diff --git a/core/entity.jai b/core/entity.jai index 6f526f7..9f14261 100644 --- a/core/entity.jai +++ b/core/entity.jai @@ -81,6 +81,9 @@ Entity :: struct { // Physics body : Physics_Body; collider : Collider; + physx_static: *PhysX.PxRigidStatic; + physx_dynamic: *PhysX.PxRigidDynamic; + // End physics #if NETWORKING { diff --git a/core/scene.jai b/core/scene.jai index 56d568e..17528b0 100644 --- a/core/scene.jai +++ b/core/scene.jai @@ -22,6 +22,8 @@ Scene :: struct { mode: Engine_Mode; + physx_scene: *PhysX.PxScene; + using custom_fields: _Custom_Scene_Fields; } @@ -142,6 +144,8 @@ unload_scene :: (scene: *Scene) { destroy_entity(e); } + PhysX.PxScene_release(scene.physx_scene); + free(scene.name); fini(*scene.pool); free(scene); @@ -191,6 +195,8 @@ create_scene :: (name: string = "", max_entities: s64 = 256) -> *Scene { array_reserve(*scene.entities, max_entities); + scene.physx_scene = create_physx_scene(); + scene.directional_light.color_and_intensity = .{1,1,1,2}; scene.directional_light.direction = to_v4(normalize(Vector3.{0.4, -0.7, 0.4})); diff --git a/module.jai b/module.jai index 76c0ae7..6e5aef0 100644 --- a/module.jai +++ b/module.jai @@ -41,8 +41,6 @@ Engine_Core :: struct { directional_light_buffer : Buffer_Handle; point_light_buffer : Buffer_Handle; - on_frustum_render: (Vector3, Vector3); - procs: struct { on_scene_loaded: (*Scene, Engine_Mode); on_pre_scene_loaded: (*Scene, Engine_Mode); @@ -85,6 +83,8 @@ coven_init :: (window_title: string, window_width: u32, window_height: u32, full init_audio_system(); init_console(); + init_physx(); + #if EDITOR { init_editor(); ui_init(); @@ -159,6 +159,7 @@ coven_run :: (game_update_proc: (float), game_editor_update_proc: (float), game_ update_animators(clamped_dt); update_mesh_colliders(engine.current_scene); update_physics(engine.current_scene, clamped_dt); + tick_physx(engine.current_scene.physx_scene, clamped_dt); game_update_post_physics_proc(clamped_dt); } } else { @@ -236,6 +237,7 @@ switch_engine_mode :: (to_mode: Engine_Mode) { #load "core/console.jai"; #load "audio/audio.jai"; #load "core/fps.jai"; +#load "physics/physx.jai"; #scope_export diff --git a/modules/PhysX/.gitignore b/modules/PhysX/.gitignore new file mode 100644 index 0000000..879f3d7 --- /dev/null +++ b/modules/PhysX/.gitignore @@ -0,0 +1,3 @@ +.build/ +.idea/ +cmake-* \ No newline at end of file diff --git a/modules/PhysX/README.md b/modules/PhysX/README.md new file mode 100644 index 0000000..b3e03ed --- /dev/null +++ b/modules/PhysX/README.md @@ -0,0 +1,26 @@ + +## Jai PhysX Bindings + +Nearly complete jai physx bindings. Based on the rust physx-sys bindings. + + +### Future Improvements + +* I'd like to have a way to pass in an allocator based on jai to the actual physx cpp wrapper library so anything allocated can be freed with jai free. + +* I want to make all integer flags in the generated api actually refer to the flag it generates. It's really annoying having to casts this all. + +* In the generator I have a function to force inheritance and I applied it to some things but not everything. It should work with everything. + +* I'd like to see if it's possible to replace the MatNN structs with jai Matrix structs. PhysX seems to be column major while jai is row major, but the physx docs somehow implied that it'll work with row major structs which I don't understand. + + +### Build + +I built this project piggy backing off of rust physx-sys which does a crazy autogen thing to create functions and structs. + +To build it again `cargo build --release` while inside the physx-sys-extract folder. Then the lib is in `target/release/deps/`. + +If you need to change the generated bindings you'll need to rerun the pxbind rust script. + +On linux I'm manually swapping the cargo.toml file in physx-sys from "staticlib" to "cdylib" to try and get back a shared library since the static doesn't seem to work. diff --git a/modules/PhysX/generate.jai b/modules/PhysX/generate.jai new file mode 100644 index 0000000..5ebcee8 --- /dev/null +++ b/modules/PhysX/generate.jai @@ -0,0 +1,484 @@ + +/* +Program Exception: SEGV_MAPERR +The program crashed because it tried to write to or read from an invalid memory location. +Segmentation fault. The faulty address is 0xffffffff00000020, from 0x328d00. +./main(physx_filter_shader_500000241+0x50) [0x328d00] +/root/FatGoblinsServer/libphysx_build.so(_Z22FilterShaderTrampolinejN5physx12PxFilterDataEjS0_RNS_7PxFlagsINS_10PxPairFlag4EnumEtEEPKvj+0x47) [0x79a2c484d277] +/root/FatGoblinsServer/libphysx_build.so(_ZN5physx2Sc10NPhaseCore17runOverlapFiltersEjPKNS_2Bp11AABBOverlapEPNS_12PxFilterInfoERjS8_S8_PjS9_+0xad6) [0x79a2c4e82 3f6] +/root/FatGoblinsServer/libphysx_build.so(_ZN17OverlapFilterTask11runInternalEv+0x45) [0x79a2c4eaa9f5] +/root/FatGoblinsServer/libphysx_build.so(_ZN5physx2Cm4Task3runEv+0x25) [0x79a2c4aff505] +/root/FatGoblinsServer/libphysx_build.so(_ZN5physx3Ext15CpuWorkerThread7executeEv+0x57) [0x79a2c4c95237] +/root/FatGoblinsServer/libphysx_build.so(+0x26c537) [0x79a2c486c537] +/lib/x86_64-linux-gnu/libc.so.6(+0x9ca94) [0x79a2c509ca94] +/lib/x86_64-linux-gnu/libc.so.6(+0x129c3c) [0x79a2c5129c3c] + + + + +Thread 6 "main" received signal SIGSEGV, Segmentation fault. +[Switching to Thread 0x7ffff1c006c0 (LWP 31950)] +0x0000000000328b50 in physx_filter_shader_70000015a (attributes0=, filterData0=..., attributes1=4055889920, + filterData1=..., pairFlags=0xffffffff00000020) + at /mnt/c/Users/Kuju/Projects/FatGoblinsServer/../FatGoblins/src/shared/physics/SharedPhysics.jai:483 +warning: 483 /mnt/c/Users/Kuju/Projects/FatGoblinsServer/../FatGoblins/src/shared/physics/SharedPhysics.jai: No such file or directory +(gdb) where +#0 0x0000000000328b50 in physx_filter_shader_70000015a (attributes0=, filterData0=..., attributes1=4055889920, + filterData1=..., pairFlags=0xffffffff00000020) + at /mnt/c/Users/Kuju/Projects/FatGoblinsServer/../FatGoblins/src/shared/physics/SharedPhysics.jai:483 +#1 0x00007ffff744d277 in FilterShaderTrampoline(unsigned int, physx::PxFilterData, unsigned int, physx::PxFilterData, physx::PxFlags&, void const*, unsigned int) () from /root/FatGoblinsServer/libphysx_build.so +#2 0x00007ffff7a823f6 in physx::Sc::NPhaseCore::runOverlapFilters(unsigned int, physx::Bp::AABBOverlap const*, physx::PxFilterInfo*, unsigned int&, unsigned int&, unsigned int&, unsigned int*, unsigned int*) () from /root/FatGoblinsServer/libphysx_build.so +#3 0x00007ffff7aaa9f5 in OverlapFilterTask::runInternal() () from /root/FatGoblinsServer/libphysx_build.so +#4 0x00007ffff76ff505 in physx::Cm::Task::run() () from /root/FatGoblinsServer/libphysx_build.so +#5 0x00007ffff7895237 in physx::Ext::CpuWorkerThread::execute() () from /root/FatGoblinsServer/libphysx_build.so +#6 0x00007ffff746c537 in physx::(anonymous namespace)::PxThreadStart(void*) () from /root/FatGoblinsServer/libphysx_build.so +#7 0x00007ffff7c9ca94 in start_thread (arg=) at ./nptl/pthread_create.c:447 +#8 0x00007ffff7d29c3c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78 +(gdb) +*/ + + + + +// windows +// linux + +// 00000000000000000000000000000000 +// 00000000000000000000000000000000 + +// 00000000000000000000000000000010111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000 +// 01011111110111111111011111000000000000000000000001110100101000010000000000000000000000000000000100000000000000000000000000000000 + +// 00000000000000000000000000000001 + +// 00000000000000000000000010000000111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000 + + + + + + +#import "Bindings_Generator"; +#import "Basic"; +#import "File"; +#import "String"; +#import "BuildCpp"; +#import "File_Utilities"; + +#run { + using opts: Generate_Bindings_Options; + // array_add(*system_include_paths, GENERATOR_DEFAULT_SYSTEM_INCLUDE_PATH); + + dependency_path: string; + #if OS == .WINDOWS { + dependency_path = "physx/physx-sys-extract/target/release/deps"; + } else #if OS == .LINUX { + dependency_path = "physx/physx-build/build"; + } + + found_lib_name: string; + // we'll now pull directly from physx-sys... because I need to compile forcing all static links or something + for file: file_list(dependency_path) { + filename: string; + filename.data = file.data + (find_index_from_right(file, "/") + 1); + filename.count = file.count - (find_index_from_right(file, "/") + 1); + #if OS == .WINDOWS { + if starts_with(filename, "physx") && ends_with(filename, ".lib") { + found_lib_name = file; + } + } else #if OS == .LINUX { + print("Checking %\n", filename); + if starts_with(filename, "libphysx") && ends_with(filename, ".so") { + found_lib_name = file; + } + } + } + if found_lib_name { + #if OS == .WINDOWS { + copy_file(found_lib_name, "windows/physx.lib"); + } else #if OS == .LINUX { + copy_file(found_lib_name, "linux/libphysx.so"); + } + } + #if OS == .WINDOWS { + if !file_exists("windows/physx.lib") { + print("Physx library doesn't exist, and could not find extracted physx library to copy.\n"); + return; + } + } else #if OS == .LINUX { + if !file_exists("linux/libphysx.so") { + print("Physx library doesn't exist, and could not find extracted physx library to copy.\n"); + return; + } + } + + #if OS == .WINDOWS { + array_add(*libpaths, "windows"); + array_add(*libnames, "physx"); + + array_add(*include_paths, "physx/physx-sys/src/generated/x86_64-pc-windows-msvc/"); + array_add(*extra_clang_arguments, "-D_MSC_VER=1939"); + array_add(*system_include_paths, "\"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/Llvm/lib/clang/17/include\""); + } else #if OS == .LINUX { + array_add(*libpaths, "linux"); + array_add(*libnames, "libphysx"); + + array_add(*extra_clang_arguments, "-D__clang__"); + array_add(*extra_clang_arguments, "-std=c++14"); + + array_add(*include_paths, "physx/physx-sys/src/generated/unix/"); + // array_add(*source_files, "/usr/include/linux/types.h"); + array_add(*system_include_paths, "/usr/lib/llvm-18/lib/clang/18/include"); + array_add(*system_include_paths, "/usr/include/c++/14"); + // array_add(*system_include_paths, ..get_default_system_include_paths(opts.os, opts.cpu)); + // array_add(*system_include_paths, "/usr/include/c++/14/tr1"); + // array_add(*system_include_paths, "/usr/include/linux"); + // array_add(*system_include_paths, "/usr/include/x86_64-linux-gnu"); + } + + array_add(*include_paths, "physx/physx-sys/src/"); + array_add(*include_paths, "physx/physx-sys/physx/physx/include/"); + + array_add(*extra_clang_arguments, "-DNDEBUG"); + + array_add(*source_files, "physx/physx-sys/physx/physx/include/PxPhysicsAPI.h"); + + array_add(*source_files, "physx/physx-sys/src/physx_api.cpp"); + + array_add(*extra_clang_arguments, "-x", "c++"); + generate_compile_time_struct_checks = false; + + convlist :: [2] string.[ + .["physx_PxVec2", "Vector2"], + .["physx_PxVec3", "Vector3"], + .["physx_PxVec4", "Vector4"], + .["physx_Vector2", "Vector2"], + .["physx_Vector3", "Vector3"], + .["physx_Vector4", "Vector4"], + .["physx_PxQuat", "Quaternion"], + .["physx_PxPlane", "Plane3"], + .["PxReal", "float"], + .["PxF32", "float"], + .["double", "float64"], + .["int8_t", "s8"], + .["char", "s8"], + .["PxI8", "s8"], + .["uint8_t", "u8"], + .["unsigned char", "u8"], + .["PxU8", "u8"], + .["int16_t", "s16"], + .["short", "s16"], + .["PxI16", "s16"], + .["uint16_t", "u16"], + .["unsigned short", "u16"], + .["PxU16", "u16"], + .["int32_t", "s32"], + .["int", "s32"], + .["PxI32", "s32"], + .["uint32_t", "u32"], + .["unsigned int", "u32"], + .["PxU32", "u32"], + .["int64_t", "s64"], + .["long", "s64"], + .["PxI64", "s64"], + .["uint64_t", "u64"], + .["unsigned long", "u64"], + .["PxU64", "u64"], + .["size_t", "u64"], + .["PxVec3", "Vector3"], + .["PxVec4", "Vector4"], + .["PxAgain", "bool"], + ]; + + remove_self_and_parents :: (decl: *Declaration) { + decl.decl_flags = .OMIT_FROM_OUTPUT; + if decl.parent { + remove_self_and_parents(decl.parent); + } + } + + opts.visitor = (decl: *Declaration, parent_decl: *Declaration) -> Declaration_Visit_Result { + filename_clang := clang_getFileName(decl.location.file); + defer clang_disposeString(filename_clang); + filename := to_lower_copy_new(to_string(clang_getCString(filename_clang)),, temp); + + // things to allow through no matter what, but it won't recurse to these necessarily since I stop in some cases + okay_things :: string.[ + "PxSimulationFilterShader", + ]; + + for okay_thing: okay_things { + if decl.name == okay_thing { + return .RECURSE; + } + } + + if contains(filename, "physx/physx/") { + if contains(decl.name, "PxSimulationFilterShader") { + print("\n\n\n\nFOUND SOMETHING... %\n\n\n\n\n", decl.*); + } + decl.decl_flags = .OMIT_FROM_OUTPUT; + return .RECURSE; + } + + for conv: convlist { + if conv[0] == decl.name { + decl.output_name = conv[1]; + decl.decl_flags = .OMIT_FROM_OUTPUT; + return .RECURSE; + } + } + + if contains(filename, "physx_api") { + if starts_with(decl.foreign_name, "?") || starts_with(decl.foreign_name, "_") { + remove_self_and_parents(decl); + return .STOP; + } + } + + // the names of the things to remove from the bindings, before the _mut and _1 stuff gets stripped + bad_things :: string.[ + "PxMat44_new_1", + "PxMat44_new_2", + "PxMat33_new_1", + "PxMat33_new_2", + "PxGeometryHolder_any", + "PxGeometryHolder_sphere", + "PxGeometryHolder_plane", + "PxGeometryHolder_capsule", + "PxGeometryHolder_box", + "PxGeometryHolder_convexMesh", + "PxGeometryHolder_tetMesh", + "PxGeometryHolder_triangleMesh", + "PxGeometryHolder_heightField", + "PxGeometryHolder_particleSystem", + "PxGeometryHolder_hairSystem", + "PxGeometryHolder_custom", + "PxSoftBodyMesh_getCollisionMesh", + "PxSoftBodyMesh_getSimulationMesh", + "PxSoftBodyMesh_getSoftBodyAuxData", + "PxCollisionTetrahedronMeshData_getMesh", + "PxCollisionTetrahedronMeshData_getData", + "PxTransform_new", + "PxQuat_new", + ]; + + for bad_thing: bad_things { + if decl.name == bad_thing { + decl.decl_flags = .OMIT_FROM_OUTPUT; + return .STOP; + } + } + + if ends_with(decl.name, "_mut") { + output_name := decl.name; + output_name.count -= 4; + decl.output_name = output_name; + } + if ends_with(decl.name, "_mut_1") || ends_with(decl.name, "_mut_2") { + output_name := decl.name; + output_name.count -= 6; + decl.output_name = output_name; + } + if ends_with(decl.name, "_1") || ends_with(decl.name, "_2") || ends_with(decl.name, "_3") || ends_with(decl.name, "_4") || ends_with(decl.name, "_5") || ends_with(decl.name, "_6") || ends_with(decl.name, "_7") || ends_with(decl.name, "_8") || ends_with(decl.name, "_9") { + output_name := decl.name; + output_name.count -= 2; + decl.output_name = output_name; + } + if ends_with(decl.name, "_10") { + output_name := decl.name; + output_name.count -= 3; + decl.output_name = output_name; + } + if starts_with(decl.name, "physx_") { + output_name := decl.name; + output_name.data += 6; + output_name.count -= 6; + decl.output_name = output_name; + } + if starts_with(decl.name, "phys_") { + output_name := decl.name; + output_name.data += 5; + output_name.count -= 5; + decl.output_name = output_name; + } + + return .RECURSE; + }; + + header = read_entire_file("generate_enums.jai"); + + footer = #string ___jai +#import "Math"; +#import "Socket"; + ___jai + + string_builder := generate_bindings(opts, true); + output := builder_to_string(*string_builder); + output = replace_and_free(output, "physx.PxFilterObjectAttributes", "u32"); + output = replace_and_free(output, "physx.PxFilterObjectAttributes", "u32"); + output = replace_and_free(output, "physx.PxFilterObjectAttributes", "u32"); + output = replace_and_free(output, "physx.float", "float"); + output = replace_and_free(output, "physx.float64", "float64"); + output = replace_and_free(output, "physx.s8", "s8"); + output = replace_and_free(output, "physx.u8", "u8"); + output = replace_and_free(output, "physx.s16", "s16"); + output = replace_and_free(output, "physx.u16", "u16"); + output = replace_and_free(output, "physx.s32", "s32"); + output = replace_and_free(output, "physx.u32", "u32"); + output = replace_and_free(output, "physx.s64", "s64"); + output = replace_and_free(output, "physx.u64", "u64"); + output = replace_and_free(output, "physx.PxVec2", "Vector3"); + output = replace_and_free(output, "physx.Vector3", "Vector3"); + output = replace_and_free(output, "physx.Vector4", "Vector4"); + output = replace_and_free(output, "physx.Matrix3", "Matrix3"); + output = replace_and_free(output, "physx.Matrix4", "Matrix4"); + output = replace_and_free(output, "physx.bool", "bool"); + output = replace_and_free(output, "physx.PxQuat", "Quaternion"); + output = replace_and_free(output, "physx.PxPlane", "Plane3"); + output = replace_and_free(output, "physx.PxI16", "s16"); + output = replace_and_free(output, "physx.PxU16", "u16"); + output = replace_and_free(output, "physx.PxI32", "s32"); + output = replace_and_free(output, "physx.PxU32", "u32"); + output = replace_and_free(output, "physx.PxAgain", "bool"); + // change the function mapping names to something that won't get replaced + output = replace_and_free(output, "\"physx_", "\"PHYSX_"); + output = replace_and_free(output, "physx.", "physx_"); + output = replace_and_free(output, "physx_", ""); + // change the function mapping names back + output = replace_and_free(output, "\"PHYSX_", "\"physx_"); + output = replace_and_free(output, "__pod", ""); + output = replace_and_free(output, "_pod", ""); + output = replace_and_free(output, "context:", "context_pod:"); + output = force_inheritance(output, "#place structgen_pad0; #as geometry: PxGeometry = ---;", .[ + "PxBoxGeometry", + "PxCapsuleGeometry", + "PxConvexMeshGeometry", + "PxSphereGeometry", + "PxPlaneGeometry", + "PxTriangleMeshGeometry", + "PxHeightFieldGeometry", + "PxParticleSystemGeometry", + "PxHairSystemGeometry", + "PxTetrahedronMeshGeometry", + "PxCustomGeometry", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as actor: PxActor = ---;", .[ + "PxRigidActor", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as rigid_actor: PxRigidActor = ---;", .[ + "PxRigidStatic", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as rigid_actor: PxRigidActor = ---;", .[ + "PxRigidBody", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as rigid_body: PxRigidBody = ---;", .[ + "PxRigidDynamic", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as rigid_body: PxRigidBody = ---;", .[ + "PxArticulationLink", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as base: PxBase = ---;", .[ + "PxRefCounted", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as ref_counted: PxRefCounted = ---;", .[ + "PxBaseMaterial", + "PxConvexMesh", + "PxHeightField", + "PxShape", + "PxSoftBodyAuxData", + "PxSoftBodyMesh", + "PxTetrahedronMesh", + "PxTriangleMesh", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as base_material: PxBaseMaterial = ---;", .[ + "PxMaterial", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as controller_desc: PxControllerDesc = ---;", .[ + "PxBoxControllerDesc", + "PxCapsuleControllerDesc", + ]); + output = force_inheritance(output, "#place vtable_; #as controller: PxController = ---;", .[ + "PxBoxController", + "PxCapsuleController", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as base: PxBase = ---;", .[ + "PxJoint", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as joint: PxJoint = ---;", .[ + "PxContactJoint", + "PxD6Joint", + "PxDistanceJoint", + "PxFixedJoint", + "PxPrismaticJoint", + "PxRevoluteJoint", + "PxSphericalJoint", + "PxGearJoint", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as output_stream: PxOutputStream = ---;", .[ + "PxDefaultMemoryOutputStream", + ]); + output = force_inheritance(output, "#place structgen_pad0; #as input_stream: PxInputStream = ---;", .[ + "PxDefaultMemoryInputData", + ]); + + #if OS == .WINDOWS { + write_entire_file("module_windows.jai", output); + } else #if OS == .LINUX { + write_entire_file("module_linux.jai", output); + } +} + +replace_and_free :: (input: string, old: string, new: string) -> string { + output := replace(input, old, new); + free(input); + return output; +} + +force_inheritance :: (input: string, place: string, struct_names: [] string) -> string { + current := input; + + struct_part :: " :: struct {"; + for struct_name: struct_names { + index := 0; + while index < current.count - struct_name.count - struct_part.count { + potential_name: string; + potential_name.data = current.data + index; + potential_name.count = struct_name.count; + + if potential_name == struct_name { + potential_struct_part: string; + potential_struct_part.data = potential_name.data + potential_name.count; + potential_struct_part.count = struct_part.count; + + if potential_struct_part == struct_part { + last_colon := index; + while current[index] != #char "}" { + if current[index] == #char ";" { + last_colon = index; + } + + index += 1; + } + + first_string: string; + first_string.data = current.data; + first_string.count = last_colon + 1; + second_string: string; + second_string.data = current.data + (last_colon + 1); + second_string.count = current.count - (last_colon + 1); + + old_current := current; + current = sprint("%1\n%2%3", first_string, place, second_string); + free(old_current); + + continue struct_name; + } + } + + index += 1; + } + } + + return current; +} diff --git a/modules/PhysX/generate_enums.jai b/modules/PhysX/generate_enums.jai new file mode 100644 index 0000000..f7a3b61 --- /dev/null +++ b/modules/PhysX/generate_enums.jai @@ -0,0 +1,694 @@ + +PxEMPTY :: enum s32 { + PxEmpty :: 0; +} + +PxZERO :: enum s32 { + PxZero :: 0; +} + +PxIDENTITY :: enum s32 { + PxIdentity :: 0; +} + +PxErrorCode :: enum_flags s32 { + NoError :: 0; + DebugInfo :: 1; + DebugWarning :: 2; + InvalidParameter :: 4; + InvalidOperation :: 8; + OutOfMemory :: 16; + InternalError :: 32; + Abort :: 64; + PerfWarning :: 128; + MaskAll :: -1; +} + +PxThreadPriority :: enum u32 { + High :: 0; + AboveNormal :: 1; + Normal :: 2; + BelowNormal :: 3; + Low :: 4; + ForceDword :: 4294967295; +} + +PxDebugColor :: enum u32 { + ArgbBlack :: 4278190080; + ArgbRed :: 4294901760; + ArgbGreen :: 4278255360; + ArgbBlue :: 4278190335; + ArgbYellow :: 4294967040; + ArgbMagenta :: 4294902015; + ArgbCyan :: 4278255615; + ArgbWhite :: 4294967295; + ArgbGrey :: 4286611584; + ArgbDarkred :: 4287102976; + ArgbDarkgreen :: 4278224896; + ArgbDarkblue :: 4278190216; +} + +PxConcreteType :: enum s32 { + Undefined :: 0; + Heightfield :: 1; + ConvexMesh :: 2; + TriangleMeshBvh33 :: 3; + TriangleMeshBvh34 :: 4; + TetrahedronMesh :: 5; + SoftbodyMesh :: 6; + RigidDynamic :: 7; + RigidStatic :: 8; + Shape :: 9; + Material :: 10; + SoftbodyMaterial :: 11; + ClothMaterial :: 12; + PbdMaterial :: 13; + FlipMaterial :: 14; + MpmMaterial :: 15; + CustomMaterial :: 16; + Constraint :: 17; + Aggregate :: 18; + ArticulationReducedCoordinate :: 19; + ArticulationLink :: 20; + ArticulationJointReducedCoordinate :: 21; + ArticulationSensor :: 22; + ArticulationSpatialTendon :: 23; + ArticulationFixedTendon :: 24; + ArticulationAttachment :: 25; + ArticulationTendonJoint :: 26; + PruningStructure :: 27; + Bvh :: 28; + SoftBody :: 29; + SoftBodyState :: 30; + PbdParticlesystem :: 31; + FlipParticlesystem :: 32; + MpmParticlesystem :: 33; + CustomParticlesystem :: 34; + FemCloth :: 35; + HairSystem :: 36; + ParticleBuffer :: 37; + ParticleDiffuseBuffer :: 38; + ParticleClothBuffer :: 39; + ParticleRigidBuffer :: 40; + PhysxCoreCount :: 41; + FirstPhysxExtension :: 256; + FirstVehicleExtension :: 512; + FirstUserExtension :: 1024; +} + +PxBaseFlags :: enum_flags u16 { + OwnsMemory :: 1 << 0; + IsReleasable :: 1 << 1; +} + +PxMetaDataFlag :: enum_flags s32 { + Class :: 1; + Virtual :: 2; + Typedef :: 4; + Ptr :: 8; + Handle :: 16; + ExtraData :: 32; + ExtraItem :: 64; + ExtraItems :: 128; + ExtraName :: 256; + Union :: 512; + Padding :: 1024; + Alignment :: 2048; + CountMaskMsb :: 4096; + CountSkipIfOne :: 8192; + ControlFlip :: 16384; + ControlMask :: 32768; + ControlMaskRange :: 255; + ForceDword :: 2147483647; +} + +PxTaskType :: enum s32 { + Cpu :: 0; + NotPresent :: 1; + Completed :: 2; +} + +PxGeometryType :: enum s32 { + Sphere :: 0; + Plane :: 1; + Capsule :: 2; + Box :: 3; + Convexmesh :: 4; + Particlesystem :: 5; + Tetrahedronmesh :: 6; + Trianglemesh :: 7; + Heightfield :: 8; + Hairsystem :: 9; + Custom :: 10; + GeometryCount :: 11; + Invalid :: -1; +} + +PxGeometryQueryFlags :: enum_flags u32 { + SimdGuard :: 1 << 0; +} + +PxBVHBuildStrategy :: enum s32 { + Fast :: 0; + Default :: 1; + Sah :: 2; + Last :: 3; +} + +PxConvexMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; +} + +PxMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; + DoubleSided :: 1 << 1; +} + +PxParticleSolverType :: enum_flags s32 { + Pbd :: 1; + Flip :: 2; + Mpm :: 4; + Custom :: 8; +} + +PxHitFlags :: enum_flags u16 { + 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 :: PxHitFlags.Position | PxHitFlags.Normal | PxHitFlags.FaceIndex; + ModifiableFlags :: PxHitFlags.AssumeNoInitialOverlap | PxHitFlags.MeshMultiple | PxHitFlags.MeshBothSides | PxHitFlags.PreciseSweep; +} + +PxHeightFieldFormat :: enum s32 { + S16Tm :: 1; +} + +PxHeightFieldTessFlag :: enum_flags s32 { + E0ThVertexShared :: 1; +} + +PxHeightFieldFlags :: enum_flags u16 { + NoBoundaryEdges :: 1 << 0; +} + +PxHeightFieldMaterial :: enum s32 { + Hole :: 127; +} + +PxMeshMeshQueryFlags :: enum_flags u32 { + Default :: 0; + DiscardCoplanar :: 1 << 0; +} + +PxMeshFlags :: enum_flags u16 { + Flipnormals :: 1 << 0; + E16BitIndices :: 1 << 1; +} + +PxMeshMidPhase :: enum s32 { + Bvh33 :: 0; + Bvh34 :: 1; + Last :: 2; +} + +PxTriangleMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; + AdjacencyInfo :: 1 << 2; + PreferNoSdfProj :: 1 << 3; +} + +PxTetrahedronMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; +} + +PxActorFlags :: enum_flags u8 { + Visualization :: 1 << 0; + DisableGravity :: 1 << 1; + SendSleepNotifies :: 1 << 2; + DisableSimulation :: 1 << 3; +} + +PxActorType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + ArticulationLink :: 2; +} + +PxAggregateType :: enum s32 { + Generic :: 0; + Static :: 1; + Kinematic :: 2; +} + +Px1DConstraintFlags :: enum_flags u16 { + Spring :: 1 << 0; + AccelerationSpring :: 1 << 1; + Restitution :: 1 << 2; + Keepbias :: 1 << 3; + OutputForce :: 1 << 4; + HasDriveLimit :: 1 << 5; + AngularConstraint :: 1 << 6; + DriveRow :: 1 << 7; +} + +PxConstraintSolveHint :: enum s32 { + None :: 0; + Acceleration1 :: 256; + SlerpSpring :: 258; + Acceleration2 :: 512; + Acceleration3 :: 768; + RotationalEquality :: 1024; + RotationalInequality :: 1025; + Equality :: 2048; + Inequality :: 2049; +} + +PxConstraintVisualizationFlag :: enum_flags s32 { + LocalFrames :: 1; + Limits :: 2; +} + +PxPvdUpdateType :: enum s32 { + CreateInstance :: 0; + ReleaseInstance :: 1; + UpdateAllProperties :: 2; + UpdateSimProperties :: 3; +} + +ConstraintType :: enum s32 { + ContactConstraint :: 0; + JointConstraint :: 1; +} + +BodyState :: enum_flags s32 { + DynamicBody :: 1; + StaticBody :: 2; + KinematicBody :: 4; + Articulation :: 8; +} + +PxArticulationAxis :: enum s32 { + Twist :: 0; + Swing1 :: 1; + Swing2 :: 2; + X :: 3; + Y :: 4; + Z :: 5; + Count :: 6; +} + +PxArticulationMotions :: enum_flags u8 { + Locked :: 0; + Limited :: 1 << 0; + Free :: 1 << 1; +} + +PxArticulationJointType :: enum s32 { + Fix :: 0; + Prismatic :: 1; + Revolute :: 2; + RevoluteUnwrapped :: 3; + Spherical :: 4; + Undefined :: 5; +} + +PxArticulationFlags :: enum_flags u8 { + FixBase :: 1 << 0; + DriveLimitsAreForces :: 1 << 1; + DisableSelfCollision :: 1 << 2; + ComputeJointForces :: 1 << 3; +} + +PxArticulationDriveType :: enum s32 { + Force :: 0; + Acceleration :: 1; + Target :: 2; + Velocity :: 3; + None :: 4; +} + +PxArticulationGpuDataType :: enum s32 { + JointPosition :: 0; + JointVelocity :: 1; + JointAcceleration :: 2; + JointForce :: 3; + JointSolverForce :: 4; + JointTargetVelocity :: 5; + JointTargetPosition :: 6; + SensorForce :: 7; + RootTransform :: 8; + RootVelocity :: 9; + LinkTransform :: 10; + LinkVelocity :: 11; + LinkForce :: 12; + LinkTorque :: 13; + FixedTendon :: 14; + FixedTendonJoint :: 15; + SpatialTendon :: 16; + SpatialTendonAttachment :: 17; +} + +PxArticulationCacheFlags :: enum_flags u32 { + 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 :: PxArticulationCacheFlags.Velocity | PxArticulationCacheFlags.Acceleration | PxArticulationCacheFlags.Position | PxArticulationCacheFlags.LinkVelocity | PxArticulationCacheFlags.LinkAcceleration | PxArticulationCacheFlags.RootTransform | PxArticulationCacheFlags.RootVelocities; +} + +PxArticulationSensorFlags :: enum_flags u8 { + ForwardDynamicsForces :: 1 << 0; + ConstraintSolverForces :: 1 << 1; + WorldFrame :: 1 << 2; +} + +PxArticulationKinematicFlags :: enum_flags u8 { + Position :: 1 << 0; + Velocity :: 1 << 1; +} + +PxShapeFlags :: enum_flags u8 { + SimulationShape :: 1 << 0; + SceneQueryShape :: 1 << 1; + TriggerShape :: 1 << 2; + Visualization :: 1 << 3; +} + +PxForceMode :: enum s32 { + Force :: 0; + Impulse :: 1; + VelocityChange :: 2; + Acceleration :: 3; +} + +PxRigidBodyFlags :: enum_flags u16 { + 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; +} + +PxConstraintFlags :: enum_flags u16 { + Broken :: 1 << 0; + ProjectToActor0 :: 1 << 1; + ProjectToActor1 :: 1 << 2; + Projection :: PxConstraintFlags.ProjectToActor0 | PxConstraintFlags.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; +} + +PxContactPatchFlags :: enum_flags s32 { + HasFaceIndices :: 1; + Modifiable :: 2; + ForceNoResponse :: 4; + HasModifiedMassRatios :: 8; + HasTargetVelocity :: 16; + HasMaxImpulse :: 32; + RegeneratePatches :: 64; + CompressedModifiedContact :: 128; +} + +StreamFormat :: enum s32 { + SimpleStream :: 0; + ModifiableStream :: 1; + CompressedModifiableStream :: 2; +} + +PxDeletionEventFlags :: enum_flags u8 { + UserRelease :: 1 << 0; + MemoryRelease :: 1 << 1; +} + +PxPairFlags :: enum_flags u16 { + 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 :: PxPairFlags.SolveContact | PxPairFlags.DetectDiscreteContact; + TriggerDefault :: PxPairFlags.NotifyTouchFound | PxPairFlags.NotifyTouchLost | PxPairFlags.DetectDiscreteContact; +} + +PxFilterFlags :: enum_flags u16 { + Default :: 0; + Kill :: 1 << 0; + Suppress :: 1 << 1; + Callback :: 1 << 2; + Notify :: PxFilterFlags.Callback; +} + +PxFilterObjectType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + Articulation :: 2; + Particlesystem :: 3; + Softbody :: 4; + Femcloth :: 5; + Hairsystem :: 6; + MaxTypeCount :: 16; + Undefined :: 15; +} + +PxFilterObjectFlag :: enum_flags s32 { + Kinematic :: 16; + Trigger :: 32; +} + +PxPairFilteringMode :: enum s32 { + Keep :: 0; + Suppress :: 1; + Kill :: 2; +} + +PxDataAccessFlags :: enum_flags u8 { + Readable :: 1 << 0; + Writable :: 1 << 1; + Device :: 1 << 2; +} + +PxMaterialFlags :: enum_flags u16 { + DisableFriction :: 1 << 0; + DisableStrongFriction :: 1 << 1; + ImprovedPatchFriction :: 1 << 2; + CompliantContact :: 1 << 3; +} + +PxRigidDynamicLockFlags :: enum_flags u8 { + LockLinearX :: 1 << 0; + LockLinearY :: 1 << 1; + LockLinearZ :: 1 << 2; + LockAngularX :: 1 << 3; + LockAngularY :: 1 << 4; + LockAngularZ :: 1 << 5; +} + +PxSceneFlags :: enum_flags u32 { + 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; +} + +PxConvexFlags :: enum_flags u16 { + 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; +} + +PxConvexMeshCookingResult :: enum s32 { + /// Convex mesh cooking succeeded. + Success :: 0; + /// Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + ZeroAreaTestFailed :: 1; + /// Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + /// The produced hull does not contain all input vertices. Try to simplify the input vertices + /// or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + PolygonsLimitReached :: 2; + /// Something unrecoverable happened. Check the error stream to find out what. + Failure :: 3; +} + +PxDefaultCpuDispatcherWaitForWorkMode :: enum s32 { + WaitForWork :: 0; + YieldThread :: 1; + YieldProcessor :: 2; +} + +PxControllerShapeType :: enum s32 { + /// A box controller. + Box :: 0; + /// A capsule controller + Capsule :: 1; + /// A capsule controller + ForceDword :: 2147483647; +} + +PxControllerNonWalkableMode :: enum s32 { + /// Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + PreventClimbing :: 0; + /// Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + PreventClimbingAndForceSliding :: 1; +} + +PxControllerCollisionFlags :: enum_flags u8 { + CollisionSides :: 1 << 0; + CollisionUp :: 1 << 1; + CollisionDown :: 1 << 2; +} + +PxCapsuleClimbingMode :: enum s32 { + /// Standard mode, let the capsule climb over surfaces according to impact normal + Easy :: 0; + /// Constrained mode, try to limit climbing according to the step offset + Constrained :: 1; + Last :: 2; +} + +PxControllerBehaviorFlags :: enum_flags u8 { + /// Controller can ride on touched object (i.e. when this touched object is moving horizontally). + /// + /// The CCT vs. CCT case is not supported. + CctCanRideOnObject :: 1; + /// Controller should slide on touched object + CctSlide :: 2; + /// Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + CctUserDefinedRide :: 4; +} + +PxQueryHitType :: enum s32 { + /// the query should ignore this shape + None :: 0; + /// a hit on the shape touches the intersection geometry of the query but does not block it + Touch :: 1; + /// a hit on the shape blocks the query (does not block overlap queries) + Block :: 2; +} + +PxQueryFlags :: enum_flags u16 { + Static :: 1 << 0; + Dynamic :: 1 << 1; + Prefilter :: 1 << 2; + Postfilter :: 1 << 3; + AnyHit :: 1 << 4; + NoBlock :: 1 << 5; + DisableHardcodedFilter :: 1 << 6; + Reserved :: 1 << 15; +} + +PxBroadPhaseType :: enum s32 { + /// 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; +} + +PxCombineMode :: enum s32 { + /// Average: (a + b)/2 + Average :: 0; + /// Minimum: minimum(a,b) + Min :: 1; + /// Multiply: a*b + Multiply :: 2; + /// Maximum: maximum(a,b) + Max :: 3; +} + +PxD6Axis :: enum s32 { + /// motion along the X axis + X :: 0; + /// motion along the Y axis + Y :: 1; + /// motion along the Z axis + Z :: 2; + /// motion around the X axis + Twist :: 3; + /// motion around the Y axis + Swing1 :: 4; + /// motion around the Z axis + Swing2 :: 5; + Count :: 6; +} + +PxD6Motion :: enum s32 { + /// The DOF is locked, it does not allow relative motion. + Locked :: 0; + /// The DOF is limited, it only allows motion within a specific range. + Limited :: 1; + /// The DOF is free and has its full range of motion. + Free :: 2; +} + +PxRevoluteJointFlags :: enum_flags u16 { + LimitEnabled :: 1 << 0; + DriveEnabled :: 1 << 1; + DriveFreespin :: 1 << 2; +} + +PxDistanceJointFlags :: enum_flags u16 { + MaxDistanceEnabled :: 1 << 1; + MinDistanceEnabled :: 1 << 2; + SpringEnabled :: 1 << 3; +} diff --git a/modules/PhysX/linux/libphysx.so b/modules/PhysX/linux/libphysx.so new file mode 100644 index 0000000..31e37d9 Binary files /dev/null and b/modules/PhysX/linux/libphysx.so differ diff --git a/modules/PhysX/module.jai b/modules/PhysX/module.jai new file mode 100644 index 0000000..86a6321 --- /dev/null +++ b/modules/PhysX/module.jai @@ -0,0 +1,6 @@ + +#if OS == .WINDOWS { + #load "module_windows.jai"; +} else #if OS == .LINUX { + #load "module_linux.jai"; +} \ No newline at end of file diff --git a/modules/PhysX/module_linux.jai b/modules/PhysX/module_linux.jai new file mode 100644 index 0000000..f1f4656 --- /dev/null +++ b/modules/PhysX/module_linux.jai @@ -0,0 +1,6990 @@ +// +// This file was auto-generated using the following command: +// +// jai generate.jai +// + +PxEMPTY :: enum s32 { + PxEmpty :: 0; +} + +PxZERO :: enum s32 { + PxZero :: 0; +} + +PxIDENTITY :: enum s32 { + PxIdentity :: 0; +} + +PxErrorCode :: enum_flags s32 { + NoError :: 0; + DebugInfo :: 1; + DebugWarning :: 2; + InvalidParameter :: 4; + InvalidOperation :: 8; + OutOfMemory :: 16; + InternalError :: 32; + Abort :: 64; + PerfWarning :: 128; + MaskAll :: -1; +} + +PxThreadPriority :: enum u32 { + High :: 0; + AboveNormal :: 1; + Normal :: 2; + BelowNormal :: 3; + Low :: 4; + ForceDword :: 4294967295; +} + +PxDebugColor :: enum u32 { + ArgbBlack :: 4278190080; + ArgbRed :: 4294901760; + ArgbGreen :: 4278255360; + ArgbBlue :: 4278190335; + ArgbYellow :: 4294967040; + ArgbMagenta :: 4294902015; + ArgbCyan :: 4278255615; + ArgbWhite :: 4294967295; + ArgbGrey :: 4286611584; + ArgbDarkred :: 4287102976; + ArgbDarkgreen :: 4278224896; + ArgbDarkblue :: 4278190216; +} + +PxConcreteType :: enum s32 { + Undefined :: 0; + Heightfield :: 1; + ConvexMesh :: 2; + TriangleMeshBvh33 :: 3; + TriangleMeshBvh34 :: 4; + TetrahedronMesh :: 5; + SoftbodyMesh :: 6; + RigidDynamic :: 7; + RigidStatic :: 8; + Shape :: 9; + Material :: 10; + SoftbodyMaterial :: 11; + ClothMaterial :: 12; + PbdMaterial :: 13; + FlipMaterial :: 14; + MpmMaterial :: 15; + CustomMaterial :: 16; + Constraint :: 17; + Aggregate :: 18; + ArticulationReducedCoordinate :: 19; + ArticulationLink :: 20; + ArticulationJointReducedCoordinate :: 21; + ArticulationSensor :: 22; + ArticulationSpatialTendon :: 23; + ArticulationFixedTendon :: 24; + ArticulationAttachment :: 25; + ArticulationTendonJoint :: 26; + PruningStructure :: 27; + Bvh :: 28; + SoftBody :: 29; + SoftBodyState :: 30; + PbdParticlesystem :: 31; + FlipParticlesystem :: 32; + MpmParticlesystem :: 33; + CustomParticlesystem :: 34; + FemCloth :: 35; + HairSystem :: 36; + ParticleBuffer :: 37; + ParticleDiffuseBuffer :: 38; + ParticleClothBuffer :: 39; + ParticleRigidBuffer :: 40; + PhysxCoreCount :: 41; + FirstPhysxExtension :: 256; + FirstVehicleExtension :: 512; + FirstUserExtension :: 1024; +} + +PxBaseFlags :: enum_flags u16 { + OwnsMemory :: 1 << 0; + IsReleasable :: 1 << 1; +} + +PxMetaDataFlag :: enum_flags s32 { + Class :: 1; + Virtual :: 2; + Typedef :: 4; + Ptr :: 8; + Handle :: 16; + ExtraData :: 32; + ExtraItem :: 64; + ExtraItems :: 128; + ExtraName :: 256; + Union :: 512; + Padding :: 1024; + Alignment :: 2048; + CountMaskMsb :: 4096; + CountSkipIfOne :: 8192; + ControlFlip :: 16384; + ControlMask :: 32768; + ControlMaskRange :: 255; + ForceDword :: 2147483647; +} + +PxTaskType :: enum s32 { + Cpu :: 0; + NotPresent :: 1; + Completed :: 2; +} + +PxGeometryType :: enum s32 { + Sphere :: 0; + Plane :: 1; + Capsule :: 2; + Box :: 3; + Convexmesh :: 4; + Particlesystem :: 5; + Tetrahedronmesh :: 6; + Trianglemesh :: 7; + Heightfield :: 8; + Hairsystem :: 9; + Custom :: 10; + GeometryCount :: 11; + Invalid :: -1; +} + +PxGeometryQueryFlags :: enum_flags u32 { + SimdGuard :: 1 << 0; +} + +PxBVHBuildStrategy :: enum s32 { + Fast :: 0; + Default :: 1; + Sah :: 2; + Last :: 3; +} + +PxConvexMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; +} + +PxMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; + DoubleSided :: 1 << 1; +} + +PxParticleSolverType :: enum_flags s32 { + Pbd :: 1; + Flip :: 2; + Mpm :: 4; + Custom :: 8; +} + +PxHitFlags :: enum_flags u16 { + 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 :: PxHitFlags.Position | PxHitFlags.Normal | PxHitFlags.FaceIndex; + ModifiableFlags :: PxHitFlags.AssumeNoInitialOverlap | PxHitFlags.MeshMultiple | PxHitFlags.MeshBothSides | PxHitFlags.PreciseSweep; +} + +PxHeightFieldFormat :: enum s32 { + S16Tm :: 1; +} + +PxHeightFieldTessFlag :: enum_flags s32 { + E0ThVertexShared :: 1; +} + +PxHeightFieldFlags :: enum_flags u16 { + NoBoundaryEdges :: 1 << 0; +} + +PxHeightFieldMaterial :: enum s32 { + Hole :: 127; +} + +PxMeshMeshQueryFlags :: enum_flags u32 { + Default :: 0; + DiscardCoplanar :: 1 << 0; +} + +PxMeshFlags :: enum_flags u16 { + Flipnormals :: 1 << 0; + E16BitIndices :: 1 << 1; +} + +PxMeshMidPhase :: enum s32 { + Bvh33 :: 0; + Bvh34 :: 1; + Last :: 2; +} + +PxTriangleMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; + AdjacencyInfo :: 1 << 2; + PreferNoSdfProj :: 1 << 3; +} + +PxTetrahedronMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; +} + +PxActorFlags :: enum_flags u8 { + Visualization :: 1 << 0; + DisableGravity :: 1 << 1; + SendSleepNotifies :: 1 << 2; + DisableSimulation :: 1 << 3; +} + +PxActorType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + ArticulationLink :: 2; +} + +PxAggregateType :: enum s32 { + Generic :: 0; + Static :: 1; + Kinematic :: 2; +} + +Px1DConstraintFlags :: enum_flags u16 { + Spring :: 1 << 0; + AccelerationSpring :: 1 << 1; + Restitution :: 1 << 2; + Keepbias :: 1 << 3; + OutputForce :: 1 << 4; + HasDriveLimit :: 1 << 5; + AngularConstraint :: 1 << 6; + DriveRow :: 1 << 7; +} + +PxConstraintSolveHint :: enum s32 { + None :: 0; + Acceleration1 :: 256; + SlerpSpring :: 258; + Acceleration2 :: 512; + Acceleration3 :: 768; + RotationalEquality :: 1024; + RotationalInequality :: 1025; + Equality :: 2048; + Inequality :: 2049; +} + +PxConstraintVisualizationFlag :: enum_flags s32 { + LocalFrames :: 1; + Limits :: 2; +} + +PxPvdUpdateType :: enum s32 { + CreateInstance :: 0; + ReleaseInstance :: 1; + UpdateAllProperties :: 2; + UpdateSimProperties :: 3; +} + +ConstraintType :: enum s32 { + ContactConstraint :: 0; + JointConstraint :: 1; +} + +BodyState :: enum_flags s32 { + DynamicBody :: 1; + StaticBody :: 2; + KinematicBody :: 4; + Articulation :: 8; +} + +PxArticulationAxis :: enum s32 { + Twist :: 0; + Swing1 :: 1; + Swing2 :: 2; + X :: 3; + Y :: 4; + Z :: 5; + Count :: 6; +} + +PxArticulationMotions :: enum_flags u8 { + Locked :: 0; + Limited :: 1 << 0; + Free :: 1 << 1; +} + +PxArticulationJointType :: enum s32 { + Fix :: 0; + Prismatic :: 1; + Revolute :: 2; + RevoluteUnwrapped :: 3; + Spherical :: 4; + Undefined :: 5; +} + +PxArticulationFlags :: enum_flags u8 { + FixBase :: 1 << 0; + DriveLimitsAreForces :: 1 << 1; + DisableSelfCollision :: 1 << 2; + ComputeJointForces :: 1 << 3; +} + +PxArticulationDriveType :: enum s32 { + Force :: 0; + Acceleration :: 1; + Target :: 2; + Velocity :: 3; + None :: 4; +} + +PxArticulationGpuDataType :: enum s32 { + JointPosition :: 0; + JointVelocity :: 1; + JointAcceleration :: 2; + JointForce :: 3; + JointSolverForce :: 4; + JointTargetVelocity :: 5; + JointTargetPosition :: 6; + SensorForce :: 7; + RootTransform :: 8; + RootVelocity :: 9; + LinkTransform :: 10; + LinkVelocity :: 11; + LinkForce :: 12; + LinkTorque :: 13; + FixedTendon :: 14; + FixedTendonJoint :: 15; + SpatialTendon :: 16; + SpatialTendonAttachment :: 17; +} + +PxArticulationCacheFlags :: enum_flags u32 { + 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 :: PxArticulationCacheFlags.Velocity | PxArticulationCacheFlags.Acceleration | PxArticulationCacheFlags.Position | PxArticulationCacheFlags.LinkVelocity | PxArticulationCacheFlags.LinkAcceleration | PxArticulationCacheFlags.RootTransform | PxArticulationCacheFlags.RootVelocities; +} + +PxArticulationSensorFlags :: enum_flags u8 { + ForwardDynamicsForces :: 1 << 0; + ConstraintSolverForces :: 1 << 1; + WorldFrame :: 1 << 2; +} + +PxArticulationKinematicFlags :: enum_flags u8 { + Position :: 1 << 0; + Velocity :: 1 << 1; +} + +PxShapeFlags :: enum_flags u8 { + SimulationShape :: 1 << 0; + SceneQueryShape :: 1 << 1; + TriggerShape :: 1 << 2; + Visualization :: 1 << 3; +} + +PxForceMode :: enum s32 { + Force :: 0; + Impulse :: 1; + VelocityChange :: 2; + Acceleration :: 3; +} + +PxRigidBodyFlags :: enum_flags u16 { + 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; +} + +PxConstraintFlags :: enum_flags u16 { + Broken :: 1 << 0; + ProjectToActor0 :: 1 << 1; + ProjectToActor1 :: 1 << 2; + Projection :: PxConstraintFlags.ProjectToActor0 | PxConstraintFlags.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; +} + +PxContactPatchFlags :: enum_flags s32 { + HasFaceIndices :: 1; + Modifiable :: 2; + ForceNoResponse :: 4; + HasModifiedMassRatios :: 8; + HasTargetVelocity :: 16; + HasMaxImpulse :: 32; + RegeneratePatches :: 64; + CompressedModifiedContact :: 128; +} + +StreamFormat :: enum s32 { + SimpleStream :: 0; + ModifiableStream :: 1; + CompressedModifiableStream :: 2; +} + +PxDeletionEventFlags :: enum_flags u8 { + UserRelease :: 1 << 0; + MemoryRelease :: 1 << 1; +} + +PxPairFlags :: enum_flags u16 { + 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 :: PxPairFlags.SolveContact | PxPairFlags.DetectDiscreteContact; + TriggerDefault :: PxPairFlags.NotifyTouchFound | PxPairFlags.NotifyTouchLost | PxPairFlags.DetectDiscreteContact; +} + +PxFilterFlags :: enum_flags u16 { + Default :: 0; + Kill :: 1 << 0; + Suppress :: 1 << 1; + Callback :: 1 << 2; + Notify :: PxFilterFlags.Callback; +} + +PxFilterObjectType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + Articulation :: 2; + Particlesystem :: 3; + Softbody :: 4; + Femcloth :: 5; + Hairsystem :: 6; + MaxTypeCount :: 16; + Undefined :: 15; +} + +PxFilterObjectFlag :: enum_flags s32 { + Kinematic :: 16; + Trigger :: 32; +} + +PxPairFilteringMode :: enum s32 { + Keep :: 0; + Suppress :: 1; + Kill :: 2; +} + +PxDataAccessFlags :: enum_flags u8 { + Readable :: 1 << 0; + Writable :: 1 << 1; + Device :: 1 << 2; +} + +PxMaterialFlags :: enum_flags u16 { + DisableFriction :: 1 << 0; + DisableStrongFriction :: 1 << 1; + ImprovedPatchFriction :: 1 << 2; + CompliantContact :: 1 << 3; +} + +PxRigidDynamicLockFlags :: enum_flags u8 { + LockLinearX :: 1 << 0; + LockLinearY :: 1 << 1; + LockLinearZ :: 1 << 2; + LockAngularX :: 1 << 3; + LockAngularY :: 1 << 4; + LockAngularZ :: 1 << 5; +} + +PxSceneFlags :: enum_flags u32 { + 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; +} + +PxConvexFlags :: enum_flags u16 { + 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; +} + +PxConvexMeshCookingResult :: enum s32 { + /// Convex mesh cooking succeeded. + Success :: 0; + /// Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + ZeroAreaTestFailed :: 1; + /// Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + /// The produced hull does not contain all input vertices. Try to simplify the input vertices + /// or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + PolygonsLimitReached :: 2; + /// Something unrecoverable happened. Check the error stream to find out what. + Failure :: 3; +} + +PxDefaultCpuDispatcherWaitForWorkMode :: enum s32 { + WaitForWork :: 0; + YieldThread :: 1; + YieldProcessor :: 2; +} + +PxControllerShapeType :: enum s32 { + /// A box controller. + Box :: 0; + /// A capsule controller + Capsule :: 1; + /// A capsule controller + ForceDword :: 2147483647; +} + +PxControllerNonWalkableMode :: enum s32 { + /// Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + PreventClimbing :: 0; + /// Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + PreventClimbingAndForceSliding :: 1; +} + +PxControllerCollisionFlags :: enum_flags u8 { + CollisionSides :: 1 << 0; + CollisionUp :: 1 << 1; + CollisionDown :: 1 << 2; +} + +PxCapsuleClimbingMode :: enum s32 { + /// Standard mode, let the capsule climb over surfaces according to impact normal + Easy :: 0; + /// Constrained mode, try to limit climbing according to the step offset + Constrained :: 1; + Last :: 2; +} + +PxControllerBehaviorFlags :: enum_flags u8 { + /// Controller can ride on touched object (i.e. when this touched object is moving horizontally). + /// + /// The CCT vs. CCT case is not supported. + CctCanRideOnObject :: 1; + /// Controller should slide on touched object + CctSlide :: 2; + /// Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + CctUserDefinedRide :: 4; +} + +PxQueryHitType :: enum s32 { + /// the query should ignore this shape + None :: 0; + /// a hit on the shape touches the intersection geometry of the query but does not block it + Touch :: 1; + /// a hit on the shape blocks the query (does not block overlap queries) + Block :: 2; +} + +PxQueryFlags :: enum_flags u16 { + Static :: 1 << 0; + Dynamic :: 1 << 1; + Prefilter :: 1 << 2; + Postfilter :: 1 << 3; + AnyHit :: 1 << 4; + NoBlock :: 1 << 5; + DisableHardcodedFilter :: 1 << 6; + Reserved :: 1 << 15; +} + +PxBroadPhaseType :: enum s32 { + /// 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; +} + +PxCombineMode :: enum s32 { + /// Average: (a + b)/2 + Average :: 0; + /// Minimum: minimum(a,b) + Min :: 1; + /// Multiply: a*b + Multiply :: 2; + /// Maximum: maximum(a,b) + Max :: 3; +} + +PxD6Axis :: enum s32 { + /// motion along the X axis + X :: 0; + /// motion along the Y axis + Y :: 1; + /// motion along the Z axis + Z :: 2; + /// motion around the X axis + Twist :: 3; + /// motion around the Y axis + Swing1 :: 4; + /// motion around the Z axis + Swing2 :: 5; + Count :: 6; +} + +PxD6Motion :: enum s32 { + /// The DOF is locked, it does not allow relative motion. + Locked :: 0; + /// The DOF is limited, it only allows motion within a specific range. + Limited :: 1; + /// The DOF is free and has its full range of motion. + Free :: 2; +} + +PxRevoluteJointFlags :: enum_flags u16 { + LimitEnabled :: 1 << 0; + DriveEnabled :: 1 << 1; + DriveFreespin :: 1 << 2; +} + +PxDistanceJointFlags :: enum_flags u16 { + MaxDistanceEnabled :: 1 << 1; + MinDistanceEnabled :: 1 << 2; + SpringEnabled :: 1 << 3; +} + + + +__clang__ :: 1; +NDEBUG :: 1; +PxMat34 :: struct {} + +PxAllocatorCallback :: struct { + vtable_: *void; +} + +PxAssertHandler :: struct { + vtable_: *void; +} + +PxFoundation :: struct { + vtable_: *void; +} + +PxAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxRawAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxVirtualAllocatorCallback :: struct { + vtable_: *void; +} + +PxVirtualAllocator :: struct { + structgen_pad0: [16] u8; +} + +PxUserAllocated :: struct { + structgen_pad0: [1] u8; +} + +PxTempAllocatorChunk :: union { + mNext: *PxTempAllocatorChunk; + mIndex: u32; + mPad: [16] u8; +} + +PxTempAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxLogTwo :: struct {} +PxUnConst :: struct {} +PxBitAndByte :: struct { + structgen_pad0: [1] u8; +} + +PxBitMap :: struct { + structgen_pad0: [16] u8; +} + +PxVec3Padded :: struct { + x: float; + y: float; + z: float; + padding: u32; +} + +PxTransform :: struct { + q: Quaternion; + p: Vector3; +} + +PxTransformPadded :: struct { + transform: PxTransform; + padding: u32; +} + +PxMat33 :: struct { + column0: Vector3; + column1: Vector3; + column2: Vector3; +} + +PxBounds3 :: struct { + minimum: Vector3; + maximum: Vector3; +} + +PxErrorCallback :: struct { + vtable_: *void; +} + +PxAllocationListener :: struct { + vtable_: *void; +} + +PxBroadcastingAllocator :: struct { + structgen_pad0: [176] u8; +} + +PxBroadcastingErrorCallback :: struct { + structgen_pad0: [160] u8; +} + +PxHash :: struct {} +PxInputStream :: struct { + vtable_: *void; +} + +PxInputData :: struct { + vtable_: *void; +} + +PxOutputStream :: struct { + vtable_: *void; +} + +PxMat44 :: struct { + column0: Vector4; + column1: Vector4; + column2: Vector4; + column3: Vector4; +} + +Interpolation :: struct { + structgen_pad0: [1] u8; +} + +PxMutexImpl :: struct { + structgen_pad0: [1] u8; +} + +PxReadWriteLock :: struct { + structgen_pad0: [8] u8; +} + +PxProfilerCallback :: struct { + vtable_: *void; +} + +PxProfileScoped :: struct { + mCallback: *PxProfilerCallback; + mEventName: *u8; + mProfilerData: *void; + mContextId: u64; + mDetached: bool; + structgen_pad0: [7] u8; +} + +PxSListEntry :: struct { + structgen_pad0: [16] u8; +} + +PxSListImpl :: struct { + structgen_pad0: [1] u8; +} + +PxSyncImpl :: struct { + structgen_pad0: [1] u8; +} + +PxRunnable :: struct { + vtable_: *void; +} + +PxCounterFrequencyToTensOfNanos :: struct { + mNumerator: u64; + mDenominator: u64; +} + +PxTime :: struct { + structgen_pad0: [8] u8; +} + +PxStridedData :: struct { + stride: u32; + structgen_pad0: [4] u8; + data: *void; +} + +PxBoundedData :: struct { + stride: u32; + structgen_pad0: [4] u8; + data: *void; + count: u32; + structgen_pad1: [4] u8; +} + +PxDebugPoint :: struct { + pos: Vector3; + color: u32; +} + +PxDebugLine :: struct { + pos0: Vector3; + color0: u32; + pos1: Vector3; + color1: u32; +} + +PxDebugTriangle :: struct { + pos0: Vector3; + color0: u32; + pos1: Vector3; + color1: u32; + pos2: Vector3; + color2: u32; +} + +PxDebugText :: struct { + position: Vector3; + size: float; + color: u32; + structgen_pad0: [4] u8; + _string: *u8; +} + +PxRenderBuffer :: struct { + vtable_: *void; +} + +PxProcessPxBaseCallback :: struct { + vtable_: *void; +} + +PxSerializationContext :: struct { + vtable_: *void; +} + +PxDeserializationContext :: struct { + structgen_pad0: [16] u8; +} + +PxSerializationRegistry :: struct { + vtable_: *void; +} + +PxCollection :: struct { + vtable_: *void; +} + +PxTypeInfo :: struct {} + +PxFEMSoftBodyMaterial :: struct {} +PxFEMClothMaterial :: struct {} +PxPBDMaterial :: struct {} +PxFLIPMaterial :: struct {} +PxMPMMaterial :: struct {} +PxCustomMaterial :: struct {} + +PxBVH33TriangleMesh :: struct {} + +PxParticleSystem :: struct {} +PxPBDParticleSystem :: struct {} +PxFLIPParticleSystem :: struct {} +PxMPMParticleSystem :: struct {} +PxCustomParticleSystem :: struct {} +PxSoftBody :: struct {} +PxFEMCloth :: struct {} +PxHairSystem :: struct {} +PxParticleBuffer :: struct {} +PxParticleAndDiffuseBuffer :: struct {} +PxParticleClothBuffer :: struct {} +PxParticleRigidBuffer :: struct {} +PxBase :: struct { + structgen_pad0: [16] u8; +} + +PxRefCounted :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as base: PxBase = ---; +} + +PxTolerancesScale :: struct { + length: float; + speed: float; +} + +PxStringTable :: struct { + vtable_: *void; +} + +PxSerializer :: struct { + vtable_: *void; +} + +PxMetaDataEntry :: struct { + type: *u8; + name: *u8; + offset: u32; + size: u32; + count: u32; + offsetSize: u32; + flags: u32; + alignment: u32; +} + +PxInsertionCallback :: struct { + vtable_: *void; +} + +PxTaskManager :: struct { + vtable_: *void; +} + +PxCpuDispatcher :: struct { + vtable_: *void; +} + +PxBaseTask :: struct { + structgen_pad0: [24] u8; +} + +PxTask :: struct { + structgen_pad0: [32] u8; +} + +PxLightCpuTask :: struct { + structgen_pad0: [40] u8; +} + +PxGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +} + +PxBoxGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + halfExtents: Vector3; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxBVHRaycastCallback :: struct { + vtable_: *void; +} + +PxBVHOverlapCallback :: struct { + vtable_: *void; +} + +PxBVHTraversalCallback :: struct { + vtable_: *void; +} + +PxBVH :: struct { + structgen_pad0: [16] u8; +} + +PxCapsuleGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + radius: float; + halfHeight: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHullPolygon :: struct { + mPlane: [4] float; + mNbVerts: u16; + mIndexBase: u16; +} + +PxConvexMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxMeshScale :: struct { + scale: Vector3; + rotation: Quaternion; +} + +PxConvexMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + scale: PxMeshScale; + structgen_pad1: [4] u8; + convexMesh: *PxConvexMesh; + meshFlags: u8; + structgen_pad2: [7] u8; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxSphereGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + radius: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxPlaneGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxTriangleMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + scale: PxMeshScale; + meshFlags: u8; + structgen_pad1: [3] u8; + triangleMesh: *PxTriangleMesh; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHeightFieldGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + heightField: *PxHeightField; + heightScale: float; + rowScale: float; + columnScale: float; + heightFieldFlags: u8; + structgen_pad1: [3] u8; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxParticleSystemGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + mSolverType: s32; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHairSystemGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxTetrahedronMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + tetrahedronMesh: *PxTetrahedronMesh; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxQueryHit :: struct { + faceIndex: u32; +} + +PxLocationHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; +} + +PxGeomRaycastHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + u: float; + v: float; +} + +PxGeomOverlapHit :: struct { + faceIndex: u32; +} + +PxGeomSweepHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; +} + +PxGeomIndexPair :: struct { + id0: u32; + id1: u32; +} + +PxQueryThreadContext :: struct { + structgen_pad0: [1] u8; +} + +PxContactBuffer :: struct {} +PxRenderOutput :: struct {} + +PxCustomGeometryType :: struct { + structgen_pad0: [4] u8; +} + +PxCustomGeometryCallbacks :: struct { + vtable_: *void; +} + +PxCustomGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + callbacks: *PxCustomGeometryCallbacks; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxGeometryHolder :: struct { + structgen_pad0: [56] u8; +} + +PxGeometryQuery :: struct { + structgen_pad0: [1] u8; +} + +PxHeightFieldSample :: struct { + height: s16; + materialIndex0: PxBitAndByte; + materialIndex1: PxBitAndByte; +} + +PxHeightField :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxHeightFieldDesc :: struct { + nbRows: u32; + nbColumns: u32; + format: s32; + structgen_pad0: [4] u8; + samples: PxStridedData; + convexEdgeThreshold: float; + flags: u16; + structgen_pad1: [2] u8; +} + +PxMeshQuery :: struct { + structgen_pad0: [1] u8; +} + +PxSimpleTriangleMesh :: struct { + points: PxBoundedData; + triangles: PxBoundedData; + flags: u16; + structgen_pad0: [6] u8; +} + +PxTriangle :: struct { + verts: [3] Vector3; +} + +PxTrianglePadded :: struct { + verts: [3] Vector3; + padding: u32; +} + +PxTriangleMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxBVH34TriangleMesh :: struct { + structgen_pad0: [16] u8; +} + +PxTetrahedron :: struct { + verts: [4] Vector3; +} + +PxSoftBodyAuxData :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxTetrahedronMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxSoftBodyMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxCollisionMeshMappingData :: struct { + structgen_pad0: [8] u8; +} + +PxSoftBodyCollisionData :: struct { + structgen_pad0: [1] u8; +} + +PxTetrahedronMeshData :: struct { + structgen_pad0: [1] u8; +} + +PxSoftBodySimulationData :: struct { + structgen_pad0: [1] u8; +} + +PxCollisionTetrahedronMeshData :: struct { + structgen_pad0: [8] u8; +} + +PxSimulationTetrahedronMeshData :: struct { + structgen_pad0: [8] u8; +} + +PxActor :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxAggregate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxSpringModifiers :: struct { + stiffness: float; + damping: float; + structgen_pad0: [8] u8; +} + +PxRestitutionModifiers :: struct { + restitution: float; + velocityThreshold: float; + structgen_pad0: [8] u8; +} + +Px1DConstraintMods :: union { + spring: PxSpringModifiers; + bounce: PxRestitutionModifiers; +} + +Px1DConstraint :: struct { + linear0: Vector3; + geometricError: float; + angular0: Vector3; + velocityTarget: float; + linear1: Vector3; + minImpulse: float; + angular1: Vector3; + maxImpulse: float; + mods: Px1DConstraintMods; + forInternalUse: float; + flags: u16; + solveHint: u16; + structgen_pad0: [8] u8; +} + +PxConstraintInvMassScale :: struct { + linear0: float; + angular0: float; + linear1: float; + angular1: float; +} + +PxConstraintVisualizer :: struct { + vtable_: *void; +} + +PxConstraintConnector :: struct { + vtable_: *void; +} + +PxContactPoint :: struct { + normal: Vector3; + separation: float; + point: Vector3; + maxImpulse: float; + targetVel: Vector3; + staticFriction: float; + materialFlags: u8; + structgen_pad0: [3] u8; + internalFaceIndex1: u32; + dynamicFriction: float; + restitution: float; + damping: float; + structgen_pad1: [12] u8; +} + +PxSolverBody :: struct { + linearVelocity: Vector3; + maxSolverNormalProgress: u16; + maxSolverFrictionProgress: u16; + angularState: Vector3; + solverProgress: u32; +} + +PxSolverBodyData :: struct { + linearVelocity: Vector3; + invMass: float; + angularVelocity: Vector3; + reportThreshold: float; + sqrtInvInertia: PxMat33; + penBiasClamp: float; + nodeIndex: u32; + maxContactImpulse: float; + body2World: PxTransform; + pad: u16; + structgen_pad0: [2] u8; +} + +PxConstraintBatchHeader :: struct { + startIndex: u32; + stride: u16; + constraintType: u16; +} + +PxSolverConstraintDesc :: struct { + structgen_pad0: [16] u8; + bodyADataIndex: u32; + bodyBDataIndex: u32; + linkIndexA: u32; + linkIndexB: u32; + constraint: *u8; + writeBack: *void; + progressA: u16; + progressB: u16; + constraintLengthOver16: u16; + padding: [10] u8; +} + +PxSolverConstraintPrepDescBase :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; +} + +PxSolverConstraintPrepDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; + rows: *Px1DConstraint; + numRows: u32; + linBreakForce: float; + angBreakForce: float; + minResponseThreshold: float; + writeback: *void; + disablePreprocessing: bool; + improvedSlerp: bool; + driveLimitsAreForces: bool; + extendedLimits: bool; + disableConstraint: bool; + structgen_pad1: [3] u8; + body0WorldOffset: PxVec3Padded; + structgen_pad2: [8] u8; +} + +PxSolverContactDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + shapeInteraction: *void; + contacts: *PxContactPoint; + numContacts: u32; + hasMaxImpulse: bool; + disableStrongFriction: bool; + hasForceThresholds: bool; + structgen_pad0: [1] u8; + restDistance: float; + maxCCDSeparation: float; + frictionPtr: *u8; + frictionCount: u8; + structgen_pad1: [7] u8; + contactForces: *float; + startFrictionPatchIndex: u32; + numFrictionPatches: u32; + startContactPatchIndex: u32; + numContactPatches: u16; + axisConstraintCount: u16; + offsetSlop: float; + structgen_pad2: [12] u8; +} + +PxConstraintAllocator :: struct { + vtable_: *void; +} + +PxArticulationLimit :: struct { + low: float; + high: float; +} + +PxArticulationDrive :: struct { + stiffness: float; + damping: float; + maxForce: float; + driveType: s32; +} + +PxTGSSolverBodyVel :: struct { + linearVelocity: Vector3; + nbStaticInteractions: u16; + maxDynamicPartition: u16; + angularVelocity: Vector3; + partitionMask: u32; + deltaAngDt: Vector3; + maxAngVel: float; + deltaLinDt: Vector3; + lockFlags: u16; + isKinematic: bool; + pad: u8; +} + +PxTGSSolverBodyTxInertia :: struct { + deltaBody2World: PxTransform; + sqrtInvInertia: PxMat33; +} + +PxTGSSolverBodyData :: struct { + originalLinearVelocity: Vector3; + maxContactImpulse: float; + originalAngularVelocity: Vector3; + penBiasClamp: float; + invMass: float; + nodeIndex: u32; + reportThreshold: float; + pad: u32; +} + +PxTGSSolverConstraintPrepDescBase :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; +} + +PxTGSSolverConstraintPrepDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + rows: *Px1DConstraint; + numRows: u32; + linBreakForce: float; + angBreakForce: float; + minResponseThreshold: float; + writeback: *void; + disablePreprocessing: bool; + improvedSlerp: bool; + driveLimitsAreForces: bool; + extendedLimits: bool; + disableConstraint: bool; + structgen_pad0: [3] u8; + body0WorldOffset: PxVec3Padded; + cA2w: PxVec3Padded; + cB2w: PxVec3Padded; +} + +PxTGSSolverContactDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + shapeInteraction: *void; + contacts: *PxContactPoint; + numContacts: u32; + hasMaxImpulse: bool; + disableStrongFriction: bool; + hasForceThresholds: bool; + structgen_pad0: [1] u8; + restDistance: float; + maxCCDSeparation: float; + frictionPtr: *u8; + frictionCount: u8; + structgen_pad1: [7] u8; + contactForces: *float; + startFrictionPatchIndex: u32; + numFrictionPatches: u32; + startContactPatchIndex: u32; + numContactPatches: u16; + axisConstraintCount: u16; + maxImpulse: float; + torsionalPatchRadius: float; + minTorsionalPatchRadius: float; + offsetSlop: float; +} + +PxArticulationTendonLimit :: struct { + lowLimit: float; + highLimit: float; +} + +PxArticulationAttachment :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationTendonJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationSpatialTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationFixedTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxSpatialForce :: struct { + force: Vector3; + pad0: float; + torque: Vector3; + pad1: float; +} + +PxSpatialVelocity :: struct { + linear: Vector3; + pad0: float; + angular: Vector3; + pad1: float; +} + +PxArticulationRootLinkData :: struct { + transform: PxTransform; + worldLinVel: Vector3; + worldAngVel: Vector3; + worldLinAccel: Vector3; + worldAngAccel: Vector3; +} + +PxArticulationCache :: struct { + externalForces: *PxSpatialForce; + denseJacobian: *float; + massMatrix: *float; + jointVelocity: *float; + jointAcceleration: *float; + jointPosition: *float; + jointForce: *float; + jointSolverForces: *float; + linkVelocity: *PxSpatialVelocity; + linkAcceleration: *PxSpatialVelocity; + rootLinkData: *PxArticulationRootLinkData; + sensorForces: *PxSpatialForce; + coefficientMatrix: *float; + lambda: *float; + scratchMemory: *void; + scratchAllocator: *void; + version: u32; + structgen_pad0: [4] u8; +} + +PxArticulationSensor :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationReducedCoordinate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationJointReducedCoordinate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxShape :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxRigidActor :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as actor: PxActor = ---; +} + +PxNodeIndex :: struct { + structgen_pad0: [8] u8; +} + +PxRigidBody :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_actor: PxRigidActor = ---; +} + +PxArticulationLink :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_body: PxRigidBody = ---; +} + +PxConeLimitedConstraint :: struct { + mAxis: Vector3; + mAngle: float; + mLowLimit: float; + mHighLimit: float; +} + +PxConeLimitParams :: struct { + lowHighLimits: Vector4; + axisAngle: Vector4; +} + +PxConstraintShaderTable :: struct { + solverPrep: *void; + structgen_pad0: [8] u8; + visualize: *void; + flag: s32; + structgen_pad1: [4] u8; +} + +PxConstraint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxMassModificationProps :: struct { + mInvMassScale0: float; + mInvInertiaScale0: float; + mInvMassScale1: float; + mInvInertiaScale1: float; +} + +PxContactPatch :: struct { + mMassModification: PxMassModificationProps; + normal: Vector3; + restitution: float; + dynamicFriction: float; + staticFriction: float; + damping: float; + startContactIndex: u16; + nbContacts: u8; + materialFlags: u8; + internalFlags: u16; + materialIndex0: u16; + materialIndex1: u16; + pad: [5] u16; +} + +PxContact :: struct { + contact: Vector3; + separation: float; +} + +PxExtendedContact :: struct { + contact: Vector3; + separation: float; + targetVelocity: Vector3; + maxImpulse: float; +} + +PxModifiableContact :: struct { + contact: Vector3; + separation: float; + targetVelocity: Vector3; + maxImpulse: float; + normal: Vector3; + restitution: float; + materialFlags: u32; + materialIndex0: u16; + materialIndex1: u16; + staticFriction: float; + dynamicFriction: float; +} + +PxContactStreamIterator :: struct { + zero: Vector3; + structgen_pad0: [4] u8; + patch: *PxContactPatch; + contact: *PxContact; + faceIndice: *u32; + totalPatches: u32; + totalContacts: u32; + nextContactIndex: u32; + nextPatchIndex: u32; + contactPatchHeaderSize: u32; + contactPointSize: u32; + mStreamFormat: s32; + forceNoResponse: u32; + pointStepped: bool; + structgen_pad1: [3] u8; + hasFaceIndices: u32; +} + +PxGpuContactPair :: struct { + contactPatches: *u8; + contactPoints: *u8; + contactForces: *float; + transformCacheRef0: u32; + transformCacheRef1: u32; + nodeIndex0: PxNodeIndex; + nodeIndex1: PxNodeIndex; + actor0: *PxActor; + actor1: *PxActor; + nbContacts: u16; + nbPatches: u16; + structgen_pad0: [4] u8; +} + +PxContactSet :: struct { + structgen_pad0: [16] u8; +} + +PxContactModifyPair :: struct { + actor: [2] *PxRigidActor; + shape: [2] *PxShape; + transform: [2] PxTransform; + contacts: PxContactSet; +} + +PxContactModifyCallback :: struct { + vtable_: *void; +} + +PxCCDContactModifyCallback :: struct { + vtable_: *void; +} + +PxDeletionListener :: struct { + vtable_: *void; +} + +PxBaseMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxFEMMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxFilterData :: struct { + word0: u32; + word1: u32; + word2: u32; + word3: u32; +} + +PxSimulationFilterCallback :: struct { + vtable_: *void; +} + +PxParticleRigidFilterPair :: struct { + mID0: u64; + mID1: u64; +} + +PxLockedData :: struct { + vtable_: *void; +} + +PxMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as base_material: PxBaseMaterial = ---; +} + +PxGpuParticleBufferIndexPair :: struct { + systemIndex: u32; + bufferIndex: u32; +} + +PxCudaContextManager :: struct {} +PxParticleRigidAttachment :: struct {} +PxParticleVolume :: struct { + bound: PxBounds3; + particleIndicesOffset: u32; + numParticles: u32; +} + +PxDiffuseParticleParams :: struct { + threshold: float; + lifetime: float; + airDrag: float; + bubbleDrag: float; + buoyancy: float; + kineticEnergyWeight: float; + pressureWeight: float; + divergenceWeight: float; + collisionDecay: float; + useAccurateVelocity: bool; + structgen_pad0: [3] u8; +} + +PxParticleSpring :: struct { + ind0: u32; + ind1: u32; + length: float; + stiffness: float; + damping: float; + pad: float; +} + +PxParticleMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxOmniPvd :: struct {} +PxPhysics :: struct { + vtable_: *void; +} + +PxActorShape :: struct { + actor: *PxRigidActor; + shape: *PxShape; +} + +PxRaycastHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + u: float; + v: float; + structgen_pad1: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxOverlapHit :: struct { + faceIndex: u32; + structgen_pad0: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxSweepHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + structgen_pad1: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxRaycastCallback :: struct { + structgen_pad0: [8] u8; + block: PxRaycastHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxRaycastHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxOverlapCallback :: struct { + structgen_pad0: [8] u8; + block: PxOverlapHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxOverlapHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxSweepCallback :: struct { + structgen_pad0: [8] u8; + block: PxSweepHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxSweepHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxRaycastBuffer :: struct { + structgen_pad0: [8] u8; + block: PxRaycastHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxRaycastHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxOverlapBuffer :: struct { + structgen_pad0: [8] u8; + block: PxOverlapHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxOverlapHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxSweepBuffer :: struct { + structgen_pad0: [8] u8; + block: PxSweepHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxSweepHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxQueryCache :: struct { + shape: *PxShape; + actor: *PxRigidActor; + faceIndex: u32; + structgen_pad0: [4] u8; +} + +PxQueryFilterData :: struct { + data: PxFilterData; + flags: u16; + structgen_pad0: [2] u8; +} + +PxQueryFilterCallback :: struct { + vtable_: *void; +} + +PxRigidDynamic :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_body: PxRigidBody = ---; +} + +PxRigidStatic :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_actor: PxRigidActor = ---; +} + +PxSceneQueryDesc :: struct { + staticStructure: s32; + dynamicStructure: s32; + dynamicTreeRebuildRateHint: u32; + dynamicTreeSecondaryPruner: s32; + staticBVHBuildStrategy: s32; + dynamicBVHBuildStrategy: s32; + staticNbObjectsPerNode: u32; + dynamicNbObjectsPerNode: u32; + sceneQueryUpdateMode: s32; +} + +PxSceneQuerySystemBase :: struct { + vtable_: *void; +} + +PxSceneSQSystem :: struct { + vtable_: *void; +} + +PxSceneQuerySystem :: struct { + vtable_: *void; +} + +PxBroadPhaseRegion :: struct { + mBounds: PxBounds3; + mUserData: *void; +} + +PxBroadPhaseRegionInfo :: struct { + mRegion: PxBroadPhaseRegion; + mNbStaticObjects: u32; + mNbDynamicObjects: u32; + mActive: bool; + mOverlap: bool; + structgen_pad0: [6] u8; +} + +PxBroadPhaseCaps :: struct { + mMaxNbRegions: u32; +} + +PxBroadPhaseDesc :: struct { + mType: s32; + structgen_pad0: [4] u8; + mContextID: u64; + structgen_pad1: [8] u8; + mFoundLostPairsCapacity: u32; + mDiscardStaticVsKinematic: bool; + mDiscardKinematicVsKinematic: bool; + structgen_pad2: [2] u8; +} + +PxBroadPhaseUpdateData :: struct { + mCreated: *u32; + mNbCreated: u32; + structgen_pad0: [4] u8; + mUpdated: *u32; + mNbUpdated: u32; + structgen_pad1: [4] u8; + mRemoved: *u32; + mNbRemoved: u32; + structgen_pad2: [4] u8; + mBounds: *PxBounds3; + mGroups: *u32; + mDistances: *float; + mCapacity: u32; + structgen_pad3: [4] u8; +} + +PxBroadPhasePair :: struct { + mID0: u32; + mID1: u32; +} + +PxBroadPhaseResults :: struct { + mNbCreatedPairs: u32; + structgen_pad0: [4] u8; + mCreatedPairs: *PxBroadPhasePair; + mNbDeletedPairs: u32; + structgen_pad1: [4] u8; + mDeletedPairs: *PxBroadPhasePair; +} + +PxBroadPhaseRegions :: struct { + vtable_: *void; +} + +PxBroadPhase :: struct { + vtable_: *void; +} + +PxAABBManager :: struct { + vtable_: *void; +} + +PxSceneLimits :: struct { + maxNbActors: u32; + maxNbBodies: u32; + maxNbStaticShapes: u32; + maxNbDynamicShapes: u32; + maxNbAggregates: u32; + maxNbConstraints: u32; + maxNbRegions: u32; + maxNbBroadPhaseOverlaps: u32; +} + +PxgDynamicsMemoryConfig :: struct { + tempBufferCapacity: u32; + maxRigidContactCount: u32; + maxRigidPatchCount: u32; + heapCapacity: u32; + foundLostPairsCapacity: u32; + foundLostAggregatePairsCapacity: u32; + totalAggregatePairsCapacity: u32; + maxSoftBodyContacts: u32; + maxFemClothContacts: u32; + maxParticleContacts: u32; + collisionStackSize: u32; + maxHairContacts: u32; +} + +PxSceneDesc :: struct { + staticStructure: s32; + dynamicStructure: s32; + dynamicTreeRebuildRateHint: u32; + dynamicTreeSecondaryPruner: s32; + staticBVHBuildStrategy: s32; + dynamicBVHBuildStrategy: s32; + staticNbObjectsPerNode: u32; + dynamicNbObjectsPerNode: u32; + sceneQueryUpdateMode: s32; + gravity: Vector3; + simulationEventCallback: *PxSimulationEventCallback; + contactModifyCallback: *PxContactModifyCallback; + ccdContactModifyCallback: *PxCCDContactModifyCallback; + filterShaderData: *void; + filterShaderDataSize: u32; + structgen_pad0: [4] u8; + filterShader: *void; + filterCallback: *PxSimulationFilterCallback; + kineKineFilteringMode: s32; + staticKineFilteringMode: s32; + broadPhaseType: s32; + structgen_pad1: [4] u8; + broadPhaseCallback: *PxBroadPhaseCallback; + limits: PxSceneLimits; + frictionType: s32; + solverType: s32; + bounceThresholdVelocity: float; + frictionOffsetThreshold: float; + frictionCorrelationDistance: float; + flags: u32; + cpuDispatcher: *PxCpuDispatcher; + structgen_pad2: [8] u8; + userData: *void; + solverBatchSize: u32; + solverArticulationBatchSize: u32; + nbContactDataBlocks: u32; + maxNbContactDataBlocks: u32; + maxBiasCoefficient: float; + contactReportStreamBufferSize: u32; + ccdMaxPasses: u32; + ccdThreshold: float; + ccdMaxSeparation: float; + wakeCounterResetValue: float; + sanityBounds: PxBounds3; + gpuDynamicsConfig: PxgDynamicsMemoryConfig; + gpuMaxNumPartitions: u32; + gpuMaxNumStaticPartitions: u32; + gpuComputeVersion: u32; + contactPairSlabSize: u32; + sceneQuerySystem: *PxSceneQuerySystem; + structgen_pad3: [8] u8; +} + +PxSimulationStatistics :: struct { + nbActiveConstraints: u32; + nbActiveDynamicBodies: u32; + nbActiveKinematicBodies: u32; + nbStaticBodies: u32; + nbDynamicBodies: u32; + nbKinematicBodies: u32; + nbShapes: [11] u32; + nbAggregates: u32; + nbArticulations: u32; + nbAxisSolverConstraints: u32; + compressedContactSize: u32; + requiredContactConstraintMemory: u32; + peakConstraintMemory: u32; + nbDiscreteContactPairsTotal: u32; + nbDiscreteContactPairsWithCacheHits: u32; + nbDiscreteContactPairsWithContacts: u32; + nbNewPairs: u32; + nbLostPairs: u32; + nbNewTouches: u32; + nbLostTouches: u32; + nbPartitions: u32; + structgen_pad0: [4] u8; + gpuMemParticles: u64; + gpuMemSoftBodies: u64; + gpuMemFEMCloths: u64; + gpuMemHairSystems: u64; + gpuMemHeap: u64; + gpuMemHeapBroadPhase: u64; + gpuMemHeapNarrowPhase: u64; + gpuMemHeapSolver: u64; + gpuMemHeapArticulation: u64; + gpuMemHeapSimulation: u64; + gpuMemHeapSimulationArticulation: u64; + gpuMemHeapSimulationParticles: u64; + gpuMemHeapSimulationSoftBody: u64; + gpuMemHeapSimulationFEMCloth: u64; + gpuMemHeapSimulationHairSystem: u64; + gpuMemHeapParticles: u64; + gpuMemHeapSoftBodies: u64; + gpuMemHeapFEMCloths: u64; + gpuMemHeapHairSystems: u64; + gpuMemHeapOther: u64; + nbBroadPhaseAdds: u32; + nbBroadPhaseRemoves: u32; + nbDiscreteContactPairs: [11] [11] u32; + nbCCDPairs: [11] [11] u32; + nbModifiedContactPairs: [11] [11] u32; + nbTriggerPairs: [11] [11] u32; +} + +PxGpuBodyData :: struct { + quat: Quaternion; + pos: Vector4; + linVel: Vector4; + angVel: Vector4; +} + +PxGpuActorPair :: struct { + srcIndex: u32; + structgen_pad0: [4] u8; + nodeIndex: PxNodeIndex; +} + +PxIndexDataPair :: struct { + index: u32; + structgen_pad0: [4] u8; + data: *void; +} + +PxPvdSceneClient :: struct { + vtable_: *void; +} + +PxDominanceGroupPair :: struct { + dominance0: u8; + dominance1: u8; +} + +PxBroadPhaseCallback :: struct { + vtable_: *void; +} + +PxScene :: struct { + structgen_pad0: [8] u8; + userData: *void; +} + +PxSceneReadLock :: struct { + structgen_pad0: [8] u8; +} + +PxSceneWriteLock :: struct { + structgen_pad0: [8] u8; +} + +PxContactPairExtraDataItem :: struct { + type: u8; +} + +PxContactPairVelocity :: struct { + type: u8; + structgen_pad0: [3] u8; + linearVelocity: [2] Vector3; + angularVelocity: [2] Vector3; +} + +PxContactPairPose :: struct { + type: u8; + structgen_pad0: [3] u8; + globalPose: [2] PxTransform; +} + +PxContactPairIndex :: struct { + type: u8; + structgen_pad0: [1] u8; + index: u16; +} + +PxContactPairExtraDataIterator :: struct { + currPtr: *u8; + endPtr: *u8; + preSolverVelocity: *PxContactPairVelocity; + postSolverVelocity: *PxContactPairVelocity; + eventPose: *PxContactPairPose; + contactPairIndex: u32; + structgen_pad0: [4] u8; +} + +PxContactPairHeader :: struct { + actors: [2] *PxActor; + extraDataStream: *u8; + extraDataStreamSize: u16; + flags: u16; + structgen_pad0: [4] u8; + pairs: *PxContactPair; + nbPairs: u32; + structgen_pad1: [4] u8; +} + +PxContactPairPoint :: struct { + position: Vector3; + separation: float; + normal: Vector3; + internalFaceIndex0: u32; + impulse: Vector3; + internalFaceIndex1: u32; +} + +PxContactPair :: struct { + shapes: [2] *PxShape; + contactPatches: *u8; + contactPoints: *u8; + contactImpulses: *float; + requiredBufferSize: u32; + contactCount: u8; + patchCount: u8; + contactStreamSize: u16; + flags: u16; + events: u16; + internalData: [2] u32; + structgen_pad0: [4] u8; +} + +PxTriggerPair :: struct { + triggerShape: *PxShape; + triggerActor: *PxActor; + otherShape: *PxShape; + otherActor: *PxActor; + status: s32; + flags: u8; + structgen_pad0: [3] u8; +} + +PxConstraintInfo :: struct { + constraint: *PxConstraint; + externalReference: *void; + type: u32; + structgen_pad0: [4] u8; +} + +PxSimulationEventCallback :: struct { + vtable_: *void; +} + +PxFEMParameters :: struct { + velocityDamping: float; + settlingThreshold: float; + sleepThreshold: float; + sleepDamping: float; + selfCollisionFilterDistance: float; + selfCollisionStressTolerance: float; +} + +PxPruningStructure :: struct { + structgen_pad0: [16] u8; +} + +PxExtendedVec3 :: struct { + x: float64; + y: float64; + z: float64; +} + +PxObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; +} + +PxBoxObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; + mHalfExtents: Vector3; + structgen_pad1: [4] u8; +} + +PxCapsuleObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; + mHalfHeight: float; + mRadius: float; +} + +PxObstacleContext :: struct { + vtable_: *void; +} + +PxControllerState :: struct { + deltaXP: Vector3; + structgen_pad0: [4] u8; + touchedShape: *PxShape; + touchedActor: *PxRigidActor; + touchedObstacleHandle: u32; + collisionFlags: u32; + standOnAnotherCCT: bool; + standOnObstacle: bool; + isMovingUp: bool; + structgen_pad1: [5] u8; +} + +PxControllerStats :: struct { + nbIterations: u16; + nbFullUpdates: u16; + nbPartialUpdates: u16; + nbTessellation: u16; +} + +PxControllerHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; +} + +PxControllerShapeHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + shape: *PxShape; + actor: *PxRigidActor; + triangleIndex: u32; + structgen_pad1: [4] u8; +} + +PxControllersHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + other: *PxController; +} + +PxControllerObstacleHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + userData: *void; +} + +PxUserControllerHitReport :: struct { + vtable_: *void; +} + +PxControllerFilterCallback :: struct { + vtable_: *void; +} + +PxControllerFilters :: struct { + mFilterData: *PxFilterData; + mFilterCallback: *PxQueryFilterCallback; + mFilterFlags: u16; + structgen_pad0: [6] u8; + mCCTFilterCallback: *PxControllerFilterCallback; +} + +PxControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [8] u8; +} + +PxController :: struct { + vtable_: *void; +} + +PxBoxControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [4] u8; + halfHeight: float; + halfSideExtent: float; + halfForwardExtent: float; +#place structgen_pad0; #as controller_desc: PxControllerDesc = ---; +} + +PxBoxController :: struct { + vtable_: *void; +#place vtable_; #as controller: PxController = ---; +} + +PxCapsuleControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [4] u8; + radius: float; + height: float; + climbingMode: s32; +#place structgen_pad0; #as controller_desc: PxControllerDesc = ---; +} + +PxCapsuleController :: struct { + vtable_: *void; +#place vtable_; #as controller: PxController = ---; +} + +PxControllerBehaviorCallback :: struct { + vtable_: *void; +} + +PxControllerManager :: struct { + vtable_: *void; +} + +PxDim3 :: struct { + x: u32; + y: u32; + z: u32; +} + +PxSDFDesc :: struct { + sdf: PxBoundedData; + dims: PxDim3; + meshLower: Vector3; + spacing: float; + subgridSize: u32; + bitsPerSubgridPixel: s32; + sdfSubgrids3DTexBlockDim: PxDim3; + sdfSubgrids: PxBoundedData; + sdfStartSlots: PxBoundedData; + subgridsMinSdfValue: float; + subgridsMaxSdfValue: float; + sdfBounds: PxBounds3; + narrowBandThicknessRelativeToSdfBoundsDiagonal: float; + numThreadsForSdfConstruction: u32; +} + +PxConvexMeshDesc :: struct { + points: PxBoundedData; + polygons: PxBoundedData; + indices: PxBoundedData; + flags: u16; + vertexLimit: u16; + polygonLimit: u16; + quantizedCount: u16; + sdfDesc: *PxSDFDesc; +} + +PxTriangleMeshDesc :: struct { + points: PxBoundedData; + triangles: PxBoundedData; + flags: u16; + structgen_pad0: [22] u8; + sdfDesc: *PxSDFDesc; +} + +PxTetrahedronMeshDesc :: struct { + structgen_pad0: [16] u8; + points: PxBoundedData; + tetrahedrons: PxBoundedData; + flags: u16; + tetsPerElement: u16; + structgen_pad1: [4] u8; +} + +PxSoftBodySimulationDataDesc :: struct { + vertexToTet: PxBoundedData; +} + +PxBVH34MidphaseDesc :: struct { + numPrimsPerLeaf: u32; + buildStrategy: s32; + quantized: bool; + structgen_pad0: [3] u8; +} + +PxMidphaseDesc :: struct { + structgen_pad0: [16] u8; +} + +PxBVHDesc :: struct { + bounds: PxBoundedData; + enlargement: float; + numPrimsPerLeaf: u32; + buildStrategy: s32; + structgen_pad0: [4] u8; +} + +PxCookingParams :: struct { + areaTestEpsilon: float; + planeTolerance: float; + convexMeshCookingType: s32; + suppressTriangleMeshRemapTable: bool; + buildTriangleAdjacencies: bool; + buildGPUData: bool; + structgen_pad0: [1] u8; + scale: PxTolerancesScale; + meshPreprocessParams: u32; + meshWeldTolerance: float; + midphaseDesc: PxMidphaseDesc; + gaussMapLimit: u32; + maxWeightRatioInTet: float; +} + +PxDefaultMemoryOutputStream :: struct { + structgen_pad0: [32] u8; +#place structgen_pad0; #as output_stream: PxOutputStream = ---; +} + +PxDefaultMemoryInputData :: struct { + structgen_pad0: [32] u8; +#place structgen_pad0; #as input_stream: PxInputStream = ---; +} + +PxDefaultFileOutputStream :: struct { + structgen_pad0: [16] u8; +} + +PxDefaultFileInputData :: struct { + structgen_pad0: [24] u8; +} + +PxDefaultAllocator :: struct { + vtable_: *void; +} + +PxJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as base: PxBase = ---; +} + +PxSpring :: struct { + stiffness: float; + damping: float; +} + +PxDistanceJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxJacobianRow :: struct { + linear0: Vector3; + linear1: Vector3; + angular0: Vector3; + angular1: Vector3; +} + +PxContactJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxFixedJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxJointLimitParameters :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; +} + +PxJointLinearLimit :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + value: float; +} + +PxJointLinearLimitPair :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + upper: float; + lower: float; +} + +PxJointAngularLimitPair :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + upper: float; + lower: float; +} + +PxJointLimitCone :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + yAngle: float; + zAngle: float; +} + +PxJointLimitPyramid :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + yAngleMin: float; + yAngleMax: float; + zAngleMin: float; + zAngleMax: float; +} + +PxPrismaticJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxRevoluteJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxSphericalJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxD6JointDrive :: struct { + stiffness: float; + damping: float; + forceLimit: float; + flags: u32; +} + +PxD6Joint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxGearJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxRackAndPinionJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxGroupsMask :: struct { + bits0: u16; + bits1: u16; + bits2: u16; + bits3: u16; +} + +PxDefaultErrorCallback :: struct { + vtable_: *void; +} + +PxRigidActorExt :: struct { + structgen_pad0: [1] u8; +} + +PxMassProperties :: struct { + inertiaTensor: PxMat33; + centerOfMass: Vector3; + mass: float; +} + +PxRigidBodyExt :: struct { + structgen_pad0: [1] u8; +} + +PxShapeExt :: struct { + structgen_pad0: [1] u8; +} + +PxMeshOverlapUtil :: struct { + structgen_pad0: [1040] u8; +} + +PxBinaryConverter :: struct {} +PxXmlMiscParameter :: struct { + upVector: Vector3; + scale: PxTolerancesScale; +} + +PxSerialization :: struct { + structgen_pad0: [1] u8; +} + +PxDefaultCpuDispatcher :: struct { + vtable_: *void; +} + +PxStringTableExt :: struct { + structgen_pad0: [1] u8; +} + +PxBroadPhaseExt :: struct { + structgen_pad0: [1] u8; +} + +PxSceneQueryExt :: struct { + structgen_pad0: [1] u8; +} + +PxBatchQueryExt :: struct { + vtable_: *void; +} + +PxCustomSceneQuerySystem :: struct { + vtable_: *void; +} + +PxCustomSceneQuerySystemAdapter :: struct { + vtable_: *void; +} + +PxSamplingExt :: struct { + structgen_pad0: [1] u8; +} + +PxPoissonSampler :: struct { + structgen_pad0: [8] u8; +} + +PxTriangleMeshPoissonSampler :: struct { + structgen_pad0: [8] u8; +} + +PxTetrahedronMeshExt :: struct { + structgen_pad0: [1] u8; +} + +PxRepXObject :: struct { + typeName: *u8; + serializable: *void; + id: u64; +} + +PxCooking :: struct {} +PxRepXInstantiationArgs :: struct { + structgen_pad0: [8] u8; + cooker: *PxCooking; + stringTable: *PxStringTable; +} + +XmlMemoryAllocator :: struct {} +XmlWriter :: struct {} +XmlReader :: struct {} +MemoryBuffer :: struct {} +PxRepXSerializer :: struct { + vtable_: *void; +} + +PxVehicleWheels4SimData :: struct {} +PxVehicleWheels4DynData :: struct {} +PxVehicleTireForceCalculator :: struct {} +PxVehicleDrivableSurfaceToTireFrictionPairs :: struct {} +PxVehicleTelemetryData :: struct {} + +PxPvd :: struct { + vtable_: *void; +} + +PxPvdTransport :: struct { + vtable_: *void; +} + +PxAllocatorCallback_delete :: (self: *PxAllocatorCallback) -> void #foreign libphysx; + +PxAllocatorCallback_allocate :: (self: *PxAllocatorCallback, size: u64, typeName: *u8, filename: *u8, line: s32) -> *void #foreign libphysx "PxAllocatorCallback_allocate_mut"; + +PxAllocatorCallback_deallocate :: (self: *PxAllocatorCallback, ptr: *void) -> void #foreign libphysx "PxAllocatorCallback_deallocate_mut"; + +PxAssertHandler_delete :: (self: *PxAssertHandler) -> void #foreign libphysx; + +PxGetAssertHandler :: () -> *PxAssertHandler #foreign libphysx "phys_PxGetAssertHandler"; + +PxSetAssertHandler :: (handler: *PxAssertHandler) -> void #foreign libphysx "phys_PxSetAssertHandler"; + +PxFoundation_release :: (self: *PxFoundation) -> void #foreign libphysx "PxFoundation_release_mut"; + +PxFoundation_getErrorCallback :: (self: *PxFoundation) -> *PxErrorCallback #foreign libphysx "PxFoundation_getErrorCallback_mut"; + +PxFoundation_setErrorLevel :: (self: *PxFoundation, mask: u32) -> void #foreign libphysx "PxFoundation_setErrorLevel_mut"; + +PxFoundation_getErrorLevel :: (self: *PxFoundation) -> u32 #foreign libphysx; + +PxFoundation_getAllocatorCallback :: (self: *PxFoundation) -> *PxAllocatorCallback #foreign libphysx "PxFoundation_getAllocatorCallback_mut"; + +PxFoundation_getReportAllocationNames :: (self: *PxFoundation) -> bool #foreign libphysx; + +PxFoundation_setReportAllocationNames :: (self: *PxFoundation, value: bool) -> void #foreign libphysx "PxFoundation_setReportAllocationNames_mut"; + +PxFoundation_registerAllocationListener :: (self: *PxFoundation, listener: *PxAllocationListener) -> void #foreign libphysx "PxFoundation_registerAllocationListener_mut"; + +PxFoundation_deregisterAllocationListener :: (self: *PxFoundation, listener: *PxAllocationListener) -> void #foreign libphysx "PxFoundation_deregisterAllocationListener_mut"; + +PxFoundation_registerErrorCallback :: (self: *PxFoundation, callback: *PxErrorCallback) -> void #foreign libphysx "PxFoundation_registerErrorCallback_mut"; + +PxFoundation_deregisterErrorCallback :: (self: *PxFoundation, callback: *PxErrorCallback) -> void #foreign libphysx "PxFoundation_deregisterErrorCallback_mut"; + +PxCreateFoundation :: (version: u32, allocator: *PxAllocatorCallback, errorCallback: *PxErrorCallback) -> *PxFoundation #foreign libphysx "phys_PxCreateFoundation"; + +PxSetFoundationInstance :: (foundation: *PxFoundation) -> void #foreign libphysx "phys_PxSetFoundationInstance"; + +PxGetFoundation :: () -> *PxFoundation #foreign libphysx "phys_PxGetFoundation"; + +PxGetProfilerCallback :: () -> *PxProfilerCallback #foreign libphysx "phys_PxGetProfilerCallback"; + +PxSetProfilerCallback :: (profiler: *PxProfilerCallback) -> void #foreign libphysx "phys_PxSetProfilerCallback"; + +PxGetAllocatorCallback :: () -> *PxAllocatorCallback #foreign libphysx "phys_PxGetAllocatorCallback"; + +PxGetBroadcastAllocator :: () -> *PxAllocatorCallback #foreign libphysx "phys_PxGetBroadcastAllocator"; + +PxGetErrorCallback :: () -> *PxErrorCallback #foreign libphysx "phys_PxGetErrorCallback"; + +PxGetBroadcastError :: () -> *PxErrorCallback #foreign libphysx "phys_PxGetBroadcastError"; + +PxGetWarnOnceTimeStamp :: () -> u32 #foreign libphysx "phys_PxGetWarnOnceTimeStamp"; + +PxDecFoundationRefCount :: () -> void #foreign libphysx "phys_PxDecFoundationRefCount"; + +PxIncFoundationRefCount :: () -> void #foreign libphysx "phys_PxIncFoundationRefCount"; + +PxAllocator_new :: (anon_param0: *u8) -> PxAllocator #foreign libphysx; + +PxAllocator_allocate :: (self: *PxAllocator, size: u64, file: *u8, line: s32) -> *void #foreign libphysx "PxAllocator_allocate_mut"; + +PxAllocator_deallocate :: (self: *PxAllocator, ptr: *void) -> void #foreign libphysx "PxAllocator_deallocate_mut"; + +PxRawAllocator_new :: (anon_param0: *u8) -> PxRawAllocator #foreign libphysx; + +PxRawAllocator_allocate :: (self: *PxRawAllocator, size: u64, anon_param1: *u8, anon_param2: s32) -> *void #foreign libphysx "PxRawAllocator_allocate_mut"; + +PxRawAllocator_deallocate :: (self: *PxRawAllocator, ptr: *void) -> void #foreign libphysx "PxRawAllocator_deallocate_mut"; + +PxVirtualAllocatorCallback_delete :: (self: *PxVirtualAllocatorCallback) -> void #foreign libphysx; + +PxVirtualAllocatorCallback_allocate :: (self: *PxVirtualAllocatorCallback, size: u64, group: s32, file: *u8, line: s32) -> *void #foreign libphysx "PxVirtualAllocatorCallback_allocate_mut"; + +PxVirtualAllocatorCallback_deallocate :: (self: *PxVirtualAllocatorCallback, ptr: *void) -> void #foreign libphysx "PxVirtualAllocatorCallback_deallocate_mut"; + +PxVirtualAllocator_new :: (callback: *PxVirtualAllocatorCallback, group: s32) -> PxVirtualAllocator #foreign libphysx; + +PxVirtualAllocator_allocate :: (self: *PxVirtualAllocator, size: u64, file: *u8, line: s32) -> *void #foreign libphysx "PxVirtualAllocator_allocate_mut"; + +PxVirtualAllocator_deallocate :: (self: *PxVirtualAllocator, ptr: *void) -> void #foreign libphysx "PxVirtualAllocator_deallocate_mut"; + +PxTempAllocatorChunk_new :: () -> PxTempAllocatorChunk #foreign libphysx; + +PxTempAllocator_new :: (anon_param0: *u8) -> PxTempAllocator #foreign libphysx; + +PxTempAllocator_allocate :: (self: *PxTempAllocator, size: u64, file: *u8, line: s32) -> *void #foreign libphysx "PxTempAllocator_allocate_mut"; + +PxTempAllocator_deallocate :: (self: *PxTempAllocator, ptr: *void) -> void #foreign libphysx "PxTempAllocator_deallocate_mut"; + +PxMemZero :: (dest: *void, count: u32) -> *void #foreign libphysx "phys_PxMemZero"; + +PxMemSet :: (dest: *void, c: s32, count: u32) -> *void #foreign libphysx "phys_PxMemSet"; + +PxMemCopy :: (dest: *void, src: *void, count: u32) -> *void #foreign libphysx "phys_PxMemCopy"; + +PxMemMove :: (dest: *void, src: *void, count: u32) -> *void #foreign libphysx "phys_PxMemMove"; + +PxMarkSerializedMemory :: (ptr: *void, byteSize: u32) -> void #foreign libphysx "phys_PxMarkSerializedMemory"; + +PxMemoryBarrier :: () -> void #foreign libphysx "phys_PxMemoryBarrier"; + +PxHighestSetBitUnsafe :: (v: u32) -> u32 #foreign libphysx "phys_PxHighestSetBitUnsafe"; + +PxLowestSetBitUnsafe :: (v: u32) -> u32 #foreign libphysx "phys_PxLowestSetBitUnsafe"; + +PxCountLeadingZeros :: (v: u32) -> u32 #foreign libphysx "phys_PxCountLeadingZeros"; + +PxPrefetchLine :: (ptr: *void, offset: u32) -> void #foreign libphysx "phys_PxPrefetchLine"; + +PxPrefetch :: (ptr: *void, count: u32) -> void #foreign libphysx "phys_PxPrefetch"; + +PxBitCount :: (v: u32) -> u32 #foreign libphysx "phys_PxBitCount"; + +PxIsPowerOfTwo :: (x: u32) -> bool #foreign libphysx "phys_PxIsPowerOfTwo"; + +PxNextPowerOfTwo :: (x: u32) -> u32 #foreign libphysx "phys_PxNextPowerOfTwo"; + +PxLowestSetBit :: (x: u32) -> u32 #foreign libphysx "phys_PxLowestSetBit"; + +PxHighestSetBit :: (x: u32) -> u32 #foreign libphysx "phys_PxHighestSetBit"; + +PxILog2 :: (num: u32) -> u32 #foreign libphysx "phys_PxILog2"; + +PxVec3_new :: () -> Vector3 #foreign libphysx; + +PxVec3_new :: (anon_param0: s32) -> Vector3 #foreign libphysx "PxVec3_new_1"; + +PxVec3_new :: (a: float) -> Vector3 #foreign libphysx "PxVec3_new_2"; + +PxVec3_new :: (nx: float, ny: float, nz: float) -> Vector3 #foreign libphysx "PxVec3_new_3"; + +PxVec3_isZero :: (self: *Vector3) -> bool #foreign libphysx; + +PxVec3_isFinite :: (self: *Vector3) -> bool #foreign libphysx; + +PxVec3_isNormalized :: (self: *Vector3) -> bool #foreign libphysx; + +PxVec3_magnitudeSquared :: (self: *Vector3) -> float #foreign libphysx; + +PxVec3_magnitude :: (self: *Vector3) -> float #foreign libphysx; + +PxVec3_dot :: (self: *Vector3, v: *Vector3) -> float #foreign libphysx; + +PxVec3_cross :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3_getNormalized :: (self: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3_normalize :: (self: *Vector3) -> float #foreign libphysx "PxVec3_normalize_mut"; + +PxVec3_normalizeSafe :: (self: *Vector3) -> float #foreign libphysx "PxVec3_normalizeSafe_mut"; + +PxVec3_normalizeFast :: (self: *Vector3) -> float #foreign libphysx "PxVec3_normalizeFast_mut"; + +PxVec3_multiply :: (self: *Vector3, a: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3_minimum :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3_minElement :: (self: *Vector3) -> float #foreign libphysx; + +PxVec3_maximum :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3_maxElement :: (self: *Vector3) -> float #foreign libphysx; + +PxVec3_abs :: (self: *Vector3) -> Vector3 #foreign libphysx; + +PxVec3Padded_new_alloc :: () -> *PxVec3Padded #foreign libphysx; + +PxVec3Padded_delete :: (self: *PxVec3Padded) -> void #foreign libphysx; + +PxVec3Padded_new_alloc :: (p: *Vector3) -> *PxVec3Padded #foreign libphysx "PxVec3Padded_new_alloc_1"; + +PxVec3Padded_new_alloc :: (f: float) -> *PxVec3Padded #foreign libphysx "PxVec3Padded_new_alloc_2"; + +PxQuat_new :: (anon_param0: s32) -> Quaternion #foreign libphysx "PxQuat_new_1"; + +PxQuat_new :: (r: float) -> Quaternion #foreign libphysx "PxQuat_new_2"; + +PxQuat_new :: (nx: float, ny: float, nz: float, nw: float) -> Quaternion #foreign libphysx "PxQuat_new_3"; + +PxQuat_new :: (angleRadians: float, unitAxis: *Vector3) -> Quaternion #foreign libphysx "PxQuat_new_4"; + +PxQuat_new :: (m: *PxMat33) -> Quaternion #foreign libphysx "PxQuat_new_5"; + +PxQuat_isIdentity :: (self: *Quaternion) -> bool #foreign libphysx; + +PxQuat_isFinite :: (self: *Quaternion) -> bool #foreign libphysx; + +PxQuat_isUnit :: (self: *Quaternion) -> bool #foreign libphysx; + +PxQuat_isSane :: (self: *Quaternion) -> bool #foreign libphysx; + +PxQuat_toRadiansAndUnitAxis :: (self: *Quaternion, angle: *float, axis: *Vector3) -> void #foreign libphysx; + +PxQuat_getAngle :: (self: *Quaternion) -> float #foreign libphysx; + +PxQuat_getAngle :: (self: *Quaternion, q: *Quaternion) -> float #foreign libphysx "PxQuat_getAngle_1"; + +PxQuat_magnitudeSquared :: (self: *Quaternion) -> float #foreign libphysx; + +PxQuat_dot :: (self: *Quaternion, v: *Quaternion) -> float #foreign libphysx; + +PxQuat_getNormalized :: (self: *Quaternion) -> Quaternion #foreign libphysx; + +PxQuat_magnitude :: (self: *Quaternion) -> float #foreign libphysx; + +PxQuat_normalize :: (self: *Quaternion) -> float #foreign libphysx "PxQuat_normalize_mut"; + +PxQuat_getConjugate :: (self: *Quaternion) -> Quaternion #foreign libphysx; + +PxQuat_getImaginaryPart :: (self: *Quaternion) -> Vector3 #foreign libphysx; + +PxQuat_getBasisVector0 :: (self: *Quaternion) -> Vector3 #foreign libphysx; + +PxQuat_getBasisVector1 :: (self: *Quaternion) -> Vector3 #foreign libphysx; + +PxQuat_getBasisVector2 :: (self: *Quaternion) -> Vector3 #foreign libphysx; + +PxQuat_rotate :: (self: *Quaternion, v: *Vector3) -> Vector3 #foreign libphysx; + +PxQuat_rotateInv :: (self: *Quaternion, v: *Vector3) -> Vector3 #foreign libphysx; + +PxTransform_new :: (position: *Vector3) -> PxTransform #foreign libphysx "PxTransform_new_1"; + +PxTransform_new :: (anon_param0: s32) -> PxTransform #foreign libphysx "PxTransform_new_2"; + +PxTransform_new :: (orientation: *Quaternion) -> PxTransform #foreign libphysx "PxTransform_new_3"; + +PxTransform_new :: (x: float, y: float, z: float, aQ: Quaternion) -> PxTransform #foreign libphysx "PxTransform_new_4"; + +PxTransform_new :: (p0: *Vector3, q0: *Quaternion) -> PxTransform #foreign libphysx "PxTransform_new_5"; + +PxTransform_new :: (m: *PxMat44) -> PxTransform #foreign libphysx "PxTransform_new_6"; + +PxTransform_getInverse :: (self: *PxTransform) -> PxTransform #foreign libphysx; + +PxTransform_transform :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign libphysx; + +PxTransform_transformInv :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign libphysx; + +PxTransform_rotate :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign libphysx; + +PxTransform_rotateInv :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign libphysx; + +PxTransform_transform :: (self: *PxTransform, src: *PxTransform) -> PxTransform #foreign libphysx "PxTransform_transform_1"; + +PxTransform_isValid :: (self: *PxTransform) -> bool #foreign libphysx; + +PxTransform_isSane :: (self: *PxTransform) -> bool #foreign libphysx; + +PxTransform_isFinite :: (self: *PxTransform) -> bool #foreign libphysx; + +PxTransform_transformInv :: (self: *PxTransform, src: *PxTransform) -> PxTransform #foreign libphysx "PxTransform_transformInv_1"; + +PxTransform_getNormalized :: (self: *PxTransform) -> PxTransform #foreign libphysx; + +PxMat33_new :: () -> PxMat33 #foreign libphysx; + +PxMat33_new :: (col0: *Vector3, col1: *Vector3, col2: *Vector3) -> PxMat33 #foreign libphysx "PxMat33_new_3"; + +PxMat33_new :: (r: float) -> PxMat33 #foreign libphysx "PxMat33_new_4"; + +PxMat33_new :: (values: *float) -> PxMat33 #foreign libphysx "PxMat33_new_5"; + +PxMat33_new :: (q: *Quaternion) -> PxMat33 #foreign libphysx "PxMat33_new_6"; + +PxMat33_createDiagonal :: (d: *Vector3) -> PxMat33 #foreign libphysx; + +PxMat33_outer :: (a: *Vector3, b: *Vector3) -> PxMat33 #foreign libphysx; + +PxMat33_getTranspose :: (self: *PxMat33) -> PxMat33 #foreign libphysx; + +PxMat33_getInverse :: (self: *PxMat33) -> PxMat33 #foreign libphysx; + +PxMat33_getDeterminant :: (self: *PxMat33) -> float #foreign libphysx; + +PxMat33_transform :: (self: *PxMat33, other: *Vector3) -> Vector3 #foreign libphysx; + +PxMat33_transformTranspose :: (self: *PxMat33, other: *Vector3) -> Vector3 #foreign libphysx; + +PxMat33_front :: (self: *PxMat33) -> *float #foreign libphysx; + +PxBounds3_new :: () -> PxBounds3 #foreign libphysx; + +PxBounds3_new :: (minimum: *Vector3, maximum: *Vector3) -> PxBounds3 #foreign libphysx "PxBounds3_new_1"; + +PxBounds3_empty :: () -> PxBounds3 #foreign libphysx; + +PxBounds3_boundsOfPoints :: (v0: *Vector3, v1: *Vector3) -> PxBounds3 #foreign libphysx; + +PxBounds3_centerExtents :: (center: *Vector3, extent: *Vector3) -> PxBounds3 #foreign libphysx; + +PxBounds3_basisExtent :: (center: *Vector3, basis: *PxMat33, extent: *Vector3) -> PxBounds3 #foreign libphysx; + +PxBounds3_poseExtent :: (pose: *PxTransform, extent: *Vector3) -> PxBounds3 #foreign libphysx; + +PxBounds3_transformSafe :: (matrix: *PxMat33, bounds: *PxBounds3) -> PxBounds3 #foreign libphysx; + +PxBounds3_transformFast :: (matrix: *PxMat33, bounds: *PxBounds3) -> PxBounds3 #foreign libphysx; + +PxBounds3_transformSafe :: (transform: *PxTransform, bounds: *PxBounds3) -> PxBounds3 #foreign libphysx "PxBounds3_transformSafe_1"; + +PxBounds3_transformFast :: (transform: *PxTransform, bounds: *PxBounds3) -> PxBounds3 #foreign libphysx "PxBounds3_transformFast_1"; + +PxBounds3_setEmpty :: (self: *PxBounds3) -> void #foreign libphysx "PxBounds3_setEmpty_mut"; + +PxBounds3_setMaximal :: (self: *PxBounds3) -> void #foreign libphysx "PxBounds3_setMaximal_mut"; + +PxBounds3_include :: (self: *PxBounds3, v: *Vector3) -> void #foreign libphysx "PxBounds3_include_mut"; + +PxBounds3_include_mut :: (self: *PxBounds3, b: *PxBounds3) -> void #foreign libphysx "PxBounds3_include_mut_1"; + +PxBounds3_isEmpty :: (self: *PxBounds3) -> bool #foreign libphysx; + +PxBounds3_intersects :: (self: *PxBounds3, b: *PxBounds3) -> bool #foreign libphysx; + +PxBounds3_intersects1D :: (self: *PxBounds3, a: *PxBounds3, axis: u32) -> bool #foreign libphysx; + +PxBounds3_contains :: (self: *PxBounds3, v: *Vector3) -> bool #foreign libphysx; + +PxBounds3_isInside :: (self: *PxBounds3, box: *PxBounds3) -> bool #foreign libphysx; + +PxBounds3_getCenter :: (self: *PxBounds3) -> Vector3 #foreign libphysx; + +PxBounds3_getCenter :: (self: *PxBounds3, axis: u32) -> float #foreign libphysx "PxBounds3_getCenter_1"; + +PxBounds3_getExtents :: (self: *PxBounds3, axis: u32) -> float #foreign libphysx; + +PxBounds3_getDimensions :: (self: *PxBounds3) -> Vector3 #foreign libphysx; + +PxBounds3_getExtents :: (self: *PxBounds3) -> Vector3 #foreign libphysx "PxBounds3_getExtents_1"; + +PxBounds3_scaleSafe :: (self: *PxBounds3, scale: float) -> void #foreign libphysx "PxBounds3_scaleSafe_mut"; + +PxBounds3_scaleFast :: (self: *PxBounds3, scale: float) -> void #foreign libphysx "PxBounds3_scaleFast_mut"; + +PxBounds3_fattenSafe :: (self: *PxBounds3, distance: float) -> void #foreign libphysx "PxBounds3_fattenSafe_mut"; + +PxBounds3_fattenFast :: (self: *PxBounds3, distance: float) -> void #foreign libphysx "PxBounds3_fattenFast_mut"; + +PxBounds3_isFinite :: (self: *PxBounds3) -> bool #foreign libphysx; + +PxBounds3_isValid :: (self: *PxBounds3) -> bool #foreign libphysx; + +PxBounds3_closestPoint :: (self: *PxBounds3, p: *Vector3) -> Vector3 #foreign libphysx; + +PxErrorCallback_delete :: (self: *PxErrorCallback) -> void #foreign libphysx; + +PxErrorCallback_reportError :: (self: *PxErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign libphysx "PxErrorCallback_reportError_mut"; + +PxAllocationListener_onAllocation :: (self: *PxAllocationListener, size: u64, typeName: *u8, filename: *u8, line: s32, allocatedMemory: *void) -> void #foreign libphysx "PxAllocationListener_onAllocation_mut"; + +PxAllocationListener_onDeallocation :: (self: *PxAllocationListener, allocatedMemory: *void) -> void #foreign libphysx "PxAllocationListener_onDeallocation_mut"; + +PxBroadcastingAllocator_new_alloc :: (allocator: *PxAllocatorCallback, error: *PxErrorCallback) -> *PxBroadcastingAllocator #foreign libphysx; + +PxBroadcastingAllocator_delete :: (self: *PxBroadcastingAllocator) -> void #foreign libphysx; + +PxBroadcastingAllocator_allocate :: (self: *PxBroadcastingAllocator, size: u64, typeName: *u8, filename: *u8, line: s32) -> *void #foreign libphysx "PxBroadcastingAllocator_allocate_mut"; + +PxBroadcastingAllocator_deallocate :: (self: *PxBroadcastingAllocator, ptr: *void) -> void #foreign libphysx "PxBroadcastingAllocator_deallocate_mut"; + +PxBroadcastingErrorCallback_new_alloc :: (errorCallback: *PxErrorCallback) -> *PxBroadcastingErrorCallback #foreign libphysx; + +PxBroadcastingErrorCallback_delete :: (self: *PxBroadcastingErrorCallback) -> void #foreign libphysx; + +PxBroadcastingErrorCallback_reportError :: (self: *PxBroadcastingErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign libphysx "PxBroadcastingErrorCallback_reportError_mut"; + +PxEnableFPExceptions :: () -> void #foreign libphysx "phys_PxEnableFPExceptions"; + +PxDisableFPExceptions :: () -> void #foreign libphysx "phys_PxDisableFPExceptions"; + +PxInputStream_read :: (self: *PxInputStream, dest: *void, count: u32) -> u32 #foreign libphysx "PxInputStream_read_mut"; + +PxInputStream_delete :: (self: *PxInputStream) -> void #foreign libphysx; + +PxInputData_getLength :: (self: *PxInputData) -> u32 #foreign libphysx; + +PxInputData_seek :: (self: *PxInputData, offset: u32) -> void #foreign libphysx "PxInputData_seek_mut"; + +PxInputData_tell :: (self: *PxInputData) -> u32 #foreign libphysx; + +PxInputData_delete :: (self: *PxInputData) -> void #foreign libphysx; + +PxOutputStream_write :: (self: *PxOutputStream, src: *void, count: u32) -> u32 #foreign libphysx "PxOutputStream_write_mut"; + +PxOutputStream_delete :: (self: *PxOutputStream) -> void #foreign libphysx; + +PxVec4_new :: () -> Vector4 #foreign libphysx; + +PxVec4_new :: (anon_param0: s32) -> Vector4 #foreign libphysx "PxVec4_new_1"; + +PxVec4_new :: (a: float) -> Vector4 #foreign libphysx "PxVec4_new_2"; + +PxVec4_new :: (nx: float, ny: float, nz: float, nw: float) -> Vector4 #foreign libphysx "PxVec4_new_3"; + +PxVec4_new :: (v: *Vector3, nw: float) -> Vector4 #foreign libphysx "PxVec4_new_4"; + +PxVec4_new :: (v: *float) -> Vector4 #foreign libphysx "PxVec4_new_5"; + +PxVec4_isZero :: (self: *Vector4) -> bool #foreign libphysx; + +PxVec4_isFinite :: (self: *Vector4) -> bool #foreign libphysx; + +PxVec4_isNormalized :: (self: *Vector4) -> bool #foreign libphysx; + +PxVec4_magnitudeSquared :: (self: *Vector4) -> float #foreign libphysx; + +PxVec4_magnitude :: (self: *Vector4) -> float #foreign libphysx; + +PxVec4_dot :: (self: *Vector4, v: *Vector4) -> float #foreign libphysx; + +PxVec4_getNormalized :: (self: *Vector4) -> Vector4 #foreign libphysx; + +PxVec4_normalize :: (self: *Vector4) -> float #foreign libphysx "PxVec4_normalize_mut"; + +PxVec4_multiply :: (self: *Vector4, a: *Vector4) -> Vector4 #foreign libphysx; + +PxVec4_minimum :: (self: *Vector4, v: *Vector4) -> Vector4 #foreign libphysx; + +PxVec4_maximum :: (self: *Vector4, v: *Vector4) -> Vector4 #foreign libphysx; + +PxVec4_getXYZ :: (self: *Vector4) -> Vector3 #foreign libphysx; + +PxMat44_new :: () -> PxMat44 #foreign libphysx; + +PxMat44_new :: (col0: *Vector4, col1: *Vector4, col2: *Vector4, col3: *Vector4) -> PxMat44 #foreign libphysx "PxMat44_new_3"; + +PxMat44_new :: (r: float) -> PxMat44 #foreign libphysx "PxMat44_new_4"; + +PxMat44_new :: (col0: *Vector3, col1: *Vector3, col2: *Vector3, col3: *Vector3) -> PxMat44 #foreign libphysx "PxMat44_new_5"; + +PxMat44_new :: (values: *float) -> PxMat44 #foreign libphysx "PxMat44_new_6"; + +PxMat44_new :: (q: *Quaternion) -> PxMat44 #foreign libphysx "PxMat44_new_7"; + +PxMat44_new :: (diagonal: *Vector4) -> PxMat44 #foreign libphysx "PxMat44_new_8"; + +PxMat44_new :: (axes: *PxMat33, position: *Vector3) -> PxMat44 #foreign libphysx "PxMat44_new_9"; + +PxMat44_new :: (t: *PxTransform) -> PxMat44 #foreign libphysx "PxMat44_new_10"; + +PxMat44_getTranspose :: (self: *PxMat44) -> PxMat44 #foreign libphysx; + +PxMat44_transform :: (self: *PxMat44, other: *Vector4) -> Vector4 #foreign libphysx; + +PxMat44_transform :: (self: *PxMat44, other: *Vector3) -> Vector3 #foreign libphysx "PxMat44_transform_1"; + +PxMat44_rotate :: (self: *PxMat44, other: *Vector4) -> Vector4 #foreign libphysx; + +PxMat44_rotate :: (self: *PxMat44, other: *Vector3) -> Vector3 #foreign libphysx "PxMat44_rotate_1"; + +PxMat44_getBasis :: (self: *PxMat44, num: u32) -> Vector3 #foreign libphysx; + +PxMat44_getPosition :: (self: *PxMat44) -> Vector3 #foreign libphysx; + +PxMat44_setPosition :: (self: *PxMat44, position: *Vector3) -> void #foreign libphysx "PxMat44_setPosition_mut"; + +PxMat44_front :: (self: *PxMat44) -> *float #foreign libphysx; + +PxMat44_scale :: (self: *PxMat44, p: *Vector4) -> void #foreign libphysx "PxMat44_scale_mut"; + +PxMat44_inverseRT :: (self: *PxMat44) -> PxMat44 #foreign libphysx; + +PxMat44_isFinite :: (self: *PxMat44) -> bool #foreign libphysx; + +PxPlane_new :: () -> Plane3 #foreign libphysx; + +PxPlane_new :: (nx: float, ny: float, nz: float, distance: float) -> Plane3 #foreign libphysx "PxPlane_new_1"; + +PxPlane_new :: (normal: *Vector3, distance: float) -> Plane3 #foreign libphysx "PxPlane_new_2"; + +PxPlane_new :: (point: *Vector3, normal: *Vector3) -> Plane3 #foreign libphysx "PxPlane_new_3"; + +PxPlane_new :: (p0: *Vector3, p1: *Vector3, p2: *Vector3) -> Plane3 #foreign libphysx "PxPlane_new_4"; + +PxPlane_distance :: (self: *Plane3, p: *Vector3) -> float #foreign libphysx; + +PxPlane_contains :: (self: *Plane3, p: *Vector3) -> bool #foreign libphysx; + +PxPlane_project :: (self: *Plane3, p: *Vector3) -> Vector3 #foreign libphysx; + +PxPlane_pointInPlane :: (self: *Plane3) -> Vector3 #foreign libphysx; + +PxPlane_normalize :: (self: *Plane3) -> void #foreign libphysx "PxPlane_normalize_mut"; + +PxPlane_transform :: (self: *Plane3, pose: *PxTransform) -> Plane3 #foreign libphysx; + +PxPlane_inverseTransform :: (self: *Plane3, pose: *PxTransform) -> Plane3 #foreign libphysx; + +PxShortestRotation :: (from: *Vector3, target: *Vector3) -> Quaternion #foreign libphysx "phys_PxShortestRotation"; + +PxDiagonalize :: (m: *PxMat33, axes: *Quaternion) -> Vector3 #foreign libphysx "phys_PxDiagonalize"; + +PxTransformFromSegment :: (p0: *Vector3, p1: *Vector3, halfHeight: *float) -> PxTransform #foreign libphysx "phys_PxTransformFromSegment"; + +PxTransformFromPlaneEquation :: (plane: *Plane3) -> PxTransform #foreign libphysx "phys_PxTransformFromPlaneEquation"; + +PxPlaneEquationFromTransform :: (pose: *PxTransform) -> Plane3 #foreign libphysx "phys_PxPlaneEquationFromTransform"; + +PxSlerp :: (t: float, left: *Quaternion, right: *Quaternion) -> Quaternion #foreign libphysx "phys_PxSlerp"; + +PxIntegrateTransform :: (curTrans: *PxTransform, linvel: *Vector3, angvel: *Vector3, timeStep: float, result: *PxTransform) -> void #foreign libphysx "phys_PxIntegrateTransform"; + +PxExp :: (v: *Vector3) -> Quaternion #foreign libphysx "phys_PxExp"; + +PxOptimizeBoundingBox :: (basis: *PxMat33) -> Vector3 #foreign libphysx "phys_PxOptimizeBoundingBox"; + +PxLog :: (q: *Quaternion) -> Vector3 #foreign libphysx "phys_PxLog"; + +PxLargestAxis :: (v: *Vector3) -> u32 #foreign libphysx "phys_PxLargestAxis"; + +PxTanHalf :: (sin: float, cos: float) -> float #foreign libphysx "phys_PxTanHalf"; + +PxEllipseClamp :: (point: *Vector3, radii: *Vector3) -> Vector3 #foreign libphysx "phys_PxEllipseClamp"; + +PxSeparateSwingTwist :: (q: *Quaternion, swing: *Quaternion, twist: *Quaternion) -> void #foreign libphysx "phys_PxSeparateSwingTwist"; + +PxComputeAngle :: (v0: *Vector3, v1: *Vector3) -> float #foreign libphysx "phys_PxComputeAngle"; + +PxComputeBasisVectors :: (dir: *Vector3, right: *Vector3, up: *Vector3) -> void #foreign libphysx "phys_PxComputeBasisVectors"; + +PxComputeBasisVectors_1 :: (p0: *Vector3, p1: *Vector3, dir: *Vector3, right: *Vector3, up: *Vector3) -> void #foreign libphysx "phys_PxComputeBasisVectors_1"; + +PxGetNextIndex3 :: (i: u32) -> u32 #foreign libphysx "phys_PxGetNextIndex3"; + +computeBarycentric :: (a: *Vector3, b: *Vector3, c: *Vector3, d: *Vector3, p: *Vector3, bary: *Vector4) -> void #foreign libphysx "phys_computeBarycentric"; + +computeBarycentric_1 :: (a: *Vector3, b: *Vector3, c: *Vector3, p: *Vector3, bary: *Vector4) -> void #foreign libphysx "phys_computeBarycentric_1"; + +Interpolation_PxLerp :: (a: float, b: float, t: float) -> float #foreign libphysx; + +Interpolation_PxBiLerp :: (f00: float, f10: float, f01: float, f11: float, tx: float, ty: float) -> float #foreign libphysx; + +Interpolation_PxTriLerp :: (f000: float, f100: float, f010: float, f110: float, f001: float, f101: float, f011: float, f111: float, tx: float, ty: float, tz: float) -> float #foreign libphysx; + +Interpolation_PxSDFIdx :: (i: u32, j: u32, k: u32, nbX: u32, nbY: u32) -> u32 #foreign libphysx; + +Interpolation_PxSDFSampleImpl :: (sdf: *float, localPos: *Vector3, sdfBoxLower: *Vector3, sdfBoxHigher: *Vector3, sdfDx: float, invSdfDx: float, dimX: u32, dimY: u32, dimZ: u32, tolerance: float) -> float #foreign libphysx; + +PxSdfSample :: (sdf: *float, localPos: *Vector3, sdfBoxLower: *Vector3, sdfBoxHigher: *Vector3, sdfDx: float, invSdfDx: float, dimX: u32, dimY: u32, dimZ: u32, gradient: *Vector3, tolerance: float) -> float #foreign libphysx "phys_PxSdfSample"; + +PxMutexImpl_new_alloc :: () -> *PxMutexImpl #foreign libphysx; + +PxMutexImpl_delete :: (self: *PxMutexImpl) -> void #foreign libphysx; + +PxMutexImpl_lock :: (self: *PxMutexImpl) -> void #foreign libphysx "PxMutexImpl_lock_mut"; + +PxMutexImpl_trylock :: (self: *PxMutexImpl) -> bool #foreign libphysx "PxMutexImpl_trylock_mut"; + +PxMutexImpl_unlock :: (self: *PxMutexImpl) -> void #foreign libphysx "PxMutexImpl_unlock_mut"; + +PxMutexImpl_getSize :: () -> u32 #foreign libphysx; + +PxReadWriteLock_new_alloc :: () -> *PxReadWriteLock #foreign libphysx; + +PxReadWriteLock_delete :: (self: *PxReadWriteLock) -> void #foreign libphysx; + +PxReadWriteLock_lockReader :: (self: *PxReadWriteLock, takeLock: bool) -> void #foreign libphysx "PxReadWriteLock_lockReader_mut"; + +PxReadWriteLock_lockWriter :: (self: *PxReadWriteLock) -> void #foreign libphysx "PxReadWriteLock_lockWriter_mut"; + +PxReadWriteLock_unlockReader :: (self: *PxReadWriteLock) -> void #foreign libphysx "PxReadWriteLock_unlockReader_mut"; + +PxReadWriteLock_unlockWriter :: (self: *PxReadWriteLock) -> void #foreign libphysx "PxReadWriteLock_unlockWriter_mut"; + +PxProfilerCallback_zoneStart :: (self: *PxProfilerCallback, eventName: *u8, detached: bool, contextId: u64) -> *void #foreign libphysx "PxProfilerCallback_zoneStart_mut"; + +PxProfilerCallback_zoneEnd :: (self: *PxProfilerCallback, profilerData: *void, eventName: *u8, detached: bool, contextId: u64) -> void #foreign libphysx "PxProfilerCallback_zoneEnd_mut"; + +PxProfileScoped_new_alloc :: (callback: *PxProfilerCallback, eventName: *u8, detached: bool, contextId: u64) -> *PxProfileScoped #foreign libphysx; + +PxProfileScoped_delete :: (self: *PxProfileScoped) -> void #foreign libphysx; + +PxSListEntry_new :: () -> PxSListEntry #foreign libphysx; + +PxSListEntry_next :: (self: *PxSListEntry) -> *PxSListEntry #foreign libphysx "PxSListEntry_next_mut"; + +PxSListImpl_new_alloc :: () -> *PxSListImpl #foreign libphysx; + +PxSListImpl_delete :: (self: *PxSListImpl) -> void #foreign libphysx; + +PxSListImpl_push :: (self: *PxSListImpl, entry: *PxSListEntry) -> void #foreign libphysx "PxSListImpl_push_mut"; + +PxSListImpl_pop :: (self: *PxSListImpl) -> *PxSListEntry #foreign libphysx "PxSListImpl_pop_mut"; + +PxSListImpl_flush :: (self: *PxSListImpl) -> *PxSListEntry #foreign libphysx "PxSListImpl_flush_mut"; + +PxSListImpl_getSize :: () -> u32 #foreign libphysx; + +PxSyncImpl_new_alloc :: () -> *PxSyncImpl #foreign libphysx; + +PxSyncImpl_delete :: (self: *PxSyncImpl) -> void #foreign libphysx; + +PxSyncImpl_wait :: (self: *PxSyncImpl, milliseconds: u32) -> bool #foreign libphysx "PxSyncImpl_wait_mut"; + +PxSyncImpl_set :: (self: *PxSyncImpl) -> void #foreign libphysx "PxSyncImpl_set_mut"; + +PxSyncImpl_reset :: (self: *PxSyncImpl) -> void #foreign libphysx "PxSyncImpl_reset_mut"; + +PxSyncImpl_getSize :: () -> u32 #foreign libphysx; + +PxRunnable_new_alloc :: () -> *PxRunnable #foreign libphysx; + +PxRunnable_delete :: (self: *PxRunnable) -> void #foreign libphysx; + +PxRunnable_execute :: (self: *PxRunnable) -> void #foreign libphysx "PxRunnable_execute_mut"; + +PxTlsAlloc :: () -> u32 #foreign libphysx "phys_PxTlsAlloc"; + +PxTlsFree :: (index: u32) -> void #foreign libphysx "phys_PxTlsFree"; + +PxTlsGet :: (index: u32) -> *void #foreign libphysx "phys_PxTlsGet"; + +PxTlsGetValue :: (index: u32) -> u64 #foreign libphysx "phys_PxTlsGetValue"; + +PxTlsSet :: (index: u32, value: *void) -> u32 #foreign libphysx "phys_PxTlsSet"; + +PxTlsSetValue :: (index: u32, value: u64) -> u32 #foreign libphysx "phys_PxTlsSetValue"; + +PxCounterFrequencyToTensOfNanos_new :: (inNum: u64, inDenom: u64) -> PxCounterFrequencyToTensOfNanos #foreign libphysx; + +PxCounterFrequencyToTensOfNanos_toTensOfNanos :: (self: *PxCounterFrequencyToTensOfNanos, inCounter: u64) -> u64 #foreign libphysx; + +PxTime_getBootCounterFrequency :: () -> *PxCounterFrequencyToTensOfNanos #foreign libphysx; + +PxTime_getCounterFrequency :: () -> PxCounterFrequencyToTensOfNanos #foreign libphysx; + +PxTime_getCurrentCounterValue :: () -> u64 #foreign libphysx; + +PxTime_getCurrentTimeInTensOfNanoSeconds :: () -> u64 #foreign libphysx; + +PxTime_new :: () -> PxTime #foreign libphysx; + +PxTime_getElapsedSeconds :: (self: *PxTime) -> float64 #foreign libphysx "PxTime_getElapsedSeconds_mut"; + +PxTime_peekElapsedSeconds :: (self: *PxTime) -> float64 #foreign libphysx "PxTime_peekElapsedSeconds_mut"; + +PxTime_getLastTime :: (self: *PxTime) -> float64 #foreign libphysx; + +PxVec2_new :: () -> Vector2 #foreign libphysx; + +PxVec2_new :: (anon_param0: s32) -> Vector2 #foreign libphysx "PxVec2_new_1"; + +PxVec2_new :: (a: float) -> Vector2 #foreign libphysx "PxVec2_new_2"; + +PxVec2_new :: (nx: float, ny: float) -> Vector2 #foreign libphysx "PxVec2_new_3"; + +PxVec2_isZero :: (self: *Vector2) -> bool #foreign libphysx; + +PxVec2_isFinite :: (self: *Vector2) -> bool #foreign libphysx; + +PxVec2_isNormalized :: (self: *Vector2) -> bool #foreign libphysx; + +PxVec2_magnitudeSquared :: (self: *Vector2) -> float #foreign libphysx; + +PxVec2_magnitude :: (self: *Vector2) -> float #foreign libphysx; + +PxVec2_dot :: (self: *Vector2, v: *Vector2) -> float #foreign libphysx; + +PxVec2_getNormalized :: (self: *Vector2) -> Vector2 #foreign libphysx; + +PxVec2_normalize :: (self: *Vector2) -> float #foreign libphysx "PxVec2_normalize_mut"; + +PxVec2_multiply :: (self: *Vector2, a: *Vector2) -> Vector2 #foreign libphysx; + +PxVec2_minimum :: (self: *Vector2, v: *Vector2) -> Vector2 #foreign libphysx; + +PxVec2_minElement :: (self: *Vector2) -> float #foreign libphysx; + +PxVec2_maximum :: (self: *Vector2, v: *Vector2) -> Vector2 #foreign libphysx; + +PxVec2_maxElement :: (self: *Vector2) -> float #foreign libphysx; + +PxStridedData_new :: () -> PxStridedData #foreign libphysx; + +PxBoundedData_new :: () -> PxBoundedData #foreign libphysx; + +PxDebugPoint_new :: (p: *Vector3, c: *u32) -> PxDebugPoint #foreign libphysx; + +PxDebugLine_new :: (p0: *Vector3, p1: *Vector3, c: *u32) -> PxDebugLine #foreign libphysx; + +PxDebugTriangle_new :: (p0: *Vector3, p1: *Vector3, p2: *Vector3, c: *u32) -> PxDebugTriangle #foreign libphysx; + +PxDebugText_new :: () -> PxDebugText #foreign libphysx; + +PxDebugText_new :: (pos: *Vector3, sz: *float, clr: *u32, str: *u8) -> PxDebugText #foreign libphysx "PxDebugText_new_1"; + +PxRenderBuffer_delete :: (self: *PxRenderBuffer) -> void #foreign libphysx; + +PxRenderBuffer_getNbPoints :: (self: *PxRenderBuffer) -> u32 #foreign libphysx; + +PxRenderBuffer_getPoints :: (self: *PxRenderBuffer) -> *PxDebugPoint #foreign libphysx; + +PxRenderBuffer_addPoint :: (self: *PxRenderBuffer, point: *PxDebugPoint) -> void #foreign libphysx "PxRenderBuffer_addPoint_mut"; + +PxRenderBuffer_getNbLines :: (self: *PxRenderBuffer) -> u32 #foreign libphysx; + +PxRenderBuffer_getLines :: (self: *PxRenderBuffer) -> *PxDebugLine #foreign libphysx; + +PxRenderBuffer_addLine :: (self: *PxRenderBuffer, line: *PxDebugLine) -> void #foreign libphysx "PxRenderBuffer_addLine_mut"; + +PxRenderBuffer_reserveLines :: (self: *PxRenderBuffer, nbLines: u32) -> *PxDebugLine #foreign libphysx "PxRenderBuffer_reserveLines_mut"; + +PxRenderBuffer_reservePoints :: (self: *PxRenderBuffer, nbLines: u32) -> *PxDebugPoint #foreign libphysx "PxRenderBuffer_reservePoints_mut"; + +PxRenderBuffer_getNbTriangles :: (self: *PxRenderBuffer) -> u32 #foreign libphysx; + +PxRenderBuffer_getTriangles :: (self: *PxRenderBuffer) -> *PxDebugTriangle #foreign libphysx; + +PxRenderBuffer_addTriangle :: (self: *PxRenderBuffer, triangle: *PxDebugTriangle) -> void #foreign libphysx "PxRenderBuffer_addTriangle_mut"; + +PxRenderBuffer_append :: (self: *PxRenderBuffer, other: *PxRenderBuffer) -> void #foreign libphysx "PxRenderBuffer_append_mut"; + +PxRenderBuffer_clear :: (self: *PxRenderBuffer) -> void #foreign libphysx "PxRenderBuffer_clear_mut"; + +PxRenderBuffer_shift :: (self: *PxRenderBuffer, delta: *Vector3) -> void #foreign libphysx "PxRenderBuffer_shift_mut"; + +PxRenderBuffer_empty :: (self: *PxRenderBuffer) -> bool #foreign libphysx; + +PxProcessPxBaseCallback_delete :: (self: *PxProcessPxBaseCallback) -> void #foreign libphysx; + +PxProcessPxBaseCallback_process :: (self: *PxProcessPxBaseCallback, anon_param0: *PxBase) -> void #foreign libphysx "PxProcessPxBaseCallback_process_mut"; + +PxSerializationContext_registerReference :: (self: *PxSerializationContext, base: *PxBase, kind: u32, reference: u64) -> void #foreign libphysx "PxSerializationContext_registerReference_mut"; + +PxSerializationContext_getCollection :: (self: *PxSerializationContext) -> *PxCollection #foreign libphysx; + +PxSerializationContext_writeData :: (self: *PxSerializationContext, data: *void, size: u32) -> void #foreign libphysx "PxSerializationContext_writeData_mut"; + +PxSerializationContext_alignData :: (self: *PxSerializationContext, alignment: u32) -> void #foreign libphysx "PxSerializationContext_alignData_mut"; + +PxSerializationContext_writeName :: (self: *PxSerializationContext, name: *u8) -> void #foreign libphysx "PxSerializationContext_writeName_mut"; + +PxDeserializationContext_resolveReference :: (self: *PxDeserializationContext, kind: u32, reference: u64) -> *PxBase #foreign libphysx; + +PxDeserializationContext_readName :: (self: *PxDeserializationContext, name: **u8) -> void #foreign libphysx "PxDeserializationContext_readName_mut"; + +PxDeserializationContext_alignExtraData :: (self: *PxDeserializationContext, alignment: u32) -> void #foreign libphysx "PxDeserializationContext_alignExtraData_mut"; + +PxSerializationRegistry_registerSerializer :: (self: *PxSerializationRegistry, type: u16, serializer: *PxSerializer) -> void #foreign libphysx "PxSerializationRegistry_registerSerializer_mut"; + +PxSerializationRegistry_unregisterSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxSerializer #foreign libphysx "PxSerializationRegistry_unregisterSerializer_mut"; + +PxSerializationRegistry_getSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxSerializer #foreign libphysx; + +PxSerializationRegistry_registerRepXSerializer :: (self: *PxSerializationRegistry, type: u16, serializer: *PxRepXSerializer) -> void #foreign libphysx "PxSerializationRegistry_registerRepXSerializer_mut"; + +PxSerializationRegistry_unregisterRepXSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxRepXSerializer #foreign libphysx "PxSerializationRegistry_unregisterRepXSerializer_mut"; + +PxSerializationRegistry_getRepXSerializer :: (self: *PxSerializationRegistry, typeName: *u8) -> *PxRepXSerializer #foreign libphysx; + +PxSerializationRegistry_release :: (self: *PxSerializationRegistry) -> void #foreign libphysx "PxSerializationRegistry_release_mut"; + +PxCollection_add :: (self: *PxCollection, object: *PxBase, id: u64) -> void #foreign libphysx "PxCollection_add_mut"; + +PxCollection_remove :: (self: *PxCollection, object: *PxBase) -> void #foreign libphysx "PxCollection_remove_mut"; + +PxCollection_contains :: (self: *PxCollection, object: *PxBase) -> bool #foreign libphysx; + +PxCollection_addId :: (self: *PxCollection, object: *PxBase, id: u64) -> void #foreign libphysx "PxCollection_addId_mut"; + +PxCollection_removeId :: (self: *PxCollection, id: u64) -> void #foreign libphysx "PxCollection_removeId_mut"; + +PxCollection_add_mut :: (self: *PxCollection, collection: *PxCollection) -> void #foreign libphysx "PxCollection_add_mut_1"; + +PxCollection_remove_mut :: (self: *PxCollection, collection: *PxCollection) -> void #foreign libphysx "PxCollection_remove_mut_1"; + +PxCollection_getNbObjects :: (self: *PxCollection) -> u32 #foreign libphysx; + +PxCollection_getObject :: (self: *PxCollection, index: u32) -> *PxBase #foreign libphysx; + +PxCollection_getObjects :: (self: *PxCollection, userBuffer: **PxBase, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxCollection_find :: (self: *PxCollection, id: u64) -> *PxBase #foreign libphysx; + +PxCollection_getNbIds :: (self: *PxCollection) -> u32 #foreign libphysx; + +PxCollection_getIds :: (self: *PxCollection, userBuffer: *u64, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxCollection_getId :: (self: *PxCollection, object: *PxBase) -> u64 #foreign libphysx; + +PxCollection_release :: (self: *PxCollection) -> void #foreign libphysx "PxCollection_release_mut"; + +PxCreateCollection :: () -> *PxCollection #foreign libphysx "phys_PxCreateCollection"; + +PxBase_release :: (self: *PxBase) -> void #foreign libphysx "PxBase_release_mut"; + +PxBase_getConcreteTypeName :: (self: *PxBase) -> *u8 #foreign libphysx; + +PxBase_getConcreteType :: (self: *PxBase) -> u16 #foreign libphysx; + +PxBase_setBaseFlag :: (self: *PxBase, flag: s32, value: bool) -> void #foreign libphysx "PxBase_setBaseFlag_mut"; + +PxBase_setBaseFlags :: (self: *PxBase, inFlags: u16) -> void #foreign libphysx "PxBase_setBaseFlags_mut"; + +PxBase_getBaseFlags :: (self: *PxBase) -> u16 #foreign libphysx; + +PxBase_isReleasable :: (self: *PxBase) -> bool #foreign libphysx; + +PxRefCounted_release :: (self: *PxRefCounted) -> void #foreign libphysx "PxRefCounted_release_mut"; + +PxRefCounted_getReferenceCount :: (self: *PxRefCounted) -> u32 #foreign libphysx; + +PxRefCounted_acquireReference :: (self: *PxRefCounted) -> void #foreign libphysx "PxRefCounted_acquireReference_mut"; + +PxTolerancesScale_new :: (defaultLength: float, defaultSpeed: float) -> PxTolerancesScale #foreign libphysx; + +PxTolerancesScale_isValid :: (self: *PxTolerancesScale) -> bool #foreign libphysx; + +PxStringTable_allocateStr :: (self: *PxStringTable, inSrc: *u8) -> *u8 #foreign libphysx "PxStringTable_allocateStr_mut"; + +PxStringTable_release :: (self: *PxStringTable) -> void #foreign libphysx "PxStringTable_release_mut"; + +PxSerializer_getConcreteTypeName :: (self: *PxSerializer) -> *u8 #foreign libphysx; + +PxSerializer_requiresObjects :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxProcessPxBaseCallback) -> void #foreign libphysx; + +PxSerializer_isSubordinate :: (self: *PxSerializer) -> bool #foreign libphysx; + +PxSerializer_exportExtraData :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxSerializationContext) -> void #foreign libphysx; + +PxSerializer_exportData :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxSerializationContext) -> void #foreign libphysx; + +PxSerializer_registerReferences :: (self: *PxSerializer, obj: *PxBase, s: *PxSerializationContext) -> void #foreign libphysx; + +PxSerializer_getClassSize :: (self: *PxSerializer) -> u64 #foreign libphysx; + +PxSerializer_createObject :: (self: *PxSerializer, address: **u8, context_pod: *PxDeserializationContext) -> *PxBase #foreign libphysx; + +PxSerializer_delete :: (self: *PxSerializer) -> void #foreign libphysx; + +PxInsertionCallback_buildObjectFromData :: (self: *PxInsertionCallback, type: s32, data: *void) -> *PxBase #foreign libphysx "PxInsertionCallback_buildObjectFromData_mut"; + +PxTaskManager_setCpuDispatcher :: (self: *PxTaskManager, ref: *PxCpuDispatcher) -> void #foreign libphysx "PxTaskManager_setCpuDispatcher_mut"; + +PxTaskManager_getCpuDispatcher :: (self: *PxTaskManager) -> *PxCpuDispatcher #foreign libphysx; + +PxTaskManager_resetDependencies :: (self: *PxTaskManager) -> void #foreign libphysx "PxTaskManager_resetDependencies_mut"; + +PxTaskManager_startSimulation :: (self: *PxTaskManager) -> void #foreign libphysx "PxTaskManager_startSimulation_mut"; + +PxTaskManager_stopSimulation :: (self: *PxTaskManager) -> void #foreign libphysx "PxTaskManager_stopSimulation_mut"; + +PxTaskManager_taskCompleted :: (self: *PxTaskManager, task: *PxTask) -> void #foreign libphysx "PxTaskManager_taskCompleted_mut"; + +PxTaskManager_getNamedTask :: (self: *PxTaskManager, name: *u8) -> u32 #foreign libphysx "PxTaskManager_getNamedTask_mut"; + +PxTaskManager_submitNamedTask :: (self: *PxTaskManager, task: *PxTask, name: *u8, type: s32) -> u32 #foreign libphysx "PxTaskManager_submitNamedTask_mut"; + +PxTaskManager_submitUnnamedTask :: (self: *PxTaskManager, task: *PxTask, type: s32) -> u32 #foreign libphysx "PxTaskManager_submitUnnamedTask_mut"; + +PxTaskManager_getTaskFromID :: (self: *PxTaskManager, id: u32) -> *PxTask #foreign libphysx "PxTaskManager_getTaskFromID_mut"; + +PxTaskManager_release :: (self: *PxTaskManager) -> void #foreign libphysx "PxTaskManager_release_mut"; + +PxTaskManager_createTaskManager :: (errorCallback: *PxErrorCallback, anon_param1: *PxCpuDispatcher) -> *PxTaskManager #foreign libphysx; + +PxCpuDispatcher_submitTask :: (self: *PxCpuDispatcher, task: *PxBaseTask) -> void #foreign libphysx "PxCpuDispatcher_submitTask_mut"; + +PxCpuDispatcher_getWorkerCount :: (self: *PxCpuDispatcher) -> u32 #foreign libphysx; + +PxCpuDispatcher_delete :: (self: *PxCpuDispatcher) -> void #foreign libphysx; + +PxBaseTask_run :: (self: *PxBaseTask) -> void #foreign libphysx "PxBaseTask_run_mut"; + +PxBaseTask_getName :: (self: *PxBaseTask) -> *u8 #foreign libphysx; + +PxBaseTask_addReference :: (self: *PxBaseTask) -> void #foreign libphysx "PxBaseTask_addReference_mut"; + +PxBaseTask_removeReference :: (self: *PxBaseTask) -> void #foreign libphysx "PxBaseTask_removeReference_mut"; + +PxBaseTask_getReference :: (self: *PxBaseTask) -> s32 #foreign libphysx; + +PxBaseTask_release :: (self: *PxBaseTask) -> void #foreign libphysx "PxBaseTask_release_mut"; + +PxBaseTask_getTaskManager :: (self: *PxBaseTask) -> *PxTaskManager #foreign libphysx; + +PxBaseTask_setContextId :: (self: *PxBaseTask, id: u64) -> void #foreign libphysx "PxBaseTask_setContextId_mut"; + +PxBaseTask_getContextId :: (self: *PxBaseTask) -> u64 #foreign libphysx; + +PxTask_release :: (self: *PxTask) -> void #foreign libphysx "PxTask_release_mut"; + +PxTask_finishBefore :: (self: *PxTask, taskID: u32) -> void #foreign libphysx "PxTask_finishBefore_mut"; + +PxTask_startAfter :: (self: *PxTask, taskID: u32) -> void #foreign libphysx "PxTask_startAfter_mut"; + +PxTask_addReference :: (self: *PxTask) -> void #foreign libphysx "PxTask_addReference_mut"; + +PxTask_removeReference :: (self: *PxTask) -> void #foreign libphysx "PxTask_removeReference_mut"; + +PxTask_getReference :: (self: *PxTask) -> s32 #foreign libphysx; + +PxTask_getTaskID :: (self: *PxTask) -> u32 #foreign libphysx; + +PxTask_submitted :: (self: *PxTask) -> void #foreign libphysx "PxTask_submitted_mut"; + +PxLightCpuTask_setContinuation :: (self: *PxLightCpuTask, tm: *PxTaskManager, c: *PxBaseTask) -> void #foreign libphysx "PxLightCpuTask_setContinuation_mut"; + +PxLightCpuTask_setContinuation_mut :: (self: *PxLightCpuTask, c: *PxBaseTask) -> void #foreign libphysx "PxLightCpuTask_setContinuation_mut_1"; + +PxLightCpuTask_getContinuation :: (self: *PxLightCpuTask) -> *PxBaseTask #foreign libphysx; + +PxLightCpuTask_removeReference :: (self: *PxLightCpuTask) -> void #foreign libphysx "PxLightCpuTask_removeReference_mut"; + +PxLightCpuTask_getReference :: (self: *PxLightCpuTask) -> s32 #foreign libphysx; + +PxLightCpuTask_addReference :: (self: *PxLightCpuTask) -> void #foreign libphysx "PxLightCpuTask_addReference_mut"; + +PxLightCpuTask_release :: (self: *PxLightCpuTask) -> void #foreign libphysx "PxLightCpuTask_release_mut"; + +PxGeometry_getType :: (self: *PxGeometry) -> s32 #foreign libphysx; + +PxBoxGeometry_new :: (hx: float, hy: float, hz: float) -> PxBoxGeometry #foreign libphysx; + +PxBoxGeometry_new :: (halfExtents: Vector3) -> PxBoxGeometry #foreign libphysx "PxBoxGeometry_new_1"; + +PxBoxGeometry_isValid :: (self: *PxBoxGeometry) -> bool #foreign libphysx; + +PxBVHRaycastCallback_delete :: (self: *PxBVHRaycastCallback) -> void #foreign libphysx; + +PxBVHRaycastCallback_reportHit :: (self: *PxBVHRaycastCallback, boundsIndex: u32, distance: *float) -> bool #foreign libphysx "PxBVHRaycastCallback_reportHit_mut"; + +PxBVHOverlapCallback_delete :: (self: *PxBVHOverlapCallback) -> void #foreign libphysx; + +PxBVHOverlapCallback_reportHit :: (self: *PxBVHOverlapCallback, boundsIndex: u32) -> bool #foreign libphysx "PxBVHOverlapCallback_reportHit_mut"; + +PxBVHTraversalCallback_delete :: (self: *PxBVHTraversalCallback) -> void #foreign libphysx; + +PxBVHTraversalCallback_visitNode :: (self: *PxBVHTraversalCallback, bounds: *PxBounds3) -> bool #foreign libphysx "PxBVHTraversalCallback_visitNode_mut"; + +PxBVHTraversalCallback_reportLeaf :: (self: *PxBVHTraversalCallback, nbPrims: u32, prims: *u32) -> bool #foreign libphysx "PxBVHTraversalCallback_reportLeaf_mut"; + +PxBVH_raycast :: (self: *PxBVH, origin: *Vector3, unitDir: *Vector3, maxDist: float, cb: *PxBVHRaycastCallback, queryFlags: u32) -> bool #foreign libphysx; + +PxBVH_sweep :: (self: *PxBVH, geom: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, maxDist: float, cb: *PxBVHRaycastCallback, queryFlags: u32) -> bool #foreign libphysx; + +PxBVH_overlap :: (self: *PxBVH, geom: *PxGeometry, pose: *PxTransform, cb: *PxBVHOverlapCallback, queryFlags: u32) -> bool #foreign libphysx; + +PxBVH_cull :: (self: *PxBVH, nbPlanes: u32, planes: *Plane3, cb: *PxBVHOverlapCallback, queryFlags: u32) -> bool #foreign libphysx; + +PxBVH_getNbBounds :: (self: *PxBVH) -> u32 #foreign libphysx; + +PxBVH_getBounds :: (self: *PxBVH) -> *PxBounds3 #foreign libphysx; + +PxBVH_getBoundsForModification :: (self: *PxBVH) -> *PxBounds3 #foreign libphysx "PxBVH_getBoundsForModification_mut"; + +PxBVH_refit :: (self: *PxBVH) -> void #foreign libphysx "PxBVH_refit_mut"; + +PxBVH_updateBounds :: (self: *PxBVH, boundsIndex: u32, newBounds: *PxBounds3) -> bool #foreign libphysx "PxBVH_updateBounds_mut"; + +PxBVH_partialRefit :: (self: *PxBVH) -> void #foreign libphysx "PxBVH_partialRefit_mut"; + +PxBVH_traverse :: (self: *PxBVH, cb: *PxBVHTraversalCallback) -> bool #foreign libphysx; + +PxBVH_getConcreteTypeName :: (self: *PxBVH) -> *u8 #foreign libphysx; + +PxCapsuleGeometry_new :: (radius_: float, halfHeight_: float) -> PxCapsuleGeometry #foreign libphysx; + +PxCapsuleGeometry_isValid :: (self: *PxCapsuleGeometry) -> bool #foreign libphysx; + +PxConvexMesh_getNbVertices :: (self: *PxConvexMesh) -> u32 #foreign libphysx; + +PxConvexMesh_getVertices :: (self: *PxConvexMesh) -> *Vector3 #foreign libphysx; + +PxConvexMesh_getIndexBuffer :: (self: *PxConvexMesh) -> *u8 #foreign libphysx; + +PxConvexMesh_getNbPolygons :: (self: *PxConvexMesh) -> u32 #foreign libphysx; + +PxConvexMesh_getPolygonData :: (self: *PxConvexMesh, index: u32, data: *PxHullPolygon) -> bool #foreign libphysx; + +PxConvexMesh_release :: (self: *PxConvexMesh) -> void #foreign libphysx "PxConvexMesh_release_mut"; + +PxConvexMesh_getMassInformation :: (self: *PxConvexMesh, mass: *float, localInertia: *PxMat33, localCenterOfMass: *Vector3) -> void #foreign libphysx; + +PxConvexMesh_getLocalBounds :: (self: *PxConvexMesh) -> PxBounds3 #foreign libphysx; + +PxConvexMesh_getSDF :: (self: *PxConvexMesh) -> *float #foreign libphysx; + +PxConvexMesh_getConcreteTypeName :: (self: *PxConvexMesh) -> *u8 #foreign libphysx; + +PxConvexMesh_isGpuCompatible :: (self: *PxConvexMesh) -> bool #foreign libphysx; + +PxMeshScale_new :: () -> PxMeshScale #foreign libphysx; + +PxMeshScale_new :: (r: float) -> PxMeshScale #foreign libphysx "PxMeshScale_new_1"; + +PxMeshScale_new :: (s: *Vector3) -> PxMeshScale #foreign libphysx "PxMeshScale_new_2"; + +PxMeshScale_new :: (s: *Vector3, r: *Quaternion) -> PxMeshScale #foreign libphysx "PxMeshScale_new_3"; + +PxMeshScale_isIdentity :: (self: *PxMeshScale) -> bool #foreign libphysx; + +PxMeshScale_getInverse :: (self: *PxMeshScale) -> PxMeshScale #foreign libphysx; + +PxMeshScale_toMat33 :: (self: *PxMeshScale) -> PxMat33 #foreign libphysx; + +PxMeshScale_hasNegativeDeterminant :: (self: *PxMeshScale) -> bool #foreign libphysx; + +PxMeshScale_transform :: (self: *PxMeshScale, v: *Vector3) -> Vector3 #foreign libphysx; + +PxMeshScale_isValidForTriangleMesh :: (self: *PxMeshScale) -> bool #foreign libphysx; + +PxMeshScale_isValidForConvexMesh :: (self: *PxMeshScale) -> bool #foreign libphysx; + +PxConvexMeshGeometry_new :: (mesh: *PxConvexMesh, scaling: *PxMeshScale, flags: u8) -> PxConvexMeshGeometry #foreign libphysx; + +PxConvexMeshGeometry_isValid :: (self: *PxConvexMeshGeometry) -> bool #foreign libphysx; + +PxSphereGeometry_new :: (ir: float) -> PxSphereGeometry #foreign libphysx; + +PxSphereGeometry_isValid :: (self: *PxSphereGeometry) -> bool #foreign libphysx; + +PxPlaneGeometry_new :: () -> PxPlaneGeometry #foreign libphysx; + +PxPlaneGeometry_isValid :: (self: *PxPlaneGeometry) -> bool #foreign libphysx; + +PxTriangleMeshGeometry_new :: (mesh: *PxTriangleMesh, scaling: *PxMeshScale, flags: u8) -> PxTriangleMeshGeometry #foreign libphysx; + +PxTriangleMeshGeometry_isValid :: (self: *PxTriangleMeshGeometry) -> bool #foreign libphysx; + +PxHeightFieldGeometry_new :: (hf: *PxHeightField, flags: u8, heightScale_: float, rowScale_: float, columnScale_: float) -> PxHeightFieldGeometry #foreign libphysx; + +PxHeightFieldGeometry_isValid :: (self: *PxHeightFieldGeometry) -> bool #foreign libphysx; + +PxParticleSystemGeometry_new :: () -> PxParticleSystemGeometry #foreign libphysx; + +PxParticleSystemGeometry_isValid :: (self: *PxParticleSystemGeometry) -> bool #foreign libphysx; + +PxHairSystemGeometry_new :: () -> PxHairSystemGeometry #foreign libphysx; + +PxHairSystemGeometry_isValid :: (self: *PxHairSystemGeometry) -> bool #foreign libphysx; + +PxTetrahedronMeshGeometry_new :: (mesh: *PxTetrahedronMesh) -> PxTetrahedronMeshGeometry #foreign libphysx; + +PxTetrahedronMeshGeometry_isValid :: (self: *PxTetrahedronMeshGeometry) -> bool #foreign libphysx; + +PxQueryHit_new :: () -> PxQueryHit #foreign libphysx; + +PxLocationHit_new :: () -> PxLocationHit #foreign libphysx; + +PxLocationHit_hadInitialOverlap :: (self: *PxLocationHit) -> bool #foreign libphysx; + +PxGeomRaycastHit_new :: () -> PxGeomRaycastHit #foreign libphysx; + +PxGeomOverlapHit_new :: () -> PxGeomOverlapHit #foreign libphysx; + +PxGeomSweepHit_new :: () -> PxGeomSweepHit #foreign libphysx; + +PxGeomIndexPair_new :: () -> PxGeomIndexPair #foreign libphysx; + +PxGeomIndexPair_new :: (_id0: u32, _id1: u32) -> PxGeomIndexPair #foreign libphysx "PxGeomIndexPair_new_1"; + +PxCustomGeometry_getUniqueID :: () -> u32 #foreign libphysx "phys_PxCustomGeometry_getUniqueID"; + +PxCustomGeometryType_new :: () -> PxCustomGeometryType #foreign libphysx; + +PxCustomGeometryType_INVALID :: () -> PxCustomGeometryType #foreign libphysx; + +PxCustomGeometryCallbacks_getCustomType :: (self: *PxCustomGeometryCallbacks) -> PxCustomGeometryType #foreign libphysx; + +PxCustomGeometryCallbacks_getLocalBounds :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry) -> PxBounds3 #foreign libphysx; + +PxCustomGeometryCallbacks_raycast :: (self: *PxCustomGeometryCallbacks, origin: *Vector3, unitDir: *Vector3, geom: *PxGeometry, pose: *PxTransform, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxGeomRaycastHit, stride: u32, threadContext: *PxQueryThreadContext) -> u32 #foreign libphysx; + +PxCustomGeometryCallbacks_overlap :: (self: *PxCustomGeometryCallbacks, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, threadContext: *PxQueryThreadContext) -> bool #foreign libphysx; + +PxCustomGeometryCallbacks_sweep :: (self: *PxCustomGeometryCallbacks, unitDir: *Vector3, maxDist: float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, sweepHit: *PxGeomSweepHit, hitFlags: u16, inflation: float, threadContext: *PxQueryThreadContext) -> bool #foreign libphysx; + +PxCustomGeometryCallbacks_computeMassProperties :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry, massProperties: *PxMassProperties) -> void #foreign libphysx; + +PxCustomGeometryCallbacks_usePersistentContactManifold :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry, breakingThreshold: *float) -> bool #foreign libphysx; + +PxCustomGeometryCallbacks_delete :: (self: *PxCustomGeometryCallbacks) -> void #foreign libphysx; + +PxCustomGeometry_new :: () -> PxCustomGeometry #foreign libphysx; + +PxCustomGeometry_new :: (_callbacks: *PxCustomGeometryCallbacks) -> PxCustomGeometry #foreign libphysx "PxCustomGeometry_new_1"; + +PxCustomGeometry_isValid :: (self: *PxCustomGeometry) -> bool #foreign libphysx; + +PxCustomGeometry_getCustomType :: (self: *PxCustomGeometry) -> PxCustomGeometryType #foreign libphysx; + +PxGeometryHolder_getType :: (self: *PxGeometryHolder) -> s32 #foreign libphysx; + +PxGeometryHolder_any :: (self: *PxGeometryHolder) -> *PxGeometry #foreign libphysx "PxGeometryHolder_any_mut"; + +PxGeometryHolder_sphere :: (self: *PxGeometryHolder) -> *PxSphereGeometry #foreign libphysx "PxGeometryHolder_sphere_mut"; + +PxGeometryHolder_plane :: (self: *PxGeometryHolder) -> *PxPlaneGeometry #foreign libphysx "PxGeometryHolder_plane_mut"; + +PxGeometryHolder_capsule :: (self: *PxGeometryHolder) -> *PxCapsuleGeometry #foreign libphysx "PxGeometryHolder_capsule_mut"; + +PxGeometryHolder_box :: (self: *PxGeometryHolder) -> *PxBoxGeometry #foreign libphysx "PxGeometryHolder_box_mut"; + +PxGeometryHolder_convexMesh :: (self: *PxGeometryHolder) -> *PxConvexMeshGeometry #foreign libphysx "PxGeometryHolder_convexMesh_mut"; + +PxGeometryHolder_tetMesh :: (self: *PxGeometryHolder) -> *PxTetrahedronMeshGeometry #foreign libphysx "PxGeometryHolder_tetMesh_mut"; + +PxGeometryHolder_triangleMesh :: (self: *PxGeometryHolder) -> *PxTriangleMeshGeometry #foreign libphysx "PxGeometryHolder_triangleMesh_mut"; + +PxGeometryHolder_heightField :: (self: *PxGeometryHolder) -> *PxHeightFieldGeometry #foreign libphysx "PxGeometryHolder_heightField_mut"; + +PxGeometryHolder_particleSystem :: (self: *PxGeometryHolder) -> *PxParticleSystemGeometry #foreign libphysx "PxGeometryHolder_particleSystem_mut"; + +PxGeometryHolder_hairSystem :: (self: *PxGeometryHolder) -> *PxHairSystemGeometry #foreign libphysx "PxGeometryHolder_hairSystem_mut"; + +PxGeometryHolder_custom :: (self: *PxGeometryHolder) -> *PxCustomGeometry #foreign libphysx "PxGeometryHolder_custom_mut"; + +PxGeometryHolder_storeAny :: (self: *PxGeometryHolder, geometry: *PxGeometry) -> void #foreign libphysx "PxGeometryHolder_storeAny_mut"; + +PxGeometryHolder_new :: () -> PxGeometryHolder #foreign libphysx; + +PxGeometryHolder_new :: (geometry: *PxGeometry) -> PxGeometryHolder #foreign libphysx "PxGeometryHolder_new_1"; + +PxGeometryQuery_raycast :: (origin: *Vector3, unitDir: *Vector3, geom: *PxGeometry, pose: *PxTransform, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxGeomRaycastHit, stride: u32, queryFlags: u32, threadContext: *PxQueryThreadContext) -> u32 #foreign libphysx; + +PxGeometryQuery_overlap :: (geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, queryFlags: u32, threadContext: *PxQueryThreadContext) -> bool #foreign libphysx; + +PxGeometryQuery_sweep :: (unitDir: *Vector3, maxDist: float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, sweepHit: *PxGeomSweepHit, hitFlags: u16, inflation: float, queryFlags: u32, threadContext: *PxQueryThreadContext) -> bool #foreign libphysx; + +PxGeometryQuery_computePenetration :: (direction: *Vector3, depth: *float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, queryFlags: u32) -> bool #foreign libphysx; + +PxGeometryQuery_pointDistance :: (point: *Vector3, geom: *PxGeometry, pose: *PxTransform, closestPoint: *Vector3, closestIndex: *u32, queryFlags: u32) -> float #foreign libphysx; + +PxGeometryQuery_computeGeomBounds :: (bounds: *PxBounds3, geom: *PxGeometry, pose: *PxTransform, offset: float, inflation: float, queryFlags: u32) -> void #foreign libphysx; + +PxGeometryQuery_isValid :: (geom: *PxGeometry) -> bool #foreign libphysx; + +PxHeightFieldSample_tessFlag :: (self: *PxHeightFieldSample) -> u8 #foreign libphysx; + +PxHeightFieldSample_setTessFlag :: (self: *PxHeightFieldSample) -> void #foreign libphysx "PxHeightFieldSample_setTessFlag_mut"; + +PxHeightFieldSample_clearTessFlag :: (self: *PxHeightFieldSample) -> void #foreign libphysx "PxHeightFieldSample_clearTessFlag_mut"; + +PxHeightField_release :: (self: *PxHeightField) -> void #foreign libphysx "PxHeightField_release_mut"; + +PxHeightField_saveCells :: (self: *PxHeightField, destBuffer: *void, destBufferSize: u32) -> u32 #foreign libphysx; + +PxHeightField_modifySamples :: (self: *PxHeightField, startCol: s32, startRow: s32, subfieldDesc: *PxHeightFieldDesc, shrinkBounds: bool) -> bool #foreign libphysx "PxHeightField_modifySamples_mut"; + +PxHeightField_getNbRows :: (self: *PxHeightField) -> u32 #foreign libphysx; + +PxHeightField_getNbColumns :: (self: *PxHeightField) -> u32 #foreign libphysx; + +PxHeightField_getFormat :: (self: *PxHeightField) -> s32 #foreign libphysx; + +PxHeightField_getSampleStride :: (self: *PxHeightField) -> u32 #foreign libphysx; + +PxHeightField_getConvexEdgeThreshold :: (self: *PxHeightField) -> float #foreign libphysx; + +PxHeightField_getFlags :: (self: *PxHeightField) -> u16 #foreign libphysx; + +PxHeightField_getHeight :: (self: *PxHeightField, x: float, z: float) -> float #foreign libphysx; + +PxHeightField_getTriangleMaterialIndex :: (self: *PxHeightField, triangleIndex: u32) -> u16 #foreign libphysx; + +PxHeightField_getTriangleNormal :: (self: *PxHeightField, triangleIndex: u32) -> Vector3 #foreign libphysx; + +PxHeightField_getSample :: (self: *PxHeightField, row: u32, column: u32) -> *PxHeightFieldSample #foreign libphysx; + +PxHeightField_getTimestamp :: (self: *PxHeightField) -> u32 #foreign libphysx; + +PxHeightField_getConcreteTypeName :: (self: *PxHeightField) -> *u8 #foreign libphysx; + +PxHeightFieldDesc_new :: () -> PxHeightFieldDesc #foreign libphysx; + +PxHeightFieldDesc_setToDefault :: (self: *PxHeightFieldDesc) -> void #foreign libphysx "PxHeightFieldDesc_setToDefault_mut"; + +PxHeightFieldDesc_isValid :: (self: *PxHeightFieldDesc) -> bool #foreign libphysx; + +PxMeshQuery_getTriangle :: (triGeom: *PxTriangleMeshGeometry, transform: *PxTransform, triangleIndex: u32, triangle: *PxTriangle, vertexIndices: *u32, adjacencyIndices: *u32) -> void #foreign libphysx; + +PxMeshQuery_getTriangle :: (hfGeom: *PxHeightFieldGeometry, transform: *PxTransform, triangleIndex: u32, triangle: *PxTriangle, vertexIndices: *u32, adjacencyIndices: *u32) -> void #foreign libphysx "PxMeshQuery_getTriangle_1"; + +PxMeshQuery_findOverlapTriangleMesh :: (geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform, results: *u32, maxResults: u32, startIndex: u32, overflow: *bool, queryFlags: u32) -> u32 #foreign libphysx; + +PxMeshQuery_findOverlapHeightField :: (geom: *PxGeometry, geomPose: *PxTransform, hfGeom: *PxHeightFieldGeometry, hfPose: *PxTransform, results: *u32, maxResults: u32, startIndex: u32, overflow: *bool, queryFlags: u32) -> u32 #foreign libphysx; + +PxMeshQuery_sweep :: (unitDir: *Vector3, distance: float, geom: *PxGeometry, pose: *PxTransform, triangleCount: u32, triangles: *PxTriangle, sweepHit: *PxGeomSweepHit, hitFlags: u16, cachedIndex: *u32, inflation: float, doubleSided: bool, queryFlags: u32) -> bool #foreign libphysx; + +PxSimpleTriangleMesh_new :: () -> PxSimpleTriangleMesh #foreign libphysx; + +PxSimpleTriangleMesh_setToDefault :: (self: *PxSimpleTriangleMesh) -> void #foreign libphysx "PxSimpleTriangleMesh_setToDefault_mut"; + +PxSimpleTriangleMesh_isValid :: (self: *PxSimpleTriangleMesh) -> bool #foreign libphysx; + +PxTriangle_new_alloc :: () -> *PxTriangle #foreign libphysx; + +PxTriangle_new_alloc :: (p0: *Vector3, p1: *Vector3, p2: *Vector3) -> *PxTriangle #foreign libphysx "PxTriangle_new_alloc_1"; + +PxTriangle_delete :: (self: *PxTriangle) -> void #foreign libphysx; + +PxTriangle_normal :: (self: *PxTriangle, _normal: *Vector3) -> void #foreign libphysx; + +PxTriangle_denormalizedNormal :: (self: *PxTriangle, _normal: *Vector3) -> void #foreign libphysx; + +PxTriangle_area :: (self: *PxTriangle) -> float #foreign libphysx; + +PxTriangle_pointFromUV :: (self: *PxTriangle, u: float, v: float) -> Vector3 #foreign libphysx; + +PxTrianglePadded_new_alloc :: () -> *PxTrianglePadded #foreign libphysx; + +PxTrianglePadded_delete :: (self: *PxTrianglePadded) -> void #foreign libphysx; + +PxTriangleMesh_getNbVertices :: (self: *PxTriangleMesh) -> u32 #foreign libphysx; + +PxTriangleMesh_getVertices :: (self: *PxTriangleMesh) -> *Vector3 #foreign libphysx; + +PxTriangleMesh_getVerticesForModification :: (self: *PxTriangleMesh) -> *Vector3 #foreign libphysx "PxTriangleMesh_getVerticesForModification_mut"; + +PxTriangleMesh_refitBVH :: (self: *PxTriangleMesh) -> PxBounds3 #foreign libphysx "PxTriangleMesh_refitBVH_mut"; + +PxTriangleMesh_getNbTriangles :: (self: *PxTriangleMesh) -> u32 #foreign libphysx; + +PxTriangleMesh_getTriangles :: (self: *PxTriangleMesh) -> *void #foreign libphysx; + +PxTriangleMesh_getTriangleMeshFlags :: (self: *PxTriangleMesh) -> u8 #foreign libphysx; + +PxTriangleMesh_getTrianglesRemap :: (self: *PxTriangleMesh) -> *u32 #foreign libphysx; + +PxTriangleMesh_release :: (self: *PxTriangleMesh) -> void #foreign libphysx "PxTriangleMesh_release_mut"; + +PxTriangleMesh_getTriangleMaterialIndex :: (self: *PxTriangleMesh, triangleIndex: u32) -> u16 #foreign libphysx; + +PxTriangleMesh_getLocalBounds :: (self: *PxTriangleMesh) -> PxBounds3 #foreign libphysx; + +PxTriangleMesh_getSDF :: (self: *PxTriangleMesh) -> *float #foreign libphysx; + +PxTriangleMesh_getSDFDimensions :: (self: *PxTriangleMesh, numX: *u32, numY: *u32, numZ: *u32) -> void #foreign libphysx; + +PxTriangleMesh_setPreferSDFProjection :: (self: *PxTriangleMesh, preferProjection: bool) -> void #foreign libphysx "PxTriangleMesh_setPreferSDFProjection_mut"; + +PxTriangleMesh_getPreferSDFProjection :: (self: *PxTriangleMesh) -> bool #foreign libphysx; + +PxTriangleMesh_getMassInformation :: (self: *PxTriangleMesh, mass: *float, localInertia: *PxMat33, localCenterOfMass: *Vector3) -> void #foreign libphysx; + +PxTetrahedron_new_alloc :: () -> *PxTetrahedron #foreign libphysx; + +PxTetrahedron_new_alloc :: (p0: *Vector3, p1: *Vector3, p2: *Vector3, p3: *Vector3) -> *PxTetrahedron #foreign libphysx "PxTetrahedron_new_alloc_1"; + +PxTetrahedron_delete :: (self: *PxTetrahedron) -> void #foreign libphysx; + +PxSoftBodyAuxData_release :: (self: *PxSoftBodyAuxData) -> void #foreign libphysx "PxSoftBodyAuxData_release_mut"; + +PxTetrahedronMesh_getNbVertices :: (self: *PxTetrahedronMesh) -> u32 #foreign libphysx; + +PxTetrahedronMesh_getVertices :: (self: *PxTetrahedronMesh) -> *Vector3 #foreign libphysx; + +PxTetrahedronMesh_getNbTetrahedrons :: (self: *PxTetrahedronMesh) -> u32 #foreign libphysx; + +PxTetrahedronMesh_getTetrahedrons :: (self: *PxTetrahedronMesh) -> *void #foreign libphysx; + +PxTetrahedronMesh_getTetrahedronMeshFlags :: (self: *PxTetrahedronMesh) -> u8 #foreign libphysx; + +PxTetrahedronMesh_getTetrahedraRemap :: (self: *PxTetrahedronMesh) -> *u32 #foreign libphysx; + +PxTetrahedronMesh_getLocalBounds :: (self: *PxTetrahedronMesh) -> PxBounds3 #foreign libphysx; + +PxTetrahedronMesh_release :: (self: *PxTetrahedronMesh) -> void #foreign libphysx "PxTetrahedronMesh_release_mut"; + +PxSoftBodyMesh_getCollisionMesh :: (self: *PxSoftBodyMesh) -> *PxTetrahedronMesh #foreign libphysx "PxSoftBodyMesh_getCollisionMesh_mut"; + +PxSoftBodyMesh_getSimulationMesh :: (self: *PxSoftBodyMesh) -> *PxTetrahedronMesh #foreign libphysx "PxSoftBodyMesh_getSimulationMesh_mut"; + +PxSoftBodyMesh_getSoftBodyAuxData :: (self: *PxSoftBodyMesh) -> *PxSoftBodyAuxData #foreign libphysx "PxSoftBodyMesh_getSoftBodyAuxData_mut"; + +PxSoftBodyMesh_release :: (self: *PxSoftBodyMesh) -> void #foreign libphysx "PxSoftBodyMesh_release_mut"; + +PxCollisionMeshMappingData_release :: (self: *PxCollisionMeshMappingData) -> void #foreign libphysx "PxCollisionMeshMappingData_release_mut"; + +PxCollisionTetrahedronMeshData_getMesh :: (self: *PxCollisionTetrahedronMeshData) -> *PxTetrahedronMeshData #foreign libphysx "PxCollisionTetrahedronMeshData_getMesh_mut"; + +PxCollisionTetrahedronMeshData_getData :: (self: *PxCollisionTetrahedronMeshData) -> *PxSoftBodyCollisionData #foreign libphysx "PxCollisionTetrahedronMeshData_getData_mut"; + +PxCollisionTetrahedronMeshData_release :: (self: *PxCollisionTetrahedronMeshData) -> void #foreign libphysx "PxCollisionTetrahedronMeshData_release_mut"; + +PxSimulationTetrahedronMeshData_getMesh :: (self: *PxSimulationTetrahedronMeshData) -> *PxTetrahedronMeshData #foreign libphysx "PxSimulationTetrahedronMeshData_getMesh_mut"; + +PxSimulationTetrahedronMeshData_getData :: (self: *PxSimulationTetrahedronMeshData) -> *PxSoftBodySimulationData #foreign libphysx "PxSimulationTetrahedronMeshData_getData_mut"; + +PxSimulationTetrahedronMeshData_release :: (self: *PxSimulationTetrahedronMeshData) -> void #foreign libphysx "PxSimulationTetrahedronMeshData_release_mut"; + +PxActor_release :: (self: *PxActor) -> void #foreign libphysx "PxActor_release_mut"; + +PxActor_getType :: (self: *PxActor) -> s32 #foreign libphysx; + +PxActor_getScene :: (self: *PxActor) -> *PxScene #foreign libphysx; + +PxActor_setName :: (self: *PxActor, name: *u8) -> void #foreign libphysx "PxActor_setName_mut"; + +PxActor_getName :: (self: *PxActor) -> *u8 #foreign libphysx; + +PxActor_getWorldBounds :: (self: *PxActor, inflation: float) -> PxBounds3 #foreign libphysx; + +PxActor_setActorFlag :: (self: *PxActor, flag: s32, value: bool) -> void #foreign libphysx "PxActor_setActorFlag_mut"; + +PxActor_setActorFlags :: (self: *PxActor, inFlags: u8) -> void #foreign libphysx "PxActor_setActorFlags_mut"; + +PxActor_getActorFlags :: (self: *PxActor) -> u8 #foreign libphysx; + +PxActor_setDominanceGroup :: (self: *PxActor, dominanceGroup: u8) -> void #foreign libphysx "PxActor_setDominanceGroup_mut"; + +PxActor_getDominanceGroup :: (self: *PxActor) -> u8 #foreign libphysx; + +PxActor_setOwnerClient :: (self: *PxActor, inClient: u8) -> void #foreign libphysx "PxActor_setOwnerClient_mut"; + +PxActor_getOwnerClient :: (self: *PxActor) -> u8 #foreign libphysx; + +PxActor_getAggregate :: (self: *PxActor) -> *PxAggregate #foreign libphysx; + +PxGetAggregateFilterHint :: (type: s32, enableSelfCollision: bool) -> u32 #foreign libphysx "phys_PxGetAggregateFilterHint"; + +PxGetAggregateSelfCollisionBit :: (hint: u32) -> u32 #foreign libphysx "phys_PxGetAggregateSelfCollisionBit"; + +PxGetAggregateType :: (hint: u32) -> s32 #foreign libphysx "phys_PxGetAggregateType"; + +PxAggregate_release :: (self: *PxAggregate) -> void #foreign libphysx "PxAggregate_release_mut"; + +PxAggregate_addActor :: (self: *PxAggregate, actor: *PxActor, bvh: *PxBVH) -> bool #foreign libphysx "PxAggregate_addActor_mut"; + +PxAggregate_removeActor :: (self: *PxAggregate, actor: *PxActor) -> bool #foreign libphysx "PxAggregate_removeActor_mut"; + +PxAggregate_addArticulation :: (self: *PxAggregate, articulation: *PxArticulationReducedCoordinate) -> bool #foreign libphysx "PxAggregate_addArticulation_mut"; + +PxAggregate_removeArticulation :: (self: *PxAggregate, articulation: *PxArticulationReducedCoordinate) -> bool #foreign libphysx "PxAggregate_removeArticulation_mut"; + +PxAggregate_getNbActors :: (self: *PxAggregate) -> u32 #foreign libphysx; + +PxAggregate_getMaxNbShapes :: (self: *PxAggregate) -> u32 #foreign libphysx; + +PxAggregate_getActors :: (self: *PxAggregate, userBuffer: **PxActor, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxAggregate_getScene :: (self: *PxAggregate) -> *PxScene #foreign libphysx "PxAggregate_getScene_mut"; + +PxAggregate_getSelfCollision :: (self: *PxAggregate) -> bool #foreign libphysx; + +PxAggregate_getConcreteTypeName :: (self: *PxAggregate) -> *u8 #foreign libphysx; + +PxConstraintInvMassScale_new :: () -> PxConstraintInvMassScale #foreign libphysx; + +PxConstraintInvMassScale_new :: (lin0: float, ang0: float, lin1: float, ang1: float) -> PxConstraintInvMassScale #foreign libphysx "PxConstraintInvMassScale_new_1"; + +PxConstraintVisualizer_visualizeJointFrames :: (self: *PxConstraintVisualizer, parent: *PxTransform, child: *PxTransform) -> void #foreign libphysx "PxConstraintVisualizer_visualizeJointFrames_mut"; + +PxConstraintVisualizer_visualizeLinearLimit :: (self: *PxConstraintVisualizer, t0: *PxTransform, t1: *PxTransform, value: float, active: bool) -> void #foreign libphysx "PxConstraintVisualizer_visualizeLinearLimit_mut"; + +PxConstraintVisualizer_visualizeAngularLimit :: (self: *PxConstraintVisualizer, t0: *PxTransform, lower: float, upper: float, active: bool) -> void #foreign libphysx "PxConstraintVisualizer_visualizeAngularLimit_mut"; + +PxConstraintVisualizer_visualizeLimitCone :: (self: *PxConstraintVisualizer, t: *PxTransform, tanQSwingY: float, tanQSwingZ: float, active: bool) -> void #foreign libphysx "PxConstraintVisualizer_visualizeLimitCone_mut"; + +PxConstraintVisualizer_visualizeDoubleCone :: (self: *PxConstraintVisualizer, t: *PxTransform, angle: float, active: bool) -> void #foreign libphysx "PxConstraintVisualizer_visualizeDoubleCone_mut"; + +PxConstraintVisualizer_visualizeLine :: (self: *PxConstraintVisualizer, p0: *Vector3, p1: *Vector3, color: u32) -> void #foreign libphysx "PxConstraintVisualizer_visualizeLine_mut"; + +PxConstraintConnector_prepareData :: (self: *PxConstraintConnector) -> *void #foreign libphysx "PxConstraintConnector_prepareData_mut"; + +PxConstraintConnector_onConstraintRelease :: (self: *PxConstraintConnector) -> void #foreign libphysx "PxConstraintConnector_onConstraintRelease_mut"; + +PxConstraintConnector_onComShift :: (self: *PxConstraintConnector, actor: u32) -> void #foreign libphysx "PxConstraintConnector_onComShift_mut"; + +PxConstraintConnector_onOriginShift :: (self: *PxConstraintConnector, shift: *Vector3) -> void #foreign libphysx "PxConstraintConnector_onOriginShift_mut"; + +PxConstraintConnector_getSerializable :: (self: *PxConstraintConnector) -> *PxBase #foreign libphysx "PxConstraintConnector_getSerializable_mut"; + +PxConstraintConnector_getConstantBlock :: (self: *PxConstraintConnector) -> *void #foreign libphysx; + +PxConstraintConnector_connectToConstraint :: (self: *PxConstraintConnector, anon_param0: *PxConstraint) -> void #foreign libphysx "PxConstraintConnector_connectToConstraint_mut"; + +PxConstraintConnector_delete :: (self: *PxConstraintConnector) -> void #foreign libphysx; + +PxSolverBody_new :: () -> PxSolverBody #foreign libphysx; + +PxSolverBodyData_projectVelocity :: (self: *PxSolverBodyData, lin: *Vector3, ang: *Vector3) -> float #foreign libphysx; + +PxSolverConstraintPrepDesc_delete :: (self: *PxSolverConstraintPrepDesc) -> void #foreign libphysx; + +PxConstraintAllocator_reserveConstraintData :: (self: *PxConstraintAllocator, byteSize: u32) -> *u8 #foreign libphysx "PxConstraintAllocator_reserveConstraintData_mut"; + +PxConstraintAllocator_reserveFrictionData :: (self: *PxConstraintAllocator, byteSize: u32) -> *u8 #foreign libphysx "PxConstraintAllocator_reserveFrictionData_mut"; + +PxConstraintAllocator_delete :: (self: *PxConstraintAllocator) -> void #foreign libphysx; + +PxArticulationLimit_new :: () -> PxArticulationLimit #foreign libphysx; + +PxArticulationLimit_new :: (low_: float, high_: float) -> PxArticulationLimit #foreign libphysx "PxArticulationLimit_new_1"; + +PxArticulationDrive_new :: () -> PxArticulationDrive #foreign libphysx; + +PxArticulationDrive_new :: (stiffness_: float, damping_: float, maxForce_: float, driveType: s32) -> PxArticulationDrive #foreign libphysx "PxArticulationDrive_new_1"; + +PxTGSSolverBodyVel_projectVelocity :: (self: *PxTGSSolverBodyVel, lin: *Vector3, ang: *Vector3) -> float #foreign libphysx; + +PxTGSSolverBodyData_projectVelocity :: (self: *PxTGSSolverBodyData, linear: *Vector3, angular: *Vector3) -> float #foreign libphysx; + +PxTGSSolverConstraintPrepDesc_delete :: (self: *PxTGSSolverConstraintPrepDesc) -> void #foreign libphysx; + +PxArticulationAttachment_setRestLength :: (self: *PxArticulationAttachment, restLength: float) -> void #foreign libphysx "PxArticulationAttachment_setRestLength_mut"; + +PxArticulationAttachment_getRestLength :: (self: *PxArticulationAttachment) -> float #foreign libphysx; + +PxArticulationAttachment_setLimitParameters :: (self: *PxArticulationAttachment, parameters: *PxArticulationTendonLimit) -> void #foreign libphysx "PxArticulationAttachment_setLimitParameters_mut"; + +PxArticulationAttachment_getLimitParameters :: (self: *PxArticulationAttachment) -> PxArticulationTendonLimit #foreign libphysx; + +PxArticulationAttachment_setRelativeOffset :: (self: *PxArticulationAttachment, offset: *Vector3) -> void #foreign libphysx "PxArticulationAttachment_setRelativeOffset_mut"; + +PxArticulationAttachment_getRelativeOffset :: (self: *PxArticulationAttachment) -> Vector3 #foreign libphysx; + +PxArticulationAttachment_setCoefficient :: (self: *PxArticulationAttachment, coefficient: float) -> void #foreign libphysx "PxArticulationAttachment_setCoefficient_mut"; + +PxArticulationAttachment_getCoefficient :: (self: *PxArticulationAttachment) -> float #foreign libphysx; + +PxArticulationAttachment_getLink :: (self: *PxArticulationAttachment) -> *PxArticulationLink #foreign libphysx; + +PxArticulationAttachment_getParent :: (self: *PxArticulationAttachment) -> *PxArticulationAttachment #foreign libphysx; + +PxArticulationAttachment_isLeaf :: (self: *PxArticulationAttachment) -> bool #foreign libphysx; + +PxArticulationAttachment_getTendon :: (self: *PxArticulationAttachment) -> *PxArticulationSpatialTendon #foreign libphysx; + +PxArticulationAttachment_release :: (self: *PxArticulationAttachment) -> void #foreign libphysx "PxArticulationAttachment_release_mut"; + +PxArticulationAttachment_getConcreteTypeName :: (self: *PxArticulationAttachment) -> *u8 #foreign libphysx; + +PxArticulationTendonJoint_setCoefficient :: (self: *PxArticulationTendonJoint, axis: s32, coefficient: float, recipCoefficient: float) -> void #foreign libphysx "PxArticulationTendonJoint_setCoefficient_mut"; + +PxArticulationTendonJoint_getCoefficient :: (self: *PxArticulationTendonJoint, axis: *s32, coefficient: *float, recipCoefficient: *float) -> void #foreign libphysx; + +PxArticulationTendonJoint_getLink :: (self: *PxArticulationTendonJoint) -> *PxArticulationLink #foreign libphysx; + +PxArticulationTendonJoint_getParent :: (self: *PxArticulationTendonJoint) -> *PxArticulationTendonJoint #foreign libphysx; + +PxArticulationTendonJoint_getTendon :: (self: *PxArticulationTendonJoint) -> *PxArticulationFixedTendon #foreign libphysx; + +PxArticulationTendonJoint_release :: (self: *PxArticulationTendonJoint) -> void #foreign libphysx "PxArticulationTendonJoint_release_mut"; + +PxArticulationTendonJoint_getConcreteTypeName :: (self: *PxArticulationTendonJoint) -> *u8 #foreign libphysx; + +PxArticulationTendon_setStiffness :: (self: *PxArticulationTendon, stiffness: float) -> void #foreign libphysx "PxArticulationTendon_setStiffness_mut"; + +PxArticulationTendon_getStiffness :: (self: *PxArticulationTendon) -> float #foreign libphysx; + +PxArticulationTendon_setDamping :: (self: *PxArticulationTendon, damping: float) -> void #foreign libphysx "PxArticulationTendon_setDamping_mut"; + +PxArticulationTendon_getDamping :: (self: *PxArticulationTendon) -> float #foreign libphysx; + +PxArticulationTendon_setLimitStiffness :: (self: *PxArticulationTendon, stiffness: float) -> void #foreign libphysx "PxArticulationTendon_setLimitStiffness_mut"; + +PxArticulationTendon_getLimitStiffness :: (self: *PxArticulationTendon) -> float #foreign libphysx; + +PxArticulationTendon_setOffset :: (self: *PxArticulationTendon, offset: float, autowake: bool) -> void #foreign libphysx "PxArticulationTendon_setOffset_mut"; + +PxArticulationTendon_getOffset :: (self: *PxArticulationTendon) -> float #foreign libphysx; + +PxArticulationTendon_getArticulation :: (self: *PxArticulationTendon) -> *PxArticulationReducedCoordinate #foreign libphysx; + +PxArticulationTendon_release :: (self: *PxArticulationTendon) -> void #foreign libphysx "PxArticulationTendon_release_mut"; + +PxArticulationSpatialTendon_createAttachment :: (self: *PxArticulationSpatialTendon, parent: *PxArticulationAttachment, coefficient: float, relativeOffset: Vector3, link: *PxArticulationLink) -> *PxArticulationAttachment #foreign libphysx "PxArticulationSpatialTendon_createAttachment_mut"; + +PxArticulationSpatialTendon_getAttachments :: (self: *PxArticulationSpatialTendon, userBuffer: **PxArticulationAttachment, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationSpatialTendon_getNbAttachments :: (self: *PxArticulationSpatialTendon) -> u32 #foreign libphysx; + +PxArticulationSpatialTendon_getConcreteTypeName :: (self: *PxArticulationSpatialTendon) -> *u8 #foreign libphysx; + +PxArticulationFixedTendon_createTendonJoint :: (self: *PxArticulationFixedTendon, parent: *PxArticulationTendonJoint, axis: s32, coefficient: float, recipCoefficient: float, link: *PxArticulationLink) -> *PxArticulationTendonJoint #foreign libphysx "PxArticulationFixedTendon_createTendonJoint_mut"; + +PxArticulationFixedTendon_getTendonJoints :: (self: *PxArticulationFixedTendon, userBuffer: **PxArticulationTendonJoint, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationFixedTendon_getNbTendonJoints :: (self: *PxArticulationFixedTendon) -> u32 #foreign libphysx; + +PxArticulationFixedTendon_setRestLength :: (self: *PxArticulationFixedTendon, restLength: float) -> void #foreign libphysx "PxArticulationFixedTendon_setRestLength_mut"; + +PxArticulationFixedTendon_getRestLength :: (self: *PxArticulationFixedTendon) -> float #foreign libphysx; + +PxArticulationFixedTendon_setLimitParameters :: (self: *PxArticulationFixedTendon, parameter: *PxArticulationTendonLimit) -> void #foreign libphysx "PxArticulationFixedTendon_setLimitParameters_mut"; + +PxArticulationFixedTendon_getLimitParameters :: (self: *PxArticulationFixedTendon) -> PxArticulationTendonLimit #foreign libphysx; + +PxArticulationFixedTendon_getConcreteTypeName :: (self: *PxArticulationFixedTendon) -> *u8 #foreign libphysx; + +PxArticulationCache_new :: () -> PxArticulationCache #foreign libphysx; + +PxArticulationCache_release :: (self: *PxArticulationCache) -> void #foreign libphysx "PxArticulationCache_release_mut"; + +PxArticulationSensor_release :: (self: *PxArticulationSensor) -> void #foreign libphysx "PxArticulationSensor_release_mut"; + +PxArticulationSensor_getForces :: (self: *PxArticulationSensor) -> PxSpatialForce #foreign libphysx; + +PxArticulationSensor_getRelativePose :: (self: *PxArticulationSensor) -> PxTransform #foreign libphysx; + +PxArticulationSensor_setRelativePose :: (self: *PxArticulationSensor, pose: *PxTransform) -> void #foreign libphysx "PxArticulationSensor_setRelativePose_mut"; + +PxArticulationSensor_getLink :: (self: *PxArticulationSensor) -> *PxArticulationLink #foreign libphysx; + +PxArticulationSensor_getIndex :: (self: *PxArticulationSensor) -> u32 #foreign libphysx; + +PxArticulationSensor_getArticulation :: (self: *PxArticulationSensor) -> *PxArticulationReducedCoordinate #foreign libphysx; + +PxArticulationSensor_getFlags :: (self: *PxArticulationSensor) -> u8 #foreign libphysx; + +PxArticulationSensor_setFlag :: (self: *PxArticulationSensor, flag: s32, enabled: bool) -> void #foreign libphysx "PxArticulationSensor_setFlag_mut"; + +PxArticulationSensor_getConcreteTypeName :: (self: *PxArticulationSensor) -> *u8 #foreign libphysx; + +PxArticulationReducedCoordinate_getScene :: (self: *PxArticulationReducedCoordinate) -> *PxScene #foreign libphysx; + +PxArticulationReducedCoordinate_setSolverIterationCounts :: (self: *PxArticulationReducedCoordinate, minPositionIters: u32, minVelocityIters: u32) -> void #foreign libphysx "PxArticulationReducedCoordinate_setSolverIterationCounts_mut"; + +PxArticulationReducedCoordinate_getSolverIterationCounts :: (self: *PxArticulationReducedCoordinate, minPositionIters: *u32, minVelocityIters: *u32) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_isSleeping :: (self: *PxArticulationReducedCoordinate) -> bool #foreign libphysx; + +PxArticulationReducedCoordinate_setSleepThreshold :: (self: *PxArticulationReducedCoordinate, threshold: float) -> void #foreign libphysx "PxArticulationReducedCoordinate_setSleepThreshold_mut"; + +PxArticulationReducedCoordinate_getSleepThreshold :: (self: *PxArticulationReducedCoordinate) -> float #foreign libphysx; + +PxArticulationReducedCoordinate_setStabilizationThreshold :: (self: *PxArticulationReducedCoordinate, threshold: float) -> void #foreign libphysx "PxArticulationReducedCoordinate_setStabilizationThreshold_mut"; + +PxArticulationReducedCoordinate_getStabilizationThreshold :: (self: *PxArticulationReducedCoordinate) -> float #foreign libphysx; + +PxArticulationReducedCoordinate_setWakeCounter :: (self: *PxArticulationReducedCoordinate, wakeCounterValue: float) -> void #foreign libphysx "PxArticulationReducedCoordinate_setWakeCounter_mut"; + +PxArticulationReducedCoordinate_getWakeCounter :: (self: *PxArticulationReducedCoordinate) -> float #foreign libphysx; + +PxArticulationReducedCoordinate_wakeUp :: (self: *PxArticulationReducedCoordinate) -> void #foreign libphysx "PxArticulationReducedCoordinate_wakeUp_mut"; + +PxArticulationReducedCoordinate_putToSleep :: (self: *PxArticulationReducedCoordinate) -> void #foreign libphysx "PxArticulationReducedCoordinate_putToSleep_mut"; + +PxArticulationReducedCoordinate_setMaxCOMLinearVelocity :: (self: *PxArticulationReducedCoordinate, maxLinearVelocity: float) -> void #foreign libphysx "PxArticulationReducedCoordinate_setMaxCOMLinearVelocity_mut"; + +PxArticulationReducedCoordinate_getMaxCOMLinearVelocity :: (self: *PxArticulationReducedCoordinate) -> float #foreign libphysx; + +PxArticulationReducedCoordinate_setMaxCOMAngularVelocity :: (self: *PxArticulationReducedCoordinate, maxAngularVelocity: float) -> void #foreign libphysx "PxArticulationReducedCoordinate_setMaxCOMAngularVelocity_mut"; + +PxArticulationReducedCoordinate_getMaxCOMAngularVelocity :: (self: *PxArticulationReducedCoordinate) -> float #foreign libphysx; + +PxArticulationReducedCoordinate_createLink :: (self: *PxArticulationReducedCoordinate, parent: *PxArticulationLink, pose: *PxTransform) -> *PxArticulationLink #foreign libphysx "PxArticulationReducedCoordinate_createLink_mut"; + +PxArticulationReducedCoordinate_release :: (self: *PxArticulationReducedCoordinate) -> void #foreign libphysx "PxArticulationReducedCoordinate_release_mut"; + +PxArticulationReducedCoordinate_getNbLinks :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getLinks :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getNbShapes :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_setName :: (self: *PxArticulationReducedCoordinate, name: *u8) -> void #foreign libphysx "PxArticulationReducedCoordinate_setName_mut"; + +PxArticulationReducedCoordinate_getName :: (self: *PxArticulationReducedCoordinate) -> *u8 #foreign libphysx; + +PxArticulationReducedCoordinate_getWorldBounds :: (self: *PxArticulationReducedCoordinate, inflation: float) -> PxBounds3 #foreign libphysx; + +PxArticulationReducedCoordinate_getAggregate :: (self: *PxArticulationReducedCoordinate) -> *PxAggregate #foreign libphysx; + +PxArticulationReducedCoordinate_setArticulationFlags :: (self: *PxArticulationReducedCoordinate, flags: u8) -> void #foreign libphysx "PxArticulationReducedCoordinate_setArticulationFlags_mut"; + +PxArticulationReducedCoordinate_setArticulationFlag :: (self: *PxArticulationReducedCoordinate, flag: s32, value: bool) -> void #foreign libphysx "PxArticulationReducedCoordinate_setArticulationFlag_mut"; + +PxArticulationReducedCoordinate_getArticulationFlags :: (self: *PxArticulationReducedCoordinate) -> u8 #foreign libphysx; + +PxArticulationReducedCoordinate_getDofs :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_createCache :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationCache #foreign libphysx; + +PxArticulationReducedCoordinate_getCacheDataSize :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_zeroCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_applyCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, flags: u32, autowake: bool) -> void #foreign libphysx "PxArticulationReducedCoordinate_applyCache_mut"; + +PxArticulationReducedCoordinate_copyInternalStateToCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, flags: u32) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_packJointData :: (self: *PxArticulationReducedCoordinate, maximum: *float, reduced: *float) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_unpackJointData :: (self: *PxArticulationReducedCoordinate, reduced: *float, maximum: *float) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_commonInit :: (self: *PxArticulationReducedCoordinate) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeGeneralizedGravityForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeCoriolisAndCentrifugalForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeGeneralizedExternalForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeJointAcceleration :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeJointForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeDenseJacobian :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, nRows: *u32, nCols: *u32) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeCoefficientMatrix :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_computeLambda :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, initialState: *PxArticulationCache, jointTorque: *float, maxIter: u32) -> bool #foreign libphysx; + +PxArticulationReducedCoordinate_computeGeneralizedMassMatrix :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign libphysx; + +PxArticulationReducedCoordinate_addLoopJoint :: (self: *PxArticulationReducedCoordinate, joint: *PxConstraint) -> void #foreign libphysx "PxArticulationReducedCoordinate_addLoopJoint_mut"; + +PxArticulationReducedCoordinate_removeLoopJoint :: (self: *PxArticulationReducedCoordinate, joint: *PxConstraint) -> void #foreign libphysx "PxArticulationReducedCoordinate_removeLoopJoint_mut"; + +PxArticulationReducedCoordinate_getNbLoopJoints :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getLoopJoints :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getCoefficientMatrixSize :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_setRootGlobalPose :: (self: *PxArticulationReducedCoordinate, pose: *PxTransform, autowake: bool) -> void #foreign libphysx "PxArticulationReducedCoordinate_setRootGlobalPose_mut"; + +PxArticulationReducedCoordinate_getRootGlobalPose :: (self: *PxArticulationReducedCoordinate) -> PxTransform #foreign libphysx; + +PxArticulationReducedCoordinate_setRootLinearVelocity :: (self: *PxArticulationReducedCoordinate, linearVelocity: *Vector3, autowake: bool) -> void #foreign libphysx "PxArticulationReducedCoordinate_setRootLinearVelocity_mut"; + +PxArticulationReducedCoordinate_getRootLinearVelocity :: (self: *PxArticulationReducedCoordinate) -> Vector3 #foreign libphysx; + +PxArticulationReducedCoordinate_setRootAngularVelocity :: (self: *PxArticulationReducedCoordinate, angularVelocity: *Vector3, autowake: bool) -> void #foreign libphysx "PxArticulationReducedCoordinate_setRootAngularVelocity_mut"; + +PxArticulationReducedCoordinate_getRootAngularVelocity :: (self: *PxArticulationReducedCoordinate) -> Vector3 #foreign libphysx; + +PxArticulationReducedCoordinate_getLinkAcceleration :: (self: *PxArticulationReducedCoordinate, linkId: u32) -> PxSpatialVelocity #foreign libphysx "PxArticulationReducedCoordinate_getLinkAcceleration_mut"; + +PxArticulationReducedCoordinate_getGpuArticulationIndex :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx "PxArticulationReducedCoordinate_getGpuArticulationIndex_mut"; + +PxArticulationReducedCoordinate_createSpatialTendon :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationSpatialTendon #foreign libphysx "PxArticulationReducedCoordinate_createSpatialTendon_mut"; + +PxArticulationReducedCoordinate_createFixedTendon :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationFixedTendon #foreign libphysx "PxArticulationReducedCoordinate_createFixedTendon_mut"; + +PxArticulationReducedCoordinate_createSensor :: (self: *PxArticulationReducedCoordinate, link: *PxArticulationLink, relativePose: *PxTransform) -> *PxArticulationSensor #foreign libphysx "PxArticulationReducedCoordinate_createSensor_mut"; + +PxArticulationReducedCoordinate_getSpatialTendons :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationSpatialTendon, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getNbSpatialTendons :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx "PxArticulationReducedCoordinate_getNbSpatialTendons_mut"; + +PxArticulationReducedCoordinate_getFixedTendons :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationFixedTendon, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getNbFixedTendons :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx "PxArticulationReducedCoordinate_getNbFixedTendons_mut"; + +PxArticulationReducedCoordinate_getSensors :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationSensor, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationReducedCoordinate_getNbSensors :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign libphysx "PxArticulationReducedCoordinate_getNbSensors_mut"; + +PxArticulationReducedCoordinate_updateKinematic :: (self: *PxArticulationReducedCoordinate, flags: u8) -> void #foreign libphysx "PxArticulationReducedCoordinate_updateKinematic_mut"; + +PxArticulationJointReducedCoordinate_getParentArticulationLink :: (self: *PxArticulationJointReducedCoordinate) -> *PxArticulationLink #foreign libphysx; + +PxArticulationJointReducedCoordinate_setParentPose :: (self: *PxArticulationJointReducedCoordinate, pose: *PxTransform) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setParentPose_mut"; + +PxArticulationJointReducedCoordinate_getParentPose :: (self: *PxArticulationJointReducedCoordinate) -> PxTransform #foreign libphysx; + +PxArticulationJointReducedCoordinate_getChildArticulationLink :: (self: *PxArticulationJointReducedCoordinate) -> *PxArticulationLink #foreign libphysx; + +PxArticulationJointReducedCoordinate_setChildPose :: (self: *PxArticulationJointReducedCoordinate, pose: *PxTransform) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setChildPose_mut"; + +PxArticulationJointReducedCoordinate_getChildPose :: (self: *PxArticulationJointReducedCoordinate) -> PxTransform #foreign libphysx; + +PxArticulationJointReducedCoordinate_setJointType :: (self: *PxArticulationJointReducedCoordinate, jointType: s32) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setJointType_mut"; + +PxArticulationJointReducedCoordinate_getJointType :: (self: *PxArticulationJointReducedCoordinate) -> s32 #foreign libphysx; + +PxArticulationJointReducedCoordinate_setMotion :: (self: *PxArticulationJointReducedCoordinate, axis: s32, motion: s32) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setMotion_mut"; + +PxArticulationJointReducedCoordinate_getMotion :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> s32 #foreign libphysx; + +PxArticulationJointReducedCoordinate_setLimitParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32, limit: *PxArticulationLimit) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setLimitParams_mut"; + +PxArticulationJointReducedCoordinate_getLimitParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> PxArticulationLimit #foreign libphysx; + +PxArticulationJointReducedCoordinate_setDriveParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32, drive: *PxArticulationDrive) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setDriveParams_mut"; + +PxArticulationJointReducedCoordinate_getDriveParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> PxArticulationDrive #foreign libphysx; + +PxArticulationJointReducedCoordinate_setDriveTarget :: (self: *PxArticulationJointReducedCoordinate, axis: s32, target: float, autowake: bool) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setDriveTarget_mut"; + +PxArticulationJointReducedCoordinate_getDriveTarget :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setDriveVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32, targetVel: float, autowake: bool) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setDriveVelocity_mut"; + +PxArticulationJointReducedCoordinate_getDriveVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setArmature :: (self: *PxArticulationJointReducedCoordinate, axis: s32, armature: float) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setArmature_mut"; + +PxArticulationJointReducedCoordinate_getArmature :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setFrictionCoefficient :: (self: *PxArticulationJointReducedCoordinate, coefficient: float) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setFrictionCoefficient_mut"; + +PxArticulationJointReducedCoordinate_getFrictionCoefficient :: (self: *PxArticulationJointReducedCoordinate) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setMaxJointVelocity :: (self: *PxArticulationJointReducedCoordinate, maxJointV: float) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setMaxJointVelocity_mut"; + +PxArticulationJointReducedCoordinate_getMaxJointVelocity :: (self: *PxArticulationJointReducedCoordinate) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setJointPosition :: (self: *PxArticulationJointReducedCoordinate, axis: s32, jointPos: float) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setJointPosition_mut"; + +PxArticulationJointReducedCoordinate_getJointPosition :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_setJointVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32, jointVel: float) -> void #foreign libphysx "PxArticulationJointReducedCoordinate_setJointVelocity_mut"; + +PxArticulationJointReducedCoordinate_getJointVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign libphysx; + +PxArticulationJointReducedCoordinate_getConcreteTypeName :: (self: *PxArticulationJointReducedCoordinate) -> *u8 #foreign libphysx; + +PxShape_release :: (self: *PxShape) -> void #foreign libphysx "PxShape_release_mut"; + +PxShape_setGeometry :: (self: *PxShape, geometry: *PxGeometry) -> void #foreign libphysx "PxShape_setGeometry_mut"; + +PxShape_getGeometry :: (self: *PxShape) -> *PxGeometry #foreign libphysx; + +PxShape_getActor :: (self: *PxShape) -> *PxRigidActor #foreign libphysx; + +PxShape_setLocalPose :: (self: *PxShape, pose: *PxTransform) -> void #foreign libphysx "PxShape_setLocalPose_mut"; + +PxShape_getLocalPose :: (self: *PxShape) -> PxTransform #foreign libphysx; + +PxShape_setSimulationFilterData :: (self: *PxShape, data: *PxFilterData) -> void #foreign libphysx "PxShape_setSimulationFilterData_mut"; + +PxShape_getSimulationFilterData :: (self: *PxShape) -> PxFilterData #foreign libphysx; + +PxShape_setQueryFilterData :: (self: *PxShape, data: *PxFilterData) -> void #foreign libphysx "PxShape_setQueryFilterData_mut"; + +PxShape_getQueryFilterData :: (self: *PxShape) -> PxFilterData #foreign libphysx; + +PxShape_setMaterials :: (self: *PxShape, materials: **PxMaterial, materialCount: u16) -> void #foreign libphysx "PxShape_setMaterials_mut"; + +PxShape_getNbMaterials :: (self: *PxShape) -> u16 #foreign libphysx; + +PxShape_getMaterials :: (self: *PxShape, userBuffer: **PxMaterial, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxShape_getMaterialFromInternalFaceIndex :: (self: *PxShape, faceIndex: u32) -> *PxBaseMaterial #foreign libphysx; + +PxShape_setContactOffset :: (self: *PxShape, contactOffset: float) -> void #foreign libphysx "PxShape_setContactOffset_mut"; + +PxShape_getContactOffset :: (self: *PxShape) -> float #foreign libphysx; + +PxShape_setRestOffset :: (self: *PxShape, restOffset: float) -> void #foreign libphysx "PxShape_setRestOffset_mut"; + +PxShape_getRestOffset :: (self: *PxShape) -> float #foreign libphysx; + +PxShape_setDensityForFluid :: (self: *PxShape, densityForFluid: float) -> void #foreign libphysx "PxShape_setDensityForFluid_mut"; + +PxShape_getDensityForFluid :: (self: *PxShape) -> float #foreign libphysx; + +PxShape_setTorsionalPatchRadius :: (self: *PxShape, radius: float) -> void #foreign libphysx "PxShape_setTorsionalPatchRadius_mut"; + +PxShape_getTorsionalPatchRadius :: (self: *PxShape) -> float #foreign libphysx; + +PxShape_setMinTorsionalPatchRadius :: (self: *PxShape, radius: float) -> void #foreign libphysx "PxShape_setMinTorsionalPatchRadius_mut"; + +PxShape_getMinTorsionalPatchRadius :: (self: *PxShape) -> float #foreign libphysx; + +PxShape_setFlag :: (self: *PxShape, flag: s32, value: bool) -> void #foreign libphysx "PxShape_setFlag_mut"; + +PxShape_setFlags :: (self: *PxShape, inFlags: u8) -> void #foreign libphysx "PxShape_setFlags_mut"; + +PxShape_getFlags :: (self: *PxShape) -> u8 #foreign libphysx; + +PxShape_isExclusive :: (self: *PxShape) -> bool #foreign libphysx; + +PxShape_setName :: (self: *PxShape, name: *u8) -> void #foreign libphysx "PxShape_setName_mut"; + +PxShape_getName :: (self: *PxShape) -> *u8 #foreign libphysx; + +PxShape_getConcreteTypeName :: (self: *PxShape) -> *u8 #foreign libphysx; + +PxRigidActor_release :: (self: *PxRigidActor) -> void #foreign libphysx "PxRigidActor_release_mut"; + +PxRigidActor_getInternalActorIndex :: (self: *PxRigidActor) -> u32 #foreign libphysx; + +PxRigidActor_getGlobalPose :: (self: *PxRigidActor) -> PxTransform #foreign libphysx; + +PxRigidActor_setGlobalPose :: (self: *PxRigidActor, pose: *PxTransform, autowake: bool) -> void #foreign libphysx "PxRigidActor_setGlobalPose_mut"; + +PxRigidActor_attachShape :: (self: *PxRigidActor, shape: *PxShape) -> bool #foreign libphysx "PxRigidActor_attachShape_mut"; + +PxRigidActor_detachShape :: (self: *PxRigidActor, shape: *PxShape, wakeOnLostTouch: bool) -> void #foreign libphysx "PxRigidActor_detachShape_mut"; + +PxRigidActor_getNbShapes :: (self: *PxRigidActor) -> u32 #foreign libphysx; + +PxRigidActor_getShapes :: (self: *PxRigidActor, userBuffer: **PxShape, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxRigidActor_getNbConstraints :: (self: *PxRigidActor) -> u32 #foreign libphysx; + +PxRigidActor_getConstraints :: (self: *PxRigidActor, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxNodeIndex_new :: (id: u32, articLinkId: u32) -> PxNodeIndex #foreign libphysx; + +PxNodeIndex_new :: (id: u32) -> PxNodeIndex #foreign libphysx "PxNodeIndex_new_1"; + +PxNodeIndex_index :: (self: *PxNodeIndex) -> u32 #foreign libphysx; + +PxNodeIndex_articulationLinkId :: (self: *PxNodeIndex) -> u32 #foreign libphysx; + +PxNodeIndex_isArticulation :: (self: *PxNodeIndex) -> u32 #foreign libphysx; + +PxNodeIndex_isStaticBody :: (self: *PxNodeIndex) -> bool #foreign libphysx; + +PxNodeIndex_isValid :: (self: *PxNodeIndex) -> bool #foreign libphysx; + +PxNodeIndex_setIndices :: (self: *PxNodeIndex, index: u32, articLinkId: u32) -> void #foreign libphysx "PxNodeIndex_setIndices_mut"; + +PxNodeIndex_setIndices_mut :: (self: *PxNodeIndex, index: u32) -> void #foreign libphysx "PxNodeIndex_setIndices_mut_1"; + +PxNodeIndex_getInd :: (self: *PxNodeIndex) -> u64 #foreign libphysx; + +PxRigidBody_setCMassLocalPose :: (self: *PxRigidBody, pose: *PxTransform) -> void #foreign libphysx "PxRigidBody_setCMassLocalPose_mut"; + +PxRigidBody_getCMassLocalPose :: (self: *PxRigidBody) -> PxTransform #foreign libphysx; + +PxRigidBody_setMass :: (self: *PxRigidBody, mass: float) -> void #foreign libphysx "PxRigidBody_setMass_mut"; + +PxRigidBody_getMass :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_getInvMass :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setMassSpaceInertiaTensor :: (self: *PxRigidBody, m: *Vector3) -> void #foreign libphysx "PxRigidBody_setMassSpaceInertiaTensor_mut"; + +PxRigidBody_getMassSpaceInertiaTensor :: (self: *PxRigidBody) -> Vector3 #foreign libphysx; + +PxRigidBody_getMassSpaceInvInertiaTensor :: (self: *PxRigidBody) -> Vector3 #foreign libphysx; + +PxRigidBody_setLinearDamping :: (self: *PxRigidBody, linDamp: float) -> void #foreign libphysx "PxRigidBody_setLinearDamping_mut"; + +PxRigidBody_getLinearDamping :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setAngularDamping :: (self: *PxRigidBody, angDamp: float) -> void #foreign libphysx "PxRigidBody_setAngularDamping_mut"; + +PxRigidBody_getAngularDamping :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_getLinearVelocity :: (self: *PxRigidBody) -> Vector3 #foreign libphysx; + +PxRigidBody_getAngularVelocity :: (self: *PxRigidBody) -> Vector3 #foreign libphysx; + +PxRigidBody_setMaxLinearVelocity :: (self: *PxRigidBody, maxLinVel: float) -> void #foreign libphysx "PxRigidBody_setMaxLinearVelocity_mut"; + +PxRigidBody_getMaxLinearVelocity :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setMaxAngularVelocity :: (self: *PxRigidBody, maxAngVel: float) -> void #foreign libphysx "PxRigidBody_setMaxAngularVelocity_mut"; + +PxRigidBody_getMaxAngularVelocity :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_addForce :: (self: *PxRigidBody, force: *Vector3, mode: s32, autowake: bool) -> void #foreign libphysx "PxRigidBody_addForce_mut"; + +PxRigidBody_addTorque :: (self: *PxRigidBody, torque: *Vector3, mode: s32, autowake: bool) -> void #foreign libphysx "PxRigidBody_addTorque_mut"; + +PxRigidBody_clearForce :: (self: *PxRigidBody, mode: s32) -> void #foreign libphysx "PxRigidBody_clearForce_mut"; + +PxRigidBody_clearTorque :: (self: *PxRigidBody, mode: s32) -> void #foreign libphysx "PxRigidBody_clearTorque_mut"; + +PxRigidBody_setForceAndTorque :: (self: *PxRigidBody, force: *Vector3, torque: *Vector3, mode: s32) -> void #foreign libphysx "PxRigidBody_setForceAndTorque_mut"; + +PxRigidBody_setRigidBodyFlag :: (self: *PxRigidBody, flag: s32, value: bool) -> void #foreign libphysx "PxRigidBody_setRigidBodyFlag_mut"; + +PxRigidBody_setRigidBodyFlags :: (self: *PxRigidBody, inFlags: u16) -> void #foreign libphysx "PxRigidBody_setRigidBodyFlags_mut"; + +PxRigidBody_getRigidBodyFlags :: (self: *PxRigidBody) -> u16 #foreign libphysx; + +PxRigidBody_setMinCCDAdvanceCoefficient :: (self: *PxRigidBody, advanceCoefficient: float) -> void #foreign libphysx "PxRigidBody_setMinCCDAdvanceCoefficient_mut"; + +PxRigidBody_getMinCCDAdvanceCoefficient :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setMaxDepenetrationVelocity :: (self: *PxRigidBody, biasClamp: float) -> void #foreign libphysx "PxRigidBody_setMaxDepenetrationVelocity_mut"; + +PxRigidBody_getMaxDepenetrationVelocity :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setMaxContactImpulse :: (self: *PxRigidBody, maxImpulse: float) -> void #foreign libphysx "PxRigidBody_setMaxContactImpulse_mut"; + +PxRigidBody_getMaxContactImpulse :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_setContactSlopCoefficient :: (self: *PxRigidBody, slopCoefficient: float) -> void #foreign libphysx "PxRigidBody_setContactSlopCoefficient_mut"; + +PxRigidBody_getContactSlopCoefficient :: (self: *PxRigidBody) -> float #foreign libphysx; + +PxRigidBody_getInternalIslandNodeIndex :: (self: *PxRigidBody) -> PxNodeIndex #foreign libphysx; + +PxArticulationLink_release :: (self: *PxArticulationLink) -> void #foreign libphysx "PxArticulationLink_release_mut"; + +PxArticulationLink_getArticulation :: (self: *PxArticulationLink) -> *PxArticulationReducedCoordinate #foreign libphysx; + +PxArticulationLink_getInboundJoint :: (self: *PxArticulationLink) -> *PxArticulationJointReducedCoordinate #foreign libphysx; + +PxArticulationLink_getInboundJointDof :: (self: *PxArticulationLink) -> u32 #foreign libphysx; + +PxArticulationLink_getNbChildren :: (self: *PxArticulationLink) -> u32 #foreign libphysx; + +PxArticulationLink_getLinkIndex :: (self: *PxArticulationLink) -> u32 #foreign libphysx; + +PxArticulationLink_getChildren :: (self: *PxArticulationLink, userBuffer: **PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxArticulationLink_setCfmScale :: (self: *PxArticulationLink, cfm: float) -> void #foreign libphysx "PxArticulationLink_setCfmScale_mut"; + +PxArticulationLink_getCfmScale :: (self: *PxArticulationLink) -> float #foreign libphysx; + +PxArticulationLink_getLinearVelocity :: (self: *PxArticulationLink) -> Vector3 #foreign libphysx; + +PxArticulationLink_getAngularVelocity :: (self: *PxArticulationLink) -> Vector3 #foreign libphysx; + +PxArticulationLink_getConcreteTypeName :: (self: *PxArticulationLink) -> *u8 #foreign libphysx; + +PxConeLimitedConstraint_new :: () -> PxConeLimitedConstraint #foreign libphysx; + +PxConstraint_release :: (self: *PxConstraint) -> void #foreign libphysx "PxConstraint_release_mut"; + +PxConstraint_getScene :: (self: *PxConstraint) -> *PxScene #foreign libphysx; + +PxConstraint_getActors :: (self: *PxConstraint, actor0: **PxRigidActor, actor1: **PxRigidActor) -> void #foreign libphysx; + +PxConstraint_setActors :: (self: *PxConstraint, actor0: *PxRigidActor, actor1: *PxRigidActor) -> void #foreign libphysx "PxConstraint_setActors_mut"; + +PxConstraint_markDirty :: (self: *PxConstraint) -> void #foreign libphysx "PxConstraint_markDirty_mut"; + +PxConstraint_getFlags :: (self: *PxConstraint) -> u16 #foreign libphysx; + +PxConstraint_setFlags :: (self: *PxConstraint, flags: u16) -> void #foreign libphysx "PxConstraint_setFlags_mut"; + +PxConstraint_setFlag :: (self: *PxConstraint, flag: s32, value: bool) -> void #foreign libphysx "PxConstraint_setFlag_mut"; + +PxConstraint_getForce :: (self: *PxConstraint, linear: *Vector3, angular: *Vector3) -> void #foreign libphysx; + +PxConstraint_isValid :: (self: *PxConstraint) -> bool #foreign libphysx; + +PxConstraint_setBreakForce :: (self: *PxConstraint, linear: float, angular: float) -> void #foreign libphysx "PxConstraint_setBreakForce_mut"; + +PxConstraint_getBreakForce :: (self: *PxConstraint, linear: *float, angular: *float) -> void #foreign libphysx; + +PxConstraint_setMinResponseThreshold :: (self: *PxConstraint, threshold: float) -> void #foreign libphysx "PxConstraint_setMinResponseThreshold_mut"; + +PxConstraint_getMinResponseThreshold :: (self: *PxConstraint) -> float #foreign libphysx; + +PxConstraint_getExternalReference :: (self: *PxConstraint, typeID: *u32) -> *void #foreign libphysx "PxConstraint_getExternalReference_mut"; + +PxConstraint_setConstraintFunctions :: (self: *PxConstraint, connector: *PxConstraintConnector, shaders: *PxConstraintShaderTable) -> void #foreign libphysx "PxConstraint_setConstraintFunctions_mut"; + +PxConstraint_getConcreteTypeName :: (self: *PxConstraint) -> *u8 #foreign libphysx; + +PxContactStreamIterator_new :: (contactPatches: *u8, contactPoints: *u8, contactFaceIndices: *u32, nbPatches: u32, nbContacts: u32) -> PxContactStreamIterator #foreign libphysx; + +PxContactStreamIterator_hasNextPatch :: (self: *PxContactStreamIterator) -> bool #foreign libphysx; + +PxContactStreamIterator_getTotalContactCount :: (self: *PxContactStreamIterator) -> u32 #foreign libphysx; + +PxContactStreamIterator_getTotalPatchCount :: (self: *PxContactStreamIterator) -> u32 #foreign libphysx; + +PxContactStreamIterator_nextPatch :: (self: *PxContactStreamIterator) -> void #foreign libphysx "PxContactStreamIterator_nextPatch_mut"; + +PxContactStreamIterator_hasNextContact :: (self: *PxContactStreamIterator) -> bool #foreign libphysx; + +PxContactStreamIterator_nextContact :: (self: *PxContactStreamIterator) -> void #foreign libphysx "PxContactStreamIterator_nextContact_mut"; + +PxContactStreamIterator_getContactNormal :: (self: *PxContactStreamIterator) -> *Vector3 #foreign libphysx; + +PxContactStreamIterator_getInvMassScale0 :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getInvMassScale1 :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getInvInertiaScale0 :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getInvInertiaScale1 :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getMaxImpulse :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getTargetVel :: (self: *PxContactStreamIterator) -> *Vector3 #foreign libphysx; + +PxContactStreamIterator_getContactPoint :: (self: *PxContactStreamIterator) -> *Vector3 #foreign libphysx; + +PxContactStreamIterator_getSeparation :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getFaceIndex0 :: (self: *PxContactStreamIterator) -> u32 #foreign libphysx; + +PxContactStreamIterator_getFaceIndex1 :: (self: *PxContactStreamIterator) -> u32 #foreign libphysx; + +PxContactStreamIterator_getStaticFriction :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getDynamicFriction :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getRestitution :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getDamping :: (self: *PxContactStreamIterator) -> float #foreign libphysx; + +PxContactStreamIterator_getMaterialFlags :: (self: *PxContactStreamIterator) -> u32 #foreign libphysx; + +PxContactStreamIterator_getMaterialIndex0 :: (self: *PxContactStreamIterator) -> u16 #foreign libphysx; + +PxContactStreamIterator_getMaterialIndex1 :: (self: *PxContactStreamIterator) -> u16 #foreign libphysx; + +PxContactStreamIterator_advanceToIndex :: (self: *PxContactStreamIterator, initialIndex: u32) -> bool #foreign libphysx "PxContactStreamIterator_advanceToIndex_mut"; + +PxContactSet_getPoint :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign libphysx; + +PxContactSet_setPoint :: (self: *PxContactSet, i: u32, p: *Vector3) -> void #foreign libphysx "PxContactSet_setPoint_mut"; + +PxContactSet_getNormal :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign libphysx; + +PxContactSet_setNormal :: (self: *PxContactSet, i: u32, n: *Vector3) -> void #foreign libphysx "PxContactSet_setNormal_mut"; + +PxContactSet_getSeparation :: (self: *PxContactSet, i: u32) -> float #foreign libphysx; + +PxContactSet_setSeparation :: (self: *PxContactSet, i: u32, s: float) -> void #foreign libphysx "PxContactSet_setSeparation_mut"; + +PxContactSet_getTargetVelocity :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign libphysx; + +PxContactSet_setTargetVelocity :: (self: *PxContactSet, i: u32, v: *Vector3) -> void #foreign libphysx "PxContactSet_setTargetVelocity_mut"; + +PxContactSet_getInternalFaceIndex0 :: (self: *PxContactSet, i: u32) -> u32 #foreign libphysx; + +PxContactSet_getInternalFaceIndex1 :: (self: *PxContactSet, i: u32) -> u32 #foreign libphysx; + +PxContactSet_getMaxImpulse :: (self: *PxContactSet, i: u32) -> float #foreign libphysx; + +PxContactSet_setMaxImpulse :: (self: *PxContactSet, i: u32, s: float) -> void #foreign libphysx "PxContactSet_setMaxImpulse_mut"; + +PxContactSet_getRestitution :: (self: *PxContactSet, i: u32) -> float #foreign libphysx; + +PxContactSet_setRestitution :: (self: *PxContactSet, i: u32, r: float) -> void #foreign libphysx "PxContactSet_setRestitution_mut"; + +PxContactSet_getStaticFriction :: (self: *PxContactSet, i: u32) -> float #foreign libphysx; + +PxContactSet_setStaticFriction :: (self: *PxContactSet, i: u32, f: float) -> void #foreign libphysx "PxContactSet_setStaticFriction_mut"; + +PxContactSet_getDynamicFriction :: (self: *PxContactSet, i: u32) -> float #foreign libphysx; + +PxContactSet_setDynamicFriction :: (self: *PxContactSet, i: u32, f: float) -> void #foreign libphysx "PxContactSet_setDynamicFriction_mut"; + +PxContactSet_ignore :: (self: *PxContactSet, i: u32) -> void #foreign libphysx "PxContactSet_ignore_mut"; + +PxContactSet_size :: (self: *PxContactSet) -> u32 #foreign libphysx; + +PxContactSet_getInvMassScale0 :: (self: *PxContactSet) -> float #foreign libphysx; + +PxContactSet_getInvMassScale1 :: (self: *PxContactSet) -> float #foreign libphysx; + +PxContactSet_getInvInertiaScale0 :: (self: *PxContactSet) -> float #foreign libphysx; + +PxContactSet_getInvInertiaScale1 :: (self: *PxContactSet) -> float #foreign libphysx; + +PxContactSet_setInvMassScale0 :: (self: *PxContactSet, scale: float) -> void #foreign libphysx "PxContactSet_setInvMassScale0_mut"; + +PxContactSet_setInvMassScale1 :: (self: *PxContactSet, scale: float) -> void #foreign libphysx "PxContactSet_setInvMassScale1_mut"; + +PxContactSet_setInvInertiaScale0 :: (self: *PxContactSet, scale: float) -> void #foreign libphysx "PxContactSet_setInvInertiaScale0_mut"; + +PxContactSet_setInvInertiaScale1 :: (self: *PxContactSet, scale: float) -> void #foreign libphysx "PxContactSet_setInvInertiaScale1_mut"; + +PxContactModifyCallback_onContactModify :: (self: *PxContactModifyCallback, pairs: *PxContactModifyPair, count: u32) -> void #foreign libphysx "PxContactModifyCallback_onContactModify_mut"; + +PxCCDContactModifyCallback_onCCDContactModify :: (self: *PxCCDContactModifyCallback, pairs: *PxContactModifyPair, count: u32) -> void #foreign libphysx "PxCCDContactModifyCallback_onCCDContactModify_mut"; + +PxDeletionListener_onRelease :: (self: *PxDeletionListener, observed: *PxBase, userData: *void, deletionEvent: s32) -> void #foreign libphysx "PxDeletionListener_onRelease_mut"; + +PxBaseMaterial_isKindOf :: (self: *PxBaseMaterial, name: *u8) -> bool #foreign libphysx; + +PxFEMMaterial_setYoungsModulus :: (self: *PxFEMMaterial, young: float) -> void #foreign libphysx "PxFEMMaterial_setYoungsModulus_mut"; + +PxFEMMaterial_getYoungsModulus :: (self: *PxFEMMaterial) -> float #foreign libphysx; + +PxFEMMaterial_setPoissons :: (self: *PxFEMMaterial, poisson: float) -> void #foreign libphysx "PxFEMMaterial_setPoissons_mut"; + +PxFEMMaterial_getPoissons :: (self: *PxFEMMaterial) -> float #foreign libphysx; + +PxFEMMaterial_setDynamicFriction :: (self: *PxFEMMaterial, dynamicFriction: float) -> void #foreign libphysx "PxFEMMaterial_setDynamicFriction_mut"; + +PxFEMMaterial_getDynamicFriction :: (self: *PxFEMMaterial) -> float #foreign libphysx; + +PxFilterData_new :: (anon_param0: s32) -> PxFilterData #foreign libphysx; + +PxFilterData_new :: () -> PxFilterData #foreign libphysx "PxFilterData_new_1"; + +PxFilterData_new :: (w0: u32, w1: u32, w2: u32, w3: u32) -> PxFilterData #foreign libphysx "PxFilterData_new_2"; + +PxFilterData_setToDefault :: (self: *PxFilterData) -> void #foreign libphysx "PxFilterData_setToDefault_mut"; + +PxGetFilterObjectType :: (attr: u32) -> s32 #foreign libphysx "phys_PxGetFilterObjectType"; + +PxFilterObjectIsKinematic :: (attr: u32) -> bool #foreign libphysx "phys_PxFilterObjectIsKinematic"; + +PxFilterObjectIsTrigger :: (attr: u32) -> bool #foreign libphysx "phys_PxFilterObjectIsTrigger"; + +PxSimulationFilterCallback_pairFound :: (self: *PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, a0: *PxActor, s0: *PxShape, attributes1: u32, filterData1: PxFilterData, a1: *PxActor, s1: *PxShape, pairFlags: *u16) -> u16 #foreign libphysx "PxSimulationFilterCallback_pairFound_mut"; + +PxSimulationFilterCallback_pairLost :: (self: *PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, objectRemoved: bool) -> void #foreign libphysx "PxSimulationFilterCallback_pairLost_mut"; + +PxSimulationFilterCallback_statusChange :: (self: *PxSimulationFilterCallback, pairID: *u32, pairFlags: *u16, filterFlags: *u16) -> bool #foreign libphysx "PxSimulationFilterCallback_statusChange_mut"; + +PxLockedData_getDataAccessFlags :: (self: *PxLockedData) -> u8 #foreign libphysx "PxLockedData_getDataAccessFlags_mut"; + +PxLockedData_unlock :: (self: *PxLockedData) -> void #foreign libphysx "PxLockedData_unlock_mut"; + +PxLockedData_delete :: (self: *PxLockedData) -> void #foreign libphysx; + +PxMaterial_setDynamicFriction :: (self: *PxMaterial, coef: float) -> void #foreign libphysx "PxMaterial_setDynamicFriction_mut"; + +PxMaterial_getDynamicFriction :: (self: *PxMaterial) -> float #foreign libphysx; + +PxMaterial_setStaticFriction :: (self: *PxMaterial, coef: float) -> void #foreign libphysx "PxMaterial_setStaticFriction_mut"; + +PxMaterial_getStaticFriction :: (self: *PxMaterial) -> float #foreign libphysx; + +PxMaterial_setRestitution :: (self: *PxMaterial, rest: float) -> void #foreign libphysx "PxMaterial_setRestitution_mut"; + +PxMaterial_getRestitution :: (self: *PxMaterial) -> float #foreign libphysx; + +PxMaterial_setDamping :: (self: *PxMaterial, damping: float) -> void #foreign libphysx "PxMaterial_setDamping_mut"; + +PxMaterial_getDamping :: (self: *PxMaterial) -> float #foreign libphysx; + +PxMaterial_setFlag :: (self: *PxMaterial, flag: s32, b: bool) -> void #foreign libphysx "PxMaterial_setFlag_mut"; + +PxMaterial_setFlags :: (self: *PxMaterial, flags: u16) -> void #foreign libphysx "PxMaterial_setFlags_mut"; + +PxMaterial_getFlags :: (self: *PxMaterial) -> u16 #foreign libphysx; + +PxMaterial_setFrictionCombineMode :: (self: *PxMaterial, combMode: s32) -> void #foreign libphysx "PxMaterial_setFrictionCombineMode_mut"; + +PxMaterial_getFrictionCombineMode :: (self: *PxMaterial) -> s32 #foreign libphysx; + +PxMaterial_setRestitutionCombineMode :: (self: *PxMaterial, combMode: s32) -> void #foreign libphysx "PxMaterial_setRestitutionCombineMode_mut"; + +PxMaterial_getRestitutionCombineMode :: (self: *PxMaterial) -> s32 #foreign libphysx; + +PxMaterial_getConcreteTypeName :: (self: *PxMaterial) -> *u8 #foreign libphysx; + +PxDiffuseParticleParams_new :: () -> PxDiffuseParticleParams #foreign libphysx; + +PxDiffuseParticleParams_setToDefault :: (self: *PxDiffuseParticleParams) -> void #foreign libphysx "PxDiffuseParticleParams_setToDefault_mut"; + +PxParticleMaterial_setFriction :: (self: *PxParticleMaterial, friction: float) -> void #foreign libphysx "PxParticleMaterial_setFriction_mut"; + +PxParticleMaterial_getFriction :: (self: *PxParticleMaterial) -> float #foreign libphysx; + +PxParticleMaterial_setDamping :: (self: *PxParticleMaterial, damping: float) -> void #foreign libphysx "PxParticleMaterial_setDamping_mut"; + +PxParticleMaterial_getDamping :: (self: *PxParticleMaterial) -> float #foreign libphysx; + +PxParticleMaterial_setAdhesion :: (self: *PxParticleMaterial, adhesion: float) -> void #foreign libphysx "PxParticleMaterial_setAdhesion_mut"; + +PxParticleMaterial_getAdhesion :: (self: *PxParticleMaterial) -> float #foreign libphysx; + +PxParticleMaterial_setGravityScale :: (self: *PxParticleMaterial, scale: float) -> void #foreign libphysx "PxParticleMaterial_setGravityScale_mut"; + +PxParticleMaterial_getGravityScale :: (self: *PxParticleMaterial) -> float #foreign libphysx; + +PxParticleMaterial_setAdhesionRadiusScale :: (self: *PxParticleMaterial, scale: float) -> void #foreign libphysx "PxParticleMaterial_setAdhesionRadiusScale_mut"; + +PxParticleMaterial_getAdhesionRadiusScale :: (self: *PxParticleMaterial) -> float #foreign libphysx; + +PxPhysics_release :: (self: *PxPhysics) -> void #foreign libphysx "PxPhysics_release_mut"; + +PxPhysics_getFoundation :: (self: *PxPhysics) -> *PxFoundation #foreign libphysx "PxPhysics_getFoundation_mut"; + +PxPhysics_createAggregate :: (self: *PxPhysics, maxActor: u32, maxShape: u32, filterHint: u32) -> *PxAggregate #foreign libphysx "PxPhysics_createAggregate_mut"; + +PxPhysics_getTolerancesScale :: (self: *PxPhysics) -> *PxTolerancesScale #foreign libphysx; + +PxPhysics_createTriangleMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxTriangleMesh #foreign libphysx "PxPhysics_createTriangleMesh_mut"; + +PxPhysics_getNbTriangleMeshes :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getTriangleMeshes :: (self: *PxPhysics, userBuffer: **PxTriangleMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createTetrahedronMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxTetrahedronMesh #foreign libphysx "PxPhysics_createTetrahedronMesh_mut"; + +PxPhysics_createSoftBodyMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxSoftBodyMesh #foreign libphysx "PxPhysics_createSoftBodyMesh_mut"; + +PxPhysics_getNbTetrahedronMeshes :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getTetrahedronMeshes :: (self: *PxPhysics, userBuffer: **PxTetrahedronMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createHeightField :: (self: *PxPhysics, stream: *PxInputStream) -> *PxHeightField #foreign libphysx "PxPhysics_createHeightField_mut"; + +PxPhysics_getNbHeightFields :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getHeightFields :: (self: *PxPhysics, userBuffer: **PxHeightField, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createConvexMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxConvexMesh #foreign libphysx "PxPhysics_createConvexMesh_mut"; + +PxPhysics_getNbConvexMeshes :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getConvexMeshes :: (self: *PxPhysics, userBuffer: **PxConvexMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createBVH :: (self: *PxPhysics, stream: *PxInputStream) -> *PxBVH #foreign libphysx "PxPhysics_createBVH_mut"; + +PxPhysics_getNbBVHs :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getBVHs :: (self: *PxPhysics, userBuffer: **PxBVH, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createScene :: (self: *PxPhysics, sceneDesc: *PxSceneDesc) -> *PxScene #foreign libphysx "PxPhysics_createScene_mut"; + +PxPhysics_getNbScenes :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getScenes :: (self: *PxPhysics, userBuffer: **PxScene, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createRigidStatic :: (self: *PxPhysics, pose: *PxTransform) -> *PxRigidStatic #foreign libphysx "PxPhysics_createRigidStatic_mut"; + +PxPhysics_createRigidDynamic :: (self: *PxPhysics, pose: *PxTransform) -> *PxRigidDynamic #foreign libphysx "PxPhysics_createRigidDynamic_mut"; + +PxPhysics_createPruningStructure :: (self: *PxPhysics, actors: **PxRigidActor, nbActors: u32) -> *PxPruningStructure #foreign libphysx "PxPhysics_createPruningStructure_mut"; + +PxPhysics_createShape :: (self: *PxPhysics, geometry: *PxGeometry, material: *PxMaterial, isExclusive: bool, shapeFlags: u8) -> *PxShape #foreign libphysx "PxPhysics_createShape_mut"; + +PxPhysics_createShape_mut :: (self: *PxPhysics, geometry: *PxGeometry, materials: **PxMaterial, materialCount: u16, isExclusive: bool, shapeFlags: u8) -> *PxShape #foreign libphysx "PxPhysics_createShape_mut_1"; + +PxPhysics_getNbShapes :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getShapes :: (self: *PxPhysics, userBuffer: **PxShape, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_createConstraint :: (self: *PxPhysics, actor0: *PxRigidActor, actor1: *PxRigidActor, connector: *PxConstraintConnector, shaders: *PxConstraintShaderTable, dataSize: u32) -> *PxConstraint #foreign libphysx "PxPhysics_createConstraint_mut"; + +PxPhysics_createArticulationReducedCoordinate :: (self: *PxPhysics) -> *PxArticulationReducedCoordinate #foreign libphysx "PxPhysics_createArticulationReducedCoordinate_mut"; + +PxPhysics_createMaterial :: (self: *PxPhysics, staticFriction: float, dynamicFriction: float, restitution: float) -> *PxMaterial #foreign libphysx "PxPhysics_createMaterial_mut"; + +PxPhysics_getNbMaterials :: (self: *PxPhysics) -> u32 #foreign libphysx; + +PxPhysics_getMaterials :: (self: *PxPhysics, userBuffer: **PxMaterial, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPhysics_registerDeletionListener :: (self: *PxPhysics, observer: *PxDeletionListener, deletionEvents: *u8, restrictedObjectSet: bool) -> void #foreign libphysx "PxPhysics_registerDeletionListener_mut"; + +PxPhysics_unregisterDeletionListener :: (self: *PxPhysics, observer: *PxDeletionListener) -> void #foreign libphysx "PxPhysics_unregisterDeletionListener_mut"; + +PxPhysics_registerDeletionListenerObjects :: (self: *PxPhysics, observer: *PxDeletionListener, observables: **PxBase, observableCount: u32) -> void #foreign libphysx "PxPhysics_registerDeletionListenerObjects_mut"; + +PxPhysics_unregisterDeletionListenerObjects :: (self: *PxPhysics, observer: *PxDeletionListener, observables: **PxBase, observableCount: u32) -> void #foreign libphysx "PxPhysics_unregisterDeletionListenerObjects_mut"; + +PxPhysics_getPhysicsInsertionCallback :: (self: *PxPhysics) -> *PxInsertionCallback #foreign libphysx "PxPhysics_getPhysicsInsertionCallback_mut"; + +PxCreatePhysics :: (version: u32, foundation: *PxFoundation, scale: *PxTolerancesScale, trackOutstandingAllocations: bool, pvd: *PxPvd, omniPvd: *PxOmniPvd) -> *PxPhysics #foreign libphysx "phys_PxCreatePhysics"; + +PxGetPhysics :: () -> *PxPhysics #foreign libphysx "phys_PxGetPhysics"; + +PxActorShape_new :: () -> PxActorShape #foreign libphysx; + +PxActorShape_new :: (a: *PxRigidActor, s: *PxShape) -> PxActorShape #foreign libphysx "PxActorShape_new_1"; + +PxQueryCache_new :: () -> PxQueryCache #foreign libphysx; + +PxQueryCache_new :: (s: *PxShape, findex: u32) -> PxQueryCache #foreign libphysx "PxQueryCache_new_1"; + +PxQueryFilterData_new :: () -> PxQueryFilterData #foreign libphysx; + +PxQueryFilterData_new :: (fd: *PxFilterData, f: u16) -> PxQueryFilterData #foreign libphysx "PxQueryFilterData_new_1"; + +PxQueryFilterData_new :: (f: u16) -> PxQueryFilterData #foreign libphysx "PxQueryFilterData_new_2"; + +PxQueryFilterCallback_preFilter :: (self: *PxQueryFilterCallback, filterData: *PxFilterData, shape: *PxShape, actor: *PxRigidActor, queryFlags: *u16) -> s32 #foreign libphysx "PxQueryFilterCallback_preFilter_mut"; + +PxQueryFilterCallback_postFilter :: (self: *PxQueryFilterCallback, filterData: *PxFilterData, hit: *PxQueryHit, shape: *PxShape, actor: *PxRigidActor) -> s32 #foreign libphysx "PxQueryFilterCallback_postFilter_mut"; + +PxQueryFilterCallback_delete :: (self: *PxQueryFilterCallback) -> void #foreign libphysx; + +PxRigidDynamic_setKinematicTarget :: (self: *PxRigidDynamic, destination: *PxTransform) -> void #foreign libphysx "PxRigidDynamic_setKinematicTarget_mut"; + +PxRigidDynamic_getKinematicTarget :: (self: *PxRigidDynamic, target: *PxTransform) -> bool #foreign libphysx; + +PxRigidDynamic_isSleeping :: (self: *PxRigidDynamic) -> bool #foreign libphysx; + +PxRigidDynamic_setSleepThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign libphysx "PxRigidDynamic_setSleepThreshold_mut"; + +PxRigidDynamic_getSleepThreshold :: (self: *PxRigidDynamic) -> float #foreign libphysx; + +PxRigidDynamic_setStabilizationThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign libphysx "PxRigidDynamic_setStabilizationThreshold_mut"; + +PxRigidDynamic_getStabilizationThreshold :: (self: *PxRigidDynamic) -> float #foreign libphysx; + +PxRigidDynamic_getRigidDynamicLockFlags :: (self: *PxRigidDynamic) -> u8 #foreign libphysx; + +PxRigidDynamic_setRigidDynamicLockFlag :: (self: *PxRigidDynamic, flag: s32, value: bool) -> void #foreign libphysx "PxRigidDynamic_setRigidDynamicLockFlag_mut"; + +PxRigidDynamic_setRigidDynamicLockFlags :: (self: *PxRigidDynamic, flags: u8) -> void #foreign libphysx "PxRigidDynamic_setRigidDynamicLockFlags_mut"; + +PxRigidDynamic_getLinearVelocity :: (self: *PxRigidDynamic) -> Vector3 #foreign libphysx; + +PxRigidDynamic_setLinearVelocity :: (self: *PxRigidDynamic, linVel: *Vector3, autowake: bool) -> void #foreign libphysx "PxRigidDynamic_setLinearVelocity_mut"; + +PxRigidDynamic_getAngularVelocity :: (self: *PxRigidDynamic) -> Vector3 #foreign libphysx; + +PxRigidDynamic_setAngularVelocity :: (self: *PxRigidDynamic, angVel: *Vector3, autowake: bool) -> void #foreign libphysx "PxRigidDynamic_setAngularVelocity_mut"; + +PxRigidDynamic_setWakeCounter :: (self: *PxRigidDynamic, wakeCounterValue: float) -> void #foreign libphysx "PxRigidDynamic_setWakeCounter_mut"; + +PxRigidDynamic_getWakeCounter :: (self: *PxRigidDynamic) -> float #foreign libphysx; + +PxRigidDynamic_wakeUp :: (self: *PxRigidDynamic) -> void #foreign libphysx "PxRigidDynamic_wakeUp_mut"; + +PxRigidDynamic_putToSleep :: (self: *PxRigidDynamic) -> void #foreign libphysx "PxRigidDynamic_putToSleep_mut"; + +PxRigidDynamic_setSolverIterationCounts :: (self: *PxRigidDynamic, minPositionIters: u32, minVelocityIters: u32) -> void #foreign libphysx "PxRigidDynamic_setSolverIterationCounts_mut"; + +PxRigidDynamic_getSolverIterationCounts :: (self: *PxRigidDynamic, minPositionIters: *u32, minVelocityIters: *u32) -> void #foreign libphysx; + +PxRigidDynamic_getContactReportThreshold :: (self: *PxRigidDynamic) -> float #foreign libphysx; + +PxRigidDynamic_setContactReportThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign libphysx "PxRigidDynamic_setContactReportThreshold_mut"; + +PxRigidDynamic_getConcreteTypeName :: (self: *PxRigidDynamic) -> *u8 #foreign libphysx; + +PxRigidStatic_getConcreteTypeName :: (self: *PxRigidStatic) -> *u8 #foreign libphysx; + +PxSceneQueryDesc_new :: () -> PxSceneQueryDesc #foreign libphysx; + +PxSceneQueryDesc_setToDefault :: (self: *PxSceneQueryDesc) -> void #foreign libphysx "PxSceneQueryDesc_setToDefault_mut"; + +PxSceneQueryDesc_isValid :: (self: *PxSceneQueryDesc) -> bool #foreign libphysx; + +PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint :: (self: *PxSceneQuerySystemBase, dynamicTreeRebuildRateHint: u32) -> void #foreign libphysx "PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint_mut"; + +PxSceneQuerySystemBase_getDynamicTreeRebuildRateHint :: (self: *PxSceneQuerySystemBase) -> u32 #foreign libphysx; + +PxSceneQuerySystemBase_forceRebuildDynamicTree :: (self: *PxSceneQuerySystemBase, prunerIndex: u32) -> void #foreign libphysx "PxSceneQuerySystemBase_forceRebuildDynamicTree_mut"; + +PxSceneQuerySystemBase_setUpdateMode :: (self: *PxSceneQuerySystemBase, updateMode: s32) -> void #foreign libphysx "PxSceneQuerySystemBase_setUpdateMode_mut"; + +PxSceneQuerySystemBase_getUpdateMode :: (self: *PxSceneQuerySystemBase) -> s32 #foreign libphysx; + +PxSceneQuerySystemBase_getStaticTimestamp :: (self: *PxSceneQuerySystemBase) -> u32 #foreign libphysx; + +PxSceneQuerySystemBase_flushUpdates :: (self: *PxSceneQuerySystemBase) -> void #foreign libphysx "PxSceneQuerySystemBase_flushUpdates_mut"; + +PxSceneQuerySystemBase_raycast :: (self: *PxSceneQuerySystemBase, origin: *Vector3, unitDir: *Vector3, distance: float, hitCall: *PxRaycastCallback, hitFlags: u16, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, queryFlags: u32) -> bool #foreign libphysx; + +PxSceneQuerySystemBase_sweep :: (self: *PxSceneQuerySystemBase, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, hitCall: *PxSweepCallback, hitFlags: u16, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float, queryFlags: u32) -> bool #foreign libphysx; + +PxSceneQuerySystemBase_overlap :: (self: *PxSceneQuerySystemBase, geometry: *PxGeometry, pose: *PxTransform, hitCall: *PxOverlapCallback, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, queryFlags: u32) -> bool #foreign libphysx; + +PxSceneSQSystem_setSceneQueryUpdateMode :: (self: *PxSceneSQSystem, updateMode: s32) -> void #foreign libphysx "PxSceneSQSystem_setSceneQueryUpdateMode_mut"; + +PxSceneSQSystem_getSceneQueryUpdateMode :: (self: *PxSceneSQSystem) -> s32 #foreign libphysx; + +PxSceneSQSystem_getSceneQueryStaticTimestamp :: (self: *PxSceneSQSystem) -> u32 #foreign libphysx; + +PxSceneSQSystem_flushQueryUpdates :: (self: *PxSceneSQSystem) -> void #foreign libphysx "PxSceneSQSystem_flushQueryUpdates_mut"; + +PxSceneSQSystem_forceDynamicTreeRebuild :: (self: *PxSceneSQSystem, rebuildStaticStructure: bool, rebuildDynamicStructure: bool) -> void #foreign libphysx "PxSceneSQSystem_forceDynamicTreeRebuild_mut"; + +PxSceneSQSystem_getStaticStructure :: (self: *PxSceneSQSystem) -> s32 #foreign libphysx; + +PxSceneSQSystem_getDynamicStructure :: (self: *PxSceneSQSystem) -> s32 #foreign libphysx; + +PxSceneSQSystem_sceneQueriesUpdate :: (self: *PxSceneSQSystem, completionTask: *PxBaseTask, controlSimulation: bool) -> void #foreign libphysx "PxSceneSQSystem_sceneQueriesUpdate_mut"; + +PxSceneSQSystem_checkQueries :: (self: *PxSceneSQSystem, block: bool) -> bool #foreign libphysx "PxSceneSQSystem_checkQueries_mut"; + +PxSceneSQSystem_fetchQueries :: (self: *PxSceneSQSystem, block: bool) -> bool #foreign libphysx "PxSceneSQSystem_fetchQueries_mut"; + +PxSceneQuerySystem_release :: (self: *PxSceneQuerySystem) -> void #foreign libphysx "PxSceneQuerySystem_release_mut"; + +PxSceneQuerySystem_acquireReference :: (self: *PxSceneQuerySystem) -> void #foreign libphysx "PxSceneQuerySystem_acquireReference_mut"; + +PxSceneQuerySystem_preallocate :: (self: *PxSceneQuerySystem, prunerIndex: u32, nbShapes: u32) -> void #foreign libphysx "PxSceneQuerySystem_preallocate_mut"; + +PxSceneQuerySystem_flushMemory :: (self: *PxSceneQuerySystem) -> void #foreign libphysx "PxSceneQuerySystem_flushMemory_mut"; + +PxSceneQuerySystem_addSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, bounds: *PxBounds3, transform: *PxTransform, compoundHandle: *u32, hasPruningStructure: bool) -> void #foreign libphysx "PxSceneQuerySystem_addSQShape_mut"; + +PxSceneQuerySystem_removeSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape) -> void #foreign libphysx "PxSceneQuerySystem_removeSQShape_mut"; + +PxSceneQuerySystem_updateSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, transform: *PxTransform) -> void #foreign libphysx "PxSceneQuerySystem_updateSQShape_mut"; + +PxSceneQuerySystem_addSQCompound :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shapes: **PxShape, bvh: *PxBVH, transforms: *PxTransform) -> u32 #foreign libphysx "PxSceneQuerySystem_addSQCompound_mut"; + +PxSceneQuerySystem_removeSQCompound :: (self: *PxSceneQuerySystem, compoundHandle: u32) -> void #foreign libphysx "PxSceneQuerySystem_removeSQCompound_mut"; + +PxSceneQuerySystem_updateSQCompound :: (self: *PxSceneQuerySystem, compoundHandle: u32, compoundTransform: *PxTransform) -> void #foreign libphysx "PxSceneQuerySystem_updateSQCompound_mut"; + +PxSceneQuerySystem_shiftOrigin :: (self: *PxSceneQuerySystem, shift: *Vector3) -> void #foreign libphysx "PxSceneQuerySystem_shiftOrigin_mut"; + +PxSceneQuerySystem_merge :: (self: *PxSceneQuerySystem, pruningStructure: *PxPruningStructure) -> void #foreign libphysx "PxSceneQuerySystem_merge_mut"; + +PxSceneQuerySystem_getHandle :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, prunerIndex: *u32) -> u32 #foreign libphysx; + +PxSceneQuerySystem_sync :: (self: *PxSceneQuerySystem, prunerIndex: u32, handles: *u32, indices: *u32, bounds: *PxBounds3, transforms: *PxTransformPadded, count: u32, ignoredIndices: *PxBitMap) -> void #foreign libphysx "PxSceneQuerySystem_sync_mut"; + +PxSceneQuerySystem_finalizeUpdates :: (self: *PxSceneQuerySystem) -> void #foreign libphysx "PxSceneQuerySystem_finalizeUpdates_mut"; + +PxSceneQuerySystem_prepareSceneQueryBuildStep :: (self: *PxSceneQuerySystem, prunerIndex: u32) -> *void #foreign libphysx "PxSceneQuerySystem_prepareSceneQueryBuildStep_mut"; + +PxSceneQuerySystem_sceneQueryBuildStep :: (self: *PxSceneQuerySystem, handle: *void) -> void #foreign libphysx "PxSceneQuerySystem_sceneQueryBuildStep_mut"; + +PxBroadPhaseDesc_new :: (type: s32) -> PxBroadPhaseDesc #foreign libphysx; + +PxBroadPhaseDesc_isValid :: (self: *PxBroadPhaseDesc) -> bool #foreign libphysx; + +PxGetBroadPhaseStaticFilterGroup :: () -> u32 #foreign libphysx "phys_PxGetBroadPhaseStaticFilterGroup"; + +PxGetBroadPhaseDynamicFilterGroup :: (id: u32) -> u32 #foreign libphysx "phys_PxGetBroadPhaseDynamicFilterGroup"; + +PxGetBroadPhaseKinematicFilterGroup :: (id: u32) -> u32 #foreign libphysx "phys_PxGetBroadPhaseKinematicFilterGroup"; + +PxBroadPhaseUpdateData_new :: (created: *u32, nbCreated: u32, updated: *u32, nbUpdated: u32, removed: *u32, nbRemoved: u32, bounds: *PxBounds3, groups: *u32, distances: *float, capacity: u32) -> PxBroadPhaseUpdateData #foreign libphysx; + +PxBroadPhaseResults_new :: () -> PxBroadPhaseResults #foreign libphysx; + +PxBroadPhaseRegions_getNbRegions :: (self: *PxBroadPhaseRegions) -> u32 #foreign libphysx; + +PxBroadPhaseRegions_getRegions :: (self: *PxBroadPhaseRegions, userBuffer: *PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxBroadPhaseRegions_addRegion :: (self: *PxBroadPhaseRegions, region: *PxBroadPhaseRegion, populateRegion: bool, bounds: *PxBounds3, distances: *float) -> u32 #foreign libphysx "PxBroadPhaseRegions_addRegion_mut"; + +PxBroadPhaseRegions_removeRegion :: (self: *PxBroadPhaseRegions, handle: u32) -> bool #foreign libphysx "PxBroadPhaseRegions_removeRegion_mut"; + +PxBroadPhaseRegions_getNbOutOfBoundsObjects :: (self: *PxBroadPhaseRegions) -> u32 #foreign libphysx; + +PxBroadPhaseRegions_getOutOfBoundsObjects :: (self: *PxBroadPhaseRegions) -> *u32 #foreign libphysx; + +PxBroadPhase_release :: (self: *PxBroadPhase) -> void #foreign libphysx "PxBroadPhase_release_mut"; + +PxBroadPhase_getType :: (self: *PxBroadPhase) -> s32 #foreign libphysx; + +PxBroadPhase_getCaps :: (self: *PxBroadPhase, caps: *PxBroadPhaseCaps) -> void #foreign libphysx; + +PxBroadPhase_getRegions :: (self: *PxBroadPhase) -> *PxBroadPhaseRegions #foreign libphysx "PxBroadPhase_getRegions_mut"; + +PxBroadPhase_getAllocator :: (self: *PxBroadPhase) -> *PxAllocatorCallback #foreign libphysx "PxBroadPhase_getAllocator_mut"; + +PxBroadPhase_getContextID :: (self: *PxBroadPhase) -> u64 #foreign libphysx; + +PxBroadPhase_setScratchBlock :: (self: *PxBroadPhase, scratchBlock: *void, size: u32) -> void #foreign libphysx "PxBroadPhase_setScratchBlock_mut"; + +PxBroadPhase_update :: (self: *PxBroadPhase, updateData: *PxBroadPhaseUpdateData, continuation: *PxBaseTask) -> void #foreign libphysx "PxBroadPhase_update_mut"; + +PxBroadPhase_fetchResults :: (self: *PxBroadPhase, results: *PxBroadPhaseResults) -> void #foreign libphysx "PxBroadPhase_fetchResults_mut"; + +PxBroadPhase_update_mut :: (self: *PxBroadPhase, results: *PxBroadPhaseResults, updateData: *PxBroadPhaseUpdateData) -> void #foreign libphysx "PxBroadPhase_update_mut_1"; + +PxCreateBroadPhase :: (desc: *PxBroadPhaseDesc) -> *PxBroadPhase #foreign libphysx "phys_PxCreateBroadPhase"; + +PxAABBManager_release :: (self: *PxAABBManager) -> void #foreign libphysx "PxAABBManager_release_mut"; + +PxAABBManager_getBroadPhase :: (self: *PxAABBManager) -> *PxBroadPhase #foreign libphysx "PxAABBManager_getBroadPhase_mut"; + +PxAABBManager_getBounds :: (self: *PxAABBManager) -> *PxBounds3 #foreign libphysx; + +PxAABBManager_getDistances :: (self: *PxAABBManager) -> *float #foreign libphysx; + +PxAABBManager_getGroups :: (self: *PxAABBManager) -> *u32 #foreign libphysx; + +PxAABBManager_getCapacity :: (self: *PxAABBManager) -> u32 #foreign libphysx; + +PxAABBManager_addObject :: (self: *PxAABBManager, index: u32, bounds: *PxBounds3, group: u32, distance: float) -> void #foreign libphysx "PxAABBManager_addObject_mut"; + +PxAABBManager_removeObject :: (self: *PxAABBManager, index: u32) -> void #foreign libphysx "PxAABBManager_removeObject_mut"; + +PxAABBManager_updateObject :: (self: *PxAABBManager, index: u32, bounds: *PxBounds3, distance: *float) -> void #foreign libphysx "PxAABBManager_updateObject_mut"; + +PxAABBManager_update :: (self: *PxAABBManager, continuation: *PxBaseTask) -> void #foreign libphysx "PxAABBManager_update_mut"; + +PxAABBManager_fetchResults :: (self: *PxAABBManager, results: *PxBroadPhaseResults) -> void #foreign libphysx "PxAABBManager_fetchResults_mut"; + +PxAABBManager_update_mut :: (self: *PxAABBManager, results: *PxBroadPhaseResults) -> void #foreign libphysx "PxAABBManager_update_mut_1"; + +PxCreateAABBManager :: (broadphase: *PxBroadPhase) -> *PxAABBManager #foreign libphysx "phys_PxCreateAABBManager"; + +PxSceneLimits_new :: () -> PxSceneLimits #foreign libphysx; + +PxSceneLimits_setToDefault :: (self: *PxSceneLimits) -> void #foreign libphysx "PxSceneLimits_setToDefault_mut"; + +PxSceneLimits_isValid :: (self: *PxSceneLimits) -> bool #foreign libphysx; + +PxgDynamicsMemoryConfig_new :: () -> PxgDynamicsMemoryConfig #foreign libphysx; + +PxgDynamicsMemoryConfig_isValid :: (self: *PxgDynamicsMemoryConfig) -> bool #foreign libphysx; + +PxSceneDesc_new :: (scale: *PxTolerancesScale) -> PxSceneDesc #foreign libphysx; + +PxSceneDesc_setToDefault :: (self: *PxSceneDesc, scale: *PxTolerancesScale) -> void #foreign libphysx "PxSceneDesc_setToDefault_mut"; + +PxSceneDesc_isValid :: (self: *PxSceneDesc) -> bool #foreign libphysx; + +PxSceneDesc_getTolerancesScale :: (self: *PxSceneDesc) -> *PxTolerancesScale #foreign libphysx; + +PxSimulationStatistics_getNbBroadPhaseAdds :: (self: *PxSimulationStatistics) -> u32 #foreign libphysx; + +PxSimulationStatistics_getNbBroadPhaseRemoves :: (self: *PxSimulationStatistics) -> u32 #foreign libphysx; + +PxSimulationStatistics_getRbPairStats :: (self: *PxSimulationStatistics, pairType: s32, g0: s32, g1: s32) -> u32 #foreign libphysx; + +PxSimulationStatistics_new :: () -> PxSimulationStatistics #foreign libphysx; + +PxPvdSceneClient_setScenePvdFlag :: (self: *PxPvdSceneClient, flag: s32, value: bool) -> void #foreign libphysx "PxPvdSceneClient_setScenePvdFlag_mut"; + +PxPvdSceneClient_setScenePvdFlags :: (self: *PxPvdSceneClient, flags: u8) -> void #foreign libphysx "PxPvdSceneClient_setScenePvdFlags_mut"; + +PxPvdSceneClient_getScenePvdFlags :: (self: *PxPvdSceneClient) -> u8 #foreign libphysx; + +PxPvdSceneClient_updateCamera :: (self: *PxPvdSceneClient, name: *u8, origin: *Vector3, up: *Vector3, target: *Vector3) -> void #foreign libphysx "PxPvdSceneClient_updateCamera_mut"; + +PxPvdSceneClient_drawPoints :: (self: *PxPvdSceneClient, points: *PxDebugPoint, count: u32) -> void #foreign libphysx "PxPvdSceneClient_drawPoints_mut"; + +PxPvdSceneClient_drawLines :: (self: *PxPvdSceneClient, lines: *PxDebugLine, count: u32) -> void #foreign libphysx "PxPvdSceneClient_drawLines_mut"; + +PxPvdSceneClient_drawTriangles :: (self: *PxPvdSceneClient, triangles: *PxDebugTriangle, count: u32) -> void #foreign libphysx "PxPvdSceneClient_drawTriangles_mut"; + +PxPvdSceneClient_drawText :: (self: *PxPvdSceneClient, text: *PxDebugText) -> void #foreign libphysx "PxPvdSceneClient_drawText_mut"; + +PxDominanceGroupPair_new :: (a: u8, b: u8) -> PxDominanceGroupPair #foreign libphysx; + +PxBroadPhaseCallback_delete :: (self: *PxBroadPhaseCallback) -> void #foreign libphysx; + +PxBroadPhaseCallback_onObjectOutOfBounds :: (self: *PxBroadPhaseCallback, shape: *PxShape, actor: *PxActor) -> void #foreign libphysx "PxBroadPhaseCallback_onObjectOutOfBounds_mut"; + +PxBroadPhaseCallback_onObjectOutOfBounds_mut :: (self: *PxBroadPhaseCallback, aggregate: *PxAggregate) -> void #foreign libphysx "PxBroadPhaseCallback_onObjectOutOfBounds_mut_1"; + +PxScene_release :: (self: *PxScene) -> void #foreign libphysx "PxScene_release_mut"; + +PxScene_setFlag :: (self: *PxScene, flag: s32, value: bool) -> void #foreign libphysx "PxScene_setFlag_mut"; + +PxScene_getFlags :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_setLimits :: (self: *PxScene, limits: *PxSceneLimits) -> void #foreign libphysx "PxScene_setLimits_mut"; + +PxScene_getLimits :: (self: *PxScene) -> PxSceneLimits #foreign libphysx; + +PxScene_getPhysics :: (self: *PxScene) -> *PxPhysics #foreign libphysx "PxScene_getPhysics_mut"; + +PxScene_getTimestamp :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_addArticulation :: (self: *PxScene, articulation: *PxArticulationReducedCoordinate) -> bool #foreign libphysx "PxScene_addArticulation_mut"; + +PxScene_removeArticulation :: (self: *PxScene, articulation: *PxArticulationReducedCoordinate, wakeOnLostTouch: bool) -> void #foreign libphysx "PxScene_removeArticulation_mut"; + +PxScene_addActor :: (self: *PxScene, actor: *PxActor, bvh: *PxBVH) -> bool #foreign libphysx "PxScene_addActor_mut"; + +PxScene_addActors :: (self: *PxScene, actors: **PxActor, nbActors: u32) -> bool #foreign libphysx "PxScene_addActors_mut"; + +PxScene_addActors_mut :: (self: *PxScene, pruningStructure: *PxPruningStructure) -> bool #foreign libphysx "PxScene_addActors_mut_1"; + +PxScene_removeActor :: (self: *PxScene, actor: *PxActor, wakeOnLostTouch: bool) -> void #foreign libphysx "PxScene_removeActor_mut"; + +PxScene_removeActors :: (self: *PxScene, actors: **PxActor, nbActors: u32, wakeOnLostTouch: bool) -> void #foreign libphysx "PxScene_removeActors_mut"; + +PxScene_addAggregate :: (self: *PxScene, aggregate: *PxAggregate) -> bool #foreign libphysx "PxScene_addAggregate_mut"; + +PxScene_removeAggregate :: (self: *PxScene, aggregate: *PxAggregate, wakeOnLostTouch: bool) -> void #foreign libphysx "PxScene_removeAggregate_mut"; + +PxScene_addCollection :: (self: *PxScene, collection: *PxCollection) -> bool #foreign libphysx "PxScene_addCollection_mut"; + +PxScene_getNbActors :: (self: *PxScene, types: u16) -> u32 #foreign libphysx; + +PxScene_getActors :: (self: *PxScene, types: u16, userBuffer: **PxActor, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxScene_getActiveActors :: (self: *PxScene, nbActorsOut: *u32) -> **PxActor #foreign libphysx "PxScene_getActiveActors_mut"; + +PxScene_getNbArticulations :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getArticulations :: (self: *PxScene, userBuffer: **PxArticulationReducedCoordinate, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxScene_getNbConstraints :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getConstraints :: (self: *PxScene, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxScene_getNbAggregates :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getAggregates :: (self: *PxScene, userBuffer: **PxAggregate, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxScene_setDominanceGroupPair :: (self: *PxScene, group1: u8, group2: u8, dominance: *PxDominanceGroupPair) -> void #foreign libphysx "PxScene_setDominanceGroupPair_mut"; + +PxScene_getDominanceGroupPair :: (self: *PxScene, group1: u8, group2: u8) -> PxDominanceGroupPair #foreign libphysx; + +PxScene_getCpuDispatcher :: (self: *PxScene) -> *PxCpuDispatcher #foreign libphysx; + +PxScene_createClient :: (self: *PxScene) -> u8 #foreign libphysx "PxScene_createClient_mut"; + +PxScene_setSimulationEventCallback :: (self: *PxScene, callback: *PxSimulationEventCallback) -> void #foreign libphysx "PxScene_setSimulationEventCallback_mut"; + +PxScene_getSimulationEventCallback :: (self: *PxScene) -> *PxSimulationEventCallback #foreign libphysx; + +PxScene_setContactModifyCallback :: (self: *PxScene, callback: *PxContactModifyCallback) -> void #foreign libphysx "PxScene_setContactModifyCallback_mut"; + +PxScene_setCCDContactModifyCallback :: (self: *PxScene, callback: *PxCCDContactModifyCallback) -> void #foreign libphysx "PxScene_setCCDContactModifyCallback_mut"; + +PxScene_getContactModifyCallback :: (self: *PxScene) -> *PxContactModifyCallback #foreign libphysx; + +PxScene_getCCDContactModifyCallback :: (self: *PxScene) -> *PxCCDContactModifyCallback #foreign libphysx; + +PxScene_setBroadPhaseCallback :: (self: *PxScene, callback: *PxBroadPhaseCallback) -> void #foreign libphysx "PxScene_setBroadPhaseCallback_mut"; + +PxScene_getBroadPhaseCallback :: (self: *PxScene) -> *PxBroadPhaseCallback #foreign libphysx; + +PxScene_setFilterShaderData :: (self: *PxScene, data: *void, dataSize: u32) -> void #foreign libphysx "PxScene_setFilterShaderData_mut"; + +PxScene_getFilterShaderData :: (self: *PxScene) -> *void #foreign libphysx; + +PxScene_getFilterShaderDataSize :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_resetFiltering :: (self: *PxScene, actor: *PxActor) -> bool #foreign libphysx "PxScene_resetFiltering_mut"; + +PxScene_resetFiltering_mut :: (self: *PxScene, actor: *PxRigidActor, shapes: **PxShape, shapeCount: u32) -> bool #foreign libphysx "PxScene_resetFiltering_mut_1"; + +PxScene_getKinematicKinematicFilteringMode :: (self: *PxScene) -> s32 #foreign libphysx; + +PxScene_getStaticKinematicFilteringMode :: (self: *PxScene) -> s32 #foreign libphysx; + +PxScene_simulate :: (self: *PxScene, elapsedTime: float, completionTask: *PxBaseTask, scratchMemBlock: *void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool #foreign libphysx "PxScene_simulate_mut"; + +PxScene_advance :: (self: *PxScene, completionTask: *PxBaseTask) -> bool #foreign libphysx "PxScene_advance_mut"; + +PxScene_collide :: (self: *PxScene, elapsedTime: float, completionTask: *PxBaseTask, scratchMemBlock: *void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool #foreign libphysx "PxScene_collide_mut"; + +PxScene_checkResults :: (self: *PxScene, block: bool) -> bool #foreign libphysx "PxScene_checkResults_mut"; + +PxScene_fetchCollision :: (self: *PxScene, block: bool) -> bool #foreign libphysx "PxScene_fetchCollision_mut"; + +PxScene_fetchResults :: (self: *PxScene, block: bool, errorState: *u32) -> bool #foreign libphysx "PxScene_fetchResults_mut"; + +PxScene_fetchResultsStart :: (self: *PxScene, contactPairs: **PxContactPairHeader, nbContactPairs: *u32, block: bool) -> bool #foreign libphysx "PxScene_fetchResultsStart_mut"; + +PxScene_processCallbacks :: (self: *PxScene, continuation: *PxBaseTask) -> void #foreign libphysx "PxScene_processCallbacks_mut"; + +PxScene_fetchResultsFinish :: (self: *PxScene, errorState: *u32) -> void #foreign libphysx "PxScene_fetchResultsFinish_mut"; + +PxScene_fetchResultsParticleSystem :: (self: *PxScene) -> void #foreign libphysx "PxScene_fetchResultsParticleSystem_mut"; + +PxScene_flushSimulation :: (self: *PxScene, sendPendingReports: bool) -> void #foreign libphysx "PxScene_flushSimulation_mut"; + +PxScene_setGravity :: (self: *PxScene, vec: *Vector3) -> void #foreign libphysx "PxScene_setGravity_mut"; + +PxScene_getGravity :: (self: *PxScene) -> Vector3 #foreign libphysx; + +PxScene_setBounceThresholdVelocity :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setBounceThresholdVelocity_mut"; + +PxScene_getBounceThresholdVelocity :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_setCCDMaxPasses :: (self: *PxScene, ccdMaxPasses: u32) -> void #foreign libphysx "PxScene_setCCDMaxPasses_mut"; + +PxScene_getCCDMaxPasses :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_setCCDMaxSeparation :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setCCDMaxSeparation_mut"; + +PxScene_getCCDMaxSeparation :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_setCCDThreshold :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setCCDThreshold_mut"; + +PxScene_getCCDThreshold :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_setMaxBiasCoefficient :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setMaxBiasCoefficient_mut"; + +PxScene_getMaxBiasCoefficient :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_setFrictionOffsetThreshold :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setFrictionOffsetThreshold_mut"; + +PxScene_getFrictionOffsetThreshold :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_setFrictionCorrelationDistance :: (self: *PxScene, t: float) -> void #foreign libphysx "PxScene_setFrictionCorrelationDistance_mut"; + +PxScene_getFrictionCorrelationDistance :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_getFrictionType :: (self: *PxScene) -> s32 #foreign libphysx; + +PxScene_getSolverType :: (self: *PxScene) -> s32 #foreign libphysx; + +PxScene_setVisualizationParameter :: (self: *PxScene, param: s32, value: float) -> bool #foreign libphysx "PxScene_setVisualizationParameter_mut"; + +PxScene_getVisualizationParameter :: (self: *PxScene, paramEnum: s32) -> float #foreign libphysx; + +PxScene_setVisualizationCullingBox :: (self: *PxScene, box: *PxBounds3) -> void #foreign libphysx "PxScene_setVisualizationCullingBox_mut"; + +PxScene_getVisualizationCullingBox :: (self: *PxScene) -> PxBounds3 #foreign libphysx; + +PxScene_getRenderBuffer :: (self: *PxScene) -> *PxRenderBuffer #foreign libphysx "PxScene_getRenderBuffer_mut"; + +PxScene_getSimulationStatistics :: (self: *PxScene, stats: *PxSimulationStatistics) -> void #foreign libphysx; + +PxScene_getBroadPhaseType :: (self: *PxScene) -> s32 #foreign libphysx; + +PxScene_getBroadPhaseCaps :: (self: *PxScene, caps: *PxBroadPhaseCaps) -> bool #foreign libphysx; + +PxScene_getNbBroadPhaseRegions :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getBroadPhaseRegions :: (self: *PxScene, userBuffer: *PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxScene_addBroadPhaseRegion :: (self: *PxScene, region: *PxBroadPhaseRegion, populateRegion: bool) -> u32 #foreign libphysx "PxScene_addBroadPhaseRegion_mut"; + +PxScene_removeBroadPhaseRegion :: (self: *PxScene, handle: u32) -> bool #foreign libphysx "PxScene_removeBroadPhaseRegion_mut"; + +PxScene_getTaskManager :: (self: *PxScene) -> *PxTaskManager #foreign libphysx; + +PxScene_lockRead :: (self: *PxScene, file: *u8, line: u32) -> void #foreign libphysx "PxScene_lockRead_mut"; + +PxScene_unlockRead :: (self: *PxScene) -> void #foreign libphysx "PxScene_unlockRead_mut"; + +PxScene_lockWrite :: (self: *PxScene, file: *u8, line: u32) -> void #foreign libphysx "PxScene_lockWrite_mut"; + +PxScene_unlockWrite :: (self: *PxScene) -> void #foreign libphysx "PxScene_unlockWrite_mut"; + +PxScene_setNbContactDataBlocks :: (self: *PxScene, numBlocks: u32) -> void #foreign libphysx "PxScene_setNbContactDataBlocks_mut"; + +PxScene_getNbContactDataBlocksUsed :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getMaxNbContactDataBlocksUsed :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getContactReportStreamBufferSize :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_setSolverBatchSize :: (self: *PxScene, solverBatchSize: u32) -> void #foreign libphysx "PxScene_setSolverBatchSize_mut"; + +PxScene_getSolverBatchSize :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_setSolverArticulationBatchSize :: (self: *PxScene, solverBatchSize: u32) -> void #foreign libphysx "PxScene_setSolverArticulationBatchSize_mut"; + +PxScene_getSolverArticulationBatchSize :: (self: *PxScene) -> u32 #foreign libphysx; + +PxScene_getWakeCounterResetValue :: (self: *PxScene) -> float #foreign libphysx; + +PxScene_shiftOrigin :: (self: *PxScene, shift: *Vector3) -> void #foreign libphysx "PxScene_shiftOrigin_mut"; + +PxScene_getScenePvdClient :: (self: *PxScene) -> *PxPvdSceneClient #foreign libphysx "PxScene_getScenePvdClient_mut"; + +PxScene_copyArticulationData :: (self: *PxScene, data: *void, index: *void, dataType: s32, nbCopyArticulations: u32, copyEvent: *void) -> void #foreign libphysx "PxScene_copyArticulationData_mut"; + +PxScene_applyArticulationData :: (self: *PxScene, data: *void, index: *void, dataType: s32, nbUpdatedArticulations: u32, waitEvent: *void, signalEvent: *void) -> void #foreign libphysx "PxScene_applyArticulationData_mut"; + +PxScene_copySoftBodyData :: (self: *PxScene, data: **void, dataSizes: *void, softBodyIndices: *void, flag: s32, nbCopySoftBodies: u32, maxSize: u32, copyEvent: *void) -> void #foreign libphysx "PxScene_copySoftBodyData_mut"; + +PxScene_applySoftBodyData :: (self: *PxScene, data: **void, dataSizes: *void, softBodyIndices: *void, flag: s32, nbUpdatedSoftBodies: u32, maxSize: u32, applyEvent: *void) -> void #foreign libphysx "PxScene_applySoftBodyData_mut"; + +PxScene_copyContactData :: (self: *PxScene, data: *void, maxContactPairs: u32, numContactPairs: *void, copyEvent: *void) -> void #foreign libphysx "PxScene_copyContactData_mut"; + +PxScene_copyBodyData :: (self: *PxScene, data: *PxGpuBodyData, index: *PxGpuActorPair, nbCopyActors: u32, copyEvent: *void) -> void #foreign libphysx "PxScene_copyBodyData_mut"; + +PxScene_applyActorData :: (self: *PxScene, data: *void, index: *PxGpuActorPair, flag: s32, nbUpdatedActors: u32, waitEvent: *void, signalEvent: *void) -> void #foreign libphysx "PxScene_applyActorData_mut"; + +PxScene_computeDenseJacobians :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign libphysx "PxScene_computeDenseJacobians_mut"; + +PxScene_computeGeneralizedMassMatrices :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign libphysx "PxScene_computeGeneralizedMassMatrices_mut"; + +PxScene_computeGeneralizedGravityForces :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign libphysx "PxScene_computeGeneralizedGravityForces_mut"; + +PxScene_computeCoriolisAndCentrifugalForces :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign libphysx "PxScene_computeCoriolisAndCentrifugalForces_mut"; + +PxScene_getGpuDynamicsConfig :: (self: *PxScene) -> PxgDynamicsMemoryConfig #foreign libphysx; + +PxScene_applyParticleBufferData :: (self: *PxScene, indices: *u32, bufferIndexPair: *PxGpuParticleBufferIndexPair, flags: *u32, nbUpdatedBuffers: u32, waitEvent: *void, signalEvent: *void) -> void #foreign libphysx "PxScene_applyParticleBufferData_mut"; + +PxSceneReadLock_new_alloc :: (scene: *PxScene, file: *u8, line: u32) -> *PxSceneReadLock #foreign libphysx; + +PxSceneReadLock_delete :: (self: *PxSceneReadLock) -> void #foreign libphysx; + +PxSceneWriteLock_new_alloc :: (scene: *PxScene, file: *u8, line: u32) -> *PxSceneWriteLock #foreign libphysx; + +PxSceneWriteLock_delete :: (self: *PxSceneWriteLock) -> void #foreign libphysx; + +PxContactPairExtraDataItem_new :: () -> PxContactPairExtraDataItem #foreign libphysx; + +PxContactPairVelocity_new :: () -> PxContactPairVelocity #foreign libphysx; + +PxContactPairPose_new :: () -> PxContactPairPose #foreign libphysx; + +PxContactPairIndex_new :: () -> PxContactPairIndex #foreign libphysx; + +PxContactPairExtraDataIterator_new :: (stream: *u8, size: u32) -> PxContactPairExtraDataIterator #foreign libphysx; + +PxContactPairExtraDataIterator_nextItemSet :: (self: *PxContactPairExtraDataIterator) -> bool #foreign libphysx "PxContactPairExtraDataIterator_nextItemSet_mut"; + +PxContactPairHeader_new :: () -> PxContactPairHeader #foreign libphysx; + +PxContactPair_new :: () -> PxContactPair #foreign libphysx; + +PxContactPair_extractContacts :: (self: *PxContactPair, userBuffer: *PxContactPairPoint, bufferSize: u32) -> u32 #foreign libphysx; + +PxContactPair_bufferContacts :: (self: *PxContactPair, newPair: *PxContactPair, bufferMemory: *u8) -> void #foreign libphysx; + +PxContactPair_getInternalFaceIndices :: (self: *PxContactPair) -> *u32 #foreign libphysx; + +PxTriggerPair_new :: () -> PxTriggerPair #foreign libphysx; + +PxConstraintInfo_new :: () -> PxConstraintInfo #foreign libphysx; + +PxConstraintInfo_new :: (c: *PxConstraint, extRef: *void, t: u32) -> PxConstraintInfo #foreign libphysx "PxConstraintInfo_new_1"; + +PxSimulationEventCallback_onConstraintBreak :: (self: *PxSimulationEventCallback, constraints: *PxConstraintInfo, count: u32) -> void #foreign libphysx "PxSimulationEventCallback_onConstraintBreak_mut"; + +PxSimulationEventCallback_onWake :: (self: *PxSimulationEventCallback, actors: **PxActor, count: u32) -> void #foreign libphysx "PxSimulationEventCallback_onWake_mut"; + +PxSimulationEventCallback_onSleep :: (self: *PxSimulationEventCallback, actors: **PxActor, count: u32) -> void #foreign libphysx "PxSimulationEventCallback_onSleep_mut"; + +PxSimulationEventCallback_onContact :: (self: *PxSimulationEventCallback, pairHeader: *PxContactPairHeader, pairs: *PxContactPair, nbPairs: u32) -> void #foreign libphysx "PxSimulationEventCallback_onContact_mut"; + +PxSimulationEventCallback_onTrigger :: (self: *PxSimulationEventCallback, pairs: *PxTriggerPair, count: u32) -> void #foreign libphysx "PxSimulationEventCallback_onTrigger_mut"; + +PxSimulationEventCallback_onAdvance :: (self: *PxSimulationEventCallback, bodyBuffer: **PxRigidBody, poseBuffer: *PxTransform, count: u32) -> void #foreign libphysx "PxSimulationEventCallback_onAdvance_mut"; + +PxSimulationEventCallback_delete :: (self: *PxSimulationEventCallback) -> void #foreign libphysx; + +PxFEMParameters_new :: () -> PxFEMParameters #foreign libphysx; + +PxPruningStructure_release :: (self: *PxPruningStructure) -> void #foreign libphysx "PxPruningStructure_release_mut"; + +PxPruningStructure_getRigidActors :: (self: *PxPruningStructure, userBuffer: **PxRigidActor, bufferSize: u32, startIndex: u32) -> u32 #foreign libphysx; + +PxPruningStructure_getNbRigidActors :: (self: *PxPruningStructure) -> u32 #foreign libphysx; + +PxPruningStructure_getStaticMergeData :: (self: *PxPruningStructure) -> *void #foreign libphysx; + +PxPruningStructure_getDynamicMergeData :: (self: *PxPruningStructure) -> *void #foreign libphysx; + +PxPruningStructure_getConcreteTypeName :: (self: *PxPruningStructure) -> *u8 #foreign libphysx; + +PxExtendedVec3_new :: () -> PxExtendedVec3 #foreign libphysx; + +PxExtendedVec3_new :: (_x: float64, _y: float64, _z: float64) -> PxExtendedVec3 #foreign libphysx "PxExtendedVec3_new_1"; + +PxExtendedVec3_isZero :: (self: *PxExtendedVec3) -> bool #foreign libphysx; + +PxExtendedVec3_dot :: (self: *PxExtendedVec3, v: *Vector3) -> float64 #foreign libphysx; + +PxExtendedVec3_distanceSquared :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> float64 #foreign libphysx; + +PxExtendedVec3_magnitudeSquared :: (self: *PxExtendedVec3) -> float64 #foreign libphysx; + +PxExtendedVec3_magnitude :: (self: *PxExtendedVec3) -> float64 #foreign libphysx; + +PxExtendedVec3_normalize :: (self: *PxExtendedVec3) -> float64 #foreign libphysx "PxExtendedVec3_normalize_mut"; + +PxExtendedVec3_isFinite :: (self: *PxExtendedVec3) -> bool #foreign libphysx; + +PxExtendedVec3_maximum :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_maximum_mut"; + +PxExtendedVec3_minimum :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_minimum_mut"; + +PxExtendedVec3_set :: (self: *PxExtendedVec3, x_: float64, y_: float64, z_: float64) -> void #foreign libphysx "PxExtendedVec3_set_mut"; + +PxExtendedVec3_setPlusInfinity :: (self: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_setPlusInfinity_mut"; + +PxExtendedVec3_setMinusInfinity :: (self: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_setMinusInfinity_mut"; + +PxExtendedVec3_cross :: (self: *PxExtendedVec3, left: *PxExtendedVec3, right: *Vector3) -> void #foreign libphysx "PxExtendedVec3_cross_mut"; + +PxExtendedVec3_cross_mut :: (self: *PxExtendedVec3, left: *PxExtendedVec3, right: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_cross_mut_1"; + +PxExtendedVec3_cross :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> PxExtendedVec3 #foreign libphysx; + +PxExtendedVec3_cross_mut :: (self: *PxExtendedVec3, left: *Vector3, right: *PxExtendedVec3) -> void #foreign libphysx "PxExtendedVec3_cross_mut_2"; + +toVec3 :: (v: *PxExtendedVec3) -> Vector3 #foreign libphysx "phys_toVec3"; + +PxObstacle_getType :: (self: *PxObstacle) -> s32 #foreign libphysx; + +PxBoxObstacle_new :: () -> PxBoxObstacle #foreign libphysx; + +PxCapsuleObstacle_new :: () -> PxCapsuleObstacle #foreign libphysx; + +PxObstacleContext_release :: (self: *PxObstacleContext) -> void #foreign libphysx "PxObstacleContext_release_mut"; + +PxObstacleContext_getControllerManager :: (self: *PxObstacleContext) -> *PxControllerManager #foreign libphysx; + +PxObstacleContext_addObstacle :: (self: *PxObstacleContext, obstacle: *PxObstacle) -> u32 #foreign libphysx "PxObstacleContext_addObstacle_mut"; + +PxObstacleContext_removeObstacle :: (self: *PxObstacleContext, handle: u32) -> bool #foreign libphysx "PxObstacleContext_removeObstacle_mut"; + +PxObstacleContext_updateObstacle :: (self: *PxObstacleContext, handle: u32, obstacle: *PxObstacle) -> bool #foreign libphysx "PxObstacleContext_updateObstacle_mut"; + +PxObstacleContext_getNbObstacles :: (self: *PxObstacleContext) -> u32 #foreign libphysx; + +PxObstacleContext_getObstacle :: (self: *PxObstacleContext, i: u32) -> *PxObstacle #foreign libphysx; + +PxObstacleContext_getObstacleByHandle :: (self: *PxObstacleContext, handle: u32) -> *PxObstacle #foreign libphysx; + +PxUserControllerHitReport_onShapeHit :: (self: *PxUserControllerHitReport, hit: *PxControllerShapeHit) -> void #foreign libphysx "PxUserControllerHitReport_onShapeHit_mut"; + +PxUserControllerHitReport_onControllerHit :: (self: *PxUserControllerHitReport, hit: *PxControllersHit) -> void #foreign libphysx "PxUserControllerHitReport_onControllerHit_mut"; + +PxUserControllerHitReport_onObstacleHit :: (self: *PxUserControllerHitReport, hit: *PxControllerObstacleHit) -> void #foreign libphysx "PxUserControllerHitReport_onObstacleHit_mut"; + +PxControllerFilterCallback_delete :: (self: *PxControllerFilterCallback) -> void #foreign libphysx; + +PxControllerFilterCallback_filter :: (self: *PxControllerFilterCallback, a: *PxController, b: *PxController) -> bool #foreign libphysx "PxControllerFilterCallback_filter_mut"; + +PxControllerFilters_new :: (filterData: *PxFilterData, cb: *PxQueryFilterCallback, cctFilterCb: *PxControllerFilterCallback) -> PxControllerFilters #foreign libphysx; + +PxControllerDesc_isValid :: (self: *PxControllerDesc) -> bool #foreign libphysx; + +PxControllerDesc_getType :: (self: *PxControllerDesc) -> s32 #foreign libphysx; + +PxController_getType :: (self: *PxController) -> s32 #foreign libphysx; + +PxController_release :: (self: *PxController) -> void #foreign libphysx "PxController_release_mut"; + +PxController_move :: (self: *PxController, disp: *Vector3, minDist: float, elapsedTime: float, filters: *PxControllerFilters, obstacles: *PxObstacleContext) -> u8 #foreign libphysx "PxController_move_mut"; + +PxController_setPosition :: (self: *PxController, position: *PxExtendedVec3) -> bool #foreign libphysx "PxController_setPosition_mut"; + +PxController_getPosition :: (self: *PxController) -> *PxExtendedVec3 #foreign libphysx; + +PxController_setFootPosition :: (self: *PxController, position: *PxExtendedVec3) -> bool #foreign libphysx "PxController_setFootPosition_mut"; + +PxController_getFootPosition :: (self: *PxController) -> PxExtendedVec3 #foreign libphysx; + +PxController_getActor :: (self: *PxController) -> *PxRigidDynamic #foreign libphysx; + +PxController_setStepOffset :: (self: *PxController, offset: float) -> void #foreign libphysx "PxController_setStepOffset_mut"; + +PxController_getStepOffset :: (self: *PxController) -> float #foreign libphysx; + +PxController_setNonWalkableMode :: (self: *PxController, flag: s32) -> void #foreign libphysx "PxController_setNonWalkableMode_mut"; + +PxController_getNonWalkableMode :: (self: *PxController) -> s32 #foreign libphysx; + +PxController_getContactOffset :: (self: *PxController) -> float #foreign libphysx; + +PxController_setContactOffset :: (self: *PxController, offset: float) -> void #foreign libphysx "PxController_setContactOffset_mut"; + +PxController_getUpDirection :: (self: *PxController) -> Vector3 #foreign libphysx; + +PxController_setUpDirection :: (self: *PxController, up: *Vector3) -> void #foreign libphysx "PxController_setUpDirection_mut"; + +PxController_getSlopeLimit :: (self: *PxController) -> float #foreign libphysx; + +PxController_setSlopeLimit :: (self: *PxController, slopeLimit: float) -> void #foreign libphysx "PxController_setSlopeLimit_mut"; + +PxController_invalidateCache :: (self: *PxController) -> void #foreign libphysx "PxController_invalidateCache_mut"; + +PxController_getScene :: (self: *PxController) -> *PxScene #foreign libphysx "PxController_getScene_mut"; + +PxController_getUserData :: (self: *PxController) -> *void #foreign libphysx; + +PxController_setUserData :: (self: *PxController, userData: *void) -> void #foreign libphysx "PxController_setUserData_mut"; + +PxController_getState :: (self: *PxController, state: *PxControllerState) -> void #foreign libphysx; + +PxController_getStats :: (self: *PxController, stats: *PxControllerStats) -> void #foreign libphysx; + +PxController_resize :: (self: *PxController, height: float) -> void #foreign libphysx "PxController_resize_mut"; + +PxBoxControllerDesc_new_alloc :: () -> *PxBoxControllerDesc #foreign libphysx; + +PxBoxControllerDesc_delete :: (self: *PxBoxControllerDesc) -> void #foreign libphysx; + +PxBoxControllerDesc_setToDefault :: (self: *PxBoxControllerDesc) -> void #foreign libphysx "PxBoxControllerDesc_setToDefault_mut"; + +PxBoxControllerDesc_isValid :: (self: *PxBoxControllerDesc) -> bool #foreign libphysx; + +PxBoxController_getHalfHeight :: (self: *PxBoxController) -> float #foreign libphysx; + +PxBoxController_getHalfSideExtent :: (self: *PxBoxController) -> float #foreign libphysx; + +PxBoxController_getHalfForwardExtent :: (self: *PxBoxController) -> float #foreign libphysx; + +PxBoxController_setHalfHeight :: (self: *PxBoxController, halfHeight: float) -> bool #foreign libphysx "PxBoxController_setHalfHeight_mut"; + +PxBoxController_setHalfSideExtent :: (self: *PxBoxController, halfSideExtent: float) -> bool #foreign libphysx "PxBoxController_setHalfSideExtent_mut"; + +PxBoxController_setHalfForwardExtent :: (self: *PxBoxController, halfForwardExtent: float) -> bool #foreign libphysx "PxBoxController_setHalfForwardExtent_mut"; + +PxCapsuleControllerDesc_new_alloc :: () -> *PxCapsuleControllerDesc #foreign libphysx; + +PxCapsuleControllerDesc_delete :: (self: *PxCapsuleControllerDesc) -> void #foreign libphysx; + +PxCapsuleControllerDesc_setToDefault :: (self: *PxCapsuleControllerDesc) -> void #foreign libphysx "PxCapsuleControllerDesc_setToDefault_mut"; + +PxCapsuleControllerDesc_isValid :: (self: *PxCapsuleControllerDesc) -> bool #foreign libphysx; + +PxCapsuleController_getRadius :: (self: *PxCapsuleController) -> float #foreign libphysx; + +PxCapsuleController_setRadius :: (self: *PxCapsuleController, radius: float) -> bool #foreign libphysx "PxCapsuleController_setRadius_mut"; + +PxCapsuleController_getHeight :: (self: *PxCapsuleController) -> float #foreign libphysx; + +PxCapsuleController_setHeight :: (self: *PxCapsuleController, height: float) -> bool #foreign libphysx "PxCapsuleController_setHeight_mut"; + +PxCapsuleController_getClimbingMode :: (self: *PxCapsuleController) -> s32 #foreign libphysx; + +PxCapsuleController_setClimbingMode :: (self: *PxCapsuleController, mode: s32) -> bool #foreign libphysx "PxCapsuleController_setClimbingMode_mut"; + +PxControllerBehaviorCallback_getBehaviorFlags :: (self: *PxControllerBehaviorCallback, shape: *PxShape, actor: *PxActor) -> u8 #foreign libphysx "PxControllerBehaviorCallback_getBehaviorFlags_mut"; + +PxControllerBehaviorCallback_getBehaviorFlags_mut :: (self: *PxControllerBehaviorCallback, controller: *PxController) -> u8 #foreign libphysx "PxControllerBehaviorCallback_getBehaviorFlags_mut_1"; + +PxControllerBehaviorCallback_getBehaviorFlags_mut :: (self: *PxControllerBehaviorCallback, obstacle: *PxObstacle) -> u8 #foreign libphysx "PxControllerBehaviorCallback_getBehaviorFlags_mut_2"; + +PxControllerManager_release :: (self: *PxControllerManager) -> void #foreign libphysx "PxControllerManager_release_mut"; + +PxControllerManager_getScene :: (self: *PxControllerManager) -> *PxScene #foreign libphysx; + +PxControllerManager_getNbControllers :: (self: *PxControllerManager) -> u32 #foreign libphysx; + +PxControllerManager_getController :: (self: *PxControllerManager, index: u32) -> *PxController #foreign libphysx "PxControllerManager_getController_mut"; + +PxControllerManager_createController :: (self: *PxControllerManager, desc: *PxControllerDesc) -> *PxController #foreign libphysx "PxControllerManager_createController_mut"; + +PxControllerManager_purgeControllers :: (self: *PxControllerManager) -> void #foreign libphysx "PxControllerManager_purgeControllers_mut"; + +PxControllerManager_getRenderBuffer :: (self: *PxControllerManager) -> *PxRenderBuffer #foreign libphysx "PxControllerManager_getRenderBuffer_mut"; + +PxControllerManager_setDebugRenderingFlags :: (self: *PxControllerManager, flags: u32) -> void #foreign libphysx "PxControllerManager_setDebugRenderingFlags_mut"; + +PxControllerManager_getNbObstacleContexts :: (self: *PxControllerManager) -> u32 #foreign libphysx; + +PxControllerManager_getObstacleContext :: (self: *PxControllerManager, index: u32) -> *PxObstacleContext #foreign libphysx "PxControllerManager_getObstacleContext_mut"; + +PxControllerManager_createObstacleContext :: (self: *PxControllerManager) -> *PxObstacleContext #foreign libphysx "PxControllerManager_createObstacleContext_mut"; + +PxControllerManager_computeInteractions :: (self: *PxControllerManager, elapsedTime: float, cctFilterCb: *PxControllerFilterCallback) -> void #foreign libphysx "PxControllerManager_computeInteractions_mut"; + +PxControllerManager_setTessellation :: (self: *PxControllerManager, flag: bool, maxEdgeLength: float) -> void #foreign libphysx "PxControllerManager_setTessellation_mut"; + +PxControllerManager_setOverlapRecoveryModule :: (self: *PxControllerManager, flag: bool) -> void #foreign libphysx "PxControllerManager_setOverlapRecoveryModule_mut"; + +PxControllerManager_setPreciseSweeps :: (self: *PxControllerManager, flag: bool) -> void #foreign libphysx "PxControllerManager_setPreciseSweeps_mut"; + +PxControllerManager_setPreventVerticalSlidingAgainstCeiling :: (self: *PxControllerManager, flag: bool) -> void #foreign libphysx "PxControllerManager_setPreventVerticalSlidingAgainstCeiling_mut"; + +PxControllerManager_shiftOrigin :: (self: *PxControllerManager, shift: *Vector3) -> void #foreign libphysx "PxControllerManager_shiftOrigin_mut"; + +PxCreateControllerManager :: (scene: *PxScene, lockingEnabled: bool) -> *PxControllerManager #foreign libphysx "phys_PxCreateControllerManager"; + +PxDim3_new :: () -> PxDim3 #foreign libphysx; + +PxSDFDesc_new :: () -> PxSDFDesc #foreign libphysx; + +PxSDFDesc_isValid :: (self: *PxSDFDesc) -> bool #foreign libphysx; + +PxConvexMeshDesc_new :: () -> PxConvexMeshDesc #foreign libphysx; + +PxConvexMeshDesc_setToDefault :: (self: *PxConvexMeshDesc) -> void #foreign libphysx "PxConvexMeshDesc_setToDefault_mut"; + +PxConvexMeshDesc_isValid :: (self: *PxConvexMeshDesc) -> bool #foreign libphysx; + +PxTriangleMeshDesc_new :: () -> PxTriangleMeshDesc #foreign libphysx; + +PxTriangleMeshDesc_setToDefault :: (self: *PxTriangleMeshDesc) -> void #foreign libphysx "PxTriangleMeshDesc_setToDefault_mut"; + +PxTriangleMeshDesc_isValid :: (self: *PxTriangleMeshDesc) -> bool #foreign libphysx; + +PxTetrahedronMeshDesc_new :: () -> PxTetrahedronMeshDesc #foreign libphysx; + +PxTetrahedronMeshDesc_isValid :: (self: *PxTetrahedronMeshDesc) -> bool #foreign libphysx; + +PxSoftBodySimulationDataDesc_new :: () -> PxSoftBodySimulationDataDesc #foreign libphysx; + +PxSoftBodySimulationDataDesc_isValid :: (self: *PxSoftBodySimulationDataDesc) -> bool #foreign libphysx; + +PxBVH34MidphaseDesc_setToDefault :: (self: *PxBVH34MidphaseDesc) -> void #foreign libphysx "PxBVH34MidphaseDesc_setToDefault_mut"; + +PxBVH34MidphaseDesc_isValid :: (self: *PxBVH34MidphaseDesc) -> bool #foreign libphysx; + +PxMidphaseDesc_new :: () -> PxMidphaseDesc #foreign libphysx; + +PxMidphaseDesc_getType :: (self: *PxMidphaseDesc) -> s32 #foreign libphysx; + +PxMidphaseDesc_setToDefault :: (self: *PxMidphaseDesc, type: s32) -> void #foreign libphysx "PxMidphaseDesc_setToDefault_mut"; + +PxMidphaseDesc_isValid :: (self: *PxMidphaseDesc) -> bool #foreign libphysx; + +PxBVHDesc_new :: () -> PxBVHDesc #foreign libphysx; + +PxBVHDesc_setToDefault :: (self: *PxBVHDesc) -> void #foreign libphysx "PxBVHDesc_setToDefault_mut"; + +PxBVHDesc_isValid :: (self: *PxBVHDesc) -> bool #foreign libphysx; + +PxCookingParams_new :: (sc: *PxTolerancesScale) -> PxCookingParams #foreign libphysx; + +PxGetStandaloneInsertionCallback :: () -> *PxInsertionCallback #foreign libphysx "phys_PxGetStandaloneInsertionCallback"; + +PxCookBVH :: (desc: *PxBVHDesc, stream: *PxOutputStream) -> bool #foreign libphysx "phys_PxCookBVH"; + +PxCreateBVH :: (desc: *PxBVHDesc, insertionCallback: *PxInsertionCallback) -> *PxBVH #foreign libphysx "phys_PxCreateBVH"; + +PxCookHeightField :: (desc: *PxHeightFieldDesc, stream: *PxOutputStream) -> bool #foreign libphysx "phys_PxCookHeightField"; + +PxCreateHeightField :: (desc: *PxHeightFieldDesc, insertionCallback: *PxInsertionCallback) -> *PxHeightField #foreign libphysx "phys_PxCreateHeightField"; + +PxCookConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc, stream: *PxOutputStream, condition: *s32) -> bool #foreign libphysx "phys_PxCookConvexMesh"; + +PxCreateConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc, insertionCallback: *PxInsertionCallback, condition: *s32) -> *PxConvexMesh #foreign libphysx "phys_PxCreateConvexMesh"; + +PxValidateConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc) -> bool #foreign libphysx "phys_PxValidateConvexMesh"; + +PxComputeHullPolygons :: (params: *PxCookingParams, mesh: *PxSimpleTriangleMesh, inCallback: *PxAllocatorCallback, nbVerts: *u32, vertices: **Vector3, nbIndices: *u32, indices: **u32, nbPolygons: *u32, hullPolygons: **PxHullPolygon) -> bool #foreign libphysx "phys_PxComputeHullPolygons"; + +PxValidateTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc) -> bool #foreign libphysx "phys_PxValidateTriangleMesh"; + +PxCreateTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc, insertionCallback: *PxInsertionCallback, condition: *s32) -> *PxTriangleMesh #foreign libphysx "phys_PxCreateTriangleMesh"; + +PxCookTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc, stream: *PxOutputStream, condition: *s32) -> bool #foreign libphysx "phys_PxCookTriangleMesh"; + +PxDefaultMemoryOutputStream_new_alloc :: (allocator: *PxAllocatorCallback) -> *PxDefaultMemoryOutputStream #foreign libphysx; + +PxDefaultMemoryOutputStream_delete :: (self: *PxDefaultMemoryOutputStream) -> void #foreign libphysx; + +PxDefaultMemoryOutputStream_write :: (self: *PxDefaultMemoryOutputStream, src: *void, count: u32) -> u32 #foreign libphysx "PxDefaultMemoryOutputStream_write_mut"; + +PxDefaultMemoryOutputStream_getSize :: (self: *PxDefaultMemoryOutputStream) -> u32 #foreign libphysx; + +PxDefaultMemoryOutputStream_getData :: (self: *PxDefaultMemoryOutputStream) -> *u8 #foreign libphysx; + +PxDefaultMemoryInputData_new_alloc :: (data: *u8, length: u32) -> *PxDefaultMemoryInputData #foreign libphysx; + +PxDefaultMemoryInputData_read :: (self: *PxDefaultMemoryInputData, dest: *void, count: u32) -> u32 #foreign libphysx "PxDefaultMemoryInputData_read_mut"; + +PxDefaultMemoryInputData_getLength :: (self: *PxDefaultMemoryInputData) -> u32 #foreign libphysx; + +PxDefaultMemoryInputData_seek :: (self: *PxDefaultMemoryInputData, pos: u32) -> void #foreign libphysx "PxDefaultMemoryInputData_seek_mut"; + +PxDefaultMemoryInputData_tell :: (self: *PxDefaultMemoryInputData) -> u32 #foreign libphysx; + +PxDefaultFileOutputStream_new_alloc :: (name: *u8) -> *PxDefaultFileOutputStream #foreign libphysx; + +PxDefaultFileOutputStream_delete :: (self: *PxDefaultFileOutputStream) -> void #foreign libphysx; + +PxDefaultFileOutputStream_write :: (self: *PxDefaultFileOutputStream, src: *void, count: u32) -> u32 #foreign libphysx "PxDefaultFileOutputStream_write_mut"; + +PxDefaultFileOutputStream_isValid :: (self: *PxDefaultFileOutputStream) -> bool #foreign libphysx "PxDefaultFileOutputStream_isValid_mut"; + +PxDefaultFileInputData_new_alloc :: (name: *u8) -> *PxDefaultFileInputData #foreign libphysx; + +PxDefaultFileInputData_delete :: (self: *PxDefaultFileInputData) -> void #foreign libphysx; + +PxDefaultFileInputData_read :: (self: *PxDefaultFileInputData, dest: *void, count: u32) -> u32 #foreign libphysx "PxDefaultFileInputData_read_mut"; + +PxDefaultFileInputData_seek :: (self: *PxDefaultFileInputData, pos: u32) -> void #foreign libphysx "PxDefaultFileInputData_seek_mut"; + +PxDefaultFileInputData_tell :: (self: *PxDefaultFileInputData) -> u32 #foreign libphysx; + +PxDefaultFileInputData_getLength :: (self: *PxDefaultFileInputData) -> u32 #foreign libphysx; + +PxDefaultFileInputData_isValid :: (self: *PxDefaultFileInputData) -> bool #foreign libphysx; + +platformAlignedAlloc :: (size: u64) -> *void #foreign libphysx "phys_platformAlignedAlloc"; + +platformAlignedFree :: (ptr: *void) -> void #foreign libphysx "phys_platformAlignedFree"; + +PxDefaultAllocator_allocate :: (self: *PxDefaultAllocator, size: u64, anon_param1: *u8, anon_param2: *u8, anon_param3: s32) -> *void #foreign libphysx "PxDefaultAllocator_allocate_mut"; + +PxDefaultAllocator_deallocate :: (self: *PxDefaultAllocator, ptr: *void) -> void #foreign libphysx "PxDefaultAllocator_deallocate_mut"; + +PxDefaultAllocator_delete :: (self: *PxDefaultAllocator) -> void #foreign libphysx; + +PxJoint_setActors :: (self: *PxJoint, actor0: *PxRigidActor, actor1: *PxRigidActor) -> void #foreign libphysx "PxJoint_setActors_mut"; + +PxJoint_getActors :: (self: *PxJoint, actor0: **PxRigidActor, actor1: **PxRigidActor) -> void #foreign libphysx; + +PxJoint_setLocalPose :: (self: *PxJoint, actor: s32, localPose: *PxTransform) -> void #foreign libphysx "PxJoint_setLocalPose_mut"; + +PxJoint_getLocalPose :: (self: *PxJoint, actor: s32) -> PxTransform #foreign libphysx; + +PxJoint_getRelativeTransform :: (self: *PxJoint) -> PxTransform #foreign libphysx; + +PxJoint_getRelativeLinearVelocity :: (self: *PxJoint) -> Vector3 #foreign libphysx; + +PxJoint_getRelativeAngularVelocity :: (self: *PxJoint) -> Vector3 #foreign libphysx; + +PxJoint_setBreakForce :: (self: *PxJoint, force: float, torque: float) -> void #foreign libphysx "PxJoint_setBreakForce_mut"; + +PxJoint_getBreakForce :: (self: *PxJoint, force: *float, torque: *float) -> void #foreign libphysx; + +PxJoint_setConstraintFlags :: (self: *PxJoint, flags: u16) -> void #foreign libphysx "PxJoint_setConstraintFlags_mut"; + +PxJoint_setConstraintFlag :: (self: *PxJoint, flag: s32, value: bool) -> void #foreign libphysx "PxJoint_setConstraintFlag_mut"; + +PxJoint_getConstraintFlags :: (self: *PxJoint) -> u16 #foreign libphysx; + +PxJoint_setInvMassScale0 :: (self: *PxJoint, invMassScale: float) -> void #foreign libphysx "PxJoint_setInvMassScale0_mut"; + +PxJoint_getInvMassScale0 :: (self: *PxJoint) -> float #foreign libphysx; + +PxJoint_setInvInertiaScale0 :: (self: *PxJoint, invInertiaScale: float) -> void #foreign libphysx "PxJoint_setInvInertiaScale0_mut"; + +PxJoint_getInvInertiaScale0 :: (self: *PxJoint) -> float #foreign libphysx; + +PxJoint_setInvMassScale1 :: (self: *PxJoint, invMassScale: float) -> void #foreign libphysx "PxJoint_setInvMassScale1_mut"; + +PxJoint_getInvMassScale1 :: (self: *PxJoint) -> float #foreign libphysx; + +PxJoint_setInvInertiaScale1 :: (self: *PxJoint, invInertiaScale: float) -> void #foreign libphysx "PxJoint_setInvInertiaScale1_mut"; + +PxJoint_getInvInertiaScale1 :: (self: *PxJoint) -> float #foreign libphysx; + +PxJoint_getConstraint :: (self: *PxJoint) -> *PxConstraint #foreign libphysx; + +PxJoint_setName :: (self: *PxJoint, name: *u8) -> void #foreign libphysx "PxJoint_setName_mut"; + +PxJoint_getName :: (self: *PxJoint) -> *u8 #foreign libphysx; + +PxJoint_release :: (self: *PxJoint) -> void #foreign libphysx "PxJoint_release_mut"; + +PxJoint_getScene :: (self: *PxJoint) -> *PxScene #foreign libphysx; + +PxJoint_getBinaryMetaData :: (stream: *PxOutputStream) -> void #foreign libphysx; + +PxSpring_new :: (stiffness_: float, damping_: float) -> PxSpring #foreign libphysx; + +PxSetJointGlobalFrame :: (joint: *PxJoint, wsAnchor: *Vector3, wsAxis: *Vector3) -> void #foreign libphysx "phys_PxSetJointGlobalFrame"; + +PxDistanceJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxDistanceJoint #foreign libphysx "phys_PxDistanceJointCreate"; + +PxDistanceJoint_getDistance :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setMinDistance :: (self: *PxDistanceJoint, distance: float) -> void #foreign libphysx "PxDistanceJoint_setMinDistance_mut"; + +PxDistanceJoint_getMinDistance :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setMaxDistance :: (self: *PxDistanceJoint, distance: float) -> void #foreign libphysx "PxDistanceJoint_setMaxDistance_mut"; + +PxDistanceJoint_getMaxDistance :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setTolerance :: (self: *PxDistanceJoint, tolerance: float) -> void #foreign libphysx "PxDistanceJoint_setTolerance_mut"; + +PxDistanceJoint_getTolerance :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setStiffness :: (self: *PxDistanceJoint, stiffness: float) -> void #foreign libphysx "PxDistanceJoint_setStiffness_mut"; + +PxDistanceJoint_getStiffness :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setDamping :: (self: *PxDistanceJoint, damping: float) -> void #foreign libphysx "PxDistanceJoint_setDamping_mut"; + +PxDistanceJoint_getDamping :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setContactDistance :: (self: *PxDistanceJoint, contactDistance: float) -> void #foreign libphysx "PxDistanceJoint_setContactDistance_mut"; + +PxDistanceJoint_getContactDistance :: (self: *PxDistanceJoint) -> float #foreign libphysx; + +PxDistanceJoint_setDistanceJointFlags :: (self: *PxDistanceJoint, flags: u16) -> void #foreign libphysx "PxDistanceJoint_setDistanceJointFlags_mut"; + +PxDistanceJoint_setDistanceJointFlag :: (self: *PxDistanceJoint, flag: s32, value: bool) -> void #foreign libphysx "PxDistanceJoint_setDistanceJointFlag_mut"; + +PxDistanceJoint_getDistanceJointFlags :: (self: *PxDistanceJoint) -> u16 #foreign libphysx; + +PxDistanceJoint_getConcreteTypeName :: (self: *PxDistanceJoint) -> *u8 #foreign libphysx; + +PxContactJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxContactJoint #foreign libphysx "phys_PxContactJointCreate"; + +PxJacobianRow_new :: () -> PxJacobianRow #foreign libphysx; + +PxJacobianRow_new :: (lin0: *Vector3, lin1: *Vector3, ang0: *Vector3, ang1: *Vector3) -> PxJacobianRow #foreign libphysx "PxJacobianRow_new_1"; + +PxContactJoint_setContact :: (self: *PxContactJoint, contact: *Vector3) -> void #foreign libphysx "PxContactJoint_setContact_mut"; + +PxContactJoint_setContactNormal :: (self: *PxContactJoint, contactNormal: *Vector3) -> void #foreign libphysx "PxContactJoint_setContactNormal_mut"; + +PxContactJoint_setPenetration :: (self: *PxContactJoint, penetration: float) -> void #foreign libphysx "PxContactJoint_setPenetration_mut"; + +PxContactJoint_getContact :: (self: *PxContactJoint) -> Vector3 #foreign libphysx; + +PxContactJoint_getContactNormal :: (self: *PxContactJoint) -> Vector3 #foreign libphysx; + +PxContactJoint_getPenetration :: (self: *PxContactJoint) -> float #foreign libphysx; + +PxContactJoint_getRestitution :: (self: *PxContactJoint) -> float #foreign libphysx; + +PxContactJoint_setRestitution :: (self: *PxContactJoint, restitution: float) -> void #foreign libphysx "PxContactJoint_setRestitution_mut"; + +PxContactJoint_getBounceThreshold :: (self: *PxContactJoint) -> float #foreign libphysx; + +PxContactJoint_setBounceThreshold :: (self: *PxContactJoint, bounceThreshold: float) -> void #foreign libphysx "PxContactJoint_setBounceThreshold_mut"; + +PxContactJoint_getConcreteTypeName :: (self: *PxContactJoint) -> *u8 #foreign libphysx; + +PxContactJoint_computeJacobians :: (self: *PxContactJoint, jacobian: *PxJacobianRow) -> void #foreign libphysx; + +PxContactJoint_getNbJacobianRows :: (self: *PxContactJoint) -> u32 #foreign libphysx; + +PxFixedJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxFixedJoint #foreign libphysx "phys_PxFixedJointCreate"; + +PxFixedJoint_getConcreteTypeName :: (self: *PxFixedJoint) -> *u8 #foreign libphysx; + +PxJointLimitParameters_new_alloc :: () -> *PxJointLimitParameters #foreign libphysx; + +PxJointLimitParameters_isValid :: (self: *PxJointLimitParameters) -> bool #foreign libphysx; + +PxJointLimitParameters_isSoft :: (self: *PxJointLimitParameters) -> bool #foreign libphysx; + +PxJointLinearLimit_new :: (scale: *PxTolerancesScale, extent: float, contactDist_deprecated: float) -> PxJointLinearLimit #foreign libphysx; + +PxJointLinearLimit_new :: (extent: float, spring: *PxSpring) -> PxJointLinearLimit #foreign libphysx "PxJointLinearLimit_new_1"; + +PxJointLinearLimit_isValid :: (self: *PxJointLinearLimit) -> bool #foreign libphysx; + +PxJointLinearLimit_delete :: (self: *PxJointLinearLimit) -> void #foreign libphysx; + +PxJointLinearLimitPair_new :: (scale: *PxTolerancesScale, lowerLimit: float, upperLimit: float, contactDist_deprecated: float) -> PxJointLinearLimitPair #foreign libphysx; + +PxJointLinearLimitPair_new :: (lowerLimit: float, upperLimit: float, spring: *PxSpring) -> PxJointLinearLimitPair #foreign libphysx "PxJointLinearLimitPair_new_1"; + +PxJointLinearLimitPair_isValid :: (self: *PxJointLinearLimitPair) -> bool #foreign libphysx; + +PxJointLinearLimitPair_delete :: (self: *PxJointLinearLimitPair) -> void #foreign libphysx; + +PxJointAngularLimitPair_new :: (lowerLimit: float, upperLimit: float, contactDist_deprecated: float) -> PxJointAngularLimitPair #foreign libphysx; + +PxJointAngularLimitPair_new :: (lowerLimit: float, upperLimit: float, spring: *PxSpring) -> PxJointAngularLimitPair #foreign libphysx "PxJointAngularLimitPair_new_1"; + +PxJointAngularLimitPair_isValid :: (self: *PxJointAngularLimitPair) -> bool #foreign libphysx; + +PxJointAngularLimitPair_delete :: (self: *PxJointAngularLimitPair) -> void #foreign libphysx; + +PxJointLimitCone_new :: (yLimitAngle: float, zLimitAngle: float, contactDist_deprecated: float) -> PxJointLimitCone #foreign libphysx; + +PxJointLimitCone_new :: (yLimitAngle: float, zLimitAngle: float, spring: *PxSpring) -> PxJointLimitCone #foreign libphysx "PxJointLimitCone_new_1"; + +PxJointLimitCone_isValid :: (self: *PxJointLimitCone) -> bool #foreign libphysx; + +PxJointLimitCone_delete :: (self: *PxJointLimitCone) -> void #foreign libphysx; + +PxJointLimitPyramid_new :: (yLimitAngleMin: float, yLimitAngleMax: float, zLimitAngleMin: float, zLimitAngleMax: float, contactDist_deprecated: float) -> PxJointLimitPyramid #foreign libphysx; + +PxJointLimitPyramid_new :: (yLimitAngleMin: float, yLimitAngleMax: float, zLimitAngleMin: float, zLimitAngleMax: float, spring: *PxSpring) -> PxJointLimitPyramid #foreign libphysx "PxJointLimitPyramid_new_1"; + +PxJointLimitPyramid_isValid :: (self: *PxJointLimitPyramid) -> bool #foreign libphysx; + +PxJointLimitPyramid_delete :: (self: *PxJointLimitPyramid) -> void #foreign libphysx; + +PxPrismaticJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxPrismaticJoint #foreign libphysx "phys_PxPrismaticJointCreate"; + +PxPrismaticJoint_getPosition :: (self: *PxPrismaticJoint) -> float #foreign libphysx; + +PxPrismaticJoint_getVelocity :: (self: *PxPrismaticJoint) -> float #foreign libphysx; + +PxPrismaticJoint_setLimit :: (self: *PxPrismaticJoint, anon_param0: *PxJointLinearLimitPair) -> void #foreign libphysx "PxPrismaticJoint_setLimit_mut"; + +PxPrismaticJoint_getLimit :: (self: *PxPrismaticJoint) -> PxJointLinearLimitPair #foreign libphysx; + +PxPrismaticJoint_setPrismaticJointFlags :: (self: *PxPrismaticJoint, flags: u16) -> void #foreign libphysx "PxPrismaticJoint_setPrismaticJointFlags_mut"; + +PxPrismaticJoint_setPrismaticJointFlag :: (self: *PxPrismaticJoint, flag: s32, value: bool) -> void #foreign libphysx "PxPrismaticJoint_setPrismaticJointFlag_mut"; + +PxPrismaticJoint_getPrismaticJointFlags :: (self: *PxPrismaticJoint) -> u16 #foreign libphysx; + +PxPrismaticJoint_getConcreteTypeName :: (self: *PxPrismaticJoint) -> *u8 #foreign libphysx; + +PxRevoluteJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxRevoluteJoint #foreign libphysx "phys_PxRevoluteJointCreate"; + +PxRevoluteJoint_getAngle :: (self: *PxRevoluteJoint) -> float #foreign libphysx; + +PxRevoluteJoint_getVelocity :: (self: *PxRevoluteJoint) -> float #foreign libphysx; + +PxRevoluteJoint_setLimit :: (self: *PxRevoluteJoint, limits: *PxJointAngularLimitPair) -> void #foreign libphysx "PxRevoluteJoint_setLimit_mut"; + +PxRevoluteJoint_getLimit :: (self: *PxRevoluteJoint) -> PxJointAngularLimitPair #foreign libphysx; + +PxRevoluteJoint_setDriveVelocity :: (self: *PxRevoluteJoint, velocity: float, autowake: bool) -> void #foreign libphysx "PxRevoluteJoint_setDriveVelocity_mut"; + +PxRevoluteJoint_getDriveVelocity :: (self: *PxRevoluteJoint) -> float #foreign libphysx; + +PxRevoluteJoint_setDriveForceLimit :: (self: *PxRevoluteJoint, limit: float) -> void #foreign libphysx "PxRevoluteJoint_setDriveForceLimit_mut"; + +PxRevoluteJoint_getDriveForceLimit :: (self: *PxRevoluteJoint) -> float #foreign libphysx; + +PxRevoluteJoint_setDriveGearRatio :: (self: *PxRevoluteJoint, ratio: float) -> void #foreign libphysx "PxRevoluteJoint_setDriveGearRatio_mut"; + +PxRevoluteJoint_getDriveGearRatio :: (self: *PxRevoluteJoint) -> float #foreign libphysx; + +PxRevoluteJoint_setRevoluteJointFlags :: (self: *PxRevoluteJoint, flags: u16) -> void #foreign libphysx "PxRevoluteJoint_setRevoluteJointFlags_mut"; + +PxRevoluteJoint_setRevoluteJointFlag :: (self: *PxRevoluteJoint, flag: s32, value: bool) -> void #foreign libphysx "PxRevoluteJoint_setRevoluteJointFlag_mut"; + +PxRevoluteJoint_getRevoluteJointFlags :: (self: *PxRevoluteJoint) -> u16 #foreign libphysx; + +PxRevoluteJoint_getConcreteTypeName :: (self: *PxRevoluteJoint) -> *u8 #foreign libphysx; + +PxSphericalJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxSphericalJoint #foreign libphysx "phys_PxSphericalJointCreate"; + +PxSphericalJoint_getLimitCone :: (self: *PxSphericalJoint) -> PxJointLimitCone #foreign libphysx; + +PxSphericalJoint_setLimitCone :: (self: *PxSphericalJoint, limit: *PxJointLimitCone) -> void #foreign libphysx "PxSphericalJoint_setLimitCone_mut"; + +PxSphericalJoint_getSwingYAngle :: (self: *PxSphericalJoint) -> float #foreign libphysx; + +PxSphericalJoint_getSwingZAngle :: (self: *PxSphericalJoint) -> float #foreign libphysx; + +PxSphericalJoint_setSphericalJointFlags :: (self: *PxSphericalJoint, flags: u16) -> void #foreign libphysx "PxSphericalJoint_setSphericalJointFlags_mut"; + +PxSphericalJoint_setSphericalJointFlag :: (self: *PxSphericalJoint, flag: s32, value: bool) -> void #foreign libphysx "PxSphericalJoint_setSphericalJointFlag_mut"; + +PxSphericalJoint_getSphericalJointFlags :: (self: *PxSphericalJoint) -> u16 #foreign libphysx; + +PxSphericalJoint_getConcreteTypeName :: (self: *PxSphericalJoint) -> *u8 #foreign libphysx; + +PxD6JointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxD6Joint #foreign libphysx "phys_PxD6JointCreate"; + +PxD6JointDrive_new :: () -> PxD6JointDrive #foreign libphysx; + +PxD6JointDrive_new :: (driveStiffness: float, driveDamping: float, driveForceLimit: float, isAcceleration: bool) -> PxD6JointDrive #foreign libphysx "PxD6JointDrive_new_1"; + +PxD6JointDrive_isValid :: (self: *PxD6JointDrive) -> bool #foreign libphysx; + +PxD6Joint_setMotion :: (self: *PxD6Joint, axis: s32, type: s32) -> void #foreign libphysx "PxD6Joint_setMotion_mut"; + +PxD6Joint_getMotion :: (self: *PxD6Joint, axis: s32) -> s32 #foreign libphysx; + +PxD6Joint_getTwistAngle :: (self: *PxD6Joint) -> float #foreign libphysx; + +PxD6Joint_getSwingYAngle :: (self: *PxD6Joint) -> float #foreign libphysx; + +PxD6Joint_getSwingZAngle :: (self: *PxD6Joint) -> float #foreign libphysx; + +PxD6Joint_setDistanceLimit :: (self: *PxD6Joint, limit: *PxJointLinearLimit) -> void #foreign libphysx "PxD6Joint_setDistanceLimit_mut"; + +PxD6Joint_getDistanceLimit :: (self: *PxD6Joint) -> PxJointLinearLimit #foreign libphysx; + +PxD6Joint_setLinearLimit :: (self: *PxD6Joint, axis: s32, limit: *PxJointLinearLimitPair) -> void #foreign libphysx "PxD6Joint_setLinearLimit_mut"; + +PxD6Joint_getLinearLimit :: (self: *PxD6Joint, axis: s32) -> PxJointLinearLimitPair #foreign libphysx; + +PxD6Joint_setTwistLimit :: (self: *PxD6Joint, limit: *PxJointAngularLimitPair) -> void #foreign libphysx "PxD6Joint_setTwistLimit_mut"; + +PxD6Joint_getTwistLimit :: (self: *PxD6Joint) -> PxJointAngularLimitPair #foreign libphysx; + +PxD6Joint_setSwingLimit :: (self: *PxD6Joint, limit: *PxJointLimitCone) -> void #foreign libphysx "PxD6Joint_setSwingLimit_mut"; + +PxD6Joint_getSwingLimit :: (self: *PxD6Joint) -> PxJointLimitCone #foreign libphysx; + +PxD6Joint_setPyramidSwingLimit :: (self: *PxD6Joint, limit: *PxJointLimitPyramid) -> void #foreign libphysx "PxD6Joint_setPyramidSwingLimit_mut"; + +PxD6Joint_getPyramidSwingLimit :: (self: *PxD6Joint) -> PxJointLimitPyramid #foreign libphysx; + +PxD6Joint_setDrive :: (self: *PxD6Joint, index: s32, drive: *PxD6JointDrive) -> void #foreign libphysx "PxD6Joint_setDrive_mut"; + +PxD6Joint_getDrive :: (self: *PxD6Joint, index: s32) -> PxD6JointDrive #foreign libphysx; + +PxD6Joint_setDrivePosition :: (self: *PxD6Joint, pose: *PxTransform, autowake: bool) -> void #foreign libphysx "PxD6Joint_setDrivePosition_mut"; + +PxD6Joint_getDrivePosition :: (self: *PxD6Joint) -> PxTransform #foreign libphysx; + +PxD6Joint_setDriveVelocity :: (self: *PxD6Joint, linear: *Vector3, angular: *Vector3, autowake: bool) -> void #foreign libphysx "PxD6Joint_setDriveVelocity_mut"; + +PxD6Joint_getDriveVelocity :: (self: *PxD6Joint, linear: *Vector3, angular: *Vector3) -> void #foreign libphysx; + +PxD6Joint_setProjectionLinearTolerance :: (self: *PxD6Joint, tolerance: float) -> void #foreign libphysx "PxD6Joint_setProjectionLinearTolerance_mut"; + +PxD6Joint_getProjectionLinearTolerance :: (self: *PxD6Joint) -> float #foreign libphysx; + +PxD6Joint_setProjectionAngularTolerance :: (self: *PxD6Joint, tolerance: float) -> void #foreign libphysx "PxD6Joint_setProjectionAngularTolerance_mut"; + +PxD6Joint_getProjectionAngularTolerance :: (self: *PxD6Joint) -> float #foreign libphysx; + +PxD6Joint_getConcreteTypeName :: (self: *PxD6Joint) -> *u8 #foreign libphysx; + +PxGearJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxGearJoint #foreign libphysx "phys_PxGearJointCreate"; + +PxGearJoint_setHinges :: (self: *PxGearJoint, hinge0: *PxBase, hinge1: *PxBase) -> bool #foreign libphysx "PxGearJoint_setHinges_mut"; + +PxGearJoint_setGearRatio :: (self: *PxGearJoint, ratio: float) -> void #foreign libphysx "PxGearJoint_setGearRatio_mut"; + +PxGearJoint_getGearRatio :: (self: *PxGearJoint) -> float #foreign libphysx; + +PxGearJoint_getConcreteTypeName :: (self: *PxGearJoint) -> *u8 #foreign libphysx; + +PxRackAndPinionJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxRackAndPinionJoint #foreign libphysx "phys_PxRackAndPinionJointCreate"; + +PxRackAndPinionJoint_setJoints :: (self: *PxRackAndPinionJoint, hinge: *PxBase, prismatic: *PxBase) -> bool #foreign libphysx "PxRackAndPinionJoint_setJoints_mut"; + +PxRackAndPinionJoint_setRatio :: (self: *PxRackAndPinionJoint, ratio: float) -> void #foreign libphysx "PxRackAndPinionJoint_setRatio_mut"; + +PxRackAndPinionJoint_getRatio :: (self: *PxRackAndPinionJoint) -> float #foreign libphysx; + +PxRackAndPinionJoint_setData :: (self: *PxRackAndPinionJoint, nbRackTeeth: u32, nbPinionTeeth: u32, rackLength: float) -> bool #foreign libphysx "PxRackAndPinionJoint_setData_mut"; + +PxRackAndPinionJoint_getConcreteTypeName :: (self: *PxRackAndPinionJoint) -> *u8 #foreign libphysx; + +PxGroupsMask_new_alloc :: () -> *PxGroupsMask #foreign libphysx; + +PxGroupsMask_delete :: (self: *PxGroupsMask) -> void #foreign libphysx; + +PxDefaultSimulationFilterShader :: (attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, pairFlags: *u16, constantBlock: *void, constantBlockSize: u32) -> u16 #foreign libphysx "phys_PxDefaultSimulationFilterShader"; + +PxGetGroupCollisionFlag :: (group1: u16, group2: u16) -> bool #foreign libphysx "phys_PxGetGroupCollisionFlag"; + +PxSetGroupCollisionFlag :: (group1: u16, group2: u16, enable: bool) -> void #foreign libphysx "phys_PxSetGroupCollisionFlag"; + +PxGetGroup :: (actor: *PxActor) -> u16 #foreign libphysx "phys_PxGetGroup"; + +PxSetGroup :: (actor: *PxActor, collisionGroup: u16) -> void #foreign libphysx "phys_PxSetGroup"; + +PxGetFilterOps :: (op0: *s32, op1: *s32, op2: *s32) -> void #foreign libphysx "phys_PxGetFilterOps"; + +PxSetFilterOps :: (op0: *s32, op1: *s32, op2: *s32) -> void #foreign libphysx "phys_PxSetFilterOps"; + +PxGetFilterBool :: () -> bool #foreign libphysx "phys_PxGetFilterBool"; + +PxSetFilterBool :: (enable: bool) -> void #foreign libphysx "phys_PxSetFilterBool"; + +PxGetFilterConstants :: (c0: *PxGroupsMask, c1: *PxGroupsMask) -> void #foreign libphysx "phys_PxGetFilterConstants"; + +PxSetFilterConstants :: (c0: *PxGroupsMask, c1: *PxGroupsMask) -> void #foreign libphysx "phys_PxSetFilterConstants"; + +PxGetGroupsMask :: (actor: *PxActor) -> PxGroupsMask #foreign libphysx "phys_PxGetGroupsMask"; + +PxSetGroupsMask :: (actor: *PxActor, mask: *PxGroupsMask) -> void #foreign libphysx "phys_PxSetGroupsMask"; + +PxDefaultErrorCallback_new_alloc :: () -> *PxDefaultErrorCallback #foreign libphysx; + +PxDefaultErrorCallback_delete :: (self: *PxDefaultErrorCallback) -> void #foreign libphysx; + +PxDefaultErrorCallback_reportError :: (self: *PxDefaultErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign libphysx "PxDefaultErrorCallback_reportError_mut"; + +PxRigidActorExt_createExclusiveShape :: (actor: *PxRigidActor, geometry: *PxGeometry, materials: **PxMaterial, materialCount: u16, shapeFlags: u8) -> *PxShape #foreign libphysx; + +PxRigidActorExt_createExclusiveShape :: (actor: *PxRigidActor, geometry: *PxGeometry, material: *PxMaterial, shapeFlags: u8) -> *PxShape #foreign libphysx "PxRigidActorExt_createExclusiveShape_1"; + +PxRigidActorExt_getRigidActorShapeLocalBoundsList :: (actor: *PxRigidActor, numBounds: *u32) -> *PxBounds3 #foreign libphysx; + +PxRigidActorExt_createBVHFromActor :: (physics: *PxPhysics, actor: *PxRigidActor) -> *PxBVH #foreign libphysx; + +PxMassProperties_new :: () -> PxMassProperties #foreign libphysx; + +PxMassProperties_new :: (m: float, inertiaT: *PxMat33, com: *Vector3) -> PxMassProperties #foreign libphysx "PxMassProperties_new_1"; + +PxMassProperties_new :: (geometry: *PxGeometry) -> PxMassProperties #foreign libphysx "PxMassProperties_new_2"; + +PxMassProperties_translate :: (self: *PxMassProperties, t: *Vector3) -> void #foreign libphysx "PxMassProperties_translate_mut"; + +PxMassProperties_getMassSpaceInertia :: (inertia: *PxMat33, massFrame: *Quaternion) -> Vector3 #foreign libphysx; + +PxMassProperties_translateInertia :: (inertia: *PxMat33, mass: float, t: *Vector3) -> PxMat33 #foreign libphysx; + +PxMassProperties_rotateInertia :: (inertia: *PxMat33, q: *Quaternion) -> PxMat33 #foreign libphysx; + +PxMassProperties_scaleInertia :: (inertia: *PxMat33, scaleRotation: *Quaternion, scale: *Vector3) -> PxMat33 #foreign libphysx; + +PxMassProperties_sum :: (props: *PxMassProperties, transforms: *PxTransform, count: u32) -> PxMassProperties #foreign libphysx; + +PxRigidBodyExt_updateMassAndInertia :: (body: *PxRigidBody, shapeDensities: *float, shapeDensityCount: u32, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign libphysx; + +PxRigidBodyExt_updateMassAndInertia :: (body: *PxRigidBody, density: float, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign libphysx "PxRigidBodyExt_updateMassAndInertia_1"; + +PxRigidBodyExt_setMassAndUpdateInertia :: (body: *PxRigidBody, shapeMasses: *float, shapeMassCount: u32, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign libphysx; + +PxRigidBodyExt_setMassAndUpdateInertia :: (body: *PxRigidBody, mass: float, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign libphysx "PxRigidBodyExt_setMassAndUpdateInertia_1"; + +PxRigidBodyExt_computeMassPropertiesFromShapes :: (shapes: **PxShape, shapeCount: u32) -> PxMassProperties #foreign libphysx; + +PxRigidBodyExt_addForceAtPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign libphysx; + +PxRigidBodyExt_addForceAtLocalPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign libphysx; + +PxRigidBodyExt_addLocalForceAtPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign libphysx; + +PxRigidBodyExt_addLocalForceAtLocalPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign libphysx; + +PxRigidBodyExt_getVelocityAtPos :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign libphysx; + +PxRigidBodyExt_getLocalVelocityAtLocalPos :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign libphysx; + +PxRigidBodyExt_getVelocityAtOffset :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign libphysx; + +PxRigidBodyExt_computeVelocityDeltaFromImpulse :: (body: *PxRigidBody, impulsiveForce: *Vector3, impulsiveTorque: *Vector3, deltaLinearVelocity: *Vector3, deltaAngularVelocity: *Vector3) -> void #foreign libphysx; + +PxRigidBodyExt_computeVelocityDeltaFromImpulse :: (body: *PxRigidBody, globalPose: *PxTransform, point: *Vector3, impulse: *Vector3, invMassScale: float, invInertiaScale: float, deltaLinearVelocity: *Vector3, deltaAngularVelocity: *Vector3) -> void #foreign libphysx "PxRigidBodyExt_computeVelocityDeltaFromImpulse_1"; + +PxRigidBodyExt_computeLinearAngularImpulse :: (body: *PxRigidBody, globalPose: *PxTransform, point: *Vector3, impulse: *Vector3, invMassScale: float, invInertiaScale: float, linearImpulse: *Vector3, angularImpulse: *Vector3) -> void #foreign libphysx; + +PxRigidBodyExt_linearSweepSingle :: (body: *PxRigidBody, scene: *PxScene, unitDir: *Vector3, distance: float, outputFlags: u16, closestHit: *PxSweepHit, shapeIndex: *u32, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign libphysx; + +PxRigidBodyExt_linearSweepMultiple :: (body: *PxRigidBody, scene: *PxScene, unitDir: *Vector3, distance: float, outputFlags: u16, touchHitBuffer: *PxSweepHit, touchHitShapeIndices: *u32, touchHitBufferSize: u32, block: *PxSweepHit, blockingShapeIndex: *s32, overflow: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> u32 #foreign libphysx; + +PxShapeExt_getGlobalPose :: (shape: *PxShape, actor: *PxRigidActor) -> PxTransform #foreign libphysx; + +PxShapeExt_raycast :: (shape: *PxShape, actor: *PxRigidActor, rayOrigin: *Vector3, rayDir: *Vector3, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxRaycastHit) -> u32 #foreign libphysx; + +PxShapeExt_overlap :: (shape: *PxShape, actor: *PxRigidActor, otherGeom: *PxGeometry, otherGeomPose: *PxTransform) -> bool #foreign libphysx; + +PxShapeExt_sweep :: (shape: *PxShape, actor: *PxRigidActor, unitDir: *Vector3, distance: float, otherGeom: *PxGeometry, otherGeomPose: *PxTransform, sweepHit: *PxSweepHit, hitFlags: u16) -> bool #foreign libphysx; + +PxShapeExt_getWorldBounds :: (shape: *PxShape, actor: *PxRigidActor, inflation: float) -> PxBounds3 #foreign libphysx; + +PxMeshOverlapUtil_new_alloc :: () -> *PxMeshOverlapUtil #foreign libphysx; + +PxMeshOverlapUtil_delete :: (self: *PxMeshOverlapUtil) -> void #foreign libphysx; + +PxMeshOverlapUtil_findOverlap :: (self: *PxMeshOverlapUtil, geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform) -> u32 #foreign libphysx "PxMeshOverlapUtil_findOverlap_mut"; + +PxMeshOverlapUtil_findOverlap_mut :: (self: *PxMeshOverlapUtil, geom: *PxGeometry, geomPose: *PxTransform, hfGeom: *PxHeightFieldGeometry, hfPose: *PxTransform) -> u32 #foreign libphysx "PxMeshOverlapUtil_findOverlap_mut_1"; + +PxMeshOverlapUtil_getResults :: (self: *PxMeshOverlapUtil) -> *u32 #foreign libphysx; + +PxMeshOverlapUtil_getNbResults :: (self: *PxMeshOverlapUtil) -> u32 #foreign libphysx; + +PxComputeTriangleMeshPenetration :: (direction: *Vector3, depth: *float, geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform, maxIter: u32, usedIter: *u32) -> bool #foreign libphysx "phys_PxComputeTriangleMeshPenetration"; + +PxComputeHeightFieldPenetration :: (direction: *Vector3, depth: *float, geom: *PxGeometry, geomPose: *PxTransform, heightFieldGeom: *PxHeightFieldGeometry, heightFieldPose: *PxTransform, maxIter: u32, usedIter: *u32) -> bool #foreign libphysx "phys_PxComputeHeightFieldPenetration"; + +PxXmlMiscParameter_new :: () -> PxXmlMiscParameter #foreign libphysx; + +PxXmlMiscParameter_new :: (inUpVector: *Vector3, inScale: PxTolerancesScale) -> PxXmlMiscParameter #foreign libphysx "PxXmlMiscParameter_new_1"; + +PxSerialization_isSerializable :: (collection: *PxCollection, sr: *PxSerializationRegistry, externalReferences: *PxCollection) -> bool #foreign libphysx; + +PxSerialization_complete :: (collection: *PxCollection, sr: *PxSerializationRegistry, exceptFor: *PxCollection, followJoints: bool) -> void #foreign libphysx; + +PxSerialization_createSerialObjectIds :: (collection: *PxCollection, base: u64) -> void #foreign libphysx; + +PxSerialization_createCollectionFromXml :: (inputData: *PxInputData, cooking: *PxCooking, sr: *PxSerializationRegistry, externalRefs: *PxCollection, stringTable: *PxStringTable, outArgs: *PxXmlMiscParameter) -> *PxCollection #foreign libphysx; + +PxSerialization_createCollectionFromBinary :: (memBlock: *void, sr: *PxSerializationRegistry, externalRefs: *PxCollection) -> *PxCollection #foreign libphysx; + +PxSerialization_serializeCollectionToXml :: (outputStream: *PxOutputStream, collection: *PxCollection, sr: *PxSerializationRegistry, cooking: *PxCooking, externalRefs: *PxCollection, inArgs: *PxXmlMiscParameter) -> bool #foreign libphysx; + +PxSerialization_serializeCollectionToBinary :: (outputStream: *PxOutputStream, collection: *PxCollection, sr: *PxSerializationRegistry, externalRefs: *PxCollection, exportNames: bool) -> bool #foreign libphysx; + +PxSerialization_createSerializationRegistry :: (physics: *PxPhysics) -> *PxSerializationRegistry #foreign libphysx; + +PxDefaultCpuDispatcher_release :: (self: *PxDefaultCpuDispatcher) -> void #foreign libphysx "PxDefaultCpuDispatcher_release_mut"; + +PxDefaultCpuDispatcher_setRunProfiled :: (self: *PxDefaultCpuDispatcher, runProfiled: bool) -> void #foreign libphysx "PxDefaultCpuDispatcher_setRunProfiled_mut"; + +PxDefaultCpuDispatcher_getRunProfiled :: (self: *PxDefaultCpuDispatcher) -> bool #foreign libphysx; + +PxDefaultCpuDispatcherCreate :: (numThreads: u32, affinityMasks: *u32, mode: s32, yieldProcessorCount: u32) -> *PxDefaultCpuDispatcher #foreign libphysx "phys_PxDefaultCpuDispatcherCreate"; + +PxBuildSmoothNormals :: (nbTris: u32, nbVerts: u32, verts: *Vector3, dFaces: *u32, wFaces: *u16, normals: *Vector3, flip: bool) -> bool #foreign libphysx "phys_PxBuildSmoothNormals"; + +PxCreateDynamic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, density: float, shapeOffset: *PxTransform) -> *PxRigidDynamic #foreign libphysx "phys_PxCreateDynamic"; + +PxCreateDynamic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape, density: float) -> *PxRigidDynamic #foreign libphysx "phys_PxCreateDynamic_1"; + +PxCreateKinematic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, density: float, shapeOffset: *PxTransform) -> *PxRigidDynamic #foreign libphysx "phys_PxCreateKinematic"; + +PxCreateKinematic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape, density: float) -> *PxRigidDynamic #foreign libphysx "phys_PxCreateKinematic_1"; + +PxCreateStatic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, shapeOffset: *PxTransform) -> *PxRigidStatic #foreign libphysx "phys_PxCreateStatic"; + +PxCreateStatic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape) -> *PxRigidStatic #foreign libphysx "phys_PxCreateStatic_1"; + +PxCloneShape :: (physicsSDK: *PxPhysics, shape: *PxShape, isExclusive: bool) -> *PxShape #foreign libphysx "phys_PxCloneShape"; + +PxCloneStatic :: (physicsSDK: *PxPhysics, transform: *PxTransform, actor: *PxRigidActor) -> *PxRigidStatic #foreign libphysx "phys_PxCloneStatic"; + +PxCloneDynamic :: (physicsSDK: *PxPhysics, transform: *PxTransform, body: *PxRigidDynamic) -> *PxRigidDynamic #foreign libphysx "phys_PxCloneDynamic"; + +PxCreatePlane :: (sdk: *PxPhysics, plane: *Plane3, material: *PxMaterial) -> *PxRigidStatic #foreign libphysx "phys_PxCreatePlane"; + +PxScaleRigidActor :: (actor: *PxRigidActor, scale: float, scaleMassProps: bool) -> void #foreign libphysx "phys_PxScaleRigidActor"; + +PxStringTableExt_createStringTable :: (inAllocator: *PxAllocatorCallback) -> *PxStringTable #foreign libphysx; + +PxBroadPhaseExt_createRegionsFromWorldBounds :: (regions: *PxBounds3, globalBounds: *PxBounds3, nbSubdiv: u32, upAxis: u32) -> u32 #foreign libphysx; + +PxSceneQueryExt_raycastAny :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, hit: *PxQueryHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> bool #foreign libphysx; + +PxSceneQueryExt_raycastSingle :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, outputFlags: u16, hit: *PxRaycastHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> bool #foreign libphysx; + +PxSceneQueryExt_raycastMultiple :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, outputFlags: u16, hitBuffer: *PxRaycastHit, hitBufferSize: u32, blockingHit: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> s32 #foreign libphysx; + +PxSceneQueryExt_sweepAny :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, queryFlags: u16, hit: *PxQueryHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign libphysx; + +PxSceneQueryExt_sweepSingle :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, outputFlags: u16, hit: *PxSweepHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign libphysx; + +PxSceneQueryExt_sweepMultiple :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, outputFlags: u16, hitBuffer: *PxSweepHit, hitBufferSize: u32, blockingHit: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> s32 #foreign libphysx; + +PxSceneQueryExt_overlapMultiple :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, hitBuffer: *PxOverlapHit, hitBufferSize: u32, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> s32 #foreign libphysx; + +PxSceneQueryExt_overlapAny :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, hit: *PxOverlapHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> bool #foreign libphysx; + +PxBatchQueryExt_release :: (self: *PxBatchQueryExt) -> void #foreign libphysx "PxBatchQueryExt_release_mut"; + +PxBatchQueryExt_raycast :: (self: *PxBatchQueryExt, origin: *Vector3, unitDir: *Vector3, distance: float, maxNbTouches: u16, hitFlags: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache) -> *PxRaycastBuffer #foreign libphysx "PxBatchQueryExt_raycast_mut"; + +PxBatchQueryExt_sweep :: (self: *PxBatchQueryExt, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, maxNbTouches: u16, hitFlags: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache, inflation: float) -> *PxSweepBuffer #foreign libphysx "PxBatchQueryExt_sweep_mut"; + +PxBatchQueryExt_overlap :: (self: *PxBatchQueryExt, geometry: *PxGeometry, pose: *PxTransform, maxNbTouches: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache) -> *PxOverlapBuffer #foreign libphysx "PxBatchQueryExt_overlap_mut"; + +PxBatchQueryExt_execute :: (self: *PxBatchQueryExt) -> void #foreign libphysx "PxBatchQueryExt_execute_mut"; + +PxCreateBatchQueryExt :: (scene: *PxScene, queryFilterCallback: *PxQueryFilterCallback, maxNbRaycasts: u32, maxNbRaycastTouches: u32, maxNbSweeps: u32, maxNbSweepTouches: u32, maxNbOverlaps: u32, maxNbOverlapTouches: u32) -> *PxBatchQueryExt #foreign libphysx "phys_PxCreateBatchQueryExt"; + +PxCreateBatchQueryExt_1 :: (scene: *PxScene, queryFilterCallback: *PxQueryFilterCallback, raycastBuffers: *PxRaycastBuffer, maxNbRaycasts: u32, raycastTouches: *PxRaycastHit, maxNbRaycastTouches: u32, sweepBuffers: *PxSweepBuffer, maxNbSweeps: u32, sweepTouches: *PxSweepHit, maxNbSweepTouches: u32, overlapBuffers: *PxOverlapBuffer, maxNbOverlaps: u32, overlapTouches: *PxOverlapHit, maxNbOverlapTouches: u32) -> *PxBatchQueryExt #foreign libphysx "phys_PxCreateBatchQueryExt_1"; + +PxCreateExternalSceneQuerySystem :: (desc: *PxSceneQueryDesc, contextID: u64) -> *PxSceneQuerySystem #foreign libphysx "phys_PxCreateExternalSceneQuerySystem"; + +PxCustomSceneQuerySystem_addPruner :: (self: *PxCustomSceneQuerySystem, primaryType: s32, secondaryType: s32, preallocated: u32) -> u32 #foreign libphysx "PxCustomSceneQuerySystem_addPruner_mut"; + +PxCustomSceneQuerySystem_startCustomBuildstep :: (self: *PxCustomSceneQuerySystem) -> u32 #foreign libphysx "PxCustomSceneQuerySystem_startCustomBuildstep_mut"; + +PxCustomSceneQuerySystem_customBuildstep :: (self: *PxCustomSceneQuerySystem, index: u32) -> void #foreign libphysx "PxCustomSceneQuerySystem_customBuildstep_mut"; + +PxCustomSceneQuerySystem_finishCustomBuildstep :: (self: *PxCustomSceneQuerySystem) -> void #foreign libphysx "PxCustomSceneQuerySystem_finishCustomBuildstep_mut"; + +PxCustomSceneQuerySystemAdapter_delete :: (self: *PxCustomSceneQuerySystemAdapter) -> void #foreign libphysx; + +PxCustomSceneQuerySystemAdapter_getPrunerIndex :: (self: *PxCustomSceneQuerySystemAdapter, actor: *PxRigidActor, shape: *PxShape) -> u32 #foreign libphysx; + +PxCustomSceneQuerySystemAdapter_processPruner :: (self: *PxCustomSceneQuerySystemAdapter, prunerIndex: u32, context_pod: *PxQueryThreadContext, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> bool #foreign libphysx; + +PxCreateCustomSceneQuerySystem :: (sceneQueryUpdateMode: s32, contextID: u64, adapter: *PxCustomSceneQuerySystemAdapter, usesTreeOfPruners: bool) -> *PxCustomSceneQuerySystem #foreign libphysx "phys_PxCreateCustomSceneQuerySystem"; + +PxFindFaceIndex :: (convexGeom: *PxConvexMeshGeometry, geomPose: *PxTransform, impactPos: *Vector3, unitDir: *Vector3) -> u32 #foreign libphysx "phys_PxFindFaceIndex"; + +PxPoissonSampler_setSamplingRadius :: (self: *PxPoissonSampler, samplingRadius: float) -> bool #foreign libphysx "PxPoissonSampler_setSamplingRadius_mut"; + +PxPoissonSampler_addSamplesInSphere :: (self: *PxPoissonSampler, sphereCenter: *Vector3, sphereRadius: float, createVolumeSamples: bool) -> void #foreign libphysx "PxPoissonSampler_addSamplesInSphere_mut"; + +PxPoissonSampler_addSamplesInBox :: (self: *PxPoissonSampler, axisAlignedBox: *PxBounds3, boxOrientation: *Quaternion, createVolumeSamples: bool) -> void #foreign libphysx "PxPoissonSampler_addSamplesInBox_mut"; + +PxPoissonSampler_delete :: (self: *PxPoissonSampler) -> void #foreign libphysx; + +PxCreateShapeSampler :: (geometry: *PxGeometry, transform: *PxTransform, worldBounds: *PxBounds3, initialSamplingRadius: float, numSampleAttemptsAroundPoint: s32) -> *PxPoissonSampler #foreign libphysx "phys_PxCreateShapeSampler"; + +PxTriangleMeshPoissonSampler_isPointInTriangleMesh :: (self: *PxTriangleMeshPoissonSampler, p: *Vector3) -> bool #foreign libphysx "PxTriangleMeshPoissonSampler_isPointInTriangleMesh_mut"; + +PxTriangleMeshPoissonSampler_delete :: (self: *PxTriangleMeshPoissonSampler) -> void #foreign libphysx; + +PxCreateTriangleMeshSampler :: (triangles: *u32, numTriangles: u32, vertices: *Vector3, numVertices: u32, initialSamplingRadius: float, numSampleAttemptsAroundPoint: s32) -> *PxTriangleMeshPoissonSampler #foreign libphysx "phys_PxCreateTriangleMeshSampler"; + +PxTetrahedronMeshExt_findTetrahedronContainingPoint :: (mesh: *PxTetrahedronMesh, point: *Vector3, bary: *Vector4, tolerance: float) -> s32 #foreign libphysx; + +PxTetrahedronMeshExt_findTetrahedronClosestToPoint :: (mesh: *PxTetrahedronMesh, point: *Vector3, bary: *Vector4) -> s32 #foreign libphysx; + +PxInitExtensions :: (physics: *PxPhysics, pvd: *PxPvd) -> bool #foreign libphysx "phys_PxInitExtensions"; + +PxCloseExtensions :: () -> void #foreign libphysx "phys_PxCloseExtensions"; + +PxRepXObject_new :: (inTypeName: *u8, inSerializable: *void, inId: u64) -> PxRepXObject #foreign libphysx; + +PxRepXObject_isValid :: (self: *PxRepXObject) -> bool #foreign libphysx; + +PxRepXInstantiationArgs_new :: (inPhysics: *PxPhysics, inCooking: *PxCooking, inStringTable: *PxStringTable) -> PxRepXInstantiationArgs #foreign libphysx; + +PxRepXSerializer_getTypeName :: (self: *PxRepXSerializer) -> *u8 #foreign libphysx "PxRepXSerializer_getTypeName_mut"; + +PxRepXSerializer_objectToFile :: (self: *PxRepXSerializer, inLiveObject: *PxRepXObject, inCollection: *PxCollection, inWriter: *XmlWriter, inTempBuffer: *MemoryBuffer, inArgs: *PxRepXInstantiationArgs) -> void #foreign libphysx "PxRepXSerializer_objectToFile_mut"; + +PxRepXSerializer_fileToObject :: (self: *PxRepXSerializer, inReader: *XmlReader, inAllocator: *XmlMemoryAllocator, inArgs: *PxRepXInstantiationArgs, inCollection: *PxCollection) -> PxRepXObject #foreign libphysx "PxRepXSerializer_fileToObject_mut"; + +PxPvd_connect :: (self: *PxPvd, transport: *PxPvdTransport, flags: u8) -> bool #foreign libphysx "PxPvd_connect_mut"; + +PxPvd_disconnect :: (self: *PxPvd) -> void #foreign libphysx "PxPvd_disconnect_mut"; + +PxPvd_isConnected :: (self: *PxPvd, useCachedStatus: bool) -> bool #foreign libphysx "PxPvd_isConnected_mut"; + +PxPvd_getTransport :: (self: *PxPvd) -> *PxPvdTransport #foreign libphysx "PxPvd_getTransport_mut"; + +PxPvd_getInstrumentationFlags :: (self: *PxPvd) -> u8 #foreign libphysx "PxPvd_getInstrumentationFlags_mut"; + +PxPvd_release :: (self: *PxPvd) -> void #foreign libphysx "PxPvd_release_mut"; + +PxCreatePvd :: (foundation: *PxFoundation) -> *PxPvd #foreign libphysx "phys_PxCreatePvd"; + +PxPvdTransport_connect :: (self: *PxPvdTransport) -> bool #foreign libphysx "PxPvdTransport_connect_mut"; + +PxPvdTransport_disconnect :: (self: *PxPvdTransport) -> void #foreign libphysx "PxPvdTransport_disconnect_mut"; + +PxPvdTransport_isConnected :: (self: *PxPvdTransport) -> bool #foreign libphysx "PxPvdTransport_isConnected_mut"; + +PxPvdTransport_write :: (self: *PxPvdTransport, inBytes: *u8, inLength: u32) -> bool #foreign libphysx "PxPvdTransport_write_mut"; + +PxPvdTransport_lock :: (self: *PxPvdTransport) -> *PxPvdTransport #foreign libphysx "PxPvdTransport_lock_mut"; + +PxPvdTransport_unlock :: (self: *PxPvdTransport) -> void #foreign libphysx "PxPvdTransport_unlock_mut"; + +PxPvdTransport_flush :: (self: *PxPvdTransport) -> void #foreign libphysx "PxPvdTransport_flush_mut"; + +PxPvdTransport_getWrittenDataSize :: (self: *PxPvdTransport) -> u64 #foreign libphysx "PxPvdTransport_getWrittenDataSize_mut"; + +PxPvdTransport_release :: (self: *PxPvdTransport) -> void #foreign libphysx "PxPvdTransport_release_mut"; + +PxDefaultPvdSocketTransportCreate :: (host: *u8, port: s32, timeoutInMilliseconds: u32) -> *PxPvdTransport #foreign libphysx "phys_PxDefaultPvdSocketTransportCreate"; + +PxDefaultPvdFileTransportCreate :: (name: *u8) -> *PxPvdTransport #foreign libphysx "phys_PxDefaultPvdFileTransportCreate"; + +gAllocator: PxDefaultAllocator #elsewhere libphysx; +gErrorCallback: PxDefaultErrorCallback #elsewhere libphysx; + +CollisionCallback :: #type (unknown0: *void, unknown1: *PxContactPairHeader, unknown2: *PxContactPair, unknown3: u32) -> void #c_call; + +SimulationFilterShader :: #type (attributes0: *u32, filterData0: *PxFilterData, attributes1: *u32, filterData1: *PxFilterData, pairFlags: *PxPairFlags) -> u16 #c_call; + +FilterShaderHandle :: struct { + shader: SimulationFilterShader; +} + +TriggerCallback :: #type (unknown0: *void, unknown1: *PxTriggerPair, unknown2: u32) -> void #c_call; +ConstraintBreakCallback :: #type (unknown0: *void, unknown1: *PxConstraintInfo, unknown2: u32) -> void #c_call; +WakeSleepCallback :: #type (unknown0: *void, unknown1: **PxActor, unknown2: u32, unknown3: bool) -> void #c_call; +AdvanceCallback :: #type (unknown0: *void, unknown1: **PxRigidBody, unknown2: *PxTransform, unknown3: u32) -> void #c_call; + +SimulationEventCallbackInfo :: struct { + // Callback for collision events. + collisionCallback: CollisionCallback = null; + collisionUserData: *void = null; + + // Callback for trigger shape events (an object entered or left a trigger shape). + triggerCallback: TriggerCallback = null; + triggerUserData: *void = null; + + // Callback for when a constraint breaks (such as a joint with a force limit) + constraintBreakCallback: ConstraintBreakCallback = null; + constraintBreakUserData: *void = null; + + // Callback for when an object falls asleep or is awoken. + wakeSleepCallback: WakeSleepCallback = null; + wakeSleepUserData: *void = null; + + // Callback to get the next pose early for objects (if flagged with eENABLE_POSE_INTEGRATION_PREVIEW). + advanceCallback: AdvanceCallback = null; + advanceUserData: *void = null; +} + +RaycastHitCallback :: #type (actor: *PxRigidActor, filterData: *PxFilterData, shape: *PxShape, hitFlags: u32, userData: *void) -> s32 #c_call; +PostFilterCallback :: #type (filterData: *PxFilterData, hit: *PxQueryHit, userData: *void) -> s32 #c_call; + +RaycastHitProcessTouchesCallback :: #type (buffer: *PxRaycastHit, nbHits: u32, userdata: *void) -> bool #c_call; +SweepHitProcessTouchesCallback :: #type (buffer: *PxSweepHit, nbHits: u32, userdata: *void) -> bool #c_call; +OverlapHitProcessTouchesCallback :: #type (buffer: *PxOverlapHit, nbHits: u32, userdata: *void) -> bool #c_call; +HitFinalizeQueryCallback :: #type (userdata: *void) -> void #c_call; + +AllocCallback :: #type (size: u64, typeName: *u8, filename: *u8, line: s32, userdata: *void) -> *void #c_call; +DeallocCallback :: #type (ptr: *void, userdata: *void) -> void #c_call; + +ZoneStartCallback :: #type (typeName: *u8, detached: bool, _context_pod: u64, userdata: *void) -> *void #c_call; +ZoneEndCallback :: #type (profilerData: *void, typeName: *u8, detached: bool, _context_pod: u64, userdata: *void) -> void #c_call; + +ErrorCallback :: #type (code: s32, message: *u8, file: *u8, line: s32, userdata: *void) -> void #c_call; + +AssertHandler :: #type (expr: *u8, file: *u8, line: s32, should_ignore: *bool, userdata: *void) -> void #c_call; + +ShapeHitCallback :: #type (unknown0: *void, unknown1: *PxControllerShapeHit) -> void #c_call; +ControllerHitCallback :: #type (unknown0: *void, unknown1: *PxControllersHit) -> void #c_call; +ObstacleHitCallback :: #type (unknown0: *void, unknown1: *PxControllerObstacleHit) -> void #c_call; + +UserControllerHitReportInfo :: struct { + shapeHitCallback: ShapeHitCallback = null; + shapeHitUserData: *void = null; + controllerHitCallback: ControllerHitCallback = null; + controllerHitUserData: *void = null; + obstacleHitCallback: ObstacleHitCallback = null; + obstacleHitUserData: *void = null; +} + +ShapeBehaviorCallback :: #type (data: *void, shape: *PxShape, actor: *PxActor) -> PxControllerBehaviorFlags #c_call; +CharacterBehaviorCallback :: #type (data: *void, controller: *PxController) -> PxControllerBehaviorFlags #c_call; +ObstacleBehaviorCallback :: #type (data: *void, obstacle: *PxObstacle) -> PxControllerBehaviorFlags #c_call; + +ControllerBehaviorCallbackInfo :: struct { + shapeBehaviorCallback: ShapeBehaviorCallback = null; + shapeBehaviorUserData: *void = null; + controllerBehaviorCallback: CharacterBehaviorCallback = null; + controllerBehaviorUserData: *void = null; + obstacleBehaviorCallback: ObstacleBehaviorCallback = null; + obstacleBehaviorUserData: *void = null; +} + +OnContactModify :: #type (data: *void, pairs: *PxContactModifyPair, count: u32) -> void #c_call; + +ContactModifyCallbackInfo :: struct { + onContactModify: OnContactModify = null; + onContactModifyUserData: *void = null; +} + +create_foundation :: () -> *PxFoundation #foreign libphysx "physx_create_foundation"; + +create_foundation_with_alloc :: (allocator: *PxAllocatorCallback) -> *PxFoundation #foreign libphysx "physx_create_foundation_with_alloc"; + +// fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages +// linking against the raw interface +get_default_allocator :: () -> *PxAllocatorCallback #foreign libphysx; + +// fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages +// linking against the raw interface +get_default_error_callback :: () -> *PxErrorCallback #foreign libphysx; + +create_physics :: (foundation: *PxFoundation) -> *PxPhysics #foreign libphysx "physx_create_physics"; + +create_raycast_filter_callback :: (actor_to_ignore: *PxRigidActor) -> *PxQueryFilterCallback #foreign libphysx; + +destroy_raycast_filter_callback :: (callback: *PxQueryFilterCallback) -> void #foreign libphysx; + +create_raycast_filter_callback_func :: (callback: RaycastHitCallback, userData: *void) -> *PxQueryFilterCallback #foreign libphysx; + +destroy_raycast_filter_callback_func :: (callback: *PxQueryFilterCallback) -> void #foreign libphysx; + +create_pre_and_post_raycast_filter_callback_func :: (preFilter: RaycastHitCallback, postFilter: PostFilterCallback, userData: *void) -> *PxQueryFilterCallback #foreign libphysx; + +destroy_pre_and_post_raycast_filter_callback_func :: (callback: *PxQueryFilterCallback) -> void #foreign libphysx; + +create_raycast_buffer :: () -> *PxRaycastCallback #foreign libphysx; + +create_sweep_buffer :: () -> *PxSweepCallback #foreign libphysx; + +create_overlap_buffer :: () -> *PxOverlapCallback #foreign libphysx; + +create_raycast_callback :: (process_touches_callback: RaycastHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxRaycastHit, numTouches: u32, userdata: *void) -> *PxRaycastCallback #foreign libphysx; + +delete_raycast_callback :: (callback: *PxRaycastCallback) -> void #foreign libphysx; + +delete_sweep_callback :: (callback: *PxSweepCallback) -> void #foreign libphysx; + +delete_overlap_callback :: (callback: *PxOverlapCallback) -> void #foreign libphysx; + +create_sweep_callback :: (process_touches_callback: SweepHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxSweepHit, numTouches: u32, userdata: *void) -> *PxSweepCallback #foreign libphysx; + +create_overlap_callback :: (process_touches_callback: OverlapHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxOverlapHit, numTouches: u32, userdata: *void) -> *PxOverlapCallback #foreign libphysx; + +create_alloc_callback :: (alloc_callback: AllocCallback, dealloc_callback: DeallocCallback, userdata: *void) -> *PxAllocatorCallback #foreign libphysx; + +get_alloc_callback_user_data :: (allocator: *PxAllocatorCallback) -> *void #foreign libphysx; + +create_profiler_callback :: (zone_start_callback: ZoneStartCallback, zone_end_callback: ZoneEndCallback, userdata: *void) -> *PxProfilerCallback #foreign libphysx; + +create_error_callback :: (error_callback: ErrorCallback, userdata: *void) -> *PxErrorCallback #foreign libphysx; + +create_assert_handler :: (on_assert: AssertHandler, userdata: *void) -> *PxAssertHandler #foreign libphysx; + +// simulation event +create_simulation_event_callbacks :: (callbacks: *SimulationEventCallbackInfo) -> *PxSimulationEventCallback #foreign libphysx; + +get_simulation_event_info :: (callback: *PxSimulationEventCallback) -> *SimulationEventCallbackInfo #foreign libphysx; + +destroy_simulation_event_callbacks :: (callback: *PxSimulationEventCallback) -> void #foreign libphysx; + +// hit report +create_user_controller_hit_report :: (callbacks: *UserControllerHitReportInfo) -> *PxUserControllerHitReport #foreign libphysx; + +get_user_controller_hit_info :: (callback: *PxUserControllerHitReport) -> *UserControllerHitReportInfo #foreign libphysx; + +destroy_user_controller_hit_report :: (callback: *PxUserControllerHitReport) -> void #foreign libphysx; + +// controller behavior +create_controller_behavior_callbacks :: (callbacks: *ControllerBehaviorCallbackInfo) -> *PxControllerBehaviorCallback #foreign libphysx; + +get_controller_behavior_info :: (callback: *PxControllerBehaviorCallback) -> *ControllerBehaviorCallbackInfo #foreign libphysx; + +destroy_controller_behavior_callbacks :: (callback: *PxControllerBehaviorCallback) -> void #foreign libphysx; + +// contact modify +create_contact_modify_callbacks :: (callbacks: *ContactModifyCallbackInfo) -> *PxContactModifyCallback #foreign libphysx; + +get_contact_modify_info :: (callback: *PxContactModifyCallback) -> *ContactModifyCallbackInfo #foreign libphysx; + +destroy_contact_modify_callbacks :: (callback: *PxContactModifyCallback) -> void #foreign libphysx; + +// ccd contact modify +create_ccd_contact_modify_callbacks :: (callbacks: *ContactModifyCallbackInfo) -> *PxCCDContactModifyCallback #foreign libphysx; + +get_ccd_contact_modify_info :: (callback: *PxCCDContactModifyCallback) -> *ContactModifyCallbackInfo #foreign libphysx; + +destroy_ccd_contact_modify_callbacks :: (callback: *PxCCDContactModifyCallback) -> void #foreign libphysx; + +// filter shader +get_default_simulation_filter_shader :: () -> SimulationFilterShader #foreign libphysx; + +set_default_filter_shader :: (desc: *PxSceneDesc) -> void #foreign libphysx; + +create_custom_filter_shader :: (filter: SimulationFilterShader) -> *FilterShaderHandle #foreign libphysx; + +destroy_custom_filter_shader :: (filterHandle: *FilterShaderHandle) -> void #foreign libphysx; + +set_custom_filter_shader :: (desc: *PxSceneDesc, filterHandle: *FilterShaderHandle) -> void #foreign libphysx; + +set_custom_filter_shader_with_default :: (desc: *PxSceneDesc, filterHandle: *FilterShaderHandle) -> void #foreign libphysx; + +// Not generated, used only for testing and examples! +PxAssertHandler_opCall :: (self: *PxErrorCallback, expr: *u8, file: *u8, line: s32, ignore: *bool) -> void #foreign libphysx "PxAssertHandler_opCall_mut"; + +#scope_file + +libphysx :: #library "linux/libphysx"; +#import "Math"; +#import "Socket"; diff --git a/modules/PhysX/module_windows.jai b/modules/PhysX/module_windows.jai new file mode 100644 index 0000000..8b7d48f --- /dev/null +++ b/modules/PhysX/module_windows.jai @@ -0,0 +1,7013 @@ +// +// This file was auto-generated using the following command: +// +// jai generate.jai +// + +PxEMPTY :: enum s32 { + PxEmpty :: 0; +} + +PxZERO :: enum s32 { + PxZero :: 0; +} + +PxIDENTITY :: enum s32 { + PxIdentity :: 0; +} + +PxErrorCode :: enum_flags s32 { + NoError :: 0; + DebugInfo :: 1; + DebugWarning :: 2; + InvalidParameter :: 4; + InvalidOperation :: 8; + OutOfMemory :: 16; + InternalError :: 32; + Abort :: 64; + PerfWarning :: 128; + MaskAll :: -1; +} + +PxThreadPriority :: enum u32 { + High :: 0; + AboveNormal :: 1; + Normal :: 2; + BelowNormal :: 3; + Low :: 4; + ForceDword :: 4294967295; +} + +PxDebugColor :: enum u32 { + ArgbBlack :: 4278190080; + ArgbRed :: 4294901760; + ArgbGreen :: 4278255360; + ArgbBlue :: 4278190335; + ArgbYellow :: 4294967040; + ArgbMagenta :: 4294902015; + ArgbCyan :: 4278255615; + ArgbWhite :: 4294967295; + ArgbGrey :: 4286611584; + ArgbDarkred :: 4287102976; + ArgbDarkgreen :: 4278224896; + ArgbDarkblue :: 4278190216; +} + +PxConcreteType :: enum s32 { + Undefined :: 0; + Heightfield :: 1; + ConvexMesh :: 2; + TriangleMeshBvh33 :: 3; + TriangleMeshBvh34 :: 4; + TetrahedronMesh :: 5; + SoftbodyMesh :: 6; + RigidDynamic :: 7; + RigidStatic :: 8; + Shape :: 9; + Material :: 10; + SoftbodyMaterial :: 11; + ClothMaterial :: 12; + PbdMaterial :: 13; + FlipMaterial :: 14; + MpmMaterial :: 15; + CustomMaterial :: 16; + Constraint :: 17; + Aggregate :: 18; + ArticulationReducedCoordinate :: 19; + ArticulationLink :: 20; + ArticulationJointReducedCoordinate :: 21; + ArticulationSensor :: 22; + ArticulationSpatialTendon :: 23; + ArticulationFixedTendon :: 24; + ArticulationAttachment :: 25; + ArticulationTendonJoint :: 26; + PruningStructure :: 27; + Bvh :: 28; + SoftBody :: 29; + SoftBodyState :: 30; + PbdParticlesystem :: 31; + FlipParticlesystem :: 32; + MpmParticlesystem :: 33; + CustomParticlesystem :: 34; + FemCloth :: 35; + HairSystem :: 36; + ParticleBuffer :: 37; + ParticleDiffuseBuffer :: 38; + ParticleClothBuffer :: 39; + ParticleRigidBuffer :: 40; + PhysxCoreCount :: 41; + FirstPhysxExtension :: 256; + FirstVehicleExtension :: 512; + FirstUserExtension :: 1024; +} + +PxBaseFlags :: enum_flags u16 { + OwnsMemory :: 1 << 0; + IsReleasable :: 1 << 1; +} + +PxMetaDataFlag :: enum_flags s32 { + Class :: 1; + Virtual :: 2; + Typedef :: 4; + Ptr :: 8; + Handle :: 16; + ExtraData :: 32; + ExtraItem :: 64; + ExtraItems :: 128; + ExtraName :: 256; + Union :: 512; + Padding :: 1024; + Alignment :: 2048; + CountMaskMsb :: 4096; + CountSkipIfOne :: 8192; + ControlFlip :: 16384; + ControlMask :: 32768; + ControlMaskRange :: 255; + ForceDword :: 2147483647; +} + +PxTaskType :: enum s32 { + Cpu :: 0; + NotPresent :: 1; + Completed :: 2; +} + +PxGeometryType :: enum s32 { + Sphere :: 0; + Plane :: 1; + Capsule :: 2; + Box :: 3; + Convexmesh :: 4; + Particlesystem :: 5; + Tetrahedronmesh :: 6; + Trianglemesh :: 7; + Heightfield :: 8; + Hairsystem :: 9; + Custom :: 10; + GeometryCount :: 11; + Invalid :: -1; +} + +PxGeometryQueryFlags :: enum_flags u32 { + SimdGuard :: 1 << 0; +} + +PxBVHBuildStrategy :: enum s32 { + Fast :: 0; + Default :: 1; + Sah :: 2; + Last :: 3; +} + +PxConvexMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; +} + +PxMeshGeometryFlags :: enum_flags u8 { + TightBounds :: 1 << 0; + DoubleSided :: 1 << 1; +} + +PxParticleSolverType :: enum_flags s32 { + Pbd :: 1; + Flip :: 2; + Mpm :: 4; + Custom :: 8; +} + +PxHitFlags :: enum_flags u16 { + 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 :: PxHitFlags.Position | PxHitFlags.Normal | PxHitFlags.FaceIndex; + ModifiableFlags :: PxHitFlags.AssumeNoInitialOverlap | PxHitFlags.MeshMultiple | PxHitFlags.MeshBothSides | PxHitFlags.PreciseSweep; +} + +PxHeightFieldFormat :: enum s32 { + S16Tm :: 1; +} + +PxHeightFieldTessFlag :: enum_flags s32 { + E0ThVertexShared :: 1; +} + +PxHeightFieldFlags :: enum_flags u16 { + NoBoundaryEdges :: 1 << 0; +} + +PxHeightFieldMaterial :: enum s32 { + Hole :: 127; +} + +PxMeshMeshQueryFlags :: enum_flags u32 { + Default :: 0; + DiscardCoplanar :: 1 << 0; +} + +PxMeshFlags :: enum_flags u16 { + Flipnormals :: 1 << 0; + E16BitIndices :: 1 << 1; +} + +PxMeshMidPhase :: enum s32 { + Bvh33 :: 0; + Bvh34 :: 1; + Last :: 2; +} + +PxTriangleMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; + AdjacencyInfo :: 1 << 2; + PreferNoSdfProj :: 1 << 3; +} + +PxTetrahedronMeshFlags :: enum_flags u8 { + E16BitIndices :: 1 << 1; +} + +PxActorFlags :: enum_flags u8 { + Visualization :: 1 << 0; + DisableGravity :: 1 << 1; + SendSleepNotifies :: 1 << 2; + DisableSimulation :: 1 << 3; +} + +PxActorType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + ArticulationLink :: 2; +} + +PxAggregateType :: enum s32 { + Generic :: 0; + Static :: 1; + Kinematic :: 2; +} + +Px1DConstraintFlags :: enum_flags u16 { + Spring :: 1 << 0; + AccelerationSpring :: 1 << 1; + Restitution :: 1 << 2; + Keepbias :: 1 << 3; + OutputForce :: 1 << 4; + HasDriveLimit :: 1 << 5; + AngularConstraint :: 1 << 6; + DriveRow :: 1 << 7; +} + +PxConstraintSolveHint :: enum s32 { + None :: 0; + Acceleration1 :: 256; + SlerpSpring :: 258; + Acceleration2 :: 512; + Acceleration3 :: 768; + RotationalEquality :: 1024; + RotationalInequality :: 1025; + Equality :: 2048; + Inequality :: 2049; +} + +PxConstraintVisualizationFlag :: enum_flags s32 { + LocalFrames :: 1; + Limits :: 2; +} + +PxPvdUpdateType :: enum s32 { + CreateInstance :: 0; + ReleaseInstance :: 1; + UpdateAllProperties :: 2; + UpdateSimProperties :: 3; +} + +ConstraintType :: enum s32 { + ContactConstraint :: 0; + JointConstraint :: 1; +} + +BodyState :: enum_flags s32 { + DynamicBody :: 1; + StaticBody :: 2; + KinematicBody :: 4; + Articulation :: 8; +} + +PxArticulationAxis :: enum s32 { + Twist :: 0; + Swing1 :: 1; + Swing2 :: 2; + X :: 3; + Y :: 4; + Z :: 5; + Count :: 6; +} + +PxArticulationMotions :: enum_flags u8 { + Locked :: 0; + Limited :: 1 << 0; + Free :: 1 << 1; +} + +PxArticulationJointType :: enum s32 { + Fix :: 0; + Prismatic :: 1; + Revolute :: 2; + RevoluteUnwrapped :: 3; + Spherical :: 4; + Undefined :: 5; +} + +PxArticulationFlags :: enum_flags u8 { + FixBase :: 1 << 0; + DriveLimitsAreForces :: 1 << 1; + DisableSelfCollision :: 1 << 2; + ComputeJointForces :: 1 << 3; +} + +PxArticulationDriveType :: enum s32 { + Force :: 0; + Acceleration :: 1; + Target :: 2; + Velocity :: 3; + None :: 4; +} + +PxArticulationGpuDataType :: enum s32 { + JointPosition :: 0; + JointVelocity :: 1; + JointAcceleration :: 2; + JointForce :: 3; + JointSolverForce :: 4; + JointTargetVelocity :: 5; + JointTargetPosition :: 6; + SensorForce :: 7; + RootTransform :: 8; + RootVelocity :: 9; + LinkTransform :: 10; + LinkVelocity :: 11; + LinkForce :: 12; + LinkTorque :: 13; + FixedTendon :: 14; + FixedTendonJoint :: 15; + SpatialTendon :: 16; + SpatialTendonAttachment :: 17; +} + +PxArticulationCacheFlags :: enum_flags u32 { + 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 :: PxArticulationCacheFlags.Velocity | PxArticulationCacheFlags.Acceleration | PxArticulationCacheFlags.Position | PxArticulationCacheFlags.LinkVelocity | PxArticulationCacheFlags.LinkAcceleration | PxArticulationCacheFlags.RootTransform | PxArticulationCacheFlags.RootVelocities; +} + +PxArticulationSensorFlags :: enum_flags u8 { + ForwardDynamicsForces :: 1 << 0; + ConstraintSolverForces :: 1 << 1; + WorldFrame :: 1 << 2; +} + +PxArticulationKinematicFlags :: enum_flags u8 { + Position :: 1 << 0; + Velocity :: 1 << 1; +} + +PxShapeFlags :: enum_flags u8 { + SimulationShape :: 1 << 0; + SceneQueryShape :: 1 << 1; + TriggerShape :: 1 << 2; + Visualization :: 1 << 3; +} + +PxForceMode :: enum s32 { + Force :: 0; + Impulse :: 1; + VelocityChange :: 2; + Acceleration :: 3; +} + +PxRigidBodyFlags :: enum_flags u16 { + 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; +} + +PxConstraintFlags :: enum_flags u16 { + Broken :: 1 << 0; + ProjectToActor0 :: 1 << 1; + ProjectToActor1 :: 1 << 2; + Projection :: PxConstraintFlags.ProjectToActor0 | PxConstraintFlags.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; +} + +PxContactPatchFlags :: enum_flags s32 { + HasFaceIndices :: 1; + Modifiable :: 2; + ForceNoResponse :: 4; + HasModifiedMassRatios :: 8; + HasTargetVelocity :: 16; + HasMaxImpulse :: 32; + RegeneratePatches :: 64; + CompressedModifiedContact :: 128; +} + +StreamFormat :: enum s32 { + SimpleStream :: 0; + ModifiableStream :: 1; + CompressedModifiableStream :: 2; +} + +PxDeletionEventFlags :: enum_flags u8 { + UserRelease :: 1 << 0; + MemoryRelease :: 1 << 1; +} + +PxPairFlags :: enum_flags u16 { + 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 :: PxPairFlags.SolveContact | PxPairFlags.DetectDiscreteContact; + TriggerDefault :: PxPairFlags.NotifyTouchFound | PxPairFlags.NotifyTouchLost | PxPairFlags.DetectDiscreteContact; +} + +PxFilterFlags :: enum_flags u16 { + Default :: 0; + Kill :: 1 << 0; + Suppress :: 1 << 1; + Callback :: 1 << 2; + Notify :: PxFilterFlags.Callback; +} + +PxFilterObjectType :: enum s32 { + RigidStatic :: 0; + RigidDynamic :: 1; + Articulation :: 2; + Particlesystem :: 3; + Softbody :: 4; + Femcloth :: 5; + Hairsystem :: 6; + MaxTypeCount :: 16; + Undefined :: 15; +} + +PxFilterObjectFlag :: enum_flags s32 { + Kinematic :: 16; + Trigger :: 32; +} + +PxPairFilteringMode :: enum s32 { + Keep :: 0; + Suppress :: 1; + Kill :: 2; +} + +PxDataAccessFlags :: enum_flags u8 { + Readable :: 1 << 0; + Writable :: 1 << 1; + Device :: 1 << 2; +} + +PxMaterialFlags :: enum_flags u16 { + DisableFriction :: 1 << 0; + DisableStrongFriction :: 1 << 1; + ImprovedPatchFriction :: 1 << 2; + CompliantContact :: 1 << 3; +} + +PxRigidDynamicLockFlags :: enum_flags u8 { + LockLinearX :: 1 << 0; + LockLinearY :: 1 << 1; + LockLinearZ :: 1 << 2; + LockAngularX :: 1 << 3; + LockAngularY :: 1 << 4; + LockAngularZ :: 1 << 5; +} + +PxSceneFlags :: enum_flags u32 { + 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; +} + +PxConvexFlags :: enum_flags u16 { + 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; +} + +PxConvexMeshCookingResult :: enum s32 { + /// Convex mesh cooking succeeded. + Success :: 0; + /// Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + ZeroAreaTestFailed :: 1; + /// Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + /// The produced hull does not contain all input vertices. Try to simplify the input vertices + /// or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + PolygonsLimitReached :: 2; + /// Something unrecoverable happened. Check the error stream to find out what. + Failure :: 3; +} + +PxDefaultCpuDispatcherWaitForWorkMode :: enum s32 { + WaitForWork :: 0; + YieldThread :: 1; + YieldProcessor :: 2; +} + +PxControllerShapeType :: enum s32 { + /// A box controller. + Box :: 0; + /// A capsule controller + Capsule :: 1; + /// A capsule controller + ForceDword :: 2147483647; +} + +PxControllerNonWalkableMode :: enum s32 { + /// Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + PreventClimbing :: 0; + /// Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + PreventClimbingAndForceSliding :: 1; +} + +PxControllerCollisionFlags :: enum_flags u8 { + CollisionSides :: 1 << 0; + CollisionUp :: 1 << 1; + CollisionDown :: 1 << 2; +} + +PxCapsuleClimbingMode :: enum s32 { + /// Standard mode, let the capsule climb over surfaces according to impact normal + Easy :: 0; + /// Constrained mode, try to limit climbing according to the step offset + Constrained :: 1; + Last :: 2; +} + +PxControllerBehaviorFlags :: enum_flags u8 { + /// Controller can ride on touched object (i.e. when this touched object is moving horizontally). + /// + /// The CCT vs. CCT case is not supported. + CctCanRideOnObject :: 1; + /// Controller should slide on touched object + CctSlide :: 2; + /// Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + CctUserDefinedRide :: 4; +} + +PxQueryHitType :: enum s32 { + /// the query should ignore this shape + None :: 0; + /// a hit on the shape touches the intersection geometry of the query but does not block it + Touch :: 1; + /// a hit on the shape blocks the query (does not block overlap queries) + Block :: 2; +} + +PxQueryFlags :: enum_flags u16 { + Static :: 1 << 0; + Dynamic :: 1 << 1; + Prefilter :: 1 << 2; + Postfilter :: 1 << 3; + AnyHit :: 1 << 4; + NoBlock :: 1 << 5; + DisableHardcodedFilter :: 1 << 6; + Reserved :: 1 << 15; +} + +PxBroadPhaseType :: enum s32 { + /// 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; +} + +PxCombineMode :: enum s32 { + /// Average: (a + b)/2 + Average :: 0; + /// Minimum: minimum(a,b) + Min :: 1; + /// Multiply: a*b + Multiply :: 2; + /// Maximum: maximum(a,b) + Max :: 3; +} + +PxD6Axis :: enum s32 { + /// motion along the X axis + X :: 0; + /// motion along the Y axis + Y :: 1; + /// motion along the Z axis + Z :: 2; + /// motion around the X axis + Twist :: 3; + /// motion around the Y axis + Swing1 :: 4; + /// motion around the Z axis + Swing2 :: 5; + Count :: 6; +} + +PxD6Motion :: enum s32 { + /// The DOF is locked, it does not allow relative motion. + Locked :: 0; + /// The DOF is limited, it only allows motion within a specific range. + Limited :: 1; + /// The DOF is free and has its full range of motion. + Free :: 2; +} + +PxRevoluteJointFlags :: enum_flags u16 { + LimitEnabled :: 1 << 0; + DriveEnabled :: 1 << 1; + DriveFreespin :: 1 << 2; +} + +PxDistanceJointFlags :: enum_flags u16 { + MaxDistanceEnabled :: 1 << 1; + MinDistanceEnabled :: 1 << 2; + SpringEnabled :: 1 << 3; +} + + + +_MSC_VER :: 1939; +NDEBUG :: 1; +PxMat34 :: struct {} + +PxAllocatorCallback :: struct { + vtable_: *void; +} + +PxAssertHandler :: struct { + vtable_: *void; +} + +PxFoundation :: struct { + vtable_: *void; +} + +PxAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxRawAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxVirtualAllocatorCallback :: struct { + vtable_: *void; +} + +PxVirtualAllocator :: struct { + structgen_pad0: [16] u8; +} + +PxUserAllocated :: struct { + structgen_pad0: [1] u8; +} + +PxTempAllocatorChunk :: union { + mNext: *PxTempAllocatorChunk; + mIndex: u32; + mPad: [16] u8; +} + +PxTempAllocator :: struct { + structgen_pad0: [1] u8; +} + +PxLogTwo :: struct {} +PxUnConst :: struct {} +PxBitAndByte :: struct { + structgen_pad0: [1] u8; +} + +PxBitMap :: struct { + structgen_pad0: [16] u8; +} + +PxVec3Padded :: struct { + x: float; + y: float; + z: float; + padding: u32; +} + +PxTransform :: struct { + q: Quaternion; + p: Vector3; +} + +PxTransformPadded :: struct { + transform: PxTransform; + padding: u32; +} + +PxMat33 :: struct { + column0: Vector3; + column1: Vector3; + column2: Vector3; +} + +PxBounds3 :: struct { + minimum: Vector3; + maximum: Vector3; +} + +PxErrorCallback :: struct { + vtable_: *void; +} + +PxAllocationListener :: struct { + vtable_: *void; +} + +PxBroadcastingAllocator :: struct { + structgen_pad0: [176] u8; +} + +PxBroadcastingErrorCallback :: struct { + structgen_pad0: [160] u8; +} + +PxHash :: struct {} +PxInputStream :: struct { + vtable_: *void; +} + +PxInputData :: struct { + vtable_: *void; +} + +PxOutputStream :: struct { + vtable_: *void; +} + +PxMat44 :: struct { + column0: Vector4; + column1: Vector4; + column2: Vector4; + column3: Vector4; +} + +Interpolation :: struct { + structgen_pad0: [1] u8; +} + +PxMutexImpl :: struct { + structgen_pad0: [1] u8; +} + +PxReadWriteLock :: struct { + structgen_pad0: [8] u8; +} + +PxProfilerCallback :: struct { + vtable_: *void; +} + +PxProfileScoped :: struct { + mCallback: *PxProfilerCallback; + mEventName: *u8; + mProfilerData: *void; + mContextId: u64; + mDetached: bool; + structgen_pad0: [7] u8; +} + +PxSListEntry :: struct { + structgen_pad0: [16] u8; +} + +PxSListImpl :: struct { + structgen_pad0: [1] u8; +} + +PxSyncImpl :: struct { + structgen_pad0: [1] u8; +} + +PxRunnable :: struct { + vtable_: *void; +} + +PxCounterFrequencyToTensOfNanos :: struct { + mNumerator: u64; + mDenominator: u64; +} + +PxTime :: struct { + structgen_pad0: [8] u8; +} + +PxStridedData :: struct { + stride: u32; + structgen_pad0: [4] u8; + data: *void; +} + +PxBoundedData :: struct { + stride: u32; + structgen_pad0: [4] u8; + data: *void; + count: u32; + structgen_pad1: [4] u8; +} + +PxDebugPoint :: struct { + pos: Vector3; + color: u32; +} + +PxDebugLine :: struct { + pos0: Vector3; + color0: u32; + pos1: Vector3; + color1: u32; +} + +PxDebugTriangle :: struct { + pos0: Vector3; + color0: u32; + pos1: Vector3; + color1: u32; + pos2: Vector3; + color2: u32; +} + +PxDebugText :: struct { + position: Vector3; + size: float; + color: u32; + structgen_pad0: [4] u8; + _string: *u8; +} + +PxRenderBuffer :: struct { + vtable_: *void; +} + +PxProcessPxBaseCallback :: struct { + vtable_: *void; +} + +PxSerializationContext :: struct { + vtable_: *void; +} + +PxDeserializationContext :: struct { + structgen_pad0: [16] u8; +} + +PxSerializationRegistry :: struct { + vtable_: *void; +} + +PxCollection :: struct { + vtable_: *void; +} + +PxTypeInfo :: struct {} + +PxFEMSoftBodyMaterial :: struct {} +PxFEMClothMaterial :: struct {} +PxPBDMaterial :: struct {} +PxFLIPMaterial :: struct {} +PxMPMMaterial :: struct {} +PxCustomMaterial :: struct {} + +PxBVH33TriangleMesh :: struct {} + +PxParticleSystem :: struct {} +PxPBDParticleSystem :: struct {} +PxFLIPParticleSystem :: struct {} +PxMPMParticleSystem :: struct {} +PxCustomParticleSystem :: struct {} +PxSoftBody :: struct {} +PxFEMCloth :: struct {} +PxHairSystem :: struct {} +PxParticleBuffer :: struct {} +PxParticleAndDiffuseBuffer :: struct {} +PxParticleClothBuffer :: struct {} +PxParticleRigidBuffer :: struct {} +PxBase :: struct { + structgen_pad0: [16] u8; +} + +PxRefCounted :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as base: PxBase = ---; +} + +PxTolerancesScale :: struct { + length: float; + speed: float; +} + +PxStringTable :: struct { + vtable_: *void; +} + +PxSerializer :: struct { + vtable_: *void; +} + +PxMetaDataEntry :: struct { + type: *u8; + name: *u8; + offset: u32; + size: u32; + count: u32; + offsetSize: u32; + flags: u32; + alignment: u32; +} + +PxInsertionCallback :: struct { + vtable_: *void; +} + +PxTaskManager :: struct { + vtable_: *void; +} + +PxCpuDispatcher :: struct { + vtable_: *void; +} + +PxBaseTask :: struct { + structgen_pad0: [24] u8; +} + +PxTask :: struct { + structgen_pad0: [32] u8; +} + +PxLightCpuTask :: struct { + structgen_pad0: [40] u8; +} + +PxGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +} + +PxBoxGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + halfExtents: Vector3; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxBVHRaycastCallback :: struct { + vtable_: *void; +} + +PxBVHOverlapCallback :: struct { + vtable_: *void; +} + +PxBVHTraversalCallback :: struct { + vtable_: *void; +} + +PxBVH :: struct { + structgen_pad0: [16] u8; +} + +PxCapsuleGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + radius: float; + halfHeight: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHullPolygon :: struct { + mPlane: [4] float; + mNbVerts: u16; + mIndexBase: u16; +} + +PxConvexMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxMeshScale :: struct { + scale: Vector3; + rotation: Quaternion; +} + +PxConvexMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + scale: PxMeshScale; + structgen_pad1: [4] u8; + convexMesh: *PxConvexMesh; + meshFlags: u8; + structgen_pad2: [7] u8; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxSphereGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + radius: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxPlaneGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxTriangleMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + scale: PxMeshScale; + meshFlags: u8; + structgen_pad1: [3] u8; + triangleMesh: *PxTriangleMesh; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHeightFieldGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + heightField: *PxHeightField; + heightScale: float; + rowScale: float; + columnScale: float; + heightFieldFlags: u8; + structgen_pad1: [3] u8; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxParticleSystemGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + mSolverType: s32; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxHairSystemGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxTetrahedronMeshGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + tetrahedronMesh: *PxTetrahedronMesh; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxQueryHit :: struct { + faceIndex: u32; +} + +PxLocationHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; +} + +PxGeomRaycastHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + u: float; + v: float; +} + +PxGeomOverlapHit :: struct { + faceIndex: u32; +} + +PxGeomSweepHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; +} + +PxGeomIndexPair :: struct { + id0: u32; + id1: u32; +} + +PxQueryThreadContext :: struct { + structgen_pad0: [1] u8; +} + +PxContactBuffer :: struct {} +PxRenderOutput :: struct {} + +PxCustomGeometryType :: struct { + structgen_pad0: [4] u8; +} + +PxCustomGeometryCallbacks :: struct { + vtable_: *void; +} + +PxCustomGeometry :: struct { + structgen_pad0: [4] u8; + mTypePadding: float; + callbacks: *PxCustomGeometryCallbacks; +#place structgen_pad0; #as geometry: PxGeometry = ---; +} + +PxGeometryHolder :: struct { + structgen_pad0: [56] u8; +} + +PxGeometryQuery :: struct { + structgen_pad0: [1] u8; +} + +PxHeightFieldSample :: struct { + height: s16; + materialIndex0: PxBitAndByte; + materialIndex1: PxBitAndByte; +} + +PxHeightField :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxHeightFieldDesc :: struct { + nbRows: u32; + nbColumns: u32; + format: s32; + structgen_pad0: [4] u8; + samples: PxStridedData; + convexEdgeThreshold: float; + flags: u16; + structgen_pad1: [2] u8; +} + +PxMeshQuery :: struct { + structgen_pad0: [1] u8; +} + +PxSimpleTriangleMesh :: struct { + points: PxBoundedData; + triangles: PxBoundedData; + flags: u16; + structgen_pad0: [6] u8; +} + +PxTriangle :: struct { + verts: [3] Vector3; +} + +PxTrianglePadded :: struct { + verts: [3] Vector3; + padding: u32; +} + +PxTriangleMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxBVH34TriangleMesh :: struct { + structgen_pad0: [16] u8; +} + +PxTetrahedron :: struct { + verts: [4] Vector3; +} + +PxSoftBodyAuxData :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxTetrahedronMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxSoftBodyMesh :: struct { + structgen_pad0: [16] u8; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxCollisionMeshMappingData :: struct { + structgen_pad0: [8] u8; +} + +PxSoftBodyCollisionData :: struct { + structgen_pad0: [1] u8; +} + +PxTetrahedronMeshData :: struct { + structgen_pad0: [1] u8; +} + +PxSoftBodySimulationData :: struct { + structgen_pad0: [1] u8; +} + +PxCollisionTetrahedronMeshData :: struct { + structgen_pad0: [8] u8; +} + +PxSimulationTetrahedronMeshData :: struct { + structgen_pad0: [8] u8; +} + +PxActor :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxAggregate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxSpringModifiers :: struct { + stiffness: float; + damping: float; + structgen_pad0: [8] u8; +} + +PxRestitutionModifiers :: struct { + restitution: float; + velocityThreshold: float; + structgen_pad0: [8] u8; +} + +Px1DConstraintMods :: union { + spring: PxSpringModifiers; + bounce: PxRestitutionModifiers; +} + +Px1DConstraint :: struct { + linear0: Vector3; + geometricError: float; + angular0: Vector3; + velocityTarget: float; + linear1: Vector3; + minImpulse: float; + angular1: Vector3; + maxImpulse: float; + mods: Px1DConstraintMods; + forInternalUse: float; + flags: u16; + solveHint: u16; + structgen_pad0: [8] u8; +} + +PxConstraintInvMassScale :: struct { + linear0: float; + angular0: float; + linear1: float; + angular1: float; +} + +PxConstraintVisualizer :: struct { + vtable_: *void; +} + +PxConstraintConnector :: struct { + vtable_: *void; +} + +PxContactPoint :: struct { + normal: Vector3; + separation: float; + point: Vector3; + maxImpulse: float; + targetVel: Vector3; + staticFriction: float; + materialFlags: u8; + structgen_pad0: [3] u8; + internalFaceIndex1: u32; + dynamicFriction: float; + restitution: float; + damping: float; + structgen_pad1: [12] u8; +} + +PxSolverBody :: struct { + linearVelocity: Vector3; + maxSolverNormalProgress: u16; + maxSolverFrictionProgress: u16; + angularState: Vector3; + solverProgress: u32; +} + +PxSolverBodyData :: struct { + linearVelocity: Vector3; + invMass: float; + angularVelocity: Vector3; + reportThreshold: float; + sqrtInvInertia: PxMat33; + penBiasClamp: float; + nodeIndex: u32; + maxContactImpulse: float; + body2World: PxTransform; + pad: u16; + structgen_pad0: [2] u8; +} + +PxConstraintBatchHeader :: struct { + startIndex: u32; + stride: u16; + constraintType: u16; +} + +PxSolverConstraintDesc :: struct { + structgen_pad0: [16] u8; + bodyADataIndex: u32; + bodyBDataIndex: u32; + linkIndexA: u32; + linkIndexB: u32; + constraint: *u8; + writeBack: *void; + progressA: u16; + progressB: u16; + constraintLengthOver16: u16; + padding: [10] u8; +} + +PxSolverConstraintPrepDescBase :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; +} + +PxSolverConstraintPrepDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; + rows: *Px1DConstraint; + numRows: u32; + linBreakForce: float; + angBreakForce: float; + minResponseThreshold: float; + writeback: *void; + disablePreprocessing: bool; + improvedSlerp: bool; + driveLimitsAreForces: bool; + extendedLimits: bool; + disableConstraint: bool; + structgen_pad1: [3] u8; + body0WorldOffset: PxVec3Padded; + structgen_pad2: [8] u8; +} + +PxSolverContactDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxSolverBody; + body1: *PxSolverBody; + data0: *PxSolverBodyData; + data1: *PxSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; + shapeInteraction: *void; + contacts: *PxContactPoint; + numContacts: u32; + hasMaxImpulse: bool; + disableStrongFriction: bool; + hasForceThresholds: bool; + structgen_pad1: [1] u8; + restDistance: float; + maxCCDSeparation: float; + frictionPtr: *u8; + frictionCount: u8; + structgen_pad2: [7] u8; + contactForces: *float; + startFrictionPatchIndex: u32; + numFrictionPatches: u32; + startContactPatchIndex: u32; + numContactPatches: u16; + axisConstraintCount: u16; + offsetSlop: float; + structgen_pad3: [4] u8; +} + +PxConstraintAllocator :: struct { + vtable_: *void; +} + +PxArticulationLimit :: struct { + low: float; + high: float; +} + +PxArticulationDrive :: struct { + stiffness: float; + damping: float; + maxForce: float; + driveType: s32; +} + +PxTGSSolverBodyVel :: struct { + linearVelocity: Vector3; + nbStaticInteractions: u16; + maxDynamicPartition: u16; + angularVelocity: Vector3; + partitionMask: u32; + deltaAngDt: Vector3; + maxAngVel: float; + deltaLinDt: Vector3; + lockFlags: u16; + isKinematic: bool; + pad: u8; +} + +PxTGSSolverBodyTxInertia :: struct { + deltaBody2World: PxTransform; + sqrtInvInertia: PxMat33; +} + +PxTGSSolverBodyData :: struct { + originalLinearVelocity: Vector3; + maxContactImpulse: float; + originalAngularVelocity: Vector3; + penBiasClamp: float; + invMass: float; + nodeIndex: u32; + reportThreshold: float; + pad: u32; +} + +PxTGSSolverConstraintPrepDescBase :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; +} + +PxTGSSolverConstraintPrepDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; + rows: *Px1DConstraint; + numRows: u32; + linBreakForce: float; + angBreakForce: float; + minResponseThreshold: float; + writeback: *void; + disablePreprocessing: bool; + improvedSlerp: bool; + driveLimitsAreForces: bool; + extendedLimits: bool; + disableConstraint: bool; + structgen_pad1: [3] u8; + body0WorldOffset: PxVec3Padded; + cA2w: PxVec3Padded; + cB2w: PxVec3Padded; + structgen_pad2: [8] u8; +} + +PxTGSSolverContactDesc :: struct { + invMassScales: PxConstraintInvMassScale; + desc: *PxSolverConstraintDesc; + body0: *PxTGSSolverBodyVel; + body1: *PxTGSSolverBodyVel; + body0TxI: *PxTGSSolverBodyTxInertia; + body1TxI: *PxTGSSolverBodyTxInertia; + bodyData0: *PxTGSSolverBodyData; + bodyData1: *PxTGSSolverBodyData; + bodyFrame0: PxTransform; + bodyFrame1: PxTransform; + bodyState0: s32; + bodyState1: s32; + structgen_pad0: [8] u8; + shapeInteraction: *void; + contacts: *PxContactPoint; + numContacts: u32; + hasMaxImpulse: bool; + disableStrongFriction: bool; + hasForceThresholds: bool; + structgen_pad1: [1] u8; + restDistance: float; + maxCCDSeparation: float; + frictionPtr: *u8; + frictionCount: u8; + structgen_pad2: [7] u8; + contactForces: *float; + startFrictionPatchIndex: u32; + numFrictionPatches: u32; + startContactPatchIndex: u32; + numContactPatches: u16; + axisConstraintCount: u16; + maxImpulse: float; + torsionalPatchRadius: float; + minTorsionalPatchRadius: float; + offsetSlop: float; + structgen_pad3: [8] u8; +} + +PxArticulationTendonLimit :: struct { + lowLimit: float; + highLimit: float; +} + +PxArticulationAttachment :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationTendonJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationSpatialTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationFixedTendon :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxSpatialForce :: struct { + force: Vector3; + pad0: float; + torque: Vector3; + pad1: float; +} + +PxSpatialVelocity :: struct { + linear: Vector3; + pad0: float; + angular: Vector3; + pad1: float; +} + +PxArticulationRootLinkData :: struct { + transform: PxTransform; + worldLinVel: Vector3; + worldAngVel: Vector3; + worldLinAccel: Vector3; + worldAngAccel: Vector3; +} + +PxArticulationCache :: struct { + externalForces: *PxSpatialForce; + denseJacobian: *float; + massMatrix: *float; + jointVelocity: *float; + jointAcceleration: *float; + jointPosition: *float; + jointForce: *float; + jointSolverForces: *float; + linkVelocity: *PxSpatialVelocity; + linkAcceleration: *PxSpatialVelocity; + rootLinkData: *PxArticulationRootLinkData; + sensorForces: *PxSpatialForce; + coefficientMatrix: *float; + lambda: *float; + scratchMemory: *void; + scratchAllocator: *void; + version: u32; + structgen_pad0: [4] u8; +} + +PxArticulationSensor :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationReducedCoordinate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxArticulationJointReducedCoordinate :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxShape :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxRigidActor :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as actor: PxActor = ---; +} + +PxNodeIndex :: struct { + structgen_pad0: [8] u8; +} + +PxRigidBody :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_actor: PxRigidActor = ---; +} + +PxArticulationLink :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_body: PxRigidBody = ---; +} + +PxConeLimitedConstraint :: struct { + mAxis: Vector3; + mAngle: float; + mLowLimit: float; + mHighLimit: float; +} + +PxConeLimitParams :: struct { + lowHighLimits: Vector4; + axisAngle: Vector4; +} + +PxConstraintShaderTable :: struct { + solverPrep: *void; + structgen_pad0: [8] u8; + visualize: *void; + flag: s32; + structgen_pad1: [4] u8; +} + +PxConstraint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxMassModificationProps :: struct { + mInvMassScale0: float; + mInvInertiaScale0: float; + mInvMassScale1: float; + mInvInertiaScale1: float; +} + +PxContactPatch :: struct { + mMassModification: PxMassModificationProps; + normal: Vector3; + restitution: float; + dynamicFriction: float; + staticFriction: float; + damping: float; + startContactIndex: u16; + nbContacts: u8; + materialFlags: u8; + internalFlags: u16; + materialIndex0: u16; + materialIndex1: u16; + pad: [5] u16; +} + +PxContact :: struct { + contact: Vector3; + separation: float; +} + +PxExtendedContact :: struct { + contact: Vector3; + separation: float; + targetVelocity: Vector3; + maxImpulse: float; +} + +PxModifiableContact :: struct { + contact: Vector3; + separation: float; + targetVelocity: Vector3; + maxImpulse: float; + normal: Vector3; + restitution: float; + materialFlags: u32; + materialIndex0: u16; + materialIndex1: u16; + staticFriction: float; + dynamicFriction: float; +} + +PxContactStreamIterator :: struct { + zero: Vector3; + structgen_pad0: [4] u8; + patch: *PxContactPatch; + contact: *PxContact; + faceIndice: *u32; + totalPatches: u32; + totalContacts: u32; + nextContactIndex: u32; + nextPatchIndex: u32; + contactPatchHeaderSize: u32; + contactPointSize: u32; + mStreamFormat: s32; + forceNoResponse: u32; + pointStepped: bool; + structgen_pad1: [3] u8; + hasFaceIndices: u32; +} + +PxGpuContactPair :: struct { + contactPatches: *u8; + contactPoints: *u8; + contactForces: *float; + transformCacheRef0: u32; + transformCacheRef1: u32; + nodeIndex0: PxNodeIndex; + nodeIndex1: PxNodeIndex; + actor0: *PxActor; + actor1: *PxActor; + nbContacts: u16; + nbPatches: u16; + structgen_pad0: [4] u8; +} + +PxContactSet :: struct { + structgen_pad0: [16] u8; +} + +PxContactModifyPair :: struct { + actor: [2] *PxRigidActor; + shape: [2] *PxShape; + transform: [2] PxTransform; + contacts: PxContactSet; +} + +PxContactModifyCallback :: struct { + vtable_: *void; +} + +PxCCDContactModifyCallback :: struct { + vtable_: *void; +} + +PxDeletionListener :: struct { + vtable_: *void; +} + +PxBaseMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as ref_counted: PxRefCounted = ---; +} + +PxFEMMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxFilterData :: struct { + word0: u32; + word1: u32; + word2: u32; + word3: u32; +} + +PxSimulationFilterCallback :: struct { + vtable_: *void; +} + +PxParticleRigidFilterPair :: struct { + mID0: u64; + mID1: u64; +} + +PxLockedData :: struct { + vtable_: *void; +} + +PxMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as base_material: PxBaseMaterial = ---; +} + +PxGpuParticleBufferIndexPair :: struct { + systemIndex: u32; + bufferIndex: u32; +} + +PxCudaContextManager :: struct {} +PxParticleRigidAttachment :: struct {} +PxParticleVolume :: struct { + bound: PxBounds3; + particleIndicesOffset: u32; + numParticles: u32; +} + +PxDiffuseParticleParams :: struct { + threshold: float; + lifetime: float; + airDrag: float; + bubbleDrag: float; + buoyancy: float; + kineticEnergyWeight: float; + pressureWeight: float; + divergenceWeight: float; + collisionDecay: float; + useAccurateVelocity: bool; + structgen_pad0: [3] u8; +} + +PxParticleSpring :: struct { + ind0: u32; + ind1: u32; + length: float; + stiffness: float; + damping: float; + pad: float; +} + +PxParticleMaterial :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxOmniPvd :: struct {} +PxPhysics :: struct { + vtable_: *void; +} + +PxActorShape :: struct { + actor: *PxRigidActor; + shape: *PxShape; +} + +PxRaycastHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + u: float; + v: float; + structgen_pad1: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxOverlapHit :: struct { + faceIndex: u32; + structgen_pad0: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxSweepHit :: struct { + faceIndex: u32; + flags: u16; + structgen_pad0: [2] u8; + position: Vector3; + normal: Vector3; + distance: float; + structgen_pad1: [4] u8; + actor: *PxRigidActor; + shape: *PxShape; +} + +PxRaycastCallback :: struct { + structgen_pad0: [8] u8; + block: PxRaycastHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxRaycastHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxOverlapCallback :: struct { + structgen_pad0: [8] u8; + block: PxOverlapHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxOverlapHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxSweepCallback :: struct { + structgen_pad0: [8] u8; + block: PxSweepHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxSweepHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxRaycastBuffer :: struct { + structgen_pad0: [8] u8; + block: PxRaycastHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxRaycastHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxOverlapBuffer :: struct { + structgen_pad0: [8] u8; + block: PxOverlapHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxOverlapHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxSweepBuffer :: struct { + structgen_pad0: [8] u8; + block: PxSweepHit; + hasBlock: bool; + structgen_pad1: [7] u8; + touches: *PxSweepHit; + maxNbTouches: u32; + nbTouches: u32; +} + +PxQueryCache :: struct { + shape: *PxShape; + actor: *PxRigidActor; + faceIndex: u32; + structgen_pad0: [4] u8; +} + +PxQueryFilterData :: struct { + data: PxFilterData; + flags: u16; + structgen_pad0: [2] u8; +} + +PxQueryFilterCallback :: struct { + vtable_: *void; +} + +PxRigidDynamic :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_body: PxRigidBody = ---; +} + +PxRigidStatic :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as rigid_actor: PxRigidActor = ---; +} + +PxSceneQueryDesc :: struct { + staticStructure: s32; + dynamicStructure: s32; + dynamicTreeRebuildRateHint: u32; + dynamicTreeSecondaryPruner: s32; + staticBVHBuildStrategy: s32; + dynamicBVHBuildStrategy: s32; + staticNbObjectsPerNode: u32; + dynamicNbObjectsPerNode: u32; + sceneQueryUpdateMode: s32; +} + +PxSceneQuerySystemBase :: struct { + vtable_: *void; +} + +PxSceneSQSystem :: struct { + vtable_: *void; +} + +PxSceneQuerySystem :: struct { + vtable_: *void; +} + +PxBroadPhaseRegion :: struct { + mBounds: PxBounds3; + mUserData: *void; +} + +PxBroadPhaseRegionInfo :: struct { + mRegion: PxBroadPhaseRegion; + mNbStaticObjects: u32; + mNbDynamicObjects: u32; + mActive: bool; + mOverlap: bool; + structgen_pad0: [6] u8; +} + +PxBroadPhaseCaps :: struct { + mMaxNbRegions: u32; +} + +PxBroadPhaseDesc :: struct { + mType: s32; + structgen_pad0: [4] u8; + mContextID: u64; + structgen_pad1: [8] u8; + mFoundLostPairsCapacity: u32; + mDiscardStaticVsKinematic: bool; + mDiscardKinematicVsKinematic: bool; + structgen_pad2: [2] u8; +} + +PxBroadPhaseUpdateData :: struct { + mCreated: *u32; + mNbCreated: u32; + structgen_pad0: [4] u8; + mUpdated: *u32; + mNbUpdated: u32; + structgen_pad1: [4] u8; + mRemoved: *u32; + mNbRemoved: u32; + structgen_pad2: [4] u8; + mBounds: *PxBounds3; + mGroups: *u32; + mDistances: *float; + mCapacity: u32; + structgen_pad3: [4] u8; +} + +PxBroadPhasePair :: struct { + mID0: u32; + mID1: u32; +} + +PxBroadPhaseResults :: struct { + mNbCreatedPairs: u32; + structgen_pad0: [4] u8; + mCreatedPairs: *PxBroadPhasePair; + mNbDeletedPairs: u32; + structgen_pad1: [4] u8; + mDeletedPairs: *PxBroadPhasePair; +} + +PxBroadPhaseRegions :: struct { + vtable_: *void; +} + +PxBroadPhase :: struct { + vtable_: *void; +} + +PxAABBManager :: struct { + vtable_: *void; +} + +PxSceneLimits :: struct { + maxNbActors: u32; + maxNbBodies: u32; + maxNbStaticShapes: u32; + maxNbDynamicShapes: u32; + maxNbAggregates: u32; + maxNbConstraints: u32; + maxNbRegions: u32; + maxNbBroadPhaseOverlaps: u32; +} + +PxgDynamicsMemoryConfig :: struct { + tempBufferCapacity: u32; + maxRigidContactCount: u32; + maxRigidPatchCount: u32; + heapCapacity: u32; + foundLostPairsCapacity: u32; + foundLostAggregatePairsCapacity: u32; + totalAggregatePairsCapacity: u32; + maxSoftBodyContacts: u32; + maxFemClothContacts: u32; + maxParticleContacts: u32; + collisionStackSize: u32; + maxHairContacts: u32; +} + +PxSceneDesc :: struct { + staticStructure: s32; + dynamicStructure: s32; + dynamicTreeRebuildRateHint: u32; + dynamicTreeSecondaryPruner: s32; + staticBVHBuildStrategy: s32; + dynamicBVHBuildStrategy: s32; + staticNbObjectsPerNode: u32; + dynamicNbObjectsPerNode: u32; + sceneQueryUpdateMode: s32; + gravity: Vector3; + simulationEventCallback: *PxSimulationEventCallback; + contactModifyCallback: *PxContactModifyCallback; + ccdContactModifyCallback: *PxCCDContactModifyCallback; + filterShaderData: *void; + filterShaderDataSize: u32; + structgen_pad0: [4] u8; + filterShader: *void; + filterCallback: *PxSimulationFilterCallback; + kineKineFilteringMode: s32; + staticKineFilteringMode: s32; + broadPhaseType: s32; + structgen_pad1: [4] u8; + broadPhaseCallback: *PxBroadPhaseCallback; + limits: PxSceneLimits; + frictionType: s32; + solverType: s32; + bounceThresholdVelocity: float; + frictionOffsetThreshold: float; + frictionCorrelationDistance: float; + flags: u32; + cpuDispatcher: *PxCpuDispatcher; + structgen_pad2: [8] u8; + userData: *void; + solverBatchSize: u32; + solverArticulationBatchSize: u32; + nbContactDataBlocks: u32; + maxNbContactDataBlocks: u32; + maxBiasCoefficient: float; + contactReportStreamBufferSize: u32; + ccdMaxPasses: u32; + ccdThreshold: float; + ccdMaxSeparation: float; + wakeCounterResetValue: float; + sanityBounds: PxBounds3; + gpuDynamicsConfig: PxgDynamicsMemoryConfig; + gpuMaxNumPartitions: u32; + gpuMaxNumStaticPartitions: u32; + gpuComputeVersion: u32; + contactPairSlabSize: u32; + sceneQuerySystem: *PxSceneQuerySystem; + structgen_pad3: [8] u8; +} + +PxSimulationStatistics :: struct { + nbActiveConstraints: u32; + nbActiveDynamicBodies: u32; + nbActiveKinematicBodies: u32; + nbStaticBodies: u32; + nbDynamicBodies: u32; + nbKinematicBodies: u32; + nbShapes: [11] u32; + nbAggregates: u32; + nbArticulations: u32; + nbAxisSolverConstraints: u32; + compressedContactSize: u32; + requiredContactConstraintMemory: u32; + peakConstraintMemory: u32; + nbDiscreteContactPairsTotal: u32; + nbDiscreteContactPairsWithCacheHits: u32; + nbDiscreteContactPairsWithContacts: u32; + nbNewPairs: u32; + nbLostPairs: u32; + nbNewTouches: u32; + nbLostTouches: u32; + nbPartitions: u32; + structgen_pad0: [4] u8; + gpuMemParticles: u64; + gpuMemSoftBodies: u64; + gpuMemFEMCloths: u64; + gpuMemHairSystems: u64; + gpuMemHeap: u64; + gpuMemHeapBroadPhase: u64; + gpuMemHeapNarrowPhase: u64; + gpuMemHeapSolver: u64; + gpuMemHeapArticulation: u64; + gpuMemHeapSimulation: u64; + gpuMemHeapSimulationArticulation: u64; + gpuMemHeapSimulationParticles: u64; + gpuMemHeapSimulationSoftBody: u64; + gpuMemHeapSimulationFEMCloth: u64; + gpuMemHeapSimulationHairSystem: u64; + gpuMemHeapParticles: u64; + gpuMemHeapSoftBodies: u64; + gpuMemHeapFEMCloths: u64; + gpuMemHeapHairSystems: u64; + gpuMemHeapOther: u64; + nbBroadPhaseAdds: u32; + nbBroadPhaseRemoves: u32; + nbDiscreteContactPairs: [11] [11] u32; + nbCCDPairs: [11] [11] u32; + nbModifiedContactPairs: [11] [11] u32; + nbTriggerPairs: [11] [11] u32; +} + +PxGpuBodyData :: struct { + quat: Quaternion; + pos: Vector4; + linVel: Vector4; + angVel: Vector4; +} + +PxGpuActorPair :: struct { + srcIndex: u32; + structgen_pad0: [4] u8; + nodeIndex: PxNodeIndex; +} + +PxIndexDataPair :: struct { + index: u32; + structgen_pad0: [4] u8; + data: *void; +} + +PxPvdSceneClient :: struct { + vtable_: *void; +} + +PxDominanceGroupPair :: struct { + dominance0: u8; + dominance1: u8; +} + +PxBroadPhaseCallback :: struct { + vtable_: *void; +} + +PxPvdSceneFlag :: enum_flags s32 +{ + TRANSMIT_CONTACTS :: 1 << 0; //! Transmits contact stream to PVD. + TRANSMIT_SCENEQUERIES :: 1 << 1; //! Transmits scene query stream to PVD. + TRANSMIT_CONSTRAINTS :: 1 << 2; //! Transmits constraints visualize stream to PVD. +} + +PxScene :: struct { + structgen_pad0: [8] u8; + userData: *void; +} + +PxSceneReadLock :: struct { + structgen_pad0: [8] u8; +} + +PxSceneWriteLock :: struct { + structgen_pad0: [8] u8; +} + +PxContactPairExtraDataItem :: struct { + type: u8; +} + +PxContactPairVelocity :: struct { + type: u8; + structgen_pad0: [3] u8; + linearVelocity: [2] Vector3; + angularVelocity: [2] Vector3; +} + +PxContactPairPose :: struct { + type: u8; + structgen_pad0: [3] u8; + globalPose: [2] PxTransform; +} + +PxContactPairIndex :: struct { + type: u8; + structgen_pad0: [1] u8; + index: u16; +} + +PxContactPairExtraDataIterator :: struct { + currPtr: *u8; + endPtr: *u8; + preSolverVelocity: *PxContactPairVelocity; + postSolverVelocity: *PxContactPairVelocity; + eventPose: *PxContactPairPose; + contactPairIndex: u32; + structgen_pad0: [4] u8; +} + +PxContactPairHeader :: struct { + actors: [2] *PxActor; + extraDataStream: *u8; + extraDataStreamSize: u16; + flags: u16; + structgen_pad0: [4] u8; + pairs: *PxContactPair; + nbPairs: u32; + structgen_pad1: [4] u8; +} + +PxContactPairPoint :: struct { + position: Vector3; + separation: float; + normal: Vector3; + internalFaceIndex0: u32; + impulse: Vector3; + internalFaceIndex1: u32; +} + +PxContactPair :: struct { + shapes: [2] *PxShape; + contactPatches: *u8; + contactPoints: *u8; + contactImpulses: *float; + requiredBufferSize: u32; + contactCount: u8; + patchCount: u8; + contactStreamSize: u16; + flags: u16; + events: u16; + internalData: [2] u32; + structgen_pad0: [4] u8; +} + +PxTriggerPair :: struct { + triggerShape: *PxShape; + triggerActor: *PxActor; + otherShape: *PxShape; + otherActor: *PxActor; + status: s32; + flags: u8; + structgen_pad0: [3] u8; +} + +PxConstraintInfo :: struct { + constraint: *PxConstraint; + externalReference: *void; + type: u32; + structgen_pad0: [4] u8; +} + +PxSimulationEventCallback :: struct { + vtable_: *void; +} + +PxFEMParameters :: struct { + velocityDamping: float; + settlingThreshold: float; + sleepThreshold: float; + sleepDamping: float; + selfCollisionFilterDistance: float; + selfCollisionStressTolerance: float; +} + +PxPruningStructure :: struct { + structgen_pad0: [16] u8; +} + +PxExtendedVec3 :: struct { + x: float64; + y: float64; + z: float64; +} + +PxObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; +} + +PxBoxObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; + mHalfExtents: Vector3; + structgen_pad1: [4] u8; +} + +PxCapsuleObstacle :: struct { + structgen_pad0: [8] u8; + mUserData: *void; + mPos: PxExtendedVec3; + mRot: Quaternion; + mHalfHeight: float; + mRadius: float; +} + +PxObstacleContext :: struct { + vtable_: *void; +} + +PxControllerState :: struct { + deltaXP: Vector3; + structgen_pad0: [4] u8; + touchedShape: *PxShape; + touchedActor: *PxRigidActor; + touchedObstacleHandle: u32; + collisionFlags: u32; + standOnAnotherCCT: bool; + standOnObstacle: bool; + isMovingUp: bool; + structgen_pad1: [5] u8; +} + +PxControllerStats :: struct { + nbIterations: u16; + nbFullUpdates: u16; + nbPartialUpdates: u16; + nbTessellation: u16; +} + +PxControllerHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; +} + +PxControllerShapeHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + shape: *PxShape; + actor: *PxRigidActor; + triangleIndex: u32; + structgen_pad1: [4] u8; +} + +PxControllersHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + other: *PxController; +} + +PxControllerObstacleHit :: struct { + controller: *PxController; + worldPos: PxExtendedVec3; + worldNormal: Vector3; + dir: Vector3; + length: float; + structgen_pad0: [4] u8; + userData: *void; +} + +PxUserControllerHitReport :: struct { + vtable_: *void; +} + +PxControllerFilterCallback :: struct { + vtable_: *void; +} + +PxControllerFilters :: struct { + mFilterData: *PxFilterData; + mFilterCallback: *PxQueryFilterCallback; + mFilterFlags: u16; + structgen_pad0: [6] u8; + mCCTFilterCallback: *PxControllerFilterCallback; +} + +PxControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [8] u8; +} + +PxController :: struct { + vtable_: *void; +} + +PxBoxControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [8] u8; + halfHeight: float; + halfSideExtent: float; + halfForwardExtent: float; + structgen_pad5: [4] u8; +#place structgen_pad0; #as controller_desc: PxControllerDesc = ---; +} + +PxBoxController :: struct { + vtable_: *void; +#place vtable_; #as controller: PxController = ---; +} + +PxCapsuleControllerDesc :: struct { + structgen_pad0: [8] u8; + position: PxExtendedVec3; + upDirection: Vector3; + slopeLimit: float; + invisibleWallHeight: float; + maxJumpHeight: float; + contactOffset: float; + stepOffset: float; + density: float; + scaleCoeff: float; + volumeGrowth: float; + structgen_pad1: [4] u8; + reportCallback: *PxUserControllerHitReport; + behaviorCallback: *PxControllerBehaviorCallback; + nonWalkableMode: s32; + structgen_pad2: [4] u8; + material: *PxMaterial; + registerDeletionListener: bool; + clientID: u8; + structgen_pad3: [6] u8; + userData: *void; + structgen_pad4: [8] u8; + radius: float; + height: float; + climbingMode: s32; + structgen_pad5: [4] u8; +#place structgen_pad0; #as controller_desc: PxControllerDesc = ---; +} + +PxCapsuleController :: struct { + vtable_: *void; +#place vtable_; #as controller: PxController = ---; +} + +PxControllerBehaviorCallback :: struct { + vtable_: *void; +} + +PxControllerManager :: struct { + vtable_: *void; +} + +PxDim3 :: struct { + x: u32; + y: u32; + z: u32; +} + +PxSDFDesc :: struct { + sdf: PxBoundedData; + dims: PxDim3; + meshLower: Vector3; + spacing: float; + subgridSize: u32; + bitsPerSubgridPixel: s32; + sdfSubgrids3DTexBlockDim: PxDim3; + sdfSubgrids: PxBoundedData; + sdfStartSlots: PxBoundedData; + subgridsMinSdfValue: float; + subgridsMaxSdfValue: float; + sdfBounds: PxBounds3; + narrowBandThicknessRelativeToSdfBoundsDiagonal: float; + numThreadsForSdfConstruction: u32; +} + +PxConvexMeshDesc :: struct { + points: PxBoundedData; + polygons: PxBoundedData; + indices: PxBoundedData; + flags: u16; + vertexLimit: u16; + polygonLimit: u16; + quantizedCount: u16; + sdfDesc: *PxSDFDesc; +} + +PxTriangleMeshDesc :: struct { + points: PxBoundedData; + triangles: PxBoundedData; + flags: u16; + structgen_pad0: [22] u8; + sdfDesc: *PxSDFDesc; +} + +PxTetrahedronMeshDesc :: struct { + structgen_pad0: [16] u8; + points: PxBoundedData; + tetrahedrons: PxBoundedData; + flags: u16; + tetsPerElement: u16; + structgen_pad1: [4] u8; +} + +PxSoftBodySimulationDataDesc :: struct { + vertexToTet: PxBoundedData; +} + +PxBVH34MidphaseDesc :: struct { + numPrimsPerLeaf: u32; + buildStrategy: s32; + quantized: bool; + structgen_pad0: [3] u8; +} + +PxMidphaseDesc :: struct { + structgen_pad0: [16] u8; +} + +PxBVHDesc :: struct { + bounds: PxBoundedData; + enlargement: float; + numPrimsPerLeaf: u32; + buildStrategy: s32; + structgen_pad0: [4] u8; +} + +PxCookingParams :: struct { + areaTestEpsilon: float; + planeTolerance: float; + convexMeshCookingType: s32; + suppressTriangleMeshRemapTable: bool; + buildTriangleAdjacencies: bool; + buildGPUData: bool; + structgen_pad0: [1] u8; + scale: PxTolerancesScale; + meshPreprocessParams: u32; + meshWeldTolerance: float; + midphaseDesc: PxMidphaseDesc; + gaussMapLimit: u32; + maxWeightRatioInTet: float; +} + +PxDefaultMemoryOutputStream :: struct { + structgen_pad0: [32] u8; +#place structgen_pad0; #as output_stream: PxOutputStream = ---; +} + +PxDefaultMemoryInputData :: struct { + structgen_pad0: [32] u8; +#place structgen_pad0; #as input_stream: PxInputStream = ---; +} + +PxDefaultFileOutputStream :: struct { + structgen_pad0: [16] u8; +} + +PxDefaultFileInputData :: struct { + structgen_pad0: [24] u8; +} + +PxDefaultAllocator :: struct { + vtable_: *void; +} + +PxJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as base: PxBase = ---; +} + +PxSpring :: struct { + stiffness: float; + damping: float; +} + +PxDistanceJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxJacobianRow :: struct { + linear0: Vector3; + linear1: Vector3; + angular0: Vector3; + angular1: Vector3; +} + +PxContactJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxFixedJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxJointLimitParameters :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; +} + +PxJointLinearLimit :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + value: float; +} + +PxJointLinearLimitPair :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + upper: float; + lower: float; +} + +PxJointAngularLimitPair :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + upper: float; + lower: float; +} + +PxJointLimitCone :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + yAngle: float; + zAngle: float; +} + +PxJointLimitPyramid :: struct { + restitution: float; + bounceThreshold: float; + stiffness: float; + damping: float; + contactDistance_deprecated: float; + yAngleMin: float; + yAngleMax: float; + zAngleMin: float; + zAngleMax: float; +} + +PxPrismaticJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxRevoluteJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxSphericalJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxD6JointDrive :: struct { + stiffness: float; + damping: float; + forceLimit: float; + flags: u32; +} + +PxD6Joint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxGearJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +#place structgen_pad0; #as joint: PxJoint = ---; +} + +PxRackAndPinionJoint :: struct { + structgen_pad0: [16] u8; + userData: *void; +} + +PxGroupsMask :: struct { + bits0: u16; + bits1: u16; + bits2: u16; + bits3: u16; +} + +PxDefaultErrorCallback :: struct { + vtable_: *void; +} + +PxRigidActorExt :: struct { + structgen_pad0: [1] u8; +} + +PxMassProperties :: struct { + inertiaTensor: PxMat33; + centerOfMass: Vector3; + mass: float; +} + +PxRigidBodyExt :: struct { + structgen_pad0: [1] u8; +} + +PxShapeExt :: struct { + structgen_pad0: [1] u8; +} + +PxMeshOverlapUtil :: struct { + structgen_pad0: [1040] u8; +} + +PxBinaryConverter :: struct {} +PxXmlMiscParameter :: struct { + upVector: Vector3; + scale: PxTolerancesScale; +} + +PxSerialization :: struct { + structgen_pad0: [1] u8; +} + +PxDefaultCpuDispatcher :: struct { + vtable_: *void; +} + +PxStringTableExt :: struct { + structgen_pad0: [1] u8; +} + +PxBroadPhaseExt :: struct { + structgen_pad0: [1] u8; +} + +PxSceneQueryExt :: struct { + structgen_pad0: [1] u8; +} + +PxBatchQueryExt :: struct { + vtable_: *void; +} + +PxCustomSceneQuerySystem :: struct { + vtable_: *void; +} + +PxCustomSceneQuerySystemAdapter :: struct { + vtable_: *void; +} + +PxSamplingExt :: struct { + structgen_pad0: [1] u8; +} + +PxPoissonSampler :: struct { + structgen_pad0: [8] u8; +} + +PxTriangleMeshPoissonSampler :: struct { + structgen_pad0: [24] u8; +} + +PxTetrahedronMeshExt :: struct { + structgen_pad0: [1] u8; +} + +PxRepXObject :: struct { + typeName: *u8; + serializable: *void; + id: u64; +} + +PxCooking :: struct {} +PxRepXInstantiationArgs :: struct { + structgen_pad0: [8] u8; + cooker: *PxCooking; + stringTable: *PxStringTable; +} + +XmlMemoryAllocator :: struct {} +XmlWriter :: struct {} +XmlReader :: struct {} +MemoryBuffer :: struct {} +PxRepXSerializer :: struct { + vtable_: *void; +} + +PxVehicleWheels4SimData :: struct {} +PxVehicleWheels4DynData :: struct {} +PxVehicleTireForceCalculator :: struct {} +PxVehicleDrivableSurfaceToTireFrictionPairs :: struct {} +PxVehicleTelemetryData :: struct {} + +PxPvd :: struct { + vtable_: *void; +} + +PxPvdTransport :: struct { + vtable_: *void; +} + +PxAllocatorCallback_delete :: (self: *PxAllocatorCallback) -> void #foreign physx; + +PxAllocatorCallback_allocate :: (self: *PxAllocatorCallback, size: u64, typeName: *u8, filename: *u8, line: s32) -> *void #foreign physx "PxAllocatorCallback_allocate_mut"; + +PxAllocatorCallback_deallocate :: (self: *PxAllocatorCallback, ptr: *void) -> void #foreign physx "PxAllocatorCallback_deallocate_mut"; + +PxAssertHandler_delete :: (self: *PxAssertHandler) -> void #foreign physx; + +PxGetAssertHandler :: () -> *PxAssertHandler #foreign physx "phys_PxGetAssertHandler"; + +PxSetAssertHandler :: (handler: *PxAssertHandler) -> void #foreign physx "phys_PxSetAssertHandler"; + +PxFoundation_release :: (self: *PxFoundation) -> void #foreign physx "PxFoundation_release_mut"; + +PxFoundation_getErrorCallback :: (self: *PxFoundation) -> *PxErrorCallback #foreign physx "PxFoundation_getErrorCallback_mut"; + +PxFoundation_setErrorLevel :: (self: *PxFoundation, mask: u32) -> void #foreign physx "PxFoundation_setErrorLevel_mut"; + +PxFoundation_getErrorLevel :: (self: *PxFoundation) -> u32 #foreign physx; + +PxFoundation_getAllocatorCallback :: (self: *PxFoundation) -> *PxAllocatorCallback #foreign physx "PxFoundation_getAllocatorCallback_mut"; + +PxFoundation_getReportAllocationNames :: (self: *PxFoundation) -> bool #foreign physx; + +PxFoundation_setReportAllocationNames :: (self: *PxFoundation, value: bool) -> void #foreign physx "PxFoundation_setReportAllocationNames_mut"; + +PxFoundation_registerAllocationListener :: (self: *PxFoundation, listener: *PxAllocationListener) -> void #foreign physx "PxFoundation_registerAllocationListener_mut"; + +PxFoundation_deregisterAllocationListener :: (self: *PxFoundation, listener: *PxAllocationListener) -> void #foreign physx "PxFoundation_deregisterAllocationListener_mut"; + +PxFoundation_registerErrorCallback :: (self: *PxFoundation, callback: *PxErrorCallback) -> void #foreign physx "PxFoundation_registerErrorCallback_mut"; + +PxFoundation_deregisterErrorCallback :: (self: *PxFoundation, callback: *PxErrorCallback) -> void #foreign physx "PxFoundation_deregisterErrorCallback_mut"; + +PxCreateFoundation :: (version: u32, allocator: *PxAllocatorCallback, errorCallback: *PxErrorCallback) -> *PxFoundation #foreign physx "phys_PxCreateFoundation"; + +PxSetFoundationInstance :: (foundation: *PxFoundation) -> void #foreign physx "phys_PxSetFoundationInstance"; + +PxGetFoundation :: () -> *PxFoundation #foreign physx "phys_PxGetFoundation"; + +PxGetProfilerCallback :: () -> *PxProfilerCallback #foreign physx "phys_PxGetProfilerCallback"; + +PxSetProfilerCallback :: (profiler: *PxProfilerCallback) -> void #foreign physx "phys_PxSetProfilerCallback"; + +PxGetAllocatorCallback :: () -> *PxAllocatorCallback #foreign physx "phys_PxGetAllocatorCallback"; + +PxGetBroadcastAllocator :: () -> *PxAllocatorCallback #foreign physx "phys_PxGetBroadcastAllocator"; + +PxGetErrorCallback :: () -> *PxErrorCallback #foreign physx "phys_PxGetErrorCallback"; + +PxGetBroadcastError :: () -> *PxErrorCallback #foreign physx "phys_PxGetBroadcastError"; + +PxGetWarnOnceTimeStamp :: () -> u32 #foreign physx "phys_PxGetWarnOnceTimeStamp"; + +PxDecFoundationRefCount :: () -> void #foreign physx "phys_PxDecFoundationRefCount"; + +PxIncFoundationRefCount :: () -> void #foreign physx "phys_PxIncFoundationRefCount"; + +PxAllocator_new :: (anon_param0: *u8) -> PxAllocator #foreign physx; + +PxAllocator_allocate :: (self: *PxAllocator, size: u64, file: *u8, line: s32) -> *void #foreign physx "PxAllocator_allocate_mut"; + +PxAllocator_deallocate :: (self: *PxAllocator, ptr: *void) -> void #foreign physx "PxAllocator_deallocate_mut"; + +PxRawAllocator_new :: (anon_param0: *u8) -> PxRawAllocator #foreign physx; + +PxRawAllocator_allocate :: (self: *PxRawAllocator, size: u64, anon_param1: *u8, anon_param2: s32) -> *void #foreign physx "PxRawAllocator_allocate_mut"; + +PxRawAllocator_deallocate :: (self: *PxRawAllocator, ptr: *void) -> void #foreign physx "PxRawAllocator_deallocate_mut"; + +PxVirtualAllocatorCallback_delete :: (self: *PxVirtualAllocatorCallback) -> void #foreign physx; + +PxVirtualAllocatorCallback_allocate :: (self: *PxVirtualAllocatorCallback, size: u64, group: s32, file: *u8, line: s32) -> *void #foreign physx "PxVirtualAllocatorCallback_allocate_mut"; + +PxVirtualAllocatorCallback_deallocate :: (self: *PxVirtualAllocatorCallback, ptr: *void) -> void #foreign physx "PxVirtualAllocatorCallback_deallocate_mut"; + +PxVirtualAllocator_new :: (callback: *PxVirtualAllocatorCallback, group: s32) -> PxVirtualAllocator #foreign physx; + +PxVirtualAllocator_allocate :: (self: *PxVirtualAllocator, size: u64, file: *u8, line: s32) -> *void #foreign physx "PxVirtualAllocator_allocate_mut"; + +PxVirtualAllocator_deallocate :: (self: *PxVirtualAllocator, ptr: *void) -> void #foreign physx "PxVirtualAllocator_deallocate_mut"; + +PxTempAllocatorChunk_new :: () -> PxTempAllocatorChunk #foreign physx; + +PxTempAllocator_new :: (anon_param0: *u8) -> PxTempAllocator #foreign physx; + +PxTempAllocator_allocate :: (self: *PxTempAllocator, size: u64, file: *u8, line: s32) -> *void #foreign physx "PxTempAllocator_allocate_mut"; + +PxTempAllocator_deallocate :: (self: *PxTempAllocator, ptr: *void) -> void #foreign physx "PxTempAllocator_deallocate_mut"; + +PxMemZero :: (dest: *void, count: u32) -> *void #foreign physx "phys_PxMemZero"; + +PxMemSet :: (dest: *void, c: s32, count: u32) -> *void #foreign physx "phys_PxMemSet"; + +PxMemCopy :: (dest: *void, src: *void, count: u32) -> *void #foreign physx "phys_PxMemCopy"; + +PxMemMove :: (dest: *void, src: *void, count: u32) -> *void #foreign physx "phys_PxMemMove"; + +PxMarkSerializedMemory :: (ptr: *void, byteSize: u32) -> void #foreign physx "phys_PxMarkSerializedMemory"; + +PxMemoryBarrier :: () -> void #foreign physx "phys_PxMemoryBarrier"; + +PxHighestSetBitUnsafe :: (v: u32) -> u32 #foreign physx "phys_PxHighestSetBitUnsafe"; + +PxLowestSetBitUnsafe :: (v: u32) -> u32 #foreign physx "phys_PxLowestSetBitUnsafe"; + +PxCountLeadingZeros :: (v: u32) -> u32 #foreign physx "phys_PxCountLeadingZeros"; + +PxPrefetchLine :: (ptr: *void, offset: u32) -> void #foreign physx "phys_PxPrefetchLine"; + +PxPrefetch :: (ptr: *void, count: u32) -> void #foreign physx "phys_PxPrefetch"; + +PxBitCount :: (v: u32) -> u32 #foreign physx "phys_PxBitCount"; + +PxIsPowerOfTwo :: (x: u32) -> bool #foreign physx "phys_PxIsPowerOfTwo"; + +PxNextPowerOfTwo :: (x: u32) -> u32 #foreign physx "phys_PxNextPowerOfTwo"; + +PxLowestSetBit :: (x: u32) -> u32 #foreign physx "phys_PxLowestSetBit"; + +PxHighestSetBit :: (x: u32) -> u32 #foreign physx "phys_PxHighestSetBit"; + +PxILog2 :: (num: u32) -> u32 #foreign physx "phys_PxILog2"; + +PxVec3_new :: () -> Vector3 #foreign physx; + +PxVec3_new :: (anon_param0: s32) -> Vector3 #foreign physx "PxVec3_new_1"; + +PxVec3_new :: (a: float) -> Vector3 #foreign physx "PxVec3_new_2"; + +PxVec3_new :: (nx: float, ny: float, nz: float) -> Vector3 #foreign physx "PxVec3_new_3"; + +PxVec3_isZero :: (self: *Vector3) -> bool #foreign physx; + +PxVec3_isFinite :: (self: *Vector3) -> bool #foreign physx; + +PxVec3_isNormalized :: (self: *Vector3) -> bool #foreign physx; + +PxVec3_magnitudeSquared :: (self: *Vector3) -> float #foreign physx; + +PxVec3_magnitude :: (self: *Vector3) -> float #foreign physx; + +PxVec3_dot :: (self: *Vector3, v: *Vector3) -> float #foreign physx; + +PxVec3_cross :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign physx; + +PxVec3_getNormalized :: (self: *Vector3) -> Vector3 #foreign physx; + +PxVec3_normalize :: (self: *Vector3) -> float #foreign physx "PxVec3_normalize_mut"; + +PxVec3_normalizeSafe :: (self: *Vector3) -> float #foreign physx "PxVec3_normalizeSafe_mut"; + +PxVec3_normalizeFast :: (self: *Vector3) -> float #foreign physx "PxVec3_normalizeFast_mut"; + +PxVec3_multiply :: (self: *Vector3, a: *Vector3) -> Vector3 #foreign physx; + +PxVec3_minimum :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign physx; + +PxVec3_minElement :: (self: *Vector3) -> float #foreign physx; + +PxVec3_maximum :: (self: *Vector3, v: *Vector3) -> Vector3 #foreign physx; + +PxVec3_maxElement :: (self: *Vector3) -> float #foreign physx; + +PxVec3_abs :: (self: *Vector3) -> Vector3 #foreign physx; + +PxVec3Padded_new_alloc :: () -> *PxVec3Padded #foreign physx; + +PxVec3Padded_delete :: (self: *PxVec3Padded) -> void #foreign physx; + +PxVec3Padded_new_alloc :: (p: *Vector3) -> *PxVec3Padded #foreign physx "PxVec3Padded_new_alloc_1"; + +PxVec3Padded_new_alloc :: (f: float) -> *PxVec3Padded #foreign physx "PxVec3Padded_new_alloc_2"; + +PxQuat_new :: (anon_param0: s32) -> Quaternion #foreign physx "PxQuat_new_1"; + +PxQuat_new :: (r: float) -> Quaternion #foreign physx "PxQuat_new_2"; + +PxQuat_new :: (nx: float, ny: float, nz: float, nw: float) -> Quaternion #foreign physx "PxQuat_new_3"; + +PxQuat_new :: (angleRadians: float, unitAxis: *Vector3) -> Quaternion #foreign physx "PxQuat_new_4"; + +PxQuat_new :: (m: *PxMat33) -> Quaternion #foreign physx "PxQuat_new_5"; + +PxQuat_isIdentity :: (self: *Quaternion) -> bool #foreign physx; + +PxQuat_isFinite :: (self: *Quaternion) -> bool #foreign physx; + +PxQuat_isUnit :: (self: *Quaternion) -> bool #foreign physx; + +PxQuat_isSane :: (self: *Quaternion) -> bool #foreign physx; + +PxQuat_toRadiansAndUnitAxis :: (self: *Quaternion, angle: *float, axis: *Vector3) -> void #foreign physx; + +PxQuat_getAngle :: (self: *Quaternion) -> float #foreign physx; + +PxQuat_getAngle :: (self: *Quaternion, q: *Quaternion) -> float #foreign physx "PxQuat_getAngle_1"; + +PxQuat_magnitudeSquared :: (self: *Quaternion) -> float #foreign physx; + +PxQuat_dot :: (self: *Quaternion, v: *Quaternion) -> float #foreign physx; + +PxQuat_getNormalized :: (self: *Quaternion) -> Quaternion #foreign physx; + +PxQuat_magnitude :: (self: *Quaternion) -> float #foreign physx; + +PxQuat_normalize :: (self: *Quaternion) -> float #foreign physx "PxQuat_normalize_mut"; + +PxQuat_getConjugate :: (self: *Quaternion) -> Quaternion #foreign physx; + +PxQuat_getImaginaryPart :: (self: *Quaternion) -> Vector3 #foreign physx; + +PxQuat_getBasisVector0 :: (self: *Quaternion) -> Vector3 #foreign physx; + +PxQuat_getBasisVector1 :: (self: *Quaternion) -> Vector3 #foreign physx; + +PxQuat_getBasisVector2 :: (self: *Quaternion) -> Vector3 #foreign physx; + +PxQuat_rotate :: (self: *Quaternion, v: *Vector3) -> Vector3 #foreign physx; + +PxQuat_rotateInv :: (self: *Quaternion, v: *Vector3) -> Vector3 #foreign physx; + +PxTransform_new :: (position: *Vector3) -> PxTransform #foreign physx "PxTransform_new_1"; + +PxTransform_new :: (anon_param0: s32) -> PxTransform #foreign physx "PxTransform_new_2"; + +PxTransform_new :: (orientation: *Quaternion) -> PxTransform #foreign physx "PxTransform_new_3"; + +PxTransform_new :: (x: float, y: float, z: float, aQ: Quaternion) -> PxTransform #foreign physx "PxTransform_new_4"; + +PxTransform_new :: (p0: *Vector3, q0: *Quaternion) -> PxTransform #foreign physx "PxTransform_new_5"; + +PxTransform_new :: (m: *PxMat44) -> PxTransform #foreign physx "PxTransform_new_6"; + +PxTransform_getInverse :: (self: *PxTransform) -> PxTransform #foreign physx; + +PxTransform_transform :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign physx; + +PxTransform_transformInv :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign physx; + +PxTransform_rotate :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign physx; + +PxTransform_rotateInv :: (self: *PxTransform, input: *Vector3) -> Vector3 #foreign physx; + +PxTransform_transform :: (self: *PxTransform, src: *PxTransform) -> PxTransform #foreign physx "PxTransform_transform_1"; + +PxTransform_isValid :: (self: *PxTransform) -> bool #foreign physx; + +PxTransform_isSane :: (self: *PxTransform) -> bool #foreign physx; + +PxTransform_isFinite :: (self: *PxTransform) -> bool #foreign physx; + +PxTransform_transformInv :: (self: *PxTransform, src: *PxTransform) -> PxTransform #foreign physx "PxTransform_transformInv_1"; + +PxTransform_getNormalized :: (self: *PxTransform) -> PxTransform #foreign physx; + +PxMat33_new :: () -> PxMat33 #foreign physx; + +PxMat33_new :: (col0: *Vector3, col1: *Vector3, col2: *Vector3) -> PxMat33 #foreign physx "PxMat33_new_3"; + +PxMat33_new :: (r: float) -> PxMat33 #foreign physx "PxMat33_new_4"; + +PxMat33_new :: (values: *float) -> PxMat33 #foreign physx "PxMat33_new_5"; + +PxMat33_new :: (q: *Quaternion) -> PxMat33 #foreign physx "PxMat33_new_6"; + +PxMat33_createDiagonal :: (d: *Vector3) -> PxMat33 #foreign physx; + +PxMat33_outer :: (a: *Vector3, b: *Vector3) -> PxMat33 #foreign physx; + +PxMat33_getTranspose :: (self: *PxMat33) -> PxMat33 #foreign physx; + +PxMat33_getInverse :: (self: *PxMat33) -> PxMat33 #foreign physx; + +PxMat33_getDeterminant :: (self: *PxMat33) -> float #foreign physx; + +PxMat33_transform :: (self: *PxMat33, other: *Vector3) -> Vector3 #foreign physx; + +PxMat33_transformTranspose :: (self: *PxMat33, other: *Vector3) -> Vector3 #foreign physx; + +PxMat33_front :: (self: *PxMat33) -> *float #foreign physx; + +PxBounds3_new :: () -> PxBounds3 #foreign physx; + +PxBounds3_new :: (minimum: *Vector3, maximum: *Vector3) -> PxBounds3 #foreign physx "PxBounds3_new_1"; + +PxBounds3_empty :: () -> PxBounds3 #foreign physx; + +PxBounds3_boundsOfPoints :: (v0: *Vector3, v1: *Vector3) -> PxBounds3 #foreign physx; + +PxBounds3_centerExtents :: (center: *Vector3, extent: *Vector3) -> PxBounds3 #foreign physx; + +PxBounds3_basisExtent :: (center: *Vector3, basis: *PxMat33, extent: *Vector3) -> PxBounds3 #foreign physx; + +PxBounds3_poseExtent :: (pose: *PxTransform, extent: *Vector3) -> PxBounds3 #foreign physx; + +PxBounds3_transformSafe :: (matrix: *PxMat33, bounds: *PxBounds3) -> PxBounds3 #foreign physx; + +PxBounds3_transformFast :: (matrix: *PxMat33, bounds: *PxBounds3) -> PxBounds3 #foreign physx; + +PxBounds3_transformSafe :: (transform: *PxTransform, bounds: *PxBounds3) -> PxBounds3 #foreign physx "PxBounds3_transformSafe_1"; + +PxBounds3_transformFast :: (transform: *PxTransform, bounds: *PxBounds3) -> PxBounds3 #foreign physx "PxBounds3_transformFast_1"; + +PxBounds3_setEmpty :: (self: *PxBounds3) -> void #foreign physx "PxBounds3_setEmpty_mut"; + +PxBounds3_setMaximal :: (self: *PxBounds3) -> void #foreign physx "PxBounds3_setMaximal_mut"; + +PxBounds3_include :: (self: *PxBounds3, v: *Vector3) -> void #foreign physx "PxBounds3_include_mut"; + +PxBounds3_include_mut :: (self: *PxBounds3, b: *PxBounds3) -> void #foreign physx "PxBounds3_include_mut_1"; + +PxBounds3_isEmpty :: (self: *PxBounds3) -> bool #foreign physx; + +PxBounds3_intersects :: (self: *PxBounds3, b: *PxBounds3) -> bool #foreign physx; + +PxBounds3_intersects1D :: (self: *PxBounds3, a: *PxBounds3, axis: u32) -> bool #foreign physx; + +PxBounds3_contains :: (self: *PxBounds3, v: *Vector3) -> bool #foreign physx; + +PxBounds3_isInside :: (self: *PxBounds3, box: *PxBounds3) -> bool #foreign physx; + +PxBounds3_getCenter :: (self: *PxBounds3) -> Vector3 #foreign physx; + +PxBounds3_getCenter :: (self: *PxBounds3, axis: u32) -> float #foreign physx "PxBounds3_getCenter_1"; + +PxBounds3_getExtents :: (self: *PxBounds3, axis: u32) -> float #foreign physx; + +PxBounds3_getDimensions :: (self: *PxBounds3) -> Vector3 #foreign physx; + +PxBounds3_getExtents :: (self: *PxBounds3) -> Vector3 #foreign physx "PxBounds3_getExtents_1"; + +PxBounds3_scaleSafe :: (self: *PxBounds3, scale: float) -> void #foreign physx "PxBounds3_scaleSafe_mut"; + +PxBounds3_scaleFast :: (self: *PxBounds3, scale: float) -> void #foreign physx "PxBounds3_scaleFast_mut"; + +PxBounds3_fattenSafe :: (self: *PxBounds3, distance: float) -> void #foreign physx "PxBounds3_fattenSafe_mut"; + +PxBounds3_fattenFast :: (self: *PxBounds3, distance: float) -> void #foreign physx "PxBounds3_fattenFast_mut"; + +PxBounds3_isFinite :: (self: *PxBounds3) -> bool #foreign physx; + +PxBounds3_isValid :: (self: *PxBounds3) -> bool #foreign physx; + +PxBounds3_closestPoint :: (self: *PxBounds3, p: *Vector3) -> Vector3 #foreign physx; + +PxErrorCallback_delete :: (self: *PxErrorCallback) -> void #foreign physx; + +PxErrorCallback_reportError :: (self: *PxErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign physx "PxErrorCallback_reportError_mut"; + +PxAllocationListener_onAllocation :: (self: *PxAllocationListener, size: u64, typeName: *u8, filename: *u8, line: s32, allocatedMemory: *void) -> void #foreign physx "PxAllocationListener_onAllocation_mut"; + +PxAllocationListener_onDeallocation :: (self: *PxAllocationListener, allocatedMemory: *void) -> void #foreign physx "PxAllocationListener_onDeallocation_mut"; + +PxBroadcastingAllocator_new_alloc :: (allocator: *PxAllocatorCallback, error: *PxErrorCallback) -> *PxBroadcastingAllocator #foreign physx; + +PxBroadcastingAllocator_delete :: (self: *PxBroadcastingAllocator) -> void #foreign physx; + +PxBroadcastingAllocator_allocate :: (self: *PxBroadcastingAllocator, size: u64, typeName: *u8, filename: *u8, line: s32) -> *void #foreign physx "PxBroadcastingAllocator_allocate_mut"; + +PxBroadcastingAllocator_deallocate :: (self: *PxBroadcastingAllocator, ptr: *void) -> void #foreign physx "PxBroadcastingAllocator_deallocate_mut"; + +PxBroadcastingErrorCallback_new_alloc :: (errorCallback: *PxErrorCallback) -> *PxBroadcastingErrorCallback #foreign physx; + +PxBroadcastingErrorCallback_delete :: (self: *PxBroadcastingErrorCallback) -> void #foreign physx; + +PxBroadcastingErrorCallback_reportError :: (self: *PxBroadcastingErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign physx "PxBroadcastingErrorCallback_reportError_mut"; + +PxEnableFPExceptions :: () -> void #foreign physx "phys_PxEnableFPExceptions"; + +PxDisableFPExceptions :: () -> void #foreign physx "phys_PxDisableFPExceptions"; + +PxInputStream_read :: (self: *PxInputStream, dest: *void, count: u32) -> u32 #foreign physx "PxInputStream_read_mut"; + +PxInputStream_delete :: (self: *PxInputStream) -> void #foreign physx; + +PxInputData_getLength :: (self: *PxInputData) -> u32 #foreign physx; + +PxInputData_seek :: (self: *PxInputData, offset: u32) -> void #foreign physx "PxInputData_seek_mut"; + +PxInputData_tell :: (self: *PxInputData) -> u32 #foreign physx; + +PxInputData_delete :: (self: *PxInputData) -> void #foreign physx; + +PxOutputStream_write :: (self: *PxOutputStream, src: *void, count: u32) -> u32 #foreign physx "PxOutputStream_write_mut"; + +PxOutputStream_delete :: (self: *PxOutputStream) -> void #foreign physx; + +PxVec4_new :: () -> Vector4 #foreign physx; + +PxVec4_new :: (anon_param0: s32) -> Vector4 #foreign physx "PxVec4_new_1"; + +PxVec4_new :: (a: float) -> Vector4 #foreign physx "PxVec4_new_2"; + +PxVec4_new :: (nx: float, ny: float, nz: float, nw: float) -> Vector4 #foreign physx "PxVec4_new_3"; + +PxVec4_new :: (v: *Vector3, nw: float) -> Vector4 #foreign physx "PxVec4_new_4"; + +PxVec4_new :: (v: *float) -> Vector4 #foreign physx "PxVec4_new_5"; + +PxVec4_isZero :: (self: *Vector4) -> bool #foreign physx; + +PxVec4_isFinite :: (self: *Vector4) -> bool #foreign physx; + +PxVec4_isNormalized :: (self: *Vector4) -> bool #foreign physx; + +PxVec4_magnitudeSquared :: (self: *Vector4) -> float #foreign physx; + +PxVec4_magnitude :: (self: *Vector4) -> float #foreign physx; + +PxVec4_dot :: (self: *Vector4, v: *Vector4) -> float #foreign physx; + +PxVec4_getNormalized :: (self: *Vector4) -> Vector4 #foreign physx; + +PxVec4_normalize :: (self: *Vector4) -> float #foreign physx "PxVec4_normalize_mut"; + +PxVec4_multiply :: (self: *Vector4, a: *Vector4) -> Vector4 #foreign physx; + +PxVec4_minimum :: (self: *Vector4, v: *Vector4) -> Vector4 #foreign physx; + +PxVec4_maximum :: (self: *Vector4, v: *Vector4) -> Vector4 #foreign physx; + +PxVec4_getXYZ :: (self: *Vector4) -> Vector3 #foreign physx; + +PxMat44_new :: () -> PxMat44 #foreign physx; + +PxMat44_new :: (col0: *Vector4, col1: *Vector4, col2: *Vector4, col3: *Vector4) -> PxMat44 #foreign physx "PxMat44_new_3"; + +PxMat44_new :: (r: float) -> PxMat44 #foreign physx "PxMat44_new_4"; + +PxMat44_new :: (col0: *Vector3, col1: *Vector3, col2: *Vector3, col3: *Vector3) -> PxMat44 #foreign physx "PxMat44_new_5"; + +PxMat44_new :: (values: *float) -> PxMat44 #foreign physx "PxMat44_new_6"; + +PxMat44_new :: (q: *Quaternion) -> PxMat44 #foreign physx "PxMat44_new_7"; + +PxMat44_new :: (diagonal: *Vector4) -> PxMat44 #foreign physx "PxMat44_new_8"; + +PxMat44_new :: (axes: *PxMat33, position: *Vector3) -> PxMat44 #foreign physx "PxMat44_new_9"; + +PxMat44_new :: (t: *PxTransform) -> PxMat44 #foreign physx "PxMat44_new_10"; + +PxMat44_getTranspose :: (self: *PxMat44) -> PxMat44 #foreign physx; + +PxMat44_transform :: (self: *PxMat44, other: *Vector4) -> Vector4 #foreign physx; + +PxMat44_transform :: (self: *PxMat44, other: *Vector3) -> Vector3 #foreign physx "PxMat44_transform_1"; + +PxMat44_rotate :: (self: *PxMat44, other: *Vector4) -> Vector4 #foreign physx; + +PxMat44_rotate :: (self: *PxMat44, other: *Vector3) -> Vector3 #foreign physx "PxMat44_rotate_1"; + +PxMat44_getBasis :: (self: *PxMat44, num: u32) -> Vector3 #foreign physx; + +PxMat44_getPosition :: (self: *PxMat44) -> Vector3 #foreign physx; + +PxMat44_setPosition :: (self: *PxMat44, position: *Vector3) -> void #foreign physx "PxMat44_setPosition_mut"; + +PxMat44_front :: (self: *PxMat44) -> *float #foreign physx; + +PxMat44_scale :: (self: *PxMat44, p: *Vector4) -> void #foreign physx "PxMat44_scale_mut"; + +PxMat44_inverseRT :: (self: *PxMat44) -> PxMat44 #foreign physx; + +PxMat44_isFinite :: (self: *PxMat44) -> bool #foreign physx; + +PxPlane_new :: () -> Plane3 #foreign physx; + +PxPlane_new :: (nx: float, ny: float, nz: float, distance: float) -> Plane3 #foreign physx "PxPlane_new_1"; + +PxPlane_new :: (normal: *Vector3, distance: float) -> Plane3 #foreign physx "PxPlane_new_2"; + +PxPlane_new :: (point: *Vector3, normal: *Vector3) -> Plane3 #foreign physx "PxPlane_new_3"; + +PxPlane_new :: (p0: *Vector3, p1: *Vector3, p2: *Vector3) -> Plane3 #foreign physx "PxPlane_new_4"; + +PxPlane_distance :: (self: *Plane3, p: *Vector3) -> float #foreign physx; + +PxPlane_contains :: (self: *Plane3, p: *Vector3) -> bool #foreign physx; + +PxPlane_project :: (self: *Plane3, p: *Vector3) -> Vector3 #foreign physx; + +PxPlane_pointInPlane :: (self: *Plane3) -> Vector3 #foreign physx; + +PxPlane_normalize :: (self: *Plane3) -> void #foreign physx "PxPlane_normalize_mut"; + +PxPlane_transform :: (self: *Plane3, pose: *PxTransform) -> Plane3 #foreign physx; + +PxPlane_inverseTransform :: (self: *Plane3, pose: *PxTransform) -> Plane3 #foreign physx; + +PxShortestRotation :: (from: *Vector3, target: *Vector3) -> Quaternion #foreign physx "phys_PxShortestRotation"; + +PxDiagonalize :: (m: *PxMat33, axes: *Quaternion) -> Vector3 #foreign physx "phys_PxDiagonalize"; + +PxTransformFromSegment :: (p0: *Vector3, p1: *Vector3, halfHeight: *float) -> PxTransform #foreign physx "phys_PxTransformFromSegment"; + +PxTransformFromPlaneEquation :: (plane: *Plane3) -> PxTransform #foreign physx "phys_PxTransformFromPlaneEquation"; + +PxPlaneEquationFromTransform :: (pose: *PxTransform) -> Plane3 #foreign physx "phys_PxPlaneEquationFromTransform"; + +PxSlerp :: (t: float, left: *Quaternion, right: *Quaternion) -> Quaternion #foreign physx "phys_PxSlerp"; + +PxIntegrateTransform :: (curTrans: *PxTransform, linvel: *Vector3, angvel: *Vector3, timeStep: float, result: *PxTransform) -> void #foreign physx "phys_PxIntegrateTransform"; + +PxExp :: (v: *Vector3) -> Quaternion #foreign physx "phys_PxExp"; + +PxOptimizeBoundingBox :: (basis: *PxMat33) -> Vector3 #foreign physx "phys_PxOptimizeBoundingBox"; + +PxLog :: (q: *Quaternion) -> Vector3 #foreign physx "phys_PxLog"; + +PxLargestAxis :: (v: *Vector3) -> u32 #foreign physx "phys_PxLargestAxis"; + +PxTanHalf :: (sin: float, cos: float) -> float #foreign physx "phys_PxTanHalf"; + +PxEllipseClamp :: (point: *Vector3, radii: *Vector3) -> Vector3 #foreign physx "phys_PxEllipseClamp"; + +PxSeparateSwingTwist :: (q: *Quaternion, swing: *Quaternion, twist: *Quaternion) -> void #foreign physx "phys_PxSeparateSwingTwist"; + +PxComputeAngle :: (v0: *Vector3, v1: *Vector3) -> float #foreign physx "phys_PxComputeAngle"; + +PxComputeBasisVectors :: (dir: *Vector3, right: *Vector3, up: *Vector3) -> void #foreign physx "phys_PxComputeBasisVectors"; + +PxComputeBasisVectors_1 :: (p0: *Vector3, p1: *Vector3, dir: *Vector3, right: *Vector3, up: *Vector3) -> void #foreign physx "phys_PxComputeBasisVectors_1"; + +PxGetNextIndex3 :: (i: u32) -> u32 #foreign physx "phys_PxGetNextIndex3"; + +computeBarycentric :: (a: *Vector3, b: *Vector3, c: *Vector3, d: *Vector3, p: *Vector3, bary: *Vector4) -> void #foreign physx "phys_computeBarycentric"; + +computeBarycentric_1 :: (a: *Vector3, b: *Vector3, c: *Vector3, p: *Vector3, bary: *Vector4) -> void #foreign physx "phys_computeBarycentric_1"; + +Interpolation_PxLerp :: (a: float, b: float, t: float) -> float #foreign physx; + +Interpolation_PxBiLerp :: (f00: float, f10: float, f01: float, f11: float, tx: float, ty: float) -> float #foreign physx; + +Interpolation_PxTriLerp :: (f000: float, f100: float, f010: float, f110: float, f001: float, f101: float, f011: float, f111: float, tx: float, ty: float, tz: float) -> float #foreign physx; + +Interpolation_PxSDFIdx :: (i: u32, j: u32, k: u32, nbX: u32, nbY: u32) -> u32 #foreign physx; + +Interpolation_PxSDFSampleImpl :: (sdf: *float, localPos: *Vector3, sdfBoxLower: *Vector3, sdfBoxHigher: *Vector3, sdfDx: float, invSdfDx: float, dimX: u32, dimY: u32, dimZ: u32, tolerance: float) -> float #foreign physx; + +PxSdfSample :: (sdf: *float, localPos: *Vector3, sdfBoxLower: *Vector3, sdfBoxHigher: *Vector3, sdfDx: float, invSdfDx: float, dimX: u32, dimY: u32, dimZ: u32, gradient: *Vector3, tolerance: float) -> float #foreign physx "phys_PxSdfSample"; + +PxMutexImpl_new_alloc :: () -> *PxMutexImpl #foreign physx; + +PxMutexImpl_delete :: (self: *PxMutexImpl) -> void #foreign physx; + +PxMutexImpl_lock :: (self: *PxMutexImpl) -> void #foreign physx "PxMutexImpl_lock_mut"; + +PxMutexImpl_trylock :: (self: *PxMutexImpl) -> bool #foreign physx "PxMutexImpl_trylock_mut"; + +PxMutexImpl_unlock :: (self: *PxMutexImpl) -> void #foreign physx "PxMutexImpl_unlock_mut"; + +PxMutexImpl_getSize :: () -> u32 #foreign physx; + +PxReadWriteLock_new_alloc :: () -> *PxReadWriteLock #foreign physx; + +PxReadWriteLock_delete :: (self: *PxReadWriteLock) -> void #foreign physx; + +PxReadWriteLock_lockReader :: (self: *PxReadWriteLock, takeLock: bool) -> void #foreign physx "PxReadWriteLock_lockReader_mut"; + +PxReadWriteLock_lockWriter :: (self: *PxReadWriteLock) -> void #foreign physx "PxReadWriteLock_lockWriter_mut"; + +PxReadWriteLock_unlockReader :: (self: *PxReadWriteLock) -> void #foreign physx "PxReadWriteLock_unlockReader_mut"; + +PxReadWriteLock_unlockWriter :: (self: *PxReadWriteLock) -> void #foreign physx "PxReadWriteLock_unlockWriter_mut"; + +PxProfilerCallback_zoneStart :: (self: *PxProfilerCallback, eventName: *u8, detached: bool, contextId: u64) -> *void #foreign physx "PxProfilerCallback_zoneStart_mut"; + +PxProfilerCallback_zoneEnd :: (self: *PxProfilerCallback, profilerData: *void, eventName: *u8, detached: bool, contextId: u64) -> void #foreign physx "PxProfilerCallback_zoneEnd_mut"; + +PxProfileScoped_new_alloc :: (callback: *PxProfilerCallback, eventName: *u8, detached: bool, contextId: u64) -> *PxProfileScoped #foreign physx; + +PxProfileScoped_delete :: (self: *PxProfileScoped) -> void #foreign physx; + +PxSListEntry_new :: () -> PxSListEntry #foreign physx; + +PxSListEntry_next :: (self: *PxSListEntry) -> *PxSListEntry #foreign physx "PxSListEntry_next_mut"; + +PxSListImpl_new_alloc :: () -> *PxSListImpl #foreign physx; + +PxSListImpl_delete :: (self: *PxSListImpl) -> void #foreign physx; + +PxSListImpl_push :: (self: *PxSListImpl, entry: *PxSListEntry) -> void #foreign physx "PxSListImpl_push_mut"; + +PxSListImpl_pop :: (self: *PxSListImpl) -> *PxSListEntry #foreign physx "PxSListImpl_pop_mut"; + +PxSListImpl_flush :: (self: *PxSListImpl) -> *PxSListEntry #foreign physx "PxSListImpl_flush_mut"; + +PxSListImpl_getSize :: () -> u32 #foreign physx; + +PxSyncImpl_new_alloc :: () -> *PxSyncImpl #foreign physx; + +PxSyncImpl_delete :: (self: *PxSyncImpl) -> void #foreign physx; + +PxSyncImpl_wait :: (self: *PxSyncImpl, milliseconds: u32) -> bool #foreign physx "PxSyncImpl_wait_mut"; + +PxSyncImpl_set :: (self: *PxSyncImpl) -> void #foreign physx "PxSyncImpl_set_mut"; + +PxSyncImpl_reset :: (self: *PxSyncImpl) -> void #foreign physx "PxSyncImpl_reset_mut"; + +PxSyncImpl_getSize :: () -> u32 #foreign physx; + +PxRunnable_new_alloc :: () -> *PxRunnable #foreign physx; + +PxRunnable_delete :: (self: *PxRunnable) -> void #foreign physx; + +PxRunnable_execute :: (self: *PxRunnable) -> void #foreign physx "PxRunnable_execute_mut"; + +PxTlsAlloc :: () -> u32 #foreign physx "phys_PxTlsAlloc"; + +PxTlsFree :: (index: u32) -> void #foreign physx "phys_PxTlsFree"; + +PxTlsGet :: (index: u32) -> *void #foreign physx "phys_PxTlsGet"; + +PxTlsGetValue :: (index: u32) -> u64 #foreign physx "phys_PxTlsGetValue"; + +PxTlsSet :: (index: u32, value: *void) -> u32 #foreign physx "phys_PxTlsSet"; + +PxTlsSetValue :: (index: u32, value: u64) -> u32 #foreign physx "phys_PxTlsSetValue"; + +PxCounterFrequencyToTensOfNanos_new :: (inNum: u64, inDenom: u64) -> PxCounterFrequencyToTensOfNanos #foreign physx; + +PxCounterFrequencyToTensOfNanos_toTensOfNanos :: (self: *PxCounterFrequencyToTensOfNanos, inCounter: u64) -> u64 #foreign physx; + +PxTime_getBootCounterFrequency :: () -> *PxCounterFrequencyToTensOfNanos #foreign physx; + +PxTime_getCounterFrequency :: () -> PxCounterFrequencyToTensOfNanos #foreign physx; + +PxTime_getCurrentCounterValue :: () -> u64 #foreign physx; + +PxTime_getCurrentTimeInTensOfNanoSeconds :: () -> u64 #foreign physx; + +PxTime_new :: () -> PxTime #foreign physx; + +PxTime_getElapsedSeconds :: (self: *PxTime) -> float64 #foreign physx "PxTime_getElapsedSeconds_mut"; + +PxTime_peekElapsedSeconds :: (self: *PxTime) -> float64 #foreign physx "PxTime_peekElapsedSeconds_mut"; + +PxTime_getLastTime :: (self: *PxTime) -> float64 #foreign physx; + +PxVec2_new :: () -> Vector2 #foreign physx; + +PxVec2_new :: (anon_param0: s32) -> Vector2 #foreign physx "PxVec2_new_1"; + +PxVec2_new :: (a: float) -> Vector2 #foreign physx "PxVec2_new_2"; + +PxVec2_new :: (nx: float, ny: float) -> Vector2 #foreign physx "PxVec2_new_3"; + +PxVec2_isZero :: (self: *Vector2) -> bool #foreign physx; + +PxVec2_isFinite :: (self: *Vector2) -> bool #foreign physx; + +PxVec2_isNormalized :: (self: *Vector2) -> bool #foreign physx; + +PxVec2_magnitudeSquared :: (self: *Vector2) -> float #foreign physx; + +PxVec2_magnitude :: (self: *Vector2) -> float #foreign physx; + +PxVec2_dot :: (self: *Vector2, v: *Vector2) -> float #foreign physx; + +PxVec2_getNormalized :: (self: *Vector2) -> Vector2 #foreign physx; + +PxVec2_normalize :: (self: *Vector2) -> float #foreign physx "PxVec2_normalize_mut"; + +PxVec2_multiply :: (self: *Vector2, a: *Vector2) -> Vector2 #foreign physx; + +PxVec2_minimum :: (self: *Vector2, v: *Vector2) -> Vector2 #foreign physx; + +PxVec2_minElement :: (self: *Vector2) -> float #foreign physx; + +PxVec2_maximum :: (self: *Vector2, v: *Vector2) -> Vector2 #foreign physx; + +PxVec2_maxElement :: (self: *Vector2) -> float #foreign physx; + +PxStridedData_new :: () -> PxStridedData #foreign physx; + +PxBoundedData_new :: () -> PxBoundedData #foreign physx; + +PxDebugPoint_new :: (p: *Vector3, c: *u32) -> PxDebugPoint #foreign physx; + +PxDebugLine_new :: (p0: *Vector3, p1: *Vector3, c: *u32) -> PxDebugLine #foreign physx; + +PxDebugTriangle_new :: (p0: *Vector3, p1: *Vector3, p2: *Vector3, c: *u32) -> PxDebugTriangle #foreign physx; + +PxDebugText_new :: () -> PxDebugText #foreign physx; + +PxDebugText_new :: (pos: *Vector3, sz: *float, clr: *u32, str: *u8) -> PxDebugText #foreign physx "PxDebugText_new_1"; + +PxRenderBuffer_delete :: (self: *PxRenderBuffer) -> void #foreign physx; + +PxRenderBuffer_getNbPoints :: (self: *PxRenderBuffer) -> u32 #foreign physx; + +PxRenderBuffer_getPoints :: (self: *PxRenderBuffer) -> *PxDebugPoint #foreign physx; + +PxRenderBuffer_addPoint :: (self: *PxRenderBuffer, point: *PxDebugPoint) -> void #foreign physx "PxRenderBuffer_addPoint_mut"; + +PxRenderBuffer_getNbLines :: (self: *PxRenderBuffer) -> u32 #foreign physx; + +PxRenderBuffer_getLines :: (self: *PxRenderBuffer) -> *PxDebugLine #foreign physx; + +PxRenderBuffer_addLine :: (self: *PxRenderBuffer, line: *PxDebugLine) -> void #foreign physx "PxRenderBuffer_addLine_mut"; + +PxRenderBuffer_reserveLines :: (self: *PxRenderBuffer, nbLines: u32) -> *PxDebugLine #foreign physx "PxRenderBuffer_reserveLines_mut"; + +PxRenderBuffer_reservePoints :: (self: *PxRenderBuffer, nbLines: u32) -> *PxDebugPoint #foreign physx "PxRenderBuffer_reservePoints_mut"; + +PxRenderBuffer_getNbTriangles :: (self: *PxRenderBuffer) -> u32 #foreign physx; + +PxRenderBuffer_getTriangles :: (self: *PxRenderBuffer) -> *PxDebugTriangle #foreign physx; + +PxRenderBuffer_addTriangle :: (self: *PxRenderBuffer, triangle: *PxDebugTriangle) -> void #foreign physx "PxRenderBuffer_addTriangle_mut"; + +PxRenderBuffer_append :: (self: *PxRenderBuffer, other: *PxRenderBuffer) -> void #foreign physx "PxRenderBuffer_append_mut"; + +PxRenderBuffer_clear :: (self: *PxRenderBuffer) -> void #foreign physx "PxRenderBuffer_clear_mut"; + +PxRenderBuffer_shift :: (self: *PxRenderBuffer, delta: *Vector3) -> void #foreign physx "PxRenderBuffer_shift_mut"; + +PxRenderBuffer_empty :: (self: *PxRenderBuffer) -> bool #foreign physx; + +PxProcessPxBaseCallback_delete :: (self: *PxProcessPxBaseCallback) -> void #foreign physx; + +PxProcessPxBaseCallback_process :: (self: *PxProcessPxBaseCallback, anon_param0: *PxBase) -> void #foreign physx "PxProcessPxBaseCallback_process_mut"; + +PxSerializationContext_registerReference :: (self: *PxSerializationContext, base: *PxBase, kind: u32, reference: u64) -> void #foreign physx "PxSerializationContext_registerReference_mut"; + +PxSerializationContext_getCollection :: (self: *PxSerializationContext) -> *PxCollection #foreign physx; + +PxSerializationContext_writeData :: (self: *PxSerializationContext, data: *void, size: u32) -> void #foreign physx "PxSerializationContext_writeData_mut"; + +PxSerializationContext_alignData :: (self: *PxSerializationContext, alignment: u32) -> void #foreign physx "PxSerializationContext_alignData_mut"; + +PxSerializationContext_writeName :: (self: *PxSerializationContext, name: *u8) -> void #foreign physx "PxSerializationContext_writeName_mut"; + +PxDeserializationContext_resolveReference :: (self: *PxDeserializationContext, kind: u32, reference: u64) -> *PxBase #foreign physx; + +PxDeserializationContext_readName :: (self: *PxDeserializationContext, name: **u8) -> void #foreign physx "PxDeserializationContext_readName_mut"; + +PxDeserializationContext_alignExtraData :: (self: *PxDeserializationContext, alignment: u32) -> void #foreign physx "PxDeserializationContext_alignExtraData_mut"; + +PxSerializationRegistry_registerSerializer :: (self: *PxSerializationRegistry, type: u16, serializer: *PxSerializer) -> void #foreign physx "PxSerializationRegistry_registerSerializer_mut"; + +PxSerializationRegistry_unregisterSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxSerializer #foreign physx "PxSerializationRegistry_unregisterSerializer_mut"; + +PxSerializationRegistry_getSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxSerializer #foreign physx; + +PxSerializationRegistry_registerRepXSerializer :: (self: *PxSerializationRegistry, type: u16, serializer: *PxRepXSerializer) -> void #foreign physx "PxSerializationRegistry_registerRepXSerializer_mut"; + +PxSerializationRegistry_unregisterRepXSerializer :: (self: *PxSerializationRegistry, type: u16) -> *PxRepXSerializer #foreign physx "PxSerializationRegistry_unregisterRepXSerializer_mut"; + +PxSerializationRegistry_getRepXSerializer :: (self: *PxSerializationRegistry, typeName: *u8) -> *PxRepXSerializer #foreign physx; + +PxSerializationRegistry_release :: (self: *PxSerializationRegistry) -> void #foreign physx "PxSerializationRegistry_release_mut"; + +PxCollection_add :: (self: *PxCollection, object: *PxBase, id: u64) -> void #foreign physx "PxCollection_add_mut"; + +PxCollection_remove :: (self: *PxCollection, object: *PxBase) -> void #foreign physx "PxCollection_remove_mut"; + +PxCollection_contains :: (self: *PxCollection, object: *PxBase) -> bool #foreign physx; + +PxCollection_addId :: (self: *PxCollection, object: *PxBase, id: u64) -> void #foreign physx "PxCollection_addId_mut"; + +PxCollection_removeId :: (self: *PxCollection, id: u64) -> void #foreign physx "PxCollection_removeId_mut"; + +PxCollection_add_mut :: (self: *PxCollection, collection: *PxCollection) -> void #foreign physx "PxCollection_add_mut_1"; + +PxCollection_remove_mut :: (self: *PxCollection, collection: *PxCollection) -> void #foreign physx "PxCollection_remove_mut_1"; + +PxCollection_getNbObjects :: (self: *PxCollection) -> u32 #foreign physx; + +PxCollection_getObject :: (self: *PxCollection, index: u32) -> *PxBase #foreign physx; + +PxCollection_getObjects :: (self: *PxCollection, userBuffer: **PxBase, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxCollection_find :: (self: *PxCollection, id: u64) -> *PxBase #foreign physx; + +PxCollection_getNbIds :: (self: *PxCollection) -> u32 #foreign physx; + +PxCollection_getIds :: (self: *PxCollection, userBuffer: *u64, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxCollection_getId :: (self: *PxCollection, object: *PxBase) -> u64 #foreign physx; + +PxCollection_release :: (self: *PxCollection) -> void #foreign physx "PxCollection_release_mut"; + +PxCreateCollection :: () -> *PxCollection #foreign physx "phys_PxCreateCollection"; + +PxBase_release :: (self: *PxBase) -> void #foreign physx "PxBase_release_mut"; + +PxBase_getConcreteTypeName :: (self: *PxBase) -> *u8 #foreign physx; + +PxBase_getConcreteType :: (self: *PxBase) -> u16 #foreign physx; + +PxBase_setBaseFlag :: (self: *PxBase, flag: s32, value: bool) -> void #foreign physx "PxBase_setBaseFlag_mut"; + +PxBase_setBaseFlags :: (self: *PxBase, inFlags: u16) -> void #foreign physx "PxBase_setBaseFlags_mut"; + +PxBase_getBaseFlags :: (self: *PxBase) -> u16 #foreign physx; + +PxBase_isReleasable :: (self: *PxBase) -> bool #foreign physx; + +PxRefCounted_release :: (self: *PxRefCounted) -> void #foreign physx "PxRefCounted_release_mut"; + +PxRefCounted_getReferenceCount :: (self: *PxRefCounted) -> u32 #foreign physx; + +PxRefCounted_acquireReference :: (self: *PxRefCounted) -> void #foreign physx "PxRefCounted_acquireReference_mut"; + +PxTolerancesScale_new :: (defaultLength: float, defaultSpeed: float) -> PxTolerancesScale #foreign physx; + +PxTolerancesScale_isValid :: (self: *PxTolerancesScale) -> bool #foreign physx; + +PxStringTable_allocateStr :: (self: *PxStringTable, inSrc: *u8) -> *u8 #foreign physx "PxStringTable_allocateStr_mut"; + +PxStringTable_release :: (self: *PxStringTable) -> void #foreign physx "PxStringTable_release_mut"; + +PxSerializer_getConcreteTypeName :: (self: *PxSerializer) -> *u8 #foreign physx; + +PxSerializer_requiresObjects :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxProcessPxBaseCallback) -> void #foreign physx; + +PxSerializer_isSubordinate :: (self: *PxSerializer) -> bool #foreign physx; + +PxSerializer_exportExtraData :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxSerializationContext) -> void #foreign physx; + +PxSerializer_exportData :: (self: *PxSerializer, anon_param0: *PxBase, anon_param1: *PxSerializationContext) -> void #foreign physx; + +PxSerializer_registerReferences :: (self: *PxSerializer, obj: *PxBase, s: *PxSerializationContext) -> void #foreign physx; + +PxSerializer_getClassSize :: (self: *PxSerializer) -> u64 #foreign physx; + +PxSerializer_createObject :: (self: *PxSerializer, address: **u8, context_pod: *PxDeserializationContext) -> *PxBase #foreign physx; + +PxSerializer_delete :: (self: *PxSerializer) -> void #foreign physx; + +PxInsertionCallback_buildObjectFromData :: (self: *PxInsertionCallback, type: s32, data: *void) -> *PxBase #foreign physx "PxInsertionCallback_buildObjectFromData_mut"; + +PxTaskManager_setCpuDispatcher :: (self: *PxTaskManager, ref: *PxCpuDispatcher) -> void #foreign physx "PxTaskManager_setCpuDispatcher_mut"; + +PxTaskManager_getCpuDispatcher :: (self: *PxTaskManager) -> *PxCpuDispatcher #foreign physx; + +PxTaskManager_resetDependencies :: (self: *PxTaskManager) -> void #foreign physx "PxTaskManager_resetDependencies_mut"; + +PxTaskManager_startSimulation :: (self: *PxTaskManager) -> void #foreign physx "PxTaskManager_startSimulation_mut"; + +PxTaskManager_stopSimulation :: (self: *PxTaskManager) -> void #foreign physx "PxTaskManager_stopSimulation_mut"; + +PxTaskManager_taskCompleted :: (self: *PxTaskManager, task: *PxTask) -> void #foreign physx "PxTaskManager_taskCompleted_mut"; + +PxTaskManager_getNamedTask :: (self: *PxTaskManager, name: *u8) -> u32 #foreign physx "PxTaskManager_getNamedTask_mut"; + +PxTaskManager_submitNamedTask :: (self: *PxTaskManager, task: *PxTask, name: *u8, type: s32) -> u32 #foreign physx "PxTaskManager_submitNamedTask_mut"; + +PxTaskManager_submitUnnamedTask :: (self: *PxTaskManager, task: *PxTask, type: s32) -> u32 #foreign physx "PxTaskManager_submitUnnamedTask_mut"; + +PxTaskManager_getTaskFromID :: (self: *PxTaskManager, id: u32) -> *PxTask #foreign physx "PxTaskManager_getTaskFromID_mut"; + +PxTaskManager_release :: (self: *PxTaskManager) -> void #foreign physx "PxTaskManager_release_mut"; + +PxTaskManager_createTaskManager :: (errorCallback: *PxErrorCallback, anon_param1: *PxCpuDispatcher) -> *PxTaskManager #foreign physx; + +PxCpuDispatcher_submitTask :: (self: *PxCpuDispatcher, task: *PxBaseTask) -> void #foreign physx "PxCpuDispatcher_submitTask_mut"; + +PxCpuDispatcher_getWorkerCount :: (self: *PxCpuDispatcher) -> u32 #foreign physx; + +PxCpuDispatcher_delete :: (self: *PxCpuDispatcher) -> void #foreign physx; + +PxBaseTask_run :: (self: *PxBaseTask) -> void #foreign physx "PxBaseTask_run_mut"; + +PxBaseTask_getName :: (self: *PxBaseTask) -> *u8 #foreign physx; + +PxBaseTask_addReference :: (self: *PxBaseTask) -> void #foreign physx "PxBaseTask_addReference_mut"; + +PxBaseTask_removeReference :: (self: *PxBaseTask) -> void #foreign physx "PxBaseTask_removeReference_mut"; + +PxBaseTask_getReference :: (self: *PxBaseTask) -> s32 #foreign physx; + +PxBaseTask_release :: (self: *PxBaseTask) -> void #foreign physx "PxBaseTask_release_mut"; + +PxBaseTask_getTaskManager :: (self: *PxBaseTask) -> *PxTaskManager #foreign physx; + +PxBaseTask_setContextId :: (self: *PxBaseTask, id: u64) -> void #foreign physx "PxBaseTask_setContextId_mut"; + +PxBaseTask_getContextId :: (self: *PxBaseTask) -> u64 #foreign physx; + +PxTask_release :: (self: *PxTask) -> void #foreign physx "PxTask_release_mut"; + +PxTask_finishBefore :: (self: *PxTask, taskID: u32) -> void #foreign physx "PxTask_finishBefore_mut"; + +PxTask_startAfter :: (self: *PxTask, taskID: u32) -> void #foreign physx "PxTask_startAfter_mut"; + +PxTask_addReference :: (self: *PxTask) -> void #foreign physx "PxTask_addReference_mut"; + +PxTask_removeReference :: (self: *PxTask) -> void #foreign physx "PxTask_removeReference_mut"; + +PxTask_getReference :: (self: *PxTask) -> s32 #foreign physx; + +PxTask_getTaskID :: (self: *PxTask) -> u32 #foreign physx; + +PxTask_submitted :: (self: *PxTask) -> void #foreign physx "PxTask_submitted_mut"; + +PxLightCpuTask_setContinuation :: (self: *PxLightCpuTask, tm: *PxTaskManager, c: *PxBaseTask) -> void #foreign physx "PxLightCpuTask_setContinuation_mut"; + +PxLightCpuTask_setContinuation_mut :: (self: *PxLightCpuTask, c: *PxBaseTask) -> void #foreign physx "PxLightCpuTask_setContinuation_mut_1"; + +PxLightCpuTask_getContinuation :: (self: *PxLightCpuTask) -> *PxBaseTask #foreign physx; + +PxLightCpuTask_removeReference :: (self: *PxLightCpuTask) -> void #foreign physx "PxLightCpuTask_removeReference_mut"; + +PxLightCpuTask_getReference :: (self: *PxLightCpuTask) -> s32 #foreign physx; + +PxLightCpuTask_addReference :: (self: *PxLightCpuTask) -> void #foreign physx "PxLightCpuTask_addReference_mut"; + +PxLightCpuTask_release :: (self: *PxLightCpuTask) -> void #foreign physx "PxLightCpuTask_release_mut"; + +PxGeometry_getType :: (self: *PxGeometry) -> s32 #foreign physx; + +PxBoxGeometry_new :: (hx: float, hy: float, hz: float) -> PxBoxGeometry #foreign physx; + +PxBoxGeometry_new :: (halfExtents: Vector3) -> PxBoxGeometry #foreign physx "PxBoxGeometry_new_1"; + +PxBoxGeometry_isValid :: (self: *PxBoxGeometry) -> bool #foreign physx; + +PxBVHRaycastCallback_delete :: (self: *PxBVHRaycastCallback) -> void #foreign physx; + +PxBVHRaycastCallback_reportHit :: (self: *PxBVHRaycastCallback, boundsIndex: u32, distance: *float) -> bool #foreign physx "PxBVHRaycastCallback_reportHit_mut"; + +PxBVHOverlapCallback_delete :: (self: *PxBVHOverlapCallback) -> void #foreign physx; + +PxBVHOverlapCallback_reportHit :: (self: *PxBVHOverlapCallback, boundsIndex: u32) -> bool #foreign physx "PxBVHOverlapCallback_reportHit_mut"; + +PxBVHTraversalCallback_delete :: (self: *PxBVHTraversalCallback) -> void #foreign physx; + +PxBVHTraversalCallback_visitNode :: (self: *PxBVHTraversalCallback, bounds: *PxBounds3) -> bool #foreign physx "PxBVHTraversalCallback_visitNode_mut"; + +PxBVHTraversalCallback_reportLeaf :: (self: *PxBVHTraversalCallback, nbPrims: u32, prims: *u32) -> bool #foreign physx "PxBVHTraversalCallback_reportLeaf_mut"; + +PxBVH_raycast :: (self: *PxBVH, origin: *Vector3, unitDir: *Vector3, maxDist: float, cb: *PxBVHRaycastCallback, queryFlags: u32) -> bool #foreign physx; + +PxBVH_sweep :: (self: *PxBVH, geom: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, maxDist: float, cb: *PxBVHRaycastCallback, queryFlags: u32) -> bool #foreign physx; + +PxBVH_overlap :: (self: *PxBVH, geom: *PxGeometry, pose: *PxTransform, cb: *PxBVHOverlapCallback, queryFlags: u32) -> bool #foreign physx; + +PxBVH_cull :: (self: *PxBVH, nbPlanes: u32, planes: *Plane3, cb: *PxBVHOverlapCallback, queryFlags: u32) -> bool #foreign physx; + +PxBVH_getNbBounds :: (self: *PxBVH) -> u32 #foreign physx; + +PxBVH_getBounds :: (self: *PxBVH) -> *PxBounds3 #foreign physx; + +PxBVH_getBoundsForModification :: (self: *PxBVH) -> *PxBounds3 #foreign physx "PxBVH_getBoundsForModification_mut"; + +PxBVH_refit :: (self: *PxBVH) -> void #foreign physx "PxBVH_refit_mut"; + +PxBVH_updateBounds :: (self: *PxBVH, boundsIndex: u32, newBounds: *PxBounds3) -> bool #foreign physx "PxBVH_updateBounds_mut"; + +PxBVH_partialRefit :: (self: *PxBVH) -> void #foreign physx "PxBVH_partialRefit_mut"; + +PxBVH_traverse :: (self: *PxBVH, cb: *PxBVHTraversalCallback) -> bool #foreign physx; + +PxBVH_getConcreteTypeName :: (self: *PxBVH) -> *u8 #foreign physx; + +PxCapsuleGeometry_new :: (radius_: float, halfHeight_: float) -> PxCapsuleGeometry #foreign physx; + +PxCapsuleGeometry_isValid :: (self: *PxCapsuleGeometry) -> bool #foreign physx; + +PxConvexMesh_getNbVertices :: (self: *PxConvexMesh) -> u32 #foreign physx; + +PxConvexMesh_getVertices :: (self: *PxConvexMesh) -> *Vector3 #foreign physx; + +PxConvexMesh_getIndexBuffer :: (self: *PxConvexMesh) -> *u8 #foreign physx; + +PxConvexMesh_getNbPolygons :: (self: *PxConvexMesh) -> u32 #foreign physx; + +PxConvexMesh_getPolygonData :: (self: *PxConvexMesh, index: u32, data: *PxHullPolygon) -> bool #foreign physx; + +PxConvexMesh_release :: (self: *PxConvexMesh) -> void #foreign physx "PxConvexMesh_release_mut"; + +PxConvexMesh_getMassInformation :: (self: *PxConvexMesh, mass: *float, localInertia: *PxMat33, localCenterOfMass: *Vector3) -> void #foreign physx; + +PxConvexMesh_getLocalBounds :: (self: *PxConvexMesh) -> PxBounds3 #foreign physx; + +PxConvexMesh_getSDF :: (self: *PxConvexMesh) -> *float #foreign physx; + +PxConvexMesh_getConcreteTypeName :: (self: *PxConvexMesh) -> *u8 #foreign physx; + +PxConvexMesh_isGpuCompatible :: (self: *PxConvexMesh) -> bool #foreign physx; + +PxMeshScale_new :: () -> PxMeshScale #foreign physx; + +PxMeshScale_new :: (r: float) -> PxMeshScale #foreign physx "PxMeshScale_new_1"; + +PxMeshScale_new :: (s: *Vector3) -> PxMeshScale #foreign physx "PxMeshScale_new_2"; + +PxMeshScale_new :: (s: *Vector3, r: *Quaternion) -> PxMeshScale #foreign physx "PxMeshScale_new_3"; + +PxMeshScale_isIdentity :: (self: *PxMeshScale) -> bool #foreign physx; + +PxMeshScale_getInverse :: (self: *PxMeshScale) -> PxMeshScale #foreign physx; + +PxMeshScale_toMat33 :: (self: *PxMeshScale) -> PxMat33 #foreign physx; + +PxMeshScale_hasNegativeDeterminant :: (self: *PxMeshScale) -> bool #foreign physx; + +PxMeshScale_transform :: (self: *PxMeshScale, v: *Vector3) -> Vector3 #foreign physx; + +PxMeshScale_isValidForTriangleMesh :: (self: *PxMeshScale) -> bool #foreign physx; + +PxMeshScale_isValidForConvexMesh :: (self: *PxMeshScale) -> bool #foreign physx; + +PxConvexMeshGeometry_new :: (mesh: *PxConvexMesh, scaling: *PxMeshScale, flags: u8) -> PxConvexMeshGeometry #foreign physx; + +PxConvexMeshGeometry_isValid :: (self: *PxConvexMeshGeometry) -> bool #foreign physx; + +PxSphereGeometry_new :: (ir: float) -> PxSphereGeometry #foreign physx; + +PxSphereGeometry_isValid :: (self: *PxSphereGeometry) -> bool #foreign physx; + +PxPlaneGeometry_new :: () -> PxPlaneGeometry #foreign physx; + +PxPlaneGeometry_isValid :: (self: *PxPlaneGeometry) -> bool #foreign physx; + +PxTriangleMeshGeometry_new :: (mesh: *PxTriangleMesh, scaling: *PxMeshScale, flags: u8) -> PxTriangleMeshGeometry #foreign physx; + +PxTriangleMeshGeometry_isValid :: (self: *PxTriangleMeshGeometry) -> bool #foreign physx; + +PxHeightFieldGeometry_new :: (hf: *PxHeightField, flags: u8, heightScale_: float, rowScale_: float, columnScale_: float) -> PxHeightFieldGeometry #foreign physx; + +PxHeightFieldGeometry_isValid :: (self: *PxHeightFieldGeometry) -> bool #foreign physx; + +PxParticleSystemGeometry_new :: () -> PxParticleSystemGeometry #foreign physx; + +PxParticleSystemGeometry_isValid :: (self: *PxParticleSystemGeometry) -> bool #foreign physx; + +PxHairSystemGeometry_new :: () -> PxHairSystemGeometry #foreign physx; + +PxHairSystemGeometry_isValid :: (self: *PxHairSystemGeometry) -> bool #foreign physx; + +PxTetrahedronMeshGeometry_new :: (mesh: *PxTetrahedronMesh) -> PxTetrahedronMeshGeometry #foreign physx; + +PxTetrahedronMeshGeometry_isValid :: (self: *PxTetrahedronMeshGeometry) -> bool #foreign physx; + +PxQueryHit_new :: () -> PxQueryHit #foreign physx; + +PxLocationHit_new :: () -> PxLocationHit #foreign physx; + +PxLocationHit_hadInitialOverlap :: (self: *PxLocationHit) -> bool #foreign physx; + +PxGeomRaycastHit_new :: () -> PxGeomRaycastHit #foreign physx; + +PxGeomOverlapHit_new :: () -> PxGeomOverlapHit #foreign physx; + +PxGeomSweepHit_new :: () -> PxGeomSweepHit #foreign physx; + +PxGeomIndexPair_new :: () -> PxGeomIndexPair #foreign physx; + +PxGeomIndexPair_new :: (_id0: u32, _id1: u32) -> PxGeomIndexPair #foreign physx "PxGeomIndexPair_new_1"; + +PxCustomGeometry_getUniqueID :: () -> u32 #foreign physx "phys_PxCustomGeometry_getUniqueID"; + +PxCustomGeometryType_new :: () -> PxCustomGeometryType #foreign physx; + +PxCustomGeometryType_INVALID :: () -> PxCustomGeometryType #foreign physx; + +PxCustomGeometryCallbacks_getCustomType :: (self: *PxCustomGeometryCallbacks) -> PxCustomGeometryType #foreign physx; + +PxCustomGeometryCallbacks_getLocalBounds :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry) -> PxBounds3 #foreign physx; + +PxCustomGeometryCallbacks_raycast :: (self: *PxCustomGeometryCallbacks, origin: *Vector3, unitDir: *Vector3, geom: *PxGeometry, pose: *PxTransform, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxGeomRaycastHit, stride: u32, threadContext: *PxQueryThreadContext) -> u32 #foreign physx; + +PxCustomGeometryCallbacks_overlap :: (self: *PxCustomGeometryCallbacks, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, threadContext: *PxQueryThreadContext) -> bool #foreign physx; + +PxCustomGeometryCallbacks_sweep :: (self: *PxCustomGeometryCallbacks, unitDir: *Vector3, maxDist: float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, sweepHit: *PxGeomSweepHit, hitFlags: u16, inflation: float, threadContext: *PxQueryThreadContext) -> bool #foreign physx; + +PxCustomGeometryCallbacks_computeMassProperties :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry, massProperties: *PxMassProperties) -> void #foreign physx; + +PxCustomGeometryCallbacks_usePersistentContactManifold :: (self: *PxCustomGeometryCallbacks, geometry: *PxGeometry, breakingThreshold: *float) -> bool #foreign physx; + +PxCustomGeometryCallbacks_delete :: (self: *PxCustomGeometryCallbacks) -> void #foreign physx; + +PxCustomGeometry_new :: () -> PxCustomGeometry #foreign physx; + +PxCustomGeometry_new :: (_callbacks: *PxCustomGeometryCallbacks) -> PxCustomGeometry #foreign physx "PxCustomGeometry_new_1"; + +PxCustomGeometry_isValid :: (self: *PxCustomGeometry) -> bool #foreign physx; + +PxCustomGeometry_getCustomType :: (self: *PxCustomGeometry) -> PxCustomGeometryType #foreign physx; + +PxGeometryHolder_getType :: (self: *PxGeometryHolder) -> s32 #foreign physx; + +PxGeometryHolder_any :: (self: *PxGeometryHolder) -> *PxGeometry #foreign physx "PxGeometryHolder_any_mut"; + +PxGeometryHolder_sphere :: (self: *PxGeometryHolder) -> *PxSphereGeometry #foreign physx "PxGeometryHolder_sphere_mut"; + +PxGeometryHolder_plane :: (self: *PxGeometryHolder) -> *PxPlaneGeometry #foreign physx "PxGeometryHolder_plane_mut"; + +PxGeometryHolder_capsule :: (self: *PxGeometryHolder) -> *PxCapsuleGeometry #foreign physx "PxGeometryHolder_capsule_mut"; + +PxGeometryHolder_box :: (self: *PxGeometryHolder) -> *PxBoxGeometry #foreign physx "PxGeometryHolder_box_mut"; + +PxGeometryHolder_convexMesh :: (self: *PxGeometryHolder) -> *PxConvexMeshGeometry #foreign physx "PxGeometryHolder_convexMesh_mut"; + +PxGeometryHolder_tetMesh :: (self: *PxGeometryHolder) -> *PxTetrahedronMeshGeometry #foreign physx "PxGeometryHolder_tetMesh_mut"; + +PxGeometryHolder_triangleMesh :: (self: *PxGeometryHolder) -> *PxTriangleMeshGeometry #foreign physx "PxGeometryHolder_triangleMesh_mut"; + +PxGeometryHolder_heightField :: (self: *PxGeometryHolder) -> *PxHeightFieldGeometry #foreign physx "PxGeometryHolder_heightField_mut"; + +PxGeometryHolder_particleSystem :: (self: *PxGeometryHolder) -> *PxParticleSystemGeometry #foreign physx "PxGeometryHolder_particleSystem_mut"; + +PxGeometryHolder_hairSystem :: (self: *PxGeometryHolder) -> *PxHairSystemGeometry #foreign physx "PxGeometryHolder_hairSystem_mut"; + +PxGeometryHolder_custom :: (self: *PxGeometryHolder) -> *PxCustomGeometry #foreign physx "PxGeometryHolder_custom_mut"; + +PxGeometryHolder_storeAny :: (self: *PxGeometryHolder, geometry: *PxGeometry) -> void #foreign physx "PxGeometryHolder_storeAny_mut"; + +PxGeometryHolder_new :: () -> PxGeometryHolder #foreign physx; + +PxGeometryHolder_new :: (geometry: *PxGeometry) -> PxGeometryHolder #foreign physx "PxGeometryHolder_new_1"; + +PxGeometryQuery_raycast :: (origin: *Vector3, unitDir: *Vector3, geom: *PxGeometry, pose: *PxTransform, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxGeomRaycastHit, stride: u32, queryFlags: u32, threadContext: *PxQueryThreadContext) -> u32 #foreign physx; + +PxGeometryQuery_overlap :: (geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, queryFlags: u32, threadContext: *PxQueryThreadContext) -> bool #foreign physx; + +PxGeometryQuery_sweep :: (unitDir: *Vector3, maxDist: float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, sweepHit: *PxGeomSweepHit, hitFlags: u16, inflation: float, queryFlags: u32, threadContext: *PxQueryThreadContext) -> bool #foreign physx; + +PxGeometryQuery_computePenetration :: (direction: *Vector3, depth: *float, geom0: *PxGeometry, pose0: *PxTransform, geom1: *PxGeometry, pose1: *PxTransform, queryFlags: u32) -> bool #foreign physx; + +PxGeometryQuery_pointDistance :: (point: *Vector3, geom: *PxGeometry, pose: *PxTransform, closestPoint: *Vector3, closestIndex: *u32, queryFlags: u32) -> float #foreign physx; + +PxGeometryQuery_computeGeomBounds :: (bounds: *PxBounds3, geom: *PxGeometry, pose: *PxTransform, offset: float, inflation: float, queryFlags: u32) -> void #foreign physx; + +PxGeometryQuery_isValid :: (geom: *PxGeometry) -> bool #foreign physx; + +PxHeightFieldSample_tessFlag :: (self: *PxHeightFieldSample) -> u8 #foreign physx; + +PxHeightFieldSample_setTessFlag :: (self: *PxHeightFieldSample) -> void #foreign physx "PxHeightFieldSample_setTessFlag_mut"; + +PxHeightFieldSample_clearTessFlag :: (self: *PxHeightFieldSample) -> void #foreign physx "PxHeightFieldSample_clearTessFlag_mut"; + +PxHeightField_release :: (self: *PxHeightField) -> void #foreign physx "PxHeightField_release_mut"; + +PxHeightField_saveCells :: (self: *PxHeightField, destBuffer: *void, destBufferSize: u32) -> u32 #foreign physx; + +PxHeightField_modifySamples :: (self: *PxHeightField, startCol: s32, startRow: s32, subfieldDesc: *PxHeightFieldDesc, shrinkBounds: bool) -> bool #foreign physx "PxHeightField_modifySamples_mut"; + +PxHeightField_getNbRows :: (self: *PxHeightField) -> u32 #foreign physx; + +PxHeightField_getNbColumns :: (self: *PxHeightField) -> u32 #foreign physx; + +PxHeightField_getFormat :: (self: *PxHeightField) -> s32 #foreign physx; + +PxHeightField_getSampleStride :: (self: *PxHeightField) -> u32 #foreign physx; + +PxHeightField_getConvexEdgeThreshold :: (self: *PxHeightField) -> float #foreign physx; + +PxHeightField_getFlags :: (self: *PxHeightField) -> u16 #foreign physx; + +PxHeightField_getHeight :: (self: *PxHeightField, x: float, z: float) -> float #foreign physx; + +PxHeightField_getTriangleMaterialIndex :: (self: *PxHeightField, triangleIndex: u32) -> u16 #foreign physx; + +PxHeightField_getTriangleNormal :: (self: *PxHeightField, triangleIndex: u32) -> Vector3 #foreign physx; + +PxHeightField_getSample :: (self: *PxHeightField, row: u32, column: u32) -> *PxHeightFieldSample #foreign physx; + +PxHeightField_getTimestamp :: (self: *PxHeightField) -> u32 #foreign physx; + +PxHeightField_getConcreteTypeName :: (self: *PxHeightField) -> *u8 #foreign physx; + +PxHeightFieldDesc_new :: () -> PxHeightFieldDesc #foreign physx; + +PxHeightFieldDesc_setToDefault :: (self: *PxHeightFieldDesc) -> void #foreign physx "PxHeightFieldDesc_setToDefault_mut"; + +PxHeightFieldDesc_isValid :: (self: *PxHeightFieldDesc) -> bool #foreign physx; + +PxMeshQuery_getTriangle :: (triGeom: *PxTriangleMeshGeometry, transform: *PxTransform, triangleIndex: u32, triangle: *PxTriangle, vertexIndices: *u32, adjacencyIndices: *u32) -> void #foreign physx; + +PxMeshQuery_getTriangle :: (hfGeom: *PxHeightFieldGeometry, transform: *PxTransform, triangleIndex: u32, triangle: *PxTriangle, vertexIndices: *u32, adjacencyIndices: *u32) -> void #foreign physx "PxMeshQuery_getTriangle_1"; + +PxMeshQuery_findOverlapTriangleMesh :: (geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform, results: *u32, maxResults: u32, startIndex: u32, overflow: *bool, queryFlags: u32) -> u32 #foreign physx; + +PxMeshQuery_findOverlapHeightField :: (geom: *PxGeometry, geomPose: *PxTransform, hfGeom: *PxHeightFieldGeometry, hfPose: *PxTransform, results: *u32, maxResults: u32, startIndex: u32, overflow: *bool, queryFlags: u32) -> u32 #foreign physx; + +PxMeshQuery_sweep :: (unitDir: *Vector3, distance: float, geom: *PxGeometry, pose: *PxTransform, triangleCount: u32, triangles: *PxTriangle, sweepHit: *PxGeomSweepHit, hitFlags: u16, cachedIndex: *u32, inflation: float, doubleSided: bool, queryFlags: u32) -> bool #foreign physx; + +PxSimpleTriangleMesh_new :: () -> PxSimpleTriangleMesh #foreign physx; + +PxSimpleTriangleMesh_setToDefault :: (self: *PxSimpleTriangleMesh) -> void #foreign physx "PxSimpleTriangleMesh_setToDefault_mut"; + +PxSimpleTriangleMesh_isValid :: (self: *PxSimpleTriangleMesh) -> bool #foreign physx; + +PxTriangle_new_alloc :: () -> *PxTriangle #foreign physx; + +PxTriangle_new_alloc :: (p0: *Vector3, p1: *Vector3, p2: *Vector3) -> *PxTriangle #foreign physx "PxTriangle_new_alloc_1"; + +PxTriangle_delete :: (self: *PxTriangle) -> void #foreign physx; + +PxTriangle_normal :: (self: *PxTriangle, _normal: *Vector3) -> void #foreign physx; + +PxTriangle_denormalizedNormal :: (self: *PxTriangle, _normal: *Vector3) -> void #foreign physx; + +PxTriangle_area :: (self: *PxTriangle) -> float #foreign physx; + +PxTriangle_pointFromUV :: (self: *PxTriangle, u: float, v: float) -> Vector3 #foreign physx; + +PxTrianglePadded_new_alloc :: () -> *PxTrianglePadded #foreign physx; + +PxTrianglePadded_delete :: (self: *PxTrianglePadded) -> void #foreign physx; + +PxTriangleMesh_getNbVertices :: (self: *PxTriangleMesh) -> u32 #foreign physx; + +PxTriangleMesh_getVertices :: (self: *PxTriangleMesh) -> *Vector3 #foreign physx; + +PxTriangleMesh_getVerticesForModification :: (self: *PxTriangleMesh) -> *Vector3 #foreign physx "PxTriangleMesh_getVerticesForModification_mut"; + +PxTriangleMesh_refitBVH :: (self: *PxTriangleMesh) -> PxBounds3 #foreign physx "PxTriangleMesh_refitBVH_mut"; + +PxTriangleMesh_getNbTriangles :: (self: *PxTriangleMesh) -> u32 #foreign physx; + +PxTriangleMesh_getTriangles :: (self: *PxTriangleMesh) -> *void #foreign physx; + +PxTriangleMesh_getTriangleMeshFlags :: (self: *PxTriangleMesh) -> u8 #foreign physx; + +PxTriangleMesh_getTrianglesRemap :: (self: *PxTriangleMesh) -> *u32 #foreign physx; + +PxTriangleMesh_release :: (self: *PxTriangleMesh) -> void #foreign physx "PxTriangleMesh_release_mut"; + +PxTriangleMesh_getTriangleMaterialIndex :: (self: *PxTriangleMesh, triangleIndex: u32) -> u16 #foreign physx; + +PxTriangleMesh_getLocalBounds :: (self: *PxTriangleMesh) -> PxBounds3 #foreign physx; + +PxTriangleMesh_getSDF :: (self: *PxTriangleMesh) -> *float #foreign physx; + +PxTriangleMesh_getSDFDimensions :: (self: *PxTriangleMesh, numX: *u32, numY: *u32, numZ: *u32) -> void #foreign physx; + +PxTriangleMesh_setPreferSDFProjection :: (self: *PxTriangleMesh, preferProjection: bool) -> void #foreign physx "PxTriangleMesh_setPreferSDFProjection_mut"; + +PxTriangleMesh_getPreferSDFProjection :: (self: *PxTriangleMesh) -> bool #foreign physx; + +PxTriangleMesh_getMassInformation :: (self: *PxTriangleMesh, mass: *float, localInertia: *PxMat33, localCenterOfMass: *Vector3) -> void #foreign physx; + +PxTetrahedron_new_alloc :: () -> *PxTetrahedron #foreign physx; + +PxTetrahedron_new_alloc :: (p0: *Vector3, p1: *Vector3, p2: *Vector3, p3: *Vector3) -> *PxTetrahedron #foreign physx "PxTetrahedron_new_alloc_1"; + +PxTetrahedron_delete :: (self: *PxTetrahedron) -> void #foreign physx; + +PxSoftBodyAuxData_release :: (self: *PxSoftBodyAuxData) -> void #foreign physx "PxSoftBodyAuxData_release_mut"; + +PxTetrahedronMesh_getNbVertices :: (self: *PxTetrahedronMesh) -> u32 #foreign physx; + +PxTetrahedronMesh_getVertices :: (self: *PxTetrahedronMesh) -> *Vector3 #foreign physx; + +PxTetrahedronMesh_getNbTetrahedrons :: (self: *PxTetrahedronMesh) -> u32 #foreign physx; + +PxTetrahedronMesh_getTetrahedrons :: (self: *PxTetrahedronMesh) -> *void #foreign physx; + +PxTetrahedronMesh_getTetrahedronMeshFlags :: (self: *PxTetrahedronMesh) -> u8 #foreign physx; + +PxTetrahedronMesh_getTetrahedraRemap :: (self: *PxTetrahedronMesh) -> *u32 #foreign physx; + +PxTetrahedronMesh_getLocalBounds :: (self: *PxTetrahedronMesh) -> PxBounds3 #foreign physx; + +PxTetrahedronMesh_release :: (self: *PxTetrahedronMesh) -> void #foreign physx "PxTetrahedronMesh_release_mut"; + +PxSoftBodyMesh_getCollisionMesh :: (self: *PxSoftBodyMesh) -> *PxTetrahedronMesh #foreign physx "PxSoftBodyMesh_getCollisionMesh_mut"; + +PxSoftBodyMesh_getSimulationMesh :: (self: *PxSoftBodyMesh) -> *PxTetrahedronMesh #foreign physx "PxSoftBodyMesh_getSimulationMesh_mut"; + +PxSoftBodyMesh_getSoftBodyAuxData :: (self: *PxSoftBodyMesh) -> *PxSoftBodyAuxData #foreign physx "PxSoftBodyMesh_getSoftBodyAuxData_mut"; + +PxSoftBodyMesh_release :: (self: *PxSoftBodyMesh) -> void #foreign physx "PxSoftBodyMesh_release_mut"; + +PxCollisionMeshMappingData_release :: (self: *PxCollisionMeshMappingData) -> void #foreign physx "PxCollisionMeshMappingData_release_mut"; + +PxCollisionTetrahedronMeshData_getMesh :: (self: *PxCollisionTetrahedronMeshData) -> *PxTetrahedronMeshData #foreign physx "PxCollisionTetrahedronMeshData_getMesh_mut"; + +PxCollisionTetrahedronMeshData_getData :: (self: *PxCollisionTetrahedronMeshData) -> *PxSoftBodyCollisionData #foreign physx "PxCollisionTetrahedronMeshData_getData_mut"; + +PxCollisionTetrahedronMeshData_release :: (self: *PxCollisionTetrahedronMeshData) -> void #foreign physx "PxCollisionTetrahedronMeshData_release_mut"; + +PxSimulationTetrahedronMeshData_getMesh :: (self: *PxSimulationTetrahedronMeshData) -> *PxTetrahedronMeshData #foreign physx "PxSimulationTetrahedronMeshData_getMesh_mut"; + +PxSimulationTetrahedronMeshData_getData :: (self: *PxSimulationTetrahedronMeshData) -> *PxSoftBodySimulationData #foreign physx "PxSimulationTetrahedronMeshData_getData_mut"; + +PxSimulationTetrahedronMeshData_release :: (self: *PxSimulationTetrahedronMeshData) -> void #foreign physx "PxSimulationTetrahedronMeshData_release_mut"; + +PxActor_release :: (self: *PxActor) -> void #foreign physx "PxActor_release_mut"; + +PxActor_getType :: (self: *PxActor) -> s32 #foreign physx; + +PxActor_getScene :: (self: *PxActor) -> *PxScene #foreign physx; + +PxActor_setName :: (self: *PxActor, name: *u8) -> void #foreign physx "PxActor_setName_mut"; + +PxActor_getName :: (self: *PxActor) -> *u8 #foreign physx; + +PxActor_getWorldBounds :: (self: *PxActor, inflation: float) -> PxBounds3 #foreign physx; + +PxActor_setActorFlag :: (self: *PxActor, flag: s32, value: bool) -> void #foreign physx "PxActor_setActorFlag_mut"; + +PxActor_setActorFlags :: (self: *PxActor, inFlags: u8) -> void #foreign physx "PxActor_setActorFlags_mut"; + +PxActor_getActorFlags :: (self: *PxActor) -> u8 #foreign physx; + +PxActor_setDominanceGroup :: (self: *PxActor, dominanceGroup: u8) -> void #foreign physx "PxActor_setDominanceGroup_mut"; + +PxActor_getDominanceGroup :: (self: *PxActor) -> u8 #foreign physx; + +PxActor_setOwnerClient :: (self: *PxActor, inClient: u8) -> void #foreign physx "PxActor_setOwnerClient_mut"; + +PxActor_getOwnerClient :: (self: *PxActor) -> u8 #foreign physx; + +PxActor_getAggregate :: (self: *PxActor) -> *PxAggregate #foreign physx; + +PxGetAggregateFilterHint :: (type: s32, enableSelfCollision: bool) -> u32 #foreign physx "phys_PxGetAggregateFilterHint"; + +PxGetAggregateSelfCollisionBit :: (hint: u32) -> u32 #foreign physx "phys_PxGetAggregateSelfCollisionBit"; + +PxGetAggregateType :: (hint: u32) -> s32 #foreign physx "phys_PxGetAggregateType"; + +PxAggregate_release :: (self: *PxAggregate) -> void #foreign physx "PxAggregate_release_mut"; + +PxAggregate_addActor :: (self: *PxAggregate, actor: *PxActor, bvh: *PxBVH) -> bool #foreign physx "PxAggregate_addActor_mut"; + +PxAggregate_removeActor :: (self: *PxAggregate, actor: *PxActor) -> bool #foreign physx "PxAggregate_removeActor_mut"; + +PxAggregate_addArticulation :: (self: *PxAggregate, articulation: *PxArticulationReducedCoordinate) -> bool #foreign physx "PxAggregate_addArticulation_mut"; + +PxAggregate_removeArticulation :: (self: *PxAggregate, articulation: *PxArticulationReducedCoordinate) -> bool #foreign physx "PxAggregate_removeArticulation_mut"; + +PxAggregate_getNbActors :: (self: *PxAggregate) -> u32 #foreign physx; + +PxAggregate_getMaxNbShapes :: (self: *PxAggregate) -> u32 #foreign physx; + +PxAggregate_getActors :: (self: *PxAggregate, userBuffer: **PxActor, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxAggregate_getScene :: (self: *PxAggregate) -> *PxScene #foreign physx "PxAggregate_getScene_mut"; + +PxAggregate_getSelfCollision :: (self: *PxAggregate) -> bool #foreign physx; + +PxAggregate_getConcreteTypeName :: (self: *PxAggregate) -> *u8 #foreign physx; + +PxConstraintInvMassScale_new :: () -> PxConstraintInvMassScale #foreign physx; + +PxConstraintInvMassScale_new :: (lin0: float, ang0: float, lin1: float, ang1: float) -> PxConstraintInvMassScale #foreign physx "PxConstraintInvMassScale_new_1"; + +PxConstraintVisualizer_visualizeJointFrames :: (self: *PxConstraintVisualizer, parent: *PxTransform, child: *PxTransform) -> void #foreign physx "PxConstraintVisualizer_visualizeJointFrames_mut"; + +PxConstraintVisualizer_visualizeLinearLimit :: (self: *PxConstraintVisualizer, t0: *PxTransform, t1: *PxTransform, value: float, active: bool) -> void #foreign physx "PxConstraintVisualizer_visualizeLinearLimit_mut"; + +PxConstraintVisualizer_visualizeAngularLimit :: (self: *PxConstraintVisualizer, t0: *PxTransform, lower: float, upper: float, active: bool) -> void #foreign physx "PxConstraintVisualizer_visualizeAngularLimit_mut"; + +PxConstraintVisualizer_visualizeLimitCone :: (self: *PxConstraintVisualizer, t: *PxTransform, tanQSwingY: float, tanQSwingZ: float, active: bool) -> void #foreign physx "PxConstraintVisualizer_visualizeLimitCone_mut"; + +PxConstraintVisualizer_visualizeDoubleCone :: (self: *PxConstraintVisualizer, t: *PxTransform, angle: float, active: bool) -> void #foreign physx "PxConstraintVisualizer_visualizeDoubleCone_mut"; + +PxConstraintVisualizer_visualizeLine :: (self: *PxConstraintVisualizer, p0: *Vector3, p1: *Vector3, color: u32) -> void #foreign physx "PxConstraintVisualizer_visualizeLine_mut"; + +PxConstraintConnector_prepareData :: (self: *PxConstraintConnector) -> *void #foreign physx "PxConstraintConnector_prepareData_mut"; + +PxConstraintConnector_onConstraintRelease :: (self: *PxConstraintConnector) -> void #foreign physx "PxConstraintConnector_onConstraintRelease_mut"; + +PxConstraintConnector_onComShift :: (self: *PxConstraintConnector, actor: u32) -> void #foreign physx "PxConstraintConnector_onComShift_mut"; + +PxConstraintConnector_onOriginShift :: (self: *PxConstraintConnector, shift: *Vector3) -> void #foreign physx "PxConstraintConnector_onOriginShift_mut"; + +PxConstraintConnector_getSerializable :: (self: *PxConstraintConnector) -> *PxBase #foreign physx "PxConstraintConnector_getSerializable_mut"; + +PxConstraintConnector_getConstantBlock :: (self: *PxConstraintConnector) -> *void #foreign physx; + +PxConstraintConnector_connectToConstraint :: (self: *PxConstraintConnector, anon_param0: *PxConstraint) -> void #foreign physx "PxConstraintConnector_connectToConstraint_mut"; + +PxConstraintConnector_delete :: (self: *PxConstraintConnector) -> void #foreign physx; + +PxSolverBody_new :: () -> PxSolverBody #foreign physx; + +PxSolverBodyData_projectVelocity :: (self: *PxSolverBodyData, lin: *Vector3, ang: *Vector3) -> float #foreign physx; + +PxSolverConstraintPrepDesc_delete :: (self: *PxSolverConstraintPrepDesc) -> void #foreign physx; + +PxConstraintAllocator_reserveConstraintData :: (self: *PxConstraintAllocator, byteSize: u32) -> *u8 #foreign physx "PxConstraintAllocator_reserveConstraintData_mut"; + +PxConstraintAllocator_reserveFrictionData :: (self: *PxConstraintAllocator, byteSize: u32) -> *u8 #foreign physx "PxConstraintAllocator_reserveFrictionData_mut"; + +PxConstraintAllocator_delete :: (self: *PxConstraintAllocator) -> void #foreign physx; + +PxArticulationLimit_new :: () -> PxArticulationLimit #foreign physx; + +PxArticulationLimit_new :: (low_: float, high_: float) -> PxArticulationLimit #foreign physx "PxArticulationLimit_new_1"; + +PxArticulationDrive_new :: () -> PxArticulationDrive #foreign physx; + +PxArticulationDrive_new :: (stiffness_: float, damping_: float, maxForce_: float, driveType: s32) -> PxArticulationDrive #foreign physx "PxArticulationDrive_new_1"; + +PxTGSSolverBodyVel_projectVelocity :: (self: *PxTGSSolverBodyVel, lin: *Vector3, ang: *Vector3) -> float #foreign physx; + +PxTGSSolverBodyData_projectVelocity :: (self: *PxTGSSolverBodyData, linear: *Vector3, angular: *Vector3) -> float #foreign physx; + +PxTGSSolverConstraintPrepDesc_delete :: (self: *PxTGSSolverConstraintPrepDesc) -> void #foreign physx; + +PxArticulationAttachment_setRestLength :: (self: *PxArticulationAttachment, restLength: float) -> void #foreign physx "PxArticulationAttachment_setRestLength_mut"; + +PxArticulationAttachment_getRestLength :: (self: *PxArticulationAttachment) -> float #foreign physx; + +PxArticulationAttachment_setLimitParameters :: (self: *PxArticulationAttachment, parameters: *PxArticulationTendonLimit) -> void #foreign physx "PxArticulationAttachment_setLimitParameters_mut"; + +PxArticulationAttachment_getLimitParameters :: (self: *PxArticulationAttachment) -> PxArticulationTendonLimit #foreign physx; + +PxArticulationAttachment_setRelativeOffset :: (self: *PxArticulationAttachment, offset: *Vector3) -> void #foreign physx "PxArticulationAttachment_setRelativeOffset_mut"; + +PxArticulationAttachment_getRelativeOffset :: (self: *PxArticulationAttachment) -> Vector3 #foreign physx; + +PxArticulationAttachment_setCoefficient :: (self: *PxArticulationAttachment, coefficient: float) -> void #foreign physx "PxArticulationAttachment_setCoefficient_mut"; + +PxArticulationAttachment_getCoefficient :: (self: *PxArticulationAttachment) -> float #foreign physx; + +PxArticulationAttachment_getLink :: (self: *PxArticulationAttachment) -> *PxArticulationLink #foreign physx; + +PxArticulationAttachment_getParent :: (self: *PxArticulationAttachment) -> *PxArticulationAttachment #foreign physx; + +PxArticulationAttachment_isLeaf :: (self: *PxArticulationAttachment) -> bool #foreign physx; + +PxArticulationAttachment_getTendon :: (self: *PxArticulationAttachment) -> *PxArticulationSpatialTendon #foreign physx; + +PxArticulationAttachment_release :: (self: *PxArticulationAttachment) -> void #foreign physx "PxArticulationAttachment_release_mut"; + +PxArticulationAttachment_getConcreteTypeName :: (self: *PxArticulationAttachment) -> *u8 #foreign physx; + +PxArticulationTendonJoint_setCoefficient :: (self: *PxArticulationTendonJoint, axis: s32, coefficient: float, recipCoefficient: float) -> void #foreign physx "PxArticulationTendonJoint_setCoefficient_mut"; + +PxArticulationTendonJoint_getCoefficient :: (self: *PxArticulationTendonJoint, axis: *s32, coefficient: *float, recipCoefficient: *float) -> void #foreign physx; + +PxArticulationTendonJoint_getLink :: (self: *PxArticulationTendonJoint) -> *PxArticulationLink #foreign physx; + +PxArticulationTendonJoint_getParent :: (self: *PxArticulationTendonJoint) -> *PxArticulationTendonJoint #foreign physx; + +PxArticulationTendonJoint_getTendon :: (self: *PxArticulationTendonJoint) -> *PxArticulationFixedTendon #foreign physx; + +PxArticulationTendonJoint_release :: (self: *PxArticulationTendonJoint) -> void #foreign physx "PxArticulationTendonJoint_release_mut"; + +PxArticulationTendonJoint_getConcreteTypeName :: (self: *PxArticulationTendonJoint) -> *u8 #foreign physx; + +PxArticulationTendon_setStiffness :: (self: *PxArticulationTendon, stiffness: float) -> void #foreign physx "PxArticulationTendon_setStiffness_mut"; + +PxArticulationTendon_getStiffness :: (self: *PxArticulationTendon) -> float #foreign physx; + +PxArticulationTendon_setDamping :: (self: *PxArticulationTendon, damping: float) -> void #foreign physx "PxArticulationTendon_setDamping_mut"; + +PxArticulationTendon_getDamping :: (self: *PxArticulationTendon) -> float #foreign physx; + +PxArticulationTendon_setLimitStiffness :: (self: *PxArticulationTendon, stiffness: float) -> void #foreign physx "PxArticulationTendon_setLimitStiffness_mut"; + +PxArticulationTendon_getLimitStiffness :: (self: *PxArticulationTendon) -> float #foreign physx; + +PxArticulationTendon_setOffset :: (self: *PxArticulationTendon, offset: float, autowake: bool) -> void #foreign physx "PxArticulationTendon_setOffset_mut"; + +PxArticulationTendon_getOffset :: (self: *PxArticulationTendon) -> float #foreign physx; + +PxArticulationTendon_getArticulation :: (self: *PxArticulationTendon) -> *PxArticulationReducedCoordinate #foreign physx; + +PxArticulationTendon_release :: (self: *PxArticulationTendon) -> void #foreign physx "PxArticulationTendon_release_mut"; + +PxArticulationSpatialTendon_createAttachment :: (self: *PxArticulationSpatialTendon, parent: *PxArticulationAttachment, coefficient: float, relativeOffset: Vector3, link: *PxArticulationLink) -> *PxArticulationAttachment #foreign physx "PxArticulationSpatialTendon_createAttachment_mut"; + +PxArticulationSpatialTendon_getAttachments :: (self: *PxArticulationSpatialTendon, userBuffer: **PxArticulationAttachment, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationSpatialTendon_getNbAttachments :: (self: *PxArticulationSpatialTendon) -> u32 #foreign physx; + +PxArticulationSpatialTendon_getConcreteTypeName :: (self: *PxArticulationSpatialTendon) -> *u8 #foreign physx; + +PxArticulationFixedTendon_createTendonJoint :: (self: *PxArticulationFixedTendon, parent: *PxArticulationTendonJoint, axis: s32, coefficient: float, recipCoefficient: float, link: *PxArticulationLink) -> *PxArticulationTendonJoint #foreign physx "PxArticulationFixedTendon_createTendonJoint_mut"; + +PxArticulationFixedTendon_getTendonJoints :: (self: *PxArticulationFixedTendon, userBuffer: **PxArticulationTendonJoint, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationFixedTendon_getNbTendonJoints :: (self: *PxArticulationFixedTendon) -> u32 #foreign physx; + +PxArticulationFixedTendon_setRestLength :: (self: *PxArticulationFixedTendon, restLength: float) -> void #foreign physx "PxArticulationFixedTendon_setRestLength_mut"; + +PxArticulationFixedTendon_getRestLength :: (self: *PxArticulationFixedTendon) -> float #foreign physx; + +PxArticulationFixedTendon_setLimitParameters :: (self: *PxArticulationFixedTendon, parameter: *PxArticulationTendonLimit) -> void #foreign physx "PxArticulationFixedTendon_setLimitParameters_mut"; + +PxArticulationFixedTendon_getLimitParameters :: (self: *PxArticulationFixedTendon) -> PxArticulationTendonLimit #foreign physx; + +PxArticulationFixedTendon_getConcreteTypeName :: (self: *PxArticulationFixedTendon) -> *u8 #foreign physx; + +PxArticulationCache_new :: () -> PxArticulationCache #foreign physx; + +PxArticulationCache_release :: (self: *PxArticulationCache) -> void #foreign physx "PxArticulationCache_release_mut"; + +PxArticulationSensor_release :: (self: *PxArticulationSensor) -> void #foreign physx "PxArticulationSensor_release_mut"; + +PxArticulationSensor_getForces :: (self: *PxArticulationSensor) -> PxSpatialForce #foreign physx; + +PxArticulationSensor_getRelativePose :: (self: *PxArticulationSensor) -> PxTransform #foreign physx; + +PxArticulationSensor_setRelativePose :: (self: *PxArticulationSensor, pose: *PxTransform) -> void #foreign physx "PxArticulationSensor_setRelativePose_mut"; + +PxArticulationSensor_getLink :: (self: *PxArticulationSensor) -> *PxArticulationLink #foreign physx; + +PxArticulationSensor_getIndex :: (self: *PxArticulationSensor) -> u32 #foreign physx; + +PxArticulationSensor_getArticulation :: (self: *PxArticulationSensor) -> *PxArticulationReducedCoordinate #foreign physx; + +PxArticulationSensor_getFlags :: (self: *PxArticulationSensor) -> u8 #foreign physx; + +PxArticulationSensor_setFlag :: (self: *PxArticulationSensor, flag: s32, enabled: bool) -> void #foreign physx "PxArticulationSensor_setFlag_mut"; + +PxArticulationSensor_getConcreteTypeName :: (self: *PxArticulationSensor) -> *u8 #foreign physx; + +PxArticulationReducedCoordinate_getScene :: (self: *PxArticulationReducedCoordinate) -> *PxScene #foreign physx; + +PxArticulationReducedCoordinate_setSolverIterationCounts :: (self: *PxArticulationReducedCoordinate, minPositionIters: u32, minVelocityIters: u32) -> void #foreign physx "PxArticulationReducedCoordinate_setSolverIterationCounts_mut"; + +PxArticulationReducedCoordinate_getSolverIterationCounts :: (self: *PxArticulationReducedCoordinate, minPositionIters: *u32, minVelocityIters: *u32) -> void #foreign physx; + +PxArticulationReducedCoordinate_isSleeping :: (self: *PxArticulationReducedCoordinate) -> bool #foreign physx; + +PxArticulationReducedCoordinate_setSleepThreshold :: (self: *PxArticulationReducedCoordinate, threshold: float) -> void #foreign physx "PxArticulationReducedCoordinate_setSleepThreshold_mut"; + +PxArticulationReducedCoordinate_getSleepThreshold :: (self: *PxArticulationReducedCoordinate) -> float #foreign physx; + +PxArticulationReducedCoordinate_setStabilizationThreshold :: (self: *PxArticulationReducedCoordinate, threshold: float) -> void #foreign physx "PxArticulationReducedCoordinate_setStabilizationThreshold_mut"; + +PxArticulationReducedCoordinate_getStabilizationThreshold :: (self: *PxArticulationReducedCoordinate) -> float #foreign physx; + +PxArticulationReducedCoordinate_setWakeCounter :: (self: *PxArticulationReducedCoordinate, wakeCounterValue: float) -> void #foreign physx "PxArticulationReducedCoordinate_setWakeCounter_mut"; + +PxArticulationReducedCoordinate_getWakeCounter :: (self: *PxArticulationReducedCoordinate) -> float #foreign physx; + +PxArticulationReducedCoordinate_wakeUp :: (self: *PxArticulationReducedCoordinate) -> void #foreign physx "PxArticulationReducedCoordinate_wakeUp_mut"; + +PxArticulationReducedCoordinate_putToSleep :: (self: *PxArticulationReducedCoordinate) -> void #foreign physx "PxArticulationReducedCoordinate_putToSleep_mut"; + +PxArticulationReducedCoordinate_setMaxCOMLinearVelocity :: (self: *PxArticulationReducedCoordinate, maxLinearVelocity: float) -> void #foreign physx "PxArticulationReducedCoordinate_setMaxCOMLinearVelocity_mut"; + +PxArticulationReducedCoordinate_getMaxCOMLinearVelocity :: (self: *PxArticulationReducedCoordinate) -> float #foreign physx; + +PxArticulationReducedCoordinate_setMaxCOMAngularVelocity :: (self: *PxArticulationReducedCoordinate, maxAngularVelocity: float) -> void #foreign physx "PxArticulationReducedCoordinate_setMaxCOMAngularVelocity_mut"; + +PxArticulationReducedCoordinate_getMaxCOMAngularVelocity :: (self: *PxArticulationReducedCoordinate) -> float #foreign physx; + +PxArticulationReducedCoordinate_createLink :: (self: *PxArticulationReducedCoordinate, parent: *PxArticulationLink, pose: *PxTransform) -> *PxArticulationLink #foreign physx "PxArticulationReducedCoordinate_createLink_mut"; + +PxArticulationReducedCoordinate_release :: (self: *PxArticulationReducedCoordinate) -> void #foreign physx "PxArticulationReducedCoordinate_release_mut"; + +PxArticulationReducedCoordinate_getNbLinks :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getLinks :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getNbShapes :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_setName :: (self: *PxArticulationReducedCoordinate, name: *u8) -> void #foreign physx "PxArticulationReducedCoordinate_setName_mut"; + +PxArticulationReducedCoordinate_getName :: (self: *PxArticulationReducedCoordinate) -> *u8 #foreign physx; + +PxArticulationReducedCoordinate_getWorldBounds :: (self: *PxArticulationReducedCoordinate, inflation: float) -> PxBounds3 #foreign physx; + +PxArticulationReducedCoordinate_getAggregate :: (self: *PxArticulationReducedCoordinate) -> *PxAggregate #foreign physx; + +PxArticulationReducedCoordinate_setArticulationFlags :: (self: *PxArticulationReducedCoordinate, flags: u8) -> void #foreign physx "PxArticulationReducedCoordinate_setArticulationFlags_mut"; + +PxArticulationReducedCoordinate_setArticulationFlag :: (self: *PxArticulationReducedCoordinate, flag: s32, value: bool) -> void #foreign physx "PxArticulationReducedCoordinate_setArticulationFlag_mut"; + +PxArticulationReducedCoordinate_getArticulationFlags :: (self: *PxArticulationReducedCoordinate) -> u8 #foreign physx; + +PxArticulationReducedCoordinate_getDofs :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_createCache :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationCache #foreign physx; + +PxArticulationReducedCoordinate_getCacheDataSize :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_zeroCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_applyCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, flags: u32, autowake: bool) -> void #foreign physx "PxArticulationReducedCoordinate_applyCache_mut"; + +PxArticulationReducedCoordinate_copyInternalStateToCache :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, flags: u32) -> void #foreign physx; + +PxArticulationReducedCoordinate_packJointData :: (self: *PxArticulationReducedCoordinate, maximum: *float, reduced: *float) -> void #foreign physx; + +PxArticulationReducedCoordinate_unpackJointData :: (self: *PxArticulationReducedCoordinate, reduced: *float, maximum: *float) -> void #foreign physx; + +PxArticulationReducedCoordinate_commonInit :: (self: *PxArticulationReducedCoordinate) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeGeneralizedGravityForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeCoriolisAndCentrifugalForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeGeneralizedExternalForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeJointAcceleration :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeJointForce :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeDenseJacobian :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, nRows: *u32, nCols: *u32) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeCoefficientMatrix :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_computeLambda :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache, initialState: *PxArticulationCache, jointTorque: *float, maxIter: u32) -> bool #foreign physx; + +PxArticulationReducedCoordinate_computeGeneralizedMassMatrix :: (self: *PxArticulationReducedCoordinate, cache: *PxArticulationCache) -> void #foreign physx; + +PxArticulationReducedCoordinate_addLoopJoint :: (self: *PxArticulationReducedCoordinate, joint: *PxConstraint) -> void #foreign physx "PxArticulationReducedCoordinate_addLoopJoint_mut"; + +PxArticulationReducedCoordinate_removeLoopJoint :: (self: *PxArticulationReducedCoordinate, joint: *PxConstraint) -> void #foreign physx "PxArticulationReducedCoordinate_removeLoopJoint_mut"; + +PxArticulationReducedCoordinate_getNbLoopJoints :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getLoopJoints :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getCoefficientMatrixSize :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_setRootGlobalPose :: (self: *PxArticulationReducedCoordinate, pose: *PxTransform, autowake: bool) -> void #foreign physx "PxArticulationReducedCoordinate_setRootGlobalPose_mut"; + +PxArticulationReducedCoordinate_getRootGlobalPose :: (self: *PxArticulationReducedCoordinate) -> PxTransform #foreign physx; + +PxArticulationReducedCoordinate_setRootLinearVelocity :: (self: *PxArticulationReducedCoordinate, linearVelocity: *Vector3, autowake: bool) -> void #foreign physx "PxArticulationReducedCoordinate_setRootLinearVelocity_mut"; + +PxArticulationReducedCoordinate_getRootLinearVelocity :: (self: *PxArticulationReducedCoordinate) -> Vector3 #foreign physx; + +PxArticulationReducedCoordinate_setRootAngularVelocity :: (self: *PxArticulationReducedCoordinate, angularVelocity: *Vector3, autowake: bool) -> void #foreign physx "PxArticulationReducedCoordinate_setRootAngularVelocity_mut"; + +PxArticulationReducedCoordinate_getRootAngularVelocity :: (self: *PxArticulationReducedCoordinate) -> Vector3 #foreign physx; + +PxArticulationReducedCoordinate_getLinkAcceleration :: (self: *PxArticulationReducedCoordinate, linkId: u32) -> PxSpatialVelocity #foreign physx "PxArticulationReducedCoordinate_getLinkAcceleration_mut"; + +PxArticulationReducedCoordinate_getGpuArticulationIndex :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx "PxArticulationReducedCoordinate_getGpuArticulationIndex_mut"; + +PxArticulationReducedCoordinate_createSpatialTendon :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationSpatialTendon #foreign physx "PxArticulationReducedCoordinate_createSpatialTendon_mut"; + +PxArticulationReducedCoordinate_createFixedTendon :: (self: *PxArticulationReducedCoordinate) -> *PxArticulationFixedTendon #foreign physx "PxArticulationReducedCoordinate_createFixedTendon_mut"; + +PxArticulationReducedCoordinate_createSensor :: (self: *PxArticulationReducedCoordinate, link: *PxArticulationLink, relativePose: *PxTransform) -> *PxArticulationSensor #foreign physx "PxArticulationReducedCoordinate_createSensor_mut"; + +PxArticulationReducedCoordinate_getSpatialTendons :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationSpatialTendon, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getNbSpatialTendons :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx "PxArticulationReducedCoordinate_getNbSpatialTendons_mut"; + +PxArticulationReducedCoordinate_getFixedTendons :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationFixedTendon, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getNbFixedTendons :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx "PxArticulationReducedCoordinate_getNbFixedTendons_mut"; + +PxArticulationReducedCoordinate_getSensors :: (self: *PxArticulationReducedCoordinate, userBuffer: **PxArticulationSensor, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationReducedCoordinate_getNbSensors :: (self: *PxArticulationReducedCoordinate) -> u32 #foreign physx "PxArticulationReducedCoordinate_getNbSensors_mut"; + +PxArticulationReducedCoordinate_updateKinematic :: (self: *PxArticulationReducedCoordinate, flags: u8) -> void #foreign physx "PxArticulationReducedCoordinate_updateKinematic_mut"; + +PxArticulationJointReducedCoordinate_getParentArticulationLink :: (self: *PxArticulationJointReducedCoordinate) -> *PxArticulationLink #foreign physx; + +PxArticulationJointReducedCoordinate_setParentPose :: (self: *PxArticulationJointReducedCoordinate, pose: *PxTransform) -> void #foreign physx "PxArticulationJointReducedCoordinate_setParentPose_mut"; + +PxArticulationJointReducedCoordinate_getParentPose :: (self: *PxArticulationJointReducedCoordinate) -> PxTransform #foreign physx; + +PxArticulationJointReducedCoordinate_getChildArticulationLink :: (self: *PxArticulationJointReducedCoordinate) -> *PxArticulationLink #foreign physx; + +PxArticulationJointReducedCoordinate_setChildPose :: (self: *PxArticulationJointReducedCoordinate, pose: *PxTransform) -> void #foreign physx "PxArticulationJointReducedCoordinate_setChildPose_mut"; + +PxArticulationJointReducedCoordinate_getChildPose :: (self: *PxArticulationJointReducedCoordinate) -> PxTransform #foreign physx; + +PxArticulationJointReducedCoordinate_setJointType :: (self: *PxArticulationJointReducedCoordinate, jointType: s32) -> void #foreign physx "PxArticulationJointReducedCoordinate_setJointType_mut"; + +PxArticulationJointReducedCoordinate_getJointType :: (self: *PxArticulationJointReducedCoordinate) -> s32 #foreign physx; + +PxArticulationJointReducedCoordinate_setMotion :: (self: *PxArticulationJointReducedCoordinate, axis: s32, motion: s32) -> void #foreign physx "PxArticulationJointReducedCoordinate_setMotion_mut"; + +PxArticulationJointReducedCoordinate_getMotion :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> s32 #foreign physx; + +PxArticulationJointReducedCoordinate_setLimitParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32, limit: *PxArticulationLimit) -> void #foreign physx "PxArticulationJointReducedCoordinate_setLimitParams_mut"; + +PxArticulationJointReducedCoordinate_getLimitParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> PxArticulationLimit #foreign physx; + +PxArticulationJointReducedCoordinate_setDriveParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32, drive: *PxArticulationDrive) -> void #foreign physx "PxArticulationJointReducedCoordinate_setDriveParams_mut"; + +PxArticulationJointReducedCoordinate_getDriveParams :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> PxArticulationDrive #foreign physx; + +PxArticulationJointReducedCoordinate_setDriveTarget :: (self: *PxArticulationJointReducedCoordinate, axis: s32, target: float, autowake: bool) -> void #foreign physx "PxArticulationJointReducedCoordinate_setDriveTarget_mut"; + +PxArticulationJointReducedCoordinate_getDriveTarget :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setDriveVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32, targetVel: float, autowake: bool) -> void #foreign physx "PxArticulationJointReducedCoordinate_setDriveVelocity_mut"; + +PxArticulationJointReducedCoordinate_getDriveVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setArmature :: (self: *PxArticulationJointReducedCoordinate, axis: s32, armature: float) -> void #foreign physx "PxArticulationJointReducedCoordinate_setArmature_mut"; + +PxArticulationJointReducedCoordinate_getArmature :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setFrictionCoefficient :: (self: *PxArticulationJointReducedCoordinate, coefficient: float) -> void #foreign physx "PxArticulationJointReducedCoordinate_setFrictionCoefficient_mut"; + +PxArticulationJointReducedCoordinate_getFrictionCoefficient :: (self: *PxArticulationJointReducedCoordinate) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setMaxJointVelocity :: (self: *PxArticulationJointReducedCoordinate, maxJointV: float) -> void #foreign physx "PxArticulationJointReducedCoordinate_setMaxJointVelocity_mut"; + +PxArticulationJointReducedCoordinate_getMaxJointVelocity :: (self: *PxArticulationJointReducedCoordinate) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setJointPosition :: (self: *PxArticulationJointReducedCoordinate, axis: s32, jointPos: float) -> void #foreign physx "PxArticulationJointReducedCoordinate_setJointPosition_mut"; + +PxArticulationJointReducedCoordinate_getJointPosition :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_setJointVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32, jointVel: float) -> void #foreign physx "PxArticulationJointReducedCoordinate_setJointVelocity_mut"; + +PxArticulationJointReducedCoordinate_getJointVelocity :: (self: *PxArticulationJointReducedCoordinate, axis: s32) -> float #foreign physx; + +PxArticulationJointReducedCoordinate_getConcreteTypeName :: (self: *PxArticulationJointReducedCoordinate) -> *u8 #foreign physx; + +PxShape_release :: (self: *PxShape) -> void #foreign physx "PxShape_release_mut"; + +PxShape_setGeometry :: (self: *PxShape, geometry: *PxGeometry) -> void #foreign physx "PxShape_setGeometry_mut"; + +PxShape_getGeometry :: (self: *PxShape) -> *PxGeometry #foreign physx; + +PxShape_getActor :: (self: *PxShape) -> *PxRigidActor #foreign physx; + +PxShape_setLocalPose :: (self: *PxShape, pose: *PxTransform) -> void #foreign physx "PxShape_setLocalPose_mut"; + +PxShape_getLocalPose :: (self: *PxShape) -> PxTransform #foreign physx; + +PxShape_setSimulationFilterData :: (self: *PxShape, data: *PxFilterData) -> void #foreign physx "PxShape_setSimulationFilterData_mut"; + +PxShape_getSimulationFilterData :: (self: *PxShape) -> PxFilterData #foreign physx; + +PxShape_setQueryFilterData :: (self: *PxShape, data: *PxFilterData) -> void #foreign physx "PxShape_setQueryFilterData_mut"; + +PxShape_getQueryFilterData :: (self: *PxShape) -> PxFilterData #foreign physx; + +PxShape_setMaterials :: (self: *PxShape, materials: **PxMaterial, materialCount: u16) -> void #foreign physx "PxShape_setMaterials_mut"; + +PxShape_getNbMaterials :: (self: *PxShape) -> u16 #foreign physx; + +PxShape_getMaterials :: (self: *PxShape, userBuffer: **PxMaterial, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxShape_getMaterialFromInternalFaceIndex :: (self: *PxShape, faceIndex: u32) -> *PxBaseMaterial #foreign physx; + +PxShape_setContactOffset :: (self: *PxShape, contactOffset: float) -> void #foreign physx "PxShape_setContactOffset_mut"; + +PxShape_getContactOffset :: (self: *PxShape) -> float #foreign physx; + +PxShape_setRestOffset :: (self: *PxShape, restOffset: float) -> void #foreign physx "PxShape_setRestOffset_mut"; + +PxShape_getRestOffset :: (self: *PxShape) -> float #foreign physx; + +PxShape_setDensityForFluid :: (self: *PxShape, densityForFluid: float) -> void #foreign physx "PxShape_setDensityForFluid_mut"; + +PxShape_getDensityForFluid :: (self: *PxShape) -> float #foreign physx; + +PxShape_setTorsionalPatchRadius :: (self: *PxShape, radius: float) -> void #foreign physx "PxShape_setTorsionalPatchRadius_mut"; + +PxShape_getTorsionalPatchRadius :: (self: *PxShape) -> float #foreign physx; + +PxShape_setMinTorsionalPatchRadius :: (self: *PxShape, radius: float) -> void #foreign physx "PxShape_setMinTorsionalPatchRadius_mut"; + +PxShape_getMinTorsionalPatchRadius :: (self: *PxShape) -> float #foreign physx; + +PxShape_setFlag :: (self: *PxShape, flag: s32, value: bool) -> void #foreign physx "PxShape_setFlag_mut"; + +PxShape_setFlags :: (self: *PxShape, inFlags: u8) -> void #foreign physx "PxShape_setFlags_mut"; + +PxShape_getFlags :: (self: *PxShape) -> u8 #foreign physx; + +PxShape_isExclusive :: (self: *PxShape) -> bool #foreign physx; + +PxShape_setName :: (self: *PxShape, name: *u8) -> void #foreign physx "PxShape_setName_mut"; + +PxShape_getName :: (self: *PxShape) -> *u8 #foreign physx; + +PxShape_getConcreteTypeName :: (self: *PxShape) -> *u8 #foreign physx; + +PxRigidActor_release :: (self: *PxRigidActor) -> void #foreign physx "PxRigidActor_release_mut"; + +PxRigidActor_getInternalActorIndex :: (self: *PxRigidActor) -> u32 #foreign physx; + +PxRigidActor_getGlobalPose :: (self: *PxRigidActor) -> PxTransform #foreign physx; + +PxRigidActor_setGlobalPose :: (self: *PxRigidActor, pose: *PxTransform, autowake: bool) -> void #foreign physx "PxRigidActor_setGlobalPose_mut"; + +PxRigidActor_attachShape :: (self: *PxRigidActor, shape: *PxShape) -> bool #foreign physx "PxRigidActor_attachShape_mut"; + +PxRigidActor_detachShape :: (self: *PxRigidActor, shape: *PxShape, wakeOnLostTouch: bool) -> void #foreign physx "PxRigidActor_detachShape_mut"; + +PxRigidActor_getNbShapes :: (self: *PxRigidActor) -> u32 #foreign physx; + +PxRigidActor_getShapes :: (self: *PxRigidActor, userBuffer: **PxShape, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxRigidActor_getNbConstraints :: (self: *PxRigidActor) -> u32 #foreign physx; + +PxRigidActor_getConstraints :: (self: *PxRigidActor, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxNodeIndex_new :: (id: u32, articLinkId: u32) -> PxNodeIndex #foreign physx; + +PxNodeIndex_new :: (id: u32) -> PxNodeIndex #foreign physx "PxNodeIndex_new_1"; + +PxNodeIndex_index :: (self: *PxNodeIndex) -> u32 #foreign physx; + +PxNodeIndex_articulationLinkId :: (self: *PxNodeIndex) -> u32 #foreign physx; + +PxNodeIndex_isArticulation :: (self: *PxNodeIndex) -> u32 #foreign physx; + +PxNodeIndex_isStaticBody :: (self: *PxNodeIndex) -> bool #foreign physx; + +PxNodeIndex_isValid :: (self: *PxNodeIndex) -> bool #foreign physx; + +PxNodeIndex_setIndices :: (self: *PxNodeIndex, index: u32, articLinkId: u32) -> void #foreign physx "PxNodeIndex_setIndices_mut"; + +PxNodeIndex_setIndices_mut :: (self: *PxNodeIndex, index: u32) -> void #foreign physx "PxNodeIndex_setIndices_mut_1"; + +PxNodeIndex_getInd :: (self: *PxNodeIndex) -> u64 #foreign physx; + +PxRigidBody_setCMassLocalPose :: (self: *PxRigidBody, pose: *PxTransform) -> void #foreign physx "PxRigidBody_setCMassLocalPose_mut"; + +PxRigidBody_getCMassLocalPose :: (self: *PxRigidBody) -> PxTransform #foreign physx; + +PxRigidBody_setMass :: (self: *PxRigidBody, mass: float) -> void #foreign physx "PxRigidBody_setMass_mut"; + +PxRigidBody_getMass :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_getInvMass :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setMassSpaceInertiaTensor :: (self: *PxRigidBody, m: *Vector3) -> void #foreign physx "PxRigidBody_setMassSpaceInertiaTensor_mut"; + +PxRigidBody_getMassSpaceInertiaTensor :: (self: *PxRigidBody) -> Vector3 #foreign physx; + +PxRigidBody_getMassSpaceInvInertiaTensor :: (self: *PxRigidBody) -> Vector3 #foreign physx; + +PxRigidBody_setLinearDamping :: (self: *PxRigidBody, linDamp: float) -> void #foreign physx "PxRigidBody_setLinearDamping_mut"; + +PxRigidBody_getLinearDamping :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setAngularDamping :: (self: *PxRigidBody, angDamp: float) -> void #foreign physx "PxRigidBody_setAngularDamping_mut"; + +PxRigidBody_getAngularDamping :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_getLinearVelocity :: (self: *PxRigidBody) -> Vector3 #foreign physx; + +PxRigidBody_getAngularVelocity :: (self: *PxRigidBody) -> Vector3 #foreign physx; + +PxRigidBody_setMaxLinearVelocity :: (self: *PxRigidBody, maxLinVel: float) -> void #foreign physx "PxRigidBody_setMaxLinearVelocity_mut"; + +PxRigidBody_getMaxLinearVelocity :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setMaxAngularVelocity :: (self: *PxRigidBody, maxAngVel: float) -> void #foreign physx "PxRigidBody_setMaxAngularVelocity_mut"; + +PxRigidBody_getMaxAngularVelocity :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_addForce :: (self: *PxRigidBody, force: *Vector3, mode: s32, autowake: bool) -> void #foreign physx "PxRigidBody_addForce_mut"; + +PxRigidBody_addTorque :: (self: *PxRigidBody, torque: *Vector3, mode: s32, autowake: bool) -> void #foreign physx "PxRigidBody_addTorque_mut"; + +PxRigidBody_clearForce :: (self: *PxRigidBody, mode: s32) -> void #foreign physx "PxRigidBody_clearForce_mut"; + +PxRigidBody_clearTorque :: (self: *PxRigidBody, mode: s32) -> void #foreign physx "PxRigidBody_clearTorque_mut"; + +PxRigidBody_setForceAndTorque :: (self: *PxRigidBody, force: *Vector3, torque: *Vector3, mode: s32) -> void #foreign physx "PxRigidBody_setForceAndTorque_mut"; + +PxRigidBody_setRigidBodyFlag :: (self: *PxRigidBody, flag: s32, value: bool) -> void #foreign physx "PxRigidBody_setRigidBodyFlag_mut"; + +PxRigidBody_setRigidBodyFlags :: (self: *PxRigidBody, inFlags: u16) -> void #foreign physx "PxRigidBody_setRigidBodyFlags_mut"; + +PxRigidBody_getRigidBodyFlags :: (self: *PxRigidBody) -> u16 #foreign physx; + +PxRigidBody_setMinCCDAdvanceCoefficient :: (self: *PxRigidBody, advanceCoefficient: float) -> void #foreign physx "PxRigidBody_setMinCCDAdvanceCoefficient_mut"; + +PxRigidBody_getMinCCDAdvanceCoefficient :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setMaxDepenetrationVelocity :: (self: *PxRigidBody, biasClamp: float) -> void #foreign physx "PxRigidBody_setMaxDepenetrationVelocity_mut"; + +PxRigidBody_getMaxDepenetrationVelocity :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setMaxContactImpulse :: (self: *PxRigidBody, maxImpulse: float) -> void #foreign physx "PxRigidBody_setMaxContactImpulse_mut"; + +PxRigidBody_getMaxContactImpulse :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_setContactSlopCoefficient :: (self: *PxRigidBody, slopCoefficient: float) -> void #foreign physx "PxRigidBody_setContactSlopCoefficient_mut"; + +PxRigidBody_getContactSlopCoefficient :: (self: *PxRigidBody) -> float #foreign physx; + +PxRigidBody_getInternalIslandNodeIndex :: (self: *PxRigidBody) -> PxNodeIndex #foreign physx; + +PxArticulationLink_release :: (self: *PxArticulationLink) -> void #foreign physx "PxArticulationLink_release_mut"; + +PxArticulationLink_getArticulation :: (self: *PxArticulationLink) -> *PxArticulationReducedCoordinate #foreign physx; + +PxArticulationLink_getInboundJoint :: (self: *PxArticulationLink) -> *PxArticulationJointReducedCoordinate #foreign physx; + +PxArticulationLink_getInboundJointDof :: (self: *PxArticulationLink) -> u32 #foreign physx; + +PxArticulationLink_getNbChildren :: (self: *PxArticulationLink) -> u32 #foreign physx; + +PxArticulationLink_getLinkIndex :: (self: *PxArticulationLink) -> u32 #foreign physx; + +PxArticulationLink_getChildren :: (self: *PxArticulationLink, userBuffer: **PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxArticulationLink_setCfmScale :: (self: *PxArticulationLink, cfm: float) -> void #foreign physx "PxArticulationLink_setCfmScale_mut"; + +PxArticulationLink_getCfmScale :: (self: *PxArticulationLink) -> float #foreign physx; + +PxArticulationLink_getLinearVelocity :: (self: *PxArticulationLink) -> Vector3 #foreign physx; + +PxArticulationLink_getAngularVelocity :: (self: *PxArticulationLink) -> Vector3 #foreign physx; + +PxArticulationLink_getConcreteTypeName :: (self: *PxArticulationLink) -> *u8 #foreign physx; + +PxConeLimitedConstraint_new :: () -> PxConeLimitedConstraint #foreign physx; + +PxConstraint_release :: (self: *PxConstraint) -> void #foreign physx "PxConstraint_release_mut"; + +PxConstraint_getScene :: (self: *PxConstraint) -> *PxScene #foreign physx; + +PxConstraint_getActors :: (self: *PxConstraint, actor0: **PxRigidActor, actor1: **PxRigidActor) -> void #foreign physx; + +PxConstraint_setActors :: (self: *PxConstraint, actor0: *PxRigidActor, actor1: *PxRigidActor) -> void #foreign physx "PxConstraint_setActors_mut"; + +PxConstraint_markDirty :: (self: *PxConstraint) -> void #foreign physx "PxConstraint_markDirty_mut"; + +PxConstraint_getFlags :: (self: *PxConstraint) -> u16 #foreign physx; + +PxConstraint_setFlags :: (self: *PxConstraint, flags: u16) -> void #foreign physx "PxConstraint_setFlags_mut"; + +PxConstraint_setFlag :: (self: *PxConstraint, flag: s32, value: bool) -> void #foreign physx "PxConstraint_setFlag_mut"; + +PxConstraint_getForce :: (self: *PxConstraint, linear: *Vector3, angular: *Vector3) -> void #foreign physx; + +PxConstraint_isValid :: (self: *PxConstraint) -> bool #foreign physx; + +PxConstraint_setBreakForce :: (self: *PxConstraint, linear: float, angular: float) -> void #foreign physx "PxConstraint_setBreakForce_mut"; + +PxConstraint_getBreakForce :: (self: *PxConstraint, linear: *float, angular: *float) -> void #foreign physx; + +PxConstraint_setMinResponseThreshold :: (self: *PxConstraint, threshold: float) -> void #foreign physx "PxConstraint_setMinResponseThreshold_mut"; + +PxConstraint_getMinResponseThreshold :: (self: *PxConstraint) -> float #foreign physx; + +PxConstraint_getExternalReference :: (self: *PxConstraint, typeID: *u32) -> *void #foreign physx "PxConstraint_getExternalReference_mut"; + +PxConstraint_setConstraintFunctions :: (self: *PxConstraint, connector: *PxConstraintConnector, shaders: *PxConstraintShaderTable) -> void #foreign physx "PxConstraint_setConstraintFunctions_mut"; + +PxConstraint_getConcreteTypeName :: (self: *PxConstraint) -> *u8 #foreign physx; + +PxContactStreamIterator_new :: (contactPatches: *u8, contactPoints: *u8, contactFaceIndices: *u32, nbPatches: u32, nbContacts: u32) -> PxContactStreamIterator #foreign physx; + +PxContactStreamIterator_hasNextPatch :: (self: *PxContactStreamIterator) -> bool #foreign physx; + +PxContactStreamIterator_getTotalContactCount :: (self: *PxContactStreamIterator) -> u32 #foreign physx; + +PxContactStreamIterator_getTotalPatchCount :: (self: *PxContactStreamIterator) -> u32 #foreign physx; + +PxContactStreamIterator_nextPatch :: (self: *PxContactStreamIterator) -> void #foreign physx "PxContactStreamIterator_nextPatch_mut"; + +PxContactStreamIterator_hasNextContact :: (self: *PxContactStreamIterator) -> bool #foreign physx; + +PxContactStreamIterator_nextContact :: (self: *PxContactStreamIterator) -> void #foreign physx "PxContactStreamIterator_nextContact_mut"; + +PxContactStreamIterator_getContactNormal :: (self: *PxContactStreamIterator) -> *Vector3 #foreign physx; + +PxContactStreamIterator_getInvMassScale0 :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getInvMassScale1 :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getInvInertiaScale0 :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getInvInertiaScale1 :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getMaxImpulse :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getTargetVel :: (self: *PxContactStreamIterator) -> *Vector3 #foreign physx; + +PxContactStreamIterator_getContactPoint :: (self: *PxContactStreamIterator) -> *Vector3 #foreign physx; + +PxContactStreamIterator_getSeparation :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getFaceIndex0 :: (self: *PxContactStreamIterator) -> u32 #foreign physx; + +PxContactStreamIterator_getFaceIndex1 :: (self: *PxContactStreamIterator) -> u32 #foreign physx; + +PxContactStreamIterator_getStaticFriction :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getDynamicFriction :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getRestitution :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getDamping :: (self: *PxContactStreamIterator) -> float #foreign physx; + +PxContactStreamIterator_getMaterialFlags :: (self: *PxContactStreamIterator) -> u32 #foreign physx; + +PxContactStreamIterator_getMaterialIndex0 :: (self: *PxContactStreamIterator) -> u16 #foreign physx; + +PxContactStreamIterator_getMaterialIndex1 :: (self: *PxContactStreamIterator) -> u16 #foreign physx; + +PxContactStreamIterator_advanceToIndex :: (self: *PxContactStreamIterator, initialIndex: u32) -> bool #foreign physx "PxContactStreamIterator_advanceToIndex_mut"; + +PxContactSet_getPoint :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign physx; + +PxContactSet_setPoint :: (self: *PxContactSet, i: u32, p: *Vector3) -> void #foreign physx "PxContactSet_setPoint_mut"; + +PxContactSet_getNormal :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign physx; + +PxContactSet_setNormal :: (self: *PxContactSet, i: u32, n: *Vector3) -> void #foreign physx "PxContactSet_setNormal_mut"; + +PxContactSet_getSeparation :: (self: *PxContactSet, i: u32) -> float #foreign physx; + +PxContactSet_setSeparation :: (self: *PxContactSet, i: u32, s: float) -> void #foreign physx "PxContactSet_setSeparation_mut"; + +PxContactSet_getTargetVelocity :: (self: *PxContactSet, i: u32) -> *Vector3 #foreign physx; + +PxContactSet_setTargetVelocity :: (self: *PxContactSet, i: u32, v: *Vector3) -> void #foreign physx "PxContactSet_setTargetVelocity_mut"; + +PxContactSet_getInternalFaceIndex0 :: (self: *PxContactSet, i: u32) -> u32 #foreign physx; + +PxContactSet_getInternalFaceIndex1 :: (self: *PxContactSet, i: u32) -> u32 #foreign physx; + +PxContactSet_getMaxImpulse :: (self: *PxContactSet, i: u32) -> float #foreign physx; + +PxContactSet_setMaxImpulse :: (self: *PxContactSet, i: u32, s: float) -> void #foreign physx "PxContactSet_setMaxImpulse_mut"; + +PxContactSet_getRestitution :: (self: *PxContactSet, i: u32) -> float #foreign physx; + +PxContactSet_setRestitution :: (self: *PxContactSet, i: u32, r: float) -> void #foreign physx "PxContactSet_setRestitution_mut"; + +PxContactSet_getStaticFriction :: (self: *PxContactSet, i: u32) -> float #foreign physx; + +PxContactSet_setStaticFriction :: (self: *PxContactSet, i: u32, f: float) -> void #foreign physx "PxContactSet_setStaticFriction_mut"; + +PxContactSet_getDynamicFriction :: (self: *PxContactSet, i: u32) -> float #foreign physx; + +PxContactSet_setDynamicFriction :: (self: *PxContactSet, i: u32, f: float) -> void #foreign physx "PxContactSet_setDynamicFriction_mut"; + +PxContactSet_ignore :: (self: *PxContactSet, i: u32) -> void #foreign physx "PxContactSet_ignore_mut"; + +PxContactSet_size :: (self: *PxContactSet) -> u32 #foreign physx; + +PxContactSet_getInvMassScale0 :: (self: *PxContactSet) -> float #foreign physx; + +PxContactSet_getInvMassScale1 :: (self: *PxContactSet) -> float #foreign physx; + +PxContactSet_getInvInertiaScale0 :: (self: *PxContactSet) -> float #foreign physx; + +PxContactSet_getInvInertiaScale1 :: (self: *PxContactSet) -> float #foreign physx; + +PxContactSet_setInvMassScale0 :: (self: *PxContactSet, scale: float) -> void #foreign physx "PxContactSet_setInvMassScale0_mut"; + +PxContactSet_setInvMassScale1 :: (self: *PxContactSet, scale: float) -> void #foreign physx "PxContactSet_setInvMassScale1_mut"; + +PxContactSet_setInvInertiaScale0 :: (self: *PxContactSet, scale: float) -> void #foreign physx "PxContactSet_setInvInertiaScale0_mut"; + +PxContactSet_setInvInertiaScale1 :: (self: *PxContactSet, scale: float) -> void #foreign physx "PxContactSet_setInvInertiaScale1_mut"; + +PxContactModifyCallback_onContactModify :: (self: *PxContactModifyCallback, pairs: *PxContactModifyPair, count: u32) -> void #foreign physx "PxContactModifyCallback_onContactModify_mut"; + +PxCCDContactModifyCallback_onCCDContactModify :: (self: *PxCCDContactModifyCallback, pairs: *PxContactModifyPair, count: u32) -> void #foreign physx "PxCCDContactModifyCallback_onCCDContactModify_mut"; + +PxDeletionListener_onRelease :: (self: *PxDeletionListener, observed: *PxBase, userData: *void, deletionEvent: s32) -> void #foreign physx "PxDeletionListener_onRelease_mut"; + +PxBaseMaterial_isKindOf :: (self: *PxBaseMaterial, name: *u8) -> bool #foreign physx; + +PxFEMMaterial_setYoungsModulus :: (self: *PxFEMMaterial, young: float) -> void #foreign physx "PxFEMMaterial_setYoungsModulus_mut"; + +PxFEMMaterial_getYoungsModulus :: (self: *PxFEMMaterial) -> float #foreign physx; + +PxFEMMaterial_setPoissons :: (self: *PxFEMMaterial, poisson: float) -> void #foreign physx "PxFEMMaterial_setPoissons_mut"; + +PxFEMMaterial_getPoissons :: (self: *PxFEMMaterial) -> float #foreign physx; + +PxFEMMaterial_setDynamicFriction :: (self: *PxFEMMaterial, dynamicFriction: float) -> void #foreign physx "PxFEMMaterial_setDynamicFriction_mut"; + +PxFEMMaterial_getDynamicFriction :: (self: *PxFEMMaterial) -> float #foreign physx; + +PxFilterData_new :: (anon_param0: s32) -> PxFilterData #foreign physx; + +PxFilterData_new :: () -> PxFilterData #foreign physx "PxFilterData_new_1"; + +PxFilterData_new :: (w0: u32, w1: u32, w2: u32, w3: u32) -> PxFilterData #foreign physx "PxFilterData_new_2"; + +PxFilterData_setToDefault :: (self: *PxFilterData) -> void #foreign physx "PxFilterData_setToDefault_mut"; + +PxGetFilterObjectType :: (attr: u32) -> s32 #foreign physx "phys_PxGetFilterObjectType"; + +PxFilterObjectIsKinematic :: (attr: u32) -> bool #foreign physx "phys_PxFilterObjectIsKinematic"; + +PxFilterObjectIsTrigger :: (attr: u32) -> bool #foreign physx "phys_PxFilterObjectIsTrigger"; + +PxSimulationFilterCallback_pairFound :: (self: *PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, a0: *PxActor, s0: *PxShape, attributes1: u32, filterData1: PxFilterData, a1: *PxActor, s1: *PxShape, pairFlags: *u16) -> u16 #foreign physx "PxSimulationFilterCallback_pairFound_mut"; + +PxSimulationFilterCallback_pairLost :: (self: *PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, objectRemoved: bool) -> void #foreign physx "PxSimulationFilterCallback_pairLost_mut"; + +PxSimulationFilterCallback_statusChange :: (self: *PxSimulationFilterCallback, pairID: *u32, pairFlags: *u16, filterFlags: *u16) -> bool #foreign physx "PxSimulationFilterCallback_statusChange_mut"; + +PxLockedData_getDataAccessFlags :: (self: *PxLockedData) -> u8 #foreign physx "PxLockedData_getDataAccessFlags_mut"; + +PxLockedData_unlock :: (self: *PxLockedData) -> void #foreign physx "PxLockedData_unlock_mut"; + +PxLockedData_delete :: (self: *PxLockedData) -> void #foreign physx; + +PxMaterial_setDynamicFriction :: (self: *PxMaterial, coef: float) -> void #foreign physx "PxMaterial_setDynamicFriction_mut"; + +PxMaterial_getDynamicFriction :: (self: *PxMaterial) -> float #foreign physx; + +PxMaterial_setStaticFriction :: (self: *PxMaterial, coef: float) -> void #foreign physx "PxMaterial_setStaticFriction_mut"; + +PxMaterial_getStaticFriction :: (self: *PxMaterial) -> float #foreign physx; + +PxMaterial_setRestitution :: (self: *PxMaterial, rest: float) -> void #foreign physx "PxMaterial_setRestitution_mut"; + +PxMaterial_getRestitution :: (self: *PxMaterial) -> float #foreign physx; + +PxMaterial_setDamping :: (self: *PxMaterial, damping: float) -> void #foreign physx "PxMaterial_setDamping_mut"; + +PxMaterial_getDamping :: (self: *PxMaterial) -> float #foreign physx; + +PxMaterial_setFlag :: (self: *PxMaterial, flag: s32, b: bool) -> void #foreign physx "PxMaterial_setFlag_mut"; + +PxMaterial_setFlags :: (self: *PxMaterial, flags: u16) -> void #foreign physx "PxMaterial_setFlags_mut"; + +PxMaterial_getFlags :: (self: *PxMaterial) -> u16 #foreign physx; + +PxMaterial_setFrictionCombineMode :: (self: *PxMaterial, combMode: s32) -> void #foreign physx "PxMaterial_setFrictionCombineMode_mut"; + +PxMaterial_getFrictionCombineMode :: (self: *PxMaterial) -> s32 #foreign physx; + +PxMaterial_setRestitutionCombineMode :: (self: *PxMaterial, combMode: s32) -> void #foreign physx "PxMaterial_setRestitutionCombineMode_mut"; + +PxMaterial_getRestitutionCombineMode :: (self: *PxMaterial) -> s32 #foreign physx; + +PxMaterial_getConcreteTypeName :: (self: *PxMaterial) -> *u8 #foreign physx; + +PxDiffuseParticleParams_new :: () -> PxDiffuseParticleParams #foreign physx; + +PxDiffuseParticleParams_setToDefault :: (self: *PxDiffuseParticleParams) -> void #foreign physx "PxDiffuseParticleParams_setToDefault_mut"; + +PxParticleMaterial_setFriction :: (self: *PxParticleMaterial, friction: float) -> void #foreign physx "PxParticleMaterial_setFriction_mut"; + +PxParticleMaterial_getFriction :: (self: *PxParticleMaterial) -> float #foreign physx; + +PxParticleMaterial_setDamping :: (self: *PxParticleMaterial, damping: float) -> void #foreign physx "PxParticleMaterial_setDamping_mut"; + +PxParticleMaterial_getDamping :: (self: *PxParticleMaterial) -> float #foreign physx; + +PxParticleMaterial_setAdhesion :: (self: *PxParticleMaterial, adhesion: float) -> void #foreign physx "PxParticleMaterial_setAdhesion_mut"; + +PxParticleMaterial_getAdhesion :: (self: *PxParticleMaterial) -> float #foreign physx; + +PxParticleMaterial_setGravityScale :: (self: *PxParticleMaterial, scale: float) -> void #foreign physx "PxParticleMaterial_setGravityScale_mut"; + +PxParticleMaterial_getGravityScale :: (self: *PxParticleMaterial) -> float #foreign physx; + +PxParticleMaterial_setAdhesionRadiusScale :: (self: *PxParticleMaterial, scale: float) -> void #foreign physx "PxParticleMaterial_setAdhesionRadiusScale_mut"; + +PxParticleMaterial_getAdhesionRadiusScale :: (self: *PxParticleMaterial) -> float #foreign physx; + +PxPhysics_release :: (self: *PxPhysics) -> void #foreign physx "PxPhysics_release_mut"; + +PxPhysics_getFoundation :: (self: *PxPhysics) -> *PxFoundation #foreign physx "PxPhysics_getFoundation_mut"; + +PxPhysics_createAggregate :: (self: *PxPhysics, maxActor: u32, maxShape: u32, filterHint: u32) -> *PxAggregate #foreign physx "PxPhysics_createAggregate_mut"; + +PxPhysics_getTolerancesScale :: (self: *PxPhysics) -> *PxTolerancesScale #foreign physx; + +PxPhysics_createTriangleMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxTriangleMesh #foreign physx "PxPhysics_createTriangleMesh_mut"; + +PxPhysics_getNbTriangleMeshes :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getTriangleMeshes :: (self: *PxPhysics, userBuffer: **PxTriangleMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createTetrahedronMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxTetrahedronMesh #foreign physx "PxPhysics_createTetrahedronMesh_mut"; + +PxPhysics_createSoftBodyMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxSoftBodyMesh #foreign physx "PxPhysics_createSoftBodyMesh_mut"; + +PxPhysics_getNbTetrahedronMeshes :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getTetrahedronMeshes :: (self: *PxPhysics, userBuffer: **PxTetrahedronMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createHeightField :: (self: *PxPhysics, stream: *PxInputStream) -> *PxHeightField #foreign physx "PxPhysics_createHeightField_mut"; + +PxPhysics_getNbHeightFields :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getHeightFields :: (self: *PxPhysics, userBuffer: **PxHeightField, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createConvexMesh :: (self: *PxPhysics, stream: *PxInputStream) -> *PxConvexMesh #foreign physx "PxPhysics_createConvexMesh_mut"; + +PxPhysics_getNbConvexMeshes :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getConvexMeshes :: (self: *PxPhysics, userBuffer: **PxConvexMesh, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createBVH :: (self: *PxPhysics, stream: *PxInputStream) -> *PxBVH #foreign physx "PxPhysics_createBVH_mut"; + +PxPhysics_getNbBVHs :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getBVHs :: (self: *PxPhysics, userBuffer: **PxBVH, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createScene :: (self: *PxPhysics, sceneDesc: *PxSceneDesc) -> *PxScene #foreign physx "PxPhysics_createScene_mut"; + +PxPhysics_getNbScenes :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getScenes :: (self: *PxPhysics, userBuffer: **PxScene, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createRigidStatic :: (self: *PxPhysics, pose: *PxTransform) -> *PxRigidStatic #foreign physx "PxPhysics_createRigidStatic_mut"; + +PxPhysics_createRigidDynamic :: (self: *PxPhysics, pose: *PxTransform) -> *PxRigidDynamic #foreign physx "PxPhysics_createRigidDynamic_mut"; + +PxPhysics_createPruningStructure :: (self: *PxPhysics, actors: **PxRigidActor, nbActors: u32) -> *PxPruningStructure #foreign physx "PxPhysics_createPruningStructure_mut"; + +PxPhysics_createShape :: (self: *PxPhysics, geometry: *PxGeometry, material: *PxMaterial, isExclusive: bool, shapeFlags: u8) -> *PxShape #foreign physx "PxPhysics_createShape_mut"; + +PxPhysics_createShape_mut :: (self: *PxPhysics, geometry: *PxGeometry, materials: **PxMaterial, materialCount: u16, isExclusive: bool, shapeFlags: u8) -> *PxShape #foreign physx "PxPhysics_createShape_mut_1"; + +PxPhysics_getNbShapes :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getShapes :: (self: *PxPhysics, userBuffer: **PxShape, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_createConstraint :: (self: *PxPhysics, actor0: *PxRigidActor, actor1: *PxRigidActor, connector: *PxConstraintConnector, shaders: *PxConstraintShaderTable, dataSize: u32) -> *PxConstraint #foreign physx "PxPhysics_createConstraint_mut"; + +PxPhysics_createArticulationReducedCoordinate :: (self: *PxPhysics) -> *PxArticulationReducedCoordinate #foreign physx "PxPhysics_createArticulationReducedCoordinate_mut"; + +PxPhysics_createMaterial :: (self: *PxPhysics, staticFriction: float, dynamicFriction: float, restitution: float) -> *PxMaterial #foreign physx "PxPhysics_createMaterial_mut"; + +PxPhysics_getNbMaterials :: (self: *PxPhysics) -> u32 #foreign physx; + +PxPhysics_getMaterials :: (self: *PxPhysics, userBuffer: **PxMaterial, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPhysics_registerDeletionListener :: (self: *PxPhysics, observer: *PxDeletionListener, deletionEvents: *u8, restrictedObjectSet: bool) -> void #foreign physx "PxPhysics_registerDeletionListener_mut"; + +PxPhysics_unregisterDeletionListener :: (self: *PxPhysics, observer: *PxDeletionListener) -> void #foreign physx "PxPhysics_unregisterDeletionListener_mut"; + +PxPhysics_registerDeletionListenerObjects :: (self: *PxPhysics, observer: *PxDeletionListener, observables: **PxBase, observableCount: u32) -> void #foreign physx "PxPhysics_registerDeletionListenerObjects_mut"; + +PxPhysics_unregisterDeletionListenerObjects :: (self: *PxPhysics, observer: *PxDeletionListener, observables: **PxBase, observableCount: u32) -> void #foreign physx "PxPhysics_unregisterDeletionListenerObjects_mut"; + +PxPhysics_getPhysicsInsertionCallback :: (self: *PxPhysics) -> *PxInsertionCallback #foreign physx "PxPhysics_getPhysicsInsertionCallback_mut"; + +PxCreatePhysics :: (version: u32, foundation: *PxFoundation, scale: *PxTolerancesScale, trackOutstandingAllocations: bool, pvd: *PxPvd, omniPvd: *PxOmniPvd) -> *PxPhysics #foreign physx "phys_PxCreatePhysics"; + +PxGetPhysics :: () -> *PxPhysics #foreign physx "phys_PxGetPhysics"; + +PxActorShape_new :: () -> PxActorShape #foreign physx; + +PxActorShape_new :: (a: *PxRigidActor, s: *PxShape) -> PxActorShape #foreign physx "PxActorShape_new_1"; + +PxQueryCache_new :: () -> PxQueryCache #foreign physx; + +PxQueryCache_new :: (s: *PxShape, findex: u32) -> PxQueryCache #foreign physx "PxQueryCache_new_1"; + +PxQueryFilterData_new :: () -> PxQueryFilterData #foreign physx; + +PxQueryFilterData_new :: (fd: *PxFilterData, f: u16) -> PxQueryFilterData #foreign physx "PxQueryFilterData_new_1"; + +PxQueryFilterData_new :: (f: u16) -> PxQueryFilterData #foreign physx "PxQueryFilterData_new_2"; + +PxQueryFilterCallback_preFilter :: (self: *PxQueryFilterCallback, filterData: *PxFilterData, shape: *PxShape, actor: *PxRigidActor, queryFlags: *u16) -> s32 #foreign physx "PxQueryFilterCallback_preFilter_mut"; + +PxQueryFilterCallback_postFilter :: (self: *PxQueryFilterCallback, filterData: *PxFilterData, hit: *PxQueryHit, shape: *PxShape, actor: *PxRigidActor) -> s32 #foreign physx "PxQueryFilterCallback_postFilter_mut"; + +PxQueryFilterCallback_delete :: (self: *PxQueryFilterCallback) -> void #foreign physx; + +PxRigidDynamic_setKinematicTarget :: (self: *PxRigidDynamic, destination: *PxTransform) -> void #foreign physx "PxRigidDynamic_setKinematicTarget_mut"; + +PxRigidDynamic_getKinematicTarget :: (self: *PxRigidDynamic, target: *PxTransform) -> bool #foreign physx; + +PxRigidDynamic_isSleeping :: (self: *PxRigidDynamic) -> bool #foreign physx; + +PxRigidDynamic_setSleepThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign physx "PxRigidDynamic_setSleepThreshold_mut"; + +PxRigidDynamic_getSleepThreshold :: (self: *PxRigidDynamic) -> float #foreign physx; + +PxRigidDynamic_setStabilizationThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign physx "PxRigidDynamic_setStabilizationThreshold_mut"; + +PxRigidDynamic_getStabilizationThreshold :: (self: *PxRigidDynamic) -> float #foreign physx; + +PxRigidDynamic_getRigidDynamicLockFlags :: (self: *PxRigidDynamic) -> u8 #foreign physx; + +PxRigidDynamic_setRigidDynamicLockFlag :: (self: *PxRigidDynamic, flag: s32, value: bool) -> void #foreign physx "PxRigidDynamic_setRigidDynamicLockFlag_mut"; + +PxRigidDynamic_setRigidDynamicLockFlags :: (self: *PxRigidDynamic, flags: u8) -> void #foreign physx "PxRigidDynamic_setRigidDynamicLockFlags_mut"; + +PxRigidDynamic_getLinearVelocity :: (self: *PxRigidDynamic) -> Vector3 #foreign physx; + +PxRigidDynamic_setLinearVelocity :: (self: *PxRigidDynamic, linVel: *Vector3, autowake: bool) -> void #foreign physx "PxRigidDynamic_setLinearVelocity_mut"; + +PxRigidDynamic_getAngularVelocity :: (self: *PxRigidDynamic) -> Vector3 #foreign physx; + +PxRigidDynamic_setAngularVelocity :: (self: *PxRigidDynamic, angVel: *Vector3, autowake: bool) -> void #foreign physx "PxRigidDynamic_setAngularVelocity_mut"; + +PxRigidDynamic_setWakeCounter :: (self: *PxRigidDynamic, wakeCounterValue: float) -> void #foreign physx "PxRigidDynamic_setWakeCounter_mut"; + +PxRigidDynamic_getWakeCounter :: (self: *PxRigidDynamic) -> float #foreign physx; + +PxRigidDynamic_wakeUp :: (self: *PxRigidDynamic) -> void #foreign physx "PxRigidDynamic_wakeUp_mut"; + +PxRigidDynamic_putToSleep :: (self: *PxRigidDynamic) -> void #foreign physx "PxRigidDynamic_putToSleep_mut"; + +PxRigidDynamic_setSolverIterationCounts :: (self: *PxRigidDynamic, minPositionIters: u32, minVelocityIters: u32) -> void #foreign physx "PxRigidDynamic_setSolverIterationCounts_mut"; + +PxRigidDynamic_getSolverIterationCounts :: (self: *PxRigidDynamic, minPositionIters: *u32, minVelocityIters: *u32) -> void #foreign physx; + +PxRigidDynamic_getContactReportThreshold :: (self: *PxRigidDynamic) -> float #foreign physx; + +PxRigidDynamic_setContactReportThreshold :: (self: *PxRigidDynamic, threshold: float) -> void #foreign physx "PxRigidDynamic_setContactReportThreshold_mut"; + +PxRigidDynamic_getConcreteTypeName :: (self: *PxRigidDynamic) -> *u8 #foreign physx; + +PxRigidStatic_getConcreteTypeName :: (self: *PxRigidStatic) -> *u8 #foreign physx; + +PxSceneQueryDesc_new :: () -> PxSceneQueryDesc #foreign physx; + +PxSceneQueryDesc_setToDefault :: (self: *PxSceneQueryDesc) -> void #foreign physx "PxSceneQueryDesc_setToDefault_mut"; + +PxSceneQueryDesc_isValid :: (self: *PxSceneQueryDesc) -> bool #foreign physx; + +PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint :: (self: *PxSceneQuerySystemBase, dynamicTreeRebuildRateHint: u32) -> void #foreign physx "PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint_mut"; + +PxSceneQuerySystemBase_getDynamicTreeRebuildRateHint :: (self: *PxSceneQuerySystemBase) -> u32 #foreign physx; + +PxSceneQuerySystemBase_forceRebuildDynamicTree :: (self: *PxSceneQuerySystemBase, prunerIndex: u32) -> void #foreign physx "PxSceneQuerySystemBase_forceRebuildDynamicTree_mut"; + +PxSceneQuerySystemBase_setUpdateMode :: (self: *PxSceneQuerySystemBase, updateMode: s32) -> void #foreign physx "PxSceneQuerySystemBase_setUpdateMode_mut"; + +PxSceneQuerySystemBase_getUpdateMode :: (self: *PxSceneQuerySystemBase) -> s32 #foreign physx; + +PxSceneQuerySystemBase_getStaticTimestamp :: (self: *PxSceneQuerySystemBase) -> u32 #foreign physx; + +PxSceneQuerySystemBase_flushUpdates :: (self: *PxSceneQuerySystemBase) -> void #foreign physx "PxSceneQuerySystemBase_flushUpdates_mut"; + +PxSceneQuerySystemBase_raycast :: (self: *PxSceneQuerySystemBase, origin: *Vector3, unitDir: *Vector3, distance: float, hitCall: *PxRaycastCallback, hitFlags: u16, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, queryFlags: u32) -> bool #foreign physx; + +PxSceneQuerySystemBase_sweep :: (self: *PxSceneQuerySystemBase, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, hitCall: *PxSweepCallback, hitFlags: u16, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float, queryFlags: u32) -> bool #foreign physx; + +PxSceneQuerySystemBase_overlap :: (self: *PxSceneQuerySystemBase, geometry: *PxGeometry, pose: *PxTransform, hitCall: *PxOverlapCallback, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, queryFlags: u32) -> bool #foreign physx; + +PxSceneSQSystem_setSceneQueryUpdateMode :: (self: *PxSceneSQSystem, updateMode: s32) -> void #foreign physx "PxSceneSQSystem_setSceneQueryUpdateMode_mut"; + +PxSceneSQSystem_getSceneQueryUpdateMode :: (self: *PxSceneSQSystem) -> s32 #foreign physx; + +PxSceneSQSystem_getSceneQueryStaticTimestamp :: (self: *PxSceneSQSystem) -> u32 #foreign physx; + +PxSceneSQSystem_flushQueryUpdates :: (self: *PxSceneSQSystem) -> void #foreign physx "PxSceneSQSystem_flushQueryUpdates_mut"; + +PxSceneSQSystem_forceDynamicTreeRebuild :: (self: *PxSceneSQSystem, rebuildStaticStructure: bool, rebuildDynamicStructure: bool) -> void #foreign physx "PxSceneSQSystem_forceDynamicTreeRebuild_mut"; + +PxSceneSQSystem_getStaticStructure :: (self: *PxSceneSQSystem) -> s32 #foreign physx; + +PxSceneSQSystem_getDynamicStructure :: (self: *PxSceneSQSystem) -> s32 #foreign physx; + +PxSceneSQSystem_sceneQueriesUpdate :: (self: *PxSceneSQSystem, completionTask: *PxBaseTask, controlSimulation: bool) -> void #foreign physx "PxSceneSQSystem_sceneQueriesUpdate_mut"; + +PxSceneSQSystem_checkQueries :: (self: *PxSceneSQSystem, block: bool) -> bool #foreign physx "PxSceneSQSystem_checkQueries_mut"; + +PxSceneSQSystem_fetchQueries :: (self: *PxSceneSQSystem, block: bool) -> bool #foreign physx "PxSceneSQSystem_fetchQueries_mut"; + +PxSceneQuerySystem_release :: (self: *PxSceneQuerySystem) -> void #foreign physx "PxSceneQuerySystem_release_mut"; + +PxSceneQuerySystem_acquireReference :: (self: *PxSceneQuerySystem) -> void #foreign physx "PxSceneQuerySystem_acquireReference_mut"; + +PxSceneQuerySystem_preallocate :: (self: *PxSceneQuerySystem, prunerIndex: u32, nbShapes: u32) -> void #foreign physx "PxSceneQuerySystem_preallocate_mut"; + +PxSceneQuerySystem_flushMemory :: (self: *PxSceneQuerySystem) -> void #foreign physx "PxSceneQuerySystem_flushMemory_mut"; + +PxSceneQuerySystem_addSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, bounds: *PxBounds3, transform: *PxTransform, compoundHandle: *u32, hasPruningStructure: bool) -> void #foreign physx "PxSceneQuerySystem_addSQShape_mut"; + +PxSceneQuerySystem_removeSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape) -> void #foreign physx "PxSceneQuerySystem_removeSQShape_mut"; + +PxSceneQuerySystem_updateSQShape :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, transform: *PxTransform) -> void #foreign physx "PxSceneQuerySystem_updateSQShape_mut"; + +PxSceneQuerySystem_addSQCompound :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shapes: **PxShape, bvh: *PxBVH, transforms: *PxTransform) -> u32 #foreign physx "PxSceneQuerySystem_addSQCompound_mut"; + +PxSceneQuerySystem_removeSQCompound :: (self: *PxSceneQuerySystem, compoundHandle: u32) -> void #foreign physx "PxSceneQuerySystem_removeSQCompound_mut"; + +PxSceneQuerySystem_updateSQCompound :: (self: *PxSceneQuerySystem, compoundHandle: u32, compoundTransform: *PxTransform) -> void #foreign physx "PxSceneQuerySystem_updateSQCompound_mut"; + +PxSceneQuerySystem_shiftOrigin :: (self: *PxSceneQuerySystem, shift: *Vector3) -> void #foreign physx "PxSceneQuerySystem_shiftOrigin_mut"; + +PxSceneQuerySystem_merge :: (self: *PxSceneQuerySystem, pruningStructure: *PxPruningStructure) -> void #foreign physx "PxSceneQuerySystem_merge_mut"; + +PxSceneQuerySystem_getHandle :: (self: *PxSceneQuerySystem, actor: *PxRigidActor, shape: *PxShape, prunerIndex: *u32) -> u32 #foreign physx; + +PxSceneQuerySystem_sync :: (self: *PxSceneQuerySystem, prunerIndex: u32, handles: *u32, indices: *u32, bounds: *PxBounds3, transforms: *PxTransformPadded, count: u32, ignoredIndices: *PxBitMap) -> void #foreign physx "PxSceneQuerySystem_sync_mut"; + +PxSceneQuerySystem_finalizeUpdates :: (self: *PxSceneQuerySystem) -> void #foreign physx "PxSceneQuerySystem_finalizeUpdates_mut"; + +PxSceneQuerySystem_prepareSceneQueryBuildStep :: (self: *PxSceneQuerySystem, prunerIndex: u32) -> *void #foreign physx "PxSceneQuerySystem_prepareSceneQueryBuildStep_mut"; + +PxSceneQuerySystem_sceneQueryBuildStep :: (self: *PxSceneQuerySystem, handle: *void) -> void #foreign physx "PxSceneQuerySystem_sceneQueryBuildStep_mut"; + +PxBroadPhaseDesc_new :: (type: s32) -> PxBroadPhaseDesc #foreign physx; + +PxBroadPhaseDesc_isValid :: (self: *PxBroadPhaseDesc) -> bool #foreign physx; + +PxGetBroadPhaseStaticFilterGroup :: () -> u32 #foreign physx "phys_PxGetBroadPhaseStaticFilterGroup"; + +PxGetBroadPhaseDynamicFilterGroup :: (id: u32) -> u32 #foreign physx "phys_PxGetBroadPhaseDynamicFilterGroup"; + +PxGetBroadPhaseKinematicFilterGroup :: (id: u32) -> u32 #foreign physx "phys_PxGetBroadPhaseKinematicFilterGroup"; + +PxBroadPhaseUpdateData_new :: (created: *u32, nbCreated: u32, updated: *u32, nbUpdated: u32, removed: *u32, nbRemoved: u32, bounds: *PxBounds3, groups: *u32, distances: *float, capacity: u32) -> PxBroadPhaseUpdateData #foreign physx; + +PxBroadPhaseResults_new :: () -> PxBroadPhaseResults #foreign physx; + +PxBroadPhaseRegions_getNbRegions :: (self: *PxBroadPhaseRegions) -> u32 #foreign physx; + +PxBroadPhaseRegions_getRegions :: (self: *PxBroadPhaseRegions, userBuffer: *PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxBroadPhaseRegions_addRegion :: (self: *PxBroadPhaseRegions, region: *PxBroadPhaseRegion, populateRegion: bool, bounds: *PxBounds3, distances: *float) -> u32 #foreign physx "PxBroadPhaseRegions_addRegion_mut"; + +PxBroadPhaseRegions_removeRegion :: (self: *PxBroadPhaseRegions, handle: u32) -> bool #foreign physx "PxBroadPhaseRegions_removeRegion_mut"; + +PxBroadPhaseRegions_getNbOutOfBoundsObjects :: (self: *PxBroadPhaseRegions) -> u32 #foreign physx; + +PxBroadPhaseRegions_getOutOfBoundsObjects :: (self: *PxBroadPhaseRegions) -> *u32 #foreign physx; + +PxBroadPhase_release :: (self: *PxBroadPhase) -> void #foreign physx "PxBroadPhase_release_mut"; + +PxBroadPhase_getType :: (self: *PxBroadPhase) -> s32 #foreign physx; + +PxBroadPhase_getCaps :: (self: *PxBroadPhase, caps: *PxBroadPhaseCaps) -> void #foreign physx; + +PxBroadPhase_getRegions :: (self: *PxBroadPhase) -> *PxBroadPhaseRegions #foreign physx "PxBroadPhase_getRegions_mut"; + +PxBroadPhase_getAllocator :: (self: *PxBroadPhase) -> *PxAllocatorCallback #foreign physx "PxBroadPhase_getAllocator_mut"; + +PxBroadPhase_getContextID :: (self: *PxBroadPhase) -> u64 #foreign physx; + +PxBroadPhase_setScratchBlock :: (self: *PxBroadPhase, scratchBlock: *void, size: u32) -> void #foreign physx "PxBroadPhase_setScratchBlock_mut"; + +PxBroadPhase_update :: (self: *PxBroadPhase, updateData: *PxBroadPhaseUpdateData, continuation: *PxBaseTask) -> void #foreign physx "PxBroadPhase_update_mut"; + +PxBroadPhase_fetchResults :: (self: *PxBroadPhase, results: *PxBroadPhaseResults) -> void #foreign physx "PxBroadPhase_fetchResults_mut"; + +PxBroadPhase_update_mut :: (self: *PxBroadPhase, results: *PxBroadPhaseResults, updateData: *PxBroadPhaseUpdateData) -> void #foreign physx "PxBroadPhase_update_mut_1"; + +PxCreateBroadPhase :: (desc: *PxBroadPhaseDesc) -> *PxBroadPhase #foreign physx "phys_PxCreateBroadPhase"; + +PxAABBManager_release :: (self: *PxAABBManager) -> void #foreign physx "PxAABBManager_release_mut"; + +PxAABBManager_getBroadPhase :: (self: *PxAABBManager) -> *PxBroadPhase #foreign physx "PxAABBManager_getBroadPhase_mut"; + +PxAABBManager_getBounds :: (self: *PxAABBManager) -> *PxBounds3 #foreign physx; + +PxAABBManager_getDistances :: (self: *PxAABBManager) -> *float #foreign physx; + +PxAABBManager_getGroups :: (self: *PxAABBManager) -> *u32 #foreign physx; + +PxAABBManager_getCapacity :: (self: *PxAABBManager) -> u32 #foreign physx; + +PxAABBManager_addObject :: (self: *PxAABBManager, index: u32, bounds: *PxBounds3, group: u32, distance: float) -> void #foreign physx "PxAABBManager_addObject_mut"; + +PxAABBManager_removeObject :: (self: *PxAABBManager, index: u32) -> void #foreign physx "PxAABBManager_removeObject_mut"; + +PxAABBManager_updateObject :: (self: *PxAABBManager, index: u32, bounds: *PxBounds3, distance: *float) -> void #foreign physx "PxAABBManager_updateObject_mut"; + +PxAABBManager_update :: (self: *PxAABBManager, continuation: *PxBaseTask) -> void #foreign physx "PxAABBManager_update_mut"; + +PxAABBManager_fetchResults :: (self: *PxAABBManager, results: *PxBroadPhaseResults) -> void #foreign physx "PxAABBManager_fetchResults_mut"; + +PxAABBManager_update_mut :: (self: *PxAABBManager, results: *PxBroadPhaseResults) -> void #foreign physx "PxAABBManager_update_mut_1"; + +PxCreateAABBManager :: (broadphase: *PxBroadPhase) -> *PxAABBManager #foreign physx "phys_PxCreateAABBManager"; + +PxSceneLimits_new :: () -> PxSceneLimits #foreign physx; + +PxSceneLimits_setToDefault :: (self: *PxSceneLimits) -> void #foreign physx "PxSceneLimits_setToDefault_mut"; + +PxSceneLimits_isValid :: (self: *PxSceneLimits) -> bool #foreign physx; + +PxgDynamicsMemoryConfig_new :: () -> PxgDynamicsMemoryConfig #foreign physx; + +PxgDynamicsMemoryConfig_isValid :: (self: *PxgDynamicsMemoryConfig) -> bool #foreign physx; + +PxSceneDesc_new :: (scale: *PxTolerancesScale) -> PxSceneDesc #foreign physx; + +PxSceneDesc_setToDefault :: (self: *PxSceneDesc, scale: *PxTolerancesScale) -> void #foreign physx "PxSceneDesc_setToDefault_mut"; + +PxSceneDesc_isValid :: (self: *PxSceneDesc) -> bool #foreign physx; + +PxSceneDesc_getTolerancesScale :: (self: *PxSceneDesc) -> *PxTolerancesScale #foreign physx; + +PxSimulationStatistics_getNbBroadPhaseAdds :: (self: *PxSimulationStatistics) -> u32 #foreign physx; + +PxSimulationStatistics_getNbBroadPhaseRemoves :: (self: *PxSimulationStatistics) -> u32 #foreign physx; + +PxSimulationStatistics_getRbPairStats :: (self: *PxSimulationStatistics, pairType: s32, g0: s32, g1: s32) -> u32 #foreign physx; + +PxSimulationStatistics_new :: () -> PxSimulationStatistics #foreign physx; + +PxPvdSceneClient_setScenePvdFlag :: (self: *PxPvdSceneClient, flag: s32, value: bool) -> void #foreign physx "PxPvdSceneClient_setScenePvdFlag_mut"; + +PxPvdSceneClient_setScenePvdFlags :: (self: *PxPvdSceneClient, flags: u8) -> void #foreign physx "PxPvdSceneClient_setScenePvdFlags_mut"; + +PxPvdSceneClient_getScenePvdFlags :: (self: *PxPvdSceneClient) -> u8 #foreign physx; + +PxPvdSceneClient_updateCamera :: (self: *PxPvdSceneClient, name: *u8, origin: *Vector3, up: *Vector3, target: *Vector3) -> void #foreign physx "PxPvdSceneClient_updateCamera_mut"; + +PxPvdSceneClient_drawPoints :: (self: *PxPvdSceneClient, points: *PxDebugPoint, count: u32) -> void #foreign physx "PxPvdSceneClient_drawPoints_mut"; + +PxPvdSceneClient_drawLines :: (self: *PxPvdSceneClient, lines: *PxDebugLine, count: u32) -> void #foreign physx "PxPvdSceneClient_drawLines_mut"; + +PxPvdSceneClient_drawTriangles :: (self: *PxPvdSceneClient, triangles: *PxDebugTriangle, count: u32) -> void #foreign physx "PxPvdSceneClient_drawTriangles_mut"; + +PxPvdSceneClient_drawText :: (self: *PxPvdSceneClient, text: *PxDebugText) -> void #foreign physx "PxPvdSceneClient_drawText_mut"; + +PxDominanceGroupPair_new :: (a: u8, b: u8) -> PxDominanceGroupPair #foreign physx; + +PxBroadPhaseCallback_delete :: (self: *PxBroadPhaseCallback) -> void #foreign physx; + +PxBroadPhaseCallback_onObjectOutOfBounds :: (self: *PxBroadPhaseCallback, shape: *PxShape, actor: *PxActor) -> void #foreign physx "PxBroadPhaseCallback_onObjectOutOfBounds_mut"; + +PxBroadPhaseCallback_onObjectOutOfBounds_mut :: (self: *PxBroadPhaseCallback, aggregate: *PxAggregate) -> void #foreign physx "PxBroadPhaseCallback_onObjectOutOfBounds_mut_1"; + +PxScene_release :: (self: *PxScene) -> void #foreign physx "PxScene_release_mut"; + +PxScene_setFlag :: (self: *PxScene, flag: s32, value: bool) -> void #foreign physx "PxScene_setFlag_mut"; + +PxScene_getFlags :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_setLimits :: (self: *PxScene, limits: *PxSceneLimits) -> void #foreign physx "PxScene_setLimits_mut"; + +PxScene_getLimits :: (self: *PxScene) -> PxSceneLimits #foreign physx; + +PxScene_getPhysics :: (self: *PxScene) -> *PxPhysics #foreign physx "PxScene_getPhysics_mut"; + +PxScene_getTimestamp :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_addArticulation :: (self: *PxScene, articulation: *PxArticulationReducedCoordinate) -> bool #foreign physx "PxScene_addArticulation_mut"; + +PxScene_removeArticulation :: (self: *PxScene, articulation: *PxArticulationReducedCoordinate, wakeOnLostTouch: bool) -> void #foreign physx "PxScene_removeArticulation_mut"; + +PxScene_addActor :: (self: *PxScene, actor: *PxActor, bvh: *PxBVH) -> bool #foreign physx "PxScene_addActor_mut"; + +PxScene_addActors :: (self: *PxScene, actors: **PxActor, nbActors: u32) -> bool #foreign physx "PxScene_addActors_mut"; + +PxScene_addActors_mut :: (self: *PxScene, pruningStructure: *PxPruningStructure) -> bool #foreign physx "PxScene_addActors_mut_1"; + +PxScene_removeActor :: (self: *PxScene, actor: *PxActor, wakeOnLostTouch: bool) -> void #foreign physx "PxScene_removeActor_mut"; + +PxScene_removeActors :: (self: *PxScene, actors: **PxActor, nbActors: u32, wakeOnLostTouch: bool) -> void #foreign physx "PxScene_removeActors_mut"; + +PxScene_addAggregate :: (self: *PxScene, aggregate: *PxAggregate) -> bool #foreign physx "PxScene_addAggregate_mut"; + +PxScene_removeAggregate :: (self: *PxScene, aggregate: *PxAggregate, wakeOnLostTouch: bool) -> void #foreign physx "PxScene_removeAggregate_mut"; + +PxScene_addCollection :: (self: *PxScene, collection: *PxCollection) -> bool #foreign physx "PxScene_addCollection_mut"; + +PxScene_getNbActors :: (self: *PxScene, types: u16) -> u32 #foreign physx; + +PxScene_getActors :: (self: *PxScene, types: u16, userBuffer: **PxActor, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxScene_getActiveActors :: (self: *PxScene, nbActorsOut: *u32) -> **PxActor #foreign physx "PxScene_getActiveActors_mut"; + +PxScene_getNbArticulations :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getArticulations :: (self: *PxScene, userBuffer: **PxArticulationReducedCoordinate, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxScene_getNbConstraints :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getConstraints :: (self: *PxScene, userBuffer: **PxConstraint, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxScene_getNbAggregates :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getAggregates :: (self: *PxScene, userBuffer: **PxAggregate, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxScene_setDominanceGroupPair :: (self: *PxScene, group1: u8, group2: u8, dominance: *PxDominanceGroupPair) -> void #foreign physx "PxScene_setDominanceGroupPair_mut"; + +PxScene_getDominanceGroupPair :: (self: *PxScene, group1: u8, group2: u8) -> PxDominanceGroupPair #foreign physx; + +PxScene_getCpuDispatcher :: (self: *PxScene) -> *PxCpuDispatcher #foreign physx; + +PxScene_createClient :: (self: *PxScene) -> u8 #foreign physx "PxScene_createClient_mut"; + +PxScene_setSimulationEventCallback :: (self: *PxScene, callback: *PxSimulationEventCallback) -> void #foreign physx "PxScene_setSimulationEventCallback_mut"; + +PxScene_getSimulationEventCallback :: (self: *PxScene) -> *PxSimulationEventCallback #foreign physx; + +PxScene_setContactModifyCallback :: (self: *PxScene, callback: *PxContactModifyCallback) -> void #foreign physx "PxScene_setContactModifyCallback_mut"; + +PxScene_setCCDContactModifyCallback :: (self: *PxScene, callback: *PxCCDContactModifyCallback) -> void #foreign physx "PxScene_setCCDContactModifyCallback_mut"; + +PxScene_getContactModifyCallback :: (self: *PxScene) -> *PxContactModifyCallback #foreign physx; + +PxScene_getCCDContactModifyCallback :: (self: *PxScene) -> *PxCCDContactModifyCallback #foreign physx; + +PxScene_setBroadPhaseCallback :: (self: *PxScene, callback: *PxBroadPhaseCallback) -> void #foreign physx "PxScene_setBroadPhaseCallback_mut"; + +PxScene_getBroadPhaseCallback :: (self: *PxScene) -> *PxBroadPhaseCallback #foreign physx; + +PxScene_setFilterShaderData :: (self: *PxScene, data: *void, dataSize: u32) -> void #foreign physx "PxScene_setFilterShaderData_mut"; + +PxScene_getFilterShaderData :: (self: *PxScene) -> *void #foreign physx; + +PxScene_getFilterShaderDataSize :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_resetFiltering :: (self: *PxScene, actor: *PxActor) -> bool #foreign physx "PxScene_resetFiltering_mut"; + +PxScene_resetFiltering_mut :: (self: *PxScene, actor: *PxRigidActor, shapes: **PxShape, shapeCount: u32) -> bool #foreign physx "PxScene_resetFiltering_mut_1"; + +PxScene_getKinematicKinematicFilteringMode :: (self: *PxScene) -> s32 #foreign physx; + +PxScene_getStaticKinematicFilteringMode :: (self: *PxScene) -> s32 #foreign physx; + +PxScene_simulate :: (self: *PxScene, elapsedTime: float, completionTask: *PxBaseTask, scratchMemBlock: *void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool #foreign physx "PxScene_simulate_mut"; + +PxScene_advance :: (self: *PxScene, completionTask: *PxBaseTask) -> bool #foreign physx "PxScene_advance_mut"; + +PxScene_collide :: (self: *PxScene, elapsedTime: float, completionTask: *PxBaseTask, scratchMemBlock: *void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool #foreign physx "PxScene_collide_mut"; + +PxScene_checkResults :: (self: *PxScene, block: bool) -> bool #foreign physx "PxScene_checkResults_mut"; + +PxScene_fetchCollision :: (self: *PxScene, block: bool) -> bool #foreign physx "PxScene_fetchCollision_mut"; + +PxScene_fetchResults :: (self: *PxScene, block: bool, errorState: *u32) -> bool #foreign physx "PxScene_fetchResults_mut"; + +PxScene_fetchResultsStart :: (self: *PxScene, contactPairs: **PxContactPairHeader, nbContactPairs: *u32, block: bool) -> bool #foreign physx "PxScene_fetchResultsStart_mut"; + +PxScene_processCallbacks :: (self: *PxScene, continuation: *PxBaseTask) -> void #foreign physx "PxScene_processCallbacks_mut"; + +PxScene_fetchResultsFinish :: (self: *PxScene, errorState: *u32) -> void #foreign physx "PxScene_fetchResultsFinish_mut"; + +PxScene_fetchResultsParticleSystem :: (self: *PxScene) -> void #foreign physx "PxScene_fetchResultsParticleSystem_mut"; + +PxScene_flushSimulation :: (self: *PxScene, sendPendingReports: bool) -> void #foreign physx "PxScene_flushSimulation_mut"; + +PxScene_setGravity :: (self: *PxScene, vec: *Vector3) -> void #foreign physx "PxScene_setGravity_mut"; + +PxScene_getGravity :: (self: *PxScene) -> Vector3 #foreign physx; + +PxScene_setBounceThresholdVelocity :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setBounceThresholdVelocity_mut"; + +PxScene_getBounceThresholdVelocity :: (self: *PxScene) -> float #foreign physx; + +PxScene_setCCDMaxPasses :: (self: *PxScene, ccdMaxPasses: u32) -> void #foreign physx "PxScene_setCCDMaxPasses_mut"; + +PxScene_getCCDMaxPasses :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_setCCDMaxSeparation :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setCCDMaxSeparation_mut"; + +PxScene_getCCDMaxSeparation :: (self: *PxScene) -> float #foreign physx; + +PxScene_setCCDThreshold :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setCCDThreshold_mut"; + +PxScene_getCCDThreshold :: (self: *PxScene) -> float #foreign physx; + +PxScene_setMaxBiasCoefficient :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setMaxBiasCoefficient_mut"; + +PxScene_getMaxBiasCoefficient :: (self: *PxScene) -> float #foreign physx; + +PxScene_setFrictionOffsetThreshold :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setFrictionOffsetThreshold_mut"; + +PxScene_getFrictionOffsetThreshold :: (self: *PxScene) -> float #foreign physx; + +PxScene_setFrictionCorrelationDistance :: (self: *PxScene, t: float) -> void #foreign physx "PxScene_setFrictionCorrelationDistance_mut"; + +PxScene_getFrictionCorrelationDistance :: (self: *PxScene) -> float #foreign physx; + +PxScene_getFrictionType :: (self: *PxScene) -> s32 #foreign physx; + +PxScene_getSolverType :: (self: *PxScene) -> s32 #foreign physx; + +PxScene_setVisualizationParameter :: (self: *PxScene, param: s32, value: float) -> bool #foreign physx "PxScene_setVisualizationParameter_mut"; + +PxScene_getVisualizationParameter :: (self: *PxScene, paramEnum: s32) -> float #foreign physx; + +PxScene_setVisualizationCullingBox :: (self: *PxScene, box: *PxBounds3) -> void #foreign physx "PxScene_setVisualizationCullingBox_mut"; + +PxScene_getVisualizationCullingBox :: (self: *PxScene) -> PxBounds3 #foreign physx; + +PxScene_getRenderBuffer :: (self: *PxScene) -> *PxRenderBuffer #foreign physx "PxScene_getRenderBuffer_mut"; + +PxScene_getSimulationStatistics :: (self: *PxScene, stats: *PxSimulationStatistics) -> void #foreign physx; + +PxScene_getBroadPhaseType :: (self: *PxScene) -> s32 #foreign physx; + +PxScene_getBroadPhaseCaps :: (self: *PxScene, caps: *PxBroadPhaseCaps) -> bool #foreign physx; + +PxScene_getNbBroadPhaseRegions :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getBroadPhaseRegions :: (self: *PxScene, userBuffer: *PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxScene_addBroadPhaseRegion :: (self: *PxScene, region: *PxBroadPhaseRegion, populateRegion: bool) -> u32 #foreign physx "PxScene_addBroadPhaseRegion_mut"; + +PxScene_removeBroadPhaseRegion :: (self: *PxScene, handle: u32) -> bool #foreign physx "PxScene_removeBroadPhaseRegion_mut"; + +PxScene_getTaskManager :: (self: *PxScene) -> *PxTaskManager #foreign physx; + +PxScene_lockRead :: (self: *PxScene, file: *u8, line: u32) -> void #foreign physx "PxScene_lockRead_mut"; + +PxScene_unlockRead :: (self: *PxScene) -> void #foreign physx "PxScene_unlockRead_mut"; + +PxScene_lockWrite :: (self: *PxScene, file: *u8, line: u32) -> void #foreign physx "PxScene_lockWrite_mut"; + +PxScene_unlockWrite :: (self: *PxScene) -> void #foreign physx "PxScene_unlockWrite_mut"; + +PxScene_setNbContactDataBlocks :: (self: *PxScene, numBlocks: u32) -> void #foreign physx "PxScene_setNbContactDataBlocks_mut"; + +PxScene_getNbContactDataBlocksUsed :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getMaxNbContactDataBlocksUsed :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getContactReportStreamBufferSize :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_setSolverBatchSize :: (self: *PxScene, solverBatchSize: u32) -> void #foreign physx "PxScene_setSolverBatchSize_mut"; + +PxScene_getSolverBatchSize :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_setSolverArticulationBatchSize :: (self: *PxScene, solverBatchSize: u32) -> void #foreign physx "PxScene_setSolverArticulationBatchSize_mut"; + +PxScene_getSolverArticulationBatchSize :: (self: *PxScene) -> u32 #foreign physx; + +PxScene_getWakeCounterResetValue :: (self: *PxScene) -> float #foreign physx; + +PxScene_shiftOrigin :: (self: *PxScene, shift: *Vector3) -> void #foreign physx "PxScene_shiftOrigin_mut"; + +PxScene_getScenePvdClient :: (self: *PxScene) -> *PxPvdSceneClient #foreign physx "PxScene_getScenePvdClient_mut"; + +PxScene_copyArticulationData :: (self: *PxScene, data: *void, index: *void, dataType: s32, nbCopyArticulations: u32, copyEvent: *void) -> void #foreign physx "PxScene_copyArticulationData_mut"; + +PxScene_applyArticulationData :: (self: *PxScene, data: *void, index: *void, dataType: s32, nbUpdatedArticulations: u32, waitEvent: *void, signalEvent: *void) -> void #foreign physx "PxScene_applyArticulationData_mut"; + +PxScene_copySoftBodyData :: (self: *PxScene, data: **void, dataSizes: *void, softBodyIndices: *void, flag: s32, nbCopySoftBodies: u32, maxSize: u32, copyEvent: *void) -> void #foreign physx "PxScene_copySoftBodyData_mut"; + +PxScene_applySoftBodyData :: (self: *PxScene, data: **void, dataSizes: *void, softBodyIndices: *void, flag: s32, nbUpdatedSoftBodies: u32, maxSize: u32, applyEvent: *void) -> void #foreign physx "PxScene_applySoftBodyData_mut"; + +PxScene_copyContactData :: (self: *PxScene, data: *void, maxContactPairs: u32, numContactPairs: *void, copyEvent: *void) -> void #foreign physx "PxScene_copyContactData_mut"; + +PxScene_copyBodyData :: (self: *PxScene, data: *PxGpuBodyData, index: *PxGpuActorPair, nbCopyActors: u32, copyEvent: *void) -> void #foreign physx "PxScene_copyBodyData_mut"; + +PxScene_applyActorData :: (self: *PxScene, data: *void, index: *PxGpuActorPair, flag: s32, nbUpdatedActors: u32, waitEvent: *void, signalEvent: *void) -> void #foreign physx "PxScene_applyActorData_mut"; + +PxScene_computeDenseJacobians :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign physx "PxScene_computeDenseJacobians_mut"; + +PxScene_computeGeneralizedMassMatrices :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign physx "PxScene_computeGeneralizedMassMatrices_mut"; + +PxScene_computeGeneralizedGravityForces :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign physx "PxScene_computeGeneralizedGravityForces_mut"; + +PxScene_computeCoriolisAndCentrifugalForces :: (self: *PxScene, indices: *PxIndexDataPair, nbIndices: u32, computeEvent: *void) -> void #foreign physx "PxScene_computeCoriolisAndCentrifugalForces_mut"; + +PxScene_getGpuDynamicsConfig :: (self: *PxScene) -> PxgDynamicsMemoryConfig #foreign physx; + +PxScene_applyParticleBufferData :: (self: *PxScene, indices: *u32, bufferIndexPair: *PxGpuParticleBufferIndexPair, flags: *u32, nbUpdatedBuffers: u32, waitEvent: *void, signalEvent: *void) -> void #foreign physx "PxScene_applyParticleBufferData_mut"; + +PxSceneReadLock_new_alloc :: (scene: *PxScene, file: *u8, line: u32) -> *PxSceneReadLock #foreign physx; + +PxSceneReadLock_delete :: (self: *PxSceneReadLock) -> void #foreign physx; + +PxSceneWriteLock_new_alloc :: (scene: *PxScene, file: *u8, line: u32) -> *PxSceneWriteLock #foreign physx; + +PxSceneWriteLock_delete :: (self: *PxSceneWriteLock) -> void #foreign physx; + +PxContactPairExtraDataItem_new :: () -> PxContactPairExtraDataItem #foreign physx; + +PxContactPairVelocity_new :: () -> PxContactPairVelocity #foreign physx; + +PxContactPairPose_new :: () -> PxContactPairPose #foreign physx; + +PxContactPairIndex_new :: () -> PxContactPairIndex #foreign physx; + +PxContactPairExtraDataIterator_new :: (stream: *u8, size: u32) -> PxContactPairExtraDataIterator #foreign physx; + +PxContactPairExtraDataIterator_nextItemSet :: (self: *PxContactPairExtraDataIterator) -> bool #foreign physx "PxContactPairExtraDataIterator_nextItemSet_mut"; + +PxContactPairHeader_new :: () -> PxContactPairHeader #foreign physx; + +PxContactPair_new :: () -> PxContactPair #foreign physx; + +PxContactPair_extractContacts :: (self: *PxContactPair, userBuffer: *PxContactPairPoint, bufferSize: u32) -> u32 #foreign physx; + +PxContactPair_bufferContacts :: (self: *PxContactPair, newPair: *PxContactPair, bufferMemory: *u8) -> void #foreign physx; + +PxContactPair_getInternalFaceIndices :: (self: *PxContactPair) -> *u32 #foreign physx; + +PxTriggerPair_new :: () -> PxTriggerPair #foreign physx; + +PxConstraintInfo_new :: () -> PxConstraintInfo #foreign physx; + +PxConstraintInfo_new :: (c: *PxConstraint, extRef: *void, t: u32) -> PxConstraintInfo #foreign physx "PxConstraintInfo_new_1"; + +PxSimulationEventCallback_onConstraintBreak :: (self: *PxSimulationEventCallback, constraints: *PxConstraintInfo, count: u32) -> void #foreign physx "PxSimulationEventCallback_onConstraintBreak_mut"; + +PxSimulationEventCallback_onWake :: (self: *PxSimulationEventCallback, actors: **PxActor, count: u32) -> void #foreign physx "PxSimulationEventCallback_onWake_mut"; + +PxSimulationEventCallback_onSleep :: (self: *PxSimulationEventCallback, actors: **PxActor, count: u32) -> void #foreign physx "PxSimulationEventCallback_onSleep_mut"; + +PxSimulationEventCallback_onContact :: (self: *PxSimulationEventCallback, pairHeader: *PxContactPairHeader, pairs: *PxContactPair, nbPairs: u32) -> void #foreign physx "PxSimulationEventCallback_onContact_mut"; + +PxSimulationEventCallback_onTrigger :: (self: *PxSimulationEventCallback, pairs: *PxTriggerPair, count: u32) -> void #foreign physx "PxSimulationEventCallback_onTrigger_mut"; + +PxSimulationEventCallback_onAdvance :: (self: *PxSimulationEventCallback, bodyBuffer: **PxRigidBody, poseBuffer: *PxTransform, count: u32) -> void #foreign physx "PxSimulationEventCallback_onAdvance_mut"; + +PxSimulationEventCallback_delete :: (self: *PxSimulationEventCallback) -> void #foreign physx; + +PxFEMParameters_new :: () -> PxFEMParameters #foreign physx; + +PxPruningStructure_release :: (self: *PxPruningStructure) -> void #foreign physx "PxPruningStructure_release_mut"; + +PxPruningStructure_getRigidActors :: (self: *PxPruningStructure, userBuffer: **PxRigidActor, bufferSize: u32, startIndex: u32) -> u32 #foreign physx; + +PxPruningStructure_getNbRigidActors :: (self: *PxPruningStructure) -> u32 #foreign physx; + +PxPruningStructure_getStaticMergeData :: (self: *PxPruningStructure) -> *void #foreign physx; + +PxPruningStructure_getDynamicMergeData :: (self: *PxPruningStructure) -> *void #foreign physx; + +PxPruningStructure_getConcreteTypeName :: (self: *PxPruningStructure) -> *u8 #foreign physx; + +PxExtendedVec3_new :: () -> PxExtendedVec3 #foreign physx; + +PxExtendedVec3_new :: (_x: float64, _y: float64, _z: float64) -> PxExtendedVec3 #foreign physx "PxExtendedVec3_new_1"; + +PxExtendedVec3_isZero :: (self: *PxExtendedVec3) -> bool #foreign physx; + +PxExtendedVec3_dot :: (self: *PxExtendedVec3, v: *Vector3) -> float64 #foreign physx; + +PxExtendedVec3_distanceSquared :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> float64 #foreign physx; + +PxExtendedVec3_magnitudeSquared :: (self: *PxExtendedVec3) -> float64 #foreign physx; + +PxExtendedVec3_magnitude :: (self: *PxExtendedVec3) -> float64 #foreign physx; + +PxExtendedVec3_normalize :: (self: *PxExtendedVec3) -> float64 #foreign physx "PxExtendedVec3_normalize_mut"; + +PxExtendedVec3_isFinite :: (self: *PxExtendedVec3) -> bool #foreign physx; + +PxExtendedVec3_maximum :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_maximum_mut"; + +PxExtendedVec3_minimum :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_minimum_mut"; + +PxExtendedVec3_set :: (self: *PxExtendedVec3, x_: float64, y_: float64, z_: float64) -> void #foreign physx "PxExtendedVec3_set_mut"; + +PxExtendedVec3_setPlusInfinity :: (self: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_setPlusInfinity_mut"; + +PxExtendedVec3_setMinusInfinity :: (self: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_setMinusInfinity_mut"; + +PxExtendedVec3_cross :: (self: *PxExtendedVec3, left: *PxExtendedVec3, right: *Vector3) -> void #foreign physx "PxExtendedVec3_cross_mut"; + +PxExtendedVec3_cross_mut :: (self: *PxExtendedVec3, left: *PxExtendedVec3, right: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_cross_mut_1"; + +PxExtendedVec3_cross :: (self: *PxExtendedVec3, v: *PxExtendedVec3) -> PxExtendedVec3 #foreign physx; + +PxExtendedVec3_cross_mut :: (self: *PxExtendedVec3, left: *Vector3, right: *PxExtendedVec3) -> void #foreign physx "PxExtendedVec3_cross_mut_2"; + +toVec3 :: (v: *PxExtendedVec3) -> Vector3 #foreign physx "phys_toVec3"; + +PxObstacle_getType :: (self: *PxObstacle) -> s32 #foreign physx; + +PxBoxObstacle_new :: () -> PxBoxObstacle #foreign physx; + +PxCapsuleObstacle_new :: () -> PxCapsuleObstacle #foreign physx; + +PxObstacleContext_release :: (self: *PxObstacleContext) -> void #foreign physx "PxObstacleContext_release_mut"; + +PxObstacleContext_getControllerManager :: (self: *PxObstacleContext) -> *PxControllerManager #foreign physx; + +PxObstacleContext_addObstacle :: (self: *PxObstacleContext, obstacle: *PxObstacle) -> u32 #foreign physx "PxObstacleContext_addObstacle_mut"; + +PxObstacleContext_removeObstacle :: (self: *PxObstacleContext, handle: u32) -> bool #foreign physx "PxObstacleContext_removeObstacle_mut"; + +PxObstacleContext_updateObstacle :: (self: *PxObstacleContext, handle: u32, obstacle: *PxObstacle) -> bool #foreign physx "PxObstacleContext_updateObstacle_mut"; + +PxObstacleContext_getNbObstacles :: (self: *PxObstacleContext) -> u32 #foreign physx; + +PxObstacleContext_getObstacle :: (self: *PxObstacleContext, i: u32) -> *PxObstacle #foreign physx; + +PxObstacleContext_getObstacleByHandle :: (self: *PxObstacleContext, handle: u32) -> *PxObstacle #foreign physx; + +PxUserControllerHitReport_onShapeHit :: (self: *PxUserControllerHitReport, hit: *PxControllerShapeHit) -> void #foreign physx "PxUserControllerHitReport_onShapeHit_mut"; + +PxUserControllerHitReport_onControllerHit :: (self: *PxUserControllerHitReport, hit: *PxControllersHit) -> void #foreign physx "PxUserControllerHitReport_onControllerHit_mut"; + +PxUserControllerHitReport_onObstacleHit :: (self: *PxUserControllerHitReport, hit: *PxControllerObstacleHit) -> void #foreign physx "PxUserControllerHitReport_onObstacleHit_mut"; + +PxControllerFilterCallback_delete :: (self: *PxControllerFilterCallback) -> void #foreign physx; + +PxControllerFilterCallback_filter :: (self: *PxControllerFilterCallback, a: *PxController, b: *PxController) -> bool #foreign physx "PxControllerFilterCallback_filter_mut"; + +PxControllerFilters_new :: (filterData: *PxFilterData, cb: *PxQueryFilterCallback, cctFilterCb: *PxControllerFilterCallback) -> PxControllerFilters #foreign physx; + +PxControllerDesc_isValid :: (self: *PxControllerDesc) -> bool #foreign physx; + +PxControllerDesc_getType :: (self: *PxControllerDesc) -> s32 #foreign physx; + +PxController_getType :: (self: *PxController) -> s32 #foreign physx; + +PxController_release :: (self: *PxController) -> void #foreign physx "PxController_release_mut"; + +PxController_move :: (self: *PxController, disp: *Vector3, minDist: float, elapsedTime: float, filters: *PxControllerFilters, obstacles: *PxObstacleContext) -> u8 #foreign physx "PxController_move_mut"; + +PxController_setPosition :: (self: *PxController, position: *PxExtendedVec3) -> bool #foreign physx "PxController_setPosition_mut"; + +PxController_getPosition :: (self: *PxController) -> *PxExtendedVec3 #foreign physx; + +PxController_setFootPosition :: (self: *PxController, position: *PxExtendedVec3) -> bool #foreign physx "PxController_setFootPosition_mut"; + +PxController_getFootPosition :: (self: *PxController) -> PxExtendedVec3 #foreign physx; + +PxController_getActor :: (self: *PxController) -> *PxRigidDynamic #foreign physx; + +PxController_setStepOffset :: (self: *PxController, offset: float) -> void #foreign physx "PxController_setStepOffset_mut"; + +PxController_getStepOffset :: (self: *PxController) -> float #foreign physx; + +PxController_setNonWalkableMode :: (self: *PxController, flag: s32) -> void #foreign physx "PxController_setNonWalkableMode_mut"; + +PxController_getNonWalkableMode :: (self: *PxController) -> s32 #foreign physx; + +PxController_getContactOffset :: (self: *PxController) -> float #foreign physx; + +PxController_setContactOffset :: (self: *PxController, offset: float) -> void #foreign physx "PxController_setContactOffset_mut"; + +PxController_getUpDirection :: (self: *PxController) -> Vector3 #foreign physx; + +PxController_setUpDirection :: (self: *PxController, up: *Vector3) -> void #foreign physx "PxController_setUpDirection_mut"; + +PxController_getSlopeLimit :: (self: *PxController) -> float #foreign physx; + +PxController_setSlopeLimit :: (self: *PxController, slopeLimit: float) -> void #foreign physx "PxController_setSlopeLimit_mut"; + +PxController_invalidateCache :: (self: *PxController) -> void #foreign physx "PxController_invalidateCache_mut"; + +PxController_getScene :: (self: *PxController) -> *PxScene #foreign physx "PxController_getScene_mut"; + +PxController_getUserData :: (self: *PxController) -> *void #foreign physx; + +PxController_setUserData :: (self: *PxController, userData: *void) -> void #foreign physx "PxController_setUserData_mut"; + +PxController_getState :: (self: *PxController, state: *PxControllerState) -> void #foreign physx; + +PxController_getStats :: (self: *PxController, stats: *PxControllerStats) -> void #foreign physx; + +PxController_resize :: (self: *PxController, height: float) -> void #foreign physx "PxController_resize_mut"; + +PxBoxControllerDesc_new_alloc :: () -> *PxBoxControllerDesc #foreign physx; + +PxBoxControllerDesc_delete :: (self: *PxBoxControllerDesc) -> void #foreign physx; + +PxBoxControllerDesc_setToDefault :: (self: *PxBoxControllerDesc) -> void #foreign physx "PxBoxControllerDesc_setToDefault_mut"; + +PxBoxControllerDesc_isValid :: (self: *PxBoxControllerDesc) -> bool #foreign physx; + +PxBoxController_getHalfHeight :: (self: *PxBoxController) -> float #foreign physx; + +PxBoxController_getHalfSideExtent :: (self: *PxBoxController) -> float #foreign physx; + +PxBoxController_getHalfForwardExtent :: (self: *PxBoxController) -> float #foreign physx; + +PxBoxController_setHalfHeight :: (self: *PxBoxController, halfHeight: float) -> bool #foreign physx "PxBoxController_setHalfHeight_mut"; + +PxBoxController_setHalfSideExtent :: (self: *PxBoxController, halfSideExtent: float) -> bool #foreign physx "PxBoxController_setHalfSideExtent_mut"; + +PxBoxController_setHalfForwardExtent :: (self: *PxBoxController, halfForwardExtent: float) -> bool #foreign physx "PxBoxController_setHalfForwardExtent_mut"; + +PxCapsuleControllerDesc_new_alloc :: () -> *PxCapsuleControllerDesc #foreign physx; + +PxCapsuleControllerDesc_delete :: (self: *PxCapsuleControllerDesc) -> void #foreign physx; + +PxCapsuleControllerDesc_setToDefault :: (self: *PxCapsuleControllerDesc) -> void #foreign physx "PxCapsuleControllerDesc_setToDefault_mut"; + +PxCapsuleControllerDesc_isValid :: (self: *PxCapsuleControllerDesc) -> bool #foreign physx; + +PxCapsuleController_getRadius :: (self: *PxCapsuleController) -> float #foreign physx; + +PxCapsuleController_setRadius :: (self: *PxCapsuleController, radius: float) -> bool #foreign physx "PxCapsuleController_setRadius_mut"; + +PxCapsuleController_getHeight :: (self: *PxCapsuleController) -> float #foreign physx; + +PxCapsuleController_setHeight :: (self: *PxCapsuleController, height: float) -> bool #foreign physx "PxCapsuleController_setHeight_mut"; + +PxCapsuleController_getClimbingMode :: (self: *PxCapsuleController) -> s32 #foreign physx; + +PxCapsuleController_setClimbingMode :: (self: *PxCapsuleController, mode: s32) -> bool #foreign physx "PxCapsuleController_setClimbingMode_mut"; + +PxControllerBehaviorCallback_getBehaviorFlags :: (self: *PxControllerBehaviorCallback, shape: *PxShape, actor: *PxActor) -> u8 #foreign physx "PxControllerBehaviorCallback_getBehaviorFlags_mut"; + +PxControllerBehaviorCallback_getBehaviorFlags_mut :: (self: *PxControllerBehaviorCallback, controller: *PxController) -> u8 #foreign physx "PxControllerBehaviorCallback_getBehaviorFlags_mut_1"; + +PxControllerBehaviorCallback_getBehaviorFlags_mut :: (self: *PxControllerBehaviorCallback, obstacle: *PxObstacle) -> u8 #foreign physx "PxControllerBehaviorCallback_getBehaviorFlags_mut_2"; + +PxControllerManager_release :: (self: *PxControllerManager) -> void #foreign physx "PxControllerManager_release_mut"; + +PxControllerManager_getScene :: (self: *PxControllerManager) -> *PxScene #foreign physx; + +PxControllerManager_getNbControllers :: (self: *PxControllerManager) -> u32 #foreign physx; + +PxControllerManager_getController :: (self: *PxControllerManager, index: u32) -> *PxController #foreign physx "PxControllerManager_getController_mut"; + +PxControllerManager_createController :: (self: *PxControllerManager, desc: *PxControllerDesc) -> *PxController #foreign physx "PxControllerManager_createController_mut"; + +PxControllerManager_purgeControllers :: (self: *PxControllerManager) -> void #foreign physx "PxControllerManager_purgeControllers_mut"; + +PxControllerManager_getRenderBuffer :: (self: *PxControllerManager) -> *PxRenderBuffer #foreign physx "PxControllerManager_getRenderBuffer_mut"; + +PxControllerManager_setDebugRenderingFlags :: (self: *PxControllerManager, flags: u32) -> void #foreign physx "PxControllerManager_setDebugRenderingFlags_mut"; + +PxControllerManager_getNbObstacleContexts :: (self: *PxControllerManager) -> u32 #foreign physx; + +PxControllerManager_getObstacleContext :: (self: *PxControllerManager, index: u32) -> *PxObstacleContext #foreign physx "PxControllerManager_getObstacleContext_mut"; + +PxControllerManager_createObstacleContext :: (self: *PxControllerManager) -> *PxObstacleContext #foreign physx "PxControllerManager_createObstacleContext_mut"; + +PxControllerManager_computeInteractions :: (self: *PxControllerManager, elapsedTime: float, cctFilterCb: *PxControllerFilterCallback) -> void #foreign physx "PxControllerManager_computeInteractions_mut"; + +PxControllerManager_setTessellation :: (self: *PxControllerManager, flag: bool, maxEdgeLength: float) -> void #foreign physx "PxControllerManager_setTessellation_mut"; + +PxControllerManager_setOverlapRecoveryModule :: (self: *PxControllerManager, flag: bool) -> void #foreign physx "PxControllerManager_setOverlapRecoveryModule_mut"; + +PxControllerManager_setPreciseSweeps :: (self: *PxControllerManager, flag: bool) -> void #foreign physx "PxControllerManager_setPreciseSweeps_mut"; + +PxControllerManager_setPreventVerticalSlidingAgainstCeiling :: (self: *PxControllerManager, flag: bool) -> void #foreign physx "PxControllerManager_setPreventVerticalSlidingAgainstCeiling_mut"; + +PxControllerManager_shiftOrigin :: (self: *PxControllerManager, shift: *Vector3) -> void #foreign physx "PxControllerManager_shiftOrigin_mut"; + +PxCreateControllerManager :: (scene: *PxScene, lockingEnabled: bool) -> *PxControllerManager #foreign physx "phys_PxCreateControllerManager"; + +PxDim3_new :: () -> PxDim3 #foreign physx; + +PxSDFDesc_new :: () -> PxSDFDesc #foreign physx; + +PxSDFDesc_isValid :: (self: *PxSDFDesc) -> bool #foreign physx; + +PxConvexMeshDesc_new :: () -> PxConvexMeshDesc #foreign physx; + +PxConvexMeshDesc_setToDefault :: (self: *PxConvexMeshDesc) -> void #foreign physx "PxConvexMeshDesc_setToDefault_mut"; + +PxConvexMeshDesc_isValid :: (self: *PxConvexMeshDesc) -> bool #foreign physx; + +PxTriangleMeshDesc_new :: () -> PxTriangleMeshDesc #foreign physx; + +PxTriangleMeshDesc_setToDefault :: (self: *PxTriangleMeshDesc) -> void #foreign physx "PxTriangleMeshDesc_setToDefault_mut"; + +PxTriangleMeshDesc_isValid :: (self: *PxTriangleMeshDesc) -> bool #foreign physx; + +PxTetrahedronMeshDesc_new :: () -> PxTetrahedronMeshDesc #foreign physx; + +PxTetrahedronMeshDesc_isValid :: (self: *PxTetrahedronMeshDesc) -> bool #foreign physx; + +PxSoftBodySimulationDataDesc_new :: () -> PxSoftBodySimulationDataDesc #foreign physx; + +PxSoftBodySimulationDataDesc_isValid :: (self: *PxSoftBodySimulationDataDesc) -> bool #foreign physx; + +PxBVH34MidphaseDesc_setToDefault :: (self: *PxBVH34MidphaseDesc) -> void #foreign physx "PxBVH34MidphaseDesc_setToDefault_mut"; + +PxBVH34MidphaseDesc_isValid :: (self: *PxBVH34MidphaseDesc) -> bool #foreign physx; + +PxMidphaseDesc_new :: () -> PxMidphaseDesc #foreign physx; + +PxMidphaseDesc_getType :: (self: *PxMidphaseDesc) -> s32 #foreign physx; + +PxMidphaseDesc_setToDefault :: (self: *PxMidphaseDesc, type: s32) -> void #foreign physx "PxMidphaseDesc_setToDefault_mut"; + +PxMidphaseDesc_isValid :: (self: *PxMidphaseDesc) -> bool #foreign physx; + +PxBVHDesc_new :: () -> PxBVHDesc #foreign physx; + +PxBVHDesc_setToDefault :: (self: *PxBVHDesc) -> void #foreign physx "PxBVHDesc_setToDefault_mut"; + +PxBVHDesc_isValid :: (self: *PxBVHDesc) -> bool #foreign physx; + +PxCookingParams_new :: (sc: *PxTolerancesScale) -> PxCookingParams #foreign physx; + +PxGetStandaloneInsertionCallback :: () -> *PxInsertionCallback #foreign physx "phys_PxGetStandaloneInsertionCallback"; + +PxCookBVH :: (desc: *PxBVHDesc, stream: *PxOutputStream) -> bool #foreign physx "phys_PxCookBVH"; + +PxCreateBVH :: (desc: *PxBVHDesc, insertionCallback: *PxInsertionCallback) -> *PxBVH #foreign physx "phys_PxCreateBVH"; + +PxCookHeightField :: (desc: *PxHeightFieldDesc, stream: *PxOutputStream) -> bool #foreign physx "phys_PxCookHeightField"; + +PxCreateHeightField :: (desc: *PxHeightFieldDesc, insertionCallback: *PxInsertionCallback) -> *PxHeightField #foreign physx "phys_PxCreateHeightField"; + +PxCookConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc, stream: *PxOutputStream, condition: *s32) -> bool #foreign physx "phys_PxCookConvexMesh"; + +PxCreateConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc, insertionCallback: *PxInsertionCallback, condition: *s32) -> *PxConvexMesh #foreign physx "phys_PxCreateConvexMesh"; + +PxValidateConvexMesh :: (params: *PxCookingParams, desc: *PxConvexMeshDesc) -> bool #foreign physx "phys_PxValidateConvexMesh"; + +PxComputeHullPolygons :: (params: *PxCookingParams, mesh: *PxSimpleTriangleMesh, inCallback: *PxAllocatorCallback, nbVerts: *u32, vertices: **Vector3, nbIndices: *u32, indices: **u32, nbPolygons: *u32, hullPolygons: **PxHullPolygon) -> bool #foreign physx "phys_PxComputeHullPolygons"; + +PxValidateTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc) -> bool #foreign physx "phys_PxValidateTriangleMesh"; + +PxCreateTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc, insertionCallback: *PxInsertionCallback, condition: *s32) -> *PxTriangleMesh #foreign physx "phys_PxCreateTriangleMesh"; + +PxCookTriangleMesh :: (params: *PxCookingParams, desc: *PxTriangleMeshDesc, stream: *PxOutputStream, condition: *s32) -> bool #foreign physx "phys_PxCookTriangleMesh"; + +PxDefaultMemoryOutputStream_new_alloc :: (allocator: *PxAllocatorCallback) -> *PxDefaultMemoryOutputStream #foreign physx; + +PxDefaultMemoryOutputStream_delete :: (self: *PxDefaultMemoryOutputStream) -> void #foreign physx; + +PxDefaultMemoryOutputStream_write :: (self: *PxDefaultMemoryOutputStream, src: *void, count: u32) -> u32 #foreign physx "PxDefaultMemoryOutputStream_write_mut"; + +PxDefaultMemoryOutputStream_getSize :: (self: *PxDefaultMemoryOutputStream) -> u32 #foreign physx; + +PxDefaultMemoryOutputStream_getData :: (self: *PxDefaultMemoryOutputStream) -> *u8 #foreign physx; + +PxDefaultMemoryInputData_new_alloc :: (data: *u8, length: u32) -> *PxDefaultMemoryInputData #foreign physx; + +PxDefaultMemoryInputData_read :: (self: *PxDefaultMemoryInputData, dest: *void, count: u32) -> u32 #foreign physx "PxDefaultMemoryInputData_read_mut"; + +PxDefaultMemoryInputData_getLength :: (self: *PxDefaultMemoryInputData) -> u32 #foreign physx; + +PxDefaultMemoryInputData_seek :: (self: *PxDefaultMemoryInputData, pos: u32) -> void #foreign physx "PxDefaultMemoryInputData_seek_mut"; + +PxDefaultMemoryInputData_tell :: (self: *PxDefaultMemoryInputData) -> u32 #foreign physx; + +PxDefaultFileOutputStream_new_alloc :: (name: *u8) -> *PxDefaultFileOutputStream #foreign physx; + +PxDefaultFileOutputStream_delete :: (self: *PxDefaultFileOutputStream) -> void #foreign physx; + +PxDefaultFileOutputStream_write :: (self: *PxDefaultFileOutputStream, src: *void, count: u32) -> u32 #foreign physx "PxDefaultFileOutputStream_write_mut"; + +PxDefaultFileOutputStream_isValid :: (self: *PxDefaultFileOutputStream) -> bool #foreign physx "PxDefaultFileOutputStream_isValid_mut"; + +PxDefaultFileInputData_new_alloc :: (name: *u8) -> *PxDefaultFileInputData #foreign physx; + +PxDefaultFileInputData_delete :: (self: *PxDefaultFileInputData) -> void #foreign physx; + +PxDefaultFileInputData_read :: (self: *PxDefaultFileInputData, dest: *void, count: u32) -> u32 #foreign physx "PxDefaultFileInputData_read_mut"; + +PxDefaultFileInputData_seek :: (self: *PxDefaultFileInputData, pos: u32) -> void #foreign physx "PxDefaultFileInputData_seek_mut"; + +PxDefaultFileInputData_tell :: (self: *PxDefaultFileInputData) -> u32 #foreign physx; + +PxDefaultFileInputData_getLength :: (self: *PxDefaultFileInputData) -> u32 #foreign physx; + +PxDefaultFileInputData_isValid :: (self: *PxDefaultFileInputData) -> bool #foreign physx; + +platformAlignedAlloc :: (size: u64) -> *void #foreign physx "phys_platformAlignedAlloc"; + +platformAlignedFree :: (ptr: *void) -> void #foreign physx "phys_platformAlignedFree"; + +PxDefaultAllocator_allocate :: (self: *PxDefaultAllocator, size: u64, anon_param1: *u8, anon_param2: *u8, anon_param3: s32) -> *void #foreign physx "PxDefaultAllocator_allocate_mut"; + +PxDefaultAllocator_deallocate :: (self: *PxDefaultAllocator, ptr: *void) -> void #foreign physx "PxDefaultAllocator_deallocate_mut"; + +PxDefaultAllocator_delete :: (self: *PxDefaultAllocator) -> void #foreign physx; + +PxJoint_setActors :: (self: *PxJoint, actor0: *PxRigidActor, actor1: *PxRigidActor) -> void #foreign physx "PxJoint_setActors_mut"; + +PxJoint_getActors :: (self: *PxJoint, actor0: **PxRigidActor, actor1: **PxRigidActor) -> void #foreign physx; + +PxJoint_setLocalPose :: (self: *PxJoint, actor: s32, localPose: *PxTransform) -> void #foreign physx "PxJoint_setLocalPose_mut"; + +PxJoint_getLocalPose :: (self: *PxJoint, actor: s32) -> PxTransform #foreign physx; + +PxJoint_getRelativeTransform :: (self: *PxJoint) -> PxTransform #foreign physx; + +PxJoint_getRelativeLinearVelocity :: (self: *PxJoint) -> Vector3 #foreign physx; + +PxJoint_getRelativeAngularVelocity :: (self: *PxJoint) -> Vector3 #foreign physx; + +PxJoint_setBreakForce :: (self: *PxJoint, force: float, torque: float) -> void #foreign physx "PxJoint_setBreakForce_mut"; + +PxJoint_getBreakForce :: (self: *PxJoint, force: *float, torque: *float) -> void #foreign physx; + +PxJoint_setConstraintFlags :: (self: *PxJoint, flags: u16) -> void #foreign physx "PxJoint_setConstraintFlags_mut"; + +PxJoint_setConstraintFlag :: (self: *PxJoint, flag: s32, value: bool) -> void #foreign physx "PxJoint_setConstraintFlag_mut"; + +PxJoint_getConstraintFlags :: (self: *PxJoint) -> u16 #foreign physx; + +PxJoint_setInvMassScale0 :: (self: *PxJoint, invMassScale: float) -> void #foreign physx "PxJoint_setInvMassScale0_mut"; + +PxJoint_getInvMassScale0 :: (self: *PxJoint) -> float #foreign physx; + +PxJoint_setInvInertiaScale0 :: (self: *PxJoint, invInertiaScale: float) -> void #foreign physx "PxJoint_setInvInertiaScale0_mut"; + +PxJoint_getInvInertiaScale0 :: (self: *PxJoint) -> float #foreign physx; + +PxJoint_setInvMassScale1 :: (self: *PxJoint, invMassScale: float) -> void #foreign physx "PxJoint_setInvMassScale1_mut"; + +PxJoint_getInvMassScale1 :: (self: *PxJoint) -> float #foreign physx; + +PxJoint_setInvInertiaScale1 :: (self: *PxJoint, invInertiaScale: float) -> void #foreign physx "PxJoint_setInvInertiaScale1_mut"; + +PxJoint_getInvInertiaScale1 :: (self: *PxJoint) -> float #foreign physx; + +PxJoint_getConstraint :: (self: *PxJoint) -> *PxConstraint #foreign physx; + +PxJoint_setName :: (self: *PxJoint, name: *u8) -> void #foreign physx "PxJoint_setName_mut"; + +PxJoint_getName :: (self: *PxJoint) -> *u8 #foreign physx; + +PxJoint_release :: (self: *PxJoint) -> void #foreign physx "PxJoint_release_mut"; + +PxJoint_getScene :: (self: *PxJoint) -> *PxScene #foreign physx; + +PxJoint_getBinaryMetaData :: (stream: *PxOutputStream) -> void #foreign physx; + +PxSpring_new :: (stiffness_: float, damping_: float) -> PxSpring #foreign physx; + +PxSetJointGlobalFrame :: (joint: *PxJoint, wsAnchor: *Vector3, wsAxis: *Vector3) -> void #foreign physx "phys_PxSetJointGlobalFrame"; + +PxDistanceJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxDistanceJoint #foreign physx "phys_PxDistanceJointCreate"; + +PxDistanceJoint_getDistance :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setMinDistance :: (self: *PxDistanceJoint, distance: float) -> void #foreign physx "PxDistanceJoint_setMinDistance_mut"; + +PxDistanceJoint_getMinDistance :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setMaxDistance :: (self: *PxDistanceJoint, distance: float) -> void #foreign physx "PxDistanceJoint_setMaxDistance_mut"; + +PxDistanceJoint_getMaxDistance :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setTolerance :: (self: *PxDistanceJoint, tolerance: float) -> void #foreign physx "PxDistanceJoint_setTolerance_mut"; + +PxDistanceJoint_getTolerance :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setStiffness :: (self: *PxDistanceJoint, stiffness: float) -> void #foreign physx "PxDistanceJoint_setStiffness_mut"; + +PxDistanceJoint_getStiffness :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setDamping :: (self: *PxDistanceJoint, damping: float) -> void #foreign physx "PxDistanceJoint_setDamping_mut"; + +PxDistanceJoint_getDamping :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setContactDistance :: (self: *PxDistanceJoint, contactDistance: float) -> void #foreign physx "PxDistanceJoint_setContactDistance_mut"; + +PxDistanceJoint_getContactDistance :: (self: *PxDistanceJoint) -> float #foreign physx; + +PxDistanceJoint_setDistanceJointFlags :: (self: *PxDistanceJoint, flags: u16) -> void #foreign physx "PxDistanceJoint_setDistanceJointFlags_mut"; + +PxDistanceJoint_setDistanceJointFlag :: (self: *PxDistanceJoint, flag: s32, value: bool) -> void #foreign physx "PxDistanceJoint_setDistanceJointFlag_mut"; + +PxDistanceJoint_getDistanceJointFlags :: (self: *PxDistanceJoint) -> u16 #foreign physx; + +PxDistanceJoint_getConcreteTypeName :: (self: *PxDistanceJoint) -> *u8 #foreign physx; + +PxContactJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxContactJoint #foreign physx "phys_PxContactJointCreate"; + +PxJacobianRow_new :: () -> PxJacobianRow #foreign physx; + +PxJacobianRow_new :: (lin0: *Vector3, lin1: *Vector3, ang0: *Vector3, ang1: *Vector3) -> PxJacobianRow #foreign physx "PxJacobianRow_new_1"; + +PxContactJoint_setContact :: (self: *PxContactJoint, contact: *Vector3) -> void #foreign physx "PxContactJoint_setContact_mut"; + +PxContactJoint_setContactNormal :: (self: *PxContactJoint, contactNormal: *Vector3) -> void #foreign physx "PxContactJoint_setContactNormal_mut"; + +PxContactJoint_setPenetration :: (self: *PxContactJoint, penetration: float) -> void #foreign physx "PxContactJoint_setPenetration_mut"; + +PxContactJoint_getContact :: (self: *PxContactJoint) -> Vector3 #foreign physx; + +PxContactJoint_getContactNormal :: (self: *PxContactJoint) -> Vector3 #foreign physx; + +PxContactJoint_getPenetration :: (self: *PxContactJoint) -> float #foreign physx; + +PxContactJoint_getRestitution :: (self: *PxContactJoint) -> float #foreign physx; + +PxContactJoint_setRestitution :: (self: *PxContactJoint, restitution: float) -> void #foreign physx "PxContactJoint_setRestitution_mut"; + +PxContactJoint_getBounceThreshold :: (self: *PxContactJoint) -> float #foreign physx; + +PxContactJoint_setBounceThreshold :: (self: *PxContactJoint, bounceThreshold: float) -> void #foreign physx "PxContactJoint_setBounceThreshold_mut"; + +PxContactJoint_getConcreteTypeName :: (self: *PxContactJoint) -> *u8 #foreign physx; + +PxContactJoint_computeJacobians :: (self: *PxContactJoint, jacobian: *PxJacobianRow) -> void #foreign physx; + +PxContactJoint_getNbJacobianRows :: (self: *PxContactJoint) -> u32 #foreign physx; + +PxFixedJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxFixedJoint #foreign physx "phys_PxFixedJointCreate"; + +PxFixedJoint_getConcreteTypeName :: (self: *PxFixedJoint) -> *u8 #foreign physx; + +PxJointLimitParameters_new_alloc :: () -> *PxJointLimitParameters #foreign physx; + +PxJointLimitParameters_isValid :: (self: *PxJointLimitParameters) -> bool #foreign physx; + +PxJointLimitParameters_isSoft :: (self: *PxJointLimitParameters) -> bool #foreign physx; + +PxJointLinearLimit_new :: (scale: *PxTolerancesScale, extent: float, contactDist_deprecated: float) -> PxJointLinearLimit #foreign physx; + +PxJointLinearLimit_new :: (extent: float, spring: *PxSpring) -> PxJointLinearLimit #foreign physx "PxJointLinearLimit_new_1"; + +PxJointLinearLimit_isValid :: (self: *PxJointLinearLimit) -> bool #foreign physx; + +PxJointLinearLimit_delete :: (self: *PxJointLinearLimit) -> void #foreign physx; + +PxJointLinearLimitPair_new :: (scale: *PxTolerancesScale, lowerLimit: float, upperLimit: float, contactDist_deprecated: float) -> PxJointLinearLimitPair #foreign physx; + +PxJointLinearLimitPair_new :: (lowerLimit: float, upperLimit: float, spring: *PxSpring) -> PxJointLinearLimitPair #foreign physx "PxJointLinearLimitPair_new_1"; + +PxJointLinearLimitPair_isValid :: (self: *PxJointLinearLimitPair) -> bool #foreign physx; + +PxJointLinearLimitPair_delete :: (self: *PxJointLinearLimitPair) -> void #foreign physx; + +PxJointAngularLimitPair_new :: (lowerLimit: float, upperLimit: float, contactDist_deprecated: float) -> PxJointAngularLimitPair #foreign physx; + +PxJointAngularLimitPair_new :: (lowerLimit: float, upperLimit: float, spring: *PxSpring) -> PxJointAngularLimitPair #foreign physx "PxJointAngularLimitPair_new_1"; + +PxJointAngularLimitPair_isValid :: (self: *PxJointAngularLimitPair) -> bool #foreign physx; + +PxJointAngularLimitPair_delete :: (self: *PxJointAngularLimitPair) -> void #foreign physx; + +PxJointLimitCone_new :: (yLimitAngle: float, zLimitAngle: float, contactDist_deprecated: float) -> PxJointLimitCone #foreign physx; + +PxJointLimitCone_new :: (yLimitAngle: float, zLimitAngle: float, spring: *PxSpring) -> PxJointLimitCone #foreign physx "PxJointLimitCone_new_1"; + +PxJointLimitCone_isValid :: (self: *PxJointLimitCone) -> bool #foreign physx; + +PxJointLimitCone_delete :: (self: *PxJointLimitCone) -> void #foreign physx; + +PxJointLimitPyramid_new :: (yLimitAngleMin: float, yLimitAngleMax: float, zLimitAngleMin: float, zLimitAngleMax: float, contactDist_deprecated: float) -> PxJointLimitPyramid #foreign physx; + +PxJointLimitPyramid_new :: (yLimitAngleMin: float, yLimitAngleMax: float, zLimitAngleMin: float, zLimitAngleMax: float, spring: *PxSpring) -> PxJointLimitPyramid #foreign physx "PxJointLimitPyramid_new_1"; + +PxJointLimitPyramid_isValid :: (self: *PxJointLimitPyramid) -> bool #foreign physx; + +PxJointLimitPyramid_delete :: (self: *PxJointLimitPyramid) -> void #foreign physx; + +PxPrismaticJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxPrismaticJoint #foreign physx "phys_PxPrismaticJointCreate"; + +PxPrismaticJoint_getPosition :: (self: *PxPrismaticJoint) -> float #foreign physx; + +PxPrismaticJoint_getVelocity :: (self: *PxPrismaticJoint) -> float #foreign physx; + +PxPrismaticJoint_setLimit :: (self: *PxPrismaticJoint, anon_param0: *PxJointLinearLimitPair) -> void #foreign physx "PxPrismaticJoint_setLimit_mut"; + +PxPrismaticJoint_getLimit :: (self: *PxPrismaticJoint) -> PxJointLinearLimitPair #foreign physx; + +PxPrismaticJoint_setPrismaticJointFlags :: (self: *PxPrismaticJoint, flags: u16) -> void #foreign physx "PxPrismaticJoint_setPrismaticJointFlags_mut"; + +PxPrismaticJoint_setPrismaticJointFlag :: (self: *PxPrismaticJoint, flag: s32, value: bool) -> void #foreign physx "PxPrismaticJoint_setPrismaticJointFlag_mut"; + +PxPrismaticJoint_getPrismaticJointFlags :: (self: *PxPrismaticJoint) -> u16 #foreign physx; + +PxPrismaticJoint_getConcreteTypeName :: (self: *PxPrismaticJoint) -> *u8 #foreign physx; + +PxRevoluteJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxRevoluteJoint #foreign physx "phys_PxRevoluteJointCreate"; + +PxRevoluteJoint_getAngle :: (self: *PxRevoluteJoint) -> float #foreign physx; + +PxRevoluteJoint_getVelocity :: (self: *PxRevoluteJoint) -> float #foreign physx; + +PxRevoluteJoint_setLimit :: (self: *PxRevoluteJoint, limits: *PxJointAngularLimitPair) -> void #foreign physx "PxRevoluteJoint_setLimit_mut"; + +PxRevoluteJoint_getLimit :: (self: *PxRevoluteJoint) -> PxJointAngularLimitPair #foreign physx; + +PxRevoluteJoint_setDriveVelocity :: (self: *PxRevoluteJoint, velocity: float, autowake: bool) -> void #foreign physx "PxRevoluteJoint_setDriveVelocity_mut"; + +PxRevoluteJoint_getDriveVelocity :: (self: *PxRevoluteJoint) -> float #foreign physx; + +PxRevoluteJoint_setDriveForceLimit :: (self: *PxRevoluteJoint, limit: float) -> void #foreign physx "PxRevoluteJoint_setDriveForceLimit_mut"; + +PxRevoluteJoint_getDriveForceLimit :: (self: *PxRevoluteJoint) -> float #foreign physx; + +PxRevoluteJoint_setDriveGearRatio :: (self: *PxRevoluteJoint, ratio: float) -> void #foreign physx "PxRevoluteJoint_setDriveGearRatio_mut"; + +PxRevoluteJoint_getDriveGearRatio :: (self: *PxRevoluteJoint) -> float #foreign physx; + +PxRevoluteJoint_setRevoluteJointFlags :: (self: *PxRevoluteJoint, flags: u16) -> void #foreign physx "PxRevoluteJoint_setRevoluteJointFlags_mut"; + +PxRevoluteJoint_setRevoluteJointFlag :: (self: *PxRevoluteJoint, flag: s32, value: bool) -> void #foreign physx "PxRevoluteJoint_setRevoluteJointFlag_mut"; + +PxRevoluteJoint_getRevoluteJointFlags :: (self: *PxRevoluteJoint) -> u16 #foreign physx; + +PxRevoluteJoint_getConcreteTypeName :: (self: *PxRevoluteJoint) -> *u8 #foreign physx; + +PxSphericalJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxSphericalJoint #foreign physx "phys_PxSphericalJointCreate"; + +PxSphericalJoint_getLimitCone :: (self: *PxSphericalJoint) -> PxJointLimitCone #foreign physx; + +PxSphericalJoint_setLimitCone :: (self: *PxSphericalJoint, limit: *PxJointLimitCone) -> void #foreign physx "PxSphericalJoint_setLimitCone_mut"; + +PxSphericalJoint_getSwingYAngle :: (self: *PxSphericalJoint) -> float #foreign physx; + +PxSphericalJoint_getSwingZAngle :: (self: *PxSphericalJoint) -> float #foreign physx; + +PxSphericalJoint_setSphericalJointFlags :: (self: *PxSphericalJoint, flags: u16) -> void #foreign physx "PxSphericalJoint_setSphericalJointFlags_mut"; + +PxSphericalJoint_setSphericalJointFlag :: (self: *PxSphericalJoint, flag: s32, value: bool) -> void #foreign physx "PxSphericalJoint_setSphericalJointFlag_mut"; + +PxSphericalJoint_getSphericalJointFlags :: (self: *PxSphericalJoint) -> u16 #foreign physx; + +PxSphericalJoint_getConcreteTypeName :: (self: *PxSphericalJoint) -> *u8 #foreign physx; + +PxD6JointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxD6Joint #foreign physx "phys_PxD6JointCreate"; + +PxD6JointDrive_new :: () -> PxD6JointDrive #foreign physx; + +PxD6JointDrive_new :: (driveStiffness: float, driveDamping: float, driveForceLimit: float, isAcceleration: bool) -> PxD6JointDrive #foreign physx "PxD6JointDrive_new_1"; + +PxD6JointDrive_isValid :: (self: *PxD6JointDrive) -> bool #foreign physx; + +PxD6Joint_setMotion :: (self: *PxD6Joint, axis: s32, type: s32) -> void #foreign physx "PxD6Joint_setMotion_mut"; + +PxD6Joint_getMotion :: (self: *PxD6Joint, axis: s32) -> s32 #foreign physx; + +PxD6Joint_getTwistAngle :: (self: *PxD6Joint) -> float #foreign physx; + +PxD6Joint_getSwingYAngle :: (self: *PxD6Joint) -> float #foreign physx; + +PxD6Joint_getSwingZAngle :: (self: *PxD6Joint) -> float #foreign physx; + +PxD6Joint_setDistanceLimit :: (self: *PxD6Joint, limit: *PxJointLinearLimit) -> void #foreign physx "PxD6Joint_setDistanceLimit_mut"; + +PxD6Joint_getDistanceLimit :: (self: *PxD6Joint) -> PxJointLinearLimit #foreign physx; + +PxD6Joint_setLinearLimit :: (self: *PxD6Joint, axis: s32, limit: *PxJointLinearLimitPair) -> void #foreign physx "PxD6Joint_setLinearLimit_mut"; + +PxD6Joint_getLinearLimit :: (self: *PxD6Joint, axis: s32) -> PxJointLinearLimitPair #foreign physx; + +PxD6Joint_setTwistLimit :: (self: *PxD6Joint, limit: *PxJointAngularLimitPair) -> void #foreign physx "PxD6Joint_setTwistLimit_mut"; + +PxD6Joint_getTwistLimit :: (self: *PxD6Joint) -> PxJointAngularLimitPair #foreign physx; + +PxD6Joint_setSwingLimit :: (self: *PxD6Joint, limit: *PxJointLimitCone) -> void #foreign physx "PxD6Joint_setSwingLimit_mut"; + +PxD6Joint_getSwingLimit :: (self: *PxD6Joint) -> PxJointLimitCone #foreign physx; + +PxD6Joint_setPyramidSwingLimit :: (self: *PxD6Joint, limit: *PxJointLimitPyramid) -> void #foreign physx "PxD6Joint_setPyramidSwingLimit_mut"; + +PxD6Joint_getPyramidSwingLimit :: (self: *PxD6Joint) -> PxJointLimitPyramid #foreign physx; + +PxD6Joint_setDrive :: (self: *PxD6Joint, index: s32, drive: *PxD6JointDrive) -> void #foreign physx "PxD6Joint_setDrive_mut"; + +PxD6Joint_getDrive :: (self: *PxD6Joint, index: s32) -> PxD6JointDrive #foreign physx; + +PxD6Joint_setDrivePosition :: (self: *PxD6Joint, pose: *PxTransform, autowake: bool) -> void #foreign physx "PxD6Joint_setDrivePosition_mut"; + +PxD6Joint_getDrivePosition :: (self: *PxD6Joint) -> PxTransform #foreign physx; + +PxD6Joint_setDriveVelocity :: (self: *PxD6Joint, linear: *Vector3, angular: *Vector3, autowake: bool) -> void #foreign physx "PxD6Joint_setDriveVelocity_mut"; + +PxD6Joint_getDriveVelocity :: (self: *PxD6Joint, linear: *Vector3, angular: *Vector3) -> void #foreign physx; + +PxD6Joint_setProjectionLinearTolerance :: (self: *PxD6Joint, tolerance: float) -> void #foreign physx "PxD6Joint_setProjectionLinearTolerance_mut"; + +PxD6Joint_getProjectionLinearTolerance :: (self: *PxD6Joint) -> float #foreign physx; + +PxD6Joint_setProjectionAngularTolerance :: (self: *PxD6Joint, tolerance: float) -> void #foreign physx "PxD6Joint_setProjectionAngularTolerance_mut"; + +PxD6Joint_getProjectionAngularTolerance :: (self: *PxD6Joint) -> float #foreign physx; + +PxD6Joint_getConcreteTypeName :: (self: *PxD6Joint) -> *u8 #foreign physx; + +PxGearJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxGearJoint #foreign physx "phys_PxGearJointCreate"; + +PxGearJoint_setHinges :: (self: *PxGearJoint, hinge0: *PxBase, hinge1: *PxBase) -> bool #foreign physx "PxGearJoint_setHinges_mut"; + +PxGearJoint_setGearRatio :: (self: *PxGearJoint, ratio: float) -> void #foreign physx "PxGearJoint_setGearRatio_mut"; + +PxGearJoint_getGearRatio :: (self: *PxGearJoint) -> float #foreign physx; + +PxGearJoint_getConcreteTypeName :: (self: *PxGearJoint) -> *u8 #foreign physx; + +PxRackAndPinionJointCreate :: (physics: *PxPhysics, actor0: *PxRigidActor, localFrame0: *PxTransform, actor1: *PxRigidActor, localFrame1: *PxTransform) -> *PxRackAndPinionJoint #foreign physx "phys_PxRackAndPinionJointCreate"; + +PxRackAndPinionJoint_setJoints :: (self: *PxRackAndPinionJoint, hinge: *PxBase, prismatic: *PxBase) -> bool #foreign physx "PxRackAndPinionJoint_setJoints_mut"; + +PxRackAndPinionJoint_setRatio :: (self: *PxRackAndPinionJoint, ratio: float) -> void #foreign physx "PxRackAndPinionJoint_setRatio_mut"; + +PxRackAndPinionJoint_getRatio :: (self: *PxRackAndPinionJoint) -> float #foreign physx; + +PxRackAndPinionJoint_setData :: (self: *PxRackAndPinionJoint, nbRackTeeth: u32, nbPinionTeeth: u32, rackLength: float) -> bool #foreign physx "PxRackAndPinionJoint_setData_mut"; + +PxRackAndPinionJoint_getConcreteTypeName :: (self: *PxRackAndPinionJoint) -> *u8 #foreign physx; + +PxGroupsMask_new_alloc :: () -> *PxGroupsMask #foreign physx; + +PxGroupsMask_delete :: (self: *PxGroupsMask) -> void #foreign physx; + +PxDefaultSimulationFilterShader :: (attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, pairFlags: *u16, constantBlock: *void, constantBlockSize: u32) -> u16 #foreign physx "phys_PxDefaultSimulationFilterShader"; + +PxGetGroupCollisionFlag :: (group1: u16, group2: u16) -> bool #foreign physx "phys_PxGetGroupCollisionFlag"; + +PxSetGroupCollisionFlag :: (group1: u16, group2: u16, enable: bool) -> void #foreign physx "phys_PxSetGroupCollisionFlag"; + +PxGetGroup :: (actor: *PxActor) -> u16 #foreign physx "phys_PxGetGroup"; + +PxSetGroup :: (actor: *PxActor, collisionGroup: u16) -> void #foreign physx "phys_PxSetGroup"; + +PxGetFilterOps :: (op0: *s32, op1: *s32, op2: *s32) -> void #foreign physx "phys_PxGetFilterOps"; + +PxSetFilterOps :: (op0: *s32, op1: *s32, op2: *s32) -> void #foreign physx "phys_PxSetFilterOps"; + +PxGetFilterBool :: () -> bool #foreign physx "phys_PxGetFilterBool"; + +PxSetFilterBool :: (enable: bool) -> void #foreign physx "phys_PxSetFilterBool"; + +PxGetFilterConstants :: (c0: *PxGroupsMask, c1: *PxGroupsMask) -> void #foreign physx "phys_PxGetFilterConstants"; + +PxSetFilterConstants :: (c0: *PxGroupsMask, c1: *PxGroupsMask) -> void #foreign physx "phys_PxSetFilterConstants"; + +PxGetGroupsMask :: (actor: *PxActor) -> PxGroupsMask #foreign physx "phys_PxGetGroupsMask"; + +PxSetGroupsMask :: (actor: *PxActor, mask: *PxGroupsMask) -> void #foreign physx "phys_PxSetGroupsMask"; + +PxDefaultErrorCallback_new_alloc :: () -> *PxDefaultErrorCallback #foreign physx; + +PxDefaultErrorCallback_delete :: (self: *PxDefaultErrorCallback) -> void #foreign physx; + +PxDefaultErrorCallback_reportError :: (self: *PxDefaultErrorCallback, code: s32, message: *u8, file: *u8, line: s32) -> void #foreign physx "PxDefaultErrorCallback_reportError_mut"; + +PxRigidActorExt_createExclusiveShape :: (actor: *PxRigidActor, geometry: *PxGeometry, materials: **PxMaterial, materialCount: u16, shapeFlags: u8) -> *PxShape #foreign physx; + +PxRigidActorExt_createExclusiveShape :: (actor: *PxRigidActor, geometry: *PxGeometry, material: *PxMaterial, shapeFlags: u8) -> *PxShape #foreign physx "PxRigidActorExt_createExclusiveShape_1"; + +PxRigidActorExt_getRigidActorShapeLocalBoundsList :: (actor: *PxRigidActor, numBounds: *u32) -> *PxBounds3 #foreign physx; + +PxRigidActorExt_createBVHFromActor :: (physics: *PxPhysics, actor: *PxRigidActor) -> *PxBVH #foreign physx; + +PxMassProperties_new :: () -> PxMassProperties #foreign physx; + +PxMassProperties_new :: (m: float, inertiaT: *PxMat33, com: *Vector3) -> PxMassProperties #foreign physx "PxMassProperties_new_1"; + +PxMassProperties_new :: (geometry: *PxGeometry) -> PxMassProperties #foreign physx "PxMassProperties_new_2"; + +PxMassProperties_translate :: (self: *PxMassProperties, t: *Vector3) -> void #foreign physx "PxMassProperties_translate_mut"; + +PxMassProperties_getMassSpaceInertia :: (inertia: *PxMat33, massFrame: *Quaternion) -> Vector3 #foreign physx; + +PxMassProperties_translateInertia :: (inertia: *PxMat33, mass: float, t: *Vector3) -> PxMat33 #foreign physx; + +PxMassProperties_rotateInertia :: (inertia: *PxMat33, q: *Quaternion) -> PxMat33 #foreign physx; + +PxMassProperties_scaleInertia :: (inertia: *PxMat33, scaleRotation: *Quaternion, scale: *Vector3) -> PxMat33 #foreign physx; + +PxMassProperties_sum :: (props: *PxMassProperties, transforms: *PxTransform, count: u32) -> PxMassProperties #foreign physx; + +PxRigidBodyExt_updateMassAndInertia :: (body: *PxRigidBody, shapeDensities: *float, shapeDensityCount: u32, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign physx; + +PxRigidBodyExt_updateMassAndInertia :: (body: *PxRigidBody, density: float, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign physx "PxRigidBodyExt_updateMassAndInertia_1"; + +PxRigidBodyExt_setMassAndUpdateInertia :: (body: *PxRigidBody, shapeMasses: *float, shapeMassCount: u32, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign physx; + +PxRigidBodyExt_setMassAndUpdateInertia :: (body: *PxRigidBody, mass: float, massLocalPose: *Vector3, includeNonSimShapes: bool) -> bool #foreign physx "PxRigidBodyExt_setMassAndUpdateInertia_1"; + +PxRigidBodyExt_computeMassPropertiesFromShapes :: (shapes: **PxShape, shapeCount: u32) -> PxMassProperties #foreign physx; + +PxRigidBodyExt_addForceAtPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign physx; + +PxRigidBodyExt_addForceAtLocalPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign physx; + +PxRigidBodyExt_addLocalForceAtPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign physx; + +PxRigidBodyExt_addLocalForceAtLocalPos :: (body: *PxRigidBody, force: *Vector3, pos: *Vector3, mode: s32, wakeup: bool) -> void #foreign physx; + +PxRigidBodyExt_getVelocityAtPos :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign physx; + +PxRigidBodyExt_getLocalVelocityAtLocalPos :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign physx; + +PxRigidBodyExt_getVelocityAtOffset :: (body: *PxRigidBody, pos: *Vector3) -> Vector3 #foreign physx; + +PxRigidBodyExt_computeVelocityDeltaFromImpulse :: (body: *PxRigidBody, impulsiveForce: *Vector3, impulsiveTorque: *Vector3, deltaLinearVelocity: *Vector3, deltaAngularVelocity: *Vector3) -> void #foreign physx; + +PxRigidBodyExt_computeVelocityDeltaFromImpulse :: (body: *PxRigidBody, globalPose: *PxTransform, point: *Vector3, impulse: *Vector3, invMassScale: float, invInertiaScale: float, deltaLinearVelocity: *Vector3, deltaAngularVelocity: *Vector3) -> void #foreign physx "PxRigidBodyExt_computeVelocityDeltaFromImpulse_1"; + +PxRigidBodyExt_computeLinearAngularImpulse :: (body: *PxRigidBody, globalPose: *PxTransform, point: *Vector3, impulse: *Vector3, invMassScale: float, invInertiaScale: float, linearImpulse: *Vector3, angularImpulse: *Vector3) -> void #foreign physx; + +PxRigidBodyExt_linearSweepSingle :: (body: *PxRigidBody, scene: *PxScene, unitDir: *Vector3, distance: float, outputFlags: u16, closestHit: *PxSweepHit, shapeIndex: *u32, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign physx; + +PxRigidBodyExt_linearSweepMultiple :: (body: *PxRigidBody, scene: *PxScene, unitDir: *Vector3, distance: float, outputFlags: u16, touchHitBuffer: *PxSweepHit, touchHitShapeIndices: *u32, touchHitBufferSize: u32, block: *PxSweepHit, blockingShapeIndex: *s32, overflow: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> u32 #foreign physx; + +PxShapeExt_getGlobalPose :: (shape: *PxShape, actor: *PxRigidActor) -> PxTransform #foreign physx; + +PxShapeExt_raycast :: (shape: *PxShape, actor: *PxRigidActor, rayOrigin: *Vector3, rayDir: *Vector3, maxDist: float, hitFlags: u16, maxHits: u32, rayHits: *PxRaycastHit) -> u32 #foreign physx; + +PxShapeExt_overlap :: (shape: *PxShape, actor: *PxRigidActor, otherGeom: *PxGeometry, otherGeomPose: *PxTransform) -> bool #foreign physx; + +PxShapeExt_sweep :: (shape: *PxShape, actor: *PxRigidActor, unitDir: *Vector3, distance: float, otherGeom: *PxGeometry, otherGeomPose: *PxTransform, sweepHit: *PxSweepHit, hitFlags: u16) -> bool #foreign physx; + +PxShapeExt_getWorldBounds :: (shape: *PxShape, actor: *PxRigidActor, inflation: float) -> PxBounds3 #foreign physx; + +PxMeshOverlapUtil_new_alloc :: () -> *PxMeshOverlapUtil #foreign physx; + +PxMeshOverlapUtil_delete :: (self: *PxMeshOverlapUtil) -> void #foreign physx; + +PxMeshOverlapUtil_findOverlap :: (self: *PxMeshOverlapUtil, geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform) -> u32 #foreign physx "PxMeshOverlapUtil_findOverlap_mut"; + +PxMeshOverlapUtil_findOverlap_mut :: (self: *PxMeshOverlapUtil, geom: *PxGeometry, geomPose: *PxTransform, hfGeom: *PxHeightFieldGeometry, hfPose: *PxTransform) -> u32 #foreign physx "PxMeshOverlapUtil_findOverlap_mut_1"; + +PxMeshOverlapUtil_getResults :: (self: *PxMeshOverlapUtil) -> *u32 #foreign physx; + +PxMeshOverlapUtil_getNbResults :: (self: *PxMeshOverlapUtil) -> u32 #foreign physx; + +PxComputeTriangleMeshPenetration :: (direction: *Vector3, depth: *float, geom: *PxGeometry, geomPose: *PxTransform, meshGeom: *PxTriangleMeshGeometry, meshPose: *PxTransform, maxIter: u32, usedIter: *u32) -> bool #foreign physx "phys_PxComputeTriangleMeshPenetration"; + +PxComputeHeightFieldPenetration :: (direction: *Vector3, depth: *float, geom: *PxGeometry, geomPose: *PxTransform, heightFieldGeom: *PxHeightFieldGeometry, heightFieldPose: *PxTransform, maxIter: u32, usedIter: *u32) -> bool #foreign physx "phys_PxComputeHeightFieldPenetration"; + +PxXmlMiscParameter_new :: () -> PxXmlMiscParameter #foreign physx; + +PxXmlMiscParameter_new :: (inUpVector: *Vector3, inScale: PxTolerancesScale) -> PxXmlMiscParameter #foreign physx "PxXmlMiscParameter_new_1"; + +PxSerialization_isSerializable :: (collection: *PxCollection, sr: *PxSerializationRegistry, externalReferences: *PxCollection) -> bool #foreign physx; + +PxSerialization_complete :: (collection: *PxCollection, sr: *PxSerializationRegistry, exceptFor: *PxCollection, followJoints: bool) -> void #foreign physx; + +PxSerialization_createSerialObjectIds :: (collection: *PxCollection, base: u64) -> void #foreign physx; + +PxSerialization_createCollectionFromXml :: (inputData: *PxInputData, cooking: *PxCooking, sr: *PxSerializationRegistry, externalRefs: *PxCollection, stringTable: *PxStringTable, outArgs: *PxXmlMiscParameter) -> *PxCollection #foreign physx; + +PxSerialization_createCollectionFromBinary :: (memBlock: *void, sr: *PxSerializationRegistry, externalRefs: *PxCollection) -> *PxCollection #foreign physx; + +PxSerialization_serializeCollectionToXml :: (outputStream: *PxOutputStream, collection: *PxCollection, sr: *PxSerializationRegistry, cooking: *PxCooking, externalRefs: *PxCollection, inArgs: *PxXmlMiscParameter) -> bool #foreign physx; + +PxSerialization_serializeCollectionToBinary :: (outputStream: *PxOutputStream, collection: *PxCollection, sr: *PxSerializationRegistry, externalRefs: *PxCollection, exportNames: bool) -> bool #foreign physx; + +PxSerialization_createSerializationRegistry :: (physics: *PxPhysics) -> *PxSerializationRegistry #foreign physx; + +PxDefaultCpuDispatcher_release :: (self: *PxDefaultCpuDispatcher) -> void #foreign physx "PxDefaultCpuDispatcher_release_mut"; + +PxDefaultCpuDispatcher_setRunProfiled :: (self: *PxDefaultCpuDispatcher, runProfiled: bool) -> void #foreign physx "PxDefaultCpuDispatcher_setRunProfiled_mut"; + +PxDefaultCpuDispatcher_getRunProfiled :: (self: *PxDefaultCpuDispatcher) -> bool #foreign physx; + +PxDefaultCpuDispatcherCreate :: (numThreads: u32, affinityMasks: *u32 = null, mode: s32 = 0, yieldProcessorCount: u32 = 0) -> *PxDefaultCpuDispatcher #foreign physx "phys_PxDefaultCpuDispatcherCreate"; + +PxBuildSmoothNormals :: (nbTris: u32, nbVerts: u32, verts: *Vector3, dFaces: *u32, wFaces: *u16, normals: *Vector3, flip: bool) -> bool #foreign physx "phys_PxBuildSmoothNormals"; + +PxCreateDynamic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, density: float, shapeOffset: *PxTransform) -> *PxRigidDynamic #foreign physx "phys_PxCreateDynamic"; + +PxCreateDynamic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape, density: float) -> *PxRigidDynamic #foreign physx "phys_PxCreateDynamic_1"; + +PxCreateKinematic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, density: float, shapeOffset: *PxTransform) -> *PxRigidDynamic #foreign physx "phys_PxCreateKinematic"; + +PxCreateKinematic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape, density: float) -> *PxRigidDynamic #foreign physx "phys_PxCreateKinematic_1"; + +PxCreateStatic :: (sdk: *PxPhysics, transform: *PxTransform, geometry: *PxGeometry, material: *PxMaterial, shapeOffset: *PxTransform) -> *PxRigidStatic #foreign physx "phys_PxCreateStatic"; + +PxCreateStatic_1 :: (sdk: *PxPhysics, transform: *PxTransform, shape: *PxShape) -> *PxRigidStatic #foreign physx "phys_PxCreateStatic_1"; + +PxCloneShape :: (physicsSDK: *PxPhysics, shape: *PxShape, isExclusive: bool) -> *PxShape #foreign physx "phys_PxCloneShape"; + +PxCloneStatic :: (physicsSDK: *PxPhysics, transform: *PxTransform, actor: *PxRigidActor) -> *PxRigidStatic #foreign physx "phys_PxCloneStatic"; + +PxCloneDynamic :: (physicsSDK: *PxPhysics, transform: *PxTransform, body: *PxRigidDynamic) -> *PxRigidDynamic #foreign physx "phys_PxCloneDynamic"; + +PxCreatePlane :: (sdk: *PxPhysics, plane: *Plane3, material: *PxMaterial) -> *PxRigidStatic #foreign physx "phys_PxCreatePlane"; + +PxScaleRigidActor :: (actor: *PxRigidActor, scale: float, scaleMassProps: bool) -> void #foreign physx "phys_PxScaleRigidActor"; + +PxStringTableExt_createStringTable :: (inAllocator: *PxAllocatorCallback) -> *PxStringTable #foreign physx; + +PxBroadPhaseExt_createRegionsFromWorldBounds :: (regions: *PxBounds3, globalBounds: *PxBounds3, nbSubdiv: u32, upAxis: u32) -> u32 #foreign physx; + +PxSceneQueryExt_raycastAny :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, hit: *PxQueryHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> bool #foreign physx; + +PxSceneQueryExt_raycastSingle :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, outputFlags: u16, hit: *PxRaycastHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> bool #foreign physx; + +PxSceneQueryExt_raycastMultiple :: (scene: *PxScene, origin: *Vector3, unitDir: *Vector3, distance: float, outputFlags: u16, hitBuffer: *PxRaycastHit, hitBufferSize: u32, blockingHit: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache) -> s32 #foreign physx; + +PxSceneQueryExt_sweepAny :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, queryFlags: u16, hit: *PxQueryHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign physx; + +PxSceneQueryExt_sweepSingle :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, outputFlags: u16, hit: *PxSweepHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> bool #foreign physx; + +PxSceneQueryExt_sweepMultiple :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, outputFlags: u16, hitBuffer: *PxSweepHit, hitBufferSize: u32, blockingHit: *bool, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback, cache: *PxQueryCache, inflation: float) -> s32 #foreign physx; + +PxSceneQueryExt_overlapMultiple :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, hitBuffer: *PxOverlapHit, hitBufferSize: u32, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> s32 #foreign physx; + +PxSceneQueryExt_overlapAny :: (scene: *PxScene, geometry: *PxGeometry, pose: *PxTransform, hit: *PxOverlapHit, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> bool #foreign physx; + +PxBatchQueryExt_release :: (self: *PxBatchQueryExt) -> void #foreign physx "PxBatchQueryExt_release_mut"; + +PxBatchQueryExt_raycast :: (self: *PxBatchQueryExt, origin: *Vector3, unitDir: *Vector3, distance: float, maxNbTouches: u16, hitFlags: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache) -> *PxRaycastBuffer #foreign physx "PxBatchQueryExt_raycast_mut"; + +PxBatchQueryExt_sweep :: (self: *PxBatchQueryExt, geometry: *PxGeometry, pose: *PxTransform, unitDir: *Vector3, distance: float, maxNbTouches: u16, hitFlags: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache, inflation: float) -> *PxSweepBuffer #foreign physx "PxBatchQueryExt_sweep_mut"; + +PxBatchQueryExt_overlap :: (self: *PxBatchQueryExt, geometry: *PxGeometry, pose: *PxTransform, maxNbTouches: u16, filterData: *PxQueryFilterData, cache: *PxQueryCache) -> *PxOverlapBuffer #foreign physx "PxBatchQueryExt_overlap_mut"; + +PxBatchQueryExt_execute :: (self: *PxBatchQueryExt) -> void #foreign physx "PxBatchQueryExt_execute_mut"; + +PxCreateBatchQueryExt :: (scene: *PxScene, queryFilterCallback: *PxQueryFilterCallback, maxNbRaycasts: u32, maxNbRaycastTouches: u32, maxNbSweeps: u32, maxNbSweepTouches: u32, maxNbOverlaps: u32, maxNbOverlapTouches: u32) -> *PxBatchQueryExt #foreign physx "phys_PxCreateBatchQueryExt"; + +PxCreateBatchQueryExt_1 :: (scene: *PxScene, queryFilterCallback: *PxQueryFilterCallback, raycastBuffers: *PxRaycastBuffer, maxNbRaycasts: u32, raycastTouches: *PxRaycastHit, maxNbRaycastTouches: u32, sweepBuffers: *PxSweepBuffer, maxNbSweeps: u32, sweepTouches: *PxSweepHit, maxNbSweepTouches: u32, overlapBuffers: *PxOverlapBuffer, maxNbOverlaps: u32, overlapTouches: *PxOverlapHit, maxNbOverlapTouches: u32) -> *PxBatchQueryExt #foreign physx "phys_PxCreateBatchQueryExt_1"; + +PxCreateExternalSceneQuerySystem :: (desc: *PxSceneQueryDesc, contextID: u64) -> *PxSceneQuerySystem #foreign physx "phys_PxCreateExternalSceneQuerySystem"; + +PxCustomSceneQuerySystem_addPruner :: (self: *PxCustomSceneQuerySystem, primaryType: s32, secondaryType: s32, preallocated: u32) -> u32 #foreign physx "PxCustomSceneQuerySystem_addPruner_mut"; + +PxCustomSceneQuerySystem_startCustomBuildstep :: (self: *PxCustomSceneQuerySystem) -> u32 #foreign physx "PxCustomSceneQuerySystem_startCustomBuildstep_mut"; + +PxCustomSceneQuerySystem_customBuildstep :: (self: *PxCustomSceneQuerySystem, index: u32) -> void #foreign physx "PxCustomSceneQuerySystem_customBuildstep_mut"; + +PxCustomSceneQuerySystem_finishCustomBuildstep :: (self: *PxCustomSceneQuerySystem) -> void #foreign physx "PxCustomSceneQuerySystem_finishCustomBuildstep_mut"; + +PxCustomSceneQuerySystemAdapter_delete :: (self: *PxCustomSceneQuerySystemAdapter) -> void #foreign physx; + +PxCustomSceneQuerySystemAdapter_getPrunerIndex :: (self: *PxCustomSceneQuerySystemAdapter, actor: *PxRigidActor, shape: *PxShape) -> u32 #foreign physx; + +PxCustomSceneQuerySystemAdapter_processPruner :: (self: *PxCustomSceneQuerySystemAdapter, prunerIndex: u32, context_pod: *PxQueryThreadContext, filterData: *PxQueryFilterData, filterCall: *PxQueryFilterCallback) -> bool #foreign physx; + +PxCreateCustomSceneQuerySystem :: (sceneQueryUpdateMode: s32, contextID: u64, adapter: *PxCustomSceneQuerySystemAdapter, usesTreeOfPruners: bool) -> *PxCustomSceneQuerySystem #foreign physx "phys_PxCreateCustomSceneQuerySystem"; + +PxFindFaceIndex :: (convexGeom: *PxConvexMeshGeometry, geomPose: *PxTransform, impactPos: *Vector3, unitDir: *Vector3) -> u32 #foreign physx "phys_PxFindFaceIndex"; + +PxPoissonSampler_setSamplingRadius :: (self: *PxPoissonSampler, samplingRadius: float) -> bool #foreign physx "PxPoissonSampler_setSamplingRadius_mut"; + +PxPoissonSampler_addSamplesInSphere :: (self: *PxPoissonSampler, sphereCenter: *Vector3, sphereRadius: float, createVolumeSamples: bool) -> void #foreign physx "PxPoissonSampler_addSamplesInSphere_mut"; + +PxPoissonSampler_addSamplesInBox :: (self: *PxPoissonSampler, axisAlignedBox: *PxBounds3, boxOrientation: *Quaternion, createVolumeSamples: bool) -> void #foreign physx "PxPoissonSampler_addSamplesInBox_mut"; + +PxPoissonSampler_delete :: (self: *PxPoissonSampler) -> void #foreign physx; + +PxCreateShapeSampler :: (geometry: *PxGeometry, transform: *PxTransform, worldBounds: *PxBounds3, initialSamplingRadius: float, numSampleAttemptsAroundPoint: s32) -> *PxPoissonSampler #foreign physx "phys_PxCreateShapeSampler"; + +PxTriangleMeshPoissonSampler_isPointInTriangleMesh :: (self: *PxTriangleMeshPoissonSampler, p: *Vector3) -> bool #foreign physx "PxTriangleMeshPoissonSampler_isPointInTriangleMesh_mut"; + +PxTriangleMeshPoissonSampler_delete :: (self: *PxTriangleMeshPoissonSampler) -> void #foreign physx; + +PxCreateTriangleMeshSampler :: (triangles: *u32, numTriangles: u32, vertices: *Vector3, numVertices: u32, initialSamplingRadius: float, numSampleAttemptsAroundPoint: s32) -> *PxTriangleMeshPoissonSampler #foreign physx "phys_PxCreateTriangleMeshSampler"; + +PxTetrahedronMeshExt_findTetrahedronContainingPoint :: (mesh: *PxTetrahedronMesh, point: *Vector3, bary: *Vector4, tolerance: float) -> s32 #foreign physx; + +PxTetrahedronMeshExt_findTetrahedronClosestToPoint :: (mesh: *PxTetrahedronMesh, point: *Vector3, bary: *Vector4) -> s32 #foreign physx; + +PxInitExtensions :: (physics: *PxPhysics, pvd: *PxPvd) -> bool #foreign physx "phys_PxInitExtensions"; + +PxCloseExtensions :: () -> void #foreign physx "phys_PxCloseExtensions"; + +PxRepXObject_new :: (inTypeName: *u8, inSerializable: *void, inId: u64) -> PxRepXObject #foreign physx; + +PxRepXObject_isValid :: (self: *PxRepXObject) -> bool #foreign physx; + +PxRepXInstantiationArgs_new :: (inPhysics: *PxPhysics, inCooking: *PxCooking, inStringTable: *PxStringTable) -> PxRepXInstantiationArgs #foreign physx; + +PxRepXSerializer_getTypeName :: (self: *PxRepXSerializer) -> *u8 #foreign physx "PxRepXSerializer_getTypeName_mut"; + +PxRepXSerializer_objectToFile :: (self: *PxRepXSerializer, inLiveObject: *PxRepXObject, inCollection: *PxCollection, inWriter: *XmlWriter, inTempBuffer: *MemoryBuffer, inArgs: *PxRepXInstantiationArgs) -> void #foreign physx "PxRepXSerializer_objectToFile_mut"; + +PxRepXSerializer_fileToObject :: (self: *PxRepXSerializer, inReader: *XmlReader, inAllocator: *XmlMemoryAllocator, inArgs: *PxRepXInstantiationArgs, inCollection: *PxCollection) -> PxRepXObject #foreign physx "PxRepXSerializer_fileToObject_mut"; + +PxPvd_connect :: (self: *PxPvd, transport: *PxPvdTransport, flags: u8) -> bool #foreign physx "PxPvd_connect_mut"; + +PxPvd_disconnect :: (self: *PxPvd) -> void #foreign physx "PxPvd_disconnect_mut"; + +PxPvd_isConnected :: (self: *PxPvd, useCachedStatus: bool) -> bool #foreign physx "PxPvd_isConnected_mut"; + +PxPvd_getTransport :: (self: *PxPvd) -> *PxPvdTransport #foreign physx "PxPvd_getTransport_mut"; + +PxPvd_getInstrumentationFlags :: (self: *PxPvd) -> u8 #foreign physx "PxPvd_getInstrumentationFlags_mut"; + +PxPvd_release :: (self: *PxPvd) -> void #foreign physx "PxPvd_release_mut"; + +PxCreatePvd :: (foundation: *PxFoundation) -> *PxPvd #foreign physx "phys_PxCreatePvd"; + +PxPvdTransport_connect :: (self: *PxPvdTransport) -> bool #foreign physx "PxPvdTransport_connect_mut"; + +PxPvdTransport_disconnect :: (self: *PxPvdTransport) -> void #foreign physx "PxPvdTransport_disconnect_mut"; + +PxPvdTransport_isConnected :: (self: *PxPvdTransport) -> bool #foreign physx "PxPvdTransport_isConnected_mut"; + +PxPvdTransport_write :: (self: *PxPvdTransport, inBytes: *u8, inLength: u32) -> bool #foreign physx "PxPvdTransport_write_mut"; + +PxPvdTransport_lock :: (self: *PxPvdTransport) -> *PxPvdTransport #foreign physx "PxPvdTransport_lock_mut"; + +PxPvdTransport_unlock :: (self: *PxPvdTransport) -> void #foreign physx "PxPvdTransport_unlock_mut"; + +PxPvdTransport_flush :: (self: *PxPvdTransport) -> void #foreign physx "PxPvdTransport_flush_mut"; + +PxPvdTransport_getWrittenDataSize :: (self: *PxPvdTransport) -> u64 #foreign physx "PxPvdTransport_getWrittenDataSize_mut"; + +PxPvdTransport_release :: (self: *PxPvdTransport) -> void #foreign physx "PxPvdTransport_release_mut"; + +PxDefaultPvdSocketTransportCreate :: (host: *u8, port: s32, timeoutInMilliseconds: u32) -> *PxPvdTransport #foreign physx "phys_PxDefaultPvdSocketTransportCreate"; + +PxDefaultPvdFileTransportCreate :: (name: *u8) -> *PxPvdTransport #foreign physx "phys_PxDefaultPvdFileTransportCreate"; + +CollisionCallback :: #type (unknown0: *void, unknown1: *PxContactPairHeader, unknown2: *PxContactPair, unknown3: u32) -> void #c_call; + +SimulationFilterShader :: #type (attributes0: *u32, filterData0: *PxFilterData, attributes1: *u32, filterData1: *PxFilterData, pairFlags: *PxPairFlags) -> u16 #c_call; + +FilterShaderHandle :: struct { + shader: SimulationFilterShader; +} + +PxPvdInstrumentationFlags :: enum_flags u8 { + DEBUG :: 1 << 0; + PROFILE :: 1 << 1; + MEMORY :: 1 << 2; + ALL :: DEBUG | PROFILE | MEMORY; + } + +TriggerCallback :: #type (unknown0: *void, unknown1: *PxTriggerPair, unknown2: u32) -> void #c_call; +ConstraintBreakCallback :: #type (unknown0: *void, unknown1: *PxConstraintInfo, unknown2: u32) -> void #c_call; +WakeSleepCallback :: #type (unknown0: *void, unknown1: **PxActor, unknown2: u32, unknown3: bool) -> void #c_call; +AdvanceCallback :: #type (unknown0: *void, unknown1: **PxRigidBody, unknown2: *PxTransform, unknown3: u32) -> void #c_call; + +SimulationEventCallbackInfo :: struct { + // Callback for collision events. + collisionCallback: CollisionCallback = null; + collisionUserData: *void = null; + + // Callback for trigger shape events (an object entered or left a trigger shape). + triggerCallback: TriggerCallback = null; + triggerUserData: *void = null; + + // Callback for when a constraint breaks (such as a joint with a force limit) + constraintBreakCallback: ConstraintBreakCallback = null; + constraintBreakUserData: *void = null; + + // Callback for when an object falls asleep or is awoken. + wakeSleepCallback: WakeSleepCallback = null; + wakeSleepUserData: *void = null; + + // Callback to get the next pose early for objects (if flagged with eENABLE_POSE_INTEGRATION_PREVIEW). + advanceCallback: AdvanceCallback = null; + advanceUserData: *void = null; +} + +RaycastHitCallback :: #type (actor: *PxRigidActor, filterData: *PxFilterData, shape: *PxShape, hitFlags: u32, userData: *void) -> s32 #c_call; +PostFilterCallback :: #type (filterData: *PxFilterData, hit: *PxQueryHit, userData: *void) -> s32 #c_call; + +RaycastHitProcessTouchesCallback :: #type (buffer: *PxRaycastHit, nbHits: u32, userdata: *void) -> bool #c_call; +SweepHitProcessTouchesCallback :: #type (buffer: *PxSweepHit, nbHits: u32, userdata: *void) -> bool #c_call; +OverlapHitProcessTouchesCallback :: #type (buffer: *PxOverlapHit, nbHits: u32, userdata: *void) -> bool #c_call; +HitFinalizeQueryCallback :: #type (userdata: *void) -> void #c_call; + +AllocCallback :: #type (size: u64, typeName: *u8, filename: *u8, line: s32, userdata: *void) -> *void #c_call; +DeallocCallback :: #type (ptr: *void, userdata: *void) -> void #c_call; + +ZoneStartCallback :: #type (typeName: *u8, detached: bool, _context_pod: u64, userdata: *void) -> *void #c_call; +ZoneEndCallback :: #type (profilerData: *void, typeName: *u8, detached: bool, _context_pod: u64, userdata: *void) -> void #c_call; + +ErrorCallback :: #type (code: s32, message: *u8, file: *u8, line: s32, userdata: *void) -> void #c_call; + +AssertHandler :: #type (expr: *u8, file: *u8, line: s32, should_ignore: *bool, userdata: *void) -> void #c_call; + +ShapeHitCallback :: #type (unknown0: *void, unknown1: *PxControllerShapeHit) -> void #c_call; +ControllerHitCallback :: #type (unknown0: *void, unknown1: *PxControllersHit) -> void #c_call; +ObstacleHitCallback :: #type (unknown0: *void, unknown1: *PxControllerObstacleHit) -> void #c_call; + +UserControllerHitReportInfo :: struct { + shapeHitCallback: ShapeHitCallback = null; + shapeHitUserData: *void = null; + controllerHitCallback: ControllerHitCallback = null; + controllerHitUserData: *void = null; + obstacleHitCallback: ObstacleHitCallback = null; + obstacleHitUserData: *void = null; +} + +ShapeBehaviorCallback :: #type (data: *void, shape: *PxShape, actor: *PxActor) -> PxControllerBehaviorFlags #c_call; +CharacterBehaviorCallback :: #type (data: *void, controller: *PxController) -> PxControllerBehaviorFlags #c_call; +ObstacleBehaviorCallback :: #type (data: *void, obstacle: *PxObstacle) -> PxControllerBehaviorFlags #c_call; + +ControllerBehaviorCallbackInfo :: struct { + shapeBehaviorCallback: ShapeBehaviorCallback = null; + shapeBehaviorUserData: *void = null; + controllerBehaviorCallback: CharacterBehaviorCallback = null; + controllerBehaviorUserData: *void = null; + obstacleBehaviorCallback: ObstacleBehaviorCallback = null; + obstacleBehaviorUserData: *void = null; +} + +OnContactModify :: #type (data: *void, pairs: *PxContactModifyPair, count: u32) -> void #c_call; + +ContactModifyCallbackInfo :: struct { + onContactModify: OnContactModify = null; + onContactModifyUserData: *void = null; +} + +create_foundation :: () -> *PxFoundation #foreign physx "physx_create_foundation"; + +create_foundation_with_alloc :: (allocator: *PxAllocatorCallback) -> *PxFoundation #foreign physx "physx_create_foundation_with_alloc"; + +// fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages +// linking against the raw interface +get_default_allocator :: () -> *PxAllocatorCallback #foreign physx; + +// fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages +// linking against the raw interface +get_default_error_callback :: () -> *PxErrorCallback #foreign physx; + +create_physics :: (foundation: *PxFoundation) -> *PxPhysics #foreign physx "physx_create_physics"; + +create_raycast_filter_callback :: (actor_to_ignore: *PxRigidActor) -> *PxQueryFilterCallback #foreign physx; + +destroy_raycast_filter_callback :: (callback: *PxQueryFilterCallback) -> void #foreign physx; + +create_raycast_filter_callback_func :: (callback: RaycastHitCallback, userData: *void) -> *PxQueryFilterCallback #foreign physx; + +destroy_raycast_filter_callback_func :: (callback: *PxQueryFilterCallback) -> void #foreign physx; + +create_pre_and_post_raycast_filter_callback_func :: (preFilter: RaycastHitCallback, postFilter: PostFilterCallback, userData: *void) -> *PxQueryFilterCallback #foreign physx; + +destroy_pre_and_post_raycast_filter_callback_func :: (callback: *PxQueryFilterCallback) -> void #foreign physx; + +create_raycast_buffer :: () -> *PxRaycastCallback #foreign physx; + +create_sweep_buffer :: () -> *PxSweepCallback #foreign physx; + +create_overlap_buffer :: () -> *PxOverlapCallback #foreign physx; + +create_raycast_callback :: (process_touches_callback: RaycastHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxRaycastHit, numTouches: u32, userdata: *void) -> *PxRaycastCallback #foreign physx; + +delete_raycast_callback :: (callback: *PxRaycastCallback) -> void #foreign physx; + +delete_sweep_callback :: (callback: *PxSweepCallback) -> void #foreign physx; + +delete_overlap_callback :: (callback: *PxOverlapCallback) -> void #foreign physx; + +create_sweep_callback :: (process_touches_callback: SweepHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxSweepHit, numTouches: u32, userdata: *void) -> *PxSweepCallback #foreign physx; + +create_overlap_callback :: (process_touches_callback: OverlapHitProcessTouchesCallback, finalize_query_callback: HitFinalizeQueryCallback, touchesBuffer: *PxOverlapHit, numTouches: u32, userdata: *void) -> *PxOverlapCallback #foreign physx; + +create_alloc_callback :: (alloc_callback: AllocCallback, dealloc_callback: DeallocCallback, userdata: *void) -> *PxAllocatorCallback #foreign physx; + +get_alloc_callback_user_data :: (allocator: *PxAllocatorCallback) -> *void #foreign physx; + +create_profiler_callback :: (zone_start_callback: ZoneStartCallback, zone_end_callback: ZoneEndCallback, userdata: *void) -> *PxProfilerCallback #foreign physx; + +create_error_callback :: (error_callback: ErrorCallback, userdata: *void) -> *PxErrorCallback #foreign physx; + +create_assert_handler :: (on_assert: AssertHandler, userdata: *void) -> *PxAssertHandler #foreign physx; + +// simulation event +create_simulation_event_callbacks :: (callbacks: *SimulationEventCallbackInfo) -> *PxSimulationEventCallback #foreign physx; + +get_simulation_event_info :: (callback: *PxSimulationEventCallback) -> *SimulationEventCallbackInfo #foreign physx; + +destroy_simulation_event_callbacks :: (callback: *PxSimulationEventCallback) -> void #foreign physx; + +// hit report +create_user_controller_hit_report :: (callbacks: *UserControllerHitReportInfo) -> *PxUserControllerHitReport #foreign physx; + +get_user_controller_hit_info :: (callback: *PxUserControllerHitReport) -> *UserControllerHitReportInfo #foreign physx; + +destroy_user_controller_hit_report :: (callback: *PxUserControllerHitReport) -> void #foreign physx; + +// controller behavior +create_controller_behavior_callbacks :: (callbacks: *ControllerBehaviorCallbackInfo) -> *PxControllerBehaviorCallback #foreign physx; + +get_controller_behavior_info :: (callback: *PxControllerBehaviorCallback) -> *ControllerBehaviorCallbackInfo #foreign physx; + +destroy_controller_behavior_callbacks :: (callback: *PxControllerBehaviorCallback) -> void #foreign physx; + +// contact modify +create_contact_modify_callbacks :: (callbacks: *ContactModifyCallbackInfo) -> *PxContactModifyCallback #foreign physx; + +get_contact_modify_info :: (callback: *PxContactModifyCallback) -> *ContactModifyCallbackInfo #foreign physx; + +destroy_contact_modify_callbacks :: (callback: *PxContactModifyCallback) -> void #foreign physx; + +// ccd contact modify +create_ccd_contact_modify_callbacks :: (callbacks: *ContactModifyCallbackInfo) -> *PxCCDContactModifyCallback #foreign physx; + +get_ccd_contact_modify_info :: (callback: *PxCCDContactModifyCallback) -> *ContactModifyCallbackInfo #foreign physx; + +destroy_ccd_contact_modify_callbacks :: (callback: *PxCCDContactModifyCallback) -> void #foreign physx; + +// filter shader +get_default_simulation_filter_shader :: () -> SimulationFilterShader #foreign physx; + +set_default_filter_shader :: (desc: *PxSceneDesc) -> void #foreign physx; + +create_custom_filter_shader :: (filter: SimulationFilterShader) -> *FilterShaderHandle #foreign physx; + +destroy_custom_filter_shader :: (filterHandle: *FilterShaderHandle) -> void #foreign physx; + +set_custom_filter_shader :: (desc: *PxSceneDesc, filterHandle: *FilterShaderHandle) -> void #foreign physx; + +set_custom_filter_shader_with_default :: (desc: *PxSceneDesc, filterHandle: *FilterShaderHandle) -> void #foreign physx; + +// Not generated, used only for testing and examples! +PxAssertHandler_opCall :: (self: *PxErrorCallback, expr: *u8, file: *u8, line: s32, ignore: *bool) -> void #foreign physx "PxAssertHandler_opCall_mut"; + +PX_PHYSICS_VERSION_MAJOR :: 5; +PX_PHYSICS_VERSION_MINOR :: 1; +PX_PHYSICS_VERSION_BUGFIX :: 3; +PX_PHYSICS_VERSION :: ((PX_PHYSICS_VERSION_MAJOR<<24) + (PX_PHYSICS_VERSION_MINOR<<16) + (PX_PHYSICS_VERSION_BUGFIX<<8) + 0); + +#scope_file + +physx :: #library "windows/physx"; +#import "Math"; +#import "Socket"; diff --git a/modules/PhysX/physx/linux/structgen_out.hpp b/modules/PhysX/physx/linux/structgen_out.hpp new file mode 100644 index 0000000..def618b --- /dev/null +++ b/modules/PhysX/physx/linux/structgen_out.hpp @@ -0,0 +1,2075 @@ +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_PxAllocatorCallback_Pod { + void* vtable_; +}; +struct physx_PxAssertHandler_Pod { + void* vtable_; +}; +struct physx_PxAllocationListener_Pod; +struct physx_PxFoundation_Pod { + void* vtable_; +}; +struct physx_PxProfilerCallback_Pod; +struct physx_PxAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRawAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxVirtualAllocatorCallback_Pod { + void* vtable_; +}; +struct physx_PxVirtualAllocator_Pod { + char structgen_pad0[16]; +}; +struct physx_PxUserAllocated_Pod { + char structgen_pad0[1]; +}; +union physx_PxTempAllocatorChunk_Pod { + physx_PxTempAllocatorChunk_Pod* mNext; + uint32_t mIndex; + uint8_t mPad[16]; +}; +struct physx_PxTempAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxLogTwo_Pod; +struct physx_PxUnConst_Pod; +struct physx_PxBitAndByte_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBitMap_Pod { + char structgen_pad0[16]; +}; +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_PxMat33_Pod { + physx_PxVec3_Pod column0; + physx_PxVec3_Pod column1; + physx_PxVec3_Pod column2; +}; +struct physx_PxBounds3_Pod { + physx_PxVec3_Pod minimum; + physx_PxVec3_Pod maximum; +}; +struct physx_PxErrorCallback_Pod { + void* vtable_; +}; +struct physx_PxAllocationListener_Pod { + void* vtable_; +}; +struct physx_PxBroadcastingAllocator_Pod { + char structgen_pad0[176]; +}; +struct physx_PxBroadcastingErrorCallback_Pod { + char structgen_pad0[160]; +}; +struct physx_PxHash_Pod; +struct physx_PxInputStream_Pod { + void* vtable_; +}; +struct physx_PxInputData_Pod { + void* vtable_; +}; +struct physx_PxOutputStream_Pod { + void* vtable_; +}; +struct physx_PxVec4_Pod { + float x; + float y; + float z; + float w; +}; +struct physx_PxMat44_Pod { + physx_PxVec4_Pod column0; + physx_PxVec4_Pod column1; + physx_PxVec4_Pod column2; + physx_PxVec4_Pod column3; +}; +struct physx_PxPlane_Pod { + physx_PxVec3_Pod n; + float d; +}; +struct physx_Interpolation_Pod { + char structgen_pad0[1]; +}; +struct physx_PxMutexImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxReadWriteLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxProfilerCallback_Pod { + void* vtable_; +}; +struct physx_PxProfileScoped_Pod { + physx_PxProfilerCallback_Pod* mCallback; + char const* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; + char structgen_pad0[7]; +}; +struct physx_PxSListEntry_Pod { + char structgen_pad0[16]; +}; +struct physx_PxSListImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSyncImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRunnable_Pod { + void* vtable_; +}; +struct physx_PxCounterFrequencyToTensOfNanos_Pod { + uint64_t mNumerator; + uint64_t mDenominator; +}; +struct physx_PxTime_Pod { + char structgen_pad0[8]; +}; +struct physx_PxVec2_Pod { + float x; + float y; +}; +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_PxDebugPoint_Pod { + physx_PxVec3_Pod pos; + uint32_t color; +}; +struct physx_PxDebugLine_Pod { + physx_PxVec3_Pod pos0; + uint32_t color0; + physx_PxVec3_Pod pos1; + uint32_t color1; +}; +struct physx_PxDebugTriangle_Pod { + physx_PxVec3_Pod pos0; + uint32_t color0; + physx_PxVec3_Pod pos1; + uint32_t color1; + physx_PxVec3_Pod pos2; + uint32_t color2; +}; +struct physx_PxDebugText_Pod { + physx_PxVec3_Pod position; + float size; + uint32_t color; + char structgen_pad0[4]; + char const* string; +}; +struct physx_PxRenderBuffer_Pod { + void* vtable_; +}; +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_PxBase_Pod { + char structgen_pad0[16]; +}; +struct physx_PxRefCounted_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTolerancesScale_Pod { + float length; + float speed; +}; +struct physx_PxStringTable_Pod { + void* vtable_; +}; +struct physx_PxSerializer_Pod { + void* vtable_; +}; +struct physx_PxMetaDataEntry_Pod { + char const* type; + char const* name; + uint32_t offset; + uint32_t size; + uint32_t count; + uint32_t offsetSize; + uint32_t flags; + uint32_t alignment; +}; +struct physx_PxInsertionCallback_Pod { + void* vtable_; +}; +struct physx_PxBaseTask_Pod; +struct physx_PxTask_Pod; +struct physx_PxLightCpuTask_Pod; +struct physx_PxCpuDispatcher_Pod; +struct physx_PxTaskManager_Pod { + void* vtable_; +}; +struct physx_PxCpuDispatcher_Pod { + void* vtable_; +}; +struct physx_PxBaseTask_Pod { + char structgen_pad0[24]; +}; +struct physx_PxTask_Pod { + char structgen_pad0[32]; +}; +struct physx_PxLightCpuTask_Pod { + char structgen_pad0[40]; +}; +struct physx_PxGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxBoxGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + physx_PxVec3_Pod halfExtents; +}; +struct physx_PxBVHRaycastCallback_Pod { + void* vtable_; +}; +struct physx_PxBVHOverlapCallback_Pod { + void* vtable_; +}; +struct physx_PxBVHTraversalCallback_Pod { + void* vtable_; +}; +struct physx_PxBVH_Pod { + char structgen_pad0[16]; +}; +struct physx_PxGeomIndexPair_Pod; +struct physx_PxCapsuleGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + float radius; + float halfHeight; +}; +struct physx_PxHullPolygon_Pod { + float mPlane[4]; + uint16_t mNbVerts; + uint16_t mIndexBase; +}; +struct physx_PxConvexMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxMeshScale_Pod { + physx_PxVec3_Pod scale; + physx_PxQuat_Pod rotation; +}; +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_PxSphereGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + float radius; +}; +struct physx_PxPlaneGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; +}; +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_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_PxGeometryQuery_Pod { + char structgen_pad0[1]; +}; +struct physx_PxHeightFieldSample_Pod { + int16_t height; + physx_PxBitAndByte_Pod materialIndex0; + physx_PxBitAndByte_Pod materialIndex1; +}; +struct physx_PxHeightFieldDesc_Pod; +struct physx_PxHeightField_Pod { + char structgen_pad0[16]; +}; +struct physx_PxHeightFieldDesc_Pod { + uint32_t nbRows; + uint32_t nbColumns; + int32_t format; + char structgen_pad0[4]; + physx_PxStridedData_Pod samples; + float convexEdgeThreshold; + uint16_t flags; + char structgen_pad1[2]; +}; +struct physx_PxTriangle_Pod; +struct physx_PxMeshQuery_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSimpleTriangleMesh_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod triangles; + uint16_t flags; + char structgen_pad0[6]; +}; +struct physx_PxTriangle_Pod { + physx_PxVec3_Pod verts[3]; +}; +struct physx_PxTrianglePadded_Pod { + physx_PxVec3_Pod verts[3]; + uint32_t padding; +}; +struct physx_PxTriangleMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxBVH34TriangleMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedron_Pod { + physx_PxVec3_Pod verts[4]; +}; +struct physx_PxSoftBodyAuxData_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedronMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxSoftBodyMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxCollisionMeshMappingData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSoftBodyCollisionData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxTetrahedronMeshData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSoftBodySimulationData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxCollisionTetrahedronMeshData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSimulationTetrahedronMeshData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxScene_Pod; +struct physx_PxActor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxAggregate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpringModifiers_Pod { + float stiffness; + float damping; + char structgen_pad0[8]; +}; +struct physx_PxRestitutionModifiers_Pod { + float restitution; + float velocityThreshold; + char structgen_pad0[8]; +}; +union physx_Px1DConstraintMods_Pod { + physx_PxSpringModifiers_Pod spring; + physx_PxRestitutionModifiers_Pod bounce; +}; +struct physx_Px1DConstraint_Pod { + physx_PxVec3_Pod linear0; + float geometricError; + physx_PxVec3_Pod angular0; + float velocityTarget; + physx_PxVec3_Pod linear1; + float minImpulse; + physx_PxVec3_Pod angular1; + float maxImpulse; + physx_Px1DConstraintMods_Pod mods; + float forInternalUse; + uint16_t flags; + uint16_t solveHint; + char structgen_pad0[8]; +}; +struct physx_PxConstraintInvMassScale_Pod { + float linear0; + float angular0; + float linear1; + float angular1; +}; +struct physx_PxConstraintVisualizer_Pod { + void* vtable_; +}; +struct physx_PxConstraintConnector_Pod { + void* vtable_; +}; +struct physx_PxContactPoint_Pod { + physx_PxVec3_Pod normal; + float separation; + physx_PxVec3_Pod point; + float maxImpulse; + physx_PxVec3_Pod targetVel; + float staticFriction; + uint8_t materialFlags; + char structgen_pad0[3]; + uint32_t internalFaceIndex1; + float dynamicFriction; + float restitution; + float damping; + char structgen_pad1[12]; +}; +struct physx_PxTGSSolverBodyVel_Pod; +struct physx_PxSolverBody_Pod { + physx_PxVec3_Pod linearVelocity; + uint16_t maxSolverNormalProgress; + uint16_t maxSolverFrictionProgress; + physx_PxVec3_Pod angularState; + uint32_t solverProgress; +}; +struct physx_PxSolverBodyData_Pod { + physx_PxVec3_Pod linearVelocity; + float invMass; + physx_PxVec3_Pod angularVelocity; + float reportThreshold; + physx_PxMat33_Pod sqrtInvInertia; + float penBiasClamp; + uint32_t nodeIndex; + float maxContactImpulse; + physx_PxTransform_Pod body2World; + uint16_t pad; + char structgen_pad0[2]; +}; +struct physx_PxConstraintBatchHeader_Pod { + uint32_t startIndex; + uint16_t stride; + uint16_t constraintType; +}; +struct physx_PxSolverConstraintDesc_Pod { + char structgen_pad0[16]; + uint32_t bodyADataIndex; + uint32_t bodyBDataIndex; + uint32_t linkIndexA; + uint32_t linkIndexB; + uint8_t* constraint; + void* writeBack; + uint16_t progressA; + uint16_t progressB; + uint16_t constraintLengthOver16; + uint8_t padding[10]; +}; +struct physx_PxSolverConstraintPrepDescBase_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxSolverConstraintPrepDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + physx_Px1DConstraint_Pod* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad1[3]; + physx_PxVec3Padded_Pod body0WorldOffset; + char structgen_pad2[8]; +}; +struct physx_PxSolverContactDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint_Pod* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float offsetSlop; + char structgen_pad2[12]; +}; +struct physx_PxConstraintAllocator_Pod { + void* vtable_; +}; +struct physx_PxArticulationLimit_Pod { + float low; + float high; +}; +struct physx_PxArticulationDrive_Pod { + float stiffness; + float damping; + float maxForce; + int32_t driveType; +}; +struct physx_PxTGSSolverBodyVel_Pod { + physx_PxVec3_Pod linearVelocity; + uint16_t nbStaticInteractions; + uint16_t maxDynamicPartition; + physx_PxVec3_Pod angularVelocity; + uint32_t partitionMask; + physx_PxVec3_Pod deltaAngDt; + float maxAngVel; + physx_PxVec3_Pod deltaLinDt; + uint16_t lockFlags; + bool isKinematic; + uint8_t pad; +}; +struct physx_PxTGSSolverBodyTxInertia_Pod { + physx_PxTransform_Pod deltaBody2World; + physx_PxMat33_Pod sqrtInvInertia; +}; +struct physx_PxTGSSolverBodyData_Pod { + physx_PxVec3_Pod originalLinearVelocity; + float maxContactImpulse; + physx_PxVec3_Pod originalAngularVelocity; + float penBiasClamp; + float invMass; + uint32_t nodeIndex; + float reportThreshold; + uint32_t pad; +}; +struct physx_PxTGSSolverConstraintPrepDescBase_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxTGSSolverConstraintPrepDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + physx_Px1DConstraint_Pod* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad0[3]; + physx_PxVec3Padded_Pod body0WorldOffset; + physx_PxVec3Padded_Pod cA2w; + physx_PxVec3Padded_Pod cB2w; +}; +struct physx_PxTGSSolverContactDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint_Pod* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float maxImpulse; + float torsionalPatchRadius; + float minTorsionalPatchRadius; + float offsetSlop; +}; +struct physx_PxArticulationSpatialTendon_Pod; +struct physx_PxArticulationFixedTendon_Pod; +struct physx_PxArticulationTendonLimit_Pod { + float lowLimit; + float highLimit; +}; +struct physx_PxArticulationAttachment_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendonJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationSpatialTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationFixedTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpatialForce_Pod { + physx_PxVec3_Pod force; + float pad0; + physx_PxVec3_Pod torque; + float pad1; +}; +struct physx_PxSpatialVelocity_Pod { + physx_PxVec3_Pod linear; + float pad0; + physx_PxVec3_Pod angular; + float pad1; +}; +struct physx_PxArticulationRootLinkData_Pod { + physx_PxTransform_Pod transform; + physx_PxVec3_Pod worldLinVel; + physx_PxVec3_Pod worldAngVel; + physx_PxVec3_Pod worldLinAccel; + physx_PxVec3_Pod worldAngAccel; +}; +struct physx_PxArticulationCache_Pod { + physx_PxSpatialForce_Pod* externalForces; + float* denseJacobian; + float* massMatrix; + float* jointVelocity; + float* jointAcceleration; + float* jointPosition; + float* jointForce; + float* jointSolverForces; + physx_PxSpatialVelocity_Pod* linkVelocity; + physx_PxSpatialVelocity_Pod* linkAcceleration; + physx_PxArticulationRootLinkData_Pod* rootLinkData; + physx_PxSpatialForce_Pod* sensorForces; + float* coefficientMatrix; + float* lambda; + void* scratchMemory; + void* scratchAllocator; + uint32_t version; + char structgen_pad0[4]; +}; +struct physx_PxArticulationSensor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationReducedCoordinate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationJointReducedCoordinate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData_Pod; +struct physx_PxBaseMaterial_Pod; +struct physx_PxShape_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidActor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxNodeIndex_Pod { + char structgen_pad0[8]; +}; +struct physx_PxRigidBody_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationLink_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxConeLimitedConstraint_Pod { + physx_PxVec3_Pod mAxis; + float mAngle; + float mLowLimit; + float mHighLimit; +}; +struct physx_PxConeLimitParams_Pod { + physx_PxVec4_Pod lowHighLimits; + physx_PxVec4_Pod axisAngle; +}; +struct physx_PxConstraintShaderTable_Pod { + void * solverPrep; + char structgen_pad0[8]; + void * visualize; + int32_t flag; + char structgen_pad1[4]; +}; +struct physx_PxConstraint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxMassModificationProps_Pod { + float mInvMassScale0; + float mInvInertiaScale0; + float mInvMassScale1; + float mInvInertiaScale1; +}; +struct physx_PxContactPatch_Pod { + physx_PxMassModificationProps_Pod mMassModification; + physx_PxVec3_Pod normal; + float restitution; + float dynamicFriction; + float staticFriction; + float damping; + uint16_t startContactIndex; + uint8_t nbContacts; + uint8_t materialFlags; + uint16_t internalFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + uint16_t pad[5]; +}; +struct physx_PxContact_Pod { + physx_PxVec3_Pod contact; + float separation; +}; +struct physx_PxExtendedContact_Pod { + physx_PxVec3_Pod contact; + float separation; + physx_PxVec3_Pod targetVelocity; + float maxImpulse; +}; +struct physx_PxModifiableContact_Pod { + physx_PxVec3_Pod contact; + float separation; + physx_PxVec3_Pod targetVelocity; + float maxImpulse; + physx_PxVec3_Pod normal; + float restitution; + uint32_t materialFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + float staticFriction; + float dynamicFriction; +}; +struct physx_PxContactStreamIterator_Pod { + physx_PxVec3_Pod zero; + char structgen_pad0[4]; + physx_PxContactPatch_Pod const* patch; + physx_PxContact_Pod const* contact; + uint32_t const* faceIndice; + uint32_t totalPatches; + uint32_t totalContacts; + uint32_t nextContactIndex; + uint32_t nextPatchIndex; + uint32_t contactPatchHeaderSize; + uint32_t contactPointSize; + int32_t mStreamFormat; + uint32_t forceNoResponse; + bool pointStepped; + char structgen_pad1[3]; + uint32_t hasFaceIndices; +}; +struct physx_PxGpuContactPair_Pod { + uint8_t* contactPatches; + uint8_t* contactPoints; + float* contactForces; + uint32_t transformCacheRef0; + uint32_t transformCacheRef1; + physx_PxNodeIndex_Pod nodeIndex0; + physx_PxNodeIndex_Pod nodeIndex1; + physx_PxActor_Pod* actor0; + physx_PxActor_Pod* actor1; + uint16_t nbContacts; + uint16_t nbPatches; + char structgen_pad0[4]; +}; +struct physx_PxContactSet_Pod { + char structgen_pad0[16]; +}; +struct physx_PxContactModifyPair_Pod { + physx_PxRigidActor_Pod const* actor[2]; + physx_PxShape_Pod const* shape[2]; + physx_PxTransform_Pod transform[2]; + physx_PxContactSet_Pod contacts; +}; +struct physx_PxContactModifyCallback_Pod { + void* vtable_; +}; +struct physx_PxCCDContactModifyCallback_Pod { + void* vtable_; +}; +struct physx_PxDeletionListener_Pod { + void* vtable_; +}; +struct physx_PxBaseMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFEMMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData_Pod { + uint32_t word0; + uint32_t word1; + uint32_t word2; + uint32_t word3; +}; +struct physx_PxSimulationFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxParticleRigidFilterPair_Pod { + uint64_t mID0; + uint64_t mID1; +}; +struct physx_PxLockedData_Pod { + void* vtable_; +}; +struct physx_PxMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGpuParticleBufferIndexPair_Pod { + uint32_t systemIndex; + uint32_t bufferIndex; +}; +struct physx_PxCudaContextManager_Pod; +struct physx_PxParticleRigidAttachment_Pod; +struct physx_PxParticleVolume_Pod { + physx_PxBounds3_Pod bound; + uint32_t particleIndicesOffset; + uint32_t numParticles; +}; +struct physx_PxDiffuseParticleParams_Pod { + float threshold; + float lifetime; + float airDrag; + float bubbleDrag; + float buoyancy; + float kineticEnergyWeight; + float pressureWeight; + float divergenceWeight; + float collisionDecay; + bool useAccurateVelocity; + char structgen_pad0[3]; +}; +struct physx_PxParticleSpring_Pod { + uint32_t ind0; + uint32_t ind1; + float length; + float stiffness; + float damping; + float pad; +}; +struct physx_PxParticleMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneDesc_Pod; +struct physx_PxPvd_Pod; +struct physx_PxOmniPvd_Pod; +struct physx_PxPhysics_Pod { + void* vtable_; +}; +struct physx_PxActorShape_Pod { + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxRaycastHit_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; + char structgen_pad1[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxOverlapHit_Pod { + uint32_t faceIndex; + char structgen_pad0[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxSweepHit_Pod { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3_Pod position; + physx_PxVec3_Pod normal; + float distance; + char structgen_pad1[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxRaycastCallback_Pod { + char structgen_pad0[8]; + physx_PxRaycastHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapCallback_Pod { + char structgen_pad0[8]; + physx_PxOverlapHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepCallback_Pod { + char structgen_pad0[8]; + physx_PxSweepHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxRaycastBuffer_Pod { + char structgen_pad0[8]; + physx_PxRaycastHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapBuffer_Pod { + char structgen_pad0[8]; + physx_PxOverlapHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepBuffer_Pod { + char structgen_pad0[8]; + physx_PxSweepHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxQueryCache_Pod { + physx_PxShape_Pod* shape; + physx_PxRigidActor_Pod* actor; + uint32_t faceIndex; + char structgen_pad0[4]; +}; +struct physx_PxQueryFilterData_Pod { + physx_PxFilterData_Pod data; + uint16_t flags; + char structgen_pad0[2]; +}; +struct physx_PxQueryFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxRigidDynamic_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidStatic_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneQuerySystem_Pod; +struct physx_PxSceneQueryDesc_Pod { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; +}; +struct physx_PxSceneQuerySystemBase_Pod { + void* vtable_; +}; +struct physx_PxSceneSQSystem_Pod { + void* vtable_; +}; +struct physx_PxSceneQuerySystem_Pod { + void* vtable_; +}; +struct physx_PxBroadPhaseRegion_Pod { + physx_PxBounds3_Pod mBounds; + void* mUserData; +}; +struct physx_PxBroadPhaseRegionInfo_Pod { + physx_PxBroadPhaseRegion_Pod mRegion; + uint32_t mNbStaticObjects; + uint32_t mNbDynamicObjects; + bool mActive; + bool mOverlap; + char structgen_pad0[6]; +}; +struct physx_PxBroadPhaseCaps_Pod { + uint32_t mMaxNbRegions; +}; +struct physx_PxBroadPhaseDesc_Pod { + int32_t mType; + char structgen_pad0[4]; + uint64_t mContextID; + char structgen_pad1[8]; + uint32_t mFoundLostPairsCapacity; + bool mDiscardStaticVsKinematic; + bool mDiscardKinematicVsKinematic; + char structgen_pad2[2]; +}; +struct physx_PxBroadPhaseUpdateData_Pod { + uint32_t const* mCreated; + uint32_t mNbCreated; + char structgen_pad0[4]; + uint32_t const* mUpdated; + uint32_t mNbUpdated; + char structgen_pad1[4]; + uint32_t const* mRemoved; + uint32_t mNbRemoved; + char structgen_pad2[4]; + physx_PxBounds3_Pod const* mBounds; + uint32_t const* mGroups; + float const* mDistances; + uint32_t mCapacity; + char structgen_pad3[4]; +}; +struct physx_PxBroadPhasePair_Pod { + uint32_t mID0; + uint32_t mID1; +}; +struct physx_PxBroadPhaseResults_Pod { + uint32_t mNbCreatedPairs; + char structgen_pad0[4]; + physx_PxBroadPhasePair_Pod const* mCreatedPairs; + uint32_t mNbDeletedPairs; + char structgen_pad1[4]; + physx_PxBroadPhasePair_Pod const* mDeletedPairs; +}; +struct physx_PxBroadPhaseRegions_Pod { + void* vtable_; +}; +struct physx_PxBroadPhase_Pod { + void* vtable_; +}; +struct physx_PxAABBManager_Pod { + void* vtable_; +}; +struct physx_PxBroadPhaseCallback_Pod; +struct physx_PxSimulationEventCallback_Pod; +struct physx_PxSceneLimits_Pod { + uint32_t maxNbActors; + uint32_t maxNbBodies; + uint32_t maxNbStaticShapes; + uint32_t maxNbDynamicShapes; + uint32_t maxNbAggregates; + uint32_t maxNbConstraints; + uint32_t maxNbRegions; + uint32_t maxNbBroadPhaseOverlaps; +}; +struct physx_PxgDynamicsMemoryConfig_Pod { + uint32_t tempBufferCapacity; + uint32_t maxRigidContactCount; + uint32_t maxRigidPatchCount; + uint32_t heapCapacity; + uint32_t foundLostPairsCapacity; + uint32_t foundLostAggregatePairsCapacity; + uint32_t totalAggregatePairsCapacity; + uint32_t maxSoftBodyContacts; + uint32_t maxFemClothContacts; + uint32_t maxParticleContacts; + uint32_t collisionStackSize; + uint32_t maxHairContacts; +}; +struct physx_PxSceneDesc_Pod { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; + physx_PxVec3_Pod gravity; + physx_PxSimulationEventCallback_Pod* simulationEventCallback; + physx_PxContactModifyCallback_Pod* contactModifyCallback; + physx_PxCCDContactModifyCallback_Pod* ccdContactModifyCallback; + void const* filterShaderData; + uint32_t filterShaderDataSize; + char structgen_pad0[4]; + void * filterShader; + physx_PxSimulationFilterCallback_Pod* filterCallback; + int32_t kineKineFilteringMode; + int32_t staticKineFilteringMode; + int32_t broadPhaseType; + char structgen_pad1[4]; + physx_PxBroadPhaseCallback_Pod* broadPhaseCallback; + physx_PxSceneLimits_Pod limits; + int32_t frictionType; + int32_t solverType; + float bounceThresholdVelocity; + float frictionOffsetThreshold; + float frictionCorrelationDistance; + uint32_t flags; + physx_PxCpuDispatcher_Pod* cpuDispatcher; + char structgen_pad2[8]; + void* userData; + uint32_t solverBatchSize; + uint32_t solverArticulationBatchSize; + uint32_t nbContactDataBlocks; + uint32_t maxNbContactDataBlocks; + float maxBiasCoefficient; + uint32_t contactReportStreamBufferSize; + uint32_t ccdMaxPasses; + float ccdThreshold; + float ccdMaxSeparation; + float wakeCounterResetValue; + physx_PxBounds3_Pod sanityBounds; + physx_PxgDynamicsMemoryConfig_Pod gpuDynamicsConfig; + uint32_t gpuMaxNumPartitions; + uint32_t gpuMaxNumStaticPartitions; + uint32_t gpuComputeVersion; + uint32_t contactPairSlabSize; + physx_PxSceneQuerySystem_Pod* sceneQuerySystem; + char structgen_pad3[8]; +}; +struct physx_PxSimulationStatistics_Pod { + uint32_t nbActiveConstraints; + uint32_t nbActiveDynamicBodies; + uint32_t nbActiveKinematicBodies; + uint32_t nbStaticBodies; + uint32_t nbDynamicBodies; + uint32_t nbKinematicBodies; + uint32_t nbShapes[11]; + uint32_t nbAggregates; + uint32_t nbArticulations; + uint32_t nbAxisSolverConstraints; + uint32_t compressedContactSize; + uint32_t requiredContactConstraintMemory; + uint32_t peakConstraintMemory; + uint32_t nbDiscreteContactPairsTotal; + uint32_t nbDiscreteContactPairsWithCacheHits; + uint32_t nbDiscreteContactPairsWithContacts; + uint32_t nbNewPairs; + uint32_t nbLostPairs; + uint32_t nbNewTouches; + uint32_t nbLostTouches; + uint32_t nbPartitions; + char structgen_pad0[4]; + uint64_t gpuMemParticles; + uint64_t gpuMemSoftBodies; + uint64_t gpuMemFEMCloths; + uint64_t gpuMemHairSystems; + uint64_t gpuMemHeap; + uint64_t gpuMemHeapBroadPhase; + uint64_t gpuMemHeapNarrowPhase; + uint64_t gpuMemHeapSolver; + uint64_t gpuMemHeapArticulation; + uint64_t gpuMemHeapSimulation; + uint64_t gpuMemHeapSimulationArticulation; + uint64_t gpuMemHeapSimulationParticles; + uint64_t gpuMemHeapSimulationSoftBody; + uint64_t gpuMemHeapSimulationFEMCloth; + uint64_t gpuMemHeapSimulationHairSystem; + uint64_t gpuMemHeapParticles; + uint64_t gpuMemHeapSoftBodies; + uint64_t gpuMemHeapFEMCloths; + uint64_t gpuMemHeapHairSystems; + uint64_t gpuMemHeapOther; + uint32_t nbBroadPhaseAdds; + uint32_t nbBroadPhaseRemoves; + uint32_t nbDiscreteContactPairs[11][11]; + uint32_t nbCCDPairs[11][11]; + uint32_t nbModifiedContactPairs[11][11]; + uint32_t nbTriggerPairs[11][11]; +}; +struct physx_PxGpuBodyData_Pod { + physx_PxQuat_Pod quat; + physx_PxVec4_Pod pos; + physx_PxVec4_Pod linVel; + physx_PxVec4_Pod angVel; +}; +struct physx_PxGpuActorPair_Pod { + uint32_t srcIndex; + char structgen_pad0[4]; + physx_PxNodeIndex_Pod nodeIndex; +}; +struct physx_PxIndexDataPair_Pod { + uint32_t index; + char structgen_pad0[4]; + void* data; +}; +struct physx_PxPvdSceneClient_Pod { + void* vtable_; +}; +struct physx_PxContactPairHeader_Pod; +struct physx_PxDominanceGroupPair_Pod { + uint8_t dominance0; + uint8_t dominance1; +}; +struct physx_PxBroadPhaseCallback_Pod { + void* vtable_; +}; +struct physx_PxScene_Pod { + char structgen_pad0[8]; + void* userData; +}; +struct physx_PxSceneReadLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSceneWriteLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxContactPairExtraDataItem_Pod { + uint8_t type; +}; +struct physx_PxContactPairVelocity_Pod { + uint8_t type; + char structgen_pad0[3]; + physx_PxVec3_Pod linearVelocity[2]; + physx_PxVec3_Pod angularVelocity[2]; +}; +struct physx_PxContactPairPose_Pod { + uint8_t type; + char structgen_pad0[3]; + physx_PxTransform_Pod globalPose[2]; +}; +struct physx_PxContactPairIndex_Pod { + uint8_t type; + char structgen_pad0[1]; + uint16_t index; +}; +struct physx_PxContactPairExtraDataIterator_Pod { + uint8_t const* currPtr; + uint8_t const* endPtr; + physx_PxContactPairVelocity_Pod const* preSolverVelocity; + physx_PxContactPairVelocity_Pod const* postSolverVelocity; + physx_PxContactPairPose_Pod const* eventPose; + uint32_t contactPairIndex; + char structgen_pad0[4]; +}; +struct physx_PxContactPair_Pod; +struct physx_PxContactPairHeader_Pod { + physx_PxActor_Pod* actors[2]; + uint8_t const* extraDataStream; + uint16_t extraDataStreamSize; + uint16_t flags; + char structgen_pad0[4]; + physx_PxContactPair_Pod const* pairs; + uint32_t nbPairs; + char structgen_pad1[4]; +}; +struct physx_PxContactPairPoint_Pod { + physx_PxVec3_Pod position; + float separation; + physx_PxVec3_Pod normal; + uint32_t internalFaceIndex0; + physx_PxVec3_Pod impulse; + uint32_t internalFaceIndex1; +}; +struct physx_PxContactPair_Pod { + physx_PxShape_Pod* shapes[2]; + uint8_t const* contactPatches; + uint8_t const* contactPoints; + float const* contactImpulses; + uint32_t requiredBufferSize; + uint8_t contactCount; + uint8_t patchCount; + uint16_t contactStreamSize; + uint16_t flags; + uint16_t events; + uint32_t internalData[2]; + char structgen_pad0[4]; +}; +struct physx_PxTriggerPair_Pod { + physx_PxShape_Pod* triggerShape; + physx_PxActor_Pod* triggerActor; + physx_PxShape_Pod* otherShape; + physx_PxActor_Pod* otherActor; + int32_t status; + uint8_t flags; + char structgen_pad0[3]; +}; +struct physx_PxConstraintInfo_Pod { + physx_PxConstraint_Pod* constraint; + void* externalReference; + uint32_t type; + char structgen_pad0[4]; +}; +struct physx_PxSimulationEventCallback_Pod { + void* vtable_; +}; +struct physx_PxFEMParameters_Pod { + float velocityDamping; + float settlingThreshold; + float sleepThreshold; + float sleepDamping; + float selfCollisionFilterDistance; + float selfCollisionStressTolerance; +}; +struct physx_PxPruningStructure_Pod { + char structgen_pad0[16]; +}; +struct physx_PxExtendedVec3_Pod { + double x; + double y; + double z; +}; +struct physx_PxControllerManager_Pod; +struct physx_PxObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; +}; +struct physx_PxBoxObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; + physx_PxVec3_Pod mHalfExtents; + char structgen_pad1[4]; +}; +struct physx_PxCapsuleObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; + float mHalfHeight; + float mRadius; +}; +struct physx_PxObstacleContext_Pod { + void* vtable_; +}; +struct physx_PxController_Pod; +struct physx_PxControllerBehaviorCallback_Pod; +struct physx_PxControllerState_Pod { + physx_PxVec3_Pod deltaXP; + char structgen_pad0[4]; + physx_PxShape_Pod* touchedShape; + physx_PxRigidActor_Pod* touchedActor; + uint32_t touchedObstacleHandle; + uint32_t collisionFlags; + bool standOnAnotherCCT; + bool standOnObstacle; + bool isMovingUp; + char structgen_pad1[5]; +}; +struct physx_PxControllerStats_Pod { + uint16_t nbIterations; + uint16_t nbFullUpdates; + uint16_t nbPartialUpdates; + uint16_t nbTessellation; +}; +struct physx_PxControllerHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; +}; +struct physx_PxControllerShapeHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + physx_PxShape_Pod* shape; + physx_PxRigidActor_Pod* actor; + uint32_t triangleIndex; + char structgen_pad1[4]; +}; +struct physx_PxControllersHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + physx_PxController_Pod* other; +}; +struct physx_PxControllerObstacleHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + void const* userData; +}; +struct physx_PxUserControllerHitReport_Pod { + void* vtable_; +}; +struct physx_PxControllerFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxControllerFilters_Pod { + physx_PxFilterData_Pod const* mFilterData; + physx_PxQueryFilterCallback_Pod* mFilterCallback; + uint16_t mFilterFlags; + char structgen_pad0[6]; + physx_PxControllerFilterCallback_Pod* mCCTFilterCallback; +}; +struct physx_PxControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; +}; +struct physx_PxController_Pod { + void* vtable_; +}; +struct physx_PxBoxControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float halfHeight; + float halfSideExtent; + float halfForwardExtent; +}; +struct physx_PxBoxController_Pod { + void* vtable_; +}; +struct physx_PxCapsuleControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float radius; + float height; + int32_t climbingMode; +}; +struct physx_PxCapsuleController_Pod { + void* vtable_; +}; +struct physx_PxControllerBehaviorCallback_Pod { + void* vtable_; +}; +struct physx_PxControllerManager_Pod { + void* vtable_; +}; +struct physx_PxDim3_Pod { + uint32_t x; + uint32_t y; + uint32_t z; +}; +struct physx_PxSDFDesc_Pod { + physx_PxBoundedData_Pod sdf; + physx_PxDim3_Pod dims; + physx_PxVec3_Pod meshLower; + float spacing; + uint32_t subgridSize; + int32_t bitsPerSubgridPixel; + physx_PxDim3_Pod sdfSubgrids3DTexBlockDim; + physx_PxBoundedData_Pod sdfSubgrids; + physx_PxBoundedData_Pod sdfStartSlots; + float subgridsMinSdfValue; + float subgridsMaxSdfValue; + physx_PxBounds3_Pod sdfBounds; + float narrowBandThicknessRelativeToSdfBoundsDiagonal; + uint32_t numThreadsForSdfConstruction; +}; +struct physx_PxConvexMeshDesc_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod polygons; + physx_PxBoundedData_Pod indices; + uint16_t flags; + uint16_t vertexLimit; + uint16_t polygonLimit; + uint16_t quantizedCount; + physx_PxSDFDesc_Pod* sdfDesc; +}; +struct physx_PxTriangleMeshDesc_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod triangles; + uint16_t flags; + char structgen_pad0[22]; + physx_PxSDFDesc_Pod* sdfDesc; +}; +struct physx_PxTetrahedronMeshDesc_Pod { + char structgen_pad0[16]; + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod tetrahedrons; + uint16_t flags; + uint16_t tetsPerElement; + char structgen_pad1[4]; +}; +struct physx_PxSoftBodySimulationDataDesc_Pod { + physx_PxBoundedData_Pod vertexToTet; +}; +struct physx_PxBVH34MidphaseDesc_Pod { + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + bool quantized; + char structgen_pad0[3]; +}; +struct physx_PxMidphaseDesc_Pod { + char structgen_pad0[16]; +}; +struct physx_PxBVHDesc_Pod { + physx_PxBoundedData_Pod bounds; + float enlargement; + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + char structgen_pad0[4]; +}; +struct physx_PxCookingParams_Pod { + float areaTestEpsilon; + float planeTolerance; + int32_t convexMeshCookingType; + bool suppressTriangleMeshRemapTable; + bool buildTriangleAdjacencies; + bool buildGPUData; + char structgen_pad0[1]; + physx_PxTolerancesScale_Pod scale; + uint32_t meshPreprocessParams; + float meshWeldTolerance; + physx_PxMidphaseDesc_Pod midphaseDesc; + uint32_t gaussMapLimit; + float maxWeightRatioInTet; +}; +struct physx_PxDefaultMemoryOutputStream_Pod { + char structgen_pad0[32]; +}; +struct physx_PxDefaultMemoryInputData_Pod { + char structgen_pad0[32]; +}; +struct physx_PxDefaultFileOutputStream_Pod { + char structgen_pad0[16]; +}; +struct physx_PxDefaultFileInputData_Pod { + char structgen_pad0[24]; +}; +struct physx_PxDefaultAllocator_Pod { + void* vtable_; +}; +struct physx_PxJoint_Pod; +struct physx_PxRackAndPinionJoint_Pod; +struct physx_PxGearJoint_Pod; +struct physx_PxD6Joint_Pod; +struct physx_PxDistanceJoint_Pod; +struct physx_PxContactJoint_Pod; +struct physx_PxFixedJoint_Pod; +struct physx_PxPrismaticJoint_Pod; +struct physx_PxRevoluteJoint_Pod; +struct physx_PxSphericalJoint_Pod; +struct physx_PxJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpring_Pod { + float stiffness; + float damping; +}; +struct physx_PxDistanceJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJacobianRow_Pod { + physx_PxVec3_Pod linear0; + physx_PxVec3_Pod linear1; + physx_PxVec3_Pod angular0; + physx_PxVec3_Pod angular1; +}; +struct physx_PxContactJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFixedJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJointLimitParameters_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; +}; +struct physx_PxJointLinearLimit_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float value; +}; +struct physx_PxJointLinearLimitPair_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointAngularLimitPair_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointLimitCone_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngle; + float zAngle; +}; +struct physx_PxJointLimitPyramid_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngleMin; + float yAngleMax; + float zAngleMin; + float zAngleMax; +}; +struct physx_PxPrismaticJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRevoluteJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSphericalJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxD6JointDrive_Pod { + float stiffness; + float damping; + float forceLimit; + uint32_t flags; +}; +struct physx_PxD6Joint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGearJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRackAndPinionJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGroupsMask_Pod { + uint16_t bits0; + uint16_t bits1; + uint16_t bits2; + uint16_t bits3; +}; +struct physx_PxDefaultErrorCallback_Pod { + void* vtable_; +}; +struct physx_PxRigidActorExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxMassProperties_Pod { + physx_PxMat33_Pod inertiaTensor; + physx_PxVec3_Pod centerOfMass; + float mass; +}; +struct physx_PxRigidBodyExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxShapeExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxMeshOverlapUtil_Pod { + char structgen_pad0[1040]; +}; +struct physx_PxBinaryConverter_Pod; +struct physx_PxXmlMiscParameter_Pod { + physx_PxVec3_Pod upVector; + physx_PxTolerancesScale_Pod scale; +}; +struct physx_PxSerialization_Pod { + char structgen_pad0[1]; +}; +struct physx_PxDefaultCpuDispatcher_Pod { + void* vtable_; +}; +struct physx_PxStringTableExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBroadPhaseExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSceneQueryExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBatchQueryExt_Pod { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystem_Pod { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystemAdapter_Pod { + void* vtable_; +}; +struct physx_PxSamplingExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxPoissonSampler_Pod { + char structgen_pad0[8]; +}; +struct physx_PxTriangleMeshPoissonSampler_Pod { + char structgen_pad0[8]; +}; +struct physx_PxTetrahedronMeshExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRepXObject_Pod { + char const* typeName; + void const* serializable; + uint64_t id; +}; +struct physx_PxCooking_Pod; +struct physx_PxRepXInstantiationArgs_Pod { + char structgen_pad0[8]; + physx_PxCooking_Pod* cooker; + physx_PxStringTable_Pod* stringTable; +}; +struct physx_XmlMemoryAllocator_Pod; +struct physx_XmlWriter_Pod; +struct physx_XmlReader_Pod; +struct physx_MemoryBuffer_Pod; +struct physx_PxRepXSerializer_Pod { + void* vtable_; +}; +struct physx_PxVehicleWheels4SimData_Pod; +struct physx_PxVehicleWheels4DynData_Pod; +struct physx_PxVehicleTireForceCalculator_Pod; +struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs_Pod; +struct physx_PxVehicleTelemetryData_Pod; +struct physx_PxPvdTransport_Pod; +struct physx_PxPvd_Pod { + void* vtable_; +}; +struct physx_PxPvdTransport_Pod { + void* vtable_; +}; diff --git a/modules/PhysX/physx/physx-build/CMakeLists.txt b/modules/PhysX/physx/physx-build/CMakeLists.txt new file mode 100644 index 0000000..ec00469 --- /dev/null +++ b/modules/PhysX/physx/physx-build/CMakeLists.txt @@ -0,0 +1,242 @@ + +cmake_minimum_required(VERSION 3.25) +project(physx) + +set(CMAKE_CXX_STANDARD 17) + +add_definitions(-DDISABLE_CUDA_PHYSX) +add_definitions(-DPX_SUPPORT_PVD) + +if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_definitions(-DNDEBUG) +endif() + +if(WIN32) + include_directories(${CMAKE_SOURCE_DIR}/../physx-sys/src/generated/x86_64-pc-windows-msvc) +elseif(UNIX AND NOT APPLE) + include_directories(${CMAKE_SOURCE_DIR}/../physx-sys/src/generated/unix) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + add_definitions(-DPX_CLANG) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + add_definitions(-DPX_GCC) +endif() + +if(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_definitions(-DPX_WIN64) + else() + add_definitions(-DPX_WIN32) + endif() +elseif(UNIX AND NOT APPLE) + add_definitions(-DPX_LINUX) +endif() + +add_definitions(-DPX_PHYSX_CORE_EXPORTS) +add_definitions(-DPX_PHYSX_COMMON_EXPORTS) +add_definitions(-DPX_PHYSX_COOKING_EXPORTS) +add_definitions(-DPX_PHYSX_FOUNDATION_EXPORTS) + +include_directories( + ${CMAKE_SOURCE_DIR}/../physx-sys/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/include + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/foundation/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/common/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/common/src + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/filebuf/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/pxshared/include + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/fastxml/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/fastxml/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/task/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/task/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/foundation + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/api/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/common/include/collision + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/common/include/utils + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/software/include + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevelaabb/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevelaabb/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowleveldynamics/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowleveldynamics/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowleveldynamics/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowleveldynamics/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxvehicle/src + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/extensions/src + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/File + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/tet + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/extensions/include + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxcharacterkinematic/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/common/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/common/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/ccd + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/common + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/contact + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/convex + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/cooking + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/distance + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/gjk + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/hf + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/intersection + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/mesh + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/pcm + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/sweep + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxcooking/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/pvd/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/pvd/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/core/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/core/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physx/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/scenequery/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/scenequery/src + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/simulationcontroller/include + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/simulationcontroller/src +) + +file(GLOB SOURCES ${CMAKE_SOURCE_DIR}/../physx-sys/src/physx_api.cpp) + + +if(WIN32) + file(GLOB OS_SOURCES ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/foundation/windows/*.cpp) + list(APPEND SOURCES ${OS_SOURCES}) +elseif(UNIX AND NOT APPLE) + file(GLOB OS_SOURCES ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/foundation/unix/*.cpp) + list(APPEND SOURCES ${OS_SOURCES}) +endif() + +file(GLOB FINAL_SOURCES + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/foundation/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/common/src/pipeline/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevel/software/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/fastxml/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/task/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowlevelaabb/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/lowleveldynamics/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxvehicle/src/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/extensions/src/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/File/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxextensions/src/tet/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxcharacterkinematic/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/common/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/ccd/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/common/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/contact/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/convex/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/cooking/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/distance/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/gjk/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/hf/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/intersection/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/mesh/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/pcm/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/geomutils/src/sweep/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxcooking/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/pvd/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physxmetadata/core/src/*.cpp + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/immediatemode/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/physx/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/scenequery/src/*.cpp + + ${CMAKE_SOURCE_DIR}/../physx-sys/physx/physx/source/simulationcontroller/src/*.cpp +) +list(APPEND SOURCES ${FINAL_SOURCES}) + +#if(WIN32) +# list(APPEND SOURCES ) +#elseif(UNIX AND NOT APPLE) +# list(APPEND SOURCES ) +#endif() + +add_library(physx SHARED ${SOURCES}) diff --git a/modules/PhysX/physx/physx-build/build/.ninja_deps b/modules/PhysX/physx/physx-build/build/.ninja_deps new file mode 100644 index 0000000..70272f2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/.ninja_deps differ diff --git a/modules/PhysX/physx/physx-build/build/.ninja_log b/modules/PhysX/physx/physx-build/build/.ninja_log new file mode 100644 index 0000000..51041b8 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/.ninja_log @@ -0,0 +1,457 @@ +# ninja log v5 +137315 161103 1723882197457681100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o bff9a6896cc40a51 +199144 214501 1723882251220393600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o 968ae854560c7323 +123347 140130 1723882177616813400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o a8f3538433307147 +216799 232675 1723882269474167000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o 82ced67fdb8db61f +123864 140427 1723882177918079100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o 922f4cd9f670a921 +208514 224250 1723882260120635400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o 8b1e696ccbd8cfb7 +187027 198287 1723882234252164000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o 21800eb27213cfd6 +64855 78205 1723882115954626800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o f3810e12bed2e13 +120770 137293 1723882174539571200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o 6fb8f290030d186c +149453 166895 1723882203871246500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o 89bbf9e5eeb8acc2 +213855 229240 1723882265662253300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o a26662979263081d +78042 91186 1723882127241904700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o 951a0a5944c7ba9f +67019 83193 1723882118886289100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o 7f130fca27062bbb +92935 104381 1723882141884616700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o 870164c307268d65 +98213 112122 1723882150045629100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o 11b2f943e363d3cf +16234 27810 1723882064490505600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o 8fb8562e4e94abf7 +66525 78018 1723882115764936300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o 3f60168601d36962 +141023 143013 1723882180581723900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o dac969859515524 +5823 15967 1723882051644236800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o fdff70d11d343444 +154411 164504 1723882201215244000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o dbddb5ec4fb8c3cf +34844 45624 1723882083453884400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o bff6bd624d856de9 +103815 113483 1723882151506595100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o 4d3dddfc6abe6e4 +154784 165293 1723882202110468000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o 44c34777bc36459e +186688 199305 1723882235365726300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o b04cf1bffd7d44af +62706 73558 1723882111160475700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o f310663705d748ed +199431 211984 1723882248617528900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o be6dc695e9ef286d +15998 26626 1723882063174683800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o c7e95459d21b6831 +220703 222328 1723882258142687200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o c9ce8257c681e44b +213789 225753 1723882261728387900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o daa154777616dc51 +173540 187833 1723882223492429900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o f7257587f43f2d28 +104041 109500 1723882147277251800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o 6351f98f9276233 +158328 172834 1723882210395873300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o bc6077f3f92f9f8a +87843 98208 1723882134998457100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o d0718fe174867d8a +224239 225702 1723882261727380800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o d131f71ea844a921 +128531 145118 1723882182771781600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o 3f875acecc7d9428 +146877 160786 1723882197065902900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o 8f2ac64a64e36283 +144294 157363 1723882193263442100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o 707eadd4d0ecf785 +99868 111484 1723882149384207700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o 733e83f1ef7a780 +96342 111010 1723882148873247800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o 67a59cfd12846c68 +19873 31124 1723882068136958600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o 811ce7517fff6b14 +16355 27568 1723882064222117100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o 82431140407bad4 +112131 126699 1723882162729415200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o 5e8c0f71e96bf0fd +225317 243750 1723882281646495900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o ffaa99c3cf1ed9e6 +18332 27930 1723882064624503500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o 9f34947e108d603f +225821 238782 1723882276268027600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o 72f7871a8d5a0e35 +199206 213779 1723882250498248800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o 5dbf25007253e6ef +159037 176502 1723882214226001900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o 398519c69840aac6 +70005 85336 1723882120996549000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o 6ebc8c656c2972b7 +203446 214826 1723882251569236000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o cd0dfa62d1a325b6 +78658 92909 1723882129178606300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o 57fce4b3ae7ee4c9 +52323 63125 1723882099885707000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o 2860f25dc1570cbc +5849 16130 1723882051798536400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o d6d993dacdd20792 +9103 20342 1723882056255602200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o abbb9302b7e0ee43 +192904 203425 1723882239667264700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o 1113bbd4c59e8f9a +45657 60879 1723882097397748700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o 20a3a95e23000b36 +138905 159137 1723882195266082700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o 19e7f25233edefb7 +229370 240318 1723882277979506700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o b101206ecfae721c +85286 96317 1723882132965181400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o 8f83e9e982a3a569 +186552 198490 1723882234505296500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o 6cca9a74bbfccd5f +157868 167807 1723882204881921400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o 3075637c483214cb +222367 224204 1723882260116122300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o cde6f84447515e0b +7822 18312 1723882054112348300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o 70fb1c869d98981f +179141 199393 1723882235413208100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o e5a8bcd3d8e37df5 +175572 188397 1723882223972023400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o b3cf32ef4e86139f +43622 56797 1723882092854063900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o 862b8a67fa371ef8 +159230 174034 1723882211647589700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o 433c8afe66a7ceb3 +26040 39191 1723882076771186100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o 175ce9ff145b70df +196914 217305 1723882254153307800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o f1b24d1b8580ad99 +110855 127983 1723882164175195900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o b6fba5bbb22c4d78 +167333 179119 1723882216893533400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o e00657e0a1e47ef +141384 160558 1723882196820014300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o 849fae7ddf7db530 +28088 36792 1723882074298487700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o 5027fe5906bce0f8 +224255 236352 1723882273550610900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o ceb885e919d737df +39225 52700 1723882088428565600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o ee496eb20c19b7c7 +165943 176418 1723882214141430200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o f61eb42327ef4f33 +29258 38536 1723882076102890200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o e56d112236e77ef7 +36847 46332 1723882084140187500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o 79aaa95b3860a77c +89302 98755 1723882135671845900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o 53fe483a499236be +177019 190327 1723882225922932900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o 122f5c428e82ca5f +60898 72475 1723882110038124200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o 656e50e76dd55fd3 +207482 223546 1723882259427931700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o 2ca10f6a29ef081b +51754 61103 1723882097660780700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o c1bf94bcd35762c6 +148115 161544 1723882197925822800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o c3519140c5cc4a +176724 188918 1723882224554165400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o d3ee7b37656c2995 +39488 53432 1723882089222888900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o 528cbc2f356c30ba +160153 168743 1723882205906032800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o f21eeccca34f236c +79066 91999 1723882128105043200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o 9f39fbff7e362aa5 +67227 78620 1723882116375761900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o 2c4b31d078756855 +126170 141732 1723882179259528800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o 6cf9f749cb6e7ec0 +27845 36877 1723882074382757000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o b02b0cb6889cae2d +36955 39459 1723882077058738300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o 1a37871c35bf540b +139689 161246 1723882197579401600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o 813df56279d3e8db +50813 60447 1723882096906047000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o 8462b4cdd604c1de +21774 33120 1723882070294480100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o f44df306f677d230 +24399 34814 1723882072123868900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o 3064645e95678671 +223458 235955 1723882273101484500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o 9c827e49586dea48 +50238 59664 1723882096049340600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o f6193e1e7c4a6799 +227943 236310 1723882273532519600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o d4c013e81080a42e +228029 239229 1723882276764977100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o a14bbffd34a74e83 +111046 123217 1723882158896084400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o cc732b78f06a1b56 +62583 74129 1723882111781414000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o f7b1e720cecf5d36 +43453 58140 1723882094374300300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o 7dbfa5037c4891e6 +202603 214351 1723882251099595000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o e12c9a07098c1bc5 +111810 126124 1723882162082821300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o a63dbd683a80e9b8 +214532 230175 1723882266686970300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o b335cd89a4383aa3 +111292 125649 1723882161572897700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o 195b8e0261b3ce9c +51003 61089 1723882097653690600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o e739a2af0f8644b8 +29831 41626 1723882079322046900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o 512a45d0bbc7f6f7 +204115 217696 1723882254563784300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o 3a605a6008b7f69e +142239 156644 1723882192536082300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o 24e2674133d0517b +67768 79437 1723882117243787200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o 658f396979c21791 +100080 111198 1723882149097299600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o 5e275dfc62021584 +130183 147928 1723882185649562300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o 5647905bfaa500a3 +99325 110834 1723882148686629000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o bd6cfc6439204be6 +52679 62562 1723882099264766900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o 4120ea411a54c333 +45885 61414 1723882097979302200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o eb4aaec4f394ae03 +36798 52657 1723882088423088100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o 277e260abe6e468e +74209 88496 1723882124352558100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o 7ba8b109ee1a9963 +35831 50201 1723882085809812400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o 9f40e5bc94520ca +28186 38323 1723882075881779700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o be7848f2c230ac40 +77295 90738 1723882126756573800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o 6632bf5b4b6f347c +106837 122334 1723882157960615800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o ed54f0030d6656d6 +90154 99216 1723882136181739500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o 2a3a55a19fe28da6 +72729 88551 1723882124374807300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o 25e4914bea02cfb7 +176422 188320 1723882223970519200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o 4c8bbcf2f0f88630 +74133 90125 1723882126080629200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o b7a229bdfcce658a +111591 125803 1723882161734541700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o 9261cf5880210781 +73587 89269 1723882125132923800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o bce72aa5af2257dc +123465 141155 1723882178665933000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o dbd757a15778d74c +106379 120603 1723882156226808900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o 271aa33af68e7893 +214359 229582 1723882266027032800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o 7a741cd472aae2c3 +33147 43429 1723882081199355300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o 6e168bb1bd339145 +177407 198661 1723882234642610700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o c3b7fe02d35cbcc5 +144143 156887 1723882192772879100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o 114ab4aa8354cbda +11272 23980 1723882060256105300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o f1ec3fcaf764f7de +18943 30015 1723882066936282600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o 61350f7131b1b7a8 +101533 111560 1723882149448294200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o 71aa4fc45a1e2f86 +110640 127903 1723882164101758600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o 2e5a220c1da3a980 +208126 222534 1723882258357358100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o 2b685cb3f38e7991 +5858 17219 1723882052933609100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o f2ef484cdd374509 +204312 216780 1723882253621049500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o 18dca4013cc2928d +190356 200923 1723882237033953200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o 229106d7a9a4d5f +98288 111257 1723882149134083400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o 10b724ecd3fe1774 +123245 141012 1723882178542228100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o 2e4a41d6557987f0 +161274 176820 1723882214518113800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o fe60fa8377ef9013 +130525 152333 1723882188018519100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o 5b1be0a70bb9aa4 +17341 28883 1723882065703699800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o 114ffa2ab79b270a +108040 123432 1723882159118179600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o fcd6c2f100f38041 +59021 68036 1723882105263535600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o aa3489416069022f +201438 210808 1723882247372272300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o a2ec470b20916069 +83227 93970 1723882130364984800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o 37c79a3b551cb1c6 +104416 119344 1723882154994608100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o 35af6504d6b48038 +72322 87835 1723882123608319700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o 66dfe3ca904e3c37 +107329 123326 1723882159010795300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o 1f814959602a75af +119182 130155 1723882166582378900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o 7547079403962457 +17022 26176 1723882062676438600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o 4b98cb0922bcf9af +72023 85283 1723882120972913000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o c8e7fa7bb4b5f624 +70606 85776 1723882121449052900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o 67250d095b5d38d6 +5795 14708 1723882050419231500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o ab84d67f4240c142 +106438 120744 1723882156370836300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o 1300ac7439d264e0 +156930 166155 1723882203049794200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o e03a64fad5e6e7d1 +145181 158298 1723882194303782200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o a66045ade56f7620 +91388 108009 1723882145722607400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o 3a05c0dbb031a9b1 +68539 79523 1723882117303911300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o 6be98c9e78e695f2 +42561 57565 1723882093713694800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o 92478f86656b212c +169802 182318 1723882220149480200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o ac5d213eb75bc3fe +198707 209118 1723882245609884100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o e66de1076e76dd5c +88499 98245 1723882135112449800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o d0612002e64f7b21 +186898 196884 1723882232776157000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o b03f412f4d5f905e +124897 141897 1723882179422520500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o e404cc17176b1b3a +17208 29326 1723882066182605100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o 2f766640c07f8fc1 +190001 200749 1723882236854726100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o 40baa480784975d +176506 188760 1723882224385228500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o c18bad42950cc5e9 +120628 137398 1723882174611690300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o c8c455ed38435bfa +97688 109882 1723882147669617100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o 7395537eac500868 +17542 28085 1723882064835304100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o ca6cf57c0268581a +167834 186539 1723882222229656500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o 40284971cd33418c +6239 17190 1723882052930559200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o eb53c1b57e5244fd +50449 60220 1723882096653321900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o 352d804a8d9e7887 +125691 127317 1723882163432914200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o dd383edf4acc1a97 +126731 142637 1723882180188101200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o ebf4b45bbdb8be14 +5801 18919 1723882054752354100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o 7e5569db9f34e3ec +141190 165403 1723882202204267300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o b69aeebd97c50fa2 +23828 37289 1723882074715420500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o d62f9d912fcfcfba +141771 154371 1723882190113320300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o 9cda8d12fe7779f +112299 128744 1723882165034484100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o ac36f71da3d36afa +95571 106367 1723882144009568800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o 5fe9eb577f9d903e +207970 223322 1723882259180721900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o 38386b8ebb04e33a +17227 25562 1723882062002326000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o e2cb9b1c0dc8b469 +188946 199133 1723882235154455700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o dca729c002b6d970 +159147 173506 1723882211098332700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o 24201e46e7efbc59 +157630 166663 1723882203607597500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o 8ac589f992dd6813 +11051 23814 1723882060075117700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o 8d42b38a56d7dbcf +66238 79033 1723882116813798400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o e6ddbb0e73eb1358 +140170 160124 1723882196332594700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o ce57a663422eb775 +5829 15882 1723882051551678900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o ec72636514621e19 +212097 227990 1723882264243295100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o 28d504efe0475e39 +181412 199869 1723882235869282000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o a5087131aad149cd +58448 67743 1723882104938235600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o dc5125bf919b67d1 +179848 192869 1723882228534074500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o c327aa0fd366afda +217722 232828 1723882269646890200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o 2458986c08507b42 +186847 198440 1723882234453287800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o 990d017c4ed0bee4 +5836 11036 1723882048911934000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o 3004483bd1204f78 +33608 43597 1723882081372994700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o 9cafb8e9ea68fd27 +160922 176545 1723882214252320800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o c707f0c5421d4865 +161565 170743 1723882208147922400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o 7c14f0c960f08f46 +220177 221732 1723882257523894800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o 166cb00d94543d12 +166178 177969 1723882215703304600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o 80e370e3e83de27b +218001 220697 1723882256467298400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o 219b65909f18b93d +5786 11254 1723882049121756100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o e01772cefb8bba2b +49767 58990 1723882095267176300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o f89be98cc664322b +79441 94520 1723882130961865400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o 131ff50346a72f57 +44335 58416 1723882094636102200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o a66c70addd84a2fc +53786 62642 1723882099376909800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o b81a6a8d2b99c5d8 +165299 176983 1723882214684730300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o f9836c69cdc06f78 +55543 64529 1723882101433463600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o 8d60d766456aeacd +229186 230619 1723882267197056200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o 225ffbaaccd08918 +93991 106412 1723882144045091800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o 4c3c5cb89d23e3c +16143 27362 1723882064003542400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o 357fa59e52dd856d +205419 217970 1723882254846742500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o bd0d335d742f843d +157408 163752 1723882200382319000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o 3bc43af6243a7f43 +172871 186889 1723882222513637800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o 2f6c783d26974c5e +178002 200684 1723882236792555100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o cc16eda2f88eb0c8 +63149 74586 1723882112223407700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o 5e75636d03043dd2 +56825 66210 1723882103274611400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o c346fd3bfb5d343f +97718 111780 1723882149679403800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o d94fb0f4ff2a3bc6 +143047 156774 1723882192647956400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o 2ee286e95ba313a +22310 33049 1723882070239283600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o 134ecf01e0b1d941 +155957 167310 1723882204329535600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o 5ae885b5b9409f5 +171538 183485 1723882221296140200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o c3d1dfbfde746b7f +128006 144259 1723882181853787800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o 111d5d599396ed87 +197867 207140 1723882243547874100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o 308e8173ce445ead +206093 220152 1723882255885878200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o 619a98a4c605d629 +178672 192280 1723882227911088000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o 61751b48e1369d8 +104602 120357 1723882155994485800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o 67ea3d5b902a65e1 +111206 123828 1723882159540466600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o f2f7c747d99f0f76 +111503 124725 1723882160531912600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o 5e13fd799da7625a +5852 17841 1723882053609620100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o 9f6d9bc4704ace0b +76489 91437 1723882127529473600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o 79c43e0d4a80b78e +192314 202582 1723882238785866100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o c9fe348a95a6f8f4 +200705 212629 1723882249276309200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o 9a9935c57e5a470c +5811 16322 1723882051989586100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o 9f6eead09d4858fd +37151 49733 1723882085416666200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o 61d30287e561b72f +161106 169768 1723882207042050300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o 29ddf46aaf2d7371 +162598 171512 1723882208990723000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o b691f47c2d8f2c48 +5791 19852 1723882055739342900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o 85a8fd047167527b +200780 212061 1723882248673967600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o cfc05a01891a2012 +28903 39405 1723882077021925400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o 688c44d8ca702d87 +109542 128504 1723882164741590500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o 583d6cb5a20b00b6 +52715 62680 1723882099392764300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o 1f3aea90cc7cdc7f +38352 51718 1723882087399637800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o d6a7626f01ab7b85 +5847 9060 1723882046850963000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o cebf966dff6202eb +61445 73324 1723882110922242300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o 699b47dca1b9f391 +48678 58183 1723882094392728400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o f88c7e5b8f663950 +146820 159197 1723882195284240600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o 1a05ae723da6d2c6 +64552 76456 1723882114151404000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o 6238a49412d005d5 +92009 101500 1723882138711428100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o c8f6050a9ff34f28 +98782 112268 1723882150199842400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o 3b642f5d07ba2734 +58146 66994 1723882104130880000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o 4c7a32d6b41bafe8 +183849 197833 1723882233775781600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o 9acc4045e3b17ff1 +41656 55524 1723882091451733400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o 44bd61dab8fd30fe +212000 223903 1723882259773674600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o 30c27c8391b5d8cd +140472 160915 1723882197234794500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o 2c94927b9609f209 +27394 36918 1723882074411062500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o eb7b9bb0c0120f1a +9067 21754 1723882057782431300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o 38535879dae0d6ff +39412 52761 1723882088506178800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o 562576eea6588b47 +40986 53765 1723882089575989600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o 2e2d3c7a0dd50f8d +94550 106814 1723882144462987100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o 8e999a049cd56869 +147957 160406 1723882196652798700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o 9c000c4002c1a744 +223555 238602 1723882276082885900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o 266624a879d820cb +62647 74172 1723882111800511800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o 381f14b8dc5d4bc5 +225249 237690 1723882275041884400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o 7c403170a8f15040 +198323 212321 1723882248940551800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o 5f50884fef223217 +5756 41875 1723883899727047400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o 68b6474de5da0384 +229249 230666 1723882267231055900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o 2affdb3ad4587668 +119378 129390 1723882165743294400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o eeb65644959e746c +61212 72294 1723882109856743700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o 189395b449067c57 +183508 195678 1723882231505573500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o a036ebb13164233f +23999 36837 1723882074336269700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o 2dd1b52c03e67057 +164523 174903 1723882212583468500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o 118424c50c340cd8 +104246 119159 1723882154824387200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o 4bc8fed798a641d3 +30033 41779 1723882079483334800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o 27041d6b319d13e1 +91233 101901 1723882139152432400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o 3e4b0b605ae554c1 +209154 225243 1723882261220854400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o 8c115916d19e7322 +60247 70587 1723882108057592600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o b275505b63b18440 +5840 17306 1723882053028121200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o d6869f7eb7874c5b +212361 228383 1723882264691544400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o be47bfdb5df78dd8 +210842 227939 1723882264229586700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o 611694fd3e0ad98a +198608 207948 1723882244398612300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o 2648232308a0300c +33051 42528 1723882080251728100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o 46717cc54ced4e17 +11342 22283 1723882058363558500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o 6fbb50c073f5f4af +230199 238051 1723882275446926700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o 4c191bd9ea47687c +99228 109450 1723882147259858700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o d059575f6b9e6183 +198445 208466 1723882244916933700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o 3ebac02642d9847a +174806 186819 1723882222512132200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o a7d0fef235985763 +197582 207450 1723882243867905800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o 2ac037737618c253 +38815 52291 1723882088006905200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o f79db30a6f431b7e +26664 36014 1723882073416392500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o 145d21699e1e264f +214856 230357 1723882266887967800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o c01588555bb86d65 +229609 238565 1723882276041453200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o 230a0d5b945387c4 +223944 225789 1723882261816126800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o b4ebdd253393261c +221767 223660 1723882259528877100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o d892aaca884a3ec8 +88009 98137 1723882134993946000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o 984fb13732e33172 +72507 87965 1723882123743673300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o cb02ede0800f3f12 +46355 58935 1723882095259353400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o 7773c00f0111baa8 +29352 40966 1723882078643718500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o 1cc326f37c8ac023 +136450 155920 1723882191752594300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o da628e22c1c6c822 +25594 38779 1723882076346182400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o 59036cc478bebf4e +182996 197552 1723882233476460800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o c3090af91fa065f9 +212655 229181 1723882265601886700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o 87a665de533bfb7e +137439 159008 1723882195094242600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o 4a94d96366eaa66f +89724 100055 1723882137113467200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o a922b41b5cd5d7fc +57585 66715 1723882103814491900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o 33b8b16e8db09ee +5767 7805 1723882045524230900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o 22cb89848c012660 +58951 68516 1723882105795475100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o df74974724252c3c +225732 238622 1723882276088705100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o 275e79f7544dd5cd +17863 29804 1723882066697915700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o 48816c90d63a427e +187865 199202 1723882235259470400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o 26e4af2acb4ffd2f +131882 149428 1723882187114483900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o e00700906b8adb18 +78241 91385 1723882127508306200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o eb7731f56c7d59fd +101322 113550 1723882151547771800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o f8401562b7b65c18 +60477 72692 1723882110261259200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o 9fe8a3592abec4de +122368 139640 1723882177100466400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o ab83b656e2f38c0 +199311 210443 1723882246995691800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o c467b59f1463a337 +94156 103785 1723882141246175400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o a9b8ab4e4bab10d9 +228417 230028 1723882266526440600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o 5f6705d15a14a728 +223357 236641 1723882273872521400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o 32984af8db45ee34 +15897 26015 1723882062511566000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o f11c119d3aed63de +61093 73787 1723882111394364900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o c59501b086ac44f +69777 84688 1723882120357975400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o 8cc49cc88cce01 +127344 146854 1723882184544321500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o 6047e1702a9ea96 +27960 37194 1723882074708044300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o 726bb445967a4e2c +36881 46459 1723882084263523500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o 393f171892399e6e +16067 28153 1723882064874161500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o c4058d6c08a3d80b +176857 194114 1723882229844061400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o c43d66b96565c17c +79348 94131 1723882130533372400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o 7fcd986b77d2b7fc +94737 104572 1723882142092231600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o 14da37dc110c7ffc +68058 78968 1723882116766057800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o b82334b9cc87549e +5804 9087 1723882046873618600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o c725ec1484786a3f +88586 99840 1723882136867628800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o 97c2be869bdc8f2b +174068 186655 1723882222336622600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o 811b0392c535a7f5 +52786 64834 1723882101764317100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o 80e1d5a7eb620e40 +37232 50414 1723882086078636500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o 8928aa2ac7d707e8 +5834 6199 1723882043817791600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o 8d6ff9b1e0b09b91 +59771 69971 1723882107368358900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o c479b0e76fdc9976 +223613 225284 1723882261254796400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o 6f5a4b005f19f2 +125837 141339 1723882178849499800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o 562d152ea30f68a2 +78972 91938 1723882128104045100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o 57312a0457bde5ae +142680 157588 1723882193506064400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o 3ecda592d6f918e +199242 211631 1723882248229608900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o 6b5d02cf7f36dbd9 +152364 162578 1723882199073486000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o c5af5f0411f7e751 +46465 61180 1723882097674470200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o b0928372bf1d5fa1 +58214 67201 1723882104351265300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o 3f73917b1cd9a14f +5825 17506 1723882053241957400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o 88f28c44165cadbc +14725 24127 1723882060428248900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o 507d7e7578f1df0c +188357 201416 1723882237558003400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o cf01301631745c8 +129450 148080 1723882185793037500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o bee27a1b1c88a083 +113576 131860 1723882168485628000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o 47461e68ba0b4743 +5815 16080 1723882051644236800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o 8f54592f8a5c89f9 +21358 33578 1723882070781888600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o 2642a565135dc5c9 +213123 229346 1723882265764443400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o 203d9f6b9b6d154b +194148 204096 1723882240372405400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o a3a990e165c6301a +188540 204288 1723882240562952600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o 90db52901be28a3a +195713 213093 1723882249757635500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o d1a23fb876715176 +87749 97746 1723882134571192500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o 7d3977e7ed8dbbf8 +16087 28095 1723882064843348200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o 865607f13fbe4060 +66744 77267 1723882114996296800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o 8fcd8a455c332f71 +8708 21337 1723882057314211900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o ebabf830da32cbad +37328 50119 1723882085804264900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o f0d09e6720f548a0 +20362 29255 1723882066134783800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o 84e64e048bfe32ce +160820 175544 1723882213213813300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o 628aaa24db2091a2 +124755 138863 1723882176238038600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o 14f7dd9f5f7b7824 +101926 112148 1723882150105377800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o 2f412990f52218f +182351 199236 1723882235292963900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o f9da2c04f592f084 +225756 239090 1723882276609821500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o ca9031908abd1df0 +168780 181387 1723882219220517200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o 72d80d3d398bf35d +65495 79335 1723882117125011000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o 92b789838fa2eda2 +166916 176721 1723882214438736800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o 179e4f5fc7f59242 +210474 223608 1723882259510307200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o a33ce15baa16dbdc +27606 38262 1723882075827870700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o 7c0d989ded51a03 +38275 50963 1723882086614933400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o 34c9f231c58dbe6b +112151 125597 1723882161512754900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o ab38ea68eb8f5b0f +211663 223454 1723882259329476300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o 30e3b40b9ad9b51d +53455 66491 1723882103556647800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o 249566c231d05e05 +5773 16041 1723882051646942900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o 568eca9cbab16fad +188426 199797 1723882235865767700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o 31eb441dd64ac4d1 +113486 130498 1723882166961462500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o 1e552d4940f55ddc +163771 179824 1723882217617942200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o e893a3c9b3aa680a +41886 94727 1723883951840160700 libphysx.so 784622bce39f029f +91474 104216 1723882141720133100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o 8105ac13ed7b55f4 +90767 101296 1723882138490867400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o 344bc9b7319e5f6d +198497 208096 1723882244552588200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o d591c28a893c186 +222706 235553 1723882272654014900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o e426ed2a3c5105ef +36515 46523 1723882084323981500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o 2d5099eca251680d +61128 71997 1723882109553993200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o 5583da72cd3033d9 +5783 8690 1723882046450159000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o c49cd46f83a19cf9 +85369 97711 1723882134526624200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o bc5c758462fe3652 +156795 165913 1723882202771952900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o 49bcdc4cf0468bc7 +199828 206071 1723882242432168000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o b21eebf39614aead +5846 16207 1723882051871951800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o 1ec229dfd14a525f +223708 225505 1723882261486521300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o 64b8bb09b130c925 +28098 37147 1723882074681767100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o 1d162ecb66269393 +129395 130703 1723882167192889200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o 266c05469dc545c8 +56536 65468 1723882102456682000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o 914f1d8771ddfbae +230052 240428 1723882278103287200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o 1bc621dc1ef5a393 +160430 174778 1723882212426715000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o 3cc3e38be23f8199 +73820 89698 1723882125610526300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o a0d3a8620d217dcb +145121 157824 1723882193766600900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o d6987bb4e4348b71 +225540 238757 1723882276249493600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o 93603c2841397606 +200954 213827 1723882250529696100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o 29019a2d8321a77c +73352 87745 1723882123556056100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o f145475d82d23d29 +188799 198598 1723882234614592500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o 11aa3f61f923a52b +174907 188511 1723882224148095800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o 9b069ef07ebb393e +97778 107305 1723882144980438800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o 1204980f6629045d +79565 95540 1723882132093509600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o 669662a614739374 +127909 129426 1723882165776542400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o 7e4ac153b5751973 +41805 56496 1723882092508379400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o e73aade12514913e +156664 172553 1723882210086847700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o 4e66a15f0903ec3e +89940 99300 1723882136274131300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o 8962c1827edf3548 +170766 182957 1723882220772133200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o 7b1858a60e3cdc9d +222565 224297 1723882260200498000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o cccde401f8c3a218 +165433 178642 1723882216402029500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o 61a7123d566ecd23 +109453 124853 1723882160670834500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o 6b13f89e1c3e3480 +130729 142198 1723882179739252700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o 3b30cb59e74b4411 +109924 128834 1723882165114128800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o 83d755da22610d20 +98169 110608 1723882148455142700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o 2955acac6cc4bfe4 +128861 145155 1723882182796559100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o 32ac42db8e6828f4 +26206 35797 1723882073187135600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o c20b4d7d89cec3f8 +24141 36486 1723882073936766600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o 8f96ec35c9ec9ba0 +38570 50783 1723882086452443400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o 9a4509cac135fae2 +220823 222664 1723882258486116100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o b9af0caf887a4115 +125601 144098 1723882181690640900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o 323aebb43c09179a +174977 186995 1723882222662178300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o 943e453b101371d0 +91969 104017 1723882141509627300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o f0c66a8d3c6af8d5 +59696 69745 1723882107125727300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o 520f3d141bb8b457 +141940 154745 1723882190509751100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o a461fa5f983dcd08 +120380 136415 1723882173529426400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o bab46716d5117962 +172595 183822 1723882221616606100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o a17f6b927ce84e70 +5779 11322 1723882049186459900 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o dc5298b64d25e687 +224336 237128 1723882274421858400 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o 52b74b1546fd74e7 +128747 146817 1723882184530143200 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o 34d3efabcfc87b39 +217335 232448 1723882269211250500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o 5d3e3cd9ee7a74bc +85805 97684 1723882134513263100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o 7ffa4f0cb2dc0d67 +176575 189971 1723882225576019600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o 2ded8cad436c9352 +199900 205399 1723882241732291800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o 904aa1c31356241f +36050 45843 1723882083651637600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o 226d28504e2389d8 +166687 177379 1723882215100963800 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o 820f30bfa8172bd0 +84724 94715 1723882131186701500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o fb2bc8bfc0855d28 +207166 220797 1723882256559619300 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o 42b40f79d4ae419c +74616 89910 1723882125841654500 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o ac6e1b316456f485 +31144 44301 1723882082099472000 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o 3dd8338b76065e71 +50149 59745 1723882096051346100 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o b855cd24f93e207a +160588 174944 1723882212605166600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o 6396bf903e308e3e +5831 17001 1723882052720452700 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o 71c0bddf7a7e5c1e +5598 64047 1723886255750682600 CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o 68b6474de5da0384 +64056 111723 1723886304345860100 libphysx.so 784622bce39f029f diff --git a/modules/PhysX/physx/physx-build/build/CMakeCache.txt b/modules/PhysX/physx/physx-build/build/CMakeCache.txt new file mode 100644 index 0000000..0d6c47e --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeCache.txt @@ -0,0 +1,374 @@ +# This is the CMakeCache file. +# For build in directory: /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING=Release + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/pkgRedirects + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Program used to build from build.ninja files. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=physx + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +physx_BINARY_DIR:STATIC=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build + +//Value Computed by CMake +physx_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +physx_SOURCE_DIR:STATIC=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=28 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Ninja +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.28 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//linker supports push/pop state +_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE + diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCCompiler.cmake b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..b11488f --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCCompiler.cmake @@ -0,0 +1,74 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "13.2.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..3ee6cf0 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake @@ -0,0 +1,85 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "13.2.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin new file mode 100644 index 0000000..7bf0609 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100644 index 0000000..3fdc408 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeSystem.cmake b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeSystem.cmake new file mode 100644 index 0000000..9f73b3f --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.15.153.1-microsoft-standard-WSL2") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.15.153.1-microsoft-standard-WSL2") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-5.15.153.1-microsoft-standard-WSL2") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.15.153.1-microsoft-standard-WSL2") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..0a0ec9b --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,880 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/a.out b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/a.out new file mode 100644 index 0000000..8a279ac Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/a.out differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..9c9c90e --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,869 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/a.out b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/a.out new file mode 100644 index 0000000..4e346b8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/a.out differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/CMakeConfigureLog.yaml b/modules/PhysX/physx/physx-build/build/CMakeFiles/CMakeConfigureLog.yaml new file mode 100644 index 0000000..c7c1e0d --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/CMakeConfigureLog.yaml @@ -0,0 +1,509 @@ + +--- +events: + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:233 (message)" + - "CMakeLists.txt:3 (project)" + message: | + The system is: Linux - 5.15.153.1-microsoft-standard-WSL2 - x86_64 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:3 (project)" + message: | + Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. + Compiler: /usr/bin/cc + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + + The C compiler identification is GNU, found in: + /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdC/a.out + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:3 (project)" + message: | + Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. + Compiler: /usr/bin/c++ + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + + The CXX compiler identification is GNU, found in: + /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/3.28.3/CompilerIdCXX/a.out + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-K9ScCn" + binary: "/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-K9ScCn" + cmakeVariables: + CMAKE_C_FLAGS: "" + CMAKE_C_FLAGS_DEBUG: "-g" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-K9ScCn' + + Run Build Command(s): /usr/bin/ninja -v cmTC_1dd47 + [1/2] /usr/bin/cc -v -o CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_1dd47.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc523MyK.s + GNU C17 (Ubuntu 13.2.0-23ubuntu4) version 13.2.0 (x86_64-linux-gnu) + compiled by GNU C version 13.2.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: 35e51c4ef55ea8f6b448d85f0fac5984 + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/' + as -v --64 -o CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o /tmp/cc523MyK.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.' + [2/2] : && /usr/bin/cc -v CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -o cmTC_1dd47 && : + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1dd47' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_1dd47.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIssvoS.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1dd47 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1dd47' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_1dd47.' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + message: | + Parsed C implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + message: | + Parsed C implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-K9ScCn'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/ninja -v cmTC_1dd47] + ignore line: [[1/2] /usr/bin/cc -v -o CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_1dd47.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc523MyK.s] + ignore line: [GNU C17 (Ubuntu 13.2.0-23ubuntu4) version 13.2.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.2.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: 35e51c4ef55ea8f6b448d85f0fac5984] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o /tmp/cc523MyK.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.'] + ignore line: [[2/2] : && /usr/bin/cc -v CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -o cmTC_1dd47 && :] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_1dd47' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_1dd47.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccIssvoS.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_1dd47 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccIssvoS.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_1dd47] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_1dd47.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-EziMzI" + binary: "/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-EziMzI" + cmakeVariables: + CMAKE_CXX_FLAGS: "" + CMAKE_CXX_FLAGS_DEBUG: "-g" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-EziMzI' + + Run Build Command(s): /usr/bin/ninja -v cmTC_4fb11 + [1/2] /usr/bin/c++ -v -o CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_4fb11.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccN2BneH.s + GNU C++17 (Ubuntu 13.2.0-23ubuntu4) version 13.2.0 (x86_64-linux-gnu) + compiled by GNU C version 13.2.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13" + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/include/c++/13 + /usr/include/x86_64-linux-gnu/c++/13 + /usr/include/c++/13/backward + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: 4e0f319cd9945d8f5a9eeeeec1481ba5 + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/' + as -v --64 -o CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccN2BneH.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.' + [2/2] : && /usr/bin/c++ -v CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_4fb11 && : + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4fb11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_4fb11.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccsWg0l7.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4fb11 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4fb11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_4fb11.' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/13] + add: [/usr/include/x86_64-linux-gnu/c++/13] + add: [/usr/include/c++/13/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/13] ==> [/usr/include/c++/13] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/13] ==> [/usr/include/x86_64-linux-gnu/c++/13] + collapse include dir [/usr/include/c++/13/backward] ==> [/usr/include/c++/13/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:3 (project)" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/CMakeScratch/TryCompile-EziMzI'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/ninja -v cmTC_4fb11] + ignore line: [[1/2] /usr/bin/c++ -v -o CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_4fb11.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccN2BneH.s] + ignore line: [GNU C++17 (Ubuntu 13.2.0-23ubuntu4) version 13.2.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.2.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/13] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/13] + ignore line: [ /usr/include/c++/13/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: 4e0f319cd9945d8f5a9eeeeec1481ba5] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccN2BneH.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [[2/2] : && /usr/bin/c++ -v CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_4fb11 && :] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.2.0-23ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-uJ7kn6/gcc-13-13.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.2.0 (Ubuntu 13.2.0-23ubuntu4) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTC_4fb11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_4fb11.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccsWg0l7.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_4fb11 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccsWg0l7.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_4fb11] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_4fb11.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +... diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/TargetDirectories.txt b/modules/PhysX/physx/physx-build/build/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..62b12b5 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,3 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/physx.dir +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/edit_cache.dir +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/CMakeFiles/rebuild_cache.dir diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/cmake.check_cache b/modules/PhysX/physx/physx-build/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o new file mode 100644 index 0000000..7b57c8d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o new file mode 100644 index 0000000..d0e0d95 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o new file mode 100644 index 0000000..69d6df6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o new file mode 100644 index 0000000..464ddbe Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o new file mode 100644 index 0000000..ed015be Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o new file mode 100644 index 0000000..8459d0f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o new file mode 100644 index 0000000..5feb01f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o new file mode 100644 index 0000000..087237f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o new file mode 100644 index 0000000..195ca81 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o new file mode 100644 index 0000000..4b04f59 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o new file mode 100644 index 0000000..1a794bc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o new file mode 100644 index 0000000..d7521d2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o new file mode 100644 index 0000000..ff3fe92 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o new file mode 100644 index 0000000..968cd0a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o new file mode 100644 index 0000000..94971e5 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o new file mode 100644 index 0000000..8bb49a0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o new file mode 100644 index 0000000..6a96e19 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o new file mode 100644 index 0000000..8962836 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o new file mode 100644 index 0000000..e05d0b6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o new file mode 100644 index 0000000..55a969f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o new file mode 100644 index 0000000..9a4b1c4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o new file mode 100644 index 0000000..fbae2fe Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o new file mode 100644 index 0000000..09f64aa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o new file mode 100644 index 0000000..a7d8e20 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o new file mode 100644 index 0000000..f6f951e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o new file mode 100644 index 0000000..2928054 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o new file mode 100644 index 0000000..82f7142 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o new file mode 100644 index 0000000..a9842b1 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o new file mode 100644 index 0000000..dcc10d6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o new file mode 100644 index 0000000..a00e21d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o new file mode 100644 index 0000000..96f299c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o new file mode 100644 index 0000000..9cd991a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o new file mode 100644 index 0000000..ad978be Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o new file mode 100644 index 0000000..6af6efb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o new file mode 100644 index 0000000..1867033 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o new file mode 100644 index 0000000..1a115d4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o new file mode 100644 index 0000000..817fef2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o new file mode 100644 index 0000000..64f83f8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o new file mode 100644 index 0000000..d778cd9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o new file mode 100644 index 0000000..9676db2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o new file mode 100644 index 0000000..4b4e21c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o new file mode 100644 index 0000000..6fb1d51 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o new file mode 100644 index 0000000..c36ec7d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o new file mode 100644 index 0000000..33f2428 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o new file mode 100644 index 0000000..e400c65 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o new file mode 100644 index 0000000..a13685a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o new file mode 100644 index 0000000..010518b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o new file mode 100644 index 0000000..ac0704f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o new file mode 100644 index 0000000..3a0ce31 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o new file mode 100644 index 0000000..9f2c5d0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o new file mode 100644 index 0000000..d9ba129 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o new file mode 100644 index 0000000..6d0af6f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o new file mode 100644 index 0000000..80b8feb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o new file mode 100644 index 0000000..636f30f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o new file mode 100644 index 0000000..8f8d4aa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o new file mode 100644 index 0000000..9f7b730 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o new file mode 100644 index 0000000..671b2bf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o new file mode 100644 index 0000000..581822a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o new file mode 100644 index 0000000..b99e158 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o new file mode 100644 index 0000000..eebe011 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o new file mode 100644 index 0000000..766a4b3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o new file mode 100644 index 0000000..0a4d5f2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o new file mode 100644 index 0000000..067671d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o new file mode 100644 index 0000000..9de2994 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o new file mode 100644 index 0000000..6733da3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o new file mode 100644 index 0000000..ba490b4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o new file mode 100644 index 0000000..d59b1bb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o new file mode 100644 index 0000000..e3bd351 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o new file mode 100644 index 0000000..56f9c2b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o new file mode 100644 index 0000000..1fce96e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o new file mode 100644 index 0000000..827ffd3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o new file mode 100644 index 0000000..cf74e71 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o new file mode 100644 index 0000000..555ae42 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o new file mode 100644 index 0000000..dcf2b9f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o new file mode 100644 index 0000000..8c4c4e8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o new file mode 100644 index 0000000..8f8e944 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o new file mode 100644 index 0000000..be688c0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o new file mode 100644 index 0000000..a420496 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o new file mode 100644 index 0000000..860dd39 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o new file mode 100644 index 0000000..c35b547 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o new file mode 100644 index 0000000..ec33919 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o new file mode 100644 index 0000000..ae508b9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o new file mode 100644 index 0000000..a7eb986 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o new file mode 100644 index 0000000..c77bdbc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o new file mode 100644 index 0000000..597b607 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o new file mode 100644 index 0000000..5fead8e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o new file mode 100644 index 0000000..3de77eb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o new file mode 100644 index 0000000..8144830 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o new file mode 100644 index 0000000..4339308 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o new file mode 100644 index 0000000..d2f5f2e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o new file mode 100644 index 0000000..90822a2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o new file mode 100644 index 0000000..91777ba Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o new file mode 100644 index 0000000..0ec9a0e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o new file mode 100644 index 0000000..2b18081 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o new file mode 100644 index 0000000..74dfd89 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o new file mode 100644 index 0000000..441314b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o new file mode 100644 index 0000000..38a8ba5 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o new file mode 100644 index 0000000..9c60611 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o new file mode 100644 index 0000000..1812aa3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o new file mode 100644 index 0000000..d4a2a44 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o new file mode 100644 index 0000000..c78062c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o new file mode 100644 index 0000000..e3202e1 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o new file mode 100644 index 0000000..b8b9d66 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o new file mode 100644 index 0000000..282e305 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o new file mode 100644 index 0000000..66497ea Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o new file mode 100644 index 0000000..5e420c0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o new file mode 100644 index 0000000..afed32e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o new file mode 100644 index 0000000..d0c70a8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o new file mode 100644 index 0000000..6d6ccd2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o new file mode 100644 index 0000000..c40bdbb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o new file mode 100644 index 0000000..57c55c8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o new file mode 100644 index 0000000..964e629 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o new file mode 100644 index 0000000..d6bf25c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o new file mode 100644 index 0000000..15ee7a6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o new file mode 100644 index 0000000..a9cd1db Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o new file mode 100644 index 0000000..30223a6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o new file mode 100644 index 0000000..f6e533b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o new file mode 100644 index 0000000..c13117b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o new file mode 100644 index 0000000..55d6967 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o new file mode 100644 index 0000000..f1dbe5b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o new file mode 100644 index 0000000..066c82b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o new file mode 100644 index 0000000..0818d59 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o new file mode 100644 index 0000000..477b94d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o new file mode 100644 index 0000000..5659097 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o new file mode 100644 index 0000000..2150094 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o new file mode 100644 index 0000000..937b1d2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o new file mode 100644 index 0000000..2374e53 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o new file mode 100644 index 0000000..bd09b16 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o new file mode 100644 index 0000000..c698a68 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o new file mode 100644 index 0000000..bf4831e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o new file mode 100644 index 0000000..4850e21 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o new file mode 100644 index 0000000..60c2a6a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o new file mode 100644 index 0000000..4589f9d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o new file mode 100644 index 0000000..78a48d6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o new file mode 100644 index 0000000..16c1961 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o new file mode 100644 index 0000000..ff7d726 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o new file mode 100644 index 0000000..899dc45 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o new file mode 100644 index 0000000..d3e1712 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o new file mode 100644 index 0000000..002e10b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o new file mode 100644 index 0000000..a8c704f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o new file mode 100644 index 0000000..fb5e4d4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o new file mode 100644 index 0000000..9869d3a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o new file mode 100644 index 0000000..940fad6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o new file mode 100644 index 0000000..b6ad7b3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o new file mode 100644 index 0000000..940b1a8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o new file mode 100644 index 0000000..7920b64 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o new file mode 100644 index 0000000..4df5a86 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o new file mode 100644 index 0000000..1ac40f7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o new file mode 100644 index 0000000..626bf84 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o new file mode 100644 index 0000000..78bcbd4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o new file mode 100644 index 0000000..2b3b3bc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o new file mode 100644 index 0000000..19b123d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o new file mode 100644 index 0000000..814269e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o new file mode 100644 index 0000000..d7de062 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o new file mode 100644 index 0000000..277b6a9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o new file mode 100644 index 0000000..e0df642 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o new file mode 100644 index 0000000..72f502a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o new file mode 100644 index 0000000..7a9d037 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o new file mode 100644 index 0000000..787ad43 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o new file mode 100644 index 0000000..f9785fe Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o new file mode 100644 index 0000000..8415527 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o new file mode 100644 index 0000000..d0ba132 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o new file mode 100644 index 0000000..f2481c2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o new file mode 100644 index 0000000..8993362 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o new file mode 100644 index 0000000..aad896c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o new file mode 100644 index 0000000..e52b2a7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o new file mode 100644 index 0000000..624abe4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o new file mode 100644 index 0000000..0b80acd Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o new file mode 100644 index 0000000..fc956ec Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o new file mode 100644 index 0000000..8c3d996 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o new file mode 100644 index 0000000..a2d291a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o new file mode 100644 index 0000000..1b1567c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o new file mode 100644 index 0000000..73692c1 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o new file mode 100644 index 0000000..398dcaa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o new file mode 100644 index 0000000..1bb6fb4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o new file mode 100644 index 0000000..e16fad9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o new file mode 100644 index 0000000..66244f5 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o new file mode 100644 index 0000000..a833e1e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o new file mode 100644 index 0000000..5b6cf91 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o new file mode 100644 index 0000000..381b893 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o new file mode 100644 index 0000000..ae0f2b4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o new file mode 100644 index 0000000..889d167 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o new file mode 100644 index 0000000..9297e94 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o new file mode 100644 index 0000000..16833a8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o new file mode 100644 index 0000000..0d7b96b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o new file mode 100644 index 0000000..6430908 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o new file mode 100644 index 0000000..651278a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o new file mode 100644 index 0000000..a0cafec Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o new file mode 100644 index 0000000..d16bce2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o new file mode 100644 index 0000000..8d47708 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o new file mode 100644 index 0000000..4dbb350 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o new file mode 100644 index 0000000..db25c57 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o new file mode 100644 index 0000000..51244a2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o new file mode 100644 index 0000000..6d27b65 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o new file mode 100644 index 0000000..0cfa519 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o new file mode 100644 index 0000000..519caf0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o new file mode 100644 index 0000000..5059dfa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o new file mode 100644 index 0000000..132f0bf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o new file mode 100644 index 0000000..66b16d0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o new file mode 100644 index 0000000..73cdab3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o new file mode 100644 index 0000000..9ff2d0c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o new file mode 100644 index 0000000..8975e31 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o new file mode 100644 index 0000000..d02f725 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o new file mode 100644 index 0000000..b78c6f3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o new file mode 100644 index 0000000..bb984c8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o new file mode 100644 index 0000000..21eb3a9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o new file mode 100644 index 0000000..7f1f05a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o new file mode 100644 index 0000000..cf4c300 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o new file mode 100644 index 0000000..7a2324f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o new file mode 100644 index 0000000..3f2d34f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o new file mode 100644 index 0000000..f2367f5 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o new file mode 100644 index 0000000..24eae36 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o new file mode 100644 index 0000000..5dbb35e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o new file mode 100644 index 0000000..c2c3e2f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o new file mode 100644 index 0000000..06deaf1 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o new file mode 100644 index 0000000..2329f9f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o new file mode 100644 index 0000000..3d82450 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o new file mode 100644 index 0000000..e54bdfc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o new file mode 100644 index 0000000..058fe19 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o new file mode 100644 index 0000000..5d41409 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o new file mode 100644 index 0000000..e47799a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o new file mode 100644 index 0000000..1e5c818 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o new file mode 100644 index 0000000..6473314 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o new file mode 100644 index 0000000..364cfa3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o new file mode 100644 index 0000000..8466ac3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o new file mode 100644 index 0000000..3ec664d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o new file mode 100644 index 0000000..5f7ac49 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o new file mode 100644 index 0000000..e6fe6e7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o new file mode 100644 index 0000000..5d79f7c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o new file mode 100644 index 0000000..e56ead3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o new file mode 100644 index 0000000..d51e82f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o new file mode 100644 index 0000000..9ef3140 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o new file mode 100644 index 0000000..e7a7d52 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o new file mode 100644 index 0000000..c82e626 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o new file mode 100644 index 0000000..c3abff3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o new file mode 100644 index 0000000..5df3957 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o new file mode 100644 index 0000000..dc8d1f8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o new file mode 100644 index 0000000..edb9b9b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o new file mode 100644 index 0000000..e453efa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o new file mode 100644 index 0000000..ca5a72d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o new file mode 100644 index 0000000..7da3abb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o new file mode 100644 index 0000000..db92f10 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o new file mode 100644 index 0000000..9aea071 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o new file mode 100644 index 0000000..1b52f5e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o new file mode 100644 index 0000000..b3dc237 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o new file mode 100644 index 0000000..aca2785 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o new file mode 100644 index 0000000..68ca74c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o new file mode 100644 index 0000000..4267f11 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o new file mode 100644 index 0000000..acb55ac Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o new file mode 100644 index 0000000..fb47e95 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o new file mode 100644 index 0000000..c0f07e9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o new file mode 100644 index 0000000..8ba0769 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o new file mode 100644 index 0000000..d18b4a7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o new file mode 100644 index 0000000..29513ce Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o new file mode 100644 index 0000000..b4ed8f7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o new file mode 100644 index 0000000..3c50bf6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o new file mode 100644 index 0000000..91e60f2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o new file mode 100644 index 0000000..7421339 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o new file mode 100644 index 0000000..b471d6e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o new file mode 100644 index 0000000..b738e67 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o new file mode 100644 index 0000000..43e3711 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o new file mode 100644 index 0000000..515f953 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o new file mode 100644 index 0000000..615725f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o new file mode 100644 index 0000000..a650307 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o new file mode 100644 index 0000000..f0d9919 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o new file mode 100644 index 0000000..316c71d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o new file mode 100644 index 0000000..0cb2945 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o new file mode 100644 index 0000000..47c34e7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o new file mode 100644 index 0000000..2aa07b0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o new file mode 100644 index 0000000..9766fd7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o new file mode 100644 index 0000000..5d08866 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o new file mode 100644 index 0000000..6308b4f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o new file mode 100644 index 0000000..7e4adef Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o new file mode 100644 index 0000000..3f46a53 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o new file mode 100644 index 0000000..86ec349 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o new file mode 100644 index 0000000..6358a04 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o new file mode 100644 index 0000000..40d54aa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o new file mode 100644 index 0000000..a023978 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o new file mode 100644 index 0000000..2700bba Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o new file mode 100644 index 0000000..73b0a6e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o new file mode 100644 index 0000000..7ac62a6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o new file mode 100644 index 0000000..f064364 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o new file mode 100644 index 0000000..71edb7c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o new file mode 100644 index 0000000..f2da2cd Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o new file mode 100644 index 0000000..b77258e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o new file mode 100644 index 0000000..660de70 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o new file mode 100644 index 0000000..6e1932d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o new file mode 100644 index 0000000..b43f35b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o new file mode 100644 index 0000000..710166e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o new file mode 100644 index 0000000..1feaaaf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o new file mode 100644 index 0000000..de7d917 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o new file mode 100644 index 0000000..2b37c48 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o new file mode 100644 index 0000000..c037ae7 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o new file mode 100644 index 0000000..7a78a82 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o new file mode 100644 index 0000000..6a168ae Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o new file mode 100644 index 0000000..e15cf2e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o new file mode 100644 index 0000000..ba0bac4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o new file mode 100644 index 0000000..f368d70 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o new file mode 100644 index 0000000..64a6f95 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o new file mode 100644 index 0000000..1fd859f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o new file mode 100644 index 0000000..0b933c6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o new file mode 100644 index 0000000..1471303 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o new file mode 100644 index 0000000..a5b0588 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o new file mode 100644 index 0000000..e5ab93a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o new file mode 100644 index 0000000..67be0bf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o new file mode 100644 index 0000000..232d1bc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o new file mode 100644 index 0000000..23b0c39 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o new file mode 100644 index 0000000..b40b88c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o new file mode 100644 index 0000000..84ca4e4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o new file mode 100644 index 0000000..c6842bb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o new file mode 100644 index 0000000..c098c26 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o new file mode 100644 index 0000000..0f9e30a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o new file mode 100644 index 0000000..28ceb39 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o new file mode 100644 index 0000000..58b5295 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o new file mode 100644 index 0000000..5b85f4e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o new file mode 100644 index 0000000..247c427 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o new file mode 100644 index 0000000..535ea3b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o new file mode 100644 index 0000000..7ad36ca Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o new file mode 100644 index 0000000..de9ae46 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o new file mode 100644 index 0000000..85d9db4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o new file mode 100644 index 0000000..8ad44e3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o new file mode 100644 index 0000000..3625676 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o new file mode 100644 index 0000000..80f5109 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o new file mode 100644 index 0000000..bcba8fe Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o new file mode 100644 index 0000000..7b5b07e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o new file mode 100644 index 0000000..c00d8fe Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o new file mode 100644 index 0000000..9c44d5e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o new file mode 100644 index 0000000..168f8b2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o new file mode 100644 index 0000000..c299e2c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o new file mode 100644 index 0000000..9859062 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o new file mode 100644 index 0000000..061f0e2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o new file mode 100644 index 0000000..1d87624 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o new file mode 100644 index 0000000..159a66a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o new file mode 100644 index 0000000..fd3c8eb Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o new file mode 100644 index 0000000..b061e33 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o new file mode 100644 index 0000000..7b61bfd Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o new file mode 100644 index 0000000..5211095 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o new file mode 100644 index 0000000..14ce084 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o new file mode 100644 index 0000000..d38cc9c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o new file mode 100644 index 0000000..18f440d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o new file mode 100644 index 0000000..0b165f6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o new file mode 100644 index 0000000..a43949d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o new file mode 100644 index 0000000..d049115 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o new file mode 100644 index 0000000..d4ab261 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o new file mode 100644 index 0000000..8abca1c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o new file mode 100644 index 0000000..990e498 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o new file mode 100644 index 0000000..6c1c144 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o new file mode 100644 index 0000000..30f93aa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o new file mode 100644 index 0000000..1a0f360 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o new file mode 100644 index 0000000..ee1f8f6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o new file mode 100644 index 0000000..3526216 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o new file mode 100644 index 0000000..b952541 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o new file mode 100644 index 0000000..3d04869 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o new file mode 100644 index 0000000..967cf80 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o new file mode 100644 index 0000000..1b1a7b0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o new file mode 100644 index 0000000..408b1ed Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o new file mode 100644 index 0000000..ff3ee95 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o new file mode 100644 index 0000000..b919063 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o new file mode 100644 index 0000000..3996422 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o new file mode 100644 index 0000000..7d47165 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o new file mode 100644 index 0000000..b5ea4ea Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o new file mode 100644 index 0000000..38f77ae Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o new file mode 100644 index 0000000..49fb498 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o new file mode 100644 index 0000000..861d72e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o new file mode 100644 index 0000000..4eef835 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o new file mode 100644 index 0000000..57dafde Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o new file mode 100644 index 0000000..29fa745 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o new file mode 100644 index 0000000..c1c7a3c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o new file mode 100644 index 0000000..72473e2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o new file mode 100644 index 0000000..a7d7b2d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o new file mode 100644 index 0000000..ee76abc Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o new file mode 100644 index 0000000..b3adbf2 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o new file mode 100644 index 0000000..34d6a84 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o new file mode 100644 index 0000000..4b7408f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o new file mode 100644 index 0000000..8793431 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o new file mode 100644 index 0000000..7da6444 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o new file mode 100644 index 0000000..bce62b9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o new file mode 100644 index 0000000..74b01e0 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o new file mode 100644 index 0000000..03e87c5 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o new file mode 100644 index 0000000..65d48d9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o new file mode 100644 index 0000000..2ecc37f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o new file mode 100644 index 0000000..99a5c23 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o new file mode 100644 index 0000000..77839ad Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o new file mode 100644 index 0000000..bb78140 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o new file mode 100644 index 0000000..a773b75 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o new file mode 100644 index 0000000..05061d3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o new file mode 100644 index 0000000..975ae04 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o new file mode 100644 index 0000000..5f56a1b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o new file mode 100644 index 0000000..770eef4 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o new file mode 100644 index 0000000..e583878 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o new file mode 100644 index 0000000..75e1c65 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o new file mode 100644 index 0000000..519f19f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o new file mode 100644 index 0000000..8e4de03 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o new file mode 100644 index 0000000..5c7d641 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o new file mode 100644 index 0000000..a7f6204 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o new file mode 100644 index 0000000..63c4e9a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o new file mode 100644 index 0000000..ebc554e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o new file mode 100644 index 0000000..1543cce Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o new file mode 100644 index 0000000..b52b5bf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o new file mode 100644 index 0000000..53d5311 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o new file mode 100644 index 0000000..8151a7d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o new file mode 100644 index 0000000..4f7da49 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o new file mode 100644 index 0000000..a7100ad Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o new file mode 100644 index 0000000..acc131f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o new file mode 100644 index 0000000..d9beb8d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o new file mode 100644 index 0000000..d72143e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o new file mode 100644 index 0000000..7d84c9e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o new file mode 100644 index 0000000..8d109f8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o new file mode 100644 index 0000000..270e757 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o new file mode 100644 index 0000000..248674e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o new file mode 100644 index 0000000..682d5fa Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o new file mode 100644 index 0000000..44a21d6 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o new file mode 100644 index 0000000..dae9dc3 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o new file mode 100644 index 0000000..fc6736d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o new file mode 100644 index 0000000..4ec6266 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o new file mode 100644 index 0000000..b542baf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o new file mode 100644 index 0000000..6e674af Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o new file mode 100644 index 0000000..151fc0c Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o new file mode 100644 index 0000000..71f5161 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o new file mode 100644 index 0000000..8106b98 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o new file mode 100644 index 0000000..fb33a94 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o new file mode 100644 index 0000000..62fc72a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o new file mode 100644 index 0000000..1af5d6d Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o new file mode 100644 index 0000000..a06fe3b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o new file mode 100644 index 0000000..cb516cf Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o new file mode 100644 index 0000000..2894e08 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o new file mode 100644 index 0000000..6ae5561 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o new file mode 100644 index 0000000..62de69b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o new file mode 100644 index 0000000..562d59f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o new file mode 100644 index 0000000..f959a00 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o new file mode 100644 index 0000000..368907f Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o new file mode 100644 index 0000000..00a8b43 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o new file mode 100644 index 0000000..0277348 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o new file mode 100644 index 0000000..b420aba Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o new file mode 100644 index 0000000..8d41857 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o new file mode 100644 index 0000000..46870c8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o new file mode 100644 index 0000000..44df13b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o new file mode 100644 index 0000000..2871062 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o new file mode 100644 index 0000000..8d1b03a Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o new file mode 100644 index 0000000..c483cab Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o new file mode 100644 index 0000000..f1e8842 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o new file mode 100644 index 0000000..76e61d8 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o new file mode 100644 index 0000000..7bb25c1 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o new file mode 100644 index 0000000..b8d6d86 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o new file mode 100644 index 0000000..887d39e Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o new file mode 100644 index 0000000..d60bb14 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o new file mode 100644 index 0000000..3070081 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o new file mode 100644 index 0000000..b999a64 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o new file mode 100644 index 0000000..590a2ee Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o new file mode 100644 index 0000000..4e4fdf9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o new file mode 100644 index 0000000..c9e8a92 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o new file mode 100644 index 0000000..decc8ff Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o new file mode 100644 index 0000000..128369b Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o differ diff --git a/modules/PhysX/physx/physx-build/build/CMakeFiles/rules.ninja b/modules/PhysX/physx/physx-build/build/CMakeFiles/rules.ninja new file mode 100644 index 0000000..018a590 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/CMakeFiles/rules.ninja @@ -0,0 +1,64 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 3.28 + +# This file contains all the rules used to get the outputs files +# built from the input files. +# It is included in the main 'build.ninja'. + +# ============================================================================= +# Project: physx +# Configurations: Release +# ============================================================================= +# ============================================================================= + +############################################# +# Rule for compiling CXX files. + +rule CXX_COMPILER__physx_unscanned_Release + depfile = $DEP_FILE + deps = gcc + command = ${LAUNCHER}${CODE_CHECK}/usr/bin/c++ $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in + description = Building CXX object $out + + +############################################# +# Rule for linking CXX shared library. + +rule CXX_SHARED_LIBRARY_LINKER__physx_Release + command = $PRE_LINK && /usr/bin/c++ -fPIC $LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS $LINK_FLAGS -shared $SONAME_FLAG$SONAME -o $TARGET_FILE $in $LINK_PATH $LINK_LIBRARIES && $POST_BUILD + description = Linking CXX shared library $TARGET_FILE + restat = $RESTAT + + +############################################# +# Rule for running custom commands. + +rule CUSTOM_COMMAND + command = $COMMAND + description = $DESC + + +############################################# +# Rule for re-running cmake. + +rule RERUN_CMAKE + command = /usr/bin/cmake --regenerate-during-build -S/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build -B/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build + description = Re-running CMake... + generator = 1 + + +############################################# +# Rule for cleaning all built files. + +rule CLEAN + command = /usr/bin/ninja $FILE_ARG -t clean $TARGETS + description = Cleaning all built files... + + +############################################# +# Rule for printing all primary targets available. + +rule HELP + command = /usr/bin/ninja -t targets + description = All primary targets available: + diff --git a/modules/PhysX/physx/physx-build/build/build.ninja b/modules/PhysX/physx/physx-build/build/build.ninja new file mode 100644 index 0000000..8ef962d --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/build.ninja @@ -0,0 +1,3764 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Ninja" Generator, CMake Version 3.28 + +# This file contains all the build statements describing the +# compilation DAG. + +# ============================================================================= +# Write statements declared in CMakeLists.txt: +# +# Which is the root file. +# ============================================================================= + +# ============================================================================= +# Project: physx +# Configurations: Release +# ============================================================================= + +############################################# +# Minimal version of Ninja required by this file + +ninja_required_version = 1.5 + + +############################################# +# Set configuration variable for custom commands. + +CONFIGURATION = Release +# ============================================================================= +# Include auxiliary files. + + +############################################# +# Include rules file. + +include CMakeFiles/rules.ninja + +# ============================================================================= + +############################################# +# Logical path to working directory; prefix for absolute paths. + +cmake_ninja_workdir = /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/ +# ============================================================================= +# Object build statements for SHARED_LIBRARY target physx + + +############################################# +# Order-only phony target for physx + +build cmake_object_order_depends_target_physx: phony || CMakeFiles/physx.dir + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src + +build CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o: CXX_COMPILER__physx_unscanned_Release /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp || cmake_object_order_depends_target_physx + DEFINES = -DDISABLE_CUDA_PHYSX -DPX_GCC -DPX_LINUX -DPX_PHYSX_COMMON_EXPORTS -DPX_PHYSX_COOKING_EXPORTS -DPX_PHYSX_CORE_EXPORTS -DPX_PHYSX_FOUNDATION_EXPORTS -DPX_SUPPORT_PVD -Dphysx_EXPORTS + DEP_FILE = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o.d + FLAGS = -O3 -DNDEBUG -fPIC + INCLUDES = -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src/generated/unix -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/common/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/filebuf/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/pxshared/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/fastxml/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/task/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/foundation -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/api/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/collision -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/pipeline -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/common/include/utils -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevel/software/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowlevelaabb/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/lowleveldynamics/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/File -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Xml -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/serialization/Binary -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxextensions/src/tet -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/extensions/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcharacterkinematic/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/ccd -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/common -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/contact -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/convex -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/cooking -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/distance -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/gjk -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/hf -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/intersection -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/mesh -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/pcm -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/geomutils/src/sweep -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxcooking/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/pvd/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physxmetadata/core/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/physx/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/scenequery/src -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/include -I/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/../physx-sys/physx/physx/source/simulationcontroller/src + OBJECT_DIR = CMakeFiles/physx.dir + OBJECT_FILE_DIR = CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src + + +# ============================================================================= +# Link build statements for SHARED_LIBRARY target physx + + +############################################# +# Link the shared library libphysx.so + +build libphysx.so: CXX_SHARED_LIBRARY_LINKER__physx_Release CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingHF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Raycast.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactMethodImpl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcMaterialMethodImpl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsCCD.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSap.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetup.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCollection.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Convert.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive4W.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp.o CMakeFiles/physx.dir/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp.o + LANGUAGE_COMPILE_FLAGS = -O3 -DNDEBUG + OBJECT_DIR = CMakeFiles/physx.dir + POST_BUILD = : + PRE_LINK = : + SONAME = libphysx.so + SONAME_FLAG = -Wl,-soname, + TARGET_FILE = libphysx.so + TARGET_PDB = physx.so.dbg + + +############################################# +# Utility command for edit_cache + +build CMakeFiles/edit_cache.util: CUSTOM_COMMAND + COMMAND = cd /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build && /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. + DESC = No interactive CMake dialog available... + restat = 1 + +build edit_cache: phony CMakeFiles/edit_cache.util + + +############################################# +# Utility command for rebuild_cache + +build CMakeFiles/rebuild_cache.util: CUSTOM_COMMAND + COMMAND = cd /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build && /usr/bin/cmake --regenerate-during-build -S/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build -B/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build + DESC = Running CMake to regenerate build system... + pool = console + restat = 1 + +build rebuild_cache: phony CMakeFiles/rebuild_cache.util + +# ============================================================================= +# Target aliases. + +build physx: phony libphysx.so + +# ============================================================================= +# Folder targets. + +# ============================================================================= + +############################################# +# Folder: /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build + +build all: phony libphysx.so + +# ============================================================================= +# Built-in targets + + +############################################# +# Re-run CMake if any of its inputs changed. + +build build.ninja: RERUN_CMAKE | /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/CMakeLists.txt /usr/share/cmake-3.28/Modules/CMakeCInformation.cmake /usr/share/cmake-3.28/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.28/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-Initialize.cmake /usr/share/cmake-3.28/Modules/Platform/Linux.cmake /usr/share/cmake-3.28/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.28.3/CMakeCCompiler.cmake CMakeFiles/3.28.3/CMakeCXXCompiler.cmake CMakeFiles/3.28.3/CMakeSystem.cmake + pool = console + + +############################################# +# A missing CMake input file is not an error. + +build /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/CMakeLists.txt /usr/share/cmake-3.28/Modules/CMakeCInformation.cmake /usr/share/cmake-3.28/Modules/CMakeCXXInformation.cmake /usr/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake /usr/share/cmake-3.28/Modules/CMakeGenericSystem.cmake /usr/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake /usr/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake /usr/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake /usr/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake /usr/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU-C.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake /usr/share/cmake-3.28/Modules/Compiler/GNU.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU-C.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU-CXX.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-GNU.cmake /usr/share/cmake-3.28/Modules/Platform/Linux-Initialize.cmake /usr/share/cmake-3.28/Modules/Platform/Linux.cmake /usr/share/cmake-3.28/Modules/Platform/UnixPaths.cmake CMakeCache.txt CMakeFiles/3.28.3/CMakeCCompiler.cmake CMakeFiles/3.28.3/CMakeCXXCompiler.cmake CMakeFiles/3.28.3/CMakeSystem.cmake: phony + + +############################################# +# Clean all the built files. + +build clean: CLEAN + + +############################################# +# Print all primary targets available. + +build help: HELP + + +############################################# +# Make the all target the default. + +default all diff --git a/modules/PhysX/physx/physx-build/build/cmake_install.cmake b/modules/PhysX/physx/physx-build/build/cmake_install.cmake new file mode 100644 index 0000000..8b9ee21 --- /dev/null +++ b/modules/PhysX/physx/physx-build/build/cmake_install.cmake @@ -0,0 +1,54 @@ +# Install script for directory: /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "Release") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-build/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/modules/PhysX/physx/physx-build/build/libphysx.so b/modules/PhysX/physx/physx-build/build/libphysx.so new file mode 100644 index 0000000..31e37d9 Binary files /dev/null and b/modules/PhysX/physx/physx-build/build/libphysx.so differ diff --git a/modules/PhysX/physx/physx-sys-extract/.gitignore b/modules/PhysX/physx/physx-sys-extract/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/modules/PhysX/physx/physx-sys-extract/.gitignore @@ -0,0 +1 @@ +/target diff --git a/modules/PhysX/physx/physx-sys-extract/Cargo.lock b/modules/PhysX/physx/physx-sys-extract/Cargo.lock new file mode 100644 index 0000000..ba990ca --- /dev/null +++ b/modules/PhysX/physx/physx-sys-extract/Cargo.lock @@ -0,0 +1,56 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "physx-sys" +version = "0.11.5" +dependencies = [ + "bitflags", + "cc", +] + +[[package]] +name = "physx-sys-extract" +version = "0.1.0" +dependencies = [ + "physx-sys", +] diff --git a/modules/PhysX/physx/physx-sys-extract/Cargo.toml b/modules/PhysX/physx/physx-sys-extract/Cargo.toml new file mode 100644 index 0000000..8efb2be --- /dev/null +++ b/modules/PhysX/physx/physx-sys-extract/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "physx-sys-extract" +version = "0.1.0" +edition = "2021" + +[dependencies] +physx-sys = { path = "../physx-sys" } \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys-extract/src/main.rs b/modules/PhysX/physx/physx-sys-extract/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys-extract/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/modules/PhysX/physx/physx-sys/CHANGELOG.md b/modules/PhysX/physx/physx-sys/CHANGELOG.md new file mode 100644 index 0000000..fade5f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/CHANGELOG.md @@ -0,0 +1,233 @@ +# `physx-sys` Changelog + + + + +## [Unreleased] - ReleaseDate +## [0.11.5] - 2023-10-11 +### Added +- [PR#216](https://github.com/EmbarkStudios/physx-rs/pull/216) Support building for Android on aarch64 macOS hosts + +## [0.11.4] - 2023-09-18 +### Added +- [PR#212](https://github.com/EmbarkStudios/physx-rs/pull/212) Build physx with -fno-strict-aliasing. +- [PR#209](https://github.com/EmbarkStudios/physx-rs/pull/209) Add support for `x86_64-linux-android` + +## [0.11.3] - 2023-07-07 +### Fixed +- 0.11.2 release was broken (wrong case in path names). + +## [0.11.2] - 2023-07-07 +- [PR#201](https://github.com/EmbarkStudios/physx-rs/pull/201) Added `create_pre_and_post_raycast_filter_callback_func`, allowing custom pre and post filtering of query hits. + +## [0.11.1] - 2023-04-18 +### Fixed +- [PR#193](https://github.com/EmbarkStudios/physx-rs/pull/193) fixed an issue where `physx-sys` would be needlessly recompiled due to an incorrect filepath. + +## [0.11.0] - 2023-03-03 +### Changed +- [PR#191](https://github.com/EmbarkStudios/physx-rs/pull/191) resolved [#187](https://github.com/EmbarkStudios/physx-rs/issues/187) by replacing the deprecated `PxCooking` class with the non-deprecated free functions that implement the same functionality. + - phys_PxCreateCooking -> **removed** + - PxCooking_cookBVH -> phys_PxCookBVH + - PxCooking_createBVH -> phys_PxCreateBVH + - PxCooking_cookConvexMesh -> phys_PxCookConvexMesh + - PxCooking_createConvexMesh -> phys_PxCreateConvexMesh + - PxCooking_validateConvexMesh -> phys_PxValidateConvexMesh + - PxCooking_cookHeightField -> phys_PxCookHeightField + - PxCooking_cookTriangleMesh -> phys_PxCookTriangleMesh + - PxCooking_createTriangleMesh -> phys_PxCreateTriangleMesh + - PxCooking_validateTriangleMesh -> phys_PxValidateTriangleMesh + - PxCooking* -> **removed** + +### Removed +- [PR#191](https://github.com/EmbarkStudios/physx-rs/pull/191) removed the cooking functions for soft bodies and tetrahedron meshes, these are only used when targeting Cuda, which this crate explicitly doesn't support. + +## [0.10.0] - 2023-03-03 +### Changed +- [PR#183](https://github.com/EmbarkStudios/physx-rs/pull/183) resolved [#175](https://github.com/EmbarkStudios/physx-rs/issues/175) by upgrading from PhysX 4.1 to PhysX 5.1.3. See the [physx-sys](migration-4-5.md) migration guide for more information for updating your code to work with this big breaking change. + +## [0.8.2] - 2023-02-17 +### Added +- [PR#181](https://github.com/EmbarkStudios/physx-rs/pull/181) add raycast, sweep and overlap buffer and callback create and delete methods, and update example to show how to use them for scene raycasting + +### Fixed +- [PR#182](https://github.com/EmbarkStudios/physx-rs/pull/176) fixed a clippy lint that triggers in 1.66.0. + +## [0.8.1] - 2022-11-22 +### Fixed +- [PR#176](https://github.com/EmbarkStudios/physx-rs/pull/176) removed warnings as errors when building the C++ code. This is not useful for end users and just results in sadness when eg. using newer compiler versions that introduce new/improved warnings. + +## [0.8.0] - 2022-10-20 +- add new `create_assert_handler` function which uses the trampoline pattern to send asserts to Rust + +## [0.7.0] - 2022-10-19 + +- add new `create_error_callback` which uses the trampoline pattern to send Physx logging to Rust + +## [0.6.0] - 2022-10-03 + +- add new `create_profiler_callback` which uses the trampoline pattern to send profiling events to Rust. +- add new feature `profile` which will enable profiling in PhysX + +## [0.5.0] - 2022-08-10 + +- [PR#157](https://github.com/EmbarkStudios/physx-rs/pull/157) Remove cmake support +- [PR#154](https://github.com/EmbarkStudios/physx-rs/pull/154) Add support for `aarch64-unknown-linux-gnu` +- [PR#158](https://github.com/EmbarkStudios/physx-rs/pull/158) Update pre generated `aarch64-linux-android` files + - `PxRepXObject` typename field changed from `*const u8` to `*const i8` + - `PxDebugText` typename field changed from `*const u8` to `*const i8` + - `PxProfileScoped` typename field changed from `*const u8` to `*const i8` + - `PxVehicleGraphChannelDesc` typename field changed from `*mut u8` to `*mut i8` +- [PR#156](https://github.com/EmbarkStudios/physx-rs/pull/156) Update pre generated `aarch64-apple-darwin` files + - Adds `PxSpatialVelocity` to the `PxArticulationRootLinkData` struct as `linkVelocity` and `linkAcceleration` fields. +- [PR#153](https://github.com/EmbarkStudios/physx-rs/pull/153) Update clang/llvm lib used by `pxbind` and update `x86_64-apple-darwin`, `x86_64-pc-windows-msvc`, `x86_64-unknown-linux` pre generated files. + - Mostly an internal change but adds `PxSpatialVelocity` to the `PxArticulationRootLinkData` struct as `linkVelocity` and `linkAcceleration` fields. + +## [0.4.16] - 2021-12-21 +### Fixed + +- [PR#142](https://github.com/EmbarkStudios/physx-rs/pull/141) added the license texts to the crate, and added a note in the README about how to clarify the licenses in cargo deny until crates.io supports parentheses in license expressions. +- [PR#144](https://github.com/EmbarkStudios/physx-rs/pull/144) fixed a few clang warnings about set but unused variables. + +## [0.4.15] - 2021-08-22 + +### Changed + +- [PR#140](https://github.com/EmbarkStudios/physx-rs/pull/140) updated to Embark lint v0.4, though we allow several clippy lints at the moment due to how endemic a few of them are. + +### Fixed + +- [PR#140](https://github.com/EmbarkStudios/physx-rs/pull/140) updated the C++ code to fix several `unused-but-set-variable` errors when compiling with clang-13. + +## [0.4.14] - 2021-07-22 + +### Fixed + +- [PR#138](https://github.com/EmbarkStudios/physx-rs/pull/138) silenced the `dtor-name`, `suggest-overrides`, and `suggest-override-destructor` warnings in the cmake build to silence warnings causing [build failures in clang-11+](https://github.com/NVIDIAGameWorks/PhysX/issues/417). + +## [0.4.13] - 2021-05-03 + +### Fixed + +- [PR#135](https://github.com/EmbarkStudios/physx-rs/pull/135) Update PhysX submodule with ARM64 buildfix for Xcode 14.5 + +## [0.4.12] - 2020-12-03 + +### Added + +- [PR#123](https://github.com/EmbarkStudios/physx-rs/pull/123) Initial `aarch64-apple-darwin` support + +## [0.4.11] - 2020-12-03 + +### Added + +- [PR#198](https://github.com/EmbarkStudios/physx-rs/pull/98) Major refactor of + the high-level `physx` crate exposed the following low-level calls: + - `pub fn get_simulation_event_info(callback: *mut PxSimulationEventCallback,) -> *mut SimulationEventCallbackInfo;` + - `pub fn get_alloc_callback_user_data(alloc_callback: *mut PxAllocatorCallback) -> *mut c_void;` + +## [0.4.10] - 2020-10-20 + +### Added + +- [PR#94](https://github.com/EmbarkStudios/physx-rs/pull/94) Allow overriding the PxAllocatorCallback with a pair of custom callback functions + +## [0.4.9] - 2020-08-13 + +### Added + +- [PR#80](https://github.com/EmbarkStudios/physx-rs/pull/80) New way to register simulation event callbacks, supporting all callback types this time. + +## [0.4.8] - 2020-07-02 + +### Fixed + +- [PR#77](https://github.com/EmbarkStudios/physx-rs/pull/77) Ignore potential PhysX C++ compile warnings + +## [0.4.7] - 2020-07-02 + +### Fixed + +- [PR#76](https://github.com/EmbarkStudios/physx-rs/pull/76) Use proper `ANDROID_NDK_ROOT` env var instead of `NDK_HOME` + +## [0.4.6] - 2020-07-01 + +### Added + +- [PR#73](https://github.com/EmbarkStudios/physx-rs/pull/73) Added `create_raycast_filter_callback_func`, allowing custom filtering of raycast hits + +### Fixed + +- [PR#74](https://github.com/EmbarkStudios/physx-rs/pull/74) Fix Android NDK toolchain path selection on Mac & Windows + +## [0.4.4] - 2020-06-02 + +### Added + +- [PR#66](https://github.com/EmbarkStudios/physx-rs/pull/66) Added support for android (`aarch64`) to the build system and to `pxbind`. + +## [0.4.3] - 2020-05-27 + +### Fixed + +- [PR#70](https://github.com/EmbarkStudios/physx-rs/pull/70) cleaned up some build script problems for Windows. + +## [0.4.2] - 2020-05-25 + +### Fixed + +- [PR#67](https://github.com/EmbarkStudios/physx-rs/pull/67) Reduce crate size from 10 MB to 2.7 MB by removing unused PhysX binary files + +## [0.4.1] - 2020-05-07 + +### Fixed + +- [PR#62](https://github.com/EmbarkStudios/physx-rs/pull/62) fixed C++ compile warnings/errors when compiling with clang 10.0.0. + +## [0.4.0] - 2020-05-07 + +### Changed + +- Use `SetThreadDescription` inside PhysX on Windows 10 to get worker thread names in profilers, instead of just the debugger. +- [PR#59](https://github.com/EmbarkStudios/physx-rs/pull/59) made `cmake` into an optional, non-default, dependency for building the C++ code, in favor of just using the `cc` crate. CMake can be enabled via the `use-cmake` feature. +- [PR#59](https://github.com/EmbarkStudios/physx-rs/pull/59) updated the fork of the PhysX repository to include various changes to the C++ code to allow it to be cross-compiled for Windows via clang from Linux or Mac. +- [PR#59](https://github.com/EmbarkStudios/physx-rs/pull/59) added a `structgen` feature flag, to make the creation of the C++ executable that generates the Rust bindings for the C++ code optional, as the generated code is now checked in and should only need to be updated when PhysX itself is updated. + +## [0.3.0] - 2020-03-04 + +### Added + +- Ability to not run the default filter shader before the callback. + + +[Unreleased]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.5...HEAD +[0.11.5]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.4...physx-sys-v0.11.5 +[0.11.4]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.3...physx-sys-v0.11.4 +[0.11.3]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.2...physx-sys-v0.11.3 +[0.11.2]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.1...physx-sys-v0.11.2 +[0.11.1]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.11.0...physx-sys-v0.11.1 +[0.11.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.10.0...physx-sys-v0.11.0 +[0.10.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.8.2...physx-sys-v0.10.0 +[0.8.2]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.8.1...physx-sys-v0.8.2 +[0.8.1]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.8.0...physx-sys-v0.8.1 +[0.8.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.7.0...physx-sys-v0.8.0 +[0.7.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.6.0...physx-sys-v0.7.0 +[0.6.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.5.0...physx-sys-v0.6.0 +[0.5.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.16...physx-sys-v0.5.0 +[0.4.16]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.15...physx-sys-v0.4.16 +[0.4.15]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.14...physx-sys-v0.4.15 +[0.4.14]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.13...physx-sys-v0.4.14 +[0.4.13]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.12...physx-sys-v0.4.13 +[0.4.12]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.11...physx-sys-v0.4.12 +[0.4.11]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.10...physx-sys-v0.4.11 +[0.4.10]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.9...physx-sys-v0.4.10 +[0.4.9]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.8...physx-sys-v0.4.9 +[0.4.8]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.7...physx-sys-v0.4.8 +[0.4.7]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.6...physx-sys-v0.4.7 +[0.4.6]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.4...physx-sys-v0.4.6 +[0.4.4]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.3...physx-sys-v0.4.4 +[0.4.3]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.2...physx-sys-v0.4.3 +[0.4.2]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.1...physx-sys-v0.4.2 +[0.4.1]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.4.0...physx-sys-v0.4.1 +[0.4.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.3.0...physx-sys-v0.4.0 +[0.3.0]: https://github.com/EmbarkStudios/physx-rs/compare/physx-sys-v0.2.4...physx-sys-v0.3.0 diff --git a/modules/PhysX/physx/physx-sys/Cargo.lock b/modules/PhysX/physx/physx-sys/Cargo.lock new file mode 100644 index 0000000..5ad8fca --- /dev/null +++ b/modules/PhysX/physx/physx-sys/Cargo.lock @@ -0,0 +1,49 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "physx-sys" +version = "0.11.5" +dependencies = [ + "bitflags", + "cc", +] diff --git a/modules/PhysX/physx/physx-sys/Cargo.toml b/modules/PhysX/physx/physx-sys/Cargo.toml new file mode 100644 index 0000000..6597b64 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/Cargo.toml @@ -0,0 +1,58 @@ +[package] +name = "physx-sys" +description = "Unsafe bindings for NVIDIA PhysX C++ SDK" +version = "0.11.5" +authors = [ + "Embark ", + "Tomasz Stachowiak ", +] +license = "(MIT OR Apache-2.0) AND BSD-3-Clause" +repository = "https://github.com/EmbarkStudios/physx-rs" +edition = "2021" +build = "build.rs" +readme = "README.md" +keywords = ["physics"] +categories = ["external-ffi-bindings", "simulation", "game-engines"] +exclude = [ + "PhysX/**/*.bat", + "PhysX/**/*.html", + "PhysX/**/*.sh", + "PhysX/*demo/**/*", + "PhysX/externals/cg-linux/**/*", + "PhysX/externals/clang-physxmetadata/**/*", + "PhysX/externals/glew-linux/**/*", + "PhysX/externals/glew/**/*", + "PhysX/externals/opengl-linux/**/*", + "PhysX/externals/targa/**/*", + "PhysX/externals/vswhere/**/*", + "PhysX/physx/bin/**/*", + "PhysX/physx/buildtools/**/*", + "PhysX/physx/documentation/**/*", + "PhysX/physx/samples/**/*", + "PhysX/physx/snippets/**/*", + "PhysX/physx/tools/**/*", +] + +[lib] +doctest = false +crate-type = ["staticlib"] + +[features] +# This feature will build and run the structgen program, generating C++ and Rust +# code to ensure the record types used in FFI match exactly and can be transparently +# memcopied. This feature is not normally needed for tier 1 platforms and Android +# as the crate includes pre-generated ones +structgen = [] +profile = [] +# Enables `Debug` derivations for the FFI structures, which can be useful for +# print debugging +debug-structs = [] +# Enables warnings in when compiling the C++ code. This is not something you should care about +cpp-warnings = [] + +[dependencies] +# The PhysX API exposes several enums used as flags +bitflags = "1.3" + +[build-dependencies] +cc = { version = "1.0", features = ["parallel"] } diff --git a/modules/PhysX/physx/physx-sys/LICENSE b/modules/PhysX/physx/physx-sys/LICENSE new file mode 100644 index 0000000..b03d8aa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/LICENSE @@ -0,0 +1 @@ +# SPDX-License-Identifier: (MIT OR Apache-2.0) AND BSD-3-Clause diff --git a/modules/PhysX/physx/physx-sys/LICENSE-APACHE b/modules/PhysX/physx/physx-sys/LICENSE-APACHE new file mode 100644 index 0000000..11069ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/modules/PhysX/physx/physx-sys/LICENSE-BSD b/modules/PhysX/physx/physx-sys/LICENSE-BSD new file mode 100644 index 0000000..c39b0b8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/LICENSE-BSD @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (c) 2023, NVIDIA Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules/PhysX/physx/physx-sys/LICENSE-MIT b/modules/PhysX/physx/physx-sys/LICENSE-MIT new file mode 100644 index 0000000..0f523e0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2021 Embark Studios + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/modules/PhysX/physx/physx-sys/README.md b/modules/PhysX/physx/physx-sys/README.md new file mode 100644 index 0000000..03d4610 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/README.md @@ -0,0 +1,113 @@ +
+ +# 🎳 physx-sys + +**Unsafe automatically-generated Rust bindings for [NVIDIA PhysX 5.1](https://github.com/NVIDIA-Omniverse/PhysX) C++ API.** + +![Build Status](https://github.com/EmbarkStudios/physx-rs/workflows/CI/badge.svg) +[![Crates.io](https://img.shields.io/crates/v/physx-sys.svg)](https://crates.io/crates/physx-sys) +[![Docs](https://docs.rs/physx-sys/badge.svg)](https://docs.rs/physx-sys) +[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4%20adopted-ff69b4.svg)](../CODE_OF_CONDUCT.md) +[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](http://embark.games) +[![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS) + +
+ +Please also see the [repository](https://github.com/EmbarkStudios/physx-rs) containing a work-in-progress safe wrapper. + +## Presentation + +[Tomasz Stachowiak](https://github.com/h3r2tic) did a presentation at the Stockholm Rust Meetup on October 2019 about this project that goes through the technical details of how C++ to Rust bindings of `physx-sys` works: + +[![An unholy fusion of Rust and C++ in physx-rs (Stockholm Rust Meetup, October 2019)](http://img.youtube.com/vi/RxtXGeDHu0w/0.jpg)](http://www.youtube.com/watch?v=RxtXGeDHu0w) + +## Basic usage + +```rust +unsafe { + let foundation = physx_create_foundation(); + let physics = physx_create_physics(foundation); + + let mut scene_desc = PxSceneDesc_new(PxPhysics_getTolerancesScale(physics)); + scene_desc.gravity = PxVec3 { + x: 0.0, + y: -9.81, + z: 0.0, + }; + + let dispatcher = phys_PxDefaultCpuDispatcherCreate( + 1, + null_mut(), + PxDefaultCpuDispatcherWaitForWorkMode::WaitForWork, + 0, + ); + scene_desc.cpuDispatcher = dispatcher.cast(); + scene_desc.filterShader = get_default_simulation_filter_shader(); + + let scene = PxPhysics_createScene_mut(physics, &scene_desc); + + // Your physics simulation goes here +} +``` + +## Examples + +### [Ball](examples/ball.rs) + +A simple example to showcase how to use physx-sys. It can be run with `cargo run --examples ball`. + +```txt + o + + o + o + + o + ooooooooo + o oo oo + o o + o o o + o oo + o o o + o ooooooo + o o oo oo + o o o oo oo + o o o o ooooooooo + o o o oo oooooooooo oo + +``` + +## How it works + +The binding is generated using a custom Rust app that parses the abstract syntax tree of the SDK, and maps the C++ PhysX functions and types to Rust using heuristics chosen specifically for this SDK. It is not a general C++ <-> Rust binding generator, and using it on other projects *will* likely crash and burn. + +Since C++ does not have a standardized and stable ABI, it's generally not safe to call it from Rust code; since PhysX exposes a C++ interface, we can't use it directly. That's why `physx-sys` generates both a Rust interface as well as a plain C wrapper. The C code is compiled into a static library at build time, and Rust then talks to C. + +In order to minimize the amount of work required to marshall data between the C wrapper and the original C++ API, we generate a **bespoke C wrapper for each build target**. The wrapper is based on metadata about structure layout extracted directly from compiling and running a tiny program against the PhysX SDK using the specific C++ compiler used in the build process. + +The build process comprises a few steps: + +1. The `pxbind` utility uses `clang` to extract metadata about PhysX functions and types, and generates partial Rust and C bindings as `physx_generated.hpp` and `physx_generated.rs`. Those contain all function definitions, and a small subset of types. It also generates a C++ utility called `structgen` by emitting `structgen.cpp`. +2. `structgen` is compiled against the PhysX SDK, and generates all the remaining type wrappers. For each struct, it queries the size and offset of its members, and generates `structgen_out.hpp` and `structgen_out.rs`. The types are "plain old data" structs which will perfectly match the memory layout of the C++ types. +3. All the generated C types are compiled together to form `physx_api`, a static library for Rust to link with. +4. The Rust wrapper is compiled, and linked with PhysX and the C wrapper. + +Steps *2..4* are performed completely automatically from within `build.rs`, while step *1* is only necessary when upgrading the PhysX SDK or modifying the generator. As such, building and running `pxbind` is a manual task, and is currently only supported on \*nix systems. + +## License + +Licensed under either of + +* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or ) +* MIT license ([LICENSE-MIT](LICENSE-MIT) or ) + +at your option. + +Note that the [PhysX C++ SDK](https://github.com/NVIDIA-Omniverse/PhysX) has its [own BSD 3 license](LICENSE-BSD). + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the Apache-2.0 +license, shall be dual licensed as above, without any additional terms or +conditions. diff --git a/modules/PhysX/physx/physx-sys/build.rs b/modules/PhysX/physx/physx-sys/build.rs new file mode 100644 index 0000000..d52006a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/build.rs @@ -0,0 +1,654 @@ +#![allow(dead_code)] + +use std::{env, path::PathBuf}; + +struct Environment { + host: String, + emit_debug_info: bool, + target_compiler: Option, + target_os: String, + target_env: Option, + mode: String, + static_crt: bool, +} + +struct Context { + root: PathBuf, + builder: cc::Build, + env: Environment, + includes: Vec, +} + +impl Context { + fn add_includes(&mut self, rel_root: &str, includes: &[&str]) -> &mut Self { + let root = self.root.join(rel_root); + self.includes + .extend(includes.iter().map(|inc| root.join(inc))); + + self + } + + fn add_sources(&mut self, rel_root: &str, files: &[&str]) -> &mut Self { + let root = self.root.join(rel_root); + self.builder.files(files.iter().map(|src| { + let mut p = root.join(src); + p.set_extension("cpp"); + p + })); + + // Always add the src directory as an include as well + self.includes.push(root); + + self + } + + fn add_component(&mut self, name: &str, rel: Option<&str>, sources: &[&str]) -> &mut Self { + let mut src_dir = format!("source/{name}"); + if let Some(rel) = rel { + src_dir.push('/'); + src_dir.push_str(rel); + } + self.add_sources(&src_dir, sources); + + let mut comproot = self.root.join("include"); + comproot.push(name); + + if comproot.exists() { + self.includes.push(comproot); + } + + let mut comproot = self.root.join("source"); + comproot.push(name); + comproot.push("include"); + + if comproot.exists() { + self.includes.push(comproot); + } + + self + } +} + +macro_rules! component { + ($name:ident) => { + fn $name(ctx: &mut Context) { + let sources = include!(concat!("sources/", stringify!($name))); + ctx.add_component(stringify!($name), Some("src"), &sources); + } + }; +} + +component! {common} +component! {fastxml} +component! {lowlevelaabb} +component! {lowleveldynamics} +component! {pvd} +component! {scenequery} +component! {simulationcontroller} +component! {task} + +// The foundation component is really the only one that references platform +// specific compilands, so just calculate them here +fn foundation(ctx: &mut Context) { + let sources = include!("sources/foundation"); + ctx.add_component("foundation", None, &sources); + + let target_family = env::var("CARGO_CFG_TARGET_FAMILY").expect("TARGET_FAMILY not specified"); + let sources = match target_family.as_str() { + "unix" => &include!("sources/foundation_unix"), + "windows" => &include!("sources/foundation_windows"), + other => panic!("unknown TARGET_FAMILY '{}'", other), + }; + + ctx.add_sources(&format!("source/foundation/{target_family}"), sources); +} + +fn lowlevel(ctx: &mut Context) { + // API + ctx.builder + .file(ctx.root.join("source/lowlevel/api/src/px_globals.cpp")); + + // pipeline + { + let sources = include!("sources/lowlevel_pipeline"); + ctx.add_sources("source/lowlevel/common/src/pipeline", &sources); + } + + // software, otherwise known as non-gpu + { + let sources = include!("sources/lowlevel_software"); + ctx.add_sources("source/lowlevel/software/src", &sources); + } + + ctx.add_includes( + "source/lowlevel", + &[ + "api/include", + "common/include/collision", + "common/include/pipeline", + "common/include/utils", + "software/include", + ], + ); +} + +fn vehicle(ctx: &mut Context) { + let sources = include!("sources/vehicle"); + ctx.add_component("physxvehicle", Some("src"), &sources); + + let sources = include!("sources/vehicle_metadata"); + ctx.add_sources("source/physxvehicle/src/physxmetadata/src", &sources); + + ctx.add_includes("source/physxvehicle/src/physxmetadata", &["include"]); +} + +fn extensions(ctx: &mut Context) { + let sources = include!("sources/extensions"); + ctx.add_component("physxextensions", Some("src"), &sources); + + // metadata + ctx.add_sources( + "source/physxmetadata/extensions/src", + &["PxExtensionAutoGeneratedMetaDataObjects"], + ); + + // serialization + let sources = include!("sources/extensions_serialization"); + ctx.add_sources("source/physxextensions/src/serialization", &sources); + ctx.add_includes("source/physxextensions/src/serialization", &["File"]); + + // xml + let sources = include!("sources/extensions_xml"); + ctx.add_sources("source/physxextensions/src/serialization/Xml", &sources); + + // binary + let sources = include!("sources/extensions_binary"); + ctx.add_sources("source/physxextensions/src/serialization/Binary", &sources); + + // tet + let sources = include!("sources/extensions_tet"); + ctx.add_sources("source/physxextensions/src/tet", &sources); + + ctx.add_includes("source/physxmetadata/extensions", &["include"]); +} + +fn physxcharacterkinematic(ctx: &mut Context) { + // root + let sources = include!("sources/physxcharacterkinematic"); + ctx.add_sources("source/physxcharacterkinematic/src", &sources); + ctx.add_includes("source/include", &["characterkinematic"]); +} + +fn geomutils(ctx: &mut Context) { + // root + let sources = include!("sources/geomutils"); + ctx.add_sources("source/geomutils/src", &sources); + ctx.add_includes("source/geomutils", &["include"]); + + // ccd + let sources = include!("sources/geomutils_ccd"); + ctx.add_sources("source/geomutils/src/ccd", &sources); + + // common + let sources = include!("sources/geomutils_common"); + ctx.add_sources("source/geomutils/src/common", &sources); + + // contact + let sources = include!("sources/geomutils_contact"); + ctx.add_sources("source/geomutils/src/contact", &sources); + + // convex + let sources = include!("sources/geomutils_convex"); + ctx.add_sources("source/geomutils/src/convex", &sources); + + // cooking + let sources = include!("sources/geomutils_cooking"); + ctx.add_sources("source/geomutils/src/cooking", &sources); + + // distance + let sources = include!("sources/geomutils_distance"); + ctx.add_sources("source/geomutils/src/distance", &sources); + + // gjk + let sources = include!("sources/geomutils_gjk"); + ctx.add_sources("source/geomutils/src/gjk", &sources); + + // hf + let sources = include!("sources/geomutils_hf"); + ctx.add_sources("source/geomutils/src/hf", &sources); + + // intersection + let sources = include!("sources/geomutils_intersection"); + ctx.add_sources("source/geomutils/src/intersection", &sources); + + // mesh + let sources = include!("sources/geomutils_mesh"); + ctx.add_sources("source/geomutils/src/mesh", &sources); + + // pcm + let sources = include!("sources/geomutils_pcm"); + ctx.add_sources("source/geomutils/src/pcm", &sources); + + // sweep + let sources = include!("sources/geomutils_sweep"); + ctx.add_sources("source/geomutils/src/sweep", &sources); +} + +fn cooking(ctx: &mut Context) { + // root + let sources = include!("sources/cooking"); + ctx.add_sources("source/physxcooking/src", &sources); + ctx.add_includes("source/include", &["cooking"]); +} + +fn physx(ctx: &mut Context) { + // metadata + { + let sources = ["PxAutoGeneratedMetaDataObjects", "PxMetaDataObjects"]; + ctx.add_sources("source/physxmetadata/core/src", &sources); + ctx.add_includes("source", &["physxmetadata/core/include"]); + } + + // immediate mode + ctx.builder.file( + ctx.root + .join("source/immediatemode/src/NpImmediateMode.cpp"), + ); + + // there's always a "core" + let sources = include!("sources/core"); + ctx.add_sources("source/physx/src", &sources); +} + +fn add_common(ctx: &mut Context) { + let shared_root = ctx.root.parent().unwrap().join("pxshared"); + + let builder = &mut ctx.builder; + let ccenv = &ctx.env; + let root = &ctx.root; + builder.cpp(true); + + // These includes are used by pretty much everything so just add them first + if ccenv.target_os == "android" { + builder.define("ANDROID", None); + let ndk_path = PathBuf::from( + env::var("ANDROID_NDK_ROOT") + .expect("environment variable \"ANDROID_NDK_ROOT\" has not been set"), + ); + let host_str = ccenv.host.as_str(); + let ndk_toolchain = match host_str { + "x86_64-pc-windows-msvc" => "windows-x86_64", + "x86_64-unknown-linux-gnu" => "linux-x86_64", + "x86_64-apple-darwin" | "aarch64-apple-darwin" => "darwin-x86_64", + _ => panic!( + "Host triple {} is unsupported for cross-compilation to Android", + host_str + ), + }; + let sysroot_path = ndk_path + .join("toolchains/llvm/prebuilt") + .join(ndk_toolchain) + .join("sysroot"); + if !sysroot_path.exists() { + panic!( + "Can't find Android NDK sysroot path \"{}\"", + sysroot_path.to_str().unwrap() + ); + } + builder.flag(&format!("--sysroot={}", &sysroot_path.to_str().unwrap())); + builder.cpp_link_stdlib("c++"); + } + + ctx.includes.push(shared_root.join("include")); + ctx.includes.extend( + [ + "include", + "source/foundation/include", + "source/common/src", + "source/filebuf/include", // only used by pvd + ] + .iter() + .map(|inc| root.join(inc)), + ); + + // If we're targetting msvc, just silence all the annoying warnings + if ccenv.target_env.as_deref() == Some("msvc") { + builder + .define("_CRT_SECURE_NO_WARNINGS", None) + .define("_WINSOCK_DEPRECATED_NO_WARNINGS", None) + .define("_ITERATOR_DEBUG_LEVEL", "0"); + } + + // Always build as a static library + builder.define("PX_PHYSX_STATIC_LIB", None); + // Always disable GPU features, at least for now + builder.define("DISABLE_CUDA_PHYSX", None); + + if ccenv.emit_debug_info { + builder.define("PX_DEBUG", None).define("PX_CHECKED", None); + } + + builder.define("PX_SUPPORT_PVD", "1"); + + if cfg!(feature = "profile") { + builder.define("PX_PROFILE", "1"); + } + + // If we're on linux, we already require clang++ for structgen, for reasons, + // so just force clang++ for the normal compile as well...except in the case + // where a user has expliclity set CXX.... + // We _also_ set it explicitly for mac hosts, due to cc-rs's current + // compiler detection, as macos uses cc still, but it's actually a symlink + // to clang++, but that means that cc rs will by default think the compiler + // is gcc + if (ccenv.host.contains("-linux-") || ccenv.host == "x86_64-apple-darwin") + && ccenv.target_compiler.is_none() + { + builder.compiler("clang++"); + } + + let flags = if builder.get_compiler().is_like_clang() || builder.get_compiler().is_like_gnu() { + vec![ + "-std=c++14", + // Disable all warnings + "-w", + // Many reinterpret_cast tricks in physx break down if we do not disable strict-aliasing + "-fno-strict-aliasing", + ] + } else if builder.get_compiler().is_like_msvc() { + // Disable defaults since we disagree with cc in some cases, this + // means we have to manually set eg profile and debug flags that + // would normally be set by default + builder.no_default_flags(true); + + // We don't care about logos, but we absolutley care about not having + // long compile times + let mut flags = vec!["-nologo", "/MP"]; + + if ccenv.static_crt { + flags.push("/MT"); + } else { + flags.push("/MD"); + } + + if ccenv.emit_debug_info { + flags.push("/Z7"); + } + + if ccenv.mode.as_str() == "profile" { + flags.push("/O2"); + } + + flags.push("/std:c++14"); + + flags + } else { + vec![] + }; + + for flag in flags { + builder.flag(flag); + } + + // Physx requires either _DEBUG or NDEBUG be set, fine. Except, NEVER set + // _DEBUG on windows, or at least for clang-cl, because it will then think + // it should link the debug version of the CRT, which will _never_ work + // for rust because rust _always_ links the release version of the CRT + // (either static or dynamic depending on the crt-static target feature), + // there is some internal code in physx that uses _DEBUG but I don't know + // if we will ever actually care. That being said, this is all terrible. + builder.define("NDEBUG", "1"); + + // cc sets PIC by default for most targets, but if we're compiling with + // clang for windows, we need to unset it, as clang (at least as of 9) + // doesn't support it + if builder.get_compiler().is_like_clang() && ccenv.target_os == "windows" { + builder.pic(false); + } +} + +fn cc_compile(target_env: Environment) { + let root = env::current_dir().unwrap().join("physx/physx"); + + let ccenv = target_env; + + let mut ctx = Context { + builder: cc::Build::new(), + root, + env: ccenv, + includes: Vec::with_capacity(1000), + }; + + add_common(&mut ctx); + + // Add the sources and includes for each major physx component + fastxml(&mut ctx); + task(&mut ctx); + foundation(&mut ctx); + lowlevel(&mut ctx); + lowlevelaabb(&mut ctx); + lowleveldynamics(&mut ctx); + vehicle(&mut ctx); + extensions(&mut ctx); + physxcharacterkinematic(&mut ctx); + common(&mut ctx); + geomutils(&mut ctx); + cooking(&mut ctx); + pvd(&mut ctx); + physx(&mut ctx); + scenequery(&mut ctx); + simulationcontroller(&mut ctx); + + ctx.includes.push(ctx.root.join("source/pvd/include")); + + // Strip out duplicate include paths, C++ already has it hard enough as it is + ctx.includes.sort(); + ctx.includes.dedup(); + + for dir in ctx.includes { + ctx.builder.include(dir); + } + + ctx.builder.compile("physx"); +} + +fn main() { + // Use the optimization level to determine the build profile to pass, we + // don't use cfg!(debug_assertions) here because I'm not sure what happens + // with that when build dependencies are configured to be debug and the + // actual target is meant to be release, so this seems safer + let build_mode = match env::var("OPT_LEVEL") + .ok() + .and_then(|s| s.parse::().ok()) + .unwrap_or(1) + { + 0 => "debug", + _ => "profile", + }; + + let target = env::var("TARGET").expect("TARGET not specified"); + let host = env::var("HOST").expect("HOST not specified"); + + // Acquire the user-specified c++ compiler if one has been set, in the same + // order and manner that cc-rs will do it + let compiler = { + env::var(format!("CXX_{target}")) + .or_else(|_| { + let target_under = target.replace('-', "_"); + env::var(format!("CXX_{target_under}")) + }) + .or_else(|_| env::var("TARGET_CXX")) + .or_else(|_| env::var("CXX")) + .ok() + }; + + { + let target_os = env::var("CARGO_CFG_TARGET_OS").expect("target os not specified"); + let target_env = env::var("CARGO_CFG_TARGET_ENV").ok(); + let static_crt = env::var("CARGO_CFG_TARGET_FEATURE") + .unwrap_or_default() + .contains("crt-static"); + + let environment = Environment { + emit_debug_info: env::var("DEBUG") + .ok() + .and_then(|s| s.parse::().ok()) + .unwrap_or(false), + target_compiler: compiler.clone(), + target_os, + target_env, + mode: build_mode.to_owned(), + host: host.clone(), + static_crt, + }; + + cc_compile(environment); + } + + let mut cc_builder = cc::Build::new(); + let physx_cc = cc_builder + .cpp(true) + .opt_level(3) + .debug(false) + .use_plt(false) + .warnings(false) + .extra_warnings(false) + .define("NDEBUG", None) + .define("PX_PHYSX_STATIC_LIB", None) + .include("physx/physx/include") + .include("physx/pxshared/include") + .include("physx/physx/source/foundation/include"); + + if cfg!(feature = "profile") { + physx_cc.define("PX_PROFILE", Some("1")); + } + + if compiler.is_none() && host.contains("-linux-") { + physx_cc.compiler("clang++"); + } + + physx_cc.flag(if physx_cc.get_compiler().is_like_msvc() { + "/std:c++14" + } else { + "-std=c++14" + }); + + use std::ffi::OsString; + let output_dir_path = + PathBuf::from(env::var("OUT_DIR").expect("output directory not specified")); + + let include_path = if env::var("CARGO_FEATURE_STRUCTGEN").is_ok() { + let mut structgen_path = output_dir_path.join("structgen"); + + // A bit hacky and might not work in all scenarios but qemu-aarch64 is not always + // available or even needed. If you are cross compiling to android then you need + // to remember to set CXX and CC to the respective toolchain compilers found in + // the ANDROID_NDK_ROOT as well. + let is_cross_compiling_aarch64 = target != host && target.starts_with("aarch64-"); + + let structgen_compiler = physx_cc.get_compiler(); + let mut cmd = structgen_compiler.to_command(); + + if env::var("CARGO_FEATURE_CPP_WARNINGS").is_err() { + let dw = if physx_cc.get_compiler().is_like_clang() + || physx_cc.get_compiler().is_like_gnu() + { + "-w" + } else if physx_cc.get_compiler().is_like_msvc() { + "/w" + } else { + panic!("unknown compiler"); + }; + + cmd.arg(dw); + } + + if structgen_compiler.is_like_msvc() { + let mut s = OsString::from("/Fe"); + s.push(&structgen_path); + cmd.arg(s); + + let mut s = OsString::from("/Fo"); + s.push(&structgen_path); + s.push(".obj"); + cmd.arg(s); + } else { + if is_cross_compiling_aarch64 { + // statically linking is just much easier to deal + // with when using qemu-aarch64 + cmd.arg("-static"); + } + cmd.arg("-o").arg(&structgen_path); + } + + cmd.arg("src/structgen/structgen.cpp"); + cmd.status().expect("c++ compiler failed to execute"); + + // The above status check has been shown to fail, ie, the compiler + // fails to output a binary, but reports success anyway + if host.contains("-windows-") { + structgen_path.set_extension("exe"); + } + + std::fs::metadata(&structgen_path) + .expect("failed to compile structgen even though compiler reported no failures"); + + let mut structgen = if is_cross_compiling_aarch64 { + let mut structgen = std::process::Command::new("qemu-aarch64"); + structgen.arg(&structgen_path); + structgen + } else { + std::process::Command::new(&structgen_path) + }; + + structgen.current_dir(&output_dir_path); + structgen.status().expect("structgen failed to execute, if you are cross compiling to aarch64 you need to have qemu-aarch64 installed"); + + println!("cargo:rerun-if-changed=src/structgen/structgen.cpp"); + println!("cargo:rerun-if-changed=src/structgen/structgen.hpp"); + + output_dir_path + } else { + let mut include = PathBuf::from("src/generated"); + + if target == "x86_64-pc-windows-msvc" { + include.push(target); + } else if target.contains("-linux-") || target.ends_with("apple-darwin") { + // Note that (currently) the x86_64 and aarch64 structures we bind + // are the exact same for linux/android and MacOS (unsure about iOS, but also don't care) + include.push("unix"); + } else { + panic!("unknown TARGET triple '{}'", target); + } + + include + }; + + // Disable all warnings. The rationale for this is that end users don't care + // and the physx code is incredibly sloppy with warnings since it's mostly + // developed on windows + if env::var("CARGO_FEATURE_CPP_WARNINGS").is_err() { + let dw = if physx_cc.get_compiler().is_like_clang() || physx_cc.get_compiler().is_like_gnu() + { + "-w" + } else if physx_cc.get_compiler().is_like_msvc() { + "/w" + } else { + panic!("unknown compiler"); + }; + + physx_cc.flag(dw); + } + + physx_cc + .include(include_path) + .file("src/physx_api.cpp") + .compile("physx_api"); + + println!("cargo:rerun-if-changed=src/physx_generated.hpp"); + println!("cargo:rerun-if-changed=src/physx_generated.rs"); + println!("cargo:rerun-if-changed=src/physx_api.cpp"); + + // TODO: use the cloned git revision number instead + println!("cargo:rerun-if-changed=physx/physx/include/foundation/PxPhysicsVersion.h"); +} diff --git a/modules/PhysX/physx/physx-sys/examples/ball.rs b/modules/PhysX/physx/physx-sys/examples/ball.rs new file mode 100644 index 0000000..ad0d038 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/examples/ball.rs @@ -0,0 +1,110 @@ +use physx_sys::*; +use std::ptr::null_mut; + +fn main() { + #[allow(unsafe_code)] + // SAFETY: It works...but is it safe? :D + unsafe { + let foundation = physx_create_foundation(); + let physics = physx_create_physics(foundation); + + let mut scene_desc = PxSceneDesc_new(PxPhysics_getTolerancesScale(physics)); + scene_desc.gravity = PxVec3 { + x: 0.0, + y: -9.81, + z: 0.0, + }; + + let dispatcher = phys_PxDefaultCpuDispatcherCreate( + 1, + null_mut(), + PxDefaultCpuDispatcherWaitForWorkMode::WaitForWork, + 0, + ); + scene_desc.cpuDispatcher = dispatcher.cast(); + scene_desc.filterShader = get_default_simulation_filter_shader(); + + let scene = PxPhysics_createScene_mut(physics, &scene_desc); + + let material = PxPhysics_createMaterial_mut(physics, 0.5, 0.5, 0.6); + let ground_plane = + phys_PxCreatePlane(physics, &PxPlane_new_1(0.0, 1.0, 0.0, 0.0), material); + PxScene_addActor_mut(scene, ground_plane.cast(), null_mut()); + + let sphere_geo = PxSphereGeometry_new(10.0); + let sphere = phys_PxCreateDynamic( + physics, + &PxTransform_new_1(&PxVec3 { + x: 0.0, + y: 40.0, + z: 100.0, + }), + (&sphere_geo as *const PxSphereGeometry).cast(), + material, + 10.0, + &PxTransform_new_2(PxIDENTITY::PxIdentity), + ); + PxRigidBody_setAngularDamping_mut(sphere.cast(), 0.5); + PxScene_addActor_mut(scene, sphere.cast(), null_mut()); + + let filter_data = PxQueryFilterData_new(); + let mut raycast_hits = Vec::new(); + + let heights_over_time = (0..100) + .map(|_| { + PxScene_simulate_mut(scene, 0.1, null_mut(), null_mut(), 0, true); + let mut error: u32 = 0; + PxScene_fetchResults_mut(scene, true, &mut error); + assert!(error == 0, "fetchResults has failed"); + + let mut hit = std::mem::MaybeUninit::uninit(); + + if physx_sys::PxSceneQueryExt_raycastSingle( + scene, + &PxVec3 { + x: 0.0, + y: 100.0, + z: 100.0, + }, // origin + &PxVec3 { + x: 0.0, + y: -1.0, + z: 0.0, + }, // dir + 1000.0, // max distance + PxHitFlags::Default, + hit.as_mut_ptr(), + &filter_data, + null_mut(), + null_mut(), + ) { + let hit = hit.assume_init(); + raycast_hits.push(hit); + } + + let pose = PxRigidActor_getGlobalPose(sphere.cast()); + (pose.p.y) as i32 - 10 + }) + .collect::>(); + let max_h = 18; + (0..max_h) + .map(|h| { + let h = max_h - 1 - h; + heights_over_time + .iter() + .enumerate() + .map(|(_t, p)| if h == *p { 'o' } else { ' ' }) + .collect::() + }) + .for_each(|line| { + println!("{line}"); + }); + PxScene_release_mut(scene); + PxDefaultCpuDispatcher_release_mut(dispatcher); + PxPhysics_release_mut(physics); + + for hit in raycast_hits { + eprintln!("Raycast hit object {:.02}m away", hit.distance); + } + } +} diff --git a/modules/PhysX/physx/physx-sys/make-sources.sh b/modules/PhysX/physx/physx-sys/make-sources.sh new file mode 100644 index 0000000..781b587 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/make-sources.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +# This script finds all of the cpp files in a and generates a rust +# array of strings into physx-sys/sources/ that is used by the build script +# to compile all of the source files when compiling physx-sys +# +# usage: make-sources.sh +dir=$1 +file="$(dirname "$0")/sources/$2" + +printf "[\n" > "$file" + +for entry in "$dir"/*.cpp +do + printf " \"%s\",\n" "$(echo "$entry" | sed -r "s/.+\/(.+)\..+/\1/")" >> "$file" +done + +printf "]\n" >> "$file" diff --git a/modules/PhysX/physx/physx-sys/migration-4-5.md b/modules/PhysX/physx/physx-sys/migration-4-5.md new file mode 100644 index 0000000..10de04b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/migration-4-5.md @@ -0,0 +1,272 @@ +# physx-sys 4.1 -> 5.1 migration guide + +This is a migration guide for the physx-sys crate from the version (0.8.*) that was wrapping PhysX SDK 4.1, and the version (0.10) that transition to PhysX SDK 5.1.3. (see [PR#183] for the PR that actually made a bulk of the transition) + +Note that there is a migration guide from NVidia for the C++ code [here](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html). + +## General Changes + +### `pxbind` + +The pxbind program, used to query the C++ AST and generate both the FFI binding functions in Rust and their C++ implementation, as well as the structgen program used to generate the POD types used on both sides of the FFI boundary, has been rewritten from C++ to Rust. This was done to get rid of the annoying dependency on libclang and just...not have C++ code that had bitrotted since the original implementation. Transitioning to Rust means it should be easier for contributors to make changes to the binding generation and just iterate on and improve the generated binding code. This change is not directly visible to end users of the crate, it is just mentioned since it makes up a large part of the new code in [PR#183]. + +### Enums + +Enums exposed by physx-sys have been changed to be more Rust like. We'll use [`PxShapeFlag`](https://github.com/EmbarkStudios/PhysX-5/blob/main/physx/include/PxShape.h#L62-L119) to illustrate the changes. + +#### Old enum output + +```rust +pub mod PxShapeFlag{ +pub type Enum = u32; +pub const eSIMULATION_SHAPE: Enum = 1u64 as u32; +pub const eSCENE_QUERY_SHAPE: Enum = 2u64 as u32; +pub const eTRIGGER_SHAPE: Enum = 4u64 as u32; +pub const eVISUALIZATION: Enum = 8u64 as u32; +} +``` + +#### New enum output + +```rust +/// 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, +} +``` + +#### Enum differences + +1. Enums are now regular Rust enums, rather than modules. +1. Enum variants now named in `UpperCamelCase` like standard Rust enum variants (minus the `e` suffix) +1. Enums now have the documentation for the enum itself, as well as each variant, pulled from the C++ declaration + +#### Migrating enums + +Migrating enums is trivial in most cases as it is just a matter of renaming the variant from the C++ name to the new form. In the case the type itself is used, it's just a matter of removing the `::Enum` from the type. + +```diff +PxShape_setFlag_mut( + shape, +- PxShapeFlag::eVISUALIZATION, ++ PxShapeFlag::Visualization, + enable_physics_shape_debug_rendering, +); + +-fn is_flag_enabled(shape: *const PxShape, flag: PxShapeFlag::Enum) -> bool { ++fn is_flag_enabled(shape: *const PxShape, flag: PxShapeFlag) -> bool { +``` + +One wrinkle with this new form is that converting to and from integer types is not as easy. If this is problematic we can add generation of `From` for 1 or more integer types for enums. + +### Flags + +PhysX uses bitsets fairly heavily in the API, using `PxFlags<_enum_type_, _integer_type_>` to create wrappers for an enum. We'll use [`PxShapeFlags`](https://github.com/EmbarkStudios/PhysX-5/blob/6efb3c60eb7869e8f9d694a674aafb58127b7173/physx/include/PxShape.h#L121-L127), the flags version of `PxShapeFlag`. + +#### Old flags output + +```rust +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxShapeFlags{ + pub mBits: u8, +} +``` + +#### New flags output + +```rust +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; + } +} +``` + +#### Flags differences + +1. Flags now create a [`bitflags`](https://crates.io/crates/bitflags) backed bitset, using a transparent repr using the same sized integer as in C++, allowing for transparent usage across the FFI boundary. +1. Normal bitset operations are now generated by `bitflags` +1. As with enums, each flag variant is named in `UpperCamelCase` + +#### Migrating flags + +Since the generated `*Flags` bitset has all of the bitset operations the migrated code should be much cleaner as there is no longer a need to convert to the underlying integer type. + +```diff +-let mut shape_flags = PxShapeFlags { +- mBits: (PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eVISUALIZATION) as u8, +-}; ++let mut shape_flags = PxShapeFlags::SceneQueryShape | PxShapeFlags::Visualization; + +if config.trigger_volume { +- shape_flags.mBits |= PxShapeFlag::eTRIGGER_SHAPE as u8; ++ shape_flags |= PxShapeFlags::TriggerShape; +} else { +- shape_flags.mBits |= PxShapeFlag::eSIMULATION_SHAPE as u8; ++ shape_flags |= PxShapeFlags::SimulationShape; +} + +PxPhysics_createShape_mut( + px_physics.as_mut_ptr(), + geom.geometry.as_ptr(), + config.material, + is_exclusive, + shape_flags, +) +``` + +### Structs + +The only difference, other than actual changes in the C++ classes/structs themselves, is that we now expose the `debug-structs` feature, which enables `Debug` to be derived for all of the generated POD structs. This is not enabled by default as the compile time and binary size increases are generally not going to be worthwhile in normal usage. + +```rust +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxActorShape { + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +``` + +### Functions + +Static methods are now no longer suffixed with `_mut`. + +```diff +-fn PxArticulationReducedCoordinate_setSolverIterationCounts_mut(); ++fn PxArticulationReducedCoordinate_setSolverIterationCounts(); +``` + +All generated Rust functions now include the comments from the C++ code, for convenience. + +```diff +-pub fn PxRigidDynamic_getKinematicTarget(self_: *const PxRigidDynamic, target: *mut PxTransform, ) -> bool; ++/// Get target pose of a kinematically controlled dynamic actor. ++/// ++/// True if the actor is a kinematically controlled dynamic and the target has been set, else False. ++pub fn PxRigidDynamic_getKinematicTarget(self_: *const PxRigidDynamic, target: *mut PxTransform) -> bool; +``` + +### Other + +One other change of note is that the old pxbind was incorrectly binding `unsigned long long/uint64_t` to `usize`. It is now bound to `u64`. This would also apply to `i64`, but there are no instances of this in the public PhysX API. + +Functions that don't return anything no longer specify the return type as `-> ()`. + +## API Changes + +This section contains API changes in the C++ code that are reflected in the API exposed by this crate. This is **not exhaustive**, as there are frankly too many changes both trivial and large to document here. That being said, please submit PRs to improve this section if you run up against issues when migrating from the 4.1 based crate to the 5.1 based crate that you think make sense to document. + +If you want an exhaustive listing of API changes you can use [cargo public-api](https://crates.io/crates/cargo-public-api) + +```sh +cargo install --locked cargo-public-api +cd physx-rs/physx-sys +cargo public-api --simplified diff 0.8.2 +``` + +It's also recommended to checkout the [PhysX CHANGELOG](https://github.com/EmbarkStudios/PhysX-5/blob/main/physx/CHANGELOG.md) though note that this is **also not exhaustive**! + +### Embark Changes + +While most of the API changes are just reflecting the changes in the underlying C++ code, we've also made a few changes to how we generate bindings. + +- We no longer bind the math functions from `PxMath.h`, there is no functionality there that cannot be done in pure Rust, without crossing the FFI boundary +- We no longer bind the functions from `PxString.h`, `PxUtilities.h`, `PxAtomic.h` or `PxHash.h`, these are all APIs that though "public" are really only used inside C++ itself + +### Deprecated + +One major change from the old bindings is that deprecated items (classes/structs/typedefs/enum variants/fields/functions/methods) are now **not generated**. This means some items that were already deprecated in the 4.1 SDK or no longer present, in addition to items that were deprecated in the transition from 4.1 -> 5.1. + +We also abuse the `PX_DEPRECATED` macro to remove items that we intentionally don't expose in this crate, notably some of the new features added in 5.1 like soft bodies and cloth which are only available on NVidia GPUs and whose source is not part of the open source SDK. + +If you were using an API in the former crate that is now deprecated (check [here](https://github.com/search?q=repo%3AEmbarkStudios%2FPhysX-5%20PX_DEPRECATED&type=code)) you can open a [PR](https://github.com/EmbarkStudios/PhysX-5/pulls) to un-deprecate the item (if it makes sense). + +#### Notable Deprecations + +- [**Vehicles**](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#vehicles): All of the former Vehicle SDK components were deprecated and replaced with new APIs. These are not bound yet, see [#186](https://github.com/EmbarkStudios/physx-rs/issues/186) +- [**PxCooking**](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#cooking): Deprecated and replaced with lower level individual functions/classes. This is temporarily [un-deprecated](https://github.com/EmbarkStudios/PhysX-5/commit/5cdbcf6c0ff9c9ff60397c909227243ea0fd8177) but will be replaced later, see [#187](https://github.com/EmbarkStudios/physx-rs/issues/187) +- [**Joint Projections**](https://github.com/EmbarkStudios/PhysX-5/blob/main/physx/CHANGELOG.md#deprecated-1): get/setProjectionAngular/LinearTolerance have been deprecated in all joints + +### `PxRefCounted` + +In PhysX 4 many classes had their own `release`, `getReferenceCount` and `acquireReference` methods. These methods have now all been moved to `PxRefCounted`, a new base class in PhysX 5. So now you will use those `PxRefCounted_*` methods instead of the former class methods, casting the pointer to a `PxRefCounted`. + +```diff +-PxMaterial_release(material); ++PxRefCounted_release(material.cast()); +``` + +- `PxMaterial` +- `PxShape` +- `PxConvexMesh` +- `PxHeightField` +- `PxTriangleMesh` + +### Removed + +Several APIs were completely removed, with their functionality either going away, or being absorbed into other classes. + +- `PxArticulationBase` and `PxArticulation` were completely removed, most functionality was moved to `PxArticulationReducedCoordinate` +- `PxArticulationJointBase` and `PxArticulationJoint` were completely removed, most functionality was moved to `PxArticulationJointReducedCoordinate` +- `PxBatchQueryDesc` has been removed +- `PxBatchQueryMemory` has been removed + +### Renamed + +- `PxBVHStructure` was renamed to [`PxBVH`](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#pxbvhstructure) +- `PxBVHStructureDesc` was renamed to [`PxBVHDesc`](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#pxbvhstructure) +- `PxPhysicsInsertionCallback` was renamed to [`PxInsertionCallback`](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#cooking) + +### Replaced/Moved + +- `PxBatchQuery` has been replaced by [`PxBatchQueryExt`](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/docs/MigrationTo51.html#scene-queries) +- `PxScene` queries have _mostly_ been moved to [`PxSceneQueryExt`](https://github.com/EmbarkStudios/PhysX-5/blob/4d33492253ab64c2246d80257ac4ce0f37b40b22/physx/include/extensions/PxSceneQueryExt.h#L60) +- `PxRigidBody_setAngularVelocity_mut` and `PxRigidBody_setLinearVelocity_mut` have been moved to [`PxRigidDynamic`](https://github.com/EmbarkStudios/PhysX-5/blob/main/physx/CHANGELOG.md#changed-3) +- Many class constructors have been consolidated, so instead of having, for example, a default constructor and a constructor that takes two `f32` parameters, there will now be single constructor that takes two `f32` parameters, both having default values that used to be set in the default constructor. If you were calling a `_new` function (a wrapper for a constructor) that now fails since the signature is different, you can look at the code to determine what arguments to pass to retain the default constructor behavior. + +```diff +-pub fn PxCapsuleGeometry_new() -> PxCapsuleGeometry; ++pub fn PxCapsuleGeometry_new(radius_: f32, halfHeight_: f32) -> PxCapsuleGeometry; +``` + +[PR#183]: https://github.com/EmbarkStudios/physx-rs/pull/183 diff --git a/modules/PhysX/physx/physx-sys/physx/.github/ISSUE_TEMPLATE/Bug_report.md b/modules/PhysX/physx/physx-sys/physx/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..8ddb757 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,49 @@ +--- +name: Bug report +about: Report a bug + +--- + + + +### Library and Version + + + +### Operating System + + + +### Steps to Trigger Behavior + + 1. + 2. + 3. + +### Code Snippet to Reproduce Behavior + +``` + +``` + +### Expected Behavior + + + +### Actual Behavior + + diff --git a/modules/PhysX/physx/physx-sys/physx/.github/PULL_REQUEST_TEMPLATE.md b/modules/PhysX/physx/physx-sys/physx/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7b58711 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ + diff --git a/modules/PhysX/physx/physx-sys/physx/CONTRIBUTING.md b/modules/PhysX/physx/physx-sys/physx/CONTRIBUTING.md new file mode 100644 index 0000000..5f9ff23 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/CONTRIBUTING.md @@ -0,0 +1,36 @@ +# Contributing to PhysX + +## Did you find a bug? + +* Check in the GitHub [Issues](https://github.com/NVIDIA-Omniverse/PhysX/issues) if a report for your bug already exists. +* If the bug has not been reported yet, open a new Issue. +* Use a short and descriptive title which contains relevant keywords. +* Write a clear description of the bug. +* Document the environment including your operating system, compiler version, and hardware specifications. +* Add code samples and executable test cases with instructions for reproducing the bug. + +## Did you find an issue in the documentation? + +* Please create an [Issue](https://github.com/NVIDIA-Omniverse/PhysX/issues/) if you find a documentation issue. + +## Did you write a bug fix? + +* Open a new [Pull Request](https://github.com/NVIDIA-Omniverse/PhysX/pulls) with your bug fix. +* Write a description of the bug which is fixed by your patch or link to related Issues. +* If your patch fixes for example Issue #33, write `Fixes #33`. +* Explain your solution with a few words. + +## Did you write a cosmetic patch? + +* Patches that are purely cosmetic will not be considered and associated Pull Requests will be closed. +* Cosmetic are patches which do not improve stability, performance, functionality, etc. +* Examples for cosmetic patches: code formatting, fixing whitespaces. + +## Do you have a question? + +* Search the GitHub [Discussions](https://github.com/NVIDIA-Omniverse/PhysX/discussions/) for your question. +* If nobody asked your question before, feel free to open a new discussion. +* Once somebody shares a satisfying answer to your question, click "Mark as answer". +* GitHub Issues should only be used for bug reports. +* If you open an Issue with a question, we may convert it into a discussion. +* You can also ask in the NVIDIA Omniverse #physics Discord Channel. Get an invite here: [https://discord.com/invite/XWQNJDNuaC](https://discord.com/invite/XWQNJDNuaC). diff --git a/modules/PhysX/physx/physx-sys/physx/LICENSE.md b/modules/PhysX/physx/physx-sys/physx/LICENSE.md new file mode 100644 index 0000000..c39b0b8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/LICENSE.md @@ -0,0 +1,31 @@ +BSD 3-Clause License + +Copyright (c) 2023, NVIDIA Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules/PhysX/physx/physx-sys/physx/README.md b/modules/PhysX/physx/physx-sys/physx/README.md new file mode 100644 index 0000000..6126f5b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/README.md @@ -0,0 +1,46 @@ +# NVIDIA PhysX + +Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## Introduction + +This is Embark's fork of PhysX, which is used as the source for the C++ code backing our [Rust wrapper](https://github.com/EmbarkStudios/physx-rs). + +This is a hard fork as the upstream rarely/never accepts PRs, thus we can get rid of all of the junk in the repo that we don't use in our bindings. You probably want to use the official repo if you aren't using our wrapper. + +## Differences from upstream + +### Fixes + +* [x] Compiling for `aarch64-apple-darwin` [actually works](https://github.com/NVIDIA-Omniverse/PhysX/issues/107). This only worked by [accident](https://github.com/EmbarkStudios/PhysX/blob/1689fbd312f447ac933c3c8023516f1fa57a5563/pxshared/include/foundation/PxPreprocessor.h#L110-L113) in PhysX 4.1 +* [x] Compiling for `aarch64-linux-android` actually works +* [x] Cross compiling for `x86_64-pc-windows-msvc` with clang actually works + +### Deprecations + +We abuse the `PX_DEPRECATED` macro to control which items are exposed in our Rust bindings. So various new items like Particles/Cloth/Soft Bodies which are Cuda-only and therefore completely uninteresting to us are marked as deprecated to avoid them. diff --git a/modules/PhysX/physx/physx-sys/physx/physx/.gitignore b/modules/PhysX/physx/physx-sys/physx/physx/.gitignore new file mode 100644 index 0000000..dc0d38c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/.gitignore @@ -0,0 +1,4 @@ +bin/ +compiler/linux-* +compiler/vc* +include/PxConfig.h diff --git a/modules/PhysX/physx/physx-sys/physx/physx/CHANGELOG.md b/modules/PhysX/physx/physx-sys/physx/physx/CHANGELOG.md new file mode 100644 index 0000000..d6a6bc1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/CHANGELOG.md @@ -0,0 +1,4335 @@ +# v5.1.3 + +## General + +### Added: + +* Support for Microsoft Visual Studio 2022 for Windows builds. + +### Fixed + +* Changing the materials of a shape did not work when using GPU dynamics. + +## Rigid Body + +### Fixed + +* A rare bug involving GPU aggregates, in which newly created actors could freely move through existing actors, has been fixed. + +## Joints + +### Fixed + +* The D6 joint's twist drive was using the wrong actor's axis (B instead of A). This has been fixed, and it could affect joint setups in existing scenes. To fix this in existing content it might be enough to flip the joint frames of involved actors, but this may not be possible depending on which other features (joint limits, etc) have been setup for the same joint. In the worst case it might be necessary to re-tune these joints. + +## Soft Body + +### Fixed + +* Rendering for tetmeshes in snippets had some tet faces inverted. This has been fixed. +* The voxel tetmesher won't crash anymore when called with zero elements as input. +* A bug in collision computation between a soft body and a scaled triangle mesh has been fixed. + +## Particles + +### Fixed + +* The Poisson Sampler will not cause number overflows and crashes anymore when called with parameters that lead to too many samples. + +## Pvd + +### Fixed + +* Fixed a potential crash bug when contact points are recorded through OmniPVD. + + +# v5.1.2 + +## General + +### Fixed: + +* Binary serialization of materials' userData. +* Fixed precision issue in index computation in Gu::HeightField::computeCellCoordinates [Issue #52](https://github.com/NVIDIA-Omniverse/PhysX/issues/52) +* Performance for SnippetCustomGeometry is now much better, particularly on Linux +* Compiler errors on Linux - [Issue #25](https://github.com/NVIDIA-Omniverse/PhysX/issues/25) + +## Cooking + +### Fixed + +* A bug that generated non-GPU compatible convex meshes even though GPU compatibility was requested. + + +# v5.1.1 + +## General + +### Changed: + +* Be aware that due to reorganization of some virtual functions in the public interface the binary data layout has changed from v5.1.0. Linking code that includes the headers of v5.1.1 against binaries that have been built with an older version will likely cause problems. + +### Added: + +* Support for spatial and fixed tendon serialization. + +### Fixed: + +* Binary serialization of articulations had a bug, which got fixed. +* Includes [PR #8: Download bootstrap packages using TLS](https://github.com/NVIDIA-Omniverse/PhysX/pull/8/) + +## Rigid Body + +### Fixed + +* A crash when colliding an SDF mesh against a sphere + +## Particle Systems + +### Fixed + +* Particle systems now support is<> type conversion. + +### Removed + +* The PxParticlePhase class has been removed. It was unused. + +## Vehicles2 + +### Changed: + +* SnippetVehicle2Multithreading is now using custom profiling code to provide timings in release builds too. + + +# v5.1.0 + +## Supported Platforms + +### Runtime + +* Linux (tested on Ubuntu 20.04) +* Microsoft Windows 10 or later (GPU acceleration: display driver and GPU supporting CUDA 11 / CUDA ARCH 3.0) + +### Development + +* Microsoft Windows 10 or later +* Microsoft Visual Studio 2017, 2019 + +## Overview + +* New SDF collisions! +* New custom geometry! +* New custom scene query system! +* New GJK queries API! +* New soft bodies! +* New mesh-vs-mesh overlap queries! +* New Vehicle SDK with customizable components and functionality! +* New gyroscopic forces! +* New gear joint and rack-and-pinion joint! + +## General + +### Added: + +* A new function PxSetMutexProtocol() has been added exclusively for Linux OS. This function affects the way in which shdfnd::Mutex sets flags that affect OS strategies to avoid thread priority inversion. The behavior was hard-coded to PTHREAD_PRIO_INHERIT but now can be set to any of PTHREAD_PRIO_INHERIT, PTHREAD_PRIO_PROTECT, PTHREAD_PRIO_NONE. A choice of PTHREAD_PRIO_NONE can lead to significant performance improvements with large thread counts but requires care to avoid priority inversion, a phenomena that occurs when a low priority thread holds a lock contended by higher priority threads. +* A flag PxVisualizationParameter::eSIMULATION_MESH has been added to render the simulation mesh instead of the collision mesh for tetmeshes. +* A flag PxVisualizationParameter::eSDF has been added to render the SDF of a mesh instead of the collision mesh for triangle meshes with SDFs. +* PxPhysics has new functions related to the creation and retrieval of tetrahedral meshes. + +### Deprecated: + +* PxPhysicsInsertionCallback is deprecated. Please use PxInsertionCallback instead. +* The PxFlags::set() function has been removed. Please now use PxFlags::raise() to set a single flag, or operator= to set all flags. +* The enum values of PxTaskType have been renamed for consistency reasons. See the corresponding API documentation for details. +* The PxRegisterHeightFields, PxRegisterArticulationsReducedCoordinate and PxCreateBasePhysics functions are deprecated. +* Binary data conversion and binary meta data have been deprecated. + * PxBinaryConverter + * PxConverterReportMode + * PxGetPhysicsBinaryMetaData() + * PxSerialization::serializeCollectionToBinaryDeterministic() + * PxSerialization::dumpBinaryMetaData() + * PxSerialization::createBinaryConverter() + * PxBinaryMetaDataCallback + * PxSerializationRegistry::registerBinaryMetaDataCallback() + +### Fixed: + +* PxPhysics::getFoundation() and PxScene::getPhysics() did not return the correct references in scenarios where two or more dynamic libraries are built with static PhysX libraries. In such a scenario, PxPhysics or PxScene objects from dynamic library A would return the wrong references when queried inside dynamic library B. +* Collision edges (PxVisualizationParameter::eCOLLISION_EDGES) were not properly rendered when PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE is used. Using this flag means that all edges are active, but none of them were rendered. The correct thing to do is to render all of them. +* PxActorFlag::eVISUALIZATION was not properly used. Shapes of actors whose visualization flag is disabled will now get skipped as well. +* Removed duplicate closing cross-thread event for Basic.narrowPhase event. +* Replaced all custom offsetof expressions that appear to dereference a null pointer with the PX_OFFSET_OF_RT macro - implementing Github PR 396. +* Debug visualization of face normals was incorrect for triangle meshes with negative scales. This has been fixed. + +### Removed: + +* Scene double buffering has been completely removed. This means it is now illegal to call API write commands that make changes to the scene or to any actor or shape in a scene while the scene is simulating; that is, in-between PxScene::simulate() and PxScene::fetchResults(). Examples include PxRigidDynamic::setLinearVelocity() and PxScene::addActor(). Another example is PxShape::setLocalPose() for any shape attached to an actor that is in a scene currently being simulated. Removal of scene double buffering has similar consequences for API read commands: it is now illegal to read any property that will be modified during a simulation step. Examples include PxRigidActor::getGlobalPose() and PxConstraint::getForce(). Split simulation is slightly less restrictive in that some reads are allowed during PxScene::collide() and some writes allowed after PxScene::fetchCollision() but before PxScene::advance(). Examples include PxRigidActor::getWorldBounds() and PxArticulation::setWakeCounter(). However, it is important to note that the rules that apply to PxScene::simulate() apply equally to PxScene::advance(). In all build configs, any corresponding illegal API read or write will result in an error being issued to PxErrorStream and the illegal API call immediately returning without executing the function. A final comment is that API read operations in event callbacks remain legal. +* PxVisualizationParameter::eDEPRECATED_COLLISION_PAIRS has been removed. +* PxBroadPhaseCaps::maxNbObjects has been removed. It was unused. +* PxSceneFlag::eADAPTIVE_FORCE has been removed. +* The semi-advanced PhysX "Samples" are no longer provided. The "Snippets" continue to provide simple example code to illustrate how to use certain PhysX features. The physics demos in NVIDIA Omniverse offer more advanced samples now. +* The deprecated PxScene::setFrictionType() method has been removed. Simply set the desired friction type in PxSceneDesc. + +### Changed: + +* The Foundation types PxVec2, PxVec3, PxVec4, PxQuat, PxMat33, PxMat34, PxMat44 and PxTransform now have higher-accuracy implementations that use double instead of float. These are not currently used directly in the PhysX SDK but can be used by clients of the SDK if needed. +* The previous snippet SnippetRaycastCCD has been replaced with SnippetCCD. This snippet illustrates how to use different types of CCD methods, including regular, raycast and speculative CCD. +* PxDefaultCpuDispatcherCreate() has been modified to support different strategies to combat wasteful thread usage when there is no work to perform. +* The PxSimulationEventCallback functions onTrigger(), onContact() and onConstraintBreak() have slightly different behavior in that api queries to the physx actors referenced by the callbacks now return the state of the actor after the simulate step rather than the state of the actor at the detection event. At the risk of a performance penalty, the flags PxPairFlag::ePRE_SOLVER_VELOCITY and PxPairFlag::eCONTACT_EVENT_POSE may be used to retrieve the poses and velocities of the actors prior to the simulation step in the implemented onContact() function. These poses and velocities represent the state of the actors when the contact was first detected during the simulation step. +* PxCapsuleGeometry with halfHeight=0.0 are now legal. +* PxNodeIndex is now a 64-bit index, with the upper 32-bits representing the rigid body/actor ID and the lower 31-bits representing the articulation link ID and 1 bit to indicate if this is an articulation link or a rigid body. However, due to GPU memory constraints, an articulation can only support a maximum of 65536 links. +* Various PxScene::addXXX() functions now return a bool status (previously void) to detect errors more easily. +* TGS solver is now the default, PGS can still be used by setting the scene flags accordingly. +* The PxScene::addActor(), ::addActors(), ::addAggregate(), addCollection(), ::resetFiltering(), ::simulate(), ::advance(), ::collide() methods now return a boolean to denote success or failure. +* Several immediate-mode structs have been renamed from FeatherStoneArticulation to ArticulationRC (the last letters are an acronym for reduced-coordinate) + +## Rigid body + +### Added: + +* A new flag PxConstraintFlag::eALWAYS_UPDATE has been added for constraints that should always be updated, i.e. the corresponding PxConstraintConnector::prepareData() function is called each frame automatically. +* A new flag PxConstraintFlag::eDISABLE_CONSTRAINT has been added. The solver prep functions are not called when this flag is set, effectively disabling the constraint. +* A userData parameter has been added to PxAggregate. +* A userData parameter has been added to PxConstraint. +* The PxPhysics::createAggregate() function has a new parameter. A deprecated wrapper for the previous function signature has been added. +* A new flag PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES has been added. This introduces gyroscopic forces to rigid bodies to simulate effects like the Dzhanibekov Effect. +* A new class PxCustomGeometry has been added. User can now create custom collision shapes by implementing a set of callback functions. +* Two pre-made custom geometry implementations added in PxCustomGeometryExt extension - Cylinder and Cone. +* A new set of API functions PxGjkQuery have been added. This is intended for spatial queries on custom shapes represented by their GJK Support Mapping. +* PxMeshGeometryFlag::eTIGHT_BOUNDS has been added. This is similar to PxConvexMeshGeometryFlag::eTIGHT_BOUNDS, but for triangle meshes. +* A new broadphase has been added (PxBroadPhaseType::ePABP). +* A standalone broadphase interface has been added (see PxCreateBroadPhase and PxCreateAABBManager). +* A compliant contact model has been added. Users can now customize spring-stiffness and damping for a soft contact response. +* Triangle mesh colliders are now supported on dynamic rigid bodies if a SDF (Signed Distance Field) gets generated during cooking. +* PxSceneDesc::frictionCorrelationDistance allows to configure the distance for merging contact points into a single anchor point. +* PxSceneDesc::contactPairSlabSize can be used to define the size of the contact pool slabs. + +### Removed: +* PxSceneDesc::solverOffsetSlop has been removed and can now be set per rigid body (see PxRigidBody::setContactSlopCoefficient()). + +### Changed: + +* PxShape::getGeometry() now returns a PxGeometry reference instead of a PxGeometryHolder. See the migration guide to 5.1 for details. The PxShape::getGeometryType() and PxShape::getXXXGeometry() functions have been deprecated as a result. +* PxMaterialFlag::eIMPROVED_PATCH_FRICTION is now enabled by default. +* PxRigidBody::setLinearVelocity() was removed and replaced with PxRigidDynamic::setLinearVelocity() +* PxRigidBody::setAngularVelocity() was removed and replaced with PxRigidDynamic::setAngularVelocity() +* PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD and PxRigidBodyFlag::eENABLE_CCD can now be enabled at the same time on a given body. In this hybrid CCD mode the linear part of the motion is handled by sweeps, and the angular part of the motion is handled by speculative contacts. + +### Fixed: + +* Removing a shape from a sleeping dynamic rigid actor woke the actor up if it was touching a shape of a static rigid actor. +* Removing a shape from a dynamic rigid actor, did not necessarily wake up touching actors even though wakeOnLostTouch was set to true in PxRigidActor::detachShape(). +* A performance problem in PxScene::getActors() has been fixed. +* Missing support for maxContactForces in the TGS solver has been added. +* A rare crash due to reading past the boundaries of a memory pool has been fixed. +* Deformable meshes using the BVH34 midphase structure did not handle collision edge flags correctly. This has been fixed. +* Collision edge flags were sometimes incorrect for negative-scaled meshes, giving birth to invalid or missed contacts. This has been fixed. +* The sphere-vs-mesh PCM contact generation had a bug that sometimes made the sphere go through the mesh due to a missed vertex contact. This has been fixed. +* Performance and stability issues when simulating convexes colliding against many triangles in complex PxTriangleMesh geometries has been improved. +* Attempting to apply a force to a kinematic rigid body will no longer lead to a crash in profile or release builds. +* Triangle mesh negative scale support for GPU code path. +* Switching a constrained dynamic body to kinematic no longer triggers an assert in debug mode. + +## Joints + +### Added: + +* New PxGearJoint and PxRackAndPinionJoint have been added. + +### Fixed: + +* PxJoint::setActors() had a bug when called at runtime, that left an internal structure referencing the previous actors. As a result PxConstraintFlag::eCOLLISION_ENABLED was not properly handled between jointed actors. + +### Deprecated: + +* PxJointLimitParameters::contactDistance is deprecated. +* Joint projection is deprecated. + +## Scene queries + +### Removed: + +* Batched query support has been removed from the PhysX SDK. The deprecated structs/classes/callbacks PxBatchQuery, PxBatchQueryDesc, PxBatchQueryResult, PxRaycastQueryResult, PxSweepQueryResult, PxOverlapQueryResult, PxBatchQueryPreFilterShader and PxBatchQueryPostFilterShader have all been removed from the SDK. The deprecated function PxScene::createBatchQuery has also been removed. In place of PxBatchQuery, a new class PxBatchQueryExt has been added to the extensions library. This acts as a wrapper for the functions PxScene::raycast(), PxScene::sweep() and PxScene::overlap() and aims to preserve the core functionality of PxBatchQuery. PxBatchQueryExt instances are instantiated with the function PxCreateBatchQueryExt(). + +### Added: + +* PxSceneDesc can now take an optional PxSceneQuerySystem parameter. If defined, all PxScene scene-query related calls will be re-routed to this interface. This allows users to potentially customize the implementation of all scene-query operations. An external implementation of this interface is available in the PxExtensions library, and can be created with the PxCreateExternalSceneQuerySystem function. +* It is possible to further customize the scene-query system, e.g. using more than the two built-in pruning structures in PhysX. See PxCreateCustomSceneQuerySystem and SnippetMultiPruners. +* The function PxCreateBatchQueryExt() has been added to the extension library. The purpose of this function is to instantiate a new class PxBatchQueryExt. This class acts as a replacement for the PxBatchQuery class of previous releases which has now been removed. PxBatchQueryExt allows queries to be added to a queue and then executed on command. +* The flag PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR has been added to support PxBatchQueryExt and/or any other user replacement for PxBatchQuery. When this flag is raised, the PhysX SDK ignores an internal filter equation and guarantees that the PxQueryHitType returned by the corresponding PxQueryFilterCallback instance is used directly without any other logic being applied. +* The function PxBatchQueryStatus::getStatus() has been added to the extensions library to determine if an overflow occurred during the execution of a batch with PxBatchQueryExt::execute(). Overflows occur when the touch buffer is insufficiently large to return all touches for all queries. +* The function PxScene::overlap() now has an optional PxQueryCache pointer as function argument. This follows the pattern of the complementary raycast() and sweep() functions of the PxScene class. +* The function PxGeometryQuery::pointDistance() now supports meshes when the PxMeshMidPhase::eBVH34 data structure is used. It has a new parameter to return the closest triangle index for meshes. +* SnippetPointDistanceQuery, SnippetGeometryQuery, SnippetStandaloneBVH and SnippetPathTracing have been added. +* The PxScene::raycast(), PxScene::overlap() and PxScene::sweep() functions have a new PxGeometryQueryFlags parameter. +* The PxGeometryQuery::raycast(), PxGeometryQuery::overlap(), PxGeometryQuery::sweep(), PxGeometryQuery::computePenetration(), PxGeometryQuery::pointDistance() functions have a new PxGeometryQueryFlags parameter. +* The PxMeshQuery::findOverlapTriangleMesh(), PxMeshQuery::findOverlapHeightField() and PxMeshQuery::sweep() functions have a new PxGeometryQueryFlags parameter. +* PxBVH now has a culling function (PxBVH::cull()) that can be used to implement view-frustum culling. See SnippetFrustumQuery for an example. +* PxBVH now has refit functions (PxBVH::refit(), PxBVH::partialRefit()) that can be used for dynamic trees. See SnippetStandaloneBVH for an example. +* PxBVH now has a generic traversal function (PxBVH::traverse()) that can be used for arbitrary purposes, like e.g. debug-visualizing the tree bounds. See SnippetStandaloneBVH for an example. +* There is a new PxFindOverlap function to find overlaps between two PxBVH objects. +* The PxRigidActorExt::createBVHFromActor() helper function has been added. +* PxSceneDesc::dynamicTreeSecondaryPruner has been added. The new PxDynamicTreeSecondaryPruner enum lets users choose which implementation to use in dynamic trees. +* PxSceneDesc::staticBVHBuildStrategy and PxSceneDesc::dynamicBVHBuildStrategy have been added. This lets users control the build strategy of the static & dynamic pruning structures. +* PxSceneDesc::staticNbObjectsPerNode and PxSceneDesc::dynamicNbObjectsPerNode have been added. This lets users control the number of objects per node for the static & dynamic pruning structures. +* PxHitFlag::eANY_HIT has been added. It is similar to the previous PxHitFlag::eMESH_ANY flag, but this time for any geometry that contains multiple primitives - for example a PxCustomGeometry. +* PxGeometryQuery::raycast, PxGeometryQuery::overlap and PxGeometryQuery::sweep now take an optional context parameter that is passed to the low-level functions, and in particular to the PxCustomGeometry callbacks. +* PxGeometryQuery::overlap now supports triangle mesh vs triangle mesh. +* A new PxMeshQuery::findOverlapTriangleMesh function has been added to compute triangle overlaps between two triangle meshes. + +### Fixed: + +* The build code for BVH34 trees had an issue that could produce degenerate trees, leading to rare performance problems and even stack overflow during traversal. This has been fixed, but it made the build code slightly slower, which could be a problem for users cooking at runtime. Since the problem was rare, the previous/faster build code has been kept, available in PxBVH34BuildStrategy::eFAST. It is not enabled by default. +* The scene query system was sometimes incorrectly updated for PxBVH structures. This has been fixed. +* A crash has been fixed when doing a query against an empty scene while using PxPruningStructureType::eNONE for the dynamic structure. +* The BVH34 codepath had a bug in the raycast-vs-mesh-with-multiple-hits case, where returned hits could be further away than defined max hit distance. This has been fixed. +* A rare crash involving the compound pruner and the PxActorFlag::eDISABLE_SIMULATION flag has been fixed. +* Fixed a rare scene-query issue happening with stabilization enabled (the SQ structures could miss updates, leading to incorrect SQ results). +* In rare cases, PxTriangleMesh::refitBVH() could return an incorrect bounding box when using PxMeshMidPhase::eBVH34. This has been fixed. +* In very rare cases, sweep tests using the eMTD flag and exactly touching a shape (impact distance == 0) could return an incorrect impact normal. This has been fixed. +* The capsule-vs-heightfield overlap query (PxGeometryQuery::overlap) was not reporting hits in some cases. This has been fixed. +* The convex-vs-heightfield overlap query (PxGeometryQuery::overlap) had a bug when using scaled convexes. This has been fixed. +* The sphere-vs-mesh and capsule-vs-mesh sweeps sometimes returned slightly incorrect impact distances (especially with long sweeps), which resulted in swept shapes penetrating the meshes when moved to the impact positions. This has been fixed. +* In rare cases the sphere-vs-mesh and capsule-vs-mesh sweeps could miss triangles entirely. This has been fixed. + +### Changed: + +* The PxQueryHit struct does not contain touched actor & shape pointers anymore. They have been moved higher up to the PxRaycastHit, PxOverlapHit and PxSweepHit structs. Explicit padding has also been dropped for these classes. +* The PxQueryFilterCallback::postfilter() function has changed. The hit actor and hit shape are now passed as extra arguments to the function. +* PxGeometryQuery::raycast() now operates on PxGeomRaycastHit structures and takes an extra stride parameter. Similarly PxGeometryQuery::sweep() now uses a PxGeomSweepHit structure. + +### Deprecated: + +* PxGeometryQuery::getWorldBounds() has been deprecated. Please use PxGeometryQuery::computeGeomBounds() instead. +* PxHitFlag::eMESH_ANY has been deprecated. Please use PxHitFlag::eANY_HIT instead. +* PxBVHStructure has been renamed to PxBVH. PxBVHStructureDesc has been renamed to PxBVHDesc. +* The PxBVHStructure scene query functions have changed. The old API is deprecated, a new API has been added. + +## Character controller + +### Added: + +* A PxClientID parameter has been added to PxControllerDesc, to let users setup the owner client before the kinematic actor is added to the scene. + +### Fixed: + +* The vertical displacement vector in the down pass was sometimes incorrect (larger than it should have been). This has been fixed. +* Releasing an articulation link while a character was standing on it produced a crash. This has been fixed. + +## Vehicles2 + +### Added: + +* The Vehicle SDK has been refactored into a completely new form to allow rapid customization and prototyping. SnippetVehicle2Customization, SnippetVehicle2DirectDrive, SnippetVehicle2FourWheelDrive etc. demonstrate use of the new Vehicle SDK. The public API for the new Vehicle SDK may be found under "physxRoot/include/vehicle2". All functions, structs and classes in the new Vehicle SDK are inside the physx::vehicle2 namespace. A migration guide may be found in the PhysX 5.1 SDK Guide under the subsection "Migrating From PhysX SDK 4.0 to 5.1/Vehicles". + +## Vehicles + +### Deprecated: + +* All structs, classes and functions of the old Vehicle SDK have been marked as deprecated and will be removed in a later release. + +### Changed: + +* Concurrent calls to PxVehicleUpdateSingleVehicleAndStoreTelemetryData() are now permitted if the additional parameter vehicleConcurrentUpdates is used. +* The functions PxVehicleSuspensionSweeps() and PxVehicleSuspensionRaycasts() have been modified to accommodate the removal of PxBatchQuery and the addition of PxBatchQueryExt. The arguments of both functions have been modified with a PxBatchQueryExt pointer directly replacing a PxBatchQuery pointer. New functionality in PxBachQueryExt has allowed PxRaycastQueryResult/PxSweepQueryResult to be removed from the argument list of PxVehicleSuspensionRaycasts()/PxVehicleSuspensionSweeps(). This change much simplifies calls to PxVehicleSuspensionRaycasts() and PxVehicleSuspensionSweeps() and requires less user management of the various arrays involved. + +### Added: + +* PxVehicleWheelsDynData::getConstraints() and PxVehicleWheelsDynData::getNbConstraints() have been added to potentially have vehicles use immediate mode for solving the vehicle rigid body constraints. +* New method PxVehicleGraph::getRawData() to extract raw telemetry data. +* New PxVehicleSteerFilter class, used in PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs & PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs to smooth the vehicle's steering angle when going from air to ground. +* A new function PxVehicleWheelsDynData::setTireContacts() has been added to the PhysX Vehicle SDK. This function allows users to directly set tire contact plane and friction for all tires on the vehicle as an alternative to using PxVehicleSuspensionSweeps() or PxVehicleSuspensionRaycasts(). +* A new function PxVehicleDrivableSurfaceToTireFrictionPairs::getSurfaceType(const PxMateria& surfaceMaterial), which returns the surface type associated with a PxMaterial instance. +* A new function PxVehicleDrivableSurfaceToTireFrictionPairs::getTypePairFriction(const PxMaterial& surfaceMaterial, const PxU32 tireType), which returns the friction value associated with a specified combination of PxMaterial instance and tire type. +* New complementary functions PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary() and PxVehicleDrivableSurfaceToTireFrictionPairs::deserializeFromBinary(), which allow friction tables to be serialized and deserialized. +* A new structure PxVehicleContext has been introduced to allow, for example, to have a set of common settings for vehicles in scene A and a different set for vehicles in scene B. PxVehicleUpdates() is one of the methods where there is now the option to use this new structure. +* The flag PxVehicleWheelsSimFlag::eDISABLE_SPRUNG_MASS_SUM_CHECK has been introduced to allow setting suspension sprung mass values that do not sum up to the mass of the vehicle rigid body. + +### Fixed: + +* Vehicle wheel suspension sweeps used the wrong scale for the sweep geometry if the wheel shapes used PxConvexMeshGeometry with scale factors other than 1. + +## Cooking + +### Deprecated: + +* The PxCooking object is deprecated. Please use the new standalone cooking functions instead (in the cooking library) or the low-level cooking functions (in the GeomUtils library). +* PxCooking::cookBVHStructure() is deprecated. Please use PxCookBVH() instead. + +### Added: + +* Added PxBVH34BuildStrategy enum to PxBVH34MidphaseDesc. Users can now select a SAH-based build strategy for BVH34 trees. +* BVH34 trees can now be quantized or not depending on PxBVH34MidphaseDesc::quantized. +* Added remeshing and mesh simplification to preprocess meshes such that they can be used for softbody simulation. New API functions are PxTetMaker::simplifyTriangleMesh()/remeshTriangleMesh()/createTreeBasedTetrahedralMesh() +* Added low-level cooking functions (GeomUtils), that can be used to cook objects without using the cooking library. See SnippetStandaloneQuerySystem for an example. The cooking library is still here though for backward compatibility. +* Triangle mesh cooking supports the generation of a SDF (Signed Distance Field) to allow triangle mesh colliders on dynamic actors. + +### Fixed: + +* Serialization of uncompressed BVH34 trees was broken (both for regular cooked files and binary serialization). This has been fixed. +* PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE was not taken into account when PxCookingParams::buildTriangleAdjacencies was used. + +### Changed: + +* PxMeshMidPhase::eBVH34 is now the default midphase structure. PxMeshMidPhase::eBVH33 has been deprecated. + +## Pvd + +### Added: + +* Adds the OmniPVD API - an object oriented serialization and deserialization library for debug data. The project is called PvdRuntime. + * Adds the OmniPVDWriter exposing serialization through OmniPVDWriteStream, OmniPVDFileWriteStream. + * Adds the OmniPVDReader exposing de-serialization through OmniPVReadStream, OmniPVDFileReadStream. +* Adds an OmniPVD API user in the PhysX SDK, exposed through PxOmniPVD, which streams PhysX debug data into an OmniPVD API write stream. + * PxOmniPVD is now an optional argument to the PxCreatePhysics() function, allowing for the parallel inclusion of both PVD and OVD debug streams. + * Adds PxPhysics::getOmniPvd() which returns the PxOmnipVD instance used in the call to PxCreatePhysics() + * Exports : Rigid Static, Rigid Dynamic, Joints, Articulations, Contacts and more into the OmniPVD stream. +* Possibility to serialize and save out, as well as read and parse OVD files (through the usage of OmniPVD API), which constain an OmniPVD command stream of PhysX debug data. +* Comes with a viewer in Omniverse Create, in the form of an extension called omni.physx.pvd also known as the OmniPVD extension. + * Adds the ability to import and inspect OVD files using the USD interface + +### Changed: + +* The file source/pvd/include/PxPvdRenderBuffer.h has been removed along with the structs it declared: pvdsdk::PvdDebugPoint, pvdsdk::PvdDebugLine, pvdsdk::PvdDebugTriangle and pvdsdk::PvdDebugText. Usage of these structs may be directly replaced with PxDebugPoint, PxDebugLine, PxDebugTriangle and PxDebugText, which are all declared in common/PxRenderBuffer.h. + +## Articulations + +### Deprecated: + +* PxArticulationJointReducedCoordinate::setLimit()/getLimit()/setDrive()/getDrive() functions are deprecated. New API has been added + +### Added: + +* Armature was added to the articulation joints. This adds additional inertia to the joint degrees of freedom. +* PxArticulationJointReducedCoordinate::dofScale was added. This scales the projection of a child's inertia onto the joint degrees of freedom, resulting in an implicit resistance to motion around the joint. This can improve simulation stability. +* Sensors were added to PxArticulationReducedCoordinate to report forces and torques acting on links in articulations. +* Fixed tendon support was added to articulations. +* Spatial tendon support was added to articulations. +* PxArticulationJointReducedCoordinate::setJointPosition/PxArticulationJointReducedCoordinate::getJointPosition was added. +* PxArticulationJointReducedCoordinate::setJointVelocity/PxArticulationJointReducedCoordinate::getJointVelocity was added. +* PxArticulationReducedCoordinate::getRootGlobalPose() was added. +* PxArticulationReducedCoordinate::setRootLinearVelocity()/getRootLinearVelocity() was added. +* PxArticulationReducedCoordinate::setRootAngularVelocity()/getRootAngularVelocity() was added. +* PxArticulationReducedCoordinate::setMaxCOMLinearVelocity()/getMaxCOMLinearVelocity() was added. +* PxArticulationReducedCoordinate::setMaxCOMAngularVelocity()/getMaxCOMAngularVelocity() was added. +* PxArticulationReducedCoordinate::setStabilizationThreshold()/getStabilizationThreshold() was added. +* PxArticulationReducedCoordinate::isSleeping()/wakeUp()/putToSleep() was added. +* PxArticulationReducedCoordinate::setSleepThreshold()/getSleepThreshold() was added. +* PxArticulationReducedCoordinate::setSolverIterationCounts()/getSolverIterationCounts() was added. +* PxArticulationReducedCoordinate::setWakeCounter()/getWakeCounter() was added. +* PxArticulationReducedCoordinate::updateKinematic() and corresponding PxArticulationKinematicFlags were added. The method allows updating link states after changing joint and root state through the respective PxArticulationReducedCoordinate and PxArticulationJointReducedCoordinate API calls. +* PxArticulationLink::setCfmScale()/getCfmScale() was added. +* Articulations in a GPU simulation may be updated/read directly from/to user-provided device buffers, see notes in GPU Rigid Bodies->Added. +* PxArticulationReducedCoordinate::setLimitParams/getLimitParams/setDriveParams()/getDriveParams() was added. +* Articulation system supports up to 65536 links per articulation. +* PxScene::computeGeneralizedMassMatrices() was added for batch computation of articulations' mass matrices on GPU. + +### Changed: + +* It is no longer possible to change the articulation structure while it is in a scene. However, the articulation retains its state through removal and re-adding to the scene, even when its configuration changes, so the application can remove the articulation from the scene, change its structure and re-add it to the scene in a straightforward way. Specifically, the following is no longer possible when an articulation is in a scene: + * Adding or removing links, tendons, or sensors + * Changing sensor flags and local poses + * Changing joint type or motion configuration +* PxArticulationReducedCoordinate::getCoefficientMatrixSize returns element size (i.e. number of PxReals) instead of Byte size, and returns 0xFFFFFFFF instead of 0 in case the articulation is not in a scene. +* Removed PxArticulationReducedCoordinate::releaseCache function and introduced a release method with the PxArticulationCache. +* Removed PxArticulationReducedCoordinate::releaseSpatialTendon function and introduced a release method with PxArticulationTendon. +* Removed PxArticulationReducedCoordinate::releaseFixedTendon function and introduced a release method with PxArticulationTendon. +* Removed PxArticulationSpatialTendon::releaseAttachment function and introduced a release method with PxArticulationAttachment. +* Removed PxArticulationFixedTendon::releaseTendonJoint function and introduced a release method with PxArticulationTendonJoint. +* Replaced PxArticulationFixedTendon::teleportRootLink function with PxArticulationReducedCoordinate::setRootGlobalPose. +* Both PxArticulationReducedCoordinate::getDofs and PxArticulationReducedCoordinate::getCacheDataSize return 0xFFFFFFFF instead of 0 in case the articulation is not in a scene. + +### Fixed: + +* Velocity drives on prismatic joints now consistent with rigid body prismatic joints. +* Numerical integration has been improved to better conserve momentum. + +### Removed: + +* The maximal coordinate articulations have been removed with the equivalent functionality exposed through the newer reduced coordinate articulations. +* It is no longer possible to set a global pose on an articulation link. +* It is no longer possible to set the linear velocity on an articulation link. +* It is no longer possible to set the angular velocity on an articulation link. +* PxArticulationReducedCoordinate::getLinkVelocity. Use PxArticulationLink::getLinearVelocity/getAngularVelocity or PxArticulationCache to read link velocities. + +## GPU Rigid Bodies + +### Added: + +* Support for GPU-accelerated aggregate broad phase collision detection has been added. +* PxSceneFlag::eSUPPRESS_READBACK flag was added. This suppresses state readback from GPU to the CPU (e.g. rigid body transforms, velocities, articulation state), which significantly improves performance. However, in order to access or set state on rigid bodies/articulations, the application must use the new copy/apply GPU API to access this state, providing device buffers to read from/write to. +* PxSceneFlag::eFORCE_READBACK flag was added to force GPU readback of articulation data even if PxSceneFlag::eSUPPRESS_READBACK is set. +* PxScene::copyArticulationData was added to copy the state of a set of articulations from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applyArticulationData was added to apply the state of a set of articulations from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copyActorData was added to copy the PxRigidDynamic/PxRigidActor data from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applyActorData was added to apply the state of a set of PxRigidDynamic/PxRigidActor from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copySoftBodyData was added to copy the state of a set of soft bodies from the internal buffers inside PhysX to a user-provided device buffer. +* PxScene::applySoftBodyData was added to apply the state of a set of soft bodies from a user-provided device buffer to the internal buffers inside PhysX. +* PxScene::copyContactData was added to copy the contact data from the internal buffers inside PhysX to a user-provided device buffer. + +### Changed: + +* Reworked PxgDynamicsMemoryConfig to simplify configuring GPU memory usage. This change can also significantly reduce GPU memory usage compared to PhysX 4. + +### Fixed: + +* Speculative CCD support was added to GPU rigid bodies. + +## Particle System + +### Added: + +* A PBD (Position Based Dynamics) particle system capable of simulating fluids and granular materials +* Interacts with all other supported actors (rigid bodies, soft bodies etc). +* User buffer architecture to store particles. It simplifies adding and removing particles at runtime and eliminates the need to specify a maximal number of particles when setting up a particle system. +* Supports multiple materials. Each particle can reference its own or a shared material. + +## Softbodies + +### Added: + +* FEM (Finite Element Method) based softbodies. +* Interact with all other supported actors (rigid bodies, particles etc). +* Generation of tetmeshes to create a softbody out of a triangle mesh. Different kinds of tetmeshes are supported to match different use cases (conforming and voxel based tetmeshes). +* Per-tetrahedra materials support. +* Attachment support including soft body vs soft body and soft body vs rigid body. + + +# v4.1.2 +April 2021 + +## General + +### Added: + +* Added SnippetTriggers to show how to emulate triggers using regular non-trigger shapes. This supports trigger-trigger notifications and CCD. +* Added Android 64 bits target: + + * Added build preset for Android arm64-v8a architecture. + * Using ANDROID ABI as part of the Android output folder to avoid name collisions between 32 and 64 bit binaries. + * Ignoring strict-aliasing warning on Android. + * Fixed compilation error on Android debug armv8: Not inlining computeDriveInertia function to fix "conditional branch out of range" error. + +* Added support to build iOS with dynamic libraries: + + * The changes are copied from macOS makefiles, now iOS makefiles are in line with macOS ones. + * Update toolchain cmake file to only generate 64 bits target on iOS (as its preset suggests because it's called "ios64"). + +* Added support to build Android with dynamic libraries. + + * The changes are copied from iOS makefiles, now Android makefiles are in line with iOS ones. + +* Modified cmake files of PhysXCharacterKinematic and PhysXExtension projects for Mac/iOS/Android so they add the suffix "_static" like the other platforms. + +### Fixed + +* Some profile zones did not properly setup the "context" parameter. This has been fixed. +* Removed duplicate closing cross-thread event for Basic.narrowPhase event. +* Fixed buffer over-read in CmPool.h +* Replaced all custom offsetof expressions that seem to dereference a null pointer with the PX_OFFSET_OF_RT macro. +* Replaced run-time assert on sizeof(PxHeightFieldSample::height) with compile-time assert in physx::Gu::HeightFieldUtil constructor. +* Various minor issues (doc typos, const correctness, compilation warnings, etc) reported on GitHub have been fixed. + + + +## Rigid body + +### Changed: + +* PxScene::setFrictionType() has been marked as deprecated due to its strong limitations. Simply set the desired friction type in PxSceneDesc. +* It is now legal to set the number of velocity iterations to zero. In some difficult configurations involving large mass ratios, the TGS solver's convergence can be negatively impacted by velocity iterations. + +### Fixed + +* The PxContactSet::ignore() function was not working properly and has been fixed. This may have caused issues in PxVehicleModifyWheelContacts. +* The debug visualization code could crash when using PxVisualizationParameter::eCOLLISION_COMPOUNDS. This has been fixed. +* Fixed a crash in the reduced-coordinates articulation system when the application removes the articulation from the scene and reinserts it back into the scene. +* Improved stacking quality with TGS solver simulating stacks of articulations. +* Fixed TGS solver stability issue constraining a rigid body to a kinematic actor. +* Fixed typo with ang dominance in CPU block solver. +* Fixed rare crash destroying a contact manager during CCD. +* Fixed buffer over-write when simulating a convex mesh with more than 64 vertices in a single face. + +### Added + +* PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS and PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS have been added. + + + +## Cooking + +### Fixed: + +* The number of bytes allocated for vertices by the convex hull builder was incorrect. This has been fixed. + + + +## Serialization + +### Fixed: + +* A performance problem in PxBinaryConverter when converting large collections has been fixed. + + + +## Vehicles + +### Added: + +* PxVehicleWheelsDynData::getConstraints() and PxVehicleWheelsDynData::getNbConstraints() have been added to potentially have vehicles use immediate mode for solving the vehicle rigid body constraints. +* New method PxVehicleGraph::getRawData() to extract raw telemetry data. +* An inflation parameter has been added to PxVehicleSuspensionSweeps. +* New flags PxVehicleWheelsSimFlag::eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST and PxVehicleWheelsSimFlag::eDISABLE_SUSPENSION_FORCE_PROJECTION have been added. + +### Changed: + +* Concurrent calls to PxVehicleUpdateSingleVehicleAndStoreTelemetryData() are now permitted if the additional parameter vehicleConcurrentUpdates is used. + +### Fixed: + +* A null pointer dereference bug has been fixed. The bug occurred if the vehicle's rigid body actor was asleep and the vehicle relied on cached tire contact planes rather than the results of a fresh suspension query. + + + +## Character controller + +### Fixed: + +* The prefilter & postfilters callback were called all the time, ignoring the PxQueryFlag::ePREFILTER and PxQueryFlag::ePOSTFILTER flags. This has been fixed. + + + +## Scene queries + +### Fixed: + +* The BVH34 codepath had a bug in the raycast-vs-mesh-with-multiple-hits case, where returned hits could be further away than defined max hit distance. This has been fixed. + + + + + +# v4.1.1 +August 2019 + +## General + +### Added: + +* Support for Visual Studio 2019 has been added, cmake 3.14 is required. + +### Changed: + +* Android binary output directory name contains Android ABI string. + + + +## Vehicles + +### Added: + +* PxVehicleWheelsSimFlags and corresponding set/get methods have been added to PxVehicleWheelsSimData. The flag eLIMIT_SUSPENSION_EXPANSION_VELOCITY can be used to avoid suspension forces being applied if the suspension can not expand fast enough to push the wheel onto the ground in a simulation step. This helps to reduce artifacts like the vehicle sticking to the ground if extreme damping ratios are chosen. + +### Fixed: + +* The PxVehicleDrive::setToRestState() was not clearing all cached data, which could sometimes make vehicles misbehave after calls to this function. + + + +## Cooking + +### Added: + +* Added error message when not at least four valid vertices exist after vertices cleanup. + + + +## Serialization + +### Fixed: + +* Binary serialization of kinematic rigid dynamic actors was failing unless they were part of a scene. + + + +## Rigid body + +### Fixed + +* Out of shared memory failure with GPU articulations. +* Inconsistent results when setting joint drive targets with GPU articulations compared to CPU articulations. +* Assert when simulating a scene with > 64k rigid bodies and joints. +* Error in PxActor::getConnectors() method when there are multiple connector types. +* Setting joint positions on articulations did not update world-space link poses and velocities. +* Improved TGS articulation joint drive solver. +* Improved robustness of articulation spherical joints. +* Joint forces/positions/velocities set through the PxArticulationCache are correctly applied when using GPU articulations. +* Fixed rare crash in MBP when the system contains out-of-bounds objects. +* Fixed a crash in the reduced-coordinates articulation system when the application removes the articulation from the scene and reinserts it back into the scene. + + + + + +# v4.1.0 +March 2019 + +## Overview + +### Immediate mode support for reduced-coordinates articulations and the temporal Gauss Seidel solver. +### GPU acceleration for reduced-coordinates articulations. + + +## General + +### Added: + +* Added support for UWP, note that cmake 3.13.4 is required for uwp arm64. + +### Fixed: + +* PhysXGpu DLLs are now standalone, so they will now work with both static and dynamic PhysX libraries. +* PhysX delay loading code is disabled for the static library configuration. + +### Changed: + +* Removed PxGpuDispatcher class. Instead of querying the GPU dispatcher with PxCudaContextManager::getGpuDispatcher() and providing it to the PxScene with PxSceneDesc::gpuDispatcher, please provide the CUDA context manager directly using PxSceneDesc::cudaContextManager. +* PxCreateCudaContextManager does have an additional parameter PxProfilerCallback, that is required in order to get profiling events from the GPU dll. +* FastXml project is now compiled as OBJECT on win platforms and is linked into PhysXExtensions library. +* Removed PxArticulationBase::getType(), PxArticulationBase::eReducedCoordinate, PxArticulationBase::eMaximumCoordinate and added PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE. + + + +## Rigid Bodies + +### Added: + +* Immediate mode API for reduced-coordinates articulations. +* Immediate mode API for the temporal Gauss Seidel (TGS) solver . +* Compute dense Jacobian matrix for the reduced-coordinates articulations. +* GPU acceleration for reduced-coordinates articulations with PGS solver. +* GPU acceleration for reduced-coordinates articulations with TGS solver (experimental). + +### Changed: + +* PxSimulationStatistics::nbDynamicBodies does not include kinematics any longer. Instead they are covered in new nbKinematicBodies counter. + +### Fixed: + +* Fixed speculative CCD optimization with sleeping bodies. +* Fixed the overlap termination condition in the GJK code for sphere primitive. +* Fixed a bug in the face selection algorithm for paper thin box overlapped with capsule. +* Fixed a contact recycling issue with PCM contact gen. +* Fixed an issue with articulation when removing and adding links to the articulation. + + + +## Serialization + +### Added: + +* PxSerialization::serializeCollectionToBinaryDeterministic, convenience function to post-process binary output with PxBinaryConverter for determinism. For achieving determinism, the checked build needs to be used. +* Support for binary and xml serialization for PxArticulationReducedCoordinate. + +### Fixed: + +* PxBinaryConverter can now produce deterministic output, independent of the runtime environment the objects have been serialized in. For achieving determinism, the checked build needs to be used for serializing collections. + +### Changed: + +* PX_BINARY_SERIAL_VERSION has been changed to a global unique identifier string. PX_PHYSICS_VERSION is no longer part of binary data versioning. + + + + + +# v4.0.0.25635910 +January 2019 + +## General + +### Fixed: + +* Fixed issue in PxBinaryConverter::convert that could corrupt platform re-targeting of convex meshes with more than 127 vertices. +* GenerateProject scripts should now also work when not called from PhysX directory. +* GenerateProject script will now create correct compiler/ directory on Linux based systems. +* Removed /Wall from MSVC compilers. +* Fixed CMake install, added missing cudacontextmanager files. +* Fixed binary serialization of actors in aggregates without serialization of the containing aggregate. + +### Removed: + +* CharacterKinematic API export/import macros have been removed. + +### Added: + +* Support for Linux samples has been added. +* PxConfig.h include file will be generated during generate projects script. Including this file in your project will ensure that required defines (like PX_PHYSX_STATIC_LIB) are set. + +### Changed: + +* PX_FOUNDATION_API was moved to PhysX and uses PX_PHYSX_STATIC_LIB define as the rest of the SDK. +* PxAssertHandler moved from PxShared to PhysX and marked as deprecated. +* PxShared does use PX_SHARED_ASSERT instead of PX_ASSERT which is used just in the PhysX SDK and uses PxAssertHandler. + + + + + +# v4.0 +December 2018 + +## Supported Platforms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Runtime + Development
+ Apple iOS (tested on 12.1) + Xcode (tested with 10.1)
+ Apple macOS (tested on 10.13) + Xcode (tested with 10.1)
+ Google Android ARM (tested with API Level 19 - KITKAT) + NDK r13b
+ Linux (tested on Ubuntu 16.04), GPU acceleration: display driver and GPU supporting CUDA 10 / CUDA ARCH 3.0 + Clang (tested with 3.8)
+ Microsoft Windows, GPU acceleration: display driver and GPU supporting CUDA 10 / CUDA ARCH 3.0 + Microsoft Visual Studio 2013, 2015, 2017
+ Microsoft XBox One* +
+ Nintendo Switch* +
+ Sony Playstation 4* +
+ +\* Console code subject to platform NDA not available on GitHub. Developers licensed by respective platform owners please contact NVIDIA for access. + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Added: + +* New Temporal Gauss Seidel (TGS) solver offering a new level of simulation accuracy. +* New Reduced Coordinate Articulation feature with no relative positional error and realistic actuation. +* New automatic multi-broadphase (ABP) providing better out of the box performance for many use cases. +* New BVH structure supporting better performance for actors with many shapes. + +### Removed: + +* PhysX Particle feature. +* PhysX Cloth feature. +* The deprecated active transforms feature has been removed. Please use active actors instead. +* The deprecated multi client behavior feature has been removed. +* The deprecated legacy heightfields have been removed. + +### Changed: + +* The PhysX SDK build system is now based on CMake generated build configuration files. For more details, please refer to the PhysX SDK 4.0 Migration Guide. +* The Linux build has been changed to produce static as opposed to shared libraries. The compiler was switched from GCC to Clang. +* The PxShared library contains functionality shared beyond the PhysX SDK. It has been streamlined to a minimal set of headers. The PxFoundation singleton has been moved back to the PhysX SDK, as well as the task manager, CUDA context manager and PhysX Visual Debugger (PVD) functionality. +* PhysXDelayLoadHook and PhysXGpuLoadHook have been simplified, and PxFoundationDelayLoadHook has been removed. + + + +## Rigid Bodies + +### Added: + +* A new broadphase implementation has been added. See PxBroadPhaseType::eABP for details. This is now the default broadphase implementation. +* TGS: A new rigid body solver, which can produce improved convergence compared to the default rigid body solver. +* Optional torsional friction model to simulate rotational friction when there is just a single point of contact. +* A flag to enable friction constraints to be processed every frame has been added +* PxContactJoint added to represent contacts in inverse dynamics. Not intended for use in simulation. +* A missing PxShape::getReferenceCount() function has been added. +* A new flag has been added to PxMaterial to improve friction accuracy. The flag is disabled by default to maintain legacy behavior. + +### Removed: + +* PxVisualizationParameter::eDEPRECATED_BODY_JOINT_GROUPS has been removed. +* PxSceneDesc::maxNbObjectsPerRegion has been removed. +* PxRigidActor::createShape() has been removed. Please use PxPhysics::createShape() or PxRigidActorExt::createExclusiveShape() instead +* The deprecated mass parameter in PxTolerancesScale has been removed. +* PxSceneFlag::eDEPRECATED_TRIGGER_TRIGGER_REPORTS has been removed. + +### Changed: + +* Aggregates can now contain more than 128 actors. +* Switching a kinematic object to dynamic does not automatically wake up the object anymore. Explicit calls to PxRigidDynamic::wakeUp() are now needed. +* Switching a kinematic object to dynamic re-inserts the object into the broadphase, producing PxPairFlag::eNOTIFY_TOUCH_FOUND events instead of PxPairFlag::eNOTIFY_TOUCH_PERSISTS events. +* PxConvexMeshGeometryFlag::eTIGHT_BOUNDS is now enabled by default for PxConvexMeshGeometry. +* The default max angular velocity for rigid bodies has been changed, from 7 to 100. + + + + + +## Extensions + +### Added: + +* PxD6Joint now supports per-axis linear limit pairs. +* Added PxSphericalJoint::getSwingYAngle and PxSphericalJoint::getSwingZAngle. +* Added PxD6Joint distance limit debug visualization. +* Added PxD6JointCreate.h file with helper functions to setup the D6 joint in various common configurations. +* Added pyramidal swing limits to the D6 joint. + + +### Removed: + +* PxComputeHeightFieldPenetration has a new signature. +* PxComputeMeshPenetration has been removed. Use PxComputeTriangleMeshPenetration instead. + + +### Changed: + +* PxRevoluteJoint now properly supports a -PI*2 to +PI*2 range for its limits, and the accuracy of limits has been improved. In order to use extended limit ranges, PxConstraintFlag::eENABLE_EXTENDED_LIMITS must be raised on the constraint. +* PxD6Joint now properly supports a -PI*2 to +PI*2 range for its twist limit, and the accuracy of the twist limit has been improved. In order to use extended limit ranges, PxConstraintFlag::eENABLE_EXTENDED_LIMITS must be raised on the constraint. +* The accuracy of the D6 joint swing limits has been improved. +* PxDistanceJoint does now always insert constraint row, this change does increase the limit precision. +* PxDistanceJoint::getDistance does not anymore return squared distance. +* PxD6Joint::setDriveVelocity, PxD6Joint::setDrivePosition and PxRevoluteJoint::setDriveVelocity have now additional parameter autowake, which will wake the joint rigids up if true (default behavior). +* Joint shaders now take a bool to define whether to use extended joint limits or not. +* Joint shaders must now provide the cA2w and cB2w vectors, defining the world-space location of the joint anchors for both bodies. + + +### Deprecated: + +* PxD6Joint::getTwist() has been deprecated. Please use PxD6Joint::getTwistAngle() now. +* The previous PxD6Joint::setLinearLimit() and PxD6Joint::getLinearLimit() functions (supporting a single linear limit value) have been deprecated. Please use PxD6Joint::setDistanceLimit() and PxD6Joint::getDistanceLimit() instead. Or you can also use the new PxD6Joint::setLinearLimit() and PxD6Joint::getLinearLimit() functions, which now support pairs of linear limit values. + + + +## Articulations + +### Added: + +* New reduced coordinate articulation implementation, supporting a wider range of joint types, more accurate drive model, inverse dynamics and joint torque control. +* PxArticulationJoint::getParentArticulationLink and PxArticulationJoint::getChildArticulationLink has been added. + + + +## Scene queries + +### Removed: + +* PxHitFlag::eDISTANCE has been removed. +* The PxVolumeCache feature has been removed. +* The PxSpatialIndex feature has been removed. +* The deprecated PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT has been removed. + + + +## Cooking + +### Added: + +* PxBVHStructure added, it computes and stores BVH structure for given bounds. The structure can be used for actors with large amount of shapes to perform scene queries actor centric rather than shape centric. For more information please see guide or snippets. + +### Removed: + +* PxPlatform enum has been removed. PhysX supported platforms all share the same endianness +* The deprecated PxCookingParams::meshCookingHint and PxCookingParams::meshSizePerformanceTradeOff parameters have been removed. +* The deprecated PxGetGaussMapVertexLimitForPlatform has been removed, use PxCookingParams::gaussMapLimit instead. +* The deprecated PxConvexMeshCookingType::eINFLATION_INCREMENTAL_HULL and PxCookingParams::skinWidth have been removed. +* PxBVH34MidphaseDesc::numTrisPerLeaf has been renamed to PxBVH34MidphaseDesc::numPrimsPerLeaf + + + + +# v3.4.2.25354359 +December 2018 + +## General + +### Changed: + +* Changed GitHub distribution to BSD license. + + + +## Supported Platforms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Runtime + Development
+ Apple iOS (tested on 12.1) + Xcode (tested with 10.1)
+ Apple macOS (tested on 10.13) + Xcode (tested with 10.1)
+ Google Android ARM (tested with API Level 16, Android 4.1 - JELLY_BEAN) + NDK r13b-win32
+ Linux (tested on Ubuntu 16.04, GPU acceleration: NVIDIA Driver version R361+ and CUDA ARCH 3.0) + GCC (tested with 4.8)
+ Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) + Microsoft Visual Studio 2012, 2013, 2015
+ Microsoft XBox One* +
+ Nintendo Switch* +
+ Sony Playstation 4* +
+ +\* Console code subject to platform NDA not available on GitHub. Developers licensed by respective platform owners please contact NVIDIA for access. + + + +# v3.4.2.25256367 +November 2018 + +## General + +### Changed: + +* A couple of serialization write functions have been optimized. +* Rtree cooking has been slightly optimized. +* Renamed PxSerializer::requires to PxSerializer::requiresObjects due to an erroneous clash with C++20 keyword with apple-clang. + +### Fixed: +### Moved external vector math includes out of PhysX namespaces. + + + +## Rigid Bodies + +### Fixed: + +* Fixed an incorrect trigger behavior when a trigger was removed and inserted within the same frame. + + + +## Scene query + +### Fixed: + +* Fixed a bug in BVH34. Raycasts could fail on binary deserialized BVH34 triangle meshes. + + + + + +# v3.4.2.24990349 +September 2018 + +## General + +### Fixed: + +* PxMeshQuery::getTriangle adjacency information for heightfield geometry fixed. +* Removed PxSetPhysXGpuDelayLoadHook from API. Delay loaded dynamically linked library names are now provided through PxSetPhysXDelayLoadHook. +* Fixed a source of non-determinism with GPU rigid bodies. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a divide by zero bug when gjk is trying to calculate the barycentric coordinate for two identical/nearly identical points. +* Fixed an incorrect mesh index reported in contact buffer when stabilization flag was used. + + + + + +# v3.4.2.24698370 +August 2018 + +## Rigid Bodies + +### Fixed: + +* Fixed a crash bug when EPA's edge buffer overflow. +* GPU rigid bodies fixed for Volta GPUs. + +### Added: + +* Aggregate broad phase now runs in parallel + + + +## Cooking + +### Fixed: + +### Added: + +* PxHeightField::getSample has been added. + + + +## Character controller + +### Fixed: + +* Capsule controller with a very small height could degenerate to spheres (with a height of exactly zero) far away from the origin, which would then triggers errors in Debug/Checked builds. This has been fixed. +* The triangle array growing strategy has been changed again to prevent performance issues when tessellation is used. Memory usage may increase in these cases. +* Some internal debug visualization code has been disabled and a crash in it has been fixed. + + + +## Scene query + +### Fixed: + +* Fixed possible buffer overrun when PxPruningStructure was used. +* Raycasts against a heightfield may have missed if a large distance was used. +* Sq raycasts against heightfield or triangle mesh could return a mildly negative values, this has been fixed. + + + + + +# v3.4.2.24214033 +May 2018 + +## General + +### Fixed: + +* Fixed clang 7 unionCast issues. +* Fixed the binary meta data in PhysX_3.4/Tools/BinaryMetaData for conversion of vehicles. + + + +## Rigid Bodies + +### Deprecated: + +* PxSceneFlag::eENABLE_KINEMATIC_STATIC_PAIRS and PxSceneDesc::eENABLE_KINEMATIC_PAIRS have been deprecated. Use the new PxPairFilteringMode parameters in PxSceneDesc instead. + +### Fixed: + +* A sequence of shape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, false) / shape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, true) without simulation calls in-between could produce errors in the broadphase. This has been fixed. +* Fixed a bug in the broadphase (SAP) that got recently introduced in SDK 3.4.1.23933511. It should only have generated a few false positives (more overlaps than strictly necessary). +* Fixed a bug in PxShape::checkMaterialSetup. +* Fixed intermittent crash with GPU rigid bodies when materials were destroyed. +* Fixed bug where setting maxImpulse to 0 on CCD contact modification meant contact was not reported in the frame's contact reports. + + + +## Cooking + +### Fixed: + +* Big convex mesh serialization used together with insertion callback stored incorrect memory for big convex data. This has been fixed. + + + +## Scene query + +### Fixed: + +* Fixed a bug in extended bucket pruner, when a pruning structure was added and immediatelly released. + + + + + +# v3.4.1.23933511 +April 2018 + +## General + +### Added: + +* Added snippet for deformable meshes, added section in the guide for them. + + + +## Rigid Bodies + +### Fixed: + +* PxTriangleMesh::refitBVH() was crashing with PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE. This has been fixed. +* SQ-only shapes contained in aggregates could result in crashes or memory corruption when removed from the aggregate. This has been fixed. +* Assert no longer fired if a dynamic body contacting a static is converted to kinematic with kinematic-static pairs enabled. +* Assert reporting broad phase as being "inconsistent" could fire when using speculative CCD when sleeping objects were activated. + + + +## Cooking + +### Fixed: + +* Convex hull cooking could have produced hulls with vertices too far from convex hull planes, this has been fixed. + +### Changed: + +* PxCooking::createTriangleMesh does now take additional output parameter PxTriangleMeshCookingResult::Enum. +* PxCooking::createConvexMesh does now take additional output parameter PxConvexMeshCookingResult::Enum. + + + +## Scene query + +### Changed: + +* PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT has been marked as deprecated. Was replaced with PxSceneQueryUpdateMode enum, if this new enum is set the flag gets ignored. + +### Added: + +* PxSceneQueryUpdateMode was added to control work done during fetchResults. +* PxScene::sceneQueriesUpdate, PxScene::checkQueries and PxScene::fetchQueries were added to run separate scene query update, see manual for more details. + + + + + +# v3.4.1.23584284 +February 2018 + +## General + +### Fixed: + +* PhysX sometimes froze in a spinlock after certain sequences of read & write locks. This has been fixed. + + + +## Scene queries + +### Fixed: + +* Raycasts against heightfields were sometimes missing hits for vertical rays were located exactly at the heightfield's boundaries. This has been fixed. + + + +## Rigid Bodies + +### Fixed: + +* Avoid edge-face collisions on boundary edges when eNO_BOUNDARY_EDGES flag is raised on heightfield when using PCM and unified HF collision. + + + + + +# v3.4.1.23472123 +January 2018 + +## General + +### Added: + +* Visual Studio 2017 15.5.1 and newer is now supported. Samples are currently not supported with Visual Studio 2017. + + +### Removed: + +* Visual Studio 2012 support is discontinued. + + + +## Cooking + +### Fixed: + +* Cooked mesh structures contained a mix of little-endian and big-endian data (the midphase structures were always saved as big-endian). This made loading of cooked files slower than necessary. This has been fixed. + + + +## Scene queries + +### Fixed: + +* Buffered moves were sometimes not properly taken into account by scene queries, leading to invalid results for one frame. This has been fixed. +* Pruning structure failed to build when actor had more shapes. This has been fixed. + + + + + +# v3.4.1.23173160 +November 2017 + +## Extensions + +### Fixed: + +* An issue with CCD sweeps against meshes that could potentially lead to the earliest impact not being detected has been fixed. + + + + + +# v3.4.1.23131702 +November 2017 + +## General + +### Fixed: + +* A bug in the management of internal interaction objects has been fixed. + + + +## Extensions + +### Fixed: + +* A regression in prismatic constraint stability introduced in PhysX 3.4.1 has been fixed. +* PxRevoluteJoint::getAngle(), PxD6Joint::getTwist(), PxD6Joint::getSwingYAngle() and PxD6Joint::getSwingZAngle() did not always return the correct angle. This problem has been fixed. +* The "double cone" case of the D6 joint had errors both in the debug visualization and the code dealing with limits. This has been fixed. +* The debug visualization of the D6 joint in the twist case did not properly color-code the angular limits. This has been fixed. +* The debug visualization of distance joints has been fixed. +* The debug visualization of prismatic joints has been fixed. +* The debug visualization of revolute joints has been fixed. It now renders active limits properly (in red when the limit is active, grey otherwise). +* Proper visualization flags are now passed to the PxConstraintVisualize function. Previously all available flags were active, even if PxVisualizationParameter::eJOINT_LOCAL_FRAMES and/or PxVisualizationParameter::eJOINT_LIMITS were set to zero. +* PxRevoluteJoint::getVelocity has been fixed. + + + +## Scene queries + +### Fixed: + +* Sweep queries using the eMTD flag could generate incorrect normals in sphere/sphere, sphere/capsule or capsule/capsule cases, when the objects were exactly overlapping each-other. This has been fixed. +* Sweep convex mesh vs heightfield queries using the eMTD flag did not fill correctly returned faceIndex. This has been fixed. + + + + + +# v3.4.1 +September 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Deprecated: + +* The PhysX cloth feature has been deprecated. + +### Changed: + +* The meaning of PxVisualizationParameter::eCULL_BOX has changed. It is now used to visualize the current culling box, while it was previously used to enable or disable the feature. Please simply use PxScene::setVisualizationCullingBox() to enable the feature from now on. +* PxVisualizationParameter::eBODY_JOINT_GROUPS has been deprecated. +* Performance of setCMassLocalPose function has been improved. + +### Added: + +* PhysXGpu: Added warnings for the case when the dynamic gpu library fails to load. + + + +## Rigid Bodies + +### Fixed: + +* A potential crash when calling detachShape has been fixed. +* Fixed assert that fired if application switched a body from dynamic to kinematic, then queried kinematic target without setting one. This assert only fired if the modifications overlapped simulation so were buffered. +* PxArticulation::getStabilizationThreshold() and PxArticulation::setStabilizationThreshold() were accessing the sleep threshold instead of the stabilization threshold. This has been fixed. +* Fixed an internal edge bug in PCM sphere vs mesh code +* Make sure sphere vs sphere and sphere vs box in PCM contact gen generate contacts consistently on the second body when the sphere center is contained in the other shape + +### Changed: + +* Improved convex vs mesh contact generation when using GPU rigid bodies. Requires the mesh to be recooked. +* Improved convex vs convex contact generation when using GPU rigid bodies. +* Reduced memory footprint of GPU triangle meshes significantly. Requires the mesh to be recooked. + +### Added: + +* Support for modifying friction and restitution coefficients has been added to contact modification. +* Added PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE to enable maxContactImpulse member of PxRigidBody to be used in CCD. This is disabled by default. It is useful in some circumstances, e.g. shooting a small ball through a plate glass window and triggering it to break, but it can also result in behavioral artifacts so it is disabled by default. +* Added PxSceneDesc::solverOffsetSlop. This is defaulted to a value of 0. A positive, non-zero value defines a tolerance used in the solver below which a contacts' offset from the COM of the body is negligible and therefore snapped to zero. This clamping occurs in a space tangential to the contact or friction direction. This is aimed at pool or golf simulations, where small numerical imprecision in either contact points or normals can lead to balls curving slightly when there are relatively high angular velocities involved. +* Added PxConvexMeshGeometry::maxMargin. This allows the application to tune the maximum amount by which PCM collision detection will shrink convex shapes in contact generation. This shrinking approach leads to some noticeable clipping around edges and vertices, but should not lead to clipping with face collisions. By default, the mesh is shrunk by an amount that is automatically computed based on the shape's properties. This allows you to limit by how much the shape will be shrunk. If the maxMargin is set to 0, then the original shape will be used for collision detection. + + + + +## Scene queries + +### Fixed: + +* A rare invalid memory read that could lead to incorrect sweep results in case of an initial overlap has been fixed. + + + +## Serialization + +### Fixed: + +* Binary serialization didn't preserve PxConstraintFlags, e.g. projection flags. +* Xml serialization failed if a shape referencing a PxTriangleMesh was added to another (dependent) collection. + + + +# v3.4.0.22387197 +June 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## Cooking + +### Fixed: + +* Fixed issue when PxConvexFlag::e16_BIT_INDICES was used together with PxConvexFlag::eCOMPUTE_CONVEX. +* Fixed issue in convex hull cooking when postHullMerge was not executed. +* Fixed crash in CCD when using bodies with 0 mass. + + + +## Rigid Bodies + +### Fixed: + +* Fixed behavioral differences when comparing the results of a given scene to the results when simulating a subset of the islands in that scene. In order for this case to be deterministic, it is necessary to raise PxSceneFlag::eENABLE_ENHANCED_DETERMINISM. + + +### Added: + +* Introduced maxBiasCoefficient in PxSceneDesc to be able to limit the coefficient used to scale error to produce the bias used in the constraint solver to correct geometric error. The default value is PX_MAX_F32 and, therefore, a value of 1/dt will be used. This value can be useful to reduce/remove jitter in scenes with variable or very small time-steps. + +# v3.4.0.22121272 +May + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug in convex vs convex PCM contact gen code. There were cases in which full contact gen should have been triggered but was not. +* Fixed a jittering bug on both GPU/CPU codepath in PCM contact gen code. This is due to the contact recycling condition not considering the toleranceLength. +* Fixed a bug causing simulation to behave incorrectly when greater than 65536 bodies were simulated. + + + +## Scene queries + +### Fixed: + +* A rare crash that could happen with sphere overlap calls has been fixed. +* Fixed a stack corruption in CCD contact modification callback. +* Fixed a bug where external forces were not cleared correctly with PxArticulations. + + + +## Cooking + +### Changed: + +* Convex hull cooking now reuses edge information, perf optimization. +* PxCooking API is now const if possible. + + +# v3.4.0.22017166 +April 2017 + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Added: + +* PxConvexMeshGeometry::maxMargin has been added. This will let the application limit how much the shape is shrunk in GJK when using by PCM contact gen + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug with joint breaking where sometimes joints would not break as expected. +* Fix a race condition between cloth/particle/trigger interactions and the parallel filtering of rigid body interaction. +* GPU rigid body feature now issues a performance warning in checked build if feature is enabled but PCM contact gen is not. +* Fixed a bug with applying external force/torque to a body in buffered insertion stage. +* Fixed a bug with CCD involving rotated static mesh actors. +* Fixed a memory leak in CCD. + +### Changed: + +* Optimizations for GPU rigid body feature, including reduced memory footprint and improvements to performance spikes when many objects are woken in a single frame. + + + +## Midphase + +### Fixed: + +* Fix Crash in BV4 code (serialization bug). + + + +## Cooking + +### Fixed: + +* Fix endless loop in convex hull cooking. + + +# v3.4.0.21821222 +March 2017 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM (version 2.2 or later required for SDK, 2.3 or later required for snippets) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft XBox One +* Nintendo Switch +* Sony Playstation 4 + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013, 2015 +* Xcode 8.2 + + +## Known Issues + + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + + + +## General + +### Fixed: + +* A rare crash happening in the debug visualization code has been fixed. + + + +## Rigid Bodies + +### Fixed: + +* Fixed a bug in PCM capsule vs plane contact gen. +* A crash happening with more than 64K interactions has been fixed. +* Fixed an island management issue in CCD when using multiple CCD passes. +* Fixed a bug with GPU rigid bodies with non-simulation scene query-only shapes. +* Fixed a bug in convex vs convex PCM contact gen code. There were cases in which full contact gen should have been triggered but was not. +* Fixed a jittering bug on both GPU/CPU codepath in PCM contact gen code. This is due to the contact recycling condition not considering the toleranceLength. + +### Added: + +* getFrozenActors has been added to allow application queries the frozen actors +* PxRigidDynamic::setKinematicSurfaceVelocity has been added, permitting the user to set a persistent velocity on a kinematic actor which behaves like a conveyor belt +* PxSceneDesc::solverOffsetSlop added. This defines a threshold distance from a body's COM under which a contact will be snapped to the COM of the body inside the solver along any principal component axis + + + +## Scene queries + +### Fixed: + +* A bug in the BVH34 overlap code sometimes made PxMeshOverlapUtil::findOverlap assert (reporting an incorrect buffer overflow). This has been fixed. +* Fix a bug in the case of two primitives just touching in sweep with eMTD flag on. + + + +# v3.4 +February 2017 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM (version 2.2 or later required for SDK, 2.3 or later required for snippets) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft XBox One +* Nintendo Switch +* Sony Playstation 4 + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013, 2015 +* Xcode 8.2 + + +## Known Issues + + + +## Changes and Resolved Issues +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added: + + * nbAggregates, nbArticulations, nbDiscreteContactPairsTotal, nbDiscreteContactPairsWithCacheHits and nbDiscreteContactPairsWithContacts have been added to PxSimulationStatistics. + * PxSceneLimits::maxNbBroadPhaseOverlaps has been added. + * A new midphase has been added. See PxMeshMidPhase enum for details. + * Midphase descriptor has been added. See PxMidphaseDesc for details. + * PxHeightField::getTimestamp() has been added + * PxCloneShape has been added to enable cloning of shapes. + * acquireReference() has been added to increment the reference count of shapes, materials, triangle meshes, convex meshes heightfields and cloth fabrics. + * The global filter shader data block can now be set through PxScene::setFilterShaderData(). + * PxGpuLoadHook and PxSetPhysXGpuLoadHook has been added to support loading of GPU dll with a different name than the default. + * A new profile zone has been added for debug visualization. + +* Changed: + + * PxMathUtils.h has moved from include/common to include/foundation + * GPU support requires SM2.x (Fermi architecture, GeForce 400 series) or later hardware. SM1.x is no longer supported. + * Windows XP 64-bit and Windows Vista no longer support GPU acceleration. Windows XP 32-bit still supports GPU acceleration. + * PxTaskManager::createTaskManager requires error callback and does not accept SPU task manager. + * PxCreatePhysics and PxCreateBasePhysics now take an optional pointer to an physx::PxPvd instance. + * PxConstraintConnector::updatePvdProperties now takes an optional pointer to an physx::pvdsdk::PvdDataStream instance. + * PxInitExtensions now takes an optional pointer to an physx::PxPvd instance. + * Shared objects (triangle mesh, convex mesh, heightfield, material, shape, cloth fabric) no longer issue an eUSER_RELEASE event when their release() method is called + * PxBase::isReleasable() is now a property only of the type of an object, not the object state. In particular, isReleasable() returns true for PxShape objects whose only counted reference belongs to their owning actor. + * PxCollection::releaseObjects() now calls release() even on shapes whose only counted reference belongs to their owning actor. An optional parameter releaseExclusiveShapes, which defaults to true, has been added to this method to assist with common scenarios in which all shapes are created with the deprecated method PxRigidActor::createShape() or its replacement PxRigidActorExt::createExclusiveShape() + * Negative mesh scale is now supported for PxTriangleMeshGeometry. Negative scale corresponds to reflection and scale along the corresponding axis. In addition to reflection PhysX will flip the triangle normals. + * PxDelayLoadHook is now inherited from PxFoundationDelayLoadHook. PxFoundation dll and PxPvdSDK dll are now delay loaded inside the SDK, their names can be provided through the delay load hook. + +* Removed: + + * Sony Playstation 3 is not supported any longer. Any related APIs have been removed. + * Microsoft XBox 360 is not supported any longer. Any related APIs have been removed. + * Nintendo Wii U is not supported any longer. Any related APIs have been removed. + * Sony Playstation Vita is not supported any longer. Any related APIs have been removed. + * Visual Studio 2010 is not supported any longer. + * Microsoft Windows RT is not supported any longer. + * Google Android X86 is not supported any longer. + * PhysX Samples are not supported anymore except on Microsoft Windows. + * Linux 32-bit no longer support GPU acceleration. Linux 64-bit still supports GPU acceleration. + +* Fixed: + + * PxScene::setFlag() does now properly send error messages in CHECKED builds if a non-mutable scene flag gets passed in. + * Fixed a bug in force threshold based contact reports, which caused events to be lost. + * Fixed a bug in aggregates that led to a crash when rigid bodies are added to an aggregate after removing all rigid bodies from an aggregate. This only occurred with aggregates that were added to the scene and with rigid bodies that had shapes attached. + * Fixed a bug where non-breakable joints could break, leading to a crash. + * Fixed RepX load of kinematic rigid bodies with mesh shapes. + * Fixed a divide by zero bug in SIMD distanceSegmentTriangle function. + * Debug visualization for compound bounds (PxVisualizationParameter::eCOLLISION_COMPOUNDS) now works even when all the compounds' shapes have their debug viz flag (PxShapeFlag::eVISUALIZATION) disabled. + * Double-buffering now works properly for the debug visualization culling box. + * The default debug visualization culling box now works correctly with heightfields. + * Rare crashes in PxShape::setGeometry() and PxShape::getMaterials() have been fixed. + * A crash happening when doing an origin shift on a scene containing an empty aggregate has been fixed. + +* Deprecated: + + * PxSceneLimits::maxNbObjectsPerRegion has been deprecated. It is currently not used. + * PxComputeHeightFieldPenetration has a new signature, and the old one has been deprecated + * PxComputeMeshPenetration has been deprecated. Use PxComputeTriangleMeshPenetration. + * The PhysX particle feature has been deprecated. + * PxTolerancesScale::mass has been deprecated. It is currently not used. + * PxActorClientBehaviorFlag has been marked as deprecated and will be removed in future releases. + +* Removed deprecated API: + + * PxPairFlag::eCCD_LINEAR removed. Use PxPairFlag::eDETECT_CCD_CONTACT | PxPairFlag::eSOLVE_CONTACT instead. + * PxPairFlag::eRESOLVE_CONTACTS removed. Use PxPairFlag::eDETECT_DISCRETE_CONTACT | PxPairFlag::eSOLVE_CONTACT instead. + * PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICE removed. Use PxTriangleMeshFlag::e16_BIT_INDICES instead. + * PxTriangleMeshFlag::eHAS_ADJACENCY_INFO removed. Use PxTriangleMeshFlag::eADJACENCY_INFO instead. + * PxTriangleMeshDesc::convexEdgeThreshold removed. + * PxSceneQueryFlag renamed to PxHitFlag. + * PxHitFlag::eDIRECT_SWEEP renamed to PxHitFlag::ePRECISE_SWEEP. + * PxHitFlag::eIMPACT renamed to PxHitFlag::ePOSITION. + * PxSceneQueryHitType renamed to PxQueryHitType. + * PxSceneQueryCache renamed to PxQueryCache. + * PxSceneQueryFilterFlag renamed to PxQueryFlag. + * PxSceneQueryFilterFlags renamed to PxQueryFlags. + * PxSceneQueryFilterData renamed to PxQueryFilterData. + * PxSceneQueryFilterCallback renamed to PxQueryFilterCallback. + * PxScene::raycastAll,PxScene::raycastSingle,PxScene::raycastAny replaced by PxScene::raycast. + * PxScene::overlapAll,PxScene::overlapAny replaced by PxScene::overlap. + * PxScene::sweepAll,PxScene::sweepSingle,PxScene::sweepAny replaced by PxScene::sweep. + * PxQuat, PxTranform, PxMat33, PxMat44 createIdentity and createZero removed. Use PxIdentity, PxZero in constructor. + * PxJointType::Enum, PxJoint::getType() removed. Use PxJointConcreteType instead. + * PxVisualDebugger removed. Use PxPvd instead. + * PxControllerFlag renamed to PxControllerCollisionFlag. + * PxCCTHit renamed to PxControllerHit. + * PxCCTNonWalkableMode renamed to PxControllerNonWalkableMode. + * PxControllerNonWalkableMode::eFORCE_SLIDING changed to PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING. + * PxControllerDesc::interactionMode, groupsBitmask, callback removed. + * PxController::setInteraction, getInteraction, setGroupsBitmask, getGroupsBitmask removed. + * PxControllerManager::createController no longer needs PxPhysics and PxScene. + * PxControllerFilters::mActiveGroups replaced with PxControllerFilters::mCCTFilterCallback. + * PxSerialization::createBinaryConverter(PxSerializationRegistry&) changed to PxSerialization::createBinaryConverter(). + * PxConstraintDominance renamed to PxDominanceGroupPair. + * PxScene::flush renamed to PxScene::flushSimulation. + * PxClothFabric::getPhaseType removed. + * PxCollection::addRequired removed. + * PxRigidActor::createShape discontinued support for initial transform. + * PxShape::resetFiltering removed. + * PxParticleBase::resetFiltering removed. + * PxSceneDesc::meshContactMargin removed. + * PxSceneDesc::contactCorrelationDistance removed. + * Indexing operators taking signed integers in PxVec3, PxVec4, PxMat33, PxMat44, PxStrideIterator have been removed. + * PxHitFlag::ePOSITION, PxHitFlag::eDISTANCE and PxHitFlag::eNORMAL are now supported in PxMeshQuery::sweep function. + * PxClothFlag::eGPU renamed to PxClothFlag::eCUDA. + * PxActorTypeSelectionFlag/PxActorTypeSelectionFlags. Use PxActorTypeFlag/PxActorTypeFlags instead. + * PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY flag removed. + + + +## PxShared + +APEX 1.4 can now be used independently of PhysX. In order to achieve that a new shared code base was created called "PxShared". PhysX functionality such as common types, PxFoundation, the task infrastructure are now part of PxShared. + + +## Rigid Bodies + +* Added: + + * An alternative simulation API has been introduced. This makes use of the following new functions: PsScene:collide(), PxScene::fetchCollision() and PxScene::advance(). Expected usage of these functions is illustrated in a new snippet SnippetSplitSim. This feature is also described in the manual in Section Simulation->SplitSim. + * PxSceneFlag::eDEPRECATED_TRIGGER_TRIGGER_REPORTS has been introduced to re-enable the legacy behavior of trigger shape pairs sending reports. This flag and the corresponding legacy behavior will be removed in version 4. + * The active actors feature has been added. See PxSceneFlag::eENABLE_ACTIVE_ACTORS. + * Functionality to compute and manipulate mass, inertia tensor and center of mass of objects has been exposed in the new class PxMassProperties. + * The option to exclude kinematics from the active actors/transforms list has been added. See PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS for details. + * The integrated pose of dynamic rigid bodies can be accessed earlier in the pipeline through a new callback (see the API documentation for PxSimulationEventCallback::onAdvance() and PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW for details). + * PxConvexMeshGeometryFlag::eTIGHT_BOUNDS has been added. See the user manual for details. + * New split fetchResults methods introduced, see PxScene::fetchResultsBegin(), PxScene::fetchResultsFinish() and PxScene::processCallbacks(). This is intended to permit the application to parallelize the event notification callbacks. + * New flag introduced to suppress updating scene query pruner trees inside fetchResults, see PxSceneFlag::eSUPPRESS_EAGER_SCENE_QUERY_REFIT. Instead, pruners will be updated during the next query. + * Introduced GPU rigid body simulation support, see PxSceneFlag::eENABLE_GPU_DYNAMICS. GPU rigid body support requires SM3.0 or later. + * Introduced a new GPU-accelerated broad phase. See PxBroadPhaseType::eGPU. GPU broad phase support requires SM3.0 or later. + * Introduced a new enhanced determinism mode. See PxSceneFlag::eENABLE_ENHANCED_DETERMINISM. This provides additional levels of rigid body simulation determinism at the cost of some performance. + * Introduced a new speculative contacts CCD approach. See PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD. This is a slightly cheaper, less robust solution to PxRigidBodyFlag::eENABLE_CCD. There is no need to turn CCD on the scene using PxSceneFlag::eENABLE_CCD or enable PxPairFlag::eDETECT_CCD_CONTACT with this CCD mode as it functions as an extension to the discrete time-stepping scheme. This form of CCD can be enabled on kinematic actors. + * New "immediate mode" API has been added. This exposes access to the low-level contact generation and constraint solver, which allows the application to use these PhysX low-level components to perform its own simulations without needing to populate and simulate a PxScene. + * RigidDynamic lock flags added which permit the application to disallow rotation/translation of PxRigidDynamics around specific axes. + +* Changed: + + * PxRigidStatic objects can now have zero shapes while being part of a scene. + * PxContactPairFlag::eINTERNAL_HAS_FACE_INDICES is obsolete and has been removed. + * PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY was previously only implemented for spring constraints. It is now correctly implemented for equality constraints. + * PxSceneFlag::eENABLE_PCM is enabled by default. This means PhysX uses PCM distance-based collision detection by default. + * Calls to PxRigidDynamic::setWakeCounter() following PxScene::collide() do now explicitly get taken into account in the subsequent call to PxScene::advance(). + * Calls to contact modification callbacks can be made from multiple threads simultaneously. Therefore, modification callbacks should must be thread-safe. + * Unified heightfield contact generation is now the default heightfield contact generation approach. This approach offers similar performance and behavior to contact generation with triangle meshes. Unified heightfields have no thickness because contact generation operates on triangles so objects may tunnel if CCD is not enabled. + * When unified heightfield contact generation is in use, the bounds of heightfield shapes are no longer extruded by "thickness". + * PxArticulationJoint::setTwistLimit and PxArticulationJoint::getTwistLimit were incorrectly documented with zLimit and yLimit in the wrong order. The behavior of both functions remains unchanged but now they are correctly documented with zLimit and yLimit in the correct order. This is simply a clarification of the existing function behavior. + +* Removed: + + * The deprecated class PxFindOverlapTriangleMeshUtil has been removed. Please use PxMeshOverlapUtil instead. + * The deprecated flag PxConstraintFlag::eREPORTING has been removed. Force reports are now always generated. + * The following deprecated simulation event flags have been removed: PxContactPairHeaderFlag::eDELETED_ACTOR_0, ::eDELETED_ACTOR_1, PxContactPairFlag::eDELETED_SHAPE_0, ::eDELETED_SHAPE_1, PxTriggerPairFlag::eDELETED_SHAPE_TRIGGER, ::eDELETED_SHAPE_OTHER. Please use the following flags instead: PxContactPairHeaderFlag::eREMOVED_ACTOR_0, ::eREMOVED_ACTOR_1, PxContactPairFlag::eREMOVED_SHAPE_0, ::eREMOVED_SHAPE_1, PxTriggerPairFlag::eREMOVED_SHAPE_TRIGGER, ::REMOVED_SHAPE_OTHER. + * The deprecated method PxPhysics::createHeightField(const PxHeightFieldDesc&) has been removed. Please use PxCooking::createHeightField(const PxHeightFieldDesc&, PxPhysicsInsertionCallback&) instead. The insertion callback can be obtained through PxPhysics::getPhysicsInsertionCallback(). + +* Deprecated: + + * PxRigidActor::createShape() has been deprecated in favor of PxRigidActorExt::createExclusiveShape() + * Trigger notification events for trigger-trigger pairs have been deprecated and will be omitted by default. See the 3.4 migration guide for more information. + * The active transforms feature (PxSceneFlag::eENABLE_ACTIVETRANSFORMS) has been deprecated. Please use PxSceneFlag::eENABLE_ACTIVE_ACTORS instead. + * PxRegisterHeightFields has been modified to register unified heightfields, which are now the default implementation. PxRegisterLegacyHeightFields() has been added to register the legacy (deprecated) heightfield contact gen approach. + * PxHeightFieldDesc::thickness has been deprecated, as the new unified height field (see PxRegisterUnifiedHeightFields()) does not support thickness any longer. + +* Fixed: + + * The capsule-vs-heightfield contact generation had a rare bug where a vertical capsule standing exactly on a shared edge could fall through a mesh. This has been fixed. + * The bounding box of a shape was not always properly updated when the contact offset changed. + * Fixed a bug in the GJK sweep caused by lost precision in the math + * Calls to PxScene::shiftOrigin() can crash when PxRigidDynamic actors with PxActorFlag::eDISABLE_SIMULATION are present. + * Fixed a bug when PxShape::setMaterials was called with less materials than shape had before. + * Fixed a bug in CCD that could lead to a hang in the simulation. + * Fixed a bug in PCM mesh edge-edge check for the parallel case. + * Fixed a bug in CCD where contact modify callbacks could be called when the CCD did not detect a contact. + * Fixed a bug with applying external force/torque to a body in buffered insertion stage. + * A rare capsule-vs-mesh contact generation bug has been fixed. + * A rare crash due to an invalid assert in the MBP broad-phase has been fixed. This error only affected debug & checked builds; release & profile builds were unaffected. + + + +## Particles + +* Gpu: Maxwell Optimizations +* The PhysX particle feature has been deprecated. +* Fixed particle collision issue with PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT (on by default). When particles collided against very dense triangle mesh areas an assert would be triggered or particles would leak through the triangle mesh. A workaround was to disable PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT. + + +## Cloth + +* Continuous collision (PxClothFlag::eSWEPT_CONTACT) behavior has been optimized to reduce cloth sticking to collision shape. +* Added air resistance feature (see PxCloth::setWindVelocity(PxVec3), PxCloth::setWindDrag(PxReal), PxCloth::setWindLift(PxReal), PxClothFabricDesc::nbTriangles, PxClothFabricDesc::triangles. + + +## Serialization + +* Fixed: + + * PxTriangleMesh instances with adjacency information were not correctly initialized when created with cooking.createTriangleMesh. This caused a crash when converting the binary serialized triangle mesh data. + + + +## Character controller + +* Added: + + * Profile zones have been added for the character controller. + * Added PxControllerDesc::registerDeletionListener boolean defining if deletion listener for CCT should be registered. + +* Fixed: + + * Character controllers cannot stand on dynamic triggers anymore. + * Fixed: the capsule-vs-sphere sweep now returns a normal in the correct direction. + * Fixed a bug where CCT shapes initially overlapping static geometry would be moved down by an incorrect amount (the length of the step offset). + * The overlap recovery module now works against kinematic objects. + + + +## Vehicles + +* Added: + + * Anti-roll suspension has been added. The class PxVehicleAntiRollBar and the functions PxVehicleWheelsSimData::setAntiRollBar, PxVehicleWheelsSimData::getAntiRollBar, PxVehicleWheelsSimData::getNbAntiRollBars allow anti-roll bars to be configured and queried. + + * A new function PxVehicleSuspensionSweeps has been introduced. This sweeps the PxShape that represents the wheel along the suspension direction. The hit planes resulting from the sweep are used as driving surfaces similar to those found by PxVehicleSuspensionRaycasts. + + * A new snippet SnippetVehicleContactMod has been added. This snippet demonstrates how to use sweeps and contact modification to allow the wheel's volume to fully interact with the environment. + + * A new function PxVehicleModifyWheelContacts has been introduced. This function analyses contact in the contact modification callback and rejects contact points that represent drivable surfaces. + * A new function PxVehicleSetMaxHitActorAcceleration has been introduced. This function sets the maximum acceleration experienced by a PxRigidDynamic that finds itself under the wheel of a vehicle. + +* Changed: + + * In checked build the functions PxVehicleDrive4W::allocate, PxVehicleDriveNW::allocate, PxVehicleDriveTank::allocate, PxVehicleNoDrive::allocate all return NULL and issue a warning if called before PxInitVehicleSDK. + + * Tire width is no longer accounted for when computing the suspension compression from raycasts (PxVehicleSuspensionRaycasts). Instead, tire width is incorporated into the suspension compression arising from swept wheels (PxVehicleSuspensionSweeps). It is recommended to use PxVehicleSuspensionSweeps if there is a strict requirement that the inside and outside of the wheel don't visibly penetrate geometry. + +* Fixed: + + * Suspension force calculation now applies an extra force perpendicular to the spring travel direction. This force is calculated to satisfy the constraint that the sprung mass only has motion along the spring travel direction. This change mostly affects vehicles with suspension travel directions that are not vertical. + * PxVehicleWheelsSimData::mThresholdLongitudinalSpeed and PxVehicleWheelsSimData::mMinLongSlipDenominator are now given default values that reflect the length scale set in PxTolerancesScale. + * Unphysically large constraint forces were generated to resolve the suspension compression beyond its limit when the suspension direction and the hit normal under the wheel approach perpendicularity. This has been fixed so that the constraint force approaches zero as the angle between the hit normal and suspension direction approaches a right angle. + + + +## Scene queries + +* Added: + + * PxPruningStructure was introduced as an optimization structure to accelerate scene queries against large sets of newly added actors. + * PxScene::addActors(PxPruningStructure& ) has been added. + * PxMeshQuery::sweep now supports PxHitFlag::eMESH_ANY. + * PxHitFlag::eFACE_INDEX was introduced to reduce the perf cost for convex hull face index computation. In order to receive face index for sweeps against a convex hull, the flag PxHitFlag::eFACE_INDEX has to be set. Note that the face index can also be computed externally using the newly introduced method PxFindFaceIndex from the extensions library. + * PxGeometryQuery::isValid was added to check provided geometry validity. + +* Changed: + + * Raycasts against triangle meshes with PxHitFlag::eMESH_MULTIPLE flag now return all hits, code for discarding hits close to each other has been removed. + * PxPruningStructure enum has been renamed to PxPruningStructureType + +* Deprecated: + + * PxHitFlag::eDISTANCE has been deprecated. + * The batched query feature has been deprecated. + * Volume cache feature has been deprecated. + * Spatial index feature has been deprecated. + +* Fixed: + + * PxScene::sweep now properly implements PxHitFlag::eMESH_BOTH_SIDES (returned normal follows the same convention as for raycasts). + * Raycasts against heightfields now correctly return multiple hits when PxHitFlag::eMESH_MULTIPLE flag is used. + * PxSweepHit.faceIndex was computed incorrectly for sweep tests initially overlapping convex objects. The face index is now set to 0xffffffff in these cases. + * Convex vs convex sweeps in PxGeometryQuery::sweep() do now correctly return the face index of the convex mesh that gets passed in as parameter geom1 (and not the one from geom0). + * PxMeshQuery::sweep now supports PxHitFlag::eMESH_ANY. + * Deprecated definition PxSceneQueryHit has been removed. Please use PxQueryHit instead. + * PxGeometryQuery::computePenetration with convex geometries. + * On Android platforms, the eDYNAMIC_AABB_TREE pruning structure could pass already released objects into the scene query filter callback. + + + + +## Cooking + +* Added: + + * PxTriangleMeshCookingResult added, cookTriangleMesh now does return additional PxTriangleMeshCookingResult. Please see the manual for more information. + * New convex hull generator added. It is now possible to switch between a new quickhull implementation and the legacy inflation based hull. Quickhull is the default algorithm. + * Convex hulls can now be directly inserted in PxPhysics as triangle meshes and height fields. + * A separate convex hull validation function has been added, it is now possible to create hulls without validation. + * Convex hull generator vertex limit has two different algorithms - plane shifting and OBB slicing. + * PxConvexFlag::eFAST_INERTIA_COMPUTATION added. When enabled, the inertia tensor is computed faster but with less precision. + * PxConvexFlag::eGPU_COMPATIBLE added. When enabled convex hulls are created with vertex limit set to 64 and vertex limit per face is 32. + * PxConvexFlag::eSHIFT_VERTICES added. When enabled input points are shifted to be around origin to improve computation stability. + * PxCookingParams::gaussMapLimit has been added. The limit can now be fully user-defined. Please refer to the migration guide and best practices sections of the manual. + +* Changed: + + * The performance of convex creation from polygons has been improved. + +* Deprecated: + + * The PxPlatform enum and the PxGetGaussMapVertexLimitForPlatform function have been deprecated. + +* Removed: + + * The deprecated flags PxMeshPreprocessingFlag::eREMOVE_UNREFERENCED_VERTICES and ::eREMOVE_DUPLICATED_TRIANGLES have been removed. Meshes get cleaned up by default unless PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH is set. + +* Fixed: + + * Mesh cooking was sometimes crashing for meshes with less than 4 triangles. This has been fixed. + * Cooking convex mesh from a flat input mesh produced incorrect large mesh. + + + +## Extensions + +* Added: + + * PxRaycastCCD has been added, to improve the visibility of the raycast-based CCD solution, which was previously only available in the Sample framework. This is a simpler and potentially cheaper alternative to the SDK's built-in continuous collision detection algorithm. + * PxFindFaceIndex has been added. The function computes the closest polygon on a convex mesh from a given hit point and direction. + +* Changed: + + * Memory churn of PxDefaultMemoryOutputStream has been reduced. + * The signatures for the PxComputeMeshPenetration and PxComputeHeightFieldPenetration functions have changed. + + + +## Profiling + +* Changed: + + * Profiling information is now available only in debug, checked and profile configuration. + * PxProfileZoneManager::createProfileZoneManager now takes PxAllocatorCallback as input parameter instead of PxFoundation. + + + +## Physx Visual Debugger + +* PhysXVisualDebuggerSDK, PvdRuntime projects replaced with PxPvdSDK. +* PxPvdSceneClient::drawPoints now takes physx::pvdsdk::PvdDebugPoint as input parameter instead of PxDebugPoint. drawLines, drawTriangles, drawText and so on. +* The SDK's Debug visualization data is not sent to PVD anymore in ePROFILE mode. +* PxPvdSceneFlag::eTRANSMIT_CONTACTS (instead of PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS) was sometimes incorrectly used to control the transmission of constraint-related data. This has been fixed. In addition, the PxPvdSceneFlag flags are now consistently ignored when PxPvdInstrumentationFlag::eDEBUG is not set. + + +## Aggregates + + +## Snippets + +* Snippet profile zone has been removed. + + +# v3.3.4 +October 2015 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2012, 2013 and 2015 +* Xcode 6.3 + + +## Changes and Resolved Issues + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added support for Microsoft Visual Studio 2015 for Windows builds. Note that the GPU features are not currently supported with Visual Studio 2015. +* Removed support for Microsoft Visual Studio 2010 +* Added support for Android platform API Level 16 and removed support for platform API Level 8 and 9. +* Fixed: + + * Fixed a bug in aggregates that led to a crash when rigid bodies are added to an aggregate after removing all rigid bodies from an aggregate. This only occurred with aggregates that were added to the scene and with rigid bodies that had shapes attached. + + + +## Rigid Bodies + +* Fixed: + + * Creating a PxConstraint or using PxConstraint::setActors() could cause a crash in situations where one of the two newly connected actors was part of a previously simulated graph of connected constraints (with some of them having projection enabled, i.e., PxConstraintFlag::ePROJECT_TO_ACTOR0 or ::ePROJECT_TO_ACTOR1 set). + * PxD6Joint::getTwist(), getSwingY(), getSwingZ() returned incorrect angle values when the corresponding components of the quaternion were negative + * The thickness of a heightfield was incorrectly applied when the heightfield transform had a non-identity quaternion. + * PxD6Joint angular projection now functions correctly when there is one free axis and it is not the twist axis. + * The bounding box of a shape was not always properly updated when the contact offset changed. + * Fixed an edge case bug in PCM contact gen that could result in a QNAN reported as the contact point. + * Fixed an uninitialized variable bug in the GJK algorithm resulting in uninitialized closest points reported. + * Fixed an edge case in which the constraint solver could access invalid memory in constraint partitioning. + * Fixed a bug in capsule vs heightfield contact generation that could produce incorrect penetration depths. + * Fixed a bug in Unified MTD code path which transformed the normal twice for the polygon index calculation. + * Fixed a crash in height fields when a capsule collided with an edge whose shared triangles had a hole material. + + + +## Serialization + +* Fixed: + + * PxTriangleMesh instances with adjacency information were not correctly initialized when created with cooking.createTriangleMesh. This caused a crash when converting the binary serialized triangle mesh data. + + + +## Scene Queries + +* Fixed: + + * Sweeps against scaled meshes. + + + +## Cooking + +* Fixed: + + * Mesh cooking was sometimes crashing for meshes with less than 4 triangles. This has been fixed. + + + + +# v3.3.3 +January 2015 + +## Supported Platforms + +## Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +## Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2010, 2012 and 2013 +* Xcode 6.2 + + +## Known Issues + + +* The combination of releasing an actor and reassigning the actors of any affected joint so that the joint no longer references the released actor will lead to a crash if these operations are performed as buffered calls ie after simulate but before fetchResults. + + +## Changes and Resolved Issues + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +## General + +* Added support for Microsoft Visual Studio 2013 and removed support for Microsoft Visual Studio 2008. +* Where applicable, mutexes on Unix flavored platforms now inherit priority to avoid priority inversion. This is a default behavior of Windows mutexes. +* Added arm64 support for the iOS version of the PhysX SDK. +* Removed samples from the iOS version of the PhysX SDK. +* Fixed: + + * x64 samples running on Windows 8. + * Concurrent calls to PxPhysics::(un)registerDeletionListener() and PxPhysics::(un)registerDeletionListenerObjects() were not safe. + * PxGeometryQuery::pointDistance() could sometimes read uninitialized memory. This has been fixed. + * The SDK will not crash anymore if an object is involved in more than 65535 interactions. Instead, it will emit an error message and the additional interactions will be ignored. + * The PxPhysics::getMaterials() function did not work with a non-zero 'startIndex' parameter. This has been fixed. + * The following static Android libs are now packed into a single library called PhysX3: LowLevel, LowLevelCloth, PhysX3, PhysXProfileSDK, PhysXVisualDebuggerSDK, PvdRuntime, PxTask, SceneQuery and SimulationController. This fixes cyclic dependencies between these libraries. + * FSqrt(0), V4Sqrt(0), V4Length(0) and V3Length(0) will return 0 instead of QNan in Android and iOS. + + + +## Rigid Bodies + +* Fixed: + + * The Prismatic joint limit now acts correctly when its frame is not the identity. + * Calling PxRigidDynamic::setGlobalPose() with the autowake parameter set to true could result in an assert when the rigid body got released and had the PxActorFlag::eDISABLE_SIMULATION flag set. + * Added errors on misuse of PxRegister[Unified]Heightfields() function, and documented it. + * PxConstraint has a eDISABLE_PREPROCESSING flag and minResponseThreshold attribute to assist in stabilizing stiffness caused by infinite inertias or mass modification. + * Island manager performance in the presence of large numbers of kinematic actors has been improved. + * Using PxConstraint::setActors() or PxJoint::setActors() could cause a crash if the new actors resulted in the constraint/joint being removed from the scene. + * The functions PxRigidActor::setGlobalPose and PxShape::setLocalPose failed to update cached contact data internal to PhysX. This led to contacts being generated with transforms that were no longer valid. Similarly, contacts could be missed due to transforms being invalid. This defect affected the classes PxRigidStatic and PxRigidDynamic, though it was more immediately noticeable with the PxRigidStatic class. + * The sphere-vs-mesh contact generation code has been improved. It could previously generate wrong contacts. This has been fixed. + * The capsule-vs-convex contact generation had a bug that could lead to rare invalid contacts. This has been fixed. + * The mesh contact generation had a bug on PS3 that could lead to invalid contacts. This has been fixed. + * The PxRigidBody::clearForce() and PxRigidBody::clearTorque() were not properly decoupled - they both cleared the force and the torque. This has been fixed. + * Repeatedly calling PxRigidActor::attachShape and PxRigidActor::detachShape in between calls to simulate resulted in a memory leak. This has been fixed. + +* Added: + + * Enabling CCD on kinematic actors is now disallowed. When the kinematic flags are raised on a CCD-enabled actor, CCD is automatically disabled. + + + +## Particles + +* Fixed: + + * Consistency between GPU and CPU particles has been improved in the case of a spatial date structure overflow. The positions and velocities of particles that have the PxParticleFlag::eSPATIAL_DATA_STRUCTURE_OVERFLOW set are now updated also for CPU particles. + * Fixed potential deadlocks from occurring in the GPU particle kernels running on GM204 and above GPUs. + * Fixed fluid simulation crash on Titan X. + + + +## Cloth + +* Fixed: + + * A bug related to hitting the sphere or plane limit while world collision is enabled has been fixed. + * PxCloth::getParticleAccelerations() implementation was fixed for GPU cloth. + + + +## Character controller + +* Fixed: + + * Character controllers cannot stand on dynamic triggers anymore. + +* Added: + + * added lockingEnabled parameter to PxCreateControllerManager(), to support thread-safe release of objects while the character controller's move() routine is executing. + + + +## Scene Queries + +* Fixed: + + * Raycasts against triangle meshes with large scales potentially failed to register a hit. + * Overlaps against height field meshes with the flag eNO_BOUNDARY_EDGES potentially failed to register a hit. + * Sweeps using shapes modelled around a space significantly offset from their geometric center could fail to register a hit. + + + +## Vehicles + +* Fixed: + + * Sticky tire friction was unreliable with more than one substep but is now fixed. This defect led to vehicles sliding down slopes where the sticky friction should have held firm. + * An error in the jounce speed calculation that led to lift force at high forward speeds has been fixed. This defect led to instabilities at high speed. + * Improved documentation for PxVehicleSuspsensionData::mSprungMass. + + + +## Cooking + +* Fixed: + + * Convex meshes generated from PhysX 3.2 were not able to load inside PhysX 3.3. + +# v3.3.2 +September 2014 + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android ARM & x86 (version 2.2 or later required for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One (SDK only, no samples) +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT only) +* Xcode 4.6|5.0|5.0.1 + + +## Known Issues + + +* The combination of releasing an actor and reassigning the actors of any affected joint so that the joint no longer references the released actor will lead to a crash if these operations are performed as buffered calls ie after simulate but before fetchResults. + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* The PhysXCommon/64.dll, nvcuda.dll and PhysXUpdateLoader/64.dll are loaded and checked for the NVIDIA Corporation digital signature. The signature is expected on all NVIDIA Corporation provided dlls. The application will exit if the signature check fails. +* Added the PxDefaultBufferedProfiler extension for simplified SDK profile events extraction. +* PxSceneDesc::sanityBounds allows a bounding box to be set for validating the position coordinates of inserted or updated rigid actors and articulations. +* Linux: Now supports GPU PhysX. +* Added set/getRunProfiled() for PxDefaultCpuDispatcher to control profiling at task level. +* Android: Support for x86 based devices was added. +* PxProfileEventHandler::durationToNanoseconds() added. Translates event duration in timestamp (cycles) into nanoseconds. +* Added SnippetProfileZone to show how to retrieve profiling information. +* Added SnippetCustomJoint to better illustrate custom joint implementation, and removed SnippetExtension. +* Added SnippetStepper to demonstrate kinematic updates while substepping with tasks. + +#### Fixed: + +* PxTask::runProfiled() now takes threadId as a parameter. +* The static pruner now issues a performance warning in debug and checked configurations when a tree rebuild occurs and the tree is not empty. +* PxSceneDesc::staticStructure now defaults to PxPruningStructure::eDYNAMIC_AABB_TREE. +* Linux: Switched to shared libraries. +* Profile zone event names changed to match function calls. +* Overlapping read/write errors will now issue a PxErrorCode::eINVALID_OPERATION rather than PxErrorCode::eDEBUG_INFO. +* Improved SnippetToleranceScale to better demonstrate the intended use case. +* Increased 126 characters limit for warnings on unix platforms, 1k limit on all platforms. +* PhysXCommon dll load within PhysX dll now respects dll name. Please see the manual's PhysXCommon DLL load section. +* Significant revision of the user's guide. Both structure and most content have been modified. +* Fixed search function of user's guide. +* Foundation math classes now have in-place arithmetic operators (+= etc). +* PxScene::checkResults() no longer counts as a read API method. Hence it is now possible to call this method in blocking mode without causing all writes to block until it returns. + +#### Deprecated: + +* Indexing operators taking signed integers in PxVec3, PxVec4, PxMat33, PxMat44, PxStrideIterator have been deprecated. + + + +### Rigid Bodies + +#### Fixed: + +* A minor bug in contact generation between capsules and triangle meshes has been fixed, reducing the amount of tunneling cases when CCD is not used. +* Discrete contact reports are no longer produced for pairs without PxPairFlag::eDETECT_DISCRETE_CONTACT raised in the filter shader. Previously, discrete contact generation would always have been performed regardless of the presence of the PxPairFlag::eDETECT_DISCRETE_CONTACT flag. This change potentially improves performance when using specific shapes for CCD-only collision, which would have previously generated discrtete contacts and then ignored them in the solver. +* Trigger reports are no longer produced for pairs without PxPairFlag::eDETECT_DISCRETE_CONTACT raised in the filter shader. PxPairFlag::eTRIGGER_DEFAULT has been modified to include the PxPairFlag::eDETECT_DISCRETE_CONTACT flag. +* An incorrect PX_DEPRECATED annotation on the default constructor for PxD6JointDrive has been removed. +* PxRigidDynamic::getKinematicTarget() returned a wrong transform if the actor center of mass pose was different from the actor global pose. +* Switching a PxRigidDynamic from dynamic to kinematic did not properly suppress existing pairs which turned into kinematic-kinematic or kinematic-static pairs. +* PxRigidDynamic::isSleeping() did not return the correct value on the frame the object got inserted if PxScene::addActors() was used and if the object was awake. +* PxSceneFlag::eDISABLE_CONTACT_CACHE now correctly works on PS3/SPU. +* If an object was added to the scene, put asleep and had overlap with another sleeping object then contact points for that pair might not have been reported once the object woke up. +* Potential crash when calling PxScene::resetFiltering() multiple times for the same actor while the simulation was running has been fixed. +* Potential crash when using PxScene::resetFiltering() with shapes that were just added while the simulation was running has been fixed. +* A crash in MBP when deleting an object that just went out of broad-phase bounds has been fixed. +* A new drive mode has been added to drive articulation joints using rotation vectors. +* In contact and trigger reports, the shape references in PxTriggerPair and PxContactPair might not have been properly marked as removed shapes if the removal took place while the simulation was running. +* PxPairFlag::eSOLVE_CONTACT is now properly observed if the flag is not set on a contacting pair. A consequence of this fix is that sleeping actors will no longer be woken up due to contact or lost contact with awake actors if PxPairFlag::eSOLVE_CONTACT is not set for the pair. This also affects kinematic-kinematic pairs if one kinematic of the pair moves out of contact with the other. Behaviour is unaffected for any pair that has PxPairFlag::eSOLVE_CONTACT set. +* A memory leak with buffered shape and actor removal has been fixed. The memory leak occurred when the release of an actor's shapes was followed by the release of the actor, all in-between simulate() and fetchResults(). +* A bug was fixed which caused incorrect force reports to sometimes be reported. +* Fixed a bug where incorrect normals were reported when using PCM contact gen. +* Fixed some issues with scaled convex hulls in the PCM contact gen code path. +* The accuracy of capsule collision code has been improved. +* An isValid() method has been added to constraints, that is satisfied if and only if at least one actor is a dynamic body or articulation link +* A check has been added to prevent constraint construction or modification that would leave the constraint invalid. +* In checked builds the PxScene methods addActor(), addActors(), addAggregate() and addCollection() will warn and return if an invalid constraint would be added to the scene + +#### Deprecated: + +* The following flags have been renamed and deprecated because the name did not properly reflect the root cause. + +* PxContactPairHeaderFlag + + * eDELETED_ACTOR_0 (use eREMOVED_ACTOR_0 instead) + * eDELETED_ACTOR_1 (use eREMOVED_ACTOR_1 instead) + +* PxContactPairFlag + + * eDELETED_SHAPE_0 (use eREMOVED_SHAPE_0 instead) + * eDELETED_SHAPE_1 (use eREMOVED_SHAPE_1 instead) + +* PxTriggerPairFlag + + * eDELETED_SHAPE_TRIGGER (use eREMOVED_SHAPE_TRIGGER instead) + * eDELETED_SHAPE_OTHER (use eREMOVED_SHAPE_OTHER instead) + + + + + +### Vehicles + +#### Added: + +* In profile config the functions PxVehicleUpdates, PxVehiclePostUpdates and PxVehicleSuspensionRaycasts are now tracked with profile events (provided that a PxProfileZoneManager instance was passed to PxCreatePhysics). These profile events can be viewed in profile view in pvd, where the names of the profile events match the names of the tracked vehicle functions. + +#### Fixed: + +* In checked config PxVehicleDriveTank::allocate enforces the rule that only tanks with even numbers of wheels are legal and warns when this rule is broken. +* In checked config PxVehicleDrive4W::allocate enforces the rule that only vehicles with 4 wheels or more are legal and warns when this rule is broken. +* PxWheelQueryResult::localPose was incorrectly only set when the vehicle had a corresponding PxShape, as described by PxVehicleWheelsSimData::setWheelShapeMapping. The localPose is now properly set independent of the mapping between wheel and shape. +* Wheels resting on moving actors now properly observe the relative speed of the two actors when their relative speed is small. This fixes a bug where at small relative speeds the velocity of the other actor was assumed to be zero. +* Repx serialization failed to serialize PxVehicleWheelsSimData::setMinLongSlipDenominator, PxVehicleWheelsSimData::setSubStepCount, PxVehicleWheelsSimData::disableWheel, PxVehicleWheelsSimData::enableWheel and the number of entries in the engine torque curve. These have now been fixed. +* PxVehicleConcreteType used for vehicle serialization is now in the public API and has been moved to PxVehicleSDK.h. +* Very small longitudinal and lateral slip angles could lead to numerical instabilities in some circumstances. A threshold has been introduced to reject very small slip angles by setting them to zero when they are below the threshold. +* Vehicles now account for rigid bodies that have been given a zero inertia component in order to lock rotation around the corresponding axis. +* Fixed a bug where the sticky wheel constraints sometimes didn't function correctly. + + + +### Cloth + +#### Fixed: + +* The version number written to the fabric stream changed from PX_PHYSICS_VERSION to 1. A fabric can be created from streams written with version 3.3.0 and later until the stream format changes. Previously, the version of the producer and the consumer of the stream needed to match. +* GPU cloth friction against convexes has been fixed. +* A crash resulting from deleting a shape in proximity of a cloth with scene collision enabled has been fixed. + + + +### Scene Queries + +#### Fixed: + +* PxMeshQuery::sweep now respects PxHitFlag::eMESH_BOTH_SIDES, and supports double-sided input triangles. +* PxRigidBodyExt::linearSweepSingle and PxRigidBodyExt::linearSweepMultiple now correctly use query filter data instead of simulation filter data if filter data is not provided. +* The spec for raycasts whose origin is located inside a solid object (sphere, box, capsule, convex) has changed back to what it was in 3.3.0. It was accidentally changed in 3.3.1. See the manual for details. +* Convex sweeps against heightfields worked only when the heightfield had the identity transform. This has now been fixed to support arbitrary transforms again. + + + +### Cooking + +#### Added: + +* Using PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES will always cook meshes with 32-bit triangle indices. + +#### Fixed: + +* Convex hull cooking fix. Some input points could be ignored during cooking, fixed. +* Inserted triangle meshes now respect 16 bit indices flag. + + + + + +### Geometry + +#### Fixed: + +* PxHeightFieldDesc::thickness is now limited to [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS range]. (Previously unbounded). + + + +### Particles + +#### Fixed: + +* Setting PxParticleReadDataFlag::eREST_OFFSET_BUFFER on a PxParticleBase instance that was not created with the per particle rest offset option (see PxPhysics::createParticleSystem, PxPhysics::createParticleFluid and PxParticleBaseFlag::ePER_PARTICLE_REST_OFFSET) is not supported. The unsupported configuration may have resulted in crashes. The SDK now rejects this configuration on calling PxParticleBase::setParticleBaseFlag and issues an appropriate warning to the error stream. +* Performance improvements on Kepler and above GPUs running SPH. +* In rare cases particle systems could access released memory when all interactions with a rigid body shape were lost. + + + +### Serialization + +#### Fixed: + +* PxBinaryConverter::convert potentially failed in checked mode with allocators that don't set 0xcd pattern. This has been fixed now. + + + + + + + + + + +# v3.3.1 +December 2013 + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT only) +* Xcode 4.6|5.0|5.0.1 + + +## Known Issues + + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* The friction model can now be changed after scene instantiation with PxScene::setFrictionType. The friction model can also be queried with PxScene::getFrictionType. + +#### Changed: + +* PxDefaultSimulationFilterShader now supports particles and cloth as well. +* PxSimulationFilterCallback: the provided actor and shape pointers are now defined as const. Note: this is no behavior change, it was never allowed to write to those objects from within the callback. +* The PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICES and PxTriangleMeshFlag::eHAS_ADJACENCY_INFO enums have been deprecated. Please use PxTriangleMeshFlag::e16_BIT_INDICES and PxTriangleMeshFlag::eADJACENCY_INFO instead. +* Removed following functions from the API for platforms which do not support CUDA: PxGetSuggestedCudaDeviceOrdinal, PxCreateCudaContextManager, PxLoadPhysxGPUModule. + +#### Fixed: + +* Fixed concurrency issue on windows. Calling PxScene::simulate on multiple scenes concurrently may have caused a deadlock. This only happened if the scenes shared a single PxCpuDispatcher and the dispatcher was configured to use one worker thread only. + + + +### Rigid Bodies + +#### Added: + +* The projection direction for constraints can now be specified through the flags PxConstraintFlag::ePROJECT_TO_ACTOR0, ::ePROJECT_TO_ACTOR1. +* A parameter has been added to PxRigidBodyExt::updateMassAndInertia() and ::setMassAndUpdateInertia() to optionally take non-simulation shapes into account for computing the mass and the inertia tensor of a rigid body. +* It is now possible to retrieve additional information in contact reports. See the API documentation of PxContactPairHeader.extraDataStream, PxPairFlag::ePRE_SOLVER_VELOCITY, ::ePOST_SOLVER_VELOCITY, ::eCONTACT_EVENT_POSE for details. +* The contact report system has been extended to support multiple notification events if the same two objects collide multiple times in multipass CCD scenarios. See the API documentation of PxPairFlag::eNOTIFY_TOUCH_CCD for details. + + +#### Changed: + +* If touching objects were added to the scene asleep and one of them got woken up, then all contact pairs of the touching objects which contained a static rigid body were resolved with a delay of one simulation step. Now these pairs get resolved without delay in the next simulation step. +* If touching objects were added to the scene asleep, eNOTIFY_TOUCH_FOUND contact reports were sent out for pairs of dynamic rigid bodies if requested. These reports will not be sent at the end of the simulation step after insertion anymore but rather at the end of the simulation step after the touching objects have been woken up. +* Rigid bodies now permit zeroes in passed to setMass and setMassSpaceInertiaTensor. Zeroes are interpreted to indicate infinite mass or infinite moment of inertia around a given principal axis of inertia. Previously, zeroes were illegal values to these methods. Note that zeroes are still illegal for instances of PxArticulationLink. + + +#### Fixed: + +* Reading back the kinematic target in the PxSimulationEventCallback::onContact() callback through PxRigidDynamic::getKinematicTarget() will now work. +* Contact reports are no longer generated for contact pairs involving two sleeping kinematic actors or for pairs involving a sleeping kinematic actor in contact with a static actor. This fixes a bug that was introduced in 3.3.0. +* No PxPairFlag::eNOTIFY_TOUCH_LOST event was sent in contact reports if a pair of sleeping rigid bodies got woken up after setting the pose on one of them (with autowake parameter set to false) and if the bounding boxes of the two objects still overlapped. +* No PxPairFlag::eNOTIFY_TOUCH_PERSISTS event was sent in contact reports during the first simulation step after a pair of sleeping rigid bodies got woken up. +* The inertia tensor computation for convex meshes has been adjusted to be more stable in certain cases where floating point precision issues arise. Furthermore, a fallback routine has been added to use an approximation if the diagonalized inertia tensor still ends up with invalid entries. +* PxRigidBody::clearForce() and ::clearTorque() did not properly clear the respective properties if used with force mode PxForceMode::eIMPULES or PxForceMode::eVELOCITY_CHANGE. +* Setting PxSceneFlag::eENABLE_KINEMATIC_STATIC_PAIRS also enabled PxSceneFlag::eENABLE_KINEMATIC_PAIRS internally and vice versa. +* Missing validation checks for some joint set() methods have been added. Similarly to other API calls, when validation fails in the checked build PhysX will report an error and return without updating the joint. +* Switching a kinematic rigid body to dynamic could lead to a crash in a subsequent simulation step, if the kinematic was moved and connected to another kinematic through a breakable PxConstraint/PxJoint. +* Deleting a breakable PxConstraint/PxJoint while the simulation is running could lead to a crash if the PxConstraint/PxJoint broke in the same simulation step. +* A bug in the PxScene::addBroadPhaseRegion() function, that could lead to a crash when using 'populateRegion=true', has been fixed. + + + +### Particles + +#### Added: + +* Added triangle mesh cache statistics for GPU particles. Triangle mesh cache statistics are also captured by PVD as part of simulation statistics. +* Added new option to query approximate particle velocities relative to colliding rigid actors. This can be used for debris rotation on moving objects. Enable with PxParticleReadDataFlag::eCOLLISION_VELOCITY_BUFFER and read from PxParticleReadData::collisionVelocityBuffer. + +#### Fixed: + +* Fixed a bug which might lead to GPU particle pipeline failures on low end GPUs. +* Enabled warning when a spatial data structure overflow occurred for GPU particles (see the guide for more information). + + + +### Cloth + +#### Fixed: + +* PxFilterFlag::eSUPPRESS was ignored for collision pairs that involved a PxCloth object. This does work now, however, please note that PxFilterFlag::eSUPPRESS is treated as PxFilterFlag::eKILL for pairs with a PxCloth object. + + + +### Serialization + +#### Added: + +* Support for binary compatibility between different sdk releases and patches has been added (PX_BINARY_SERIAL_VERSION). The current sdk version can load binary data of the older sdk versions listed in the documentation of PX_BINARY_SERIAL_VERSION. +* SnippetLoadCollection has been added. It illustrates loading repx or binary serialized collections and instantiating the objects in a scene. It only compiles and runs on authoring platforms (windows, osx and linux). +* SnippetConvert has been added. It illustrates how to convert PhysX 3 serialized binary files from one platform to another. It only compiles and runs on authoring platforms (windows, osx and linux). + +#### Deprecated: + +* Method PxCollection::addRequire is deprecated, use PxCollection::add and PxCollection::contains instead. +* Method PxCollection::createBinaryConverter(PxSerializationRegistry&) is deprecated, use PxCollection::createBinaryConverter() instead. + + + +### Character controller + +#### Added: + +* PxControllerManager::setPreventVerticalSlidingAgainstCeiling() has been added, to control the behaviour of characters against ceilings. + + + + +### Vehicles + +#### Added: + +* Vehicles may now be updated concurrently through the addition of a new function PxVehiclePostUpdates and passing a PxVehicleConcurrentUpdateData array to PxVehicleupdates. +* A new snippet SnippetVehicleMultiThreading has been added to show the operation of concurrent vehicle updates. +* PxVehicleDriveTankControl and PxVehicleDriveTankControlModel now have improved doxy comments. +* A new function PxVehicleUpdateCMassLocalPose has been added to help update a vehicle after the center of mass pose of the vehicle's actor has been modified. +* PxWheelQueryResult now records the local pose of the wheel. + +#### Changed: + +* PxVehcicleDrive4W::setup now tests that at least 4 wheels are specified and returns wtih an error message if numWheels < 4. It is only possible to create a PxVehicleDrive4W instance with less than 4 active wheels by disabling wheels after instantiating a 4-wheeled car. +* In debug and checked build configurations PxVehicleComputeSprungMasses now reports whether the sprung masses were successfully computed. Warnings are passed to the error stream in checked configuration if the function does not complete successfully. Apart from error checking the operation of the function is unchanged. + +#### Fixed: + +* The doxy comment describing the default setting for PxVehicleWheelsSimData::setWheelShapeMapping was incorrect. This now correctly documents the default mapping as PxVehicleWheelsSimData::setWheelShapeMapping(i,i). +* Suspensions raycasts that start inside geometry are ignored for all geometry types. Prior to this release this was true for all geometry types except for heightfields and triangle meshes. This inconsistency has now been fixed so that all geometry types obey the rule that suspension raycasts starting inside geometry are neglected. + + + +### Scene queries + +#### Added: + +* Added eMTD flag. If an initial overlap is detected, this flag triggers the sweep to compute the MTD (Minimum Translation Direction), which can be used to de-penetrate the query shape from the shape with which an initial overlap was found. In this case, the distance reported will be negative. This negative distance can be used to scale the reported normal to generate the translation vector required to de-penetrate the query shape. +* Added PxTriangle::pointFromUV. + +#### Fixed: + +* A rare ray-capsule intersection bug has been fixed, when the capsule's height is close to zero. +* A capsule-capsule distance bug has been fixed, when the tested capsules are large and parallel. +* Raycasts against heightfields now correctly return triangle UVs. + +#### Changed: + +* PxBatchQuery::raycast, overlap and sweep previously had an incorrect const modifier indicating that these methods were safe to call from multiple threads simultaneously. This has been removed. Multiple batch queries can still be executed (via PxBatchQuery::execute()) in parallel. + + + + +### Cooking + +#### Added: + +* PxCookingParams::meshSizePerformanceTradeOff parameter can be used to make the mesh smaller at the expense of reduced simulation and scene query performance (or the other way around). +* PxCookingParams::meshCookingHint parameter can be used to specify mesh hierarchy construction preference (cooking speed or simulation speed). +* PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH disables mesh clean process. Vertices duplicities are not searched, huge triangles test is not done. Vertices welding is not done. Does speed up the cooking. +* PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE disables vertex edge precomputation. Makes cooking faster but slow up contact generation. +* PxPhysicsInsertionCallback adds the support for inserting cooked triangle mesh or height field directly into PxPhysics without the stream serialization. +* PxCooking::createTriangleMesh creates triangle mesh and inserts it to PxPhysics without using the stream serialization. +* PxCooking::createHeightField creates height field and inserts it to PxPhysics without using the stream serialization. +* PxCooking::validateTriangleMesh validates mesh in separate function before it can be cooked without the mesh cleaning. +* PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES checks and removes almost zero-area triangles during the computation of the convex hull. +* PxCookingParams::areaTestEpsilon triangle area size was added. This epsilon is used for the zero-area test in the computation of the convex hull. + +#### Changed: + +* PxCooking::computeHullPolygons does now return also vertices used by the polygons. Redundant vertices are removed. +* PxCooking::cookConvexMesh now returns a PxConvexMeshCookingResult::Enum with additional error information. + + + +### Aggregates + +#### Added: + +* PxSceneLimits has a new member variable maxNbAggregates. Setting this value to a good approximation of the peak number of aggregates will avoid the need for internal run-time allocations that can occur when aggregates are added to the scene. + +#### Fixed: + +* PxScene::removeActor will auotmatically remove that actor from all PxAggregate instances that contain the removed actor. Likewise, PxScene::removeArticulation will automatically remove all articulation links from all relevant aggregates. This fix upholds the rule that all actors of an aggregate must be in same scene. +* The condition of an internal assert that triggered after calling PxScene::addAggregate has been corrected. This assert triggered when an aggregate was added to the scene after removal of all aggregates from the scene. The operation of the function PxScene::addAggregate is unchanged apart from the asserted condtition. + + + +### Samples + +#### Changed: + +* Starting with Release 302 drivers, application developers can direct the Optimus driver at runtime to use the High Performance Graphics to render any application - even those applications for which there is no existing application profile. The samples now make use of this feature to enable High Performance Graphics by default. + + + + + + + + +# v3.3 +September 2013 + +## Release Highlights + + +* Added PhysXDevice/64.dll to the PC packages. See the Windows readme for details. +* Added support for the NVIDIA Kepler GPU architecture. +* Added support for the Nintendo Wii U console. +* Added support for Windows 8 Modern UI applications (ARM and x86). +* Ported our SIMD library to the ARM NEON architecture. +* Multi Box Pruning (MBP) is offered as an alternative broad phase algorithm to Sweep And Prune (SAP). MBP shows improved performance when most objects are moving or when inserting large numbers of objects. SAP can be faster in scenarios with few moving (many sleeping) objects. +* Significant performance and stability optimizations for rigid body solver. +* New function to compute the minimum translational distance and direction to separate two overlapping geometry objects. +* New 'PCM' contact generation mode which is often faster and more robust than the still available legacy path. +* Improved performance of scene queries and contact reports. +* Improved behavior and performance of Continuous Collision Detection (CCD). +* Reduced memory footprint of rigid body classes. +* Added support for sharing shapes among rigid bodies. +* Significantly improved cloth behavior and GPU performance. +* Added support for cloth colliding against itself, other cloth instances, and scene geometry. +* Improved useability of binary and xml serialization. +* Memory can be saved for objects that do not participate in the simulation and are used for scene queries only. For details see the new flag PxActorFlag::eDISABLE_SIMULATION. + + + +## Supported Platforms + +### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver version R304 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox One +* Microsoft XBox 360 +* Nintendo Wii U +* Sony Playstation 3 +* Sony Playstation 4 (SDK only, no samples yet) +* Sony Playstation Vita + +### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010, 2012 (Windows RT/PS4/XboxOne only) +* Xcode 4.6 + + + +## Known Issues + + +* PxSimulationOrder::eSOLVE_COLLIDE feature is not implemented in this release. Calls to PxScene::solve() and PxScene::collide() will be ignored with a warning added to the error stream +* Reading back the kinematic target through PxRigidDynamic::getKinematicTarget() in the PxSimulationEventCallback::onContact() callback will fail. +* Cloth self-collision without rest position is not supported on GPUs with SM capability lower than 2.0. + + +## Changes and Resolved Issues + + +Note: Platform specific issues and changes can be found in the readme file of the corresponding platform. + +### General + +#### Added: + +* PxScene::setLimits: Hint to preallocate capacities of various data structures. See PxSceneLimits. +* Scalar constructors PxQuat(r), PxMat33(r), PxMat33(r). +* identity constructors for PxMat33, PxMat44, PxQuat, PxTransform - e.g. PxTransform(PxIdentity). +* zero constructors for PxMat33, PxMat44, PxVec3 - e.g. PxMat33(PxZero). +* PxTransform(x, y, z) constructor was added as a shortcut for PxTransform(PxVec3(x,y,z)). +* The GPU code uses CUDA version 5.0 and supports Kepler GPUs (SM version 3.0 and 3.5). +* Helper method PxContactPair::bufferContacts() has been added to copy the contact pair data stream into a user buffer. +* PxGeometryQuery::computePenetration() has been added, to compute the Minimum Translational Distance between geometry objects. +* Ability for APEX and other PhysX extensions to change the PhysX Visual Indicator. +* Reporting allocation names can now be enabled or disabled (see PxFoundation::setReportAllocationNames). When enabled, some platforms allocate memory through 'malloc'. +* The scene origin can now be shifted to better support big world scenarios. See PxScene::shiftOrigin() for details. +* PxAssertHandler got extended with a boolean parameter to support ignoring specific asserts. See windows implementation of DefaultAssertHandler. +* Added new PxPairFlags - PxPairFlag::eSOLVE_CONTACT and PxPairFlag::eDETECT_DISCRETE_CONTACT. + +#### Removed: + +* The obsolete PxConvexFlag::eUSE_UNCOMPRESSED_NORMALS flag has been removed. +* The PxSceneFlag::eDISABLE_SSE was obsolete, and has now been removed. +* The obsolte PxPtrArray has been removed + +#### Changed: + +* Mesh BVH construction was significantly improved for meshes with a mix of large and small triangles. Mesh sizes are now slightly increased, but traversals are substantially faster. As a side effect, cooked mesh format has changed. This requires meshes to be recooked! +* The specification for valid PxBounds3 representations has changed. See the API documentation for details (especially the newly introduced PxBounds3::isValid() method). +* PxBounds3::transform(), ::scale() and ::fatten() have been split into a fast and a safe version to avoid unnecessary checks and improve stability for empty bounds respectively. +* PxBounds3::setInfinite() has been renamed to PxBounds3::setMaximal() to better fit the actual behavior. +* PxTask: PVD profile events for tasks are now only emitted in profile builds (all platforms). +* Platform mutex implementations now verify that lock/unlock come from correct thread in debug builds. +* PxWindowsDelayLoadHook.h has been moved from Include/foundation/windows to Include/common/windows. +* API instances of 'Num' as in 'maxNum' and 'getNum' have changed uniformly to 'Nb'. +* The following classes have been renamed: + + * PxSceneQueryHit to PxQueryHit + * PxSceneQueryFlags to PxHitFlags + * PxSceneQueryHitType to PxQueryHitType + * PxSceneQueryFilterData to PxQueryFilterData + * PxSceneQueryFilterCallback to PxQueryFilterCallback + * PxSceneQueryFilterFlags to PxQueryFlags + * PxSceneQueryCache to PxQueryCache + * PxCCTNonWalkableMode to PxControllerNonWalkableMode + * PxControllerFlags to PxControllerCollisionFlags + * PxCCTHit to PxControllerHit + * PxConstraintDominance to PxDominanceGroupPair + * PxActorTypeSelectionFlags to PxActorTypeFlags + * PxFindOverlapTriangleMeshUtil to PxMeshOverlapUtil + +* The previous names have been retained for compatibility but are deprecated. + +* PX_SLEEP_INTERVAL has been replaced with the new parameter PxSceneDesc::wakeCounterResetValue to specify the wake counter value to set when wakeUp() gets called on dynamic objects. +* PxClientBehaviorBit has been renamed PxClientBehaviorFlag, PxActorClientBehaviorBit has been renamed PxActorClientBehaviorFlag. Names of related functions have also changed. +* queryClient parameter in raycast(), sweep(), overlap() functions was moved inside of PxQueryFilterData struct. +* The PxObserver/PxObservable system has been replaced by the PxDeletionListener API. The supported object types have been extended from PxActor to all core objects inheriting from PxBase. Furthermore, two kinds of deletion events are now distinguished: user release and memory release. Please read the API documentation for details. +* Deprecated PxPairFlag::eRESOLVE_CONTACT. Use PxPairFlag::eDETECT_DISCRETE_CONTACT and PxPairFlag::eSOLVE_CONTACT instead. +* Number of materials per shape is now PxU16 instead of PxU32, contact material information also now returns PxU16. +* Maximum number of touching hits in batched queries is now PxU16 instead of PxU32. +* SweepEpsilonDistance has been replaced by meshContactMargin and marked as deprecated. Please read the API documentation for details. +* PxShape::resetFiltering() and PxParticleBase::resetFiltering() have been deprecated. Please use one of the new overloaded methods PxScene::resetFiltering() instead. +* The pxtask namespace has been removed and it's types have been added to the physx namespace with a Px* prefix +* The delay load hook PxDelayLoadHook::setPhysXInstance has been renamed to PxSetPhysXDelayLoadHook and PxDelayLoadHook::setPhysXCookingInstance has been renamed to PxSetPhysXCookingDelayLoadHook + +#### Fixed: + +* Calling Thread::setAffinityMask() before the thread has been started is now supported. +* PxDefaultSimulationFilterShader ignored the value of the second filter constant in the collision filtering equation and used the value of the first filter constant instead. + +#### Deprecated: + +* The PxScene::flush() method has been deprecated, please use PxScene::flushSimulation(). +* PxRigidDynamicFlag has been deprecated and replaced with PxRigidBodyFlag to allow flags to be shared between PxArticulationLink and PxRigidDynamic. +* PxTransform::createIdentity(), PxQuat::createIdentity(), PxMat33::createIdentity(), PxMat44::createIdentity(), PxMat33::createZero(), PxMat44::createZero() + + + +### Character controller + +#### Added: + +* The PxControllerBehaviorFlag::eCCT_USER_DEFINED_RIDE flag has been added. +* A new helper function PxController::resize() has been added to facilitate character controller resizing. +* A new runtime tessellation feature has been added that can help reducing FPU accuracy issues in the sweep tests. +* PxControllerFilterCallback has been added to make CCT-vs-CCT filtering more flexible. +* An overlap recovery module has been added. See PxControllerManager::setOverlapRecoveryModule +* PxObstacle notifications has been added to handle touched obstacles. +* PxObstacleContext::getObstacleByHandle has been added. +* The origin of character controllers and obstacles can now be shifted to stay in sync when the origin of the underlying PxScene is shifted. See PxControllerManager::shiftOrigin() for details. + +#### Changed: + +* The PxControllerManager is now tightly coupled to a PxScene which has to be provided on creation. See PxCreateControllerManager(). +* The PxObstacleContext instances of a PxControllerManager will now get released automatically when the manager is released. +* PxController::reportSceneChanged() has been renamed to PxController::invalidateCache(). +* PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not the default behavior anymore. +* PxCCTNonWalkableMode::eFORCE_SLIDING has been renamed to PxCCTNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING. +* PxCCTInteractionMode has been renamed PxControllerInteractionMode +* PxCCTNonWalkableMode has been renamed PxControllerNonWalkableMode +* PxCCTHit has been renamed PxControllerHit +* Touched PxObstacle has been replaced by touched ObstacleHandle. +* PxControllerInteractionMode and PxControllerFilters::mActiveGroups have been removed. Please use the new PxControllerFilterCallback instead. + +#### Fixed: + +* Bugs with respect to deleting shapes from a touching actor have been fixed. +* Touched actor's scene is checked in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* Touched shape's scene query flag is checked in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* Touched shape's user CCT filtering is triggered in CCT::move before rideOnTouchedObject is called to ensure that the touched shape is valid. +* The PxControllerBehaviorCallback was not called when a PxUserControllerHitReport was not defined. +* It is not possible anymore to create a CCT whose contact offset is zero. The doc has always said a non-zero value was expected, but corresponding check was missing. +* Box & capsule controllers' resize function now properly take the up direction into account + + + +### CCD + +#### Added: + +* Introduced PxRigidBodyFlag::eENABLE_CCD_FRICTION to control whether friction is applied inside CCD on a given body. This is disabled by default. In general, disabling friction in CCD improves the behavior of high-speed collisions. +* Introduced PxSceneDesc::ccdMaxPasses field, which controls the maximum number of CCD passes. Each CCD pass will advance each object to its next TOI. By default, we use 1 pass. Increasing the number of passes can reduced the likelihood of time being dropped inside the CCD system at the cost of extra CCD procesing overhead. +* Introduced per-body value to control how far past the initial time of impact the CCD advances the simulation. Advancing further can improve fluidity at the increased risk of tunneling. +* CCD now has limited support contact modification. It supports disabling response to contacts by setting max impulse to 0. It does not yet support target velocity, non-zero max impulse values or scaling mass or inertia. +* Introduced new PxPairFlag eDETECT_CCD_CONTACT. This flags is used to control whether CCD performs sweep tests for a give pair. Decision over whether any collisions are responded to is made by the presence of the flag eSOLVE_CONTACT. + +#### Removed: + +* CCD is now enabled per-body instead of per-shape. As a result, PxShapeFlag::eUSE_SWEPT_BOUNDS has been removed and replaced with PxRigidBodyFlag::eENABLE_CCD. + +#### Changed: + +* API attributes previously named SWEPT_INTEGRATION have now been renamed 'ccd': specifically PxSceneFlag::eENABLE_SWEPT_INTEGRATION, PxSceneFlag::eSWEPT_INTEGRATION_LINEAR, PxSceneDesc::sweptIntegrationLinearSpeedFactor, PxSceneDesc::sweptIntegrationAngularSpeedFactor, PxPairFlag::eENABLE_SWEPT_INTEGRATION +* PxPairFlag::eCCD_LINEAR has been deprecated. Use (PxPairFlag::eDETECT_CCD_CONTACT | PxPairFlag::eSOLVE_CONTACT) instead. + +#### Fixed: + +* Updated CCD algorithm which improves the fluidity of motion of the CCD system while reducing the processing overhead significantly. +* Contact notification is now reliable in CCD. CCD contacts are appended to the end of the contact list for a given pair so that both discrete and continuous contacts are reported +* CCD contact notification now reports applied forces. These contacts will be correctly filtered by force thresholds. + + + +### Serialization + +#### Added: + +* Added extension PxSerialization::isSerializable method to query whether a collection is serializable. +* Added extension PxSerialization::complete which allows to prepare a collection for serialization. +* Added extension PxSerialization::createNames which adds reference names to serializables. +* Added extension PxCollectionExt::remove which removes all serializables of a certain type and optionally adds them to another collection. +* Added extension function PxCollectionExt::releaseObjects to remove and release objects from a collection +* Added class PxSerializationRegistry for handling custom serializable types. +* Added PxSerialization::serializeCollectionToXml and PxSerialization::createCollectionFromXml +* Included pre-built binary meta data with SDK at [path to installed PhysX SDK]/Tools/BinaryMetaData +* Added class PxSerializer to provide serialization specific functionality to serializable classes. +* Added classes PxSerializationContext and PxDeserializationContext to provide functionality for serialization and deserialization operations. + +#### Removed: + +* Removed PxUserReferences class and PxPhysics::createUserReferences. +* Removed RepX.h and unified serialization interfaces for xml and binary serialization. + +#### Changed: + +* PxCollection was reworked to improve reference management rendering PxUserReferences obsolete. PxCollection was also decoupled more from Serialization/Deserialization functionality. Serialization of incomplete collections fails now early at serialization as opposed to late at deserialization. +* Replaced PxPhysics::createCollection with PxCreateCollection. +* Replaced RepXCollection with PxCollection, and unified corresponding interfaces. +* Replaced PxCollection::serialize with PxSerialization::serializeCollectionToBinary. +* Replaced PxCollection::deserialize with PxSerialization::createCollectionFromBinary. +* Replaced PxSerializable::collectForExport(PxCollection& c) with PxSerializer::requires. The new method works in a non-recursive way. +* Replaced PxDumpMetaData with PxSerialization::dumpMetaData. +* Replaced PxCollectForExportSDK with PxCollectionExt::createCollection(PxPhysics& sdk). +* Replaced PxCollectForExportScene with PxCollectionExt::createCollection(PxScene& scene). +* Moved PxCooking::createBinaryConverter to PxSerialization +* Changed PxShape release semantics for shapes. As a consequence deserialized shapes are never autmatically released, but need to be released by the application. Exception: PxPhysics::release. + + + +### Cloth + +#### Added: + +* Improved GPU cloth performance significantly with new parallel solver. +* Added tether constraints, which allow minimum amount of cloth stretching even for large gravity scales. See PxClothFabric. +* Added support for dynamic addition and deletion of collision primitives. See PxCloth::addCollision* and PxCloth::removeCollision*. +* Added triangle mesh collider support. See PxCloth::setCollisionTriangles. +* Added support for self collision and inter-cloth collision. See PxCloth::setSelfCollision*() and PxScene::setClothInterCollision*(). +* Added direct access to CUDA particle data for graphics interoperability, see PxCloth::lockParticleData() +* Added PxRegisterCloth to reduce binary size by stripping unused code on platforms where static linking is used. +* Added methods setWakeCounter/getWakeCounter() (see the corresponding API documentation for details). + + * It is illegal to call wakeUp/putToSleep/isSleeping() on a PxCloth that has not been added to a scene. + + +#### Changed: + +* Cloth solver does not use fibers any more. See PxClothFabric for changes in fabric API. +* Moved PxCooking.cookClothFabric() to extensions. See PxClothFabricCooker and PxClothFabricCreate. +* PxClothMeshDesc has been moved to extensions and now supports both triangle and quad representations. See PxClothMeshDesc. +* The scaling of damping and stiffness coefficients has been separated from the solver frequency and can now be set indepedently using PxCloth::setStiffnessFrequency(). +* PxCloth::setInertiaScale() has been split into linear, angular, and centrifugal components. See PxCloth::set*IntertiaScale. +* Drag coefficient has been split into linear and angular coefficient. See PxCloth::setLinearDragCoefficient and PxCloth::setAngularDragCoefficient. +* Renamed PxCloth::lockClothReadData() to lockParticleData(). Added support for update operations on the returned particle arrays (as an alternative to setParticles()). +* PxCloth::wakeUp() does not have a parameter anymore. Use setWakeCounter() instead to set a specific value. +* PxCloth::getNbCollisionSpherePairs() has been renamed to PxCloth::getNbCollisionCapsules() + +#### Fixed: + +* Fixed a crash bug in the clothing collision code appearing on iOS. + + + +### Rigid Bodies + +#### Added: + +* The contact distance parameter for a limit is automatically estimated if not supplied in the constructor for the limit structure. +* The new callback PxConstraintConnector::onOriginShift() has been introduced. It gets called for all constraints of a scene, when its origin is shifted. +* New helper function PxRigidBodyExt::computeVelocityDeltaFromImpulse has been added. +* Shapes may be declared as shared on creation, and then attached to multiple actors, see the user manual for restrictions. +* Since a shape is no longer necessarily associated with a unique actor, references to shapes in callbacks from the engine are accompanied by the a reference to the associated actor +* Joints and contact modification now support tuning relative mass and inertia for the bodies on a per-contact basis. Inertia and mass can be tuned independently. + +#### Removed: + +* PxShape::overlap(), PxShape::sweep() and PxShape::raycast() have been removed. Equivalent functionality is provided in PxGeometryQuery. + +#### Changed: + +* It is illegal to call resetFiltering() on a PxShape or PxParticleBase if they have not been added to a scene. +* It is illegal to call addForce/addTorque/clearForce/clearTorque() on a PxRigidBody that has not been added to a scene. +* The sleep behavior of dynamic rigid bodies has changed significantly (for details on the current behavior see the API documentation of isSleeping(), wakeUp(), putToSleep(), setKinematicTarget(), PxRigidBodyFlag::eKINEMATIC, ...). Among the changes are: + + * The methods setWakeCounter/getWakeCounter() have been added for PxRigidDynamic and PxArticulation objects (see the corresponding API documentation for details). + * The wakeUp() method of PxRigidDynamic and PxArticulation has lost the wake counter parameter. Use setWakeCounter() instead to set a specific value. + * It is illegal to call wakeUp/putToSleep/isSleeping() on a PxRigidDynamic or PxArticulation that has not been added to a scene. + * Putting a dynamic rigid actor to sleep will clear any pending force updates. + * Switching a dynamic actor to kinematic will put the actor to sleep immediately. + * Switching a kinematic actor back to dynamic will not affect the sleep state (previously the actor was woken up). + * Calling wakeUp/putToSleep() on a kinematically controlled dynamic actor is not valid any longer. The sleep state of a kinematic actor is solely defined based on whether a target pose has been set (see API documentation of isSleeping() for details). + * A call to PxRigidBody::setCMassLocalPose() does not wake up the actor anymore. Note: this also affects related methods in PhysXExtensions like PxRigidBodyExt::updateMassAndInertia() etc. + * If a non-zero velocity or force is set through PxRigidBody::setLinearVelocity(), ::setAngularVelocity(), ::addForce() or ::addTorque(), the actor will get woken up automatically even if the autowake parameter is false. + * PxRigidBody::clearForce() and ::clearTorque() do not have the autowake parameter, to optionally wake the actor up, anymore. These methods will not change the sleep state any longer. Call ::wakeUp() subsequently to get the old default behavior. + * Adding or removing a PxConstraint/PxJoint to/from the scene does not wake the connected actors up automatically anymore. + * It is now possible to avoid automatic wake up of previously touching objects on scene removal. See the additional parameter wakeOnLostTouch in PxScene::removeActor(), ::removeArticulation(), ::removeAggregte(), PxRigidActor::detachShape(). + + +* PxJointLimit and PxJointLimitPair are now PxJointLinearLimit, PxJointLinearLimitPair, PxJointAngularLimitPair, depending on whether the limit is linear or angular. +* Joints now solve for the entire position error rather than a ratio of 0.7 of it. The flag PxConstraintFlag::eDEPRECATED_32_COMPATIBILITY can be used to restore this behavior +* PxConstraintFlag::Type has been renamed to PxConstraintFlag::Enum +* +* The spring constant parameter in joints and articulations that was previously 'spring' is now 'stiffness'. +* The tangential spring constant parameter in articulations that was previously 'tangentialSpring' is now 'tangentialStiffness'. +* Constraints do not respect PxDominanceGroup settings. Use PxJoint::setInvMassScale and setInvInertiaScale +* Shapes are reference counted. PxShape::release() now decrements the reference count on a shape, and its use is deprecated for detaching a shape from its actor - use detachShape() instead. +* Shape creation methods do not take a local transform parameter anymore. Instead PxShapeFlags can be specified. Triangle meshes, height fields and plane geometry shapes cannot be combined with non-kinematic PxRigidDynmic actors if PxShapeFlag::eSIMULATION_SHAPE is specified. Corresponding calls to PxRigidActor::createShape() or PxRigidActor::attachShape() are not supported. +* PxShape::getActor() now returns a pointer, which is NULL if the shape is shareable. +* PxShape::getWorldBounds() has been replaced with PxShapeExt::getWorldBounds(). +* PxContactPoint has been renamed PxFeatureContact. +* The internal format for contact storage has been modified; applications directly accessing the internal contact representation rather than PxContactPair::extractContacts should be modified accordingly. +* Friction mode flags eENABLE_ONE_DIRECTIONAL_FRICTION and eENABLE_TWO_DIRECTIONAL_FRICTION have been replaced by PxFrictionType::Enum PxSceneDesc::frictionType. +* PxSceneDesc::contactCorrelationDistance has been deprecated. +* PxSceneDesc::contactCorrelationDistance no longer has an influence on how many friction anchors are created in a single frame, only on when they are removed in later frames. This may cause a very minor change in friction behavior. + +#### Fixed: + +* Rigid bodies now properly accumulate the forces/torques that are applied with addForce/addTorque while scene insertion is still pending. This affects bodies added to the scene while the scene is simulating and then given forces/torques with addForce/addTorque while the scene is simulating. These accumulated forces and torques are applied during the next simulate() call. Prior to this fix the forces/torques that accumulated while scene insertion was pending were lost and never applied. +* Its now possible to serialize collections with jointed actors without including the corresponding joints in the collection. The deserialized actors will not be jointed anymore. +* Joint drive force limits are actual force limits rather than impulse limits. Set the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES to false to support legacy behavior +* Angular drive constraints for revolute joints were wrongly computed, resulting in a negative angular velocity when a positive drive target was set. +* Scene addActors will now correctly remove all actors that were passed to add, if some insert failed. +* Contact modification now enforces max impulse field correctly. Previously, it only enforced it if max impulse was set to 0. +* Contact modification now supports target velocity in all directions. Previously, it only enforced the target velocity components that were perpendicular to the contact normal. +* Jittering of small spheres & capsules on very large triangles has been fixed. +* Setting sleep threshold to 0 now guarantees that bodies won't fall asleep even if their kinetic energy reaches exactly 0. + +#### Deprecated: + +* PxShape::release() now decrements the reference count on a shape, and its use is deprecated for detaching a shape from its actor - use detachShape() instead. +* PxJoint::getType() is deprecated - use getConcreteType() instead. +* PxConstraintFlag::eREPORTING is deprecated - constraints always generate force reports +* PxConstraintDominance is deprecated - use PxDominanceGroupPair instead. + + + +### Scene queries + +#### Added: + +* PxVolumeCache, a volumetric cache for local collision geometry. +* Parameter inflation was added to some PxGeometryQuery functions. +* Flag eMESH_BOTH_SIDES can be now used to control triangle mesh culling for raycasts and sweeps. +* Added PxBatchQueryMemory as a part of PxBatchQueryDesc, to allow memory buffers to be set before execution. +* PxBatchQueryDesc() constructor now requires 3 parameters at initialization - see migration guide for more details. +* PxBatchQuery::raycast, sweep, overlap calls will now issue a warning and discard the query when over maximum allowed queries. +* There is a new flag to allow manually updating the scene query representation, see: PxSceneFlags::eENABLE_MANUAL_SQ_UPDATE and PxScene::flushQueryChanges(). +* Added PxScene::forceDynamicTreeRebuild() function to immediately rebuild the scene query structures. +* Added bool PxSweepHit::hadInitialOverlap() returning true if a sweep hit occurred early due to initial overlap at distance=0. + +#### Removed: + +* PxBatchQuery::linearCompoundGeometrySweepSingle and PxBatchQuery::linearCompoundGeometrySweepMultiple functions are no longer supported. +* Globals PxPS3ConfigParam::eSPU_OVERLAP, eSPU_RAYCAST, eSPU_SWEEP that were previous set via setSceneParamInt call are replaced with PxBatchQueryDesc::runOnSpu. See migration guide for more details. + +#### Changed: + +* Scene Query raycastAny/Single/Multiple APIs were merged into a single raycast() call (same for overlaps and sweeps). Please refer to user and migration guides for details. +* Scene Query raycast() API now uses a PxRaycastBuffer or a PxRaycastCallback parameter for reporting hits. Blocking hits are now reported separately from toching and PxRaycastCallback class supports reporting an unbounded number of results (same for overlaps and sweeps). +* A const templated PxRaycastBufferN object was added to allow convenient creation of fixed size scene query touch buffers. Same for overlaps and sweeps. +* Support for compound sweeps was moved out from core SDK to extensions. +* Support for compound sweeps was moved from PxScene to extensions (see PxRigidBodyExt::linearSweepSingle, PxRigidBodyExt::linearSweepMultiple). +* PxQueryFilterCallback::preFilter now passes an actor pointer as well as a shape pointer. +* PxSceneQueryFlag::eINITIAL_OVERLAP and PxSceneQueryFlag::eINITIAL_OVERLAP_KEEP have been replaced with PxHitFlag::eINITIAL_OVERLAP_DISABLE and PxLocationHit::hadInitialOverlap(). Note that checking for initial overlap is now the defaut for sweeps. +* Sweeps in 3.3 execute using a new faster code path, in some cases with reduced precision. If you encounter precision issues not previously experienced in earlier versions of PhysX, use ePRECISE_SWEEP flag to enable the backwards compatible more accurate sweep code. +* The default behavior for overlap queries with query filters returning eBLOCK has changed to only return one of eBLOCK hits. Please refer to the migration guide for details. + +#### Fixed: + +* Scene Query performance was significantly improved in a variety of scenarios. +* Fixed a bug in capsule/mesh overlap code that occasionally caused unreported and misreported faces. +* Fixed a crash in raycastMultiple when a convex was hit by the ray and eMESH_MULTIPLE flag was specified as a query flag. +* Fixed a rare crash in heightfield raycast code. +* Internal limit of 65536 results has been removed. +* Accuracy in sphere/capsule-vs-triangle overlap and sweep tests has been improved. + + + +### Cooking + +#### Added: + +* Added support for convex hull creation with limited output vertices count. +* Added support for convex hull creation directly from polygons rather than triangles. +* Added support function computeHullPolygons in cooking, that creates hull polygons from given vertices and triangles. The resulting polygons can be used to create the convex hull directly. + +#### Changed: + +* Changed convex hull volume integrals. +* PxCookingParams constructor requires now PxTolerancesScale as an additional parameter. This enables us to perform further checks on the triangles during cooking. A warning will be emitted to the error stream if too huge triangles were found. This will ensure better simulation stability. + +#### Fixed: + +* Optimized heightfield load code for no-endian conversion case. + + + +### Triangle meshes + +#### Added: + +* Added PxTriangleMeshFlag::eHAS_ADJACENCY_INFO flag for adjacency information checks. + +#### Removed: + +* Removed has16BitTriangleIndices(), replaced by triangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::eHAS_16BIT_TRIANGLE_INDICES. + + + +### Particles + +#### Added: + +* Direct read access to CUDA particle data has been added for graphics interoperability, see PxParticleBase::lockParticleReadData(PxDataAccessFlags flags) and PxParticleFluid::lockParticleFluidReadData(PxDataAccessFlags flags) +* Added PxRegisterParticles to reduce binary size by stipping unused code on platforms where static linking is used. +* Added setExplicitCudaFlushCountHint to allow early flushing of the cuda push buffer. +* Added caching of triangle meshes. setTriangleMeshCacheSizeHint is supported on Kepler and above GPUs. + +#### Fixed: + +* Creating and immediately setting the position of particles failed and possibly crashed with GPU acceleration enabled. This would only happen after one or more simulation updates. +* Creating many spread out particles might have crashed the GPU pipeline. + + + +### Broad Phase + +#### Added: + +* The SDK now supports multiple broad-phase algorithms (SAP & MBP). See Release Highlights, PxBroadPhaseType and PxBroadPhaseDesc. +* PxVisualizationParameter::eMBP_REGIONS has been added to visualize MBP regions + +#### Fixed: + +* The sap broadphase now gracefully handles PxShape instances whose axis-aligned bounding boxes have min/max limits with value +/- PX_MAX_F32 or QNAN or INF. Such bounds values can occur if a PxShape is given a global transform that is either illegal or close to the upper limit of the floating point range. Prior to this release, the sap broadphase could crash when the axis-aligned bounds of shapes had values that weren't within the floating point range. This has now been fixed. The overlap pairs reported by the broadphase for bounds with such values is undefined. + + + +### Vehicles + +#### Added: + +* Vehicles now support serialization. A PxSerializationRegistry instance may be passed into PxInitVehicleSdk and PxCloseVehicleSdk in order to enable support. +* Vehicle telemetry graphs can now be queried per channel for the most recent value with the function PxVehicleGraph::getLatestValue. +* New vehicle PxVehicleDriveNW type has been introduced. This class makes use of a new differential type PxVehicleDifferentialNW, which allows specified wheels to be equally coupled to the differential, and allows all for some or all of the N wheels to be driven. +* Support for camber angles has been added to the PxVehicleSuspensionData class. +* Moment of inertia parameter has been added to the PxVehicleEngineData class. Prior to this a value of 1.0 was assumed internally. A default value of 1.0 has been used in the constructor for backwards compatability. +* Vehicle manual contains new section describing the conversion of default vehicle parameter values from SI units to any system of units with particular reference to the use of centimetres instead of metres . +* The SI units of each parameter in PxVehicleComponents.h has been documented. +* Vehicle manual contains updated troubleshooting section. +* The requirements for disabled wheels (PxVehicleWheelsSimData::disableWheel) have been documented to make it clear that disabled wheels must be no longer associated with a PxShape, must have zero rotation speed, and must be decoupled from the differential. This is also now discussed in the guide. +* Wheel raycasts documentation has been improved to clarify the start and end points of each raycast. +* Suspension line raycasts do not need to be performed for each vehicle prior to update with PxVehicleUpdates. This feature is implemented with a boolean array passed as an extra function argument to PxVehicleSuspensionRaycasts. This feature is useful for vehicles that require only low level of detail. +* The clutch model now supports two accuracy modes (PxVehicleClutchAccuracyMode::eESTIMATE and PxVehicleClutchAccuracyMode::eBEST_POSSIBLE). If the estimate mode is chosen the computational cost and accuracy of the clutch can be tuned with PxVehicleClutchData::mEstimateIterations. +* PxVehicleSuspensionData now has a function setMassAndPreserveNaturalFrequency. This modifies the mass and stiffness of the spring in a way that preserves the spring natural frequency. +* A new helper function PxVehicleCopyDynamicsData has been added that allows dynamics data such as engine rotation speed, wheel rotation speed, gear etc to be copied from one vehicle to another of the same type. This is particularly useful if a vehicle has a number of different versions where each represents a different level of detail. +* A new function PxVehicleWheelsSimData::copy has been added to allow per wheel dynamics data to be copied from one vehicle to another. +* The vehicle manual contains a new section "Level of Detail" describing the available options for vehicles that require only a low level of detail. +* PxVehicleTireLoadFilterData now requires that mMinNormalisedLoad is greater than or equal to zero. +* PxVehicleTireLoadFilterData now has a new member variable mMinFilteredNormalisedLoad. This value describes the filtered normalised load that occurs when the normalised is less than or equal to mMinNormalisedLoad. +* PxVehicleWheelsSimData now has a new function setMinLongSlipDenominator. This can be used to tune stability issues that can arise when the vehicle slows down in the absence of brake and drive torques. +* A new section "PxVehicleAutoBoxData" has been added to the vehicle tuning guide to describe operation of the automatic gearbox. +* A new section "The Vehicle Under-steers Then Over-steers" has been added to the vehicle troubleshooting guide to describe steps to avoid twitchy handling on bumpy surfaces. A new section "The Vehicle Never Goes Beyond First Gear" has been added to the vehicle troubleshooting guide to describe a common scenario that occurs when the automatic gearbox is given a latency time that is shorter than the time taken to complete a gear change. +* A new section "The Vehicle Slows Down Unnaturally" has been added to the vehicle troubleshooting guide to describe the steps that can be taken to help the vehicle slow down more smoothly. +* A number of vehicle snippets have been added. + +#### Changed: + +* Minor api change for consistency: PxVehicleDrive4WWheelOrder has been introduced to replace the enum beginning with PxVehicleDrive4W::eFRONT_LEFT_WHEEL. +* Minor api change for consistency: PxVehicleDrive4WControl has been introduced to replace the enum beginning with PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL. +* Minor api change for consistency: PxVehicleDriveTankWheelOrder has been introduced to replace the enum beginning with PxVehicleDriveTankWheelOrder::eFRONT_LEFT. +* Minor api change for consistency: PxVehicleDriveTankControl has been introduced to replace the enum beginning with PxVehicleDriveTank::eANALOG_INPUT_ACCEL. +* Minor api change for consistency: PxVehicleDriveTankControlModel has been introduced to replace the enum beginning with PxVehicleDriveTank::eDRIVE_MODEL_STANDARD. +* Minor api change for consistency: PxVehicleTypes has been introduced to replace the enum beginning with eVEHICLE_TYPE_DRIVE4W. +* Minor api change for consistency: PxVehicleWheelGraphChannel has been introduced to replace the enum beginning with PxVehicleGraph::eCHANNEL_JOUNCE. +* Minor api change for consistency: PxVehicleDriveGraphChannel has been introduced to replace the enum beginning with PxVehicleGraph::eCHANNEL_ENGINE_REVS. +* Minor api change for consistency: PxVehicleGraphType has been introduced to replace the enum beginning with PxVehicleGraph::eGRAPH_TYPE_WHEEL. +* PxVehicleUpdates now checks in checked and debug config that the wheel positioning of the driven wheels in a PxVehicleDrive4W obey the wheel ordering specified in PxVehicleDrive4WWheelOrder. Vehicles that are back-to-front or right-to-left are also allowed. A warning is issued if the check fails. +* PxVehicleUpdates now checks in checked and debug config that the odd wheels of a PxVehicleDriveTank are either all to the left or all to the right of their even-wheeled complement, as specified in PxVehicleDriveTankWheelOrder. A warning is issued if the check fails. +* To improve api consistency the arguments of the function PxVehicleDriveDynData::setAnalogInput(const PxReal analogVal, const PxU32 type) have been swapped so that it is now of the form PxVehicleDriveDynData::setAnalogInput(const PxU32 type, const PxReal analogVal). +* Non-persistent wheel dynamics data (slip, friction, suspension force, hit data etc) has been moved out of the PxVehicleWheelsDynData class and is now recorded in a PxWheelQueryResult buffer that is passed as a function argument to the PxVehicleUpdates function. +* PxVehicleWheels::isInAir() has been replaced with PxVehicleIsInAir(const PxVehicleWheelQueryResult& vehWheelQueryResults) to reflect the change to non-persistent data storage. +* The origin of vehicles can now be shifted to stay in sync when the origin of the underlying PxScene is shifted. See PxVehicleShiftOrigin() for details. +* PxVehicleWheels::setWheelShapeMapping and PxVehicleWheels::getWheelShapeMapping have been moved to PxVehicleWheelsSimData::setWheelShapeMapping and PxVehicleWheelsSimData::getWheelShapeMapping +* PxVehicleWheels::setSceneQueryFilterData and PxVehicleWheels::getSceneQueryFilterData have been moved to PxVehicleWheelsSimData::setSceneQueryFilterData and PxVehicleWheelsSimData::getSceneQueryFilterData +* PxVehicle4WEnable3WTadpoleMode and PxVehicle4WEnable3WDeltaMode now take an extra function argument: a non-const reference to a PxVehicleWheelsDynData. +* The section "SI Units" in the vehicle guide has been updated to include the new functon PxVehicleWheelsSimData::setMinLongSlipDenominator. +* PxVehicleTireData::mCamberStiffness has been replaced with PxVehicleTireData::mCamberStiffnessPerUnitGravity. PxVehicleTireData::mCamberStiffnessPerUnitGravity should be set so that it is equivalent to the old value of PxVehicleTireData::mCamberStiffness divided by the magnitude of gravitational acceleration. +* PxVehicleComputeTireForceDefault has been removed from the public vehicle api. Custom tire shaders that call PxVehicleComputeTireForceDefault are best implemented by taking a copy of PxVehicleComputeTireForceDefault and calling the copy instead. + +#### Fixed: + +* Sticky tire friction is now activated in the tire's lateral direction at the tire force application point when the velocity at the base of the tire has low longitudinal and low lateral components. Longitudinal sticky tire friction is unaffected and is still activated when the vehicle has low forward speed. This fixes a minor bug where vehicles positioned on a slope perpendicular to the slope's downwards direction can slowly drift down the slope. +* Bugs in the suspension force and tire load computation have been fixed that affected handling when the car was upside down. +* The tire load passed to the tire force computation is now clamped so that it never falls below zero. +* A bug in the tank damping forces has now been fixed. Tanks now slow down more aggressively from engine and wheel damping forces. + + + + + + + + +# v3.2.4 + +April 2013 + +## What's New In NVIDIA PhysX 3.2.4 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Fixed a bug which caused actors to return wrong world bounds if the bounds minimum was above 10000 on any axis. +* Reporting allocation names can now be enabled or disabled (see PxFoundation::setReportAllocationNames). When enabled, some platforms allocate memory through 'malloc'. +* eEXCEPTION_ON_STARTUP is removed from PxErrorCode and it is no longer needed. +* Added boilerplate.txt to the Tools folder. SpuShaderDump.exe and clang.exe require it. +* PxWindowsDelayLoadHook.h has been moved from Include/foundation/windows to Include/common/windows. +* PxScene::saveToDesc now reports the bounceThresholdVelocity value. +* Fixed a bug in PxDefaultSimulationFilterShader: the value of the second filter constant in the collision filtering equation was ignored and instead the value of the first filter constant was used. +* Fixed a crash bug in PCM collision. + + + +#### Rigid Bodies + +* Forces applied to bodies (with PxRigidBody::addForce) that go to sleep in the subsequent update now have their applied forces cleared when the body is set to sleep to avoid them being applied in a later update when the body is once more awake. This bug broke the rule that forces applied with PxRigidBody::addForce do not persist beyond the next scene update. +* Jittering of small spheres & capsules on very large triangles has been fixed. + + +#### Cooking + +* PxCookingParams constructor is now marked as deprecated. PxToleranceScale is needed for PxCookingParams in order to perform additional triangle check during cooking. This triangle check will trigger warning if too huge triangles are used. This check will ensure better simulation stability. + + +#### Scene Queries + +* Added PxScene::forceDynamicTreeRebuild() function to immediately rebuild the scene query structures. +* Accuracy in sphere/capsule-vs-triangle overlap and sweep tests has been improved. + + +#### Broad Phase + +* Fixed assert in debug mode that wrongly asserted when an overlap pair was removed with perfect equality between the min of one bound and the max of the other along at least one axis. + + +#### Character controller + +* PxControllerFilterCallback has been added, to make CCT-vs-CCT filtering more flexible. +* Fixed a bug where PxControllerBehaviorCallback was not called when a PxUserControllerHitReport was not defined. +* PxObstacle notifications has been added to handle touched obstacles. +* Touched PxObstacle has been replaced by touched ObstacleHandle. +* PxObstacleContext::getObstacleByHandle has been added. +* Touched actors scene is checked before ride on shape, to ensure valid touched shape. +* Touched shape scene query flag is checked before ride on shape, to ensure valid touched shape. +* Touched shape user CCT filtering is triggered before ride on shape, to ensure valid touched shape. +* Box & capsule controllers' resize function now properly take the up direction into account + + +#### Vehicles + +* Documented potential problem with PxVehicleWheelsDynData::getTireDrivableSurfaceType() and PxVehicleWheelsDynData::getTireDrivableSurfaceShape() whereby the pointer returned may reference a PxShape or PxMaterial that has been released in-between storing the pointer in PxVehicleUpdates and any subsequent query. +* PxVehicleWheelsSimData::disableWheel has been documented in more detail. PxVehicleWheelsSimData::enableWheel has been added. +* Fixed a bug where the denominator of the longitudinal slip calculation didn't take into account the value of PxTolerancesScale::length. This will only have an impact if PxTolerancesScale::length != 1.0f. +* Fixed a bug where the engine torque would be incorrectly applied if PxTolerancesScale::length != 1.0f. This will only have an impact if PxTolerancesScale::length != 1.0f. + + +#### Particles + +* Creating and immediately setting the position of particles failed and possibly crashed with GPU acceleration enabled. This would only happen after one or more simulation updates. + + + + +## Supported Platforms + + +Unchanged from from 3.2.3 except: +#### Development + +* Upgraded to Xcode 4.6 + + + +## Known Issues And Limitations + + +Unchanged from from 3.2.3. + + + + + + + + + +# v3.2.3 + +November 2012 + +## What's New In NVIDIA PhysX 3.2.3 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Quaternions passed through the API are now considered valid if their magnitude is between 0.99 and 1.01. +* Fixed crash when running out of memory on creation of a triangle mesh. +* For applications using floating point exceptions, the SDK will now mask or avoid exceptions arising from invalid floating point operations (inexact and underflow exceptions may still be generated). +* Fixed a bug with recursive use of the PxScene read/write lock. +* Fixed a shutdown bug with very short lived threads on Linux platforms. +* PhysX version number in error messages now printed in hex for easier reading. +* Fixed memory barrier and prefetch implementation for all posix based platforms (android, ios, osx, linux). + + +#### Broad Phase + +* Fixed a broad phase crash bug that occurred when deleting shapes with bounds very far from the origin. + + + +#### Collision Detection + +* Documentation of limits of PxShape counts has been added for affected platforms. +* Made kinematics interact better with CCD. +* Adding support for disabled contact response in CCD by respecting the dominance setting. In this case, CCD will emit events but will not alter the motion of the bodies. +* Fixed potential crash in eENABLE_PCM codepath. + + + +#### Rigid Bodies + +* Fixed bug in force based contact reports. An assert could occur when PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS was set and PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND was not set. +* Twist Limit range is documented for revolute and D6 joints, and validated. +* Reduced the number of SDK allocations when using CCD. + + + +#### Scene Queries + +* Raycasts against heighfields now return correct actual mesh index, which can be used for getTriangle(). +* Fixed bug that caused scene queries to miss hits for static rigid bodies that got moved around (after having been added to the scene). +* Fixed rebuilding the dynamic structure properly when used for static rigid bodies. +* Fixed a rare crash in heightfield raycast code. + + +#### Character controller + +* A new runtime tessellation feature has been added, that can help reducing FPU accuracy issues in the sweep tests. + + +#### Convex hulls + +* Zero-sized convex hull data double delete detection fix. + + +#### Vehicles + +* Vehicles with rigid body actors that are asleep and also have no acceleration or steer inputs are treated as though they are asleep too; that is, they are bypassed completely in the PxVehicleUpdates function. Vehicles with sleeping rigid body actors but with non-zero acceleration or steer inputs are processed as normal in PxVehicleUpdates and will automatically have their rigid body actor woken up. +* New function PxVehicleSetUpdateMode to allow PxVehicleUpdates to select between applying accelerations to vehicle rigid bodies or immediate updating of their velocity. + + +#### Particles + +* Fixed a non-deterministic crash appearing with rigid bodies using CCD and gpu particles in the same scene. + + +#### Physx Visual Debugger + +* Material release events are now correctly sent to PVD. + + +#### RepX + +* Add more RepX class information in PhysXAPI document. + + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox 360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.5 + + + +## Known Issues And Limitations + + +Unchanged from from 3.2.2. + + + + + + + + + +# v3.2.2 + +October 2012 + +## What's New In NVIDIA PhysX 3.2.2 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. + +* Added Microsoft Windows RT (formerly known as Windows on ARM) support. +* Suspended Sony Playstation Vita support. +* PxScene now exposes methods to make multithreaded sharing of scenes easier, see PxSceneFlags::eREQUIRE_RW_LOCK for details. +* Enabled Win64 DEBUG build to use SIMD enabled code path. +* Fixed bug in quaternion to axis/angle routine which failed on negative w values. +* Fixed crash when using ConvX on a PxCollection with external references. +* Fixed a spurious overlapping read/write error report when using simulation call backs in checked builds. +* The bounce threshold velocity can be set at run-time with PxScene::setBounceThresholdVelocity. Likewise, it can be queried with PxScene::getBounceThresholdVelocity +* Fixed return value of Ps::atomicExchange for POSIX based platforms: Linux, Android, IOS and OSX +* PxGeometryQuery::computePenetration() has been added, to compute the Minimum Translational Distance between geometry objects. + + +#### Broad Phase + +* Fixed a broad phase crash bug. + + +#### Collision Detection + +* Collision detection now more robust when confronted with ill-conditioned scenarios. +* Fixed crash when SDK is unable to create more contact pairs. Now a warning is emitted and the contacts are ignored. + + +#### Rigid Bodies + +* Improved the numerical stability of articulations. +* The target pose of a kinematically controlled dynamic actor can now get extracted through PxRigidDynamic::getKinematicTarget(). +* The new flag PxRigidDynamicFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES makes scene queries use the target pose of a kinematically controlled dynamic actor instead of the actual pose. +* Fixed PxConstraintFlag::eVISUALIZATION having no effect. +* Fixed bug that caused sleep/wake-up notification events to get lost. +* Fixed a bug where sleeping objects were not waking up properly. +* Fixed potential assert when switching a rigid body between kinematic and dynamic with contact reports enabled. +* Fixed a bug where CCD didn't consider the scaling transform for triangle meshes. +* Fixed a potential crash bug when PxConstraintFlag::ePROJECTION gets raised after a joint (that connects to other projecting joints) has been created. +* Fixed a bug that resulted in joint breakage being reported every frame for any broken joint +* Added PxArticulationDriveCache for applying an impulse to an entire articulation +* fixed various crash bugs when sleeping articulations were removed from the scene and re-added +* + + +#### GPU Physics + +* Fixed a possible out of bounds array access in GPU particle collision code. +* Updated the GPU PhysX Visual Indicator to allow APEX to hook into it. +* Fixed sample particles crash when there is a cuda kernel error. +* Upgraded GPU tech to CUDA 4.2. + + +#### Scene Queries + +* PxSceneQueryHit::faceIndex is now filled in for sweeps against convex meshes. +* Added support for sphere and capsule shaped heightfield overlap queries. +* Added an inflation parameter to all sweep queries in PxGeometryQuery, PxBatchQuery, and PxScene. This can be used to maintain a minimum distance between objects when moving them using sweeps. +* Made sure that raycast multiple will include the closest triangle in the results even if the output cannot hold all the triangles that are hit. +* Fixed swept sphere against capsule not properly testing for initial overlap. +* Fixed the normal vector returned from sweeps being sometimes negated. +* Fixed a scenario where raycasting could miss an actor after the user has moved it using setGlobalPose(). +* Fixed swept convex against plane sometimes reporting false hits +* Fixed swept/overlap/raycast with convexes that don't have identity scale rotation. +* Fixed a culling bug for box-triangle mesh sweep. + + +#### Convex hulls + +* Convex hull is rejected if it has less than 4 polygons. +* Additional convex hull check has been added to detect open volumes. + + +#### Triangle meshes + +* Added triangle mesh flags for 16bit indices and adjacency information. +* Fixed adjacency information order for getTriangle with triangle meshes to respect the vertex order. + + +#### HeightFields + +* Fixed bug where capsules would bounce as they roll across heightfield edges. +* Fixed bug where spheres would bounce as they roll across heightfield vertices. +* Added adjacency information for getTriangle with height fields. + + +#### Particles + +* Fixed triangle mesh shapes with ePARTICLE_DRAIN colliding with particles. +* Fixed crash with GPU particles when a lot of grid cells get occupied and vacated within one time step. + + +#### Character Controller + +* The PxControllerBehaviorFlag::eCCT_USER_DEFINED_RIDE flag has been added. +* Fixed character controller not walking up steps properly if they are not exactly 90 degrees vertical. +* Fixed a bug where the character controller was not able to move up slopes when using a small step offset setting. +* Fixed a bug where the character controller could rise off the ground when blocked by a step. +* Fixed a bug where the character controller could rise off the ground when hitting another character controller. +* Fixed a bug where releasing a shape of a touching actor and then releasing the character controller would crash. Releasing shapes of actors in touch may still lead to crashes in other situations. PxController::invalidateCache() can be used to work around these situations. + +#### CCD + +* Fixed culling bug in CCD sweeps with meshes with transforms that caused contacts to be missed + + +#### Vehicles + +* The vehicle sdk used to make the assumption that wheels 0 and 1 (the front wheels) of a PxVehicleDrive4W responded positively to the input steering wheel angle, while wheels 2 and 3 (the rear wheels) responded in the opposite direction to that of the input steering wheel angle. A consequence of this assumed behaviour was the restriction that PxVehicleWheelData::mMaxSteer was limited to positive values. This restriction has now been relaxed with the caveat that PxVehicleWheelData::mMaxSteer must be in range (-Pi/2, Pi/2). It is now possible to turn each wheel positively or negatively relative to the input steering wheel angle by choosing positive or negative values for PxVehicleWheelData::mMaxSteer. Ackermann steer correction might result in the front and rear wheels competing against each other if the rear and front all steer in the same direction relative to the input steering wheel angle. If this is the case it will be necessary to set the Ackermann accuracy to zero. +* It is now possible to set the engine rotation speed (PxVehicleDriveDynData::setEngineRotationSpeed), the rotation speed of each wheel (PxVehicleWheelsDynData::setWheelRotationSpeed) and the rotation angle of each wheel (PxVehicleWheelsDynData::setWheelRotationAngle). The default values for each of these properties remains zero. +* Wheel contact reporting has been improved with the addition of a number of query functions to the PxVehicleWheelsDynData class. These are getTireDrivableSurfaceContactPoint, getTireDrivableSurfaceContactNormal, getTireLongitudinalDir, getTireLateralDir, getSuspensionForce, getTireDrivableSurfaceShape. +* It is now possible to store a userData pointer per wheel. This allows, for example, each wheel to be associated with a game object. The relevant functions are PxVehicleWheelsDynData::setUserData and PxVehicleWheelsDynData::getUserData. +* The default behavior of PxVehicleWheels::setWheelShapeMapping has changed. Previously, default values were automatically assigned to each wheel at construction so that the ith wheel was mapped to the ith body shape. This, however, made the assumption that there was a wheel shape for each wheel, which is not always true. As a consequence, the default value is now -1, meaning any mapping between body shape and wheel has to be explictily made by calling setWheelShapeMapping. +* It is now possible to query the mapping between wheel and body shape with PxVehicleWheels::getWheelShapeMapping. +* It is now possible to query the tire shader data that has been applied to each wheel with PxVehicleWheelsDynData::getTireForceShaderData. +* The helper function PxVehicleComputeSprungMasses has been added to aid the setup of the suspension sprung masses from the rigid body centre of mass and wheel center coordinates. +* The scene query filter data applied to the suspension raycasts was previously taken from the filter data of the associated body shape. This makes the assumption of a body shape per wheel, which is not always true. As a consequence, the filter data must be explictly set per wheel by calling PxVehicleWheels::setSceneQueryFilterData. The filter data can be queried with PxVehicleWheels::getSceneQueryFilterData. +* Sub-stepping of the vehicle update can now be applied per vehicle with PxVehicleWheelsSimData::setSubStepCount. +* PxVehicleDrivableSurfaceToTireFrictionPairs has been modified so that the dictionary of material pointers can be updated without the necessity of further allocation. The create function has been replaced with separate allocate and setup functions. +* A new vehicle type PxVehicleNoDrive has been added to provide a close approximation to backwards compatibility with the api of the 2.8.x NxWheelShape. + + + +#### Visual Remote Debugger + +* Added PVD compatible profile zones for batched queries. +* Added the ability to capture and inspect scene queries in PVD. +* SDK will now flush the pvd connection stream immediately after cloth or cloth fabric is created or released. +* Fixed the PVD support for articulations. +* Fixed PVD rendering wrong constraint limits. + + + +#### Documentation + +* Wrong statement in PxRigidStatic::release() has been corrected. Static rigid bodies do wake up touching dynamic rigid bodies on release. +* Wrong statement in PxShape::setFlag() has been corrected. It is a valid operation to clear all flags. +* Retroactively added more detail about changes to 3.2.1 release notes below. + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft Windows RT (formerly known as Windows on ARM) (SDK only, no samples yet) +* Microsoft XBox 360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.2 + + + + + + +## Known Issues And Limitations + + +#### General + +* Memory leaks might get reported when using the debug versions of malloc and free together with the debug version of PhysX on Microsoft Windows platforms with Visual Studio 2010. This is caused by a bug in the Visual Studio 2010 runtime libraries. If such a leak appears immediately after releasing PhysX and all its components, please contact us for information about workarounds. +* Use of articulations may require an increase of 64K in the stack size for threads making API calls and engine worker threads + + + +Please also see the previous lists from 3.2.1 and earlier. + + + + + + + + +# v3.2.1 + +June 2012 + +## What's New In NVIDIA PhysX 3.2.1 + + +#### General + +* Note: PS3 platform specific changes can be found in the PS3 readme file. +* Added GRB hooks for APEX 1.2.1. +* Some incorrect usages of __restrict have been fixed. +* A crash when the user's code had FPU exceptions enabled has been fixed. +* A rare crash on Win64 has been fixed. +* Removed no longer needed RapidXML library from distribution. +* Binary serialization can now save the names of actors and shapes. +* Removed a RepXUtility.h reinterpret_cast compile warning that happened on some platforms. +* Fixed a spurious overlapping read/write error report when using simulation call backs in checked builds. +* Fixed a bug in PxBinaryConverter when processing PxConvexMesh and PxMaterial assets. +* Fixed bug in implementations of array accessors (PxPhysics::getScenes(), GuMeshFactory::getTriangleMeshes(), GuMeshFactory::getConvexMeshes(), GuMeshFactory::getHeightFields(), PxAggregate::getActors(), PxScene::getAggregates(), PxScene::getArticulations(), PxScene::getConstraints() ) when startIndex > bufferSize. +* Reduced the number of libraries provided for game consoles. The following core libraries are included in the PhysX3 library and are not available separately anymore: LowLevel, LowLevelCloth, PhysX3Common, PhysXProfileSDK, PhysXVisualDebuggerSDK, PvdRuntime, PxTask, SceneQuery, SimulationController. + + +#### Documentation + +* Clarified documentation regarding use of eSEND_SLEEP_NOTIFIES flag. +* Clarified documentation regarding using different CRT libraries. +* Removed some confusing statements about meta data from the documentation. +* Updated PsPool, PsSort so they can use the user allocator. + + +#### Mesh Cooking + +* A warning message about negative volumes in the convex mesh cooker could cause a crash. +* Fixed failure to create valid convex hull in cooking when using PxConvexFlag::eINFLATE_CONVEX. +* The convex mesh cooking has been made more robust and properly outputs some error messages that were previously missing. +* Fixed crash bug in x64 version of ClothEdgeQuadifier. +* Adjacency information option for TriangleMeshes. This is controlled using the PxCookingParams::buildTriangleAdjacencies flag, and returned if available by PxMeshQuery::getTriangle(). + + +#### Broad Phase + +* The sdk gracefully handles the case of more than 65536 broadphase pairs and reports a warning that some contacts will be dropped in the event that this limit is exceeded. This affects all platforms except win32/win64/linux/linux64, which support a maximum number of 4294967296 pairs. + + +#### Collision Detection + +* Fixed a memory corruption bug in heightfield code. +* Fixed a bug in sphere vs mesh contact generation that could result in bad normals. +* Added a flag to enable or disable contact caching, to permit users to make a performance vs memory tradeoff. +* Fixed a crash bug in ContactReport cleanup code. + + +#### Rigid Bodies + +* The simultaneous raising of both the PxShapeFlag::eSIMULATION_SHAPE and PxShapeFlag::eTRIGGER_SHAPE flags is now explicitly forbidden by the sdk. If any of the two is raised then any attempt to raise the other is rejected by the sdk and an error is passed to the error stream. + + +#### Articulations + +* The API stubbed in 3.2.0 for applying an impulse to an entire articulation is now implemented. + + +#### GPU Physics + +* Much more specific error messages for CUDA compute capability related failures. +* Added SM35 support for GK110 GPUs. +* The CUDA contexts provided by the gpu dispatcher can now be shared across scenes. +* Fixed a possible out of bounds array access in GPU particle collision code. + + + +#### Scene Queries + +* Resolved poor GJK sweep convergence. +* Batched queries accept sphere geometry for sweeps. +* Optimized performance of raycasts. +* An internal limit of 65536 objects in the scene-query subsytem has been lifted. +* Fixed a bug where raycasts that sliced through two adjoining heightfields did not return correct results. +* Fixed a crash bug in PxFindOverlapTriangleMeshUtil when doing a sphere overlap query against a heightfield. + + + +#### Cloth + +* PxCloth::setMotionConstraints() now works with NULL parameter. + + +#### Character Controller + +* PhysX CCT code no longer sets PxShape::userData. +* Intersection of pairs of CCTs now uses the supplied filter data and the supplied callback prefilter. The callback postfilter is not yet hooked up. +* A bug has been fixed whereby the filterData was ignored in one of the scene queries initiated by the PhysX CCT code. +* Introduced a more automatic mechanism for invelidating the character controller's scene cache. As part of this, PxController::reportSceneChanged() was replaced with PxController::invalidateCache(). +* Added helper functions PxController::get/setFootPosition() to let user specify the bottom point of the character controller, rather than the center. +* A new helper function, PxController::resize(), has been added to facilitate character controller resizing. +* PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not the default behavior anymore. +* The slope limit is only observed when walking on static convex meshes, static triangle meshes, static boxes and static heightfields. The slope limit is not observed when walking on dynamic or kinematic rigid bodies or static capsules or static spheres. This partially fixes a bug where the slope limit was inadvertently considered for shapes attached to dynamic rigid bodies and inadvertently ignored for boxes attached to static shapes. + + +#### Vehicles + +* The vehicle sdk now reports an error to the error stream and exits from PxVehicleUpates if PxInitVehicleSdk has not been called in advance. This avoids a divide-by-zero error that can arise if the vehicle sdk has not been initialised correctly. + + +#### Visual Debugger + +* Releasing of cloth fabrics is reported to the VRD. +* Ext::Joint::setActors() call now reported to PVD. +* Fixed crash bug when removing an aggregate containing a PxArticulation, while PVD is running. + + + +## Supported Platforms + + +Unchanged from from 3.2. + + +## Known Issues And Limitations + + +Unchanged from from 3.2. + + + + + + + + +# v3.2 + +December 2011 + +## What's New In NVIDIA PhysX 3.2 + + +#### General + +* Three new sample applications: SampleCharacterCloth (character with cloth cape and cloth flags), SampleBridges (character controller walking on dynamic bridges and moving platforms), SampleCustomGravity (character controller with arbitrary up vector). +* On Windows, the PxFoundation instance is now a process wide singleton and part of the new PhysX3Common.dll library +* PxCreatePhysics() does not create a PxFoundation instance any longer. The PxFoundation instance has to be created in advance through PxCreateFoundation(). +* Calls to PxCreatePhysics() are not valid anymore if a PxPhysics instance already exists. +* If profiling information should be sent to the PhysX Visual Debugger, a PxProfileZoneManager instance has to be provided when creating the PxPhysics instance. +* The version number constant PX_PUBLIC_FOUNDATION_VERSION has been replaced with PX_PHYSICS_VERSION. Both PxFoundation and PxPhysics use the same version number now. +* The API now distinguishes between input and output stream types. +* Added mechanism to reduce code size by not linking optional components. See PxCreateBasePhysics() and the PxRegister*() functions. +* Added getConcreteTypeName() to API classes to provide run time type information. +* Added PxScene::getTimestamp() to retrieve the simulation counter. +* PxGetFoundation has been moved to PxGetFoundation.h +* Changed the functions PxPhysics::releaseUserReferences(), releaseCollection(), addCollection() and releaseCollected() to now take a reference rather than a pointer. +* The signature of PxCreatePhysics has changed: The Foundation SDK instance must be passed in explicitly. One can also hook profiling information by passing a PxProfileZoneManager. +* Platform conversion for serialized data has been moved from the ConvX command line tool to the PxBinaryConverter interface in the cooking library +* contact data block allocation now provides statistics on usage and max usage +* On all platforms except PS3, contact data blocks can be progressively allocated +* PxExtensionVisualDebugger has been renamed to PxVisualDebuggerExt, PxExtensionsConnectionType renamed to PxVisualDebuggerConnectionFlag +* Default implementations of memory and file streams added in PxDefaultStreams.h +* Renamed PxPhysics::getMetaData() to ::PxGetSDKMetaData(). +* Scene::simulate() now takes a memory block which is used for allocation of temporary data during simulation +* On Windows, CudaContextManagerDesc support appGUID now. It only works on release build. If your application employs PhysX modules that use CUDA you need to use a GUID so that patches for new architectures can be released for your game.You can obtain a GUID for your application from Nvidia. + + +#### Rigid Bodies + +* Introduced a new contact generation mode, see eENABLE_PCM. Note that this is an experimental feature that still shows simulation artifacts in some scenarios. +* Introduced two new friction simulation modes, see eENABLE_ONE_DIRECTIONAL_FRICTION and eENABLE_TWO_DIRECTIONAL_FRICTION. +* Introduced a new scene query flag PxSceneQueryFlag::eINITIAL_OVERLAP_KEEP to control how initial overhaps are treated in scene queries. +* Per-triangle materials have been implemented. +* Changes to material properties are automatically reflected in contact resolution. +* New helper methods to compute mass properties for a dynamic rigid body taking per shape density/mass values into account (see documentation on PxRigidBodyExt for details). +* A new set of methods for overlap, sweep and raycast tests based on PxGeometry objects has been introduced. See documentation on PxMeshQuery and PxGeometryQuery for details). +* The contact report API has changed (for details see the documentation on PxSimulationEventCallback::onContact()). Among the changes are: + + * Reports only get sent for shape pairs which request them. Previously, reports were sent for an actor pair even if the requested shape pair event was not triggered (for example because other shapes of the same actors started colliding etc.) + * The following PxPairFlags have been removed eNOTIFY_CONTACT_FORCES, eNOTIFY_CONTACT_FORCE_PER_POINT, eNOTIFY_CONTACT_FEATURE_INDICES_PER_POINT. Forces and feature indices are now always provided if applicable. + * It is much easier now to skip shape pairs or contact point information when traversing the contact report data. + * The memory footprint of contact reports has been reduced. + + +* The members featureIndex0/1 of PxContactPoint have been renamed to internalFaceIndex0/1 for consistency. +* For trigger reports, the eNOTIFY_TOUCH_PERSISTS event has been deprecated and will be removed in the next release. For performance and flexibility reasons it is recommended to use eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST only and manage the persistent state separately. +* Added PxConstraintVisualizer interface and code to visualize joint frames and limits. +* Improved PxBatchQuery API. +* PxPhysics::getProfileZoneManager() now returns a pointer rather than a reference. +* PxRigidDynamic::moveKinematic() has been renamed to setKinematicTarget() to underline its precise semantics. +* Added new function PxShape::getGeometry and class PxGeometryHolder to improve Geometry APIs. +* PxCreatePlane now takes a PxPlane equation as a parameter. Note that the interpretation of the distance value is negated relative to 3.1 +* Added new actor creation helpers PxCloneStatic, PxCloneDynamic, PxScaleActor. +* Added new functions PxTransformFromSegment, PxTransformFromPlaneEquation to simplify creation of planes and capsules. +* added PxJoint::getConstraint() to access the underlying constraint object, from which the constraint force can be read +* Some methods of PxAggregate have been renamed for consistency or replaced for extended functionality. + + * getMaxSize() is now called getMaxNbActors(). + * getCurrentSize() is now called getNbActors(). + * getActor() has been replaced by getActors() which copies the actor pointers to a user buffer. + + +* Added support for kinematic triangle meshes, planes and heighfields. + + +#### Scene queries + +* Dynamic AABBTree has been set as the default dynamic pruning structure. + + +#### Particles + +* Removed descriptors from particle API: The properties maxParticles and PxParticleBaseFlag::ePER_PARTICLE_REST_OFFSET need to be specified when calling PxPhysics::createParticleSystem() and createParticleFluid(). All other properties can be adjusted after creation through set methods. + + +#### Cloth + +* Added convex collision shapes, see PxCloth::addCollisionConvex() +* Added friction support, see PxCloth::setFrictionCoefficient() +* Added angle based bending constraints, see PxClothPhaseSolverConfig::SolverType::eBENDING +* Added separation constraints, a spherical volume that particles should stay outside of, see PxCloth::setSeparationConstraints() +* Added drag, see PxCloth::setDragCoefficient() +* Added inertia scaling, controls how much movement due to PxCloth::setTargetPose() will affect the cloth +* Added support for setting particle previous positions, see PxCloth::setParticles() +* Added controls for scaling particle mass during collision, this can help reduce edge stretching around joints on characters, see PxCloth::setCollisionMassScale() +* Particle data is now copied asynchronously from the GPU after simulate (rather than on demand) +* Improved fabric layout, you can now share fabric data across multiple phases to reduce memory usage, see PxClothFabric +* Fixed bug in collision when capsules are tapered at a slope > 1 + + +#### Vehicles + +* Added PxVehicleDriveTank, a vehicle class that enables tank behaviors. +* Support for vehicles with more than 4 wheels, see PxVehicleDrive4W, PxVehicleDriveTank. +* Significant refactor of vehicle api to allow further types of vehicle to be added. +* Americal English spelling used in vehicle api. +* PxVehicle4W replaced with PxVehicleDrive4W, PxVehicle4WSimulationData replaced with PxVehicleDriveSimData4W. +* Removal of scene query helper functions and structs: PxVehicle4WSceneQueryData, PxVehicle4WSetUpSceneQuery, PxWheelRaycastPreFilter, PxSetupDrivableShapeQueryFilterData, PxSetupNonDrivableShapeQueryFilterData, PxSetupVehicleShapeQueryFilterData. See SampleVehicle_SceneQuery.h for their implementation in SampleVehicle. +* PxVehicle4WSimpleSetup and PxCreateVehicle4WSimulationData have been removed and replaced with default values in vehicle components, see PxVehicleComponents.h. +* PxVehicle4WTelemetryData has been replaced with PxVehicleTelemetryData, a class that supports vehicles with any number of wheels, see PxVehicleTelemetryData +* PxVehicleDrivableSurfaceType no longer stored in PxMaterial::userData. A hash table of PxMaterial pointers is instead used to associate each PxMaterial with a PxVehicleDrivableSurfaceType, see PxVehicleDrivableSurfaceToTireFrictionPairs. +* PxVehicleTyreData::mLongitudinalStiffness has been replaced with PxVehicleTireData::mLongitudinalStiffnessPerUnitGravity, see PxVehicleTireData. +* Tire forces now computed from a shader to allow user-specified tire force functions, see PxVehicleTireForceCalculator. +* Added helper functions to quickly configure 3-wheeled cars, see PxVehicle4WEnable3WTadpoleMode, PxVehicle4WEnable3WDeltaMode. + + +#### Serialization + +* Changed the functions PxPhysics::releaseUserReferences(), releaseCollection(), addCollection() and releaseCollected() to now take a reference rather than a pointer. +* Platform conversion for serialized data has been moved from the ConvX command line tool to the PxBinaryConverter interface in the cooking library. +* Changed some functions in RepXUtility.h and RepX.h to take a reference rather than a pointer. + + + +#### What we removed: + +* Deformables have been removed. Use the optimized solution for clothing simulation instead (see documentation on PxCloth for details). +* PxSweepCache was replaced with PxVolumeCache. +* PVD is no longer enabled in the release build. +* Removed anisotropic friction. +* Removed the CCD mode eSWEPT_CONTACT_PAIRS. +* PxActorDesc has been removed. +* The ConvX tool has been removed. +* Removed empty default implementations of functions in PxSimulationEventCallback for consistency and because it can create bugs in user code if function prototypes change between releases. Users must now supply (eventually blank) implementations for all functions. +* Octree and quadtree pruning structures have been removed. + + +#### Fixed Bugs + +* PxScene::getActors() might not work properly when the startIndex parameter is used. +* Improved the doc-comment of PxConvexMesh::getMassInformation(). +* RepX instantiation can lose all internal references when addOriginalIdsToObjectMap is false. +* PxSetGroup crashed when used on a compound. +* PhysXCommon.dll can be delay loaded. +* ContactReportStream can now handle huge report numbers and size (resize-able flag) can be set in PxSceneDesc.h. +* Fixed assert in sweep tests. +* Concurrent read/write operations during a PxScene::fetchResults() call were not detected properly and no warning message got sent in checked builds. Forbidden write operations during callbacks triggered by PxScene::fetchResults() (contact/trigger reports etc.) were not covered either. +* Fixed crash bug that occurred during collision detection when more than 16K of contact data was generated. Contacts that generate more than 16K of contact data are now fully supported. +* Fixed crash bug when PhysX Visual Debugger is connected and an object gets modified and then released while the simulation is running. + + + + +## Supported Platforms + + +#### Runtime + +* Apple iOS +* Apple Mac OS X +* Google Android (version 2.2 or later for SDK, 2.3 or later required for samples) +* Linux (tested on Ubuntu) +* Microsoft Windows XP or later (NVIDIA Driver ver 295.73 or later is required for GPU acceleration) +* Microsoft XBox 360 +* Sony Playstation 3 +* Sony Playstation Vita + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 4.2 + + + +## Known Issues And Limitations + + + +#### Binary Serialization + +* Meta data generation for PxParticleFluid and PxParticleSystem serializables currently fails. +* For collections that contain jointed rigid bodies all corresponding joints need to be added as well, otherwise deserialization will fail. + +#### Rigid Body Simulation + +* Capsules and spheres can struggle to come to rest on even perfectly flat surfaces. To ensure these objects come to rest, it is necessary to increase angular damping on rigid bodies made of these shapes. In addition, flagging the capsule/sphere's material with physx::PxMaterialFlag::eDISABLE_STRONG_FRICTION can help bring these shapes to rest. + +#### Character Cloth Sample + +* An NVIDIA GPU with Compute Capability 2.0 or higher is required for GPU accelerated simulation in the SampleCharacterCloth sample, if no such device is present then simulation will be performed on the CPU. +* Note that this is not a general SDK requirement, the clothing SDK supports cards with Compute Capability < 2.0 but with limitations on mesh size. + +#### Character Controller + +* Releasing shapes of actors that are in touch with a character controller may lead to crashes. Releasing whole actors doesn't lead to the same problems. PxController::invalidateCache() can be used to work around these issues. + + + + + +Please also see the previous lists from 3.1.1 and earlier. + + + + + + + + +# v3.1.2 + +December 2011 + +## What's New In NVIDIA PhysX 3.1.2 + + +#### General + +* Fixed wrong write/read clash checks. +* Removed some compiler warnings from public header files. +* Fixed PxScene::getActors() returning wrong actors when a start index is specified. + + + +#### Rigid Bodies + +* Fixed broken joint projection in connection with kinematics. +* Fixed inaccurate normals returned from height field scene queries. +* Fixed a crash when the geometry of a shape changes and then the actor gets removed from the scene while the simulation is running. +* Fixed a crash when re-adding scene-query shape actors to scene. + + + +#### Particles + +* Fixed crash bug in particle simulation code on GPU. + + + +#### Cloth + +* Fixed a crash when GPU fabrics are shared between cloths. +* Fixed a hang in cloth fiber cooker when handed non-manifold geometry. + + +#### Samples + +* Fixed SampleVehicles doing an invalid write. +* Fixed SampleVehicle jitter in profile build. + + + + +## Supported Platforms (available in separate packages) + + +Unchanged from from 3.1.1. + + +## Known Issues And Limitations + + +Unchanged from from 3.1. + + + + + + + + +# v3.1.1 + +November 2011 + +## What's New In NVIDIA PhysX 3.1.1 + + +#### General + +* Ported samples to Linux. +* Fixed crash bug in ConvX. +* Fixed crash bug in the allocator code of PXC_NP_MEM_BLOCK_EXTENSIBLE. +* Fixed crash bug when connected to PVD on various platforms. +* Fixed bogus asserts due to overly strict validation of quaternions. +* Fixed one frame lag in PVD scene statistics. +* Fixed a number of OSX PVD sockets issues. +* Fixed SampleSubmarine code that violated concurrent read/writes restriction. +* Added warnings about read/write hazards to the checked build. +* Fixed RepX not reading joint properties. +* Fixed support for concurrent scene queries. +* Fixed PhysX GPU Visual Indicator support. +* Made it more clear in documentation that simulate(0) is not allowed. + + +#### Rigid Bodies + +* eNOTIFY_TOUCH_LOST trigger events do now get reported if one of the objects in contact gets deleted (see documentation of PxTriggerPair for details). +* Dynamic rigid bodies with trigger shapes only do not wake up other touching bodies anymore. +* Added lost touch events for trigger reports when objects get deleted. +* Fixed dynamic triggers waking up actors they are triggered by. +* Removed an inapropriate assert from articulation code. +* Fixed problem with the angular momentum conservation of articulations. +* Fixed articulation sleep problems. +* Fixed a linear velocity related bug in CCD. +* Fixed crash bug CCD. +* Optimized performance of joint information being sent to PVD. + + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or later +* Microsoft XBox 360 +* Sony Playstation 3 +* Android 2.2 or later for SDK, 2.3 or later required for samples +* Linux (tested on Ubuntu) +* Mac OS X + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 3 + + + +## Known Issues And Limitations + + +Unchanged from from 3.1. + + + + + + + + +# v3.1 + +September 2011 + +## What's New In NVIDIA PhysX 3.1 + + +#### General + +* VC10 support has been introduced. +* VC8 support has been discontinued. +* Namespaces cleaned up. +* Extensions, Character Controller and Vehicle source code made available in binary distribution. +* Added x86,x64 suffix to PxTaskCUDA.dll +* Removed boolean return value from PxScene::addActor(...), and similar API calls. +* Added MacOS, Android and Linux to the list of supported platforms. See Supported Platforms below for details. +* Upgraded GPU tech to CUDA 4. +* Cleaned up a large number of warnings at C++ warning level 4, and set SDK to compile with warnings as errors. +* Removed individual sample executables in favor of one Samples executable from PC and console builds. +* Fixed alpha blending in samples. +* Simplified some code in samples. +* Improved ambient lighting in samples. +* Made samples work with older graphics cards. +* Improved and added more content the user's guide. +* No longer passing NULL pointers to user allocator to deallocate. +* Various improvements to Foundation and classes shared with APEX. + +#### Rigid Bodies + +* Rigid Body: High performance alternative convex narrow phase code available to source licensees. See PERSISTENT_CONTACT_MANIFOLD in the code. +* Significant advancements in the continuous collision detection algorithm. +* Optimizations and robustness improvements for articulations. +* Added some helper code to the API. +* Added sleep code for articulations. +* Added support for vehicles with more than one chassis shape. +* Solver iteration count for articulations. +* Articulation limit padding configurable. +* The reference count of meshes does now take the application's reference into acount as well and thus has increased by 1 (it used to count the number of objects referencing the mesh only). Note that a mesh does only get destroyed and removed from the list of meshes once the reference count reaches 0. +* Fixed autowake parameter sometimes being ignored. +* Constraint solver optimizations. +* Improved behavior of character controller on steep slopes. +* Binary serialization now saves names. +* Removed some descriptors from API. +* Removed the angular velocity term in the joint positional drive error formula. +* Fixed bug in capsule sweep versus mesh. +* Fixed a crash bug in the tire model. +* Fixed crashing of single link articulations. +* Fixed bug related to removing elements of an aggregate. +* Fixed swapped wheel graphs in sample vehicle. +* Fixed some slow moving bodies falling asleep in midair. +* Fixed missing collisions after a call to resetFiltering. +* Fixed broken autowake option in setAngularVelocity. +* Fixed D6 joint linear limits being uninitialized. +* A large number of misc. bug fixes and optimizations. +* Improved documentation and error messages associated with running out of narrow phase buffer blocks. +* Added articulation documentation. +* Expanded manual sections on joints. +* Improved reference doc for PxSceneQueryHitType. +* Added reference doc for PxSerializable. + + +#### Particles + +* Particle index allocation removed from SDK. Added index allocation pool to extensions. +* Replaced GPU specific side band API PxPhysicsGpu and PxPhysics::getPhysicsGpu() with PxParticleGpu. +* Memory optimizations on all platforms and options to reduce memory usage according to use case with new per particle system flags: + + * PxParticleBaseFlag::eCOLLISION_WITH_DYNAMIC_ACTORS + * PxParticleBaseFlag::ePER_PARTICLE_COLLISION_CACHE_HINT + + +* Fixed rare crash appearing with multi-threaded non-GPU particle systems and rigid bodies. +* Fixed particles leaking through triangle mesh geometry on GPU. +* Fixed fast particles tunneling through scene geometry in some cases. +* Fixed erroneous collision of particles with teleporting rigid shapes (setGlobalPose). +* Fixed particle sample behavior with some older GPU models. +* Fixed a GPU particle crash bug. + + + +#### Cloth + +* A new solution for simulating cloth and clothing. + + + +#### Deformables + +* Deformables are deprecated and will be removed in the next release. There is a new optimized solution for clothing simulation (see documentation on PxCloth for details). + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or later +* Microsoft XBox 360 +* Sony Playstation 3 +* Android 2.2 or later for SDK, 2.3 or later required for samples +* Linux (SDK tested on Ubuntu, samples not yet ported) +* Mac OS X + +#### Development + +* Microsoft Windows XP or later +* Microsoft Visual Studio 2008, 2010 +* Xcode 3 + + + +## Known Issues And Limitations + + +#### General + +* Under VC10, you may get warnings due to conflicting build configuration flags. Workaround: Clear the "Inherit from parent or project defaults" flag for all projects in Project->Properties->C/C++->Command Line. We plan to fix this for the 3.1 general availability release. + +#### Scene Query + +* Querying the scene (e.g. using raycastSingle()) from multiple threads simultaneously is not safe. + +#### Cloth + +* Even simple parameters of a PxCloth can not be set or accessed while the simulation is running. + +#### RepX + +* RepX fails to load elements of aggregate joint parameters (PxD6JointDrive etc.) + + + + +Please also see the previous lists from 3.0. + + + + + + + + +# v3.0 + +February 14th2011 + +## What's New In NVIDIA PhysX 3.0 + + +#### General + +This third major version of the SDK is a significant rewrite of the entire technology. We did away with a large amount of legacy clutter and replaced them with a wealth of new features and improvements. +Because even the API changes are so significant, it is easier to see it as a whole new product rather than a long list of changes. + +#### What we removed: + +* The dedicated NVIDIA PhysX PPU hardware is not supported any more. +* Scene compartments are not supported anymore. All created physical objects are now part of one and the same compartment. +* Force fields are not part of the NVIDIA PhysX SDK anymore. +* Splitting a simulation timestep into multiple substeps is not a functionality of the NVIDIA PhysX SDK any longer and has to be implemented above the SDK. + + +#### Key new features: + +* Articulations: A way to create very stiff joint assemblies. +* Serialization: Save objects in a binary format and load them back quickly! +* Broad Phase Clustering: Put objects that belong together into a single broadphase volume. +* Driverless Model: No need to worry about system software on PC anymore. +* Dynamic Character Controller: A character controller that can robustly walk on dynamic objects. +* Vehicle Library: A toolkit to make vehicles, including an all new tire model. +* Non-Simulation Objects: A staging are outside of the simulation from where you can add things into the simulation at high speed. +* Simulation Task Manager: Take control of the management of simulation tasks. +* Stable Depenetration: Large penetrations can be gracefully recovered from. +* Double Buffering: You can read from and write to the simulated objects while the simulation is running on another thread. +* Mesh Scaling: Create different nonuniformly scaled instances of your meshes and convexes without duplicating the memory. +* Distance Based Collision Detection: Have the simulation create contacts before objects touch, and do away with unsightly overlaps. +* Fast Continuous Collision Detection: Have small and high speed objects collide correctly without sacrificing performance. +* Significantly increased performance and memory footprint, especially on consoles. +* Unified solver for deformables and rigid bodies for great interaction. +* Triangle collision detection with deformables. +* Support for our new Physics Visual Debugger, including integrated profiling. + + + +#### Math classes + +* Matrix based transforms have been replaced by quaternions. +* All angles are now expressed in radians. IN PARTICULAR the PxQuat constructor from axis and angle as well as the getAngleAxis and fromAngleAxis methods now use radians rather than degrees. + + + +#### Rigid Bodies + +* Capsules are now defined to extend along the x rather than the y axis. +* Triangle meshes do not support heightfield functionality anymore. Use the dedicated PxHeightField class instead. +* Dynamic triangle mesh actors are not supported any longer. However, you can decompose your mesh into convex parts and create a dynamic actor consisting of these convex parts. +* The deprecated heightfield property NxHeightFieldDesc::verticalExtent is not supported any longer. Please use the PxHeightFieldDesc::thickness parameter instead. +* NxSpringAndDamperEffector is not supported anymore. Use PxDistanceJoint instead. +* Joints are now part of the PhysX extensions library (PhysXExtensions). +* Wheel shapes have been replaced by the more flexible entity PxWheel. A default wheel implementation, encapsulating most of the old wheel functionality, can be found in the PhysX extensions library (see PxDefaultWheel). +* The NxUtilLib library has been removed. Sweep/overlap/raycast tests and other helper methods can be found in the new GeomUtils library. +* Materials can no longer be accessed through indices. Per triangle material meshes need a material table which can be specified per shape (see PxShape::setMaterials() for details). +* The default material is not available anymore. + + +#### Particle Systems, Particle Fluids + +* The NxFluid class has been replaced with two classes for separation of functionality and ease of use. + + * PxParticleSystem: Particles colliding against the scene. + * PxParticleFluid: Particles simulating a fluid (sph). + + +* Simplified parameterization for particle systems. + + * Using absolute distances instead of relative multipliers to rest spacing + * Simplified sph parameters + * Unified collision parameters with deformable and rigid body features + + +* Creating and releasing particles is now fully controlled by the application. + + * Particle lifetime management isn't provided through the SDK anymore. + * Emitters have been removed from the SDK. + * Drain shapes don't cause particles to be deleted directly, but to be flagged instead. + * Initial particle creation from the particle system descriptor isn't supported anymore. + + +* Particle data buffer handling has been moved to the SDK. +* Per particle collision rest offset. +* GPU accelerated particle systems. + + * Application controllable mesh mirroring to device memory. + * Runtime switching between software and GPU accelerated implementation. + + + + + +## Supported Platforms (available in separate packages) + + +#### Runtime + +* Microsoft Windows XP or and later +* Microsoft XBox360 +* Sony Playstation 3 + +#### Development + +* Microsoft Windows XP or and later +* Microsoft Visual Studio 2008 + + + +## Known Issues And Limitations + + +#### Rigid Bodies + +* Adding or removing a PxAggregate object to the scene is not possible while the simulation is running. + +#### Particle Systems + +* Releasing the Physics SDK may result in a crash when using GPU accelerated particle systems. +* This can be avoided by doing the following before releasing the Physics SDK: + + * Releasing the PxScene objects that contain the GPU accelerated particle systems. + * Releasing application mirrored meshes by calling PxPhysicsGpu::releaseTriangleMeshMirror(...), PxPhysicsGpu::releaseHeightFieldMirror(...) or PxPhysicsGpu::releaseConvexMeshMirror(...). + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/README.md b/modules/PhysX/physx/physx-sys/physx/physx/README.md new file mode 100644 index 0000000..41e8b24 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/README.md @@ -0,0 +1,62 @@ +# NVIDIA PhysX SDK 5 + +Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of NVIDIA CORPORATION nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## Introduction + +Welcome to the NVIDIA PhysX SDK source code repository. + +The NVIDIA PhysX SDK is a scalable multi-platform physics solution supporting a wide range of devices, from smartphones to high-end multicore CPUs and GPUs. PhysX is already integrated into some of the most popular game engines, including Unreal Engine, and Unity3D. [PhysX SDK on developer.nvidia.com](https://developer.nvidia.com/physx-sdk). + +Please see [Release Notes](./CHANGELOG.md) for updates pertaining to the latest version. + +## User Guide and API Documentation + +The user guide and API documentation are available on [GitHub Pages](https://nvidia-omniverse.github.io/PhysX/physx/index.html). Please create an [Issue](https://github.com/NVIDIA-Omniverse/PhysX/issues/) if you find a documentation issue. + +## Quick Start Instructions + +Platform specific environment and build information can be found in [documentation/platformreadme](./documentation/platformreadme). + +To begin, clone this repository onto your local drive. Then change directory to physx/, run ./generate_projects.[bat|sh] and follow on-screen prompts. This will let you select a platform specific solution to build. You can then build from the generated solution/make file in the platform- and configuration-specific folders in the ``compiler`` folder. + +## Acknowledgements + +This depot references packages of third party open source software copyright their respective owners. +For copyright details, please refer to the license files included in the packages. + +| Software | Copyright Holder | Package | +|---------------------------|-------------------------------------------------------------------------------------|----------------------------------| +| CMake | Kitware, Inc. and Contributors | CMakeModules | +| FindCUDA | James Bigler: NVIDIA Corp, Abe Stephens: SCI Institute | CMakeModules | +| LLVM | University of Illinois at Urbana-Champaign | clang-physxmetadata | +| Visual Studio Locator | Microsoft Corporation | VsWhere | +| Freeglut | Pawel W. Olszta | freeglut-windows
opengl-linux | +| Mesa 3-D graphics library | Brian Paul | opengl-linux | +| RapidJSON | THL A29 Limited, a Tencent company, and Milo Yip
Alexander Chemeris (msinttypes) | rapidjson | +| OpenGL Ext Wrangler Lib | Nigel Stewart, Milan Ikits, Marcelo E. Magallon, Lev Povalahev | [SDK_ROOT]/snippets/graphics | diff --git a/modules/PhysX/physx/physx-sys/physx/physx/dependencies.xml b/modules/PhysX/physx/physx-sys/physx/physx/dependencies.xml new file mode 100644 index 0000000..b92483f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/dependencies.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxActor.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxActor.h new file mode 100644 index 0000000..35609c0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxActor.h @@ -0,0 +1,378 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ACTOR_H +#define PX_ACTOR_H + +/** \addtogroup physics + @{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxBounds3.h" +#include "PxClient.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRigidActor; +class PxRigidBody; +class PxRigidStatic; +class PxRigidDynamic; +class PxArticulationLink; +class PxScene; + +/** +\brief Group index which allows to specify 1- or 2-way interaction +*/ +typedef PxU8 PxDominanceGroup; // Must be < 32, PxU8. + +/** +\brief Flags which control the behavior of an actor. + +@see PxActorFlags PxActor PxActor.setActorFlag() PxActor.getActorFlags() +*/ +struct PxActorFlag +{ + enum Enum + { + /** + \brief Enable debug renderer for this actor + + @see PxScene.getRenderBuffer() PxRenderBuffer PxVisualizationParameter + */ + eVISUALIZATION = (1<<0), + + /** + \brief Disables scene gravity for this actor + */ + eDISABLE_GRAVITY = (1<<1), + + /** + \brief Enables the sending of PxSimulationEventCallback::onWake() and PxSimulationEventCallback::onSleep() notify events + + @see PxSimulationEventCallback::onWake() PxSimulationEventCallback::onSleep() + */ + eSEND_SLEEP_NOTIFIES = (1<<2), + + /** + \brief Disables simulation for the actor. + + \note This is only supported by PxRigidStatic and PxRigidDynamic actors and can be used to reduce the memory footprint when rigid actors are + used for scene queries only. + + \note Setting this flag will remove all constraints attached to the actor from the scene. + + \note If this flag is set, the following calls are forbidden: + \li PxRigidBody: setLinearVelocity(), setAngularVelocity(), addForce(), addTorque(), clearForce(), clearTorque(), setForceAndTorque() + \li PxRigidDynamic: setKinematicTarget(), setWakeCounter(), wakeUp(), putToSleep() + + \par Sleeping: + Raising this flag will set all velocities and the wake counter to 0, clear all forces, clear the kinematic target, put the actor + to sleep and wake up all touching actors from the previous frame. + */ + eDISABLE_SIMULATION = (1<<3) + }; +}; + +/** +\brief collection of set bits defined in PxActorFlag. + +@see PxActorFlag +*/ +typedef PxFlags PxActorFlags; +PX_FLAGS_OPERATORS(PxActorFlag::Enum,PxU8) + +/** +\brief Identifies each type of actor. +@see PxActor +*/ +struct PxActorType +{ + enum Enum + { + /** + \brief A static rigid body + @see PxRigidStatic + */ + eRIGID_STATIC, + + /** + \brief A dynamic rigid body + @see PxRigidDynamic + */ + eRIGID_DYNAMIC, + + /** + \brief An articulation link + @see PxArticulationLink + */ + eARTICULATION_LINK, + + /** + \brief A FEM-based soft body + @see PxSoftBody + */ + eSOFTBODY PX_DEPRECATED, + + /** + \brief A FEM-based cloth + \note In development + @see PxFEMCloth + */ + eFEMCLOTH PX_DEPRECATED, + + /** + \brief A PBD ParticleSystem + @see PxPBDParticleSystem + */ + ePBD_PARTICLESYSTEM PX_DEPRECATED, + + /** + \brief A FLIP ParticleSystem + \note In development + @see PxFLIPParticleSystem + */ + eFLIP_PARTICLESYSTEM PX_DEPRECATED, + + /** + \brief A MPM ParticleSystem + \note In development + @see PxMPMParticleSystem + */ + eMPM_PARTICLESYSTEM PX_DEPRECATED, + + /** + \brief A CUSTOM ParticleSystem + \note In development + @see PxCUSTOMParticleSystem + */ + eCUSTOM_PARTICLESYSTEM PX_DEPRECATED, + + /** + \brief A HairSystem + \note In development + @see PxHairSystem + */ + eHAIRSYSTEM PX_DEPRECATED, + + //! \brief internal use only! + eACTOR_COUNT PX_DEPRECATED, + + //! \brief internal use only! + eACTOR_FORCE_DWORD PX_DEPRECATED = 0x7fffffff + }; +}; + +/** +\brief PxActor is the base class for the main simulation objects in the physics SDK. + +The actor is owned by and contained in a PxScene. +*/ +class PxActor : public PxBase +{ +public: + /** + \brief Deletes the actor. + + Do not keep a reference to the deleted instance. + + If the actor belongs to a #PxAggregate object, it is automatically removed from the aggregate. + + @see PxBase.release(), PxAggregate + */ + virtual void release() = 0; + + /** + \brief Retrieves the type of actor. + + \return The actor type of the actor. + + @see PxActorType + */ + virtual PxActorType::Enum getType() const = 0; + + /** + \brief Retrieves the scene which this actor belongs to. + + \return Owner Scene. NULL if not part of a scene. + + @see PxScene + */ + virtual PxScene* getScene() const = 0; + + // Runtime modifications + + /** + \brief 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. + + \param[in] name String to set the objects name to. + + Default: NULL + + @see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Retrieves the name string set with setName(). + + \return Name string associated with object. + + @see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Retrieves the axis aligned bounding box enclosing the actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \return The actor's bounding box. + + @see PxBounds3 + */ + virtual PxBounds3 getWorldBounds(float inflation=1.01f) const = 0; + + /** + \brief Raises or clears a particular actor flag. + + See the list of flags #PxActorFlag + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] flag The PxActor flag to raise(set) or clear. See #PxActorFlag. + \param[in] value The boolean value to assign to the flag. + + @see PxActorFlag getActorFlags() + */ + virtual void setActorFlag(PxActorFlag::Enum flag, bool value) = 0; + + /** + \brief Sets the actor flags. + + See the list of flags #PxActorFlag + @see PxActorFlag setActorFlag() + */ + virtual void setActorFlags( PxActorFlags inFlags ) = 0; + + /** + \brief Reads the PxActor flags. + + See the list of flags #PxActorFlag + + \return The values of the PxActor flags. + + @see PxActorFlag setActorFlag() + */ + virtual PxActorFlags getActorFlags() const = 0; + + /** + \brief Assigns dynamic actors a dominance group identifier. + + PxDominanceGroup is a 5 bit group identifier (legal range from 0 to 31). + + The PxScene::setDominanceGroupPair() lets you set certain behaviors for pairs of dominance groups. + By default every dynamic actor is created in group 0. + + Default: 0 + + Sleeping: Changing the dominance group does NOT wake the actor up automatically. + + \param[in] dominanceGroup The dominance group identifier. Range: [0..31] + + @see getDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair() + */ + virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) = 0; + + /** + \brief Retrieves the value set with setDominanceGroup(). + + \return The dominance group of this actor. + + @see setDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair() + */ + virtual PxDominanceGroup getDominanceGroup() const = 0; + + + /** + \brief Sets the owner client of an actor. + + This cannot be done once the actor has been placed into a scene. + + Default: PX_DEFAULT_CLIENT + + @see PxClientID PxScene::createClient() + */ + virtual void setOwnerClient( PxClientID inClient ) = 0; + + /** + \brief Returns the owner client that was specified at creation time. + + This value cannot be changed once the object is placed into the scene. + + @see PxClientID PxScene::createClient() + */ + virtual PxClientID getOwnerClient() const = 0; + + /** + \brief Retrieves the aggregate the actor might be a part of. + + \return The aggregate the actor is a part of, or NULL if the actor does not belong to an aggregate. + + @see PxAggregate + */ + virtual PxAggregate* getAggregate() const = 0; + + //public variables: + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + PX_INLINE PxActor(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {} + PX_INLINE PxActor(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxActor() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxActor", name) || PxBase::isKindOf(name); } + + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxActorData.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxActorData.h new file mode 100644 index 0000000..4fe5d7f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxActorData.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_ACTOR_DATA_H +#define PX_ACTOR_DATA_H + +/** \addtogroup physics + @{ +*/ + +#include "foundation/PxVec4.h" +#include "foundation/PxQuat.h" +#include "foundation/PxFlags.h" +#include "PxNodeIndex.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \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 PxActorCacheFlags; + PX_FLAGS_OPERATORS(PxActorCacheFlag::Enum, PxU16) + + /** + \brief State of a body used when interfacing with the GPU rigid body pipeline + @see PxScene.copyBodyData() + */ + PX_ALIGN_PREFIX(16) + struct PxGpuBodyData + { + PxQuat quat; /*!< actor global pose quaternion in world frame */ + PxVec4 pos; /*!< (x,y,z members): actor global pose position in world frame */ + PxVec4 linVel; /*!< (x,y,z members): linear velocity at center of gravity in world frame */ + PxVec4 angVel; /*!< (x,y,z members): angular velocity in world frame */ + } + PX_ALIGN_SUFFIX(16); + + /** + \brief Pair correspondence used for matching array indices with body node indices + */ + PX_ALIGN_PREFIX(8) + struct PxGpuActorPair + { + PxU32 srcIndex; //Defines which index in src array we read + PxNodeIndex nodeIndex; //Defines which actor this entry in src array is updating + } + PX_ALIGN_SUFFIX(8); + + /** + \brief Maps numeric index to a data pointer. + + @see PxScene::computeDenseJacobians(), PxScene::computeGeneralizedMassMatrices(), PxScene::computeGeneralizedGravityForces(), PxScene::computeCoriolisAndCentrifugalForces() + */ + struct PxIndexDataPair + { + PxU32 index; + void* data; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxAggregate.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxAggregate.h new file mode 100644 index 0000000..70ccd62 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxAggregate.h @@ -0,0 +1,254 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_AGGREGATE_H +#define PX_AGGREGATE_H + +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxActor; +class PxBVH; +class PxScene; + + struct PxAggregateType + { + enum Enum + { + eGENERIC = 0, //!< Aggregate will contain various actors of unspecified types + eSTATIC = 1, //!< Aggregate will only contain static actors + eKINEMATIC = 2 //!< Aggregate will only contain kinematic actors + }; + }; + + // PxAggregateFilterHint is used for more efficient filtering of aggregates outside of the broadphase. + // It is a combination of a PxAggregateType and a self-collision bit. + typedef PxU32 PxAggregateFilterHint; + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxAggregateFilterHint PxGetAggregateFilterHint(PxAggregateType::Enum type, bool enableSelfCollision) + { + const PxU32 selfCollisionBit = enableSelfCollision ? 1 : 0; + return PxAggregateFilterHint((PxU32(type)<<1)|selfCollisionBit); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxGetAggregateSelfCollisionBit(PxAggregateFilterHint hint) + { + return hint & 1; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxAggregateType::Enum PxGetAggregateType(PxAggregateFilterHint hint) + { + return PxAggregateType::Enum(hint>>1); + } + +/** +\brief Class to aggregate actors into a single broad-phase entry. + +A PxAggregate object is a collection of PxActors, which will exist as a single entry in the +broad-phase structures. This has 3 main benefits: + +1) it reduces "broad phase pollution" by allowing a collection of spatially coherent broad-phase +entries to be replaced by a single aggregated entry (e.g. a ragdoll or a single actor with a +large number of attached shapes). + +2) it reduces broad-phase memory usage + +3) filtering can be optimized a lot if self-collisions within an aggregate are not needed. For + example if you don't need collisions between ragdoll bones, it's faster to simply disable + filtering once and for all, for the aggregate containing the ragdoll, rather than filtering + out each bone-bone collision in the filter shader. + +@see PxActor, PxPhysics.createAggregate +*/ +class PxAggregate : public PxBase +{ +public: + + /** + \brief Deletes the aggregate object. + + Deleting the PxAggregate object does not delete the aggregated actors. If the PxAggregate object + belongs to a scene, the aggregated actors are automatically re-inserted in that scene. If you intend + to delete both the PxAggregate and its actors, it is best to release the actors first, then release + the PxAggregate when it is empty. + */ + virtual void release() = 0; + + /** + \brief Adds an actor to the aggregate object. + + A warning is output if the total number of actors is reached, or if the incoming actor already belongs + to an aggregate. + + If the aggregate belongs to a scene, adding an actor to the aggregate also adds the actor to that scene. + + If the actor already belongs to a scene, a warning is output and the call is ignored. You need to remove + the actor from the scene first, before adding it to the aggregate. + + \note When a BVH is provided the actor shapes are grouped together. + The scene query pruning structure inside PhysX SDK will store/update one + bound per actor. The scene queries against such an actor will query actor + bounds and then make a local space query against the provided BVH, which is in actor's local space. + + \param [in] actor The actor that should be added to the aggregate + \param [in] bvh BVH for actor shapes. + return true if success + */ + virtual bool addActor(PxActor& actor, const PxBVH* bvh = NULL) = 0; + + /** + \brief Removes an actor from the aggregate object. + + A warning is output if the incoming actor does not belong to the aggregate. Otherwise the actor is + removed from the aggregate. If the aggregate belongs to a scene, the actor is reinserted in that + scene. If you intend to delete the actor, it is best to call #PxActor::release() directly. That way + the actor will be automatically removed from its aggregate (if any) and not reinserted in a scene. + + \param [in] actor The actor that should be removed from the aggregate + return true if success + */ + virtual bool removeActor(PxActor& actor) = 0; + + /** + \brief Adds an articulation to the aggregate object. + + A warning is output if the total number of actors is reached (every articulation link counts as an actor), + or if the incoming articulation already belongs to an aggregate. + + If the aggregate belongs to a scene, adding an articulation to the aggregate also adds the articulation to that scene. + + If the articulation already belongs to a scene, a warning is output and the call is ignored. You need to remove + the articulation from the scene first, before adding it to the aggregate. + + \param [in] articulation The articulation that should be added to the aggregate + return true if success + */ + virtual bool addArticulation(PxArticulationReducedCoordinate& articulation) = 0; + + /** + \brief Removes an articulation from the aggregate object. + + A warning is output if the incoming articulation does not belong to the aggregate. Otherwise the articulation is + removed from the aggregate. If the aggregate belongs to a scene, the articulation is reinserted in that + scene. If you intend to delete the articulation, it is best to call #PxArticulationReducedCoordinate::release() directly. That way + the articulation will be automatically removed from its aggregate (if any) and not reinserted in a scene. + + \param [in] articulation The articulation that should be removed from the aggregate + return true if success + */ + virtual bool removeArticulation(PxArticulationReducedCoordinate& articulation) = 0; + + /** + \brief Returns the number of actors contained in the aggregate. + + You can use #getActors() to retrieve the actor pointers. + + \return Number of actors contained in the aggregate. + + @see PxActor getActors() + */ + virtual PxU32 getNbActors() const = 0; + + /** + \brief Retrieves max amount of actors that can be contained in the aggregate. + + \note PxAggregate now supports an arbitrary number of actors. This method return PX_MAX_U32 and will be + removed in a future release. + + \return Max actor size. + + @see PxPhysics::createAggregate() + @deprecated + */ + PX_DEPRECATED virtual PxU32 getMaxNbActors() const = 0; + + /** + \brief Retrieves max amount of shapes that can be contained in the aggregate. + + \return Max shape size. + + @see PxPhysics::createAggregate() + */ + virtual PxU32 getMaxNbShapes() const = 0; + + /** + \brief Retrieve all actors contained in the aggregate. + + You can retrieve the number of actor pointers by calling #getNbActors() + + \param[out] userBuffer The buffer to store the actor pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of actor pointers written to the buffer. + + @see PxShape getNbShapes() + */ + virtual PxU32 getActors(PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Retrieves the scene which this aggregate belongs to. + + \return Owner Scene. NULL if not part of a scene. + + @see PxScene + */ + virtual PxScene* getScene() = 0; + + /** + \brief Retrieves aggregate's self-collision flag. + + \return self-collision flag + */ + virtual bool getSelfCollision() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxAggregate"; } + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + PX_INLINE PxAggregate(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {} + PX_INLINE PxAggregate(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxAggregate() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxAggregate", name) || PxBase::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationFlag.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationFlag.h new file mode 100644 index 0000000..7587043 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationFlag.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ARTICULATION_FLAG_H +#define PX_ARTICULATION_FLAG_H + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A description of the types of articulation data that may be directly written to and read from the GPU using the functions + PxScene::copyArticulationData() and PxScene::applyArticulationData(). Types that are read-only may only be used in conjunction with + PxScene::copyArticulationData(). Types that are write-only may only be used in conjunction with PxScene::applyArticulationData(). + A subset of data types may be used in conjunction with both PxScene::applyArticulationData() and PxScene::applyArticulationData(). + + @see PxArticulationCache, PxScene::copyArticulationData(), PxScene::applyArticulationData() + */ + class PxArticulationGpuDataType + { + public: + enum Enum + { + eJOINT_POSITION = 0, //!< The joint positions, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + eJOINT_VELOCITY, //!< The joint velocities, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + eJOINT_ACCELERATION, //!< The joint accelerations, read only, see PxScene::copyArticulationData() + eJOINT_FORCE, //!< The applied joint forces, write only, see PxScene::applyArticulationData() + eJOINT_SOLVER_FORCE, //!< The computed joint constraint solver forces, read only, see PxScene::copyArticulationData()() + eJOINT_TARGET_VELOCITY, //!< The velocity targets for the joint drives, write only, see PxScene::applyArticulationData() + eJOINT_TARGET_POSITION, //!< The position targets for the joint drives, write only, see PxScene::applyArticulationData() + eSENSOR_FORCE, //!< The spatial sensor forces, read only, see PxScene::copyArticulationData() + eROOT_TRANSFORM, //!< The root link transform, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + eROOT_VELOCITY, //!< The root link velocity, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + eLINK_TRANSFORM, //!< The link transforms including root link, read only, see PxScene::copyArticulationData() + eLINK_VELOCITY, //!< The link velocities including root link, read only, see PxScene::copyArticulationData() + eLINK_FORCE, //!< The forces to apply to links, write only, see PxScene::applyArticulationData() + eLINK_TORQUE, //!< The torques to apply to links, write only, see PxScene::applyArticulationData() + eFIXED_TENDON, //!< Fixed tendon data, write only, see PxScene::applyArticulationData() + eFIXED_TENDON_JOINT, //!< Fixed tendon joint data, write only, see PxScene::applyArticulationData() + eSPATIAL_TENDON, //!< Spatial tendon data, write only, see PxScene::applyArticulationData() + eSPATIAL_TENDON_ATTACHMENT //!< Spatial tendon attachment data, write only, see PxScene::applyArticulationData() + }; + }; + + + /** + \brief These flags determine what data is read or written to the internal articulation data via cache. + + @see PxArticulationCache PxArticulationReducedCoordinate::copyInternalStateToCache PxArticulationReducedCoordinate::applyCache + */ + class PxArticulationCacheFlag + { + public: + enum Enum + { + eVELOCITY = (1 << 0), //!< The joint velocities, see PxArticulationCache::jointVelocity. + eACCELERATION = (1 << 1), //!< The joint accelerations, see PxArticulationCache::jointAcceleration. + ePOSITION = (1 << 2), //!< The joint positions, see PxArticulationCache::jointPosition. + eFORCE = (1 << 3), //!< The joint forces, see PxArticulationCache::jointForce. + eLINK_VELOCITY = (1 << 4), //!< The link velocities, see PxArticulationCache::linkVelocity. + eLINK_ACCELERATION = (1 << 5), //!< The link accelerations, see PxArticulationCache::linkAcceleration. + eROOT_TRANSFORM = (1 << 6), //!< Root link transform, see PxArticulationCache::rootLinkData. + eROOT_VELOCITIES = (1 << 7), //!< Root link velocities (read/write) and accelerations (read), see PxArticulationCache::rootLinkData. + eSENSOR_FORCES = (1 << 8), //!< The spatial sensor forces, see PxArticulationCache::sensorForces. + eJOINT_SOLVER_FORCES = (1 << 9), //!< Solver constraint joint forces, see PxArticulationCache::jointSolverForces. + eALL = (eVELOCITY | eACCELERATION | ePOSITION | eLINK_VELOCITY | eLINK_ACCELERATION | eROOT_TRANSFORM | eROOT_VELOCITIES) + }; + }; + + typedef PxFlags PxArticulationCacheFlags; + PX_FLAGS_OPERATORS(PxArticulationCacheFlag::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationJointReducedCoordinate.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationJointReducedCoordinate.h new file mode 100644 index 0000000..4043f74 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationJointReducedCoordinate.h @@ -0,0 +1,528 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ARTICULATION_JOINT_RC_H +#define PX_ARTICULATION_JOINT_RC_H +/** \addtogroup physics +@{ */ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "solver/PxSolverDefs.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A joint between two links in an articulation. + + @see PxArticulationReducedCoordinate, PxArticulationLink + */ + class PxArticulationJointReducedCoordinate : public PxBase + { + public: + + /** + \brief Gets the parent articulation link of this joint. + + \return The parent link. + */ + virtual PxArticulationLink& getParentArticulationLink() const = 0; + + /** + \brief Sets the joint pose in the parent link actor frame. + + \param[in] pose The joint pose. + Default: The identity transform. + + \note This call is not allowed while the simulation is running. + + @see getParentPose + */ + virtual void setParentPose(const PxTransform& pose) = 0; + + /** + \brief Gets the joint pose in the parent link actor frame. + + \return The joint pose. + + @see setParentPose + */ + virtual PxTransform getParentPose() const = 0; + + /** + \brief Gets the child articulation link of this joint. + + \return The child link. + */ + virtual PxArticulationLink& getChildArticulationLink() const = 0; + + /** + \brief Sets the joint pose in the child link actor frame. + + \param[in] pose The joint pose. + Default: The identity transform. + + \note This call is not allowed while the simulation is running. + + @see getChildPose + */ + virtual void setChildPose(const PxTransform& pose) = 0; + + /** + \brief Gets the joint pose in the child link actor frame. + + \return The joint pose. + + @see setChildPose + */ + virtual PxTransform getChildPose() const = 0; + + /** + \brief Sets the joint type (e.g. revolute). + + \param[in] jointType The joint type to set. + + \note Setting the joint type is not allowed while the articulation is in a scene. + In order to set the joint type, remove and then re-add the articulation to the scene. + + @see PxArticulationJointType, getJointType + */ + virtual void setJointType(PxArticulationJointType::Enum jointType) = 0; + + /** + \brief Gets the joint type. + + \return The joint type. + + @see PxArticulationJointType, setJointType + */ + virtual PxArticulationJointType::Enum getJointType() const = 0; + + /** + \brief Sets the joint motion for a given axis. + + \param[in] axis The target axis. + \param[in] motion The motion type to set. + + \note Setting the motion of joint axes is not allowed while the articulation is in a scene. + In order to set the motion, remove and then re-add the articulation to the scene. + + @see PxArticulationAxis, PxArticulationMotion, getMotion + */ + virtual void setMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) = 0; + + /** + \brief Returns the joint motion for the given axis. + + \param[in] axis The target axis. + + \return The joint motion of the given axis. + + @see PxArticulationAxis, PxArticulationMotion, setMotion + */ + virtual PxArticulationMotion::Enum getMotion(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint limits for a given axis. + + - The motion of the corresponding axis should be set to PxArticulationMotion::eLIMITED in order for the limits to be enforced. + - The lower limit should be strictly smaller than the higher limit. If the limits should be equal, use PxArticulationMotion::eLOCKED + and an appropriate offset in the parent/child joint frames. + + \param[in] axis The target axis. + \param[in] lowLimit The lower joint limit.
+ Range: [-PX_MAX_F32, highLimit)
+ Default: 0.0 + \param[in] highLimit The higher joint limit.
+ Range: (lowLimit, PX_MAX_F32]
+ Default: 0.0 + + \note This call is not allowed while the simulation is running. + + \deprecated Use #setLimitParams instead. Deprecated since PhysX version 5.1. + + @see setLimitParams, PxArticulationAxis + */ + PX_DEPRECATED PX_FORCE_INLINE void setLimit(PxArticulationAxis::Enum axis, const PxReal lowLimit, const PxReal highLimit) + { + setLimitParams(axis, PxArticulationLimit(lowLimit, highLimit)); + } + + /** + \brief Returns the joint limits for a given axis. + + \param[in] axis The target axis. + \param[out] lowLimit The lower joint limit. + \param[out] highLimit The higher joint limit. + + \deprecated Use #getLimitParams instead. Deprecated since PhysX version 5.1. + + @see getLimitParams, PxArticulationAxis + */ + PX_DEPRECATED PX_FORCE_INLINE void getLimit(PxArticulationAxis::Enum axis, PxReal& lowLimit, PxReal& highLimit) const + { + PxArticulationLimit pair = getLimitParams(axis); + lowLimit = pair.low; + highLimit = pair.high; + } + + /** + \brief Sets the joint limits for a given axis. + + - The motion of the corresponding axis should be set to PxArticulationMotion::eLIMITED in order for the limits to be enforced. + - The lower limit should be strictly smaller than the higher limit. If the limits should be equal, use PxArticulationMotion::eLOCKED + and an appropriate offset in the parent/child joint frames. + + \param[in] axis The target axis. + \param[in] limit The joint limits. + + \note This call is not allowed while the simulation is running. + + \note For spherical joints, limit.min and limit.max must both be in range [-Pi, Pi]. + + @see getLimitParams, PxArticulationAxis, PxArticulationLimit + */ + virtual void setLimitParams(PxArticulationAxis::Enum axis, const PxArticulationLimit& limit) = 0; + + /** + \brief Returns the joint limits for a given axis. + + \param[in] axis The target axis. + + \return The joint limits. + + @see setLimitParams, PxArticulationAxis, PxArticulationLimit + */ + virtual PxArticulationLimit getLimitParams(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Configures a joint drive for the given axis. + + See PxArticulationDrive for parameter details; and the manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + \param[in] axis The target axis. + \param[in] stiffness The drive stiffness, i.e. the proportional gain of the implicit PD controller.
+ Range: [0, PX_MAX_F32]
+ Default: 0.0 + \param[in] damping The drive damping, i.e. the derivative gain of the implicit PD controller.
+ Range: [0, PX_MAX_F32]
+ Default: 0.0 + \param[in] maxForce The force limit of the drive (this parameter also limits the force for an acceleration-type drive).
+ Range: [0, PX_MAX_F32]
+ Default: 0.0 + \param[in] driveType The drive type, @see PxArticulationDriveType. + + \note This call is not allowed while the simulation is running. + + \deprecated Use #setDriveParams instead. Deprecated since PhysX version 5.1. + + @see setDriveParams, PxArticulationAxis, PxArticulationDriveType, PxArticulationDrive, PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES + */ + PX_DEPRECATED PX_FORCE_INLINE void setDrive(PxArticulationAxis::Enum axis, const PxReal stiffness, const PxReal damping, const PxReal maxForce, PxArticulationDriveType::Enum driveType = PxArticulationDriveType::eFORCE) + { + setDriveParams(axis, PxArticulationDrive(stiffness, damping, maxForce, driveType)); + } + + /** + \brief Gets the joint drive configuration for the given axis. + + \param[in] axis The motion axis. + \param[out] stiffness The drive stiffness. + \param[out] damping The drive damping. + \param[out] maxForce The force limit. + \param[out] driveType The drive type. + + \deprecated Use #getDriveParams instead. Deprecated since PhysX version 5.1. + + @see getDriveParams, PxArticulationAxis, PxArticulationDriveType, PxArticulationDrive + */ + PX_DEPRECATED PX_FORCE_INLINE void getDrive(PxArticulationAxis::Enum axis, PxReal& stiffness, PxReal& damping, PxReal& maxForce, PxArticulationDriveType::Enum& driveType) const + { + PxArticulationDrive drive = getDriveParams(axis); + stiffness = drive.stiffness; + damping = drive.damping; + maxForce = drive.maxForce; + driveType = drive.driveType; + } + + /** + \brief Configures a joint drive for the given axis. + + See PxArticulationDrive for parameter details; and the manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + \param[in] axis The target axis. + \param[in] drive The drive parameters + + \note This call is not allowed while the simulation is running. + + @see getDriveParams, PxArticulationAxis, PxArticulationDrive + */ + virtual void setDriveParams(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive) = 0; + + /** + \brief Gets the joint drive configuration for the given axis. + + \param[in] axis The target axis. + \return The drive parameters. + + @see setDriveParams, PxArticulationAxis, PxArticulationDrive + */ + virtual PxArticulationDrive getDriveParams(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint drive position target for the given axis. + + The target units are linear units (equivalent to scene units) for a translational axis, or rad for a rotational axis. + + \param[in] axis The target axis. + \param[in] target The target position. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call is not allowed while the simulation is running. + + \note For spherical joints, target must be in range [-Pi, Pi]. + + \note The target is specified in the parent frame of the joint. If Gp, Gc are the parent and child actor poses in the world frame and Lp, Lc are the parent and child joint frames expressed in the parent and child actor frames then the joint will drive the parent and child links to poses that obey Gp * Lp * J = Gc * Lc. For joints restricted to angular motion, J has the form PxTranfsorm(PxVec3(PxZero), PxExp(PxVec3(twistTarget, swing1Target, swing2Target))). For joints restricted to linear motion, J has the form PxTransform(PxVec3(XTarget, YTarget, ZTarget), PxQuat(PxIdentity)). + + \note For spherical joints with more than 1 degree of freedom, the joint target angles taken together can collectively represent a rotation of greater than Pi around a vector. When this happens the rotation that matches the joint drive target is not the shortest path rotation. The joint pose J that is the outcome after driving to the target pose will always be the equivalent of the shortest path rotation. + + @see PxArticulationAxis, getDriveTarget + */ + virtual void setDriveTarget(PxArticulationAxis::Enum axis, const PxReal target, bool autowake = true) = 0; + + /** + \brief Returns the joint drive position target for the given axis. + + \param[in] axis The target axis. + + \return The target position. + + @see PxArticulationAxis, setDriveTarget + */ + virtual PxReal getDriveTarget(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint drive velocity target for the given axis. + + The target units are linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + + \param[in] axis The target axis. + \param[in] targetVel The target velocity. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call is not allowed while the simulation is running. + + @see PxArticulationAxis, getDriveVelocity + */ + virtual void setDriveVelocity(PxArticulationAxis::Enum axis, const PxReal targetVel, bool autowake = true) = 0; + + /** + \brief Returns the joint drive velocity target for the given axis. + + \param[in] axis The target axis. + + \return The target velocity. + + @see PxArticulationAxis, setDriveVelocity + */ + virtual PxReal getDriveVelocity(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint armature for the given axis. + + - The armature is directly added to the joint-space spatial inertia of the corresponding axis. + - The armature is in mass units for a prismatic (i.e. linear) joint, and in mass units * (scene linear units)^2 for a rotational joint. + + \param[in] axis The target axis. + \param[in] armature The joint axis armature. + + \note This call is not allowed while the simulation is running. + + @see PxArticulationAxis, getArmature + */ + virtual void setArmature(PxArticulationAxis::Enum axis, const PxReal armature) = 0; + + /** + \brief Gets the joint armature for the given axis. + + \param[in] axis The target axis. + \return The armature set on the given axis. + + @see PxArticulationAxis, setArmature + */ + virtual PxReal getArmature(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint friction coefficient, which applies to all joint axes. + + - The joint friction is unitless and relates the magnitude of the spatial force [F_trans, T_trans] transmitted from parent to child link to + the maximal friction force F_resist that may be applied by the solver to resist joint motion, per axis; i.e. |F_resist| <= coefficient * (|F_trans| + |T_trans|), + where F_resist may refer to a linear force or torque depending on the joint axis. + - The simulated friction effect is therefore similar to static and Coulomb friction. In order to simulate dynamic joint friction, use a joint drive with + zero stiffness and zero velocity target, and an appropriately dimensioned damping parameter. + + \param[in] coefficient The joint friction coefficient. + + \note This call is not allowed while the simulation is running. + + @see getFrictionCoefficient + */ + virtual void setFrictionCoefficient(const PxReal coefficient) = 0; + + /** + \brief Gets the joint friction coefficient. + + \return The joint friction coefficient. + + @see setFrictionCoefficient + */ + virtual PxReal getFrictionCoefficient() const = 0; + + /** + \brief Sets the maximal joint velocity enforced for all axes. + + - The solver will apply appropriate joint-space impulses in order to enforce the per-axis joint-velocity limit. + - The velocity units are linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + + \param[in] maxJointV The maximal per-axis joint velocity. + + \note This call is not allowed while the simulation is running. + + @see getMaxJointVelocity + */ + virtual void setMaxJointVelocity(const PxReal maxJointV) = 0; + + /** + \brief Gets the maximal joint velocity enforced for all axes. + + \return The maximal per-axis joint velocity. + + @see setMaxJointVelocity + */ + virtual PxReal getMaxJointVelocity() const = 0; + + /** + \brief Sets the joint position for the given axis. + + - For performance, prefer PxArticulationCache::jointPosition to set joint positions in a batch articulation state update. + - Use PxArticulationReducedCoordinate::updateKinematic after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] axis The target axis. + \param[in] jointPos The joint position in linear units (equivalent to scene units) for a translational axis, or radians for a rotational axis. + + \note This call is not allowed while the simulation is running. + + \note For spherical joints, jointPos must be in range [-Pi, Pi]. + + \note Joint position is specified in the parent frame of the joint. If Gp, Gc are the parent and child actor poses in the world frame and Lp, Lc are the parent and child joint frames expressed in the parent and child actor frames then the parent and child links will be given poses that obey Gp * Lp * J = Gc * Lc with J denoting the joint pose. For joints restricted to angular motion, J has the form PxTranfsorm(PxVec3(PxZero), PxExp(PxVec3(twistPos, swing1Pos, swing2Pos))). For joints restricted to linear motion, J has the form PxTransform(PxVec3(xPos, yPos, zPos), PxQuat(PxIdentity)). + + \note For spherical joints with more than 1 degree of freedom, the input joint positions taken together can collectively represent a rotation of greater than Pi around a vector. When this happens the rotation that matches the joint positions is not the shortest path rotation. The joint pose J that is the outcome of setting and applying the joint positions will always be the equivalent of the shortest path rotation. + + @see PxArticulationAxis, getJointPosition, PxArticulationCache::jointPosition, PxArticulationReducedCoordinate::updateKinematic + */ + virtual void setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos) = 0; + + /** + \brief Gets the joint position for the given axis, i.e. joint degree of freedom (DOF). + + For performance, prefer PxArticulationCache::jointPosition to get joint positions in a batch query. + + \param[in] axis The target axis. + + \return The joint position in linear units (equivalent to scene units) for a translational axis, or radians for a rotational axis. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see PxArticulationAxis, setJointPosition, PxArticulationCache::jointPosition + */ + virtual PxReal getJointPosition(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Sets the joint velocity for the given axis. + + - For performance, prefer PxArticulationCache::jointVelocity to set joint velocities in a batch articulation state update. + - Use PxArticulationReducedCoordinate::updateKinematic after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] axis The target axis. + \param[in] jointVel The joint velocity in linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + + \note This call is not allowed while the simulation is running. + + @see PxArticulationAxis, getJointVelocity, PxArticulationCache::jointVelocity, PxArticulationReducedCoordinate::updateKinematic + */ + virtual void setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel) = 0; + + /** + \brief Gets the joint velocity for the given axis. + + For performance, prefer PxArticulationCache::jointVelocity to get joint velocities in a batch query. + + \param[in] axis The target axis. + + \return The joint velocity in linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see PxArticulationAxis, setJointVelocity, PxArticulationCache::jointVelocity + */ + virtual PxReal getJointVelocity(PxArticulationAxis::Enum axis) const = 0; + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationJointReducedCoordinate"; } + + virtual ~PxArticulationJointReducedCoordinate() {} + + //public variables: + void* userData; //!< The user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + protected: + PX_INLINE PxArticulationJointReducedCoordinate(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationJointReducedCoordinate(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxArticulationJointReducedCoordinate", name) || PxBase::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationLink.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationLink.h new file mode 100644 index 0000000..d6df1eb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationLink.h @@ -0,0 +1,205 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ARTICULATION_LINK_H +#define PX_ARTICULATION_LINK_H +/** \addtogroup physics +@{ */ + +#include "PxPhysXConfig.h" +#include "PxRigidBody.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A component of an articulation that represents a rigid body. + +Articulation links have a restricted subset of the functionality of a PxRigidDynamic: +- They may not be kinematic, and do not support contact-force thresholds. +- Their velocity or global pose cannot be set directly, but must be set via the articulation-root and joint positions/velocities. +- Sleep state and solver iteration counts are properties of the entire articulation rather than the individual links. + +@see PxArticulationReducedCoordinate, PxArticulationReducedCoordinate::createLink, PxArticulationJointReducedCoordinate, PxRigidBody +*/ + +class PxArticulationLink : public PxRigidBody +{ +public: + /** + \brief Releases the link from the articulation. + + \note Only a leaf articulation link can be released. + \note Releasing a link is not allowed while the articulation link is in a scene. In order to release a link, + remove and then re-add the corresponding articulation to the scene. + + @see PxArticulationReducedCoordinate::createLink() + */ + virtual void release() = 0; + + /** + \brief Gets the articulation that the link is a part of. + + \return The articulation. + + @see PxArticulationReducedCoordinate + */ + virtual PxArticulationReducedCoordinate& getArticulation() const = 0; + + /** + \brief Gets the joint which connects this link to its parent. + + \return The joint connecting the link to the parent. NULL for the root link. + + @see PxArticulationJointReducedCoordinate + */ + virtual PxArticulationJointReducedCoordinate* getInboundJoint() const = 0; + + /** + \brief Gets the number of degrees of freedom of the joint which connects this link to its parent. + + - The root link DOF-count is defined to be 0 regardless of PxArticulationFlag::eFIX_BASE. + - The return value is only valid for articulations that are in a scene. + + \return The number of degrees of freedom, or 0xFFFFFFFF if the articulation is not in a scene. + + @see PxArticulationJointReducedCoordinate + */ + virtual PxU32 getInboundJointDof() const = 0; + + /** + \brief Gets the number of child links. + + \return The number of child links. + + @see getChildren + */ + virtual PxU32 getNbChildren() const = 0; + + /** + \brief Gets the low-level link index that may be used to index into members of PxArticulationCache. + + The return value is only valid for articulations that are in a scene. + + \return The low-level index, or 0xFFFFFFFF if the articulation is not in a scene. + + @see PxArticulationCache + */ + virtual PxU32 getLinkIndex() const = 0; + + /** + \brief Retrieves the child links. + + \param[out] userBuffer The buffer to receive articulation link pointers. + \param[in] bufferSize The size of the provided user buffer, use getNbChildren() for sizing. + \param[in] startIndex The index of the first child pointer to be retrieved. + + \return The number of articulation links written to the buffer. + + @see getNbChildren + */ + virtual PxU32 getChildren(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + + /** + \brief Set the constraint-force-mixing scale term. + + The cfm scale term is a stabilization term that helps avoid instabilities with over-constrained + configurations. It should be a small value that is multiplied by 1/mass internally to produce + an additional bias added to the unit response term in the solver. + + \param[in] cfm The constraint-force-mixing scale term. + + Default: 0.025 + Range: [0, 1] + + \note This call is not allowed while the simulation is running. + + @see getCfmScale + */ + virtual void setCfmScale(const PxReal cfm) = 0; + + /** + \brief Get the constraint-force-mixing scale term. + \return The constraint-force-mixing scale term. + + @see setCfmScale + */ + virtual PxReal getCfmScale() const = 0; + + /** + \brief Get the linear velocity of the link. + + - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + - For performance, prefer PxArticulationCache::linkVelocity to get link spatial velocities in a batch query. + - When the articulation state is updated via non-cache API, use PxArticulationReducedCoordinate::updateKinematic before querying velocity. + + \return The linear velocity of the link. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see PxRigidBody::getCMassLocalPose + */ + virtual PxVec3 getLinearVelocity() const = 0; + + /** + \brief Get the angular velocity of the link. + + - For performance, prefer PxArticulationCache::linkVelocity to get link spatial velocities in a batch query. + - When the articulation state is updated via non-cache API, use PxArticulationReducedCoordinate::updateKinematic before querying velocity. + + \return The angular velocity of the link. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + */ + virtual PxVec3 getAngularVelocity() const = 0; + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationLink"; } + +protected: + PX_INLINE PxArticulationLink(PxType concreteType, PxBaseFlags baseFlags) : PxRigidBody(concreteType, baseFlags) {} + PX_INLINE PxArticulationLink(PxBaseFlags baseFlags) : PxRigidBody(baseFlags) {} + virtual ~PxArticulationLink() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxArticulationLink", name) || PxRigidBody::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationReducedCoordinate.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationReducedCoordinate.h new file mode 100644 index 0000000..32510f7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationReducedCoordinate.h @@ -0,0 +1,1419 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ARTICULATION_RC_H +#define PX_ARTICULATION_RC_H +/** \addtogroup physics +@{ */ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "solver/PxSolverDefs.h" +#include "PxArticulationFlag.h" +#include "PxArticulationTendon.h" +#include "PxArticulationFlag.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + PX_ALIGN_PREFIX(16) + /** + \brief Data structure to represent spatial forces. + */ + struct PxSpatialForce + { + PxVec3 force; + PxReal pad0; + PxVec3 torque; + PxReal pad1; + } + PX_ALIGN_SUFFIX(16); + + PX_ALIGN_PREFIX(16) + /** + \brief Data structure to represent spatial velocities. + */ + struct PxSpatialVelocity + { + PxVec3 linear; + PxReal pad0; + PxVec3 angular; + PxReal pad1; + } + PX_ALIGN_SUFFIX(16); + + class PxConstraint; + class PxScene; + + /** + \brief Data structure used to access the root link state and acceleration. + + @see PxArticulationCache + */ + struct PxArticulationRootLinkData + { + PxTransform transform; //!< Actor transform + // The velocities and accelerations below are with respect to the center of mass (COM) of the root link. The COM and actor frame origin may not coincide. + PxVec3 worldLinVel; //!< Link linear velocity + PxVec3 worldAngVel; //!< Link angular velocity + PxVec3 worldLinAccel; //!< Link classical linear acceleration + PxVec3 worldAngAccel; //!< Link angular acceleration + }; + + /** + \brief Data structure used to read and write internal articulation data. + + @see PxArticulationCacheFlag, PxArticulationReducedCoordinate::createCache, PxArticulationReducedCoordinate::applyCache, + PxArticulationReducedCoordinate::copyInternalStateToCache + */ + class PxArticulationCache + { + public: + PxArticulationCache() : + externalForces (NULL), + denseJacobian (NULL), + massMatrix (NULL), + jointVelocity (NULL), + jointAcceleration (NULL), + jointPosition (NULL), + jointForce (NULL), + jointSolverForces (NULL), + linkVelocity (NULL), + linkAcceleration (NULL), + rootLinkData (NULL), + sensorForces (NULL), + coefficientMatrix (NULL), + lambda (NULL), + scratchMemory (NULL), + scratchAllocator (NULL), + version (0) + {} + + /** + \brief Releases an articulation cache. + + @see PxArticulationReducedCoordinate::createCache, PxArticulationReducedCoordinate::applyCache, + PxArticulationReducedCoordinate::copyInternalStateToCache + */ + PX_PHYSX_CORE_API void release(); + + /** + \brief External forces acting on the articulation links for inverse dynamics computation. + + - N = getNbLinks(). + - Indexing follows the low-level link indices, see PxArticulationLink::getLinkIndex. + - The forces are with respect to the center of mass of the link. + + @see PxArticulationReducedCoordinate::computeGeneralizedExternalForce + */ + PxSpatialForce* externalForces; + + /** + \brief Dense Jacobian data. + + - N = nbRows * nbCols = (6 * getNbLinks()) * (6 + getDofs()) -> size includes possible floating-base DOFs regardless of PxArticulationFlag::eFIX_BASE flag. + - The links, i.e. rows are in order of the low-level link indices (minus one if PxArticulationFlag::eFIX_BASE is true), see PxArticulationLink::getLinkIndex. + The corresponding spatial velocities are stacked [vx; vy; vz; wx; wy; wz], where vx and wx refer to the linear and rotational velocity in world X. + - The DOFs, i.e. column indices correspond to the low-level DOF indices, see PxArticulationCache::jointVelocity. + + @see PxArticulationReducedCoordinate::computeDenseJacobian + */ + PxReal* denseJacobian; + + /** + \brief The generalized mass matrix that maps joint accelerations to joint forces. + + - N = getDofs() * getDofs(). + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + + @see PxArticulationReducedCoordinate::computeGeneralizedMassMatrix + */ + PxReal* massMatrix; + + /** + \brief The articulation joint DOF velocities. + + - N = getDofs(). + - Read/write using PxArticulationCacheFlag::eVELOCITY. + - The indexing follows the internal DOF index order. Therefore, the application should calculate the DOF data indices by summing the joint DOFs in the order of + the links' low-level indices (see the manual Section "Cache Indexing" for a snippet for this calculation): + \verbatim Low-level link index: | link 0 | link 1 | link 2 | link 3 | ... | <- PxArticulationLink::getLinkIndex() \endverbatim + \verbatim Link inbound joint DOF: | 0 | 1 | 2 | 1 | ... | <- PxArticulationLink::getInboundJointDof() \endverbatim + \verbatim Low-level DOF index: | - | 0 | 1, 2 | 3 | ... | \endverbatim + The root link always has low-level index 0 and always has zero inbound joint DOFs. The link DOF indexing follows the order in PxArticulationAxis::Enum. + For example, assume that low-level link 2 has an inbound spherical joint with two DOFs: eSWING1 and eSWING2. The corresponding low-level joint DOF indices + are therefore 1 for eSWING1 and 2 for eSWING2. + */ + PxReal* jointVelocity; + + /** + \brief The articulation joint DOF accelerations. + + - N = getDofs(). + - Read using PxArticulationCacheFlag::eACCELERATION. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - Delta joint DOF velocities can be computed from acceleration * dt. + */ + PxReal* jointAcceleration; + + /** + \brief The articulation joint DOF positions. + + - N = getDofs(). + - Read/write using PxArticulationCacheFlag::ePOSITION. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - For spherical joints, the joint position for each axis on the joint must be in range [-Pi, Pi]. + */ + PxReal* jointPosition; + + /** + \brief The articulation joint DOF forces. + + - N = getDofs(). + - Read/Write using PxArticulationCacheFlag::eFORCE. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - Applied joint forces persist and are applied each frame until changed. + */ + PxReal* jointForce; + + /** + \brief Solver constraint joint DOF forces. + + - N = getDofs(). + - Read using PxArticulationCacheFlag::eJOINT_SOLVER_FORCES. + - The indexing follows the internal DOF index order, see PxArticulationCache::jointVelocity. + - Raise PxArticulationFlag::eCOMPUTE_JOINT_FORCES to enable reading the solver forces. + */ + PxReal* jointSolverForces; + + /** + \brief Link spatial velocity. + + - N = getNbLinks(). + - Read using PxArticulationCacheFlag::eLINK_VELOCITY. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The velocity is with respect to the link's center of mass. + + @see PxRigidBody::getCMassLocalPose + */ + PxSpatialVelocity* linkVelocity; + + /** + \brief Link classical acceleration. + + - N = getNbLinks(). + - Read using PxArticulationCacheFlag::eLINK_ACCELERATION. + - The indexing follows the internal link indexing, see PxArticulationLink::getLinkIndex. + - The acceleration is with respect to the link's center of mass. + + @see PxArticulationReducedCoordinate::getLinkAcceleration, PxRigidBody::getCMassLocalPose + */ + PxSpatialVelocity* linkAcceleration; + + /** + \brief Root link transform, velocities, and accelerations. + + - N = 1. + - Read/write using PxArticulationCacheFlag::eROOT_TRANSFORM and PxArticulationCacheFlag::eROOT_VELOCITIES (accelerations are read-only). + + @see PxArticulationRootLinkData + */ + PxArticulationRootLinkData* rootLinkData; + + /** + \brief Link sensor spatial forces. + + - N = getNbSensors(). + - Read using PxArticulationCacheFlag::eSENSOR_FORCES. + - For indexing, see PxArticulationSensor::getIndex. + + @see PxArticulationSensor + */ + PxSpatialForce* sensorForces; + + // Members and memory below here are not zeroed when zeroCache is called, and are not included in the size returned by PxArticulationReducedCoordinate::getCacheDataSize. + + /** + \brief Constraint coefficient matrix. + + - N = getCoefficentMatrixSize(). + - The user needs to allocate memory and set this member to the allocated memory. + + @see PxArticulationReducedCoordinate::computeCoefficientMatrix + */ + PxReal* coefficientMatrix; + + /** + \brief Constraint lambda values (impulses applied by the respective constraints). + + - N = getNbLoopJoints(). + - The user needs to allocate memory and set this member to the allocated memory. + + @see PxArticulationReducedCoordinate::computeLambda + */ + PxReal* lambda; + + void* scratchMemory; //!< The scratch memory is used for internal calculations. + void* scratchAllocator; //!< The scratch allocator is used for internal calculations. + PxU32 version; //!< The cache version used internally to check compatibility with the articulation, i.e. detect if the articulation configuration changed after the cache was created. + }; + + /** + \brief Flags to configure the forces reported by articulation link sensors. + + @see PxArticulationSensor::setFlag + */ + struct PxArticulationSensorFlag + { + enum Enum + { + eFORWARD_DYNAMICS_FORCES = 1 << 0, //!< Raise to receive forces from forward dynamics. + eCONSTRAINT_SOLVER_FORCES = 1 << 1, //!< Raise to receive forces from constraint solver. + eWORLD_FRAME = 1 << 2 //!< Raise to receive forces in the world rotation frame, otherwise they will be reported in the sensor's local frame. + }; + }; + + typedef physx::PxFlags PxArticulationSensorFlags; + + /** + \brief A force sensor that can be attached to articulation links to measure spatial force. + + @see PxArticulationReducedCoordinate::createSensor + */ + class PxArticulationSensor : public PxBase + { + public: + /** + \brief Releases the sensor. + + \note Releasing a sensor is not allowed while the articulation is in a scene. In order to + release a sensor, remove and then re-add the articulation to the scene. + */ + virtual void release() = 0; + + /** + \brief Returns the spatial force in the local frame of the sensor. + + \return The spatial force. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see setRelativePose, getRelativePose + */ + virtual PxSpatialForce getForces() const = 0; + + /** + \brief Returns the relative pose between this sensor and the body frame of the link that the sensor is attached to. + + The link body frame is at the center of mass and aligned with the principal axes of inertia, see PxRigidBody::getCMassLocalPose. + + \return The transform link body frame -> sensor frame. + + @see setRelativePose + */ + virtual PxTransform getRelativePose() const = 0; + + /** + \brief Sets the relative pose between this sensor and the body frame of the link that the sensor is attached to. + + The link body frame is at the center of mass and aligned with the principal axes of inertia, see PxRigidBody::getCMassLocalPose. + + \param[in] pose The transform link body frame -> sensor frame. + + \note Setting the sensor relative pose is not allowed while the articulation is in a scene. In order to + set the pose, remove and then re-add the articulation to the scene. + + @see getRelativePose + */ + virtual void setRelativePose(const PxTransform& pose) = 0; + + /** + \brief Returns the link that this sensor is attached to. + + \return A pointer to the link. + */ + virtual PxArticulationLink* getLink() const = 0; + + /** + \brief Returns the index of this sensor inside the articulation. + + The return value is only valid for sensors attached to articulations that are in a scene. + + \return The low-level index, or 0xFFFFFFFF if the articulation is not in a scene. + */ + virtual PxU32 getIndex() const = 0; + + /** + \brief Returns the articulation that this sensor is part of. + + \return A pointer to the articulation. + */ + virtual PxArticulationReducedCoordinate* getArticulation() const = 0; + + /** + \brief Returns the sensor's flags. + + \return The current set of flags of the sensor. + + @see PxArticulationSensorFlag + */ + virtual PxArticulationSensorFlags getFlags() const = 0; + + /** + \brief Sets a flag of the sensor. + + \param[in] flag The flag to set. + \param[in] enabled The value to set the flag to. + + \note Setting the sensor flags is not allowed while the articulation is in a scene. In order to + set the flags, remove and then re-add the articulation to the scene. + + @see PxArticulationSensorFlag + */ + virtual void setFlag(PxArticulationSensorFlag::Enum flag, bool enabled) = 0; + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationSensor"; } + + virtual ~PxArticulationSensor() {} + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + protected: + PX_INLINE PxArticulationSensor(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationSensor(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + }; + + + /** + \brief Flag that configures articulation-state updates by PxArticulationReducedCoordinate::updateKinematic. + */ + struct PxArticulationKinematicFlag + { + enum Enum + { + ePOSITION = 1 << 0, //!< Raise after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + eVELOCITY = 1 << 1 //!< Raise after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities. + }; + }; + + typedef physx::PxFlags PxArticulationKinematicFlags; + PX_FLAGS_OPERATORS(PxArticulationKinematicFlag::Enum, PxU8) + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + + /** + \brief A tree structure of bodies connected by joints that is treated as a unit by the dynamics solver. Parametrized in reduced (joint) coordinates. + + @see PxArticulationJointReducedCoordinate, PxArticulationLink, PxPhysics::createArticulationReducedCoordinate + */ + class PxArticulationReducedCoordinate : public PxBase + { + public: + + /** + \brief Returns the scene which this articulation belongs to. + + \return Owner Scene. NULL if not part of a scene. + + @see PxScene + */ + virtual PxScene* getScene() const = 0; + + /** + \brief Sets the solver iteration counts for the articulation. + + The solver iteration count determines how accurately contacts, drives, and limits are resolved. + Setting a higher position iteration count may therefore help in scenarios where the articulation + is subject to many constraints; for example, a manipulator articulation with drives and joint limits + that is grasping objects, or several such articulations interacting through contacts. Other situations + where higher position iterations may improve simulation fidelity are: large mass ratios within the + articulation or between the articulation and an object in contact with it; or strong drives in the + articulation being used to manipulate a light object. + + If intersecting bodies are being depenetrated too violently, increase the number of velocity + iterations. More velocity iterations will drive the relative exit velocity of the intersecting + objects closer to the correct value given the restitution. + + \param[in] minPositionIters Number of position iterations the solver should perform for this articulation. Range: [1,255] + \param[in] minVelocityIters Number of velocity iterations the solver should perform for this articulation. Range: [1,255] + + \note This call may not be made during simulation. + + @see getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Returns the solver iteration counts. + + @see setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief Returns true if this articulation is sleeping. + + When an actor does not move for a period of time, it is no longer simulated in order to save time. This state + is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + or a sleep-affecting property is changed by the user, the entire sleep mechanism should be transparent to the user. + + An articulation can only go to sleep if all links are ready for sleeping. An articulation is guaranteed to be awake + if at least one of the following holds: + + \li The wake counter is positive (see #setWakeCounter()). + \li The linear or angular velocity of any link is non-zero. + \li A non-zero force or torque has been applied to the articulation or any of its links. + + If an articulation is sleeping, the following state is guaranteed: + + \li The wake counter is zero. + \li The linear and angular velocity of all links is zero. + \li There is no force update pending. + + When an articulation gets inserted into a scene, it will be considered asleep if all the points above hold, else it will + be treated as awake. + + If an articulation is asleep after the call to #PxScene::fetchResults() returns, it is guaranteed that the poses of the + links were not changed. You can use this information to avoid updating the transforms of associated objects. + + \return True if the articulation is sleeping. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation, + except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see wakeUp() putToSleep() getSleepThreshold() + */ + virtual bool isSleeping() const = 0; + + /** + \brief Sets the mass-normalized energy threshold below which the articulation may go to sleep. + + The articulation will sleep if the energy of each link is below this threshold. + + \param[in] threshold Energy below which the articulation may go to sleep. Range: [0, PX_MAX_F32) + + \note This call may not be made during simulation. + + @see isSleeping() getSleepThreshold() wakeUp() putToSleep() + */ + virtual void setSleepThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized energy below which the articulation may go to sleep. + + \return The energy threshold for sleeping. + + @see isSleeping() wakeUp() putToSleep() setSleepThreshold() + */ + virtual PxReal getSleepThreshold() const = 0; + + /** + \brief Sets the mass-normalized kinetic energy threshold below which the articulation may participate in stabilization. + + Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc. + + Default: 0.01 * PxTolerancesScale::speed * PxTolerancesScale::speed + + \param[in] threshold Energy below which the articulation may participate in stabilization. Range: [0,inf) + + \note This call may not be made during simulation. + + @see getStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual void setStabilizationThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized kinetic energy below which the articulation may participate in stabilization. + + Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + \return The energy threshold for participating in stabilization. + + @see setStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual PxReal getStabilizationThreshold() const = 0; + + /** + \brief Sets the wake counter for the articulation in seconds. + + - The wake counter value determines the minimum amount of time until the articulation can be put to sleep. + - An articulation will not be put to sleep if the energy is above the specified threshold (see #setSleepThreshold()) + or if other awake objects are touching it. + - Passing in a positive value will wake up the articulation automatically. + + Default: 0.4s (which corresponds to 20 frames for a time step of 0.02s) + + \param[in] wakeCounterValue Wake counter value in seconds. Range: [0, PX_MAX_F32) + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see isSleeping() getWakeCounter() + */ + virtual void setWakeCounter(PxReal wakeCounterValue) = 0; + + /** + \brief Returns the wake counter of the articulation in seconds. + + \return The wake counter of the articulation in seconds. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see isSleeping() setWakeCounter() + */ + virtual PxReal getWakeCounter() const = 0; + + /** + \brief Wakes up the articulation if it is sleeping. + + - The articulation will get woken up and might cause other touching objects to wake up as well during the next simulation step. + - This will set the wake counter of the articulation to the value specified in #PxSceneDesc::wakeCounterResetValue. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation, + except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see isSleeping() putToSleep() + */ + virtual void wakeUp() = 0; + + /** + \brief Forces the articulation to sleep. + + - The articulation will stay asleep during the next simulation step if not touched by another non-sleeping actor. + - This will set any applied force, the velocity, and the wake counter of all bodies in the articulation to zero. + + \note This call may not be made during simulation, and may only be made on articulations that are in a scene. + + @see isSleeping() wakeUp() + */ + virtual void putToSleep() = 0; + + /** + \brief Sets the limit on the magnitude of the linear velocity of the articulation's center of mass. + + - The limit acts on the linear velocity of the entire articulation. The velocity is calculated from the total momentum + and the spatial inertia of the articulation. + - The limit only applies to floating-base articulations. + - A benefit of the COM velocity limit is that it is evenly applied to the whole articulation, which results in fewer visual + artifacts compared to link rigid-body damping or joint-velocity limits. However, these per-link or per-degree-of-freedom + limits may still help avoid numerical issues. + + \note This call may not be made during simulation. + + \param[in] maxLinearVelocity The maximal linear velocity magnitude. Range: [0, PX_MAX_F32); Default: PX_MAX_F32. + + @see setMaxCOMAngularVelocity, PxRigidBody::setLinearDamping, PxRigidBody::setAngularDamping, PxArticulationJointReducedCoordinate::setMaxJointVelocity + */ + virtual void setMaxCOMLinearVelocity(const PxReal maxLinearVelocity) = 0; + + /** + \brief Gets the limit on the magnitude of the linear velocity of the articulation's center of mass. + + \return The maximal linear velocity magnitude. + + @see setMaxCOMLinearVelocity + */ + virtual PxReal getMaxCOMLinearVelocity() const = 0; + + /** + \brief Sets the limit on the magnitude of the angular velocity at the articulation's center of mass. + + - The limit acts on the angular velocity of the entire articulation. The velocity is calculated from the total momentum + and the spatial inertia of the articulation. + - The limit only applies to floating-base articulations. + - A benefit of the COM velocity limit is that it is evenly applied to the whole articulation, which results in fewer visual + artifacts compared to link rigid-body damping or joint-velocity limits. However, these per-link or per-degree-of-freedom + limits may still help avoid numerical issues. + + \note This call may not be made during simulation. + + \param[in] maxAngularVelocity The maximal angular velocity magnitude. Range: [0, PX_MAX_F32); Default: PX_MAX_F32. + + @see setMaxCOMLinearVelocity, PxRigidBody::setLinearDamping, PxRigidBody::setAngularDamping, PxArticulationJointReducedCoordinate::setMaxJointVelocity + */ + virtual void setMaxCOMAngularVelocity(const PxReal maxAngularVelocity) = 0; + + /** + \brief Gets the limit on the magnitude of the angular velocity at the articulation's center of mass. + + \return The maximal angular velocity magnitude. + + @see setMaxCOMAngularVelocity + */ + virtual PxReal getMaxCOMAngularVelocity() const = 0; + + /** + \brief Adds a link to the articulation with default attribute values. + + \param[in] parent The parent link in the articulation. Must be NULL if (and only if) this is the root link. + \param[in] pose The initial pose of the new link. Must be a valid transform. + + \return The new link, or NULL if the link cannot be created. + + \note Creating a link is not allowed while the articulation is in a scene. In order to add a link, + remove and then re-add the articulation to the scene. + + @see PxArticulationLink + */ + virtual PxArticulationLink* createLink(PxArticulationLink* parent, const PxTransform& pose) = 0; + + /** + \brief Releases the articulation, and all its links and corresponding joints. + + Attached sensors and tendons are released automatically when the articulation is released. + + \note This call may not be made during simulation. + */ + virtual void release() = 0; + + /** + \brief Returns the number of links in the articulation. + + \return The number of links. + */ + virtual PxU32 getNbLinks() const = 0; + + /** + \brief Returns the set of links in the articulation in the order that they were added to the articulation using createLink. + + \param[in] userBuffer Buffer into which to write the array of articulation link pointers. + \param[in] bufferSize The size of the buffer. If the buffer is not large enough to contain all the pointers to links, + only as many as will fit are written. + \param[in] startIndex Index of first link pointer to be retrieved. + + \return The number of links written into the buffer. + + @see PxArticulationLink + */ + virtual PxU32 getLinks(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of shapes in the articulation. + + \return The number of shapes. + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Sets a name string for the articulation 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. + + \param[in] name String to set the articulation's name to. + + @see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Returns the name string set with setName(). + + \return Name string associated with the articulation. + + @see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Returns the axis-aligned bounding box enclosing the articulation. + + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \return The articulation's bounding box. + + \note It is not allowed to use this method while the simulation is running, except in a split simulation + during #PxScene::collide() and up to #PxScene::advance(), and in PxContactModifyCallback or in contact report callbacks. + + @see PxBounds3 + */ + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const = 0; + + /** + \brief Returns the aggregate the articulation might be a part of. + + \return The aggregate the articulation is a part of, or NULL if the articulation does not belong to an aggregate. + + @see PxAggregate + */ + virtual PxAggregate* getAggregate() const = 0; + + /** + \brief Sets flags on the articulation. + + \param[in] flags The articulation flags. + + \note This call may not be made during simulation. + + @see PxArticulationFlag + */ + virtual void setArticulationFlags(PxArticulationFlags flags) = 0; + + /** + \brief Raises or clears a flag on the articulation. + + \param[in] flag The articulation flag. + \param[in] value The value to set the flag to. + + \note This call may not be made during simulation. + + @see PxArticulationFlag + */ + virtual void setArticulationFlag(PxArticulationFlag::Enum flag, bool value) = 0; + + /** + \brief Returns the articulation's flags. + + \return The flags. + + @see PxArticulationFlag + */ + virtual PxArticulationFlags getArticulationFlags() const = 0; + + /** + \brief Returns the total number of joint degrees-of-freedom (DOFs) of the articulation. + + - The six DOFs of the base of a floating-base articulation are not included in this count. + - Example: Both a fixed-base and a floating-base double-pendulum with two revolute joints will have getDofs() == 2. + - The return value is only valid for articulations that are in a scene. + + \return The number of joint DOFs, or 0xFFFFFFFF if the articulation is not in a scene. + + */ + virtual PxU32 getDofs() const = 0; + + /** + \brief Creates an articulation cache that can be used to read and write internal articulation data. + + - When the structure of the articulation changes (e.g. adding a link or sensor) after the cache was created, + the cache needs to be released and recreated. + - Free the memory allocated for the cache by calling the release() method on the cache. + - Caches can only be created by articulations that are in a scene. + + \return The cache, or NULL if the articulation is not in a scene. + + @see applyCache, copyInternalStateToCache + */ + virtual PxArticulationCache* createCache() const = 0; + + /** + \brief Returns the size of the articulation cache in bytes. + + - The size does not include: the user-allocated memory for the coefficient matrix or lambda values; + the scratch-related memory/members; and the cache version. See comment in #PxArticulationCache. + - The return value is only valid for articulations that are in a scene. + + \return The byte size of the cache, or 0xFFFFFFFF if the articulation is not in a scene. + + @see PxArticulationCache + */ + virtual PxU32 getCacheDataSize() const = 0; + + /** + \brief Zeroes all data in the articulation cache, except user-provided and scratch memory, and cache version. + + \note This call may only be made on articulations that are in a scene. + + @see PxArticulationCache + */ + virtual void zeroCache(PxArticulationCache& cache) const = 0; + + /** + \brief Applies the data in the cache to the articulation. + + This call wakes the articulation if it is sleeping, and the autowake parameter is true (default) or: + - a nonzero joint velocity is applied or + - a nonzero joint force is applied or + - a nonzero root velocity is applied + + \param[in] cache The articulation data. + \param[in] flags Indicate which data in the cache to apply to the articulation. + \param[in] autowake If true, the call wakes up the articulation and increases the wake counter to #PxSceneDesc::wakeCounterResetValue + if the counter value is below the reset value. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see PxArticulationCache, PxArticulationCacheFlags, createCache, copyInternalStateToCache, PxScene::applyArticulationData + */ + virtual void applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags, bool autowake = true) = 0; + + /** + \brief Copies internal data of the articulation to the cache. + + \param[in] cache The articulation data. + \param[in] flags Indicate which data to copy from the articulation to the cache. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see PxArticulationCache, PxArticulationCacheFlags, createCache, applyCache + */ + virtual void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags) const = 0; + + + /** + \brief Converts maximal-coordinate joint DOF data to reduced coordinates. + + - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + + \param[in] maximum The maximal-coordinate joint DOF data, N = (getNbLinks() - 1) * 6 + \param[out] reduced The reduced-coordinate joint DOF data, N = getDofs() + + \note The articulation must be in a scene. + + @see unpackJointData + */ + virtual void packJointData(const PxReal* maximum, PxReal* reduced) const = 0; + + /** + \brief Converts reduced-coordinate joint DOF data to maximal coordinates. + + - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + + \param[in] reduced The reduced-coordinate joint DOF data, N = getDofs(). + \param[out] maximum The maximal-coordinate joint DOF data, N = (getNbLinks() - 1) * 6. + + \note The articulation must be in a scene. + + @see packJointData + */ + virtual void unpackJointData(const PxReal* reduced, PxReal* maximum) const = 0; + + /** + \brief Prepares common articulation data based on articulation pose for inverse dynamics calculations. + + Usage: + 1. Set articulation pose (joint positions and base transform) via articulation cache and applyCache(). + 1. Call commonInit. + 1. Call inverse dynamics computation method. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see computeGeneralizedGravityForce, computeCoriolisAndCentrifugalForce + */ + virtual void commonInit() const = 0; + + /** + \brief Computes the joint DOF forces required to counteract gravitational forces for the given articulation pose. + + - Inputs - Articulation pose (joint positions + base transform). + - Outputs - Joint forces to counteract gravity (in cache). + + - The joint forces returned are determined purely by gravity for the articulation in the current joint and base pose, and joints at rest; + i.e. external forces, joint velocities, and joint accelerations are set to zero. Joint drives are also not considered in the computation. + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeGeneralizedGravityForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint DOF forces required to counteract Coriolis and centrifugal forces for the given articulation state. + + - Inputs - Articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs - Joint forces to counteract Coriolis and centrifugal forces (in cache). + + - The joint forces returned are determined purely by the articulation's state; i.e. external forces, gravity, and joint accelerations are set to zero. + Joint drives and potential damping terms, such as link angular or linear damping, or joint friction, are also not considered in the computation. + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointVelocity; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint DOF forces required to counteract external spatial forces applied to articulation links. + + - Inputs - External forces on links (in cache), articulation pose (joint positions + base transform). + - Outputs - Joint forces to counteract the external forces (in cache). + + - Only the external spatial forces provided in the cache and the articulation pose are considered in the computation. + - The external spatial forces are with respect to the links' centers of mass, and not the actor's origin. + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::externalForces; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeGeneralizedExternalForce(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint accelerations for the given articulation state and joint forces. + + - Inputs - Joint forces (in cache) and articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs - Joint accelerations (in cache). + + - The computation includes Coriolis terms and gravity. However, joint drives and potential damping terms are not considered in the computation + (for example, linear link damping or joint friction). + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointForce and PxArticulationCache::jointVelocity; Out: PxArticulationCache::jointAcceleration. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeJointAcceleration(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the joint forces for the given articulation state and joint accelerations, not considering gravity. + + - Inputs - Joint accelerations (in cache) and articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + - Outputs - Joint forces (in cache). + + - The computation includes Coriolis terms. However, joint drives and potential damping terms are not considered in the computation + (for example, linear link damping or joint friction). + - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[in,out] cache In: PxArticulationCache::jointAcceleration and PxArticulationCache::jointVelocity; Out: PxArticulationCache::jointForce. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeJointForce(PxArticulationCache& cache) const = 0; + + /** + \brief Compute the dense Jacobian for the articulation in world space, including the DOFs of a potentially floating base. + + This computes the dense representation of an inherently sparse matrix. Multiplication with this matrix maps + joint space velocities to world-space linear and angular (i.e. spatial) velocities of the centers of mass of the links. + + \param[out] cache Sets cache.denseJacobian matrix. The matrix is indexed [nCols * row + column]. + \param[out] nRows Set to number of rows in matrix, which corresponds to nbLinks() * 6, minus 6 if PxArticulationFlag::eFIX_BASE is true. + \param[out] nCols Set to number of columns in matrix, which corresponds to the number of joint DOFs, plus 6 in the case PxArticulationFlag::eFIX_BASE is false. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + */ + virtual void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const = 0; + + /** + \brief Computes the coefficient matrix for contact forces. + + - The matrix dimension is getCoefficientMatrixSize() = getDofs() * getNbLoopJoints(), and the DOF (column) indexing follows the internal DOF order, see PxArticulationCache::jointVelocity. + - Each column in the matrix is the joint forces effected by a contact based on impulse strength 1. + - The user must allocate memory for PxArticulationCache::coefficientMatrix where the required size of the PxReal array is equal to getCoefficientMatrixSize(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::coefficientMatrix. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit, getCoefficientMatrixSize + */ + virtual void computeCoefficientMatrix(PxArticulationCache& cache) const = 0; + + /** + \brief Computes the lambda values when the test impulse is 1. + + - The user must allocate memory for PxArticulationCache::lambda where the required size of the PxReal array is equal to getNbLoopJoints(). + - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::lambda. + \param[in] initialState The initial state of the articulation system. + \param[in] jointTorque M(q)*qddot + C(q,qdot) + g(q) <- calculate by summing joint forces obtained with computeJointForce and computeGeneralizedGravityForce. + \param[in] maxIter Maximum number of solver iterations to run. If the system converges, fewer iterations may be used. + + \return True if convergence was achieved within maxIter; False if convergence was not achieved or the operation failed otherwise. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit, getNbLoopJoints + */ + virtual bool computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, const PxReal* const jointTorque, const PxU32 maxIter) const = 0; + + /** + \brief Compute the joint-space inertia matrix that maps joint accelerations to joint forces: forces = M * accelerations. + + - Inputs - Articulation pose (joint positions and base transform). + - Outputs - Mass matrix (in cache). + + commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + + \param[out] cache Out: PxArticulationCache::massMatrix. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see commonInit + */ + virtual void computeGeneralizedMassMatrix(PxArticulationCache& cache) const = 0; + + /** + \brief Adds a loop joint to the articulation system for inverse dynamics. + + \param[in] joint The joint to add. + + \note This call may not be made during simulation. + + @see PxContactJoint, PxFixedJoint, PxSphericalJoint, PxRevoluteJoint, PxPrismaticJoint, PxDistanceJoint, PxD6Joint + */ + virtual void addLoopJoint(PxConstraint* joint) = 0; + + /** + \brief Removes a loop joint from the articulation for inverse dynamics. + + \note This call may not be made during simulation. + + \param[in] joint The joint to remove. + */ + virtual void removeLoopJoint(PxConstraint* joint) = 0; + + /** + \brief Returns the number of loop joints in the articulation for inverse dynamics. + + \return The number of loop joints. + */ + virtual PxU32 getNbLoopJoints() const = 0; + + /** + \brief Returns the set of loop constraints (i.e. joints) in the articulation. + + \param[in] userBuffer Target buffer for the constraint pointers. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to the constraints, + only as many as will fit are written. Use getNbLoopJoints() to size the buffer for retrieving all constraints. + \param[in] startIndex Index of first constraint pointer to be retrieved. + + \return The number of constraints written into the buffer. + */ + virtual PxU32 getLoopJoints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the required size of the coefficient matrix in the articulation. + + \return Size of the coefficient matrix (equal to getDofs() * getNbLoopJoints()). + + \note This call may only be made on articulations that are in a scene. + + @see computeCoefficientMatrix + */ + virtual PxU32 getCoefficientMatrixSize() const = 0; + + /** + \brief Sets the root link transform (world to actor frame). + + - For performance, prefer PxArticulationCache::rootLinkData to set the root link transform in a batch articulation state update. + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] pose The new root link transform. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call may not be made during simulation. + + @see getRootGlobalPose, updateKinematic, PxArticulationCache, applyCache + */ + virtual void setRootGlobalPose(const PxTransform& pose, bool autowake = true) = 0; + + /** + \brief Returns the root link transform (world to actor frame). + + For performance, prefer PxArticulationCache::rootLinkData to get the root link transform in a batch query. + + \return The root link transform. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see setRootGlobalPose, PxArticulationCache, copyInternalStateToCache + */ + virtual PxTransform getRootGlobalPose() const = 0; + + /** + \brief Sets the root link linear center-of-mass velocity. + + - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + - For performance, prefer PxArticulationCache::rootLinkData to set the root link velocity in a batch articulation state update. + - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] linearVelocity The new root link center-of-mass linear velocity. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see updateKinematic, getRootLinearVelocity, setRootAngularVelocity, getRootAngularVelocity, PxRigidBody::getCMassLocalPose, PxArticulationCache, applyCache + */ + virtual void setRootLinearVelocity(const PxVec3& linearVelocity, bool autowake = true) = 0; + + /** + \brief Gets the root link center-of-mass linear velocity. + + - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + - For performance, prefer PxArticulationCache::rootLinkData to get the root link velocity in a batch query. + + \return The root link center-of-mass linear velocity. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see setRootLinearVelocity, setRootAngularVelocity, getRootAngularVelocity, PxRigidBody::getCMassLocalPose, PxArticulationCache, applyCache + */ + virtual PxVec3 getRootLinearVelocity(void) const = 0; + + /** + \brief Sets the root link angular velocity. + + - For performance, prefer PxArticulationCache::rootLinkData to set the root link velocity in a batch articulation state update. + - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + in order to update link states for the next simulation frame or querying. + + \param[in] angularVelocity The new root link angular velocity. + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + \note This call may not be made during simulation, except in a split simulation in-between #PxScene::fetchCollision and #PxScene::advance. + + @see updateKinematic, getRootAngularVelocity, setRootLinearVelocity, getRootLinearVelocity, PxArticulationCache, applyCache + */ + virtual void setRootAngularVelocity(const PxVec3& angularVelocity, bool autowake = true) = 0; + + /** + \brief Gets the root link angular velocity. + + For performance, prefer PxArticulationCache::rootLinkData to get the root link velocity in a batch query. + + \return The root link angular velocity. + + \note This call is not allowed while the simulation is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), + and in PxContactModifyCallback or in contact report callbacks. + + @see setRootAngularVelocity, setRootLinearVelocity, getRootLinearVelocity, PxArticulationCache, applyCache + */ + virtual PxVec3 getRootAngularVelocity(void) const = 0; + + /** + \brief Returns the (classical) link acceleration in world space for the given low-level link index. + + - The returned acceleration is not a spatial, but a classical, i.e. body-fixed acceleration (https://en.wikipedia.org/wiki/Spatial_acceleration). + - The (linear) acceleration is with respect to the link's center of mass and not the actor frame origin. + + \param[in] linkId The low-level link index, see PxArticulationLink::getLinkIndex. + + \return The link's center-of-mass classical acceleration, or 0 if the call is made before the articulation participated in a first simulation step. + + \note This call may only be made on articulations that are in a scene, and it is not allowed to use this method while the simulation + is running except in a split simulation during #PxScene::collide() and up to #PxScene::advance(), and in PxContactModifyCallback or in contact report callbacks. + + @see PxArticulationLink::getLinkIndex, PxRigidBody::getCMassLocalPose + */ + virtual PxSpatialVelocity getLinkAcceleration(const PxU32 linkId) = 0; + + /** + \brief Returns the GPU articulation index. + + \return The GPU index, or 0xFFFFFFFF if the articulation is not in a scene or PxSceneFlag::eSUPPRESS_READBACK is not set. + */ + virtual PxU32 getGpuArticulationIndex() = 0; + + /** + \brief Creates a spatial tendon to attach to the articulation with default attribute values. + + \return The new spatial tendon. + + \note Creating a spatial tendon is not allowed while the articulation is in a scene. In order to + add the tendon, remove and then re-add the articulation to the scene. + + @see PxArticulationSpatialTendon + */ + virtual PxArticulationSpatialTendon* createSpatialTendon() = 0; + + /** + \brief Creates a fixed tendon to attach to the articulation with default attribute values. + + \return The new fixed tendon. + + \note Creating a fixed tendon is not allowed while the articulation is in a scene. In order to + add the tendon, remove and then re-add the articulation to the scene. + + @see PxArticulationFixedTendon + */ + virtual PxArticulationFixedTendon* createFixedTendon() = 0; + + /** + \brief Creates a force sensor attached to a link of the articulation. + + \param[in] link The link to attach the sensor to. + \param[in] relativePose The sensor frame's relative pose to the link's body frame, i.e. the transform body frame -> sensor frame. + The link body frame is at the center of mass and aligned with the principal axes of inertia, see PxRigidBody::getCMassLocalPose. + + \return The new sensor. + + \note Creating a sensor is not allowed while the articulation is in a scene. In order to + add the sensor, remove and then re-add the articulation to the scene. + + @see PxArticulationSensor + */ + virtual PxArticulationSensor* createSensor(PxArticulationLink* link, const PxTransform& relativePose) = 0; + + + /** + \brief Returns the spatial tendons attached to the articulation. + + The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the tendons. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to tendons, + only as many as will fit are written. Use getNbSpatialTendons to size for all attached tendons. + \param[in] startIndex Index of first tendon pointer to be retrieved. + + \return The number of tendons written into the buffer. + + @see PxArticulationSpatialTendon, getNbSpatialTendons + */ + virtual PxU32 getSpatialTendons(PxArticulationSpatialTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of spatial tendons in the articulation. + + \return The number of tendons. + */ + virtual PxU32 getNbSpatialTendons() = 0; + + /** + \brief Returns the fixed tendons attached to the articulation. + + The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the tendons. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to tendons, + only as many as will fit are written. Use getNbFixedTendons to size for all attached tendons. + \param[in] startIndex Index of first tendon pointer to be retrieved. + + \return The number of tendons written into the buffer. + + @see PxArticulationFixedTendon, getNbFixedTendons + */ + virtual PxU32 getFixedTendons(PxArticulationFixedTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of fixed tendons in the articulation. + + \return The number of tendons. + */ + virtual PxU32 getNbFixedTendons() = 0; + + /** + \brief Returns the sensors attached to the articulation. + + The order of the sensors in the buffer is not necessarily identical to the order in which the sensors were added to the articulation. + + \param[in] userBuffer The buffer into which to write the array of pointers to the sensors. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to sensors, + only as many as will fit are written. Use getNbSensors to size for all attached sensors. + \param[in] startIndex Index of first sensor pointer to be retrieved. + + \return The number of sensors written into the buffer. + + @see PxArticulationSensor, getNbSensors + */ + + virtual PxU32 getSensors(PxArticulationSensor** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of sensors in the articulation. + + \return The number of sensors. + */ + virtual PxU32 getNbSensors() = 0; + + /** + \brief Update link velocities and/or positions in the articulation. + + For performance, prefer the PxArticulationCache API that performs batch articulation state updates. + + If the application updates the root state (position and velocity) or joint state via any combination of + the non-cache API calls + + - setRootGlobalPose(), setRootLinearVelocity(), setRootAngularVelocity() + - PxArticulationJointReducedCoordinate::setJointPosition(), PxArticulationJointReducedCoordinate::setJointVelocity() + + the application needs to call this method after the state setting in order to update the link states for + the next simulation frame or querying. + + Use + - PxArticulationKinematicFlag::ePOSITION after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + - PxArticulationKinematicFlag::eVELOCITY after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities only. + + \note This call may only be made on articulations that are in a scene, and may not be made during simulation. + + @see PxArticulationKinematicFlags, PxArticulationCache, applyCache + */ + virtual void updateKinematic(PxArticulationKinematicFlags flags) = 0; + + virtual ~PxArticulationReducedCoordinate() {} + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + protected: + PX_INLINE PxArticulationReducedCoordinate(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationReducedCoordinate(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + + }; + +#if PX_VC +#pragma warning(pop) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendon.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendon.h new file mode 100644 index 0000000..6f47d0f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendon.h @@ -0,0 +1,589 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_ARTICULATION_TENDON_H +#define PX_ARTICULATION_TENDON_H +/** \addtogroup physics +@{ */ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "solver/PxSolverDefs.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxArticulationSpatialTendon; + class PxArticulationFixedTendon; + class PxArticulationLink; + /** + \brief Defines the low/high limits of the length of a tendon. + */ + class PxArticulationTendonLimit + { + public: + PxReal lowLimit; + PxReal highLimit; + }; + + /** + \brief Defines a spatial tendon attachment point on a link. + */ + class PxArticulationAttachment : public PxBase + { + + public: + + virtual ~PxArticulationAttachment() {} + /** + \brief Sets the spring rest length for the sub-tendon from the root to this leaf attachment. + + Setting this on non-leaf attachments has no effect. + + \param[in] restLength The rest length of the spring. + Default: 0 + + @see getRestLength(), isLeaf() + */ + virtual void setRestLength(const PxReal restLength) = 0; + + /** + \brief Gets the spring rest length for the sub-tendon from the root to this leaf attachment. + + \return The rest length. + + @see setRestLength() + */ + virtual PxReal getRestLength() const = 0; + + /** + \brief Sets the low and high limit on the length of the sub-tendon from the root to this leaf attachment. + + Setting this on non-leaf attachments has no effect. + + \param[in] parameters Struct with the low and high limit. + Default: (PX_MAX_F32, -PX_MAX_F32) (i.e. an invalid configuration that can only work if stiffness is zero) + + @see PxArticulationTendonLimit, getLimitParameters(), isLeaf() + */ + virtual void setLimitParameters(const PxArticulationTendonLimit& parameters) = 0; + + /** + \brief Gets the low and high limit on the length of the sub-tendon from the root to this leaf attachment. + + \return Struct with the low and high limit. + + @see PxArticulationTendonLimit, setLimitParameters() + */ + virtual PxArticulationTendonLimit getLimitParameters() const = 0; + + /** + \brief Sets the attachment's relative offset in the link actor frame. + + \param[in] offset The relative offset in the link actor frame. + + @see getRelativeOffset() + */ + virtual void setRelativeOffset(const PxVec3& offset) = 0; + + /** + \brief Gets the attachment's relative offset in the link actor frame. + + \return The relative offset in the link actor frame. + + @see setRelativeOffset() + */ + virtual PxVec3 getRelativeOffset() const = 0; + + /** + \brief Sets the attachment coefficient. + + \param[in] coefficient The scale that the distance between this attachment and its parent is multiplied by when summing up the spatial tendon's length. + + @see getCoefficient() + */ + virtual void setCoefficient(const PxReal coefficient) = 0; + + /** + \brief Gets the attachment coefficient. + + \return The scale that the distance between this attachment and its parent is multiplied by when summing up the spatial tendon's length. + + @see setCoefficient() + */ + virtual PxReal getCoefficient() const = 0; + + /** + \brief Gets the articulation link. + + \return The articulation link that this attachment is attached to. + */ + virtual PxArticulationLink* getLink() const = 0; + + /** + \brief Gets the parent attachment. + + \return The parent attachment. + */ + virtual PxArticulationAttachment* getParent() const = 0; + + /** + \brief Indicates that this attachment is a leaf, and thus defines a sub-tendon from the root to this attachment. + + \return True: This attachment is a leaf and has zero children; False: Not a leaf. + */ + virtual bool isLeaf() const = 0; + + /** + \brief Gets the spatial tendon that the attachment is a part of. + + \return The tendon. + + @see PxArticulationSpatialTendon + */ + virtual PxArticulationSpatialTendon* getTendon() const = 0; + + /** + \brief Releases the attachment. + + \note Releasing the attachment is not allowed while the articulation is in a scene. In order to + release the attachment, remove and then re-add the articulation to the scene. + + @see PxArticulationSpatialTendon::createAttachment() + */ + virtual void release() = 0; + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationAttachment"; } + + protected: + + PX_INLINE PxArticulationAttachment(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationAttachment(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + }; + + + /** + \brief Defines a fixed-tendon joint on an articulation joint degree of freedom. + */ + class PxArticulationTendonJoint : public PxBase + { + + public: + + virtual ~PxArticulationTendonJoint() {} + + /** + \brief Sets the tendon joint coefficient. + + \param[in] axis The degree of freedom that the tendon joint operates on (must correspond to a degree of freedom of the associated link's incoming joint). + \param[in] coefficient The scale that the axis' joint position is multiplied by when summing up the fixed tendon's length. + \param[in] recipCoefficient The scale that the tendon's response is multiplied by when applying to this tendon joint. + + \note RecipCoefficient is commonly expected to be 1/coefficient, but it can be set to different values to tune behavior; for example, zero can be used to + have a joint axis only participate in the length computation of the tendon, but not have any tendon force applied to it. + + @see getCoefficient() + */ + virtual void setCoefficient(const PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient) = 0; + + /** + \brief Gets the tendon joint coefficient. + + \param[out] axis The degree of freedom that the tendon joint operates on. + \param[out] coefficient The scale that the axis' joint position is multiplied by when summing up the fixed tendon's length. + \param[in] recipCoefficient The scale that the tendon's response is multiplied by when applying to this tendon joint. + + @see setCoefficient() + */ + virtual void getCoefficient(PxArticulationAxis::Enum& axis, PxReal& coefficient, PxReal& recipCoefficient) const = 0; + + /** + \brief Gets the articulation link. + + \return The articulation link (and its incoming joint in particular) that this tendon joint is associated with. + */ + virtual PxArticulationLink* getLink() const = 0; + + /** + \brief Gets the parent tendon joint. + + \return The parent tendon joint. + */ + virtual PxArticulationTendonJoint* getParent() const = 0; + + /** + \brief Gets the tendon that the joint is a part of. + + \return The tendon. + + @see PxArticulationFixedTendon + */ + virtual PxArticulationFixedTendon* getTendon() const = 0; + + /** + \brief Releases a tendon joint. + + \note Releasing a tendon joint is not allowed while the articulation is in a scene. In order to + release the joint, remove and then re-add the articulation to the scene. + + @see PxArticulationFixedTendon::createTendonJoint() + */ + virtual void release() = 0; + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationTendonJoint"; } + + protected: + + PX_INLINE PxArticulationTendonJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationTendonJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + }; + + + /** + \brief Common API base class shared by PxArticulationSpatialTendon and PxArticulationFixedTendon. + */ + class PxArticulationTendon : public PxBase + { + public: + /** + \brief Sets the spring stiffness term acting on the tendon length. + + \param[in] stiffness The spring stiffness. + Default: 0 + + @see getStiffness() + */ + virtual void setStiffness(const PxReal stiffness) = 0; + + /** + \brief Gets the spring stiffness of the tendon. + + \return The spring stiffness. + + @see setStiffness() + */ + virtual PxReal getStiffness() const = 0; + + /** + \brief Sets the damping term acting both on the tendon length and tendon-length limits. + + \param[in] damping The damping term. + Default: 0 + + @see getDamping() + */ + virtual void setDamping(const PxReal damping) = 0; + + /** + \brief Gets the damping term acting both on the tendon length and tendon-length limits. + + \return The damping term. + + @see setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Sets the limit stiffness term acting on the tendon's length limits. + + For spatial tendons, this parameter applies to all its leaf attachments / sub-tendons. + + \param[in] stiffness The limit stiffness term. + Default: 0 + + @see getLimitStiffness() + */ + virtual void setLimitStiffness(const PxReal stiffness) = 0; + + /** + \brief Gets the limit stiffness term acting on the tendon's length limits. + + For spatial tendons, this parameter applies to all its leaf attachments / sub-tendons. + + \return The limit stiffness term. + + @see setLimitStiffness() + */ + virtual PxReal getLimitStiffness() const = 0; + + /** + \brief Sets the length offset term for the tendon. + + An offset defines an amount to be added to the accumulated length computed for the tendon. It allows the + application to actuate the tendon by shortening or lengthening it. + + \param[in] offset The offset term. Default: 0 + \param[in] autowake If true and the articulation is in a scene, the call wakes up the articulation and increases the wake counter + to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + @see getOffset() + */ + virtual void setOffset(const PxReal offset, bool autowake = true) = 0; + + /** + \brief Gets the length offset term for the tendon. + + \return The offset term. + + @see setOffset() + */ + virtual PxReal getOffset() const = 0; + + /** + \brief Gets the articulation that the tendon is a part of. + + \return The articulation. + + @see PxArticulationReducedCoordinate + */ + virtual PxArticulationReducedCoordinate* getArticulation() const = 0; + + /** + \brief Releases a tendon to remove it from the articulation and free its associated memory. + + When an articulation is released, its attached tendons are automatically released. + + \note Releasing a tendon is not allowed while the articulation is in a scene. In order to + release the tendon, remove and then re-add the articulation to the scene. + */ + + virtual void release() = 0; + + virtual ~PxArticulationTendon() {} + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + protected: + PX_INLINE PxArticulationTendon(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxArticulationTendon(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + }; + + /** + \brief A spatial tendon that attaches to an articulation. + + A spatial tendon attaches to multiple links in an articulation using a set of PxArticulationAttachments. + The tendon is defined as a tree of attachment points, where each attachment can have an arbitrary number of children. + Each leaf of the attachment tree defines a subtendon between itself and the root attachment. The subtendon then + applies forces at the leaf, and an equal but opposing force at the root, in order to satisfy the spring-damper and limit + constraints that the user sets up. Attachments in between the root and leaf do not exert any force on the articulation, + but define the geometry of the tendon from which the length is computed together with the attachment coefficients. + */ + class PxArticulationSpatialTendon : public PxArticulationTendon + { + public: + /** + \brief Creates an articulation attachment and adds it to the list of children in the parent attachment. + + Creating an attachment is not allowed while the articulation is in a scene. In order to + add the attachment, remove and then re-add the articulation to the scene. + + \param[in] parent The parent attachment. Can be NULL for the root attachment of a tendon. + \param[in] coefficient A user-defined scale that the accumulated length is scaled by. + \param[in] relativeOffset An offset vector in the link's actor frame to the point where the tendon attachment is attached to the link. + \param[in] link The link that this attachment is associated with. + + \return The newly-created attachment if creation was successful, otherwise a null pointer. + + @see releaseAttachment() + */ + virtual PxArticulationAttachment* createAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link) = 0; + + /** + \brief Fills a user-provided buffer of attachment pointers with the set of attachments. + + \param[in] userBuffer The user-provided buffer. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to attachments, + only as many as can fit are written. Use getNbAttachments to size for all attachments. + \param[in] startIndex Index of first attachment pointer to be retrieved. + + \return The number of attachments that were filled into the user buffer. + + @see getNbAttachments + */ + virtual PxU32 getAttachments(PxArticulationAttachment** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of attachments in the tendon. + + \return The number of attachments. + */ + virtual PxU32 getNbAttachments() const = 0; + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationSpatialTendon"; } + + virtual ~PxArticulationSpatialTendon() {} + + protected: + PX_INLINE PxArticulationSpatialTendon(PxType concreteType, PxBaseFlags baseFlags) : PxArticulationTendon(concreteType, baseFlags) {} + PX_INLINE PxArticulationSpatialTendon(PxBaseFlags baseFlags) : PxArticulationTendon(baseFlags) {} + + }; + + /** + \brief A fixed tendon that can be used to link multiple degrees of freedom of multiple articulation joints via length and limit constraints. + + Fixed tendons allow the simulation of coupled relationships between joint degrees of freedom in an articulation. Fixed tendons do not allow + linking arbitrary joint axes of the articulation: The respective joints must all be directly connected to each other in the articulation structure, + i.e. each of the joints in the tendon must be connected by a single articulation link to another joint in the same tendon. This implies both that + 1) fixed tendons can branch along a branching articulation; and 2) they cannot be used to create relationships between axes in a spherical joint with + more than one degree of freedom. Locked joint axes or fixed joints are currently not supported. + */ + class PxArticulationFixedTendon : public PxArticulationTendon + { + public: + /** + \brief Creates an articulation tendon joint and adds it to the list of children in the parent tendon joint. + + Creating a tendon joint is not allowed while the articulation is in a scene. In order to + add the joint, remove and then re-add the articulation to the scene. + + \param[in] parent The parent tendon joint. Can be NULL for the root tendon joint of a tendon. + \param[in] axis The degree of freedom that this tendon joint is associated with. + \param[in] coefficient A user-defined scale that the accumulated tendon length is scaled by. + \param[in] recipCoefficient The scale that the tendon's response is multiplied by when applying to this tendon joint. + \param[in] link The link (and the link's incoming joint in particular) that this tendon joint is associated with. + + \return The newly-created tendon joint if creation was successful, otherwise a null pointer. + + \note + - The axis motion must not be configured as PxArticulationMotion::eLOCKED. + - The axis cannot be part of a fixed joint, i.e. joint configured as PxArticulationJointType::eFIX. + + @see PxArticulationTendonJoint PxArticulationAxis + */ + virtual PxArticulationTendonJoint* createTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link) = 0; + + /** + \brief Fills a user-provided buffer of tendon-joint pointers with the set of tendon joints. + + \param[in] userBuffer The user-provided buffer. + \param[in] bufferSize The size of the buffer. If this is not large enough to contain all the pointers to tendon joints, + only as many as can fit are written. Use getNbTendonJoints to size for all tendon joints. + \param[in] startIndex Index of first tendon joint pointer to be retrieved. + + \return The number of tendon joints filled into the user buffer. + + @see getNbTendonJoints + */ + virtual PxU32 getTendonJoints(PxArticulationTendonJoint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of tendon joints in the tendon. + + \return The number of tendon joints. + */ + virtual PxU32 getNbTendonJoints() const = 0; + + /** + \brief Sets the spring rest length of the tendon. + + The accumulated "length" of a fixed tendon is a linear combination of the joint axis positions that the tendon is + associated with, scaled by the respective tendon joints' coefficients. As such, when the joint positions of all + joints are zero, the accumulated length of a fixed tendon is zero. + + The spring of the tendon is not exerting any force on the articulation when the rest length is equal to the + tendon's accumulated length plus the tendon offset. + + \param[in] restLength The spring rest length of the tendon. + + @see getRestLength() + */ + virtual void setRestLength(const PxReal restLength) = 0; + + /** + \brief Gets the spring rest length of the tendon. + + \return The spring rest length of the tendon. + + @see setRestLength() + */ + virtual PxReal getRestLength() const = 0; + + /** + \brief Sets the low and high limit on the length of the tendon. + + \param[in] parameter Struct with the low and high limit. + + The limits, together with the damping and limit stiffness parameters, act on the accumulated length of the tendon. + + @see PxArticulationTendonLimit getLimitParameters() setRestLength() + */ + virtual void setLimitParameters(const PxArticulationTendonLimit& parameter) = 0; + + + /** + \brief Gets the low and high limit on the length of the tendon. + + \return Struct with the low and high limit. + + @see PxArticulationTendonLimit setLimitParameters() + */ + virtual PxArticulationTendonLimit getLimitParameters() const = 0; + + /** + \brief Returns the string name of the dynamic type. + + \return The string name. + */ + virtual const char* getConcreteTypeName() const { return "PxArticulationFixedTendon"; } + + virtual ~PxArticulationFixedTendon() {} + + protected: + PX_INLINE PxArticulationFixedTendon(PxType concreteType, PxBaseFlags baseFlags) : PxArticulationTendon(concreteType, baseFlags) {} + PX_INLINE PxArticulationFixedTendon(PxBaseFlags baseFlags) : PxArticulationTendon(baseFlags) {} + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendonData.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendonData.h new file mode 100644 index 0000000..8a4155a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxArticulationTendonData.h @@ -0,0 +1,120 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_ARTICULATION_TENDON_DATA_H +#define PX_ARTICULATION_TENDON_DATA_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PxGpuSpatialTendonData + +This data structure is to be used by the direct GPU API for spatial tendon data updates. + +@see PxArticulationSpatialTendon PxScene::copyArticulationData PxScene::applyArticulationData +*/ +PX_ALIGN_PREFIX(16) +class PxGpuSpatialTendonData +{ +public: + PxReal stiffness; + PxReal damping; + PxReal limitStiffness; + PxReal offset; +} +PX_ALIGN_SUFFIX(16); + +/** +\brief PxGpuFixedTendonData + +This data structure is to be used by the direct GPU API for fixed tendon data updates. + +@see PxArticulationFixedTendon PxScene::copyArticulationData PxScene::applyArticulationData +*/ +PX_ALIGN_PREFIX(16) +class PxGpuFixedTendonData : public PxGpuSpatialTendonData +{ +public: + PxReal lowLimit; + PxReal highLimit; + PxReal restLength; + PxReal padding; +} +PX_ALIGN_SUFFIX(16); + +/** +\brief PxGpuTendonJointCoefficientData + +This data structure is to be used by the direct GPU API for fixed tendon joint data updates. + +@see PxArticulationTendonJoint PxScene::copyArticulationData PxScene::applyArticulationData +*/ +PX_ALIGN_PREFIX(16) +class PxGpuTendonJointCoefficientData +{ +public: + PxReal coefficient; + PxReal recipCoefficient; + PxU32 axis; + PxU32 pad; +} +PX_ALIGN_SUFFIX(16); + +/** +\brief PxGpuTendonAttachmentData + +This data structure is to be used by the direct GPU API for spatial tendon attachment data updates. + +@see PxArticulationAttachment PxScene::copyArticulationData PxScene::applyArticulationData +*/ +PX_ALIGN_PREFIX(16) +class PxGpuTendonAttachmentData +{ +public: + PxVec3 relativeOffset; + PxReal restLength; + + PxReal coefficient; + PxReal lowLimit; + PxReal highLimit; + PxReal padding; +} +PX_ALIGN_SUFFIX(16); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxAttachment.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxAttachment.h new file mode 100644 index 0000000..32d0a17 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxAttachment.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ATTACHMENT_H +#define PX_ATTACHMENT_H + +#include "PxConeLimitedConstraint.h" +#include "PxFiltering.h" +#include "foundation/PxVec4.h" + +/** \addtogroup physics +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Struct to specify attachment between a particle/vertex and a rigid +*/ +struct PxParticleRigidAttachment : public PxParticleRigidFilterPair +{ + PX_ALIGN(16, PxVec4 mLocalPose0); //!< local pose in body frame - except for statics, these are using world positions. + + PxConeLimitParams mParams; //!< Parameters to specify cone constraints +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxBaseMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBaseMaterial.h new file mode 100644 index 0000000..7f5f8c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBaseMaterial.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BASE_MATERIAL_H +#define PX_BASE_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Base material class. + + @see PxPhysics.createMaterial PxPhysics.createFEMClothMaterial PxPhysics.createFEMSoftBodyMaterial PxPhysics.createFLIPMaterial PxPhysics.createMPMMaterial PxPhysics.createPBDMaterial + */ + class PxBaseMaterial : public PxRefCounted + { + public: + PX_INLINE PxBaseMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags), userData(NULL) {} + PX_INLINE PxBaseMaterial(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxBaseMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxBaseMaterial", name) || PxRefCounted::isKindOf(name); } + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxBroadPhase.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBroadPhase.h new file mode 100644 index 0000000..450b45b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBroadPhase.h @@ -0,0 +1,705 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BROAD_PHASE_H +#define PX_BROAD_PHASE_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxBaseTask; + class PxCudaContextManager; + + /** + \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 + }; + }; + + /** + \brief "Region of interest" for the broad-phase. + + This is currently only used for the PxBroadPhaseType::eMBP broad-phase, which requires zones or regions to be defined + when the simulation starts in order to work. Regions can overlap and be added or removed at runtime, but at least one + region needs to be defined when the scene is created. + + If objects that do no overlap any region are inserted into the scene, they will not be added to the broad-phase and + thus collisions will be disabled for them. A PxBroadPhaseCallback out-of-bounds notification will be sent for each one + of those objects. + + The total number of regions is limited by PxBroadPhaseCaps::mMaxNbRegions. + + The number of regions has a direct impact on performance and memory usage, so it is recommended to experiment with + various settings to find the best combination for your game. A good default setup is to start with global bounds + around the whole world, and subdivide these bounds into 4*4 regions. The PxBroadPhaseExt::createRegionsFromWorldBounds + function can do that for you. + + @see PxBroadPhaseCallback PxBroadPhaseExt.createRegionsFromWorldBounds + */ + struct PxBroadPhaseRegion + { + PxBounds3 mBounds; //!< Region's bounds + void* mUserData; //!< Region's user-provided data + }; + + /** + \brief Information & stats structure for a region + */ + struct PxBroadPhaseRegionInfo + { + PxBroadPhaseRegion mRegion; //!< User-provided region data + PxU32 mNbStaticObjects; //!< Number of static objects in the region + PxU32 mNbDynamicObjects; //!< Number of dynamic objects in the region + bool mActive; //!< True if region is currently used, i.e. it has not been removed + bool mOverlap; //!< True if region overlaps other regions (regions that are just touching are not considering overlapping) + }; + + /** + \brief Caps class for broad phase. + */ + struct PxBroadPhaseCaps + { + PxU32 mMaxNbRegions; //!< Max number of regions supported by the broad-phase (0 = explicit regions not needed) + }; + + /** + \brief Broadphase descriptor. + + This structure is used to create a standalone broadphase. It captures all the parameters needed to + initialize a broadphase. + + For the GPU broadphase (PxBroadPhaseType::eGPU) it is necessary to provide a CUDA context manager. + + The kinematic filtering flags are currently not supported by the GPU broadphase. They are used to + dismiss pairs that involve kinematic objects directly within the broadphase. + + \see PxCreateBroadPhase + */ + class PxBroadPhaseDesc + { + public: + PxBroadPhaseDesc(PxBroadPhaseType::Enum type = PxBroadPhaseType::eLAST) : + mType (type), + mContextID (0), + mContextManager (NULL), + mFoundLostPairsCapacity (256 * 1024), + mDiscardStaticVsKinematic (false), + mDiscardKinematicVsKinematic(false) + {} + + PxBroadPhaseType::Enum mType; //!< Desired broadphase implementation + PxU64 mContextID; //!< Context ID for profiler. See PxProfilerCallback. + + PX_DEPRECATED PxCudaContextManager* mContextManager; //!< (GPU) CUDA context manager, must be provided for PxBroadPhaseType::eGPU. + PxU32 mFoundLostPairsCapacity; //!< (GPU) Capacity of found and lost buffers allocated in GPU global memory. This is used for the found/lost pair reports in the BP. + + bool mDiscardStaticVsKinematic; //!< Static-vs-kinematic filtering flag. Not supported by PxBroadPhaseType::eGPU. + bool mDiscardKinematicVsKinematic; //!< kinematic-vs-kinematic filtering flag. Not supported by PxBroadPhaseType::eGPU. + + PX_INLINE bool isValid() const + { + if(PxU32(mType)>=PxBroadPhaseType::eLAST) + return false; + + if(mType==PxBroadPhaseType::eGPU && !mContextManager) + return false; + + return true; + } + }; + + typedef PxU32 PxBpIndex; //!< Broadphase index. Indexes bounds, groups and distance arrays. + typedef PxU32 PxBpFilterGroup; //!< Broadphase filter group. + #define PX_INVALID_BP_FILTER_GROUP 0xffffffff //!< Invalid broadphase filter group + + /** + \brief Retrieves the filter group for static objects. + + Mark static objects with this group when adding them to the broadphase. + Overlaps between static objects will not be detected. All static objects + should have the same group. + + \return Filter group for static objects. + \see PxBpFilterGroup + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxBpFilterGroup PxGetBroadPhaseStaticFilterGroup(); + + /** + \brief Retrieves a filter group for dynamic objects. + + Mark dynamic objects with this group when adding them to the broadphase. + Each dynamic object must have an ID, and overlaps between dynamic objects that have + the same ID will not be detected. This is useful to dismiss overlaps between shapes + of the same (compound) actor directly within the broadphase. + + \param id [in] ID/Index of dynamic object + \return Filter group for the object. + \see PxBpFilterGroup + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxBpFilterGroup PxGetBroadPhaseDynamicFilterGroup(PxU32 id); + + /** + \brief Retrieves a filter group for kinematic objects. + + Mark kinematic objects with this group when adding them to the broadphase. + Each kinematic object must have an ID, and overlaps between kinematic objects that have + the same ID will not be detected. + + \param id [in] ID/Index of kinematic object + \return Filter group for the object. + \see PxBpFilterGroup + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxBpFilterGroup PxGetBroadPhaseKinematicFilterGroup(PxU32 id); + + /** + \brief Broadphase data update structure. + + This structure is used to update the low-level broadphase (PxBroadPhase). All added, updated and removed objects + must be batched and submitted at once to the broadphase. + + Broadphase objects have bounds, a filtering group, and a distance. With the low-level broadphase the data must be + externally managed by the clients of the broadphase API, and passed to the update function. + + The provided bounds are non-inflated "base" bounds that can be further extended by the broadphase using the passed + distance value. These can be contact offsets, or dynamically updated distance values for e.g. speculative contacts. + Either way they are optional and can be left to zero. The broadphase implementations efficiently combine the base + bounds with the per-object distance values at runtime. + + The per-object filtering groups are used to discard some pairs directly within the broadphase, which is more + efficient than reporting the pairs and culling them in a second pass. + + \see PxBpFilterGroup PxBpIndex PxBounds3 PxBroadPhase::update + */ + class PxBroadPhaseUpdateData + { + public: + + PxBroadPhaseUpdateData( const PxBpIndex* created, PxU32 nbCreated, + const PxBpIndex* updated, PxU32 nbUpdated, + const PxBpIndex* removed, PxU32 nbRemoved, + const PxBounds3* bounds, const PxBpFilterGroup* groups, const float* distances, + PxU32 capacity) : + mCreated (created), mNbCreated (nbCreated), + mUpdated (updated), mNbUpdated (nbUpdated), + mRemoved (removed), mNbRemoved (nbRemoved), + mBounds (bounds), mGroups (groups), mDistances (distances), + mCapacity (capacity) + { + } + + PxBroadPhaseUpdateData(const PxBroadPhaseUpdateData& other) : + mCreated (other.mCreated), mNbCreated (other.mNbCreated), + mUpdated (other.mUpdated), mNbUpdated (other.mNbUpdated), + mRemoved (other.mRemoved), mNbRemoved (other.mNbRemoved), + mBounds (other.mBounds), mGroups (other.mGroups), mDistances (other.mDistances), + mCapacity (other.mCapacity) + { + } + + PxBroadPhaseUpdateData& operator=(const PxBroadPhaseUpdateData& other); + + const PxBpIndex* mCreated; //!< Indices of created objects. + const PxU32 mNbCreated; //!< Number of created objects. + + const PxBpIndex* mUpdated; //!< Indices of updated objects. + const PxU32 mNbUpdated; //!< Number of updated objects. + + const PxBpIndex* mRemoved; //!< Indices of removed objects. + const PxU32 mNbRemoved; //!< Number of removed objects. + + const PxBounds3* mBounds; //!< (Persistent) array of bounds. + const PxBpFilterGroup* mGroups; //!< (Persistent) array of groups. + const float* mDistances; //!< (Persistent) array of distances. + const PxU32 mCapacity; //!< Capacity of bounds / groups / distance buffers. + }; + + /** + \brief Broadphase pair. + + A pair of indices returned by the broadphase for found or lost pairs. + + \see PxBroadPhaseResults + */ + struct PxBroadPhasePair + { + PxBpIndex mID0; //!< Index of first object + PxBpIndex mID1; //!< Index of second object + }; + + /** + \brief Broadphase results. + + Set of found and lost pairs after a broadphase update. + + \see PxBroadPhasePair PxBroadPhase::fetchResults PxAABBManager::fetchResults + */ + struct PxBroadPhaseResults + { + PxBroadPhaseResults() : mNbCreatedPairs(0), mCreatedPairs(NULL), mNbDeletedPairs(0), mDeletedPairs(NULL) {} + + PxU32 mNbCreatedPairs; //!< Number of new/found/created pairs. + const PxBroadPhasePair* mCreatedPairs; //!< Array of new/found/created pairs. + + PxU32 mNbDeletedPairs; //!< Number of lost/deleted pairs. + const PxBroadPhasePair* mDeletedPairs; //!< Array of lost/deleted pairs. + }; + + /** + \brief Broadphase regions. + + An API to manage broadphase regions. Only needed for the MBP broadphase (PxBroadPhaseType::eMBP). + + \see PxBroadPhase::getRegions() + */ + class PxBroadPhaseRegions + { + protected: + PxBroadPhaseRegions() {} + virtual ~PxBroadPhaseRegions() {} + public: + + /** + \brief Returns number of regions currently registered in the broad-phase. + + \return Number of regions + */ + virtual PxU32 getNbRegions() const = 0; + + /** + \brief Gets broad-phase regions. + + \param userBuffer [out] Returned broad-phase regions + \param bufferSize [in] Size of provided userBuffer. + \param startIndex [in] Index of first desired region, in [0 ; getNbRegions()[ + \return Number of written out regions. + \see PxBroadPhaseRegionInfo + */ + virtual PxU32 getRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Adds a new broad-phase region. + + The total number of regions is limited to PxBroadPhaseCaps::mMaxNbRegions. If that number is exceeded, the call is ignored. + + The newly added region will be automatically populated with already existing objects that touch it, if the + 'populateRegion' parameter is set to true. Otherwise the newly added region will be empty, and it will only be + populated with objects when those objects are added to the simulation, or updated if they already exist. + + Using 'populateRegion=true' has a cost, so it is best to avoid it if possible. In particular it is more efficient + to create the empty regions first (with populateRegion=false) and then add the objects afterwards (rather than + the opposite). + + Objects automatically move from one region to another during their lifetime. The system keeps tracks of what + regions a given object is in. It is legal for an object to be in an arbitrary number of regions. However if an + object leaves all regions, or is created outside of all regions, several things happen: + - collisions get disabled for this object + - the object appears in the getOutOfBoundsObjects() array + + If an out-of-bounds object, whose collisions are disabled, re-enters a valid broadphase region, then collisions + are re-enabled for that object. + + \param region [in] User-provided region data + \param populateRegion [in] True to automatically populate the newly added region with existing objects touching it + \param bounds [in] User-managed array of bounds + \param distances [in] User-managed array of distances + + \return Handle for newly created region, or 0xffffffff in case of failure. + \see PxBroadPhaseRegion getOutOfBoundsObjects() + */ + virtual PxU32 addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* bounds, const float* distances) = 0; + + /** + \brief Removes a broad-phase region. + + If the region still contains objects, and if those objects do not overlap any region any more, they are not + automatically removed from the simulation. Instead, the PxBroadPhaseCallback::onObjectOutOfBounds notification + is used for each object. Users are responsible for removing the objects from the simulation if this is the + desired behavior. + + If the handle is invalid, or if a valid handle is removed twice, an error message is sent to the error stream. + + \param handle [in] Region's handle, as returned by addRegion + \return True if success + */ + virtual bool removeRegion(PxU32 handle) = 0; + + /* + \brief Return the number of objects that are not in any region. + */ + virtual PxU32 getNbOutOfBoundsObjects() const = 0; + + /* + \brief Return an array of objects that are not in any region. + */ + virtual const PxU32* getOutOfBoundsObjects() const = 0; + }; + + /** + \brief Low-level broadphase API. + + This low-level API only supports batched updates and leaves most of the data management to its clients. + + This is useful if you want to use the broadphase with your own memory buffers. Note however that the GPU broadphase + works best with buffers allocated in CUDA memory. The getAllocator() function returns an allocator that is compatible + with the selected broadphase. It is recommended to allocate and deallocate the broadphase data (bounds, groups, distances) + using this allocator. + + Important note: it must be safe to load 4 bytes past the end of the provided bounds array. + + The high-level broadphase API (PxAABBManager) is an easier-to-use interface that automatically deals with these requirements. + + \see PxCreateBroadPhase + */ + class PxBroadPhase + { + protected: + PxBroadPhase() {} + virtual ~PxBroadPhase() {} + public: + + /* + \brief Releases the broadphase. + */ + virtual void release() = 0; + + /** + \brief Gets the broadphase type. + + \return Broadphase type. + \see PxBroadPhaseType::Enum + */ + virtual PxBroadPhaseType::Enum getType() const = 0; + + /** + \brief Gets broad-phase caps. + + \param caps [out] Broad-phase caps + \see PxBroadPhaseCaps + */ + virtual void getCaps(PxBroadPhaseCaps& caps) const = 0; + + /** + \brief Retrieves the regions API if applicable. + + For broadphases that do not use explicit user-defined regions, this call returns NULL. + + \return Region API, or NULL. + \see PxBroadPhaseRegions + */ + virtual PxBroadPhaseRegions* getRegions() = 0; + + /** + \brief Retrieves the broadphase allocator. + + User-provided buffers should ideally be allocated with this allocator, for best performance. + This is especially true for the GPU broadphases, whose buffers need to be allocated in CUDA + host memory. + + \return The broadphase allocator. + \see PxAllocatorCallback + */ + virtual PxAllocatorCallback* getAllocator() = 0; + + /** + \brief Retrieves the profiler's context ID. + + \return The context ID. + \see PxBroadPhaseDesc + */ + virtual PxU64 getContextID() const = 0; + + /** + \brief Sets a scratch buffer + + Some broadphases might take advantage of a scratch buffer to limit runtime allocations. + + All broadphases still work without providing a scratch buffer, this is an optional function + that can potentially reduce runtime allocations. + + \param scratchBlock [in] The scratch buffer + \param size [in] Size of the scratch buffer in bytes + */ + virtual void setScratchBlock(void* scratchBlock, PxU32 size) = 0; + + /** + \brief Updates the broadphase and computes the lists of created/deleted pairs. + + The provided update data describes changes to objects since the last broadphase update. + + To benefit from potentially multithreaded implementations, it is necessary to provide a continuation + task to the function. It is legal to pass NULL there, but the underlying (CPU) implementations will + then run single-threaded. + + \param updateData [in] The update data + \param continuation [in] Continuation task to enable multi-threaded implementations, or NULL. + \see PxBroadPhaseUpdateData PxBaseTask + */ + virtual void update(const PxBroadPhaseUpdateData& updateData, PxBaseTask* continuation=NULL) = 0; + + /** + \brief Retrieves the broadphase results after an update. + + This should be called once after each update call to retrieve the results of the broadphase. The + results are incremental, i.e. the system only returns new and lost pairs, not all current pairs. + + \param results [out] The broadphase results + \see PxBroadPhaseResults + */ + virtual void fetchResults(PxBroadPhaseResults& results) = 0; + + /** + \brief Helper for single-threaded updates. + + This short helper function performs a single-theaded update and reports the results in a single call. + + \param results [out] The broadphase results + \param updateData [in] The update data + \see PxBroadPhaseUpdateData PxBroadPhaseResults + */ + PX_FORCE_INLINE void update(PxBroadPhaseResults& results, const PxBroadPhaseUpdateData& updateData) + { + update(updateData); + fetchResults(results); + } + }; + + /** + \brief Broadphase factory function. + + Use this function to create a new standalone broadphase. + + \param desc [in] Broadphase descriptor + \return Newly created broadphase, or NULL + \see PxBroadPhase PxBroadPhaseDesc + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxBroadPhase* PxCreateBroadPhase(const PxBroadPhaseDesc& desc); + + /** + \brief High-level broadphase API. + + The low-level broadphase API (PxBroadPhase) only supports batched updates and has a few non-trivial + requirements for managing the bounds data. + + The high-level broadphase API (PxAABBManager) is an easier-to-use one-object-at-a-time API that + automatically deals with the quirks of the PxBroadPhase data management. + + \see PxCreateAABBManager + */ + class PxAABBManager + { + protected: + PxAABBManager() {} + virtual ~PxAABBManager() {} + public: + + /* + \brief Releases the AABB manager. + */ + virtual void release() = 0; + + /** + \brief Retrieves the underlying broadphase. + + \return The managed broadphase. + \see PxBroadPhase + */ + virtual PxBroadPhase& getBroadPhase() = 0; + + /** + \brief Retrieves the managed bounds. + + This is needed as input parameters to functions like PxBroadPhaseRegions::addRegion. + + \return The managed object bounds. + \see PxBounds3 + */ + virtual const PxBounds3* getBounds() const = 0; + + /** + \brief Retrieves the managed distances. + + This is needed as input parameters to functions like PxBroadPhaseRegions::addRegion. + + \return The managed object distances. + */ + virtual const float* getDistances() const = 0; + + /** + \brief Retrieves the managed filter groups. + + \return The managed object groups. + */ + virtual const PxBpFilterGroup* getGroups() const = 0; + + /** + \brief Retrieves the managed buffers' capacity. + + Bounds, distances and groups buffers have the same capacity. + + \return The managed buffers' capacity. + */ + virtual PxU32 getCapacity() const = 0; + + /** + \brief Adds an object to the manager. + + Objects' indices are externally managed, i.e. they must be provided by users (as opposed to handles + that could be returned by this manager). The design allows users to identify an object by a single ID, + and use the same ID in multiple sub-systems. + + \param index [in] The object's index + \param bounds [in] The object's bounds + \param group [in] The object's filter group + \param distance [in] The object's distance (optional) + \see PxBpIndex PxBounds3 PxBpFilterGroup + */ + virtual void addObject(PxBpIndex index, const PxBounds3& bounds, PxBpFilterGroup group, float distance=0.0f) = 0; + + /** + \brief Removes an object from the manager. + + \param index [in] The object's index + \see PxBpIndex + */ + virtual void removeObject(PxBpIndex index) = 0; + + /** + \brief Updates an object in the manager. + + This call can update an object's bounds, distance, or both. + It is not possible to update an object's filter group. + + \param index [in] The object's index + \param bounds [in] The object's updated bounds, or NULL + \param distance [in] The object's updated distance, or NULL + \see PxBpIndex PxBounds3 + */ + virtual void updateObject(PxBpIndex index, const PxBounds3* bounds=NULL, const float* distance=NULL) = 0; + + /** + \brief Updates the broadphase and computes the lists of created/deleted pairs. + + The data necessary for updating the broadphase is internally computed by the AABB manager. + + To benefit from potentially multithreaded implementations, it is necessary to provide a continuation + task to the function. It is legal to pass NULL there, but the underlying (CPU) implementations will + then run single-threaded. + + \param continuation [in] Continuation task to enable multi-threaded implementations, or NULL. + \see PxBaseTask + */ + virtual void update(PxBaseTask* continuation=NULL) = 0; + + /** + \brief Retrieves the broadphase results after an update. + + This should be called once after each update call to retrieve the results of the broadphase. The + results are incremental, i.e. the system only returns new and lost pairs, not all current pairs. + + \param results [out] The broadphase results + \see PxBroadPhaseResults + */ + virtual void fetchResults(PxBroadPhaseResults& results) = 0; + + /** + \brief Helper for single-threaded updates. + + This short helper function performs a single-theaded update and reports the results in a single call. + + \param results [out] The broadphase results + \see PxBroadPhaseResults + */ + PX_FORCE_INLINE void update(PxBroadPhaseResults& results) + { + update(); + fetchResults(results); + } + }; + + /** + \brief AABB manager factory function. + + Use this function to create a new standalone high-level broadphase. + + \param broadphase [in] The broadphase that will be managed by the AABB manager + \return Newly created AABB manager, or NULL + \see PxAABBManager PxBroadPhase + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxAABBManager* PxCreateAABBManager(PxBroadPhase& broadphase); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBuffer.h new file mode 100644 index 0000000..4ebaf11 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxBuffer.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_BUFFER_H +#define PX_BUFFER_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + +class PxCudaContextManager; + +/** +\brief Specifies memory space for a PxBuffer instance. + +@see PxBuffer +*/ +struct PxBufferType +{ + enum Enum + { + eHOST, + eDEVICE + }; +}; + +/** +\brief Buffer for delayed bulk read and write operations supporting host and GPU device memory spaces. + +@see PxPhysics::createBuffer(), PxParticleSystem +*/ +class PX_DEPRECATED PxBuffer +{ +public: + + /** + \brief Deletes the buffer. + + Do not keep a reference to the deleted instance. + Unfinished operations will be flushed and synchronized on. + */ + virtual void release() = 0; + + /** + \brief Provides access to internal memory (either device or pinned host memory depending on PxBufferType). + + Unfinished operations will be flushed and synchronized on before returning. + */ + virtual void* map() = 0; + + /** + \brief Releases access to internal memory (either device or pinned host memory depending on PxBufferType). + + \param[in] event Optional pointer to CUevent. Used to synchronize on application side work that needs to be completed before + buffer can be accessed again. + */ + virtual void unmap(void* event = NULL) = 0; + + /** + \brief Buffer memory space type. + + @see PxBufferType + */ + virtual PxBufferType::Enum getBufferType() const = 0; + + /** + \brief Size of buffer in bytes. + */ + virtual PxU64 getByteSize() const = 0; + + /** + \brief Get the associated PxCudaContextManager. + + @see PxCudaContextManager. + */ + virtual PxCudaContextManager* getCudaContextManager() const = 0; + + /** + \brief Helper function to synchronize on all pending operations. + + @see PxCudaContextManager. + */ + PX_INLINE void sync() { map(); unmap(); } + + virtual void resize(PxU64 size) = 0; + +protected: + + virtual ~PxBuffer() {} + PX_INLINE PxBuffer() {} +}; + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxClient.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxClient.h new file mode 100644 index 0000000..71d3948 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxClient.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CLIENT_H +#define PX_CLIENT_H + +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief An ID to identify different clients for multiclient support. + +@see PxScene::createClient() +*/ +typedef PxU8 PxClientID; + +/** +\brief The predefined default PxClientID value. + +@see PxClientID PxScene::createClient() +*/ +static const PxClientID PX_DEFAULT_CLIENT = 0; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxConeLimitedConstraint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConeLimitedConstraint.h new file mode 100644 index 0000000..e8e931f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConeLimitedConstraint.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONE_LIMITED_CONSTRAINT_H +#define PX_CONE_LIMITED_CONSTRAINT_H + +/** \addtogroup physics +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A constraint descriptor for limiting movement to a conical region. +*/ +struct PxConeLimitedConstraint +{ + PxConeLimitedConstraint() + { + mAxis = PxVec3(0.f, 0.f, 0.f); + mAngle = 0.f; + mLowLimit = 0.f; + mHighLimit = 0.f; + } + + PxVec3 mAxis; //!< Axis of the cone in the actor space of the rigid body + PxReal mAngle; //!< Opening angle in radians + PxReal mLowLimit; //!< Minimum distance + PxReal mHighLimit; //!< Maximum distance +}; + +/** +\brief Compressed form of cone limit parameters +@see PxConeLimitedConstraint +*/ +PX_ALIGN_PREFIX(16) +struct PxConeLimitParams +{ + PxVec4 lowHighLimits; // [lowLimit, highLimit, unused, unused] + PxVec4 axisAngle; // [axis.x, axis.y, axis.z, angle] +}PX_ALIGN_SUFFIX(16); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraint.h new file mode 100644 index 0000000..08e1715 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraint.h @@ -0,0 +1,274 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONSTRAINT_H +#define PX_CONSTRAINT_H + +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxConstraintDesc.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRigidActor; +class PxScene; +class PxConstraintConnector; + +/** +\brief constraint flags + +\note eBROKEN is a read only flag +*/ +struct PxConstraintFlag +{ + enum Enum + { + eBROKEN = 1<<0, //!< whether the constraint is broken + ePROJECT_TO_ACTOR0 = 1<<1, //!< @deprecated whether actor1 should get projected to actor0 for this constraint (note: projection of a static/kinematic actor to a dynamic actor will be ignored) + ePROJECT_TO_ACTOR1 = 1<<2, //!< @deprecated whether actor0 should get projected to actor1 for this constraint (note: projection of a static/kinematic actor to a dynamic actor will be ignored) + ePROJECTION = ePROJECT_TO_ACTOR0 | ePROJECT_TO_ACTOR1, //!< @deprecated whether the actors should get projected for this constraint (the direction will be chosen by PhysX) + eCOLLISION_ENABLED = 1<<3, //!< whether contacts should be generated between the objects this constraint constrains + eVISUALIZATION = 1<<4, //!< whether this constraint should be visualized, if constraint visualization is turned on + eDRIVE_LIMITS_ARE_FORCES = 1<<5, //!< limits for drive strength are forces rather than impulses + eIMPROVED_SLERP = 1<<7, //!< perform preprocessing for improved accuracy on D6 Slerp Drive (this flag will be removed in a future release when preprocessing is no longer required) + eDISABLE_PREPROCESSING = 1<<8, //!< suppress constraint preprocessing, intended for use with rowResponseThreshold. May result in worse solver accuracy for ill-conditioned constraints. + eENABLE_EXTENDED_LIMITS = 1<<9, //!< enables extended limit ranges for angular limits (e.g., limit values > PxPi or < -PxPi) + eGPU_COMPATIBLE = 1<<10, //!< the constraint type is supported by gpu dynamics + eALWAYS_UPDATE = 1<<11, //!< updates the constraint each frame + eDISABLE_CONSTRAINT = 1<<12 //!< disables the constraint. SolverPrep functions won't be called for this constraint. + }; +}; + +/** +\brief constraint flags +@see PxConstraintFlag +*/ +typedef PxFlags PxConstraintFlags; +PX_FLAGS_OPERATORS(PxConstraintFlag::Enum, PxU16) + +/** +\brief a table of function pointers for a constraint + +@see PxConstraint +*/ +struct PxConstraintShaderTable +{ + PxConstraintSolverPrep solverPrep; //!< solver constraint generation function + PX_DEPRECATED PxConstraintProject project; //!< @deprecated constraint projection function + PxConstraintVisualize visualize; //!< constraint visualization function + PxConstraintFlag::Enum flag; //!< constraint flags +}; + +/** +\brief A plugin class for implementing constraints + +@see PxPhysics.createConstraint +*/ +class PxConstraint : public PxBase +{ +public: + + /** + \brief Releases a PxConstraint instance. + + \note This call does not wake up the connected rigid bodies. + + @see PxPhysics.createConstraint, PxBase.release() + */ + virtual void release() = 0; + + /** + \brief Retrieves the scene which this constraint belongs to. + + \return Owner Scene. NULL if not part of a scene. + + @see PxScene + */ + virtual PxScene* getScene() const = 0; + + /** + \brief Retrieves the actors for this constraint. + + \param[out] actor0 a reference to the pointer for the first actor + \param[out] actor1 a reference to the pointer for the second actor + + @see PxActor + */ + virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0; + + /** + \brief Sets the actors for this constraint. + + \param[in] actor0 a reference to the pointer for the first actor + \param[in] actor1 a reference to the pointer for the second actor + + @see PxActor + */ + virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0; + + /** + \brief Notify the scene that the constraint shader data has been updated by the application + */ + virtual void markDirty() = 0; + + /** + \brief Retrieve the flags for this constraint + + \return the constraint flags + @see PxConstraintFlags + */ + virtual PxConstraintFlags getFlags() const = 0; + + /** + \brief Set the flags for this constraint + + \param[in] flags the new constraint flags + + default: PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + + @see PxConstraintFlags + */ + virtual void setFlags(PxConstraintFlags flags) = 0; + + /** + \brief Set a flag for this constraint + + \param[in] flag the constraint flag + \param[in] value the new value of the flag + + @see PxConstraintFlags + */ + virtual void setFlag(PxConstraintFlag::Enum flag, bool value) = 0; + + /** + \brief Retrieve the constraint force most recently applied to maintain this constraint. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \param[out] linear the constraint force + \param[out] angular the constraint torque + */ + virtual void getForce(PxVec3& linear, PxVec3& angular) const = 0; + + /** + \brief whether the constraint is valid. + + A constraint is valid if it has at least one dynamic rigid body or articulation link. A constraint that + is not valid may not be inserted into a scene, and therefore a static actor to which an invalid constraint + is attached may not be inserted into a scene. + + Invalid constraints arise only when an actor to which the constraint is attached has been deleted. + */ + virtual bool isValid() const = 0; + + /** + \brief Set the break force and torque thresholds for this constraint. + + If either the force or torque measured at the constraint exceed these thresholds the constraint will break. + + \param[in] linear the linear break threshold + \param[in] angular the angular break threshold + */ + virtual void setBreakForce(PxReal linear, PxReal angular) = 0; + + /** + \brief Retrieve the constraint break force and torque thresholds + + \param[out] linear the linear break threshold + \param[out] angular the angular break threshold + */ + virtual void getBreakForce(PxReal& linear, PxReal& angular) const = 0; + + /** + \brief Set the minimum response threshold for a constraint row + + When using mass modification for a joint or infinite inertia for a jointed body, very stiff solver constraints can be generated which + can destabilize simulation. Setting this value to a small positive value (e.g. 1e-8) will cause constraint rows to be ignored if very + large changes in impulses will generate only small changes in velocity. When setting this value, also set + PxConstraintFlag::eDISABLE_PREPROCESSING. The solver accuracy for this joint may be reduced. + + \param[in] threshold the minimum response threshold + + @see PxConstraintFlag::eDISABLE_PREPROCESSING + */ + virtual void setMinResponseThreshold(PxReal threshold) = 0; + + /** + \brief Retrieve the constraint break force and torque thresholds + + \return the minimum response threshold for a constraint row + */ + virtual PxReal getMinResponseThreshold() const = 0; + + /** + \brief Fetch external owner of the constraint. + + Provides a reference to the external owner of a constraint and a unique owner type ID. + + \param[out] typeID Unique type identifier of the external object. + \return Reference to the external object which owns the constraint. + + @see PxConstraintConnector.getExternalReference() + */ + virtual void* getExternalReference(PxU32& typeID) = 0; + + /** + \brief Set the constraint functions for this constraint + + \param[in] connector the constraint connector object by which the SDK communicates with the constraint. + \param[in] shaders the shader table for the constraint + + @see PxConstraintConnector PxConstraintSolverPrep PxConstraintProject PxConstraintVisualize + */ + virtual void setConstraintFunctions(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders) = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxConstraint"; } + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + PX_INLINE PxConstraint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {} + PX_INLINE PxConstraint(PxBaseFlags baseFlags) : PxBase(baseFlags), userData(NULL) {} + virtual ~PxConstraint() {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxConstraint", name) || PxBase::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraintDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraintDesc.h new file mode 100644 index 0000000..a9f16a3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxConstraintDesc.h @@ -0,0 +1,468 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONSTRAINT_DESC_H +#define PX_CONSTRAINT_DESC_H + +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" +#include "foundation/PxVec3.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx { namespace pvdsdk { +#endif + class PvdDataStream; +#if !PX_DOXYGEN +}} +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + \brief Constraint row flags + + These flags configure the post-processing of constraint rows and the behavior of the solver while solving constraints +*/ +struct Px1DConstraintFlag +{ + enum Type + { + eSPRING = 1<<0, //!< whether the constraint is a spring. Mutually exclusive with eRESTITUTION. If set, eKEEPBIAS is ignored. + eACCELERATION_SPRING = 1<<1, //!< whether the constraint is a force or acceleration spring. Only valid if eSPRING is set. + eRESTITUTION = 1<<2, //!< whether the restitution model should be applied to generate the target velocity. Mutually exclusive with eSPRING. If restitution causes a bounces, eKEEPBIAS is ignored + eKEEPBIAS = 1<<3, //!< whether to keep the error term when solving for velocity. Ignored if restitution generates bounce, or eSPRING is set. + eOUTPUT_FORCE = 1<<4, //!< whether to accumulate the force value from this constraint in the force total that is reported for the constraint and tested for breakage + eHAS_DRIVE_LIMIT = 1<<5, //!< whether the constraint has a drive force limit (which will be scaled by dt unless PxConstraintFlag::eLIMITS_ARE_FORCES is set) + eANGULAR_CONSTRAINT = 1<<6, //!< whether this is an angular or linear constraint + eDRIVE_ROW = 1<<7 //!< whether the constraint's geometric error should drive the target velocity + }; +}; + +typedef PxFlags Px1DConstraintFlags; +PX_FLAGS_OPERATORS(Px1DConstraintFlag::Type, PxU16) + +/** +\brief Constraint type hints which the solver uses to optimize constraint handling +*/ +struct PxConstraintSolveHint +{ + enum Enum + { + eNONE = 0, //!< no special properties + eACCELERATION1 = 256, //!< a group of acceleration drive constraints with the same stiffness and drive parameters + eSLERP_SPRING = 258, //!< temporary special value to identify SLERP drive rows + eACCELERATION2 = 512, //!< a group of acceleration drive constraints with the same stiffness and drive parameters + eACCELERATION3 = 768, //!< a group of acceleration drive constraints with the same stiffness and drive parameters + eROTATIONAL_EQUALITY = 1024, //!< rotational equality constraints with no force limit and no velocity target + eROTATIONAL_INEQUALITY = 1025, //!< rotational inequality constraints with (0, PX_MAX_FLT) force limits + eEQUALITY = 2048, //!< equality constraints with no force limit and no velocity target + eINEQUALITY = 2049 //!< inequality constraints with (0, PX_MAX_FLT) force limits + }; +}; + +/** +\brief A one-dimensional constraint + +A constraint is expressed as a set of 1-dimensional constraint rows which define the required constraint +on the objects' velocities. + +Each constraint is either a hard constraint or a spring. We define the velocity at the constraint to be +the quantity + + v = body0vel.dot(lin0,ang0) - body1vel.dot(lin1, ang1) + +For a hard constraint, the solver attempts to generate + +1. a set of velocities for the objects which, when integrated, respect the constraint errors: + + v + (geometricError / timestep) = velocityTarget + +2. a set of velocities for the objects which respect the constraints: + + v = velocityTarget + +Hard constraints support restitution: if the impact velocity exceeds the bounce threshold, then the target velocity +of the constraint will be set to restitution * -v + +Alternatively, the solver can attempt to resolve the velocity constraint as an implicit spring: + + F = stiffness * -geometricError + damping * (velocityTarget - v) + +where F is the constraint force or acceleration. Springs are fully implicit: that is, the force or acceleration +is a function of the position and velocity after the solve. + +All constraints support limits on the minimum or maximum impulse applied. +*/ + +PX_ALIGN_PREFIX(16) +struct PxSpringModifiers +{ + PxReal stiffness; //!< spring parameter, for spring constraints + PxReal damping; //!< damping parameter, for spring constraints +} +PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct PxRestitutionModifiers +{ + PxReal restitution; //!< restitution parameter for determining additional "bounce" + PxReal velocityThreshold; //!< minimum impact velocity for bounce +} +PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +union Px1DConstraintMods { + PxSpringModifiers spring; + PxRestitutionModifiers bounce; +} +PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Px1DConstraint +{ + PxVec3 linear0; //!< linear component of velocity jacobian in world space + PxReal geometricError; //!< geometric error of the constraint along this axis + PxVec3 angular0; //!< angular component of velocity jacobian in world space + PxReal velocityTarget; //!< velocity target for the constraint along this axis + + PxVec3 linear1; //!< linear component of velocity jacobian in world space + PxReal minImpulse; //!< minimum impulse the solver may apply to enforce this constraint + PxVec3 angular1; //!< angular component of velocity jacobian in world space + PxReal maxImpulse; //!< maximum impulse the solver may apply to enforce this constraint + + Px1DConstraintMods mods; + + PxReal forInternalUse; //!< for internal use only + PxU16 flags; //!< a set of Px1DConstraintFlags + PxU16 solveHint; //!< constraint optimization hint, should be an element of PxConstraintSolveHint +} +PX_ALIGN_SUFFIX(16); + +/** +\brief Flags for determining which components of the constraint should be visualized. + +@see PxConstraintVisualize +*/ +struct PxConstraintVisualizationFlag +{ + enum Enum + { + eLOCAL_FRAMES = 1, //!< visualize constraint frames + eLIMITS = 2 //!< visualize constraint limits + }; +}; + +/** +\brief Struct for specifying mass scaling for a pair of rigids +*/ +PX_ALIGN_PREFIX(16) +struct PxConstraintInvMassScale +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxReal linear0; //!< multiplier for inverse mass of body0 + PxReal angular0; //!< multiplier for inverse MoI of body0 + PxReal linear1; //!< multiplier for inverse mass of body1 + PxReal angular1; //!< multiplier for inverse MoI of body1 + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxConstraintInvMassScale(){} + PX_CUDA_CALLABLE PX_FORCE_INLINE PxConstraintInvMassScale(PxReal lin0, PxReal ang0, PxReal lin1, PxReal ang1) : linear0(lin0), angular0(ang0), linear1(lin1), angular1(ang1){} +} +PX_ALIGN_SUFFIX(16); + +/** +\brief Solver constraint generation shader + +This function is called by the constraint solver framework. The function must be reentrant, since it may be called simultaneously +from multiple threads, and should access only the arguments passed into it. + +Developers writing custom constraints are encouraged to read the documentation in the user guide and the implementation code in PhysXExtensions. + +\param[out] constraints An array of solver constraint rows to be filled in +\param[out] bodyAWorldOffset The origin point (offset from the position vector of bodyA's center of mass) at which the constraint is resolved. This value does not affect how constraints are solved, only the constraint force reported. +\param[in] maxConstraints The size of the constraint buffer. At most this many constraints rows may be written +\param[out] invMassScale The inverse mass and inertia scales for the constraint +\param[in] constantBlock The constant data block +\param[in] bodyAToWorld The center of mass frame of the first constrained body (the identity transform if the first actor is static, or if a NULL actor pointer was provided for it) +\param[in] bodyBToWorld The center of mass frame of the second constrained body (the identity transform if the second actor is static, or if a NULL actor pointer was provided for it) +\param[in] useExtendedLimits Enables limit ranges outside of (-PI, PI) +\param[out] cAtW The world space location of body A's joint frame (position only) +\param[out] cBtW The world space location of body B's joint frame (position only) + +\return the number of constraint rows written. +*/ +typedef PxU32 (*PxConstraintSolverPrep)(Px1DConstraint* constraints, + PxVec3p& bodyAWorldOffset, + PxU32 maxConstraints, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bodyAToWorld, + const PxTransform& bodyBToWorld, + bool useExtendedLimits, + PxVec3p& cAtW, + PxVec3p& cBtW); + +/** +\brief Solver constraint projection shader + +This function is called by the constraint post-solver framework. The function must be reentrant, since it may be called simultaneously +from multiple threads and should access only the arguments passed into it. + +\param[in] constantBlock The constant data block +\param[out] bodyAToWorld The center of mass frame of the first constrained body (the identity if the actor is static or a NULL pointer was provided for it) +\param[out] bodyBToWorld The center of mass frame of the second constrained body (the identity if the actor is static or a NULL pointer was provided for it) +\param[in] projectToA True if the constraint should be projected by moving the second body towards the first, false if the converse + +@deprecated +*/ +typedef PX_DEPRECATED void (*PxConstraintProject)(const void* constantBlock, + PxTransform& bodyAToWorld, + PxTransform& bodyBToWorld, + bool projectToA); + +/** +\brief API used to visualize details about a constraint. +*/ +class PxConstraintVisualizer +{ +protected: + virtual ~PxConstraintVisualizer(){} +public: + /** \brief Visualize joint frames + + \param[in] parent Parent transformation + \param[in] child Child transformation + */ + virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) = 0; + + /** \brief Visualize joint linear limit + + \param[in] t0 Base transformation + \param[in] t1 End transformation + \param[in] value Distance + \param[in] active State of the joint - active/inactive + */ + virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, PxReal value, bool active) = 0; + + /** \brief Visualize joint angular limit + + \param[in] t0 Transformation for the visualization + \param[in] lower Lower limit angle + \param[in] upper Upper limit angle + \param[in] active State of the joint - active/inactive + */ + virtual void visualizeAngularLimit(const PxTransform& t0, PxReal lower, PxReal upper, bool active) = 0; + + /** \brief Visualize limit cone + + \param[in] t Transformation for the visualization + \param[in] tanQSwingY Tangent of the quarter Y angle + \param[in] tanQSwingZ Tangent of the quarter Z angle + \param[in] active State of the joint - active/inactive + */ + virtual void visualizeLimitCone(const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ, bool active) = 0; + + /** \brief Visualize joint double cone + + \param[in] t Transformation for the visualization + \param[in] angle Limit angle + \param[in] active State of the joint - active/inactive + */ + virtual void visualizeDoubleCone(const PxTransform& t, PxReal angle, bool active) = 0; + + /** \brief Visualize line + + \param[in] p0 Start position + \param[in] p1 End postion + \param[in] color Color + */ + virtual void visualizeLine(const PxVec3& p0, const PxVec3& p1, PxU32 color) = 0; +}; + +/** \brief Solver constraint visualization function + +This function is called by the constraint post-solver framework to visualize the constraint + +\param[out] visualizer The render buffer to render to +\param[in] constantBlock The constant data block +\param[in] body0Transform The center of mass frame of the first constrained body (the identity if the actor is static, or a NULL pointer was provided for it) +\param[in] body1Transform The center of mass frame of the second constrained body (the identity if the actor is static, or a NULL pointer was provided for it) +\param[in] flags The visualization flags (PxConstraintVisualizationFlag) + +@see PxRenderBuffer +*/ +typedef void (*PxConstraintVisualize)(PxConstraintVisualizer& visualizer, + const void* constantBlock, + const PxTransform& body0Transform, + const PxTransform& body1Transform, + PxU32 flags); + +/** +\brief Flags for determining how PVD should serialize a constraint update + +@see PxConstraintConnector::updatePvdProperties, PvdSceneClient::updateConstraint +*/ +struct PxPvdUpdateType +{ + enum Enum + { + CREATE_INSTANCE, //!< triggers createPvdInstance call, creates an instance of a constraint + RELEASE_INSTANCE, //!< triggers releasePvdInstance call, releases an instance of a constraint + UPDATE_ALL_PROPERTIES, //!< triggers updatePvdProperties call, updates all properties of a constraint + UPDATE_SIM_PROPERTIES //!< triggers simUpdate call, updates all simulation properties of a constraint + }; +}; + +/** +\brief This class connects a custom constraint to the SDK + +This class connects a custom constraint to the SDK, and functions are called by the SDK +to query the custom implementation for specific information to pass on to the application +or inform the constraint when the application makes calls into the SDK which will update +the custom constraint's internal implementation +*/ +class PxConstraintConnector +{ +public: + /** \brief Pre-simulation data preparation + when the constraint is marked dirty, this function is called at the start of the simulation + step for the SDK to copy the constraint data block. + */ + virtual void* prepareData() = 0; + + /** + \brief this function is called by the SDK to update PVD's view of it + */ + PX_DEPRECATED virtual bool updatePvdProperties(physx::pvdsdk::PvdDataStream& pvdConnection, + const PxConstraint* c, + PxPvdUpdateType::Enum updateType) const = 0; + + /** + \brief this function is called by the SDK to update OmniPVD's view of it + */ + PX_DEPRECATED virtual void updateOmniPvdProperties() const = 0; + + /** + \brief Constraint release callback + + When the SDK deletes a PxConstraint object this function is called by the SDK. In general + custom constraints should not be deleted directly by applications: rather, the constraint + should respond to a release() request by calling PxConstraint::release(), then wait for + this call to release its own resources. + + This function is also called when a PxConstraint object is deleted on cleanup due to + destruction of the PxPhysics object. + */ + virtual void onConstraintRelease() = 0; + + /** + \brief Center-of-mass shift callback + + This function is called by the SDK when the CoM of one of the actors is moved. Since the + API specifies constraint positions relative to actors, and the constraint shader functions + are supplied with coordinates relative to bodies, some synchronization is usually required + when the application moves an object's center of mass. + */ + virtual void onComShift(PxU32 actor) = 0; + + /** + \brief Origin shift callback + + This function is called by the SDK when the scene origin gets shifted and allows to adjust + custom data which contains world space transforms. + + \note If the adjustments affect constraint shader data, it is necessary to call PxConstraint::markDirty() + to make sure that the data gets synced at the beginning of the next simulation step. + + \param[in] shift Translation vector the origin is shifted by. + + @see PxScene.shiftOrigin() + */ + virtual void onOriginShift(const PxVec3& shift) = 0; + + /** + \brief Fetches external data for a constraint. + + This function is used by the SDK to acquire a reference to the owner of a constraint and a unique + owner type ID. This information will be passed on when a breakable constraint breaks or when + #PxConstraint::getExternalReference() is called. + + \param[out] typeID Unique type identifier of the external object. The value 0xffffffff is reserved and should not be used. Furthermore, if the PhysX extensions library is used, some other IDs are reserved already (see PxConstraintExtIDs) + \return Reference to the external object which owns the constraint. + + @see PxConstraintInfo PxSimulationEventCallback.onConstraintBreak() + */ + PX_DEPRECATED virtual void* getExternalReference(PxU32& typeID) = 0; + + /** + \brief Obtain a reference to a PxBase interface if the constraint has one. + + If the constraint does not implement the PxBase interface, it should return NULL. + */ + virtual PxBase* getSerializable() = 0; + + /** + \brief Obtain the shader function pointer used to prep rows for this constraint + */ + PX_DEPRECATED virtual PxConstraintSolverPrep getPrep() const = 0; + + /** + \brief Obtain the pointer to the constraint's constant data + */ + virtual const void* getConstantBlock() const = 0; + + /** + \brief Let the connector know it has been connected to a constraint. + */ + virtual void connectToConstraint(PxConstraint*) {} + + /** + \brief virtual destructor + */ + virtual ~PxConstraintConnector() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxContact.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxContact.h new file mode 100644 index 0000000..aa90fd1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxContact.h @@ -0,0 +1,676 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTACT_H +#define PX_CONTACT_H + +/** \addtogroup physics + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxAssert.h" +#include "PxNodeIndex.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +#define PXC_CONTACT_NO_FACE_INDEX 0xffffffff + +class PxActor; + +/** +\brief Struct for specifying mass modification for a pair of rigids +\deprecated Use #PxConstraintInvMassScale instead. Deprecated since PhysX version 5.1. +*/ +PX_ALIGN_PREFIX(16) +struct PxMassModificationProps +{ + PxReal mInvMassScale0; + PxReal mInvInertiaScale0; + PxReal mInvMassScale1; + PxReal mInvInertiaScale1; +} +PX_ALIGN_SUFFIX(16); + +/** +\brief Header for a contact patch where all points share same material and normal +*/ +PX_ALIGN_PREFIX(16) +struct PxContactPatch +{ + enum PxContactPatchFlags + { + eHAS_FACE_INDICES = 1, //!< Indicates this contact stream has face indices. + eMODIFIABLE = 2, //!< Indicates this contact stream is modifiable. + eFORCE_NO_RESPONSE = 4, //!< Indicates this contact stream is notify-only (no contact response). + eHAS_MODIFIED_MASS_RATIOS = 8, //!< Indicates this contact stream has modified mass ratios + eHAS_TARGET_VELOCITY = 16, //!< Indicates this contact stream has target velocities set + eHAS_MAX_IMPULSE = 32, //!< Indicates this contact stream has max impulses set + eREGENERATE_PATCHES = 64, //!< Indicates this contact stream needs patches re-generated. This is required if the application modified either the contact normal or the material properties + eCOMPRESSED_MODIFIED_CONTACT = 128 + }; + + /** + \brief Modifiers for scaling the inertia of the involved bodies + */ + PX_ALIGN(16, PxMassModificationProps mMassModification); //16 + + /** + \brief Contact normal + */ + PX_ALIGN(16, PxVec3 normal); //28 + + /** + \brief Restitution coefficient + */ + PxReal restitution; //32 + + /** + \brief Dynamic friction coefficient + */ + PxReal dynamicFriction; //36 + + /** + \brief Static friction coefficient + */ + PxReal staticFriction; //40 + + /** + \brief Damping coefficient (for compliant contacts) + */ + PxReal damping; //44 + + /** + \brief Index of the first contact in the patch + */ + PxU16 startContactIndex; //46 + + /** + \brief The number of contacts in this patch + */ + PxU8 nbContacts; //47 //Can be a U8 + + /** + \brief The combined material flag of two actors that come in contact + @see PxMaterialFlag, PxCombineMode + */ + PxU8 materialFlags; //48 //Can be a U16 + + /** + \brief The PxContactPatchFlags for this patch + */ + PxU16 internalFlags; //50 //Can be a U16 + + /** + \brief Material index of first body + */ + PxU16 materialIndex0; //52 //Can be a U16 + + /** + \brief Material index of second body + */ + PxU16 materialIndex1; //54 //Can be a U16 + + PxU16 pad[5]; //64 +} +PX_ALIGN_SUFFIX(16); + +/** +\brief Contact point data +*/ +PX_ALIGN_PREFIX(16) +struct PxContact +{ + /** + \brief Contact point in world space + */ + PxVec3 contact; //12 + /** + \brief Separation value (negative implies penetration). + */ + PxReal separation; //16 +} +PX_ALIGN_SUFFIX(16); + +/** +\brief Contact point data with additional target and max impulse values +*/ +PX_ALIGN_PREFIX(16) +struct PxExtendedContact : public PxContact +{ + /** + \brief Target velocity + */ + PX_ALIGN(16, PxVec3 targetVelocity); //28 + /** + \brief Maximum impulse + */ + PxReal maxImpulse; //32 +} +PX_ALIGN_SUFFIX(16); + +/** +\brief A modifiable contact point. This has additional fields per-contact to permit modification by user. +\note Not all fields are currently exposed to the user. +*/ +PX_ALIGN_PREFIX(16) +struct PxModifiableContact : public PxExtendedContact +{ + /** + \brief Contact normal + */ + PX_ALIGN(16, PxVec3 normal); //44 + /** + \brief Restitution coefficient + */ + PxReal restitution; //48 + + /** + \brief Material Flags + */ + PxU32 materialFlags; //52 + + /** + \brief Shape A's material index + */ + PxU16 materialIndex0; //54 + /** + \brief Shape B's material index + */ + PxU16 materialIndex1; //56 + /** + \brief static friction coefficient + */ + PxReal staticFriction; //60 + /** + \brief dynamic friction coefficient + */ + PxReal dynamicFriction; //64 +} +PX_ALIGN_SUFFIX(16); + +/** +\brief A class to iterate over a compressed contact stream. This supports read-only access to the various contact formats. +*/ +struct PxContactStreamIterator +{ + enum StreamFormat + { + eSIMPLE_STREAM, + eMODIFIABLE_STREAM, + eCOMPRESSED_MODIFIABLE_STREAM + }; + /** + \brief Utility zero vector to optimize functions returning zero vectors when a certain flag isn't set. + \note This allows us to return by reference instead of having to return by value. Returning by value will go via memory (registers -> stack -> registers), which can + cause performance issues on certain platforms. + */ + PxVec3 zero; + + /** + \brief The patch headers. + */ + const PxContactPatch* patch; + + /** + \brief The contacts + */ + const PxContact* contact; + + /** + \brief The contact triangle face index + */ + const PxU32* faceIndice; + + /** + \brief The total number of patches in this contact stream + */ + PxU32 totalPatches; + + /** + \brief The total number of contact points in this stream + */ + PxU32 totalContacts; + + /** + \brief The current contact index + */ + PxU32 nextContactIndex; + + /** + \brief The current patch Index + */ + PxU32 nextPatchIndex; + + /** + \brief Size of contact patch header + \note This varies whether the patch is modifiable or not. + */ + PxU32 contactPatchHeaderSize; + + /** + \brief Contact point size + \note This varies whether the patch has feature indices or is modifiable. + */ + PxU32 contactPointSize; + + /** + \brief The stream format + */ + StreamFormat mStreamFormat; + + /** + \brief Indicates whether this stream is notify-only or not. + */ + PxU32 forceNoResponse; + + /** + \brief Internal helper for stepping the contact stream iterator + */ + bool pointStepped; + + /** + \brief Specifies if this contactPatch has face indices (handled as bool) + @see faceIndice + */ + PxU32 hasFaceIndices; + + /** + \brief Constructor + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxContactStreamIterator(const PxU8* contactPatches, const PxU8* contactPoints, const PxU32* contactFaceIndices, PxU32 nbPatches, PxU32 nbContacts) + : zero(0.f) + { + bool modify = false; + bool compressedModify = false; + bool response = false; + bool indices = false; + + PxU32 pointSize = 0; + PxU32 patchHeaderSize = sizeof(PxContactPatch); + + const PxContactPatch* patches = reinterpret_cast(contactPatches); + + if(patches) + { + modify = (patches->internalFlags & PxContactPatch::eMODIFIABLE) != 0; + compressedModify = (patches->internalFlags & PxContactPatch::eCOMPRESSED_MODIFIED_CONTACT) != 0; + indices = (patches->internalFlags & PxContactPatch::eHAS_FACE_INDICES) != 0; + + patch = patches; + + contact = reinterpret_cast(contactPoints); + + faceIndice = contactFaceIndices; + + pointSize = compressedModify ? sizeof(PxExtendedContact) : modify ? sizeof(PxModifiableContact) : sizeof(PxContact); + + response = (patch->internalFlags & PxContactPatch::eFORCE_NO_RESPONSE) == 0; + } + + + mStreamFormat = compressedModify ? eCOMPRESSED_MODIFIABLE_STREAM : modify ? eMODIFIABLE_STREAM : eSIMPLE_STREAM; + hasFaceIndices = PxU32(indices); + forceNoResponse = PxU32(!response); + + contactPatchHeaderSize = patchHeaderSize; + contactPointSize = pointSize; + nextPatchIndex = 0; + nextContactIndex = 0; + totalContacts = nbContacts; + totalPatches = nbPatches; + + pointStepped = false; + } + + /** + \brief Returns whether there are more patches in this stream. + \return Whether there are more patches in this stream. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextPatch() const + { + return nextPatchIndex < totalPatches; + } + + /** + \brief Returns the total contact count. + \return Total contact count. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getTotalContactCount() const + { + return totalContacts; + } + + /** + \brief Returns the total patch count. + \return Total patch count. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getTotalPatchCount() const + { + return totalPatches; + } + + /** + \brief Advances iterator to next contact patch. + */ + PX_CUDA_CALLABLE PX_INLINE void nextPatch() + { + PX_ASSERT(nextPatchIndex < totalPatches); + if(nextPatchIndex) + { + if(nextContactIndex < patch->nbContacts) + { + PxU32 nbToStep = patch->nbContacts - this->nextContactIndex; + contact = reinterpret_cast(reinterpret_cast(contact) + contactPointSize * nbToStep); + } + patch = reinterpret_cast(reinterpret_cast(patch) + contactPatchHeaderSize); + } + nextPatchIndex++; + nextContactIndex = 0; + } + + /** + \brief Returns if the current patch has more contacts. + \return If there are more contacts in the current patch. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNextContact() const + { + return nextContactIndex < (patch->nbContacts); + } + + /** + \brief Advances to the next contact in the patch. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void nextContact() + { + PX_ASSERT(nextContactIndex < patch->nbContacts); + if(pointStepped) + { + contact = reinterpret_cast(reinterpret_cast(contact) + contactPointSize); + faceIndice++; + } + nextContactIndex++; + pointStepped = true; + } + + /** + \brief Gets the current contact's normal + \return The current contact's normal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getContactNormal() const + { + return getContactPatch().normal; + } + + /** + \brief Gets the inverse mass scale for body 0. + \return The inverse mass scale for body 0. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getInvMassScale0() const + { + return patch->mMassModification.mInvMassScale0; + } + + /** + \brief Gets the inverse mass scale for body 1. + \return The inverse mass scale for body 1. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getInvMassScale1() const + { + return patch->mMassModification.mInvMassScale1; + } + + /** + \brief Gets the inverse inertia scale for body 0. + \return The inverse inertia scale for body 0. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getInvInertiaScale0() const + { + return patch->mMassModification.mInvInertiaScale0; + } + + /** + \brief Gets the inverse inertia scale for body 1. + \return The inverse inertia scale for body 1. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getInvInertiaScale1() const + { + return patch->mMassModification.mInvInertiaScale1; + } + + /** + \brief Gets the contact's max impulse. + \return The contact's max impulse. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getMaxImpulse() const + { + return mStreamFormat != eSIMPLE_STREAM ? getExtendedContact().maxImpulse : PX_MAX_REAL; + } + + /** + \brief Gets the contact's target velocity. + \return The contact's target velocity. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getTargetVel() const + { + return mStreamFormat != eSIMPLE_STREAM ? getExtendedContact().targetVelocity : zero; + } + + /** + \brief Gets the contact's contact point. + \return The contact's contact point. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& getContactPoint() const + { + return contact->contact; + } + + /** + \brief Gets the contact's separation. + \return The contact's separation. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getSeparation() const + { + return contact->separation; + } + + /** + \brief Gets the contact's face index for shape 0. + \return The contact's face index for shape 0. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getFaceIndex0() const + { + return PXC_CONTACT_NO_FACE_INDEX; + } + + /** + \brief Gets the contact's face index for shape 1. + \return The contact's face index for shape 1. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getFaceIndex1() const + { + return hasFaceIndices ? *faceIndice : PXC_CONTACT_NO_FACE_INDEX; + } + + /** + \brief Gets the contact's static friction coefficient. + \return The contact's static friction coefficient. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getStaticFriction() const + { + return getContactPatch().staticFriction; + } + + /** + \brief Gets the contact's dynamic friction coefficient. + \return The contact's dynamic friction coefficient. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getDynamicFriction() const + { + return getContactPatch().dynamicFriction; + } + + /** + \brief Gets the contact's restitution coefficient. + \return The contact's restitution coefficient. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getRestitution() const + { + return getContactPatch().restitution; + } + + /** + \brief Gets the contact's damping value. + \return The contact's damping value. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getDamping() const + { + return getContactPatch().damping; + } + + /** + \brief Gets the contact's material flags. + \return The contact's material flags. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMaterialFlags() const + { + return getContactPatch().materialFlags; + } + + /** + \brief Gets the contact's material index for shape 0. + \return The contact's material index for shape 0. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 getMaterialIndex0() const + { + return PxU16(getContactPatch().materialIndex0); + } + + /** + \brief Gets the contact's material index for shape 1. + \return The contact's material index for shape 1. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 getMaterialIndex1() const + { + return PxU16(getContactPatch().materialIndex1); + } + + /** + \brief Advances the contact stream iterator to a specific contact index. + \return True if advancing was possible + */ + bool advanceToIndex(const PxU32 initialIndex) + { + PX_ASSERT(this->nextPatchIndex == 0 && this->nextContactIndex == 0); + + PxU32 numToAdvance = initialIndex; + + if(numToAdvance == 0) + { + PX_ASSERT(hasNextPatch()); + nextPatch(); + return true; + } + + while(numToAdvance) + { + while(hasNextPatch()) + { + nextPatch(); + PxU32 patchSize = patch->nbContacts; + if(numToAdvance <= patchSize) + { + contact = reinterpret_cast(reinterpret_cast(contact) + contactPointSize * numToAdvance); + nextContactIndex += numToAdvance; + return true; + } + else + { + numToAdvance -= patchSize; + } + } + } + return false; + } + +private: + + /** + \brief Internal helper + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxContactPatch& getContactPatch() const + { + return *static_cast(patch); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxExtendedContact& getExtendedContact() const + { + PX_ASSERT(mStreamFormat == eMODIFIABLE_STREAM || mStreamFormat == eCOMPRESSED_MODIFIABLE_STREAM); + return *static_cast(contact); + } + +}; + +/** +\brief Contains contact information for a contact reported by the direct-GPU contact report API. See PxScene::copyContactData(). +*/ +struct PxGpuContactPair +{ + PxU8* contactPatches; //!< Ptr to contact patches. Type: PxContactPatch*, size: nbPatches. + PxU8* contactPoints; //!< Ptr to contact points. Type: PxContact*, size: nbContacts. + PxReal* contactForces; //!< Ptr to contact forces. Size: nbContacts. + PxU32 transformCacheRef0; //!< Ref to shape0's transform in transform cache. + PxU32 transformCacheRef1; //!< Ref to shape1's transform in transform cache. + PxNodeIndex nodeIndex0; //!< Unique Id for actor0 if the actor is dynamic. + PxNodeIndex nodeIndex1; //!< Unique Id for actor1 if the actor is dynamic. + PxActor* actor0; //!< Ptr to PxActor for actor0. + PxActor* actor1; //!< Ptr to PxActor for actor1. + + PxU16 nbContacts; //!< Num contacts. + PxU16 nbPatches; //!< Num patches. +}; + + +#if PX_VC +#pragma warning(pop) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxContactModifyCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxContactModifyCallback.h new file mode 100644 index 0000000..6087d08 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxContactModifyCallback.h @@ -0,0 +1,526 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTACT_MODIFY_CALLBACK_H +#define PX_CONTACT_MODIFY_CALLBACK_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxShape.h" +#include "PxContact.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; + +/** +\brief An array of contact points, as passed to contact modification. + +The word 'set' in the name does not imply that duplicates are filtered in any +way. This initial set of contacts does potentially get reduced to a smaller +set before being passed to the solver. + +You can use the accessors to read and write contact properties. The number of +contacts is immutable, other than being able to disable contacts using ignore(). + +@see PxContactModifyCallback, PxModifiableContact +*/ +class PxContactSet +{ +public: + /** + \brief Get the position of a specific contact point in the set. + \param[in] i Index of the point in the set + \return Position to the requested point in world space + + @see PxModifiableContact.point + */ + PX_FORCE_INLINE const PxVec3& getPoint(PxU32 i) const { return mContacts[i].contact; } + + /** + \brief Alter the position of a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] p The new position in world space + + @see PxModifiableContact.point + */ + PX_FORCE_INLINE void setPoint(PxU32 i, const PxVec3& p) { mContacts[i].contact = p; } + + /** + \brief Get the contact normal of a specific contact point in the set. + \param[in] i Index of the point in the set + \return The requested normal in world space + + @see PxModifiableContact.normal + */ + PX_FORCE_INLINE const PxVec3& getNormal(PxU32 i) const { return mContacts[i].normal; } + + /** + \brief Alter the contact normal of a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] n The new normal in world space + + \note Changing the normal can cause contact points to be ignored. + + @see PxModifiableContact.normal + */ + PX_FORCE_INLINE void setNormal(PxU32 i, const PxVec3& n) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].normal = n; + } + + /** + \brief Get the separation distance of a specific contact point in the set. + \param[in] i Index of the point in the set + \return The separation. Negative implies penetration. + + @see PxModifiableContact.separation + */ + PX_FORCE_INLINE PxReal getSeparation(PxU32 i) const { return mContacts[i].separation; } + + /** + \brief Alter the separation of a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] s The new separation + + @see PxModifiableContact.separation + */ + PX_FORCE_INLINE void setSeparation(PxU32 i, PxReal s) { mContacts[i].separation = s; } + + /** + \brief Get the target velocity of a specific contact point in the set. + \param[in] i Index of the point in the set + \return The target velocity in world frame + + @see PxModifiableContact.targetVelocity + + */ + PX_FORCE_INLINE const PxVec3& getTargetVelocity(PxU32 i) const { return mContacts[i].targetVelocity; } + + /** + \brief Alter the target velocity of a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] v The new velocity in world frame + + @see PxModifiableContact.targetVelocity + */ + PX_FORCE_INLINE void setTargetVelocity(PxU32 i, const PxVec3& v) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eHAS_TARGET_VELOCITY; + mContacts[i].targetVelocity = v; + } + + /** + \brief Get the face index with respect to the first shape of the pair for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The face index of the first shape + \note At the moment, the first shape is never a tri-mesh, therefore this function always returns PXC_CONTACT_NO_FACE_INDEX + + @see PxModifiableContact.internalFaceIndex0 + */ + PX_FORCE_INLINE PxU32 getInternalFaceIndex0(PxU32 i) const { PX_UNUSED(i); return PXC_CONTACT_NO_FACE_INDEX; } + + /** + \brief Get the face index with respect to the second shape of the pair for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The face index of the second shape + + @see PxModifiableContact.internalFaceIndex1 + */ + PX_FORCE_INLINE PxU32 getInternalFaceIndex1(PxU32 i) const + { + PxContactPatch* patch = getPatch(); + if (patch->internalFlags & PxContactPatch::eHAS_FACE_INDICES) + { + return reinterpret_cast(mContacts + mCount)[mCount + i]; + } + return PXC_CONTACT_NO_FACE_INDEX; + } + + /** + \brief Get the maximum impulse for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The maximum impulse + + @see PxModifiableContact.maxImpulse + */ + PX_FORCE_INLINE PxReal getMaxImpulse(PxU32 i) const { return mContacts[i].maxImpulse; } + + /** + \brief Alter the maximum impulse for a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] s The new maximum impulse + + \note Must be nonnegative. If set to zero, the contact point will be ignored + + @see PxModifiableContact.maxImpulse, ignore() + */ + PX_FORCE_INLINE void setMaxImpulse(PxU32 i, PxReal s) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eHAS_MAX_IMPULSE; + mContacts[i].maxImpulse = s; + } + + /** + \brief Get the restitution coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The restitution coefficient + + @see PxModifiableContact.restitution + */ + PX_FORCE_INLINE PxReal getRestitution(PxU32 i) const { return mContacts[i].restitution; } + + /** + \brief Alter the restitution coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] r The new restitution coefficient + + \note Valid ranges [0,1] + + @see PxModifiableContact.restitution + */ + PX_FORCE_INLINE void setRestitution(PxU32 i, PxReal r) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].restitution = r; + } + + /** + \brief Get the static friction coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The friction coefficient (dimensionless) + + @see PxModifiableContact.staticFriction + */ + PX_FORCE_INLINE PxReal getStaticFriction(PxU32 i) const { return mContacts[i].staticFriction; } + + /** + \brief Alter the static friction coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] f The new friction coefficient (dimensionless), range [0, inf] + + @see PxModifiableContact.staticFriction + */ + PX_FORCE_INLINE void setStaticFriction(PxU32 i, PxReal f) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].staticFriction = f; + } + + /** + \brief Get the static friction coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \return The friction coefficient + + @see PxModifiableContact.dynamicFriction + */ + PX_FORCE_INLINE PxReal getDynamicFriction(PxU32 i) const { return mContacts[i].dynamicFriction; } + + /** + \brief Alter the static dynamic coefficient for a specific contact point in the set. + \param[in] i Index of the point in the set + \param[in] f The new friction coefficient + + @see PxModifiableContact.dynamicFriction + */ + PX_FORCE_INLINE void setDynamicFriction(PxU32 i, PxReal f) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].dynamicFriction = f; + } + + /** + \brief Ignore the contact point. + \param[in] i Index of the point in the set + + If a contact point is ignored then no force will get applied at this point. This can be used to disable collision in certain areas of a shape, for example. + */ + PX_FORCE_INLINE void ignore(PxU32 i) { setMaxImpulse(i, 0.0f); } + + /** + \brief The number of contact points in the set. + */ + PX_FORCE_INLINE PxU32 size() const { return mCount; } + + /** + \brief Returns the invMassScale of body 0 + + A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + */ + PX_FORCE_INLINE PxReal getInvMassScale0() const + { + PxContactPatch* patch = getPatch(); + return patch->mMassModification.mInvMassScale0; + } + + /** + \brief Returns the invMassScale of body 1 + + A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + */ + PX_FORCE_INLINE PxReal getInvMassScale1() const + { + PxContactPatch* patch = getPatch(); + return patch->mMassModification.mInvMassScale1; + } + + /** + \brief Returns the invInertiaScale of body 0 + + A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + */ + PX_FORCE_INLINE PxReal getInvInertiaScale0() const + { + PxContactPatch* patch = getPatch(); + return patch->mMassModification.mInvInertiaScale0; + } + + /** + \brief Returns the invInertiaScale of body 1 + + A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + */ + PX_FORCE_INLINE PxReal getInvInertiaScale1() const + { + PxContactPatch* patch = getPatch(); + return patch->mMassModification.mInvInertiaScale1; + } + + /** + \brief Sets the invMassScale of body 0 + \param[in] scale The new scale + + This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + */ + PX_FORCE_INLINE void setInvMassScale0(const PxReal scale) + { + PxContactPatch* patch = getPatch(); + patch->mMassModification.mInvMassScale0 = scale; + patch->internalFlags |= PxContactPatch::eHAS_MODIFIED_MASS_RATIOS; + } + + /** + \brief Sets the invMassScale of body 1 + \param[in] scale The new scale + + This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + */ + PX_FORCE_INLINE void setInvMassScale1(const PxReal scale) + { + PxContactPatch* patch = getPatch(); + patch->mMassModification.mInvMassScale1 = scale; + patch->internalFlags |= PxContactPatch::eHAS_MODIFIED_MASS_RATIOS; + } + + /** + \brief Sets the invInertiaScale of body 0 + \param[in] scale The new scale + + This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + */ + PX_FORCE_INLINE void setInvInertiaScale0(const PxReal scale) + { + PxContactPatch* patch = getPatch(); + patch->mMassModification.mInvInertiaScale0 = scale; + patch->internalFlags |= PxContactPatch::eHAS_MODIFIED_MASS_RATIOS; + } + + /** + \brief Sets the invInertiaScale of body 1 + \param[in] scale The new scale + + This can be set to any value in the range [0, PX_MAX_F32). A value < 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + */ + PX_FORCE_INLINE void setInvInertiaScale1(const PxReal scale) + { + PxContactPatch* patch = getPatch(); + patch->mMassModification.mInvInertiaScale1 = scale; + patch->internalFlags |= PxContactPatch::eHAS_MODIFIED_MASS_RATIOS; + } + +protected: + + PX_FORCE_INLINE PxContactPatch* getPatch() const + { + const size_t headerOffset = sizeof(PxContactPatch)*mCount; + return reinterpret_cast(reinterpret_cast(mContacts) - headerOffset); + } + + PxU32 mCount; //!< Number of contact points in the set + PxModifiableContact* mContacts; //!< The contact points of the set +}; + + + +/** +\brief An array of instances of this class is passed to PxContactModifyCallback::onContactModify(). + +@see PxContactModifyCallback +*/ + +class PxContactModifyPair +{ +public: + + /** + \brief The actors which make up the pair in contact. + + Note that these are the actors as seen by the simulation, and may have been deleted since the simulation step started. + */ + const PxRigidActor* actor[2]; + + /** + \brief The shapes which make up the pair in contact. + + Note that these are the shapes as seen by the simulation, and may have been deleted since the simulation step started. + */ + const PxShape* shape[2]; + + /** + \brief The shape to world transforms of the two shapes. + + These are the transforms as the simulation engine sees them, and may have been modified by the application + since the simulation step started. + */ + PxTransform transform[2]; + + /** + \brief An array of contact points between these two shapes. + */ + PxContactSet contacts; +}; + + +/** +\brief An interface class that the user can implement in order to modify contact constraints. + +Threading: It is necessary to make this class thread safe as it will be called in the context of the +simulation thread. It might also be necessary to make it reentrant, since some calls can be made by multi-threaded +parts of the physics engine. + +You can enable the use of this contact modification callback by raising the flag PxPairFlag::eMODIFY_CONTACTS in +the filter shader/callback (see #PxSimulationFilterShader) for a pair of rigid body objects. + +Please note: ++ Raising the contact modification flag will not wake the actors up automatically. ++ It is not possible to turn off the performance degradation by simply removing the callback from the scene, the + filter shader/callback has to be used to clear the contact modification flag. ++ The contacts will only be reported as long as the actors are awake. There will be no callbacks while the actors are sleeping. + +@see PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() +*/ +class PxContactModifyCallback +{ +public: + + /** + \brief Passes modifiable arrays of contacts to the application. + + The initial contacts are regenerated from scratch each frame by collision detection. + + The number of contacts can not be changed, so you cannot add your own contacts. You may however + disable contacts using PxContactSet::ignore(). + + \param[in,out] pairs The contact pairs that may be modified + \param[in] count Number of contact pairs + + @see PxContactModifyPair + */ + virtual void onContactModify(PxContactModifyPair* const pairs, PxU32 count) = 0; + +protected: + virtual ~PxContactModifyCallback(){} +}; + +/** +\brief An interface class that the user can implement in order to modify CCD contact constraints. + +Threading: It is necessary to make this class thread safe as it will be called in the context of the +simulation thread. It might also be necessary to make it reentrant, since some calls can be made by multi-threaded +parts of the physics engine. + +You can enable the use of this contact modification callback by raising the flag PxPairFlag::eMODIFY_CONTACTS in +the filter shader/callback (see #PxSimulationFilterShader) for a pair of rigid body objects. + +Please note: ++ Raising the contact modification flag will not wake the actors up automatically. ++ It is not possible to turn off the performance degradation by simply removing the callback from the scene, the + filter shader/callback has to be used to clear the contact modification flag. ++ The contacts will only be reported as long as the actors are awake. There will be no callbacks while the actors are sleeping. + +@see PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() +*/ +class PxCCDContactModifyCallback +{ +public: + + /** + \brief Passes modifiable arrays of contacts to the application. + + The initial contacts are regenerated from scratch each frame by collision detection. + + The number of contacts can not be changed, so you cannot add your own contacts. You may however + disable contacts using PxContactSet::ignore(). + + \param[in,out] pairs The contact pairs that may be modified + \param[in] count Number of contact pairs + */ + virtual void onCCDContactModify(PxContactModifyPair* const pairs, PxU32 count) = 0; + +protected: + virtual ~PxCCDContactModifyCallback(){} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxCustomParticleSystemSolverCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxCustomParticleSystemSolverCallback.h new file mode 100644 index 0000000..be66d7f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxCustomParticleSystemSolverCallback.h @@ -0,0 +1,105 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CUSTOM_PARTICLE_SYSTEM_SOLVER_CALLBACK_H +#define PX_CUSTOM_PARTICLE_SYSTEM_SOLVER_CALLBACK_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" +#include "cudamanager/PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + +class PxGpuParticleSystem; + + +class PxCustomParticleSystemSolverCallback +{ +public: + /** + \brief callback called when the particle solver begins. + + This is called once per frame. It occurs after external forces have been pre-integrated into the particle state. + It is called prior to the particles being reordered by spatial hash index, so state can be accessed in the unsorted buffers only at this stage. This provides an opportunity to add custom + forces and modifications to position or velocity. + + \param [in] gpuParticleSystem A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory. + \param [in] dt The time-step. + \param [in] stream The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions. + */ + virtual void onBegin(PxGpuParticleSystem* gpuParticleSystem, PxReal dt, CUstream stream) = 0; + + /** + \brief callback called during the iterative particle solve stage. + + This callback will potentially be called multiple times between onBegin and onFinalize. + + \param [in] gpuParticleSystem A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory. + \param [in] dt The time-step. + \param [in] stream The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions. + */ + virtual void onSolve(PxGpuParticleSystem* gpuParticleSystem, PxReal dt, CUstream stream) = 0; + + /** + \brief callback called after all solver iterations have completed. + + This callback will be called once per frame, after integration has completed. + + \param [in] gpuParticleSystem A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory. + \param [in] dt The time-step. + \param [in] stream The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions. + */ + virtual void onFinalize(PxGpuParticleSystem* gpuParticleSystem, PxReal dt, CUstream stream) = 0; + + /** + \brief Destructor + */ + virtual ~PxCustomParticleSystemSolverCallback() {} +}; + + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxDeletionListener.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxDeletionListener.h new file mode 100644 index 0000000..310f583 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxDeletionListener.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DELETION_LISTENER_H +#define PX_DELETION_LISTENER_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief Flags specifying deletion event types. + +@see PxDeletionListener::onRelease PxPhysics.registerDeletionListener() +*/ +struct PxDeletionEventFlag +{ + enum Enum + { + eUSER_RELEASE = (1<<0), //!< The user has called release on an object. + eMEMORY_RELEASE = (1<<1) //!< The destructor of an object has been called and the memory has been released. + }; +}; + +/** +\brief Collection of set bits defined in PxDeletionEventFlag. + +@see PxDeletionEventFlag +*/ +typedef PxFlags PxDeletionEventFlags; +PX_FLAGS_OPERATORS(PxDeletionEventFlag::Enum,PxU8) + + +/** +\brief interface to get notification on object deletion + +*/ +class PxDeletionListener +{ +public: + /** + \brief Notification if an object or its memory gets released + + If release() gets called on a PxBase object, an eUSER_RELEASE event will get fired immediately. The object state can be queried in the callback but + it is not allowed to change the state. Furthermore, when reading from the object it is the user's responsibility to make sure that no other thread + is writing at the same time to the object (this includes the simulation itself, i.e., #PxScene::fetchResults() must not get called at the same time). + + Calling release() on a PxBase object does not necessarily trigger its destructor immediately. For example, the object can be shared and might still + be referenced by other objects or the simulation might still be running and accessing the object state. In such cases the destructor will be called + as soon as it is safe to do so. After the destruction of the object and its memory, an eMEMORY_RELEASE event will get fired. In this case it is not + allowed to dereference the object pointer in the callback. + + \param[in] observed The object for which the deletion event gets fired. + \param[in] userData The user data pointer of the object for which the deletion event gets fired. Not available for all object types in which case it will be set to 0. + \param[in] deletionEvent The type of deletion event. Do not dereference the object pointer argument if the event is eMEMORY_RELEASE. + + */ + virtual void onRelease(const PxBase* observed, void* userData, PxDeletionEventFlag::Enum deletionEvent) = 0; + +protected: + PxDeletionListener() {} + virtual ~PxDeletionListener() {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothFlags.h new file mode 100644 index 0000000..43b7b18 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothFlags.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_FEM_CLOTH_FLAGS_H +#define PX_PHYSICS_FEM_CLOTH_FLAGS_H + +#include "foundation/PxFlags.h" +#include "foundation/PxSimpleTypes.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Identifies input and output buffers for PxFEMCloth. +@see PxFEMClothData::readData(), PxFEMClothData::writeData(), PxBuffer. +*/ +struct PxFEMClothData +{ + enum Enum + { + eNONE = 0, + ePOSITION_INVMASS = 1 << 0, + eVELOCITY = 1 << 1, + eREST_POSITION = 1 << 2, + eALL = ePOSITION_INVMASS | eVELOCITY | eREST_POSITION + }; +}; + +typedef PxFlags PxFEMClothDataFlags; + +struct PxFEMClothFlag +{ + enum Enum + { + eDISABLE_SELF_COLLISION = 1 << 0, + eUSE_ISOTROPIC_CLOTH = 1 << 1, // 0: use anistropic model + eUSE_REST_POSITION_FOR_BENDING = 1 << 2 // 0: use zero bending angle + }; +}; + +typedef PxFlags PxFEMClothFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothMaterial.h new file mode 100644 index 0000000..c1b99cc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMClothMaterial.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FEM_CLOTH_MATERIAL_H +#define PX_FEM_CLOTH_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxFEMMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Material class to represent a set of FEM material properties. + + @see PxPhysics.createFEMClothMaterial + */ + class PxFEMClothMaterial : public PxFEMMaterial + { + public: + + /** + \brief Sets material thickness + + \param[in] thickness Material thickness. + + @see getThickness + */ + virtual void setThickness(PxReal thickness) = 0; + + /** + \brief Retrieves the material thickness. + \return thickness. + + @see setDamping() + */ + virtual PxReal getThickness() const = 0; + + /** + \brief Sets the elasticity damping for the internal cloth solver. + + \param[in] damping The elasticity damping term. Range: [0.0, Inf) + + @see getElasticityDamping() + */ + virtual void setElasticityDamping(PxReal damping) = 0; + + /** + \brief Retrieves the elasticity damping term. + \return The elasticity damping term. + + @see setElasticityDamping() + */ + virtual PxReal getElasticityDamping() const = 0; + + /** + \brief Sets the bending coefficient for bending constraints. + + \param[in] damping The bending coefficient. Range: [0.0, Inf) + + @see getBendingDamping() + */ + virtual void setBendingDamping(PxReal damping) = 0; + + /** + \brief Retrieves the bending coefficient for bending constraints. + \return The bending coefficient. + + @see setBendingDamping() + */ + virtual PxReal getBendingDamping() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxFEMClothMaterial"; } + + protected: + PX_INLINE PxFEMClothMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxFEMMaterial(concreteType, baseFlags) {} + PX_INLINE PxFEMClothMaterial(PxBaseFlags baseFlags) : PxFEMMaterial(baseFlags) {} + virtual ~PxFEMClothMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxFEMClothMaterial", name) || PxRefCounted::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMMaterial.h new file mode 100644 index 0000000..1a81420 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMMaterial.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FEM_MATERIAL_H +#define PX_FEM_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxBaseMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + + /** + \brief Material class to represent a set of FEM material properties. + + @see PxPhysics.createFEMSoftBodyMaterial + */ + class PxFEMMaterial : public PxBaseMaterial + { + public: + + /** + \brief Sets young's modulus which defines the body's stiffness + + \param[in] young Young's modulus. Range: [0, PX_MAX_F32) + + @see getYoungsModulus() + */ + virtual void setYoungsModulus(PxReal young) = 0; + + /** + \brief Retrieves the young's modulus value. + + \return The young's modulus value. + + @see setYoungsModulus() + */ + virtual PxReal getYoungsModulus() const = 0; + + /** + \brief Sets the Poisson's ratio which defines the body's volume preservation. Completely incompressible materials have a poisson ratio of 0.5. Its value should not be set to exactly 0.5 because this leads to numerical problems. + + \param[in] poisson Poisson's ratio. Range: [0, 0.5) + + @see getPoissons() + */ + virtual void setPoissons(PxReal poisson) = 0; + + /** + \brief Retrieves the Poisson's ratio. + \return The Poisson's ratio. + + @see setPoissons() + */ + virtual PxReal getPoissons() const = 0; + + /** + \brief Sets the dynamic friction value which defines the strength of resistance when two objects slide relative to each other while in contact. + + \param[in] dynamicFriction The dynamic friction value. Range: [0, PX_MAX_F32) + + @see getDynamicFriction() + */ + virtual void setDynamicFriction(PxReal dynamicFriction) = 0; + + /** + \brief Retrieves the dynamic friction value + \return The dynamic friction value + + @see setDynamicFriction() + */ + virtual PxReal getDynamicFriction() const = 0; + + protected: + PX_INLINE PxFEMMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {} + PX_INLINE PxFEMMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {} + virtual ~PxFEMMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxFEMMaterial", name) || PxBaseMaterial::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMParameter.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMParameter.h new file mode 100644 index 0000000..25fbafe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMParameter.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_PHYSICS_FEM_PARAMETER_H +#define PX_PHYSICS_FEM_PARAMETER_H + +#include "foundation/PxSimpleTypes.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Set of parameters to control the sleeping and collision behavior of FEM based objects + */ + struct PxFEMParameters + { + public: + /** + \brief Velocity damping value. After every timestep the velocity is reduced while the magnitude of the reduction depends on velocityDamping + Default: 0.05 + */ + PxReal velocityDamping; + /** + \brief Threshold that defines the maximal magnitude of the linear motion a fem body can move in one second before it becomes a candidate for sleeping + Default: 0.1 + */ + PxReal settlingThreshold; + /** + \brief Threshold that defines the maximal magnitude of the linear motion a fem body can move in one second such that it can go to sleep in the next frame + Default: 0.05 + */ + PxReal sleepThreshold; + /** + \brief Damping value that damps the motion of bodies that move slow enough to be candidates for sleeping (see settlingThreshold) + Default: 10 + */ + PxReal sleepDamping; + /** + \brief Penetration value that needs to get exceeded before contacts for self collision are generated. Will only have an effect if self collisions are enabled. + Default: 0.1 + */ + PxReal selfCollisionFilterDistance; + /** + \brief Stress threshold to deactivate collision contacts in case the tetrahedron's stress magnitude exceeds the threshold + Default: 0.9 + */ + PxReal selfCollisionStressTolerance; + +#ifndef __CUDACC__ + PxFEMParameters() + { + velocityDamping = 0.05f; + settlingThreshold = 0.1f; + sleepThreshold = 0.05f; + sleepDamping = 10.f; + selfCollisionFilterDistance = 0.1f; + selfCollisionStressTolerance = 0.9f; + } +#endif + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMSoftBodyMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMSoftBodyMaterial.h new file mode 100644 index 0000000..1657a24 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFEMSoftBodyMaterial.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FEM_SOFT_BODY_MATERIAL_H +#define PX_FEM_SOFT_BODY_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxFEMMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + /** + \brief Material class to represent a set of softbody FEM material properties. + + @see PxPhysics.createFEMSoftBodyMaterial + */ + class PX_DEPRECATED PxFEMSoftBodyMaterial : public PxFEMMaterial + { + public: + + /** + \brief Sets material velocity damping term + + \param[in] damping Material velocity damping term. Range: [0, PX_MAX_F32)
+ + @see getDamping + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Retrieves velocity damping + \return The velocity damping. + + @see setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Sets material damping scale. A scale of 1 corresponds to default damping, a value of 0 will only apply damping to certain motions leading to special effects that look similar to water filled softbodies. + + \param[in] scale Damping scale term. Default: 1 Range: [0, 1] + + @see getDampingScale + */ + virtual void setDampingScale(PxReal scale) = 0; + + /** + \brief Retrieves material damping scale. + \return The damping scale term. + + @see setDamping() + */ + virtual PxReal getDampingScale() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxFEMSoftBodyMaterial"; } + + protected: + PX_INLINE PxFEMSoftBodyMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxFEMMaterial(concreteType, baseFlags) {} + PX_INLINE PxFEMSoftBodyMaterial(PxBaseFlags baseFlags) : PxFEMMaterial(baseFlags) {} + virtual ~PxFEMSoftBodyMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxFEMSoftBodyMaterial", name) || PxFEMMaterial::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFLIPMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFLIPMaterial.h new file mode 100644 index 0000000..b27d505 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFLIPMaterial.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FLIP_MATERIAL_H +#define PX_FLIP_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxParticleMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + /** + \brief Material class to represent a set of FLIP particle material properties. + + @see #PxPhysics.createFLIPMaterial() + */ + class PxFLIPMaterial : public PxParticleMaterial + { + public: + /** + \brief Sets viscosity + + \param[in] viscosity Viscosity. Range: [0, PX_MAX_F32) + + @see #getViscosity() + */ + virtual void setViscosity(PxReal viscosity) = 0; + + /** + \brief Retrieves the viscosity value. + + \return The viscosity value. + + @see #setViscosity() + */ + virtual PxReal getViscosity() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxFLIPMaterial"; } + + protected: + PX_INLINE PxFLIPMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxParticleMaterial(concreteType, baseFlags) {} + PX_INLINE PxFLIPMaterial(PxBaseFlags baseFlags) : PxParticleMaterial(baseFlags) {} + virtual ~PxFLIPMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxFLIPMaterial", name) || PxParticleMaterial::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxFiltering.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFiltering.h new file mode 100644 index 0000000..3bbd04c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxFiltering.h @@ -0,0 +1,785 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FILTERING_H +#define PX_FILTERING_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxActor; +class PxShape; + +static const PxU32 INVALID_FILTER_PAIR_INDEX = 0xffffffff; + +/** +\brief Collection of flags describing the actions to take for a collision pair. + +@see PxPairFlags PxSimulationFilterShader.filter() PxSimulationFilterCallback +*/ +struct PxPairFlag +{ + enum Enum + { + /** + \brief Process the contacts of this collision pair in the dynamics solver. + + \note Only takes effect if the colliding actors are rigid bodies. + */ + eSOLVE_CONTACT = (1<<0), + + /** + \brief Call contact modification callback for this collision pair + + \note Only takes effect if the colliding actors are rigid bodies. + + @see PxContactModifyCallback + */ + eMODIFY_CONTACTS = (1<<1), + + /** + \brief Call contact report callback or trigger callback when this collision pair starts to be in contact. + + If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE) + then the trigger callback will get called as soon as the other object enters the trigger volume. + If none of the two collision objects is a trigger shape then the contact report callback will get + called when the actors of this collision pair start to be in contact. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger() + */ + eNOTIFY_TOUCH_FOUND = (1<<2), + + /** + \brief Call contact report callback while this collision pair is in contact + + If none of the two collision objects is a trigger shape then the contact report callback will get + called while the actors of this collision pair are in contact. + + \note Triggers do not support this event. Persistent trigger contacts need to be tracked separately by observing eNOTIFY_TOUCH_FOUND/eNOTIFY_TOUCH_LOST events. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note No report will get sent if the objects in contact are sleeping. + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + \note If this flag gets enabled while a pair is in touch already, there will be no eNOTIFY_TOUCH_PERSISTS events until the pair loses and regains touch. + + @see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger() + */ + eNOTIFY_TOUCH_PERSISTS = (1<<3), + + /** + \brief Call contact report callback or trigger callback when this collision pair stops to be in contact + + If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE) + then the trigger callback will get called as soon as the other object leaves the trigger volume. + If none of the two collision objects is a trigger shape then the contact report callback will get + called when the actors of this collision pair stop to be in contact. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note This event will also get triggered if one of the colliding objects gets deleted. + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger() + */ + eNOTIFY_TOUCH_LOST = (1<<4), + + /** + \brief Call contact report callback when this collision pair is in contact during CCD passes. + + If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same + object multiple times. Hence, the same pair might be in contact multiple times during a simulation step. + This flag will make sure that all the detected collision during CCD will get reported. For performance + reasons, the system can not always tell whether the contact pair lost touch in one of the previous CCD + passes and thus can also not always tell whether the contact is new or has persisted. eNOTIFY_TOUCH_CCD + just reports when the two collision objects were detected as being in contact during a CCD pass. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note Trigger shapes are not supported. + + \note Only takes effect if eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger() + */ + eNOTIFY_TOUCH_CCD = (1<<5), + + /** + \brief Call contact report callback when the contact force between the actors of this collision pair exceeds one of the actor-defined force thresholds. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() + */ + eNOTIFY_THRESHOLD_FORCE_FOUND = (1<<6), + + /** + \brief Call contact report callback when the contact force between the actors of this collision pair continues to exceed one of the actor-defined force thresholds. + + \note Only takes effect if the colliding actors are rigid bodies. + + \note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the + previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND has been set in the previous frame). + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() + */ + eNOTIFY_THRESHOLD_FORCE_PERSISTS = (1<<7), + + /** + \brief Call contact report callback when the contact force between the actors of this collision pair falls below one of the actor-defined force thresholds (includes the case where this collision pair stops being in contact). + + \note Only takes effect if the colliding actors are rigid bodies. + + \note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the + previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND or #eNOTIFY_THRESHOLD_FORCE_PERSISTS has been set in the previous frame). + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() + */ + eNOTIFY_THRESHOLD_FORCE_LOST = (1<<8), + + /** + \brief Provide contact points in contact reports for this collision pair. + + \note Only takes effect if the colliding actors are rigid bodies and if used in combination with the flags eNOTIFY_TOUCH_... or eNOTIFY_THRESHOLD_FORCE_... + + \note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + + @see PxSimulationEventCallback.onContact() PxContactPair PxContactPair.extractContacts() + */ + eNOTIFY_CONTACT_POINTS = (1<<9), + + /** + \brief This flag is used to indicate whether this pair generates discrete collision detection contacts. + + \note Contacts are only responded to if eSOLVE_CONTACT is enabled. + */ + eDETECT_DISCRETE_CONTACT = (1<<10), + + /** + \brief This flag is used to indicate whether this pair generates CCD contacts. + + \note The contacts will only be responded to if eSOLVE_CONTACT is enabled on this pair. + \note The scene must have PxSceneFlag::eENABLE_CCD enabled to use this feature. + \note Non-static bodies of the pair should have PxRigidBodyFlag::eENABLE_CCD specified for this feature to work correctly. + \note This flag is not supported with trigger shapes. However, CCD trigger events can be emulated using non-trigger shapes + and requesting eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST and not raising eSOLVE_CONTACT on the pair. + + @see PxRigidBodyFlag::eENABLE_CCD + @see PxSceneFlag::eENABLE_CCD + */ + eDETECT_CCD_CONTACT = (1<<11), + + /** + \brief Provide pre solver velocities in contact reports for this collision pair. + + If the collision pair has contact reports enabled, the velocities of the rigid bodies before contacts have been solved + will be provided in the contact report callback unless the pair lost touch in which case no data will be provided. + + \note Usually it is not necessary to request these velocities as they will be available by querying the velocity from the provided + PxRigidActor object directly. However, it might be the case that the velocity of a rigid body gets set while the simulation is running + in which case the PxRigidActor would return this new velocity in the contact report callback and not the velocity the simulation used. + + @see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream + */ + ePRE_SOLVER_VELOCITY = (1<<12), + + /** + \brief Provide post solver velocities in contact reports for this collision pair. + + If the collision pair has contact reports enabled, the velocities of the rigid bodies after contacts have been solved + will be provided in the contact report callback unless the pair lost touch in which case no data will be provided. + + @see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream + */ + ePOST_SOLVER_VELOCITY = (1<<13), + + /** + \brief Provide rigid body poses in contact reports for this collision pair. + + If the collision pair has contact reports enabled, the rigid body poses at the contact event will be provided + in the contact report callback unless the pair lost touch in which case no data will be provided. + + \note Usually it is not necessary to request these poses as they will be available by querying the pose from the provided + PxRigidActor object directly. However, it might be the case that the pose of a rigid body gets set while the simulation is running + in which case the PxRigidActor would return this new pose in the contact report callback and not the pose the simulation used. + Another use case is related to CCD with multiple passes enabled, A fast moving object might bounce on and off the same + object multiple times. This flag can be used to request the rigid body poses at the time of impact for each such collision event. + + @see PxSimulationEventCallback.onContact(), PxContactPairPose, PxContactPairHeader.extraDataStream + */ + eCONTACT_EVENT_POSE = (1<<14), + + eNEXT_FREE = (1<<15), //!< For internal use only. + + /** + \brief Provided default flag to do simple contact processing for this collision pair. + */ + eCONTACT_DEFAULT = eSOLVE_CONTACT | eDETECT_DISCRETE_CONTACT, + + /** + \brief Provided default flag to get commonly used trigger behavior for this collision pair. + */ + eTRIGGER_DEFAULT = eNOTIFY_TOUCH_FOUND | eNOTIFY_TOUCH_LOST | eDETECT_DISCRETE_CONTACT + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxPairFlag. + +@see PxPairFlag +*/ +typedef PxFlags PxPairFlags; +PX_FLAGS_OPERATORS(PxPairFlag::Enum, PxU16) + + + +/** +\brief Collection of flags describing the filter actions to take for a collision pair. + +@see PxFilterFlags PxSimulationFilterShader PxSimulationFilterCallback +*/ +struct PxFilterFlag +{ + enum Enum + { + /** + \brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap. + + Killed pairs will be ignored by the simulation and won't run through the filter again until one + of the following occurs: + + \li The bounding volumes of the two objects overlap again (after being separated) + \li The user enforces a re-filtering (see #PxScene::resetFiltering()) + + @see PxScene::resetFiltering() + */ + eKILL = (1<<0), + + /** + \brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap or until filtering relevant data changes for one of the collision objects. + + Suppressed pairs will be ignored by the simulation and won't make another filter request until one + of the following occurs: + + \li Same conditions as for killed pairs (see #eKILL) + \li The filter data or the filter object attributes change for one of the collision objects + + @see PxFilterData PxFilterObjectAttributes + */ + eSUPPRESS = (1<<1), + + /** + \brief Invoke the filter callback (#PxSimulationFilterCallback::pairFound()) for this collision pair. + + @see PxSimulationFilterCallback + */ + eCALLBACK = (1<<2), + + /** + \brief Track this collision pair with the filter callback mechanism. + + When the bounding volumes of the collision pair lose contact, the filter callback #PxSimulationFilterCallback::pairLost() + will be invoked. Furthermore, the filter status of the collision pair can be adjusted through #PxSimulationFilterCallback::statusChange() + once per frame (until a pairLost() notification occurs). + + @see PxSimulationFilterCallback + */ + eNOTIFY = (1<<3) | eCALLBACK, + + /** + \brief Provided default to get standard behavior: + + The application configure the pair's collision properties once when bounding volume overlap is found and + doesn't get asked again about that pair until overlap status or filter properties changes, or re-filtering is requested. + + No notification is provided when bounding volume overlap is lost + + The pair will not be killed or suppressed, so collision detection will be processed + */ + + eDEFAULT = 0 + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxFilterFlag. + +@see PxFilterFlag +*/ +typedef PxFlags PxFilterFlags; +PX_FLAGS_OPERATORS(PxFilterFlag::Enum, PxU16) + + +/** +\brief PxFilterData is user-definable data which gets passed into the collision filtering shader and/or callback. + +@see PxShape.setSimulationFilterData() PxShape.getSimulationFilterData() PxSimulationFilterShader PxSimulationFilterCallback +*/ +struct PxFilterData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PX_INLINE PxFilterData(const PxEMPTY) + { + } + + /** + \brief Default constructor. + */ + PX_INLINE PxFilterData() + { + word0 = word1 = word2 = word3 = 0; + } + + /** + \brief Copy constructor. + */ + PX_INLINE PxFilterData(const PxFilterData& fd) : word0(fd.word0), word1(fd.word1), word2(fd.word2), word3(fd.word3) {} + + /** + \brief Constructor to set filter data initially. + */ + PX_INLINE PxFilterData(PxU32 w0, PxU32 w1, PxU32 w2, PxU32 w3) : word0(w0), word1(w1), word2(w2), word3(w3) {} + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault() + { + *this = PxFilterData(); + } + + /** + \brief Assignment operator + */ + PX_INLINE void operator = (const PxFilterData& fd) + { + word0 = fd.word0; + word1 = fd.word1; + word2 = fd.word2; + word3 = fd.word3; + } + + /** + \brief Comparison operator to allow use in Array. + */ + PX_INLINE bool operator == (const PxFilterData& a) const + { + return a.word0 == word0 && a.word1 == word1 && a.word2 == word2 && a.word3 == word3; + } + + /** + \brief Comparison operator to allow use in Array. + */ + PX_INLINE bool operator != (const PxFilterData& a) const + { + return !(a == *this); + } + + PxU32 word0; + PxU32 word1; + PxU32 word2; + PxU32 word3; +}; + + +/** +\brief Identifies each type of filter object. + +@see PxGetFilterObjectType() +*/ +struct PxFilterObjectType +{ + enum Enum + { + /** + \brief A static rigid body + @see PxRigidStatic + */ + eRIGID_STATIC, + + /** + \brief A dynamic rigid body + @see PxRigidDynamic + */ + eRIGID_DYNAMIC, + + /** + \brief An articulation + @see PxArticulationReducedCoordinate + */ + eARTICULATION, + + /** + \brief A particle system + @see PxParticleSystem + */ + ePARTICLESYSTEM, + + /** + \brief A FEM-based soft body + @see PxSoftBody + */ + eSOFTBODY, + + /** + \brief A FEM-based cloth + \note In development + @see PxFEMCloth + */ + eFEMCLOTH, + + /** + \brief A hair system + \note In development + @see PxHairSystem + */ + eHAIRSYSTEM, + + //! \brief internal use only! + eMAX_TYPE_COUNT = 16, + + //! \brief internal use only! + eUNDEFINED = eMAX_TYPE_COUNT-1 + }; +}; + + +// For internal use only +struct PxFilterObjectFlag +{ + enum Enum + { + eKINEMATIC = (1<<4), + eTRIGGER = (1<<5) + }; +}; + + +/** +\brief Structure which gets passed into the collision filtering shader and/or callback providing additional information on objects of a collision pair + +@see PxSimulationFilterShader PxSimulationFilterCallback getActorType() PxFilterObjectIsKinematic() PxFilterObjectIsTrigger() +*/ +typedef PxU32 PxFilterObjectAttributes; + + +/** +\brief Extract filter object type from the filter attributes of a collision pair object + +\param[in] attr The filter attribute of a collision pair object +\return The type of the collision pair object. + +@see PxFilterObjectType +*/ +PX_INLINE PxFilterObjectType::Enum PxGetFilterObjectType(PxFilterObjectAttributes attr) +{ + return PxFilterObjectType::Enum(attr & (PxFilterObjectType::eMAX_TYPE_COUNT-1)); +} + + +/** +\brief Specifies whether the collision object belongs to a kinematic rigid body + +\param[in] attr The filter attribute of a collision pair object +\return True if the object belongs to a kinematic rigid body, else false + +@see PxRigidBodyFlag::eKINEMATIC +*/ +PX_INLINE bool PxFilterObjectIsKinematic(PxFilterObjectAttributes attr) +{ + return (attr & PxFilterObjectFlag::eKINEMATIC) != 0; +} + + +/** +\brief Specifies whether the collision object is a trigger shape + +\param[in] attr The filter attribute of a collision pair object +\return True if the object is a trigger shape, else false + +@see PxShapeFlag::eTRIGGER_SHAPE +*/ +PX_INLINE bool PxFilterObjectIsTrigger(PxFilterObjectAttributes attr) +{ + return (attr & PxFilterObjectFlag::eTRIGGER) != 0; +} + +/** +\brief Filter method to specify how a pair of potentially colliding objects should be processed. + +Collision filtering is a mechanism to specify how a pair of potentially colliding objects should be processed by the +simulation. A pair of objects is potentially colliding if the bounding volumes of the two objects overlap. +In short, a collision filter decides whether a collision pair should get processed, temporarily ignored or discarded. +If a collision pair should get processed, the filter can additionally specify how it should get processed, for instance, +whether contacts should get resolved, which callbacks should get invoked or which reports should be sent etc. +The function returns the PxFilterFlag flags and sets the PxPairFlag flags to define what the simulation should do with the given collision pair. + +\note A default implementation of a filter shader is provided in the PhysX extensions library, see #PxDefaultSimulationFilterShader. + +This methods gets called when: +\li The bounding volumes of two objects start to overlap. +\li The bounding volumes of two objects overlap and the filter data or filter attributes of one of the objects changed +\li A re-filtering was forced through resetFiltering() (see #PxScene::resetFiltering()) +\li Filtering is requested in scene queries + +\note Certain pairs of objects are always ignored and this method does not get called. This is the case for the +following pairs: + +\li Pair of static rigid actors +\li A static rigid actor and a kinematic actor (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP) +\li Two kinematic actors (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP) +\li Two jointed rigid bodies and the joint was defined to disable collision +\li Two articulation links if connected through an articulation joint + +\note This is a performance critical method and should be stateless. You should neither access external objects +from within this method nor should you call external methods that are not inlined. If you need a more complex +logic to filter a collision pair then use the filter callback mechanism for this pair (see #PxSimulationFilterCallback, +#PxFilterFlag::eCALLBACK, #PxFilterFlag::eNOTIFY). + +\param[in] attributes0 The filter attribute of the first object +\param[in] filterData0 The custom filter data of the first object +\param[in] attributes1 The filter attribute of the second object +\param[in] filterData1 The custom filter data of the second object +\param[out] pairFlags Flags giving additional information on how an accepted pair should get processed +\param[in] constantBlock The constant global filter data (see #PxSceneDesc.filterShaderData) +\param[in] constantBlockSize Size of the global filter data (see #PxSceneDesc.filterShaderDataSize) +\return Filter flags defining whether the pair should be discarded, temporarily ignored, processed and whether the +filter callback should get invoked for this pair. + +@see PxSimulationFilterCallback PxFilterData PxFilterObjectAttributes PxFilterFlag PxFilterFlags PxPairFlag PxPairFlags PxSceneDesc.filterShader +*/ +typedef PxFilterFlags (*PxSimulationFilterShader) + (PxFilterObjectAttributes attributes0, PxFilterData filterData0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, + PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize); + + + +/** +\brief Filter callback to specify handling of collision pairs. + +This class is provided to implement more complex and flexible collision pair filtering logic, for instance, taking +the state of the user application into account. Filter callbacks also give the user the opportunity to track collision +pairs and update their filter state. + +You might want to check the documentation on #PxSimulationFilterShader as well since it includes more general information +on filtering. + +\note SDK state should not be modified from within the callbacks. In particular objects should not +be created or destroyed. If state modification is needed then the changes should be stored to a buffer +and performed after the simulation step. + +\note The callbacks may execute in user threads or simulation threads, possibly simultaneously. The corresponding objects +may have been deleted by the application earlier in the frame. It is the application's responsibility to prevent race conditions +arising from using the SDK API in the callback while an application thread is making write calls to the scene, and to ensure that +the callbacks are thread-safe. Return values which depend on when the callback is called during the frame will introduce nondeterminism +into the simulation. + +@see PxSceneDesc.filterCallback PxSimulationFilterShader +*/ +class PxSimulationFilterCallback +{ +public: + + /** + \brief Filter method to specify how a pair of potentially colliding objects should be processed. + + This method gets called when the filter flags returned by the filter shader (see #PxSimulationFilterShader) + indicate that the filter callback should be invoked (#PxFilterFlag::eCALLBACK or #PxFilterFlag::eNOTIFY set). + Return the PxFilterFlag flags and set the PxPairFlag flags to define what the simulation should do with the given + collision pair. + + \param[in] pairID Unique ID of the collision pair used to issue filter status changes for the pair (see #statusChange()) + \param[in] attributes0 The filter attribute of the first object + \param[in] filterData0 The custom filter data of the first object + \param[in] a0 Actor pointer of the first object + \param[in] s0 Shape pointer of the first object (NULL if the object has no shapes) + \param[in] attributes1 The filter attribute of the second object + \param[in] filterData1 The custom filter data of the second object + \param[in] a1 Actor pointer of the second object + \param[in] s1 Shape pointer of the second object (NULL if the object has no shapes) + \param[in,out] pairFlags In: Pair flags returned by the filter shader. Out: Additional information on how an accepted pair should get processed + \return Filter flags defining whether the pair should be discarded, temporarily ignored or processed and whether the pair + should be tracked and send a report on pair deletion through the filter callback + + @see PxSimulationFilterShader PxFilterData PxFilterObjectAttributes PxFilterFlag PxPairFlag + */ + virtual PxFilterFlags pairFound( PxU32 pairID, + PxFilterObjectAttributes attributes0, PxFilterData filterData0, const PxActor* a0, const PxShape* s0, + PxFilterObjectAttributes attributes1, PxFilterData filterData1, const PxActor* a1, const PxShape* s1, + PxPairFlags& pairFlags) = 0; + + /** + \brief Callback to inform that a tracked collision pair is gone. + + This method gets called when a collision pair disappears or gets re-filtered. Only applies to + collision pairs which have been marked as filter callback pairs (#PxFilterFlag::eNOTIFY set in #pairFound()). + + \param[in] pairID Unique ID of the collision pair that disappeared + \param[in] attributes0 The filter attribute of the first object + \param[in] filterData0 The custom filter data of the first object + \param[in] attributes1 The filter attribute of the second object + \param[in] filterData1 The custom filter data of the second object + \param[in] objectRemoved True if the pair was lost because one of the objects got removed from the scene + + @see pairFound() PxSimulationFilterShader PxFilterData PxFilterObjectAttributes + */ + virtual void pairLost( PxU32 pairID, + PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + bool objectRemoved) = 0; + + /** + \brief Callback to give the opportunity to change the filter state of a tracked collision pair. + + This method gets called once per simulation step to let the application change the filter and pair + flags of a collision pair that has been reported in #pairFound() and requested callbacks by + setting #PxFilterFlag::eNOTIFY. To request a change of filter status, the target pair has to be + specified by its ID, the new filter and pair flags have to be provided and the method should return true. + + \note If this method changes the filter status of a collision pair and the pair should keep being tracked + by the filter callbacks then #PxFilterFlag::eNOTIFY has to be set. + + \note The application is responsible to ensure that this method does not get called for pairs that have been + reported as lost, see #pairLost(). + + \param[out] pairID ID of the collision pair for which the filter status should be changed + \param[out] pairFlags The new pairFlags to apply to the collision pair + \param[out] filterFlags The new filterFlags to apply to the collision pair + \return True if the changes should be applied. In this case the method will get called again. False if + no more status changes should be done in the current simulation step. In that case the provided flags will be discarded. + + @see pairFound() pairLost() PxFilterFlag PxPairFlag + */ + virtual bool statusChange(PxU32& pairID, PxPairFlags& pairFlags, PxFilterFlags& filterFlags) = 0; + +protected: + virtual ~PxSimulationFilterCallback() {} +}; + +struct PxPairFilteringMode +{ + enum Enum + { + /** + \brief Output pair from BP, potentially send to user callbacks, create regular interaction object. + + Enable contact pair filtering between kinematic/static or kinematic/kinematic rigid bodies. + + By default contacts between these are suppressed (see #PxFilterFlag::eSUPPRESS) and don't get reported to the filter mechanism. + Use this mode if these pairs should go through the filtering pipeline nonetheless. + + \note This mode is not mutable, and must be set in PxSceneDesc at scene creation. + */ + eKEEP, + + /** + \brief Output pair from BP, create interaction marker. Can be later switched to regular interaction. + */ + eSUPPRESS, + + /** + \brief Don't output pair from BP. Cannot be later switched to regular interaction, needs "resetFiltering" call. + */ + eKILL, + + /** + \brief Default is eSUPPRESS for compatibility with previous PhysX versions. + */ + eDEFAULT PX_DEPRECATED = eSUPPRESS + }; +}; + +/** +\brief Struct for storing a particle/vertex - rigid filter pair with comparison operators +*/ +struct PxParticleRigidFilterPair +{ + PxU64 mID0; //!< Rigid node index + PxU64 mID1; //!< Particle/vertex id + + PX_CUDA_CALLABLE bool operator<(const PxParticleRigidFilterPair& other) const + { + if(mID0 < other.mID0) + return true; + if(mID0 == other.mID0 && mID1 < other.mID1) + return true; + return false; + } + + PX_CUDA_CALLABLE bool operator>(const PxParticleRigidFilterPair& other) const + { + if(mID0 > other.mID0) + return true; + if(mID0 == other.mID0 && mID1 > other.mID1) + return true; + return false; + } + + PX_CUDA_CALLABLE bool operator==(const PxParticleRigidFilterPair& other) const + { + return (mID0 == other.mID0 && mID1 == other.mID1); + } +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxForceMode.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxForceMode.h new file mode 100644 index 0000000..090136b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxForceMode.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FORCE_MODE_H +#define PX_FORCE_MODE_H + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup physics +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Parameter to addForce() and addTorque() calls, determines the exact operation that is carried out. + +@see PxRigidBody.addForce() PxRigidBody.addTorque() +*/ +struct PxForceMode +{ + enum Enum + { + eFORCE, //!< parameter has unit of mass * length / time^2, i.e., a force + eIMPULSE, //!< parameter has unit of mass * length / time, i.e., force * time + eVELOCITY_CHANGE, //!< parameter has unit of length / time, i.e., the effect is mass independent: a velocity change. + eACCELERATION //!< parameter has unit of length/ time^2, i.e., an acceleration. It gets treated just like a force except the mass is not divided out before integration. + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxHairSystemFlag.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxHairSystemFlag.h new file mode 100644 index 0000000..06f6b31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxHairSystemFlag.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HAIR_SYSTEM_FLAG_H +#define PX_HAIR_SYSTEM_FLAG_H + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Identifies input and output buffers for PxHairSystem + \see PxHairSystemData::readData(), PxHairSystemData::writeData(), PxBuffer + */ + struct PxHairSystemData + { + enum Enum + { + eNONE = 0, //!< No data specified + ePOSITION_INVMASS = 1 << 0, //!< Specifies the position (first 3 floats) and inverse mass (last float) data (array of PxVec4 * max number of vertices) + eVELOCITY = 1 << 1, //!< Specifies the velocity (first 3 floats) data (array of PxVec4 * max number of vertices) + eALL = ePOSITION_INVMASS | eVELOCITY //!< Specifies everything + }; + }; + typedef PxFlags PxHairSystemDataFlags; + + /** + \brief Binary settings for hair system simulation + */ + struct PxHairSystemFlag + { + enum Enum + { + eDISABLE_SELF_COLLISION = 1 << 0, //!< Determines if self-collision between hair vertices is ignored + eDISABLE_EXTERNAL_COLLISION = 1 << 1, //!< Determines if collision between hair and external bodies is ignored + eDISABLE_TWOSIDED_ATTACHMENT = 1 << 2 //!< Determines if attachment constraint is also felt by body to which the hair is attached + }; + }; + typedef PxFlags PxHairSystemFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxImmediateMode.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxImmediateMode.h new file mode 100644 index 0000000..e63debd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxImmediateMode.h @@ -0,0 +1,771 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_IMMEDIATE_MODE_H +#define PX_IMMEDIATE_MODE_H +/** \addtogroup immediatemode +@{ */ + +#include "PxPhysXConfig.h" +#include "foundation/PxMemory.h" +#include "solver/PxSolverDefs.h" +#include "collision/PxCollisionDefs.h" +#include "PxArticulationReducedCoordinate.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxCudaContextManager; + class PxBaseTask; + class PxGeometry; + +#if !PX_DOXYGEN +namespace immediate +{ +#endif + + typedef void* PxArticulationHandle; + + /** + \brief Structure to store linear and angular components of spatial vector + */ + struct PxSpatialVector + { + PxVec3 top; + PxReal pad0; + PxVec3 bottom; + PxReal pad1; + }; + + /** + \brief Structure to store rigid body properties + */ + struct PxRigidBodyData + { + PX_ALIGN(16, PxVec3 linearVelocity); //!< 12 Linear velocity + PxReal invMass; //!< 16 Inverse mass + PxVec3 angularVelocity; //!< 28 Angular velocity + PxReal maxDepenetrationVelocity; //!< 32 Maximum de-penetration velocity + PxVec3 invInertia; //!< 44 Mass-space inverse interia diagonal vector + PxReal maxContactImpulse; //!< 48 Maximum permissable contact impulse + PxTransform body2World; //!< 76 World space transform + PxReal linearDamping; //!< 80 Linear damping coefficient + PxReal angularDamping; //!< 84 Angular damping coefficient + PxReal maxLinearVelocitySq; //!< 88 Squared maximum linear velocity + PxReal maxAngularVelocitySq; //!< 92 Squared maximum angular velocity + PxU32 pad; //!< 96 Padding for 16-byte alignment + }; + + /** + \brief Callback class to record contact points produced by immediate::PxGenerateContacts + */ + class PxContactRecorder + { + public: + /** + \brief Method to record new contacts + \param [in] contactPoints The contact points produced + \param [in] nbContacts The number of contact points produced + \param [in] index The index of this pair. This is an index from 0-N-1 identifying which pair this relates to from within the array of pairs passed to PxGenerateContacts + \return a boolean to indicate if this callback successfully stored the contacts or not. + */ + virtual bool recordContacts(const PxContactPoint* contactPoints, const PxU32 nbContacts, const PxU32 index) = 0; + + virtual ~PxContactRecorder(){} + }; + + /** + \brief Constructs a PxSolverBodyData structure based on rigid body properties. Applies gravity, damping and clamps maximum velocity. + \param [in] inRigidData The array rigid body properties + \param [out] outSolverBodyData The array of solverBodyData produced to represent these bodies + \param [in] nbBodies The total number of solver bodies to create + \param [in] gravity The gravity vector + \param [in] dt The timestep + \param [in] gyroscopicForces Indicates whether gyroscopic forces should be integrated + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructSolverBodies(const PxRigidBodyData* inRigidData, PxSolverBodyData* outSolverBodyData, PxU32 nbBodies, const PxVec3& gravity, PxReal dt, bool gyroscopicForces = false); + + /** + \brief Constructs a PxSolverBodyData structure for a static body at a given pose. + \param [in] globalPose The pose of this static actor + \param [out] solverBodyData The solver body representation of this static actor + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructStaticSolverBody(const PxTransform& globalPose, PxSolverBodyData& solverBodyData); + + /** + \brief Groups together sets of independent PxSolverConstraintDesc objects to be solved using SIMD SOA approach. + \param [in] solverConstraintDescs The set of solver constraint descs to batch + \param [in] nbConstraints The number of constraints to batch + \param [in,out] solverBodies The array of solver bodies that the constraints reference. Some fields in these structures are written to as scratch memory for the batching. + \param [in] nbBodies The number of bodies + \param [out] outBatchHeaders The batch headers produced by this batching process. This array must have at least 1 entry per input constraint + \param [out] outOrderedConstraintDescs A reordered copy of the constraint descs. This array is referenced by the constraint batches. This array must have at least 1 entry per input constraint. + \param [in,out] articulations The array of articulations that the constraints reference. Some fields in these structures are written to as scratch memory for the batching. + \param [in] nbArticulations The number of articulations + \return The total number of batches produced. This should be less than or equal to nbConstraints. + + \note This method considers all bodies within the range [0, nbBodies-1] to be valid dynamic bodies. A given dynamic body can only be referenced in a batch once. Static or kinematic bodies can be + referenced multiple times within a batch safely because constraints do not affect their velocities. The batching will implicitly consider any bodies outside of the range [0, nbBodies-1] to be + infinite mass (static or kinematic). This means that either appending static/kinematic to the end of the array of bodies or placing static/kinematic bodies at before the start body pointer + will ensure that the minimum number of batches are produced. + */ + PX_C_EXPORT PX_PHYSX_CORE_API PxU32 PxBatchConstraints( const PxSolverConstraintDesc* solverConstraintDescs, PxU32 nbConstraints, PxSolverBody* solverBodies, PxU32 nbBodies, + PxConstraintBatchHeader* outBatchHeaders, PxSolverConstraintDesc* outOrderedConstraintDescs, + PxArticulationHandle* articulations=NULL, PxU32 nbArticulations=0); + + /** + \brief Creates a set of contact constraint blocks. Note that, depending the results of PxBatchConstraints, each batchHeader may refer to up to 4 solverConstraintDescs. + This function will allocate both constraint and friction patch data via the PxConstraintAllocator provided. Constraint data is only valid until PxSolveConstraints has completed. + Friction data is to be retained and provided by the application for friction correlation. + + \param [in] batchHeaders Array of batch headers to process + \param [in] nbHeaders The total number of headers + \param [in] contactDescs An array of contact descs defining the pair and contact properties of each respective contacting pair + \param [in] allocator An allocator callback to allocate constraint and friction memory + \param [in] invDt The inverse timestep + \param [in] bounceThreshold The bounce threshold. Relative velocities below this will be solved by bias only. Relative velocities above this will be solved by restitution. If restitution is zero + then these pairs will always be solved by bias. + \param [in] frictionOffsetThreshold The friction offset threshold. Contacts whose separations are below this threshold can generate friction constraints. + \param [in] correlationDistance The correlation distance used by friction correlation to identify whether a friction patch is broken on the grounds of relation separation. + \param [out] Z Temporary buffer for impulse propagation. + + \return a boolean to define if this method was successful or not. + */ + PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateContactConstraints(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxSolverContactDesc* contactDescs, + PxConstraintAllocator& allocator, PxReal invDt, PxReal bounceThreshold, PxReal frictionOffsetThreshold, PxReal correlationDistance, + PxSpatialVector* Z = NULL); + + /** + \brief Creates a set of joint constraint blocks. Note that, depending the results of PxBatchConstraints, the batchHeader may refer to up to 4 solverConstraintDescs + \param [in] batchHeaders The array of batch headers to be processed. + \param [in] nbHeaders The total number of batch headers to process. + \param [in] jointDescs An array of constraint prep descs defining the properties of the constraints being created. + \param [in] allocator An allocator callback to allocate constraint data. + \param [in] dt The timestep. + \param [in] invDt The inverse timestep. + \param [out] Z Temporary buffer for impulse propagation. + \return a boolean indicating if this method was successful or not. + */ + PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraints(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator, PxSpatialVector* Z, PxReal dt, PxReal invDt); + + /** + \brief Creates a set of joint constraint blocks. This function runs joint shaders defined inside PxConstraint** param, fills in joint row information in jointDescs and then calls PxCreateJointConstraints. + \param [in] batchHeaders The set of batchHeaders to be processed. + \param [in] nbBatchHeaders The number of batch headers to process. + \param [in] constraints The set of constraints to be used to produce constraint rows. + \param [in,out] jointDescs An array of constraint prep descs defining the properties of the constraints being created. + \param [in] allocator An allocator callback to allocate constraint data. + \param [in] dt The timestep. + \param [in] invDt The inverse timestep. + \param [out] Z Temporary buffer for impulse propagation. + \return a boolean indicating if this method was successful or not. + @see PxCreateJointConstraints + */ + PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithShaders(PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, PxConstraint** constraints, PxSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator, PxReal dt, PxReal invDt, PxSpatialVector* Z = NULL); + + struct PxImmediateConstraint + { + PxConstraintSolverPrep prep; + const void* constantBlock; + }; + + /** + \brief Creates a set of joint constraint blocks. This function runs joint shaders defined inside PxImmediateConstraint* param, fills in joint row information in jointDescs and then calls PxCreateJointConstraints. + \param [in] batchHeaders The set of batchHeaders to be processed. + \param [in] nbBatchHeaders The number of batch headers to process. + \param [in] constraints The set of constraints to be used to produce constraint rows. + \param [in,out] jointDescs An array of constraint prep descs defining the properties of the constraints being created. + \param [in] allocator An allocator callback to allocate constraint data. + \param [in] dt The timestep. + \param [in] invDt The inverse timestep. + \param [out] Z Temporary buffer for impulse propagation. + \return a boolean indicating if this method was successful or not. + @see PxCreateJointConstraints + */ + PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithImmediateShaders(PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, PxImmediateConstraint* constraints, PxSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator, PxReal dt, PxReal invDt, PxSpatialVector* Z = NULL); + + /** + \brief Iteratively solves the set of constraints defined by the provided PxConstraintBatchHeader and PxSolverConstraintDesc structures. Updates deltaVelocities inside the PxSolverBody structures. Produces resulting linear and angular motion velocities. + \param [in] batchHeaders The set of batch headers to be solved + \param [in] nbBatchHeaders The total number of batch headers to be solved + \param [in] solverConstraintDescs The reordererd set of solver constraint descs referenced by the batch headers + \param [in,out] solverBodies The set of solver bodies the bodies reference + \param [out] linearMotionVelocity The resulting linear motion velocity + \param [out] angularMotionVelocity The resulting angular motion velocity. + \param [in] nbSolverBodies The total number of solver bodies + \param [in] nbPositionIterations The number of position iterations to run + \param [in] nbVelocityIterations The number of velocity iterations to run + \param [in] dt Timestep. Only needed if articulations are sent to the function. + \param [in] invDt Inverse timestep. Only needed if articulations are sent to the function. + \param [in] nbSolverArticulations Number of articulations to solve constraints for. + \param [in] solverArticulations Array of articulations to solve constraints for. + \param [out] Z Temporary buffer for impulse propagation + \param [out] deltaV Temporary buffer for velocity change + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PxSolveConstraints(const PxConstraintBatchHeader* batchHeaders, PxU32 nbBatchHeaders, const PxSolverConstraintDesc* solverConstraintDescs, + const PxSolverBody* solverBodies, PxVec3* linearMotionVelocity, PxVec3* angularMotionVelocity, PxU32 nbSolverBodies, PxU32 nbPositionIterations, PxU32 nbVelocityIterations, + float dt=0.0f, float invDt=0.0f, PxU32 nbSolverArticulations=0, PxArticulationHandle* solverArticulations=NULL, PxSpatialVector* Z = NULL, PxSpatialVector* deltaV = NULL); + + /** + \brief Integrates a rigid body, returning the new velocities and transforms. After this function has been called, solverBodyData stores all the body's velocity data. + + \param [in,out] solverBodyData The array of solver body data to be integrated + \param [in] solverBody The bodies' linear and angular velocities + \param [in] linearMotionVelocity The bodies' linear motion velocity array + \param [in] angularMotionState The bodies' angular motion velocity array + \param [in] nbBodiesToIntegrate The total number of bodies to integrate + \param [in] dt The timestep + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PxIntegrateSolverBodies(PxSolverBodyData* solverBodyData, PxSolverBody* solverBody, const PxVec3* linearMotionVelocity, const PxVec3* angularMotionState, PxU32 nbBodiesToIntegrate, PxReal dt); + + /** + \brief Performs contact generation for a given pair of geometries at the specified poses. Produced contacts are stored in the provided contact recorder. Information is cached in PxCache structure + to accelerate future contact generation between pairs. This cache data is valid only as long as the memory provided by PxCacheAllocator has not been released/re-used. Recommendation is to + retain that data for a single simulation frame, discarding cached data after 2 frames. If the cached memory has been released/re-used prior to the corresponding pair having contact generation + performed again, it is the application's responsibility to reset the PxCache. + + \param [in] geom0 Array of geometries to perform collision detection on. + \param [in] geom1 Array of geometries to perform collision detection on + \param [in] pose0 Array of poses associated with the corresponding entry in the geom0 array + \param [in] pose1 Array of poses associated with the corresponding entry in the geom1 array + \param [in,out] contactCache Array of contact caches associated with each pair geom0[i] + geom1[i] + \param [in] nbPairs The total number of pairs to process + \param [out] contactRecorder A callback that is called to record contacts for each pair that detects contacts + \param [in] contactDistance The distance at which contacts begin to be generated between the pairs + \param [in] meshContactMargin The mesh contact margin. + \param [in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param [in] allocator A callback to allocate memory for the contact cache + + \return a boolean indicating if the function was successful or not. + */ + PX_C_EXPORT PX_PHYSX_CORE_API bool PxGenerateContacts( const PxGeometry* const * geom0, const PxGeometry* const * geom1, const PxTransform* pose0, const PxTransform* pose1, + PxCache* contactCache, PxU32 nbPairs, PxContactRecorder& contactRecorder, + PxReal contactDistance, PxReal meshContactMargin, PxReal toleranceLength, PxCacheAllocator& allocator); + + /** + \brief Register articulation-related solver functions. This is equivalent to PxRegisterArticulationsReducedCoordinate() for PxScene-level articulations. + Call this first to enable reduced coordinates articulations in immediate mode. + + @see PxRegisterArticulationsReducedCoordinate + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PxRegisterImmediateArticulations(); + + struct PxArticulationJointDataRC + { + PxTransform parentPose; + PxTransform childPose; + PxArticulationMotion::Enum motion[PxArticulationAxis::eCOUNT]; + PxArticulationLimit limits[PxArticulationAxis::eCOUNT]; + PxArticulationDrive drives[PxArticulationAxis::eCOUNT]; + PxReal targetPos[PxArticulationAxis::eCOUNT]; + PxReal targetVel[PxArticulationAxis::eCOUNT]; + PxReal armature[PxArticulationAxis::eCOUNT]; + PxReal jointPos[PxArticulationAxis::eCOUNT]; + PxReal jointVel[PxArticulationAxis::eCOUNT]; + PxReal frictionCoefficient; + PxReal maxJointVelocity; + PxArticulationJointType::Enum type; + + void initData() + { + parentPose = PxTransform(PxIdentity); + childPose = PxTransform(PxIdentity); + frictionCoefficient = 0.05f; + maxJointVelocity = 100.0f; + type = PxArticulationJointType::eUNDEFINED; // For root + + for(PxU32 i=0;i PxDataAccessFlags; +PX_FLAGS_OPERATORS(PxDataAccessFlag::Enum,PxU8) + + +/** +\brief Parent class for bulk data that is shared between the SDK and the application. +*/ +class PxLockedData +{ +public: + + /** + \brief Any combination of PxDataAccessFlag::eREADABLE and PxDataAccessFlag::eWRITABLE + @see PxDataAccessFlag + */ + virtual PxDataAccessFlags getDataAccessFlags() = 0; + + /** + \brief Unlocks the bulk data. + */ + virtual void unlock() = 0; + + /** + \brief virtual destructor + */ + virtual ~PxLockedData() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxMPMMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxMPMMaterial.h new file mode 100644 index 0000000..3f21ff2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxMPMMaterial.h @@ -0,0 +1,416 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MPM_MATERIAL_H +#define PX_MPM_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxParticleMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief MPM material models + */ + struct PxMPMMaterialModel + { + enum Enum + { + eATTACHED = 1 << 0, //!< Marker to indicate that all particles with an attached material should be treated as attached to whatever object they are located in + eNEO_HOOKEAN = 1 << 1, //!< A Neo-Hookean material model will be used + eELASTIC = 1 << 2, //!< A corotaional cauchy strain based material model will be used + eSNOW = 1 << 3, //!< A corotaional cauchy strain based material model with strain limiting and hardening will be used + eSAND = 1 << 4, //!< A Ducker-Prager elastoplasticity material model will be used + eVON_MISES = 1 << 5 //!< A von Mises material model will be used + }; + }; + + /** + \brief MPM surface types that influence interaction between particles and obstacles + */ + struct PxMPMSurfaceType + { + enum Enum + { + eDEFAULT = 0, //!< Normal surface with friction in tangential direction + eSTICKY = 1 << 0, //!< Surface will always have friction in the tangential and the normal direction + eSLIPPERY = 1 << 1 //!< Surface will not cause any friction + }; + }; + + /** + \brief Optional MPM modes that improve the quality of fracture and/or cutting + */ + struct PxMPMCuttingFlag + { + enum Enum + { + eNONE = 0, //!< No special processing to support cutting will be performed + eSUPPORT_THIN_BLADES = 1 << 0, //!< Special collision detection will be performed to improve support for blade like objects that are thinner than the mpm grid spacing + eENABLE_DAMAGE_TRACKING = 1 << 1 //!< A damage value will get updated on every particle to simulate material weakening to get more realistic crack propagation + }; + }; + typedef PxFlags PxMPMCuttingFlags; + PX_FLAGS_OPERATORS(PxMPMCuttingFlag::Enum,PxU16) + + class PxScene; + + /** + \brief Material class to represent a set of MPM particle material properties. + + @see PxPhysics.createMPMMaterial + */ + class PxMPMMaterial : public PxParticleMaterial + { + public: + /** + \brief Sets stretch and shear damping which dampens stretch and shear motion of MPM bodies. The effect is comparable to viscosity for fluids. + + \param[in] stretchAndShearDamping The stretch and shear damping + + @see getStretchAndShearDamping() + */ + virtual void setStretchAndShearDamping(PxReal stretchAndShearDamping) = 0; + + /** + \brief Retrieves the stretch and shear damping. + + \return The stretch and shear damping + + @see setStretchAndShearDamping() + */ + virtual PxReal getStretchAndShearDamping() const = 0; + + + /** + \brief Sets the rotational damping which dampens rotations of mpm bodies + + \param[in] rotationalDamping The rotational damping + + @see getRotationalDamping() + */ + virtual void setRotationalDamping(PxReal rotationalDamping) = 0; + + /** + \brief Retrieves the rotational damping. + + \return The rotational damping + + @see setRotationalDamping() + */ + virtual PxReal getRotationalDamping() const = 0; + + + /** + \brief Sets density which influences the body's weight + + \param[in] density The material's density + + @see getDensity() + */ + virtual void setDensity(PxReal density) = 0; + + /** + \brief Retrieves the density value. + + \return The density + + @see setDensity() + */ + virtual PxReal getDensity() const = 0; + + + /** + \brief Sets the material model which influences interaction between MPM particles + + \param[in] materialModel The material model + + @see getMaterialModel() + */ + virtual void setMaterialModel(PxMPMMaterialModel::Enum materialModel) = 0; + + /** + \brief Retrieves the material model. + + \return The material model + + @see setMaterialModel() + */ + virtual PxMPMMaterialModel::Enum getMaterialModel() const = 0; + + + /** + \brief Sets the cutting flags which can enable damage tracking or thin blade support + + \param[in] cuttingFlags The cutting flags + + @see getCuttingFlags() + */ + virtual void setCuttingFlags(PxMPMCuttingFlags cuttingFlags) = 0; + + /** + \brief Retrieves the cutting flags. + + \return The cutting flags + + @see setCuttingFlags() + */ + virtual PxMPMCuttingFlags getCuttingFlags() const = 0; + + + /** + \brief Sets the sand friction angle, only applied if the material model is set to sand + + \param[in] sandFrictionAngle The sand friction angle + + @see getSandFrictionAngle() + */ + virtual void setSandFrictionAngle(PxReal sandFrictionAngle) = 0; + + /** + \brief Retrieves the sand friction angle. + + \return The sand friction angle + + @see setSandFrictionAngle() + */ + virtual PxReal getSandFrictionAngle() const = 0; + + + /** + \brief Sets the yield stress, only applied if the material model is set to Von Mises + + \param[in] yieldStress The yield stress + + @see getYieldStress() + */ + virtual void setYieldStress(PxReal yieldStress) = 0; + + + /** + \brief Retrieves the yield stress. + + \return The yield stress + + @see setYieldStress() + */ + virtual PxReal getYieldStress() const = 0; + + + /** + \brief Set material to plastic + + \param[in] isPlastic True if plastic + + @see getIsPlastic() + */ + virtual void setIsPlastic(bool isPlastic) = 0; + + /** + \brief Returns true if material is plastic + + \return True if plastic + + @see setIsPlastic() + */ + virtual bool getIsPlastic() const = 0; + + /** + \brief Sets Young's modulus which defines the body's stiffness + + \param[in] young Young's modulus. Range: [0, PX_MAX_F32) + + @see getYoungsModulus() + */ + virtual void setYoungsModulus(PxReal young) = 0; + + /** + \brief Retrieves the Young's modulus value. + + \return The Young's modulus value. + + @see setYoungsModulus() + */ + virtual PxReal getYoungsModulus() const = 0; + + /** + \brief Sets Poisson's ratio defines the body's volume preservation. Completely incompressible materials have a Poisson ratio of 0.5 which will lead to numerical problems. + + \param[in] poisson Poisson's ratio. Range: [0, 0.5) + + @see getPoissons() + */ + virtual void setPoissons(PxReal poisson) = 0; + + /** + \brief Retrieves the Poisson's ratio. + \return The Poisson's ratio. + + @see setPoissons() + */ + virtual PxReal getPoissons() const = 0; + + /** + \brief Sets material hardening coefficient + + Tendency to get more rigid under compression. Range: [0, PX_MAX_F32) + + \param[in] hardening Material hardening coefficient. + + @see getHardening + */ + virtual void setHardening(PxReal hardening) = 0; + + /** + \brief Retrieves the hardening coefficient. + + \return The hardening coefficient. + + @see setHardening() + */ + virtual PxReal getHardening() const = 0; + + /** + \brief Sets material critical compression coefficient + + Compression clamping threshold (higher means more compression is allowed before yield). Range: [0, 1) + + \param[in] criticalCompression Material critical compression coefficient. + + @see getCriticalCompression + */ + virtual void setCriticalCompression(PxReal criticalCompression) = 0; + + /** + \brief Retrieves the critical compression coefficient. + + \return The criticalCompression coefficient. + + @see setCriticalCompression() + */ + virtual PxReal getCriticalCompression() const = 0; + + /** + \brief Sets material critical stretch coefficient + + Stretch clamping threshold (higher means more stretching is allowed before yield). Range: [0, 1] + + \param[in] criticalStretch Material critical stretch coefficient. + + @see getCriticalStretch + */ + virtual void setCriticalStretch(PxReal criticalStretch) = 0; + + /** + \brief Retrieves the critical stretch coefficient. + + \return The criticalStretch coefficient. + + @see setCriticalStretch() + */ + virtual PxReal getCriticalStretch() const = 0; + + /** + \brief Sets material tensile damage sensitivity coefficient + + Sensitivity to tensile loads. The higher the sensitivity, the quicker damage will occur under tensile loads. Range: [0, PX_MAX_U32) + + \param[in] tensileDamageSensitivity Material tensile damage sensitivity coefficient. + + @see getTensileDamageSensitivity + */ + virtual void setTensileDamageSensitivity(PxReal tensileDamageSensitivity) = 0; + + /** + \brief Retrieves the tensile damage sensitivity coefficient. + + \return The tensileDamageSensitivity coefficient. + + @see setTensileDamageSensitivity() + */ + virtual PxReal getTensileDamageSensitivity() const = 0; + + /** + \brief Sets material compressive damage sensitivity coefficient + + Sensitivity to compressive loads. The higher the sensitivity, the quicker damage will occur under compressive loads Range: [0, PX_MAX_U32) + + \param[in] compressiveDamageSensitivity Material compressive damage sensitivity coefficient. + + @see getCompressiveDamageSensitivity + */ + virtual void setCompressiveDamageSensitivity(PxReal compressiveDamageSensitivity) = 0; + + /** + \brief Retrieves the compressive damage sensitivity coefficient. + + \return The compressiveDamageSensitivity coefficient. + + @see setCompressiveDamageSensitivity() + */ + virtual PxReal getCompressiveDamageSensitivity() const = 0; + + /** + \brief Sets material attractive force residual coefficient + + Relative amount of attractive force a fully damaged particle can exert on other particles compared to an undamaged one. Range: [0, 1] + + \param[in] attractiveForceResidual Material attractive force residual coefficient. + + @see getAttractiveForceResidual + */ + virtual void setAttractiveForceResidual(PxReal attractiveForceResidual) = 0; + + /** + \brief Retrieves the attractive force residual coefficient. + \return The attractiveForceResidual coefficient. + + @see setAttractiveForceResidual() + */ + virtual PxReal getAttractiveForceResidual() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxMPMMaterial"; } + + protected: + PX_INLINE PxMPMMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxParticleMaterial(concreteType, baseFlags) {} + PX_INLINE PxMPMMaterial(PxBaseFlags baseFlags) : PxParticleMaterial(baseFlags) {} + virtual ~PxMPMMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxMPMMaterial", name) || PxParticleMaterial::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxMaterial.h new file mode 100644 index 0000000..f862dd8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxMaterial.h @@ -0,0 +1,358 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MATERIAL_H +#define PX_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxBaseMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxScene; + +/** +\brief Flags which control the behavior of a material. + +@see PxMaterial +*/ +struct PxMaterialFlag +{ + enum Enum + { + + /** + \brief If this flag is set, friction computations are always skipped between shapes with this material and any other shape. + */ + eDISABLE_FRICTION = 1 << 0, + + /** + \brief Whether to use strong friction. + The difference between "normal" and "strong" friction is that the strong friction feature + remembers the "friction error" between simulation steps. The friction is a force trying to + hold objects in place (or slow them down) and this is handled in the solver. But since the + solver is only an approximation, the result of the friction calculation can include a small + "error" - e.g. a box resting on a slope should not move at all if the static friction is in + action, but could slowly glide down the slope because of a small friction error in each + simulation step. The strong friction counter-acts this by remembering the small error and + taking it to account during the next simulation step. + + However, in some cases the strong friction could cause problems, and this is why it is + possible to disable the strong friction feature by setting this flag. One example is + raycast vehicles that are sliding fast across the surface, but still need a precise + steering behavior. It may be a good idea to reenable the strong friction when objects + are coming to a rest, to prevent them from slowly creeping down inclines. + + Note: This flag only has an effect if the PxMaterialFlag::eDISABLE_FRICTION bit is 0. + */ + eDISABLE_STRONG_FRICTION = 1 << 1, + + /** + \brief Whether to use the patch friction model. + This flag only has an effect if PxFrictionType::ePATCH friction model is used. + + When using the patch friction model, up to 2 friction anchors are generated per patch. As the number of friction anchors + can be smaller than the number of contacts, the normal force is accumulated over all contacts and used to compute friction + for all anchors. Where there are more than 2 anchors, this can produce frictional behavior that is too strong (approximately 2x as strong + as analytical models suggest). + + This flag causes the normal force to be distributed between the friction anchors such that the total amount of friction applied does not + exceed the analytical results. + */ + eIMPROVED_PATCH_FRICTION = 1 << 2, + + /** + \brief This flag has the effect of enabling an implicit spring model for the normal force computation. + @see PxMaterial.setRestitution, PxMaterial.setDamping + */ + eCOMPLIANT_CONTACT = 1 << 3 + }; +}; + +/** +\brief collection of set bits defined in PxMaterialFlag. + +@see PxMaterialFlag +*/ +typedef PxFlags PxMaterialFlags; +PX_FLAGS_OPERATORS(PxMaterialFlag::Enum,PxU16) + + +/** +\brief Enumeration that determines the way in which two material properties will be combined to yield a friction or restitution coefficient for a collision. + +When two actors come in contact with each other, they each have materials with various coefficients, but we only need a single set of coefficients for the pair. + +Physics doesn't have any inherent combinations because the coefficients are determined empirically on a case by case +basis. However, simulating this with a pairwise lookup table is often impractical. + +For this reason the following combine behaviors are available: + +eAVERAGE +eMIN +eMULTIPLY +eMAX + +The effective combine mode for the pair is maximum(material0.combineMode, material1.combineMode). + +@see PxMaterial.setFrictionCombineMode() PxMaterial.getFrictionCombineMode() PxMaterial.setRestitutionCombineMode() PxMaterial.getFrictionCombineMode() +*/ +struct PxCombineMode +{ + enum Enum + { + eAVERAGE = 0, //!< Average: (a + b)/2 + eMIN = 1, //!< Minimum: minimum(a,b) + eMULTIPLY = 2, //!< Multiply: a*b + eMAX = 3, //!< Maximum: maximum(a,b) + eN_VALUES = 4, //!< This is not a valid combine mode, it is a sentinel to denote the number of possible values. We assert that the variable's value is smaller than this. + ePAD_32 = 0x7fffffff //!< This is not a valid combine mode, it is to assure that the size of the enum type is big enough. + }; +}; + +/** +\brief Material class to represent a set of surface properties. + +@see PxPhysics.createMaterial +*/ +class PxMaterial : public PxBaseMaterial +{ +public: + + /** + \brief Sets the coefficient of dynamic friction. + + The coefficient of dynamic friction should be in [0, PX_MAX_F32). If set to greater than staticFriction, the effective value of staticFriction will be increased to match. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] coef Coefficient of dynamic friction. Range: [0, PX_MAX_F32) + + @see getDynamicFriction() + */ + virtual void setDynamicFriction(PxReal coef) = 0; + + /** + \brief Retrieves the DynamicFriction value. + + \return The coefficient of dynamic friction. + + @see setDynamicFriction + */ + virtual PxReal getDynamicFriction() const = 0; + + /** + \brief Sets the coefficient of static friction + + The coefficient of static friction should be in the range [0, PX_MAX_F32) + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] coef Coefficient of static friction. Range: [0, PX_MAX_F32) + + @see getStaticFriction() + */ + virtual void setStaticFriction(PxReal coef) = 0; + + /** + \brief Retrieves the coefficient of static friction. + \return The coefficient of static friction. + + @see setStaticFriction + */ + virtual PxReal getStaticFriction() const = 0; + + /** + \brief Sets the coefficient of restitution + + A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce. + + This property is overloaded when PxMaterialFlag::eCOMPLIANT_CONTACT flag is enabled. This permits negative values for restitution to be provided. + The negative values are converted into spring stiffness terms for an implicit spring simulated at the contact site, with the spring positional error defined by + the contact separation value. Higher stiffness terms produce stiffer springs that behave more like a rigid contact. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] rest Coefficient of restitution. Range: [-INF,1] + + @see getRestitution() + */ + virtual void setRestitution(PxReal rest) = 0; + + /** + \brief Retrieves the coefficient of restitution. + + See #setRestitution. + + \return The coefficient of restitution. + + @see setRestitution() + */ + virtual PxReal getRestitution() const = 0; + + + /** + \brief Sets the coefficient of damping + + This property only affects the simulation if PxMaterialFlag::eCOMPLIANT_CONTACT is raised. + Damping works together with spring stiffness (set through a negative restitution value). Spring stiffness corrects positional error while + damping resists relative velocity. Setting a high damping coefficient can produce spongy contacts. + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] damping Coefficient of damping. Range: [0,INF] + + @see getDamping() + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Retrieves the coefficient of damping. + + See #setDamping. + + \return The coefficient of damping. + + @see setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Raises or clears a particular material flag. + + See the list of flags #PxMaterialFlag + + Default: eIMPROVED_PATCH_FRICTION + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] flag The PxMaterial flag to raise(set) or clear. + \param[in] b New state of the flag + + @see getFlags() setFlags() PxMaterialFlag + */ + virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0; + + /** + \brief sets all the material flags. + + See the list of flags #PxMaterialFlag + + Default: eIMPROVED_PATCH_FRICTION + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] flags All PxMaterial flags + + @see getFlags() setFlag() PxMaterialFlag + */ + virtual void setFlags(PxMaterialFlags flags) = 0; + + /** + \brief Retrieves the flags. See #PxMaterialFlag. + + \return The material flags. + + @see PxMaterialFlag setFlags() + */ + virtual PxMaterialFlags getFlags() const = 0; + + /** + \brief Sets the friction combine mode. + + See the enum ::PxCombineMode . + + Default: PxCombineMode::eAVERAGE + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] combMode Friction combine mode to set for this material. See #PxCombineMode. + + @see PxCombineMode getFrictionCombineMode setStaticFriction() setDynamicFriction() + */ + virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0; + + /** + \brief Retrieves the friction combine mode. + + See #setFrictionCombineMode. + + \return The friction combine mode for this material. + + @see PxCombineMode setFrictionCombineMode() + */ + virtual PxCombineMode::Enum getFrictionCombineMode() const = 0; + + /** + \brief Sets the restitution combine mode. + + See the enum ::PxCombineMode . + + Default: PxCombineMode::eAVERAGE + + Sleeping: Does NOT wake any actors which may be affected. + + \param[in] combMode Restitution combine mode for this material. See #PxCombineMode. + + @see PxCombineMode getRestitutionCombineMode() setRestitution() + */ + virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0; + + /** + \brief Retrieves the restitution combine mode. + + See #setRestitutionCombineMode. + + \return The coefficient of restitution combine mode for this material. + + @see PxCombineMode setRestitutionCombineMode getRestitution() + */ + virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0; + + // PxBase + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxMaterial"; } + //~PxBase + +protected: + PX_INLINE PxMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {} + PX_INLINE PxMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {} + virtual ~PxMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxMaterial", name) || PxBaseMaterial::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxNodeIndex.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxNodeIndex.h new file mode 100644 index 0000000..dda4d6b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxNodeIndex.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_NODEINDEX_H +#define PX_NODEINDEX_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#define PX_INVALID_NODE 0xFFFFFFFFu + + + /** + \brief PxNodeIndex + + Node index is the unique index for each actor referenced by the island gen. It contains details like + if the actor is an articulation or rigid body. If it is an articulation, the node index also contains + the link index of the rigid body within the articulation. Also, it contains information to detect whether + the rigid body is static body or not + */ + class PxNodeIndex + { + protected: + PxU64 ind; + + public: + + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxNodeIndex(PxU32 id, PxU32 articLinkId) : ind((PxU64(id) << 32) | (articLinkId << 1) | 1) + { + } + + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxNodeIndex(PxU32 id = PX_INVALID_NODE) : ind((PxU64(id) << 32)) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 index() const { return PxU32(ind >> 32); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 articulationLinkId() const { return PxU32((ind >> 1) & 0x7FFFFFFF); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 isArticulation() const { return PxU32(ind & 1); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isStaticBody() const { return PxU32(ind >> 32) == PX_INVALID_NODE; } + + PX_CUDA_CALLABLE bool isValid() const { return PxU32(ind >> 32) != PX_INVALID_NODE; } + + PX_CUDA_CALLABLE void setIndices(PxU32 index, PxU32 articLinkId) { ind = ((PxU64(index) << 32) | (articLinkId << 1) | 1); } + + PX_CUDA_CALLABLE void setIndices(PxU32 index) { ind = ((PxU64(index) << 32)); } + + PX_CUDA_CALLABLE bool operator < (const PxNodeIndex& other) const { return ind < other.ind; } + + PX_CUDA_CALLABLE bool operator <= (const PxNodeIndex& other) const { return ind <= other.ind; } + + PX_CUDA_CALLABLE bool operator == (const PxNodeIndex& other) const { return ind == other.ind; } + + PX_CUDA_CALLABLE PxU64 getInd() const { return ind; } + }; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDMaterial.h new file mode 100644 index 0000000..2aea60b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDMaterial.h @@ -0,0 +1,231 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PBD_MATERIAL_H +#define PX_PBD_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "PxParticleMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + /** + \brief Material class to represent a set of PBD particle material properties. + + @see #PxPhysics.createPBDMaterial + */ + class PX_DEPRECATED PxPBDMaterial : public PxParticleMaterial + { + public: + + /** + \brief Sets viscosity + + \param[in] viscosity Viscosity. Range: [0, PX_MAX_F32) + + @see #getViscosity() + */ + virtual void setViscosity(PxReal viscosity) = 0; + + /** + \brief Retrieves the viscosity value. + + \return The viscosity value. + + @see #setViscosity() + */ + virtual PxReal getViscosity() const = 0; + + /** + \brief Sets material vorticity confinement coefficient + + \param[in] vorticityConfinement Material vorticity confinement coefficient. Range: [0, PX_MAX_F32) + + @see #getVorticityConfinement() + */ + virtual void setVorticityConfinement(PxReal vorticityConfinement) = 0; + + /** + \brief Retrieves the vorticity confinement coefficient. + \return The vorticity confinement coefficient. + + @see #setVorticityConfinement() + */ + virtual PxReal getVorticityConfinement() const = 0; + + /** + \brief Sets material surface tension coefficient + + \param[in] surfaceTension Material surface tension coefficient. Range: [0, PX_MAX_F32) + + @see #getSurfaceTension() + */ + virtual void setSurfaceTension(PxReal surfaceTension) = 0; + + /** + \brief Retrieves the surface tension coefficient. + \return The surface tension coefficient. + + @see #setSurfaceTension() + */ + virtual PxReal getSurfaceTension() const = 0; + + /** + \brief Sets material cohesion coefficient + + \param[in] cohesion Material cohesion coefficient. Range: [0, PX_MAX_F32) + + @see #getCohesion() + */ + virtual void setCohesion(PxReal cohesion) = 0; + + /** + \brief Retrieves the cohesion coefficient. + \return The cohesion coefficient. + + @see #setCohesion() + */ + virtual PxReal getCohesion() const = 0; + + /** + \brief Sets material lift coefficient + + \param[in] lift Material lift coefficient. Range: [0, PX_MAX_F32) + + @see #getLift() + */ + virtual void setLift(PxReal lift) = 0; + + /** + \brief Retrieves the lift coefficient. + \return The lift coefficient. + + @see #setLift() + */ + virtual PxReal getLift() const = 0; + + /** + \brief Sets material drag coefficient + + \param[in] drag Material drag coefficient. Range: [0, PX_MAX_F32) + + @see #getDrag() + */ + virtual void setDrag(PxReal drag) = 0; + + /** + \brief Retrieves the drag coefficient. + \return The drag coefficient. + + @see #setDrag() + */ + virtual PxReal getDrag() const = 0; + + /** + \brief Sets the CFL coefficient. + + \param[in] coefficient CFL coefficient. This coefficient scales the CFL term used to limit relative motion between fluid particles. Range: [1.f, PX_MAX_F32) + */ + virtual void setCFLCoefficient(PxReal coefficient) = 0; + + /** + \brief Retrieves the CFL coefficient. + \return The CFL coefficient. + + @see #setCFLCoefficient() + */ + virtual PxReal getCFLCoefficient() const = 0; + + /** + \brief Sets material particle friction scale. This allows the application to scale up/down the frictional effect between particles independent of the friction + coefficient, which also defines frictional behavior between the particle and rigid bodies/soft bodies/cloth etc. + + \param[in] scale particle friction scale. Range: [0, PX_MAX_F32) + + @see #getParticleFrictionScale() + */ + virtual void setParticleFrictionScale(PxReal scale) = 0; + + /** + \brief Retrieves the particle friction scale. + \return The particle friction scale. + + @see #setParticleFrictionScale() + */ + virtual PxReal getParticleFrictionScale() const = 0; + + /** + \brief Sets material particle adhesion scale value. This is the adhesive value between particles defined as a scaled multiple of the adhesion parameter. + + \param[in] adhesion particle adhesion scale value. Range: [0, PX_MAX_F32) + + @see #getParticleAdhesionScale() + */ + virtual void setParticleAdhesionScale(PxReal adhesion) = 0; + + /** + \brief Retrieves the particle adhesion scale value. + \return The particle adhesion scale value. + + @see #setParticleAdhesionScale() + */ + virtual PxReal getParticleAdhesionScale() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxPBDMaterial"; } + + protected: + PX_INLINE PxPBDMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxParticleMaterial(concreteType, baseFlags) {} + PX_INLINE PxPBDMaterial(PxBaseFlags baseFlags) : PxParticleMaterial(baseFlags) {} + virtual ~PxPBDMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxPBDMaterial", name) || PxParticleMaterial::isKindOf(name); } + }; + + class PX_DEPRECATED PxCustomMaterial : public PxParticleMaterial + { + public: + + virtual const char* getConcreteTypeName() const { return "PxCustomMaterial"; } + + protected: + PX_INLINE PxCustomMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxParticleMaterial(concreteType, baseFlags) {} + PX_INLINE PxCustomMaterial(PxBaseFlags baseFlags) : PxParticleMaterial(baseFlags) {} + virtual ~PxCustomMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxCustomMaterial", name) || PxParticleMaterial::isKindOf(name); } + }; +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDParticleSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDParticleSystem.h new file mode 100644 index 0000000..daaf817 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPBDParticleSystem.h @@ -0,0 +1,153 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PBD_PARTICLE_SYSTEM_H +#define PX_PBD_PARTICLE_SYSTEM_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "foundation/PxVec3.h" + +#include "PxParticleSystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + +/** +\brief A particle system that uses the position based dynamics(PBD) solver. + +The position based dynamics solver for particle systems supports behaviors like +fluid, cloth, inflatables etc. + +*/ +class PxPBDParticleSystem : public PxParticleSystem +{ +public: + + virtual ~PxPBDParticleSystem() {} + + /** + \brief Set wind direction and intensity + + \param[in] wind The wind direction and intensity + */ + virtual void setWind(const PxVec3& wind) = 0; + + /** + \brief Retrieves the wind direction and intensity. + + \return The wind direction and intensity + */ + virtual PxVec3 getWind() const = 0; + + /** + \brief Set the fluid boundary density scale + + Defines how strong of a contribution the boundary (typically a rigid surface) should have on a fluid particle's density. + + \param[in] fluidBoundaryDensityScale Range: (0.0, 1.0) + */ + virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) = 0; + + /** + \brief Return the fluid boundary density scale + \return the fluid boundary density scale + + See #setFluidBoundaryDensityScale() + */ + virtual PxReal getFluidBoundaryDensityScale() const = 0; + + /** + \brief Set the fluid rest offset + + Two fluid particles will come to rest at a distance equal to twice the fluidRestOffset value. + + \param[in] fluidRestOffset Range: (0, particleContactOffset) + */ + virtual void setFluidRestOffset(PxReal fluidRestOffset) = 0; + + /** + \brief Return the fluid rest offset + \return the fluid rest offset + + See #setFluidRestOffset() + */ + virtual PxReal getFluidRestOffset() const = 0; + + /** + \brief Set the particle system grid size x dimension + + \param[in] gridSizeX x dimension in the particle grid + */ + virtual void setGridSizeX(PxU32 gridSizeX) = 0; + + /** + \brief Set the particle system grid size y dimension + + \param[in] gridSizeY y dimension in the particle grid + */ + virtual void setGridSizeY(PxU32 gridSizeY) = 0; + + /** + \brief Set the particle system grid size z dimension + + \param[in] gridSizeZ z dimension in the particle grid + */ + virtual void setGridSizeZ(PxU32 gridSizeZ) = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxPBDParticleSystem"; } + +protected: + PX_INLINE PxPBDParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxParticleSystem(concreteType, baseFlags) {} + PX_INLINE PxPBDParticleSystem(PxBaseFlags baseFlags) : PxParticleSystem(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxPBDParticleSystem", name) || PxParticleSystem::isKindOf(name); } +}; + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleBuffer.h new file mode 100644 index 0000000..9746fbf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleBuffer.h @@ -0,0 +1,608 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_BUFFER_H +#define PX_PARTICLE_BUFFER_H +/** \addtogroup physics +@{ */ + +#include "common/PxBase.h" +#include "common/PxPhysXCommonConfig.h" +#include "common/PxTypeInfo.h" + +#include "PxParticleSystemFlag.h" + +#include "foundation/PxBounds3.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + +class PxCudaContextManager; +struct PxParticleRigidFilterPair; +struct PxParticleRigidAttachment; + +/** +\brief Particle volume structure. Used to track the bounding volume of a user-specified set of particles. The particles are required +to be laid out contiguously within the same PxParticleBuffer. +*/ +PX_ALIGN_PREFIX(16) +struct PxParticleVolume +{ + PxBounds3 bound; //!< The current bounds of the particles contained in this #PxParticleVolume. + PxU32 particleIndicesOffset; //!< The index into the particle list of the #PxParticleBuffer for the first particle of this volume. + PxU32 numParticles; //!< The number of particles contained in this #PxParticleVolume. +} PX_ALIGN_SUFFIX(16); + + +/** +\brief The shared base class for all particle buffers, can be instantiated directly to simulate granular and fluid particles. + +See #PxPhysics::createParticleBuffer. + +A particle buffer is a container that specifies per-particle attributes of a set of particles that will be used during the simulation +of a particle system. It exposes direct access to the underlying GPU buffers and is independent of the scene and particle system. Particle +buffers can be added/removed from a particle system at any time between simulation steps, and transferred from one particle system to another. +*/ +class PX_DEPRECATED PxParticleBuffer : public PxBase +{ +public: + + /** + \brief Get positions and inverse masses for this particle buffer. + \return A pointer to a device buffer containing the positions and inverse mass packed as PxVec4(pos.x, pos.y, pos.z, inverseMass). + */ + virtual PxVec4* getPositionInvMasses() const = 0; + + /** + \brief Get velocities for this particle buffer. + \return A pointer to a device buffer containing the velocities packed as PxVec4(vel.x, vel.y, vel.z, 0.0f). + */ + virtual PxVec4* getVelocities() const = 0; + + /** + \brief Get phases for this particle buffer. + + See #PxParticlePhase + + \return A pointer to a device buffer containing the per-particle phases for this particle buffer. + */ + virtual PxU32* getPhases() const = 0; + + /** + \brief Get particle volumes for this particle buffer. + + See #PxParticleVolume + + \return A pointer to a device buffer containing the #PxParticleVolume s for this particle buffer. + */ + virtual PxParticleVolume* getParticleVolumes() const = 0; + + /** + \brief Set the number of active particles for this particle buffer. + \param[in] nbActiveParticles The number of active particles. + + The number of active particles can be <= PxParticleBuffer::getMaxParticles(). The particle system will simulate the first + x particles in the #PxParticleBuffer, where x is the number of active particles. + */ + virtual void setNbActiveParticles(PxU32 nbActiveParticles) = 0; + + /** + \brief Get the number of active particles for this particle buffer. + \return The number of active particles. + */ + virtual PxU32 getNbActiveParticles() const = 0; + + /** + \brief Get the maximum number particles this particle buffer can hold. + + The maximum number of particles is specified when creating a #PxParticleBuffer. See #PxPhysics::createParticleBuffer. + + \return The maximum number of particles. + */ + virtual PxU32 getMaxParticles() const = 0; + + /** + \brief Get the number of particle volumes in this particle buffer. + \return The number of #PxParticleVolume s for this particle buffer. + */ + virtual PxU32 getNbParticleVolumes() const = 0; + + /** + \brief Set the number of #PxParticleVolume s for this particle buffer. + \param[in] nbParticleVolumes The number of particle volumes in this particle buffer. + */ + virtual void setNbParticleVolumes(PxU32 nbParticleVolumes) = 0; + + /** + \brief Get the maximum number of particle volumes this particle buffer can hold. + + See #PxParticleVolume. + + \return The maximum number of particle volumes this particle buffer can hold. + */ + virtual PxU32 getMaxParticleVolumes() const = 0; + + /** + \brief Set the #PxParticleRigidFilterPair s for collision filtering of particles in this buffer with rigid bodies. + + See #PxParticleRigidFilterPair + + \param[in] filters A device buffer containing #PxParticleRigidFilterPair s. + \param[in] nbFilters The number of particle-rigid body collision filtering pairs. + */ + virtual void setRigidFilters(PxParticleRigidFilterPair* filters, PxU32 nbFilters) = 0; + + /** + \brief Set the particle-rigid body attachments for particles in this particle buffer. + + See #PxParticleRigidAttachment + + \param[in] attachments A device buffer containing #PxParticleRigidAttachment s. + \param[in] nbAttachments The number of particle-rigid body attachments. + */ + virtual void setRigidAttachments(PxParticleRigidAttachment* attachments, PxU32 nbAttachments) = 0; + + /** + \brief Get the start index for the first particle of this particle buffer in the complete list of + particles of the particle system this buffer is used in. + + The return value is only correct if the particle buffer is assigned to a particle system and at least + one call to simulate() has been performed. + + \return The index of the first particle in the complete particle list. + */ + virtual PxU32 getFlatListStartIndex() const = 0; + + /** + \brief Raise dirty flags on this particle buffer to communicate that the corresponding data has been updated + by the user. + \param[in] flags The flag corresponding to the data that is dirty. + + See #PxParticleBufferFlag. + */ + virtual void raiseFlags(PxParticleBufferFlag::Enum flags) = 0; + + /** + \brief Release this buffer and deallocate all the memory. + */ + virtual void release() = 0; + + /** + \brief Cleanup helper used in case a particle system is released before the particle buffers have been removed. + */ + virtual void onParticleSystemDestroy() = 0; + + /** + \brief Reserved for internal use. + */ + virtual void setInternalData(void* data) = 0; + + /** + \brief Index of this buffer in the particle system it is assigned to. + */ + PxU32 bufferIndex; + + /** + \brief Unique index that does not change over the lifetime of a PxParticleBuffer. + */ + const PxU32 bufferUniqueId; + +protected: + + virtual ~PxParticleBuffer() { } + PX_INLINE PxParticleBuffer(PxU32 uniqueId) : PxBase(PxConcreteType::ePARTICLE_BUFFER, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), bufferIndex(0xffffffff), bufferUniqueId(uniqueId){} + PX_INLINE PxParticleBuffer(PxU32 uniqueId, PxType type) : PxBase(type, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), bufferIndex(0xffffffff), bufferUniqueId(uniqueId){} + +private: + PX_NOCOPY(PxParticleBuffer) +}; + +/** +\brief Parameters to configure the behavior of diffuse particles +*/ +class PxDiffuseParticleParams +{ +public: + /** + \brief Construct parameters with default values. + */ + PX_INLINE PxDiffuseParticleParams() + { + threshold = 100.0f; + lifetime = 5.0f; + airDrag = 0.0f; + bubbleDrag = 0.5f; + buoyancy = 0.8f; + kineticEnergyWeight = 0.01f; + pressureWeight = 1.0f; + divergenceWeight = 5.0f; + collisionDecay = 0.5f; + useAccurateVelocity = false; + } + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault() + { + *this = PxDiffuseParticleParams(); + } + + PxReal threshold; //!< Particles with potential value greater than the threshold will spawn diffuse particles + PxReal lifetime; //!< Diffuse particle will be removed after the specified lifetime + PxReal airDrag; //!< Air drag force factor for spray particles + PxReal bubbleDrag; //!< Fluid drag force factor for bubble particles + PxReal buoyancy; //!< Buoyancy force factor for bubble particles + PxReal kineticEnergyWeight; //!< Contribution from kinetic energy when deciding diffuse particle creation. + PxReal pressureWeight; //!< Contribution from pressure when deciding diffuse particle creation. + PxReal divergenceWeight; //!< Contribution from divergence when deciding diffuse particle creation. + PxReal collisionDecay; //!< Decay factor of diffuse particles' lifetime after they collide with shapes. + bool useAccurateVelocity; //!< If true, enables accurate velocity estimation when using PBD solver. +}; + +/** +\brief A particle buffer used to simulate diffuse particles. + +See #PxPhysics::createParticleAndDiffuseBuffer. +*/ +class PX_DEPRECATED PxParticleAndDiffuseBuffer : public PxParticleBuffer +{ +public: + + /** + \brief Get a device buffer of positions and remaining lifetimes for the diffuse particles. + \return A device buffer containing positions and lifetimes of diffuse particles packed as PxVec4(pos.x, pos.y, pos.z, lifetime). + */ + virtual PxVec4* getDiffusePositionLifeTime() const = 0; + + /** + \brief Get number of currently active diffuse particles. + \return The number of currently active diffuse particles. + */ + virtual PxU32 getNbActiveDiffuseParticles() const = 0; + + /** + \brief Set the maximum possible number of diffuse particles for this buffer. + \param[in] maxActiveDiffuseParticles the maximum number of active diffuse particles. + + \note Must be in the range [0, PxParticleAndDiffuseBuffer::getMaxDiffuseParticles()] + */ + virtual void setMaxActiveDiffuseParticles(PxU32 maxActiveDiffuseParticles) = 0; + + /** + \brief Get maximum possible number of diffuse particles. + \return The maximum possible number diffuse particles. + */ + virtual PxU32 getMaxDiffuseParticles() const = 0; + + /** + \brief Set the parameters for diffuse particle simulation. + \param[in] params The diffuse particle parameters. + + See #PxDiffuseParticleParams + */ + virtual void setDiffuseParticleParams(const PxDiffuseParticleParams& params) = 0; + + /** + \brief Get the parameters currently used for diffuse particle simulation. + \return A PxDiffuseParticleParams structure. + */ + virtual PxDiffuseParticleParams getDiffuseParticleParams() const = 0; + +protected: + + virtual ~PxParticleAndDiffuseBuffer() {} + PX_INLINE PxParticleAndDiffuseBuffer(PxU32 uniqueId) : PxParticleBuffer(uniqueId, PxConcreteType::ePARTICLE_DIFFUSE_BUFFER){} + +private: + PX_NOCOPY(PxParticleAndDiffuseBuffer) +}; + +/** +\brief Holds all the information for a spring constraint between two particles. Used for particle cloth simulation. +*/ +struct PX_ALIGN_PREFIX(8) PxParticleSpring +{ + PxU32 ind0; //!< particle index of first particle + PxU32 ind1; //!< particle index of second particle + PxReal length; //!< spring length + PxReal stiffness; //!< spring stiffness + PxReal damping; //!< spring damping factor + PxReal pad; //!< padding bytes. +} PX_ALIGN_SUFFIX(8); + +/** +\brief Particle cloth structure. Holds information about a single piece of cloth that is part of a #PxParticleClothBuffer. +*/ +struct PX_DEPRECATED PxParticleCloth +{ + PxU32 startVertexIndex; //!< Index of the first particle of this cloth in the position/velocity buffers of the parent #PxParticleClothBuffer + PxU32 numVertices; //!< The number of particles of this piece of cloth + PxReal clothBlendScale; //!< Used internally. + PxReal restVolume; //!< The rest volume of this piece of cloth, used for inflatable simulation. + PxReal pressure; //!< The factor of the rest volume to specify the target volume for this piece of cloth, used for inflatable simulation. + PxU32 startTriangleIndex; //!< The index of the first triangle of this piece of cloth in the triangle list. + PxU32 numTriangles; //!< The number of triangles of this piece of cloth. + + bool operator <= (const PxParticleCloth& other) const { return startVertexIndex <= other.startVertexIndex; } + bool operator >= (const PxParticleCloth& other) const { return startVertexIndex >= other.startVertexIndex; } + bool operator < (const PxParticleCloth& other) const { return startVertexIndex < other.startVertexIndex; } + bool operator > (const PxParticleCloth& other) const { return startVertexIndex > other.startVertexIndex; } + bool operator == (const PxParticleCloth& other) const { return startVertexIndex == other.startVertexIndex; } +}; + +/** +\brief Structure to describe the set of particle cloths in the same #PxParticleClothBuffer. Used an input for the cloth preprocessing. +*/ +struct PX_DEPRECATED PxParticleClothDesc +{ + PxParticleClothDesc() : cloths(NULL), triangles(NULL), springs(NULL), restPositions(NULL), + nbCloths(0), nbSprings(0), nbTriangles(0), nbParticles(0) + { + } + + PxParticleCloth* cloths; //!< List of PxParticleCloth s, describes the individual cloths. + PxU32* triangles; //!< List of triangle indices, 3 consecutive PxU32 that map triangle vertices to particles + PxParticleSpring* springs; //!< List of PxParticleSpring s. + PxVec4* restPositions; //!< List of rest positions for all particles + PxU32 nbCloths; //!< The number of cloths in described using this cloth descriptor + PxU32 nbSprings; //!< The number of springs in this cloth descriptor + PxU32 nbTriangles; //!< The number of triangles in this cloth descriptor + PxU32 nbParticles; //!< The number of particles in this cloth descriptor +}; + +/** +\brief Structure to describe the output of the particle cloth preprocessing. Used as an input to specify cloth data for a #PxParticleClothBuffer. +All the pointers point to pinned host memory. + +See #PxParticleClothPreProcessor +*/ +struct PX_DEPRECATED PX_PHYSX_CORE_API PxPartitionedParticleCloth +{ + PxU32* accumulatedSpringsPerPartitions; //!< The number of springs in each partition. Size: numPartitions. + PxU32* accumulatedCopiesPerParticles; //!< Start index for each particle in the accumulation buffer. Size: numParticles. + PxU32* remapOutput; //!< Index of the next copy of this particle in the next partition, or in the accumulation buffer. Size: numSprings * 2. + PxParticleSpring* orderedSprings; //!< Springs ordered by partition. Size: numSprings. + PxU32* sortedClothStartIndices; //!< The first particle index into the position buffer of the #PxParticleClothBuffer for each cloth. Cloths are sorted by start particle index. Size: numCloths. + PxParticleCloth* cloths; //!< The #PxParticleCloth s sorted by start particle index. + + PxU32 remapOutputSize; //!< Size of remapOutput. + PxU32 nbPartitions; //!< The number of partitions. + PxU32 nbSprings; //!< The number of springs. + PxU32 nbCloths; //!< The number of cloths. + PxU32 maxSpringsPerPartition; //!< The maximum number of springs in a partition. + + PxCudaContextManager* mCudaManager; //!< A cuda context manager. + + PxPartitionedParticleCloth(); + ~PxPartitionedParticleCloth(); + + /** + \brief allocate all the buffers for this #PxPartitionedParticleCloth. + + \param[in] nbParticles the number of particles this #PxPartitionedParticleCloth will be generated for. + \param[in] cudaManager a cuda context manager. + */ + void allocateBuffers(PxU32 nbParticles, PxCudaContextManager* cudaManager); +}; + +/** +\brief A particle buffer used to simulate particle cloth. + +See #PxPhysics::createParticleClothBuffer. +*/ +class PX_DEPRECATED PxParticleClothBuffer : public PxParticleBuffer +{ +public: + + /** + \brief Get rest positions for this particle buffer. + \return A pointer to a device buffer containing the rest positions packed as PxVec4(pos.x, pos.y, pos.z, 0.0f). + */ + virtual PxVec4* getRestPositions() = 0; + + /** + \brief Get the triangle indices for this particle buffer. + \return A pointer to a device buffer containing the triangle indices for this cloth buffer. + */ + virtual PxU32* getTriangles() const = 0; + + /** + \brief Set the number of triangles for this particle buffer. + \param[in] nbTriangles The number of triangles for this particle cloth buffer. + */ + virtual void setNbTriangles(PxU32 nbTriangles) = 0; + + /** + \brief Get the number of triangles for this particle buffer. + \return The number triangles for this cloth buffer. + */ + virtual PxU32 getNbTriangles() const = 0; + + /** + \brief Get the number of springs in this particle buffer. + \return The number of springs in this cloth buffer. + */ + virtual PxU32 getNbSprings() const = 0; + + /** + \brief Get the springs for this particle buffer. + \return A pointer to a device buffer containing the springs for this cloth buffer. + */ + virtual PxParticleSpring* getSprings() = 0; + + /** + \brief Set cloths for this particle buffer. + \param[in] cloths A pointer to a PxPartitionedParticleCloth. + + See #PxPartitionedParticleCloth, #PxParticleClothPreProcessor + */ + virtual void setCloths(PxPartitionedParticleCloth& cloths) = 0; + +protected: + + virtual ~PxParticleClothBuffer() {} + PX_INLINE PxParticleClothBuffer(PxU32 uniqueId) : PxParticleBuffer(uniqueId, PxConcreteType::ePARTICLE_CLOTH_BUFFER) {} + +private: + PX_NOCOPY(PxParticleClothBuffer) +}; + +/** +\brief A particle buffer used to simulate rigid bodies using shape matching with particles. + +See #PxPhysics::createParticleRigidBuffer. +*/ +class PX_DEPRECATED PxParticleRigidBuffer : public PxParticleBuffer +{ +public: + /** + \brief Get the particle indices of the first particle for each shape matched rigid body. + \return A device buffer containing the list of particle start indices of each shape matched rigid body. + */ + virtual PxU32* getRigidOffsets() const = 0; + + /** + \brief Get the stiffness coefficients for all shape matched rigid bodies in this buffer. + + Stiffness must be in the range [0, 1]. + + \return A device buffer containing the list of stiffness coefficients for each rigid body. + */ + virtual PxReal* getRigidCoefficients() const = 0; + + /** + \brief Get the local position of each particle relative to the rigid body's center of mass. + \return A pointer to a device buffer containing the local position for each particle. + */ + virtual PxVec4* getRigidLocalPositions() const = 0; + + /** + \brief Get the world-space translations for all rigid bodies in this buffer. + \return A pointer to a device buffer containing the world-space translations for all shape-matched rigid bodies in this buffer. + */ + virtual PxVec4* getRigidTranslations() const = 0; + + /** + \brief Get the world-space rotation of every shape-matched rigid body in this buffer. + + Rotations are specified as quaternions. + + \return A pointer to a device buffer containing the world-space rotation for every shape-matched rigid body in this buffer. + */ + virtual PxVec4* getRigidRotations() const = 0; + + /** + \brief Get the local space normals for each particle relative to the shape of the corresponding rigid body. + + The 4th component of every PxVec4 should be the negative signed distance of the particle inside its shape. + + \return A pointer to a device buffer containing the local-space normals for each particle. + */ + virtual PxVec4* getRigidLocalNormals() const = 0; + + /** + \brief Set the number of shape matched rigid bodies in this buffer. + \param[in] nbRigids The number of shape matched rigid bodies + */ + virtual void setNbRigids(PxU32 nbRigids) = 0; + + /** + \brief Get the number of shape matched rigid bodies in this buffer. + \return The number of shape matched rigid bodies in this buffer. + */ + virtual PxU32 getNbRigids() const = 0; + +protected: + + virtual ~PxParticleRigidBuffer() {} + PX_INLINE PxParticleRigidBuffer(PxU32 uniqueId) : PxParticleBuffer(uniqueId, PxConcreteType::ePARTICLE_RIGID_BUFFER) {} + +private: + PX_NOCOPY(PxParticleRigidBuffer) +}; + +/** +@brief Preprocessor to prepare particle cloths for simulation. + +Preprocessing is done by calling #PxParticleClothPreProcessor::partitionSprings() on an instance of this class. This will allocate the memory in the +output object, partition the springs and fill all the members of the ouput object. The output can then be passed without +any further modifications to #PxParticleClothBuffer::setCloths(). + +See #PxCreateParticleClothPreprocessor, #PxParticleClothDesc, #PxPartitionedParticleCloth +*/ +class PX_DEPRECATED PxParticleClothPreProcessor +{ +public: + + /** + \brief Release this object and deallocate all the memory. + */ + virtual void release() = 0; + + /** + \brief Partition the spring constraints for particle cloth simulation. + \param[in] clothDesc Reference to a valid #PxParticleClothDesc. + \param[in] output Reference to a #PxPartitionedParticleCloth object. This is the output of the preprocessing and should be passed to a #PxParticleClothBuffer. + */ + virtual void partitionSprings(const PxParticleClothDesc& clothDesc, PxPartitionedParticleCloth& output) = 0; + +protected: + virtual ~PxParticleClothPreProcessor(){} +}; + + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Create a particle cloth preprocessor. +\param[in] cudaContextManager A cuda context manager. + +See #PxParticleClothDesc, #PxPartitionedParticleCloth. +*/ +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API physx::PxParticleClothPreProcessor* PX_CALL_CONV PxCreateParticleClothPreProcessor(physx::PxCudaContextManager* cudaContextManager); + + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleGpu.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleGpu.h new file mode 100644 index 0000000..3201d01 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleGpu.h @@ -0,0 +1,192 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GPU_PARTICLE_SYSTEM_H +#define PX_GPU_PARTICLE_SYSTEM_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" + +#include "PxParticleSystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +@brief Common material properties for particles. See #PxParticleMaterial. + +Accessed by either integration or particle-rigid collisions +*/ +struct PxsParticleMaterialData +{ + PxReal friction; // 4 + PxReal damping; // 8 + PxReal adhesion; // 12 + PxReal gravityScale; // 16 + PxReal adhesionRadiusScale; // 20 +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_SUPPORT_GPU_PHYSX + +struct float4; + +PX_CUDA_CALLABLE inline physx::PxU32 PxGetGroup(physx::PxU32 phase) { return phase & physx::PxParticlePhaseFlag::eParticlePhaseGroupMask; } +PX_CUDA_CALLABLE inline bool PxGetFluid(physx::PxU32 phase) { return (phase & physx::PxParticlePhaseFlag::eParticlePhaseFluid) != 0; } +PX_CUDA_CALLABLE inline bool PxGetSelfCollide(physx::PxU32 phase) { return (phase & physx::PxParticlePhaseFlag::eParticlePhaseSelfCollide) != 0; } +PX_CUDA_CALLABLE inline bool PxGetSelfCollideFilter(physx::PxU32 phase) { return (phase & physx::PxParticlePhaseFlag::eParticlePhaseSelfCollideFilter) != 0; } + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +@brief An iterator class to iterate over the neighbors of a particle during particle system simulation. +*/ +class PxNeighborhoodIterator +{ + + const PxU32* PX_RESTRICT mCollisionIndex; //!< Pointer to the current state of the iterator. + PxU32 mMaxParticles; //!< The maximum number of particles of the particle system this iterator is used on. + +public: + PX_CUDA_CALLABLE PxNeighborhoodIterator(const PxU32* PX_RESTRICT collisionIndex, PxU32 maxParticles) : + mCollisionIndex(collisionIndex), mMaxParticles(maxParticles) + { + } + + PX_CUDA_CALLABLE PxU32 getNextIndex() + { + PxU32 result = *mCollisionIndex; + mCollisionIndex += mMaxParticles; + return result; + } + + PX_INLINE PxNeighborhoodIterator(const PxNeighborhoodIterator& params) + { + mCollisionIndex = params.mCollisionIndex; + mMaxParticles = params.mMaxParticles; + } + + PX_INLINE void operator = (const PxNeighborhoodIterator& params) + { + mCollisionIndex = params.mCollisionIndex; + mMaxParticles = params.mMaxParticles; + } +}; + +/** +@brief Structure that holds simulation parameters of a #PxGpuParticleSystem. +*/ +struct PxGpuParticleData +{ + PxVec3 mPeriod; //!< Size of the unit cell for periodic boundary conditions. If 0, the size of the simulation domain is specified by the mGridSize * mParticleContactDistance. + + PxU32 mGridSizeX; //!< Size of the x-dimension of the background simulation grid. Translates to an absolute size of mGridSizeX * mParticleContactDistance. + PxU32 mGridSizeY; //!< Size of the y-dimension of the background simulation grid. Translates to an absolute size of mGridSizeY * mParticleContactDistance. + PxU32 mGridSizeZ; //!< Size of the z-dimension of the background simulation grid. Translates to an absolute size of mGridSizeZ * mParticleContactDistance. + + PxReal mParticleContactDistance; //!< Two particles start interacting if their distance is lower than mParticleContactDistance. + PxReal mParticleContactDistanceInv; //!< 1.f / mParticleContactDistance. + PxReal mParticleContactDistanceSq; //!< mParticleContactDistance * mParticleContactDistance. + + PxU32 mNumParticles; //!< The number of particles in this particle system. + PxU32 mMaxParticles; //!< The maximum number of particles that can be simulated in this particle system. + PxU32 mMaxNeighborhood; //!< The maximum number of particles considered when computing neighborhood based particle interactions. + PxU32 mMaxDiffuseParticles; //!< The maximum number of diffuse particles that can be simulated using this particle system. + PxU32 mNumParticleBuffers; //!< The number of particle buffers that are simulated in this particle system. +}; + +/** +@brief Container class for a GPU particle system. Used to communicate particle system parameters and simulation state +between the internal SDK simulation and the particle system callbacks. + +See #PxParticleSystem, #PxParticleSystemCallback. +*/ +class PxGpuParticleSystem +{ +public: + + /** + @brief Returns the number of cells of the background simulation grid. + + @return PxU32 the number of cells. + */ + PX_FORCE_INLINE PxU32 getNumCells() { return mCommonData.mGridSizeX * mCommonData.mGridSizeY * mCommonData.mGridSizeZ; } + + /* Unsorted particle state buffers */ + float4* mUnsortedPositions_InvMass; //!< GPU pointer to unsorted particle positions and inverse masses. + float4* mUnsortedVelocities; //!< GPU pointer to unsorted particle velocities. + PxU32* mUnsortedPhaseArray; //!< GPU pointer to unsorted particle phase array. See #PxParticlePhase. + + /* Sorted particle state buffers. Sorted by increasing hash value in background grid. */ + float4* mSortedPositions_InvMass; //!< GPU pointer to sorted particle positions + float4* mSortedVelocities; //!< GPU pointer to sorted particle velocities + PxU32* mSortedPhaseArray; //!< GPU pointer to sorted particle phase array + + /* Mappings to/from sorted particle states */ + PxU32* mUnsortedToSortedMapping; //!< GPU pointer to the mapping from unsortedParticle ID to sorted particle ID + PxU32* mSortedToUnsortedMapping; //!< GPU pointer to the mapping from sorted particle ID to unsorted particle ID + + /* Neighborhood information */ + PxU32* mParticleSelfCollisionCount; //!< Per-particle neighborhood count + PxU32* mCollisionIndex; //!< Set of sorted particle indices per neighbor + + PxsParticleMaterialData* mParticleMaterials; //!< GPU pointer to the particle materials used in this particle system. + PxGpuParticleData mCommonData; //!< Structure holding simulation parameters and state for this particle system. See #PxGpuParticleData. + + /** + @brief Get a PxNeighborhoodIterator initialized for usage with this particle system. + + @param particleId An initial particle index for the initialization of the iterator. + + @return An initialized PxNeighborhoodIterator. + */ + PX_CUDA_CALLABLE PxNeighborhoodIterator getIterator(PxU32 particleId) const + { + return PxNeighborhoodIterator(mCollisionIndex + particleId, mCommonData.mMaxParticles); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleMaterial.h new file mode 100644 index 0000000..3dd7fa1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleMaterial.h @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_MATERIAL_H +#define PX_PARTICLE_MATERIAL_H +/** \addtogroup physics +@{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#include "PxBaseMaterial.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Material class to represent a set of particle material properties. + +@see #PxPhysics.createPBDMaterial, #PxPhysics.createFLIPMaterial, #PxPhysics.createMPMMaterial +*/ +class PxParticleMaterial : public PxBaseMaterial +{ +public: + + /** + \brief Sets friction + + \param[in] friction Friction. Range: [0, PX_MAX_F32) + + @see #getFriction() + */ + virtual void setFriction(PxReal friction) = 0; + + /** + \brief Retrieves the friction value. + + \return The friction value. + + @see #setFriction() + */ + virtual PxReal getFriction() const = 0; + + /** + \brief Sets velocity damping term + + \param[in] damping Velocity damping term. Range: [0, PX_MAX_F32) + + @see #getDamping + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Retrieves the velocity damping term + \return The velocity damping term. + + @see #setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Sets adhesion term + + \param[in] adhesion adhesion coefficient. Range: [0, PX_MAX_F32) + + @see #getAdhesion + */ + virtual void setAdhesion(PxReal adhesion) = 0; + + /** + \brief Retrieves the adhesion term + \return The adhesion term. + + @see #setAdhesion() + */ + virtual PxReal getAdhesion() const = 0; + + /** + \brief Sets gravity scale term + + \param[in] scale gravity scale coefficient. Range: (-PX_MAX_F32, PX_MAX_F32) + + @see #getAdhesion + */ + virtual void setGravityScale(PxReal scale) = 0; + + /** + \brief Retrieves the gravity scale term + \return The gravity scale term. + + @see #setAdhesion() + */ + virtual PxReal getGravityScale() const = 0; + + /** + \brief Sets material adhesion radius scale. This is multiplied by the particle rest offset to compute the fall-off distance + at which point adhesion ceases to operate. + + \param[in] scale Material adhesion radius scale. Range: [0, PX_MAX_F32) + + @see #getAdhesionRadiusScale + */ + virtual void setAdhesionRadiusScale(PxReal scale) = 0; + + /** + \brief Retrieves the adhesion radius scale. + \return The adhesion radius scale. + + @see #setAdhesionRadiusScale() + */ + virtual PxReal getAdhesionRadiusScale() const = 0; + +protected: + PX_INLINE PxParticleMaterial(PxType concreteType, PxBaseFlags baseFlags) : PxBaseMaterial(concreteType, baseFlags) {} + PX_INLINE PxParticleMaterial(PxBaseFlags baseFlags) : PxBaseMaterial(baseFlags) {} + virtual ~PxParticleMaterial() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxParticleMaterial", name) || PxBaseMaterial::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSolverType.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSolverType.h new file mode 100644 index 0000000..671220e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSolverType.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_SOLVER_TYPE_H +#define PX_PARTICLE_SOLVER_TYPE_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + + +/** +\brief Identifies the solver to use for a particle system. +*/ +struct PxParticleSolverType +{ + enum Enum + { + ePBD = 1 << 0, //!< The position based dynamics solver that can handle fluid, granular material, cloth, inflatables etc. See #PxPBDParticleSystem. + eFLIP = 1 << 1, //!< The FLIP fluid solver. See #PxFLIPParticleSystem. + eMPM = 1 << 2, //!< The MPM (material point method) solver that can handle a variety of materials. See #PxMPMParticleSystem. + eCUSTOM = 1 << 3 //!< Custom solver. The user needs to specify the interaction of the particle by providing appropriate functions. Can be used e.g. for molecular dynamics simulations. See #PxCustomParticleSystem. + }; +}; + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystem.h new file mode 100644 index 0000000..f5c7305 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystem.h @@ -0,0 +1,455 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_SYSTEM_H +#define PX_PARTICLE_SYSTEM_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "PxActor.h" +#include "PxFiltering.h" +#include "PxParticleSystemFlag.h" + +#include "cudamanager/PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + +class PxCudaContextManager; +class PxGpuParticleSystem; + +class PxParticleAndDiffuseBuffer; +class PxParticleBuffer; +class PxParticleMaterial; + +/** +\brief Container to hold a pair of corresponding device and host pointers. These pointers should point to GPU / CPU mirrors of the same data, but +this is not enforced. +*/ +template +struct PxGpuMirroredPointer +{ + Type* mDevicePtr; + Type* mHostPtr; + + PxGpuMirroredPointer(Type* devicePtr, Type* hostPtr) : mDevicePtr(devicePtr), mHostPtr(hostPtr) { } +}; + +/** +\brief Particle system callback base class to schedule work that should be done before, while or after the particle system updates. +A call to fetchResultsParticleSystem() on the PxScene will synchronize the work such that the caller knows that all tasks of this callback completed. +*/ +class PxParticleSystemCallback +{ +public: + /** + \brief Method gets called when dirty data from the particle system is uploated to the gpu + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onBegin(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Method gets called when the simulation step of the particle system is performed + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onAdvance(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Method gets called after the particle system simulation step completed + + \param[in] gpuParticleSystem Pointers to the particle systems gpu data available as host accessible pointer and as gpu accessible pointer + \param[in] stream The stream on which all cuda kernel calls get scheduled for execution. A call to fetchResultsParticleSystem() on the + PxScene will synchronize the work such that the caller knows that the task completed. + */ + virtual void onPostSolve(const PxGpuMirroredPointer& gpuParticleSystem, CUstream stream) = 0; + + /** + \brief Destructor + */ + virtual ~PxParticleSystemCallback() {} +}; + +/** +\brief Flags which control the behaviour of a particle system. + +See #PxParticleSystem::setParticleFlag(), #PxParticleSystem::setParticleFlags(), #PxParticleSystem::getParticleFlags() +*/ +struct PxParticleFlag +{ + enum Enum + { + eDISABLE_SELF_COLLISION = 1 << 0, //!< Disables particle self-collision + eDISABLE_RIGID_COLLISION = 1 << 1, //!< Disables particle-rigid body collision + eFULL_DIFFUSE_ADVECTION = 1 << 2 //!< Enables full advection of diffuse particles. By default, diffuse particles are advected only by particles in the cell they are contained. This flag enables full neighbourhood generation (more expensive). + }; +}; + +typedef PxFlags PxParticleFlags; + +/** +\brief The shared base class for all particle systems + +A particle system simulates a bunch of particles that interact with each other. The interactions can be simple collisions +with friction (granular material) ore more complex like fluid interactions, cloth, inflatables etc. + +*/ +class PX_DEPRECATED PxParticleSystem : public PxActor +{ +public: + + /** + \brief Sets the solver iteration counts for the body. + + The solver iteration count determines how accurately joints and contacts are resolved. + If you are having trouble with jointed bodies oscillating and behaving erratically, then + setting a higher position iteration count may improve their stability. + + If intersecting bodies are being depenetrated too violently, increase the number of velocity + iterations. More velocity iterations will drive the relative exit velocity of the intersecting + objects closer to the correct value given the restitution. + + Default: 4 position iterations, 1 velocity iteration + + \param[in] minPositionIters Number of position iterations the solver should perform for this body. Range: [1,255] + \param[in] minVelocityIters Number of velocity iterations the solver should perform for this body. Range: [1,255] + + See #getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Retrieves the solver iteration counts. + + See #setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief Retrieves the collision filter settings. + + \return The filter data + */ + virtual PxFilterData getSimulationFilterData() const = 0; + + /** + \brief Set collision filter settings + + Allows to control with which objects the particle system collides + + \param[in] data The filter data + */ + virtual void setSimulationFilterData(const PxFilterData& data) = 0; + + /** + \brief Set particle flag + + Allows to control self collision etc. + + \param[in] flag The flag to set + \param[in] val The new value of the flag + */ + virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) = 0; + + /** + \brief Set particle flags + + Allows to control self collision etc. + + \param[in] flags The flags to set + */ + virtual void setParticleFlags(PxParticleFlags flags) = 0; + + /** + \brief Retrieves the particle flags. + + \return The particle flags + */ + virtual PxParticleFlags getParticleFlags() const = 0; + + /** + \brief Set the maximal depenetration velocity particles can reach + + Allows to limit the particles' maximal depenetration velocity to avoid that collision responses lead to very high particle velocities + + \param[in] maxDepenetrationVelocity The maximal depenetration velocity + */ + virtual void setMaxDepenetrationVelocity(PxReal maxDepenetrationVelocity) = 0; + + /** + \brief Retrieves maximal depenetration velocity a particle can have. + + \return The maximal depenetration velocity + */ + virtual PxReal getMaxDepenetrationVelocity() = 0; + + /** + \brief Set the maximal velocity particles can reach + + Allows to limit the particles' maximal velocity to control the maximal distance a particle can move per frame + + \param[in] maxVelocity The maximal velocity + */ + virtual void setMaxVelocity(PxReal maxVelocity) = 0; + + /** + \brief Retrieves maximal velocity a particle can have. + + \return The maximal velocity + */ + virtual PxReal getMaxVelocity() = 0; + + + /** + \brief Return the cuda context manager + + \return The cuda context manager + */ + virtual PxCudaContextManager* getCudaContextManager() const = 0; + + /** + \brief Set the rest offset for the collision between particles and rigids or soft bodies. + + A particle and a rigid or soft body will come to rest at a distance equal to the sum of their restOffset values. + + \param[in] restOffset Range: (0, contactOffset) + */ + virtual void setRestOffset(PxReal restOffset) = 0; + + /** + \brief Return the rest offset + \return the rest offset + + See #setRestOffset() + */ + virtual PxReal getRestOffset() const = 0; + + /** + \brief Set the contact offset for the collision between particles and rigids or soft bodies + + The contact offset needs to be larger than the rest offset. + Contact constraints are generated for a particle and a rigid or softbody below the distance equal to the sum of their contacOffset values. + + \param[in] contactOffset Range: (restOffset, PX_MAX_F32) + */ + virtual void setContactOffset(PxReal contactOffset) = 0; + + /** + \brief Return the contact offset + \return the contact offset + + See #setContactOffset() + */ + virtual PxReal getContactOffset() const = 0; + + /** + \brief Set the contact offset for the interactions between particles + + The particle contact offset needs to be larger than the fluid rest offset and larger than the solid rest offset. + Interactions for two particles are computed if their distance is below twice the particleContactOffset value. + + \param[in] particleContactOffset Range: (Max(solidRestOffset, fluidRestOffset), PX_MAX_F32) + */ + virtual void setParticleContactOffset(PxReal particleContactOffset) = 0; + + /** + \brief Return the particle contact offset + \return the particle contact offset + + See #setParticleContactOffset() + */ + virtual PxReal getParticleContactOffset() const = 0; + + /** + \brief Set the solid rest offset + + Two solid particles (or a solid and a fluid particle) will come to rest at a distance equal to twice the solidRestOffset value. + + \param[in] solidRestOffset Range: (0, particleContactOffset) + */ + virtual void setSolidRestOffset(PxReal solidRestOffset) = 0; + + /** + \brief Return the solid rest offset + \return the solid rest offset + + See #setSolidRestOffset() + */ + virtual PxReal getSolidRestOffset() const = 0; + + + /** + \brief Creates a rigid attachment between a particle and a rigid actor. + + This method creates a symbolic attachment between the particle system and a rigid body for the purpose of island management. + The actual attachments will be contained in the particle buffers. + + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The particle system keeps track of these attachments but the rigid body does not. + + \param[in] actor The rigid actor used for the attachment + */ + virtual void addRigidAttachment(PxRigidActor* actor) = 0; + + /** + \brief Removes a rigid attachment between a particle and a rigid body. + + This method destroys a symbolic attachment between the particle system and a rigid body for the purpose of island management. + + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The particle system keeps track of these attachments but the rigid body does not. + + \param[in] actor The rigid body actor used for the attachment + */ + virtual void removeRigidAttachment(PxRigidActor* actor) = 0; + + + /** + \brief Enable continuous collision detection for particles + + \param[in] enable Boolean indicates whether continuous collision detection is enabled. + */ + virtual void enableCCD(bool enable) = 0; + + + /** + \brief Creates combined particle flag with particle material and particle phase flags. + + \param[in] material A material instance to associate with the new particle group. + \param[in] flags The particle phase flags. + \return The combined particle group index and phase flags. + + See #PxParticlePhaseFlag + */ + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) = 0; + + + /** + \brief Returns number of particle materials + \return The number of particle materials + */ + virtual PxU32 getNbParticleMaterials() const = 0; + + + /** + \brief Sets a user notify object which receives special simulation events when they occur. + + \note Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + \note A call to fetchResultsParticleSystem() on the PxScene will synchronize the work such that the caller knows that all worke done in the callback completed. + + \param[in] callback User notification callback. See PxSimulationEventCallback. + + See #PxParticleSystemCallback, #getParticleSystemCallback() + */ + virtual void setParticleSystemCallback(PxParticleSystemCallback* callback) = 0; + + /** + \brief Retrieves the simulationEventCallback pointer set with setSimulationEventCallback(). + \return The current user notify pointer. See PxSimulationEventCallback. + + See #PxParticleSystemCallback, #setParticleSystemCallback() + */ + virtual PxParticleSystemCallback* getParticleSystemCallback() const = 0; + + /** + \brief Sets periodic boundary wrap value + \param[in] boundary The periodic boundary wrap value + + See #getPeriodicBoundary() + */ + virtual void setPeriodicBoundary(const PxVec3& boundary) = 0; + + /** + \brief Gets periodic boundary wrap value + \return boundary The periodic boundary wrap value + + See #setPeriodicBoundary() + */ + virtual PxVec3 getPeriodicBoundary() const = 0; + + /** + \brief Add an existing particle buffer to the particle system. + \param[in] particleBuffer a PxParticleBuffer*. + + See #PxParticleBuffer. + */ + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer) = 0; + + /** + \brief Remove particle buffer from the particle system. + \param[in] particleBuffer a PxParticleBuffer*. + + See #PxParticleBuffer. + */ + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer) = 0; + + /** + \brief Returns the GPU particle system index. + \return The GPU index, if the particle system is in a scene and PxSceneFlag::eSUPPRESS_READBACK is set, or 0xFFFFFFFF otherwise. + */ + virtual PxU32 getGpuParticleSystemIndex() = 0; + +protected: + + virtual ~PxParticleSystem() {} + + PX_INLINE PxParticleSystem(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} + PX_INLINE PxParticleSystem(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxParticleSystem", name) || PxActor::isKindOf(name); } +}; + + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystemFlag.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystemFlag.h new file mode 100644 index 0000000..1544e49 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxParticleSystemFlag.h @@ -0,0 +1,101 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_SYSTEM_FLAG_H +#define PX_PARTICLE_SYSTEM_FLAG_H + +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Identifies dirty particle buffers that need to be updated in the particle system. + +This flag can be used mark the device user buffers that are dirty and need to be written to the particle system. +*/ +struct PxParticleBufferFlag +{ + enum Enum + { + eNONE = 0, //!< No data specified + + eUPDATE_POSITION = 1 << 0, //!< Specifies the position (first 3 floats) and inverse mass (last float) data (array of PxVec4 * number of particles) + eUPDATE_VELOCITY = 1 << 1, //!< Specifies the velocity (first 3 floats) data (array of PxVec4 * number of particles) + eUPDATE_PHASE = 1 << 2, //!< Specifies the per-particle phase flag data (array of PxU32 * number of particles) + eUPDATE_RESTPOSITION = 1 << 3, //!< Specifies the rest position (first 3 floats) data for cloth buffers + eUPDATE_CLOTH = 1 << 5, //!< Specifies the cloth buffer (see PxParticleClothBuffer) + eUPDATE_RIGID = 1 << 6, //!< Specifies the rigid buffer (see PxParticleRigidBuffer) + eUPDATE_DIFFUSE_PARAM = 1 << 7, //!< Specifies the diffuse particle parameter buffer (see PxDiffuseParticleParams) + eUPDATE_ATTACHMENTS = 1 << 8, //!< Specifies the attachments. + + eALL = + eUPDATE_POSITION | eUPDATE_VELOCITY | eUPDATE_PHASE | eUPDATE_RESTPOSITION | eUPDATE_CLOTH | eUPDATE_RIGID | eUPDATE_DIFFUSE_PARAM | eUPDATE_ATTACHMENTS + }; +}; + +typedef PxFlags PxParticleBufferFlags; + +/** +\brief A pair of particle buffer unique id and GPU particle system index. + +@see PxScene::applyParticleBufferData +*/ +struct PxGpuParticleBufferIndexPair +{ + PxU32 systemIndex; // gpu particle system index + PxU32 bufferIndex; // particle buffer unique id +}; + +/** +\brief Identifies per-particle behavior for a PxParticleSystem. + +See #PxParticleSystem::createPhase(). +*/ +struct PxParticlePhaseFlag +{ + enum Enum + { + eParticlePhaseGroupMask = 0x000fffff, //!< Bits [ 0, 19] represent the particle group for controlling collisions + eParticlePhaseFlagsMask = 0xfff00000, //!< Bits [20, 23] hold flags about how the particle behave + + eParticlePhaseSelfCollide = 1 << 20, //!< If set this particle will interact with particles of the same group + eParticlePhaseSelfCollideFilter = 1 << 21, //!< If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using setRestParticles() + eParticlePhaseFluid = 1 << 22 //!< If set this particle will generate fluid density constraints for its overlapping neighbors + }; +}; + +typedef PxFlags PxParticlePhaseFlags; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysXConfig.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysXConfig.h new file mode 100644 index 0000000..a27531e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysXConfig.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_CONFIG_H +#define PX_PHYSICS_CONFIG_H + +/** Configuration include file for PhysX SDK */ + +/** \addtogroup physics +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysics.h new file mode 100644 index 0000000..f39b2bb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysics.h @@ -0,0 +1,1317 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_H +#define PX_PHYSICS_H + +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxDeletionListener.h" +#include "foundation/PxTransform.h" +#include "PxShape.h" +#include "PxAggregate.h" +#include "PxBuffer.h" +#include "PxParticleSystem.h" +#include "foundation/PxPreprocessor.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFEMCloth.h" +#include "PxHairSystem.h" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxScene; +class PxSceneDesc; +class PxTolerancesScale; +class PxPvd; +class PxOmniPvd; +class PxInsertionCallback; + +class PxRigidActor; +class PxConstraintConnector; +struct PxConstraintShaderTable; + +class PxGeometry; +class PxFoundation; + +class PxPruningStructure; +class PxBVH; +/** + * @deprecated + */ +typedef PX_DEPRECATED PxBVH PxBVHStructure; + +class PxParticleClothBuffer; +class PxParticleRigidBuffer; + +class PxSoftBodyMesh; + +/** +\brief Abstract singleton factory class used for instancing objects in the Physics SDK. + +In addition you can use PxPhysics to set global parameters which will effect all scenes and create +objects that can be shared across multiple scenes. + +You can get an instance of this class by calling PxCreateBasePhysics() or PxCreatePhysics() with pre-registered modules. + +@see PxCreatePhysics() PxCreateBasePhysics() PxScene +*/ +class PxPhysics +{ +public: + + /** @name Basics + */ + //@{ + + virtual ~PxPhysics() {} + + /** + \brief Destroys the instance it is called on. + + Use this release method to destroy an instance of this class. Be sure + to not keep a reference to this object after calling release. + Avoid release calls while a scene is simulating (in between simulate() and fetchResults() calls). + + Note that this must be called once for each prior call to PxCreatePhysics, as + there is a reference counter. Also note that you mustn't destroy the PxFoundation instance (holding the allocator, error callback etc.) + until after the reference count reaches 0 and the SDK is actually removed. + + Releasing an SDK will also release any objects created through it (scenes, triangle meshes, convex meshes, heightfields, shapes etc.), + provided the user hasn't already done so. + + \note Releasing the PxPhysics instance is a prerequisite to releasing the PxFoundation instance. + + @see PxCreatePhysics() PxFoundation + */ + virtual void release() = 0; + + /** + \brief Retrieves the Foundation instance. + \return A reference to the Foundation object. + */ + virtual PxFoundation& getFoundation() = 0; + + /** + \brief Retrieves the PxOmniPvd instance if there is one registered with PxPhysics. + \return A pointer to a PxOmniPvd object. + */ + PX_DEPRECATED virtual PxOmniPvd* getOmniPvd() = 0; + + /** + \brief Creates an aggregate with the specified maximum size and filtering hint. + + The previous API used "bool enableSelfCollision" which should now silently evaluates + to a PxAggregateType::eGENERIC aggregate with its self-collision bit. + + Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will + only contain static or kinematic actors. This provides faster filtering when used in + combination with PxPairFilteringMode. + + \param [in] maxActor The maximum number of actors that may be placed in the aggregate. + \param [in] maxShape The maximum number of shapes that may be placed in the aggregate. + \param [in] filterHint The aggregate's filtering hint. + \return The new aggregate. + + @see PxAggregate PxAggregateFilterHint PxAggregateType PxPairFilteringMode + */ + virtual PxAggregate* createAggregate(PxU32 maxActor, PxU32 maxShape, PxAggregateFilterHint filterHint) = 0; + + /** + \brief Creates an aggregate with the specified maximum size and filtering hint. + + The previous API used "bool enableSelfCollision" which should now silently evaluates + to a PxAggregateType::eGENERIC aggregate with its self-collision bit. + + Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will + only contain static or kinematic actors. This provides faster filtering when used in + combination with PxPairFilteringMode. + + \note This variation of the method is not compatible with GPU rigid bodies. + + \param [in] maxActor The maximum number of actors that may be placed in the aggregate. + \param [in] filterHint The aggregate's filtering hint. + \return The new aggregate. + + @see PxAggregate PxAggregateFilterHint PxAggregateType PxPairFilteringMode + @deprecated + */ + PX_FORCE_INLINE PX_DEPRECATED PxAggregate* createAggregate(PxU32 maxActor, PxAggregateFilterHint filterHint) + { + return createAggregate(maxActor, PX_MAX_U32, filterHint); + } + + /** + \brief Returns the simulation tolerance parameters. + \return The current simulation tolerance parameters. + */ + virtual const PxTolerancesScale& getTolerancesScale() const = 0; + + //@} + /** @name Meshes + */ + //@{ + + /** + \brief Creates a triangle mesh object. + + This can then be instanced into #PxShape objects. + + \param [in] stream The triangle mesh stream. + \return The new triangle mesh. + + @see PxTriangleMesh PxMeshPreprocessingFlag PxTriangleMesh.release() PxInputStream PxTriangleMeshFlag + */ + virtual PxTriangleMesh* createTriangleMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of triangle meshes that currently exist. + + \return Number of triangle meshes. + + @see getTriangleMeshes() + */ + virtual PxU32 getNbTriangleMeshes() const = 0; + + /** + \brief Writes the array of triangle mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the triangle meshes in the array is not specified. + + \param [out] userBuffer The buffer to receive triangle mesh pointers. + \param [in] bufferSize The number of triangle mesh pointers which can be stored in the buffer. + \param [in] startIndex Index of first mesh pointer to be retrieved. + \return The number of triangle mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbTriangleMeshes() PxTriangleMesh + */ + virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + + //@} + /** @name Tetrahedron Meshes + */ + //@{ + + /** + \brief Creates a tetrahedron mesh object. + + This can then be instanced into #PxShape objects. + + \param[in] stream The tetrahedron mesh stream. + \return The new tetrahedron mesh. + + @see PxTetrahedronMesh PxMeshPreprocessingFlag PxTetrahedronMesh.release() PxInputStream PxTriangleMeshFlag + */ + virtual PxTetrahedronMesh* createTetrahedronMesh(PxInputStream& stream) = 0; + + /** + \brief Creates a softbody mesh object. + + \param[in] stream The softbody mesh stream. + \return The new softbody mesh. + + @see createTetrahedronMesh + */ + virtual PxSoftBodyMesh* createSoftBodyMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of tetrahedron meshes that currently exist. + + \return Number of tetrahedron meshes. + + @see getTetrahedronMeshes() + */ + virtual PxU32 getNbTetrahedronMeshes() const = 0; + + /** + \brief Writes the array of tetrahedron mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the tetrahedron meshes in the array is not specified. + + \param[out] userBuffer The buffer to receive tetrahedron mesh pointers. + \param[in] bufferSize The number of tetrahedron mesh pointers which can be stored in the buffer. + \param[in] startIndex Index of first mesh pointer to be retrieved. + \return The number of tetrahedron mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbTetrahedronMeshes() PxTetrahedronMesh + */ + virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a heightfield object from previously cooked stream. + + This can then be instanced into #PxShape objects. + + \param [in] stream The heightfield mesh stream. + \return The new heightfield. + + @see PxHeightField PxHeightField.release() PxInputStream PxRegisterHeightFields + */ + virtual PxHeightField* createHeightField(PxInputStream& stream) = 0; + + /** + \brief Return the number of heightfields that currently exist. + + \return Number of heightfields. + + @see getHeightFields() + */ + virtual PxU32 getNbHeightFields() const = 0; + + /** + \brief Writes the array of heightfield pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the heightfields in the array is not specified. + + \param [out] userBuffer The buffer to receive heightfield pointers. + \param [in] bufferSize The number of heightfield pointers which can be stored in the buffer. + \param [in] startIndex Index of first heightfield pointer to be retrieved. + \return The number of heightfield pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbHeightFields() PxHeightField + */ + virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a convex mesh object. + + This can then be instanced into #PxShape objects. + + \param [in] stream The stream to load the convex mesh from. + \return The new convex mesh. + + @see PxConvexMesh PxConvexMesh.release() PxInputStream createTriangleMesh() PxConvexMeshGeometry PxShape + */ + virtual PxConvexMesh* createConvexMesh(PxInputStream& stream) = 0; + + /** + \brief Return the number of convex meshes that currently exist. + + \return Number of convex meshes. + + @see getConvexMeshes() + */ + virtual PxU32 getNbConvexMeshes() const = 0; + + /** + \brief Writes the array of convex mesh pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the convex meshes in the array is not specified. + + \param [out] userBuffer The buffer to receive convex mesh pointers. + \param [in] bufferSize The number of convex mesh pointers which can be stored in the buffer. + \param [in] startIndex Index of first convex mesh pointer to be retrieved. + \return The number of convex mesh pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbConvexMeshes() PxConvexMesh + */ + virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a bounding volume hierarchy. + + \param [in] stream The stream to load the BVH from. + \return The new BVH. + + @see PxBVH PxInputStream + */ + virtual PxBVH* createBVH(PxInputStream& stream) = 0; + + /** + * @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE PxBVH* createBVHStructure(PxInputStream& stream) + { + return createBVH(stream); + } + + /** + \brief Return the number of bounding volume hierarchies that currently exist. + + \return Number of bounding volume hierarchies. + + @see PxBVH getBVHs() + */ + virtual PxU32 getNbBVHs() const = 0; + + /** + * @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE PxU32 getNbBVHStructures() const + { + return getNbBVHs(); + } + + /** + \brief Writes the array of bounding volume hierarchy pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the BVHs in the array is not specified. + + \param [out] userBuffer The buffer to receive BVH pointers. + \param [in] bufferSize The number of BVH pointers which can be stored in the buffer. + \param [in] startIndex Index of first BVH pointer to be retrieved. + \return The number of BVH pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbBVHs() PxBVH + */ + virtual PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + * @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE PxU32 getBVHStructures(PxBVHStructure** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const + { + return getBVHs(userBuffer, bufferSize, startIndex); + } + + //@} + /** @name Scenes + */ + //@{ + + /** + \brief Creates a scene. + + \note Every scene uses a Thread Local Storage slot. This imposes a platform specific limit on the + number of scenes that can be created. + + \param [in] sceneDesc Scene descriptor. See #PxSceneDesc + \return The new scene object. + + @see PxScene PxScene.release() PxSceneDesc + */ + virtual PxScene* createScene(const PxSceneDesc& sceneDesc) = 0; + + /** + \brief Gets number of created scenes. + + \return The number of scenes created. + + @see getScenes() + */ + virtual PxU32 getNbScenes() const = 0; + + /** + \brief Writes the array of scene pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the scene pointers in the array is not specified. + + \param [out] userBuffer The buffer to receive scene pointers. + \param [in] bufferSize The number of scene pointers which can be stored in the buffer. + \param [in] startIndex Index of first scene pointer to be retrieved. + \return The number of scene pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbScenes() PxScene + */ + virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //@} + /** @name Actors + */ + //@{ + + /** + \brief Creates a static rigid actor with the specified pose and all other fields initialized + to their default values. + + \param [in] pose The initial pose of the actor. Must be a valid transform. + + @see PxRigidStatic + */ + virtual PxRigidStatic* createRigidStatic(const PxTransform& pose) = 0; + + /** + \brief Creates a dynamic rigid actor with the specified pose and all other fields initialized + to their default values. + + \param [in] pose The initial pose of the actor. Must be a valid transform. + + @see PxRigidDynamic + */ + virtual PxRigidDynamic* createRigidDynamic(const PxTransform& pose) = 0; + + /** + \brief Creates a pruning structure from actors. + + \note Every provided actor needs at least one shape with the eSCENE_QUERY_SHAPE flag set. + \note Both static and dynamic actors can be provided. + \note It is not allowed to pass in actors which are already part of a scene. + \note Articulation links cannot be provided. + + \param [in] actors Array of actors to add to the pruning structure. Must be non NULL. + \param [in] nbActors Number of actors in the array. Must be >0. + \return Pruning structure created from given actors, or NULL if any of the actors did not comply with the above requirements. + @see PxActor PxPruningStructure + */ + virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) = 0; + + //@} + /** @name Shapes + */ + //@{ + + /** + \brief Creates a shape which may be attached to multiple actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + @see PxShape + */ + PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } + + /** + \brief Creates a shape which may be attached to one or more softbody actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + @see PxShape + */ + PX_DEPRECATED PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxFEMSoftBodyMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxFEMSoftBodyMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + /** + \brief Creates a shape which may be attached to one or more FEMCloth actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] material The material for the shape + \param [in] isExclusive Whether this shape is exclusive to a single actor or maybe be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + + @see PxShape + */ + PX_FORCE_INLINE PxShape* createShape( const PxGeometry& geometry, + const PxFEMClothMaterial& material, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxFEMClothMaterial* materialPtr = const_cast(&material); + return createShape(geometry, &materialPtr, 1, isExclusive, shapeFlags); + } +#endif + + /** + \brief Creates a shape which may be attached to multiple actors + + The shape will be created with a reference count of 1. + + \param [in] geometry The geometry for the shape + \param [in] materials The materials for the shape + \param [in] materialCount The number of materials + \param [in] isExclusive Whether this shape is exclusive to a single actor or may be shared + \param [in] shapeFlags The PxShapeFlags to be set + \return The shape + + \note Shared shapes are not mutable when they are attached to an actor + \note Shapes created from *SDF* triangle-mesh geometries do not support more than one material. + + @see PxShape + */ + virtual PxShape* createShape( const PxGeometry& geometry, + PxMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + PX_DEPRECATED virtual PxShape* createShape( const PxGeometry& geometry, + PxFEMSoftBodyMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + PX_DEPRECATED virtual PxShape* createShape( const PxGeometry& geometry, + PxFEMClothMaterial*const * materials, + PxU16 materialCount, + bool isExclusive = false, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) = 0; + + /** + \brief Return the number of shapes that currently exist. + + \return Number of shapes. + + @see getShapes() + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Writes the array of shape pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the shapes in the array is not specified. + + \param [out] userBuffer The buffer to receive shape pointers. + \param [in] bufferSize The number of shape pointers which can be stored in the buffer. + \param [in] startIndex Index of first shape pointer to be retrieved + \return The number of shape pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbShapes() PxShape + */ + virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + //@} + /** @name Constraints and Articulations + */ + //@{ + + /** + \brief Creates a constraint shader. + + \note A constraint shader will get added automatically to the scene the two linked actors belong to. Either, but not both, of actor0 and actor1 may + be NULL to denote attachment to the world. + + \param [in] actor0 The first actor + \param [in] actor1 The second actor + \param [in] connector The connector object, which the SDK uses to communicate with the infrastructure for the constraint + \param [in] shaders The shader functions for the constraint + \param [in] dataSize The size of the data block for the shader + + \return The new constraint shader. + + @see PxConstraint + */ + virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) = 0; + + /** + \brief Creates a reduced-coordinate articulation with all fields initialized to their default values. + + \return the new articulation + + @see PxArticulationReducedCoordinate, PxRegisterArticulationsReducedCoordinate + */ + virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() = 0; + + /** + \brief Creates a FEM-based cloth with all fields initialized to their default values. + \warning Feature under development, only for internal usage. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new FEM-cloth + + @see PxFEMCloth + */ + PX_DEPRECATED virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a FEM-based soft body with all fields initialized to their default values. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new soft body + + @see PxSoftBody + */ + PX_DEPRECATED virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a hair system with all fields initialized to their default values. + \warning Feature under development, only for internal usage. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new hair system + + @see PxHairSystem + */ + PX_DEPRECATED virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a particle system with a position-based dynamics (PBD) solver. + + A PBD particle system can be used to simulate particle systems with fluid and granular particles. It also allows simulating cloth using + mass-spring constraints and rigid bodies by shape matching the bodies with particles. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \param[in] maxNeighborhood The maximum number of particles considered in neighborhood-based particle interaction calculations (e.g. fluid density constraints). + \return the new particle system + + @see PxPBDParticleSystem + */ + PX_DEPRECATED virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood = 96) = 0; + + /** + \brief Creates a particle system with a fluid-implicit particle solver (FLIP). + \warning Feature under development, only for internal usage. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new particle system + + @see PxFLIPParticleSystem + */ + PX_DEPRECATED virtual PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a particle system with a material-point-method solver (MPM). + \warning Feature under development, only for internal usage. + + A MPM particle system can be used to simulate fluid dynamics and deformable body effects using particles. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \return the new particle system + + @see PxMPMParticleSystem + */ + PX_DEPRECATED virtual PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContextManager) = 0; + + /** + \brief Creates a customizable particle system to simulate effects that are not supported by PhysX natively (e.g. molecular dynamics). + \warning Feature under development, only for internal usage. + + \param[in] cudaContextManager The PxCudaContextManager this instance is tied to. + \param[in] maxNeighborhood The maximum number of particles considered in neighborhood-based particle interaction calculations (e.g. fluid density constraints). + \return the new particle system + + @see PxCustomParticleSystem + */ + PX_DEPRECATED virtual PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood) = 0; + + /** + \brief Create a buffer for reading and writing data across host and device memory spaces. + + \param[in] byteSize The size of the buffer in bytes. + \param[in] bufferType The memory space of the buffer. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxBuffer instance. + + @see PxBuffer + */ + PX_DEPRECATED virtual PxBuffer* createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create particle buffer to simulate fluid/granular material. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxVolumes The maximum number of volumes in this buffer. See PxParticleVolume. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleBuffer instance + + @see PxParticleBuffer + */ + PX_DEPRECATED virtual PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer for fluid dynamics with diffuse particles. Diffuse particles are used to simulate fluid effects + such as foam, spray and bubbles. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxDiffuseParticles The max number of diffuse particles int this buffer. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleAndDiffuseBuffer instance + + @see PxParticleAndDiffuseBuffer, PxDiffuseParticleParams + */ + PX_DEPRECATED virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer to simulate particle cloth. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxNumVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxNumCloths The maximum number of cloths in this buffer. See #PxParticleCloth. + \param[in] maxNumTriangles The maximum number of triangles for aerodynamics. + \param[in] maxNumSprings The maximum number of springs to connect particles. See #PxParticleSpring. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleClothBuffer instance + + @see PxParticleClothBuffer + */ + PX_DEPRECATED virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager) = 0; + + /** + \brief Create a particle buffer to simulate rigid bodies using shape matching with particles. + + \param[in] maxParticles The maximum number of particles in this buffer. + \param[in] maxNumVolumes The maximum number of volumes in this buffer. See #PxParticleVolume. + \param[in] maxNumRigids The maximum number of rigid bodies this buffer is used to simulate. + \param[in] cudaContextManager The PxCudaContextManager this buffer is tied to. + \return PxParticleRigidBuffer instance + + @see PxParticleRigidBuffer + */ + PX_DEPRECATED virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager) = 0; + + //@} + /** @name Materials + */ + //@{ + + /** + \brief Creates a new rigid body material with certain default properties. + + \return The new rigid body material. + + \param [in] staticFriction The coefficient of static friction + \param [in] dynamicFriction The coefficient of dynamic friction + \param [in] restitution The coefficient of restitution + + @see PxMaterial + */ + virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) = 0; + + /** + \brief Return the number of rigid body materials that currently exist. + + \return Number of rigid body materials. + + @see getMaterials() + */ + virtual PxU32 getNbMaterials() const = 0; + + /** + \brief Writes the array of rigid body material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbMaterials() PxMaterial + */ + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new FEM soft body material with certain default properties. + + \return The new FEM material. + + \param [in] youngs The young's modulus + \param [in] poissons The poissons's ratio + \param [in] dynamicFriction The dynamic friction coefficient + + @see PxFEMSoftBodyMaterial + */ + PX_DEPRECATED virtual PxFEMSoftBodyMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) = 0; + + /** + \brief Return the number of FEM soft body materials that currently exist. + + \return Number of FEM materials. + + @see getFEMSoftBodyMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbFEMSoftBodyMaterials() const = 0; + + /** + \brief Writes the array of FEM soft body material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbFEMSoftBodyMaterials() PxFEMSoftBodyMaterial + */ + PX_DEPRECATED virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new FEM cloth material with certain default properties. + \warning Feature under development, only for internal usage. + + \return The new FEM material. + + \param [in] youngs The young's modulus + \param [in] poissons The poissons's ratio + \param [in] dynamicFriction The dynamic friction coefficient + + @see PxFEMClothMaterial + */ + PX_DEPRECATED virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) = 0; + + /** + \brief Return the number of FEM cloth materials that currently exist. + + \return Number of FEM cloth materials. + + @see getFEMClothMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbFEMClothMaterials() const = 0; + + /** + \brief Writes the array of FEM cloth material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbFEMClothMaterials() PxFEMClothMaterial + */ + PX_DEPRECATED virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new PBD material with certain default properties. + + \param [in] friction The friction parameter + \param [in] damping The velocity damping parameter + \param [in] adhesion The adhesion parameter + \param [in] viscosity The viscosity parameter + \param [in] vorticityConfinement The vorticity confinement coefficient + \param [in] surfaceTension The surface tension coefficient + \param [in] cohesion The cohesion parameter + \param [in] lift The lift parameter + \param [in] drag The drag parameter + \param [in] cflCoefficient The Courant-Friedrichs-Lewy(cfl) coefficient + \param [in] gravityScale The gravity scale + \return The new PBD material. + + @see PxPBDMaterial + */ + PX_DEPRECATED virtual PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient = 1.f, PxReal gravityScale = 1.f) = 0; + + /** + \brief Return the number of PBD materials that currently exist. + + \return Number of PBD materials. + + @see getPBDMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbPBDMaterials() const = 0; + + /** + \brief Writes the array of PBD material pointers to a user buffer. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbPBDMaterials() PxPBDMaterial + */ + PX_DEPRECATED virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new FLIP material with certain default properties. + \warning Feature under development, only for internal usage. + + \param [in] friction The friction parameter + \param [in] damping The velocity damping parameter + \param [in] adhesion The maximum velocity magnitude of particles + \param [in] viscosity The viscosity parameter + \param [in] gravityScale The gravity scale + \return The new FLIP material. + + @see PxFLIPMaterial + */ + PX_DEPRECATED virtual PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal gravityScale = 1.f) = 0; + + /** + \brief Return the number of FLIP materials that currently exist. + \warning Feature under development, only for internal usage. + + \return Number of FLIP materials. + + @see getFLIPMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbFLIPMaterials() const = 0; + + /** + \brief Writes the array of FLIP material pointers to a user buffer. + \warning Feature under development, only for internal usage. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbFLIPMaterials() PxFLIPMaterial + */ + PX_DEPRECATED virtual PxU32 getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new MPM material with certain default properties. + \warning Feature under development, only for internal usage. + + \param [in] friction The friction parameter + \param [in] damping The velocity damping parameter + \param [in] adhesion The maximum velocity magnitude of particles + \param [in] isPlastic True if plastic + \param [in] youngsModulus The Young's modulus + \param [in] poissons The Poissons's ratio + \param [in] hardening The hardening parameter + \param [in] criticalCompression The critical compression parameter + \param [in] criticalStretch The critical stretch parameter + \param [in] tensileDamageSensitivity The tensile damage sensitivity parameter + \param [in] compressiveDamageSensitivity The compressive damage sensitivity parameter + \param [in] attractiveForceResidual The attractive force residual parameter + \param [in] gravityScale The gravity scale + \return The new MPM material. + + @see PxMPMMaterial + */ + PX_DEPRECATED virtual PxMPMMaterial* createMPMMaterial(PxReal friction, PxReal damping, PxReal adhesion, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale = 1.0f) = 0; + + /** + \brief Return the number of MPM materials that currently exist. + \warning Feature under development, only for internal usage. + + \return Number of MPM materials. + + @see getMPMMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbMPMMaterials() const = 0; + + /** + \brief Writes the array of MPM material pointers to a user buffer. + \warning Feature under development, only for internal usage. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbMPMMaterials() PxMPMMaterial + */ + PX_DEPRECATED virtual PxU32 getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Creates a new material for custom particle systems. + \warning Feature under development, only for internal usage. + + \param[in] gpuBuffer A pointer to a GPU buffer containing material parameters. + \return the new material. + */ + PX_DEPRECATED virtual PxCustomMaterial* createCustomMaterial(void* gpuBuffer) = 0; + + /** + \brief Return the number of custom materials that currently exist. + \warning Feature under development, only for internal usage. + + \return Number of custom materials. + + @see getCustomMaterials() + */ + PX_DEPRECATED virtual PxU32 getNbCustomMaterials() const = 0; + + /** + \brief Writes the array of custom material pointers to a user buffer. + \warning Feature under development, only for internal usage. + + Returns the number of pointers written. + + The ordering of the materials in the array is not specified. + + \param [out] userBuffer The buffer to receive material pointers. + \param [in] bufferSize The number of material pointers which can be stored in the buffer. + \param [in] startIndex Index of first material pointer to be retrieved. + \return The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + + @see getNbCustomMaterials() PxCustomMaterial + */ + PX_DEPRECATED virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + + //@} + /** @name Deletion Listeners + */ + //@{ + + /** + \brief Register a deletion listener. Listeners will be called whenever an object is deleted. + + It is illegal to register or unregister a deletion listener while deletions are being processed. + + \note By default a registered listener will receive events from all objects. Set the restrictedObjectSet parameter to true on registration and use #registerDeletionListenerObjects to restrict the received events to specific objects. + + \note The deletion events are only supported on core PhysX objects. In general, objects in extension modules do not provide this functionality, however, in the case of PxJoint objects, the underlying PxConstraint will send the events. + + \param [in] observer Observer object to send notifications to. + \param [in] deletionEvents The deletion event types to get notified of. + \param [in] restrictedObjectSet If false, the deletion listener will get events from all objects, else the objects to receive events from have to be specified explicitly through #registerDeletionListenerObjects. + + @see PxDeletionListener unregisterDeletionListener + */ + virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet = false) = 0; + + /** + \brief Unregister a deletion listener. + + It is illegal to register or unregister a deletion listener while deletions are being processed. + + \param [in] observer Observer object to stop sending notifications to. + + @see PxDeletionListener registerDeletionListener + */ + virtual void unregisterDeletionListener(PxDeletionListener& observer) = 0; + + /** + \brief Register specific objects for deletion events. + + This method allows for a deletion listener to limit deletion events to specific objects only. + + \note It is illegal to register or unregister objects while deletions are being processed. + + \note The deletion listener has to be registered through #registerDeletionListener() and configured to support restricted object sets prior to this method being used. + + \param [in] observer Observer object to send notifications to. + \param [in] observables List of objects for which to receive deletion events. Only PhysX core objects are supported. In the case of PxJoint objects, the underlying PxConstraint can be used to get the events. + \param [in] observableCount Size of the observables list. + + @see PxDeletionListener unregisterDeletionListenerObjects + */ + virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0; + + /** + \brief Unregister specific objects for deletion events. + + This method allows to clear previously registered objects for a deletion listener (see #registerDeletionListenerObjects()). + + \note It is illegal to register or unregister objects while deletions are being processed. + + \note The deletion listener has to be registered through #registerDeletionListener() and configured to support restricted object sets prior to this method being used. + + \param [in] observer Observer object to stop sending notifications to. + \param [in] observables List of objects for which to not receive deletion events anymore. + \param [in] observableCount Size of the observables list. + + @see PxDeletionListener registerDeletionListenerObjects + */ + virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) = 0; + + /** + \brief Gets PxPhysics object insertion interface. + + The insertion interface is needed for PxCreateTriangleMesh, PxCooking::createTriangleMesh etc., this allows runtime mesh creation. + + @see PxCreateTriangleMesh PxCreateHeightField PxCreateTetrahedronMesh PxCreateBVH + PxCooking::createTriangleMesh PxCooking::createHeightfield PxCooking::createTetrahedronMesh PxCooking::createBVH + */ + virtual PxInsertionCallback& getPhysicsInsertionCallback() = 0; + + //@} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Enables the usage of the reduced coordinate articulations feature. This function is called automatically inside PxCreatePhysics(). +On resource constrained platforms, it is possible to call PxCreateBasePhysics() and then NOT call this function +to save on code memory if your application does not use reduced coordinate articulations. In this case the linker should strip out +the relevant implementation code from the library. If you need to use reduced coordinate articulations but not some other optional +component, you shoud call PxCreateBasePhysics() followed by this call. + +@deprecated +*/ +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterArticulationsReducedCoordinate(physx::PxPhysics& physics); + +/** +\brief Enables the usage of the heightfield feature. + +This call will link the default 'unified' implementation of heightfields which is identical to the narrow phase of triangle meshes. +This function is called automatically inside PxCreatePhysics(). + +On resource constrained platforms, it is possible to call PxCreateBasePhysics() and then NOT call this function +to save on code memory if your application does not use heightfields. In this case the linker should strip out +the relevant implementation code from the library. If you need to use heightfield but not some other optional +component, you shoud call PxCreateBasePhysics() followed by this call. + +You must call this function at a time where no ::PxScene instance exists, typically before calling PxPhysics::createScene(). +This is to prevent a change to the heightfield implementation code at runtime which would have undefined results. + +Calling PxCreateBasePhysics() and then attempting to create a heightfield shape without first calling +::PxRegisterHeightFields(), will result in an error. + +@deprecated +*/ +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterHeightFields(physx::PxPhysics& physics); + +/** +\brief Creates an instance of the physics SDK with minimal additional components registered + +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. + +\param version Version number we are expecting (should be #PX_PHYSICS_VERSION) +\param foundation Foundation instance (see PxFoundation) +\param scale values used to determine default tolerances for objects at creation time +\param trackOutstandingAllocations true if you want to track memory allocations + so a debugger connection partway through your physics simulation will get + an accurate map of everything that has been allocated so far. This could have a memory + and performance impact on your simulation hence it defaults to off. +\param pvd When pvd points to a valid PxPvd instance (PhysX Visual Debugger), a connection to the specified PxPvd instance is created. + If pvd is NULL no connection will be attempted. +\param omniPvd When omniPvd points to a valid PxOmniPvd instance PhysX will sample its internal structures to the defined OmniPvd output streams + set in the PxOmniPvd object. +\return PxPhysics instance on success, NULL if operation failed + +@see PxPhysics, PxFoundation, PxTolerancesScale, PxPvd, PxOmniPvd + +@deprecated +*/ +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics* PX_CALL_CONV PxCreateBasePhysics( physx::PxU32 version, + physx::PxFoundation& foundation, + const physx::PxTolerancesScale& scale, + bool trackOutstandingAllocations = false, + physx::PxPvd* pvd = NULL, + physx::PxOmniPvd* omniPvd = NULL); + +/** +\brief 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. + +\param version Version number we are expecting (should be #PX_PHYSICS_VERSION) +\param foundation Foundation instance (see PxFoundation) +\param scale values used to determine default tolerances for objects at creation time +\param trackOutstandingAllocations true if you want to track memory allocations + so a debugger connection partway through your physics simulation will get + an accurate map of everything that has been allocated so far. This could have a memory + and performance impact on your simulation hence it defaults to off. +\param pvd When pvd points to a valid PxPvd instance (PhysX Visual Debugger), a connection to the specified PxPvd instance is created. + If pvd is NULL no connection will be attempted. +\param omniPvd When omniPvd points to a valid PxOmniPvd instance PhysX will sample its internal structures to the defined OmniPvd output streams + set in the PxOmniPvd object. +\return PxPhysics instance on success, NULL if operation failed + +@see PxPhysics, PxCreateBasePhysics, PxRegisterArticulationsReducedCoordinate, PxRegisterHeightFields +*/ +PX_C_EXPORT PX_PHYSX_CORE_API PX_INLINE physx::PxPhysics* PxCreatePhysics(physx::PxU32 version, + physx::PxFoundation& foundation, + const physx::PxTolerancesScale& scale, + bool trackOutstandingAllocations = false, + physx::PxPvd* pvd = NULL, + physx::PxOmniPvd* omniPvd = NULL) +{ + physx::PxPhysics* physics = PxCreateBasePhysics(version, foundation, scale, trackOutstandingAllocations, pvd, omniPvd); + if (!physics) + return NULL; + + PxRegisterArticulationsReducedCoordinate(*physics); + PxRegisterHeightFields(*physics); + + return physics; +} + + +/** +\brief Retrieves the Physics SDK after it has been created. + +Before using this function the user must call #PxCreatePhysics() or #PxCreateBasePhysics(). + +\note The behavior of this method is undefined if the Physics SDK instance has not been created already. +*/ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +#endif + +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxPhysics& PX_CALL_CONV PxGetPhysics(); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsAPI.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsAPI.h new file mode 100644 index 0000000..d667808 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsAPI.h @@ -0,0 +1,253 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_API_H +#define PX_PHYSICS_API_H +/** \addtogroup physics +@{ +*/ + +/** +This is the main include header for the Physics SDK, for users who +want to use a single #include file. + +Alternatively, one can instead directly #include a subset of the below files. +*/ + +// Foundation SDK +#include "foundation/Px.h" +#include "foundation/PxAlignedMalloc.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxArray.h" +#include "foundation/PxAssert.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxBitAndData.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxBroadcast.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFlags.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxFPU.h" +#include "foundation/PxHash.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxInlineAllocator.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxIO.h" +#include "foundation/PxMat33.h" +#include "foundation/PxMat44.h" +#include "foundation/PxMath.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxMemory.h" +#include "foundation/PxMutex.h" +#include "foundation/PxPhysicsVersion.h" +#include "foundation/PxPlane.h" +#include "foundation/PxPool.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxProfiler.h" +#include "foundation/PxQuat.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxSList.h" +#include "foundation/PxSocket.h" +#include "foundation/PxSort.h" +#include "foundation/PxStrideIterator.h" +#include "foundation/PxString.h" +#include "foundation/PxSync.h" +#include "foundation/PxTempAllocator.h" +#include "foundation/PxThread.h" +#include "foundation/PxTime.h" +#include "foundation/PxTransform.h" +#include "foundation/PxUnionCast.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVec2.h" +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxVecQuat.h" +#include "foundation/PxVecTransform.h" + + +//Not physics specific utilities and common code +#include "common/PxCoreUtilityTypes.h" +#include "common/PxPhysXCommonConfig.h" +#include "common/PxRenderBuffer.h" +#include "common/PxBase.h" +#include "common/PxTolerancesScale.h" +#include "common/PxTypeInfo.h" +#include "common/PxStringTable.h" +#include "common/PxSerializer.h" +#include "common/PxMetaData.h" +#include "common/PxMetaDataFlags.h" +#include "common/PxSerialFramework.h" +#include "common/PxInsertionCallback.h" + +//Task Manager +#include "task/PxTask.h" + +// Cuda Mananger +#if PX_SUPPORT_GPU_PHYSX +#include "gpu/PxGpu.h" +#endif + +//Geometry Library +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxBVH.h" +#include "geometry/PxBVHBuildStrategy.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHelpers.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxHeightFieldDesc.h" +#include "geometry/PxHeightFieldFlag.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHeightFieldSample.h" +#include "geometry/PxMeshQuery.h" +#include "geometry/PxMeshScale.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxTriangle.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxTetrahedron.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTetrahedronMeshGeometry.h" + +// PhysX Core SDK +#include "PxActor.h" +#include "PxAggregate.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxArticulationJointReducedCoordinate.h" +#include "PxArticulationLink.h" +#include "PxClient.h" +#include "PxConeLimitedConstraint.h" +#include "PxConstraint.h" +#include "PxConstraintDesc.h" +#include "PxContact.h" +#include "PxContactModifyCallback.h" +#include "PxDeletionListener.h" +#include "PxFEMSoftBodyMaterial.h" +#include "PxFiltering.h" +#include "PxForceMode.h" +#include "PxLockedData.h" +#include "PxMaterial.h" +#include "PxParticleBuffer.h" +#include "PxParticleSystem.h" +#include "PxPBDParticleSystem.h" +#include "PxPBDMaterial.h" +#include "PxPhysics.h" +#include "PxPhysXConfig.h" +#include "PxQueryFiltering.h" +#include "PxQueryReport.h" +#include "PxRigidActor.h" +#include "PxRigidBody.h" +#include "PxRigidDynamic.h" +#include "PxRigidStatic.h" +#include "PxScene.h" +#include "PxSceneDesc.h" +#include "PxSceneLock.h" +#include "PxShape.h" +#include "PxSimulationEventCallback.h" +#include "PxSimulationStatistics.h" +#include "PxSoftBody.h" +#include "PxVisualizationParameter.h" +#include "PxPruningStructure.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxCustomParticleSystem.h" +#include "PxFEMCloth.h" +#include "PxFEMClothMaterial.h" +#include "PxFLIPParticleSystem.h" +#include "PxFLIPMaterial.h" +#include "PxHairSystem.h" +#include "PxMPMMaterial.h" +#include "PxMPMParticleSystem.h" +#endif + +//Character Controller +#include "characterkinematic/PxBoxController.h" +#include "characterkinematic/PxCapsuleController.h" +#include "characterkinematic/PxController.h" +#include "characterkinematic/PxControllerBehavior.h" +#include "characterkinematic/PxControllerManager.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "characterkinematic/PxExtended.h" + +//Cooking (data preprocessing) +#include "cooking/Pxc.h" +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxCooking.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "cooking/PxBVH33MidphaseDesc.h" +#include "cooking/PxBVH34MidphaseDesc.h" +#include "cooking/PxMidphaseDesc.h" + +//Extensions to the SDK +#include "extensions/PxDefaultStreams.h" +#include "extensions/PxExtensionsAPI.h" + +//Serialization +#include "extensions/PxSerialization.h" +#include "extensions/PxBinaryConverter.h" +#include "extensions/PxRepXSerializer.h" + +//Vehicle Simulation +#include "vehicle2/PxVehicleAPI.h" +#include "vehicle/PxVehicleComponents.h" +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveTank.h" +#include "vehicle/PxVehicleSDK.h" +#include "vehicle/PxVehicleShaders.h" +#include "vehicle/PxVehicleTireFriction.h" +#include "vehicle/PxVehicleUpdate.h" +#include "vehicle/PxVehicleUtil.h" +#include "vehicle/PxVehicleUtilControl.h" +#include "vehicle/PxVehicleUtilSetup.h" +#include "vehicle/PxVehicleUtilTelemetry.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleDriveNW.h" + +//Connecting the SDK to Visual Debugger +#include "pvd/PxPvdSceneClient.h" +#include "pvd/PxPvd.h" +#include "pvd/PxPvdTransport.h" +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsSerialization.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsSerialization.h new file mode 100644 index 0000000..e9383ab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPhysicsSerialization.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_SERIALIZATION_H +#define PX_PHYSICS_SERIALIZATION_H + +#include "common/PxSerialFramework.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +/** +\brief Retrieves the PhysX SDK metadata. + +\deprecated Binary conversion and binary meta data are deprecated. + +This function is used to implement PxSerialization.dumpBinaryMetaData() and is not intended to be needed otherwise. +@see PxSerialization.dumpBinaryMetaData() +*/ +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxGetPhysicsBinaryMetaData(physx::PxOutputStream& stream); + +/** +\brief Registers physics classes for serialization. +This function is used to implement PxSerialization.createSerializationRegistry() and is not intended to be needed otherwise. +@see PxSerializationRegistry +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxRegisterPhysicsSerializers(physx::PxSerializationRegistry& sr); + +/** +\brief Unregisters physics classes for serialization. +This function is used in the release implementation of PxSerializationRegistry and in not intended to be used otherwise. +@see PxSerializationRegistry +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxUnregisterPhysicsSerializers(physx::PxSerializationRegistry& sr); + + +/** +\brief Adds collected objects to PxPhysics. + +This function adds all objects contained in the input collection to the PxPhysics instance. This is used after deserializing +the collection, to populate the physics with inplace deserialized objects. This function is used in the implementation of +PxSerialization.createCollectionFromBinary and is not intended to be needed otherwise. +\param[in] collection Objects to add to the PxPhysics instance. + +@see PxCollection, PxSerialization.createCollectionFromBinary +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxAddCollectionToPhysics(const physx::PxCollection& collection); + +#endif // !PX_DOXYGEN + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxPruningStructure.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPruningStructure.h new file mode 100644 index 0000000..86019b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxPruningStructure.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PRUNING_STRUCTURE_H +#define PX_PRUNING_STRUCTURE_H +/** \addtogroup physics +@{ */ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief A precomputed pruning structure to accelerate scene queries against newly added actors. + +The pruning structure can be provided to #PxScene:: addActors() in which case it will get merged +directly into the scene query optimization AABB tree, thus leading to improved performance when +doing queries against the newly added actors. This applies to both static and dynamic actors. + +\note PxPruningStructure objects can be added to a collection and get serialized. +\note Adding a PxPruningStructure object to a collection will also add the actors that were used to build the pruning structure. + +\note PxPruningStructure must be released before its rigid actors. +\note PxRigidBody objects can be in one PxPruningStructure only. +\note Changing the bounds of PxRigidBody objects assigned to a pruning structure that has not been added to a scene yet will +invalidate the pruning structure. Same happens if shape scene query flags change or shape gets removed from an actor. + +@see PxScene::addActors PxCollection +*/ +class PxPruningStructure : public PxBase +{ +public: + /** + \brief Release this object. + */ + virtual void release() = 0; + + /** + \brief Retrieve rigid actors in the pruning structure. + + You can retrieve the number of rigid actor pointers by calling #getNbRigidActors() + + \param[out] userBuffer The buffer to store the actor pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of rigid actor pointers written to the buffer. + + @see PxRigidActor + */ + virtual PxU32 getRigidActors(PxRigidActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Returns the number of rigid actors in the pruning structure. + + You can use #getRigidActors() to retrieve the rigid actor pointers. + + \return Number of rigid actors in the pruning structure. + + @see PxRigidActor + */ + virtual PxU32 getNbRigidActors() const = 0; + + /** + \brief Gets the merge data for static actors + + This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + with the internal data-structures of the scene-query system. + + \return Implementation-dependent merge data for static actors. + + @see PxSceneQuerySystem::merge() + */ + virtual const void* getStaticMergeData() const = 0; + + /** + \brief Gets the merge data for dynamic actors + + This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + with the internal data-structures of the scene-query system. + + \return Implementation-dependent merge data for dynamic actors. + + @see PxSceneQuerySystem::merge() + */ + virtual const void* getDynamicMergeData() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxPruningStructure"; } +protected: + PX_INLINE PxPruningStructure(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxPruningStructure(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxPruningStructure() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxPruningStructure", name) || PxBase::isKindOf(name); } +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryFiltering.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryFiltering.h new file mode 100644 index 0000000..03dec6a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryFiltering.h @@ -0,0 +1,233 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_QUERY_FILTERING_H +#define PX_QUERY_FILTERING_H +/** \addtogroup scenequery +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxFiltering.h" +#include "PxQueryReport.h" +#include "PxClient.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxRigidActor; +struct PxQueryHit; + +/** +\brief Filtering flags for scene queries. + +@see PxQueryFilterData.flags +*/ +struct PxQueryFlag +{ + enum Enum + { + eSTATIC = (1<<0), //!< Traverse static shapes + + eDYNAMIC = (1<<1), //!< Traverse dynamic shapes + + ePREFILTER = (1<<2), //!< Run the pre-intersection-test filter (see #PxQueryFilterCallback::preFilter()) + + ePOSTFILTER = (1<<3), //!< Run the post-intersection-test filter (see #PxQueryFilterCallback::postFilter()) + + eANY_HIT = (1<<4), //!< Abort traversal as soon as any hit is found and return it via callback.block. + //!< Helps query performance. Both eTOUCH and eBLOCK hitTypes are considered hits with this flag. + + eNO_BLOCK = (1<<5), //!< All hits are reported as touching. Overrides eBLOCK returned from user filters with eTOUCH. + //!< This is also an optimization hint that may improve query performance. + + eBATCH_QUERY_LEGACY_BEHAVIOUR PX_DEPRECATED = (1<<6), //!< Run with legacy batch query filter behavior. Raising this flag ensures that + //!< the hardcoded filter equation is neglected. This guarantees that any provided PxQueryFilterCallback + //!< will be utilised, as specified by the ePREFILTER and ePOSTFILTER flags. + + eDISABLE_HARDCODED_FILTER = (1<<6), //!< Same as eBATCH_QUERY_LEGACY_BEHAVIOUR, more explicit name making it clearer that this can also be used + //!< with regular/non-batched queries if needed. + + eRESERVED = (1<<15) //!< Reserved for internal use + }; +}; +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eSTATIC==(1<<0)); +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eDYNAMIC==(1<<1)); +PX_COMPILE_TIME_ASSERT(PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR==PxQueryFlag::eDISABLE_HARDCODED_FILTER); + +/** +\brief Flags typedef for the set of bits defined in PxQueryFlag. + +*/ +typedef PxFlags PxQueryFlags; +PX_FLAGS_OPERATORS(PxQueryFlag::Enum,PxU16) + +/** +\brief Classification of scene query hits (intersections). + + - eNONE: Returning this hit type means that the hit should not be reported. + - eBLOCK: For all raycast, sweep and overlap queries the nearest eBLOCK type hit will always be returned in PxHitCallback::block member. + - eTOUCH: Whenever a raycast, sweep or overlap query was called with non-zero PxHitCallback::nbTouches and PxHitCallback::touches + parameters, eTOUCH type hits that are closer or same distance (touchDistance <= blockDistance condition) + as the globally nearest eBLOCK type hit, will be reported. + - For example, to record all hits from a raycast query, always return eTOUCH. + +All hits in overlap() queries are treated as if the intersection distance were zero. +This means the hits are unsorted and all eTOUCH hits are recorded by the callback even if an eBLOCK overlap hit was encountered. +Even though all overlap() blocking hits have zero length, only one (arbitrary) eBLOCK overlap hit is recorded in PxHitCallback::block. +All overlap() eTOUCH type hits are reported (zero touchDistance <= zero blockDistance condition). + +For raycast/sweep/overlap calls with zero touch buffer or PxHitCallback::nbTouches member, +only the closest hit of type eBLOCK is returned. All eTOUCH hits are discarded. + +@see PxQueryFilterCallback.preFilter PxQueryFilterCallback.postFilter PxScene.raycast PxScene.sweep PxScene.overlap +*/ +struct PxQueryHitType +{ + enum Enum + { + eNONE = 0, //!< the query should ignore this shape + eTOUCH = 1, //!< a hit on the shape touches the intersection geometry of the query but does not block it + eBLOCK = 2 //!< a hit on the shape blocks the query (does not block overlap queries) + }; +}; + +/** +\brief Scene query filtering data. + +Whenever the scene query intersects a shape, filtering is performed in the following order: + +\li For non-batched queries only:
If the data field is non-zero, and the bitwise-AND value of data AND the shape's +queryFilterData is zero, the shape is skipped +\li If filter callbacks are enabled in flags field (see #PxQueryFlags) they will get invoked accordingly. +\li If neither #PxQueryFlag::ePREFILTER or #PxQueryFlag::ePOSTFILTER is set, the hit defaults +to type #PxQueryHitType::eBLOCK when the value of PxHitCallback::nbTouches provided with the query is zero and to type +#PxQueryHitType::eTOUCH when PxHitCallback::nbTouches is positive. + +@see PxScene.raycast PxScene.sweep PxScene.overlap PxQueryFlag::eANY_HIT +*/ +struct PxQueryFilterData +{ + /** \brief default constructor */ + explicit PX_INLINE PxQueryFilterData() : flags(PxQueryFlag::eDYNAMIC | PxQueryFlag::eSTATIC) {} + + /** \brief constructor to set both filter data and filter flags */ + explicit PX_INLINE PxQueryFilterData(const PxFilterData& fd, PxQueryFlags f) : data(fd), flags(f) {} + + /** \brief constructor to set filter flags only */ + explicit PX_INLINE PxQueryFilterData(PxQueryFlags f) : flags(f) {} + + PxFilterData data; //!< Filter data associated with the scene query + PxQueryFlags flags; //!< Filter flags (see #PxQueryFlags) +}; + +/** +\brief Scene query filtering callbacks. + +Custom filtering logic for scene query intersection candidates. If an intersection candidate object passes the data based filter +(see #PxQueryFilterData), filtering callbacks are executed if requested (see #PxQueryFilterData.flags) + +\li If #PxQueryFlag::ePREFILTER is set, the preFilter function runs before exact intersection tests. +If this function returns #PxQueryHitType::eTOUCH or #PxQueryHitType::eBLOCK, exact testing is performed to +determine the intersection location. + +The preFilter function may overwrite the copy of queryFlags it receives as an argument to specify any of #PxHitFlag::eMODIFIABLE_FLAGS +on a per-shape basis. Changes apply only to the shape being filtered, and changes to other flags are ignored. + +\li If #PxQueryFlag::ePREFILTER is not set, precise intersection testing is performed using the original query's filterData.flags. + +\li If #PxQueryFlag::ePOSTFILTER is set, the postFilter function is called for each intersection to determine the touch/block status. +This overrides any touch/block status previously returned from the preFilter function for this shape. + +Filtering calls are not guaranteed to be sorted along the ray or sweep direction. + +@see PxScene.raycast PxScene.sweep PxScene.overlap PxQueryFlags PxHitFlags +*/ +class PxQueryFilterCallback +{ +public: + + /** + \brief This filter callback is executed before the exact intersection test if PxQueryFlag::ePREFILTER flag was set. + + \param[in] filterData custom filter data specified as the query's filterData.data parameter. + \param[in] shape A shape that has not yet passed the exact intersection test. + \param[in] actor The shape's actor. + \param[in,out] queryFlags scene query flags from the query's function call (only flags from PxHitFlag::eMODIFIABLE_FLAGS bitmask can be modified) + \return the updated type for this hit (see #PxQueryHitType) + */ + virtual PxQueryHitType::Enum preFilter( + const PxFilterData& filterData, const PxShape* shape, const PxRigidActor* actor, PxHitFlags& queryFlags) = 0; + + /** + \brief This filter callback is executed if the exact intersection test returned true and PxQueryFlag::ePOSTFILTER flag was set. + + \param[in] filterData custom filter data of the query + \param[in] hit Scene query hit information. faceIndex member is not valid for overlap queries. For sweep and raycast queries the hit information can be cast to #PxSweepHit and #PxRaycastHit respectively. + \return the updated hit type for this hit (see #PxQueryHitType) + @deprecated + */ + PX_DEPRECATED virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit) + { + PX_UNUSED(filterData); + PX_UNUSED(hit); + return PxQueryHitType::eBLOCK; + } + + /** + \brief This filter callback is executed if the exact intersection test returned true and PxQueryFlag::ePOSTFILTER flag was set. + + \param[in] filterData custom filter data of the query + \param[in] hit Scene query hit information. faceIndex member is not valid for overlap queries. For sweep and raycast queries the hit information can be cast to #PxSweepHit and #PxRaycastHit respectively. + \param[in] shape Hit shape + \param[in] actor Hit actor + \return the updated hit type for this hit (see #PxQueryHitType) + */ + virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit, const PxShape* shape, const PxRigidActor* actor) + { + PX_UNUSED(shape); + PX_UNUSED(actor); + return postFilter(filterData, hit); + } + + /** + \brief virtual destructor + */ + virtual ~PxQueryFilterCallback() {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryReport.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryReport.h new file mode 100644 index 0000000..a508d1c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxQueryReport.h @@ -0,0 +1,285 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_QUERY_REPORT_H +#define PX_QUERY_REPORT_H +/** \addtogroup scenequery +@{ +*/ +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "foundation/PxAssert.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxRigidActor; + +/** +\brief Combines a shape pointer and the actor the shape belongs to into one memory location. + +Serves as a base class for PxQueryHit. + +@see PxQueryHit +*/ +struct PxActorShape +{ + PX_INLINE PxActorShape() : actor(NULL), shape(NULL) {} + PX_INLINE PxActorShape(PxRigidActor* a, PxShape* s) : actor(a), shape(s) {} + + PxRigidActor* actor; + PxShape* shape; +}; + +// Extends geom hits with Px object pointers +struct PxRaycastHit : PxGeomRaycastHit, PxActorShape {}; +struct PxOverlapHit : PxGeomOverlapHit, PxActorShape {}; +struct PxSweepHit : PxGeomSweepHit, PxActorShape {}; + +/** +\brief Describes query behavior after returning a partial query result via a callback. + +If callback returns true, traversal will continue and callback can be issued again. +If callback returns false, traversal will stop, callback will not be issued again. + +@see PxHitCallback +*/ +typedef bool PxAgain; + +/** +\brief This callback class facilitates reporting scene query hits (intersections) to the user. + +User overrides the virtual processTouches function to receive hits in (possibly multiple) fixed size blocks. + +\note PxHitBuffer derives from this class and is used to receive touching hits in a fixed size buffer. +\note Since the compiler doesn't look in template dependent base classes when looking for non-dependent names +\note with some compilers it will be necessary to use "this->hasBlock" notation to access a parent variable +\note in a child callback class. +\note Pre-made typedef shorthands, such as ::PxRaycastCallback can be used for raycast, overlap and sweep queries. + +@see PxHitBuffer PxRaycastHit PxSweepHit PxOverlapHit PxRaycastCallback PxOverlapCallback PxSweepCallback +*/ +template +struct PxHitCallback : PxQueryThreadContext +{ + HitType block; //!< Holds the closest blocking hit result for the query. Invalid if hasBlock is false. + bool hasBlock; //!< Set to true if there was a blocking hit during query. + + HitType* touches; //!< User specified buffer for touching hits. + + /** + \brief Size of the user specified touching hits buffer. + \note If set to 0 all hits will default to PxQueryHitType::eBLOCK, otherwise to PxQueryHitType::eTOUCH + \note Hit type returned from pre-filter overrides this default */ + PxU32 maxNbTouches; + + /** + \brief Number of touching hits returned by the query. Used with PxHitBuffer. + \note If true (PxAgain) is returned from the callback, nbTouches will be reset to 0. */ + PxU32 nbTouches; + + /** + \brief Initializes the class with user provided buffer. + + \param[in] aTouches Optional buffer for recording PxQueryHitType::eTOUCH type hits. + \param[in] aMaxNbTouches Size of touch buffer. + + \note if aTouches is NULL and aMaxNbTouches is 0, only the closest blocking hit will be recorded by the query. + \note If PxQueryFlag::eANY_HIT flag is used as a query parameter, hasBlock will be set to true and blockingHit will be used to receive the result. + \note Both eTOUCH and eBLOCK hits will be registered as hasBlock=true and stored in PxHitCallback.block when eANY_HIT flag is used. + + @see PxHitCallback.hasBlock PxHitCallback.block */ + PxHitCallback(HitType* aTouches, PxU32 aMaxNbTouches) + : hasBlock(false), touches(aTouches), maxNbTouches(aMaxNbTouches), nbTouches(0) + {} + + /** + \brief virtual callback function used to communicate query results to the user. + + This callback will always be invoked with #touches as a buffer if #touches was specified as non-NULL. + All reported touch hits are guaranteed to be closer than the closest blocking hit. + + \param[in] buffer Callback will report touch hits to the user in this buffer. This pointer will be the same as #touches. + \param[in] nbHits Number of touch hits reported in buffer. This number will not exceed #maxNbTouches. + + \note There is a significant performance penalty in case multiple touch callbacks are issued (up to 2x) + \note to avoid the penalty use a bigger buffer so that all touching hits can be reported in a single buffer. + \note If true (again) is returned from the callback, nbTouches will be reset to 0, + \note If false is returned, nbTouched will remain unchanged. + \note By the time processTouches is first called, the globally closest blocking hit is already determined, + \note values of hasBlock and block are final and all touch hits are guaranteed to be closer than the blocking hit. + \note touches and maxNbTouches can be modified inside of processTouches callback. + + \return true to continue receiving callbacks in case there are more hits or false to stop. + + @see PxAgain PxRaycastHit PxSweepHit PxOverlapHit */ + virtual PxAgain processTouches(const HitType* buffer, PxU32 nbHits) = 0; + + virtual void finalizeQuery() {} //!< Query finalization callback, called after the last processTouches callback. + + virtual ~PxHitCallback() {} + + /** \brief Returns true if any blocking or touching hits were encountered during a query. */ + PX_FORCE_INLINE bool hasAnyHits() { return (hasBlock || (nbTouches > 0)); } +}; + +/** +\brief Returns scene query hits (intersections) to the user in a preallocated buffer. + +Will clip touch hits to maximum buffer capacity. When clipped, an arbitrary subset of touching hits will be discarded. +Overflow does not trigger warnings or errors. block and hasBlock will be valid in finalizeQuery callback and after query completion. +Touching hits are guaranteed to have closer or same distance ( <= condition) as the globally nearest blocking hit at the time any processTouches() +callback is issued. + +\note Pre-made typedef shorthands, such as ::PxRaycastBuffer can be used for raycast, overlap and sweep queries. + +@see PxHitCallback +@see PxRaycastBuffer PxOverlapBuffer PxSweepBuffer PxRaycastBufferN PxOverlapBufferN PxSweepBufferN +*/ +template +struct PxHitBuffer : public PxHitCallback +{ + /** + \brief Initializes the buffer with user memory. + + The buffer is initialized with 0 touch hits by default => query will only report a single closest blocking hit. + Use PxQueryFlag::eANY_HIT to tell the query to abort and return any first hit encoutered as blocking. + + \param[in] aTouches Optional buffer for recording PxQueryHitType::eTOUCH type hits. + \param[in] aMaxNbTouches Size of touch buffer. + + @see PxHitCallback */ + PxHitBuffer(HitType* aTouches = NULL, PxU32 aMaxNbTouches = 0) : PxHitCallback(aTouches, aMaxNbTouches) {} + + /** \brief Computes the number of any hits in this result, blocking or touching. */ + PX_INLINE PxU32 getNbAnyHits() const { return getNbTouches() + PxU32(this->hasBlock); } + /** \brief Convenience iterator used to access any hits in this result, blocking or touching. */ + PX_INLINE const HitType& getAnyHit(const PxU32 index) const { PX_ASSERT(index < getNbTouches() + PxU32(this->hasBlock)); + return index < getNbTouches() ? getTouches()[index] : this->block; } + + PX_INLINE PxU32 getNbTouches() const { return this->nbTouches; } + PX_INLINE const HitType* getTouches() const { return this->touches; } + PX_INLINE const HitType& getTouch(const PxU32 index) const { PX_ASSERT(index < getNbTouches()); return getTouches()[index]; } + PX_INLINE PxU32 getMaxNbTouches() const { return this->maxNbTouches; } + + virtual ~PxHitBuffer() {} + +protected: + // stops after the first callback + virtual PxAgain processTouches(const HitType* buffer, PxU32 nbHits) { PX_UNUSED(buffer); PX_UNUSED(nbHits); return false; } +}; + +/** \brief Raycast query callback. */ +typedef PxHitCallback PxRaycastCallback; + +/** \brief Overlap query callback. */ +typedef PxHitCallback PxOverlapCallback; + +/** \brief Sweep query callback. */ +typedef PxHitCallback PxSweepCallback; + +/** \brief Raycast query buffer. */ +typedef PxHitBuffer PxRaycastBuffer; + +/** \brief Overlap query buffer. */ +typedef PxHitBuffer PxOverlapBuffer; + +/** \brief Sweep query buffer. */ +typedef PxHitBuffer PxSweepBuffer; + +/** \brief Returns touching raycast hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxRaycastBufferN : public PxHitBuffer +{ + PxRaycastHit hits[N]; + PxRaycastBufferN() : PxHitBuffer(hits, N) {} +}; + +/** \brief Returns touching overlap hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxOverlapBufferN : public PxHitBuffer +{ + PxOverlapHit hits[N]; + PxOverlapBufferN() : PxHitBuffer(hits, N) {} +}; + +/** \brief Returns touching sweep hits to the user in a fixed size array embedded in the buffer class. **/ +template +struct PxSweepBufferN : public PxHitBuffer +{ + PxSweepHit hits[N]; + PxSweepBufferN() : PxHitBuffer(hits, N) {} +}; + +/** +\brief single hit cache for scene queries. + +If a cache object is supplied to a scene query, the cached actor/shape pair is checked for intersection first. +\note Filters are not executed for the cached shape. +\note If intersection is found, the hit is treated as blocking. +\note Typically actor and shape from the last PxHitCallback.block query result is used as a cached actor/shape pair. +\note Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. +\note Cache is only used if no touch buffer was provided, for single nearest blocking hit queries and queries using eANY_HIT flag. +\note if non-zero touch buffer was provided, cache will be ignored + +\note It is the user's responsibility to ensure that the shape and actor are valid, so care must be taken +when deleting shapes to invalidate cached references. + +The faceIndex field is an additional hint for a mesh or height field which is not currently used. + +@see PxScene.raycast +*/ +struct PxQueryCache +{ + /** + \brief constructor sets to default + */ + PX_INLINE PxQueryCache() : shape(NULL), actor(NULL), faceIndex(0xffffffff) {} + + /** + \brief constructor to set properties + */ + PX_INLINE PxQueryCache(PxShape* s, PxU32 findex) : shape(s), actor(NULL), faceIndex(findex) {} + + PxShape* shape; //!< Shape to test for intersection first + PxRigidActor* actor; //!< Actor to which the shape belongs + PxU32 faceIndex; //!< Triangle index to test first - NOT CURRENTLY SUPPORTED +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidActor.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidActor.h new file mode 100644 index 0000000..1c3d8ae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidActor.h @@ -0,0 +1,235 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_ACTOR_H +#define PX_RIGID_ACTOR_H +/** \addtogroup physics +@{ +*/ + +#include "PxActor.h" +#include "PxShape.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxConstraint; + +/** +\brief PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SDK. + +PxRigidActor objects specify the geometry of the object by defining a set of attached shapes (see #PxShape). + +@see PxActor +*/ +class PxRigidActor : public PxActor +{ +public: + /** + \brief Deletes the rigid actor object. + + Also releases any shapes associated with the actor. + + Releasing an actor will affect any objects that are connected to the actor (constraint shaders like joints etc.). + Such connected objects will be deleted upon scene deletion, or explicitly by the user by calling release() + on these objects. It is recommended to always remove all objects that reference actors before the actors + themselves are removed. It is not possible to retrieve list of dead connected objects. + + Sleeping: This call will awaken any sleeping actors contacting the deleted actor (directly or indirectly). + + Calls #PxActor::release() so you might want to check the documentation of that method as well. + + @see PxActor::release() + */ + virtual void release() = 0; + + /** + \brief Returns the internal actor index. + + \warning This is only defined for actors that have been added to a scene. + + \return The internal actor index, or 0xffffffff if the actor is not part of a scene. + */ + virtual PxU32 getInternalActorIndex() const = 0; + +/************************************************************************************************/ +/** @name Global Pose Manipulation +*/ + + /** + \brief Retrieves the actors world space transform. + + The getGlobalPose() method retrieves the actor's current actor space to world space transformation. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return Global pose of object. + + @see PxRigidDynamic.setGlobalPose() PxRigidStatic.setGlobalPose() + */ + virtual PxTransform getGlobalPose() const = 0; + + /** + \brief Method for setting an actor's pose in the world. + + This method instantaneously changes the actor space to world space transformation. + + This method is mainly for dynamic rigid bodies (see #PxRigidDynamic). Calling this method on static actors is + likely to result in a performance penalty, since internal optimization structures for static actors may need to be + recomputed. In addition, moving static actors will not interact correctly with dynamic actors or joints. + + To directly control an actor's position and have it correctly interact with dynamic bodies and joints, create a dynamic + body with the PxRigidBodyFlag::eKINEMATIC flag, then use the setKinematicTarget() commands to define its path. + + Even when moving dynamic actors, exercise restraint in making use of this method. Where possible, avoid: + + \li moving actors into other actors, thus causing overlap (an invalid physical state) + + \li moving an actor that is connected by a joint to another away from the other (thus causing joint error) + + Sleeping: This call wakes dynamic actors if they are sleeping and the autowake parameter is true (default). + + \param[in] pose Transformation from the actors local frame to the global frame. Range: rigid body transform. + \param[in] autowake whether to wake the object if it is dynamic. This parameter has no effect for static or kinematic actors. If true and the current wake counter value is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + @see getGlobalPose() + */ + virtual void setGlobalPose(const PxTransform& pose, bool autowake = true) = 0; + +/************************************************************************************************/ +/** @name Shapes +*/ + + /** + \brief Attach a shape to an actor + + This call will increment the reference count of the shape. + + \note Mass properties of dynamic rigid actors will not automatically be recomputed + to reflect the new mass distribution implied by the shape. Follow this call with a call to + the PhysX extensions method #PxRigidBodyExt::updateMassAndInertia() to do that. + + Attaching a triangle mesh, heightfield or plane geometry shape configured as eSIMULATION_SHAPE is not supported for + non-kinematic PxRigidDynamic instances. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] shape the shape to attach. + + \return True if success. + */ + virtual bool attachShape(PxShape& shape) = 0; + + /** + \brief Detach a shape from an actor. + + This will also decrement the reference count of the PxShape, and if the reference count is zero, will cause it to be deleted. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] shape the shape to detach. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types. + */ + virtual void detachShape(PxShape& shape, bool wakeOnLostTouch = true) = 0; + + /** + \brief Returns the number of shapes assigned to the actor. + + You can use #getShapes() to retrieve the shape pointers. + + \return Number of shapes associated with this actor. + + @see PxShape getShapes() + */ + virtual PxU32 getNbShapes() const = 0; + + /** + \brief Retrieve all the shape pointers belonging to the actor. + + These are the shapes used by the actor for collision detection. + + You can retrieve the number of shape pointers by calling #getNbShapes() + + Note: Removing shapes with #PxShape::release() will invalidate the pointer of the released shape. + + \param[out] userBuffer The buffer to store the shape pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first shape pointer to be retrieved + \return Number of shape pointers written to the buffer. + + @see PxShape getNbShapes() PxShape::release() + */ + virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + +/************************************************************************************************/ +/** @name Constraints +*/ + + /** + \brief Returns the number of constraint shaders attached to the actor. + + You can use #getConstraints() to retrieve the constraint shader pointers. + + \return Number of constraint shaders attached to this actor. + + @see PxConstraint getConstraints() + */ + virtual PxU32 getNbConstraints() const = 0; + + /** + \brief Retrieve all the constraint shader pointers belonging to the actor. + + You can retrieve the number of constraint shader pointers by calling #getNbConstraints() + + Note: Removing constraint shaders with #PxConstraint::release() will invalidate the pointer of the released constraint. + + \param[out] userBuffer The buffer to store the constraint shader pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first constraint pointer to be retrieved + \return Number of constraint shader pointers written to the buffer. + + @see PxConstraint getNbConstraints() PxConstraint::release() + */ + virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + +protected: + PX_INLINE PxRigidActor(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} + PX_INLINE PxRigidActor(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual ~PxRigidActor() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidActor", name) || PxActor::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidBody.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidBody.h new file mode 100644 index 0000000..ab4a03e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidBody.h @@ -0,0 +1,710 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_BODY_H +#define PX_RIGID_BODY_H +/** \addtogroup physics +@{ +*/ + +#include "PxRigidActor.h" +#include "PxForceMode.h" +#include "PxNodeIndex.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Collection of flags describing the behavior of a rigid body. + +@see PxRigidBody.setRigidBodyFlag(), PxRigidBody.getRigidBodyFlags() +*/ +struct PxRigidBodyFlag +{ + enum Enum + { + /** + \brief Enables kinematic mode for the actor. + + Kinematic actors are special dynamic actors that are not + influenced by forces (such as gravity), and have no momentum. They are considered to have infinite + mass and can be moved around the world using the setKinematicTarget() method. They will push + regular dynamic actors out of the way. Kinematics will not collide with static or other kinematic objects. + + Kinematic actors are great for moving platforms or characters, where direct motion control is desired. + + You can not connect Reduced joints to kinematic actors. Lagrange joints work ok if the platform + is moving with a relatively low, uniform velocity. + + Sleeping: + \li Setting this flag on a dynamic actor will put the actor to sleep and set the velocities to 0. + \li If this flag gets cleared, the current sleep state of the actor will be kept. + + \note kinematic actors are incompatible with CCD so raising this flag will automatically clear eENABLE_CCD + + @see PxRigidDynamic.setKinematicTarget() + */ + eKINEMATIC = (1<<0), //!< Enable kinematic mode for the body. + + /** + \brief Use the kinematic target transform for scene queries. + + If this flag is raised, then scene queries will treat the kinematic target transform as the current pose + of the body (instead of using the actual pose). Without this flag, the kinematic target will only take + effect with respect to scene queries after a simulation step. + + @see PxRigidDynamic.setKinematicTarget() + */ + eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES = (1<<1), + + /** + \brief Enables swept integration for the actor. + + If this flag is raised and CCD is enabled on the scene, then this body will be simulated by the CCD system to ensure that collisions are not missed due to + high-speed motion. Note individual shape pairs still need to enable PxPairFlag::eDETECT_CCD_CONTACT in the collision filtering to enable the CCD to respond to + individual interactions. + + \note kinematic actors are incompatible with CCD so this flag will be cleared automatically when raised on a kinematic actor + */ + eENABLE_CCD = (1<<2), //!< Enable CCD for the body. + + /** + \brief Enabled CCD in swept integration for the actor. + + If this flag is raised and CCD is enabled, CCD interactions will simulate friction. By default, friction is disabled in CCD interactions because + CCD friction has been observed to introduce some simulation artifacts. CCD friction was enabled in previous versions of the SDK. Raising this flag will result in behavior + that is a closer match for previous versions of the SDK. + + \note This flag requires PxRigidBodyFlag::eENABLE_CCD to be raised to have any effect. + */ + eENABLE_CCD_FRICTION = (1<<3), + + /** + \brief Register a rigid body to dynamically adjust contact offset based on velocity. This can be used to achieve a CCD effect. + + If both eENABLE_CCD and eENABLE_SPECULATIVE_CCD are set on the same body, then angular motions are handled by speculative + contacts (eENABLE_SPECULATIVE_CCD) while linear motions are handled by sweeps (eENABLE_CCD). + */ + eENABLE_SPECULATIVE_CCD = (1<<4), + + /** + \brief Register a rigid body for reporting pose changes by the simulation at an early stage. + + Sometimes it might be advantageous to get access to the new pose of a rigid body as early as possible and + not wait until the call to fetchResults() returns. Setting this flag will schedule the rigid body to get reported + in #PxSimulationEventCallback::onAdvance(). Please refer to the documentation of that callback to understand + the behavior and limitations of this functionality. + + @see PxSimulationEventCallback::onAdvance() + */ + eENABLE_POSE_INTEGRATION_PREVIEW = (1<<5), + + /** + \brief Permit CCD to limit maxContactImpulse. This is useful for use-cases like a destruction system but can cause visual artefacts so is not enabled by default. + */ + eENABLE_CCD_MAX_CONTACT_IMPULSE = (1<<6), + + /** + \brief Carries over forces/accelerations between frames, rather than clearing them + */ + eRETAIN_ACCELERATIONS = (1<<7), + + /** + \brief Forces kinematic-kinematic pairs notifications for this actor. + + This flag overrides the global scene-level PxPairFilteringMode setting for kinematic actors. + This is equivalent to having PxPairFilteringMode::eKEEP for pairs involving this actor. + + A particular use case is when you have a large amount of kinematic actors, but you are only + interested in interactions between a few of them. In this case it is best to use + PxSceneDesc.kineKineFilteringMode = PxPairFilteringMode::eKILL, and then raise the + eFORCE_KINE_KINE_NOTIFICATIONS flag on the small set of kinematic actors that need + notifications. + + \note This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + + \warning Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + + @see PxPairFilteringMode PxSceneDesc.kineKineFilteringMode + */ + eFORCE_KINE_KINE_NOTIFICATIONS = (1<<8), + + /** + \brief Forces static-kinematic pairs notifications for this actor. + + Similar to eFORCE_KINE_KINE_NOTIFICATIONS, but for static-kinematic interactions. + + \note This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + + \warning Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + + @see PxPairFilteringMode PxSceneDesc.staticKineFilteringMode + */ + eFORCE_STATIC_KINE_NOTIFICATIONS = (1<<9), + + /** + \brief Enables computation of gyroscopic forces on the rigid body. + */ + eENABLE_GYROSCOPIC_FORCES = (1<<10), + + /** + \brief Reserved for internal usage + */ + eRESERVED PX_DEPRECATED = (1<<15) + }; +}; + +/** +\brief collection of set bits defined in PxRigidBodyFlag. + +@see PxRigidBodyFlag +*/ +typedef PxFlags PxRigidBodyFlags; +PX_FLAGS_OPERATORS(PxRigidBodyFlag::Enum,PxU16) + +/** +\brief PxRigidBody is a base class shared between dynamic rigid body objects. + +@see PxRigidActor +*/ + +class PxRigidBody : public PxRigidActor +{ +public: + // Runtime modifications + +/************************************************************************************************/ +/** @name Mass Manipulation +*/ + + /** + \brief Sets the pose of the center of mass relative to the actor. + + \note Changing this transform will not move the actor in the world! + + \note Setting an unrealistic center of mass which is a long way from the body can make it difficult for + the SDK to solve constraints. Perhaps leading to instability and jittering bodies. + + Default: the identity transform + + \param[in] pose Mass frame offset transform relative to the actor frame. Range: rigid body transform. + + @see getCMassLocalPose() PxRigidBodyDesc.massLocalPose + */ + virtual void setCMassLocalPose(const PxTransform& pose) = 0; + + /** + \brief Retrieves the center of mass pose relative to the actor frame. + + \return The center of mass pose relative to the actor frame. + + @see setCMassLocalPose() PxRigidBodyDesc.massLocalPose + */ + virtual PxTransform getCMassLocalPose() const = 0; + + /** + \brief Sets the mass of a dynamic actor. + + The mass must be non-negative. + + setMass() does not update the inertial properties of the body, to change the inertia tensor + use setMassSpaceInertiaTensor() or the PhysX extensions method #PxRigidBodyExt::updateMassAndInertia(). + + \note A value of 0 is interpreted as infinite mass. + \note Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + + Default: 1.0 + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] mass New mass value for the actor. Range: [0, PX_MAX_F32) + + @see getMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor() + */ + virtual void setMass(PxReal mass) = 0; + + /** + \brief Retrieves the mass of the actor. + + \note A value of 0 is interpreted as infinite mass. + + \return The mass of this actor. + + @see setMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor() + */ + virtual PxReal getMass() const = 0; + + /** + \brief Retrieves the inverse mass of the actor. + + \return The inverse mass of this actor. + + @see setMass() PxRigidBodyDesc.mass setMassSpaceInertiaTensor() + */ + virtual PxReal getInvMass() const = 0; + + /** + \brief Sets the inertia tensor, using a parameter specified in mass space coordinates. + + Note that such matrices are diagonal -- the passed vector is the diagonal. + + If you have a non diagonal world/actor space inertia tensor(3x3 matrix). Then you need to + diagonalize it and set an appropriate mass space transform. See #setCMassLocalPose(). + + The inertia tensor elements must be non-negative. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + \note Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + + Default: (1.0, 1.0, 1.0) + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] m New mass space inertia tensor for the actor. + + @see PxRigidBodyDesc.massSpaceInertia getMassSpaceInertia() setMass() setCMassLocalPose() + */ + virtual void setMassSpaceInertiaTensor(const PxVec3& m) = 0; + + /** + \brief Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame. + + This method retrieves a mass frame inertia vector. + + \return The mass space inertia tensor of this actor. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + + @see PxRigidBodyDesc.massSpaceInertia setMassSpaceInertiaTensor() setMass() setCMassLocalPose() + */ + virtual PxVec3 getMassSpaceInertiaTensor() const = 0; + + /** + \brief Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame. + + This method retrieves a mass frame inverse inertia vector. + + \note A value of 0 in an element is interpreted as infinite inertia along that axis. + + \return The mass space inverse inertia tensor of this actor. + + @see PxRigidBodyDesc.massSpaceInertia setMassSpaceInertiaTensor() setMass() setCMassLocalPose() + */ + virtual PxVec3 getMassSpaceInvInertiaTensor() const = 0; + + /************************************************************************************************/ + /** @name Damping + */ + + /** + \brief Sets the linear damping coefficient. + + Zero represents no damping. The damping coefficient must be nonnegative. + + Default: 0.0 + + \param[in] linDamp Linear damping coefficient. Range: [0, PX_MAX_F32) + + @see getLinearDamping() setAngularDamping() + */ + virtual void setLinearDamping(PxReal linDamp) = 0; + + /** + \brief Retrieves the linear damping coefficient. + + \return The linear damping coefficient associated with this actor. + + @see setLinearDamping() getAngularDamping() + */ + virtual PxReal getLinearDamping() const = 0; + + /** + \brief Sets the angular damping coefficient. + + Zero represents no damping. + + The angular damping coefficient must be nonnegative. + + Default: 0.05 + + \param[in] angDamp Angular damping coefficient. Range: [0, PX_MAX_F32) + + @see getAngularDamping() setLinearDamping() + */ + virtual void setAngularDamping(PxReal angDamp) = 0; + + /** + \brief Retrieves the angular damping coefficient. + + \return The angular damping coefficient associated with this actor. + + @see setAngularDamping() getLinearDamping() + */ + virtual PxReal getAngularDamping() const = 0; + + +/************************************************************************************************/ +/** @name Velocity +*/ + + /** + \brief Retrieves the linear velocity of an actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return The linear velocity of the actor. + + @see PxRigidDynamic.setLinearVelocity() getAngularVelocity() + */ + virtual PxVec3 getLinearVelocity() const = 0; + + /** + \brief Retrieves the angular velocity of the actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return The angular velocity of the actor. + + @see PxRigidDynamic.setAngularVelocity() getLinearVelocity() + */ + virtual PxVec3 getAngularVelocity() const = 0; + + /** + \brief Lets you set the maximum linear velocity permitted for this actor. + + With this function, you can set the maximum linear velocity permitted for this rigid body. + Higher angular velocities are clamped to this value. + + Note: The angular velocity is clamped to the set value before the solver, which means that + the limit may still be momentarily exceeded. + + Default: PX_MAX_F32 + + \param[in] maxLinVel Max allowable linear velocity for actor. Range: [0, PX_MAX_F32) + + @see getMaxAngularVelocity() + */ + virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0; + + /** + \brief Retrieves the maximum angular velocity permitted for this actor. + + \return The maximum allowed angular velocity for this actor. + + @see setMaxLinearVelocity + */ + virtual PxReal getMaxLinearVelocity() const = 0; + + /** + \brief Lets you set the maximum angular velocity permitted for this actor. + + For various internal computations, very quickly rotating actors introduce error + into the simulation, which leads to undesired results. + + With this function, you can set the maximum angular velocity permitted for this rigid body. + Higher angular velocities are clamped to this value. + + Note: The angular velocity is clamped to the set value before the solver, which means that + the limit may still be momentarily exceeded. + + Default: 100.0 + + \param[in] maxAngVel Max allowable angular velocity for actor. Range: [0, PX_MAX_F32) + + @see getMaxAngularVelocity() + */ + virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0; + + /** + \brief Retrieves the maximum angular velocity permitted for this actor. + + \return The maximum allowed angular velocity for this actor. + + @see setMaxAngularVelocity + */ + virtual PxReal getMaxAngularVelocity() const = 0; + +/************************************************************************************************/ +/** @name Forces +*/ + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame to the actor at its center of mass. + + This will not induce a torque. + + ::PxForceMode determines if the force is to be conventional or impulsive. + + Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators and are just short hand for multiplying the vector parameter by inverse mass and then using PxForceMode::eACCELERATION and + PxForceMode::eVELOCITY_CHANGE respectively. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note if this is called on an articulation link, only the link is updated, not the entire articulation. + + \note see #PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in linear velocity that + will arise from the application of an impulsive force, where an impulsive force is applied force multiplied by a timestep. + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the force is non-zero. + + \param[in] force Force/Impulse to apply defined in the global frame. + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode) + \param[in] autowake Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value + is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + @see PxForceMode addTorque + */ + virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0; + + /** + \brief Applies an impulsive torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the torque is to be conventional or impulsive. + + Each actor has an angular acceleration and an angular velocity change accumulator which are directly modified using the modes + PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE + also modify these same accumulators and are just short hand for multiplying the vector parameter by inverse inertia and then + using PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note if this called on an articulation link, only the link is updated, not the entire articulation. + + \note see #PxRigidBodyExt::computeVelocityDeltaFromImpulse for details of how to compute the change in angular velocity that + will arise from the application of an impulsive torque, where an impulsive torque is an applied torque multiplied by a timestep. + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the torque is non-zero. + + \param[in] torque Torque to apply defined in the global frame. Range: torque vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] autowake Specify if the call should wake up the actor if it is currently asleep. If true and the current wake counter value + is smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + @see PxForceMode addForce() + */ + virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0; + + /** + \brief Clears the accumulated forces (sets the accumulated force back to zero). + + Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators (see PxRigidBody::addForce() for details); therefore the effect of calling clearForce(PxForceMode::eFORCE) is equivalent to calling + clearForce(PxForceMode::eACCELERATION), and the effect of calling clearForce(PxForceMode::eIMPULSE) is equivalent to calling + clearForce(PxForceMode::eVELOCITY_CHANGE). + + ::PxForceMode determines if the cleared force is to be conventional or impulsive. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] mode The mode to use when clearing the force/impulse(see #PxForceMode) + + @see PxForceMode addForce + */ + virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Clears the impulsive torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + + Each actor has an angular acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + accumulators (see PxRigidBody::addTorque() for details); therefore the effect of calling clearTorque(PxForceMode::eFORCE) is equivalent to calling + clearTorque(PxForceMode::eACCELERATION), and the effect of calling clearTorque(PxForceMode::eIMPULSE) is equivalent to calling + clearTorque(PxForceMode::eVELOCITY_CHANGE). + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] mode The mode to use when clearing the force/impulse(see #PxForceMode). + + @see PxForceMode addTorque + */ + virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Sets the impulsive force and torque defined in the global coordinate frame to the actor. + + ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + + \note The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + @see PxForceMode addTorque + */ + virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0; + + /** + \brief Raises or clears a particular rigid body flag. + + See the list of flags #PxRigidBodyFlag + + Default: no flags are set + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] flag The PxRigidBody flag to raise(set) or clear. See #PxRigidBodyFlag. + \param[in] value The new boolean value for the flag. + + @see PxRigidBodyFlag getRigidBodyFlags() + */ + virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0; + virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0; + + /** + \brief Reads the PxRigidBody flags. + + See the list of flags #PxRigidBodyFlag + + \return The values of the PxRigidBody flags. + + @see PxRigidBodyFlag setRigidBodyFlag() + */ + virtual PxRigidBodyFlags getRigidBodyFlags() const = 0; + + /** + \brief Sets the CCD minimum advance coefficient. + + The CCD minimum advance coefficient is a value in the range [0, 1] that is used to control the minimum amount of time a body is integrated when + it has a CCD contact. The actual minimum amount of time that is integrated depends on various properties, including the relative speed and collision shapes + of the bodies involved in the contact. From these properties, a numeric value is calculated that determines the maximum distance (and therefore maximum time) + which these bodies could be integrated forwards that would ensure that these bodies did not pass through each-other. This value is then scaled by CCD minimum advance + coefficient to determine the amount of time that will be consumed in the CCD pass. + + Things to consider: + A large value (approaching 1) ensures that the objects will always advance some time. However, larger values increase the chances of objects gently drifting through each-other in + scenes which the constraint solver can't converge, e.g. scenes where an object is being dragged through a wall with a constraint. + A value of 0 ensures that the pair of objects stop at the exact time-of-impact and will not gently drift through each-other. However, with very small/thin objects initially in + contact, this can lead to a large amount of time being dropped and increases the chances of jamming. Jamming occurs when the an object is persistently in contact with an object + such that the time-of-impact is 0, which results in no time being advanced for those objects in that CCD pass. + + The chances of jamming can be reduced by increasing the number of CCD mass @see PxSceneDesc.ccdMaxPasses. However, increasing this number increases the CCD overhead. + + \param[in] advanceCoefficient The CCD min advance coefficient. Range: [0, 1] Default: 0.15 + */ + virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0; + + /** + \brief Gets the CCD minimum advance coefficient. + + \return The value of the CCD min advance coefficient. + + @see setMinCCDAdvanceCoefficient + */ + virtual PxReal getMinCCDAdvanceCoefficient() const = 0; + + /** + \brief Sets the maximum depenetration velocity permitted to be introduced by the solver. + This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + \param[in] biasClamp The maximum velocity to de-penetrate by Range: (0, PX_MAX_F32]. + */ + virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0; + + /** + \brief Returns the maximum depenetration velocity the solver is permitted to introduced. + This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + \return The maximum penetration bias applied by the solver. + */ + virtual PxReal getMaxDepenetrationVelocity() const = 0; + + /** + \brief Sets a limit on the impulse that may be applied at a contact. The maximum impulse at a contact between two dynamic or kinematic + bodies will be the minimum of the two limit values. For a collision between a static and a dynamic body, the impulse is limited + by the value for the dynamic body. + + \param[in] maxImpulse the maximum contact impulse. Range: [0, PX_MAX_F32] Default: PX_MAX_F32 + + @see getMaxContactImpulse + */ + virtual void setMaxContactImpulse(PxReal maxImpulse) = 0; + + /** + \brief Returns the maximum impulse that may be applied at a contact. + + \return The maximum impulse that may be applied at a contact + + @see setMaxContactImpulse + */ + virtual PxReal getMaxContactImpulse() const = 0; + + /** + \brief Sets a distance scale whereby the angular influence of a contact on the normal constraint in a contact is + zeroed if normal.cross(offset) falls below this tolerance. Rather than acting as an absolute value, this tolerance + is scaled by the ratio rXn.dot(angVel)/normal.dot(linVel) such that contacts that have relatively larger angular velocity + than linear normal velocity (e.g. rolling wheels) achieve larger slop values as the angular velocity increases. + + \param[in] slopCoefficient the Slop coefficient. Range: [0, PX_MAX_F32] Default: 0 + + @see getContactSlopCoefficient + */ + virtual void setContactSlopCoefficient(PxReal slopCoefficient) = 0; + + /** + \brief Returns the contact slop coefficient. + + \return The contact slop coefficient. + + @see setContactSlopCoefficient + */ + virtual PxReal getContactSlopCoefficient() const = 0; + + /** + \brief Returns the island node index + + \return The island node index. + */ + virtual PxNodeIndex getInternalIslandNodeIndex() const = 0; + +protected: + PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {} + PX_INLINE PxRigidBody(PxBaseFlags baseFlags) : PxRigidActor(baseFlags) {} + virtual ~PxRigidBody() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidBody", name) || PxRigidActor::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidDynamic.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidDynamic.h new file mode 100644 index 0000000..fa46bc6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidDynamic.h @@ -0,0 +1,454 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_DYNAMIC_H +#define PX_RIGID_DYNAMIC_H +/** \addtogroup physics +@{ +*/ + +#include "PxRigidBody.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief Collection of flags providing a mechanism to lock motion along/around a specific axis. + +@see PxRigidDynamic.setRigidDynamicLockFlag(), PxRigidBody.getRigidDynamicLockFlags() +*/ +struct PxRigidDynamicLockFlag +{ + enum Enum + { + eLOCK_LINEAR_X = (1 << 0), + eLOCK_LINEAR_Y = (1 << 1), + eLOCK_LINEAR_Z = (1 << 2), + eLOCK_ANGULAR_X = (1 << 3), + eLOCK_ANGULAR_Y = (1 << 4), + eLOCK_ANGULAR_Z = (1 << 5) + }; +}; + +typedef PxFlags PxRigidDynamicLockFlags; +PX_FLAGS_OPERATORS(PxRigidDynamicLockFlag::Enum, PxU8) + +/** +\brief PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK. + +

Creation

+Instances of this class are created by calling #PxPhysics::createRigidDynamic() and deleted with #release(). + + +

Visualizations

+\li #PxVisualizationParameter::eACTOR_AXES +\li #PxVisualizationParameter::eBODY_AXES +\li #PxVisualizationParameter::eBODY_MASS_AXES +\li #PxVisualizationParameter::eBODY_LIN_VELOCITY +\li #PxVisualizationParameter::eBODY_ANG_VELOCITY + +@see PxRigidBody PxPhysics.createRigidDynamic() release() +*/ + +class PxRigidDynamic : public PxRigidBody +{ +public: + // Runtime modifications + + +/************************************************************************************************/ +/** @name Kinematic Actors +*/ + + /** + \brief Moves kinematically controlled dynamic actors through the game world. + + You set a dynamic actor to be kinematic using the PxRigidBodyFlag::eKINEMATIC flag + with setRigidBodyFlag(). + + The move command will result in a velocity that will move the body into + the desired pose. After the move is carried out during a single time step, + the velocity is returned to zero. Thus, you must continuously call + this in every time step for kinematic actors so that they move along a path. + + This function simply stores the move destination until the next simulation + step is processed, so consecutive calls will simply overwrite the stored target variable. + + The motion is always fully carried out. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + Sleeping: This call wakes the actor if it is sleeping and will set the wake counter to #PxSceneDesc::wakeCounterResetValue. + + \param[in] destination The desired pose for the kinematic actor, in the global frame. Range: rigid body transform. + + @see getKinematicTarget() PxRigidBodyFlag setRigidBodyFlag() + */ + virtual void setKinematicTarget(const PxTransform& destination) = 0; + + /** + \brief Get target pose of a kinematically controlled dynamic actor. + + \param[out] target Transform to write the target pose to. Only valid if the method returns true. + \return True if the actor is a kinematically controlled dynamic and the target has been set, else False. + + @see setKinematicTarget() PxRigidBodyFlag setRigidBodyFlag() + */ + virtual bool getKinematicTarget(PxTransform& target) const = 0; + + +/************************************************************************************************/ +/** @name Sleeping +*/ + + /** + \brief Returns true if this body is sleeping. + + When an actor does not move for a period of time, it is no longer simulated in order to save time. This state + is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + or one of its properties is changed by the user, the entire sleep mechanism should be transparent to the user. + + In general, a dynamic rigid actor is guaranteed to be awake if at least one of the following holds: + + \li The wake counter is positive (see #setWakeCounter()). + \li The linear or angular velocity is non-zero. + \li A non-zero force or torque has been applied. + + If a dynamic rigid actor is sleeping, the following state is guaranteed: + + \li The wake counter is zero. + \li The linear and angular velocity is zero. + \li There is no force update pending. + + When an actor gets inserted into a scene, it will be considered asleep if all the points above hold, else it will be treated as awake. + + If an actor is asleep after the call to PxScene::fetchResults() returns, it is guaranteed that the pose of the actor + was not changed. You can use this information to avoid updating the transforms of associated objects. + + \note A kinematic actor is asleep unless a target pose has been set (in which case it will stay awake until two consecutive + simulation steps without a target pose being set have passed). The wake counter will get set to zero or to the reset value + #PxSceneDesc::wakeCounterResetValue in the case where a target pose has been set to be consistent with the definitions above. + + \note It is invalid to use this method if the actor has not been added to a scene already. + + \note It is not allowed to use this method while the simulation is running. + + \return True if the actor is sleeping. + + @see isSleeping() wakeUp() putToSleep() getSleepThreshold() + */ + virtual bool isSleeping() const = 0; + + + /** + \brief Sets the mass-normalized kinetic energy threshold below which an actor may go to sleep. + + Actors whose kinetic energy divided by their mass is below this threshold will be candidates for sleeping. + + Default: 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed + + \param[in] threshold Energy below which an actor may go to sleep. Range: [0, PX_MAX_F32) + + @see isSleeping() getSleepThreshold() wakeUp() putToSleep() PxTolerancesScale + */ + virtual void setSleepThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized kinetic energy below which an actor may go to sleep. + + \return The energy threshold for sleeping. + + @see isSleeping() wakeUp() putToSleep() setSleepThreshold() + */ + virtual PxReal getSleepThreshold() const = 0; + + /** + \brief Sets the mass-normalized kinetic energy threshold below which an actor may participate in stabilization. + + Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc. + + Default: 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed + + \param[in] threshold Energy below which an actor may participate in stabilization. Range: [0,inf) + + @see getStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual void setStabilizationThreshold(PxReal threshold) = 0; + + /** + \brief Returns the mass-normalized kinetic energy below which an actor may participate in stabilization. + + Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + + \return The energy threshold for participating in stabilization. + + @see setStabilizationThreshold() PxSceneFlag::eENABLE_STABILIZATION + */ + virtual PxReal getStabilizationThreshold() const = 0; + + + /** + \brief Reads the PxRigidDynamic lock flags. + + See the list of flags #PxRigidDynamicLockFlag + + \return The values of the PxRigidDynamicLock flags. + + @see PxRigidDynamicLockFlag setRigidDynamicLockFlag() + */ + virtual PxRigidDynamicLockFlags getRigidDynamicLockFlags() const = 0; + + /** + \brief Raises or clears a particular rigid dynamic lock flag. + + See the list of flags #PxRigidDynamicLockFlag + + Default: no flags are set + + + \param[in] flag The PxRigidDynamicLockBody flag to raise(set) or clear. See #PxRigidBodyFlag. + \param[in] value The new boolean value for the flag. + + @see PxRigidDynamicLockFlag getRigidDynamicLockFlags() + */ + virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) = 0; + virtual void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) = 0; + + /** + \brief Retrieves the linear velocity of an actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return The linear velocity of the actor. + + @see PxRigidDynamic.setLinearVelocity() getAngularVelocity() + */ + virtual PxVec3 getLinearVelocity() const = 0; + + /** + \brief Sets the linear velocity of the actor. + + Note that if you continuously set the velocity of an actor yourself, + forces such as gravity or friction will not be able to manifest themselves, because forces directly + influence only the velocity/momentum of an actor. + + Default: (0.0, 0.0, 0.0) + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the + new velocity is non-zero. + + \note It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] linVel New linear velocity of actor. Range: velocity vector + \param[in] autowake Whether to wake the object up if it is asleep. If true and the current wake counter value is + smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + @see getLinearVelocity() setAngularVelocity() + */ + virtual void setLinearVelocity(const PxVec3& linVel, bool autowake = true) = 0; + + /** + \brief Retrieves the angular velocity of the actor. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \return The angular velocity of the actor. + + @see PxRigidDynamic.setAngularVelocity() getLinearVelocity() + */ + virtual PxVec3 getAngularVelocity() const = 0; + + /** + \brief Sets the angular velocity of the actor. + + Note that if you continuously set the angular velocity of an actor yourself, + forces such as friction will not be able to rotate the actor, because forces directly influence only the velocity/momentum. + + Default: (0.0, 0.0, 0.0) + + Sleeping: This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the + new velocity is non-zero. + + \note It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + + \param[in] angVel New angular velocity of actor. Range: angular velocity vector + \param[in] autowake Whether to wake the object up if it is asleep. If true and the current wake counter value is + smaller than #PxSceneDesc::wakeCounterResetValue it will get increased to the reset value. + + @see getAngularVelocity() setLinearVelocity() + */ + virtual void setAngularVelocity(const PxVec3& angVel, bool autowake = true) = 0; + /** + \brief Sets the wake counter for the actor. + + The wake counter value determines the minimum amount of time until the body can be put to sleep. Please note + that a body will not be put to sleep if the energy is above the specified threshold (see #setSleepThreshold()) + or if other awake bodies are touching it. + + \note Passing in a positive value will wake the actor up automatically. + + \note It is invalid to use this method for kinematic actors since the wake counter for kinematics is defined + based on whether a target pose has been set (see the comment in #isSleeping()). + + \note It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + + Default: 0.4 (which corresponds to 20 frames for a time step of 0.02) + + \param[in] wakeCounterValue Wake counter value. Range: [0, PX_MAX_F32) + + @see isSleeping() getWakeCounter() + */ + virtual void setWakeCounter(PxReal wakeCounterValue) = 0; + + /** + \brief Returns the wake counter of the actor. + + \note It is not allowed to use this method while the simulation is running. + + \return The wake counter of the actor. + + @see isSleeping() setWakeCounter() + */ + virtual PxReal getWakeCounter() const = 0; + + /** + \brief Wakes up the actor if it is sleeping. + + The actor will get woken up and might cause other touching actors to wake up as well during the next simulation step. + + \note This will set the wake counter of the actor to the value specified in #PxSceneDesc::wakeCounterResetValue. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined + based on whether a target pose has been set (see the comment in #isSleeping()). + + @see isSleeping() putToSleep() + */ + virtual void wakeUp() = 0; + + /** + \brief Forces the actor to sleep. + + The actor will stay asleep during the next simulation step if not touched by another non-sleeping actor. + + \note Any applied force will be cleared and the velocity and the wake counter of the actor will be set to 0. + + \note It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + + \note It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined + based on whether a target pose has been set (see the comment in #isSleeping()). + + @see isSleeping() wakeUp() + */ + virtual void putToSleep() = 0; + +/************************************************************************************************/ + + /** + \brief Sets the solver iteration counts for the body. + + The solver iteration count determines how accurately joints and contacts are resolved. + If you are having trouble with jointed bodies oscillating and behaving erratically, then + setting a higher position iteration count may improve their stability. + + If intersecting bodies are being depenetrated too violently, increase the number of velocity + iterations. More velocity iterations will drive the relative exit velocity of the intersecting + objects closer to the correct value given the restitution. + + Default: 4 position iterations, 1 velocity iteration + + \param[in] minPositionIters Number of position iterations the solver should perform for this body. Range: [1,255] + \param[in] minVelocityIters Number of velocity iterations the solver should perform for this body. Range: [0,255] + + @see getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Retrieves the solver iteration counts. + + @see setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + /** + \brief Retrieves the force threshold for contact reports. + + The contact report threshold is a force threshold. If the force between + two actors exceeds this threshold for either of the two actors, a contact report + will be generated according to the contact report threshold flags provided by + the filter shader/callback. + See #PxPairFlag. + + The threshold used for a collision between a dynamic actor and the static environment is + the threshold of the dynamic actor, and all contacts with static actors are summed to find + the total normal force. + + Default: PX_MAX_F32 + + \return Force threshold for contact reports. + + @see setContactReportThreshold PxPairFlag PxSimulationFilterShader PxSimulationFilterCallback + */ + virtual PxReal getContactReportThreshold() const = 0; + + /** + \brief Sets the force threshold for contact reports. + + See #getContactReportThreshold(). + + \param[in] threshold Force threshold for contact reports. Range: [0, PX_MAX_F32) + + @see getContactReportThreshold PxPairFlag + */ + virtual void setContactReportThreshold(PxReal threshold) = 0; + + virtual const char* getConcreteTypeName() const { return "PxRigidDynamic"; } + +protected: + PX_INLINE PxRigidDynamic(PxType concreteType, PxBaseFlags baseFlags) : PxRigidBody(concreteType, baseFlags) { } + PX_INLINE PxRigidDynamic(PxBaseFlags baseFlags) : PxRigidBody(baseFlags) {} + virtual ~PxRigidDynamic() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidDynamic", name) || PxRigidBody::isKindOf(name); } + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidStatic.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidStatic.h new file mode 100644 index 0000000..57c6ebe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxRigidStatic.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_STATIC_H +#define PX_RIGID_STATIC_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxRigidActor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PxRigidStatic represents a static rigid body simulation object in the physics SDK. + +PxRigidStatic objects are static rigid physics entities. They shall be used to define solid objects which are fixed in the world. + +

Creation

+Instances of this class are created by calling #PxPhysics::createRigidStatic() and deleted with #release(). + +

Visualizations

+\li #PxVisualizationParameter::eACTOR_AXES + +@see PxRigidActor PxPhysics.createRigidStatic() release() +*/ + +class PxRigidStatic : public PxRigidActor +{ +public: + virtual const char* getConcreteTypeName() const { return "PxRigidStatic"; } + +protected: + PX_INLINE PxRigidStatic(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {} + PX_INLINE PxRigidStatic(PxBaseFlags baseFlags) : PxRigidActor(baseFlags){} + virtual ~PxRigidStatic() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidStatic", name) || PxRigidActor::isKindOf(name); } + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxScene.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxScene.h new file mode 100644 index 0000000..05851fd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxScene.h @@ -0,0 +1,1816 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_H +#define PX_SCENE_H +/** \addtogroup physics +@{ +*/ + +#include "PxSceneQuerySystem.h" +#include "PxSceneDesc.h" +#include "PxVisualizationParameter.h" +#include "PxSimulationStatistics.h" +#include "PxClient.h" +#include "task/PxTask.h" +#include "PxArticulationFlag.h" +#include "PxSoftBodyFlag.h" +#include "PxHairSystemFlag.h" +#include "PxActorData.h" +#include "PxParticleSystemFlag.h" +#include "PxParticleSolverType.h" + +#include "pvd/PxPvdSceneClient.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxCollection; +class PxConstraint; +class PxSimulationEventCallback; +class PxPhysics; +class PxAggregate; +class PxRenderBuffer; +class PxArticulationReducedCoordinate; +class PxParticleSystem; + +struct PxContactPairHeader; + +typedef PxU8 PxDominanceGroup; + +class PxPvdSceneClient; + +class PxSoftBody; +class PxFEMCloth; +class PxHairSystem; + +/** +\brief Expresses the dominance relationship of a contact. +For the time being only three settings are permitted: + +(1, 1), (0, 1), and (1, 0). + +@see getDominanceGroup() PxDominanceGroup PxScene::setDominanceGroupPair() +*/ +struct PxDominanceGroupPair +{ + PxDominanceGroupPair(PxU8 a, PxU8 b) + : dominance0(a), dominance1(b) {} + PxU8 dominance0; + PxU8 dominance1; +}; + + +/** +\brief Identifies each type of actor for retrieving actors from a scene. + +\note #PxArticulationLink objects are not supported. Use the #PxArticulationReducedCoordinate object to retrieve all its links. + +@see PxScene::getActors(), PxScene::getNbActors() +*/ +struct PxActorTypeFlag +{ + enum Enum + { + /** + \brief A static rigid body + @see PxRigidStatic + */ + eRIGID_STATIC = (1 << 0), + + /** + \brief A dynamic rigid body + @see PxRigidDynamic + */ + eRIGID_DYNAMIC = (1 << 1) + }; +}; + +/** +\brief Collection of set bits defined in PxActorTypeFlag. + +@see PxActorTypeFlag +*/ +typedef PxFlags PxActorTypeFlags; +PX_FLAGS_OPERATORS(PxActorTypeFlag::Enum,PxU16) + +class PxActor; + +/** +\brief Broad-phase callback to receive broad-phase related events. + +Each broadphase callback object is associated with a PxClientID. It is possible to register different +callbacks for different clients. The callback functions are called this way: +- for shapes/actors, the callback assigned to the actors' clients are used +- for aggregates, the callbacks assigned to clients from aggregated actors are used + +\note SDK state should not be modified from within the callbacks. In particular objects should not +be created or destroyed. If state modification is needed then the changes should be stored to a buffer +and performed after the simulation step. + +Threading: It is not necessary to make this class thread safe as it will only be called in the context of the +user thread. + +@see PxSceneDesc PxScene.setBroadPhaseCallback() PxScene.getBroadPhaseCallback() +*/ +class PxBroadPhaseCallback +{ + public: + virtual ~PxBroadPhaseCallback() {} + + /** + \brief Out-of-bounds notification. + + This function is called when an object leaves the broad-phase. + + \param[in] shape Shape that left the broad-phase bounds + \param[in] actor Owner actor + */ + virtual void onObjectOutOfBounds(PxShape& shape, PxActor& actor) = 0; + + /** + \brief Out-of-bounds notification. + + This function is called when an aggregate leaves the broad-phase. + + \param[in] aggregate Aggregate that left the broad-phase bounds + */ + virtual void onObjectOutOfBounds(PxAggregate& aggregate) = 0; +}; + +/** + \brief A scene is a collection of bodies and constraints which can interact. + + The scene simulates the behavior of these objects over time. Several scenes may exist + at the same time, but each body or constraint is specific to a scene + -- they may not be shared. + + @see PxSceneDesc PxPhysics.createScene() release() +*/ +class PxScene : public PxSceneSQSystem +{ + protected: + + /************************************************************************************************/ + + /** @name Basics + */ + //@{ + + PxScene() : userData(NULL) {} + virtual ~PxScene() {} + + public: + + /** + \brief Deletes the scene. + + Removes any actors and constraint shaders from this scene + (if the user hasn't already done so). + + Be sure to not keep a reference to this object after calling release. + Avoid release calls while the scene is simulating (in between simulate() and fetchResults() calls). + + @see PxPhysics.createScene() + */ + virtual void release() = 0; + + /** + \brief Sets a scene flag. You can only set one flag at a time. + + \note Not all flags are mutable and changing some will result in an error. Please check #PxSceneFlag to see which flags can be changed. + + @see PxSceneFlag + */ + virtual void setFlag(PxSceneFlag::Enum flag, bool value) = 0; + + /** + \brief Get the scene flags. + + \return The scene flags. See #PxSceneFlag + + @see PxSceneFlag + */ + virtual PxSceneFlags getFlags() const = 0; + + /** + \brief Set new scene limits. + + \note Increase the maximum capacity of various data structures in the scene. The new capacities will be + at least as large as required to deal with the objects currently in the scene. Further, these values + are for preallocation and do not represent hard limits. + + \param[in] limits Scene limits. + @see PxSceneLimits + */ + virtual void setLimits(const PxSceneLimits& limits) = 0; + + /** + \brief Get current scene limits. + \return Current scene limits. + @see PxSceneLimits + */ + virtual PxSceneLimits getLimits() const = 0; + + /** + \brief Call this method to retrieve the Physics SDK. + + \return The physics SDK this scene is associated with. + + @see PxPhysics + */ + virtual PxPhysics& getPhysics() = 0; + + /** + \brief Retrieves the scene's internal timestamp, increased each time a simulation step is completed. + + \return scene timestamp + */ + virtual PxU32 getTimestamp() const = 0; + + //@} + /************************************************************************************************/ + + /** @name Add/Remove Articulations + */ + //@{ + /** + \brief Adds an articulation to this scene. + + \note If the articulation is already assigned to a scene (see #PxArticulationReducedCoordinate::getScene), the call is ignored and an error is issued. + + \param[in] articulation The articulation to add to the scene. + \return True if success + + @see PxArticulationReducedCoordinate + */ + virtual bool addArticulation(PxArticulationReducedCoordinate& articulation) = 0; + + /** + \brief Removes an articulation from this scene. + + \note If the articulation is not part of this scene (see #PxArticulationReducedCoordinate::getScene), the call is ignored and an error is issued. + + \note If the articulation is in an aggregate it will be removed from the aggregate. + + \param[in] articulation The articulation to remove from the scene. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. + Only applies to PxArticulationReducedCoordinate and PxRigidActor types. + + @see PxArticulationReducedCoordinate, PxAggregate + */ + virtual void removeArticulation(PxArticulationReducedCoordinate& articulation, bool wakeOnLostTouch = true) = 0; + + //@} + /************************************************************************************************/ + + /** @name Add/Remove Actors + */ + //@{ + /** + \brief Adds an actor to this scene. + + \note If the actor is already assigned to a scene (see #PxActor::getScene), the call is ignored and an error is issued. + \note If the actor has an invalid constraint, in checked builds the call is ignored and an error is issued. + + \note You can not add individual articulation links (see #PxArticulationLink) to the scene. Use #addArticulation() instead. + + \note If the actor is a PxRigidActor then each assigned PxConstraint object will get added to the scene automatically if + it connects to another actor that is part of the scene already. + + \note When a BVH is provided the actor shapes are grouped together. + The scene query pruning structure inside PhysX SDK will store/update one + bound per actor. The scene queries against such an actor will query actor + bounds and then make a local space query against the provided BVH, which is in actor's local space. + + \param[in] actor Actor to add to scene. + \param[in] bvh BVH for actor shapes. + \return True if success + + @see PxActor, PxConstraint::isValid(), PxBVH + */ + virtual bool addActor(PxActor& actor, const PxBVH* bvh = NULL) = 0; + + /** + \brief Adds actors to this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + + \note This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use addActor() instead. + For articulation links, use addArticulation(). + + \note If one of the actors is already assigned to a scene (see #PxActor::getScene), the call is ignored and an error is issued. + + \note If an actor in the array contains an invalid constraint, in checked builds the call is ignored and an error is issued. + \note If an actor in the array is a PxRigidActor then each assigned PxConstraint object will get added to the scene automatically if + it connects to another actor that is part of the scene already. + + \note this method is optimized for high performance. + + \param[in] actors Array of actors to add to scene. + \param[in] nbActors Number of actors in the array. + \return True if success + + @see PxActor, PxConstraint::isValid() + */ + virtual bool addActors(PxActor*const* actors, PxU32 nbActors) = 0; + + /** + \brief Adds a pruning structure together with its actors to this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + + \note This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use addActor() instead. + For articulation links, use addArticulation(). + + \note If an actor in the pruning structure contains an invalid constraint, in checked builds the call is ignored and an error is issued. + \note For all actors in the pruning structure each assigned PxConstraint object will get added to the scene automatically if + it connects to another actor that is part of the scene already. + + \note This method is optimized for high performance. + + \note Merging a PxPruningStructure into an active scene query optimization AABB tree might unbalance the tree. A typical use case for + PxPruningStructure is a large world scenario where blocks of closely positioned actors get streamed in. The merge process finds the + best node in the active scene query optimization AABB tree and inserts the PxPruningStructure. Therefore using PxPruningStructure + for actors scattered throughout the world will result in an unbalanced tree. + + \param[in] pruningStructure Pruning structure for a set of actors. + \return True if success + + @see PxPhysics::createPruningStructure, PxPruningStructure + */ + virtual bool addActors(const PxPruningStructure& pruningStructure) = 0; + + /** + \brief Removes an actor from this scene. + + \note If the actor is not part of this scene (see #PxActor::getScene), the call is ignored and an error is issued. + + \note You can not remove individual articulation links (see #PxArticulationLink) from the scene. Use #removeArticulation() instead. + + \note If the actor is a PxRigidActor then all assigned PxConstraint objects will get removed from the scene automatically. + + \note If the actor is in an aggregate it will be removed from the aggregate. + + \param[in] actor Actor to remove from scene. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types. + + @see PxActor, PxAggregate + */ + virtual void removeActor(PxActor& actor, bool wakeOnLostTouch = true) = 0; + + /** + \brief Removes actors from this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + + \note This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use removeActor() instead. + For articulation links, use removeArticulation(). + + \note If some actor is not part of this scene (see #PxActor::getScene), the actor remove is ignored and an error is issued. + + \note You can not remove individual articulation links (see #PxArticulationLink) from the scene. Use #removeArticulation() instead. + + \note If the actor is a PxRigidActor then all assigned PxConstraint objects will get removed from the scene automatically. + + \param[in] actors Array of actors to add to scene. + \param[in] nbActors Number of actors in the array. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCooridnate and PxRigidActor types. + + @see PxActor + */ + virtual void removeActors(PxActor*const* actors, PxU32 nbActors, bool wakeOnLostTouch = true) = 0; + + /** + \brief Adds an aggregate to this scene. + + \note If the aggregate is already assigned to a scene (see #PxAggregate::getScene), the call is ignored and an error is issued. + \note If the aggregate contains an actor with an invalid constraint, in checked builds the call is ignored and an error is issued. + + \note If the aggregate already contains actors, those actors are added to the scene as well. + + \param[in] aggregate Aggregate to add to scene. + \return True if success + + @see PxAggregate, PxConstraint::isValid() + */ + virtual bool addAggregate(PxAggregate& aggregate) = 0; + + /** + \brief Removes an aggregate from this scene. + + \note If the aggregate is not part of this scene (see #PxAggregate::getScene), the call is ignored and an error is issued. + + \note If the aggregate contains actors, those actors are removed from the scene as well. + + \param[in] aggregate Aggregate to remove from scene. + \param[in] wakeOnLostTouch Specifies whether touching objects from the previous frame should get woken up in the next frame. Only applies to PxArticulationReducedCoordinate and PxRigidActor types. + + @see PxAggregate + */ + virtual void removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch = true) = 0; + + /** + \brief Adds objects in the collection to this scene. + + This function adds the following types of objects to this scene: PxRigidActor (except PxArticulationLink), PxAggregate, PxArticulationReducedCoordinate. + This method is typically used after deserializing the collection in order to populate the scene with deserialized objects. + + \note If the collection contains an actor with an invalid constraint, in checked builds the call is ignored and an error is issued. + + \param[in] collection Objects to add to this scene. See #PxCollection + \return True if success + + @see PxCollection, PxConstraint::isValid() + */ + virtual bool addCollection(const PxCollection& collection) = 0; + //@} + /************************************************************************************************/ + + /** @name Contained Object Retrieval + */ + //@{ + + /** + \brief Retrieve the number of actors of certain types in the scene. For supported types, see PxActorTypeFlags. + + \param[in] types Combination of actor types. + \return the number of actors. + + @see getActors() + */ + virtual PxU32 getNbActors(PxActorTypeFlags types) const = 0; + + /** + \brief Retrieve an array of all the actors of certain types in the scene. For supported types, see PxActorTypeFlags. + + \param[in] types Combination of actor types to retrieve. + \param[out] userBuffer The buffer to receive actor pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of actors written to the buffer. + + @see getNbActors() + */ + virtual PxU32 getActors(PxActorTypeFlags types, PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Queries the PxScene for a list of the PxActors whose transforms have been + updated during the previous simulation step. Only includes actors of type PxRigidDynamic and PxArticulationLink. + + \note PxSceneFlag::eENABLE_ACTIVE_ACTORS must be set. + + \note Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored and NULL will be returned. + + \param[out] nbActorsOut The number of actors returned. + + \return A pointer to the list of active PxActors generated during the last call to fetchResults(). + + @see PxActor + */ + virtual PxActor** getActiveActors(PxU32& nbActorsOut) = 0; + + /** + \brief Retrieve the number of soft bodies in the scene. + + \return the number of soft bodies. + + @see getActors() + */ + PX_DEPRECATED virtual PxU32 getNbSoftBodies() const = 0; + + /** + \brief Retrieve an array of all the soft bodies in the scene. + + \param[out] userBuffer The buffer to receive actor pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of actors written to the buffer. + + @see getNbActors() + */ + PX_DEPRECATED virtual PxU32 getSoftBodies(PxSoftBody** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Retrieve the number of particle systems of the requested type in the scene. + + \param[in] type The particle system type. See PxParticleSolverType. Only one type can be requested per function call. + \return the number particle systems. + + See getParticleSystems(), PxParticleSolverType + */ + PX_DEPRECATED virtual PxU32 getNbParticleSystems(PxParticleSolverType::Enum type) const = 0; + + /** + \brief Retrieve an array of all the particle systems of the requested type in the scene. + + \param[in] type The particle system type. See PxParticleSolverType. Only one type can be requested per function call. + \param[out] userBuffer The buffer to receive particle system pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first particle system pointer to be retrieved + \return Number of particle systems written to the buffer. + + See getNbParticleSystems(), PxParticleSolverType + */ + PX_DEPRECATED virtual PxU32 getParticleSystems(PxParticleSolverType::Enum type, PxParticleSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Retrieve the number of FEM cloths in the scene. + \warning Feature under development, only for internal usage. + + \return the number of FEM cloths. + + See getFEMCloths() + */ + PX_DEPRECATED virtual PxU32 getNbFEMCloths() const = 0; + + /** + \brief Retrieve an array of all the FEM cloths in the scene. + \warning Feature under development, only for internal usage. + + \param[out] userBuffer The buffer to write the FEM cloth pointers to + \param[in] bufferSize Size of the provided user buffer + \param[in] startIndex Index of first FEM cloth pointer to be retrieved + \return Number of FEM cloths written to the buffer + */ + PX_DEPRECATED virtual PxU32 getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Retrieve the number of hair systems in the scene. + \warning Feature under development, only for internal usage. + \return the number of hair systems + @see getActors() + */ + PX_DEPRECATED virtual PxU32 getNbHairSystems() const = 0; + + /** + \brief Retrieve an array of all the hair systems in the scene. + \warning Feature under development, only for internal usage. + + \param[out] userBuffer The buffer to write the actor pointers to + \param[in] bufferSize Size of the provided user buffer + \param[in] startIndex Index of first actor pointer to be retrieved + \return Number of actors written to the buffer + */ + PX_DEPRECATED virtual PxU32 getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Returns the number of articulations in the scene. + + \return the number of articulations in this scene. + + @see getArticulations() + */ + virtual PxU32 getNbArticulations() const = 0; + + /** + \brief Retrieve all the articulations in the scene. + + \param[out] userBuffer The buffer to receive articulations pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first articulations pointer to be retrieved + \return Number of articulations written to the buffer. + + @see getNbArticulations() + */ + virtual PxU32 getArticulations(PxArticulationReducedCoordinate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Returns the number of constraint shaders in the scene. + + \return the number of constraint shaders in this scene. + + @see getConstraints() + */ + virtual PxU32 getNbConstraints() const = 0; + + /** + \brief Retrieve all the constraint shaders in the scene. + + \param[out] userBuffer The buffer to receive constraint shader pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first constraint pointer to be retrieved + \return Number of constraint shaders written to the buffer. + + @see getNbConstraints() + */ + virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Returns the number of aggregates in the scene. + + \return the number of aggregates in this scene. + + @see getAggregates() + */ + virtual PxU32 getNbAggregates() const = 0; + + /** + \brief Retrieve all the aggregates in the scene. + + \param[out] userBuffer The buffer to receive aggregates pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first aggregate pointer to be retrieved + \return Number of aggregates written to the buffer. + + @see getNbAggregates() + */ + virtual PxU32 getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + //@} + /************************************************************************************************/ + + /** @name Dominance + */ + //@{ + + /** + \brief Specifies the dominance behavior of contacts between two actors with two certain dominance groups. + + It is possible to assign each actor to a dominance groups using #PxActor::setDominanceGroup(). + + With dominance groups one can have all contacts created between actors act in one direction only. This is useful, for example, if you + want an object to push debris out of its way and be unaffected,while still responding physically to forces and collisions + with non-debris objects. + + Whenever a contact between two actors (a0, a1) needs to be solved, the groups (g0, g1) of both + actors are retrieved. Then the PxDominanceGroupPair setting for this group pair is retrieved with getDominanceGroupPair(g0, g1). + + In the contact, PxDominanceGroupPair::dominance0 becomes the dominance setting for a0, and + PxDominanceGroupPair::dominance1 becomes the dominance setting for a1. A dominanceN setting of 1.0f, the default, + will permit aN to be pushed or pulled by a(1-N) through the contact. A dominanceN setting of 0.0f, will however + prevent aN to be pushed by a(1-N) via the contact. Thus, a PxDominanceGroupPair of (1.0f, 0.0f) makes + the interaction one-way. + + + The matrix sampled by getDominanceGroupPair(g1, g2) is initialised by default such that: + + if g1 == g2, then (1.0f, 1.0f) is returned + if g1 < g2, then (0.0f, 1.0f) is returned + if g1 > g2, then (1.0f, 0.0f) is returned + + In other words, we permit actors in higher groups to be pushed around by actors in lower groups by default. + + These settings should cover most applications, and in fact not overriding these settings may likely result in higher performance. + + It is not possible to make the matrix asymetric, or to change the diagonal. In other words: + + * it is not possible to change (g1, g2) if (g1==g2) + * if you set + + (g1, g2) to X, then (g2, g1) will implicitly and automatically be set to ~X, where: + + ~(1.0f, 1.0f) is (1.0f, 1.0f) + ~(0.0f, 1.0f) is (1.0f, 0.0f) + ~(1.0f, 0.0f) is (0.0f, 1.0f) + + These two restrictions are to make sure that contacts between two actors will always evaluate to the same dominance + setting, regardless of the order of the actors. + + Dominance settings are currently specified as floats 0.0f or 1.0f because in the future we may permit arbitrary + fractional settings to express 'partly-one-way' interactions. + + Sleeping: Does NOT wake actors up automatically. + + @see getDominanceGroupPair() PxDominanceGroup PxDominanceGroupPair PxActor::setDominanceGroup() PxActor::getDominanceGroup() + */ + virtual void setDominanceGroupPair( + PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance) = 0; + + /** + \brief Samples the dominance matrix. + + @see setDominanceGroupPair() PxDominanceGroup PxDominanceGroupPair PxActor::setDominanceGroup() PxActor::getDominanceGroup() + */ + virtual PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const = 0; + + //@} + /************************************************************************************************/ + + /** @name Dispatcher + */ + //@{ + + /** + \brief Return the cpu dispatcher that was set in PxSceneDesc::cpuDispatcher when creating the scene with PxPhysics::createScene + + @see PxSceneDesc::cpuDispatcher, PxPhysics::createScene + */ + virtual PxCpuDispatcher* getCpuDispatcher() const = 0; + + /** + \brief Return the CUDA context manager that was set in PxSceneDesc::cudaContextManager when creating the scene with PxPhysics::createScene + + Platform specific: Applies to PC GPU only. + + @see PxSceneDesc::cudaContextManager, PxPhysics::createScene + */ + PX_DEPRECATED virtual PxCudaContextManager* getCudaContextManager() const = 0; + + //@} + /************************************************************************************************/ + /** @name Multiclient + */ + //@{ + /** + \brief Reserves a new client ID. + + PX_DEFAULT_CLIENT is always available as the default clientID. + Additional clients are returned by this function. Clients cannot be released once created. + An error is reported when more than a supported number of clients (currently 128) are created. + + @see PxClientID + */ + virtual PxClientID createClient() = 0; + + //@} + + /************************************************************************************************/ + + /** @name Callbacks + */ + //@{ + + /** + \brief Sets a user notify object which receives special simulation events when they occur. + + \note Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[in] callback User notification callback. See #PxSimulationEventCallback. + + @see PxSimulationEventCallback getSimulationEventCallback + */ + virtual void setSimulationEventCallback(PxSimulationEventCallback* callback) = 0; + + /** + \brief Retrieves the simulationEventCallback pointer set with setSimulationEventCallback(). + + \return The current user notify pointer. See #PxSimulationEventCallback. + + @see PxSimulationEventCallback setSimulationEventCallback() + */ + virtual PxSimulationEventCallback* getSimulationEventCallback() const = 0; + + /** + \brief Sets a user callback object, which receives callbacks on all contacts generated for specified actors. + + \note Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[in] callback Asynchronous user contact modification callback. See #PxContactModifyCallback. + */ + virtual void setContactModifyCallback(PxContactModifyCallback* callback) = 0; + + /** + \brief Sets a user callback object, which receives callbacks on all CCD contacts generated for specified actors. + + \note Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[in] callback Asynchronous user contact modification callback. See #PxCCDContactModifyCallback. + */ + virtual void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback) = 0; + + /** + \brief Retrieves the PxContactModifyCallback pointer set with setContactModifyCallback(). + + \return The current user contact modify callback pointer. See #PxContactModifyCallback. + + @see PxContactModifyCallback setContactModifyCallback() + */ + virtual PxContactModifyCallback* getContactModifyCallback() const = 0; + + /** + \brief Retrieves the PxCCDContactModifyCallback pointer set with setContactModifyCallback(). + + \return The current user contact modify callback pointer. See #PxContactModifyCallback. + + @see PxContactModifyCallback setContactModifyCallback() + */ + virtual PxCCDContactModifyCallback* getCCDContactModifyCallback() const = 0; + + /** + \brief Sets a broad-phase user callback object. + + \note Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[in] callback Asynchronous broad-phase callback. See #PxBroadPhaseCallback. + */ + virtual void setBroadPhaseCallback(PxBroadPhaseCallback* callback) = 0; + + /** + \brief Retrieves the PxBroadPhaseCallback pointer set with setBroadPhaseCallback(). + + \return The current broad-phase callback pointer. See #PxBroadPhaseCallback. + + @see PxBroadPhaseCallback setBroadPhaseCallback() + */ + virtual PxBroadPhaseCallback* getBroadPhaseCallback() const = 0; + + //@} + /************************************************************************************************/ + + /** @name Collision Filtering + */ + //@{ + + /** + \brief Sets the shared global filter data which will get passed into the filter shader. + + \note It is the user's responsibility to ensure that changing the shared global filter data does not change the filter output value for existing pairs. + If the filter output for existing pairs does change nonetheless then such a change will not take effect until the pair gets refiltered. + resetFiltering() can be used to explicitly refilter the pairs of specific objects. + + \note The provided data will get copied to internal buffers and this copy will be used for filtering calls. + + \note Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[in] data The shared global filter shader data. + \param[in] dataSize Size of the shared global filter shader data (in bytes). + + @see getFilterShaderData() PxSceneDesc.filterShaderData PxSimulationFilterShader + */ + virtual void setFilterShaderData(const void* data, PxU32 dataSize) = 0; + + /** + \brief Gets the shared global filter data in use for this scene. + + \note The reference points to a copy of the original filter data specified in #PxSceneDesc.filterShaderData or provided by #setFilterShaderData(). + + \return Shared filter data for filter shader. + + @see getFilterShaderDataSize() setFilterShaderData() PxSceneDesc.filterShaderData PxSimulationFilterShader + */ + virtual const void* getFilterShaderData() const = 0; + + /** + \brief Gets the size of the shared global filter data (#PxSceneDesc.filterShaderData) + + \return Size of shared filter data [bytes]. + + @see getFilterShaderData() PxSceneDesc.filterShaderDataSize PxSimulationFilterShader + */ + virtual PxU32 getFilterShaderDataSize() const = 0; + + /** + \brief Gets the custom collision filter shader in use for this scene. + + \return Filter shader class that defines the collision pair filtering. + + @see PxSceneDesc.filterShader PxSimulationFilterShader + */ + PX_DEPRECATED virtual PxSimulationFilterShader getFilterShader() const = 0; + + /** + \brief Gets the custom collision filter callback in use for this scene. + + \return Filter callback class that defines the collision pair filtering. + + @see PxSceneDesc.filterCallback PxSimulationFilterCallback + */ + PX_DEPRECATED virtual PxSimulationFilterCallback* getFilterCallback() const = 0; + + /** + \brief Marks the object to reset interactions and re-run collision filters in the next simulation step. + + This call forces the object to remove all existing collision interactions, to search anew for existing contact + pairs and to run the collision filters again for found collision pairs. + + \note The operation is supported for PxRigidActor objects only. + + \note All persistent state of existing interactions will be lost and can not be retrieved even if the same collison pair + is found again in the next step. This will mean, for example, that you will not get notified about persistent contact + for such an interaction (see #PxPairFlag::eNOTIFY_TOUCH_PERSISTS), the contact pair will be interpreted as newly found instead. + + \note Lost touch contact reports will be sent for every collision pair which includes this shape, if they have + been requested through #PxPairFlag::eNOTIFY_TOUCH_LOST or #PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST. + + \note This is an expensive operation, don't use it if you don't have to. + + \note Can be used to retrieve collision pairs that were killed by the collision filters (see #PxFilterFlag::eKILL) + + \note It is invalid to use this method if the actor has not been added to a scene already. + + \note It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + + \note Do not use this method while the simulation is running. + + Sleeping: Does wake up the actor. + + \param[in] actor The actor for which to re-evaluate interactions. + \return True if success + + @see PxSimulationFilterShader PxSimulationFilterCallback + */ + virtual bool resetFiltering(PxActor& actor) = 0; + + /** + \brief Marks the object to reset interactions and re-run collision filters for specified shapes in the next simulation step. + + This is a specialization of the resetFiltering(PxActor& actor) method and allows to reset interactions for specific shapes of + a PxRigidActor. + + \note Do not use this method while the simulation is running. + + Sleeping: Does wake up the actor. + + \param[in] actor The actor for which to re-evaluate interactions. + \param[in] shapes The shapes for which to re-evaluate interactions. + \param[in] shapeCount Number of shapes in the list. + + @see PxSimulationFilterShader PxSimulationFilterCallback + */ + virtual bool resetFiltering(PxRigidActor& actor, PxShape*const* shapes, PxU32 shapeCount) = 0; + + /** + \brief Gets the pair filtering mode for kinematic-kinematic pairs. + + \return Filtering mode for kinematic-kinematic pairs. + + @see PxPairFilteringMode PxSceneDesc + */ + virtual PxPairFilteringMode::Enum getKinematicKinematicFilteringMode() const = 0; + + /** + \brief Gets the pair filtering mode for static-kinematic pairs. + + \return Filtering mode for static-kinematic pairs. + + @see PxPairFilteringMode PxSceneDesc + */ + virtual PxPairFilteringMode::Enum getStaticKinematicFilteringMode() const = 0; + + //@} + /************************************************************************************************/ + + /** @name Simulation + */ + //@{ + /** + \brief Advances the simulation by an elapsedTime time. + + \note Large elapsedTime values can lead to instabilities. In such cases elapsedTime + should be subdivided into smaller time intervals and simulate() should be called + multiple times for each interval. + + Calls to simulate() should pair with calls to fetchResults(): + Each fetchResults() invocation corresponds to exactly one simulate() + invocation; calling simulate() twice without an intervening fetchResults() + or fetchResults() twice without an intervening simulate() causes an error + condition. + + scene->simulate(); + ...do some processing until physics is computed... + scene->fetchResults(); + ...now results of run may be retrieved. + + + \param[in] elapsedTime Amount of time to advance simulation by. The parameter has to be larger than 0, else the resulting behavior will be undefined. Range: (0, PX_MAX_F32) + \param[in] completionTask if non-NULL, this task will have its refcount incremented in simulate(), then + decremented when the scene is ready to have fetchResults called. So the task will not run until the + application also calls removeReference(). + \param[in] scratchMemBlock a memory region for physx to use for temporary data during simulation. This block may be reused by the application + after fetchResults returns. Must be aligned on a 16-byte boundary + \param[in] scratchMemBlockSize the size of the scratch memory block. Must be a multiple of 16K. + \param[in] controlSimulation if true, the scene controls its PxTaskManager simulation state. Leave + true unless the application is calling the PxTaskManager start/stopSimulation() methods itself. + \return True if success + + @see fetchResults() checkResults() + */ + virtual bool simulate(PxReal elapsedTime, physx::PxBaseTask* completionTask = NULL, + void* scratchMemBlock = 0, PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0; + + /** + \brief Performs dynamics phase of the simulation pipeline. + + \note Calls to advance() should follow calls to fetchCollision(). An error message will be issued if this sequence is not followed. + + \param[in] completionTask if non-NULL, this task will have its refcount incremented in advance(), then + decremented when the scene is ready to have fetchResults called. So the task will not run until the + application also calls removeReference(). + \return True if success + */ + virtual bool advance(physx::PxBaseTask* completionTask = 0) = 0; + + /** + \brief Performs collision detection for the scene over elapsedTime + + \note Calls to collide() should be the first method called to simulate a frame. + + + \param[in] elapsedTime Amount of time to advance simulation by. The parameter has to be larger than 0, else the resulting behavior will be undefined. Range: (0, PX_MAX_F32) + \param[in] completionTask if non-NULL, this task will have its refcount incremented in collide(), then + decremented when the scene is ready to have fetchResults called. So the task will not run until the + application also calls removeReference(). + \param[in] scratchMemBlock a memory region for physx to use for temporary data during simulation. This block may be reused by the application + after fetchResults returns. Must be aligned on a 16-byte boundary + \param[in] scratchMemBlockSize the size of the scratch memory block. Must be a multiple of 16K. + \param[in] controlSimulation if true, the scene controls its PxTaskManager simulation state. Leave + true unless the application is calling the PxTaskManager start/stopSimulation() methods itself. + \return True if success + */ + virtual bool collide(PxReal elapsedTime, physx::PxBaseTask* completionTask = 0, void* scratchMemBlock = 0, + PxU32 scratchMemBlockSize = 0, bool controlSimulation = true) = 0; + + /** + \brief This checks to see if the simulation run has completed. + + This does not cause the data available for reading to be updated with the results of the simulation, it is simply a status check. + The bool will allow it to either return immediately or block waiting for the condition to be met so that it can return true + + \param[in] block When set to true will block until the condition is met. + \return True if the results are available. + + @see simulate() fetchResults() + */ + virtual bool checkResults(bool block = false) = 0; + + /** + This method must be called after collide() and before advance(). It will wait for the collision phase to finish. If the user makes an illegal simulation call, the SDK will issue an error + message. + + \param[in] block When set to true will block until the condition is met, which is collision must finish running. + */ + virtual bool fetchCollision(bool block = false) = 0; + + /** + This is the big brother to checkResults() it basically does the following: + + \code + if ( checkResults(block) ) + { + fire appropriate callbacks + swap buffers + return true + } + else + return false + + \endcode + + \param[in] block When set to true will block until results are available. + \param[out] errorState Used to retrieve hardware error codes. A non zero value indicates an error. + \return True if the results have been fetched. + + @see simulate() checkResults() + */ + virtual bool fetchResults(bool block = false, PxU32* errorState = 0) = 0; + + /** + This call performs the first section of fetchResults, and returns a pointer to the contact streams output by the simulation. It can be used to process contact pairs in parallel, which is often a limiting factor + for fetchResults() performance. + + After calling this function and processing the contact streams, call fetchResultsFinish(). Note that writes to the simulation are not + permitted between the start of fetchResultsStart() and the end of fetchResultsFinish(). + + \param[in] block When set to true will block until results are available. + \param[out] contactPairs an array of pointers to contact pair headers + \param[out] nbContactPairs the number of contact pairs + \return True if the results have been fetched. + + @see simulate() checkResults() fetchResults() fetchResultsFinish() + */ + virtual bool fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block = false) = 0; + + /** + This call processes all event callbacks in parallel. It takes a continuation task, which will be executed once all callbacks have been processed. + + This is a utility function to make it easier to process callbacks in parallel using the PhysX task system. It can only be used in conjunction with + fetchResultsStart(...) and fetchResultsFinish(...) + + \param[in] continuation The task that will be executed once all callbacks have been processed. + */ + virtual void processCallbacks(physx::PxBaseTask* continuation) = 0; + + /** + This call performs the second section of fetchResults. + + It must be called after fetchResultsStart() returns and contact reports have been processed. + + Note that once fetchResultsFinish() has been called, the contact streams returned in fetchResultsStart() will be invalid. + + \param[out] errorState Used to retrieve hardware error codes. A non zero value indicates an error. + + @see simulate() checkResults() fetchResults() fetchResultsStart() + */ + virtual void fetchResultsFinish(PxU32* errorState = 0) = 0; + + /** + This call performs the synchronization of particle system data copies. + */ + virtual void fetchResultsParticleSystem() = 0; + + /** + \brief Clear internal buffers and free memory. + + This method can be used to clear buffers and free internal memory without having to destroy the scene. Can be useful if + the physics data gets streamed in and a checkpoint with a clean state should be created. + + \note It is not allowed to call this method while the simulation is running. The call will fail. + + \param[in] sendPendingReports When set to true pending reports will be sent out before the buffers get cleaned up (for instance lost touch contact/trigger reports due to deleted objects). + */ + virtual void flushSimulation(bool sendPendingReports = false) = 0; + + /** + \brief Sets a constant gravity for the entire scene. + + \note Do not use this method while the simulation is running. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] vec A new gravity vector(e.g. PxVec3(0.0f,-9.8f,0.0f) ) Range: force vector + + @see PxSceneDesc.gravity getGravity() + */ + virtual void setGravity(const PxVec3& vec) = 0; + + /** + \brief Retrieves the current gravity setting. + + \return The current gravity for the scene. + + @see setGravity() PxSceneDesc.gravity + */ + virtual PxVec3 getGravity() const = 0; + + /** + \brief Set the bounce threshold velocity. Collision speeds below this threshold will not cause a bounce. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::bounceThresholdVelocity, getBounceThresholdVelocity + */ + virtual void setBounceThresholdVelocity(const PxReal t) = 0; + + /** + \brief Return the bounce threshold velocity. + + @see PxSceneDesc.bounceThresholdVelocity, setBounceThresholdVelocity + */ + virtual PxReal getBounceThresholdVelocity() const = 0; + + /** + \brief Sets the maximum number of CCD passes + + \note Do not use this method while the simulation is running. + + \param[in] ccdMaxPasses Maximum number of CCD passes + + @see PxSceneDesc.ccdMaxPasses getCCDMaxPasses() + */ + virtual void setCCDMaxPasses(PxU32 ccdMaxPasses) = 0; + + /** + \brief Gets the maximum number of CCD passes. + + \return The maximum number of CCD passes. + + @see PxSceneDesc::ccdMaxPasses setCCDMaxPasses() + */ + virtual PxU32 getCCDMaxPasses() const = 0; + + /** + \brief Set the maximum CCD separation. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::ccdMaxSeparation, getCCDMaxSeparation + */ + virtual void setCCDMaxSeparation(const PxReal t) = 0; + + /** + \brief Gets the maximum CCD separation. + + \return The maximum CCD separation. + + @see PxSceneDesc::ccdMaxSeparation setCCDMaxSeparation() + */ + virtual PxReal getCCDMaxSeparation() const = 0; + + /** + \brief Set the CCD threshold. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::ccdThreshold, getCCDThreshold + */ + virtual void setCCDThreshold(const PxReal t) = 0; + + /** + \brief Gets the CCD threshold. + + \return The CCD threshold. + + @see PxSceneDesc::ccdThreshold setCCDThreshold() + */ + virtual PxReal getCCDThreshold() const = 0; + + /** + \brief Set the max bias coefficient. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::maxBiasCoefficient, getMaxBiasCoefficient + */ + virtual void setMaxBiasCoefficient(const PxReal t) = 0; + + /** + \brief Gets the max bias coefficient. + + \return The max bias coefficient. + + @see PxSceneDesc::maxBiasCoefficient setMaxBiasCoefficient() + */ + virtual PxReal getMaxBiasCoefficient() const = 0; + + /** + \brief Set the friction offset threshold. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::frictionOffsetThreshold, getFrictionOffsetThreshold + */ + virtual void setFrictionOffsetThreshold(const PxReal t) = 0; + + /** + \brief Gets the friction offset threshold. + + @see PxSceneDesc::frictionOffsetThreshold, setFrictionOffsetThreshold + */ + virtual PxReal getFrictionOffsetThreshold() const = 0; + + /** + \brief Set the friction correlation distance. + + \note Do not use this method while the simulation is running. + + @see PxSceneDesc::frictionCorrelationDistance, getFrictionCorrelationDistance + */ + virtual void setFrictionCorrelationDistance(const PxReal t) = 0; + + /** + \brief Gets the friction correlation distance. + + @see PxSceneDesc::frictionCorrelationDistance, setFrictionCorrelationDistance + */ + virtual PxReal getFrictionCorrelationDistance() const = 0; + + /** + \brief Return the friction model. + @see PxFrictionType, PxSceneDesc::frictionType + */ + virtual PxFrictionType::Enum getFrictionType() const = 0; + + /** + \brief Return the solver model. + @see PxSolverType, PxSceneDesc::solverType + */ + virtual PxSolverType::Enum getSolverType() const = 0; + + //@} + /************************************************************************************************/ + + /** @name Visualization and Statistics + */ + //@{ + /** + \brief Function that lets you set debug visualization parameters. + + Returns false if the value passed is out of range for usage specified by the enum. + + \note Do not use this method while the simulation is running. + + \param[in] param Parameter to set. See #PxVisualizationParameter + \param[in] value The value to set, see #PxVisualizationParameter for allowable values. Setting to zero disables visualization for the specified property, setting to a positive value usually enables visualization and defines the scale factor. + \return False if the parameter is out of range. + + @see getVisualizationParameter PxVisualizationParameter getRenderBuffer() + */ + virtual bool setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) = 0; + + /** + \brief Function that lets you query debug visualization parameters. + + \param[in] paramEnum The Parameter to retrieve. + \return The value of the parameter. + + @see setVisualizationParameter PxVisualizationParameter + */ + virtual PxReal getVisualizationParameter(PxVisualizationParameter::Enum paramEnum) const = 0; + + /** + \brief Defines a box in world space to which visualization geometry will be (conservatively) culled. Use a non-empty culling box to enable the feature, and an empty culling box to disable it. + + \note Do not use this method while the simulation is running. + + \param[in] box the box to which the geometry will be culled. Empty box to disable the feature. + @see setVisualizationParameter getVisualizationCullingBox getRenderBuffer() + */ + virtual void setVisualizationCullingBox(const PxBounds3& box) = 0; + + /** + \brief Retrieves the visualization culling box. + + \return the box to which the geometry will be culled. + @see setVisualizationParameter setVisualizationCullingBox + */ + virtual PxBounds3 getVisualizationCullingBox() const = 0; + + /** + \brief Retrieves the render buffer. + + This will contain the results of any active visualization for this scene. + + \note Do not use this method while the simulation is running. Calls to this method while the simulation is running will result in undefined behaviour. + + \return The render buffer. + + @see PxRenderBuffer + */ + virtual const PxRenderBuffer& getRenderBuffer() = 0; + + /** + \brief Call this method to retrieve statistics for the current simulation step. + + \note Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \param[out] stats Used to retrieve statistics for the current simulation step. + + @see PxSimulationStatistics + */ + virtual void getSimulationStatistics(PxSimulationStatistics& stats) const = 0; + + //@} + + /************************************************************************************************/ + /** @name Broad-phase + */ + //@{ + + /** + \brief Returns broad-phase type. + + \return Broad-phase type + */ + virtual PxBroadPhaseType::Enum getBroadPhaseType() const = 0; + + /** + \brief Gets broad-phase caps. + + \param[out] caps Broad-phase caps + \return True if success + */ + virtual bool getBroadPhaseCaps(PxBroadPhaseCaps& caps) const = 0; + + /** + \brief Returns number of regions currently registered in the broad-phase. + + \return Number of regions + */ + virtual PxU32 getNbBroadPhaseRegions() const = 0; + + /** + \brief Gets broad-phase regions. + + \param[out] userBuffer Returned broad-phase regions + \param[in] bufferSize Size of userBuffer + \param[in] startIndex Index of first desired region, in [0 ; getNbRegions()[ + \return Number of written out regions + */ + virtual PxU32 getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Adds a new broad-phase region. + + The bounds for the new region must be non-empty, otherwise an error occurs and the call is ignored. + + Note that by default, objects already existing in the SDK that might touch this region will not be automatically + added to the region. In other words the newly created region will be empty, and will only be populated with new + objects when they are added to the simulation, or with already existing objects when they are updated. + + It is nonetheless possible to override this default behavior and let the SDK populate the new region automatically + with already existing objects overlapping the incoming region. This has a cost though, and it should only be used + when the game can not guarantee that all objects within the new region will be added to the simulation after the + region itself. + + Objects automatically move from one region to another during their lifetime. The system keeps tracks of what + regions a given object is in. It is legal for an object to be in an arbitrary number of regions. However if an + object leaves all regions, or is created outside of all regions, several things happen: + - collisions get disabled for this object + - if a PxBroadPhaseCallback object is provided, an "out-of-bounds" event is generated via that callback + - if a PxBroadPhaseCallback object is not provided, a warning/error message is sent to the error stream + + If an object goes out-of-bounds and user deletes it during the same frame, neither the out-of-bounds event nor the + error message is generated. + + \param[in] region User-provided region data + \param[in] populateRegion Automatically populate new region with already existing objects overlapping it + \return Handle for newly created region, or 0xffffffff in case of failure. + \see PxBroadPhaseRegion PxBroadPhaseCallback + */ + virtual PxU32 addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion=false) = 0; + + /** + \brief Removes a new broad-phase region. + + If the region still contains objects, and if those objects do not overlap any region any more, they are not + automatically removed from the simulation. Instead, the PxBroadPhaseCallback::onObjectOutOfBounds notification + is used for each object. Users are responsible for removing the objects from the simulation if this is the + desired behavior. + + If the handle is invalid, or if a valid handle is removed twice, an error message is sent to the error stream. + + \param[in] handle Region's handle, as returned by PxScene::addBroadPhaseRegion. + \return True if success + */ + virtual bool removeBroadPhaseRegion(PxU32 handle) = 0; + + //@} + + /************************************************************************************************/ + + /** @name Threads and Memory + */ + //@{ + + /** + \brief Get the task manager associated with this scene + + \return the task manager associated with the scene + */ + virtual PxTaskManager* getTaskManager() const = 0; + + /** + \brief Lock the scene for reading from the calling thread. + + When the PxSceneFlag::eREQUIRE_RW_LOCK flag is enabled lockRead() must be + called before any read calls are made on the scene. + + Multiple threads may read at the same time, no threads may read while a thread is writing. + If a call to lockRead() is made while another thread is holding a write lock + then the calling thread will be blocked until the writing thread calls unlockWrite(). + + \note Lock upgrading is *not* supported, that means it is an error to + call lockRead() followed by lockWrite(). + + \note Recursive locking is supported but each lockRead() call must be paired with an unlockRead(). + + \param file String representing the calling file, for debug purposes + \param line The source file line number, for debug purposes + */ + virtual void lockRead(const char* file=NULL, PxU32 line=0) = 0; + + /** + \brief Unlock the scene from reading. + + \note Each unlockRead() must be paired with a lockRead() from the same thread. + */ + virtual void unlockRead() = 0; + + /** + \brief Lock the scene for writing from this thread. + + When the PxSceneFlag::eREQUIRE_RW_LOCK flag is enabled lockWrite() must be + called before any write calls are made on the scene. + + Only one thread may write at a time and no threads may read while a thread is writing. + If a call to lockWrite() is made and there are other threads reading then the + calling thread will be blocked until the readers complete. + + Writers have priority. If a thread is blocked waiting to write then subsequent calls to + lockRead() from other threads will be blocked until the writer completes. + + \note If multiple threads are waiting to write then the thread that is first + granted access depends on OS scheduling. + + \note Recursive locking is supported but each lockWrite() call must be paired + with an unlockWrite(). + + \note If a thread has already locked the scene for writing then it may call + lockRead(). + + \param file String representing the calling file, for debug purposes + \param line The source file line number, for debug purposes + */ + virtual void lockWrite(const char* file=NULL, PxU32 line=0) = 0; + + /** + \brief Unlock the scene from writing. + + \note Each unlockWrite() must be paired with a lockWrite() from the same thread. + */ + virtual void unlockWrite() = 0; + + /** + \brief set the cache blocks that can be used during simulate(). + + Each frame the simulation requires memory to store contact, friction, and contact cache data. This memory is used in blocks of 16K. + Each frame the blocks used by the previous frame are freed, and may be retrieved by the application using PxScene::flushSimulation() + + This call will force allocation of cache blocks if the numBlocks parameter is greater than the currently allocated number + of blocks, and less than the max16KContactDataBlocks parameter specified at scene creation time. + + \note Do not use this method while the simulation is running. + + \param[in] numBlocks The number of blocks to allocate. + + @see PxSceneDesc.nbContactDataBlocks PxSceneDesc.maxNbContactDataBlocks flushSimulation() getNbContactDataBlocksUsed getMaxNbContactDataBlocksUsed + */ + virtual void setNbContactDataBlocks(PxU32 numBlocks) = 0; + + /** + \brief get the number of cache blocks currently used by the scene + + This function may not be called while the scene is simulating + + \return the number of cache blocks currently used by the scene + + @see PxSceneDesc.nbContactDataBlocks PxSceneDesc.maxNbContactDataBlocks flushSimulation() setNbContactDataBlocks() getMaxNbContactDataBlocksUsed() + */ + virtual PxU32 getNbContactDataBlocksUsed() const = 0; + + /** + \brief get the maximum number of cache blocks used by the scene + + This function may not be called while the scene is simulating + + \return the maximum number of cache blocks everused by the scene + + @see PxSceneDesc.nbContactDataBlocks PxSceneDesc.maxNbContactDataBlocks flushSimulation() setNbContactDataBlocks() getNbContactDataBlocksUsed() + */ + virtual PxU32 getMaxNbContactDataBlocksUsed() const = 0; + + /** + \brief Return the value of PxSceneDesc::contactReportStreamBufferSize that was set when creating the scene with PxPhysics::createScene + + @see PxSceneDesc::contactReportStreamBufferSize, PxPhysics::createScene + */ + virtual PxU32 getContactReportStreamBufferSize() const = 0; + + /** + \brief Sets the number of actors required to spawn a separate rigid body solver thread. + + \note Do not use this method while the simulation is running. + + \param[in] solverBatchSize Number of actors required to spawn a separate rigid body solver thread. + + @see PxSceneDesc.solverBatchSize getSolverBatchSize() + */ + virtual void setSolverBatchSize(PxU32 solverBatchSize) = 0; + + /** + \brief Retrieves the number of actors required to spawn a separate rigid body solver thread. + + \return Current number of actors required to spawn a separate rigid body solver thread. + + @see PxSceneDesc.solverBatchSize setSolverBatchSize() + */ + virtual PxU32 getSolverBatchSize() const = 0; + + /** + \brief Sets the number of articulations required to spawn a separate rigid body solver thread. + + \note Do not use this method while the simulation is running. + + \param[in] solverBatchSize Number of articulations required to spawn a separate rigid body solver thread. + + @see PxSceneDesc.solverBatchSize getSolverArticulationBatchSize() + */ + virtual void setSolverArticulationBatchSize(PxU32 solverBatchSize) = 0; + + /** + \brief Retrieves the number of articulations required to spawn a separate rigid body solver thread. + + \return Current number of articulations required to spawn a separate rigid body solver thread. + + @see PxSceneDesc.solverBatchSize setSolverArticulationBatchSize() + */ + virtual PxU32 getSolverArticulationBatchSize() const = 0; + + //@} + + /** + \brief Returns the wake counter reset value. + + \return Wake counter reset value + + @see PxSceneDesc.wakeCounterResetValue + */ + virtual PxReal getWakeCounterResetValue() const = 0; + + /** + \brief Shift the scene origin by the specified vector. + + The poses of all objects in the scene and the corresponding data structures will get adjusted to reflect the new origin location + (the shift vector will get subtracted from all object positions). + + \note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysX accordingly. + + \note Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + + \note Make sure to propagate the origin shift to other dependent modules (for example, the character controller module etc.). + + \note This is an expensive operation and we recommend to use it only in the case where distance related precision issues may arise in areas far from the origin. + + \param[in] shift Translation vector to shift the origin by. + */ + virtual void shiftOrigin(const PxVec3& shift) = 0; + + /** + \brief Returns the Pvd client associated with the scene. + \return the client, NULL if no PVD supported. + */ + virtual PxPvdSceneClient* getScenePvdClient() = 0; + + /** + \brief Copy GPU articulation data from the internal GPU buffer to a user-provided device buffer. + \param[in] data User-provided gpu data buffer which should be sized appropriately for the particular data that is requested. Further details provided in the user guide. + \param[in] index User-provided gpu index buffer. This buffer stores the articulation indices which the user wants to copy. + \param[in] dataType Enum specifying the type of data the user wants to read back from the articulations. + \param[in] nbCopyArticulations Number of articulations that data should be copied from. + \param[in] copyEvent User-provided event for the articulation stream to signal when the data copy to the user buffer has completed. + */ + virtual void copyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbCopyArticulations, void* copyEvent = NULL) = 0; + + /** + \brief Apply GPU articulation data from a user-provided device buffer to the internal GPU buffer. + \param[in] data User-provided gpu data buffer which should be sized appropriately for the particular data that is requested. Further details provided in the user guide. + \param[in] index User-provided gpu index buffer. This buffer stores the articulation indices which the user wants to write to. + \param[in] dataType Enum specifying the type of data the user wants to write to the articulations. + \param[in] nbUpdatedArticulations Number of articulations that data should be written to. + \param[in] waitEvent User-provided event for the articulation stream to wait for data. + \param[in] signalEvent User-provided event for the articulation stream to signal when the data read from the user buffer has completed. + */ + virtual void applyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbUpdatedArticulations, void* waitEvent = NULL, void* signalEvent = NULL) = 0; + + /** + \brief Copy GPU softbody data from the internal GPU buffer to a user-provided device buffer. + \param[in] data User-provided gpu buffer containing a pointer to another gpu buffer for every softbody to process + \param[in] dataSizes The size of every buffer in bytes + \param[in] softBodyIndices User provided gpu index buffer. This buffer stores the softbody index which the user want to copy. + \param[in] maxSize The largest size stored in dataSizes. Used internally to decide how many threads to launch for the copy process. + \param[in] flag Flag defining which data the user wants to read back from the softbody system + \param[in] nbCopySoftBodies The number of softbodies to be copied. + \param[in] copyEvent User-provided event for the user to sync data + */ + virtual void copySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbCopySoftBodies, const PxU32 maxSize, void* copyEvent = NULL) = 0; + + + /** + \brief Apply user-provided data to the internal softbody system. + \param[in] data User-provided gpu buffer containing a pointer to another gpu buffer for every softbody to process + \param[in] dataSizes The size of every buffer in bytes + \param[in] softBodyIndices User provided gpu index buffer. This buffer stores the updated softbody index. + \param[in] flag Flag defining which data the user wants to write to the softbody system + \param[in] maxSize The largest size stored in dataSizes. Used internally to decide how many threads to launch for the copy process. + \param[in] nbUpdatedSoftBodies The number of updated softbodies + \param[in] applyEvent User-provided event for the softbody stream to wait for data + */ + virtual void applySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbUpdatedSoftBodies, const PxU32 maxSize, void* applyEvent = NULL) = 0; + + /** + \brief Copy contact data from the internal GPU buffer to a user-provided device buffer. + + \note The contact data contains pointers to internal state and is only valid until the next call to simulate(). + + \param[in] data User-provided gpu data buffer, which should be the size of PxGpuContactPair * numContactPairs + \param[in] maxContactPairs The maximum number of pairs that the buffer can contain + \param[in] numContactPairs The actual number of contact pairs that were written + \param[in] copyEvent User-provided event for the user to sync data + */ + virtual void copyContactData(void* data, const PxU32 maxContactPairs, void* numContactPairs, void* copyEvent = NULL) = 0; + + /** + \brief Copy GPU rigid body data from the internal GPU buffer to a user-provided device buffer. + \param[in] data User-provided gpu data buffer which should nbCopyActors * sizeof(PxGpuBodyData). The only data it can copy is PxGpuBodyData. + \param[in] index User provided node PxGpuActorPair buffer. This buffer stores pairs of indices: the PxNodeIndex corresponding to the rigid body and an index corresponding to the location in the user buffer that this value should be placed. + \param[in] nbCopyActors The number of rigid body to be copied. + \param[in] copyEvent User-provided event for the user to sync data. + */ + virtual void copyBodyData(PxGpuBodyData* data, PxGpuActorPair* index, const PxU32 nbCopyActors, void* copyEvent = NULL) = 0; + + /** + \brief Apply user-provided data to rigid body. + \param[in] data User-provided gpu data buffer which should be sized appropriately for the particular data that is requested. Further details provided in the user guide. + \param[in] index User provided PxGpuActorPair buffer. This buffer stores pairs of indices: the PxNodeIndex corresponding to the rigid body and an index corresponding to the location in the user buffer that this value should be placed. + \param[in] flag Flag defining which data the user wants to write to the rigid body + \param[in] nbUpdatedActors The number of updated rigid body + \param[in] waitEvent User-provided event for the rigid body stream to wait for data + \param[in] signalEvent User-provided event for the rigid body stream to signal when the read from the user buffer has completed + */ + virtual void applyActorData(void* data, PxGpuActorPair* index, PxActorCacheFlag::Enum flag, const PxU32 nbUpdatedActors, void* waitEvent = NULL, void* signalEvent = NULL) = 0; + + /** + \brief Compute dense Jacobian matrices for specified articulations on the GPU. + + The size of Jacobians can vary by articulation, since it depends on the number of links, degrees-of-freedom, and whether the base is fixed. + + The size is determined using these formulas: + nCols = (fixedBase ? 0 : 6) + dofCount + nRows = (fixedBase ? 0 : 6) + (linkCount - 1) * 6; + + The user must ensure that adequate space is provided for each Jacobian matrix. + + \param[in] indices User-provided gpu buffer of (index, data) pairs. The entries map a GPU articulation index to a GPU block of memory where the returned Jacobian will be stored. + \param[in] nbIndices The number of (index, data) pairs provided. + \param[in] computeEvent User-provided event for the user to sync data. + */ + virtual void computeDenseJacobians(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + + /** + \brief Compute the joint-space inertia matrices that maps joint accelerations to joint forces: forces = M * accelerations on the GPU. + + The size of matrices can vary by articulation, since it depends on the number of links and degrees-of-freedom. + + The size is determined using this formula: + sizeof(float) * dofCount * dofCount + + The user must ensure that adequate space is provided for each mass matrix. + + \param[in] indices User-provided gpu buffer of (index, data) pairs. The entries map a GPU articulation index to a GPU block of memory where the returned matrix will be stored. + \param[in] nbIndices The number of (index, data) pairs provided. + \param[in] computeEvent User-provided event for the user to sync data. + */ + virtual void computeGeneralizedMassMatrices(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + + /** + \brief Computes the joint DOF forces required to counteract gravitational forces for the given articulation pose. + + The size of the result can vary by articulation, since it depends on the number of links and degrees-of-freedom. + + The size is determined using this formula: + sizeof(float) * dofCount + + The user must ensure that adequate space is provided for each articulation. + + \param[in] indices User-provided gpu buffer of (index, data) pairs. The entries map a GPU articulation index to a GPU block of memory where the returned matrix will be stored. + \param[in] nbIndices The number of (index, data) pairs provided. + \param[in] computeEvent User-provided event for the user to sync data. + */ + virtual void computeGeneralizedGravityForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + + /** + \brief Computes the joint DOF forces required to counteract coriolis and centrifugal forces for the given articulation pose. + + The size of the result can vary by articulation, since it depends on the number of links and degrees-of-freedom. + + The size is determined using this formula: + sizeof(float) * dofCount + + The user must ensure that adequate space is provided for each articulation. + + \param[in] indices User-provided gpu buffer of (index, data) pairs. The entries map a GPU articulation index to a GPU block of memory where the returned matrix will be stored. + \param[in] nbIndices The number of (index, data) pairs provided. + \param[in] computeEvent User-provided event for the user to sync data. + */ + virtual void computeCoriolisAndCentrifugalForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + + virtual PxgDynamicsMemoryConfig getGpuDynamicsConfig() const = 0; + + /** + \brief Apply user-provided data to particle buffers. + + This function should be used if the particle buffer flags are already on the device. Otherwise, use PxParticleBuffer::raiseFlags() + from the CPU. + + This assumes the data has been changed directly in the PxParticleBuffer. + + \param[in] indices User-provided index buffer that indexes into the BufferIndexPair and flags list. + \param[in] bufferIndexPair User-provided index pair buffer specifying the unique id and GPU particle system for each PxParticleBuffer. See PxGpuParticleBufferIndexPair. + \param[in] flags Flags to mark what data needs to be updated. See PxParticleBufferFlags. + \param[in] nbUpdatedBuffers The number of particle buffers to update. + \param[in] waitEvent User-provided event for the particle stream to wait for data. + \param[in] signalEvent User-provided event for the particle stream to signal when the data read from the user buffer has completed. + */ + virtual void applyParticleBufferData(const PxU32* indices, const PxGpuParticleBufferIndexPair* bufferIndexPair, const PxParticleBufferFlags* flags, PxU32 nbUpdatedBuffers, void* waitEvent = NULL, void* signalEvent = NULL) = 0; + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneDesc.h new file mode 100644 index 0000000..2822c88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneDesc.h @@ -0,0 +1,1042 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_DESC_H +#define PX_SCENE_DESC_H +/** \addtogroup physics +@{ +*/ + +#include "PxSceneQueryDesc.h" +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxBitUtils.h" +#include "PxFiltering.h" +#include "PxBroadPhase.h" +#include "common/PxTolerancesScale.h" +#include "task/PxTask.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxBroadPhaseCallback; + class PxCudaContextManager; + +/** +\brief Enum for selecting the friction algorithm used for simulation. + +#PxFrictionType::ePATCH selects the patch friction model which typically leads to the most stable results at low solver iteration counts and is also quite inexpensive, as it uses only +up to four scalar solver constraints per pair of touching objects. The patch friction model is the same basic strong friction algorithm as PhysX 3.2 and before. + +#PxFrictionType::eONE_DIRECTIONAL is a simplification of the Coulomb friction model, in which the friction for a given point of contact is applied in the alternating tangent directions of +the contact's normal. This simplification allows us to reduce the number of iterations required for convergence but is not as accurate as the two directional model. + +#PxFrictionType::eTWO_DIRECTIONAL is identical to the one directional model, but it applies friction in both tangent directions simultaneously. This hurts convergence a bit so it +requires more solver iterations, but is more accurate. Like the one directional model, it is applied at every contact point, which makes it potentially more expensive +than patch friction for scenarios with many contact points. + +#PxFrictionType::eFRICTION_COUNT is the total numer of friction models supported by the SDK. +*/ +struct PxFrictionType +{ + enum Enum + { + ePATCH, //!< Select default patch-friction model. + eONE_DIRECTIONAL, //!< Select one directional per-contact friction model. + eTWO_DIRECTIONAL, //!< Select two directional per-contact friction model. + eFRICTION_COUNT //!< The total number of friction models supported by the SDK. + }; +}; + +/** +\brief Enum for selecting the type of solver used for the simulation. + +#PxSolverType::ePGS selects the iterative sequential impulse solver. This is the same kind of solver used in PhysX 3.4 and earlier releases. + +#PxSolverType::eTGS selects a non linear iterative solver. This kind of solver can lead to improved convergence and handle large mass ratios, long chains and jointed systems better. It is slightly more expensive than the default solver and can introduce more energy to correct joint and contact errors. +*/ +struct PxSolverType +{ + enum Enum + { + ePGS, //!< Projected Gauss-Seidel iterative solver + eTGS //!< Default Temporal Gauss-Seidel solver + }; +}; + +/** +\brief flags for configuring properties of the scene + +@see PxScene +*/ +struct PxSceneFlag +{ + enum Enum + { + /** + \brief Enable Active Actors Notification. + + This flag enables the Active Actor Notification feature for a scene. This + feature defaults to disabled. When disabled, the function + PxScene::getActiveActors() will always return a NULL list. + + \note There may be a performance penalty for enabling the Active Actor Notification, hence this flag should + only be enabled if the application intends to use the feature. + + Default: False + */ + eENABLE_ACTIVE_ACTORS = (1<<0), + + /** + \brief Enables a second broad phase check after integration that makes it possible to prevent objects from tunneling through eachother. + + PxPairFlag::eDETECT_CCD_CONTACT requires this flag to be specified. + + \note For this feature to be effective for bodies that can move at a significant velocity, the user should raise the flag PxRigidBodyFlag::eENABLE_CCD for them. + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + Default: False + + @see PxRigidBodyFlag::eENABLE_CCD, PxPairFlag::eDETECT_CCD_CONTACT, eDISABLE_CCD_RESWEEP + */ + eENABLE_CCD = (1<<1), + + /** + \brief Enables a simplified swept integration strategy, which sacrifices some accuracy for improved performance. + + This simplified swept integration approach makes certain assumptions about the motion of objects that are not made when using a full swept integration. + These assumptions usually hold but there are cases where they could result in incorrect behavior between a set of fast-moving rigid bodies. A key issue is that + fast-moving dynamic objects may tunnel through each-other after a rebound. This will not happen if this mode is disabled. However, this approach will be potentially + faster than a full swept integration because it will perform significantly fewer sweeps in non-trivial scenes involving many fast-moving objects. This approach + should successfully resist objects passing through the static environment. + + PxPairFlag::eDETECT_CCD_CONTACT requires this flag to be specified. + + \note This scene flag requires eENABLE_CCD to be enabled as well. If it is not, this scene flag will do nothing. + \note For this feature to be effective for bodies that can move at a significant velocity, the user should raise the flag PxRigidBodyFlag::eENABLE_CCD for them. + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + Default: False + + @see PxRigidBodyFlag::eENABLE_CCD, PxPairFlag::eDETECT_CCD_CONTACT, eENABLE_CCD + */ + eDISABLE_CCD_RESWEEP = (1<<2), + + /** + \brief Enable GJK-based distance collision detection system. + + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + Default: true + */ + eENABLE_PCM = (1 << 6), + + /** + \brief Disable contact report buffer resize. Once the contact buffer is full, the rest of the contact reports will + not be buffered and sent. + + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + Default: false + */ + eDISABLE_CONTACT_REPORT_BUFFER_RESIZE = (1 << 7), + + /** + \brief Disable contact cache. + + Contact caches are used internally to provide faster contact generation. You can disable all contact caches + if memory usage for this feature becomes too high. + + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + Default: false + */ + eDISABLE_CONTACT_CACHE = (1 << 8), + + /** + \brief Require scene-level locking + + When set to true this requires that threads accessing the PxScene use the + multi-threaded lock methods. + + \note This flag is not mutable, and must be set in PxSceneDesc at scene creation. + + @see PxScene::lockRead + @see PxScene::unlockRead + @see PxScene::lockWrite + @see PxScene::unlockWrite + + Default: false + */ + eREQUIRE_RW_LOCK = (1 << 9), + + /** + \brief Enables additional stabilization pass in solver + + When set to true, this enables additional stabilization processing to improve that stability of complex interactions between large numbers of bodies. + + Note that this flag is not mutable and must be set in PxSceneDesc at scene creation. Also, this is an experimental feature which does result in some loss of momentum. + */ + eENABLE_STABILIZATION = (1 << 10), + + /** + \brief Enables average points in contact manifolds + + When set to true, this enables additional contacts to be generated per manifold to represent the average point in a manifold. This can stabilize stacking when only a small + number of solver iterations is used. + + Note that this flag is not mutable and must be set in PxSceneDesc at scene creation. + */ + eENABLE_AVERAGE_POINT = (1 << 11), + + /** + \brief Do not report kinematics in list of active actors. + + Since the target pose for kinematics is set by the user, an application can track the activity state directly and use + this flag to avoid that kinematics get added to the list of active actors. + + \note This flag has only an effect in combination with eENABLE_ACTIVE_ACTORS. + + @see eENABLE_ACTIVE_ACTORS + + Default: false + */ + eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS = (1 << 12), + + /*\brief Enables the GPU dynamics pipeline + + When set to true, a CUDA ARCH 3.0 or above-enabled NVIDIA GPU is present and the CUDA context manager has been configured, this will run the GPU dynamics pipelin instead of the CPU dynamics pipeline. + + Note that this flag is not mutable and must be set in PxSceneDesc at scene creation. + */ + eENABLE_GPU_DYNAMICS = (1 << 13), + + /** + \brief Provides improved determinism at the expense of performance. + + By default, PhysX provides limited determinism guarantees. Specifically, PhysX guarantees that the exact scene (same actors created in the same order) and simulated using the same + time-stepping scheme should provide the exact same behaviour. + + However, if additional actors are added to the simulation, this can affect the behaviour of the existing actors in the simulation, even if the set of new actors do not interact with + the existing actors. + + This flag provides an additional level of determinism that guarantees that the simulation will not change if additional actors are added to the simulation, provided those actors do not interfere + with the existing actors in the scene. Determinism is only guaranteed if the actors are inserted in a consistent order each run in a newly-created scene and simulated using a consistent time-stepping + scheme. + + Note that this flag is not mutable and must be set at scene creation. + + Note that enabling this flag can have a negative impact on performance. + + Note that this feature is not currently supported on GPU. + + Default false + */ + eENABLE_ENHANCED_DETERMINISM = (1<<14), + + /** + \brief Controls processing friction in all solver iterations + + By default, PhysX processes friction only in the final 3 position iterations, and all velocity + iterations. This flag enables friction processing in all position and velocity iterations. + + The default behaviour provides a good trade-off between performance and stability and is aimed + primarily at game development. + + When simulating more complex frictional behaviour, such as grasping of complex geometries with + a robotic manipulator, better results can be achieved by enabling friction in all solver iterations. + + \note This flag only has effect with the default solver. The TGS solver always performs friction per-iteration. + */ + eENABLE_FRICTION_EVERY_ITERATION = (1 << 15), + + /* + \brief Disables GPU readback of articulation data when running on GPU. + Useful if your application only needs to communicate to the GPU via GPU buffers. Can be significantly faster + */ + eSUPPRESS_READBACK = (1<<16), + + /* + \brief Forces GPU readback of articulation data when user raise eSUPPRESS_READBACK. + */ + eFORCE_READBACK = (1 << 17), + + eMUTABLE_FLAGS = eENABLE_ACTIVE_ACTORS|eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS|eSUPPRESS_READBACK + }; +}; + +/** +\brief collection of set bits defined in PxSceneFlag. + +@see PxSceneFlag +*/ +typedef PxFlags PxSceneFlags; +PX_FLAGS_OPERATORS(PxSceneFlag::Enum,PxU32) + +class PxSimulationEventCallback; +class PxContactModifyCallback; +class PxCCDContactModifyCallback; +class PxSimulationFilterCallback; + +/** +\brief Class used to retrieve limits(e.g. maximum number of bodies) for a scene. The limits +are used as a hint to the size of the scene, not as a hard limit (i.e. it will be possible +to create more objects than specified in the scene limits). + +0 indicates no limit. Using limits allows the SDK to preallocate various arrays, leading to +less re-allocations and faster code at runtime. +*/ +class PxSceneLimits +{ +public: + PxU32 maxNbActors; //!< Expected maximum number of actors + PxU32 maxNbBodies; //!< Expected maximum number of dynamic rigid bodies + PxU32 maxNbStaticShapes; //!< Expected maximum number of static shapes + PxU32 maxNbDynamicShapes; //!< Expected maximum number of dynamic shapes + PxU32 maxNbAggregates; //!< Expected maximum number of aggregates + PxU32 maxNbConstraints; //!< Expected maximum number of constraint shaders + PxU32 maxNbRegions; //!< Expected maximum number of broad-phase regions + PxU32 maxNbBroadPhaseOverlaps; //!< Expected maximum number of broad-phase overlaps + + /** + \brief constructor sets to default + */ + PX_INLINE PxSceneLimits(); + + /** + \brief (re)sets the structure to the default + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE PxSceneLimits::PxSceneLimits() : //constructor sets to default + maxNbActors (0), + maxNbBodies (0), + maxNbStaticShapes (0), + maxNbDynamicShapes (0), + maxNbAggregates (0), + maxNbConstraints (0), + maxNbRegions (0), + maxNbBroadPhaseOverlaps (0) +{ +} + +PX_INLINE void PxSceneLimits::setToDefault() +{ + *this = PxSceneLimits(); +} + +PX_INLINE bool PxSceneLimits::isValid() const +{ + if(maxNbRegions>256) // max number of regions is currently limited + return false; + + return true; +} + +//#if PX_SUPPORT_GPU_PHYSX +/** +\brief Sizes of pre-allocated buffers use for GPU dynamics +*/ + +struct PxgDynamicsMemoryConfig +{ + PxU32 tempBufferCapacity; //!< Capacity of temp buffer allocated in pinned host memory. + PxU32 maxRigidContactCount; //!< Size of contact stream buffer allocated in pinned host memory. This is double-buffered so total allocation size = 2* contactStreamCapacity * sizeof(PxContact). + PxU32 maxRigidPatchCount; //!< Size of the contact patch stream buffer allocated in pinned host memory. This is double-buffered so total allocation size = 2 * patchStreamCapacity * sizeof(PxContactPatch). + PxU32 heapCapacity; //!< Initial capacity of the GPU and pinned host memory heaps. Additional memory will be allocated if more memory is required. + PxU32 foundLostPairsCapacity; //!< Capacity of found and lost buffers allocated in GPU global memory. This is used for the found/lost pair reports in the BP. + PxU32 foundLostAggregatePairsCapacity; //!Range: force vector
+ Default: Zero + + @see PxScene.setGravity() PxScene.getGravity() + + When setting gravity, you should probably also set bounce threshold. + */ + PxVec3 gravity; + + /** + \brief Possible notification callback. + + Default: NULL + + @see PxSimulationEventCallback PxScene.setSimulationEventCallback() PxScene.getSimulationEventCallback() + */ + PxSimulationEventCallback* simulationEventCallback; + + /** + \brief Possible asynchronous callback for contact modification. + + Default: NULL + + @see PxContactModifyCallback PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() + */ + PxContactModifyCallback* contactModifyCallback; + + /** + \brief Possible asynchronous callback for contact modification. + + Default: NULL + + @see PxContactModifyCallback PxScene.setContactModifyCallback() PxScene.getContactModifyCallback() + */ + PxCCDContactModifyCallback* ccdContactModifyCallback; + + /** + \brief Shared global filter data which will get passed into the filter shader. + + \note The provided data will get copied to internal buffers and this copy will be used for filtering calls. + + Default: NULL + + @see PxSimulationFilterShader PxScene.setFilterShaderData() PxScene.getFilterShaderData() + */ + const void* filterShaderData; + + /** + \brief Size (in bytes) of the shared global filter data #filterShaderData. + + Default: 0 + + @see PxSimulationFilterShader filterShaderData PxScene.getFilterShaderDataSize() + */ + PxU32 filterShaderDataSize; + + /** + \brief The custom filter shader to use for collision filtering. + + \note This parameter is compulsory. If you don't want to define your own filter shader you can + use the default shader #PxDefaultSimulationFilterShader which can be found in the PhysX extensions + library. + + @see PxSimulationFilterShader PxScene.getFilterShader() + */ + PxSimulationFilterShader filterShader; + + /** + \brief A custom collision filter callback which can be used to implement more complex filtering operations which need + access to the simulation state, for example. + + Default: NULL + + @see PxSimulationFilterCallback PxScene.getFilterCallback() + */ + PxSimulationFilterCallback* filterCallback; + + /** + \brief Filtering mode for kinematic-kinematic pairs in the broadphase. + + Default: PxPairFilteringMode::eDEFAULT + + @see PxPairFilteringMode PxScene.getKinematicKinematicFilteringMode() + */ + PxPairFilteringMode::Enum kineKineFilteringMode; + + /** + \brief Filtering mode for static-kinematic pairs in the broadphase. + + Default: PxPairFilteringMode::eDEFAULT + + @see PxPairFilteringMode PxScene.getStaticKinematicFilteringMode() + */ + PxPairFilteringMode::Enum staticKineFilteringMode; + + /** + \brief Selects the broad-phase algorithm to use. + + Default: PxBroadPhaseType::ePABP + + @see PxBroadPhaseType PxScene.getBroadPhaseType() + */ + PxBroadPhaseType::Enum broadPhaseType; + + /** + \brief Broad-phase callback + + Default: NULL + + @see PxBroadPhaseCallback PxScene.getBroadPhaseCallback() PxScene.setBroadPhaseCallback() + */ + PxBroadPhaseCallback* broadPhaseCallback; + + /** + \brief Expected scene limits. + + @see PxSceneLimits PxScene.getLimits() + */ + PxSceneLimits limits; + + /** + \brief Selects the friction algorithm to use for simulation. + + \note frictionType cannot be modified after the first call to any of PxScene::simulate, PxScene::solve and PxScene::collide + + Default: PxFrictionType::ePATCH + + @see PxFrictionType PxScene.setFrictionType(), PxScene.getFrictionType() + */ + PxFrictionType::Enum frictionType; + + /** + \brief Selects the solver algorithm to use. + + Default: PxSolverType::ePGS + + @see PxSolverType PxScene.getSolverType() + */ + PxSolverType::Enum solverType; + + /** + \brief A contact with a relative velocity below this will not bounce. A typical value for simulation. + stability is about 0.2 * gravity. + + Range: (0, PX_MAX_F32)
+ Default: 0.2 * PxTolerancesScale::speed + + @see PxMaterial PxScene.setBounceThresholdVelocity() PxScene.getBounceThresholdVelocity() + */ + PxReal bounceThresholdVelocity; + + /** + \brief A threshold of contact separation distance used to decide if a contact point will experience friction forces. + + \note If the separation distance of a contact point is greater than the threshold then the contact point will not experience friction forces. + + \note If the aggregated contact offset of a pair of shapes is large it might be desirable to neglect friction + for contact points whose separation distance is sufficiently large that the shape surfaces are clearly separated. + + \note This parameter can be used to tune the separation distance of contact points at which friction starts to have an effect. + + Range: [0, PX_MAX_F32)
+ Default: 0.04 * PxTolerancesScale::length + + @see PxScene.setFrictionOffsetThreshold() PxScene.getFrictionOffsetThreshold() + */ + PxReal frictionOffsetThreshold; + + /** + \brief Friction correlation distance used to decide whether contacts are close enough to be merged into a single friction anchor point or not. + + \note If the correlation distance is larger than the distance between contact points generated between a pair of shapes, some of the contacts may not experience frictional forces. + + \note This parameter can be used to tune the correlation distance used in the solver. Contact points can be merged into a single friction anchor if the distance between the contacts is smaller than correlation distance. + + Range: [0, PX_MAX_F32)
+ Default: 0.025f * PxTolerancesScale::length + + @see PxScene.setFrictionCorrelationDistance() PxScene.getFrictionCorrelationDistance() + */ + PxReal frictionCorrelationDistance; + + /** + \brief Flags used to select scene options. + + Default: PxSceneFlag::eENABLE_PCM + + @see PxSceneFlag PxSceneFlags PxScene.getFlags() PxScene.setFlag() + */ + PxSceneFlags flags; + + /** + \brief The CPU task dispatcher for the scene. + + @see PxCpuDispatcher, PxScene::getCpuDispatcher + */ + PxCpuDispatcher* cpuDispatcher; + + /** + \brief The CUDA context manager for the scene. + + Platform specific: Applies to PC GPU only. + + @see PxCudaContextManager, PxScene::getCudaContextManager + */ + PX_DEPRECATED PxCudaContextManager* cudaContextManager; + + /** + \brief Will be copied to PxScene::userData. + + Default: NULL + */ + void* userData; + + /** + \brief Defines the number of actors required to spawn a separate rigid body solver island task chain. + + This parameter defines the minimum number of actors required to spawn a separate rigid body solver task chain. Setting a low value + will potentially cause more task chains to be generated. This may result in the overhead of spawning tasks can become a limiting performance factor. + Setting a high value will potentially cause fewer islands to be generated. This may reduce thread scaling (fewer task chains spawned) and may + detrimentally affect performance if some bodies in the scene have large solver iteration counts because all constraints in a given island are solved by the + maximum number of solver iterations requested by any body in the island. + + Note that a rigid body solver task chain is spawned as soon as either a sufficient number of rigid bodies or articulations are batched together. + + Default: 128 + + @see PxScene.setSolverBatchSize() PxScene.getSolverBatchSize() + */ + PxU32 solverBatchSize; + + /** + \brief Defines the number of articulations required to spawn a separate rigid body solver island task chain. + + This parameter defines the minimum number of articulations required to spawn a separate rigid body solver task chain. Setting a low value + will potentially cause more task chains to be generated. This may result in the overhead of spawning tasks can become a limiting performance factor. + Setting a high value will potentially cause fewer islands to be generated. This may reduce thread scaling (fewer task chains spawned) and may + detrimentally affect performance if some bodies in the scene have large solver iteration counts because all constraints in a given island are solved by the + maximum number of solver iterations requested by any body in the island. + + Note that a rigid body solver task chain is spawned as soon as either a sufficient number of rigid bodies or articulations are batched together. + + Default: 16 + + @see PxScene.setSolverArticulationBatchSize() PxScene.getSolverArticulationBatchSize() + */ + PxU32 solverArticulationBatchSize; + + /** + \brief Setting to define the number of 16K blocks that will be initially reserved to store contact, friction, and contact cache data. + This is the number of 16K memory blocks that will be automatically allocated from the user allocator when the scene is instantiated. Further 16k + memory blocks may be allocated during the simulation up to maxNbContactDataBlocks. + + \note This value cannot be larger than maxNbContactDataBlocks because that defines the maximum number of 16k blocks that can be allocated by the SDK. + + Default: 0 + + Range: [0, PX_MAX_U32]
+ + @see PxPhysics::createScene PxScene::setNbContactDataBlocks + */ + PxU32 nbContactDataBlocks; + + /** + \brief Setting to define the maximum number of 16K blocks that can be allocated to store contact, friction, and contact cache data. + As the complexity of a scene increases, the SDK may require to allocate new 16k blocks in addition to the blocks it has already + allocated. This variable controls the maximum number of blocks that the SDK can allocate. + + In the case that the scene is sufficiently complex that all the permitted 16K blocks are used, contacts will be dropped and + a warning passed to the error stream. + + If a warning is reported to the error stream to indicate the number of 16K blocks is insufficient for the scene complexity + then the choices are either (i) re-tune the number of 16K data blocks until a number is found that is sufficient for the scene complexity, + (ii) to simplify the scene or (iii) to opt to not increase the memory requirements of physx and accept some dropped contacts. + + Default: 65536 + + Range: [0, PX_MAX_U32]
+ + @see nbContactDataBlocks PxScene.setNbContactDataBlocks() + */ + PxU32 maxNbContactDataBlocks; + + /** + \brief The maximum bias coefficient used in the constraint solver + + When geometric errors are found in the constraint solver, either as a result of shapes penetrating + or joints becoming separated or violating limits, a bias is introduced in the solver position iterations + to correct these errors. This bias is proportional to 1/dt, meaning that the bias becomes increasingly + strong as the time-step passed to PxScene::simulate(...) becomes smaller. This coefficient allows the + application to restrict how large the bias coefficient is, to reduce how violent error corrections are. + This can improve simulation quality in cases where either variable time-steps or extremely small time-steps + are used. + + Default: PX_MAX_F32 + + Range [0, PX_MAX_F32]
+ + @see PxScene.setMaxBiasCoefficient() PxScene.getMaxBiasCoefficient() + */ + PxReal maxBiasCoefficient; + + /** + \brief Size of the contact report stream (in bytes). + + The contact report stream buffer is used during the simulation to store all the contact reports. + If the size is not sufficient, the buffer will grow by a factor of two. + It is possible to disable the buffer growth by setting the flag PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE. + In that case the buffer will not grow but contact reports not stored in the buffer will not get sent in the contact report callbacks. + + Default: 8192 + + Range: (0, PX_MAX_U32]
+ + @see PxScene.getContactReportStreamBufferSize() + */ + PxU32 contactReportStreamBufferSize; + + /** + \brief Maximum number of CCD passes + + The CCD performs multiple passes, where each pass every object advances to its time of first impact. This value defines how many passes the CCD system should perform. + + \note The CCD system is a multi-pass best-effort conservative advancement approach. After the defined number of passes has been completed, any remaining time is dropped. + \note This defines the maximum number of passes the CCD can perform. It may perform fewer if additional passes are not necessary. + + Default: 1 + Range: [1, PX_MAX_U32]
+ + @see PxScene.setCCDMaxPasses() PxScene.getCCDMaxPasses() + */ + PxU32 ccdMaxPasses; + + /** + \brief CCD threshold + + CCD performs sweeps against shapes if and only if the relative motion of the shapes is fast-enough that a collision would be missed + by the discrete contact generation. However, in some circumstances, e.g. when the environment is constructed from large convex shapes, this + approach may produce undesired simulation artefacts. This parameter defines the minimum relative motion that would be required to force CCD between shapes. + The smaller of this value and the sum of the thresholds calculated for the shapes involved will be used. + + \note It is not advisable to set this to a very small value as this may lead to CCD "jamming" and detrimentally effect performance. This value should be at least larger than the translation caused by a single frame's gravitational effect + + Default: PX_MAX_F32 + Range: [Eps, PX_MAX_F32]
+ + @see PxScene.setCCDThreshold() PxScene.getCCDThreshold() + */ + PxReal ccdThreshold; + + /** + \brief A threshold for speculative CCD. Used to control whether bias, restitution or a combination of the two are used to resolve the contacts. + + \note This only has any effect on contacting pairs where one of the bodies has PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD raised. + + Range: [0, PX_MAX_F32)
+ Default: 0.04 * PxTolerancesScale::length + + @see PxScene.setCCDMaxSeparation() PxScene.getCCDMaxSeparation() + */ + PxReal ccdMaxSeparation; + + /** + \brief The wake counter reset value + + Calling wakeUp() on objects which support sleeping will set their wake counter value to the specified reset value. + + Range: (0, PX_MAX_F32)
+ Default: 0.4 (which corresponds to 20 frames for a time step of 0.02) + + @see PxRigidDynamic::wakeUp() PxArticulationReducedCoordinate::wakeUp() PxScene.getWakeCounterResetValue() + */ + PxReal wakeCounterResetValue; + + /** + \brief The bounds used to sanity check user-set positions of actors and articulation links + + These bounds are used to check the position values of rigid actors inserted into the scene, and positions set for rigid actors + already within the scene. + + Range: any valid PxBounds3
+ Default: (-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS) on each axis + */ + PxBounds3 sanityBounds; + + /** + \brief The pre-allocations performed in the GPU dynamics pipeline. + */ + PxgDynamicsMemoryConfig gpuDynamicsConfig; + + /** + \brief Limitation for the partitions in the GPU dynamics pipeline. + This variable must be power of 2. + A value greater than 32 is currently not supported. + Range: (1, 32)
+ */ + PxU32 gpuMaxNumPartitions; + + /** + \brief Limitation for the number of static rigid body partitions in the GPU dynamics pipeline. + Range: (1, 255)
+ Default: 16 + */ + PxU32 gpuMaxNumStaticPartitions; + + /** + \brief Defines which compute version the GPU dynamics should target. DO NOT MODIFY + */ + PxU32 gpuComputeVersion; + + /** + \brief Defines the size of a contact pool slab. + Contact pairs and associated data are allocated using a pool allocator. Increasing the slab size can trade + off some performance spikes when a large number of new contacts are found for an increase in overall memory + usage. + + Range:(1, PX_MAX_U32)
+ Default: 256 + */ + PxU32 contactPairSlabSize; + + /** + \brief The scene query sub-system for the scene. + + If left to NULL, PxScene will use its usual internal sub-system. If non-NULL, all SQ-related calls + will be re-routed to the user-provided implementation. An external SQ implementation is available + in the Extensions library (see PxCreateExternalSceneQuerySystem). This can also be fully re-implemented by users if needed. + + @see PxSceneQuerySystem + */ + PxSceneQuerySystem* sceneQuerySystem; + +private: + /** + \cond + */ + // For internal use only + PxTolerancesScale tolerancesScale; + /** + \endcond + */ + +public: + /** + \brief constructor sets to default. + + \param[in] scale scale values for the tolerances in the scene, these must be the same values passed into + PxCreatePhysics(). The affected tolerances are bounceThresholdVelocity and frictionOffsetThreshold. + + @see PxCreatePhysics() PxTolerancesScale bounceThresholdVelocity frictionOffsetThreshold + */ + PX_INLINE PxSceneDesc(const PxTolerancesScale& scale); + + /** + \brief (re)sets the structure to the default. + + \param[in] scale scale values for the tolerances in the scene, these must be the same values passed into + PxCreatePhysics(). The affected tolerances are bounceThresholdVelocity and frictionOffsetThreshold. + + @see PxCreatePhysics() PxTolerancesScale bounceThresholdVelocity frictionOffsetThreshold + */ + PX_INLINE void setToDefault(const PxTolerancesScale& scale); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + PX_INLINE bool isValid() const; + + /** + \cond + */ + // For internal use only + PX_INLINE const PxTolerancesScale& getTolerancesScale() const { return tolerancesScale; } + /** + \endcond + */ +}; + +PX_INLINE PxSceneDesc::PxSceneDesc(const PxTolerancesScale& scale): + gravity (PxVec3(0.0f)), + simulationEventCallback (NULL), + contactModifyCallback (NULL), + ccdContactModifyCallback (NULL), + + filterShaderData (NULL), + filterShaderDataSize (0), + filterShader (NULL), + filterCallback (NULL), + + kineKineFilteringMode (PxPairFilteringMode::eDEFAULT), + staticKineFilteringMode (PxPairFilteringMode::eDEFAULT), + + broadPhaseType (PxBroadPhaseType::ePABP), + broadPhaseCallback (NULL), + + frictionType (PxFrictionType::ePATCH), + solverType (PxSolverType::ePGS), + bounceThresholdVelocity (0.2f * scale.speed), + frictionOffsetThreshold (0.04f * scale.length), + frictionCorrelationDistance (0.025f * scale.length), + + flags (PxSceneFlag::eENABLE_PCM), + + cpuDispatcher (NULL), + cudaContextManager (NULL), + + userData (NULL), + + solverBatchSize (128), + solverArticulationBatchSize (16), + + nbContactDataBlocks (0), + maxNbContactDataBlocks (1<<16), + maxBiasCoefficient (PX_MAX_F32), + contactReportStreamBufferSize (8192), + ccdMaxPasses (1), + ccdThreshold (PX_MAX_F32), + ccdMaxSeparation (0.04f * scale.length), + wakeCounterResetValue (20.0f*0.02f), + sanityBounds (PxBounds3(PxVec3(-PX_MAX_BOUNDS_EXTENTS), PxVec3(PX_MAX_BOUNDS_EXTENTS))), + gpuMaxNumPartitions (8), + gpuMaxNumStaticPartitions (16), + gpuComputeVersion (0), + contactPairSlabSize (256), + sceneQuerySystem (NULL), + tolerancesScale (scale) +{ +} + +PX_INLINE void PxSceneDesc::setToDefault(const PxTolerancesScale& scale) +{ + *this = PxSceneDesc(scale); +} + +PX_INLINE bool PxSceneDesc::isValid() const +{ + if(!PxSceneQueryDesc::isValid()) + return false; + + if(!filterShader) + return false; + + if( ((filterShaderDataSize == 0) && (filterShaderData != NULL)) || + ((filterShaderDataSize > 0) && (filterShaderData == NULL)) ) + return false; + + if(!limits.isValid()) + return false; + + if(bounceThresholdVelocity <= 0.0f) + return false; + if(frictionOffsetThreshold < 0.0f) + return false; + if(frictionCorrelationDistance <= 0) + return false; + + if(maxBiasCoefficient < 0.0f) + return false; + + if(!ccdMaxPasses) + return false; + if(ccdThreshold <= 0.0f) + return false; + if(ccdMaxSeparation < 0.0f) + return false; + + if(!cpuDispatcher) + return false; + + if(!contactReportStreamBufferSize) + return false; + + if(maxNbContactDataBlocks < nbContactDataBlocks) + return false; + + if(wakeCounterResetValue <= 0.0f) + return false; + + if(!sanityBounds.isValid()) + return false; + +#if PX_SUPPORT_GPU_PHYSX + if(!PxIsPowerOfTwo(gpuMaxNumPartitions)) + return false; + if(gpuMaxNumPartitions > 32) + return false; + if (gpuMaxNumPartitions == 0) + return false; + if(!gpuDynamicsConfig.isValid()) + return false; + + if (flags & PxSceneFlag::eSUPPRESS_READBACK) + { + if(!(flags & PxSceneFlag::eENABLE_GPU_DYNAMICS && broadPhaseType == PxBroadPhaseType::eGPU)) + return false; + } +#endif + + if(contactPairSlabSize == 0) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneLock.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneLock.h new file mode 100644 index 0000000..903841c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneLock.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_LOCK_H +#define PX_SCENE_LOCK_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "PxScene.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief RAII wrapper for the PxScene read lock. + +Use this class as follows to lock the scene for reading by the current thread +for the duration of the enclosing scope: + + PxSceneReadLock lock(sceneRef); + +@see PxScene::lockRead(), PxScene::unlockRead(), PxSceneFlag::eREQUIRE_RW_LOCK +*/ +class PxSceneReadLock +{ + PxSceneReadLock(const PxSceneReadLock&); + PxSceneReadLock& operator=(const PxSceneReadLock&); + +public: + + /** + \brief Constructor + \param scene The scene to lock for reading + \param file Optional string for debugging purposes + \param line Optional line number for debugging purposes + */ + PxSceneReadLock(PxScene& scene, const char* file=NULL, PxU32 line=0) + : mScene(scene) + { + mScene.lockRead(file, line); + } + + ~PxSceneReadLock() + { + mScene.unlockRead(); + } + +private: + + PxScene& mScene; +}; + +/** +\brief RAII wrapper for the PxScene write lock. + +Use this class as follows to lock the scene for writing by the current thread +for the duration of the enclosing scope: + + PxSceneWriteLock lock(sceneRef); + +@see PxScene::lockWrite(), PxScene::unlockWrite(), PxSceneFlag::eREQUIRE_RW_LOCK +*/ +class PxSceneWriteLock +{ + PxSceneWriteLock(const PxSceneWriteLock&); + PxSceneWriteLock& operator=(const PxSceneWriteLock&); + +public: + + /** + \brief Constructor + \param scene The scene to lock for writing + \param file Optional string for debugging purposes + \param line Optional line number for debugging purposes + */ + PxSceneWriteLock(PxScene& scene, const char* file=NULL, PxU32 line=0) + : mScene(scene) + { + mScene.lockWrite(file, line); + } + + ~PxSceneWriteLock() + { + mScene.unlockWrite(); + } + +private: + + PxScene& mScene; +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQueryDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQueryDesc.h new file mode 100644 index 0000000..50eae85 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQueryDesc.h @@ -0,0 +1,328 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_QUERY_DESC_H +#define PX_SCENE_QUERY_DESC_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "geometry/PxBVHBuildStrategy.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxSceneQuerySystem; + +/** +\brief Pruning structure used to accelerate scene queries. + +eNONE uses a simple data structure that consumes less memory than the alternatives, +but generally has slower query performance. + +eDYNAMIC_AABB_TREE usually provides the fastest queries. However there is a +constant per-frame management cost associated with this structure. How much work should +be done per frame can be tuned via the #PxSceneQueryDesc::dynamicTreeRebuildRateHint +parameter. + +eSTATIC_AABB_TREE is typically used for static objects. It is the same as the +dynamic AABB tree, without the per-frame overhead. This can be a good choice for static +objects, if no static objects are added, moved or removed after the scene has been +created. If there is no such guarantee (e.g. when streaming parts of the world in and out), +then the dynamic version is a better choice even for static objects. +*/ +struct PxPruningStructureType +{ + enum Enum + { + eNONE, //!< Using a simple data structure + eDYNAMIC_AABB_TREE, //!< Using a dynamic AABB tree + eSTATIC_AABB_TREE, //!< Using a static AABB tree + + eLAST + }; +}; + +/** +\brief Secondary pruning structure used for newly added objects in dynamic trees. + +Dynamic trees (PxPruningStructureType::eDYNAMIC_AABB_TREE) are slowly rebuilt +over several frames. A secondary pruning structure holds and manages objects +added to the scene while this rebuild is in progress. + +eNONE ignores newly added objects. This means that for a number of frames (roughly +defined by PxSceneQueryDesc::dynamicTreeRebuildRateHint) newly added objects will +be ignored by scene queries. This can be acceptable when streaming large worlds, e.g. +when the objects added at the boundaries of the game world don't immediately need to be +visible from scene queries (it would be equivalent to streaming that data in a few frames +later). The advantage of this approach is that there is no CPU cost associated with +inserting the new objects in the scene query data structures, and no extra runtime cost +when performing queries. + +eBUCKET uses a structure similar to PxPruningStructureType::eNONE. Insertion is fast but +query cost can be high. + +eINCREMENTAL uses an incremental AABB-tree, with no direct PxPruningStructureType equivalent. +Query time is fast but insertion cost can be high. + +eBVH uses a PxBVH structure. This usually offers the best overall performance. +*/ +struct PxDynamicTreeSecondaryPruner +{ + enum Enum + { + eNONE, //!< no secondary pruner, new objects aren't visible to SQ for a few frames + eBUCKET , //!< bucket-based secondary pruner, faster updates, slower query time + eINCREMENTAL, //!< incremental-BVH secondary pruner, faster query time, slower updates + eBVH, //!< PxBVH-based secondary pruner, good overall performance + + eLAST + }; +}; + +/** +\brief Scene query update mode + +This enum controls what work is done when the scene query system is updated. The updates traditionally happen when PxScene::fetchResults +is called. This function then calls PxSceneQuerySystem::finalizeUpdates, where the update mode is used. + +fetchResults/finalizeUpdates will sync changed bounds during simulation and update the scene query bounds in pruners, this work is mandatory. + +eBUILD_ENABLED_COMMIT_ENABLED does allow to execute the new AABB tree build step during fetchResults/finalizeUpdates, additionally +the pruner commit is called where any changes are applied. During commit PhysX refits the dynamic scene query tree and if a new tree +was built and the build finished the tree is swapped with current AABB tree. + +eBUILD_ENABLED_COMMIT_DISABLED does allow to execute the new AABB tree build step during fetchResults/finalizeUpdates. Pruner commit +is not called, this means that refit will then occur during the first scene query following fetchResults/finalizeUpdates, or may be forced +by the method PxScene::flushQueryUpdates() / PxSceneQuerySystemBase::flushUpdates(). + +eBUILD_DISABLED_COMMIT_DISABLED no further scene query work is executed. The scene queries update needs to be called manually, see +PxScene::sceneQueriesUpdate (see that function's doc for the equivalent PxSceneQuerySystem sequence). It is recommended to call +PxScene::sceneQueriesUpdate right after fetchResults/finalizeUpdates as the pruning structures are not updated. +*/ +struct PxSceneQueryUpdateMode +{ + enum Enum + { + eBUILD_ENABLED_COMMIT_ENABLED, //!< Both scene query build and commit are executed. + eBUILD_ENABLED_COMMIT_DISABLED, //!< Scene query build only is executed. + eBUILD_DISABLED_COMMIT_DISABLED //!< No work is done, no update of scene queries + }; +}; + +/** +\brief Descriptor class for scene query system. See #PxSceneQuerySystem. +*/ +class PxSceneQueryDesc +{ +public: + + /** + \brief Defines the structure used to store static objects (PxRigidStatic actors). + + There are usually a lot more static actors than dynamic actors in a scene, so they are stored + in a separate structure. The idea is that when dynamic actors move each frame, the static structure + remains untouched and does not need updating. + + Default: PxPruningStructureType::eDYNAMIC_AABB_TREE + + \note Only PxPruningStructureType::eSTATIC_AABB_TREE and PxPruningStructureType::eDYNAMIC_AABB_TREE are allowed here. + + @see PxPruningStructureType PxSceneSQSystem.getStaticStructure() + */ + PxPruningStructureType::Enum staticStructure; + + /** + \brief Defines the structure used to store dynamic objects (non-PxRigidStatic actors). + + Default: PxPruningStructureType::eDYNAMIC_AABB_TREE + + @see PxPruningStructureType PxSceneSQSystem.getDynamicStructure() + */ + PxPruningStructureType::Enum dynamicStructure; + + /** + \brief Hint for how much work should be done per simulation frame to rebuild the pruning structures. + + This parameter gives a hint on the distribution of the workload for rebuilding the dynamic AABB tree + pruning structure #PxPruningStructureType::eDYNAMIC_AABB_TREE. It specifies the desired number of simulation frames + the rebuild process should take. Higher values will decrease the workload per frame but the pruning + structure will get more and more outdated the longer the rebuild takes (which can make + scene queries less efficient). + + \note Only used for #PxPruningStructureType::eDYNAMIC_AABB_TREE pruning structures. + + \note Both staticStructure & dynamicStructure can use a PxPruningStructureType::eDYNAMIC_AABB_TREE, in which case + this parameter is used for both. + + \note This parameter gives only a hint. The rebuild process might still take more or less time depending on the + number of objects involved. + + Range: [4, PX_MAX_U32)
+ Default: 100 + + @see PxSceneQuerySystemBase.setDynamicTreeRebuildRateHint() PxSceneQuerySystemBase.getDynamicTreeRebuildRateHint() + */ + PxU32 dynamicTreeRebuildRateHint; + + /** + \brief Secondary pruner for dynamic tree. + + This is used for PxPruningStructureType::eDYNAMIC_AABB_TREE structures, to control how objects added to the system + at runtime are managed. + + \note Both staticStructure & dynamicStructure can use a PxPruningStructureType::eDYNAMIC_AABB_TREE, in which case + this parameter is used for both. + + Default: PxDynamicTreeSecondaryPruner::eINCREMENTAL + + @see PxDynamicTreeSecondaryPruner + */ + PxDynamicTreeSecondaryPruner::Enum dynamicTreeSecondaryPruner; + + /** + \brief Build strategy for PxSceneQueryDesc::staticStructure. + + This parameter is used to refine / control the build strategy of PxSceneQueryDesc::staticStructure. This is only + used with PxPruningStructureType::eDYNAMIC_AABB_TREE and PxPruningStructureType::eSTATIC_AABB_TREE. + + Default: PxBVHBuildStrategy::eFAST + + @see PxBVHBuildStrategy PxSceneQueryDesc::staticStructure + */ + PxBVHBuildStrategy::Enum staticBVHBuildStrategy; + + /** + \brief Build strategy for PxSceneQueryDesc::dynamicStructure. + + This parameter is used to refine / control the build strategy of PxSceneQueryDesc::dynamicStructure. This is only + used with PxPruningStructureType::eDYNAMIC_AABB_TREE and PxPruningStructureType::eSTATIC_AABB_TREE. + + Default: PxBVHBuildStrategy::eFAST + + @see PxBVHBuildStrategy PxSceneQueryDesc::dynamicStructure + */ + PxBVHBuildStrategy::Enum dynamicBVHBuildStrategy; + + /** + \brief Number of objects per node for PxSceneQueryDesc::staticStructure. + + This parameter is used to refine / control the number of objects per node for PxSceneQueryDesc::staticStructure. + This is only used with PxPruningStructureType::eDYNAMIC_AABB_TREE and PxPruningStructureType::eSTATIC_AABB_TREE. + + This parameter has an impact on how quickly the structure gets built, and on the per-frame cost of maintaining + the structure. Increasing this value gives smaller AABB-trees that use less memory, are faster to build and + update, but it can lead to slower queries. + + Default: 4 + + @see PxSceneQueryDesc::staticStructure + */ + PxU32 staticNbObjectsPerNode; + + /** + \brief Number of objects per node for PxSceneQueryDesc::dynamicStructure. + + This parameter is used to refine / control the number of objects per node for PxSceneQueryDesc::dynamicStructure. + This is only used with PxPruningStructureType::eDYNAMIC_AABB_TREE and PxPruningStructureType::eSTATIC_AABB_TREE. + + This parameter has an impact on how quickly the structure gets built, and on the per-frame cost of maintaining + the structure. Increasing this value gives smaller AABB-trees that use less memory, are faster to build and + update, but it can lead to slower queries. + + Default: 4 + + @see PxSceneQueryDesc::dynamicStructure + */ + PxU32 dynamicNbObjectsPerNode; + + /** + \brief Defines the scene query update mode. + + Default: PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED + + @see PxSceneQuerySystemBase.setUpdateMode() PxSceneQuerySystemBase.getUpdateMode() + */ + PxSceneQueryUpdateMode::Enum sceneQueryUpdateMode; + +public: + /** + \brief constructor sets to default. + */ + PX_INLINE PxSceneQueryDesc(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE PxSceneQueryDesc::PxSceneQueryDesc(): + staticStructure (PxPruningStructureType::eDYNAMIC_AABB_TREE), + dynamicStructure (PxPruningStructureType::eDYNAMIC_AABB_TREE), + dynamicTreeRebuildRateHint (100), + dynamicTreeSecondaryPruner (PxDynamicTreeSecondaryPruner::eINCREMENTAL), + staticBVHBuildStrategy (PxBVHBuildStrategy::eFAST), + dynamicBVHBuildStrategy (PxBVHBuildStrategy::eFAST), + staticNbObjectsPerNode (4), + dynamicNbObjectsPerNode (4), + sceneQueryUpdateMode (PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED) +{ +} + +PX_INLINE void PxSceneQueryDesc::setToDefault() +{ + *this = PxSceneQueryDesc(); +} + +PX_INLINE bool PxSceneQueryDesc::isValid() const +{ + if(staticStructure!=PxPruningStructureType::eSTATIC_AABB_TREE && staticStructure!=PxPruningStructureType::eDYNAMIC_AABB_TREE) + return false; + + if(dynamicTreeRebuildRateHint < 4) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQuerySystem.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQuerySystem.h new file mode 100644 index 0000000..0d926dc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSceneQuerySystem.h @@ -0,0 +1,656 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_QUERY_SYSTEM_H +#define PX_SCENE_QUERY_SYSTEM_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxTransform.h" +#include "PxSceneQueryDesc.h" +#include "PxQueryReport.h" +#include "PxQueryFiltering.h" +#include "geometry/PxGeometryQueryFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxBaseTask; + class PxRenderOutput; + class PxGeometry; + class PxRigidActor; + class PxShape; + class PxBVH; + class PxPruningStructure; + + /** + \brief Built-in enum for default PxScene pruners + + This is passed as a pruner index to various functions in the following APIs. + + @see PxSceneQuerySystemBase::forceRebuildDynamicTree PxSceneQuerySystem::preallocate + @see PxSceneQuerySystem::visualize PxSceneQuerySystem::sync PxSceneQuerySystem::prepareSceneQueryBuildStep + */ + enum PxScenePrunerIndex + { + PX_SCENE_PRUNER_STATIC = 0, + PX_SCENE_PRUNER_DYNAMIC = 1, + PX_SCENE_COMPOUND_PRUNER = 0xffffffff + }; + + /** + \brief Base class for the scene-query system. + + Methods defined here are common to both the traditional PxScene API and the PxSceneQuerySystem API. + + @see PxScene PxSceneQuerySystem + */ + class PxSceneQuerySystemBase + { + protected: + PxSceneQuerySystemBase() {} + virtual ~PxSceneQuerySystemBase() {} + + public: + + /** @name Scene Query + */ + //@{ + + /** + \brief Sets the rebuild rate of the dynamic tree pruning structures. + + \param[in] dynamicTreeRebuildRateHint Rebuild rate of the dynamic tree pruning structures. + + @see PxSceneQueryDesc.dynamicTreeRebuildRateHint getDynamicTreeRebuildRateHint() forceRebuildDynamicTree() + */ + virtual void setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint) = 0; + + /** + \brief Retrieves the rebuild rate of the dynamic tree pruning structures. + + \return The rebuild rate of the dynamic tree pruning structures. + + @see PxSceneQueryDesc.dynamicTreeRebuildRateHint setDynamicTreeRebuildRateHint() forceRebuildDynamicTree() + */ + virtual PxU32 getDynamicTreeRebuildRateHint() const = 0; + + /** + \brief Forces dynamic trees to be immediately rebuilt. + + \param[in] prunerIndex Index of pruner containing the dynamic tree to rebuild + + \note PxScene will call this function with the PX_SCENE_PRUNER_STATIC or PX_SCENE_PRUNER_DYNAMIC value. + + @see PxSceneQueryDesc.dynamicTreeRebuildRateHint setDynamicTreeRebuildRateHint() getDynamicTreeRebuildRateHint() + */ + virtual void forceRebuildDynamicTree(PxU32 prunerIndex) = 0; + + /** + \brief Sets scene query update mode + + \param[in] updateMode Scene query update mode. + + @see PxSceneQueryUpdateMode::Enum + */ + virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum updateMode) = 0; + + /** + \brief Gets scene query update mode + + \return Current scene query update mode. + + @see PxSceneQueryUpdateMode::Enum + */ + virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const = 0; + + /** + \brief Retrieves the system's internal scene query timestamp, increased each time a change to the + static scene query structure is performed. + + \return scene query static timestamp + */ + virtual PxU32 getStaticTimestamp() const = 0; + + /** + \brief Flushes any changes to the scene query representation. + + This method updates the state of the scene query representation to match changes in the scene state. + + By default, these changes are buffered until the next query is submitted. Calling this function will not change + the results from scene queries, but can be used to ensure that a query will not perform update work in the course of + its execution. + + A thread performing updates will hold a write lock on the query structure, and thus stall other querying threads. In multithread + scenarios it can be useful to explicitly schedule the period where this lock may be held for a significant period, so that + subsequent queries issued from multiple threads will not block. + */ + virtual void flushUpdates() = 0; + + /** + \brief Performs a raycast against objects in the scene, returns results in a PxRaycastBuffer object + or via a custom user callback implementation inheriting from PxRaycastCallback. + + \note Touching hits are not ordered. + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in user guide article SceneQuery. User can ignore such objects by employing one of the provided filter mechanisms. + + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Has to be in the [0, inf) range. + \param[out] hitCall Raycast hit buffer or callback object used to report raycast hits. + \param[in] hitFlags Specifies which properties per hit should be computed and returned via the hit callback. + \param[in] filterData Filtering data passed to the filter shader. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] queryFlags Optional flags controlling the query. + + \return True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + + @see PxRaycastCallback PxRaycastBuffer PxQueryFilterData PxQueryFilterCallback PxQueryCache PxRaycastHit PxQueryFlag PxQueryFlag::eANY_HIT PxGeometryQueryFlag + */ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxRaycastCallback& hitCall, PxHitFlags hitFlags = PxHitFlag::eDEFAULT, + const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Performs a sweep test against objects in the scene, returns results in a PxSweepBuffer object + or via a custom user callback implementation inheriting from PxSweepCallback. + + \note Touching hits are not ordered. + \note If a shape from the scene is already overlapping with the query shape in its starting position, + the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be in [0, inf) range and >0 if eASSUME_NO_INITIAL_OVERLAP was specified. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[out] hitCall Sweep hit buffer or callback object used to report sweep hits. + \param[in] hitFlags Specifies which properties per hit should be computed and returned via the hit callback. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first. If no hit is found the sweep gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + Note: ePRECISE_SWEEP doesn't support inflation. Therefore the sweep will be performed with zero inflation. + \param[in] queryFlags Optional flags controlling the query. + + \return True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + + @see PxSweepCallback PxSweepBuffer PxQueryFilterData PxQueryFilterCallback PxSweepHit PxQueryCache PxGeometryQueryFlag + */ + virtual bool sweep( const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSweepCallback& hitCall, PxHitFlags hitFlags = PxHitFlag::eDEFAULT, + const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, const PxReal inflation = 0.0f, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Performs an overlap test of a given geometry against objects in the scene, returns results in a PxOverlapBuffer object + or via a custom user callback implementation inheriting from PxOverlapCallback. + + \note Filtering: returning eBLOCK from user filter for overlap queries will cause a warning (see #PxQueryHitType). + + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[out] hitCall Overlap hit buffer or callback object used to report overlap hits. + \param[in] filterData Filtering data and simple logic. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to overlap. + \param[in] cache Cached hit shape (optional). Overlap is performed against cached shape first. If no hit is found the overlap gets queried against the scene. + \param[in] queryFlags Optional flags controlling the query. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + + \return True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + + \note eBLOCK should not be returned from user filters for overlap(). Doing so will result in undefined behavior, and a warning will be issued. + \note If the PxQueryFlag::eNO_BLOCK flag is set, the eBLOCK will instead be automatically converted to an eTOUCH and the warning suppressed. + + @see PxOverlapCallback PxOverlapBuffer PxHitFlags PxQueryFilterData PxQueryFilterCallback PxGeometryQueryFlag + */ + virtual bool overlap(const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData = PxQueryFilterData(), PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + //@} + }; + + /** + \brief Traditional SQ system for PxScene. + + Methods defined here are only available through the traditional PxScene API. + Thus PxSceneSQSystem effectively captures the scene-query related part of the PxScene API. + + @see PxScene PxSceneQuerySystemBase + */ + class PxSceneSQSystem : public PxSceneQuerySystemBase + { + protected: + PxSceneSQSystem() {} + virtual ~PxSceneSQSystem() {} + + public: + + /** @name Scene Query + */ + //@{ + + /** + \brief Sets scene query update mode + + \param[in] updateMode Scene query update mode. + + @see PxSceneQueryUpdateMode::Enum + */ + PX_FORCE_INLINE void setSceneQueryUpdateMode(PxSceneQueryUpdateMode::Enum updateMode) { setUpdateMode(updateMode); } + + /** + \brief Gets scene query update mode + + \return Current scene query update mode. + + @see PxSceneQueryUpdateMode::Enum + */ + PX_FORCE_INLINE PxSceneQueryUpdateMode::Enum getSceneQueryUpdateMode() const { return getUpdateMode(); } + + /** + \brief Retrieves the scene's internal scene query timestamp, increased each time a change to the + static scene query structure is performed. + + \return scene query static timestamp + */ + PX_FORCE_INLINE PxU32 getSceneQueryStaticTimestamp() const { return getStaticTimestamp(); } + + /** + \brief Flushes any changes to the scene query representation. + + @see flushUpdates + */ + PX_FORCE_INLINE void flushQueryUpdates() { flushUpdates(); } + + /** + \brief Forces dynamic trees to be immediately rebuilt. + + \param[in] rebuildStaticStructure True to rebuild the dynamic tree containing static objects + \param[in] rebuildDynamicStructure True to rebuild the dynamic tree containing dynamic objects + + @see PxSceneQueryDesc.dynamicTreeRebuildRateHint setDynamicTreeRebuildRateHint() getDynamicTreeRebuildRateHint() + */ + PX_FORCE_INLINE void forceDynamicTreeRebuild(bool rebuildStaticStructure, bool rebuildDynamicStructure) + { + if(rebuildStaticStructure) + forceRebuildDynamicTree(PX_SCENE_PRUNER_STATIC); + if(rebuildDynamicStructure) + forceRebuildDynamicTree(PX_SCENE_PRUNER_DYNAMIC); + } + + /** + \brief Return the value of PxSceneQueryDesc::staticStructure that was set when creating the scene with PxPhysics::createScene + + @see PxSceneQueryDesc::staticStructure, PxPhysics::createScene + */ + virtual PxPruningStructureType::Enum getStaticStructure() const = 0; + + /** + \brief Return the value of PxSceneQueryDesc::dynamicStructure that was set when creating the scene with PxPhysics::createScene + + @see PxSceneQueryDesc::dynamicStructure, PxPhysics::createScene + */ + virtual PxPruningStructureType::Enum getDynamicStructure() const = 0; + + /** + \brief Executes scene queries update tasks. + + This function will refit dirty shapes within the pruner and will execute a task to build a new AABB tree, which is + build on a different thread. The new AABB tree is built based on the dynamic tree rebuild hint rate. Once + the new tree is ready it will be commited in next fetchQueries call, which must be called after. + + This function is equivalent to the following PxSceneQuerySystem calls: + Synchronous calls: + - PxSceneQuerySystemBase::flushUpdates() + - handle0 = PxSceneQuerySystem::prepareSceneQueryBuildStep(PX_SCENE_PRUNER_STATIC) + - handle1 = PxSceneQuerySystem::prepareSceneQueryBuildStep(PX_SCENE_PRUNER_DYNAMIC) + Asynchronous calls: + - PxSceneQuerySystem::sceneQueryBuildStep(handle0); + - PxSceneQuerySystem::sceneQueryBuildStep(handle1); + + This function is part of the PxSceneSQSystem interface because it uses the PxScene task system under the hood. But + it calls PxSceneQuerySystem functions, which are independent from this system and could be called in a similar + fashion by a separate, possibly user-defined task manager. + + \note If PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED is used, it is required to update the scene queries + using this function. + + \param[in] completionTask if non-NULL, this task will have its refcount incremented in sceneQueryUpdate(), then + decremented when the scene is ready to have fetchQueries called. So the task will not run until the + application also calls removeReference(). + \param[in] controlSimulation if true, the scene controls its PxTaskManager simulation state. Leave + true unless the application is calling the PxTaskManager start/stopSimulation() methods itself. + + @see PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED + */ + virtual void sceneQueriesUpdate(PxBaseTask* completionTask = NULL, bool controlSimulation = true) = 0; + + /** + \brief This checks to see if the scene queries update has completed. + + This does not cause the data available for reading to be updated with the results of the scene queries update, it is simply a status check. + The bool will allow it to either return immediately or block waiting for the condition to be met so that it can return true + + \param[in] block When set to true will block until the condition is met. + \return True if the results are available. + + @see sceneQueriesUpdate() fetchResults() + */ + virtual bool checkQueries(bool block = false) = 0; + + /** + This method must be called after sceneQueriesUpdate. It will wait for the scene queries update to finish. If the user makes an illegal scene queries update call, + the SDK will issue an error message. + + If a new AABB tree build finished, then during fetchQueries the current tree within the pruning structure is swapped with the new tree. + + \param[in] block When set to true will block until the condition is met, which is tree built task must finish running. + */ + virtual bool fetchQueries(bool block = false) = 0; + //@} + }; + + typedef PxU32 PxSQCompoundHandle; + typedef PxU32 PxSQPrunerHandle; + typedef void* PxSQBuildStepHandle; + + /** + \brief Scene-queries external sub-system for PxScene-based objects. + + The default PxScene has hardcoded support for 2 regular pruners + 1 compound pruner, but these interfaces + should work with multiple pruners. + + Regular shapes are traditional PhysX shapes that belong to an actor. That actor can be a compound, i.e. it has + more than one shape. *All of these go to the regular pruners*. This is important because it might be misleading: + by default all shapes go to one of the two regular pruners, even shapes that belong to compound actors. + + For compound actors, adding all the actor's shapes individually to the SQ system can be costly, since all the + corresponding bounds will always move together and remain close together - that can put a lot of stress on the + code that updates the SQ spatial structures. In these cases it can be more efficient to add the compound's bounds + (i.e. the actor's bounds) to the system, as the first level of a bounds hierarchy. The scene queries would then + be performed against the actor's bounds first, and only visit the shapes' bounds second. This is only useful + for actors that have more than one shape, i.e. compound actors. Such actors added to the SQ system are thus + called "SQ compounds". These objects are managed by the "compound pruner", which is only used when an explicit + SQ compound is added to the SQ system via the addSQCompound call. So in the end one has to distinguish between: + + - a "compound shape", which is added to regular pruners as its own individual entity. + - an "SQ compound shape", which is added to the compound pruner as a subpart of an SQ compound actor. + + A compound shape has an invalid compound ID, since it does not belong to an SQ compound. + An SQ compound shape has a valid compound ID, that identifies its SQ compound owner. + + @see PxScene PxSceneQuerySystemBase + */ + class PxSceneQuerySystem : public PxSceneQuerySystemBase + { + protected: + PxSceneQuerySystem() {} + virtual ~PxSceneQuerySystem() {} + public: + + /** + \brief Decrements the reference count of the object and releases it if the new reference count is zero. + */ + virtual void release() = 0; + + /** + \brief Acquires a counted reference to this object. + + This method increases the reference count of the object by 1. Decrement the reference count by calling release() + */ + virtual void acquireReference() = 0; + + /** + \brief Preallocates internal arrays to minimize the amount of reallocations. + + The system does not prevent more allocations than given numbers. It is legal to not call this function at all, + or to add more shapes to the system than the preallocated amounts. + + \param[in] prunerIndex Index of pruner to preallocate (PX_SCENE_PRUNER_STATIC, PX_SCENE_PRUNER_DYNAMIC or PX_SCENE_COMPOUND_PRUNER when called from PxScene). + \param[in] nbShapes Expected number of (regular) shapes + */ + virtual void preallocate(PxU32 prunerIndex, PxU32 nbShapes) = 0; + + /** + \brief Frees internal memory that may not be in-use anymore. + + This is an entry point for reclaiming transient memory allocated at some point by the SQ system, + but which wasn't been immediately freed for performance reason. Calling this function might free + some memory, but it might also produce a new set of allocations in the next frame. + */ + virtual void flushMemory() = 0; + + /** + \brief Adds a shape to the SQ system. + + The same function is used to add either a regular shape, or a SQ compound shape. + + \param[in] actor The shape's actor owner + \param[in] shape The shape itself + \param[in] bounds Shape bounds, in world-space for regular shapes, in local-space for SQ compound shapes. + \param[in] transform Shape transform, in world-space for regular shapes, in local-space for SQ compound shapes. + \param[in] compoundHandle Handle of SQ compound owner, or NULL for regular shapes. + \param[in] hasPruningStructure True if the shape is part of a pruning structure. The structure will be merged later, adding the objects will not invalidate the pruner. + + @see merge() PxPruningStructure + */ + virtual void addSQShape( const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, + const PxTransform& transform, const PxSQCompoundHandle* compoundHandle=NULL, bool hasPruningStructure=false) = 0; + + /** + \brief Removes a shape from the SQ system. + + The same function is used to remove either a regular shape, or a SQ compound shape. + + \param[in] actor The shape's actor owner + \param[in] shape The shape itself + */ + virtual void removeSQShape(const PxRigidActor& actor, const PxShape& shape) = 0; + + /** + \brief Updates a shape in the SQ system. + + The same function is used to update either a regular shape, or a SQ compound shape. + + The transforms are eager-evaluated, but the bounds are lazy-evaluated. This means that + the updated transform has to be passed to the update function, while the bounds are automatically + recomputed by the system whenever needed. + + \param[in] actor The shape's actor owner + \param[in] shape The shape itself + \param[in] transform New shape transform, in world-space for regular shapes, in local-space for SQ compound shapes. + */ + virtual void updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform) = 0; + + /** + \brief Adds a compound to the SQ system. + + \param[in] actor The compound actor + \param[in] shapes The compound actor's shapes + \param[in] bvh BVH structure containing the compound's shapes in local space + \param[in] transforms Shape transforms, in local-space + + \return SQ compound handle + + @see PxBVH PxCooking::createBVH + */ + virtual PxSQCompoundHandle addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& bvh, const PxTransform* transforms) = 0; + + /** + \brief Removes a compound from the SQ system. + + \param[in] compoundHandle SQ compound handle (returned by addSQCompound) + */ + virtual void removeSQCompound(PxSQCompoundHandle compoundHandle) = 0; + + /** + \brief Updates a compound in the SQ system. + + The compound structures are immediately updated when the call occurs. + + \param[in] compoundHandle SQ compound handle (returned by addSQCompound) + \param[in] compoundTransform New actor/compound transform, in world-space + */ + virtual void updateSQCompound(PxSQCompoundHandle compoundHandle, const PxTransform& compoundTransform) = 0; + + /** + \brief Shift the data structures' origin by the specified vector. + + Please refer to the notes of the similar function in PxScene. + + \param[in] shift Translation vector to shift the origin by. + */ + virtual void shiftOrigin(const PxVec3& shift) = 0; + + /** + \brief Visualizes the system's internal data-structures, for debugging purposes. + + \param[in] prunerIndex Index of pruner to visualize (PX_SCENE_PRUNER_STATIC, PX_SCENE_PRUNER_DYNAMIC or PX_SCENE_COMPOUND_PRUNER when called from PxScene). + + \param[out] out Filled with render output data + + @see PxRenderOutput + */ + PX_DEPRECATED virtual void visualize(PxU32 prunerIndex, PxRenderOutput& out) const = 0; + + /** + \brief Merges a pruning structure with the SQ system's internal pruners. + + \param[in] pruningStructure The pruning structure to merge + + @see PxPruningStructure + */ + virtual void merge(const PxPruningStructure& pruningStructure) = 0; + + /** + \brief Shape to SQ-pruner-handle mapping function. + + This function finds and returns the SQ pruner handle associated with a given (actor/shape) couple + that was previously added to the system. This is needed for the sync function. + + \param[in] actor The shape's actor owner + \param[in] shape The shape itself + \param[out] prunerIndex Index of pruner the shape belongs to + + \return Associated SQ pruner handle. + */ + virtual PxSQPrunerHandle getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const = 0; + + /** + \brief Synchronizes the scene-query system with another system that references the same objects. + + This function is used when the scene-query objects also exist in another system that can also update them. For example the scene-query objects + (used for raycast, overlap or sweep queries) might be driven by equivalent objects in an external rigid-body simulation engine. In this case + the rigid-body simulation engine computes the new poses and transforms, and passes them to the scene-query system using this function. It is + more efficient than calling updateSQShape on each object individually, since updateSQShape would end up recomputing the bounds already available + in the rigid-body engine. + + \param[in] prunerIndex Index of pruner being synched (PX_SCENE_PRUNER_DYNAMIC for regular PhysX usage) + \param[in] handles Handles of updated objects + \param[in] indices Bounds & transforms indices of updated objects, i.e. object handles[i] has bounds[indices[i]] and transforms[indices[i]] + \param[in] bounds Array of bounds for all objects (not only updated bounds) + \param[in] transforms Array of transforms for all objects (not only updated transforms) + \param[in] count Number of updated objects + \param[in] ignoredIndices Optional bitmap of ignored indices, i.e. update is skipped if ignoredIndices[indices[i]] is set. + + @see PxBounds3 PxTransform32 PxBitMap + */ + virtual void sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) = 0; + + /** + \brief Finalizes updates made to the SQ system. + + This function should be called after updates have been made to the SQ system, to fully reflect the changes + inside the internal pruners. In particular it should be called: + - after calls to updateSQShape + - after calls to sync + + This function: + - recomputes bounds of manually updated shapes (i.e. either regular or SQ compound shapes modified by updateSQShape) + - updates dynamic pruners (refit operations) + - incrementally rebuilds AABB-trees + + The amount of work performed in this function depends on PxSceneQueryUpdateMode. + + @see PxSceneQueryUpdateMode updateSQShape() sync() + */ + virtual void finalizeUpdates() = 0; + + /** + \brief Prepares asynchronous build step. + + This is directly called (synchronously) by PxSceneSQSystem::sceneQueriesUpdate(). See the comments there. + + This function is called to let the system execute any necessary synchronous operation before the + asynchronous sceneQueryBuildStep() function is called. + + If there is any work to do for the specific pruner, the function returns a pruner-specific handle that + will be passed to the corresponding, asynchronous sceneQueryBuildStep function. + + \return A pruner-specific handle that will be sent to sceneQueryBuildStep if there is any work to do, i.e. to execute the corresponding sceneQueryBuildStep() call. + + \param[in] prunerIndex Index of pruner being built. (PX_SCENE_PRUNER_STATIC or PX_SCENE_PRUNER_DYNAMIC when called by PxScene). + + \return Null if there is no work to do, otherwise a pruner-specific handle. + + @see PxSceneSQSystem::sceneQueriesUpdate sceneQueryBuildStep + */ + virtual PxSQBuildStepHandle prepareSceneQueryBuildStep(PxU32 prunerIndex) = 0; + + /** + \brief Executes asynchronous build step. + + This is directly called (asynchronously) by PxSceneSQSystem::sceneQueriesUpdate(). See the comments there. + + This function incrementally builds the internal trees/pruners. It is called asynchronously, i.e. this can be + called from different threads for building multiple trees at the same time. + + \param[in] handle Pruner-specific handle previously returned by the prepareSceneQueryBuildStep function. + + @see PxSceneSQSystem::sceneQueriesUpdate prepareSceneQueryBuildStep + */ + virtual void sceneQueryBuildStep(PxSQBuildStepHandle handle) = 0; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxShape.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxShape.h new file mode 100644 index 0000000..176769f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxShape.h @@ -0,0 +1,794 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SHAPE_H +#define PX_SHAPE_H +/** \addtogroup physics +@{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHelpers.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBoxGeometry; +class PxSphereGeometry; +class PxCapsuleGeometry; +class PxPlaneGeometry; +class PxConvexMeshGeometry; +class PxTriangleMeshGeometry; +class PxTetrahedronMeshGeometry; +class PxHeightFieldGeometry; +class PxParticleSystemGeometry; +class PxHairSystemGeometry; +class PxRigidActor; +struct PxFilterData; +class PxBaseMaterial; +class PxMaterial; +class PxFEMSoftBodyMaterial; +class PxFEMClothMaterial; + +/** +\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 PxShapeFlags; +PX_FLAGS_OPERATORS(PxShapeFlag::Enum,PxU8) + +/** +\brief Abstract class for collision shapes. + +Shapes are shared, reference counted objects. + +An instance can be created by calling the createShape() method of the PxRigidActor class, or +the createShape() method of the PxPhysics class. + +

Visualizations

+\li PxVisualizationParameter::eCOLLISION_AABBS +\li PxVisualizationParameter::eCOLLISION_SHAPES +\li PxVisualizationParameter::eCOLLISION_AXES + +@see PxPhysics.createShape() PxRigidActor.createShape() PxBoxGeometry PxSphereGeometry PxCapsuleGeometry PxPlaneGeometry PxConvexMeshGeometry +PxTriangleMeshGeometry PxHeightFieldGeometry +*/ +class PxShape : public PxRefCounted +{ +public: + /** + \brief 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. + + @see PxRigidActor::createShape() PxPhysics::createShape() PxRigidActor::attachShape() PxRigidActor::detachShape() + */ + virtual void release() = 0; + + /** + \brief Adjust the geometry of the shape. + + \note The type of the passed in geometry must match the geometry type of the shape. + \note It is not allowed to change the geometry type of a shape. + \note This function does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + + \param[in] geometry New geometry of the shape. + + @see PxGeometry PxGeometryType getGeometryType() + */ + virtual void setGeometry(const PxGeometry& geometry) = 0; + + /** + \brief Retrieve a reference to the shape's geometry. + + \warning The returned reference has the same lifetime as the PxShape it comes from. + + \return Reference to internal PxGeometry object. + + @see PxGeometry PxGeometryType getGeometryType() setGeometry() + */ + virtual const PxGeometry& getGeometry() const = 0; + + /** + \brief Get the geometry type of the shape. + + \return Type of shape geometry. + + @see PxGeometryType + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE PxGeometryType::Enum getGeometryType() const + { + return getGeometry().getType(); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getBoxGeometry(PxBoxGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eBOX, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getSphereGeometry(PxSphereGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eSPHERE, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getCapsuleGeometry(PxCapsuleGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eCAPSULE, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getPlaneGeometry(PxPlaneGeometry& geometry) const + { + return getGeometryT(PxGeometryType::ePLANE, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getConvexMeshGeometry(PxConvexMeshGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eCONVEXMESH, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getTriangleMeshGeometry(PxTriangleMeshGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eTRIANGLEMESH, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getTetrahedronMeshGeometry(PxTetrahedronMeshGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eTETRAHEDRONMESH, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getParticleSystemGeometry(PxParticleSystemGeometry& geometry) const + { + return getGeometryT(PxGeometryType::ePARTICLESYSTEM, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getHeightFieldGeometry(PxHeightFieldGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eHEIGHTFIELD, geometry); + } + + /** + \brief Fetch the geometry of the shape. + + \note If the type of geometry to extract does not match the geometry type of the shape + then the method will return false and the passed in geometry descriptor is not modified. + + \param[in] geometry The descriptor to save the shape's geometry data to. + \return True on success else false + + @see PxGeometry PxGeometryType getGeometryType() + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool getCustomGeometry(PxCustomGeometry& geometry) const + { + return getGeometryT(PxGeometryType::eCUSTOM, geometry); + } + + /** + \brief Retrieves the actor which this shape is associated with. + + \return The actor this shape is associated with, if it is an exclusive shape, else NULL + + @see PxRigidStatic, PxRigidDynamic, PxArticulationLink + */ + virtual PxRigidActor* getActor() const = 0; + +/************************************************************************************************/ + +/** @name Pose Manipulation +*/ +//@{ + + /** + \brief 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 + + \param[in] pose The new transform from the actor frame to the shape frame. Range: rigid body transform + + @see getLocalPose() + */ + virtual void setLocalPose(const PxTransform& pose) = 0; + + /** + \brief 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. + + \return Pose of shape relative to the actor's frame. + + @see setLocalPose() + */ + virtual PxTransform getLocalPose() const = 0; + +//@} +/************************************************************************************************/ + +/** @name Collision Filtering +*/ +//@{ + + /** + \brief 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) + + @see getSimulationFilterData() + */ + virtual void setSimulationFilterData(const PxFilterData& data) = 0; + + /** + \brief Retrieves the shape's collision filter data. + + @see setSimulationFilterData() + */ + virtual PxFilterData getSimulationFilterData() const = 0; + + /** + \brief Sets the user definable query filter data. + + Default: (0,0,0,0) + + @see getQueryFilterData() + */ + virtual void setQueryFilterData(const PxFilterData& data) = 0; + + /** + \brief Retrieves the shape's Query filter data. + + @see setQueryFilterData() + */ + virtual PxFilterData getQueryFilterData() const = 0; + +//@} +/************************************************************************************************/ + + /** + \brief Assigns material(s) to the shape. Will remove existing materials from the shape. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxMaterial + \param[in] materialCount The number of materials provided. + + @see PxPhysics.createMaterial() getMaterials() + */ + virtual void setMaterials(PxMaterial*const* materials, PxU16 materialCount) = 0; + + /** + \brief Assigns FEM soft body material(s) to the shape. Will remove existing materials from the shape. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxFEMSoftBodyMaterial + \param[in] materialCount The number of materials provided. + + @see PxPhysics.createFEMSoftBodyMaterial() getSoftBodyMaterials() + */ + PX_DEPRECATED virtual void setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount) = 0; + + /** + \brief Assigns FEM cloth material(s) to the shape. Will remove existing materials from the shape. + \warning Feature under development, only for internal usage. + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] materials List of material pointers to assign to the shape. See #PxFEMClothMaterial + \param[in] materialCount The number of materials provided. + + @see PxPhysics.createFEMClothMaterial() getClothMaterials() + */ + PX_DEPRECATED virtual void setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) = 0; + + /** + \brief Returns the number of materials assigned to the shape. + + You can use #getMaterials() to retrieve the material pointers. + + \return Number of materials associated with this shape. + + @see PxMaterial getMaterials() + */ + virtual PxU16 getNbMaterials() const = 0; + + /** + \brief 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(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + @see PxMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Retrieve all the FEM soft body 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(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + @see PxFEMSoftBodyMaterial getNbMaterials() PxMaterial::release() + */ + PX_DEPRECATED virtual PxU32 getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief Retrieve all the FEM cloth material pointers associated with the shape. + \warning Feature under development, only for internal usage. + + 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(). + + \param[out] userBuffer The buffer to store the material pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first material pointer to be retrieved + \return Number of material pointers written to the buffer. + + @see PxFEMClothMaterial getNbMaterials() PxMaterial::release() + */ + PX_DEPRECATED virtual PxU32 getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const = 0; + + /** + \brief 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. + + \param[in] faceIndex The internal triangle index whose material you want to retrieve. + \return Material from input triangle + + \note If faceIndex value of 0xFFFFffff is passed as an input for mesh and heightfield shapes, this function will issue a warning and return NULL. + \note Scene queries set the value of PxQueryHit::faceIndex to 0xFFFFffff whenever it is undefined or does not apply. + + @see PxMaterial getNbMaterials() PxMaterial::release() + */ + virtual PxBaseMaterial* getMaterialFromInternalFaceIndex(PxU32 faceIndex) const = 0; + + /** + \brief 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. + + \param[in] contactOffset Range: [maximum(0,restOffset), PX_MAX_F32) + + @see getContactOffset PxTolerancesScale setRestOffset + */ + virtual void setContactOffset(PxReal contactOffset) = 0; + + /** + \brief Retrieves the contact offset. + + \return The contact offset of the shape. + + @see setContactOffset() + */ + virtual PxReal getContactOffset() const = 0; + + /** + \brief 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. + + \param[in] restOffset Range: (-PX_MAX_F32, contactOffset) + + @see getRestOffset setContactOffset + */ + virtual void setRestOffset(PxReal restOffset) = 0; + + /** + \brief Retrieves the rest offset. + + \return The rest offset of the shape. + + @see setRestOffset() + */ + virtual PxReal getRestOffset() const = 0; + + /** + \brief 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 + + \param[in] densityForFluid Range: (0, PX_MAX_F32) + + @see getDensityForFluid + */ + virtual void setDensityForFluid(PxReal densityForFluid) = 0; + + /** + \brief Retrieves the density used to interact with fluids. + + \return The density of the body when interacting with fluid. + + @see setDensityForFluid() + */ + virtual PxReal getDensityForFluid() const = 0; + + /** + \brief 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 + + \param[in] radius Range: (0, PX_MAX_F32) + */ + virtual void setTorsionalPatchRadius(PxReal radius) = 0; + + /** + \brief 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. + + \return The torsional patch radius of the shape. + */ + virtual PxReal getTorsionalPatchRadius() const = 0; + + /** + \brief 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 + + \param[in] radius Range: (0, PX_MAX_F32) + */ + virtual void setMinTorsionalPatchRadius(PxReal radius) = 0; + + /** + \brief 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. + + \return The minimum torsional patch radius of the shape. + */ + virtual PxReal getMinTorsionalPatchRadius() const = 0; + +/************************************************************************************************/ + + /** + \brief Sets shape flags + + Sleeping: Does NOT wake the associated actor up automatically. + + \param[in] flag The shape flag to enable/disable. See #PxShapeFlag. + \param[in] value True to set the flag. False to clear the flag specified in flag. + + Default: PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eSCENE_QUERY_SHAPE + + @see PxShapeFlag getFlags() + */ + virtual void setFlag(PxShapeFlag::Enum flag, bool value) = 0; + + /** + \brief Sets shape flags + + @see PxShapeFlag getFlags() + */ + virtual void setFlags(PxShapeFlags inFlags) = 0; + + /** + \brief Retrieves shape flags. + + \return The values of the shape flags. + + @see PxShapeFlag setFlag() + */ + virtual PxShapeFlags getFlags() const = 0; + + /** + \brief Returns true if the shape is exclusive to an actor. + + @see PxPhysics::createShape() + */ + virtual bool isExclusive() const = 0; + + /** + \brief 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 + + \param[in] name The name string to set the objects name to. + + @see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief retrieves the name string set with setName(). + \return The name associated with the shape. + + @see setName() + */ + virtual const char* getName() const = 0; + + + virtual const char* getConcreteTypeName() const { return "PxShape"; } + +/************************************************************************************************/ + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + +protected: + PX_INLINE PxShape(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + PX_INLINE PxShape(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags), userData(NULL) {} + virtual ~PxShape() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxShape", name) || PxRefCounted::isKindOf(name); } + + template + PX_FORCE_INLINE bool getGeometryT(PxGeometryType::Enum type, T& geom) const + { + if(getGeometryType() != type) + return false; + + geom = static_cast(getGeometry()); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationEventCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationEventCallback.h new file mode 100644 index 0000000..5c4cb18 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationEventCallback.h @@ -0,0 +1,909 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMULATION_EVENT_CALLBACK_H +#define PX_SIMULATION_EVENT_CALLBACK_H +/** \addtogroup physics +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMemory.h" +#include "PxPhysXConfig.h" +#include "PxFiltering.h" +#include "PxContact.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxShape; +class PxActor; +class PxRigidActor; +class PxRigidBody; +class PxConstraint; + + +/** +\brief Extra data item types for contact pairs. + +@see PxContactPairExtraDataItem.type +*/ +struct PxContactPairExtraDataType +{ + enum Enum + { + ePRE_SOLVER_VELOCITY, //!< see #PxContactPairVelocity + ePOST_SOLVER_VELOCITY, //!< see #PxContactPairVelocity + eCONTACT_EVENT_POSE, //!< see #PxContactPairPose + eCONTACT_PAIR_INDEX //!< see #PxContactPairIndex + }; +}; + + +/** +\brief Base class for items in the extra data stream of contact pairs + +@see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairExtraDataItem() {} + + /** + \brief The type of the extra data stream item + */ + PxU8 type; +}; + + +/** +\brief Velocities of the contact pair rigid bodies + +This struct is shared by multiple types of extra data items. The #type field allows to distinguish between them: +\li PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY: see #PxPairFlag::ePRE_SOLVER_VELOCITY +\li PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY: see #PxPairFlag::ePOST_SOLVER_VELOCITY + +\note For static rigid bodies, the velocities will be set to zero. + +@see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairVelocity : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairVelocity() {} + + /** + \brief The linear velocity of the rigid bodies + */ + PxVec3 linearVelocity[2]; + + /** + \brief The angular velocity of the rigid bodies + */ + PxVec3 angularVelocity[2]; +}; + + +/** +\brief World space actor poses of the contact pair rigid bodies + +@see PxContactPairHeader.extraDataStream PxPairFlag::eCONTACT_EVENT_POSE +*/ +struct PxContactPairPose : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairPose() {} + + /** + \brief The world space pose of the rigid bodies + */ + PxTransform globalPose[2]; +}; + + +/** +\brief Marker for the beginning of a new item set in the extra data stream. + +If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same +object multiple times. Also, different shapes of the same actor might gain and lose contact with an other +object over multiple passes. This marker allows to separate the extra data items for each collision case, as well as +distinguish the shape pair reports of different CCD passes. + +Example: +Let us assume that an actor a0 with shapes s0_0 and s0_1 hits another actor a1 with shape s1. +First s0_0 will hit s1, then a0 will slightly rotate and s0_1 will hit s1 while s0_0 will lose contact with s1. +Furthermore, let us say that contact event pose information is requested as extra data. +The extra data stream will look like this: + +PxContactPairIndexA | PxContactPairPoseA | PxContactPairIndexB | PxContactPairPoseB + +The corresponding array of PxContactPair events (see #PxSimulationEventCallback.onContact()) will look like this: + +PxContactPair(touch_found: s0_0, s1) | PxContactPair(touch_lost: s0_0, s1) | PxContactPair(touch_found: s0_1, s1) + +The #index of PxContactPairIndexA will point to the first entry in the PxContactPair array, for PxContactPairIndexB, +#index will point to the third entry. + +@see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairIndex : public PxContactPairExtraDataItem +{ +public: + PX_FORCE_INLINE PxContactPairIndex() {} + + /** + \brief The next item set in the extra data stream refers to the contact pairs starting at #index in the reported PxContactPair array. + */ + PxU16 index; +}; + + +/** +\brief A class to iterate over a contact pair extra data stream. + +@see PxContactPairHeader.extraDataStream +*/ +struct PxContactPairExtraDataIterator +{ + /** + \brief Constructor + \param[in] stream Pointer to the start of the stream. + \param[in] size Size of the stream in bytes. + */ + PX_FORCE_INLINE PxContactPairExtraDataIterator(const PxU8* stream, PxU32 size) + : currPtr(stream), endPtr(stream + size), contactPairIndex(0) + { + clearDataPtrs(); + } + + /** + \brief Advances the iterator to next set of extra data items. + + The contact pair extra data stream contains sets of items as requested by the corresponding #PxPairFlag flags + #PxPairFlag::ePRE_SOLVER_VELOCITY, #PxPairFlag::ePOST_SOLVER_VELOCITY, #PxPairFlag::eCONTACT_EVENT_POSE. A set can contain one + item of each plus the PxContactPairIndex item. This method parses the stream and points the iterator + member variables to the corresponding items of the current set, if they are available. If CCD is not enabled, + you should only get one set of items. If CCD with multiple passes is enabled, you might get more than one item + set. + + \note Even though contact pair extra data is requested per shape pair, you will not get an item set per shape pair + but one per actor pair. If, for example, an actor has two shapes and both collide with another actor, then + there will only be one item set (since it applies to both shape pairs). + + \return True if there was another set of extra data items in the stream, else false. + + @see PxContactPairVelocity PxContactPairPose PxContactPairIndex + */ + PX_INLINE bool nextItemSet() + { + clearDataPtrs(); + + bool foundEntry = false; + bool endOfItemSet = false; + while ((currPtr < endPtr) && (!endOfItemSet)) + { + const PxContactPairExtraDataItem* edItem = reinterpret_cast(currPtr); + PxU8 type = edItem->type; + + switch(type) + { + case PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY: + { + PX_ASSERT(!preSolverVelocity); + preSolverVelocity = static_cast(edItem); + currPtr += sizeof(PxContactPairVelocity); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY: + { + postSolverVelocity = static_cast(edItem); + currPtr += sizeof(PxContactPairVelocity); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::eCONTACT_EVENT_POSE: + { + eventPose = static_cast(edItem); + currPtr += sizeof(PxContactPairPose); + foundEntry = true; + } + break; + + case PxContactPairExtraDataType::eCONTACT_PAIR_INDEX: + { + if (!foundEntry) + { + contactPairIndex = static_cast(edItem)->index; + currPtr += sizeof(PxContactPairIndex); + foundEntry = true; + } + else + endOfItemSet = true; + } + break; + + default: + return foundEntry; + } + } + + return foundEntry; + } + +private: + /** + \brief Internal helper + */ + PX_FORCE_INLINE void clearDataPtrs() + { + preSolverVelocity = NULL; + postSolverVelocity = NULL; + eventPose = NULL; + } + +public: + /** + \brief Current pointer in the stream. + */ + const PxU8* currPtr; + + /** + \brief Pointer to the end of the stream. + */ + const PxU8* endPtr; + + /** + \brief Pointer to the current pre solver velocity item in the stream. NULL if there is none. + + @see PxContactPairVelocity + */ + const PxContactPairVelocity* preSolverVelocity; + + /** + \brief Pointer to the current post solver velocity item in the stream. NULL if there is none. + + @see PxContactPairVelocity + */ + const PxContactPairVelocity* postSolverVelocity; + + /** + \brief Pointer to the current contact event pose item in the stream. NULL if there is none. + + @see PxContactPairPose + */ + const PxContactPairPose* eventPose; + + /** + \brief The contact pair index of the current item set in the stream. + + @see PxContactPairIndex + */ + PxU32 contactPairIndex; +}; + + +/** +\brief Collection of flags providing information on contact report pairs. + +@see PxContactPairHeader +*/ +struct PxContactPairHeaderFlag +{ + enum Enum + { + eREMOVED_ACTOR_0 = (1<<0), //!< The actor with index 0 has been removed from the scene. + eREMOVED_ACTOR_1 = (1<<1) //!< The actor with index 1 has been removed from the scene. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxContactPairHeaderFlag. + +@see PxContactPairHeaderFlag +*/ +typedef PxFlags PxContactPairHeaderFlags; +PX_FLAGS_OPERATORS(PxContactPairHeaderFlag::Enum, PxU16) + + +/** +\brief An Instance of this class is passed to PxSimulationEventCallback.onContact(). + +@see PxSimulationEventCallback.onContact() +*/ +struct PxContactPairHeader +{ + public: + PX_INLINE PxContactPairHeader() {} + + /** + \brief The two actors of the notification shape pairs. + + \note The actor pointers might reference deleted actors. This will be the case if PxPairFlag::eNOTIFY_TOUCH_LOST + or PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST events were requested for the pair and one of the involved actors + gets deleted or removed from the scene. Check the #flags member to see whether that is the case. + Do not dereference a pointer to a deleted actor. The pointer to a deleted actor is only provided + such that user data structures which might depend on the pointer value can be updated. + + @see PxActor + */ + PxActor* actors[2]; + + /** + \brief Stream containing extra data as requested in the PxPairFlag flags of the simulation filter. + + This pointer is only valid if any kind of extra data information has been requested for the contact report pair (see #PxPairFlag::ePOST_SOLVER_VELOCITY etc.), + else it will be NULL. + + @see PxPairFlag + */ + const PxU8* extraDataStream; + + /** + \brief Size of the extra data stream [bytes] + */ + PxU16 extraDataStreamSize; + + /** + \brief Additional information on the contact report pair. + + @see PxContactPairHeaderFlag + */ + PxContactPairHeaderFlags flags; + + /** + \brief pointer to the contact pairs + */ + const struct PxContactPair* pairs; + + /** + \brief number of contact pairs + */ + PxU32 nbPairs; +}; + + +/** +\brief Collection of flags providing information on contact report pairs. + +@see PxContactPair +*/ +struct PxContactPairFlag +{ + enum Enum + { + /** + \brief The shape with index 0 has been removed from the actor/scene. + */ + eREMOVED_SHAPE_0 = (1<<0), + + /** + \brief The shape with index 1 has been removed from the actor/scene. + */ + eREMOVED_SHAPE_1 = (1<<1), + + /** + \brief First actor pair contact. + + The provided shape pair marks the first contact between the two actors, no other shape pair has been touching prior to the current simulation frame. + + \note: This info is only available if #PxPairFlag::eNOTIFY_TOUCH_FOUND has been declared for the pair. + */ + eACTOR_PAIR_HAS_FIRST_TOUCH = (1<<2), + + /** + \brief All contact between the actor pair was lost. + + All contact between the two actors has been lost, no shape pairs remain touching after the current simulation frame. + */ + eACTOR_PAIR_LOST_TOUCH = (1<<3), + + /** + \brief Internal flag, used by #PxContactPair.extractContacts() + + The applied contact impulses are provided for every contact point. + This is the case if #PxPairFlag::eSOLVE_CONTACT has been set for the pair. + */ + eINTERNAL_HAS_IMPULSES = (1<<4), + + /** + \brief Internal flag, used by #PxContactPair.extractContacts() + + The provided contact point information is flipped with regards to the shapes of the contact pair. This mainly concerns the order of the internal triangle indices. + */ + eINTERNAL_CONTACTS_ARE_FLIPPED = (1<<5) + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxContactPairFlag. + +@see PxContactPairFlag +*/ +typedef PxFlags PxContactPairFlags; +PX_FLAGS_OPERATORS(PxContactPairFlag::Enum, PxU16) + + +/** +\brief A contact point as used by contact notification +*/ +struct PxContactPairPoint +{ + /** + \brief The position of the contact point between the shapes, in world space. + */ + PxVec3 position; + + /** + \brief The separation of the shapes at the contact point. A negative separation denotes a penetration. + */ + PxReal separation; + + /** + \brief The normal of the contacting surfaces at the contact point. The normal direction points from the second shape to the first shape. + */ + PxVec3 normal; + + /** + \brief The surface index of shape 0 at the contact point. This is used to identify the surface material. + */ + PxU32 internalFaceIndex0; + + /** + \brief The impulse applied at the contact point, in world space. Divide by the simulation time step to get a force value. + */ + PxVec3 impulse; + + /** + \brief The surface index of shape 1 at the contact point. This is used to identify the surface material. + */ + PxU32 internalFaceIndex1; +}; + + +/** +\brief Contact report pair information. + +Instances of this class are passed to PxSimulationEventCallback.onContact(). If contact reports have been requested for a pair of shapes (see #PxPairFlag), +then the corresponding contact information will be provided through this structure. + +@see PxSimulationEventCallback.onContact() +*/ +struct PxContactPair +{ + public: + PX_INLINE PxContactPair() {} + + /** + \brief The two shapes that make up the pair. + + \note The shape pointers might reference deleted shapes. This will be the case if #PxPairFlag::eNOTIFY_TOUCH_LOST + or #PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST events were requested for the pair and one of the involved shapes + gets deleted. Check the #flags member to see whether that is the case. Do not dereference a pointer to a + deleted shape. The pointer to a deleted shape is only provided such that user data structures which might + depend on the pointer value can be updated. + + @see PxShape + */ + PxShape* shapes[2]; + + /** + \brief Pointer to first patch header in contact stream containing contact patch data + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxU8* contactPatches; + + /** + \brief Pointer to first contact point in contact stream containing contact data + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxU8* contactPoints; + + /** + \brief Buffer containing applied impulse data. + + This pointer is only valid if contact point information has been requested for the contact report pair (see #PxPairFlag::eNOTIFY_CONTACT_POINTS). + Use #extractContacts() as a reference for the data layout of the stream. + */ + const PxReal* contactImpulses; + + /** + \brief Size of the contact stream [bytes] including force buffer + */ + PxU32 requiredBufferSize; + + /** + \brief Number of contact points stored in the contact stream + */ + PxU8 contactCount; + + /** + \brief Number of contact patches stored in the contact stream + */ + + PxU8 patchCount; + + /** + \brief Size of the contact stream [bytes] not including force buffer + */ + + PxU16 contactStreamSize; + + /** + \brief Additional information on the contact report pair. + + @see PxContactPairFlag + */ + PxContactPairFlags flags; + + /** + \brief Flags raised due to the contact. + + The events field is a combination of: + +
    +
  • PxPairFlag::eNOTIFY_TOUCH_FOUND,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_PERSISTS,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_LOST,
  • +
  • PxPairFlag::eNOTIFY_TOUCH_CCD,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS,
  • +
  • PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST
  • +
+ + See the documentation of #PxPairFlag for an explanation of each. + + \note eNOTIFY_TOUCH_CCD can get raised even if the pair did not request this event. However, in such a case it will only get + raised in combination with one of the other flags to point out that the other event occured during a CCD pass. + + @see PxPairFlag + */ + PxPairFlags events; + + PxU32 internalData[2]; // For internal use only + + /** + \brief Extracts the contact points from the stream and stores them in a convenient format. + + \param[out] userBuffer Array of PxContactPairPoint structures to extract the contact points to. The number of contacts for a pair is defined by #contactCount + \param[in] bufferSize Number of PxContactPairPoint structures the provided buffer can store. + \return Number of contact points written to the buffer. + + @see PxContactPairPoint + */ + PX_INLINE PxU32 extractContacts(PxContactPairPoint* userBuffer, PxU32 bufferSize) const; + + /** + \brief Helper method to clone the contact pair and copy the contact data stream into a user buffer. + + The contact data stream is only accessible during the contact report callback. This helper function provides copy functionality + to buffer the contact stream information such that it can get accessed at a later stage. + + \param[out] newPair The contact pair info will get copied to this instance. The contact data stream pointer of the copy will be redirected to the provided user buffer. Use NULL to skip the contact pair copy operation. + \param[out] bufferMemory Memory block to store the contact data stream to. At most #requiredBufferSize bytes will get written to the buffer. + */ + PX_INLINE void bufferContacts(PxContactPair* newPair, PxU8* bufferMemory) const; + + PX_INLINE const PxU32* getInternalFaceIndices() const; +}; + + +PX_INLINE PxU32 PxContactPair::extractContacts(PxContactPairPoint* userBuffer, PxU32 bufferSize) const +{ + PxU32 nbContacts = 0; + + if(contactCount && bufferSize) + { + PxContactStreamIterator iter(contactPatches, contactPoints, getInternalFaceIndices(), patchCount, contactCount); + + const PxReal* impulses = contactImpulses; + + const PxU32 flippedContacts = (flags & PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED); + const PxU32 hasImpulses = (flags & PxContactPairFlag::eINTERNAL_HAS_IMPULSES); + + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + iter.nextContact(); + PxContactPairPoint& dst = userBuffer[nbContacts]; + dst.position = iter.getContactPoint(); + dst.separation = iter.getSeparation(); + dst.normal = iter.getContactNormal(); + if(!flippedContacts) + { + dst.internalFaceIndex0 = iter.getFaceIndex0(); + dst.internalFaceIndex1 = iter.getFaceIndex1(); + } + else + { + dst.internalFaceIndex0 = iter.getFaceIndex1(); + dst.internalFaceIndex1 = iter.getFaceIndex0(); + } + + if(hasImpulses) + { + const PxReal impulse = impulses[nbContacts]; + dst.impulse = dst.normal * impulse; + } + else + dst.impulse = PxVec3(0.0f); + ++nbContacts; + if(nbContacts == bufferSize) + return nbContacts; + } + } + } + + return nbContacts; +} + + +PX_INLINE void PxContactPair::bufferContacts(PxContactPair* newPair, PxU8* bufferMemory) const +{ + PxU8* patches = bufferMemory; + PxU8* contacts = NULL; + if(patches) + { + contacts = bufferMemory + patchCount * sizeof(PxContactPatch); + PxMemCopy(patches, contactPatches, sizeof(PxContactPatch)*patchCount); + PxMemCopy(contacts, contactPoints, contactStreamSize - (sizeof(PxContactPatch)*patchCount)); + } + + if(contactImpulses) + { + PxMemCopy(bufferMemory + ((contactStreamSize + 15) & (~15)), contactImpulses, sizeof(PxReal) * contactCount); + } + + if (newPair) + { + *newPair = *this; + newPair->contactPatches = patches; + newPair->contactPoints = contacts; + } +} + + +PX_INLINE const PxU32* PxContactPair::getInternalFaceIndices() const +{ + return reinterpret_cast(contactImpulses + contactCount); +} + +/** +\brief Collection of flags providing information on trigger report pairs. + +@see PxTriggerPair +*/ +struct PxTriggerPairFlag +{ + enum Enum + { + eREMOVED_SHAPE_TRIGGER = (1<<0), //!< The trigger shape has been removed from the actor/scene. + eREMOVED_SHAPE_OTHER = (1<<1), //!< The shape causing the trigger event has been removed from the actor/scene. + eNEXT_FREE = (1<<2) //!< For internal use only. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxTriggerPairFlag. + +@see PxTriggerPairFlag +*/ +typedef PxFlags PxTriggerPairFlags; +PX_FLAGS_OPERATORS(PxTriggerPairFlag::Enum, PxU8) + + +/** +\brief Descriptor for a trigger pair. + +An array of these structs gets passed to the PxSimulationEventCallback::onTrigger() report. + +\note The shape pointers might reference deleted shapes. This will be the case if #PxPairFlag::eNOTIFY_TOUCH_LOST + events were requested for the pair and one of the involved shapes gets deleted. Check the #flags member to see + whether that is the case. Do not dereference a pointer to a deleted shape. The pointer to a deleted shape is + only provided such that user data structures which might depend on the pointer value can be updated. + +@see PxSimulationEventCallback.onTrigger() +*/ +struct PxTriggerPair +{ + PX_INLINE PxTriggerPair() {} + + PxShape* triggerShape; //!< The shape that has been marked as a trigger. + PxActor* triggerActor; //!< The actor to which triggerShape is attached + PxShape* otherShape; //!< The shape causing the trigger event. \deprecated (see #PxSimulationEventCallback::onTrigger()) If collision between trigger shapes is enabled, then this member might point to a trigger shape as well. + PxActor* otherActor; //!< The actor to which otherShape is attached + PxPairFlag::Enum status; //!< Type of trigger event (eNOTIFY_TOUCH_FOUND or eNOTIFY_TOUCH_LOST). eNOTIFY_TOUCH_PERSISTS events are not supported. + PxTriggerPairFlags flags; //!< Additional information on the pair (see #PxTriggerPairFlag) +}; + + +/** +\brief Descriptor for a broken constraint. + +An array of these structs gets passed to the PxSimulationEventCallback::onConstraintBreak() report. + +@see PxConstraint PxSimulationEventCallback.onConstraintBreak() +*/ +struct PxConstraintInfo +{ + PX_INLINE PxConstraintInfo() {} + PX_INLINE PxConstraintInfo(PxConstraint* c, void* extRef, PxU32 t) : constraint(c), externalReference(extRef), type(t) {} + + PxConstraint* constraint; //!< The broken constraint. + void* externalReference; //!< The external object which owns the constraint (see #PxConstraintConnector::getExternalReference()) + PxU32 type; //!< Unique type ID of the external object. Allows to cast the provided external reference to the appropriate type +}; + + +/** +\brief An interface class that the user can implement in order to receive simulation events. + +With the exception of onAdvance(), the events get sent during the call to either #PxScene::fetchResults() or +#PxScene::flushSimulation() with sendPendingReports=true. onAdvance() gets called while the simulation +is running (that is between PxScene::simulate() or PxScene::advance() and PxScene::fetchResults()). + +\note SDK state should not be modified from within the callbacks. In particular objects should not +be created or destroyed. If state modification is needed then the changes should be stored to a buffer +and performed after the simulation step. + +Threading: With the exception of onAdvance(), it is not necessary to make these callbacks thread safe as +they will only be called in the context of the user thread. + +@see PxScene.setSimulationEventCallback() PxScene.getSimulationEventCallback() +*/ +class PxSimulationEventCallback + { + public: + /** + \brief This is called when a breakable constraint breaks. + + \note The user should not release the constraint shader inside this call! + + \note No event will get reported if the constraint breaks but gets deleted while the time step is still being simulated. + + \param[in] constraints - The constraints which have been broken. + \param[in] count - The number of constraints + + @see PxConstraint PxConstraintDesc.linearBreakForce PxConstraintDesc.angularBreakForce + */ + virtual void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) = 0; + + /** + \brief This is called with the actors which have just been woken up. + + \note Only supported by rigid bodies yet. + \note Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + \note Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + will get reported. For example, let us assume actor A is awake, then A->putToSleep() gets called, then later A->wakeUp() gets called. + At the next simulate/fetchResults() step only an onWake() event will get triggered because that was the last transition. + \note If an actor gets newly added to a scene with properties such that it is awake and the sleep state does not get changed by + the user or simulation, then an onWake() event will get sent at the next simulate/fetchResults() step. + + \param[in] actors - The actors which just woke up. + \param[in] count - The number of actors + + @see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag() + */ + virtual void onWake(PxActor** actors, PxU32 count) = 0; + + /** + \brief This is called with the actors which have just been put to sleep. + + \note Only supported by rigid bodies yet. + \note Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + \note Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + will get reported. For example, let us assume actor A is asleep, then A->wakeUp() gets called, then later A->putToSleep() gets called. + At the next simulate/fetchResults() step only an onSleep() event will get triggered because that was the last transition (assuming the simulation + does not wake the actor up). + \note If an actor gets newly added to a scene with properties such that it is asleep and the sleep state does not get changed by + the user or simulation, then an onSleep() event will get sent at the next simulate/fetchResults() step. + + \param[in] actors - The actors which have just been put to sleep. + \param[in] count - The number of actors + + @see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxActorFlag PxActor.setActorFlag() + */ + virtual void onSleep(PxActor** actors, PxU32 count) = 0; + + /** + \brief This is called when certain contact events occur. + + The method will be called for a pair of actors if one of the colliding shape pairs requested contact notification. + You request which events are reported using the filter shader/callback mechanism (see #PxSimulationFilterShader, + #PxSimulationFilterCallback, #PxPairFlag). + + Do not keep references to the passed objects, as they will be + invalid after this function returns. + + \param[in] pairHeader Information on the two actors whose shapes triggered a contact report. + \param[in] pairs The contact pairs of two actors for which contact reports have been requested. See #PxContactPair. + \param[in] nbPairs The number of provided contact pairs. + + @see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxContactPair PxPairFlag PxSimulationFilterShader PxSimulationFilterCallback + */ + virtual void onContact(const PxContactPairHeader& pairHeader, const PxContactPair* pairs, PxU32 nbPairs) = 0; + + /** + \brief This is called with the current trigger pair events. + + Shapes which have been marked as triggers using PxShapeFlag::eTRIGGER_SHAPE will send events + according to the pair flag specification in the filter shader (see #PxPairFlag, #PxSimulationFilterShader). + + \note Trigger shapes will no longer send notification events for interactions with other trigger shapes. + + \param[in] pairs - The trigger pair events. + \param[in] count - The number of trigger pair events. + + @see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxPairFlag PxSimulationFilterShader PxShapeFlag PxShape.setFlag() + */ + virtual void onTrigger(PxTriggerPair* pairs, PxU32 count) = 0; + + /** + \brief Provides early access to the new pose of moving rigid bodies. + + When this call occurs, rigid bodies having the #PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW + flag set, were moved by the simulation and their new poses can be accessed through the provided buffers. + + \note The provided buffers are valid and can be read until the next call to #PxScene::simulate() or #PxScene::collide(). + + \note This callback gets triggered while the simulation is running. If the provided rigid body references are used to + read properties of the object, then the callback has to guarantee no other thread is writing to the same body at the same + time. + + \note The code in this callback should be lightweight as it can block the simulation, that is, the + #PxScene::fetchResults() call. + + \param[in] bodyBuffer The rigid bodies that moved and requested early pose reporting. + \param[in] poseBuffer The integrated rigid body poses of the bodies listed in bodyBuffer. + \param[in] count The number of entries in the provided buffers. + + @see PxScene.setSimulationEventCallback() PxSceneDesc.simulationEventCallback PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW + */ + virtual void onAdvance(const PxRigidBody*const* bodyBuffer, const PxTransform* poseBuffer, const PxU32 count) = 0; + + virtual ~PxSimulationEventCallback() {} + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationStatistics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationStatistics.h new file mode 100644 index 0000000..2102ecd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSimulationStatistics.h @@ -0,0 +1,457 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMULATION_STATISTICS_H +#define PX_SIMULATION_STATISTICS_H +/** \addtogroup physics +@{ +*/ + +#include "foundation/PxAssert.h" +#include "PxPhysXConfig.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class used to retrieve statistics for a simulation step. + +@see PxScene::getSimulationStatistics() +*/ +class PxSimulationStatistics +{ +public: + + /** + \brief Different types of rigid body collision pair statistics. + @see getRbPairStats + */ + enum RbPairStatsType + { + /** + \brief Shape pairs processed as discrete contact pairs for the current simulation step. + */ + eDISCRETE_CONTACT_PAIRS, + + /** + \brief Shape pairs processed as swept integration pairs for the current simulation step. + + \note Counts the pairs for which special CCD (continuous collision detection) work was actually done and NOT the number of pairs which were configured for CCD. + Furthermore, there can be multiple CCD passes and all processed pairs of all passes are summed up, hence the number can be larger than the amount of pairs which have been configured for CCD. + + @see PxPairFlag::eDETECT_CCD_CONTACT, + */ + eCCD_PAIRS, + + /** + \brief Shape pairs processed with user contact modification enabled for the current simulation step. + + @see PxContactModifyCallback + */ + eMODIFIED_CONTACT_PAIRS, + + /** + \brief Trigger shape pairs processed for the current simulation step. + + @see PxShapeFlag::eTRIGGER_SHAPE + */ + eTRIGGER_PAIRS + }; + + +//objects: + /** + \brief Number of active PxConstraint objects (joints etc.) for the current simulation step. + */ + PxU32 nbActiveConstraints; + + /** + \brief Number of active dynamic bodies for the current simulation step. + + \note Does not include active kinematic bodies + */ + PxU32 nbActiveDynamicBodies; + + /** + \brief Number of active kinematic bodies for the current simulation step. + + \note Kinematic deactivation occurs at the end of the frame after the last call to PxRigidDynamic::setKinematicTarget() was called so kinematics that are + deactivated in a given frame will be included by this counter. + */ + PxU32 nbActiveKinematicBodies; + + /** + \brief Number of static bodies for the current simulation step. + */ + PxU32 nbStaticBodies; + + /** + \brief Number of dynamic bodies for the current simulation step. + + \note Includes inactive bodies and articulation links + \note Does not include kinematic bodies + */ + PxU32 nbDynamicBodies; + + /** + \brief Number of kinematic bodies for the current simulation step. + + \note Includes inactive bodies + */ + PxU32 nbKinematicBodies; + + /** + \brief Number of shapes of each geometry type. + */ + + PxU32 nbShapes[PxGeometryType::eGEOMETRY_COUNT]; + + /** + \brief Number of aggregates in the scene. + */ + PxU32 nbAggregates; + + /** + \brief Number of articulations in the scene. + */ + PxU32 nbArticulations; + +//solver: + /** + \brief The number of 1D axis constraints(joints+contact) present in the current simulation step. + */ + PxU32 nbAxisSolverConstraints; + + /** + \brief The size (in bytes) of the compressed contact stream in the current simulation step + */ + PxU32 compressedContactSize; + + /** + \brief The total required size (in bytes) of the contact constraints in the current simulation step + */ + PxU32 requiredContactConstraintMemory; + + /** + \brief The peak amount of memory (in bytes) that was allocated for constraints (this includes joints) in the current simulation step + */ + PxU32 peakConstraintMemory; + +//broadphase: + /** + \brief Get number of broadphase volumes added for the current simulation step. + + \return Number of broadphase volumes added. + */ + PX_FORCE_INLINE PxU32 getNbBroadPhaseAdds() const + { + return nbBroadPhaseAdds; + } + + /** + \brief Get number of broadphase volumes removed for the current simulation step. + + \return Number of broadphase volumes removed. + */ + PX_FORCE_INLINE PxU32 getNbBroadPhaseRemoves() const + { + return nbBroadPhaseRemoves; + } + +//collisions: + /** + \brief Get number of shape collision pairs of a certain type processed for the current simulation step. + + There is an entry for each geometry pair type. + + \note entry[i][j] = entry[j][i], hence, if you want the sum of all pair + types, you need to discard the symmetric entries + + \param[in] pairType The type of pair for which to get information + \param[in] g0 The geometry type of one pair object + \param[in] g1 The geometry type of the other pair object + \return Number of processed pairs of the specified geometry types. + */ + PxU32 getRbPairStats(RbPairStatsType pairType, PxGeometryType::Enum g0, PxGeometryType::Enum g1) const + { + PX_ASSERT_WITH_MESSAGE( (pairType >= eDISCRETE_CONTACT_PAIRS) && + (pairType <= eTRIGGER_PAIRS), + "Invalid pairType in PxSimulationStatistics::getRbPairStats"); + + if (g0 >= PxGeometryType::eGEOMETRY_COUNT || g1 >= PxGeometryType::eGEOMETRY_COUNT) + { + PX_ASSERT(false); + return 0; + } + + PxU32 nbPairs = 0; + switch(pairType) + { + case eDISCRETE_CONTACT_PAIRS: + nbPairs = nbDiscreteContactPairs[g0][g1]; + break; + case eCCD_PAIRS: + nbPairs = nbCCDPairs[g0][g1]; + break; + case eMODIFIED_CONTACT_PAIRS: + nbPairs = nbModifiedContactPairs[g0][g1]; + break; + case eTRIGGER_PAIRS: + nbPairs = nbTriggerPairs[g0][g1]; + break; + } + return nbPairs; + } + + /** + \brief Total number of (non CCD) pairs reaching narrow phase + */ + PxU32 nbDiscreteContactPairsTotal; + + /** + \brief Total number of (non CCD) pairs for which contacts are successfully cached (<=nbDiscreteContactPairsTotal) + \note This includes pairs for which no contacts are generated, it still counts as a cache hit. + */ + PxU32 nbDiscreteContactPairsWithCacheHits; + + /** + \brief Total number of (non CCD) pairs for which at least 1 contact was generated (<=nbDiscreteContactPairsTotal) + */ + PxU32 nbDiscreteContactPairsWithContacts; + + /** + \brief Number of new pairs found by BP this frame + */ + PxU32 nbNewPairs; + + /** + \brief Number of lost pairs from BP this frame + */ + PxU32 nbLostPairs; + + /** + \brief Number of new touches found by NP this frame + */ + PxU32 nbNewTouches; + + /** + \brief Number of lost touches from NP this frame + */ + PxU32 nbLostTouches; + + /** + \brief Number of partitions used by the solver this frame + */ + PxU32 nbPartitions; + + /** + \brief GPU device memory in bytes allocated for particle state accessible through API + */ + PxU64 gpuMemParticles; + + /** + \brief GPU device memory in bytes allocated for FEM-based soft body state accessible through API + */ + PxU64 gpuMemSoftBodies; + + /** + \brief GPU device memory in bytes allocated for FEM-based cloth state accessible through API + */ + PxU64 gpuMemFEMCloths; + + /** + \brief GPU device memory in bytes allocated for hairsystem state accessible through API + */ + PxU64 gpuMemHairSystems; + + /** + \brief GPU device memory in bytes allocated for internal heap allocation + */ + PxU64 gpuMemHeap; + + /** + \brief GPU device heap memory used for broad phase in bytes + */ + PxU64 gpuMemHeapBroadPhase; + + /** + \brief GPU device heap memory used for narrow phase in bytes + */ + PxU64 gpuMemHeapNarrowPhase; + + /** + \brief GPU device heap memory used for solver in bytes + */ + PxU64 gpuMemHeapSolver; + + /** + \brief GPU device heap memory used for articulations in bytes + */ + PxU64 gpuMemHeapArticulation; + + /** + \brief GPU device heap memory used for simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulation; + + /** + \brief GPU device heap memory used for articulations in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationArticulation; + + /** + \brief GPU device heap memory used for particles in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationParticles; + + /** + \brief GPU device heap memory used for soft bodies in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationSoftBody; + + /** + \brief GPU device heap memory used for FEM-cloth in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationFEMCloth; + + /** + \brief GPU device heap memory used for hairsystem in the simulation pipeline in bytes + */ + PxU64 gpuMemHeapSimulationHairSystem; + + /** + \brief GPU device heap memory used for shared buffers in the particles pipeline in bytes + */ + PxU64 gpuMemHeapParticles; + + /** + \brief GPU device heap memory used for shared buffers in the FEM-based soft body pipeline in bytes + */ + PxU64 gpuMemHeapSoftBodies; + + /** + \brief GPU device heap memory used for shared buffers in the FEM-based cloth pipeline in bytes + */ + PxU64 gpuMemHeapFEMCloths; + + /** + \brief GPU device heap memory used for shared buffers in the hairsystem pipeline in bytes + */ + PxU64 gpuMemHeapHairSystems; + + /** + \brief GPU device heap memory not covered by other stats in bytes + */ + PxU64 gpuMemHeapOther; + + PxSimulationStatistics() : + nbActiveConstraints (0), + nbActiveDynamicBodies (0), + nbActiveKinematicBodies (0), + nbStaticBodies (0), + nbDynamicBodies (0), + nbKinematicBodies (0), + nbAggregates (0), + nbArticulations (0), + nbAxisSolverConstraints (0), + compressedContactSize (0), + requiredContactConstraintMemory (0), + peakConstraintMemory (0), + nbDiscreteContactPairsTotal (0), + nbDiscreteContactPairsWithCacheHits (0), + nbDiscreteContactPairsWithContacts (0), + nbNewPairs (0), + nbLostPairs (0), + nbNewTouches (0), + nbLostTouches (0), + nbPartitions (0), + gpuMemParticles (0), + gpuMemSoftBodies (0), + gpuMemFEMCloths (0), + gpuMemHairSystems (0), + gpuMemHeap (0), + gpuMemHeapBroadPhase (0), + gpuMemHeapNarrowPhase (0), + gpuMemHeapSolver (0), + gpuMemHeapArticulation (0), + gpuMemHeapSimulation (0), + gpuMemHeapSimulationArticulation (0), + gpuMemHeapSimulationParticles (0), + gpuMemHeapSimulationSoftBody (0), + gpuMemHeapSimulationFEMCloth (0), + gpuMemHeapSimulationHairSystem (0), + gpuMemHeapParticles (0), + gpuMemHeapSoftBodies (0), + gpuMemHeapFEMCloths (0), + gpuMemHeapHairSystems (0), + gpuMemHeapOther (0) + { + nbBroadPhaseAdds = 0; + nbBroadPhaseRemoves = 0; + + for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++) + { + for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++) + { + nbDiscreteContactPairs[i][j] = 0; + nbModifiedContactPairs[i][j] = 0; + nbCCDPairs[i][j] = 0; + nbTriggerPairs[i][j] = 0; + } + } + + for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++) + { + nbShapes[i] = 0; + } + } + + + // + // We advise to not access these members directly. Use the provided accessor methods instead. + // +//broadphase: + PxU32 nbBroadPhaseAdds; + PxU32 nbBroadPhaseRemoves; + +//collisions: + PxU32 nbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 nbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBody.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBody.h new file mode 100644 index 0000000..b092c76 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBody.h @@ -0,0 +1,742 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SOFT_BODY_H +#define PX_SOFT_BODY_H +/** \addtogroup physics +@{ */ + +#include "PxFEMParameter.h" +#include "PxActor.h" +#include "PxConeLimitedConstraint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4435) +#endif + + class PxCudaContextManager; + class PxBuffer; + class PxTetrahedronMesh; + class PxSoftBodyAuxData; + class PxFEMCloth; + class PxParticleBuffer; + + /** + \brief The maximum tetrahedron index supported in the model. + */ + #define PX_MAX_TETID 0x000fffff + + /** + \brief Identifies input and output buffers for PxSoftBody. + + @see PxSoftBodyData::readData(), PxSoftBodyData::writeData(), PxBuffer. + */ + struct PxSoftBodyData + { + enum Enum + { + eNONE = 0, + + ePOSITION_INVMASS = 1 << 0, //!< Flag to request access to the collision mesh's positions; read only @see PxSoftBody::writeData + eSIM_POSITION_INVMASS = 1 << 2, //!< Flag to request access to the simulation mesh's positions and inverse masses + eSIM_VELOCITY = 1 << 3, //!< Flag to request access to the simulation mesh's velocities and inverse masses + eSIM_KINEMATIC_TARGET = 1 << 4, //!< Flag to request access to the simulation mesh's kinematic target position + + eALL = ePOSITION_INVMASS | eSIM_POSITION_INVMASS | eSIM_VELOCITY | eSIM_KINEMATIC_TARGET + }; + }; + + typedef PxFlags PxSoftBodyDataFlags; + + /** + \brief Flags to enable or disable special modes of a SoftBody + */ + struct PxSoftBodyFlag + { + enum Enum + { + eDISABLE_SELF_COLLISION = 1 << 0, //!< Determines if self collision will be detected and resolved + eCOMPUTE_STRESS_TENSOR = 1 << 1, //!< Enables computation of a Cauchy stress tensor for every tetrahedron in the simulation mesh. The tensors can be accessed through the softbody direct API + eENABLE_CCD = 1 << 2, //!< Enables support for continuous collision detection + eDISPLAY_SIM_MESH = 1 << 3, //!< Enable debug rendering to display the simulation mesh + eKINEMATIC = 1 << 4, //!< Enables support for kinematic motion of the collision and simulation mesh. + ePARTIALLY_KINEMATIC = 1 << 5 //!< Enables partially kinematic motion of the collisios and simulation mesh. + }; + }; + + typedef PxFlags PxSoftBodyFlags; + + /** + \brief Represents a FEM softbody including everything to calculate its definition like geometry and material properties + */ + class PX_DEPRECATED PxSoftBody : public PxActor + { + public: + + virtual ~PxSoftBody() {} + + /** + \brief Set a single softbody flag + + \param[in] flag The flag to set or clear + \param[in] val The new state of the flag + */ + virtual void setSoftBodyFlag(PxSoftBodyFlag::Enum flag, bool val) = 0; + + /** + \brief Set the softbody flags + + \param[in] flags The new softbody flags + */ + virtual void setSoftBodyFlags(PxSoftBodyFlags flags) = 0; + + /** + \brief Get the softbody flags + + \return The softbody flags + */ + virtual PxSoftBodyFlags getSoftBodyFlag() const = 0; + + /** + \brief Set parameter for FEM internal solve + + \param[in] parameters The FEM parameters + */ + virtual void setParameter(const PxFEMParameters parameters) = 0; + + /** + \brief Get parameter for FEM internal solve + + \return The FEM parameters + */ + virtual PxFEMParameters getParameter() const = 0; + + /** + \brief Issues a read command to the PxSoftBody. + + Read operations are scheduled and then flushed in PxScene::simulate(). + Read operations are known to be finished when PxBuffer::map() returns. + + PxSoftBodyData::ePOSITION_INVMASS, PxSoftBodyData::eSIM_POSITION_INVMASS and PxSoftBodyData::eSIM_VELOCITY can be read from the PxSoftBody. + + The softbody class offers internal cpu buffers that can be used to hold the data. The cpu buffers are accessible through getPositionInvMassCPU(), + getSimPositionInvMassCPU() and getSimVelocityInvMassCPU(). + + \param[in] flags Specifies which PxSoftBody data to read from. + \param[in] buffer Specifies buffer to which data is written to. + \param[in] flush If set to true the command gets executed immediately, otherwise it will get executed the next time copy commands are flushed. + + @see writeData(), PxBuffer, PxSoftBodyData + */ + virtual void readData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush = false) = 0; + + /** + \brief Issues a read command to the PxSoftBody. + + Read operations are scheduled and then flushed in PxScene::simulate(). + Read operations are known to be finished when PxBuffer::map() returns. + + PxSoftBodyData::ePOSITION_INVMASS, PxSoftBodyData::eSIM_POSITION_INVMASS and PxSoftBodyData::eSIM_VELOCITY can be read from the PxSoftBody. + + The data to read from the GPU is written to the corresponding cpu buffer that a softbody provides. Those cpu buffers are accessible through + getPositionInvMassCPU(), getSimPositionInvMassCPU() or getSimVelocityInvMassCPU(). + + \param[in] flags Specifies which PxSoftBody data to read from. + \param[in] flush If set to true the command gets executed immediately, otherwise it will get executed the next time copy commands are flushed. + + @see writeData(), PxSoftBodyData + */ + virtual void readData(PxSoftBodyData::Enum flags, bool flush = false) = 0; + + /** + \brief Issues a write command to the PxSoftBody. + + Write operations are scheduled and then flushed in PxScene::simulate(). + Write operations are known to be finished when PxScene::fetchResult() returns. + + PxSoftBodyData::eSIM_POSITION_INVMASS and PxSoftBodyData::eSIM_VELOCITY can be written to the PxSoftBody. PxSoftBodyData::ePOSITION_INVMASS is read only, + because the collision-mesh vertices are driven by the simulation-mesh vertices, which can be written to with PxSoftBodyData::eSIM_POSITION_INVMASS. + + The softbody class offers internal cpu buffers that can be used to hold the data. The cpu buffers are accessible through getPositionInvMassCPU(), + getSimPositionInvMassCPU() and getSimVelocityInvMassCPU(). Consider to use the PxSoftBodyExt::commit() extension method if all buffers should get written. + + \param[in] flags Specifies which PxSoftBody data to write to. + \param[in] buffer Specifies buffer from which data is read. + \param[in] flush If set to true the command gets executed immediately, otherwise it will get executed the next time copy commands are flushed. + + @see readData(), PxBuffer, PxSoftBodyData, PxSoftBodyExt::commit + */ + virtual void writeData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush = false) = 0; + + /** + \brief Issues a write command to the PxSoftBody. + + Write operations are scheduled and then flushed in PxScene::simulate(). + Write operations are known to be finished when PxScene::fetchResult() returns. + + PxSoftBodyData::eSIM_POSITION_INVMASS and PxSoftBodyData::eSIM_VELOCITY can be written to the PxSoftBody. PxSoftBodyData::ePOSITION_INVMASS is read only, + because the collision-mesh vertices are driven by the simulation-mesh vertices, which can be written to with PxSoftBodyData::eSIM_POSITION_INVMASS. + + The data to write to the GPU is taken from the corresponding cpu buffer that a softbody provides. Those cpu buffers are accessible through + getPositionInvMassCPU(), getSimPositionInvMassCPU() or getSimVelocityInvMassCPU(). + + \param[in] flags Specifies which PxSoftBody data to write to. + \param[in] flush If set to true the command gets executed immediately, otherwise it will get executed the next time copy commands are flushed. + + @see readData(), PxSoftBodyData + */ + virtual void writeData(PxSoftBodyData::Enum flags, bool flush = false) = 0; + + /** + \brief Return the cuda context manager + + \return The cuda context manager + */ + virtual PxCudaContextManager* getCudaContextManager() const = 0; + + /** + \brief Sets the wake counter for the soft body. + + The wake counter value determines the minimum amount of time until the soft body can be put to sleep. Please note + that a soft body will not be put to sleep if any vertex velocity is above the specified threshold + or if other awake objects are touching it. + + \note Passing in a positive value will wake the soft body up automatically. + + Default: 0.4 (which corresponds to 20 frames for a time step of 0.02) + + \param[in] wakeCounterValue Wake counter value. Range: [0, PX_MAX_F32) + + @see isSleeping() getWakeCounter() + */ + virtual void setWakeCounter(PxReal wakeCounterValue) = 0; + + /** + \brief Returns the wake counter of the soft body. + + \return The wake counter of the soft body. + + @see isSleeping() setWakeCounter() + */ + virtual PxReal getWakeCounter() const = 0; + + /** + \brief Returns true if this soft body is sleeping. + + When an actor does not move for a period of time, it is no longer simulated in order to save time. This state + is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + or a sleep-affecting property is changed by the user, the entire sleep mechanism should be transparent to the user. + + A soft body can only go to sleep if all vertices are ready for sleeping. A soft body is guaranteed to be awake + if at least one of the following holds: + + \li The wake counter is positive (@see setWakeCounter()). + \li The velocity of any vertex is above the sleep threshold. + + If a soft body is sleeping, the following state is guaranteed: + + \li The wake counter is zero. + \li The linear velocity of all vertices is zero. + + When a soft body gets inserted into a scene, it will be considered asleep if all the points above hold, else it will + be treated as awake. + + \note It is invalid to use this method if the soft body has not been added to a scene already. + + \return True if the soft body is sleeping. + + @see isSleeping() + */ + virtual bool isSleeping() const = 0; + + /** + \brief Sets the solver iteration counts for the body. + + The solver iteration count determines how accurately deformation and contacts are resolved. + If you are having trouble with softbodies that are not as stiff as they should be, then + setting a higher position iteration count may improve the behavior. + + If intersecting bodies are being depenetrated too violently, increase the number of velocity + iterations. + + Default: 4 position iterations, 1 velocity iteration + + \param[in] minPositionIters Minimal number of position iterations the solver should perform for this body. Range: [1,255] + \param[in] minVelocityIters Minimal number of velocity iterations the solver should perform for this body. Range: [1,255] + + @see getSolverIterationCounts() + */ + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0; + + /** + \brief Retrieves the solver iteration counts. + + @see setSolverIterationCounts() + */ + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0; + + + /** + \brief Retrieves the shape pointer belonging to the actor. + + \return Pointer to the collision mesh's shape + @see PxShape getNbShapes() PxShape::release() + */ + virtual PxShape* getShape() = 0; + + + /** + \brief Retrieve the collision mesh pointer. + + Allows to access the geometry of the tetrahedral mesh used to perform collision detection + + \return Pointer to the collision mesh + */ + virtual PxTetrahedronMesh* getCollisionMesh() = 0; + + /** + \brief Retrieves the simulation mesh pointer. + + Allows to access the geometry of the tetrahedral mesh used to compute the object's deformation + + \return Pointer to the simulation mesh + */ + virtual PxTetrahedronMesh* getSimulationMesh() = 0; + + /** + \brief Retrieves the simulation state pointer. + + Allows to access the additional data of the simulation mesh (inverse mass, rest state etc.). + The geometry part of the data is stored in the simulation mesh. + + \return Pointer to the simulation state + */ + virtual PxSoftBodyAuxData* getSoftBodyAuxData() = 0; + + + /** + \brief Attaches a shape + + Attaches the shape to use for collision detection + + \param[in] shape The shape to use for collisions + + \return Returns true if the operation was successful + */ + virtual bool attachShape(PxShape& shape) = 0; + + /** + \brief Attaches a simulation mesh + + Attaches the simulation mesh (geometry) and a state containing inverse mass, rest pose + etc. required to compute the softbody deformation. + + \param[in] simulationMesh The tetrahedral mesh used to compute the softbody's deformation + \param[in] softBodyAuxData A state that contain a mapping from simulation to collision mesh, volume information etc. + + \return Returns true if the operation was successful + */ + virtual bool attachSimulationMesh(PxTetrahedronMesh& simulationMesh, PxSoftBodyAuxData& softBodyAuxData) = 0; + + /** + \brief Detaches the shape + + Detaches the shape used for collision detection. + + @see void detachSimulationMesh() + */ + virtual void detachShape() = 0; + + /** + \brief Detaches the simulation mesh + + Detaches the simulation mesh and simulation state used to compute the softbody deformation. + + @see void detachShape() + */ + virtual void detachSimulationMesh() = 0; + + /** + \brief Releases the softbody + + Releases the softbody and frees its resources. + */ + virtual void release() = 0; + + /** + \brief Creates a collision filter between a particle and a tetrahedron in the soft body's collision mesh. + + \param[in] particlesystem The particle system used for the collision filter + \param[in] buffer The PxParticleBuffer to which the particle belongs to. + \param[in] particleId The particle whose collisions with the tetrahedron in the soft body are filtered. + \param[in] tetId The tetradedron in the soft body that is filtered. If tetId is PX_MAX_TETID, this particle will filter against all tetrahedra in this soft body + */ + virtual void addParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId) = 0; + + /** + \brief Removes a collision filter between a particle and a tetrahedron in the soft body's collision mesh. + + \param[in] particlesystem The particle system used for the collision filter + \param[in] buffer The PxParticleBuffer to which the particle belongs to. + \param[in] particleId The particle whose collisions with the tetrahedron in the soft body are filtered. + \param[in] tetId The tetrahedron in the soft body is filtered. + */ + virtual void removeParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId) = 0; + + /** + \brief Creates an attachment between a particle and a soft body. + Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the particle system does not. + + \param[in] particlesystem The particle system used for the attachment + \param[in] buffer The PxParticleBuffer to which the particle belongs to. + \param[in] particleId The particle that is attached to a tetrahedron in the soft body's collision mesh. + \param[in] tetId The tetrahedron in the soft body's collision mesh to attach the particle to. + \param[in] barycentric The barycentric coordinates of the particle attachment position with respect to the tetrahedron specified with tetId. + \return Returns a handle that identifies the attachment created. This handle can be used to release the attachment later + */ + virtual PxU32 addParticleAttachment(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId, const PxVec4& barycentric) = 0; + + + /** + \brief Removes an attachment between a particle and a soft body. + Be aware that destroying the particle system before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the particle system does not. + + \param[in] particlesystem The particle system used for the attachment + \param[in] handle Index that identifies the attachment. This handle gets returned by the addParticleAttachment when the attachment is created + */ + virtual void removeParticleAttachment(PxPBDParticleSystem* particlesystem, PxU32 handle) = 0; + + /** + \brief Creates a collision filter between a vertex in a soft body and a rigid body. + + \param[in] actor The rigid body actor used for the collision filter + \param[in] vertId The index of a vertex in the softbody's collision mesh whose collisions with the rigid body are filtered. + */ + virtual void addRigidFilter(PxRigidActor* actor, PxU32 vertId) = 0; + + /** + \brief Removes a collision filter between a vertex in a soft body and a rigid body. + + \param[in] actor The rigid body actor used for the collision filter + \param[in] vertId The index of a vertex in the softbody's collision mesh whose collisions with the rigid body are filtered. + */ + virtual void removeRigidFilter(PxRigidActor* actor, PxU32 vertId) = 0; + + /** + \brief Creates a rigid attachment between a soft body and a rigid body. + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the rigid body does not. + + This method attaches a vertex on the soft body collision mesh to the rigid body. + + \param[in] actor The rigid body actor used for the attachment + \param[in] vertId The index of a vertex in the softbody's collision mesh that gets attached to the rigid body. + \param[in] actorSpacePose The location of the attachment point expressed in the rigid body's coordinate system. + \param[in] constraint The user defined cone distance limit constraint to limit the movement between a vertex in the soft body and rigid body. + \return Returns a handle that identifies the attachment created. This handle can be used to relese the attachment later + */ + virtual PxU32 addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint = NULL) = 0; + + /** + \brief Releases a rigid attachment between a soft body and a rigid body. + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the rigid body does not. + + This method removes a previously-created attachment between a vertex of the soft body collision mesh and the rigid body. + + \param[in] actor The rigid body actor used for the attachment + \param[in] handle Index that identifies the attachment. This handle gets returned by the addRigidAttachment when the attachment is created + */ + virtual void removeRigidAttachment(PxRigidActor* actor, PxU32 handle) = 0; + + /** + \brief Creates collision filter between a tetrahedron in a soft body and a rigid body. + + \param[in] actor The rigid body actor used for collision filter + \param[in] tetIdx The index of a tetrahedron in the softbody's collision mesh whose collisions with the rigid body is filtered. + */ + virtual void addTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) = 0; + + /** + \brief Removes collision filter between a tetrahedron in a soft body and a rigid body. + + \param[in] actor The rigid body actor used for collision filter + \param[in] tetIdx The index of a tetrahedron in the softbody's collision mesh whose collisions with the rigid body is filtered. + */ + virtual void removeTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) = 0; + + /** + \brief Creates a rigid attachment between a soft body and a rigid body. + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the rigid body does not. + + This method attaches a point inside a tetrahedron of the collision to the rigid body. + + \param[in] actor The rigid body actor used for the attachment + \param[in] tetIdx The index of a tetrahedron in the softbody's collision mesh that contains the point to be attached to the rigid body + \param[in] barycentric The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx + \param[in] actorSpacePose The location of the attachment point expressed in the rigid body's coordinate system. + \param[in] constraint The user defined cone distance limit constraint to limit the movement between a tet and rigid body. + \return Returns a handle that identifies the attachment created. This handle can be used to release the attachment later + */ + virtual PxU32 addTetRigidAttachment(PxRigidActor* actor, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint = NULL) = 0; + + /** + \brief Creates collision filter between a tetrahedron in a soft body and a tetrahedron in another soft body. + + \param[in] otherSoftBody The other soft body actor used for collision filter + \param[in] otherTetIdx The index of the tetrahedron in the other softbody's collision mesh to be filtered. + \param[in] tetIdx1 The index of the tetrahedron in the softbody's collision mesh to be filtered. + */ + virtual void addSoftBodyFilter(PxSoftBody* otherSoftBody, PxU32 otherTetIdx, PxU32 tetIdx1) = 0; + + /** + \brief Removes collision filter between a tetrahedron in a soft body and a tetrahedron in other soft body. + + \param[in] otherSoftBody The other soft body actor used for collision filter + \param[in] otherTetIdx The index of the other tetrahedron in the other softbody's collision mesh whose collision with the tetrahedron with the soft body is filtered. + \param[in] tetIdx1 The index of the tetrahedron in the softbody's collision mesh whose collision with the other tetrahedron with the other soft body is filtered. + */ + virtual void removeSoftBodyFilter(PxSoftBody* otherSoftBody, PxU32 otherTetIdx, PxU32 tetIdx1) = 0; + + /** + \brief Creates collision filters between a tetrahedron in a soft body with another soft body. + + \param[in] otherSoftBody The other soft body actor used for collision filter + \param[in] otherTetIndices The indices of the tetrahedron in the other softbody's collision mesh to be filtered. + \param[in] tetIndices The indices of the tetrahedron of the softbody's collision mesh to be filtered. + \param[in] tetIndicesSize The size of tetIndices. + */ + virtual void addSoftBodyFilters(PxSoftBody* otherSoftBody, PxU32* otherTetIndices, PxU32* tetIndices, PxU32 tetIndicesSize) = 0; + + /** + \brief Removes collision filters between a tetrahedron in a soft body with another soft body. + + \param[in] otherSoftBody The other soft body actor used for collision filter + \param[in] otherTetIndices The indices of the tetrahedron in the other softbody's collision mesh to be filtered. + \param[in] tetIndices The indices of the tetrahedron of the softbody's collision mesh to be filtered. + \param[in] tetIndicesSize The size of tetIndices. + */ + virtual void removeSoftBodyFilters(PxSoftBody* otherSoftBody, PxU32* otherTetIndices, PxU32* tetIndices, PxU32 tetIndicesSize) = 0; + + /** + \brief Creates an attachment between two soft bodies. + + This method attaches a point inside a tetrahedron of the collision mesh to a point in another soft body's tetrahedron collision mesh. + + \param[in] softbody0 The soft body actor used for the attachment + \param[in] tetIdx0 The index of a tetrahedron in the other soft body that contains the point to be attached to the soft body + \param[in] tetBarycentric0 The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx0 + \param[in] tetIdx1 The index of a tetrahedron in the softbody's collision mesh that contains the point to be attached to the softbody0 + \param[in] tetBarycentric1 The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx1 + \param[in] constraint The user defined cone distance limit constraint to limit the movement between tets. + \return Returns a handle that identifies the attachment created. This handle can be used to release the attachment later + */ + virtual PxU32 addSoftBodyAttachment(PxSoftBody* softbody0, PxU32 tetIdx0, const PxVec4& tetBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint = NULL) = 0; + + /** + \brief Releases an attachment between a soft body and the other soft body. + Be aware that destroying the soft body before destroying the attachment is illegal and may cause a crash. + + This method removes a previously-created attachment between a point inside a tetrahedron of the collision mesh to a point in another soft body's tetrahedron collision mesh. + + \param[in] softbody0 The softbody actor used for the attachment. + \param[in] handle Index that identifies the attachment. This handle gets returned by the addSoftBodyAttachment when the attachment is created. + */ + virtual void removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle) = 0; + + /** + \brief Creates collision filter between a tetrahedron in a soft body and a triangle in a cloth. + \warning Feature under development, only for internal usage. + + \param[in] cloth The cloth actor used for collision filter + \param[in] triIdx The index of the triangle in the cloth mesh to be filtered. + \param[in] tetIdx The index of the tetrahedron in the softbody's collision mesh to be filtered. + */ + virtual void addClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx) = 0; + + /** + \brief Removes collision filter between a tetrahedron in a soft body and a triangle in a cloth. + \warning Feature under development, only for internal usage. + + \param[in] cloth The cloth actor used for collision filter + \param[in] triIdx The index of the triangle in the cloth mesh to be filtered. + \param[in] tetIdx The index of the tetrahedron in the softbody's collision mesh to be filtered. + */ + virtual void removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx) = 0; + + + /** + \brief Creates an attachment between a soft body and a cloth. + Be aware that destroying the rigid body before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the cloth does not. + + This method attaches a point inside a tetrahedron of the collision mesh to a cloth. + + \warning Feature under development, only for internal usage. + + \param[in] cloth The cloth actor used for the attachment + \param[in] triIdx The index of a triangle in the cloth mesh that contains the point to be attached to the soft body + \param[in] triBarycentric The barycentric coordinates of the attachment point inside the triangle specified by triangleIdx + \param[in] tetIdx The index of a tetrahedron in the softbody's collision mesh that contains the point to be attached to the cloth + \param[in] tetBarycentric The barycentric coordinates of the attachment point inside the tetrahedron specified by tetIdx + \param[in] constraint The user defined cone distance limit constraint to limit the movement between a triangle in the fem cloth and a tet in the soft body. + \return Returns a handle that identifies the attachment created. This handle can be used to release the attachment later + */ + virtual PxU32 addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, + PxConeLimitedConstraint* constraint = NULL) = 0; + + /** + \brief Releases an attachment between a cloth and a soft body. + Be aware that destroying the cloth before destroying the attachment is illegal and may cause a crash. + The soft body keeps track of these attachments but the cloth does not. + + This method removes a previously-created attachment between a point inside a collision mesh tetrahedron and a point inside a cloth mesh. + + \warning Feature under development, only for internal usage. + + \param[in] cloth The cloth actor used for the attachment + \param[in] handle Index that identifies the attachment. This handle gets returned by the addClothAttachment when the attachment is created + */ + virtual void removeClothAttachment(PxFEMCloth* cloth, PxU32 handle) = 0; + + /** + \brief Access to the vertices of the simulation mesh on the host + + Each element uses 4 float values containing position and inverseMass per vertex [x, y, z, inverseMass] + The inverse mass must match the inverse mass in the simVelocityCPU buffer at the same index. A copy of this value + is stored in the simVelocityCPU buffer to allow for faster access on the GPU. If the inverse masses in those two buffers + don't match, the simulation may produce wrong results + + Allows to access the CPU buffer of the simulation mesh's vertices + + \return The buffer that contains the simulation mesh's vertex positions (x, y, z) and the inverse mass as 4th component + */ + virtual PxBuffer* getSimPositionInvMassCPU() = 0; + + /** + \brief Access to the vertices of the simulation mesh on the host + + Each element uses 4 float values containing position and inverseMass per vertex [x, y, z, inverseMass] + The inverse mass must match the inverse mass in the simVelocityCPU buffer at the same index. A copy of this value + is stored in the simVelocityCPU buffer to allow for faster access on the GPU. If the inverse masses in those two buffers + don't match, the simulation may produce wrong results + + Allows to access the CPU buffer of the simulation mesh's vertices + + \return The buffer that contains the simulation mesh's vertex positions (x, y, z) and the inverse mass as 4th component + */ + virtual PxBuffer* getKinematicTargetCPU() = 0; + /** + \brief Access to the velocities of the simulation mesh on the host + + Each element uses 4 float values containing velocity and inverseMass per vertex [x, y, z, inverseMass] + The inverse mass must match the inverse mass in the simPositionInvMassCPU buffer at the same index. A copy of this value + is stored in the simPositionInvMassCPU buffer to allow for faster access on the GPU. If the inverse masses in those two buffers + don't match, the simulation may produce wrong results + + Allows to access the CPU buffer of the simulation mesh's vertices + + \return The buffer that contains the simulation mesh's velocities (x, y, z) and the inverse mass as 4th component + */ + virtual PxBuffer* getSimVelocityInvMassCPU() = 0; + + /** + \brief Access to the vertices of the collision mesh on the host + + Each element uses 4 float values containing position and inverseMass per vertex [x, y, z, inverseMass] + The inverse mass on the collision mesh has no effect, it can be set to an arbitrary value. + + Allows to access the CPU buffer of the collision mesh's vertices + + \return The buffer that contains the collision mesh's vertex positions (x, y, z) and the inverse mass as 4th component + */ + virtual PxBuffer* getPositionInvMassCPU() = 0; + + /** + \brief Access to the rest vertices of the collision mesh on the host + + Each element uses 4 float values containing position and inverseMass per vertex [x, y, z, inverseMass] + The inverse mass on the collision mesh has no effect, it can be set to an arbitrary value. + + Allows to access the CPU buffer of the collision mesh's rest vertices + + \return The buffer that contains the collision mesh's rest vertex positions (x, y, z) and the inverse mass as 4th component + */ + virtual PxBuffer* getRestPositionInvMassCPU() = 0; + + /** + \brief Retrieves the axis aligned bounding box enclosing the soft body. + + \note It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + in PxContactModifyCallback or in contact report callbacks). + + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + \return The soft body's bounding box. + + @see PxBounds3 + */ + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const = 0; + + /** + \brief Returns the GPU soft body index. + + \return The GPU index, or 0xFFFFFFFF if the soft body is not in a scene. + */ + virtual PxU32 getGpuSoftBodyIndex() = 0; + + virtual const char* getConcreteTypeName() const PX_OVERRIDE { return "PxSoftBody"; } + + + protected: + PX_INLINE PxSoftBody(PxType concreteType, PxBaseFlags baseFlags) : PxActor(concreteType, baseFlags) {} + PX_INLINE PxSoftBody(PxBaseFlags baseFlags) : PxActor(baseFlags) {} + virtual bool isKindOf(const char* name) const PX_OVERRIDE { return !::strcmp("PxSoftBody", name) || PxActor::isKindOf(name); } + }; + +#if PX_VC +#pragma warning(pop) +#endif + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBodyFlag.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBodyFlag.h new file mode 100644 index 0000000..ce19e5d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSoftBodyFlag.h @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SOFT_BODY_FLAG_H +#define PX_SOFT_BODY_FLAG_H + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief These flags determine what data is read or written to the gpu softbody. + + @see PxScene::copySoftBodyData, PxScene::applySoftBodyData + */ + class PxSoftBodyDataFlag + { + public: + enum Enum + { + eTET_INDICES = 0, //!< The collision mesh tetrahedron indices (quadruples of int32) + eTET_STRESS = 1, //!< The collision mesh cauchy stress tensors (float 3x3 matrices) + eTET_STRESSCOEFF = 2, //!< The collision mesh tetrahedron von Mises stress (float scalar) + eTET_REST_POSES = 3, //!< The collision mesh tetrahedron rest poses (float 3x3 matrices) + eTET_ROTATIONS = 4, //!< The collision mesh tetrahedron orientations (quaternions, quadruples of float) + eTET_POSITION_INV_MASS = 5, //!< The collision mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + eSIM_TET_INDICES = 6, //!< The simulation mesh tetrahedron indices (quadruples of int32) + eSIM_VELOCITY_INV_MASS = 7, //!< The simulation mesh vertex velocities and their inverted mass in the 4th component (quadruples of float) + eSIM_POSITION_INV_MASS = 8, //!< The simulation mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + eSIM_KINEMATIC_TARGET = 9 //!< The simulation mesh kinematic target positions + }; + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxSparseGridParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSparseGridParams.h new file mode 100644 index 0000000..c836804 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxSparseGridParams.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SPARSE_GRID_PARAMS_H +#define PX_SPARSE_GRID_PARAMS_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Parameters to define the sparse grid settings like grid spacing, maximal number of subgrids etc. + */ + struct PxSparseGridParams + { + /** + \brief Default constructor. + */ + PX_INLINE PxSparseGridParams() + { + maxNumSubgrids = 512; + subgridSizeX = 32; + subgridSizeY = 32; + subgridSizeZ = 32; + gridSpacing = 0.2f; + haloSize = 1; + } + + /** + \brief Copy constructor. + */ + PX_CUDA_CALLABLE PX_INLINE PxSparseGridParams(const PxSparseGridParams& params) + { + maxNumSubgrids = params.maxNumSubgrids; + subgridSizeX = params.subgridSizeX; + subgridSizeY = params.subgridSizeY; + subgridSizeZ = params.subgridSizeZ; + gridSpacing = params.gridSpacing; + haloSize = params.haloSize; + } + + PX_CUDA_CALLABLE PX_INLINE PxU32 getNumCellsPerSubgrid() const + { + return subgridSizeX * subgridSizeY * subgridSizeZ; + } + + PX_CUDA_CALLABLE PX_INLINE PxReal getSqrt3dx() const + { + return PxSqrt(3.0f) * gridSpacing; + } + + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault() + { + *this = PxSparseGridParams(); + } + + /** + \brief Assignment operator + */ + PX_INLINE void operator = (const PxSparseGridParams& params) + { + maxNumSubgrids = params.maxNumSubgrids; + subgridSizeX = params.subgridSizeX; + subgridSizeY = params.subgridSizeY; + subgridSizeZ = params.subgridSizeZ; + gridSpacing = params.gridSpacing; + haloSize = params.haloSize; + } + + PxU32 maxNumSubgrids; //!< Maximum number of subgrids + PxReal gridSpacing; //!< Grid spacing for the grid + PxU16 subgridSizeX; //!< Subgrid resolution in x dimension (must be an even number) + PxU16 subgridSizeY; //!< Subgrid resolution in y dimension (must be an even number) + PxU16 subgridSizeZ; //!< Subgrid resolution in z dimension (must be an even number) + PxU16 haloSize; //!< Number of halo cell layers around every subgrid cell. Only 0 and 1 are valid values + }; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/PxVisualizationParameter.h b/modules/PhysX/physx/physx-sys/physx/physx/include/PxVisualizationParameter.h new file mode 100644 index 0000000..175f3f0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/PxVisualizationParameter.h @@ -0,0 +1,253 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VISUALIZATION_PARAMETER_H +#define PX_VISUALIZATION_PARAMETER_H + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup physics +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/* +NOTE: Parameters should NOT be conditionally compiled out. Even if a particular feature is not available. +Otherwise the parameter values get shifted about and the numeric values change per platform. This causes problems +when trying to serialize parameters. + +New parameters should also be added to the end of the list for this reason. Also make sure to update +eNUM_VALUES, which should be one higher than the maximum value in the enum. +*/ + +/** +\brief Debug visualization parameters. + +#PxVisualizationParameter::eSCALE is the master switch for enabling visualization, please read the corresponding documentation +for further details. + +@see PxScene.setVisualizationParameter() PxScene.getVisualizationParameter() PxScene.getRenderBuffer() +*/ +struct PxVisualizationParameter +{ + enum Enum + { + /* RigidBody-related parameters */ + + /** + \brief This overall visualization scale gets multiplied with the individual scales. Setting to zero ignores all visualizations. Default is 0. + + The below settings permit the debug visualization of various simulation properties. + The setting is either zero, in which case the property is not drawn. Otherwise it is a scaling factor + that determines the size of the visualization widgets. + + Only objects for which visualization is turned on using setFlag(eVISUALIZATION) are visualized (see #PxActorFlag::eVISUALIZATION, #PxShapeFlag::eVISUALIZATION, ...). + Contacts are visualized if they involve a body which is being visualized. + Default is 0. + + Notes: + - to see any visualization, you have to set PxVisualizationParameter::eSCALE to nonzero first. + - the scale factor has been introduced because it's difficult (if not impossible) to come up with a + good scale for 3D vectors. Normals are normalized and their length is always 1. But it doesn't mean + we should render a line of length 1. Depending on your objects/scene, this might be completely invisible + or extremely huge. That's why the scale factor is here, to let you tune the length until it's ok in + your scene. + - however, things like collision shapes aren't ambiguous. They are clearly defined for example by the + triangles & polygons themselves, and there's no point in scaling that. So the visualization widgets + are only scaled when it makes sense. + + Range: [0, PX_MAX_F32)
+ Default: 0 + */ + eSCALE, + + /** + \brief Visualize the world axes. + */ + eWORLD_AXES, + + /* Body visualizations */ + + /** + \brief Visualize a bodies axes. + + @see PxActor.globalPose PxActor + */ + eBODY_AXES, + + /** + \brief Visualize a body's mass axes. + + This visualization is also useful for visualizing the sleep state of bodies. Sleeping bodies are drawn in + black, while awake bodies are drawn in white. If the body is sleeping and part of a sleeping group, it is + drawn in red. + + @see PxBodyDesc.massLocalPose PxActor + */ + eBODY_MASS_AXES, + + /** + \brief Visualize the bodies linear velocity. + + @see PxBodyDesc.linearVelocity PxActor + */ + eBODY_LIN_VELOCITY, + + /** + \brief Visualize the bodies angular velocity. + + @see PxBodyDesc.angularVelocity PxActor + */ + eBODY_ANG_VELOCITY, + + /* Contact visualisations */ + + /** + \brief Visualize contact points. Will enable contact information. + */ + eCONTACT_POINT, + + /** + \brief Visualize contact normals. Will enable contact information. + */ + eCONTACT_NORMAL, + + /** + \brief Visualize contact errors. Will enable contact information. + */ + eCONTACT_ERROR, + + /** + \brief Visualize Contact forces. Will enable contact information. + */ + eCONTACT_FORCE, + + /** + \brief Visualize actor axes. + + @see PxRigidStatic PxRigidDynamic PxArticulationLink + */ + eACTOR_AXES, + + /** + \brief Visualize bounds (AABBs in world space) + */ + eCOLLISION_AABBS, + + /** + \brief Shape visualization + + @see PxShape + */ + eCOLLISION_SHAPES, + + /** + \brief Shape axis visualization + + @see PxShape + */ + eCOLLISION_AXES, + + /** + \brief Compound visualization (compound AABBs in world space) + */ + eCOLLISION_COMPOUNDS, + + /** + \brief Mesh & convex face normals + + @see PxTriangleMesh PxConvexMesh + */ + eCOLLISION_FNORMALS, + + /** + \brief Active edges for meshes + + @see PxTriangleMesh + */ + eCOLLISION_EDGES, + + /** + \brief Static pruning structures + */ + eCOLLISION_STATIC, + + /** + \brief Dynamic pruning structures + */ + eCOLLISION_DYNAMIC, + + /** + \brief Joint local axes + */ + eJOINT_LOCAL_FRAMES, + + /** + \brief Joint limits + */ + eJOINT_LIMITS, + + /** + \brief Visualize culling box + */ + eCULL_BOX, + + /** + \brief MBP regions + */ + eMBP_REGIONS, + + /** + \brief Renders the simulation mesh instead of the collision mesh (only available for tetmeshes) + */ + eSIMULATION_MESH, + + /** + \brief Renders the SDF of a mesh instead of the collision mesh (only available for triangle meshes with SDFs) + */ + eSDF, + + /** + \brief This is not a parameter, it just records the current number of parameters (as maximum(PxVisualizationParameter)+1) for use in loops. + */ + eNUM_VALUES, + + eFORCE_DWORD = 0x7fffffff + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxBoxController.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxBoxController.h new file mode 100644 index 0000000..5ba8e54 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxBoxController.h @@ -0,0 +1,227 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BOX_CONTROLLER_H +#define PX_BOX_CONTROLLER_H +/** \addtogroup character + @{ +*/ + +#include "characterkinematic/PxController.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\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 + + Default: 1.0 + */ + PxF32 halfHeight; // Half-height in the "up" direction + + /** + \brief Half side extent + + Default: 0.5 + */ + PxF32 halfSideExtent; // Half-extent in the "side" direction + + /** + \brief Half forward extent + + Default: 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; +} + +/** +\brief Box character controller. + +@see PxBoxControllerDesc PxController +*/ +class PxBoxController : public PxController +{ +public: + + /** + \brief Gets controller's half height. + + \return The half height of the controller. + + @see PxBoxControllerDesc.halfHeight setHalfHeight() + */ + virtual PxF32 getHalfHeight() const = 0; + + /** + \brief Gets controller's half side extent. + + \return The half side extent of the controller. + + @see PxBoxControllerDesc.halfSideExtent setHalfSideExtent() + */ + virtual PxF32 getHalfSideExtent() const = 0; + + /** + \brief Gets controller's half forward extent. + + \return The half forward extent of the controller. + + @see PxBoxControllerDesc.halfForwardExtent setHalfForwardExtent() + */ + virtual PxF32 getHalfForwardExtent() const = 0; + + /** + \brief Sets controller's half height. + + \warning this doesn't check for collisions. + + \param[in] halfHeight The new half height for the controller. + \return Currently always true. + + @see PxBoxControllerDesc.halfHeight getHalfHeight() + */ + virtual bool setHalfHeight(PxF32 halfHeight) = 0; + + /** + \brief Sets controller's half side extent. + + \warning this doesn't check for collisions. + + \param[in] halfSideExtent The new half side extent for the controller. + \return Currently always true. + + @see PxBoxControllerDesc.halfSideExtent getHalfSideExtent() + */ + virtual bool setHalfSideExtent(PxF32 halfSideExtent) = 0; + + /** + \brief Sets controller's half forward extent. + + \warning this doesn't check for collisions. + + \param[in] halfForwardExtent The new half forward extent for the controller. + \return Currently always true. + + @see PxBoxControllerDesc.halfForwardExtent getHalfForwardExtent() + */ + virtual bool setHalfForwardExtent(PxF32 halfForwardExtent) = 0; + +protected: + PX_INLINE PxBoxController() {} + virtual ~PxBoxController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxCapsuleController.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxCapsuleController.h new file mode 100644 index 0000000..28e4e1e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxCapsuleController.h @@ -0,0 +1,248 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CAPSULE_CONTROLLER_H +#define PX_CAPSULE_CONTROLLER_H +/** \addtogroup character + @{ +*/ + +#include "characterkinematic/PxController.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCapsuleClimbingMode +{ + enum Enum + { + eEASY, //!< Standard mode, let the capsule climb over surfaces according to impact normal + eCONSTRAINED, //!< Constrained mode, try to limit climbing according to the step offset + + eLAST + }; +}; + +/** +\brief A descriptor for a capsule character controller. + +@see PxCapsuleController PxControllerDesc +*/ +class PxCapsuleControllerDesc : public PxControllerDesc +{ +public: + /** + \brief constructor sets to default. + */ + PX_INLINE PxCapsuleControllerDesc (); + PX_INLINE virtual ~PxCapsuleControllerDesc () {} + + /** + \brief copy constructor. + */ + PX_INLINE PxCapsuleControllerDesc(const PxCapsuleControllerDesc&); + + /** + \brief assignment operator. + */ + PX_INLINE PxCapsuleControllerDesc& operator=(const PxCapsuleControllerDesc&); + + /** + \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 The radius of the capsule + + Default: 0.0 + + @see PxCapsuleController + */ + PxF32 radius; + + /** + \brief The height of the controller + + Default: 0.0 + + @see PxCapsuleController + */ + PxF32 height; + + /** + \brief The climbing mode + + Default: PxCapsuleClimbingMode::eEASY + + @see PxCapsuleController + */ + PxCapsuleClimbingMode::Enum climbingMode; + +protected: + PX_INLINE void copy(const PxCapsuleControllerDesc&); +}; + +PX_INLINE PxCapsuleControllerDesc::PxCapsuleControllerDesc () : PxControllerDesc(PxControllerShapeType::eCAPSULE) +{ + radius = height = 0.0f; + climbingMode = PxCapsuleClimbingMode::eEASY; +} + +PX_INLINE PxCapsuleControllerDesc::PxCapsuleControllerDesc(const PxCapsuleControllerDesc& other) : PxControllerDesc(other) +{ + copy(other); +} + +PX_INLINE PxCapsuleControllerDesc& PxCapsuleControllerDesc::operator=(const PxCapsuleControllerDesc& other) +{ + PxControllerDesc::operator=(other); + copy(other); + return *this; +} + +PX_INLINE void PxCapsuleControllerDesc::copy(const PxCapsuleControllerDesc& other) +{ + radius = other.radius; + height = other.height; + climbingMode = other.climbingMode; +} + +PX_INLINE void PxCapsuleControllerDesc::setToDefault() +{ + *this = PxCapsuleControllerDesc(); +} + +PX_INLINE bool PxCapsuleControllerDesc::isValid() const +{ + if(!PxControllerDesc::isValid()) return false; + if(radius<=0.0f) return false; + if(height<=0.0f) return false; + if(stepOffset>height+radius*2.0f) return false; // Prevents obvious mistakes + return true; +} +/** +\brief A capsule character controller. + +The capsule is defined as a position, a vertical height, and a radius. +The height is the distance between the two sphere centers at the end of the capsule. +In other words: + +p = pos (returned by controller)
+h = height
+r = radius
+ +p = center of capsule
+top sphere center = p.y + h*0.5
+bottom sphere center = p.y - h*0.5
+top capsule point = p.y + h*0.5 + r
+bottom capsule point = p.y - h*0.5 - r
+*/ +class PxCapsuleController : public PxController +{ +public: + + /** + \brief Gets controller's radius. + + \return The radius of the controller. + + @see PxCapsuleControllerDesc.radius setRadius() + */ + virtual PxF32 getRadius() const = 0; + + /** + \brief Sets controller's radius. + + \warning this doesn't check for collisions. + + \param[in] radius The new radius for the controller. + \return Currently always true. + + @see PxCapsuleControllerDesc.radius getRadius() + */ + virtual bool setRadius(PxF32 radius) = 0; + + /** + \brief Gets controller's height. + + \return The height of the capsule controller. + + @see PxCapsuleControllerDesc.height setHeight() + */ + virtual PxF32 getHeight() const = 0; + + /** + \brief Resets controller's height. + + \warning this doesn't check for collisions. + + \param[in] height The new height for the controller. + \return Currently always true. + + @see PxCapsuleControllerDesc.height getHeight() + */ + virtual bool setHeight(PxF32 height) = 0; + + /** + \brief Gets controller's climbing mode. + + \return The capsule controller's climbing mode. + + @see PxCapsuleControllerDesc.climbingMode setClimbingMode() + */ + virtual PxCapsuleClimbingMode::Enum getClimbingMode() const = 0; + + /** + \brief Sets controller's climbing mode. + + \param[in] mode The capsule controller's climbing mode. + + @see PxCapsuleControllerDesc.climbingMode getClimbingMode() + */ + virtual bool setClimbingMode(PxCapsuleClimbingMode::Enum mode) = 0; + +protected: + PX_INLINE PxCapsuleController() {} + virtual ~PxCapsuleController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxController.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxController.h new file mode 100644 index 0000000..ee64b3d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxController.h @@ -0,0 +1,925 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTROLLER_H +#define PX_CONTROLLER_H +/** \addtogroup character + @{ +*/ + +#include "characterkinematic/PxExtended.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "PxQueryFiltering.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief The type of controller, eg box, sphere or capsule. +*/ +struct PxControllerShapeType +{ + enum Enum + { + /** + \brief A box controller. + + @see PxBoxController PxBoxControllerDesc + */ + eBOX, + + /** + \brief A capsule controller + + @see PxCapsuleController PxCapsuleControllerDesc + */ + eCAPSULE, + + eFORCE_DWORD = 0x7fffffff + }; +}; + +class PxShape; +class PxScene; +class PxController; +class PxRigidDynamic; +class PxMaterial; +struct PxFilterData; +class PxQueryFilterCallback; +class PxControllerBehaviorCallback; +class PxObstacleContext; +class PxObstacle; + +/** +\brief specifies how a CCT interacts with non-walkable parts. + +This is only used when slopeLimit is non zero. It is currently enabled for static actors only, and not supported for spheres or capsules. +*/ +struct PxControllerNonWalkableMode +{ + enum Enum + { + ePREVENT_CLIMBING, //!< Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + ePREVENT_CLIMBING_AND_FORCE_SLIDING //!< Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + }; +}; + +/** +\brief specifies which sides a character is colliding with. +*/ +struct PxControllerCollisionFlag +{ + enum Enum + { + eCOLLISION_SIDES = (1<<0), //!< Character is colliding to the sides. + eCOLLISION_UP = (1<<1), //!< Character has collision above. + eCOLLISION_DOWN = (1<<2) //!< Character has collision below. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxControllerCollisionFlag. + +@see PxControllerCollisionFlag +*/ +typedef PxFlags PxControllerCollisionFlags; +PX_FLAGS_OPERATORS(PxControllerCollisionFlag::Enum, PxU8) + +/** +\brief Describes a controller's internal state. +*/ +struct PxControllerState +{ + PxVec3 deltaXP; //!< delta position vector for the object the CCT is standing/riding on. Not always match the CCT delta when variable timesteps are used. + PxShape* touchedShape; //!< Shape on which the CCT is standing + PxRigidActor* touchedActor; //!< Actor owning 'touchedShape' + PxObstacleHandle touchedObstacleHandle; // Obstacle on which the CCT is standing + PxU32 collisionFlags; //!< Last known collision flags (PxControllerCollisionFlag) + bool standOnAnotherCCT; //!< Are we standing on another CCT? + bool standOnObstacle; //!< Are we standing on a user-defined obstacle? + bool isMovingUp; //!< is CCT moving up or not? (i.e. explicit jumping) +}; + +/** +\brief Describes a controller's internal statistics. +*/ +struct PxControllerStats +{ + PxU16 nbIterations; + PxU16 nbFullUpdates; + PxU16 nbPartialUpdates; + PxU16 nbTessellation; +}; + +/** +\brief Describes a generic CCT hit. +*/ +struct PxControllerHit +{ + PxController* controller; //!< Current controller + PxExtendedVec3 worldPos; //!< Contact position in world space + PxVec3 worldNormal; //!< Contact normal in world space + PxVec3 dir; //!< Motion direction + PxF32 length; //!< Motion length +}; + +/** +\brief Describes a hit between a CCT and a shape. Passed to onShapeHit() + +@see PxUserControllerHitReport.onShapeHit() +*/ +struct PxControllerShapeHit : public PxControllerHit +{ + PxShape* shape; //!< Touched shape + PxRigidActor* actor; //!< Touched actor + PxU32 triangleIndex; //!< touched triangle index (only for meshes/heightfields) +}; + +/** +\brief Describes a hit between a CCT and another CCT. Passed to onControllerHit(). + +@see PxUserControllerHitReport.onControllerHit() +*/ +struct PxControllersHit : public PxControllerHit +{ + PxController* other; //!< Touched controller +}; + +/** +\brief Describes a hit between a CCT and a user-defined obstacle. Passed to onObstacleHit(). + +@see PxUserControllerHitReport.onObstacleHit() PxObstacleContext +*/ +struct PxControllerObstacleHit : public PxControllerHit +{ + const void* userData; +}; + +/** +\brief User callback class for character controller events. + +\note Character controller hit reports are only generated when move is called. + +@see PxControllerDesc.callback +*/ +class PxUserControllerHitReport +{ +public: + + /** + \brief Called when current controller hits a shape. + + This is called when the CCT moves and hits a shape. This will not be called when a moving shape hits a non-moving CCT. + + \param[in] hit Provides information about the hit. + + @see PxControllerShapeHit + */ + virtual void onShapeHit(const PxControllerShapeHit& hit) = 0; + + /** + \brief Called when current controller hits another controller. + + \param[in] hit Provides information about the hit. + + @see PxControllersHit + */ + virtual void onControllerHit(const PxControllersHit& hit) = 0; + + /** + \brief Called when current controller hits a user-defined obstacle. + + \param[in] hit Provides information about the hit. + + @see PxControllerObstacleHit PxObstacleContext + */ + virtual void onObstacleHit(const PxControllerObstacleHit& hit) = 0; + +protected: + virtual ~PxUserControllerHitReport(){} +}; + + +/** +\brief Dedicated filtering callback for CCT vs CCT. + +This controls collisions between CCTs (one CCT vs anoter CCT). + +To make each CCT collide against all other CCTs, just return true - or simply avoid defining a callback. +To make each CCT freely go through all other CCTs, just return false. +Otherwise create a custom filtering logic in this callback. + +@see PxControllerFilters +*/ +class PxControllerFilterCallback +{ +public: + virtual ~PxControllerFilterCallback(){} + + /** + \brief Filtering method for CCT-vs-CCT. + + \param[in] a First CCT + \param[in] b Second CCT + \return true to keep the pair, false to filter it out + */ + virtual bool filter(const PxController& a, const PxController& b) = 0; +}; + +/** +\brief Filtering data for "move" call. + +This class contains all filtering-related parameters for the PxController::move() call. + +Collisions between a CCT and the world are filtered using the mFilterData, mFilterCallback and mFilterFlags +members. These parameters are internally passed to PxScene::overlap() to find objects touched by the CCT. +Please refer to the PxScene::overlap() documentation for details. + +Collisions between a CCT and another CCT are filtered using the mCCTFilterCallback member. If this filter +callback is not defined, none of the CCT-vs-CCT collisions are filtered, and each CCT will collide against +all other CCTs. + +\note PxQueryFlag::eANY_HIT and PxQueryFlag::eNO_BLOCK are ignored in mFilterFlags. + +@see PxController.move() PxControllerFilterCallback +*/ +class PxControllerFilters +{ + public: + + PX_INLINE PxControllerFilters(const PxFilterData* filterData=NULL, PxQueryFilterCallback* cb=NULL, PxControllerFilterCallback* cctFilterCb=NULL) : + mFilterData (filterData), + mFilterCallback (cb), + mFilterFlags (PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER), + mCCTFilterCallback (cctFilterCb) + {} + + // CCT-vs-shapes: + const PxFilterData* mFilterData; //!< Data for internal PxQueryFilterData structure. Passed to PxScene::overlap() call. + //!< This can be NULL, in which case a default PxFilterData is used. + PxQueryFilterCallback* mFilterCallback; //!< Custom filter logic (can be NULL). Passed to PxScene::overlap() call. + PxQueryFlags mFilterFlags; //!< Flags for internal PxQueryFilterData structure. Passed to PxScene::overlap() call. + // CCT-vs-CCT: + PxControllerFilterCallback* mCCTFilterCallback; //!< CCT-vs-CCT filter callback. If NULL, all CCT-vs-CCT collisions are kept. +}; + +/** +\brief Descriptor class for a character controller. + +@see PxBoxController PxCapsuleController +*/ +class PxControllerDesc +{ +public: + + /** + \brief returns true if the current settings are valid + + \return True if the descriptor is valid. + */ + PX_INLINE virtual bool isValid() const; + + /** + \brief Returns the character controller type + + \return The controllers type. + + @see PxControllerType PxCapsuleControllerDesc PxBoxControllerDesc + */ + PX_INLINE PxControllerShapeType::Enum getType() const { return mType; } + + /** + \brief The position of the character + + \note The character's initial position must be such that it does not overlap the static geometry. + + Default: Zero + */ + PxExtendedVec3 position; + + /** + \brief Specifies the 'up' direction + + In order to provide stepping functionality the SDK must be informed about the up direction. + + Default: (0, 1, 0) + + */ + PxVec3 upDirection; + + /** + \brief The maximum slope which the character can walk up. + + In general it is desirable to limit where the character can walk, in particular it is unrealistic + for the character to be able to climb arbitary slopes. + + The limit is expressed as the cosine of desired limit angle. A value of 0 disables this feature. + + \warning It is currently enabled for static actors only (not for dynamic/kinematic actors), and not supported for spheres or capsules. + + Default: 0.707 + + @see upDirection invisibleWallHeight maxJumpHeight + */ + PxF32 slopeLimit; + + /** + \brief Height of invisible walls created around non-walkable triangles + + The library can automatically create invisible walls around non-walkable triangles defined + by the 'slopeLimit' parameter. This defines the height of those walls. If it is 0.0, then + no extra triangles are created. + + Default: 0.0 + + @see upDirection slopeLimit maxJumpHeight + */ + PxF32 invisibleWallHeight; + + /** + \brief Maximum height a jumping character can reach + + This is only used if invisible walls are created ('invisibleWallHeight' is non zero). + + When a character jumps, the non-walkable triangles he might fly over are not found + by the collision queries (since the character's bounding volume does not touch them). + Thus those non-walkable triangles do not create invisible walls, and it is possible + for a jumping character to land on a non-walkable triangle, while he wouldn't have + reached that place by just walking. + + The 'maxJumpHeight' variable is used to extend the size of the collision volume + downward. This way, all the non-walkable triangles are properly found by the collision + queries and it becomes impossible to 'jump over' invisible walls. + + If the character in your game can not jump, it is safe to use 0.0 here. Otherwise it + is best to keep this value as small as possible, since a larger collision volume + means more triangles to process. + + Default: 0.0 + + @see upDirection slopeLimit invisibleWallHeight + */ + PxF32 maxJumpHeight; + + /** + \brief The contact offset used by the controller. + + Specifies a skin around the object within which contacts will be generated. + Use it to avoid numerical precision issues. + + This is dependant on the scale of the users world, but should be a small, positive + non zero value. + + Default: 0.1 + */ + PxF32 contactOffset; + + /** + \brief Defines the maximum height of an obstacle which the character can climb. + + A small value will mean that the character gets stuck and cannot walk up stairs etc, + a value which is too large will mean that the character can climb over unrealistically + high obstacles. + + Default: 0.5 + + @see upDirection + */ + PxF32 stepOffset; + + /** + \brief Density of underlying kinematic actor + + The CCT creates a PhysX's kinematic actor under the hood. This controls its density. + + Default: 10.0 + */ + PxF32 density; + + /** + \brief Scale coefficient for underlying kinematic actor + + The CCT creates a PhysX's kinematic actor under the hood. This controls its scale factor. + This should be a number a bit smaller than 1.0. + + Default: 0.8 + */ + PxF32 scaleCoeff; + + /** + \brief Cached volume growth + + Amount of space around the controller we cache to improve performance. This is a scale factor + that should be higher than 1.0f but not too big, ideally lower than 2.0f. + + Default: 1.5 + */ + PxF32 volumeGrowth; + + /** + \brief Specifies a user report callback. + + This report callback is called when the character collides with shapes and other characters. + + Setting this to NULL disables the callback. + + Default: NULL + + @see PxUserControllerHitReport + */ + PxUserControllerHitReport* reportCallback; + + /** + \brief Specifies a user behavior callback. + + This behavior callback is called to customize the controller's behavior w.r.t. touched shapes. + + Setting this to NULL disables the callback. + + Default: NULL + + @see PxControllerBehaviorCallback + */ + PxControllerBehaviorCallback* behaviorCallback; + + /** + \brief The non-walkable mode controls if a character controller slides or not on a non-walkable part. + + This is only used when slopeLimit is non zero. + + Default: PxControllerNonWalkableMode::ePREVENT_CLIMBING + + @see PxControllerNonWalkableMode + */ + PxControllerNonWalkableMode::Enum nonWalkableMode; + + /** + \brief The material for the actor associated with the controller. + + The controller internally creates a rigid body actor. This parameter specifies the material of the actor. + + Default: NULL + + @see PxMaterial + */ + PxMaterial* material; + + /** + \brief Use a deletion listener to get informed about released objects and clear internal caches if needed. + + If a character controller registers a deletion listener, it will get informed about released objects. That allows the + controller to invalidate cached data that connects to a released object. If a deletion listener is not + registered, PxController::invalidateCache has to be called manually after objects have been released. + + @see PxController::invalidateCache + + Default: true + */ + bool registerDeletionListener; + + /** + \brief Client ID for associated actor. + + @see PxClientID PxActor::setOwnerClient + + Default: PX_DEFAULT_CLIENT + */ + PxClientID clientID; + + /** + \brief User specified data associated with the controller. + + Default: NULL + */ + void* userData; + +protected: + const PxControllerShapeType::Enum mType; //!< The type of the controller. This gets set by the derived class' ctor, the user should not have to change it. + + /** + \brief constructor sets to default. + */ + PX_INLINE PxControllerDesc(PxControllerShapeType::Enum); + PX_INLINE virtual ~PxControllerDesc(); + + /** + \brief copy constructor. + */ + PX_INLINE PxControllerDesc(const PxControllerDesc&); + + /** + \brief assignment operator. + */ + PX_INLINE PxControllerDesc& operator=(const PxControllerDesc&); + + PX_INLINE void copy(const PxControllerDesc&); +}; + +PX_INLINE PxControllerDesc::PxControllerDesc(PxControllerShapeType::Enum t) : + position (PxExtended(0.0), PxExtended(0.0), PxExtended(0.0)), + upDirection (0.0f, 1.0f, 0.0f), + slopeLimit (0.707f), + invisibleWallHeight (0.0f), + maxJumpHeight (0.0f), + contactOffset (0.1f), + stepOffset (0.5f), + density (10.0f), + scaleCoeff (0.8f), + volumeGrowth (1.5f), + reportCallback (NULL), + behaviorCallback (NULL), + nonWalkableMode (PxControllerNonWalkableMode::ePREVENT_CLIMBING), + material (NULL), + registerDeletionListener (true), + clientID (PX_DEFAULT_CLIENT), + userData (NULL), + mType (t) +{ +} + +PX_INLINE PxControllerDesc::PxControllerDesc(const PxControllerDesc& other) : mType(other.mType) +{ + copy(other); +} + +PX_INLINE PxControllerDesc& PxControllerDesc::operator=(const PxControllerDesc& other) +{ + copy(other); + return *this; +} + +PX_INLINE void PxControllerDesc::copy(const PxControllerDesc& other) +{ + upDirection = other.upDirection; + slopeLimit = other.slopeLimit; + contactOffset = other.contactOffset; + stepOffset = other.stepOffset; + density = other.density; + scaleCoeff = other.scaleCoeff; + volumeGrowth = other.volumeGrowth; + reportCallback = other.reportCallback; + behaviorCallback = other.behaviorCallback; + userData = other.userData; + nonWalkableMode = other.nonWalkableMode; + position.x = other.position.x; + position.y = other.position.y; + position.z = other.position.z; + material = other.material; + invisibleWallHeight = other.invisibleWallHeight; + maxJumpHeight = other.maxJumpHeight; + registerDeletionListener = other.registerDeletionListener; + clientID = other.clientID; +} + +PX_INLINE PxControllerDesc::~PxControllerDesc() +{ +} + +PX_INLINE bool PxControllerDesc::isValid() const +{ + if( mType!=PxControllerShapeType::eBOX + && mType!=PxControllerShapeType::eCAPSULE) + return false; + if(scaleCoeff<0.0f) + return false; + if(volumeGrowth<1.0f) + return false; + if(density<0.0f) + return false; + if(slopeLimit<0.0f) + return false; + if(stepOffset<0.0f) + return false; + if(contactOffset<=0.0f) + return false; + if(!material) + return false; + if(!toVec3(position).isFinite()) + return false; //the float version needs to be finite otherwise actor creation will fail. + + return true; +} + + +/** +\brief Base class for character controllers. + +@see PxCapsuleController PxBoxController +*/ +class PxController +{ +public: + //********************************************************************* + // DEPRECATED FUNCTIONS: + // + // PX_DEPRECATED virtual void setInteraction(PxCCTInteractionMode::Enum flag) = 0; + // PX_DEPRECATED virtual PxCCTInteractionMode::Enum getInteraction() const = 0; + // PX_DEPRECATED virtual void setGroupsBitmask(PxU32 bitmask) = 0; + // PX_DEPRECATED virtual PxU32 getGroupsBitmask() const = 0; + // + // => replaced with: + // + // PxControllerFilters::mCCTFilterCallback. Please define a PxControllerFilterCallback object and emulate the old interaction mode there. + // + //********************************************************************* + + /** + \brief Return the type of controller + + @see PxControllerType + */ + virtual PxControllerShapeType::Enum getType() const = 0; + + /** + \brief Releases the controller. + */ + virtual void release() = 0; + + /** + \brief Moves the character using a "collide-and-slide" algorithm. + + \param[in] disp Displacement vector + \param[in] minDist The minimum travelled distance to consider. If travelled distance is smaller, the character doesn't move. + This is used to stop the recursive motion algorithm when remaining distance to travel is small. + \param[in] elapsedTime Time elapsed since last call + \param[in] filters User-defined filters for this move + \param[in] obstacles Potential additional obstacles the CCT should collide with. + \return Collision flags, collection of ::PxControllerCollisionFlags + */ + virtual PxControllerCollisionFlags move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles=NULL) = 0; + + /** + \brief Sets controller's position. + + The position controlled by this function is the center of the collision shape. + + \warning This is a 'teleport' function, it doesn't check for collisions. + \warning The character's position must be such that it does not overlap the static geometry. + + To move the character under normal conditions use the #move() function. + + \param[in] position The new (center) positon for the controller. + \return Currently always returns true. + + @see PxControllerDesc.position getPosition() getFootPosition() setFootPosition() move() + */ + virtual bool setPosition(const PxExtendedVec3& position) = 0; + + /** + \brief Retrieve the raw position of the controller. + + The position retrieved by this function is the center of the collision shape. To retrieve the bottom position of the shape, + a.k.a. the foot position, use the getFootPosition() function. + + The position is updated by calls to move(). Calling this method without calling + move() will return the last position or the initial position of the controller. + + \return The controller's center position + + @see PxControllerDesc.position setPosition() getFootPosition() setFootPosition() move() + */ + virtual const PxExtendedVec3& getPosition() const = 0; + + /** + \brief Set controller's foot position. + + The position controlled by this function is the bottom of the collision shape, a.k.a. the foot position. + + \note The foot position takes the contact offset into account + + \warning This is a 'teleport' function, it doesn't check for collisions. + + To move the character under normal conditions use the #move() function. + + \param[in] position The new (bottom) positon for the controller. + \return Currently always returns true. + + @see PxControllerDesc.position setPosition() getPosition() getFootPosition() move() + */ + virtual bool setFootPosition(const PxExtendedVec3& position) = 0; + + /** + \brief Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape. + + \note The foot position takes the contact offset into account + + \return The controller's foot position + + @see PxControllerDesc.position setPosition() getPosition() setFootPosition() move() + */ + virtual PxExtendedVec3 getFootPosition() const = 0; + + /** + \brief Get the rigid body actor associated with this controller (see PhysX documentation). + The behavior upon manually altering this actor is undefined, you should primarily + use it for reading const properties. + + \return the actor associated with the controller. + */ + virtual PxRigidDynamic* getActor() const = 0; + + /** + \brief The step height. + + \param[in] offset The new step offset for the controller. + + @see PxControllerDesc.stepOffset + */ + virtual void setStepOffset(const PxF32 offset) =0; + + /** + \brief Retrieve the step height. + + \return The step offset for the controller. + + @see setStepOffset() + */ + virtual PxF32 getStepOffset() const =0; + + /** + \brief Sets the non-walkable mode for the CCT. + + \param[in] flag The new value of the non-walkable mode. + + @see PxControllerNonWalkableMode + */ + virtual void setNonWalkableMode(PxControllerNonWalkableMode::Enum flag) = 0; + + /** + \brief Retrieves the non-walkable mode for the CCT. + + \return The current non-walkable mode. + + @see PxControllerNonWalkableMode + */ + virtual PxControllerNonWalkableMode::Enum getNonWalkableMode() const = 0; + + /** + \brief Retrieve the contact offset. + + \return The contact offset for the controller. + + @see PxControllerDesc.contactOffset + */ + virtual PxF32 getContactOffset() const =0; + + /** + \brief Sets the contact offset. + + \param[in] offset The contact offset for the controller. + + @see PxControllerDesc.contactOffset + */ + virtual void setContactOffset(PxF32 offset) =0; + + /** + \brief Retrieve the 'up' direction. + + \return The up direction for the controller. + + @see PxControllerDesc.upDirection + */ + virtual PxVec3 getUpDirection() const =0; + + /** + \brief Sets the 'up' direction. + + \param[in] up The up direction for the controller. + + @see PxControllerDesc.upDirection + */ + virtual void setUpDirection(const PxVec3& up) =0; + + /** + \brief Retrieve the slope limit. + + \return The slope limit for the controller. + + @see PxControllerDesc.slopeLimit + */ + virtual PxF32 getSlopeLimit() const =0; + + /** + \brief Sets the slope limit. + + \note This feature can not be enabled at runtime, i.e. if the slope limit is zero when creating the CCT + (which disables the feature) then changing the slope limit at runtime will not have any effect, and the call + will be ignored. + + \param[in] slopeLimit The slope limit for the controller. + + @see PxControllerDesc.slopeLimit + */ + virtual void setSlopeLimit(PxF32 slopeLimit) =0; + + /** + \brief Flushes internal geometry cache. + + The character controller uses caching in order to speed up collision testing. The cache is + automatically flushed when a change to static objects is detected in the scene. For example when a + static shape is added, updated, or removed from the scene, the cache is automatically invalidated. + + However there may be situations that cannot be automatically detected, and those require manual + invalidation of the cache. Currently the user must call this when the filtering behavior changes (the + PxControllerFilters parameter of the PxController::move call). While the controller in principle + could detect a change in these parameters, it cannot detect a change in the behavior of the filtering + function. + + @see PxController.move + */ + virtual void invalidateCache() = 0; + + /** + \brief Retrieve the scene associated with the controller. + + \return The physics scene + */ + virtual PxScene* getScene() = 0; + + /** + \brief Returns the user data associated with this controller. + + \return The user pointer associated with the controller. + + @see PxControllerDesc.userData + */ + virtual void* getUserData() const = 0; + + /** + \brief Sets the user data associated with this controller. + + \param[in] userData The user pointer associated with the controller. + + @see PxControllerDesc.userData + */ + virtual void setUserData(void* userData) = 0; + + /** + \brief Returns information about the controller's internal state. + + \param[out] state The controller's internal state + + @see PxControllerState + */ + virtual void getState(PxControllerState& state) const = 0; + + /** + \brief Returns the controller's internal statistics. + + \param[out] stats The controller's internal statistics + + @see PxControllerStats + */ + virtual void getStats(PxControllerStats& stats) const = 0; + + /** + \brief Resizes the controller. + + This function attempts to resize the controller to a given size, while making sure the bottom + position of the controller remains constant. In other words the function modifies both the + height and the (center) position of the controller. This is a helper function that can be used + to implement a 'crouch' functionality for example. + + \param[in] height Desired controller's height + */ + virtual void resize(PxReal height) = 0; + +protected: + PX_INLINE PxController() {} + virtual ~PxController() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerBehavior.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerBehavior.h new file mode 100644 index 0000000..4c9aa47 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerBehavior.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTROLLER_BEHAVIOR_H +#define PX_CONTROLLER_BEHAVIOR_H +/** \addtogroup character + @{ +*/ + +#include "PxFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxShape; + class PxObstacle; + class PxController; + + /** + \brief specifies controller behavior + */ + struct PxControllerBehaviorFlag + { + enum Enum + { + eCCT_CAN_RIDE_ON_OBJECT = (1<<0), //!< Controller can ride on touched object (i.e. when this touched object is moving horizontally). \note The CCT vs. CCT case is not supported. + eCCT_SLIDE = (1<<1), //!< Controller should slide on touched object + eCCT_USER_DEFINED_RIDE = (1<<2) //!< Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + }; + }; + + /** + \brief Bitfield that contains a set of raised flags defined in PxControllerBehaviorFlag. + + @see PxControllerBehaviorFlag + */ + typedef PxFlags PxControllerBehaviorFlags; + PX_FLAGS_OPERATORS(PxControllerBehaviorFlag::Enum, PxU8) + + /** + \brief User behavior callback. + + This behavior callback is called to customize the controller's behavior w.r.t. touched shapes. + */ + class PxControllerBehaviorCallback + { + public: + /** + \brief Retrieve behavior flags for a shape. + + When the CCT touches a shape, the CCT's behavior w.r.t. this shape can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \note See comments about deprecated functions at the start of this class + + \param[in] shape The shape the CCT is currently touching + \param[in] actor The actor owning the shape + + \return Desired behavior flags for the given shape + + @see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxShape& shape, const PxActor& actor) = 0; + + /** + \brief Retrieve behavior flags for a controller. + + When the CCT touches a controller, the CCT's behavior w.r.t. this controller can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \note The flag PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not supported. + \note See comments about deprecated functions at the start of this class + + \param[in] controller The controller the CCT is currently touching + + \return Desired behavior flags for the given controller + + @see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxController& controller) = 0; + + /** + \brief Retrieve behavior flags for an obstacle. + + When the CCT touches an obstacle, the CCT's behavior w.r.t. this obstacle can be customized by users. + This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + + \note See comments about deprecated functions at the start of this class + + \param[in] obstacle The obstacle the CCT is currently touching + + \return Desired behavior flags for the given obstacle + + @see PxControllerBehaviorFlag + */ + virtual PxControllerBehaviorFlags getBehaviorFlags(const PxObstacle& obstacle) = 0; + + protected: + virtual ~PxControllerBehaviorCallback(){} + }; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerManager.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerManager.h new file mode 100644 index 0000000..76c30e7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerManager.h @@ -0,0 +1,298 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTROLLER_MANAGER_H +#define PX_CONTROLLER_MANAGER_H +/** \addtogroup character + @{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" +#include "foundation/PxErrorCallback.h" +#include "common/PxRenderBuffer.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPhysics; +class PxScene; +class PxController; +class PxControllerDesc; +class PxObstacleContext; +class PxControllerFilterCallback; + +/** +\brief specifies debug-rendering flags +*/ +struct PxControllerDebugRenderFlag +{ + enum Enum + { + eTEMPORAL_BV = (1<<0), //!< Temporal bounding volume around controllers + eCACHED_BV = (1<<1), //!< Cached bounding volume around controllers + eOBSTACLES = (1<<2), //!< User-defined obstacles + + eNONE = 0, + eALL = 0xffffffff + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxControllerDebugRenderFlag. + +@see PxControllerDebugRenderFlag +*/ +typedef PxFlags PxControllerDebugRenderFlags; +PX_FLAGS_OPERATORS(PxControllerDebugRenderFlag::Enum, PxU32) + + +/** +\brief Manages an array of character controllers. + +@see PxController PxBoxController PxCapsuleController +*/ +class PxControllerManager +{ +public: + /** + \brief Releases the controller manager. + + \note This will release all associated controllers and obstacle contexts. + + \note This function is required to be called to release foundation usage. + + */ + virtual void release() = 0; + + /** + \brief Returns the scene the manager is adding the controllers to. + + \return The associated physics scene. + */ + virtual PxScene& getScene() const = 0; + + /** + \brief Returns the number of controllers that are being managed. + + \return The number of controllers. + */ + virtual PxU32 getNbControllers() const = 0; + + /** + \brief Retrieve one of the controllers in the manager. + + \param index the index of the controller to return + \return The controller with the specified index. + */ + virtual PxController* getController(PxU32 index) = 0; + + /** + \brief Creates a new character controller. + + \param[in] desc The controllers descriptor + \return The new controller + + @see PxController PxController.release() PxControllerDesc + */ + virtual PxController* createController(const PxControllerDesc& desc) = 0; + + /** + \brief Releases all the controllers that are being managed. + */ + virtual void purgeControllers() = 0; + + /** + \brief Retrieves debug data. + + \return The render buffer filled with debug-render data + + @see PxControllerManager.setDebugRenderingFlags() + */ + virtual PxRenderBuffer& getRenderBuffer() = 0; + + /** + \brief Sets debug rendering flags + + \param[in] flags The debug rendering flags (combination of PxControllerDebugRenderFlags) + + @see PxControllerManager.getRenderBuffer() PxControllerDebugRenderFlags + */ + virtual void setDebugRenderingFlags(PxControllerDebugRenderFlags flags) = 0; + + /** + \brief Returns the number of obstacle contexts that are being managed. + + \return The number of obstacle contexts. + */ + virtual PxU32 getNbObstacleContexts() const = 0; + + /** + \brief Retrieve one of the obstacle contexts in the manager. + + \param index The index of the obstacle context to retrieve. + \return The obstacle context with the specified index. + */ + virtual PxObstacleContext* getObstacleContext(PxU32 index) = 0; + + /** + \brief Creates an obstacle context. + + \return New obstacle context + + @see PxObstacleContext + */ + virtual PxObstacleContext* createObstacleContext() = 0; + + /** + \brief Computes character-character interactions. + + This function is an optional helper to properly resolve interactions between characters, in case they overlap (which can happen for gameplay reasons, etc). + + You should call this once per frame, before your PxController::move() calls. The function will not move the characters directly, but it will + compute overlap information for each character that will be used in the next move() call. + + You need to provide a proper time value here so that interactions are resolved in a way that do not depend on the framerate. + + If you only have one character in the scene, or if you can guarantee your characters will never overlap, then you do not need to call this function. + + \note Releasing the manager will automatically release all the associated obstacle contexts. + + \param[in] elapsedTime Elapsed time since last call + \param[in] cctFilterCb Filtering callback for CCT-vs-CCT interactions + */ + virtual void computeInteractions(PxF32 elapsedTime, PxControllerFilterCallback* cctFilterCb=NULL) = 0; + + /** + \brief Enables or disables runtime tessellation. + + Large triangles can create accuracy issues in the sweep code, which in turn can lead to characters not sliding smoothly + against geometries, or even penetrating them. This feature allows one to reduce those issues by tessellating large + triangles at runtime, before performing sweeps against them. The amount of tessellation is controlled by the 'maxEdgeLength' parameter. + Any triangle with at least one edge length greater than the maxEdgeLength will get recursively tessellated, until resulting triangles are small enough. + + This features only applies to triangle meshes, convex meshes, heightfields and boxes. + + \param[in] flag True/false to enable/disable runtime tessellation. + \param[in] maxEdgeLength Max edge length allowed before tessellation kicks in. + */ + virtual void setTessellation(bool flag, float maxEdgeLength) = 0; + + /** + \brief Enables or disables the overlap recovery module. + + The overlap recovery module can be used to depenetrate CCTs from static objects when an overlap is detected. This can happen + in three main cases: + - when the CCT is directly spawned or teleported in another object + - when the CCT algorithm fails due to limited FPU accuracy + - when the "up vector" is modified, making the rotated CCT shape overlap surrounding objects + + When activated, the CCT module will automatically try to resolve the penetration, and move the CCT to a safe place where it does + not overlap other objects anymore. This only concerns static objects, dynamic objects are ignored by the recovery module. + + When the recovery module is not activated, it is possible for the CCTs to go through static objects. By default, the recovery + module is enabled. + + The recovery module currently works with all geometries except heightfields. + + \param[in] flag True/false to enable/disable overlap recovery module. + */ + virtual void setOverlapRecoveryModule(bool flag) = 0; + + /** + \brief Enables or disables the precise sweeps. + + Precise sweeps are more accurate, but also potentially slower than regular sweeps. + + By default, precise sweeps are enabled. + + \param[in] flag True/false to enable/disable precise sweeps. + */ + virtual void setPreciseSweeps(bool flag) = 0; + + /** + \brief Enables or disables vertical sliding against ceilings. + + Geometry is seen as "ceilings" when the following condition is met: + + dot product(contact normal, up direction)<0.0f + + This flag controls whether characters should slide vertically along the geometry in that case. + + By default, sliding is allowed. + + \param[in] flag True/false to enable/disable sliding. + */ + virtual void setPreventVerticalSlidingAgainstCeiling(bool flag) = 0; + + /** + \brief Shift the origin of the character controllers and obstacle objects by the specified vector. + + The positions of all character controllers, obstacle objects and the corresponding data structures will get adjusted to reflect the shifted origin location + (the shift vector will get subtracted from all character controller and obstacle object positions). + + \note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysXCharacterKinematic accordingly. + + \note This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() seperately to keep the systems in sync. + + \param[in] shift Translation vector to shift the origin by. + */ + virtual void shiftOrigin(const PxVec3& shift) = 0; + +protected: + PxControllerManager() {} + virtual ~PxControllerManager() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** + \brief Creates the controller manager. + + \param[in] scene PhysX scene. + \param[in] lockingEnabled Enables/disables internal locking. + + The character controller is informed by #PxDeletionListener::onRelease() when actors or shapes are released, and updates its internal + caches accordingly. If character controller movement or a call to #PxControllerManager::shiftOrigin() may overlap with actor/shape releases, + internal data structures must be guarded against concurrent access. + + Locking guarantees thread safety in such scenarios. + + \note locking may result in significant slowdown for release of actors or shapes. + + By default, locking is disabled. + */ +PX_C_EXPORT physx::PxControllerManager* PX_CALL_CONV PxCreateControllerManager(physx::PxScene& scene, bool lockingEnabled = false); + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerObstacles.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerObstacles.h new file mode 100644 index 0000000..7f438fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxControllerObstacles.h @@ -0,0 +1,190 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTROLLER_OBSTACLES_H +#define PX_CONTROLLER_OBSTACLES_H +/** \addtogroup character + @{ +*/ + +#include "characterkinematic/PxExtended.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxControllerManager; + + #define PX_INVALID_OBSTACLE_HANDLE 0xffffffff + + /** + \brief Base class for obstacles. + + @see PxBoxObstacle PxCapsuleObstacle PxObstacleContext + */ + class PxObstacle + { + protected: + PxObstacle() : + mType (PxGeometryType::eINVALID), + mUserData (NULL), + mPos (0.0, 0.0, 0.0), + mRot (PxQuat(PxIdentity)) + {} + + PxGeometryType::Enum mType; + public: + + PX_FORCE_INLINE PxGeometryType::Enum getType() const { return mType; } + + void* mUserData; + PxExtendedVec3 mPos; + PxQuat mRot; + }; + + /** + \brief A box obstacle. + + @see PxObstacle PxCapsuleObstacle PxObstacleContext + */ + class PxBoxObstacle : public PxObstacle + { + public: + PxBoxObstacle() : + mHalfExtents(0.0f) + { mType = PxGeometryType::eBOX; } + + PxVec3 mHalfExtents; + }; + + /** + \brief A capsule obstacle. + + @see PxBoxObstacle PxObstacle PxObstacleContext + */ + class PxCapsuleObstacle : public PxObstacle + { + public: + PxCapsuleObstacle() : + mHalfHeight (0.0f), + mRadius (0.0f) + { mType = PxGeometryType::eCAPSULE; } + + PxReal mHalfHeight; + PxReal mRadius; + }; + + typedef PxU32 PxObstacleHandle; + + /** + \brief Context class for obstacles. + + An obstacle context class contains and manages a set of user-defined obstacles. + + @see PxBoxObstacle PxCapsuleObstacle PxObstacle + */ + class PxObstacleContext + { + public: + PxObstacleContext() {} + virtual ~PxObstacleContext() {} + + /** + \brief Releases the context. + */ + virtual void release() = 0; + + /** + \brief Retrieves the controller manager associated with this context. + + \return The associated controller manager + */ + virtual PxControllerManager& getControllerManager() const = 0; + + /** + \brief Adds an obstacle to the context. + + \param [in] obstacle Obstacle data for the new obstacle. The data gets copied. + + \return Handle for newly-added obstacle + */ + virtual PxObstacleHandle addObstacle(const PxObstacle& obstacle) = 0; + + /** + \brief Removes an obstacle from the context. + + \param [in] handle Handle for the obstacle object that needs to be removed. + + \return True if success + */ + virtual bool removeObstacle(PxObstacleHandle handle) = 0; + + /** + \brief Updates data for an existing obstacle. + + \param [in] handle Handle for the obstacle object that needs to be updated. + \param [in] obstacle New obstacle data + + \return True if success + */ + virtual bool updateObstacle(PxObstacleHandle handle, const PxObstacle& obstacle) = 0; + + /** + \brief Retrieves number of obstacles in the context. + + \return Number of obstacles in the context + */ + virtual PxU32 getNbObstacles() const = 0; + + /** + \brief Retrieves desired obstacle. + + \param [in] i Obstacle index + + \return Desired obstacle + */ + virtual const PxObstacle* getObstacle(PxU32 i) const = 0; + + /** + \brief Retrieves desired obstacle by given handle. + + \param [in] handle Obstacle handle + + \return Desired obstacle + */ + virtual const PxObstacle* getObstacleByHandle(PxObstacleHandle handle) const = 0; + }; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxExtended.h b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxExtended.h new file mode 100644 index 0000000..1bc75eb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/characterkinematic/PxExtended.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_EXTENDED_H +#define PX_EXTENDED_H +/** \addtogroup character + @{ +*/ + +// This needs to be included in Foundation just for the debug renderer + +#include "PxPhysXConfig.h" +#include "foundation/PxTransform.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// This has to be done here since it also changes the top-level "Px" and "Np" APIs +#define PX_BIG_WORLDS + +#ifdef PX_BIG_WORLDS +typedef double PxExtended; +#define PX_MAX_EXTENDED PX_MAX_F64 +#define PxExtendedAbs(x) fabs(x) + +struct PxExtendedVec3 +{ + PX_INLINE PxExtendedVec3() {} + PX_INLINE PxExtendedVec3(PxExtended _x, PxExtended _y, PxExtended _z) : x(_x), y(_y), z(_z) {} + + PX_INLINE bool isZero() const + { + if(x!=0.0 || y!=0.0 || z!=0.0) return false; + return true; + } + + PX_INLINE PxExtended dot(const PxVec3& v) const + { + return x * PxExtended(v.x) + y * PxExtended(v.y) + z * PxExtended(v.z); + } + + PX_INLINE PxExtended distanceSquared(const PxExtendedVec3& v) const + { + PxExtended dx = x - v.x; + PxExtended dy = y - v.y; + PxExtended dz = z - v.z; + return dx * dx + dy * dy + dz * dz; + } + + PX_INLINE PxExtended magnitudeSquared() const + { + return x * x + y * y + z * z; + } + + PX_INLINE PxExtended magnitude() const + { + return PxSqrt(x * x + y * y + z * z); + } + + PX_INLINE PxExtended normalize() + { + PxExtended m = magnitude(); + if (m != 0.0) + { + const PxExtended il = PxExtended(1.0) / m; + x *= il; + y *= il; + z *= il; + } + return m; + } + + PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z); + } + + PX_INLINE void maximum(const PxExtendedVec3& v) + { + if (x < v.x) x = v.x; + if (y < v.y) y = v.y; + if (z < v.z) z = v.z; + } + + + PX_INLINE void minimum(const PxExtendedVec3& v) + { + if (x > v.x) x = v.x; + if (y > v.y) y = v.y; + if (z > v.z) z = v.z; + } + + PX_INLINE void set(PxExtended x_, PxExtended y_, PxExtended z_) + { + this->x = x_; + this->y = y_; + this->z = z_; + } + + PX_INLINE void setPlusInfinity() + { + x = y = z = PX_MAX_EXTENDED; + } + + PX_INLINE void setMinusInfinity() + { + x = y = z = -PX_MAX_EXTENDED; + } + + PX_INLINE void cross(const PxExtendedVec3& left, const PxVec3& right) + { + // temps needed in case left or right is this. + PxExtended a = (left.y * PxExtended(right.z)) - (left.z * PxExtended(right.y)); + PxExtended b = (left.z * PxExtended(right.x)) - (left.x * PxExtended(right.z)); + PxExtended c = (left.x * PxExtended(right.y)) - (left.y * PxExtended(right.x)); + + x = a; + y = b; + z = c; + } + + PX_INLINE void cross(const PxExtendedVec3& left, const PxExtendedVec3& right) + { + // temps needed in case left or right is this. + PxExtended a = (left.y * right.z) - (left.z * right.y); + PxExtended b = (left.z * right.x) - (left.x * right.z); + PxExtended c = (left.x * right.y) - (left.y * right.x); + + x = a; + y = b; + z = c; + } + + PX_INLINE PxExtendedVec3 cross(const PxExtendedVec3& v) const + { + PxExtendedVec3 temp; + temp.cross(*this,v); + return temp; + } + + PX_INLINE void cross(const PxVec3& left, const PxExtendedVec3& right) + { + // temps needed in case left or right is this. + PxExtended a = (PxExtended(left.y) * right.z) - (PxExtended(left.z) * right.y); + PxExtended b = (PxExtended(left.z) * right.x) - (PxExtended(left.x) * right.z); + PxExtended c = (PxExtended(left.x) * right.y) - (PxExtended(left.y) * right.x); + + x = a; + y = b; + z = c; + } + + PX_INLINE PxExtendedVec3 operator-() const + { + return PxExtendedVec3(-x, -y, -z); + } + + PX_INLINE PxExtendedVec3& operator+=(const PxExtendedVec3& v) + { + x += v.x; + y += v.y; + z += v.z; + return *this; + } + + PX_INLINE PxExtendedVec3& operator-=(const PxExtendedVec3& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } + + PX_INLINE PxExtendedVec3& operator+=(const PxVec3& v) + { + x += PxExtended(v.x); + y += PxExtended(v.y); + z += PxExtended(v.z); + return *this; + } + + PX_INLINE PxExtendedVec3& operator-=(const PxVec3& v) + { + x -= PxExtended(v.x); + y -= PxExtended(v.y); + z -= PxExtended(v.z); + return *this; + } + + PX_INLINE PxExtendedVec3& operator*=(const PxReal& s) + { + x *= PxExtended(s); + y *= PxExtended(s); + z *= PxExtended(s); + return *this; + } + + PX_INLINE PxExtendedVec3 operator+(const PxExtendedVec3& v) const + { + return PxExtendedVec3(x + v.x, y + v.y, z + v.z); + } + + PX_INLINE PxVec3 operator-(const PxExtendedVec3& v) const + { + return PxVec3(PxReal(x - v.x), PxReal(y - v.y), PxReal(z - v.z)); + } + + PX_INLINE PxExtended& operator[](int index) + { + PX_ASSERT(index>=0 && index<=2); + + return reinterpret_cast(this)[index]; + } + + + PX_INLINE PxExtended operator[](int index) const + { + PX_ASSERT(index>=0 && index<=2); + + return reinterpret_cast(this)[index]; + } + + PxExtended x,y,z; +}; + + PX_FORCE_INLINE PxVec3 toVec3(const PxExtendedVec3& v) + { + return PxVec3(float(v.x), float(v.y), float(v.z)); + } + +#else +// Big worlds not defined + +typedef PxVec3 PxExtendedVec3; +typedef PxReal PxExtended; +#define PX_MAX_EXTENDED PX_MAX_F32 +#define PxExtendedAbs(x) fabsf(x) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/collision/PxCollisionDefs.h b/modules/PhysX/physx/physx-sys/physx/physx/include/collision/PxCollisionDefs.h new file mode 100644 index 0000000..134c61c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/collision/PxCollisionDefs.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_COLLISION_DEFS_H +#define PX_COLLISION_DEFS_H + +#include "PxPhysXConfig.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A callback class to allocate memory to cache information used in contact generation. +*/ +class PxCacheAllocator +{ +public: + /** + \brief Allocates cache data for contact generation. This data is stored inside PxCache objects. + The application can retain and provide this information for future contact generation passes + for a given pair to improve contact generation performance. It is the application's responsibility + to release this memory appropriately. If the memory is released, the application must ensure that + this memory is no longer referenced by any PxCache objects passed to PxGenerateContacts. + + \param byteSize [in] size of the allocation in bytes + + \return the newly-allocated memory. The returned address must be 16-byte aligned. + + @see PxCache, PxGenerateContacts + */ + virtual PxU8* allocateCacheData(const PxU32 byteSize) = 0; + + virtual ~PxCacheAllocator() {} +}; + +/** +\brief A structure to cache contact information produced by low-level contact generation functions. +*/ +struct PxCache +{ + PxU8* mCachedData; //!< Cached data pointer. Allocated via PxCacheAllocator + PxU16 mCachedSize; //!< The total size of the cached data + PxU8 mPairData; //!< Pair data information used and cached internally by some contact generation functions to accelerate performance. + PxU8 mManifoldFlags; //!< Manifold flags used to identify the format the cached data is stored in. @see Gu::ManifoldFlags + + PX_FORCE_INLINE PxCache() : mCachedData(NULL), mCachedSize(0), mPairData(0), mManifoldFlags(0) + { + } + + PX_FORCE_INLINE void reset() + { + mCachedData = NULL; + mCachedSize = 0; + mPairData = 0; + mManifoldFlags = 0; + } +}; + +#if !PX_DOXYGEN +} +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxBase.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxBase.h new file mode 100644 index 0000000..b3ee5f7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxBase.h @@ -0,0 +1,239 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BASE_H +#define PX_BASE_H + +/** \addtogroup common +@{ +*/ + +#include "foundation/PxFlags.h" +#include "common/PxSerialFramework.h" +#include "common/PxCollection.h" +#include "common/PxTypeInfo.h" +#include // For strcmp +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +typedef PxU16 PxType; + +/** +\brief Flags for PxBase. +*/ +struct PxBaseFlag +{ + enum Enum + { + eOWNS_MEMORY = (1<<0), + eIS_RELEASABLE = (1<<1) + }; +}; + +typedef PxFlags PxBaseFlags; +PX_FLAGS_OPERATORS(PxBaseFlag::Enum, PxU16) + +/** +\brief Base class for objects that can be members of a PxCollection. + +All PxBase sub-classes can be serialized. + +@see PxCollection +*/ +class PxBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief Releases the PxBase instance, please check documentation of release in derived class. + */ + virtual void release() = 0; + + /** + \brief Returns string name of dynamic type. + \return Class name of most derived type of this object. + */ + virtual const char* getConcreteTypeName() const = 0; + + /* brief Implements dynamic cast functionality. + + Example use: + + if(actor->is()) {...} + + \return A pointer to the specified type if object matches, otherwise NULL + */ + template T* is() { return typeMatch() ? static_cast(this) : NULL; } + + /* brief Implements dynamic cast functionality for const objects. + + Example use: + + if(actor->is()) {...} + + \return A pointer to the specified type if object matches, otherwise NULL + */ + template const T* is() const { return typeMatch() ? static_cast(this) : NULL; } + + /** + \brief Returns concrete type of object. + \return PxConcreteType::Enum of serialized object + + @see PxConcreteType + */ + PX_FORCE_INLINE PxType getConcreteType() const { return mConcreteType; } + + /** + \brief Set PxBaseFlag + + \param[in] flag The flag to be set + \param[in] value The flags new value + */ + PX_FORCE_INLINE void setBaseFlag(PxBaseFlag::Enum flag, bool value) { mBaseFlags = value ? mBaseFlags|flag : mBaseFlags&~flag; } + + /** + \brief Set PxBaseFlags + + \param[in] inFlags The flags to be set + + @see PxBaseFlags + */ + PX_FORCE_INLINE void setBaseFlags(PxBaseFlags inFlags) { mBaseFlags = inFlags; } + + /** + \brief Returns PxBaseFlags + + \return PxBaseFlags + + @see PxBaseFlags + */ + PX_FORCE_INLINE PxBaseFlags getBaseFlags() const { return mBaseFlags; } + + /** + \brief Whether the object is subordinate. + + A class is subordinate, if it can only be instantiated in the context of another class. + + \return Whether the class is subordinate + + @see PxSerialization::isSerializable + */ + virtual bool isReleasable() const { return mBaseFlags & PxBaseFlag::eIS_RELEASABLE; } + +protected: + /** + \brief Constructor setting concrete type and base flags. + */ + PX_INLINE PxBase(PxType concreteType, PxBaseFlags baseFlags) + : mConcreteType(concreteType), mBaseFlags(baseFlags), mBuiltInRefCount(1) {} + + /** + \brief Deserialization constructor setting base flags. + */ + PX_INLINE PxBase(PxBaseFlags baseFlags) : mBaseFlags(baseFlags) + { + PX_ASSERT(mBuiltInRefCount == 1); + } + /** + \brief Destructor. + */ + virtual ~PxBase() {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* superClass) const { return !::strcmp(superClass, "PxBase"); } + + template bool typeMatch() const + { + return PxU32(PxTypeInfo::eFastTypeId)!=PxU32(PxConcreteType::eUNDEFINED) ? + PxU32(getConcreteType()) == PxU32(PxTypeInfo::eFastTypeId) : isKindOf(PxTypeInfo::name()); + } + +private: + friend void getBinaryMetaData_PxBase(PxOutputStream& stream); + +protected: + PxType mConcreteType; // concrete type identifier - see PxConcreteType. + PxBaseFlags mBaseFlags; // internal flags + PxU32 mBuiltInRefCount; +}; + +/** +\brief Base class for ref-counted objects. +*/ +class PxRefCounted : public PxBase +{ +public: + + /** + \brief Decrements the reference count of the object and releases it if the new reference count is zero. + */ + virtual void release() = 0; + + /** + \brief Returns the reference count of the object. + + At creation, the reference count of the object is 1. Every other object referencing this object increments the + count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically. + + \return the current reference count. + */ + virtual PxU32 getReferenceCount() const = 0; + + /** + \brief Acquires a counted reference to this object. + + This method increases the reference count of the object by 1. Decrement the reference count by calling release() + */ + virtual void acquireReference() = 0; + +protected: + virtual void onRefCountZero() { delete this; } + + PX_INLINE PxRefCounted(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxRefCounted(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxRefCounted() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRefCounted", name) || PxBase::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCollection.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCollection.h new file mode 100644 index 0000000..84d67e5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCollection.h @@ -0,0 +1,277 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_COLLECTION_H +#define PX_COLLECTION_H + +#include "common/PxSerialFramework.h" + +/** \addtogroup common +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBase; + +/** +\brief Collection class for serialization. + +A collection is a set of PxBase objects. PxBase objects can be added to the collection +regardless of other objects they depend on. Objects may be named using PxSerialObjectId values in order +to resolve dependencies between objects of different collections. + +Serialization and deserialization only work through collections. + +A scene is typically serialized using the following steps: + + -# create a serialization registry + -# create a collection for scene objects + -# complete the scene objects (adds all dependent objects, e.g. meshes) + -# serialize collection + -# release collection + -# release serialization registry + +For example the code may look like this: + +\code + PxPhysics* physics; // The physics + PxScene* scene; // The physics scene + SerialStream s; // The user-defined stream doing the actual write to disk + + PxSerializationRegistry* registry = PxSerialization::createSerializationRegistry(*physics); // step 1) + PxCollection* collection = PxSerialization::createCollection(*scene); // step 2) + PxSerialization::complete(*collection, *registry); // step 3) + PxSerialization::serializeCollectionToBinary(s, *collection, *registry); // step 4) + collection->release(); // step 5) + registry->release(); // step 6) +\endcode + +A scene is typically deserialized using the following steps: + + -# load a serialized collection into memory + -# create a serialization registry + -# create a collection by passing the serialized memory block + -# add collected objects to scene + -# release collection + -# release serialization registry + +For example the code may look like this: + +\code + PxPhysics* physics; // The physics + PxScene* scene; // The physics scene + void* memory128; // a 128-byte aligned buffer previously loaded from disk by the user - step 1) + + PxSerializationRegistry* registry = PxSerialization::createSerializationRegistry(*physics); // step 2) + PxCollection* collection = PxSerialization::createCollectionFromBinary(memory128, *registry); // step 3) + scene->addCollection(*collection); // step 4) + collection->release(); // step 5) + registry->release(); // step 6) +\endcode + +@see PxBase, PxCreateCollection() +*/ +class PxCollection +{ +public: + + /** + \brief Adds a PxBase object to the collection. + + Adds a PxBase object to the collection. Optionally a PxSerialObjectId can be provided + in order to resolve dependencies between collections. A PxSerialObjectId value of PX_SERIAL_OBJECT_ID_INVALID + means the object remains without id. Objects can be added regardless of other objects they require. If the object + is already in the collection, the ID will be set if it was PX_SERIAL_OBJECT_ID_INVALID previously, otherwise the + operation fails. + + + \param[in] object Object to be added to the collection + \param[in] id Optional PxSerialObjectId id + */ + virtual void add(PxBase& object, PxSerialObjectId id = PX_SERIAL_OBJECT_ID_INVALID) = 0; + + /** + \brief Removes a PxBase member object from the collection. + + Object needs to be contained by the collection. + + \param[in] object PxBase object to be removed + */ + virtual void remove(PxBase& object) = 0; + + /** + \brief Returns whether the collection contains a certain PxBase object. + + \param[in] object PxBase object + \return Whether object is contained. + */ + virtual bool contains(PxBase& object) const = 0; + + /** + \brief Adds an id to a member PxBase object. + + If the object is already associated with an id within the collection, the id is replaced. + May only be called for objects that are members of the collection. The id needs to be unique + within the collection. + + \param[in] object Member PxBase object + \param[in] id PxSerialObjectId id to be given to the object + */ + virtual void addId(PxBase& object, PxSerialObjectId id) = 0; + + /** + \brief Removes id from a contained PxBase object. + + May only be called for ids that are associated with an object in the collection. + + \param[in] id PxSerialObjectId value + */ + virtual void removeId(PxSerialObjectId id) = 0; + + /** + \brief Adds all PxBase objects and their ids of collection to this collection. + + PxBase objects already in this collection are ignored. Object ids need to be conflict + free, i.e. the same object may not have two different ids within the two collections. + + \param[in] collection Collection to be added + */ + virtual void add(PxCollection& collection) = 0; + + /** + \brief Removes all PxBase objects of collection from this collection. + + PxBase objects not present in this collection are ignored. Ids of objects + which are removed are also removed. + + \param[in] collection Collection to be removed + */ + virtual void remove(PxCollection& collection) = 0; + + /** + \brief Gets number of PxBase objects in this collection. + + \return Number of objects in this collection + */ + virtual PxU32 getNbObjects() const = 0; + + /** + \brief Gets the PxBase object of this collection given its index. + + \param[in] index PxBase index in [0, getNbObjects()) + \return PxBase object at index index + */ + virtual PxBase& getObject(PxU32 index) const = 0; + + /** + \brief Copies member PxBase pointers to a user specified buffer. + + \param[out] userBuffer Array of PxBase pointers + \param[in] bufferSize Capacity of userBuffer + \param[in] startIndex Offset into list of member PxBase objects + \return number of members PxBase objects that have been written to the userBuffer + */ + virtual PxU32 getObjects(PxBase** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Looks for a PxBase object given a PxSerialObjectId value. + + If there is no PxBase object in the collection with the given id, NULL is returned. + + \param[in] id PxSerialObjectId value to look for + \return PxBase object with the given id value or NULL + */ + virtual PxBase* find(PxSerialObjectId id) const = 0; + + /** + \brief Gets number of PxSerialObjectId names in this collection. + + \return Number of PxSerialObjectId names in this collection + */ + virtual PxU32 getNbIds() const = 0; + + /** + \brief Copies member PxSerialObjectId values to a user specified buffer. + + \param[out] userBuffer Array of PxSerialObjectId values + \param[in] bufferSize Capacity of userBuffer + \param[in] startIndex Offset into list of member PxSerialObjectId values + \return number of members PxSerialObjectId values that have been written to the userBuffer + */ + virtual PxU32 getIds(PxSerialObjectId* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const = 0; + + /** + \brief Gets the PxSerialObjectId name of a PxBase object within the collection. + + The PxBase object needs to be a member of the collection. + + \param[in] object PxBase object to get id for + \return PxSerialObjectId name of the object or PX_SERIAL_OBJECT_ID_INVALID if the object is unnamed + */ + virtual PxSerialObjectId getId(const PxBase& object) const = 0; + + /** + \brief Deletes a collection object. + + This function only deletes the collection object, i.e. the container class. It doesn't delete objects + that are part of the collection. + + @see PxCreateCollection() + */ + + virtual void release() = 0; + +protected: + PxCollection() {} + virtual ~PxCollection() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief 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. + +\return The new collection object. + +@see PxCollection, PxCollection::release() +*/ +PX_C_EXPORT PX_PHYSX_COMMON_API physx::PxCollection* PX_CALL_CONV PxCreateCollection(); + + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCoreUtilityTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCoreUtilityTypes.h new file mode 100644 index 0000000..bc1ab80 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxCoreUtilityTypes.h @@ -0,0 +1,223 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CORE_UTILITY_TYPES_H +#define PX_CORE_UTILITY_TYPES_H +/** \addtogroup common +@{ +*/ + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +struct PxStridedData +{ + /** + \brief The offset in bytes between consecutive samples in the data. + + Default: 0 + */ + PxU32 stride; + const void* data; + + PxStridedData() : stride( 0 ), data( NULL ) {} + + template + PX_INLINE const TDataType& at( PxU32 idx ) const + { + PxU32 theStride( stride ); + if ( theStride == 0 ) + theStride = sizeof( TDataType ); + PxU32 offset( theStride * idx ); + return *(reinterpret_cast( reinterpret_cast< const PxU8* >( data ) + offset )); + } +}; + +template +struct PxTypedStridedData +{ + PxU32 stride; + const TDataType* data; + + PxTypedStridedData() + : stride( 0 ) + , data( NULL ) + { + } + + PxTypedStridedData(const TDataType* data_, PxU32 stride_ = 0) + : stride(stride_) + , data(data_) + { + } + + PX_INLINE const TDataType& at(PxU32 idx) const + { + PxU32 theStride(stride); + if (theStride == 0) + theStride = sizeof(TDataType); + PxU32 offset(theStride * idx); + return *(reinterpret_cast(reinterpret_cast(data) + offset)); + } +}; + +struct PxBoundedData : public PxStridedData +{ + PxU32 count; + PxBoundedData() : count( 0 ) {} +}; + +template +struct PxPadding +{ + PxU8 mPadding[TNumBytes]; + PxPadding() + { + for ( PxU8 idx =0; idx < TNumBytes; ++idx ) + mPadding[idx] = 0; + } +}; + +template class PxFixedSizeLookupTable +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + PxFixedSizeLookupTable() + : mNbDataPairs(0) + { + } + + PxFixedSizeLookupTable(const PxEMPTY) {} + + PxFixedSizeLookupTable(const PxReal* dataPairs, const PxU32 numDataPairs) + { + PxMemCopy(mDataPairs,dataPairs,sizeof(PxReal)*2*numDataPairs); + mNbDataPairs=numDataPairs; + } + + PxFixedSizeLookupTable(const PxFixedSizeLookupTable& src) + { + PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs); + mNbDataPairs=src.mNbDataPairs; + } + + ~PxFixedSizeLookupTable() + { + } + + PxFixedSizeLookupTable& operator=(const PxFixedSizeLookupTable& src) + { + PxMemCopy(mDataPairs,src.mDataPairs,sizeof(PxReal)*2*src.mNbDataPairs); + mNbDataPairs=src.mNbDataPairs; + return *this; + } + + PX_FORCE_INLINE void addPair(const PxReal x, const PxReal y) + { + PX_ASSERT(mNbDataPairs=x0)&&(x=getX(mNbDataPairs-1)); + return getY(mNbDataPairs-1); + } + + PxU32 getNbDataPairs() const {return mNbDataPairs;} + + void clear() + { + PxMemSet(mDataPairs, 0, NB_ELEMENTS*2*sizeof(PxReal)); + mNbDataPairs = 0; + } + + PX_FORCE_INLINE PxReal getX(const PxU32 i) const + { + return mDataPairs[2*i]; + } + PX_FORCE_INLINE PxReal getY(const PxU32 i) const + { + return mDataPairs[2*i+1]; + } + + PxReal mDataPairs[2*NB_ELEMENTS]; + PxU32 mNbDataPairs; + PxU32 mPad[3]; + + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxInsertionCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxInsertionCallback.h new file mode 100644 index 0000000..e9f3738 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxInsertionCallback.h @@ -0,0 +1,81 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_INSERTION_CALLBACK_H +#define PX_INSERTION_CALLBACK_H + +#include "common/PxBase.h" + +/** \addtogroup common +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Callback interface that permits TriangleMesh, Heightfield, ConvexMesh or BVH to be used + directly without the need to store the cooking results into a stream. + + Using this is advised only if real-time cooking is required; using "offline" cooking and + streams is otherwise preferred. + + The default PxInsertionCallback implementations must be used. The PxPhysics + default callback can be obtained using the PxPhysics::getPhysicsInsertionCallback(). + The PxCooking default callback can be obtained using the PxCooking::getStandaloneInsertionCallback(). + + @see PxCooking PxPhysics + */ + class PxInsertionCallback + { + public: + PxInsertionCallback() {} + + /** + \brief Builds object (TriangleMesh, Heightfield, ConvexMesh or BVH) from given data in PxPhysics. + + \param type Object type to build. + \param data Object data + \return PxBase Created object in PxPhysics. + */ + virtual PxBase* buildObjectFromData(PxConcreteType::Enum type, void* data) = 0; + + protected: + virtual ~PxInsertionCallback() {} + }; + + typedef PxInsertionCallback PxPhysicsInsertionCallback; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaData.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaData.h new file mode 100644 index 0000000..4b2e26a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaData.h @@ -0,0 +1,226 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_METADATA_H +#define PX_METADATA_H +/** \addtogroup physics +@{ +*/ + +#include "foundation/Px.h" +#include "foundation/PxIO.h" +#include "PxMetaDataFlags.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Struct to store meta data definitions. + + Note: The individual fields have different meaning depending on the meta data entry configuration. + */ + struct PxMetaDataEntry + { + const char* type; //!< Field type (bool, byte, quaternion, etc) + const char* name; //!< Field name (appears exactly as in the source file) + PxU32 offset; //!< Offset from the start of the class (ie from "this", field is located at "this"+Offset) + PxU32 size; //!< sizeof(Type) + PxU32 count; //!< Number of items of type Type (0 for dynamic sizes) + PxU32 offsetSize; //!< Offset of dynamic size param, for dynamic arrays + PxU32 flags; //!< Field parameters + PxU32 alignment; //!< Explicit alignment + }; + + #define PX_STORE_METADATA(stream, metaData) stream.write(&metaData, sizeof(PxMetaDataEntry)) + + #define PX_SIZE_OF(Class, Member) sizeof((reinterpret_cast(0))->Member) + + /** + \brief specifies a binary metadata entry for a member variable of a class + */ + #define PX_DEF_BIN_METADATA_ITEM(stream, Class, type, name, flags) \ + { \ + PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ + 1, 0, flags, 0}; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a member array variable of a class + \details similar to PX_DEF_BIN_METADATA_ITEMS_AUTO but for cases with mismatch between specified type and array type + */ + #define PX_DEF_BIN_METADATA_ITEMS(stream, Class, type, name, flags, count) \ + { \ + PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ + count, 0, flags, 0}; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a member array variable of a class + \details similar to PX_DEF_BIN_METADATA_ITEMS but automatically detects the array length, which only works when the specified + type matches the type of the array - does not support PxMetaDataFlag::ePTR + */ + #define PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Class, type, name, flags) \ + { \ + PxMetaDataEntry tmp = { #type, #name, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ + sizeof((reinterpret_cast(0))->name)/sizeof(type), 0, flags, 0}; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a class + */ + #define PX_DEF_BIN_METADATA_CLASS(stream, Class) \ + { \ + PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a virtual class + */ + #define PX_DEF_BIN_METADATA_VCLASS(stream, Class) \ + { \ + PxMetaDataEntry tmp = { #Class, 0, 0, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS|PxMetaDataFlag::eVIRTUAL, 0}; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a typedef + */ + #define PX_DEF_BIN_METADATA_TYPEDEF(stream, newType, oldType) \ + { \ + PxMetaDataEntry tmp = { #newType, #oldType, 0, 0, 0, 0, PxMetaDataFlag::eTYPEDEF, 0 }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for declaring a base class + */ + #define PX_DEF_BIN_METADATA_BASE_CLASS(stream, Class, BaseClass) \ + { \ + Class* myClass = reinterpret_cast(42); \ + BaseClass* s = static_cast(myClass); \ + const PxU32 offset = PxU32(size_t(s) - size_t(myClass)); \ + PxMetaDataEntry tmp = { #Class, #BaseClass, offset, sizeof(Class), 0, 0, PxMetaDataFlag::eCLASS, 0 }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a union + */ + #define PX_DEF_BIN_METADATA_UNION(stream, Class, name) \ + { \ + PxMetaDataEntry tmp = { #Class, 0, PxU32(PX_OFFSET_OF_RT(Class, name)), PX_SIZE_OF(Class, name), \ + 1, 0, PxMetaDataFlag::eUNION, 0 }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for a particular member type of a union + */ + #define PX_DEF_BIN_METADATA_UNION_TYPE(stream, Class, type, enumValue) \ + { \ + PxMetaDataEntry tmp = { #Class, #type, enumValue, 0, 0, 0, PxMetaDataFlag::eUNION, 0 }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for extra data + */ + #define PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, Class, type, control, align) \ + { \ + PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), sizeof(type), 0, PxU32(PX_SIZE_OF(Class, control)), \ + PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEM, align }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for an array of extra data + */ + #define PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, Class, type, control, count, flags, align) \ + { \ + PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), PxU32(PX_SIZE_OF(Class, control)), \ + PxU32(PX_OFFSET_OF_RT(Class, count)), PxU32(PX_SIZE_OF(Class, count)), \ + PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags, align }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for an array of extra data + additional to PX_DEF_BIN_METADATA_EXTRA_ITEMS a mask can be specified to interpret the control value + @see PxMetaDataFlag::eCONTROL_MASK + */ + #define PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, Class, type, control, controlMask ,count, flags, align) \ + { \ + PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, control)), PxU32(PX_SIZE_OF(Class, control)), \ + PxU32(PX_OFFSET_OF_RT(Class, count)), PxU32(PX_SIZE_OF(Class, count)), \ + PxMetaDataFlag::eCONTROL_MASK|PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_ITEMS|flags|(controlMask & PxMetaDataFlag::eCONTROL_MASK_RANGE) << 16, \ + align}; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for an array of extra data + \details similar to PX_DEF_BIN_METADATA_EXTRA_ITEMS, but supporting no control - PxMetaDataFlag::ePTR is also not supported + */ + #define PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Class, type, dyn_count, align, flags) \ + { \ + PxMetaDataEntry tmp = { #type, 0, PxU32(PX_OFFSET_OF_RT(Class, dyn_count)), PX_SIZE_OF(Class, dyn_count), align, 0, \ + PxMetaDataFlag::eEXTRA_DATA|flags, align }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry for an string of extra data + */ + #define PX_DEF_BIN_METADATA_EXTRA_NAME(stream, Class, control, align) \ + { \ + PxMetaDataEntry tmp = { "char", "string", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eEXTRA_NAME, align }; \ + PX_STORE_METADATA(stream, tmp); \ + } + + /** + \brief specifies a binary metadata entry declaring an extra data alignment for a class + */ + #define PX_DEF_BIN_METADATA_EXTRA_ALIGN(stream, Class, align) \ + { \ + PxMetaDataEntry tmp = { "PxU8", "Alignment", 0, 0, 0, 0, PxMetaDataFlag::eEXTRA_DATA|PxMetaDataFlag::eALIGNMENT, align}; \ + PX_STORE_METADATA(stream, tmp); \ + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaDataFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaDataFlags.h new file mode 100644 index 0000000..f7bdebe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxMetaDataFlags.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_METADATA_FLAGS_H +#define PX_METADATA_FLAGS_H + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Flags used to configure binary meta data entries, typically set through PX_DEF_BIN_METADATA defines. + + @see PxMetaDataEntry + */ + struct PxMetaDataFlag + { + enum Enum + { + eCLASS = (1<<0), //!< declares a class + eVIRTUAL = (1<<1), //!< declares class to be virtual + eTYPEDEF = (1<<2), //!< declares a typedef + ePTR = (1<<3), //!< declares a pointer + eHANDLE = (1<<4), //!< declares a handle + eEXTRA_DATA = (1<<5), //!< declares extra data exported with PxSerializer::exportExtraData + eEXTRA_ITEM = (1<<6), //!< specifies one element of extra data + eEXTRA_ITEMS = (1<<7), //!< specifies an array of extra data + eEXTRA_NAME = (1<<8), //!< specifies a name of extra data + eUNION = (1<<9), //!< declares a union + ePADDING = (1<<10), //!< declares explicit padding data + eALIGNMENT = (1<<11), //!< declares aligned data + eCOUNT_MASK_MSB = (1<<12), //!< specifies that the count value's most significant bit needs to be masked out + eCOUNT_SKIP_IF_ONE = (1<<13), //!< specifies that the count value is treated as zero for a variable value of one - special case for single triangle meshes + eCONTROL_FLIP = (1<<14), //!< specifies that the control value is the negate of the variable value + eCONTROL_MASK = (1<<15), //!< specifies that the control value is masked - mask bits are assumed to be within eCONTROL_MASK_RANGE + eCONTROL_MASK_RANGE = 0x000000FF, //!< mask range allowed for eCONTROL_MASK + eFORCE_DWORD = 0x7fffffff + }; + }; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxPhysXCommonConfig.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxPhysXCommonConfig.h new file mode 100644 index 0000000..794da10 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxPhysXCommonConfig.h @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSX_COMMON_CONFIG_H +#define PX_PHYSX_COMMON_CONFIG_H + +/** \addtogroup common +@{ */ + +#include "foundation/Px.h" + +/*Disable support for VS2017 prior version 15.5.1 for windows platform, because of a compiler bug: +https://developercommunity.visualstudio.com/content/problem/66047/possible-compiler-bug.html +*/ +#if (PX_VC == 15) && PX_WINDOWS && (_MSC_FULL_VER < 191225830) +#error Visual studio 2017 prior to 15.5.1 is not supported because of a compiler bug. +#endif + +// define API function declaration (public API only needed because of extensions) +#if defined PX_PHYSX_STATIC_LIB + #define PX_PHYSX_CORE_API +#else + #if PX_WINDOWS_FAMILY + #if defined PX_PHYSX_CORE_EXPORTS + #define PX_PHYSX_CORE_API __declspec(dllexport) + #else + #define PX_PHYSX_CORE_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_CORE_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_CORE_API + #endif +#endif + +#if PX_SUPPORT_GPU_PHYSX +// define API function declaration +#if defined PX_PHYSX_GPU_STATIC + #define PX_PHYSX_GPU_API +#else + #if PX_WINDOWS + #if defined PX_PHYSX_GPU_EXPORTS + #define PX_PHYSX_GPU_API __declspec(dllexport) + #else + #define PX_PHYSX_GPU_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_GPU_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_GPU_API + #endif +#endif + +#else // PX_SUPPORT_GPU_PHYSX +#define PX_PHYSX_GPU_API +#endif // PX_SUPPORT_GPU_PHYSX + +#if defined PX_PHYSX_STATIC_LIB + #define PX_PHYSX_COMMON_API +#else + #if PX_WINDOWS_FAMILY && !defined(__CUDACC__) + #if defined PX_PHYSX_COMMON_EXPORTS + #define PX_PHYSX_COMMON_API __declspec(dllexport) + #else + #define PX_PHYSX_COMMON_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_COMMON_API PX_UNIX_EXPORT + #else + #define PX_PHYSX_COMMON_API + #endif +#endif + +// PT: typical "invalid" value in various CD algorithms +#define PX_INVALID_U32 0xffffffff +#define PX_INVALID_U16 0xffff + +// Changing these parameters requires recompilation of the SDK + +// Enable debug visualization +#define PX_ENABLE_DEBUG_VISUALIZATION 1 +#define PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION + +// Enable simulation statistics generation +#define PX_ENABLE_SIM_STATS 1 +#define PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + +#if !PX_DOXYGEN +namespace physx +{ +#endif + typedef PxU32 PxTriangleID; + typedef PxU16 PxMaterialTableIndex; + typedef PxU16 PxFEMMaterialTableIndex; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxProfileZone.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxProfileZone.h new file mode 100644 index 0000000..a562940 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxProfileZone.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_ZONE_H +#define PX_PROFILE_ZONE_H + +#include "foundation/PxProfiler.h" +#include "foundation/PxFoundation.h" + +#if PX_DEBUG || PX_CHECKED || PX_PROFILE + #define PX_PROFILE_ZONE(x, y) \ + physx::PxProfileScoped PX_CONCAT(_scoped, __LINE__)(PxGetProfilerCallback(), x, false, y) + #define PX_PROFILE_START_CROSSTHREAD(x, y) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->zoneStart(x, true, y) + #define PX_PROFILE_STOP_CROSSTHREAD(x, y) \ + if(PxGetProfilerCallback()) \ + PxGetProfilerCallback()->zoneEnd(NULL, x, true, y) +#else + #define PX_PROFILE_ZONE(x, y) + #define PX_PROFILE_START_CROSSTHREAD(x, y) + #define PX_PROFILE_STOP_CROSSTHREAD(x, y) +#endif + +#define PX_PROFILE_POINTER_TO_U64(pointer) static_cast(reinterpret_cast(pointer)) + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderBuffer.h new file mode 100644 index 0000000..23baf4a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderBuffer.h @@ -0,0 +1,167 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RENDER_BUFFER_H +#define PX_RENDER_BUFFER_H + +/** \addtogroup common +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Default color values used for debug rendering. +*/ +struct PxDebugColor +{ + enum Enum + { + eARGB_BLACK = 0xff000000, + eARGB_RED = 0xffff0000, + eARGB_GREEN = 0xff00ff00, + eARGB_BLUE = 0xff0000ff, + eARGB_YELLOW = 0xffffff00, + eARGB_MAGENTA = 0xffff00ff, + eARGB_CYAN = 0xff00ffff, + eARGB_WHITE = 0xffffffff, + eARGB_GREY = 0xff808080, + eARGB_DARKRED = 0xff880000, + eARGB_DARKGREEN = 0xff008800, + eARGB_DARKBLUE = 0xff000088 + }; +}; + + +/** +\brief Used to store a single point and colour for debug rendering. +*/ +struct PxDebugPoint +{ + PxDebugPoint(const PxVec3& p, const PxU32& c) + : pos(p), color(c) {} + + PxVec3 pos; + PxU32 color; +}; + +/** +\brief Used to store a single line and colour for debug rendering. +*/ +struct PxDebugLine +{ + PxDebugLine(const PxVec3& p0, const PxVec3& p1, const PxU32& c) + : pos0(p0), color0(c), pos1(p1), color1(c) {} + + PxVec3 pos0; + PxU32 color0; + PxVec3 pos1; + PxU32 color1; +}; + +/** +\brief Used to store a single triangle and colour for debug rendering. +*/ +struct PxDebugTriangle +{ + PxDebugTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxU32& c) + : pos0(p0), color0(c), pos1(p1), color1(c), pos2(p2), color2(c) {} + + PxVec3 pos0; + PxU32 color0; + PxVec3 pos1; + PxU32 color1; + PxVec3 pos2; + PxU32 color2; +}; + +/** +\brief Used to store a text for debug rendering. Doesn't own 'string' array. +*/ +struct PxDebugText +{ + PxDebugText() : string(0) + { + } + + PxDebugText(const PxVec3& pos, const PxReal& sz, const PxU32& clr, const char* str) + : position(pos), size(sz), color(clr), string(str) + { + } + + PxVec3 position; + PxReal size; + PxU32 color; + const char* string; +}; + + +/** +\brief Interface for points, lines, triangles, and text buffer. +*/ +class PxRenderBuffer +{ +public: + virtual ~PxRenderBuffer() {} + + virtual PxU32 getNbPoints() const = 0; + virtual const PxDebugPoint* getPoints() const = 0; + virtual void addPoint(const PxDebugPoint& point) = 0; + + virtual PxU32 getNbLines() const = 0; + virtual const PxDebugLine* getLines() const = 0; + virtual void addLine(const PxDebugLine& line) = 0; + virtual PxDebugLine* reserveLines(const PxU32 nbLines) = 0; + virtual PxDebugPoint* reservePoints(const PxU32 nbLines) = 0; + + virtual PxU32 getNbTriangles() const = 0; + virtual const PxDebugTriangle* getTriangles() const = 0; + virtual void addTriangle(const PxDebugTriangle& triangle) = 0; + + virtual void append(const PxRenderBuffer& other) = 0; + virtual void clear() = 0; + + virtual void shift(const PxVec3& delta) = 0; + + virtual bool empty() const = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderOutput.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderOutput.h new file mode 100644 index 0000000..2bc16f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxRenderOutput.h @@ -0,0 +1,404 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RENDER_OUTPUT_H +#define PX_RENDER_OUTPUT_H + +#include "foundation/PxMat44.h" +#include "foundation/PxBasicTemplates.h" +#include "PxRenderBuffer.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + + /** + Output stream to fill RenderBuffer + */ + class PX_PHYSX_COMMON_API PxRenderOutput + { + public: + + enum Primitive + { + POINTS, + LINES, + LINESTRIP, + TRIANGLES, + TRIANGLESTRIP + }; + + PxRenderOutput(PxRenderBuffer& buffer) + : mPrim(POINTS), + mColor(0), + mVertex0(0.0f), + mVertex1(0.0f), + mVertexCount(0), + mTransform(PxIdentity), + mBuffer(buffer) + { + } + + PX_INLINE PxRenderOutput& operator<<(Primitive prim); + + PX_INLINE PxRenderOutput& operator<<(PxU32 color) ; + + PX_INLINE PxRenderOutput& operator<<(const PxMat44& transform); + + PX_INLINE PxRenderOutput& operator<<(const PxTransform& t); + + PX_INLINE PxRenderOutput& operator<<(const PxVec3& vertex); //AM: Don't use this! Slow! Deprecated! + + PX_INLINE PxDebugLine* reserveSegments(PxU32 nbSegments); + + PX_INLINE PxDebugPoint* reservePoints(PxU32 nbSegments); + + PX_INLINE void outputSegment(const PxVec3& v0, const PxVec3& v1); + + PX_INLINE PxRenderOutput& outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose); + + private: + + PxRenderOutput& operator=(const PxRenderOutput&); + + Primitive mPrim; + PxU32 mColor; + PxVec3 mVertex0, mVertex1; + PxU32 mVertexCount; + PxMat44 mTransform; + PxRenderBuffer& mBuffer; + }; + + struct PxDebugBox + { + explicit PxDebugBox(const PxVec3& extents, bool wireframe_ = true) + : minimum(-extents), maximum(extents), wireframe(wireframe_) {} + + explicit PxDebugBox(const PxVec3& pos, const PxVec3& extents, bool wireframe_ = true) + : minimum(pos - extents), maximum(pos + extents), wireframe(wireframe_) {} + + explicit PxDebugBox(const PxBounds3& bounds, bool wireframe_ = true) + : minimum(bounds.minimum), maximum(bounds.maximum), wireframe(wireframe_) {} + + PxVec3 minimum, maximum; + bool wireframe; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBox& box) + { + if (box.wireframe) + { + out << PxRenderOutput::LINESTRIP; + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); + out << PxRenderOutput::LINES; + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); + } + else + { + out << PxRenderOutput::TRIANGLESTRIP; + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0 + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2 + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1 + out << PxVec3(box.maximum.x, box.maximum.y, box.minimum.z); // 3 + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7 + out << PxVec3(box.minimum.x, box.maximum.y, box.minimum.z); // 2 + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6 + out << PxVec3(box.minimum.x, box.minimum.y, box.minimum.z); // 0 + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4 + out << PxVec3(box.maximum.x, box.minimum.y, box.minimum.z); // 1 + out << PxVec3(box.maximum.x, box.minimum.y, box.maximum.z); // 5 + out << PxVec3(box.maximum.x, box.maximum.y, box.maximum.z); // 7 + out << PxVec3(box.minimum.x, box.minimum.y, box.maximum.z); // 4 + out << PxVec3(box.minimum.x, box.maximum.y, box.maximum.z); // 6 + } + return out; + } + + struct PxDebugArrow + { + PxDebugArrow(const PxVec3& pos, const PxVec3& vec) + : base(pos), tip(pos + vec), headLength(vec.magnitude()*0.15f) {} + + PxDebugArrow(const PxVec3& pos, const PxVec3& vec, PxReal headLength_) + : base(pos), tip(pos + vec), headLength(headLength_) {} + + PxVec3 base, tip; + PxReal headLength; + }; + PX_FORCE_INLINE void normalToTangents(const PxVec3& normal, PxVec3& tangent0, PxVec3& tangent1) + { + tangent0 = PxAbs(normal.x) < 0.70710678f ? PxVec3(0, -normal.z, normal.y) : PxVec3(-normal.y, normal.x, 0); + tangent0.normalize(); + tangent1 = normal.cross(tangent0); + } + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArrow& arrow) + { + PxVec3 t0 = arrow.tip - arrow.base, t1, t2; + + t0.normalize(); + normalToTangents(t0, t1, t2); + + const PxReal tipAngle = 0.25f; + t1 *= arrow.headLength * tipAngle; + t2 *= arrow.headLength * tipAngle * PxSqrt(3.0f); + PxVec3 headBase = arrow.tip - t0 * arrow.headLength; + + out << PxRenderOutput::LINES; + out << arrow.base << arrow.tip; + + out << PxRenderOutput::TRIANGLESTRIP; + out << arrow.tip; + out << headBase + t1 + t1; + out << headBase - t1 - t2; + out << headBase - t1 + t2; + out << arrow.tip; + out << headBase + t1 + t1; + return out; + } + + struct PxDebugBasis + { + PxDebugBasis(const PxVec3& ext, PxU32 cX = PxU32(PxDebugColor::eARGB_RED), + PxU32 cY = PxU32(PxDebugColor::eARGB_GREEN), PxU32 cZ = PxU32(PxDebugColor::eARGB_BLUE)) + : extends(ext), colorX(cX), colorY(cY), colorZ(cZ) {} + PxVec3 extends; + PxU32 colorX, colorY, colorZ; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugBasis& basis) + { + const PxReal headLength = basis.extends.magnitude() * 0.15f; + out << basis.colorX << PxDebugArrow(PxVec3(0.0f), PxVec3(basis.extends.x, 0, 0), headLength); + out << basis.colorY << PxDebugArrow(PxVec3(0.0f), PxVec3(0, basis.extends.y, 0), headLength); + out << basis.colorZ << PxDebugArrow(PxVec3(0.0f), PxVec3(0, 0, basis.extends.z), headLength); + return out; + } + + struct PxDebugCircle + { + PxDebugCircle(PxU32 s, PxReal r) + : nSegments(s), radius(r) {} + PxU32 nSegments; + PxReal radius; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugCircle& circle) + { + const PxF32 step = PxTwoPi / circle.nSegments; + PxF32 angle = 0; + out << PxRenderOutput::LINESTRIP; + for (PxU32 i = 0; i < circle.nSegments; i++, angle += step) + out << PxVec3(circle.radius * PxSin(angle), circle.radius * PxCos(angle), 0); + out << PxVec3(0, circle.radius, 0); + return out; + } + + struct PxDebugArc + { + PxDebugArc(PxU32 s, PxReal r, PxReal minAng, PxReal maxAng) + : nSegments(s), radius(r), minAngle(minAng), maxAngle(maxAng) {} + PxU32 nSegments; + PxReal radius; + PxReal minAngle, maxAngle; + }; + PX_FORCE_INLINE PxRenderOutput& operator<<(PxRenderOutput& out, const PxDebugArc& arc) + { + const PxF32 step = (arc.maxAngle - arc.minAngle) / arc.nSegments; + PxF32 angle = arc.minAngle; + out << PxRenderOutput::LINESTRIP; + for (PxU32 i = 0; i < arc.nSegments; i++, angle += step) + out << PxVec3(arc.radius * PxSin(angle), arc.radius * PxCos(angle), 0); + out << PxVec3(arc.radius * PxSin(arc.maxAngle), arc.radius * PxCos(arc.maxAngle), 0); + return out; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(Primitive prim) + { + mPrim = prim; + mVertexCount = 0; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(PxU32 color) + { + mColor = color; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxMat44& transform) + { + mTransform = transform; + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxTransform& t) + { + mTransform = PxMat44(t); + return *this; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::operator<<(const PxVec3& vertexIn) + { + // apply transformation + const PxVec3 vertex = mTransform.transform(vertexIn); + ++mVertexCount; + + // add primitive to render buffer + switch (mPrim) + { + case POINTS: + mBuffer.addPoint(PxDebugPoint(vertex, mColor)); break; + case LINES: + if (mVertexCount == 2) + { + mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor)); + mVertexCount = 0; + } + break; + case LINESTRIP: + if (mVertexCount >= 2) + mBuffer.addLine(PxDebugLine(mVertex0, vertex, mColor)); + break; + case TRIANGLES: + if (mVertexCount == 3) + { + mBuffer.addTriangle(PxDebugTriangle(mVertex1, mVertex0, vertex, mColor)); + mVertexCount = 0; + } + break; + case TRIANGLESTRIP: + if (mVertexCount >= 3) + mBuffer.addTriangle(PxDebugTriangle( + (mVertexCount & 0x1) ? mVertex0 : mVertex1, + (mVertexCount & 0x1) ? mVertex1 : mVertex0, vertex, mColor)); + break; + } + + // cache the last 2 vertices (for strips) + if (1 < mVertexCount) + { + mVertex1 = mVertex0; + mVertex0 = vertex; + } + else + { + mVertex0 = vertex; + } + return *this; + } + + PX_INLINE PxDebugLine* PxRenderOutput::reserveSegments(PxU32 nbSegments) + { + return mBuffer.reserveLines(nbSegments); + } + + PX_INLINE PxDebugPoint* PxRenderOutput::reservePoints(PxU32 nbPoints) + { + return mBuffer.reservePoints(nbPoints); + } + + // PT: using the operators is just too slow. + PX_INLINE void PxRenderOutput::outputSegment(const PxVec3& v0, const PxVec3& v1) + { + PxDebugLine* segment = mBuffer.reserveLines(1); + segment->pos0 = v0; + segment->pos1 = v1; + segment->color0 = segment->color1 = mColor; + } + + PX_INLINE PxRenderOutput& PxRenderOutput::outputCapsule(PxF32 radius, PxF32 halfHeight, const PxMat44& absPose) + { + PxRenderOutput& out = *this; + + const PxVec3 vleft2(-halfHeight, 0.0f, 0.0f); + PxMat44 left2 = absPose; + left2.column3 += PxVec4(left2.rotate(vleft2), 0.0f); + out << left2 << PxDebugArc(100, radius, PxPi, PxTwoPi); + + PxMat44 rotPose = left2; + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + out << rotPose << PxDebugArc(100, radius, PxPi, PxTwoPi); + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + out << rotPose << PxDebugCircle(100, radius); + + const PxVec3 vright2(halfHeight, 0.0f, 0.0f); + PxMat44 right2 = absPose; + right2.column3 += PxVec4(right2.rotate(vright2), 0.0f); + out << right2 << PxDebugArc(100, radius, 0.0f, PxPi); + + rotPose = right2; + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + out << rotPose << PxDebugArc(100, radius, 0.0f, PxPi); + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + out << rotPose << PxDebugCircle(100, radius); + + out << absPose; + out.outputSegment(absPose.transform(PxVec3(-halfHeight, radius, 0)), + absPose.transform(PxVec3(halfHeight, radius, 0))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, -radius, 0)), + absPose.transform(PxVec3(halfHeight, -radius, 0))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, radius)), + absPose.transform(PxVec3(halfHeight, 0, radius))); + out.outputSegment(absPose.transform(PxVec3(-halfHeight, 0, -radius)), + absPose.transform(PxVec3(halfHeight, 0, -radius))); + + return *this; + } + +#if PX_VC +#pragma warning(pop) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerialFramework.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerialFramework.h new file mode 100644 index 0000000..22bc3c3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerialFramework.h @@ -0,0 +1,402 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SERIAL_FRAMEWORK_H +#define PX_SERIAL_FRAMEWORK_H + +/** \addtogroup common +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +typedef PxU16 PxType; +class PxBase; +class PxSerializationContext; +class PxRepXSerializer; +class PxSerializer; +class PxPhysics; +class PxCollection; + +//! Default serialization alignment +#define PX_SERIAL_ALIGN 16 + +//! Serialized input data must be aligned to this value +#define PX_SERIAL_FILE_ALIGN 128 + +//! PxSerialObjectId value for objects that do not have an ID +#define PX_SERIAL_OBJECT_ID_INVALID 0 + +//! ID type for PxBase objects in a PxCollection +typedef PxU64 PxSerialObjectId; + +//! Bit to mark pointer type references, @see PxDeserializationContext +#define PX_SERIAL_REF_KIND_PTR_TYPE_BIT (1u<<31) + +//! Reference kind value for PxBase objects +#define PX_SERIAL_REF_KIND_PXBASE (0 | PX_SERIAL_REF_KIND_PTR_TYPE_BIT) + +//! Reference kind value for material indices +#define PX_SERIAL_REF_KIND_MATERIAL_IDX (1) + +//! Used to fix multi-byte characters warning from gcc for situations like: PxU32 foo = 'CCTS'; +#define PX_MAKE_FOURCC(a, b, c, d) ( (a) | ((b)<<8) | ((c)<<16) | ((d)<<24) ) + +/** +\brief Callback class used to process PxBase objects. + +@see PxSerializer::requires +*/ +class PxProcessPxBaseCallback +{ +public: + virtual ~PxProcessPxBaseCallback() {} + virtual void process(PxBase&) = 0; +}; + + +/** +\brief Binary serialization context class. + +This class is used to register reference values and write object +and object extra data during serialization. +It is mainly used by the serialization framework. Except for custom +serializable types, users should not have to worry about it. + +@see PxDeserializationContext +*/ +class PxSerializationContext +{ +public: + + /** + \brief Registers a reference value corresponding to a PxBase object. + + This method is assumed to be called in the implementation of PxSerializer::registerReferences for serialized + references that need to be resolved on deserialization. + + A reference needs to be associated with exactly one PxBase object in either the collection or the + external references collection. + + Different kinds of references are supported and need to be specified. In the most common case + (PX_SERIAL_REF_KIND_PXBASE) the PxBase object matches the reference value (which is the pointer + to the PxBase object). Integer references maybe registered as well (used for internal material + indices with PX_SERIAL_REF_KIND_MATERIAL_IDX). Other kinds could be added with the restriction that + for pointer types the kind value needs to be marked with the PX_SERIAL_REF_KIND_PTR_TYPE_BIT. + + \param[in] base PxBase object associated with the reference + \param[in] kind What kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind) + \param[in] reference Value of reference + + @see PxDeserializationContext::resolveReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, PxSerializer::registerReferences + */ + virtual void registerReference(PxBase& base, PxU32 kind, size_t reference) = 0; + + /** + \brief Returns the collection that is being serialized. + */ + virtual const PxCollection& getCollection() const = 0; + + /** + \brief Serializes object data and object extra data. + + This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + + @see PxSerializer::exportData, PxSerializer::exportExtraData, PxSerializer::createObject, PxDeserializationContext::readExtraData + */ + virtual void writeData(const void* data, PxU32 size) = 0; + + /** + \brief Aligns the serialized data. + + This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + + @see PxSerializer::exportData, PxSerializer::exportExtraData, PxDeserializationContext::alignExtraData + */ + virtual void alignData(PxU32 alignment = PX_SERIAL_ALIGN) = 0; + + /** + \brief Helper function to write a name to the extraData if serialization is configured to save names. + + This function is assumed to be called within the implementation of PxSerializer::exportExtraData. + + @see PxSerialization::serializeCollectionToBinary, PxDeserializationContext::readName + */ + virtual void writeName(const char* name) = 0; + +protected: + + PxSerializationContext() {} + virtual ~PxSerializationContext() {} +}; + + +/** +\brief Binary deserialization context class. + +This class is used to resolve references and access extra data during deserialization. +It is mainly used by the serialization framework. Except for custom +serializable types, users should not have to worry about it. + +@see PxSerializationContext +*/ +class PxDeserializationContext +{ +public: + + /** + \brief Retrieves a pointer to a deserialized PxBase object given a corresponding deserialized reference value + + This method is assumed to be called in the implementation of PxSerializer::createObject in order + to update reference values on deserialization. + + To update a PxBase reference the corresponding deserialized pointer value needs to be provided in order to retrieve + the location of the corresponding deserialized PxBase object. (PxDeserializationContext::translatePxBase simplifies + this common case). + + For other kinds of references the reverence values need to be updated by deduction given the corresponding PxBase instance. + + \param[in] kind What kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind) + \param[in] reference Deserialized reference value + \return PxBase object associated with the reference value + + @see PxSerializationContext::registerReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, translatePxBase + */ + virtual PxBase* resolveReference(PxU32 kind, size_t reference) const = 0; + + /** + \brief Helper function to update PxBase pointer on deserialization + + @see resolveReference, PX_SERIAL_REF_KIND_PXBASE + */ + template + void translatePxBase(T*& base) { if (base) { base = static_cast(resolveReference(PX_SERIAL_REF_KIND_PXBASE, size_t(base))); } } + + /** + \brief Helper function to read a name from the extra data during deserialization. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + @see PxSerializationContext::writeName + */ + PX_INLINE void readName(const char*& name) + { + PxU32 len = *reinterpret_cast(mExtraDataAddress); + mExtraDataAddress += sizeof(len); + name = len ? reinterpret_cast(mExtraDataAddress) : NULL; + mExtraDataAddress += len; + } + + /** + \brief Function to read extra data during deserialization. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + @see PxSerializationContext::writeData, PxSerializer::createObject + */ + template + PX_INLINE T* readExtraData(PxU32 count=1) + { + T* data = reinterpret_cast(mExtraDataAddress); + mExtraDataAddress += sizeof(T)*count; + return data; + } + + /** + \brief Function to read extra data during deserialization optionally aligning the extra data stream before reading. + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + @see PxSerializationContext::writeData, PxDeserializationContext::alignExtraData, PxSerializer::createObject + */ + template + PX_INLINE T* readExtraData(PxU32 count=1) + { + alignExtraData(alignment); + return readExtraData(count); + } + + /** + \brief Function to align the extra data stream to a power of 2 alignment + + This function is assumed to be called within the implementation of PxSerializer::createObject. + + @see PxSerializationContext::alignData, PxSerializer::createObject + */ + PX_INLINE void alignExtraData(PxU32 alignment = PX_SERIAL_ALIGN) + { + size_t addr = size_t(mExtraDataAddress); + addr = (addr+alignment-1)&~size_t(alignment-1); + mExtraDataAddress = reinterpret_cast(addr); + } + +protected: + + PxDeserializationContext() {} + virtual ~PxDeserializationContext() {} + + PxU8* mExtraDataAddress; +}; + +/** +\brief Callback type for exporting binary meta data for a serializable type. +\deprecated Binary conversion and binary meta data are deprecated. + +@see PxSerializationRegistry::registerBinaryMetaDataCallback + +\param stream Stream to store binary meta data. +*/ +typedef PX_DEPRECATED void (*PxBinaryMetaDataCallback)(PxOutputStream& stream); + +/** +\brief Class serving as a registry for XML (RepX) and binary serializable types. + +In order to serialize and deserialize objects the application needs +to maintain an instance of this class. It can be created with +PxSerialization::createSerializationRegistry() and released with +PxSerializationRegistry::release(). + +@see PxSerialization::createSerializationRegistry +*/ +class PxSerializationRegistry +{ +public: + /************************************************************************************************/ + + /** @name Binary Serialization Functionality + */ + //@{ + + /** + \brief Register a serializer for a concrete type + + \param type PxConcreteType corresponding to the serializer + \param serializer The PxSerializer to be registered + + @see PxConcreteType, PxSerializer, PxSerializationRegistry::unregisterSerializer + */ + virtual void registerSerializer(PxType type, PxSerializer& serializer) = 0; + + /** + \brief Unregister a serializer for a concrete type, and retrieves the corresponding serializer object. + + \param type PxConcreteType for which the serializer should be unregistered + \return Unregistered serializer corresponding to type, NULL for types for which no serializer has been registered. + + @see PxConcreteType, PxSerializationRegistry::registerSerializer, PxSerializationRegistry::release + */ + virtual PxSerializer* unregisterSerializer(PxType type) = 0; + + /** + \brief Register binary meta data callback + + \deprecated Binary conversion and binary meta data are deprecated. + + The callback is executed when calling PxSerialization::dumpBinaryMetaData. + + \param callback PxBinaryMetaDataCallback to be registered. + + @see PxBinaryMetaDataCallback, PxSerialization::dumpBinaryMetaData + */ + PX_DEPRECATED virtual void registerBinaryMetaDataCallback(PxBinaryMetaDataCallback callback) = 0; + + /** + \brief Returns PxSerializer corresponding to type + + \param type PxConcreteType of the serializer requested. + \return Registered PxSerializer object corresponding to type + + @see PxConcreteType + */ + virtual const PxSerializer* getSerializer(PxType type) const = 0; + + //@} + /************************************************************************************************/ + + /** @name RepX (XML) Serialization Functionality + */ + //@{ + + /** + \brief Register a RepX serializer for a concrete type + + \param type PxConcreteType corresponding to the RepX serializer + \param serializer The PxRepXSerializer to be registered + + @see PxConcreteType, PxRepXSerializer + */ + virtual void registerRepXSerializer(PxType type, PxRepXSerializer& serializer) = 0; + + /** + \brief Unregister a RepX serializer for a concrete type, and retrieves the corresponding serializer object. + + \param type PxConcreteType for which the RepX serializer should be unregistered + \return Unregistered PxRepxSerializer corresponding to type, NULL for types for which no RepX serializer has been registered. + + @see PxConcreteType, PxSerializationRegistry::registerRepXSerializer, PxSerializationRegistry::release + */ + virtual PxRepXSerializer* unregisterRepXSerializer(PxType type) = 0; + + /** + \brief Returns RepX serializer given the corresponding type name + + \param typeName Name of the type + \return Registered PxRepXSerializer object corresponding to type name + + @see PxRepXSerializer, PxTypeInfo, PX_DEFINE_TYPEINFO + */ + virtual PxRepXSerializer* getRepXSerializer(const char* typeName) const = 0; + + //@} + /************************************************************************************************/ + + /** + \brief Releases PxSerializationRegistry instance. + + This unregisters all PhysX and PhysXExtension serializers. Make sure to unregister all custom type + serializers before releasing the PxSerializationRegistry. + + @see PxSerializationRegistry::unregisterSerializer, PxSerializationRegistry::unregisterRepXSerializer + */ + virtual void release() = 0; + +protected: + virtual ~PxSerializationRegistry(){} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerializer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerializer.h new file mode 100644 index 0000000..538f937 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxSerializer.h @@ -0,0 +1,263 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SERIALIZER_H +#define PX_SERIALIZER_H +/** \addtogroup extensions +@{ +*/ + +#include "foundation/PxAssert.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxFoundation.h" +#include "common/PxSerialFramework.h" +#include "common/PxCollection.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + \brief Serialization interface class. + + PxSerializer is used to extend serializable PxBase classes with serialization functionality. The + interface is structured such that per-class adapter instances can be used as opposed to per-object + adapter instances, avoiding per object allocations. Hence the methods take a reference to PxBase as a parameter. + + The PxSerializer interface needs to be implemented for binary or RepX serialization to work on custom + types. If only RepX serialization is needed, some methods can be left empty, as they are only needed + for binary serialization. + + A default implementation is available as a template adapter (PxSerializerDefaultAdapter). + + @see PxSerializerDefaultAdapter, PX_NEW_SERIALIZER_ADAPTER, PxSerializationRegistry::registerSerializer +*/ +class PxSerializer +{ +public: + + /**********************************************************************************************************************/ + + /** @name Basics needed for Binary- and RepX-Serialization + */ + //@{ + + /** + \brief Returns string name of dynamic type. + + \return Class name of most derived type of this object. + */ + virtual const char* getConcreteTypeName() const = 0; + + /** + \brief Adds required objects to the collection. + + This method does not add the required objects recursively, e.g. objects required by required objects. + + @see PxCollection, PxSerialization::complete + */ + virtual void requiresObjects(PxBase&, PxProcessPxBaseCallback&) const = 0; + + /** + \brief Whether the object is subordinate. + + A class is subordinate, if it can only be instantiated in the context of another class. + + \return Whether the class is subordinate + + @see PxSerialization::isSerializable + */ + virtual bool isSubordinate() const = 0; + + //@} + /**********************************************************************************************************************/ + + /**********************************************************************************************************************/ + + /** @name Functionality needed for Binary Serialization only + */ + //@{ + + /** + \brief Exports object's extra data to stream. + */ + virtual void exportExtraData(PxBase&, PxSerializationContext&) const = 0; + + /** + \brief Exports object's data to stream. + */ + virtual void exportData(PxBase&, PxSerializationContext&) const = 0; + + /** + \brief Register references that the object maintains to other objects. + */ + virtual void registerReferences(PxBase& obj, PxSerializationContext& s) const = 0; + + /** + \brief Returns size needed to create the class instance. + + \return sizeof class instance. + */ + virtual size_t getClassSize() const = 0; + + /** + \brief Create object at a given address, resolve references and import extra data. + + \param address Location at which object is created. Address is increased by the size of the created object. + \param context Context for reading external data and resolving references. + \return Created PxBase pointer (needs to be identical to address before increment). + */ + virtual PxBase* createObject(PxU8*& address, PxDeserializationContext& context) const = 0; + + //@} + /**********************************************************************************************************************/ + virtual ~PxSerializer() {} +}; + + +/** + \brief Default PxSerializer implementation. +*/ +template +class PxSerializerDefaultAdapter : public PxSerializer +{ +public: + + /************************************************************************************************/ + + /** @name Basics needed for Binary- and RepX-Serialization + */ + //@{ + + PxSerializerDefaultAdapter(const char* name) : mTypeName(name){} + + virtual const char* getConcreteTypeName() const + { + return mTypeName; + } + + virtual void requiresObjects(PxBase& obj, PxProcessPxBaseCallback& c) const + { + T& t = static_cast(obj); + t.requiresObjects(c); + } + + virtual bool isSubordinate() const + { + return false; + } + + //@} + /************************************************************************************************/ + + /** @name Functionality needed for Binary Serialization only + */ + //@{ + + // object methods + + virtual void exportExtraData(PxBase& obj, PxSerializationContext& s) const + { + T& t = static_cast(obj); + t.exportExtraData(s); + } + + virtual void exportData(PxBase& obj, PxSerializationContext& s) const + { + PxAllocatorCallback& allocator = *PxGetAllocatorCallback(); + T* copy = reinterpret_cast(allocator.allocate(sizeof(T), "TmpAllocExportData", __FILE__, __LINE__)); + PxMemCopy(copy, &obj, sizeof(T)); + copy->preExportDataReset(); + s.writeData(copy, sizeof(T)); + allocator.deallocate(copy); + } + + virtual void registerReferences(PxBase& obj, PxSerializationContext& s) const + { + T& t = static_cast(obj); + + s.registerReference(obj, PX_SERIAL_REF_KIND_PXBASE, size_t(&obj)); + + struct RequiresCallback : public PxProcessPxBaseCallback + { + RequiresCallback(PxSerializationContext& c) : context(c) {} + RequiresCallback& operator=(RequiresCallback&) { PX_ASSERT(0); return *this; } + void process(physx::PxBase& base) + { + context.registerReference(base, PX_SERIAL_REF_KIND_PXBASE, size_t(&base)); + } + PxSerializationContext& context; + }; + + RequiresCallback callback(s); + t.requiresObjects(callback); + } + + // class methods + + virtual size_t getClassSize() const + { + return sizeof(T); + } + + virtual PxBase* createObject(PxU8*& address, PxDeserializationContext& context) const + { + return T::createObject(address, context); + } + + + //@} + /************************************************************************************************/ + +private: + const char* mTypeName; +}; + +/** + \brief Preprocessor Macro to simplify adapter creation. + + Note: that the allocator used for creation needs to match with the one used in PX_DELETE_SERIALIZER_ADAPTER. +*/ +#define PX_NEW_SERIALIZER_ADAPTER(x) \ + *new( PxGetAllocatorCallback()->allocate(sizeof(PxSerializerDefaultAdapter), \ + "PxSerializerDefaultAdapter", __FILE__, __LINE__ )) PxSerializerDefaultAdapter(#x) + +/** + \brief Preprocessor Macro to simplify adapter deletion. +*/ +#define PX_DELETE_SERIALIZER_ADAPTER(x) \ + { PxSerializer* s = x; if (s) { s->~PxSerializer(); PxGetAllocatorCallback()->deallocate(s); } } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxStringTable.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxStringTable.h new file mode 100644 index 0000000..f5cc134 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxStringTable.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_STRING_TABLE_H +#define PX_STRING_TABLE_H + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup physics +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief a table to manage strings. Strings allocated through this object are expected to be owned by this object. + */ +class PxStringTable +{ +protected: + virtual ~PxStringTable(){} +public: + /** + * \brief Allocate a new string. + * + * \param[in] inSrc Source string, null terminated or null. + * + * \return *Always* a valid null terminated string. "" is returned if "" or null is passed in. + */ + virtual const char* allocateStr( const char* inSrc ) = 0; + + /** + * Release the string table and all the strings associated with it. + */ + virtual void release() = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTolerancesScale.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTolerancesScale.h new file mode 100644 index 0000000..4343481 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTolerancesScale.h @@ -0,0 +1,107 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TOLERANCES_SCALE_H +#define PX_TOLERANCES_SCALE_H + +/** \addtogroup common + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class to define the scale at which simulation runs. Most simulation tolerances are +calculated in terms of the values here. + +\note if you change the simulation scale, you will probably also wish to change the scene's +default value of gravity, and stable simulation will probably require changes to the scene's +bounceThreshold also. +*/ + +class PxTolerancesScale +{ +public: + + /** + \brief The approximate size of objects in the simulation. + + For simulating roughly human-sized in metric units, 1 is a good choice. + If simulation is done in centimetres, use 100 instead. This is used to + estimate certain length-related tolerances. + */ + PxReal length; + + /** + \brief The typical magnitude of velocities of objects in simulation. This is used to estimate + whether a contact should be treated as bouncing or resting based on its impact velocity, + and a kinetic energy threshold below which the simulation may put objects to sleep. + + For normal physical environments, a good choice is the approximate speed of an object falling + under gravity for one second. + */ + PxReal speed; + + /** + \brief constructor sets to default + + \param[in] defaultLength Default length + \param[in] defaultSpeed Default speed + */ + PX_INLINE PxTolerancesScale(float defaultLength=1.0f, float defaultSpeed=10.0f); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid (returns always true). + */ + PX_INLINE bool isValid() const; + +}; + +PX_INLINE PxTolerancesScale::PxTolerancesScale(float defaultLength, float defaultSpeed) : + length (defaultLength), + speed (defaultSpeed) + { + } + +PX_INLINE bool PxTolerancesScale::isValid() const +{ + return length>0.0f; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTypeInfo.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTypeInfo.h new file mode 100644 index 0000000..8a84b3c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/PxTypeInfo.h @@ -0,0 +1,167 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TYPE_INFO_H +#define PX_TYPE_INFO_H + +/** \addtogroup common +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief an enumeration of concrete classes inheriting from PxBase + +Enumeration space is reserved for future PhysX core types, PhysXExtensions, +PhysXVehicle and Custom application types. + +@see PxBase, PxTypeInfo +*/ + +struct PxConcreteType +{ + enum Enum + { + eUNDEFINED, + + eHEIGHTFIELD, + eCONVEX_MESH, + eTRIANGLE_MESH_BVH33, // PX_DEPRECATED + eTRIANGLE_MESH_BVH34, + eTETRAHEDRON_MESH, + eSOFTBODY_MESH, + + eRIGID_DYNAMIC, + eRIGID_STATIC, + eSHAPE, + eMATERIAL, + eSOFTBODY_MATERIAL, + eCLOTH_MATERIAL, + ePBD_MATERIAL, + eFLIP_MATERIAL, + eMPM_MATERIAL, + eCUSTOM_MATERIAL, + eCONSTRAINT, + eAGGREGATE, + eARTICULATION_REDUCED_COORDINATE, + eARTICULATION_LINK, + eARTICULATION_JOINT_REDUCED_COORDINATE, + eARTICULATION_SENSOR, + eARTICULATION_SPATIAL_TENDON, + eARTICULATION_FIXED_TENDON, + eARTICULATION_ATTACHMENT, + eARTICULATION_TENDON_JOINT, + ePRUNING_STRUCTURE, + eBVH, + eSOFT_BODY, + eSOFT_BODY_STATE, + ePBD_PARTICLESYSTEM, + eFLIP_PARTICLESYSTEM, + eMPM_PARTICLESYSTEM, + eCUSTOM_PARTICLESYSTEM, + eFEM_CLOTH, + eHAIR_SYSTEM, + ePARTICLE_BUFFER, + ePARTICLE_DIFFUSE_BUFFER, + ePARTICLE_CLOTH_BUFFER, + ePARTICLE_RIGID_BUFFER, + + ePHYSX_CORE_COUNT, + eFIRST_PHYSX_EXTENSION = 256, + eFIRST_VEHICLE_EXTENSION = 512, + eFIRST_USER_EXTENSION = 1024 + }; +}; + +/** +\brief a structure containing per-type information for types inheriting from PxBase + +@see PxBase, PxConcreteType +*/ + +template struct PxTypeInfo {}; + +#define PX_DEFINE_TYPEINFO(_name, _fastType) \ + class _name; \ + template <> struct PxTypeInfo<_name> { static const char* name() { return #_name; } enum { eFastTypeId = _fastType }; }; + +/* the semantics of the fastType are as follows: an object A can be cast to a type B if B's fastType is defined, and A has the same fastType. + * This implies that B has no concrete subclasses or superclasses. + */ + +PX_DEFINE_TYPEINFO(PxBase, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxMaterial, PxConcreteType::eMATERIAL) +PX_DEFINE_TYPEINFO(PxFEMSoftBodyMaterial, PxConcreteType::eSOFTBODY_MATERIAL) +PX_DEFINE_TYPEINFO(PxFEMClothMaterial, PxConcreteType::eCLOTH_MATERIAL) +PX_DEFINE_TYPEINFO(PxPBDMaterial, PxConcreteType::ePBD_MATERIAL) +PX_DEFINE_TYPEINFO(PxFLIPMaterial, PxConcreteType::eFLIP_MATERIAL) +PX_DEFINE_TYPEINFO(PxMPMMaterial, PxConcreteType::eMPM_MATERIAL) +PX_DEFINE_TYPEINFO(PxCustomMaterial, PxConcreteType::eCUSTOM_MATERIAL) +PX_DEFINE_TYPEINFO(PxConvexMesh, PxConcreteType::eCONVEX_MESH) +PX_DEFINE_TYPEINFO(PxTriangleMesh, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxBVH33TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH33) +PX_DEFINE_TYPEINFO(PxBVH34TriangleMesh, PxConcreteType::eTRIANGLE_MESH_BVH34) +PX_DEFINE_TYPEINFO(PxTetrahedronMesh, PxConcreteType::eTETRAHEDRON_MESH) +PX_DEFINE_TYPEINFO(PxHeightField, PxConcreteType::eHEIGHTFIELD) +PX_DEFINE_TYPEINFO(PxActor, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidActor, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidBody, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRigidDynamic, PxConcreteType::eRIGID_DYNAMIC) +PX_DEFINE_TYPEINFO(PxRigidStatic, PxConcreteType::eRIGID_STATIC) +PX_DEFINE_TYPEINFO(PxArticulationLink, PxConcreteType::eARTICULATION_LINK) +PX_DEFINE_TYPEINFO(PxArticulationJointReducedCoordinate, PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) +PX_DEFINE_TYPEINFO(PxArticulationReducedCoordinate, PxConcreteType::eARTICULATION_REDUCED_COORDINATE) +PX_DEFINE_TYPEINFO(PxAggregate, PxConcreteType::eAGGREGATE) +PX_DEFINE_TYPEINFO(PxConstraint, PxConcreteType::eCONSTRAINT) +PX_DEFINE_TYPEINFO(PxShape, PxConcreteType::eSHAPE) +PX_DEFINE_TYPEINFO(PxPruningStructure, PxConcreteType::ePRUNING_STRUCTURE) +PX_DEFINE_TYPEINFO(PxParticleSystem, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxPBDParticleSystem, PxConcreteType::ePBD_PARTICLESYSTEM) +PX_DEFINE_TYPEINFO(PxFLIPParticleSystem, PxConcreteType::eFLIP_PARTICLESYSTEM) +PX_DEFINE_TYPEINFO(PxMPMParticleSystem, PxConcreteType::eMPM_PARTICLESYSTEM) +PX_DEFINE_TYPEINFO(PxCustomParticleSystem, PxConcreteType::eCUSTOM_PARTICLESYSTEM) +PX_DEFINE_TYPEINFO(PxSoftBody, PxConcreteType::eSOFT_BODY) +PX_DEFINE_TYPEINFO(PxFEMCloth, PxConcreteType::eFEM_CLOTH) +PX_DEFINE_TYPEINFO(PxHairSystem, PxConcreteType::eHAIR_SYSTEM) +PX_DEFINE_TYPEINFO(PxParticleBuffer, PxConcreteType::ePARTICLE_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleAndDiffuseBuffer, PxConcreteType::ePARTICLE_DIFFUSE_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleClothBuffer, PxConcreteType::ePARTICLE_CLOTH_BUFFER) +PX_DEFINE_TYPEINFO(PxParticleRigidBuffer, PxConcreteType::ePARTICLE_RIGID_BUFFER) + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/common/windows/PxWindowsDelayLoadHook.h b/modules/PhysX/physx/physx-sys/physx/physx/include/common/windows/PxWindowsDelayLoadHook.h new file mode 100644 index 0000000..433b981 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/common/windows/PxWindowsDelayLoadHook.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_DELAY_LOAD_HOOK_H +#define PX_WINDOWS_DELAY_LOAD_HOOK_H + +#include "foundation/PxPreprocessor.h" +#include "common/PxPhysXCommonConfig.h" + +/** \addtogroup foundation +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + \brief PxDelayLoadHook + + This is a helper class for delay loading the PhysXCommon dll and PhysXFoundation dll. + If a PhysXCommon dll or PhysXFoundation dll with a non-default file name needs to be loaded, + PxDelayLoadHook can be sub-classed to provide the custom filenames. + + Once the names are set, the instance must be set for use by PhysX.dll using PxSetPhysXDelayLoadHook(), + PhysXCooking.dll using PxSetPhysXCookingDelayLoadHook() or by PhysXCommon.dll using PxSetPhysXCommonDelayLoadHook(). + + @see PxSetPhysXDelayLoadHook(), PxSetPhysXCookingDelayLoadHook(), PxSetPhysXCommonDelayLoadHook() + */ + class PxDelayLoadHook + { + public: + PxDelayLoadHook() {} + virtual ~PxDelayLoadHook() {} + + virtual const char* getPhysXFoundationDllName() const = 0; + + virtual const char* getPhysXCommonDllName() const = 0; + + protected: + private: + }; + + /** + \brief Sets delay load hook instance for PhysX dll. + + \param[in] hook Delay load hook. + + @see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXDelayLoadHook(const physx::PxDelayLoadHook* hook); + + /** + \brief Sets delay load hook instance for PhysXCooking dll. + + \param[in] hook Delay load hook. + + @see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXCookingDelayLoadHook(const physx::PxDelayLoadHook* hook); + + /** + \brief Sets delay load hook instance for PhysXCommon dll. + + \param[in] hook Delay load hook. + + @see PxDelayLoadHook + */ + PX_C_EXPORT PX_PHYSX_COMMON_API void PX_CALL_CONV PxSetPhysXCommonDelayLoadHook(const physx::PxDelayLoadHook* hook); + +#if !PX_DOXYGEN +} // namespace physx +#endif +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH33MidphaseDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH33MidphaseDesc.h new file mode 100644 index 0000000..4642746 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH33MidphaseDesc.h @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BVH_33_MIDPHASE_DESC_H +#define PX_BVH_33_MIDPHASE_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief Enumeration for mesh cooking hints. + * @deprecated + */ +struct PX_DEPRECATED PxMeshCookingHint +{ + enum Enum + { + eSIM_PERFORMANCE = 0, //!< Default value. Favors higher quality hierarchy with higher runtime performance over cooking speed. + eCOOKING_PERFORMANCE = 1 //!< Enables fast cooking path at the expense of somewhat lower quality hierarchy construction. + }; +}; + +/** + +\brief Structure describing parameters affecting BVH33 midphase mesh structure. + +@see PxCookingParams, PxMidphaseDesc +@deprecated +*/ +struct PX_DEPRECATED PxBVH33MidphaseDesc +{ + /** + \brief Controls the trade-off between mesh size and runtime performance. + + Using a value of 1.0 will produce a larger cooked mesh with generally higher runtime performance, + using 0.0 will produce a smaller cooked mesh, with generally lower runtime performance. + + Values outside of [0,1] range will be clamped and cause a warning when any mesh gets cooked. + + Default value: 0.55 + Range: [0.0f, 1.0f] + */ + PxF32 meshSizePerformanceTradeOff; + + /** + \brief Mesh cooking hint. Used to specify mesh hierarchy construction preference. + + Default value: PxMeshCookingHint::eSIM_PERFORMANCE + */ + PxMeshCookingHint::Enum meshCookingHint; + + /** + \brief Desc initialization to default value. + */ + void setToDefault() + { + meshSizePerformanceTradeOff = 0.55f; + meshCookingHint = PxMeshCookingHint::eSIM_PERFORMANCE; + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(meshSizePerformanceTradeOff < 0.0f || meshSizePerformanceTradeOff > 1.0f) + return false; + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + + /** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH34MidphaseDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH34MidphaseDesc.h new file mode 100644 index 0000000..1009418 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVH34MidphaseDesc.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BVH_34_MIDPHASE_DESC_H +#define PX_BVH_34_MIDPHASE_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Desired build strategy for PxMeshMidPhase::eBVH34 +*/ +struct PxBVH34BuildStrategy +{ + enum Enum + { + eFAST = 0, //!< Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime mesh cooking. + eDEFAULT = 1, //!< Default build strategy. Medium build speed, good runtime performance in all cases. + eSAH = 2, //!< SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + + eLAST + }; +}; + + +/** + +\brief Structure describing parameters affecting BVH34 midphase mesh structure. + +@see PxCookingParams, PxMidphaseDesc +*/ +struct PxBVH34MidphaseDesc +{ + /** + \brief Mesh cooking hint for max primitives per leaf limit. + Less primitives per leaf produces larger meshes with better runtime performance + and worse cooking performance. More triangles per leaf results in faster cooking speed and + smaller mesh sizes, but with worse runtime performance. + + Default value: 4 + Range: <2, 15> + */ + PxU32 numPrimsPerLeaf; + + /** + \brief Desired build strategy for the BVH + + Default value: eDEFAULT + */ + PxBVH34BuildStrategy::Enum buildStrategy; + + /** + \brief Whether the tree should be quantized or not + + Quantized trees use up less memory, but the runtime dequantization (to retrieve the node bounds) might have + a measurable performance cost. In most cases the cost is too small to matter, and using less memory is more + important. Hence, the default is true. + + One important use case for non-quantized trees is deformable meshes. The refit function for the BVH is not + supported for quantized trees. + + Default value: true + */ + bool quantized; + + /** + \brief Desc initialization to default value. + */ + void setToDefault() + { + numPrimsPerLeaf = 4; + buildStrategy = PxBVH34BuildStrategy::eDEFAULT; + quantized = true; + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(numPrimsPerLeaf < 2 || numPrimsPerLeaf > 15) + return false; + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + + /** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVHDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVHDesc.h new file mode 100644 index 0000000..4a0aec9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxBVHDesc.h @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BVH_DESC_H +#define PX_BVH_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "common/PxCoreUtilityTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxBVHBuildStrategy.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Descriptor class for #PxBVH. + +@see PxBVH +*/ +class PxBVHDesc +{ +public: + PX_INLINE PxBVHDesc(); + + /** + \brief Pointer to first bounding box. + */ + PxBoundedData bounds; + + /** + \brief Bounds enlargement + + Passed bounds are slightly enlarged before creating the BVH. This is done to avoid numerical issues when + e.g. raycasts just graze the bounds. The performed operation is: + + extents = (bounds.maximum - bounds.minimum)/2 + enlagedBounds.minimum = passedBounds.minium - extents * enlargement + enlagedBounds.maximum = passedBounds.maxium + extents * enlargement + + Users can pass pre-enlarged bounds to the BVH builder, in which case just set the enlargement value to zero. + + Default value: 0.01 + */ + float enlargement; + + /** + \brief Max primitives per leaf limit. + + Range: [0, 16)
+ Default value: 4 + */ + PxU32 numPrimsPerLeaf; + + /** + \brief Desired build strategy for the BVH + + Default value: eDEFAULT + */ + PxBVHBuildStrategy::Enum buildStrategy; + + /** + \brief Initialize the BVH descriptor + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + PX_INLINE bool isValid() const; + +protected: +}; + +PX_INLINE PxBVHDesc::PxBVHDesc() : enlargement(0.01f), numPrimsPerLeaf(4), buildStrategy(PxBVHBuildStrategy::eDEFAULT) +{ +} + +PX_INLINE void PxBVHDesc::setToDefault() +{ + *this = PxBVHDesc(); +} + +PX_INLINE bool PxBVHDesc::isValid() const +{ + // Check BVH desc data + if(!bounds.data) + return false; + if(bounds.stride < sizeof(PxBounds3)) //should be at least one bounds' worth of data + return false; + + if(bounds.count == 0) + return false; + + if(enlargement<0.0f) + return false; + + if(numPrimsPerLeaf>=16) + return false; + + return true; +} + + /** + * @deprecated + */ + typedef PX_DEPRECATED PxBVHDesc PxBVHStructureDesc; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxConvexMeshDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxConvexMeshDesc.h new file mode 100644 index 0000000..390e263 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxConvexMeshDesc.h @@ -0,0 +1,345 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONVEX_MESH_DESC_H +#define PX_CONVEX_MESH_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" +#include "geometry/PxConvexMesh.h" +#include "PxSDFDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +\brief Flags which describe the format and behavior of a convex mesh. +*/ +struct PxConvexFlag +{ + enum Enum + { + /** + Denotes the use of 16-bit vertex indices in PxConvexMeshDesc::triangles or PxConvexMeshDesc::polygons. + (otherwise, 32-bit indices are assumed) + @see #PxConvexMeshDesc.indices + */ + e16_BIT_INDICES = (1<<0), + + /** + Automatically recomputes the hull from the vertices. If this flag is not set, you must provide the entire geometry manually. + + \note There are two different algorithms for hull computation, please see PxConvexMeshCookingType. + + @see PxConvexMeshCookingType + */ + eCOMPUTE_CONVEX = (1<<1), + + /** + \brief Checks and removes almost zero-area triangles during convex hull computation. + The rejected area size is specified in PxCookingParams::areaTestEpsilon + + \note This flag is only used in combination with eCOMPUTE_CONVEX. + + @see PxCookingParams PxCookingParams::areaTestEpsilon + */ + eCHECK_ZERO_AREA_TRIANGLES = (1<<2), + + /** + \brief Quantizes the input vertices using the k-means clustering + + \note The input vertices are quantized to PxConvexMeshDesc::quantizedCount + see http://en.wikipedia.org/wiki/K-means_clustering + + */ + eQUANTIZE_INPUT = (1 << 3), + + /** + \brief Disables the convex mesh validation to speed-up hull creation. Please use separate validation + function in checked/debug builds. Creating a convex mesh with invalid input data without prior validation + may result in undefined behavior. + + @see PxCooking::validateConvexMesh + */ + eDISABLE_MESH_VALIDATION = (1 << 4), + + /** + \brief Enables plane shifting vertex limit algorithm. + + Plane shifting is an alternative algorithm for the case when the computed hull has more vertices + than the specified vertex limit. + + The default algorithm computes the full hull, and an OBB around the input vertices. This OBB is then sliced + with the hull planes until the vertex limit is reached.The default algorithm requires the vertex limit + to be set to at least 8, and typically produces results that are much better quality than are produced + by plane shifting. + + When plane shifting is enabled, the hull computation stops when vertex limit is reached. The hull planes + are then shifted to contain all input vertices, and the new plane intersection points are then used to + generate the final hull with the given vertex limit.Plane shifting may produce sharp edges to vertices + very far away from the input cloud, and does not guarantee that all input vertices are inside the resulting + hull.However, it can be used with a vertex limit as low as 4. + */ + ePLANE_SHIFTING = (1 << 5), + + /** + \brief Inertia tensor computation is faster using SIMD code, but the precision is lower, which may result + in incorrect inertia for very thin hulls. + */ + eFAST_INERTIA_COMPUTATION = (1 << 6), + + /** + \brief Convex hulls are created with respect to GPU simulation limitations. Vertex limit and polygon limit + is set to 64 and vertex limit per face is internally set to 32. + \note Can be used only with eCOMPUTE_CONVEX flag. + */ + eGPU_COMPATIBLE = (1 << 7), + + /** + \brief Convex hull input vertices are shifted to be around origin to provide better computation stability. + It is recommended to provide input vertices around the origin, otherwise use this flag to improve + numerical stability. + \note Is used only with eCOMPUTE_CONVEX flag. + */ + eSHIFT_VERTICES = (1 << 8) + }; +}; + +/** +\brief collection of set bits defined in PxConvexFlag. + +@see PxConvexFlag +*/ +typedef PxFlags PxConvexFlags; +PX_FLAGS_OPERATORS(PxConvexFlag::Enum,PxU16) + +/** +\brief Descriptor class for #PxConvexMesh. +\note The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 256. +\note The number of vertices and the number of convex polygons in a GPU compatible convex mesh is limited to 64, +and the number of faces per vertex is limited to 32. + +@see PxConvexMesh PxConvexMeshGeometry PxShape PxPhysics.createConvexMesh() + +*/ +class PxConvexMeshDesc +{ +public: + + /** + \brief Vertex positions data in PxBoundedData format. + + Default: NULL + */ + PxBoundedData points; + + /** + \brief Polygons data in PxBoundedData format. +

Pointer to first polygon.

+ + Default: NULL + + @see PxHullPolygon + */ + PxBoundedData polygons; + + /** + \brief Polygon indices data in PxBoundedData format. +

Pointer to first index.

+ + Default: NULL + +

This is declared as a void pointer because it is actually either an PxU16 or a PxU32 pointer.

+ + @see PxHullPolygon PxConvexFlag::e16_BIT_INDICES + */ + PxBoundedData indices; + + /** + \brief Flags bits, combined from values of the enum ::PxConvexFlag + + Default: 0 + */ + PxConvexFlags flags; + + /** + \brief Limits the number of vertices of the result convex mesh. Hard maximum limit is 255 + and minimum limit is 4 if PxConvexFlag::ePLANE_SHIFTING is used, otherwise the minimum + limit is 8. + + \note Vertex limit is only used when PxConvexFlag::eCOMPUTE_CONVEX is specified. + \note The please see PxConvexFlag::ePLANE_SHIFTING for algorithm explanation + \note The maximum limit for GPU compatible convex meshes is 64. + + @see PxConvexFlag::ePLANE_SHIFTING + + Range: [4, 255]
+ Default: 255 + */ + PxU16 vertexLimit; + + /** + \brief Limits the number of polygons of the result convex mesh. Hard maximum limit is 255 + and minimum limit is 4. + + \note The maximum limit for GPU compatible convex meshes is 64. + + Range: [4, 255]
+ Default: 255 + */ + PxU16 polygonLimit; + + /** + \brief Maximum number of vertices after quantization. The quantization is done during the vertex cleaning phase. + The quantization is applied when PxConvexFlag::eQUANTIZE_INPUT is specified. + + @see PxConvexFlag::eQUANTIZE_INPUT + + Range: [4, 65535]
+ Default: 255 + */ + PxU16 quantizedCount; + + /** + \brief SDF descriptor. When this descriptor is set, signed distance field is calculated for this convex mesh. + + Default: NULL + */ + PxSDFDesc* sdfDesc; + + /** + \brief constructor sets to default. + */ + PX_INLINE PxConvexMeshDesc(); + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + + /** + \brief Returns true if the descriptor is valid. + + \return True if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE PxConvexMeshDesc::PxConvexMeshDesc() //constructor sets to default +: vertexLimit(255), polygonLimit(255), quantizedCount(255), sdfDesc(NULL) +{ + +} + +PX_INLINE void PxConvexMeshDesc::setToDefault() +{ + *this = PxConvexMeshDesc(); +} + +PX_INLINE bool PxConvexMeshDesc::isValid() const +{ + // Check geometry + if(points.count < 3 || //at least 1 trig's worth of points + (points.count > 0xffff && flags & PxConvexFlag::e16_BIT_INDICES)) + return false; + if(!points.data) + return false; + if(points.stride < sizeof(PxVec3)) //should be at least one point's worth of data + return false; + if (quantizedCount < 4) + return false; + + // Check topology + if(polygons.data) + { + if(polygons.count < 4) // we require 2 neighbors for each vertex - 4 polygons at least + return false; + + if(!indices.data) // indices must be provided together with polygons + return false; + + PxU32 limit = (flags & PxConvexFlag::e16_BIT_INDICES) ? sizeof(PxU16) : sizeof(PxU32); + if(indices.stride < limit) + return false; + + limit = sizeof(PxHullPolygon); + if(polygons.stride < limit) + return false; + } + else + { + // We can compute the hull from the vertices + if(!(flags & PxConvexFlag::eCOMPUTE_CONVEX)) + return false; // If the mesh is convex and we're not allowed to compute the hull, + // you have to provide it completely (geometry & topology). + } + + if((flags & PxConvexFlag::ePLANE_SHIFTING) && vertexLimit < 4) + { + return false; + } + + if (!(flags & PxConvexFlag::ePLANE_SHIFTING) && vertexLimit < 8) + { + return false; + } + + if(vertexLimit > 255) + { + return false; + } + + if (polygonLimit < 4) + { + return false; + } + + if (polygonLimit > 255) + { + return false; + } + + if (sdfDesc && !sdfDesc->isValid()) + { + return false; + } + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCooking.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCooking.h new file mode 100644 index 0000000..6089e6c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCooking.h @@ -0,0 +1,914 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_COOKING_H +#define PX_COOKING_H +/** \addtogroup cooking +@{ +*/ +#include "common/PxPhysXCommonConfig.h" +#include "common/PxTolerancesScale.h" +#include "cooking/Pxc.h" + +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "cooking/PxTetrahedronMeshDesc.h" +#include "cooking/PxMidphaseDesc.h" +#include "cooking/PxBVHDesc.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxBVH.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxInsertionCallback; +class PxFoundation; +class PxAllocatorCallback; +class PxHeightFieldDesc; + +/** +\brief Result from convex cooking. +*/ +struct PxConvexMeshCookingResult +{ + enum Enum + { + /** + \brief Convex mesh cooking succeeded. + */ + eSUCCESS, + + /** + \brief Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + + @see PxCookingParams::areaTestEpsilon PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES + */ + eZERO_AREA_TEST_FAILED, + + /** + \brief Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + The produced hull does not contain all input vertices. Try to simplify the input vertices + or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + + @see PxConvexFlag::eINFLATE_CONVEX PxConvexFlag::eQUANTIZE_INPUT + */ + ePOLYGONS_LIMIT_REACHED, + + /** + \brief Something unrecoverable happened. Check the error stream to find out what. + */ + eFAILURE + }; +}; + +/** \brief Enumeration for convex mesh cooking algorithms. */ +struct PxConvexMeshCookingType +{ + enum Enum + { + /** + \brief The Quickhull algorithm constructs the hull from the given input points. The resulting hull + will only contain a subset of the input points. + + */ + eQUICKHULL + }; +}; + +/** +\brief Result from triangle mesh cooking +*/ +struct PxTriangleMeshCookingResult +{ + enum Enum + { + /** + \brief Everything is A-OK. + */ + eSUCCESS = 0, + + /** + \brief a triangle is too large for well-conditioned results. Tessellate the mesh for better behavior, see the user guide section on cooking for more details. + */ + eLARGE_TRIANGLE, + + /** + \brief Something unrecoverable happened. Check the error stream to find out what. + */ + eFAILURE + }; +}; + +/** +\brief Enum for the set of mesh pre-processing parameters. +*/ +struct PxMeshPreprocessingFlag +{ + enum Enum + { + /** + \brief When set, mesh welding is performed. See PxCookingParams::meshWeldTolerance. Clean mesh must be enabled. + */ + eWELD_VERTICES = 1 << 0, + + /** + \brief When set, mesh cleaning is disabled. This makes cooking faster. + + When clean mesh is not performed, mesh welding is also not performed. + + It is recommended to use only meshes that passed during validateTriangleMesh. + + */ + eDISABLE_CLEAN_MESH = 1 << 1, + + /** + \brief When set, active edges are set for each triangle edge. This makes cooking faster but slow up contact generation. + */ + eDISABLE_ACTIVE_EDGES_PRECOMPUTE = 1 << 2, + + /** + \brief When set, 32-bit indices will always be created regardless of triangle count. + + \note By default mesh will be created with 16-bit indices for triangle count <= 0xFFFF and 32-bit otherwise. + */ + eFORCE_32BIT_INDICES = 1 << 3, + + /** + \brief When set, a list of triangles will be created for each associated vertex in the mesh + */ + eENABLE_VERT_MAPPING = 1 << 4, + + /** + \brief When set, inertia tensor is calculated for the mesh + */ + eENABLE_INERTIA = 1 << 5 + + }; +}; + +typedef PxFlags PxMeshPreprocessingFlags; + +/** +\brief Structure describing parameters affecting mesh cooking. + +@see PxSetCookingParams() PxGetCookingParams() +*/ +struct PxCookingParams +{ + /** + \brief Zero-size area epsilon used in convex hull computation. + + If the area of a triangle of the hull is below this value, the triangle will be rejected. This test + is done only if PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES is used. + + @see PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES + + Default value: 0.06f*PxTolerancesScale.length*PxTolerancesScale.length + + Range: (0.0f, PX_MAX_F32) + */ + float areaTestEpsilon; + + /** + \brief Plane tolerance used in convex hull computation. + + The value is used during hull construction. When a new point is about to be added to the hull it + gets dropped when the point is closer to the hull than the planeTolerance. The planeTolerance + is increased according to the hull size. + + If 0.0f is set all points are accepted when the convex hull is created. This may lead to edge cases + where the new points may be merged into an existing polygon and the polygons plane equation might + slightly change therefore. This might lead to failures during polygon merging phase in the hull computation. + + It is recommended to use the default value, however if it is required that all points needs to be + accepted or huge thin convexes are created, it might be required to lower the default value. + + \note The plane tolerance is used only within PxConvexMeshCookingType::eQUICKHULL algorithm. + + Default value: 0.0007f + + Range: <0.0f, PX_MAX_F32) + */ + float planeTolerance; + + /** + \brief Convex hull creation algorithm. + + Default value: PxConvexMeshCookingType::eQUICKHULL + + @see PxConvexMeshCookingType + */ + PxConvexMeshCookingType::Enum convexMeshCookingType; + + /** + \brief When true, the face remap table is not created. This saves a significant amount of memory, but the SDK will + not be able to provide the remap information for internal mesh triangles returned by collisions, + sweeps or raycasts hits. + + Default value: false + */ + bool suppressTriangleMeshRemapTable; + + /** + \brief When true, the triangle adjacency information is created. You can get the adjacency triangles + for a given triangle from getTriangle. + + Default value: false + */ + bool buildTriangleAdjacencies; + + /** + \brief When true, addigional information required for GPU-accelerated rigid body simulation is created. This can increase memory usage and cooking times for convex meshes and triangle meshes. + + Default value: false + */ + bool buildGPUData; + + /** + \brief Tolerance scale is used to check if cooked triangles are not too huge. This check will help with simulation stability. + + \note The PxTolerancesScale values have to match the values used when creating a PxPhysics or PxScene instance. + + @see PxTolerancesScale + */ + PxTolerancesScale scale; + + /** + \brief Mesh pre-processing parameters. Used to control options like whether the mesh cooking performs vertex welding before cooking. + + Default value: 0 + */ + PxMeshPreprocessingFlags meshPreprocessParams; + + /** + \brief Mesh weld tolerance. If mesh welding is enabled, this controls the distance at which vertices are welded. + If mesh welding is not enabled, this value defines the acceptance distance for mesh validation. Provided no two vertices are within this distance, the mesh is considered to be + clean. If not, a warning will be emitted. Having a clean, welded mesh is required to achieve the best possible performance. + + The default vertex welding uses a snap-to-grid approach. This approach effectively truncates each vertex to integer values using meshWeldTolerance. + Once these snapped vertices are produced, all vertices that snap to a given vertex on the grid are remapped to reference a single vertex. Following this, + all triangles' indices are remapped to reference this subset of clean vertices. It should be noted that the vertices that we do not alter the + position of the vertices; the snap-to-grid is only performed to identify nearby vertices. + + The mesh validation approach also uses the same snap-to-grid approach to identify nearby vertices. If more than one vertex snaps to a given grid coordinate, + we ensure that the distance between the vertices is at least meshWeldTolerance. If this is not the case, a warning is emitted. + + Default value: 0.0 + */ + PxReal meshWeldTolerance; + + /** + \brief Controls the desired midphase desc structure for triangle meshes. + + @see PxBVH33MidphaseDesc, PxBVH34MidphaseDesc, PxMidphaseDesc + + Default value: PxMeshMidPhase::eBVH34 + */ + PxMidphaseDesc midphaseDesc; + + /** + \brief Vertex limit beyond which additional acceleration structures are computed for each convex mesh. Increase that limit to reduce memory usage. + Computing the extra structures all the time does not guarantee optimal performance. There is a per-platform break-even point below which the + extra structures actually hurt performance. + + Default value: 32 + */ + PxU32 gaussMapLimit; + + /** + \brief Maximum mass ratio allowed on vertices touched by a single tet. If a any tetrahedron exceeds the mass ratio, the masses will get smoothed locally + until the maximum mass ratio is matched. Value should not be below 1. Smoothing might not fully converge for values <1.5. The smaller the maximum + allowed ratio, the better the stability during simulation. + + Default value: FLT_MAX + */ + PxReal maxWeightRatioInTet; + + PxCookingParams(const PxTolerancesScale& sc): + areaTestEpsilon (0.06f*sc.length*sc.length), + planeTolerance (0.0007f), + convexMeshCookingType (PxConvexMeshCookingType::eQUICKHULL), + suppressTriangleMeshRemapTable (false), + buildTriangleAdjacencies (false), + buildGPUData (false), + scale (sc), + meshPreprocessParams (0), + meshWeldTolerance (0.f), + gaussMapLimit (32), + maxWeightRatioInTet (FLT_MAX) + { + } +}; + +/** +\brief Provides methods to cook (where cooking means to prepare the data and convert it to the right format +potentially including the construction of acceleration structures and other support data) all kind of simulation data +@deprecated +*/ +class PX_DEPRECATED PxCooking +{ +public: + /** + \brief Closes this instance of the interface. + + This function should be called to cleanly shut down the Cooking library before application exit. + + \note This function is required to be called to release foundation usage. + + */ + virtual void release() = 0; + + /** + \brief Sets cooking parameters + + \param[in] params Cooking parameters + + @see getParams() + */ + virtual void setParams(const PxCookingParams& params) = 0; + + /** + \brief Gets cooking parameters + + \return Current cooking parameters. + + @see PxCookingParams setParams() + */ + virtual const PxCookingParams& getParams() const = 0; + + /** + \brief Checks endianness is the same between cooking & target platforms + + \return True if there is and endian mismatch. + */ + virtual bool platformMismatch() const = 0; + + virtual bool cookTriangleMesh(const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition = NULL) const = 0; + + virtual PxTriangleMesh* createTriangleMesh(const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition = NULL) const = 0; + + /** + \brief Cooks and creates a triangle mesh without going through a stream. Convenience function for standalone objects. + + \note This method does the same as cookTriangleMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + \return PxTriangleMesh pointer on success. + + \param[in] desc The triangle mesh descriptor to read the mesh from. + + @see cookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback + */ + PX_FORCE_INLINE PxTriangleMesh* createTriangleMesh(const PxTriangleMeshDesc& desc) const + { + return createTriangleMesh(desc, const_cast(*this).getStandaloneInsertionCallback()); + } + + virtual bool validateTriangleMesh(const PxTriangleMeshDesc& desc) const = 0; + + /** + \brief Cooks a softbody mesh. The results are written to the stream. + + To create a softbody mesh object it is necessary to first 'cook' the mesh data into + a form which allows the SDK to perform efficient collision detection and to store data + used during the FEM calculations. + + cookSoftBodyMesh() allows a mesh description to be cooked into a binary stream + suitable for loading and performing collision detection at runtime. + + Example + + \param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. + \param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. + \param[in] softbodyDataDesc The softbody data descriptor to read mapping information from. + \param[in] stream User stream to output the cooked data. + \return true on success + + @see cookConvexMesh() setParams() PxPhysics.createTriangleMesh() PxTriangleMeshCookingResult::Enum + */ + virtual bool cookSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream) const = 0; + + /** + \brief Cooks and creates a softbody mesh without going through a stream. + + \note This method does the same as cookSoftBodyMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + + \note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() + or PxCooking::getStandaloneInsertionCallback(). + + \param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. + \param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. + \param[in] softbodyDataDesc The softbody data descriptor to read mapping information from. + \param[in] insertionCallback The insertion interface from PxPhysics. + \return PxSoftBodyMesh pointer on success. + + @see cookTriangleMesh() setParams() PxPhysics.createTriangleMesh() PxInsertionCallback + */ + virtual PxSoftBodyMesh* createSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback) const = 0; + + + /** + \brief Cooks and creates a softbody mesh without going through a stream. Convenience function for standalone objects. + + \note This method does the same as cookSoftBodyMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + + \param[in] simulationMeshDesc The tetrahedron mesh descriptor to read the simulation mesh from. + \param[in] collisionMeshDesc The tetrahedron mesh descriptor to read the collision mesh from. + \param[in] softbodyDataDesc The softbody data descriptor to read mapping information from. + \return PxSoftBodyMesh pointer on success. + + @see cookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback + */ + PX_FORCE_INLINE PxSoftBodyMesh* createSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc) const + { + return createSoftBodyMesh(simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, const_cast(*this).getStandaloneInsertionCallback()); + } + + /** + \brief Cooks a tetrahedron mesh. The results are written to the stream. + + To create a tetrahedron mesh object it is necessary to first 'cook' the mesh data into + a form which allows the SDK to perform efficient collision detection. + + cookTriangleMesh() allows a mesh description to be cooked into a binary stream + suitable for loading and performing collision detection at runtime. + + Example + + \param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. + \param[in] stream User stream to output the cooked data. + \return true on success + + @see cookConvexMesh() setParams() PxPhysics.createTetrahedronMesh() + */ + virtual bool cookTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream) const = 0; + + /** + \brief Cooks and creates a tetrahedron mesh without going through a stream. + + \note This method does the same as cookTetrahedronMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + + \note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() + or PxCooking::getStandaloneInsertionCallback(). + + \param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. + \param[in] insertionCallback The insertion interface from PxPhysics. + \return PxTetrahedronMesh pointer on success. + + @see cookTetrahedronMesh() setParams() PxInsertionCallback + */ + virtual PxTetrahedronMesh* createTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback) const = 0; + + + /** + \brief Cooks and creates a tetrahedron mesh without going through a stream. Convenience function for standalone objects. + + \note This method does the same as cookTetrahedronMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + + \param[in] meshDesc The tetrahedron mesh descriptor to read the mesh from. + \return PxTetrahedronMesh pointer on success. + + @see cookTetrahedronMesh() PxInsertionCallback + */ + PX_FORCE_INLINE PxTetrahedronMesh* createTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc) const + { + return createTetrahedronMesh(meshDesc, const_cast(*this).getStandaloneInsertionCallback()); + } + + /** + \brief Computes the mapping between collision and simulation mesh + + The softbody deformation is computed on the simulation mesh. To deform the collision mesh accordingly + it needs to be specified how its vertices need to be placed and updated inside the deformation mesh. + This method computes that embedding information. + + \param[in] simulationMesh A tetrahedral mesh that defines the shape of the simulation mesh which is used to compute the body's deformation + \param[in] collisionMesh A tetrahedral mesh that defines the shape of the collision mesh which is used for collision detection + \param[in] collisionData A data container that contains acceleration structures and surface information of the collision mesh + \param[in] vertexToTet Optional indices (array of integers) that specifies the index of the tetrahedron in the simulation mesh that + contains a collision mesh vertex. If not provided, the embedding will be computed internally. If the simulation mesh is obtained from + PxTetMaker::createVoxelTetrahedronMesh, then the vertexToTet map createVoxelTetrahedronMesh returned should be used here. + \return PxCollisionMeshMappingData pointer that describes how the collision mesh is embedded into the simulation mesh + + @see PxTetMaker::createVoxelTetrahedronMesh + */ + virtual PxCollisionMeshMappingData* computeModelsMapping(PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, + const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet = NULL) const = 0; + + /** + \brief Computes data to accelerate collision detection of tetrahedral meshes + + Computes data structures to speed up collision detection with tetrahedral meshes. + + \param[in] collisionMeshDesc Raw tetrahedral mesh descriptor wich will be used for collision detection + \return PxCollisionTetrahedronMeshData pointer that describes the collision mesh + + */ + virtual PxCollisionTetrahedronMeshData* computeCollisionData(const PxTetrahedronMeshDesc& collisionMeshDesc) const = 0; + + /** + \brief Computes data to accelerate collision detection of tetrahedral meshes + + Computes data to compute and store a softbody's deformation using FEM. + + \param[in] simulationMeshDesc Raw tetrahedral mesh descriptor wich will be used for FEM simulation + \return PxSimulationTetrahedronMeshData pointer that describes the simulation mesh + + */ + virtual PxSimulationTetrahedronMeshData* computeSimulationData(const PxTetrahedronMeshDesc& simulationMeshDesc) const = 0; + + /** + \brief Bundles all data required for softbody simulation + + Creates a container that provides everything to create a PxSoftBody + + \param[in] simulationMesh The geometry (tetrahedral mesh) to be used as simulation mesh + \param[in] simulationData Additional non-tetmesh data that contains mass information etc. for the simulation mesh + \param[in] collisionMesh The geometry (tetrahedral mesh) to be used for collision detection + \param[in] collisionData Additional non-tetmesh data that contains surface information, acceleration structures etc. for the simulation mesh + \param[in] mappingData Mapping that describes how the collision mesh's vertices are embedded into the simulation mesh + \param[in] insertionCallback The insertion interface from PxPhysics. + \return PxSoftBodyMesh pointer that represents a softbody mesh bundling all data (simulation mesh, collision mesh etc.) + + @see PxSoftBody createSoftBody() + */ + virtual PxSoftBodyMesh* assembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, + PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const = 0; + + /** + \brief Bundles all data required for softbody simulation + + Creates a container that provides everything to create a PxSoftBody + + \param[in] simulationMesh Container that provides all information about the simulation mesh (geometry, mass distribution etc.) + \param[in] collisionMesh Container that provides all information about the collision mesh (geometry, surface information, acceleration structures etc.) + \param[in] mappingData Mapping that describes how the collision mesh's vertices are embedded into the simulation mesh + \param[in] insertionCallback The insertion interface from PxPhysics. + \return PxSoftBodyMesh pointer that represents a softbody mesh bundling all data (simulation mesh, collision mesh etc.) + + @see PxSoftBody createSoftBody() + */ + virtual PxSoftBodyMesh* assembleSoftBodyMesh(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, + PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const = 0; + + virtual bool cookConvexMesh(const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition = NULL) const = 0; + virtual PxConvexMesh* createConvexMesh(const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition = NULL) const = 0; + + /** + \brief Cooks and creates a convex mesh without going through a stream. Convenience function for standalone objects. + + \note This method does the same as cookConvexMesh, but the produced mesh is not stored + into a stream but is either directly inserted in PxPhysics, or created as a standalone + object. Use this method if you are unable to cook offline. + + \param[in] desc The convex mesh descriptor to read the mesh from. + \return PxConvexMesh pointer on success + + @see cookConvexMesh() PxInsertionCallback + */ + PX_FORCE_INLINE PxConvexMesh* createConvexMesh(const PxConvexMeshDesc& desc) const + { + return createConvexMesh(desc, const_cast(*this).getStandaloneInsertionCallback()); + } + + virtual bool validateConvexMesh(const PxConvexMeshDesc& desc) const = 0; + + virtual bool computeHullPolygons(const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices, + PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) const = 0; + + + virtual bool cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) const = 0; + + virtual PxHeightField* createHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback) const = 0; + + + /** + \brief Cooks and creates a heightfield mesh and inserts it into PxPhysics. Convenience function for standalone objects. + + \param[in] desc The heightfield descriptor to read the HF from. + \return PxHeightField pointer on success + + @see cookConvexMesh() PxPhysics.createTriangleMesh() PxInsertionCallback + */ + PX_FORCE_INLINE PxHeightField* createHeightField(const PxHeightFieldDesc& desc) const + { + return createHeightField(desc, const_cast(*this).getStandaloneInsertionCallback()); + } + + virtual bool cookBVH(const PxBVHDesc& desc, PxOutputStream& stream) const = 0; + + + /** + \brief Backward compatibility helper. Cooks a bounding volume hierarchy. The results are written to the stream. + + \param[in] desc The BVH descriptor. + \param[in] stream User stream to output the cooked data. + \return true on success. + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE bool cookBVHStructure(const PxBVHStructureDesc& desc, PxOutputStream& stream) const + { + return cookBVH(desc, stream); + } + + virtual PxBVH* createBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback) const = 0; + + PX_FORCE_INLINE PxBVH* createBVH(const PxBVHDesc& desc) const + { + return createBVH(desc, const_cast(*this).getStandaloneInsertionCallback()); + } + + /** + \brief Backward compatibility helper. Cooks and creates a bounding volume hierarchy without going through a stream. + + \param[in] desc The BVH descriptor. + \param[in] insertionCallback The insertion interface. + \return PxBVH pointer on success + @deprecated + */ + PX_DEPRECATED PX_FORCE_INLINE PxBVHStructure* createBVHStructure(const PxBVHStructureDesc& desc, PxInsertionCallback& insertionCallback) const + { + return createBVH(desc, insertionCallback); + } + + /** + \brief Gets standalone object insertion interface. + + This interface allows the creation of standalone objects that can exist without a PxPhysics or PxScene object. + + @see PxCooking::createTriangleMesh PxCooking::createHeightfield PxCooking::createTetrahedronMesh PxCooking::createBVH + */ + virtual PxInsertionCallback& getStandaloneInsertionCallback() = 0; + +protected: + virtual ~PxCooking(){} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCooking* PX_CALL_CONV PxCreateCooking(physx::PxU32 version, + physx::PxFoundation& foundation, + const physx::PxCookingParams& params); + +// Immediate cooking + +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxInsertionCallback* PxGetStandaloneInsertionCallback(); + +// BVH + +/** +\brief Cooks a bounding volume hierarchy. The results are written to the stream. + +PxCookBVH() allows a BVH description to be cooked into a binary stream +suitable for loading and performing BVH detection at runtime. + +\param[in] desc The BVH descriptor. +\param[in] stream User stream to output the cooked data. +\return true on success. + +@see PxBVH PxRigidActorExt::getRigidActorShapeLocalBoundsList +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookBVH(const physx::PxBVHDesc& desc, physx::PxOutputStream& stream); +/** +\brief Cooks and creates a bounding volume hierarchy without going through a stream. + +\note This method does the same as cookBVH, but the produced BVH is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxCooking::getStandaloneInsertionCallback(). + +\param[in] desc The BVH descriptor. +\param[in] insertionCallback The insertion interface. +\return PxBVH pointer on success + +@see PxCookBVH() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxBVH* PxCreateBVH(const physx::PxBVHDesc& desc, physx::PxInsertionCallback& insertionCallback); + +// Heightfield + +/** +\brief Cooks a heightfield. The results are written to the stream. + +To create a heightfield object there is an option to precompute some of calculations done while loading the heightfield data. + +cookHeightField() allows a heightfield description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] desc The heightfield descriptor to read the HF from. +\param[in] stream User stream to output the cooked data. +\return true on success + +@see PxPhysics.createHeightField() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookHeightField(const physx::PxHeightFieldDesc& desc, physx::PxOutputStream& stream); +/** +\brief Cooks and creates a heightfield mesh and inserts it into PxPhysics. + +\param[in] desc The heightfield descriptor to read the HF from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\return PxHeightField pointer on success + +@see PxCookConvexMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxHeightField* PxCreateHeightField(const physx::PxHeightFieldDesc& desc, physx::PxInsertionCallback& insertionCallback); + +// Convex meshes + +/** +\brief Cooks a convex mesh. The results are written to the stream. + +To create a triangle mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection. + +cookConvexMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\note The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 255. +\note If those limits are exceeded in either the user-provided data or the final cooked mesh, an error is reported. + +\param[in] desc The convex mesh descriptor to read the mesh from. +\param[in] stream User stream to output the cooked data. +\param[out] condition Result from convex mesh cooking. +\return true on success. + +@see PxCookTriangleMesh() PxConvexMeshCookingResult::Enum +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc, physx::PxOutputStream& stream, physx::PxConvexMeshCookingResult::Enum* condition=NULL); +/** +\brief Cooks and creates a convex mesh without going through a stream. + +\note This method does the same as cookConvexMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxCooking::getStandaloneInsertionCallback(). + +\param[in] desc The convex mesh descriptor to read the mesh from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\param[out] condition Result from convex mesh cooking. +\return PxConvexMesh pointer on success + +@see PxCookConvexMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxConvexMesh* PxCreateConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc, physx::PxInsertionCallback& insertionCallback, physx::PxConvexMeshCookingResult::Enum* condition=NULL); + +/** +\brief Verifies if the convex mesh is valid. Prints an error message for each inconsistency found. + +The convex mesh descriptor must contain an already created convex mesh - the vertices, indices and polygons must be provided. + +\note This function should be used if PxConvexFlag::eDISABLE_MESH_VALIDATION is planned to be used in release builds. + +\param[in] desc The convex mesh descriptor to read the mesh from. + +\return true if all the validity conditions hold, false otherwise. + +@see cookConvexMesh() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxValidateConvexMesh(const physx::PxCookingParams& params, const physx::PxConvexMeshDesc& desc); +/** +\brief Computed hull polygons from given vertices and triangles. Polygons are needed for PxConvexMeshDesc rather than triangles. + +Please note that the resulting polygons may have different number of vertices. Some vertices may be removed. +The output vertices, indices and polygons must be used to construct a hull. + +The provided PxAllocatorCallback does allocate the out array's. It is the user responsibility to deallocated those +array's. + +\param[in] mesh Simple triangle mesh containing vertices and triangles used to compute polygons. +\param[in] inCallback Memory allocator for out array allocations. +\param[out] nbVerts Number of vertices used by polygons. +\param[out] vertices Vertices array used by polygons. +\param[out] nbIndices Number of indices used by polygons. +\param[out] indices Indices array used by polygons. +\param[out] nbPolygons Number of created polygons. +\param[out] hullPolygons Polygons array. +\return true on success + +@see PxCookConvexMesh() PxConvexFlags PxConvexMeshDesc PxSimpleTriangleMesh +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxComputeHullPolygons(const physx::PxCookingParams& params, const physx::PxSimpleTriangleMesh& mesh, physx::PxAllocatorCallback& inCallback, physx::PxU32& nbVerts, physx::PxVec3*& vertices, + physx::PxU32& nbIndices, physx::PxU32*& indices, physx::PxU32& nbPolygons, physx::PxHullPolygon*& hullPolygons); + +// Triangle meshes + +/** +\brief Verifies if the triangle mesh is valid. Prints an error message for each inconsistency found. + +The following conditions are true for a valid triangle mesh: +1. There are no duplicate vertices (within specified vertexWeldTolerance. See PxCookingParams::meshWeldTolerance) +2. There are no large triangles (within specified PxTolerancesScale.) + +\param[in] desc The triangle mesh descriptor to read the mesh from. + +\return true if all the validity conditions hold, false otherwise. + +@see PxCookTriangleMesh() +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxValidateTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc); +/** +\brief Cooks and creates a triangle mesh without going through a stream. + +\note This method does the same as cookTriangleMesh, but the produced mesh is not stored +into a stream but is either directly inserted in PxPhysics, or created as a standalone +object. Use this method if you are unable to cook offline. + +\note PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() +or PxCooking::getStandaloneInsertionCallback(). + +\param[in] desc The triangle mesh descriptor to read the mesh from. +\param[in] insertionCallback The insertion interface from PxPhysics. +\param[out] condition Result from triangle mesh cooking. +\return PxTriangleMesh pointer on success. + +@see PxCookTriangleMesh() PxPhysics.createTriangleMesh() PxInsertionCallback +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTriangleMesh* PxCreateTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc, physx::PxInsertionCallback& insertionCallback, physx::PxTriangleMeshCookingResult::Enum* condition=NULL); +/** +\brief Cooks a triangle mesh. The results are written to the stream. + +To create a triangle mesh object it is necessary to first 'cook' the mesh data into +a form which allows the SDK to perform efficient collision detection. + +PxCookTriangleMesh() allows a mesh description to be cooked into a binary stream +suitable for loading and performing collision detection at runtime. + +\param[in] desc The triangle mesh descriptor to read the mesh from. +\param[in] stream User stream to output the cooked data. +\param[out] condition Result from triangle mesh cooking. +\return true on success + +@see PxCookConvexMesh() PxPhysics.createTriangleMesh() PxTriangleMeshCookingResult::Enum +*/ +PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookTriangleMesh(const physx::PxCookingParams& params, const physx::PxTriangleMeshDesc& desc, physx::PxOutputStream& stream, physx::PxTriangleMeshCookingResult::Enum* condition=NULL); + +// Tetrahedron & soft body meshes +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookTetrahedronMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& meshDesc, physx::PxOutputStream& stream); +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTetrahedronMesh* PxCreateTetrahedronMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& meshDesc, physx::PxInsertionCallback& insertionCallback); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API bool PxCookSoftBodyMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxSoftBodySimulationDataDesc& softbodyDataDesc, physx::PxOutputStream& stream); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxSoftBodyMesh* PxCreateSoftBodyMesh(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& simulationMeshDesc, const physx::PxTetrahedronMeshDesc& collisionMeshDesc, + const physx::PxSoftBodySimulationDataDesc& softbodyDataDesc, physx::PxInsertionCallback& insertionCallback); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCollisionMeshMappingData* PxComputeModelsMapping(const physx::PxCookingParams& params, physx::PxTetrahedronMeshData& simulationMesh, const physx::PxTetrahedronMeshData& collisionMesh, + const physx::PxSoftBodyCollisionData& collisionData, const physx::PxBoundedData* vertexToTet = NULL); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCollisionTetrahedronMeshData* PxComputeCollisionData(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& collisionMeshDesc); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxSimulationTetrahedronMeshData* PxComputeSimulationData(const physx::PxCookingParams& params, const physx::PxTetrahedronMeshDesc& simulationMeshDesc); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxSoftBodyMesh* PxAssembleSoftBodyMesh(physx::PxTetrahedronMeshData& simulationMesh, physx::PxSoftBodySimulationData& simulationData, physx::PxTetrahedronMeshData& collisionMesh, + physx::PxSoftBodyCollisionData& collisionData, physx::PxCollisionMeshMappingData& mappingData, physx::PxInsertionCallback& insertionCallback); + +PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxSoftBodyMesh* PxAssembleSoftBodyMesh_Sim(physx::PxSimulationTetrahedronMeshData& simulationMesh, physx::PxCollisionTetrahedronMeshData& collisionMesh, + physx::PxCollisionMeshMappingData& mappingData, physx::PxInsertionCallback& insertionCallback); + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCookingInternal.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCookingInternal.h new file mode 100644 index 0000000..73972a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxCookingInternal.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_COOKING_INTERNAL_H +#define PX_COOKING_INTERNAL_H +/** \addtogroup cooking +@{ +*/ + +#include "cooking/PxCooking.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxTriangleMeshInternalData; + struct PxBVHInternalData; + class PxTriangleMesh; + class PxBVH; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxTriangleMesh* PX_CALL_CONV PxCreateTriangleMeshInternal(const physx::PxTriangleMeshInternalData& data, const physx::PxCooking& cooking); + + PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxBVH* PX_CALL_CONV PxCreateBVHInternal(const physx::PxBVHInternalData& data, const physx::PxCooking& cooking); + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxMidphaseDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxMidphaseDesc.h new file mode 100644 index 0000000..ee63e01 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxMidphaseDesc.h @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MIDPHASE_DESC_H +#define PX_MIDPHASE_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "geometry/PxTriangleMesh.h" +#include "cooking/PxBVH33MidphaseDesc.h" +#include "cooking/PxBVH34MidphaseDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + +\brief Structure describing parameters affecting midphase mesh structure. + +@see PxCookingParams, PxBVH33MidphaseDesc, PxBVH34MidphaseDesc +*/ +class PxMidphaseDesc +{ +public: + PX_FORCE_INLINE PxMidphaseDesc() { setToDefault(PxMeshMidPhase::eBVH34); } + + /** + \brief Returns type of midphase mesh structure. + \return PxMeshMidPhase::Enum + + @see PxMeshMidPhase::Enum + */ + PX_FORCE_INLINE PxMeshMidPhase::Enum getType() const { return mType; } + + /** + \brief Midphase descriptors union + + @see PxBV33MidphaseDesc, PxBV34MidphaseDesc + */ + union { + PxBVH33MidphaseDesc mBVH33Desc; + PxBVH34MidphaseDesc mBVH34Desc; + }; + + /** + \brief Initialize the midphase mesh structure descriptor + \param[in] type Midphase mesh structure descriptor + + @see PxBV33MidphaseDesc, PxBV34MidphaseDesc + */ + void setToDefault(PxMeshMidPhase::Enum type) + { + mType = type; + if(type==PxMeshMidPhase::eBVH33) + mBVH33Desc.setToDefault(); + else if(type==PxMeshMidPhase::eBVH34) + mBVH34Desc.setToDefault(); + } + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid. + */ + bool isValid() const + { + if(mType==PxMeshMidPhase::eBVH33) + return mBVH33Desc.isValid(); + else if(mType==PxMeshMidPhase::eBVH34) + return mBVH34Desc.isValid(); + return false; + } + + /** + \brief Assignment operator + \return this + */ + PX_FORCE_INLINE PxMidphaseDesc& operator=(PxMeshMidPhase::Enum descType) + { + setToDefault(descType); + return *this; + } + +protected: + PxMeshMidPhase::Enum mType; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + + /** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxSDFDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxSDFDesc.h new file mode 100644 index 0000000..4f37a2a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxSDFDesc.h @@ -0,0 +1,196 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SDF_DESC_H +#define PX_SDF_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "PxPhysXConfig.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A helper structure to define dimensions in 3D + */ + struct PxDim3 + { + PxU32 x, y, z; + }; + + /** + \brief Defines the number of bits per subgrid pixel + */ + class PxSdfBitsPerSubgridPixel + { + public: + enum Enum + { + e8_BIT_PER_PIXEL = 1, //!< 8 bit per subgrid pixel (values will be stored as normalized integers) + e16_BIT_PER_PIXEL = 2, //!< 16 bit per subgrid pixel (values will be stored as normalized integers) + e32_BIT_PER_PIXEL = 4 //!< 32 bit per subgrid pixel (values will be stored as floats in world scale units) + }; + }; + + /** + \brief A structure describing signed distance field for mesh. + */ + class PxSDFDesc + { + public: + + /** + \brief Pointer to first sdf array element. + */ + PxBoundedData sdf; + + /** + \brief Dimensions of sdf + */ + PxDim3 dims; + + /** + \brief The Lower bound of the original mesh + */ + PxVec3 meshLower; + + /** + \brief The spacing of each sdf voxel + */ + PxReal spacing; + + + /** + \brief The number of cells in a sparse subgrid block (full block has subgridSize^3 cells and (subgridSize+1)^3 samples). If set to zero, this indicates that only a dense background grid SDF is used without sparse blocks + */ + PxU32 subgridSize; + + /** + \brief Enumeration that defines the number of bits per subgrid pixel (either 32, 16 or 8bits) + */ + PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel; + + /** + \brief Number of subgrid blocks in the 3d texture. The full texture dimension will be sdfSubgrids3DTexBlockDim*(subgridSize+1). + */ + PxDim3 sdfSubgrids3DTexBlockDim; + + /** + \brief The data to create the 3d texture containg the packed subgrid blocks. Stored as PxU8 to support multiple formats (8, 16 and 32 bits per pixel) + */ + PxBoundedData sdfSubgrids; + + /** + \brief Array with start indices into the subgrid texture for every subgrid block. 10bits for z coordinate, 10bits for y and 10bits for x. Encoding is as follows: slot = (z << 20) | (y << 10) | x + */ + PxBoundedData sdfStartSlots; + + /** + \brief The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + */ + PxReal subgridsMinSdfValue; + + /** + \brief The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + */ + PxReal subgridsMaxSdfValue; + + /** + \brief The bounds of the sdf. If left unassigned (empty), the bounds of the mesh will be used + */ + PxBounds3 sdfBounds; + + /** + \brief Narrow band thickness as a fraction of the bounds diagonal length. Every subgrid block that + overlaps with the narrow band around the mesh surface will be kept providing high resultion around the mesh surface. + The valid range of this parameter is (0, 1). The higher the value, the more subgrids will get created, the more memory will be required. + */ + PxReal narrowBandThicknessRelativeToSdfBoundsDiagonal; + + /** + \brief The number of threads that are launched to compute the signed distance field + */ + PxU32 numThreadsForSdfConstruction; + + /** + \brief Constructor + */ + PX_INLINE PxSDFDesc(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const; + }; + + PX_INLINE PxSDFDesc::PxSDFDesc() + { + sdf.data = NULL; + dims.x = 0; + dims.y = 0; + dims.z = 0; + spacing = 0; + meshLower = PxVec3(PxZero); + subgridSize = 0; + subgridsMinSdfValue = 0.0f; + subgridsMaxSdfValue = 0.0f; + sdfBounds = PxBounds3::empty(); + bitsPerSubgridPixel = PxSdfBitsPerSubgridPixel::e16_BIT_PER_PIXEL; + narrowBandThicknessRelativeToSdfBoundsDiagonal = 0.01f; + numThreadsForSdfConstruction = 1; + } + + PX_INLINE bool PxSDFDesc::isValid() const + { + // Check validity of user's input(if any) + if (sdf.data) + { + if (dims.x < 1 || dims.y < 1 || dims.z < 1) + return false; + if (!meshLower.isFinite()) + return false; + if (spacing <= 0) + return false; + } + + return true; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTetrahedronMeshDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTetrahedronMeshDesc.h new file mode 100644 index 0000000..5d68d02 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTetrahedronMeshDesc.h @@ -0,0 +1,233 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETRAHEDRON_MESH_DESC_H +#define PX_TETRAHEDRON_MESH_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + \brief Descriptor class for #PxTetrahedronMesh (contains only pure geometric data). + + @see PxTetrahedronMesh PxShape + */ + class PxTetrahedronMeshDesc + { + public: + + /** + \brief Defines the tetrahedron structure of a mesh. + */ + enum PxMeshFormat + { + eTET_MESH, //!< Normal tetmesh with arbitrary tetrahedra + eHEX_MESH //!< 6 tetrahedra in a row will form a hexahedron + }; + + + /** + Optional pointer to first material index, or NULL. There are PxTetrahedronMesh::numTriangles indices in total. + Caller may add materialIndexStride bytes to the pointer to access the next triangle. + + When a tetrahedron mesh collides with another object, a material is required at the collision point. + If materialIndices is NULL, then the material of the PxShape instance is used. + Otherwise, if the point of contact is on a tetrahedron with index i, then the material index is determined as: + PxFEMMaterialTableIndex index = *(PxFEMMaterialTableIndex *)(((PxU8*)materialIndices) + materialIndexStride * i); + + If the contact point falls on a vertex or an edge, a tetrahedron adjacent to the vertex or edge is selected, and its index + used to look up a material. The selection is arbitrary but consistent over time. + + Default: NULL + + @see materialIndexStride + */ + PxTypedStridedData materialIndices; + + /** + \brief Pointer to first vertex point. + */ + PxBoundedData points; + + /** + \brief Pointer to first tetrahedron. + + Caller may add tetrhedronStrideBytes bytes to the pointer to access the next tetrahedron. + + These are quadruplets of 0 based indices: + vert0 vert1 vert2 vert3 + vert0 vert1 vert2 vert3 + vert0 vert1 vert2 vert3 + ... + + where vertex is either a 32 or 16 bit unsigned integer. There are numTetrahedrons*4 indices. + + This is declared as a void pointer because it is actually either an PxU16 or a PxU32 pointer. + */ + PxBoundedData tetrahedrons; + + + /** + \brief Flags bits, combined from values of the enum ::PxMeshFlag + */ + PxMeshFlags flags; + + /** + \brief Used for simulation meshes only. Defines if this tet mesh should be simulated as a tet mesh, + or if a set of tetrahedra should be used to represent another shape, e.g. a hexahedral mesh constructed + from 6 elements. + */ + PxU16 tetsPerElement; + + /** + \brief Constructor to build an empty tetmesh description + */ + PxTetrahedronMeshDesc() + { + points.count = 0; + points.stride = 0; + points.data = NULL; + + tetrahedrons.count = 0; + tetrahedrons.stride = 0; + tetrahedrons.data = NULL; + + tetsPerElement = 1; + } + + /** + \brief Constructor to build a tetmeshdescription that links to the vertices and indices provided + */ + PxTetrahedronMeshDesc(physx::PxArray& meshVertices, physx::PxArray& meshTetIndices, const PxTetrahedronMeshDesc::PxMeshFormat meshFormat = eTET_MESH) + { + points.count = meshVertices.size(); + points.stride = sizeof(float) * 3; + points.data = meshVertices.begin(); + + tetrahedrons.count = meshTetIndices.size() / 4; + tetrahedrons.stride = sizeof(int) * 4; + tetrahedrons.data = meshTetIndices.begin(); + + if (meshFormat == eTET_MESH) + tetsPerElement = 1; + else + tetsPerElement = 6; + } + + PX_INLINE bool isValid() const + { + // Check geometry of the collision mesh + if (points.count < 4) //at least 1 tetrahedron's worth of points + return false; + if ((!tetrahedrons.data) && (points.count % 4)) // Non-indexed mesh => we must ensure the geometry defines an implicit number of tetrahedrons // i.e. numVertices can't be divided by 4 + return false; + if (points.count > 0xffff && flags & PxMeshFlag::e16_BIT_INDICES) + return false; + if (!points.data) + return false; + if (points.stride < sizeof(PxVec3)) //should be at least one point's worth of data + return false; + + //add more validity checks here + if (materialIndices.data && materialIndices.stride < sizeof(PxFEMMaterialTableIndex)) + return false; + + // The tetrahedrons pointer is not mandatory + if (tetrahedrons.data) + { + // Indexed collision mesh + PxU32 limit = (flags & PxMeshFlag::e16_BIT_INDICES) ? sizeof(PxU16) * 4 : sizeof(PxU32) * 4; + if (tetrahedrons.stride < limit) + return false; + } + + //The model can only be either a tetmesh (1 tet per element), or have 5 or 6 tets per hex element, otherwise invalid. + if (tetsPerElement != 1 && tetsPerElement != 6) + return false; + + return true; + } + }; + + ///** + //\brief Descriptor class for #PxSoftBodyMesh (contains only additional data used for softbody simulation). + + //@see PxSoftBodyMesh PxShape + //*/ + class PxSoftBodySimulationDataDesc + { + public: + /** + \brief Pointer to first index of tetrahedron that contains the vertex at the same location in the vertex buffer. + if left unassigned it will be computed automatically. If a point is inside multiple tetrahedra (ambiguous case), the frist one found will be taken. + */ + PxBoundedData vertexToTet; + + /** + \brief Constructor to build an empty simulation description + */ + PxSoftBodySimulationDataDesc() + { + vertexToTet.count = 0; + vertexToTet.stride = 0; + vertexToTet.data = NULL; + } + + /** + \brief Constructor to build a simulation description with a defined vertex to tetrahedron mapping + */ + PxSoftBodySimulationDataDesc(physx::PxArray& vertToTet) + { + vertexToTet.count = vertToTet.size(); + vertexToTet.stride = sizeof(PxI32); + vertexToTet.data = vertToTet.begin(); + } + + PX_INLINE bool isValid() const + { + return true; + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTriangleMeshDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTriangleMeshDesc.h new file mode 100644 index 0000000..10f5291 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/PxTriangleMeshDesc.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_DESC_H +#define PX_TRIANGLE_MESH_DESC_H +/** \addtogroup cooking +@{ +*/ + +#include "PxPhysXConfig.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "PxSDFDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + +/** +\brief Descriptor class for #PxTriangleMesh. + +Note that this class is derived from PxSimpleTriangleMesh which contains the members that describe the basic mesh. +The mesh data is *copied* when an PxTriangleMesh object is created from this descriptor. After the call the +user may discard the triangle data. + +@see PxTriangleMesh PxTriangleMeshGeometry PxShape +*/ +class PxTriangleMeshDesc : public PxSimpleTriangleMesh +{ +public: + + /** + Optional pointer to first material index, or NULL. There are PxSimpleTriangleMesh::numTriangles indices in total. + Caller may add materialIndexStride bytes to the pointer to access the next triangle. + + When a triangle mesh collides with another object, a material is required at the collision point. + If materialIndices is NULL, then the material of the PxShape instance is used. + Otherwise, if the point of contact is on a triangle with index i, then the material index is determined as: + PxMaterialTableIndex index = *(PxMaterialTableIndex *)(((PxU8*)materialIndices) + materialIndexStride * i); + + If the contact point falls on a vertex or an edge, a triangle adjacent to the vertex or edge is selected, and its index + used to look up a material. The selection is arbitrary but consistent over time. + + Default: NULL + + @see materialIndexStride + */ + PxTypedStridedData materialIndices; + + /** + \brief SDF descriptor. When this descriptor is set, signed distance field is calculated for this convex mesh. + + Default: NULL + */ + PxSDFDesc* sdfDesc; + + /** + \brief Constructor sets to default. + */ + PX_INLINE PxTriangleMeshDesc(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return true if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + + +PX_INLINE PxTriangleMeshDesc::PxTriangleMeshDesc() //constructor sets to default +{ + PxSimpleTriangleMesh::setToDefault(); + sdfDesc = NULL; +} + +PX_INLINE void PxTriangleMeshDesc::setToDefault() +{ + *this = PxTriangleMeshDesc(); +} + +PX_INLINE bool PxTriangleMeshDesc::isValid() const +{ + if(points.count < 3) //at least 1 trig's worth of points + return false; + if ((!triangles.data) && (points.count%3)) // Non-indexed mesh => we must ensure the geometry defines an implicit number of triangles // i.e. numVertices can't be divided by 3 + return false; + //add more validity checks here + if (materialIndices.data && materialIndices.stride < sizeof(PxMaterialTableIndex)) + return false; + + if (sdfDesc && !sdfDesc->isValid()) + return false; + + return PxSimpleTriangleMesh::isValid(); +} + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/Pxc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/Pxc.h new file mode 100644 index 0000000..7f00d76 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cooking/Pxc.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_H +#define PXC_H + +#include "foundation/Px.h" + +// define API function declaration +#if !defined PX_PHYSX_STATIC_LIB + #if PX_WINDOWS_FAMILY + #if defined PX_PHYSX_COOKING_EXPORTS + #define PX_PHYSX_COOKING_API __declspec(dllexport) + #else + #define PX_PHYSX_COOKING_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_PHYSX_COOKING_API PX_UNIX_EXPORT + #endif +#endif + +#if !defined(PX_PHYSX_COOKING_API) + #define PX_PHYSX_COOKING_API +#endif + +#ifndef PX_C_EXPORT + #define PX_C_EXPORT extern "C" +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContext.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContext.h new file mode 100644 index 0000000..15e1926 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContext.h @@ -0,0 +1,182 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CUDA_CONTEX_H +#define PX_CUDA_CONTEX_H + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + struct PxCudaKernelParam + { + void* data; + size_t size; + }; + + // workaround for not being able to forward declare enums in PxCudaTypes.h. + // provides different automatic casting depending on whether cuda.h was included beforehand or not. + template + struct PxCUenum + { + PxU32 value; + + PxCUenum(CUenum e) { value = PxU32(e); } + operator CUenum() const { return CUenum(value); } + }; + +#ifdef CUDA_VERSION + typedef PxCUenum PxCUjit_option; + typedef PxCUenum PxCUresult; +#else + typedef PxCUenum PxCUjit_option; + typedef PxCUenum PxCUresult; +#endif + +#define PX_CUDA_KERNEL_PARAM(X) { (void*)&X, sizeof(X) } +#define PX_CUDA_KERNEL_PARAM2(X) (void*)&X + + class PxDeviceAllocatorCallback; + /** + Cuda Context + */ + class PxCudaContext + { + protected: + virtual ~PxCudaContext() {} + + PxDeviceAllocatorCallback* mAllocatorCallback; + + public: + virtual void release() = 0; + + virtual PxCUresult memAlloc(CUdeviceptr *dptr, size_t bytesize) = 0; + + virtual PxCUresult memFree(CUdeviceptr dptr) = 0; + + virtual PxCUresult memHostAlloc(void **pp, size_t bytesize, unsigned int Flags) = 0; + + virtual PxCUresult memFreeHost(void *p) = 0; + + virtual PxCUresult memHostGetDevicePointer(CUdeviceptr *pdptr, void *p, unsigned int Flags) = 0; + + virtual PxCUresult moduleLoadDataEx(CUmodule *module, const void *image, unsigned int numOptions, PxCUjit_option *options, void **optionValues) = 0; + + virtual PxCUresult moduleGetFunction(CUfunction *hfunc, CUmodule hmod, const char *name) = 0; + + virtual PxCUresult moduleUnload(CUmodule hmod) = 0; + + virtual PxCUresult streamCreate(CUstream *phStream, unsigned int Flags) = 0; + + virtual PxCUresult streamCreateWithPriority(CUstream *phStream, unsigned int flags, int priority) = 0; + + virtual PxCUresult streamFlush(CUstream hStream) = 0; + + virtual PxCUresult streamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int Flags) = 0; + + virtual PxCUresult streamDestroy(CUstream hStream) = 0; + + virtual PxCUresult streamSynchronize(CUstream hStream) = 0; + + virtual PxCUresult eventCreate(CUevent *phEvent, unsigned int Flags) = 0; + + virtual PxCUresult eventRecord(CUevent hEvent, CUstream hStream) = 0; + + virtual PxCUresult eventQuery(CUevent hEvent) = 0; + + virtual PxCUresult eventSynchronize(CUevent hEvent) = 0; + + virtual PxCUresult eventDestroy(CUevent hEvent) = 0; + + virtual PxCUresult launchKernel( + CUfunction f, + unsigned int gridDimX, + unsigned int gridDimY, + unsigned int gridDimZ, + unsigned int blockDimX, + unsigned int blockDimY, + unsigned int blockDimZ, + unsigned int sharedMemBytes, + CUstream hStream, + PxCudaKernelParam* kernelParams, + size_t kernelParamsSizeInBytes, + void** extra = NULL + ) = 0; + + // PT: same as above but without copying the kernel params to a local stack before the launch + // i.e. the kernelParams data is passed directly to the kernel. + virtual PxCUresult launchKernel( + CUfunction f, + PxU32 gridDimX, PxU32 gridDimY, PxU32 gridDimZ, + PxU32 blockDimX, PxU32 blockDimY, PxU32 blockDimZ, + PxU32 sharedMemBytes, + CUstream hStream, + void** kernelParams, + void** extra = NULL + ) = 0; + + virtual PxCUresult memcpyDtoH(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount) = 0; + + virtual PxCUresult memcpyDtoHAsync(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyHtoD(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount) = 0; + + virtual PxCUresult memcpyHtoDAsync(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyDtoDAsync(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memcpyDtoD(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount) = 0; + + virtual PxCUresult memcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream) = 0; + + virtual PxCUresult memsetD32Async(CUdeviceptr dstDevice, unsigned int ui, size_t N, CUstream hStream) = 0; + + virtual PxCUresult memsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream) = 0; + + virtual PxCUresult memsetD32(CUdeviceptr dstDevice, unsigned int ui, size_t N) = 0; + + virtual PxCUresult memsetD16(CUdeviceptr dstDevice, unsigned short uh, size_t N) = 0; + + virtual PxCUresult memsetD8(CUdeviceptr dstDevice, unsigned char uc, size_t N) = 0; + + virtual PxCUresult getLastError() = 0; + + PxDeviceAllocatorCallback* getAllocatorCallback() { return mAllocatorCallback; } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_SUPPORT_GPU_PHYSX +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContextManager.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContextManager.h new file mode 100644 index 0000000..49aa0df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaContextManager.h @@ -0,0 +1,564 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CUDA_CONTEXT_MANAGER_H +#define PX_CUDA_CONTEXT_MANAGER_H + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxFlags.h" + +#include "PxCudaTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxCudaContext; + +/** \brief Possible graphic/CUDA interoperability modes for context */ +struct PxCudaInteropMode +{ + /** + * \brief Possible graphic/CUDA interoperability modes for context + */ + enum Enum + { + NO_INTEROP = 0, + D3D10_INTEROP, + D3D11_INTEROP, + OGL_INTEROP, + + COUNT + }; +}; + +struct PxCudaInteropRegisterFlag +{ + enum Enum + { + eNONE = 0x00, + eREAD_ONLY = 0x01, + eWRITE_DISCARD = 0x02, + eSURFACE_LDST = 0x04, + eTEXTURE_GATHER = 0x08 + }; +}; + +/** +\brief An interface class that the user can implement in order for PhysX to use a user-defined device memory allocator. +*/ +class PxDeviceAllocatorCallback +{ +public: + + /** + \brief Allocated device memory. + \param[in] ptr Pointer to store the allocated address + \param[in] size The amount of memory required + \return A boolean indicates the operation succeed or fail + */ + virtual bool memAlloc(void** ptr, size_t size) = 0; + + /** + \brief Frees device memory. + \param[in] ptr The memory to free + \return A boolean indicates the operation succeed or fail + */ + virtual bool memFree(void* ptr) = 0; + +protected: + virtual ~PxDeviceAllocatorCallback() {} +}; +/** +\brief collection of set bits defined in NxCudaInteropRegisterFlag. + +@see NxCudaInteropRegisterFlag +*/ +typedef PxFlags PxCudaInteropRegisterFlags; +PX_FLAGS_OPERATORS(PxCudaInteropRegisterFlag::Enum, uint32_t) + +//! \brief Descriptor used to create a PxCudaContextManager +class PxCudaContextManagerDesc +{ +public: + /** + * \brief The CUDA context to manage + * + * If left NULL, the PxCudaContextManager will create a new context. If + * graphicsDevice is also not NULL, this new CUDA context will be bound to + * that graphics device, enabling the use of CUDA/Graphics interop features. + * + * If ctx is not NULL, the specified context must be applied to the thread + * that is allocating the PxCudaContextManager at creation time (aka, it + * cannot be popped). The PxCudaContextManager will take ownership of the + * context until the manager is released. All access to the context must be + * gated by lock acquisition. + * + * If the user provides a context for the PxCudaContextManager, the context + * _must_ have either been created on the GPU ordinal returned by + * PxGetSuggestedCudaDeviceOrdinal() or on your graphics device. + */ + CUcontext* ctx; + + /** + * \brief D3D device pointer or OpenGl context handle + * + * Only applicable when ctx is NULL, thus forcing a new context to be + * created. In that case, the created context will be bound to this + * graphics device. + */ + void* graphicsDevice; + + /** + * \brief Application-specific GUID + * + * If your application employs PhysX modules that use CUDA you need to use a GUID + * so that patches for new architectures can be released for your game.You can obtain a GUID for your + * application from Nvidia. + */ + const char* appGUID; + + /** + * \brief Application-specific device memory allocator + * + * the application can implement an device memory allocator, which inherites PxDeviceAllocatorCallback, and + * pass that to the PxCudaContextManagerDesc. The SDK will use that allocator to allocate device memory instead of + * using the defaul CUDA device memory allocator. + */ + PxDeviceAllocatorCallback* deviceAllocator; + + /** + * \brief The CUDA/Graphics interop mode of this context + * + * If ctx is NULL, this value describes the nature of the graphicsDevice + * pointer provided by the user. Else it describes the nature of the + * context provided by the user. + */ + PxCudaInteropMode::Enum interopMode; + + PX_INLINE PxCudaContextManagerDesc() : + ctx (NULL), + graphicsDevice (NULL), + appGUID (NULL), + deviceAllocator (NULL), + interopMode (PxCudaInteropMode::NO_INTEROP) + { + } +}; + +/** +\brief A cuda kernel index providing an index to the cuda module and the function name +*/ +struct PxKernelIndex +{ + PxU32 moduleIndex; + const char* functionName; +}; + +/** + * \brief Manages thread locks, and task scheduling for a CUDA context + * + * A PxCudaContextManager manages access to a single CUDA context, allowing it to + * be shared between multiple scenes. + * The context must be acquired from the manager before using any CUDA APIs unless stated differently. + * + * The PxCudaContextManager is based on the CUDA driver API and explicitly does not + * support the CUDA runtime API (aka, CUDART). + */ +class PxCudaContextManager +{ +public: + /** + * \brief Schedules clear operation for a device memory buffer on the specified stream + * + * The cuda context will get acquired automatically + */ + template + void clearDeviceBufferAsync(T* deviceBuffer, PxU32 numElements, CUstream stream, PxI32 value = 0) + { + clearDeviceBufferAsyncInternal(deviceBuffer, numElements * sizeof(T), stream, value); + } + + /** + * \brief Copies a device buffer to the host + * + * The cuda context will get acquired automatically + */ + template + void copyDToH(T* hostBuffer, const T* deviceBuffer, PxU32 numElements) + { + copyDToHInternal(hostBuffer, deviceBuffer, numElements * sizeof(T)); + } + + /** + * \brief Copies a host buffer to the device + * + * The cuda context will get acquired automatically + */ + template + void copyHToD(T* deviceBuffer, const T* hostBuffer, PxU32 numElements) + { + copyHToDInternal(deviceBuffer, hostBuffer, numElements * sizeof(T)); + } + + /** + * \brief Schedules device to host copy operation on the specified stream + * + * The cuda context will get acquired automatically + */ + template + void copyDToHAsync(T* hostBuffer, const T* deviceBuffer, PxU32 numElements, CUstream stream) + { + copyDToHAsyncInternal(hostBuffer, deviceBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Schedules host to device copy operation on the specified stream + * + * The cuda context will get acquired automatically + */ + template + void copyHToDAsync(T* deviceBuffer, const T* hostBuffer, PxU32 numElements, CUstream stream) + { + copyHToDAsyncInternal(deviceBuffer, hostBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Schedules device to device copy operation on the specified stream + * + * The cuda context will get acquired automatically + */ + template + void copyDToDAsync(T* dstDeviceBuffer, const T* srcDeviceBuffer, PxU32 numElements, CUstream stream) + { + copyDToDAsyncInternal(dstDeviceBuffer, srcDeviceBuffer, numElements * sizeof(T), stream); + } + + /** + * \brief Allocates a device buffer + * + * The cuda context will get acquired automatically + */ + template + void allocDeviceBuffer(T*& deviceBuffer, PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocDeviceBufferInternal(numElements * sizeof(T), filename, line); + deviceBuffer = reinterpret_cast(ptr); + } + + /** + * \brief Allocates a device buffer and returns the pointer to the memory + * + * The cuda context will get acquired automatically + */ + template + T* allocDeviceBuffer(PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocDeviceBufferInternal(numElements * sizeof(T), filename, line); + return reinterpret_cast(ptr); + } + + /** + * \brief Frees a device buffer + * + * The cuda context will get acquired automatically + */ + template + void freeDeviceBuffer(T*& deviceBuffer) + { + freeDeviceBufferInternal(deviceBuffer); + deviceBuffer = NULL; + } + + /** + * \brief Allocates a pinned host buffer + * + * A pinned host buffer can be used on the gpu after getting a mapped device pointer from the pinned host buffer pointer, see getMappedDevicePtr + * The cuda context will get acquired automatically + * @see getMappedDevicePtr + */ + template + void allocPinnedHostBuffer(T*& pinnedHostBuffer, PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocPinnedHostBufferInternal(numElements * sizeof(T), filename, line); + pinnedHostBuffer = reinterpret_cast(ptr); + } + + /** + * \brief Allocates a pinned host buffer and returns the pointer to the memory + * + * A pinned host buffer can be used on the gpu after getting a mapped device pointer from the pinned host buffer pointer, see getMappedDevicePtr + * The cuda context will get acquired automatically + * @see getMappedDevicePtr + */ + template + T* allocPinnedHostBuffer(PxU32 numElements, const char* filename = __FILE__, PxI32 line = __LINE__) + { + void* ptr = allocPinnedHostBufferInternal(numElements * sizeof(T), filename, line); + return reinterpret_cast(ptr); + } + + /** + * \brief Frees a pinned host buffer + * + * The cuda context will get acquired automatically + */ + template + void freePinnedHostBuffer(T*& pinnedHostBuffer) + { + freePinnedHostBufferInternal(pinnedHostBuffer); + pinnedHostBuffer = NULL; + } + + /** + * \brief Gets a mapped pointer from a pinned host buffer that can be used in cuda kernels directly + * + * Data access performance with a mapped pinned host pointer will be slower than using a device pointer directly + * but the changes done in the kernel will be available on the host immediately. + * The cuda context will get acquired automatically + */ + virtual CUdeviceptr getMappedDevicePtr(void* pinnedHostBuffer) = 0; + + /** + * \brief Acquire the CUDA context for the current thread + * + * Acquisitions are allowed to be recursive within a single thread. + * You can acquire the context multiple times so long as you release + * it the same count. + * + * The context must be acquired before using most CUDA functions. + */ + virtual void acquireContext() = 0; + + /** + * \brief Release the CUDA context from the current thread + * + * The CUDA context should be released as soon as practically + * possible, to allow other CPU threads to work efficiently. + */ + virtual void releaseContext() = 0; + + /** + * \brief Return the CUcontext + */ + virtual CUcontext getContext() = 0; + + /** + * \brief Return the CudaContext + */ + virtual PxCudaContext* getCudaContext() = 0; + + /** + * \brief Context manager has a valid CUDA context + * + * This method should be called after creating a PxCudaContextManager, + * especially if the manager was responsible for allocating its own + * CUDA context (desc.ctx == NULL). + */ + virtual bool contextIsValid() const = 0; + + /* Query CUDA context and device properties, without acquiring context */ + + virtual bool supportsArchSM10() const = 0; //!< G80 + virtual bool supportsArchSM11() const = 0; //!< G92 + virtual bool supportsArchSM12() const = 0; //!< GT200 + virtual bool supportsArchSM13() const = 0; //!< GT260 + virtual bool supportsArchSM20() const = 0; //!< GF100 + virtual bool supportsArchSM30() const = 0; //!< GK100 + virtual bool supportsArchSM35() const = 0; //!< GK110 + virtual bool supportsArchSM50() const = 0; //!< GM100 + virtual bool supportsArchSM52() const = 0; //!< GM200 + virtual bool supportsArchSM60() const = 0; //!< GP100 + virtual bool isIntegrated() const = 0; //!< true if GPU is an integrated (MCP) part + virtual bool canMapHostMemory() const = 0; //!< true if GPU map host memory to GPU (0-copy) + virtual int getDriverVersion() const = 0; //!< returns cached value of cuGetDriverVersion() + virtual size_t getDeviceTotalMemBytes() const = 0; //!< returns cached value of device memory size + virtual int getMultiprocessorCount() const = 0; //!< returns cache value of SM unit count + virtual unsigned int getClockRate() const = 0; //!< returns cached value of SM clock frequency + virtual int getSharedMemPerBlock() const = 0; //!< returns total amount of shared memory available per block in bytes + virtual int getSharedMemPerMultiprocessor() const = 0; //!< returns total amount of shared memory available per multiprocessor in bytes + virtual unsigned int getMaxThreadsPerBlock() const = 0; //!< returns the maximum number of threads per block + virtual const char *getDeviceName() const = 0; //!< returns device name retrieved from driver + virtual CUdevice getDevice() const = 0; //!< returns device handle retrieved from driver + virtual PxCudaInteropMode::Enum getInteropMode() const = 0; //!< interop mode the context was created with + + virtual void setUsingConcurrentStreams(bool) = 0; //!< turn on/off using concurrent streams for GPU work + virtual bool getUsingConcurrentStreams() const = 0; //!< true if GPU work can run in concurrent streams + /* End query methods that don't require context to be acquired */ + + /** + * \brief Register a rendering resource with CUDA + * + * This function is called to register render resources (allocated + * from OpenGL) with CUDA so that the memory may be shared + * between the two systems. This is only required for render + * resources that are designed for interop use. In APEX, each + * render resource descriptor that could support interop has a + * 'registerInCUDA' boolean variable. + * + * The function must be called again any time your graphics device + * is reset, to re-register the resource. + * + * Returns true if the registration succeeded. A registered + * resource must be unregistered before it can be released. + * + * \param resource [OUT] the handle to the resource that can be used with CUDA + * \param buffer [IN] GLuint buffer index to be mapped to cuda + * \param flags [IN] cuda interop registration flags + */ + virtual bool registerResourceInCudaGL(CUgraphicsResource& resource, uint32_t buffer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; + + /** + * \brief Register a rendering resource with CUDA + * + * This function is called to register render resources (allocated + * from Direct3D) with CUDA so that the memory may be shared + * between the two systems. This is only required for render + * resources that are designed for interop use. In APEX, each + * render resource descriptor that could support interop has a + * 'registerInCUDA' boolean variable. + * + * The function must be called again any time your graphics device + * is reset, to re-register the resource. + * + * Returns true if the registration succeeded. A registered + * resource must be unregistered before it can be released. + * + * \param resource [OUT] the handle to the resource that can be used with CUDA + * \param resourcePointer [IN] A pointer to either IDirect3DResource9, or ID3D10Device, or ID3D11Resource to be registered. + * \param flags [IN] cuda interop registration flags + */ + virtual bool registerResourceInCudaD3D(CUgraphicsResource& resource, void* resourcePointer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; + + /** + * \brief Unregister a rendering resource with CUDA + * + * If a render resource was successfully registered with CUDA using + * the registerResourceInCuda***() methods, this function must be called + * to unregister the resource before the it can be released. + */ + virtual bool unregisterResourceInCuda(CUgraphicsResource resource) = 0; + + /** + * \brief Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel + * \note If using CUDA Interop, this will always return false + * \returns 1 if there is a dedicated GPU + * 0 if there is NOT a dedicated GPU + * -1 if the routine is not implemented + */ + virtual int usingDedicatedGPU() const = 0; + + /** + * \brief Get the cuda modules that have been loaded into this context on construction + * \return Pointer to the cuda modules + */ + virtual CUmodule* getCuModules() = 0; + + /** + * \brief Release the PxCudaContextManager + * + * If the PxCudaContextManager created the CUDA context it was + * responsible for, it also frees that context. + * + * Do not release the PxCudaContextManager if there are any scenes + * using it. Those scenes must be released first. + * + */ + virtual void release() = 0; + +protected: + + /** + * \brief protected destructor, use release() method + */ + virtual ~PxCudaContextManager() {} + + virtual void* allocDeviceBufferInternal(PxU32 numBytes, const char* filename = NULL, PxI32 line = -1) = 0; + virtual void* allocPinnedHostBufferInternal(PxU32 numBytes, const char* filename = NULL, PxI32 line = -1) = 0; + + virtual void freeDeviceBufferInternal(void* deviceBuffer) = 0; + virtual void freePinnedHostBufferInternal(void* pinnedHostBuffer) = 0; + + virtual void clearDeviceBufferAsyncInternal(void* deviceBuffer, PxU32 numBytes, CUstream stream, PxI32 value) = 0; + + virtual void copyDToHAsyncInternal(void* hostBuffer, const void* deviceBuffer, PxU32 numBytes, CUstream stream) = 0; + virtual void copyHToDAsyncInternal(void* deviceBuffer, const void* hostBuffer, PxU32 numBytes, CUstream stream) = 0; + virtual void copyDToDAsyncInternal(void* dstDeviceBuffer, const void* srcDeviceBuffer, PxU32 numBytes, CUstream stream) = 0; + + virtual void copyDToHInternal(void* hostBuffer, const void* deviceBuffer, PxU32 numBytes) = 0; + virtual void copyHToDInternal(void* deviceBuffer, const void* hostBuffer, PxU32 numBytes) = 0; +}; + +#define PX_DEVICE_ALLOC(cudaContextManager, deviceBuffer, numElements) cudaContextManager->allocDeviceBuffer(deviceBuffer, numElements, __FILE__, __LINE__) +#define PX_DEVICE_ALLOC_T(T, cudaContextManager, numElements) cudaContextManager->allocDeviceBuffer(numElements, __FILE__, __LINE__) +#define PX_DEVICE_FREE(cudaContextManager, deviceBuffer) cudaContextManager->freeDeviceBuffer(deviceBuffer); + +#define PX_PINNED_HOST_ALLOC(cudaContextManager, pinnedHostBuffer, numElements) cudaContextManager->allocPinnedHostBuffer(pinnedHostBuffer, numElements, __FILE__, __LINE__) +#define PX_PINNED_HOST_ALLOC_T(T, cudaContextManager, numElements) cudaContextManager->allocPinnedHostBuffer(numElements, __FILE__, __LINE__) +#define PX_PINNED_HOST_FREE(cudaContextManager, pinnedHostBuffer) cudaContextManager->freePinnedHostBuffer(pinnedHostBuffer); + +/** + * \brief Convenience class for holding CUDA lock within a scope + */ +class PxScopedCudaLock +{ +public: + /** + * \brief ScopedCudaLock constructor + */ + PxScopedCudaLock(PxCudaContextManager& ctx) : mCtx(&ctx) + { + mCtx->acquireContext(); + } + + /** + * \brief ScopedCudaLock destructor + */ + ~PxScopedCudaLock() + { + mCtx->releaseContext(); + } + +protected: + + /** + * \brief CUDA context manager pointer (initialized in the constructor) + */ + PxCudaContextManager* mCtx; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // PX_SUPPORT_GPU_PHYSX +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaTypes.h new file mode 100644 index 0000000..97ee47d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/cudamanager/PxCudaTypes.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CUDA_TYPES_H +#define PX_CUDA_TYPES_H + +//type definitions to avoid forced inclusion of cuda.h +//if cuda.h is needed anyway, please include it before PxCudaContextManager.h, PxCudaContext.h or PxCudaTypes.h + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#ifndef CUDA_VERSION + +#include "foundation/PxSimpleTypes.h" + +#if PX_LINUX && !PX_A64 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" +#endif + +#if PX_P64_FAMILY +typedef unsigned long long CUdeviceptr; +#else +typedef unsigned int CUdeviceptr; +#endif + +#if PX_LINUX && !PX_A64 +#pragma GCC diagnostic pop +#endif + +typedef int CUdevice; + +typedef struct CUctx_st* CUcontext; +typedef struct CUmod_st* CUmodule; +typedef struct CUfunc_st* CUfunction; +typedef struct CUstream_st* CUstream; +typedef struct CUevent_st* CUevent; +typedef struct CUgraphicsResource_st* CUgraphicsResource; + +#endif + +#else +typedef struct CUstream_st* CUstream; // We declare some callbacks taking CUstream as an argument even when building with PX_SUPPORT_GPU_PHYSX = 0. +#endif // PX_SUPPORT_GPU_PHYSX +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBinaryConverter.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBinaryConverter.h new file mode 100644 index 0000000..f2421e6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBinaryConverter.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BINARY_CONVERTER_H +#define PX_BINARY_CONVERTER_H +/** \addtogroup extensions +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PX_DEPRECATED PxConverterReportMode +{ + enum Enum + { + eNONE, //!< Silent mode. If enabled, no information is sent to the error stream. + eNORMAL, //!< Normal mode. If enabled, only important information is sent to the error stream. + eVERBOSE //!< Verbose mode. If enabled, detailed information is sent to the error stream. + }; +}; + + +/** +\brief Binary converter for serialized streams. + +\deprecated Binary conversion and binary meta data are deprecated. + +The binary converter class is targeted at converting binary streams from authoring platforms, +such as windows, osx or linux to any game runtime platform supported by PhysX. Particularly +it is currently not supported to run the converter on a platforms that has an endian mismatch +with the platform corresponding to the source binary file and source meta data. + +If you want to use multiple threads for batch conversions, please create one instance +of this class for each thread. + +@see PxSerialization.createBinaryConverter +*/ +class PX_DEPRECATED PxBinaryConverter +{ +public: + + /** + \brief Releases binary converter + */ + virtual void release() = 0; + + /** + \brief Sets desired report mode. + + \param[in] mode Report mode + */ + virtual void setReportMode(PxConverterReportMode::Enum mode) = 0; + + /** + \brief Setups source and target meta-data streams + + The source meta data provided needs to have the same endianness as the platform the converter is run on. + The meta data needs to be set before calling the conversion method. + + \param[in] srcMetaData Source platform's meta-data stream + \param[in] dstMetaData Target platform's meta-data stream + + \return True if success + + @see PxSerialization::dumpBinaryMetaData + */ + virtual bool setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaData) = 0; + + /** + \brief Test utility function to compare two sets of meta data. + + The meta data needs to be set before calling the compareMetaData method. + This method will issue PxErrorCode::eDEBUG_INFO messages if mismatches are encountered. + + \return True if meta data is equivalend + */ + virtual bool compareMetaData() const = 0; + + /** + \brief Converts binary stream from source platform to target platform + + The converter needs to be configured with source and destination meta data before calling the conversion method. + The source meta data needs to correspond to the same platform as the source binary data. + + \param[in] srcStream Source stream + \param[in] srcSize Number of bytes to convert + \param[in] targetStream Target stream + + \return True if success + */ + virtual bool convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream) = 0; + + +protected: + PxBinaryConverter() {} + virtual ~PxBinaryConverter() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBroadPhaseExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBroadPhaseExt.h new file mode 100644 index 0000000..614fb89 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxBroadPhaseExt.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BROAD_PHASE_EXT_H +#define PX_BROAD_PHASE_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBroadPhaseExt +{ +public: + + /** + \brief Creates regions for PxSceneDesc, from a global box. + + This helper simply subdivides the given global box into a 2D grid of smaller boxes. Each one of those smaller boxes + is a region of interest for the broadphase. There are nbSubdiv*nbSubdiv regions in the 2D grid. The function does not + subdivide along the given up axis. + + This is the simplest setup one can use with PxBroadPhaseType::eMBP. A more sophisticated setup would try to cover + the game world with a non-uniform set of regions (i.e. not just a grid). + + \param[out] regions Regions computed from the input global box + \param[in] globalBounds World-space box covering the game world + \param[in] nbSubdiv Grid subdivision level. The function will create nbSubdiv*nbSubdiv regions. + \param[in] upAxis Up axis (0 for X, 1 for Y, 2 for Z). + \return number of regions written out to the 'regions' array + + @see PxSceneDesc PxBroadPhaseType + */ + static PxU32 createRegionsFromWorldBounds(PxBounds3* regions, const PxBounds3& globalBounds, PxU32 nbSubdiv, PxU32 upAxis=1); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCollectionExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCollectionExt.h new file mode 100644 index 0000000..d17f5dd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCollectionExt.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_COLLECTION_EXT_H +#define PX_COLLECTION_EXT_H +/** \addtogroup extensions +@{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxCollection.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxCollection; + class PxScene; + + class PxCollectionExt + { + public: + /** + \brief Removes and releases all object from a collection. + + The Collection itself is not released. + + If the releaseExclusiveShapes flag is not set to true, release() will not be called on exclusive shapes. + + It is assumed that the application holds a reference to each of the objects in the collection, with the exception of objects that are not releasable + (PxBase::isReleasable()). In general, objects that violate this assumption need to be removed from the collection prior to calling releaseObjects. + + \note when a shape is created with PxRigidActor::createShape() or PxRigidActorExt::createExclusiveShape(), the only counted reference is held by the actor. + If such a shape and its actor are present in the collection, the reference count will be decremented once when the actor is released, and once when the + shape is released, resulting in undefined behavior. Shape reference counts can be incremented with PxShape::acquireReference(). + + \param[in] collection to remove and release all object from. + \param[in] releaseExclusiveShapes if this parameter is set to false, release() will not be called on exclusive shapes. + */ + static void releaseObjects(PxCollection& collection, bool releaseExclusiveShapes = true); + + /** + \brief Removes objects of a given type from a collection, potentially adding them to another collection. + + \param[in,out] collection Collection from which objects are removed + \param[in] concreteType PxConcreteType of sdk objects that should be removed + \param[in,out] to Optional collection to which the removed objects are added + + @see PxCollection, PxConcreteType + */ + static void remove(PxCollection& collection, PxType concreteType, PxCollection* to = NULL); + + /** + \brief Collects all objects in PxPhysics that are shareable across multiple scenes. + + This function creates a new collection from all objects that are shareable across multiple + scenes. Instances of the following types are included: PxConvexMesh, PxTriangleMesh, + PxHeightField, PxShape and PxMaterial. + + This is a helper function to ease the creation of collections for serialization. + + \param[in] physics The physics SDK instance from which objects are collected. See #PxPhysics + \return Collection to which objects are added. See #PxCollection + + @see PxCollection, PxPhysics + */ + static PxCollection* createCollection(PxPhysics& physics); + + /** + \brief Collects all objects from a PxScene. + + This function creates a new collection from all objects that were added to the specified + PxScene. Instances of the following types are included: PxActor, PxAggregate, + PxArticulationReducedCoordinate and PxJoint (other PxConstraint types are not included). + + This is a helper function to ease the creation of collections for serialization. + The function PxSerialization.complete() can be used to complete the collection with required objects prior to + serialization. + + \param[in] scene The PxScene instance from which objects are collected. See #PxScene + \return Collection to which objects are added. See #PxCollection + + @see PxCollection, PxScene, PxSerialization.complete() + */ + static PxCollection* createCollection(PxScene& scene); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConstraintExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConstraintExt.h new file mode 100644 index 0000000..0a585e8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConstraintExt.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONSTRAINT_EXT_H +#define PX_CONSTRAINT_EXT_H + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup extensions + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Unique identifiers for extensions classes which implement a constraint based on PxConstraint. + +\note Users which want to create their own custom constraint types should choose an ID larger or equal to eNEXT_FREE_ID +and not eINVALID_ID. + +@see PxConstraint PxSimulationEventCallback.onConstraintBreak() +*/ +struct PxConstraintExtIDs +{ + enum Enum + { + eJOINT, + eVEHICLE_SUSP_LIMIT_DEPRECATED, + eVEHICLE_STICKY_TYRE_DEPRECATED, + eVEHICLE_JOINT, + eNEXT_FREE_ID, + eINVALID_ID = 0x7fffffff + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxContactJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxContactJoint.h new file mode 100644 index 0000000..a49ec1a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxContactJoint.h @@ -0,0 +1,167 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTACT_JOINT_H +#define PX_CONTACT_JOINT_H + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxContactJoint; + + /** + \brief Create a distance Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + + @see PxContactJoint + */ + PxContactJoint* PxContactJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + /** + \brief a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects + + @see PxContactJointCreate PxJoint + */ + + struct PxJacobianRow + { + PxVec3 linear0; + PxVec3 linear1; + PxVec3 angular0; + PxVec3 angular1; + + PxJacobianRow(){} + + PxJacobianRow(const PxVec3& lin0, const PxVec3& lin1, const PxVec3& ang0, const PxVec3& ang1) : + linear0(lin0), linear1(lin1), angular0(ang0), angular1(ang1) + { + + } + + void operator *= (const PxReal scale) + { + linear0 *= scale; + linear1 *= scale; + angular0 *= scale; + angular1 *= scale; + } + + PxJacobianRow operator * (const PxReal scale) const + { + return PxJacobianRow(linear0*scale, linear1*scale, angular0*scale, angular1*scale); + } + }; + + /** + \brief a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects + + @see PxContactJointCreate PxJoint + */ + class PxContactJoint : public PxJoint + { + public: + + /** + \brief Set the current contact of the joint + */ + virtual void setContact(const PxVec3& contact) = 0; + + /** + \brief Set the current contact normal of the joint + */ + virtual void setContactNormal(const PxVec3& contactNormal) = 0; + + /** + \brief Set the current penetration of the joint + */ + virtual void setPenetration(const PxReal penetration) = 0; + + /** + \brief Return the current contact of the joint + */ + virtual PxVec3 getContact() const = 0; + + /** + \brief Return the current contact normal of the joint + */ + virtual PxVec3 getContactNormal() const = 0; + + /** + \brief Return the current penetration value of the joint + */ + virtual PxReal getPenetration() const = 0; + + virtual PxReal getRestitution() const = 0; + virtual void setRestitution(const PxReal restitution) = 0; + virtual PxReal getBounceThreshold() const = 0; + virtual void setBounceThreshold(const PxReal bounceThreshold) = 0; + + /** + \brief Returns string name of PxContactJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxContactJoint"; } + + virtual void computeJacobians(PxJacobianRow* jacobian) const = 0; + virtual PxU32 getNbJacobianRows() const = 0; + + protected: + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxContactJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxContactJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxContactJoint", name) || PxJoint::isKindOf(name); } + + //~serialization + }; + +#if !PX_DOXYGEN +} +#endif + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConvexMeshExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConvexMeshExt.h new file mode 100644 index 0000000..0db30b9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxConvexMeshExt.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONVEX_MESH_EXT_H +#define PX_CONVEX_MESH_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxConvexMeshGeometry; + + /** + \brief Computes closest polygon of the convex hull geometry for a given impact point + and impact direction. When doing sweeps against a scene, one might want to delay + the rather expensive computation of the hit face index for convexes until it is clear + the information is really needed and then use this method to get the corresponding + face index. + + \param[in] convexGeom The convex mesh geometry. + \param[in] geomPose Pose for the geometry object. + \param[in] impactPos Impact position. + \param[in] unitDir Normalized impact direction. + + \return Closest face index of the convex geometry. + + @see PxTransform PxConvexMeshGeometry + */ + PxU32 PxFindFaceIndex(const PxConvexMeshGeometry& convexGeom, + const PxTransform& geomPose, + const PxVec3& impactPos, + const PxVec3& unitDir); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomGeometryExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomGeometryExt.h new file mode 100644 index 0000000..cbdf20d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomGeometryExt.h @@ -0,0 +1,173 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CUSTOM_GEOMETRY_EXT_H +#define PX_CUSTOM_GEOMETRY_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxMassProperties; +class PxGeometryHolder; +struct PxContactPoint; + +/** +\brief Pre-made custom geometry callbacks implementations. +*/ +class PxCustomGeometryExt +{ +public: + + /// \cond PRIVATE + struct BaseConvexCallbacks : PxCustomGeometryCallbacks, PxGjkQuery::Support + { + float margin; + + BaseConvexCallbacks(float _margin) : margin(_margin) {} + + // override PxCustomGeometryCallbacks + virtual PxBounds3 getLocalBounds(const PxGeometry& geometry) const; + PX_DEPRECATED virtual bool generateContacts(const PxGeometry& geom0, const PxGeometry& geom1, const PxTransform& pose0, const PxTransform& pose1, + const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, + PxContactBuffer& contactBuffer) const; + virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* rayHits, PxU32 stride, PxRaycastThreadContext*) const; + virtual bool overlap(const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext*) const; + virtual bool sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext*) const; + virtual bool usePersistentContactManifold(const PxGeometry& geometry, PxReal& breakingThreshold) const; + + // override PxGjkQuery::Support + virtual PxReal getMargin() const { return margin; } + + protected: + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0, const PxVec3& pos1) const = 0; + }; + /// \endcond + + /** + \brief Cylinder geometry callbacks + */ + struct CylinderCallbacks : BaseConvexCallbacks + { + /// \brief Cylinder height + float height; + /// \brief Cylinder radius + float radius; + /// \brief Cylinder axis + int axis; + + /** + \brief Construct cylinder geometry callbacks object + + \param[in] height The cylinder height. + \param[in] radius The cylinder radius. + \param[in] axis The cylinder axis (0 - X, 1 - Y, 2 - Z). + \param[in] margin The cylinder margin. + */ + CylinderCallbacks(float height, float radius, int axis = 0, float margin = 0); + + /// \cond PRIVATE + // override PxCustomGeometryCallbacks + DECLARE_CUSTOM_GEOMETRY_TYPE + PX_DEPRECATED virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const; + virtual void computeMassProperties(const PxGeometry& geometry, PxMassProperties& massProperties) const; + + // override PxGjkQuery::Support + virtual PxVec3 supportLocal(const PxVec3& dir) const; + + protected: + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0, const PxVec3& pos1) const; + + // Radius at height + float getRadiusAtHeight(float height) const; + /// \endcond + }; + + /** + \brief Cone geometry callbacks + */ + struct ConeCallbacks : BaseConvexCallbacks + { + /// \brief Cone height + float height; + /// \brief Cone radius + float radius; + /// \brief Cone axis + int axis; + + /** + \brief Construct cone geometry callbacks object + + \param[in] height The cylinder height. + \param[in] radius The cylinder radius. + \param[in] axis The cylinder axis (0 - X, 1 - Y, 2 - Z). + \param[in] margin The cylinder margin. + */ + ConeCallbacks(float height, float radius, int axis = 0, float margin = 0); + + /// \cond PRIVATE + // override PxCustomGeometryCallbacks + DECLARE_CUSTOM_GEOMETRY_TYPE + PX_DEPRECATED virtual void visualize(const PxGeometry&, PxRenderOutput&, const PxTransform&, const PxBounds3&) const; + virtual void computeMassProperties(const PxGeometry& geometry, PxMassProperties& massProperties) const; + + // override PxGjkQuery::Support + virtual PxVec3 supportLocal(const PxVec3& dir) const; + + protected: + + // Substitute geometry + virtual bool useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0, const PxVec3& pos1) const; + + // Radius at height + float getRadiusAtHeight(float height) const; + /// \endcond + }; +}; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomSceneQuerySystem.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomSceneQuerySystem.h new file mode 100644 index 0000000..b245fa0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxCustomSceneQuerySystem.h @@ -0,0 +1,191 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_NEW_SCENE_QUERY_SYSTEM_H +#define PX_NEW_SCENE_QUERY_SYSTEM_H +/** \addtogroup extensions + @{ +*/ + +#include "PxSceneQuerySystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A custom scene query system. + + This is an example of a custom scene query system. It augments the PxSceneQuerySystem API to support an arbitrary number + of "pruners", instead of the usual hardcoded two. + + It might not be possible to support the whole PxSceneQuerySystem API in this context. See the source code for details. + + @see PxSceneQuerySystem + */ + class PxCustomSceneQuerySystem : public PxSceneQuerySystem + { + public: + PxCustomSceneQuerySystem() {} + virtual ~PxCustomSceneQuerySystem() {} + + /** + \brief Adds a pruner to the system. + + The internal PhysX scene-query system uses two regular pruners (one for static shapes, one for dynamic shapes) and an optional + compound pruner. Our custom scene query system supports an arbitrary number of regular pruners. + + This can be useful to reduce the load on each pruner, in particular during updates, when internal trees are rebuilt in the + background. On the other hand this implementation simply iterates over all created pruners to perform queries, so their cost + might increase if a large number of pruners is used. + + In any case this serves as an example of how the PxSceneQuerySystem API can be used to customize scene queries. + + \param[in] primaryType Desired primary (main) type for the new pruner + \param[in] secondaryType Secondary type when primary type is PxPruningStructureType::eDYNAMIC_AABB_TREE. + \param[in] preallocated Optional number of preallocated shapes in the new pruner + + \return A pruner index + + @see PxCustomSceneQuerySystem PxSceneQueryUpdateMode PxCustomSceneQuerySystemAdapter PxSceneDesc::sceneQuerySystem + */ + virtual PxU32 addPruner(PxPruningStructureType::Enum primaryType, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxU32 preallocated=0) = 0; + + /** + \brief Start custom build-steps for all pruners + + This function is used in combination with customBuildstep() and finishCustomBuildstep() to let users take control + of the pruners' build-step & commit calls - basically the pruners' update functions. These functions should be used + with the PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED update mode, otherwise the build-steps will happen + automatically in fetchResults. For N pruners it can be more efficient to use these custom build-step functions to + perform the updates in parallel: + + - call startCustomBuildstep() first (one synchronous call) + - for each pruner, call customBuildstep() (asynchronous calls from multiple threads) + - once it is done, call finishCustomBuildstep() to finish the update (synchronous call) + + The multi-threaded update is more efficient here than what it is in PxScene, because the "flushShapes()" call is + also multi-threaded (while it is not in PxScene). + + Note that users are responsible for locks here, and these calls should not overlap with other SQ calls. In particular + one should not add new objects to the SQ system or perform queries while these calls are happening. + + \return The number of pruners in the system. + + @see customBuildstep finishCustomBuildstep PxSceneQueryUpdateMode + */ + virtual PxU32 startCustomBuildstep() = 0; + + /** + \brief Perform a custom build-step for a given pruner. + + \param[in] index Pruner index (should be between 0 and the number returned by startCustomBuildstep) + + @see startCustomBuildstep finishCustomBuildstep + */ + virtual void customBuildstep(PxU32 index) = 0; + + /** + \brief Finish custom build-steps + + Call this function once after all the customBuildstep() calls are done. + + @see startCustomBuildstep customBuildstep + */ + virtual void finishCustomBuildstep() = 0; + }; + + /** + \brief An adapter class to customize the object-to-pruner mapping. + + In the regular PhysX code static shapes went to the static pruner, and dynamic shapes went to the + dynamic pruner. + + This class is a replacement for this mapping when N user-defined pruners are involved. + */ + class PxCustomSceneQuerySystemAdapter + { + public: + PxCustomSceneQuerySystemAdapter() {} + virtual ~PxCustomSceneQuerySystemAdapter() {} + + /** + \brief Gets a pruner index for an actor/shape. + + This user-defined function tells the system in which pruner a given actor/shape should go. + + \note The returned index must be valid, i.e. it must have been previously returned to users by PxCustomSceneQuerySystem::addPruner. + + \param[in] actor The actor + \param[in] shape The shape + + \return A pruner index for this actor/shape. + + @see PxRigidActor PxShape PxCustomSceneQuerySystem::addPruner + */ + virtual PxU32 getPrunerIndex(const PxRigidActor& actor, const PxShape& shape) const = 0; + + /** + \brief Pruner filtering callback. + + This will be called for each query to validate whether it should process a given pruner. + + \param[in] prunerIndex The index of currently processed pruner + \param[in] context The query context + \param[in] filterData The query's filter data + \param[in] filterCall The query's filter callback + + \return True to process the pruner, false to skip it entirely + */ + virtual bool processPruner(PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const = 0; + }; + + /** + \brief Creates a custom scene query system. + + This is similar to PxCreateExternalSceneQuerySystem, except this function creates a PxCustomSceneQuerySystem object. + It can be plugged to PxScene the same way, via PxSceneDesc::sceneQuerySystem. + + \param[in] sceneQueryUpdateMode Desired update mode + \param[in] contextID Context ID parameter, sent to the profiler + \param[in] adapter Adapter class implementing our extended API + \param[in] usesTreeOfPruners True to keep pruners themselves in a BVH, which might increase query performance if a lot of pruners are involved + + \return A custom SQ system instance + + @see PxCustomSceneQuerySystem PxSceneQueryUpdateMode PxCustomSceneQuerySystemAdapter PxSceneDesc::sceneQuerySystem + */ + PxCustomSceneQuerySystem* PxCreateCustomSceneQuerySystem(PxSceneQueryUpdateMode::Enum sceneQueryUpdateMode, PxU64 contextID, const PxCustomSceneQuerySystemAdapter& adapter, bool usesTreeOfPruners=false); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6Joint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6Joint.h new file mode 100644 index 0000000..2d092e4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6Joint.h @@ -0,0 +1,570 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_D6_JOINT_H +#define PX_D6_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxD6Joint; + +/** +\brief Create a D6 joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxD6Joint +*/ +PxD6Joint* PxD6JointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** +\brief Used to specify one of the degrees of freedom of a D6 joint. + +@see PxD6Joint +*/ +struct PxD6Axis +{ + enum Enum + { + eX = 0, //!< motion along the X axis + eY = 1, //!< motion along the Y axis + eZ = 2, //!< motion along the Z axis + eTWIST = 3, //!< motion around the X axis + eSWING1 = 4, //!< motion around the Y axis + eSWING2 = 5, //!< motion around the Z axis + eCOUNT = 6 + }; +}; + + +/** +\brief Used to specify the range of motions allowed for a degree of freedom in a D6 joint. + +@see PxD6Joint +*/ +struct PxD6Motion +{ + enum Enum + { + eLOCKED, //!< The DOF is locked, it does not allow relative motion. + eLIMITED, //!< The DOF is limited, it only allows motion within a specific range. + eFREE //!< The DOF is free and has its full range of motion. + }; +}; + + +/** +\brief Used to specify which axes of a D6 joint are driven. + +Each drive is an implicit force-limited damped spring: + +force = spring * (target position - position) + damping * (targetVelocity - velocity) + +Alternatively, the spring may be configured to generate a specified acceleration instead of a force. + +A linear axis is affected by drive only if the corresponding drive flag is set. There are two possible models +for angular drive: swing/twist, which may be used to drive one or more angular degrees of freedom, or slerp, +which may only be used to drive all three angular degrees simultaneously. + +@see PxD6Joint +*/ +struct PxD6Drive +{ + enum Enum + { + eX = 0, //!< drive along the X-axis + eY = 1, //!< drive along the Y-axis + eZ = 2, //!< drive along the Z-axis + eSWING = 3, //!< drive of displacement from the X-axis + eTWIST = 4, //!< drive of the displacement around the X-axis + eSLERP = 5, //!< drive of all three angular degrees along a SLERP-path + eCOUNT = 6 + }; +}; + +/** +\brief flags for configuring the drive model of a PxD6Joint + +@see PxD6JointDrive PxD6Joint +*/ +struct PxD6JointDriveFlag +{ + enum Enum + { + eACCELERATION = 1 //!< drive spring is for the acceleration at the joint (rather than the force) + }; +}; +typedef PxFlags PxD6JointDriveFlags; +PX_FLAGS_OPERATORS(PxD6JointDriveFlag::Enum, PxU32) + +/** +\brief parameters for configuring the drive model of a PxD6Joint + +@see PxD6Joint +*/ +class PxD6JointDrive : public PxSpring +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + +public: + PxReal forceLimit; //!< the force limit of the drive - may be an impulse or a force depending on PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + PxD6JointDriveFlags flags; //!< the joint drive flags + + /** + \brief default constructor for PxD6JointDrive. + */ + PxD6JointDrive(): PxSpring(0,0), forceLimit(PX_MAX_F32), flags(0) {} + + /** + \brief constructor a PxD6JointDrive. + + \param[in] driveStiffness The stiffness of the drive spring. + \param[in] driveDamping The damping of the drive spring + \param[in] driveForceLimit The maximum impulse or force that can be exerted by the drive + \param[in] isAcceleration Whether the drive is an acceleration drive or a force drive + */ + PxD6JointDrive(PxReal driveStiffness, PxReal driveDamping, PxReal driveForceLimit, bool isAcceleration = false) + : PxSpring(driveStiffness, driveDamping) + , forceLimit(driveForceLimit) + , flags(isAcceleration?PxU32(PxD6JointDriveFlag::eACCELERATION) : 0) + {} + + /** + \brief returns true if the drive is valid + */ + bool isValid() const + { + return PxIsFinite(stiffness) && stiffness>=0 && + PxIsFinite(damping) && damping >=0 && + PxIsFinite(forceLimit) && forceLimit >=0; + } +}; + + +/** + \brief A D6 joint is a general constraint between two actors. + + It allows the application to individually define the linear and rotational degrees of freedom, + and also to configure a variety of limits and driven degrees of freedom. + + By default all degrees of freedom are locked. So to create a prismatic joint with free motion + along the x-axis: + + \code + ... + joint->setMotion(PxD6Axis::eX, PxD6JointMotion::eFREE); + ... + \endcode + + Or a Revolute joint with motion free allowed around the x-axis: + + \code + ... + joint->setMotion(PxD6Axis::eTWIST, PxD6JointMotion::eFREE); + ... + \endcode + + Degrees of freedom may also be set to limited instead of locked. + + There are two different kinds of linear limits available. The first kind is a single limit value + for all linear degrees of freedom, which may act as a linear, circular, or spherical limit depending + on which degrees of freedom are limited. This is similar to a distance limit. Then, the second kind + supports a pair of limit values for each linear axis, which can be used to implement a traditional + prismatic joint for example. + + If the twist degree of freedom is limited, is supports upper and lower limits. The two swing degrees + of freedom are limited with a cone limit. +@see PxD6JointCreate() PxJoint +*/ +class PxD6Joint : public PxJoint +{ +public: + + /** + \brief Set the motion type around the specified axis. + + Each axis may independently specify that the degree of freedom is locked (blocking relative movement + along or around this axis), limited by the corresponding limit, or free. + + \param[in] axis the axis around which motion is specified + \param[in] type the motion type around the specified axis + + Default: all degrees of freedom are locked + + @see getMotion() PxD6Axis PxD6Motion + */ + virtual void setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type) = 0; + + /** + \brief Get the motion type around the specified axis. + + @see setMotion() PxD6Axis PxD6Motion + + \param[in] axis the degree of freedom around which the motion type is specified + \return the motion type around the specified axis + */ + virtual PxD6Motion::Enum getMotion(PxD6Axis::Enum axis) const = 0; + + /** + \brief get the twist angle of the joint, in the range (-2*Pi, 2*Pi] + */ + virtual PxReal getTwistAngle() const = 0; + + /** + \brief get the twist angle of the joint + + \deprecated Use getTwistAngle instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE PxReal getTwist() const { return getTwistAngle(); } + + /** + \brief get the swing angle of the joint from the Y axis + */ + virtual PxReal getSwingYAngle() const = 0; + + /** + \brief get the swing angle of the joint from the Z axis + */ + virtual PxReal getSwingZAngle() const = 0; + + /** + \brief Set the distance limit for the joint. + + A single limit constraints all linear limited degrees of freedom, forming a linear, circular + or spherical constraint on motion depending on the number of limited degrees. This is similar + to a distance limit. + + \param[in] limit the distance limit structure + + @see getDistanceLimit() PxJointLinearLimit + */ + virtual void setDistanceLimit(const PxJointLinearLimit& limit) = 0; + + /** + \brief Get the distance limit for the joint. + + \return the distance limit structure + + @see setDistanceLimit() PxJointLinearLimit + */ + virtual PxJointLinearLimit getDistanceLimit() const = 0; + + /** + \deprecated Use setDistanceLimit instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE void setLinearLimit(const PxJointLinearLimit& limit) { setDistanceLimit(limit); } + + /** + \deprecated Use getDistanceLimit instead. Deprecated since PhysX version 4.0 + */ + PX_DEPRECATED PX_FORCE_INLINE PxJointLinearLimit getLinearLimit() const { return getDistanceLimit(); } + + /** + \brief Set the linear limit for a given linear axis. + + This function extends the previous setDistanceLimit call with the following features: + - there can be a different limit for each linear axis + - each limit is defined by two values, i.e. it can now be asymmetric + + This can be used to create prismatic joints similar to PxPrismaticJoint, or point-in-quad joints, + or point-in-box joints. + + \param[in] axis The limited linear axis (must be PxD6Axis::eX, PxD6Axis::eY or PxD6Axis::eZ) + \param[in] limit The linear limit pair structure + + @see getLinearLimit() + */ + virtual void setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair& limit) = 0; + + /** + \brief Get the linear limit for a given linear axis. + + \param[in] axis The limited linear axis (must be PxD6Axis::eX, PxD6Axis::eY or PxD6Axis::eZ) + + \return the linear limit pair structure from desired axis + + @see setLinearLimit() PxJointLinearLimit + */ + virtual PxJointLinearLimitPair getLinearLimit(PxD6Axis::Enum axis) const = 0; + + /** + \brief Set the twist limit for the joint. + + The twist limit controls the range of motion around the twist axis. + + The limit angle range is (-2*Pi, 2*Pi). + + \param[in] limit the twist limit structure + + @see getTwistLimit() PxJointAngularLimitPair + */ + virtual void setTwistLimit(const PxJointAngularLimitPair& limit) = 0; + + /** + \brief Get the twist limit for the joint. + + \return the twist limit structure + + @see setTwistLimit() PxJointAngularLimitPair + */ + virtual PxJointAngularLimitPair getTwistLimit() const = 0; + + /** + \brief Set the swing cone limit for the joint. + + The cone limit is used if either or both swing axes are limited. The extents are + symmetrical and measured in the frame of the parent. If only one swing degree of freedom + is limited, the corresponding value from the cone limit defines the limit range. + + \param[in] limit the cone limit structure + + @see getLimitCone() PxJointLimitCone + */ + virtual void setSwingLimit(const PxJointLimitCone& limit) = 0; + + /** + \brief Get the cone limit for the joint. + + \return the swing limit structure + + @see setLimitCone() PxJointLimitCone + */ + virtual PxJointLimitCone getSwingLimit() const = 0; + + /** + \brief Set a pyramidal swing limit for the joint. + + The pyramid limits will only be used in the following cases: + - both swing Y and Z are limited. The limit shape is then a pyramid. + - Y is limited and Z is locked, or vice versa. The limit shape is an asymmetric angular section, similar to + what is supported for the twist axis. + The remaining cases (Y limited and Z is free, or vice versa) are not supported. + + \param[in] limit the cone limit structure + + @see getLimitCone() PxJointLimitPyramid + */ + virtual void setPyramidSwingLimit(const PxJointLimitPyramid& limit) = 0; + + /** + \brief Get the pyramidal swing limit for the joint. + + \return the swing limit structure + + @see setLimitCone() PxJointLimitPyramid + */ + virtual PxJointLimitPyramid getPyramidSwingLimit() const = 0; + + /** + \brief Set the drive parameters for the specified drive type. + + \param[in] index the type of drive being specified + \param[in] drive the drive parameters + + @see getDrive() PxD6JointDrive + + Default The default drive spring and damping values are zero, the force limit is zero, and no flags are set. + */ + virtual void setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive) = 0; + + /** + \brief Get the drive parameters for the specified drive type. + + \param[in] index the specified drive type + + @see setDrive() PxD6JointDrive + */ + virtual PxD6JointDrive getDrive(PxD6Drive::Enum index) const = 0; + + /** + \brief Set the drive goal pose + + The goal is relative to the constraint frame of actor[0] + + Default the identity transform + + \param[in] pose The goal drive pose if positional drive is in use. + \param[in] autowake If true and the attached actors are in a scene, this call wakes them up and increases their + wake counters to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + @see setDrivePosition() + */ + virtual void setDrivePosition(const PxTransform& pose, bool autowake = true) = 0; + + /** + \brief Get the drive goal pose. + + @see getDrivePosition() + */ + virtual PxTransform getDrivePosition() const = 0; + + /** + \brief Set the target goal velocity for drive. + + The velocity is measured in the constraint frame of actor[0] + + \param[in] linear The goal velocity for linear drive + \param[in] angular The goal velocity for angular drive + \param[in] autowake If true and the attached actors are in a scene, this call wakes them up and increases their + wake counters to #PxSceneDesc::wakeCounterResetValue if the counter value is below the reset value. + + @see getDriveVelocity() + */ + virtual void setDriveVelocity(const PxVec3& linear, const PxVec3& angular, bool autowake = true) = 0; + + /** + \brief Get the target goal velocity for joint drive. + + \param[in] linear The goal velocity for linear drive + \param[in] angular The goal velocity for angular drive + + @see setDriveVelocity() + */ + virtual void getDriveVelocity(PxVec3& linear, PxVec3& angular) const = 0; + + /** + \brief Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + is set for the joint. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0, PX_MAX_F32)
+ Default: 1e10f + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() PxConstraintFlag::ePROJECTION + + @deprecated + */ + virtual void setProjectionLinearTolerance(PxReal tolerance) = 0; + + /** + \brief Get the linear tolerance threshold for projection. + + \return the linear tolerance threshold + + @see setProjectionLinearTolerance() + + @deprecated + */ + virtual PxReal getProjectionLinearTolerance() const = 0; + + /** + \brief Set the angular tolerance threshold for projection. Projection is enabled if + PxConstraintFlag::ePROJECTION is set for the joint. + + If the joint deviates by more than this angle around its locked angular degrees of freedom, + the solver will move the bodies to close the angle. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0,Pi]
+ Default: Pi + + \param[in] tolerance the angular tolerance threshold in radians + + \note + Angular projection is implemented only for the case of two or three locked angular degrees of freedom. + + @see getProjectionAngularTolerance() PxJoint::setConstraintFlag() PxConstraintFlag::ePROJECTION + + @deprecated + */ + virtual void setProjectionAngularTolerance(PxReal tolerance) = 0; + + /** + \brief Get the angular tolerance threshold for projection. + + \return tolerance the angular tolerance threshold in radians + + @see setProjectionAngularTolerance() + + @deprecated + */ + virtual PxReal getProjectionAngularTolerance() const = 0; + + /** + \brief Returns string name of PxD6Joint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxD6Joint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxD6Joint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxD6Joint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxD6Joint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6JointCreate.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6JointCreate.h new file mode 100644 index 0000000..39f1696 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxD6JointCreate.h @@ -0,0 +1,254 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_D6_JOINT_CREATE_H +#define PX_D6_JOINT_CREATE_H + +#include "common/PxPhysXCommonConfig.h" + +/** \addtogroup extensions + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPhysics; +class PxRigidActor; +class PxJoint; + +/** + \brief Helper function to create a fixed joint, using either a PxD6Joint or PxFixedJoint. + + For fixed joints it is important that the joint frames have the same orientation. This helper function uses an identity rotation for both. + It is also important that the joint frames have an equivalent position in world space. The function does not check this, so it is up to users + to ensure that this is the case. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] useD6 True to use a PxD6Joint, false to use a PxFixedJoint; + + \return The created joint. + + @see PxD6Joint PxFixedJoint +*/ +PxJoint* PxD6JointCreate_Fixed(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, bool useD6); + +/** + \brief Helper function to create a distance joint, using either a PxD6Joint or PxDistanceJoint. + + This helper function only supports a maximum distance constraint, because PxD6Joint does not support a minimum distance constraint (contrary + to PxDistanceJoint). + + The distance is computed between the joint frames' world-space positions. The joint frames' orientations are irrelevant here so the function + sets them to identity. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] maxDist The maximum allowed distance + \param[in] useD6 True to use a PxD6Joint, false to use a PxDistanceJoint; + + \return The created joint. + + @see PxD6Joint PxDistanceJoint +*/ +PxJoint* PxD6JointCreate_Distance(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float maxDist, bool useD6); + +/** + \brief Helper function to create a prismatic joint, using either a PxD6Joint or PxPrismaticJoint. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired translation axis. + This orientation is computed by the function, so users only have to define the desired translation axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The translation can be limited. Limits are enforced if minLimitmaxLimit the + limits are not enforced and the axis is free. The limit values are computed relative to the position of actor0's joint frame. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The axis along which objects are allowed to move, expressed in the actors' local space + \param[in] minLimit The minimum allowed position along the axis + \param[in] maxLimit The maximum allowed position along the axis + \param[in] useD6 True to use a PxD6Joint, false to use a PxPrismaticJoint; + + \return The created joint. + + @see PxD6Joint PxPrismaticJoint +*/ +PxJoint* PxD6JointCreate_Prismatic(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6); + +/** + \brief Helper function to create a revolute joint, using either a PxD6Joint or PxRevoluteJoint. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired rotation axis. + This orientation is computed by the function, so users only have to define the desired rotation axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The rotation can be limited. Limits are enforced if minLimitmaxLimit the + limits are not enforced and the axis is free. The limit values are computed relative to the rotation of actor0's joint frame. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-2*PI;+2*PI[ + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The axis around which objects are allowed to move, expressed in the actors' local space + \param[in] minLimit The minimum allowed rotation along the axis + \param[in] maxLimit The maximum allowed rotation along the axis + \param[in] useD6 True to use a PxD6Joint, false to use a PxRevoluteJoint; + + \return The created joint. + + @see PxD6Joint PxRevoluteJoint +*/ +PxJoint* PxD6JointCreate_Revolute(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6); + +/** + \brief Helper function to create a spherical joint, using either a PxD6Joint or PxSphericalJoint. + + This function supports a cone limit shape, defined by a cone axis and two angular limit values. + + This function enforces that the joint frames have the same orientation, which is a local frame whose X is the desired cone axis. + This orientation is computed by the function, so users only have to define the desired cone axis (typically 1;0;0 or 0;1;0 or 0;0;1). + + The rotations can be limited. Limits are enforced if limit1>0 and limit2>0. Otherwise the motion is free. The limit values define an ellipse, + which is the cross-section of the cone limit shape. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]0;PI[. Limits are symmetric around the cone axis. + + The cone axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The cone axis, expressed in the actors' local space + \param[in] limit1 Max angular limit for the ellipse along the joint frame's second axis (first axis = cone axis) + \param[in] limit2 Max angular limit for the ellipse along the joint frame's third axis (first axis = cone axis) + \param[in] useD6 True to use a PxD6Joint, false to use a PxSphericalJoint; + + \return The created joint. + + @see PxD6Joint PxSphericalJoint +*/ +PxJoint* PxD6JointCreate_Spherical(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float limit1, float limit2, bool useD6); + +/** + \brief Helper function to create a spherical joint, using either a PxD6Joint or PxSphericalJoint. + + This function supports a cone limit shape, defined by two pairs of angular limit values. This can be used to create an asymmetric cone. If the + angular limit values are symmetric (i.e. minLimit1=-maxLimit1 and minLimit2=-maxLimit2) then the cone axis is the X axis in actor0's space. + If the limits are not symmetric, the function rotates the cone axis accordingly so that limits remain symmetric for PhysX. If this happens, + the initial joint frames will be different for both actors. By default minLimit1/maxLimit1 are limits around the joint's Y axis, and + minLimit2/maxLimit2 are limits around the joint's Z axis. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-PI;PI[. + + The cone axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + The returned apiroty and apirotz values can later be added to retrieved Y and Z swing angle values (from the joint), to remap + angle values to the given input range. + + \param[out] apiroty Amount of rotation around Y used to setup actor0's joint frame + \param[out] apirotz Amount of rotation around Z used to setup actor0's joint frame + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] minLimit1 Min angular limit along the joint frame's second axis (first axis = cone axis) + \param[in] maxLimit1 Max angular limit along the joint frame's second axis (first axis = cone axis) + \param[in] minLimit2 Min angular limit along the joint frame's third axis (first axis = cone axis) + \param[in] maxLimit2 Max angular limit along the joint frame's third axis (first axis = cone axis) + \param[in] useD6 True to use a PxD6Joint, false to use a PxSphericalJoint; + + \return The created joint. + + @see PxD6Joint PxSphericalJoint +*/ +PxJoint* PxD6JointCreate_GenericCone(float& apiroty, float& apirotz, PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float minLimit1, float maxLimit1, float minLimit2, float maxLimit2, bool useD6); + + +/** + \brief Helper function to create a D6 joint with pyramidal swing limits. + + This function supports a pyramid limit shape, defined by two pairs of angular limit values. This can be used to create an asymmetric pyramid. If the + angular limit values are symmetric (i.e. minLimit1=-maxLimit1 and minLimit2=-maxLimit2) then the pyramid axis is the X axis in actor0's space. + By default minLimit1/maxLimit1 are limits around the joint's Y axis, and minLimit2/maxLimit2 are limits around the joint's Z axis. + + The function creates hard limits, and uses PhysX's default contact distance parameter. + + Limits are expressed in radians. Allowed range is ]-PI;PI[. + + The pyramid axis is equivalent to the twist axis for the D6 joint. The twist motion is not limited. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos0 The position of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localPos1 The position of the joint relative to actor1 + \param[in] axis The pyramid axis, expressed in the actors' local space + \param[in] minLimit1 Min angular limit along the joint frame's second axis (first axis = pyramid axis) + \param[in] maxLimit1 Max angular limit along the joint frame's second axis (first axis = pyramid axis) + \param[in] minLimit2 Min angular limit along the joint frame's third axis (first axis = pyramid axis) + \param[in] maxLimit2 Max angular limit along the joint frame's third axis (first axis = pyramid axis) + + \return The created joint. + + @see PxD6Joint +*/ +PxJoint* PxD6JointCreate_Pyramid(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, + float minLimit1, float maxLimit1, float minLimit2, float maxLimit2); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultAllocator.h new file mode 100644 index 0000000..940abd9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultAllocator.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DEFAULT_ALLOCATOR_H +#define PX_DEFAULT_ALLOCATOR_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxAssert.h" +#include "common/PxPhysXCommonConfig.h" + +#include + +#if PX_WINDOWS_FAMILY || PX_LINUX_FAMILY || PX_SWITCH +#include +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_WINDOWS_FAMILY +// on win32 we only have 8-byte alignment guaranteed, but the CRT provides special aligned allocation fns +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return _aligned_malloc(size, 16); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + _aligned_free(ptr); +} +#elif PX_LINUX_FAMILY || PX_SWITCH +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return ::memalign(16, size); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + ::free(ptr); +} +#else +// on all other platforms we get 16-byte alignment by default +PX_FORCE_INLINE void* platformAlignedAlloc(size_t size) +{ + return ::malloc(size); +} + +PX_FORCE_INLINE void platformAlignedFree(void* ptr) +{ + ::free(ptr); +} +#endif + +/** +\brief default implementation of the allocator interface required by the SDK +*/ +class PxDefaultAllocator : public PxAllocatorCallback +{ +public: + virtual void* allocate(size_t size, const char*, const char*, int) + { + void* ptr = platformAlignedAlloc(size); + PX_ASSERT((size_t(ptr) & 15)==0); + return ptr; + } + + virtual void deallocate(void* ptr) + { + platformAlignedFree(ptr); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultCpuDispatcher.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultCpuDispatcher.h new file mode 100644 index 0000000..9aadb99 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultCpuDispatcher.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DEFAULT_CPU_DISPATCHER_H +#define PX_DEFAULT_CPU_DISPATCHER_H +/** \addtogroup extensions + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "task/PxCpuDispatcher.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A default implementation for a CPU task dispatcher. + +@see PxDefaultCpuDispatcherCreate() PxCpuDispatcher +*/ +class PxDefaultCpuDispatcher : public PxCpuDispatcher +{ +public: + /** + \brief Deletes the dispatcher. + + Do not keep a reference to the deleted instance. + + @see PxDefaultCpuDispatcherCreate() + */ + virtual void release() = 0; + + /** + \brief Enables profiling at task level. + + \note By default enabled only in profiling builds. + + \param[in] runProfiled True if tasks should be profiled. + */ + virtual void setRunProfiled(bool runProfiled) = 0; + + /** + \brief Checks if profiling is enabled at task level. + + \return True if tasks should be profiled. + */ + virtual bool getRunProfiled() const = 0; +}; + + +/** +\brief If a thread ends up waiting for work it will find itself in a spin-wait loop until work becomes available. +Three strategies are available to limit wasted cycles. +The strategies are as follows: +a) wait until a work task signals the end of the spin-wait period. +b) yield the thread by providing a hint to reschedule thread execution, thereby allowing other threads to run. +c) yield the processor by informing it that it is waiting for work and requesting it to more efficiently use compute resources. +*/ +struct PxDefaultCpuDispatcherWaitForWorkMode +{ + enum Enum + { + eWAIT_FOR_WORK, + eYIELD_THREAD, + eYIELD_PROCESSOR + }; +}; + + +/** +\brief Create default dispatcher, extensions SDK needs to be initialized first. + +\param[in] numThreads Number of worker threads the dispatcher should use. +\param[in] affinityMasks Array with affinity mask for each thread. If not defined, default masks will be used. +\param[in] mode is the strategy employed when a busy-wait is encountered. +\param[in] yieldProcessorCount specifies the number of times a OS-specific yield processor command will be executed +during each cycle of a busy-wait in the event that the specified mode is eYIELD_PROCESSOR + +\note numThreads may be zero in which case no worker thread are initialized and +simulation tasks will be executed on the thread that calls PxScene::simulate() + +\note yieldProcessorCount must be greater than zero if eYIELD_PROCESSOR is the chosen mode and equal to zero for all other modes. + +\note eYIELD_THREAD and eYIELD_PROCESSOR modes will use compute resources even if the simulation is not running. +It is left to users to keep threads inactive, if so desired, when no simulation is running. + +@see PxDefaultCpuDispatcher +*/ +PxDefaultCpuDispatcher* PxDefaultCpuDispatcherCreate(PxU32 numThreads, PxU32* affinityMasks = NULL, PxDefaultCpuDispatcherWaitForWorkMode::Enum mode = PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK, PxU32 yieldProcessorCount = 0); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultErrorCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultErrorCallback.h new file mode 100644 index 0000000..38227f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultErrorCallback.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DEFAULT_ERROR_CALLBACK_H +#define PX_DEFAULT_ERROR_CALLBACK_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxErrorCallback.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief default implementation of the error callback + + This class is provided in order to enable the SDK to be started with the minimum of user code. Typically an application + will use its own error callback, and log the error to file or otherwise make it visible. Warnings and error messages from + the SDK are usually indicative that changes are required in order for PhysX to function correctly, and should not be ignored. + */ + + class PxDefaultErrorCallback : public PxErrorCallback + { + public: + PxDefaultErrorCallback(); + virtual ~PxDefaultErrorCallback(); + + virtual void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) PX_OVERRIDE; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultSimulationFilterShader.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultSimulationFilterShader.h new file mode 100644 index 0000000..f6fd7be --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultSimulationFilterShader.h @@ -0,0 +1,261 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DEFAULT_SIMULATION_FILTER_SHADER_H +#define PX_DEFAULT_SIMULATION_FILTER_SHADER_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" + +#include "PxFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxActor; + +/** +\brief 64-bit mask used for collision filtering. + +The collision filtering equation for 2 objects o0 and o1 is: + +
 (G0 op0 K0) op2 (G1 op1 K1) == b 
+ +with + +
    +
  • G0 = PxGroupsMask for object o0. See PxSetGroupsMask
  • +
  • G1 = PxGroupsMask for object o1. See PxSetGroupsMask
  • +
  • K0 = filtering constant 0. See PxSetFilterConstants
  • +
  • K1 = filtering constant 1. See PxSetFilterConstants
  • +
  • b = filtering boolean. See PxSetFilterBool
  • +
  • op0, op1, op2 = filtering operations. See PxSetFilterOps
  • +
+ +If the filtering equation is true, collision detection is enabled. + +@see PxSetFilterOps() +*/ +class PxGroupsMask +{ +public: + PX_INLINE PxGroupsMask():bits0(0),bits1(0),bits2(0),bits3(0) {} + PX_INLINE ~PxGroupsMask() {} + + PxU16 bits0, bits1, bits2, bits3; +}; + +/** +\brief Collision filtering operations. + +@see PxGroupsMask +*/ +struct PxFilterOp +{ + enum Enum + { + PX_FILTEROP_AND, + PX_FILTEROP_OR, + PX_FILTEROP_XOR, + PX_FILTEROP_NAND, + PX_FILTEROP_NOR, + PX_FILTEROP_NXOR, + PX_FILTEROP_SWAP_AND + }; +}; + +/** +\brief Implementation of a simple filter shader that emulates PhysX 2.8.x filtering + +This shader provides the following logic: +\li If one of the two filter objects is a trigger, the pair is acccepted and #PxPairFlag::eTRIGGER_DEFAULT will be used for trigger reports +\li Else, if the filter mask logic (see further below) discards the pair it will be suppressed (#PxFilterFlag::eSUPPRESS) +\li Else, the pair gets accepted and collision response gets enabled (#PxPairFlag::eCONTACT_DEFAULT) + +Filter mask logic: +Given the two #PxFilterData structures fd0 and fd1 of two collision objects, the pair passes the filter if the following +conditions are met: + + 1) Collision groups of the pair are enabled + 2) Collision filtering equation is satisfied + +@see PxSimulationFilterShader +*/ + +PxFilterFlags PxDefaultSimulationFilterShader( + PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, + PxU32 constantBlockSize); + +/** + \brief Determines if collision detection is performed between a pair of groups + + \note Collision group is an integer between 0 and 31. + + \param[in] group1 First Group + \param[in] group2 Second Group + + \return True if the groups could collide + + @see PxSetGroupCollisionFlag +*/ +bool PxGetGroupCollisionFlag(const PxU16 group1, const PxU16 group2); + +/** + \brief Specifies if collision should be performed by a pair of groups + + \note Collision group is an integer between 0 and 31. + + \param[in] group1 First Group + \param[in] group2 Second Group + \param[in] enable True to enable collision between the groups + + @see PxGetGroupCollisionFlag +*/ +void PxSetGroupCollisionFlag(const PxU16 group1, const PxU16 group2, const bool enable); + +/** + \brief Retrieves the value set with PxSetGroup() + + \note Collision group is an integer between 0 and 31. + + \param[in] actor The actor + + \return The collision group this actor belongs to + + @see PxSetGroup +*/ +PxU16 PxGetGroup(const PxActor& actor); + +/** + \brief Sets which collision group this actor is part of + + \note Collision group is an integer between 0 and 31. + + \param[in] actor The actor + \param[in] collisionGroup Collision group this actor belongs to + + @see PxGetGroup +*/ +void PxSetGroup(PxActor& actor, const PxU16 collisionGroup); + +/** +\brief Retrieves filtering operation. See comments for PxGroupsMask + +\param[out] op0 First filter operator. +\param[out] op1 Second filter operator. +\param[out] op2 Third filter operator. + +@see PxSetFilterOps PxSetFilterBool PxSetFilterConstants +*/ +void PxGetFilterOps(PxFilterOp::Enum& op0, PxFilterOp::Enum& op1, PxFilterOp::Enum& op2); + +/** +\brief Setups filtering operations. See comments for PxGroupsMask + +\param[in] op0 Filter op 0. +\param[in] op1 Filter op 1. +\param[in] op2 Filter op 2. + +@see PxSetFilterBool PxSetFilterConstants +*/ +void PxSetFilterOps(const PxFilterOp::Enum& op0, const PxFilterOp::Enum& op1, const PxFilterOp::Enum& op2); + +/** +\brief Retrieves filtering's boolean value. See comments for PxGroupsMask + +\return flag Boolean value for filter. + +@see PxSetFilterBool PxSetFilterConstants +*/ +bool PxGetFilterBool(); + +/** +\brief Setups filtering's boolean value. See comments for PxGroupsMask + +\param[in] enable Boolean value for filter. + +@see PxSetFilterOps PxSsetFilterConstants +*/ +void PxSetFilterBool(const bool enable); + +/** +\brief Gets filtering constant K0 and K1. See comments for PxGroupsMask + +\param[out] c0 the filtering constants, as a mask. See #PxGroupsMask. +\param[out] c1 the filtering constants, as a mask. See #PxGroupsMask. + +@see PxSetFilterOps PxSetFilterBool PxSetFilterConstants +*/ +void PxGetFilterConstants(PxGroupsMask& c0, PxGroupsMask& c1); + +/** +\brief Setups filtering's K0 and K1 value. See comments for PxGroupsMask + +\param[in] c0 The new group mask. See #PxGroupsMask. +\param[in] c1 The new group mask. See #PxGroupsMask. + +@see PxSetFilterOps PxSetFilterBool PxGetFilterConstants +*/ +void PxSetFilterConstants(const PxGroupsMask& c0, const PxGroupsMask& c1); + +/** +\brief Gets 64-bit mask used for collision filtering. See comments for PxGroupsMask + +\param[in] actor The actor + +\return The group mask for the actor. + +@see PxSetGroupsMask() +*/ +PxGroupsMask PxGetGroupsMask(const PxActor& actor); + +/** +\brief Sets 64-bit mask used for collision filtering. See comments for PxGroupsMask + +\param[in] actor The actor +\param[in] mask The group mask to set for the actor. + +@see PxGetGroupsMask() +*/ +void PxSetGroupsMask(PxActor& actor, const PxGroupsMask& mask); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultStreams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultStreams.h new file mode 100644 index 0000000..cf19e7a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDefaultStreams.h @@ -0,0 +1,148 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DEFAULT_STREAMS_H +#define PX_DEFAULT_STREAMS_H +/** \addtogroup extensions + @{ +*/ + +#include +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxIO.h" +#include "foundation/PxFoundation.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +typedef FILE* PxFileHandle; + +/** +\brief default implementation of a memory write stream + +@see PxOutputStream +*/ + +class PxDefaultMemoryOutputStream: public PxOutputStream +{ +public: + PxDefaultMemoryOutputStream(PxAllocatorCallback &allocator = *PxGetAllocatorCallback()); + virtual ~PxDefaultMemoryOutputStream(); + + virtual PxU32 write(const void* src, PxU32 count); + + virtual PxU32 getSize() const { return mSize; } + virtual PxU8* getData() const { return mData; } + +private: + PxDefaultMemoryOutputStream(const PxDefaultMemoryOutputStream&); + PxDefaultMemoryOutputStream& operator=(const PxDefaultMemoryOutputStream&); + + PxAllocatorCallback& mAllocator; + PxU8* mData; + PxU32 mSize; + PxU32 mCapacity; +}; + +/** +\brief default implementation of a memory read stream + +@see PxInputData +*/ + +class PxDefaultMemoryInputData: public PxInputData +{ +public: + PxDefaultMemoryInputData(PxU8* data, PxU32 length); + + virtual PxU32 read(void* dest, PxU32 count); + virtual PxU32 getLength() const; + virtual void seek(PxU32 pos); + virtual PxU32 tell() const; + +private: + PxU32 mSize; + const PxU8* mData; + PxU32 mPos; +}; + + + +/** +\brief default implementation of a file write stream + +@see PxOutputStream +*/ + +class PxDefaultFileOutputStream: public PxOutputStream +{ +public: + PxDefaultFileOutputStream(const char* name); + virtual ~PxDefaultFileOutputStream(); + + virtual PxU32 write(const void* src, PxU32 count); + virtual bool isValid(); +private: + PxFileHandle mFile; +}; + + +/** +\brief default implementation of a file read stream + +@see PxInputData +*/ + +class PxDefaultFileInputData: public PxInputData +{ +public: + PxDefaultFileInputData(const char* name); + virtual ~PxDefaultFileInputData(); + + virtual PxU32 read(void* dest, PxU32 count); + virtual void seek(PxU32 pos); + virtual PxU32 tell() const; + virtual PxU32 getLength() const; + + bool isValid() const; +private: + PxFileHandle mFile; + PxU32 mLength; +}; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDistanceJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDistanceJoint.h new file mode 100644 index 0000000..7ac153b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxDistanceJoint.h @@ -0,0 +1,296 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_DISTANCE_JOINT_H +#define PX_DISTANCE_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxDistanceJoint; + +/** +\brief Create a distance Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxDistanceJoint +*/ +PxDistanceJoint* PxDistanceJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief flags for configuring the drive of a PxDistanceJoint + +@see PxDistanceJoint +*/ +struct PxDistanceJointFlag +{ + enum Enum + { + eMAX_DISTANCE_ENABLED = 1<<1, + eMIN_DISTANCE_ENABLED = 1<<2, + eSPRING_ENABLED = 1<<3 + }; +}; + +typedef PxFlags PxDistanceJointFlags; +PX_FLAGS_OPERATORS(PxDistanceJointFlag::Enum, PxU16) + +/** +\brief a joint that maintains an upper or lower bound (or both) on the distance between two points on different objects + +@see PxDistanceJointCreate PxJoint +*/ +class PxDistanceJoint : public PxJoint +{ +public: + + /** + \brief Return the current distance of the joint + */ + virtual PxReal getDistance() const = 0; + + /** + \brief Set the allowed minimum distance for the joint. + + The minimum distance must be no more than the maximum distance + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] distance the minimum distance + + @see PxDistanceJoint::minDistance, PxDistanceJointFlag::eMIN_DISTANCE_ENABLED getMinDistance() + */ + virtual void setMinDistance(PxReal distance) = 0; + + /** + \brief Get the allowed minimum distance for the joint. + + \return the allowed minimum distance + + @see PxDistanceJoint::minDistance, PxDistanceJointFlag::eMIN_DISTANCE_ENABLED setMinDistance() + */ + virtual PxReal getMinDistance() const = 0; + + /** + \brief Set the allowed maximum distance for the joint. + + The maximum distance must be no less than the minimum distance. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] distance the maximum distance + + @see PxDistanceJoint::maxDistance, PxDistanceJointFlag::eMAX_DISTANCE_ENABLED getMinDistance() + */ + virtual void setMaxDistance(PxReal distance) = 0; + + /** + \brief Get the allowed maximum distance for the joint. + + \return the allowed maximum distance + + @see PxDistanceJoint::maxDistance, PxDistanceJointFlag::eMAX_DISTANCE_ENABLED setMaxDistance() + */ + virtual PxReal getMaxDistance() const = 0; + + /** + \brief Set the error tolerance of the joint. + + \param[in] tolerance the distance beyond the allowed range at which the joint becomes active + + @see PxDistanceJoint::tolerance, getTolerance() + */ + virtual void setTolerance(PxReal tolerance) = 0; + + /** + \brief Get the error tolerance of the joint. + + the distance beyond the joint's [min, max] range before the joint becomes active. + + Default 0.25f * PxTolerancesScale::length + Range (0, PX_MAX_F32) + + This value should be used to ensure that if the minimum distance is zero and the + spring function is in use, the rest length of the spring is non-zero. + + @see PxDistanceJoint::tolerance, setTolerance() + */ + virtual PxReal getTolerance() const = 0; + + /** + \brief Set the strength of the joint spring. + + The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] stiffness the spring strength of the joint + + @see PxDistanceJointFlag::eSPRING_ENABLED getStiffness() + */ + virtual void setStiffness(PxReal stiffness) = 0; + + /** + \brief Get the strength of the joint spring. + + \return stiffness the spring strength of the joint + + @see PxDistanceJointFlag::eSPRING_ENABLED setStiffness() + */ + virtual PxReal getStiffness() const = 0; + + /** + \brief Set the damping of the joint spring. + + The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] damping the degree of damping of the joint spring of the joint + + @see PxDistanceJointFlag::eSPRING_ENABLED setDamping() + */ + virtual void setDamping(PxReal damping) = 0; + + /** + \brief Get the damping of the joint spring. + + \return the degree of damping of the joint spring of the joint + + @see PxDistanceJointFlag::eSPRING_ENABLED setDamping() + */ + virtual PxReal getDamping() const = 0; + + /** + \brief Set the contact distance for the min & max distance limits. + + This is similar to the PxJointLimitParameters::contactDistance parameter for regular limits. + + The two most common values are 0 and infinite. Infinite means the internal constraints are + always created, resulting in the best simulation quality but slower performance. Zero means + the internal constraints are only created when the limits are violated, resulting in best + performance but worse simulation quality. + + Default 0.0f + Range [0, PX_MAX_F32) + + \param[in] contactDistance The contact distance + + @see PxJointLimitParameters::contactDistance getContactDistance() + */ + virtual void setContactDistance(PxReal contactDistance) = 0; + + /** + \brief Get the contact distance. + + \return the contact distance + + @see PxJointLimitParameters::contactDistance setContactDistance() + */ + virtual PxReal getContactDistance() const = 0; + + /** + \brief Set the flags specific to the Distance Joint. + + Default PxDistanceJointFlag::eMAX_DISTANCE_ENABLED + + \param[in] flags The joint flags. + + @see PxDistanceJointFlag setFlag() getFlags() + */ + virtual void setDistanceJointFlags(PxDistanceJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Distance Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + @see PxDistanceJointFlag, getFlags() setFlags() + */ + virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Distance Joint. + + \return the joint flags + + @see PxDistanceJoint::flags, PxDistanceJointFlag setFlag() setFlags() + */ + virtual PxDistanceJointFlags getDistanceJointFlags() const = 0; + + /** + \brief Returns string name of PxDistanceJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxDistanceJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxDistanceJoint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxExtensionsAPI.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxExtensionsAPI.h new file mode 100644 index 0000000..fc30edb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxExtensionsAPI.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_EXTENSIONS_API_H +#define PX_EXTENSIONS_API_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxErrorCallback.h" +#include "extensions/PxDefaultAllocator.h" +#include "extensions/PxConstraintExt.h" +#include "extensions/PxDistanceJoint.h" +#include "extensions/PxContactJoint.h" +#include "extensions/PxFixedJoint.h" +#include "extensions/PxPrismaticJoint.h" +#include "extensions/PxRevoluteJoint.h" +#include "extensions/PxSphericalJoint.h" +#include "extensions/PxD6Joint.h" +#include "extensions/PxGearJoint.h" +#include "extensions/PxRackAndPinionJoint.h" +#include "extensions/PxDefaultSimulationFilterShader.h" +#include "extensions/PxDefaultErrorCallback.h" +#include "extensions/PxDefaultStreams.h" +#include "extensions/PxRigidActorExt.h" +#include "extensions/PxRigidBodyExt.h" +#include "extensions/PxShapeExt.h" +#include "extensions/PxTriangleMeshExt.h" +#include "extensions/PxSerialization.h" +#include "extensions/PxDefaultCpuDispatcher.h" +#include "extensions/PxSmoothNormals.h" +#include "extensions/PxSimpleFactory.h" +#include "extensions/PxStringTableExt.h" +#include "extensions/PxBroadPhaseExt.h" +#include "extensions/PxMassProperties.h" +#include "extensions/PxSceneQueryExt.h" +#include "extensions/PxSceneQuerySystemExt.h" +#include "extensions/PxCustomSceneQuerySystem.h" +#include "extensions/PxConvexMeshExt.h" +#include "extensions/PxSamplingExt.h" +#include "extensions/PxTetrahedronMeshExt.h" + +/** \brief Initialize the PhysXExtensions library. + +This should be called before calling any functions or methods in extensions which may require allocation. +\note This function does not need to be called before creating a PxDefaultAllocator object. + +\param physics a PxPhysics object +\param pvd an PxPvd (PhysX Visual Debugger) object + +@see PxCloseExtensions PxFoundation PxPhysics +*/ +PX_C_EXPORT bool PX_CALL_CONV PxInitExtensions(physx::PxPhysics& physics, physx::PxPvd* pvd); + +/** \brief Shut down the PhysXExtensions library. + +This function should be called to cleanly shut down the PhysXExtensions library before application exit. + +\note This function is required to be called to release foundation usage. + +@see PxInitExtensions +*/ +PX_C_EXPORT void PX_CALL_CONV PxCloseExtensions(); + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxFixedJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxFixedJoint.h new file mode 100644 index 0000000..a2a2939 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxFixedJoint.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FIXED_JOINT_H +#define PX_FIXED_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFixedJoint; + +/** +\brief Create a fixed joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxFixedJoint +*/ +PxFixedJoint* PxFixedJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** + \brief A fixed joint permits no relative movement between two bodies. ie the bodies are glued together. + + \image html fixedJoint.png + + @see PxFixedJointCreate() PxJoint +*/ +class PxFixedJoint : public PxJoint +{ +public: + + /** + \brief Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + is set for the joint. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0, PX_MAX_F32)
+ Default: 1e10f + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() PxConstraintFlag::ePROJECTION + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionLinearTolerance(PxReal tolerance) = 0; + + /** + \brief Get the linear tolerance threshold for projection. + + \return the linear tolerance threshold + + @see setProjectionLinearTolerance() PxJoint::setConstraintFlag() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionLinearTolerance() const = 0; + + /** + \brief Set the angular tolerance threshold for projection. Projection is enabled if + PxConstraintFlag::ePROJECTION is set for the joint. + + If the joint deviates by more than this angle around its locked angular degrees of freedom, + the solver will move the bodies to close the angle. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0,Pi]
+ Default: Pi + + \param[in] tolerance the angular tolerance threshold in radians + + @see getProjectionAngularTolerance() PxJoint::setConstraintFlag() PxConstraintFlag::ePROJECTION + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionAngularTolerance(PxReal tolerance) = 0; + + /** + \brief Get the angular tolerance threshold for projection. + + \return the angular tolerance threshold in radians + + @see setProjectionAngularTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionAngularTolerance() const = 0; + + /** + \brief Returns string name of PxFixedJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxFixedJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxFixedJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxFixedJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxFixedJoint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGearJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGearJoint.h new file mode 100644 index 0000000..28f42f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGearJoint.h @@ -0,0 +1,121 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEAR_JOINT_H +#define PX_GEAR_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxGearJoint; + + /** + \brief Create a gear Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + + @see PxGearJoint + */ + PxGearJoint* PxGearJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + /** + \brief A joint that connects two existing revolute joints and constrains their relative angular velocity and position with respect to each other. + + @see PxGearJointCreate PxJoint + */ + class PxGearJoint : public PxJoint + { + public: + + /** + \brief Set the hinge/revolute joints connected by the gear joint. + + The passed joints can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. + The joints must define degrees of freedom around the twist axis. They cannot be null. + + Note that these joints are only used to compute the positional error correction term, + used to adjust potential drift between jointed actors. The gear joint can run without + calling this function, but in that case some visible overlap may develop over time between + the teeth of the gear meshes. + + \note Calling this function resets the internal positional error correction term. + + \param[in] hinge0 The first hinge joint + \param[in] hinge1 The second hinge joint + \return true if success + */ + virtual bool setHinges(const PxBase* hinge0, const PxBase* hinge1) = 0; + + /** + \brief Set the desired gear ratio. + + For two gears with n0 and n1 teeth respectively, the gear ratio is n0/n1. + + \note You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + + \note Calling this function resets the internal positional error correction term. + + \param[in] ratio Desired ratio between the two hinges. + */ + virtual void setGearRatio(float ratio) = 0; + + /** + \brief Get the gear ratio. + + \return Current ratio + */ + virtual float getGearRatio() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxGearJoint"; } + + protected: + + PX_INLINE PxGearJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + PX_INLINE PxGearJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxGearJoint", name) || PxJoint::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGjkQueryExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGjkQueryExt.h new file mode 100644 index 0000000..63416af --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxGjkQueryExt.h @@ -0,0 +1,212 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GJK_QUERY_EXT_H +#define PX_GJK_QUERY_EXT_H + +#include "geometry/PxGjkQuery.h" +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxSphereGeometry; +class PxCapsuleGeometry; +class PxBoxGeometry; +class PxConvexMeshGeometry; +class PxContactBuffer; +class PxConvexMesh; + +/** +\brief Pre-made support mapping for built-in convex geometry types. +*/ +class PxGjkQueryExt +{ +public: + /** + \brief Pre-made support mapping for a sphere + */ + struct SphereSupport : PxGjkQuery::Support + { + PxReal radius; + + /** + \brief Default constructor + */ + SphereSupport(); + /** + \brief Constructs a SphereSupport for a sphere radius + */ + SphereSupport(PxReal radius); + /** + \brief Constructs a SphereSupport for a PxSphereGeometry + */ + SphereSupport(const PxSphereGeometry& geom); + + virtual PxReal getMargin() const; + virtual PxVec3 supportLocal(const PxVec3& dir) const; + }; + + /** + \brief Pre-made support mapping for a capsule + */ + struct CapsuleSupport : PxGjkQuery::Support + { + PxReal radius, halfHeight; + + /** + \brief Default constructor + */ + CapsuleSupport(); + /** + \brief Constructs a CapsuleSupport for capsule radius and halfHeight + */ + CapsuleSupport(PxReal radius, PxReal halfHeight); + /** + \brief Constructs a CapsuleSupport for a PxCapsuleGeometry + */ + CapsuleSupport(const PxCapsuleGeometry& geom); + + virtual PxReal getMargin() const; + virtual PxVec3 supportLocal(const PxVec3& dir) const; + }; + + /** + \brief Pre-made support mapping for a box + */ + struct BoxSupport : PxGjkQuery::Support + { + PxVec3 halfExtents; + PxReal margin; + + /** + \brief Default constructor + */ + BoxSupport(); + /** + \brief Constructs a BoxSupport for a box halfExtents with optional margin + */ + BoxSupport(const PxVec3& halfExtents, PxReal margin = 0); + /** + \brief Constructs a BoxSupport for a PxBoxGeometry + */ + BoxSupport(const PxBoxGeometry& box, PxReal margin = 0); + + virtual PxReal getMargin() const; + virtual PxVec3 supportLocal(const PxVec3& dir) const; + }; + + /** + \brief Pre-made support mapping for a convex mesh + */ + struct ConvexMeshSupport : PxGjkQuery::Support + { + const PxConvexMesh* convexMesh; + PxVec3 scale; + PxQuat scaleRotation; + PxReal margin; + + /** + \brief Default constructor + */ + ConvexMeshSupport(); + /** + \brief Constructs a BoxSupport for a PxConvexMesh + */ + ConvexMeshSupport(const PxConvexMesh& convexMesh, const PxVec3& scale = PxVec3(1), const PxQuat& scaleRotation = PxQuat(PxIdentity), PxReal margin = 0); + /** + \brief Constructs a BoxSupport for a PxConvexMeshGeometry + */ + ConvexMeshSupport(const PxConvexMeshGeometry& convexMesh, PxReal margin = 0); + + virtual PxReal getMargin() const; + virtual PxVec3 supportLocal(const PxVec3& dir) const; + }; + + /** + \brief Pre-made support mapping for any PhysX's convex geometry (sphere, capsule, box, convex mesh) + */ + struct ConvexGeomSupport : PxGjkQuery::Support + { + /** + \brief Default constructor + */ + ConvexGeomSupport(); + /** + \brief Constructs a BoxSupport for a PxGeometry + */ + ConvexGeomSupport(const PxGeometry& geom, PxReal margin = 0); + /** + \brief Destructor + */ + ~ConvexGeomSupport(); + + /** + \brief Returns false if ConvexGeomSupport was constructed from non-convex geometry + */ + bool isValid() const; + + virtual PxReal getMargin() const; + virtual PxVec3 supportLocal(const PxVec3& dir) const; + + private: + PxGeometryType::Enum mType; + union { + void* alignment; + PxU8 sphere[sizeof(SphereSupport)]; + PxU8 capsule[sizeof(CapsuleSupport)]; + PxU8 box[sizeof(BoxSupport)]; + PxU8 convexMesh[sizeof(ConvexMeshSupport)]; + } mSupport; + }; + + /** + \brief Generates a contact point between two shapes using GJK-EPA algorithm + + \param[in] a Shape A support mapping + \param[in] b Shape B support mapping + \param[in] poseA Shape A transformation + \param[in] poseB Shape B transformation + \param[in] contactDistance The distance at which contacts begin to be generated between the shapes + \param[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param[out] contactBuffer A buffer to store the contact + + \return True if there is a contact. + */ + PX_DEPRECATED static bool generateContacts(const PxGjkQuery::Support& a, const PxGjkQuery::Support& b, const PxTransform& poseA, const PxTransform& poseB, + PxReal contactDistance, PxReal toleranceLength, PxContactBuffer& contactBuffer); + +}; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJoint.h new file mode 100644 index 0000000..0d469c0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJoint.h @@ -0,0 +1,422 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_JOINT_H +#define PX_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxTransform.h" +#include "PxRigidActor.h" +#include "PxConstraint.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRigidActor; +class PxScene; +class PxPhysics; +class PxConstraint; + +/** +\brief an enumeration of PhysX' built-in joint types + +@see PxJoint +*/ +struct PxJointConcreteType +{ + enum Enum + { + eSPHERICAL = PxConcreteType::eFIRST_PHYSX_EXTENSION, + eREVOLUTE, + ePRISMATIC, + eFIXED, + eDISTANCE, + eD6, + eCONTACT, + eGEAR, + eRACK_AND_PINION, + eLast + }; +}; + +PX_DEFINE_TYPEINFO(PxJoint, PxConcreteType::eUNDEFINED) +PX_DEFINE_TYPEINFO(PxRackAndPinionJoint, PxJointConcreteType::eRACK_AND_PINION) +PX_DEFINE_TYPEINFO(PxGearJoint, PxJointConcreteType::eGEAR) +PX_DEFINE_TYPEINFO(PxD6Joint, PxJointConcreteType::eD6) +PX_DEFINE_TYPEINFO(PxDistanceJoint, PxJointConcreteType::eDISTANCE) +PX_DEFINE_TYPEINFO(PxContactJoint, PxJointConcreteType::eCONTACT) +PX_DEFINE_TYPEINFO(PxFixedJoint, PxJointConcreteType::eFIXED) +PX_DEFINE_TYPEINFO(PxPrismaticJoint, PxJointConcreteType::ePRISMATIC) +PX_DEFINE_TYPEINFO(PxRevoluteJoint, PxJointConcreteType::eREVOLUTE) +PX_DEFINE_TYPEINFO(PxSphericalJoint, PxJointConcreteType::eSPHERICAL) + + +/** +\brief an enumeration for specifying one or other of the actors referenced by a joint + +@see PxJoint +*/ + +struct PxJointActorIndex +{ + enum Enum + { + eACTOR0, + eACTOR1, + COUNT + }; +}; + +/** +\brief a base interface providing common functionality for PhysX joints +*/ + +class PxJoint : public PxBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + /** + \brief Set the actors for this joint. + + An actor may be NULL to indicate the world frame. At most one of the actors may be NULL. + + \param[in] actor0 the first actor. + \param[in] actor1 the second actor + + @see getActors() + */ + virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0; + + /** + \brief Get the actors for this joint. + + \param[out] actor0 the first actor. + \param[out] actor1 the second actor + + @see setActors() + */ + virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0; + + /** + \brief Set the joint local pose for an actor. + + This is the relative pose which locates the joint frame relative to the actor. + + \param[in] actor 0 for the first actor, 1 for the second actor. + \param[in] localPose the local pose for the actor this joint + + @see getLocalPose() + */ + virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0; + + /** + \brief get the joint local pose for an actor. + + \param[in] actor 0 for the first actor, 1 for the second actor. + + return the local pose for this joint + + @see setLocalPose() + */ + virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0; + + /** + \brief get the relative pose for this joint + + This function returns the pose of the joint frame of actor1 relative to actor0 + + */ + virtual PxTransform getRelativeTransform() const = 0; + + /** + \brief get the relative linear velocity of the joint + + This function returns the linear velocity of the origin of the constraint frame of actor1, relative to the origin of the constraint + frame of actor0. The value is returned in the constraint frame of actor0 + */ + virtual PxVec3 getRelativeLinearVelocity() const = 0; + + /** + \brief get the relative angular velocity of the joint + + This function returns the angular velocity of actor1 relative to actor0. The value is returned in the constraint frame of actor0 + */ + virtual PxVec3 getRelativeAngularVelocity() const = 0; + + /** + \brief set the break force for this joint. + + if the constraint force or torque on the joint exceeds the specified values, the joint will break, + at which point it will not constrain the two actors and the flag PxConstraintFlag::eBROKEN will be set. The + force and torque are measured in the joint frame of the first actor + + \param[in] force the maximum force the joint can apply before breaking + \param[in] torque the maximum torque the joint can apply before breaking + */ + virtual void setBreakForce(PxReal force, PxReal torque) = 0; + + /** + \brief get the break force for this joint. + + \param[out] force the maximum force the joint can apply before breaking + \param[out] torque the maximum torque the joint can apply before breaking + + @see setBreakForce() + */ + virtual void getBreakForce(PxReal& force, PxReal& torque) const = 0; + + /** + \brief set the constraint flags for this joint. + + \param[in] flags the constraint flags + + @see PxConstraintFlag + */ + virtual void setConstraintFlags(PxConstraintFlags flags) = 0; + + /** + \brief set a constraint flags for this joint to a specified value. + + \param[in] flag the constraint flag + \param[in] value the value to which to set the flag + + @see PxConstraintFlag + */ + virtual void setConstraintFlag(PxConstraintFlag::Enum flag, bool value) = 0; + + /** + \brief get the constraint flags for this joint. + + \return the constraint flags + + @see PxConstraintFlag + */ + virtual PxConstraintFlags getConstraintFlags() const = 0; + + /** + \brief set the inverse mass scale for actor0. + + \param[in] invMassScale the scale to apply to the inverse mass of actor 0 for resolving this constraint + + @see getInvMassScale0 + */ + virtual void setInvMassScale0(PxReal invMassScale) = 0; + + /** + \brief get the inverse mass scale for actor0. + + \return inverse mass scale for actor0 + + @see setInvMassScale0 + */ + virtual PxReal getInvMassScale0() const = 0; + + /** + \brief set the inverse inertia scale for actor0. + + \param[in] invInertiaScale the scale to apply to the inverse inertia of actor0 for resolving this constraint + + @see getInvMassScale0 + */ + virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0; + + /** + \brief get the inverse inertia scale for actor0. + + \return inverse inertia scale for actor0 + + @see setInvInertiaScale0 + */ + virtual PxReal getInvInertiaScale0() const = 0; + + /** + \brief set the inverse mass scale for actor1. + + \param[in] invMassScale the scale to apply to the inverse mass of actor 1 for resolving this constraint + + @see getInvMassScale1 + */ + virtual void setInvMassScale1(PxReal invMassScale) = 0; + + /** + \brief get the inverse mass scale for actor1. + + \return inverse mass scale for actor1 + + @see setInvMassScale1 + */ + virtual PxReal getInvMassScale1() const = 0; + + /** + \brief set the inverse inertia scale for actor1. + + \param[in] invInertiaScale the scale to apply to the inverse inertia of actor1 for resolving this constraint + + @see getInvInertiaScale1 + */ + virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0; + + /** + \brief get the inverse inertia scale for actor1. + + \return inverse inertia scale for actor1 + + @see setInvInertiaScale1 + */ + virtual PxReal getInvInertiaScale1() const = 0; + + /** + \brief Retrieves the PxConstraint corresponding to this joint. + + This can be used to determine, among other things, the force applied at the joint. + + \return the constraint + */ + virtual PxConstraint* getConstraint() const = 0; + + /** + \brief 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. + + \param[in] name String to set the objects name to. + + @see getName() + */ + virtual void setName(const char* name) = 0; + + /** + \brief Retrieves the name string set with setName(). + + \return Name string associated with object. + + @see setName() + */ + virtual const char* getName() const = 0; + + /** + \brief Deletes the joint. + + \note This call does not wake up the connected rigid bodies. + */ + virtual void release() = 0; + + /** + \brief Retrieves the scene which this joint belongs to. + + \return Owner Scene. NULL if not part of a scene. + + @see PxScene + */ + virtual PxScene* getScene() const = 0; + + void* userData; //!< user can assign this to whatever, usually to create a 1:1 relationship with a user object. + + //serialization + + /** + \brief Put class meta data in stream, used for serialization + */ + static void getBinaryMetaData(PxOutputStream& stream); + + //~serialization + +protected: + virtual ~PxJoint() {} + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxJoint", name) || PxBase::isKindOf(name); } + + //~serialization +}; + +class PxSpring +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + PxReal stiffness; //!< the spring strength of the drive: that is, the force proportional to the position error + PxReal damping; //!< the damping strength of the drive: that is, the force proportional to the velocity error + + PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {} +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** \brief Helper function to setup a joint's global frame + + This replaces the following functions from previous SDK versions: + + void NxJointDesc::setGlobalAnchor(const NxVec3& wsAnchor); + void NxJointDesc::setGlobalAxis(const NxVec3& wsAxis); + + The function sets the joint's localPose using world-space input parameters. + + \param[in] wsAnchor Global frame anchor point. Range: position vector + \param[in] wsAxis Global frame axis. Range: direction vector + \param[in,out] joint Joint having its global frame set. +*/ + +PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis); + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJointLimit.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJointLimit.h new file mode 100644 index 0000000..c00cbac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxJointLimit.h @@ -0,0 +1,567 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_JOINT_LIMIT_H +#define PX_JOINT_LIMIT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxMath.h" +#include "common/PxTolerancesScale.h" +#include "extensions/PxJoint.h" +#include "PxPhysXConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Describes the parameters for a joint limit. + +Limits are enabled or disabled by setting flags or other configuration parameters joints, see the +documentation for specific joint types for details. +*/ +class PxJointLimitParameters +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief Controls the amount of bounce when the joint hits a limit. + + A restitution value of 1.0 causes the joint to bounce back with the velocity which it hit the limit. + A value of zero causes the joint to stop dead. + + In situations where the joint has many locked DOFs (e.g. 5) the restitution may not be applied + correctly. This is due to a limitation in the solver which causes the restitution velocity to become zero + as the solver enforces constraints on the other DOFs. + + This limitation applies to both angular and linear limits, however it is generally most apparent with limited + angular DOFs. Disabling joint projection and increasing the solver iteration count may improve this behavior + to some extent. + + Also, combining soft joint limits with joint drives driving against those limits may affect stability. + + Range: [0,1]
+ Default: 0.0 + */ + PxReal restitution; + + /** + determines the minimum impact velocity which will cause the joint to bounce + */ + PxReal bounceThreshold; + + /** + \brief if greater than zero, the limit is soft, i.e. a spring pulls the joint back to the limit + + Range: [0, PX_MAX_F32)
+ Default: 0.0 + */ + PxReal stiffness; + + /** + \brief if spring is greater than zero, this is the damping of the limit spring + + Range: [0, PX_MAX_F32)
+ Default: 0.0 + */ + PxReal damping; + + /** + \brief The distance inside the limit value at which the limit will be considered to be active by the + solver. As this value is made larger, the limit becomes active more quickly. It thus becomes less + likely to violate the extents of the limit, but more expensive. + + The contact distance should be less than the limit angle or distance, and in the case of a pair limit, + less than half the distance between the upper and lower bounds. Exceeding this value will result in + the limit being active all the time. + + Making this value too small can result in jitter around the limit. + + Default: depends on the joint + + \note This is deprecated in PhysX 5.1 + + @see PxPhysics::getTolerancesScale() + */ + 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() {} +}; + + +/** +\brief Describes a one-sided linear limit. +*/ +class PxJointLinearLimit : public PxJointLimitParameters +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief the extent of the limit. + + Range: (0, PX_MAX_F32)
+ Default: PX_MAX_F32 + */ + PxReal value; + + /** + \brief construct a linear hard limit + + \param[in] scale A PxTolerancesScale struct. Should be the same as used when creating the PxPhysics object. + \param[in] extent The extent of the limit + \param[in] contactDist_deprecated The distance from the limit at which it becomes active. Default is 0.01f scaled by the tolerance length scale. This is deprecated in PhysX 5.1. + + @see PxJointLimitParameters PxTolerancesScale + */ + PxJointLinearLimit(const PxTolerancesScale& scale, PxReal extent, PxReal contactDist_deprecated = -1.0f) + : value(extent) + { + PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated == -1.0f ? 0.01f*scale.length : contactDist_deprecated; + } + + /** + \brief construct a linear soft limit + + \param[in] extent the extent of the limit + \param[in] spring the stiffness and damping parameters for the limit spring + + @see PxJointLimitParameters PxTolerancesScale + */ + PxJointLinearLimit(PxReal extent, const PxSpring& spring) : value(extent) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \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(value) && + value > 0.0f; + } +}; + + +/** +\brief Describes a two-sided limit. +*/ +class PxJointLinearLimitPair : public PxJointLimitParameters +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief the range of the limit. The upper limit must be no lower than the + lower limit, and if they are equal the limited degree of freedom will be treated as locked. + + Range: See the joint on which the limit is used for details
+ Default: lower = -PX_MAX_F32/3, upper = PX_MAX_F32/3 + */ + PxReal upper, lower; + + /** + \brief Construct a linear hard limit pair. The lower distance value must be less than the upper distance value. + + \param[in] scale A PxTolerancesScale struct. Should be the same as used when creating the PxPhysics object. + \param[in] lowerLimit The lower distance of the limit + \param[in] upperLimit The upper distance of the limit + \param[in] contactDist_deprecated The distance from the limit at which it becomes active. Default is the lesser of 0.01f scaled by the tolerance length scale, and 0.49 * (upperLimit - lowerLimit). This is deprecated in PhysX 5.1. + + @see PxJointLimitParameters PxTolerancesScale + */ + PxJointLinearLimitPair(const PxTolerancesScale& scale, PxReal lowerLimit = -PX_MAX_F32/3.0f, PxReal upperLimit = PX_MAX_F32/3.0f, PxReal contactDist_deprecated = -1.0f) : + upper(upperLimit), + lower(lowerLimit) + { + PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated == -1.0f ? PxMin(scale.length * 0.01f, (upperLimit*0.49f-lowerLimit*0.49f)) : contactDist_deprecated; + bounceThreshold = 2.0f*scale.length; + } + + /** + \brief construct a linear soft limit pair + + \param[in] lowerLimit The lower distance of the limit + \param[in] upperLimit The upper distance of the limit + \param[in] spring The stiffness and damping parameters of the limit spring + + @see PxJointLimitParameters PxTolerancesScale + */ + PxJointLinearLimitPair(PxReal lowerLimit, PxReal upperLimit, const PxSpring& spring) : + upper(upperLimit), + lower(lowerLimit) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \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 && + PxIsFinite(upper - lower); + } +}; + + +class PxJointAngularLimitPair : public PxJointLimitParameters +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief the range of the limit. The upper limit must be no lower than the lower limit. + + Unit: Angular: Radians + Range: See the joint on which the limit is used for details
+ Default: lower = -PI/2, upper = PI/2 + */ + PxReal upper, lower; + + /** + \brief construct an angular hard limit pair. + + The lower value must be less than the upper value. + + \param[in] lowerLimit The lower angle of the limit + \param[in] upperLimit The upper angle of the limit + \param[in] contactDist_deprecated The distance from the limit at which it becomes active. Default is the lesser of 0.1 radians, and 0.49 * (upperLimit - lowerLimit). This is deprecated in PhysX 5.1. + + @see PxJointLimitParameters + */ + 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 construct an angular soft limit pair. + + The lower value must be less than the upper value. + + \param[in] lowerLimit The lower angle of the limit + \param[in] upperLimit The upper angle of the limit + \param[in] spring The stiffness and damping of the limit spring + + @see PxJointLimitParameters + */ + PxJointAngularLimitPair(PxReal lowerLimit, PxReal upperLimit, const PxSpring& spring) : + upper(upperLimit), + lower(lowerLimit) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \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; + } +}; + +/** +\brief Describes an elliptical conical joint limit. Note that very small or highly elliptical limit cones may +result in jitter. + +@see PxD6Joint PxSphericalJoint +*/ +class PxJointLimitCone : public PxJointLimitParameters +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief the maximum angle from the Y axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (0,PI)
+ Default: PI/2 + */ + PxReal yAngle; + + /** + \brief the maximum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (0,PI)
+ Default: PI/2 + */ + PxReal zAngle; + + /** + \brief Construct a cone hard limit. + + \param[in] yLimitAngle The limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngle The limit angle from the Z-axis of the constraint frame + \param[in] contactDist_deprecated The distance from the limit at which it becomes active. Default is the lesser of 0.1 radians, and 0.49 * the lower of the limit angles. This is deprecated in PhysX 5.1. + + @see PxJointLimitParameters + */ + PxJointLimitCone(PxReal yLimitAngle, PxReal zLimitAngle, PxReal contactDist_deprecated = -1.0f) : + yAngle(yLimitAngle), + zAngle(zLimitAngle) + { + PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated == -1.0f ? PxMin(0.1f, PxMin(yLimitAngle, zLimitAngle)*0.49f) : contactDist_deprecated; + bounceThreshold = 0.5f; + } + + /** + \brief Construct a cone soft limit. + + \param[in] yLimitAngle The limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngle The limit angle from the Z-axis of the constraint frame + \param[in] spring The stiffness and damping of the limit spring + + @see PxJointLimitParameters + */ + PxJointLimitCone(PxReal yLimitAngle, PxReal zLimitAngle, const PxSpring& spring) : + yAngle(yLimitAngle), + zAngle(zLimitAngle) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \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(yAngle) && yAngle>0 && yAngle0 && zAngleUnit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: -PI/2 + */ + PxReal yAngleMin; + + /** + \brief the maximum angle from the Y axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: PI/2 + */ + PxReal yAngleMax; + + /** + \brief the minimum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: -PI/2 + */ + PxReal zAngleMin; + + /** + \brief the maximum angle from the Z-axis of the constraint frame. + + Unit: Angular: Radians + Range: Angular: (-PI,PI)
+ Default: PI/2 + */ + PxReal zAngleMax; + + /** + \brief Construct a pyramid hard limit. + + \param[in] yLimitAngleMin The minimum limit angle from the Y-axis of the constraint frame + \param[in] yLimitAngleMax The maximum limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngleMin The minimum limit angle from the Z-axis of the constraint frame + \param[in] zLimitAngleMax The maximum limit angle from the Z-axis of the constraint frame + \param[in] contactDist_deprecated The distance from the limit at which it becomes active. Default is the lesser of 0.1 radians, and 0.49 * the lower of the limit angles. This is deprecated in PhysX 5.1. + + @see PxJointLimitParameters + */ + PxJointLimitPyramid(PxReal yLimitAngleMin, PxReal yLimitAngleMax, PxReal zLimitAngleMin, PxReal zLimitAngleMax, PxReal contactDist_deprecated = -1.0f) : + yAngleMin(yLimitAngleMin), + yAngleMax(yLimitAngleMax), + zAngleMin(zLimitAngleMin), + zAngleMax(zLimitAngleMax) + { + if(contactDist_deprecated == -1.0f) + { + const PxReal contactDistY = PxMin(0.1f, 0.49f*(yLimitAngleMax - yLimitAngleMin)); + const PxReal contactDistZ = PxMin(0.1f, 0.49f*(zLimitAngleMax - zLimitAngleMin)); + PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated == PxMin(contactDistY, contactDistZ); + } + else + { + PxJointLimitParameters::contactDistance_deprecated = contactDist_deprecated; + } + + bounceThreshold = 0.5f; + } + + /** + \brief Construct a pyramid soft limit. + + \param[in] yLimitAngleMin The minimum limit angle from the Y-axis of the constraint frame + \param[in] yLimitAngleMax The maximum limit angle from the Y-axis of the constraint frame + \param[in] zLimitAngleMin The minimum limit angle from the Z-axis of the constraint frame + \param[in] zLimitAngleMax The maximum limit angle from the Z-axis of the constraint frame + \param[in] spring The stiffness and damping of the limit spring + + @see PxJointLimitParameters + */ + PxJointLimitPyramid(PxReal yLimitAngleMin, PxReal yLimitAngleMax, PxReal zLimitAngleMin, PxReal zLimitAngleMax, const PxSpring& spring) : + yAngleMin(yLimitAngleMin), + yAngleMax(yLimitAngleMax), + zAngleMin(zLimitAngleMin), + zAngleMax(zLimitAngleMax) + { + stiffness = spring.stiffness; + damping = spring.damping; + } + + /** + \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(yAngleMin) && yAngleMin>-PxPi && yAngleMin-PxPi && yAngleMax-PxPi && zAngleMin-PxPi && zAngleMax=yAngleMin && zAngleMax>=zAngleMin; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxMassProperties.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxMassProperties.h new file mode 100644 index 0000000..a7acf59 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxMassProperties.h @@ -0,0 +1,365 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MASS_PROPERTIES_H +#define PX_MASS_PROPERTIES_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "foundation/PxMath.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxCustomGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxTriangleMesh.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Utility class to compute and manipulate mass and inertia tensor properties. + +In most cases #PxRigidBodyExt::updateMassAndInertia(), #PxRigidBodyExt::setMassAndUpdateInertia() should be enough to +setup the mass properties of a rigid body. This utility class targets users that need to customize the mass properties +computation. +*/ +class PxMassProperties +{ +public: + /** + \brief Default constructor. + */ + PX_FORCE_INLINE PxMassProperties() : inertiaTensor(PxIdentity), centerOfMass(0.0f), mass(1.0f) {} + + /** + \brief Construct from individual elements. + */ + PX_FORCE_INLINE PxMassProperties(const PxReal m, const PxMat33& inertiaT, const PxVec3& com) : inertiaTensor(inertiaT), centerOfMass(com), mass(m) {} + + /** + \brief Compute mass properties based on a provided geometry structure. + + This constructor assumes the geometry has a density of 1. Mass and inertia tensor scale linearly with density. + + \param[in] geometry The geometry to compute the mass properties for. Supported geometry types are: sphere, box, capsule and convex mesh. + */ + PxMassProperties(const PxGeometry& geometry) + { + switch (geometry.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& s = static_cast(geometry); + mass = (4.0f / 3.0f) * PxPi * s.radius * s.radius * s.radius; + inertiaTensor = PxMat33::createDiagonal(PxVec3(2.0f / 5.0f * mass * s.radius * s.radius)); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& b = static_cast(geometry); + mass = b.halfExtents.x * b.halfExtents.y * b.halfExtents.z * 8.0f; + PxVec3 d2 = b.halfExtents.multiply(b.halfExtents); + inertiaTensor = PxMat33::createDiagonal(PxVec3(d2.y + d2.z, d2.x + d2.z, d2.x + d2.y)) * (mass * 1.0f / 3.0f); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& c = static_cast(geometry); + PxReal r = c.radius, h = c.halfHeight; + mass = ((4.0f / 3.0f) * r + 2 * c.halfHeight) * PxPi * r * r; + + PxReal a = r*r*r * (8.0f / 15.0f) + h*r*r * (3.0f / 2.0f) + h*h*r * (4.0f / 3.0f) + h*h*h * (2.0f / 3.0f); + PxReal b = r*r*r * (8.0f / 15.0f) + h*r*r; + inertiaTensor = PxMat33::createDiagonal(PxVec3(b, a, a) * PxPi * r * r); + centerOfMass = PxVec3(0.0f); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& c = static_cast(geometry); + PxVec3 unscaledCoM; + PxMat33 unscaledInertiaTensorNonCOM; // inertia tensor of convex mesh in mesh local space + PxMat33 unscaledInertiaTensorCOM; + PxReal unscaledMass; + c.convexMesh->getMassInformation(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM); + + // inertia tensor relative to center of mass + unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass*PxReal((unscaledCoM.y*unscaledCoM.y+unscaledCoM.z*unscaledCoM.z)); + unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass*PxReal((unscaledCoM.z*unscaledCoM.z+unscaledCoM.x*unscaledCoM.x)); + unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass*PxReal((unscaledCoM.x*unscaledCoM.x+unscaledCoM.y*unscaledCoM.y)); + unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass*PxReal(unscaledCoM.x*unscaledCoM.y)); + unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass*PxReal(unscaledCoM.y*unscaledCoM.z)); + unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass*PxReal(unscaledCoM.z*unscaledCoM.x)); + + const PxMeshScale& s = c.scale; + mass = unscaledMass * s.scale.x * s.scale.y * s.scale.z; + centerOfMass = s.transform(unscaledCoM); + inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.rotation, s.scale); + } + break; + + case PxGeometryType::eCUSTOM: + { + *this = PxMassProperties(); + static_cast(geometry).callbacks->computeMassProperties(geometry, *this); + } + break; + + case PxGeometryType::eTRIANGLEMESH: + { + const PxTriangleMeshGeometry& g = static_cast(geometry); + + PxVec3 unscaledCoM; + PxMat33 unscaledInertiaTensorNonCOM; // inertia tensor of convex mesh in mesh local space + PxMat33 unscaledInertiaTensorCOM; + PxReal unscaledMass; + g.triangleMesh->getMassInformation(unscaledMass, unscaledInertiaTensorNonCOM, unscaledCoM); + + // inertia tensor relative to center of mass + unscaledInertiaTensorCOM[0][0] = unscaledInertiaTensorNonCOM[0][0] - unscaledMass * PxReal((unscaledCoM.y*unscaledCoM.y + unscaledCoM.z*unscaledCoM.z)); + unscaledInertiaTensorCOM[1][1] = unscaledInertiaTensorNonCOM[1][1] - unscaledMass * PxReal((unscaledCoM.z*unscaledCoM.z + unscaledCoM.x*unscaledCoM.x)); + unscaledInertiaTensorCOM[2][2] = unscaledInertiaTensorNonCOM[2][2] - unscaledMass * PxReal((unscaledCoM.x*unscaledCoM.x + unscaledCoM.y*unscaledCoM.y)); + unscaledInertiaTensorCOM[0][1] = unscaledInertiaTensorCOM[1][0] = (unscaledInertiaTensorNonCOM[0][1] + unscaledMass * PxReal(unscaledCoM.x*unscaledCoM.y)); + unscaledInertiaTensorCOM[1][2] = unscaledInertiaTensorCOM[2][1] = (unscaledInertiaTensorNonCOM[1][2] + unscaledMass * PxReal(unscaledCoM.y*unscaledCoM.z)); + unscaledInertiaTensorCOM[0][2] = unscaledInertiaTensorCOM[2][0] = (unscaledInertiaTensorNonCOM[0][2] + unscaledMass * PxReal(unscaledCoM.z*unscaledCoM.x)); + + const PxMeshScale& s = g.scale; + mass = unscaledMass * s.scale.x * s.scale.y * s.scale.z; + centerOfMass = s.transform(unscaledCoM); + inertiaTensor = scaleInertia(unscaledInertiaTensorCOM, s.rotation, s.scale); + } + break; + + default: + { + *this = PxMassProperties(); + } + } + + PX_ASSERT(inertiaTensor.column0.isFinite() && inertiaTensor.column1.isFinite() && inertiaTensor.column2.isFinite()); + PX_ASSERT(centerOfMass.isFinite()); + PX_ASSERT(PxIsFinite(mass)); + } + + /** + \brief Scale mass properties. + + \param[in] scale The linear scaling factor to apply to the mass properties. + \return The scaled mass properties. + */ + PX_FORCE_INLINE PxMassProperties operator*(const PxReal scale) const + { + PX_ASSERT(PxIsFinite(scale)); + + return PxMassProperties(mass * scale, inertiaTensor * scale, centerOfMass); + } + + /** + \brief Translate the center of mass by a given vector and adjust the inertia tensor accordingly. + + \param[in] t The translation vector for the center of mass. + */ + PX_FORCE_INLINE void translate(const PxVec3& t) + { + PX_ASSERT(t.isFinite()); + + inertiaTensor = translateInertia(inertiaTensor, mass, t); + centerOfMass += t; + + PX_ASSERT(inertiaTensor.column0.isFinite() && inertiaTensor.column1.isFinite() && inertiaTensor.column2.isFinite()); + PX_ASSERT(centerOfMass.isFinite()); + } + + /** + \brief Get the entries of the diagonalized inertia tensor and the corresponding reference rotation. + + \param[in] inertia The inertia tensor to diagonalize. + \param[out] massFrame The frame the diagonalized tensor refers to. + \return The entries of the diagonalized inertia tensor. + */ + PX_FORCE_INLINE static PxVec3 getMassSpaceInertia(const PxMat33& inertia, PxQuat& massFrame) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + + PxVec3 diagT = PxDiagonalize(inertia, massFrame); + PX_ASSERT(diagT.isFinite()); + PX_ASSERT(massFrame.isFinite()); + return diagT; + } + + /** + \brief Translate an inertia tensor using the parallel axis theorem + + \param[in] inertia The inertia tensor to translate. + \param[in] mass The mass of the object. + \param[in] t The relative frame to translate the inertia tensor to. + \return The translated inertia tensor. + */ + PX_FORCE_INLINE static PxMat33 translateInertia(const PxMat33& inertia, const PxReal mass, const PxVec3& t) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(PxIsFinite(mass)); + PX_ASSERT(t.isFinite()); + + PxMat33 s( PxVec3(0,t.z,-t.y), + PxVec3(-t.z,0,t.x), + PxVec3(t.y,-t.x,0) ); + + PxMat33 translatedIT = s.getTranspose() * s * mass + inertia; + PX_ASSERT(translatedIT.column0.isFinite() && translatedIT.column1.isFinite() && translatedIT.column2.isFinite()); + return translatedIT; + } + + /** + \brief Rotate an inertia tensor around the center of mass + + \param[in] inertia The inertia tensor to rotate. + \param[in] q The rotation from the new to the old coordinate frame, i.e. q.rotate(v) transforms + the coordinates of vector v from the old to the new coordinate frame. + \return The rotated inertia tensor. + */ + PX_FORCE_INLINE static PxMat33 rotateInertia(const PxMat33& inertia, const PxQuat& q) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(q.isUnit()); + + PxMat33 m(q); + PxMat33 rotatedIT = m * inertia * m.getTranspose(); + PX_ASSERT(rotatedIT.column0.isFinite() && rotatedIT.column1.isFinite() && rotatedIT.column2.isFinite()); + return rotatedIT; + } + + /** + \brief Non-uniform scaling of the inertia tensor + + \param[in] inertia The inertia tensor to scale. + \param[in] scaleRotation The rotation from the scaling frame to the frame that inertia is expressed in. + I.e. scaleRotation.rotate(v) transforms the coordinates of vertex v from inertia's frame to the scaling-axes frame. + \param[in] scale The scaling factor for each axis (relative to the frame specified with scaleRotation). + \return The scaled inertia tensor. + */ + static PxMat33 scaleInertia(const PxMat33& inertia, const PxQuat& scaleRotation, const PxVec3& scale) + { + PX_ASSERT(inertia.column0.isFinite() && inertia.column1.isFinite() && inertia.column2.isFinite()); + PX_ASSERT(scaleRotation.isUnit()); + PX_ASSERT(scale.isFinite()); + + PxMat33 localInertiaT = rotateInertia(inertia, scaleRotation); // rotate inertia into scaling frame + PxVec3 diagonal(localInertiaT[0][0], localInertiaT[1][1], localInertiaT[2][2]); + + PxVec3 xyz2 = PxVec3(diagonal.dot(PxVec3(0.5f))) - diagonal; // original x^2, y^2, z^2 + PxVec3 scaledxyz2 = xyz2.multiply(scale).multiply(scale); + + PxReal xx = scaledxyz2.y + scaledxyz2.z, + yy = scaledxyz2.z + scaledxyz2.x, + zz = scaledxyz2.x + scaledxyz2.y; + + PxReal xy = localInertiaT[0][1] * scale.x * scale.y, + xz = localInertiaT[0][2] * scale.x * scale.z, + yz = localInertiaT[1][2] * scale.y * scale.z; + + PxMat33 scaledInertia( PxVec3(xx, xy, xz), + PxVec3(xy, yy, yz), + PxVec3(xz, yz, zz)); + + PxMat33 scaledIT = rotateInertia(scaledInertia * (scale.x * scale.y * scale.z), scaleRotation.getConjugate()); + PX_ASSERT(scaledIT.column0.isFinite() && scaledIT.column1.isFinite() && scaledIT.column2.isFinite()); + return scaledIT; + } + + /** + \brief Sum up individual mass properties. + + \param[in] props Array of mass properties to sum up. + \param[in] transforms Reference transforms for each mass properties entry. + \param[in] count The number of mass properties to sum up. + \return The summed up mass properties. + */ + static PxMassProperties sum(const PxMassProperties* props, const PxTransform* transforms, const PxU32 count) + { + PxReal combinedMass = 0.0f; + PxVec3 combinedCoM(0.0f); + PxMat33 combinedInertiaT = PxMat33(PxZero); + + for(PxU32 i = 0; i < count; i++) + { + PX_ASSERT(props[i].inertiaTensor.column0.isFinite() && props[i].inertiaTensor.column1.isFinite() && props[i].inertiaTensor.column2.isFinite()); + PX_ASSERT(props[i].centerOfMass.isFinite()); + PX_ASSERT(PxIsFinite(props[i].mass)); + + combinedMass += props[i].mass; + const PxVec3 comTm = transforms[i].transform(props[i].centerOfMass); + combinedCoM += comTm * props[i].mass; + } + + if(combinedMass > 0.f) + combinedCoM /= combinedMass; + + for(PxU32 i = 0; i < count; i++) + { + const PxVec3 comTm = transforms[i].transform(props[i].centerOfMass); + combinedInertiaT += translateInertia(rotateInertia(props[i].inertiaTensor, transforms[i].q), props[i].mass, combinedCoM - comTm); + } + + PX_ASSERT(combinedInertiaT.column0.isFinite() && combinedInertiaT.column1.isFinite() && combinedInertiaT.column2.isFinite()); + PX_ASSERT(combinedCoM.isFinite()); + PX_ASSERT(PxIsFinite(combinedMass)); + + return PxMassProperties(combinedMass, combinedInertiaT, combinedCoM); + } + + + PxMat33 inertiaTensor; //!< The inertia tensor of the object. + PxVec3 centerOfMass; //!< The center of mass of the object. + PxReal mass; //!< The mass of the object. +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleClothCooker.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleClothCooker.h new file mode 100644 index 0000000..537e86f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleClothCooker.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_CLOTH_COOKER_H +#define PX_PARTICLE_CLOTH_COOKER_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace ExtGpu +{ + +/** +\brief Holds all the information for a particle cloth constraint used in the PxParticleClothCooker. +*/ +struct PxParticleClothConstraint +{ + enum + { + eTYPE_INVALID_CONSTRAINT = 0, + eTYPE_HORIZONTAL_CONSTRAINT = 1, + eTYPE_VERTICAL_CONSTRAINT = 2, + eTYPE_DIAGONAL_CONSTRAINT = 4, + eTYPE_BENDING_CONSTRAINT = 8, + eTYPE_DIAGONAL_BENDING_CONSTRAINT = 16, + eTYPE_ALL = eTYPE_HORIZONTAL_CONSTRAINT | eTYPE_VERTICAL_CONSTRAINT | eTYPE_DIAGONAL_CONSTRAINT | eTYPE_BENDING_CONSTRAINT | eTYPE_DIAGONAL_BENDING_CONSTRAINT + }; + PxU32 particleIndexA; //!< The first particle index of this constraint. + PxU32 particleIndexB; //!< The second particle index of this constraint. + PxReal length; //!< The distance between particle A and B. + PxU32 constraintType; //!< The type of constraint, see the constraint type enum. +}; + +/* +\brief Generates PxParticleClothConstraint constraints that connect the individual particles of a particle cloth. +*/ +class PxParticleClothCooker +{ +public: + virtual void release() = 0; + + /** + \brief Generate the constraint list and triangle index list. + + \param[in] constraints A pointer to an array of PxParticleClothConstraint constraints. If NULL, the cooker will generate all the constraints. Otherwise, the user-provided constraints will be added. + \param[in] numConstraints The number of user-provided PxParticleClothConstraint s. + */ + virtual void cookConstraints(const PxParticleClothConstraint* constraints = NULL, const PxU32 numConstraints = 0) = 0; + + virtual PxU32* getTriangleIndices() = 0; //!< \return A pointer to the triangle indices. + virtual PxU32 getTriangleIndicesCount() = 0; //!< \return The number of triangle indices. + virtual PxParticleClothConstraint* getConstraints() = 0; //!< \return A pointer to the PxParticleClothConstraint constraints. + virtual PxU32 getConstraintCount() = 0; //!< \return The number of constraints. + virtual void calculateMeshVolume() = 0; //!< Computes the volume of a closed mesh and the contraintScale. Expects vertices in local space - 'close' to origin. + virtual PxReal getMeshVolume() = 0; //!< \return The mesh volume calculated by PxParticleClothCooker::calculateMeshVolume. + +protected: + virtual ~PxParticleClothCooker() {} +}; + +} // namespace ExtGpu + +/** +\brief Creates a PxParticleClothCooker. + +\param[in] vertexCount The number of vertices of the particle cloth. +\param[in] inVertices The vertex positions of the particle cloth. +\param[in] triangleIndexCount The number of triangles of the cloth mesh. +\param[in] inTriangleIndices The triangle indices of the cloth mesh +\param[in] constraintTypeFlags The types of constraints to generate. See PxParticleClothConstraint. +\param[in] verticalDirection The vertical direction of the cloth mesh. This is needed to generate the correct horizontal and vertical constraints to model shear stiffness. +\param[in] bendingConstraintMaxAngle The maximum angle considered in the bending constraints. + +\return A pointer to the new PxParticleClothCooker. +*/ +ExtGpu::PxParticleClothCooker* PxCreateParticleClothCooker(PxU32 vertexCount, physx::PxVec4* inVertices, PxU32 triangleIndexCount, PxU32* inTriangleIndices, + PxU32 constraintTypeFlags = ExtGpu::PxParticleClothConstraint::eTYPE_ALL, PxVec3 verticalDirection = PxVec3(0.0f,1.0f,0.0f), PxReal bendingConstraintMaxAngle = 20.0f/360.0f*PxTwoPi +); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleExt.h new file mode 100644 index 0000000..4ad9c5e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxParticleExt.h @@ -0,0 +1,394 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLE_EXT_H +#define PX_PARTICLE_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxParticleSystem.h" +#include "PxParticleBuffer.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "PxAttachment.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace ExtGpu +{ + +/** +\brief Structure to define user-defined particle state when constructing a new particle system. +*/ +struct PxParticleBufferDesc +{ + PxVec4* positions; + PxVec4* velocities; + PxU32* phases; + PxParticleVolume* volumes; + PxU32 numActiveParticles; + PxU32 maxParticles; + PxU32 numVolumes; + PxU32 maxVolumes; + + PxParticleBufferDesc() : positions(NULL), velocities(NULL), phases(NULL), volumes(NULL), numActiveParticles(0), maxParticles(0), numVolumes(0), maxVolumes(0) { } +}; + +/** +\brief Structure to define user-defined particle state when constructing a new particle system that includes diffuse particles. +*/ +struct PxParticleAndDiffuseBufferDesc : public PxParticleBufferDesc +{ + PxDiffuseParticleParams diffuseParams; + PxU32 maxDiffuseParticles; + PxU32 maxActiveDiffuseParticles; + + PxParticleAndDiffuseBufferDesc() : PxParticleBufferDesc() { } +}; + +/** +\brief Structure to define user-defined particle state when constructing a new particle system that includes shape-matched rigid bodies. +*/ +struct PxParticleRigidDesc +{ + PxParticleRigidDesc() : rigidOffsets(NULL), rigidCoefficients(NULL), rigidTranslations(NULL), rigidRotations(NULL), + rigidLocalPositions(NULL), rigidLocalNormals(NULL), maxRigids(0), numActiveRigids(0) { } + + PxU32* rigidOffsets; + PxReal* rigidCoefficients; + PxVec4* rigidTranslations; + PxQuat* rigidRotations; + PxVec4* rigidLocalPositions; + PxVec4* rigidLocalNormals; + PxU32 maxRigids; + PxU32 numActiveRigids; +}; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** +\brief Helper class to manage PxParticleClothDesc buffers used for communicating particle based cloths to PxParticleClothBuffer. +*/ +class PxParticleClothBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxCloths() const = 0; //!< \return The maximum number of cloths this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumCloths() const = 0; //!< \return The current number of cloths in this PxParticleClothBufferHelper. + virtual PxU32 getMaxSprings() const = 0; //!< \return The maximum number of springs this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumSprings() const = 0; //!< \return The current number of springs in this PxParticleClothBufferHelper. + virtual PxU32 getMaxTriangles() const = 0; //!< \return The maximum number of triangles this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumTriangles() const = 0; //!< \return The current number of triangles in this PxParticleClothBufferHelper. + virtual PxU32 getMaxParticles() const = 0; //!< \return The maximum number of particles this PxParticleClothBufferHelper can hold. + virtual PxU32 getNumParticles() const = 0; //!< \return The current number of particles in this PxParticleClothBufferHelper. + + /** + \brief Adds a PxParticleCloth to this PxParticleClothBufferHelper instance. + + \param[in] particleCloth The PxParticleCloth to be added. + \param[in] triangles A pointer to the triangles + \param[in] numTriangles The number of triangles + \param[in] springs A pointer to the springs + \param[in] numSprings The number of springs + \param[in] restPositions A pointer to the particle rest positions + \param[in] numParticles The number of particles in this cloth + + @see PxParticleCloth PxParticleSpring + */ + virtual void addCloth(const PxParticleCloth& particleCloth, + const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, const PxVec4* restPositions, const PxU32 numParticles) = 0; + + /** + \brief Adds a cloth to this PxParticleClothBufferHelper instance. + + Adds a cloth to this PxParticleClothBufferHelper instance. With this method the relevant parameters for inflatable simulation + (restVolume, pressure) can be set directly. + + \param[in] blendScale This should be 1.f / (numPartitions + 1) if the springs are partitioned by the user. Otherwise this will be set during spring partitioning. + \param[in] restVolume The rest volume of the inflatable + \param[in] pressure The pressure of the inflatable. The target inflatable volume is defined as restVolume * pressure. Setting this to > 0.0 will enable inflatable simulation. + \param[in] triangles A pointer to the triangles + \param[in] numTriangles The number of triangles + \param[in] springs A pointer to the springs + \param[in] numSprings The number of springs + \param[in] restPositions A pointer to the particle rest positions + \param[in] numParticles The number of particles in this cloth + + @see PxParticleSpring + */ + virtual void addCloth(const PxReal blendScale, const PxReal restVolume, const PxReal pressure, + const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, + const PxVec4* restPositions, const PxU32 numParticles) = 0; + + /** + \brief Returns a PxParticleClothDesc for this PxParticleClothBufferHelper instance to be used for spring partitioning. + + \return the PxParticleClothDesc. + + @see PxCreateAndPopulateParticleClothBuffer, PxParticleClothPreProcessor::partitionSprings + */ + virtual PxParticleClothDesc& getParticleClothDesc() = 0; + +protected: + virtual ~PxParticleClothBufferHelper() {} +}; + + +/** +\brief Helper struct that holds information about a specific mesh in a PxParticleVolumeBufferHelper. +*/ +struct PxParticleVolumeMesh +{ + PxU32 startIndex; //!< The index of the first triangle of this mesh in the triangle array of the PxParticleVolumeBufferHelper instance. + PxU32 count; //!< The number of triangles of this mesh. +}; + +/** +\brief Helper class to manage communicating PxParticleVolumes data to PxParticleBuffer. +*/ +class PxParticleVolumeBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxVolumes() const = 0; //!< \return The maximum number of PxParticleVolume this PxParticleVolumeBufferHelper instance can hold. + virtual PxU32 getNumVolumes() const = 0; //!< \return The current number of PxParticleVolume in this PxParticleVolumeBufferHelper instance. + virtual PxU32 getMaxTriangles() const = 0; //!< \return The maximum number of triangles this PxParticleVolumeBufferHelper instance can hold. + virtual PxU32 getNumTriangles() const = 0; //!< \return The current number of triangles in this PxParticleVolumeBufferHelper instance. + + virtual PxParticleVolume* getParticleVolumes() = 0; //!< \return A pointer to the PxParticleVolume s of this PxParticleVolumeBufferHelper instance. + virtual PxParticleVolumeMesh* getParticleVolumeMeshes() = 0; //!< \return A pointer to the PxParticleVolumeMesh structs describing the PxParticleVolumes of this PxParticleVolumeBufferHelper instance. + virtual PxU32* getTriangles() = 0; //!< \return A pointer to the triangle indices in this PxParticleVolumeBufferHelper instance. + + /** + \brief Adds a PxParticleVolume with a PxParticleVolumeMesh + + \param[in] volume The PxParticleVolume to be added. + \param[in] volumeMesh A PxParticleVolumeMesh that describes the volumes to be added. startIndex is the index into the triangle list of the PxParticleVolumeBufferHelper instance. + \param[in] triangles A pointer to the triangle indices of the PxParticleVolume to be added. + \param[in] numTriangles The number of triangles of the PxParticleVolume to be added. + */ + virtual void addVolume(const PxParticleVolume& volume, const PxParticleVolumeMesh& volumeMesh, const PxU32* triangles, const PxU32 numTriangles) = 0; + + /** + \brief Adds a volume + + \param[in] particleOffset The index of the first particle of the cloth that maps to this volume in the PxParticleClothBufferHelper instance. + \param[in] numParticles The number of particles of the cloth that maps to this volume in the PxParticleClothBufferHelper instance. + \param[in] triangles A pointer to the triangle indices of this volume. + \param[in] numTriangles The number of triangles in this volume. + */ + virtual void addVolume(const PxU32 particleOffset, const PxU32 numParticles, const PxU32* triangles, const PxU32 numTriangles) = 0; + +protected: + virtual ~PxParticleVolumeBufferHelper() {} +}; + + +/** +\brief Helper class to manage PxParticleRigidDesc buffers used for communicating particle based rigids to PxPaticleSystem. +*/ +class PxParticleRigidBufferHelper +{ +public: + virtual void release() = 0; + + virtual PxU32 getMaxRigids() const = 0; //!< \return The maximum number of rigids this PxParticleRigidBufferHelper instance can hold. + virtual PxU32 getNumRigids() const = 0; //!< \return The current number of rigids in this PxParticleRigidBufferHelper instance. + virtual PxU32 getMaxParticles() const = 0; //!< \return The maximum number of particles this PxParticleRigidBufferHelper instance can hold. + virtual PxU32 getNumParticles() const = 0; //!< \return The current number of particles in this PxParticleRigidBufferHelper instance. + + /** + \brief Adds a rigid. + + \param[in] translation The world-space location of the rigid. + \param[in] rotation The world-space rotation of the rigid. + \param[in] coefficient The stiffness of the rigid. + \param[in] localPositions The particle positions in local space. + \param[in] localNormals The surface normal for all the particles in local space. Each PxVec4 has the normal in the first 3 components and the SDF in the last component. + \param[in] numParticles The number of particles in this rigid. + */ + virtual void addRigid(const PxVec3& translation, const PxQuat& rotation, const PxReal coefficient, + const PxVec4* localPositions, const PxVec4* localNormals, PxU32 numParticles) = 0; + + /** + \brief Get the PxParticleRigidDesc for this buffer. + + \returns A PxParticleRigidDesc. + */ + virtual PxParticleRigidDesc& getParticleRigidDesc() = 0; + +protected: + virtual ~PxParticleRigidBufferHelper() {} +}; + +/////////////////////////////////////////////////////////////////////////////// + +/** +\brief Holds user-defined attachment data to attach particles to other bodies +*/ +class PxParticleAttachmentBuffer : public PxUserAllocated +{ + PxArray mAttachments; + PxArray mFilters; + PxHashMap mReferencedBodies; + PxArray mNewReferencedBodies; + PxArray mDestroyedRefrencedBodies; + + PxParticleBuffer& mParticleBuffer; + + PxParticleRigidAttachment* mDeviceAttachments; + PxParticleRigidFilterPair* mDeviceFilters; + PxU32 mNumDeviceAttachments; + PxU32 mNumDeviceFilters; + + PxCudaContextManager* mCudaContextManager; + + PxParticleSystem& mParticleSystem; + + bool mDirty; + + PX_NOCOPY(PxParticleAttachmentBuffer) + +public: + + PxParticleAttachmentBuffer(PxParticleBuffer& particleBuffer, PxParticleSystem& particleSystem); + + ~PxParticleAttachmentBuffer(); + + // adds attachment to attachment buffer - localPose is in actor space for attachments to all types of rigids. + void addRigidAttachment(PxRigidActor* rigidBody, const PxU32 particleID, const PxVec3& localPose, PxConeLimitedConstraint* coneLimit = NULL); + bool removeRigidAttachment(PxRigidActor* rigidBody, const PxU32 particleID); + void addRigidFilter(PxRigidActor* rigidBody, const PxU32 particleID); + bool removeRigidFilter(PxRigidActor* rigidBody, const PxU32 particleID); + + void copyToDevice(CUstream stream = 0); +}; + +/** +\brief Creates a PxParticleRigidBufferHelper. + +\param[in] maxRigids The maximum number of rigids this PxParticleRigidsBuffers instance should hold. +\param[in] maxParticles The maximum number of particles this PxParticleRigidBufferHelper instance should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the new PxParticleRigidBufferHelper. +*/ +PxParticleRigidBufferHelper* PxCreateParticleRigidBufferHelper(PxU32 maxRigids, PxU32 maxParticles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a PxParticleClothBufferHelper helper. + +\param[in] maxCloths The maximum number of cloths this PxParticleClothBufferHelper should hold. +\param[in] maxTriangles The maximum number of triangles this PxParticleClothBufferHelper should hold. +\param[in] maxSprings The maximum number of springs this PxParticleClothBufferHelper should hold. +\param[in] maxParticles The maximum number of particles this PxParticleClothBufferHelper should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the PxParticleClothBufferHelper that was created. +*/ +PxParticleClothBufferHelper* PxCreateParticleClothBufferHelper(const PxU32 maxCloths, const PxU32 maxTriangles, const PxU32 maxSprings, const PxU32 maxParticles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a PxParticleVolumeBufferHelper. + +\param[in] maxVolumes The maximum number of PxParticleVolume s this PxParticleVolumeBufferHelper instance should hold. +\param[in] maxTriangles The maximum number of triangles this PxParticleVolumeBufferHelper instance should hold. +\param[in] cudaContextManager A pointer to a PxCudaContextManager. + +\return A pointer to the new PxParticleVolumeBufferHelper. +*/ +PxParticleVolumeBufferHelper* PxCreateParticleVolumeBufferHelper(PxU32 maxVolumes, PxU32 maxTriangles, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates a particle attachment buffer + +\param[in] particleBuffer The particle buffer that contains particles that should get attached to something +\param[in] particleSystem The particle system that is used to simulate the userBuffer +\return An attachment buffer ready to use +*/ +PxParticleAttachmentBuffer* PxCreateParticleAttachmentBuffer(PxParticleBuffer& particleBuffer, PxParticleSystem& particleSystem); + +/** +\brief Creates and populates a particle buffer + +\param[in] desc The particle buffer descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle buffer ready to use +*/ +PxParticleBuffer* PxCreateAndPopulateParticleBuffer(const ExtGpu::PxParticleBufferDesc& desc, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle buffer that includes support for diffuse particles + +\param[in] desc The particle buffer descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle buffer ready to use +*/ +PxParticleAndDiffuseBuffer* PxCreateAndPopulateParticleAndDiffuseBuffer(const ExtGpu::PxParticleAndDiffuseBufferDesc& desc, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle cloth buffer + +\param[in] desc The particle buffer descriptor +\param[in] clothDesc The cloth descriptor +\param[out] output A cloth output object to further configure the behavior of the cloth +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle cloth buffer ready to use +*/ +PxParticleClothBuffer* PxCreateAndPopulateParticleClothBuffer(const ExtGpu::PxParticleBufferDesc& desc, const PxParticleClothDesc& clothDesc, + PxPartitionedParticleCloth& output, PxCudaContextManager* cudaContextManager); + +/** +\brief Creates and populates a particle rigid buffer. Particle rigids are particles that try to keep their relative positions. They are a bit commpressible similar to softbodies. + +\param[in] desc The particle buffer descriptor +\param[in] rigidDesc The rigid descriptor +\param[in] cudaContextManager A cuda context manager +\return A fully populated particle rigid buffer ready to use +*/ +PxParticleRigidBuffer* PxCreateAndPopulateParticleRigidBuffer(const ExtGpu::PxParticleBufferDesc& desc, const ExtGpu::PxParticleRigidDesc& rigidDesc, + PxCudaContextManager* cudaContextManager); + +} // namespace ExtGpu + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxPrismaticJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxPrismaticJoint.h new file mode 100644 index 0000000..d34c190 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxPrismaticJoint.h @@ -0,0 +1,243 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PRISMATIC_JOINT_H +#define PX_PRISMATIC_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPrismaticJoint; + +/** +\brief Create a prismatic joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxPrismaticJoint +*/ +PxPrismaticJoint* PxPrismaticJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief Flags specific to the prismatic joint. + +@see PxPrismaticJoint +*/ +struct PxPrismaticJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<1 + }; +}; + +typedef PxFlags PxPrismaticJointFlags; +PX_FLAGS_OPERATORS(PxPrismaticJointFlag::Enum, PxU16) + +/** + \brief A prismatic joint permits relative translational movement between two bodies along + an axis, but no relative rotational movement. + + the axis on each body is defined as the line containing the origin of the joint frame and + extending along the x-axis of that frame + + \image html prismJoint.png + + @see PxPrismaticJointCreate() PxJoint +*/ +class PxPrismaticJoint : public PxJoint +{ +public: + + /** + \brief returns the displacement of the joint along its axis. + */ + virtual PxReal getPosition() const = 0; + + /** + \brief returns the velocity of the joint along its axis + */ + virtual PxReal getVelocity() const = 0; + + /** + \brief sets the joint limit parameters. + + The limit range is [-PX_MAX_F32, PX_MAX_F32], but note that the width of the limit (upper-lower) must also be + a valid float. + + @see PxJointLinearLimitPair getLimit() + */ + virtual void setLimit(const PxJointLinearLimitPair&) = 0; + + /** + \brief gets the joint limit parameters. + + @see PxJointLinearLimit getLimit() + */ + virtual PxJointLinearLimitPair getLimit() const = 0; + + /** + \brief Set the flags specific to the Prismatic Joint. + + Default PxPrismaticJointFlags(0) + + \param[in] flags The joint flags. + + @see PxPrismaticJointFlag setFlag() getFlags() + */ + virtual void setPrismaticJointFlags(PxPrismaticJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Prismatic Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value The value to which to set the flag + + @see PxPrismaticJointFlag, getFlags() setFlags() + */ + virtual void setPrismaticJointFlag(PxPrismaticJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Prismatic Joint. + + \return the joint flags + + @see PxPrismaticJoint::flags, PxPrismaticJointFlag setFlag() setFlags() + */ + virtual PxPrismaticJointFlags getPrismaticJointFlags() const = 0; + + /** + \brief Set the linear tolerance threshold for projection. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + This value must be nonnegative. + + Range: [0, PX_MAX_F32)
+ Default: 1e10f + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionLinearTolerance(PxReal tolerance) = 0; + + /** + \brief Get the linear tolerance threshold for projection. + + \return the linear tolerance threshold in radians + + @see setProjectionLinearTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionLinearTolerance() const = 0; + + /** + \brief Set the angular tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + is set for the joint. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0, PX_MAX_F32)
+ Default: Pi + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionAngularTolerance(PxReal tolerance) = 0; + + /** + \brief Get the angular tolerance threshold for projection. + + @see getProjectionAngularTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionAngularTolerance() const = 0; + + /** + \brief Returns string name of PxPrismaticJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxPrismaticJoint"; } + +protected: + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxPrismaticJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxPrismaticJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxPrismaticJoint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRackAndPinionJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRackAndPinionJoint.h new file mode 100644 index 0000000..953ff04 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRackAndPinionJoint.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RACK_AND_PINION_JOINT_H +#define PX_RACK_AND_PINION_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxRackAndPinionJoint; + + /** + \brief Create a rack & pinion Joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + + @see PxRackAndPinionJoint + */ + PxRackAndPinionJoint* PxRackAndPinionJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + /** + \brief A joint that connects an existing revolute joint to an existing prismatic joint, + and constrains their relative angular/linear velocity and position with respect to each other. + + @see PxRackAndPinionJointCreate PxJoint + */ + class PxRackAndPinionJoint : public PxJoint + { + public: + + /** + \brief Set the hinge & prismatic joints connected by the rack & pinion joint. + + The passed hinge joint can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. It cannot be null. + The passed prismatic joint can be either PxPrismaticJoint or PxD6Joint. It cannot be null. + + Note that these joints are only used to compute the positional error correction term, + used to adjust potential drift between jointed actors. The rack & pinion joint can run without + calling this function, but in that case some visible overlap may develop over time between + the teeth of the rack & pinion meshes. + + \note Calling this function resets the internal positional error correction term. + + \param[in] hinge The hinge joint (pinion) + \param[in] prismatic The prismatic joint (rack) + \return true if success + */ + virtual bool setJoints(const PxBase* hinge, const PxBase* prismatic) = 0; + + /** + \brief Set the desired ratio directly. + + \note You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + + \note Calling this function resets the internal positional error correction term. + + \param[in] ratio Desired ratio between the hinge and the prismatic. + */ + virtual void setRatio(float ratio) = 0; + + /** + \brief Get the ratio. + + \return Current ratio + */ + virtual float getRatio() const = 0; + + /** + \brief Set the desired ratio indirectly. + + This is a simple helper function that computes the ratio from passed data: + + ratio = (PI*2*nbRackTeeth)/(rackLength*nbPinionTeeth) + + \note Calling this function resets the internal positional error correction term. + + \param[in] nbRackTeeth Number of teeth on the rack (cannot be zero) + \param[in] nbPinionTeeth Number of teeth on the pinion (cannot be zero) + \param[in] rackLength Length of the rack + \return true if success + */ + virtual bool setData(PxU32 nbRackTeeth, PxU32 nbPinionTeeth, float rackLength) = 0; + + virtual const char* getConcreteTypeName() const { return "PxRackAndPinionJoint"; } + + protected: + + PX_INLINE PxRackAndPinionJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + PX_INLINE PxRackAndPinionJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRackAndPinionJoint", name) || PxJoint::isKindOf(name); } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRaycastCCD.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRaycastCCD.h new file mode 100644 index 0000000..4e92e19 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRaycastCCD.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RAYCAST_CCD_H +#define PX_RAYCAST_CCD_H +/** \addtogroup extensions +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxScene; + class PxShape; + class PxRigidDynamic; + class RaycastCCDManagerInternal; + + /** + \brief Raycast-CCD manager. + + Raycast-CCD is a simple and potentially cheaper alternative to the SDK's built-in continuous collision detection algorithm. + + This implementation has some limitations: + - it is only implemented for PxRigidDynamic objects (not for PxArticulationLink) + - it is only implemented for simple actors with 1 shape (not for "compounds") + + Also, since it is raycast-based, the solution is not perfect. In particular: + - small dynamic objects can still go through the static world if the ray goes through a crack between edges, or a small + hole in the world (like the keyhole from a door). + - dynamic-vs-dynamic CCD is very approximate. It only works well for fast-moving dynamic objects colliding against + slow-moving dynamic objects. + + Finally, since it is using the SDK's scene queries under the hood, it only works provided the simulation shapes also have + scene-query shapes associated with them. That is, if the objects in the scene only use PxShapeFlag::eSIMULATION_SHAPE + (and no PxShapeFlag::eSCENE_QUERY_SHAPE), then the raycast-CCD system will not work. + */ + class RaycastCCDManager + { + public: + RaycastCCDManager(PxScene* scene); + ~RaycastCCDManager(); + + /** + \brief Register dynamic object for raycast CCD. + + \param[in] actor object's actor + \param[in] shape object's shape + + \return True if success + */ + bool registerRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + + /** + \brief Unregister dynamic object for raycast CCD. + + \param[in] actor object's actor + \param[in] shape object's shape + + \return True if success + */ + bool unregisterRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + + /** + \brief Perform raycast CCD. Call this after your simulate/fetchResults calls. + + \param[in] doDynamicDynamicCCD True to enable dynamic-vs-dynamic CCD (more expensive, not always needed) + */ + void doRaycastCCD(bool doDynamicDynamicCCD); + + private: + RaycastCCDManagerInternal* mImpl; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRemeshingExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRemeshingExt.h new file mode 100644 index 0000000..556a859 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRemeshingExt.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REMESHING_EXT_H +#define PX_REMESHING_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Provides methods to adjust the tessellation of meshes + */ + class PxRemeshingExt + { + public: + /** + \brief Processes a triangle mesh and makes sure that no triangle edge is longer than the maximal edge length specified + + To shorten edges that are too long, additional points get inserted at their center leading to a subdivision of the input mesh. + This process is executed repeatedly until the maximum edge length criterion is satisfied + + \param[in,out] triangles The triangles of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in,out] points The vertices of the mesh where a maximum edge length should be enforced. They will be modified in place during the process. + \param[in] maxEdgeLength The maximum edge length allowed after processing the input + \param[in] maxIterations The maximum number of subdivision iterations + \param[out] triangleMap An optional map that provides the index of the original triangle for every triangle after the subdivision + \param[in] triangleCountThreshold Optional limit to the number of triangles. Not guaranteed to match exactly, the algorithm will just stop as soon as possible after reaching the limit. + + \return True if any remeshing was applied + */ + static bool limitMaxEdgeLength(PxArray& triangles, PxArray& points, PxReal maxEdgeLength, + PxU32 maxIterations = 100, PxArray* triangleMap = NULL, PxU32 triangleCountThreshold = 0xFFFFFFFF); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSerializer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSerializer.h new file mode 100644 index 0000000..92f8211 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSerializer.h @@ -0,0 +1,149 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REPX_SERIALIZER_H +#define PX_REPX_SERIALIZER_H +/** \addtogroup Serializers + @{ +*/ + +#include "common/PxBase.h" +#include "extensions/PxRepXSimpleType.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class XmlMemoryAllocator; + class XmlWriter; + class XmlReader; + class MemoryBuffer; + + /** + \brief Serializer interface for RepX (Xml) serialization. + + In order to serialize a class to RepX both a PxSerializer and + a PxRepXSerializer implementation are needed. + + A repx Serializer provides the ability to capture a live + object to a descriptor or static state and the ability to + write that state out to a file. Objects allocated + by the Serializer using the allocator are freed when the + collection itself is freed. + SnRepXCoreSerializers.cpp implements a set of Serializers + for the core PhysX types. + + \note Implementing a PxRepXSerializer is currently not practical without including the internal PhysXExtension header "SnRepXSerializerImpl.h". + + @see PxSerializer, PX_NEW_REPX_SERIALIZER, PxSerializationRegistry::registerRepXSerializer + */ + class PxRepXSerializer + { + protected: + virtual ~PxRepXSerializer(){} + public: + + /** + \brief The type this Serializer is meant to operate on. + @see PxRepXObject::typeName + */ + virtual const char* getTypeName() = 0; + + /** + \brief Convert from a RepX object to a key-value pair hierarchy + + \param[in] inLiveObject The object to convert to the passed in descriptor. + \param[in] inCollection The collection to use to find ids of references of this object. + \param[in] inWriter Interface to write data to. + \param[in] inTempBuffer used to for temporary allocations. + \param[in] inArgs The arguments used in create resources and objects. + */ + virtual void objectToFile( const PxRepXObject& inLiveObject, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) = 0; + + /** + \brief Convert from a descriptor to a live object. Must be an object of this Serializer type. + + \param[in] inReader The inverse of the writer, a key-value pair database. + \param[in] inAllocator An allocator to use for temporary allocations. These will be freed after instantiation completes. + \param[in] inArgs The arguments used in create resources and objects. + \param[in] inCollection The collection used to find references. + + \return The new live object. It can be an invalid object if the instantiation cannot take place. + */ + virtual PxRepXObject fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) = 0; + + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Inline helper template function to create PxRepXObject from TDataType type supporting PxTypeInfo::name. +*/ +template +PX_INLINE physx::PxRepXObject PxCreateRepXObject(const TDataType* inType, const physx::PxSerialObjectId inId) +{ + return physx::PxRepXObject(physx::PxTypeInfo::name(), inType, inId); +} + +/** +\brief Inline helper function to create PxRepXObject from a PxBase instance. +*/ +PX_INLINE physx::PxRepXObject PxCreateRepXObject(const physx::PxBase* inType, const physx::PxSerialObjectId inId) +{ + PX_ASSERT(inType); + return physx::PxRepXObject(inType->getConcreteTypeName(), inType, inId); +} + +/** +\brief Inline helper template function to create PxRepXObject form TDataType type using inType pointer as a PxSerialObjectId id. +*/ +template +PX_INLINE physx::PxRepXObject PxCreateRepXObject(const TDataType* inType) +{ + return PxCreateRepXObject(inType, static_cast(size_t(inType))); +} + +/** +\brief Preprocessor macro for RepX serializer creation. +*/ +#define PX_NEW_REPX_SERIALIZER(T) \ + *PX_PLACEMENT_NEW(PxGetAllocatorCallback()->allocate(sizeof(T), "PxRepXSerializer", __FILE__, __LINE__ ), T)(*PxGetAllocatorCallback()) + +/** +\brief Preprocessor Macro to simplify RepX serializer delete. +*/ +#define PX_DELETE_REPX_SERIALIZER(x) \ + { PxRepXSerializer* s = x; if (s) { PxGetAllocatorCallback()->deallocate(s); } } + + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSimpleType.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSimpleType.h new file mode 100644 index 0000000..0eee599 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRepXSimpleType.h @@ -0,0 +1,103 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REPX_SIMPLE_TYPE_H +#define PX_REPX_SIMPLE_TYPE_H + +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "cooking/PxCooking.h" +#include "common/PxStringTable.h" +#include "common/PxSerialFramework.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Helper class containing the mapping of id to object, and type name. + */ + struct PxRepXObject + { + /** + \brief Identifies the extension meant to handle this object. + @see PxTypeInfo, PX_DEFINE_TYPEINFO, PxRepXSerializer + */ + const char* typeName; + + /** + \brief Pointer to the serializable this was created from + */ + const void* serializable; + + /** + \brief Id given to this object at some point + */ + PxSerialObjectId id; + PxRepXObject( const char* inTypeName = "", const void* inSerializable = NULL, const PxSerialObjectId inId = 0 ) + : typeName( inTypeName ) + , serializable( inSerializable ) + , id( inId ) + { + } + bool isValid() const { return serializable != NULL; } + }; + + /** + \brief Arguments required to instantiate a serializable object from RepX. + + Extra arguments can be added to the object map under special ids. + + @see PxRepXSerializer::objectToFile, PxRepXSerializer::fileToObject + */ + struct PxRepXInstantiationArgs + { + PxPhysics& physics; + PxCooking* cooker; + PxStringTable* stringTable; + PxRepXInstantiationArgs( PxPhysics& inPhysics, PxCooking* inCooking = NULL , PxStringTable* inStringTable = NULL ) + : physics( inPhysics ) + , cooker( inCooking ) + , stringTable( inStringTable ) + { + } + + PxRepXInstantiationArgs& operator=(const PxRepXInstantiationArgs&); + }; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRevoluteJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRevoluteJoint.h new file mode 100644 index 0000000..55bed4f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRevoluteJoint.h @@ -0,0 +1,337 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REVOLUTE_JOINT_H +#define PX_REVOLUTE_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxRevoluteJoint; + +/** +\brief Create a revolute joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxRevoluteJoint +*/ +PxRevoluteJoint* PxRevoluteJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + +/** +\brief Flags specific to the Revolute Joint. + +@see PxRevoluteJoint +*/ +struct PxRevoluteJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<0, //!< enable the limit + eDRIVE_ENABLED = 1<<1, //!< enable the drive + eDRIVE_FREESPIN = 1<<2 //!< if the existing velocity is beyond the drive velocity, do not add force + }; +}; + +typedef PxFlags PxRevoluteJointFlags; +PX_FLAGS_OPERATORS(PxRevoluteJointFlag::Enum, PxU16) + +/** + +\brief A joint which behaves in a similar way to a hinge or axle. + + A hinge joint removes all but a single rotational degree of freedom from two objects. + The axis along which the two bodies may rotate is specified with a point and a direction + vector. + + The position of the hinge on each body is specified by the origin of the body's joint frame. + The axis of the hinge is specified as the direction of the x-axis in the body's joint frame. + + \image html revoluteJoint.png + + A revolute joint can be given a motor, so that it can apply a force to rotate the attached actors. + It may also be given a limit, to restrict the revolute motion to within a certain range. In + addition, the bodies may be projected together if the distance or angle between them exceeds + a given threshold. + + Projection, drive and limits are activated by setting the appropriate flags on the joint. + + @see PxRevoluteJointCreate() PxJoint +*/ +class PxRevoluteJoint : public PxJoint +{ +public: + + /** + \brief return the angle of the joint, in the range (-2*Pi, 2*Pi] + */ + virtual PxReal getAngle() const = 0; + + /** + \brief return the velocity of the joint + */ + virtual PxReal getVelocity() const = 0; + + /** + \brief set the joint limit parameters. + + The limit is activated using the flag PxRevoluteJointFlag::eLIMIT_ENABLED + + The limit angle range is (-2*Pi, 2*Pi). + + \param[in] limits The joint limit parameters. + + @see PxJointAngularLimitPair getLimit() + */ + virtual void setLimit(const PxJointAngularLimitPair& limits) = 0; + + /** + \brief get the joint limit parameters. + + \return the joint limit parameters + + @see PxJointAngularLimitPair setLimit() + */ + virtual PxJointAngularLimitPair getLimit() const = 0; + + /** + \brief set the target velocity for the drive model. + + The motor will only be able to reach this velocity if the maxForce is sufficiently large. + If the joint is spinning faster than this velocity, the motor will actually try to brake + (see PxRevoluteJointFlag::eDRIVE_FREESPIN.) + + The sign of this variable determines the rotation direction, with positive values going + the same way as positive joint angles. Setting a very large target velocity may cause + undesirable results. + + \param[in] velocity the drive target velocity + \param[in] autowake Whether to wake up the joint rigids if they are asleep. + + Range: (-PX_MAX_F32, PX_MAX_F32)
+ Default: 0.0 + + @see PxRevoluteFlags::eDRIVE_FREESPIN + */ + virtual void setDriveVelocity(PxReal velocity, bool autowake = true) = 0; + + /** + \brief gets the target velocity for the drive model. + + \return the drive target velocity + + @see setDriveVelocity() + */ + virtual PxReal getDriveVelocity() const = 0; + + /** + \brief sets the maximum torque the drive can exert. + + The value set here may be used either as an impulse limit or a force limit, depending on the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + + Range: [0, PX_MAX_F32)
+ Default: PX_MAX_F32 + + @see setDriveVelocity() + */ + virtual void setDriveForceLimit(PxReal limit) = 0; + + /** + \brief gets the maximum torque the drive can exert. + + \return the torque limit + + @see setDriveVelocity() + */ + virtual PxReal getDriveForceLimit() const = 0; + + /** + \brief sets the gear ratio for the drive. + + When setting up the drive constraint, the velocity of the first actor is scaled by this value, and its response to drive torque is scaled down. + So if the drive target velocity is zero, the second actor will be driven to the velocity of the first scaled by the gear ratio + + Range: [0, PX_MAX_F32)
+ Default: 1.0 + + \param[in] ratio the drive gear ratio + + @see getDriveGearRatio() + */ + virtual void setDriveGearRatio(PxReal ratio) = 0; + + /** + \brief gets the gear ratio. + + \return the drive gear ratio + + @see setDriveGearRatio() + */ + virtual PxReal getDriveGearRatio() const = 0; + + /** + \brief sets the flags specific to the Revolute Joint. + + Default PxRevoluteJointFlags(0) + + \param[in] flags The joint flags. + + @see PxRevoluteJointFlag setFlag() getFlags() + */ + virtual void setRevoluteJointFlags(PxRevoluteJointFlags flags) = 0; + + /** + \brief sets a single flag specific to a Revolute Joint. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + @see PxRevoluteJointFlag, getFlags() setFlags() + */ + virtual void setRevoluteJointFlag(PxRevoluteJointFlag::Enum flag, bool value) = 0; + + /** + \brief gets the flags specific to the Revolute Joint. + + \return the joint flags + + @see PxRevoluteJoint::flags, PxRevoluteJointFlag setFlag() setFlags() + */ + virtual PxRevoluteJointFlags getRevoluteJointFlags() const = 0; + + /** + \brief Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + is set for the joint. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0, PX_MAX_F32)
+ Default: 1e10f + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() PxConstraintFlag::ePROJECTION + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionLinearTolerance(PxReal tolerance) = 0; + + /** + \brief Get the linear tolerance threshold for projection. + + \return the linear tolerance threshold + + @see setProjectionLinearTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionLinearTolerance() const = 0; + + /** + \brief Set the angular tolerance threshold for projection. Projection is enabled if + PxConstraintFlag::ePROJECTION is set for the joint. + + If the joint deviates by more than this angle around its locked angular degrees of freedom, + the solver will move the bodies to close the angle. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0,Pi]
+ Default: Pi + + \param[in] tolerance the angular tolerance threshold in radians + + @see getProjectionAngularTolerance() PxJoint::setConstraintFlag() PxConstraintFlag::ePROJECTION + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionAngularTolerance(PxReal tolerance) = 0; + + /** + \brief gets the angular tolerance threshold for projection. + + \return the angular tolerance threshold in radians + + @see setProjectionAngularTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionAngularTolerance() const = 0; + + /** + \brief Returns string name of PxRevoluteJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxRevoluteJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxRevoluteJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxRevoluteJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxRevoluteJoint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidActorExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidActorExt.h new file mode 100644 index 0000000..ddc0805 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidActorExt.h @@ -0,0 +1,177 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_ACTOR_EXT_H +#define PX_RIGID_ACTOR_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "PxPhysics.h" +#include "PxRigidActor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBVH; +class PxCooking; + +/** +\brief utility functions for use with PxRigidActor and subclasses + +@see PxRigidActor PxRigidStatic PxRigidBody PxRigidDynamic PxArticulationLink +*/ + +class PxRigidActorExt +{ +public: + + /** + \brief Creates a new shape with default properties and a list of materials and adds it to the list of shapes of this actor. + + This is equivalent to the following + + ```cpp + // reference count is 1 + PxShape* shape(...) = PxGetPhysics().createShape(...); + // increments reference count + actor->attachShape(shape); + // releases user reference, leaving reference count at 1 + shape->release(); + ``` + + As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + + \note The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see #PxShapeFlag). + Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + non-kinematic PxRigidDynamic instances. + + \note Creating compounds with a very large number of shapes may adversely affect performance and stability. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] actor the actor to which to attach the shape + \param[in] geometry the geometry of the shape + \param[in] materials a pointer to an array of material pointers + \param[in] materialCount the count of materials + \param[in] shapeFlags optional PxShapeFlags + + \return The newly created shape. + + @see PxShape PxShape::release(), PxPhysics::createShape(), PxRigidActor::attachShape() + */ + static PxShape* createExclusiveShape(PxRigidActor& actor, const PxGeometry& geometry, PxMaterial*const* materials, PxU16 materialCount, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxShape* shape = PxGetPhysics().createShape(geometry, materials, materialCount, true, shapeFlags); + if(shape) + { + bool status = actor.attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor + shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly + if(!status) + shape = NULL; + } + return shape; + } + + /** + \brief Creates a new shape with default properties and a single material adds it to the list of shapes of this actor. + + This is equivalent to the following + + ```cpp + // reference count is 1 + PxShape* shape(...) = PxGetPhysics().createShape(...); + // increments reference count + actor->attachShape(shape); + // releases user reference, leaving reference count at 1 + shape->release(); + ``` + + As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + + \note The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see #PxShapeFlag). + Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + non-kinematic PxRigidDynamic instances. + + \note Creating compounds with a very large number of shapes may adversely affect performance and stability. + + Sleeping: Does NOT wake the actor up automatically. + + \param[in] actor the actor to which to attach the shape + \param[in] geometry the geometry of the shape + \param[in] material the material for the shape + \param[in] shapeFlags optional PxShapeFlags + + \return The newly created shape. + + @see PxShape PxShape::release(), PxPhysics::createShape(), PxRigidActor::attachShape() + */ + static PX_FORCE_INLINE PxShape* createExclusiveShape(PxRigidActor& actor, const PxGeometry& geometry, const PxMaterial& material, + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) + { + PxMaterial* materialPtr = const_cast(&material); + return createExclusiveShape(actor, geometry, &materialPtr, 1, shapeFlags); + } + + /** + \brief Gets a list of bounds based on shapes in rigid actor. This list can be used to cook/create + bounding volume hierarchy though PxCooking API. + + \param[in] actor The actor from which the bounds list is retrieved. + \param[out] numBounds Number of bounds in returned list. + + @see PxShape PxBVH PxCooking::createBVH PxCooking::cookBVH + */ + static PxBounds3* getRigidActorShapeLocalBoundsList(const PxRigidActor& actor, PxU32& numBounds); + + /** + \brief Convenience function to create a PxBVH object from a PxRigidActor. + + The computed PxBVH can then be used in PxScene::addActor() or PxAggregate::addActor(). + After adding the actor & BVH to the scene/aggregate, release the PxBVH object by calling PxBVH::release(). + + \param[in] physics The physics object. The function will retrieve the insertion callback from it. + \param[in] actor The actor to compute a PxBVH for. + + \return The PxBVH for this actor. + + @see PxBVH PxScene::addActor PxAggregate::addActor + */ + static PxBVH* createBVHFromActor(PxPhysics& physics, const PxRigidActor& actor); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidBodyExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidBodyExt.h new file mode 100644 index 0000000..2988016 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxRigidBodyExt.h @@ -0,0 +1,448 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_RIGID_BODY_EXT_H +#define PX_RIGID_BODY_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "PxRigidBody.h" +#include "PxQueryReport.h" +#include "PxQueryFiltering.h" +#include "extensions/PxMassProperties.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxScene; +struct PxQueryCache; +class PxShape; + +/** +\brief utility functions for use with PxRigidBody and subclasses + +@see PxRigidBody PxRigidDynamic PxArticulationLink +*/ + +class PxRigidBodyExt +{ +public: + /** + \brief Computation of mass properties for a rigid body actor + + To simulate a dynamic rigid actor, the SDK needs a mass and an inertia tensor. + + This method offers functionality to compute the necessary mass and inertia properties based on the shapes declared in + the PxRigidBody descriptor and some additionally specified parameters. For each shape, the shape geometry, + the shape positioning within the actor and the specified shape density are used to compute the body's mass and + inertia properties. + +
    +
  • Shapes without PxShapeFlag::eSIMULATION_SHAPE set are ignored unless includeNonSimShapes is true.
  • +
  • Shapes with plane, triangle mesh or heightfield geometry and PxShapeFlag::eSIMULATION_SHAPE set are not allowed for PxRigidBody collision.
  • +
+ + This method will set the mass, center of mass, and inertia tensor + + if no collision shapes are found, the inertia tensor is set to (1,1,1) and the mass to 1 + + if massLocalPose is non-NULL, the rigid body's center of mass parameter will be set + to the user provided value (massLocalPose) and the inertia tensor will be resolved at that point. + + \note If all shapes of the actor have the same density then the overloaded method updateMassAndInertia() with a single density parameter can be used instead. + + \param[in,out] body The rigid body. + \param[in] shapeDensities The per shape densities. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set (or for all shapes if includeNonSimShapes is set to true). Other shapes are ignored. The density values must be greater than 0. + \param[in] shapeDensityCount The number of provided density values. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + @see PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool updateMassAndInertia(PxRigidBody& body, const PxReal* shapeDensities, PxU32 shapeDensityCount, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + See previous method for details. + + \param[in,out] body The rigid body. + \param[in] density The density of the body. Used to compute the mass of the body. The density must be greater than 0. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + @see PxRigidBody::setMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool updateMassAndInertia(PxRigidBody& body, PxReal density, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the sum of all user-supplied + shape mass values, and the inertia and center of mass are computed according to the rigid body's shapes and the per shape mass input values. + + If no collision shapes are found, the inertia tensor is set to (1,1,1) + + \note If a single mass value should be used for the actor as a whole then the overloaded method setMassAndUpdateInertia() with a single mass parameter can be used instead. + + @see updateMassAndInertia for more details. + + \param[in,out] body The rigid body for which to set the mass and centre of mass local pose properties. + \param[in] shapeMasses The per shape mass values. There must be one entry for each shape which has the PxShapeFlag::eSIMULATION_SHAPE set. Other shapes are ignored. The mass values must be greater than 0. + \param[in] shapeMassCount The number of provided mass values. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + @see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool setMassAndUpdateInertia(PxRigidBody& body, const PxReal* shapeMasses, PxU32 shapeMassCount, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Computation of mass properties for a rigid body actor + + This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied + value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass. + + If no collision shapes are found, the inertia tensor is set to (1,1,1) + + @see updateMassAndInertia for more details. + + \param[in,out] body The rigid body for which to set the mass and centre of mass local pose properties. + \param[in] mass The mass of the body. Must be greater than 0. + \param[in] massLocalPose The center of mass relative to the actor frame. If set to null then (0,0,0) is assumed. + \param[in] includeNonSimShapes True if all kind of shapes (PxShapeFlag::eSCENE_QUERY_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) should be taken into account. + \return Boolean. True on success else false. + + @see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static bool setMassAndUpdateInertia(PxRigidBody& body, PxReal mass, const PxVec3* massLocalPose = NULL, bool includeNonSimShapes = false); + + /** + \brief Compute the mass, inertia tensor and center of mass from a list of shapes. + + \param[in] shapes The shapes to compute the mass properties from. + \param[in] shapeCount The number of provided shapes. + \return The mass properties from the combined shapes. + + @see PxRigidBody::setCMassLocalPose PxRigidBody::setMassSpaceInertiaTensor PxRigidBody::setMass + */ + static PxMassProperties computeMassPropertiesFromShapes(const PxShape* const* shapes, PxU32 shapeCount); + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + point in global coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, + you can maintain a total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the global frame. Range: force vector + \param[in] pos Position in the global frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + @see PxForceMode + @see addForceAtLocalPos() addLocalForceAtPos() addLocalForceAtLocalPos() + */ + static void addForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + point in local coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the global frame. Range: force vector + \param[in] pos Position in the local frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + @see PxForceMode + @see addForceAtPos() addLocalForceAtPos() addLocalForceAtLocalPos() + */ + static void addForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + particular point in global coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the local frame. Range: force vector + \param[in] pos Position in the global frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + @see PxForceMode + @see addForceAtPos() addForceAtLocalPos() addLocalForceAtLocalPos() + */ + static void addLocalForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + particular point in local coordinates, to the actor. + + Note that if the force does not act along the center of mass of the actor, this + will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + total external force on an object by calling this once every frame. + + \note if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + articulation + + ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + given point. + + Sleeping: This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + + \param[in] body The rigid body to apply the force to. + \param[in] force Force/impulse to add, defined in the local frame. Range: force vector + \param[in] pos Position in the local frame to add the force at. Range: position vector + \param[in] mode The mode to use when applying the force/impulse(see #PxForceMode). + \param[in] wakeup Specify if the call should wake up the actor. + + @see PxForceMode + @see addForceAtPos() addForceAtLocalPos() addLocalForceAtPos() + */ + static void addLocalForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode = PxForceMode::eFORCE, bool wakeup = true); + + /** + \brief Computes the velocity of a point given in world coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position we wish to determine the velocity for, defined in the global frame. Range: position vector + \return The velocity of point in the global frame. + + @see getLocalPointVelocity() + */ + static PxVec3 getVelocityAtPos(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Computes the velocity of a point given in local coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position we wish to determine the velocity for, defined in the local frame. Range: position vector + \return The velocity of point in the local frame. + + @see getLocalPointVelocity() + */ + static PxVec3 getLocalVelocityAtLocalPos(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the + specified body and moving with it. + + \param[in] body The rigid body the point is attached to. + \param[in] pos Position (offset from the origin of the body) we wish to determine the velocity for, defined in the global frame. Range: position vector + \return The velocity of point (offset from the origin of the body) in the global frame. + + @see getLocalPointVelocity() + */ + static PxVec3 getVelocityAtOffset(const PxRigidBody& body, const PxVec3& pos); + + /** + \brief Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body. + + The rigid body is left unaffected unless a subsequent independent call is executed that actually applies the computed changes to velocity and angular velocity. + + \note if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + + @see PxRigidBody::getLinearVelocity, PxRigidBody::setLinearVelocity, PxRigidBody::getAngularVelocity, PxRigidBody::setAngularVelocity + + \param[in] body The body under consideration. + \param[in] impulsiveForce The impulsive force that would be applied to the specified rigid body. + \param[in] impulsiveTorque The impulsive torque that would be applied to the specified rigid body. + \param[out] deltaLinearVelocity The change in linear velocity that would arise if impulsiveForce was to be applied to the specified rigid body. + \param[out] deltaAngularVelocity The change in angular velocity that would arise if impulsiveTorque was to be applied to the specified rigid body. + */ + static void computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxVec3& impulsiveForce, const PxVec3& impulsiveTorque, PxVec3& deltaLinearVelocity, PxVec3& deltaAngularVelocity); + + /** + \brief Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account + + This function is useful for extracting the respective linear and angular velocity changes from a contact or joint when the mass/inertia ratios have been adjusted. + + \note if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + + \param[in] body The rigid body + \param[in] globalPose The body's world space transform + \param[in] point The point in world space where the impulse is applied + \param[in] impulse The impulse vector in world space + \param[in] invMassScale The inverse mass scale + \param[in] invInertiaScale The inverse inertia scale + \param[out] deltaLinearVelocity The linear velocity change + \param[out] deltaAngularVelocity The angular velocity change + */ + static void computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& deltaLinearVelocity, PxVec3& deltaAngularVelocity); + + /** + \brief Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account + + This function is useful for extracting the respective linear and angular impulses from a contact or joint when the mass/inertia ratios have been adjusted. + + \param[in] body The rigid body + \param[in] globalPose The body's world space transform + \param[in] point The point in world space where the impulse is applied + \param[in] impulse The impulse vector in world space + \param[in] invMassScale The inverse mass scale + \param[in] invInertiaScale The inverse inertia scale + \param[out] linearImpulse The linear impulse + \param[out] angularImpulse The angular impulse + */ + static void computeLinearAngularImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& linearImpulse, PxVec3& angularImpulse); + + /** + \brief Performs a linear sweep through space with the body's geometry objects. + + \note Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + \note If eTOUCH is returned from the filter callback, it will trigger an error and the hit will be discarded. + + The function sweeps all shapes attached to a given rigid body through space and reports the nearest + object in the scene which intersects any of of the shapes swept paths. + Information about the closest intersection is written to a #PxSweepHit structure. + + \param[in] body The rigid body to sweep. + \param[in] scene The scene object to process the query. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] closestHit Closest hit result. + \param[out] shapeIndex Index of the body shape that caused the closest hit. + \param[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, + otherwise shape->getQueryFilterData() will be used instead. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + + \return True if a blocking hit was found. + + @see PxScene PxQueryFlags PxFilterData PxSweepHit + */ + static bool linearSweepSingle( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, + PxHitFlags outputFlags, + PxSweepHit& closestHit, PxU32& shapeIndex, + const PxQueryFilterData& filterData = PxQueryFilterData(), + PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, + const PxReal inflation=0.0f); + + /** + \brief Performs a linear sweep through space with the body's geometry objects, returning all overlaps. + + \note Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + + This function sweeps all shapes attached to a given rigid body through space and reports all + objects in the scene that intersect any of the shapes' swept paths until there are no more objects to report + or a blocking hit is encountered. + + \param[in] body The rigid body to sweep. + \param[in] scene The scene object to process the query. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] touchHitBuffer Raycast hit information buffer. If the buffer overflows, an arbitrary subset of touch hits + is returned (typically the query should be restarted with a larger buffer). + \param[out] touchHitShapeIndices After the query is completed, touchHitShapeIndices[i] will contain the body index that caused the hit stored in hitBuffer[i] + \param[in] touchHitBufferSize Size of both touch hit buffers in elements. + \param[out] block Closest blocking hit is returned via this reference. + \param[out] blockingShapeIndex Set to -1 if if a blocking hit was not found, otherwise set to closest blocking hit shape index. The touching hits are reported separately in hitBuffer. + \param[out] overflow Set to true if touchHitBuffer didn't have enough space for all results. Touch hits will be incomplete if overflow occurred. Possible solution is to restart the query with a larger buffer. + \param[in] filterData If any word in filterData.data is non-zero then filterData.data will be used for filtering, + otherwise shape->getQueryFilterData() will be used instead. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxQueryFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + + \return the number of touching hits. If overflow is set to true, the results are incomplete. In case of overflow there are also no guarantees that all touching hits returned are closer than the blocking hit. + + @see PxScene PxQueryFlags PxFilterData PxSweepHit + */ + static PxU32 linearSweepMultiple( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, + PxHitFlags outputFlags, + PxSweepHit* touchHitBuffer, PxU32* touchHitShapeIndices, PxU32 touchHitBufferSize, + PxSweepHit& block, PxI32& blockingShapeIndex, bool& overflow, + const PxQueryFilterData& filterData = PxQueryFilterData(), + PxQueryFilterCallback* filterCall = NULL, + const PxQueryCache* cache = NULL, const PxReal inflation = 0.0f); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSamplingExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSamplingExt.h new file mode 100644 index 0000000..088c4f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSamplingExt.h @@ -0,0 +1,185 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SAMPLING_EXT_H +#define PX_SAMPLING_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxArray.h" +#include "geometry/PxGeometry.h" +#include "foundation/PxUserAllocated.h" +#include "geometry/PxSimpleTriangleMesh.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief utility functions to sample vertices on or inside a triangle mesh or other geometries +*/ +class PxSamplingExt +{ +public: + /** Computes samples on a triangle mesh's surface that are not closer to each other than a given distance. Optionally the mesh's interior can be filled with samples as well. + + \param[in] mesh The triangle mesh + \param[in] r The closest distance two surface samples are allowed to have + \param[out] result Equally distributed samples on and if specified inside the triangle mesh + \param[in] rVolume The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh's surface + \param[out] triangleIds Optional output containing the index of the triangle for all samples on the mesh's surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface. + \param[out] barycentricCoordinates Optional output containing the barycentric coordinates for all samples on the mesh's surface. The array will contain less entries than output vertices if volume samples are active since volume samples are not on the surface. + \param[in] axisAlignedBox A box that limits the space where samples can get created + \param[in] boxOrientation The orientation of the box that limits the space where samples can get created + \param[in] maxNumSamples If larger than zero, the sampler will stop when the sample count reaches maxNumSamples + \param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + static bool poissonSample(const PxSimpleTriangleMesh& mesh, PxReal r, PxArray& result, PxReal rVolume = 0.0f, PxArray* triangleIds = NULL, PxArray* barycentricCoordinates = NULL, + const PxBounds3* axisAlignedBox = NULL, const PxQuat* boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30); + + /** Computes samples on a geometry's surface that are not closer to each other than a given distance. + + \param[in] geometry The geometry that defines the surface on which the samples get created + \param[in] transform The geometry's global pose + \param[in] worldBounds The geometry's bounding box + \param[in] r The closest distance two surface samples are allowed to have + \param[out] result Equally distributed samples on and if specified inside the triangle mesh + \param[in] rVolume The average distance of samples inside the mesh. If set to zero, samples will only be placed on the mesh's surface + \param[in] axisAlignedBox A box that limits the space where samples can get created + \param[in] boxOrientation The orientation of the box that limits the space where samples can get created + \param[in] maxNumSamples If larger than zero, the sampler will stop when the sample count reaches maxNumSamples + \param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + static bool poissonSample(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal r, PxArray& result, PxReal rVolume = 0.0f, + const PxBounds3* axisAlignedBox = NULL, const PxQuat* boxOrientation = NULL, PxU32 maxNumSamples = 0, PxU32 numSampleAttemptsAroundPoint = 30); +}; + +/** +\brief Sampler to generate Poisson Samples locally on a triangle mesh or a shape. For every local addition of new samples, an individual sampling density can be used. +*/ +class PxPoissonSampler : public PxUserAllocated +{ +public: + /** Sets the sampling radius + \param[in] samplingRadius The closest distance two surface samples are allowed to have. Changing the sampling radius is a bit an expensive operation. + \return Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + */ + virtual bool setSamplingRadius(PxReal samplingRadius) = 0; + + /** Adds samples + \param[in] samples The samples to add. Adding samples is a bit an expensive operation. + */ + virtual void addSamples(const PxArray& samples) = 0; + + /** Adds samples + \param[in] samples The samples to remove. Removing samples is a bit an expensive operation. + \return Returns the number of removed samples. If some samples were not found, then the number of actually removed samples will be smaller than the number of samples requested to remove + */ + virtual PxU32 removeSamples(const PxArray& samples) = 0; + + /** Adds new Poisson Samples inside the sphere specified + \param[in] sphereCenter The sphere's center. Used to define the region where new samples get added. + \param[in] sphereRadius The sphere's radius. Used to define the region where new samples get added. + \param[in] createVolumeSamples If set to true, samples will also get generated inside of the mesh, not just on its surface. + */ + virtual void addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples = false) = 0; + + /** Adds new Poisson Samples inside the box specified + \param[in] axisAlignedBox The axis aligned bounding box. Used to define the region where new samples get added. + \param[in] boxOrientation The orientation making an oriented bounding box out of the axis aligned one. Used to define the region where new samples get added. + \param[in] createVolumeSamples If set to true, samples will also get generated inside of the mesh, not just on its surface. + */ + virtual void addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples = false) = 0; + + /** Gets the Poisson Samples + \return Returns the generated Poisson Samples + */ + virtual const PxArray& getSamples() const = 0; + + virtual ~PxPoissonSampler() { } +}; + + +/** Creates a shape sampler +\param[in] geometry The shape that defines the surface on which the samples get created +\param[in] transform The shape's global pose +\param[in] worldBounds The shapes bounding box +\param[in] initialSamplingRadius The closest distance two surface samples are allowed to have +\param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. +\return Returns the sampler +*/ +PxPoissonSampler* PxCreateShapeSampler(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal initialSamplingRadius, PxI32 numSampleAttemptsAroundPoint = 30); + + +/** +\brief Sampler to generate Poisson Samples on a triangle mesh. +*/ +class PxTriangleMeshPoissonSampler : public virtual PxPoissonSampler +{ +public: + /** Gets the Poisson Samples' triangle indices + \return Returns the generated Poisson Samples' triangle indices + */ + virtual const PxArray& getSampleTriangleIds() const = 0; + + /** Gets the Poisson Samples' barycentric coordinates + \return Returns the generated Poisson Samples' barycentric coordinates + */ + virtual const PxArray& getSampleBarycentrics() const = 0; + + /** Checks whether a point is inside the triangle mesh + \return Returns true if the point is inside the triangle mesh + */ + virtual bool isPointInTriangleMesh(const PxVec3& p) = 0; + + virtual ~PxTriangleMeshPoissonSampler() { } +}; + + +/** Creates a triangle mesh sampler +\param[in] triangles The triangle indices of the mesh +\param[in] numTriangles The total number of triangles +\param[in] vertices The vertices of the mesh +\param[in] numVertices The total number of vertices +\param[in] initialSamplingRadius The closest distance two surface samples are allowed to have +\param[in] numSampleAttemptsAroundPoint Number of repetitions the underlying algorithm performs to find a new valid sample that matches all criteria like minimal distance to existing samples etc. +\return Returns the sampler +*/ +PxTriangleMeshPoissonSampler* PxCreateTriangleMeshSampler(const PxU32* triangles, PxU32 numTriangles, const PxVec3* vertices, PxU32 numVertices, PxReal initialSamplingRadius, PxI32 numSampleAttemptsAroundPoint = 30); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQueryExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQueryExt.h new file mode 100644 index 0000000..488c094 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQueryExt.h @@ -0,0 +1,496 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_QUERY_EXT_H +#define PX_SCENE_QUERY_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" + +#include "PxScene.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// These types have been deprecated (removed) in PhysX 3.4. We typedef them to the new types here for easy migration from 3.3 to 3.4. +typedef PxQueryHit PxSceneQueryHit; +typedef PxQueryFilterData PxSceneQueryFilterData; +typedef PxQueryFilterCallback PxSceneQueryFilterCallback; +typedef PxQueryCache PxSceneQueryCache; +typedef PxHitFlag PxSceneQueryFlag; +typedef PxHitFlags PxSceneQueryFlags; + +/** +\brief utility functions for use with PxScene, related to scene queries. + +Some of these functions have been deprecated (removed) in PhysX 3.4. We re-implement them here for easy migration from 3.3 to 3.4. + +@see PxShape +*/ + +class PxSceneQueryExt +{ +public: + + /** + \brief Raycast returning any blocking hit, not necessarily the closest. + + Returns whether any rigid actor is hit along the ray. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[out] hit Raycast hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return True if a blocking hit was found. + + @see PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache PxSceneQueryHit + */ + static bool raycastAny( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryHit& hit, const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Raycast returning a single result. + + Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information + \param[out] hit Raycast hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return True if a blocking hit was found. + + @see PxSceneQueryFlags PxRaycastHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static bool raycastSingle( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxRaycastHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Raycast returning multiple results. + + Find all rigid actors that get hit along the ray. Each result contains data as specified by the outputFlags field. + + \note Touching hits are not ordered. + + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] scene The scene + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] outputFlags Specifies which properties should be written to the hit information + \param[out] hitBuffer Raycast hit information buffer. If the buffer overflows, the blocking hit is returned as the last entry together with an arbitrary subset + of the nearer touching hits (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[out] blockingHit True if a blocking hit was found. If found, it is the last in the buffer, preceded by any touching hits which are closer. Otherwise the touching hits are listed. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be touching. + \param[in] cache Cached hit shape (optional). Ray is tested against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + @see PxSceneQueryFlags PxRaycastHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static PxI32 raycastMultiple( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxRaycastHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL); + + /** + \brief Sweep returning any blocking hit, not necessarily the closest. + + Returns whether any rigid actor is hit along the sweep path. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] queryFlags Combination of PxSceneQueryFlag defining the query behavior + \param[out] hit Sweep hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first. If no hit is found the sweep gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return True if a blocking hit was found. + + @see PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryHit PxSceneQueryCache + */ + static bool sweepAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags queryFlags, + PxSceneQueryHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, + const PxSceneQueryCache* cache = NULL, + PxReal inflation = 0.0f); + + /** + \brief Sweep returning a single result. + + Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] hit Sweep hit information. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be blocking. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return True if a blocking hit was found. + + @see PxSceneQueryFlags PxSweepHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static bool sweepSingle(const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxSweepHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, + const PxSceneQueryCache* cache = NULL, + PxReal inflation=0.0f); + + /** + \brief Sweep returning multiple results. + + Find all rigid actors that get hit along the sweep. Each result contains data as specified by the outputFlags field. + + \note Touching hits are not ordered. + + \note If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + + \param[in] scene The scene + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] outputFlags Specifies which properties should be written to the hit information. + \param[out] hitBuffer Sweep hit information buffer. If the buffer overflows, the blocking hit is returned as the last entry together with an arbitrary subset + of the nearer touching hits (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[out] blockingHit True if a blocking hit was found. If found, it is the last in the buffer, preceded by any touching hits which are closer. Otherwise the touching hits are listed. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to be touching. + \param[in] cache Cached hit shape (optional). Sweep is performed against cached shape first then against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + @see PxSceneQueryFlags PxSweepHit PxSceneQueryFilterData PxSceneQueryFilterCallback PxSceneQueryCache + */ + static PxI32 sweepMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxSweepHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL, const PxSceneQueryCache* cache = NULL, + PxReal inflation = 0.0f); + + /** + \brief Test overlap between a geometry and objects in the scene. + + \note Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both get written to the hit buffer. + + \note PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + + \param[in] scene The scene + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[out] hitBuffer Buffer to store the overlapping objects to. If the buffer overflows, an arbitrary subset of overlapping objects is stored (typically the query should be restarted with a larger buffer). + \param[in] hitBufferSize Size of the hit buffer. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to overlap. + \return Number of hits in the buffer, or -1 if the buffer overflowed. + + @see PxSceneQueryFlags PxSceneQueryFilterData PxSceneQueryFilterCallback + */ + static PxI32 overlapMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit* hitBuffer, PxU32 hitBufferSize, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL); + + /** + \brief Test returning, for a given geometry, any overlapping object in the scene. + + \note Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both trigger a hit. + + \note PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + + \param[in] scene The scene + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[out] hit Pointer to store the overlapping object to. + \param[in] filterData Filtering data and simple logic. + \param[in] filterCall Custom filtering logic (optional). Only used if the corresponding #PxHitFlag flags are set. If NULL, all hits are assumed to overlap. + \return True if an overlap was found. + + @see PxSceneQueryFlags PxSceneQueryFilterData PxSceneQueryFilterCallback + */ + static bool overlapAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit& hit, + const PxSceneQueryFilterData& filterData = PxSceneQueryFilterData(), + PxSceneQueryFilterCallback* filterCall = NULL); +}; + +struct PxBatchQueryStatus +{ + enum Enum + { + /** + \brief This is the initial state before a query starts. + */ + ePENDING = 0, + + /** + \brief The query is finished; results have been written into the result and hit buffers. + */ + eSUCCESS, + + /** + \brief The query results were incomplete due to touch hit buffer overflow. Blocking hit is still correct. + */ + eOVERFLOW + }; +}; + +class PxBatchQueryExt +{ +public: + + virtual void release() = 0; + + /** + \brief Performs a raycast against objects in the scene. + + \note Touching hits are not ordered. + \note Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] distance Length of the ray. Needs to be larger than 0. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] hitFlags Specifies which properties per hit should be computed and returned in hit array and blocking hit. + \param[in] filterData Filtering data passed to the filter shader. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxRaycastBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + @see PxCreateBatchQueryExt + + @see PxQueryFilterData PxQueryFilterCallback PxRaycastHit PxScene::raycast + */ + virtual PxRaycastBuffer* raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches = 0, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL) = 0; + + /** + \brief Performs a sweep test against objects in the scene. + + \note Touching hits are not ordered. + \note If a shape from the scene is already overlapping with the query shape in its starting position, + the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + + \param[in] geometry Geometry of object to sweep (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the sweep object. + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Will be clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] hitFlags Specifies which properties per hit should be computed and returned in hit array and blocking hit. + \param[in] filterData Filtering data and simple logic. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + Note: ePRECISE_SWEEP doesn't support inflation. Therefore the sweep will be performed with zero inflation. + + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxSweepBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + @see PxCreateBatchQueryExt + + @see PxHitFlags PxQueryFilterData PxBatchQueryPreFilterShader PxBatchQueryPostFilterShader PxSweepHit + */ + virtual PxSweepBuffer* sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches = 0, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL, + const PxReal inflation = 0.0f) = 0; + + + /** + \brief Performs an overlap test of a given geometry against objects in the scene. + + \note Filtering: returning eBLOCK from user filter for overlap queries will cause a warning (see #PxQueryHitType). + + \param[in] geometry Geometry of object to check for overlap (supported types are: box, sphere, capsule, convex). + \param[in] pose Pose of the object. + \param[in] maxNbTouches Maximum number of hits to record in the touch buffer for this query. Default=0 reports a single blocking hit. If maxTouchHits is set to 0 all hits are treated as blocking by default. + \param[in] filterData Filtering data and simple logic. See #PxQueryFilterData #PxQueryFilterCallback + \param[in] cache Cached hit shape (optional). Query is tested against cached shape first. If no hit is found the ray gets queried against the scene. + Note: Filtering is not executed for a cached shape if supplied; instead, if a hit is found, it is assumed to be a blocking hit. + Note: Using past touching hits as cache will produce incorrect behavior since the cached hit will always be treated as blocking. + + \note eBLOCK should not be returned from user filters for overlap(). Doing so will result in undefined behavior, and a warning will be issued. + \note If the PxQueryFlag::eNO_BLOCK flag is set, the eBLOCK will instead be automatically converted to an eTOUCH and the warning suppressed. + \note This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + and overlapping writes from different threads may result in undefined behavior). + + \return Returns a PxOverlapBuffer pointer that will store the result of the query after execute() is completed. + This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + @see PxCreateBatchQueryExt + + @see PxQueryFilterData PxQueryFilterCallback + */ + virtual PxOverlapBuffer* overlap( + const PxGeometry& geometry, const PxTransform& pose, + PxU16 maxNbTouches = 0, + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL) = 0; + + virtual void execute() = 0; + +protected: + + virtual ~PxBatchQueryExt() {} +}; + +/** +\brief Create a PxBatchQueryExt without the need for pre-allocated result or touch buffers. + +\param[in] scene Queries will be performed against objects in the specified PxScene +\param[in] queryFilterCallback Filtering for all queries is performed using queryFilterCallback. A null pointer results in all shapes being considered. + +\param[in] maxNbRaycasts A result buffer will be allocated that is large enough to accommodate maxNbRaycasts calls to PxBatchQueryExt::raycast() +\param[in] maxNbRaycastTouches A touch buffer will be allocated that is large enough to accommodate maxNbRaycastTouches touches for all raycasts in the batch. + +\param[in] maxNbSweeps A result buffer will be allocated that is large enough to accommodate maxNbSweeps calls to PxBatchQueryExt::sweep() +\param[in] maxNbSweepTouches A touch buffer will be allocated that is large enough to accommodate maxNbSweepTouches touches for all sweeps in the batch. + +\param[in] maxNbOverlaps A result buffer will be allocated that is large enough to accommodate maxNbOverlaps calls to PxBatchQueryExt::overlap() +\param[in] maxNbOverlapTouches A touch buffer will be allocated that is large enough to accommodate maxNbOverlapTouches touches for all overlaps in the batch. + +\return Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. +In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. +*/ +PxBatchQueryExt* PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + const PxU32 maxNbRaycasts, const PxU32 maxNbRaycastTouches, + const PxU32 maxNbSweeps, const PxU32 maxNbSweepTouches, + const PxU32 maxNbOverlaps, const PxU32 maxNbOverlapTouches); + + +/** +\brief Create a PxBatchQueryExt with user-supplied result and touch buffers. + +\param[in] scene Queries will be performed against objects in the specified PxScene +\param[in] queryFilterCallback Filtering for all queries is performed using queryFilterCallback. A null pointer results in all shapes being considered. + +\param[in] raycastBuffers This is the array that will be used to store the results of each raycast in a batch. +\param[in] maxNbRaycasts This is the length of the raycastBuffers array. +\param[in] raycastTouches This is the array that will be used to store the touches generated by all raycasts in a batch. +\param[in] maxNbRaycastTouches This is the length of the raycastTouches array. + +\param[in] sweepBuffers This is the array that will be used to store the results of each sweep in a batch. +\param[in] maxNbSweeps This is the length of the sweepBuffers array. +\param[in] sweepTouches This is the array that will be used to store the touches generated by all sweeps in a batch. +\param[in] maxNbSweepTouches This is the length of the sweepTouches array. + +\param[in] overlapBuffers This is the array that will be used to store the results of each overlap in a batch. +\param[in] maxNbOverlaps This is the length of the overlapBuffers array. +\param[in] overlapTouches This is the array that will be used to store the touches generated by all overlaps in a batch. +\param[in] maxNbOverlapTouches This is the length of the overlapTouches array. + +\return Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. +In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. +*/ +PxBatchQueryExt* PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + PxRaycastBuffer* raycastBuffers, const PxU32 maxNbRaycasts, PxRaycastHit* raycastTouches, const PxU32 maxNbRaycastTouches, + PxSweepBuffer* sweepBuffers, const PxU32 maxNbSweeps, PxSweepHit* sweepTouches, const PxU32 maxNbSweepTouches, + PxOverlapBuffer* overlapBuffers, const PxU32 maxNbOverlaps, PxOverlapHit* overlapTouches, const PxU32 maxNbOverlapTouches); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQuerySystemExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQuerySystemExt.h new file mode 100644 index 0000000..909fd72 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSceneQuerySystemExt.h @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SCENE_QUERY_SYSTEM_EXT_H +#define PX_SCENE_QUERY_SYSTEM_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxSceneQuerySystem.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Creates an external scene query system. + + An external SQ system is the part of a PxScene that deals with scene queries (SQ). This is usually taken care of + by an internal implementation inside PxScene, but it is also possible to re-route all SQ calls to an external + implementation, potentially opening the door to some customizations in behavior and features for advanced users. + + The following external SQ system is an example of how an implementation would look like. It re-uses much of the + same code as the internal version, but it could be re-implemented in a completely different way to match users' + specific needs. + + \param[in] desc Scene query descriptor + \param[in] contextID Context ID parameter, sent to the profiler + + \return An external SQ system instance + + @see PxSceneQuerySystem PxSceneQueryDesc + */ + PxSceneQuerySystem* PxCreateExternalSceneQuerySystem(const PxSceneQueryDesc& desc, PxU64 contextID); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSerialization.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSerialization.h new file mode 100644 index 0000000..30f358a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSerialization.h @@ -0,0 +1,294 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SERIALIZATION_H +#define PX_SERIALIZATION_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxBase.h" +#include "cooking/PxCooking.h" +#include "foundation/PxIO.h" +#include "common/PxTolerancesScale.h" +#include "common/PxTypeInfo.h" +#include "common/PxStringTable.h" + +/** +PX_BINARY_SERIAL_VERSION is used to version the PhysX binary data and meta data. The global unique identifier of the PhysX SDK needs to match +the one in the data and meta data, otherwise they are considered incompatible. A 32 character wide GUID can be generated with https://www.guidgenerator.com/ for example. +*/ +#define PX_BINARY_SERIAL_VERSION "0E16D844227B469DB23DA9C42CB4E624" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxBinaryConverter; + +/** +\brief Additional PxScene and PxPhysics options stored in XML serialized data. + +The PxXmlMiscParameter parameter can be serialized and deserialized along with PxCollection instances (XML only). +This is for application use only and has no impact on how objects are serialized or deserialized. +@see PxSerialization::createCollectionFromXml, PxSerialization::serializeCollectionToXml +*/ +struct PxXmlMiscParameter +{ + /** + \brief Up vector for the scene reference coordinate system. + */ + PxVec3 upVector; + + /** + \brief Tolerances scale to be used for the scene. + */ + PxTolerancesScale scale; + + PxXmlMiscParameter() : upVector(0) {} + PxXmlMiscParameter(PxVec3& inUpVector, PxTolerancesScale inScale) : upVector(inUpVector), scale(inScale) {} +}; + +/** +\brief Utility functions for serialization + +@see PxCollection, PxSerializationRegistry +*/ +class PxSerialization +{ +public: + /** + \brief Returns whether the collection is serializable with the externalReferences collection. + + Some definitions to explain whether a collection can be serialized or not: + + For definitions of requires and complete see #PxSerialization::complete + + A serializable object is subordinate if it cannot be serialized on its own + The following objects are subordinate: + - articulation links + - articulation joints + - joints + + A collection C can be serialized with external references collection D iff + - C is complete relative to D (no dangling references) + - Every object in D required by an object in C has a valid ID (no unnamed references) + - Every subordinate object in C is required by another object in C (no orphans) + + \param[in] collection Collection to be checked + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalReferences the external References collection + \return Whether the collection is serializable + @see PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry + */ + static bool isSerializable(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalReferences = NULL); + + /** + \brief Adds to a collection all objects such that it can be successfully serialized. + + A collection C is complete relative to an other collection D if every object required by C is either in C or D. + This function adds objects to a collection, such that it becomes complete with respect to the exceptFor collection. + Completeness is needed for serialization. See #PxSerialization::serializeCollectionToBinary, + #PxSerialization::serializeCollectionToXml. + + Sdk objects require other sdk object according to the following rules: + - joints require their actors and constraint + - rigid actors require their shapes + - shapes require their material(s) and mesh (triangle mesh, convex mesh or height field), if any + - articulations require their links and joints + - aggregates require their actors + + If followJoints is specified another rule is added: + - actors require their joints + + Specifying followJoints will make whole jointed actor chains being added to the collection. Following chains + is interrupted whenever a object in exceptFor is encountered. + + \param[in,out] collection Collection which is completed + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] exceptFor Optional exemption collection + \param[in] followJoints Specifies whether joints should be added for jointed actors + @see PxCollection, PxSerialization::serializeCollectionToBinary, PxSerialization::serializeCollectionToXml, PxSerializationRegistry + */ + static void complete(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* exceptFor = NULL, bool followJoints = false); + + /** + \brief Creates PxSerialObjectId values for unnamed objects in a collection. + + Creates PxSerialObjectId names for unnamed objects in a collection starting at a base value and incrementing, + skipping values that are already assigned to objects in the collection. + + \param[in,out] collection Collection for which names are created + \param[in] base Start address for PxSerialObjectId names + @see PxCollection + */ + static void createSerialObjectIds(PxCollection& collection, const PxSerialObjectId base); + + /** + \brief Creates a PxCollection from XML data. + + \param inputData The input data containing the XML collection. + \param cooking PxCooking instance used for sdk object instantiation. + \param sr PxSerializationRegistry instance with information about registered classes. + \param externalRefs PxCollection used to resolve external references. + \param stringTable PxStringTable instance used for storing object names. + \param outArgs Optional parameters of physics and scene deserialized from XML. See #PxSerialization::PxXmlMiscParameter + \return a pointer to a PxCollection if successful or NULL if it failed. + + @see PxCollection, PxSerializationRegistry, PxInputData, PxStringTable, PxCooking, PxSerialization::PxXmlMiscParameter + */ + static PxCollection* createCollectionFromXml(PxInputData& inputData, PxCooking& cooking, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, PxStringTable* stringTable = NULL, PxXmlMiscParameter* outArgs = NULL); + + /** + \brief Deserializes a PxCollection from memory. + + Creates a collection from memory. If the collection has external dependencies another collection + can be provided to resolve these. + + The memory block provided has to be 128 bytes aligned and contain a contiguous serialized collection as written + by PxSerialization::serializeCollectionToBinary. The contained binary data needs to be compatible with the current binary format version + which is defined by "PX_PHYSICS_VERSION_MAJOR.PX_PHYSICS_VERSION_MINOR.PX_PHYSICS_VERSION_BUGFIX-PX_BINARY_SERIAL_VERSION". + For a list of compatible sdk releases refer to the documentation of PX_BINARY_SERIAL_VERSION. + + \param[in] memBlock Pointer to memory block containing the serialized collection + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalRefs Collection to resolve external dependencies + + @see PxCollection, PxSerialization::complete, PxSerialization::serializeCollectionToBinary, PxSerializationRegistry, PX_BINARY_SERIAL_VERSION + */ + static PxCollection* createCollectionFromBinary(void* memBlock, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL); + + /** + \brief Serializes a physics collection to an XML output stream. + + The collection to be serialized needs to be complete @see PxSerialization.complete. + Optionally the XML may contain meshes in binary cooked format for fast loading. It does this when providing a valid non-null PxCooking pointer. + + \note Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + + \param outputStream Stream to save collection to. + \param collection PxCollection instance which is serialized. The collection needs to be complete with respect to the externalRefs collection. + \param sr PxSerializationRegistry instance with information about registered classes. + \param cooking Optional pointer to cooking instance. If provided, cooked mesh data is cached for fast loading. + \param externalRefs Collection containing external references. + \param inArgs Optional parameters of physics and scene serialized to XML along with the collection. See #PxSerialization::PxXmlMiscParameter + \return true if the collection is successfully serialized. + + @see PxCollection, PxOutputStream, PxSerializationRegistry, PxCooking, PxSerialization::PxXmlMiscParameter + */ + static bool serializeCollectionToXml(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, PxCooking* cooking = NULL, const PxCollection* externalRefs = NULL, PxXmlMiscParameter* inArgs = NULL); + + /** + \brief Serializes a collection to a binary stream. + + Serializes a collection to a stream. In order to resolve external dependencies the externalReferences collection has to be provided. + Optionally names of objects that where set for example with #PxActor::setName are serialized along with the objects. + + The collection can be successfully serialized if isSerializable(collection) returns true. See #isSerializable. + + The implementation of the output stream needs to fulfill the requirements on the memory block input taken by + PxSerialization::createCollectionFromBinary. + + \note Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + + \param[out] outputStream into which the collection is serialized + \param[in] collection Collection to be serialized + \param[in] sr PxSerializationRegistry instance with information about registered classes. + \param[in] externalRefs Collection used to resolve external dependencies + \param[in] exportNames Specifies whether object names are serialized + \return Whether serialization was successful + + @see PxCollection, PxOutputStream, PxSerialization::complete, PxSerialization::createCollectionFromBinary, PxSerializationRegistry + */ + static bool serializeCollectionToBinary(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, bool exportNames = false ); + + /** + \brief Serializes a collection to a binary stream. + + \deprecated Deterministic binary serialization is deprecated. PxSerialization::serializeCollectionToBinary might become deterministic in the future. + + Convenience function that serializes a collection to a stream while rebasing memory addresses and handles + to achieve a deterministic output, independent of the PhysX runtime environment the objects have been created in. + + The same functionality can be achieved by manually + - creating a binary data stream with PxSerialization::serializeCollectionToBinary + - producing the binary meta data of the current runtime platform with PxSerialization::dumpBinaryMetaData + - converting the binary data stream with the PxBinaryConverter, using the binary meta for both source and destination + + @see PxSerialization::serializeCollectionToBinary, PxSerialization::dumpBinaryMetaData, PxBinaryConverter + */ + PX_DEPRECATED static bool serializeCollectionToBinaryDeterministic(PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalRefs = NULL, bool exportNames = false); + + /** + \brief Dumps the binary meta-data to a stream. + + \deprecated Binary conversion and binary meta data are deprecated. + + A meta-data file contains information about the SDK's internal classes and about custom user types ready + for serialization. Such a file is needed to convert binary-serialized data from one platform to another (re-targeting). + The converter needs meta-data files for the source and target platforms to perform conversions. + + Custom user types can be supported with PxSerializationRegistry::registerBinaryMetaDataCallback (see the guide for more information). + + \param[out] outputStream Stream to write meta data to + \param[in] sr PxSerializationRegistry instance with information about registered classes used for conversion. + + @see PxOutputStream, PxSerializationRegistry + */ + PX_DEPRECATED static void dumpBinaryMetaData(PxOutputStream& outputStream, PxSerializationRegistry& sr); + + /** + \brief Creates binary converter for re-targeting binary-serialized data. + + \deprecated Binary conversion and binary meta data are deprecated. + + \return Binary converter instance. + */ + PX_DEPRECATED static PxBinaryConverter* createBinaryConverter(); + + /** + \brief Creates an application managed registry for serialization. + + \param[in] physics Physics SDK to generate create serialization registry + + \return PxSerializationRegistry instance. + + @see PxSerializationRegistry + */ + static PxSerializationRegistry* createSerializationRegistry(PxPhysics& physics); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxShapeExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxShapeExt.h new file mode 100644 index 0000000..e0c059d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxShapeExt.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SHAPE_EXT_H +#define PX_SHAPE_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" + +#include "PxShape.h" +#include "PxRigidActor.h" +#include "geometry/PxGeometryQuery.h" +#include "PxQueryReport.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief utility functions for use with PxShape + +@see PxShape +*/ + +class PxShapeExt +{ +public: + /** + \brief Retrieves the world space pose of the shape. + + \param[in] shape The shape for which to get the global pose. + \param[in] actor The actor to which the shape is attached + + \return Global pose of shape. + */ + static PX_INLINE PxTransform getGlobalPose(const PxShape& shape, const PxRigidActor& actor) + { + return actor.getGlobalPose() * shape.getLocalPose(); + } + + /** + \brief Raycast test against the shape. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] rayOrigin The origin of the ray to test the geometry object against + \param[in] rayDir The direction of the ray to test the geometry object against + \param[in] maxDist Maximum ray length + \param[in] hitFlags Specify which properties per hit should be computed and written to result hit array. Combination of #PxHitFlag flags + \param[in] maxHits max number of returned hits = size of 'rayHits' buffer + \param[out] rayHits Raycast hits information + \return Number of hits between the ray and the shape + + @see PxRaycastHit PxTransform + */ + static PX_INLINE PxU32 raycast(const PxShape& shape, const PxRigidActor& actor, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, PxHitFlags hitFlags, + PxU32 maxHits, PxRaycastHit* rayHits) + { + return PxGeometryQuery::raycast( + rayOrigin, rayDir, shape.getGeometry(), getGlobalPose(shape, actor), maxDist, hitFlags, maxHits, rayHits); + } + + /** + \brief Test overlap between the shape and a geometry object + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] otherGeom The other geometry object to test overlap with + \param[in] otherGeomPose Pose of the other geometry object + \return True if the shape overlaps the geometry object + + @see PxGeometry PxTransform + */ + static PX_INLINE bool overlap(const PxShape& shape, const PxRigidActor& actor, + const PxGeometry& otherGeom, const PxTransform& otherGeomPose) + { + return PxGeometryQuery::overlap(shape.getGeometry(), getGlobalPose(shape, actor), otherGeom, otherGeomPose); + } + + /** + \brief Sweep a geometry object against the shape. + + Currently only box, sphere, capsule and convex mesh shapes are supported, i.e. the swept geometry object must be one of those types. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] unitDir Normalized direction along which the geometry object should be swept. + \param[in] distance Sweep distance. Needs to be larger than 0. + \param[in] otherGeom The geometry object to sweep against the shape + \param[in] otherGeomPose Pose of the geometry object + \param[out] sweepHit The sweep hit information. Only valid if this method returns true. + \param[in] hitFlags Specify which properties per hit should be computed and written to result hit array. Combination of #PxHitFlag flags + \return True if the swept geometry object hits the shape + + @see PxGeometry PxTransform PxSweepHit + */ + static PX_INLINE bool sweep(const PxShape& shape, const PxRigidActor& actor, + const PxVec3& unitDir, const PxReal distance, const PxGeometry& otherGeom, const PxTransform& otherGeomPose, + PxSweepHit& sweepHit, PxHitFlags hitFlags) + { + return PxGeometryQuery::sweep(unitDir, distance, otherGeom, otherGeomPose, shape.getGeometry(), getGlobalPose(shape, actor), sweepHit, hitFlags); + } + + + /** + \brief Retrieves the axis aligned bounding box enclosing the shape. + + \return The shape's bounding box. + + \param[in] shape the shape + \param[in] actor the actor to which the shape is attached + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + + @see PxBounds3 + */ + static PX_INLINE PxBounds3 getWorldBounds(const PxShape& shape, const PxRigidActor& actor, float inflation=1.01f) + { + return PxGeometryQuery::getWorldBounds(shape.getGeometry(), getGlobalPose(shape, actor), inflation); + } + +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSimpleFactory.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSimpleFactory.h new file mode 100644 index 0000000..ac21af0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSimpleFactory.h @@ -0,0 +1,297 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMPLE_FACTORY_H +#define PX_SIMPLE_FACTORY_H +/** \addtogroup extensions + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxTransform.h" +#include "foundation/PxPlane.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxPhysics; + class PxMaterial; + class PxRigidActor; + class PxRigidDynamic; + class PxRigidStatic; + class PxGeometry; + class PxShape; + +/** \brief simple method to create a PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape, which must be a sphere, capsule, box or convex + \param[in] material the material for the new object's shape + \param[in] density the density of the new object. Must be greater than zero. + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \return a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + not be constructed + + @see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the transform of the new object + \param[in] shape the shape of the new object + \param[in] density the density of the new object. Must be greater than zero. + + \return a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + not be constructed + + @see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density); + +/** \brief simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape + \param[in] material the material for the new object's shape + \param[in] density the density of the new object. Must be greater than zero if the object is to participate in simulation. + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \note unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + kinematics of other geometry types may not participate in simulation collision and may be used only for + triggers or scene queries of moving objects under animation control. In this case the density parameter + will be ignored and the created shape will be set up as a scene query only shape (see #PxShapeFlag::eSCENE_QUERY_SHAPE) + + \return a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + not be constructed + + @see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] density the density of the new object. Must be greater than zero if the object is to participate in simulation. + \param[in] shape the shape of the new object + + \note unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + kinematics of other geometry types may not participate in simulation collision and may be used only for + triggers or scene queries of moving objects under animation control. In this case the density parameter + will be ignored and the created shape will be set up as a scene query only shape (see #PxShapeFlag::eSCENE_QUERY_SHAPE) + + \return a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + not be constructed + + @see PxRigidDynamic PxShapeFlag +*/ +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density); + +/** \brief simple method to create a PxRigidStatic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] geometry the geometry of the new object's shape + \param[in] material the material for the new object's shape + \param[in] shapeOffset an optional offset for the new shape, defaults to identity + + \return a new static actor, or NULL if it could not be constructed + + @see PxRigidStatic +*/ +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + const PxTransform& shapeOffset = PxTransform(PxIdentity)); + +/** \brief simple method to create a PxRigidStatic actor with a single PxShape. + + \param[in] sdk the PxPhysics object + \param[in] transform the global pose of the new object + \param[in] shape the new object's shape + + \return a new static actor, or NULL if it could not be constructed + + @see PxRigidStatic +*/ +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape); + +/** +\brief create a shape by copying attributes from another shape + +The function clones a PxShape. The following properties are copied: +- geometry +- flags +- materials +- actor-local pose +- contact offset +- rest offset +- simulation filter data +- query filter data +- torsional patch radius +- minimum torsional patch radius + +The following are not copied and retain their default values: +- name +- user data + +\param[in] physicsSDK - the physics SDK used to allocate the shape +\param[in] shape the shape from which to take the attributes. +\param[in] isExclusive whether the new shape should be an exclusive or shared shape. + +\return the newly-created rigid static +*/ +PxShape* PxCloneShape(PxPhysics& physicsSDK, + const PxShape& shape, + bool isExclusive); + +/** +\brief create a static body by copying attributes from another rigid actor + +The function clones a PxRigidDynamic or PxRigidStatic as a PxRigidStatic. A uniform scale is applied. The following properties are copied: +- shapes +- actor flags +- owner client and client behavior bits +- dominance group + +The following are not copied and retain their default values: +- name +- joints or observers +- aggregate or scene membership +- user data + +\note Transforms are not copied with bit-exact accuracy. + +\param[in] physicsSDK - the physics SDK used to allocate the rigid static +\param[in] actor the rigid actor from which to take the attributes. +\param[in] transform the transform of the new static. + +\return the newly-created rigid static +*/ +PxRigidStatic* PxCloneStatic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidActor& actor); + +/** +\brief create a dynamic body by copying attributes from an existing body + +The following properties are copied: +- shapes +- actor flags, rigidDynamic flags and rigidDynamic lock flags +- mass, moment of inertia, and center of mass frame +- linear and angular velocity +- linear and angular damping +- maximum linear velocity +- maximum angular velocity +- position and velocity solver iterations +- maximum depenetration velocity +- sleep threshold +- contact report threshold +- dominance group +- owner client and client behavior bits +- name pointer +- kinematic target + +The following are not copied and retain their default values: +- name +- joints or observers +- aggregate or scene membership +- sleep timer +- user data + +\note Transforms are not copied with bit-exact accuracy. + +\param[in] physicsSDK PxPhysics - the physics SDK used to allocate the rigid static +\param[in] body the rigid dynamic to clone. +\param[in] transform the transform of the new dynamic + +\return the newly-created rigid static +*/ +PxRigidDynamic* PxCloneDynamic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidDynamic& body); + +/** \brief create a plane actor. The plane equation is n.x + d = 0 + + \param[in] sdk the PxPhysics object + \param[in] plane a plane of the form n.x + d = 0 + \param[in] material the material for the new object's shape + + \return a new static actor, or NULL if it could not be constructed + + @see PxRigidStatic +*/ +PxRigidStatic* PxCreatePlane(PxPhysics& sdk, + const PxPlane& plane, + PxMaterial& material); + +/** +\brief scale a rigid actor by a uniform scale + +The geometry and relative positions of the actor are multiplied by the given scale value. If the actor is a rigid body or an +articulation link and the scaleMassProps value is true, the mass properties are scaled assuming the density is constant: the +center of mass is linearly scaled, the mass is multiplied by the cube of the scale, and the inertia tensor by the fifth power of the scale. + +\param[in] actor a rigid actor +\param[in] scale the scale by which to multiply the actor. Must be >0. +\param[in] scaleMassProps whether to scale the mass properties +*/ +void PxScaleRigidActor(PxRigidActor& actor, PxReal scale, bool scaleMassProps = true); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSmoothNormals.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSmoothNormals.h new file mode 100644 index 0000000..7b52850 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSmoothNormals.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SMOOTH_NORMALS_H +#define PX_SMOOTH_NORMALS_H +/** \addtogroup extensions + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +/** +\brief Builds smooth vertex normals over a mesh. + +- "smooth" because smoothing groups are not supported here +- takes angles into account for correct cube normals computation + +To use 32bit indices pass a pointer in dFaces and set wFaces to zero. Alternatively pass a pointer to +wFaces and set dFaces to zero. + +\param[in] nbTris Number of triangles +\param[in] nbVerts Number of vertices +\param[in] verts Array of vertices +\param[in] dFaces Array of dword triangle indices, or null +\param[in] wFaces Array of word triangle indices, or null +\param[out] normals Array of computed normals (assumes nbVerts vectors) +\param[in] flip Flips the normals or not +\return True on success. +*/ +PX_C_EXPORT bool PX_CALL_CONV PxBuildSmoothNormals(physx::PxU32 nbTris, physx::PxU32 nbVerts, const physx::PxVec3* verts, + const physx::PxU32* dFaces, const physx::PxU16* wFaces, physx::PxVec3* normals, bool flip); + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSoftBodyExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSoftBodyExt.h new file mode 100644 index 0000000..ffc1c30 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSoftBodyExt.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SOFT_BODY_EXT_H +#define PX_SOFT_BODY_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxTransform.h" +#include "PxSoftBody.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCookingParams; +class PxSimpleTriangleMesh; +class PxInsertionCallback; +class PxSoftBodyMesh; + +/** +\brief utility functions for use with PxSoftBody and subclasses +*/ +class PxSoftBodyExt +{ +public: + /** + \brief Computes the SoftBody's vertex masses from the provided density and the volume of the tetrahedra + + The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU() + + The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position and velocity buffer. + Performance optimizations are the reason why the mass inverse is stored in two locations. + + \param[in] softBody The soft body which will get its mass updated + \param[in] density The density to used to calculate the mass from the body's volume + \param[in] maxInvMassRatio Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh + + @see PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU() + */ + static void updateMass(PxSoftBody& softBody, const PxReal density, const PxReal maxInvMassRatio); + + /** + \brief Computes the SoftBody's vertex masses such that the sum of all masses is equal to the provided mass + + The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU() + + The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position and velocity buffer. + Performance optimizations are the reason why the mass inverse is stored in two locations. + + \param[in] softBody The soft body which will get its mass updated + \param[in] mass The SoftBody's mass + \param[in] maxInvMassRatio Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh + + @see PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU() + */ + static void setMass(PxSoftBody& softBody, const PxReal mass, const PxReal maxInvMassRatio); + + /** + \brief Transforms a SoftBody + + The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU() + + Applies a transformation to the simulation mesh's positions an velocities. Velocities only get rotated and scaled (translation is not applicable to direction vectors). + It does not modify the body's mass. + If the method is called multiple times, the transformation will compound with the ones previously applied. + + \param[in] softBody The soft body which is transformed + \param[in] transform The transform to apply + \param[in] scale A scaling factor + + @see PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU() + */ + static void transform(PxSoftBody& softBody, const PxTransform& transform, const PxReal scale); + + /** + \brief Updates the collision mesh's vertex positions to match the simulation mesh's transformation and scale. + + The buffer affected by this operation can be obtained from the SoftBody using the method getPositionInvMassCPU() + + \param[in] softBody The soft body which will get its collision mesh vertices updated + + @see PxSoftBody PxSoftBody::getPositionInvMassCPU() + */ + static void updateEmbeddedCollisionMesh(PxSoftBody& softBody); + + /** + \brief Uploads prepared SoftBody data to the GPU. It ensures that the embedded collision mesh matches the simulation mesh's transformation and scale. + + \param[in] softBody The soft body which will perform the data upload + \param[in] flags Specifies which buffers the data transfer should include + \param[in] flush If set to true, the upload will get processed immediately, otherwise it will take place before the data is needed for calculations on the GPU + + @see PxSoftBody + */ + static void commit(PxSoftBody& softBody, PxSoftBodyDataFlags flags, bool flush = false); + + /** + \brief Creates a full SoftBody mesh matching the shape given as input. Uses a voxel mesh for FEM simulation and a surface-matching mesh for collision detection. + + \param[in] params Cooking params instance required for mesh processing + \param[in] surfaceMesh Input triangle mesh that represents the surface of the SoftBody + \param[in] numVoxelsAlongLongestAABBAxis The number of voxels along the longest bounding box axis + \param[in] insertionCallback The insertion interface from PxPhysics + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \return SoftBody mesh if cooking was successful, NULL otherwise + @see PxSoftBodyMesh + */ + static PxSoftBodyMesh* createSoftBodyMesh(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxU32 numVoxelsAlongLongestAABBAxis, PxInsertionCallback& insertionCallback, const bool validate = true); + + /** + \brief Creates a full SoftBody mesh matching the shape given as input. Uses the same surface-matching mesh for collision detection and FEM simulation. + + \param[in] params Cooking params instance required for mesh processing + \param[in] surfaceMesh Input triangle mesh that represents the surface of the SoftBody + \param[in] insertionCallback The insertion interface from PxPhysics + \param[in] maxWeightRatioInTet Upper limit for the ratio of node weights that are adjacent to the same tetrahedron. The closer to one (while remaining larger than one), the more stable the simulation. + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \return SoftBody mesh if cooking was successful, NULL otherwise + @see PxSoftBodyMesh + */ + static PxSoftBodyMesh* createSoftBodyMeshNoVoxels(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxInsertionCallback& insertionCallback, PxReal maxWeightRatioInTet = 1.5f, const bool validate = true); + + + /** + \brief Creates a SoftBody instance from a SoftBody mesh + + \param[in] softBodyMesh The SoftBody mesh + \param[in] transform The transform that defines initial position and orientation of the SoftBody + \param[in] material The material + \param[in] cudaContextManager A cuda context manager + \param[in] density The density used to compute the mass properties + \param[in] solverIterationCount The number of iterations the solver should apply during simulation + \param[in] femParams Additional parameters to specify e. g. damping + \param[in] scale The scaling of the SoftBody + \return SoftBody instance + @see PxSoftBodyMesh, PxSoftBody + */ + static PxSoftBody* createSoftBodyFromMesh(PxSoftBodyMesh* softBodyMesh, const PxTransform& transform, + const PxFEMSoftBodyMaterial& material, PxCudaContextManager& cudaContextManager, PxReal density = 100.0f, PxU32 solverIterationCount = 30, + const PxFEMParameters& femParams = PxFEMParameters(), PxReal scale = 1.0f); + + + /** + \brief Creates a SoftBody instance with a box shape + + \param[in] transform The transform that defines initial position and orientation of the SoftBody + \param[in] boxDimensions The dimensions (side lengths) of the box shape + \param[in] material The material + \param[in] cudaContextManager A cuda context manager + \param[in] maxEdgeLength The maximal length of a triangle edge. Subdivision will get applied until the edge length criteria is matched. -1 means no subdivision is applied. + \param[in] density The density used to compute the mass properties + \param[in] solverIterationCount The number of iterations the solver should apply during simulation + \param[in] femParams Additional parameters to specify e. g. damping + \param[in] numVoxelsAlongLongestAABBAxis The number of voxels to use for the simulation mesh along the longest bounding box dimension + \param[in] scale The scaling of the SoftBody + \return SoftBody instance + @see PxSoftBodyMesh, PxSoftBody + */ + static PxSoftBody* createSoftBodyBox(const PxTransform& transform, const PxVec3& boxDimensions, const PxFEMSoftBodyMaterial& material, + PxCudaContextManager& cudaContextManager, PxReal maxEdgeLength = -1.0f, PxReal density = 100.0f, PxU32 solverIterationCount = 30, + const PxFEMParameters& femParams = PxFEMParameters(), PxU32 numVoxelsAlongLongestAABBAxis = 10, PxReal scale = 1.0f); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSphericalJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSphericalJoint.h new file mode 100644 index 0000000..bee0585 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxSphericalJoint.h @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SPHERICAL_JOINT_H +#define PX_SPHERICAL_JOINT_H +/** \addtogroup extensions + @{ +*/ + +#include "extensions/PxJoint.h" +#include "extensions/PxJointLimit.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxSphericalJoint; + +/** +\brief Create a spherical joint. + + \param[in] physics The physics SDK + \param[in] actor0 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame0 The position and orientation of the joint relative to actor0 + \param[in] actor1 An actor to which the joint is attached. NULL may be used to attach the joint to a specific point in the world frame + \param[in] localFrame1 The position and orientation of the joint relative to actor1 + +@see PxSphericalJoint +*/ +PxSphericalJoint* PxSphericalJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + + +/** +\brief Flags specific to the spherical joint. + +@see PxSphericalJoint +*/ +struct PxSphericalJointFlag +{ + enum Enum + { + eLIMIT_ENABLED = 1<<1 //!< the cone limit for the spherical joint is enabled + }; +}; +typedef PxFlags PxSphericalJointFlags; +PX_FLAGS_OPERATORS(PxSphericalJointFlag::Enum, PxU16) + +/** +\brief A joint which behaves in a similar way to a ball and socket. + + A spherical joint removes all linear degrees of freedom from two objects. + + The position of the joint on each actor is specified by the origin of the body's joint frame. + + A spherical joint may have a cone limit, to restrict the motion to within a certain range. In + addition, the bodies may be projected together if the distance between them exceeds a given threshold. + + Projection, drive and limits are activated by setting the appropriate flags on the joint. + + @see PxRevoluteJointCreate() PxJoint +*/ +class PxSphericalJoint : public PxJoint +{ +public: + + /** + \brief Set the limit cone. + + If enabled, the limit cone will constrain the angular movement of the joint to lie + within an elliptical cone. + + \return the limit cone + + @see PxJointLimitCone setLimit() + */ + virtual PxJointLimitCone getLimitCone() const = 0; + + /** + \brief Get the limit cone. + + \param[in] limit the limit cone + + @see PxJointLimitCone getLimit() + */ + virtual void setLimitCone(const PxJointLimitCone& limit) = 0; + + /** + \brief get the swing angle of the joint from the Y axis + */ + virtual PxReal getSwingYAngle() const = 0; + + /** + \brief get the swing angle of the joint from the Z axis + */ + virtual PxReal getSwingZAngle() const = 0; + + /** + \brief Set the flags specific to the Spherical Joint. + + Default PxSphericalJointFlags(0) + + \param[in] flags The joint flags. + + @see PxSphericalJointFlag setFlag() getFlags() + */ + virtual void setSphericalJointFlags(PxSphericalJointFlags flags) = 0; + + /** + \brief Set a single flag specific to a Spherical Joint to true or false. + + \param[in] flag The flag to set or clear. + \param[in] value the value to which to set the flag + + @see PxSphericalJointFlag, getFlags() setFlags() + */ + virtual void setSphericalJointFlag(PxSphericalJointFlag::Enum flag, bool value) = 0; + + /** + \brief Get the flags specific to the Spherical Joint. + + \return the joint flags + + @see PxSphericalJoint::flags, PxSphericalJointFlag setFlag() setFlags() + */ + virtual PxSphericalJointFlags getSphericalJointFlags() const = 0; + + /** + \brief Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + is set for the joint. + + If the joint separates by more than this distance along its locked degrees of freedom, the solver + will move the bodies to close the distance. + + Setting a very small tolerance may result in simulation jitter or other artifacts. + + Sometimes it is not possible to project (for example when the joints form a cycle). + + Range: [0, PX_MAX_F32)
+ Default: 1e10f + + \param[in] tolerance the linear tolerance threshold + + @see getProjectionLinearTolerance() PxJoint::setConstraintFlags() PxConstraintFlag::ePROJECTION + + @deprecated + */ + PX_DEPRECATED virtual void setProjectionLinearTolerance(PxReal tolerance) = 0; + + /** + \brief Get the linear tolerance threshold for projection. + + \return the linear tolerance threshold + + @see setProjectionLinearTolerance() + + @deprecated + */ + PX_DEPRECATED virtual PxReal getProjectionLinearTolerance() const = 0; + + /** + \brief Returns string name of PxSphericalJoint, used for serialization + */ + virtual const char* getConcreteTypeName() const { return "PxSphericalJoint"; } + +protected: + + //serialization + + /** + \brief Constructor + */ + PX_INLINE PxSphericalJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {} + + /** + \brief Deserialization constructor + */ + PX_INLINE PxSphericalJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {} + + /** + \brief Returns whether a given type name matches with the type of this instance + */ + virtual bool isKindOf(const char* name) const { return !::strcmp("PxSphericalJoint", name) || PxJoint::isKindOf(name); } + + //~serialization +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxStringTableExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxStringTableExt.h new file mode 100644 index 0000000..b4fdb1c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxStringTableExt.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_STRING_TABLE_EXT_H +#define PX_STRING_TABLE_EXT_H +#include "foundation/Px.h" +#include "common/PxStringTable.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief a factory class for creating PxStringTable with a specific allocator. + +@see PxStringTable +*/ + +class PxStringTableExt +{ +public: + static PxStringTable& createStringTable( physx::PxAllocatorCallback& inAllocator ); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetMakerExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetMakerExt.h new file mode 100644 index 0000000..e5d8dd5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetMakerExt.h @@ -0,0 +1,188 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETMAKER_EXT_H +#define PX_TETMAKER_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "common/PxCoreUtilityTypes.h" +#include "foundation/PxArray.h" +#include "PxTriangleMeshAnalysisResult.h" +#include "PxTetrahedronMeshAnalysisResult.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxTriangleMesh; +class PxTetrahedronMeshDesc; +class PxSoftBodySimulationDataDesc; +struct PxTetMakerData; +class PxSimpleTriangleMesh; + +/** +\brief Provides functionality to create a tetrahedral mesh from a triangle mesh. +*/ +class PxTetMaker +{ +public: + + /** + \brief Create conforming tetrahedron mesh using TetMaker + + \param[in] triangleMesh The description of the triangle mesh including vertices and indices + \param[out] outVertices The vertices to store the conforming tetrahedral mesh + \param[out] outTetIndices The indices to store the conforming tetrahedral mesh + \param[in] validate If set to true the input triangle mesh will get analyzed to find possible deficiencies + \param[in] volumeThreshold Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh + \return True if success + */ + static bool createConformingTetrahedronMesh(const PxSimpleTriangleMesh& triangleMesh, physx::PxArray& outVertices, physx::PxArray& outTetIndices, + const bool validate = true, PxReal volumeThreshold = 0.0f); + + /** + \brief Create voxel-based tetrahedron mesh using TetMaker + + \param[in] tetMesh The description of the tetrahedral mesh including vertices and indices + \param[in] numVoxelsAlongLongestBoundingBoxAxis The number of voxels along the longest bounding box axis + \param[out] outVertices The vertices to store the voxel-based tetrahedral mesh + \param[out] outTetIndices The indices to store the voxel-based tetrahedral mesh + \param[out] inputPointToOutputTetIndex Buffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index + \param[in] anchorNodeIndices Some input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points. + \return True if success + */ + static bool createVoxelTetrahedronMesh(const PxTetrahedronMeshDesc& tetMesh, const PxU32 numVoxelsAlongLongestBoundingBoxAxis, + physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL); + + /** + \brief Create voxel-based tetrahedron mesh using TetMaker + + \param[in] tetMesh The description of the tetrahedral mesh including vertices and indices + \param[in] voxelEdgeLength The edge length of a voxel.Can be adjusted slightly such that a multiple of it matches the input points' bounding box size + \param[out] outVertices The vertices to store the voxel-based tetrahedral mesh + \param[out] outTetIndices The indices to store the voxel-based tetrahedral mesh + \param[out] inputPointToOutputTetIndex Buffer with the size of nbTetVerts that contains the tetrahedron index containing the input point with the same index + \param[in] anchorNodeIndices Some input vertices may not be referenced by any tetrahedron. They can be mapped to another input vertex that is used by a tetrahedron to support embedding of additional points. + \return True if success + */ + static bool createVoxelTetrahedronMeshFromEdgeLength(const PxTetrahedronMeshDesc& tetMesh, const PxReal voxelEdgeLength, + physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* inputPointToOutputTetIndex = NULL, const PxU32* anchorNodeIndices = NULL); + + /** + \brief Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot. + + \param[in] triangleMesh The description of the triangle mesh including vertices and indices + \param[in] minVolumeThreshold Minimum volume the mesh must have such that no volume warning is generated + \param[in] minTriangleAngleRadians Minimum angle allowed for triangles such that no angle warning is generated + \return Flags that describe the triangle mesh's deficiencies + */ + static PxTriangleMeshAnalysisResults validateTriangleMesh(const PxSimpleTriangleMesh& triangleMesh, const PxReal minVolumeThreshold = 1e-6f, const PxReal minTriangleAngleRadians = 10.0f*3.1415926535898f / 180.0f); + + /** + \brief Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the softbody cooker, others cannot. + + \param[in] points The mesh's points + \param[in] tetrahedra The mesh's tetrahedra (index buffer) + \param[in] minTetVolumeThreshold Minimum volume every tetrahedron in the mesh must have such that no volume warning is generated + \return Flags that describe the tetrahedron mesh's deficiencies + */ + static PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const PxReal minTetVolumeThreshold = 1e-8f); + + /** + \brief Simplifies (decimates) a triangle mesh using quadric simplification. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] targetTriangleCount Desired number of triangles in the output mesh + \param[in] maximalEdgeLength Edges below this length will not be collapsed. A value of zero means there is no limit. + \param[out] outputVertices The vertices of the output (decimated) triangle mesh + \param[out] outputIndices The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] vertexMap Optional parameter which returns the mapping from input to output vertices. Note that multiple input vertices are typically collapsed into the same output vertex. + \param[in] edgeLengthCostWeight Factor to scale influence of edge length when prioritizing edge collapses. Has no effect if set to zero. + \param[in] flatnessDetectionThreshold Threshold used to detect edges in flat regions and to improve the placement of the collapsed point. If set to a large value it will have no effect. + */ + static void simplifyTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, int targetTriangleCount, PxF32 maximalEdgeLength, + PxArray& outputVertices, PxArray& outputIndices, + PxArray *vertexMap = NULL, PxReal edgeLengthCostWeight = 0.1f, PxReal flatnessDetectionThreshold = 0.01f); + + /** + \brief Creates a new mesh from a given mesh. The input mesh is first voxelized. The new surface is created from the voxel surface and subsequent projection to the original mesh. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] gridResolution Size of the voxel grid (number of voxels along the longest dimension) + \param[out] outputVertices The vertices of the output (decimated) triangle mesh + \param[out] outputIndices The indices of the output (decimated) triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] vertexMap Optional parameter which returns a mapping from input to output vertices. Since the meshes are independent, the mapping returns an output vertex that is topologically close to the input vertex. + */ + static void remeshTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, int gridResolution, + PxArray& outputVertices, PxArray& outputIndices, + PxArray *vertexMap = NULL); + + /** + \brief Creates a tetrahedral mesh using an octree. + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[in] useTreeNodes Using the nodes of the octree as tetrahedral vertices + \param[out] outputVertices The vertices of the output tetrahedral mesh + \param[out] outputIndices The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), .. + \param[in] volumeThreshold Tetrahedra with a volume smaller than the specified threshold will be removed from the mesh + */ + static void createTreeBasedTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + bool useTreeNodes, PxArray& outputVertices, PxArray& outputIndices, PxReal volumeThreshold = 0.0f); + + /** + \brief Creates a tetrahedral mesh by relaxing a voxel mesh around the input mesh + + \param[in] inputVertices The vertices of the input triangle mesh + \param[in] inputIndices The indices of the input triangle mesh of the form (id0, id1, id2), (id0, id1, id2), .. + \param[out] outputVertices The vertices of the output tetrahedral mesh + \param[out] outputIndices The indices of the output tetrahedral mesh of the form (id0, id1, id2, id3), (id0, id1, id2, id3), .. + \param[in] resolution The grid spacing is computed as the diagonal of the bounding box of the input mesh divided by the resolution. + \param[in] numRelaxationIterations Number of iterations to pull the tetrahedral mesh towards the input mesh + \param[in] relMinTetVolume Constrains the volumes of the tetrahedra to stay abobe relMinTetvolume times the tetrahedron's rest volume. + */ + static void createRelaxedVoxelTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + PxArray& outputVertices, PxArray& outputIndices, + PxI32 resolution, PxI32 numRelaxationIterations = 5, PxF32 relMinTetVolume = 0.05f); + +}; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h new file mode 100644 index 0000000..be88af9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshAnalysisResult.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TETRAHEDRON_MESH_ANALYSIS_RESULT_H +#define PX_TETRAHEDRON_MESH_ANALYSIS_RESULT_H + + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief These flags indicate what kind of deficiencies a tetrahedron mesh has and describe if the mesh is considered ok, problematic or invalid for softbody cooking + */ + class PxTetrahedronMeshAnalysisResult + { + public: + enum Enum + { + eVALID = 0, + eDEGENERATE_TETRAHEDRON = (1 << 0), //!< At least one tetrahedron has zero or negative volume. This can happen when the input triangle mesh contains triangles that are very elongated, e. g. one edge is a lot shorther than the other two. + + eMESH_IS_PROBLEMATIC = (1 << 1), //!< flag is set if the mesh is categorized as problematic + eMESH_IS_INVALID = (1 << 2) //!< flag is set if the mesh is categorized as invalid + }; + }; + typedef PxFlags PxTetrahedronMeshAnalysisResults; + PX_FLAGS_OPERATORS(PxTetrahedronMeshAnalysisResult::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshExt.h new file mode 100644 index 0000000..ca24c44 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTetrahedronMeshExt.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETRAHEDRON_MESH_EXT_H +#define PX_TETRAHEDRON_MESH_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxArray.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxTetrahedronMesh; + + /** + \brief utility functions for use with PxTetrahedronMesh and subclasses + */ + class PxTetrahedronMeshExt + { + public: + /** Returns the index of the tetrahedron that contains a point + + \param[in] mesh The tetmesh + \param[in] point The point to find the enclosing tetrahedron for + \param[in] bary The barycentric coordinates of the point inside the enclosing tetrahedron + \param[in] tolerance Tolerance value used classify points as inside if they lie exactly a tetrahedron's surface + \return The index of the tetrahedon containing the point, -1 if not tetrahedron contains the opoint + */ + static PxI32 findTetrahedronContainingPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary, PxReal tolerance = 1e-6f); + + /** Returns the index of the tetrahedron closest to a point + + \param[in] mesh The tetmesh + \param[in] point The point to find the closest tetrahedron for + \param[in] bary The barycentric coordinates of the point in the tetrahedron + \return The index of the tetrahedon closest to the point + */ + static PxI32 findTetrahedronClosestToPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary); + + /** Extracts the surface triangles of a tetmesh + + The extracted triangle's vertex indices point to the vertex buffer of the tetmesh. + + \param[in] tetrahedra The tetrahedra indices + \param[in] numTetrahedra The number of tetrahedra + \param[in] sixteenBitIndices If set to true, the tetrahedra indices are read as 16bit integers, otherwise 32bit integers are used + \param[in] surfaceTriangles The resulting surface triangles + \param[in] surfaceTriangleToTet Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index + \param[in] flipTriangleOrientation Reverses the orientation of the ouput triangles + */ + static void extractTetMeshSurface(const void* tetrahedra, PxU32 numTetrahedra, bool sixteenBitIndices, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false); + + /** Extracts the surface triangles of a tetmesh + + The extracted triangle's vertex indices point to the vertex buffer of the tetmesh. + + \param[in] mesh The mesh from which the surface shall be computed + \param[in] surfaceTriangles The resulting surface triangles + \param[in] surfaceTriangleToTet Optional array to get the index of a tetrahedron that is adjacent to the surface triangle with the corresponding index + \param[in] flipTriangleOrientation Reverses the orientation of the ouput triangles + */ + static void extractTetMeshSurface(const PxTetrahedronMesh* mesh, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet = NULL, bool flipTriangleOrientation = false); + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshAnalysisResult.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshAnalysisResult.h new file mode 100644 index 0000000..e84bcf9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshAnalysisResult.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_ANALYSIS_RESULT_H +#define PX_TRIANGLE_MESH_ANALYSIS_RESULT_H + + +#include "PxPhysXConfig.h" +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief These flags indicate what kind of deficiencies a triangle mesh has and describe if the mesh is considered ok, problematic or invalid for tetmeshing + */ + class PxTriangleMeshAnalysisResult + { + public: + enum Enum + { + eVALID = 0, + eZERO_VOLUME = (1 << 0), //!< invalid: Flat mesh without meaningful amount of volume - cannot be meshed since a tetmesh is volumetric + eOPEN_BOUNDARIES = (1 << 1), //!< problematic: Open boundary means that the mesh is not watertight and that there are holes. The mesher can fill holes but the surface might have an unexpected shape where the hole was. + eSELF_INTERSECTIONS = (1 << 2), //!< problematic: The surface of the resulting mesh won't match exactly at locations of self-intersections. The tetmesh might be connected at self-intersections even if the input triangle mesh is not + eINCONSISTENT_TRIANGLE_ORIENTATION = (1 << 3), //!< invalid: It is not possible to distinguish what is inside and outside of the mesh. If there are no self-intersections and not edges shared by more than two triangles, a call to makeTriOrientationConsistent can fix this. Without fixing it, the output from the tetmesher will be incorrect + eCONTAINS_ACUTE_ANGLED_TRIANGLES = (1 << 4), //!< problematic: An ideal mesh for a softbody has triangles with similar angles and evenly distributed vertices. Acute angles can be handled but might lead to a poor quality tetmesh. + eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES = (1 << 5), //!< problematic: Border case of a self-intersecting mesh. The tetmesh might not match the surace exactly near such edges. + eCONTAINS_DUPLICATE_POINTS = (1 << 6), //!< ok: Duplicate points can be handled by the mesher without problems. The resulting tetmesh will only make use of first unique point that is found, duplicate points will get mapped to that unique point in the tetmesh. Therefore the tetmesh can contain points that are not accessed by a tet. + eCONTAINS_INVALID_POINTS = (1 << 7), //!< invalid: Points contain NAN, infinity or similar values that will lead to an invalid mesh + eREQUIRES_32BIT_INDEX_BUFFER = (1 << 8), //!< invalid: Mesh contains more indices than a 16bit index buffer can address + + eMESH_IS_PROBLEMATIC = (1 << 9), //!< flag is set if the mesh is categorized as problematic + eMESH_IS_INVALID = (1 << 10) //!< flag is set if the mesh is categorized as invalid + }; + }; + typedef PxFlags PxTriangleMeshAnalysisResults; + PX_FLAGS_OPERATORS(PxTriangleMeshAnalysisResult::Enum, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshExt.h b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshExt.h new file mode 100644 index 0000000..be919ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/extensions/PxTriangleMeshExt.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_EXT_H +#define PX_TRIANGLE_MESH_EXT_H +/** \addtogroup extensions + @{ +*/ + +#include "PxPhysXConfig.h" +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxTriangleMesh; +class PxTriangleMeshGeometry; +class PxHeightFieldGeometry; + + /** + \brief Utility class to find mesh triangles touched by a specified geometry object. + + This class is a helper calling PxMeshQuery::findOverlapTriangleMesh or PxMeshQuery::findOverlapHeightField under the hood, + while taking care of necessary memory management issues. + + PxMeshQuery::findOverlapTriangleMesh and PxMeshQuery::findOverlapHeightField are the "raw" functions operating on user-provided fixed-size + buffers. These functions abort with an error code in case of buffer overflow. PxMeshOverlapUtil is a convenient helper function checking + this error code, and resizing buffers appropriately, until the desired call succeeds. + + Returned triangle indices are stored within the class, and can be used with PxMeshQuery::getTriangle() to retrieve the triangle properties. + */ + class PxMeshOverlapUtil + { + public: + PxMeshOverlapUtil(); + ~PxMeshOverlapUtil(); + /** + \brief Find the mesh triangles which touch the specified geometry object. + + \param[in] geom The geometry object to test for mesh triangle overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry + \param[in] geomPose Pose of the geometry object + \param[in] meshGeom The triangle mesh geometry to check overlap against + \param[in] meshPose Pose of the triangle mesh + \return Number of overlaps found. Triangle indices can then be accessed through the #getResults() function. + + @see PxGeometry PxTransform PxTriangleMeshGeometry PxMeshQuery::findOverlapTriangleMesh + */ + PxU32 findOverlap(const PxGeometry& geom, const PxTransform& geomPose, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshPose); + + /** + \brief Find the height field triangles which touch the specified geometry object. + + \param[in] geom The geometry object to test for height field overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry. The sphere and capsule queries are currently conservative estimates. + \param[in] geomPose Pose of the geometry object + \param[in] hfGeom The height field geometry to check overlap against + \param[in] hfPose Pose of the height field + \return Number of overlaps found. Triangle indices can then be accessed through the #getResults() function. + + @see PxGeometry PxTransform PxHeightFieldGeometry PxMeshQuery::findOverlapHeightField + */ + PxU32 findOverlap(const PxGeometry& geom, const PxTransform& geomPose, const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose); + + /** + \brief Retrieves array of triangle indices after a findOverlap call. + \return Indices of touched triangles + */ + PX_FORCE_INLINE const PxU32* getResults() const { return mResultsMemory; } + + /** + \brief Retrieves number of triangle indices after a findOverlap call. + \return Number of touched triangles + */ + PX_FORCE_INLINE PxU32 getNbResults() const { return mNbResults; } + + private: + PxU32* mResultsMemory; + PxU32 mResults[256]; + PxU32 mNbResults; + PxU32 mMaxNbResults; + }; + + /** + \brief Computes an approximate minimum translational distance (MTD) between a geometry object and a mesh. + + This iterative function computes an approximate vector that can be used to depenetrate a geom object + from a triangle mesh. Returned depenetration vector should be applied to 'geom', to get out of the mesh. + + The function works best when the amount of overlap between the geom object and the mesh is small. If the + geom object's center goes inside the mesh, backface culling usually kicks in, no overlap is detected, + and the function does not compute an MTD vector. + + The function early exits if no overlap is detected after a depenetration attempt. This means that if + maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + been successful. Usually N = 4 gives good results. + + \param[out] direction Computed MTD unit direction + \param[out] depth Penetration depth. Always positive or zero. + \param[in] geom The geometry object + \param[in] geomPose Pose for the geometry object + \param[in] meshGeom The mesh geometry + \param[in] meshPose Pose for the mesh + \param[in] maxIter Max number of iterations before returning. + \param[out] usedIter Number of depenetrations attempts performed during the call. Will not be returned if the pointer is NULL. + + \return True if the MTD has successfully been computed, i.e. if objects do overlap. + + @see PxGeometry PxTransform PxTriangleMeshGeometry + */ + bool PxComputeTriangleMeshPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxTriangleMeshGeometry& meshGeom, + const PxTransform& meshPose, + PxU32 maxIter, + PxU32* usedIter = NULL); + + /** + \brief Computes an approximate minimum translational distance (MTD) between a geometry object and a heightfield. + + This iterative function computes an approximate vector that can be used to depenetrate a geom object + from a heightfield. Returned depenetration vector should be applied to 'geom', to get out of the heightfield. + + The function works best when the amount of overlap between the geom object and the mesh is small. If the + geom object's center goes inside the heightfield, backface culling usually kicks in, no overlap is detected, + and the function does not compute an MTD vector. + + The function early exits if no overlap is detected after a depenetration attempt. This means that if + maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + been successful. Usually N = 4 gives good results. + + \param[out] direction Computed MTD unit direction + \param[out] depth Penetration depth. Always positive or zero. + \param[in] geom The geometry object + \param[in] geomPose Pose for the geometry object + \param[in] heightFieldGeom The heightfield geometry + \param[in] heightFieldPose Pose for the heightfield + \param[in] maxIter Max number of iterations before returning. + \param[out] usedIter Number of depenetrations attempts performed during the call. Will not be returned if the pointer is NULL. + + \return True if the MTD has successfully been computed, i.e. if objects do overlap. + + @see PxGeometry PxTransform PxHeightFieldGeometry + */ + bool PxComputeHeightFieldPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxHeightFieldGeometry& heightFieldGeom, + const PxTransform& heightFieldPose, + PxU32 maxIter, + PxU32* usedIter = NULL); + + /** + \brief Extracts an isosurface from the SDF of a mesh if it the SDF is available. + + \param[in] triangleMesh The triangle mesh + \param[out] isosurfaceVertices The vertices of the extracted isosurface + \param[out] isosurfaceTriangleIndices The triangles of the extracted isosurface + */ + PX_DEPRECATED bool PxExtractIsosurfaceFromSDF(const PxTriangleMesh& triangleMesh, PxArray& isosurfaceVertices, PxArray& isosurfaceTriangleIndices); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/filebuf/PxFileBuf.h b/modules/PhysX/physx/physx-sys/physx/physx/include/filebuf/PxFileBuf.h new file mode 100644 index 0000000..79ab026 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/filebuf/PxFileBuf.h @@ -0,0 +1,338 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PSFILEBUFFER_PXFILEBUF_H +#define PSFILEBUFFER_PXFILEBUF_H + +#include "foundation/PxSimpleTypes.h" + +/** \addtogroup foundation + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ + +namespace general_PxIOStream2 +{ +#endif + +PX_PUSH_PACK_DEFAULT + +/** +\brief Callback class for data serialization. + +The user needs to supply an PxFileBuf implementation to a number of methods to allow the SDK to read or write +chunks of binary data. This allows flexibility for the source/destination of the data. For example the PxFileBuf +could store data in a file, memory buffer or custom file format. + +\note It is the users responsibility to ensure that the data is written to the appropriate offset. + +*/ +class PxFileBuf +{ +public: + + enum EndianMode + { + ENDIAN_NONE = 0, // do no conversion for endian mode + ENDIAN_BIG = 1, // always read/write data as natively big endian (Power PC, etc.) + ENDIAN_LITTLE = 2 // always read/write data as natively little endian (Intel, etc.) Default Behavior! + }; + + PxFileBuf(EndianMode mode=ENDIAN_LITTLE) + { + setEndianMode(mode); + } + + virtual ~PxFileBuf(void) + { + + } + + /** + \brief Declares a constant to seek to the end of the stream. + * + * Does not support streams longer than 32 bits + */ + static const uint32_t STREAM_SEEK_END=0xFFFFFFFF; + + enum OpenMode + { + OPEN_FILE_NOT_FOUND, + OPEN_READ_ONLY, // open file buffer stream for read only access + OPEN_WRITE_ONLY, // open file buffer stream for write only access + OPEN_READ_WRITE_NEW, // open a new file for both read/write access + OPEN_READ_WRITE_EXISTING // open an existing file for both read/write access + }; + + virtual OpenMode getOpenMode(void) const = 0; + + bool isOpen(void) const + { + return getOpenMode()!=OPEN_FILE_NOT_FOUND; + } + + enum SeekType + { + SEEKABLE_NO = 0, + SEEKABLE_READ = 0x1, + SEEKABLE_WRITE = 0x2, + SEEKABLE_READWRITE = 0x3 + }; + + virtual SeekType isSeekable(void) const = 0; + + void setEndianMode(EndianMode e) + { + mEndianMode = e; + if ( (e==ENDIAN_BIG && !isBigEndian() ) || + (e==ENDIAN_LITTLE && isBigEndian() ) ) + { + mEndianSwap = true; + } + else + { + mEndianSwap = false; + } + } + + EndianMode getEndianMode(void) const + { + return mEndianMode; + } + + virtual uint32_t getFileLength(void) const = 0; + + /** + \brief Seeks the stream to a particular location for reading + * + * If the location passed exceeds the length of the stream, then it will seek to the end. + * Returns the location it ended up at (useful if you seek to the end) to get the file position + */ + virtual uint32_t seekRead(uint32_t loc) = 0; + + /** + \brief Seeks the stream to a particular location for writing + * + * If the location passed exceeds the length of the stream, then it will seek to the end. + * Returns the location it ended up at (useful if you seek to the end) to get the file position + */ + virtual uint32_t seekWrite(uint32_t loc) = 0; + + /** + \brief Reads from the stream into a buffer. + + \param[out] mem The buffer to read the stream into. + \param[in] len The number of bytes to stream into the buffer + + \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. + */ + virtual uint32_t read(void *mem,uint32_t len) = 0; + + + /** + \brief Reads from the stream into a buffer but does not advance the read location. + + \param[out] mem The buffer to read the stream into. + \param[in] len The number of bytes to stream into the buffer + + \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. + */ + virtual uint32_t peek(void *mem,uint32_t len) = 0; + + /** + \brief Writes a buffer of memory to the stream + + \param[in] mem The address of a buffer of memory to send to the stream. + \param[in] len The number of bytes to send to the stream. + + \return Returns the actual number of bytes sent to the stream. If not equal to the length specific, then the stream is full or unable to write for some reason. + */ + virtual uint32_t write(const void *mem,uint32_t len) = 0; + + /** + \brief Reports the current stream location read aqccess. + + \return Returns the current stream read location. + */ + virtual uint32_t tellRead(void) const = 0; + + /** + \brief Reports the current stream location for write access. + + \return Returns the current stream write location. + */ + virtual uint32_t tellWrite(void) const = 0; + + /** + \brief Causes any temporarily cached data to be flushed to the stream. + */ + virtual void flush(void) = 0; + + /** + \brief Close the stream. + */ + virtual void close(void) {} + + void release(void) + { + PX_DELETE_THIS; + } + + static PX_INLINE bool isBigEndian() + { + int32_t i = 1; + return *(reinterpret_cast(&i))==0; + } + + PX_INLINE void swap2Bytes(void* _data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[1]; data[1] = one_byte; + } + + PX_INLINE void swap4Bytes(void* _data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[3]; data[3] = one_byte; + one_byte = data[1]; data[1] = data[2]; data[2] = one_byte; + } + + PX_INLINE void swap8Bytes(void *_data) const + { + char *data = static_cast(_data); + char one_byte; + one_byte = data[0]; data[0] = data[7]; data[7] = one_byte; + one_byte = data[1]; data[1] = data[6]; data[6] = one_byte; + one_byte = data[2]; data[2] = data[5]; data[5] = one_byte; + one_byte = data[3]; data[3] = data[4]; data[4] = one_byte; + } + + + PX_INLINE void storeDword(uint32_t v) + { + if ( mEndianSwap ) + swap4Bytes(&v); + + write(&v,sizeof(v)); + } + + PX_INLINE void storeFloat(float v) + { + if ( mEndianSwap ) + swap4Bytes(&v); + write(&v,sizeof(v)); + } + + PX_INLINE void storeDouble(double v) + { + if ( mEndianSwap ) + swap8Bytes(&v); + write(&v,sizeof(v)); + } + + PX_INLINE void storeByte(uint8_t b) + { + write(&b,sizeof(b)); + } + + PX_INLINE void storeWord(uint16_t w) + { + if ( mEndianSwap ) + swap2Bytes(&w); + write(&w,sizeof(w)); + } + + uint8_t readByte(void) + { + uint8_t v=0; + read(&v,sizeof(v)); + return v; + } + + uint16_t readWord(void) + { + uint16_t v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap2Bytes(&v); + return v; + } + + uint32_t readDword(void) + { + uint32_t v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap4Bytes(&v); + return v; + } + + float readFloat(void) + { + float v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap4Bytes(&v); + return v; + } + + double readDouble(void) + { + double v=0; + read(&v,sizeof(v)); + if ( mEndianSwap ) + swap8Bytes(&v); + return v; + } + +private: + bool mEndianSwap; // whether or not the endian should be swapped on the current platform + EndianMode mEndianMode; // the current endian mode behavior for the stream +}; + +PX_POP_PACK + +#if !PX_DOXYGEN +} // end of namespace + +using namespace general_PxIOStream2; + +namespace general_PxIOStream = general_PxIOStream2; + +} // end of namespace +#endif + +/** @} */ + +#endif // PSFILEBUFFER_PXFILEBUF_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/Px.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/Px.h new file mode 100644 index 0000000..cc0574e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/Px.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_H +#define PX_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxSimpleTypes.h" + +/** files to always include */ +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +typedef uint32_t PxU32; + +class PxAllocatorCallback; +class PxErrorCallback; +//struct PxErrorCode; +class PxAssertHandler; + +class PxInputStream; +class PxInputData; +class PxOutputStream; +class PxVec2; +class PxVec3; +class PxVec4; +class PxQuat; +class PxMat33; +class PxMat34; +class PxMat44; +class PxTransform; +class PxPlane; +class PxBounds3; + +/** enum for empty constructor tag*/ +enum PxEMPTY +{ + PxEmpty +}; + +/** enum for zero constructor tag for vectors and matrices */ +enum PxZERO +{ + PxZero +}; + +/** enum for identity constructor flag for quaternions, transforms, and matrices */ +enum PxIDENTITY +{ + PxIdentity +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlignedMalloc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlignedMalloc.h new file mode 100644 index 0000000..6e71f59 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlignedMalloc.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ALIGNED_MALLOC_H +#define PX_ALIGNED_MALLOC_H + +#include "PxUserAllocated.h" + +/*! +Allocate aligned memory. +Alignment must be a power of 2! +-- should be templated by a base allocator +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + Allocator, which is used to access the global PxAllocatorCallback instance + (used for dynamic data types template instantiation), which can align memory + */ + + // SCS: AlignedMalloc with 3 params not found, seems not used on PC either + // disabled for now to avoid GCC error + + template + class PxAlignedAllocator : public BaseAllocator + { + public: + PxAlignedAllocator(const BaseAllocator& base = BaseAllocator()) : BaseAllocator(base) + { + } + + void* allocate(size_t size, const char* file, int line) + { + size_t pad = N - 1 + sizeof(size_t); // store offset for delete. + uint8_t* base = reinterpret_cast(BaseAllocator::allocate(size + pad, file, line)); + if (!base) + return NULL; + + uint8_t* ptr = reinterpret_cast(size_t(base + pad) & ~(size_t(N) - 1)); // aligned pointer, ensuring N + // is a size_t + // wide mask + reinterpret_cast(ptr)[-1] = size_t(ptr - base); // store offset + + return ptr; + } + void deallocate(void* ptr) + { + if (ptr == NULL) + return; + + uint8_t* base = reinterpret_cast(ptr) - reinterpret_cast(ptr)[-1]; + BaseAllocator::deallocate(base); + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlloca.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlloca.h new file mode 100644 index 0000000..088cda1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAlloca.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ALLOCA_H +#define PX_ALLOCA_H + +#include "foundation/PxTempAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +class PxScopedPointer : private Alloc +{ + public: + ~PxScopedPointer() + { + if(mOwned) + Alloc::deallocate(mPointer); + } + + operator T*() const + { + return mPointer; + } + + T* mPointer; + bool mOwned; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + // Don't use inline for alloca !!! +#if PX_WINDOWS_FAMILY +#include +#define PxAlloca(x) _alloca(x) +#elif PX_LINUX +#include +#define PxAlloca(x) alloca(x) +#elif PX_APPLE_FAMILY +#include +#define PxAlloca(x) alloca(x) +#elif PX_SWITCH +#include +#define PxAlloca(x) alloca(x) +#endif + +#define PxAllocaAligned(x, alignment) ((size_t(PxAlloca(x + alignment)) + (alignment - 1)) & ~size_t(alignment - 1)) + +/*! Stack allocation for \c count instances of \c type. Falling back to temp allocator if using more than 1kB. */ +#define PX_ALLOCA(var, type, count) \ + physx::PxScopedPointer var; \ + { \ + uint32_t size = sizeof(type) * (count); \ + var.mOwned = size > 1024; \ + if(var.mOwned) \ + var.mPointer = reinterpret_cast(physx::PxTempAllocator().allocate(size, __FILE__, __LINE__)); \ + else \ + var.mPointer = reinterpret_cast(PxAlloca(size)); \ + } +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocator.h new file mode 100644 index 0000000..1f76bc0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocator.h @@ -0,0 +1,226 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ALLOCATOR_H +#define PX_ALLOCATOR_H + +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxAssert.h" +#include "foundation/PxFoundation.h" +#include "foundation/Px.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4577) +#endif + +#if PX_WINDOWS_FAMILY + #include + #include +#endif +#if(PX_APPLE_FAMILY) + #include +#endif + +#include + +#if PX_VC +#pragma warning(pop) +#endif + + +// PT: the rules are simple: +// - PX_ALLOC/PX_ALLOCATE/PX_FREE is similar to malloc/free. Use that for POD/anything that doesn't need ctor/dtor. +// - PX_NEW/PX_DELETE is similar to new/delete. Use that for anything that needs a ctor/dtor. +// - Everything goes through the user allocator. +// - Inherit from PxUserAllocated to PX_NEW something. Do it even on small classes, it's free. +// - You cannot PX_NEW a POD. Use PX_ALLOC. + +#define PX_ALLOC(n, name) physx::PxAllocator().allocate(n, __FILE__, __LINE__) + +// PT: use this one to reduce the amount of visible reinterpret_cast +#define PX_ALLOCATE(type, count, name) reinterpret_cast(PX_ALLOC(count*sizeof(type), name)) + +#define PX_FREE(x) \ + if(x) \ + { \ + physx::PxAllocator().deallocate(x); \ + x = NULL; \ + } + +#define PX_FREE_THIS physx::PxAllocator().deallocate(this) + +#define PX_NEW(T) new (physx::PxReflectionAllocator(), __FILE__, __LINE__) T +#define PX_PLACEMENT_NEW(p, T) new (p) T +#define PX_DELETE_THIS delete this +#define PX_DELETE(x) if(x) { delete x; x = NULL; } +#define PX_DELETE_ARRAY(x) if(x) { delete []x; x = NULL; } +#define PX_RELEASE(x) if(x) { x->release(); x = NULL; } + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + Allocator used to access the global PxAllocatorCallback instance without providing additional information. + */ + class PxAllocator + { + public: + PX_FORCE_INLINE PxAllocator(const char* = NULL){} + + PX_FORCE_INLINE void* allocate(size_t size, const char* file, int line) + { + return size ? PxGetBroadcastAllocator()->allocate(size, "", file, line) : NULL; + } + + PX_FORCE_INLINE void deallocate(void* ptr) + { + if(ptr) + PxGetBroadcastAllocator()->deallocate(ptr); + } + }; + + /* + * Bootstrap allocator using malloc/free. + * Don't use unless your objects get allocated before foundation is initialized. + */ + class PxRawAllocator + { + public: + PxRawAllocator(const char* = 0) {} + + PX_FORCE_INLINE void* allocate(size_t size, const char*, int) + { + // malloc returns valid pointer for size==0, no need to check + return ::malloc(size); + } + + PX_FORCE_INLINE void deallocate(void* ptr) + { + // free(0) is guaranteed to have no side effect, no need to check + ::free(ptr); + } + }; + + /* + \brief Virtual allocator callback used to provide run-time defined allocators to foundation types like Array or Bitmap. + This is used by VirtualAllocator + */ + class PxVirtualAllocatorCallback + { + public: + PxVirtualAllocatorCallback() {} + virtual ~PxVirtualAllocatorCallback() {} + + virtual void* allocate(const size_t size, const int group, const char* file, const int line) = 0; + virtual void deallocate(void* ptr) = 0; + }; + + /* + \brief Virtual allocator to be used by foundation types to provide run-time defined allocators. + Due to the fact that Array extends its allocator, rather than contains a reference/pointer to it, the VirtualAllocator + must + be a concrete type containing a pointer to a virtual callback. The callback may not be available at instantiation time, + therefore + methods are provided to set the callback later. + */ + class PxVirtualAllocator + { + public: + PxVirtualAllocator(PxVirtualAllocatorCallback* callback = NULL, const int group = 0) : mCallback(callback), mGroup(group) {} + + PX_FORCE_INLINE void* allocate(const size_t size, const char* file, const int line) + { + PX_ASSERT(mCallback); + if (size) + return mCallback->allocate(size, mGroup, file, line); + return NULL; + } + + PX_FORCE_INLINE void deallocate(void* ptr) + { + PX_ASSERT(mCallback); + if (ptr) + mCallback->deallocate(ptr); + } + + private: + PxVirtualAllocatorCallback* mCallback; + const int mGroup; + PxVirtualAllocator& operator=(const PxVirtualAllocator&); + }; + + /** + Allocator used to access the global PxAllocatorCallback instance using a static name derived from T. + */ + template + class PxReflectionAllocator + { + static const char* getName() + { + if (!PxGetFoundation().getReportAllocationNames()) + return ""; +#if PX_GCC_FAMILY + return __PRETTY_FUNCTION__; +#else + // name() calls malloc(), raw_name() wouldn't + return typeid(T).name(); +#endif + } + + public: + PxReflectionAllocator(const PxEMPTY) {} + PxReflectionAllocator(const char* = 0) {} + + inline PxReflectionAllocator(const PxReflectionAllocator&) {} + + PX_FORCE_INLINE void* allocate(size_t size, const char* filename, int line) + { + return size ? PxGetBroadcastAllocator()->allocate(size, getName(), filename, line) : NULL; + } + + PX_FORCE_INLINE void deallocate(void* ptr) + { + if (ptr) + PxGetBroadcastAllocator()->deallocate(ptr); + } + }; + + template + struct PxAllocatorTraits + { + typedef PxReflectionAllocator Type; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocatorCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocatorCallback.h new file mode 100644 index 0000000..c82ceb0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAllocatorCallback.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ALLOCATOR_CALLBACK_H +#define PX_ALLOCATOR_CALLBACK_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxFoundationConfig.h" +#include "foundation/Px.h" +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\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. + +Threading: 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. + + Threading: 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(). + + Threading: 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; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAoS.h new file mode 100644 index 0000000..28e4cac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAoS.h @@ -0,0 +1,42 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_AOS_H +#define PX_AOS_H + +#include "foundation/Px.h" + +#if PX_WINDOWS && !PX_NEON && !PX_CLANG + #include "windows/PxWindowsAoS.h" +#elif (PX_UNIX_FAMILY || PX_SWITCH || PX_CLANG) + #include "unix/PxUnixAoS.h" +#else + #error "Platform not supported!" +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxArray.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxArray.h new file mode 100644 index 0000000..5b636f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxArray.h @@ -0,0 +1,721 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ARRAY_H +#define PX_ARRAY_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxMemory.h" + +namespace physx +{ + +/*! +An array is a sequential container. + +Implementation note +* entries between 0 and size are valid objects +* we use inheritance to build this because the array is included inline in a lot + of objects and we want the allocator to take no space if it's not stateful, which + aggregation doesn't allow. Also, we want the metadata at the front for the inline + case where the allocator contains some inline storage space +*/ +template ::Type> +class PxArray : protected Alloc +{ + public: + typedef T* Iterator; + typedef const T* ConstIterator; + + explicit PxArray(const PxEMPTY v) : Alloc(v) + { + if(mData) + mCapacity |= PX_SIGN_BITMASK; + } + + /*! + Default array constructor. Initialize an empty array + */ + PX_INLINE explicit PxArray(const Alloc& alloc = Alloc()) : Alloc(alloc), mData(0), mSize(0), mCapacity(0) + { + } + + /*! + Initialize array with given capacity + */ + PX_INLINE explicit PxArray(uint32_t size, const T& a = T(), const Alloc& alloc = Alloc()) + : Alloc(alloc), mData(0), mSize(0), mCapacity(0) + { + resize(size, a); + } + + /*! + Copy-constructor. Copy all entries from other array + */ + template + PX_INLINE explicit PxArray(const PxArray& other, const Alloc& alloc = Alloc()) + : Alloc(alloc) + { + copy(other); + } + + // This is necessary else the basic default copy constructor is used in the case of both arrays being of the same + // template instance + // The C++ standard clearly states that a template constructor is never a copy constructor [2]. In other words, + // the presence of a template constructor does not suppress the implicit declaration of the copy constructor. + // Also never make a copy constructor explicit, or copy-initialization* will no longer work. This is because + // 'binding an rvalue to a const reference requires an accessible copy constructor' (http://gcc.gnu.org/bugs/) + // *http://stackoverflow.com/questions/1051379/is-there-a-difference-in-c-between-copy-initialization-and-assignment-initializ + PX_INLINE PxArray(const PxArray& other, const Alloc& alloc = Alloc()) : Alloc(alloc) + { + copy(other); + } + + /*! + Initialize array with given length + */ + PX_INLINE explicit PxArray(const T* first, const T* last, const Alloc& alloc = Alloc()) + : Alloc(alloc), mSize(last < first ? 0 : uint32_t(last - first)), mCapacity(mSize) + { + mData = allocate(mSize); + copy(mData, mData + mSize, first); + } + + /*! + Destructor + */ + PX_INLINE ~PxArray() + { + destroy(mData, mData + mSize); + + if(capacity() && !isInUserMemory()) + deallocate(mData); + } + + /*! + Assignment operator. Copy content (deep-copy) + */ + template + PX_INLINE PxArray& operator=(const PxArray& rhs) + { + if(&rhs == this) + return *this; + + clear(); + reserve(rhs.mSize); + copy(mData, mData + rhs.mSize, rhs.mData); + + mSize = rhs.mSize; + return *this; + } + + PX_INLINE PxArray& operator=(const PxArray& t) // Needs to be declared, see comment at copy-constructor + { + return operator=(t); + } + + /*! + Array indexing operator. + \param i + The index of the element that will be returned. + \return + The element i in the array. + */ + PX_FORCE_INLINE const T& operator[](uint32_t i) const + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + /*! + Array indexing operator. + \param i + The index of the element that will be returned. + \return + The element i in the array. + */ + PX_FORCE_INLINE T& operator[](uint32_t i) + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + /*! + Returns a pointer to the initial element of the array. + \return + a pointer to the initial element of the array. + */ + PX_FORCE_INLINE ConstIterator begin() const + { + return mData; + } + + PX_FORCE_INLINE Iterator begin() + { + return mData; + } + + /*! + Returns an iterator beyond the last element of the array. Do not dereference. + \return + a pointer to the element beyond the last element of the array. + */ + + PX_FORCE_INLINE ConstIterator end() const + { + return mData + mSize; + } + + PX_FORCE_INLINE Iterator end() + { + return mData + mSize; + } + + /*! + Returns a reference to the first element of the array. Undefined if the array is empty. + \return a reference to the first element of the array + */ + + PX_FORCE_INLINE const T& front() const + { + PX_ASSERT(mSize); + return mData[0]; + } + + PX_FORCE_INLINE T& front() + { + PX_ASSERT(mSize); + return mData[0]; + } + + /*! + Returns a reference to the last element of the array. Undefined if the array is empty + \return a reference to the last element of the array + */ + + PX_FORCE_INLINE const T& back() const + { + PX_ASSERT(mSize); + return mData[mSize - 1]; + } + + PX_FORCE_INLINE T& back() + { + PX_ASSERT(mSize); + return mData[mSize - 1]; + } + + /*! + Returns the number of entries in the array. This can, and probably will, + differ from the array capacity. + \return + The number of of entries in the array. + */ + PX_FORCE_INLINE uint32_t size() const + { + return mSize; + } + + /*! + Clears the array. + */ + PX_INLINE void clear() + { + destroy(mData, mData + mSize); + mSize = 0; + } + + /*! + Returns whether the array is empty (i.e. whether its size is 0). + \return + true if the array is empty + */ + PX_FORCE_INLINE bool empty() const + { + return mSize == 0; + } + + /*! + Finds the first occurrence of an element in the array. + \param a + The element to find. + */ + + PX_INLINE Iterator find(const T& a) + { + uint32_t index; + for(index = 0; index < mSize && mData[index] != a; index++) + ; + return mData + index; + } + + PX_INLINE ConstIterator find(const T& a) const + { + uint32_t index; + for(index = 0; index < mSize && mData[index] != a; index++) + ; + return mData + index; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Adds one element to the end of the array. Operation is O(1). + \param a + The element that will be added to this array. + */ + ///////////////////////////////////////////////////////////////////////// + + PX_FORCE_INLINE T& pushBack(const T& a) + { + if(capacity() <= mSize) + return growAndPushBack(a); + + PX_PLACEMENT_NEW(reinterpret_cast(mData + mSize), T)(a); + + return mData[mSize++]; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Returns the element at the end of the array. Only legal if the array is non-empty. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE T popBack() + { + PX_ASSERT(mSize); + T t = mData[mSize - 1]; + + mData[--mSize].~T(); + + return t; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Construct one element at the end of the array. Operation is O(1). + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE T& insert() + { + if(capacity() <= mSize) + grow(capacityIncrement()); + + T* ptr = mData + mSize++; + PX_PLACEMENT_NEW(ptr, T); // not 'T()' because PODs should not get default-initialized. + return *ptr; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Subtracts the element on position i from the array and replace it with + the last element. + Operation is O(1) + \param i + The position of the element that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void replaceWithLast(uint32_t i) + { + PX_ASSERT(i < mSize); + mData[i] = mData[--mSize]; + + mData[mSize].~T(); + } + + PX_INLINE void replaceWithLast(Iterator i) + { + replaceWithLast(static_cast(i - mData)); + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Replaces the first occurrence of the element a with the last element + Operation is O(n) + \param a + The position of the element that will be subtracted from this array. + \return true if the element has been removed. + */ + ///////////////////////////////////////////////////////////////////////// + + PX_INLINE bool findAndReplaceWithLast(const T& a) + { + uint32_t index = 0; + while(index < mSize && mData[index] != a) + ++index; + if(index == mSize) + return false; + replaceWithLast(index); + return true; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Subtracts the element on position i from the array. Shift the entire + array one step. + Operation is O(n) + \param i + The position of the element that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void remove(uint32_t i) + { + PX_ASSERT(i < mSize); + + T* it = mData + i; + it->~T(); + while (++i < mSize) + { + PX_PLACEMENT_NEW(it, T(mData[i])); + ++it; + it->~T(); + } + --mSize; + } + + ///////////////////////////////////////////////////////////////////////// + /*! + Removes a range from the array. Shifts the array so order is maintained. + Operation is O(n) + \param begin + The starting position of the element that will be subtracted from this array. + \param count + The number of elments that will be subtracted from this array. + */ + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void removeRange(uint32_t begin, uint32_t count) + { + PX_ASSERT(begin < mSize); + PX_ASSERT((begin + count) <= mSize); + + for(uint32_t i = 0; i < count; i++) + mData[begin + i].~T(); // call the destructor on the ones being removed first. + + T* dest = &mData[begin]; // location we are copying the tail end objects to + T* src = &mData[begin + count]; // start of tail objects + uint32_t move_count = mSize - (begin + count); // compute remainder that needs to be copied down + + for(uint32_t i = 0; i < move_count; i++) + { + PX_PLACEMENT_NEW(dest, T(*src)); // copy the old one to the new location + src->~T(); // call the destructor on the old location + dest++; + src++; + } + mSize -= count; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Resize array + */ + ////////////////////////////////////////////////////////////////////////// + PX_NOINLINE void resize(const uint32_t size, const T& a = T()); + + PX_NOINLINE void resizeUninitialized(const uint32_t size); + + ////////////////////////////////////////////////////////////////////////// + /*! + Resize array such that only as much memory is allocated to hold the + existing elements + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void shrink() + { + recreate(mSize); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Deletes all array elements and frees memory. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void reset() + { + resize(0); + shrink(); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Resets or clears the array depending on occupancy. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void resetOrClear() + { + const PxU32 c = capacity(); + const PxU32 s = size(); + if(s>=c/2) + clear(); + else + reset(); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Ensure that the array has at least size capacity. + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void reserve(const uint32_t capacity) + { + if(capacity > this->capacity()) + grow(capacity); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Query the capacity(allocated mem) for the array. + */ + ////////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE uint32_t capacity() const + { + return mCapacity & ~PX_SIGN_BITMASK; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Unsafe function to force the size of the array + */ + ////////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE void forceSize_Unsafe(uint32_t size) + { + PX_ASSERT(size <= mCapacity); + mSize = size; + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Swap contents of an array without allocating temporary storage + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void swap(PxArray& other) + { + PxSwap(mData, other.mData); + PxSwap(mSize, other.mSize); + PxSwap(mCapacity, other.mCapacity); + } + + ////////////////////////////////////////////////////////////////////////// + /*! + Assign a range of values to this vector (resizes to length of range) + */ + ////////////////////////////////////////////////////////////////////////// + PX_INLINE void assign(const T* first, const T* last) + { + resizeUninitialized(uint32_t(last - first)); + copy(begin(), end(), first); + } + + // We need one bit to mark arrays that have been deserialized from a user-provided memory block. + // For alignment & memory saving purpose we store that bit in the rarely used capacity member. + PX_FORCE_INLINE uint32_t isInUserMemory() const + { + return mCapacity & PX_SIGN_BITMASK; + } + + /// return reference to allocator + PX_INLINE Alloc& getAllocator() + { + return *this; + } + + protected: + // constructor for where we don't own the memory + PxArray(T* memory, uint32_t size, uint32_t capacity, const Alloc& alloc = Alloc()) + : Alloc(alloc), mData(memory), mSize(size), mCapacity(capacity | PX_SIGN_BITMASK) + { + } + + template + PX_NOINLINE void copy(const PxArray& other); + + PX_INLINE T* allocate(uint32_t size) + { + if(size > 0) + { + T* p = reinterpret_cast(Alloc::allocate(sizeof(T) * size, __FILE__, __LINE__)); + PxMarkSerializedMemory(p, sizeof(T) * size); + return p; + } + return 0; + } + + PX_INLINE void deallocate(void* mem) + { + Alloc::deallocate(mem); + } + + static PX_INLINE void create(T* first, T* last, const T& a) + { + for(; first < last; ++first) + ::PX_PLACEMENT_NEW(first, T(a)); + } + + static PX_INLINE void copy(T* first, T* last, const T* src) + { + if(last <= first) + return; + + for(; first < last; ++first, ++src) + ::PX_PLACEMENT_NEW(first, T(*src)); + } + + static PX_INLINE void destroy(T* first, T* last) + { + for(; first < last; ++first) + first->~T(); + } + + /*! + Called when pushBack() needs to grow the array. + \param a The element that will be added to this array. + */ + PX_NOINLINE T& growAndPushBack(const T& a); + + /*! + Resizes the available memory for the array. + + \param capacity + The number of entries that the set should be able to hold. + */ + PX_INLINE void grow(uint32_t capacity) + { + PX_ASSERT(this->capacity() < capacity); + recreate(capacity); + } + + /*! + Creates a new memory block, copies all entries to the new block and destroys old entries. + + \param capacity + The number of entries that the set should be able to hold. + */ + PX_NOINLINE void recreate(uint32_t capacity); + + // The idea here is to prevent accidental bugs with pushBack or insert. Unfortunately + // it interacts badly with InlineArrays with smaller inline allocations. + // TODO(dsequeira): policy template arg, this is exactly what they're for. + PX_INLINE uint32_t capacityIncrement() const + { + const uint32_t capacity = this->capacity(); + return capacity == 0 ? 1 : capacity * 2; + } + + T* mData; + uint32_t mSize; + uint32_t mCapacity; +}; + +template +PX_NOINLINE void PxArray::resize(const uint32_t size, const T& a) +{ + reserve(size); + create(mData + mSize, mData + size, a); + destroy(mData + size, mData + mSize); + mSize = size; +} + +template +template +PX_NOINLINE void PxArray::copy(const PxArray& other) +{ + if(!other.empty()) + { + mData = allocate(mSize = mCapacity = other.size()); + copy(mData, mData + mSize, other.begin()); + } + else + { + mData = NULL; + mSize = 0; + mCapacity = 0; + } + + // mData = allocate(other.mSize); + // mSize = other.mSize; + // mCapacity = other.mSize; + // copy(mData, mData + mSize, other.mData); +} + +template +PX_NOINLINE void PxArray::resizeUninitialized(const uint32_t size) +{ + reserve(size); + mSize = size; +} + +template +PX_NOINLINE T& PxArray::growAndPushBack(const T& a) +{ + uint32_t capacity = capacityIncrement(); + + T* newData = allocate(capacity); + PX_ASSERT((!capacity) || (newData && (newData != mData))); + copy(newData, newData + mSize, mData); + + // inserting element before destroying old array + // avoids referencing destroyed object when duplicating array element. + PX_PLACEMENT_NEW(reinterpret_cast(newData + mSize), T)(a); + + destroy(mData, mData + mSize); + if(!isInUserMemory()) + deallocate(mData); + + mData = newData; + mCapacity = capacity; + + return mData[mSize++]; +} + +template +PX_NOINLINE void PxArray::recreate(uint32_t capacity) +{ + T* newData = allocate(capacity); + PX_ASSERT((!capacity) || (newData && (newData != mData))); + + copy(newData, newData + mSize, mData); + destroy(mData, mData + mSize); + if(!isInUserMemory()) + deallocate(mData); + + mData = newData; + mCapacity = capacity; +} + +template +PX_INLINE void swap(PxArray& x, PxArray& y) +{ + x.swap(y); +} + +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAssert.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAssert.h new file mode 100644 index 0000000..6f310ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAssert.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ASSERT_H +#define PX_ASSERT_H + +#include "foundation/PxFoundationConfig.h" +#include "foundation/Px.h" + +/** \addtogroup foundation + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * @brief Base class to handle assert failures + * @deprecated + */ +class PxAssertHandler +{ + public: + virtual ~PxAssertHandler() + { + } + virtual void operator()(const char* exp, const char* file, int line, bool& ignore) = 0; +}; + +/** + * @deprecated + */ +PX_FOUNDATION_API PxAssertHandler& PxGetAssertHandler(); + +/** + * @deprecated + */ +PX_FOUNDATION_API void PxSetAssertHandler(PxAssertHandler& handler); + + +#if !PX_ENABLE_ASSERTS + #define PX_ASSERT(exp) ((void)0) + #define PX_ALWAYS_ASSERT_MESSAGE(exp) ((void)0) + #define PX_ASSERT_WITH_MESSAGE(condition, message) ((void)0) +#else +#if PX_VC + #define PX_CODE_ANALYSIS_ASSUME(exp) \ + __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a PX_ASSERT is used + // to "guard" illegal mem access, for example. +#else + #define PX_CODE_ANALYSIS_ASSUME(exp) +#endif + #define PX_ASSERT(exp) \ + { \ + static bool _ignore = false; \ + ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(#exp, __FILE__, __LINE__, _ignore), false)))); \ + PX_CODE_ANALYSIS_ASSUME(exp); \ + } + #define PX_ALWAYS_ASSERT_MESSAGE(exp) \ + { \ + static bool _ignore = false; \ + if(!_ignore) \ + physx::PxGetAssertHandler()(exp, __FILE__, __LINE__, _ignore); \ + } + #define PX_ASSERT_WITH_MESSAGE(exp, message) \ + { \ + static bool _ignore = false; \ + ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(message, __FILE__, __LINE__, _ignore), false)))); \ + PX_CODE_ANALYSIS_ASSUME(exp); \ + } +#endif // !PX_ENABLE_ASSERTS + +#define PX_ALWAYS_ASSERT() PX_ASSERT(0) + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAtomic.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAtomic.h new file mode 100644 index 0000000..5cf4a16 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxAtomic.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ATOMIC_H +#define PX_ATOMIC_H + +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/* set *dest equal to val. Return the old value of *dest */ +PX_FOUNDATION_API PxI32 PxAtomicExchange(volatile PxI32* dest, PxI32 val); + +/* if *dest == comp, replace with exch. Return original value of *dest */ +PX_FOUNDATION_API PxI32 PxAtomicCompareExchange(volatile PxI32* dest, PxI32 exch, PxI32 comp); + +/* if *dest == comp, replace with exch. Return original value of *dest */ +PX_FOUNDATION_API void* PxAtomicCompareExchangePointer(volatile void** dest, void* exch, void* comp); + +/* increment the specified location. Return the incremented value */ +PX_FOUNDATION_API PxI32 PxAtomicIncrement(volatile PxI32* val); + +/* decrement the specified location. Return the decremented value */ +PX_FOUNDATION_API PxI32 PxAtomicDecrement(volatile PxI32* val); + +/* add delta to *val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicAdd(volatile PxI32* val, PxI32 delta); + +/* compute the maximum of dest and val. Return the new value */ +PX_FOUNDATION_API PxI32 PxAtomicMax(volatile PxI32* val, PxI32 val2); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBasicTemplates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBasicTemplates.h new file mode 100644 index 0000000..7243e5d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBasicTemplates.h @@ -0,0 +1,147 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BASIC_TEMPLATES_H +#define PX_BASIC_TEMPLATES_H + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + template + struct PxEqual + { + bool operator()(const A& a, const A& b) const + { + return a == b; + } + }; + + template + struct PxLess + { + bool operator()(const A& a, const A& b) const + { + return a < b; + } + }; + + template + struct PxGreater + { + bool operator()(const A& a, const A& b) const + { + return a > b; + } + }; + + template + class PxPair + { + public: + F first; + S second; + PX_CUDA_CALLABLE PxPair() : first(F()), second(S()) + { + } + PX_CUDA_CALLABLE PxPair(const F& f, const S& s) : first(f), second(s) + { + } + PX_CUDA_CALLABLE PxPair(const PxPair& p) : first(p.first), second(p.second) + { + } + // CN - fix for /.../PxBasicTemplates.h(61) : warning C4512: 'physx::PxPair' : assignment operator could + // not be generated + PX_CUDA_CALLABLE PxPair& operator=(const PxPair& p) + { + first = p.first; + second = p.second; + return *this; + } + PX_CUDA_CALLABLE bool operator==(const PxPair& p) const + { + return first == p.first && second == p.second; + } + PX_CUDA_CALLABLE bool operator<(const PxPair& p) const + { + if (first < p.first) + return true; + else + return !(p.first < first) && (second < p.second); + } + }; + + template + struct PxLogTwo + { + static const unsigned int value = PxLogTwo<(A >> 1)>::value + 1; + }; + template <> + struct PxLogTwo<1> + { + static const unsigned int value = 0; + }; + + template + struct PxUnConst + { + typedef T Type; + }; + template + struct PxUnConst + { + typedef T Type; + }; + + template + T PxPointerOffset(void* p, ptrdiff_t offset) + { + return reinterpret_cast(reinterpret_cast(p) + offset); + } + template + T PxPointerOffset(const void* p, ptrdiff_t offset) + { + return reinterpret_cast(reinterpret_cast(p) + offset); + } + + template + PX_CUDA_CALLABLE PX_INLINE void PxSwap(T& x, T& y) + { + const T tmp = x; + x = y; + y = tmp; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitAndData.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitAndData.h new file mode 100644 index 0000000..38f937b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitAndData.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BIT_AND_DATA_H +#define PX_BIT_AND_DATA_H + +#include "foundation/Px.h" + +/** \addtogroup foundation + @{ +*/ +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template +class PxBitAndDataT +{ + public: + PX_FORCE_INLINE PxBitAndDataT(const PxEMPTY) + { + } + PX_FORCE_INLINE PxBitAndDataT() : mData(0) + { + } + PX_FORCE_INLINE PxBitAndDataT(storageType data, bool bit = false) + { + mData = bit ? storageType(data | bitMask) : data; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE operator storageType() const + { + return storageType(mData & ~bitMask); + } + PX_CUDA_CALLABLE PX_FORCE_INLINE void setBit() + { + mData |= bitMask; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE void clearBit() + { + mData &= ~bitMask; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE storageType isBitSet() const + { + return storageType(mData & bitMask); + } + + protected: + storageType mData; +}; +typedef PxBitAndDataT PxBitAndByte; +typedef PxBitAndDataT PxBitAndWord; +typedef PxBitAndDataT PxBitAndDword; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitMap.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitMap.h new file mode 100644 index 0000000..cb7ce9d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitMap.h @@ -0,0 +1,480 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BITMAP_H +#define PX_BITMAP_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMath.h" +#include "foundation/PxMemory.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBitUtils.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /*! + Hold a bitmap with operations to set,reset or test given bit. + + We inhibit copy to prevent unintentional copies. If a copy is desired copy() should be used or + alternatively a copy constructor implemented. + */ + template + class PxBitMapBase : public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_NOCOPY(PxBitMapBase) + + public: + + // PX_SERIALIZATION + /* todo: explicit */ PxBitMapBase(const PxEMPTY) + { + if (mMap) + mWordCount |= PX_SIGN_BITMASK; + } + //~PX_SERIALIZATION + + PX_INLINE PxBitMapBase(const PxAllocator& allocator) : mMap(0), mWordCount(0), mAllocator(allocator) {} + + PX_INLINE PxBitMapBase() : mMap(0), mWordCount(0) {} + + PX_INLINE ~PxBitMapBase() + { + release(); + } + + PX_INLINE void release() + { + if (mMap && !isInUserMemory()) + mAllocator.deallocate(mMap); + mMap = NULL; + } + + PX_INLINE PxAllocator& getAllocator() { return mAllocator; } + + PX_INLINE void growAndSet(PxU32 index) + { + extend(index + 1); + mMap[index >> 5] |= 1 << (index & 31); + } + + PX_INLINE void growAndReset(PxU32 index) + { + extend(index + 1); + mMap[index >> 5] &= ~(1 << (index & 31)); + } + + PX_INLINE PxIntBool boundedTest(PxU32 index) const + { + return PxIntBool(index >> 5 >= getWordCount() ? PxIntFalse : (mMap[index >> 5] & (1 << (index & 31)))); + } + + PX_INLINE void boundedReset(PxU32 index) + { + if((index >> 5) < getWordCount()) + mMap[index >> 5] &= ~(1 << (index & 31)); + } + + // Special optimized versions, when you _know_ your index is in range + PX_INLINE void set(PxU32 index) + { + PX_ASSERT(index> 5] |= 1 << (index & 31); + } + + PX_INLINE void reset(PxU32 index) + { + PX_ASSERT(index> 5] &= ~(1 << (index & 31)); + } + + PX_INLINE PxIntBool test(PxU32 index) const + { + PX_ASSERT(index> 5] & (1 << (index & 31))); + } + + // nibble == 4 bits + PX_INLINE PxU32 getNibbleFast(PxU32 nibIndex) const + { + const PxU32 bitIndex = nibIndex << 2; + PX_ASSERT(bitIndex < getWordCount() * 32); + return (mMap[bitIndex >> 5] >> (bitIndex & 31)) & 0xf; + } + + PX_INLINE void andNibbleFast(PxU32 nibIndex, PxU32 mask) + { + //TODO: there has to be a faster way... + const PxU32 bitIndex = nibIndex << 2; + const PxU32 shift = (bitIndex & 31); + const PxU32 nibMask = (0xfu << shift); + + PX_ASSERT(bitIndex < getWordCount() * 32); + + mMap[bitIndex >> 5] &= ((mask << shift) | ~nibMask); + } + + PX_INLINE void orNibbleFast(PxU32 nibIndex, PxU32 mask) + { + PX_ASSERT(!(mask & ~0xfu)); //check extra bits are not set + + const PxU32 bitIndex = nibIndex << 2; + const PxU32 shift = bitIndex & 31; + + PX_ASSERT(bitIndex < getWordCount() * 32); + + mMap[bitIndex >> 5] |= (mask << shift); + } + + void clear() + { + PxMemSet(mMap, 0, getWordCount() * sizeof(PxU32)); + } + + void resizeAndClear(PxU32 newBitCount) + { + extendUninitialized(newBitCount); + PxMemSet(mMap, 0, getWordCount() * sizeof(PxU32)); + } + + void setEmpty() + { + mMap = NULL; + mWordCount = 0; + } + + void setWords(PxU32* map, PxU32 wordCount) + { + mMap = map; + mWordCount = wordCount; + mWordCount |= PX_SIGN_BITMASK; + } + + // !!! only sets /last/ bit to value + void resize(PxU32 newBitCount, bool value = false) + { + PX_ASSERT(!value); // only new class supports this + PX_UNUSED(value); + extend(newBitCount); + } + + PxU32 size() const { return getWordCount() * 32; } + + void copy(const PxBitMapBase& a) + { + extendUninitialized(a.getWordCount() << 5); + PxMemCopy(mMap, a.mMap, a.getWordCount() * sizeof(PxU32)); + if (getWordCount() > a.getWordCount()) + PxMemSet(mMap + a.getWordCount(), 0, (getWordCount() - a.getWordCount()) * sizeof(PxU32)); + } + + PX_INLINE PxU32 count() const + { + // NOTE: we can probably do this faster, since the last steps in PxcBitCount32 can be defered to + // the end of the seq. + 64/128bits at a time + native bit counting instructions(360 is fast non micro code). + PxU32 count = 0; + const PxU32 wordCount = getWordCount(); + for (PxU32 i = 0; i 0;) + { + if (mMap[i]) + return (i << 5) + PxHighestSetBit(mMap[i]); + } + return PxU32(0); + } + + // the obvious combiners and some used in the SDK + + struct OR { PX_INLINE PxU32 operator()(PxU32 a, PxU32 b) { return a | b; } }; + struct AND { PX_INLINE PxU32 operator()(PxU32 a, PxU32 b) { return a&b; } }; + struct XOR { PX_INLINE PxU32 operator()(PxU32 a, PxU32 b) { return a^b; } }; + + // we use auxiliary functions here so as not to generate combiners for every combination + // of allocators + + template + PX_INLINE void combineInPlace(const PxBitMapBase<_>& b) + { + combine1(b.mMap, b.getWordCount()); + } + + template + PX_INLINE void combine(const PxBitMapBase<_1>& a, const PxBitMapBase<_2>& b) + { + combine2(a.mMap, a.getWordCount(), b.mMap, b.getWordCount()); + } + + PX_FORCE_INLINE const PxU32* getWords() const { return mMap; } + PX_FORCE_INLINE PxU32* getWords() { return mMap; } + + // PX_SERIALIZATION + PX_FORCE_INLINE PxU32 getWordCount() const { return mWordCount & ~PX_SIGN_BITMASK; } + + // We need one bit to mark arrays that have been deserialized from a user-provided memory block. + PX_FORCE_INLINE PxU32 isInUserMemory() const { return mWordCount & PX_SIGN_BITMASK; } + //~PX_SERIALIZATION + + /*! + Iterate over indices in a bitmap + + This iterator is good because it finds the set bit without looping over the cached bits upto 31 times. + However it does require a variable shift. + */ + + class Iterator + { + public: + static const PxU32 DONE = 0xffffffff; + + PX_INLINE Iterator(const PxBitMapBase &map) : mBitMap(map) + { + reset(); + } + + PX_INLINE Iterator& operator=(const Iterator& other) + { + PX_ASSERT(&mBitMap == &other.mBitMap); + mBlock = other.mBlock; + mIndex = other.mIndex; + return *this; + } + + PX_INLINE PxU32 getNext() + { + if (mBlock) + { + PxU32 bitIndex = mIndex << 5 | PxLowestSetBit(mBlock); + mBlock &= mBlock - 1; + PxU32 wordCount = mBitMap.getWordCount(); + while (!mBlock && ++mIndex < wordCount) + mBlock = mBitMap.mMap[mIndex]; + return bitIndex; + } + return DONE; + } + + PX_INLINE void reset() + { + mIndex = mBlock = 0; + PxU32 wordCount = mBitMap.getWordCount(); + while (mIndex < wordCount && ((mBlock = mBitMap.mMap[mIndex]) == 0)) + ++mIndex; + } + private: + PxU32 mBlock, mIndex; + const PxBitMapBase& mBitMap; + }; + + // DS: faster but less general: hasBits() must be true or getNext() is illegal so it is the calling code's responsibility to ensure that getNext() is not called illegally. + class PxLoopIterator + { + PX_NOCOPY(PxLoopIterator) + + public: + PX_FORCE_INLINE PxLoopIterator(const PxBitMapBase &map) : mMap(map.getWords()), mBlock(0), mIndex(-1), mWordCount(PxI32(map.getWordCount())) {} + + PX_FORCE_INLINE bool hasBits() + { + PX_ASSERT(mIndex> 5; + if (newWordCount > getWordCount()) + { + PxU32* newMap = reinterpret_cast(mAllocator.allocate(newWordCount * sizeof(PxU32), __FILE__, __LINE__)); + if (mMap) + { + PxMemCopy(newMap, mMap, getWordCount() * sizeof(PxU32)); + if (!isInUserMemory()) + mAllocator.deallocate(mMap); + } + PxMemSet(newMap + getWordCount(), 0, (newWordCount - getWordCount()) * sizeof(PxU32)); + mMap = newMap; + // also resets the isInUserMemory bit + mWordCount = newWordCount; + } + } + + void extendUninitialized(PxU32 size) + { + PxU32 newWordCount = (size + 31) >> 5; + if (newWordCount > getWordCount()) + { + if (mMap && !isInUserMemory()) + mAllocator.deallocate(mMap); + // also resets the isInUserMemory bit + mWordCount = newWordCount; + mMap = reinterpret_cast(mAllocator.allocate(mWordCount * sizeof(PxU32), __FILE__, __LINE__)); + } + } + + template + void combine1(const PxU32* words, PxU32 length) + { + extend(length << 5); + PxU32 combineLength = PxMin(getWordCount(), length); + for (PxU32 i = 0; i + void combine2(const PxU32* words1, PxU32 length1, + const PxU32* words2, PxU32 length2) + { + extendUninitialized(PxMax(length1, length2) << 5); + + PxU32 commonSize = PxMin(length1, length2); + + for (PxU32 i = 0; i PxBitMap; + typedef PxBitMapBase PxBitMapPinned; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitUtils.h new file mode 100644 index 0000000..49942c1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBitUtils.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BIT_UTILS_H +#define PX_BIT_UTILS_H + +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAssert.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxMathIntrinsics.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +PX_INLINE uint32_t PxBitCount(uint32_t v) +{ + // from http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + uint32_t const w = v - ((v >> 1) & 0x55555555); + uint32_t const x = (w & 0x33333333) + ((w >> 2) & 0x33333333); + return (((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; +} + +PX_INLINE bool PxIsPowerOfTwo(uint32_t x) +{ + return x != 0 && (x & (x - 1)) == 0; +} + +// "Next Largest Power of 2 +// Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm +// that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with +// the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next +// largest power of 2. For a 32-bit value:" +PX_INLINE uint32_t PxNextPowerOfTwo(uint32_t x) +{ + x |= (x >> 1); + x |= (x >> 2); + x |= (x >> 4); + x |= (x >> 8); + x |= (x >> 16); + return x + 1; +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ + +PX_INLINE uint32_t PxLowestSetBit(uint32_t x) +{ + PX_ASSERT(x); + return PxLowestSetBitUnsafe(x); +} + +/*! +Return the index of the highest set bit. Not valid for zero arg. +*/ + +PX_INLINE uint32_t PxHighestSetBit(uint32_t x) +{ + PX_ASSERT(x); + return PxHighestSetBitUnsafe(x); +} + +// Helper function to approximate log2 of an integer value +// assumes that the input is actually power of two. +PX_INLINE uint32_t PxILog2(uint32_t num) +{ + for(uint32_t i = 0; i < 32; i++) + { + num >>= 1; + if(num == 0) + return i; + } + + PX_ASSERT(0); + return uint32_t(-1); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBounds3.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBounds3.h new file mode 100644 index 0000000..40d0ebe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBounds3.h @@ -0,0 +1,501 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BOUNDS3_H +#define PX_BOUNDS3_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// maximum extents defined such that floating point exceptions are avoided for standard use cases +#define PX_MAX_BOUNDS_EXTENTS (PX_MAX_REAL * 0.25f) + +/** +\brief Class representing 3D range or axis aligned bounding box. + +Stored as minimum and maximum extent corners. Alternate representation +would be center and dimensions. +May be empty or nonempty. For nonempty bounds, minimum <= maximum has to hold for all axes. +Empty bounds have to be represented as minimum = PX_MAX_BOUNDS_EXTENTS and maximum = -PX_MAX_BOUNDS_EXTENTS for all +axes. +All other representations are invalid and the behavior is undefined. +*/ +class PxBounds3 +{ + public: + /** + \brief Default constructor, not performing any initialization for performance reason. + \remark Use empty() function below to construct empty bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3() + { + } + + /** + \brief Construct from two bounding points + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3(const PxVec3& minimum, const PxVec3& maximum); + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator=(const PxBounds3& other) + { + minimum = other.minimum; + maximum = other.maximum; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3(const PxBounds3& other) + { + minimum = other.minimum; + maximum = other.maximum; + } + + /** + \brief Return empty bounds. + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 empty(); + + /** + \brief returns the AABB containing v0 and v1. + \param v0 first point included in the AABB. + \param v1 second point included in the AABB. + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 boundsOfPoints(const PxVec3& v0, const PxVec3& v1); + + /** + \brief returns the AABB from center and extents vectors. + \param center Center vector + \param extent Extents vector + */ + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 centerExtents(const PxVec3& center, const PxVec3& extent); + + /** + \brief Construct from center, extent, and (not necessarily orthogonal) basis + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 basisExtent(const PxVec3& center, const PxMat33& basis, const PxVec3& extent); + + /** + \brief Construct from pose and extent + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 poseExtent(const PxTransform& pose, const PxVec3& extent); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + This version is safe to call for empty bounds. + + \param[in] matrix Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformSafe(const PxMat33& matrix, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + Calling this method for empty bounds leads to undefined behavior. Use #transformSafe() instead. + + \param[in] matrix Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformFast(const PxMat33& matrix, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + This version is safe to call for empty bounds. + + \param[in] transform Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformSafe(const PxTransform& transform, const PxBounds3& bounds); + + /** + \brief gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + + Calling this method for empty bounds leads to undefined behavior. Use #transformSafe() instead. + + \param[in] transform Transform to apply, can contain scaling as well + \param[in] bounds The bounds to transform. + */ + static PX_CUDA_CALLABLE PX_INLINE PxBounds3 transformFast(const PxTransform& transform, const PxBounds3& bounds); + + /** + \brief Sets empty to true + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void setEmpty(); + + /** + \brief Sets the bounds to maximum size [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS]. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void setMaximal(); + + /** + \brief expands the volume to include v + \param v Point to expand to. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void include(const PxVec3& v); + + /** + \brief expands the volume to include b. + \param b Bounds to perform union with. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void include(const PxBounds3& b); + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isEmpty() const; + + /** + \brief indicates whether the intersection of this and b is empty or not. + \param b Bounds to test for intersection. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects(const PxBounds3& b) const; + + /** + \brief computes the 1D-intersection between two AABBs, on a given axis. + \param a the other AABB + \param axis the axis (0, 1, 2) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool intersects1D(const PxBounds3& a, uint32_t axis) const; + + /** + \brief indicates if these bounds contain v. + \param v Point to test against bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool contains(const PxVec3& v) const; + + /** + \brief checks a box is inside another box. + \param box the other AABB + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isInside(const PxBounds3& box) const; + + /** + \brief returns the center of this axis aligned box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getCenter() const; + + /** + \brief get component of the box's center along a given axis + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getCenter(uint32_t axis) const; + + /** + \brief get component of the box's extents along a given axis + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getExtents(uint32_t axis) const; + + /** + \brief returns the dimensions (width/height/depth) of this axis aligned box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getDimensions() const; + + /** + \brief returns the extents, which are half of the width/height/depth. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getExtents() const; + + /** + \brief scales the AABB. + + This version is safe to call for empty bounds. + + \param scale Factor to scale AABB by. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleSafe(float scale); + + /** + \brief scales the AABB. + + Calling this method for empty bounds leads to undefined behavior. Use #scaleSafe() instead. + + \param scale Factor to scale AABB by. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void scaleFast(float scale); + + /** + fattens the AABB in all 3 dimensions by the given distance. + + This version is safe to call for empty bounds. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenSafe(float distance); + + /** + fattens the AABB in all 3 dimensions by the given distance. + + Calling this method for empty bounds leads to undefined behavior. Use #fattenSafe() instead. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE void fattenFast(float distance); + + /** + checks that the AABB values are not NaN + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const; + + /** + checks that the AABB values describe a valid configuration. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid() const; + + /** + Finds the closest point in the box to the point p. If p is contained, this will be p, otherwise it + will be the closest point on the surface of the box. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 closestPoint(const PxVec3& p) const; + + PxVec3 minimum, maximum; +}; + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3::PxBounds3(const PxVec3& minimum_, const PxVec3& maximum_) +: minimum(minimum_), maximum(maximum_) +{ +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::empty() +{ + return PxBounds3(PxVec3(PX_MAX_BOUNDS_EXTENTS), PxVec3(-PX_MAX_BOUNDS_EXTENTS)); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isFinite() const +{ + return minimum.isFinite() && maximum.isFinite(); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::boundsOfPoints(const PxVec3& v0, const PxVec3& v1) +{ + return PxBounds3(v0.minimum(v1), v0.maximum(v1)); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxBounds3 PxBounds3::centerExtents(const PxVec3& center, const PxVec3& extent) +{ + return PxBounds3(center - extent, center + extent); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 +PxBounds3::basisExtent(const PxVec3& center, const PxMat33& basis, const PxVec3& extent) +{ + // extended basis vectors + const PxVec3 c0 = basis.column0 * extent.x; + const PxVec3 c1 = basis.column1 * extent.y; + const PxVec3 c2 = basis.column2 * extent.z; + + // find combination of base vectors that produces max. distance for each component = sum of abs() + const PxVec3 w( PxAbs(c0.x) + PxAbs(c1.x) + PxAbs(c2.x), + PxAbs(c0.y) + PxAbs(c1.y) + PxAbs(c2.y), + PxAbs(c0.z) + PxAbs(c1.z) + PxAbs(c2.z)); + + return PxBounds3(center - w, center + w); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::poseExtent(const PxTransform& pose, const PxVec3& extent) +{ + return basisExtent(pose.p, PxMat33(pose.q), extent); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setEmpty() +{ + minimum = PxVec3(PX_MAX_BOUNDS_EXTENTS); + maximum = PxVec3(-PX_MAX_BOUNDS_EXTENTS); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setMaximal() +{ + minimum = PxVec3(-PX_MAX_BOUNDS_EXTENTS); + maximum = PxVec3(PX_MAX_BOUNDS_EXTENTS); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxVec3& v) +{ + PX_ASSERT(isValid()); + minimum = minimum.minimum(v); + maximum = maximum.maximum(v); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxBounds3& b) +{ + PX_ASSERT(isValid()); + minimum = minimum.minimum(b.minimum); + maximum = maximum.maximum(b.maximum); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isEmpty() const +{ + PX_ASSERT(isValid()); + return minimum.x > maximum.x; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects(const PxBounds3& b) const +{ + PX_ASSERT(isValid() && b.isValid()); + return !(b.minimum.x > maximum.x || minimum.x > b.maximum.x || b.minimum.y > maximum.y || minimum.y > b.maximum.y || + b.minimum.z > maximum.z || minimum.z > b.maximum.z); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects1D(const PxBounds3& a, uint32_t axis) const +{ + PX_ASSERT(isValid() && a.isValid()); + return maximum[axis] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis]; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const +{ + PX_ASSERT(isValid()); + + return !(v.x < minimum.x || v.x > maximum.x || v.y < minimum.y || v.y > maximum.y || v.z < minimum.z || + v.z > maximum.z); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) const +{ + PX_ASSERT(isValid() && box.isValid()); + if(box.minimum.x > minimum.x) + return false; + if(box.minimum.y > minimum.y) + return false; + if(box.minimum.z > minimum.z) + return false; + if(box.maximum.x < maximum.x) + return false; + if(box.maximum.y < maximum.y) + return false; + if(box.maximum.z < maximum.z) + return false; + return true; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getCenter() const +{ + PX_ASSERT(isValid()); + return (minimum + maximum) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getCenter(uint32_t axis) const +{ + PX_ASSERT(isValid()); + return (minimum[axis] + maximum[axis]) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getExtents(uint32_t axis) const +{ + PX_ASSERT(isValid()); + return (maximum[axis] - minimum[axis]) * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getDimensions() const +{ + PX_ASSERT(isValid()); + return maximum - minimum; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getExtents() const +{ + PX_ASSERT(isValid()); + return getDimensions() * 0.5f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleSafe(float scale) +{ + PX_ASSERT(isValid()); + if(!isEmpty()) + scaleFast(scale); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleFast(float scale) +{ + PX_ASSERT(isValid()); + *this = centerExtents(getCenter(), getExtents() * scale); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenSafe(float distance) +{ + PX_ASSERT(isValid()); + if(!isEmpty()) + fattenFast(distance); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) +{ + PX_ASSERT(isValid()); + minimum.x -= distance; + minimum.y -= distance; + minimum.z -= distance; + + maximum.x += distance; + maximum.y += distance; + maximum.z += distance; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxMat33& matrix, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return !bounds.isEmpty() ? transformFast(matrix, bounds) : bounds; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxMat33& matrix, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return PxBounds3::basisExtent(matrix * bounds.getCenter(), matrix, bounds.getExtents()); +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxTransform& transform, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return !bounds.isEmpty() ? transformFast(transform, bounds) : bounds; +} + +PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxTransform& transform, const PxBounds3& bounds) +{ + PX_ASSERT(bounds.isValid()); + return PxBounds3::basisExtent(transform.transform(bounds.getCenter()), PxMat33(transform.q), bounds.getExtents()); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isValid() const +{ + return (isFinite() && (((minimum.x <= maximum.x) && (minimum.y <= maximum.y) && (minimum.z <= maximum.z)) || + ((minimum.x == PX_MAX_BOUNDS_EXTENTS) && (minimum.y == PX_MAX_BOUNDS_EXTENTS) && + (minimum.z == PX_MAX_BOUNDS_EXTENTS) && (maximum.x == -PX_MAX_BOUNDS_EXTENTS) && + (maximum.y == -PX_MAX_BOUNDS_EXTENTS) && (maximum.z == -PX_MAX_BOUNDS_EXTENTS)))); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::closestPoint(const PxVec3& p) const +{ + return minimum.maximum(maximum.minimum(p)); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBroadcast.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBroadcast.h new file mode 100644 index 0000000..2d16089 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxBroadcast.h @@ -0,0 +1,276 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BROADCAST_H +#define PX_BROADCAST_H + +#include "foundation/PxInlineArray.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Abstract listener class that listens to allocation and deallocation events from the + foundation memory system. + +Threading: 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 PxAllocationListener +{ + public: + /** + \brief callback when memory is allocated. + \param size Size of the allocation in bytes. + \param typeName Type this data is being allocated for. + \param filename File the allocation came from. + \param line the allocation came from. + \param allocatedMemory memory that will be returned from the allocation. + */ + virtual void onAllocation(size_t size, const char* typeName, const char* filename, int line, + void* allocatedMemory) = 0; + + /** + \brief callback when memory is deallocated. + \param allocatedMemory memory just before allocation. + */ + virtual void onDeallocation(void* allocatedMemory) = 0; + + protected: + virtual ~PxAllocationListener() + { + } +}; + +/** +\brief Broadcast class implementation, registering listeners. + +Threading: All methods of this class should be thread safe as it can be called from the user thread +or the physics processing thread(s). There is not internal locking +*/ +template +class PxBroadcast : public Base +{ + public: + static const uint32_t MAX_NB_LISTENERS = 16; + + /** + \brief The default constructor. + */ + PxBroadcast() + { + } + + /** + \brief Register new listener. + + \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. + moreover, there is no thread safety to registration/deregistration. + + \param listener Listener to register. + */ + void registerListener(Listener& listener) + { + if(mListeners.size() < MAX_NB_LISTENERS) + mListeners.pushBack(&listener); + } + + /** + \brief Deregister an existing listener. + + \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. + moreover, there is no thread safety to registration/deregistration. + + \param listener Listener to deregister. + */ + void deregisterListener(Listener& listener) + { + mListeners.findAndReplaceWithLast(&listener); + } + + /** + \brief Get number of registered listeners. + + \return Number of listeners. + */ + uint32_t getNbListeners() const + { + return mListeners.size(); + } + + /** + \brief Get an existing listener from given index. + + \param index Index of the listener. + \return Listener on given index. + */ + Listener& getListener(uint32_t index) + { + PX_ASSERT(index <= mListeners.size()); + return *mListeners[index]; + } + + protected: + virtual ~PxBroadcast() + { + } + + physx::PxInlineArray mListeners; +}; + +/** +\brief Abstract base class for an application defined memory allocator that allows an external listener +to audit the memory allocations. +*/ +class PxBroadcastingAllocator : public PxBroadcast +{ + PX_NOCOPY(PxBroadcastingAllocator) + + public: + /** + \brief The default constructor. + */ + PxBroadcastingAllocator(PxAllocatorCallback& allocator, PxErrorCallback& error) : mAllocator(allocator), mError(error) + { + mListeners.clear(); + } + + /** + \brief The default constructor. + */ + virtual ~PxBroadcastingAllocator() + { + mListeners.clear(); + } + + /** + \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. + + Threading: 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. + */ + void* allocate(size_t size, const char* typeName, const char* filename, int line) + { + void* mem = mAllocator.allocate(size, typeName, filename, line); + + if(!mem) + { + mError.reportError(PxErrorCode::eABORT, "User allocator returned NULL.", __FILE__, __LINE__); + return NULL; + } + + if((size_t(mem) & 15)) + { + mError.reportError(PxErrorCode::eABORT, "Allocations must be 16-byte aligned.", __FILE__, __LINE__); + return NULL; + } + + for(uint32_t i = 0; i < mListeners.size(); i++) + mListeners[i]->onAllocation(size, typeName, filename, line, mem); + + return mem; + } + + /** + \brief Frees memory previously allocated by allocate(). + + Threading: 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. + */ + void deallocate(void* ptr) + { + for(uint32_t i = 0; i < mListeners.size(); i++) + { + mListeners[i]->onDeallocation(ptr); + } + mAllocator.deallocate(ptr); + } + + private: + PxAllocatorCallback& mAllocator; + PxErrorCallback& mError; +}; + +/** +\brief Abstract base class for an application defined error callback that allows an external listener +to report errors. +*/ +class PxBroadcastingErrorCallback : public PxBroadcast +{ + PX_NOCOPY(PxBroadcastingErrorCallback) + public: + /** + \brief The default constructor. + */ + PxBroadcastingErrorCallback(PxErrorCallback& errorCallback) + { + registerListener(errorCallback); + } + + /** + \brief The default destructor. + */ + virtual ~PxBroadcastingErrorCallback() + { + mListeners.clear(); + } + + /** + \brief Reports an error code. + \param code Error code, see #PxErrorCode + \param message Message to display. + \param file File error occured in. + \param line Line number error occured on. + */ + void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) + { + for(uint32_t i = 0; i < mListeners.size(); i++) + mListeners[i]->reportError(code, message, file, line); + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrorCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrorCallback.h new file mode 100644 index 0000000..3a9a522 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrorCallback.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ERROR_CALLBACK_H +#define PX_ERROR_CALLBACK_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxErrors.h" +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief User defined interface class. Used by the library to emit debug information. + +\note The SDK state should not be modified from within any error reporting functions. + +Threading: The SDK sequences its calls to the output stream using a mutex, so the class need not +be implemented in a thread-safe manner if the SDK is the only client. +*/ +class PxErrorCallback +{ + public: + virtual ~PxErrorCallback() + { + } + + /** + \brief Reports an error code. + \param code Error code, see #PxErrorCode + \param message Message to display. + \param file File error occured in. + \param line Line number error occured on. + */ + virtual void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrors.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrors.h new file mode 100644 index 0000000..17311da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxErrors.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_ERRORS_H +#define PX_ERRORS_H +/** \addtogroup foundation +@{ +*/ + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Error codes + +These error codes are passed to #PxErrorCallback + +@see PxErrorCallback +*/ +struct PxErrorCode +{ + enum Enum + { + eNO_ERROR = 0, + + //! \brief An informational message. + eDEBUG_INFO = 1, + + //! \brief a warning message for the user to help with debugging + eDEBUG_WARNING = 2, + + //! \brief method called with invalid parameter(s) + eINVALID_PARAMETER = 4, + + //! \brief method was called at a time when an operation is not possible + eINVALID_OPERATION = 8, + + //! \brief method failed to allocate some memory + eOUT_OF_MEMORY = 16, + + /** \brief The library failed for some reason. + Possibly you have passed invalid values like NaNs, which are not checked for. + */ + eINTERNAL_ERROR = 32, + + //! \brief An unrecoverable error, execution should be halted and log output flushed + eABORT = 64, + + //! \brief The SDK has determined that an operation may result in poor performance. + ePERF_WARNING = 128, + + //! \brief A bit mask for including all errors + eMASK_ALL = -1 + }; +}; + +#if PX_CHECKED + #define PX_CHECK_MSG(exp, msg) (!!(exp) || (PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg), 0) ) + #define PX_CHECK_AND_RETURN(exp, msg) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return; } } + #define PX_CHECK_AND_RETURN_NULL(exp, msg) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return 0; } } + #define PX_CHECK_AND_RETURN_VAL(exp, msg, r) { if(!(exp)) { PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, msg); return r; } } +#else + #define PX_CHECK_MSG(exp, msg) + #define PX_CHECK_AND_RETURN(exp, msg) + #define PX_CHECK_AND_RETURN_NULL(exp, msg) + #define PX_CHECK_AND_RETURN_VAL(exp, msg, r) +#endif + +// shortcut macros: +// usage: PxGetFoundation().error(PX_WARN, "static friction %f is is lower than dynamic friction %d", sfr, dfr); +#define PX_WARN ::physx::PxErrorCode::eDEBUG_WARNING, PX_FL +#define PX_INFO ::physx::PxErrorCode::eDEBUG_INFO, PX_FL + +#if PX_DEBUG || PX_CHECKED + #define PX_WARN_ONCE(string) \ + { \ + static PxU32 timestamp = 0; \ + const PxU32 ts = PxGetWarnOnceTimeStamp(); \ + if(timestamp != ts) \ + { \ + timestamp = ts; \ + PxGetFoundation().error(PX_WARN, string); \ + } \ + } + #define PX_WARN_ONCE_IF(condition, string) \ + { \ + if(condition) \ + { \ + PX_WARN_ONCE(string) \ + } \ + } +#else + #define PX_WARN_ONCE(string) ((void)0) + #define PX_WARN_ONCE_IF(condition, string) ((void)0) +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFPU.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFPU.h new file mode 100644 index 0000000..e878868 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFPU.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FPU_H +#define PX_FPU_H + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxAssert.h" +#include "foundation/PxFoundationConfig.h" + +#define PX_IR(x) ((PxU32&)(x)) // integer representation of a floating-point value. +#define PX_SIR(x) ((PxI32&)(x)) // signed integer representation of a floating-point value. +#define PX_FR(x) ((PxReal&)(x)) // floating-point representation of a integer value. + +#define PX_FPU_GUARD PxFPUGuard scopedFpGuard; +#define PX_SIMD_GUARD PxSIMDGuard scopedFpGuard; +#define PX_SIMD_GUARD_CNDT(x) PxSIMDGuard scopedFpGuard(x); + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// sets the default SDK state for scalar and SIMD units +class PX_FOUNDATION_API PX_DEPRECATED PxFPUGuard +{ + public: + PxFPUGuard(); // set fpu control word for PhysX + ~PxFPUGuard(); // restore fpu control word + private: + PxU32 mControlWords[8]; +}; + +// sets default SDK state for simd unit only, lighter weight than FPUGuard +class PX_DEPRECATED PxSIMDGuard +{ + public: + PX_INLINE PxSIMDGuard(bool enable = true); // set simd control word for PhysX + PX_INLINE ~PxSIMDGuard(); // restore simd control word + private: +#if !(PX_LINUX || PX_OSX) || (!PX_EMSCRIPTEN && PX_INTEL_FAMILY) + PxU32 mControlWord; + bool mEnabled; +#endif +}; + +/** +\brief Enables floating point exceptions for the scalar and SIMD unit +*/ +PX_FOUNDATION_API void PxEnableFPExceptions(); + +/** +\brief Disables floating point exceptions for the scalar and SIMD unit +*/ +PX_FOUNDATION_API void PxDisableFPExceptions(); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_WINDOWS_FAMILY +#include "foundation/windows/PxWindowsFPU.h" +#elif (PX_LINUX && PX_SSE2) || PX_OSX +#include "foundation/unix/PxUnixFPU.h" +#else +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool) +{ +} +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +} +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFlags.h new file mode 100644 index 0000000..65d6ed2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFlags.h @@ -0,0 +1,383 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FLAGS_H +#define PX_FLAGS_H + +/** \addtogroup foundation + @{ +*/ + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +\brief Container for bitfield flag variables associated with a specific enum type. + +This allows for type safe manipulation for bitfields. + +

Example

+ // enum that defines each bit... + struct MyEnum + { + enum Enum + { + eMAN = 1, + eBEAR = 2, + ePIG = 4, + }; + }; + + // implements some convenient global operators. + PX_FLAGS_OPERATORS(MyEnum::Enum, uint8_t); + + PxFlags myFlags; + myFlags |= MyEnum::eMAN; + myFlags |= MyEnum::eBEAR | MyEnum::ePIG; + if(myFlags & MyEnum::eBEAR) + { + doSomething(); + } +*/ + +template +class PxFlags +{ + public: + typedef storagetype InternalType; + + PX_CUDA_CALLABLE PX_INLINE explicit PxFlags(const PxEMPTY) + { + } + PX_CUDA_CALLABLE PX_INLINE PxFlags(void); + PX_CUDA_CALLABLE PX_INLINE PxFlags(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE explicit PxFlags(storagetype b); + + PX_CUDA_CALLABLE PX_INLINE bool operator==(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxFlags& f) const; + PX_CUDA_CALLABLE PX_INLINE bool operator==(bool b) const; + PX_CUDA_CALLABLE PX_INLINE bool operator!=(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE bool operator!=(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator=(enumtype e); + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator|=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator|=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator&=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator&=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator^=(enumtype e); + PX_CUDA_CALLABLE PX_INLINE PxFlags& operator^=(const PxFlags& f); + PX_CUDA_CALLABLE PX_INLINE PxFlags operator^(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags operator^(const PxFlags& f) const; + + PX_CUDA_CALLABLE PX_INLINE PxFlags operator~(void) const; + + PX_CUDA_CALLABLE PX_INLINE operator bool(void) const; + PX_CUDA_CALLABLE PX_INLINE operator uint8_t(void) const; + PX_CUDA_CALLABLE PX_INLINE operator uint16_t(void) const; + PX_CUDA_CALLABLE PX_INLINE operator uint32_t(void) const; + + PX_CUDA_CALLABLE PX_INLINE void clear(enumtype e); + PX_CUDA_CALLABLE PX_INLINE void raise(enumtype e); + PX_CUDA_CALLABLE PX_INLINE bool isSet(enumtype e) const; + PX_CUDA_CALLABLE PX_INLINE PxFlags& setAll(enumtype e); + + public: + friend PX_INLINE PxFlags operator&(enumtype a, PxFlags& b) + { + PxFlags out; + out.mBits = a & b.mBits; + return out; + } + + private: + storagetype mBits; +}; + +#if !PX_DOXYGEN + +#define PX_FLAGS_OPERATORS(enumtype, storagetype) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator|(enumtype a, enumtype b) \ + { \ + PxFlags r(a); \ + r |= b; \ + return r; \ + } \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator&(enumtype a, enumtype b) \ + { \ + PxFlags r(a); \ + r &= b; \ + return r; \ + } \ + PX_CUDA_CALLABLE PX_INLINE PxFlags operator~(enumtype a) \ + { \ + return ~PxFlags(a); \ + } + +#define PX_FLAGS_TYPEDEF(x, y) \ + typedef PxFlags x##s; \ + PX_FLAGS_OPERATORS(x::Enum, y) + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(void) +{ + mBits = 0; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(enumtype e) +{ + mBits = static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(const PxFlags& f) +{ + mBits = f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::PxFlags(storagetype b) +{ + mBits = b; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(enumtype e) const +{ + return mBits == static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(const PxFlags& f) const +{ + return mBits == f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator==(bool b) const +{ + return bool(*this) == b; +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator!=(enumtype e) const +{ + return mBits != static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::operator!=(const PxFlags& f) const +{ + return mBits != f.mBits; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator=(enumtype e) +{ + mBits = static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator=(const PxFlags& f) +{ + mBits = f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator|=(enumtype e) +{ + mBits |= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator|=(const PxFlags& f) +{ + mBits |= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator|(enumtype e) const +{ + PxFlags out(*this); + out |= e; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator|(const PxFlags& f) const +{ + PxFlags out(*this); + out |= f; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator&=(enumtype e) +{ + mBits &= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator&=(const PxFlags& f) +{ + mBits &= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator&(enumtype e) const +{ + PxFlags out = *this; + out.mBits &= static_cast(e); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator&(const PxFlags& f) const +{ + PxFlags out = *this; + out.mBits &= f.mBits; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::operator^=(enumtype e) +{ + mBits ^= static_cast(e); + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags:: +operator^=(const PxFlags& f) +{ + mBits ^= f.mBits; + return *this; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator^(enumtype e) const +{ + PxFlags out = *this; + out.mBits ^= static_cast(e); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags:: +operator^(const PxFlags& f) const +{ + PxFlags out = *this; + out.mBits ^= f.mBits; + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags PxFlags::operator~(void) const +{ + PxFlags out; + out.mBits = storagetype(~mBits); + return out; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator bool(void) const +{ + return mBits ? true : false; +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator uint8_t(void) const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator uint16_t(void) const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags::operator uint32_t(void) const +{ + return static_cast(mBits); +} + +template +PX_CUDA_CALLABLE PX_INLINE void PxFlags::clear(enumtype e) +{ + mBits &= ~static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE void PxFlags::raise(enumtype e) +{ + mBits |= static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE bool PxFlags::isSet(enumtype e) const +{ + return (mBits & static_cast(e)) == static_cast(e); +} + +template +PX_CUDA_CALLABLE PX_INLINE PxFlags& PxFlags::setAll(enumtype e) +{ + mBits = static_cast(e); + return *this; +} + +} // namespace physx +#endif //!PX_DOXYGEN + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundation.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundation.h new file mode 100644 index 0000000..d8479de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundation.h @@ -0,0 +1,224 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FOUNDATION_H +#define PX_FOUNDATION_H + +/** \addtogroup foundation + @{ +*/ + +#include "foundation/Px.h" +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxErrors.h" + +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxAllocationListener; +class PxErrorCallback; + +/** +\brief Foundation SDK singleton class. + +You need to have an instance of this class to instance the higher level SDKs. +*/ +class PX_FOUNDATION_API PxFoundation +{ + public: + /** + \brief Destroys the instance it is called on. + + The operation will fail, if there are still modules referencing the foundation object. Release all dependent modules + prior to calling this method. + + @see PxCreateFoundation() + */ + virtual void release() = 0; + + /** + retrieves error callback + */ + virtual PxErrorCallback& getErrorCallback() = 0; + + /** + Sets mask of errors to report. + */ + virtual void setErrorLevel(uint32_t mask = PxErrorCode::eMASK_ALL) = 0; + + /** + Retrieves mask of errors to be reported. + */ + virtual uint32_t getErrorLevel() const = 0; + + /** + Retrieves the allocator this object was created with. + */ + virtual PxAllocatorCallback& getAllocatorCallback() = 0; + + /** + Retrieves if allocation names are being passed to allocator callback. + */ + virtual bool getReportAllocationNames() const = 0; + + /** + Set if allocation names are being passed to allocator callback. + \details Enabled by default in debug and checked build, disabled by default in profile and release build. + */ + virtual void setReportAllocationNames(bool value) = 0; + + virtual void registerAllocationListener(PxAllocationListener& listener) = 0; + + virtual void deregisterAllocationListener(PxAllocationListener& listener) = 0; + + virtual void registerErrorCallback(PxErrorCallback& callback) = 0; + + virtual void deregisterErrorCallback(PxErrorCallback& callback) = 0; + + PX_DEPRECATED virtual bool error(PxErrorCode::Enum c, const char* file, int line, const char* messageFmt, ...) = 0; + + PX_DEPRECATED virtual bool error(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, va_list) = 0; + + protected: + virtual ~PxFoundation() + { + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +// PT: use this to make generated code shorter (e.g. from 52 to 24 bytes of assembly (10 to 4 instructions)) +// We must use a macro here to let __FILE__ expand to the proper filename (it doesn't work with an inlined function). +#define PX_IMPLEMENT_OUTPUT_ERROR \ +template \ +static PX_NOINLINE bool outputError(int line, const char* message) \ +{ \ + return PxGetFoundation().error(PxErrorCode::Enum(errorCode), __FILE__, line, message); \ +} + +/** +\brief Creates an instance of the foundation class + +The foundation class is needed to initialize higher level SDKs. There may be only one instance per process. +Calling this method after an instance has been created already will result in an error message and NULL will be +returned. + +\param version Version number we are expecting (should be #PX_PHYSICS_VERSION) +\param allocator User supplied interface for allocating memory(see #PxAllocatorCallback) +\param errorCallback User supplied interface for reporting errors and displaying messages(see #PxErrorCallback) +\return Foundation instance on success, NULL if operation failed + +@see PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation* PX_CALL_CONV PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, physx::PxErrorCallback& errorCallback); + + +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetFoundationInstance(physx::PxFoundation& foundation); + + +/** +\brief Retrieves the Foundation SDK after it has been created. + +\note The behavior of this method is undefined if the foundation instance has not been created already. + +@see PxCreateFoundation() +*/ +#if PX_CLANG + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wreturn-type-c-linkage" +#endif // PX_CLANG +PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation& PX_CALL_CONV PxGetFoundation(); +#if PX_CLANG + #pragma clang diagnostic pop +#endif // PX_CLANG + +#if !PX_DOXYGEN +namespace physx +{ +#endif +class PxProfilerCallback; +class PxAllocatorCallback; +class PxErrorCallback; +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Get the callback that will be used for all profiling. +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxProfilerCallback* PX_CALL_CONV PxGetProfilerCallback(); + +/** +\brief Set the callback that will be used for all profiling. +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetProfilerCallback(physx::PxProfilerCallback* profiler); + +/** +\brief Get the allocator callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxAllocatorCallback* PX_CALL_CONV PxGetAllocatorCallback(); + +/** +\brief Get the broadcasting allocator callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxAllocatorCallback* PX_CALL_CONV PxGetBroadcastAllocator(); + +/** +\brief Get the error callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxErrorCallback* PX_CALL_CONV PxGetErrorCallback(); + +/** +\brief Get the broadcasting error callback +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxErrorCallback* PX_CALL_CONV PxGetBroadcastError(); + +/** +\brief Get the warn once timestamp +*/ +PX_C_EXPORT PX_FOUNDATION_API physx::PxU32 PX_CALL_CONV PxGetWarnOnceTimeStamp(); + +/** +\brief Decrement the ref count of PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxDecFoundationRefCount(); + +/** +\brief Increment the ref count of PxFoundation +*/ +PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxIncFoundationRefCount(); + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundationConfig.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundationConfig.h new file mode 100644 index 0000000..53c14ac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxFoundationConfig.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FOUNDATION_CONFIG_H +#define PX_FOUNDATION_CONFIG_H + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup foundation + @{ +*/ + +#if defined PX_PHYSX_STATIC_LIB + #define PX_FOUNDATION_API +#else + #if PX_WINDOWS_FAMILY && !defined(__CUDACC__) + #if defined PX_PHYSX_FOUNDATION_EXPORTS + #define PX_FOUNDATION_API __declspec(dllexport) + #else + #define PX_FOUNDATION_API __declspec(dllimport) + #endif + #elif PX_UNIX_FAMILY + #define PX_FOUNDATION_API PX_UNIX_EXPORT + #else + #define PX_FOUNDATION_API + #endif +#endif + + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHash.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHash.h new file mode 100644 index 0000000..43ea552 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHash.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HASH_H +#define PX_HASH_H + +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxString.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4302) +#endif + +#if PX_LINUX +#include "foundation/PxSimpleTypes.h" +#endif + +/*! +Central definition of hash functions +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// Hash functions + +// Thomas Wang's 32 bit mix +// http://www.cris.com/~Ttwang/tech/inthash.htm +PX_FORCE_INLINE uint32_t PxComputeHash(const uint32_t key) +{ + uint32_t k = key; + k += ~(k << 15); + k ^= (k >> 10); + k += (k << 3); + k ^= (k >> 6); + k += ~(k << 11); + k ^= (k >> 16); + return uint32_t(k); +} + +PX_FORCE_INLINE uint32_t PxComputeHash(const int32_t key) +{ + return PxComputeHash(uint32_t(key)); +} + +// Thomas Wang's 64 bit mix +// http://www.cris.com/~Ttwang/tech/inthash.htm +PX_FORCE_INLINE uint32_t PxComputeHash(const uint64_t key) +{ + uint64_t k = key; + k += ~(k << 32); + k ^= (k >> 22); + k += ~(k << 13); + k ^= (k >> 8); + k += (k << 3); + k ^= (k >> 15); + k += ~(k << 27); + k ^= (k >> 31); + return uint32_t(UINT32_MAX & k); +} + +#if PX_APPLE_FAMILY +// hash for size_t, to make gcc happy +PX_INLINE uint32_t PxComputeHash(const size_t key) +{ +#if PX_P64_FAMILY + return PxComputeHash(uint64_t(key)); +#else + return PxComputeHash(uint32_t(key)); +#endif +} +#endif + +// Hash function for pointers +PX_INLINE uint32_t PxComputeHash(const void* ptr) +{ +#if PX_P64_FAMILY + return PxComputeHash(uint64_t(ptr)); +#else + return PxComputeHash(uint32_t(UINT32_MAX & size_t(ptr))); +#endif +} + +// Hash function for pairs +template +PX_INLINE uint32_t PxComputeHash(const PxPair& p) +{ + uint32_t seed = 0x876543; + uint32_t m = 1000007; + return PxComputeHash(p.second) ^ (m * (PxComputeHash(p.first) ^ (m * seed))); +} + +// hash object for hash map template parameter +template +struct PxHash +{ + uint32_t operator()(const Key& k) const + { + return PxComputeHash(k); + } + bool equal(const Key& k0, const Key& k1) const + { + return k0 == k1; + } +}; + +// specialization for strings +template <> +struct PxHash +{ + public: + uint32_t operator()(const char* _string) const + { + // "DJB" string hash + const uint8_t* string = reinterpret_cast(_string); + uint32_t h = 5381; + for(const uint8_t* ptr = string; *ptr; ptr++) + h = ((h << 5) + h) ^ uint32_t(*ptr); + return h; + } + bool equal(const char* string0, const char* string1) const + { + return !Pxstrcmp(string0, string1); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashInternals.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashInternals.h new file mode 100644 index 0000000..024084d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashInternals.h @@ -0,0 +1,792 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HASH_INTERNALS_H +#define PX_HASH_INTERNALS_H + +#include "foundation/PxAllocator.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxHash.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4127) // conditional expression is constant +#endif +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +class PxHashBase : private PxAllocator +{ + void init(uint32_t initialTableSize, float loadFactor) + { + mBuffer = NULL; + mEntries = NULL; + mEntriesNext = NULL; + mHash = NULL; + mEntriesCapacity = 0; + mHashSize = 0; + mLoadFactor = loadFactor; + mFreeList = uint32_t(EOL); + mTimestamp = 0; + mEntriesCount = 0; + + if(initialTableSize) + reserveInternal(initialTableSize); + } + + public: + typedef Entry EntryType; + + PxHashBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : PxAllocator("hashBase") + { + init(initialTableSize, loadFactor); + } + + PxHashBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) : PxAllocator(alloc) + { + init(initialTableSize, loadFactor); + } + + PxHashBase(const PxAllocator& alloc) : PxAllocator(alloc) + { + init(64, 0.75f); + } + + ~PxHashBase() + { + destroy(); // No need to clear() + + if(mBuffer) + PxAllocator::deallocate(mBuffer); + } + + static const uint32_t EOL = 0xffffffff; + + PX_INLINE Entry* create(const Key& k, bool& exists) + { + uint32_t h = 0; + if(mHashSize) + { + h = hash(k); + uint32_t index = mHash[h]; + while(index != EOL && !HashFn().equal(GetKey()(mEntries[index]), k)) + index = mEntriesNext[index]; + exists = index != EOL; + if(exists) + return mEntries + index; + } + else + exists = false; + + if(freeListEmpty()) + { + grow(); + h = hash(k); + } + + uint32_t entryIndex = freeListGetNext(); + + mEntriesNext[entryIndex] = mHash[h]; + mHash[h] = entryIndex; + + mEntriesCount++; + mTimestamp++; + + return mEntries + entryIndex; + } + + PX_INLINE const Entry* find(const Key& k) const + { + if(!mEntriesCount) + return NULL; + + const uint32_t h = hash(k); + uint32_t index = mHash[h]; + while(index != EOL && !HashFn().equal(GetKey()(mEntries[index]), k)) + index = mEntriesNext[index]; + return index != EOL ? mEntries + index : NULL; + } + + PX_INLINE bool erase(const Key& k, Entry& e) + { + if(!mEntriesCount) + return false; + + const uint32_t h = hash(k); + uint32_t* ptr = mHash + h; + while(*ptr != EOL && !HashFn().equal(GetKey()(mEntries[*ptr]), k)) + ptr = mEntriesNext + *ptr; + + if(*ptr == EOL) + return false; + + PX_PLACEMENT_NEW(&e, Entry)(mEntries[*ptr]); + + return eraseInternal(ptr); + } + + PX_INLINE bool erase(const Key& k) + { + if(!mEntriesCount) + return false; + + const uint32_t h = hash(k); + uint32_t* ptr = mHash + h; + while(*ptr != EOL && !HashFn().equal(GetKey()(mEntries[*ptr]), k)) + ptr = mEntriesNext + *ptr; + + if(*ptr == EOL) + return false; + + return eraseInternal(ptr); + } + + PX_INLINE uint32_t size() const + { + return mEntriesCount; + } + + PX_INLINE uint32_t capacity() const + { + return mHashSize; + } + + void clear() + { + if(!mHashSize || mEntriesCount == 0) + return; + + destroy(); + + intrinsics::memSet(mHash, EOL, mHashSize * sizeof(uint32_t)); + + const uint32_t sizeMinus1 = mEntriesCapacity - 1; + for(uint32_t i = 0; i < sizeMinus1; i++) + { + PxPrefetchLine(mEntriesNext + i, 128); + mEntriesNext[i] = i + 1; + } + mEntriesNext[mEntriesCapacity - 1] = uint32_t(EOL); + mFreeList = 0; + mEntriesCount = 0; + } + + void reserve(uint32_t size) + { + if(size > mHashSize) + reserveInternal(size); + } + + PX_INLINE const Entry* getEntries() const + { + return mEntries; + } + + PX_INLINE Entry* insertUnique(const Key& k) + { + PX_ASSERT(find(k) == NULL); + uint32_t h = hash(k); + + uint32_t entryIndex = freeListGetNext(); + + mEntriesNext[entryIndex] = mHash[h]; + mHash[h] = entryIndex; + + mEntriesCount++; + mTimestamp++; + + return mEntries + entryIndex; + } + + private: + void destroy() + { + for(uint32_t i = 0; i < mHashSize; i++) + { + for(uint32_t j = mHash[i]; j != EOL; j = mEntriesNext[j]) + mEntries[j].~Entry(); + } + } + + template + PX_NOINLINE void copy(const PxHashBase& other); + + // free list management - if we're coalescing, then we use mFreeList to hold + // the top of the free list and it should always be equal to size(). Otherwise, + // we build a free list in the next() pointers. + + PX_INLINE void freeListAdd(uint32_t index) + { + if(compacting) + { + mFreeList--; + PX_ASSERT(mFreeList == mEntriesCount); + } + else + { + mEntriesNext[index] = mFreeList; + mFreeList = index; + } + } + + PX_INLINE void freeListAdd(uint32_t start, uint32_t end) + { + if(!compacting) + { + for(uint32_t i = start; i < end - 1; i++) // add the new entries to the free list + mEntriesNext[i] = i + 1; + + // link in old free list + mEntriesNext[end - 1] = mFreeList; + PX_ASSERT(mFreeList != end - 1); + mFreeList = start; + } + else if(mFreeList == EOL) // don't reset the free ptr for the compacting hash unless it's empty + mFreeList = start; + } + + PX_INLINE uint32_t freeListGetNext() + { + PX_ASSERT(!freeListEmpty()); + if(compacting) + { + PX_ASSERT(mFreeList == mEntriesCount); + return mFreeList++; + } + else + { + uint32_t entryIndex = mFreeList; + mFreeList = mEntriesNext[mFreeList]; + return entryIndex; + } + } + + PX_INLINE bool freeListEmpty() const + { + if(compacting) + return mEntriesCount == mEntriesCapacity; + else + return mFreeList == EOL; + } + + PX_INLINE void replaceWithLast(uint32_t index) + { + PX_PLACEMENT_NEW(mEntries + index, Entry)(mEntries[mEntriesCount]); + mEntries[mEntriesCount].~Entry(); + mEntriesNext[index] = mEntriesNext[mEntriesCount]; + + uint32_t h = hash(GetKey()(mEntries[index])); + uint32_t* ptr; + for(ptr = mHash + h; *ptr != mEntriesCount; ptr = mEntriesNext + *ptr) + PX_ASSERT(*ptr != EOL); + *ptr = index; + } + + PX_INLINE uint32_t hash(const Key& k, uint32_t hashSize) const + { + return HashFn()(k) & (hashSize - 1); + } + + PX_INLINE uint32_t hash(const Key& k) const + { + return hash(k, mHashSize); + } + + PX_INLINE bool eraseInternal(uint32_t* ptr) + { + const uint32_t index = *ptr; + + *ptr = mEntriesNext[index]; + + mEntries[index].~Entry(); + + mEntriesCount--; + mTimestamp++; + + if (compacting && index != mEntriesCount) + replaceWithLast(index); + + freeListAdd(index); + return true; + } + + PX_NOINLINE void reserveInternal(uint32_t size) + { + if(!PxIsPowerOfTwo(size)) + size = PxNextPowerOfTwo(size); + + PX_ASSERT(!(size & (size - 1))); + + // decide whether iteration can be done on the entries directly + bool resizeCompact = compacting || freeListEmpty(); + + // define new table sizes + uint32_t oldEntriesCapacity = mEntriesCapacity; + uint32_t newEntriesCapacity = uint32_t(float(size) * mLoadFactor); + uint32_t newHashSize = size; + + // allocate new common buffer and setup pointers to new tables + uint8_t* newBuffer; + uint32_t* newHash; + uint32_t* newEntriesNext; + Entry* newEntries; + { + uint32_t newHashByteOffset = 0; + uint32_t newEntriesNextBytesOffset = newHashByteOffset + newHashSize * sizeof(uint32_t); + uint32_t newEntriesByteOffset = newEntriesNextBytesOffset + newEntriesCapacity * sizeof(uint32_t); + newEntriesByteOffset += (16 - (newEntriesByteOffset & 15)) & 15; + uint32_t newBufferByteSize = newEntriesByteOffset + newEntriesCapacity * sizeof(Entry); + + newBuffer = reinterpret_cast(PxAllocator::allocate(newBufferByteSize, __FILE__, __LINE__)); + PX_ASSERT(newBuffer); + + newHash = reinterpret_cast(newBuffer + newHashByteOffset); + newEntriesNext = reinterpret_cast(newBuffer + newEntriesNextBytesOffset); + newEntries = reinterpret_cast(newBuffer + newEntriesByteOffset); + } + + // initialize new hash table + intrinsics::memSet(newHash, uint32_t(EOL), newHashSize * sizeof(uint32_t)); + + // iterate over old entries, re-hash and create new entries + if(resizeCompact) + { + // check that old free list is empty - we don't need to copy the next entries + PX_ASSERT(compacting || mFreeList == EOL); + + for(uint32_t index = 0; index < mEntriesCount; ++index) + { + uint32_t h = hash(GetKey()(mEntries[index]), newHashSize); + newEntriesNext[index] = newHash[h]; + newHash[h] = index; + + PX_PLACEMENT_NEW(newEntries + index, Entry)(mEntries[index]); + mEntries[index].~Entry(); + } + } + else + { + // copy old free list, only required for non compact resizing + intrinsics::memCopy(newEntriesNext, mEntriesNext, mEntriesCapacity * sizeof(uint32_t)); + + for(uint32_t bucket = 0; bucket < mHashSize; bucket++) + { + uint32_t index = mHash[bucket]; + while(index != EOL) + { + uint32_t h = hash(GetKey()(mEntries[index]), newHashSize); + newEntriesNext[index] = newHash[h]; + PX_ASSERT(index != newHash[h]); + + newHash[h] = index; + + PX_PLACEMENT_NEW(newEntries + index, Entry)(mEntries[index]); + mEntries[index].~Entry(); + + index = mEntriesNext[index]; + } + } + } + + // swap buffer and pointers + PxAllocator::deallocate(mBuffer); + mBuffer = newBuffer; + mHash = newHash; + mHashSize = newHashSize; + mEntriesNext = newEntriesNext; + mEntries = newEntries; + mEntriesCapacity = newEntriesCapacity; + + freeListAdd(oldEntriesCapacity, newEntriesCapacity); + } + + void grow() + { + PX_ASSERT((mFreeList == EOL) || (compacting && (mEntriesCount == mEntriesCapacity))); + + uint32_t size = mHashSize == 0 ? 16 : mHashSize * 2; + reserve(size); + } + + uint8_t* mBuffer; + Entry* mEntries; + uint32_t* mEntriesNext; // same size as mEntries + uint32_t* mHash; + uint32_t mEntriesCapacity; + uint32_t mHashSize; + float mLoadFactor; + uint32_t mFreeList; + uint32_t mTimestamp; + uint32_t mEntriesCount; // number of entries + + public: + class Iter + { + public: + PX_INLINE Iter(PxHashBase& b) : mBucket(0), mEntry(uint32_t(b.EOL)), mTimestamp(b.mTimestamp), mBase(b) + { + if(mBase.mEntriesCapacity > 0) + { + mEntry = mBase.mHash[0]; + skip(); + } + } + + PX_INLINE void check() const + { + PX_ASSERT(mTimestamp == mBase.mTimestamp); + } + PX_INLINE const Entry& operator*() const + { + check(); + return mBase.mEntries[mEntry]; + } + PX_INLINE Entry& operator*() + { + check(); + return mBase.mEntries[mEntry]; + } + PX_INLINE const Entry* operator->() const + { + check(); + return mBase.mEntries + mEntry; + } + PX_INLINE Entry* operator->() + { + check(); + return mBase.mEntries + mEntry; + } + PX_INLINE Iter operator++() + { + check(); + advance(); + return *this; + } + PX_INLINE Iter operator++(int) + { + check(); + Iter i = *this; + advance(); + return i; + } + PX_INLINE bool done() const + { + check(); + return mEntry == mBase.EOL; + } + + private: + PX_INLINE void advance() + { + mEntry = mBase.mEntriesNext[mEntry]; + skip(); + } + PX_INLINE void skip() + { + while(mEntry == mBase.EOL) + { + if(++mBucket == mBase.mHashSize) + break; + mEntry = mBase.mHash[mBucket]; + } + } + + Iter& operator=(const Iter&); + + uint32_t mBucket; + uint32_t mEntry; + uint32_t mTimestamp; + PxHashBase& mBase; + }; + + /*! + Iterate over entries in a hash base and allow entry erase while iterating + */ + class PxEraseIterator + { + public: + PX_INLINE PxEraseIterator(PxHashBase& b): mBase(b) + { + reset(); + } + + PX_INLINE Entry* eraseCurrentGetNext(bool eraseCurrent) + { + if(eraseCurrent && mCurrentEntryIndexPtr) + { + mBase.eraseInternal(mCurrentEntryIndexPtr); + // if next was valid return the same ptr, if next was EOL search new hash entry + if(*mCurrentEntryIndexPtr != mBase.EOL) + return mBase.mEntries + *mCurrentEntryIndexPtr; + else + return traverseHashEntries(); + } + + // traverse mHash to find next entry + if(mCurrentEntryIndexPtr == NULL) + return traverseHashEntries(); + + const uint32_t index = *mCurrentEntryIndexPtr; + if(mBase.mEntriesNext[index] == mBase.EOL) + { + return traverseHashEntries(); + } + else + { + mCurrentEntryIndexPtr = mBase.mEntriesNext + index; + return mBase.mEntries + *mCurrentEntryIndexPtr; + } + } + + PX_INLINE void reset() + { + mCurrentHashIndex = 0; + mCurrentEntryIndexPtr = NULL; + } + + private: + PX_INLINE Entry* traverseHashEntries() + { + mCurrentEntryIndexPtr = NULL; + while (mCurrentEntryIndexPtr == NULL && mCurrentHashIndex < mBase.mHashSize) + { + if (mBase.mHash[mCurrentHashIndex] != mBase.EOL) + { + mCurrentEntryIndexPtr = mBase.mHash + mCurrentHashIndex; + mCurrentHashIndex++; + return mBase.mEntries + *mCurrentEntryIndexPtr; + } + else + { + mCurrentHashIndex++; + } + } + return NULL; + } + + PxEraseIterator& operator=(const PxEraseIterator&); + private: + uint32_t* mCurrentEntryIndexPtr; + uint32_t mCurrentHashIndex; + PxHashBase& mBase; + }; +}; + +template +template +PX_NOINLINE void +PxHashBase::copy(const PxHashBase& other) +{ + reserve(other.mEntriesCount); + + for(uint32_t i = 0; i < other.mEntriesCount; i++) + { + for(uint32_t j = other.mHash[i]; j != EOL; j = other.mEntriesNext[j]) + { + const Entry& otherEntry = other.mEntries[j]; + + bool exists; + Entry* newEntry = create(GK()(otherEntry), exists); + PX_ASSERT(!exists); + + PX_PLACEMENT_NEW(newEntry, Entry)(otherEntry); + } + } +} + +template ::Type, bool Coalesced = false> +class PxHashSetBase +{ + PX_NOCOPY(PxHashSetBase) + public: + struct GetKey + { + PX_INLINE const Key& operator()(const Key& e) + { + return e; + } + }; + + typedef PxHashBase BaseMap; + typedef typename BaseMap::Iter Iterator; + + PxHashSetBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) + : mBase(initialTableSize, loadFactor, alloc) + { + } + + PxHashSetBase(const PxAllocator& alloc) : mBase(64, 0.75f, alloc) + { + } + + PxHashSetBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : mBase(initialTableSize, loadFactor) + { + } + + bool insert(const Key& k) + { + bool exists; + Key* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Key)(k); + return !exists; + } + + PX_INLINE bool contains(const Key& k) const + { + return mBase.find(k) != 0; + } + PX_INLINE bool erase(const Key& k) + { + return mBase.erase(k); + } + PX_INLINE uint32_t size() const + { + return mBase.size(); + } + PX_INLINE uint32_t capacity() const + { + return mBase.capacity(); + } + PX_INLINE void reserve(uint32_t size) + { + mBase.reserve(size); + } + PX_INLINE void clear() + { + mBase.clear(); + } + + protected: + BaseMap mBase; +}; + +template >::Type> +class PxHashMapBase +{ + PX_NOCOPY(PxHashMapBase) + public: + typedef PxPair Entry; + + struct GetKey + { + PX_INLINE const Key& operator()(const Entry& e) + { + return e.first; + } + }; + + typedef PxHashBase BaseMap; + typedef typename BaseMap::Iter Iterator; + typedef typename BaseMap::PxEraseIterator EraseIterator; + + PxHashMapBase(uint32_t initialTableSize, float loadFactor, const PxAllocator& alloc) + : mBase(initialTableSize, loadFactor, alloc) + { + } + + PxHashMapBase(const PxAllocator& alloc) : mBase(64, 0.75f, alloc) + { + } + + PxHashMapBase(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : mBase(initialTableSize, loadFactor) + { + } + + bool insert(const Key /*&*/ k, const Value /*&*/ v) + { + bool exists; + Entry* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Entry)(k, v); + return !exists; + } + + Value& operator[](const Key& k) + { + bool exists; + Entry* e = mBase.create(k, exists); + if(!exists) + PX_PLACEMENT_NEW(e, Entry)(k, Value()); + + return e->second; + } + + PX_INLINE const Entry* find(const Key& k) const + { + return mBase.find(k); + } + PX_INLINE bool erase(const Key& k) + { + return mBase.erase(k); + } + PX_INLINE bool erase(const Key& k, Entry& e) + { + return mBase.erase(k, e); + } + PX_INLINE uint32_t size() const + { + return mBase.size(); + } + PX_INLINE uint32_t capacity() const + { + return mBase.capacity(); + } + PX_INLINE Iterator getIterator() + { + return Iterator(mBase); + } + PX_INLINE EraseIterator getEraseIterator() + { + return EraseIterator(mBase); + } + PX_INLINE void reserve(uint32_t size) + { + mBase.reserve(size); + } + PX_INLINE void clear() + { + mBase.clear(); + } + + protected: + BaseMap mBase; +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashMap.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashMap.h new file mode 100644 index 0000000..cc34ae1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashMap.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HASHMAP_H +#define PX_HASHMAP_H + +#include "foundation/PxHashInternals.h" + +// TODO: make this doxy-format +// +// This header defines two hash maps. Hash maps +// * support custom initial table sizes (rounded up internally to power-of-2) +// * support custom static allocator objects +// * auto-resize, based on a load factor (i.e. a 64-entry .75 load factor hash will resize +// when the 49th element is inserted) +// * are based on open hashing +// * have O(1) contains, erase +// +// Maps have STL-like copying semantics, and properly initialize and destruct copies of objects +// +// There are two forms of map: coalesced and uncoalesced. Coalesced maps keep the entries in the +// initial segment of an array, so are fast to iterate over; however deletion is approximately +// twice as expensive. +// +// HashMap: +// bool insert(const Key& k, const Value& v) O(1) amortized (exponential resize policy) +// Value & operator[](const Key& k) O(1) for existing objects, else O(1) amortized +// const Entry * find(const Key& k); O(1) +// bool erase(const T& k); O(1) +// uint32_t size(); constant +// void reserve(uint32_t size); O(MAX(currentOccupancy,size)) +// void clear(); O(currentOccupancy) (with zero constant for objects +// without +// destructors) +// Iterator getIterator(); +// +// operator[] creates an entry if one does not exist, initializing with the default constructor. +// CoalescedHashMap does not support getIterator, but instead supports +// const Key *getEntries(); +// +// Use of iterators: +// +// for(HashMap::Iterator iter = test.getIterator(); !iter.done(); ++iter) +// myFunction(iter->first, iter->second); + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +template , class Allocator = PxAllocator> +class PxHashMap : public physx::PxHashMapBase +{ + public: + typedef physx::PxHashMapBase HashMapBase; + typedef typename HashMapBase::Iterator Iterator; + + PxHashMap(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : HashMapBase(initialTableSize, loadFactor) + { + } + PxHashMap(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashMapBase(initialTableSize, loadFactor, alloc) + { + } + PxHashMap(const Allocator& alloc) : HashMapBase(64, 0.75f, alloc) + { + } + Iterator getIterator() + { + return Iterator(HashMapBase::mBase); + } +}; + +template , class Allocator = PxAllocator> +class PxCoalescedHashMap : public physx::PxHashMapBase +{ + public: + typedef physx::PxHashMapBase HashMapBase; + + PxCoalescedHashMap(uint32_t initialTableSize = 64, float loadFactor = 0.75f) + : HashMapBase(initialTableSize, loadFactor) + { + } + const PxPair* getEntries() const + { + return HashMapBase::mBase.getEntries(); + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashSet.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashSet.h new file mode 100644 index 0000000..354b044 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxHashSet.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HASHSET_H +#define PX_HASHSET_H + +#include "foundation/PxHashInternals.h" + +// TODO: make this doxy-format + +// This header defines two hash sets. Hash sets +// * support custom initial table sizes (rounded up internally to power-of-2) +// * support custom static allocator objects +// * auto-resize, based on a load factor (i.e. a 64-entry .75 load factor hash will resize +// when the 49th element is inserted) +// * are based on open hashing +// +// Sets have STL-like copying semantics, and properly initialize and destruct copies of objects +// +// There are two forms of set: coalesced and uncoalesced. Coalesced sets keep the entries in the +// initial segment of an array, so are fast to iterate over; however deletion is approximately +// twice as expensive. +// +// HashSet: +// bool insert(const T& k) amortized O(1) (exponential resize policy) +// bool contains(const T& k) const; O(1) +// bool erase(const T& k); O(1) +// uint32_t size() const; constant +// void reserve(uint32_t size); O(MAX(size, currentOccupancy)) +// void clear(); O(currentOccupancy) (with zero constant for objects without +// destructors) +// Iterator getIterator(); +// +// Use of iterators: +// +// for(HashSet::Iterator iter = test.getIterator(); !iter.done(); ++iter) +// myFunction(*iter); +// +// CoalescedHashSet does not support getIterator, but instead supports +// const Key *getEntries(); +// +// insertion into a set already containing the element fails returning false, as does +// erasure of an element not in the set +// + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template , class Allocator = PxAllocator> +class PxHashSet : public physx::PxHashSetBase +{ + public: + typedef physx::PxHashSetBase HashSetBase; + typedef typename HashSetBase::Iterator Iterator; + + PxHashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : HashSetBase(initialTableSize, loadFactor) + { + } + PxHashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashSetBase(initialTableSize, loadFactor, alloc) + { + } + PxHashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) + { + } + Iterator getIterator() + { + return Iterator(HashSetBase::mBase); + } +}; + +template , class Allocator = PxAllocator> +class PxCoalescedHashSet : public physx::PxHashSetBase +{ + public: + typedef typename physx::PxHashSetBase HashSetBase; + + PxCoalescedHashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) + : HashSetBase(initialTableSize, loadFactor) + { + } + + PxCoalescedHashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) + : HashSetBase(initialTableSize, loadFactor, alloc) + { + } + PxCoalescedHashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) + { + } + + const Key* getEntries() const + { + return HashSetBase::mBase.getEntries(); + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIO.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIO.h new file mode 100644 index 0000000..a3d53f7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIO.h @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_IO_H +#define PX_IO_H + +/** \addtogroup common + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Input stream class for I/O. + +The user needs to supply a PxInputStream implementation to a number of methods to allow the SDK to read data. +*/ + +class PxInputStream +{ + public: + /** + \brief read from the stream. The number of bytes read may be less than the number requested. + + \param[in] dest the destination address to which the data will be read + \param[in] count the number of bytes requested + + \return the number of bytes read from the stream. + */ + + virtual uint32_t read(void* dest, uint32_t count) = 0; + + virtual ~PxInputStream() + { + } +}; + +/** +\brief Input data class for I/O which provides random read access. + +The user needs to supply a PxInputData implementation to a number of methods to allow the SDK to read data. +*/ + +class PxInputData : public PxInputStream +{ + public: + /** + \brief return the length of the input data + + \return size in bytes of the input data + */ + + virtual uint32_t getLength() const = 0; + + /** + \brief seek to the given offset from the start of the data. + + \param[in] offset the offset to seek to. If greater than the length of the data, this call is equivalent to + seek(length); + */ + + virtual void seek(uint32_t offset) = 0; + + /** + \brief return the current offset from the start of the data + + \return the offset to seek to. + */ + + virtual uint32_t tell() const = 0; + + virtual ~PxInputData() + { + } +}; + +/** +\brief Output stream class for I/O. + +The user needs to supply a PxOutputStream implementation to a number of methods to allow the SDK to write data. +*/ + +class PxOutputStream +{ + public: + /** + \brief write to the stream. The number of bytes written may be less than the number sent. + + \param[in] src the destination address from which the data will be written + \param[in] count the number of bytes to be written + + \return the number of bytes written to the stream by this call. + */ + + virtual uint32_t write(const void* src, uint32_t count) = 0; + + virtual ~PxOutputStream() + { + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAllocator.h new file mode 100644 index 0000000..9ff7388 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAllocator.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_INLINE_ALLOCATOR_H +#define PX_INLINE_ALLOCATOR_H + +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +// this is used by the array class to allocate some space for a small number +// of objects along with the metadata +template +class PxInlineAllocator : private BaseAllocator +{ + public: + PxInlineAllocator(const PxEMPTY v) : BaseAllocator(v) + { + } + + PxInlineAllocator(const BaseAllocator& alloc = BaseAllocator()) : BaseAllocator(alloc), mBufferUsed(false) + { + } + + PxInlineAllocator(const PxInlineAllocator& aloc) : BaseAllocator(aloc), mBufferUsed(false) + { + } + + void* allocate(PxU32 size, const char* filename, PxI32 line) + { + if(!mBufferUsed && size <= N) + { + mBufferUsed = true; + return mBuffer; + } + return BaseAllocator::allocate(size, filename, line); + } + + void deallocate(void* ptr) + { + if(ptr == mBuffer) + mBufferUsed = false; + else + BaseAllocator::deallocate(ptr); + } + + PX_FORCE_INLINE PxU8* getInlineBuffer() + { + return mBuffer; + } + PX_FORCE_INLINE bool isBufferUsed() const + { + return mBufferUsed; + } + + protected: + PxU8 mBuffer[N]; + bool mBufferUsed; +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAoS.h new file mode 100644 index 0000000..7267c08 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineAoS.h @@ -0,0 +1,45 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_INLINE_AOS_H +#define PX_INLINE_AOS_H + +#include "foundation/PxPreprocessor.h" + +#if PX_WINDOWS && !PX_CLANG + #include "windows/PxWindowsTrigConstants.h" + #include "windows/PxWindowsInlineAoS.h" +#elif (PX_UNIX_FAMILY || PX_SWITCH || PX_CLANG) + #include "unix/PxUnixTrigConstants.h" + #include "unix/PxUnixInlineAoS.h" +#else + #error "Platform not supported!" +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineArray.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineArray.h new file mode 100644 index 0000000..f3c9d84 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxInlineArray.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_INLINE_ARRAY_H +#define PX_INLINE_ARRAY_H + +#include "foundation/PxArray.h" +#include "foundation/PxInlineAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// array that pre-allocates for N elements +template ::Type> +class PxInlineArray : public PxArray > +{ + typedef PxInlineAllocator Allocator; + + public: + PxInlineArray(const PxEMPTY v) : PxArray(v) + { + if(isInlined()) + this->mData = reinterpret_cast(PxArray::getInlineBuffer()); + } + + PX_INLINE bool isInlined() const + { + return Allocator::isBufferUsed(); + } + + PX_INLINE explicit PxInlineArray(const Alloc& alloc = Alloc()) : PxArray(alloc) + { + this->mData = this->allocate(N); + this->mCapacity = N; + } +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIntrinsics.h new file mode 100644 index 0000000..46ddaf2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxIntrinsics.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_INTRINSICS_H +#define PX_INTRINSICS_H + +#include "foundation/PxPreprocessor.h" + +#if PX_WINDOWS_FAMILY +#include "windows/PxWindowsIntrinsics.h" +#elif(PX_LINUX || PX_APPLE_FAMILY) +#include "unix/PxUnixIntrinsics.h" +#elif PX_SWITCH +#include "switch/PxSwitchIntrinsics.h" +#else +#error "Platform not supported!" +#endif + +#if PX_WINDOWS_FAMILY +#pragma intrinsic(memcmp) +#pragma intrinsic(memcpy) +#pragma intrinsic(memset) +#endif + +#endif // #ifndef PX_INTRINSICS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat33.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat33.h new file mode 100644 index 0000000..ba410d9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat33.h @@ -0,0 +1,418 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MAT33_H +#define PX_MAT33_H +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +\brief 3x3 matrix class + +Some clarifications, as there have been much confusion about matrix formats etc in the past. + +Short: +- Matrix have base vectors in columns (vectors are column matrices, 3x1 matrices). +- Matrix is physically stored in column major format +- Matrices are concaternated from left + +Long: +Given three base vectors a, b and c the matrix is stored as + +|a.x b.x c.x| +|a.y b.y c.y| +|a.z b.z c.z| + +Vectors are treated as columns, so the vector v is + +|x| +|y| +|z| + +And matrices are applied _before_ the vector (pre-multiplication) +v' = M*v + +|x'| |a.x b.x c.x| |x| |a.x*x + b.x*y + c.x*z| +|y'| = |a.y b.y c.y| * |y| = |a.y*x + b.y*y + c.y*z| +|z'| |a.z b.z c.z| |z| |a.z*x + b.z*y + c.z*z| + + +Physical storage and indexing: +To be compatible with popular 3d rendering APIs (read D3d and OpenGL) +the physical indexing is + +|0 3 6| +|1 4 7| +|2 5 8| + +index = column*3 + row + +which in C++ translates to M[column][row] + +The mathematical indexing is M_row,column and this is what is used for _-notation +so _12 is 1st row, second column and operator(row, column)! +*/ + +class PxMat33 +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33(PxIDENTITY) : + column0(float(1.0), float(0.0), float(0.0)), + column1(float(0.0), float(1.0), float(0.0)), + column2(float(0.0), float(0.0), float(1.0)) + { + } + + //! zero constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33(PxZERO) : + column0(float(0.0)), + column1(float(0.0)), + column2(float(0.0)) + { + } + + //! Construct from three base vectors + PX_CUDA_CALLABLE PxMat33(const PxVec3& col0, const PxVec3& col1, const PxVec3& col2) : + column0(col0), + column1(col1), + column2(col2) + { + } + + //! constructor from a scalar, which generates a multiple of the identity matrix + explicit PX_CUDA_CALLABLE PX_INLINE PxMat33(float r) : + column0(r, float(0.0), float(0.0)), + column1(float(0.0), r, float(0.0)), + column2(float(0.0), float(0.0), r) + { + } + + //! Construct from float[9] + explicit PX_CUDA_CALLABLE PX_INLINE PxMat33(float values[]) : + column0(values[0], values[1], values[2]), + column1(values[3], values[4], values[5]), + column2(values[6], values[7], values[8]) + { + } + + //! Construct from a quaternion + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33(const PxQuat& q) + { + // PT: TODO: PX-566 + const float x = q.x; + const float y = q.y; + const float z = q.z; + const float w = q.w; + + const float x2 = x + x; + const float y2 = y + y; + const float z2 = z + z; + + const float xx = x2 * x; + const float yy = y2 * y; + const float zz = z2 * z; + + const float xy = x2 * y; + const float xz = x2 * z; + const float xw = x2 * w; + + const float yz = y2 * z; + const float yw = y2 * w; + const float zw = z2 * w; + + column0 = PxVec3(float(1.0) - yy - zz, xy + zw, xz - yw); + column1 = PxVec3(xy - zw, float(1.0) - xx - zz, yz + xw); + column2 = PxVec3(xz + yw, yz - xw, float(1.0) - xx - yy); + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_INLINE PxMat33(const PxMat33& other) : + column0(other.column0), + column1(other.column1), + column2(other.column2) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33& operator=(const PxMat33& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + return *this; + } + + //! Construct from diagonal, off-diagonals are zero. + PX_CUDA_CALLABLE PX_INLINE static const PxMat33 createDiagonal(const PxVec3& d) + { + return PxMat33(PxVec3(d.x, float(0.0), float(0.0)), + PxVec3(float(0.0), d.y, float(0.0)), + PxVec3(float(0.0), float(0.0), d.z)); + } + + //! Computes the outer product of two vectors + PX_CUDA_CALLABLE PX_INLINE static const PxMat33 outer(const PxVec3& a, const PxVec3& b) + { + return PxMat33(a * b.x, a * b.y, a * b.z); + } + + /** + \brief returns true if the two matrices are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat33& m) const + { + return column0 == m.column0 && column1 == m.column1 && column2 == m.column2; + } + + //! Get transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 getTranspose() const + { + const PxVec3 v0(column0.x, column1.x, column2.x); + const PxVec3 v1(column0.y, column1.y, column2.y); + const PxVec3 v2(column0.z, column1.z, column2.z); + + return PxMat33(v0, v1, v2); + } + + //! Get the real inverse + PX_CUDA_CALLABLE PX_INLINE const PxMat33 getInverse() const + { + const float det = getDeterminant(); + PxMat33 inverse; + + if(det != float(0.0)) + { + const float invDet = float(1.0) / det; + + inverse.column0.x = invDet * (column1.y * column2.z - column2.y * column1.z); + inverse.column0.y = invDet * -(column0.y * column2.z - column2.y * column0.z); + inverse.column0.z = invDet * (column0.y * column1.z - column0.z * column1.y); + + inverse.column1.x = invDet * -(column1.x * column2.z - column1.z * column2.x); + inverse.column1.y = invDet * (column0.x * column2.z - column0.z * column2.x); + inverse.column1.z = invDet * -(column0.x * column1.z - column0.z * column1.x); + + inverse.column2.x = invDet * (column1.x * column2.y - column1.y * column2.x); + inverse.column2.y = invDet * -(column0.x * column2.y - column0.y * column2.x); + inverse.column2.z = invDet * (column0.x * column1.y - column1.x * column0.y); + + return inverse; + } + else + { + return PxMat33(PxIdentity); + } + } + + //! Get determinant + PX_CUDA_CALLABLE PX_INLINE float getDeterminant() const + { + return column0.dot(column1.cross(column2)); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator-() const + { + return PxMat33(-column0, -column1, -column2); + } + + //! Add + PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator+(const PxMat33& other) const + { + return PxMat33(column0 + other.column0, column1 + other.column1, column2 + other.column2); + } + + //! Subtract + PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator-(const PxMat33& other) const + { + return PxMat33(column0 - other.column0, column1 - other.column1, column2 - other.column2); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat33 operator*(float scalar) const + { + return PxMat33(column0 * scalar, column1 * scalar, column2 * scalar); + } + + PX_CUDA_CALLABLE PX_INLINE friend PxMat33 operator*(float, const PxMat33&); + + //! Matrix vector multiplication (returns 'this->transform(vec)') + PX_CUDA_CALLABLE PX_INLINE const PxVec3 operator*(const PxVec3& vec) const + { + return transform(vec); + } + + // a = b operators + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat33 operator*(const PxMat33& other) const + { + // Rows from this columns from other + // column0 = transform(other.column0) etc + return PxMat33(transform(other.column0), + transform(other.column1), + transform(other.column2)); + } + + //! Equals-add + PX_CUDA_CALLABLE PX_INLINE PxMat33& operator+=(const PxMat33& other) + { + column0 += other.column0; + column1 += other.column1; + column2 += other.column2; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_INLINE PxMat33& operator-=(const PxMat33& other) + { + column0 -= other.column0; + column1 -= other.column1; + column2 -= other.column2; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat33& operator*=(float scalar) + { + column0 *= scalar; + column1 *= scalar; + column2 *= scalar; + return *this; + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat33& operator*=(const PxMat33& other) + { + *this = *this * other; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + // Transform etc + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 transform(const PxVec3& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z; + } + + //! Transform vector by matrix transpose, v' = M^t*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3 transformTranspose(const PxVec3& other) const + { + return PxVec3(column0.dot(other), column1.dot(other), column2.dot(other)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const float* front() const + { + return &column0.x; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](PxU32 num) + { + return (&column0)[num]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](PxU32 num) const + { + return (&column0)[num]; + } + + // Data, see above for format! + + PxVec3 column0, column1, column2; // the three base vectors +}; + +PX_CUDA_CALLABLE PX_INLINE PxMat33 operator*(float scalar, const PxMat33& m) +{ + return PxMat33(scalar * m.column0, scalar * m.column1, scalar * m.column2); +} + +// implementation from PxQuat.h +PX_CUDA_CALLABLE PX_INLINE PxQuat::PxQuat(const PxMat33& m) +{ + if(m.column2.z < float(0)) + { + if(m.column0.x > m.column1.y) + { + const float t = float(1.0) + m.column0.x - m.column1.y - m.column2.z; + *this = PxQuat(t, m.column0.y + m.column1.x, m.column2.x + m.column0.z, m.column1.z - m.column2.y) * (float(0.5) / PxSqrt(t)); + } + else + { + const float t = float(1.0) - m.column0.x + m.column1.y - m.column2.z; + *this = PxQuat(m.column0.y + m.column1.x, t, m.column1.z + m.column2.y, m.column2.x - m.column0.z) * (float(0.5) / PxSqrt(t)); + } + } + else + { + if(m.column0.x < -m.column1.y) + { + const float t = float(1.0) - m.column0.x - m.column1.y + m.column2.z; + *this = PxQuat(m.column2.x + m.column0.z, m.column1.z + m.column2.y, t, m.column0.y - m.column1.x) * (float(0.5) / PxSqrt(t)); + } + else + { + const float t = float(1.0) + m.column0.x + m.column1.y + m.column2.z; + *this = PxQuat(m.column1.z - m.column2.y, m.column2.x - m.column0.z, m.column0.y - m.column1.x, t) * (float(0.5) / PxSqrt(t)); + } + } +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat34.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat34.h new file mode 100644 index 0000000..b13ac63 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat34.h @@ -0,0 +1,271 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MAT34_H +#define PX_MAT34_H +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +Basic mathematical 3x4 matrix, implemented as a 3x3 rotation matrix and a translation + +See PxMat33 for the format of the rotation matrix. +*/ + +class PxMat34 +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34() + { + } + + //! Construct from four base vectors + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(const PxVec3& b0, const PxVec3& b1, const PxVec3& b2, const PxVec3& b3) + : m(b0, b1, b2), p(b3) + { + } + + //! Construct from float[12] + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(float values[]) : + m(values), p(values[9], values[10], values[11]) + { + } + + //! Construct from a 3x3 matrix + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(const PxMat33& other) + : m(other), p(PxZero) + { + } + + //! Construct from a 3x3 matrix and a translation vector + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(const PxMat33& other, const PxVec3& t) + : m(other), p(t) + { + } + + //! Construct from a PxTransform + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(const PxTransform& other) + : m(other.q), p(other.p) + { + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34(const PxMat34& other) : m(other.m), p(other.p) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxMat34& operator=(const PxMat34& other) + { + m = other.m; + p = other.p; + return *this; + } + + //! Set to identity matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE void setIdentity() + { + m = PxMat33(PxIdentity); + p = PxVec3(0); + } + + // Simpler operators + //! Equality operator + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxMat34& other) const + { + return m == other.m && p == other.p; + } + + //! Inequality operator + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxMat34& other) const + { + return !operator==(other); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator-() const + { + return PxMat34(-m, -p); + } + + //! Add + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator+(const PxMat34& other) const + { + return PxMat34(m + other.m, p + other.p); + } + + //! Subtract + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator-(const PxMat34& other) const + { + return PxMat34(m - other.m, p - other.p); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator*(float scalar) const + { + return PxMat34(m*scalar, p*scalar); + } + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator*(const PxMat34& other) const + { + //Rows from this columns from other + //base0 = rotate(other.m.column0) etc + return PxMat34(m*other.m, m*other.p + p); + } + + //! Matrix multiplication, extend the second matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 operator*(const PxMat33& other) const + { + //Rows from this columns from other + //base0 = transform(other.m.column0) etc + return PxMat34(m*other, p); + } + + friend PxMat34 operator*(const PxMat33& a, const PxMat34& b); + + // a = b operators + + //! Equals-add + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34& operator+=(const PxMat34& other) + { + m += other.m; + p += other.p; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34& operator-=(const PxMat34& other) + { + m -= other.m; + p -= other.p; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34& operator*=(float scalar) + { + m *= scalar; + p *= scalar; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + // Transform etc + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotate(const PxVec3& other) const + { + return m*other; + } + + //! Transform vector by transpose of matrix, equal to v' = M^t*v + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotateTranspose(const PxVec3& other) const + { + return m.transformTranspose(other); + } + + //! Transform point by matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transform(const PxVec3& other) const + { + return m*other + p; + } + + //! Transform point by transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transformTranspose(const PxVec3& other) const + { + return m.transformTranspose(other - p); + } + + //! Transform point by transposed matrix + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 transformTranspose(const PxMat34& other) const + { + return PxMat34(m.transformTranspose(other.m.column0), + m.transformTranspose(other.m.column1), + m.transformTranspose(other.m.column2), + m.transformTranspose(other.p - p)); + } + + //! Invert matrix treating it as a rotation+translation matrix only + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat34 getInverseRT() const + { + return PxMat34(m.getTranspose(), m.transformTranspose(-p)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](PxU32 num) { return (&m.column0)[num]; } + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](PxU32 num) const { return (&m.column0)[num]; } + + //Data, see above for format! + + PxMat33 m; + PxVec3 p; +}; + +//! Multiply a*b, a is extended +PX_INLINE PxMat34 operator*(const PxMat33& a, const PxMat34& b) +{ + return PxMat34(a * b.m, a * b.p); +} + +//! A padded version of PxMat34, to safely load its data using SIMD +class PxMat34Padded : public PxMat34 +{ + public: + PX_FORCE_INLINE PxMat34Padded(const PxMat34& src) : PxMat34(src) {} + PX_FORCE_INLINE PxMat34Padded() {} + PX_FORCE_INLINE ~PxMat34Padded() {} + PxU32 padding; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxMat34Padded)==16)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat44.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat44.h new file mode 100644 index 0000000..0a714bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMat44.h @@ -0,0 +1,385 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MAT44_H +#define PX_MAT44_H +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxQuat.h" +#include "foundation/PxVec4.h" +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/*! +\brief 4x4 matrix class + +This class is layout-compatible with D3D and OpenGL matrices. More notes on layout are given in the PxMat33 + +@see PxMat33 PxTransform +*/ + +class PxMat44 +{ + public: + //! Default constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44(PxIDENTITY) : + column0(float(1.0), float(0.0), float(0.0), float(0.0)), + column1(float(0.0), float(1.0), float(0.0), float(0.0)), + column2(float(0.0), float(0.0), float(1.0), float(0.0)), + column3(float(0.0), float(0.0), float(0.0), float(1.0)) + { + } + + //! zero constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44(PxZERO) : column0(PxZero), column1(PxZero), column2(PxZero), column3(PxZero) + { + } + + //! Construct from four 4-vectors + PX_CUDA_CALLABLE PxMat44(const PxVec4& col0, const PxVec4& col1, const PxVec4& col2, const PxVec4& col3) : + column0(col0), + column1(col1), + column2(col2), + column3(col3) + { + } + + //! constructor that generates a multiple of the identity matrix + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44(float r) : + column0(r, float(0.0), float(0.0), float(0.0)), + column1(float(0.0), r, float(0.0), float(0.0)), + column2(float(0.0), float(0.0), r, float(0.0)), + column3(float(0.0), float(0.0), float(0.0), r) + { + } + + //! Construct from three base vectors and a translation + PX_CUDA_CALLABLE PxMat44(const PxVec3& col0, const PxVec3& col1, const PxVec3& col2, const PxVec3& col3) : + column0(col0, float(0.0)), + column1(col1, float(0.0)), + column2(col2, float(0.0)), + column3(col3, float(1.0)) + { + } + + //! Construct from float[16] + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44(float values[]) : + column0(values[0], values[1], values[2], values[3]), + column1(values[4], values[5], values[6], values[7]), + column2(values[8], values[9], values[10], values[11]), + column3(values[12], values[13], values[14], values[15]) + { + } + + //! Construct from a quaternion + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44(const PxQuat& q) + { + // PT: TODO: PX-566 + const float x = q.x; + const float y = q.y; + const float z = q.z; + const float w = q.w; + + const float x2 = x + x; + const float y2 = y + y; + const float z2 = z + z; + + const float xx = x2 * x; + const float yy = y2 * y; + const float zz = z2 * z; + + const float xy = x2 * y; + const float xz = x2 * z; + const float xw = x2 * w; + + const float yz = y2 * z; + const float yw = y2 * w; + const float zw = z2 * w; + + column0 = PxVec4(float(1.0) - yy - zz, xy + zw, xz - yw, float(0.0)); + column1 = PxVec4(xy - zw, float(1.0) - xx - zz, yz + xw, float(0.0)); + column2 = PxVec4(xz + yw, yz - xw, float(1.0) - xx - yy, float(0.0)); + column3 = PxVec4(float(0.0), float(0.0), float(0.0), float(1.0)); + } + + //! Construct from a diagonal vector + explicit PX_CUDA_CALLABLE PX_INLINE PxMat44(const PxVec4& diagonal) : + column0(diagonal.x, float(0.0), float(0.0), float(0.0)), + column1(float(0.0), diagonal.y, float(0.0), float(0.0)), + column2(float(0.0), float(0.0), diagonal.z, float(0.0)), + column3(float(0.0), float(0.0), float(0.0), diagonal.w) + { + } + + //! Construct from Mat33 and a translation + PX_CUDA_CALLABLE PxMat44(const PxMat33& axes, const PxVec3& position) : + column0(axes.column0, float(0.0)), + column1(axes.column1, float(0.0)), + column2(axes.column2, float(0.0)), + column3(position, float(1.0)) + { + } + + PX_CUDA_CALLABLE PxMat44(const PxTransform& t) + { + *this = PxMat44(PxMat33(t.q), t.p); + } + + /** + \brief returns true if the two matrices are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxMat44& m) const + { + return column0 == m.column0 && column1 == m.column1 && column2 == m.column2 && column3 == m.column3; + } + + //! Copy constructor + PX_CUDA_CALLABLE PX_INLINE PxMat44(const PxMat44& other) : + column0(other.column0), + column1(other.column1), + column2(other.column2), + column3(other.column3) + { + } + + //! Assignment operator + PX_CUDA_CALLABLE PX_INLINE PxMat44& operator=(const PxMat44& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + column3 = other.column3; + return *this; + } + + //! Get transposed matrix + PX_CUDA_CALLABLE PX_INLINE const PxMat44 getTranspose() const + { + return PxMat44( + PxVec4(column0.x, column1.x, column2.x, column3.x), PxVec4(column0.y, column1.y, column2.y, column3.y), + PxVec4(column0.z, column1.z, column2.z, column3.z), PxVec4(column0.w, column1.w, column2.w, column3.w)); + } + + //! Unary minus + PX_CUDA_CALLABLE PX_INLINE const PxMat44 operator-() const + { + return PxMat44(-column0, -column1, -column2, -column3); + } + + //! Add + PX_CUDA_CALLABLE PX_INLINE const PxMat44 operator+(const PxMat44& other) const + { + return PxMat44(column0 + other.column0, column1 + other.column1, column2 + other.column2, column3 + other.column3); + } + + //! Subtract + PX_CUDA_CALLABLE PX_INLINE const PxMat44 operator-(const PxMat44& other) const + { + return PxMat44(column0 - other.column0, column1 - other.column1, column2 - other.column2, column3 - other.column3); + } + + //! Scalar multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat44 operator*(float scalar) const + { + return PxMat44(column0 * scalar, column1 * scalar, column2 * scalar, column3 * scalar); + } + + friend PxMat44 operator*(float, const PxMat44&); + + //! Matrix multiplication + PX_CUDA_CALLABLE PX_INLINE const PxMat44 operator*(const PxMat44& other) const + { + // Rows from this columns from other + // column0 = transform(other.column0) etc + return PxMat44(transform(other.column0), transform(other.column1), transform(other.column2), transform(other.column3)); + } + + // a = b operators + + //! Equals-add + PX_CUDA_CALLABLE PX_INLINE PxMat44& operator+=(const PxMat44& other) + { + column0 += other.column0; + column1 += other.column1; + column2 += other.column2; + column3 += other.column3; + return *this; + } + + //! Equals-sub + PX_CUDA_CALLABLE PX_INLINE PxMat44& operator-=(const PxMat44& other) + { + column0 -= other.column0; + column1 -= other.column1; + column2 -= other.column2; + column3 -= other.column3; + return *this; + } + + //! Equals scalar multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat44& operator*=(float scalar) + { + column0 *= scalar; + column1 *= scalar; + column2 *= scalar; + column3 *= scalar; + return *this; + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxMat44& operator*=(const PxMat44& other) + { + *this = *this * other; + return *this; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(PxU32 row, PxU32 col) const + { + return (*this)[col][row]; + } + + //! Element access, mathematical way! + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(PxU32 row, PxU32 col) + { + return (*this)[col][row]; + } + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec4 transform(const PxVec4& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z + column3 * other.w; + } + + //! Transform vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3 transform(const PxVec3& other) const + { + return transform(PxVec4(other, float(1.0))).getXYZ(); + } + + //! Rotate vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec4 rotate(const PxVec4& other) const + { + return column0 * other.x + column1 * other.y + column2 * other.z; // + column3*0; + } + + //! Rotate vector by matrix, equal to v' = M*v + PX_CUDA_CALLABLE PX_INLINE const PxVec3 rotate(const PxVec3& other) const + { + return rotate(PxVec4(other, float(1.0))).getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE const PxVec3 getBasis(PxU32 num) const + { + PX_ASSERT(num < 3); + return (&column0)[num].getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE const PxVec3 getPosition() const + { + return column3.getXYZ(); + } + + PX_CUDA_CALLABLE PX_INLINE void setPosition(const PxVec3& position) + { + column3.x = position.x; + column3.y = position.y; + column3.z = position.z; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const float* front() const + { + return &column0.x; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4& operator[](PxU32 num) + { + return (&column0)[num]; + } + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4& operator[](PxU32 num) const + { + return (&column0)[num]; + } + + PX_CUDA_CALLABLE PX_INLINE void scale(const PxVec4& p) + { + column0 *= p.x; + column1 *= p.y; + column2 *= p.z; + column3 *= p.w; + } + + PX_CUDA_CALLABLE PX_INLINE const PxMat44 inverseRT(void) const + { + const PxVec3 r0(column0.x, column1.x, column2.x); + const PxVec3 r1(column0.y, column1.y, column2.y); + const PxVec3 r2(column0.z, column1.z, column2.z); + + return PxMat44(r0, r1, r2, -(r0 * column3.x + r1 * column3.y + r2 * column3.z)); + } + + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return column0.isFinite() && column1.isFinite() && column2.isFinite() && column3.isFinite(); + } + + // Data, see above for format! + + PxVec4 column0, column1, column2, column3; // the four base vectors +}; + +// implementation from PxTransform.h +PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform::PxTransform(const PxMat44& m) +{ + const PxVec3 column0(m.column0.x, m.column0.y, m.column0.z); + const PxVec3 column1(m.column1.x, m.column1.y, m.column1.z); + const PxVec3 column2(m.column2.x, m.column2.y, m.column2.z); + + q = PxQuat(PxMat33(column0, column1, column2)); + p = PxVec3(m.column3.x, m.column3.y, m.column3.z); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMath.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMath.h new file mode 100644 index 0000000..6d13fd9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMath.h @@ -0,0 +1,378 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MATH_H +#define PX_MATH_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxPreprocessor.h" + + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4985) // 'symbol name': attributes not present on previous declaration +#endif +#include +#if PX_VC +#pragma warning(pop) +#endif + +#include +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// constants +static const float PxPi = float(3.141592653589793); +static const float PxHalfPi = float(1.57079632679489661923); +static const float PxTwoPi = float(6.28318530717958647692); +static const float PxInvPi = float(0.31830988618379067154); +static const float PxInvTwoPi = float(0.15915494309189533577); +static const float PxPiDivTwo = float(1.57079632679489661923); +static const float PxPiDivFour = float(0.78539816339744830962); +static const float PxSqrt2 = float(1.4142135623730951); +static const float PxInvSqrt2 = float(0.7071067811865476); + +/** +\brief The return value is the greater of the two specified values. +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMax(T a, T b) +{ + return a < b ? b : a; +} + +//! overload for float to use fsel on xbox +template <> +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxMax(float a, float b) +{ + return intrinsics::selectMax(a, b); +} + +/** +\brief The return value is the lesser of the two specified values. +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxMin(T a, T b) +{ + return a < b ? a : b; +} + +template <> +//! overload for float to use fsel on xbox +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxMin(float a, float b) +{ + return intrinsics::selectMin(a, b); +} + +/* +Many of these are just implemented as PX_CUDA_CALLABLE PX_FORCE_INLINE calls to the C lib right now, +but later we could replace some of them with some approximations or more +clever stuff. +*/ + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAbs(float a) +{ + return intrinsics::abs(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxEquals(float a, float b, float eps) +{ + return (PxAbs(a - b) < eps); +} + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAbs(double a) +{ + return ::fabs(a); +} + +/** +\brief abs returns the absolute value of its argument. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE int32_t PxAbs(int32_t a) +{ + return ::abs(a); +} + +/** +\brief Clamps v to the range [hi,lo] +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE T PxClamp(T v, T lo, T hi) +{ + PX_ASSERT(lo <= hi); + return PxMin(hi, PxMax(lo, v)); +} + +//! \brief Square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSqrt(float a) +{ + return intrinsics::sqrt(a); +} + +//! \brief Square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxSqrt(double a) +{ + return ::sqrt(a); +} + +//! \brief reciprocal square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxRecipSqrt(float a) +{ + return intrinsics::recipSqrt(a); +} + +//! \brief reciprocal square root. +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxRecipSqrt(double a) +{ + return 1 / ::sqrt(a); +} + +//! \brief square of the argument +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxSqr(const PxF32 a) +{ + return a * a; +} + +//! trigonometry -- all angles are in radians. + +//! \brief Sine of an angle ( Unit: Radians ) +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSin(float a) +{ + return intrinsics::sin(a); +} + +//! \brief Sine of an angle ( Unit: Radians ) +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxSin(double a) +{ + return ::sin(a); +} + +//! \brief Cosine of an angle (Unit: Radians) +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxCos(float a) +{ + return intrinsics::cos(a); +} + +//! \brief Cosine of an angle (Unit: Radians) +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxCos(double a) +{ + return ::cos(a); +} + +//! \brief compute sine and cosine at the same time +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSinCos(const PxF32 a, PxF32& sin, PxF32& cos) +{ +#if defined(__CUDACC__) && __CUDA_ARCH__ >= 350 + __sincosf(a, &sin, &cos); +#else + sin = PxSin(a); + cos = PxCos(a); +#endif +} + +//! \brief compute sine and cosine at the same time +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSinCos(const double a, double& sin, double& cos) +{ + sin = PxSin(a); + cos = PxCos(a); +} + +/** +\brief Tangent of an angle. +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxTan(float a) +{ + return ::tanf(a); +} + +/** +\brief Tangent of an angle. +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxTan(double a) +{ + return ::tan(a); +} + +/** +\brief Arcsine. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAsin(float f) +{ + return ::asinf(PxClamp(f, -1.0f, 1.0f)); +} + +/** +\brief Arcsine. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAsin(double f) +{ + return ::asin(PxClamp(f, -1.0, 1.0)); +} + +/** +\brief Arccosine. +Returns angle between 0 and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAcos(float f) +{ + return ::acosf(PxClamp(f, -1.0f, 1.0f)); +} + +/** +\brief Arccosine. +Returns angle between 0 and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAcos(double f) +{ + return ::acos(PxClamp(f, -1.0, 1.0)); +} + +/** +\brief ArcTangent. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan(float a) +{ + return ::atanf(a); +} + +/** +\brief ArcTangent. +Returns angle between -PI/2 and PI/2 in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAtan(double a) +{ + return ::atan(a); +} + +/** +\brief Arctangent of (x/y) with correct sign. +Returns angle between -PI and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxAtan2(float x, float y) +{ + return ::atan2f(x, y); +} + +/** +\brief Arctangent of (x/y) with correct sign. +Returns angle between -PI and PI in radians +Unit: Radians +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE double PxAtan2(double x, double y) +{ + return ::atan2(x, y); +} + +/** +\brief Converts degrees to radians. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxDegToRad(const PxF32 a) +{ + return 0.01745329251994329547f * a; +} + +//! \brief returns true if the passed number is a finite floating point number as opposed to INF, NAN, etc. +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(float f) +{ + return intrinsics::isFinite(f); +} + +//! \brief returns true if the passed number is a finite floating point number as opposed to INF, NAN, etc. +PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxIsFinite(double f) +{ + return intrinsics::isFinite(f); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxFloor(float a) +{ + return ::floorf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxExp(float a) +{ + return ::expf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxCeil(float a) +{ + return ::ceilf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSign(float a) +{ + return physx::intrinsics::sign(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxSign2(float a, float eps = FLT_EPSILON) +{ + return (a < -eps) ? -1.0f : (a > eps) ? 1.0f : 0.0f; +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxPow(float x, float y) +{ + return ::powf(x, y); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float PxLog(float x) +{ + return ::logf(x); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathIntrinsics.h new file mode 100644 index 0000000..0f40918 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathIntrinsics.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MATH_INTRINSICS_H +#define PX_MATH_INTRINSICS_H + +#include "foundation/PxPreprocessor.h" + +#if PX_WINDOWS_FAMILY +#include "foundation/windows/PxWindowsMathIntrinsics.h" +#elif(PX_LINUX || PX_APPLE_FAMILY) +#include "foundation/unix/PxUnixMathIntrinsics.h" +#elif PX_SWITCH +#include "foundation/switch/PxSwitchMathIntrinsics.h" +#else +#error "Platform not supported!" +#endif + +/** +Platform specific defines +*/ +#if PX_WINDOWS_FAMILY +#pragma intrinsic(abs) +#pragma intrinsic(labs) +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathUtils.h new file mode 100644 index 0000000..bfbf3b7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMathUtils.h @@ -0,0 +1,501 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MATH_UTILS_H +#define PX_MATH_UTILS_H + +/** \addtogroup common + @{ +*/ + +#include "foundation/PxFoundationConfig.h" +#include "foundation/Px.h" +#include "foundation/PxVec4.h" +#include "foundation/PxAssert.h" +#include "foundation/PxPlane.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief finds the shortest rotation between two vectors. + +\param[in] from the vector to start from +\param[in] target the vector to rotate to +\return a rotation about an axis normal to the two vectors which takes one to the other via the shortest path +*/ +PX_FOUNDATION_API PxQuat PxShortestRotation(const PxVec3& from, const PxVec3& target); + +/* \brief diagonalizes a 3x3 symmetric matrix y + +The returned matrix satisfies M = R * D * R', where R is the rotation matrix for the output quaternion, R' its +transpose, and D the diagonal matrix + +If the matrix is not symmetric, the result is undefined. + +\param[in] m the matrix to diagonalize +\param[out] axes a quaternion rotation which diagonalizes the matrix +\return the vector diagonal of the diagonalized matrix. +*/ +PX_FOUNDATION_API PxVec3 PxDiagonalize(const PxMat33& m, PxQuat& axes); + +/** \brief creates a transform from the endpoints of a segment, suitable for an actor transform for a PxCapsuleGeometry + +\param[in] p0 one end of major axis of the capsule +\param[in] p1 the other end of the axis of the capsule +\param[out] halfHeight the halfHeight of the capsule. This parameter is optional. +\return A PxTransform which will transform the vector (1,0,0) to the capsule axis shrunk by the halfHeight +*/ +PX_FOUNDATION_API PxTransform PxTransformFromSegment(const PxVec3& p0, const PxVec3& p1, PxReal* halfHeight = NULL); + +/** \brief creates a transform from a plane equation, suitable for an actor transform for a PxPlaneGeometry + +\param[in] plane the desired plane equation +\return a PxTransform which will transform the plane PxPlane(1,0,0,0) to the specified plane +*/ +PX_FOUNDATION_API PxTransform PxTransformFromPlaneEquation(const PxPlane& plane); + +/** \brief creates a plane equation from a transform, such as the actor transform for a PxPlaneGeometry + +\param[in] pose the transform +\return the plane +*/ +PX_INLINE PxPlane PxPlaneEquationFromTransform(const PxTransform& pose) +{ + return PxPlane(1.0f, 0.0f, 0.0f, 0.0f).transform(pose); +} + +/** +\brief Spherical linear interpolation of two quaternions. +\param[in] t is the interpolation parameter in range (0, 1) +\param[in] left is the start of the interpolation +\param[in] right is the end of the interpolation +\return Returns left when t=0, right when t=1 and a linear interpolation of left and right when 0 < t < 1. +Returns angle between -PI and PI in radians +*/ +PX_FOUNDATION_API PxQuat PxSlerp(const PxReal t, const PxQuat& left, const PxQuat& right); + +/** +\brief integrate transform. +\param[in] curTrans The current transform +\param[in] linvel Linear velocity +\param[in] angvel Angular velocity +\param[in] timeStep The time-step for integration +\param[out] result The integrated transform +*/ +PX_FOUNDATION_API void PxIntegrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, + PxReal timeStep, PxTransform& result); + +//! \brief Compute the exponent of a PxVec3 +PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat PxExp(const PxVec3& v) +{ + const PxReal m = v.magnitudeSquared(); + return m < 1e-24f ? PxQuat(PxIdentity) : PxQuat(PxSqrt(m), v * PxRecipSqrt(m)); +} + +/** +\brief computes a oriented bounding box around the scaled basis. +\param basis Input = skewed basis, Output = (normalized) orthogonal basis. +\return Bounding box extent. +*/ +PX_FOUNDATION_API PxVec3 PxOptimizeBoundingBox(PxMat33& basis); + +/** +\brief return Returns the log of a PxQuat +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxLog(const PxQuat& q) +{ + const PxReal s = q.getImaginaryPart().magnitude(); + if (s < 1e-12f) + return PxVec3(0.0f); + // force the half-angle to have magnitude <= pi/2 + PxReal halfAngle = q.w < 0 ? PxAtan2(-s, -q.w) : PxAtan2(s, q.w); + PX_ASSERT(halfAngle >= -PxPi / 2 && halfAngle <= PxPi / 2); + + return q.getImaginaryPart().getNormalized() * 2.f * halfAngle; +} + +/** +\brief return Returns 0 if v.x is largest element of v, 1 if v.y is largest element, 2 if v.z is largest element. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxLargestAxis(const PxVec3& v) +{ + PxU32 m = PxU32(v.y > v.x ? 1 : 0); + return v.z > v[m] ? 2 : m; +} + +/** +\brief Compute tan(theta/2) given sin(theta) and cos(theta) as inputs. +\param[in] sin has value sin(theta) +\param[in] cos has value cos(theta) +\return Returns tan(theta/2) +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal PxTanHalf(PxReal sin, PxReal cos) +{ + // PT: avoids divide by zero for singularity. We return sqrt(FLT_MAX) instead of FLT_MAX + // to make sure the calling code doesn't generate INF values when manipulating the returned value + // (some joints multiply it by 4, etc). + if (cos == -1.0f) + return sin < 0.0f ? -sqrtf(FLT_MAX) : sqrtf(FLT_MAX); + + // PT: half-angle formula: tan(a/2) = sin(a)/(1+cos(a)) + return sin / (1.0f + cos); +} + +/** +\brief Compute the closest point on an 2d ellipse to a given 2d point. +\param[in] point is a 2d point in the y-z plane represented by (point.y, point.z) +\param[in] radii are the radii of the ellipse (radii.y and radii.z) in the y-z plane. +\return Returns the 2d position on the surface of the ellipse that is closest to point. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxEllipseClamp(const PxVec3& point, const PxVec3& radii) +{ + // lagrange multiplier method with Newton/Halley hybrid root-finder. + // see http://www.geometrictools.com/Documentation/DistancePointToEllipse2.pdf + // for proof of Newton step robustness and initial estimate. + // Halley converges much faster but sometimes overshoots - when that happens we take + // a newton step instead + + // converges in 1-2 iterations where D&C works well, and it's good with 4 iterations + // with any ellipse that isn't completely crazy + + const PxU32 MAX_ITERATIONS = 20; + const PxReal convergenceThreshold = 1e-4f; + + // iteration requires first quadrant but we recover generality later + + PxVec3 q(0, PxAbs(point.y), PxAbs(point.z)); + const PxReal tinyEps = 1e-6f; // very close to minor axis is numerically problematic but trivial + if (radii.y >= radii.z) + { + if (q.z < tinyEps) + return PxVec3(0, point.y > 0 ? radii.y : -radii.y, 0); + } + else + { + if (q.y < tinyEps) + return PxVec3(0, 0, point.z > 0 ? radii.z : -radii.z); + } + + PxVec3 denom, e2 = radii.multiply(radii), eq = radii.multiply(q); + + // we can use any initial guess which is > maximum(-e.y^2,-e.z^2) and for which f(t) is > 0. + // this guess works well near the axes, but is weak along the diagonals. + + PxReal t = PxMax(eq.y - e2.y, eq.z - e2.z); + + for (PxU32 i = 0; i < MAX_ITERATIONS; i++) + { + denom = PxVec3(0, 1 / (t + e2.y), 1 / (t + e2.z)); + PxVec3 denom2 = eq.multiply(denom); + + PxVec3 fv = denom2.multiply(denom2); + PxReal f = fv.y + fv.z - 1; + + // although in exact arithmetic we are guaranteed f>0, we can get here + // on the first iteration via catastrophic cancellation if the point is + // very close to the origin. In that case we just behave as if f=0 + + if (f < convergenceThreshold) + return e2.multiply(point).multiply(denom); + + PxReal df = fv.dot(denom) * -2.0f; + t = t - f / df; + } + + // we didn't converge, so clamp what we have + PxVec3 r = e2.multiply(point).multiply(denom); + return r * PxRecipSqrt(PxSqr(r.y / radii.y) + PxSqr(r.z / radii.z)); +} + +/** +\brief Compute from an input quaternion q a pair of quaternions (swing, twist) such that +q = swing * twist +with the caveats that swing.x = twist.y = twist.z = 0. +\param[in] q is the quaternion to be decomposed into swing and twist quaternions. +\param[out] swing is the swing component of the quaternion decomposition. +\param[out] twist is the twist component of the quaternion decomposition. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxSeparateSwingTwist(const PxQuat& q, PxQuat& swing, PxQuat& twist) +{ + twist = q.x != 0.0f ? PxQuat(q.x, 0, 0, q.w).getNormalized() : PxQuat(PxIdentity); + swing = q * twist.getConjugate(); +} + +/** +\brief Compute the angle between two non-unit vectors +\param[in] v0 is one of the non-unit vectors +\param[in] v1 is the other of the two non-unit vectors +\return Returns the angle (in radians) between the two vector v0 and v1. +*/ +PX_CUDA_CALLABLE PX_FORCE_INLINE PxF32 PxComputeAngle(const PxVec3& v0, const PxVec3& v1) +{ + const PxF32 cos = v0.dot(v1); // |v0|*|v1|*Cos(Angle) + const PxF32 sin = (v0.cross(v1)).magnitude(); // |v0|*|v1|*Sin(Angle) + return PxAtan2(sin, cos); +} + +/** +\brief Compute two normalized vectors (right and up) that are perpendicular to an input normalized vector (dir). +\param[in] dir is a normalized vector that is used to compute the perpendicular vectors. +\param[out] right is the first of the two vectors perpendicular to dir +\param[out] up is the second of the two vectors perpendicular to dir +*/ +PX_INLINE void PxComputeBasisVectors(const PxVec3& dir, PxVec3& right, PxVec3& up) +{ + // Derive two remaining vectors + if (PxAbs(dir.y) <= 0.9999f) + { + right = PxVec3(dir.z, 0.0f, -dir.x); + right.normalize(); + + // PT: normalize not needed for 'up' because dir & right are unit vectors, + // and by construction the angle between them is 90 degrees (i.e. sin(angle)=1) + up = PxVec3(dir.y * right.z, dir.z * right.x - dir.x * right.z, -dir.y * right.x); + } + else + { + right = PxVec3(1.0f, 0.0f, 0.0f); + + up = PxVec3(0.0f, dir.z, -dir.y); + up.normalize(); + } +} + +/** +\brief Compute three normalized vectors (dir, right and up) that are parallel to (dir) and perpendicular to (right, up) the +normalized direction vector (p1 - p0)/||p1 - p0||. +\param[in] p0 is used to compute the normalized vector dir = (p1 - p0)/||p1 - p0||. +\param[in] p1 is used to compute the normalized vector dir = (p1 - p0)/||p1 - p0||. +\param[out] dir is the normalized vector (p1 - p0)/||p1 - p0||. +\param[out] right is the first of the two normalized vectors perpendicular to dir +\param[out] up is the second of the two normalized vectors perpendicular to dir +*/ +PX_INLINE void PxComputeBasisVectors(const PxVec3& p0, const PxVec3& p1, PxVec3& dir, PxVec3& right, PxVec3& up) +{ + // Compute the new direction vector + dir = p1 - p0; + dir.normalize(); + + // Derive two remaining vectors + PxComputeBasisVectors(dir, right, up); +} + + +/** +\brief Compute (i+1)%3 +*/ +PX_INLINE PxU32 PxGetNextIndex3(PxU32 i) +{ + return (i + 1 + (i >> 1)) & 3; +} + +PX_INLINE PX_CUDA_CALLABLE void computeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec3& p, PxVec4& bary) +{ + const PxVec3 ba = b - a; + const PxVec3 ca = c - a; + const PxVec3 da = d - a; + const PxVec3 pa = p - a; + + const PxReal detBcd = ba.dot(ca.cross(da)); + const PxReal detPcd = pa.dot(ca.cross(da)); + + bary.y = detPcd / detBcd; + + const PxReal detBpd = ba.dot(pa.cross(da)); + bary.z = detBpd / detBcd; + + const PxReal detBcp = ba.dot(ca.cross(pa)); + + bary.w = detBcp / detBcd; + bary.x = 1 - bary.y - bary.z - bary.w; +} + +PX_INLINE PX_CUDA_CALLABLE void computeBarycentric(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& p, PxVec4& bary) +{ + const PxVec3 v0 = b - a; + const PxVec3 v1 = c - a; + const PxVec3 v2 = p - a; + + const float d00 = v0.dot(v0); + const float d01 = v0.dot(v1); + const float d11 = v1.dot(v1); + const float d20 = v2.dot(v0); + const float d21 = v2.dot(v1); + + const float denom = d00 * d11 - d01 * d01; + const float v = (d11 * d20 - d01 * d21) / denom; + const float w = (d00 * d21 - d01 * d20) / denom; + const float u = 1.f - v - w; + + bary.x = u; bary.y = v; bary.z = w; + bary.w = 0.f; +} + + +// lerp +struct Interpolation +{ + PX_INLINE PX_CUDA_CALLABLE static float PxLerp(float a, float b, float t) + { + return a + t * (b - a); + } + + PX_INLINE PX_CUDA_CALLABLE static PxReal PxBiLerp( + const PxReal f00, + const PxReal f10, + const PxReal f01, + const PxReal f11, + const PxReal tx, const PxReal ty) + { + return PxLerp( + PxLerp(f00, f10, tx), + PxLerp(f01, f11, tx), + ty); + } + + PX_INLINE PX_CUDA_CALLABLE static PxReal PxTriLerp( + const PxReal f000, + const PxReal f100, + const PxReal f010, + const PxReal f110, + const PxReal f001, + const PxReal f101, + const PxReal f011, + const PxReal f111, + const PxReal tx, + const PxReal ty, + const PxReal tz) + { + return PxLerp( + PxBiLerp(f000, f100, f010, f110, tx, ty), + PxBiLerp(f001, f101, f011, f111, tx, ty), + tz); + } + + PX_INLINE PX_CUDA_CALLABLE static PxU32 PxSDFIdx(PxU32 i, PxU32 j, PxU32 k, PxU32 nbX, PxU32 nbY) + { + return i + j * nbX + k * nbX*nbY; + } + + PX_INLINE PX_CUDA_CALLABLE static PxReal PxSDFSampleImpl(const PxReal* PX_RESTRICT sdf, const PxVec3& localPos, const PxVec3& sdfBoxLower, + const PxVec3& sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxReal tolerance) + { + PxVec3 clampedGridPt = localPos.maximum(sdfBoxLower).minimum(sdfBoxHigher); + + const PxVec3 diff = (localPos - clampedGridPt); + + if (diff.magnitudeSquared() > tolerance*tolerance) + return PX_MAX_F32; + + PxVec3 f = (clampedGridPt - sdfBoxLower) * invSdfDx; + + PxU32 i = PxU32(f.x); + PxU32 j = PxU32(f.y); + PxU32 k = PxU32(f.z); + + f -= PxVec3(PxReal(i), PxReal(j), PxReal(k)); + + if (i >= (dimX - 1)) + { + i = dimX - 2; + clampedGridPt.x -= f.x * sdfDx; + f.x = 1.f; + } + if (j >= (dimY - 1)) + { + j = dimY - 2; + clampedGridPt.y -= f.y * sdfDx; + f.y = 1.f; + } + if (k >= (dimZ - 1)) + { + k = dimZ - 2; + clampedGridPt.z -= f.z * sdfDx; + f.z = 1.f; + } + + const PxReal s000 = sdf[Interpolation::PxSDFIdx(i, j, k, dimX, dimY)]; + const PxReal s100 = sdf[Interpolation::PxSDFIdx(i + 1, j, k, dimX, dimY)]; + const PxReal s010 = sdf[Interpolation::PxSDFIdx(i, j + 1, k, dimX, dimY)]; + const PxReal s110 = sdf[Interpolation::PxSDFIdx(i + 1, j + 1, k, dimX, dimY)]; + const PxReal s001 = sdf[Interpolation::PxSDFIdx(i, j, k + 1, dimX, dimY)]; + const PxReal s101 = sdf[Interpolation::PxSDFIdx(i + 1, j, k + 1, dimX, dimY)]; + const PxReal s011 = sdf[Interpolation::PxSDFIdx(i, j + 1, k + 1, dimX, dimY)]; + const PxReal s111 = sdf[Interpolation::PxSDFIdx(i + 1, j + 1, k + 1, dimX, dimY)]; + + PxReal dist = PxTriLerp( + s000, + s100, + s010, + s110, + s001, + s101, + s011, + s111, + f.x, f.y, f.z); + + dist += diff.magnitude(); + + return dist; + } + +}; + +PX_INLINE PX_CUDA_CALLABLE PxReal PxSdfSample(const PxReal* PX_RESTRICT sdf, const PxVec3& localPos, const PxVec3& sdfBoxLower, + const PxVec3& sdfBoxHigher, const PxReal sdfDx, const PxReal invSdfDx, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, PxVec3& gradient, PxReal tolerance = PX_MAX_F32) +{ + + PxReal dist = Interpolation::PxSDFSampleImpl(sdf, localPos, sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + + if (dist < tolerance) + { + + PxVec3 grad; + grad.x = Interpolation::PxSDFSampleImpl(sdf, localPos + PxVec3(sdfDx, 0.f, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + Interpolation::PxSDFSampleImpl(sdf, localPos - PxVec3(sdfDx, 0.f, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + grad.y = Interpolation::PxSDFSampleImpl(sdf, localPos + PxVec3(0.f, sdfDx, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + Interpolation::PxSDFSampleImpl(sdf, localPos - PxVec3(0.f, sdfDx, 0.f), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + grad.z = Interpolation::PxSDFSampleImpl(sdf, localPos + PxVec3(0.f, 0.f, sdfDx), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance) - + Interpolation::PxSDFSampleImpl(sdf, localPos - PxVec3(0.f, 0.f, sdfDx), sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + + gradient = grad; + + } + + return dist; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMemory.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMemory.h new file mode 100644 index 0000000..750a5fa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMemory.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MEMORY_H +#define PX_MEMORY_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/Px.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Sets the bytes of the provided buffer to zero. + + \param dest [out] Pointer to block of memory to set zero. + \param count [in] Number of bytes to set to zero. + + \return Pointer to memory block (same as input) + */ + PX_FORCE_INLINE void* PxMemZero(void* dest, PxU32 count) + { + return physx::intrinsics::memZero(dest, count); + } + + /** + \brief Sets the bytes of the provided buffer to the specified value. + + \param dest [out] Pointer to block of memory to set to the specified value. + \param c [in] Value to set the bytes of the block of memory to. + \param count [in] Number of bytes to set to the specified value. + + \return Pointer to memory block (same as input) + */ + PX_FORCE_INLINE void* PxMemSet(void* dest, PxI32 c, PxU32 count) + { + return physx::intrinsics::memSet(dest, c, count); + } + + /** + \brief Copies the bytes of one memory block to another. The memory blocks must not overlap. + + \note Use #PxMemMove if memory blocks overlap. + + \param dest [out] Pointer to block of memory to copy to. + \param src [in] Pointer to block of memory to copy from. + \param count [in] Number of bytes to copy. + + \return Pointer to destination memory block + */ + PX_FORCE_INLINE void* PxMemCopy(void* dest, const void* src, PxU32 count) + { + return physx::intrinsics::memCopy(dest, src, count); + } + + /** + \brief Copies the bytes of one memory block to another. The memory blocks can overlap. + + \note Use #PxMemCopy if memory blocks do not overlap. + + \param dest [out] Pointer to block of memory to copy to. + \param src [in] Pointer to block of memory to copy from. + \param count [in] Number of bytes to copy. + + \return Pointer to destination memory block + */ + PX_FORCE_INLINE void* PxMemMove(void* dest, const void* src, PxU32 count) + { + return physx::intrinsics::memMove(dest, src, count); + } + + /** + 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. + + \param ptr [out] Pointer to block of memory to initialize. + \param byteSize [in] Number of bytes to initialize. + */ + PX_INLINE void PxMarkSerializedMemory(void* ptr, PxU32 byteSize) + { +#if PX_CHECKED + PxMemSet(ptr, 0xcd, byteSize); +#else + PX_UNUSED(ptr); + PX_UNUSED(byteSize); +#endif + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMutex.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMutex.h new file mode 100644 index 0000000..fcb8e02 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxMutex.h @@ -0,0 +1,183 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MUTEX_H +#define PX_MUTEX_H + +#include "foundation/PxAllocator.h" + +/* + * This inclusion is a best known fix for gcc 4.4.1 error: + * Creating object file for apex/src/PsAllocator.cpp ... + * In file included from apex/include/PsFoundation.h:30, + * from apex/src/PsAllocator.cpp:26: + * apex/include/PsMutex.h: In constructor 'physx::PxMutexT::MutexT(const Alloc&)': + * apex/include/PsMutex.h:92: error: no matching function for call to 'operator new(unsigned int, + * physx::PxMutexImpl*&)' + * :0: note: candidates are: void* operator new(unsigned int) + */ +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif +class PX_FOUNDATION_API PxMutexImpl +{ + public: + /** + The constructor for Mutex creates a mutex. It is initially unlocked. + */ + PxMutexImpl(); + + /** + The destructor for Mutex deletes the mutex. + */ + ~PxMutexImpl(); + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method blocks until the mutex is + unlocked. + */ + void lock(); + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method returns false without blocking. + */ + bool trylock(); + + /** + Release (unlock) the mutex. + */ + void unlock(); + + /** + Size of this class. + */ + static uint32_t getSize(); +}; + +template > +class PxMutexT : protected Alloc +{ + PX_NOCOPY(PxMutexT) + public: + class ScopedLock + { + PxMutexT& mMutex; + PX_NOCOPY(ScopedLock) + public: + PX_INLINE ScopedLock(PxMutexT& mutex) : mMutex(mutex) + { + mMutex.lock(); + } + PX_INLINE ~ScopedLock() + { + mMutex.unlock(); + } + }; + + /** + The constructor for Mutex creates a mutex. It is initially unlocked. + */ + PxMutexT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxMutexImpl::getSize(), __FILE__, __LINE__)); + PX_PLACEMENT_NEW(mImpl, PxMutexImpl)(); + } + + /** + The destructor for Mutex deletes the mutex. + */ + ~PxMutexT() + { + mImpl->~PxMutexImpl(); + Alloc::deallocate(mImpl); + } + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method blocks until the mutex is + unlocked. + */ + PX_FORCE_INLINE void lock() const + { + mImpl->lock(); + } + + /** + Acquire (lock) the mutex. If the mutex is already locked + by another thread, this method returns false without blocking, + returns true if lock is successfully acquired + */ + PX_FORCE_INLINE bool trylock() const + { + return mImpl->trylock(); + } + + /** + Release (unlock) the mutex, the calling thread must have + previously called lock() or method will error + */ + PX_FORCE_INLINE void unlock() const + { + mImpl->unlock(); + } + + private: + PxMutexImpl* mImpl; +}; + +class PX_FOUNDATION_API PxReadWriteLock +{ + PX_NOCOPY(PxReadWriteLock) + public: + PxReadWriteLock(); + ~PxReadWriteLock(); + + // "takeLock" can only be false if the thread already holds the mutex, e.g. if it already acquired the write lock + void lockReader(bool takeLock); + void lockWriter(); + + void unlockReader(); + void unlockWriter(); + + private: + class ReadWriteLockImpl* mImpl; +}; + +typedef PxMutexT<> PxMutex; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPhysicsVersion.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPhysicsVersion.h new file mode 100644 index 0000000..bab58af --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPhysicsVersion.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_VERSION_H +#define PX_PHYSICS_VERSION_H + +/* +VersionNumbers: The combination of these +numbers uniquely identifies the API, and should +be incremented when the SDK API changes. This may +include changes to file formats. + +This header is included in the main SDK header files +so that the entire SDK and everything that builds on it +is completely rebuilt when this file changes. Thus, +this file is not to include a frequently changing +build number. See BuildNumber.h for that. + +Each of these three values should stay below 255 because +sometimes they are stored in a byte. +*/ +/** \addtogroup foundation + @{ +*/ + +#define PX_PHYSICS_VERSION_MAJOR 5 +#define PX_PHYSICS_VERSION_MINOR 1 +#define PX_PHYSICS_VERSION_BUGFIX 3 + +/** +The constant PX_PHYSICS_VERSION is used when creating certain PhysX module objects. +This is to ensure that the application is using the same header version as the library was built with. +*/ +#define PX_PHYSICS_VERSION ((PX_PHYSICS_VERSION_MAJOR<<24) + (PX_PHYSICS_VERSION_MINOR<<16) + (PX_PHYSICS_VERSION_BUGFIX<<8) + 0) + +#endif + + /** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPinnedArray.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPinnedArray.h new file mode 100644 index 0000000..020fb43 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPinnedArray.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PINNED_ARRAY_H +#define PX_PINNED_ARRAY_H + +#include "foundation/PxArray.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBounds3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + template + using PxPinnedArray = PxArray; + + typedef PxArray PxBoundsArrayPinned; + typedef PxArray PxFloatArrayPinned; + typedef PxArray PxInt32ArrayPinned; + typedef PxArray PxInt8ArrayPinned; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPlane.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPlane.h new file mode 100644 index 0000000..a041862 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPlane.h @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PLANE_H +#define PX_PLANE_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Representation of a plane. + + Plane equation used: n.dot(v) + d = 0 +*/ +class PxPlane +{ + public: + /** + \brief Constructor + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane() + { + } + + /** + \brief Constructor from a normal and a distance + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(float nx, float ny, float nz, float distance) : n(nx, ny, nz), d(distance) + { + } + + /** + \brief Constructor from a normal and a distance + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& normal, float distance) : n(normal), d(distance) + { + } + + /** + \brief Constructor from a point on the plane and a normal + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& point, const PxVec3& normal) + : n(normal), d(-point.dot(n)) // p satisfies normal.dot(p) + d = 0 + { + } + + /** + \brief Constructor from three points + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2) + { + n = (p1 - p0).cross(p2 - p0).getNormalized(); + d = -p0.dot(n); + } + + /** + \brief returns true if the two planes are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxPlane& p) const + { + return n == p.n && d == p.d; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE float distance(const PxVec3& p) const + { + return p.dot(n) + d; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool contains(const PxVec3& p) const + { + return PxAbs(distance(p)) < (1.0e-7f); + } + + /** + \brief projects p into the plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 project(const PxVec3& p) const + { + return p - n * distance(p); + } + + /** + \brief find an arbitrary point in the plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 pointInPlane() const + { + return -n * d; + } + + /** + \brief equivalent plane with unit normal + */ + + PX_CUDA_CALLABLE PX_FORCE_INLINE void normalize() + { + float denom = 1.0f / n.magnitude(); + n *= denom; + d *= denom; + } + + /** + \brief transform plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane transform(const PxTransform& pose) const + { + const PxVec3 transformedNormal = pose.rotate(n); + return PxPlane(transformedNormal, d - pose.p.dot(transformedNormal)); + } + + /** + \brief inverse-transform plane + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxPlane inverseTransform(const PxTransform& pose) const + { + const PxVec3 transformedNormal = pose.rotateInv(n); + return PxPlane(transformedNormal, d + pose.p.dot(n)); + } + + PxVec3 n; //!< The normal to the plane + float d; //!< The distance from the origin +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPool.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPool.h new file mode 100644 index 0000000..21c8367 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPool.h @@ -0,0 +1,269 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_POOL_H +#define PX_POOL_H + +#include "foundation/PxArray.h" +#include "foundation/PxSort.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxMemory.h" + +namespace physx +{ + +/*! +Simple allocation pool +*/ +template ::Type> +class PxPoolBase : public PxUserAllocated, public Alloc +{ + PX_NOCOPY(PxPoolBase) + protected: + PxPoolBase(const Alloc& alloc, uint32_t elementsPerSlab, uint32_t slabSize) + : Alloc(alloc), mSlabs(alloc), mElementsPerSlab(elementsPerSlab), mUsed(0), mSlabSize(slabSize), mFreeElement(0) + { + mSlabs.reserve(64); +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-local-typedef" +#endif // PX_LINUX +#endif // PX_CLANG + PX_COMPILE_TIME_ASSERT(sizeof(T) >= sizeof(size_t)); +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic pop +#endif +#endif + } + + public: + ~PxPoolBase() + { + if(mUsed) + disposeElements(); + + for(void** slabIt = mSlabs.begin(), *slabEnd = mSlabs.end(); slabIt != slabEnd; ++slabIt) + Alloc::deallocate(*slabIt); + } + + // Allocate space for single object + PX_INLINE T* allocate() + { + if(mFreeElement == 0) + allocateSlab(); + T* p = reinterpret_cast(mFreeElement); + mFreeElement = mFreeElement->mNext; + mUsed++; + + PxMarkSerializedMemory(p, sizeof(T)); + return p; + } + + // Put space for a single element back in the lists + PX_INLINE void deallocate(T* p) + { + if(p) + { + PX_ASSERT(mUsed); + mUsed--; + push(reinterpret_cast(p)); + } + } + + PX_INLINE T* construct() + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T()) : NULL; + } + + template + PX_INLINE T* construct(A1& a) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c)) : NULL; + } + + template + PX_INLINE T* construct(A1* a, A2& b, A3& c) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f, A7& g) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f, g)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e, A6& f, A7& g, A8& h) + { + T* t = allocate(); + return t ? PX_PLACEMENT_NEW(t, T(a, b, c, d, e, f, g, h)) : NULL; + } + + PX_INLINE void destroy(T* const p) + { + if(p) + { + p->~T(); + deallocate(p); + } + } + + protected: + struct FreeList + { + FreeList* mNext; + }; + + // All the allocated slabs, sorted by pointer + PxArray mSlabs; + + uint32_t mElementsPerSlab; + uint32_t mUsed; + uint32_t mSlabSize; + + FreeList* mFreeElement; // Head of free-list + + // Helper function to get bitmap of allocated elements + + void push(FreeList* p) + { + p->mNext = mFreeElement; + mFreeElement = p; + } + + // Allocate a slab and segregate it into the freelist + void allocateSlab() + { + T* slab = reinterpret_cast(Alloc::allocate(mSlabSize, __FILE__, __LINE__)); + + mSlabs.pushBack(slab); + + // Build a chain of nodes for the freelist + T* it = slab + mElementsPerSlab; + while(--it >= slab) + push(reinterpret_cast(it)); + } + + /* + Cleanup method. Go through all active slabs and call destructor for live objects, + then free their memory + */ + void disposeElements() + { + PxArray freeNodes(*this); + while(mFreeElement) + { + freeNodes.pushBack(mFreeElement); + mFreeElement = mFreeElement->mNext; + } + Alloc& alloc(*this); + PxSort(freeNodes.begin(), freeNodes.size(), PxLess(), alloc); + PxSort(mSlabs.begin(), mSlabs.size(), PxLess(), alloc); + + typename PxArray::Iterator slabIt = mSlabs.begin(), slabEnd = mSlabs.end(); + for(typename PxArray::Iterator freeIt = freeNodes.begin(); slabIt != slabEnd; ++slabIt) + { + for(T* tIt = reinterpret_cast(*slabIt), *tEnd = tIt + mElementsPerSlab; tIt != tEnd; ++tIt) + { + if(freeIt != freeNodes.end() && *freeIt == tIt) + ++freeIt; + else + tIt->~T(); + } + } + } +}; + +// original pool implementation +template ::Type> +class PxPool : public PxPoolBase +{ + public: + PxPool(const Alloc& alloc = Alloc(), uint32_t elementsPerSlab = 32) + : PxPoolBase(alloc, elementsPerSlab, elementsPerSlab * sizeof(T)) + { + } +}; + +// allows specification of the slab size instead of the occupancy +template ::Type> +class PxPool2 : public PxPoolBase +{ + public: + PxPool2(const Alloc& alloc = Alloc()) : PxPoolBase(alloc, slabSize / sizeof(T), slabSize) + { + } +}; + +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPreprocessor.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPreprocessor.h new file mode 100644 index 0000000..bdc3bfc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxPreprocessor.h @@ -0,0 +1,529 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PREPROCESSOR_H +#define PX_PREPROCESSOR_H + +#include +#if !defined(PX_GENERATE_META_DATA) +#include +#endif +/** \addtogroup foundation + @{ +*/ + +#ifndef PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#define PX_ENABLE_FEATURES_UNDER_CONSTRUCTION 0 +#endif + +#define PX_STRINGIZE_HELPER(X) #X +#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) + +#define PX_CONCAT_HELPER(X, Y) X##Y +#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) + +/* +The following preprocessor identifiers specify compiler, OS, and architecture. +All definitions have a value of 1 or 0, use '#if' instead of '#ifdef'. +*/ + +/** +Compiler defines, see http://sourceforge.net/p/predef/wiki/Compilers/ +*/ +#if defined(_MSC_VER) + #if _MSC_VER >= 1920 + #define PX_VC 16 + #elif _MSC_VER >= 1910 + #define PX_VC 15 + #elif _MSC_VER >= 1900 + #define PX_VC 14 + #elif _MSC_VER >= 1800 + #define PX_VC 12 + #elif _MSC_VER >= 1700 + #define PX_VC 11 + #elif _MSC_VER >= 1600 + #define PX_VC 10 + #elif _MSC_VER >= 1500 + #define PX_VC 9 + #else + #error "Unknown VC version" + #endif +#endif + +#if defined(__clang__) + #define PX_CLANG 1 + #if defined (__clang_major__) + #define PX_CLANG_MAJOR __clang_major__ + #elif defined (_clang_major) + #define PX_CLANG_MAJOR _clang_major + #else + #define PX_CLANG_MAJOR 0 + #endif +#endif // __clang__ + +#if defined(__GNUC__) // note: __clang__ implies __GNUC__ + #define PX_GCC 1 +#endif + +// Ensure we have at least 1 known compiler, note that in a cross compilation +// scenario targeting windows with clang-cl, both PX_CLANG and the PX_VC version +// will be set, at least if clang-cl has been instructed to use msvc compatibility +#if !defined(_MSC_VER) && !defined(PX_CLANG) && !defined(PX_GCC) + #error "Unknown compiler" +#endif + +/** +Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSystems/ +*/ +#if defined(_WIN64) + #define PX_WIN64 1 +#elif defined(_WIN32) // note: _M_PPC implies _WIN32 + #define PX_WIN32 1 +#elif defined(__linux__) || defined (__EMSCRIPTEN__) + #define PX_LINUX 1 +#elif defined(__APPLE__) + #define PX_OSX 1 +#elif defined(__NX__) + #define PX_SWITCH 1 +#else + #error "Unknown operating system" +#endif + +/** +Architecture defines, see http://sourceforge.net/p/predef/wiki/Architectures/ +*/ +#if defined(__x86_64__) || defined(_M_X64) + #define PX_X64 1 +#elif defined(__i386__) || defined(_M_IX86) || defined (__EMSCRIPTEN__) + #define PX_X86 1 +#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) + #define PX_A64 1 +#elif defined(__arm__) || defined(_M_ARM) + #define PX_ARM 1 +#elif defined(__ppc__) || defined(_M_PPC) || defined(__CELLOS_LV2__) + #define PX_PPC 1 +#else + #error "Unknown architecture" +#endif + +/** +SIMD defines +*/ +#if !defined(PX_SIMD_DISABLED) + #if defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) || (defined (__EMSCRIPTEN__) && defined(__SSE2__)) + #define PX_SSE2 1 + #endif + #if defined(_M_ARM) || defined(__ARM_NEON__) || defined(__ARM_NEON) + #define PX_NEON 1 + #endif + #if defined(_M_PPC) || defined(__CELLOS_LV2__) + #define PX_VMX 1 + #endif +#endif + +/** +define anything not defined on this platform to 0 +*/ +#ifndef PX_VC + #define PX_VC 0 +#endif +#ifndef PX_CLANG + #define PX_CLANG 0 +#endif +#ifndef PX_GCC + #define PX_GCC 0 +#endif +#ifndef PX_WIN64 + #define PX_WIN64 0 +#endif +#ifndef PX_WIN32 + #define PX_WIN32 0 +#endif +#ifndef PX_LINUX + #define PX_LINUX 0 +#endif +#ifndef PX_OSX + #define PX_OSX 0 +#endif +#ifndef PX_SWITCH + #define PX_SWITCH 0 +#endif +#ifndef PX_X64 + #define PX_X64 0 +#endif +#ifndef PX_X86 + #define PX_X86 0 +#endif +#ifndef PX_A64 + #define PX_A64 0 +#endif +#ifndef PX_ARM + #define PX_ARM 0 +#endif +#ifndef PX_PPC + #define PX_PPC 0 +#endif +#ifndef PX_SSE2 + #define PX_SSE2 0 +#endif +#ifndef PX_NEON + #define PX_NEON 0 +#endif +#ifndef PX_VMX + #define PX_VMX 0 +#endif + +/* +define anything not defined through the command line to 0 +*/ +#ifndef PX_DEBUG + #define PX_DEBUG 0 +#endif +#ifndef PX_CHECKED + #define PX_CHECKED 0 +#endif +#ifndef PX_PROFILE + #define PX_PROFILE 0 +#endif +#ifndef PX_DEBUG_CRT + #define PX_DEBUG_CRT 0 +#endif +#ifndef PX_NVTX + #define PX_NVTX 0 +#endif +#ifndef PX_DOXYGEN + #define PX_DOXYGEN 0 +#endif + +/** +family shortcuts +*/ +// compiler +#define PX_GCC_FAMILY (PX_CLANG || PX_GCC) +// os +#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64) +#define PX_LINUX_FAMILY PX_LINUX +#define PX_APPLE_FAMILY c // equivalent to #if __APPLE__ +#define PX_UNIX_FAMILY (PX_LINUX_FAMILY || PX_APPLE_FAMILY) // shortcut for unix/posix platforms +#if defined(__EMSCRIPTEN__) + #define PX_EMSCRIPTEN 1 +#else + #define PX_EMSCRIPTEN 0 +#endif +// architecture +#define PX_INTEL_FAMILY (PX_X64 || PX_X86) +#define PX_ARM_FAMILY (PX_ARM || PX_A64) +#define PX_P64_FAMILY (PX_X64 || PX_A64) // shortcut for 64-bit architectures + +/** +C++ standard library defines +*/ +#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_EMSCRIPTEN + #define PX_LIBCPP 1 +#else + #define PX_LIBCPP 0 +#endif + +// legacy define for PhysX +#define PX_WINDOWS (PX_WINDOWS_FAMILY && !PX_ARM_FAMILY) + +/** +Assert macro +*/ +#ifndef PX_ENABLE_ASSERTS + #if PX_DEBUG && !defined(__CUDACC__) + #define PX_ENABLE_ASSERTS 1 + #else + #define PX_ENABLE_ASSERTS 0 + #endif +#endif + +/** +DLL export macros +*/ +#ifndef PX_C_EXPORT + #if PX_WINDOWS_FAMILY || PX_LINUX + #define PX_C_EXPORT extern "C" + #else + #define PX_C_EXPORT + #endif +#endif + +#if PX_UNIX_FAMILY&& __GNUC__ >= 4 + #define PX_UNIX_EXPORT __attribute__((visibility("default"))) +#else + #define PX_UNIX_EXPORT +#endif + +#if PX_WINDOWS_FAMILY + #define PX_DLL_EXPORT __declspec(dllexport) + #define PX_DLL_IMPORT __declspec(dllimport) +#else + #define PX_DLL_EXPORT PX_UNIX_EXPORT + #define PX_DLL_IMPORT +#endif + +/** +Calling convention +*/ +#ifndef PX_CALL_CONV + #if PX_WINDOWS_FAMILY + #define PX_CALL_CONV __cdecl + #else + #define PX_CALL_CONV + #endif +#endif + +/** +Pack macros - disabled on SPU because they are not supported +*/ +#if PX_VC + #define PX_PUSH_PACK_DEFAULT __pragma(pack(push, 8)) + #define PX_POP_PACK __pragma(pack(pop)) +#elif PX_GCC_FAMILY + #define PX_PUSH_PACK_DEFAULT _Pragma("pack(push, 8)") + #define PX_POP_PACK _Pragma("pack(pop)") +#else + #define PX_PUSH_PACK_DEFAULT + #define PX_POP_PACK +#endif + +/** +Inline macro +*/ +#define PX_INLINE inline +#if PX_WINDOWS_FAMILY && !PX_CLANG // clang doesn't understand this pragma + #pragma inline_depth(255) +#endif + +/** +Force inline macro +*/ +#if PX_VC + #define PX_FORCE_INLINE __forceinline +#elif PX_LINUX // Workaround; Fedora Core 3 do not agree with force inline and PxcPool + #define PX_FORCE_INLINE inline +#elif PX_GCC_FAMILY + #define PX_FORCE_INLINE inline __attribute__((always_inline)) +#else + #define PX_FORCE_INLINE inline +#endif + +/** +Noinline macro +*/ +#if PX_WINDOWS_FAMILY + #define PX_NOINLINE __declspec(noinline) +#elif PX_GCC_FAMILY + #define PX_NOINLINE __attribute__((noinline)) +#else + #define PX_NOINLINE +#endif + +/** +Restrict macro +*/ +#if defined(__CUDACC__) + #define PX_RESTRICT __restrict__ +#else + #define PX_RESTRICT __restrict +#endif + +/** +Noalias macro +*/ +#if PX_WINDOWS_FAMILY + #define PX_NOALIAS __declspec(noalias) +#else + #define PX_NOALIAS +#endif + +/** +Override macro +*/ +#define PX_OVERRIDE override + +/** +Alignment macros + +PX_ALIGN_PREFIX and PX_ALIGN_SUFFIX can be used for type alignment instead of aligning individual variables as follows: +PX_ALIGN_PREFIX(16) +struct A { +... +} PX_ALIGN_SUFFIX(16); +This declaration style is parsed correctly by Visual Assist. +*/ +#ifndef PX_ALIGN + #if PX_WINDOWS_FAMILY + #define PX_ALIGN(alignment, decl) __declspec(align(alignment)) decl + #define PX_ALIGN_PREFIX(alignment) __declspec(align(alignment)) + #define PX_ALIGN_SUFFIX(alignment) + #elif PX_GCC_FAMILY + #define PX_ALIGN(alignment, decl) decl __attribute__((aligned(alignment))) + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) __attribute__((aligned(alignment))) + #elif defined __CUDACC__ + #define PX_ALIGN(alignment, decl) __align__(alignment) decl + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) __align__(alignment)) + #else + #define PX_ALIGN(alignment, decl) + #define PX_ALIGN_PREFIX(alignment) + #define PX_ALIGN_SUFFIX(alignment) + #endif +#endif + +/** +Deprecated macro +- To deprecate a function: Place PX_DEPRECATED at the start of the function header (leftmost word). +- To deprecate a 'typedef', a 'struct' or a 'class': Place PX_DEPRECATED directly after the keywords ('typedef', +'struct', 'class'). + +Use these macro definitions to create warnings for deprecated functions +\#define PX_DEPRECATED __declspec(deprecated) // Microsoft +\#define PX_DEPRECATED __attribute__((deprecated())) // GCC +*/ +#ifndef PX_DEPRECATED + #define PX_DEPRECATED +#endif + +/** +General defines +*/ + +// static assert +#if(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (PX_APPLE_FAMILY) || (PX_SWITCH) || (PX_CLANG && PX_ARM) || (PX_CLANG && PX_A64) || (PX_CLANG && PX_WINDOWS) + #define PX_COMPILE_TIME_ASSERT(exp) typedef char PX_CONCAT(PxCompileTimeAssert_Dummy, __COUNTER__)[(exp) ? 1 : -1] __attribute__((unused)) +#else + #define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1] +#endif + +#if PX_GCC_FAMILY + #define PX_OFFSET_OF(X, Y) __builtin_offsetof(X, Y) +#else + #define PX_OFFSET_OF(X, Y) offsetof(X, Y) +#endif + +#define PX_OFFSETOF_BASE 0x100 // casting the null ptr takes a special-case code path, which we don't want +#define PX_OFFSET_OF_RT(Class, Member) (reinterpret_cast(&reinterpret_cast(PX_OFFSETOF_BASE)->Member) - size_t(PX_OFFSETOF_BASE)) + +// check that exactly one of NDEBUG and _DEBUG is defined +#if !defined(NDEBUG) ^ defined(_DEBUG) + #error Exactly one of NDEBUG and _DEBUG needs to be defined! +#endif + +// make sure PX_CHECKED is defined in all _DEBUG configurations as well +#if !PX_CHECKED && PX_DEBUG + #error PX_CHECKED must be defined when PX_DEBUG is defined +#endif + +#ifdef __CUDACC__ + #define PX_CUDA_CALLABLE __host__ __device__ +#else + #define PX_CUDA_CALLABLE +#endif + +// avoid unreferenced parameter warning +// preferred solution: omit the parameter's name from the declaration +template +PX_CUDA_CALLABLE PX_INLINE void PX_UNUSED(T const&) +{ +} + +// Ensure that the application hasn't tweaked the pack value to less than 8, which would break +// matching between the API headers and the binaries +// This assert works on win32/win64, but may need further specialization on other platforms. +// Some GCC compilers need the compiler flag -malign-double to be set. +// Apparently the apple-clang-llvm compiler doesn't support malign-double. +#if PX_APPLE_FAMILY || (PX_CLANG && !PX_ARM && !PX_WINDOWS) + struct PxPackValidation + { + char _; + long a; + }; +#elif PX_CLANG && PX_ARM + struct PxPackValidation + { + char _; + double a; + }; +#else + struct PxPackValidation + { + char _; + long long a; + }; +#endif +// clang (as of version 3.9) cannot align doubles on 8 byte boundary when compiling for Intel 32 bit target +#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN && !(PX_CLANG && PX_X86) + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxPackValidation, a) == 8); +#endif + +// use in a cpp file to suppress LNK4221 +#if PX_VC && !PX_CLANG + #define PX_DUMMY_SYMBOL \ + namespace \ + { \ + char PxDummySymbol; \ + } +#else + #define PX_DUMMY_SYMBOL +#endif + +#if PX_GCC_FAMILY + #define PX_WEAK_SYMBOL __attribute__((weak)) // this is to support SIMD constant merging in template specialization +#else + #define PX_WEAK_SYMBOL +#endif + +// Macro for avoiding default assignment and copy, because doing this by inheritance can increase class size on some +// platforms. +#define PX_NOCOPY(Class) \ +protected: \ + Class(const Class&); \ + Class& operator=(const Class&); + +//#define DISABLE_CUDA_PHYSX +#ifndef DISABLE_CUDA_PHYSX + //CUDA is currently supported on x86_64 windows and linux, and ARM_64 linux + #define PX_SUPPORT_GPU_PHYSX ((PX_X64 && (PX_WINDOWS_FAMILY || PX_LINUX)) || (PX_A64 && PX_LINUX)) +#else + #define PX_SUPPORT_GPU_PHYSX 0 +#endif + +#ifndef PX_SUPPORT_EXTERN_TEMPLATE + #define PX_SUPPORT_EXTERN_TEMPLATE (PX_VC != 11) +#else + #define PX_SUPPORT_EXTERN_TEMPLATE 0 +#endif + +#define PX_FL __FILE__, __LINE__ + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxProfiler.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxProfiler.h new file mode 100644 index 0000000..b72a6b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxProfiler.h @@ -0,0 +1,103 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILER_H +#define PX_PROFILER_H + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief The pure virtual callback interface for general purpose instrumentation and profiling of GameWorks modules as +well as applications +*/ +class PxProfilerCallback +{ +protected: + virtual ~PxProfilerCallback() {} + +public: + /************************************************************************************************************************** + Instrumented profiling events + ***************************************************************************************************************************/ + + /** + \brief Mark the beginning of a nested profile block + \param[in] eventName Event name. Must be a persistent const char * + \param[in] detached True for cross thread events + \param[in] contextId the context id of this zone. Zones with the same id belong to the same group. 0 is used for no specific group. + \return Returns implementation-specific profiler data for this event + */ + virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId) = 0; + + /** + \brief Mark the end of a nested profile block + \param[in] profilerData The data returned by the corresponding zoneStart call (or NULL if not available) + \param[in] eventName The name of the zone ending, must match the corresponding name passed with 'zoneStart'. Must be a persistent const char *. + \param[in] detached True for cross thread events. Should match the value passed to zoneStart. + \param[in] contextId The context of this zone. Should match the value passed to zoneStart. + + \note eventName plus contextId can be used to uniquely match up start and end of a zone. + */ + virtual void zoneEnd(void* profilerData, const char* eventName, bool detached, uint64_t contextId) = 0; +}; + +class PxProfileScoped +{ + public: + PX_FORCE_INLINE PxProfileScoped(PxProfilerCallback* callback, const char* eventName, bool detached, uint64_t contextId) : mCallback(callback), mProfilerData(NULL) + { + if(mCallback) + { + mEventName = eventName; + mContextId = contextId; + mDetached = detached; + mProfilerData = mCallback->zoneStart(eventName, detached, contextId); + } + } + + PX_FORCE_INLINE ~PxProfileScoped() + { + if(mCallback) + mCallback->zoneEnd(mProfilerData, mEventName, mDetached, mContextId); + } + PxProfilerCallback* mCallback; + const char* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxQuat.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxQuat.h new file mode 100644 index 0000000..df35c01 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxQuat.h @@ -0,0 +1,402 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_QUAT_H +#define PX_QUAT_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxVec3.h" +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief This is a quaternion class. For more information on quaternion mathematics +consult a mathematics source on complex numbers. +*/ + +class PxQuat +{ + public: + + /** + \brief Default constructor, does not do any initialization. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat() + { + } + + //! identity constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat(PxIDENTITY) : x(float(0.0)), y(float(0.0)), z(float(0.0)), w(float(1.0)) + { + } + + /** + \brief Constructor from a scalar: sets the real part w to the scalar value, and the imaginary parts (x,y,z) to zero + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat(float r) : x(float(0.0)), y(float(0.0)), z(float(0.0)), w(r) + { + } + + /** + \brief Constructor. Take note of the order of the elements! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat(float nx, float ny, float nz, float nw) : x(nx), y(ny), z(nz), w(nw) + { + } + + /** + \brief Creates from angle-axis representation. + + Axis must be normalized! + + Angle is in radians! + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_INLINE PxQuat(float angleRadians, const PxVec3& unitAxis) + { + PX_ASSERT(PxAbs(float(1.0) - unitAxis.magnitude()) < float(1e-3)); + const float a = angleRadians * float(0.5); + + float s; + PxSinCos(a, s, w); + x = unitAxis.x * s; + y = unitAxis.y * s; + z = unitAxis.z * s; + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat(const PxQuat& v) : x(v.x), y(v.y), z(v.z), w(v.w) + { + } + + /** + \brief Creates from orientation matrix. + + \param[in] m Rotation matrix to extract quaternion from. + */ + PX_CUDA_CALLABLE PX_INLINE explicit PxQuat(const PxMat33& m); /* defined in PxMat33.h */ + + /** + \brief returns true if quat is identity + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isIdentity() const + { + return x==float(0.0) && y==float(0.0) && z==float(0.0) && w==float(1.0); + } + + /** + \brief returns true if all elements are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z) && PxIsFinite(w); + } + + /** + \brief returns true if finite and magnitude is close to unit + */ + PX_CUDA_CALLABLE bool isUnit() const + { + const float unitTolerance = float(1e-3); + return isFinite() && PxAbs(magnitude() - float(1.0)) < unitTolerance; + } + + /** + \brief returns true if finite and magnitude is reasonably close to unit to allow for some accumulation of error vs + isValid + */ + PX_CUDA_CALLABLE bool isSane() const + { + const float unitTolerance = float(1e-2); + return isFinite() && PxAbs(magnitude() - float(1.0)) < unitTolerance; + } + + /** + \brief returns true if the two quaternions are exactly equal + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxQuat& q) const + { + return x == q.x && y == q.y && z == q.z && w == q.w; + } + + /** + \brief converts this quaternion to angle-axis representation + */ + PX_CUDA_CALLABLE PX_INLINE void toRadiansAndUnitAxis(float& angle, PxVec3& axis) const + { + const float quatEpsilon = float(1.0e-8); + const float s2 = x * x + y * y + z * z; + if(s2 < quatEpsilon * quatEpsilon) // can't extract a sensible axis + { + angle = float(0.0); + axis = PxVec3(float(1.0), float(0.0), float(0.0)); + } + else + { + const float s = PxRecipSqrt(s2); + axis = PxVec3(x, y, z) * s; + angle = PxAbs(w) < quatEpsilon ? float(PxPi) : PxAtan2(s2 * s, w) * float(2.0); + } + } + + /** + \brief Gets the angle between this quat and the identity quaternion. + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getAngle() const + { + return PxAcos(w) * float(2.0); + } + + /** + \brief Gets the angle between this quat and the argument + + Unit: Radians + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float getAngle(const PxQuat& q) const + { + return PxAcos(dot(q)) * float(2.0); + } + + /** + \brief This is the squared 4D vector length, should be 1 for unit quaternions. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared() const + { + return x * x + y * y + z * z + w * w; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float dot(const PxQuat& v) const + { + return x * v.x + y * v.y + z * v.z + w * v.w; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat getNormalized() const + { + const float s = float(1.0) / magnitude(); + return PxQuat(x * s, y * s, z * s, w * s); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + // modifiers: + /** + \brief maps to the closest unit quaternion. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize() // convert this PxQuat to a unit quaternion + { + const float mag = magnitude(); + if(mag != float(0.0)) + { + const float imag = float(1.0) / mag; + + x *= imag; + y *= imag; + z *= imag; + w *= imag; + } + return mag; + } + + /* + \brief returns the conjugate. + + \note for unit quaternions, this is the inverse. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat getConjugate() const + { + return PxQuat(-x, -y, -z, w); + } + + /* + \brief returns imaginary part. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getImaginaryPart() const + { + return PxVec3(x, y, z); + } + + /** brief computes rotation of x-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector0() const + { + const float x2 = x * float(2.0); + const float w2 = w * float(2.0); + return PxVec3((w * w2) - float(1.0) + x * x2, (z * w2) + y * x2, (-y * w2) + z * x2); + } + + /** brief computes rotation of y-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector1() const + { + const float y2 = y * float(2.0); + const float w2 = w * float(2.0); + return PxVec3((-z * w2) + x * y2, (w * w2) - float(1.0) + y * y2, (x * w2) + z * y2); + } + + /** brief computes rotation of z-axis */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getBasisVector2() const + { + const float z2 = z * float(2.0); + const float w2 = w * float(2.0); + return PxVec3((y * w2) + x * z2, (-x * w2) + y * z2, (w * w2) - float(1.0) + z * z2); + } + + /** + rotates passed vec by this (assumed unitary) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 rotate(const PxVec3& v) const + { + const float vx = float(2.0) * v.x; + const float vy = float(2.0) * v.y; + const float vz = float(2.0) * v.z; + const float w2 = w * w - 0.5f; + const float dot2 = (x * vx + y * vy + z * vz); + return PxVec3((vx * w2 + (y * vz - z * vy) * w + x * dot2), (vy * w2 + (z * vx - x * vz) * w + y * dot2), + (vz * w2 + (x * vy - y * vx) * w + z * dot2)); + } + + /** + inverse rotates passed vec by this (assumed unitary) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3 rotateInv(const PxVec3& v) const + { + const float vx = float(2.0) * v.x; + const float vy = float(2.0) * v.y; + const float vz = float(2.0) * v.z; + const float w2 = w * w - 0.5f; + const float dot2 = (x * vx + y * vy + z * vz); + return PxVec3((vx * w2 - (y * vz - z * vy) * w + x * dot2), (vy * w2 - (z * vx - x * vz) * w + y * dot2), + (vz * w2 - (x * vy - y * vx) * w + z * dot2)); + } + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& operator=(const PxQuat& p) + { + x = p.x; + y = p.y; + z = p.z; + w = p.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& operator*=(const PxQuat& q) + { + const float tx = w * q.x + q.w * x + y * q.z - q.y * z; + const float ty = w * q.y + q.w * y + z * q.x - q.z * x; + const float tz = w * q.z + q.w * z + x * q.y - q.x * y; + + w = w * q.w - q.x * x - y * q.y - q.z * z; + x = tx; + y = ty; + z = tz; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& operator+=(const PxQuat& q) + { + x += q.x; + y += q.y; + z += q.z; + w += q.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& operator-=(const PxQuat& q) + { + x -= q.x; + y -= q.y; + z -= q.z; + w -= q.w; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat& operator*=(const float s) + { + x *= s; + y *= s; + z *= s; + w *= s; + return *this; + } + + /** quaternion multiplication */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator*(const PxQuat& q) const + { + return PxQuat(w * q.x + q.w * x + y * q.z - q.y * z, w * q.y + q.w * y + z * q.x - q.z * x, + w * q.z + q.w * z + x * q.y - q.x * y, w * q.w - x * q.x - y * q.y - z * q.z); + } + + /** quaternion addition */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator+(const PxQuat& q) const + { + return PxQuat(x + q.x, y + q.y, z + q.z, w + q.w); + } + + /** quaternion subtraction */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator-() const + { + return PxQuat(-x, -y, -z, -w); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator-(const PxQuat& q) const + { + return PxQuat(x - q.x, y - q.y, z - q.z, w - q.w); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxQuat operator*(float r) const + { + return PxQuat(x * r, y * r, z * r, w * r); + } + + /** the quaternion elements */ + float x, y, z, w; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSIMDHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSIMDHelpers.h new file mode 100644 index 0000000..85e0656 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSIMDHelpers.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMD_HELPERS_H +#define PX_SIMD_HELPERS_H + +#include "foundation/PxMat33.h" +#include "foundation/PxVecMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + //! A padded version of PxMat33, to safely load its data using SIMD + class PxMat33Padded : public PxMat33 + { + public: + explicit PX_FORCE_INLINE PxMat33Padded(const PxQuat& q) + { + using namespace aos; + const QuatV qV = V4LoadU(&q.x); + Vec3V column0V, column1V, column2V; + QuatGetMat33V(qV, column0V, column1V, column2V); +#if defined(PX_SIMD_DISABLED) || (PX_LINUX && (PX_ARM || PX_A64)) + V3StoreU(column0V, column0); + V3StoreU(column1V, column1); + V3StoreU(column2V, column2); +#else + V4StoreU(column0V, &column0.x); + V4StoreU(column1V, &column1.x); + V4StoreU(column2V, &column2.x); +#endif + } + PX_FORCE_INLINE ~PxMat33Padded() {} + PX_FORCE_INLINE void operator=(const PxMat33& other) + { + column0 = other.column0; + column1 = other.column1; + column2 = other.column2; + } + PxU32 padding; + }; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSList.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSList.h new file mode 100644 index 0000000..e0a3361 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSList.h @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SLIST_H +#define PX_SLIST_H + +#include "foundation/Px.h" +#include "foundation/PxAssert.h" +#include "foundation/PxAlignedMalloc.h" + +#if PX_P64_FAMILY + #define PX_SLIST_ALIGNMENT 16 +#else + #define PX_SLIST_ALIGNMENT 8 +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +#if PX_VC + #pragma warning(push) + #pragma warning(disable : 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +PX_ALIGN_PREFIX(PX_SLIST_ALIGNMENT) +class PxSListEntry +{ + friend struct PxSListImpl; + + public: + PxSListEntry() : mNext(NULL) + { + PX_ASSERT((size_t(this) & (PX_SLIST_ALIGNMENT - 1)) == 0); + } + + // Only use on elements returned by SList::flush() + // because the operation is not atomic. + PxSListEntry* next() + { + return mNext; + } + + private: + PxSListEntry* mNext; +}PX_ALIGN_SUFFIX(PX_SLIST_ALIGNMENT); + +#if PX_VC + #pragma warning(pop) +#endif + +// template-less implementation +struct PX_FOUNDATION_API PxSListImpl +{ + PxSListImpl(); + ~PxSListImpl(); + void push(PxSListEntry* entry); + PxSListEntry* pop(); + PxSListEntry* flush(); + static uint32_t getSize(); +}; + +template > +class PxSListT : protected Alloc +{ + public: + PxSListT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxSListImpl::getSize(), __FILE__, __LINE__)); + PX_ASSERT((size_t(mImpl) & (PX_SLIST_ALIGNMENT - 1)) == 0); + PX_PLACEMENT_NEW(mImpl, PxSListImpl)(); + } + ~PxSListT() + { + mImpl->~PxSListImpl(); + Alloc::deallocate(mImpl); + } + + // pushes a new element to the list + void push(PxSListEntry& entry) + { + mImpl->push(&entry); + } + + // pops an element from the list + PxSListEntry* pop() + { + return mImpl->pop(); + } + + // removes all items from list, returns pointer to first element + PxSListEntry* flush() + { + return mImpl->flush(); + } + + private: + PxSListImpl* mImpl; +}; + +typedef PxSListT<> PxSList; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSimpleTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSimpleTypes.h new file mode 100644 index 0000000..49b44fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSimpleTypes.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMPLE_TYPES_H +#define PX_SIMPLE_TYPES_H + +/** \addtogroup foundation + @{ +*/ + +// Platform specific types: +// Design note: Its OK to use int for general loop variables and temps. + +#include "foundation/PxPreprocessor.h" +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4668) // suppressing warning generated by Microsoft Visual Studio when including this standard +// header +#endif + +#if PX_LINUX +#define __STDC_LIMIT_MACROS +#endif + +#include +#if PX_VC +#pragma warning(pop) +#endif + +#if PX_VC // we could use inttypes.h starting with VC12 +#define PX_PRIu64 "I64u" +#else +#if !PX_APPLE_FAMILY +#define __STDC_FORMAT_MACROS +#endif +#include +#define PX_PRIu64 PRIu64 +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +typedef int64_t PxI64; +typedef uint64_t PxU64; +typedef int32_t PxI32; +typedef uint32_t PxU32; +typedef int16_t PxI16; +typedef uint16_t PxU16; +typedef int8_t PxI8; +typedef uint8_t PxU8; +typedef float PxF32; +typedef double PxF64; +typedef float PxReal; +// Int-as-bool type - has some uses for efficiency and with SIMD +typedef PxI32 PxIntBool; +static const PxIntBool PxIntFalse = 0; +static const PxIntBool PxIntTrue = 1; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#define PX_SIGN_BITMASK 0x80000000 + +// Type ranges + +#define PX_MAX_F32 3.4028234663852885981170418348452e+38F +// maximum possible float value +#define PX_MAX_F64 DBL_MAX // maximum possible double value + +#define PX_EPS_F32 FLT_EPSILON // maximum relative error of float rounding +#define PX_EPS_F64 DBL_EPSILON // maximum relative error of double rounding + +#define PX_MAX_REAL PX_MAX_F32 +#define PX_EPS_REAL PX_EPS_F32 +#define PX_NORMALIZATION_EPSILON float(1e-20f) + +// Legacy type ranges used by PhysX +#define PX_MAX_I8 INT8_MAX +#define PX_MIN_I8 INT8_MIN +#define PX_MAX_U8 UINT8_MAX +#define PX_MIN_U8 UINT8_MIN +#define PX_MAX_I16 INT16_MAX +#define PX_MIN_I16 INT16_MIN +#define PX_MAX_U16 UINT16_MAX +#define PX_MIN_U16 UINT16_MIN +#define PX_MAX_I32 INT32_MAX +#define PX_MIN_I32 INT32_MIN +#define PX_MAX_U32 UINT32_MAX +#define PX_MIN_U32 UINT32_MIN + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSocket.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSocket.h new file mode 100644 index 0000000..8819665 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSocket.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SOCKET_H +#define PX_SOCKET_H + +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/** +Socket abstraction API +*/ + +class PX_DEPRECATED PX_FOUNDATION_API PxSocket : public PxUserAllocated +{ + public: + static const uint32_t DEFAULT_BUFFER_SIZE; + + PxSocket(bool inEnableBuffering = true, bool blocking = true); + + virtual ~PxSocket(); + + /*! + Opens a network socket for input and/or output + + \param host + Name of the host to connect to. This can be an IP, URL, etc + + \param port + The port to connect to on the remote host + + \param timeout + Timeout in ms until the connection must be established. + + \return + True if the connection was successful, false otherwise + */ + bool connect(const char* host, uint16_t port, uint32_t timeout = 1000); + + /*! + Opens a network socket for input and/or output as a server. Put the connection in listening mode + + \param port + The port on which the socket listens + */ + bool listen(uint16_t port); + + /*! + Accept a connection on a socket that is in listening mode + + \note + This method only supports a single connection client. Additional clients + that connect to the listening port will overwrite the existing socket handle. + + \param block + whether or not the call should block + + \return whether a connection was established + */ + bool accept(bool block); + + /*! + Disconnects an open socket + */ + void disconnect(); + + /*! + Returns whether the socket is currently open (connected) or not. + + \return + True if the socket is connected, false otherwise + */ + bool isConnected() const; + + /*! + Returns the name of the connected host. This is the same as the string + that was supplied to the connect call. + + \return + The name of the connected host + */ + const char* getHost() const; + + /*! + Returns the port of the connected host. This is the same as the port + that was supplied to the connect call. + + \return + The port of the connected host + */ + uint16_t getPort() const; + + /*! + Flushes the output stream. Until the stream is flushed, there is no + guarantee that the written data has actually reached the destination + storage. Flush forces all buffered data to be sent to the output. + + \note flush always blocks. If the socket is in non-blocking mode, this will result + the thread spinning. + + \return + True if the flush was successful, false otherwise + */ + bool flush(); + + /*! + Writes data to the output stream. + + \param data + Pointer to a block of data to write to the stream + + \param length + Amount of data to write, in bytes + + \return + Number of bytes actually written. This could be lower than length if the socket is non-blocking. + */ + + uint32_t write(const uint8_t* data, uint32_t length); + + /*! + Reads data from the output stream. + + \param data + Pointer to a buffer where the read data will be stored. + + \param length + Amount of data to read, in bytes. + + \return + Number of bytes actually read. This could be lower than length if the stream end is + encountered or the socket is non-blocking. + */ + uint32_t read(uint8_t* data, uint32_t length); + + /*! + Sets blocking mode of the socket. + Socket must be connected, otherwise calling this method won't take any effect. + */ + void setBlocking(bool blocking); + + /*! + Returns whether read/write/flush calls to the socket are blocking. + + \return + True if the socket is blocking. + */ + bool isBlocking() const; + + private: + class SocketImpl* mImpl; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSort.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSort.h new file mode 100644 index 0000000..24ad1bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSort.h @@ -0,0 +1,131 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SORT_H +#define PX_SORT_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxSortInternals.h" +#include "foundation/PxAlloca.h" + +#define PX_SORT_PARANOIA PX_DEBUG + +/** +\brief Sorts an array of objects in ascending order, assuming +that the predicate implements the < operator: + +@see PxLess, PxGreater +*/ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4706) // disable the warning that we did an assignment within a conditional expression, as +// this was intentional. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +void PxSort(T* elements, uint32_t count, const Predicate& compare, const PxAllocator& inAllocator, + const uint32_t initialStackSize = 32) +{ + static const uint32_t SMALL_SORT_CUTOFF = 5; // must be >= 3 since we need 3 for median + + PX_ALLOCA(stackMem, int32_t, initialStackSize); + PxStack stack(stackMem, initialStackSize, inAllocator); + + int32_t first = 0, last = int32_t(count - 1); + if(last > first) + { + for(;;) + { + while(last > first) + { + PX_ASSERT(first >= 0 && last < int32_t(count)); + if(uint32_t(last - first) < SMALL_SORT_CUTOFF) + { + PxSmallSort(elements, first, last, compare); + break; + } + else + { + const int32_t partIndex = PxPartition(elements, first, last, compare); + + // push smaller sublist to minimize stack usage + if((partIndex - first) < (last - partIndex)) + { + stack.push(first, partIndex - 1); + first = partIndex + 1; + } + else + { + stack.push(partIndex + 1, last); + last = partIndex - 1; + } + } + } + + if(stack.empty()) + break; + + stack.pop(first, last); + } + } +#if PX_SORT_PARANOIA + for(uint32_t i = 1; i < count; i++) + PX_ASSERT(!compare(elements[i], elements[i - 1])); +#endif +} + +template +void PxSort(T* elements, uint32_t count, const Predicate& compare) +{ + PxSort(elements, count, compare, typename PxAllocatorTraits::Type()); +} + +template +void PxSort(T* elements, uint32_t count) +{ + PxSort(elements, count, PxLess(), typename PxAllocatorTraits::Type()); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if PX_VC +#pragma warning(pop) +#endif +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSortInternals.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSortInternals.h new file mode 100644 index 0000000..b6702d1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSortInternals.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SORT_INTERNALS_H +#define PX_SORT_INTERNALS_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxAssert.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +template +PX_INLINE void PxMedian3(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + /* + This creates sentinels because we know there is an element at the start minimum(or equal) + than the pivot and an element at the end greater(or equal) than the pivot. Plus the + median of 3 reduces the chance of degenerate behavour. + */ + + int32_t mid = (first + last) / 2; + + if(compare(elements[mid], elements[first])) + PxSwap(elements[first], elements[mid]); + + if(compare(elements[last], elements[first])) + PxSwap(elements[first], elements[last]); + + if(compare(elements[last], elements[mid])) + PxSwap(elements[mid], elements[last]); + + // keep the pivot at last-1 + PxSwap(elements[mid], elements[last - 1]); +} + +template +PX_INLINE int32_t PxPartition(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + PxMedian3(elements, first, last, compare); + + /* + WARNING: using the line: + + T partValue = elements[last-1]; + + and changing the scan loops to: + + while(comparator.greater(partValue, elements[++i])); + while(comparator.greater(elements[--j], partValue); + + triggers a compiler optimizer bug on xenon where it stores a double to the stack for partValue + then loads it as a single...:-( + */ + + int32_t i = first; // we know first is less than pivot(but i gets pre incremented) + int32_t j = last - 1; // pivot is in last-1 (but j gets pre decremented) + + for(;;) + { + while(compare(elements[++i], elements[last - 1])) + ; + while(compare(elements[last - 1], elements[--j])) + ; + + if(i >= j) + break; + + PX_ASSERT(i <= last && j >= first); + PxSwap(elements[i], elements[j]); + } + // put the pivot in place + + PX_ASSERT(i <= last && first <= (last - 1)); + PxSwap(elements[i], elements[last - 1]); + + return i; +} + +template +PX_INLINE void PxSmallSort(T* elements, int32_t first, int32_t last, Predicate& compare) +{ + // selection sort - could reduce to fsel on 360 with floats. + + for(int32_t i = first; i < last; i++) + { + int32_t m = i; + for(int32_t j = i + 1; j <= last; j++) + if(compare(elements[j], elements[m])) + m = j; + + if(m != i) + PxSwap(elements[m], elements[i]); + } +} + +template +class PxStack +{ + PxAllocator mAllocator; + uint32_t mSize, mCapacity; + int32_t* mMemory; + bool mRealloc; + + public: + PxStack(int32_t* memory, uint32_t capacity, const PxAllocator& inAllocator) + : mAllocator(inAllocator), mSize(0), mCapacity(capacity), mMemory(memory), mRealloc(false) + { + } + ~PxStack() + { + if(mRealloc) + mAllocator.deallocate(mMemory); + } + + void grow() + { + mCapacity *= 2; + int32_t* newMem = + reinterpret_cast(mAllocator.allocate(sizeof(int32_t) * mCapacity, __FILE__, __LINE__)); + intrinsics::memCopy(newMem, mMemory, mSize * sizeof(int32_t)); + if(mRealloc) + mAllocator.deallocate(mMemory); + mRealloc = true; + mMemory = newMem; + } + + PX_INLINE void push(int32_t start, int32_t end) + { + if(mSize >= mCapacity - 1) + grow(); + mMemory[mSize++] = start; + mMemory[mSize++] = end; + } + + PX_INLINE void pop(int32_t& start, int32_t& end) + { + PX_ASSERT(!empty()); + end = mMemory[--mSize]; + start = mMemory[--mSize]; + } + + PX_INLINE bool empty() + { + return mSize == 0; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + /** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxStrideIterator.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxStrideIterator.h new file mode 100644 index 0000000..c1326fa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxStrideIterator.h @@ -0,0 +1,353 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_STRIDE_ITERATOR_H +#define PX_STRIDE_ITERATOR_H + +#include "foundation/Px.h" +#include "foundation/PxAssert.h" + +/** \addtogroup foundation + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Iterator class for iterating over arrays of data that may be interleaved with other data. + +This class is used for iterating over arrays of elements that may have a larger element to element +offset, called the stride, than the size of the element itself (non-contiguous). + +The template parameter T denotes the type of the element accessed. The stride itself +is stored as a member field so multiple instances of a PxStrideIterator class can have +different strides. This is useful for cases were the stride depends on runtime configuration. + +The stride iterator can be used for index based access, e.g.: +\code + PxStrideIterator strideArray(...); + for (unsigned i = 0; i < 10; ++i) + { + PxVec3& vec = strideArray[i]; + ... + } +\endcode +or iteration by increment, e.g.: +\code + PxStrideIterator strideBegin(...); + PxStrideIterator strideEnd(strideBegin + 10); + for (PxStrideIterator it = strideBegin; it < strideEnd; ++it) + { + PxVec3& vec = *it; + ... + } +\endcode + +Two special cases: +- A stride of sizeof(T) represents a regular c array of type T. +- A stride of 0 can be used to describe re-occurrence of the same element multiple times. + +*/ +template +class PxStrideIterator +{ + +#if !PX_DOXYGEN + template + struct StripConst + { + typedef X Type; + }; + + template + struct StripConst + { + typedef X Type; + }; +#endif + + public: + /** + \brief Constructor. + + Optionally takes a pointer to an element and a stride. + + \param[in] ptr pointer to element, defaults to NULL. + \param[in] stride stride for accessing consecutive elements, defaults to the size of one element. + */ + explicit PX_INLINE PxStrideIterator(T* ptr = NULL, PxU32 stride = sizeof(T)) : mPtr(ptr), mStride(stride) + { + PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + } + + /** + \brief Copy constructor. + + \param[in] strideIterator PxStrideIterator to be copied. + */ + PX_INLINE PxStrideIterator(const PxStrideIterator::Type>& strideIterator) + : mPtr(strideIterator.ptr()), mStride(strideIterator.stride()) + { + PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + } + + /** + \brief Get pointer to element. + */ + PX_INLINE T* ptr() const + { + return mPtr; + } + + /** + \brief Get stride. + */ + PX_INLINE PxU32 stride() const + { + return mStride; + } + + /** + \brief Indirection operator. + */ + PX_INLINE T& operator*() const + { + return *mPtr; + } + + /** + \brief Dereferencing operator. + */ + PX_INLINE T* operator->() const + { + return mPtr; + } + + /** + \brief Indexing operator. + */ + PX_INLINE T& operator[](unsigned int i) const + { + return *byteAdd(mPtr, i * stride()); + } + + /** + \brief Pre-increment operator. + */ + PX_INLINE PxStrideIterator& operator++() + { + mPtr = byteAdd(mPtr, stride()); + return *this; + } + + /** + \brief Post-increment operator. + */ + PX_INLINE PxStrideIterator operator++(int) + { + PxStrideIterator tmp = *this; + mPtr = byteAdd(mPtr, stride()); + return tmp; + } + + /** + \brief Pre-decrement operator. + */ + PX_INLINE PxStrideIterator& operator--() + { + mPtr = byteSub(mPtr, stride()); + return *this; + } + + /** + \brief Post-decrement operator. + */ + PX_INLINE PxStrideIterator operator--(int) + { + PxStrideIterator tmp = *this; + mPtr = byteSub(mPtr, stride()); + return tmp; + } + + /** + \brief Addition operator. + */ + PX_INLINE PxStrideIterator operator+(unsigned int i) const + { + return PxStrideIterator(byteAdd(mPtr, i * stride()), stride()); + } + + /** + \brief Subtraction operator. + */ + PX_INLINE PxStrideIterator operator-(unsigned int i) const + { + return PxStrideIterator(byteSub(mPtr, i * stride()), stride()); + } + + /** + \brief Addition compound assignment operator. + */ + PX_INLINE PxStrideIterator& operator+=(unsigned int i) + { + mPtr = byteAdd(mPtr, i * stride()); + return *this; + } + + /** + \brief Subtraction compound assignment operator. + */ + PX_INLINE PxStrideIterator& operator-=(unsigned int i) + { + mPtr = byteSub(mPtr, i * stride()); + return *this; + } + + /** + \brief Iterator difference. + */ + PX_INLINE int operator-(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + int byteDiff = static_cast(reinterpret_cast(mPtr) - reinterpret_cast(other.mPtr)); + return byteDiff / static_cast(stride()); + } + + /** + \brief Equality operator. + */ + PX_INLINE bool operator==(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr == other.mPtr; + } + + /** + \brief Inequality operator. + */ + PX_INLINE bool operator!=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr != other.mPtr; + } + + /** + \brief Less than operator. + */ + PX_INLINE bool operator<(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr < other.mPtr; + } + + /** + \brief Greater than operator. + */ + PX_INLINE bool operator>(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr > other.mPtr; + } + + /** + \brief Less or equal than operator. + */ + PX_INLINE bool operator<=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr <= other.mPtr; + } + + /** + \brief Greater or equal than operator. + */ + PX_INLINE bool operator>=(const PxStrideIterator& other) const + { + PX_ASSERT(isCompatible(other)); + return mPtr >= other.mPtr; + } + + private: + PX_INLINE static T* byteAdd(T* ptr, PxU32 bytes) + { + return const_cast(reinterpret_cast(reinterpret_cast(ptr) + bytes)); + } + + PX_INLINE static T* byteSub(T* ptr, PxU32 bytes) + { + return const_cast(reinterpret_cast(reinterpret_cast(ptr) - bytes)); + } + + PX_INLINE bool isCompatible(const PxStrideIterator& other) const + { + int byteDiff = static_cast(reinterpret_cast(mPtr) - reinterpret_cast(other.mPtr)); + return (stride() == other.stride()) && (abs(byteDiff) % stride() == 0); + } + + T* mPtr; + PxU32 mStride; +}; + +/** +\brief Addition operator. +*/ +template +PX_INLINE PxStrideIterator operator+(int i, PxStrideIterator it) +{ + it += i; + return it; +} + +/** +\brief Stride iterator factory function which infers the iterator type. +*/ +template +PX_INLINE PxStrideIterator PxMakeIterator(T* ptr, PxU32 stride = sizeof(T)) +{ + return PxStrideIterator(ptr, stride); +} + +/** +\brief Stride iterator factory function which infers the iterator type. +*/ +template +PX_INLINE PxStrideIterator PxMakeIterator(const T* ptr, PxU32 stride = sizeof(T)) +{ + return PxStrideIterator(ptr, stride); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxString.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxString.h new file mode 100644 index 0000000..eb744bb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxString.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_STRING_H +#define PX_STRING_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxFoundationConfig.h" +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// the following functions have C99 semantics. Note that C99 requires for snprintf and vsnprintf: +// * the resulting string is always NULL-terminated regardless of truncation. +// * in the case of truncation the return value is the number of characters that would have been created. + +PX_FOUNDATION_API int32_t Pxsscanf(const char* buffer, const char* format, ...); +PX_FOUNDATION_API int32_t Pxstrcmp(const char* str1, const char* str2); +PX_FOUNDATION_API int32_t Pxstrncmp(const char* str1, const char* str2, size_t count); +PX_FOUNDATION_API int32_t Pxsnprintf(char* dst, size_t dstSize, const char* format, ...); +PX_FOUNDATION_API int32_t Pxvsnprintf(char* dst, size_t dstSize, const char* src, va_list arg); + +// strlcat and strlcpy have BSD semantics: +// * dstSize is always the size of the destination buffer +// * the resulting string is always NULL-terminated regardless of truncation +// * in the case of truncation the return value is the length of the string that would have been created + +PX_FOUNDATION_API size_t Pxstrlcat(char* dst, size_t dstSize, const char* src); +PX_FOUNDATION_API size_t Pxstrlcpy(char* dst, size_t dstSize, const char* src); + +// case-insensitive string comparison +PX_FOUNDATION_API int32_t Pxstricmp(const char* str1, const char* str2); +PX_FOUNDATION_API int32_t Pxstrnicmp(const char* str1, const char* str2, size_t count); + +// in-place string case conversion +PX_FOUNDATION_API void Pxstrlwr(char* str); +PX_FOUNDATION_API void Pxstrupr(char* str); + + +/** +\brief Prints the string literally (does not consume % specifier), trying to make sure it's visible to the app +programmer +*/ +PX_FOUNDATION_API void PxPrintString(const char*); + +#if !PX_DOXYGEN +} // namespace physx +#endif +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSync.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSync.h new file mode 100644 index 0000000..46865d7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxSync.h @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SYNC_H +#define PX_SYNC_H + +#include "foundation/PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +/*! +Implementation notes: +* - Calling set() on an already signaled Sync does not change its state. +* - Calling reset() on an already reset Sync does not change its state. +* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). +* - Calling wait() on an already signaled Sync will return true immediately. +* - NOTE: be careful when pulsing an event with set() followed by reset(), because a +* thread that is not waiting on the event will miss the signal. +*/ +class PX_FOUNDATION_API PxSyncImpl +{ + public: + static const uint32_t waitForever = 0xffffffff; + + PxSyncImpl(); + + ~PxSyncImpl(); + + /** Wait on the object for at most the given number of ms. Returns + * true if the object is signaled. Sync::waitForever will block forever + * or until the object is signaled. + */ + + bool wait(uint32_t milliseconds = waitForever); + + /** Signal the synchronization object, waking all threads waiting on it */ + + void set(); + + /** Reset the synchronization object */ + + void reset(); + + /** + Size of this class. + */ + static uint32_t getSize(); +}; + +/*! +Implementation notes: +* - Calling set() on an already signaled Sync does not change its state. +* - Calling reset() on an already reset Sync does not change its state. +* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). +* - Calling wait() on an already signaled Sync will return true immediately. +* - NOTE: be careful when pulsing an event with set() followed by reset(), because a +* thread that is not waiting on the event will miss the signal. +*/ +template > +class PxSyncT : protected Alloc +{ + public: + static const uint32_t waitForever = PxSyncImpl::waitForever; + + PxSyncT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxSyncImpl::getSize(), __FILE__, __LINE__)); + PX_PLACEMENT_NEW(mImpl, PxSyncImpl)(); + } + + ~PxSyncT() + { + mImpl->~PxSyncImpl(); + Alloc::deallocate(mImpl); + } + + /** Wait on the object for at most the given number of ms. Returns + * true if the object is signaled. Sync::waitForever will block forever + * or until the object is signaled. + */ + + bool wait(uint32_t milliseconds = PxSyncImpl::waitForever) + { + return mImpl->wait(milliseconds); + } + + /** Signal the synchronization object, waking all threads waiting on it */ + + void set() + { + mImpl->set(); + } + + /** Reset the synchronization object */ + + void reset() + { + mImpl->reset(); + } + + private: + class PxSyncImpl* mImpl; +}; + +typedef PxSyncT<> PxSync; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTempAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTempAllocator.h new file mode 100644 index 0000000..395bce9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTempAllocator.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TEMP_ALLOCATOR_H +#define PX_TEMP_ALLOCATOR_H + +#include "foundation/PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +union PxTempAllocatorChunk +{ + PxTempAllocatorChunk() : mNext(0) + { + } + PxTempAllocatorChunk* mNext; // while chunk is free + PxU32 mIndex; // while chunk is allocated + PxU8 mPad[16]; // 16 byte aligned allocations +}; + +class PxTempAllocator +{ + public: + PX_FORCE_INLINE PxTempAllocator(const char* = 0) + { + } + PX_FOUNDATION_API void* allocate(size_t size, const char* file, PxI32 line); + PX_FOUNDATION_API void deallocate(void* ptr); +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxThread.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxThread.h new file mode 100644 index 0000000..5a52f0e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxThread.h @@ -0,0 +1,369 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_THREAD_H +#define PX_THREAD_H + +#include "foundation/PxUserAllocated.h" + +// todo: these need to go somewhere else +// PT: looks like this is still used on some platforms + +#if PX_WINDOWS_FAMILY +#define PxSpinLockPause() __asm pause +#elif PX_LINUX || PX_APPLE_FAMILY || PX_SWITCH +#define PxSpinLockPause() asm("nop") +#else +#error "Platform not supported!" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +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 + }; +}; + +class PxRunnable +{ + public: + PxRunnable() {} + virtual ~PxRunnable() {} + virtual void execute() {} +}; + +class PX_FOUNDATION_API PX_DEPRECATED PxThreadImpl +{ + public: + typedef size_t Id; // space for a pointer or an integer + typedef void* (*ExecuteFn)(void*); + + static PxU32 getDefaultStackSize(); + static Id getId(); + + /** + Construct (but do not start) the thread object. The OS thread object will not be created + until start() is called. Executes in the context + of the spawning thread. + */ + + PxThreadImpl(); + + /** + Construct and start the the thread, passing the given arg to the given fn. (pthread style) + */ + + PxThreadImpl(ExecuteFn fn, void* arg, const char* name); + + /** + Deallocate all resources associated with the thread. Should be called in the + context of the spawning thread. + */ + + ~PxThreadImpl(); + + /** + Create the OS thread and start it running. Called in the context of the spawning thread. + If an affinity mask has previously been set then it will be applied after the + thread has been created. + */ + + void start(PxU32 stackSize, PxRunnable* r); + + /** + Violently kill the current thread. Blunt instrument, not recommended since + it can leave all kinds of things unreleased (stack, memory, mutexes...) Should + be called in the context of the spawning thread. + */ + + void kill(); + + /** + Stop the thread. Signals the spawned thread that it should stop, so the + thread should check regularly + */ + + void signalQuit(); + + /** + Wait for a thread to stop. Should be called in the context of the spawning + thread. Returns false if the thread has not been started. + */ + + bool waitForQuit(); + + /** + check whether the thread is signalled to quit. Called in the context of the + spawned thread. + */ + + bool quitIsSignalled(); + + /** + Cleanly shut down this thread. Called in the context of the spawned thread. + */ + void quit(); + + /** + Change the affinity mask for this thread. The mask is a platform + specific value. + + On Windows, Linux, and Switch platforms, each set mask bit represents + the index of a logical processor that the OS may schedule thread execution on. + Bits outside the range of valid logical processors may be ignored or cause + the function to return an error. + + On Apple platforms, this function has no effect. + + If the thread has not yet been started then the mask is stored + and applied when the thread is started. + + If the thread has already been started then this method returns the + previous affinity mask on success, otherwise it returns zero. + */ + PxU32 setAffinityMask(PxU32 mask); + + static PxThreadPriority::Enum getPriority(Id threadId); + + /** Set thread priority. */ + void setPriority(PxThreadPriority::Enum prio); + + /** set the thread's name */ + void setName(const char* name); + + /** Put the current thread to sleep for the given number of milliseconds */ + static void sleep(PxU32 ms); + + /** Yield the current thread's slot on the CPU */ + static void yield(); + + /** Inform the processor that we're in a busy wait to give it a chance to do something clever. + yield() yields the thread, while yieldProcessor() aims to yield the processor */ + static void yieldProcessor(); + + /** Return the number of physical cores (does not include hyper-threaded cores), returns 0 on failure */ + static PxU32 getNbPhysicalCores(); + + /** + Size of this class. + */ + static PxU32 getSize(); +}; + +/** +Thread abstraction API +*/ +template > +class PxThreadT : protected Alloc, public PxUserAllocated, public PxRunnable +{ + public: + typedef PxThreadImpl::Id Id; // space for a pointer or an integer + + /** + Construct (but do not start) the thread object. Executes in the context + of the spawning thread + */ + PxThreadT(const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxThreadImpl::getSize(), __FILE__, __LINE__)); + PX_PLACEMENT_NEW(mImpl, PxThreadImpl)(); + } + + /** + Construct and start the the thread, passing the given arg to the given fn. (pthread style) + */ + PxThreadT(PxThreadImpl::ExecuteFn fn, void* arg, const char* name, const Alloc& alloc = Alloc()) : Alloc(alloc) + { + mImpl = reinterpret_cast(Alloc::allocate(PxThreadImpl::getSize(), __FILE__, __LINE__)); + PX_PLACEMENT_NEW(mImpl, PxThreadImpl)(fn, arg, name); + } + + /** + Deallocate all resources associated with the thread. Should be called in the + context of the spawning thread. + */ + virtual ~PxThreadT() + { + mImpl->~PxThreadImpl(); + Alloc::deallocate(mImpl); + } + + /** + start the thread running. Called in the context of the spawning thread. + */ + + void start(PxU32 stackSize = PxThreadImpl::getDefaultStackSize()) + { + mImpl->start(stackSize, this); + } + + /** + Violently kill the current thread. Blunt instrument, not recommended since + it can leave all kinds of things unreleased (stack, memory, mutexes...) Should + be called in the context of the spawning thread. + */ + + void kill() + { + mImpl->kill(); + } + + /** + The virtual execute() method is the user defined function that will + run in the new thread. Called in the context of the spawned thread. + */ + + virtual void execute(void) + { + } + + /** + stop the thread. Signals the spawned thread that it should stop, so the + thread should check regularly + */ + + void signalQuit() + { + mImpl->signalQuit(); + } + + /** + Wait for a thread to stop. Should be called in the context of the spawning + thread. Returns false if the thread has not been started. + */ + + bool waitForQuit() + { + return mImpl->waitForQuit(); + } + + /** + check whether the thread is signalled to quit. Called in the context of the + spawned thread. + */ + + bool quitIsSignalled() + { + return mImpl->quitIsSignalled(); + } + + /** + Cleanly shut down this thread. Called in the context of the spawned thread. + */ + void quit() + { + mImpl->quit(); + } + + PxU32 setAffinityMask(PxU32 mask) + { + return mImpl->setAffinityMask(mask); + } + + static PxThreadPriority::Enum getPriority(PxThreadImpl::Id threadId) + { + return PxThreadImpl::getPriority(threadId); + } + + /** Set thread priority. */ + void setPriority(PxThreadPriority::Enum prio) + { + mImpl->setPriority(prio); + } + + /** set the thread's name */ + void setName(const char* name) + { + mImpl->setName(name); + } + + /** Put the current thread to sleep for the given number of milliseconds */ + static void sleep(PxU32 ms) + { + PxThreadImpl::sleep(ms); + } + + /** Yield the current thread's slot on the CPU */ + static void yield() + { + PxThreadImpl::yield(); + } + + /** Inform the processor that we're in a busy wait to give it a chance to do something clever + yield() yields the thread, while yieldProcessor() aims to yield the processor */ + static void yieldProcesor() + { + PxThreadImpl::yieldProcessor(); + } + + static PxU32 getDefaultStackSize() + { + return PxThreadImpl::getDefaultStackSize(); + } + + static PxThreadImpl::Id getId() + { + return PxThreadImpl::getId(); + } + + static PxU32 getNbPhysicalCores() + { + return PxThreadImpl::getNbPhysicalCores(); + } + + private: + class PxThreadImpl* mImpl; +}; + +typedef PxThreadT<> PxThread; + +PX_FOUNDATION_API PxU32 PxTlsAlloc(); +PX_FOUNDATION_API void PxTlsFree(PxU32 index); +PX_FOUNDATION_API void* PxTlsGet(PxU32 index); +PX_FOUNDATION_API size_t PxTlsGetValue(PxU32 index); +PX_FOUNDATION_API PxU32 PxTlsSet(PxU32 index, void* value); +PX_FOUNDATION_API PxU32 PxTlsSetValue(PxU32 index, size_t value); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTime.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTime.h new file mode 100644 index 0000000..c94baf7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTime.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TIME_H +#define PX_TIME_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxFoundationConfig.h" + +#if PX_LINUX +#include +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxCounterFrequencyToTensOfNanos +{ + PxU64 mNumerator; + PxU64 mDenominator; + PxCounterFrequencyToTensOfNanos(PxU64 inNum, PxU64 inDenom) : mNumerator(inNum), mDenominator(inDenom) + { + } + + // quite slow. + PxU64 toTensOfNanos(PxU64 inCounter) const + { + return (inCounter * mNumerator) / mDenominator; + } +}; + +class PX_FOUNDATION_API PxTime +{ + public: + static const PxU64 sNumTensOfNanoSecondsInASecond = 100000000; + // This is supposedly guaranteed to not change after system boot + // regardless of processors, speedstep, etc. + static const PxCounterFrequencyToTensOfNanos& getBootCounterFrequency(); + + static PxCounterFrequencyToTensOfNanos getCounterFrequency(); + + static PxU64 getCurrentCounterValue(); + + // SLOW!! + // Thar be a 64 bit divide in thar! + static PxU64 getCurrentTimeInTensOfNanoSeconds() + { + PxU64 ticks = getCurrentCounterValue(); + return getBootCounterFrequency().toTensOfNanos(ticks); + } + + PxTime(); + PxF64 getElapsedSeconds(); + PxF64 peekElapsedSeconds(); + PxF64 getLastTime() const; + + private: +#if PX_LINUX || PX_APPLE_FAMILY + PxF64 mLastTime; +#else + PxI64 mTickCount; +#endif +}; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTransform.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTransform.h new file mode 100644 index 0000000..94fb5a3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxTransform.h @@ -0,0 +1,220 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRANSFORM_H +#define PX_TRANSFORM_H +/** \addtogroup foundation + @{ +*/ + +#include "foundation/PxQuat.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/*! +\brief class representing a rigid euclidean transform as a quaternion and a vector +*/ + +class PxTransform +{ + public: + PxQuat q; + PxVec3 p; + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform() + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxVec3& position) : q(PxIdentity), p(position) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(PxIDENTITY) : q(PxIdentity), p(PxZero) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxQuat& orientation) : q(orientation), p(float(0)) + { + PX_ASSERT(orientation.isSane()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(float x, float y, float z, PxQuat aQ = PxQuat(PxIdentity)) : + q(aQ), p(x, y, z) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(const PxVec3& p0, const PxQuat& q0) : q(q0), p(p0) + { + PX_ASSERT(q0.isSane()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxMat44& m); // defined in PxMat44.h + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator=(const PxTransform& other) + { + p = other.p; + q = other.q; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(const PxTransform& other) + { + p = other.p; + q = other.q; + } + + /** + \brief returns true if the two transforms are exactly equal + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxTransform& t) const + { + return p == t.p && q == t.q; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform operator*(const PxTransform& x) const + { + PX_ASSERT(x.isSane()); + return transform(x); + } + + //! Equals matrix multiplication + PX_CUDA_CALLABLE PX_INLINE PxTransform& operator*=(const PxTransform& other) + { + *this = *this * other; + return *this; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform getInverse() const + { + PX_ASSERT(isFinite()); + return PxTransform(q.rotateInv(-p), q.getConjugate()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transform(const PxVec3& input) const + { + PX_ASSERT(isFinite()); + return q.rotate(input) + p; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transformInv(const PxVec3& input) const + { + PX_ASSERT(isFinite()); + return q.rotateInv(input - p); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotate(const PxVec3& input) const + { + PX_ASSERT(isFinite()); + return q.rotate(input); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotateInv(const PxVec3& input) const + { + PX_ASSERT(isFinite()); + return q.rotateInv(input); + } + + //! Transform transform to parent (returns compound transform: first src, then *this) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transform(const PxTransform& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isSane()); + // src = [srct, srcr] -> [r*srct + t, r*srcr] + return PxTransform(q.rotate(src.p) + p, q * src.q); + } + + /** + \brief returns true if finite and q is a unit quaternion + */ + PX_CUDA_CALLABLE bool isValid() const + { + return p.isFinite() && q.isFinite() && q.isUnit(); + } + + /** + \brief returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error + vs isValid + */ + PX_CUDA_CALLABLE bool isSane() const + { + return isFinite() && q.isSane(); + } + + /** + \brief returns true if all elems are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const + { + return p.isFinite() && q.isFinite(); + } + + //! Transform transform from parent (returns compound transform: first src, then this->inverse) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transformInv(const PxTransform& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isFinite()); + // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] + const PxQuat qinv = q.getConjugate(); + return PxTransform(qinv.rotate(src.p - p), qinv * src.q); + } + + /** + \brief return a normalized transform (i.e. one in which the quaternion has unit magnitude) + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform getNormalized() const + { + return PxTransform(p, q.getNormalized()); + } +}; + +/*! +\brief A generic padded & aligned transform class. + +This can be used for safe faster loads & stores, and faster address computations +(the default PxTransform often generating imuls for this otherwise). Padding bytes +can be reused to store useful data if needed. +*/ +struct PX_ALIGN_PREFIX(16) PxTransformPadded +{ + PxTransform transform; + PxU32 padding; +} +PX_ALIGN_SUFFIX(16); +PX_COMPILE_TIME_ASSERT(sizeof(PxTransformPadded)==32); + +typedef PxTransformPadded PxTransform32; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUnionCast.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUnionCast.h new file mode 100644 index 0000000..95d7d1d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUnionCast.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_UNION_CAST_H +#define PX_UNION_CAST_H + +#include "foundation/Px.h" + +/** \addtogroup foundation +@{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +// Needed for clang 7 +#if PX_CLANG && PX_CLANG_MAJOR >= 7 + #define USE_VOLATILE_UNION volatile +#else + #define USE_VOLATILE_UNION +#endif + +template +PX_FORCE_INLINE A PxUnionCast(B b) +{ + union AB + { + AB(B bb) : _b(bb) + { + } + B _b; + A _a; + } USE_VOLATILE_UNION u(b); + return u._a; +} + +#undef USE_VOLATILE_UNION + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUserAllocated.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUserAllocated.h new file mode 100644 index 0000000..d5be172 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUserAllocated.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_USER_ALLOCATED_H +#define PX_USER_ALLOCATED_H + +#include "PxAllocator.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + /** + Provides new and delete using a UserAllocator. + Guarantees that 'delete x;' uses the UserAllocator too. + */ + class PxUserAllocated + { + public: + // PX_SERIALIZATION + PX_INLINE void* operator new(size_t, void* address) + { + return address; + } + + //~PX_SERIALIZATION + // Matching operator delete to the above operator new. Don't ask me + // how this makes any sense - Nuernberger. + PX_INLINE void operator delete(void*, void*) + { + } + + template + PX_INLINE void* operator new(size_t size, Alloc alloc, const char* fileName, int line) + { + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new(size_t size, size_t /*align*/, Alloc alloc, const char* fileName, int line) + { + // align is not respected, we have 16bit aligned allocator + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new [](size_t size, Alloc alloc, const char* fileName, int line) + { + return alloc.allocate(size, fileName, line); + } + + template + PX_INLINE void* operator new [](size_t size, size_t /*align*/, Alloc alloc, const char* fileName, int line) + { + // align is not respected, we have 16bit aligned allocator + return alloc.allocate(size, fileName, line); + } + + // placement delete + template + PX_INLINE void operator delete(void* ptr, Alloc alloc, const char* fileName, int line) + { + PX_UNUSED(fileName); + PX_UNUSED(line); + alloc.deallocate(ptr); + } + + template + PX_INLINE void operator delete [](void* ptr, Alloc alloc, const char* fileName, int line) + { + PX_UNUSED(fileName); + PX_UNUSED(line); + alloc.deallocate(ptr); + } + + PX_INLINE void operator delete(void* ptr) + { + PxAllocator().deallocate(ptr); + } + + PX_INLINE void operator delete [](void* ptr) + { + PxAllocator().deallocate(ptr); + } + }; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUtilities.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUtilities.h new file mode 100644 index 0000000..7f35398 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxUtilities.h @@ -0,0 +1,146 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_UTILITIES_H +#define PX_UTILITIES_H + +#include "foundation/PxVec3.h" +#include "foundation/PxAssert.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBasicTemplates.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +PX_INLINE char PxLittleEndian() +{ + int i = 1; + return *(reinterpret_cast(&i)); +} + +// PT: checked casts +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 PxTo32(PxU64 value) +{ + PX_ASSERT(value <= 0xffffffff); + return PxU32(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 PxTo16(PxU32 value) +{ + PX_ASSERT(value <= 0xffff); + return PxU16(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxU16 value) +{ + PX_ASSERT(value <= 0xff); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxU32 value) +{ + PX_ASSERT(value <= 0xff); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 PxTo8(PxI32 value) +{ + PX_ASSERT(value <= 0xff); + PX_ASSERT(value >= 0); + return PxU8(value); +} +PX_CUDA_CALLABLE PX_FORCE_INLINE PxI8 PxToI8(PxU32 value) +{ + PX_ASSERT(value <= 0x7f); + return PxI8(value); +} + +//! @cond +/*! +Get number of elements in array +*/ +template +char (&PxArraySizeHelper(T (&array)[N]))[N]; +#define PX_ARRAY_SIZE(_array) (sizeof(physx::PxArraySizeHelper(_array))) +//! @endcond + +/*! +Sort two elements using operator< + +On return x will be the smaller of the two +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(T& x, T& y) +{ + if(y < x) + PxSwap(x, y); +} + +// most architectures can do predication on real comparisons, and on VMX, it matters + +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(PxReal& x, PxReal& y) +{ + PxReal newX = PxMin(x, y); + PxReal newY = PxMax(x, y); + x = newX; + y = newY; +} + +/*! +Sort two elements using operator< and also keep order +of any extra data +*/ +template +PX_CUDA_CALLABLE PX_FORCE_INLINE void PxOrder(T& x, T& y, E1& xe1, E1& ye1) +{ + if(y < x) + { + swap(x, y); + swap(xe1, ye1); + } +} + +#if PX_GCC_FAMILY && !PX_EMSCRIPTEN +__attribute__((noreturn)) +#endif + PX_INLINE void PxDebugBreak() +{ +#if PX_WINDOWS && !PX_CLANG + __debugbreak(); +#elif PX_LINUX + __builtin_trap(); +#elif PX_GCC_FAMILY + __builtin_trap(); +#else + PX_ASSERT(false); +#endif +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec2.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec2.h new file mode 100644 index 0000000..0c1e6b3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec2.h @@ -0,0 +1,344 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC2_H +#define PX_VEC2_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief 2 Element vector class. + +This is a 2-dimensional vector class with public data members. +*/ +class PxVec2 +{ + public: + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(PxZERO) : x(float(0.0)), y(float(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(float a) : x(a), y(a) + { + } + + /** + \brief Initializes from 2 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(float nx, float ny) : x(nx), y(ny) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2(const PxVec2& v) : x(v.x), y(v.y) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2& operator=(const PxVec2& p) + { + x = p.x; + y = p.y; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) + { + PX_ASSERT(index <= 1); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const + { + PX_ASSERT(index <= 1); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec2& v) const + { + return x == v.x && y == v.y; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec2& v) const + { + return x != v.x || y != v.y; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const + { + return x == float(0.0) && y == float(0.0); + } + + /** + \brief returns true if all 2 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const + { + const float unitTolerance = float(1e-4); + return isFinite() && PxAbs(magnitude() - float(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared() const + { + return x * x + y * y; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator-() const + { + return PxVec2(-x, -y); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator+(const PxVec2& v) const + { + return PxVec2(x + v.x, y + v.y); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator-(const PxVec2& v) const + { + return PxVec2(x - v.x, y - v.y); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator*(float f) const + { + return PxVec2(x * f, y * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator/(float f) const + { + f = float(1.0) / f; + return PxVec2(x * f, y * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2& operator+=(const PxVec2& v) + { + x += v.x; + y += v.y; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2& operator-=(const PxVec2& v) + { + x -= v.x; + y -= v.y; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2& operator*=(float f) + { + x *= f; + y *= f; + return *this; + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2& operator/=(float f) + { + f = float(1.0) / f; + x *= f; + y *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float dot(const PxVec2& v) const + { + return x * v.x + y * v.y; + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 getNormalized() const + { + const float m = magnitudeSquared(); + return m > float(0.0) ? *this * PxRecipSqrt(m) : PxVec2(float(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize() + { + const float m = magnitude(); + if(m > float(0.0)) + *this /= m; + return m; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 multiply(const PxVec2& a) const + { + return PxVec2(x * a.x, y * a.y); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 minimum(const PxVec2& v) const + { + return PxVec2(PxMin(x, v.x), PxMin(y, v.y)); + } + + /** + \brief returns MIN(x, y); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float minElement() const + { + return PxMin(x, y); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 maximum(const PxVec2& v) const + { + return PxVec2(PxMax(x, v.x), PxMax(y, v.y)); + } + + /** + \brief returns MAX(x, y); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float maxElement() const + { + return PxMax(x, y); + } + + float x, y; +}; + +PX_CUDA_CALLABLE static PX_FORCE_INLINE PxVec2 operator*(float f, const PxVec2& v) +{ + return PxVec2(f * v.x, f * v.y); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec3.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec3.h new file mode 100644 index 0000000..03b143d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec3.h @@ -0,0 +1,418 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC3_H +#define PX_VEC3_H + +/** \addtogroup foundation +@{ +*/ + +#include "foundation/PxMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief 3 Element vector class. + +This is a 3-dimensional vector class with public data members. +*/ +class PxVec3 +{ + public: + + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(PxZERO) : x(float(0.0)), y(float(0.0)), z(float(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(float a) : x(a), y(a), z(a) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + \param[in] nz Value to initialize Z component. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(float nx, float ny, float nz) : x(nx), y(ny), z(nz) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3(const PxVec3& v) : x(v.x), y(v.y), z(v.z) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator=(const PxVec3& p) + { + x = p.x; + y = p.y; + z = p.z; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) + { + PX_ASSERT(index <= 2); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const + { + PX_ASSERT(index <= 2); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator==(const PxVec3& v) const + { + return x == v.x && y == v.y && z == v.z; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool operator!=(const PxVec3& v) const + { + return x != v.x || y != v.y || z != v.z; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZero() const + { + return x == float(0.0) && y == float(0.0) && z == float(0.0); + } + + /** + \brief returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isNormalized() const + { + const float unitTolerance = float(1e-4); // PT: do we need a different epsilon for float & double? + return isFinite() && PxAbs(magnitude() - float(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitudeSquared() const + { + return x * x + y * y + z * z; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator-() const + { + return PxVec3(-x, -y, -z); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator+(const PxVec3& v) const + { + return PxVec3(x + v.x, y + v.y, z + v.z); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator-(const PxVec3& v) const + { + return PxVec3(x - v.x, y - v.y, z - v.z); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator*(float f) const + { + return PxVec3(x * f, y * f, z * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 operator/(float f) const + { + f = float(1.0) / f; + return PxVec3(x * f, y * f, z * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator+=(const PxVec3& v) + { + x += v.x; + y += v.y; + z += v.z; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator-=(const PxVec3& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator*=(float f) + { + x *= f; + y *= f; + z *= f; + return *this; + } + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator/=(float f) + { + f = float(1.0) / f; + x *= f; + y *= f; + z *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float dot(const PxVec3& v) const + { + return x * v.x + y * v.y + z * v.z; + } + + /** + \brief cross product + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 cross(const PxVec3& v) const + { + return PxVec3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x); + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 getNormalized() const + { + const float m = magnitudeSquared(); + return m > float(0.0) ? *this * PxRecipSqrt(m) : PxVec3(float(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float normalize() + { + const float m = magnitude(); + if(m > float(0.0)) + *this /= m; + return m; + } + + /** + \brief normalizes the vector in place. Does nothing if vector magnitude is under PX_NORMALIZATION_EPSILON. + Returns vector magnitude if >= PX_NORMALIZATION_EPSILON and 0.0f otherwise. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeSafe() + { + const float mag = magnitude(); + if(mag < PX_NORMALIZATION_EPSILON) // PT: do we need a different epsilon for float & double? + return float(0.0); + *this *= float(1.0) / mag; + return mag; + } + + /** + \brief normalizes the vector in place. Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON. + returns vector magnitude. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeFast() + { + const float mag = magnitude(); + PX_ASSERT(mag >= PX_NORMALIZATION_EPSILON); // PT: do we need a different epsilon for float & double? + *this *= float(1.0) / mag; + return mag; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 multiply(const PxVec3& a) const + { + return PxVec3(x * a.x, y * a.y, z * a.z); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 minimum(const PxVec3& v) const + { + return PxVec3(PxMin(x, v.x), PxMin(y, v.y), PxMin(z, v.z)); + } + + /** + \brief returns MIN(x, y, z); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float minElement() const + { + return PxMin(x, PxMin(y, z)); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 maximum(const PxVec3& v) const + { + return PxVec3(PxMax(x, v.x), PxMax(y, v.y), PxMax(z, v.z)); + } + + /** + \brief returns MAX(x, y, z); + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE float maxElement() const + { + return PxMax(x, PxMax(y, z)); + } + + /** + \brief returns absolute values of components; + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 abs() const + { + return PxVec3(PxAbs(x), PxAbs(y), PxAbs(z)); + } + + float x, y, z; +}; + +PX_CUDA_CALLABLE static PX_FORCE_INLINE PxVec3 operator*(float f, const PxVec3& v) +{ + return PxVec3(f * v.x, f * v.y, f * v.z); +} + +//! A padded version of PxVec3, to safely load its data using SIMD +class PxVec3Padded : public PxVec3 +{ + public: + PX_FORCE_INLINE PxVec3Padded() {} + PX_FORCE_INLINE ~PxVec3Padded() {} + PX_FORCE_INLINE PxVec3Padded(const PxVec3& p) : PxVec3(p) {} + PX_FORCE_INLINE PxVec3Padded(float f) : PxVec3(f) {} + + /** + \brief Assignment operator. + To fix this: + error: definition of implicit copy assignment operator for 'PxVec3Padded' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated] + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3Padded& operator=(const PxVec3Padded& p) + { + x = p.x; + y = p.y; + z = p.z; + return *this; + } + + PxU32 padding; +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxVec3Padded) == 16); + +typedef PxVec3Padded PxVec3p; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec4.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec4.h new file mode 100644 index 0000000..5c77082 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVec4.h @@ -0,0 +1,363 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC4_H +#define PX_VEC4_H + +/** \addtogroup foundation +@{ +*/ +#include "foundation/PxMath.h" +#include "foundation/PxVec3.h" + +/** +\brief 4 Element vector class. + +This is a 4-dimensional vector class with public data members. +*/ +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxVec4 +{ + public: + /** + \brief default constructor leaves data uninitialized. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4() + { + } + + /** + \brief zero constructor. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4(PxZERO) : x(float(0.0)), y(float(0.0)), z(float(0.0)), w(float(0.0)) + { + } + + /** + \brief Assigns scalar parameter to all elements. + + Useful to initialize to zero or one. + + \param[in] a Value to assign to elements. + */ + explicit PX_CUDA_CALLABLE PX_INLINE PxVec4(float a) : x(a), y(a), z(a), w(a) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] nx Value to initialize X component. + \param[in] ny Value to initialize Y component. + \param[in] nz Value to initialize Z component. + \param[in] nw Value to initialize W component. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4(float nx, float ny, float nz, float nw) : x(nx), y(ny), z(nz), w(nw) + { + } + + /** + \brief Initializes from 3 scalar parameters. + + \param[in] v Value to initialize the X, Y, and Z components. + \param[in] nw Value to initialize W component. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4(const PxVec3& v, float nw) : x(v.x), y(v.y), z(v.z), w(nw) + { + } + + /** + \brief Initializes from an array of scalar parameters. + + \param[in] v Value to initialize with. + */ + explicit PX_CUDA_CALLABLE PX_INLINE PxVec4(const float v[]) : x(v[0]), y(v[1]), z(v[2]), w(v[3]) + { + } + + /** + \brief Copy ctor. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4(const PxVec4& v) : x(v.x), y(v.y), z(v.z), w(v.w) + { + } + + // Operators + + /** + \brief Assignment operator + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4& operator=(const PxVec4& p) + { + x = p.x; + y = p.y; + z = p.z; + w = p.w; + return *this; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_INLINE float& operator[](unsigned int index) + { + PX_ASSERT(index <= 3); + return reinterpret_cast(this)[index]; + } + + /** + \brief element access + */ + PX_CUDA_CALLABLE PX_INLINE const float& operator[](unsigned int index) const + { + PX_ASSERT(index <= 3); + return reinterpret_cast(this)[index]; + } + + /** + \brief returns true if the two vectors are exactly equal. + */ + PX_CUDA_CALLABLE PX_INLINE bool operator==(const PxVec4& v) const + { + return x == v.x && y == v.y && z == v.z && w == v.w; + } + + /** + \brief returns true if the two vectors are not exactly equal. + */ + PX_CUDA_CALLABLE PX_INLINE bool operator!=(const PxVec4& v) const + { + return x != v.x || y != v.y || z != v.z || w != v.w; + } + + /** + \brief tests for exact zero vector + */ + PX_CUDA_CALLABLE PX_INLINE bool isZero() const + { + return x == float(0) && y == float(0) && z == float(0) && w == float(0); + } + + /** + \brief returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + */ + PX_CUDA_CALLABLE PX_INLINE bool isFinite() const + { + return PxIsFinite(x) && PxIsFinite(y) && PxIsFinite(z) && PxIsFinite(w); + } + + /** + \brief is normalized - used by API parameter validation + */ + PX_CUDA_CALLABLE PX_INLINE bool isNormalized() const + { + const float unitTolerance = float(1e-4); + return isFinite() && PxAbs(magnitude() - float(1.0)) < unitTolerance; + } + + /** + \brief returns the squared magnitude + + Avoids calling PxSqrt()! + */ + PX_CUDA_CALLABLE PX_INLINE float magnitudeSquared() const + { + return x * x + y * y + z * z + w * w; + } + + /** + \brief returns the magnitude + */ + PX_CUDA_CALLABLE PX_INLINE float magnitude() const + { + return PxSqrt(magnitudeSquared()); + } + + /** + \brief negation + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 operator-() const + { + return PxVec4(-x, -y, -z, -w); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 operator+(const PxVec4& v) const + { + return PxVec4(x + v.x, y + v.y, z + v.z, w + v.w); + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 operator-(const PxVec4& v) const + { + return PxVec4(x - v.x, y - v.y, z - v.z, w - v.w); + } + + /** + \brief scalar post-multiplication + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 operator*(float f) const + { + return PxVec4(x * f, y * f, z * f, w * f); + } + + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 operator/(float f) const + { + f = float(1.0) / f; + return PxVec4(x * f, y * f, z * f, w * f); + } + + /** + \brief vector addition + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4& operator+=(const PxVec4& v) + { + x += v.x; + y += v.y; + z += v.z; + w += v.w; + return *this; + } + + /** + \brief vector difference + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4& operator-=(const PxVec4& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + w -= v.w; + return *this; + } + + /** + \brief scalar multiplication + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4& operator*=(float f) + { + x *= f; + y *= f; + z *= f; + w *= f; + return *this; + } + /** + \brief scalar division + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4& operator/=(float f) + { + f = float(1.0) / f; + x *= f; + y *= f; + z *= f; + w *= f; + return *this; + } + + /** + \brief returns the scalar product of this and other. + */ + PX_CUDA_CALLABLE PX_INLINE float dot(const PxVec4& v) const + { + return x * v.x + y * v.y + z * v.z + w * v.w; + } + + /** returns a unit vector */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 getNormalized() const + { + const float m = magnitudeSquared(); + return m > float(0.0) ? *this * PxRecipSqrt(m) : PxVec4(float(0)); + } + + /** + \brief normalizes the vector in place + */ + PX_CUDA_CALLABLE PX_INLINE float normalize() + { + const float m = magnitude(); + if(m > float(0.0)) + *this /= m; + return m; + } + + /** + \brief a[i] * b[i], for all i. + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 multiply(const PxVec4& a) const + { + return PxVec4(x * a.x, y * a.y, z * a.z, w * a.w); + } + + /** + \brief element-wise minimum + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 minimum(const PxVec4& v) const + { + return PxVec4(PxMin(x, v.x), PxMin(y, v.y), PxMin(z, v.z), PxMin(w, v.w)); + } + + /** + \brief element-wise maximum + */ + PX_CUDA_CALLABLE PX_INLINE PxVec4 maximum(const PxVec4& v) const + { + return PxVec4(PxMax(x, v.x), PxMax(y, v.y), PxMax(z, v.z), PxMax(w, v.w)); + } + + PX_CUDA_CALLABLE PX_INLINE PxVec3 getXYZ() const + { + return PxVec3(x, y, z); + } + + float x, y, z, w; +}; + +PX_CUDA_CALLABLE static PX_INLINE PxVec4 operator*(float f, const PxVec4& v) +{ + return PxVec4(f * v.x, f * v.y, f * v.z, f * v.w); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMath.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMath.h new file mode 100644 index 0000000..de0635a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMath.h @@ -0,0 +1,1336 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_MATH_H +#define PX_VEC_MATH_H + +#include "foundation/Px.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxMat33.h" +#include "foundation/PxUnionCast.h" + +// We can opt to use the scalar version of vectorised functions. +// This can catch type safety issues and might even work out more optimal on pc. +// It will also be useful for benchmarking and testing. +// NEVER submit with vector intrinsics deactivated without good reason. +// AM: deactivating SIMD for debug win64 just so autobuild will also exercise +// non-SIMD path, until a dedicated non-SIMD platform sich as Arm comes online. +// TODO: dima: reference all platforms with SIMD support here, +// all unknown/experimental cases should better default to NO SIMD. + +// enable/disable SIMD +#if !defined(PX_SIMD_DISABLED) + #if PX_INTEL_FAMILY && (!defined(__EMSCRIPTEN__) || defined(__SSE2__)) + #define COMPILE_VECTOR_INTRINSICS 1 + #elif PX_SWITCH + #define COMPILE_VECTOR_INTRINSICS 1 + #elif (PX_OSX || PX_LINUX) && PX_A64 + #define COMPILE_VECTOR_INTRINSICS 1 + #else + #define COMPILE_VECTOR_INTRINSICS 0 + #endif +#else + #define COMPILE_VECTOR_INTRINSICS 0 +#endif + +#if COMPILE_VECTOR_INTRINSICS && PX_INTEL_FAMILY && PX_UNIX_FAMILY +// only SSE2 compatible platforms should reach this +#if PX_EMSCRIPTEN + #include +#endif + #include +#endif + +#if COMPILE_VECTOR_INTRINSICS + #include "PxAoS.h" +#else + #include "PxVecMathAoSScalar.h" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +// Basic AoS types are +// FloatV - 16-byte aligned representation of float. +// Vec3V - 16-byte aligned representation of PxVec3 stored as (x y z 0). +// Vec4V - 16-byte aligned representation of vector of 4 floats stored as (x y z w). +// BoolV - 16-byte aligned representation of vector of 4 bools stored as (x y z w). +// VecU32V - 16-byte aligned representation of 4 unsigned ints stored as (x y z w). +// VecI32V - 16-byte aligned representation of 4 signed ints stored as (x y z w). +// Mat33V - 16-byte aligned representation of any 3x3 matrix. +// Mat34V - 16-byte aligned representation of transformation matrix (rotation in col1,col2,col3 and translation in +// col4). +// Mat44V - 16-byte aligned representation of any 4x4 matrix. + +////////////////////////////////////////// +// Construct a simd type from a scalar type +////////////////////////////////////////// + +// FloatV +//(f,f,f,f) +PX_FORCE_INLINE FloatV FLoad(const PxF32 f); + +// Vec3V +//(f,f,f,0) +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f); +//(f.x,f.y,f.z,0) +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f); +//(f.x,f.y,f.z,0), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f); +//(f.x,f.y,f.z,w_undefined), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f); +//(f.x,f.y,f.z,0) +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f); +//(f.x,f.y,f.z,0), f must be 16-byte aligned +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f); + +// Vec4V +//(f,f,f,f) +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f); +//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f); +//(x,y,z,w) +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w); + +// BoolV +//(f,f,f,f) +PX_FORCE_INLINE BoolV BLoad(const bool f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE BoolV BLoad(const bool* const f); + +// VecU32V +//(f,f,f,f) +PX_FORCE_INLINE VecU32V U4Load(const PxU32 f); +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* f); +//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* f); +//((U32)x, (U32)y, (U32)z, (U32)w) +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w); + +// VecI32V +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i); +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i); +//(i,i,i,i) +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i); + +// QuatV +//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array don't need to aligned +PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v); +//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array need to aligned, fast load +PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v); +//(x, y, z, w) +PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w); + +// not added to public api +Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& v); + +/////////////////////////////////////////////////// +// Construct a simd type from a different simd type +/////////////////////////////////////////////////// + +// Vec3V +//(v.x,v.y,v.z,0) +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v); +//(v.x,v.y,v.z,undefined) - be very careful with w!=0 because many functions require w==0 for correct operation eg V3Dot, V3Length, V3Cross etc etc. +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v); + +// Vec4V +//(f.x,f.y,f.z,f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f); +//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a); +//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a); +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a); +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a); + +// VecU32V +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a); +//(b[0], b[1], b[2], b[3]) +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b); + +// VecI32V +//(*(reinterpret_cast(&f.x), (reinterpret_cast(&f.y), (reinterpret_cast(&f.z), +//(reinterpret_cast(&f.w)) +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a); +//((I32)a.x, (I32)a.y, (I32)a.z, (I32)a.w) +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a); +//((I32)b.x, (I32)b.y, (I32)b.z, (I32)b.w) +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b); + +/////////////////////////////////////////////////// +// Convert from a simd type back to a scalar type +/////////////////////////////////////////////////// + +// FloatV +// a.x +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f); + +// Vec3V +//(a.x,a.y,a.z) +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f); +//(a.x,a.y,a.z) +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f); + +// Vec4V +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f); +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f); + +// BoolV +PX_FORCE_INLINE void BStoreA(const BoolV b, PxU32* f); + +// VecU32V +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u); + +// VecI32V +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i); + +////////////////////////////////////////////////////////////////// +// Test that simd types have elements in the floating point range +////////////////////////////////////////////////////////////////// + +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a); +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a); +// check for each component is valid ie in floating point range +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a); + +// Check that w-component is zero. +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a); + +////////////////////////////////////////////////////////////////// +// Tests that all elements of two 16-byte types are completely equivalent. +// Use these tests for unit testing and asserts only. +////////////////////////////////////////////////////////////////// + +namespace vecMathTests +{ +PX_FORCE_INLINE Vec3V getInvalidVec3V(); +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b); +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b); +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b); +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b); +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b); +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b); + +PX_FORCE_INLINE bool allElementsEqualMat33V(const Mat33V& a, const Mat33V& b) +{ + return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && + allElementsEqualVec3V(a.col2, b.col2)); +} +PX_FORCE_INLINE bool allElementsEqualMat34V(const Mat34V& a, const Mat34V& b) +{ + return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && + allElementsEqualVec3V(a.col2, b.col2) && allElementsEqualVec3V(a.col3, b.col3)); +} +PX_FORCE_INLINE bool allElementsEqualMat44V(const Mat44V& a, const Mat44V& b) +{ + return (allElementsEqualVec4V(a.col0, b.col0) && allElementsEqualVec4V(a.col1, b.col1) && + allElementsEqualVec4V(a.col2, b.col2) && allElementsEqualVec4V(a.col3, b.col3)); +} + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b); +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b); +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b); +PX_FORCE_INLINE bool allElementsNearEqualMat33V(const Mat33V& a, const Mat33V& b) +{ + return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && + allElementsNearEqualVec3V(a.col2, b.col2)); +} +PX_FORCE_INLINE bool allElementsNearEqualMat34V(const Mat34V& a, const Mat34V& b) +{ + return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && + allElementsNearEqualVec3V(a.col2, b.col2) && allElementsNearEqualVec3V(a.col3, b.col3)); +} +PX_FORCE_INLINE bool allElementsNearEqualMat44V(const Mat44V& a, const Mat44V& b) +{ + return (allElementsNearEqualVec4V(a.col0, b.col0) && allElementsNearEqualVec4V(a.col1, b.col1) && + allElementsNearEqualVec4V(a.col2, b.col2) && allElementsNearEqualVec4V(a.col3, b.col3)); +} +} + +////////////////////////////////////////////////////////////////// +// Math operations on FloatV +////////////////////////////////////////////////////////////////// + +//(0,0,0,0) +PX_FORCE_INLINE FloatV FZero(); +//(1,1,1,1) +PX_FORCE_INLINE FloatV FOne(); +//(0.5,0.5,0.5,0.5) +PX_FORCE_INLINE FloatV FHalf(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE FloatV FEps(); +//! @cond +//(PX_MAX_REAL, PX_MAX_REAL, PX_MAX_REAL PX_MAX_REAL) +PX_FORCE_INLINE FloatV FMax(); +//! @endcond +//(-PX_MAX_REAL, -PX_MAX_REAL, -PX_MAX_REAL -PX_MAX_REAL) +PX_FORCE_INLINE FloatV FNegMax(); +//(1e-6f, 1e-6f, 1e-6f, 1e-6f) +PX_FORCE_INLINE FloatV FEps6(); +//((PxF32*)&1, (PxF32*)&1, (PxF32*)&1, (PxF32*)&1) + +//-f (per component) +PX_FORCE_INLINE FloatV FNeg(const FloatV f); +// a+b (per component) +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b); +// a-b (per component) +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b); +// 1.0f/a +PX_FORCE_INLINE FloatV FRecip(const FloatV a); +// 1.0f/a +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a); +// sqrt(a) +PX_FORCE_INLINE FloatV FSqrt(const FloatV a); +// a*b+c +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c); +// c-a*b +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c); +// fabs(a) +PX_FORCE_INLINE FloatV FAbs(const FloatV a); +// c ? a : b (per component) +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b); +// a>b (per component) +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b); +// a>=b (per component) +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b); +// a==b (per component) +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b); +// Max(a,b) (per component) +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b); +// Min(a,b) (per component) +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b); +// Clamp(a,b) (per component) +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV); + +// a.x>b.x +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b); +// a.x>=b.x +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b); +// a.x==b.x +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b); +// amax +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max); +// a>=min && a<=max +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max); +// a<-bounds || a>bounds +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds); +// a>=-bounds && a<=bounds +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds); + +// round float a to the near int +PX_FORCE_INLINE FloatV FRound(const FloatV a); +// calculate the sin of float a +PX_FORCE_INLINE FloatV FSin(const FloatV a); +// calculate the cos of float b +PX_FORCE_INLINE FloatV FCos(const FloatV a); + +////////////////////////////////////////////////////////////////// +// Math operations on Vec3V +////////////////////////////////////////////////////////////////// + +//(f,f,f,f) +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f); + +//(x,y,z) +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z); + +//(1,0,0,0) +PX_FORCE_INLINE Vec3V V3UnitX(); +//(0,1,0,0) +PX_FORCE_INLINE Vec3V V3UnitY(); +//(0,0,1,0) +PX_FORCE_INLINE Vec3V V3UnitZ(); + +//(f.x,f.x,f.x,f.x) +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f); +//(f.y,f.y,f.y,f.y) +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f); +//(f.z,f.z,f.z,f.z) +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f); + +//(f,v.y,v.z,v.w) +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f); +//(v.x,f,v.z,v.w) +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f); +//(v.x,v.y,f,v.w) +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f); + +// v.x=f +PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f); +// v.y=f +PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f); +// v.z=f +PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f); +// v.x=f.x, v.y=f.y, v.z=f.z +PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f); +// return v.x +PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v); +// return v.y +PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v); +// return v.y +PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v); +// return (v.x,v.y,v.z) +PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v); + +//(a.x, b.x, c.x) +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c); +//(a.y, b.y, c.y) +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c); +//(a.z, b.z, c.z) +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c); + +//(0,0,0,0) +PX_FORCE_INLINE Vec3V V3Zero(); +//(1,1,1,1) +PX_FORCE_INLINE Vec3V V3One(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE Vec3V V3Eps(); +//-c (per component) +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c); +// a+b (per component) +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b); +// a-b (per component) +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b); +// a*b (per component) +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b); +// 1.0f/a +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a); +// 1.0f/a +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a); +// a*b+c +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c); +// c-a*b +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c); +// a*b+c +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c); +// c-a*b +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c); +// fabs(a) +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a); + +// a.b +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b); +// aXb +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b); +// |a.a|^1/2 +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3Length(const Vec3V a); +// a.a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a); +// a*|a.a|^-1/2 +// Note: a.w must have value zero +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a); +// a.a>0 ? a*|a.a|^-1/2 : (0,0,0,0) +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3Length(const Vec3V a); +// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue +// Note: a.w must have value zero +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue); +// a.x + a.y + a.z +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a); + +// c ? a : b (per component) +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b); +// a>b (per component) +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b); +// a>=b (per component) +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b); +// a==b (per component) +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b); +// Max(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b); +// Min(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b); + +// Extract the maximum value from a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a); + +// Extract the minimum value from a +// Note: a.w must have value zero +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a); + +// Clamp(a,b) (per component) +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV); + +// Extract the sign for each component +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a); + +// Test all components. +// (a.x>b.x && a.y>b.y && a.z>b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b); +// (a.x>=b.x && a.y>=b.y && a.z>=b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b); +// (a.x==b.x && a.y==b.y && a.z==b.z) +// Note: a.w and b.w must have value zero +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b); +// a.xmax.x || a.y>max.y || a.z>max.z +// Note: a.w and min.w and max.w must have value zero +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max); +// a.x>=min.x && a.y>=min.y && a.z>=min.z && a.x<=max.x && a.y<=max.y && a.z<=max.z +// Note: a.w and min.w and max.w must have value zero +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max); +// a.x<-bounds.x || a.y<=-bounds.y || a.zbounds.x || a.y>bounds.y || a.z>bounds.z +// Note: a.w and bounds.w must have value zero +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds); +// a.x>=-bounds.x && a.y>=-bounds.y && a.z>=-bounds.z && a.x<=bounds.x && a.y<=bounds.y && a.z<=bounds.z +// Note: a.w and bounds.w must have value zero +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds); + +//(floor(a.x + 0.5f), floor(a.y + 0.5f), floor(a.z + 0.5f)) +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a); + +//(sinf(a.x), sinf(a.y), sinf(a.z)) +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a); +//(cosf(a.x), cosf(a.y), cosf(a.z)) +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a); + +//(a.y,a.z,a.z) +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a); +//(a.x,a.y,a.x) +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a); +//(a.y,a.z,a.x) +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a); +//(a.z, a.x, a.y) +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a); +//(a.z,a.z,a.y) +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a); +//(a.y,a.x,a.x) +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a); +//(0, v1.z, v0.y) +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1); +//(v0.z, 0, v1.x) +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1); +//(v1.y, v0.x, 0) +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1); + +// Transpose 3 Vec3Vs inplace. Sets the w component to zero +// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] -> [x0 x1 x2 0] [y0 y1 y2 0] [z0 z1 z2 0] +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); + +////////////////////////////////////////////////////////////////// +// Math operations on Vec4V +////////////////////////////////////////////////////////////////// + +//(f,f,f,f) +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f); + +//(f[0],f[1],f[2],f[3]) +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const f); +//(x,y,z,w) +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); +//(x.w, y.w, z.w, w.w) +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.z, y.z, z.z, w.z) +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.y, y.y, z.y, w.y) +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); +//(x.x, y.x, z.x, w.x) +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); + +//(a.x, b.x, a.y, b.y) +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b); +//(a.z, b.z, a.w, b.w) +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b); + +//(1,0,0,0) +PX_FORCE_INLINE Vec4V V4UnitW(); +//(0,1,0,0) +PX_FORCE_INLINE Vec4V V4UnitY(); +//(0,0,1,0) +PX_FORCE_INLINE Vec4V V4UnitZ(); +//(0,0,0,1) +PX_FORCE_INLINE Vec4V V4UnitW(); + +//(f.x,f.x,f.x,f.x) +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f); +//(f.y,f.y,f.y,f.y) +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f); +//(f.z,f.z,f.z,f.z) +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f); +//(f.w,f.w,f.w,f.w) +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f); + +//(f,v.y,v.z,v.w) +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f); +//(v.x,f,v.z,v.w) +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f); +//(v.x,v.y,f,v.w) +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f); +//(v.x,v.y,v.z,f) +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f); + +//(v.x,v.y,v.z,0) +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v); + +//(a[elementIndex], a[elementIndex], a[elementIndex], a[elementIndex]) +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a); + +// v.x=f +PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f); +// v.y=f +PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f); +// v.z=f +PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f); +// v.w=f +PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f); +// v.x=f.x, v.y=f.y, v.z=f.z +PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f); +// return v.x +PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v); +// return v.y +PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v); +// return v.z +PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v); +// return v.w +PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v); +// return (v.x,v.y,v.z) +PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v); + +//(0,0,0,0) +PX_FORCE_INLINE Vec4V V4Zero(); +//(1,1,1,1) +PX_FORCE_INLINE Vec4V V4One(); +//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) +PX_FORCE_INLINE Vec4V V4Eps(); + +//-c (per component) +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c); +// a+b (per component) +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b); +// a-b (per component) +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b); +// a*b (per component) +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b); +// a*b (per component) +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b); +// a/b (per component) +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b); +// 1.0f/a +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a); +// 1.0f/a +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a); +// 1.0f/sqrt(a) +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a); +// a*b+c +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c); +// c-a*b +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c); +// a*b+c +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c); +// c-a*b +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c); + +// fabs(a) +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a); +// bitwise a & ~b +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b); + +// a.b (W is taken into account) +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b); +// a.b (same computation as V3Dot. W is ignored in input) +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b); +// aXb (same computation as V3Cross. W is ignored in input and undefined in output) +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b); + +//|a.a|^1/2 +PX_FORCE_INLINE FloatV V4Length(const Vec4V a); +// a.a +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a); + +// a*|a.a|^-1/2 +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a); +// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue); +// a*|a.a|^-1/2 +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a); + +// c ? a : b (per component) +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b); +// a>b (per component) +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b); +// a>=b (per component) +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b); +// a==b (per component) +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b); +// Max(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b); +// Min(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b); +// Get the maximum component from a +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a); +// Get the minimum component from a +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a); + +// Clamp(a,b) (per component) +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV); + +// return 1 if all components of a are greater than all components of b. +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b); +// return 1 if all components of a are greater than or equal to all components of b +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b); +// return 1 if XYZ components of a are greater than or equal to XYZ components of b. W is ignored. +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b); +// return 1 if all components of a are equal to all components of b +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b); +// return 1 if any XYZ component of a is greater than the corresponding component of b. W is ignored. +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b); + +// round(a)(per component) +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a); +// sin(a) (per component) +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a); +// cos(a) (per component) +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a); + +// Permute v into a new vec4v with YXWZ format +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v); +// Permute v into a new vec4v with XZXZ format +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v); +// Permute v into a new vec4v with YWYW format +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v); +// Permute v into a new vec4v with YZXW format +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v); +// Permute v into a new vec4v with ZWXY format - equivalent to a swap of the two 64bit parts of the vector +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a); + +// Permute v into a new vec4v with format {a[x], a[y], a[z], a[w]} +// V4Perm<1,3,1,3> is equal to V4PermYWYW +// V4Perm<0,2,0,2> is equal to V4PermXZXZ +// V3Perm<1,0,3,2> is equal to V4PermYXWZ +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a); + +// Transpose 4 Vec4Vs inplace. +// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] [ x3, y3, z3, w3] -> +// [ x0, x1, x2, x3] [ y0, y1, y2, y3] [ z0, z1, z2, z3] [ w0, w1, w2, w3] +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); + +// q = cos(a/2) + u*sin(a/2) +PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a); +// convert q to a unit quaternion +PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q); +//|q.q|^1/2 +PX_FORCE_INLINE FloatV QuatLength(const QuatV q); +// q.q +PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q); +// a.b +PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b); +//(-q.x, -q.y, -q.z, q.w) +PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q); +//(q.x, q.y, q.z) +PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q); +// convert quaternion to matrix 33 +PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q); +// convert quaternion to matrix 33 +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2); +// convert matrix 33 to quaternion +PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a); +// brief computes rotation of x-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q); +// brief computes rotation of y-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q); +// brief computes rotation of z-axis +PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q); +// calculate the rotation vector from q and v +PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v); +// calculate the rotation vector from the conjugate quaternion and v +PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v); +// quaternion multiplication +PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b); +// quaternion add +PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b); +// (-q.x, -q.y, -q.z, -q.w) +PX_FORCE_INLINE QuatV QuatNeg(const QuatV q); +// (a.x - b.x, a.y-b.y, a.z-b.z, a.w-b.w ) +PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b); +// (a.x*b, a.y*b, a.z*b, a.w*b) +PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b); +// (x = v[0], y = v[1], z = v[2], w =v[3]) +PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const v); +// (x = v[0], y = v[1], z = v[2], w =v[3]) +PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); +// (x = 0.f, y = 0.f, z = 0.f, w = 1.f) +PX_FORCE_INLINE QuatV QuatIdentity(); +// check for each component is valid +PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q); +// check for each component is valid +PX_FORCE_INLINE bool isValidQuatV(const QuatV q); +// check for each component is valid +PX_FORCE_INLINE bool isSaneQuatV(const QuatV q); + +// Math operations on 16-byte aligned booleans. +// x=false y=false z=false w=false +PX_FORCE_INLINE BoolV BFFFF(); +// x=false y=false z=false w=true +PX_FORCE_INLINE BoolV BFFFT(); +// x=false y=false z=true w=false +PX_FORCE_INLINE BoolV BFFTF(); +// x=false y=false z=true w=true +PX_FORCE_INLINE BoolV BFFTT(); +// x=false y=true z=false w=false +PX_FORCE_INLINE BoolV BFTFF(); +// x=false y=true z=false w=true +PX_FORCE_INLINE BoolV BFTFT(); +// x=false y=true z=true w=false +PX_FORCE_INLINE BoolV BFTTF(); +// x=false y=true z=true w=true +PX_FORCE_INLINE BoolV BFTTT(); +// x=true y=false z=false w=false +PX_FORCE_INLINE BoolV BTFFF(); +// x=true y=false z=false w=true +PX_FORCE_INLINE BoolV BTFFT(); +// x=true y=false z=true w=false +PX_FORCE_INLINE BoolV BTFTF(); +// x=true y=false z=true w=true +PX_FORCE_INLINE BoolV BTFTT(); +// x=true y=true z=false w=false +PX_FORCE_INLINE BoolV BTTFF(); +// x=true y=true z=false w=true +PX_FORCE_INLINE BoolV BTTFT(); +// x=true y=true z=true w=false +PX_FORCE_INLINE BoolV BTTTF(); +// x=true y=true z=true w=true +PX_FORCE_INLINE BoolV BTTTT(); + +// x=false y=false z=false w=true +PX_FORCE_INLINE BoolV BWMask(); +// x=true y=false z=false w=false +PX_FORCE_INLINE BoolV BXMask(); +// x=false y=true z=false w=false +PX_FORCE_INLINE BoolV BYMask(); +// x=false y=false z=true w=false +PX_FORCE_INLINE BoolV BZMask(); + +// get x component +PX_FORCE_INLINE BoolV BGetX(const BoolV f); +// get y component +PX_FORCE_INLINE BoolV BGetY(const BoolV f); +// get z component +PX_FORCE_INLINE BoolV BGetZ(const BoolV f); +// get w component +PX_FORCE_INLINE BoolV BGetW(const BoolV f); + +// Use elementIndex to splat xxxx or yyyy or zzzz or wwww +template +PX_FORCE_INLINE BoolV BSplatElement(Vec4V a); + +// component-wise && (AND) +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b); +// component-wise || (OR) +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b); +// component-wise not +PX_FORCE_INLINE BoolV BNot(const BoolV a); + +// if all four components are true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a); + +// if any four components is true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a); + +// if all three(0, 1, 2) components are true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a); + +// if any three (0, 1, 2) components is true, return true, otherwise return false +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a); + +// Return 1 if all components equal, zero otherwise. +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b); + +// Specialized/faster BAllEq function for b==TTTT +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a); +// Specialized/faster BAllEq function for b==FFFF +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a); + +/// Get BoolV as bits set in an PxU32. A bit in the output is set if the element is 'true' in the input. +/// There is a bit for each element in a, with element 0s value held in bit0, element 1 in bit 1s and so forth. +/// If nothing is true in the input it will return 0, and if all are true if will return 0xf. +/// NOTE! That performance of the function varies considerably by platform, thus it is recommended to use +/// where your algorithm really needs a BoolV in an integer variable. +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a); + +// VecI32V stuff + +PX_FORCE_INLINE VecI32V VecI32V_Zero(); + +PX_FORCE_INLINE VecI32V VecI32V_One(); + +PX_FORCE_INLINE VecI32V VecI32V_Two(); + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne(); + +// Compute a shift parameter for VecI32V_LeftShift and VecI32V_RightShift +// Each element of shift must be identical ie the vector must have form {count, count, count, count} with count>=0 +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift); + +// Shift each element of a leftwards by the same amount +// Compute shift with VecI32V_PrepareShift +//{a.x<>shift[0], a.y>>shift[0], a.z>>shift[0], a.w>>shift[0]} +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg shift); + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a); + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b); + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b); + +// VecU32V stuff + +PX_FORCE_INLINE VecU32V U4Zero(); + +PX_FORCE_INLINE VecU32V U4One(); + +PX_FORCE_INLINE VecU32V U4Two(); + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b); + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b); + +// VecU32 - why does this not return a bool? +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b); + +// Math operations on 16-byte aligned Mat33s (represents any 3x3 matrix) +PX_FORCE_INLINE Mat33V M33Load(const PxMat33& m) +{ + return Mat33V(Vec3V_From_Vec4V(V4LoadU(&m.column0.x)), + Vec3V_From_Vec4V(V4LoadU(&m.column1.x)), V3LoadU(m.column2)); +} +// a*b +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b); +// A*x + b +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c); +// transpose(a) * b +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b); +// a*b +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b); +// a+b +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b); +// a+b +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b); +//-a +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a); +// absolute value of the matrix +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a); +// inverse mat +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a); +// transpose(a) +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a); +// create an identity matrix +PX_FORCE_INLINE Mat33V M33Identity(); + +// create a vec3 to store the diagonal element of the M33 +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg); + +// Not implemented +// return 1 if all components of a are equal to all components of b +// PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b); +// v.w=f +// PX_FORCE_INLINE void V3WriteW(Vec3V& v, const PxF32 f); +// PX_FORCE_INLINE PxF32 V3ReadW(const Vec3V& v); + +// Not used +// PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr); +// PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr); +// floor(a)(per component) +// PX_FORCE_INLINE Vec4V V4Floor(Vec4V a); +// ceil(a) (per component) +// PX_FORCE_INLINE Vec4V V4Ceil(Vec4V a); +// PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power); + +// Math operations on 16-byte aligned Mat34s (represents transformation matrix - rotation and translation). +// namespace _Mat34V +//{ +// //a*b +// PX_FORCE_INLINE Vec3V multiplyV(const Mat34V& a, const Vec3V b); +// //a_rotation * b +// PX_FORCE_INLINE Vec3V multiply3X3V(const Mat34V& a, const Vec3V b); +// //transpose(a_rotation)*b +// PX_FORCE_INLINE Vec3V multiplyTranspose3X3V(const Mat34V& a, const Vec3V b); +// //a*b +// PX_FORCE_INLINE Mat34V multiplyV(const Mat34V& a, const Mat34V& b); +// //a_rotation*b +// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat33V& b); +// //a_rotation*b_rotation +// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat34V& b); +// //a+b +// PX_FORCE_INLINE Mat34V addV(const Mat34V& a, const Mat34V& b); +// //a^-1 +// PX_FORCE_INLINE Mat34V getInverseV(const Mat34V& a); +// //transpose(a_rotation) +// PX_FORCE_INLINE Mat33V getTranspose3X3(const Mat34V& a); +//}; //namespace _Mat34V + +// a*b +//#define M34MulV3(a,b) (M34MulV3(a,b)) +////a_rotation * b +//#define M34Mul33V3(a,b) (M34Mul33V3(a,b)) +////transpose(a_rotation)*b +//#define M34TrnspsMul33V3(a,b) (M34TrnspsMul33V3(a,b)) +////a*b +//#define M34MulM34(a,b) (_Mat34V::multiplyV(a,b)) +// a_rotation*b +//#define M34MulM33(a,b) (M34MulM33(a,b)) +// a_rotation*b_rotation +//#define M34Mul33MM34(a,b) (M34MulM33(a,b)) +// a+b +//#define M34Add(a,b) (M34Add(a,b)) +////a^-1 +//#define M34Inverse(a,b) (M34Inverse(a)) +// transpose(a_rotation) +//#define M34Trnsps33(a) (M33Trnsps3X3(a)) + +// Math operations on 16-byte aligned Mat44s (represents any 4x4 matrix) +// namespace _Mat44V +//{ +// //a*b +// PX_FORCE_INLINE Vec4V multiplyV(const Mat44V& a, const Vec4V b); +// //transpose(a)*b +// PX_FORCE_INLINE Vec4V multiplyTransposeV(const Mat44V& a, const Vec4V b); +// //a*b +// PX_FORCE_INLINE Mat44V multiplyV(const Mat44V& a, const Mat44V& b); +// //a+b +// PX_FORCE_INLINE Mat44V addV(const Mat44V& a, const Mat44V& b); +// //a&-1 +// PX_FORCE_INLINE Mat44V getInverseV(const Mat44V& a); +// //transpose(a) +// PX_FORCE_INLINE Mat44V getTransposeV(const Mat44V& a); +//}; //namespace _Mat44V + +// namespace _VecU32V +//{ +// // pack 8 U32s to 8 U16s with saturation +// PX_FORCE_INLINE VecU16V pack2U32VToU16VSaturate(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V orV(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V andV(VecU32V a, VecU32V b); +// PX_FORCE_INLINE VecU32V andcV(VecU32V a, VecU32V b); +// // conversion from integer to float +// PX_FORCE_INLINE Vec4V convertToVec4V(VecU32V a); +// // splat a[elementIndex] into all fields of a +// template +// PX_FORCE_INLINE VecU32V splatElement(VecU32V a); +// PX_FORCE_INLINE void storeAligned(VecU32V a, VecU32V* address); +//}; + +// namespace _VecI32V +//{ +// template PX_FORCE_INLINE VecI32V splatI32(); +//}; +// +// namespace _VecU16V +//{ +// PX_FORCE_INLINE VecU16V orV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V andV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V andcV(VecU16V a, VecU16V b); +// PX_FORCE_INLINE void storeAligned(VecU16V val, VecU16V *address); +// PX_FORCE_INLINE VecU16V loadAligned(VecU16V* addr); +// PX_FORCE_INLINE VecU16V loadUnaligned(VecU16V* addr); +// PX_FORCE_INLINE VecU16V compareGt(VecU16V a, VecU16V b); +// template +// PX_FORCE_INLINE VecU16V splatElement(VecU16V a); +// PX_FORCE_INLINE VecU16V subtractModulo(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU16V addModulo(VecU16V a, VecU16V b); +// PX_FORCE_INLINE VecU32V getLo16(VecU16V a); // [0,2,4,6] 16-bit values to [0,1,2,3] 32-bit vector +// PX_FORCE_INLINE VecU32V getHi16(VecU16V a); // [1,3,5,7] 16-bit values to [0,1,2,3] 32-bit vector +//}; +// +// namespace _VecI16V +//{ +// template PX_FORCE_INLINE VecI16V splatImmediate(); +//}; +// +// namespace _VecU8V +//{ +//}; + +// a*b +//#define M44MulV4(a,b) (M44MulV4(a,b)) +////transpose(a)*b +//#define M44TrnspsMulV4(a,b) (M44TrnspsMulV4(a,b)) +////a*b +//#define M44MulM44(a,b) (M44MulM44(a,b)) +////a+b +//#define M44Add(a,b) (M44Add(a,b)) +////a&-1 +//#define M44Inverse(a) (M44Inverse(a)) +////transpose(a) +//#define M44Trnsps(a) (M44Trnsps(a)) + +// dsequeira: these used to be assert'd out in SIMD builds, but they're necessary if +// we want to be able to write some scalar functions which run using SIMD data structures + +PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).x = f; +} + +PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).y = f; +} + +PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f) +{ + reinterpret_cast(v).z = f; +} + +PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f) +{ + reinterpret_cast(v) = f; +} + +PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v) +{ + return reinterpret_cast(v).x; +} + +PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v) +{ + return reinterpret_cast(v).y; +} + +PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v) +{ + return reinterpret_cast(v).z; +} + +PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v) +{ + return reinterpret_cast(v); +} + +PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).x = f; +} + +PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).y = f; +} + +PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).z = f; +} + +PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f) +{ + reinterpret_cast(v).w = f; +} + +PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f) +{ + reinterpret_cast(v) = f; +} + +PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v) +{ + return reinterpret_cast(v).x; +} + +PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v) +{ + return reinterpret_cast(v).y; +} + +PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v) +{ + return reinterpret_cast(v).z; +} + +PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v) +{ + return reinterpret_cast(v).w; +} + +PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v) +{ + return reinterpret_cast(v); +} + +// this macro transposes 4 Vec4V into 3 Vec4V (assuming that the W component can be ignored +#define PX_TRANSPOSE_44_34(inA, inB, inC, inD, outA, outB, outC) \ +outA = V4UnpackXY(inA, inC); \ +inA = V4UnpackZW(inA, inC); \ +inC = V4UnpackXY(inB, inD); \ +inB = V4UnpackZW(inB, inD); \ +outB = V4UnpackZW(outA, inC); \ +outA = V4UnpackXY(outA, inC); \ +outC = V4UnpackXY(inA, inB); + +// this macro transposes 3 Vec4V into 4 Vec4V (with W components as garbage!) +#define PX_TRANSPOSE_34_44(inA, inB, inC, outA, outB, outC, outD) \ + outA = V4UnpackXY(inA, inC); \ + inA = V4UnpackZW(inA, inC); \ + outC = V4UnpackXY(inB, inB); \ + inC = V4UnpackZW(inB, inB); \ + outB = V4UnpackZW(outA, outC); \ + outA = V4UnpackXY(outA, outC); \ + outC = V4UnpackXY(inA, inC); \ + outD = V4UnpackZW(inA, inC); + +#define PX_TRANSPOSE_44(inA, inB, inC, inD, outA, outB, outC, outD) \ + outA = V4UnpackXY(inA, inC); \ + inA = V4UnpackZW(inA, inC); \ + inC = V4UnpackXY(inB, inD); \ + inB = V4UnpackZW(inB, inD); \ + outB = V4UnpackZW(outA, inC); \ + outA = V4UnpackXY(outA, inC); \ + outC = V4UnpackXY(inA, inB); \ + outD = V4UnpackZW(inA, inB); + +// This function returns a Vec4V, where each element is the dot product of one pair of Vec3Vs. On PC, each element in +// the result should be identical to the results if V3Dot was performed +// for each pair of Vec3V. +// However, on other platforms, the result might diverge by some small margin due to differences in FP rounding, e.g. if +// _mm_dp_ps was used or some other approximate dot product or fused madd operations +// were used. +// Where there does not exist a hw-accelerated dot-product operation, this approach should be the fastest way to compute +// the dot product of 4 vectors. +PX_FORCE_INLINE Vec4V V3Dot4(const Vec3VArg a0, const Vec3VArg b0, const Vec3VArg a1, const Vec3VArg b1, + const Vec3VArg a2, const Vec3VArg b2, const Vec3VArg a3, const Vec3VArg b3) +{ + Vec4V a0b0 = Vec4V_From_Vec3V(V3Mul(a0, b0)); + Vec4V a1b1 = Vec4V_From_Vec3V(V3Mul(a1, b1)); + Vec4V a2b2 = Vec4V_From_Vec3V(V3Mul(a2, b2)); + Vec4V a3b3 = Vec4V_From_Vec3V(V3Mul(a3, b3)); + + Vec4V aTrnsps, bTrnsps, cTrnsps; + + PX_TRANSPOSE_44_34(a0b0, a1b1, a2b2, a3b3, aTrnsps, bTrnsps, cTrnsps); + + return V4Add(V4Add(aTrnsps, bTrnsps), cTrnsps); +} + +//(f.x,f.y,f.z,0) - Alternative/faster V3LoadU implementation when it is safe to read "W", i.e. the 32bits after the PxVec3. +PX_FORCE_INLINE Vec3V V3LoadU_SafeReadW(const PxVec3& f) +{ + return Vec3V_From_Vec4V(V4LoadU(&f.x)); +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +// Now for the cross-platform implementations of the 16-byte aligned maths functions (win32/360/ppu/spu etc). +#if COMPILE_VECTOR_INTRINSICS +#include "PxInlineAoS.h" +#else // #if COMPILE_VECTOR_INTRINSICS +#include "PxVecMathAoSScalarInline.h" +#endif // #if !COMPILE_VECTOR_INTRINSICS +#include "PxVecQuat.h" + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalar.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalar.h new file mode 100644 index 0000000..11243cd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalar.h @@ -0,0 +1,251 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_MATH_AOS_SCALAR_H +#define PX_VEC_MATH_AOS_SCALAR_H + +#if COMPILE_VECTOR_INTRINSICS +#error Scalar version should not be included when using vector intrinsics. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +struct VecI16V; +struct VecU16V; +struct VecI32V; +struct VecU32V; +struct Vec4V; +typedef Vec4V QuatV; + +PX_ALIGN_PREFIX(16) +struct FloatV +{ + PxF32 x; + PxF32 pad[3]; + FloatV() + { + } + FloatV(const PxF32 _x) : x(_x) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Vec4V +{ + PxF32 x, y, z, w; + Vec4V() + { + } + Vec4V(const PxF32 _x, const PxF32 _y, const PxF32 _z, const PxF32 _w) : x(_x), y(_y), z(_z), w(_w) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Vec3V +{ + PxF32 x, y, z; + PxF32 pad; + Vec3V() + { + } + Vec3V(const PxF32 _x, const PxF32 _y, const PxF32 _z) : x(_x), y(_y), z(_z), pad(0.0f) + { + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct BoolV +{ + PxU32 ux, uy, uz, uw; + BoolV() + { + } + BoolV(const PxU32 _x, const PxU32 _y, const PxU32 _z, const PxU32 _w) : ux(_x), uy(_y), uz(_z), uw(_w) + { + } +} PX_ALIGN_SUFFIX(16); + +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V col0; + Vec3V col1; + Vec3V col2; +}; + +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V col0; + Vec3V col1; + Vec3V col2; + Vec3V col3; +}; + +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V col0; + Vec4V col1; + Vec4V col2; +}; + +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V col0; + Vec4V col1; + Vec4V col2; + Vec4V col3; +}; + +PX_ALIGN_PREFIX(16) +struct VecU32V +{ + PxU32 u32[4]; + PX_FORCE_INLINE VecU32V() + { + } + PX_FORCE_INLINE VecU32V(PxU32 a, PxU32 b, PxU32 c, PxU32 d) + { + u32[0] = a; + u32[1] = b; + u32[2] = c; + u32[3] = d; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecI32V +{ + PxI32 i32[4]; + PX_FORCE_INLINE VecI32V() + { + } + PX_FORCE_INLINE VecI32V(PxI32 a, PxI32 b, PxI32 c, PxI32 d) + { + i32[0] = a; + i32[1] = b; + i32[2] = c; + i32[3] = d; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecI16V +{ + PxI16 i16[8]; + PX_FORCE_INLINE VecI16V() + { + } + PX_FORCE_INLINE VecI16V(PxI16 a, PxI16 b, PxI16 c, PxI16 d, PxI16 e, PxI16 f, PxI16 g, PxI16 h) + { + i16[0] = a; + i16[1] = b; + i16[2] = c; + i16[3] = d; + i16[4] = e; + i16[5] = f; + i16[6] = g; + i16[7] = h; + } +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct VecU16V +{ + union + { + PxU16 u16[8]; + PxI16 i16[8]; + }; + PX_FORCE_INLINE VecU16V() + { + } + PX_FORCE_INLINE VecU16V(PxU16 a, PxU16 b, PxU16 c, PxU16 d, PxU16 e, PxU16 f, PxU16 g, PxU16 h) + { + u16[0] = a; + u16[1] = b; + u16[2] = c; + u16[3] = d; + u16[4] = e; + u16[5] = f; + u16[6] = g; + u16[7] = h; + } +} PX_ALIGN_SUFFIX(16); + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define QuatVArg QuatV & + +#define VecCrossV Vec3V + +typedef VecI32V VecShiftV; +#define VecShiftVArg VecShiftV & + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalarInline.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalarInline.h new file mode 100644 index 0000000..b328ebb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathAoSScalarInline.h @@ -0,0 +1,2293 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_MATH_AOS_SCALAR_INLINE_H +#define PX_VEC_MATH_AOS_SCALAR_INLINE_H + +#if COMPILE_VECTOR_INTRINSICS +#error Scalar version should not be included when using vector intrinsics. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +#define BOOL_TO_U32(b) PxU32(- PxI32(b)) +#define TRUE_TO_U32 PxU32(-1) +#define FALSE_TO_U32 PxU32(0) + +#define BOOL_TO_U16(b) PxU16(- PxI32(b)) + +#define PX_VECMATH_ASSERT_ENABLED 0 + +#if PX_VECMATH_ASSERT_ENABLED +#define VECMATHAOS_ASSERT(x) { PX_ASSERT(x); } +#else +#define VECMATHAOS_ASSERT(x) +#endif + +///////////////////////////////////////////////////////////////////// +////INTERNAL USE ONLY AND TESTS +///////////////////////////////////////////////////////////////////// + +namespace internalScalarSimd +{ +PX_FORCE_INLINE PxF32 FStore(const FloatV a) +{ + return a.x; +} + +PX_FORCE_INLINE bool hasZeroElementInFloatV(const FloatV a) +{ + return (0 == a.x); +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + return (0 == a.x || 0 == a.y || 0 == a.z); +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + return (0 == a.x || 0 == a.y || 0 == a.z || 0 == a.w); +} +} + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + Vec3V tmp; + tmp.x = tmp.y = tmp.z = 0.0f; + tmp.pad = 1.0f; + return tmp; +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + return (a.x == b.x); +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + return (a.x == b.x && a.y == b.y && a.z == b.z); +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return (a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w); +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw); +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return (a.u32[0] == b.u32[0] && a.u32[1] == b.u32[1] && a.u32[2] == b.u32[2] && a.u32[3] == b.u32[3]); +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + return (a.i32[0] == b.i32[0] && a.i32[1] == b.i32[1] && a.i32[2] == b.i32[2] && a.i32[3] == b.i32[3]); +} + +#define VECMATH_AOS_EPSILON (1e-3f) + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + const PxF32 cx = a.x - b.x; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const PxF32 cx = a.x - b.x; + const PxF32 cy = a.y - b.y; + const PxF32 cz = a.z - b.z; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && + cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const PxF32 cx = a.x - b.x; + const PxF32 cy = a.y - b.y; + const PxF32 cz = a.z - b.z; + const PxF32 cw = a.w - b.w; + return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && + cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON && + cw > -VECMATH_AOS_EPSILON && cw < VECMATH_AOS_EPSILON); +} +} + +/////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + return a.pad == 0.f; +} + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + return PxIsFinite(a.x); +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z); +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z) && PxIsFinite(a.w); +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return FloatV(f); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + return Vec3V(f, f, f); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return Vec4V(f, f, f, f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ +#if PX_ARM + // SD: Android ARM builds fail if this is done with a cast. + // Might also fail because of something else but the select + // operator here seems to fix everything that failed in release builds. + return f ? BTTTT() : BFFFF(); +#else + return BoolV(BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f)); +#endif +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + return Vec3V(f[0], f[1], f[2]); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const f) +{ + return Vec3V(f[0], f[1], f[2]); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V f) +{ + return Vec3V(f.x, f.y, f.z); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) +{ + return Vec3V(v.x, v.y, v.z); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + return Vec4V(f.x, f.y, f.z, 0.0f); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return Vec4V(f.x, f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + return Vec4V(f[0], f[1], f[2], f[3]); +} + +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) +{ + *reinterpret_cast(f) = a; +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + *reinterpret_cast(f) = *reinterpret_cast(&a.x); +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) +{ + *reinterpret_cast(f) = a; +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + *reinterpret_cast(u) = uv; +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + *reinterpret_cast(i) = iv; +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return Vec4V(f[0], f[1], f[2], f[3]); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + return Vec4V(f[0], f[1], f[2], 0.0f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + return BoolV(BOOL_TO_U32(f[0]), BOOL_TO_U32(f[1]), BOOL_TO_U32(f[2]), BOOL_TO_U32(f[3])); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + *f = a.x; +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + f = PxVec3(a.x, a.y, a.z); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + f = PxVec3(a.x, a.y, a.z); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) +{ + *b2 = b.ux; +} + +////////////////////////// +// FLOATV +////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return FLoad(0.0f); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +//! @cond +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} +//! @endcond + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + return FloatV(-f.x); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + return FloatV(a.x + b.x); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + return FloatV(a.x - b.x); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + return FloatV(a.x * b.x); +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + VECMATHAOS_ASSERT(b.x != 0.0f); + return FloatV(a.x / b.x); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + VECMATHAOS_ASSERT(b.x != 0.0f); + return FloatV(a.x / b.x); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return 1.0f / a.x; +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return 1.0f / a.x; +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return PxRecipSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + return PxSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + VECMATHAOS_ASSERT(a.x != 0.0f); + return PxRecipSqrt(a.x); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + return FAdd(FMul(a, b), c); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + return FSub(c, FMul(a, b)); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + return FloatV(PxAbs(a.x)); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + return FloatV(c.ux ? a.x : b.x); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + return BLoad(a.x > b.x); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + return BLoad(a.x >= b.x); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + return BLoad(a.x == b.x); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + return (a.x > b.x ? FloatV(a.x) : FloatV(b.x)); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + return (a.x > b.x ? FloatV(b.x) : FloatV(a.x)); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + return FMax(FMin(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x > b.x); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x >= b.x); +} +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + return BOOL_TO_U32(a.x == b.x); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + return floorf(a.x + 0.5f); +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + return sinf(a.x); +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + return cosf(a.x); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + return BOOL_TO_U32(a.x > max.x || a.x < min.x); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + return BOOL_TO_U32(a.x >= min.x && a.x <= max.x); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + return FOutOfBounds(a, FNeg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + return FInBounds(a, FNeg(bounds), bounds); +} + +///////////////////// +// VEC3V +///////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + return Vec3V(f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + return Vec3V(x.x, y.x, z.x); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + return Vec3V(1.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + return Vec3V(0.0f, 1.0f, 0.0f); +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + return Vec3V(0.0f, 0.0f, 1.0f); +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + return FloatV(f.x); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + return FloatV(f.y); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + return FloatV(f.z); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + return Vec3V(f.x, v.y, v.z); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + return Vec3V(v.x, f.x, v.z); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + return Vec3V(v.x, v.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.x, b.x, c.x); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.y, b.y, c.y); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return Vec3V(a.z, b.z, c.z); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return V3Load(0.0f); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c) +{ + return Vec3V(-c.x, -c.y, -c.z); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x + b.x, a.y + b.y, a.z + b.z); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x - b.x, a.y - b.y, a.z - b.z); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + return Vec3V(a.x * b.x, a.y * b.x, a.z * b.x); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x * b.x, a.y * b.y, a.z * b.z); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + return V3Add(V3Scale(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + return V3Sub(c, V3Scale(a, b)); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return V3Add(V3Mul(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + return V3Sub(c, V3Mul(a, b)); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3VArg normal) +{ + return normal; +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z)); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + return FloatV(a.x * a.x + a.y * a.y + a.z * a.z); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); + const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + const PxF32 length = PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + if(PX_EPS_REAL >= length) + { + return unsafeReturnValue; + } + else + { + const PxF32 lengthInv = 1.0f / length; + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); + } +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); + const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); + return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + return Vec3V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), FALSE_TO_U32); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), TRUE_TO_U32); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), TRUE_TO_U32); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + return Vec3V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; + return t0 >= a.z ? t0 : a.z; +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; + return t0 <= a.z ? t0 : a.z; +} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + return Vec3V((a.x >= 0.f ? 1.f : -1.f), (a.y >= 0.f ? 1.f : -1.f), (a.z >= 0.f ? 1.f : -1.f)); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + return V3Max(a, V3Neg(a)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + return Vec3V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f)); +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + return Vec3V(sinf(a.x), sinf(a.y), sinf(a.z)); +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + return Vec3V(cosf(a.x), cosf(a.y), cosf(a.z)); +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + return Vec3V(a.y, a.z, a.z); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + return Vec3V(a.x, a.y, a.x); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + return Vec3V(a.y, a.z, a.x); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + return Vec3V(a.z, a.x, a.y); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + return Vec3V(a.z, a.z, a.y); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + return Vec3V(a.y, a.x, a.x); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(0.0f, v1.z, v0.y); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(v0.z, 0.0f, v1.x); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + return Vec3V(v1.y, v0.x, 0.0f); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + return FloatV(a.x + a.y + a.z); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + return BOOL_TO_U32(a.x > max.x || a.y > max.y || a.z > max.z || a.x < min.x || a.y < min.y || a.z < min.z); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + return BOOL_TO_U32(a.x <= max.x && a.y <= max.y && a.z <= max.z && a.x >= min.x && a.y >= min.y && a.z >= min.z); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + return V3OutOfBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + return V3InBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + const PxF32 t01 = col0.y, t02 = col0.z, t12 = col1.z; + col0.y = col1.x; + col0.z = col2.x; + col1.z = col2.y; + col1.x = t01; + col2.x = t02; + col2.y = t12; +} + +///////////////////////// +// VEC4V +///////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + return Vec4V(f.x, f.x, f.x, f.x); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + return Vec4V(floatVArray[0].x, floatVArray[1].x, floatVArray[2].x, floatVArray[3].x); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + return Vec4V(x.x, y.x, z.x, w.x); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.w, y.w, z.w, w.w); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.z, y.z, z.z, w.z); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.y, y.y, z.y, w.y); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + return Vec4V(x.x, y.x, z.x, w.x); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return Vec4V(a.x, b.x, a.y, b.y); +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return Vec4V(a.z, b.z, a.w, b.w); +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + return Vec4V(1.0f, 0.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + return Vec4V(0.0f, 1.0f, 0.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + return Vec4V(0.0f, 0.0f, 1.0f, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + return Vec4V(0.0f, 0.0f, 0.0f, 1.0f); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + return FloatV(f.x); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + return FloatV(f.y); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + return FloatV(f.z); +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + return FloatV(f.w); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + return Vec4V(f.x, v.y, v.z, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, f.x, v.z, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, v.y, f.x, v.w); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + return Vec4V(v.x, v.y, v.z, f.x); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec3V v, const FloatV f) +{ + return Vec4V(v.x, v.y, v.z, f.x); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return Vec4V(v.x, v.y, v.z, 0.0f); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v) +{ + return Vec4V(v.y, v.x, v.w, v.z); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v) +{ + return Vec4V(v.x, v.z, v.x, v.z); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v) +{ + return Vec4V(v.y, v.w, v.y, v.w); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v) +{ + return Vec4V(v.y, v.z, v.x, v.w); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V v) +{ + return Vec4V(v.z, v.w, v.x, v.y); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V v) +{ + const PxF32 f[4] = { v.x, v.y, v.z, v.w }; + return Vec4V(f[_x], f[_y], f[_z], f[_w]); +} + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return V4Load(0.0f); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return V4Load(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c) +{ + return Vec4V(-c.x, -c.y, -c.z, -c.w); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return Vec4V(a.x * b.x, a.y * b.x, a.z * b.x, a.w * b.x); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + VECMATHAOS_ASSERT(b.x != 0 && b.y != 0 && b.z != 0 && b.w != 0); + return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + const PxF32 bInv = 1.0f / b.x; + return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return Vec4V(PxSqrt(a.x), PxSqrt(a.y), PxSqrt(a.z), PxSqrt(a.w)); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + return V4Add(V4Scale(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + return V4Sub(c, V4Scale(a, b)); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Add(V4Mul(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Sub(c, V4Mul(a, b)); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ + return FloatV(a.x + a.y + a.z + a.w); +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w); +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) +{ + return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x, 0.0f); +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w)); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); + const FloatV length = FloatV(V4Length(a)); + return V4ScaleInv(a, length); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const FloatV length = FloatV(V4Length(a)); + if(PX_EPS_REAL >= length.x) + { + return unsafeReturnValue; + } + else + { + return V4ScaleInv(a, length); + } +} +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); + const FloatV length = FloatV(V4Length(a)); + return V4ScaleInv(a, length); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return Vec4V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z, c.uw ? a.w : b.w); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), BOOL_TO_U32(a.w > b.w)); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), BOOL_TO_U32(a.w >= b.w)); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), BOOL_TO_U32(a.w == b.w)); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z, a.w > b.w ? a.w : b.w); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return Vec4V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z, a.w < b.w ? a.w : b.w); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; + const PxF32 t1 = (a.z >= a.w) ? a.x : a.w; + return t0 >= t1 ? t0 : t1; +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; + const PxF32 t1 = (a.z <= a.w) ? a.x : a.w; + return t0 <= t1 ? t0 : t1; +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ + return Vec4V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f), floorf(a.w + 0.5f)); +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + return Vec4V(sinf(a.x), sinf(a.y), sinf(a.z), sinf(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + return Vec4V(cosf(a.x), cosf(a.y), cosf(a.z), cosf(a.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z) & (a.w > b.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z) & (a.w >= b.w)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z) & (a.w == b.w)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return BOOL_TO_U32((a.x > b.x) | (a.y > b.y) | (a.z > b.z)); +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + const PxF32 t01 = col0.y, t02 = col0.z, t03 = col0.w; + const PxF32 t12 = col1.z, t13 = col1.w; + const PxF32 t23 = col2.w; + col0.y = col1.x; + col0.z = col2.x; + col0.w = col3.x; + col1.z = col2.y; + col1.w = col3.y; + col2.w = col3.z; + col1.x = t01; + col2.x = t02; + col3.x = t03; + col2.y = t12; + col3.y = t13; + col3.z = t23; +} + +PX_FORCE_INLINE BoolV BFFFF() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFFT() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFTF() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFFTT() +{ + return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTFF() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTFT() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTTF() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BFTTT() +{ + return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFFF() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFFT() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFTF() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTFTT() +{ + return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTFF() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTFT() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTTF() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); +} +PX_FORCE_INLINE BoolV BTTTT() +{ + return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + return BTFFF(); +} +PX_FORCE_INLINE BoolV BYMask() +{ + return BFTFF(); +} +PX_FORCE_INLINE BoolV BZMask() +{ + return BFFTF(); +} +PX_FORCE_INLINE BoolV BWMask() +{ + return BFFFT(); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV a) +{ + return BoolV(a.ux, a.ux, a.ux, a.ux); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV a) +{ + return BoolV(a.uy, a.uy, a.uy, a.uy); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV a) +{ + return BoolV(a.uz, a.uz, a.uz, a.uz); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV a) +{ + return BoolV(a.uw, a.uw, a.uw, a.uw); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return BoolV(f.ux, v.uy, v.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, f.uy, v.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, v.uy, f.uz, v.uw); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return BoolV(v.ux, v.uy, v.uz, f.uw); +} + +template +BoolV BSplatElement(BoolV a) +{ + PxU32* b = reinterpret_cast(&a); + return BoolV(b[index], b[index], b[index], b[index]); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return BoolV(BOOL_TO_U32(a.ux && b.ux), BOOL_TO_U32(a.uy && b.uy), BOOL_TO_U32(a.uz && b.uz), BOOL_TO_U32(a.uw && b.uw)); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + return BoolV(a.ux & ~b.ux, a.uy & ~b.uy, a.uz & ~b.uz, a.uw & ~b.uw); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + return BoolV(~a.ux, ~a.uy, ~a.uz, ~a.uw); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return BoolV(BOOL_TO_U32(a.ux || b.ux), BOOL_TO_U32(a.uy || b.uy), BOOL_TO_U32(a.uz || b.uz), BOOL_TO_U32(a.uw || b.uw)); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw ? 1 : 0); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return BAllEq(a, BTTTT()); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return BAllEq(a, BFFFF()); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + return (a.ux & a.uy & a.uz & a.uw) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + return (a.ux | a.uy | a.uz | a.uw) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + return (a.ux & a.uy & a.uz) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + return (a.ux | a.uy | a.uz) ? BTTTT() : BFFFF(); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + return (a.ux & 1) | (a.uy & 2) | (a.uz & 4) | (a.uw & 8); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const Vec3V x = V3Mul(V3UnitX(), d); + const Vec3V y = V3Mul(V3UnitY(), d); + const Vec3V z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const PxF32 det = a.col0.x * (a.col1.y * a.col2.z - a.col1.z * a.col2.y) - + a.col1.x * (a.col0.y * a.col2.z - a.col2.y * a.col0.z) + + a.col2.x * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); + + const PxF32 invDet = 1.0f / det; + + Mat33V ret; + ret.col0.x = invDet * (a.col1.y * a.col2.z - a.col2.y * a.col1.z); + ret.col0.y = invDet * (a.col2.y * a.col0.z - a.col0.y * a.col2.z); + ret.col0.z = invDet * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); + + ret.col1.x = invDet * (a.col2.x * a.col1.z - a.col1.x * a.col2.z); + ret.col1.y = invDet * (a.col0.x * a.col2.z - a.col2.x * a.col0.z); + ret.col1.z = invDet * (a.col1.x * a.col0.z - a.col0.x * a.col1.z); + + ret.col2.x = invDet * (a.col1.x * a.col2.y - a.col2.x * a.col1.y); + ret.col2.y = invDet * (a.col2.x * a.col0.y - a.col0.x * a.col2.y); + ret.col2.z = invDet * (a.col0.x * a.col1.y - a.col1.x * a.col0.y); + + return ret; +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + PX_ASSERT((size_t(&out) & 15) == 0); + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), + Vec3V(a.col0.z, a.col1.z, a.col2.z)); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x, + a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33V3(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), + Vec3V(a.col0.z, a.col1.z, a.col2.z)); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + return Vec4V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x * b.w, + a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y * b.w, + a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z * b.w, + a.col0.w * b.x + a.col1.w * b.y + a.col2.w * b.z + a.col3.w * b.w); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + return Vec4V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z + a.col0.w * b.w, + a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z + a.col1.w * b.w, + a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z + a.col2.w * b.w, + a.col3.x * b.x + a.col3.y * b.y + a.col3.z * b.z + a.col3.w * b.w); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + PxF32 tmp[12]; + PxF32 dst[16]; + PxF32 det; + + const PxF32 src[16] = { a.col0.x, a.col0.y, a.col0.z, a.col0.w, a.col1.x, a.col1.y, a.col1.z, a.col1.w, + a.col2.x, a.col2.y, a.col2.z, a.col2.w, a.col3.x, a.col3.y, a.col3.z, a.col3.w }; + + tmp[0] = src[10] * src[15]; + tmp[1] = src[11] * src[14]; + tmp[2] = src[9] * src[15]; + tmp[3] = src[11] * src[13]; + tmp[4] = src[9] * src[14]; + tmp[5] = src[10] * src[13]; + tmp[6] = src[8] * src[15]; + tmp[7] = src[11] * src[12]; + tmp[8] = src[8] * src[14]; + tmp[9] = src[10] * src[12]; + tmp[10] = src[8] * src[13]; + tmp[11] = src[9] * src[12]; + + dst[0] = tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]; + dst[0] -= tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]; + dst[1] = tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]; + dst[1] -= tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]; + dst[2] = tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]; + dst[2] -= tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]; + dst[3] = tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]; + dst[3] -= tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]; + dst[4] = tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]; + dst[4] -= tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]; + dst[5] = tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]; + dst[5] -= tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]; + dst[6] = tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]; + dst[6] -= tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]; + dst[7] = tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]; + dst[7] -= tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]; + + tmp[0] = src[2] * src[7]; + tmp[1] = src[3] * src[6]; + tmp[2] = src[1] * src[7]; + tmp[3] = src[3] * src[5]; + tmp[4] = src[1] * src[6]; + tmp[5] = src[2] * src[5]; + tmp[6] = src[0] * src[7]; + tmp[7] = src[3] * src[4]; + tmp[8] = src[0] * src[6]; + tmp[9] = src[2] * src[4]; + tmp[10] = src[0] * src[5]; + tmp[11] = src[1] * src[4]; + + dst[8] = tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]; + dst[8] -= tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]; + dst[9] = tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]; + dst[9] -= tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]; + dst[10] = tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]; + dst[10] -= tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]; + dst[11] = tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]; + dst[11] -= tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]; + dst[12] = tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]; + dst[12] -= tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]; + dst[13] = tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]; + dst[13] -= tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]; + dst[14] = tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]; + dst[14] -= tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]; + dst[15] = tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]; + dst[15] -= tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]; + + det = src[0] * dst[0] + src[1] * dst[1] + src[2] * dst[2] + src[3] * dst[3]; + + det = 1.0f / det; + for(PxU32 j = 0; j < 16; j++) + { + dst[j] *= det; + } + + return Mat44V(Vec4V(dst[0], dst[4], dst[8], dst[12]), Vec4V(dst[1], dst[5], dst[9], dst[13]), + Vec4V(dst[2], dst[6], dst[10], dst[14]), Vec4V(dst[3], dst[7], dst[11], dst[15])); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + return Mat44V(Vec4V(a.col0.x, a.col1.x, a.col2.x, a.col3.x), Vec4V(a.col0.y, a.col1.y, a.col2.y, a.col3.y), + Vec4V(a.col0.z, a.col1.z, a.col2.z, a.col3.z), Vec4V(a.col0.w, a.col1.w, a.col2.w, a.col3.w)); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + return Vec4V(x, y, z, w); +} + +/* +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + return VecU16V( + PxU16(PxClamp((a).u32[0], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[1], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[2], 0, 0xFFFF)), + PxU16(PxClamp((a).u32[3], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[0], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[1], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[2], 0, 0xFFFF)), + PxU16(PxClamp((b).u32[3], 0, 0xFFFF))); +} +*/ + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return VecU32V(c.ux ? a.u32[0] : b.u32[0], c.uy ? a.u32[1] : b.u32[1], c.uz ? a.u32[2] : b.u32[2], + c.uw ? a.u32[3] : b.u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] | (b).u32[0], (a).u32[1] | (b).u32[1], (a).u32[2] | (b).u32[2], (a).u32[3] | (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] ^ (b).u32[0], (a).u32[1] ^ (b).u32[1], (a).u32[2] ^ (b).u32[2], (a).u32[3] ^ (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] & (b).u32[0], (a).u32[1] & (b).u32[1], (a).u32[2] & (b).u32[2], (a).u32[3] & (b).u32[3]); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + return VecU32V((a).u32[0] & ~(b).u32[0], (a).u32[1] & ~(b).u32[1], (a).u32[2] & ~(b).u32[2], + (a).u32[3] & ~(b).u32[3]); +} + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]|(b).u16[0], (a).u16[1]|(b).u16[1], (a).u16[2]|(b).u16[2], (a).u16[3]|(b).u16[3], + (a).u16[4]|(b).u16[4], (a).u16[5]|(b).u16[5], (a).u16[6]|(b).u16[6], (a).u16[7]|(b).u16[7]); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]&(b).u16[0], (a).u16[1]&(b).u16[1], (a).u16[2]&(b).u16[2], (a).u16[3]&(b).u16[3], + (a).u16[4]&(b).u16[4], (a).u16[5]&(b).u16[5], (a).u16[6]&(b).u16[6], (a).u16[7]&(b).u16[7]); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return VecU16V( + (a).u16[0]&~(b).u16[0], (a).u16[1]&~(b).u16[1], (a).u16[2]&~(b).u16[2], (a).u16[3]&~(b).u16[3], + (a).u16[4]&~(b).u16[4], (a).u16[5]&~(b).u16[5], (a).u16[6]&~(b).u16[6], (a).u16[7]&~(b).u16[7]); +} +*/ + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + return VecI32V(a, a, a, a); +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + return VecU32V(a, a, a, a); +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + *address = val; +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + VecU32V r = V4U32Andc(*reinterpret_cast(&a), b); + return (*reinterpret_cast(&r)); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return VecU32V(a.x > b.x ? 0xFFFFffff : 0, a.y > b.y ? 0xFFFFffff : 0, a.z > b.z ? 0xFFFFffff : 0, + a.w > b.w ? 0xFFFFffff : 0); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + return VecU16V + ( + BOOL_TO_U16(a.u16[0] > b.u16[0]), BOOL_TO_U16(a.u16[1] > b.u16[1]), BOOL_TO_U16(a.u16[2] > b.u16[2]), BOOL_TO_U16(a.u16[3] > b.u16[3]), + BOOL_TO_U16(a.u16[4] > b.u16[4]), BOOL_TO_U16(a.u16[5] > b.u16[5]), BOOL_TO_U16(a.u16[6] > b.u16[6]), BOOL_TO_U16(a.u16[7] > b.u16[7]) + ); +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) +{ + return VecU16V + ( + BOOL_TO_U16(a.i16[0] > b.i16[0]), BOOL_TO_U16(a.i16[1] > b.i16[1]), BOOL_TO_U16(a.i16[2] > b.i16[2]), BOOL_TO_U16(a.i16[3] > b.i16[3]), + BOOL_TO_U16(a.i16[4] > b.i16[4]), BOOL_TO_U16(a.i16[5] > b.i16[5]), BOOL_TO_U16(a.i16[6] > b.i16[6]), BOOL_TO_U16(a.i16[7] > b.i16[7]) + ); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + return Vec4V(PxF32((a).u32[0]), PxF32((a).u32[1]), PxF32((a).u32[2]), PxF32((a).u32[3])); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return Vec4V(PxF32((a).i32[0]), PxF32((a).i32[1]), PxF32((a).i32[2]), PxF32((a).i32[3])); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return VecI32V(PxI32(data[0]), PxI32(data[1]), PxI32(data[2]), PxI32(data[3])); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + Vec4V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + Vec4V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + VecU32V b = *reinterpret_cast(&a); + return b; +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + VecI32V b = *reinterpret_cast(&a); + return b; +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + return VecU32V((a).u32[index], (a).u32[index], (a).u32[index], (a).u32[index]); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(BoolV a) +{ + const PxU32 u = (&a.ux)[index]; + return VecU32V(u, u, u, u); +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return Vec4V(data[index], data[index], data[index], data[index]); +} + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + return VecU32V(x, y, z, w); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return V4Max(a, V4Neg(a)); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return BoolV(BOOL_TO_U32(a.u32[0] == b.u32[0]), BOOL_TO_U32(a.u32[1] == b.u32[1]), BOOL_TO_U32(a.u32[2] == b.u32[2]), BOOL_TO_U32(a.u32[3] == b.u32[3])); +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return VecU32V(i, i, i, i); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return VecU32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + return VecU32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return VecI32V(x, y, z, w); +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return VecI32V(i, i, i, i); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return VecI32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + return VecI32V(i[0], i[1], i[2], i[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] + b.i32[0], a.i32[1] + b.i32[1], a.i32[2] + b.i32[2], a.i32[3] + b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] - b.i32[0], a.i32[1] - b.i32[1], a.i32[2] - b.i32[2], a.i32[3] - b.i32[3]); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return BoolV(BOOL_TO_U32(a.i32[0] > b.i32[0]), BOOL_TO_U32(a.i32[1] > b.i32[1]), BOOL_TO_U32(a.i32[2] > b.i32[2]), BOOL_TO_U32(a.i32[3] > b.i32[3])); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return BoolV(BOOL_TO_U32(a.i32[0] == b.i32[0]), BOOL_TO_U32(a.i32[1] == b.i32[1]), BOOL_TO_U32(a.i32[2] == b.i32[2]), BOOL_TO_U32(a.i32[3] == b.i32[3])); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], + c.uw ? a.i32[3] : b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return VecI32V(0, 0, 0, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return VecI32V(1, 1, 1, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return VecI32V(2, 2, 2, 2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return VecI32V(-1, -1, -1, -1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return VecU32V(0, 0, 0, 0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return VecU32V(1, 1, 1, 1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return VecU32V(2, 2, 2, 2); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + return shift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return VecI32V(a.i32[0] << count.i32[0], a.i32[1] << count.i32[1], a.i32[2] << count.i32[2], a.i32[3] + << count.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return VecI32V(a.i32[0] >> count.i32[0], a.i32[1] >> count.i32[1], a.i32[2] >> count.i32[2], + a.i32[3] >> count.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return VecI32V(a.i32[0] << count, a.i32[1] << count, a.i32[2] << count, a.i32[3] << count); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return VecI32V(a.i32[0] >> count, a.i32[1] >> count, a.i32[2] >> count, a.i32[3] >> count); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] & b.i32[0], a.i32[1] & b.i32[1], a.i32[2] & b.i32[2], a.i32[3] & b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(a.i32[0] | b.i32[0], a.i32[1] | b.i32[1], a.i32[2] | b.i32[2], a.i32[3] | b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return VecI32V(a.i32[0], a.i32[0], a.i32[0], a.i32[0]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return VecI32V(a.i32[1], a.i32[1], a.i32[1], a.i32[1]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return VecI32V(a.i32[2], a.i32[2], a.i32[2], a.i32[2]); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return VecI32V(a.i32[3], a.i32[3], a.i32[3], a.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], + c.uw ? a.i32[3] : b.i32[3]); +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + return VecI32V(a.i32[0], b.i32[0], c.i32[0], d.i32[0]); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + *i = a.i32[0]; +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b) +{ + return VecI32V(PxI32(b.ux), PxI32(b.uy), PxI32(b.uz), PxI32(b.uw)); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b) +{ + return VecU32V(b.ux, b.uy, b.uz, b.uw); +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); +} + + +// not used + +/* +PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return *addr; +} +*/ + +/* +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return *addr; +} +*/ + +/* +PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V a) +{ + return Vec4V(PxCeil(a.x), PxCeil(a.y), PxCeil(a.z), PxCeil(a.w)); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V a) +{ + return Vec4V(PxFloor(a.x), PxFloor(a.y), PxFloor(a.z), PxFloor(a.w)); +} +*/ + +/* +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); + return VecU32V( + PxU32(PxClamp((a).x, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).y, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).z, 0.0f, ffffFFFFasFloat)), + PxU32(PxClamp((a).w, 0.0f, ffffFFFFasFloat))); +} +*/ + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathSSE.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathSSE.h new file mode 100644 index 0000000..0b0aaa9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecMathSSE.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_MATH_SSE_H +#define PX_VEC_MATH_SSE_H + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +namespace +{ + const PX_ALIGN(16, PxF32) minus1w[4] = { 0.0f, 0.0f, 0.0f, -1.0f }; +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const __m128 q2 = V4Add(q, q); + const __m128 qw2 = V4MulAdd(q2, V4GetW(q), _mm_load_ps(minus1w)); // (2wx, 2wy, 2wz, 2ww-1) + const __m128 nw2 = Vec3V_From_Vec4V(V4Neg(qw2)); // (-2wx, -2wy, -2wz, 0) + const __m128 v = Vec3V_From_Vec4V(q); + + const __m128 a0 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 1, 2, 3)); // (2ww-1, 2wz, -2wy, 0) + column0 = V4MulAdd(v, V4GetX(q2), a0); + + const __m128 a1 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 2, 0, 3)); // (2ww-1, 2wx, -2wz, 0) + column1 = V4MulAdd(v, V4GetY(q2), _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 1, 0, 2))); + + const __m128 a2 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 0, 1, 3)); // (2ww-1, 2wy, -2wx, 0) + column2 = V4MulAdd(v, V4GetZ(q2), _mm_shuffle_ps(a2, a2, _MM_SHUFFLE(3, 0, 2, 1))); +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecQuat.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecQuat.h new file mode 100644 index 0000000..4016fda --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecQuat.h @@ -0,0 +1,473 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_QUAT_H +#define PX_VEC_QUAT_H + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +#ifndef PX_PIDIV2 +#define PX_PIDIV2 1.570796327f +#endif + +////////////////////////////////// +// QuatV +////////////////////////////////// +PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w) +{ + return V4LoadXYZW(x, y, z, w); +} + +PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v) +{ + return V4LoadU(v); +} + +PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v) +{ + return V4LoadA(v); +} + +PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a) +{ + // q = cos(a/2) + u*sin(a/2) + const FloatV half = FLoad(0.5f); + const FloatV hangle = FMul(a, half); + const FloatV piByTwo(FLoad(PX_PIDIV2)); + const FloatV PiByTwoMinHangle(FSub(piByTwo, hangle)); + const Vec4V hangle2(Vec4V_From_Vec3V(V3Merge(hangle, PiByTwoMinHangle, hangle))); + + /*const FloatV sina = FSin(hangle); + const FloatV cosa = FCos(hangle);*/ + + const Vec4V _sina = V4Sin(hangle2); + const FloatV sina = V4GetX(_sina); + const FloatV cosa = V4GetY(_sina); + + const Vec3V v = V3Scale(u, sina); + // return V4Sel(BTTTF(), Vec4V_From_Vec3V(v), V4Splat(cosa)); + return V4SetW(Vec4V_From_Vec3V(v), cosa); +} + +// Normalize +PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q) +{ + return V4Normalize(q); +} + +PX_FORCE_INLINE FloatV QuatLength(const QuatV q) +{ + return V4Length(q); +} + +PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q) +{ + return V4LengthSq(q); +} + +PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b) // convert this PxQuat to a unit quaternion +{ + return V4Dot(a, b); +} + +PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q) +{ + return V4SetW(V4Neg(q), V4GetW(q)); +} + +PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q) +{ + return Vec3V_From_Vec4V(q); +} + +/** brief computes rotation of x-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q) +{ + /*const PxF32 x2 = x*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (w * w2) - 1.0f + x*x2, + (z * w2) + y*x2, + (-y * w2) + z*x2);*/ + + const FloatV two = FLoad(2.f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV x2 = FMul(V3GetX(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, x2); + const Vec3V tmp = V3Merge(w, V3GetZ(u), FNeg(V3GetY(u))); + // const Vec3V b = V3Scale(tmp, w2); + // const Vec3V ab = V3Add(a, b); + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetX(ab, FSub(V3GetX(ab), FOne())); +} + +/** brief computes rotation of y-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q) +{ + /*const PxF32 y2 = y*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (-z * w2) + x*y2, + (w * w2) - 1.0f + y*y2, + (x * w2) + z*y2);*/ + + const FloatV two = FLoad(2.f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV y2 = FMul(V3GetY(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, y2); + const Vec3V tmp = V3Merge(FNeg(V3GetZ(u)), w, V3GetX(u)); + // const Vec3V b = V3Scale(tmp, w2); + // const Vec3V ab = V3Add(a, b); + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetY(ab, FSub(V3GetY(ab), FOne())); +} + +/** brief computes rotation of z-axis */ +PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q) +{ + /*const PxF32 z2 = z*2.0f; + const PxF32 w2 = w*2.0f; + return PxVec3( (y * w2) + x*z2, + (-x * w2) + y*z2, + (w * w2) - 1.0f + z*z2);*/ + + const FloatV two = FLoad(2.f); + const FloatV w = V4GetW(q); + const Vec3V u = Vec3V_From_Vec4V(q); + + const FloatV z2 = FMul(V3GetZ(u), two); + const FloatV w2 = FMul(w, two); + + const Vec3V a = V3Scale(u, z2); + const Vec3V tmp = V3Merge(V3GetY(u), FNeg(V3GetX(u)), w); + /*const Vec3V b = V3Scale(tmp, w2); + const Vec3V ab = V3Add(a, b);*/ + const Vec3V ab = V3ScaleAdd(tmp, w2, a); + return V3SetZ(ab, FSub(V3GetZ(ab), FOne())); +} + +PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v) +{ + /* + const PxVec3 qv(x,y,z); + return (v*(w*w-0.5f) + (qv.cross(v))*w + qv*(qv.dot(v)))*2; + */ + + const FloatV two = FLoad(2.f); + // const FloatV half = FloatV_From_F32(0.5f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + // const FloatV w2 = FSub(FMul(w, w), half); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + // const Vec3V b = V3Scale(V3Cross(u, v), w); + // const Vec3V c = V3Scale(u, V3Dot(u, v)); + // return V3Scale(V3Add(V3Add(a, b), c), two); + const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); + return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); +} + +PX_FORCE_INLINE Vec3V QuatTransform(const QuatV q, const Vec3V p, const Vec3V v) +{ + // p + q.rotate(v) + const FloatV two = FLoad(2.f); + // const FloatV half = FloatV_From_F32(0.5f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + // const FloatV w2 = FSub(FMul(w, w), half); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + /*const Vec3V b = V3Scale(V3Cross(u, v), w); + const Vec3V c = V3Scale(u, V3Dot(u, v)); + return V3ScaleAdd(V3Add(V3Add(a, b), c), two, p);*/ + const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); + const Vec3V z = V3ScaleAdd(u, V3Dot(u, v), temp); + return V3ScaleAdd(z, two, p); +} + +PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v) +{ + + // const PxVec3 qv(x,y,z); + // return (v*(w*w-0.5f) - (qv.cross(v))*w + qv*(qv.dot(v)))*2; + + const FloatV two = FLoad(2.f); + const FloatV nhalf = FLoad(-0.5f); + const Vec3V u = Vec3V_From_Vec4V(q); + const FloatV w = V4GetW(q); + const FloatV w2 = FScaleAdd(w, w, nhalf); + const Vec3V a = V3Scale(v, w2); + /*const Vec3V b = V3Scale(V3Cross(u, v), w); + const Vec3V c = V3Scale(u, V3Dot(u, v)); + return V3Scale(V3Add(V3Sub(a, b), c), two);*/ + const Vec3V temp = V3NegScaleSub(V3Cross(u, v), w, a); + return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); +} + +PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b) +{ + const Vec3V imagA = Vec3V_From_Vec4V(a); + const Vec3V imagB = Vec3V_From_Vec4V(b); + const FloatV rA = V4GetW(a); + const FloatV rB = V4GetW(b); + + const FloatV real = FSub(FMul(rA, rB), V3Dot(imagA, imagB)); + const Vec3V v0 = V3Scale(imagA, rB); + const Vec3V v1 = V3Scale(imagB, rA); + const Vec3V v2 = V3Cross(imagA, imagB); + const Vec3V imag = V3Add(V3Add(v0, v1), v2); + + return V4SetW(Vec4V_From_Vec3V(imag), real); +} + +PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b) +{ + return V4Add(a, b); +} + +PX_FORCE_INLINE QuatV QuatNeg(const QuatV q) +{ + return V4Neg(q); +} + +PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b) +{ + return V4Sub(a, b); +} + +PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b) +{ + return V4Scale(a, b); +} + +PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const floatVArray) +{ + return V4Merge(floatVArray); +} + +PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + return V4Merge(x, y, z, w); +} + +PX_FORCE_INLINE QuatV QuatIdentity() +{ + return V4SetW(V4Zero(), FOne()); +} + +PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q) +{ + return isFiniteVec4V(q); +} + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance +#endif + +PX_FORCE_INLINE bool isValidQuatV(const QuatV q) +{ + const FloatV unitTolerance = FLoad(1e-4f); + const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); + const BoolV con = FIsGrtr(unitTolerance, tmp); + return isFiniteVec4V(q) && (BAllEqTTTT(con) == 1); +} + +PX_FORCE_INLINE bool isSaneQuatV(const QuatV q) +{ + const FloatV unitTolerance = FLoad(1e-2f); + const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); + const BoolV con = FIsGrtr(unitTolerance, tmp); + return isFiniteVec4V(q) && (BAllEqTTTT(con) == 1); +} + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q) +{ + // const FloatV two = FloatV_From_F32(2.f); + // const FloatV one = FOne(); + + // const FloatV x = V4GetX(q); + // const FloatV y = V4GetY(q); + // const FloatV z = V4GetZ(q); + // const Vec4V _q = V4Mul(q, two); + // + ////const FloatV w = V4GetW(q); + + // const Vec4V t0 = V4Mul(_q, x); // 2xx, 2xy, 2xz, 2xw + // const Vec4V t1 = V4Mul(_q, y); // 2xy, 2yy, 2yz, 2yw + // const Vec4V t2 = V4Mul(_q, z); // 2xz, 2yz, 2zz, 2zw + ////const Vec4V t3 = V4Mul(_q, w); // 2xw, 2yw, 2zw, 2ww + + // const FloatV xx2 = V4GetX(t0); + // const FloatV xy2 = V4GetY(t0); + // const FloatV xz2 = V4GetZ(t0); + // const FloatV xw2 = V4GetW(t0); + + // const FloatV yy2 = V4GetY(t1); + // const FloatV yz2 = V4GetZ(t1); + // const FloatV yw2 = V4GetW(t1); + + // const FloatV zz2 = V4GetZ(t2); + // const FloatV zw2 = V4GetW(t2); + + ////const FloatV ww2 = V4GetW(t3); + + // const FloatV c00 = FSub(one, FAdd(yy2, zz2)); + // const FloatV c01 = FSub(xy2, zw2); + // const FloatV c02 = FAdd(xz2, yw2); + + // const FloatV c10 = FAdd(xy2, zw2); + // const FloatV c11 = FSub(one, FAdd(xx2, zz2)); + // const FloatV c12 = FSub(yz2, xw2); + + // const FloatV c20 = FSub(xz2, yw2); + // const FloatV c21 = FAdd(yz2, xw2); + // const FloatV c22 = FSub(one, FAdd(xx2, yy2)); + + // const Vec3V c0 = V3Merge(c00, c10, c20); + // const Vec3V c1 = V3Merge(c01, c11, c21); + // const Vec3V c2 = V3Merge(c02, c12, c22); + + // return Mat33V(c0, c1, c2); + + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + const Vec3V column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + const Vec3V column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + const Vec3V column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); + return Mat33V(column0, column1, column2); +} + +PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a) +{ + const FloatV one = FOne(); + const FloatV zero = FZero(); + const FloatV half = FLoad(0.5f); + const FloatV two = FLoad(2.f); + const FloatV scale = FLoad(0.25f); + const FloatV a00 = V3GetX(a.col0); + const FloatV a11 = V3GetY(a.col1); + const FloatV a22 = V3GetZ(a.col2); + + const FloatV a21 = V3GetZ(a.col1); // row=2, col=1; + const FloatV a12 = V3GetY(a.col2); // row=1, col=2; + const FloatV a02 = V3GetX(a.col2); // row=0, col=2; + const FloatV a20 = V3GetZ(a.col0); // row=2, col=0; + const FloatV a10 = V3GetY(a.col0); // row=1, col=0; + const FloatV a01 = V3GetX(a.col1); // row=0, col=1; + + const Vec3V vec0 = V3Merge(a21, a02, a10); + const Vec3V vec1 = V3Merge(a12, a20, a01); + const Vec3V v = V3Sub(vec0, vec1); + const Vec3V g = V3Add(vec0, vec1); + + const FloatV trace = FAdd(a00, FAdd(a11, a22)); + + if(FAllGrtrOrEq(trace, zero)) + { + const FloatV h = FSqrt(FAdd(trace, one)); + const FloatV w = FMul(half, h); + const FloatV s = FMul(half, FRecip(h)); + const Vec3V u = V3Scale(v, s); + return V4SetW(Vec4V_From_Vec3V(u), w); + } + else + { + const FloatV ntrace = FNeg(trace); + const Vec3V d = V3Merge(a00, a11, a22); + const BoolV con0 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a00), d)); + const BoolV con1 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a11), d)); + + const FloatV t0 = FAdd(one, FScaleAdd(a00, two, ntrace)); + const FloatV t1 = FAdd(one, FScaleAdd(a11, two, ntrace)); + const FloatV t2 = FAdd(one, FScaleAdd(a22, two, ntrace)); + + const FloatV t = FSel(con0, t0, FSel(con1, t1, t2)); + + const FloatV h = FMul(two, FSqrt(t)); + const FloatV s = FRecip(h); + const FloatV g0 = FMul(scale, h); + const Vec3V vs = V3Scale(v, s); + const Vec3V gs = V3Scale(g, s); + const FloatV gsx = V3GetX(gs); + const FloatV gsy = V3GetY(gs); + const FloatV gsz = V3GetZ(gs); + // vs.x= (a21 - a12)*s; vs.y=(a02 - a20)*s; vs.z=(a10 - a01)*s; + // gs.x= (a21 + a12)*s; gs.y=(a02 + a20)*s; gs.z=(a10 + a01)*s; + const Vec4V v0 = V4Merge(g0, gsz, gsy, V3GetX(vs)); + const Vec4V v1 = V4Merge(gsz, g0, gsx, V3GetY(vs)); + const Vec4V v2 = V4Merge(gsy, gsx, g0, V3GetZ(vs)); + return V4Sel(con0, v0, V4Sel(con1, v1, v2)); + } +} + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecTransform.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecTransform.h new file mode 100644 index 0000000..7bcf9d1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/PxVecTransform.h @@ -0,0 +1,288 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEC_TRANSFORM_H +#define PX_VEC_TRANSFORM_H + +#include "foundation/PxVecMath.h" +#include "foundation/PxTransform.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +class PxTransformV +{ + public: + QuatV q; + Vec3V p; + + PX_FORCE_INLINE PxTransformV(const PxTransform& orientation) + { + // const PxQuat oq = orientation.q; + // const PxF32 f[4] = {oq.x, oq.y, oq.z, oq.w}; + q = QuatVLoadXYZW(orientation.q.x, orientation.q.y, orientation.q.z, orientation.q.w); + // q = QuatV_From_F32Array(&oq.x); + p = V3LoadU(orientation.p); + } + + PX_FORCE_INLINE PxTransformV(const Vec3VArg p0 = V3Zero(), const QuatVArg q0 = QuatIdentity()) : q(q0), p(p0) + { + PX_ASSERT(isSaneQuatV(q0)); + } + + PX_FORCE_INLINE PxTransformV operator*(const PxTransformV& x) const + { + PX_ASSERT(x.isSane()); + return transform(x); + } + + PX_FORCE_INLINE PxTransformV getInverse() const + { + PX_ASSERT(isFinite()); + // return PxTransform(q.rotateInv(-p),q.getConjugate()); + return PxTransformV(QuatRotateInv(q, V3Neg(p)), QuatConjugate(q)); + } + + PX_FORCE_INLINE void normalize() + { + p = V3Zero(); + q = QuatIdentity(); + } + + PX_FORCE_INLINE void Invalidate() + { + p = V3Splat(FMax()); + q = QuatIdentity(); + } + + PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotate(input) + p; + return QuatTransform(q, p, input); + } + + PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotateInv(input-p); + return QuatRotateInv(q, V3Sub(input, p)); + } + + PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotate(input); + return QuatRotate(q, input); + } + + PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const + { + PX_ASSERT(isFinite()); + // return q.rotateInv(input); + return QuatRotateInv(q, input); + } + + //! Transform transform to parent (returns compound transform: first src, then *this) + PX_FORCE_INLINE PxTransformV transform(const PxTransformV& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isSane()); + // src = [srct, srcr] -> [r*srct + t, r*srcr] + // return PxTransform(q.rotate(src.p) + p, q*src.q); + return PxTransformV(V3Add(QuatRotate(q, src.p), p), QuatMul(q, src.q)); + } + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical" // bitwise intentionally chosen for performance +#endif + + /** + \brief returns true if finite and q is a unit quaternion + */ + PX_FORCE_INLINE bool isValid() const + { + return isFiniteVec3V(p) && isFiniteQuatV(q) && isValidQuatV(q); + } + + /** + \brief returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error + vs isValid + */ + + PX_FORCE_INLINE bool isSane() const + { + return isFinite() && isSaneQuatV(q); + } + + /** + \brief returns true if all elems are finite (not NAN or INF, etc.) + */ + PX_FORCE_INLINE bool isFinite() const + { + return isFiniteVec3V(p) && isFiniteQuatV(q); + } + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + + //! Transform transform from parent (returns compound transform: first src, then this->inverse) + PX_FORCE_INLINE PxTransformV transformInv(const PxTransformV& src) const + { + PX_ASSERT(src.isSane()); + PX_ASSERT(isFinite()); + // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] + /*PxQuat qinv = q.getConjugate(); + return PxTransform(qinv.rotate(src.p - p), qinv*src.q);*/ + const QuatV qinv = QuatConjugate(q); + const Vec3V v = QuatRotate(qinv, V3Sub(src.p, p)); + const QuatV rot = QuatMul(qinv, src.q); + return PxTransformV(v, rot); + } + + static PX_FORCE_INLINE PxTransformV createIdentity() + { + return PxTransformV(V3Zero()); + } +}; + +PX_FORCE_INLINE PxTransformV loadTransformA(const PxTransform& transform) +{ + const QuatV q0 = QuatVLoadA(&transform.q.x); + const Vec3V p0 = V3LoadA(&transform.p.x); + + return PxTransformV(p0, q0); +} + +PX_FORCE_INLINE PxTransformV loadTransformU(const PxTransform& transform) +{ + const QuatV q0 = QuatVLoadU(&transform.q.x); + const Vec3V p0 = V3LoadU(&transform.p.x); + + return PxTransformV(p0, q0); +} + +class PxMatTransformV +{ + public: + Mat33V rot; + Vec3V p; + + PX_FORCE_INLINE PxMatTransformV() + { + p = V3Zero(); + rot = M33Identity(); + } + PX_FORCE_INLINE PxMatTransformV(const Vec3VArg _p, const Mat33V& _rot) + { + p = _p; + rot = _rot; + } + + PX_FORCE_INLINE PxMatTransformV(const PxTransformV& other) + { + p = other.p; + QuatGetMat33V(other.q, rot.col0, rot.col1, rot.col2); + } + + PX_FORCE_INLINE PxMatTransformV(const Vec3VArg _p, const QuatV& quat) + { + p = _p; + QuatGetMat33V(quat, rot.col0, rot.col1, rot.col2); + } + + PX_FORCE_INLINE Vec3V getCol0() const + { + return rot.col0; + } + + PX_FORCE_INLINE Vec3V getCol1() const + { + return rot.col1; + } + + PX_FORCE_INLINE Vec3V getCol2() const + { + return rot.col2; + } + + PX_FORCE_INLINE void setCol0(const Vec3VArg col0) + { + rot.col0 = col0; + } + + PX_FORCE_INLINE void setCol1(const Vec3VArg col1) + { + rot.col1 = col1; + } + + PX_FORCE_INLINE void setCol2(const Vec3VArg col2) + { + rot.col2 = col2; + } + + PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const + { + return V3Add(p, M33MulV3(rot, input)); + } + + PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const + { + return M33TrnspsMulV3(rot, V3Sub(input, p)); // QuatRotateInv(q, V3Sub(input, p)); + } + + PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const + { + return M33MulV3(rot, input); + } + + PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const + { + return M33TrnspsMulV3(rot, input); + } + + PX_FORCE_INLINE PxMatTransformV transformInv(const PxMatTransformV& src) const + { + + const Vec3V v = M33TrnspsMulV3(rot, V3Sub(src.p, p)); + const Mat33V mat = M33MulM33(M33Trnsps(rot), src.rot); + return PxMatTransformV(v, mat); + } +}; +} +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixAoS.h new file mode 100644 index 0000000..530cc95 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixAoS.h @@ -0,0 +1,46 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXAOS_H +#define PXFOUNDATION_PXUNIXAOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if PX_INTEL_FAMILY +#include "foundation/unix/sse2/PxUnixSse2AoS.h" +#elif PX_NEON +#include "foundation/unix/neon/PxUnixNeonAoS.h" +#else +#error No SIMD implementation for this unix platform. +#endif + +#endif // PXFOUNDATION_PXUNIXAOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixFPU.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixFPU.h new file mode 100644 index 0000000..19ae126 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixFPU.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXFPU_H +#define PXFOUNDATION_PXUNIXFPU_H + +#include "foundation/PxPreprocessor.h" + +#if PX_LINUX || PX_OSX + +#if PX_X86 || PX_X64 +#if PX_EMSCRIPTEN +#include +#endif +#include +#elif PX_NEON +#include +#endif + +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool enable) +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + : mEnabled(enable) +#endif +{ +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + if(enable) + { + mControlWord = _mm_getcsr(); + // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) + _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); + } + else + { + PX_UNUSED(enable); + PX_ASSERT(_mm_getcsr() & _MM_FLUSH_ZERO_ON); + PX_ASSERT(_mm_getcsr() & (1 << 6)); + PX_ASSERT(_mm_getcsr() & _MM_MASK_MASK); + } +#endif +} + +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +#if !PX_EMSCRIPTEN && (PX_X86 || PX_X64) + if(mEnabled) + { + // restore control word and clear exception flags + // (setting exception state flags cause exceptions on the first following fp operation) + _mm_setcsr(mControlWord & PxU32(~_MM_EXCEPT_MASK)); + } +#endif +} + +#else + #error No SIMD implementation for this unix platform. +#endif // PX_LINUX || PX_OSX + +#endif // #ifndef PXFOUNDATION_PXUNIXFPU_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixInlineAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixInlineAoS.h new file mode 100644 index 0000000..e257d17 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixInlineAoS.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXINLINEAOS_H +#define PXFOUNDATION_PXUNIXINLINEAOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if PX_INTEL_FAMILY +#include "foundation/unix/sse2/PxUnixSse2InlineAoS.h" +#elif PX_NEON +#include "foundation/unix/neon/PxUnixNeonInlineAoS.h" +#else +#error No SIMD implementation for this unix platform. +#endif + +#endif // PXFOUNDATION_PXUNIXINLINEAOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixIntrinsics.h new file mode 100644 index 0000000..4d38089 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixIntrinsics.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PSFOUNDATION_PSUNIXINTRINSICS_H +#define PSFOUNDATION_PSUNIXINTRINSICS_H + +#include "foundation/PxAssert.h" +#include + +// this file is for internal intrinsics - that is, intrinsics that are used in +// cross platform code but do not appear in the API + +#if !(PX_LINUX || PX_APPLE_FAMILY) +#error "This file should only be included by unix builds!!" +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +PX_FORCE_INLINE void PxMemoryBarrier() +{ + __sync_synchronize(); +} + +/*! +Return the index of the highest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v) +{ + + return uint32_t(31 - __builtin_clz(v)); +} + +/*! +Return the index of the highest set bit. Undefined for zero arg. +*/ +PX_INLINE uint32_t PxLowestSetBitUnsafe(uint32_t v) +{ + return uint32_t(__builtin_ctz(v)); +} + +/*! +Returns the index of the highest set bit. Returns 32 for v=0. +*/ +PX_INLINE uint32_t PxCountLeadingZeros(uint32_t v) +{ + if(v) + return uint32_t(__builtin_clz(v)); + else + return 32u; +} + +/*! +Prefetch aligned 64B x86, 32b ARM around \c ptr+offset. +*/ +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ + __builtin_prefetch(reinterpret_cast(ptr) + offset, 0, 3); +} + +/*! +Prefetch \c count bytes starting at \c ptr. +*/ +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = reinterpret_cast(ptr); + uint64_t p = size_t(ptr); + uint64_t startLine = p >> 6, endLine = (p + count - 1) >> 6; + uint64_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 64; + } while(--lines); +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // #ifndef PSFOUNDATION_PSUNIXINTRINSICS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixMathIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixMathIntrinsics.h new file mode 100644 index 0000000..f866276 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixMathIntrinsics.h @@ -0,0 +1,180 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXINTRINSICS_H +#define PXFOUNDATION_PXUNIXINTRINSICS_H + +#include "foundation/Px.h" +#include "foundation/PxAssert.h" + +#if !(PX_LINUX || PX_APPLE_FAMILY) +#error "This file should only be included by Unix builds!!" +#endif + +#if PX_LINUX && !defined(__CUDACC__) && !PX_EMSCRIPTEN + // Linux and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable + #include + #ifndef isfinite + using std::isfinite; + #endif +#endif + +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +namespace intrinsics +{ +//! \brief platform-specific absolute value +PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a) +{ + return ::fabsf(a); +} + +//! \brief platform-specific select float +PX_CUDA_CALLABLE PX_FORCE_INLINE float fsel(float a, float b, float c) +{ + return (a >= 0.0f) ? b : c; +} + +//! \brief platform-specific sign +PX_CUDA_CALLABLE PX_FORCE_INLINE float sign(float a) +{ + return (a >= 0.0f) ? 1.0f : -1.0f; +} + +//! \brief platform-specific reciprocal +PX_CUDA_CALLABLE PX_FORCE_INLINE float recip(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific reciprocal estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float sqrt(float a) +{ + return ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrt(float a) +{ + return 1.0f / ::sqrtf(a); +} + +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific sine +PX_CUDA_CALLABLE PX_FORCE_INLINE float sin(float a) +{ + return ::sinf(a); +} + +//! \brief platform-specific cosine +PX_CUDA_CALLABLE PX_FORCE_INLINE float cos(float a) +{ + return ::cosf(a); +} + +//! \brief platform-specific minimum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMin(float a, float b) +{ + return a < b ? a : b; +} + +//! \brief platform-specific maximum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b) +{ + return a > b ? a : b; +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a) +{ + //std::isfinite not recommended as of Feb 2017, since it doesn't work with g++/clang's floating point optimization. + union localU { PxU32 i; float f; } floatUnion; + floatUnion.f = a; + return !((floatUnion.i & 0x7fffffff) >= 0x7f800000); +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(double a) +{ + return !!isfinite(a); +} + +/*! +Sets \c count bytes starting at \c dst to zero. +*/ +PX_FORCE_INLINE void* memZero(void* dest, uint32_t count) +{ + return memset(dest, 0, count); +} + +/*! +Sets \c count bytes starting at \c dst to \c c. +*/ +PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count) +{ + return memset(dest, c, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. User memMove if regions overlap. +*/ +PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count) +{ + return memcpy(dest, src, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. Supports overlapping regions. +*/ +PX_FORCE_INLINE void* memMove(void* dest, const void* src, uint32_t count) +{ + return memmove(dest, src, count); +} + +} // namespace intrinsics +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif // #ifndef PXFOUNDATION_PXUNIXINTRINSICS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixTrigConstants.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixTrigConstants.h new file mode 100644 index 0000000..b294be4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/PxUnixTrigConstants.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +#include "foundation/PxPreprocessor.h" + +namespace physx +{ +namespace aos +{ + +#if PX_CLANG && PX_WINDOWS + #define PX_GLOBALCONST extern const __declspec(selectany) +#else + #define PX_GLOBALCONST extern const __attribute__((weak)) +#endif + +PX_ALIGN_PREFIX(16) +struct PX_VECTORF32 +{ + float f[4]; +} PX_ALIGN_SUFFIX(16); + +PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; +PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; + +} // namespace aos +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonAoS.h new file mode 100644 index 0000000..bf00851 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonAoS.h @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXNEONAOS_H +#define PXFOUNDATION_PXUNIXNEONAOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +// only ARM NEON compatible platforms should reach this +#include + +namespace physx +{ +namespace aos +{ + +typedef float32x2_t FloatV; +typedef float32x4_t Vec3V; +typedef float32x4_t Vec4V; +typedef uint32x4_t BoolV; +typedef float32x4_t QuatV; + +typedef uint32x4_t VecU32V; +typedef int32x4_t VecI32V; +typedef uint16x8_t VecU16V; +typedef int16x8_t VecI16V; +typedef uint8x16_t VecU8V; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define VecU8VArg VecU8V & +#define QuatVArg QuatV & + +// KS - TODO - make an actual VecCrossV type for NEON +#define VecCrossV Vec3V + +typedef VecI32V VecShiftV; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXNEONAOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h new file mode 100644 index 0000000..ecd6c4f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/neon/PxUnixNeonInlineAoS.h @@ -0,0 +1,3619 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXNEONINLINEAOS_H +#define PXFOUNDATION_PXUNIXNEONINLINEAOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +namespace physx +{ +namespace aos +{ + +// improved estimates +#define VRECIPEQ recipq_newton<1> +#define VRECIPE recip_newton<1> +#define VRECIPSQRTEQ rsqrtq_newton<1> +#define VRECIPSQRTE rsqrt_newton<1> + +// "exact" +#define VRECIPQ recipq_newton<4> +#if PX_SWITCH +// StabilizationTests.AveragePoint needs more precision to succeed. +#define VRECIP recip_newton<5> +#else +#define VRECIP recip_newton<4> +#endif +#define VRECIPSQRTQ rsqrtq_newton<4> +#define VRECIPSQRT rsqrt_newton<4> + +#define VECMATH_AOS_EPSILON (1e-3f) + +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE bool isValidFloatV(const FloatV a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1_f32(reinterpret_cast(data), a); + const float32_t x = data[0]; + const float32_t y = data[1]; + + return (x == y); +} + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + const float32_t w = vgetq_lane_f32(a, 3); + return (0.0f == w); +} + +PX_FORCE_INLINE bool isAligned16(const void* a) +{ + return(0 == (size_t(a) & 0x0f)); +} + +#if PX_DEBUG +#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) +#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) +#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(static_cast(a))) +#else +#define ASSERT_ISVALIDVEC3V(a) +#define ASSERT_ISVALIDFLOATV(a) +#define ASSERT_ISALIGNED16(a) +#endif + +namespace internalUnitNeonSimd +{ +PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32(vget_lane_u32(finalReduce, 0) == 0xffffFFFF); +} + +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) == 0xffFFff); +} + +PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32(vget_lane_u32(finalReduce, 0) != 0x0); +} + +PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) +{ + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + const uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) != 0); +} +} + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + PX_ALIGN(16, PxF32) data[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vceq_f32(a, b), 0) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V3AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return V4AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalUnitNeonSimd::BAllTrue4_R(vceqq_u32(a, b)) != 0; +} + +PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEqU32(a, b)); +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return V4U32AllEq(a, b) != 0; +} + +PX_FORCE_INLINE BoolV V4IsEqI32(const VecI32V a, const VecI32V b) +{ + return vceqq_s32(a, b); +} + +PX_FORCE_INLINE PxU32 V4I32AllEq(const VecI32V a, const VecI32V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEqI32(a, b)); +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + return V4I32AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + + const float32x2_t c = vsub_f32(a, b); + const float32x2_t error = vdup_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x2_t greater = vcagt_f32(error, c); + const uint32x2_t min = vpmin_u32(greater, greater); + return vget_lane_u32(min, 0) != 0x0; +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + const float32x4_t c = vsubq_f32(a, b); + const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x4_t greater = vcagtq_f32(error, c); + return internalUnitNeonSimd::BAllTrue3_R(greater) != 0; +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const float32x4_t c = vsubq_f32(a, b); + const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); +// absolute compare abs(error) > abs(c) + const uint32x4_t greater = vcagtq_f32(error, c); + return internalUnitNeonSimd::BAllTrue4_R(greater) != 0x0; +} +} + +#if 0 // debugging printfs +#include +PX_FORCE_INLINE void printVec(const float32x4_t& v, const char* name) +{ + PX_ALIGN(16, float32_t) data[4]; + vst1q_f32(data, v); + printf("%s: (%f, %f, %f, %f)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const float32x2_t& v, const char* name) +{ + PX_ALIGN(16, float32_t) data[2]; + vst1_f32(data, v); + printf("%s: (%f, %f)\n", name, data[0], data[1]); +} + +PX_FORCE_INLINE void printVec(const uint32x4_t& v, const char* name) +{ + PX_ALIGN(16, uint32_t) data[4]; + vst1q_u32(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const uint16x8_t& v, const char* name) +{ + PX_ALIGN(16, uint16_t) data[8]; + vst1q_u16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7]); +} + +PX_FORCE_INLINE void printVec(const int32x4_t& v, const char* name) +{ + PX_ALIGN(16, int32_t) data[4]; + vst1q_s32(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const int16x8_t& v, const char* name) +{ + PX_ALIGN(16, int16_t) data[8]; + vst1q_s16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], + data[4], data[5], data[6], data[7]); +} + +PX_FORCE_INLINE void printVec(const uint16x4_t& v, const char* name) +{ + PX_ALIGN(16, uint16_t) data[4]; + vst1_u16(data, v); + printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); +} + +PX_FORCE_INLINE void printVec(const uint32x2_t& v, const char* name) +{ + PX_ALIGN(16, uint32_t) data[2]; + vst1_u32(data, v); + printf("%s: (0x%x, 0x%x)\n", name, data[0], data[1]); +} + +PX_FORCE_INLINE void printVar(const PxU32 v, const char* name) +{ + printf("%s: 0x%x\n", name, v); +} + +PX_FORCE_INLINE void printVar(const PxF32 v, const char* name) +{ + printf("%s: %f\n", name, v); +} + +#define PRINT_VAR(X) printVar((X), #X) +#define PRINT_VEC(X) printVec((X), #X) +#define PRINT_VEC_TITLE(TITLE, X) printVec((X), TITLE #X) +#endif // debugging printf + +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]); +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1q_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]); +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + PX_ALIGN(16, PxF32) data[4]; + vst1q_f32(reinterpret_cast(data), a); + return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]) && PxIsFinite(data[3]); +} + +PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return vget_lane_u32(vreinterpret_u32_f32(a), 0) == 0; +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t dMin = vpmin_u32(dLow, dLow); + + return vget_lane_u32(dMin, 0) == 0 || vgetq_lane_u32(vreinterpretq_u32_f32(a), 2) == 0; +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + const uint32x2_t dHigh = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); + + const uint32x2_t dMin = vmin_u32(dHigh, dLow); + const uint32x2_t pairMin = vpmin_u32(dMin, dMin); + return vget_lane_u32(pairMin, 0) == 0; +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return vdup_n_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE FloatV FLoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return vld1_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + PX_ALIGN(16, PxF32) data[4] = { f, f, f, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return vdupq_n_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ + const PxU32 i = static_cast(-(static_cast(f))); + return vdupq_n_u32(i); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f) +{ + ASSERT_ISALIGNED16(f); + PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f) +{ + PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) +{ + return vsetq_lane_f32(0.0f, v, 3); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(Vec4V v) +{ + return v; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + return f; // ok if it is implemented as the same type. +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return vcombine_f32(f, f); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; + return V4LoadA(data); +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return vld1q_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE void V4StoreA(Vec4V a, PxF32* f) +{ + ASSERT_ISALIGNED16(f); + vst1q_f32(reinterpret_cast(f), a); +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f[0] = f2[0]; + f[1] = f2[1]; + f[2] = f2[2]; + f[3] = f2[3]; +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + vst1q_u32(reinterpret_cast(u), a); +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + vst1q_u32(reinterpret_cast(u), uv); +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + vst1q_s32(reinterpret_cast(i), iv); +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return vld1q_f32(reinterpret_cast(f)); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxU32) b[4] = { static_cast(-static_cast(f[0])), + static_cast(-static_cast(f[1])), + static_cast(-static_cast(f[2])), + static_cast(-static_cast(f[3])) }; + return vld1q_u32(b); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + ASSERT_ISVALIDFLOATV(a); + // vst1q_lane_f32(f, a, 0); // causes vst1 alignment bug + *f = vget_lane_f32(a, 0); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV a, PxU32* PX_RESTRICT f) +{ + *f = vget_lane_u32(vget_low_u32(a), 0); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32) f2[4]; + vst1q_f32(reinterpret_cast(f2), a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return FLoad(0.0f); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV IZero() +{ + return vreinterpret_f32_u32(vdup_n_u32(0)); +} + +PX_FORCE_INLINE FloatV IOne() +{ + return vreinterpret_f32_u32(vdup_n_u32(1)); +} + +PX_FORCE_INLINE FloatV ITwo() +{ + return vreinterpret_f32_u32(vdup_n_u32(2)); +} + +PX_FORCE_INLINE FloatV IThree() +{ + return vreinterpret_f32_u32(vdup_n_u32(3)); +} + +PX_FORCE_INLINE FloatV IFour() +{ + return vreinterpret_f32_u32(vdup_n_u32(4)); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return vneg_f32(f); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vadd_f32(a, b); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vsub_f32(a, b); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, b); +} + +template +PX_FORCE_INLINE float32x2_t recip_newton(const float32x2_t& in) +{ + float32x2_t recip = vrecpe_f32(in); + for(int i = 0; i < n; ++i) + recip = vmul_f32(recip, vrecps_f32(in, recip)); + return recip; +} + +template +PX_FORCE_INLINE float32x4_t recipq_newton(const float32x4_t& in) +{ + float32x4_t recip = vrecpeq_f32(in); + for(int i = 0; i < n; ++i) + recip = vmulq_f32(recip, vrecpsq_f32(recip, in)); + return recip; +} + +template +PX_FORCE_INLINE float32x2_t rsqrt_newton(const float32x2_t& in) +{ + float32x2_t rsqrt = vrsqrte_f32(in); + for(int i = 0; i < n; ++i) + rsqrt = vmul_f32(rsqrt, vrsqrts_f32(vmul_f32(rsqrt, rsqrt), in)); + return rsqrt; +} + +template +PX_FORCE_INLINE float32x4_t rsqrtq_newton(const float32x4_t& in) +{ + float32x4_t rsqrt = vrsqrteq_f32(in); + for(int i = 0; i < n; ++i) + rsqrt = vmulq_f32(rsqrt, vrsqrtsq_f32(vmulq_f32(rsqrt, rsqrt), in)); + return rsqrt; +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, VRECIP(b)); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vmul_f32(a, VRECIPE(b)); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIP(a); +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPE(a); +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPSQRT(a); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return FSel(FIsEq(a, FZero()), a, vmul_f32(a, VRECIPSQRT(a))); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return VRECIPSQRTE(a); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return vmla_f32(c, a, b); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return vmls_f32(c, a, b); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return vabs_f32(a); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + PX_ASSERT( vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + ASSERT_ISVALIDFLOATV(vbsl_f32(vget_low_u32(c), a, b)); + return vbsl_f32(vget_low_u32(c), a, b); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vcgt_f32(a, b), 0); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vcge_f32(a, b), 0); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vdupq_lane_u32(vceq_f32(a, b), 0); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + //ASSERT_ISVALIDFLOATV(a); + //ASSERT_ISVALIDFLOATV(b); + return vmax_f32(a, b); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + //ASSERT_ISVALIDFLOATV(a); + //ASSERT_ISVALIDFLOATV(b); + return vmin_f32(a, b); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + ASSERT_ISVALIDFLOATV(minV); + ASSERT_ISVALIDFLOATV(maxV); + return vmax_f32(vmin_f32(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vcgt_f32(a, b), 0); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vcge_f32(a, b), 0); +} + +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return vget_lane_u32(vceq_f32(a, b), 0); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // truncate(a + (0.5f - sign(a))) + const float32x2_t half = vdup_n_f32(0.5f); + const float32x2_t sign = vcvt_f32_u32((vshr_n_u32(vreinterpret_u32_f32(a), 31))); + const float32x2_t aPlusHalf = vadd_f32(a, half); + const float32x2_t aRound = vsub_f32(aPlusHalf, sign); + int32x2_t tmp = vcvt_s32_f32(aRound); + return vcvt_f32_s32(tmp); +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = FLoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V3 = FMul(V2, V1); + const FloatV V5 = FMul(V3, V2); + const FloatV V7 = FMul(V5, V2); + const FloatV V9 = FMul(V7, V2); + const FloatV V11 = FMul(V9, V2); + const FloatV V13 = FMul(V11, V2); + const FloatV V15 = FMul(V13, V2); + const FloatV V17 = FMul(V15, V2); + const FloatV V19 = FMul(V17, V2); + const FloatV V21 = FMul(V19, V2); + const FloatV V23 = FMul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + FloatV Result; + Result = FScaleAdd(S1, V3, V1); + Result = FScaleAdd(S2, V5, Result); + Result = FScaleAdd(S3, V7, Result); + Result = FScaleAdd(S4, V9, Result); + Result = FScaleAdd(S5, V11, Result); + Result = FScaleAdd(S6, V13, Result); + Result = FScaleAdd(S7, V15, Result); + Result = FScaleAdd(S8, V17, Result); + Result = FScaleAdd(S9, V19, Result); + Result = FScaleAdd(S10, V21, Result); + Result = FScaleAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = FLoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V4 = FMul(V2, V2); + const FloatV V6 = FMul(V4, V2); + const FloatV V8 = FMul(V4, V4); + const FloatV V10 = FMul(V6, V4); + const FloatV V12 = FMul(V6, V6); + const FloatV V14 = FMul(V8, V6); + const FloatV V16 = FMul(V8, V8); + const FloatV V18 = FMul(V10, V8); + const FloatV V20 = FMul(V10, V10); + const FloatV V22 = FMul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + FloatV Result; + Result = FScaleAdd(C1, V2, FOne()); + Result = FScaleAdd(C2, V4, Result); + Result = FScaleAdd(C3, V6, Result); + Result = FScaleAdd(C4, V8, Result); + Result = FScaleAdd(C5, V10, Result); + Result = FScaleAdd(C6, V12, Result); + Result = FScaleAdd(C7, V14, Result); + Result = FScaleAdd(C8, V16, Result); + Result = FScaleAdd(C9, V18, Result); + Result = FScaleAdd(C10, V20, Result); + Result = FScaleAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + + const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + + const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); + return PxU32(BAllEqTTTT(c)); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + const uint32x2_t greater = vcagt_f32(a, bounds); + return vget_lane_u32(greater, 0); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + const uint32x2_t geq = vcage_f32(bounds, a); + return vget_lane_u32(geq, 0); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t uHigh = vreinterpret_u32_f32(f); + const float32x2_t dHigh = vreinterpret_f32_u32(vand_u32(uHigh, mask)); + + return vcombine_f32(f, dHigh); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t dHigh = vand_u32(vreinterpret_u32_f32(z), mask); + const uint32x2_t dLow = vext_u32(vreinterpret_u32_f32(x), vreinterpret_u32_f32(y), 1); + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const float32x4_t x = { 1.0f, 0.0f, 0.0f, 0.0f }; + return x; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const float32x4_t y = { 0, 1.0f, 0, 0 }; + return y; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const float32x4_t z = { 0, 0, 1.0f, 0 }; + return z; +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 0); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 1); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 0); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aLow = vget_low_f32(a); + const float32x2_t bLow = vget_low_f32(b); + const float32x2_t cLow = vget_low_f32(c); + const float32x2_t zero = vdup_n_f32(0.0f); + + const float32x2x2_t zipL = vzip_f32(aLow, bLow); + const float32x2x2_t zipH = vzip_f32(cLow, zero); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aLow = vget_low_f32(a); + const float32x2_t bLow = vget_low_f32(b); + const float32x2_t cLow = vget_low_f32(c); + const float32x2_t zero = vdup_n_f32(0.0f); + + const float32x2x2_t zipL = vzip_f32(aLow, bLow); + const float32x2x2_t zipH = vzip_f32(cLow, zero); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + + const float32x2_t aHi = vget_high_f32(a); + const float32x2_t bHi = vget_high_f32(b); + const float32x2_t cHi = vget_high_f32(c); + + const float32x2x2_t zipL = vzip_f32(aHi, bHi); + + return vcombine_f32(zipL.val[0], cHi); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return vdupq_n_f32(0.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + const float32x4_t tmp = vnegq_f32(f); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vaddq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return vaddq_f32(a, Vec3V_From_FloatV(b)); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vsubq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return vsubq_f32(a, Vec3V_From_FloatV(b)); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x4_t tmp = vmulq_lane_f32(a, b, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vmulq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIP(b); + const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + float32x4_t invB = VRECIPQ(b); + invB = vsetq_lane_f32(0.0f, invB, 3); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIPE(b); + const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); + return vsetq_lane_f32(0.0f, tmp, 3); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + float32x4_t invB = VRECIPEQ(b); + invB = vsetq_lane_f32(0.0f, invB, 3); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t recipA = VRECIPQ(a); + return vsetq_lane_f32(0.0f, recipA, 3); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t recipA = VRECIPEQ(a); + return vsetq_lane_f32(0.0f, recipA, 3); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t rSqrA = VRECIPSQRTQ(a); + return vsetq_lane_f32(0.0f, rSqrA, 3); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x4_t rSqrA = VRECIPSQRTEQ(a); + return vsetq_lane_f32(0.0f, rSqrA, 3); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + + float32x4_t tmp = vmlaq_lane_f32(c, a, b, 0); + // using vsetq_lane_f32 resulted in failures, + // probably related to a compiler bug on + // ndk r9d-win32, gcc 4.8, cardhu/shield + + // code with issue + // return vsetq_lane_f32(0.0f, tmp, 3); + + // workaround + float32x2_t w_z = vget_high_f32(tmp); + float32x2_t y_x = vget_low_f32(tmp); + w_z = vset_lane_f32(0.0f, w_z, 1); + return vcombine_f32(y_x, w_z); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + + float32x4_t tmp = vmlsq_lane_f32(c, a, b, 0); + // using vsetq_lane_f32 resulted in failures, + // probably related to a compiler bug on + // ndk r9d-win32, gcc 4.8, cardhu/shield + + // code with issue + // return vsetq_lane_f32(0.0f, tmp, 3); + + // workaround + float32x2_t w_z = vget_high_f32(tmp); + float32x2_t y_x = vget_low_f32(tmp); + w_z = vset_lane_f32(0.0f, w_z, 1); + return vcombine_f32(y_x, w_z); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return vmlaq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return vmlsq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return vabsq_f32(a); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + const float32x4_t tmp = vmulq_f32(a, b); + + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return sum0ZYX; +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + + const uint32x2_t TF = { 0xffffFFFF, 0x0 }; + const float32x2_t ay_ax = vget_low_f32(a); // d2 + const float32x2_t aw_az = vget_high_f32(a); // d3 + const float32x2_t by_bx = vget_low_f32(b); // d4 + const float32x2_t bw_bz = vget_high_f32(b); // d5 + // Hi, Lo + const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by + const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay + + const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx + const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by + + const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz + const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx + + const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by + const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx + + return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return a; +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + + const float32x4_t tmp = vmulq_f32(a, a); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return FSqrt(sum0ZYX); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Dot(a, a); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V3ScaleInv(a, V3Length(a)); +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V3Scale(a, VRECIPSQRTE(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + ASSERT_ISVALIDVEC3V(a); + const FloatV zero = vdup_n_f32(0.0f); + const FloatV length = V3Length(a); + const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); + return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V( vbslq_f32(c, a, b)); + return vbslq_f32(c, a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vcgtq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vcgeq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vceqq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vmaxq_f32(a, b); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return vminq_f32(a, b); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t zz = vdup_lane_f32(high, 0); + const float32x2_t max0 = vpmax_f32(zz, low); + const float32x2_t max1 = vpmax_f32(max0, max0); + + return max1; +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t zz = vdup_lane_f32(high, 0); + const float32x2_t min0 = vpmin_f32(zz, low); + const float32x2_t min1 = vpmin_f32(min0, min0); + + return min1; +} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const Vec3V zero = V3Zero(); + const Vec3V one = V3One(); + const Vec3V none = V3Neg(one); + return V3Sel(V3IsGrtrOrEq(a, zero), one, none); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + ASSERT_ISVALIDVEC3V(minV); + ASSERT_ISVALIDVEC3V(maxV); + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitNeonSimd::BAllTrue3_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + // truncate(a + (0.5f - sign(a))) + const Vec3V half = V3Load(0.5f); + const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); + const Vec3V aPlusHalf = V3Add(a, half); + const Vec3V aRound = V3Sub(aPlusHalf, sign); + return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V4Mul(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V3 = V3Mul(V2, V1); + const Vec3V V5 = V3Mul(V3, V2); + const Vec3V V7 = V3Mul(V5, V2); + const Vec3V V9 = V3Mul(V7, V2); + const Vec3V V11 = V3Mul(V9, V2); + const Vec3V V13 = V3Mul(V11, V2); + const Vec3V V15 = V3Mul(V13, V2); + const Vec3V V17 = V3Mul(V15, V2); + const Vec3V V19 = V3Mul(V17, V2); + const Vec3V V21 = V3Mul(V19, V2); + const Vec3V V23 = V3Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec3V Result; + Result = V4ScaleAdd(V3, S1, V1); + Result = V4ScaleAdd(V5, S2, Result); + Result = V4ScaleAdd(V7, S3, Result); + Result = V4ScaleAdd(V9, S4, Result); + Result = V4ScaleAdd(V11, S5, Result); + Result = V4ScaleAdd(V13, S6, Result); + Result = V4ScaleAdd(V15, S7, Result); + Result = V4ScaleAdd(V17, S8, Result); + Result = V4ScaleAdd(V19, S9, Result); + Result = V4ScaleAdd(V21, S10, Result); + Result = V4ScaleAdd(V23, S11, Result); + + return Result; +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V4Mul(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V4 = V3Mul(V2, V2); + const Vec3V V6 = V3Mul(V4, V2); + const Vec3V V8 = V3Mul(V4, V4); + const Vec3V V10 = V3Mul(V6, V4); + const Vec3V V12 = V3Mul(V6, V6); + const Vec3V V14 = V3Mul(V8, V6); + const Vec3V V16 = V3Mul(V8, V8); + const Vec3V V18 = V3Mul(V10, V8); + const Vec3V V20 = V3Mul(V10, V10); + const Vec3V V22 = V3Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec3V Result; + Result = V4ScaleAdd(V2, C1, V4One()); + Result = V4ScaleAdd(V4, C2, Result); + Result = V4ScaleAdd(V6, C3, Result); + Result = V4ScaleAdd(V8, C4, Result); + Result = V4ScaleAdd(V10, C5, Result); + Result = V4ScaleAdd(V12, C6, Result); + Result = V4ScaleAdd(V14, C7, Result); + Result = V4ScaleAdd(V16, C8, Result); + Result = V4ScaleAdd(V18, C9, Result); + Result = V4ScaleAdd(V20, C10, Result); + Result = V4ScaleAdd(V22, C11, Result); + + return V4ClearW(Result); +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2_t yz = vext_f32(xy, zw, 1); + return vcombine_f32(yz, zw); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(xy, xw)); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yz = vext_u32(xy, zw, 1); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t wz = vrev64_u32(zw); + + const uint32x2_t zx = vext_u32(wz, xy, 1); + const uint32x2_t yw = vext_u32(xy, wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(zx, yw)); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + + const uint32x2_t wz = vrev64_u32(zw); + const uint32x2_t yw = vext_u32(xy, wz, 1); + const uint32x2_t zz = vdup_lane_u32(wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(zz, yw)); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yx = vrev64_u32(xy); + const uint32x2_t xw = vand_u32(xy, mask); + return vreinterpretq_f32_u32(vcombine_u32(yx, xw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t wz = vrev64_u32(zw); + const uint32x2_t yw = vext_u32(xy, wz, 1); + + return vreinterpretq_f32_u32(vcombine_u32(wz, yw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t mask = { 0xffffFFFF, 0x0 }; + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t xw = vand_u32(xy, mask); + + return vreinterpretq_f32_u32(vcombine_u32(zw, xw)); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + + const uint32x2_t axy = vget_low_u32(vreinterpretq_u32_f32(v0)); + const uint32x2_t bxy = vget_low_u32(vreinterpretq_u32_f32(v1)); + const uint32x2_t byax = vext_u32(bxy, axy, 1); + const uint32x2_t ww = vdup_n_u32(0); + + return vreinterpretq_f32_u32(vcombine_u32(byax, ww)); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // const uint32x2_t mask = {0xffffFFFF, 0x0}; + + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + + return sum0ZYX; +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + + const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); + return internalUnitNeonSimd::BAnyTrue3_R(c); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + + const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); + return internalUnitNeonSimd::BAllTrue4_R(c); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + + const BoolV greater = V3IsGrtr(V3Abs(a), bounds); + return internalUnitNeonSimd::BAnyTrue3_R(greater); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + + const BoolV greaterOrEq = V3IsGrtrOrEq(bounds, V3Abs(a)); + return internalUnitNeonSimd::BAllTrue4_R(greaterOrEq); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + ASSERT_ISVALIDVEC3V(col0); + ASSERT_ISVALIDVEC3V(col1); + ASSERT_ISVALIDVEC3V(col2); + + Vec3V col3 = V3Zero(); + const float32x4x2_t v0v1 = vzipq_f32(col0, col2); + const float32x4x2_t v2v3 = vzipq_f32(col1, col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + col0 = zip0.val[0]; + col1 = zip0.val[1]; + col2 = zip1.val[0]; + // col3 = zip1.val[1]; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return vcombine_f32(f, f); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + ASSERT_ISVALIDFLOATV(floatVArray[0]); + ASSERT_ISVALIDFLOATV(floatVArray[1]); + ASSERT_ISVALIDFLOATV(floatVArray[2]); + ASSERT_ISVALIDFLOATV(floatVArray[3]); + + const uint32x2_t xLow = vreinterpret_u32_f32(floatVArray[0]); + const uint32x2_t yLow = vreinterpret_u32_f32(floatVArray[1]); + const uint32x2_t zLow = vreinterpret_u32_f32(floatVArray[2]); + const uint32x2_t wLow = vreinterpret_u32_f32(floatVArray[3]); + + const uint32x2_t dLow = vext_u32(xLow, yLow, 1); + const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); + + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + ASSERT_ISVALIDFLOATV(w); + + const uint32x2_t xLow = vreinterpret_u32_f32(x); + const uint32x2_t yLow = vreinterpret_u32_f32(y); + const uint32x2_t zLow = vreinterpret_u32_f32(z); + const uint32x2_t wLow = vreinterpret_u32_f32(w); + + const uint32x2_t dLow = vext_u32(xLow, yLow, 1); + const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); + + return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_high_f32(x); + const float32x2_t yy = vget_high_f32(y); + const float32x2_t zz = vget_high_f32(z); + const float32x2_t ww = vget_high_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_high_f32(x); + const float32x2_t yy = vget_high_f32(y); + const float32x2_t zz = vget_high_f32(z); + const float32x2_t ww = vget_high_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_low_f32(x); + const float32x2_t yy = vget_low_f32(y); + const float32x2_t zz = vget_low_f32(z); + const float32x2_t ww = vget_low_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[1], zipH.val[1]); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const float32x2_t xx = vget_low_f32(x); + const float32x2_t yy = vget_low_f32(y); + const float32x2_t zz = vget_low_f32(z); + const float32x2_t ww = vget_low_f32(w); + + const float32x2x2_t zipL = vzip_f32(xx, yy); + const float32x2x2_t zipH = vzip_f32(zz, ww); + + return vcombine_f32(zipL.val[0], zipH.val[0]); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return vzipq_f32(a, b).val[0]; +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return vzipq_f32(a, b).val[1]; +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t zo = vext_f32(zeros, ones, 1); + return vcombine_f32(zeros, zo); +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t oz = vext_f32(ones, zeros, 1); + return vcombine_f32(oz, zeros); +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t zo = vext_f32(zeros, ones, 1); + return vcombine_f32(zo, zeros); +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const float32x2_t ones = vmov_n_f32(1.0f); + const float32x2_t oz = vext_f32(ones, zeros, 1); + return vcombine_f32(zeros, oz); +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 1); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 0); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + const float32x2_t fLow = vget_low_f32(f); + return vdup_lane_f32(fLow, 1); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + const float32x2_t fhigh = vget_high_f32(f); + return vdup_lane_f32(fhigh, 0); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTTF(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, vcombine_f32(f, f)); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return V4Sel(BTTTF(), v, V4Zero()); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2_t yx = vext_f32(xy, xy, 1); + const float32x2_t wz = vext_f32(zw, zw, 1); + return vcombine_f32(yx, wz); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2x2_t xzyw = vzip_f32(xy, zw); + return vcombine_f32(xzyw.val[0], xzyw.val[0]); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) +{ + const float32x2_t xy = vget_low_f32(a); + const float32x2_t zw = vget_high_f32(a); + const float32x2x2_t xzyw = vzip_f32(xy, zw); + return vcombine_f32(xzyw.val[1], xzyw.val[1]); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); + const uint32x2_t yz = vext_u32(xy, zw, 1); + const uint32x2_t xw = vrev64_u32(vext_u32(zw, xy, 1)); + return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + return vcombine_f32(high, low); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V V) +{ + static const uint32_t ControlElement[4] = + { +#if 1 + 0x03020100, // XM_SWIZZLE_X + 0x07060504, // XM_SWIZZLE_Y + 0x0B0A0908, // XM_SWIZZLE_Z + 0x0F0E0D0C, // XM_SWIZZLE_W +#else + 0x00010203, // XM_SWIZZLE_X + 0x04050607, // XM_SWIZZLE_Y + 0x08090A0B, // XM_SWIZZLE_Z + 0x0C0D0E0F, // XM_SWIZZLE_W +#endif + }; + + uint8x8x2_t tbl; + tbl.val[0] = vreinterpret_u8_f32(vget_low_f32(V)); + tbl.val[1] = vreinterpret_u8_f32(vget_high_f32(V)); + + uint8x8_t idx = + vcreate_u8(static_cast(ControlElement[E0]) | (static_cast(ControlElement[E1]) << 32)); + const uint8x8_t rL = vtbl2_u8(tbl, idx); + idx = vcreate_u8(static_cast(ControlElement[E2]) | (static_cast(ControlElement[E3]) << 32)); + const uint8x8_t rH = vtbl2_u8(tbl, idx); + return vreinterpretq_f32_u8(vcombine_u8(rL, rH)); +} + +// PT: this seems measurably slower than the hardcoded version +/*PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + return V4Perm<1, 2, 0, 3>(a); +}*/ + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return vreinterpretq_f32_u32(vmovq_n_u32(0)); + // return vmovq_n_f32(0.0f); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return vmovq_n_f32(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + // return vmovq_n_f32(PX_EPS_REAL); + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) +{ + return vnegq_f32(f); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return vaddq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return vsubq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return vmulq_lane_f32(a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return vmulq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIP(b); + return vmulq_lane_f32(a, invB, 0); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + const float32x4_t invB = VRECIPQ(b); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + const float32x2_t invB = VRECIPE(b); + return vmulq_lane_f32(a, invB, 0); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + const float32x4_t invB = VRECIPEQ(b); + return vmulq_f32(a, invB); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return VRECIPQ(a); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return VRECIPEQ(a); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return VRECIPSQRTQ(a); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return VRECIPSQRTEQ(a); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return V4Sel(V4IsEq(a, V4Zero()), a, V4Mul(a, VRECIPSQRTQ(a))); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return vmlaq_lane_f32(c, a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return vmlsq_lane_f32(c, a, b, 0); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return vmlaq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return vmlsq_f32(c, a, b); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return vabsq_f32(a); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ + const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y + const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w + const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w + const FloatV xz = V4GetX(xz_yw); // x+z + const FloatV yw = V4GetZ(xz_yw); // y+w + return FAdd(xz, yw); // sum +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ + const float32x4_t tmp = vmulq_f32(a, b); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {z+w, x+y} + const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z+w, x+y+z+w} + return sumWZYX; +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V aa, const Vec4V bb) +{ + // PT: the V3Dot code relies on the fact that W=0 so we can't reuse it as-is, we need to clear W first. + // TODO: find a better implementation that does not need to clear W. + const Vec4V a = V4ClearW(aa); + const Vec4V b = V4ClearW(bb); + + const float32x4_t tmp = vmulq_f32(a, b); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + return sum0ZYX; +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ + const uint32x2_t TF = { 0xffffFFFF, 0x0 }; + const float32x2_t ay_ax = vget_low_f32(a); // d2 + const float32x2_t aw_az = vget_high_f32(a); // d3 + const float32x2_t by_bx = vget_low_f32(b); // d4 + const float32x2_t bw_bz = vget_high_f32(b); // d5 + // Hi, Lo + const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by + const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay + + const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx + const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by + + const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz + const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx + + const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by + const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx + + return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + const float32x4_t tmp = vmulq_f32(a, a); + const float32x2_t low = vget_low_f32(tmp); + const float32x2_t high = vget_high_f32(tmp); + + const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} + const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} + return FSqrt(sumWZYX); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V4ScaleInv(a, V4Length(a)); +} + +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); + return V4Scale(a, FRsqrtFast(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const FloatV zero = FZero(); + const FloatV length = V4Length(a); + const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); + return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return vceqq_u32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return vbslq_f32(c, a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return vcgtq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return vcgeq_f32(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return vceqq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return vmaxq_f32(a, b); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return vminq_f32(a, b); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t max0 = vpmax_f32(high, low); + const float32x2_t max1 = vpmax_f32(max0, max0); + + return max1; +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const float32x2_t low = vget_low_f32(a); + const float32x2_t high = vget_high_f32(a); + + const float32x2_t min0 = vpmin_f32(high, low); + const float32x2_t min1 = vpmin_f32(min0, min0); + + return min1; +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAllTrue4_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return internalUnitNeonSimd::BAnyTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ + // truncate(a + (0.5f - sign(a))) + const Vec4V half = V4Load(0.5f); + const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); + const Vec4V aPlusHalf = V4Add(a, half); + const Vec4V aRound = V4Sub(aPlusHalf, sign); + return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V3 = V4Mul(V2, V1); + const Vec4V V5 = V4Mul(V3, V2); + const Vec4V V7 = V4Mul(V5, V2); + const Vec4V V9 = V4Mul(V7, V2); + const Vec4V V11 = V4Mul(V9, V2); + const Vec4V V13 = V4Mul(V11, V2); + const Vec4V V15 = V4Mul(V13, V2); + const Vec4V V17 = V4Mul(V15, V2); + const Vec4V V19 = V4Mul(V17, V2); + const Vec4V V21 = V4Mul(V19, V2); + const Vec4V V23 = V4Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec4V Result; + Result = V4ScaleAdd(V3, S1, V1); + Result = V4ScaleAdd(V5, S2, Result); + Result = V4ScaleAdd(V7, S3, Result); + Result = V4ScaleAdd(V9, S4, Result); + Result = V4ScaleAdd(V11, S5, Result); + Result = V4ScaleAdd(V13, S6, Result); + Result = V4ScaleAdd(V15, S7, Result); + Result = V4ScaleAdd(V17, S8, Result); + Result = V4ScaleAdd(V19, S9, Result); + Result = V4ScaleAdd(V21, S10, Result); + Result = V4ScaleAdd(V23, S11, Result); + + return Result; +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V4 = V4Mul(V2, V2); + const Vec4V V6 = V4Mul(V4, V2); + const Vec4V V8 = V4Mul(V4, V4); + const Vec4V V10 = V4Mul(V6, V4); + const Vec4V V12 = V4Mul(V6, V6); + const Vec4V V14 = V4Mul(V8, V6); + const Vec4V V16 = V4Mul(V8, V8); + const Vec4V V18 = V4Mul(V10, V8); + const Vec4V V20 = V4Mul(V10, V10); + const Vec4V V22 = V4Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec4V Result; + Result = V4ScaleAdd(V2, C1, V4One()); + Result = V4ScaleAdd(V4, C2, Result); + Result = V4ScaleAdd(V6, C3, Result); + Result = V4ScaleAdd(V8, C4, Result); + Result = V4ScaleAdd(V10, C5, Result); + Result = V4ScaleAdd(V12, C6, Result); + Result = V4ScaleAdd(V14, C7, Result); + Result = V4ScaleAdd(V16, C8, Result); + Result = V4ScaleAdd(V18, C9, Result); + Result = V4ScaleAdd(V20, C10, Result); + Result = V4ScaleAdd(V22, C11, Result); + + return Result; +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + const float32x4x2_t v0v1 = vzipq_f32(col0, col2); + const float32x4x2_t v2v3 = vzipq_f32(col1, col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + col0 = zip0.val[0]; + col1 = zip0.val[1]; + col2 = zip1.val[0]; + col3 = zip1.val[1]; +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE BoolV BFFFF() +{ + return vmovq_n_u32(0); +} + +PX_FORCE_INLINE BoolV BFFFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zeros, zo); +} + +PX_FORCE_INLINE BoolV BFFTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(zeros, oz); +} + +PX_FORCE_INLINE BoolV BFFTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + return vcombine_u32(zeros, ones); +} + +PX_FORCE_INLINE BoolV BFTFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, zeros); +} + +PX_FORCE_INLINE BoolV BFTFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, zo); +} + +PX_FORCE_INLINE BoolV BFTTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(zo, oz); +} + +PX_FORCE_INLINE BoolV BFTTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(zo, ones); +} + +PX_FORCE_INLINE BoolV BTFFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + // const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, zeros); +} + +PX_FORCE_INLINE BoolV BTFFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, zo); +} + +PX_FORCE_INLINE BoolV BTFTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, oz); +} + +PX_FORCE_INLINE BoolV BTFTT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(oz, ones); +} + +PX_FORCE_INLINE BoolV BTTFF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + return vcombine_u32(ones, zeros); +} + +PX_FORCE_INLINE BoolV BTTFT() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t zo = vext_u32(zeros, ones, 1); + return vcombine_u32(ones, zo); +} + +PX_FORCE_INLINE BoolV BTTTF() +{ + const uint32x2_t zeros = vmov_n_u32(0); + const uint32x2_t ones = vmov_n_u32(0xffffFFFF); + const uint32x2_t oz = vext_u32(ones, zeros, 1); + return vcombine_u32(ones, oz); +} + +PX_FORCE_INLINE BoolV BTTTT() +{ + return vmovq_n_u32(0xffffFFFF); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + return BTFFF(); +} + +PX_FORCE_INLINE BoolV BYMask() +{ + return BFTFF(); +} + +PX_FORCE_INLINE BoolV BZMask() +{ + return BFFTF(); +} + +PX_FORCE_INLINE BoolV BWMask() +{ + return BFFFT(); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV f) +{ + const uint32x2_t fLow = vget_low_u32(f); + return vdupq_lane_u32(fLow, 0); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV f) +{ + const uint32x2_t fLow = vget_low_u32(f); + return vdupq_lane_u32(fLow, 1); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV f) +{ + const uint32x2_t fHigh = vget_high_u32(f); + return vdupq_lane_u32(fHigh, 0); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV f) +{ + const uint32x2_t fHigh = vget_high_u32(f); + return vdupq_lane_u32(fHigh, 1); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return vbslq_u32(BFTTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTFTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTTFT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return vbslq_u32(BTTTF(), v, f); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return vandq_u32(a, b); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + return vmvnq_u32(a); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + // return vbicq_u32(a, b); + return vandq_u32(a, vmvnq_u32(b)); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return vorrq_u32(a, b); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vceq_u32(finalReduce, allTrue); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vtst_u32(finalReduce, allTrue); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vceq_u32(vand_u32(finalReduce, allTrue3), allTrue3); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); + const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); + const uint16x4_t dLow = vmovn_u32(a); + uint16x8_t combined = vcombine_u16(dLow, dHigh); + const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); + const uint32x2_t result = vtst_u32(vand_u32(finalReduce, allTrue3), allTrue3); + return vdupq_lane_u32(result, 0); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + const BoolV bTest = vceqq_u32(a, b); + return internalUnitNeonSimd::BAllTrue4_R(bTest); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return BAllEq(a, BTTTT()); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return BAllEq(a, BFFFF()); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + static PX_ALIGN(16, const PxU32) bitMaskData[4] = { 1, 2, 4, 8 }; + const uint32x4_t bitMask = *(reinterpret_cast(bitMaskData)); + const uint32x4_t t0 = vandq_u32(a, bitMask); + const uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); // Pairwise add (0 + 1), (2 + 3) + return PxU32(vget_lane_u32(vpadd_u32(t1, t1), 0)); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); + const BoolV btttf = BTTTF(); + + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = FRecipFast(dot); + + const float32x4x2_t merge = vzipq_f32(cross12, cross01); + const float32x4_t mergeh = merge.val[0]; + const float32x4_t mergel = merge.val[1]; + + // const Vec3V colInv0 = XMVectorPermute(mergeh,cross20,PxPermuteControl(0,4,1,7)); + const float32x4_t colInv0_xxyy = vzipq_f32(mergeh, cross20).val[0]; + const float32x4_t colInv0 = vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(colInv0_xxyy), btttf)); + + // const Vec3V colInv1 = XMVectorPermute(mergeh,cross20,PxPermuteControl(2,5,3,7)); + const float32x2_t zw0 = vget_high_f32(mergeh); + const float32x2_t xy1 = vget_low_f32(cross20); + const float32x2_t yzero1 = vext_f32(xy1, zeros, 1); + const float32x2x2_t merge1 = vzip_f32(zw0, yzero1); + const float32x4_t colInv1 = vcombine_f32(merge1.val[0], merge1.val[1]); + + // const Vec3V colInv2 = XMVectorPermute(mergel,cross20,PxPermuteControl(0,6,1,7)); + const float32x2_t x0y0 = vget_low_f32(mergel); + const float32x2_t z1w1 = vget_high_f32(cross20); + const float32x2x2_t merge2 = vzip_f32(x0y0, z1w1); + const float32x4_t colInv2 = vcombine_f32(merge2.val[0], merge2.val[1]); + + return Mat33V(vmulq_lane_f32(colInv0, invDet, 0), vmulq_lane_f32(colInv1, invDet, 0), + vmulq_lane_f32(colInv2, invDet, 0)); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) +{ + const BoolV bTFFF = BTFFF(); + const BoolV bFTFF = BFTFF(); + const BoolV bFFTF = BTFTF(); + + const Vec3V zero = V3Zero(); + + return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const Vec3V x = V3Mul(V3UnitX(), d); + const Vec3V y = V3Mul(V3UnitY(), d); + const Vec3V z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); + return V3Add(v0PlusV1Plusv2, a.col3); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const FloatV w = V4GetW(b); + + const Vec4V v0 = V4Scale(a.col0, x); + const Vec4V v1 = V4Scale(a.col1, y); + const Vec4V v2 = V4Scale(a.col2, z); + const Vec4V v3 = V4Scale(a.col3, w); + const Vec4V v0PlusV1 = V4Add(v0, v1); + const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); + return V4Add(v0PlusV1Plusv2, v3); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + return V4Merge(V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b)); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + // asm volatile( + // "vzip.f32 %q0, %q2 \n\t" + // "vzip.f32 %q1, %q3 \n\t" + // "vzip.f32 %q0, %q1 \n\t" + // "vzip.f32 %q2, %q3 \n\t" + // : "+w" (a.col0), "+w" (a.col1), "+w" (a.col2), "+w" a.col3)); + + const float32x4x2_t v0v1 = vzipq_f32(a.col0, a.col2); + const float32x4x2_t v2v3 = vzipq_f32(a.col1, a.col3); + const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); + const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); + + return Mat44V(zip0.val[0], zip0.val[1], zip1.val[0], zip1.val[1]); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + float32x4_t minor0, minor1, minor2, minor3; + float32x4_t row0, row1, row2, row3; + float32x4_t det, tmp1; + + tmp1 = vmovq_n_f32(0.0f); + row1 = vmovq_n_f32(0.0f); + row3 = vmovq_n_f32(0.0f); + + row0 = a.col0; + row1 = vextq_f32(a.col1, a.col1, 2); + row2 = a.col2; + row3 = vextq_f32(a.col3, a.col3, 2); + + tmp1 = vmulq_f32(row2, row3); + tmp1 = vrev64q_f32(tmp1); + minor0 = vmulq_f32(row1, tmp1); + minor1 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(vmulq_f32(row1, tmp1), minor0); + minor1 = vsubq_f32(vmulq_f32(row0, tmp1), minor1); + minor1 = vextq_f32(minor1, minor1, 2); + + tmp1 = vmulq_f32(row1, row2); + tmp1 = vrev64q_f32(tmp1); + minor0 = vaddq_f32(vmulq_f32(row3, tmp1), minor0); + minor3 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(minor0, vmulq_f32(row3, tmp1)); + minor3 = vsubq_f32(vmulq_f32(row0, tmp1), minor3); + minor3 = vextq_f32(minor3, minor3, 2); + + tmp1 = vmulq_f32(vextq_f32(row1, row1, 2), row3); + tmp1 = vrev64q_f32(tmp1); + row2 = vextq_f32(row2, row2, 2); + minor0 = vaddq_f32(vmulq_f32(row2, tmp1), minor0); + minor2 = vmulq_f32(row0, tmp1); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor0 = vsubq_f32(minor0, vmulq_f32(row2, tmp1)); + minor2 = vsubq_f32(vmulq_f32(row0, tmp1), minor2); + minor2 = vextq_f32(minor2, minor2, 2); + + tmp1 = vmulq_f32(row0, row1); + tmp1 = vrev64q_f32(tmp1); + minor2 = vaddq_f32(vmulq_f32(row3, tmp1), minor2); + minor3 = vsubq_f32(vmulq_f32(row2, tmp1), minor3); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor2 = vsubq_f32(vmulq_f32(row3, tmp1), minor2); + minor3 = vsubq_f32(minor3, vmulq_f32(row2, tmp1)); + + tmp1 = vmulq_f32(row0, row3); + tmp1 = vrev64q_f32(tmp1); + minor1 = vsubq_f32(minor1, vmulq_f32(row2, tmp1)); + minor2 = vaddq_f32(vmulq_f32(row1, tmp1), minor2); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor1 = vaddq_f32(vmulq_f32(row2, tmp1), minor1); + minor2 = vsubq_f32(minor2, vmulq_f32(row1, tmp1)); + + tmp1 = vmulq_f32(row0, row2); + tmp1 = vrev64q_f32(tmp1); + minor1 = vaddq_f32(vmulq_f32(row3, tmp1), minor1); + minor3 = vsubq_f32(minor3, vmulq_f32(row1, tmp1)); + tmp1 = vextq_f32(tmp1, tmp1, 2); + minor1 = vsubq_f32(minor1, vmulq_f32(row3, tmp1)); + minor3 = vaddq_f32(vmulq_f32(row1, tmp1), minor3); + + det = vmulq_f32(row0, minor0); + det = vaddq_f32(vextq_f32(det, det, 2), det); + det = vaddq_f32(vrev64q_f32(det), det); + det = vdupq_lane_f32(VRECIPE(vget_low_f32(det)), 0); + + minor0 = vmulq_f32(det, minor0); + minor1 = vmulq_f32(det, minor1); + minor2 = vmulq_f32(det, minor2); + minor3 = vmulq_f32(det, minor3); + Mat44V invTrans(minor0, minor1, minor2, minor3); + return M44Trnsps(invTrans); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + const float32x4_t ret = { x, y, z, w }; + return ret; +} + +/* +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + return vcombine_u16(vqmovn_u32(a), vqmovn_u32(b)); +} +*/ + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return vbslq_u32(c, a, b); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return vorrq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return veorq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return vandq_u32(a, b); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + // return vbicq_u32(a, b); // creates gcc compiler bug in RTreeQueries.cpp + return vandq_u32(a, vmvnq_u32(b)); +} + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return vorrq_u16(a, b); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return vandq_u16(a, b); +} +*/ +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return vbicq_u16(a, b); +} +*/ + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + const int32x4_t ret = { x, y, z, w }; + return ret; +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return vdupq_n_s32(i); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return vld1q_s32(i); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + return vld1q_s32(i); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return vaddq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return vsubq_s32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return vcgtq_s32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return vceqq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return vbslq_s32(c, a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return vdupq_n_s32(0); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return vdupq_n_s32(1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return vdupq_n_s32(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return vdupq_n_s32(-1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return U4Load(0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return U4Load(1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return U4Load(2); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + return shift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return vshlq_s32(a, count); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return vshlq_s32(a, VecI32V_Sub(I4Load(0), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + const int32x4_t shiftCount = { (PxI32)count, (PxI32)count, (PxI32)count, (PxI32)count }; + return vshlq_s32(a, shiftCount); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + const int32x4_t shiftCount = { -(PxI32)count, -(PxI32)count, -(PxI32)count, -(PxI32)count }; + return vshlq_s32(a, shiftCount); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return vandq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return vorrq_s32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg f) +{ + const int32x2_t fLow = vget_low_s32(f); + return vdupq_lane_s32(fLow, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg f) +{ + const int32x2_t fLow = vget_low_s32(f); + return vdupq_lane_s32(fLow, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg f) +{ + const int32x2_t fHigh = vget_high_s32(f); + return vdupq_lane_s32(fHigh, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg f) +{ + const int32x2_t fHigh = vget_high_s32(f); + return vdupq_lane_s32(fHigh, 1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return vbslq_s32(c, a, b); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + *i = vgetq_lane_s32(a, 0); +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + const int32x2_t aLow = vget_low_s32(a); + const int32x2_t bLow = vget_low_s32(b); + const int32x2_t cLow = vget_low_s32(c); + const int32x2_t dLow = vget_low_s32(d); + + const int32x2_t low = vext_s32(aLow, bLow, 1); + const int32x2_t high = vext_s32(cLow, dLow, 1); + + return vcombine_s32(low, high); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return vreinterpretq_s32_u32(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + return vdupq_n_s32(a); +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + return vdupq_n_u32(a); +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + vst1q_u16((uint16_t*)address, val); +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + vst1q_u32(reinterpret_cast(address), val); +} + +PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return vld1q_f32(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return vld1q_f32(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + return vreinterpretq_f32_u32(V4U32Andc(vreinterpretq_u32_f32(a), b)); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return V4IsGrtr(a, b); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) +{ + return vld1q_u16(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) +{ + return vld1q_u16(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + return vcgtq_u16(a, b); +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecI16V a, VecI16V b) +{ + return vcgtq_s16(a, b); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + return vcvtq_f32_u32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return vcvtq_f32_s32(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return vcvtq_s32_f32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return vreinterpretq_f32_u32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return vreinterpretq_f32_s32(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return vreinterpretq_u32_f32(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return vreinterpretq_s32_f32(a); +} + +#if !PX_SWITCH +template +PX_FORCE_INLINE BoolV BSplatElement(BoolV a) +{ + if(index < 2) + { + return vdupq_lane_u32(vget_low_u32(a), index); + } + else if(index == 2) + { + return vdupq_lane_u32(vget_high_u32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_u32(vget_high_u32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE BoolV BSplatElement(BoolV a); +template<> PX_FORCE_INLINE BoolV BSplatElement<0>(BoolV a) { return vdupq_lane_u32(vget_low_u32(a), 0); } +template<> PX_FORCE_INLINE BoolV BSplatElement<1>(BoolV a) { return vdupq_lane_u32(vget_low_u32(a), 1); } +template<> PX_FORCE_INLINE BoolV BSplatElement<2>(BoolV a) { return vdupq_lane_u32(vget_high_u32(a), 0); } +template<> PX_FORCE_INLINE BoolV BSplatElement<3>(BoolV a) { return vdupq_lane_u32(vget_high_u32(a), 1); } +#endif + +#if !PX_SWITCH +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + if(index < 2) + { + return vdupq_lane_u32(vget_low_u32(a), index); + } + else if(index == 2) + { + return vdupq_lane_u32(vget_high_u32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_u32(vget_high_u32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a); +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<0>(VecU32V a) { return vdupq_lane_u32(vget_low_u32(a), 0); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<1>(VecU32V a) { return vdupq_lane_u32(vget_low_u32(a), 1); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<2>(VecU32V a) { return vdupq_lane_u32(vget_high_u32(a), 0); } +template <> PX_FORCE_INLINE VecU32V V4U32SplatElement<3>(VecU32V a) { return vdupq_lane_u32(vget_high_u32(a), 1); } +#endif + +#if !PX_SWITCH +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + if(index == 0) + { + return vdupq_lane_f32(vget_low_f32(a), 0); + } + else if(index == 1) + { + return vdupq_lane_f32(vget_low_f32(a), 1); + } + else if(index == 2) + { + return vdupq_lane_f32(vget_high_f32(a), 0); + } + else if(index == 3) + { + return vdupq_lane_f32(vget_high_f32(a), 1); + } +} +#else +//workaround for template compile issue +template PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a); +template <> PX_FORCE_INLINE Vec4V V4SplatElement<0>(Vec4V a) { return vdupq_lane_f32(vget_low_f32(a), 0); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<1>(Vec4V a) { return vdupq_lane_f32(vget_low_f32(a), 1); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<2>(Vec4V a) { return vdupq_lane_f32(vget_high_f32(a), 0); } +template <> PX_FORCE_INLINE Vec4V V4SplatElement<3>(Vec4V a) { return vdupq_lane_f32(vget_high_f32(a), 1); } +#endif + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + const uint32x4_t ret = { x, y, z, w }; + return ret; +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return vdupq_n_u32(i); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return vld1q_u32(i); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + return vld1q_u32(i); +} + +PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) +{ + const float32x4_t ones = vdupq_n_f32(1.0f); + const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); + const float32x4_t rdToZeroPlusOne = vaddq_f32(rdToZero, ones); + const uint32x4_t gt = vcgtq_f32(in, rdToZero); + return vbslq_f32(gt, rdToZeroPlusOne, rdToZero); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) +{ + const float32x4_t ones = vdupq_n_f32(1.0f); + const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); + const float32x4_t rdToZeroMinusOne = vsubq_f32(rdToZero, ones); + const uint32x4_t lt = vcltq_f32(in, rdToZero); + return vbslq_f32(lt, rdToZeroMinusOne, rdToZero); +} + +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + + return vcvtq_u32_f32(in); +} + +PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) +{ + const FloatV one = FOne(); + const FloatV x = V4GetX(q); + const FloatV y = V4GetY(q); + const FloatV z = V4GetZ(q); + const FloatV w = V4GetW(q); + + const FloatV x2 = FAdd(x, x); + const FloatV y2 = FAdd(y, y); + const FloatV z2 = FAdd(z, z); + + const FloatV xx = FMul(x2, x); + const FloatV yy = FMul(y2, y); + const FloatV zz = FMul(z2, z); + + const FloatV xy = FMul(x2, y); + const FloatV xz = FMul(x2, z); + const FloatV xw = FMul(x2, w); + + const FloatV yz = FMul(y2, z); + const FloatV yw = FMul(y2, w); + const FloatV zw = FMul(z2, w); + + const FloatV v = FSub(one, xx); + + column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); + column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); + column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); +} + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXNEONINLINEAOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h new file mode 100644 index 0000000..97fc796 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2AoS.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXSSE2AOS_H +#define PXFOUNDATION_PXUNIXSSE2AOS_H + +// no includes here! this file should be included from PxcVecMath.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +namespace physx +{ +namespace aos +{ + +#if PX_EMSCRIPTEN || (PX_WINDOWS && PX_CLANG) +typedef int8_t __int8_t; +typedef int16_t __int16_t; +typedef int32_t __int32_t; +typedef int64_t __int64_t; +typedef uint16_t __uint16_t; +typedef uint32_t __uint32_t; +typedef uint64_t __uint64_t; +#endif + +typedef union UnionM128 +{ + UnionM128() + { + } + UnionM128(__m128 in) + { + m128 = in; + } + + UnionM128(__m128i in) + { + m128i = in; + } + + operator __m128() + { + return m128; + } + + operator const __m128() const + { + return m128; + } + + float m128_f32[4]; + __int8_t m128_i8[16]; + __int16_t m128_i16[8]; + __int32_t m128_i32[4]; + __int64_t m128_i64[2]; + __uint16_t m128_u16[8]; + __uint32_t m128_u32[4]; + __uint64_t m128_u64[2]; + __m128 m128; + __m128i m128i; +} UnionM128; + +typedef __m128 FloatV; +typedef __m128 Vec3V; +typedef __m128 Vec4V; +typedef __m128 BoolV; +typedef __m128 QuatV; +typedef __m128i VecI32V; +typedef UnionM128 VecU32V; +typedef UnionM128 VecU16V; +typedef UnionM128 VecI16V; +typedef UnionM128 VecU8V; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define VecU8VArg VecU8V & +#define QuatVArg QuatV & + +// Optimization for situations in which you cross product multiple vectors with the same vector. +// Avoids 2X shuffles per product +struct VecCrossV +{ + Vec3V mL1; + Vec3V mR1; +}; + +struct VecShiftV +{ + VecI32V shift; +}; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXSSE2AOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h new file mode 100644 index 0000000..ac77694 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/unix/sse2/PxUnixSse2InlineAoS.h @@ -0,0 +1,3274 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXUNIXSSE2INLINEAOS_H +#define PXFOUNDATION_PXUNIXSSE2INLINEAOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#ifdef __SSE4_2__ +#include "smmintrin.h" +#endif + +#include "../../PxVecMathSSE.h" + +namespace physx +{ +namespace aos +{ + +#define PX_FPCLASS_SNAN 0x0001 /* signaling NaN */ +#define PX_FPCLASS_QNAN 0x0002 /* quiet NaN */ +#define PX_FPCLASS_NINF 0x0004 /* negative infinity */ +#define PX_FPCLASS_PINF 0x0200 /* positive infinity */ + +PX_FORCE_INLINE __m128 m128_I2F(__m128i n) +{ + return _mm_castsi128_ps(n); +} +PX_FORCE_INLINE __m128i m128_F2I(__m128 n) +{ + return _mm_castps_si128(n); +} + +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////////////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE static bool isValidFloatV(const FloatV a) +{ + const PxF32 x = V4ReadX(a); + const PxF32 y = V4ReadY(a); + const PxF32 z = V4ReadZ(a); + const PxF32 w = V4ReadW(a); + + return (x == y && x == z && x == w); + + /*if ( + (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - z) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs(x - w) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + + if ( + (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - z) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && + (PxAbs((x - w) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) + ) + { + return true; + } + + return false;*/ +} + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + PX_ALIGN(16, PxF32 f[4]); + V4StoreA(a, f); + return (f[3] == 0.0f); +} + +PX_FORCE_INLINE bool isFiniteLength(const Vec3V a) +{ + return !FAllEq(V4LengthSq(a), FZero()); +} + +PX_FORCE_INLINE bool isAligned16(void* a) +{ + return(0 == (size_t(a) & 0x0f)); +} + +//ASSERT_FINITELENGTH is deactivated because there is a lot of code that calls a simd normalisation function with zero length but then ignores the result. + +#if PX_DEBUG +#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) +#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) +#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(reinterpret_cast(a))) +#define ASSERT_ISFINITELENGTH(a) //PX_ASSERT(isFiniteLength(a)) +#else +#define ASSERT_ISVALIDVEC3V(a) +#define ASSERT_ISVALIDFLOATV(a) +#define ASSERT_ISALIGNED16(a) +#define ASSERT_ISFINITELENGTH(a) +#endif + + +namespace internalUnitSSE2Simd +{ +PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask == 0xf); +} + +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) == 0x7); +} + +PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask != 0x0); +} + +PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) != 0x0); +} + +PX_FORCE_INLINE PxU32 FiniteTestEq(const Vec4V a, const Vec4V b) +{ + // This is a bit of a bodge. + //_mm_comieq_ss returns 1 if either value is nan so we need to re-cast a and b with true encoded as a non-nan + // number. + // There must be a better way of doing this in sse. + const BoolV one = FOne(); + const BoolV zero = FZero(); + const BoolV a1 = V4Sel(a, one, zero); + const BoolV b1 = V4Sel(b, one, zero); + return ( + _mm_comieq_ss(a1, b1) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 1, 1, 1)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(1, 1, 1, 1))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(2, 2, 2, 2)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(2, 2, 2, 2))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 3, 3, 3)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(3, 3, 3, 3)))); +} + +#if !PX_EMSCRIPTEN +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wglobal-constructors" +#endif +#endif +const PX_ALIGN(16, PxF32 gMaskXYZ[4]) = { physx::PxUnionCast(0xffffffff), physx::PxUnionCast(0xffffffff), + physx::PxUnionCast(0xffffffff), 0 }; +#if PX_CLANG +#if PX_LINUX +#pragma clang diagnostic pop +#endif +#endif +#else +// emscripten doesn't like the PxUnionCast data structure +// the following is what windows and xbox does -- using these for emscripten +const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; +#endif +} + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + const float f = 1.0f; + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_comieq_ss(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + return V3AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return V4AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalUnitSSE2Simd::BAllTrue4_R(VecI32V_IsEq(m128_F2I(a), m128_F2I(b))) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return internalUnitSSE2Simd::BAllTrue4_R(V4IsEqU32(a, b)) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + BoolV c = m128_I2F(_mm_cmpeq_epi32(a, b)); + return internalUnitSSE2Simd::BAllTrue4_R(c) != 0; +} + +#define VECMATH_AOS_EPSILON (1e-3f) + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + const FloatV c = FSub(a, b); + const FloatV minError = FLoad(-VECMATH_AOS_EPSILON); + const FloatV maxError = FLoad(VECMATH_AOS_EPSILON); + return _mm_comigt_ss(c, minError) && _mm_comilt_ss(c, maxError); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const Vec3V c = V3Sub(a, b); + const Vec3V minError = V3Load(-VECMATH_AOS_EPSILON); + const Vec3V maxError = V3Load(VECMATH_AOS_EPSILON); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError)); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const Vec4V c = V4Sub(a, b); + const Vec4V minError = V4Load(-VECMATH_AOS_EPSILON); + const Vec4V maxError = V4Load(VECMATH_AOS_EPSILON); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minError) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxError)); +} +} + +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const FloatV vBadNum = FLoad(badNumber); + const BoolV vMask = BAnd(vBadNum, a); + return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const Vec3V vBadNum = V3Load(badNumber); + const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); + return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + /*Vec4V a; + PX_ALIGN(16, PxF32 f[4]); + F32Array_Aligned_From_Vec4V(a, f); + return PxIsFinite(f[0]) + && PxIsFinite(f[1]) + && PxIsFinite(f[2]) + && PxIsFinite(f[3]);*/ + + PxF32 badNumber = + physx::PxUnionCast(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); + const Vec4V vBadNum = V4Load(badNumber); + const BoolV vMask = BAnd(vBadNum, a); + + return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; +} + +PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) ? true : false; +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero())); +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)), FZero())); +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + return _mm_set_ps(0.0f, f, f, f); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ + const PxU32 i = PxU32(-PxI32(f)); + return _mm_load1_ps(reinterpret_cast(&i)); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(const_cast(&f)); +#if !PX_EMSCRIPTEN + return _mm_and_ps(reinterpret_cast(f), V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); +#else + return _mm_and_ps((Vec3V&)f, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); +#endif +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(const_cast(&f)); + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(const_cast(f)); +#if !PX_EMSCRIPTEN + return _mm_and_ps(V4LoadA(f), V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); +#else + return _mm_and_ps((Vec3V&)*f, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); +#endif +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i) +{ + return _mm_set_ps(0.0f, i[2], i[1], i[0]); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) +{ + return V4ClearW(v); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) +{ + return v; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return f; // ok if it is implemented as the same type. +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return f; +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + ASSERT_ISVALIDVEC3V(f); + return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(const_cast(f)); + return _mm_load_ps(f); +} + +PX_FORCE_INLINE void V4StoreA(Vec4V a, PxF32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps(f, a); +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + _mm_storeu_ps(f, a); +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps(reinterpret_cast(f), a); +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + _mm_store_ps(reinterpret_cast(u), uv); +} + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return _mm_set_epi32(w, z, y, x); +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + _mm_store_ps(reinterpret_cast(i), m128_I2F(iv)); +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return _mm_loadu_ps(f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxI32) b[4] = { -PxI32(f[0]), -PxI32(f[1]), -PxI32(f[2]), -PxI32(f[3]) }; + return _mm_load_ps(reinterpret_cast(&b)); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + ASSERT_ISVALIDFLOATV(a); + _mm_store_ss(f, a); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32) f2[4]; + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32) f2[4]; + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) +{ + _mm_store_ss(reinterpret_cast(b2), b); +} + +PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) +{ + return _mm_load1_ps(reinterpret_cast(&i)); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return _mm_loadu_ps(reinterpret_cast(i)); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + ASSERT_ISALIGNED16(const_cast(i)); + return _mm_load_ps(reinterpret_cast(i)); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return FLoad(0.0f); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV IZero() +{ + const PxU32 zero = 0; + return _mm_load1_ps(reinterpret_cast(&zero)); +} + +PX_FORCE_INLINE FloatV IOne() +{ + const PxU32 one = 1; + return _mm_load1_ps(reinterpret_cast(&one)); +} + +PX_FORCE_INLINE FloatV ITwo() +{ + const PxU32 two = 2; + return _mm_load1_ps(reinterpret_cast(&two)); +} + +PX_FORCE_INLINE FloatV IThree() +{ + const PxU32 three = 3; + return _mm_load1_ps(reinterpret_cast(&three)); +} + +PX_FORCE_INLINE FloatV IFour() +{ + PxU32 four = 4; + return _mm_load1_ps(reinterpret_cast(&four)); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); +/* + if(!isValidFloatV(a)) + { +assert(false); + } + if(!isValidFloatV(b)) + { +assert(false); + } +*/ + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), a); +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FAdd(FMul(a, b), c); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FSub(c, FMul(a, b)); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + PX_ALIGN(16, const PxU32) absMask[4] = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; + return _mm_and_ps(a, _mm_load_ps(reinterpret_cast(absMask))); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + PX_ASSERT(vecMathTests::allElementsEqualBoolV(c,BTTTT()) || + vecMathTests::allElementsEqualBoolV(c,BFFFF())); + ASSERT_ISVALIDFLOATV(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + ASSERT_ISVALIDFLOATV(minV); + ASSERT_ISVALIDFLOATV(maxV); + return _mm_max_ps(_mm_min_ps(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comigt_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comige_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comieq_ss(a, b)); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const FloatV half = FLoad(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const FloatV aRound = FSub(FAdd(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V3 = FMul(V2, V1); + const FloatV V5 = FMul(V3, V2); + const FloatV V7 = FMul(V5, V2); + const FloatV V9 = FMul(V7, V2); + const FloatV V11 = FMul(V9, V2); + const FloatV V13 = FMul(V11, V2); + const FloatV V15 = FMul(V13, V2); + const FloatV V17 = FMul(V15, V2); + const FloatV V19 = FMul(V17, V2); + const FloatV V21 = FMul(V19, V2); + const FloatV V23 = FMul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + FloatV Result; + Result = FScaleAdd(S1, V3, V1); + Result = FScaleAdd(S2, V5, Result); + Result = FScaleAdd(S3, V7, Result); + Result = FScaleAdd(S4, V9, Result); + Result = FScaleAdd(S5, V11, Result); + Result = FScaleAdd(S6, V13, Result); + Result = FScaleAdd(S7, V15, Result); + Result = FScaleAdd(S8, V17, Result); + Result = FScaleAdd(S9, V19, Result); + Result = FScaleAdd(S10, V21, Result); + Result = FScaleAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V4 = FMul(V2, V2); + const FloatV V6 = FMul(V4, V2); + const FloatV V8 = FMul(V4, V4); + const FloatV V10 = FMul(V6, V4); + const FloatV V12 = FMul(V6, V6); + const FloatV V14 = FMul(V8, V6); + const FloatV V16 = FMul(V8, V8); + const FloatV V18 = FMul(V10, V8); + const FloatV V20 = FMul(V10, V10); + const FloatV V22 = FMul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + FloatV Result; + Result = FScaleAdd(C1, V2, V4One()); + Result = FScaleAdd(C2, V4, Result); + Result = FScaleAdd(C3, V6, Result); + Result = FScaleAdd(C4, V8, Result); + Result = FScaleAdd(C5, V10, Result); + Result = FScaleAdd(C6, V12, Result); + Result = FScaleAdd(C7, V14, Result); + Result = FScaleAdd(C8, V16, Result); + Result = FScaleAdd(C9, V18, Result); + Result = FScaleAdd(C10, V20, Result); + Result = FScaleAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); + return !BAllEqFFFF(c); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max) + const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FOutOfBounds(a, FNeg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FInBounds(a, FNeg(bounds), bounds); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + const __m128 zero = FZero(); + const __m128 fff0 = _mm_move_ss(f, zero); + return _mm_shuffle_ps(fff0, fff0, _MM_SHUFFLE(0, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + // static on zero causes compiler crash on x64 debug_opt + const __m128 zero = FZero(); + const __m128 xy = _mm_move_ss(x, y); + const __m128 z0 = _mm_move_ss(zero, z); + + return _mm_shuffle_ps(xy, z0, _MM_SHUFFLE(1, 0, 0, 1)); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f) + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 0, 3, 0)); + return V3SetY(r, V3GetX(b)); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c) + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 1, 3, 1)); + return V3SetY(r, V3GetY(b)); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 2, 3, 2)); + return V3SetY(r, V3GetZ(b)); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return V3Load(0.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_div_ps(a, b)); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_mul_ps(a, _mm_rcp_ps(b))); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rcp_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), _mm_sqrt_ps(a)); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rsqrt_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Scale(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Scale(a, b)); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Mul(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Mul(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Max(a, V3Neg(a)); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0x7f); +#else + const __m128 t0 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); // ay*by | ax*bx | aw*bw | az*bz + const __m128 t2 = _mm_add_ps(t0, t1); // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + return _mm_add_ps(t3, t2); // ax*bx + az*bz + ay*by + aw*bw + // ay*by + aw*bw + ax*bx + az*bz + // az*bz + ax*bx + aw*bw + ay*by + // aw*bw + ay*by + az*bz + ax*bx +#endif +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + VecCrossV v; + v.mR1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + v.mL1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + return v; +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(b); + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(a.mL1, l2), _mm_mul_ps(a.mR1, r2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const VecCrossV& b) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 r2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(b.mR1, r2), _mm_mul_ps(b.mL1, l2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const VecCrossV& b) +{ + return _mm_sub_ps(_mm_mul_ps(a.mL1, b.mR1), _mm_mul_ps(a.mR1, b.mL1)); +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_sqrt_ps(V3Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Dot(a, a); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3ScaleInv(a, _mm_sqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3Scale(a, _mm_rsqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 eps = V4Eps(); + const __m128 length = V3Length(a); + const __m128 isGreaterThanZero = FIsGrtr(length, eps); + return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + + return _mm_max_ps(_mm_max_ps(shuf1, shuf2), shuf3); +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + + return _mm_min_ps(_mm_min_ps(shuf1, shuf2), shuf3); +} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 one = V3One(); + const __m128 none = V3Neg(one); + return V3Sel(V3IsGrtrOrEq(a, zero), one, none); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + ASSERT_ISVALIDVEC3V(maxV); + ASSERT_ISVALIDVEC3V(minV); + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalUnitSSE2Simd::BAllTrue3_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const Vec3V half = V3Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec3V aRound = V3Sub(V3Add(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V3 = V3Mul(V2, V1); + const Vec3V V5 = V3Mul(V3, V2); + const Vec3V V7 = V3Mul(V5, V2); + const Vec3V V9 = V3Mul(V7, V2); + const Vec3V V11 = V3Mul(V9, V2); + const Vec3V V13 = V3Mul(V11, V2); + const Vec3V V15 = V3Mul(V13, V2); + const Vec3V V17 = V3Mul(V15, V2); + const Vec3V V19 = V3Mul(V17, V2); + const Vec3V V21 = V3Mul(V19, V2); + const Vec3V V23 = V3Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V3, S1, V1); + Result = V3ScaleAdd(V5, S2, Result); + Result = V3ScaleAdd(V7, S3, Result); + Result = V3ScaleAdd(V9, S4, Result); + Result = V3ScaleAdd(V11, S5, Result); + Result = V3ScaleAdd(V13, S6, Result); + Result = V3ScaleAdd(V15, S7, Result); + Result = V3ScaleAdd(V17, S8, Result); + Result = V3ScaleAdd(V19, S9, Result); + Result = V3ScaleAdd(V21, S10, Result); + Result = V3ScaleAdd(V23, S11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V4 = V3Mul(V2, V2); + const Vec3V V6 = V3Mul(V4, V2); + const Vec3V V8 = V3Mul(V4, V4); + const Vec3V V10 = V3Mul(V6, V4); + const Vec3V V12 = V3Mul(V6, V6); + const Vec3V V14 = V3Mul(V8, V6); + const Vec3V V16 = V3Mul(V8, V8); + const Vec3V V18 = V3Mul(V10, V8); + const Vec3V V20 = V3Mul(V10, V10); + const Vec3V V22 = V3Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V2, C1, V3One()); + Result = V3ScaleAdd(V4, C2, Result); + Result = V3ScaleAdd(V6, C3, Result); + Result = V3ScaleAdd(V8, C4, Result); + Result = V3ScaleAdd(V10, C5, Result); + Result = V3ScaleAdd(V12, C6, Result); + Result = V3ScaleAdd(V14, C7, Result); + Result = V3ScaleAdd(V16, C8, Result); + Result = V3ScaleAdd(V18, C9, Result); + Result = V3ScaleAdd(V20, C10, Result); + Result = V3ScaleAdd(V22, C11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 1, 0)); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 0, 1)); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v1, v0, _MM_SHUFFLE(3, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v0, v1, _MM_SHUFFLE(3, 0, 3, 2)); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + // There must be a better way to do this. + Vec3V v2 = V3Zero(); + FloatV y1 = V3GetY(v1); + FloatV x0 = V3GetX(v0); + v2 = V3SetX(v2, y1); + return V3SetY(v2, x0); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); +#ifdef __SSE4_2__ + Vec3V r = _mm_hadd_ps(a, a); + r = _mm_hadd_ps(r, r); + return r; +#else + __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w + __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z + __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); +#endif +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); + return !BAllEqFFFF(c); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + return V3OutOfBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds) + return V3InBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + ASSERT_ISVALIDVEC3V(col0); + ASSERT_ISVALIDVEC3V(col1); + ASSERT_ISVALIDVEC3V(col2); + + const Vec3V col3 = _mm_setzero_ps(); + Vec3V tmp0 = _mm_unpacklo_ps(col0, col1); + Vec3V tmp2 = _mm_unpacklo_ps(col2, col3); + Vec3V tmp1 = _mm_unpackhi_ps(col0, col1); + Vec3V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + // return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0,0,0,0)); + return f; +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + ASSERT_ISVALIDFLOATV(floatVArray[0]); + ASSERT_ISVALIDFLOATV(floatVArray[1]); + ASSERT_ISVALIDFLOATV(floatVArray[2]); + ASSERT_ISVALIDFLOATV(floatVArray[3]); + const __m128 xw = _mm_move_ss(floatVArray[1], floatVArray[0]); // y, y, y, x + const __m128 yz = _mm_move_ss(floatVArray[2], floatVArray[3]); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + ASSERT_ISVALIDFLOATV(w); + const __m128 xw = _mm_move_ss(y, x); // y, y, y, x + const __m128 yz = _mm_move_ss(z, w); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpacklo_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpackhi_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const PX_ALIGN(16, PxF32) w[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; + const __m128 w128 = _mm_load_ps(w); + return w128; +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTTF(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ +#if !PX_EMSCRIPTEN + return _mm_and_ps(v, V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); +#else + return _mm_and_ps(v, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); +#endif +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 0, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 0, 2, 0)); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 3, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(w, z, y, x)); +} + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return V4Load(0.0f); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return V4Load(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) +{ + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return _mm_div_ps(V4One(), a); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return _mm_div_ps(V4One(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Add(V4Scale(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Sub(c, V4Scale(a, b)); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Add(V4Mul(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Sub(c, V4Mul(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return V4Max(a, V4Neg(a)); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ +#ifdef __SSE4_2__ + Vec4V r = _mm_hadd_ps(a, a); + r = _mm_hadd_ps(r, r); + return r; +#else + const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y + const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w + const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w + const FloatV xz = V4GetX(xz_yw); // x+z + const FloatV yw = V4GetZ(xz_yw); // y+w + return FAdd(xz, yw); // sum +#endif +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0xff); +#else + //const __m128 dot1 = _mm_mul_ps(a, b); // x,y,z,w + //const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 1, 0, 3)); // w,x,y,z + //const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 0, 3, 2)); // z,w,x,y + //const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 3, 2, 1)); // y,z,w,x + //return _mm_add_ps(_mm_add_ps(shuf2, shuf3), _mm_add_ps(dot1, shuf1)); + + // aw*bw | az*bz | ay*by | ax*bx + const __m128 t0 = _mm_mul_ps(a, b); + // ay*by | ax*bx | aw*bw | az*bz + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1, 0, 3, 2)); + // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t2 = _mm_add_ps(t0, t1); + // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2, 3, 0, 1)); + // ax*bx + az*bz + ay*by + aw*bw + return _mm_add_ps(t3, t2); +#endif +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) +{ +#ifdef __SSE4_2__ + return _mm_dp_ps(a, b, 0x7f); +#else + const __m128 dot1 = _mm_mul_ps(a, b); // w,z,y,x + const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w + const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z + const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); +#endif +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + return _mm_sqrt_ps(V4Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInv(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInvFast(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec3V unsafeReturnValue) +{ + const __m128 eps = V3Eps(); + const __m128 length = V4Length(a); + const __m128 isGreaterThanZero = V4IsGrtr(length, eps); + return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return m128_I2F(_mm_cmpeq_epi32(m128_F2I(a), m128_F2I(b))); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_max_ps(_mm_max_ps(a, shuf1), _mm_max_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_min_ps(_mm_min_ps(a, shuf1), _mm_min_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return internalUnitSSE2Simd::BAllTrue4_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return internalUnitSSE2Simd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return internalUnitSSE2Simd::BAllTrue4_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return internalUnitSSE2Simd::BAnyTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ +#ifdef __SSE4_2__ + return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); +#else + // return _mm_round_ps(a, 0x0); + const Vec4V half = V4Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec4V aRound = V4Sub(V4Add(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +#endif +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V3 = V4Mul(V2, V1); + const Vec4V V5 = V4Mul(V3, V2); + const Vec4V V7 = V4Mul(V5, V2); + const Vec4V V9 = V4Mul(V7, V2); + const Vec4V V11 = V4Mul(V9, V2); + const Vec4V V13 = V4Mul(V11, V2); + const Vec4V V15 = V4Mul(V13, V2); + const Vec4V V17 = V4Mul(V15, V2); + const Vec4V V19 = V4Mul(V17, V2); + const Vec4V V21 = V4Mul(V19, V2); + const Vec4V V23 = V4Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec4V Result; + Result = V4MulAdd(S1, V3, V1); + Result = V4MulAdd(S2, V5, Result); + Result = V4MulAdd(S3, V7, Result); + Result = V4MulAdd(S4, V9, Result); + Result = V4MulAdd(S5, V11, Result); + Result = V4MulAdd(S6, V13, Result); + Result = V4MulAdd(S7, V15, Result); + Result = V4MulAdd(S8, V17, Result); + Result = V4MulAdd(S9, V19, Result); + Result = V4MulAdd(S10, V21, Result); + Result = V4MulAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V4 = V4Mul(V2, V2); + const Vec4V V6 = V4Mul(V4, V2); + const Vec4V V8 = V4Mul(V4, V4); + const Vec4V V10 = V4Mul(V6, V4); + const Vec4V V12 = V4Mul(V6, V6); + const Vec4V V14 = V4Mul(V8, V6); + const Vec4V V16 = V4Mul(V8, V8); + const Vec4V V18 = V4Mul(V10, V8); + const Vec4V V20 = V4Mul(V10, V10); + const Vec4V V22 = V4Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec4V Result; + Result = V4MulAdd(C1, V2, V4One()); + Result = V4MulAdd(C2, V4, Result); + Result = V4MulAdd(C3, V6, Result); + Result = V4MulAdd(C4, V8, Result); + Result = V4MulAdd(C5, V10, Result); + Result = V4MulAdd(C6, V12, Result); + Result = V4MulAdd(C7, V14, Result); + Result = V4MulAdd(C8, V16, Result); + Result = V4MulAdd(C9, V18, Result); + Result = V4MulAdd(C10, V20, Result); + Result = V4MulAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + Vec4V tmp0 = _mm_unpacklo_ps(col0, col1); + Vec4V tmp2 = _mm_unpacklo_ps(col2, col3); + Vec4V tmp1 = _mm_unpackhi_ps(col0, col1); + Vec4V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); + col3 = _mm_movehl_ps(tmp3, tmp1); +} + +////////////////////////////////// +// BoolV +////////////////////////////////// + +PX_FORCE_INLINE BoolV BFFFF() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE BoolV BFFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fftt=_mm_load_ps((float*)&f); + return fftt;*/ + return m128_I2F(_mm_set_epi32(-1, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ftft=_mm_load_ps((float*)&f); + return ftft;*/ + return m128_I2F(_mm_set_epi32(-1, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 fttf=_mm_load_ps((float*)&f); + return fttf;*/ + return m128_I2F(_mm_set_epi32(0, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fttt=_mm_load_ps((float*)&f); + return fttt;*/ + return m128_I2F(_mm_set_epi32(-1, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BTFFF() +{ + // const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + // const __m128 tfff=_mm_load_ps((float*)&f); + // return tfff; + return m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0xFFFFFFFF}; + const __m128 tfft=_mm_load_ps((float*)&f); + return tfft;*/ + return m128_I2F(_mm_set_epi32(-1, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0}; + const __m128 tftf=_mm_load_ps((float*)&f); + return tftf;*/ + return m128_I2F(_mm_set_epi32(0, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tftt=_mm_load_ps((float*)&f); + return tftt;*/ + return m128_I2F(_mm_set_epi32(-1, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0}; + const __m128 ttff=_mm_load_ps((float*)&f); + return ttff;*/ + return m128_I2F(_mm_set_epi32(0, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ttft=_mm_load_ps((float*)&f); + return ttft;*/ + return m128_I2F(_mm_set_epi32(-1, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 tttf=_mm_load_ps((float*)&f); + return tttf;*/ + return m128_I2F(_mm_set_epi32(0, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tttt=_mm_load_ps((float*)&f); + return tttt;*/ + return m128_I2F(_mm_set_epi32(-1, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + const __m128 tfff=_mm_load_ps((float*)&f); + return tfff;*/ + return m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BYMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BZMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BWMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return V4Sel(BTTTF(), v, f); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return _mm_and_ps(a, b); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + const BoolV bAllTrue(BTTTT()); + return _mm_xor_ps(a, bAllTrue); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + return _mm_andnot_ps(b, a); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return _mm_or_ps(a, b); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + const BoolV bTmp = + _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + const BoolV bTmp = + _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + const BoolV bTmp = + _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + const BoolV bTmp = + _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + const BoolV bTest = m128_I2F(_mm_cmpeq_epi32(m128_F2I(a), m128_F2I(b))); + return internalUnitSSE2Simd::BAllTrue4_R(bTest); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==15); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==0); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const BoolV tfft = BTFFT(); + const BoolV tttf = BTTTF(); + const FloatV zero = FZero(); + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = _mm_rcp_ps(dot); + const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); + const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); + Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); + colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); + const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); + const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); + const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); + const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); + const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); + const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); + + return Mat33V(_mm_mul_ps(colInv0, invDet), _mm_mul_ps(colInv1, invDet), _mm_mul_ps(colInv2, invDet)); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) +{ + const BoolV bTFFF = BTFFF(); + const BoolV bFTFF = BFTFF(); + const BoolV bFFTF = BTFTF(); + + const Vec3V zero = V3Zero(); + + return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const FloatV x = V3Mul(V3UnitX(), d); + const FloatV y = V3Mul(V3UnitY(), d); + const FloatV z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); + return V3Add(v0PlusV1Plusv2, a.col3); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3Dot(a.col0, b); + const FloatV y = V3Dot(a.col1, b); + const FloatV z = V3Dot(a.col2, b); + return V3Merge(x, y, z); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), + V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), + V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const FloatV w = V4GetW(b); + + const Vec4V v0 = V4Scale(a.col0, x); + const Vec4V v1 = V4Scale(a.col1, y); + const Vec4V v2 = V4Scale(a.col2, z); + const Vec4V v3 = V4Scale(a.col3, w); + const Vec4V v0PlusV1 = V4Add(v0, v1); + const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); + return V4Add(v0PlusV1Plusv2, v3); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + PX_ALIGN(16, FloatV) dotProdArray[4] = { V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b) }; + return V4Merge(dotProdArray); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + const Vec4V v0 = _mm_unpacklo_ps(a.col0, a.col2); + const Vec4V v1 = _mm_unpackhi_ps(a.col0, a.col2); + const Vec4V v2 = _mm_unpacklo_ps(a.col1, a.col3); + const Vec4V v3 = _mm_unpackhi_ps(a.col1, a.col3); + return Mat44V(_mm_unpacklo_ps(v0, v2), _mm_unpackhi_ps(v0, v2), _mm_unpacklo_ps(v1, v3), _mm_unpackhi_ps(v1, v3)); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + __m128 minor0, minor1, minor2, minor3; + __m128 row0, row1, row2, row3; + __m128 det, tmp1; + + tmp1 = V4Zero(); + row1 = V4Zero(); + row3 = V4Zero(); + + row0 = a.col0; + row1 = _mm_shuffle_ps(a.col1, a.col1, _MM_SHUFFLE(1, 0, 3, 2)); + row2 = a.col2; + row3 = _mm_shuffle_ps(a.col3, a.col3, _MM_SHUFFLE(1, 0, 3, 2)); + + tmp1 = _mm_mul_ps(row2, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_mul_ps(row1, tmp1); + minor1 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0); + minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1); + minor1 = _mm_shuffle_ps(minor1, minor1, 0x4E); + + tmp1 = _mm_mul_ps(row1, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0); + minor3 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3); + minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E); + + tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, 0x4E), row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + row2 = _mm_shuffle_ps(row2, row2, 0x4E); + minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0); + minor2 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2); + minor2 = _mm_shuffle_ps(minor2, minor2, 0x4E); + + tmp1 = _mm_mul_ps(row0, row1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1)); + + tmp1 = _mm_mul_ps(row0, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1); + minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1)); + + tmp1 = _mm_mul_ps(row0, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1)); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3); + + det = _mm_mul_ps(row0, minor0); + det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det); + det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det); + tmp1 = _mm_rcp_ss(det); +#if 0 + det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1))); + det = _mm_shuffle_ps(det, det, 0x00); +#else + det = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(0, 0, 0, 0)); +#endif + + minor0 = _mm_mul_ps(det, minor0); + minor1 = _mm_mul_ps(det, minor1); + minor2 = _mm_mul_ps(det, minor2); + minor3 = _mm_mul_ps(det, minor3); + Mat44V invTrans(minor0, minor1, minor2, minor3); + return M44Trnsps(invTrans); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + return _mm_set_ps(w, z, y, x); +} + +/* +// AP: work in progress - use proper SSE intrinsics where possible +PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) +{ + VecU16V result; + result.m128_u16[0] = PxU16(PxClamp((a).m128_u32[0], 0, 0xFFFF)); + result.m128_u16[1] = PxU16(PxClamp((a).m128_u32[1], 0, 0xFFFF)); + result.m128_u16[2] = PxU16(PxClamp((a).m128_u32[2], 0, 0xFFFF)); + result.m128_u16[3] = PxU16(PxClamp((a).m128_u32[3], 0, 0xFFFF)); + result.m128_u16[4] = PxU16(PxClamp((b).m128_u32[0], 0, 0xFFFF)); + result.m128_u16[5] = PxU16(PxClamp((b).m128_u32[1], 0, 0xFFFF)); + result.m128_u16[6] = PxU16(PxClamp((b).m128_u32[2], 0, 0xFFFF)); + result.m128_u16[7] = PxU16(PxClamp((b).m128_u32[3], 0, 0xFFFF)); + return result; +} +*/ + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return m128_I2F(_mm_or_si128(_mm_andnot_si128(m128_F2I(c), m128_F2I(b)), _mm_and_si128(m128_F2I(c), m128_F2I(a)))); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return m128_I2F(_mm_or_si128(m128_F2I(a), m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return m128_I2F(_mm_xor_si128(m128_F2I(a), m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return m128_I2F(_mm_and_si128(m128_F2I(a), m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + return m128_I2F(_mm_andnot_si128(m128_F2I(b), m128_F2I(a))); +} + +/* +PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_or_si128(m128_F2I(a), m128_F2I(b))); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_and_si128(m128_F2I(a), m128_F2I(b))); +} +*/ + +/* +PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_andnot_si128(m128_F2I(b), m128_F2I(a))); +} +*/ + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return m128_F2I(_mm_load1_ps(reinterpret_cast(&i))); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return m128_F2I(_mm_loadu_ps(reinterpret_cast(i))); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + return m128_F2I(_mm_load_ps(reinterpret_cast(i))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_add_epi32(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_sub_epi32(a, b); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return m128_I2F(_mm_cmpgt_epi32(a, b)); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return m128_I2F(_mm_cmpeq_epi32(a, b)); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return _mm_or_si128(_mm_andnot_si128(m128_F2I(c), b), _mm_and_si128(m128_F2I(c), a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return _mm_setzero_si128(); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return I4Load(1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return I4Load(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return I4Load(-1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return U4Load(0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return U4Load(1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return U4Load(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + return _mm_or_si128(_mm_andnot_si128(m128_F2I(c), b), _mm_and_si128(m128_F2I(c), a)); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + VecShiftV s; + s.shift = VecI32V_Sel(BTFFF(), shift, VecI32V_Zero()); + return s; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return _mm_sll_epi32(a, count.shift); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return _mm_srl_epi32(a, count.shift); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return _mm_slli_epi32(a, PxI32(count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return _mm_srai_epi32(a, PxI32(count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_and_si128(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return _mm_or_si128(a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(0, 0, 0, 0))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(2, 2, 2, 2))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(3, 3, 3, 3))); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + _mm_store_ss(reinterpret_cast(i), m128_I2F(a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg x, const VecI32VArg y, const VecI32VArg z, const VecI32VArg w) +{ + const __m128 xw = _mm_move_ss(m128_I2F(y), m128_I2F(x)); // y, y, y, x + const __m128 yz = _mm_move_ss(m128_I2F(z), m128_I2F(w)); // z, z, z, w + return m128_F2I(_mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0))); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return m128_F2I(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +/* +template PX_FORCE_INLINE VecI32V V4ISplat() +{ + VecI32V result; + result.m128_i32[0] = a; + result.m128_i32[1] = a; + result.m128_i32[2] = a; + result.m128_i32[3] = a; + return result; +} + +template PX_FORCE_INLINE VecU32V V4USplat() +{ + VecU32V result; + result.m128_u32[0] = a; + result.m128_u32[1] = a; + result.m128_u32[2] = a; + result.m128_u32[3] = a; + return result; +} +*/ + +/* +PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) +{ + *address = val; +} +*/ + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) +{ + return V4LoadU(reinterpret_cast(addr)); +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + VecU32V result32(a); + result32 = V4U32Andc(result32, b); + return Vec4V(result32); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return V4IsGrtr(a, b); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + // _mm_cmpgt_epi16 doesn't work for unsigned values unfortunately + // return m128_I2F(_mm_cmpgt_epi16(m128_F2I(a), m128_F2I(b))); + VecU16V result; + result.m128_u16[0] = (a).m128_u16[0] > (b).m128_u16[0]; + result.m128_u16[1] = (a).m128_u16[1] > (b).m128_u16[1]; + result.m128_u16[2] = (a).m128_u16[2] > (b).m128_u16[2]; + result.m128_u16[3] = (a).m128_u16[3] > (b).m128_u16[3]; + result.m128_u16[4] = (a).m128_u16[4] > (b).m128_u16[4]; + result.m128_u16[5] = (a).m128_u16[5] > (b).m128_u16[5]; + result.m128_u16[6] = (a).m128_u16[6] > (b).m128_u16[6]; + result.m128_u16[7] = (a).m128_u16[7] > (b).m128_u16[7]; + return result; +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) +{ + return m128_I2F(_mm_cmpgt_epi16(m128_F2I(a), m128_F2I(b))); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + Vec4V result = V4LoadXYZW(PxF32(a.m128_u32[0]), PxF32(a.m128_u32[1]), PxF32(a.m128_u32[2]), PxF32(a.m128_u32[3])); + return result; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V in) +{ + return _mm_cvtepi32_ps(in); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return _mm_cvttps_epi32(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return m128_I2F(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecU32V(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return m128_F2I(a); +} + +/* +template PX_FORCE_INLINE BoolV BSplatElement(BoolV a) +{ + BoolV result; + result[0] = result[1] = result[2] = result[3] = a[index]; + return result; +} +*/ + +template +BoolV BSplatElement(BoolV a) +{ + float* data = reinterpret_cast(&a); + return V4Load(data[index]); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + VecU32V result; + result.m128_u32[0] = result.m128_u32[1] = result.m128_u32[2] = result.m128_u32[3] = a.m128_u32[index]; + return result; +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + float* data = reinterpret_cast(&a); + return V4Load(data[index]); +} + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + VecU32V result; + result.m128_u32[0] = x; + result.m128_u32[1] = y; + result.m128_u32[2] = z; + result.m128_u32[3] = w; + return result; +} + +PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) +{ + UnionM128 a(in); + return V4LoadXYZW(PxCeil(a.m128_f32[0]), PxCeil(a.m128_f32[1]), PxCeil(a.m128_f32[2]), PxCeil(a.m128_f32[3])); +} + +PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) +{ + UnionM128 a(in); + return V4LoadXYZW(PxFloor(a.m128_f32[0]), PxFloor(a.m128_f32[1]), PxFloor(a.m128_f32[2]), PxFloor(a.m128_f32[3])); +} + +PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) +{ + PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); + PX_UNUSED(power); // prevent warning in release builds + PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); + UnionM128 a(in); + VecU32V result; + result.m128_u32[0] = PxU32(PxClamp((a).m128_f32[0], 0.0f, ffffFFFFasFloat)); + result.m128_u32[1] = PxU32(PxClamp((a).m128_f32[1], 0.0f, ffffFFFFasFloat)); + result.m128_u32[2] = PxU32(PxClamp((a).m128_f32[2], 0.0f, ffffFFFFasFloat)); + result.m128_u32[3] = PxU32(PxClamp((a).m128_f32[3], 0.0f, ffffFFFFasFloat)); + return result; +} + +} // namespace aos +} // namespace physx + +#endif // PXFOUNDATION_PXUNIXSSE2INLINEAOS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsAoS.h new file mode 100644 index 0000000..13175e3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsAoS.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_AOS_H +#define PX_WINDOWS_AOS_H + +// no includes here! this file should be included from PxAOS.h only!!! + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif +namespace aos +{ + +typedef __m128 FloatV; +typedef __m128 Vec3V; +typedef __m128 Vec4V; +typedef __m128 BoolV; +typedef __m128 VecU32V; +typedef __m128 VecI32V; +typedef __m128 VecU16V; +typedef __m128 VecI16V; +typedef __m128 QuatV; + +#define FloatVArg FloatV & +#define Vec3VArg Vec3V & +#define Vec4VArg Vec4V & +#define BoolVArg BoolV & +#define VecU32VArg VecU32V & +#define VecI32VArg VecI32V & +#define VecU16VArg VecU16V & +#define VecI16VArg VecI16V & +#define QuatVArg QuatV & + +// Optimization for situations in which you cross product multiple vectors with the same vector. +// Avoids 2X shuffles per product +struct VecCrossV +{ + Vec3V mL1; + Vec3V mR1; +}; + +struct VecShiftV +{ + VecI32V shift; +}; +#define VecShiftVArg VecShiftV & + +PX_ALIGN_PREFIX(16) +struct Mat33V +{ + Mat33V() + { + } + Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat34V +{ + Mat34V() + { + } + Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec3V PX_ALIGN(16, col0); + Vec3V PX_ALIGN(16, col1); + Vec3V PX_ALIGN(16, col2); + Vec3V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat43V +{ + Mat43V() + { + } + Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct Mat44V +{ + Mat44V() + { + } + Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) + { + } + Vec4V PX_ALIGN(16, col0); + Vec4V PX_ALIGN(16, col1); + Vec4V PX_ALIGN(16, col2); + Vec4V PX_ALIGN(16, col3); +} PX_ALIGN_SUFFIX(16); + +} // namespace aos +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsFPU.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsFPU.h new file mode 100644 index 0000000..f70383e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsFPU.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_FPU_H +#define PX_WINDOWS_FPU_H + +PX_INLINE physx::PxSIMDGuard::PxSIMDGuard(bool enable) : mEnabled(enable) +{ +#if !PX_ARM && !PX_A64 + if (enable) + { + mControlWord = _mm_getcsr(); + // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) + _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); + } + else + { + PX_ASSERT(_mm_getcsr() & _MM_FLUSH_ZERO_ON); + PX_ASSERT(_mm_getcsr() & (1 << 6)); + PX_ASSERT(_mm_getcsr() & _MM_MASK_MASK); + } +#endif +} + +PX_INLINE physx::PxSIMDGuard::~PxSIMDGuard() +{ +#if !PX_ARM && !PX_A64 + if (mEnabled) + { + // restore control word and clear any exception flags + // (setting exception state flags cause exceptions on the first following fp operation) + _mm_setcsr(mControlWord & ~_MM_EXCEPT_MASK); + } +#endif +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInclude.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInclude.h new file mode 100644 index 0000000..992a5a6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInclude.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_INCLUDE_H +#define PX_WINDOWS_INCLUDE_H + +#ifndef _WIN32 +#error "This file should only be included by Windows builds!!" +#endif + +#ifdef _WINDOWS_ // windows already included +#error "Only include windows.h through this file!!" +#endif + +// We only support >= Windows XP, and we need this for critical section and +// Setting this hides some important APIs (e.g. LoadPackagedLibrary), so don't do it +#define _WIN32_WINNT 0x0501 + +// turn off as much as we can for windows. All we really need is the thread functions(critical sections/Interlocked* +// etc) +#define NOGDICAPMASKS +#define NOVIRTUALKEYCODES +#define NOWINMESSAGES +#define NOWINSTYLES +#define NOSYSMETRICS +#define NOMENUS +#define NOICONS +#define NOKEYSTATES +#define NOSYSCOMMANDS +#define NORASTEROPS +#define NOSHOWWINDOW +#define NOATOM +#define NOCLIPBOARD +#define NOCOLOR +#define NOCTLMGR +#define NODRAWTEXT +#define NOGDI +#define NOMB +#define NOMEMMGR +#define NOMETAFILE +#define NOMINMAX +#define NOOPENFILE +#define NOSCROLL +#define NOSERVICE +#define NOSOUND +#define NOTEXTMETRIC +#define NOWH +#define NOWINOFFSETS +#define NOCOMM +#define NOKANJI +#define NOHELP +#define NOPROFILER +#define NODEFERWINDOWPOS +#define NOMCX +#define WIN32_LEAN_AND_MEAN +// We need a slightly wider API surface for e.g. MultiByteToWideChar +#define NOUSER +#define NONLS +#define NOMSG + +#pragma warning(push) +#pragma warning(disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#include +#pragma warning(pop) + +#if PX_SSE2 +#include +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInlineAoS.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInlineAoS.h new file mode 100644 index 0000000..b2920da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsInlineAoS.h @@ -0,0 +1,3155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_INLINE_AOS_H +#define PX_WINDOWS_INLINE_AOS_H + +#if !COMPILE_VECTOR_INTRINSICS +#error Vector intrinsics should not be included when using scalar implementation. +#endif + +#include "../PxVecMathSSE.h" + +namespace physx +{ +namespace aos +{ + +////////////////////////////////////////////////////////////////////// +//Test that Vec3V and FloatV are legal +////////////////////////////////////////////////////////////////////// + +#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f +PX_FORCE_INLINE bool isValidFloatV(const FloatV a) +{ + const PxF32 x = V4ReadX(a); + const PxF32 y = V4ReadY(a); + const PxF32 z = V4ReadZ(a); + const PxF32 w = V4ReadW(a); + + return (!(x != y || x != z || x != w)); +} + +PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) +{ + //using _mm_comieq_ss to do the comparison doesn't work for NaN. + PX_ALIGN(16, PxF32 f[4]); + V4StoreA((const Vec4V&)a, f); + return f[3] == 0.0f; +} + +PX_FORCE_INLINE bool isFiniteLength(const Vec3V a) +{ + return !FAllEq(V4LengthSq(a), FZero()); +} + +PX_FORCE_INLINE bool isAligned16(void* a) +{ + return(0 == ((size_t)a & 0x0f)); +} + +//ASSERT_FINITELENGTH is deactivated because there is a lot of code that calls a simd normalisation function with zero length but then ignores the result. + +#if PX_DEBUG +#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) +#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) +#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16((void*)a)) +#define ASSERT_ISFINITELENGTH(a) //PX_ASSERT(isFiniteLength(a)) +#else +#define ASSERT_ISVALIDVEC3V(a) +#define ASSERT_ISVALIDFLOATV(a) +#define ASSERT_ISALIGNED16(a) +#define ASSERT_ISFINITELENGTH(a) +#endif +///////////////////////////////////////////////////////////////////// +////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////// +// USED ONLY INTERNALLY +////////////////////////////////////////////////////////////////////// + +namespace internalWindowsSimd +{ +PX_FORCE_INLINE __m128 m128_I2F(__m128i n) +{ + return _mm_castsi128_ps(n); +} + +PX_FORCE_INLINE __m128i m128_F2I(__m128 n) +{ + return _mm_castps_si128(n); +} + +PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask == 0xf); +} + +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) == 0x7); +} + +PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(moveMask != 0x0); +} + +PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32(((moveMask & 0x7) != 0x0)); +} + +PX_FORCE_INLINE PxU32 FiniteTestEq(const Vec4V a, const Vec4V b) +{ + // This is a bit of a bodge. + //_mm_comieq_ss returns 1 if either value is nan so we need to re-cast a and b with true encoded as a non-nan + // number. + // There must be a better way of doing this in sse. + const BoolV one = FOne(); + const BoolV zero = FZero(); + const BoolV a1 = V4Sel(a, one, zero); + const BoolV b1 = V4Sel(b, one, zero); + return (PxU32( + _mm_comieq_ss(a1, b1) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 1, 1, 1)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(1, 1, 1, 1))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(2, 2, 2, 2)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(2, 2, 2, 2))) && + _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 3, 3, 3)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(3, 3, 3, 3))))); +} + +PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) ? true : false; +} + +PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero())); +} + +PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) +{ + return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero()) || + _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)), FZero())); +} + +const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; +} //internalWindowsSimd + +namespace vecMathTests +{ +// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' +PX_FORCE_INLINE Vec3V getInvalidVec3V() +{ + const float f = 1.0f; + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_comieq_ss(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) +{ + return V3AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) +{ + return V4AllEq(a, b) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) +{ + return internalWindowsSimd::BAllTrue4_R(VecI32V_IsEq(a, b)) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) +{ + return internalWindowsSimd::BAllTrue4_R(V4IsEqU32(a, b)) != 0; +} + +PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) +{ + BoolV c = internalWindowsSimd::m128_I2F( + _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); + return internalWindowsSimd::BAllTrue4_R(c) != 0; +} + +#define VECMATH_AOS_EPSILON (1e-3f) +static const FloatV minFError = FLoad(-VECMATH_AOS_EPSILON); +static const FloatV maxFError = FLoad(VECMATH_AOS_EPSILON); +static const Vec3V minV3Error = V3Load(-VECMATH_AOS_EPSILON); +static const Vec3V maxV3Error = V3Load(VECMATH_AOS_EPSILON); +static const Vec4V minV4Error = V4Load(-VECMATH_AOS_EPSILON); +static const Vec4V maxV4Error = V4Load(VECMATH_AOS_EPSILON); + +PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + const FloatV c = FSub(a, b); + return _mm_comigt_ss(c, minFError) && _mm_comilt_ss(c, maxFError); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) +{ + const Vec3V c = V3Sub(a, b); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV3Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV3Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV3Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV3Error)); +} + +PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) +{ + const Vec4V c = V4Sub(a, b); + return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV4Error) && + _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minV4Error) && + _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxV4Error)); +} +} //vecMathTests + +PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) +{ + PxF32 f; + FStore(a, &f); + return PxIsFinite(f); + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const FloatV vBadNum = FloatV_From_F32((PxF32&)badNumber); + const BoolV vMask = BAnd(vBadNum, a); + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) +{ + PX_ALIGN(16, PxF32 f[4]); + V4StoreA((Vec4V&)a, f); + return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]); + + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const Vec3V vBadNum = Vec3V_From_F32((PxF32&)badNumber); + const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) +{ + PX_ALIGN(16, PxF32 f[4]); + V4StoreA(a, f); + return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]) && PxIsFinite(f[3]); + + /* + const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); + const Vec4V vBadNum = Vec4V_From_U32((PxF32&)badNumber); + const BoolV vMask = BAnd(vBadNum, a); + + return FiniteTestEq(vMask, BFFFF()) == 1; + */ +} + +///////////////////////////////////////////////////////////////////// +////VECTORISED FUNCTION IMPLEMENTATIONS +///////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE FloatV FLoad(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) +{ + return _mm_set_ps(0.0f, f, f, f); +} + +PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) +{ + return _mm_load1_ps(&f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool f) +{ + const PxU32 i = PxU32(-(PxI32)f); + return _mm_load1_ps((float*)&i); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + return _mm_and_ps(_mm_load_ps(&f.x), reinterpret_cast(internalWindowsSimd::gMaskXYZ)); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +// w component of result is undefined +PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + return _mm_load_ps(&f.x); +} + +PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return V4ClearW(_mm_load_ps(f)); +} + +PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i) +{ + return _mm_set_ps(0.0f, i[2], i[1], i[0]); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) +{ + return V4ClearW(v); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) +{ + return v; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) +{ + return f; // ok if it is implemented as the same type. +} + +PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) +{ + return f; +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) +{ + return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) +{ + return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) +{ + return _mm_set_ps(0.0f, f.z, f.y, f.x); +} + +PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) +{ + ASSERT_ISALIGNED16(f); + return _mm_load_ps(f); +} + +PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps(f, a); +} + +PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) +{ + _mm_storeu_ps(f, a); +} + +PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) +{ + ASSERT_ISALIGNED16(f); + _mm_store_ps((PxF32*)f, a); +} + +PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) +{ + ASSERT_ISALIGNED16(u); + _mm_store_ps((PxF32*)u, uv); +} + +PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) +{ + ASSERT_ISALIGNED16(i); + _mm_store_ps((PxF32*)i, iv); +} + +PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) +{ + return _mm_loadu_ps(f); +} + +PX_FORCE_INLINE BoolV BLoad(const bool* const f) +{ + const PX_ALIGN(16, PxU32 b[4]) = { PxU32(-(PxI32)f[0]), PxU32(-(PxI32)f[1]), + PxU32(-(PxI32)f[2]), PxU32(-(PxI32)f[3]) }; + return _mm_load_ps((float*)&b); +} + +PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) +{ + ASSERT_ISVALIDFLOATV(a); + _mm_store_ss(f, a); +} + +PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) +{ + ASSERT_ISALIGNED16(&f); + PX_ALIGN(16, PxF32 f2[4]); + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) +{ + _mm_store_ss((PxF32*)b2, b); +} + +PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) +{ + PX_ALIGN(16, PxF32 f2[4]); + _mm_store_ps(f2, a); + f = PxVec3(f2[0], f2[1], f2[2]); +} + +PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) +{ + return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); +} + +PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) +{ + ASSERT_ISALIGNED16(&out); + V3StoreU(m.col0, out.column0); + V3StoreU(m.col1, out.column1); + V3StoreU(m.col2, out.column2); +} + +////////////////////////////////// +// FLOATV +////////////////////////////////// + +PX_FORCE_INLINE FloatV FZero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE FloatV FOne() +{ + return FLoad(1.0f); +} + +PX_FORCE_INLINE FloatV FHalf() +{ + return FLoad(0.5f); +} + +PX_FORCE_INLINE FloatV FEps() +{ + return FLoad(PX_EPS_REAL); +} + +PX_FORCE_INLINE FloatV FEps6() +{ + return FLoad(1e-6f); +} + +PX_FORCE_INLINE FloatV FMax() +{ + return FLoad(PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV FNegMax() +{ + return FLoad(-PX_MAX_REAL); +} + +PX_FORCE_INLINE FloatV IZero() +{ + const PxU32 zero = 0; + return _mm_load1_ps((PxF32*)&zero); +} + +PX_FORCE_INLINE FloatV IOne() +{ + const PxU32 one = 1; + return _mm_load1_ps((PxF32*)&one); +} + +PX_FORCE_INLINE FloatV ITwo() +{ + const PxU32 two = 2; + return _mm_load1_ps((PxF32*)&two); +} + +PX_FORCE_INLINE FloatV IThree() +{ + const PxU32 three = 3; + return _mm_load1_ps((PxF32*)&three); +} + +PX_FORCE_INLINE FloatV IFour() +{ + const PxU32 four = 4; + return _mm_load1_ps((PxF32*)&four); +} + +PX_FORCE_INLINE FloatV FNeg(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE FloatV FRecip(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), a); +} + +PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) +{ + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_div_ps(FOne(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE FloatV FSqrt(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FAdd(FMul(a, b), c); +} + +PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDFLOATV(c); + return FSub(c, FMul(a, b)); +} + +PX_FORCE_INLINE FloatV FAbs(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + PX_ALIGN(16, const static PxU32 absMask[4]) = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; + return _mm_and_ps(a, _mm_load_ps((PxF32*)absMask)); +} + +PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) +{ + PX_ASSERT(vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + ASSERT_ISVALIDFLOATV(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) +{ + ASSERT_ISVALIDFLOATV(minV); + ASSERT_ISVALIDFLOATV(maxV); + return _mm_max_ps(_mm_min_ps(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comigt_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comige_ss(a, b)); +} + +PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(b); + return PxU32(_mm_comieq_ss(a, b)); +} + +PX_FORCE_INLINE FloatV FRound(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + // return _mm_round_ps(a, 0x0); + const FloatV half = FLoad(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const FloatV aRound = FSub(FAdd(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +} + +PX_FORCE_INLINE FloatV FSin(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V3 = FMul(V2, V1); + const FloatV V5 = FMul(V3, V2); + const FloatV V7 = FMul(V5, V2); + const FloatV V9 = FMul(V7, V2); + const FloatV V11 = FMul(V9, V2); + const FloatV V13 = FMul(V11, V2); + const FloatV V15 = FMul(V13, V2); + const FloatV V17 = FMul(V15, V2); + const FloatV V19 = FMul(V17, V2); + const FloatV V21 = FMul(V19, V2); + const FloatV V23 = FMul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + FloatV Result; + Result = FScaleAdd(S1, V3, V1); + Result = FScaleAdd(S2, V5, Result); + Result = FScaleAdd(S3, V7, Result); + Result = FScaleAdd(S4, V9, Result); + Result = FScaleAdd(S5, V11, Result); + Result = FScaleAdd(S6, V13, Result); + Result = FScaleAdd(S7, V15, Result); + Result = FScaleAdd(S8, V17, Result); + Result = FScaleAdd(S9, V19, Result); + Result = FScaleAdd(S10, V21, Result); + Result = FScaleAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE FloatV FCos(const FloatV a) +{ + ASSERT_ISVALIDFLOATV(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const FloatV tmp = FMul(a, recipTwoPi); + const FloatV b = FRound(tmp); + const FloatV V1 = FNegScaleSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const FloatV V2 = FMul(V1, V1); + const FloatV V4 = FMul(V2, V2); + const FloatV V6 = FMul(V4, V2); + const FloatV V8 = FMul(V4, V4); + const FloatV V10 = FMul(V6, V4); + const FloatV V12 = FMul(V6, V6); + const FloatV V14 = FMul(V8, V6); + const FloatV V16 = FMul(V8, V8); + const FloatV V18 = FMul(V10, V8); + const FloatV V20 = FMul(V10, V10); + const FloatV V22 = FMul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + FloatV Result; + Result = FScaleAdd(C1, V2, V4One()); + Result = FScaleAdd(C2, V4, Result); + Result = FScaleAdd(C3, V6, Result); + Result = FScaleAdd(C4, V8, Result); + Result = FScaleAdd(C5, V10, Result); + Result = FScaleAdd(C6, V12, Result); + Result = FScaleAdd(C7, V14, Result); + Result = FScaleAdd(C8, V16, Result); + Result = FScaleAdd(C9, V18, Result); + Result = FScaleAdd(C10, V20, Result); + Result = FScaleAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(min); + ASSERT_ISVALIDFLOATV(max); + const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FOutOfBounds(a, FNeg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) +{ + ASSERT_ISVALIDFLOATV(a); + ASSERT_ISVALIDFLOATV(bounds); + return FInBounds(a, FNeg(bounds), bounds); +} + +////////////////////////////////// +// VEC3V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + const __m128 zero = V3Zero(); + const __m128 fff0 = _mm_move_ss(f, zero); + return _mm_shuffle_ps(fff0, fff0, _MM_SHUFFLE(0, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + // static on zero causes compiler crash on x64 debug_opt + const __m128 zero = V3Zero(); + const __m128 xy = _mm_move_ss(x, y); + const __m128 z0 = _mm_move_ss(zero, z); + + return _mm_shuffle_ps(xy, z0, _MM_SHUFFLE(1, 0, 0, 1)); +} + +PX_FORCE_INLINE Vec3V V3UnitX() +{ + const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec3V V3UnitY() +{ + const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec3V V3UnitZ() +{ + const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) +{ + ASSERT_ISVALIDVEC3V(v); + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 0, 3, 0)); + return V3SetY(r, V3GetX(b)); +} + +PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 1, 3, 1)); + return V3SetY(r, V3GetY(b)); +} + +PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 2, 3, 2)); + return V3SetY(r, V3GetZ(b)); +} + +PX_FORCE_INLINE Vec3V V3Zero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE Vec3V V3One() +{ + return V3Load(1.0f); +} + +PX_FORCE_INLINE Vec3V V3Eps() +{ + return V3Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) +{ + ASSERT_ISVALIDVEC3V(f); + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_div_ps(a, b)); +} + +PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return V4ClearW(_mm_mul_ps(a, _mm_rcp_ps(b))); +} + +PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rcp_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_div_ps(V3One(), _mm_sqrt_ps(a)); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 tttf = BTTTF(); + const __m128 recipA = _mm_rsqrt_ps(a); + return V4Sel(tttf, recipA, zero); +} + +PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Scale(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDFLOATV(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Scale(a, b)); +} + +PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Add(V3Mul(a, b), c); +} + +PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + ASSERT_ISVALIDVEC3V(c); + return V3Sub(c, V3Mul(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Max(a, V3Neg(a)); +} + +PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + + const __m128 t0 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); // ay*by | ax*bx | aw*bw | az*bz + const __m128 t2 = _mm_add_ps(t0, t1); // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + return _mm_add_ps(t3, t2); // ax*bx + az*bz + ay*by + aw*bw + // ay*by + aw*bw + ax*bx + az*bz + // az*bz + ax*bx + aw*bw + ay*by + // aw*bw + ay*by + az*bz + ax*bx +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); +/* if(0) + { + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); + } + else*/ + { + const __m128 b0 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3,0,2,1)); + const __m128 a1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3,0,2,1)); + __m128 v = _mm_mul_ps(a1, b); + v = _mm_sub_ps(_mm_mul_ps(a, b0), v); + __m128 res = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3,0,2,1)); + ASSERT_ISVALIDVEC3V(res); + return res; + } +} + +PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + VecCrossV v; + v.mR1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + v.mL1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + return v; +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(b); + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(a.mL1, l2), _mm_mul_ps(a.mR1, r2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const VecCrossV& b) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 r2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(b.mR1, r2), _mm_mul_ps(b.mL1, l2)); +} + +PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const VecCrossV& b) +{ + return _mm_sub_ps(_mm_mul_ps(a.mL1, b.mR1), _mm_mul_ps(a.mR1, b.mL1)); +} + +PX_FORCE_INLINE FloatV V3Length(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_sqrt_ps(V3Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return V3Dot(a, a); +} + +PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3ScaleInv(a, _mm_sqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISFINITELENGTH(a); + return V3Scale(a, _mm_rsqrt_ps(V3Dot(a, a))); +} + +PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 eps = FEps(); + const __m128 length = V3Length(a); + const __m128 isGreaterThanZero = FIsGrtr(length, eps); + return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + return _mm_max_ps(_mm_max_ps(shuf1, shuf2), shuf3); +} + +PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); + return _mm_min_ps(_mm_min_ps(shuf1, shuf2), shuf3); +} + +//// if(a > 0.0f) return 1.0f; else if a == 0.f return 0.f, else return -1.f; +// PX_FORCE_INLINE Vec3V V3MathSign(const Vec3V a) +//{ +// VECMATHAOS_ASSERT(isValidVec3V(a)); +// +// const __m128i ai = _mm_cvtps_epi32(a); +// const __m128i bi = _mm_cvtps_epi32(V3Neg(a)); +// const __m128 aa = _mm_cvtepi32_ps(_mm_srai_epi32(ai, 31)); +// const __m128 bb = _mm_cvtepi32_ps(_mm_srai_epi32(bi, 31)); +// return _mm_or_ps(aa, bb); +//} + +// return (a >= 0.0f) ? 1.0f : -1.0f; +PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 zero = V3Zero(); + const __m128 one = V3One(); + const __m128 none = V3Neg(one); + return V3Sel(V3IsGrtrOrEq(a, zero), one, none); +} + +PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(minV); + ASSERT_ISVALIDVEC3V(maxV); + return V3Max(V3Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalWindowsSimd::BAllTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalWindowsSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(b); + return internalWindowsSimd::BAllTrue3_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // return _mm_round_ps(a, 0x0); + const Vec3V half = V3Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec3V aRound = V3Sub(V3Add(a, half), signBit); + __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +} + +PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V3 = V3Mul(V2, V1); + const Vec3V V5 = V3Mul(V3, V2); + const Vec3V V7 = V3Mul(V5, V2); + const Vec3V V9 = V3Mul(V7, V2); + const Vec3V V11 = V3Mul(V9, V2); + const Vec3V V13 = V3Mul(V11, V2); + const Vec3V V15 = V3Mul(V13, V2); + const Vec3V V17 = V3Mul(V15, V2); + const Vec3V V19 = V3Mul(V17, V2); + const Vec3V V21 = V3Mul(V19, V2); + const Vec3V V23 = V3Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V3, S1, V1); + Result = V3ScaleAdd(V5, S2, Result); + Result = V3ScaleAdd(V7, S3, Result); + Result = V3ScaleAdd(V9, S4, Result); + Result = V3ScaleAdd(V11, S5, Result); + Result = V3ScaleAdd(V13, S6, Result); + Result = V3ScaleAdd(V15, S7, Result); + Result = V3ScaleAdd(V17, S8, Result); + Result = V3ScaleAdd(V19, S9, Result); + Result = V3ScaleAdd(V21, S10, Result); + Result = V3ScaleAdd(V23, S11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + + // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec3V tmp = V3Scale(a, recipTwoPi); + const Vec3V b = V3Round(tmp); + const Vec3V V1 = V3NegScaleSub(b, twoPi, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec3V V2 = V3Mul(V1, V1); + const Vec3V V4 = V3Mul(V2, V2); + const Vec3V V6 = V3Mul(V4, V2); + const Vec3V V8 = V3Mul(V4, V4); + const Vec3V V10 = V3Mul(V6, V4); + const Vec3V V12 = V3Mul(V6, V6); + const Vec3V V14 = V3Mul(V8, V6); + const Vec3V V16 = V3Mul(V8, V8); + const Vec3V V18 = V3Mul(V10, V8); + const Vec3V V20 = V3Mul(V10, V10); + const Vec3V V22 = V3Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec3V Result; + Result = V3ScaleAdd(V2, C1, V3One()); + Result = V3ScaleAdd(V4, C2, Result); + Result = V3ScaleAdd(V6, C3, Result); + Result = V3ScaleAdd(V8, C4, Result); + Result = V3ScaleAdd(V10, C5, Result); + Result = V3ScaleAdd(V12, C6, Result); + Result = V3ScaleAdd(V14, C7, Result); + Result = V3ScaleAdd(V16, C8, Result); + Result = V3ScaleAdd(V18, C9, Result); + Result = V3ScaleAdd(V20, C10, Result); + Result = V3ScaleAdd(V22, C11, Result); + + ASSERT_ISVALIDVEC3V(Result); + return Result; +} + +PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 1, 0)); +} + +PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 2, 2)); +} + +PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 0, 1)); +} + +PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v1, v0, _MM_SHUFFLE(3, 1, 2, 3)); +} + +PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + return _mm_shuffle_ps(v0, v1, _MM_SHUFFLE(3, 0, 3, 2)); +} + +PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) +{ + ASSERT_ISVALIDVEC3V(v0); + ASSERT_ISVALIDVEC3V(v1); + // There must be a better way to do this. + Vec3V v2 = V3Zero(); + FloatV y1 = V3GetY(v1); + FloatV x0 = V3GetX(v0); + v2 = V3SetX(v2, y1); + return V3SetY(v2, x0); +} + +PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) +{ + ASSERT_ISVALIDVEC3V(a); + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); + return PxU32(!BAllEqFFFF(c)); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(min); + ASSERT_ISVALIDVEC3V(max); + const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); + return BAllEqTTTT(c); +} + +PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + return V3OutOfBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) +{ + ASSERT_ISVALIDVEC3V(a); + ASSERT_ISVALIDVEC3V(bounds); + return V3InBounds(a, V3Neg(bounds), bounds); +} + +PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) +{ + ASSERT_ISVALIDVEC3V(col0); + ASSERT_ISVALIDVEC3V(col1); + ASSERT_ISVALIDVEC3V(col2); + const Vec3V col3 = _mm_setzero_ps(); + Vec3V tmp0 = _mm_unpacklo_ps(col0, col1); + Vec3V tmp2 = _mm_unpacklo_ps(col2, col3); + Vec3V tmp1 = _mm_unpackhi_ps(col0, col1); + Vec3V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); +} + +////////////////////////////////// +// VEC4V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + // return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0,0,0,0)); + return f; +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) +{ + ASSERT_ISVALIDFLOATV(floatVArray[0]); + ASSERT_ISVALIDFLOATV(floatVArray[1]); + ASSERT_ISVALIDFLOATV(floatVArray[2]); + ASSERT_ISVALIDFLOATV(floatVArray[3]); + const __m128 xw = _mm_move_ss(floatVArray[1], floatVArray[0]); // y, y, y, x + const __m128 yz = _mm_move_ss(floatVArray[2], floatVArray[3]); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) +{ + ASSERT_ISVALIDFLOATV(x); + ASSERT_ISVALIDFLOATV(y); + ASSERT_ISVALIDFLOATV(z); + ASSERT_ISVALIDFLOATV(w); + const __m128 xw = _mm_move_ss(y, x); // y, y, y, x + const __m128 yz = _mm_move_ss(z, w); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpackhi_ps(x, z); + const Vec4V yw = _mm_unpackhi_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpackhi_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) +{ + const Vec4V xz = _mm_unpacklo_ps(x, z); + const Vec4V yw = _mm_unpacklo_ps(y, w); + return _mm_unpacklo_ps(xz, yw); +} + +PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpacklo_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) +{ + return _mm_unpackhi_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 0, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 0, 2, 0)); +} + +PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 3, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); +} + +PX_FORCE_INLINE Vec4V V4PermZWXY(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); +} + +template +PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(w, z, y, x)); +} + +PX_FORCE_INLINE Vec4V V4UnitW() +{ + const PX_ALIGN(16, PxF32 w[4]) = { 0.0f, 0.0f, 0.0f, 1.0f }; + const __m128 w128 = _mm_load_ps(w); + return w128; +} + +PX_FORCE_INLINE Vec4V V4UnitX() +{ + const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; + const __m128 x128 = _mm_load_ps(x); + return x128; +} + +PX_FORCE_INLINE Vec4V V4UnitY() +{ + const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; + const __m128 y128 = _mm_load_ps(y); + return y128; +} + +PX_FORCE_INLINE Vec4V V4UnitZ() +{ + const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; + const __m128 z128 = _mm_load_ps(z); + return z128; +} + +PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTTF(), v, f); +} + +PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) +{ + return _mm_and_ps(v, (VecI32V&)internalWindowsSimd::gMaskXYZ); +} + +PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) +{ + ASSERT_ISVALIDFLOATV(f); + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE Vec4V V4Zero() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE Vec4V V4One() +{ + return V4Load(1.0f); +} + +PX_FORCE_INLINE Vec4V V4Eps() +{ + return V4Load(PX_EPS_REAL); +} + +PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) +{ + return _mm_sub_ps(_mm_setzero_ps(), f); +} + +PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) +{ + return _mm_add_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) +{ + return _mm_sub_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) +{ + return _mm_div_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) +{ + ASSERT_ISVALIDFLOATV(b); + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) +{ + return _mm_mul_ps(a, _mm_rcp_ps(b)); +} + +PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) +{ + return _mm_div_ps(V4One(), a); +} + +PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) +{ + return _mm_rcp_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) +{ + return _mm_div_ps(V4One(), _mm_sqrt_ps(a)); +} + +PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) +{ + return _mm_rsqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) +{ + return _mm_sqrt_ps(a); +} + +PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Add(V4Scale(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) +{ + ASSERT_ISVALIDFLOATV(b); + return V4Sub(c, V4Scale(a, b)); +} + +PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Add(V4Mul(a, b), c); +} + +PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) +{ + return V4Sub(c, V4Mul(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) +{ + return V4Max(a, V4Neg(a)); +} + +PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) +{ + const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y + const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w + const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w + const FloatV xz = V4GetX(xz_yw); // x+z + const FloatV yw = V4GetZ(xz_yw); // y+w + return FAdd(xz, yw); // sum +} + +PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) +{ + //const __m128 dot1 = _mm_mul_ps(a, b); // x,y,z,w + //const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 1, 0, 3)); // w,x,y,z + //const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 0, 3, 2)); // z,w,x,y + //const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 3, 2, 1)); // y,z,w,x + //return _mm_add_ps(_mm_add_ps(shuf2, shuf3), _mm_add_ps(dot1, shuf1)); + + // PT: this version has two less instructions but we should check its accuracy + // aw*bw | az*bz | ay*by | ax*bx + const __m128 t0 = _mm_mul_ps(a, b); + // ay*by | ax*bx | aw*bw | az*bz + const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); + // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx + const __m128 t2 = _mm_add_ps(t0, t1); + // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by + const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); + // ax*bx + az*bz + ay*by + aw*bw + return _mm_add_ps(t3, t2); + // ay*by + aw*bw + ax*bx + az*bz + // az*bz + ax*bx + aw*bw + ay*by + // aw*bw + ay*by + az*bz + ax*bx +} + +PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) +{ + const __m128 dot1 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx + const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 0, 0, 0)); // ax*bx | ax*bx | ax*bx | ax*bx + const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 1, 1, 1)); // ay*by | ay*by | ay*by | ay*by + const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 2, 2, 2)); // az*bz | az*bz | az*bz | az*bz + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); // ax*bx + ay*by + az*bz in each component +} + +PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) +{ +/* if(0) + { + const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w + const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w + return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); + } + else*/ + { + const __m128 b0 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3,0,2,1)); + const __m128 a1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3,0,2,1)); + __m128 v = _mm_mul_ps(a1, b); + v = _mm_sub_ps(_mm_mul_ps(a, b0), v); + return _mm_shuffle_ps(v, v, _MM_SHUFFLE(3,0,2,1)); + } +} + +PX_FORCE_INLINE FloatV V4Length(const Vec4V a) +{ + return _mm_sqrt_ps(V4Dot(a, a)); +} + +PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) +{ + return V4Dot(a, a); +} + +PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInv(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) +{ + ASSERT_ISFINITELENGTH(a); + return V4ScaleInvFast(a, _mm_sqrt_ps(V4Dot(a, a))); +} + +PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) +{ + const __m128 eps = V3Eps(); + const __m128 length = V4Length(a); + const __m128 isGreaterThanZero = V4IsGrtr(length, eps); + return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); +} + +PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) +{ + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) +{ + return _mm_cmpgt_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpge_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) +{ + return _mm_cmpeq_ps(a, b); +} + +PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) +{ + return _mm_max_ps(a, b); +} + +PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) +{ + return _mm_min_ps(a, b); +} + +PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_max_ps(_mm_max_ps(a, shuf1), _mm_max_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) +{ + const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); + const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); + const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); + + return _mm_min_ps(_mm_min_ps(a, shuf1), _mm_min_ps(shuf2, shuf3)); +} + +PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) +{ + return V4Max(V4Min(a, maxV), minV); +} + +PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) +{ + return internalWindowsSimd::BAllTrue4_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) +{ + return internalWindowsSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) +{ + return internalWindowsSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) +{ + return internalWindowsSimd::BAllTrue4_R(V4IsEq(a, b)); +} + +PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) +{ + return internalWindowsSimd::BAnyTrue3_R(V4IsGrtr(a, b)); +} + +PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) +{ + // return _mm_round_ps(a, 0x0); + const Vec4V half = V4Load(0.5f); + const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); + const Vec4V aRound = V4Sub(V4Add(a, half), signBit); + const __m128i tmp = _mm_cvttps_epi32(aRound); + return _mm_cvtepi32_ps(tmp); +} + +PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - + // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V3 = V4Mul(V2, V1); + const Vec4V V5 = V4Mul(V3, V2); + const Vec4V V7 = V4Mul(V5, V2); + const Vec4V V9 = V4Mul(V7, V2); + const Vec4V V11 = V4Mul(V9, V2); + const Vec4V V13 = V4Mul(V11, V2); + const Vec4V V15 = V4Mul(V13, V2); + const Vec4V V17 = V4Mul(V15, V2); + const Vec4V V19 = V4Mul(V17, V2); + const Vec4V V21 = V4Mul(V19, V2); + const Vec4V V23 = V4Mul(V21, V2); + + const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); + const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); + const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); + + const FloatV S1 = V4GetY(sinCoefficients0); + const FloatV S2 = V4GetZ(sinCoefficients0); + const FloatV S3 = V4GetW(sinCoefficients0); + const FloatV S4 = V4GetX(sinCoefficients1); + const FloatV S5 = V4GetY(sinCoefficients1); + const FloatV S6 = V4GetZ(sinCoefficients1); + const FloatV S7 = V4GetW(sinCoefficients1); + const FloatV S8 = V4GetX(sinCoefficients2); + const FloatV S9 = V4GetY(sinCoefficients2); + const FloatV S10 = V4GetZ(sinCoefficients2); + const FloatV S11 = V4GetW(sinCoefficients2); + + Vec4V Result; + Result = V4MulAdd(S1, V3, V1); + Result = V4MulAdd(S2, V5, Result); + Result = V4MulAdd(S3, V7, Result); + Result = V4MulAdd(S4, V9, Result); + Result = V4MulAdd(S5, V11, Result); + Result = V4MulAdd(S6, V13, Result); + Result = V4MulAdd(S7, V15, Result); + Result = V4MulAdd(S8, V17, Result); + Result = V4MulAdd(S9, V19, Result); + Result = V4MulAdd(S10, V21, Result); + Result = V4MulAdd(S11, V23, Result); + + return Result; +} + +PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) +{ + const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); + const FloatV twoPi = V4LoadA(g_PXTwoPi.f); + const Vec4V tmp = V4Mul(a, recipTwoPi); + const Vec4V b = V4Round(tmp); + const Vec4V V1 = V4NegMulSub(twoPi, b, a); + + // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - + // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) + const Vec4V V2 = V4Mul(V1, V1); + const Vec4V V4 = V4Mul(V2, V2); + const Vec4V V6 = V4Mul(V4, V2); + const Vec4V V8 = V4Mul(V4, V4); + const Vec4V V10 = V4Mul(V6, V4); + const Vec4V V12 = V4Mul(V6, V6); + const Vec4V V14 = V4Mul(V8, V6); + const Vec4V V16 = V4Mul(V8, V8); + const Vec4V V18 = V4Mul(V10, V8); + const Vec4V V20 = V4Mul(V10, V10); + const Vec4V V22 = V4Mul(V12, V10); + + const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); + const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); + const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); + + const FloatV C1 = V4GetY(cosCoefficients0); + const FloatV C2 = V4GetZ(cosCoefficients0); + const FloatV C3 = V4GetW(cosCoefficients0); + const FloatV C4 = V4GetX(cosCoefficients1); + const FloatV C5 = V4GetY(cosCoefficients1); + const FloatV C6 = V4GetZ(cosCoefficients1); + const FloatV C7 = V4GetW(cosCoefficients1); + const FloatV C8 = V4GetX(cosCoefficients2); + const FloatV C9 = V4GetY(cosCoefficients2); + const FloatV C10 = V4GetZ(cosCoefficients2); + const FloatV C11 = V4GetW(cosCoefficients2); + + Vec4V Result; + Result = V4MulAdd(C1, V2, V4One()); + Result = V4MulAdd(C2, V4, Result); + Result = V4MulAdd(C3, V6, Result); + Result = V4MulAdd(C4, V8, Result); + Result = V4MulAdd(C5, V10, Result); + Result = V4MulAdd(C6, V12, Result); + Result = V4MulAdd(C7, V14, Result); + Result = V4MulAdd(C8, V16, Result); + Result = V4MulAdd(C9, V18, Result); + Result = V4MulAdd(C10, V20, Result); + Result = V4MulAdd(C11, V22, Result); + + return Result; +} + +PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) +{ + Vec4V tmp0 = _mm_unpacklo_ps(col0, col1); + Vec4V tmp2 = _mm_unpacklo_ps(col2, col3); + Vec4V tmp1 = _mm_unpackhi_ps(col0, col1); + Vec4V tmp3 = _mm_unpackhi_ps(col2, col3); + col0 = _mm_movelh_ps(tmp0, tmp2); + col1 = _mm_movehl_ps(tmp2, tmp0); + col2 = _mm_movelh_ps(tmp1, tmp3); + col3 = _mm_movehl_ps(tmp3, tmp1); +} + +////////////////////////////////// +// BoolV +////////////////////////////////// + +PX_FORCE_INLINE BoolV BFFFF() +{ + return _mm_setzero_ps(); +} + +PX_FORCE_INLINE BoolV BFFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fftt=_mm_load_ps((float*)&f); + return fftt;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BFTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ftft=_mm_load_ps((float*)&f); + return ftft;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 fttf=_mm_load_ps((float*)&f); + return fttf;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BFTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 fttt=_mm_load_ps((float*)&f); + return fttt;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, 0)); +} + +PX_FORCE_INLINE BoolV BTFFF() +{ + // const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + // const __m128 tfff=_mm_load_ps((float*)&f); + // return tfff; + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0xFFFFFFFF}; + const __m128 tfft=_mm_load_ps((float*)&f); + return tfft;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0}; + const __m128 tftf=_mm_load_ps((float*)&f); + return tftf;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTFTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tftt=_mm_load_ps((float*)&f); + return tftt;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, -1)); +} + +PX_FORCE_INLINE BoolV BTTFF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0}; + const __m128 ttff=_mm_load_ps((float*)&f); + return ttff;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTFT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0xFFFFFFFF}; + const __m128 ttft=_mm_load_ps((float*)&f); + return ttft;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTF() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0}; + const __m128 tttf=_mm_load_ps((float*)&f); + return tttf;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BTTTT() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; + const __m128 tttt=_mm_load_ps((float*)&f); + return tttt;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, -1)); +} + +PX_FORCE_INLINE BoolV BXMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; + const __m128 tfff=_mm_load_ps((float*)&f); + return tfff;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); +} + +PX_FORCE_INLINE BoolV BYMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; + const __m128 ftff=_mm_load_ps((float*)&f); + return ftff;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); +} + +PX_FORCE_INLINE BoolV BZMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; + const __m128 fftf=_mm_load_ps((float*)&f); + return fftf;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); +} + +PX_FORCE_INLINE BoolV BWMask() +{ + /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; + const __m128 ffft=_mm_load_ps((float*)&f); + return ffft;*/ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetX(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE BoolV BGetY(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE BoolV BGetZ(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE BoolV BGetW(const BoolV f) +{ + return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) +{ + return V4Sel(BFTTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) +{ + return V4Sel(BTFTT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) +{ + return V4Sel(BTTFT(), v, f); +} + +PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) +{ + return V4Sel(BTTTF(), v, f); +} + +template +BoolV BSplatElement(BoolV a) +{ + return internalWindowsSimd::m128_I2F( + _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) +{ + return _mm_and_ps(a, b); +} + +PX_FORCE_INLINE BoolV BNot(const BoolV a) +{ + const BoolV bAllTrue(BTTTT()); + return _mm_xor_ps(a, bAllTrue); +} + +PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) +{ + return _mm_andnot_ps(b, a); +} + +PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) +{ + return _mm_or_ps(a, b); +} + +PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) +{ + const BoolV bTmp = + _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) +{ + const BoolV bTmp = + _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) +{ + const BoolV bTmp = + _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) +{ + const BoolV bTmp = + _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); + return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), + _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); +} + +PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) +{ + const BoolV bTest = internalWindowsSimd::m128_I2F( + _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); + return internalWindowsSimd::BAllTrue4_R(bTest); +} + +PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==15); +} + +PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)==0); +} + +PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) +{ + return PxU32(_mm_movemask_ps(a)); +} + +////////////////////////////////// +// MAT33V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) +{ + Vec3V v0 = V3Mul(a.col0, b); + Vec3V v1 = V3Mul(a.col1, b); + Vec3V v2 = V3Mul(a.col2, b); + V3Transpose(v0, v1, v2); + return V3Add(V3Add(v0, v1), v2); +} + +PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + Vec3V result = V3ScaleAdd(A.col0, x, c); + result = V3ScaleAdd(A.col1, y, result); + return V3ScaleAdd(A.col2, z, result); +} + +PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) +{ + return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); +} + +PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) +{ + return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); +} + +PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) +{ + return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) +{ + return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); +} + +PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) +{ + const BoolV tfft = BTFFT(); + const BoolV tttf = BTTTF(); + const FloatV zero = V3Zero(); + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = _mm_rcp_ps(dot); + const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); + const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); + Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); + colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); + const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); + const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); + const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); + const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); + const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); + const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); + + return Mat33V(_mm_mul_ps(colInv0, invDet), _mm_mul_ps(colInv1, invDet), _mm_mul_ps(colInv2, invDet)); +} + +PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) +{ + Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; + V3Transpose(col0, col1, col2); + return Mat33V(col0, col1, col2); +} + +PX_FORCE_INLINE Mat33V M33Identity() +{ + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); +} + +PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) +{ + const FloatV x = V3Mul(V3UnitX(), d); + const FloatV y = V3Mul(V3UnitY(), d); + const FloatV z = V3Mul(V3UnitZ(), d); + return Mat33V(x, y, z); +} + +////////////////////////////////// +// MAT34V +////////////////////////////////// + +PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); + return V3Add(v0PlusV1Plusv2, a.col3); +} + +PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) +{ + const FloatV x = V3GetX(b); + const FloatV y = V3GetY(b); + const FloatV z = V3GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) +{ + Vec3V v0 = V3Mul(a.col0, b); + Vec3V v1 = V3Mul(a.col1, b); + Vec3V v2 = V3Mul(a.col2, b); + V3Transpose(v0, v1, v2); + return V3Add(V3Add(v0, v1), v2); +} + +PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); +} + +PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) +{ + return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); +} + +PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) +{ + return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat34V M34Inverse(const Mat34V& a) +{ + Mat34V aInv; + const BoolV tfft = BTFFT(); + const BoolV tttf = BTTTF(); + const FloatV zero = V3Zero(); + const Vec3V cross01 = V3Cross(a.col0, a.col1); + const Vec3V cross12 = V3Cross(a.col1, a.col2); + const Vec3V cross20 = V3Cross(a.col2, a.col0); + const FloatV dot = V3Dot(cross01, a.col2); + const FloatV invDet = _mm_rcp_ps(dot); + const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); + const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); + Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); + colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); + const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); + const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); + const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); + const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); + const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); + const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); + aInv.col0 = _mm_mul_ps(colInv0, invDet); + aInv.col1 = _mm_mul_ps(colInv1, invDet); + aInv.col2 = _mm_mul_ps(colInv2, invDet); + aInv.col3 = M34Mul33V3(aInv, V3Neg(a.col3)); + return aInv; +} + +PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) +{ + Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; + V3Transpose(col0, col1, col2); + return Mat33V(col0, col1, col2); +} + +////////////////////////////////// +// MAT44V +////////////////////////////////// + +PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const FloatV w = V4GetW(b); + + const Vec4V v0 = V4Scale(a.col0, x); + const Vec4V v1 = V4Scale(a.col1, y); + const Vec4V v2 = V4Scale(a.col2, z); + const Vec4V v3 = V4Scale(a.col3, w); + const Vec4V v0PlusV1 = V4Add(v0, v1); + const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); + return V4Add(v0PlusV1Plusv2, v3); +} + +PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) +{ + Vec4V v0 = V4Mul(a.col0, b); + Vec4V v1 = V4Mul(a.col1, b); + Vec4V v2 = V4Mul(a.col2, b); + Vec4V v3 = V4Mul(a.col3, b); + V4Transpose(v0, v1, v2, v3); + return V4Add(V4Add(v0, v1), V4Add(v2, v3)); +} + +PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) +{ + return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); +} + +PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) +{ + Vec4V col0 = a.col0, col1 = a.col1, col2 = a.col2, col3 = a.col3; + V4Transpose(col0, col1, col2, col3); + return Mat44V(col0, col1, col2, col3); +} + +PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) +{ + __m128 minor0, minor1, minor2, minor3; + __m128 row0, row1, row2, row3; + __m128 det, tmp1; + + tmp1 = V4Zero(); + row1 = V4Zero(); + row3 = V4Zero(); + + row0 = a.col0; + row1 = _mm_shuffle_ps(a.col1, a.col1, _MM_SHUFFLE(1, 0, 3, 2)); + row2 = a.col2; + row3 = _mm_shuffle_ps(a.col3, a.col3, _MM_SHUFFLE(1, 0, 3, 2)); + + tmp1 = _mm_mul_ps(row2, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_mul_ps(row1, tmp1); + minor1 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0); + minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1); + minor1 = _mm_shuffle_ps(minor1, minor1, 0x4E); + + tmp1 = _mm_mul_ps(row1, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0); + minor3 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3); + minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E); + + tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, 0x4E), row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + row2 = _mm_shuffle_ps(row2, row2, 0x4E); + minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0); + minor2 = _mm_mul_ps(row0, tmp1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2); + minor2 = _mm_shuffle_ps(minor2, minor2, 0x4E); + + tmp1 = _mm_mul_ps(row0, row1); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1)); + + tmp1 = _mm_mul_ps(row0, row3); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1)); + minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1); + minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1)); + + tmp1 = _mm_mul_ps(row0, row2); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); + minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1); + minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1)); + tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); + minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1)); + minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3); + + det = _mm_mul_ps(row0, minor0); + det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det); + det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det); + tmp1 = _mm_rcp_ss(det); +#if 0 + det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1))); + det = _mm_shuffle_ps(det, det, 0x00); +#else + det = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(0, 0, 0, 0)); +#endif + + minor0 = _mm_mul_ps(det, minor0); + minor1 = _mm_mul_ps(det, minor1); + minor2 = _mm_mul_ps(det, minor2); + minor3 = _mm_mul_ps(det, minor3); + Mat44V invTrans(minor0, minor1, minor2, minor3); + return M44Trnsps(invTrans); +} + +PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) +{ + return _mm_set_ps(w, z, y, x); +} + +PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_or_si128(_mm_andnot_si128(internalWindowsSimd::m128_F2I(c), internalWindowsSimd::m128_F2I(b)), + _mm_and_si128(internalWindowsSimd::m128_F2I(c), internalWindowsSimd::m128_F2I(a)))); +} + +PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) +{ + return internalWindowsSimd::m128_I2F(_mm_or_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_xor_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_and_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_andnot_si128(internalWindowsSimd::m128_F2I(b), internalWindowsSimd::m128_F2I(a))); +} + +PX_FORCE_INLINE VecI32V U4Load(const PxU32 i) +{ + return _mm_load1_ps((PxF32*)&i); +} + +PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) +{ + return _mm_loadu_ps((PxF32*)i); +} + +PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) +{ + ASSERT_ISALIGNED16(i); + return _mm_load_ps((PxF32*)i); +} + +PX_FORCE_INLINE VecI32V I4LoadXYZW(const PxI32& x, const PxI32& y, const PxI32& z, const PxI32& w) +{ + return internalWindowsSimd::m128_I2F(_mm_set_epi32(w, z, y, x)); +} + +PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) +{ + return _mm_load1_ps((PxF32*)&i); +} + +PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) +{ + return _mm_loadu_ps((PxF32*)i); +} + +PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) +{ + ASSERT_ISALIGNED16(i); + return _mm_load_ps((PxF32*)i); +} + +PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_add_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_sub_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_cmpgt_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) +{ + return V4U32Sel(c, a, b); +} + +PX_FORCE_INLINE VecI32V VecI32V_Zero() +{ + return V4Zero(); +} + +PX_FORCE_INLINE VecI32V VecI32V_One() +{ + return I4Load(1); +} + +PX_FORCE_INLINE VecI32V VecI32V_Two() +{ + return I4Load(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_MinusOne() +{ + return I4Load(-1); +} + +PX_FORCE_INLINE VecU32V U4Zero() +{ + return U4Load(0); +} + +PX_FORCE_INLINE VecU32V U4One() +{ + return U4Load(1); +} + +PX_FORCE_INLINE VecU32V U4Two() +{ + return U4Load(2); +} + +PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) +{ + PX_ASSERT(vecMathTests::allElementsEqualBoolV(c, BTTTT()) || + vecMathTests::allElementsEqualBoolV(c, BFFFF())); + return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); +} + +PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) +{ + VecShiftV preparedShift; + preparedShift.shift = _mm_or_ps(_mm_andnot_ps(BTFFF(), VecI32V_Zero()), _mm_and_ps(BTFFF(), shift)); + return preparedShift; +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) +{ + return internalWindowsSimd::m128_I2F( + _mm_sll_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(count.shift))); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) +{ + return internalWindowsSimd::m128_I2F( + _mm_srl_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(count.shift))); +} + +PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const PxU32 count) +{ + return internalWindowsSimd::m128_I2F( + _mm_slli_epi32(internalWindowsSimd::m128_F2I(a), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const PxU32 count) +{ + return internalWindowsSimd::m128_I2F( + _mm_srai_epi32(internalWindowsSimd::m128_F2I(a), count)); +} + +PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_and_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) +{ + return internalWindowsSimd::m128_I2F( + _mm_or_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); +} + +PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) +{ + return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)); +} + +PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) +{ + _mm_store_ss((PxF32*)i, a); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) +{ + return a; +} + +PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) +{ + const __m128 xw = _mm_move_ss(b, a); // y, y, y, x + const __m128 yz = _mm_move_ss(c, d); // z, z, z, w + return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); +} + +PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) +{ + *address = val; +} + +PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) +{ + VecU32V result32(a); + result32 = V4U32Andc(result32, b); + return Vec4V(result32); +} + +PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) +{ + return V4IsGrtr(a, b); +} + +PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) +{ + return *addr; +} + +PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) +{ + return *addr; +} + +// unsigned compares are not supported on x86 +PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) +{ + // _mm_cmpgt_epi16 doesn't work for unsigned values unfortunately + // return m128_I2F(_mm_cmpgt_epi16(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); + VecU16V result; + result.m128_u16[0] = PxU16((a).m128_u16[0] > (b).m128_u16[0]); + result.m128_u16[1] = PxU16((a).m128_u16[1] > (b).m128_u16[1]); + result.m128_u16[2] = PxU16((a).m128_u16[2] > (b).m128_u16[2]); + result.m128_u16[3] = PxU16((a).m128_u16[3] > (b).m128_u16[3]); + result.m128_u16[4] = PxU16((a).m128_u16[4] > (b).m128_u16[4]); + result.m128_u16[5] = PxU16((a).m128_u16[5] > (b).m128_u16[5]); + result.m128_u16[6] = PxU16((a).m128_u16[6] > (b).m128_u16[6]); + result.m128_u16[7] = PxU16((a).m128_u16[7] > (b).m128_u16[7]); + return result; +} + +PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) +{ + return internalWindowsSimd::m128_I2F( + _mm_cmpgt_epi16(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) +{ + Vec4V result = V4LoadXYZW(PxF32(a.m128_u32[0]), PxF32(a.m128_u32[1]), PxF32(a.m128_u32[2]), PxF32(a.m128_u32[3])); + return result; +} + +PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) +{ + return _mm_cvtepi32_ps(internalWindowsSimd::m128_F2I(a)); +} + +PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) +{ + return internalWindowsSimd::m128_I2F(_mm_cvttps_epi32(a)); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) +{ + return Vec4V(a); +} + +PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecU32V(a); +} + +PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) +{ + return VecI32V(a); +} + +template +PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) +{ + return internalWindowsSimd::m128_I2F( + _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +template +PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) +{ + return internalWindowsSimd::m128_I2F( + _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); +} + +PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) +{ + VecU32V result; + result.m128_u32[0] = x; + result.m128_u32[1] = y; + result.m128_u32[2] = z; + result.m128_u32[3] = w; + return result; +} + +PX_FORCE_INLINE Vec4V V4ConvertFromI32V(const VecI32V in) +{ + return _mm_cvtepi32_ps(internalWindowsSimd::m128_F2I(in)); +} + +} // namespace aos +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsIntrinsics.h new file mode 100644 index 0000000..169c076 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsIntrinsics.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_INTRINSICS_H +#define PX_WINDOWS_INTRINSICS_H + +#include "foundation/PxAssert.h" + +// this file is for internal intrinsics - that is, intrinsics that are used in +// cross platform code but do not appear in the API + +#if !PX_WINDOWS_FAMILY +#error "This file should only be included by Windows builds!!" +#endif + +#pragma warning(push) +//'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#pragma warning(disable : 4668) +#if PX_VC == 10 +#pragma warning(disable : 4987) // nonstandard extension used: 'throw (...)' +#endif +#include +#pragma warning(pop) + +#pragma warning(push) +#pragma warning(disable : 4985) // 'symbol name': attributes not present on previous declaration +#include +#pragma warning(pop) + +#include +// do not include for ARM target +#if !PX_ARM && !PX_A64 +#include +#endif + +#pragma intrinsic(_BitScanForward) +#pragma intrinsic(_BitScanReverse) + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/* +* Implements a memory barrier +*/ +PX_FORCE_INLINE void PxMemoryBarrier() +{ + #if PX_CLANG + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #endif + _ReadWriteBarrier(); + #if PX_CLANG + #pragma clang diagnostic pop + #endif + /* long Barrier; + __asm { + xchg Barrier, eax + }*/ +} + +/*! +Returns the index of the highest set bit. Not valid for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxHighestSetBitUnsafe(uint32_t v) +{ + unsigned long retval; + _BitScanReverse(&retval, v); + return retval; +} + +/*! +Returns the index of the highest set bit. Undefined for zero arg. +*/ +PX_FORCE_INLINE uint32_t PxLowestSetBitUnsafe(uint32_t v) +{ + unsigned long retval; + _BitScanForward(&retval, v); + return retval; +} + +/*! +Returns the number of leading zeros in v. Returns 32 for v=0. +*/ +PX_FORCE_INLINE uint32_t PxCountLeadingZeros(uint32_t v) +{ + if(v) + { + unsigned long bsr = (unsigned long)-1; + _BitScanReverse(&bsr, v); + return 31 - bsr; + } + else + return 32; +} + +/*! +Prefetch aligned cache size around \c ptr+offset. +*/ +#if !PX_ARM && !PX_A64 +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ + // cache line on X86/X64 is 64-bytes so a 128-byte prefetch would require 2 prefetches. + // However, we can only dispatch a limited number of prefetch instructions so we opt to prefetch just 1 cache line + /*_mm_prefetch(((const char*)ptr + offset), _MM_HINT_T0);*/ + // We get slightly better performance prefetching to non-temporal addresses instead of all cache levels + _mm_prefetch(((const char*)ptr + offset), _MM_HINT_NTA); +} +#else +PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) +{ + // arm does have 32b cache line size + __prefetch(((const char*)ptr + offset)); +} +#endif + +/*! +Prefetch \c count bytes starting at \c ptr. +*/ +#if !PX_ARM +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = (char*)ptr; + uint64_t p = size_t(ptr); + uint64_t startLine = p >> 6, endLine = (p + count - 1) >> 6; + uint64_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 64; + } while(--lines); +} +#else +PX_FORCE_INLINE void PxPrefetch(const void* ptr, uint32_t count = 1) +{ + const char* cp = (char*)ptr; + uint32_t p = size_t(ptr); + uint32_t startLine = p >> 5, endLine = (p + count - 1) >> 5; + uint32_t lines = endLine - startLine + 1; + do + { + PxPrefetchLine(cp); + cp += 32; + } while(--lines); +} +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsMathIntrinsics.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsMathIntrinsics.h new file mode 100644 index 0000000..1eed281 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsMathIntrinsics.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_MATH_INTRINSICS_H +#define PX_WINDOWS_MATH_INTRINSICS_H + +#include "foundation/Px.h" +#include "foundation/PxAssert.h" + +#if !PX_WINDOWS_FAMILY +#error "This file should only be included by Windows builds!!" +#endif + +#include +#include + +#if !PX_DOXYGEN +namespace physx +{ +namespace intrinsics +{ +#endif + +//! \brief platform-specific absolute value +PX_CUDA_CALLABLE PX_FORCE_INLINE float abs(float a) +{ + return ::fabsf(a); +} + +//! \brief platform-specific select float +PX_CUDA_CALLABLE PX_FORCE_INLINE float fsel(float a, float b, float c) +{ + return (a >= 0.0f) ? b : c; +} + +//! \brief platform-specific sign +PX_CUDA_CALLABLE PX_FORCE_INLINE float sign(float a) +{ + return (a >= 0.0f) ? 1.0f : -1.0f; +} + +//! \brief platform-specific reciprocal +PX_CUDA_CALLABLE PX_FORCE_INLINE float recip(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific reciprocal estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipFast(float a) +{ + return 1.0f / a; +} + +//! \brief platform-specific square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float sqrt(float a) +{ + return ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrt(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific reciprocal square root estimate +PX_CUDA_CALLABLE PX_FORCE_INLINE float recipSqrtFast(float a) +{ + return 1.0f / ::sqrtf(a); +} + +//! \brief platform-specific sine +PX_CUDA_CALLABLE PX_FORCE_INLINE float sin(float a) +{ + return ::sinf(a); +} + +//! \brief platform-specific cosine +PX_CUDA_CALLABLE PX_FORCE_INLINE float cos(float a) +{ + return ::cosf(a); +} + +//! \brief platform-specific minimum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMin(float a, float b) +{ + return a < b ? a : b; +} + +//! \brief platform-specific maximum +PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b) +{ + return a > b ? a : b; +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a) +{ +#ifdef __CUDACC__ + return !!isfinite(a); +#else + return (0 == ((_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF) & _fpclass(a))); +#endif +} + +//! \brief platform-specific finiteness check (not INF or NAN) +PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(double a) +{ +#ifdef __CUDACC__ + return !!isfinite(a); +#else + return (0 == ((_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF) & _fpclass(a))); +#endif +} + +/*! +Sets \c count bytes starting at \c dst to zero. +*/ +PX_FORCE_INLINE void* memZero(void* dest, uint32_t count) +{ + return memset(dest, 0, count); +} + +/*! +Sets \c count bytes starting at \c dst to \c c. +*/ +PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count) +{ + return memset(dest, c, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. User memMove if regions overlap. +*/ +PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count) +{ + return memcpy(dest, src, count); +} + +/*! +Copies \c count bytes from \c src to \c dst. Supports overlapping regions. +*/ +PX_FORCE_INLINE void* memMove(void* dest, const void* src, uint32_t count) +{ + return memmove(dest, src, count); +} + +#if !PX_DOXYGEN +} // namespace intrinsics +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsTrigConstants.h b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsTrigConstants.h new file mode 100644 index 0000000..673244d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/foundation/windows/PxWindowsTrigConstants.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_WINDOWS_TRIG_CONSTANTS_H +#define PX_WINDOWS_TRIG_CONSTANTS_H + +namespace physx +{ +namespace aos +{ + +#define PX_GLOBALCONST extern const __declspec(selectany) + +__declspec(align(16)) struct PX_VECTORF32 +{ + float f[4]; +}; + +PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; +PX_GLOBALCONST PX_VECTORF32 +g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; +PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; +PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; + +} // namespace aos +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVH.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVH.h new file mode 100644 index 0000000..f316db5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVH.h @@ -0,0 +1,329 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BVH_H +#define PX_BVH_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxBase.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxGeometryQueryFlags.h" +#include "geometry/PxReportCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; + +struct PxBVHRaycastCallback +{ + PxBVHRaycastCallback() {} + virtual ~PxBVHRaycastCallback() {} + + // Reports one raycast or sweep hit. + // boundsIndex [in] Index of touched bounds + // distance [in/out] Impact distance. Shrinks the ray if written out. + // return false to abort the query + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) = 0; +}; + +struct PxBVHOverlapCallback +{ + PxBVHOverlapCallback() {} + virtual ~PxBVHOverlapCallback() {} + + // Reports one overlap hit. + // boundsIndex [in] Index of touched bounds + // return false to abort the query + virtual bool reportHit(PxU32 boundsIndex) = 0; +}; + +struct PxBVHTraversalCallback +{ + PxBVHTraversalCallback() {} + virtual ~PxBVHTraversalCallback() {} + + // Reports one visited node. + // bounds [in] node bounds + // return true to continue traversing this branch + virtual bool visitNode(const PxBounds3& bounds) = 0; + + // Reports one validated leaf node. Called on leaf nodes after visitNode returns true on them. + // nbPrims [in] number of primitives in the node + // prims [in] primitives in the node (nbPrims entries) + // return false to abort the query + virtual bool reportLeaf(PxU32 nbPrims, const PxU32* prims) = 0; +}; + +/** +\brief Class representing a bounding volume hierarchy. + +PxBVH can be provided to PxScene::addActor. In this case the scene query +pruning structure inside PhysX SDK will store/update one bound per actor. +The scene queries against such an actor will query actor bounds and then +make a local space query against the provided BVH, which is in actor's +local space. + +PxBVH can also be used as a standalone data-structure for arbitrary +purposes, unrelated to PxScene / PxActor. + +@see PxScene::addActor +*/ +class PxBVH : public PxBase +{ +public: + + /** + \brief Raycast test against a BVH. + + \param[in] origin The origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[in] maxHits Max number of returned hits = size of 'rayHits' buffer + \param[out] rayHits Raycast hits information, bounds indices + \return Number of hits + @deprecated + */ + PX_DEPRECATED virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT rayHits) const = 0; + + /** + \brief Sweep test against a BVH. + + \param[in] aabb The axis aligned bounding box to sweep + \param[in] unitDir Normalized direction of the sweep. + \param[in] maxDist Maximum sweep length, has to be in the [0, inf) range + \param[in] maxHits Max number of returned hits = size of 'sweepHits' buffer + \param[out] sweepHits Sweep hits information, bounds indices + \return Number of hits + @deprecated + */ + PX_DEPRECATED virtual PxU32 sweep(const PxBounds3& aabb, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT sweepHits) const = 0; + + /** + \brief AABB overlap test against a BVH. + + \param[in] aabb The axis aligned bounding box + \param[in] maxHits Max number of returned hits = size of 'overlapHits' buffer + \param[out] overlapHits Overlap hits information, bounds indices + \return Number of hits + @deprecated + */ + PX_DEPRECATED virtual PxU32 overlap(const PxBounds3& aabb, PxU32 maxHits, PxU32* PX_RESTRICT overlapHits) const = 0; + + /** + \brief Raycast test against a BVH. + + \param[in] origin The origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[in] cb Raycast callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, float maxDist, PxBVHRaycastCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Sweep test against a BVH. + + \param[in] geom The query volume + \param[in] pose The pose of the query volume + \param[in] unitDir Normalized direction of the sweep. + \param[in] maxDist Maximum sweep length, has to be in the [0, inf) range + \param[in] cb Raycast callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool sweep(const PxGeometry& geom, const PxTransform& pose, const PxVec3& unitDir, float maxDist, PxBVHRaycastCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Overlap test against a BVH. + + \param[in] geom The query volume + \param[in] pose The pose of the query volume + \param[in] cb Overlap callback, called once per hit + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool overlap(const PxGeometry& geom, const PxTransform& pose, PxBVHOverlapCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Frustum culling test against a BVH. + + This is similar in spirit to an overlap query using a convex object around the frustum. + However this specialized query has better performance, and can support more than the 6 planes + of a frustum, which can be useful in portal-based engines. + + On the other hand this test only returns a conservative number of bounds, i.e. some of the returned + bounds may actually be outside the frustum volume, close to it but not touching it. This is usually + an ok performance trade-off when the function is used for view-frustum culling. + + \param[in] nbPlanes Number of planes. Only 32 planes max are supported. + \param[in] planes Array of planes, should be in the same space as the BVH. + \param[in] cb Overlap callback, called once per visible object + \param[in] queryFlags Optional flags controlling the query. + \return false if query has been aborted + */ + virtual bool cull(PxU32 nbPlanes, const PxPlane* planes, PxBVHOverlapCallback& cb, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT) const = 0; + + /** + \brief Returns the number of bounds in the BVH. + + You can use #getBounds() to retrieve the bounds. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + \return Number of bounds in the BVH. + + @see getBounds() getBoundsForModification() + */ + virtual PxU32 getNbBounds() const = 0; + + /** + \brief Retrieve the read-only bounds in the BVH. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + @see PxBounds3 getNbBounds() getBoundsForModification() + */ + virtual const PxBounds3* getBounds() const = 0; + + /** + \brief Retrieve the bounds in the BVH. + + These bounds can be modified. Call refit() after modifications are done. + + \note These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + + @see PxBounds3 getNbBounds() getBounds() refit() updateBounds() partialRefit() + */ + PX_FORCE_INLINE PxBounds3* getBoundsForModification() + { + return const_cast(getBounds()); + } + + /** + \brief Refit the BVH. + + This function "refits" the tree, i.e. takes the new (leaf) bounding boxes into account and + recomputes all the BVH bounds accordingly. This is an O(n) operation with n = number of bounds in the BVH. + + This works best with minor bounds modifications, i.e. when the bounds remain close to their initial values. + With large modifications the tree quality degrades more and more, and subsequent query performance suffers. + It might be a better strategy to create a brand new BVH if bounds change drastically. + + This function refits the whole tree after an arbitrary number of bounds have potentially been modified by + users (via getBoundsForModification()). If you only have a small number of bounds to update, it might be + more efficient to use setBounds() and partialRefit() instead. + + @see getNbBounds() getBoundsForModification() updateBounds() partialRefit() + */ + virtual void refit() = 0; + + /** + \brief Update single bounds. + + This is an alternative to getBoundsForModification() / refit(). If you only have a small set of bounds to + update, it can be inefficient to call the refit() function, because it refits the whole BVH. + + Instead, one can update individual bounds with this updateBounds() function. It sets the new bounds and + marks the corresponding BVH nodes for partial refit. Once all the individual bounds have been updated, + call partialRefit() to only refit the subset of marked nodes. + + \param[in] boundsIndex Index of updated bounds. Valid range is between 0 and getNbBounds(). + \param[in] newBounds Updated bounds. + + \return true if success + + @see getNbBounds() getBoundsForModification() refit() partialRefit() + */ + virtual bool updateBounds(PxU32 boundsIndex, const PxBounds3& newBounds) = 0; + + /** + \brief Refits subset of marked nodes. + + This is an alternative to the refit() function, to be called after updateBounds() calls. + See updateBounds() for details. + + @see getNbBounds() getBoundsForModification() refit() updateBounds() + */ + virtual void partialRefit() = 0; + + /** + \brief Generic BVH traversal function. + + This can be used to implement custom BVH traversal functions if provided ones are not enough. + In particular this can be used to visualize the tree's bounds. + + \param[in] cb Traversal callback, called for each visited node + \return false if query has been aborted + */ + virtual bool traverse(PxBVHTraversalCallback& cb) const = 0; + + virtual const char* getConcreteTypeName() const { return "PxBVH"; } +protected: + PX_INLINE PxBVH(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PX_INLINE PxBVH(PxBaseFlags baseFlags) : PxBase(baseFlags) {} + virtual ~PxBVH() {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH", name) || PxBase::isKindOf(name); } +}; + + struct PxGeomIndexPair; + + /** + \brief BVH-vs-BVH overlap test + + This function returns pairs of box indices that belong to both the first & second input bvhs. + + \param[in] callback The callback object used to report results + \param[in] bvh0 First bvh + \param[in] bvh1 Second bvh + \return true if an overlap has been detected + + @see PxBVH PxReportCallback + */ + PX_DEPRECATED PX_C_EXPORT PX_PHYSX_COMMON_API bool PX_CALL_CONV PxFindOverlap(PxReportCallback& callback, const PxBVH& bvh0, const PxBVH& bvh1); + +//! @cond + /** + * @deprecated + */ + typedef PX_DEPRECATED PxBVH PxBVHStructure; +//! @endcond + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVHBuildStrategy.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVHBuildStrategy.h new file mode 100644 index 0000000..4397201 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBVHBuildStrategy.h @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BVH_BUILD_STRATEGY_H +#define PX_BVH_BUILD_STRATEGY_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Desired build strategy for bounding-volume hierarchies +*/ +struct PxBVHBuildStrategy +{ + enum Enum + { + eFAST = 0, //!< Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime cooking. + eDEFAULT = 1, //!< Default build strategy. Medium build speed, good runtime performance in all cases. + eSAH = 2, //!< SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + + eLAST + }; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBoxGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBoxGeometry.h new file mode 100644 index 0000000..de04acc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxBoxGeometry.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_BOX_GEOMETRY_H +#define PX_BOX_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class representing the geometry of a box. + +The geometry of a box can be fully specified by its half extents. This is the half of its width, height, and depth. +\note The scaling of the box is expected to be baked into these values, there is no additional scaling parameter. +*/ +class PxBoxGeometry : public PxGeometry +{ +public: + /** + \brief Constructor to initialize half extents from scalar parameters. + \param hx Initial half extents' x component. + \param hy Initial half extents' y component. + \param hz Initial half extents' z component. + */ + PX_INLINE PxBoxGeometry(PxReal hx=0.0f, PxReal hy=0.0f, PxReal hz=0.0f) : PxGeometry(PxGeometryType::eBOX), halfExtents(hx, hy, hz) {} + + /** + \brief Constructor to initialize half extents from vector parameter. + \param halfExtents_ Initial half extents. + */ + PX_INLINE PxBoxGeometry(PxVec3 halfExtents_) : PxGeometry(PxGeometryType::eBOX), halfExtents(halfExtents_) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxBoxGeometry(const PxBoxGeometry& that) : PxGeometry(that), halfExtents(that.halfExtents) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxBoxGeometry& that) + { + mType = that.mType; + halfExtents = that.halfExtents; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid + + \note A valid box has a positive extent in each direction (halfExtents.x > 0, halfExtents.y > 0, halfExtents.z > 0). + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a box that has zero extent in any direction. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + /** + \brief Half of the width, height, and depth of the box. + */ + PxVec3 halfExtents; +}; + +PX_INLINE bool PxBoxGeometry::isValid() const +{ + if(mType != PxGeometryType::eBOX) + return false; + if(!halfExtents.isFinite()) + return false; + if(halfExtents.x <= 0.0f || halfExtents.y <= 0.0f || halfExtents.z <= 0.0f) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCapsuleGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCapsuleGeometry.h new file mode 100644 index 0000000..69a59f9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCapsuleGeometry.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CAPSULE_GEOMETRY_H +#define PX_CAPSULE_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "foundation/PxFoundationConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class representing the geometry of a capsule. + +Capsules are shaped as the union of a cylinder of length 2 * halfHeight and with the +given radius centered at the origin and extending along the x axis, and two hemispherical ends. +\note The scaling of the capsule is expected to be baked into these values, there is no additional scaling parameter. + +The function PxTransformFromSegment is a helper for generating an appropriate transform for the capsule from the capsule's interior line segment. + +@see PxTransformFromSegment +*/ +class PxCapsuleGeometry : public PxGeometry +{ +public: + /** + \brief Constructor, initializes to a capsule with passed radius and half height. + */ + PX_INLINE PxCapsuleGeometry(PxReal radius_=0.0f, PxReal halfHeight_=0.0f) : PxGeometry(PxGeometryType::eCAPSULE), radius(radius_), halfHeight(halfHeight_) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxCapsuleGeometry(const PxCapsuleGeometry& that) : PxGeometry(that), radius(that.radius), halfHeight(that.halfHeight) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxCapsuleGeometry& that) + { + mType = that.mType; + radius = that.radius; + halfHeight = that.halfHeight; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid. + + \note A valid capsule has radius > 0, halfHeight >= 0. + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a capsule that has zero radius or height. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + /** + \brief The radius of the capsule. + */ + PxReal radius; + + /** + \brief half of the capsule's height, measured between the centers of the hemispherical ends. + */ + PxReal halfHeight; +}; + +PX_INLINE bool PxCapsuleGeometry::isValid() const +{ + if(mType != PxGeometryType::eCAPSULE) + return false; + if(!PxIsFinite(radius) || !PxIsFinite(halfHeight)) + return false; + if(radius <= 0.0f || halfHeight < 0.0f) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMesh.h new file mode 100644 index 0000000..a0c9457 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMesh.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONVEX_MESH_H +#define PX_CONVEX_MESH_H +/** \addtogroup geomutils + @{ +*/ + +#include "foundation/Px.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Polygon data + +Plane format: (mPlane[0],mPlane[1],mPlane[2]).dot(x) + mPlane[3] = 0 +With the normal outward-facing from the hull. +*/ +struct PxHullPolygon +{ + PxReal mPlane[4]; //!< Plane equation for this polygon + PxU16 mNbVerts; //!< Number of vertices/edges in the polygon + PxU16 mIndexBase; //!< Offset in index buffer +}; + +/** +\brief A convex mesh. + +Internally represented as a list of convex polygons. The number +of polygons is limited to 256. + +To avoid duplicating data when you have several instances of a particular +mesh positioned differently, you do not use this class to represent a +convex object directly. Instead, you create an instance of this mesh via +the PxConvexMeshGeometry and PxShape classes. + +

Creation

+ +To create an instance of this class call PxPhysics::createConvexMesh(), +and PxConvexMesh::release() to delete it. This is only possible +once you have released all of its #PxShape instances. + +

Visualizations:

+\li #PxVisualizationParameter::eCOLLISION_AABBS +\li #PxVisualizationParameter::eCOLLISION_SHAPES +\li #PxVisualizationParameter::eCOLLISION_AXES +\li #PxVisualizationParameter::eCOLLISION_FNORMALS +\li #PxVisualizationParameter::eCOLLISION_EDGES + +@see PxConvexMeshDesc PxPhysics.createConvexMesh() +*/ +class PxConvexMesh : public PxRefCounted +{ +public: + + /** + \brief Returns the number of vertices. + \return Number of vertices. + @see getVertices() + */ + virtual PxU32 getNbVertices() const = 0; + + /** + \brief Returns the vertices. + \return Array of vertices. + @see getNbVertices() + */ + virtual const PxVec3* getVertices() const = 0; + + /** + \brief Returns the index buffer. + \return Index buffer. + @see getNbPolygons() getPolygonData() + */ + virtual const PxU8* getIndexBuffer() const = 0; + + /** + \brief Returns the number of polygons. + \return Number of polygons. + @see getIndexBuffer() getPolygonData() + */ + virtual PxU32 getNbPolygons() const = 0; + + /** + \brief Returns the polygon data. + \param[in] index Polygon index in [0 ; getNbPolygons()[. + \param[out] data Polygon data. + \return True if success. + @see getIndexBuffer() getNbPolygons() + */ + virtual bool getPolygonData(PxU32 index, PxHullPolygon& data) const = 0; + + /** + \brief Decrements the reference count of a convex mesh and releases it if the new reference count is zero. + + @see PxPhysics.createConvexMesh() PxConvexMeshGeometry PxShape + */ + virtual void release() = 0; + + /** + \brief Returns the mass properties of the mesh assuming unit density. + + The following relationship holds between mass and volume: + + mass = volume * density + + The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh. + + Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the + localInertia of the unit density mesh by d. + + \param[out] mass The mass of the mesh assuming unit density. + \param[out] localInertia The inertia tensor in mesh local space assuming unit density. + \param[out] localCenterOfMass Position of center of mass (or centroid) in mesh local space. + */ + virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const = 0; + + /** + \brief Returns the local-space (vertex space) AABB from the convex mesh. + + \return local-space bounds + */ + virtual PxBounds3 getLocalBounds() const = 0; + + /** + \brief Returns the local-space Signed Distance Field for this mesh if it has one. + \return local-space SDF. + */ + virtual const PxReal* getSDF() const = 0; + + + virtual const char* getConcreteTypeName() const { return "PxConvexMesh"; } + + /** + \brief This method decides whether a convex mesh is gpu compatible. If the total number of vertices are more than 64 or any number of vertices in a polygon is more than 32, or + convex hull data was not cooked with GPU data enabled during cooking or was loaded from a serialized collection, the convex hull is incompatible with GPU collision detection. Otherwise + it is compatible. + + \return True if the convex hull is gpu compatible + */ + virtual bool isGpuCompatible() const = 0; + + +protected: + PX_INLINE PxConvexMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxConvexMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxConvexMesh() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxConvexMesh", name) || PxRefCounted::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMeshGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMeshGeometry.h new file mode 100644 index 0000000..1a35d33 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxConvexMeshGeometry.h @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONVEX_MESH_GEOMETRY_H +#define PX_CONVEX_MESH_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "geometry/PxMeshScale.h" +#include "common/PxCoreUtilityTypes.h" +#include "geometry/PxConvexMesh.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxConvexMesh; + +/** +\brief Flags controlling the simulated behavior of the convex mesh geometry. + +Used in ::PxConvexMeshGeometryFlags. +*/ +struct PxConvexMeshGeometryFlag +{ + enum Enum + { + eTIGHT_BOUNDS = (1<<0) //!< Use tighter (but more expensive to compute) bounds around the convex geometry. + }; +}; + +/** +\brief collection of set bits defined in PxConvexMeshGeometryFlag. + +@see PxConvexMeshGeometryFlag +*/ +typedef PxFlags PxConvexMeshGeometryFlags; +PX_FLAGS_OPERATORS(PxConvexMeshGeometryFlag::Enum,PxU8) + +/** +\brief Convex mesh geometry class. + +This class unifies a convex mesh object with a scaling transform, and +lets the combined object be used anywhere a PxGeometry is needed. + +The scaling is a transform along arbitrary axes contained in the scale object. +The vertices of the mesh in geometry (or shape) space is the +PxMeshScale::toMat33() transform, multiplied by the vertex space vertices +in the PxConvexMesh object. +*/ +class PxConvexMeshGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. By default creates an empty object with a NULL mesh and identity scale. + + \param[in] mesh Mesh pointer. May be NULL, though this will not make the object valid for shape construction. + \param[in] scaling Scale factor. + \param[in] flags Mesh flags. + \ + */ + PX_INLINE PxConvexMeshGeometry( PxConvexMesh* mesh = NULL, + const PxMeshScale& scaling = PxMeshScale(), + PxConvexMeshGeometryFlags flags = PxConvexMeshGeometryFlag::eTIGHT_BOUNDS) : + PxGeometry (PxGeometryType::eCONVEXMESH), + scale (scaling), + convexMesh (mesh), + meshFlags (flags) + { + } + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxConvexMeshGeometry(const PxConvexMeshGeometry& that) : + PxGeometry (that), + scale (that.scale), + convexMesh (that.convexMesh), + meshFlags (that.meshFlags) + { + } + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxConvexMeshGeometry& that) + { + mType = that.mType; + scale = that.scale; + convexMesh = that.convexMesh; + meshFlags = that.meshFlags; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + \note A valid convex mesh has a positive scale value in each direction (scale.x > 0, scale.y > 0, scale.z > 0). + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a convex that has zero extent in any direction. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + PxMeshScale scale; //!< The scaling transformation (from vertex space to shape space). + PxConvexMesh* convexMesh; //!< A reference to the convex mesh object. + PxConvexMeshGeometryFlags meshFlags; //!< Mesh flags. + PxPadding<3> paddingFromFlags; //!< padding for mesh flags +}; + + +PX_INLINE bool PxConvexMeshGeometry::isValid() const +{ + if(mType != PxGeometryType::eCONVEXMESH) + return false; + if(!scale.scale.isFinite() || !scale.rotation.isUnit()) + return false; + if(!scale.isValidForConvexMesh()) + return false; + if(!convexMesh) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCustomGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCustomGeometry.h new file mode 100644 index 0000000..9b5c87b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxCustomGeometry.h @@ -0,0 +1,311 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CUSTOMGEOMETRY_H +#define PX_CUSTOMGEOMETRY_H +/** \addtogroup geomutils +@{ +*/ + +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" +#include "foundation/PxFoundationConfig.h" +#include "PxPhysXConfig.h" + +/** +\brief For internal use +*/ +PX_C_EXPORT PX_PHYSX_COMMON_API uint32_t PxCustomGeometry_getUniqueID(); + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxContactBuffer; + class PxRenderOutput; + class PxMassProperties; + + /** + \brief The type of a custom geometry. Allows to identify a particular kind of it. + */ + struct PxCustomGeometryType + { + /** + \brief Default constructor + */ + PX_INLINE PxCustomGeometryType() : mID(PxCustomGeometry_getUniqueID()) {} + + /** + \brief Default constructor + */ + PX_INLINE PxCustomGeometryType(const PxCustomGeometryType& t) : mID(t.mID) {} + + /** + \brief Assigment operator + */ + PX_INLINE PxCustomGeometryType& operator = (const PxCustomGeometryType& t) { mID = t.mID; return *this; } + + /** + \brief Equality operator + */ + PX_INLINE bool operator == (const PxCustomGeometryType& t) const { return mID == t.mID; } + + /** + \brief Inequality operator + */ + PX_INLINE bool operator != (const PxCustomGeometryType& t) const { return mID != t.mID; } + + /** + \brief Invalid type + */ + PX_INLINE static PxCustomGeometryType INVALID() { PxU32 z(0); return reinterpret_cast(z); } + + private: + PxU32 mID; + }; + + /** + \brief Custom geometry callbacks structure. User should inherit this and implement all pure virtual functions. + */ + struct PxCustomGeometryCallbacks + { + /** + \brief Return custom type. The type purpose is for user to differentiate custom geometries. Not used by PhysX. + + \return Unique ID of a custom geometry type. + + \note User should use DECLARE_CUSTOM_GEOMETRY_TYPE and IMPLEMENT_CUSTOM_GEOMETRY_TYPE intead of overwriting this function. + */ + virtual PxCustomGeometryType getCustomType() const = 0; + + /** + \brief Return local bounds. + + \param[in] geometry This geometry. + + \return Bounding box in the geometry local space. + */ + virtual PxBounds3 getLocalBounds(const PxGeometry& geometry) const = 0; + + /** + \brief Contacts generation. Generate collision contacts between two geometries in given poses. + + \param[in] geom0 This custom geometry + \param[in] geom1 The other geometry + \param[in] pose0 This custom geometry pose + \param[in] pose1 The other geometry pose + \param[in] contactDistance The distance at which contacts begin to be generated between the pairs + \param[in] meshContactMargin The mesh contact margin. + \param[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param[out] contactBuffer A buffer to write contacts to. + + \return True if there are contacts. False otherwise. + */ + PX_DEPRECATED virtual bool generateContacts(const PxGeometry& geom0, const PxGeometry& geom1, const PxTransform& pose0, const PxTransform& pose1, + const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, + PxContactBuffer& contactBuffer) const = 0; + + /** + \brief Raycast. Cast a ray against the geometry in given pose. + + \param[in] origin Origin of the ray. + \param[in] unitDir Normalized direction of the ray. + \param[in] geom This custom geometry + \param[in] pose This custom geometry pose + \param[in] maxDist Length of the ray. Has to be in the [0, inf) range. + \param[in] hitFlags Specifies which properties per hit should be computed and returned via the hit callback. + \param[in] maxHits max number of returned hits = size of 'rayHits' buffer + \param[out] rayHits Ray hits. + \param[in] stride Ray hit structure stride. + \param[in] threadContext Optional user-defined per-thread context. + + \return Number of hits. + */ + virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* rayHits, PxU32 stride, PxRaycastThreadContext* threadContext) const = 0; + + /** + \brief Overlap. Test if geometries overlap. + + \param[in] geom0 This custom geometry + \param[in] pose0 This custom geometry pose + \param[in] geom1 The other geometry + \param[in] pose1 The other geometry pose + \param[in] threadContext Optional user-defined per-thread context. + + \return True if there is overlap. False otherwise. + */ + virtual bool overlap(const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext* threadContext) const = 0; + + /** + \brief Sweep. Sweep one geometry against the other. + + \param[in] unitDir Normalized direction of the sweep. + \param[in] maxDist Length of the sweep. Has to be in the [0, inf) range. + \param[in] geom0 This custom geometry + \param[in] pose0 This custom geometry pose + \param[in] geom1 The other geometry + \param[in] pose1 The other geometry pose + \param[out] sweepHit Used to report the sweep hit. + \param[in] hitFlags Specifies which properties per hit should be computed and returned via the hit callback. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. + \param[in] threadContext Optional user-defined per-thread context. + + \return True if there is hit. False otherwise. + */ + virtual bool sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& geom0, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext* threadContext) const = 0; + + /** + \brief Visualize custom geometry for debugging. Optional. + + \param[in] geometry This geometry. + \param[in] out Render output. + \param[in] absPose Geometry absolute transform. + \param[in] cullbox Region to visualize. + */ + PX_DEPRECATED virtual void visualize(const PxGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose, const PxBounds3& cullbox) const = 0; + + /** + \brief Compute custom geometry mass properties. For geometries usable with dynamic rigidbodies. + + \param[in] geometry This geometry. + \param[out] massProperties Mass properties to compute. + */ + virtual void computeMassProperties(const PxGeometry& geometry, PxMassProperties& massProperties) const = 0; + + /** + \brief Compatible with PhysX's PCM feature. Allows to optimize contact generation. + + \param[in] geometry This geometry. + \param[out] breakingThreshold The threshold to trigger contacts re-generation. + */ + virtual bool usePersistentContactManifold(const PxGeometry& geometry, PxReal& breakingThreshold) const = 0; + + /* Destructor */ + virtual ~PxCustomGeometryCallbacks() {} + }; + + /** + \brief Custom geometry class. This class allows user to create custom geometries by providing a set of virtual callback functions. + */ + class PxCustomGeometry : public PxGeometry + { + public: + /** + \brief Default constructor. + + Creates an empty object with a NULL callbacks pointer. + */ + PX_INLINE PxCustomGeometry() : + PxGeometry(PxGeometryType::eCUSTOM), + callbacks(NULL) + {} + + /** + \brief Constructor. + */ + PX_INLINE PxCustomGeometry(PxCustomGeometryCallbacks& _callbacks) : + PxGeometry(PxGeometryType::eCUSTOM), + callbacks(&_callbacks) + {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxCustomGeometry(const PxCustomGeometry& that) : + PxGeometry(that), + callbacks(that.callbacks) + {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxCustomGeometry& that) + { + mType = that.mType; + callbacks = that.callbacks; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + + /** + \brief Returns the custom type of the custom geometry. + */ + PX_INLINE PxCustomGeometryType getCustomType() const + { + return callbacks ? callbacks->getCustomType() : PxCustomGeometryType::INVALID(); + } + + public: + PxCustomGeometryCallbacks* callbacks; //!< A reference to the callbacks object. + }; + + PX_INLINE bool PxCustomGeometry::isValid() const + { + return mType == PxGeometryType::eCUSTOM && callbacks != NULL; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** +\brief Used in pair with IMPLEMENT_CUSTOM_GEOMETRY_TYPE to overwrite Callbacks::getCustomType() callback. +*/ +#define DECLARE_CUSTOM_GEOMETRY_TYPE \ + static ::physx::PxCustomGeometryType TYPE(); \ + virtual ::physx::PxCustomGeometryType getCustomType() const; + +/** +\brief Used in pair with DECLARE_CUSTOM_GEOMETRY_TYPE to overwrite Callbacks::getCustomType() callback. +*/ +#define IMPLEMENT_CUSTOM_GEOMETRY_TYPE(CLASS) \ +::physx::PxCustomGeometryType CLASS::TYPE() \ +{ \ + static ::physx::PxCustomGeometryType customType; \ + return customType; \ +} \ +::physx::PxCustomGeometryType CLASS::getCustomType() const \ +{ \ + return TYPE(); \ +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometry.h new file mode 100644 index 0000000..043484c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometry.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_H +#define PX_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxFlags.h" +#include "foundation/PxMath.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A geometry type. + +Used to distinguish the type of a ::PxGeometry object. +*/ +struct PxGeometryType +{ + enum Enum + { + eSPHERE, + ePLANE, + eCAPSULE, + eBOX, + eCONVEXMESH, + ePARTICLESYSTEM, + eTETRAHEDRONMESH, + eTRIANGLEMESH, + eHEIGHTFIELD, + eHAIRSYSTEM, + eCUSTOM, + + eGEOMETRY_COUNT, //!< internal use only! + eINVALID = -1 //!< internal use only! + }; +}; + +/** +\brief A geometry object. + +A geometry object defines the characteristics of a spatial object, but without any information +about its placement in the world. + +\note This is an abstract class. You cannot create instances directly. Create an instance of one of the derived classes instead. +*/ +class PxGeometry +{ +public: + /** + \brief Returns the type of the geometry. + \return The type of the object. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxGeometryType::Enum getType() const { return mType; } + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxGeometry& that) + { + mType = that.mType; + } + +protected: + PX_CUDA_CALLABLE PX_FORCE_INLINE PxGeometry(PxGeometryType::Enum type) : mType(type) {} + PX_CUDA_CALLABLE PX_FORCE_INLINE PxGeometry(const PxGeometry& that) : mType(that.mType) {} + + PxGeometryType::Enum mType; + +public: + float mTypePadding; // PT: padding bytes on x64, used internally +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHelpers.h new file mode 100644 index 0000000..02983c1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHelpers.h @@ -0,0 +1,191 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_HELPERS_H +#define PX_GEOMETRY_HELPERS_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxPlane.h" +#include "foundation/PxTransform.h" +#include "foundation/PxUnionCast.h" +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxParticleSystemGeometry.h" +#include "geometry/PxHairSystemGeometry.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "geometry/PxCustomGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Geometry holder class + +This class contains enough space to hold a value of any PxGeometry subtype. + +Its principal use is as a convenience class to allow geometries to be returned polymorphically from functions. +*/ + +PX_ALIGN_PREFIX(4) +class PxGeometryHolder +{ + class PxInvalidGeometry : public PxGeometry + { + public: + PX_INLINE PxInvalidGeometry() : PxGeometry(PxGeometryType::eINVALID) {} + }; + +public: + PX_FORCE_INLINE PxGeometryType::Enum getType() const + { + return any().getType(); + } + + PX_FORCE_INLINE PxGeometry& any() + { + return *PxUnionCast(&bytes.geometry); + } + + PX_FORCE_INLINE const PxGeometry& any() const + { + return *PxUnionCast(&bytes.geometry); + } + +//! @cond + PX_FORCE_INLINE PxSphereGeometry& sphere() { return get(); } + PX_FORCE_INLINE const PxSphereGeometry& sphere() const { return get(); } + + PX_FORCE_INLINE PxPlaneGeometry& plane() { return get(); } + PX_FORCE_INLINE const PxPlaneGeometry& plane() const { return get(); } + + PX_FORCE_INLINE PxCapsuleGeometry& capsule() { return get(); } + PX_FORCE_INLINE const PxCapsuleGeometry& capsule() const { return get(); } + + PX_FORCE_INLINE PxBoxGeometry& box() { return get(); } + PX_FORCE_INLINE const PxBoxGeometry& box() const { return get(); } + + PX_FORCE_INLINE PxConvexMeshGeometry& convexMesh() { return get(); } + PX_FORCE_INLINE const PxConvexMeshGeometry& convexMesh() const { return get(); } + + PX_FORCE_INLINE PxTetrahedronMeshGeometry& tetMesh() { return get(); } + PX_FORCE_INLINE const PxTetrahedronMeshGeometry& tetMesh() const { return get(); } + + PX_FORCE_INLINE PxTriangleMeshGeometry& triangleMesh() { return get(); } + PX_FORCE_INLINE const PxTriangleMeshGeometry& triangleMesh() const { return get(); } + + PX_FORCE_INLINE PxHeightFieldGeometry& heightField() { return get(); } + PX_FORCE_INLINE const PxHeightFieldGeometry& heightField() const { return get(); } + + PX_FORCE_INLINE PxParticleSystemGeometry& particleSystem() { return get(); } + PX_FORCE_INLINE const PxParticleSystemGeometry& particleSystem() const { return get(); } + + PX_FORCE_INLINE PxHairSystemGeometry& hairSystem() { return get(); } + PX_FORCE_INLINE const PxHairSystemGeometry& hairSystem() const { return get(); } + + PX_FORCE_INLINE PxCustomGeometry& custom() { return get(); } + PX_FORCE_INLINE const PxCustomGeometry& custom() const { return get(); } +//! @endcond + + PX_FORCE_INLINE void storeAny(const PxGeometry& geometry) + { + PX_ASSERT_WITH_MESSAGE( (geometry.getType() >= PxGeometryType::eSPHERE) && + (geometry.getType() < PxGeometryType::eGEOMETRY_COUNT), + "Unexpected GeometryType in PxGeometryHolder::storeAny"); + + switch(geometry.getType()) + { + case PxGeometryType::eSPHERE: put(geometry); break; + case PxGeometryType::ePLANE: put(geometry); break; + case PxGeometryType::eCAPSULE: put(geometry); break; + case PxGeometryType::eBOX: put(geometry); break; + case PxGeometryType::eCONVEXMESH: put(geometry); break; + case PxGeometryType::eTRIANGLEMESH: put(geometry); break; + case PxGeometryType::eTETRAHEDRONMESH: put(geometry); break; + case PxGeometryType::eHEIGHTFIELD: put(geometry); break; + case PxGeometryType::ePARTICLESYSTEM: put(geometry); break; + case PxGeometryType::eHAIRSYSTEM: put(geometry); break; + case PxGeometryType::eCUSTOM: put(geometry); break; + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: break; + } + } + + PX_FORCE_INLINE PxGeometryHolder() { put(PxInvalidGeometry()); } + PX_FORCE_INLINE PxGeometryHolder(const PxGeometry& geometry){ storeAny(geometry); } + + private: + template void put(const PxGeometry& geometry) + { + static_cast(any()) = static_cast(geometry); + } + + template T& get() + { + PX_ASSERT(getType() == type); + return static_cast(any()); + } + + template T& get() const + { + PX_ASSERT(getType() == type); + return static_cast(any()); + } + + union { + PxU8 geometry[sizeof(PxGeometry)]; + PxU8 box[sizeof(PxBoxGeometry)]; + PxU8 sphere[sizeof(PxSphereGeometry)]; + PxU8 capsule[sizeof(PxCapsuleGeometry)]; + PxU8 plane[sizeof(PxPlaneGeometry)]; + PxU8 convex[sizeof(PxConvexMeshGeometry)]; + PxU8 tetMesh[sizeof(PxTetrahedronMeshGeometry)]; + PxU8 mesh[sizeof(PxTriangleMeshGeometry)]; + PxU8 heightfield[sizeof(PxHeightFieldGeometry)]; + PxU8 particleSystem[sizeof(PxParticleSystemGeometry)]; + PxU8 hairSystem[sizeof(PxHairSystemGeometry)]; + PxU8 custom[sizeof(PxCustomGeometry)]; + } bytes; +} +PX_ALIGN_SUFFIX(4); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHit.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHit.h new file mode 100644 index 0000000..a665850 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryHit.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_HIT_H +#define PX_GEOMETRY_HIT_H +/** \addtogroup scenequery +@{ +*/ +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Scene query and geometry query behavior flags. + +PxHitFlags are used for 3 different purposes: + +1) To request hit fields to be filled in by scene queries (such as hit position, normal, face index or UVs). +2) Once query is completed, to indicate which fields are valid (note that a query may produce more valid fields than requested). +3) To specify additional options for the narrow phase and mid-phase intersection routines. + +All these flags apply to both scene queries and geometry queries (PxGeometryQuery). + +@see PxRaycastHit PxSweepHit PxOverlapHit PxScene.raycast PxScene.sweep PxScene.overlap PxGeometryQuery PxFindFaceIndex +*/ +struct PxHitFlag +{ + enum Enum + { + ePOSITION = (1<<0), //!< "position" member of #PxQueryHit is valid + eNORMAL = (1<<1), //!< "normal" member of #PxQueryHit is valid + eUV = (1<<3), //!< "u" and "v" barycentric coordinates of #PxQueryHit are valid. Not applicable to sweep queries. + eASSUME_NO_INITIAL_OVERLAP = (1<<4), //!< Performance hint flag for sweeps when it is known upfront there's no initial overlap. + //!< NOTE: using this flag may cause undefined results if shapes are initially overlapping. + eANY_HIT = (1<<5), //!< Report any first hit. Used for geometries that contain more than one primitive. For meshes, + //!< if neither eMESH_MULTIPLE nor eANY_HIT is specified, a single closest hit will be reported. + eMESH_MULTIPLE = (1<<6), //!< Report all hits for meshes rather than just the first. Not applicable to sweep queries. + eMESH_ANY PX_DEPRECATED = eANY_HIT, //!< @deprecated Deprecated, please use eANY_HIT instead. + eMESH_BOTH_SIDES = (1<<7), //!< Report hits with back faces of mesh triangles. Also report hits for raycast + //!< originating on mesh surface and facing away from the surface normal. Not applicable to sweep queries. + //!< Please refer to the user guide for heightfield-specific differences. + ePRECISE_SWEEP = (1<<8), //!< Use more accurate but slower narrow phase sweep tests. + //!< May provide better compatibility with PhysX 3.2 sweep behavior. + eMTD = (1<<9), //!< Report the minimum translation depth, normal and contact point. + eFACE_INDEX = (1<<10), //!< "face index" member of #PxQueryHit is valid + + eDEFAULT = ePOSITION|eNORMAL|eFACE_INDEX, + + /** \brief Only this subset of flags can be modified by pre-filter. Other modifications will be discarded. */ + eMODIFIABLE_FLAGS = eMESH_MULTIPLE|eMESH_BOTH_SIDES|eASSUME_NO_INITIAL_OVERLAP|ePRECISE_SWEEP + }; +}; + +/** +\brief collection of set bits defined in PxHitFlag. + +@see PxHitFlag +*/ +PX_FLAGS_TYPEDEF(PxHitFlag, PxU16) + +/** +\brief Scene query hit information. +*/ +struct PxQueryHit +{ + PX_INLINE PxQueryHit() : faceIndex(0xFFFFffff) {} + + /** + Face index of touched triangle, for triangle meshes, convex meshes and height fields. + + \note This index will default to 0xFFFFffff value for overlap queries. + \note Please refer to the user guide for more details for sweep queries. + \note This index is remapped by mesh cooking. Use #PxTriangleMesh::getTrianglesRemap() to convert to original mesh index. + \note For convex meshes use #PxConvexMesh::getPolygonData() to retrieve touched polygon data. + */ + PxU32 faceIndex; +}; + +/** +\brief Scene query hit information for raycasts and sweeps returning hit position and normal information. + +::PxHitFlag flags can be passed to scene query functions, as an optimization, to cause the SDK to +only generate specific members of this structure. +*/ +struct PxLocationHit : PxQueryHit +{ + PX_INLINE PxLocationHit() : flags(0), position(PxVec3(0)), normal(PxVec3(0)), distance(PX_MAX_REAL) {} + + /** + \note For raycast hits: true for shapes overlapping with raycast origin. + \note For sweep hits: true for shapes overlapping at zero sweep distance. + + @see PxRaycastHit PxSweepHit + */ + PX_INLINE bool hadInitialOverlap() const { return (distance <= 0.0f); } + + // the following fields are set in accordance with the #PxHitFlags + PxHitFlags flags; //!< Hit flags specifying which members contain valid values. + PxVec3 position; //!< World-space hit position (flag: #PxHitFlag::ePOSITION) + PxVec3 normal; //!< World-space hit normal (flag: #PxHitFlag::eNORMAL) + + /** + \brief Distance to hit. + \note If the eMTD flag is used, distance will be a negative value if shapes are overlapping indicating the penetration depth. + \note Otherwise, this value will be >= 0 */ + PxF32 distance; +}; + +/** +\brief Stores results of raycast queries. + +::PxHitFlag flags can be passed to raycast function, as an optimization, to cause the SDK to only compute specified members of this +structure. + +Some members like barycentric coordinates are currently only computed for triangle meshes and height fields, but next versions +might provide them in other cases. The client code should check #flags to make sure returned values are valid. + +@see PxScene.raycast +*/ +struct PxGeomRaycastHit : PxLocationHit +{ + PX_INLINE PxGeomRaycastHit() : u(0.0f), v(0.0f) {} + + // the following fields are set in accordance with the #PxHitFlags + + PxReal u, v; //!< barycentric coordinates of hit point, for triangle mesh and height field (flag: #PxHitFlag::eUV) +}; + +/** +\brief Stores results of overlap queries. + +@see PxScene.overlap +*/ +struct PxGeomOverlapHit : PxQueryHit +{ + PX_INLINE PxGeomOverlapHit() {} +}; + +/** +\brief Stores results of sweep queries. + +@see PxScene.sweep +*/ +struct PxGeomSweepHit : PxLocationHit +{ + PX_INLINE PxGeomSweepHit() {} +}; + +/** +\brief Pair of indices, typically either object or triangle indices. +*/ +struct PxGeomIndexPair +{ + PX_FORCE_INLINE PxGeomIndexPair() {} + PX_FORCE_INLINE PxGeomIndexPair(PxU32 _id0, PxU32 _id1) : id0(_id0), id1(_id1) {} + + PxU32 id0, id1; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryInternal.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryInternal.h new file mode 100644 index 0000000..b269b02 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryInternal.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_INTERNAL_H +#define PX_GEOMETRY_INTERNAL_H +/** \addtogroup geomutils +@{ */ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" +#include "geometry/PxTriangleMesh.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxTriangleMesh; + + struct PxTriangleMeshInternalData + { + PxU32 mNbVertices; + PxU32 mNbTriangles; + PxVec3* mVertices; + void* mTriangles; + PxU32* mFaceRemap; + PxVec3 mAABB_Center; + PxVec3 mAABB_Extents; + PxReal mGeomEpsilon; + PxU8 mFlags; + // + PxU32 mNbNodes; + PxU32 mNodeSize; + void* mNodes; + PxU32 mInitData; + PxVec3 mCenterOrMinCoeff; + PxVec3 mExtentsOrMaxCoeff; + bool mQuantized; + + PX_FORCE_INLINE PxU32 getSizeofVerticesInBytes() const + { + return mNbVertices * sizeof(PxVec3); + } + + PX_FORCE_INLINE PxU32 getSizeofTrianglesInBytes() const + { + const PxU32 triangleSize = mFlags & PxTriangleMeshFlag::e16_BIT_INDICES ? sizeof(PxU16) : sizeof(PxU32); + return mNbTriangles * 3 * triangleSize; + } + + PX_FORCE_INLINE PxU32 getSizeofFaceRemapInBytes() const + { + return mNbTriangles * sizeof(PxU32); + } + + PX_FORCE_INLINE PxU32 getSizeofNodesInBytes() const + { + return mNbNodes * mNodeSize; + } + }; + + PX_C_EXPORT PX_PHYSX_COMMON_API bool PX_CALL_CONV PxGetTriangleMeshInternalData(PxTriangleMeshInternalData& data, const PxTriangleMesh& mesh, bool takeOwnership); + + class PxBVH; + + struct PxBVHInternalData + { + PxU32 mNbIndices; + PxU32 mNbNodes; + PxU32 mNodeSize; + void* mNodes; + PxU32* mIndices; // Can be null + void* mBounds; + + PX_FORCE_INLINE PxU32 getSizeofNodesInBytes() const + { + return mNbNodes * mNodeSize; + } + + PX_FORCE_INLINE PxU32 getSizeofIndicesInBytes() const + { + return mNbIndices * sizeof(PxU32); + } + + PX_FORCE_INLINE PxU32 getSizeofBoundsInBytes() const + { + return (mNbIndices+1)*6; + } + }; + + PX_C_EXPORT PX_PHYSX_COMMON_API bool PX_CALL_CONV PxGetBVHInternalData(PxBVHInternalData& data, const PxBVH& bvh, bool takeOwnership); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQuery.h new file mode 100644 index 0000000..a743dec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQuery.h @@ -0,0 +1,278 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_QUERY_H +#define PX_GEOMETRY_QUERY_H + +/** +\brief Maximum sweep distance for scene sweeps. The distance parameter for sweep functions will be clamped to this value. +The reason for this is GJK support cannot be evaluated near infinity. A viable alternative can be a sweep followed by an infinite raycast. + +@see PxScene +*/ +#define PX_MAX_SWEEP_DISTANCE 1e8f + +/** \addtogroup geomutils + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryFlags.h" +#include "geometry/PxGeometryQueryContext.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxContactBuffer; + +/** +\brief Collection of geometry object queries (sweeps, raycasts, overlaps, ...). +*/ +class PxGeometryQuery +{ +public: + + /** + \brief Raycast test against a geometry object. + + All geometry types are supported except PxParticleSystemGeometry, PxTetrahedronMeshGeometry and PxHairSystemGeometry. + + \param[in] origin The origin of the ray to test the geometry object against + \param[in] unitDir Normalized direction of the ray to test the geometry object against + \param[in] geom The geometry object to test the ray against + \param[in] pose Pose of the geometry object + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[in] hitFlags Specification of the kind of information to retrieve on hit. Combination of #PxHitFlag flags + \param[in] maxHits max number of returned hits = size of 'rayHits' buffer + \param[out] rayHits Raycast hits information + \param[in] stride Stride value (in number of bytes) for rayHits array. Typically sizeof(PxGeomRaycastHit) for packed arrays. + \param[in] queryFlags Optional flags controlling the query. + \param[in] threadContext Optional user-defined per-thread context. + + \return Number of hits between the ray and the geometry object + + @see PxGeomRaycastHit PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static PxU32 raycast( const PxVec3& origin, const PxVec3& unitDir, + const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, + PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT rayHits, PxU32 stride, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT, + PxRaycastThreadContext* threadContext = NULL); + + /** + * @brief Backward compatibility helper + * @deprecated + */ + template + PX_DEPRECATED PX_FORCE_INLINE static PxU32 raycast( const PxVec3& origin, const PxVec3& unitDir, + const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, + PxU32 maxHits, HitT* PX_RESTRICT rayHits) + { + return raycast(origin, unitDir, geom, pose, maxDist, hitFlags, maxHits, rayHits, sizeof(HitT)); + } + + /** + \brief Overlap test for two geometry objects. + + All combinations are supported except: + \li PxPlaneGeometry vs. {PxPlaneGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + \li PxTriangleMeshGeometry vs. PxHeightFieldGeometry + \li PxHeightFieldGeometry vs. PxHeightFieldGeometry + \li Anything involving PxParticleSystemGeometry, PxTetrahedronMeshGeometry or PxHairSystemGeometry. + + \param[in] geom0 The first geometry object + \param[in] pose0 Pose of the first geometry object + \param[in] geom1 The second geometry object + \param[in] pose1 Pose of the second geometry object + \param[in] queryFlags Optional flags controlling the query. + \param[in] threadContext Optional user-defined per-thread context. + + \return True if the two geometry objects overlap + + @see PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static bool overlap(const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT, PxOverlapThreadContext* threadContext=NULL); + + /** + \brief Sweep a specified geometry object in space and test for collision with a given object. + + The following combinations are supported. + + \li PxSphereGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + \li PxCapsuleGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + \li PxBoxGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + \li PxConvexMeshGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + + \param[in] unitDir Normalized direction along which object geom0 should be swept + \param[in] maxDist Maximum sweep distance, has to be in the [0, inf) range + \param[in] geom0 The geometry object to sweep. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry, #PxBoxGeometry and #PxConvexMeshGeometry + \param[in] pose0 Pose of the geometry object to sweep + \param[in] geom1 The geometry object to test the sweep against + \param[in] pose1 Pose of the geometry object to sweep against + \param[out] sweepHit The sweep hit information. Only valid if this method returns true. + \param[in] hitFlags Specify which properties per hit should be computed and written to result hit array. Combination of #PxHitFlag flags + \param[in] inflation Surface of the swept shape is additively extruded in the normal direction, rounding corners and edges. + \param[in] queryFlags Optional flags controlling the query. + \param[in] threadContext Optional user-defined per-thread context. + + \return True if the swept geometry object geom0 hits the object geom1 + + @see PxGeomSweepHit PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static bool sweep( const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags = PxHitFlag::eDEFAULT, + const PxReal inflation = 0.0f, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT, + PxSweepThreadContext* threadContext = NULL); + + /** + \brief Compute minimum translational distance (MTD) between two geometry objects. + + All combinations of geom objects are supported except: + - plane/plane + - plane/mesh + - plane/heightfield + - mesh/mesh + - mesh/heightfield + - heightfield/heightfield + - anything involving PxParticleSystemGeometry, PxTetrahedronMeshGeometry or PxHairSystemGeometry + + The function returns a unit vector ('direction') and a penetration depth ('depth'). + + The depenetration vector D = direction * depth should be applied to the first object, to + get out of the second object. + + Returned depth should always be positive or null. + + If objects do not overlap, the function can not compute the MTD and returns false. + + \param[out] direction Computed MTD unit direction + \param[out] depth Penetration depth. Always positive or null. + \param[in] geom0 The first geometry object + \param[in] pose0 Pose of the first geometry object + \param[in] geom1 The second geometry object + \param[in] pose1 Pose of the second geometry object + \param[in] queryFlags Optional flags controlling the query. + \return True if the MTD has successfully been computed, i.e. if objects do overlap. + + @see PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static bool computePenetration( PxVec3& direction, PxF32& depth, + const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); + + /** + \brief Computes distance between a point and a geometry object. + + Currently supported geometry objects: box, sphere, capsule, convex, mesh. + + \note For meshes, only the BVH34 midphase data-structure is supported. + + \param[in] point The point P + \param[in] geom The geometry object + \param[in] pose Pose of the geometry object + \param[out] closestPoint Optionally returned closest point to P on the geom object. Only valid when returned distance is strictly positive. + \param[out] closestIndex Optionally returned closest (triangle) index. Only valid for triangle meshes. + \param[in] queryFlags Optional flags controlling the query. + \return Square distance between the point and the geom object, or 0.0 if the point is inside the object, or -1.0 if an error occured (geometry type is not supported, or invalid pose) + + @see PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static PxReal pointDistance(const PxVec3& point, const PxGeometry& geom, const PxTransform& pose, + PxVec3* closestPoint=NULL, PxU32* closestIndex=NULL, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); + + /** + \brief computes the bounds for a geometry object + + \param[out] bounds Returned computed bounds + \param[in] geom The geometry object + \param[in] pose Pose of the geometry object + \param[in] offset Offset for computed bounds. This value is added to the geom's extents. + \param[in] inflation Scale factor for computed bounds. The geom's extents are multiplied by this value. + \param[in] queryFlags Optional flags controlling the query. + + @see PxGeometry PxTransform + */ + PX_PHYSX_COMMON_API static void computeGeomBounds(PxBounds3& bounds, const PxGeometry& geom, const PxTransform& pose, float offset=0.0f, float inflation=1.0f, PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); + + /** + \brief get the bounds for a geometry object + + \param[in] geom The geometry object + \param[in] pose Pose of the geometry object + \param[in] inflation Scale factor for computed world bounds. Box extents are multiplied by this value. + \return The bounds of the object + + @see PxGeometry PxTransform + @deprecated + */ + PX_DEPRECATED PX_PHYSX_COMMON_API static PxBounds3 getWorldBounds(const PxGeometry& geom, const PxTransform& pose, float inflation=1.01f); + + /** + \brief Generate collision contacts between a convex geometry and a single triangle + + \param[in] geom The geometry object. Can be a capsule, a box or a convex mesh + \param[in] pose Pose of the geometry object + \param[in] triangleVertices Triangle vertices in local space + \param[in] triangleIndex Triangle index + \param[in] contactDistance The distance at which contacts begin to be generated between the pairs + \param[in] meshContactMargin The mesh contact margin. + \param[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param[out] contactBuffer A buffer to write contacts to. + + \return True if there was collision + */ + PX_DEPRECATED PX_PHYSX_COMMON_API static bool generateTriangleContacts(const PxGeometry& geom, const PxTransform& pose, const PxVec3 triangleVertices[3], PxU32 triangleIndex, PxReal contactDistance, PxReal meshContactMargin, PxReal toleranceLength, PxContactBuffer& contactBuffer); + + /** + \brief Checks if provided geometry is valid. + + \param[in] geom The geometry object. + \return True if geometry is valid. + + @see PxGeometry + */ + PX_PHYSX_COMMON_API static bool isValid(const PxGeometry& geom); +}; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryContext.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryContext.h new file mode 100644 index 0000000..0b64cfe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryContext.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_QUERY_CONTEXT_H +#define PX_GEOMETRY_QUERY_CONTEXT_H + +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief A per-thread context passed to low-level query functions. + + This is a user-defined optional parameter that gets passed down to low-level query functions (raycast / overlap / sweep). + + This is not used directly in PhysX, although the context in this case is the PxHitCallback used in the query. This allows + user-defined query functions, such as the ones from PxCustomGeometry, to get some additional data about the query. In this + case this is a 'per-query' context rather than 'per-thread', but the initial goal of this parameter is to give custom + query callbacks access to per-thread data structures (e.g. caches) that could be needed to implement the callbacks. + + In any case this is mostly for user-controlled query systems. + */ + struct PxQueryThreadContext + { + }; + + /** + \brief A per-thread context passed to low-level raycast functions. + */ + typedef PxQueryThreadContext PxRaycastThreadContext; + + /** + \brief A per-thread context passed to low-level overlap functions. + */ + typedef PxQueryThreadContext PxOverlapThreadContext; + + /** + \brief A per-thread context passed to low-level sweep functions. + */ + typedef PxQueryThreadContext PxSweepThreadContext; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryFlags.h new file mode 100644 index 0000000..94833bf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGeometryQueryFlags.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GEOMETRY_QUERY_FLAGS_H +#define PX_GEOMETRY_QUERY_FLAGS_H + +#include "foundation/PxFlags.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Geometry-level query flags. + + @see PxScene::raycast PxScene::overlap PxScene::sweep PxBVH::raycast PxBVH::overlap PxBVH::sweep PxGeometryQuery::raycast PxGeometryQuery::overlap PxGeometryQuery::sweep + @see PxGeometryQuery::computePenetration PxGeometryQuery::pointDistance PxGeometryQuery::computeGeomBounds + @see PxMeshQuery::findOverlapTriangleMesh PxMeshQuery::findOverlapHeightField PxMeshQuery::sweep + */ + struct PxGeometryQueryFlag + { + enum Enum + { + eSIMD_GUARD = (1<<0), //!< Saves/restores SIMD control word for each query (safer but slower). Omit this if you took care of it yourself in your app. + + eDEFAULT PX_DEPRECATED = eSIMD_GUARD + }; + }; + + /** + \brief collection of set bits defined in PxGeometryQueryFlag. + + @see PxGeometryQueryFlag + */ + PX_FLAGS_TYPEDEF(PxGeometryQueryFlag, PxU32) + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGjkQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGjkQuery.h new file mode 100644 index 0000000..c85b791 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxGjkQuery.h @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_GJK_QUERY_H +#define PX_GJK_QUERY_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Collection of GJK query functions (sweeps, raycasts, overlaps, ...). +*/ +class PxGjkQuery +{ +public: + + /** + \brief Abstract interface for a user defined shape GJK mapping support. + A user defined shape consists of a core shape and a margin. If the distance + between two shapes' cores is equal to the sum of their margins, these shapes are + considered touching. + */ + struct Support + { + /* Virtual destructor */ + virtual ~Support() {} + /** + \brief Return the user defined shape margin. Margin should be greater than or equal to 0 + + \return Margin. + */ + virtual PxReal getMargin() const = 0; + /** + \brief Return the farthest point on the user defined shape's core in given direction. + + \param[in] dir Direction + + \return Farthest point in given direction. + */ + virtual PxVec3 supportLocal(const PxVec3& dir) const = 0; + }; + + /** + \brief Computes proximity information for two shapes using GJK-EPA algorithm + + \param[in] a Shape A support mapping + \param[in] b Shape B support mapping + \param[in] poseA Shape A transformation + \param[in] poseB Shape B transformation + \param[in] contactDistance The distance at which proximity info begins to be computed between the shapes + \param[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units + \param[out] pointA The closest/deepest point on shape A surface + \param[out] pointB The closest/deepest point on shape B surface + \param[out] separatingAxis Translating shape B along 'separatingAxis' by 'separation' makes the shapes touching + \param[out] separation Translating shape B along 'separatingAxis' by 'separation' makes the shapes touching + + \return False if the distance greater than contactDistance. + */ + PX_PHYSX_COMMON_API static bool proximityInfo(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB, + PxReal contactDistance, PxReal toleranceLength, PxVec3& pointA, PxVec3& pointB, PxVec3& separatingAxis, PxReal& separation); + + /** + \brief Raycast test against the given shape. + + \param[in] shape Shape support mapping + \param[in] pose Shape transformation + \param[in] rayStart The start point of the ray to test the shape against + \param[in] unitDir Normalized direction of the ray to test the shape against + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[out] t Hit distance + \param[out] n Hit normal + \param[out] p Hit point + + \return True if there is a hit. + */ + PX_PHYSX_COMMON_API static bool raycast(const Support& shape, const PxTransform& pose, const PxVec3& rayStart, + const PxVec3& unitDir, PxReal maxDist, PxReal& t, PxVec3& n, PxVec3& p); + + /** + \brief Overlap test for two shapes. + + \param[in] a Shape A support mapping + \param[in] b Shape B support mapping + \param[in] poseA Shape A transformation + \param[in] poseB Shape B transformation + + \return True if the shapes overlap. + */ + PX_PHYSX_COMMON_API static bool overlap(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB); + + /** + \brief Sweep the shape B in space and test for collision with the shape A. + + \param[in] a Shape A support mapping + \param[in] b Shape B support mapping + \param[in] poseA Shape A transformation + \param[in] poseB Shape B transformation + \param[in] unitDir Normalized direction of the ray to test the shape against + \param[in] maxDist Maximum ray length, has to be in the [0, inf) range + \param[out] t Hit distance + \param[out] n Hit normal + \param[out] p Hit point + + \return True if there is a hit. + */ + PX_PHYSX_COMMON_API static bool sweep(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB, + const PxVec3& unitDir, PxReal maxDist, PxReal& t, PxVec3& n, PxVec3& p); +}; + +#if !PX_DOXYGEN +} +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemDesc.h new file mode 100644 index 0000000..f5ab60e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemDesc.h @@ -0,0 +1,200 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef PX_HAIRSYSTEM_DESC_H +#define PX_HAIRSYSTEM_DESC_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxHairSystemDescFlag + { + enum Enum + { + /** + Determines whether or not to allocate memory on device (GPU) or on Host (CPU) + */ + eDEVICE_MEMORY = (1<<0) + }; + }; + + /** + \brief collection of set bits defined in PxHairSystemDescFlag + \see PxHairSystemDescFlag + */ + typedef PxFlags PxHairSystemDescFlags; + PX_FLAGS_OPERATORS(PxHairSystemDescFlag::Enum, PxU16) + + /** + \brief Descriptor class for #PxHairSystem + \note The data is *copied* when a PxHairSystem object is created from this + descriptor. The user may discard the data after the call. + + \see PxHairSystem PxHairSystemGeometry PxShape PxPhysics.createHairSystem() + PxCooking.createHairSystem() + */ + class PxHairSystemDesc + { + public: + /** + \brief The number of strands in this hair system + + Default: 0 + */ + PxU32 numStrands; + + /** + \brief The length of a hair segment + + Default: 0.1 + */ + PxReal segmentLength; + + /** + \brief The radius of a hair segment + + Default: 0.01 + */ + PxReal segmentRadius; + + /** + \brief Specifies the number of vertices each strand is composed of. + Length must be equal to numStrands, elements assumed to be of + type PxU32. Number of segments = numVerticesPerStrand - 1. + + Default: NULL + */ + PxBoundedData numVerticesPerStrand; + + /** + \brief Vertex positions and inverse mass [x,y,z,1/m] in PxBoundedData format. + If count equal to numStrands, assumed to be strand root positions, + otherwise positions of all vertices sorted by strands and increasing + from root towards tip of strand. + Type assumed to be of PxReal. + + Default: NULL + */ + PxBoundedData vertices; + + /** + \brief Vertex velocities in PxBoundedData format. + If NULL, zero velocity is assumed. + Type assumed to be of PxReal. + + Default: NULL + */ + PxBoundedData velocities; + + /** + \brief Flags bits, combined from values of the enum ::PxHairSystemDesc + + Default: 0 + */ + PxHairSystemDescFlags flags; + + /** + \brief Constructor with default initialization + */ + PX_INLINE PxHairSystemDesc(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Check whether the descriptor is valid + \return True if the current settings are valid + */ + PX_INLINE bool isValid() const; + }; + + PX_INLINE PxHairSystemDesc::PxHairSystemDesc() + { + numStrands = 0; + segmentLength = 0.1f; + segmentRadius = 0.01f; + } + + PX_INLINE void PxHairSystemDesc::setToDefault() + { + *this = PxHairSystemDesc(); + } + + PX_INLINE bool PxHairSystemDesc::isValid() const + { + if (segmentLength < 0.0f || segmentRadius < 0.0f) + return false; + + if (2.0f * segmentRadius >= segmentLength) + return false; + + if (numStrands == 0) + return false; + + if (numVerticesPerStrand.count != numStrands) + return false; + + PxU32 totalNumVertices = 0; + for (PxU32 i = 0; i < numVerticesPerStrand.count; i++) + { + const PxU32 numVertices = numVerticesPerStrand.at(i); + totalNumVertices += numVertices; + if (numVertices < 2) + { + return false; + } + } + + if (vertices.count != totalNumVertices && vertices.count != numStrands) + return false; + + if (velocities.count != totalNumVertices && velocities.count != 0) + return false; + + return true; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemGeometry.h new file mode 100644 index 0000000..6d35c52 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHairSystemGeometry.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef PX_HAIRSYSTEM_GEOMETRY_H +#define PX_HAIRSYSTEM_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Hair system geometry class. + + */ + class PxHairSystemGeometry : public PxGeometry + { + public: + /** + \brief Default constructor. + */ + PX_INLINE PxHairSystemGeometry() : PxGeometry(PxGeometryType::eHAIRSYSTEM) {} + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_FORCE_INLINE bool isValid() const + { + if(mType != PxGeometryType::eHAIRSYSTEM) + return false; + + return true; + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightField.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightField.h new file mode 100644 index 0000000..d760422 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightField.h @@ -0,0 +1,243 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HEIGHTFIELD_H +#define PX_HEIGHTFIELD_H +/** \addtogroup geomutils + @{ +*/ + +#include "geometry/PxHeightFieldFlag.h" +#include "geometry/PxHeightFieldSample.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxHeightFieldDesc; + +/** +\brief A height field class. + +Height fields work in a similar way as triangle meshes specified to act as +height fields, with some important differences: + +Triangle meshes can be made of nonuniform geometry, while height fields are +regular, rectangular grids. This means that with PxHeightField, you sacrifice +flexibility in return for improved performance and decreased memory consumption. + +In local space rows extend in X direction, columns in Z direction and height in Y direction. + +Like Convexes and TriangleMeshes, HeightFields are referenced by shape instances +(see #PxHeightFieldGeometry, #PxShape). + +To avoid duplicating data when you have several instances of a particular +height field differently, you do not use this class to represent a +height field object directly. Instead, you create an instance of this height field +via the PxHeightFieldGeometry and PxShape classes. + +

Creation

+ +To create an instance of this class call PxPhysics::createHeightField() or +PxCooking::createHeightField(const PxHeightFieldDesc&, PxInsertionCallback&). +To delete it call release(). This is only possible +once you have released all of its PxHeightFiedShape instances. + +

Visualizations:

+\li #PxVisualizationParameter::eCOLLISION_AABBS +\li #PxVisualizationParameter::eCOLLISION_SHAPES +\li #PxVisualizationParameter::eCOLLISION_AXES +\li #PxVisualizationParameter::eCOLLISION_FNORMALS +\li #PxVisualizationParameter::eCOLLISION_EDGES + +@see PxHeightFieldDesc PxHeightFieldGeometry PxShape PxPhysics.createHeightField() PxCooking.createHeightField() +*/ + +class PxHeightField : public PxRefCounted +{ + public: + /** + \brief Decrements the reference count of a height field and releases it if the new reference count is zero. + + @see PxPhysics.createHeightField() PxHeightFieldDesc PxHeightFieldGeometry PxShape + */ + virtual void release() = 0; + + /** + \brief Writes out the sample data array. + + The user provides destBufferSize bytes storage at destBuffer. + The data is formatted and arranged as PxHeightFieldDesc.samples. + + \param[out] destBuffer The destination buffer for the sample data. + \param[in] destBufferSize The size of the destination buffer. + \return The number of bytes written. + + @see PxHeightFieldDesc.samples + */ + virtual PxU32 saveCells(void* destBuffer, PxU32 destBufferSize) const = 0; + + /** + \brief Replaces a rectangular subfield in the sample data array. + + The user provides the description of a rectangular subfield in subfieldDesc. + The data is formatted and arranged as PxHeightFieldDesc.samples. + + \param[in] startCol First cell in the destination heightfield to be modified. Can be negative. + \param[in] startRow First row in the destination heightfield to be modified. Can be negative. + \param[in] subfieldDesc Description of the source subfield to read the samples from. + \param[in] shrinkBounds If left as false, the bounds will never shrink but only grow. If set to true the bounds will be recomputed from all HF samples at O(nbColums*nbRows) perf cost. + \return True on success, false on failure. Failure can occur due to format mismatch. + + \note Modified samples are constrained to the same height quantization range as the original heightfield. + Source samples that are out of range of target heightfield will be clipped with no error. + PhysX does not keep a mapping from the heightfield to heightfield shapes that reference it. + Call PxShape::setGeometry on each shape which references the height field, to ensure that internal data structures are updated to reflect the new geometry. + Please note that PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + + @see PxHeightFieldDesc.samples PxShape.setGeometry + */ + virtual bool modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc& subfieldDesc, bool shrinkBounds = false) = 0; + + /** + \brief Retrieves the number of sample rows in the samples array. + + \return The number of sample rows in the samples array. + + @see PxHeightFieldDesc.nbRows + */ + virtual PxU32 getNbRows() const = 0; + + /** + \brief Retrieves the number of sample columns in the samples array. + + \return The number of sample columns in the samples array. + + @see PxHeightFieldDesc.nbColumns + */ + virtual PxU32 getNbColumns() const = 0; + + /** + \brief Retrieves the format of the sample data. + + \return The format of the sample data. + + @see PxHeightFieldDesc.format PxHeightFieldFormat + */ + virtual PxHeightFieldFormat::Enum getFormat() const = 0; + + /** + \brief Retrieves the offset in bytes between consecutive samples in the array. + + \return The offset in bytes between consecutive samples in the array. + + @see PxHeightFieldDesc.sampleStride + */ + virtual PxU32 getSampleStride() const = 0; + + /** + \brief Retrieves the convex edge threshold. + + \return The convex edge threshold. + + @see PxHeightFieldDesc.convexEdgeThreshold + */ + virtual PxReal getConvexEdgeThreshold() const = 0; + + /** + \brief Retrieves the flags bits, combined from values of the enum ::PxHeightFieldFlag. + + \return The flags bits, combined from values of the enum ::PxHeightFieldFlag. + + @see PxHeightFieldDesc.flags PxHeightFieldFlag + */ + virtual PxHeightFieldFlags getFlags() const = 0; + + /** + \brief Retrieves the height at the given coordinates in grid space. + + \return The height at the given coordinates or 0 if the coordinates are out of range. + */ + virtual PxReal getHeight(PxReal x, PxReal z) const = 0; + + /** + \brief Returns material table index of given triangle + + \note This function takes a post cooking triangle index. + + \param[in] triangleIndex (internal) index of desired triangle + \return Material table index, or 0xffff if no per-triangle materials are used + */ + virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0; + + /** + \brief Returns a triangle face normal for a given triangle index + + \note This function takes a post cooking triangle index. + + \param[in] triangleIndex (internal) index of desired triangle + \return Triangle normal for a given triangle index + */ + virtual PxVec3 getTriangleNormal(PxTriangleID triangleIndex) const = 0; + + /** + \brief Returns heightfield sample of given row and column + + \param[in] row Given heightfield row + \param[in] column Given heightfield column + \return Heightfield sample + */ + virtual const PxHeightFieldSample& getSample(PxU32 row, PxU32 column) const = 0; + + /** + \brief Returns the number of times the heightfield data has been modified + + This method returns the number of times modifySamples has been called on this heightfield, so that code that has + retained state that depends on the heightfield can efficiently determine whether it has been modified. + + \return the number of times the heightfield sample data has been modified. + */ + virtual PxU32 getTimestamp() const = 0; + + virtual const char* getConcreteTypeName() const { return "PxHeightField"; } + +protected: + PX_INLINE PxHeightField(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxHeightField(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxHeightField() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxHeightField", name) || PxRefCounted::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldDesc.h new file mode 100644 index 0000000..bb9ac82 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldDesc.h @@ -0,0 +1,185 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HEIGHTFIELD_DESC_H +#define PX_HEIGHTFIELD_DESC_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxHeightFieldFlag.h" +#include "common/PxCoreUtilityTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Descriptor class for #PxHeightField. + +\note The heightfield data is *copied* when a PxHeightField object is created from this descriptor. After the call the +user may discard the height data. + +@see PxHeightField PxHeightFieldGeometry PxShape PxPhysics.createHeightField() PxCooking.createHeightField() +*/ +class PxHeightFieldDesc +{ +public: + + /** + \brief Number of sample rows in the height field samples array. + + \note Local space X-axis corresponds to rows. + + Range: >1
+ Default: 0 + */ + PxU32 nbRows; + + /** + \brief Number of sample columns in the height field samples array. + + \note Local space Z-axis corresponds to columns. + + Range: >1
+ Default: 0 + */ + PxU32 nbColumns; + + /** + \brief Format of the sample data. + + Currently the only supported format is PxHeightFieldFormat::eS16_TM: + + Default: PxHeightFieldFormat::eS16_TM + + @see PxHeightFormat PxHeightFieldDesc.samples + */ + PxHeightFieldFormat::Enum format; + + /** + \brief The samples array. + + It is copied to the SDK's storage at creation time. + + There are nbRows * nbColumn samples in the array, + which define nbRows * nbColumn vertices and cells, + of which (nbRows - 1) * (nbColumns - 1) cells are actually used. + + The array index of sample(row, column) = row * nbColumns + column. + The byte offset of sample(row, column) = sampleStride * (row * nbColumns + column). + The sample data follows at the offset and spans the number of bytes defined by the format. + Then there are zero or more unused bytes depending on sampleStride before the next sample. + + Default: NULL + + @see PxHeightFormat + */ + PxStridedData samples; + + /** + This threshold is used by the collision detection to determine if a height field edge is convex + and can generate contact points. + Usually the convexity of an edge is determined from the angle (or cosine of the angle) between + the normals of the faces sharing that edge. + The height field allows a more efficient approach by comparing height values of neighboring vertices. + This parameter offsets the comparison. Smaller changes than 0.5 will not alter the set of convex edges. + The rule of thumb is that larger values will result in fewer edge contacts. + + This parameter is ignored in contact generation with sphere and capsule primitives. + + Range: [0, PX_MAX_F32)
+ Default: 0 + */ + PxReal convexEdgeThreshold; + + /** + \brief Flags bits, combined from values of the enum ::PxHeightFieldFlag. + + Default: 0 + + @see PxHeightFieldFlag PxHeightFieldFlags + */ + PxHeightFieldFlags flags; + + /** + \brief Constructor sets to default. + */ + PX_INLINE PxHeightFieldDesc(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Returns true if the descriptor is valid. + \return True if the current settings are valid. + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE PxHeightFieldDesc::PxHeightFieldDesc() //constructor sets to default +{ + nbColumns = 0; + nbRows = 0; + format = PxHeightFieldFormat::eS16_TM; + convexEdgeThreshold = 0.0f; + flags = PxHeightFieldFlags(); +} + +PX_INLINE void PxHeightFieldDesc::setToDefault() +{ + *this = PxHeightFieldDesc(); +} + +PX_INLINE bool PxHeightFieldDesc::isValid() const +{ + if (nbColumns < 2) + return false; + if (nbRows < 2) + return false; + if(format != PxHeightFieldFormat::eS16_TM) + return false; + if (samples.stride < 4) + return false; + if (convexEdgeThreshold < 0) + return false; + if ((flags & PxHeightFieldFlag::eNO_BOUNDARY_EDGES) != flags) + return false; + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldFlag.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldFlag.h new file mode 100644 index 0000000..b094725 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldFlag.h @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HEIGHT_FIELD_FLAG_H +#define PX_HEIGHT_FIELD_FLAG_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Describes the format of height field samples. +@see PxHeightFieldDesc.format PxHeightFieldDesc.samples +*/ +struct PxHeightFieldFormat +{ + enum Enum + { + /** + \brief Height field height data is 16 bit signed integers, followed by triangle materials. + + Each sample is 32 bits wide arranged as follows: + + \image html heightFieldFormat_S16_TM.png + + 1) First there is a 16 bit height value. + 2) Next, two one byte material indices, with the high bit of each byte reserved for special use. + (so the material index is only 7 bits). + The high bit of material0 is the tess-flag. + The high bit of material1 is reserved for future use. + + There are zero or more unused bytes before the next sample depending on PxHeightFieldDesc.sampleStride, + where the application may eventually keep its own data. + + This is the only format supported at the moment. + + @see PxHeightFieldDesc.format PxHeightFieldDesc.samples + */ + eS16_TM = (1 << 0) + }; +}; + +/** +\brief Determines the tessellation of height field cells. +@see PxHeightFieldDesc.format PxHeightFieldDesc.samples +*/ +struct PxHeightFieldTessFlag +{ + enum Enum + { + /** + \brief This flag determines which way each quad cell is subdivided. + + The flag lowered indicates subdivision like this: (the 0th vertex is referenced by only one triangle) + + \image html heightfieldTriMat2.PNG + +
+		+--+--+--+---> column
+		| /| /| /|
+		|/ |/ |/ |
+		+--+--+--+
+		| /| /| /|
+		|/ |/ |/ |
+		+--+--+--+
+		|
+		|
+		V row
+		
+ + The flag raised indicates subdivision like this: (the 0th vertex is shared by two triangles) + + \image html heightfieldTriMat1.PNG + +
+		+--+--+--+---> column
+		|\ |\ |\ |
+		| \| \| \|
+		+--+--+--+
+		|\ |\ |\ |
+		| \| \| \|
+		+--+--+--+
+		|
+		|
+		V row
+		
+ + @see PxHeightFieldDesc.format PxHeightFieldDesc.samples + */ + e0TH_VERTEX_SHARED = (1 << 0) + }; +}; + + +/** +\brief Enum with flag values to be used in PxHeightFieldDesc.flags. +*/ +struct PxHeightFieldFlag +{ + enum Enum + { + /** + \brief Disable collisions with height field with boundary edges. + + Raise this flag if several terrain patches are going to be placed adjacent to each other, + to avoid a bump when sliding across. + + This flag is ignored in contact generation with sphere and capsule shapes. + + @see PxHeightFieldDesc.flags + */ + eNO_BOUNDARY_EDGES = (1 << 0) + }; +}; + +/** +\brief collection of set bits defined in PxHeightFieldFlag. + +@see PxHeightFieldFlag +*/ +typedef PxFlags PxHeightFieldFlags; +PX_FLAGS_OPERATORS(PxHeightFieldFlag::Enum,PxU16) + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldGeometry.h new file mode 100644 index 0000000..b64c32d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldGeometry.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HEIGHT_FIELD_GEOMETRY_H +#define PX_HEIGHT_FIELD_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxTriangleMeshGeometry.h" +#include "common/PxCoreUtilityTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#define PX_MIN_HEIGHTFIELD_XZ_SCALE 1e-8f +#define PX_MIN_HEIGHTFIELD_Y_SCALE (0.0001f / PxReal(0xFFFF)) + +class PxHeightField; + +/** +\brief Height field geometry class. + +This class allows to create a scaled height field geometry instance. + +There is a minimum allowed value for Y and XZ scaling - PX_MIN_HEIGHTFIELD_XZ_SCALE, heightfield creation will fail if XZ value is below this value. +*/ +class PxHeightFieldGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. + */ + PX_INLINE PxHeightFieldGeometry(PxHeightField* hf = NULL, + PxMeshGeometryFlags flags = PxMeshGeometryFlag::Enum(0), + PxReal heightScale_ = 1.0f, + PxReal rowScale_ = 1.0f, + PxReal columnScale_ = 1.0f) : + PxGeometry (PxGeometryType::eHEIGHTFIELD), + heightField (hf), + heightScale (heightScale_), + rowScale (rowScale_), + columnScale (columnScale_), + heightFieldFlags (flags) + { + } + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxHeightFieldGeometry(const PxHeightFieldGeometry& that) : + PxGeometry (that), + heightField (that.heightField), + heightScale (that.heightScale), + rowScale (that.rowScale), + columnScale (that.columnScale), + heightFieldFlags (that.heightFieldFlags) + { + } + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxHeightFieldGeometry& that) + { + mType = that.mType; + heightField = that.heightField; + heightScale = that.heightScale; + rowScale = that.rowScale; + columnScale = that.columnScale; + heightFieldFlags = that.heightFieldFlags; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid + + \note A valid height field has a positive scale value in each direction (heightScale > 0, rowScale > 0, columnScale > 0). + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a height field that has zero extents in any direction. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + /** + \brief The height field data. + */ + PxHeightField* heightField; + + /** + \brief The scaling factor for the height field in vertical direction (y direction in local space). + */ + PxReal heightScale; + + /** + \brief The scaling factor for the height field in the row direction (x direction in local space). + */ + PxReal rowScale; + + /** + \brief The scaling factor for the height field in the column direction (z direction in local space). + */ + PxReal columnScale; + + /** + \brief Flags to specify some collision properties for the height field. + */ + PxMeshGeometryFlags heightFieldFlags; + + PxPadding<3> paddingFromFlags; //!< padding for mesh flags. +}; + + +PX_INLINE bool PxHeightFieldGeometry::isValid() const +{ + if(mType != PxGeometryType::eHEIGHTFIELD) + return false; + if(!PxIsFinite(heightScale) || !PxIsFinite(rowScale) || !PxIsFinite(columnScale)) + return false; + if(rowScale < PX_MIN_HEIGHTFIELD_XZ_SCALE || columnScale < PX_MIN_HEIGHTFIELD_XZ_SCALE || heightScale < PX_MIN_HEIGHTFIELD_Y_SCALE) + return false; + if(!heightField) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldSample.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldSample.h new file mode 100644 index 0000000..82df7fd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxHeightFieldSample.h @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_HEIGHT_FIELD_SAMPLE_H +#define PX_HEIGHT_FIELD_SAMPLE_H +/** \addtogroup geomutils +@{ */ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxBitAndData.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Special material index values for height field samples. + +@see PxHeightFieldSample.materialIndex0 PxHeightFieldSample.materialIndex1 +*/ +struct PxHeightFieldMaterial +{ + enum Enum + { + eHOLE = 127 //!< A material indicating that the triangle should be treated as a hole in the mesh. + }; +}; + +/** +\brief Heightfield sample format. + +This format corresponds to the #PxHeightFieldFormat member PxHeightFieldFormat::eS16_TM. + +An array of heightfield samples are used when creating a PxHeightField to specify +the elevation of the heightfield points. In addition the material and tessellation of the adjacent +triangles are specified. + +@see PxHeightField PxHeightFieldDesc PxHeightFieldDesc.samples +*/ +struct PxHeightFieldSample +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + /** + \brief The height of the heightfield sample + + This value is scaled by PxHeightFieldGeometry::heightScale. + + @see PxHeightFieldGeometry + */ + PxI16 height; + + /** + \brief The triangle material index of the quad's lower triangle + tesselation flag + + An index pointing into the material table of the shape which instantiates the heightfield. + This index determines the material of the lower of the quad's two triangles (i.e. the quad whose + upper-left corner is this sample, see the Guide for illustrations). + + Special values of the 7 data bits are defined by PxHeightFieldMaterial + + The tesselation flag specifies which way the quad is split whose upper left corner is this sample. + If the flag is set, the diagonal of the quad will run from this sample to the opposite vertex; if not, + it will run between the other two vertices (see the Guide for illustrations). + + @see PxHeightFieldGeometry materialIndex1 PxShape.setmaterials() PxShape.getMaterials() + */ + PxBitAndByte materialIndex0; + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 tessFlag() const { return PxU8(materialIndex0.isBitSet() ? 1 : 0); } // PT: explicit conversion to make sure we don't break the code + PX_CUDA_CALLABLE PX_FORCE_INLINE void setTessFlag() { materialIndex0.setBit(); } + PX_CUDA_CALLABLE PX_FORCE_INLINE void clearTessFlag() { materialIndex0.clearBit(); } + + /** + \brief The triangle material index of the quad's upper triangle + reserved flag + + An index pointing into the material table of the shape which instantiates the heightfield. + This index determines the material of the upper of the quad's two triangles (i.e. the quad whose + upper-left corner is this sample, see the Guide for illustrations). + + @see PxHeightFieldGeometry materialIndex0 PxShape.setmaterials() PxShape.getMaterials() + */ + PxBitAndByte materialIndex1; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshQuery.h new file mode 100644 index 0000000..a7c657a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshQuery.h @@ -0,0 +1,247 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MESH_QUERY_H +#define PX_MESH_QUERY_H + +/** \addtogroup geomutils + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryFlags.h" +#include "geometry/PxReportCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxGeometry; +class PxConvexMeshGeometry; +class PxTriangleMeshGeometry; +class PxHeightFieldGeometry; + +class PxTriangle; + + struct PxMeshMeshQueryFlag + { + enum Enum + { + eDEFAULT = 0, //!< Report all overlaps + eDISCARD_COPLANAR = (1<<0) //!< Ignore coplanar triangle-triangle overlaps + }; + }; + + PX_FLAGS_TYPEDEF(PxMeshMeshQueryFlag, PxU32) + +class PxMeshQuery +{ +public: + + /** + \brief Retrieves triangle data from a triangle ID. + + This function can be used together with #findOverlapTriangleMesh() to retrieve triangle properties. + + \param[in] triGeom Geometry of the triangle mesh to extract the triangle from. + \param[in] transform Transform for the triangle mesh + \param[in] triangleIndex The index of the triangle to retrieve. + \param[out] triangle Triangle points in world space. + \param[out] vertexIndices Returned vertex indices for given triangle + \param[out] adjacencyIndices Returned 3 triangle adjacency internal face indices (0xFFFFFFFF if no adjacency). The mesh must be cooked with cooking param buildTriangleAdjacencies enabled. + + \note This function will flip the triangle normal whenever triGeom.scale.hasNegativeDeterminant() is true. + + @see PxTriangle PxTriangleFlags PxTriangleID findOverlapTriangleMesh() + */ + PX_PHYSX_COMMON_API static void getTriangle(const PxTriangleMeshGeometry& triGeom, const PxTransform& transform, PxTriangleID triangleIndex, PxTriangle& triangle, PxU32* vertexIndices=NULL, PxU32* adjacencyIndices=NULL); + + + /** + \brief Retrieves triangle data from a triangle ID. + + This function can be used together with #findOverlapHeightField() to retrieve triangle properties. + + \param[in] hfGeom Geometry of the height field to extract the triangle from. + \param[in] transform Transform for the height field. + \param[in] triangleIndex The index of the triangle to retrieve. + \param[out] triangle Triangle points in world space. + \param[out] vertexIndices Returned vertex indices for given triangle + \param[out] adjacencyIndices Returned 3 triangle adjacency triangle indices (0xFFFFFFFF if no adjacency). + + \note This function will flip the triangle normal whenever triGeom.scale.hasNegativeDeterminant() is true. + \note TriangleIndex is an index used in internal format, which does have an index out of the bounds in last row. + To traverse all tri indices in the HF, the following code can be applied: + for (PxU32 row = 0; row < (nbRows - 1); row++) + { + for (PxU32 col = 0; col < (nbCols - 1); col++) + { + for (PxU32 k = 0; k < 2; k++) + { + const PxU32 triIndex = 2 * (row*nbCols + col) + k; + .... + } + } + } + @see PxTriangle PxTriangleFlags PxTriangleID findOverlapHeightField() + */ + PX_PHYSX_COMMON_API static void getTriangle(const PxHeightFieldGeometry& hfGeom, const PxTransform& transform, PxTriangleID triangleIndex, PxTriangle& triangle, PxU32* vertexIndices=NULL, PxU32* adjacencyIndices=NULL); + + + /** + \brief Find the mesh triangles which touch the specified geometry object. + + For mesh-vs-mesh overlap tests, please use the specialized function below. + + Returned triangle indices can be used with #getTriangle() to retrieve the triangle properties. + + \param[in] geom The geometry object to test for mesh triangle overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry + \param[in] geomPose Pose of the geometry object + \param[in] meshGeom The triangle mesh geometry to check overlap against + \param[in] meshPose Pose of the triangle mesh + \param[out] results Indices of overlapping triangles + \param[in] maxResults Size of 'results' buffer + \param[in] startIndex Index of first result to be retrieved. Previous indices are skipped. + \param[out] overflow True if a buffer overflow occurred + \param[in] queryFlags Optional flags controlling the query. + \return Number of overlaps found, i.e. number of elements written to the results buffer + + @see PxTriangleMeshGeometry getTriangle() PxGeometryQueryFlags + */ + PX_PHYSX_COMMON_API static PxU32 findOverlapTriangleMesh( const PxGeometry& geom, const PxTransform& geomPose, + const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshPose, + PxU32* results, PxU32 maxResults, PxU32 startIndex, bool& overflow, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); + + /** + \brief Mesh-vs-mesh overlap test + + A specialized findOverlapTriangleMesh function for mesh-vs-mesh. The other findOverlapTriangleMesh() function above cannot be used + directly since it only returns a single set of triangle indices that belongs to one of the meshes only. This function returns pairs + of triangle indices that belong to both the first & second input meshes. + + Returned triangle indices can be used with #getTriangle() to retrieve the triangle properties. + + \note This is only implemented for the PxMeshMidPhase::eBVH34 data structure. + + \param[in] callback The callback object used to report results + \param[in] meshGeom0 First triangle mesh geometry + \param[in] meshPose0 Pose of first triangle mesh geometry + \param[in] meshGeom1 Second triangle mesh geometry + \param[in] meshPose1 Pose of second triangle mesh geometry + \param[in] queryFlags Optional flags controlling the query. + \param[in] meshMeshFlags Optional flags controlling the query. + \return true if an overlap has been detected, false if the meshes are disjoint + + @see PxTriangleMeshGeometry getTriangle() PxReportCallback PxGeometryQueryFlags PxMeshMeshQueryFlags + */ + PX_PHYSX_COMMON_API static bool findOverlapTriangleMesh(PxReportCallback& callback, + const PxTriangleMeshGeometry& meshGeom0, const PxTransform& meshPose0, + const PxTriangleMeshGeometry& meshGeom1, const PxTransform& meshPose1, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT, + PxMeshMeshQueryFlags meshMeshFlags = PxMeshMeshQueryFlag::eDEFAULT); + + /** + \brief Find the height field triangles which touch the specified geometry object. + + Returned triangle indices can be used with #getTriangle() to retrieve the triangle properties. + + \param[in] geom The geometry object to test for height field overlaps. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry. The sphere and capsule queries are currently conservative estimates. + \param[in] geomPose Pose of the geometry object + \param[in] hfGeom The height field geometry to check overlap against + \param[in] hfPose Pose of the height field + \param[out] results Indices of overlapping triangles + \param[in] maxResults Size of 'results' buffer + \param[in] startIndex Index of first result to be retrieved. Previous indices are skipped. + \param[out] overflow True if a buffer overflow occurred + \param[in] queryFlags Optional flags controlling the query. + \return Number of overlaps found, i.e. number of elements written to the results buffer + + @see PxHeightFieldGeometry getTriangle() PxGeometryQueryFlags + */ + PX_PHYSX_COMMON_API static PxU32 findOverlapHeightField(const PxGeometry& geom, const PxTransform& geomPose, + const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose, + PxU32* results, PxU32 maxResults, PxU32 startIndex, bool& overflow, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); + + + /** + \brief Sweep a specified geometry object in space and test for collision with a set of given triangles. + + This function simply sweeps input geometry against each input triangle, in the order they are given. + This is an O(N) operation with N = number of input triangles. It does not use any particular acceleration structure. + + \param[in] unitDir Normalized direction of the sweep. + \param[in] distance Sweep distance. Needs to be larger than 0. Clamped to PX_MAX_SWEEP_DISTANCE. + \param[in] geom The geometry object to sweep. Supported geometries are #PxSphereGeometry, #PxCapsuleGeometry and #PxBoxGeometry + \param[in] pose Pose of the geometry object to sweep. + \param[in] triangleCount Number of specified triangles + \param[in] triangles Array of triangles to sweep against + \param[out] sweepHit The sweep hit information. See the notes below for limitations about returned results. + \param[in] hitFlags Specification of the kind of information to retrieve on hit. Combination of #PxHitFlag flags. See the notes below for limitations about supported flags. + \param[in] cachedIndex Cached triangle index for subsequent calls. Cached triangle is tested first. Optional parameter. + \param[in] inflation This parameter creates a skin around the swept geometry which increases its extents for sweeping. The sweep will register a hit as soon as the skin touches a shape, and will return the corresponding distance and normal. + \param[in] doubleSided Counterpart of PxMeshGeometryFlag::eDOUBLE_SIDED for input triangles. + \param[in] queryFlags Optional flags controlling the query. + \return True if the swept geometry object hits the specified triangles + + \note Only the following geometry types are currently supported: PxSphereGeometry, PxCapsuleGeometry, PxBoxGeometry + \note If a shape from the scene is already overlapping with the query shape in its starting position, the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + \note This function returns a single closest hit across all the input triangles. Multiple hits are not supported. + \note Supported hitFlags are PxHitFlag::eDEFAULT, PxHitFlag::eASSUME_NO_INITIAL_OVERLAP, PxHitFlag::ePRECISE_SWEEP, PxHitFlag::eMESH_BOTH_SIDES, PxHitFlag::eMESH_ANY. + \note ePOSITION is only defined when there is no initial overlap (sweepHit.hadInitialOverlap() == false) + \note The returned normal for initially overlapping sweeps is set to -unitDir. + \note Otherwise the returned normal is the front normal of the triangle even if PxHitFlag::eMESH_BOTH_SIDES is set. + \note The returned PxGeomSweepHit::faceIndex parameter will hold the index of the hit triangle in input array, i.e. the range is [0; triangleCount). For initially overlapping sweeps, this is the index of overlapping triangle. + \note The inflation parameter is not compatible with PxHitFlag::ePRECISE_SWEEP. + + @see PxTriangle PxSweepHit PxGeometry PxTransform PxGeometryQueryFlags + */ + PX_PHYSX_COMMON_API static bool sweep(const PxVec3& unitDir, + const PxReal distance, + const PxGeometry& geom, + const PxTransform& pose, + PxU32 triangleCount, + const PxTriangle* triangles, + PxGeomSweepHit& sweepHit, + PxHitFlags hitFlags = PxHitFlag::eDEFAULT, + const PxU32* cachedIndex = NULL, + const PxReal inflation = 0.0f, + bool doubleSided = false, + PxGeometryQueryFlags queryFlags = PxGeometryQueryFlag::eDEFAULT); +}; + + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshScale.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshScale.h new file mode 100644 index 0000000..8134356 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxMeshScale.h @@ -0,0 +1,172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_MESH_SCALE_H +#define PX_MESH_SCALE_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxMat33.h" +#include "foundation/PxAssert.h" + +/** \brief Minimum allowed absolute magnitude for each of mesh scale's components (x,y,z). + \note Only positive scale values are allowed for convex meshes. */ +#define PX_MESH_SCALE_MIN 1e-6f + +/** \brief Maximum allowed absolute magnitude for each of mesh scale's components (x,y,z). + \note Only positive scale values are allowed for convex meshes. */ +#define PX_MESH_SCALE_MAX 1e6f + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A class expressing a nonuniform scaling transformation. + +The scaling is along arbitrary axes that are specified by PxMeshScale::rotation. Specifically, PxMeshScale::rotation +describes the rotation from the scaling-axes frame to the mesh-local frame, i.e. PxMeshScale::rotation.rotate(v) transforms +the coordinates of vertex v from the mesh-local frame to the scaling-axes frame. + +\note Negative scale values are supported for PxTriangleMeshGeometry + with absolute values for each component within [PX_MIN_ABS_MESH_SCALE, PX_MAX_ABS_MESH_SCALE] range. + Negative scale causes a reflection around the specified axis, in addition PhysX will flip the normals + for mesh triangles when scale.x*scale.y*scale.z < 0. +\note Only positive scale values are supported for PxConvexMeshGeometry + with values for each component within [PX_MIN_ABS_MESH_SCALE, PX_MAX_ABS_MESH_SCALE] range). + +@see PxConvexMeshGeometry PxTriangleMeshGeometry +*/ +class PxMeshScale +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + /** + \brief Constructor initializes to identity scale. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMeshScale(): scale(1.0f), rotation(PxIdentity) + { + } + + /** + \brief Constructor from scalar. + */ + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE PxMeshScale(PxReal r): scale(r), rotation(PxIdentity) + { + } + + /** + \brief Constructor to initialize to arbitrary scale and identity scale rotation. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMeshScale(const PxVec3& s) + { + scale = s; + rotation = PxQuat(PxIdentity); + } + + /** + \brief Constructor to initialize to arbitrary scaling. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMeshScale(const PxVec3& s, const PxQuat& r) + { + PX_ASSERT(r.isUnit()); + scale = s; + rotation = r; + } + + /** + \brief Returns true if the scaling is an identity transformation. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isIdentity() const + { + return (scale.x == 1.0f && scale.y == 1.0f && scale.z == 1.0f); + } + + /** + \brief Returns the inverse of this scaling transformation. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMeshScale getInverse() const + { + return PxMeshScale(PxVec3(1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z), rotation); + } + + /** + \brief Converts this transformation to a 3x3 matrix representation. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 toMat33() const + { + PxMat33 rot(rotation); + PxMat33 trans = rot.getTranspose(); + trans.column0 *= scale[0]; + trans.column1 *= scale[1]; + trans.column2 *= scale[2]; + return trans * rot; + } + + /** + \brief Returns true if combination of negative scale components will cause the triangle normal to flip. The SDK will flip the normals internally. + */ + PX_CUDA_CALLABLE PX_FORCE_INLINE bool hasNegativeDeterminant() const + { + return (scale.x * scale.y * scale.z < 0.0f); + } + + PxVec3 transform(const PxVec3& v) const + { + return rotation.rotateInv(scale.multiply(rotation.rotate(v))); + } + + bool isValidForTriangleMesh() const + { + PxVec3 absXYZ = scale.abs(); + return (absXYZ.maxElement() <= PX_MESH_SCALE_MAX) && (absXYZ.minElement() >= PX_MESH_SCALE_MIN); + } + + bool isValidForConvexMesh() const + { + return (scale.maxElement() <= PX_MESH_SCALE_MAX) && (scale.minElement() >= PX_MESH_SCALE_MIN); + } + + PxVec3 scale; //!< A nonuniform scaling + PxQuat rotation; //!< The orientation of the scaling axes +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxParticleSystemGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxParticleSystemGeometry.h new file mode 100644 index 0000000..f4578d1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxParticleSystemGeometry.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PARTICLESYSTEM_GEOMETRY_H +#define PX_PARTICLESYSTEM_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "common/PxCoreUtilityTypes.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxVec4.h" +#include "PxParticleSystem.h" +#include "PxParticleSolverType.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Particle system geometry class. + + */ + class PxParticleSystemGeometry : public PxGeometry + { + public: + /** + \brief Default constructor. + + Creates an empty object with no particles. + */ + PX_INLINE PxParticleSystemGeometry() : PxGeometry(PxGeometryType::ePARTICLESYSTEM){} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxParticleSystemGeometry(const PxParticleSystemGeometry& that) : PxGeometry(that) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxParticleSystemGeometry& that) + { + mType = that.mType; + mSolverType = that.mSolverType; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_FORCE_INLINE bool isValid() const + { + if(mType != PxGeometryType::ePARTICLESYSTEM) + return false; + + return true; + } + + PxParticleSolverType::Enum mSolverType; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxPlaneGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxPlaneGeometry.h new file mode 100644 index 0000000..72c6d14 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxPlaneGeometry.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PLANE_GEOMETRY_H +#define PX_PLANE_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "foundation/PxFoundationConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Class describing a plane geometry. + +The plane geometry specifies the half-space volume x<=0. As with other geometry types, +when used in a PxShape the collision volume is obtained by transforming the halfspace +by the shape local pose and the actor global pose. + +To generate a PxPlane from a PxTransform, transform PxPlane(1,0,0,0). + +To generate a PxTransform from a PxPlane, use PxTransformFromPlaneEquation. + +@see PxShape.setGeometry() PxShape.getPlaneGeometry() PxTransformFromPlaneEquation +*/ +class PxPlaneGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. + */ + PX_INLINE PxPlaneGeometry() : PxGeometry(PxGeometryType::ePLANE) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxPlaneGeometry(const PxPlaneGeometry& that) : PxGeometry(that) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxPlaneGeometry& that) + { + mType = that.mType; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + +PX_INLINE bool PxPlaneGeometry::isValid() const +{ + if(mType != PxGeometryType::ePLANE) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxReportCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxReportCallback.h new file mode 100644 index 0000000..36f2a8f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxReportCallback.h @@ -0,0 +1,259 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REPORT_CALLBACK_H +#define PX_REPORT_CALLBACK_H + +/** \addtogroup geomutils + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxArray.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Base class for callback reporting an unknown number of items to users. + + This can be used as-is and customized by users, or several pre-designed callbacks can be used instead (see below). + + This design lets users decide how to retrieve the results of a query: + - either one by one via a regular callback + - or one batch at a time via a callback + - or written out directly to their own C-style buffer + - or pushed back to their own PxArray + - etc + + @see PxRegularReportCallback PxLocalStorageReportCallback PxExternalStorageReportCallback PxDynamicArrayReportCallback + */ + template + class PxReportCallback + { + public: + PxReportCallback(T* buffer=NULL, PxU32 capacity=0) : mBuffer(buffer), mCapacity(capacity), mSize(0) {} + virtual ~PxReportCallback() {} + + T* mBuffer; // Destination buffer for writing results. if NULL, the system will use its internal buffer and set that pointer as it sees fit. + // Otherwise users can set it to where they want the results to be written. + PxU32 mCapacity; // Capacity of mBuffer. If mBuffer is NULL, this controls how many items are reported to users at the same time (with a limit of 256). + PxU32 mSize; //!< Current number of items in the buffer. This is entirely managed by the system. + + /** + \brief Reports query results to users. + + This will be called by the system as many times as necessary to report all results. + + \param[in] nbItems Number of reported items + \param[in] items array of reported items + + \return true to continue the query, false to abort the query + */ + virtual bool flushResults(PxU32 nbItems, const T* items) = 0; + }; + + /** + \brief Regular report callback + + This reports results like a regular callback would: + - without explicit buffer management from users + - by default, one item at a time + + This customized callback sends results to users via the processResults() function. + + The capacity parameter dictates how many items can be reported at a time, + i.e. how many times the flushResults/processResults function will be called by the system. + + @see PxReportCallback + */ + template + class PxRegularReportCallback : public PxReportCallback + { + public: + PxRegularReportCallback(const PxU32 capacity=1) + { + PX_ASSERT(capacity<=256); + this->mCapacity = capacity; + } + + virtual bool flushResults(PxU32 nbItems, const T* items) + { + PX_ASSERT(nbItems<=this->mCapacity); + PX_ASSERT(items==this->mBuffer); + return processResults(nbItems, items); + } + + /** + \brief Reports query results to users. + + \param[in] nbItems Number of reported items + \param[in] items array of reported items + + \return true to continue the query, false to abort the query + */ + virtual bool processResults(PxU32 nbItems, const T* items) = 0; + }; + + /** + \brief Local storage report callback + + This is the same as a regular callback, except the destination buffer is a local buffer within the class. + + This customized callback sends results to users via the processResults() function. + + The capacity of the embedded buffer (determined by a template parameter) dictates how many items can be reported at a time, + i.e. how many times the flushResults/processResults function will be called by the system. + + @see PxReportCallback + */ + template + class PxLocalStorageReportCallback : public PxReportCallback + { + T mLocalStorage[capacityT]; + + public: + PxLocalStorageReportCallback() + { + this->mBuffer = mLocalStorage; + this->mCapacity = capacityT; + } + + virtual bool flushResults(PxU32 nbItems, const T* items) + { + PX_ASSERT(items==mLocalStorage); + PX_ASSERT(nbItems<=this->mCapacity); + return processResults(nbItems, items); + } + + /** + \brief Reports query results to users. + + \param[in] nbItems Number of reported items + \param[in] items array of reported items + + \return true to continue the query, false to abort the query + */ + virtual bool processResults(PxU32 nbItems, const T* items) = 0; + }; + + /** + \brief External storage report callback + + This is the same as a regular callback, except the destination buffer is a user-provided external buffer. + + Typically the provided buffer can be larger here than for PxLocalStorageReportCallback, and it could + even be a scratchpad-kind of memory shared by multiple sub-systems. + + This would be the same as having a C-style buffer to write out results in the query interface. + + This customized callback sends results to users via the processResults() function. + + The capacity parameter dictates how many items can be reported at a time, + i.e. how many times the flushResults/processResults function will be called by the system. + + @see PxReportCallback + */ + template + class PxExternalStorageReportCallback : public PxReportCallback + { + public: + PxExternalStorageReportCallback(T* buffer, PxU32 capacity) + { + this->mBuffer = buffer; + this->mCapacity = capacity; + } + + virtual bool flushResults(PxU32 nbItems, const T* items) + { + PX_ASSERT(items==this->mBuffer); + PX_ASSERT(nbItems<=this->mCapacity); + return processResults(nbItems, items); + } + + /** + \brief Reports query results to users. + + \param[in] nbItems Number of reported items + \param[in] items array of reported items + + \return true to continue the query, false to abort the query + */ + virtual bool processResults(PxU32 nbItems, const T* items) = 0; + }; + + /** + \brief Dynamic array report callback + + This callback emulates the behavior of pushing results to a (user-provided) dynamic array. + + This customized callback does not actually call users back during the query, results are + available afterwards in the provided dynamic array. This would be the same as having a PxArray + directly in the query interface. + + @see PxReportCallback + */ + template + class PxDynamicArrayReportCallback : public PxReportCallback + { + public: + PxDynamicArrayReportCallback(PxArray& results) : mResults(results) + { + mResults.reserve(32); + this->mBuffer = mResults.begin(); + this->mCapacity = mResults.capacity(); + } + + virtual bool flushResults(PxU32 nbItems, const T* /*items*/) + { + const PxU32 size = mResults.size(); + const PxU32 capa = mResults.capacity(); + const PxU32 newSize = size+nbItems; + PX_ASSERT(newSize<=capa); + mResults.forceSize_Unsafe(newSize); + if(newSize==capa) + { + const PxU32 newCapa = capa*2; + mResults.reserve(newCapa); + this->mBuffer = mResults.begin() + newSize; + this->mCapacity = mResults.capacity() - newSize; + } + return true; + } + + PxArray& mResults; + }; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSimpleTriangleMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSimpleTriangleMesh.h new file mode 100644 index 0000000..76b4487 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSimpleTriangleMesh.h @@ -0,0 +1,164 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SIMPLE_TRIANGLE_MESH_H +#define PX_SIMPLE_TRIANGLE_MESH_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "common/PxCoreUtilityTypes.h" +#include "common/PxPhysXCommonConfig.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Enum with flag values to be used in PxSimpleTriangleMesh::flags. +*/ +struct PxMeshFlag +{ + enum Enum + { + /** + \brief Specifies if the SDK should flip normals. + + The PhysX libraries assume that the face normal of a triangle with vertices [a,b,c] can be computed as: + edge1 = b-a + edge2 = c-a + face_normal = edge1 x edge2. + + Note: This is the same as a counterclockwise winding in a right handed coordinate system or + alternatively a clockwise winding order in a left handed coordinate system. + + If this does not match the winding order for your triangles, raise the below flag. + */ + eFLIPNORMALS = (1<<0), + e16_BIT_INDICES = (1<<1) //!< Denotes the use of 16-bit vertex indices + }; +}; + +/** +\brief collection of set bits defined in PxMeshFlag. + +@see PxMeshFlag +*/ +typedef PxFlags PxMeshFlags; +PX_FLAGS_OPERATORS(PxMeshFlag::Enum,PxU16) + + +/** +\brief A structure describing a triangle mesh. +*/ +class PxSimpleTriangleMesh +{ +public: + + /** + \brief Pointer to first vertex point. + */ + PxBoundedData points; + + /** + \brief Pointer to first triangle. + + Caller may add triangleStrideBytes bytes to the pointer to access the next triangle. + + These are triplets of 0 based indices: + vert0 vert1 vert2 + vert0 vert1 vert2 + vert0 vert1 vert2 + ... + + where vertex is either a 32 or 16 bit unsigned integer. There are numTriangles*3 indices. + + This is declared as a void pointer because it is actually either an PxU16 or a PxU32 pointer. + */ + PxBoundedData triangles; + + /** + \brief Flags bits, combined from values of the enum ::PxMeshFlag + */ + PxMeshFlags flags; + + /** + \brief constructor sets to default. + */ + PX_INLINE PxSimpleTriangleMesh(); + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + /** + \brief returns true if the current settings are valid + */ + PX_INLINE bool isValid() const; +}; + + +PX_INLINE PxSimpleTriangleMesh::PxSimpleTriangleMesh() +{ +} + +PX_INLINE void PxSimpleTriangleMesh::setToDefault() +{ + *this = PxSimpleTriangleMesh(); +} + +PX_INLINE bool PxSimpleTriangleMesh::isValid() const +{ + // Check geometry + if(points.count > 0xffff && flags & PxMeshFlag::e16_BIT_INDICES) + return false; + if(!points.data) + return false; + if(points.stride < sizeof(PxVec3)) //should be at least one point's worth of data + return false; + + // Check topology + // The triangles pointer is not mandatory + if(triangles.data) + { + // Indexed mesh + PxU32 limit = (flags & PxMeshFlag::e16_BIT_INDICES) ? sizeof(PxU16)*3 : sizeof(PxU32)*3; + if(triangles.stride < limit) + return false; + } + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSphereGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSphereGeometry.h new file mode 100644 index 0000000..d939851 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxSphereGeometry.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SPHERE_GEOMETRY_H +#define PX_SPHERE_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief A class representing the geometry of a sphere. + +Spheres are defined by their radius. +\note The scaling of the sphere is expected to be baked into this value, there is no additional scaling parameter. +*/ +class PxSphereGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. + */ + PX_INLINE PxSphereGeometry(PxReal ir=0.0f) : PxGeometry(PxGeometryType::eSPHERE), radius(ir) {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxSphereGeometry(const PxSphereGeometry& that) : PxGeometry(that), radius(that.radius) {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxSphereGeometry& that) + { + mType = that.mType; + radius = that.radius; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid + + \note A valid sphere has radius > 0. + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a sphere that has zero radius. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + + /** + \brief The radius of the sphere. + */ + PxReal radius; +}; + +PX_INLINE bool PxSphereGeometry::isValid() const +{ + if(mType != PxGeometryType::eSPHERE) + return false; + if(!PxIsFinite(radius)) + return false; + if(radius <= 0.0f) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedron.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedron.h new file mode 100644 index 0000000..2e02337 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedron.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETRAHEDRON_H +#define PX_TETRAHEDRON_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + /** + \brief Tetrahedron class. + */ + class PxTetrahedron + { + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE PxTetrahedron() {} + + /** + \brief Constructor + + \param[in] p0 Point 0 + \param[in] p1 Point 1 + \param[in] p2 Point 2 + \param[in] p3 Point 3 + */ + PX_FORCE_INLINE PxTetrahedron(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxVec3& p3) + { + verts[0] = p0; + verts[1] = p1; + verts[2] = p2; + verts[3] = p3; + } + + /** + \brief Copy constructor + + \param[in] tetrahedron copy + */ + PX_FORCE_INLINE PxTetrahedron(const PxTetrahedron& tetrahedron) + { + verts[0] = tetrahedron.verts[0]; + verts[1] = tetrahedron.verts[1]; + verts[2] = tetrahedron.verts[2]; + verts[3] = tetrahedron.verts[3]; + } + + /** + \brief Destructor + */ + PX_FORCE_INLINE ~PxTetrahedron() {} + + /** + \brief Assignment operator + */ + PX_FORCE_INLINE void operator=(const PxTetrahedron& tetrahedron) + { + verts[0] = tetrahedron.verts[0]; + verts[1] = tetrahedron.verts[1]; + verts[2] = tetrahedron.verts[2]; + verts[3] = tetrahedron.verts[3]; + } + /** + \brief Array of Vertices. + */ + PxVec3 verts[4]; + + }; + + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMesh.h new file mode 100644 index 0000000..147a643 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMesh.h @@ -0,0 +1,362 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETRAHEDRON_MESH_H +#define PX_TETRAHEDRON_MESH_H +/** \addtogroup geomutils +@{ */ + +#include "foundation/PxVec3.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxUserAllocated.h" +#include "common/PxPhysXCommonConfig.h" +#include "common/PxBase.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxTetrahedronMeshFlag + { + enum Enum + { + e16_BIT_INDICES = (1 << 1) //!< The tetrahedron mesh has 16bits vertex indices + }; + }; + + /** + \brief collection of set bits defined in PxTetrahedronMeshFlag. + + @see PxTetrahedronMeshFlag + */ + typedef PxFlags PxTetrahedronMeshFlags; + PX_FLAGS_OPERATORS(PxTetrahedronMeshFlag::Enum, PxU8) + + + /** + \brief A data container providing mass, rest pose and other information required for softbody simulation + + Stores properties of softbody like inverse mass per node, rest pose matrix per tetrahedral element etc. + Mainly used internally to store runtime data. + + */ + class PxSoftBodyAuxData : public PxRefCounted + { + public: + /** + \brief Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + + @see PxPhysics.createTetrahedronMesh() + */ + virtual void release() = 0; + + protected: + PX_INLINE PxSoftBodyAuxData(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxSoftBodyAuxData(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxSoftBodyAuxData() {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxSoftBodyAuxData", name) || PxRefCounted::isKindOf(name); } + }; + + /** + \brief A tetramedron mesh, also called a 'tetrahedron soup'. + + It is represented as an indexed tetrahedron list. There are no restrictions on the + tetrahedron data. + + To avoid duplicating data when you have several instances of a particular + mesh positioned differently, you do not use this class to represent a + mesh object directly. Instead, you create an instance of this mesh via + the PxTetrahedronMeshGeometry and PxShape classes. + +

Creation

+ + To create an instance of this class call PxPhysics::createTetrahedronMesh(), + and release() to delete it. This is only possible + once you have released all of its PxShape instances. + + +

Visualizations:

+ \li #PxVisualizationParameter::eCOLLISION_AABBS + \li #PxVisualizationParameter::eCOLLISION_SHAPES + \li #PxVisualizationParameter::eCOLLISION_AXES + \li #PxVisualizationParameter::eCOLLISION_FNORMALS + \li #PxVisualizationParameter::eCOLLISION_EDGES + + @see PxTetrahedronMeshDesc PxTetrahedronMeshGeometry PxShape PxPhysics.createTetrahedronMesh() + */ + class PxTetrahedronMesh : public PxRefCounted + { + public: + /** + \brief Returns the number of vertices. + \return number of vertices + @see getVertices() + */ + virtual PxU32 getNbVertices() const = 0; + + /** + \brief Returns the vertices + \return array of vertices + @see getNbVertices() + */ + virtual const PxVec3* getVertices() const = 0; + + + /** + \brief Returns the number of tetrahedrons. + \return number of tetrahedrons + @see getTetrahedrons() + */ + virtual PxU32 getNbTetrahedrons() const = 0; + + /** + \brief Returns the tetrahedron indices. + + The indices can be 16 or 32bit depending on the number of tetrahedrons in the mesh. + Call getTetrahedronMeshFlags() to know if the indices are 16 or 32 bits. + + The number of indices is the number of tetrahedrons * 4. + + \return array of tetrahedrons + @see getNbTetrahedron() getTetrahedronMeshFlags() getTetrahedraRemap() + */ + virtual const void* getTetrahedrons() const = 0; + + /** + \brief Reads the PxTetrahedronMesh flags. + + See the list of flags #PxTetrahedronMeshFlags + + \return The values of the PxTetrahedronMesh flags. + */ + virtual PxTetrahedronMeshFlags getTetrahedronMeshFlags() const = 0; + + + /** + \brief Returns the tetrahedra remapping table. + + The tetrahedra are internally sorted according to various criteria. Hence the internal tetrahedron order + does not always match the original (user-defined) order. The remapping table helps finding the old + indices knowing the new ones: + + remapTable[ internalTetrahedronIndex ] = originalTetrahedronIndex + + \return the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used) + @see getNbTetrahedron() getTetrahedrons() PxCookingParams::suppressTriangleMeshRemapTable + */ + virtual const PxU32* getTetrahedraRemap() const = 0; + + /** + \brief Returns the local-space (vertex space) AABB from the tetrahedron mesh. + + \return local-space bounds + */ + virtual PxBounds3 getLocalBounds() const = 0; + + /** + \brief Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + + @see PxPhysics.createTetrahedronMesh() + */ + virtual void release() = 0; + + protected: + PX_INLINE PxTetrahedronMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxTetrahedronMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxTetrahedronMesh() {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxTetrahedronMesh", name) || PxRefCounted::isKindOf(name); } + }; + + /** + \brief A softbody mesh, containing structures to store collision shape, simulation shape and deformation state + + The class bundles shapes and deformation state of a softbody that is simulated using FEM. The meshes used for + collision detection and for the FEM calculations are both tetrahedral meshes. While collision detection requires + a mesh that matches the surface of the simulated body as exactly as possible, the simulation mesh has more freedom + such that it can be optimized for tetrahedra without small angles and nodes that aren't shared by too many elements. + +

Creation

+ + To create an instance of this class call PxPhysics::createSoftBodyMesh(), + and release() to delete it. This is only possible + once you have released all of its PxShape instances. + + */ + class PxSoftBodyMesh : public PxRefCounted + { + public: + /** + \brief Const accecssor to the softbody's collision mesh. + + @see PxTetrahedronMesh + */ + virtual const PxTetrahedronMesh* getCollisionMesh() const = 0; + + /** + \brief Accecssor to the softbody's collision mesh. + + @see PxTetrahedronMesh + */ + virtual PxTetrahedronMesh* getCollisionMesh() = 0; + + /** + \brief Const accessor to the softbody's simulation mesh. + + @see PxTetrahedronMesh + */ + virtual const PxTetrahedronMesh* getSimulationMesh() const = 0; + + /** + \brief Accecssor to the softbody's simulation mesh. + + @see PxTetrahedronMesh + */ + virtual PxTetrahedronMesh* getSimulationMesh() = 0; + + + /** + \brief Const accessor to the softbodies simulation state. + + @see PxSoftBodyAuxData + */ + virtual const PxSoftBodyAuxData* getSoftBodyAuxData() const = 0; + + /** + \brief Accessor to the softbody's auxilary data like mass and rest pose information + + @see PxSoftBodyAuxData + */ + virtual PxSoftBodyAuxData* getSoftBodyAuxData() = 0; + + /** + \brief Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + + @see PxPhysics.createTetrahedronMesh() + */ + virtual void release() = 0; + + + protected: + PX_INLINE PxSoftBodyMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxSoftBodyMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxSoftBodyMesh() {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxSoftBodyMesh", name) || PxRefCounted::isKindOf(name); } + }; + + + /** + + \brief Contains information about how to update the collision mesh's vertices given a deformed simulation tetmesh. + + @see PxTetrahedronMeshData + */ + class PxCollisionMeshMappingData : public PxUserAllocated + { + public: + virtual void release() = 0; + + virtual ~PxCollisionMeshMappingData() {} + }; + + /** + + \brief Stores data to accelerate collision detection of a tetrahedral mesh + + @see PxTetrahedronMeshData + */ + class PxSoftBodyCollisionData : public PxUserAllocated + { + + }; + + /** + + \brief Contains raw geometry information describing the tetmesh's vertices and its elements (tetrahedra) + + @see PxTetrahedronMeshData + */ + class PxTetrahedronMeshData : public PxUserAllocated + { + + }; + + /** + + \brief Stores data to compute and store the state of a deformed tetrahedral mesh + + @see PxTetrahedronMeshData + */ + class PxSoftBodySimulationData : public PxUserAllocated + { + + }; + + /** + + \brief Conbines PxTetrahedronMeshData and PxSoftBodyCollisionData + + @see PxTetrahedronMeshData PxSoftBodyCollisionData + */ + class PxCollisionTetrahedronMeshData : public PxUserAllocated + { + public: + virtual const PxTetrahedronMeshData* getMesh() const = 0; + virtual PxTetrahedronMeshData* getMesh() = 0; + virtual const PxSoftBodyCollisionData* getData() const = 0; + virtual PxSoftBodyCollisionData* getData() = 0; + virtual void release() = 0; + + virtual ~PxCollisionTetrahedronMeshData() {} + }; + + /** + + \brief Conbines PxTetrahedronMeshData and PxSoftBodyCollisionData + + @see PxTetrahedronMeshData PxSoftBodySimulationData + */ + class PxSimulationTetrahedronMeshData : public PxUserAllocated + { + public: + virtual PxTetrahedronMeshData* getMesh() = 0; + virtual PxSoftBodySimulationData* getData() = 0; + virtual void release() = 0; + + virtual ~PxSimulationTetrahedronMeshData() {} + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMeshGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMeshGeometry.h new file mode 100644 index 0000000..2c32cdf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTetrahedronMeshGeometry.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TETRAHEDRON_GEOMETRY_H +#define PX_TETRAHEDRON_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "geometry/PxMeshScale.h" +#include "common/PxCoreUtilityTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + class PxTetrahedronMesh; + + /** + \brief Tetrahedron mesh geometry class. + + This class wraps a tetrahedron mesh such that it can be used in contexts where a PxGeometry type is needed. + */ + class PxTetrahedronMeshGeometry : public PxGeometry + { + public: + /** + \brief Constructor. By default creates an empty object with a NULL mesh and identity scale. + */ + PX_INLINE PxTetrahedronMeshGeometry(PxTetrahedronMesh* mesh = NULL) : + PxGeometry(PxGeometryType::eTETRAHEDRONMESH), + tetrahedronMesh(mesh) + {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxTetrahedronMeshGeometry(const PxTetrahedronMeshGeometry& that) : + PxGeometry(that), + tetrahedronMesh(that.tetrahedronMesh) + {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxTetrahedronMeshGeometry& that) + { + mType = that.mType; + tetrahedronMesh = that.tetrahedronMesh; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + \note A valid tetrahedron mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a tetrahedron mesh that has zero extents in any direction. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + + public: + PxTetrahedronMesh* tetrahedronMesh; //!< A reference to the mesh object. + }; + + PX_INLINE bool PxTetrahedronMeshGeometry::isValid() const + { + if(mType != PxGeometryType::eTETRAHEDRONMESH) + return false; + + if(!tetrahedronMesh) + return false; + + return true; + } + +#if !PX_DOXYGEN +} // namespace physx +#endif + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangle.h new file mode 100644 index 0000000..5fe2dd1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangle.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRIANGLE_H +#define PX_TRIANGLE_H +/** \addtogroup geomutils + @{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Triangle class. +*/ +class PxTriangle +{ + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE PxTriangle() {} + + /** + \brief Constructor + + \param[in] p0 Point 0 + \param[in] p1 Point 1 + \param[in] p2 Point 2 + */ + PX_FORCE_INLINE PxTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2) + { + verts[0] = p0; + verts[1] = p1; + verts[2] = p2; + } + + /** + \brief Copy constructor + + \param[in] triangle Tri to copy + */ + PX_FORCE_INLINE PxTriangle(const PxTriangle& triangle) + { + verts[0] = triangle.verts[0]; + verts[1] = triangle.verts[1]; + verts[2] = triangle.verts[2]; + } + + /** + \brief Destructor + */ + PX_FORCE_INLINE ~PxTriangle() {} + + /** + \brief Assignment operator + */ + PX_FORCE_INLINE void operator=(const PxTriangle& triangle) + { + verts[0] = triangle.verts[0]; + verts[1] = triangle.verts[1]; + verts[2] = triangle.verts[2]; + } + + /** + \brief Compute the normal of the Triangle. + + \param[out] _normal Triangle normal. + */ + PX_FORCE_INLINE void normal(PxVec3& _normal) const + { + _normal = (verts[1]-verts[0]).cross(verts[2]-verts[0]); + _normal.normalize(); + } + + /** + \brief Compute the unnormalized normal of the triangle. + + \param[out] _normal Triangle normal (not normalized). + */ + PX_FORCE_INLINE void denormalizedNormal(PxVec3& _normal) const + { + _normal = (verts[1]-verts[0]).cross(verts[2]-verts[0]); + } + + /** + \brief Compute the area of the triangle. + + \return Area of the triangle. + */ + PX_FORCE_INLINE PxReal area() const + { + const PxVec3& p0 = verts[0]; + const PxVec3& p1 = verts[1]; + const PxVec3& p2 = verts[2]; + return ((p0 - p1).cross(p0 - p2)).magnitude() * 0.5f; + } + + /** + \return Computes a point on the triangle from u and v barycentric coordinates. + */ + PX_FORCE_INLINE PxVec3 pointFromUV(PxReal u, PxReal v) const + { + return (1.0f-u-v)*verts[0] + u*verts[1] + v*verts[2]; + } + + /** + \brief Array of Vertices. + */ + PxVec3 verts[3]; +}; + +//! A padded version of PxTriangle, to safely load its data using SIMD +class PxTrianglePadded : public PxTriangle +{ +public: + PX_FORCE_INLINE PxTrianglePadded() {} + PX_FORCE_INLINE ~PxTrianglePadded() {} + PxU32 padding; +}; + +#if !PX_DOXYGEN +} +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMesh.h new file mode 100644 index 0000000..1a9f489 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMesh.h @@ -0,0 +1,338 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_H +#define PX_TRIANGLE_MESH_H +/** \addtogroup geomutils +@{ */ + +#include "foundation/PxVec3.h" +#include "foundation/PxBounds3.h" +#include "common/PxPhysXCommonConfig.h" +#include "common/PxBase.h" +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Mesh midphase structure. This enum is used to select the desired acceleration structure for midphase queries + (i.e. raycasts, overlaps, sweeps vs triangle meshes). + + The PxMeshMidPhase::eBVH33 structure is the one used in recent PhysX versions (up to PhysX 3.3). It has great performance and is + supported on all platforms. It is deprecated since PhysX 5.x. + + The PxMeshMidPhase::eBVH34 structure is a revisited implementation introduced in PhysX 3.4. It can be significantly faster both + in terms of cooking performance and runtime performance. +*/ +struct PxMeshMidPhase +{ + enum Enum + { + eBVH33 = 0, //!< Default midphase mesh structure, as used up to PhysX 3.3 (deprecated) + eBVH34 = 1, //!< New midphase mesh structure, introduced in PhysX 3.4 + + eLAST + }; +}; + +/** +\brief Flags for the mesh geometry properties. + +Used in ::PxTriangleMeshFlags. +*/ +struct PxTriangleMeshFlag +{ + enum Enum + { + e16_BIT_INDICES = (1<<1), //!< The triangle mesh has 16bits vertex indices. + eADJACENCY_INFO = (1<<2), //!< The triangle mesh has adjacency information build. + ePREFER_NO_SDF_PROJ = (1<<3)//!< Indicates that this mesh would preferably not be the mesh projected for mesh-mesh collision. This can indicate that the mesh is not well tessellated. + }; +}; + +/** +\brief collection of set bits defined in PxTriangleMeshFlag. + +@see PxTriangleMeshFlag +*/ +typedef PxFlags PxTriangleMeshFlags; +PX_FLAGS_OPERATORS(PxTriangleMeshFlag::Enum,PxU8) + +/** + +\brief A triangle mesh, also called a 'polygon soup'. + +It is represented as an indexed triangle list. There are no restrictions on the +triangle data. + +To avoid duplicating data when you have several instances of a particular +mesh positioned differently, you do not use this class to represent a +mesh object directly. Instead, you create an instance of this mesh via +the PxTriangleMeshGeometry and PxShape classes. + +

Creation

+ +To create an instance of this class call PxPhysics::createTriangleMesh(), +and release() to delete it. This is only possible +once you have released all of its PxShape instances. + + +

Visualizations:

+\li #PxVisualizationParameter::eCOLLISION_AABBS +\li #PxVisualizationParameter::eCOLLISION_SHAPES +\li #PxVisualizationParameter::eCOLLISION_AXES +\li #PxVisualizationParameter::eCOLLISION_FNORMALS +\li #PxVisualizationParameter::eCOLLISION_EDGES + +@see PxTriangleMeshDesc PxTriangleMeshGeometry PxShape PxPhysics.createTriangleMesh() +*/ +class PxTriangleMesh : public PxRefCounted +{ + public: + /** + \brief Returns the number of vertices. + \return number of vertices + @see getVertices() + */ + virtual PxU32 getNbVertices() const = 0; + + /** + \brief Returns the vertices. + \return array of vertices + @see getNbVertices() + */ + virtual const PxVec3* getVertices() const = 0; + + /** + \brief Returns all mesh vertices for modification. + + This function will return the vertices of the mesh so that their positions can be changed in place. + After modifying the vertices you must call refitBVH for the refitting to actually take place. + This function maintains the old mesh topology (triangle indices). + + \return inplace vertex coordinates for each existing mesh vertex. + + \note It is recommended to use this feature for scene queries only. + \note Size of array returned is equal to the number returned by getNbVertices(). + \note This function operates on cooked vertex indices. + \note This means the index mapping and vertex count can be different from what was provided as an input to the cooking routine. + \note To achieve unchanged 1-to-1 index mapping with orignal mesh data (before cooking) please use the following cooking flags: + \note eWELD_VERTICES = 0, eDISABLE_CLEAN_MESH = 1. + \note It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + @see getNbVertices() + @see refitBVH() + */ + virtual PxVec3* getVerticesForModification() = 0; + + /** + \brief Refits BVH for mesh vertices. + + This function will refit the mesh BVH to correctly enclose the new positions updated by getVerticesForModification. + Mesh BVH will not be reoptimized by this function so significantly different new positions will cause significantly reduced performance. + + \return New bounds for the entire mesh. + + \note For PxMeshMidPhase::eBVH34 trees the refit operation is only available on non-quantized trees (see PxBVH34MidphaseDesc::quantized) + \note PhysX does not keep a mapping from the mesh to mesh shapes that reference it. + \note Call PxShape::setGeometry on each shape which references the mesh, to ensure that internal data structures are updated to reflect the new geometry. + \note PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + \note It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + \note Active edges information will be lost during refit, the rigid body mesh contact generation might not perform as expected. + @see getNbVertices() + @see getVerticesForModification() + @see PxBVH34MidphaseDesc::quantized + */ + virtual PxBounds3 refitBVH() = 0; + + /** + \brief Returns the number of triangles. + \return number of triangles + @see getTriangles() getTrianglesRemap() + */ + virtual PxU32 getNbTriangles() const = 0; + + /** + \brief Returns the triangle indices. + + The indices can be 16 or 32bit depending on the number of triangles in the mesh. + Call getTriangleMeshFlags() to know if the indices are 16 or 32 bits. + + The number of indices is the number of triangles * 3. + + \return array of triangles + @see getNbTriangles() getTriangleMeshFlags() getTrianglesRemap() + */ + virtual const void* getTriangles() const = 0; + + /** + \brief Reads the PxTriangleMesh flags. + + See the list of flags #PxTriangleMeshFlag + + \return The values of the PxTriangleMesh flags. + + @see PxTriangleMesh + */ + virtual PxTriangleMeshFlags getTriangleMeshFlags() const = 0; + + /** + \brief Returns the triangle remapping table. + + The triangles are internally sorted according to various criteria. Hence the internal triangle order + does not always match the original (user-defined) order. The remapping table helps finding the old + indices knowing the new ones: + + remapTable[ internalTriangleIndex ] = originalTriangleIndex + + \return the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used) + @see getNbTriangles() getTriangles() PxCookingParams::suppressTriangleMeshRemapTable + */ + virtual const PxU32* getTrianglesRemap() const = 0; + + /** + \brief Decrements the reference count of a triangle mesh and releases it if the new reference count is zero. + + @see PxPhysics.createTriangleMesh() + */ + virtual void release() = 0; + + /** + \brief Returns material table index of given triangle + + This function takes a post cooking triangle index. + + \param[in] triangleIndex (internal) index of desired triangle + \return Material table index, or 0xffff if no per-triangle materials are used + */ + virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0; + + /** + \brief Returns the local-space (vertex space) AABB from the triangle mesh. + + \return local-space bounds + */ + virtual PxBounds3 getLocalBounds() const = 0; + + /** + \brief Returns the local-space Signed Distance Field for this mesh if it has one. + \return local-space SDF. + */ + virtual const PxReal* getSDF() const = 0; + + /** + \brief Returns the resolution of the local-space dense SDF. + */ + virtual void getSDFDimensions(PxU32& numX, PxU32& numY, PxU32& numZ) const = 0; + + /** + \brief Sets whether this mesh should be preferred for SDF projection. + + By default, meshes are flagged as preferring projection and the decisions on which mesh to project is based on the triangle and vertex + count. The model with the fewer triangles is projected onto the SDF of the more detailed mesh. + If one of the meshes is set to prefer SDF projection (default) and the other is set to not prefer SDF projection, model flagged as + preferring SDF projection will be projected onto the model flagged as not preferring, regardless of the detail of the respective meshes. + Where both models are flagged as preferring no projection, the less detailed model will be projected as before. + + \param[in] preferProjection Indicates if projection is preferred + */ + virtual void setPreferSDFProjection(bool preferProjection) = 0; + + /** + \brief Returns whether this mesh prefers SDF projection. + \return whether this mesh prefers SDF projection. + */ + virtual bool getPreferSDFProjection() const = 0; + + /** + \brief Returns the mass properties of the mesh assuming unit density. + + The following relationship holds between mass and volume: + + mass = volume * density + + The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh. + + Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the + localInertia of the unit density mesh by d. + + \param[out] mass The mass of the mesh assuming unit density. + \param[out] localInertia The inertia tensor in mesh local space assuming unit density. + \param[out] localCenterOfMass Position of center of mass (or centroid) in mesh local space. + */ + virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const = 0; + +protected: + PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {} + PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {} + virtual ~PxTriangleMesh() {} + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxTriangleMesh", name) || PxRefCounted::isKindOf(name); } +}; + +/** + +\brief A triangle mesh containing the PxMeshMidPhase::eBVH33 structure. + +@see PxMeshMidPhase +@deprecated +*/ +class PX_DEPRECATED PxBVH33TriangleMesh : public PxTriangleMesh +{ + public: +protected: + PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {} + PX_INLINE PxBVH33TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {} + virtual ~PxBVH33TriangleMesh() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH33TriangleMesh", name) || PxTriangleMesh::isKindOf(name); } +}; + +/** + +\brief A triangle mesh containing the PxMeshMidPhase::eBVH34 structure. + +@see PxMeshMidPhase +*/ +class PxBVH34TriangleMesh : public PxTriangleMesh +{ + public: +protected: + PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {} + PX_INLINE PxBVH34TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {} + virtual ~PxBVH34TriangleMesh() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH34TriangleMesh", name) || PxTriangleMesh::isKindOf(name); } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMeshGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMeshGeometry.h new file mode 100644 index 0000000..3f347a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geometry/PxTriangleMeshGeometry.h @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_TRIANGLE_MESH_GEOMETRY_H +#define PX_TRIANGLE_MESH_GEOMETRY_H +/** \addtogroup geomutils +@{ +*/ +#include "geometry/PxGeometry.h" +#include "geometry/PxMeshScale.h" +#include "common/PxCoreUtilityTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxTriangleMesh; + +/** +\brief Flags controlling the simulated behavior of the triangle mesh geometry. + +Used in ::PxMeshGeometryFlags. +*/ +struct PxMeshGeometryFlag +{ + enum Enum + { + eTIGHT_BOUNDS = (1<<0), //!< Use tighter (but more expensive to compute) bounds around the triangle mesh geometry. + eDOUBLE_SIDED = (1<<1) //!< Meshes with this flag set are treated as double-sided. + //!< This flag is currently only used for raycasts and sweeps (it is ignored for overlap queries). + //!< For detailed specifications of this flag for meshes and heightfields please refer to the Geometry Query section of the user guide. + }; +}; + +/** +\brief collection of set bits defined in PxMeshGeometryFlag. + +@see PxMeshGeometryFlag +*/ +typedef PxFlags PxMeshGeometryFlags; +PX_FLAGS_OPERATORS(PxMeshGeometryFlag::Enum,PxU8) + +/** +\brief Triangle mesh geometry class. + +This class unifies a mesh object with a scaling transform, and +lets the combined object be used anywhere a PxGeometry is needed. + +The scaling is a transform along arbitrary axes contained in the scale object. +The vertices of the mesh in geometry (or shape) space is the +PxMeshScale::toMat33() transform, multiplied by the vertex space vertices +in the PxTriangleMeshGeometry object. +*/ +class PxTriangleMeshGeometry : public PxGeometry +{ +public: + /** + \brief Constructor. By default creates an empty object with a NULL mesh and identity scale. + + \param[in] mesh Mesh pointer. May be NULL, though this will not make the object valid for shape construction. + \param[in] scaling Scale factor. + \param[in] flags Mesh flags. + */ + PX_INLINE PxTriangleMeshGeometry( PxTriangleMesh* mesh = NULL, + const PxMeshScale& scaling = PxMeshScale(), + PxMeshGeometryFlags flags = PxMeshGeometryFlags()) : + PxGeometry (PxGeometryType::eTRIANGLEMESH), + scale (scaling), + meshFlags (flags), + triangleMesh(mesh) + {} + + /** + \brief Copy constructor. + + \param[in] that Other object + */ + PX_INLINE PxTriangleMeshGeometry(const PxTriangleMeshGeometry& that) : + PxGeometry (that), + scale (that.scale), + meshFlags (that.meshFlags), + triangleMesh(that.triangleMesh) + {} + + /** + \brief Assignment operator + */ + PX_INLINE void operator=(const PxTriangleMeshGeometry& that) + { + mType = that.mType; + scale = that.scale; + meshFlags = that.meshFlags; + triangleMesh = that.triangleMesh; + } + + /** + \brief Returns true if the geometry is valid. + + \return True if the current settings are valid for shape creation. + + \note A valid triangle mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). + It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a triangle mesh that has zero extents in any direction. + + @see PxRigidActor::createShape, PxPhysics::createShape + */ + PX_INLINE bool isValid() const; + +public: + PxMeshScale scale; //!< The scaling transformation. + PxMeshGeometryFlags meshFlags; //!< Mesh flags. + PxPadding<3> paddingFromFlags; //!< padding for mesh flags + PxTriangleMesh* triangleMesh; //!< A reference to the mesh object. +}; + +PX_INLINE bool PxTriangleMeshGeometry::isValid() const +{ + if(mType != PxGeometryType::eTRIANGLEMESH) + return false; + if(!scale.scale.isFinite() || !scale.rotation.isUnit()) + return false; + if(!scale.isValidForTriangleMesh()) + return false; + if(!triangleMesh) + return false; + + return true; +} + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactBuffer.h new file mode 100644 index 0000000..92a47f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactBuffer.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTACTBUFFER_H +#define PX_CONTACTBUFFER_H + +#include "PxPhysXConfig.h" +#include "geomutils/PxContactPoint.h" +#include "PxContact.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxContactBuffer + { + public: + + static const PxU32 MAX_CONTACTS = 64; + + PxContactPoint contacts[MAX_CONTACTS]; + PxU32 count; + PxU32 pad; + + PX_FORCE_INLINE void reset() + { + count = 0; + } + + PX_FORCE_INLINE bool contact(const PxVec3& worldPoint, + const PxVec3& worldNormalIn, + PxReal separation, + PxU32 faceIndex1 = PXC_CONTACT_NO_FACE_INDEX + ) + { + PX_ASSERT(PxAbs(worldNormalIn.magnitude()-1)<1e-3f); + + if(count>=MAX_CONTACTS) + return false; + + PxContactPoint& p = contacts[count++]; + p.normal = worldNormalIn; + p.point = worldPoint; + p.separation = separation; + p.internalFaceIndex1= faceIndex1; + return true; + } + + PX_FORCE_INLINE bool contact(const PxContactPoint& pt) + { + if(count>=MAX_CONTACTS) + return false; + contacts[count++] = pt; + return true; + } + + PX_FORCE_INLINE PxContactPoint* contact() + { + if(count>=MAX_CONTACTS) + return NULL; + return &contacts[count++]; + } + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactPoint.h b/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactPoint.h new file mode 100644 index 0000000..9630bf2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/geomutils/PxContactPoint.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_CONTACT_POINT_H +#define PX_CONTACT_POINT_H + +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + struct PxContactPoint + { + /** + \brief The normal of the contacting surfaces at the contact point. + + For two shapes s0 and s1, the normal points in the direction that s0 needs to move in to resolve the contact with s1. + */ + PX_ALIGN(16, PxVec3 normal); + + /** + \brief The separation of the shapes at the contact point. A negative separation denotes a penetration. + */ + PxReal separation; + + /** + \brief The point of contact between the shapes, in world space. + */ + PX_ALIGN(16, PxVec3 point); + + /** + \brief The max impulse permitted at this point + */ + PxReal maxImpulse; + + PX_ALIGN(16, PxVec3 targetVel); + + /** + \brief The static friction coefficient + */ + PxReal staticFriction; + + /** + \brief Material flags for this contact (eDISABLE_FRICTION, eDISABLE_STRONG_FRICTION). @see PxMaterialFlag + */ + PxU8 materialFlags; + + /** + \brief The surface index of shape 1 at the contact point. This is used to identify the surface material. + + \note This field is only supported by triangle meshes and heightfields, else it will be set to PXC_CONTACT_NO_FACE_INDEX. + \note This value must be directly after internalFaceIndex0 in memory + */ + PxU32 internalFaceIndex1; + + /** + \brief The dynamic friction coefficient + */ + PxReal dynamicFriction; + + /** + \brief The restitution coefficient + */ + PxReal restitution; + + PxReal damping; + }; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/gpu/PxGpu.h b/modules/PhysX/physx/physx-sys/physx/physx/include/gpu/PxGpu.h new file mode 100644 index 0000000..4b0f34b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/gpu/PxGpu.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_GPU_H +#define PX_GPU_H + +#include "PxPhysXConfig.h" + + +#if PX_SUPPORT_GPU_PHYSX + +#include "cudamanager/PxCudaContextManager.h" +#include "foundation/Px.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxFoundation.h" +#include "common/PxPhysXCommonConfig.h" + +/** +\brief PxGpuLoadHook + +This is a helper class for loading the PhysXGpu dll. +If a PhysXGpu dll with a non-default file name needs to be loaded, +PxGpuLoadHook can be sub-classed to provide the custom filenames. + +Once the names are set, the instance must be set for use by PhysX.dll using PxSetPhysXGpuLoadHook(), + +@see PxSetPhysXGpuLoadHook() +*/ +class PxGpuLoadHook +{ +public: + PxGpuLoadHook() {} + virtual ~PxGpuLoadHook() {} + + virtual const char* getPhysXGpuDllName() const = 0; + +protected: +private: +}; + +/** +\brief Sets GPU load hook instance for PhysX dll. + +\param[in] hook GPU load hook. + +@see PxGpuLoadHook +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuLoadHook(const PxGpuLoadHook* hook); + +/** + * \brief Ask the NVIDIA control panel which GPU has been selected for use by + * PhysX. Returns -1 if no PhysX capable GPU is found or GPU PhysX has + * been disabled. + */ +PX_C_EXPORT PX_PHYSX_CORE_API int PX_CALL_CONV PxGetSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc); + +/** + * \brief Allocate a CUDA Context manager, complete with heaps. + * You only need one CUDA context manager per GPU device you intend to use for + * CUDA tasks. + \param[in] foundation PhysXFoundation instance. + \param[in] desc Cuda context manager desc. + \param[in] profilerCallback PhysX profiler callback instance. + + @see PxGetProfilerCallback() + */ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxCudaContextManager* PX_CALL_CONV PxCreateCudaContextManager(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback = NULL); + +/** + * \brief Sets profiler callback to PhysX GPU + \param[in] profilerCallback PhysX profiler callback instance. + + @see PxGetProfilerCallback() + */ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxSetPhysXGpuProfilerCallback(physx::PxProfilerCallback* profilerCallback); + + +/** +\brief Internally used callback to register function names of cuda kernels +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void PX_CALL_CONV PxCudaRegisterFunction(int moduleIndex, const char* functionName); + +/** +\brief Internally used callback to register cuda modules at load time +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void** PX_CALL_CONV PxCudaRegisterFatBinary(void*); + +/** +\brief Access to the registered cuda modules +*/ +PX_C_EXPORT PX_PHYSX_CORE_API void** PX_CALL_CONV PxGetCudaModuleTable(); + +/** +\brief Number of registered cuda modules +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetCudaModuleTableSize(); + +/** +\brief Access to the loaded cuda functions (kernels) +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxKernelIndex* PX_CALL_CONV PxGetCudaFunctionTable(); + +/** +\brief Number of loaded cuda functions (kernels) +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxU32 PX_CALL_CONV PxGetCudaFunctionTableSize(); + + +#endif // PX_SUPPORT_GPU_PHYSX + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/omnipvd/PxOmniPvd.h b/modules/PhysX/physx/physx-sys/physx/physx/include/omnipvd/PxOmniPvd.h new file mode 100644 index 0000000..cc7b842 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/omnipvd/PxOmniPvd.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_OMNI_PVD_H +#define PX_OMNI_PVD_H + +#include "PxPhysXConfig.h" + +class OmniPvdWriter; +class OmniPvdFileWriteStream; + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFoundation; + +class PxOmniPvd +{ +public: + virtual ~PxOmniPvd() + { + } + /** + \brief Gets an instance of the OmniPvd writer + + \return OmniPvdWriter instance on succes, NULL otherwise. + */ + virtual OmniPvdWriter* getWriter() = 0; + + /** + \brief Gets an instance to the OmniPvd file write stream + + \return OmniPvdFileWriteStream instance on succes, NULL otherwise. + */ + virtual OmniPvdFileWriteStream* getFileWriteStream() = 0; + + /** + \brief Starts the OmniPvd sampling + + \return True if sampling started correctly, false if not. + */ + virtual bool startSampling() = 0; + + /** + \brief Releases the PxOmniPvd object + + */ + virtual void release() = 0; +}; +#if !PX_DOXYGEN +} // namespace physx +#endif +/** +\brief Creates an instance of the OmniPvd object + +Creates an instance of the OmniPvd class. There may be only one instance of this class per process. Calling this method after an instance +has been created already will return the same instance over and over. + +\param foundation Foundation instance (see PxFoundation) + +\return PxOmniPvd instance on succes, NULL otherwise. + +*/ +PX_C_EXPORT PX_PHYSX_CORE_API physx::PxOmniPvd* PX_CALL_CONV PxCreateOmniPvd(physx::PxFoundation& foundation); + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvd.h b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvd.h new file mode 100644 index 0000000..1597e3a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvd.h @@ -0,0 +1,178 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_H +#define PX_PVD_H + +/** \addtogroup pvd +@{ +*/ +#include "foundation/PxFlags.h" +#include "foundation/PxProfiler.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxFoundation; +class PxPvdTransport; + +/** +\brief types of instrumentation that PVD can do. +*/ +struct PxPvdInstrumentationFlag +{ + enum Enum + { + /** + \brief Send debugging information to PVD. + + This information is the actual object data of the rigid statics, shapes, + articulations, etc. Sending this information has a noticeable impact on + performance and thus this flag should not be set if you want an accurate + performance profile. + */ + eDEBUG = 1 << 0, + + /** + \brief Send profile information to PVD. + + This information populates PVD's profile view. It has (at this time) negligible + cost compared to Debug information and makes PVD *much* more useful so it is quite + highly recommended. + + This flag works together with a PxCreatePhysics parameter. + Using it allows the SDK to send profile events to PVD. + */ + ePROFILE = 1 << 1, + + /** + \brief Send memory information to PVD. + + The PVD sdk side hooks into the Foundation memory controller and listens to + allocation/deallocation events. This has a noticable hit on the first frame, + however, this data is somewhat compressed and the PhysX SDK doesn't allocate much + once it hits a steady state. This information also has a fairly negligible + impact and thus is also highly recommended. + + This flag works together with a PxCreatePhysics parameter, + trackOutstandingAllocations. Using both of them together allows users to have + an accurate view of the overall memory usage of the simulation at the cost of + a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort + attempt not to allocate or deallocate during simulation so this hashtable lookup + tends to have no effect past the first frame. + + Sending memory information without tracking outstanding allocations means that + PVD will accurate information about the state of the memory system before the + actual connection happened. + */ + eMEMORY = 1 << 2, + + eALL = (eDEBUG | ePROFILE | eMEMORY) + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxPvdInstrumentationFlag. + +@see PxPvdInstrumentationFlag +*/ +typedef PxFlags PxPvdInstrumentationFlags; +PX_FLAGS_OPERATORS(PxPvdInstrumentationFlag::Enum, uint8_t) + +/** +\brief PxPvd is the top-level class for the PVD framework, and the main customer interface for PVD +configuration.It is a singleton class, instantiated and owned by the application. +*/ +class PxPvd : public physx::PxProfilerCallback +{ + public: + /** + Connects the SDK to the PhysX Visual Debugger application. + \param transport transport for pvd captured data. + \param flags Flags to set. + return True if success + */ + virtual bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) = 0; + + /** + Disconnects the SDK from the PhysX Visual Debugger application. + If we are still connected, this will kill the entire debugger connection. + */ + virtual void disconnect() = 0; + + /** + * Return if connection to PVD is created. + \param useCachedStatus + 1> When useCachedStaus is false, isConnected() checks the lowlevel network status. + This can be slow because it needs to lock the lowlevel network stream. If isConnected() is + called frequently, the expense of locking can be significant. + 2> When useCachedStatus is true, isConnected() checks the highlevel cached status with atomic access. + It is faster than locking, but the status may be different from the lowlevel network with latency of up to + one frame. + The reason for this is that the cached status is changed inside socket listener, which is not + called immediately when the lowlevel connection status changes. + */ + virtual bool isConnected(bool useCachedStatus = true) = 0; + + /** + returns the PVD data transport + returns NULL if no transport is present. + */ + virtual PxPvdTransport* getTransport() = 0; + + /** + Retrieves the PVD flags. See PxPvdInstrumentationFlags. + */ + virtual PxPvdInstrumentationFlags getInstrumentationFlags() = 0; + + /** + \brief Releases the pvd instance. + */ + virtual void release() = 0; + + protected: + virtual ~PxPvd() + { + } +}; + +/** + \brief Create a pvd instance. + \param foundation is the foundation instance that stores the allocator and error callbacks. +*/ +PX_C_EXPORT PxPvd* PX_CALL_CONV PxCreatePvd(PxFoundation& foundation); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdSceneClient.h b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdSceneClient.h new file mode 100644 index 0000000..6fd3255 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdSceneClient.h @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_SCENE_CLIENT_H +#define PX_PVD_SCENE_CLIENT_H + +/** \addtogroup pvd +@{ +*/ + +#include "foundation/PxFlags.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + namespace pvdsdk + { + class PvdClient; + } + struct PxDebugPoint; + struct PxDebugLine; + struct PxDebugTriangle; + struct PxDebugText; +#if !PX_DOXYGEN +} // namespace physx +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PVD scene Flags. They are disabled by default, and only works if PxPvdInstrumentationFlag::eDEBUG is set. +*/ +struct PxPvdSceneFlag +{ + enum Enum + { + eTRANSMIT_CONTACTS = (1 << 0), //! Transmits contact stream to PVD. + eTRANSMIT_SCENEQUERIES = (1 << 1), //! Transmits scene query stream to PVD. + eTRANSMIT_CONSTRAINTS = (1 << 2) //! Transmits constraints visualize stream to PVD. + }; +}; + +/** +\brief Bitfield that contains a set of raised flags defined in PxPvdSceneFlag. + +@see PxPvdSceneFlag +*/ +typedef PxFlags PxPvdSceneFlags; +PX_FLAGS_OPERATORS(PxPvdSceneFlag::Enum, PxU8) + +/** +\brief Special client for PxScene. +It provides access to the PxPvdSceneFlag. +It also provides simple user debug services that associated scene position such as immediate rendering and camera updates. +*/ +class PxPvdSceneClient +{ + public: + /** + Sets the PVD flag. See PxPvdSceneFlag. + \param flag Flag to set. + \param value value the flag gets set to. + */ + virtual void setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value) = 0; + + /** + Sets the PVD flags. See PxPvdSceneFlags. + \param flags Flags to set. + */ + virtual void setScenePvdFlags(PxPvdSceneFlags flags) = 0; + + /** + Retrieves the PVD flags. See PxPvdSceneFlags. + */ + virtual PxPvdSceneFlags getScenePvdFlags() const = 0; + + /** + update camera on PVD application's render window + */ + virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0; + + /** + draw points on PVD application's render window + */ + virtual void drawPoints(const physx::PxDebugPoint* points, PxU32 count) = 0; + + /** + draw lines on PVD application's render window + */ + virtual void drawLines(const physx::PxDebugLine* lines, PxU32 count) = 0; + + /** + draw triangles on PVD application's render window + */ + virtual void drawTriangles(const physx::PxDebugTriangle* triangles, PxU32 count) = 0; + + /** + draw text on PVD application's render window + */ + virtual void drawText(const physx::PxDebugText& text) = 0; + + /** + get the underlying client, for advanced users + */ + PX_DEPRECATED virtual physx::pvdsdk::PvdClient* getClientInternal() = 0; + +protected: + virtual ~PxPvdSceneClient(){} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdTransport.h b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdTransport.h new file mode 100644 index 0000000..d9da9df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/pvd/PxPvdTransport.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_TRANSPORT_H +#define PX_PVD_TRANSPORT_H + +/** \addtogroup pvd +@{ +*/ +#include "foundation/PxErrors.h" +#include "foundation/PxFlags.h" +#include "pvd/PxPvd.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief PxPvdTransport is an interface representing the data transport mechanism. +This class defines all services associated with the transport: configuration, connection, reading, writing etc. +It is owned by the application, and can be realized as a file or a socket (using one-line PxDefault<...> methods in +PhysXExtensions) or in a custom implementation. This is a class that is intended for use by PVD, not by the +application, the application entry points are PxPvd and PvdClient. +*/ + +class PxPvdTransport +{ + public: + // connect, isConnected, disconnect, read, write, flush + + /** + Connects to the Visual Debugger application. + return True if success + */ + virtual bool connect() = 0; + + /** + Disconnects from the Visual Debugger application. + If we are still connected, this will kill the entire debugger connection. + */ + virtual void disconnect() = 0; + + /** + * Return if connection to PVD is created. + */ + virtual bool isConnected() = 0; + + /** + * write bytes to the other endpoint of the connection. should lock before witre. If an error occurs + * this connection will assume to be dead. + */ + virtual bool write(const uint8_t* inBytes, uint32_t inLength) = 0; + + /* + lock this transport and return it + */ + virtual PxPvdTransport& lock() = 0; + + /* + unlock this transport + */ + virtual void unlock() = 0; + + /** + * send any data and block until we know it is at least on the wire. + */ + virtual void flush() = 0; + + /** + * Return size of written data. + */ + virtual uint64_t getWrittenDataSize() = 0; + + virtual void release() = 0; + + protected: + virtual ~PxPvdTransport() + { + } +}; + +/** + \brief Create a default socket transport. + \param host host address of the pvd application. + \param port ip port used for pvd, should same as the port setting in pvd application. + \param timeoutInMilliseconds timeout when connect to pvd host. +*/ +PX_C_EXPORT PxPvdTransport* PX_CALL_CONV +PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds); + +/** + \brief Create a default file transport. + \param name full path filename used save captured pvd data, or NULL for a fake/test file transport. +*/ +PX_C_EXPORT PxPvdTransport* PX_CALL_CONV PxDefaultPvdFileTransportCreate(const char* name); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/solver/PxSolverDefs.h b/modules/PhysX/physx/physx-sys/physx/physx/include/solver/PxSolverDefs.h new file mode 100644 index 0000000..64267d2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/solver/PxSolverDefs.h @@ -0,0 +1,545 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_SOLVER_DEFS_H +#define PX_SOLVER_DEFS_H + +#include "PxPhysXConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" +#include "PxConstraintDesc.h" +#include "geomutils/PxContactPoint.h" + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4324) // structure was padded due to alignment +#endif + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxTGSSolverBodyVel; + +/** +\brief Struct that the solver uses to store velocity updates for a body +*/ +struct PxSolverBody +{ + PX_ALIGN(16, PxVec3) linearVelocity; //!< Delta linear velocity computed by the solver + PxU16 maxSolverNormalProgress; //!< Progress counter used by constraint batching and parallel island solver. + PxU16 maxSolverFrictionProgress; //!< Progress counter used by constraint batching and parallel island solver. + + PxVec3 angularState; //!< Delta angular velocity state computed by the solver. + + PxU32 solverProgress; //!< Progress counter used by constraint batching and parallel island solver + + PxSolverBody() : linearVelocity(0.f), maxSolverNormalProgress(0), maxSolverFrictionProgress(0), angularState(0), solverProgress(0) + { + } +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxSolverBody) == 32); + +/** +\brief Struct that the solver uses to store the state and other properties of a body +*/ +struct PxSolverBodyData +{ + PX_ALIGN(16, PxVec3 linearVelocity); //!< 12 Pre-solver linear velocity + PxReal invMass; //!< 16 inverse mass + PxVec3 angularVelocity; //!< 28 Pre-solver angular velocity + PxReal reportThreshold; //!< 32 contact force threshold + PxMat33 sqrtInvInertia; //!< 68 inverse inertia in world space + PxReal penBiasClamp; //!< 72 the penetration bias clamp + PxU32 nodeIndex; //!< 76 the node idx of this solverBodyData. Used by solver to reference between solver bodies and island bodies. Not required by immediate mode + PxReal maxContactImpulse; //!< 80 the max contact impulse + PxTransform body2World; //!< 108 the body's transform + PxU16 pad; //!< 112 pad + + PX_FORCE_INLINE PxReal projectVelocity(const PxVec3& lin, const PxVec3& ang) const + { + return linearVelocity.dot(lin) + angularVelocity.dot(ang); + } +}; +PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxSolverBodyData) & 15)); + +//---------------------------------- +/** +\brief A header that defines the size of a specific batch of constraints (of same type and without dependencies) +*/ +struct PxConstraintBatchHeader +{ + PxU32 startIndex; //!< Start index for this batch + PxU16 stride; //!< Number of constraints in this batch (range: 1-4) + PxU16 constraintType; //!< The type of constraint this batch references +}; + +/** +\brief Constraint descriptor used inside the solver +*/ +struct PxSolverConstraintDesc +{ + static const PxU16 RIGID_BODY = 0xffff; + + enum ConstraintType + { + eCONTACT_CONSTRAINT, //!< Defines this pair is a contact constraint + eJOINT_CONSTRAINT //!< Defines this pair is a joint constraint + }; + + union + { + PxSolverBody* bodyA; //!< bodyA pointer + PxTGSSolverBodyVel* tgsBodyA; //!< bodyA pointer + void* articulationA; //!< Articulation pointer for body A + }; + + union + { + PxSolverBody* bodyB; //!< BodyB pointer + PxTGSSolverBodyVel* tgsBodyB; //!< BodyB pointer + void* articulationB; //!< Articulation pointer for body B + }; + PxU32 bodyADataIndex; //!< Body A's index into the SolverBodyData array + PxU32 bodyBDataIndex; //!< Body B's index into the SolverBodyData array + + PxU32 linkIndexA; //!< Link index defining which link in Articulation A this constraint affects. If not an articulation, must be NO_LINK + PxU32 linkIndexB; //!< Link index defining which link in Articulation B this constraint affects. If not an articulation, must be NO_LINK + PxU8* constraint; //!< Pointer to the constraint rows to be solved + void* writeBack; //!< Pointer to the writeback structure results for this given constraint are to be written to + + PxU16 progressA; //!< Internal progress counter + PxU16 progressB; //!< Internal progress counter + PxU16 constraintLengthOver16; //!< constraintLength/16, max constraint length is 1MB, allows PxSolverConstraintDesc to fit in 32 bytes + PxU8 padding[10]; +}; + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverConstraintPrepDescBase +{ + enum BodyState + { + eDYNAMIC_BODY = 1 << 0, + eSTATIC_BODY = 1 << 1, + eKINEMATIC_BODY = 1 << 2, + eARTICULATION = 1 << 3 + }; + + PxConstraintInvMassScale invMassScales; //!< In: The local mass scaling for this pair. + + PxSolverConstraintDesc* desc; //!< Output: The PxSolverConstraintDesc filled in by contact prep + + const PxSolverBody* body0; //!< In: The first body. Stores velocity information. Unused unless contact involves articulations. + const PxSolverBody* body1; //!< In: The second body. Stores velocity information. Unused unless contact involves articulations. + + const PxSolverBodyData* data0; //!< In: The first PxSolverBodyData. Stores mass and miscellaneous information for the first body. + const PxSolverBodyData* data1; //!< In: The second PxSolverBodyData. Stores mass and miscellaneous information for the second body + + PxTransform bodyFrame0; //!< In: The world-space transform of the first body. + PxTransform bodyFrame1; //!< In: The world-space transform of the second body. + + BodyState bodyState0; //!< In: Defines what kind of actor the first body is + BodyState bodyState1; //!< In: Defines what kind of actor the second body is +}; + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverConstraintPrepDesc : public PxSolverConstraintPrepDescBase +{ + PX_ALIGN(16, Px1DConstraint* rows); //!< The start of the constraint rows + PxU32 numRows; //!< The number of rows + + PxReal linBreakForce, angBreakForce; //!< Break forces + PxReal minResponseThreshold; //!< The minimum response threshold + void* writeback; //!< Pointer to constraint writeback structure. Reports back joint breaking. If not required, set to NULL. + bool disablePreprocessing; //!< Disable joint pre-processing. Pre-processing can improve stability but under certain circumstances, e.g. when some invInertia rows are zero/almost zero, can cause instabilities. + bool improvedSlerp; //!< Use improved slerp model + bool driveLimitsAreForces; //!< Indicates whether drive limits are forces + bool extendedLimits; //!< Indicates whether we want to use extended limits + bool disableConstraint; //!< Disables constraint + + PxVec3p body0WorldOffset; //!< Body0 world offset +}; + +/** +\brief Data structure used for preparing constraints before solving them +*/ +struct PxSolverContactDesc : public PxSolverConstraintPrepDescBase +{ + void* shapeInteraction; //!< Pointer to shape interaction. Used for force threshold reports in solver. Set to NULL if using immediate mode. + PxContactPoint* contacts; //!< The start of the contacts for this pair + PxU32 numContacts; //!< The total number of contacts this pair references. + + bool hasMaxImpulse; //!< Defines whether this pairs has maxImpulses clamping enabled + bool disableStrongFriction; //!< Defines whether this pair disables strong friction (sticky friction correlation) + bool hasForceThresholds; //!< Defines whether this pair requires force thresholds + + PxReal restDistance; //!< A distance at which the solver should aim to hold the bodies separated. Default is 0 + PxReal maxCCDSeparation; //!< A distance used to configure speculative CCD behavior. Default is PX_MAX_F32. Set internally in PhysX for bodies with eENABLE_SPECULATIVE_CCD on. Do not set directly! + + PxU8* frictionPtr; //!< InOut: Friction patch correlation data. Set each frame by solver. Can be retained for improved behavior or discarded each frame. + PxU8 frictionCount; //!< The total number of friction patches in this pair + + PxReal* contactForces; //!< Out: A buffer for the solver to write applied contact forces to. + + PxU32 startFrictionPatchIndex; //!< Start index of friction patch in the correlation buffer. Set by friction correlation + PxU32 numFrictionPatches; //!< Total number of friction patches in this pair. Set by friction correlation + + PxU32 startContactPatchIndex; //!< The start index of this pair's contact patches in the correlation buffer. For internal use only + PxU16 numContactPatches; //!< Total number of contact patches. + PxU16 axisConstraintCount; //!< Axis constraint count. Defines how many constraint rows this pair has produced. Useful for statistical purposes. + + PxReal offsetSlop; //!< Slop value used to snap contact line of action back in-line with the COM. + //PxU8 pad[16 - sizeof(void*)]; +}; + +class PxConstraintAllocator +{ +public: + /** + \brief Allocates constraint data. It is the application's responsibility to release this memory after PxSolveConstraints has completed. + \param[in] byteSize Allocation size in bytes + \return The allocated memory. This address must be 16-byte aligned. + */ + virtual PxU8* reserveConstraintData(const PxU32 byteSize) = 0; + + /** + \brief Allocates friction data. Friction data can be retained by the application for a given pair and provided as an input to PxSolverContactDesc to improve simulation stability. + It is the application's responsibility to release this memory. If this memory is released, the application should ensure it does not pass pointers to this memory to PxSolverContactDesc. + \param[in] byteSize Allocation size in bytes + \return The allocated memory. This address must be 4-byte aligned. + */ + virtual PxU8* reserveFrictionData(const PxU32 byteSize) = 0; + + virtual ~PxConstraintAllocator() {} +}; + +/** \addtogroup physics +@{ */ +struct PxArticulationAxis +{ + enum Enum + { + eTWIST = 0, //!< Rotational about eX + eSWING1 = 1, //!< Rotational about eY + eSWING2 = 2, //!< Rotational about eZ + eX = 3, //!< Linear in eX + eY = 4, //!< Linear in eY + eZ = 5, //!< Linear in eZ + eCOUNT = 6 + }; +}; + +PX_FLAGS_OPERATORS(PxArticulationAxis::Enum, PxU8) + +struct PxArticulationMotion +{ + enum Enum + { + eLOCKED = 0, //!< Locked axis, i.e. degree of freedom (DOF) + eLIMITED = 1, //!< Limited DOF - set limits of joint DOF together with this flag, see PxArticulationJointReducedCoordinate::setLimitParams + eFREE = 2 //!< Free DOF + }; +}; + +typedef PxFlags PxArticulationMotions; +PX_FLAGS_OPERATORS(PxArticulationMotion::Enum, PxU8) + +struct PxArticulationJointType +{ + enum Enum + { + eFIX = 0, //!< All joint axes, i.e. degrees of freedom (DOFs) locked + ePRISMATIC = 1, //!< Single linear DOF, e.g. cart on a rail + eREVOLUTE = 2, //!< Single rotational DOF, e.g. an elbow joint or a rotational motor, position wrapped at 2pi radians + eREVOLUTE_UNWRAPPED = 3, //!< Single rotational DOF, e.g. an elbow joint or a rotational motor, position not wrapped + eSPHERICAL = 4, //!< Ball and socket joint with two or three DOFs + eUNDEFINED = 5 + }; +}; + +struct PxArticulationFlag +{ + enum Enum + { + eFIX_BASE = (1 << 0), //!< Set articulation base to be fixed. + eDRIVE_LIMITS_ARE_FORCES = (1<<1), //!< Limits for drive effort are forces and torques rather than impulses, see PxArticulationDrive::maxForce. + eDISABLE_SELF_COLLISION = (1<<2), //!< Disable collisions between the articulation's links (note that parent/child collisions are disabled internally in either case). + eCOMPUTE_JOINT_FORCES = (1<<3) //!< Enable in order to be able to query joint solver (i.e. constraint) forces using PxArticulationCache::jointSolverForces. + }; +}; + +typedef PxFlags PxArticulationFlags; +PX_FLAGS_OPERATORS(PxArticulationFlag::Enum, PxU8) + +struct PxArticulationDriveType +{ + enum Enum + { + eFORCE = 0, //!< The output of the implicit spring drive controller is a force/torque. + eACCELERATION = 1, //!< The output of the implicit spring drive controller is a joint acceleration (use this to get (spatial)-inertia-invariant behavior of the drive). + eTARGET = 2, //!< Sets the drive gains internally to track a target position almost kinematically (i.e. with very high drive gains). + eVELOCITY = 3, //!< Sets the drive gains internally to track a target velocity almost kinematically (i.e. with very high drive gains). + eNONE = 4 + }; +}; + +/** +\brief Data structure to set articulation joint limits. + +- The lower limit should be strictly smaller than the higher limit. If the limits should be equal, use PxArticulationMotion::eLOCKED +and an appropriate offset in the parent/child joint frames. +- The limit units are linear units (equivalent to scene units) for a translational axis, or radians for a rotational axis. + +@see PxArticulationJointReducedCoordinate::setLimitParams, PxArticulationReducedCoordinate +*/ +struct PxArticulationLimit +{ + PxArticulationLimit(){} + + PxArticulationLimit(const PxReal low_, const PxReal high_) + { + low = low_; + high = high_; + } + + /** + \brief The lower limit on the joint axis position. + + Range: [-PX_MAX_F32, high)
+ Default: 0.0f
+ */ + PxReal low; + + /** + \brief The higher limit on the joint axis position. + + Range: (low, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal high; +}; + +/** +\brief Data structure for articulation joint drive configuration. + +@see PxArticulationJointReducedCoordinate::setDriveParams, PxArticulationReducedCoordinate +*/ +struct PxArticulationDrive +{ + PxArticulationDrive(){} + + PxArticulationDrive(const PxReal stiffness_, const PxReal damping_, const PxReal maxForce_, PxArticulationDriveType::Enum driveType_=PxArticulationDriveType::eFORCE) + { + stiffness = stiffness_; + damping = damping_; + maxForce = maxForce_; + driveType = driveType_; + } + + /** + \brief The drive stiffness, i.e. the proportional gain of the implicit PD controller. + + See manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + Units: (distance = linear scene units)
+ Rotational axis: torque/rad if driveType = PxArticulationDriveType::eFORCE; or (rad/s^2)/rad if driveType = PxArticulationDriveType::eACCELERATION
+ Translational axis: force/distance if driveType = PxArticulationDriveType::eFORCE; or (distance/s^2)/distance if driveType = PxArticulationDriveType::eACCELERATION
+ Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal stiffness; + + /** + \brief The drive damping, i.e. the derivative gain of the implicit PD controller. + + See manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + + Units: (distance = linear scene units)
+ Rotational axis: torque/(rad/s) if driveType = PxArticulationDriveType::eFORCE; or (rad/s^2)/(rad/s) if driveType = PxArticulationDriveType::eACCELERATION
+ Translational axis: force/(distance/s) if driveType = PxArticulationDriveType::eFORCE; or (distance/s^2)/(distance/s) if driveType = PxArticulationDriveType::eACCELERATION
+ Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ */ + PxReal damping; + + /** + \brief The drive force limit. + + - The limit is enforced regardless of the drive type #PxArticulationDriveType. + - The limit corresponds to a force (linear axis) or torque (rotational axis) if PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES is set, and to an impulse (force|torque * dt) otherwise. + + Range: [0, PX_MAX_F32]
+ Default: 0.0f
+ + @see PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES + */ + PxReal maxForce; + + /** + \brief The drive type. + + @see PxArticulationDriveType + */ + PxArticulationDriveType::Enum driveType; +}; +/** @} */ + +struct PxTGSSolverBodyVel +{ + PX_ALIGN(16, PxVec3) linearVelocity; //12 + PxU16 nbStaticInteractions; //14 Used to accumulate the number of static interactions + PxU16 maxDynamicPartition; //16 Used to accumulate the max partition of dynamic interactions + PxVec3 angularVelocity; //28 + PxU32 partitionMask; //32 Used in partitioning as a bit-field + PxVec3 deltaAngDt; //44 + PxReal maxAngVel; //48 + PxVec3 deltaLinDt; //60 + PxU16 lockFlags; //62 + bool isKinematic; //63 + PxU8 pad; //64 + + PX_FORCE_INLINE PxReal projectVelocity(const PxVec3& lin, const PxVec3& ang) const + { + return linearVelocity.dot(lin) + angularVelocity.dot(ang); + } +}; + +//Needed only by prep, integration and 1D constraints +struct PxTGSSolverBodyTxInertia +{ + PxTransform deltaBody2World; + PxMat33 sqrtInvInertia; //!< inverse inertia in world space +}; + +struct PxTGSSolverBodyData +{ + PX_ALIGN(16, PxVec3) originalLinearVelocity; //!< Pre-solver linear velocity. + PxReal maxContactImpulse; //!< The max contact impulse. + PxVec3 originalAngularVelocity; //!< Pre-solver angular velocity + PxReal penBiasClamp; //!< The penetration bias clamp. + + PxReal invMass; //!< Inverse mass. + PxU32 nodeIndex; //!< The node idx of this solverBodyData. Used by solver to reference between solver bodies and island bodies. Not required by immediate mode. + PxReal reportThreshold; //!< Contact force threshold. + PxU32 pad; + + PxReal projectVelocity(const PxVec3& linear, const PxVec3& angular) const + { + return originalLinearVelocity.dot(linear) + originalAngularVelocity.dot(angular); + } +}; + +struct PxTGSSolverConstraintPrepDescBase +{ + PxConstraintInvMassScale invMassScales; //!< In: The local mass scaling for this pair. + + PxSolverConstraintDesc* desc; //!< Output: The PxSolverConstraintDesc filled in by contact prep + + const PxTGSSolverBodyVel* body0; //!< In: The first body. Stores velocity information. Unused unless contact involves articulations. + const PxTGSSolverBodyVel* body1; //!< In: The second body. Stores velocity information. Unused unless contact involves articulations. + + const PxTGSSolverBodyTxInertia* body0TxI; //!< In: The first PxTGSSolverBodyTxInertia. Stores the delta body to world transform and sqrtInvInertia for first body. + const PxTGSSolverBodyTxInertia* body1TxI; //!< In: The second PxTGSSolverBodyTxInertia. Stores the delta body to world transform and sqrtInvInertia for second body. + + const PxTGSSolverBodyData* bodyData0; //!< In: The first PxTGSSolverBodyData. Stores mass and miscellaneous information for the first body. + const PxTGSSolverBodyData* bodyData1; //!< In: The second PxTGSSolverBodyData. Stores mass and miscellaneous information for the second body. + + PxTransform bodyFrame0; //!< In: The world-space transform of the first body. + PxTransform bodyFrame1; //!< In: The world-space transform of the second body. + + PxSolverConstraintPrepDescBase::BodyState bodyState0; //!< In: Defines what kind of actor the first body is + PxSolverConstraintPrepDescBase::BodyState bodyState1; //!< In: Defines what kind of actor the second body is +}; + +struct PxTGSSolverConstraintPrepDesc : public PxTGSSolverConstraintPrepDescBase +{ + Px1DConstraint* rows; //!< The start of the constraint rows + PxU32 numRows; //!< The number of rows + + PxReal linBreakForce, angBreakForce; //!< Break forces + PxReal minResponseThreshold; //!< The minimum response threshold + void* writeback; //!< Pointer to constraint writeback structure. Reports back joint breaking. If not required, set to NULL. + bool disablePreprocessing; //!< Disable joint pre-processing. Pre-processing can improve stability but under certain circumstances, e.g. when some invInertia rows are zero/almost zero, can cause instabilities. + bool improvedSlerp; //!< Use improved slerp model + bool driveLimitsAreForces; //!< Indicates whether drive limits are forces + bool extendedLimits; //!< Indicates whether extended limits are used + bool disableConstraint; //!< Disables constraint + + PxVec3p body0WorldOffset; //!< Body0 world offset + PxVec3p cA2w; //!< Location of anchor point A in world space + PxVec3p cB2w; //!< Location of anchor point B in world space +}; + +struct PxTGSSolverContactDesc : public PxTGSSolverConstraintPrepDescBase +{ + void* shapeInteraction; //!< Pointer to shape interaction. Used for force threshold reports in solver. Set to NULL if using immediate mode. + PxContactPoint* contacts; //!< The start of the contacts for this pair + PxU32 numContacts; //!< The total number of contacts this pair references. + + bool hasMaxImpulse; //!< Defines whether this pairs has maxImpulses clamping enabled + bool disableStrongFriction; //!< Defines whether this pair disables strong friction (sticky friction correlation) + bool hasForceThresholds; //!< Defines whether this pair requires force thresholds + + PxReal restDistance; //!< A distance at which the solver should aim to hold the bodies separated. Default is 0 + PxReal maxCCDSeparation; //!< A distance used to configure speculative CCD behavior. Default is PX_MAX_F32. Set internally in PhysX for bodies with eENABLE_SPECULATIVE_CCD on. Do not set directly! + + PxU8* frictionPtr; //!< InOut: Friction patch correlation data. Set each frame by solver. Can be retained for improved behavior or discarded each frame. + PxU8 frictionCount; //!< The total number of friction patches in this pair + + PxReal* contactForces; //!< Out: A buffer for the solver to write applied contact forces to. + + PxU32 startFrictionPatchIndex; //!< Start index of friction patch in the correlation buffer. Set by friction correlation + PxU32 numFrictionPatches; //!< Total number of friction patches in this pair. Set by friction correlation + + PxU32 startContactPatchIndex; //!< The start index of this pair's contact patches in the correlation buffer. For internal use only + PxU16 numContactPatches; //!< Total number of contact patches. + PxU16 axisConstraintCount; //!< Axis constraint count. Defines how many constraint rows this pair has produced. Useful for statistical purposes. + + PxReal maxImpulse; //!< The maximum impulse the solver is allowed to introduce for this pair of bodies. + + PxReal torsionalPatchRadius; //!< This defines the radius of the contact patch used to apply torsional friction. + PxReal minTorsionalPatchRadius; //!< This defines the minimum radius of the contact patch used to apply torsional friction. + PxReal offsetSlop; //!< Slop value used to snap contact line of action back in-line with the COM. +}; + +#if !PX_DOXYGEN +} +#endif + +#if PX_VC +#pragma warning(pop) +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxCpuDispatcher.h b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxCpuDispatcher.h new file mode 100644 index 0000000..fc2e30c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxCpuDispatcher.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_CPU_DISPATCHER_H +#define PX_CPU_DISPATCHER_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBaseTask; + +/** + \brief A CpuDispatcher is responsible for scheduling the execution of tasks passed to it by the SDK. + + A typical implementation would for example use a thread pool with the dispatcher + pushing tasks onto worker thread queues or a global queue. + + @see PxBaseTask + @see PxTask + @see PxTaskManager +*/ +class PxCpuDispatcher +{ +public: + /** + \brief Called by the TaskManager when a task is to be queued for execution. + + Upon receiving a task, the dispatcher should schedule the task to run. + After the task has been run, it should call the release() method and + discard its pointer. + + \param[in] task The task to be run. + + @see PxBaseTask + */ + virtual void submitTask(PxBaseTask& task) = 0; + + /** + \brief Returns the number of available worker threads for this dispatcher. + + The SDK will use this count to control how many tasks are submitted. By + matching the number of tasks with the number of execution units task + overhead can be reduced. + */ + virtual uint32_t getWorkerCount() const = 0; + + virtual ~PxCpuDispatcher() {} +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTask.h b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTask.h new file mode 100644 index 0000000..73851e5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTask.h @@ -0,0 +1,319 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TASK_H +#define PX_TASK_H + +#include "task/PxTaskManager.h" +#include "task/PxCpuDispatcher.h" +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** + * \brief Base class of all task types + * + * PxBaseTask defines a runnable reference counted task with built-in profiling. + */ +class PxBaseTask +{ +public: + PxBaseTask() : mContextID(0), mTm(NULL) {} + virtual ~PxBaseTask() {} + + /** + * \brief The user-implemented run method where the task's work should be performed + * + * run() methods must be thread safe, stack friendly (no alloca, etc), and + * must never block. + */ + virtual void run() = 0; + + /** + * \brief Return a user-provided task name for profiling purposes. + * + * It does not have to be unique, but unique names are helpful. + * + * \return The name of this task + */ + virtual const char* getName() const = 0; + + //! \brief Implemented by derived implementation classes + virtual void addReference() = 0; + //! \brief Implemented by derived implementation classes + virtual void removeReference() = 0; + //! \brief Implemented by derived implementation classes + virtual int32_t getReference() const = 0; + + /** \brief Implemented by derived implementation classes + * + * A task may assume in its release() method that the task system no longer holds + * references to it - so it may safely run its destructor, recycle itself, etc. + * provided no additional user references to the task exist + */ + virtual void release() = 0; + + /** + * \brief Return PxTaskManager to which this task was submitted + * + * Note, can return NULL if task was not submitted, or has been + * completed. + */ + PX_FORCE_INLINE PxTaskManager* getTaskManager() const + { + return mTm; + } + + PX_FORCE_INLINE void setContextId(PxU64 id) { mContextID = id; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + +protected: + PxU64 mContextID; //!< Context ID for profiler interface + PxTaskManager* mTm; //!< Owning PxTaskManager instance + + friend class PxTaskMgr; +}; + + +/** + * \brief A PxBaseTask implementation with deferred execution and full dependencies + * + * A PxTask must be submitted to a PxTaskManager to to be executed, Tasks may + * optionally be named when they are submitted. + */ +class PxTask : public PxBaseTask +{ +public: + PxTask() : mTaskID(0) {} + virtual ~PxTask() {} + + //! \brief Release method implementation + virtual void release() PX_OVERRIDE + { + PX_ASSERT(mTm); + + // clear mTm before calling taskCompleted() for safety + PxTaskManager* save = mTm; + mTm = NULL; + save->taskCompleted(*this); + } + + //! \brief Inform the PxTaskManager this task must finish before the given + // task is allowed to start. + PX_INLINE void finishBefore(PxTaskID taskID) + { + PX_ASSERT(mTm); + mTm->finishBefore(*this, taskID); + } + + //! \brief Inform the PxTaskManager this task cannot start until the given + // task has completed. + PX_INLINE void startAfter(PxTaskID taskID) + { + PX_ASSERT(mTm); + mTm->startAfter(*this, taskID); + } + + /** + * \brief Manually increment this task's reference count. The task will + * not be allowed to run until removeReference() is called. + */ + virtual void addReference() PX_OVERRIDE + { + PX_ASSERT(mTm); + mTm->addReference(mTaskID); + } + + /** + * \brief Manually decrement this task's reference count. If the reference + * count reaches zero, the task will be dispatched. + */ + virtual void removeReference() PX_OVERRIDE + { + PX_ASSERT(mTm); + mTm->decrReference(mTaskID); + } + + /** + * \brief Return the ref-count for this task + */ + virtual int32_t getReference() const PX_OVERRIDE + { + return mTm->getReference(mTaskID); + } + + /** + * \brief Return the unique ID for this task + */ + PX_INLINE PxTaskID getTaskID() const + { + return mTaskID; + } + + /** + * \brief Called by PxTaskManager at submission time for initialization + * + * Perform simulation step initialization here. + */ + virtual void submitted() + { + } + +protected: + PxTaskID mTaskID; //!< ID assigned at submission + + friend class PxTaskMgr; +}; + + +/** + * \brief A PxBaseTask implementation with immediate execution and simple dependencies + * + * A PxLightCpuTask bypasses the PxTaskManager launch dependencies and will be + * submitted directly to your scene's CpuDispatcher. When the run() function + * completes, it will decrement the reference count of the specified + * continuation task. + * + * You must use a full-blown PxTask if you want your task to be resolved + * by another PxTask, or you need more than a single dependency to be + * resolved when your task completes, or your task will not run on the + * CpuDispatcher. + */ +class PxLightCpuTask : public PxBaseTask +{ +public: + PxLightCpuTask() + : mCont( NULL ) + , mRefCount( 0 ) + { + } + virtual ~PxLightCpuTask() + { + mTm = NULL; + } + + /** + * \brief Initialize this task and specify the task that will have its ref count decremented on completion. + * + * Submission is deferred until the task's mRefCount is decremented to zero. + * Note that we only use the PxTaskManager to query the appropriate dispatcher. + * + * \param[in] tm The PxTaskManager this task is managed by + * \param[in] c The task to be executed when this task has finished running + */ + PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c) + { + PX_ASSERT(mRefCount == 0); + mRefCount = 1; + mCont = c; + mTm = &tm; + if(mCont) + mCont->addReference(); + } + + /** + * \brief Initialize this task and specify the task that will have its ref count decremented on completion. + * + * This overload of setContinuation() queries the PxTaskManager from the continuation + * task, which cannot be NULL. + * \param[in] c The task to be executed after this task has finished running + */ + PX_INLINE void setContinuation(PxBaseTask* c) + { + PX_ASSERT(c); + PX_ASSERT(mRefCount == 0); + mRefCount = 1; + mCont = c; + if(mCont) + { + mCont->addReference(); + mTm = mCont->getTaskManager(); + PX_ASSERT(mTm); + } + } + + /** + * \brief Retrieves continuation task + */ + PX_INLINE PxBaseTask* getContinuation() const + { + return mCont; + } + + /** + * \brief Manually decrement this task's reference count. If the reference + * count reaches zero, the task will be dispatched. + */ + virtual void removeReference() PX_OVERRIDE + { + mTm->decrReference(*this); + } + + /** \brief Return the ref-count for this task */ + virtual int32_t getReference() const PX_OVERRIDE + { + return mRefCount; + } + + /** + * \brief Manually increment this task's reference count. The task will + * not be allowed to run until removeReference() is called. + */ + virtual void addReference() PX_OVERRIDE + { + mTm->addReference(*this); + } + + /** + * \brief called by CpuDispatcher after run method has completed + * + * Decrements the continuation task's reference count, if specified. + */ + virtual void release() PX_OVERRIDE + { + if(mCont) + mCont->removeReference(); + } + +protected: + + PxBaseTask* mCont; //!< Continuation task, can be NULL + volatile int32_t mRefCount; //!< PxTask is dispatched when reaches 0 + + friend class PxTaskMgr; +}; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTaskManager.h b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTaskManager.h new file mode 100644 index 0000000..33af754 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/task/PxTaskManager.h @@ -0,0 +1,206 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_TASK_MANAGER_H +#define PX_TASK_MANAGER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxErrorCallback.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxBaseTask; +class PxTask; +class PxLightCpuTask; +typedef unsigned int PxTaskID; + +/** +\brief Identifies the type of each heavyweight PxTask object + +\note This enum type is only used by PxTask objects, PxLightCpuTasks do not use this enum. + +@see PxTask +@see PxLightCpuTask +*/ +struct PxTaskType +{ + /** + * \brief Identifies the type of each heavyweight PxTask object + */ + enum Enum + { + eCPU, //!< PxTask will be run on the CPU + eNOT_PRESENT, //!< Return code when attempting to find a task that does not exist + eCOMPLETED, //!< PxTask execution has been completed + TT_CPU PX_DEPRECATED = eCPU, + TT_NOT_PRESENT PX_DEPRECATED = eNOT_PRESENT, + TT_COMPLETED PX_DEPRECATED = eCOMPLETED + }; +}; + +class PxCpuDispatcher; + +/** + \brief The PxTaskManager interface + + A PxTaskManager instance holds references to user-provided dispatcher objects. When tasks are + submitted the PxTaskManager routes them to the appropriate dispatcher and handles task profiling if enabled. + Users should not implement the PxTaskManager interface, the SDK creates its own concrete PxTaskManager object + per-scene which users can configure by passing dispatcher objects into the PxSceneDesc. + + @see PxCpuDispatcher + +*/ +class PxTaskManager +{ +public: + + /** + \brief Set the user-provided dispatcher object for CPU tasks + + \param[in] ref The dispatcher object. + + @see PxCpuDispatcher + */ + virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0; + + /** + \brief Get the user-provided dispatcher object for CPU tasks + + \return The CPU dispatcher object. + + @see PxCpuDispatcher + */ + virtual PxCpuDispatcher* getCpuDispatcher() const = 0; + + /** + \brief Reset any dependencies between Tasks + + \note Will be called at the start of every frame before tasks are submitted. + + @see PxTask + */ + virtual void resetDependencies() = 0; + + /** + \brief Called by the owning scene to start the task graph. + + \note All tasks with ref count of 1 will be dispatched. + + @see PxTask + */ + virtual void startSimulation() = 0; + + /** + \brief Called by the owning scene at the end of a simulation step. + */ + virtual void stopSimulation() = 0; + + /** + \brief Called by the worker threads to inform the PxTaskManager that a task has completed processing. + + \param[in] task The task which has been completed + */ + virtual void taskCompleted(PxTask& task) = 0; + + /** + \brief Retrieve a task by name + + \param[in] name The unique name of a task + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID getNamedTask(const char* name) = 0; + + /** + \brief Submit a task with a unique name. + + \param[in] task The task to be executed + \param[in] name The unique name of a task + \param[in] type The type of the task (default eCPU) + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::eCPU) = 0; + + /** + \brief Submit an unnamed task. + + \param[in] task The task to be executed + \param[in] type The type of the task (default eCPU) + + \return The ID of the task with that name, or eNOT_PRESENT if not found + */ + virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::eCPU) = 0; + + /** + \brief Retrieve a task given a task ID + + \param[in] id The ID of the task to return, a valid ID must be passed or results are undefined + + \return The task associated with the ID + */ + virtual PxTask* getTaskFromID(PxTaskID id) = 0; + + /** + \brief Release the PxTaskManager object, referenced dispatchers will not be released + */ + virtual void release() = 0; + + /** + \brief Construct a new PxTaskManager instance with the given [optional] dispatchers + */ + static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = NULL); + +protected: + virtual ~PxTaskManager() {} + + /*! \cond PRIVATE */ + + virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0; + virtual void startAfter(PxTask& task, PxTaskID taskID) = 0; + + virtual void addReference(PxTaskID taskID) = 0; + virtual void decrReference(PxTaskID taskID) = 0; + virtual int32_t getReference(PxTaskID taskID) const = 0; + + virtual void decrReference(PxLightCpuTask&) = 0; + virtual void addReference(PxLightCpuTask&) = 0; + + /*! \endcond */ + + friend class PxBaseTask; + friend class PxTask; + friend class PxLightCpuTask; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleComponents.h new file mode 100644 index 0000000..1b2c381 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleComponents.h @@ -0,0 +1,1355 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_COMPONENTS_H +#define PX_VEHICLE_COMPONENTS_H + +#include "foundation/PxMemory.h" +#include "foundation/PxVec3.h" +#include "common/PxCoreUtilityTypes.h" +#include "vehicle/PxVehicleSDK.h" +#include "common/PxTypeInfo.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PX_DEPRECATED PxVehicleChassisData +{ +public: + + friend class PxVehicleDriveSimData4W; + + PxVehicleChassisData() + : mMOI(PxVec3(0,0,0)), + mMass(1500), + mCMOffset(PxVec3(0,0,0)) + { + } + + /** + \brief Moment of inertia of vehicle rigid body actor. + + \note Specified in kilograms metres-squared (kg m^2). + */ + PxVec3 mMOI; + + /** + \brief Mass of vehicle rigid body actor. + + \note Specified in kilograms (kg). + */ + PxReal mMass; + + /** + \brief Center of mass offset of vehicle rigid body actor. + + \note Specified in metres (m). + */ + PxVec3 mCMOffset; + +private: + + PxReal pad; + + bool isValid() const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleChassisData)& 0x0f)); + +class PX_DEPRECATED PxVehicleEngineData +{ +public: + + friend class PxVehicleDriveSimData; + + enum + { + eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES = 8 + }; + + PxVehicleEngineData() + : mMOI(1.0f), + mPeakTorque(500.0f), + mMaxOmega(600.0f), + mDampingRateFullThrottle(0.15f), + mDampingRateZeroThrottleClutchEngaged(2.0f), + mDampingRateZeroThrottleClutchDisengaged(0.35f) + { + mTorqueCurve.addPair(0.0f, 0.8f); + mTorqueCurve.addPair(0.33f, 1.0f); + mTorqueCurve.addPair(1.0f, 0.8f); + + mRecipMOI=1.0f/mMOI; + mRecipMaxOmega=1.0f/mMaxOmega; + } + + /** + \brief Graph of normalized torque (torque/mPeakTorque) against normalized engine speed ( engineRotationSpeed / mMaxOmega ). + + \note The normalized engine speed is the x-axis of the graph, while the normalized torque is the y-axis of the graph. + */ + PxFixedSizeLookupTable mTorqueCurve; + + /** + \brief Moment of inertia of the engine around the axis of rotation. + + \note Specified in kilograms metres-squared (kg m^2) + */ + PxReal mMOI; + + /** + \brief Maximum torque available to apply to the engine when the accelerator pedal is at maximum. + + \note The torque available is the value of the accelerator pedal (in range [0, 1]) multiplied by the normalized torque as computed from mTorqueCurve multiplied by mPeakTorque. + + \note Specified in kilograms metres-squared per second-squared (kg m^2 s^-2). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mPeakTorque; + + /** + \brief Maximum rotation speed of the engine. + + \note Specified in radians per second (s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxOmega; + + /** + \brief Damping rate of engine when full throttle is applied. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchEngaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchEngaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchDisengaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchDisengaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + \note Specified in kilograms metres-squared per second (kg m^2 s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mDampingRateFullThrottle; + + + /** + \brief Damping rate of engine when full throttle is applied. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchEngaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchEngaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchDisengaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchDisengaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + \note Specified in kilograms metres-squared per second (kg m^2 s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mDampingRateZeroThrottleClutchEngaged; + + /** + \brief Damping rate of engine when full throttle is applied. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchEngaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchEngaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between mDampingRateZeroThrottleClutchDisengaged and mDampingRateFullThrottle: + mDampingRateZeroThrottleClutchDisengaged + (mDampingRateFullThrottle-mDampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + \note Specified in kilograms metres-squared per second (kg m^2 s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mDampingRateZeroThrottleClutchDisengaged; + + /** + \brief Return value of mRecipMOI(=1.0f/mMOI) that is automatically set by PxVehicleDriveSimData::setEngineData + */ + PX_FORCE_INLINE PxReal getRecipMOI() const {return mRecipMOI;} + + /** + \brief Return value of mRecipMaxOmega( = 1.0f / mMaxOmega ) that is automatically set by PxVehicleDriveSimData::setEngineData + */ + PX_FORCE_INLINE PxReal getRecipMaxOmega() const {return mRecipMaxOmega;} + +private: + + /** + \brief Reciprocal of the engine moment of inertia. + + \note Not necessary to set this value because it is set by PxVehicleDriveSimData::setEngineData + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRecipMOI; + + /** + \brief Reciprocal of the maximum rotation speed of the engine. + + \note Not necessary to set this value because it is set by PxVehicleDriveSimData::setEngineData + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRecipMaxOmega; + + bool isValid() const; + + +//serialization +public: + PxVehicleEngineData(const PxEMPTY) : mTorqueCurve(PxEmpty) {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleEngineData)& 0x0f)); + +class PX_DEPRECATED PxVehicleGearsData +{ +public: + + friend class PxVehicleDriveSimData; + + enum Enum + { + eREVERSE=0, + eNEUTRAL, + eFIRST, + eSECOND, + eTHIRD, + eFOURTH, + eFIFTH, + eSIXTH, + eSEVENTH, + eEIGHTH, + eNINTH, + eTENTH, + eELEVENTH, + eTWELFTH, + eTHIRTEENTH, + eFOURTEENTH, + eFIFTEENTH, + eSIXTEENTH, + eSEVENTEENTH, + eEIGHTEENTH, + eNINETEENTH, + eTWENTIETH, + eTWENTYFIRST, + eTWENTYSECOND, + eTWENTYTHIRD, + eTWENTYFOURTH, + eTWENTYFIFTH, + eTWENTYSIXTH, + eTWENTYSEVENTH, + eTWENTYEIGHTH, + eTWENTYNINTH, + eTHIRTIETH, + eGEARSRATIO_COUNT + }; + + PxVehicleGearsData() + : mFinalRatio(4.0f), + mNbRatios(7), + mSwitchTime(0.5f) + { + mRatios[PxVehicleGearsData::eREVERSE]=-4.0f; + mRatios[PxVehicleGearsData::eNEUTRAL]=0.0f; + mRatios[PxVehicleGearsData::eFIRST]=4.0f; + mRatios[PxVehicleGearsData::eSECOND]=2.0f; + mRatios[PxVehicleGearsData::eTHIRD]=1.5f; + mRatios[PxVehicleGearsData::eFOURTH]=1.1f; + mRatios[PxVehicleGearsData::eFIFTH]=1.0f; + + for(PxU32 i = PxVehicleGearsData::eSIXTH; i < PxVehicleGearsData::eGEARSRATIO_COUNT; ++i) + mRatios[i]=0.f; + } + + /** + \brief Gear ratios + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRatios[PxVehicleGearsData::eGEARSRATIO_COUNT]; + + /** + \brief Gear ratio applied is mRatios[currentGear]*finalRatio + + Range: [0, PX_MAX_F32)
+ */ + PxReal mFinalRatio; + + /** + \brief Number of gears (including reverse and neutral). + + Range: (0, MAX_NB_GEAR_RATIOS)
+ */ + PxU32 mNbRatios; + + /** + \brief Time it takes to switch gear. + + \note Specified in seconds (s). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mSwitchTime; + +private: + + PxReal mPad; + + bool isValid() const; + +//serialization +public: + PxVehicleGearsData(const PxEMPTY) {} + PxReal getGearRatio(PxVehicleGearsData::Enum a) const {return mRatios[a];} + void setGearRatio(PxVehicleGearsData::Enum a, PxReal ratio) { mRatios[a] = ratio;} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleGearsData)& 0x0f)); + +class PX_DEPRECATED PxVehicleAutoBoxData +{ +public: + + friend class PxVehicleDriveSimData; + + PxVehicleAutoBoxData() + { + for(PxU32 i=0;i mUpRatios[currentGear] the autobox will begin + a transition to currentGear+1 unless currentGear is the highest possible gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal mUpRatios[PxVehicleGearsData::eGEARSRATIO_COUNT]; + + /** + \brief Value of engineRevs/maxEngineRevs that is low enough to decrement gear. + + \note When ( engineRotationSpeed / PxVehicleEngineData::mMaxOmega ) < mDownRatios[currentGear] the autobox will begin + a transition to currentGear-1 unless currentGear is first gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal mDownRatios[PxVehicleGearsData::eGEARSRATIO_COUNT]; + + /** + \brief Set the latency time of the autobox. + + \note Latency time is the minimum time that must pass between each gear change that is initiated by the autobox. + The auto-box will only attempt to initiate another gear change up or down if the simulation time that has passed since the most recent + automated gear change is greater than the specified latency. + + \note Specified in seconds (s). + + @see getLatency + */ + void setLatency(const PxReal latency) + { + mDownRatios[PxVehicleGearsData::eREVERSE]=latency; + } + + /** + \brief Get the latency time of the autobox. + + \note Specified in seconds (s). + + @see setLatency + */ + PxReal getLatency() const + { + return mDownRatios[PxVehicleGearsData::eREVERSE]; + } + +private: + bool isValid() const; + +//serialization +public: + PxVehicleAutoBoxData(const PxEMPTY) {} + + PxReal getUpRatios(PxVehicleGearsData::Enum a) const {return mUpRatios[a];} + void setUpRatios(PxVehicleGearsData::Enum a, PxReal ratio) { mUpRatios[a] = ratio;} + + PxReal getDownRatios(PxVehicleGearsData::Enum a) const {return mDownRatios[a];} + void setDownRatios(PxVehicleGearsData::Enum a, PxReal ratio) { mDownRatios[a] = ratio;} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleAutoBoxData)& 0x0f)); + +class PX_DEPRECATED PxVehicleDifferential4WData +{ +public: + + friend class PxVehicleDriveSimData4W; + + enum Enum + { + eDIFF_TYPE_LS_4WD, //limited slip differential for car with 4 driven wheels + eDIFF_TYPE_LS_FRONTWD, //limited slip differential for car with front-wheel drive + eDIFF_TYPE_LS_REARWD, //limited slip differential for car with rear-wheel drive + eDIFF_TYPE_OPEN_4WD, //open differential for car with 4 driven wheels + eDIFF_TYPE_OPEN_FRONTWD, //open differential for car with front-wheel drive + eDIFF_TYPE_OPEN_REARWD, //open differential for car with rear-wheel drive + eMAX_NB_DIFF_TYPES + }; + + PxVehicleDifferential4WData() + : mFrontRearSplit(0.45f), + mFrontLeftRightSplit(0.5f), + mRearLeftRightSplit(0.5f), + mCentreBias(1.3f), + mFrontBias(1.3f), + mRearBias(1.3f), + mType(PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD) + { + } + + /** + \brief Ratio of torque split between front and rear (>0.5 means more to front, <0.5 means more to rear). + + \note Only applied to DIFF_TYPE_LS_4WD and eDIFF_TYPE_OPEN_4WD + + Range: [0, 1]
+ */ + PxReal mFrontRearSplit; + + /** + \brief Ratio of torque split between front-left and front-right (>0.5 means more to front-left, <0.5 means more to front-right). + + \note Only applied to DIFF_TYPE_LS_4WD and eDIFF_TYPE_OPEN_4WD and eDIFF_TYPE_LS_FRONTWD + + Range: [0, 1]
+ */ + PxReal mFrontLeftRightSplit; + + /** + \brief Ratio of torque split between rear-left and rear-right (>0.5 means more to rear-left, <0.5 means more to rear-right). + + \note Only applied to DIFF_TYPE_LS_4WD and eDIFF_TYPE_OPEN_4WD and eDIFF_TYPE_LS_REARWD + + Range: [0, 1]
+ */ + PxReal mRearLeftRightSplit; + + /** + \brief Maximum allowed ratio of average front wheel rotation speed and rear wheel rotation speeds + The differential will divert more torque to the slower wheels when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD + + Range: [1, PX_MAX_F32)
+ */ + PxReal mCentreBias; + + /** + \brief Maximum allowed ratio of front-left and front-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_FRONTWD + + Range: [1, PX_MAX_F32)
+ */ + PxReal mFrontBias; + + /** + \brief Maximum allowed ratio of rear-left and rear-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_REARWD + + Range: [1, PX_MAX_F32)
+ */ + PxReal mRearBias; + + /** + \brief Type of differential. + + Range: [DIFF_TYPE_LS_4WD, DIFF_TYPE_OPEN_FRONTWD]
+ */ + PxVehicleDifferential4WData::Enum mType; + +private: + + PxReal mPad[1]; + + bool isValid() const; + +//serialization +public: + PxVehicleDifferential4WData(const PxEMPTY) {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDifferential4WData)& 0x0f)); + +class PX_DEPRECATED PxVehicleDifferentialNWData +{ +public: + + friend class PxVehicleDriveSimDataNW; + friend class PxVehicleUpdate; + + PxVehicleDifferentialNWData() + { + PxMemSet(mBitmapBuffer, 0, sizeof(PxU32) * (((PX_MAX_NB_WHEELS + 31) & ~31) >> 5)); + mNbDrivenWheels=0; + mInvNbDrivenWheels=0.0f; + } + + /** + \brief Set a specific wheel to be driven or non-driven by the differential. + + \note The available drive torque will be split equally between all driven wheels. + Zero torque will be applied to non-driven wheels. + The default state of each wheel is to be uncoupled to the differential. + */ + void setDrivenWheel(const PxU32 wheelId, const bool drivenState); + + /** + \brief Test if a specific wheel has been configured as a driven or non-driven wheel. + */ + bool getIsDrivenWheel(const PxU32 wheelId) const; + +private: + + PxU32 mBitmapBuffer[((PX_MAX_NB_WHEELS + 31) & ~31) >> 5]; + PxU32 mNbDrivenWheels; + PxReal mInvNbDrivenWheels; + PxU32 mPad; + + bool isValid() const; + +//serialization +public: + PxVehicleDifferentialNWData(const PxEMPTY) {} + PxU32 getDrivenWheelStatus() const; + void setDrivenWheelStatus(PxU32 status); +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDifferentialNWData)& 0x0f)); + + +class PX_DEPRECATED PxVehicleAckermannGeometryData +{ +public: + + friend class PxVehicleDriveSimData4W; + + PxVehicleAckermannGeometryData() + : mAccuracy(1.0f), + mFrontWidth(0.0f), //Must be filled out + mRearWidth(0.0f), //Must be filled out + mAxleSeparation(0.0f) //Must be filled out + { + } + + /** + \brief Accuracy of Ackermann steer calculation. + + \note Accuracy with value 0.0 results in no Ackermann steer-correction, while + accuracy with value 1.0 results in perfect Ackermann steer-correction. + + \note Perfect Ackermann steer correction modifies the steer angles applied to the front-left and + front-right wheels so that the perpendiculars to the wheels' longitudinal directions cross the + extended vector of the rear axle at the same point. It is also applied to any steer angle applied + to the rear wheels but instead using the extended vector of the front axle. + + \note In general, more steer correction produces better cornering behavior. + + Range: [0, 1]
+ */ + PxReal mAccuracy; + + /** + \brief Distance between center-point of the two front wheels. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mFrontWidth; + + /** + \brief Distance between center-point of the two rear wheels. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRearWidth; + + /** + \brief Distance between center of front axle and center of rear axle. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mAxleSeparation; + +private: + + bool isValid() const; + +//serialization +public: + PxVehicleAckermannGeometryData(const PxEMPTY) {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleAckermannGeometryData)& 0x0f)); + +/** +\brief Choose between a potentially more expensive but more accurate solution to the clutch model or a potentially cheaper but less accurate solution. +@see PxVehicleClutchData +*/ +struct PX_DEPRECATED PxVehicleClutchAccuracyMode +{ + enum Enum + { + eESTIMATE = 0, + eBEST_POSSIBLE + }; +}; + +class PX_DEPRECATED PxVehicleClutchData +{ +public: + + friend class PxVehicleDriveSimData; + + PxVehicleClutchData() + : mStrength(10.0f), + mAccuracyMode(PxVehicleClutchAccuracyMode::eBEST_POSSIBLE), + mEstimateIterations(5) + { + } + + /** + \brief Strength of clutch. + + \note The clutch is the mechanism that couples the engine to the wheels. + A stronger clutch more strongly couples the engine to the wheels, while a + clutch of strength zero completely decouples the engine from the wheels. + Stronger clutches more quickly bring the wheels and engine into equilibrium, while weaker + clutches take longer, resulting in periods of clutch slip and delays in power transmission + from the engine to the wheels. + The torque generated by the clutch is proportional to the clutch strength and + the velocity difference between the engine's rotational speed and the rotational speed of the + driven wheels after accounting for the gear ratio. + The torque at the clutch is applied negatively to the engine and positively to the driven wheels. + + \note Specified in kilograms metres-squared per second (kg m^2 s^-1) + + Range: [0,PX_MAX_F32)
+ */ + PxReal mStrength; + + /** + \brief The engine and wheel rotation speeds that are coupled through the clutch can be updated by choosing + one of two modes: eESTIMATE and eBEST_POSSIBLE. + + \note If eESTIMATE is chosen the vehicle sdk will update the wheel and engine rotation speeds + with estimated values to the implemented clutch model. + + \note If eBEST_POSSIBLE is chosen the vehicle sdk will compute the best possible + solution (within floating point tolerance) to the implemented clutch model. + This is the recommended mode. + + \note The clutch model remains the same if either eESTIMATE or eBEST_POSSIBLE is chosen but the accuracy and + computational cost of the solution to the model can be tuned as required. + */ + PxVehicleClutchAccuracyMode::Enum mAccuracyMode; + + /** + \brief Tune the mathematical accuracy and computational cost of the computed estimate to the wheel and + engine rotation speeds if eESTIMATE is chosen. + + \note As mEstimateIterations increases the computational cost of the clutch also increases and the solution + approaches the solution that would be computed if eBEST_POSSIBLE was chosen instead. + + \note This has no effect if eBEST_POSSIBLE is chosen as the accuracy mode. + + \note A value of zero is not allowed if eESTIMATE is chosen as the accuracy mode. + */ + PxU32 mEstimateIterations; + +private: + + PxU8 mPad[4]; + + bool isValid() const; + +//serialization +public: + PxVehicleClutchData(const PxEMPTY) {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleClutchData)& 0x0f)); + + +/** +\brief Tire load variation can be strongly dependent on the time-step so it is a good idea to filter it +to give less jerky handling behavior. + +\note The x-axis of the graph is normalized tire load, while the y-axis is the filtered normalized tire load. + +\note The normalized load is the force acting downwards on the tire divided by the force experienced by the tire when the car is at rest on the ground. + +\note The rest load is approximately the product of the value of gravitational acceleration and PxVehicleSuspensionData::mSprungMass. + +\note The minimum possible normalized load is zero. + +\note There are two points on the graph: (mMinNormalisedLoad, mMinNormalisedFilteredLoad) and (mMaxNormalisedLoad, mMaxFilteredNormalisedLoad). + +\note Normalized loads less than mMinNormalisedLoad have filtered normalized load = mMinNormalisedFilteredLoad. + +\note Normalized loads greater than mMaxNormalisedLoad have filtered normalized load = mMaxFilteredNormalisedLoad. + +\note Normalized loads in-between are linearly interpolated between mMinNormalisedFilteredLoad and mMaxFilteredNormalisedLoad. + +\note The tire load applied as input to the tire force computation is the filtered normalized load multiplied by the rest load. +*/ +class PX_DEPRECATED PxVehicleTireLoadFilterData +{ +public: + + friend class PxVehicleWheelsSimData; + + PxVehicleTireLoadFilterData() + : mMinNormalisedLoad(0), + mMinFilteredNormalisedLoad(0.2308f), + mMaxNormalisedLoad(3.0f), + mMaxFilteredNormalisedLoad(3.0f) + { + mDenominator=1.0f/(mMaxNormalisedLoad - mMinNormalisedLoad); + } + + /** + \brief Graph point (mMinNormalisedLoad,mMinFilteredNormalisedLoad) + */ + PxReal mMinNormalisedLoad; + + /** + \brief Graph point (mMinNormalisedLoad,mMinFilteredNormalisedLoad) + */ + PxReal mMinFilteredNormalisedLoad; + + /** + \brief Graph point (mMaxNormalisedLoad,mMaxFilteredNormalisedLoad) + */ + PxReal mMaxNormalisedLoad; + + /** + \brief Graph point (mMaxNormalisedLoad,mMaxFilteredNormalisedLoad) + */ + PxReal mMaxFilteredNormalisedLoad; + + PX_FORCE_INLINE PxReal getDenominator() const {return mDenominator;} + +private: + + /** + \brief Not necessary to set this value. + */ + //1.0f/(mMaxNormalisedLoad-mMinNormalisedLoad) for quick calculations + PxReal mDenominator; + + PxU32 mPad[3]; + + bool isValid() const; + +//serialization +public: + PxVehicleTireLoadFilterData(const PxEMPTY) {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTireLoadFilterData)& 0x0f)); + +class PX_DEPRECATED PxVehicleWheelData +{ +public: + + friend class PxVehicleWheels4SimData; + + PxVehicleWheelData() + : mRadius(0.0f), //Must be filled out + mWidth(0.0f), + mMass(20.0f), + mMOI(0.0f), //Must be filled out + mDampingRate(0.25f), + mMaxBrakeTorque(1500.0f), + mMaxHandBrakeTorque(0.0f), + mMaxSteer(0.0f), + mToeAngle(0.0f), + mRecipRadius(0.0f), //Must be filled out + mRecipMOI(0.0f) //Must be filled out + { + } + + /** + \brief Radius of unit that includes metal wheel plus rubber tire. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRadius; + + /** + \brief Maximum width of unit that includes wheel plus tire. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mWidth; + + /** + \brief Mass of unit that includes wheel plus tire. + + \note Specified in kilograms (kg). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMass; + + /** + \brief Moment of inertia of unit that includes wheel plus tire about the rolling axis. + + \note Specified in kilograms metres-squared (kg m^2). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMOI; + + /** + \brief Damping rate applied to wheel. + + \note Specified in kilograms metres-squared per second (kg m^2 s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mDampingRate; + + /** + \brief Max brake torque that can be applied to wheel. + + \note Specified in kilograms metres-squared per second-squared (kg m^2 s^-2) + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxBrakeTorque; + + /** + \brief Max handbrake torque that can be applied to wheel. + + \note Specified in kilograms metres-squared per second-squared (kg m^2 s^-2) + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxHandBrakeTorque; + + /** + \brief Max steer angle that can be achieved by the wheel. + + \note Specified in radians. + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxSteer; + + /** + \brief Wheel toe angle. This value is ignored by PxVehicleDriveTank and PxVehicleNoDrive. + + \note Specified in radians. + + Range: [0, Pi/2]
+ */ + PxReal mToeAngle;//in radians + + /** + \brief Return value equal to 1.0f/mRadius + + @see PxVehicleWheelsSimData::setWheelData + */ + PX_FORCE_INLINE PxReal getRecipRadius() const {return mRecipRadius;} + + /** + \brief Return value equal to 1.0f/mRecipMOI + + @see PxVehicleWheelsSimData::setWheelData + */ + PX_FORCE_INLINE PxReal getRecipMOI() const {return mRecipMOI;} + +private: + + /** + \brief Reciprocal of radius of unit that includes metal wheel plus rubber tire. + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setWheelData + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRecipRadius; + + /** + \brief Reciprocal of moment of inertia of unit that includes wheel plus tire about single allowed axis of rotation. + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setWheelData + + Range: [0, PX_MAX_F32)
+ */ + PxReal mRecipMOI; + + PxReal mPad[1]; + + bool isValid() const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheelData)& 0x0f)); + +class PX_DEPRECATED PxVehicleSuspensionData +{ +public: + + friend class PxVehicleWheels4SimData; + + PxVehicleSuspensionData() + : mSpringStrength(0.0f), + mSpringDamperRate(0.0f), + mMaxCompression(0.3f), + mMaxDroop(0.1f), + mSprungMass(0.0f), + mCamberAtRest(0.0f), + mCamberAtMaxCompression(0.0f), + mCamberAtMaxDroop(0.0f), + mRecipMaxCompression(1.0f), + mRecipMaxDroop(1.0f) + { + } + + /** + \brief Spring strength of suspension unit. + + \note Specified in kilograms per second-squared (kg s^-2). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mSpringStrength; + + /** + \brief Spring damper rate of suspension unit. + + \note Specified in kilograms per second (kg s^-1). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mSpringDamperRate; + + /** + \brief Maximum compression allowed by suspension spring. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxCompression; + + /** + \brief Maximum elongation allowed by suspension spring. + + \note Specified in metres (m). + + Range: [0, PX_MAX_F32)
+ */ + PxReal mMaxDroop; + + /** + \brief Mass of vehicle that is supported by suspension spring. + + \note Specified in kilograms (kg). + + \note Each suspension is guaranteed to generate an upwards force of |gravity|*mSprungMass along the suspension direction when the wheel is perfectly + at rest and sitting at the rest pose defined by the wheel centre offset. + + \note The sum of the sprung masses of all suspensions of a vehicle should match the mass of the PxRigidDynamic associated with the vehicle. + When this condition is satisfied for a vehicle on a horizontal plane the wheels of the vehicle are guaranteed to sit at the rest pose + defined by the wheel centre offset. For special cases, where this condition can not be met easily, the flag + #PxVehicleWheelsSimFlag::eDISABLE_SPRUNG_MASS_SUM_CHECK allows to provide sprung mass values that do not sum up to the mass of the PxRigidDynamic. + + \note As the wheel compresses or elongates along the suspension direction the force generated by the spring is + F = |gravity|*mSprungMass + deltaX*mSpringStrength + deltaXDot*mSpringDamperRate + where deltaX is the deviation from the defined rest pose and deltaXDot is the velocity of the sprung mass along the suspension direction. + In practice, deltaXDot is computed by comparing the current and previous deviation from the rest pose and dividing the difference + by the simulation timestep. + + \note If a single suspension spring is hanging in the air and generates zero force the remaining springs of the vehicle will necessarily + sit in a compressed configuration. In summary, the sum of the remaining suspension forces cannot balance the downwards gravitational force + acting on the vehicle without extra force arising from the deltaX*mSpringStrength force term. + + \note Theoretically, a suspension spring should generate zero force at maximum elongation and increase linearly as the suspension approaches the rest pose. + PxVehicleSuspensionData will only enforce this physical law if the spring is configured so that |gravity|*mSprungMass == mMaxDroop*mSpringStrength. + To help decouple vehicle handling from visual wheel positioning this condition is not enforced. + In practice, the value of |gravity|*mSprungMass + deltaX*mSpringStrength is clamped at zero to ensure it never falls negative. + + @see PxVehicleComputeSprungMasses, PxVehicleWheelsSimData::setWheelCentreOffset, PxVehicleSuspensionData::mSpringStrength, PxVehicleSuspensionData::mSpringDamperRate, PxVehicleSuspensionData::mMaxDroop + + Range: [0, PX_MAX_F32)
+ */ + PxReal mSprungMass; + + /** + \brief Camber angle (in radians) of wheel when the suspension is at its rest position. + + \note Specified in radians. + + Range: [-pi/2, pi/2]
+ + */ + PxReal mCamberAtRest; + + /** + \brief Camber angle (in radians) of wheel when the suspension is at maximum compression. + + \note For compressed suspensions the camber angle is a linear interpolation of + mCamberAngleAtRest and mCamberAtMaxCompression + + \note Specified in radians. + + Range: [-pi/2, pi/2]
+ */ + PxReal mCamberAtMaxCompression; + + /** + \brief Camber angle (in radians) of wheel when the suspension is at maximum droop. + + \note For extended suspensions the camber angle is linearly interpolation of + mCamberAngleAtRest and mCamberAtMaxDroop + + \note Specified in radians. + + Range: [-pi/2, pi/2]
+ */ + PxReal mCamberAtMaxDroop; + + /** + \brief Reciprocal of maximum compression. + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setSuspensionData + + Range: [0, PX_MAX_F32)
+ */ + PX_FORCE_INLINE PxReal getRecipMaxCompression() const {return mRecipMaxCompression;} + + /** + \brief Reciprocal of maximum droop. + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setSuspensionData + + Range: [0, PX_MAX_F32)
+ */ + PX_FORCE_INLINE PxReal getRecipMaxDroop() const {return mRecipMaxDroop;} + + /** + \brief Set a new sprung mass for the suspension and modify the spring strength so that the natural frequency + of the spring is preserved. + \param[in] newSprungMass is the new mass that the suspension spring will support. + */ + void setMassAndPreserveNaturalFrequency(const PxReal newSprungMass) + { + const PxF32 oldStrength = mSpringStrength; + const PxF32 oldSprungMass = mSprungMass; + const PxF32 newStrength = oldStrength * (newSprungMass / oldSprungMass); + mSpringStrength = newStrength; + mSprungMass = newSprungMass; + } + +private: + + /** + \brief Cached value of 1.0f/mMaxCompression + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setSuspensionData + */ + PxReal mRecipMaxCompression; + + /** + \brief Cached value of 1.0f/mMaxDroop + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setSuspensionData + */ + PxReal mRecipMaxDroop; + + //padding + PxReal mPad[2]; + + bool isValid() const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleSuspensionData)& 0x0f)); + +class PX_DEPRECATED PxVehicleAntiRollBarData +{ +public: + + friend class PxVehicleWheelsSimData; + + PxVehicleAntiRollBarData() + : mWheel0(0xffffffff), + mWheel1(0xffffffff), + mStiffness(0.0f) + { + } + + /* + \brief The anti-roll bar connects two wheels with indices mWheel0 and mWheel1 + */ + PxU32 mWheel0; + + /* + \brief The anti-roll bar connects two wheels with indices mWheel0 and mWheel1 + */ + PxU32 mWheel1; + + /* + \brief The stiffness of the anti-roll bar. + + \note Specified in kilograms per second-squared (kg s^-2). + + Range: [0, PX_MAX_F32)
+ */ + PxF32 mStiffness; + +private: + + PxF32 mPad[1]; + + bool isValid() const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleAntiRollBarData)& 0x0f)); + +class PX_DEPRECATED PxVehicleTireData +{ +public: + friend class PxVehicleWheels4SimData; + + PxVehicleTireData() + : mLatStiffX(2.0f), + mLatStiffY(0.3125f*(180.0f / PxPi)), + mLongitudinalStiffnessPerUnitGravity(1000.0f), + mCamberStiffnessPerUnitGravity(0.1f*(180.0f / PxPi)), + mType(0) + { + mFrictionVsSlipGraph[0][0]=0.0f; + mFrictionVsSlipGraph[0][1]=1.0f; + mFrictionVsSlipGraph[1][0]=0.1f; + mFrictionVsSlipGraph[1][1]=1.0f; + mFrictionVsSlipGraph[2][0]=1.0f; + mFrictionVsSlipGraph[2][1]=1.0f; + + mRecipLongitudinalStiffnessPerUnitGravity=1.0f/mLongitudinalStiffnessPerUnitGravity; + + mFrictionVsSlipGraphRecipx1Minusx0=1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0]); + mFrictionVsSlipGraphRecipx2Minusx1=1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0]); + } + + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. mLatStiffX describes the minimum normalized load (load/restLoad) that gives a + flat lateral stiffness response to load. + + Range: [0, PX_MAX_F32)
+ */ + PxReal mLatStiffX; + + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. mLatStiffY describes the maximum possible value of lateralStiffness/restLoad that occurs + when (load/restLoad)>= mLatStiffX. + + \note If load/restLoad is greater than mLatStiffX then the lateral stiffness is mLatStiffY*restLoad. + + \note If load/restLoad is less than mLatStiffX then the lateral stiffness is mLastStiffY*(load/mLatStiffX) + + \note Lateral force can be approximated as lateralStiffness * lateralSlip. + + \note Specified in per radian. + + Range: [0, PX_MAX_F32)
+ */ + PxReal mLatStiffY; + + /** + \brief Tire Longitudinal stiffness per unit gravitational acceleration. + + \note Longitudinal stiffness of the tire is calculated as gravitationalAcceleration*mLongitudinalStiffnessPerUnitGravity. + + \note Longitudinal force can be approximated as gravitationalAcceleration*mLongitudinalStiffnessPerUnitGravity*longitudinalSlip. + + \note Specified in kilograms per radian. + + Range: [0, PX_MAX_F32)
+ */ + PxReal mLongitudinalStiffnessPerUnitGravity; + + /** + \brief tire Tire camber stiffness per unity gravitational acceleration. + + \note Camber stiffness of the tire is calculated as gravitationalAcceleration*mCamberStiffnessPerUnitGravity + + \note Camber force can be approximated as gravitationalAcceleration*mCamberStiffnessPerUnitGravity*camberAngle. + + \note Specified in kilograms per radian. + + Range: [0, PX_MAX_F32)
+ */ + PxReal mCamberStiffnessPerUnitGravity; + + /** + \brief Graph of friction vs longitudinal slip with 3 points. + + \note mFrictionVsSlipGraph[0][0] is always zero. + + \note mFrictionVsSlipGraph[0][1] is the friction available at zero longitudinal slip. + + \note mFrictionVsSlipGraph[1][0] is the value of longitudinal slip with maximum friction. + + \note mFrictionVsSlipGraph[1][1] is the maximum friction. + + \note mFrictionVsSlipGraph[2][0] is the end point of the graph. + + \note mFrictionVsSlipGraph[2][1] is the value of friction for slips greater than mFrictionVsSlipGraph[2][0]. + + \note The friction value computed from the friction vs longitudinal slip graph is used to scale the friction + value for the combination of material and tire type (PxVehicleDrivableSurfaceToTireFrictionPairs). + + \note mFrictionVsSlipGraph[2][0] > mFrictionVsSlipGraph[1][0] > mFrictionVsSlipGraph[0][0] + + \note mFrictionVsSlipGraph[1][1] is typically greater than mFrictionVsSlipGraph[0][1] + + \note mFrictionVsSlipGraph[2][1] is typically smaller than mFrictionVsSlipGraph[1][1] + + \note longitudinal slips > mFrictionVsSlipGraph[2][0] use friction multiplier mFrictionVsSlipGraph[2][1] + + \note The final friction value used by the tire model is the value returned by PxVehicleDrivableSurfaceToTireFrictionPairs + multiplied by the value computed from mFrictionVsSlipGraph. + + @see PxVehicleDrivableSurfaceToTireFrictionPairs, PxVehicleComputeTireForce + + Range: [0, PX_MAX_F32)
+ */ + PxReal mFrictionVsSlipGraph[3][2]; + + /** + \brief Tire type denoting slicks, wets, snow, winter, summer, all-terrain, mud etc. + + @see PxVehicleDrivableSurfaceToTireFrictionPairs + + Range: [0, PX_MAX_F32)
+ */ + PxU32 mType; + + /** + \brief Return Cached value of 1.0/mLongitudinalStiffnessPerUnitGravity + + @see PxVehicleWheelsSimData::setTireData + */ + PX_FORCE_INLINE PxReal getRecipLongitudinalStiffnessPerUnitGravity() const {return mRecipLongitudinalStiffnessPerUnitGravity;} + + /** + \brief Return Cached value of 1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0]) + + @see PxVehicleWheelsSimData::setTireData + */ + PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx1Minusx0() const {return mFrictionVsSlipGraphRecipx1Minusx0;} + + /** + \brief Return Cached value of 1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0]) + + @see PxVehicleWheelsSimData::setTireData + */ + PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx2Minusx1() const {return mFrictionVsSlipGraphRecipx2Minusx1;} + +private: + + /** + \brief Cached value of 1.0/mLongitudinalStiffnessPerUnitGravity. + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setTireData + + @see PxVehicleWheelsSimData::setTireData + */ + PxReal mRecipLongitudinalStiffnessPerUnitGravity; + + /** + \brief Cached value of 1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0]) + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setTireData + + @see PxVehicleWheelsSimData::setTireData + */ + PxReal mFrictionVsSlipGraphRecipx1Minusx0; + + /** + \brief Cached value of 1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0]) + + \note Not necessary to set this value because it is set by PxVehicleWheelsSimData::setTireData + + @see PxVehicleWheelsSimData::setTireData + */ + PxReal mFrictionVsSlipGraphRecipx2Minusx1; + + PxReal mPad[2]; + + bool isValid() const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTireData)& 0x0f)); +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive.h new file mode 100644 index 0000000..57be28f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive.h @@ -0,0 +1,560 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_DRIVE_H +#define PX_VEHICLE_DRIVE_H + +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleComponents.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxFilterData; +class PxGeometry; +class PxPhysics; +class PxVehicleDrivableSurfaceToTireFrictionPairs; +class PxShape; +class PxMaterial; +class PxRigidDynamic; + +/** +\brief Data structure describing non-wheel configuration data of a vehicle that has engine, gears, clutch, and auto-box. +@see PxVehicleWheelsSimData for wheels configuration data. +*/ +class PX_DEPRECATED PxVehicleDriveSimData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleDriveTank; + + /** + \brief Return the engine data + */ + PX_FORCE_INLINE const PxVehicleEngineData& getEngineData() const + { + return mEngine; + } + + /** + \brief Set the engine data + \param[in] engine - the data stored in engine is copied to the vehicle's engine. + */ + void setEngineData(const PxVehicleEngineData& engine); + + /** + \brief Return the gears data + */ + PX_FORCE_INLINE const PxVehicleGearsData& getGearsData() const + { + return mGears; + } + + /** + \brief Set the gears data + \param[in] gears - the data stored in gears is copied to the vehicle's gears. + */ + void setGearsData(const PxVehicleGearsData& gears); + + /** + \brief Return the clutch data + */ + PX_FORCE_INLINE const PxVehicleClutchData& getClutchData() const + { + return mClutch; + } + + /** + \brief Set the clutch data + \param[in] clutch - the data stored in clutch is copied to the vehicle's clutch. + */ + void setClutchData(const PxVehicleClutchData& clutch); + + /** + \brief Return the autobox data + */ + PX_FORCE_INLINE const PxVehicleAutoBoxData& getAutoBoxData() const + { + return mAutoBox; + } + + /** + \brief Set the autobox data + \param[in] autobox - the data stored in autobox is copied to the vehicle's autobox. + */ + void setAutoBoxData(const PxVehicleAutoBoxData& autobox); + +protected: + /* + \brief Engine simulation data + @see setEngineData, getEngineData + */ + PxVehicleEngineData mEngine; + + /* + \brief Gear simulation data + @see setGearsData, getGearsData + */ + PxVehicleGearsData mGears; + + /* + \brief Clutch simulation data + @see setClutchData, getClutchData + */ + PxVehicleClutchData mClutch; + + /* + \brief Autobox simulation data + @see setAutoboxData, getAutoboxData + */ + PxVehicleAutoBoxData mAutoBox; + + /** + \brief Test that a PxVehicleDriveSimData instance has been configured with legal data. + Call only after setting all components with setEngineData,setGearsData,setClutchData,setAutoBoxData + @see PxVehicleDrive4W::setup, PxVehicleDriveTank::setup + */ + bool isValid() const; + + +//serialization +public: + PxVehicleDriveSimData() {} + PxVehicleDriveSimData(const PxEMPTY) : mEngine(PxEmpty), mGears(PxEmpty), mClutch(PxEmpty), mAutoBox(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimData) & 15)); + + +/** +\brief Data structure with instanced dynamics data for vehicle with engine, clutch, gears, autobox +@see PxVehicleWheelsDynData for wheels dynamics data. +*/ +class PX_DEPRECATED PxVehicleDriveDynData +{ +public: + + enum + { + eMAX_NB_ANALOG_INPUTS=16 + }; + + friend class PxVehicleDrive; + + /** + \brief Set all dynamics data to zero to bring the vehicle to rest. + */ + void setToRestState(); + + /** + \brief Set an analog control value to drive the vehicle. + \param[in] type describes the type of analog control being modified + \param[in] analogVal is the new value of the specific analog control. + @see PxVehicleDrive4WControl, PxVehicleDriveNWControl, PxVehicleDriveTankControl + */ + void setAnalogInput(const PxU32 type, const PxReal analogVal); + + /** + \brief Get the analog control value that has been applied to the vehicle. + \return The value of the specified analog control value. + @see PxVehicleDrive4WControl, PxVehicleDriveNWControl, PxVehicleDriveTankControl + */ + PxReal getAnalogInput(const PxU32 type) const; + + /** + \brief Inform the vehicle that the gear-up button has been pressed. + + \param[in] digitalVal is the state of the gear-up button. + + \note If digitalVal is true the vehicle will attempt to initiate a gear change at the next call to PxVehicleUpdates. + + \note The value of mGearUpPressed is not reset by PxVehicleUpdates + */ + void setGearUp(const bool digitalVal) + { + mGearUpPressed = digitalVal; + } + + /** + \brief Set that the gear-down button has been pressed. + + \param[in] digitalVal is the state of the gear-down button. + + \note If digitalVal is true the vehicle will attempt to initiate a gear change at the next call to PxVehicleUpdates. + + \note The value of mGearDownPressed is not reset by PxVehicleUpdates + */ + void setGearDown(const bool digitalVal) + { + mGearDownPressed = digitalVal; + } + + /** + \brief Check if the gear-up button has been pressed + \return The state of the gear-up button. + */ + bool getGearUp() const + { + return mGearUpPressed; + } + + /** + \brief Check if the gear-down button has been pressed + \return The state of the gear-down button. + */ + bool getGearDown() const + { + return mGearDownPressed; + } + + /** + \brief Set the flag that will be used to select auto-gears + If useAutoGears is true the auto-box will be active. + \param[in] useAutoGears is the active state of the auto-box. + */ + PX_FORCE_INLINE void setUseAutoGears(const bool useAutoGears) + { + mUseAutoGears=useAutoGears; + } + + /** + \brief Get the flag status that is used to select auto-gears + \return The active status of the auto-box. + */ + PX_FORCE_INLINE bool getUseAutoGears() const + { + return mUseAutoGears; + } + + /** + \brief Toggle the auto-gears flag + If useAutoGears is true the auto-box will be active. + */ + PX_FORCE_INLINE void toggleAutoGears() + { + mUseAutoGears = !mUseAutoGears; + } + + /** + \brief Set the current gear. + + \param[in] currentGear is the vehicle's gear. + + \note If the target gear is different from the current gear the vehicle will + attempt to start a gear change from the current gear that has just been set + towards the target gear at the next call to PxVehicleUpdates. + + @see setTargetGear, PxVehicleGearsData + */ + PX_FORCE_INLINE void setCurrentGear(PxU32 currentGear) + { + mCurrentGear = currentGear; + } + + /** + \brief Get the current gear. + + \return The vehicle's current gear. + + @see getTargetGear, PxVehicleGearsData + */ + PX_FORCE_INLINE PxU32 getCurrentGear() const + { + return mCurrentGear; + } + + /** + \brief Set the target gear. + + \param[in] targetGear is the vehicle's target gear. + + \note If the target gear is different from the current gear the vehicle will + attempt to start a gear change towards the target gear at the next call to + PxVehicleUpdates. + + @see PxVehicleGearsData + */ + PX_FORCE_INLINE void setTargetGear(PxU32 targetGear) + { + mTargetGear = targetGear; + } + + /** + \brief Get the target gear. + + \return The vehicle's target gear. + + @see setTargetGear, PxVehicleGearsData + */ + PX_FORCE_INLINE PxU32 getTargetGear() const + { + return mTargetGear; + } + + /** + \brief Start a gear change to a target gear. + + \param[in] targetGear is the gear the vehicle will begin a transition towards. + + \note The gear change will begin at the next call to PxVehicleUpadates. + + @see PxVehicleGearsData + */ + PX_FORCE_INLINE void startGearChange(const PxU32 targetGear) + { + mTargetGear=targetGear; + } + + /** + \brief Force an immediate gear change to a target gear + + \param[in] targetGear is the gear the vehicle will be given immediately. + + @see PxVehicleGearsData + */ + PX_FORCE_INLINE void forceGearChange(const PxU32 targetGear) + { + mTargetGear=targetGear; + mCurrentGear=targetGear; + } + + /** + \brief Set the rotation speed of the engine (radians per second) + + \param[in] speed is the rotational speed (radians per second) to apply to the engine. + */ + PX_FORCE_INLINE void setEngineRotationSpeed(const PxF32 speed) + { + mEnginespeed = speed; + } + + /** + \brief Return the rotation speed of the engine (radians per second) + + \return The rotational speed (radians per second) of the engine. + */ + PX_FORCE_INLINE PxReal getEngineRotationSpeed() const + { + return mEnginespeed; + } + + /** + \brief Return the time that has passed since the current gear change was initiated. + + \return The time that has passed since the current gear change was initiated. + + \note If no gear change is in process the gear switch time will be zero. + + @see PxVehicleGearsData.mSwitchTime + */ + PX_FORCE_INLINE PxReal getGearSwitchTime() const + { + return mGearSwitchTime; + } + + /** + \brief Return the time that has passed since the autobox last initiated a gear change. + + \return The time that has passed since the autobox last initiated a gear change. + + @see PxVehicleAutoBoxData::setLatency, PxVehicleAutoBoxData::getLatency + */ + PX_FORCE_INLINE PxReal getAutoBoxSwitchTime() const + { + return mAutoBoxSwitchTime; + } + + /** + \brief All dynamic data values are public for fast access. + */ + + + /** + \brief Analog control values used by vehicle simulation. + @see setAnalogInput, getAnalogInput, PxVehicleDrive4WControl, PxVehicleDriveNWControl, PxVehicleDriveTankControl + */ + PxReal mControlAnalogVals[eMAX_NB_ANALOG_INPUTS]; + + /** + \brief Auto-gear flag used by vehicle simulation. Set true to enable the autobox, false to disable the autobox. + @see setUseAutoGears, setUseAutoGears, toggleAutoGears, PxVehicleAutoBoxData + */ + bool mUseAutoGears; + + /** + \brief Gear-up digital control value used by vehicle simulation. + + \note If true a gear change will be initiated towards currentGear+1 (or to first gear if in reverse). + + @see setDigitalInput, getDigitalInput + */ + bool mGearUpPressed; + + /** + \brief Gear-down digital control value used by vehicle simulation. + + \note If true a gear change will be initiated towards currentGear-1 (or to reverse if in first). + + @see setDigitalInput, getDigitalInput + */ + bool mGearDownPressed; + + /** + \brief Current gear + @see startGearChange, forceGearChange, getCurrentGear, PxVehicleGearsData + */ + PxU32 mCurrentGear; + + /** + \brief Target gear (different from current gear if a gear change is underway) + @see startGearChange, forceGearChange, getTargetGear, PxVehicleGearsData + */ + PxU32 mTargetGear; + + /** + \brief Rotation speed of engine + @see setToRestState, getEngineRotationSpeed + */ + PxReal mEnginespeed; + + /** + \brief Reported time that has passed since gear change started. + @see setToRestState, startGearChange, PxVehicleGearsData::mSwitchTime + */ + PxReal mGearSwitchTime; + + /** + \brief Reported time that has passed since last autobox gearup/geardown decision. + @see setToRestState, PxVehicleAutoBoxData::setLatency + */ + PxReal mAutoBoxSwitchTime; + +private: + PxU32 mPad[2]; + + /** + \brief Test that a PxVehicleDriveDynData instance has legal values. + @see setToRestState + */ + bool isValid() const; + +//serialization +public: + PxVehicleDriveDynData(); + PxVehicleDriveDynData(const PxEMPTY) {} + PxU32 getNbAnalogInput() const { return eMAX_NB_ANALOG_INPUTS; } + PX_FORCE_INLINE void setGearChange(const PxU32 gearChange) { mTargetGear= gearChange; } + PX_FORCE_INLINE PxU32 getGearChange() const { return mTargetGear; } + PX_FORCE_INLINE void setGearSwitchTime(const PxReal switchTime) { mGearSwitchTime = switchTime; } + PX_FORCE_INLINE void setAutoBoxSwitchTime(const PxReal autoBoxSwitchTime) { mAutoBoxSwitchTime = autoBoxSwitchTime; } +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveDynData) & 15)); + +/** +\brief A complete vehicle with instance dynamics data and configuration data for wheels and engine,clutch,gears,autobox. +@see PxVehicleDrive4W, PxVehicleDriveTank +*/ +class PX_DEPRECATED PxVehicleDrive : public PxVehicleWheels +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + /** + \brief Dynamics data of vehicle instance. + @see setup + */ + PxVehicleDriveDynData mDriveDynData; + +protected: + + /** + \brief Test that all instanced dynamics data and configuration data have legal values. + */ + bool isValid() const; + + /** + \brief Set vehicle to rest. + */ + void setToRestState(); + + /** + @see PxVehicleDrive4W::allocate, PxVehicleDriveTank::allocate + */ + static PxU32 computeByteSize(const PxU32 numWheels); + static PxU8* patchupPointers(const PxU32 nbWheels, PxVehicleDrive* vehDrive, PxU8* ptr); + virtual void init(const PxU32 numWheels); + + /** + \brief Deallocate a PxVehicle4WDrive instance. + @see PxVehicleDrive4W::free, PxVehicleDriveTank::free + */ + void free(); + + /** + @see PxVehicleDrive4W::setup, PxVehicleDriveTank::setup + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, + const PxU32 nbDrivenWheels, const PxU32 nbNonDrivenWheels); + +//serialization +public: + static void getBinaryMetaData(PxOutputStream& stream); + PxVehicleDrive(PxBaseFlags baseFlags) : PxVehicleWheels(baseFlags), mDriveDynData(PxEmpty) {} + virtual const char* getConcreteTypeName() const { return "PxVehicleDrive"; } +protected: + PxVehicleDrive(PxType concreteType, PxBaseFlags baseFlags) : PxVehicleWheels(concreteType, baseFlags) {} + ~PxVehicleDrive() {} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive", name) || PxBase::isKindOf(name); } +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive4W.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive4W.h new file mode 100644 index 0000000..e2212df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDrive4W.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_4WDRIVE_H +#define PX_VEHICLE_4WDRIVE_H + +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleComponents.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxFilterData; +class PxGeometry; +class PxPhysics; +class PxVehicleDrivableSurfaceToTireFrictionPairs; +class PxShape; +class PxMaterial; +class PxRigidDynamic; + +/** +\brief Data structure describing the drive model components of a vehicle with up to 4 driven wheels and up to 16 un-driven wheels. +The drive model incorporates engine, clutch, gears, autobox, differential, and Ackermann steer correction. +@see PxVehicleDriveSimData +*/ +class PX_DEPRECATED PxVehicleDriveSimData4W : public PxVehicleDriveSimData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleDrive4W; + + PxVehicleDriveSimData4W() + : PxVehicleDriveSimData() + { + } + + /** + \brief Return the data describing the differential. + @see PxVehicleDifferential4WData + */ + PX_FORCE_INLINE const PxVehicleDifferential4WData& getDiffData() const + { + return mDiff; + } + + /** + \brief Return the data describing the Ackermann steer-correction. + @see PxVehicleAckermannGeometryData + */ + PX_FORCE_INLINE const PxVehicleAckermannGeometryData& getAckermannGeometryData() const + { + return mAckermannGeometry; + } + + /** + \brief Set the data describing the differential. + @see PxVehicleDifferential4WData + */ + void setDiffData(const PxVehicleDifferential4WData& diff); + + /** + \brief Set the data describing the Ackermann steer-correction. + @see PxVehicleAckermannGeometryData + */ + void setAckermannGeometryData(const PxVehicleAckermannGeometryData& ackermannData); + +private: + + /** + \brief Differential simulation data + @see setDiffData, getDiffData + */ + PxVehicleDifferential4WData mDiff; + + /** + \brief Data for ackermann steer angle computation. + @see setAckermannGeometryData, getAckermannGeometryData + */ + PxVehicleAckermannGeometryData mAckermannGeometry; + + /** + \brief Test if the 4W-drive simulation data has been setup with legal data. + \note Call only after setting all components. + @see setEnginedata, setClutchData, setGearsData, setAutoboxData, setDiffData, setAckermannGeometryData + */ + bool isValid() const; + +//serialization +public: + PxVehicleDriveSimData4W(const PxEMPTY) : PxVehicleDriveSimData(PxEmpty), mDiff(PxEmpty), mAckermannGeometry(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimData4W) & 15)); + + + +/** +\brief The ordering of the driven and steered wheels of a PxVehicleDrive4W. + +@see PxVehicleWheelsSimData, PxVehicleWheelsDynData +*/ + +struct PX_DEPRECATED PxVehicleDrive4WWheelOrder +{ + enum Enum + { + eFRONT_LEFT=0, + eFRONT_RIGHT, + eREAR_LEFT, + eREAR_RIGHT + }; +}; + +/** +\brief The control inputs for a PxVehicleDrive4W. + +@see PxVehicleDriveDynData::setAnalogInput, PxVehicleDriveDynData::getAnalogInput +*/ + +struct PX_DEPRECATED PxVehicleDrive4WControl +{ + enum Enum + { + eANALOG_INPUT_ACCEL=0, + eANALOG_INPUT_BRAKE, + eANALOG_INPUT_HANDBRAKE, + eANALOG_INPUT_STEER_LEFT, + eANALOG_INPUT_STEER_RIGHT, + eMAX_NB_DRIVE4W_ANALOG_INPUTS + }; +}; + +/** +\brief Data structure with instanced dynamics data and configuration data of a vehicle with up to 4 driven wheels and up to 16 non-driven wheels. +*/ +class PX_DEPRECATED PxVehicleDrive4W : public PxVehicleDrive +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + friend class PxVehicleUpdate; + + /** + \brief Allocate a PxVehicleDrive4W instance for a 4WDrive vehicle with nbWheels (= 4 + number of un-driven wheels) + + \param[in] nbWheels is the number of vehicle wheels (= 4 + number of un-driven wheels) + + \return The instantiated vehicle. + + @see free, setup + */ + static PxVehicleDrive4W* allocate(const PxU32 nbWheels); + + /** + \brief Deallocate a PxVehicleDrive4W instance. + @see allocate + */ + void free(); + + /** + \brief Set up a vehicle using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \param[in] driveData describes the properties of the vehicle's drive model (gears/engine/clutch/differential/autobox). The vehicle instance takes a copy of this data. + \param[in] nbNonDrivenWheels is the number of wheels on the vehicle that cannot be connected to the differential (= numWheels - 4). + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + \note wheelsData must contain data for at least 4 wheels. Unwanted wheels can be disabled with PxVehicleWheelsSimData::disableWheel after calling setup. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, + const PxU32 nbNonDrivenWheels); + + /** + \brief Allocate and set up a vehicle using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \param[in] driveData describes the properties of the vehicle's drive model (gears/engine/clutch/differential/autobox). The vehicle instance takes a copy of this data. + \param[in] nbNonDrivenWheels is the number of wheels on the vehicle that cannot be connected to the differential (= numWheels - 4). + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + \note wheelsData must contain data for at least 4 wheels. Unwanted wheels can be disabled with PxVehicleWheelsSimData::disableWheel after calling setup. + \return The instantiated vehicle. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + */ + static PxVehicleDrive4W* create + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, + const PxU32 nbNonDrivenWheels); + + /** + \brief Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body + to the state they were in immediately after setup or create. + \note Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line + raycasts need to be performed at least once with PxVehicleSuspensionRaycasts before calling PxVehicleUpdates. + @see setup, create, PxVehicleSuspensionRaycasts, PxVehicleUpdates + */ + void setToRestState(); + + /** + \brief Simulation data that describes the configuration of the vehicle's drive model. + @see setup, create + */ + PxVehicleDriveSimData4W mDriveSimData; + +private: + + /** + \brief Test if the instanced dynamics and configuration data has legal values. + */ + bool isValid() const; + +//serialization +protected: + PxVehicleDrive4W(); + ~PxVehicleDrive4W(){} + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive4W", name) || PxBase::isKindOf(name); } +public: + static PxVehicleDrive4W* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + PxVehicleDrive4W(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {} + virtual const char* getConcreteTypeName() const { return "PxVehicleDrive4W"; } +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive4W) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveNW.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveNW.h new file mode 100644 index 0000000..23c984b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveNW.h @@ -0,0 +1,231 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_NWDRIVE_H +#define PX_VEHICLE_NWDRIVE_H + +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleComponents.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxFilterData; +class PxGeometry; +class PxPhysics; +class PxVehicleDrivableSurfaceToTireFrictionPairs; +class PxShape; +class PxMaterial; +class PxRigidDynamic; + +/** +\brief Data structure describing configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven equally through the differential. The vehicle has an +engine, clutch, gears, autobox, differential. +@see PxVehicleDriveSimData +*/ +class PX_DEPRECATED PxVehicleDriveSimDataNW : public PxVehicleDriveSimData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleDriveNW; + + PxVehicleDriveSimDataNW() + : PxVehicleDriveSimData() + { + } + + /** + \brief Return the data describing the differential of a vehicle with up to PX_MAX_NB_WHEELS driven wheels. + */ + const PxVehicleDifferentialNWData& getDiffData() const + { + return mDiff; + } + + /** + \brief Set the data describing the differential of a vehicle with up to PX_MAX_NB_WHEELS driven wheels. + The differential data describes the set of wheels that are driven by the differential. + */ + void setDiffData(const PxVehicleDifferentialNWData& diff); + +private: + + /** + \brief Differential simulation data + @see setDiffData, getDiffData + */ + PxVehicleDifferentialNWData mDiff; + + /** + \brief Test if the NW-drive simulation data has been setup with legal data. + Call only after setting all components. + @see setEngineData, setClutchData, setGearsData, setAutoboxData, setDiffData, setAckermannGeometryData + */ + bool isValid() const; + +//serialization +public: + PxVehicleDriveSimDataNW(const PxEMPTY) : PxVehicleDriveSimData(PxEmpty), mDiff(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimDataNW) & 15)); + + +/** +\brief The control inputs for a PxVehicleDriveNW. + +@see PxVehicleDriveDynData::setAnalogInput, PxVehicleDriveDynData::getAnalogInput +*/ +struct PX_DEPRECATED PxVehicleDriveNWControl +{ + enum Enum + { + eANALOG_INPUT_ACCEL=0, + eANALOG_INPUT_BRAKE, + eANALOG_INPUT_HANDBRAKE, + eANALOG_INPUT_STEER_LEFT, + eANALOG_INPUT_STEER_RIGHT, + eMAX_NB_DRIVENW_ANALOG_INPUTS + }; +}; + +/** +\brief Data structure with instanced dynamics data and configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven wheels. +*/ +class PX_DEPRECATED PxVehicleDriveNW : public PxVehicleDrive +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + /** + \brief Allocate a PxVehicleDriveNW instance for a NWDrive vehicle with nbWheels + + \param[in] nbWheels is the number of wheels on the vehicle. + + \return The instantiated vehicle. + + @see free, setup + */ + static PxVehicleDriveNW* allocate(const PxU32 nbWheels); + + /** + \brief Deallocate a PxVehicleDriveNW instance. + @see allocate + */ + void free(); + + /** + \brief Set up a vehicle using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \param[in] driveData describes the properties of the vehicle's drive model (gears/engine/clutch/differential/autobox). The vehicle instance takes a copy of this data. + \param[in] nbWheels is the number of wheels on the vehicle. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData, + const PxU32 nbWheels); + + /** + \brief Allocate and set up a vehicle using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \param[in] driveData describes the properties of the vehicle's drive model (gears/engine/clutch/differential/autobox). The vehicle instance takes a copy of this data. + \param[in] nbWheels is the number of wheels on the vehicle. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + \return The instantiated vehicle. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + */ + static PxVehicleDriveNW* create + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData, + const PxU32 nbWheels); + + /** + \brief Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body + to the state they were in immediately after setup or create. + \note Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line + raycasts need to be performed at least once with PxVehicleSuspensionRaycasts before calling PxVehicleUpdates. + @see setup, create, PxVehicleSuspensionRaycasts, PxVehicleUpdates + */ + void setToRestState(); + + /** + \brief Simulation data that describes the configuration of the vehicle's drive model. + @see setup, create + */ + PxVehicleDriveSimDataNW mDriveSimData; + +private: + + /** + \brief Test if the instanced dynamics and configuration data has legal values. + */ + bool isValid() const; + +//serialization +public: + PxVehicleDriveNW(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {} + PxVehicleDriveNW(); + ~PxVehicleDriveNW(){} + static PxVehicleDriveNW* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + virtual const char* getConcreteTypeName() const { return "PxVehicleDriveNW"; } + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveNW", name) || PxBase::isKindOf(name); } +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveNW) & 15)); + + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveTank.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveTank.h new file mode 100644 index 0000000..4201612 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleDriveTank.h @@ -0,0 +1,275 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_DRIVE_TANK_H +#define PX_VEHICLE_DRIVE_TANK_H + +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleComponents.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxFilterData; +class PxGeometry; +class PxPhysics; +class PxVehicleDrivableSurfaceToTireFrictionPairs; +class PxShape; +class PxMaterial; +class PxRigidDynamic; + +/** +\brief The ordering of the wheels of a PxVehicleDriveTank. + +@see PxVehicleWheelsSimData, PxVehicleWheelsDynData +*/ +struct PX_DEPRECATED PxVehicleDriveTankWheelOrder +{ + enum Enum + { + eFRONT_LEFT=0, + eFRONT_RIGHT, + e1ST_FROM_FRONT_LEFT, + e1ST_FROM_FRONT_RIGHT, + e2ND_FROM_FRONT_LEFT, + e2ND_FROM_FRONT_RIGHT, + e3RD_FROM_FRONT_LEFT, + e3RD_FROM_FRONT_RIGHT, + e4TH_FROM_FRONT_LEFT, + e4TH_FROM_FRONT_RIGHT, + e5TH_FROM_FRONT_LEFT, + e5TH_FROM_FRONT_RIGHT, + e6TH_FROM_FRONT_LEFT, + e6TH_FROM_FRONT_RIGHT, + e7TH_FROM_FRONT_LEFT, + e7TH_FROM_FRONT_RIGHT, + e8TH_FROM_FRONT_LEFT, + e8TH_FROM_FRONT_RIGHT, + e9TH_FROM_FRONT_LEFT, + e9TH_FROM_FRONT_RIGHT + }; +}; + + +/** +\brief The control inputs for a PxVehicleDriveTank. + +\note The values of eANALOG_INPUT_THRUST_LEFT and eANALOG_INPUT_THRUST_RIGHT determine how much +of the total available drive torque is diverted to the left and right wheels. These entries in the +enumerated list represent the state of the left and right control sticks of a tank. The total available +drive torque available is controlled by eANALOG_INPUT_ACCEL, which represents the state of the acceleration +pedal and controls how much torque will be applied to the engine. + +\note To accelerate forwards eANALOG_INPUT_ACCEL must be greater than zero so that torque is applied to drive the +engine, while eANALOG_INPUT_THRUST_LEFT and eANALOG_INPUT_THRUST_RIGHT must also be greater than zero +to divert the available drive torque to the left and wheels. If eANALOG_INPUT_THRUST_LEFT > eANALOG_INPUT_THRUST_RIGHT +the tank will turn to the right. If eANALOG_INPUT_THRUST_RIGHT > eANALOG_INPUT_THRUST_LEFT +the tank will turn to the left. + +@see PxVehicleDriveDynData::setAnalogInput, PxVehicleDriveDynData::getAnalogInput +*/ + +struct PX_DEPRECATED PxVehicleDriveTankControl +{ + enum Enum + { + eANALOG_INPUT_ACCEL=0, + eANALOG_INPUT_BRAKE_LEFT, + eANALOG_INPUT_BRAKE_RIGHT, + eANALOG_INPUT_THRUST_LEFT, + eANALOG_INPUT_THRUST_RIGHT, + eMAX_NB_DRIVETANK_ANALOG_INPUTS + }; +}; + +/** +\brief Two driving models are supported. + +\note If eSTANDARD is chosen the left and right wheels are always driven in the same direction. If the tank is in +a forward gear the left and right wheels will all be driven forwards, while in reverse gear the left and right wheels +will all be driven backwards. With eSTANDARD the legal range of left and right thrust is (0,1). + +\note If eSPECIAL is chosen it is possible to drive the left and right wheels in different directions. +With eSPECIAL the legal range of left and right thrust is (-1,1). In forward(reverse) gear negative thrust values drive the wheels +backwards(forwards), while positive thrust values drives the wheels forwards(backwards). + +\note A sharp left turn can be achieved in eSTANDARD mode by braking with the left wheels and thrusting forward with the +right wheels. A smaller turning circle can theoretically be achieved in eSPECIAL mode by applying negative thrust to the left wheels and positive +thrust to the right wheels. + +\note In both modes the legal ranges of acceleration and left/right brake are all (0,1). + +@see PxVehicleDriveTank::setDriveModel +*/ +struct PX_DEPRECATED PxVehicleDriveTankControlModel +{ + enum Enum + { + eSTANDARD=0, + eSPECIAL + }; +}; + + +/** +\brief Data structure with instanced dynamics data and configuration data of a tank. +*/ +class PX_DEPRECATED PxVehicleDriveTank : public PxVehicleDrive +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + + /** + \brief Allocate a PxVehicleTankDrive instance for a tank with nbWheels + + \param[in] nbWheels is the number of wheels on the vehicle. + + \note It is assumed that all wheels are driven wheels. + + \return The instantiated vehicle. + + @see free, setup + */ + static PxVehicleDriveTank* allocate(const PxU32 nbWheels); + + /** + \brief Deallocate a PxVehicleDriveTank instance. + @see allocate + */ + void free(); + + /** + \brief Set up a tank using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data. + \param[in] driveData describes the properties of the tank's drive model (gears/engine/clutch/autobox). The tank instance takes a copy of this data. + \param[in] nbDrivenWheels is the number of wheels on the tank. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + \note nbDrivenWheels must be an even number + \note The wheels must be arranged according to PxVehicleDriveTankWheelOrder; that is, + the even wheels are on the left side of the tank and the odd wheels are on the right side of the tank. + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData, + const PxU32 nbDrivenWheels); + + /** + \brief Allocate and set up a tank using simulation data for the wheels and drive model. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the tank. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data. + \param[in] driveData describes the properties of the tank's drive model (gears/engine/clutch/differential/autobox). The tank instance takes a copy of this data. + \param[in] nbDrivenWheels is the number of wheels on the tank. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping. + \return The instantiated vehicle. + @see allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping + */ + static PxVehicleDriveTank* create + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData, + const PxU32 nbDrivenWheels); + + /** + \brief Set the control model used by the tank. + \note eDRIVE_MODEL_STANDARD: turning achieved by braking on one side, accelerating on the other side. + \note eDRIVE_MODEL_SPECIAL: turning achieved by accelerating forwards on one side, accelerating backwards on the other side. + \note The default value is eDRIVE_MODEL_STANDARD + */ + void setDriveModel(const PxVehicleDriveTankControlModel::Enum driveModel) + { + mDriveModel=driveModel; + } + + /** + \brief Return the control model used by the tank. + */ + PxVehicleDriveTankControlModel::Enum getDriveModel() const {return mDriveModel;} + + /** + \brief Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body + to the state they were in immediately after setup or create. + \note Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line + raycasts need to be performed at least once with PxVehicleSuspensionRaycasts before calling PxVehicleUpdates. + @see setup, create, PxVehicleSuspensionRaycasts, PxVehicleUpdates + */ + void setToRestState(); + + /** + \brief Simulation data that models vehicle components + @see setup, create + */ + PxVehicleDriveSimData mDriveSimData; + +private: + /** + \brief Test if the instanced dynamics and configuration data has legal values. + */ + bool isValid() const; + + /** + \brief Drive model + @see setDriveModel, getDriveModel, PxVehicleDriveTankControlModel + */ + PxVehicleDriveTankControlModel::Enum mDriveModel; + + PxU32 mPad[3]; + +//serialization +public: + PxVehicleDriveTank(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags) {} + static PxVehicleDriveTank* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + virtual const char* getConcreteTypeName() const { return "PxVehicleDriveTank"; } + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveTank", name) || PxBase::isKindOf(name); } +protected: + PxVehicleDriveTank(); + ~PxVehicleDriveTank(){} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveTank) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleNoDrive.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleNoDrive.h new file mode 100644 index 0000000..f8d8cc7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleNoDrive.h @@ -0,0 +1,211 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_NO_DRIVE_H +#define PX_VEHICLE_NO_DRIVE_H + +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleComponents.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxFilterData; +class PxGeometry; +class PxPhysics; +class PxVehicleDrivableSurfaceToTireFrictionPairs; +class PxShape; +class PxMaterial; +class PxRigidDynamic; + +/** +\brief Data structure with instanced dynamics data and configuration data of a vehicle with no drive model. +*/ +class PX_DEPRECATED PxVehicleNoDrive : public PxVehicleWheels +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + /** + \brief Allocate a PxVehicleNoDrive instance for a vehicle without drive model and with nbWheels + + \param[in] nbWheels is the number of wheels on the vehicle. + + \return The instantiated vehicle. + + @see free, setup + */ + static PxVehicleNoDrive* allocate(const PxU32 nbWheels); + + /** + \brief Deallocate a PxVehicleNoDrive instance. + @see allocate + */ + void free(); + + /** + \brief Set up a vehicle using simulation data for the wheels. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheels::setWheelShapeMapping. + @see allocate, free, setToRestState, PxVehicleWheels::setWheelShapeMapping + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, const PxVehicleWheelsSimData& wheelsData); + + /** + \brief Allocate and set up a vehicle using simulation data for the wheels. + \param[in] physics is a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle. + \param[in] vehActor is a PxRigidDynamic instance that is used to represent the vehicle in the PhysX SDK. + \param[in] wheelsData describes the configuration of all suspension/tires/wheels of the vehicle. The vehicle instance takes a copy of this data. + \note It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheels::setWheelShapeMapping. + \return The instantiated vehicle. + @see allocate, free, setToRestState, PxVehicleWheels::setWheelShapeMapping + */ + static PxVehicleNoDrive* create + (PxPhysics* physics, PxRigidDynamic* vehActor, const PxVehicleWheelsSimData& wheelsData); + + /** + \brief Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body + to the state they were in immediately after setup or create. + \note Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line + raycasts need to be performed at least once with PxVehicleSuspensionRaycasts before calling PxVehicleUpdates. + @see setup, create, PxVehicleSuspensionRaycasts, PxVehicleUpdates + */ + void setToRestState(); + + /** + \brief Set the brake torque to be applied to a specific wheel + + \note The applied brakeTorque persists until the next call to setBrakeTorque + + \note The brake torque is specified in Newton metres. + + \param[in] id is the wheel being given the brake torque + \param[in] brakeTorque is the value of the brake torque + */ + void setBrakeTorque(const PxU32 id, const PxReal brakeTorque); + + /** + \brief Set the drive torque to be applied to a specific wheel + + \note The applied driveTorque persists until the next call to setDriveTorque + + \note The brake torque is specified in Newton metres. + + \param[in] id is the wheel being given the brake torque + \param[in] driveTorque is the value of the brake torque + */ + void setDriveTorque(const PxU32 id, const PxReal driveTorque); + + /** + \brief Set the steer angle to be applied to a specific wheel + + \note The applied steerAngle persists until the next call to setSteerAngle + + \note The steer angle is specified in radians. + + \param[in] id is the wheel being given the steer angle + \param[in] steerAngle is the value of the steer angle in radians. + */ + void setSteerAngle(const PxU32 id, const PxReal steerAngle); + + /** + \brief Get the brake torque that has been applied to a specific wheel + \param[in] id is the wheel being queried for its brake torque + \return The brake torque applied to the queried wheel. + */ + PxReal getBrakeTorque(const PxU32 id) const; + + /** + \brief Get the drive torque that has been applied to a specific wheel + \param[in] id is the wheel being queried for its drive torque + \return The drive torque applied to the queried wheel. + */ + PxReal getDriveTorque(const PxU32 id) const; + + /** + \brief Get the steer angle that has been applied to a specific wheel + \param[in] id is the wheel being queried for its steer angle + \return The steer angle (in radians) applied to the queried wheel. + */ + PxReal getSteerAngle(const PxU32 id) const; + +private: + + PxReal* mSteerAngles; + PxReal* mDriveTorques; + PxReal* mBrakeTorques; + +#if PX_P64_FAMILY + PxU32 mPad[2]; +#else + PxU32 mPad[1]; +#endif + + /** + \brief Test if the instanced dynamics and configuration data has legal values. + */ + bool isValid() const; + + +//serialization +public: + PxVehicleNoDrive(PxBaseFlags baseFlags) : PxVehicleWheels(baseFlags) {} + virtual void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext&); + static PxVehicleNoDrive* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + virtual const char* getConcreteTypeName() const { return "PxVehicleNoDrive"; } + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleNoDrive", name) || PxBase::isKindOf(name); } + PxU32 getNbSteerAngle() const { return mWheelsSimData.getNbWheels(); } + PxU32 getNbDriveTorque() const { return mWheelsSimData.getNbWheels(); } + PxU32 getNbBrakeTorque() const { return mWheelsSimData.getNbWheels(); } +protected: + PxVehicleNoDrive(); + ~PxVehicleNoDrive() {} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleNoDrive) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleSDK.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleSDK.h new file mode 100644 index 0000000..cfe58f0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleSDK.h @@ -0,0 +1,420 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_SDK_H +#define PX_VEHICLE_SDK_H + +#include "foundation/Px.h" +#include "foundation/PxVec3.h" +#include "common/PxTypeInfo.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPhysics; +class PxSerializationRegistry; + +/** +\brief Initialize the PhysXVehicle library. + +Call this before using any of the vehicle functions. + +\param physics The PxPhysics instance. +\param serializationRegistry PxSerializationRegistry instance, if NULL vehicle serialization is not supported. + +\note This function must be called after PxFoundation and PxPhysics instances have been created. +\note If a PxSerializationRegistry instance is specified then PhysXVehicle is also dependent on PhysXExtensions. + +@see PxCloseVehicleSDK +*/ +PX_DEPRECATED PX_C_EXPORT bool PX_CALL_CONV PxInitVehicleSDK(PxPhysics& physics, PxSerializationRegistry* serializationRegistry = NULL); + + +/** +\brief Shut down the PhysXVehicle library. + +Call this function as part of the physx shutdown process. + +\param serializationRegistry PxSerializationRegistry instance, if non-NULL must be the same as passed into PxInitVehicleSDK. + +\note This function must be called prior to shutdown of PxFoundation and PxPhysics. +\note If the PxSerializationRegistry instance is specified this function must additionally be called prior to shutdown of PhysXExtensions. + +@see PxInitVehicleSDK +*/ +PX_DEPRECATED PX_C_EXPORT void PX_CALL_CONV PxCloseVehicleSDK(PxSerializationRegistry* serializationRegistry = NULL); + + +/** +\brief This number is the maximum number of wheels allowed for a vehicle. +*/ +#define PX_MAX_NB_WHEELS (20) + + +/** +\brief Compiler setting to enable recording of telemetry data + +@see PxVehicleUpdateSingleVehicleAndStoreTelemetryData, PxVehicleTelemetryData +*/ +#define PX_DEBUG_VEHICLE_ON (1) + + +/** +@see PxVehicleDrive4W, PxVehicleDriveTank, PxVehicleDriveNW, PxVehicleNoDrive, PxVehicleWheels::getVehicleType +*/ +struct PX_DEPRECATED PxVehicleTypes +{ + enum Enum + { + eDRIVE4W=0, + eDRIVENW, + eDRIVETANK, + eNODRIVE, + eUSER1, + eUSER2, + eUSER3, + eMAX_NB_VEHICLE_TYPES + }; +}; + + +/** +\brief An enumeration of concrete vehicle classes inheriting from PxBase. +\note This enum can be used to identify a vehicle object stored in a PxCollection. +@see PxBase, PxTypeInfo, PxBase::getConcreteType +*/ +struct PX_DEPRECATED PxVehicleConcreteType +{ + enum Enum + { + eVehicleNoDrive = PxConcreteType::eFIRST_VEHICLE_EXTENSION, + eVehicleDrive4W, + eVehicleDriveNW, + eVehicleDriveTank + }; +}; + + +/** +\brief Set the basis vectors of the vehicle simulation + +See PxVehicleContext for the default values. + +Call this function before using PxVehicleUpdates unless the default values are correct +or the settings structure is explicitly provided. + +@see PxVehicleContext +*/ +PX_DEPRECATED void PxVehicleSetBasisVectors(const PxVec3& up, const PxVec3& forward); + + +/** +@see PxVehicleSetUpdateMode +*/ +struct PX_DEPRECATED PxVehicleUpdateMode +{ + enum Enum + { + eVELOCITY_CHANGE, + eACCELERATION + }; +}; + + +/** +\brief Set the effect of PxVehicleUpdates to be either to modify each vehicle's rigid body actor + +with an acceleration to be applied in the next PhysX SDK update or as an immediate velocity modification. + +See PxVehicleContext for the default value. + +Call this function before using PxVehicleUpdates for the first time if the default is not the desired behavior +or if the settings structure is not explicitly provided. + +@see PxVehicleUpdates, PxVehicleContext +*/ +PX_DEPRECATED void PxVehicleSetUpdateMode(PxVehicleUpdateMode::Enum vehicleUpdateMode); + +/** + +\brief Set threshold angles that are used to determine if a wheel hit is to be resolved by vehicle suspension or by rigid body collision. + + +\note ^ + N ___ + |** + ** + ** + %%% %%% ** + %%% %%% ** / + / + %%% %%% / + / + %%% %%% / + C / + %%% | ** %%% / + | ** / + %%% | **%%%/ + | X** + %%% | %%% / **_| ^ + | / D + %%% | %%% / + | / + | / + | / + | + ^ | + S \|/ + +The diagram above depicts a wheel centered at "C" that has hit an inclined plane at point "X". +The inclined plane has unit normal "N", while the suspension direction has unit vector "S". +The unit vector from the wheel center to the hit point is "D". +Hit points are analyzed by comparing the unit vectors D and N with the suspension direction S. +This analysis is performed in the contact modification callback PxVehicleModifyWheelContacts (when enabled) and in +PxVehicleUpdates (when non-blocking sweeps are enabled). +If the angle between D and S is less than pointRejectAngle the hit is accepted by the suspension in PxVehicleUpdates and rejected +by the contact modification callback PxVehicleModifyWheelContacts. +If the angle between -N and S is less than normalRejectAngle the hit is accepted by the suspension in PxVehicleUpdates and rejected +by the contact modification callback PxVehicleModifyWheelContacts. + +\param pointRejectAngle is the threshold angle used when comparing the angle between D and S. + +\param normalRejectAngle is the threshold angle used when comparing the angle between -N and S. + +\note PxVehicleUpdates ignores the rejection angles for raycasts and for sweeps that return blocking hits. + +\note Both angles have default values of Pi/4. + +@see PxVehicleSuspensionSweeps, PxVehicleModifyWheelContacts, PxVehicleContext +*/ +PX_DEPRECATED void PxVehicleSetSweepHitRejectionAngles(const PxF32 pointRejectAngle, const PxF32 normalRejectAngle); + + +/** +\brief Determine the maximum acceleration experienced by PxRigidDynamic instances that are found to be in contact +with a wheel. + +\note Newton's Third Law states that every force has an equal and opposite force. As a consequence, forces applied to +the suspension must be applied to dynamic objects that lie under the wheel. This can lead to instabilities, particularly +when a heavy wheel is driving on a light object. The value of maxHitActorAcceleration clamps the applied force so that it never +generates an acceleration greater than the specified value. + +See PxVehicleContext for the default value. + +@see PxVehicleContext +*/ +PX_DEPRECATED void PxVehicleSetMaxHitActorAcceleration(const PxF32 maxHitActorAcceleration); + + +/** +\brief Common parameters and settings used for the vehicle simulation. + +To be passed into PxVehicleUpdates(), for example. + +@see PxVehicleUpdates() +*/ +class PX_DEPRECATED PxVehicleContext +{ +public: + + /** + \brief The axis denoting the up direction for vehicles. + + Range: unit length vector
+ Default: PxVec3(0,1,0) + + @see PxVehicleSetBasisVectors() + */ + PxVec3 upAxis; + + /** + \brief The axis denoting the forward direction for vehicles. + + Range: unit length vector
+ Default: PxVec3(0,0,1) + + @see PxVehicleSetBasisVectors() + */ + PxVec3 forwardAxis; + + /** + \brief The axis denoting the side direction for vehicles. + + Has to be the cross product of the up- and forward-axis. The method + computeSideAxis() can be used to do that computation for you. + + Range: unit length vector
+ Default: PxVec3(1,0,0) + + @see PxVehicleSetBasisVectors(), computeSideAxis() + */ + PxVec3 sideAxis; + + /** + \brief Apply vehicle simulation results as acceleration or velocity modification. + + See PxVehicleSetUpdateMode() for details. + + Default: eVELOCITY_CHANGE + + @see PxVehicleSetUpdateMode() + */ + PxVehicleUpdateMode::Enum updateMode; + + /** + \brief Cosine of threshold angle for rejecting sweep hits. + + See PxVehicleSetSweepHitRejectionAngles() for details. + + Range: (1, -1)
+ Default: 0.707f (cosine of 45 degrees) + + @see PxVehicleSetSweepHitRejectionAngles() + */ + PxF32 pointRejectAngleThresholdCosine; + + /** + \brief Cosine of threshold angle for rejecting sweep hits. + + See PxVehicleSetSweepHitRejectionAngles() for details. + + Range: (1, -1)
+ Default: 0.707f (cosine of 45 degrees) + + @see PxVehicleSetSweepHitRejectionAngles() + */ + PxF32 normalRejectAngleThresholdCosine; + + /** + \brief Maximum acceleration experienced by PxRigidDynamic instances that are found to be in contact with a wheel. + + See PxVehicleSetMaxHitActorAcceleration() for details. + + Range: [0, PX_MAX_REAL]
+ Default: PX_MAX_REAL + + @see PxVehicleSetMaxHitActorAcceleration() + */ + PxF32 maxHitActorAcceleration; + + +public: + /** + \brief Constructor sets to default. + */ + PX_INLINE PxVehicleContext(); + + /** + \brief (re)sets the structure to the default. + */ + PX_INLINE void setToDefault(); + + /** + \brief Check if the settings descriptor is valid. + + \return True if the current settings are valid. + */ + PX_INLINE bool isValid() const; + + /** + \brief Compute the side-axis from the up- and forward-axis + */ + PX_INLINE void computeSideAxis(); +}; + +PX_INLINE PxVehicleContext::PxVehicleContext(): + upAxis(0.0f, 1.0f, 0.0f), + forwardAxis(0.0f, 0.0f, 1.0f), + sideAxis(1.0f, 0.0f, 0.0f), + updateMode(PxVehicleUpdateMode::eVELOCITY_CHANGE), + pointRejectAngleThresholdCosine(0.707f), // cosine of 45 degrees + normalRejectAngleThresholdCosine(0.707f), // cosine of 45 degrees + maxHitActorAcceleration(PX_MAX_REAL) +{ +} + +PX_INLINE void PxVehicleContext::setToDefault() +{ + *this = PxVehicleContext(); +} + +PX_INLINE bool PxVehicleContext::isValid() const +{ + if (!upAxis.isNormalized()) + return false; + + if (!forwardAxis.isNormalized()) + return false; + + if (!sideAxis.isNormalized()) + return false; + + if (((upAxis.cross(forwardAxis)) - sideAxis).magnitude() > 0.02f) // somewhat above 1 degree assuming both have unit length + return false; + + if ((pointRejectAngleThresholdCosine >= 1) || (pointRejectAngleThresholdCosine <= -1)) + return false; + + if ((normalRejectAngleThresholdCosine >= 1) || (normalRejectAngleThresholdCosine <= -1)) + return false; + + if (maxHitActorAcceleration < 0.0f) + return false; + + return true; +} + +PX_INLINE void PxVehicleContext::computeSideAxis() +{ + sideAxis = upAxis.cross(forwardAxis); +} + + +/** +\brief Get the default vehicle context. + +Will be used if the corresponding parameters are not specified in methods like +PxVehicleUpdates() etc. + +To set the default values, see the methods PxVehicleSetBasisVectors(), +PxVehicleSetUpdateMode() etc. + +\return The default vehicle context. + +@see PxVehicleSetBasisVectors() PxVehicleSetUpdateMode() +*/ +PX_DEPRECATED const PxVehicleContext& PxVehicleGetDefaultContext(); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleShaders.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleShaders.h new file mode 100644 index 0000000..0c08d9f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleShaders.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_SHADERS_H +#define PX_VEHICLE_SHADERS_H + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/** +\brief Prototype of shader function that is used to compute wheel torque and tire forces. +\param[in] shaderData is the shader data for the tire being processed. The shader data describes the tire data in the format required by the tire model that is implemented by the shader function. +\param[in] tireFriction is the value of friction for the contact between the tire and the ground. +\param[in] longSlip is the value of longitudinal slip experienced by the tire. +\param[in] latSlip is the value of lateral slip experienced by the tire. +\param[in] camber is the camber angle of the tire in radians. +\param[in] wheelOmega is the rotational speed of the wheel. +\param[in] wheelRadius is the distance from the tire surface to the center of the wheel. +\param[in] recipWheelRadius is the reciprocal of wheelRadius. +\param[in] restTireLoad is the load force experienced by the tire when the vehicle is at rest. +\param[in] normalisedTireLoad is a pre-computed value equal to the load force on the tire divided by restTireLoad. +\param[in] tireLoad is the load force currently experienced by the tire (= restTireLoad*normalisedTireLoad) +\param[in] gravity is the magnitude of gravitational acceleration. +\param[in] recipGravity is the reciprocal of the magnitude of gravitational acceleration. +\param[out] wheelTorque is the torque that is to be applied to the wheel around the wheel's axle. +\param[out] tireLongForceMag is the magnitude of the longitudinal tire force to be applied to the vehicle's rigid body. +\param[out] tireLatForceMag is the magnitude of the lateral tire force to be applied to the vehicle's rigid body. +\param[out] tireAlignMoment is the aligning moment of the tire that is to be applied to the vehicle's rigid body (not currently used). +@see PxVehicleWheelsDynData::setTireForceShaderFunction, PxVehicleWheelsDynData::setTireForceShaderData +*/ +PX_DEPRECATED typedef void (*PxVehicleComputeTireForce) +(const void* shaderData, + const PxF32 tireFriction, + const PxF32 longSlip, const PxF32 latSlip, const PxF32 camber, + const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, + const PxF32 restTireLoad, const PxF32 normalisedTireLoad, const PxF32 tireLoad, + const PxF32 gravity, const PxF32 recipGravity, + PxF32& wheelTorque, PxF32& tireLongForceMag, PxF32& tireLatForceMag, PxF32& tireAlignMoment); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleTireFriction.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleTireFriction.h new file mode 100644 index 0000000..d2408ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleTireFriction.h @@ -0,0 +1,274 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_TIREFRICTION_H +#define PX_VEHICLE_TIREFRICTION_H + +#include "foundation/PxSimpleTypes.h" +#include "common/PxSerialFramework.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxMaterial; +class PxCollection; +class PxOutputStream; + +/** +\brief Driving surface type. Each PxMaterial is associated with a corresponding PxVehicleDrivableSurfaceType. +@see PxMaterial, PxVehicleDrivableSurfaceToTireFrictionPairs +*/ +struct PX_DEPRECATED PxVehicleDrivableSurfaceType +{ + enum + { + eSURFACE_TYPE_UNKNOWN=0xffffffff + }; + PxU32 mType; +}; + +/** +\brief Friction for each combination of driving surface type and tire type. +@see PxVehicleDrivableSurfaceType, PxVehicleTireData::mType +*/ +class PX_DEPRECATED PxVehicleDrivableSurfaceToTireFrictionPairs +{ +public: + + friend class VehicleSurfaceTypeHashTable; + + enum + { + eMAX_NB_SURFACE_TYPES=256 + }; + + /** + \brief Allocate the memory for a PxVehicleDrivableSurfaceToTireFrictionPairs instance + that can hold data for combinations of tire type and surface type with up to maxNbTireTypes types of tire and maxNbSurfaceTypes types of surface. + + \param[in] maxNbTireTypes is the maximum number of allowed tire types. + \param[in] maxNbSurfaceTypes is the maximum number of allowed surface types. Must be less than or equal to eMAX_NB_SURFACE_TYPES + + \return a PxVehicleDrivableSurfaceToTireFrictionPairs instance that can be reused later with new type and friction data. + + @see setup + */ + static PxVehicleDrivableSurfaceToTireFrictionPairs* allocate + (const PxU32 maxNbTireTypes, const PxU32 maxNbSurfaceTypes); + + /** + \brief Set up a PxVehicleDrivableSurfaceToTireFrictionPairs instance for combinations of nbTireTypes tire types and nbSurfaceTypes surface types. + + \param[in] nbTireTypes is the number of different types of tire. This value must be less than or equal to maxNbTireTypes specified in allocate(). + \param[in] nbSurfaceTypes is the number of different types of surface. This value must be less than or equal to maxNbSurfaceTypes specified in allocate(). + \param[in] drivableSurfaceMaterials is an array of PxMaterial pointers of length nbSurfaceTypes. + \param[in] drivableSurfaceTypes is an array of PxVehicleDrivableSurfaceType instances of length nbSurfaceTypes. + + \note If the pointer to the PxMaterial that touches the tire is found in drivableSurfaceMaterials[x] then the surface type is drivableSurfaceTypes[x].mType + and the friction is the value that is set with setTypePairFriction(drivableSurfaceTypes[x].mType, PxVehicleTireData::mType, frictionValue). + + \note A friction value of 1.0 will be assigned as default to each combination of tire and surface type. To override this use setTypePairFriction. + @see release, setTypePairFriction, getTypePairFriction, PxVehicleTireData.mType + */ + void setup + (const PxU32 nbTireTypes, const PxU32 nbSurfaceTypes, + const PxMaterial** drivableSurfaceMaterials, const PxVehicleDrivableSurfaceType* drivableSurfaceTypes); + + /** + \brief Deallocate a PxVehicleDrivableSurfaceToTireFrictionPairs instance + */ + void release(); + + /** + \brief Set the friction for a specified pair of tire type and drivable surface type. + + \param[in] surfaceType describes the surface type + \param[in] tireType describes the tire type. + \param[in] value describes the friction coefficient for the combination of surface type and tire type. + */ + void setTypePairFriction(const PxU32 surfaceType, const PxU32 tireType, const PxReal value); + + + /** + \brief Compute the surface type associated with a specified PxMaterial instance. + \param[in] surfaceMaterial is the material to be queried for its associated surface type. + \note The surface type may be used to query the friction of a surface type/tire type pair using getTypePairFriction() + \return The surface type associated with a specified PxMaterial instance. + If surfaceMaterial is not referenced by the PxVehicleDrivableSurfaceToTireFrictionPairs a value of 0 will be returned. + @see setup + @see getTypePairFriction + */ + PxU32 getSurfaceType(const PxMaterial& surfaceMaterial) const; + + /** + \brief Return the friction for a specified combination of surface type and tire type. + \return The friction for a specified combination of surface type and tire type. + \note The final friction value used by the tire model is the value returned by getTypePairFriction + multiplied by the value computed from PxVehicleTireData::mFrictionVsSlipGraph + \note The surface type is associated with a PxMaterial. The mapping between the two may be queried using getSurfaceType(). + @see PxVehicleTireData::mFrictionVsSlipGraph + @see getSurfaceType + */ + PxReal getTypePairFriction(const PxU32 surfaceType, const PxU32 tireType) const; + + /** + \brief Return the friction for a specified combination of PxMaterial and tire type. + \return The friction for a specified combination of PxMaterial and tire type. + \note The final friction value used by the tire model is the value returned by getTypePairFriction + multiplied by the value computed from PxVehicleTireData::mFrictionVsSlipGraph + \note If surfaceMaterial is not referenced by the PxVehicleDrivableSurfaceToTireFrictionPairs + a surfaceType of value 0 will be assumed and the corresponding friction value will be returned. + @see PxVehicleTireData::mFrictionVsSlipGraph + */ + PxReal getTypePairFriction(const PxMaterial& surfaceMaterial, const PxU32 tireType) const; + + /** + \brief Return the maximum number of surface types + \return The maximum number of surface types + @see allocate + */ + PX_FORCE_INLINE PxU32 getMaxNbSurfaceTypes() const {return mMaxNbSurfaceTypes;} + + /** + \brief Return the maximum number of tire types + \return The maximum number of tire types + @see allocate + */ + PX_FORCE_INLINE PxU32 getMaxNbTireTypes() const {return mMaxNbTireTypes;} + + /** + \brief Binary serialization of a PxVehicleDrivableSurfaceToTireFrictionPairs instance. + The PxVehicleDrivableSurfaceToTireFrictionPairs instance is serialized to a PxOutputStream. + The materials referenced by the PxVehicleDrivableSurfaceToTireFrictionPairs instance are + serialized to a PxCollection. + \param[in] frictionTable is the PxVehicleDrivableSurfaceToTireFrictionPairs instance to be serialized. + \param[in] materialIds are unique ids that will be used to add the materials to the collection. + \param[in] nbMaterialIds is the length of the materialIds array. It must be sufficient to cover all materials. + \param[out] collection is the PxCollection instance that is to be used to serialize the PxMaterial instances referenced by the + PxVehicleDrivableSurfaceToTireFrictionPairs instance. + \param[out] stream contains the memory block for the binary serialized friction table. + \note If a material has already been added to the collection with a PxSerialObjectId, it will not be added again. + \note If all materials have already been added to the collection with a PxSerialObjectId, it is legal to pass a NULL ptr for the materialIds array. + \note frictionTable references PxMaterial instances, which are serialized using PxCollection. + The PxCollection instance may be used to serialize an entire scene that also references some or none of those material instances + or particular objects in a scene or nothing at all. The complementary deserialize() function requires the same collection instance + or more typically a deserialized copy of the collection to be passed as a function argument. + @see deserializeFromBinary + */ + static void serializeToBinary(const PxVehicleDrivableSurfaceToTireFrictionPairs& frictionTable, const PxSerialObjectId* materialIds, const PxU32 nbMaterialIds, PxCollection* collection, PxOutputStream& stream); + + /** + \brief Deserialize from a memory block to create a PxVehicleDrivableSurfaceToTireFrictionPairs instance. + \param[in] collection contains the PxMaterial instances that will be referenced by the friction table. + \param[in] memBlock is a binary array that may be retrieved or copied from the stream in the complementary serializeToBinary function. + \return A PxVehicleDrivableSurfaceToTireFrictionPairs instance whose base address is equal to the memBlock ptr. + @see serializeToBinary + */ + static PxVehicleDrivableSurfaceToTireFrictionPairs* deserializeFromBinary(const PxCollection& collection, void* memBlock); + +private: + + /** + \brief Ptr to base address of a 2d PxReal array with dimensions [mNbSurfaceTypes][mNbTireTypes] + + \note Each element of the array describes the maximum friction provided by a surface type-tire type combination. + eg the friction corresponding to a combination of surface type x and tire type y is mPairs[x][y] + */ + PxReal* mPairs; + + /** + \brief Ptr to 1d array of material ptrs that is of length mNbSurfaceTypes. + + \note If the PxMaterial that touches the tire corresponds to mDrivableSurfaceMaterials[x] then the drivable surface + type is mDrivableSurfaceTypes[x].mType and the friction for that contact is mPairs[mDrivableSurfaceTypes[x].mType][y], + assuming a tire type y. + + \note If the PxMaterial that touches the tire is not found in mDrivableSurfaceMaterials then the friction is + mPairs[0][y], assuming a tire type y. + */ + const PxMaterial** mDrivableSurfaceMaterials; + + /** + \brief Ptr to 1d array of PxVehicleDrivableSurfaceType that is of length mNbSurfaceTypes. + + \note If the PxMaterial that touches the tire is found in mDrivableSurfaceMaterials[x] then the drivable surface + type is mDrivableSurfaceTypes[x].mType and the friction for that contact is mPairs[mDrivableSurfaceTypes[x].mType][y], + assuming a tire type y. + + \note If the PxMaterial that touches the tire is not found in mDrivableSurfaceMaterials then the friction is + mPairs[0][y], assuming a tire type y. + */ + PxVehicleDrivableSurfaceType* mDrivableSurfaceTypes; + + /** + \brief A PxSerialObjectId per surface type used internally for serialization. + */ + PxSerialObjectId* mMaterialSerialIds; + + /** + \brief Number of different driving surface types. + + \note mDrivableSurfaceMaterials and mDrivableSurfaceTypes are both 1d arrays of length mMaxNbSurfaceTypes. + + \note mNbSurfaceTypes must be less than or equal to mMaxNbSurfaceTypes. + */ + PxU32 mNbSurfaceTypes; + + /** + \brief Maximum number of different driving surface types. + + \note mMaxNbSurfaceTypes must be less than or equal to eMAX_NB_SURFACE_TYPES. + */ + PxU32 mMaxNbSurfaceTypes; + + /** + \brief Number of different tire types. + + \note Tire types stored in PxVehicleTireData.mType + */ + PxU32 mNbTireTypes; + + /** + \brief Maximum number of different tire types. + + \note Tire types stored in PxVehicleTireData.mType + */ + PxU32 mMaxNbTireTypes; + + PxVehicleDrivableSurfaceToTireFrictionPairs(){} + ~PxVehicleDrivableSurfaceToTireFrictionPairs(){} +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrivableSurfaceToTireFrictionPairs) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUpdate.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUpdate.h new file mode 100644 index 0000000..ae6bc50 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUpdate.h @@ -0,0 +1,598 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_UPDATE_H +#define PX_VEHICLE_UPDATE_H + +#include "vehicle/PxVehicleSDK.h" +#include "vehicle/PxVehicleTireFriction.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMemory.h" +#include "foundation/PxTransform.h" +#include "PxQueryFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class PxContactModifyPair; + class PxVehicleWheels; + class PxVehicleDrivableSurfaceToTireFrictionPairs; + class PxVehicleTelemetryData; + class PxBatchQueryExt; + + /** + \brief Structure containing data describing the non-persistent state of each suspension/wheel/tire unit. + This structure is filled out in PxVehicleUpdates and PxVehicleUpdateSingleVehicleAndStoreTelemetryData + @see PxVehicleUpdates, PxVehicleUpdateSingleVehicleAndStoreTelemetryData + */ + struct PX_DEPRECATED PxWheelQueryResult + { + PxWheelQueryResult() + { + PxMemZero(this, sizeof(PxWheelQueryResult)); + isInAir=true; + tireSurfaceType = PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN); + localPose = PxTransform(PxIdentity); + } + + /** + \brief Start point of suspension line raycast/sweep used in the raycast/sweep completed immediately before PxVehicleUpdates. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then (0,0,0) is stored. + @see PxVehicleSuspensionRaycasts, PxVehicleSuspensionRaycasts + */ + PxVec3 suspLineStart; + + /** + \brief Directions of suspension line raycast/sweep used in the raycast/sweep completed immediately before PxVehicleUpdates. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then (0,0,0) is stored. + @see PxVehicleSuspensionRaycasts, PxVehicleSuspensionRaycasts + */ + PxVec3 suspLineDir; + + /** + \brief Lengths of suspension line raycast/sweep used in raycast/sweep completed immediately before PxVehicleUpdates. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then 0 is stored. + @see PxVehicleSuspensionRaycasts, PxVehicleSuspensionRaycasts + */ + PxReal suspLineLength; + + /** + \brief If suspension travel limits forbid the wheel from touching the drivable surface then isInAir is true. + \note If the wheel can be placed on the contact plane of the most recent suspension line raycast/sweep then isInAir is false. + \note If #PxVehicleWheelsSimFlag::eLIMIT_SUSPENSION_EXPANSION_VELOCITY is set, then isInAir will also be true if the suspension + force is not large enough to expand to the target length in the given simulation time step. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then isInAir + is computed using the contact plane that was hit by the most recent suspension line raycast/sweep. + */ + bool isInAir; + + /** + \brief PxActor instance of the driving surface under the corresponding vehicle wheel. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireContactActor is NULL. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then NULL is stored. + */ + PxActor* tireContactActor; + + /** + \brief PxShape instance of the driving surface under the corresponding vehicle wheel. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireContactShape is NULL. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then NULL is stored. + */ + PxShape* tireContactShape; + + /** + \brief PxMaterial instance of the driving surface under the corresponding vehicle wheel. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireSurfaceMaterial is NULL. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then NULL is stored. + */ + const PxMaterial* tireSurfaceMaterial; + + /** + \brief Surface type integer that corresponds to the mapping between tireSurfaceMaterial and integer as + described in PxVehicleDrivableSurfaceToTireFrictionPairs. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireSurfaceType is + PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN. + \note If no raycast/sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then + PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN is stored. + @see PxVehicleDrivableSurfaceToTireFrictionPairs + */ + PxU32 tireSurfaceType; + + /** + \brief Point on the drivable surface hit by the most recent suspension raycast or sweep. + \note If suspension travel limits forbid the wheel from touching the drivable surface then the contact point is (0,0,0). + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then (0,0,0) is stored. + */ + PxVec3 tireContactPoint; + + /** + \brief Normal on the drivable surface at the hit point of the most recent suspension raycast or sweep. + \note If suspension travel limits forbid the wheel from touching the drivable surface then the contact normal is (0,0,0). + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then (0,0,0) is stored. + */ + PxVec3 tireContactNormal; + + /** + \brief Friction experienced by the tire for the combination of tire type and surface type after accounting + for the friction vs slip graph. + \note If suspension travel limits forbid the wheel from touching the drivable surface then the tire friction is 0. + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + stored tire friction is the value computed in PxVehicleUpdates that immediately followed the last raycast or sweep. + @see PxVehicleDrivableSurfaceToTireFrictionPairs, PxVehicleTireData + */ + PxReal tireFriction; + + /** + \brief Compression of the suspension spring. + \note If suspension travel limits forbid the wheel from touching the drivable surface then the jounce is -PxVehicleSuspensionData.mMaxDroop + The jounce can never exceed PxVehicleSuspensionData.mMaxCompression. Positive values result when the suspension is compressed from + the rest position, while negative values mean the suspension is elongated from the rest position. + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + suspension compression is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + */ + PxReal suspJounce; + + /** + \brief Magnitude of force applied by the suspension spring along the direction of suspension travel. + \note If suspension travel limits forbid the wheel from touching the drivable surface then the force is 0 + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + suspension spring force is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + @see PxVehicleWheelsSimData::getSuspTravelDirection + */ + PxReal suspSpringForce; + + /** + \brief Forward direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact plane of the drivable surface. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireLongitudinalDir is (0,0,0) + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + tire longitudinal direction is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + */ + PxVec3 tireLongitudinalDir; + + /** + \brief Lateral direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact plan of the drivable surface. + \note If suspension travel limits forbid the wheel from touching the drivable surface then tireLateralDir is (0,0,0) + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + tire lateral direction is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + */ + PxVec3 tireLateralDir; + + /** + \brief Longitudinal slip of the tire. + \note If suspension travel limits forbid the wheel from touching the drivable surface then longitudinalSlip is 0.0 + \note The longitudinal slip is approximately (w*r - vz) / PxAbs(vz) where w is the angular speed of the wheel, r is the radius of the wheel, and + vz component of rigid body velocity computed at the wheel base along the longitudinal direction of the tire. + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + tire longitudinal slip is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + */ + PxReal longitudinalSlip; + + /** + \brief Lateral slip of the tire. + \note If suspension travel limits forbid the wheel from touching the drivable surface then lateralSlip is 0.0 + \note The lateral slip angle is approximately PxAtan(vx / PxAbs(vz)) where vx and vz are the components of rigid body velocity at the wheel base + along the wheel's lateral and longitudinal directions, respectively. + \note If no raycast or sweep for the corresponding suspension was performed immediately prior to PxVehicleUpdates then the + tire lateral slip is computed using the contact plane that was hit by the most recent suspension line raycast or sweep. + */ + PxReal lateralSlip; + + /** + \brief Steer angle of the wheel about the "up" vector accounting for input steer and toe and, if applicable, Ackermann steer correction. + @see PxVehicleWheelData::mToeAngle + */ + PxReal steerAngle; + + /** + \brief Local pose of the wheel. + */ + PxTransform localPose; + }; + + struct PX_DEPRECATED PxVehicleWheelQueryResult + { + /** + \brief Pointer to an PxWheelQueryResult buffer of length nbWheelQueryResults + The wheelQueryResults buffer must persist until the end of PxVehicleUpdates + A NULL pointer is permitted. + The wheelQueryResults buffer is left unmodified in PxVehicleUpdates for vehicles with sleeping rigid bodies + whose control inputs indicate they should remain inert. + @see PxVehicleUpdates + */ + PxWheelQueryResult* wheelQueryResults; + + /** + \brief The length of the wheelQueryResults buffer. This value corresponds to the + number of wheels in the associated vehicle in PxVehicleUpdates. + */ + PxU32 nbWheelQueryResults; + }; + + /** + \brief Structure containing data that is computed for a wheel during concurrent calls to PxVehicleUpdates or + PxVehicleUpdateSingleVehicleAndStoreTelemetryData but which cannot be safely concurrently applied. + + @see PxVehicleUpdates, PxVehicleUpdateSingleVehicleAndStoreTelemetryData, PxVehiclePostUpdates, PxVehicleConcurrentUpdate + */ + struct PX_DEPRECATED PxVehicleWheelConcurrentUpdateData + { + friend class PxVehicleUpdate; + + PxVehicleWheelConcurrentUpdateData() + : localPose(PxTransform(PxIdentity)), + hitActor(NULL), + hitActorForce(PxVec3(0,0,0)), + hitActorForcePosition(PxVec3(0,0,0)) + { + } + + private: + + PxTransform localPose; + PxRigidDynamic* hitActor; + PxVec3 hitActorForce; + PxVec3 hitActorForcePosition; + }; + + /** + \brief Structure containing data that is computed for a vehicle and its wheels during concurrent calls to PxVehicleUpdates or + PxVehicleUpdateSingleVehicleAndStoreTelemetryData but which cannot be safely concurrently applied. + + @see PxVehicleUpdates, PxVehicleUpdateSingleVehicleAndStoreTelemetryData, PxVehiclePostUpdates, PxVehicleWheelConcurrentUpdateData + */ + + struct PX_DEPRECATED PxVehicleConcurrentUpdateData + { + friend class PxVehicleUpdate; + + PxVehicleConcurrentUpdateData() + : concurrentWheelUpdates(NULL), + nbConcurrentWheelUpdates(0), + linearMomentumChange(PxVec3(0,0,0)), + angularMomentumChange(PxVec3(0,0,0)), + staySleeping(false), + wakeup(false) + { + } + + /** + \brief Pointer to an PxVehicleWheelConcurrentUpdate buffer of length nbConcurrentWheelUpdates + The concurrentWheelUpdates buffer must persist until the end of PxVehiclePostUpdates + A NULL pointer is not permitted. + @see PxVehicleUpdates, PxVehiclePostUpdates + */ + PxVehicleWheelConcurrentUpdateData* concurrentWheelUpdates; + + /** + \brief The length of the concurrentWheelUpdates buffer. This value corresponds to the + number of wheels in the associated vehicle passed to PxVehicleUpdates. + */ + PxU32 nbConcurrentWheelUpdates; + + private: + + PxVec3 linearMomentumChange; + PxVec3 angularMomentumChange; + bool staySleeping; + bool wakeup; + }; + + /** + \brief Perform raycasts for all suspension lines for all vehicles. + + \param[in] batchQuery is a PxBatchQueryExt instance used to specify shader data and functions for the raycast scene queries. + + \param[in] nbVehicles is the number of vehicles in the vehicles array. + + \param[in] vehicles is an array of all vehicles that are to have a raycast issued from each wheel. + + \param[in] vehiclesToRaycast is an array of bools of length nbVehicles that is used to decide if raycasts will be performed for the corresponding vehicle + in the vehicles array. If vehiclesToRaycast[i] is true then suspension line raycasts will be performed for vehicles[i]. If vehiclesToRaycast[i] is + false then suspension line raycasts will not be performed for vehicles[i]. + + \param[in] queryFlags filter flags for the batched scene queries + + \note If vehiclesToRaycast is NULL then raycasts are performed for all vehicles in the vehicles array. + + \note If vehiclesToRaycast[i] is false then the vehicle stored in vehicles[i] will automatically use the raycast or sweep hit planes recorded by the most recent + suspension sweeps or raycasts for that vehicle. For vehicles far from the camera or not visible on the screen it can be + optimal to only perform suspension line raycasts every Nth update rather than every single update. The accuracy of the cached contact plane + naturally diminishes as N increase, meaning that wheels might start to hover or intersect the ground for large values of N or even with values close to 1 in + conjunction with large vehicle speeds and/or geometry that has low spatial coherence. + + \note Calling setToRestState invalidates any cached hit planes. Prior to calling PxVehicleUpdates each vehicle needs to perform suspension line raycasts + or sweeps at least once after instantiation and at least once after calling setToRestState. + + \note Each raycast casts along the suspension travel direction from the position of the top of the wheel at maximum suspension compression + to the position of the base of the wheel at maximum droop. Raycasts that start inside a PxShape are subsequently ignored by the + corresponding vehicle. + + \note Only blocking hits are supported (PxQueryHitType::eBLOCK). + + @see PxVehicleDrive4W::setToRestState, PxVehicleDriveNW::setToRestState, PxVehicleDriveTank::setToRestState, PxVehicleNoDrive::setToRestState + + @see PxBatchQueryExt::raycast + */ + PX_DEPRECATED void PxVehicleSuspensionRaycasts( PxBatchQueryExt* batchQuery, + const PxU32 nbVehicles, PxVehicleWheels** vehicles, + const bool* vehiclesToRaycast = NULL, + const PxQueryFlags queryFlags = PxQueryFlag::eSTATIC | PxQueryFlag::eDYNAMIC | PxQueryFlag::ePREFILTER); + + /** + \brief Perform sweeps for all suspension lines for all vehicles. + + \param[in] batchQuery is a PxBatchQueryExt instance used to specify shader data and functions for the sweep scene queries. + + \param[in] nbVehicles is the number of vehicles in the vehicles array. + + \param[in] vehicles is an array of all vehicles that are to have a sweep issued from each wheel. + + \param[in] nbHitsPerQuery is the maximum numbers of hits that will be returned for each query. + + \param[in] vehiclesToSweep is an array of bools of length nbVehicles that is used to decide if sweeps will be performed for the corresponding vehicle + in the vehicles array. If vehiclesToSweep[i] is true then suspension sweeps will be performed for vehicles[i]. If vehiclesToSweep[i] is + false then suspension sweeps will not be performed for vehicles[i]. + + \param[in] sweepWidthScale scales the geometry of the wheel used in the sweep. Values < 1 result in a thinner swept wheel, while values > 1 result in a fatter swept wheel. + + \param[in] sweepRadiusScale scales the geometry of the wheel used in the sweep. Values < 1 result in a smaller swept wheel, while values > 1 result in a larger swept wheel. + + \param[in] sweepInflation Inflation parameter for sweeps. This is the inflation parameter from PxScene::sweep(). It inflates the shape and makes it rounder, + which gives smoother and more reliable normals. + + \param[in] queryFlags filter flags for the batched scene queries + + \param[in] context the vehicle context to use for the suspension sweeps. + + \note If vehiclesToSweep is NULL then sweeps are performed for all vehicles in the vehicles array. + + \note If vehiclesToSweep[i] is false then the vehicle stored in vehicles[i] will automatically use the most recent sweep or raycast hit planes + recorded by the most recent suspension sweeps or raycasts for that vehicle. For vehicles far from the camera or not visible on the screen it can be + optimal to only perform suspension queries every Nth update rather than every single update. The accuracy of the cached contact plane + naturally diminishes as N increase, meaning that wheels might start to hover or intersect the ground for large values of N or even with values close to 1 in + conjunction with large vehicle speeds and/or geometry that has low spatial coherence. + + \note Calling setToRestState invalidates any cached hit planes. Prior to calling PxVehicleUpdates each vehicle needs to perform suspension raycasts + or sweeps at least once after instantiation and at least once after calling setToRestState. + + \note Each sweep casts the wheel's shape along the suspension travel direction from the position of the top of the wheel at maximum suspension compression + to the position of the base of the wheel at maximum droop. Sweeps that start inside a PxShape are subsequently ignored by the + corresponding vehicle. + + \note A scale can be applied to the shape so that a modified shape is swept through the scene. The parameters sweepWidthScale and sweepRadiusScale scale the + swept wheel shape in the width and radial directions. It is sometimes a good idea to sweep a thinner wheel to allow contact with other dynamic actors to be resolved + first before attempting to drive on them. + + \note Blocking hits (PxQueryHitType::eBLOCK) and non-blocking hits (PxQueryHitType::TOUCH) are supported. If the pre-and post-filter functions of the PxBatchQuery + instance are set up to return blocking hits it is recommended to set nbHitsPerQuery = 1. If the filter functions returns touch hits then it is recommended to + set nbHitsPerQuery > 1. The exact value depends on the expected complexity of the geometry that lies under the wheel. For complex geometry, especially with dynamic + objects, it is recommended to use non-blocking hits. The vehicle update function will analyze all returned hits and choose the most appropriate using the thresholds + set in PxVehicleSetSweepHitRejectionAngles. + + @see PxVehicleDrive4W::setToRestState, PxVehicleDriveNW::setToRestState, PxVehicleDriveTank::setToRestState, PxVehicleNoDrive::setToRestState + + @see PxBatchQueryExt::sweep PxScene::sweep() + + @see PxVehicleSetSweepHitRejectionAngles + */ + PX_DEPRECATED void PxVehicleSuspensionSweeps( PxBatchQueryExt* batchQuery, + const PxU32 nbVehicles, PxVehicleWheels** vehicles, + const PxU16 nbHitsPerQuery, + const bool* vehiclesToSweep = NULL, + const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f, const PxF32 sweepInflation = 0.0f, + const PxQueryFlags queryFlags = PxQueryFlag::eSTATIC | PxQueryFlag::eDYNAMIC | PxQueryFlag::ePREFILTER, + const PxVehicleContext& context = PxVehicleGetDefaultContext()); + + /** + \brief A function called from PxContactModifyCallback::onContactModify. The function determines if rigid body contact points + recorded for the wheel's PxShape are likely to be duplicated and resolved by the wheel's suspension raycast. Contact points that will be + resolved by the suspension are ignored. Contact points that are accepted (rather than ignored) are modified to account for the effect of the + suspension geometry and the angular speed of the wheel. + + \param[in] vehicle is a reference to the PxVehicleWheels instance that owns the wheel + + \param[in] wheelId is the id of the wheel + + \param[in] wheelTangentVelocityMultiplier determines the amount of wheel angular velocity that is used to modify the target relative velocity of the contact. + The target relative velocity is modified by adding a vector equal to the tangent velocity of the rotating wheel at the contact point and scaled by + wheelTangentVelocityMultiplier. The value of wheelTangentVelocityMultiplier is limited to the range (0,1). Higher values mimic higher values of friction + and tire load, while lower values mimic lower values of friction and tire load. + + \param[in] maxImpulse determines the maximum impulse strength that the contacts can apply when a wheel is in contact with a PxRigidDynamic. This value is ignored for + contacts with PxRigidStatic instances. + + \param[in,out] contactModifyPair describes the set of contacts involving the PxShape of the specified wheel and one other shape. The contacts in the contact set are + ignored or modified as required. + + \param[in] context the vehicle context to use for the contact modification. + + \note Contact points are accepted or rejected using the threshold angles specified in the function PxVehicleSetSweepHitRejectionAngles. + + \note If a contact point is not rejected it is modified to account for the wheel rotation speed. + + \note Set maxImpulse to PX_MAX_F32 to allow any impulse value to be applied. + + \note Reduce maxImpulse if the wheels are frequently colliding with light objects with mass much less than the vehicle's mass. + Reducing this value encourages numerical stability. + + @see PxContactModifyCallback::onContactModify, PxVehicleSetSweepHitRejectionAngles, PxVehicleContext + */ + PX_DEPRECATED PxU32 PxVehicleModifyWheelContacts + (const PxVehicleWheels& vehicle, const PxU32 wheelId, + const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse, + PxContactModifyPair& contactModifyPair, + const PxVehicleContext& context = PxVehicleGetDefaultContext()); + + + /** + \brief Update an array of vehicles by either applying an acceleration to the rigid body actor associated with + each vehicle or by an immediate update of the velocity of the actor. + + \note The update mode (acceleration or velocity change) can be selected with PxVehicleSetUpdateMode. + + \param[in] timestep is the timestep of the update + + \param[in] gravity is the value of gravitational acceleration + + \param[in] vehicleDrivableSurfaceToTireFrictionPairs describes the mapping between each PxMaterial ptr and an integer representing a + surface type. It also stores the friction value for each combination of surface and tire type. + + \param[in] nbVehicles is the number of vehicles pointers in the vehicles array + + \param[in,out] vehicles is an array of length nbVehicles containing all vehicles to be updated by the specified timestep + + \param[out] vehicleWheelQueryResults is an array of length nbVehicles storing the wheel query results of each corresponding vehicle and wheel in the + vehicles array. A NULL pointer is permitted. + + \param[out] vehicleConcurrentUpdates is an array of length nbVehicles. It is only necessary to specify vehicleConcurrentUpdates if PxVehicleUpdates is + called concurrently (also concurrently with PxVehicleUpdateSingleVehicleAndStoreTelemetryData). The element vehicleConcurrentUpdates[i] of the array + stores data that is computed for vehicle[i] during PxVehicleUpdates but which cannot be safely written when concurrently called. The data computed and + stored in vehicleConcurrentUpdates must be passed to PxVehiclePostUpdates, where it is applied to all relevant actors in sequence. A NULL pointer is permitted. + + \param[in] context the vehicle context to use for the vehicle update. + + \note The vehicleWheelQueryResults buffer must persist until the end of PxVehicleUpdates. + + \note The vehicleWheelQueryResults buffer is left unmodified for vehicles with sleeping rigid bodies whose control inputs indicate they should remain inert. + + \note If PxVehicleUpdates is called concurrently then vehicleConcurrentUpdates must be specified. Do not specify vehicleConcurrentUpdates if PxVehicleUpdates + is not called concurrently. + + \note The vehicleConcurrentUpdates buffer must persist until the end of PxVehiclePostUpdate. + + \note If any vehicle has one or more disabled wheels (PxVehicleWheelsSimData::disableWheel) then the disabled wheels must not be associated + with a PxShape (PxVehicleWheelsSimData::setWheelShapeMapping); the differential of the vehicle must be configured so that no drive torque + is delivered to a disabled wheel; and the wheel must have zero rotation speed (PxVehicleWheelsDynData::setWheelRotationSpeed) + + \note Concurrent calls to PxVehicleUpdates and PxVehicleUpdateSingleVehicleAndStoreTelemetryData are permitted if the parameter + vehicleConcurrentUpdates is used. + + @see PxVehicleSetUpdateMode, PxVehicleWheelsSimData::disableWheel, PxVehicleWheelsSimData::setWheelShapeMapping, PxVehicleWheelsDynData::setWheelRotationSpeed, + PxVehiclePostUpdates + */ + PX_DEPRECATED void PxVehicleUpdates( + const PxReal timestep, const PxVec3& gravity, + const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, + const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL, + const PxVehicleContext& context = PxVehicleGetDefaultContext()); + + + /** + \brief Apply actor changes that were computed in concurrent calls to PxVehicleUpdates or PxVehicleUpdateSingleVehicleAndStoreTelemetryData but + which could not be safely applied due to the concurrency. + + \param[in] vehicleConcurrentUpdates is an array of length nbVehicles where vehicleConcurrentUpdates[i] contains data describing actor changes that + were computed for vehicles[i] during concurrent calls to PxVehicleUpdates or PxVehicleUpdateSingleVehicleAndStoreTelemetryData. + + \param[in] nbVehicles is the number of vehicles pointers in the vehicles array + + \param[in,out] vehicles is an array of length nbVehicles containing all vehicles that were partially updated in concurrent calls to PxVehicleUpdates or + PxVehicleUpdateSingleVehicleAndStoreTelemetryData. + + \param[in] context the vehicle context to use for the vehicle post update. + + @see PxVehicleUpdates, PxVehicleUpdateSingleVehicleAndStoreTelemetryData + */ + PX_DEPRECATED void PxVehiclePostUpdates( + const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles, + const PxVehicleContext& context = PxVehicleGetDefaultContext()); + + + /** + \brief Shift the origin of vehicles by the specified vector. + + Call this method to adjust the internal data structures of vehicles to reflect the shifted origin location + (the shift vector will get subtracted from all world space spatial data). + + \note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysXVehicle accordingly. + + \note This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() seperately to keep the systems in sync. + + \param[in] shift is the translation vector to shift the origin by. + + \param[in] nbVehicles is the number of vehicles in the vehicles array. + + \param[in,out] vehicles is an array of all vehicles that should be updated to map to the new scene origin. + */ + PX_DEPRECATED void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles); + +#if PX_DEBUG_VEHICLE_ON + /** + \brief Update an single vehicle by either applying an acceleration to the rigid body actor associated with + each vehicle or by an immediate update of the velocity of the actor. Also record telemetry data from the + vehicle so that it may be visualized or queried. + + \note The update mode (acceleration or velocity change) can be selected with PxVehicleSetUpdateMode. + + \param[in] timestep is the timestep of the update + + \param[in] gravity is the value of gravitational acceleration + + \param[in] vehicleDrivableSurfaceToTireFrictionPairs describes the mapping between each PxMaterial ptr and an integer representing a + surface type. It also stores the friction value for each combination of surface and tire type. + + \param[in,out] focusVehicle is the vehicle to be updated and have its telemetry data recorded + + \param[out] vehicleWheelQueryResults is an array of length 1 storing the wheel query results of each wheel of the vehicle/ + A NULL pointer is permitted. + + \param[out] telemetryData is the data structure used to record telemetry data during the update for later query or visualization + + \param[out] vehicleConcurrentUpdates is an array of length 1. It is only necessary to specify vehicleConcurrentUpdates if + PxVehicleUpdateSingleVehicleAndStoreTelemetryData is called concurrently (also concurrently with PxVehicleUpdates). The + PxVehicleConcurrentUpdateData struct stores data that cannot be safely written when concurrently called. The data computed and + stored in vehicleConcurrentUpdates must be passed to PxVehiclePostUpdates, where it is applied to the vehicle actor. A NULL + pointer is permitted. + + \param[in] context the vehicle context to use for the vehicle update. + + \note The vehicleWheelQueryResults buffer must persist until the end of PxVehicleUpdateSingleVehicleAndStoreTelemetryData + + \note The vehicleWheelQueryResults buffer is left unmodified for vehicles with sleeping rigid bodies whose control inputs indicate they should remain inert. + + \note Concurrent calls to PxVehicleUpdateSingleVehicleAndStoreTelemetryData and PxVehicleUpdates are permitted if the parameter + vehicleConcurrentUpdates is used. + + @see PxVehiclePostUpdates, PxVehicleSetUpdateMode, PxVehicleTelemetryData + */ + PX_DEPRECATED void PxVehicleUpdateSingleVehicleAndStoreTelemetryData + (const PxReal timestep, const PxVec3& gravity, + const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, + PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults, + PxVehicleTelemetryData& telemetryData, + PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL, + const PxVehicleContext& context = PxVehicleGetDefaultContext()); +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtil.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtil.h new file mode 100644 index 0000000..3eea356 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtil.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_UTIL_H +#define PX_VEHICLE_UTIL_H + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +struct PxVehicleWheelQueryResult; + +/** +\brief Test if all wheels of a vehicle are in the air by querying the wheel query data +stored in the last call to PxVehicleUpdates. If all wheels are in the air then true is returned. + +\note False is returned if any wheel can reach to the ground. + +\note If vehWheelQueryResults.wheelQueryResults is NULL or vehWheelQueryResults.nbWheelQueryResults is 0 then true is returned. +This function does not account for wheels that have been disabled since the last execution of PxVehicleUpdates so it is possible +that wheels disabled more recently than the last call to PxVehicleUpdates report are treated as touching the ground. + +\return True if the vehicle is in the air, false if any wheel is touching the ground. +*/ +PX_DEPRECATED bool PxVehicleIsInAir(const PxVehicleWheelQueryResult& vehWheelQueryResults); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtilControl.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtilControl.h new file mode 100644 index 0000000..3a6361e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleUtilControl.h @@ -0,0 +1,676 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_UTIL_CONTROL_H +#define PX_VEHICLE_UTIL_CONTROL_H + +#include "vehicle/PxVehicleSDK.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveNW.h" +#include "vehicle/PxVehicleDriveTank.h" + + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#if PX_CHECKED + void testValidAnalogValue(const PxF32 actualValue, const PxF32 minVal, const PxF32 maxVal, const char* errorString); +#endif + +/** +\brief Used to produce smooth steering values in the presence of discontinuities when a vehicle e.g. lands on the ground. +Use a zero sharpness value to disable the feature (backward compatibility with previous PhysX versions). +*/ +struct PX_DEPRECATED PxVehicleSteerFilter +{ + PxVehicleSteerFilter(float sharpness=0.0f) : mSharpness(sharpness), mFilteredMaxSteer(0.0f) {} + + static PX_FORCE_INLINE float feedbackFilter(float val, float& memory, float sharpness) + { + if(sharpness<0.0f) sharpness = 0.0f; + else if(sharpness>1.0f) sharpness = 1.0f; + return memory = val * sharpness + memory * (1.0f - sharpness); + } + + PX_FORCE_INLINE float computeMaxSteer(const bool isVehicleInAir, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxF32 vzAbs, const PxF32 timestep) const + { + const PxF32 targetMaxSteer = (isVehicleInAir ? 1.0f : steerVsForwardSpeedTable.getYVal(vzAbs)); + if(mSharpness==0.0f) + return targetMaxSteer; + else + return feedbackFilter(targetMaxSteer, mFilteredMaxSteer, mSharpness*timestep); + } + + PxReal mSharpness; + mutable PxReal mFilteredMaxSteer; +}; + +/** +\brief Used to produce smooth vehicle driving control values from key inputs. +@see PxVehicle4WSmoothDigitalRawInputsAndSetAnalogInputs, PxVehicle4WSmoothAnalogRawInputsAndSetAnalogInputs +*/ +struct PX_DEPRECATED PxVehicleKeySmoothingData +{ + /** + \brief Rise rate of each analog value if digital value is 1 + */ + PxReal mRiseRates[PxVehicleDriveDynData::eMAX_NB_ANALOG_INPUTS]; + + /** + \brief Fall rate of each analog value if digital value is 0 + */ + PxReal mFallRates[PxVehicleDriveDynData::eMAX_NB_ANALOG_INPUTS]; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleKeySmoothingData)& 0x0f)); + +/** +\brief Used to produce smooth analog vehicle control values from analog inputs. +@see PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs, PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs +*/ +struct PX_DEPRECATED PxVehiclePadSmoothingData +{ + /** + \brief Rise rate of each analog value from previous value towards target if target>previous + */ + PxReal mRiseRates[PxVehicleDriveDynData::eMAX_NB_ANALOG_INPUTS]; + + /** + \brief Rise rate of each analog value from previous value towards target if target& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDrive4W& focusVehicle, const PxVehicleSteerFilter& steerFilter = PxVehicleSteerFilter(), + const PxVec3& forwardAxis = PxVehicleGetDefaultContext().forwardAxis); + +/** +\brief Used to smooth and set analog vehicle control values from analog inputs (gamepad). +Also used to set boolean gearup, geardown values. +\param[in] padSmoothing describes how quickly the control values applied to the vehicle blend from the current vehicle values towards the raw analog values from the gamepad. +\param[in] steerVsForwardSpeedTable is a table of maximum allowed steer versus forward vehicle speed. +\param[in] rawInputData is the state of all gamepad analog inputs that will be used control the vehicle. +\param[in] timestep is the time that has passed since the last call to PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs +\param[in] isVehicleInAir describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. +\param[in] focusVehicle is the vehicle that will be given analog control values arising from the gamepad inputs. +\param[in] steerFilter is an optional smoothing filter for the steering angle. +\param[in] forwardAxis The axis denoting the local space forward direction of the vehicle. +*/ +PX_DEPRECATED void PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs + (const PxVehiclePadSmoothingData& padSmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDrive4W& focusVehicle, const PxVehicleSteerFilter& steerFilter = PxVehicleSteerFilter(), + const PxVec3& forwardAxis = PxVehicleGetDefaultContext().forwardAxis); + + +/** +\brief Used to produce smooth vehicle driving control values from analog and digital inputs. +@see PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs, PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs +*/ +class PX_DEPRECATED PxVehicleDriveNWRawInputData : public PxVehicleDrive4WRawInputData +{ +public: + + PxVehicleDriveNWRawInputData() : PxVehicleDrive4WRawInputData(){} + ~PxVehicleDriveNWRawInputData(){} +}; + +/** +\brief Used to smooth and set analog vehicle control values (accel,brake,handbrake,steer) from digital inputs (keyboard). + Also used to set boolean gearup, geardown values. + \param[in] keySmoothing describes the rise and fall rates of the corresponding analog values when keys are pressed on and off. + \param[in] steerVsForwardSpeedTable is a table of maximum allowed steer versus forward vehicle speed. + \param[in] rawInputData is the state of all digital inputs that control the vehicle. + \param[in] timestep is the time that has passed since the last call to PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs + \param[in] isVehicleInAir describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. + \param[in] focusVehicle is the vehicle that will be given analog and gearup/geardown control values arising from the digital inputs. + \param[in] steerFilter is an optional smoothing filter for the steering angle. + \param[in] forwardAxis The axis denoting the local space forward direction of the vehicle. +*/ +PX_DEPRECATED void PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs + (const PxVehicleKeySmoothingData& keySmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDriveNWRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDriveNW& focusVehicle, const PxVehicleSteerFilter& steerFilter = PxVehicleSteerFilter(), + const PxVec3& forwardAxis = PxVehicleGetDefaultContext().forwardAxis); + +/** +\brief Used to smooth and set analog vehicle control values from analog inputs (gamepad). +Also used to set boolean gearup, geardown values. +\param[in] padSmoothing describes how quickly the control values applied to the vehicle blend from the current vehicle values towards the raw analog values from the gamepad. +\param[in] steerVsForwardSpeedTable is a table of maximum allowed steer versus forward vehicle speed. +\param[in] rawInputData is the state of all gamepad analog inputs that will be used control the vehicle. +\param[in] timestep is the time that has passed since the last call to PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs +\param[in] isVehicleInAir describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. +\param[in] focusVehicle is the vehicle that will be given analog control values arising from the gamepad inputs. +\param[in] steerFilter is an optional smoothing filter for the steering angle. +\param[in] forwardAxis The axis denoting the local space forward direction of the vehicle. +*/ +PX_DEPRECATED void PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs + (const PxVehiclePadSmoothingData& padSmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDriveNWRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDriveNW& focusVehicle, const PxVehicleSteerFilter& steerFilter = PxVehicleSteerFilter(), + const PxVec3& forwardAxis = PxVehicleGetDefaultContext().forwardAxis); + + +/** +\brief Used to produce smooth analog tank control values from analog and digital inputs. +@see PxVehicleDriveTankSmoothDigitalRawInputsAndSetAnalogInputs, PxVehicleDriveTankSmoothAnalogRawInputsAndSetAnalogInputs +*/ +class PX_DEPRECATED PxVehicleDriveTankRawInputData +{ +public: + + PxVehicleDriveTankRawInputData(const PxVehicleDriveTankControlModel::Enum mode) + : mMode(mode) + { + for(PxU32 i=0;iRange: (0,1)
+ */ + PxReal mPosX; + + /** + \brief y-coord of graph centre. + Range: (0,1)
+ */ + PxReal mPosY; + + /** + \brief x-extents of graph (from mPosX-0.5f*mSizeX to mPosX+0.5f*mSizeX). + Range: (0,1)
+ */ + PxReal mSizeX; + + /** + \brief y-extents of graph (from mPosY-0.5f*mSizeY to mPosY+0.5f*mSizeY). + Range: (0,1)
+ */ + PxReal mSizeY; + + /** + \brief Background color of graph. + */ + PxVec3 mBackgroundColor; + + /** + \brief Alpha value of background color. + */ + PxReal mAlpha; + +private: + + bool isValid() const; +}; + +struct PX_DEPRECATED PxVehicleGraphChannelDesc +{ +public: + + friend class PxVehicleGraph; + + PxVehicleGraphChannelDesc(); + + /** + \brief Data values less than mMinY will be clamped at mMinY. + */ + PxReal mMinY; + + /** + \brief Data values greater than mMaxY will be clamped at mMaxY. + */ + PxReal mMaxY; + + /** + \brief Data values greater than mMidY will be drawn with color mColorHigh. + Data values less than mMidY will be drawn with color mColorLow. + */ + PxReal mMidY; + + /** + \brief Color used to render data values lower than mMidY. + */ + PxVec3 mColorLow; + + /** + \brief Color used to render data values greater than mMidY. + */ + PxVec3 mColorHigh; + + /** + \brief String to describe data channel. + */ + char* mTitle; + +private: + + bool isValid() const; +}; + +struct PX_DEPRECATED PxVehicleWheelGraphChannel +{ + enum Enum + { + eJOUNCE=0, + eSUSPFORCE, + eTIRELOAD, + eNORMALIZED_TIRELOAD, + eWHEEL_OMEGA, + eTIRE_FRICTION, + eTIRE_LONG_SLIP, + eNORM_TIRE_LONG_FORCE, + eTIRE_LAT_SLIP, + eNORM_TIRE_LAT_FORCE, + eNORM_TIRE_ALIGNING_MOMENT, + eMAX_NB_WHEEL_CHANNELS + }; +}; + +struct PX_DEPRECATED PxVehicleDriveGraphChannel +{ + enum Enum + { + eENGINE_REVS=0, + eENGINE_DRIVE_TORQUE, + eCLUTCH_SLIP, + eACCEL_CONTROL, //TANK_ACCEL + eBRAKE_CONTROL, //TANK_BRAKE_LEFT + eHANDBRAKE_CONTROL, //TANK_BRAKE_RIGHT + eSTEER_LEFT_CONTROL, //TANK_THRUST_LEFT + eSTEER_RIGHT_CONTROL, //TANK_THRUST_RIGHT + eGEAR_RATIO, + eMAX_NB_DRIVE_CHANNELS + }; +}; + +struct PX_DEPRECATED PxVehicleGraphType +{ + enum Enum + { + eWHEEL=0, + eDRIVE + }; +}; + + +class PX_DEPRECATED PxVehicleGraph +{ +public: + + friend class PxVehicleTelemetryData; + friend class PxVehicleUpdate; + + enum + { + eMAX_NB_SAMPLES=256 + }; + + enum + { + eMAX_NB_TITLE_CHARS=256 + }; + + enum + { + eMAX_NB_CHANNELS=12 + }; + + /** + \brief Setup a graph from a descriptor. + */ + void setup(const PxVehicleGraphDesc& desc, const PxVehicleGraphType::Enum graphType); + + /** + \brief Clear all data recorded in a graph. + */ + void clearRecordedChannelData(); + + /** + \brief Get the color of the graph background. Used for rendering a graph. + */ + const PxVec3& getBackgroundColor() const {return mBackgroundColor;} + + /** + \brief Get the alpha transparency of the color of the graph background. Used for rendering a graph. + */ + PxReal getBackgroundAlpha() const {return mBackgroundAlpha;} + + /** + \brief Get the coordinates of the graph background. Used for rendering a graph + + \param[out] xMin is the x-coord of the lower-left corner + \param[out] yMin is the y-coord of the lower-left corner + \param[out] xMax is the x-coord of the upper-right corner + \param[out] yMax is the y-coord of the upper-right corner + */ + void getBackgroundCoords(PxReal& xMin, PxReal& yMin, PxReal& xMax, PxReal& yMax) const {xMin = mBackgroundMinX;xMax = mBackgroundMaxX;yMin = mBackgroundMinY;yMax = mBackgroundMaxY;} + + /** + \brief Compute the coordinates of the graph data of a specific graph channel. + + \param[out] xy is an array of graph sample coordinates stored in order x0,y0,x1,y1,x2,y2...xn,yn. + \param[out] colors stores the color of each point on the graph. + \param[out] title is the title of the graph. + */ + void computeGraphChannel(const PxU32 channel, PxReal* xy, PxVec3* colors, char* title) const; + + /** + \brief Return the latest value stored in the specified graph channel + */ + PxF32 getLatestValue(const PxU32 channel) const ; + + /** + \brief Get the raw data of a specific graph channel. + + \param[in] channel is the ID of the graph channel to get data from. + \param[out] values is the buffer to write the data to. Minimum required size is eMAX_NB_SAMPLES. + */ + void getRawData(const PxU32 channel, PxReal* values) const; + +private: + + //Min and max of each sample. + PxReal mChannelMinY[eMAX_NB_CHANNELS]; + PxReal mChannelMaxY[eMAX_NB_CHANNELS]; + //Discriminate between high and low values with different colors. + PxReal mChannelMidY[eMAX_NB_CHANNELS]; + //Different colors for values than midY and less than midY. + PxVec3 mChannelColorLow[eMAX_NB_CHANNELS]; + PxVec3 mChannelColorHigh[eMAX_NB_CHANNELS]; + //Title of graph + char mChannelTitle[eMAX_NB_CHANNELS][eMAX_NB_TITLE_CHARS]; + //Graph data. + PxReal mChannelSamples[eMAX_NB_CHANNELS][eMAX_NB_SAMPLES]; + + //Background color,alpha,coords + PxVec3 mBackgroundColor; + PxReal mBackgroundAlpha; + PxReal mBackgroundMinX; + PxReal mBackgroundMaxX; + PxReal mBackgroundMinY; + PxReal mBackgroundMaxY; + + PxU32 mSampleTide; + + PxU32 mNbChannels; + + PxU32 mPad[2]; + + + void setup + (const PxF32 graphSizeX, const PxF32 graphSizeY, + const PxF32 engineGraphPosX, const PxF32 engineGraphPosY, + const PxF32* const wheelGraphPosX, const PxF32* const wheelGraphPosY, + const PxVec3& backgroundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow); + + void updateTimeSlice(const PxReal* const samples); + + void setChannel(PxVehicleGraphChannelDesc& desc, const PxU32 channel); + + void setupEngineGraph + (const PxF32 sizeX, const PxF32 sizeY, const PxF32 posX, const PxF32 posY, + const PxVec3& backgoundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow); + + void setupWheelGraph + (const PxF32 sizeX, const PxF32 sizeY, const PxF32 posX, const PxF32 posY, + const PxVec3& backgoundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow); + + PxVehicleGraph(); + ~PxVehicleGraph(); +}; +PX_COMPILE_TIME_ASSERT(PxU32(PxVehicleGraph::eMAX_NB_CHANNELS) >= PxU32(PxVehicleWheelGraphChannel::eMAX_NB_WHEEL_CHANNELS) && PxU32(PxVehicleGraph::eMAX_NB_CHANNELS) >= PxU32(PxVehicleDriveGraphChannel::eMAX_NB_DRIVE_CHANNELS)); +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleGraph) & 15)); + +class PX_DEPRECATED PxVehicleTelemetryData +{ +public: + + friend class PxVehicleUpdate; + + /** + \brief Allocate a PxVehicleNWTelemetryData instance for a vehicle with nbWheels + @see PxVehicleNWTelemetryDataFree + */ + static PxVehicleTelemetryData* allocate(const PxU32 nbWheels); + + /** + \brief Free a PxVehicleNWTelemetryData instance for a vehicle. + @see PxVehicleNWTelemetryDataAllocate + */ + void free(); + + /** + \brief Set up all the graphs so that they are ready to record data. + */ + void setup + (const PxReal graphSizeX, const PxReal graphSizeY, + const PxReal engineGraphPosX, const PxReal engineGraphPosY, + const PxReal* const wheelGraphPosX, const PxReal* const wheelGraphPosY, + const PxVec3& backGroundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow); + + /** + \brief Clear the graphs of recorded data. + */ + void clear(); + + /** + \brief Get the graph data for the engine + */ + const PxVehicleGraph& getEngineGraph() const {return *mEngineGraph;} + + /** + \brief Get the number of wheel graphs + */ + PxU32 getNbWheelGraphs() const {return mNbActiveWheels;} + + /** + \brief Get the graph data for the kth wheel + */ + const PxVehicleGraph& getWheelGraph(const PxU32 k) const {return mWheelGraphs[k];} + + /** + \brief Get the array of tire force application points so they can be rendered + */ + const PxVec3* getTireforceAppPoints() const {return mTireforceAppPoints;} + + /** + \brief Get the array of susp force application points so they can be rendered + */ + const PxVec3* getSuspforceAppPoints() const {return mSuspforceAppPoints;} + +private: + + /** + \brief Graph data for engine. + Used for storing single timeslices of debug data for engine graph. + @see PxVehicleGraph + */ + PxVehicleGraph* mEngineGraph; + + /** + \brief Graph data for each wheel. + Used for storing single timeslices of debug data for wheel graphs. + @see PxVehicleGraph + */ + PxVehicleGraph* mWheelGraphs; + + /** + \brief Application point of tire forces. + */ + PxVec3* mTireforceAppPoints; + + /** + \brief Application point of susp forces. + */ + PxVec3* mSuspforceAppPoints; + + /** + \brief Total number of active wheels + */ + PxU32 mNbActiveWheels; + + PxU32 mPad[3]; + +private: + + PxVehicleTelemetryData(){} + ~PxVehicleTelemetryData(){} +}; + +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTelemetryData) & 15)); + +#endif //PX_DEBUG_VEHICLE_ON + +//#endif // PX_DEBUG_VEHICLE_ON + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleWheels.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleWheels.h new file mode 100644 index 0000000..0004d64 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle/PxVehicleWheels.h @@ -0,0 +1,972 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_WHEELS_H +#define PX_VEHICLE_WHEELS_H + +#include "foundation/PxSimpleTypes.h" +#include "vehicle/PxVehicleShaders.h" +#include "vehicle/PxVehicleComponents.h" +#include "common/PxBase.h" +#include "PxRigidDynamic.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxVehicleWheels4SimData; +class PxVehicleWheels4DynData; +class PxVehicleTireForceCalculator; +class PxShape; +class PxPhysics; +class PxMaterial; + +/** +\brief Flags to configure the vehicle wheel simulation. + +@see PxVehicleWheelsSimData::setFlags(), PxVehicleWheelsSimData::getFlags() +*/ +struct PX_DEPRECATED PxVehicleWheelsSimFlag +{ + enum Enum + { + /** + \brief Limit the suspension expansion velocity. + + For extreme damping ratios, large damping forces might result in the vehicle sticking to the ground where + one would rather expect to see the vehicle lift off. While it is highly recommended to use somewhat realistic + damping ratios, this flag can be used to limit the velocity of the suspension. In more detail, the simulation + will check whether the suspension can extend to the target length in the given simulation time step. If that + is the case, the suspension force will be computed as usual, else the force will be set to zero. Enabling + this feature gives a slightly more realisitic behavior at the potential cost of more easily losing control + when steering the vehicle. + */ + eLIMIT_SUSPENSION_EXPANSION_VELOCITY = (1 << 0), + + /** + \brief Disable internal cylinder-plane intersection test. + + By default the internal code runs a post-process on sweep results, approximating the wheel shape with a + cylinder and tweaking the sweep hit results accordingly. This can produce artefacts in certain cases, in + particular when the swept shape is very different from a cylinder - e.g. with swept spheres. This flag + tells the system to disable this internal test, and reuse the direct user-provided sweep results. + + The default code refines the sweep results in each substep. Enabling this flag makes the system partially + reuse the same sweep results over each substep, which could potentially create other artefacts. + */ + eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST = (1 << 1), + + /** + \brief Disable suspension force projection. + + By default the internal code modulates the suspension force with the contact normal, i.e. the more the contact + normal is aligned with the suspension direction, the bigger the force. This can create issues when using a + single blocking hit, whose unique contact normal sometimes does not accurately capture the reality of the + surrounding geometry. For example it can weaken the suspension force too much, which visually makes the wheel + move up and down against e.g. a kerb. Enabling this flag tells the system to disable the modulation of the + suspension force by the contact normal. + + The rationale is that a real tire has a deformed contact patch containing multiple normals, and even if some + of these normals are bent when colliding against a kerb, there would still be a large area of the contact patch + touching the ground, and getting normals aligned with the suspension. This is difficult to capture with simple + sweep results, especially with a single sweep hit whose normal is computed by a less than accurate algorithm + like GJK. Using this flag shortcuts these issues, which can improves the behavior when driving over kerbs or + small obstacles. + */ + eDISABLE_SUSPENSION_FORCE_PROJECTION = (1 << 2), + + /** + \brief Disable check for sprung mass values summing up to chassis mass. + + Generally, the sum of the suspension sprung mass values should match the chassis mass. However, there can be + scenarios where this is not necessarily desired. Taking a semi-trailer truck as an example, a large part of + the trailer mass will rest on the tractor unit and not the trailer wheels. This flag allows the user to set + the values as desired without error messages being sent. + */ + eDISABLE_SPRUNG_MASS_SUM_CHECK = (1 << 3) + }; +}; + +/** +\brief Collection of set bits defined in #PxVehicleWheelsSimFlag. + +@see PxVehicleWheelsSimFlag +*/ +PX_DEPRECATED typedef PxFlags PxVehicleWheelsSimFlags; +PX_FLAGS_OPERATORS(PxVehicleWheelsSimFlag::Enum, PxU32) + +/** +\brief Data structure describing configuration data of a vehicle with up to 20 wheels. +*/ + +class PX_DEPRECATED PxVehicleWheelsSimData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleWheels; + friend class PxVehicleNoDrive; + friend class PxVehicleDrive4W; + friend class PxVehicleDriveTank; + friend class PxVehicleUpdate; + + /** + \brief Allocate a PxVehicleWheelsSimData instance for with nbWheels. + @see free + */ + static PxVehicleWheelsSimData* allocate(const PxU32 nbWheels); + + /** + \brief Setup with mass information that can be applied to the default values of the suspensions, wheels, and tires + set in their respective constructors. + + \param chassisMass is the mass of the chassis. + + \note This function assumes that the suspensions equally share the load of the chassis mass. It also + assumes that the suspension will have a particular natural frequency and damping ratio that is typical + of a standard car. If either of these assumptions is broken then each suspension will need to + be individually configured with custom strength, damping rate, and sprung mass. + + @see allocate + */ + void setChassisMass(const PxF32 chassisMass); + + /** + \brief Free a PxVehicleWheelsSimData instance + @see allocate + */ + void free(); + + /** + \brief Copy wheel simulation data. + \note The number of wheels on both instances of PxVehicleWheelsSimData must match. + */ + PxVehicleWheelsSimData& operator=(const PxVehicleWheelsSimData& src); + + /** + \brief Copy the data of a single wheel unit (wheel, suspension, tire) from srcWheel of src to trgWheel. + \param[in] src is the data to be copied. + \param[in] srcWheel is the wheel whose data will be copied from src. + \param[in] trgWheel is the wheel that will be assigned the copied data. + */ + void copy(const PxVehicleWheelsSimData& src, const PxU32 srcWheel, const PxU32 trgWheel); + + /** + \brief Return the number of wheels + @see allocate + */ + PxU32 getNbWheels() const {return mNbActiveWheels;} + + /** + \brief Return the suspension data of the idth wheel + */ + const PxVehicleSuspensionData& getSuspensionData(const PxU32 id) const; + + /** + \brief Return the wheel data of the idth wheel + */ + const PxVehicleWheelData& getWheelData(const PxU32 id) const; + + /** + \brief Return the tire data of the idth wheel + */ + const PxVehicleTireData& getTireData(const PxU32 id) const; + + /** + \brief Return the direction of travel of the suspension of the idth wheel + */ + const PxVec3& getSuspTravelDirection(const PxU32 id) const; + + /** + \brief Return the application point of the suspension force of the suspension of the idth wheel as an offset from the rigid body center of mass. + \note Specified relative to the center of mass of the rigid body + */ + const PxVec3& getSuspForceAppPointOffset(const PxU32 id) const; + + /** + \brief Return the application point of the tire force of the tire of the idth wheel as an offset from the rigid body center of mass. + \note Specified relative to the centre of mass of the rigid body + */ + const PxVec3& getTireForceAppPointOffset(const PxU32 id) const; + + /** + \brief Return the offset from the rigid body centre of mass to the centre of the idth wheel. + */ + const PxVec3& getWheelCentreOffset(const PxU32 id) const; + + /** + \brief Return the wheel mapping for the ith wheel. + + \note The return value is the element in the array of + shapes of the vehicle's PxRigidDynamic that corresponds to the ith wheel. A return value of -1 means + that the wheel is not mapped to a PxShape. + + @see PxRigidActor.getShapes + */ + PxI32 getWheelShapeMapping(const PxU32 wheelId) const; + + /** + \brief Return the scene query filter data used by the specified suspension line + */ + const PxFilterData& getSceneQueryFilterData(const PxU32 suspId) const; + + /** + \brief Return the number of unique anti-roll bars that have been added with addAntiRollBarData + @see PxVehicleWheelsSimData::addAntiRollBarData + */ + PxU32 getNbAntiRollBars() const + { + return mNbActiveAntiRollBars; + } + + /** + \brief Return a specific anti-roll bar. + \param antiRollId is the unique id of the anti-roll bar + \note The return value of addAntiRollBarData is a unique id for that specific anti-roll bar + and can be used as input parameter for getAntiRollBarData in order to query the same anti-roll bar. + Alternatively, it is possible to iterate over all anti-roll bars by choosing antiRollId + in range (0, getNbAntiRollBars()). + */ + const PxVehicleAntiRollBarData& getAntiRollBarData(const PxU32 antiRollId) const; + + /** + \brief Return the data that describes the filtering of the tire load to produce smoother handling at large time-steps. + */ + PX_FORCE_INLINE const PxVehicleTireLoadFilterData& getTireLoadFilterData() const + { + return mNormalisedLoadFilter; + } + + /** + \brief Set the suspension data of the idth wheel + \param[in] id is the wheel index. + \param[in] susp is the suspension data to be applied. + */ + void setSuspensionData(const PxU32 id, const PxVehicleSuspensionData& susp); + + /** + \brief Set the wheel data of the idth wheel + \param[in] id is the wheel index. + \param[in] wheel is the wheel data to be applied. + */ + void setWheelData(const PxU32 id, const PxVehicleWheelData& wheel); + + /** + \brief Set the tire data of the idth wheel + \param[in] id is the wheel index. + \param[in] tire is the tire data to be applied. + */ + void setTireData(const PxU32 id, const PxVehicleTireData& tire); + + /** + \brief Set the direction of travel of the suspension of the idth wheel + \param[in] id is the wheel index + \param[in] dir is the suspension travel direction to be applied. + */ + void setSuspTravelDirection(const PxU32 id, const PxVec3& dir); + + /** + \brief Set the application point of the suspension force of the suspension of the idth wheel. + \param[in] id is the wheel index + \param[in] offset is the offset from the rigid body center of mass to the application point of the suspension force. + \note Specified relative to the centre of mass of the rigid body + */ + void setSuspForceAppPointOffset(const PxU32 id, const PxVec3& offset); + + /** + \brief Set the application point of the tire force of the tire of the idth wheel. + \param[in] id is the wheel index + \param[in] offset is the offset from the rigid body center of mass to the application point of the tire force. + \note Specified relative to the centre of mass of the rigid body + */ + void setTireForceAppPointOffset(const PxU32 id, const PxVec3& offset); + + /** + \brief Set the offset from the rigid body centre of mass to the centre of the idth wheel. + \param[in] id is the wheel index + \param[in] offset is the offset from the rigid body center of mass to the center of the wheel at rest. + \note Specified relative to the centre of mass of the rigid body + */ + void setWheelCentreOffset(const PxU32 id, const PxVec3& offset); + + /** + \brief Set mapping between wheel id and position of corresponding wheel shape in the list of actor shapes. + + \note This mapping is used to pose the correct wheel shapes with the latest wheel rotation angle, steer angle, and suspension travel + while allowing arbitrary ordering of the wheel shapes in the actor's list of shapes. + + \note Use setWheelShapeMapping(i,-1) to register that there is no wheel shape corresponding to the ith wheel + + \note Set setWheelShapeMapping(i,k) to register that the ith wheel corresponds to the kth shape in the actor's list of shapes. + + \note The default values correspond to setWheelShapeMapping(i,i) for all wheels. + + \note Calling this function will also pose the relevant PxShape at the rest position of the wheel. + + \param wheelId is the wheel index + + \param shapeId is the shape index. + + @see PxVehicleUpdates, PxVehicleDrive4W::setup, PxVehicleDriveTank::setup, PxVehicleNoDrive::setup, setSceneQueryFilterData, PxRigidActor::getShapes + */ + void setWheelShapeMapping(const PxU32 wheelId, const PxI32 shapeId); + + /** + \brief Set the scene query filter data that will be used for raycasts along the travel + direction of the specified suspension. The default value is PxFilterData(0,0,0,0) + \param suspId is the wheel index + \param sqFilterData is the raycast filter data for the suspension raycast. + @see setWheelShapeMapping + */ + void setSceneQueryFilterData(const PxU32 suspId, const PxFilterData& sqFilterData); + + /** + \brief Set the data that describes the filtering of the tire load to produce smoother handling at large timesteps. + \param tireLoadFilter is the smoothing function data. + */ + void setTireLoadFilterData(const PxVehicleTireLoadFilterData& tireLoadFilter); + + /** + \brief Set the anti-roll suspension for a pair of wheels. + + \param antiRoll is the anti-roll suspension. + + \note If an anti-roll bar has already been set for the same logical wheel pair + (independent of wheel index order specified by PxVehicleAntiRollBar.mWheel0 and PxVehicleAntiRollBar.mWheel0) + then the existing anti-roll bar is updated with a new stiffness parameter antiRoll.mStiffness. + + \note If the wheel pair specified by antiRoll does not yet have an anti-roll bar then antiRoll is added to + a list of anti-roll bars for the vehicle. + + \return If antiRoll represents a new wheel pair then a unique id is assigned to the anti-roll bar and returned. + If antiRoll represents an existing wheel pair then the unique id of the existing anti-roll bar is returned. + The return value is always in range (0, getNbAntiRollBars()). + + \note The return value can be used to query the anti-roll bar with getAntiRollBarData(id). + + \note The number of possible anti-roll bars is limited to half the wheel count. + + \note An existing anti-roll bar can be disabled by calling antiRoll.mStiffness to zero. + + @see PxVehicleWheelsSimData::getAntiRollBarData, PxVehicleAntiRollBarData + */ + PxU32 addAntiRollBarData(const PxVehicleAntiRollBarData& antiRoll); + + /** + \brief Disable a wheel so that zero suspension forces and zero tire forces are applied to the rigid body from this wheel. + + \note If the vehicle has a differential (PxVehicleNW/PxVehicle4W) then the differential (PxVehicleDifferentialNWData/PxVehicleDifferential4WData) + needs to be configured so that no drive torque is delivered to the disabled wheel. + + \note If the vehicle is of type PxVehicleNoDrive then zero drive torque must be applied to the disabled wheel. + + \note For tanks (PxVehicleDriveTank) any drive torque that could be delivered to the wheel through the tank differential will be + re-directed to the remaining enabled wheels. + + @see enableWheel + @see PxVehicleDifferentialNWData::setDrivenWheel + @see PxVehicleDifferential4WData::mFrontLeftRightSplit, PxVehicleDifferential4WData::mRearLeftRightSplit, PxVehicleDifferential4WData::mType + @see PxVehicleNoDrive::setDriveTorque + @see PxVehicle4WEnable3WTadpoleMode, PxVehicle4WEnable3WDeltaMode + + \note If a PxShape is associated with the disabled wheel then the association must be broken by calling setWheelShapeMapping(wheelId, -1). + @see setWheelShapeMapping + + \note A wheel that is disabled must also simultaneously be given zero wheel rotation speed. + @see PxVehicleWheelsDynData::setWheelRotationSpeed + + \note Care must be taken with the sprung mass supported by the remaining enabled wheels. Depending on the desired effect, the mass of the rigid body + might need to be distributed among the remaining enabled wheels and suspensions. + + \param[in] wheel is the wheel index. + */ + void disableWheel(const PxU32 wheel); + + /** + \brief Enable a wheel so that suspension forces and tire forces are applied to the rigid body. + All wheels are enabled by default and remain enabled until they are disabled. + \param[in] wheel is the wheel index. + @see disableWheel + */ + void enableWheel(const PxU32 wheel); + + /** + \brief Test if a wheel has been disabled. + \param[in] wheel is the wheel index. + */ + bool getIsWheelDisabled(const PxU32 wheel) const; + + /** + \brief Set the number of vehicle sub-steps that will be performed when the vehicle's longitudinal + speed is below and above a threshold longitudinal speed. + + \note More sub-steps provides better stability but with greater computational cost. + + \note Typically, vehicles require more sub-steps at very low forward speeds. + + \note The threshold longitudinal speed has a default value that is the equivalent of 5 metres per second after accounting for + the length scale set in PxTolerancesScale. + + \note The sub-step count below the threshold longitudinal speed has a default of 3. + + \note The sub-step count above the threshold longitudinal speed has a default of 1. + + \note Each sub-step has time advancement equal to the time-step passed to PxVehicleUpdates divided by the number of required sub-steps. + + \note The contact planes of the most recent suspension line raycast are reused across all sub-steps. + + \note Each sub-step computes tire and suspension forces and then advances a velocity, angular velocity and transform. + + \note At the end of all sub-steps the vehicle actor is given the velocity and angular velocity that would move the actor from its start transform prior + to the first sub-step to the transform computed at the end of the last substep, assuming it doesn't collide with anything along the way in the next PhysX SDK update. + + \note The global pose of the actor is left unchanged throughout the sub-steps. + + \param[in] thresholdLongitudinalSpeed is a threshold speed that is used to categorize vehicle speed as low speed or high speed. + \param[in] lowForwardSpeedSubStepCount is the number of sub-steps performed in PxVehicleUpates for vehicles that have longitudinal speed lower than thresholdLongitudinalSpeed. + \param[in] highForwardSpeedSubStepCount is the number of sub-steps performed in PxVehicleUpdates for vehicles that have longitudinal speed graeter than thresholdLongitudinalSpeed. + */ + void setSubStepCount(const PxReal thresholdLongitudinalSpeed, const PxU32 lowForwardSpeedSubStepCount, const PxU32 highForwardSpeedSubStepCount); + + /** + \brief Set the minimum denominator used in the longitudinal slip calculation. + + \note The longitudinal slip has a theoretical value of (w*r - vz)/|vz|, where w is the angular speed of the wheel; r is the radius of the wheel; + and vz is the component of rigid body velocity (computed at the wheel base) that lies along the longitudinal wheel direction. The term |vz| + normalizes the slip, while preserving the sign of the longitudinal tire slip. The difficulty here is that when |vz| approaches zero the + longitudinal slip approaches infinity. A solution to this problem is to replace the denominator (|vz|) with a value that never falls below a chosen threshold. + The longitudinal slip is then calculated with (w*r - vz)/PxMax(|vz|, minLongSlipDenominator). + + \note The default value is the equivalent of 4 metres per second after accounting for the length scale set in PxTolerancesScale. + + \note Adjust this value upwards if a vehicle has difficulty coming to rest. + + \note Decreasing the timestep (or increasing the number of sub-steps at low longitudinal speed with setSubStepCount) should allow stable stable + behavior with smaller values of minLongSlipDenominator. + */ + void setMinLongSlipDenominator(const PxReal minLongSlipDenominator); + + /** + \brief Set the vehicle wheel simulation flags. + + \param[in] flags The flags to set (see #PxVehicleWheelsSimFlags). + + Default: no flag set + + @see PxVehicleWheelsSimFlag + */ + void setFlags(PxVehicleWheelsSimFlags flags); + + /** + \brief Return the vehicle wheel simulation flags. + + \return The values of the flags. + + @see PxVehicleWheelsSimFlag + */ + PxVehicleWheelsSimFlags getFlags() const; + +private: + + /** + \brief Graph to filter normalised load + @see setTireLoadFilterData, getTireLoadFilterData + */ + PxVehicleTireLoadFilterData mNormalisedLoadFilter; + + /** + \brief Wheels data organised in blocks of 4 wheels. + */ + PxVehicleWheels4SimData* mWheels4SimData; + + /** + \brief Number of blocks of 4 wheels. + */ + PxU32 mNbWheels4; + + /** + \brief Number of actual wheels (<=(mNbWheels4*4)) + */ + PxU32 mNbActiveWheels; + + /** + \brief Anti-roll bars + */ + PxVehicleAntiRollBarData* mAntiRollBars; + + /** + \brief 2 anti-rollbars allocated for each block of 4 wheels. + */ + PxU32 mNbAntiRollBars4; + + /** + \brief Number of active anti-roll bars. + */ + PxU32 mNbActiveAntiRollBars; + + /** + \brief Which of the mNbActiveWheels are active or disabled? + The default is that all mNbActiveWheels wheels are active. + */ + PxU32 mActiveWheelsBitmapBuffer[((PX_MAX_NB_WHEELS + 31) & ~31) >> 5]; + + /** + \brief Threshold longitudinal speed used to decide whether to use + mLowForwardSpeedSubStepCount or mHighForwardSpeedSubStepCount as the + number of sub-steps that will be peformed. + */ + PxF32 mThresholdLongitudinalSpeed; + + /** + \brief Number of sub-steps that will be performed if the longitudinal speed + of the vehicle is smaller than mThresholdLongitudinalSpeed. + */ + PxU32 mLowForwardSpeedSubStepCount; + + /** + \brief Number of sub-steps that will be performed if the longitudinal speed + of the vehicle is greater than or equal to mThresholdLongitudinalSpeed. + */ + PxU32 mHighForwardSpeedSubStepCount; + + /** + \brief Minimum long slip denominator + */ + PxF32 mMinLongSlipDenominator; + + /** + \brief The vehicle wheel simulation flags. + + @see PxVehicleWheelsSimFlags + */ + PxU32 mFlags; + +#if PX_P64_FAMILY + PxU32 mPad[1]; +#endif + + /** + \brief Test if wheel simulation data has been setup with legal values. + */ + bool isValid() const; + + /** + \brief see PxVehicleWheels::allocate + */ + static PxU32 computeByteSize(const PxU32 numWheels); + static PxU8* patchUpPointers(const PxU32 numWheels, PxVehicleWheelsSimData* simData, PxU8* ptrIn); + PxVehicleWheelsSimData(const PxU32 numWheels); + +//serialization +public: + PxVehicleWheelsSimData(const PxEMPTY) : mNormalisedLoadFilter(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + PxU32 getNbWheels4() const { return mNbWheels4; } + PxU32 getNbSuspensionData() const { return mNbActiveWheels; } + PxU32 getNbWheelData() const { return mNbActiveWheels; } + PxU32 getNbSuspTravelDirection() const { return mNbActiveWheels; } + PxU32 getNbTireData() const { return mNbActiveWheels; } + PxU32 getNbSuspForceAppPointOffset() const { return mNbActiveWheels; } + PxU32 getNbTireForceAppPointOffset() const { return mNbActiveWheels; } + PxU32 getNbWheelCentreOffset() const { return mNbActiveWheels; } + PxU32 getNbWheelShapeMapping() const { return mNbActiveWheels; } + PxU32 getNbSceneQueryFilterData() const { return mNbActiveWheels; } + PxF32 getMinLongSlipDenominator() const {return mMinLongSlipDenominator;} + void setThresholdLongSpeed(const PxF32 f) {mThresholdLongitudinalSpeed = f;} + PxF32 getThresholdLongSpeed() const {return mThresholdLongitudinalSpeed;} + void setLowForwardSpeedSubStepCount(const PxU32 f) {mLowForwardSpeedSubStepCount = f;} + PxU32 getLowForwardSpeedSubStepCount() const {return mLowForwardSpeedSubStepCount;} + void setHighForwardSpeedSubStepCount(const PxU32 f) {mHighForwardSpeedSubStepCount = f;} + PxU32 getHighForwardSpeedSubStepCount() const {return mHighForwardSpeedSubStepCount;} + void setWheelEnabledState(const PxU32 wheel, const bool state) {if(state) {enableWheel(wheel);} else {disableWheel(wheel);}} + bool getWheelEnabledState(const PxU32 wheel) const {return !getIsWheelDisabled(wheel);} + PxU32 getNbWheelEnabledState() const {return mNbActiveWheels;} + PxU32 getNbAntiRollBars4() const { return mNbAntiRollBars4; } + PxU32 getNbAntiRollBarData() const {return mNbActiveAntiRollBars;} + void setAntiRollBarData(const PxU32 id, const PxVehicleAntiRollBarData& antiRoll); + PxVehicleWheelsSimData(){} + ~PxVehicleWheelsSimData(){} +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheelsSimData) & 15)); + + +/** +\brief Description of the per wheel intersection method to be used by PxVehicleWheelsDynData::setTireContacts() +*/ +struct PX_DEPRECATED PxTireContactIntersectionMethod +{ + enum Enum + { + eRAY = 0, + eCYLINDER + }; +}; + +/** +\brief Data structure with instanced dynamics data for wheels +*/ +class PX_DEPRECATED PxVehicleWheelsDynData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleWheels; + friend class PxVehicleDrive4W; + friend class PxVehicleDriveTank; + friend class PxVehicleUpdate; + + PxVehicleWheelsDynData(){} + ~PxVehicleWheelsDynData(){} + + /** + \brief Set all wheels to their rest state. + @see setup + */ + void setToRestState(); + + /** + \brief Set the tire force shader function + \param[in] tireForceShaderFn is the shader function that will be used to compute tire forces. + */ + void setTireForceShaderFunction(PxVehicleComputeTireForce tireForceShaderFn); + + /** + \brief Set the tire force shader data for a specific tire + \param[in] tireId is the wheel index + \param[in] tireForceShaderData is the data describing the tire. + */ + void setTireForceShaderData(const PxU32 tireId, const void* tireForceShaderData); + + /** + \brief Get the tire force shader data for a specific tire + */ + const void* getTireForceShaderData(const PxU32 tireId) const; + + /** + \brief Set the wheel rotation speed (radians per second) about the rolling axis for the specified wheel. + \param[in] wheelIdx is the wheel index + \param[in] speed is the rotation speed to be applied to the wheel. + */ + void setWheelRotationSpeed(const PxU32 wheelIdx, const PxReal speed); + + /** + \brief Return the rotation speed about the rolling axis of a specified wheel . + */ + PxReal getWheelRotationSpeed(const PxU32 wheelIdx) const; + + /** + \brief Set the wheel rotation angle (radians) about the rolling axis of the specified wheel. + \param[in] wheelIdx is the wheel index + \param[in] angle is the rotation angle to be applied to the wheel. + */ + void setWheelRotationAngle(const PxU32 wheelIdx, const PxReal angle); + + /** + \brief Return the rotation angle about the rolling axis for the specified wheel. + */ + PxReal getWheelRotationAngle(const PxU32 wheelIdx) const; + + /** + \brief Set the user data pointer for the specified wheel + It has a default value of NULL. + \param[in] tireIdx is the wheel index + \param[in] userData is the data to be associated with the wheel. + */ + void setUserData(const PxU32 tireIdx, void* userData); + + /** + \brief Get the user data pointer that was set for the specified wheel + */ + void* getUserData(const PxU32 tireIdx) const; + + /** + \brief Copy the dynamics data of a single wheel unit (wheel, suspension, tire) from srcWheel of src to trgWheel. + \param[in] src is the data to be copied. + \param[in] srcWheel is the wheel whose data will be copied from src. + \param[in] trgWheel is the wheel that will be assigned the copied data. + */ + void copy(const PxVehicleWheelsDynData& src, const PxU32 srcWheel, const PxU32 trgWheel); + + /** + \brief Directly set tire contact plane and friction for all tires on the vehicle as an alternative to using PxVehicleSuspensionSweeps() or PxVehicleSuspensionRaycasts(). + \param[in] nbHits is an array describing whether each tire has a contact plane or not. Each element of the array is either 0 (no contact) or 1 (contact). + \param[in] contactPlanes is an array of contact planes describing the contact plane per tire. + \param[in] contactFrictions is the friction value of each tire contact with the drivable surface. + \param[in] intersectionMethods describes how each tire will individually interact with its contact plane in order to compute the spring + compression that places the tire on the contact plane. A value of eCYLINDER will compute the spring compression by intersecting the wheel's + cylindrical shape with the contact plane. A value of eRAY will compute the spring compression by casting a ray through the wheel center + and along the suspension direction until it hits the contact plane. + \param[in] nbWheels is the length of the arrays nbContacts, contactPlanes, contactFrictions and intersectionMethods. + \note Each contact plane (n, d) obeys the rule that all points P on the plane satisfy n.dot(P) + d = 0.0. + \note The contact planes specified by setTireContacts() will persist as driving surfaces until either the next call to setTireContacts() or the next call to + \note The friction values are scaled by PxVehicleTireData::mFrictionVsSlipGraph before being applied to the tire. + \note The vehicle model assumes that the tire contacts are with static objects. + PxVehicleSuspensionSweeps() or PxVehicleSuspensionRaycasts(). + */ + void setTireContacts(const PxU32* nbHits, const PxPlane* contactPlanes, const PxReal* contactFrictions, const PxTireContactIntersectionMethod::Enum* intersectionMethods, const PxU32 nbWheels); + +private: + + /** + \brief Dynamics data arranged in blocks of 4 wheels. + */ + PxVehicleWheels4DynData* mWheels4DynData; + + /** + \brief Test if wheel dynamics data have legal values. + */ + bool isValid() const; + + /** + \brief Shader data and function for tire force calculations. + */ + PxVehicleTireForceCalculator* mTireForceCalculators; + + /** + \brief A userData pointer can be stored for each wheel. + @see setUserData, getUserData + */ + void** mUserDatas; + + /** + \brief Number of blocks of 4 wheels. + */ + PxU32 mNbWheels4; + + /** + \brief Number of wheels (mNbActiveWheels <= (mNbWheels4*4)) + */ + PxU32 mNbActiveWheels; + + PxU32 mPad[3]; + + /** + \brief see PxVehicleWheels::allocate + */ + static PxU32 computeByteSize(const PxU32 numWheels); + static PxU8* patchUpPointers(const PxU32 numWheels, PxVehicleWheelsDynData* dynData, PxU8* ptr); + PxVehicleWheelsDynData(const PxU32 numWheels); + +//serialization +public: + static void getBinaryMetaData(PxOutputStream& stream); + PxU32 getNbWheelRotationSpeed() const { return mNbActiveWheels; } + PxU32 getNbWheelRotationAngle() const { return mNbActiveWheels; } + PxVehicleWheels4DynData* getWheel4DynData() const { return mWheels4DynData; } +//~serialization + + /** + \brief Retrieve the number of PxConstraint objects associated with the vehicle. + + You can use #getConstraints() to retrieve the constraint pointers. + + \return Number of constraints associated with this vehicle. + + @see PxConstraint getConstraints() + */ + PxU32 getNbConstraints() const { return mNbWheels4; } + + /** + \brief Retrieve all the PxConstraint objects associated with the vehicle. + + There is one PxConstraint per block of 4 wheels. The count can be extracted through #getNbConstraints() + + \param[out] userBuffer The buffer to store the constraint pointers. + \param[in] bufferSize Size of provided user buffer. + \param[in] startIndex Index of first constraint pointer to be retrieved + \return Number of constraint pointers written to the buffer. + + @see PxConstraint getNbConstraints() + */ + PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheelsDynData) & 15)); + +/** +\brief Data structure with instanced dynamics data and configuration data of a vehicle with just wheels +@see PxVehicleDrive, PxVehicleDrive4W, PxVehicleDriveTank +*/ +class PX_DEPRECATED PxVehicleWheels : public PxBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + friend class PxVehicleConstraintShader; + + /** + \brief Return the type of vehicle + @see PxVehicleTypes + */ + PX_FORCE_INLINE PxU32 getVehicleType() const {return mType;} + + /** + \brief Get non-const ptr to PxRigidDynamic instance that is the vehicle's physx representation + */ + PX_FORCE_INLINE PxRigidDynamic* getRigidDynamicActor() {return mActor;} + + /** + \brief Get const ptr to PxRigidDynamic instance that is the vehicle's physx representation + */ + PX_FORCE_INLINE const PxRigidDynamic* getRigidDynamicActor() const {return mActor;} + + /** + \brief Compute the rigid body velocity component along the forward vector of the rigid body transform. + + \param[in] forwardAxis The axis denoting the local space forward direction of the vehicle. + + @see PxVehicleSetBasisVectors + */ + PxReal computeForwardSpeed(const PxVec3& forwardAxis = PxVehicleGetDefaultContext().forwardAxis) const; + + /** + \brief Compute the rigid body velocity component along the right vector of the rigid body transform. + + \param[in] sideAxis The axis denoting the local space side direction of the vehicle. + + @see PxVehicleSetBasisVectors + */ + PxReal computeSidewaysSpeed(const PxVec3& sideAxis = PxVehicleGetDefaultContext().sideAxis) const; + + /** + \brief Data describing the setup of all the wheels/suspensions/tires. + */ + PxVehicleWheelsSimData mWheelsSimData; + + /** + \brief Data describing the dynamic state of all wheels/suspension/tires. + */ + PxVehicleWheelsDynData mWheelsDynData; + +protected: + + /** + \brief Set all wheels to their rest state + */ + void setToRestState(); + + /** + \brief Test that all configuration and instanced dynamics data is valid. + */ + bool isValid() const; + + /** + @see PxVehicleDrive4W::allocate, PxVehicleDriveTank::allocate + */ + static PxU32 computeByteSize(const PxU32 nbWheels); + static PxU8* patchupPointers(const PxU32 nbWheels, PxVehicleWheels* vehWheels, PxU8* ptr); + virtual void init(const PxU32 numWheels); + + /** + \brief Deallocate a PxVehicleWheels instance. + @see PxVehicleDrive4W::free, PxVehicleDriveTank::free + */ + void free(); + + /* + \brief Deferred deletion. + */ + void onConstraintRelease(); + + /** + @see PxVehicleDrive4W::setup, PxVehicleDriveTank::setup + */ + void setup + (PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, + const PxU32 nbDrivenWheels, const PxU32 nbNonDrivenWheels); + + /** + \brief The rigid body actor that represents the vehicle in the PhysX SDK. + */ + PxRigidDynamic* mActor; + +private: + + /** + \brief Count the number of constraint connectors that have hit their callback when deleting a vehicle. + Can only delete the vehicle's memory when all constraint connectors have hit their callback. + */ + PxU32 mNbNonDrivenWheels; + + PxU8 mOnConstraintReleaseCounter; + +protected: + + /** + \brief Vehicle type (eVehicleDriveTypes) + */ + PxU8 mType; + +#if PX_P64_FAMILY + PxU8 mPad0[14]; +#else + PxU8 mPad0[8]; +#endif + +//serialization +public: + virtual void requiresObjects(PxProcessPxBaseCallback& c); + virtual const char* getConcreteTypeName() const { return "PxVehicleWheels"; } + virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleWheels", name) || PxBase::isKindOf(name); } + virtual void preExportDataReset() {} + virtual void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext&); + void resolveReferences(PxDeserializationContext&); + static void getBinaryMetaData(PxOutputStream& stream); + PX_FORCE_INLINE PxU32 getNbNonDrivenWheels() const { return mNbNonDrivenWheels; } + PxVehicleWheels(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {} + PxVehicleWheels(PxBaseFlags baseFlags) : PxBase(baseFlags), mWheelsSimData(PxEmpty) {} + virtual ~PxVehicleWheels() {} + virtual void release() { free(); } +//~serialization +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheels) & 15)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleAPI.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleAPI.h new file mode 100644 index 0000000..922a5f1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleAPI.h @@ -0,0 +1,147 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/PxVehicleComponent.h" +#include "vehicle2/PxVehicleComponentSequence.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleMaths.h" + +#include "vehicle2/braking/PxVehicleBrakingParams.h" +#include "vehicle2/braking/PxVehicleBrakingFunctions.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainComponents.h" + +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorHelpers.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorFunctions.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorComponents.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h" + +#include "vehicle2/pvd/PxVehiclePvdHelpers.h" +#include "vehicle2/pvd/PxVehiclePvdFunctions.h" +#include "vehicle2/pvd/PxVehiclePvdComponents.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyComponents.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" + +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/steering/PxVehicleSteeringFunctions.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" +#include "vehicle2/suspension/PxVehicleSuspensionFunctions.h" +#include "vehicle2/suspension/PxVehicleSuspensionComponents.h" + +#include "vehicle2/tire/PxVehicleTireParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" +#include "vehicle2/tire/PxVehicleTireHelpers.h" +#include "vehicle2/tire/PxVehicleTireFunctions.h" +#include "vehicle2/tire/PxVehicleTireComponents.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" +#include "vehicle2/wheel/PxVehicleWheelFunctions.h" +#include "vehicle2/wheel/PxVehicleWheelComponents.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + /** \brief Initialize the PhysX Vehicle library. + + This should be called before calling any functions or methods in extensions which may require allocation. + \note This function does not need to be called before creating a PxDefaultAllocator object. + + \param foundation a PxFoundation object + + @see PxCloseVehicleExtension PxFoundation + */ + PX_FORCE_INLINE bool PxInitVehicleExtension(physx::PxFoundation& foundation) + { + PX_UNUSED(foundation); + PX_CHECK_AND_RETURN_VAL(&PxGetFoundation() == &foundation, "Supplied foundation must match the one that will be used to perform allocations", false); + PxIncFoundationRefCount(); + return true; + } + + /** \brief Shut down the PhysX Vehicle library. + + This function should be called to cleanly shut down the PhysX Vehicle library before application exit. + + \note This function is required to be called to release foundation usage. + + @see PxInitVehicleExtension + */ + PX_FORCE_INLINE void PxCloseVehicleExtension() + { + PxDecFoundationRefCount(); + } + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponent.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponent.h new file mode 100644 index 0000000..0e2d5f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponent.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +struct PxVehicleSimulationContext; + +class PxVehicleComponent +{ +public: + + virtual ~PxVehicleComponent() {} + + /** + \brief Update function for a vehicle component. + + \param[in] dt The timestep size to use for the update step. + \param[in] context Vehicle simulation context holding global data or data that usually applies to a + large group of vehicles. + \return True if subsequent components in a sequence should get updated, false if the sequence should + be aborted. + + @see PxVehicleComponentSequence + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) = 0; + +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponentSequence.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponentSequence.h new file mode 100644 index 0000000..8ddb99a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleComponentSequence.h @@ -0,0 +1,326 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ +#include "foundation/PxAssert.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundation.h" +#include "PxVehicleComponent.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +struct PxVehicleComponentSequenceLimits +{ + enum Enum + { + eMAX_NB_SUBGROUPS = 16, + eMAX_NB_COMPONENTS = 64, + eMAX_NB_SUBGROUPELEMENTS = eMAX_NB_SUBGROUPS + eMAX_NB_COMPONENTS + }; +}; + +struct PxVehicleComponentSequence +{ + enum + { + eINVALID_SUBSTEP_GROUP = 0xff + }; + + PxVehicleComponentSequence() + : mNbComponents(0), mNbSubgroups(1), mNbSubGroupElements(0), mActiveSubgroup(0) + { + } + + /** + \brief Add a component to the sequence. + + \param[in] component The component to add to the sequence. + \return True on success, else false (for example due to component count limit being reached). + */ + PX_FORCE_INLINE bool add(PxVehicleComponent* component); + + /** + \brief Start a substepping group. + \note All components added using #add() will be added to the new substepping group until either the group + is marked as complete with a call to #endSubstepGroup() or a subsequent substepping group is started with + a call to #beginSubstepGroup(). + \note Groups can be nested with stacked calls to #beginSubstepGroup(). + \note Each group opened by #beginSubstepGroup() must be closed with a complementary #endSubstepGroup() prior to calling #update(). + \param[in] nbSubSteps is the number of substeps for the group's sequence. This can be changed with a call to #setSubsteps(). + \return Handle for the substepping group on success, else eINVALID_SUBSTEP_GROUP + @see setSubsteps() + @see endSubstepGroup() + */ + PX_FORCE_INLINE PxU8 beginSubstepGroup(const PxU8 nbSubSteps = 1); + + /** + \brief End a substepping group + \note The group most recently opened with #beginSubstepGroup() will be closed by this call. + @see setSubsteps() + @see beginSubstepGroup() + */ + PX_FORCE_INLINE void endSubstepGroup() + { + mActiveSubgroup = mSubGroups[mActiveSubgroup].parentGroup; + } + + /** + \brief Set the number of substeps to perform for a specific substepping group. + \param[in] subGroupHandle specifies the substepping group + \param[in] nbSteps is the number of times to invoke the sequence of components and groups in the specified substepping group. + @see beginSubstepGroup() + @see endSubstepGroup() + */ + void setSubsteps(const PxU8 subGroupHandle, const PxU8 nbSteps) + { + PX_ASSERT(subGroupHandle < mNbSubgroups); + mSubGroups[subGroupHandle].nbSteps = nbSteps; + } + + /** + \brief Update each component in the sequence. + + \note If the update method of a component in the sequence returns false, the update process gets aborted. + + \param[in] dt is the timestep of the update. The provided value has to be positive. + \param[in] context specifies global quantities of the simulation such as gravitational acceleration. + */ + void update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_ASSERT(0 == mActiveSubgroup); + + if (dt > 0.0f) + { + updateSubGroup(dt, context, 0, 1); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxVehicleComponentSequence::update: The timestep must be positive!"); + } + } + +private: + enum + { + eINVALID_COMPONENT = 0xff, + eINVALID_SUB_GROUP_ELEMENT = 0xff + }; + + //Elements have the form of a linked list to allow traversal over a list of elements. + //Each element is either a single component or a subgroup. + struct SubGroupElement + { + SubGroupElement() + : childGroup(eINVALID_SUBSTEP_GROUP), + component(eINVALID_COMPONENT), + nextElement(eINVALID_SUB_GROUP_ELEMENT) + { + } + + PxU8 childGroup; + PxU8 component; + PxU8 nextElement; + }; + + //A group is a linked list of elements to be processed in sequence. + //Each group stores the first element in the sequence. + //Each element in the sequence stores the next element in the sequence + //to allow traversal over the list of elements in the group. + struct Group + { + Group() + : parentGroup(eINVALID_SUBSTEP_GROUP), + firstElement(eINVALID_SUB_GROUP_ELEMENT), + nbSteps(1) + { + } + PxU8 parentGroup; + PxU8 firstElement; + PxU8 nbSteps; + }; + + PxVehicleComponent* mComponents[PxVehicleComponentSequenceLimits::eMAX_NB_COMPONENTS]; + PxU8 mNbComponents; + + Group mSubGroups[PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPS]; + PxU8 mNbSubgroups; + + SubGroupElement mSubGroupElements[PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS]; + PxU8 mNbSubGroupElements; + + PxU8 mActiveSubgroup; + + bool updateSubGroup(const PxReal dt, const PxVehicleSimulationContext& context, const PxU8 groupId, const PxU8 parentSepMultiplier) + { + const PxU8 nbSteps = mSubGroups[groupId].nbSteps; + const PxU8 stepMultiplier = parentSepMultiplier * nbSteps; + const PxReal timestepForGroup = dt / PxReal(stepMultiplier); + for (PxU8 k = 0; k < nbSteps; k++) + { + PxU8 nextElement = mSubGroups[groupId].firstElement; + while (eINVALID_SUB_GROUP_ELEMENT != nextElement) + { + const SubGroupElement& e = mSubGroupElements[nextElement]; + PX_ASSERT(e.component != eINVALID_COMPONENT || e.childGroup != eINVALID_SUBSTEP_GROUP); + if (eINVALID_COMPONENT != e.component) + { + PxVehicleComponent* c = mComponents[e.component]; + if (!c->update(timestepForGroup, context)) + return false; + } + else + { + PX_ASSERT(eINVALID_SUBSTEP_GROUP != e.childGroup); + if (!updateSubGroup(dt, context, e.childGroup, stepMultiplier)) + return false; + } + nextElement = e.nextElement; + } + } + + return true; + } + + PxU8 getLastKnownElementInGroup(const PxU8 groupId) const + { + PxU8 currElement = mSubGroups[groupId].firstElement; + PxU8 nextElement = mSubGroups[groupId].firstElement; + while (nextElement != eINVALID_SUB_GROUP_ELEMENT) + { + currElement = nextElement; + nextElement = mSubGroupElements[nextElement].nextElement; + } + return currElement; + } +}; + + +bool PxVehicleComponentSequence::add(PxVehicleComponent* c) +{ + if (PxVehicleComponentSequenceLimits::eMAX_NB_COMPONENTS == mNbComponents) + return false; + if (PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS == mNbSubGroupElements) + return false; + + //Create a new element and point it at the component. + SubGroupElement& nextElementInGroup = mSubGroupElements[mNbSubGroupElements]; + nextElementInGroup.childGroup = eINVALID_SUBSTEP_GROUP; + nextElementInGroup.component = mNbComponents; + nextElementInGroup.nextElement = eINVALID_SUB_GROUP_ELEMENT; + + if (eINVALID_SUB_GROUP_ELEMENT == mSubGroups[mActiveSubgroup].firstElement) + { + //The group is empty so add the first element to it. + //Point the group at the new element because this will + //be the first element in the group. + mSubGroups[mActiveSubgroup].firstElement = mNbSubGroupElements; + } + else + { + //We are extending the sequence of element of the group. + //Add the new element to the end of the group's sequence. + mSubGroupElements[getLastKnownElementInGroup(mActiveSubgroup)].nextElement = mNbSubGroupElements; + } + + //Increment the number of elements. + mNbSubGroupElements++; + + //Record the component and increment the number of components. + mComponents[mNbComponents] = c; + mNbComponents++; + + return true; +} + +PxU8 PxVehicleComponentSequence::beginSubstepGroup(const PxU8 nbSubSteps) +{ + if (mNbSubgroups == PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPS) + return eINVALID_SUBSTEP_GROUP; + if (mNbSubGroupElements == PxVehicleComponentSequenceLimits::eMAX_NB_SUBGROUPELEMENTS) + return eINVALID_SUBSTEP_GROUP; + + //We have a parent and child group relationship. + const PxU8 parentGroup = mActiveSubgroup; + const PxU8 childGroup = mNbSubgroups; + + //Set up the child group. + mSubGroups[childGroup].parentGroup = parentGroup; + mSubGroups[childGroup].firstElement = eINVALID_SUB_GROUP_ELEMENT; + mSubGroups[childGroup].nbSteps = nbSubSteps; + + //Create a new element to add to the parent group and point it at the child group. + SubGroupElement& nextElementIInGroup = mSubGroupElements[mNbSubGroupElements]; + nextElementIInGroup.childGroup = childGroup; + nextElementIInGroup.nextElement = eINVALID_SUB_GROUP_ELEMENT; + nextElementIInGroup.component = eINVALID_COMPONENT; + + //Add the new element to the parent group. + if (eINVALID_SUB_GROUP_ELEMENT == mSubGroups[parentGroup].firstElement) + { + //The parent group is empty so add the first element to it. + //Point the parent group at the new element because this will + //be the first element in the group. + mSubGroups[parentGroup].firstElement = mNbSubGroupElements; + } + else + { + //We are extending the sequence of elements of the parent group. + //Add the new element to the end of the group's sequence. + mSubGroupElements[getLastKnownElementInGroup(parentGroup)].nextElement = mNbSubGroupElements; + } + + //Push the active group. + //All subsequent operations will now address the child group and we push or pop the group. + mActiveSubgroup = childGroup; + + //Increment the number of elements. + mNbSubGroupElements++; + + //Increment the number of groups. + mNbSubgroups++; + + //Return the group id. + return mActiveSubgroup; +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleFunctions.h new file mode 100644 index 0000000..9cfafdc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleFunctions.h @@ -0,0 +1,199 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" +#include "foundation/PxSimpleTypes.h" +#include "PxRigidBody.h" +#include "PxVehicleParams.h" +#include "roadGeometry/PxVehicleRoadGeometryState.h" +#include "rigidBody/PxVehicleRigidBodyStates.h" +#include "physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "physxActor/PxVehiclePhysXActorStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +PX_FORCE_INLINE PxVec3 PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVec3& v) +{ + PxVec3 result = v; + if ((srcFrame.lngAxis != trgFrame.lngAxis) || (srcFrame.latAxis != trgFrame.latAxis) || (srcFrame.vrtAxis != trgFrame.vrtAxis)) + { + const PxMat33 a = srcFrame.getFrame(); + const PxMat33 r = trgFrame.getFrame(); + result = (r * a.getTranspose() * v); + } + return result; +} + +PX_FORCE_INLINE PxVec3 PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, + const PxVehicleScale& srcScale, const PxVehicleScale& trgScale, + const PxVec3& v) +{ + PxVec3 result = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, v); + if((srcScale.scale != trgScale.scale)) + result *= (trgScale.scale / srcScale.scale); + return result; +} + +PX_FORCE_INLINE PxTransform PxVehicleTransformFrameToFrame +(const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, + const PxVehicleScale& srcScale, const PxVehicleScale& trgScale, + const PxTransform& v) +{ + PxTransform result(PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, v.p), v.q); + if ((srcFrame.lngAxis != trgFrame.lngAxis) || (srcFrame.latAxis != trgFrame.latAxis) || (srcFrame.vrtAxis != trgFrame.vrtAxis)) + { + PxF32 angle; + PxVec3 axis; + v.q.toRadiansAndUnitAxis(angle, axis); + result.q = PxQuat(angle, PxVehicleTransformFrameToFrame(srcFrame, trgFrame, axis)); + } + return result; +} + +PX_FORCE_INLINE PxVec3 PxVehicleComputeTranslation(const PxVehicleFrame& frame, const PxReal lng, const PxReal lat, const PxReal vrt) +{ + const PxVec3 v = frame.getFrame()*PxVec3(lng, lat, vrt); + return v; +} + +PX_FORCE_INLINE PxQuat PxVehicleComputeRotation(const PxVehicleFrame& frame, const PxReal roll, const PxReal pitch, const PxReal yaw) +{ + const PxMat33 m = frame.getFrame(); + const PxVec3& lngAxis = m.column0; + const PxVec3& latAxis = m.column1; + const PxVec3& vrtAxis = m.column2; + const PxQuat quatPitch(pitch, latAxis); + const PxQuat quatRoll(roll, lngAxis); + const PxQuat quatYaw(yaw, vrtAxis); + const PxQuat result = quatYaw * quatRoll * quatPitch; + return result; +} + +PX_FORCE_INLINE PxF32 PxVehicleComputeSign(const PxReal f) +{ + return physx::intrinsics::fsel(f, physx::intrinsics::fsel(-f, 0.0f, 1.0f), -1.0f); +} + + +/** +\brief Shift the origin of a vehicle by the specified vector. + +Call this method to adjust the internal data structures of vehicles to reflect the shifted origin location +(the shift vector will get subtracted from all world space spatial data). + +\param[in] axleDesc is a description of the wheels on the vehicle. +\param[in] shift is the translation vector used to shift the origin. +\param[in] rigidBodyState stores the current position of the vehicle +\param[in] roadGeometryStates stores the hit plane under each wheel. +\param[in] physxActor stores the PxRigidActor that is the vehicle's PhysX representation. +\param[in] physxQueryStates stores the hit point of the most recent execution of PxVehiclePhysXRoadGeometryQueryUpdate() for each wheel. +\note It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from the vehicle accordingly. +\note This call will not automatically shift the PhysX scene and its objects. PxScene::shiftOrigin() must be called seperately to keep the systems in sync. +\note If there is no associated PxRigidActor then set physxActor to NULL. +\note If there is an associated PxRigidActor and it is already in a PxScene then the complementary call to PxScene::shiftOrigin() will take care of +shifting the associated PxRigidActor. This being the case, set physxActor to NULL. physxActor should be a non-NULL pointer only when there is an +associated PxRigidActor and it is not part of a PxScene. This can occur if the associated PxRigidActor is updated using PhysX immediate mode. +\note If scene queries are independent of PhysX geometry then set queryStates to NULL. +*/ +PX_FORCE_INLINE void PxVehicleShiftOrigin +(const PxVehicleAxleDescription& axleDesc, const PxVec3& shift, + PxVehicleRigidBodyState& rigidBodyState, PxVehicleRoadGeometryState* roadGeometryStates, + PxVehiclePhysXActor* physxActor = NULL, PxVehiclePhysXRoadGeometryQueryState* physxQueryStates = NULL) +{ + //Adjust the vehicle's internal pose. + rigidBodyState.pose.p -= shift; + + //Optionally adjust the PxRigidActor pose. + if (physxActor && !physxActor->rigidBody->getScene()) + { + const PxTransform oldPose = physxActor->rigidBody->getGlobalPose(); + const PxTransform newPose(oldPose.p - shift, oldPose.q); + physxActor->rigidBody->setGlobalPose(newPose); + } + + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + //Optionally adjust the hit position. + if (physxQueryStates && physxQueryStates[wheelId].actor) + physxQueryStates[wheelId].hitPosition -= shift; + + //Adjust the hit plane. + if (roadGeometryStates[wheelId].hitState) + { + const PxPlane plane = roadGeometryStates[wheelId].plane; + PxU32 largestNormalComponentAxis = 0; + PxReal largestNormalComponent = 0.0f; + const PxF32 normalComponents[3] = { plane.n.x, plane.n.y, plane.n.z }; + for (PxU32 k = 0; k < 3; k++) + { + if (PxAbs(normalComponents[k]) > largestNormalComponent) + { + largestNormalComponent = PxAbs(normalComponents[k]); + largestNormalComponentAxis = k; + } + } + PxVec3 pointInPlane(PxZero); + switch (largestNormalComponentAxis) + { + case 0: + pointInPlane.x = -plane.d / plane.n.x; + break; + case 1: + pointInPlane.y = -plane.d / plane.n.y; + break; + case 2: + pointInPlane.z = -plane.d / plane.n.z; + break; + default: + break; + } + roadGeometryStates[wheelId].plane.d = -plane.n.dot(pointInPlane - shift); + } + } +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleLimits.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleLimits.h new file mode 100644 index 0000000..e91c53c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleLimits.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif +struct PxVehicleLimits +{ + enum Enum + { + eMAX_NB_WHEELS = 20, + eMAX_NB_AXLES = eMAX_NB_WHEELS + }; +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleMaths.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleMaths.h new file mode 100644 index 0000000..a4d4098 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleMaths.h @@ -0,0 +1,237 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMemory.h" + +#include "PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleVectorN +{ +public: + enum + { + eMAX_SIZE = PxVehicleLimits::eMAX_NB_WHEELS + 3 + }; + + PxVehicleVectorN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= PxVehicleVectorN::eMAX_SIZE); + PxMemZero(mValues, sizeof(PxReal)*PxVehicleVectorN::eMAX_SIZE); + } + + ~PxVehicleVectorN() + { + } + + PxVehicleVectorN(const PxVehicleVectorN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + } + + PX_FORCE_INLINE PxVehicleVectorN& operator=(const PxVehicleVectorN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxReal& operator[] (const PxU32 i) + { + PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE const PxReal& operator[] (const PxU32 i) const + { + //PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + +private: + + PxReal mValues[PxVehicleVectorN::eMAX_SIZE]; + PxU32 mSize; +}; + +class PxVehicleMatrixNN +{ +public: + + PxVehicleMatrixNN() + : mSize(0) + { + } + + PxVehicleMatrixNN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= PxVehicleVectorN::eMAX_SIZE); + PxMemZero(mValues, sizeof(PxReal)*PxVehicleVectorN::eMAX_SIZE*PxVehicleVectorN::eMAX_SIZE); + } + + PxVehicleMatrixNN(const PxVehicleMatrixNN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + for (PxU32 j = 0; j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize = src.mSize; + } + + ~PxVehicleMatrixNN() + { + } + + PX_FORCE_INLINE PxVehicleMatrixNN& operator=(const PxVehicleMatrixNN& src) + { + for (PxU32 i = 0; i < src.mSize; i++) + { + for (PxU32 j = 0; j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxReal get(const PxU32 i, const PxU32 j) const + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + return mValues[i][j]; + } + + PX_FORCE_INLINE void set(const PxU32 i, const PxU32 j, const PxReal val) + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + mValues[i][j] = val; + } + + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + + PX_FORCE_INLINE void setSize(const PxU32 size) + { + PX_ASSERT(size <= PxVehicleVectorN::eMAX_SIZE); + mSize = size; + } + +public: + + PxReal mValues[PxVehicleVectorN::eMAX_SIZE][PxVehicleVectorN::eMAX_SIZE]; + PxU32 mSize; +}; + + +/* + LUPQ decomposition + + Based upon "Outer Product LU with Complete Pivoting," from Matrix Computations (4th Edition), Golub and Van Loan + + Solve A*x = b using: + + MatrixNNLUSolver solver; + solver.decomposeLU(A); + solver.solve(b, x); +*/ +class PxVehicleMatrixNNLUSolver +{ +private: + + PxVehicleMatrixNN mLU; + PxU32 mP[PxVehicleVectorN::eMAX_SIZE - 1]; // Row permutation + PxU32 mQ[PxVehicleVectorN::eMAX_SIZE - 1]; // Column permutation + PxReal mDetM; + +public: + + PxVehicleMatrixNNLUSolver() {} + ~PxVehicleMatrixNNLUSolver() {} + + PxReal getDet() const { return mDetM; } + + void decomposeLU(const PxVehicleMatrixNN& A); + + //Given a matrix A and a vector b find x that satisfies Ax = b, where the matrix A is the matrix that was passed to #decomposeLU. + //Returns true if the lu decomposition indicates that the matrix has an inverse and x was successfully computed. + //Returns false if the lu decomposition resulted in zero determinant ie the matrix has no inverse and no solution exists for x. + //Returns false if the size of either b or x doesn't match the size of the matrix passed to #decomposeLU. + //If false is returned then each relevant element of x is set to zero. + bool solve(const PxVehicleVectorN& b, PxVehicleVectorN& x) const; +}; + + +class PxVehicleMatrixNGaussSeidelSolver +{ +public: + + void solve(const PxU32 maxIterations, const PxReal tolerance, const PxVehicleMatrixNN& A, const PxVehicleVectorN& b, PxVehicleVectorN& result) const; +}; + +class PxVehicleMatrix33Solver +{ +public: + + bool solve(const PxVehicleMatrixNN& A_, const PxVehicleVectorN& b_, PxVehicleVectorN& result) const; +}; + +#if !PX_DOXYGEN +} //namespace vehicle2 +} //namespace physx +#endif + +/** @} */ + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleParams.h new file mode 100644 index 0000000..7eb58e4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/PxVehicleParams.h @@ -0,0 +1,914 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ +#include "foundation/PxFoundation.h" +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" + +#include "PxVehicleLimits.h" + +class OmniPvdWriter; + +#if !PX_DOXYGEN +namespace physx +{ +class PxConvexMesh; +class PxScene; +namespace vehicle2 +{ +#endif + +struct PxVehicleAxleDescription +{ + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleAxleDescription)); + } + + /** + \brief Add an axle to the vehicle by specifying the number of wheels on the axle and an array of wheel ids specifying each wheel on the axle. + \param[in] nbWheelsOnAxle is the number of wheels on the axle to be added. + \param[in] wheelIdsOnAxle is an array of wheel ids specifying all the wheels on the axle to be added. + */ + void addAxle(const PxU32 nbWheelsOnAxle, const PxU32* const wheelIdsOnAxle) + { + PX_ASSERT((nbWheels + nbWheelsOnAxle) < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbAxles < PxVehicleLimits::eMAX_NB_AXLES); + nbWheelsPerAxle[nbAxles] = nbWheelsOnAxle; + axleToWheelIds[nbAxles] = nbWheels; + for (PxU32 i = 0; i < nbWheelsOnAxle; i++) + { + wheelIdsInAxleOrder[nbWheels + i] = wheelIdsOnAxle[i]; + } + nbWheels += nbWheelsOnAxle; + nbAxles++; + } + + /** + \brief Return the number of axles on the vehicle. + \return The number of axles. + @see getNbWheelsOnAxle() + */ + PX_FORCE_INLINE PxU32 getNbAxles() const + { + return nbAxles; + } + + /** + \brief Return the number of wheels on the ith axle. + \param[in] i specifies the axle to be queried for its wheel count. + \return The number of wheels on the specified axle. + @see getWheelOnAxle() + */ + PX_FORCE_INLINE PxU32 getNbWheelsOnAxle(const PxU32 i) const + { + return nbWheelsPerAxle[i]; + } + + /** + \brief Return the wheel id of the jth wheel on the ith axle. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified axle. + \param[in] i specifies the axle to be queried. + \return The wheel id of the jth wheel on the ith axle. + @see getNbWheelsOnAxle() + */ + PX_FORCE_INLINE PxU32 getWheelOnAxle(const PxU32 j, const PxU32 i) const + { + return wheelIdsInAxleOrder[axleToWheelIds[i] + j]; + } + + /** + \brief Return the number of wheels on the vehicle. + \return The number of wheels. + */ + PX_FORCE_INLINE PxU32 getNbWheels() const + { + return nbWheels; + } + + /** + \brief Return the axle of a specified wheel. + \param[in] wheelId is the wheel whose axle is to be queried. + \return The axle of the specified wheel. + */ + PX_FORCE_INLINE PxU32 getAxle(const PxU32 wheelId) const + { + for (PxU32 i = 0; i < getNbAxles(); i++) + { + for (PxU32 j = 0; j < getNbWheelsOnAxle(i); j++) + { + if (getWheelOnAxle(j, i) == wheelId) + return i; + } + } + return 0xffffffff; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(nbAxles > 0, "PxVehicleAxleDescription.nbAxles must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbWheels > 0, "PxVehicleAxleDescription.nbWheels must be greater than zero", false); + return true; + } + + PxU32 nbAxles; //!< The number of axles on the vehicle + PxU32 nbWheelsPerAxle[PxVehicleLimits::eMAX_NB_AXLES]; //!< The number of wheels on each axle. + PxU32 axleToWheelIds[PxVehicleLimits::eMAX_NB_AXLES]; //!< The list of wheel ids for the ith axle begins at wheelIdsInAxleOrder[axleToWheelIds[i]] + + PxU32 wheelIdsInAxleOrder[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of all wheel ids on the vehicle. + PxU32 nbWheels; //!< The number of wheels on the vehicle. + + + PX_COMPILE_TIME_ASSERT(PxVehicleLimits::eMAX_NB_AXLES == PxVehicleLimits::eMAX_NB_WHEELS); + // It should be possible to support cases where each wheel is controlled individually and thus + // having a wheel per axle for up to the max wheel count. +}; + + +struct PxVehicleAxes +{ + enum Enum + { + ePosX = 0, //!< The +x axis + eNegX, //!< The -x axis + ePosY, //!< The +y axis + eNegY, //!< The -y axis + ePosZ, //!< The +z axis + eNegZ, //!< The -z axis + eMAX_NB_AXES + }; +}; + +struct PxVehicleFrame +{ + PxVehicleAxes::Enum lngAxis; //!< The axis defining the longitudinal (forward) direction of the vehicle. + PxVehicleAxes::Enum latAxis; //!< The axis defining the lateral (side) direction of the vehicle. + PxVehicleAxes::Enum vrtAxis; //!< The axis defining the vertical (up) direction of the vehicle. + + PX_FORCE_INLINE void setToDefault() + { + lngAxis = PxVehicleAxes::ePosX; + latAxis = PxVehicleAxes::ePosY; + vrtAxis = PxVehicleAxes::ePosZ; + } + + PX_FORCE_INLINE PxMat33 getFrame() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + const PxMat33 mat33(basisDirs[lngAxis], basisDirs[latAxis], basisDirs[vrtAxis]); + return mat33; + } + + PX_FORCE_INLINE PxVec3 getLngAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[lngAxis]; + } + + PX_FORCE_INLINE PxVec3 getLatAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[latAxis]; + } + + PX_FORCE_INLINE PxVec3 getVrtAxis() const + { + const PxVec3 basisDirs[6] = { PxVec3(1,0,0), PxVec3(-1,0,0), PxVec3(0,1,0), PxVec3(0,-1,0), PxVec3(0,0,1), PxVec3(0,0,-1) }; + return basisDirs[vrtAxis]; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(lngAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.lngAxis is invalid", false); + PX_CHECK_AND_RETURN_VAL(latAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.latAxis is invalid", false); + PX_CHECK_AND_RETURN_VAL(vrtAxis < PxVehicleAxes::eMAX_NB_AXES, "PxVehicleFrame.vrtAxis is invalid", false); + const PxMat33 frame = getFrame(); + const PxQuat quat(frame); + PX_CHECK_AND_RETURN_VAL(quat.isFinite() && quat.isUnit() && quat.isSane(), "PxVehicleFrame is not a legal frame", false); + return true; + } +}; + +struct PxVehicleScale +{ + PxReal scale; //!< The length scale used for the vehicle. For example, if 1.0 is considered meters, then 100.0 would be for centimeters. + + PX_FORCE_INLINE void setToDefault() + { + scale = 1.0f; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(scale > 0.0f, "PxVehicleScale.scale must be greater than zero", false); + return true; + } +}; + +/** +\brief Helper struct to pass array type data to vehice components and functions. + +The Vehicle SDK tries to give the user a certain freedom in how the parameters and +states are stored. This helper struct presents a way to either use array of structs +or array of pointers to structs to pass data into the provided vehicle components +and functions. +*/ +template +struct PxVehicleArrayData +{ + enum DataFormat + { + eARRAY_OF_STRUCTS = 0, //!< The data is provided as an array of structs and stored in #arrayOfStructs. + eARRAY_OF_POINTERS //!< The data is provided as an array of pointers and stored in #arrayOfPointers. + }; + + /** + \brief Set the data as an array of structs. + + \param[in] data The data as an array of structs. + */ + PX_FORCE_INLINE void setData(T* data) + { + arrayOfStructs = data; + dataFormat = eARRAY_OF_STRUCTS; + } + + /** + \brief Set the data as an array of pointers. + + \param[in] data The data as an array of pointers. + */ + PX_FORCE_INLINE void setData(T*const* data) + { + arrayOfPointers= data; + dataFormat = eARRAY_OF_POINTERS; + } + + PX_FORCE_INLINE PxVehicleArrayData() + { + } + + PX_FORCE_INLINE explicit PxVehicleArrayData(T* data) + { + setData(data); + } + + PX_FORCE_INLINE explicit PxVehicleArrayData(T*const* data) + { + setData(data); + } + + /** + \brief Get the data entry at a given index. + + \param[in] index The index to retrieve the data entry for. + \return Reference to the requested data entry. + */ + PX_FORCE_INLINE T& getData(PxU32 index) + { + if (dataFormat == eARRAY_OF_STRUCTS) + return arrayOfStructs[index]; + else + return *arrayOfPointers[index]; + } + + PX_FORCE_INLINE T& operator[](PxU32 index) + { + return getData(index); + } + + /** + \brief Get the data entry at a given index. + + \param[in] index The index to retrieve the data entry for. + \return Reference to the requested data entry. + */ + PX_FORCE_INLINE const T& getData(PxU32 index) const + { + if (dataFormat == eARRAY_OF_STRUCTS) + return arrayOfStructs[index]; + else + return *arrayOfPointers[index]; + } + + PX_FORCE_INLINE const T& operator[](PxU32 index) const + { + return getData(index); + } + + /** + \brief Set as empty. + */ + PX_FORCE_INLINE void setEmpty() + { + arrayOfStructs = NULL; + } + + /** + \brief Check if declared as empty. + + \return True if empty, else false. + */ + PX_FORCE_INLINE bool isEmpty() const + { + return (arrayOfStructs == NULL); + } + + /** + \brief Get a reference to the array but read only. + + \return Read only version of the data. + */ + PX_FORCE_INLINE const PxVehicleArrayData& getConst() const + { + return reinterpret_cast&>(*this); + } + + + union + { + T* arrayOfStructs; //!< The data stored as an array of structs. + T*const* arrayOfPointers; //!< The data stored as an array of pointers. + }; + PxU8 dataFormat; +}; + +template +struct PxVehicleSizedArrayData : public PxVehicleArrayData +{ + /** + \brief Set the data as an array of structs and set the number of data entries. + + \param[in] data The data as an array of structs. + \param[in] count The number of entries in the data array. + */ + PX_FORCE_INLINE void setDataAndCount(T* data, const PxU32 count) + { + PxVehicleArrayData::setData(data); + size = count; + } + + /** + \brief Set the data as an array of pointers and set the number of data entries. + + \param[in] data The data as an array of pointers. + \param[in] count The number of entries in the data array. + */ + PX_FORCE_INLINE void setDataAndCount(T*const* data, const PxU32 count) + { + PxVehicleArrayData::setData(data); + size = count; + } + + /** + \brief Set as empty. + */ + PX_FORCE_INLINE void setEmpty() + { + PxVehicleArrayData::setEmpty(); + size = 0; + } + + /** + \brief Check if declared as empty. + + \return True if empty, else false. + */ + PX_FORCE_INLINE bool isEmpty() const + { + return ((size == 0) || PxVehicleArrayData::isEmpty()); + } + + PxU32 size; +}; + +/** +\brief Determine whether the PhysX actor associated with a vehicle is to be updated with a velocity change or an acceleration change. +A velocity change will be immediately reflected in linear and angular velocity queries against the vehicle. An acceleration change, on the other hand, +will leave the linear and angular velocities unchanged until the next PhysX scene update has applied the acceleration update to the actor's linear and +angular velocities. +@see PxVehiclePhysXActorEndComponent +@see PxVehicleWriteRigidBodyStateToPhysXActor +*/ +struct PxVehiclePhysXActorUpdateMode +{ + enum Enum + { + eAPPLY_VELOCITY = 0, + eAPPLY_ACCELERATION + }; +}; + +/** +\brief Tire slip values are computed using ratios with potential for divide-by-zero errors. PxVehicleTireSlipParams +introduces a minimum value for the denominator of each of these ratios. +*/ +struct PxVehicleTireSlipParams +{ + /** + \brief The lateral slip angle is typically computed as a function of the ratio of lateral and longitudinal speeds + of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the longitudinal speed + approaches zero. The parameter minLatSlipDenominator sets a minimum denominator for the ratio of speeds used to + compute the lateral slip angle. + \note Larger timesteps typically require larger values of minLatSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minLatSlipDenominator; + + /** + \brief The longitudinal slip represents the difference between the longitudinal speed of the rigid body in the tire's + frame and the linear speed arising from the rotation of the wheel. This is typically normalized using the reciprocal + of the longitudinal speed of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the + longitudinal speed approaches zero. The parameter minPassiveLongSlipDenominator sets a minimum denominator for the normalized + longitudinal slip when the wheel experiences zero drive torque and zero brake torque and zero handbrake torque. The aim is + to bring the vehicle to rest without experiencing wheel rotational speeds that oscillate around zero. + \note The vehicle will come to rest more smoothly with larger values of minPassiveLongSlipDenominator, particularly + with large timesteps that often lead to oscillation in wheel rotation speeds when the wheel rotation speed approaches + zero. + \note It is recommended that minActiveLongSlipDenominator < minPassiveLongSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minPassiveLongSlipDenominator; + + /** + \brief The longitudinal slip represents the difference between the longitudinal speed of the rigid body in the tire's + frame and the linear speed arising from the rotation of the wheel. This is typically normalized using the reciprocal + of the longitudinal speed of the rigid body in the tire's frame. This leads to a divide-by-zero in the event that the + longitudinal speed approaches zero. The parameter minActiveLongSlipDenominator sets a minimum denominator for the normalized + longitudinal slip when the wheel experiences either a non-zero drive torque or a non-zero brake torque or a non-zero handbrake + torque. + \note Larger timesteps typically require larger values of minActiveLongSlipDenominator to avoid instabilities occurring when + the vehicle is aggressively throttled from rest. + \note It is recommended that minActiveLongSlipDenominator < minPassiveLongSlipDenominator. + + Range: (0, inf)
+ Unit: velocity = length / time + */ + PxReal minActiveLongSlipDenominator; + + PX_FORCE_INLINE void setToDefault() + { + minLatSlipDenominator = 1.0f; + minActiveLongSlipDenominator = 0.1f; + minPassiveLongSlipDenominator = 4.0f; + } + + PX_FORCE_INLINE PxVehicleTireSlipParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireSlipParams p = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + p.minLatSlipDenominator *= scaleRatio; + p.minPassiveLongSlipDenominator *= scaleRatio; + p.minActiveLongSlipDenominator *= scaleRatio; + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(minLatSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minLatSlipDenominator must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(minPassiveLongSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minPassiveLongSlipDenominator must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(minActiveLongSlipDenominator > 0.0f, "PxVehicleTireSlipParams.minActiveLongSlipDenominator must be greater than zero", false); + return true; + } +}; + +/** +\brief Tires have two important directions for the purposes of tire force computation: longitudinal and lateral. +*/ +struct PxVehicleTireDirectionModes +{ + enum Enum + { + eLONGITUDINAL = 0, + eLATERAL, + eMAX_NB_PLANAR_DIRECTIONS + }; +}; + +/** +\brief The low speed regime often presents numerical difficulties for the tire model due to the potential for divide-by-zero errors. +This particularly affects scenarios where the vehicle is slowing down due to damping and drag. In scenarios where there is no +significant brake or drive torque, numerical error begins to dominate and it can be difficult to bring the vehicle to rest. A solution +to this problem is to recognise that the vehicle is close to rest and to replace the tire forces with velocity constraints that will +bring the vehicle to rest. This regime is known as the "sticky tire" regime. PxVehicleTireAxisStickyParams describes velocity and time +thresholds that categorise the "sticky tire" regime. It also describes the rate at which the velocity constraints approach zero speed. +*/ +struct PxVehicleTireAxisStickyParams +{ + /** + \brief A tire enters the "sticky tire" regime when it has been below a speed specified by #thresholdSpeed for a continuous time + specified by #thresholdTime. + + Range: [0, inf)
+ Unit: velocity = length / time + */ + PxReal thresholdSpeed; + + /** + \brief A tire enters the "sticky tire" regime when it has been below a speed specified by #thresholdSpeed for a continuous time + specified by #thresholdTime. + + Range: [0, inf)
+ Unit: time + */ + PxReal thresholdTime; + + /** + \brief The rate at which the velocity constraint approaches zero is controlled by the damping parameter. + \note Larger values of damping lead to faster approaches to zero. Since the damping behaves like a + stiffness with respect to the velocity, too large a value can lead to instabilities. + + Range: [0, inf)
+ Unit: 1 / time (acceleration instead of force based damping, thus not mass/time) + */ + PxReal damping; + + + PX_FORCE_INLINE PxVehicleTireAxisStickyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireAxisStickyParams p = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + p.thresholdSpeed *= scaleRatio; + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(thresholdSpeed >= 0.0f, "PxVehicleTireAxisStickyParams.thresholdSpeed must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(thresholdTime >= 0.0f, "PxVehicleTireAxisStickyParams.thresholdTime must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleTireAxisStickyParams.damping must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief For each tire, the forces of the tire model may be replaced by velocity constraints when the tire enters the "sticky tire" +regime. The "sticky tire" regime of the lateral and longitudinal directions of the tire are managed separately. +*/ +struct PxVehicleTireStickyParams +{ + /** + The "sticky tire" regime of the lateral and longitudinal directions of the tire are managed separately and are individually + parameterized. + */ + PxVehicleTireAxisStickyParams stickyParams[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdSpeed = 0.2f; + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdTime = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].damping = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdSpeed = 0.2f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdTime = 1.0f; + stickyParams[PxVehicleTireDirectionModes::eLATERAL].damping = 0.1f; + } + + PX_FORCE_INLINE PxVehicleTireStickyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleTireStickyParams p = *this; + p.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL] = + stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + p.stickyParams[PxVehicleTireDirectionModes::eLATERAL] = + stickyParams[PxVehicleTireDirectionModes::eLATERAL].transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return p; + } + + PX_FORCE_INLINE bool isValid() const + { + if (!stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].isValid()) + return false; + if (!stickyParams[PxVehicleTireDirectionModes::eLATERAL].isValid()) + return false; + return true; + } +}; + +struct PxVehicleSimulationContextType +{ + enum Enum + { + eDEFAULT, //!< The simulation context inherits from PxVehicleSimulationContext + ePHYSX //!< The simulation context inherits from PxVehiclePhysXSimulationContext + }; +}; + +/** +\brief Structure to support Omni PVD, the PhysX Visual Debugger. +*/ +struct PxVehiclePvdContext +{ +public: + PX_FORCE_INLINE void setToDefault() + { + attributeHandles = NULL; + writer = NULL; + } + + + /** + \brief The attribute handles used to reflect vehicle parameter and state data in omnipvd. + \note A null value will result in no values being reflected in omnipvd. + \note #attributeHandles and #writer both need to be non-NULL to reflect vehicle values in omnipvd. + @see PxVehiclePvdAttributesCreate + @see PxVehiclePvdAttributesRelease + @see PxVehiclePVDComponent + */ + const struct PxVehiclePvdAttributeHandles* attributeHandles; + + /** + \brief An instance of OmniPvdWriter used to write vehicle prameter and state data to omnipvd. + \note A null value will result in no values being reflected in omnipvd. + \note #attributeHandles and #writer both need to be non-NULL to reflect vehicle values in omnipvd. + @see PxVehiclePvdAttributesCreate + @see PxVehiclePvdAttributesRelease + @see PxVehiclePVDComponent + */ + OmniPvdWriter* writer; +}; + +struct PxVehicleSimulationContext +{ + PxVehicleSimulationContext() + : type(PxVehicleSimulationContextType::eDEFAULT) + {} + + PxVec3 gravity; + + PxVehicleFrame frame; + PxVehicleScale scale; + + //Tire + PxVehicleTireSlipParams tireSlipParams; + PxVehicleTireStickyParams tireStickyParams; + + /** + \brief Forward wheel speed below which the wheel rotation speed gets blended with the rolling speed. + + The blended rotation speed is used to integrate the wheel rotation angle. At low forward wheel speed, + the wheel rotation speed can get unstable (depending on the tire model used) and, for example, oscillate. + + \note If brake or throttle is applied, there will be no blending. + + Unit: velocity = length / time + */ + PxReal thresholdForwardSpeedForWheelAngleIntegration; + + /** + \brief Structure to support Omni PVD, the PhysX Visual Debugger. + */ + PxVehiclePvdContext pvdContext; + +protected: + PxVehicleSimulationContextType::Enum type; + + +public: + PX_FORCE_INLINE PxVehicleSimulationContextType::Enum getType() const { return type; } + + PX_FORCE_INLINE void setToDefault() + { + frame.setToDefault(); + scale.setToDefault(); + + gravity = frame.getVrtAxis() * (-9.81f * scale.scale); + + tireSlipParams.setToDefault(); + tireStickyParams.setToDefault(); + + thresholdForwardSpeedForWheelAngleIntegration = 5.0f * scale.scale; + + pvdContext.setToDefault(); + } + + PX_FORCE_INLINE PxVehicleSimulationContext transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleSimulationContext c = *this; + const PxReal scaleRatio = trgScale.scale / srcScale.scale; + c.gravity = trgFrame.getFrame()*srcFrame.getFrame().getTranspose()*c.gravity; + c.gravity *= scaleRatio; + c.tireSlipParams = tireSlipParams.transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + c.tireStickyParams = tireStickyParams.transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + c.thresholdForwardSpeedForWheelAngleIntegration *= scaleRatio; + c.frame = trgFrame; + c.scale = trgScale; + return c; + } +}; + +struct PxVehiclePhysXSimulationContext : public PxVehicleSimulationContext +{ + PxVehiclePhysXSimulationContext() + : PxVehicleSimulationContext() + { + type = PxVehicleSimulationContextType::ePHYSX; + } + + //Road geometry queries to find the plane under the wheel. + const PxConvexMesh* physxUnitCylinderSweepMesh; + const PxScene* physxScene; + + //PhysX actor update + PxVehiclePhysXActorUpdateMode::Enum physxActorUpdateMode; + + /** + \brief Wake counter value to set on the physx actor if a reset is required. + + Certain vehicle states should keep a physx actor of a vehicle awake. This + will be achieved by resetting the wake counter value if needed. The wake + counter value is the minimum simulation time that a physx actor will stay + awake. + + Unit: time + + @see physxActorWakeCounterThreshold PxVehiclePhysxActorKeepAwakeCheck + */ + PxReal physxActorWakeCounterResetValue; + + /** + \brief Threshold below which to check whether the physx actor wake counter + should get reset. + + Unit: time + + @see physxActorWakeCounterResetValue PxVehiclePhysxActorKeepAwakeCheck + */ + PxReal physxActorWakeCounterThreshold; + + + PX_FORCE_INLINE void setToDefault() + { + PxVehicleSimulationContext::setToDefault(); + + physxUnitCylinderSweepMesh = NULL; + physxScene = NULL; + + physxActorUpdateMode = PxVehiclePhysXActorUpdateMode::eAPPLY_VELOCITY; + + physxActorWakeCounterResetValue = 20.0f * 0.02f; // 20 timesteps of size 0.02 + physxActorWakeCounterThreshold = 0.5f * physxActorWakeCounterResetValue; + } + + PX_FORCE_INLINE PxVehiclePhysXSimulationContext transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehiclePhysXSimulationContext r = *this; + static_cast(r) = PxVehicleSimulationContext::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } +}; + +/** +* \brief Express a function as a sequence of points {(x, y)} that form a piecewise polynomial. +*/ +template +class PxVehicleFixedSizeLookupTable +{ +public: + + PxVehicleFixedSizeLookupTable() + : nbDataPairs(0) + { + } + + PxVehicleFixedSizeLookupTable(const PxVehicleFixedSizeLookupTable& src) + { + PxMemCopy(xVals, src.xVals, sizeof(PxReal)* src.nbDataPairs); + PxMemCopy(yVals, src.yVals, sizeof(T)*src.nbDataPairs); + nbDataPairs = src.nbDataPairs; + } + + ~PxVehicleFixedSizeLookupTable() + { + } + + PxVehicleFixedSizeLookupTable& operator=(const PxVehicleFixedSizeLookupTable& src) + { + PxMemCopy(xVals, src.xVals, sizeof(PxReal)*src.nbDataPairs); + PxMemCopy(yVals, src.yVals, sizeof(T)*src.nbDataPairs); + nbDataPairs = src.nbDataPairs; + return *this; + } + + /** + \brief Add one more point to create one more polynomial segment of a piecewise polynomial. + */ + PX_FORCE_INLINE bool addPair(const PxReal x, const T y) + { + PX_CHECK_AND_RETURN_VAL(nbDataPairs < NB_ELEMENTS, "PxVehicleFixedSizeLookupTable::addPair() exceeded fixed size capacity", false); + xVals[nbDataPairs] = x; + yVals[nbDataPairs] = y; + nbDataPairs++; + return true; + } + + /** + \brief Identify the segment of the piecewise polynomial that includes x and compute the corresponding y value by linearly interpolating the gradient of the segment. + \param[in] x is the value on the x-axis of the piecewise polynomial. + \return Returns the y value that corresponds to the input x. + */ + PX_FORCE_INLINE T interpolate(const PxReal x) const + { + if (0 == nbDataPairs) + { + return T(0); + } + + if (1 == nbDataPairs || x < xVals[0]) + { + return yVals[0]; + } + + PxReal x0 = xVals[0]; + T y0 = yVals[0]; + + for (PxU32 i = 1; i < nbDataPairs; i++) + { + const PxReal x1 = xVals[i]; + const T y1 = yVals[i]; + + if ((x >= x0) && (x < x1)) + { + return (y0 + (y1 - y0) * (x - x0) / (x1 - x0)); + } + + x0 = x1; + y0 = y1; + } + + PX_ASSERT(x >= xVals[nbDataPairs - 1]); + return yVals[nbDataPairs - 1]; + } + + void clear() + { + PxMemSet(xVals, 0, NB_ELEMENTS * sizeof(PxReal)); + PxMemSet(yVals, 0, NB_ELEMENTS * sizeof(T)); + nbDataPairs = 0; + } + + PxReal xVals[NB_ELEMENTS]; + T yVals[NB_ELEMENTS]; + PxU32 nbDataPairs; + + PX_FORCE_INLINE bool isValid() const + { + for (PxU32 i = 1; i < nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(xVals[i] > xVals[i - 1], "PxVehicleFixedSizeLookupTable:: xVals[i+1] must be greater than xVals[i]", false); + } + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + + + + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h new file mode 100644 index 0000000..f72fed1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingFunctions.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxMath.h" +#include "PxVehicleBrakingParams.h" +#include "../commands/PxVehicleCommandStates.h" +#include "../commands/PxVehicleCommandHelpers.h" +#include "../drivetrain/PxVehicleDrivetrainParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the brake torque response to an array of brake commands. +\param[in] brakeCommands is the array of input brake commands to be applied to the vehicle. +\param[in] nbBrakeCommands is the number of input brake commands to be applied to the vehicle. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle. +\param[in] wheelId specifies the wheel that is to have its brake response computed. +\param[in] brakeResponseParams specifies the per wheel brake torque response to each brake command as a nonlinear function of brake command and longitudinal speed. +\param[out] brakeResponseState is the brake torque response to the input brake command. +\note commands.brakes[i] and brakeResponseParams[i] are treated as pairs of brake command and brake command response. +*/ +PX_FORCE_INLINE void PxVehicleBrakeCommandResponseUpdate +(const PxReal* brakeCommands, const PxU32 nbBrakeCommands, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleSizedArrayData& brakeResponseParams, + PxReal& brakeResponseState) +{ + PX_CHECK_AND_RETURN(nbBrakeCommands <= brakeResponseParams.size, "PxVehicleBrakeCommandLinearUpdate: nbBrakes must be less than or equal to brakeResponseParams.size"); + PxReal sum = 0.0f; + for (PxU32 i = 0; i < nbBrakeCommands; i++) + { + sum += PxVehicleNonLinearResponseCompute(brakeCommands[i], longitudinalSpeed, wheelId, brakeResponseParams[i]); + } + brakeResponseState = sum; +} + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingParams.h new file mode 100644 index 0000000..c48259a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/braking/PxVehicleBrakingParams.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Distribute a brake response to the wheels of a vehicle. +\note The brake torque of each wheel on the ith wheel is brakeCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable brake torque +that occurs when the brake command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable brake torque per wheel as a fractional multiplier of the vehicle's maximum achievable brake torque. +*/ +struct PxVehicleBrakeCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleBrakeCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleBrakeCommandResponseParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.maxResponse *= (scale*scale); //maxResponse is a torque! + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + PX_CHECK_AND_RETURN_VAL(maxResponse >= 0.0f, "PxVehicleBrakeCommandResponseParams.maxResponse must be greater than or equal to zero", false); + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]] >= 0.0f, "PxVehicleBrakeCommandResponseParams.wheelResponseMultipliers[i] must be greater than or equal to zero.", false); + } + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h new file mode 100644 index 0000000..b746bfc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandHelpers.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "PxVehicleCommandParams.h" +#include "PxVehicleCommandStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the linear response to a command. +\param[in] command is a normalised command value. +\param[in] wheelId specifies the wheel that is to respond to the command. +\param[in] responseParams specifies the wheel responses for all wheels on a vehicle. +\return The linear response of the specified wheel to the command. +*/ +PX_FORCE_INLINE PxReal PxVehicleLinearResponseCompute +(const PxReal command, const PxU32 wheelId, const PxVehicleCommandResponseParams& responseParams) +{ + return command*responseParams.maxResponse*responseParams.wheelResponseMultipliers[wheelId]; +} + +/** +\brief Compute the non-linear response to a command. +\param[in] command is a normalised command value. +\param[in] longitudinalSpeed is the longitudional speed of the vehicle. +\param[in] wheelId specifies the wheel that is to respond to the command. +\param[in] responseParams specifies the wheel responses for all wheels on a vehicle. +\note responseParams is used to compute an interpolated normalized response to the combination of command and longitudinalSpeed. +The interpolated normalized response is then used in place of the command as input to PxVehicleComputeLinearResponse(). +*/ +PxReal PxVehicleNonLinearResponseCompute +(const PxReal command, const PxReal longitudinalSpeed, const PxU32 wheelId, const PxVehicleCommandResponseParams& responseParams); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandParams.h new file mode 100644 index 0000000..3b82656 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandParams.h @@ -0,0 +1,202 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + + +/** +\brief Each command value may be associated with a table specifying a normalized response as a function of longitudinal speed. +Multiple instances of PxVehicleCommandValueResponseTable allow a normalized response to be authored as a multi-variate +piecewise polynomial with normalized command response expressed as a nonlinear function of command value and speed. +*/ +struct PxVehicleCommandValueResponseTable +{ + enum Enum + { + eMAX_NB_SPEED_RESPONSES = 64 + }; + + /** + \brief The command value associated with the table of speed responses. + */ + PxReal commandValue; + + /** + \brief A lookup table specifying the normalised response to the specified command value as a function of longitudinal speed. + \note Each entry in the speedResponses table must be of the form (speed, normalizedResponse). + \note The longitudinal speeds in the table must form a monotonically increasing series. + \note The normalized responses must be in range (0,1). + */ + PxVehicleFixedSizeLookupTable speedResponses; +}; + +/** +\note Brake, drive and steer response typically reduce at increased longitudinal speed. Moreover, response to a brake, throttle or steer command is typically +nonlinear and may be subject to dead zones where response is constant with either zero or non-zero response. PxVehicleCommandNonLinearResponseParams allows +command responses to be authored as multi-variate piecewise polynomials with normalized command response a function of command value and longitudinal speed. +*/ +class PxVehicleCommandNonLinearResponseParams +{ +public: + + enum Enum + { + eMAX_NB_COMMAND_VALUES = 8 + }; + + PxVehicleCommandNonLinearResponseParams() + : nbSpeedResponses(0), + nbCommandValues(0) + { + } + + void clear() + { + nbCommandValues = 0; + nbSpeedResponses = 0; + } + + /** + \brief Add a table of normalised response vs speed and associated it with a specified command value. + \note commandValueSpeedResponses must be authored as a series of monotonically increasing series of speeds with form {speed, normalizedResponse} + \note The responses added must form a series of monotonically increasing commands. + */ + bool addResponse(const PxVehicleCommandValueResponseTable& commandValueSpeedResponses) + { + const PxReal commandValue = commandValueSpeedResponses.commandValue; + const PxReal* speeds = commandValueSpeedResponses.speedResponses.xVals; + const PxReal* responses = commandValueSpeedResponses.speedResponses.yVals; + const PxU16 nb = PxU16(commandValueSpeedResponses.speedResponses.nbDataPairs); + + PX_CHECK_AND_RETURN_VAL(commandValue >= 0.0f && commandValue <= 1.0f, "PxVehicleCommandAndResponseTable::commandValue must be in range (0,1)", false); + + PX_CHECK_AND_RETURN_VAL(nbCommandValues < eMAX_NB_COMMAND_VALUES, "PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses", false); + + PX_CHECK_AND_RETURN_VAL(((nbSpeedResponses + nb) <= PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES), "PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses", false); + + PX_CHECK_AND_RETURN_VAL((0 == nbCommandValues) || (commandValue > commandValues[nbCommandValues - 1]), "PxVehicleNonLinearCommandResponse::addResponse - command must be part of a a monotonically increasing series", false); + + PX_CHECK_AND_RETURN_VAL(nb > 0, "PxVehicleNonLinearCommandResponse::addResponse - each command response must have at least 1 point", false); + +#if PX_CHECKED + for (PxU32 i = 1; i < nb; i++) + { + PX_CHECK_AND_RETURN_VAL(speeds[i] > speeds[i - 1], "PxVehicleNonLinearCommandResponse::addResponse - speeds array must be a monotonically increasing series", false); + PX_CHECK_AND_RETURN_VAL(responses[i] >= 0.0f && responses[i] <= 1.0f , "PxVehicleNonLinearCommandResponse::addResponse - response must be in range (0,1)", false); + } +#endif + + commandValues[nbCommandValues] = commandValue; + nbSpeedRenponsesPerCommandValue[nbCommandValues] = nb; + speedResponsesPerCommandValue[nbCommandValues] = nbSpeedResponses; + PxMemCopy(speedResponses + 2 * nbSpeedResponses, speeds, sizeof(PxReal)*nb); + PxMemCopy(speedResponses + 2 * nbSpeedResponses + nb, responses, sizeof(PxReal)*nb); + nbCommandValues++; + nbSpeedResponses += nb; + return true; + } + +public: + + /** + \brief A ragged array of speeds and normalized responses. + */ + PxReal speedResponses[PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES * 2]; + + /** + \brief The number of speeds and normalized responses. + */ + PxU16 nbSpeedResponses; + + /** + \brief The table of speed responses for the ith command value begins at speedResponses[2*speedResponsesPerCommandValue[i]] + */ + PxU16 speedResponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The ith command value has N speed responses with N = nbSpeedRenponsesPerCommandValue[i]. + */ + PxU16 nbSpeedRenponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The command values. + */ + PxReal commandValues[eMAX_NB_COMMAND_VALUES]; + + /** + \brief The number of command values. + */ + PxU16 nbCommandValues; +}; + +/** +\brief A description of the per wheel response to an input command. +*/ +struct PxVehicleCommandResponseParams +{ + /** + \brief A nonlinear response to command value expressed as a lookup table of normalized response as a function of command value and longitudinal speed. + \note The effect of the default state of nonlinearResponse is a linear response to command value that is independent of longitudinal speed. + */ + PxVehicleCommandNonLinearResponseParams nonlinearResponse; + + /** + \brief A description of the per wheel response multiplier to an input command. + */ + PxReal wheelResponseMultipliers[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The maximum response that occurs when the wheel response multiplier has value 1.0 and nonlinearResponse is in the default state of linear response. + */ + PxF32 maxResponse; +}; + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandStates.h new file mode 100644 index 0000000..6dec45e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/commands/PxVehicleCommandStates.h @@ -0,0 +1,140 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMemory.h" +#include "vehicle2/PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +/** +\brief A description of the state of commands that are applied to the vehicle +\note brakes[0] and brakes[1] may be used to distinguish brake and handbrake controls. +*/ +struct PxVehicleCommandState +{ + PxReal brakes[2]; //!< The instantaneous state of the brake controllers in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxU32 nbBrakes; //|< The number of brake commands. + PxReal throttle; //!< The instantaneous state of the throttle controller in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxReal steer; //!< The instantaneous state of the steer controller in range [-1,1]. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with direct drive. +*/ +struct PxVehicleDirectDriveTransmissionCommandState +{ + /** + \brief Direct drive vehicles only have reverse, neutral or forward gear. + */ + enum Enum + { + eREVERSE = 0, + eNEUTRAL, + eFORWARD + }; + + Enum gear; //!< The desired gear of the input gear controller. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleDirectDriveTransmissionCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with engine drive. +*/ +struct PxVehicleEngineDriveTransmissionCommandState +{ + enum Enum + { + /** + \brief Special gear value to denote the automatic shift mode (often referred to as DRIVE). + + When using automatic transmission, setting this value as target gear will enable automatic + gear shifts between first and highest gear. If the current gear is a reverse gear or + the neutral gear, then this value will trigger a shift to first gear. If this value is + used even though there is no automatic transmission available, the gear state will remain + unchanged. + */ + eAUTOMATIC_GEAR = 0xff + }; + + PxReal clutch; //!< The instantaneous state of the clutch controller in range [0,1] with 1 denoting fully pressed and 0 fully depressed. + PxU32 targetGear; //!< The desired gear of the input gear controller. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineDriveTransmissionCommandState)); + } +}; + +/** +\brief A description of the state of transmission-related commands that are applied to a vehicle with tank drive. +*/ +struct PxVehicleTankDriveTransmissionCommandState : public PxVehicleEngineDriveTransmissionCommandState +{ + /** + \brief The wheels of each tank track are either all connected to thrusts[0] or all connected to thrusts[1]. + \note The thrust commands are used to divert torque from the engine to the wheels of the tank tracks controlled by each thrust. + \note thrusts[0] and thrusts[1] are in range [-1,1] with the sign dictating whether the thrust will be applied positively or negatively with respect to the gearing ratio. + */ + PxReal thrusts[2]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTankDriveTransmissionCommandState)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h new file mode 100644 index 0000000..75050de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainComponents.h @@ -0,0 +1,802 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/braking/PxVehicleBrakingFunctions.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/steering/PxVehicleSteeringFunctions.h" +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxVehicleDrivetrainStates.h" +#include "PxVehicleDrivetrainFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleBrakeCommandResponseParams; +struct PxVehicleDirectDriveThrottleCommandResponseParams; + +/** +\brief Forward the applicable set of control values for a direct drive vehicle to a command response state for each +applicable control value. +\note The applicable control values are brake, handbrake, throttle and steer. +@see PxVehicleDirectDriveActuationStateComponent +@see PxVehicleDirectDrivetrainComponent +@see PxVehicleBrakeCommandLinearUpdate +@see PxVehicleDirectDriveThrottleLinearCommandUpdate +@see PxVehicleSteerCommandLinearUpdate +@see PxVehicleAckermannSteerUpdate +*/ +class PxVehicleDirectDriveCommandResponseComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDriveCommandResponseComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDriveCommandResponseComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseParams An array of brake response parameters with a brake response for each brake command. + \param[out] throttleResponseParams The throttle response parameters. + \param[out] steerResponseParams The steer response parameters. + \param[out] ackermannParams The parameters defining Ackermann steering. NULL if no Ackermann steering is desired. + \param[out] commands The throttle, brake, steer etc. command states. + \param[out] transmissionCommands The transmission command state describing the current gear. + \param[out] rigidBodyState The state of the vehicle's rigid body. + \param[out] brakeResponseStates The resulting brake response states given the command input and brake response parameters. + \param[out] throttleResponseStates The resulting throttle response states given the command input and throttle response parameters. + \param[out] steerResponseStates The resulting steer response states given the command input, steer response and (optionally) Ackermann parameters. + */ + virtual void getDataForDirectDriveCommandResponseComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleDirectDriveThrottleCommandResponseParams*& throttleResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + PxVehicleSizedArrayData& ackermannParams, + const PxVehicleCommandState*& commands, const PxVehicleDirectDriveTransmissionCommandState*& transmissionCommands, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& steerResponseStates) = 0; + + /** + \brief Compute a per wheel response to the input brake/handbrake/throttle/steer commands + and determine if there is an intention to accelerate the vehicle. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDriveCommandResponseComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleSizedArrayData brakeResponseParams; + const PxVehicleDirectDriveThrottleCommandResponseParams* throttleResponseParams; + const PxVehicleSteerCommandResponseParams* steerResponseParams; + PxVehicleSizedArrayData ackermannParams; + const PxVehicleCommandState* commands; + const PxVehicleDirectDriveTransmissionCommandState* transmissionCommands; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData steerResponseStates; + + getDataForDirectDriveCommandResponseComponent(axleDescription, + brakeResponseParams, throttleResponseParams, steerResponseParams, ackermannParams, + commands, transmissionCommands, + rigidBodyState, + brakeResponseStates, throttleResponseStates, steerResponseStates); + + const PxReal longitudinalSpeed = rigidBodyState->getLongitudinalSpeed(context.frame); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleBrakeCommandResponseUpdate( + commands->brakes, commands->nbBrakes, longitudinalSpeed, + wheelId, brakeResponseParams, + brakeResponseStates[wheelId]); + + PxVehicleDirectDriveThrottleCommandResponseUpdate( + commands->throttle, *transmissionCommands, longitudinalSpeed, + wheelId, *throttleResponseParams, + throttleResponseStates[wheelId]); + + PxVehicleSteerCommandResponseUpdate( + commands->steer, longitudinalSpeed, + wheelId, *steerResponseParams, + steerResponseStates[wheelId]); + } + if (ackermannParams.size > 0) + PxVehicleAckermannSteerUpdate( + commands->steer, + *steerResponseParams, ackermannParams, + steerResponseStates); + + return true; + } +}; + + +/** +\brief Determine the actuation state for each wheel of a direct drive vehicle. +\note The actuation state for each wheel contains a binary record of whether brake and drive torque are to be applied to the wheel. +@see PxVehicleDirectDriveCommandResponseComponent +@see PxVehicleDirectDrivetrainComponent +@see PxVehicleDirectDriveActuationStateUpdate +*/ +class PxVehicleDirectDriveActuationStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDriveActuationStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDriveActuationStateComponent() {} + + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseStates The brake response states. + \param[out] throttleResponseStates The throttle response states. + \param[out] actuationStates The actuation states. + */ + virtual void getDataForDirectDriveActuationStateComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& actuationStates) = 0; + + /** + \brief Compute the actuation state for each wheel given the brake, handbrake and throttle states. + \*/ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDriveActuationStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData actuationStates; + + getDataForDirectDriveActuationStateComponent( + axleDescription, + brakeResponseStates, throttleResponseStates, + actuationStates); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleDirectDriveActuationStateUpdate( + brakeResponseStates[wheelId], throttleResponseStates[wheelId], + actuationStates[wheelId]); + } + + return true; + } +}; + +/** +\brief Forward integrate the angular speed of each wheel on a vehicle by integrating the +brake and drive torque applied to each wheel and the torque that develops on the tire as a response +to the longitudinal tire force. +@see PxVehicleDirectDriveUpdate +*/ +class PxVehicleDirectDrivetrainComponent : public PxVehicleComponent +{ +public: + + PxVehicleDirectDrivetrainComponent() : PxVehicleComponent() {} + virtual ~PxVehicleDirectDrivetrainComponent() {} + + virtual void getDataForDirectDrivetrainComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& throttleResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& tireForces, + PxVehicleArrayData& wheelRigidBody1dStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleDirectDrivetrainComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData throttleResponseStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData actuationStates; + PxVehicleArrayData tireForces; + PxVehicleArrayData wheelRigidBody1dStates; + + getDataForDirectDrivetrainComponent(axleDescription, + brakeResponseStates, throttleResponseStates, + wheelParams, actuationStates, tireForces, + wheelRigidBody1dStates); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleDirectDriveUpdate( + wheelParams[wheelId], actuationStates[wheelId], + brakeResponseStates[wheelId], throttleResponseStates[wheelId], + tireForces[wheelId], + dt, + wheelRigidBody1dStates[wheelId]); + } + + return true; + } +}; + +/** +\brief Forward the applicable set of control values for a vehicle driven by an engine to a command response state for each +applicable control value. + +If parameters for an autobox are provided, the autobox will determine if a gear change should begin in order to +maintain a desired engine revs. + +@see PxVehicleBrakeCommandLinearUpdate +@see PxVehicleClutchCommandResponseLinearUpdate +@see PxVehicleEngineDriveThrottleCommandResponseUpdate +@see PxVehicleSteerCommandLinearUpdate +@see PxVehicleAckermannSteerUpdate +@see PxVehicleAutoBoxUpdate +@see PxVehicleGearCommandResponseUpdate +*/ +class PxVehicleEngineDriveCommandResponseComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDriveCommandResponseComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDriveCommandResponseComponent() {} + + /** + \brief Provide vehicle data items for this component. + \param[out] axleDescription identifies the wheels on each axle. + \param[out] brakeResponseParams An array of brake response parameters with a brake response for each brake command. + \param[out] steerResponseParams The steer response parameters. + \param[out] ackermannParams The parameters defining Ackermann steering. NULL if no Ackermann steering is desired. + \param[out] gearboxParams The gearbox parameters. + \param[out] clutchResponseParams The clutch response parameters. + \param[out] engineParams The engine parameters. Only needed if an autobox is provided (see autoboxParams), else it can be set to NULL. + \param[out] engineState The engine state. Only needed if an autobox is provided (see autoboxParams), else it can be set to NULL. + \param[out] autoboxParams The autobox parameters. If not NULL, the autobox will determine the target gear. Requires the parameters + engineParams, engineState and autoboxState to be available. If no autobox is desired, NULL can be used in which case + the aforementioned additional parameters can be set to NULL too. + \param[out] rigidBodyState The state of the vehicle's rigid body. + \param[out] commands The throttle, brake, steer etc. command states. + \param[out] transmissionCommands The clutch, target gear etc. command states. If an autobox is provided (see autoboxParams) + and the target gear is set to PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR, then the autobox will trigger + gear shifts. + \param[out] brakeResponseStates The resulting brake response states given the command input and brake response parameters. + \param[out] throttleResponseState The resulting throttle response to the input throttle command. + \param[out] steerResponseStates The resulting steer response states given the command input, steer response and (optionally) Ackermann parameters. + \param[out] gearboxResponseState The resulting gearbox response state given the command input and gearbox parameters. + \param[out] clutchResponseState The resulting clutch state given the command input and clutch response parameters. + \param[out] autoboxState The resulting autobox state given the autobox/engine/gear params and engine state. Only needed if an autobox is + provided (see autoboxParams), else it can be set to NULL. + */ + virtual void getDataForEngineDriveCommandResponseComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + PxVehicleSizedArrayData& ackermannParams, + const PxVehicleGearboxParams*& gearboxParams, + const PxVehicleClutchCommandResponseParams*& clutchResponseParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleRigidBodyState*& rigidBodyState, + const PxVehicleEngineState*& engineState, + const PxVehicleAutoboxParams*& autoboxParams, + const PxVehicleCommandState*& commands, + const PxVehicleEngineDriveTransmissionCommandState*& transmissionCommands, + PxVehicleArrayData& brakeResponseStates, + PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + PxVehicleArrayData& steerResponseStates, + PxVehicleGearboxState*& gearboxResponseState, + PxVehicleClutchCommandResponseState*& clutchResponseState, + PxVehicleAutoboxState*& autoboxState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDriveCommandResponseComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleSizedArrayData brakeResponseParams; + const PxVehicleSteerCommandResponseParams* steerResponseParams; + PxVehicleSizedArrayData ackermannParams; + const PxVehicleGearboxParams* gearboxParams; + const PxVehicleClutchCommandResponseParams* clutchResponseParams; + const PxVehicleEngineParams* engineParams; + const PxVehicleRigidBodyState* rigidBodyState; + const PxVehicleEngineState* engineState; + const PxVehicleAutoboxParams* autoboxParams; + const PxVehicleCommandState* commands; + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands; + PxVehicleArrayData brakeResponseStates; + PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + PxVehicleArrayData steerResponseStates; + PxVehicleGearboxState* gearboxResponseState; + PxVehicleClutchCommandResponseState* clutchResponseState; + PxVehicleAutoboxState* autoboxState; + + getDataForEngineDriveCommandResponseComponent(axleDescription, + brakeResponseParams, steerResponseParams, ackermannParams, + gearboxParams, clutchResponseParams, engineParams, rigidBodyState, + engineState, autoboxParams, + commands, transmissionCommands, + brakeResponseStates, throttleResponseState, + steerResponseStates, + gearboxResponseState, clutchResponseState, autoboxState); + + //The autobox can modify commands like throttle and target gear. Since the user defined + //values should not be overwritten, a copy is used to compute the response. + PxVehicleCommandState commandsTmp = *commands; + PxVehicleEngineDriveTransmissionCommandState transmissionCommandsTmp = *transmissionCommands; + + const PxReal longitudinalSpeed = rigidBodyState->getLongitudinalSpeed(context.frame); + + //Let the autobox set the target gear, unless the user defined target gear requests + //a shift already + if (autoboxParams) + { + PX_ASSERT(engineParams); + PX_ASSERT(engineState); + PX_ASSERT(autoboxState); + + PxVehicleAutoBoxUpdate( + *engineParams, *gearboxParams, *autoboxParams, + *engineState, *gearboxResponseState, dt, + transmissionCommandsTmp.targetGear, *autoboxState, commandsTmp.throttle); + } + else if (transmissionCommandsTmp.targetGear == PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR) + { + //If there is no autobox but eAUTOMATIC_GEAR was specified, use the current target gear + transmissionCommandsTmp.targetGear = gearboxResponseState->targetGear; + } + + //Distribute brake torque to the wheels across each axle. + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleBrakeCommandResponseUpdate( + commandsTmp.brakes, commandsTmp.nbBrakes, longitudinalSpeed, + wheelId, brakeResponseParams, + brakeResponseStates[i]); + } + + //Update target gear as required. + PxVehicleGearCommandResponseUpdate( + transmissionCommandsTmp.targetGear, + *gearboxParams, + *gearboxResponseState); + + //Compute the response to the clutch command. + PxVehicleClutchCommandResponseLinearUpdate( + transmissionCommandsTmp.clutch, + *clutchResponseParams, + *clutchResponseState); + + //Compute the response to the throttle command. + PxVehicleEngineDriveThrottleCommandResponseLinearUpdate( + commandsTmp, + *throttleResponseState); + + //Update the steer angles and Ackermann correction. + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + PxVehicleSteerCommandResponseUpdate(commandsTmp.steer, longitudinalSpeed, wheelId, *steerResponseParams, steerResponseStates[i]); + } + if (ackermannParams.size > 0) + PxVehicleAckermannSteerUpdate(commandsTmp.steer, *steerResponseParams, ackermannParams, steerResponseStates); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a multi-wheel drive differential. +@see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleMultiWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleMultiWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleMultiWheelDriveDifferentialStateComponent() {} + + virtual void getDataForMultiWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleMultiWheelDriveDifferentialParams*& differentialParams, + PxVehicleDifferentialState*& differentialState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleMultiWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleMultiWheelDriveDifferentialParams* differentialParams; + PxVehicleDifferentialState* differentialState; + + getDataForMultiWheelDriveDifferentialStateComponent(axleDescription, + differentialParams, differentialState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, + *differentialParams, + *differentialState); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a differential delivering torque to multiple wheels +with limited slip applied to specified wheel pairs. +@see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleFourWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleFourWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleFourWheelDriveDifferentialStateComponent() {} + + virtual void getDataForFourWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleFourWheelDriveDifferentialParams*& differentialParams, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleDifferentialState*& differentialState, + PxVehicleWheelConstraintGroupState*& wheelConstraintGroupState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleFourWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleFourWheelDriveDifferentialParams* differentialParams; + PxVehicleArrayData wheelRigidbody1dStates; + PxVehicleDifferentialState* differentialState; + PxVehicleWheelConstraintGroupState* wheelConstraintGroupState; + + getDataForFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams, + wheelRigidbody1dStates, + differentialState, wheelConstraintGroupState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, *differentialParams, + wheelRigidbody1dStates, dt, + *differentialState, *wheelConstraintGroupState); + + return true; + } +}; + +/** +\brief Compute the per wheel drive torque split of a tank drive differential. +@see PxVehicleDifferentialStateUpdate +*/ +class PxVehicleTankDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleTankDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleTankDriveDifferentialStateComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] transmissionCommands specifies the values of the thrust controllers that divert torque to the tank tracks. + \param[out] wheelParams is an array describing the radius of each wheel. + \param[out] differentialParams describes the operation of the tank differential by + specifying the default torque split between all wheels connected to the differential and by + specifying the wheels coupled to each tank track. + \param[out] differentialState stores the instantaneous torque split between all wheels arising from the difference between the thrust controllers. + \param[out] constraintGroupState stores the groups of wheels that are connected by sharing a tank track. + */ + virtual void getDataForTankDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleTankDriveTransmissionCommandState*& transmissionCommands, + PxVehicleArrayData& wheelParams, + const PxVehicleTankDriveDifferentialParams*& differentialParams, + PxVehicleDifferentialState*& differentialState, + PxVehicleWheelConstraintGroupState*& constraintGroupState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleTankDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleTankDriveTransmissionCommandState* transmissionCommands; + PxVehicleArrayData wheelParams; + const PxVehicleTankDriveDifferentialParams* differentialParams; + PxVehicleDifferentialState* differentialState; + PxVehicleWheelConstraintGroupState* constraintGroupState; + + getDataForTankDriveDifferentialStateComponent( + axleDescription, + transmissionCommands, + wheelParams, + differentialParams, + differentialState, constraintGroupState); + + PxVehicleDifferentialStateUpdate( + *axleDescription, + wheelParams, *differentialParams, + transmissionCommands->thrusts[0], transmissionCommands->thrusts[1], + *differentialState, *constraintGroupState); + + return true; + } +}; + +/** +@deprecated + +\brief Compute the per wheel drive torque split of a four wheel drive differential. +@see PxVehicleDifferentialStateUpdate +*/ +class PX_DEPRECATED PxVehicleLegacyFourWheelDriveDifferentialStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacyFourWheelDriveDifferentialStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacyFourWheelDriveDifferentialStateComponent() {} + + virtual void getDataForLegacyFourWheelDriveDifferentialStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleFourWheelDriveDifferentialLegacyParams*& differentialParams, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleDifferentialState*& differentialState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleLegacyFourWheelDriveDifferentialStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleFourWheelDriveDifferentialLegacyParams* differentialParams; + PxVehicleArrayData wheelRigidbody1dStates; + PxVehicleDifferentialState* differentialState; + + getDataForLegacyFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams, + wheelRigidbody1dStates, + differentialState); + + PxVehicleDifferentialStateUpdate( + *differentialParams, wheelRigidbody1dStates, + *differentialState); + + return true; + } +}; + +/** +\brief Determine the actuation state for each wheel for a vehicle propelled by engine torque. +\note The actuation state for each wheel contains a binary record of whether brake and drive torque are to be applied to the wheel. +@see PxVehicleEngineDriveActuationStateUpdate +*/ +class PxVehicleEngineDriveActuationStateComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDriveActuationStateComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDriveActuationStateComponent() {} + + virtual void getDataForEngineDriveActuationStateComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleGearboxParams*& gearboxParams, + PxVehicleArrayData& brakeResponseStates, + const PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + const PxVehicleGearboxState*& gearboxState, + const PxVehicleDifferentialState*& differentialState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + PxVehicleArrayData& actuationStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDriveActuationStateComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleGearboxParams* gearboxParams; + PxVehicleArrayData brakeResponseStates; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + const PxVehicleGearboxState* gearboxState; + const PxVehicleDifferentialState* differentialState; + const PxVehicleClutchCommandResponseState* clutchResponseState; + PxVehicleArrayData actuationStates; + + getDataForEngineDriveActuationStateComponent(axleDescription, gearboxParams, + brakeResponseStates, throttleResponseState, + gearboxState, differentialState, clutchResponseState, + actuationStates); + + PxVehicleEngineDriveActuationStateUpdate( + *axleDescription, + *gearboxParams, + brakeResponseStates, + *throttleResponseState, + *gearboxState, *differentialState, *clutchResponseState, + actuationStates); + + return true; + } +}; + +/** +\brief Forward integrate the angular speed of each wheel and of the engine, accounting for the +state of the clutch, gearbox and differential. +@see PxVehicleGearboxUpdate +@see PxVehicleEngineDrivetrainUpdate +*/ +class PxVehicleEngineDrivetrainComponent : public PxVehicleComponent +{ +public: + + PxVehicleEngineDrivetrainComponent() : PxVehicleComponent() {} + virtual ~PxVehicleEngineDrivetrainComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] wheelParams specifies the radius of each wheel. + \param[out] engineParams specifies the engine's torque curve, idle revs and max revs. + \param[out] clutchParams specifies the maximum strength of the clutch. + \param[out] gearboxParams specifies the gear ratio of each gear. + \param[out] brakeResponseStates stores the instantaneous brake brake torque to apply to each wheel. + \param[out] actuationStates stores whether a brake and/or drive torque are to be applied to each wheel. + \param[out] tireForces stores the lateral and longitudinal tire force that has developed on each tire. + \param[out] throttleResponseState stores the response of the throttle to the input throttle command. + \param[out] clutchResponseState stores the instantaneous clutch strength that arises from the input clutch command. + \param[out] differentialState stores the instantaneous torque split between the wheels. + \param[out] constraintGroupState stores the groups of wheels that are subject to constraints that require them to have the same angular or linear velocity. + \param[out] wheelRigidBody1dStates stores the per wheel angular speed to be computed by the component. + \param[out] engineState stores the engine rotation speed to be computed by the component. + \param[out] gearboxState stores the state of the gearbox to be computed by the component. + \param[out] clutchState stores the clutch slip to be computed by the component. + \note If constraintGroupState is set to NULL it is assumed that there are no requirements for any wheels to have the same angular or linear velocity. + */ + virtual void getDataForEngineDrivetrainComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& wheelParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleClutchParams*& clutchParams, + const PxVehicleGearboxParams*& gearboxParams, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& tireForces, + const PxVehicleEngineDriveThrottleCommandResponseState*& throttleResponseState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + const PxVehicleDifferentialState*& differentialState, + const PxVehicleWheelConstraintGroupState*& constraintGroupState, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState*& engineState, + PxVehicleGearboxState*& gearboxState, + PxVehicleClutchSlipState*& clutchState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehicleEngineDrivetrainComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData wheelParams; + const PxVehicleEngineParams* engineParams; + const PxVehicleClutchParams* clutchParams; + const PxVehicleGearboxParams* gearboxParams; + PxVehicleArrayData brakeResponseStates; + PxVehicleArrayData actuationStates; + PxVehicleArrayData tireForces; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState; + const PxVehicleClutchCommandResponseState* clutchResponseState; + const PxVehicleDifferentialState* differentialState; + const PxVehicleWheelConstraintGroupState* constraintGroupState; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleEngineState* engineState; + PxVehicleGearboxState* gearboxState; + PxVehicleClutchSlipState* clutchState; + + getDataForEngineDrivetrainComponent(axleDescription, wheelParams, + engineParams, clutchParams, gearboxParams, + brakeResponseStates, actuationStates, tireForces, + throttleResponseState, clutchResponseState, differentialState, constraintGroupState, + wheelRigidBody1dStates, engineState, gearboxState, clutchState); + + PxVehicleGearboxUpdate(*gearboxParams, dt, *gearboxState); + + PxVehicleEngineDrivetrainUpdate( + *axleDescription, + wheelParams, + *engineParams, *clutchParams, *gearboxParams, + brakeResponseStates, actuationStates, + tireForces, + *gearboxState, *throttleResponseState, *clutchResponseState, *differentialState, constraintGroupState, + dt, + wheelRigidBody1dStates, *engineState, *clutchState); + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h new file mode 100644 index 0000000..33bef11 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h @@ -0,0 +1,318 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; +struct PxVehicleDirectDriveTransmissionCommandState; +struct PxVehicleEngineDriveTransmissionCommandState; +struct PxVehicleDirectDriveThrottleCommandResponseParams; +struct PxVehicleWheelActuationState; +struct PxVehicleWheelParams; +struct PxVehicleTireForce; +struct PxVehicleWheelRigidBody1dState; +struct PxVehicleEngineParams; +struct PxVehicleGearboxParams; +struct PxVehicleAutoboxParams; +struct PxVehicleEngineState; +struct PxVehicleGearboxState; +struct PxVehicleAutoboxState; +struct PxVehicleClutchCommandResponseParams; +struct PxVehicleClutchCommandResponseState; +struct PxVehicleEngineDriveThrottleCommandResponseState; +struct PxVehicleDifferentialState; +struct PxVehicleMultiWheelDriveDifferentialParams; +struct PxVehicleFourWheelDriveDifferentialParams; +struct PxVehicleTankDriveDifferentialParams; +struct PxVehicleFourWheelDriveDifferentialLegacyParams; +struct PxVehicleClutchParams; +struct PxVehicleWheelConstraintGroupState; +struct PxVehicleClutchSlipState; + +/** +\brief Compute the drive torque response to a throttle command. +\param[in] throttle is the throttle command. +\param[in] transmissionCommands is the gearing command to apply to the direct drive tranmission. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle's rigid body. +\param[in] wheelId specifies the wheel that is to have its throttle response computed. +\param[in] throttleResponseParams specifies the per wheel drive torque response to the throttle command as a nonlinear function of throttle command and longitudinal speed. +\param[out] throttleResponseState is the drive torque response to the input throttle command. +*/ +void PxVehicleDirectDriveThrottleCommandResponseUpdate +(const PxReal throttle, const PxVehicleDirectDriveTransmissionCommandState& transmissionCommands, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleDirectDriveThrottleCommandResponseParams& throttleResponseParams, + PxReal& throttleResponseState); + +/** +\brief Determine the actuation state of a wheel given the brake torque, handbrake torque and drive torque applied to it. +\param[in] brakeTorque is the brake torque to be applied to the wheel. +\param[in] driveTorque is the drive torque to be applied to the wheel. +\param[out] actuationState contains a binary record of whether brake or drive torque is applied to the wheel. +*/ +void PxVehicleDirectDriveActuationStateUpdate +(const PxReal brakeTorque, const PxReal driveTorque, + PxVehicleWheelActuationState& actuationState); + +/** +\brief Forward integrate the angular speed of a wheel given the brake and drive torque applied to it +\param[in] wheelParams specifies the moment of inertia of the wheel. +\param[in] actuationState is a binary record of whether brake and drive torque are to be applied to the wheel. +\param[in] brakeTorque is the brake torque to be applied to the wheel. +\param[in] driveTorque is the drive torque to be applied to the wheel. +\param[in] tireForce specifies the torque to apply to the wheel as a response to the longitudinal tire force. +\param[in] dt is the timestep of the forward integration. +\param[out] wheelRigidBody1dState describes the angular speed of the wheel. +*/ +void PxVehicleDirectDriveUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleWheelActuationState& actuationState, + const PxReal brakeTorque, const PxReal driveTorque, const PxVehicleTireForce& tireForce, + const PxF32 dt, + PxVehicleWheelRigidBody1dState& wheelRigidBody1dState); + +/** +\param[in] engineParams specifies the engine configuration. +\param[in] gearboxParams specifies the gear ratios and the time required to complete a gear change. +\param[in] autoboxParams specifies the conditions for switching gear. +\param[in] engineState contains the current angular speed of the engine. +\param[in] gearboxState describes the current and target gear. +\param[in] dt is the time that has lapsed since the last call to PxVehicleAutoBoxUpdate. +\param[in,out] targetGearCommand specifies the desired target gear for the gearbox. If set to + PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR, the value will get overwritten + with a target gear chosen by the autobox. +\param[out] autoboxState specifies the time that has lapsed since the last automated gear change and contains a record of +any ongoing automated gear change. +\param[out] throttle A throttle command value in [0, 1] that will be set to 0 if a gear change is initiated or is ongoing. + +\note The autobox will not begin a gear change if a gear change is already ongoing. +\note The autobox will not begin a gear change until a threshold time has lapsed since the last automated gear change. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. +\note The autobox will not shift down from 1st gear or up from reverse gear. +\note The autobox shifts in single gear increments or decrements. +\note The autobox instantiates a gear change by setting PxVehicleCommandState::targetGear to be different from +from PxVehicleGearboxState::currentGear +*/ +void PxVehicleAutoBoxUpdate +(const PxVehicleEngineParams& engineParams, const PxVehicleGearboxParams& gearboxParams, const PxVehicleAutoboxParams& autoboxParams, + const PxVehicleEngineState& engineState, const PxVehicleGearboxState& gearboxState, + const PxReal dt, + PxU32& targetGearCommand, PxVehicleAutoboxState& autoboxState, + PxReal& throttle); + +/** +\brief Propagate input gear commands to the gearbox state. +\param[in] targetGearCommand specifies the target gear for the gearbox. +\param[in] gearboxParams specifies the number of gears and the index of neutral gear. +\param[out] gearboxState contains a record of the current and target gear. +\note Any ongoing gear change must complete before starting another. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. + \note The gearbox remains in neutral for the duration of the gear change. + \note A gear change begins if PxVehicleCommandState::targetGear is different from PxVehicleGearboxState::currentGear. +*/ +void PxVehicleGearCommandResponseUpdate +(const PxU32 targetGearCommand, + const PxVehicleGearboxParams& gearboxParams, + PxVehicleGearboxState& gearboxState); + +/** +\brief Propagate the input clutch command to the clutch response state. +\param[in] clutchCommand specifies the state of the clutch pedal. +\param[in] clutchResponseParams specifies how the clutch responds to the input clutch command. +\param[out] clutchResponse specifies the response of the clutch to the input clutch command. +*/ +void PxVehicleClutchCommandResponseLinearUpdate +(const PxReal clutchCommand, + const PxVehicleClutchCommandResponseParams& clutchResponseParams, + PxVehicleClutchCommandResponseState& clutchResponse); + +/** +\brief Propagate the input throttle command to the throttle response state. +\param[in] commands specifies the state of the throttle pedal. +\param[out] throttleResponse specifies how the clutch responds to the input throttle command. +*/ +void PxVehicleEngineDriveThrottleCommandResponseLinearUpdate +(const PxVehicleCommandState& commands, + PxVehicleEngineDriveThrottleCommandResponseState& throttleResponse); + +/** +\brief Determine the actuation state of all wheels on a vehicle. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] gearboxParams specifies the index of the neutral gear of the gearbox. +\param[in] brakeResponseStates specifies the response of each wheel to the input brake command. +\param[in] throttleResponseState specifies the response of the engine to the input throttle command. +\param[in] gearboxState specifies the current gear. +\param[in] diffState specifies the fraction of available drive torque to be delivered to each wheel. +\param[in] clutchResponseState specifies the response of the clutch to the input throttle command. +\param[out] actuationStates is an array of binary records determining whether brake and drive torque are to be applied to each wheel. +\note Drive torque is not applied to a wheel if + a) the gearbox is in neutral + b) the differential delivers no torque to the wheel + c) no throttle is applied to the engine + c) the clutch is fully disengaged. +*/ +void PxVehicleEngineDriveActuationStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState, + const PxVehicleGearboxState& gearboxState, const PxVehicleDifferentialState& diffState, const PxVehicleClutchCommandResponseState& clutchResponseState, + PxVehicleArrayData& actuationStates); + +/** +@deprecated + +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] diffParams specifies the operation of a differential that can be connected to up to four wheels. +\param[in] wheelStates describes the angular speed of each wheel +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel. +\note If the handbrake is on then torque is only delivered to the wheels specified as the front wheels of the differential. +*/ +void PX_DEPRECATED PxVehicleDifferentialStateUpdate +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelStates, + PxVehicleDifferentialState& diffState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. Additionally, add wheel constraints for wheel pairs whose +rotational speed ratio exceeds the corresponding differential bias. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] diffParams describe the division of available drive torque and the biases of the limited +slip differential. +\param[in] wheelStates describes the rotational speeds of each wheel. +\param[in] dt is the simulation time that has passes since the last call to PxVehicleDifferentialStateUpdate() +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel. +\param[out] wheelConstraintGroupState describes the groups of wheels that have exceeded their corresponding +differential biases. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleFourWheelDriveDifferentialParams& diffParams, + const PxVehicleArrayData& wheelStates, + const PxReal dt, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] diffParams specifies the operation of a differential that can be connected to any combination of wheels. +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel connected to the differential. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleMultiWheelDriveDifferentialParams& diffParams, + PxVehicleDifferentialState& diffState); + +/** +\brief Compute the fraction of available torque to be delivered to each wheel and gather a list of all +wheels connected to the differential. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams is an array that describes the wheel radius of each wheel. +\param[in] diffParams specifies the operation of a tank differential. +\param[in] thrustCommand0 is the state of one of the two thrust controllers. +\param[in] thrustCommand1 is the state of one of the two thrust controllers. +\param[out] diffState contains the fraction of available drive torque to be delivered to each wheel connected to the differential. +\param[out] wheelConstraintGroupState describes the groups of wheels connected by sharing a tank track. +*/ +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, const PxVehicleTankDriveDifferentialParams& diffParams, + const PxReal thrustCommand0, PxReal thrustCommand1, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState); + + +/** +\brief Update the current gear of the gearbox. If a gear change is ongoing then complete the gear change if a threshold +time has passed since the beginning of the gear change. +\param[in] gearboxParams describes the time required to complete a gear change. +\param[in] dt is the time that has lapsed since the last call to PxVehicleGearboxUpdate. +\param[out] gearboxState is the gearbox state to be updated. +\note A gear change is considered as ongoing for as long as PxVehicleGearboxState::currentGear is different from + PxVehicleGearboxState::targetGear. +*/ +void PxVehicleGearboxUpdate +(const PxVehicleGearboxParams& gearboxParams, + const PxF32 dt, + PxVehicleGearboxState& gearboxState); + +/** +\brief Forward integrate the angular speed of the vehicle's wheels and engine, given the state of clutch, differential and gearbox. +\param[in] axleDescription is a decription of the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams specifies the moment of inertia of each wheel. +\param[in] engineParams specifies the torque curve of the engine and its moment of inertia. +\param[in] clutchParams specifies the maximum clutch strength that happens when the clutch is fully engaged. +\param[in] gearboxParams specifies the gearing ratios of the gearbox. +\param[in] brakeResponseStates describes the per wheel response to the input brake command. +\param[in] actuationStates is a binary record of whether brake or drive torque is applied to each wheel. +\param[in] tireForces describes the torque to apply to each wheel as a response to the longitudinal tire force. +\param[in] gearboxState describes the current gear. +\param[in] throttleResponse describes the engine response to the input throttle pedal. +\param[in] clutchResponse describes the clutch response to the input clutch pedal. +\param[in] diffState describes the fraction of available drive torque to be delivered to each wheel. +\param[in] constraintGroupState describes groups of wheels with rotational speed constrained to the same value. +\param[in] dt is the time that has lapsed since the last call to PxVehicleEngineDrivetrainUpdate +\param[out] wheelRigidbody1dStates describes the angular speed of each wheel. +\param[out] engineState describes the angular speed of the engine. +\param[out] clutchState describes the clutch slip. +\note If constraintGroupState is NULL then it is assumed that there are no wheels subject to rotational speed constraints. +*/ +void PxVehicleEngineDrivetrainUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleEngineParams& engineParams, const PxVehicleClutchParams& clutchParams, const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& actuationStates, + const PxVehicleArrayData& tireForces, + const PxVehicleGearboxState& gearboxState, const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponse, const PxVehicleClutchCommandResponseState& clutchResponse, + const PxVehicleDifferentialState& diffState, const PxVehicleWheelConstraintGroupState* constraintGroupState, + const PxReal dt, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleEngineState& engineState, PxVehicleClutchSlipState& clutchState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h new file mode 100644 index 0000000..908e5a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelRigidBody1dState; + +/** +\brief Compute the coupling strength of the clutch. +\param[in] clutchResponseState describes the response of the clutch to the input clutch command. +\param[in] gearboxParams holds the index of neutral gear. +\param[in] gearboxState describes the current gear. +\note If the gear is in neutral the clutch is fully disengaged and the clutch strength is 0. +\note A clutch response state of 0.0 denotes a fully engaged clutch with maximum strength. +\note A clutch response state of 1.0 denotes a fully disengaged clutch with a strength of 0.0. +*/ +PX_FORCE_INLINE PxReal PxVehicleClutchStrengthCompute(const PxVehicleClutchCommandResponseState& clutchResponseState, const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState) +{ + return (gearboxParams.neutralGear != gearboxState.currentGear) ? clutchResponseState.commandResponse : 0.0f; +} + +/** +\brief Compute the damping rate of the engine. +\param[in] engineParams describes various damping rates of the engine in different operational states. +\param[in] gearboxParams holds the index of neutral gear. +\param[in] gearboxState describes the current gear. +\param[in] clutchResponseState is the response of the clutch to the clutch command. +\param[in] throttleResponseState is the response of the throttle to the throttle command. +\note Engines typically have different damping rates with clutch engaged and disengaged. +\note Engines typically have different damping rates at different throttle pedal values. +@see PxVehicleClutchStrengthCompute() +\note In neutral gear the clutch is considered to be fully disengaged. +*/ +PX_FORCE_INLINE PxReal PxVehicleEngineDampingRateCompute +(const PxVehicleEngineParams& engineParams, + const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState, + const PxVehicleClutchCommandResponseState& clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState) +{ + const PxReal K = (gearboxParams.neutralGear != gearboxState.currentGear) ? clutchResponseState.normalisedCommandResponse : 0.0f; + const PxReal zeroThrottleDamping = engineParams.dampingRateZeroThrottleClutchEngaged + + (1.0f - K)* (engineParams.dampingRateZeroThrottleClutchDisengaged - engineParams.dampingRateZeroThrottleClutchEngaged); + const PxReal appliedThrottle = throttleResponseState.commandResponse; + const PxReal fullThrottleDamping = engineParams.dampingRateFullThrottle; + const PxReal engineDamping = zeroThrottleDamping + (fullThrottleDamping - zeroThrottleDamping)*appliedThrottle; + return engineDamping; +} + +/** +\brief Compute the gear ratio delivered by the gearbox in the current gear. +\param[in] gearboxParams describes the gear ratio of each gear and the final ratio. +\param[in] gearboxState describes the current gear. +\note The gear ratio is the product of the gear ratio of the current gear and the final gear ratio of the gearbox. +*/ +PX_FORCE_INLINE PxReal PxVehicleGearRatioCompute +(const PxVehicleGearboxParams& gearboxParams, const PxVehicleGearboxState& gearboxState) +{ + const PxReal gearRatio = gearboxParams.ratios[gearboxState.currentGear] * gearboxParams.finalRatio; + return gearRatio; +} + +/** +\brief Compute the drive torque to deliver to the engine. +\param[in] engineParams describes the profile of maximum available torque across the full range of engine rotational speed. +\param[in] engineState describes the engine rotational speed. +\param[in] throttleCommandResponseState describes the engine's response to input throttle command. +*/ +PX_FORCE_INLINE PxReal PxVehicleEngineDriveTorqueCompute +(const PxVehicleEngineParams& engineParams, const PxVehicleEngineState& engineState, const PxVehicleEngineDriveThrottleCommandResponseState& throttleCommandResponseState) +{ + const PxReal appliedThrottle = throttleCommandResponseState.commandResponse; + const PxReal peakTorque = engineParams.peakTorque; + const PxVehicleFixedSizeLookupTable& torqueCurve = engineParams.torqueCurve; + const PxReal normalisedRotSpeed = engineState.rotationSpeed/engineParams.maxOmega; + const PxReal engineDriveTorque = appliedThrottle*peakTorque*torqueCurve.interpolate(normalisedRotSpeed); + return engineDriveTorque; +} + +/** +@deprecated + +\brief Compute the contribution that each wheel makes to the averaged wheel speed at the clutch plate connected to the wheels driven by +the differential. +\param[in] diffParams describes the wheels coupled to the differential and the operation of the torque split at the differential. +\param[in] nbWheels The number of wheels. Can be larger than the number of wheels connected to the differential. +\param[out] diffAveWheelSpeedContributions describes the contribution that each wheel makes to the averaged wheel speed at the clutch. + The buffer needs to be sized to be able to hold at least nbWheels entries. +\note Any wheel on an axle connected to the differential could have a non-zero value, depending on the way the differential couples to the wheels. +\note Any wheel on an axle not connected to the differential will have a zero contribution to the averaged wheel speed. +*/ +void PX_DEPRECATED PxVehicleLegacyDifferentialWheelSpeedContributionsCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxU32 nbWheels, PxReal* diffAveWheelSpeedContributions); + +/** +@deprecated + +\brief Compute the fraction of available torque that is delivered to each wheel through the differential. +\param[in] diffParams describes the wheels coupled to the differential and the operation of the torque split at the differential. +\param[in] wheelOmegas describes the rotational speeds of the wheels. Is expected to have nbWheels entries. +\param[in] nbWheels The number of wheels. Can be larger than the number of wheels connected to the differential. +\param[out] diffTorqueRatios describes the fraction of available torque delivered to each wheel. + The buffer needs to be sized to be able to hold at least nbWheels entries. +\note Any wheel on an axle connected to the diff could receive a non-zero ratio, depending on the way the differential couples to the wheels. +\note Any wheel not on an axle connected to the diff will have a zero value. +\note The sum of all the ratios adds to 1.0. +\note Slipping wheels driven by the differential will typically receive less torque than non-slipping wheels in the event that the +differential has a limited slip configuration. +*/ +void PX_DEPRECATED PxVehicleLegacyDifferentialTorqueRatiosCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelOmegas, + const PxU32 nbWheels, PxReal* diffTorqueRatios); + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h new file mode 100644 index 0000000..cb2bdc8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainParams.h @@ -0,0 +1,991 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" +#include "common/PxCoreUtilityTypes.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Distribute a throttle response to the wheels of a direct drive vehicle. +\note The drive torque applied to each wheel on the ith axle is throttleCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable drive torque +that occurs when the steer command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable drive torque per wheel as a fractional multiplier of the vehicle's maximum achievable steer angle. +*/ +struct PxVehicleDirectDriveThrottleCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleDirectDriveThrottleCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleDirectDriveThrottleCommandResponseParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.maxResponse *= (scale*scale); //Max response is a torque! + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_CHECK_AND_RETURN_VAL(PxIsFinite(maxResponse), "PxVehicleDirectDriveThrottleCommandResponseParams.maxResponse must be a finite value", false); + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(PxIsFinite(wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]]), "PxVehicleDirectDriveThrottleCommandResponseParams.wheelResponseMultipliers[i] must be a finite value", false); + } + return true; + } +}; + +/** +\brief Specifies the maximum clutch strength that occurs when the clutch pedal is fully disengaged and the clutch is fully engaged. +*/ +struct PxVehicleClutchCommandResponseParams +{ + /** + \brief Strength of clutch. + + \note The clutch is the mechanism that couples the engine to the wheels. + A stronger clutch more strongly couples the engine to the wheels, while a + clutch of strength zero completely decouples the engine from the wheels. + Stronger clutches more quickly bring the wheels and engine into equilibrium, while weaker + clutches take longer, resulting in periods of clutch slip and delays in power transmission + from the engine to the wheels. + The torque generated by the clutch is proportional to the clutch strength and + the velocity difference between the engine's rotational speed and the rotational speed of the + driven wheels after accounting for the gear ratio. + The torque at the clutch is applied negatively to the engine and positively to the driven wheels. + + Range: [0,inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal maxResponse; + + PX_FORCE_INLINE PxVehicleClutchCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + const PxReal scale = trgScale.scale/srcScale.scale; + PxVehicleClutchCommandResponseParams r = *this; + r.maxResponse *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(maxResponse >= 0.0f, "PxVehicleClutchCommandResponseParams.maxResponse must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief Choose between a potentially more expensive but more accurate solution to the clutch model or a potentially cheaper but less accurate solution. +@see PxVehicleClutchParams +*/ +struct PxVehicleClutchAccuracyMode +{ + enum Enum + { + eESTIMATE = 0, + eBEST_POSSIBLE + }; +}; + +/** +\brief The clutch connects two plates together. One plate rotates with the speed of the engine. The second plate rotates with a weighted average of all +wheels connected to the differential after accounting for the gear ratio. The difference in rotation speeds generates a restoring torque applied to engine and wheels +that aims to reduce the difference in rotational speed. The restoring torque is proportional to the clutch strength and the clutch pedal position. +*/ +struct PxVehicleClutchParams +{ +public: + + /** + \brief The engine and wheel rotation speeds that are coupled through the clutch can be updated by choosing + one of two modes: eESTIMATE and eBEST_POSSIBLE. + + \note If eESTIMATE is chosen the vehicle sdk will update the wheel and engine rotation speeds + with estimated values to the implemented clutch model. + + \note If eBEST_POSSIBLE is chosen the vehicle sdk will compute the best possible + solution (within floating point tolerance) to the implemented clutch model. + This is the recommended mode. + + \note The clutch model remains the same if either eESTIMATE or eBEST_POSSIBLE is chosen but the accuracy and + computational cost of the solution to the model can be tuned as required. + */ + PxVehicleClutchAccuracyMode::Enum accuracyMode; + + /** + \brief Tune the mathematical accuracy and computational cost of the computed estimate to the wheel and + engine rotation speeds if eESTIMATE is chosen. + + \note As estimateIterations increases the computational cost of the clutch also increases and the solution + approaches the solution that would be computed if eBEST_POSSIBLE was chosen instead. + + \note This has no effect if eBEST_POSSIBLE is chosen as the accuracy mode. + + \note A value of zero is not allowed if eESTIMATE is chosen as the accuracy mode. + */ + PxU32 estimateIterations; + + PX_FORCE_INLINE PxVehicleClutchParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL((PxVehicleClutchAccuracyMode::eBEST_POSSIBLE == accuracyMode) || ((PxVehicleClutchAccuracyMode::eESTIMATE == accuracyMode) && (estimateIterations > 0)), "PxVehicleClutchParams.estimateIterations must be greater than zero if PxVehicleClutchAccuracyMode::eESTIMATE is selected", false); + return true; + } +}; + + +struct PxVehicleEngineParams +{ + /** + \brief Maximum supported number of points in the #torqueCurve graph. + */ + enum + { + eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES = 8 + }; + + /** + \brief Graph of normalized torque (torque/#peakTorque) against normalized engine speed ( engineRotationSpeed / #maxOmega ). + + \note The normalized engine speed is the x-axis of the graph, while the normalized torque is the y-axis of the graph. + */ + PxVehicleFixedSizeLookupTable torqueCurve; + + /** + \brief Moment of inertia of the engine around the axis of rotation. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxReal moi; + + /** + \brief Maximum torque available to apply to the engine when the accelerator pedal is at maximum. + + \note The torque available is the value of the accelerator pedal (in range [0, 1]) multiplied by the normalized torque as computed from #torqueCurve multiplied by #peakTorque. + + Range: [0, inf)
+ Unit: mass * (length^2) / (time^2) + */ + PxReal peakTorque; + + /** + \brief Minimum rotation speed of the engine. + + Range: [0, inf)
+ Unit: radians / time + */ + PxReal idleOmega; + + /** + \brief Maximum rotation speed of the engine. + + Range: [0, inf)
+ Unit: radians / time + */ + PxReal maxOmega; + + /** + \brief Damping rate of engine when full throttle is applied. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateFullThrottle; + + /** + \brief Damping rate of engine when no throttle is applied and with engaged clutch. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateZeroThrottleClutchEngaged; + + /** + \brief Damping rate of engine when no throttle is applied and with disengaged clutch. + + \note If the clutch is engaged (any gear except neutral) then the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchEngaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchEngaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchEngaged)*acceleratorPedal; + + \note If the clutch is disengaged (in neutral gear) the damping rate applied at run-time is an interpolation + between #dampingRateZeroThrottleClutchDisengaged and #dampingRateFullThrottle: + #dampingRateZeroThrottleClutchDisengaged + (#dampingRateFullThrottle-#dampingRateZeroThrottleClutchDisengaged)*acceleratorPedal; + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRateZeroThrottleClutchDisengaged; + + PX_FORCE_INLINE PxVehicleEngineParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleEngineParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.moi *= (scale*scale); + r.peakTorque *= (scale*scale); + r.dampingRateFullThrottle *= (scale*scale); + r.dampingRateZeroThrottleClutchDisengaged *= (scale*scale); + r.dampingRateZeroThrottleClutchEngaged *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(moi > 0.0f, "PxVehicleEngineParams.moi must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(peakTorque >= 0.0f, "PxVehicleEngineParams.peakTorque must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(torqueCurve.isValid(), "PxVehicleEngineParams.torqueCurve is invalid", false); + PX_CHECK_AND_RETURN_VAL(maxOmega >= 0.0f, "PxVehicleEngineParams.maxOmega must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(idleOmega >= 0.0f, "PxVehicleEngineParams.idleOmega must be greater or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateFullThrottle >= 0.0f, "PxVehicleEngineParams.dampingRateFullThrottle must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateZeroThrottleClutchEngaged >= 0.0f, "PxVehicleEngineParams.dampingRateZeroThrottleClutchEngaged must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRateZeroThrottleClutchDisengaged >= 0.0f, "PxVehicleEngineParams.dampingRateZeroThrottleClutchDisengaged must be greater than or equal to zero", false) + return true; + } +}; + +struct PxVehicleGearboxParams +{ +public: + + /** + \brief The gear that denotes neutral gear + */ + PxU32 neutralGear; + + /** + \brief Maximum supported number of gears, including reverse and neutral. + */ + enum Enum + { + eMAX_NB_GEARS = 32 + }; + + /** + \brief Gear ratios + + The ratio for reverse gears must be negative, the ratio for the neutral gear + has to be 0 and the ratio for forward gears must be positive. + */ + PxReal ratios[eMAX_NB_GEARS]; + + /** + \brief Gear ratio applied is #ratios[currentGear]*#finalRatio + + Range: (0, inf)
+ */ + PxReal finalRatio; + + /** + \brief Number of gears (including reverse and neutral). + + Range: [1, eMAX_NB_GEARS]
+ */ + PxU32 nbRatios; + + /** + \brief Time it takes to switch gear. + + Range: [0, inf)
+ Unit: time + */ + PxReal switchTime; + + PX_FORCE_INLINE PxVehicleGearboxParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(finalRatio > 0, "PxVehicleGearboxParams.finalRatio must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbRatios >= 1, "PxVehicleGearboxParams.nbRatios must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(nbRatios <= eMAX_NB_GEARS, "PxVehicleGearboxParams.nbRatios must be less than or equal to eMAX_NB_GEARS", false); + PX_CHECK_AND_RETURN_VAL(neutralGear < nbRatios, "PxVehicleGearboxParams.neutralGear must be less than PxVehicleGearboxParams.nbRatios", false); + PX_CHECK_AND_RETURN_VAL(switchTime >= 0.0f, "PxVehicleGearboxParams.switchTime must be greater than or equal to zero", false); + for(PxU32 i = 0; i < neutralGear; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] < 0.0f, "Reverse gear ratios must be less than zero", false); + } + { + PX_CHECK_AND_RETURN_VAL(ratios[neutralGear] == 0.0f, "Neutral gear ratio must be equal to zero", false); + } + for (PxU32 i = neutralGear + 1; i < nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] > 0.0f, "Forward gear ratios must be greater than zero", false); + } + for (PxU32 i = neutralGear + 2; i < nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(ratios[i] < ratios[i - 1], "Forward gear ratios must be a descending sequence of gear ratios", false); + } + return true; + } +}; + + +struct PxVehicleAutoboxParams +{ +public: + + /** + \brief Value of ( engineRotationSpeed /maxEngineRevs ) that is high enough to increment gear. + + \note When ( engineRotationSpeed / #PxVehicleEngineParams::maxOmega ) > upRatios[currentGear] the autobox will begin + a transition to currentGear+1 unless currentGear is the highest possible gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal upRatios[PxVehicleGearboxParams::eMAX_NB_GEARS]; + + /** + \brief Value of engineRevs/maxEngineRevs that is low enough to decrement gear. + + \note When ( engineRotationSpeed / #PxVehicleEngineParams::maxOmega) < downRatios[currentGear] the autobox will begin + a transition to currentGear-1 unless currentGear is first gear or neutral or reverse. + + Range: [0, 1]
+ */ + PxReal downRatios[PxVehicleGearboxParams::eMAX_NB_GEARS]; + + /** + \brief Set the latency time of the autobox. + + \note Latency time is the minimum time that must pass between each gear change that is initiated by the autobox. + The auto-box will only attempt to initiate another gear change up or down if the simulation time that has passed since the most recent + automated gear change is greater than the specified latency. + + Range: [0, inf)
+ Unit: time + */ + PxReal latency; + + PX_FORCE_INLINE PxVehicleAutoboxParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleGearboxParams& gearboxParams) const + { + if (!gearboxParams.isValid()) + return false; + + for (PxU32 i = gearboxParams.neutralGear + 1; i < gearboxParams.nbRatios-1; i++) + { + PX_CHECK_AND_RETURN_VAL(upRatios[i] >= 0.0f, "PxVehicleAutoboxParams.upRatios must be greater than or equal to zero", false); + } + for (PxU32 i = gearboxParams.neutralGear + 2; i < gearboxParams.nbRatios; i++) + { + PX_CHECK_AND_RETURN_VAL(downRatios[i] >= 0.0f, "PxVehicleAutoboxParams.downRatios must be greater than or equal to zero", false); + } + PX_CHECK_AND_RETURN_VAL(latency >= 0.0f, "PxVehicleAutoboxParams.latency must be greater than or equal to zero", false); + return true; + } +}; + +/** +@deprecated +*/ +struct PX_DEPRECATED PxVehicleFourWheelDriveDifferentialLegacyParams +{ +public: + + enum Enum + { + eDIFF_TYPE_LS_4WD, //limited slip differential for car with 4 driven wheels + eDIFF_TYPE_LS_FRONTWD, //limited slip differential for car with front-wheel drive + eDIFF_TYPE_LS_REARWD, //limited slip differential for car with rear-wheel drive + eMAX_NB_DIFF_TYPES + }; + + /** + \brief The two front wheels are specified by the array frontWheelIds. + \note The states eDIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_FRONTWD require knowledge of the front wheels + to allow torque splits between front and rear axles as well as torque splits across the front axle. + \note frontWheelIds[0] should specify the wheel on the front axle that is negatively placed on the lateral axis. + \note frontWheelIds[1] should specify the wheel on the front axle that is positively placed on the lateral axis. + \note If #frontNegPosSplit > 0.5, more torque will be delivered to the wheel specified by frontWheelIds[0] than to the wheel + specified by frontWheelIds[1]. The converse is true if #frontNegPosSplit < 0.5. + */ + PxU32 frontWheelIds[2]; + + + /** + \brief The two rear wheels are specified by the array rearWheelIds. + \note The states eDIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_REARWD require knowledge of the rear wheels + to allow torque splits between front and rear axles as well as torque splits across the rear axle. + \note rearWheelIds[0] should specify the wheel on the rear axle that is negatively placed on the lateral axis. + \note rearWheelIds[1] should specify the wheel on the rear axle that is positively placed on the lateral axis. + \note If #rearNegPosSplit > 0.5, more torque will be delivered to the wheel specified by rearWheelIds[0] than to the wheel + specified by rearWheelIds[1]. The converse is true if #rearNegPosSplit < 0.5. + */ + PxU32 rearWheelIds[2]; + + /** + \brief Ratio of torque split between front and rear wheels (>0.5 means more front, <0.5 means more to rear). + + \note Only applied to DIFF_TYPE_LS_4WD + + Range: [0, 1]
+ */ + PxReal frontRearSplit; + + /** + \brief Ratio of torque split between front-negative and front-positive wheels (>0.5 means more to #frontWheelIds[0], <0.5 means more to #frontWheelIds[1]). + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_FRONTWD + + Range: [0, 1]
+ */ + PxReal frontNegPosSplit; + + /** + \brief Ratio of torque split between rear-negative wheel and rear-positive wheels (>0.5 means more to #rearWheelIds[0], <0.5 means more to #rearWheelIds[1]). + + \note Only applied to DIFF_TYPE_LS_4WD and eDIFF_TYPE_LS_REARWD + + Range: [0, 1]
+ */ + PxReal rearNegPosSplit; + + /** + \brief Maximum allowed ratio of average front wheel rotation speed and rear wheel rotation speeds. + The differential will divert more torque to the slower wheels when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD + + Range: [1, inf)
+ */ + PxReal centerBias; + + /** + \brief Maximum allowed ratio of front-left and front-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_FRONTWD + + Range: [1, inf)
+ */ + PxReal frontBias; + + /** + \brief Maximum allowed ratio of rear-left and rear-right wheel rotation speeds. + The differential will divert more torque to the slower wheel when the bias is exceeded. + + \note Only applied to DIFF_TYPE_LS_4WD and DIFF_TYPE_LS_REARWD + + Range: [1, inf)
+ */ + PxReal rearBias; + + /** + \brief Type of differential. + + Range: [DIFF_TYPE_LS_4WD, eDIFF_TYPE_LS_REARWD]
+ */ + Enum type; + + PX_FORCE_INLINE PxVehicleFourWheelDriveDifferentialLegacyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_UNUSED(axleDesc); + PX_CHECK_AND_RETURN_VAL((axleDesc.getAxle(frontWheelIds[0]) != 0xffffffff) && (axleDesc.getAxle(frontWheelIds[0])== axleDesc.getAxle(frontWheelIds[1])), "frontWheelIds[0] and frontWheelIds[1] must reference wheels on the same axle", false); + PX_CHECK_AND_RETURN_VAL((axleDesc.getAxle(rearWheelIds[0]) != 0xffffffff) && (axleDesc.getAxle(rearWheelIds[0]) == axleDesc.getAxle(rearWheelIds[1])), "rearWheelIds[0] and rearWheelIds[1] must reference wheels on the same axle", false); + PX_CHECK_AND_RETURN_VAL(frontRearSplit <= 1.0f && frontRearSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontRearSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(frontNegPosSplit <= 1.0f && frontNegPosSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontNegPosSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(rearNegPosSplit <= 1.0f && rearNegPosSplit >= 0.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.rearNegPosSplit must be in range [0,1]", false); + PX_CHECK_AND_RETURN_VAL(centerBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.centerBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(frontBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.frontBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(rearBias >= 1.0f, "PxVehicleLegacyFourWheelDriveDifferentialParams.rearBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(type < PxVehicleFourWheelDriveDifferentialLegacyParams::eMAX_NB_DIFF_TYPES, "PxVehicleLegacyFourWheelDriveDifferentialParams.type has illegal value", false); + return true; + } +}; + +/** +\brief PxVehicleMultiWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from the differential +and the division of torque between the wheels that are connected to the differential. +*/ +struct PxVehicleMultiWheelDriveDifferentialParams +{ + /** + \brief torqueRatios describes the fraction of torque delivered to each wheel through the differential. + \note Wheels not connected to the differential must receive zero torque. + \note Wheels connected to the differential may receive a non-zero torque. + \note The sum of the absolute of the ratios of all wheels must equal to 1.0. + \note A negative torque ratio simulates a wheel with negative gearing applied. + + Range: [1, -1]
+ */ + PxReal torqueRatios[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief aveWheelSpeedRatios describes the contribution of each wheel to the average wheel speed measured at the clutch. + \note Wheels not connected to the differential do not contribute to the average wheel speed measured at the clutch. + \note Wheels connected to the differential may delivere a non-zero contribution to the average wheel speed measured at the clutch. + \note The sum of all ratios of all wheels must equal to 1.0. + + Range: [0, 1]
+ */ + PxReal aveWheelSpeedRatios[PxVehicleLimits::eMAX_NB_WHEELS]; + + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleMultiWheelDriveDifferentialParams)); + } + + PX_FORCE_INLINE PxVehicleMultiWheelDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + PxReal aveWheelSpeedSum = 0.0f; + PxReal torqueRatioSum = 0.0f; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + PX_CHECK_AND_RETURN_VAL(PxAbs(torqueRatios[wheelId]) <= 1.0f, "PxVehicleMultiWheelDriveDifferentialParams.torqueRatios[i] must be in range [-1, 1] for all wheels connected to the differential", false); + PX_CHECK_AND_RETURN_VAL(aveWheelSpeedRatios[wheelId] >= 0.0f && aveWheelSpeedRatios[wheelId] <= 1.0f, "PxVehicleMultiWheelDriveDifferentialParams.aveWheelSpeedRatios[i] must be in range [0, 1] for all wheels connected to the differential", false); + aveWheelSpeedSum += aveWheelSpeedRatios[wheelId]; + torqueRatioSum += PxAbs(torqueRatios[wheelId]); + } + PX_CHECK_AND_RETURN_VAL(aveWheelSpeedSum >= 0.99f && aveWheelSpeedSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.aveWheelSpeedRatios[i] must be 1.0.", false); + PX_CHECK_AND_RETURN_VAL(torqueRatioSum >= 0.99f && torqueRatioSum <= 1.01f, "Sum of PxVehicleMultiWheelDriveDifferentialParams.torqueRatios[i] must be 1.0.", false); + PX_UNUSED(aveWheelSpeedSum); + PX_UNUSED(torqueRatioSum); + return true; + } +}; + +/** +\brief A special value that indicates instantaneous resolution of a slip that exceeds a differential bias. +*/ +#define PX_VEHICLE_FOUR_WHEEL_DIFFERENTIAL_MAXIMUM_STRENGTH PX_MAX_F32 + +/** +\brief PxVehicleFourWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from the differential +and the division of torque between the wheels that are connected to the differential. Additionally, it specifies the biases +and strength of a limited slip differential that operates on two wheels specified as front wheels and two wheels specified +as rear wheels. +*/ +struct PxVehicleFourWheelDriveDifferentialParams : public PxVehicleMultiWheelDriveDifferentialParams +{ + /** + \brief The ids of the two wheels considered by the differential to be the front pair. + \note When the ratio of the rotational speeds of the front wheels exceeds frontBias, drive torque is diverted so + that the ratio approaches the value specified by frontTarget. When the bias is not breached, the drive torque + is specified by the corresponding entries in PxVehicleMultiWheelDriveDifferentialParams::torqueRatios. + */ + PxU32 frontWheelIds[2]; + + /** + \brief The ids of the two wheels considered by the differential to be the rear pair. + \note When the ratio of the rotational speeds of the rear wheels exceeds rearBias, drive torque is diverted so + that the ratio approaches the value specified by rearTarget. When the bias is not breached, the drive torque + is specified by the corresponding entries in PxVehicleMultiWheelDriveDifferentialParams::torqueRatios. + */ + PxU32 rearWheelIds[2]; + + /** + \brief The parameter frontBias specifies the maximum angular speed ratio of the two front wheels specified by frontWheelIds[2]. + \note If frontBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the two front wheels. + \note If frontBias has value 0.0, the torque split between the front wheels is specified by the array torqueRatios. + \note frontBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked axle). + \note If frontBias has value greater than or equal to 1.0 then the array frontWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If frontBias has value greater than or equal to 1.0 then frontTarget must also be specified. + \note A locked axle may be achieved by setting frontBias and frontTarget to 1.0. + \note A limited slip differential may be achieved by setting frontBias > 1.0 and frontBias > frontTarget > 1.0. + */ + PxReal frontBias; + + /** + \brief The parameter frontTarget specifies the target rotational speed ratio of the two front wheels in the event that the ratio exceeds frontBias and frontBias + is configured for an activated limited slip or locked axle. + \note frontTarget must be less than frontBias and greater than 1.0 to implement a limited slip differential. + \note Set frontTarget and frontBias to 1.0 to implement a locked axle. + */ + PxReal frontTarget; + + /** + \brief The parameter rearBias specifies the maximum angular speed ratio of the two rear wheels specified by rearWheelIds[2]. + \note If rearBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the two rear wheels. + \note If rearBias has value 0.0, the torque split between the rear wheels is specified by the array torqueRatios. + \note rearBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked axle). + \note If rearBias has value greater than or equal to 1.0 then the array rearWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If rearBias has value greater than or equal to 1.0 then rearTarget must also be specified. + \note A locked axle may be achieved by setting rearBias and rearTarget to 1.0. + \note A limited slip differential may be achieved by setting rearBias > 1.0 and rearBias > rearTarget > 1.0 + */ + PxReal rearBias; + + /** + \brief The parameter rearTarget specifies the target rotational speed ratio of the two rear wheels in the event that the ratio exceeds rearBias and rearBias + is configured for an activated limited slip or locked axle. + \note rearTarget must be less than rearBias and greater than 1.0 to implement a limited slip differential. + \note Set rearTarget and rearBias to 1.0 to implement a locked axle. + */ + PxReal rearTarget; + + /** + \brief The parameter centerBias specifies the maximum angular speed ratio of the sum of the two front wheels and the sum of the two rear wheels, + as specified by frontWheelIds[2] and rearWheelIds[2]. + \note If centerBias has value 0.0, the differential will not try to enforce any relationship between the rotational speeds of the front and rear wheels. + \note If centerBias has value 0.0, the torque split between the front and rear rear wheels is specified by the array torqueRatios. + \note centerBias must have value 0.0 (deactivated limited slip) or be greater than 1.0 (activated limited slip) or be equal to 1.0 (locked). + \note If centerBias has value greater than or equal to 1.0 then the arrays frontWheelIds and rearWheelIds must be specified and the corresponding entries of + the isConnected[] array must be set true. + \note If centerBias has value greater than or equal to 1.0 then centerTarget must also be specified. + \note A locked front/rear differential may be achieved by setting centerBias and centerTarget to 1.0. + \note A limited slip differential may be achieved by setting centerBias > 1.0 and centerBias > centerTarget > 1.0 + */ + PxReal centerBias; + + /** + \brief The parameter centerTarget specifies the target rotational speed ratio of the sum of the two front wheels and the sum of the two rear wheels + in the event that the ratio exceeds centerBias and centerBias is configured for an activated limited slip. + \note centerTarget must be less than centerBias and greater than 1.0 to implement a limited slip differential. + \note Set centerTarget and centerBias to 1.0 to implement a locked differential. + */ + PxReal centerTarget; + + /** + \brief The parameter rate specifies how quickly the ratio of rotational speeds approaches the target rotational speed ratio. + \note strength must be in range [0,PX_VEHICLE_FOUR_WHEEL_DIFF_MAXIMUM_STRENGTH]. + \note The ratio of rotational speeds is decremented each update by rate*dt until the ratio is equal to the target ratio. + \note A value of 0 will result in a deactivated limited slip. + \note A value of PX_VEHICLE_FOUR_WHEEL_DIFF_MAXIMUM_STRENGTH will result in instantaneous correction of the rotational speed ratios. + */ + PxReal rate; + + + PX_FORCE_INLINE void setToDefault() + { + PxVehicleMultiWheelDriveDifferentialParams::setToDefault(); + frontBias = 0.0f; + rearBias = 0.0f; + centerBias = 0.0f; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxVehicleMultiWheelDriveDifferentialParams::isValid(axleDesc)) + return false; + + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + frontWheelIds[0] < axleDesc.nbWheels && frontWheelIds[1] < axleDesc.nbWheels && + rearWheelIds[0] < axleDesc.nbWheels && rearWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the frontWheelIds and rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + frontWheelIds[0] != frontWheelIds[1] && frontWheelIds[0] != rearWheelIds[0] && frontWheelIds[0] != rearWheelIds[1] && + frontWheelIds[1] != rearWheelIds[0] && frontWheelIds[1] != rearWheelIds[1] && + rearWheelIds[0] != rearWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the frontWheelIds and rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (centerBias > 1.0f && + torqueRatios[frontWheelIds[0]] != 0.0f && torqueRatios[frontWheelIds[1]] != 0.0f && torqueRatios[rearWheelIds[0]] != 0.0f && torqueRatios[rearWheelIds[1]] != 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: centreBias is enabled but the front and rear wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || + (rearBias > 1.0f && rearWheelIds[0] < axleDesc.nbWheels && rearWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || + (rearBias > 1.0f && rearWheelIds[0] != rearWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rearWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || + (rearBias > 1.0f && torqueRatios[rearWheelIds[0]] != 0.0f && torqueRatios[rearWheelIds[1]] != 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: rearBias is enabled but the rear wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && frontWheelIds[0] < axleDesc.nbWheels && frontWheelIds[1] < axleDesc.nbWheels), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the frontWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && frontWheelIds[0] != frontWheelIds[1]), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the frontWheelIds are not configured correctly.", false); + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || + (frontBias > 1.0f && torqueRatios[frontWheelIds[0]] != 0.0f && frontWheelIds[frontWheelIds[1]]), + "PxVehicleFourWheelDriveDifferentialParams:: frontBias is enabled but the front wheels are not connected.", false); + + PX_CHECK_AND_RETURN_VAL(((0.0f == frontBias) && (0.0f == rearBias) && (0.0f == centerBias)) || (rate >= 0.0f), + "PxVehicleFourWheelDriveDifferentialParams:: strength must be greater than or equal to zero", false); + + PX_CHECK_AND_RETURN_VAL((0.0f == frontBias) || ((1.0f == frontTarget && 1.0f == rearTarget) || (frontTarget > 1.0f && frontTarget < frontBias)), + "PxVehicleFourWheelDriveDifferentialParams: frontBias is enabled but frontTarget not in range (1.0f, frontBias)", false); + PX_CHECK_AND_RETURN_VAL((0.0f == rearBias) || ((1.0f == rearTarget && 1.0f == rearBias) || (rearTarget > 1.0f && rearTarget < rearBias)), + "PxVehicleFourWheelDriveDifferentialParams: rearBias is enabled but rearTarget not in range (1.0f, rearBias)", false); + PX_CHECK_AND_RETURN_VAL((0.0f == centerBias) || ((1.0f == centerTarget && 1.0f == centerBias) || (centerTarget > 1.0f && centerTarget < centerBias)), + "PxVehicleFourWheelDriveDifferentialParams: centerBias is enabled but centerTarget not in range (1.0f, centerBias)", false); + + return true; + } + + PX_FORCE_INLINE PxVehicleFourWheelDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + PxVehicleFourWheelDriveDifferentialParams r = *this; + static_cast(r) = PxVehicleMultiWheelDriveDifferentialParams::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } +}; + +/** +\brief A description of a tank differential. +\note The wheels on a tank may be connected to the differential or not connected to the differential. +\note The wheels on a tank track may be connected to a tank track or not connected to a tank track. +\note Wheels connected to the differential but not to a tank track receive the torque split specified by the +corresponding elements of PxVehicleMultiWheelDriveDifferentialParams::torqueRatios[]. +\note Wheels connected to a tank track but not to the differential receive no torque from the engine. +\note Wheels connected to a tank track and to the differential receive the torque split specified by the +corresponding elements of PxVehicleMultiWheelDriveDifferentialParams::torqueRatios[] multiplied by the corresponding +thrust controller value. If the thrust controller has a negative value, the wheels will receive a torque that is negative +with respect to the gearing ratio. +\note The wheels in each tank track have a constraint applied to them to enforce the rule that they all have the same longitudinal speed +at the contact point between the wheel and the tank track. +*/ +struct PxVehicleTankDriveDifferentialParams : public PxVehicleMultiWheelDriveDifferentialParams +{ + PX_FORCE_INLINE void setToDefault() + { + PxVehicleMultiWheelDriveDifferentialParams::setToDefault(); + nbTracks = 0; + nbWheelsInTracks = 0; + } + + /** + \brief Add a tank track by specifying the number of wheels along the track track and an array of wheel ids specifying each wheel in the tank track. + \param[in] nbWheelsInTrackToAdd is the number of wheels in the track to be added. + \param[in] wheelIdsInTrackToAdd is an array of wheel ids specifying all the wheels in the track to be added. + \param[in] thrustControllerIndex specifies the index of the thrust controller that will be used to control the tank track. + */ + void addTankTrack(const PxU32 nbWheelsInTrackToAdd, const PxU32* const wheelIdsInTrackToAdd, const PxU32 thrustControllerIndex) + { + PX_ASSERT((nbWheelsInTracks + nbWheelsInTrackToAdd) < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbTracks < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(thrustControllerIndex < 2); + nbWheelsPerTrack[nbTracks] = nbWheelsInTrackToAdd; + thrustIdPerTrack[nbTracks] = thrustControllerIndex; + trackToWheelIds[nbTracks] = nbWheelsInTracks; + for (PxU32 i = 0; i < nbWheelsInTrackToAdd; i++) + { + wheelIdsInTrackOrder[nbWheelsInTracks + i] = wheelIdsInTrackToAdd[i]; + } + nbWheelsInTracks += nbWheelsInTrackToAdd; + nbTracks++; + } + + /** + \brief Return the number of tracks. + \return The number of tracks. + @see getNbWheelsInTrack() + */ + PX_FORCE_INLINE PxU32 getNbTracks() const + { + return nbTracks; + } + + /** + \brief Return the number of wheels in the ith track. + \param[in] i specifies the track to be queried for its wheel count. + \return The number of wheels in the specified track. + @see getWheelInTrack() + */ + PX_FORCE_INLINE PxU32 getNbWheelsInTrack(const PxU32 i) const + { + return nbWheelsPerTrack[i]; + } + + /** + \brief Return the array of all wheels in the ith track. + \param[in] i specifies the track to be queried for its wheels. + \return The array of wheels in the specified track. + */ + PX_FORCE_INLINE const PxU32* getWheelsInTrack(const PxU32 i) const + { + return (wheelIdsInTrackOrder + trackToWheelIds[i]); + } + + /** + \brief Return the wheel id of the jth wheel in the ith track. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified track. + \param[in] i specifies the track to be queried. + \return The wheel id of the jth wheel in the ith track. + @see getNbWheelsInTrack() + */ + PX_FORCE_INLINE PxU32 getWheelInTrack(const PxU32 j, const PxU32 i) const + { + return wheelIdsInTrackOrder[trackToWheelIds[i] + j]; + } + + /** + \brief Return the index of the thrust controller that will control a specified track. + \param[in] i specifies the track to be queried for its thrust controller index + \return The index of the thrust controller that will control the ith track. + */ + PX_FORCE_INLINE PxU32 getThrustControllerIndex(const PxU32 i) const + { + return thrustIdPerTrack[i]; + } + + PX_FORCE_INLINE PxVehicleTankDriveDifferentialParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + PxVehicleTankDriveDifferentialParams r = *this; + static_cast(r) = PxVehicleMultiWheelDriveDifferentialParams::transformAndScale(srcFrame, trgFrame, srcScale, trgScale); + return r; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxVehicleMultiWheelDriveDifferentialParams::isValid(axleDesc)) + return false; + + PX_CHECK_AND_RETURN_VAL(nbTracks <= PxVehicleLimits::eMAX_NB_WHEELS, "PxVehicleTankDriveDifferentialParams.nbTracks must not exceed PxVehicleLimits::eMAX_NB_WHEELS", false); + PX_CHECK_AND_RETURN_VAL(nbWheelsInTracks <= PxVehicleLimits::eMAX_NB_WHEELS, "PxVehicleTankDriveDifferentialParams.nbWheelsInTracks must not exceed PxVehicleLimits::eMAX_NB_WHEELS", false); + for (PxU32 i = 0; i < nbTracks; i++) + { + PX_CHECK_AND_RETURN_VAL(thrustIdPerTrack[i] < 2, "PxVehicleTankDriveDifferentialParams.thrustId must be less than 2", false); + PX_CHECK_AND_RETURN_VAL(getNbWheelsInTrack(i) >= 2, "PxVehicleTankDriveDifferentialParams.nbWheelsPerTrack must be greater than or equal to 2", false); + } + + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + PxU32 count = 0; + for (PxU32 j = 0; j < nbWheelsInTracks; j++) + { + if (wheelIdsInTrackOrder[j] == wheelId) + count++; + } + PX_CHECK_AND_RETURN_VAL(count <= 1, "PxVehicleTankDriveDifferentialParams - a wheel cannot be in more than one tank track", false); + } + return true; + } + + PxU32 nbTracks; //!< The number of tracks + PxU32 thrustIdPerTrack[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The id of the thrust that will control the track. Must have value 0 or 1. + PxU32 nbWheelsPerTrack[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The number of wheels in each track + PxU32 trackToWheelIds[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of wheel ids for the ith tank track begins at wheelIdsInTrackOrder[trackToWheelIds[i]] + + PxU32 wheelIdsInTrackOrder[PxVehicleLimits::eMAX_NB_WHEELS];//!< The list of all wheel ids in all tracks + PxU32 nbWheelsInTracks; //!< The number of wheels in all tracks. +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h new file mode 100644 index 0000000..aacfc75 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/drivetrain/PxVehicleDrivetrainStates.h @@ -0,0 +1,288 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/commands/PxVehicleCommandStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +struct PxVehicleClutchCommandResponseState +{ + PxReal normalisedCommandResponse; + PxReal commandResponse; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleClutchCommandResponseState)); + } +}; + +struct PxVehicleEngineDriveThrottleCommandResponseState +{ + PxReal commandResponse; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineDriveThrottleCommandResponseState)); + } +}; + +struct PxVehicleEngineState +{ + /** + \brief The rotation speed of the engine (radians per second). + + Unit: radians / time + */ + PxReal rotationSpeed; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleEngineState)); + } +}; + +#define PX_VEHICLE_NO_GEAR_SWITCH_PENDING -1.0f +#define PX_VEHICLE_GEAR_SWITCH_INITIATED -2.0f + +struct PxVehicleGearboxState +{ + /** + \brief Current gear + */ + PxU32 currentGear; + + /** + \brief Target gear (different from current gear if a gear change is underway) + */ + PxU32 targetGear; + + /** + \brief Reported time that has passed since gear change started. + + The special value PX_VEHICLE_NO_GEAR_SWITCH_PENDING denotes that there is currently + no gear change underway. + + If a gear switch was initiated, the special value PX_VEHICLE_GEAR_SWITCH_INITIATED + will be used temporarily but get translated to 0 in the gearbox update immediately. + This state might only get encountered, if the vehicle component update is split into + multiple sequences that do not run in one go. + + Unit: time + */ + PxReal gearSwitchTime; + + PX_FORCE_INLINE void setToDefault() + { + currentGear = 0; + targetGear = 0; + gearSwitchTime = PX_VEHICLE_NO_GEAR_SWITCH_PENDING; + } +}; + +#define PX_VEHICLE_UNSPECIFIED_TIME_SINCE_LAST_SHIFT PX_MAX_F32 + +struct PxVehicleAutoboxState +{ + /** + \brief Time that has lapsed since the last autobox gear shift. + + Unit: time + */ + PxReal timeSinceLastShift; + + /** + \brief Describes whether a gear shift triggered by the autobox is still in flight. + */ + bool activeAutoboxGearShift; + + PX_FORCE_INLINE void setToDefault() + { + timeSinceLastShift = PX_VEHICLE_UNSPECIFIED_TIME_SINCE_LAST_SHIFT; + activeAutoboxGearShift = false; + } +}; + +struct PxVehicleDifferentialState +{ + /** + \brief A list of wheel indices that are connected to the differential. + */ + PxU32 connectedWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The number of wheels that are connected to the differential. + */ + PxU32 nbConnectedWheels; + + /** + \brief The fraction of available torque that is delivered to each wheel through the differential. + \note If a wheel is not connected to the differential then the fraction of available torque delivered to that wheel will be zero. + \note A negative torque ratio for a wheel indicates a negative gearing is to be applied to that wheel. + \note The sum of the absolute value of each fraction must equal 1.0. + */ + PxReal torqueRatiosAllWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief The contribution of each wheel to the average wheel rotation speed measured at the clutch. + \note If a wheel is not connected to the differential then the contribution to the average rotation speed measured at the clutch must be zero. + \note The sum of all contributions must equal 1.0. + */ + PxReal aveWheelSpeedContributionAllWheels[PxVehicleLimits::eMAX_NB_WHEELS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleDifferentialState)); + } +}; + +/** +\brief Specify groups of wheels that are to be constrained to have pre-determined angular velocity relationship. +*/ +struct PxVehicleWheelConstraintGroupState +{ + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelConstraintGroupState)); + } + + /** + \brief Add a wheel constraint group by specifying the number of wheels in the group, an array of wheel ids specifying each wheel in the group + and a desired rotational speed relationship. + \param[in] nbWheelsInGroupToAdd is the number of wheels in the group to be added. + \param[in] wheelIdsInGroupToAdd is an array of wheel ids specifying all the wheels in the group to be added. + \param[in] constraintMultipliers is an array of constraint multipliers describing the desired relationship of the wheel rotational speeds. + \note constraintMultipliers[j] specifies the target rotational speed of the jth wheel in the constraint group as a multiplier of the rotational + speed of the zeroth wheel in the group. + */ + void addConstraintGroup(const PxU32 nbWheelsInGroupToAdd, const PxU32* const wheelIdsInGroupToAdd, const PxF32* constraintMultipliers) + { + PX_ASSERT((nbWheelsInGroups + nbWheelsInGroupToAdd) < PxVehicleLimits::eMAX_NB_WHEELS); + PX_ASSERT(nbGroups < PxVehicleLimits::eMAX_NB_WHEELS); + nbWheelsPerGroup[nbGroups] = nbWheelsInGroupToAdd; + groupToWheelIds[nbGroups] = nbWheelsInGroups; + for (PxU32 i = 0; i < nbWheelsInGroupToAdd; i++) + { + wheelIdsInGroupOrder[nbWheelsInGroups + i] = wheelIdsInGroupToAdd[i]; + wheelMultipliersInGroupOrder[nbWheelsInGroups + i] = constraintMultipliers[i]; + } + nbWheelsInGroups += nbWheelsInGroupToAdd; + nbGroups++; + } + + /** + \brief Return the number of wheel constraint groups in the vehicle. + \return The number of wheel constraint groups. + @see getNbWheelsInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getNbConstraintGroups() const + { + return nbGroups; + } + + /** + \brief Return the number of wheels in the ith constraint group. + \param[in] i specifies the constraint group to be queried for its wheel count. + \return The number of wheels in the specified constraint group. + @see getWheelInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getNbWheelsInConstraintGroup(const PxU32 i) const + { + return nbWheelsPerGroup[i]; + } + + /** + \brief Return the wheel id of the jth wheel in the ith constraint group. + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified constraint group. + \param[in] i specifies the constraint group to be queried. + \return The wheel id of the jth wheel in the ith constraint group. + @see getNbWheelsInConstraintGroup() + */ + PX_FORCE_INLINE PxU32 getWheelInConstraintGroup(const PxU32 j, const PxU32 i) const + { + return wheelIdsInGroupOrder[groupToWheelIds[i] + j]; + } + + /** + \brief Return the constraint multiplier of the jth wheel in the ith constraint group + \param[in] j specifies that the wheel id to be returned is the jth wheel in the list of wheels on the specified constraint group. + \param[in] i specifies the constraint group to be queried. + \return The constraint multiplier of the jth wheel in the ith constraint group. + */ + PX_FORCE_INLINE PxReal getMultiplierInConstraintGroup(const PxU32 j, const PxU32 i) const + { + return wheelMultipliersInGroupOrder[groupToWheelIds[i] + j]; + } + + PxU32 nbGroups; //!< The number of constraint groups in the vehicle + PxU32 nbWheelsPerGroup[PxVehicleLimits::eMAX_NB_AXLES]; //!< The number of wheels in each group + PxU32 groupToWheelIds[PxVehicleLimits::eMAX_NB_AXLES]; //!< The list of wheel ids for the ith group begins at wheelIdsInGroupOrder[groupToWheelIds[i]] + + PxU32 wheelIdsInGroupOrder[PxVehicleLimits::eMAX_NB_WHEELS]; //!< The list of all wheel ids in constraint groups + PxF32 wheelMultipliersInGroupOrder[PxVehicleLimits::eMAX_NB_WHEELS];//!< The constraint multipliers for each constraint group. + PxU32 nbWheelsInGroups; //!< The number of wheels in a constraint group. +}; + +/** +\brief The clutch is modelled as two spinning plates with one connected to the wheels through the gearing and the other connected to the engine. The clutch slip is angular speed difference of the two plates. +*/ +struct PxVehicleClutchSlipState +{ + /** + \brief The slip at the clutch. + + Unit: radians / time + */ + PxReal clutchSlip; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleClutchSlipState)); + } +}; + + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h new file mode 100644 index 0000000..f97c8f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorComponents.h @@ -0,0 +1,238 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +#include "PxVehiclePhysXActorFunctions.h" +#include "PxVehiclePhysXActorStates.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Work items at the beginning of an update step for a PhysX actor based vehicle. + +Includes: + - Waking the actor up if it is sleeping and a throttle or steer command is issued. + - Clearing certain states if the actor is sleeping. + - Reading the state from the PhysX actor and copy to the vehicle internal state. + +@see PxVehiclePhysxActorWakeup PxVehiclePhysxActorSleepCheck PxVehicleReadRigidBodyStateFromPhysXActor +*/ +class PxVehiclePhysXActorBeginComponent : public PxVehicleComponent +{ +public: + + PxVehiclePhysXActorBeginComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXActorBeginComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] commands are the brake, throttle and steer values that will drive the vehicle. + \param[out] transmissionCommands are the target gear and clutch values that will control + the transmission. Can be set to NULL if the vehicle does not have a gearbox. If + specified, then gearParams and gearState has to be specifed too. + \param[out] gearParams The gearbox parameters. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. + \param[out] gearState The state of the gearbox. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. + \param[out] engineParams The engine parameters. Can be set to NULL if the vehicle does + not have an engine. Must be specified, if engineState is specified. + \param[out] physxActor is the PxRigidBody instance associated with the vehicle. + \param[out] physxSteerState is the previous state of the steer and is used to determine if the + steering wheel has changed by comparing with PxVehicleCommandState::steer. + \param[out] physxConstraints The state of the suspension limit and low speed tire constraints. + If the vehicle actor is sleeping and constraints are active, they will be + deactivated and marked as dirty. + \param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. + \param[out] wheelRigidBody1dStates describes the angular speed of each wheel. + \param[out] engineState The engine state. Can be set to NULL if the vehicle does + not have an engine. If specified, then engineParams has to be specifed too. + */ + virtual void getDataForPhysXActorBeginComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleCommandState*& commands, + const PxVehicleEngineDriveTransmissionCommandState*& transmissionCommands, + const PxVehicleGearboxParams*& gearParams, + const PxVehicleGearboxState*& gearState, + const PxVehicleEngineParams*& engineParams, + PxVehiclePhysXActor*& physxActor, + PxVehiclePhysXSteerState*& physxSteerState, + PxVehiclePhysXConstraints*& physxConstraints, + PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState*& engineState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehiclePhysXActorBeginComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleCommandState* commands; + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands; + const PxVehicleGearboxParams* gearParams; + const PxVehicleGearboxState* gearState; + const PxVehicleEngineParams* engineParams; + PxVehiclePhysXActor* physxActor; + PxVehiclePhysXSteerState* physxSteerState; + PxVehiclePhysXConstraints* physxConstraints; + PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleEngineState* engineState; + + getDataForPhysXActorBeginComponent(axleDescription, commands, transmissionCommands, + gearParams, gearState, engineParams, + physxActor, physxSteerState, physxConstraints, + rigidBodyState, wheelRigidBody1dStates, engineState); + + if (physxActor->rigidBody->getScene()) // Considering case where actor is not in a scene and constraints get solved via immediate mode + { + PxVehiclePhysxActorWakeup(*commands, transmissionCommands, gearParams, gearState, + *physxActor->rigidBody, *physxSteerState); + + if (PxVehiclePhysxActorSleepCheck(*axleDescription, *physxActor->rigidBody, engineParams, + *rigidBodyState, *physxConstraints, wheelRigidBody1dStates, engineState)) + { + return false; + } + } + + PxVehicleReadRigidBodyStateFromPhysXActor(*physxActor->rigidBody, *rigidBodyState); + + return true; + } +}; + +/** +\brief Work items at the end of an update step for a PhysX actor based vehicle. + +Includes: + - Writing vehicle internal state to the PhysX actor. + - Keeping the vehicle awake if certain criteria are met. +*/ +class PxVehiclePhysXActorEndComponent : public PxVehicleComponent +{ +public: + + PxVehiclePhysXActorEndComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXActorEndComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. + \param[out] wheelParams describes the radius, mass etc. of the wheels. + \param[out] wheelShapeLocalPoses are the local poses in the wheel's frame to apply to the PxShape instances that represent the wheel + \param[out] wheelRigidBody1dStates describes the angular speed of the wheels. + \param[out] wheelLocalPoses describes the local poses of the wheels in the rigid body frame. + \param[out] gearState The gear state. Can be set to NULL if the vehicle does + not have gears. + \param[out] physxActor is the PxRigidBody instance associated with the vehicle. + */ + virtual void getDataForPhysXActorEndComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& wheelShapeLocalPoses, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses, + const PxVehicleGearboxState*& gearState, + PxVehiclePhysXActor*& physxActor) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + + PX_PROFILE_ZONE("PxVehiclePhysXActorEndComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData wheelShapeLocalPoses; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleArrayData wheelLocalPoses; + const PxVehicleGearboxState* gearState; + PxVehiclePhysXActor* physxActor; + + getDataForPhysXActorEndComponent(axleDescription, rigidBodyState, + wheelParams, wheelShapeLocalPoses, wheelRigidBody1dStates, wheelLocalPoses, gearState, + physxActor); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleWriteWheelLocalPoseToPhysXWheelShape(wheelLocalPoses[wheelId].localPose, wheelShapeLocalPoses[wheelId], + physxActor->wheelShapes[wheelId]); + } + + if (context.getType() == PxVehicleSimulationContextType::ePHYSX) + { + const PxVehiclePhysXSimulationContext& physxContext = static_cast(context); + + PxVehicleWriteRigidBodyStateToPhysXActor(physxContext.physxActorUpdateMode, *rigidBodyState, dt, *physxActor->rigidBody); + + PxVehiclePhysxActorKeepAwakeCheck(*axleDescription, wheelParams, wheelRigidBody1dStates, + physxContext.physxActorWakeCounterThreshold, physxContext.physxActorWakeCounterResetValue, gearState, + *physxActor->rigidBody); + } + else + { + PX_ALWAYS_ASSERT(); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h new file mode 100644 index 0000000..cd7072e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorFunctions.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxRigidBody; +class PxShape; + +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; +struct PxVehicleEngineDriveTransmissionCommandState; +struct PxVehicleEngineParams; +struct PxVehicleEngineState; +struct PxVehicleGearboxParams; +struct PxVehicleGearboxState; +struct PxVehicleRigidBodyState; +struct PxVehiclePhysXConstraints; +struct PxVehicleWheelLocalPose; +struct PxVehicleWheelParams; +struct PxVehicleWheelRigidBody1dState; +struct PxVehiclePhysXSteerState; + +/** +\brief Wake up the physx actor if the actor is asleep and the commands signal an intent to +change the state of the vehicle. +\param[in] commands are the brake, throttle and steer values that will drive the vehicle. +\param[in] transmissionCommands are the target gear and clutch values that will control + the transmission. If the target gear is different from the current gearbox + target gear, then the physx actor will get woken up. Can be set to NULL if the + vehicle does not have a gearbox or if this is not a desired behavior. If + specified, then gearParams and gearState has to be specifed too. +\param[in] gearParams The gearbox parameters. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. +\param[in] gearState The state of the gearbox. Can be set to NULL if the vehicle does + not have a gearbox and transmissionCommands is NULL. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +\param[in,out] physxSteerState and commands are compared to +determine if the steering state has changed since the last call to PxVehiclePhysxActorWakeup(). +\note If the steering has changed, the actor will be woken up. +\note On exit from PxVehiclePhysxActorWakeup, physxSteerState.previousSteerCommand is assigned to the value +of commands.steer so that the steer state may be propagated to the subsequent call to PxVehiclePhysxActorWakeup(). +\note If physxSteerState.previousSteerCommand has value PX_VEHICLE_UNSPECIFIED_STEER_STATE, the steering state +is treated as though it has not changed. +*/ +void PxVehiclePhysxActorWakeup( + const PxVehicleCommandState& commands, + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands, + const PxVehicleGearboxParams* gearParams, + const PxVehicleGearboxState* gearState, + PxRigidBody& physxActor, + PxVehiclePhysXSteerState& physxSteerState); + +/** +\brief Check if the physx actor is sleeping and clear certain vehicle states if it is. + +\param[in] axleDescription identifies the wheels on each axle. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +\param[in] engineParams The engine parameters. Can be set to NULL if the vehicle does + not have an engine. Must be specified, if engineState is specified. +\param[in,out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. +\param[in,out] physxConstraints The state of the suspension limit and low speed tire constraints. + If the vehicle actor is sleeping and constraints are active, they will be + deactivated and marked as dirty. +\param[in,out] wheelRigidBody1dStates describes the angular speed of the wheels. +\param[out] engineState The engine state. Can be set to NULL if the vehicle does + not have an engine. If specified, then engineParams has to be specifed too. + The engine rotation speed will get set to the idle rotation speed if + the actor is sleeping. +\return True if the actor was sleeping, else false. +*/ +bool PxVehiclePhysxActorSleepCheck +(const PxVehicleAxleDescription& axleDescription, + const PxRigidBody& physxActor, + const PxVehicleEngineParams* engineParams, + PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraints& physxConstraints, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState* engineState); + +/** +\brief Check if the physx actor has to be kept awake. + +Certain criteria should keep the vehicle physx actor awake, for example, if the +(mass normalized) rotational kinetic energy of the wheels is above a certain +threshold or if a gear change is pending. This method will reset the wake +counter of the physx actor to a specified value, if any of the mentioned +criterias are met. + +\note The physx actor's sleep threshold will be used as threshold to test against + for the energy criteria. + +\param[in] axleDescription identifies the wheels on each axle. +\param[in] wheelParams describes the radius, mass etc. of the wheels. +\param[in] wheelRigidBody1dStates describes the angular speed of the wheels. +\param[in] wakeCounterThreshold Once the wake counter of the physx actor falls + below this threshold, the method will start testing if the wake + counter needs to be reset. +\param[in] wakeCounterResetValue The value to set the physx actor wake counter + to, if any of the criteria to do so are met. +\param[in] gearState The gear state. Can be set to NULL if the vehicle does + not have gears or if the mentioned behavior is not desired. +\param[in] physxActor is the PxRigidBody instance associated with the vehicle. +*/ +void PxVehiclePhysxActorKeepAwakeCheck +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxReal wakeCounterThreshold, + const PxReal wakeCounterResetValue, + const PxVehicleGearboxState* gearState, + PxRigidBody& physxActor); + + +/** +\brief Read the rigid body state from a PhysX actor. +\param[in] physxActor is a reference to a PhysX actor. +\param[out] rigidBodyState is the state of the rigid body used by the Vehicle SDK. +*/ +void PxVehicleReadRigidBodyStateFromPhysXActor +(const PxRigidBody& physxActor, + PxVehicleRigidBodyState& rigidBodyState); + +/** +\brief Update the local pose of a PxShape that is associated with a wheel. +\param[in] wheelLocalPose describes the local pose of each wheel in the rigid body frame. +\param[in] wheelShapeLocalPose describes the local pose to apply to the PxShape instance in the wheel's frame. +\param[in] shape is the target PxShape. +*/ +void PxVehicleWriteWheelLocalPoseToPhysXWheelShape +(const PxTransform& wheelLocalPose, const PxTransform& wheelShapeLocalPose, PxShape* shape); + +/** +\brief Write the rigid body state to a PhysX actor. +\param[in] physxActorUpdateMode controls whether the PhysX actor is to be updated with +instantaneous velocity changes or with accumulated accelerations to be applied in +the next simulation step of the associated PxScene. +\param[in] rigidBodyState is the state of the rigid body. +\param[in] dt is the simulation time that has elapsed since the last call to +PxVehicleWriteRigidBodyStateToPhysXActor(). +\param[out] physXActor is a reference to the PhysX actor. +*/ +void PxVehicleWriteRigidBodyStateToPhysXActor +(const PxVehiclePhysXActorUpdateMode::Enum physxActorUpdateMode, + const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, + PxRigidBody& physXActor); + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h new file mode 100644 index 0000000..a4ee94d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorHelpers.h @@ -0,0 +1,209 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "PxFiltering.h" +#include "PxShape.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxGeometry; +class PxMaterial; +struct PxCookingParams; + +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyParams; +struct PxVehicleAxleDescription; +struct PxVehicleWheelParams; +struct PxVehiclePhysXActor; +struct PxVehicleFrame; +struct PxVehicleSuspensionParams; + +class PxVehiclePhysXRigidActorParams +{ + PX_NOCOPY(PxVehiclePhysXRigidActorParams) + +public: + + PxVehiclePhysXRigidActorParams(const PxVehicleRigidBodyParams& _physxActorRigidBodyParams, const char* _physxActorName) + : rigidBodyParams(_physxActorRigidBodyParams), + physxActorName(_physxActorName) + { + } + + const PxVehicleRigidBodyParams& rigidBodyParams; + const char* physxActorName; +}; + +class PxVehiclePhysXRigidActorShapeParams +{ + PX_NOCOPY(PxVehiclePhysXRigidActorShapeParams) + +public: + + PxVehiclePhysXRigidActorShapeParams + (const PxGeometry& _geometry, const PxTransform& _localPose, const PxMaterial& _material, + const PxShapeFlags _flags, const PxFilterData& _simulationFilterData, const PxFilterData& _queryFilterData) + : geometry(_geometry), + localPose(_localPose), + material(_material), + flags(_flags), + simulationFilterData(_simulationFilterData), + queryFilterData(_queryFilterData) + { + } + + const PxGeometry& geometry; + const PxTransform& localPose; + const PxMaterial& material; + PxShapeFlags flags; + PxFilterData simulationFilterData; + PxFilterData queryFilterData; +}; + +class PxVehiclePhysXWheelParams +{ + PX_NOCOPY(PxVehiclePhysXWheelParams) + +public: + + PxVehiclePhysXWheelParams(const PxVehicleAxleDescription& _axleDescription, const PxVehicleWheelParams* _wheelParams) + : axleDescription(_axleDescription), + wheelParams(_wheelParams) + { + } + + const PxVehicleAxleDescription& axleDescription; + const PxVehicleWheelParams* wheelParams; +}; + +class PxVehiclePhysXWheelShapeParams +{ + PX_NOCOPY(PxVehiclePhysXWheelShapeParams) + +public: + + PxVehiclePhysXWheelShapeParams(const PxMaterial& _material, const PxShapeFlags _flags, const PxFilterData _simulationFilterData, const PxFilterData _queryFilterData) + : material(_material), + flags(_flags), + simulationFilterData(_simulationFilterData), + queryFilterData(_queryFilterData) + { + } + + const PxMaterial& material; + PxShapeFlags flags; + PxFilterData simulationFilterData; + PxFilterData queryFilterData; +}; + +/** +\brief Create a PxRigidDynamic instance, instantiate it with desired properties and populate it with PxShape instances. +\param[in] vehicleFrame describes the frame of the vehicle. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[in] rigidActorShapeParams describes the collision geometry associated with the rigid body. +\param[in] wheelParams describes the radius and half-width of the wheels. +\param[in] wheelShapeParams describes the PxMaterial and PxShapeFlags to apply to the wheel shapes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\param[in] vehiclePhysXActor is a record of the PxRigidDynamic and PxShape instances instantiated. +\note This is an alternative to PxVehiclePhysXArticulationLinkCreate. +\note PxVehiclePhysXActorCreate primarily serves as an illustration of the instantiation of the PhysX class instances +required to simulate a vehicle with a PxRigidDynamic. +@see PxVehiclePhysXActorDestroy +*/ +void PxVehiclePhysXActorCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor); + + +/** +\brief Configure an actor so that it is ready for vehicle simulation. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[out] rigidBody is the body to be prepared for simulation. +*/ +void PxVehiclePhysXActorConfigure +(const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + PxRigidBody& rigidBody); + +/** +\brief Create a PxArticulationReducedCoordinate and a single PxArticulationLink, +instantiate the PxArticulationLink with desired properties and populate it with PxShape instances. +\param[in] vehicleFrame describes the frame of the vehicle. +\param[in] rigidActorParams describes the mass and moment of inertia of the rigid body. +\param[in] rigidActorCmassLocalPose specifies the mapping between actor and rigid body frame. +\param[in] rigidActorShapeParams describes the collision geometry associated with the rigid body. +\param[in] wheelParams describes the radius and half-width of the wheels. +\param[in] wheelShapeParams describes the PxMaterial and PxShapeFlags to apply to the wheel shapes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\param[in] vehiclePhysXActor is a record of the PxArticulationReducedCoordinate, PxArticulationLink and PxShape instances instantiated. +\note This is an alternative to PxVehiclePhysXActorCreate. +\note PxVehiclePhysXArticulationLinkCreate primarily serves as an illustration of the instantiation of the PhysX class instances +required to simulate a vehicle as part of an articulated ensemble. +@see PxVehiclePhysXActorDestroy +*/ +void PxVehiclePhysXArticulationLinkCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor); + +/** +\brief Release the PxRigidDynamic, PxArticulationReducedCoordinate, PxArticulationLink and PxShape instances +instantiated by PxVehiclePhysXActorCreate or PxVehiclePhysXArticulationLinkCreate. +\param[in] vehiclePhysXActor is a description of the PhysX instances to be released. +*/ +void PxVehiclePhysXActorDestroy(PxVehiclePhysXActor& vehiclePhysXActor); + + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h new file mode 100644 index 0000000..617649c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxActor/PxVehiclePhysXActorStates.h @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxMemory.h" + +#include "PxRigidBody.h" + +#include "vehicle2/PxVehicleLimits.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxShape; + +namespace vehicle2 +{ +#endif + +/** +\brief A description of the PhysX actor and shapes that represent the vehicle in an associated PxScene. +*/ +struct PxVehiclePhysXActor +{ + /** + \brief The PhysX rigid body that represents the vehcle in the associated PhysX scene. + \note PxActorFlag::eDISABLE_GRAVITY must be set true on the PxRigidBody + */ + PxRigidBody* rigidBody; + + /** + \brief An array of shapes with one shape pointer (or NULL) for each wheel. + */ + PxShape* wheelShapes[PxVehicleLimits::eMAX_NB_WHEELS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXActor)); + } +}; + + +#define PX_VEHICLE_UNSPECIFIED_STEER_STATE PX_MAX_F32 + +/** +\brief A description of the previous steer command applied to the vehicle. +*/ +struct PxVehiclePhysXSteerState +{ + + /** + \brief The steer command that was most previously applied to the vehicle. + */ + PxReal previousSteerCommand; + + PX_FORCE_INLINE void setToDefault() + { + previousSteerCommand = PX_VEHICLE_UNSPECIFIED_STEER_STATE; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h new file mode 100644 index 0000000..a362e08 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintComponents.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "PxVehiclePhysXConstraintFunctions.h" +#include "PxVehiclePhysXConstraintHelpers.h" +#include "PxVehiclePhysXConstraintStates.h" +#include "PxVehiclePhysXConstraintParams.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehiclePhysXConstraintComponent : public PxVehicleComponent +{ +public: + PxVehiclePhysXConstraintComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXConstraintComponent() {} + + virtual void getDataForPhysXConstraintComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionLimitParams, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireStickyStates, + PxVehiclePhysXConstraints*& constraints) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + PX_PROFILE_ZONE("PxVehiclePhysXConstraintComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionLimitParams; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireStickyStates; + PxVehiclePhysXConstraints* constraints; + + getDataForPhysXConstraintComponent(axleDescription, rigidBodyState, + suspensionParams, suspensionLimitParams, suspensionStates, suspensionComplianceStates, + wheelRoadGeomStates, tireDirectionStates, tireStickyStates, + constraints); + + PxVehicleConstraintsDirtyStateUpdate(*constraints); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehiclePhysXConstraintStatesUpdate( + suspensionParams[wheelId], suspensionLimitParams[wheelId], + suspensionStates[wheelId], suspensionComplianceStates[wheelId], + wheelRoadGeomStates[wheelId].plane.n, + context.tireStickyParams.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].damping, + context.tireStickyParams.stickyParams[PxVehicleTireDirectionModes::eLATERAL].damping, + tireDirectionStates[wheelId], tireStickyStates[wheelId], + *rigidBodyState, + constraints->constraintStates[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h new file mode 100644 index 0000000..d1993cc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams; +struct PxVehiclePhysXSuspensionLimitConstraintParams; +struct PxVehicleSuspensionState; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleTireDirectionState; +struct PxVehicleTireStickyState; +struct PxVehicleRigidBodyState; +struct PxVehiclePhysXConstraintState; + +/** +\brief Read constraint data from the vehicle's internal state for a single wheel and write it to a +structure that will be read by the associated PxScene and used to impose the constraints during the next +PxScene::simulate() step. +\param[in] suspensionParams describes the suspension frame. +\param[in] suspensionLimitParams describes the restitution value applied to any constraint triggered by +the suspension travel limit. +\param[in] suspensionState describes the excess suspension compression beyond the suspension travel limit that will be +resolved with a constraint. +\param[in] suspensionComplianceState describes the effect of suspension compliance on the effective application point +of the suspension force. +\param[in] groundPlaneNormal The normal direction of the ground plane the wheel is driving on. A normalized vector is + expected. +\param[in] tireStickyDampingLong The damping coefficient to use in the constraint to approach a zero target velocity + along the longitudinal tire axis. +\param[in] tireStickyDampingLat Same concept as tireStickyDampingLong but for the lateral tire axis. +\param[in] tireDirectionState describes the longitudinal and lateral directions of the tire in the world frame. +\param[in] tireStickyState describes the low speed state of the tire in the longitudinal and lateral directions. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[out] constraintState is the data structure that will be read by the associated PxScene in the next call to +PxScene::simulate(). +\note Constraints include suspension constraints to account for suspension travel limit and sticky +tire constraints that bring the vehicle to rest at low longitudinal and lateral speed. +*/ +void PxVehiclePhysXConstraintStatesUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehiclePhysXSuspensionLimitConstraintParams& suspensionLimitParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, + const PxVec3& groundPlaneNormal, + const PxReal tireStickyDampingLong, const PxReal tireStickyDampingLat, + const PxVehicleTireDirectionState& tireDirectionState, const PxVehicleTireStickyState& tireStickyState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraintState& constraintState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h new file mode 100644 index 0000000..a42f126 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +#include "foundation/PxPreprocessor.h" + +/** \addtogroup vehicle2 + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ + +class PxPhysics; +class PxRigidBody; + +namespace vehicle2 +{ +#endif + +struct PxVehicleAxleDescription; +struct PxVehiclePhysXConstraints; + +/** +\brief Instantiate the PhysX custom constraints. + +Custom constraints will resolve excess suspension compression and velocity constraints that serve as +a replacement low speed tire model. + +\param[in] axleDescription describes the axles of the vehicle and the wheels on each axle. +\param[in] physics is a PxPhysics instance. +\param[in] physxActor is the vehicle's PhysX representation as a PxRigidBody +\param[in] vehicleConstraints is a wrapper class that holds pointers to PhysX objects required to implement the custom constraint. +*/ +void PxVehicleConstraintsCreate +(const PxVehicleAxleDescription& axleDescription, + PxPhysics& physics, PxRigidBody& physxActor, + PxVehiclePhysXConstraints& vehicleConstraints); + +/** +\brief To ensure the constraints are processed by the PhysX scene they are marked as dirty prior to each simulate step. + +\param[in] vehicleConstraints is a wrapper class that holds pointers to PhysX objects required to implement the custom constraint. + +@see PxVehicleConstraintsCreate +*/ +void PxVehicleConstraintsDirtyStateUpdate +(PxVehiclePhysXConstraints& vehicleConstraints); + +/** +\brief Destroy the PhysX custom constraints. + +\param[in,out] vehicleConstraints describes the PhysX custom constraints to be released. + +@see PxVehicleConstraintsCreate +*/ +void PxVehicleConstraintsDestroy +(PxVehiclePhysXConstraints& vehicleConstraints); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h new file mode 100644 index 0000000..9da8607 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief A description of the PhysX models employed to resolve suspension limit constraints. +@see PxVehiclePhysXConstraintState +*/ +struct PxVehiclePhysXSuspensionLimitConstraintParams +{ + /** + \brief restitution is used by the restitution model used to generate a target velocity when resolving suspension limit + constraints. + \note A value of 0.0 means that the restitution model is not employed. + \note Restitution has no effect if directionForSuspensionLimitConstraint has value Enum::eNONE. + @see Px1DConstraintFlag::eRESTITUTION + @see Px1DConstraint::RestitutionModifiers::restitution + */ + PxReal restitution; + + /** + \brief Set the direction to apply a constraint impulse when the suspension cannot place the wheel on the ground + and simultaneously respect the limits of suspension travel. The choices are to push along the ground normal to resolve the + geometric error or to push along the suspension direction. The former choice can be thought of as mimicing a force applied + by the tire's contact with the ground, while the latter can be thought of as mimicing a force arising from a suspension limit spring. + When the ground normal and the suspension direction are approximately aligned, both do an equivalent job of maintaining the wheel above + the ground. When the vehicle is on its side, eSUSPENSION does a better job of keeping the wheels above + the ground but comes at the cost of an unnaturally strong torque that can lead to unwanted self-righting behaviour. + eROAD_GEOMETRY_NORMAL is a good choice to avoid self-righting behaviour and still do a reasonable job at maintaining + the wheel above the ground in the event that the vehicle is tending towards a roll onto its side. + eNONE should be chosen if it is desired that no extra impulse is applied when the suspension alone cannot keep the wheels above + the ground plane. + */ + enum DirectionSpecifier + { + eSUSPENSION, + eROAD_GEOMETRY_NORMAL, + eNONE + }; + DirectionSpecifier directionForSuspensionLimitConstraint; + + PX_FORCE_INLINE PxVehiclePhysXSuspensionLimitConstraintParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL( + PxVehiclePhysXSuspensionLimitConstraintParams::eSUSPENSION == directionForSuspensionLimitConstraint || + PxVehiclePhysXSuspensionLimitConstraintParams::eROAD_GEOMETRY_NORMAL == directionForSuspensionLimitConstraint || + PxVehiclePhysXSuspensionLimitConstraintParams::eNONE == directionForSuspensionLimitConstraint, "PxVehiclePhysXSuspensionLimitConstraintParams.directionForSuspensionLimitConstraint must have legal value", false); + PX_CHECK_AND_RETURN_VAL(restitution >= 0.0f && restitution <= 1.0f, "PxVehiclePhysXSuspensionLimitConstraintParams.restitution must be in range [0, 1]", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h new file mode 100644 index 0000000..ae31234 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h @@ -0,0 +1,357 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxAssert.h" +#include "foundation/PxTransform.h" +#include "extensions/PxConstraintExt.h" + +#include "vehicle2/PxVehicleLimits.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxConstraint.h" +#include "PxConstraintDesc.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxConstraint; + +namespace vehicle2 +{ +#endif + + +/** +\brief A description of the number of PxConstraintConnector instances per vehicle required to maintain suspension limit +and sticky tire instances. +*/ +struct PxVehiclePhysXConstraintLimits +{ + enum Enum + { + eNB_DOFS_PER_PXCONSTRAINT = 12, + eNB_DOFS_PER_WHEEL = 3, + eNB_WHEELS_PER_PXCONSTRAINT = eNB_DOFS_PER_PXCONSTRAINT / eNB_DOFS_PER_WHEEL, + eNB_CONSTRAINTS_PER_VEHICLE = (PxVehicleLimits::eMAX_NB_WHEELS + (eNB_WHEELS_PER_PXCONSTRAINT - 1)) / (eNB_WHEELS_PER_PXCONSTRAINT) + }; +}; + +/** +\brief PxVehiclePhysXConstraintState is a data structure used to write +constraint data to the internal state of the associated PxScene. +@see Px1dConstraint +*/ +struct PxVehiclePhysXConstraintState +{ + /** + \brief a boolean describing whether to trigger a low speed constraint along the tire longitudinal and lateral directions. + */ + bool tireActiveStatus[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief linear component of velocity jacobian in world space for the tire's longitudinal and lateral directions. + */ + PxVec3 tireLinears[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief angular component of velocity jacobian in world space for the tire's longitudinal and lateral directions. + */ + PxVec3 tireAngulars[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + /** + \brief damping coefficient applied to the tire's longitudinal and lateral velocities. + + The constraint sets a target velocity of 0 and the damping coefficient will impact the size of the + impulse applied to reach the target. Since damping acts as a stiffness with respect to the velocity, + too large a value can cause instabilities. + */ + PxReal tireDamping[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + + /** + \brief a boolean describing whether to trigger a suspension limit constraint. + */ + bool suspActiveStatus; + /** + \brief linear component of velocity jacobian in the world frame. + */ + PxVec3 suspLinear; + /** + \brief angular component of velocity jacobian in the world frame. + */ + PxVec3 suspAngular; + /** + \brief the excess suspension compression to be resolved by the constraint that cannot be resolved due to the travel limit + of the suspension spring. + + \note The expected error value is the excess suspension compression projected onto the ground plane normal and should have + a negative sign. + */ + PxReal suspGeometricError; + /** + \brief restitution value of the restitution model used to generate a target velocity that will resolve the geometric error. + \note A value of 0.0 means that the restitution model is not employed. + @see Px1DConstraintFlag::eRESTITUTION + @see Px1DConstraint::RestitutionModifiers::restitution + */ + PxReal restitution; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXConstraintState)); + } +}; + +//TAG:solverprepshader +PX_FORCE_INLINE PxU32 vehicleConstraintSolverPrep +(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 maxConstraints, + PxConstraintInvMassScale&, + const void* constantBlock, + const PxTransform& bodyAToWorld, + const PxTransform& bodyBToWorld, + bool, + PxVec3p& cA2w, PxVec3p& cB2w) +{ + PX_UNUSED(maxConstraints); + PX_UNUSED(body0WorldOffset); + PX_UNUSED(bodyBToWorld); + PX_ASSERT(bodyAToWorld.isValid()); PX_ASSERT(bodyBToWorld.isValid()); + + const PxVehiclePhysXConstraintState* data = static_cast(constantBlock); + PxU32 numActive = 0; + + //KS - the TGS solver will use raXn to try to add to the angular part of the linear constraints. + //We overcome this by setting the ra and rb offsets to be 0. + cA2w = bodyAToWorld.p; + cB2w = bodyBToWorld.p; + // note: this is only needed for PxSolverType::eTGS and even then it should not have an effect as + // long as a constraint raises Px1DConstraintFlag::eANGULAR_CONSTRAINT + + //Susp limit constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].suspActiveStatus) + { + // Going beyond max suspension compression should be treated similar to rigid body contacts. + // Thus setting up constraints that try to emulate such contacts. + // + // linear l = contact normal = n + // angular a = suspension force application offset x contact normal = cross(r, n) + // + // velocity at contact: + // vl: part from linear vehicle velocity v + // vl = dot(n, v) = dot(l, v) + // + // va: part from angular vehicle velocity w + // va = dot(n, cross(w, r)) = dot(w, cross(r, n)) = dot(w, a) + // + // ve: part from excess suspension compression + // ve = (geomError / dt) (note: geomError is expected to be negative here) + // + // velocity target vt = vl + va + ve + // => should become 0 by applying positive impulse along l. If vt is positive, + // nothing will happen as a negative impulse would have to be applied (but + // min impulse is set to 0). If vt is negative, a positive impulse will get + // applied to push vt towards 0. + // + + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].suspLinear; + p.angular0 = data[i].suspAngular; + p.geometricError = data[i].suspGeometricError; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = 0; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0; + p.solveHint = PxConstraintSolveHint::eINEQUALITY; + + // note: this is only needed for PxSolverType::eTGS to not have the angular part + // be modified based on the linear part during substeps. Basically, it will + // disable the constraint re-projection etc. to emulate PxSolverType::ePGS. + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + + if (data[i].restitution > 0.0f) + { + p.flags |= Px1DConstraintFlag::eRESTITUTION; + p.mods.bounce.restitution = data[i].restitution; + p.mods.bounce.velocityThreshold = -FLT_MAX; + } + numActive++; + } + } + + //Sticky tire friction constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL]) + { + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].tireLinears[PxVehicleTireDirectionModes::eLONGITUDINAL]; + p.angular0 = data[i].tireAngulars[PxVehicleTireDirectionModes::eLONGITUDINAL]; + p.geometricError = 0.0f; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = -FLT_MAX; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0.0f; + p.mods.spring.damping = data[i].tireDamping[PxVehicleTireDirectionModes::eLONGITUDINAL]; + // note: no stiffness specified as this will have no effect with geometricError=0 + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; // see explanation of same flag usage further above + numActive++; + } + } + + //Sticky tire friction constraints. + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT; i++) + { + if (data[i].tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL]) + { + Px1DConstraint& p = constraints[numActive]; + p.linear0 = data[i].tireLinears[PxVehicleTireDirectionModes::eLATERAL]; + p.angular0 = data[i].tireAngulars[PxVehicleTireDirectionModes::eLATERAL]; + p.geometricError = 0.0f; + p.linear1 = PxVec3(0); + p.angular1 = PxVec3(0); + p.minImpulse = -FLT_MAX; + p.maxImpulse = FLT_MAX; + p.velocityTarget = 0.0f; + p.mods.spring.damping = data[i].tireDamping[PxVehicleTireDirectionModes::eLATERAL]; + // note: no stiffness specified as this will have no effect with geometricError=0 + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; // see explanation of same flag usage further above + numActive++; + } + } + + return numActive; +} + +PX_FORCE_INLINE void visualiseVehicleConstraint +(PxConstraintVisualizer &viz, + const void* constantBlock, + const PxTransform& body0Transform, + const PxTransform& body1Transform, + PxU32 flags) +{ + PX_UNUSED(&viz); + PX_UNUSED(constantBlock); + PX_UNUSED(body0Transform); + PX_UNUSED(body1Transform); + PX_UNUSED(flags); + PX_ASSERT(body0Transform.isValid()); + PX_ASSERT(body1Transform.isValid()); +} + +class PxVehicleConstraintConnector : public PxConstraintConnector +{ +public: + + PxVehicleConstraintConnector() : mVehicleConstraintState(NULL) {} + PxVehicleConstraintConnector(PxVehiclePhysXConstraintState* vehicleConstraintState) : mVehicleConstraintState(vehicleConstraintState) {} + ~PxVehicleConstraintConnector() {} + + void setConstraintState(PxVehiclePhysXConstraintState* constraintState) { mVehicleConstraintState = constraintState; } + + virtual void* prepareData() { return mVehicleConstraintState; } + virtual const void* getConstantBlock() const { return mVehicleConstraintState; } + virtual PxConstraintSolverPrep getPrep() const { return vehicleConstraintSolverPrep; } + + //Is this necessary if physx no longer supports double-buffering? + virtual void onConstraintRelease() { } + + //Can be empty functions. + virtual bool updatePvdProperties(physx::pvdsdk::PvdDataStream& pvdConnection, const PxConstraint* c, PxPvdUpdateType::Enum updateType) const + { + PX_UNUSED(pvdConnection); + PX_UNUSED(c); + PX_UNUSED(updateType); + return true; + } + virtual void updateOmniPvdProperties() const { } + virtual void onComShift(PxU32 actor) { PX_UNUSED(actor); } + virtual void onOriginShift(const PxVec3& shift) { PX_UNUSED(shift); } + virtual void* getExternalReference(PxU32& typeID) { typeID = PxConstraintExtIDs::eVEHICLE_JOINT; return this; } + virtual PxBase* getSerializable() { return NULL; } + +private: + + PxVehiclePhysXConstraintState* mVehicleConstraintState; +}; + +/** +\brief A mapping between constraint state data and the associated PxConstraint instances. +*/ +struct PxVehiclePhysXConstraints +{ + /** + \brief PxVehiclePhysXConstraintComponent writes to the constraintStates array and a + callback invoked by PxScene::simulate() reads a portion from it for a block of wheels + and writes that portion to an associated PxConstraint instance. + */ + PxVehiclePhysXConstraintState constraintStates[PxVehicleLimits::eMAX_NB_WHEELS]; + + /** + \brief PxVehiclePhysXConstraintComponent writes to the constraintStates array and a + callback invoked by PxScene::simulate() reads a portion from it for a block of wheels + and writes that portion to an associated PxConstraint instance. + */ + PxConstraint* constraints[PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE]; + + /** + \brief A constraint connector is necessary to connect each PxConstraint to a portion of the constraintStates array. + */ + PxVehicleConstraintConnector* constraintConnectors[PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE]; + + PX_FORCE_INLINE void setToDefault() + { + for (PxU32 i = 0; i < PxVehicleLimits::eMAX_NB_WHEELS; i++) + { + constraintStates[i].setToDefault(); + } + for(PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE; i++) + { + constraints[i] = NULL; + constraintConnectors[i] = NULL; + } + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h new file mode 100644 index 0000000..b422aea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryComponents.h @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehiclePhysXRoadGeometrySceneQueryComponent : public PxVehicleComponent +{ +public: + PxVehiclePhysXRoadGeometrySceneQueryComponent() : PxVehicleComponent() {} + virtual ~PxVehiclePhysXRoadGeometrySceneQueryComponent() {} + + /** + \brief Provide vehicle data items for this component. + + \param[out] axleDescription identifies the wheels on each axle. + \param[out] roadGeomParams The road geometry parameters of the vehicle. + \param[out] steerResponseStates The steer response state of the wheels. + \param[out] rigidBodyState The pose, velocity etc. of the vehicle rigid body. + \param[out] wheelParams The wheel parameters for the wheels. + \param[out] suspensionParams The suspension parameters for the wheels. + \param[out] materialFrictionParams The tire friction tables for the wheels. + \param[out] roadGeometryStates The detected ground surface plane, friction value etc. for the wheels. + \param[out] physxRoadGeometryStates Optional buffer to store additional information about the query (like actor/shape that got hit etc.). + Set to empty if not desired. + */ + virtual void getDataForPhysXRoadGeometrySceneQueryComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehiclePhysXRoadGeometryQueryParams*& roadGeomParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& materialFrictionParams, + PxVehicleArrayData& roadGeometryStates, + PxVehicleArrayData& physxRoadGeometryStates) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + + PX_PROFILE_ZONE("PxVehiclePhysXRoadGeometrySceneQueryComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehiclePhysXRoadGeometryQueryParams* roadGeomParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData materialFrictionParams; + PxVehicleArrayData roadGeometryStates; + PxVehicleArrayData physxRoadGeometryStates; + + getDataForPhysXRoadGeometrySceneQueryComponent(axleDescription, + roadGeomParams, steerResponseStates, rigidBodyState, + wheelParams, suspensionParams, materialFrictionParams, + roadGeometryStates, physxRoadGeometryStates); + + if (context.getType() == PxVehicleSimulationContextType::ePHYSX) + { + const PxVehiclePhysXSimulationContext& physxContext = static_cast(context); + + for(PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehiclePhysXRoadGeometryQueryUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + *roadGeomParams, materialFrictionParams[wheelId], + steerResponseStates[wheelId], *rigidBodyState, + *physxContext.physxScene, physxContext.physxUnitCylinderSweepMesh, context.frame, + roadGeometryStates[wheelId], + !physxRoadGeometryStates.isEmpty() ? &physxRoadGeometryStates[wheelId] : NULL); + } + } + else + { + PX_ALWAYS_ASSERT(); + + for(PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + roadGeometryStates[wheelId].setToDefault(); + } + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h new file mode 100644 index 0000000..20ddaf6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxScene; +class PxConvexMesh; + +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleSuspensionParams; +struct PxVehiclePhysXRoadGeometryQueryParams; +struct PxVehiclePhysXRoadGeometryQueryState; +struct PxVehiclePhysXMaterialFrictionParams; +struct PxVehicleRigidBodyState; +struct PxVehicleFrame; +struct PxVehicleRoadGeometryState; + +/** +\brief Compute the plane of the road geometry under a wheel and the tire friction of the contact. +\param[in] wheelParams describes the radius and halfwidth of the wheel. +\param[in] suspParams describes the frame of the suspension and wheel and the maximum suspension travel. +\param[in] roadGeomParams describes the operation of the PhysX scene query. +\param[in] materialFrictionParams describes a mapping between PxMaterial and friction in order to compute a tire friction value. +\param[in] wheelYawAngle is the yaw angle (in radians) of the wheel. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[in] scene is the PhysX scene that will be queried by the scene query. +\param[in] unitCylinderSweepMesh is a convex cylindrical mesh of unit radius and half-width to be used in +the event that a sweep query is to be used. +\param[in] frame describes the lateral, longitudinal and vertical axes and is used to scale unitCylinderSweepMesh +by the wheel's radius and half-width. +\param[out] roadGeomState contains the plane and friction of the road geometry under the wheel. +\param[out] physxRoadGeometryState Optional buffer to store additional information about the query (like actor/shape that got hit etc.). + Set to NULL if not needed. +\note PxVehicleRoadGeometryState::hitState will have value false in the event that the there is no reachable road geometry under the wheel and +true if there is reachable road geometry under the wheel. Road geometry is considered reachable if the suspension can elongate from its +reference pose far enough to place wheel on the ground. +*/ +void PxVehiclePhysXRoadGeometryQueryUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspParams, + const PxVehiclePhysXRoadGeometryQueryParams& roadGeomParams, const PxVehiclePhysXMaterialFrictionParams& materialFrictionParams, + const PxReal wheelYawAngle, const PxVehicleRigidBodyState& rigidBodyState, + const PxScene& scene, const PxConvexMesh* unitCylinderSweepMesh, + const PxVehicleFrame& frame, + PxVehicleRoadGeometryState& roadGeomState, + PxVehiclePhysXRoadGeometryQueryState* physxRoadGeometryState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h new file mode 100644 index 0000000..4dbe39d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxConvexMesh; +class PxPhysics; +struct PxCookingParams; + +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; + +/** +\brief Create a cylindrical mesh with unit radius and half-width. +\param[in] vehicleFrame is a description of the lateral and longitudinal axes. +\param[in] physics is a PxPhysics instance. +\param[in] params is a PxCookingParams instance +\return Return a PxConvexMesh instance that represents a convex hull with unit radius and half-width. +@see PxVehicleUnitCylinderSweepMeshDestroy +*/ +PxConvexMesh* PxVehicleUnitCylinderSweepMeshCreate(const PxVehicleFrame& vehicleFrame, PxPhysics& physics, const PxCookingParams& params); + +/** +\brief Release the mesh created with PxVehicleUnitCylinderSweepMeshCreate. +\param[in] mesh is a PxConvexMesh instance. +@see PxVehicleUnitCylinderSweepMeshCreate +*/ +void PxVehicleUnitCylinderSweepMeshDestroy(PxConvexMesh* mesh); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h new file mode 100644 index 0000000..896204c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h @@ -0,0 +1,164 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#include "PxQueryFiltering.h" + +#if !PX_DOXYGEN +namespace physx +{ +class PxMaterial; + +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief PhysX scene queries may be raycasts or sweeps. +\note eNONE will result in no PhysX scene query. This option will not overwrite the associated PxVehicleRoadGeometryState. +*/ +struct PxVehiclePhysXRoadGeometryQueryType +{ + enum Enum + { + eNONE = 0, //!< Info about the road geometry below the wheel is provided by the user + eRAYCAST, //!< The road geometry below the wheel is analyzed using a raycast query + eSWEEP, //!< The road geometry below the wheel is analyzed using a sweep query + eMAX_NB + }; +}; + +/** +\brief A description of type of PhysX scene query and the filter data to apply to the query. +*/ +struct PxVehiclePhysXRoadGeometryQueryParams +{ + /** + \brief A description of the type of physx scene query to employ. + @see PxSceneQuerySystemBase::raycast + @see PxSceneQuerySystemBase::sweep + */ + PxVehiclePhysXRoadGeometryQueryType::Enum roadGeometryQueryType; + + /** + \brief The filter data to use for the physx scene query. + @see PxSceneQuerySystemBase::raycast + @see PxSceneQuerySystemBase::sweep + */ + PxQueryFilterData filterData; + + /** + \brief A filter callback to be used by the physx scene query + \note A null pointer is allowed. + @see PxSceneQuerySystemBase::raycast + @see PxSceneQuerySystemBase::sweep + */ + PxQueryFilterCallback* filterCallback; + + PX_FORCE_INLINE PxVehiclePhysXRoadGeometryQueryParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(roadGeometryQueryType < PxVehiclePhysXRoadGeometryQueryType::eMAX_NB, "PxVehiclePhysXRoadGeometryQueryParams.roadGeometryQueryType has illegal value", false); + return true; + } +}; + +/** +A mapping between PxMaterial and a friction value to be used by the tire model. +@see PxVehiclePhysXMaterialFrictionParams +*/ +struct PxVehiclePhysXMaterialFriction +{ + /** + \brief A PxMaterial instance that is to be mapped to a friction value. + */ + const PxMaterial* material; + + /** + \brief A friction value that is to be mapped to a PxMaterial instance. + \note friction must have value greater than or equal to zero. + + Range: [0, inf)
+ + @see PxVehicleTireGripState::friction + */ + PxReal friction; + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(friction >= 0.0f, "PxVehiclePhysXMaterialFriction.friction must be greater than or equal to zero", false); + return true; + } +}; + +/** +\brief A mappping between PxMaterial instance and friction for multiple PxMaterial intances. +*/ +struct PxVehiclePhysXMaterialFrictionParams +{ + PxVehiclePhysXMaterialFriction* materialFrictions; //!< An array of mappings between PxMaterial and friction. + PxU32 nbMaterialFrictions; //!< The number of mappings between PxMaterial and friction. + PxReal defaultFriction; //!< A default friction value to be used in the event that the PxMaterial under the tire is not found in the array #materialFrictions. + + PX_FORCE_INLINE bool isValid() const + { + for (PxU32 i = 0; i < nbMaterialFrictions; i++) + { + if (!materialFrictions[i].isValid()) + return false; + } + PX_CHECK_AND_RETURN_VAL(defaultFriction >= 0.0f, "PxVehiclePhysXMaterialFrictionParams.defaultFriction must be greater than or equal to zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h new file mode 100644 index 0000000..28ef45f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxMemory.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ + +class PxRigidActor; +class PxShape; +class PxMaterial; + +namespace vehicle2 +{ +#endif + +struct PxVehiclePhysXRoadGeometryQueryState +{ + PxRigidActor* actor; //!< The actor that got hit by the query. + PxShape* shape; //!< The shape that got hit by the query. + PxMaterial* material; //!< The material at the hit point. + PxVec3 hitPosition; //!< The hit position in world space. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehiclePhysXRoadGeometryQueryState)); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h new file mode 100644 index 0000000..676ff73 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdComponents.h @@ -0,0 +1,323 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleComponent.h" +#include "vehicle2/PxVehicleParams.h" +#include "PxVehiclePvdFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +#define VEHICLE_FLOAT_ARRAY_DATA(b) PxVehicleArrayData b; b.setEmpty(); +#define VEHICLE_ARRAY_DATA(a, b) PxVehicleArrayData b; b.setEmpty(); +#define VEHICLE_SIZED_ARRAY_DATA(a, b) PxVehicleSizedArrayData b; b.setEmpty(); + +class PxVehiclePVDComponent : public PxVehicleComponent +{ +public: + + PxVehiclePVDComponent() : PxVehicleComponent() , firstTime(true) {} + virtual ~PxVehiclePVDComponent() {} + + virtual void getDataForPVDComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rbodyParams, const PxVehicleRigidBodyState*& rbodyState, + const PxVehicleSuspensionStateCalculationParams*& suspStateCalcParams, + PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams*& steerResponseParams, + PxVehicleArrayData& brakeResponseStates, + PxVehicleArrayData& steerResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& wheelActuationStates, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspParams, + PxVehicleArrayData& suspCompParams, + PxVehicleArrayData& suspForceParams, + PxVehicleArrayData& suspStates, + PxVehicleArrayData& suspCompStates, + PxVehicleArrayData& suspForces, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireCamberStates, + PxVehicleArrayData& tireForces, + PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque*& antiRollTorque, + const PxVehicleCommandState*& commandState, + const PxVehicleDirectDriveThrottleCommandResponseParams*& directDriveThrottleResponseParams, + const PxVehicleDirectDriveTransmissionCommandState*& directDriveTransmissionState, + PxVehicleArrayData& directDrivethrottleResponseState, + const PxVehicleClutchCommandResponseParams*& clutchResponseParams, + const PxVehicleClutchParams*& clutchParams, + const PxVehicleEngineParams*& engineParams, + const PxVehicleGearboxParams*& gearboxParams, + const PxVehicleAutoboxParams*& autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams*& multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams*& fourWheelDiffParams, + const PxVehicleEngineDriveTransmissionCommandState*& engineDriveTransmissionState, + const PxVehicleClutchCommandResponseState*& clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState*& engineDriveThrottleResponseState, + const PxVehicleEngineState*& engineState, + const PxVehicleGearboxState*& gearboxState, + const PxVehicleAutoboxState*& autoboxState, + const PxVehicleDifferentialState*& diffState, + const PxVehicleClutchSlipState*& clutchSlipState, + PxVehicleArrayData& physxConstraintParams, + PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor*& physxActor, + const PxVehiclePhysXRoadGeometryQueryParams*& physxRoadGeomQryParams, + PxVehicleArrayData& physxRoadGeomStates, + PxVehicleArrayData& physxConstraintStates, + PxVehiclePvdObjectHandles*& objectHandles) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_UNUSED(dt); + PX_UNUSED(context); + + if(!context.pvdContext.attributeHandles || !context.pvdContext.writer) + return true; + + const PxVehicleAxleDescription* axleDesc = NULL; + const PxVehicleRigidBodyParams* rbodyParams = NULL; + const PxVehicleRigidBodyState* rbodyState = NULL; + const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams = NULL; + VEHICLE_SIZED_ARRAY_DATA(PxVehicleBrakeCommandResponseParams, brakeResponseParams); + const PxVehicleSteerCommandResponseParams* steerResponseParams = NULL; + VEHICLE_FLOAT_ARRAY_DATA(brakeResponseStates); + VEHICLE_FLOAT_ARRAY_DATA(steerResponseStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelParams, wheelParams); + VEHICLE_ARRAY_DATA(PxVehicleWheelActuationState, wheelActuationStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelRigidBody1dState, wheelRigidBody1dStates); + VEHICLE_ARRAY_DATA(PxVehicleWheelLocalPose, wheelLocalPoses); + VEHICLE_ARRAY_DATA(PxVehicleRoadGeometryState, roadGeomStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionParams, suspParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionComplianceParams, suspComplianceParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionForceParams, suspForceParams); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionState, suspStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionComplianceState, suspComplianceStates); + VEHICLE_ARRAY_DATA(PxVehicleSuspensionForce, suspForces); + VEHICLE_ARRAY_DATA(PxVehicleTireForceParams, tireForceParams); + VEHICLE_ARRAY_DATA(PxVehicleTireDirectionState, tireDirectionStates); + VEHICLE_ARRAY_DATA(PxVehicleTireSpeedState, tireSpeedStates); + VEHICLE_ARRAY_DATA(PxVehicleTireSlipState, tireSlipStates); + VEHICLE_ARRAY_DATA(PxVehicleTireStickyState, tireStickyStates); + VEHICLE_ARRAY_DATA(PxVehicleTireGripState, tireGripStates); + VEHICLE_ARRAY_DATA(PxVehicleTireCamberAngleState, tireCamberStates); + VEHICLE_ARRAY_DATA(PxVehicleTireForce, tireForces); + VEHICLE_SIZED_ARRAY_DATA(PxVehicleAntiRollForceParams, antiRollParams); + const PxVehicleAntiRollTorque* antiRollTorque = NULL; + const PxVehicleCommandState* commandState = NULL; + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams = NULL; + const PxVehicleDirectDriveTransmissionCommandState* directDriveTransmissionState = NULL; + VEHICLE_FLOAT_ARRAY_DATA(directDrivethrottleResponseState); + const PxVehicleClutchCommandResponseParams* clutchResponseParams = NULL; + const PxVehicleClutchParams* clutchParams = NULL; + const PxVehicleEngineParams* engineParams = NULL; + const PxVehicleGearboxParams* gearboxParams = NULL; + const PxVehicleAutoboxParams* autoboxParams = NULL; + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams = NULL; + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffParams = NULL; + const PxVehicleEngineDriveTransmissionCommandState* engineDriveTransmissionCommandState = NULL; + const PxVehicleClutchCommandResponseState* clutchResponseState = NULL; + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState = NULL; + const PxVehicleEngineState* engineState = NULL; + const PxVehicleGearboxState* gearboxState = NULL; + const PxVehicleAutoboxState* autoboxState = NULL; + const PxVehicleDifferentialState* diffState = NULL; + const PxVehicleClutchSlipState* clutchSlipState = NULL; + VEHICLE_ARRAY_DATA(PxVehiclePhysXSuspensionLimitConstraintParams, physxConstraintParams); + VEHICLE_ARRAY_DATA(PxVehiclePhysXMaterialFrictionParams, physxMaterialFrictionParams); + const PxVehiclePhysXActor* physxActor = NULL; + const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams = NULL; + VEHICLE_ARRAY_DATA(PxVehiclePhysXRoadGeometryQueryState, physxRoadGeomStates); + VEHICLE_ARRAY_DATA(PxVehiclePhysXConstraintState, physxConstraintStates); + PxVehiclePvdObjectHandles* omniPvdObjectHandles = NULL; + + getDataForPVDComponent( + axleDesc, + rbodyParams, rbodyState, + suspStateCalcParams, + brakeResponseParams, steerResponseParams, + brakeResponseStates, steerResponseStates, + wheelParams, + wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, + suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + antiRollParams, antiRollTorque, + commandState, + directDriveThrottleResponseParams, directDriveTransmissionState, directDrivethrottleResponseState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, multiWheelDiffParams, fourWheelDiffParams, + engineDriveTransmissionCommandState, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, + omniPvdObjectHandles); + + if(!omniPvdObjectHandles) + return true; + + if(firstTime) + { + PxVehiclePvdRigidBodyRegister( + rbodyParams, rbodyState, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdSuspensionStateCalculationParamsRegister( + suspStateCalcParams, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdCommandResponseRegister( + brakeResponseParams, steerResponseParams, + brakeResponseStates, steerResponseStates, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdWheelAttachmentsRegister( + *axleDesc, + wheelParams, wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdAntiRollsRegister( + antiRollParams, antiRollTorque, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdDirectDrivetrainRegister( + commandState, directDriveTransmissionState, + directDriveThrottleResponseParams, + directDrivethrottleResponseState, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdEngineDrivetrainRegister( + commandState, engineDriveTransmissionCommandState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, multiWheelDiffParams, fourWheelDiffParams, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdPhysXWheelAttachmentRegister( + *axleDesc, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdPhysXRigidActorRegister( + physxActor, + *context.pvdContext.attributeHandles, omniPvdObjectHandles, context.pvdContext.writer); + + firstTime = false; + } + + PxVehiclePvdRigidBodyWrite( + rbodyParams, rbodyState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdSuspensionStateCalculationParamsWrite( + suspStateCalcParams, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdCommandResponseWrite( + *axleDesc, brakeResponseParams, steerResponseParams, brakeResponseStates, steerResponseStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdWheelAttachmentsWrite( + *axleDesc, + wheelParams, wheelActuationStates, wheelRigidBody1dStates, wheelLocalPoses, + roadGeomStates, + suspParams, suspComplianceParams, suspForceParams, suspStates, suspComplianceStates, + suspForces, + tireForceParams, + tireDirectionStates, tireSpeedStates, tireSlipStates, tireStickyStates, tireGripStates, tireCamberStates, + tireForces, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdAntiRollsWrite( + antiRollParams, antiRollTorque, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdDirectDrivetrainWrite( + *axleDesc, + commandState, directDriveTransmissionState, + directDriveThrottleResponseParams, + directDrivethrottleResponseState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdEngineDrivetrainWrite( + commandState, engineDriveTransmissionCommandState, + clutchResponseParams, clutchParams, engineParams, gearboxParams, autoboxParams, multiWheelDiffParams, fourWheelDiffParams, + clutchResponseState, throttleResponseState, engineState, gearboxState, autoboxState, diffState, clutchSlipState, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdPhysXWheelAttachmentWrite( + *axleDesc, + physxConstraintParams, physxMaterialFrictionParams, + physxActor, physxRoadGeomQryParams, physxRoadGeomStates, physxConstraintStates, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + PxVehiclePvdPhysXRigidActorWrite( + physxActor, + *context.pvdContext.attributeHandles, *omniPvdObjectHandles, context.pvdContext.writer); + + return true; + } + +private: + + bool firstTime; +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h new file mode 100644 index 0000000..9bff4db --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdFunctions.h @@ -0,0 +1,610 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/braking/PxVehicleBrakingParams.h" +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/tire/PxVehicleTireParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +class OmniPvdWriter; +namespace physx +{ +class PxAllocatorCallback; +namespace vehicle2 +{ +struct PxVehiclePvdAttributeHandles; +struct PxVehiclePvdObjectHandles; +} // namespace vehicle2 +} // namespace physx + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Create object instances in omnipvd that will be used to reflect the parameters and state of the rigid body of a vehicle instance. +Handles to the created object instances will be stored in a PxVehiclePvdObjectHandles instance. +\param[in] rbodyParams describes the parameters of the vehicle's rigid body. +\param[in] rbodyState describes the state of the vehicle's rigid body. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If rbodyParams is NULL, omnipvd will not reflect rigid body parameters. +\note If rbodyState is NULL, omnipvd will not reflect rigid body state. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +\note PxVehiclePvdRigidBodyRegister should be called once for each vehicle instance. +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdRigidBodyWrite +*/ +void PxVehiclePvdRigidBodyRegister +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write the parameters and state of the rigid body of a vehicle instance to omnipvd. +\param[in] rbodyParams describes the parameters of the vehicle's rigid body. +\param[in] rbodyState describes the state of the vehicle's rigid body. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If rbodyParams is NULL but a non-NULL value was used in PxVehiclePvdRigidBodyRegister(), the rigid body parameters will not be updated in omnipvd. +\note If rbodyState is NULL but a non-NULL value was used in PxVehiclePvdRigidBodyRegister(), the rigid body state will not be updated in omnipvd. +\note omniWriter must be non-NULL and must be the same instance used in PxVehiclePvdRigidBodyRegister(). +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdRigidBodyRegister +*/ +void PxVehiclePvdRigidBodyWrite +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the suspension state calculation parameters of a vehicle instance. +\param[in] suspStateCalcParams describes parameters used to calculate suspension state. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If suspStateCalcParams is NULL, omnipvd will not reflect the suspension state calculation parameters. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdSuspensionStateCalculationParamsWrite +*/ +void PxVehiclePvdSuspensionStateCalculationParamsRegister +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write the parameters and state of the rigid body of a vehicle instance to omnipvd. +\param[in] suspStateCalcParams describes parameters used to calculate suspension state. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If suspStateCalcParams is NULL but a non-NULL value was used in void PxVehiclePvdSuspensionStateCalculationParamsRegister(), +the suspension state calculation parameters will not be updated in omnipvd. +\note omniWriter must be non-NULL and must be the same instance used in PxVehiclePvdSuspensionStateCalculationParamsRegister(). +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdSuspensionStateCalculationParamsRegister +*/ +void PxVehiclePvdSuspensionStateCalculationParamsWrite +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the brake and steer command response parameters of a vehicle instance. +\param[in] brakeResponseParams is an array of brake command response parameters. +\param[in] steerResponseParams describes the steer command response parameters. +\param[in] brakeResponseStates is an array of brake responses torqyes, +\param[in] steerResponseStates is an array of steer response angles. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If brakeResponseParams is empty, omnipvd will not reflect any brake command response parameters. +\note If steerResponseParams is NULL, omnipvd will not reflect the steer command response parameters. +\note If brakeResponseStates is empty, omnipvd will not reflect any brake command response state. +\note If steerResponseStates is empty, omnipvd will not reflect any steer command response state. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdCommandResponseWrite +*/ +void PxVehiclePvdCommandResponseRegister +(const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write brake and steer command response parameters to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] brakeResponseParams is an array of brake command response parameters. +\param[in] steerResponseParams describes the steer command response parameters. +\param[in] brakeResponseStates is an array of brake response torques. +\param[in] steerResponseStates is an array of steer response angles. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If brakeResponseParams is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the brake command response parameters will not be updated in omnipvd. +\note If steerResponseParams is non-NULL but a NULL value was used in PxVehiclePvdCommandResponseRegister(), +the steer command parameters will not be updated in omnipvd. +\note If brakeResponseStates is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the brake response states will not be updated in omnipvd. +\note If steerResponseStates is empty but a non-empty array was used in PxVehiclePvdCommandResponseRegister(), +the steer response states will not be updated in omnipvd. +\note omniWriter must be non-NULL and must be the same instance used in PxVehiclePvdCommandResponseRegister(). +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdCommandResponseRegister +*/ +void PxVehiclePvdCommandResponseWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect wheel attachment data such as tires, suspensions and wheels. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] wheelParams is an array of wheel parameters. +\param[in] wheelActuationStates is an array of wheel actuation states. +\param[in] wheelRigidBody1dStates is an array of wheel rigid body states. +\param[in] wheelLocalPoses is an array of wheel local poses. +\param[in] roadGeometryStates is an array of road geometry states. +\param[in] suspParams is an array of suspension parameters. +\param[in] suspCompParams is an array of suspension compliance parameters. +\param[in] suspForceParams is an array of suspension force parameters. +\param[in] suspStates is an array of suspension states. +\param[in] suspCompStates is an array of suspension compliance states. +\param[in] suspForces is an array of suspension forces. +\param[in] tireForceParams is an array of tire force parameters. +\param[in] tireDirectionStates is an array of tire direction states. +\param[in] tireSpeedStates is an array of tire speed states. +\param[in] tireSlipStates is an array of tire slip states. +\param[in] tireStickyStates is an array of tire sticky states. +\param[in] tireGripStates is an array of tire grip states. +\param[in] tireCamberStates is an array of tire camber states. +\param[in] tireForces is an array of tire forces. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdWheelAttachmentsWrite +*/ +void PxVehiclePvdWheelAttachmentsRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write wheel attachment data such as tire, suspension and wheel data to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] wheelParams is an array of wheel parameters. +\param[in] wheelActuationStates is an array of wheel actuation states. +\param[in] wheelRigidBody1dStates is an array of wheel rigid body states. +\param[in] wheelLocalPoses is an array of wheel local poses. +\param[in] roadGeometryStates is an array of road geometry states. +\param[in] suspParams is an array of suspension parameters. +\param[in] suspCompParams is an array of suspension compliance parameters. +\param[in] suspForceParams is an array of suspension force parameters. +\param[in] suspStates is an array of suspension states. +\param[in] suspCompStates is an array of suspension compliance states. +\param[in] suspForces is an array of suspension forces. +\param[in] tireForceParams is an array of tire force parameters. +\param[in] tireDirectionStates is an array of tire direction states. +\param[in] tireSpeedStates is an array of tire speed states. +\param[in] tireSlipStates is an array of tire slip states. +\param[in] tireStickyStates is an array of tire sticky states. +\param[in] tireGripStates is an array of tire grip states. +\param[in] tireCamberStates is an array of tire camber states. +\param[in] tireForces is an array of tire forces. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty but the corresponding argument in PxVehiclePvdWheelAttachmentsRegister was not empty, the corresponding data will not be updated in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdWheelAttachmentsRegister +*/ +void PxVehiclePvdWheelAttachmentsWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the antiroll bars of a vehicle instance. +\param[in] antiRollForceParams is an array of antiroll parameters. +\param[in] antiRollTorque describes the instantaneous accumulated torque from all antiroll bas. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If antiRollForceParams is empty, the corresponding data will not be reflected in omnipvd. +\note If antiRollTorque is NULL, the corresponding data will not be reflected in omnipvd. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdAntiRollsWrite +*/ +void PxVehiclePvdAntiRollsRegister +(const PxVehicleSizedArrayData& antiRollForceParams, const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write antiroll data to omnipvd. +\param[in] antiRollForceParams is an array of antiroll parameters. +\param[in] antiRollTorque describes the instantaneous accumulated torque from all antiroll bas. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If antiRollForceParams is empty but the corresponding argument was not empty, the corresponding data will not be updated in omnipvd. +\note If antiRollTorque is NULL but the corresponding argument was not NULL, the corresponding data will not be updated in omnipvd. +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdAntiRollsRegister +*/ +void PxVehiclePvdAntiRollsWrite +(const PxVehicleSizedArrayData& antiRollForceParams, const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the direct drivetrain of a vehicle instance. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the direct drive transmission. +\param[in] directDriveThrottleResponseParams describes the vehicle's torque response to a throttle command. +\param[in] directDriveThrottleResponseState is the instantaneous torque response of each wheel to a throttle command. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If commandState is NULL, the corresponding data will not be reflected in omnipvd. +\note If transmissionCommandState is NULL, the corresponding data will not be reflected in omnipvd. +\note If directDriveThrottleResponseParams is NULL, the corresponding data will not be reflected in omnipvd. +\note If directDriveThrottleResponseState is empty, the corresponding data will not be reflected in omnipvd. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdDirectDrivetrainWrite +*/ +void PxVehiclePvdDirectDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write direct drivetrain data to omnipvd. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the direct drive transmission. +\param[in] directDriveThrottleResponseParams describes the vehicle's torque response to a throttle command. +\param[in] directDriveThrottleResponseState is the instantaneous torque response of each wheel to a throttle command. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If commandState is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If transmissionCommandState is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If directDriveThrottleResponseParams is NULL but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not NULL, the corresponding data will not be updated in omnipvd. +\note If directDriveThrottleResponseState is empty but the corresponding entry in PxVehiclePvdDirectDrivetrainRegister() was not empty, the corresponding data will not be updated in omnipvd. +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdDirectDrivetrainRegister +*/ +void PxVehiclePvdDirectDrivetrainWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register object instances in omnipvd that will be used to reflect the engine drivetrain of a vehicle instance. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the engine drive transmission. +\param[in] clutchResponseParams describes the vehicle's response to a clutch command. +\param[in] clutchParams describes the vehicle's clutch. +\param[in] engineParams describes the engine. +\param[in] gearboxParams describes the gearbox. +\param[in] autoboxParams describes the automatic gearbox. +\param[in] multiWheelDiffParams describes a multiwheel differential without limited slip compensation. +\param[in] fourWheelDiffPrams describes a differential that delivers torque to four drive wheels with limited slip compensation. +\param[in] clutchResponseState is the instantaneous reponse of the clutch to a clutch command. +\param[in] throttleResponseState is the instantaneous response to a throttle command. +\param[in] engineState is the instantaneous state of the engine. +\param[in] gearboxState is the instantaneous state of the gearbox. +\param[in] autoboxState is the instantaneous state of the automatic gearbox. +\param[in] diffState is the instantaneous state of the differential. +\param[in] clutchSlipState is the instantaneous slip recorded at the clutch. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any pointer is NULL, the corresponding data will not be reflected in omnipvd. +\note objectHandles must be non-NULL +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdEngineDrivetrainWrite +*/ +void PxVehiclePvdEngineDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParams, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffPrams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write engine drivetrain data of a vehicle instance to omnipvd. +\param[in] commandState describes the control values applied to the vehicle. +\param[in] transmissionCommandState describes the state of the engine drive transmission. +\param[in] clutchResponseParams describes the vehicle's response to a clutch command. +\param[in] clutchParams describes the vehicle's clutch. +\param[in] engineParams describes the engine. +\param[in] gearboxParams describes the gearbox. +\param[in] autoboxParams describes the automatic gearbox. +\param[in] multiWheelDiffParams describes a multiwheel differential without limited slip compensation. +\param[in] fourWheelDiffPrams describes a differential that delivers torque to four drive wheels with limited slip compensation. +\param[in] clutchResponseState is the instantaneous reponse of the clutch to a clutch command. +\param[in] throttleResponseState is the instantaneous response to a throttle command. +\param[in] engineState is the instantaneous state of the engine. +\param[in] gearboxState is the instantaneous state of the gearbox. +\param[in] autoboxState is the instantaneous state of the automatic gearbox. +\param[in] diffState is the instantaneous state of the differential. +\param[in] clutchSlipState is the instantaneous slip recorded at the clutch. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any pointer is NULL and the corresponding argument in PxVehiclePvdEngineDrivetrainRegister() was not NULL, the corresponding data will not be reflected in omnipvd. +\note omniWriter must be non-NULL +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdEngineDrivetrainRegister +*/ +void PxVehiclePvdEngineDrivetrainWrite +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParams, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffPrams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register per wheel attachment data that involves the vehicle's integration with a PhysX scene. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] physxSuspLimitConstraintParams describes the method used by PhysX to enforce suspension travel limits. +\param[in] physxMaterialFrictionParams describes the friction response of each wheel to a set of PxMaterial instances. +\param[in] physxActor describes the PxRigidActor and PxShape instances that are used to represent the vehicle's rigid body and wheel shapes in PhysX. +\param[in] physxRoadGeometryQueryParams describes the physx scene query method used to place each wheel on the ground. +\param[in] physxRoadGeomState is an array of per wheel physx scene query results. +\param[in] physxConstraintStates is an array of constraints states used by PhysX to enforce sticky tire and suspension travel limit constraints. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty, the corresponding data will not be reflected in omnipvd. +\note If physxActor is NULL, the corresponding data will not be reflected in omnipvd. +\note If physxRoadGeometryQueryParams is NULL, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\note objectHandles must be non-NULL. +\note omniWriter must be non-NULL. +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdPhysXWheelAttachmentWrite +*/ +void PxVehiclePvdPhysXWheelAttachmentRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeometryQueryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write to omnipvd the per wheel attachment data that involves the vehicle's integration with a PhysX scene. +\param[in] axleDesc is a description of the wheels and axles of a vehicle. +\param[in] physxSuspLimitConstraintParams describes the method used by PhysX to enforce suspension travel limits. +\param[in] physxMaterialFrictionParams describes the friction response of each wheel to a set of PxMaterial instances. +\param[in] physxActor describes the PxShape instances that are used to represent the vehicle's wheel shapes in PhysX. +\param[in] physxRoadGeometryQueryParams describes the physx scene query method used to place each wheel on the ground. +\param[in] physxRoadGeomState is an array of per wheel physx scene query results. +\param[in] physxConstraintStates is an array of constraints states used by PhysX to enforce sticky tire and suspension travel limit constraints. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If any array is empty but the corresponding array in PxVehiclePvdPhysXWheelAttachmentRegister() was not empty, the corresponding data will not be updated in omnipvd. +\note If physxActor is NULL but the corresponding argument in PxVehiclePvdPhysXWheelAttachmentRegister was not NULL, the corresponding data will not be reflected in omnipvd. +\note If physxRoadGeometryQueryParams is NULL but the corresponding argument in PxVehiclePvdPhysXWheelAttachmentRegister was not NULL, the corresponding data will not be reflected in omnipvd. +\note Each array must either be empty or contain an entry for each wheel present in axleDesc. +\note omniWriter must be non-NULL. +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdPhysXWheelAttachmentWrite +*/ +void PxVehiclePvdPhysXWheelAttachmentWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeometryQueryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Register the PxRigidActor instance that represents the vehicle's rigid body in a PhysX scene. +\param[in] physxActor describes the PxRigidActor instance that is used to represent the vehicle's rigid body in PhysX. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxActor is NULL, the corresponding data will not be reflected in omnipvd. +\note objectHandles must be non-NULL. +\note omniWriter must be non-NULL. +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdPhysXRigidActorWrite +*/ +void PxVehiclePvdPhysXRigidActorRegister +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter); + +/** +\brief Write the PxRigidActor instance to omnipvd. +\param[in] physxActor describes the PxRigidActor instance that is used to represent the vehicle's rigid body in PhysX. +\param[in] attributeHandles contains a general description of vehicle parameters and states that will be reflected in omnipvd. +\param[in] objectHandles contains unique handles for the parameters and states of each vehicle instance. +\param[in] omniWriter is an OmniPvdWriter instance used to communicate state and parameter data to omnipvd. +\note If physxActor is NULL and the corresponding argument in PxVehiclePvdPhysXRigidActorRegister was not NULL, the corresponding data will not be updated in omnipvd. +\note objectHandles must be non-NULL. +\note omniWriter must be non-NULL. +@see PxVehiclePvdAttributesCreate +@see PxVehiclePvdObjectCreate +@see PxVehiclePvdPhysXRigidActorRegister +*/ +void PxVehiclePvdPhysXRigidActorWrite +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& attributeHandles, + const PxVehiclePvdObjectHandles& objectHandles, OmniPvdWriter* omniWriter); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h new file mode 100644 index 0000000..1151dee --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/pvd/PxVehiclePvdHelpers.h @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +class OmniPvdWriter; +namespace physx +{ +class PxAllocatorCallback; +namespace vehicle2 +{ +struct PxVehiclePvdAttributeHandles; +struct PxVehiclePvdObjectHandles; +} +} + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Create the attribute handles necessary to reflect vehicles in omnipvd. +\param[in] allocator is used to allocate the memory used to store the attribute handles. +\param[in] omniWriter is used to register the attribute handles with omnipvd. +\note omniWriter must be a valid pointer to an instance of OmniPvdWriter. +@see PxVehicleSimulationContext +@see PxVehiclePVDComponent +@see PxVehiclePvdAttributesRelease +*/ +PxVehiclePvdAttributeHandles* PxVehiclePvdAttributesCreate +(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter); + +/** +\brief Destory the attribute handles created by PxVehiclePvdAttributesCreate(). +\param[in] allocator must be the instance used by PxVehiclePvdObjectCreate(). +\param[in] omniWriter must point to the same OmniPvdWriter instance used for the complementary call to PxVehiclePvdAttributesCreate(). +\param[in] attributeHandles is the PxVehiclePvdAttributeHandles created by PxVehiclePvdAttributesCreate(). +@see PxVehiclePvdAttributesCreate +*/ +void PxVehiclePvdAttributesRelease +(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter, PxVehiclePvdAttributeHandles* attributeHandles); + +/** +\brief Create omnipvd objects that will be used to reflect an individual veicle in omnipvd. +\param[in] nbWheels must be greater than or equal to the number of wheels on the vehicle. +\param[in] nbAntirolls must be greater than or equal to the number of antiroll bars on the vehicle. +\param[in] maxNbPhysxMaterialFrictions must be greater than or equal to the number of PxPhysXMaterialFriction instances associated with any wheel of the vehicle. +\param[in] contextHandle is typically used to associated vehicles with a particular scene or group. +\param[in] attributeHandles is the PxVehiclePvdAttributeHandles instance returned by PxVehiclePvdAttributesCreate() +\param[in] omniWriter is used to register the attribute handles with omnipvd. +\param[in] allocator is used to allocate the memory used to store handles to the created omnipvd objects. +\note PxVehiclePvdObjectCreate() must be called after PxVehiclePvdAttributesCreate(). +@see PxVehicleAxleDescription +@see PxVehicleAntiRollForceParams +@see PxVehiclePhysXMaterialFrictionParams +@see PxVehiclePVDComponent +@see PxVehiclePvdAttributesCreate +*/ +PxVehiclePvdObjectHandles* PxVehiclePvdObjectCreate +(const PxU32 nbWheels, const PxU32 nbAntirolls, const PxU32 maxNbPhysxMaterialFrictions, + const PxU64 contextHandle, const PxVehiclePvdAttributeHandles& attributeHandles, + OmniPvdWriter* omniWriter, PxAllocatorCallback& allocator); + +/** +\brief Destroy the PxVehiclePvdObjectHandles instance created by PxVehiclePvdObjectCreate(). +\param[in] attributeHandles is the PxVehiclePvdAttributeHandles created by PxVehiclePvdAttributesCreate(). +\param[in] omniWriter is used to register the attribute handles with omnipvd. +\param[in] allocator must be the instance used by PxVehiclePvdObjectCreate(). +\param[in] objectHandles is the PxVehiclePvdObjectHandles that was created by PxVehiclePvdObjectCreate(). +*/ +void PxVehiclePvdObjectRelease +(const PxVehiclePvdAttributeHandles& attributeHandles, + OmniPvdWriter* omniWriter, PxAllocatorCallback& allocator, PxVehiclePvdObjectHandles* objectHandles); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h new file mode 100644 index 0000000..c4a9766 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyComponents.h @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "PxVehicleRigidBodyFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Forward integrate the momentum and pose of the vehicle's rigid body after applying forces and torques +from the suspension, tires and anti-roll bars. +*/ +class PxVehicleRigidBodyComponent : public PxVehicleComponent +{ +public: + + PxVehicleRigidBodyComponent() : PxVehicleComponent() {} + virtual ~PxVehicleRigidBodyComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to update the dynamic state of a rigid body. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] rigidBodyParams must be returned as a non-null pointer to a single PxVehicleRigidBodyParams instance that describes the mass and moment of + inertia of the rigid body. + \param[out] suspensionForces must be returned as a non-null pointer to an array of suspension forces and torques in the world frame. + The suspension forces and torques will be applied to the rigid body to update *rigidBodyState*. + \param[out] tireForces must be returned as a non-null pointer to an array of tire forces and torques in the world frame. + The tire forces and torques will be applied to the rigid body to update *rigidBodyState*. + \param[out] antiRollTorque may be returned an optionally non-null pointer to a single PxVehicleAntiRollTorque instance that contains the accumulated anti-roll + torque to apply to the rigid body. + \param[out] rigidBodyState imust be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that is to be forward integrated. + \note The suspensionForces array must contain an entry for each wheel listed as an active wheel in axleDescription. + \note The tireForces array must contain an entry for each wheel listed as an active wheel in axleDescription. + \note If antiRollTorque is returned as a null pointer then zero anti-roll torque will be applied to the rigid body. + */ + virtual void getDataForRigidBodyComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rigidBodyParams, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& tireForces, + const PxVehicleAntiRollTorque*& antiRollTorque, + PxVehicleRigidBodyState*& rigidBodyState) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleRigidBodyComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyParams* rigidBodyParams; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData tireForces; + const PxVehicleAntiRollTorque* antiRollTorque; + PxVehicleRigidBodyState* rigidBodyState; + + getDataForRigidBodyComponent(axleDescription, rigidBodyParams, + suspensionForces, tireForces, antiRollTorque, + rigidBodyState); + + PxVehicleRigidBodyUpdate( + *axleDescription, *rigidBodyParams, + suspensionForces, tireForces, antiRollTorque, + dt, context.gravity, + *rigidBodyState); + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h new file mode 100644 index 0000000..c1e555e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyParams; +struct PxVehicleSuspensionForce; +struct PxVehicleTireForce; +struct PxVehicleAntiRollTorque; +struct PxVehicleRigidBodyState; + +/** +\brief Forward integrate rigid body state. +\param[in] axleDescription is a description of the axles of the vehicle and the wheels on each axle. +\param[in] rigidBodyParams is a description of rigid body mass and moment of inertia. +\param[in] suspensionForces is an array of suspension forces and torques in the world frame to be applied to the rigid body. +\param[in] tireForces is an array of tire forces and torques in the world frame to be applied to the rigid body. +\param[in] antiRollTorque is an optional pointer to a single PxVehicleAntiRollTorque instance that contains the accumulated anti-roll +torque to apply to the rigid body. +\param[in] dt is the timestep of the forward integration. +\param[in] gravity is gravitational acceleration. +\param[in,out] rigidBodyState is the rigid body state that is to be updated. +\note The suspensionForces array must contain an entry for each wheel listed as an active wheel in axleDescription. +\note The tireForces array must contain an entry for each wheel listed as an active wheel in axleDescription. +\note If antiRollTorque is a null pointer then zero anti-roll torque will be applied to the rigid body. +*/ +void PxVehicleRigidBodyUpdate + (const PxVehicleAxleDescription& axleDescription, const PxVehicleRigidBodyParams& rigidBodyParams, + const PxVehicleArrayData& suspensionForces, + const PxVehicleArrayData& tireForces, + const PxVehicleAntiRollTorque* antiRollTorque, + const PxReal dt, const PxVec3& gravity, + PxVehicleRigidBodyState& rigidBodyState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h new file mode 100644 index 0000000..8fe3dea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyParams.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief The properties of the rigid body. +*/ +struct PxVehicleRigidBodyParams +{ + /** + \brief The mass of the rigid body. + + Range: (0, inf)
+ Unit: mass + */ + PxReal mass; + + /** + \brief The moment of inertia of the rigid body. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxVec3 moi; + + PX_FORCE_INLINE PxVehicleRigidBodyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleRigidBodyParams r = *this; + r.moi = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, moi).abs(); + const PxReal scale = trgScale.scale/srcScale.scale; + r.moi *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(mass > 0.0f, "PxVehicleRigidBodyParams.mass must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(moi.x > 0.0f && moi.y > 0.0f && moi.z> 0.0f, "PxVehicleRigidBodyParams.moi must be greater than zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h new file mode 100644 index 0000000..ce2b33e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/rigidBody/PxVehicleRigidBodyStates.h @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxTransform.h" +#include "foundation/PxVec3.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRigidBodyState +{ + PxTransform pose; //!< the body's pose (in world space) + PxVec3 linearVelocity; //!< the body's linear velocity (in world space) + PxVec3 angularVelocity; //!< the body's angular velocity (in world space) + PxVec3 previousLinearVelocity; //!< the previous linear velocity of the body (in world space) + PxVec3 previousAngularVelocity; //!< the previous angular velocity of the body (in world space) + PxVec3 externalForce; //!< external force (in world space) affecting the rigid body (usually excluding gravitational force) + PxVec3 externalTorque; //!< external torque (in world space) affecting the rigid body + + PX_FORCE_INLINE void setToDefault() + { + pose = PxTransform(PxIdentity); + linearVelocity = PxVec3(PxZero); + angularVelocity = PxVec3(PxZero); + externalForce = PxVec3(PxZero); + externalTorque = PxVec3(PxZero); + } + + /** + \brief Compute the vertical speed of the rigid body transformed to the world frame. + \param[in] frame describes the axes of the vehicle + */ + PX_FORCE_INLINE PxReal getVerticalSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getVrtAxis())); + } + + /** + \param[in] frame describes the axes of the vehicle + \brief Compute the lateral speed of the rigid body transformed to the world frame. + */ + PX_FORCE_INLINE PxReal getLateralSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getLatAxis())); + } + + /** + \brief Compute the longitudinal speed of the rigid body transformed to the world frame. + \param[in] frame describes the axes of the vehicle + */ + PX_FORCE_INLINE PxReal getLongitudinalSpeed(const PxVehicleFrame& frame) const + { + return linearVelocity.dot(pose.q.rotate(frame.getLngAxis())); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h new file mode 100644 index 0000000..1c4a9e2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/roadGeometry/PxVehicleRoadGeometryState.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPlane.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleRoadGeometryState +{ + PxPlane plane; //!< the plane under the wheel + PxReal friction; //!< the friction to be used by the tire model + PxVec3 velocity; //!< the velocity of the road geometry + bool hitState; //!< true if a plane is found, false if there is no plane. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleRoadGeometryState)); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h new file mode 100644 index 0000000..3b77b39 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringFunctions.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxSimpleTypes.h" + +#include "vehicle2/PxVehicleParams.h" +#include "PxVehicleSteeringParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleCommandState; + +/** +\brief Compute the yaw angle response to a steer command. +\param[in] steer is the input steer command value. +\param[in] longitudinalSpeed is the longitudinal speed of the vehicle. +\param[in] wheelId specifies the wheel to have its steer response computed. +\param[in] steerResponseParmas specifies the per wheel yaw angle response to the steer command as a nonlinear function of steer command and longitudinal speed. +\param[out] steerResponseState is the yaw angle response to the input steer command. +*/ +void PxVehicleSteerCommandResponseUpdate +(const PxReal steer, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleSteerCommandResponseParams& steerResponseParmas, + PxReal& steerResponseState); + +/** +\brief Account for Ackermann correction by modifying the per wheel steer response multipliers to engineer an asymmetric steer response across axles. +\param[in] steer is the input steer command value. +\param[in] steerResponseParmas describes the maximum response and a response multiplier per axle. +\param[in] ackermannParams is an array that describes the wheels affected by Ackerman steer correction. +\param[in,out] steerResponseStates contains the corrected per wheel steer response multipliers that take account of Ackermann steer correction. +*/ +void PxVehicleAckermannSteerUpdate +(const PxReal steer, const PxVehicleSteerCommandResponseParams& steerResponseParmas, + const PxVehicleSizedArrayData& ackermannParams, + PxVehicleArrayData& steerResponseStates); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringParams.h new file mode 100644 index 0000000..f40cd14 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/steering/PxVehicleSteeringParams.h @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleFrame; +struct PxVehicleScale; + +/** +\brief Distribute a steer response to the wheels of a vehicle. +\note The steer angle applied to each wheel on the ith wheel is steerCommand * maxResponse * wheelResponseMultipliers[i]. +\note A typical use case is to set maxResponse to be the vehicle's maximum achievable steer angle +that occurs when the steer command is equal to 1.0. The array wheelResponseMultipliers[i] would then be used +to specify the maximum achievable steer angle per wheel as a fractional multiplier of the vehicle's maximum achievable steer angle. +*/ +struct PxVehicleSteerCommandResponseParams : public PxVehicleCommandResponseParams +{ + PX_FORCE_INLINE PxVehicleSteerCommandResponseParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!axleDesc.isValid()) + return false; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + PX_CHECK_AND_RETURN_VAL(PxAbs(maxResponse*wheelResponseMultipliers[axleDesc.wheelIdsInAxleOrder[i]]) <= PxPi, + "PxVehicleSteerCommandResponseParams.maxResponse*PxVehicleSteerCommandResponseParams.wheelResponseMultipliers[i] must be in range [-Pi, Pi]", false); + } + return true; + } +}; + +/** +\brief A description of a single axle that is to be affected by Ackermann steer correction. +*/ +struct PxVehicleAckermannParams +{ + PxU32 wheelIds[2]; //!< wheelIds[0] is the id of the wheel that is negative along the lateral axis, wheelIds[1] is the wheel id that is positive along the lateral axis. + PxReal wheelBase; //!< wheelBase is the longitudinal distance between the axle that is affected by Ackermann correction and a reference axle. + PxReal trackWidth; //!< trackWidth is the width of the axle specified by #wheelIds + PxReal strength; //!< is the strength of the correction with 0 denoting no correction and 1 denoting perfect correction. + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[0] < axleDesc.getNbWheels(), "PxVehicleAckermannParams.wheelIds[0] must be valid wheel", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[1] < axleDesc.getNbWheels(), "PxVehicleAckermannParams.wheelIds[1] must be a valid wheel", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelIds[0] != wheelIds[1], "PxVehicleAckermannParams.wheelIds[0] and PxVehicleAckermannParams.wheelIds[1] must reference two different wheels", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || wheelBase > 0.0f, "PxVehicleAckermannParams.wheelBase must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(0.0f == strength || trackWidth > 0.0f, "PxVehicleAckermannParams.trackWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(strength >= 0.0f && strength <= 1.0f, "PxVehicleAckermannParams.strength must be in range [0,1]", false); + PX_UNUSED(axleDesc); + return true; + } + + PX_FORCE_INLINE PxVehicleAckermannParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleAckermannParams r = *this; + const PxReal scale = trgScale.scale / srcScale.scale; + r.wheelBase *= scale; + r.trackWidth *= scale; + return r; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h new file mode 100644 index 0000000..fd6201f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionComponents.h @@ -0,0 +1,328 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandStates.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "PxVehicleSuspensionParams.h" +#include "PxVehicleSuspensionStates.h" +#include "PxVehicleSuspensionFunctions.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +class PxVehicleSuspensionComponent : public PxVehicleComponent +{ +public: + + PxVehicleSuspensionComponent() : PxVehicleComponent() {} + virtual ~PxVehicleSuspensionComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to compute the suspension state and the forces/torques that arise from the suspension state. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] rigidBodyParams must be returned as a a non-null pointer to a single PxVehicleRigidBodyParams instance that describes the mass and moment + of inertia of the vehicle's rigid body. + \param[out] suspensionStateCalculationParams must be returned as a non-null pointer to a single PxVehicleSuspensionStateCalculationParams instance + that describes the jounce computation type etc. + \param[out] steerResponseStates must be returned as a non-null pointer to a single PxVehicleSteerCommandResponseStates instance that describes the steer + state of the wheels. + \param[out] rigidBodyState must be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that describes the pose and momentum of + the vehicle's rigid body. + \param[out] wheelParams must be set to a non-null pointer to an array of PxVehicleWheelParams containing per-wheel parameters for each wheel + referenced by axleDescription. + \param[out] suspensionParams must be set to a non-null pointer to an array of PxVehicleSuspensionParams containing per-wheel parameters for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceParams must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceParams containing per-wheel + parameters for each wheel referenced by axleDescription. + \param[out] suspensionForceParams must be set to a non-null pointer to an array of PxVehicleSuspensionForceParams containing per-wheel parameters + for each wheel referenced by axleDescription. + \param[out] antiRollForceParams is optionally returned as a non-null pointer to an array of PxVehicleAntiRollForceParams with each element in the array + describing a unique anti-roll bar connecting a pair of wheels. + \param[out] wheelRoadGeomStates must be set to non-null pointer to an array of PxVehicleRoadGeometryState containing per-wheel road geometry for + each wheel referenced by axleDescription. + \param[out] suspensionStates must be set to a non-null pointer to an array of PxVehicleSuspensionState containing per-wheel suspension state for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceStates must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceState containing per-wheel suspension + compliance state for each wheel referenced by axleDescription. + \param[out] suspensionForces must be set to a non-null pointer to an array of PxVehicleSuspensionForce containing per-wheel suspension forces for each + wheel referenced by axleDescription. + \param[out] antiRollTorque is optionally returned as a non-null pointer to a single PxVehicleAntiRollTorque instance that will store the accumulated anti-roll + torque to be applied to the vheicle's rigid body. + \note antiRollForceParams and antiRollTorque should be returned either both non-NULL or both NULL. + */ + virtual void getDataForSuspensionComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleRigidBodyParams*& rigidBodyParams, + const PxVehicleSuspensionStateCalculationParams*& suspensionStateCalculationParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionComplianceParams, + PxVehicleArrayData& suspensionForceParams, + PxVehicleSizedArrayData& antiRollForceParams, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleAntiRollTorque*& antiRollTorque) = 0; + + /** + \brief Update the suspension state and suspension compliance state and use those updated states to compute suspension and anti-roll forces/torques + to apply to the vehicle's rigid body. + \param[in] dt is the simulation time that has passed since the last call to PxVehicleSuspensionComponent::update() + \param[in] context describes a variety of global simulation constants such as frame and scale of the simulation and the gravitational acceleration + of the simulated environment. + \note The suspension and anti-roll forces/torques are computed in the world frame. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleSuspensionComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleRigidBodyParams* rigidBodyParams; + const PxVehicleSuspensionStateCalculationParams* suspensionStateCalculationParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionComplianceParams; + PxVehicleArrayData suspensionForceParams; + PxVehicleSizedArrayData antiRollForceParams; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleAntiRollTorque* antiRollTorque; + + getDataForSuspensionComponent(axleDescription, rigidBodyParams, suspensionStateCalculationParams, + steerResponseStates, rigidBodyState, + wheelParams, suspensionParams, + suspensionComplianceParams, suspensionForceParams, antiRollForceParams, + wheelRoadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, antiRollTorque); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Update the suspension state (jounce, jounce speed) + PxVehicleSuspensionStateUpdate( + wheelParams[wheelId], suspensionParams[wheelId], *suspensionStateCalculationParams, + suspensionForceParams[wheelId].stiffness, suspensionForceParams[wheelId].damping, + steerResponseStates[wheelId], wheelRoadGeomStates[wheelId], + *rigidBodyState, + dt, context.frame, context.gravity, + suspensionStates[wheelId]); + + //Update the compliance from the suspension state. + PxVehicleSuspensionComplianceUpdate( + suspensionParams[wheelId], suspensionComplianceParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId]); + + //Compute the suspension force from the suspension and compliance states. + PxVehicleSuspensionForceUpdate( + suspensionParams[wheelId], suspensionForceParams[wheelId], + wheelRoadGeomStates[wheelId], suspensionStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.gravity, rigidBodyParams->mass, + suspensionForces[wheelId]); + } + + if (antiRollForceParams.size>0 && antiRollTorque) + { + PxVehicleAntiRollForceUpdate( + suspensionParams, antiRollForceParams, + suspensionStates.getConst(), suspensionComplianceStates.getConst(), *rigidBodyState, + *antiRollTorque); + } + + return true; + } +}; + +/** + * @deprecated + */ +class PX_DEPRECATED PxVehicleLegacySuspensionComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacySuspensionComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacySuspensionComponent() {} + + /** + \brief Retrieve pointers to the parameter and state data required to compute the suspension state and the forces/torques that arise from the suspension state. + \param[out] axleDescription must be returned as a non-null pointer to a single PxVehicleAxleDescription instance that describes the wheels and axles + of the vehicle. + \param[out] suspensionStateCalculationParams must be returned as a non-null pointer to a single PxVehicleSuspensionStateCalculationParams instance + that describes the jounce computation type etc. + \param[out] steerResponseStates must be returned as a non-null pointer to a single PxVehicleSteerCommandResponseStates instance that describes the steer + state of the wheels. + \param[out] rigidBodyState must be returned as a non-null pointer to a single PxVehicleRigidBodyState instance that describes the pose and momentum of + the vehicle's rigid body. + \param[out] wheelParams must be set to a non-null pointer to an array of PxVehicleWheelParams containing per-wheel parameters for each wheel + referenced by axleDescription. + \param[out] suspensionParams must be set to a non-null pointer to an array of PxVehicleSuspensionParams containing per-wheel parameters for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceParams must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceParams containing per-wheel + parameters for each wheel referenced by axleDescription. + \param[out] suspensionForceParams must be set to a non-null pointer to an array of PxVehicleSuspensionForceLegacyParams containing per-wheel parameters + for each wheel referenced by axleDescription. + \param[out] antiRollForceParams is optionally returned as a non-null pointer to an array of PxVehicleAntiRollForceParams with each element in the array + describing a unique anti-roll bar connecting a pair of wheels. + \param[out] wheelRoadGeomStates must be set to non-null pointer to an array of PxVehicleRoadGeometryState containing per-wheel road geometry for + each wheel referenced by axleDescription. + \param[out] suspensionStates must be set to a non-null pointer to an array of PxVehicleSuspensionState containing per-wheel suspension state for each + wheel referenced by axleDescription. + \param[out] suspensionComplianceStates must be set to a non-null pointer to an array of PxVehicleSuspensionComplianceState containing per-wheel suspension + compliance state for each wheel referenced by axleDescription. + \param[out] suspensionForces must be set to a non-null pointer to an array of PxVehicleSuspensionForce containing per-wheel suspension forces for each + wheel referenced by axleDescription. + \param[out] antiRollTorque is optionally returned as a non-null pointer to a single PxVehicleAntiRollTorque instance that will store the accumulated anti-roll + torque to be applied to the vheicle's rigid body. + \note antiRollForceParams and antiRollTorque should be returned either both non-NULL or both NULL. + */ + virtual void getDataForLegacySuspensionComponent( + const PxVehicleAxleDescription*& axleDescription, + const PxVehicleSuspensionStateCalculationParams*& suspensionStateCalculationParams, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& suspensionComplianceParams, + PxVehicleArrayData& suspensionForceParams, + PxVehicleSizedArrayData& antiRollForceParams, + PxVehicleArrayData& wheelRoadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleAntiRollTorque*& antiRollTorque) = 0; + + /** + \brief Update the suspension state and suspension compliance state and use those updated states to compute suspension and anti-roll forces/torques + to apply to the vehicle's rigid body. + \param[in] dt is the simulation time that has passed since the last call to PxVehicleSuspensionComponent::update() + \param[in] context describes a variety of global simulation constants such as frame and scale of the simulation and the gravitational acceleration + of the simulated environment. + \note The suspension and anti-roll forces are computed in the world frame. + \note PxVehicleLegacySuspensionComponent::update() implements legacy suspension behaviour. + */ + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleLegacySuspensionComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + const PxVehicleSuspensionStateCalculationParams* suspensionStateCalculationParams; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData suspensionComplianceParams; + PxVehicleArrayData suspensionForceParams; + PxVehicleSizedArrayData antiRollForceParams; + PxVehicleArrayData wheelRoadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleAntiRollTorque* antiRollTorque; + + getDataForLegacySuspensionComponent(axleDescription, suspensionStateCalculationParams, + steerResponseStates, rigidBodyState, wheelParams, + suspensionParams, suspensionComplianceParams, + suspensionForceParams, antiRollForceParams, + wheelRoadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, antiRollTorque); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Update the suspension state (jounce, jounce speed) + PxVehicleSuspensionStateUpdate( + wheelParams[wheelId], suspensionParams[wheelId], *suspensionStateCalculationParams, + suspensionForceParams[wheelId].stiffness, suspensionForceParams[wheelId].damping, + steerResponseStates[wheelId], wheelRoadGeomStates[wheelId], *rigidBodyState, + dt, context.frame, context.gravity, + suspensionStates[wheelId]); + + //Update the compliance from the suspension state. + PxVehicleSuspensionComplianceUpdate( + suspensionParams[wheelId], suspensionComplianceParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId]); + + //Compute the suspension force from the suspension and compliance states. + PxVehicleSuspensionLegacyForceUpdate( + suspensionParams[wheelId], suspensionForceParams[wheelId], + wheelRoadGeomStates[wheelId], suspensionStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.gravity, + suspensionForces[wheelId]); + } + + if (antiRollForceParams.size>0 && antiRollTorque) + { + PxVehicleAntiRollForceUpdate( + suspensionParams, antiRollForceParams, + suspensionStates.getConst(), suspensionComplianceStates.getConst(), *rigidBodyState, + *antiRollTorque); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h new file mode 100644 index 0000000..5e63350 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionFunctions.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleSuspensionParams; +struct PxVehicleSuspensionStateCalculationParams; +struct PxVehicleRoadGeometryState; +struct PxVehicleRigidBodyState; +struct PxVehicleSuspensionState; +struct PxVehicleSuspensionComplianceParams; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleSuspensionForceParams; +struct PxVehicleSuspensionForce; +struct PxVehicleSuspensionForceLegacyParams; +struct PxVehicleAntiRollForceParams; +struct PxVehicleAntiRollTorque; + +/** +\brief Compute the suspension compression and compression speed for a single suspension. +\param[in] wheelParams is a description of the radius and half-width of the wheel on the suspension. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionStateCalcParams specifies whether to compute the suspension compression by either +raycasting or sweeping against the plane of the road geometry under the wheel. +\param[in] suspensionStiffness is the stiffness of the suspension +\param[in] suspensionDamping is the damping rate of the suspension. +or whether to apply a limit to the expansion speed so that the wheel may not reach the ground. +\param[in] steerAngle is the yaw angle (in radians) of the wheel. +\param[in] roadGeometryState describes the plane under the wheel. +\param[in] rigidBodyState describes the pose of the rigid body. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleSuspensionStateUpdate +\param[in] frame describes the longitudinal, lateral and vertical axes of the vehicle. +\param[in] gravity is the gravitational acceleration that acts on the suspension sprung mass. +\param[in,out] suspState is the compression (jounce) and compression speed of the suspension. +*/ +void PxVehicleSuspensionStateUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, const PxVehicleSuspensionStateCalculationParams& suspensionStateCalcParams, + const PxReal suspensionStiffness, const PxReal suspensionDamping, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, const PxVehicleFrame& frame, const PxVec3& gravity, + PxVehicleSuspensionState& suspState); + +/** +\brief Compute the toe, camber and force application points that are affected by suspension compression. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] complianceParams describes how toe, camber and force application points are affected by suspension compression. +\param[in] suspensionState describes the current suspension compression. +\param[in] complianceState is the computed toe, camber and force application points. +*/ +void PxVehicleSuspensionComplianceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionComplianceParams& complianceParams, + const PxVehicleSuspensionState& suspensionState, + PxVehicleSuspensionComplianceState& complianceState); + +/** +\brief Compute the suspension force and torque arising from suspension compression and speed. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionForceParams describes the conversion of suspension state to suspension force. +\param[in] roadGeometryState describes the plane under the wheel of the suspension. +\param[in] suspensionState is the current compression state of the suspension. +\param[in] complianceState is the current compliance state of the suspension. +\param[in] rigidBodyState describes the current pose of the rigid body. +\param[in] gravity is the gravitational acceleration. +\param[in] vehicleMass is the rigid body mass. +\param[out] suspensionForce is the force and torque to apply to the rigid body arising from the suspension state. +*/ +void PxVehicleSuspensionForceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionForceParams& suspensionForceParams, + const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionState& suspensionState, + const PxVehicleSuspensionComplianceState& complianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, const PxReal vehicleMass, + PxVehicleSuspensionForce& suspensionForce); + + +/** +\brief Compute the suspension force and torque arising from suspension compression and speed. +\param[in] suspensionParams is a description of the suspension and wheel frames. +\param[in] suspensionForceParams describes the conversion of suspension state to suspension force. +\param[in] roadGeometryState describes the plane under the wheel of the suspension. +\param[in] suspensionState is the current compression state of the suspension. +\param[in] complianceState is the current compliance state of the suspension. +\param[in] rigidBodyState describes the current pose of the rigid body. +\param[in] gravity is the gravitational acceleration. +\param[out] suspensionForce is the force and torque to apply to the rigid body arising from the suspension state. +\note PxVehicleSuspensionLegacyForceUpdate implements the legacy force computation of PhysX 5.0 and earlier. +@deprecated +*/ +PX_DEPRECATED void PxVehicleSuspensionLegacyForceUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionForceLegacyParams& suspensionForceParams, + const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionState& suspensionState, + const PxVehicleSuspensionComplianceState& complianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, + PxVehicleSuspensionForce& suspensionForce); + +/** +\brief Compute the accumulated anti-roll torque to apply to the vehicle's rigid body. +\param[in] suspensionParams The suspension parameters for each wheel. +\param[in] antiRollParams describes the wheel pairs connected by anti-roll bars and the strength of each anti-roll bar. +\param[in] suspensionStates The suspension states for each wheel. +\param[in] complianceStates The suspension compliance states for each wheel. +\param[in] rigidBodyState describes the pose and momentum of the vehicle's rigid body in the world frame. +\param[in] antiRollTorque is the accumulated anti-roll torque that is computed by iterating over all anti-roll bars +describes in *antiRollParams*. +\note suspensionParams must contain an entry for each wheel index referenced by *antiRollParams*. +\note suspensionStates must contain an entry for each wheel index referenced by *antiRollParams*. +\note complianceStates must contain an entry for each wheel index referenced by *antiRollParams*. +\note antiRollTorque is expressed in the world frame. +*/ +void PxVehicleAntiRollForceUpdate +(const PxVehicleArrayData& suspensionParams, + const PxVehicleSizedArrayData& antiRollParams, + const PxVehicleArrayData& suspensionStates, + const PxVehicleArrayData& complianceStates, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleAntiRollTorque& antiRollTorque); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h new file mode 100644 index 0000000..648e739 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionHelpers.h @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ + + */ +#include "foundation/PxTransform.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" + +#include "PxVehicleSuspensionParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute suspension travel direction in the world frame. +\param[in] suspensionParams is a description of the suspension frame. +\param[in] rigidBodyPose is the current pose of the vehicle's rigid body. +\return The return value is the suspension travel direction in the world frame. +\note The suspension travel direction is used to perform queries against the road geometry. +*/ +PX_FORCE_INLINE PxVec3 PxVehicleComputeSuspensionDirection(const PxVehicleSuspensionParams& suspensionParams, const PxTransform& rigidBodyPose) +{ + const PxVec3 suspDir = rigidBodyPose.rotate(suspensionParams.suspensionTravelDir); + return suspDir; +} + +/** +\brief Compute the start pose of a suspension query. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] suspensionParams is a description of the suspension frame. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPoseForSuspensionQuery(const PxVehicleFrame& frame, const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxTransform& rigidBodyPose) +{ + //Compute the wheel pose with zero travel from attachment point, zero compliance, + //zero wheel pitch (ignore due to radial symmetry). + //Zero travel from attachment point (we want the wheel pose at the top of the suspension, i.e., at max compression) + PxVehicleSuspensionState suspState; + suspState.setToDefault(); + //Compute the wheel pose. + const PxTransform wheelPose = PxVehicleComputeWheelPose(frame, suspensionParams, suspState, 0.0f, 0.0f, steerAngle, rigidBodyPose, + 0.0f); + + return wheelPose; +} + +/** +\brief Compute the start point, direction and length of a suspension scene raycast. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] wheelParams describes the radius and halfwidth of the wheel. +\param[in] suspensionParams describes the suspension frame and the maximum suspension travel. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[out] start is the starting point of the raycast in the world frame. +\param[out] dir is the direction of the raycast in the world frame. +\param[out] dist is the length of the raycast. +\note start, dir and dist together describe a raycast that begins at the top of wheel at maximum compression +and ends at the bottom of wheel at maximum droop. +*/ +PX_FORCE_INLINE void PxVehicleComputeSuspensionRaycast +(const PxVehicleFrame& frame, const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxF32 steerAngle, const PxTransform& rigidBodyPose, + PxVec3& start, PxVec3& dir, PxReal& dist) +{ + const PxTransform wheelPose = PxVehicleComputeWheelPoseForSuspensionQuery(frame, suspensionParams, steerAngle, rigidBodyPose); + + //Raycast from top of wheel at max compression to bottom of wheel at max droop. + dir = PxVehicleComputeSuspensionDirection(suspensionParams, rigidBodyPose); + start = wheelPose.p - dir * wheelParams.radius; + dist = suspensionParams.suspensionTravelDist + 2.0f*wheelParams.radius; +} + +/** +\brief Compute the start pose, direction and length of a suspension scene sweep. +\param[in] frame is a description of the longitudinal, lateral and vertical axes. +\param[in] suspensionParams describes the suspension frame and the maximum suspension travel. +\param[in] steerAngle is the yaw angle of the wheel in radians. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[out] start is the start pose of the sweep in the world frame. +\param[out] dir is the direction of the sweep in the world frame. +\param[out] dist is the length of the sweep. +\note start, dir and dist together describe a sweep that begins with the wheel placed at maximum +compression and ends at the maximum droop pose. +*/ +PX_FORCE_INLINE void PxVehicleComputeSuspensionSweep +(const PxVehicleFrame& frame, const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxTransform& rigidBodyPose, + PxTransform& start, PxVec3& dir, PxReal& dist) +{ + start = PxVehicleComputeWheelPoseForSuspensionQuery(frame, suspensionParams, steerAngle, rigidBodyPose); + dir = PxVehicleComputeSuspensionDirection(suspensionParams, rigidBodyPose); + dist = suspensionParams.suspensionTravelDist; +} + + +/** +\brief Compute the sprung masses of the suspension springs given (i) the number of sprung masses, +(ii) coordinates of the sprung masses in the rigid body frame, (iii) the center of mass offset of the rigid body, (iv) the +total mass of the rigid body, and (v) the direction of gravity +\param[in] nbSprungMasses is the number of sprung masses of the vehicle. This value corresponds to the number of wheels on the vehicle. +\param[in] sprungMassCoordinates are the coordinates of the sprung masses in the rigid body frame. The array sprungMassCoordinates must be of +length nbSprungMasses or greater. +\param[in] totalMass is the total mass of all the sprung masses. +\param[in] gravityDirection describes the direction of gravitational acceleration. +\param[out] sprungMasses are the masses to set in the associated suspension data with PxVehicleSuspensionData::mSprungMass. The sprungMasses array must be of length +nbSprungMasses or greater. Each element in the sprungMasses array corresponds to the suspension located at the same array element in sprungMassCoordinates. +The center of mass of the masses in sprungMasses with the coordinates in sprungMassCoordinates satisfy the specified centerOfMass. +\return True if the sprung masses were successfully computed, false if the sprung masses were not successfully computed. +*/ +bool PxVehicleComputeSprungMasses(const PxU32 nbSprungMasses, const PxVec3* sprungMassCoordinates, const PxReal totalMass, const PxVehicleAxes::Enum gravityDirection, PxReal* sprungMasses); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h new file mode 100644 index 0000000..a58a8d7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionParams.h @@ -0,0 +1,414 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + + +#include "foundation/PxTransform.h" +#include "foundation/PxFoundation.h" + +#include "common/PxCoreUtilityTypes.h" + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams +{ + /** + \brief suspensionAttachment specifies the wheel pose at maximum compression. + \note suspensionAttachment is specified in the frame of the rigid body. + \note camber, steer and toe angles are all applied in the suspension frame. + */ + PxTransform suspensionAttachment; + + /** + \brief suspensionTravelDir specifies the direction of suspension travel. + \note suspensionTravelDir is specified in the frame of the rigid body. + */ + PxVec3 suspensionTravelDir; + + /** + \brief suspensionTravelDist is the maximum distance that the suspenson can elongate along #suspensionTravelDir + from the pose specified by #suspensionAttachment. + \note The position suspensionAttachment.p + #suspensionTravelDir*#suspensionTravelDist corresponds to the + the suspension at maximum droop in the rigid body frame. + */ + PxReal suspensionTravelDist; + + /** + \brief wheelAttachment is the pose of the wheel in the suspension frame. + \note The rotation angle around the wheel's lateral axis is applied in the wheel attachment frame. + */ + PxTransform wheelAttachment; + + + PX_FORCE_INLINE PxVehicleSuspensionParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PxVehicleSuspensionParams r = *this; + r.suspensionAttachment= PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, suspensionAttachment); + r.suspensionTravelDir = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, suspensionTravelDir); + r.suspensionTravelDist *= (trgScale.scale/srcScale.scale); + r.wheelAttachment = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, srcScale, trgScale, wheelAttachment); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(suspensionAttachment.isValid(), "PxVehicleSuspensionParams.suspensionAttachment must be a valid transform", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDir.isFinite(), "PxVehicleSuspensionParams.suspensionTravelDir must be a valid vector", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDir.isNormalized(), "PxVehicleSuspensionParams.suspensionTravelDir must be a unit vector", false); + PX_CHECK_AND_RETURN_VAL(suspensionTravelDist > 0.0f, "PxVehicleSuspensionParams.suspensionTravelDist must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(wheelAttachment.isValid(), "PxVehicleSuspensionParams.wheelAttachment must be a valid transform", false); + return true; + } +}; + +struct PxVehicleSuspensionJounceCalculationType +{ + enum Enum + { + eRAYCAST, //!< The jounce is calculated using a raycast against the plane of the road geometry state + eSWEEP, //!< The jounce is calculated by sweeping a cylinder against the plane of the road geometry state + eMAX_NB + }; +}; + +struct PxVehicleSuspensionStateCalculationParams +{ + PxVehicleSuspensionJounceCalculationType::Enum suspensionJounceCalculationType; + + /** + \brief Limit the suspension expansion dynamics. + + If a hit with the ground is detected, the suspension jounce will be set such that the wheel + is placed on the ground. This can result in large changes to jounce within a single + simulation frame, if the ground surface has high frequency or if the simulation time step + is large. As a result, large damping forces can evolve and cause undesired behavior. If this + parameter is set to true, the suspension expansion speed will be limited to what can be + achieved given the time step, suspension stiffness etc. As a consequence, handling of the + vehicle will be affected as the wheel might loose contact with the ground more easily. + */ + bool limitSuspensionExpansionVelocity; + + PX_FORCE_INLINE PxVehicleSuspensionStateCalculationParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + return true; + } +}; + +/** +\brief Compliance describes how toe and camber angle and force application points are affected by suspension compression. +\note Each compliance term is in the form of a graph with up to 3 points. +\note Each point in the graph has form (jounce/suspensionTravelDist, complianceValue). +\note The sequence of points must respresent monotonically increasing values of jounce. +\note The compliance value can be computed by linear interpolation. +\note If any graph has zero points in it, a value of 0.0 is used for the compliance value. +\note If any graph has 1 point in it, the compliance value of that point is used directly. +*/ +struct PxVehicleSuspensionComplianceParams +{ + /** + \brief A graph of toe angle against jounce/suspensionTravelDist with the toe angle expressed in radians. + \note The toe angle is applied in the suspension frame. + */ + PxVehicleFixedSizeLookupTable wheelToeAngle; + + /** + \brief A graph of camber angle against jounce/suspensionTravelDist with the camber angle expressed in radians. + \note The camber angle is applied in the suspension frame. + */ + PxVehicleFixedSizeLookupTable wheelCamberAngle; + + /** + \brief Suspension forces are applied at an offset from the suspension frame. suspForceAppPoint + specifies the (X, Y, Z) components of that offset as a function of jounce/suspensionTravelDist. + */ + PxVehicleFixedSizeLookupTable suspForceAppPoint; + + /** + \brief Tire forces are applied at an offset from the suspension frame. tireForceAppPoint + specifies the (X, Y, Z) components of that offset as a function of jounce/suspensionTravelDist. + */ + PxVehicleFixedSizeLookupTable tireForceAppPoint; + + PX_FORCE_INLINE PxVehicleSuspensionComplianceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleSuspensionComplianceParams r = *this; + + const PxReal scale = trgScale.scale / srcScale.scale; + for (PxU32 i = 0; i < r.suspForceAppPoint.nbDataPairs; i++) + { + r.suspForceAppPoint.yVals[i] = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, suspForceAppPoint.yVals[i]); + r.suspForceAppPoint.yVals[i] *= scale; + } + for (PxU32 i = 0; i < r.tireForceAppPoint.nbDataPairs; i++) + { + r.tireForceAppPoint.yVals[i] = PxVehicleTransformFrameToFrame(srcFrame, trgFrame, tireForceAppPoint.yVals[i]); + r.tireForceAppPoint.yVals[i] *= scale; + } + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.isValid(), "PxVehicleSuspensionComplianceParams.wheelToeAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.isValid(), "PxVehicleSuspensionComplianceParams.wheelCamberAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(suspForceAppPoint.isValid(), "PxVehicleSuspensionComplianceParams.wheelToeAngle is invalid", false); + PX_CHECK_AND_RETURN_VAL(tireForceAppPoint.isValid(), "PxVehicleSuspensionComplianceParams.wheelCamberAngle is invalid", false); + + for (PxU32 i = 0; i < wheelToeAngle.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.xVals[i] >= 0.0f && wheelToeAngle.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.wheelToeAngle must be an array of points (x,y) with x in range [0, 1]", false); + PX_CHECK_AND_RETURN_VAL(wheelToeAngle.yVals[i] >= -PxPi && wheelToeAngle.yVals[i] <= PxPi, "PxVehicleSuspensionComplianceParams.wheelToeAngle must be an array of points (x,y) with y in range [-Pi, Pi]", false); + } + for (PxU32 i = 0; i < wheelCamberAngle.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.xVals[i] >= 0.0f && wheelCamberAngle.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.wheelCamberAngle must be an array of points (x,y) with x in range [0, 1]", false); + PX_CHECK_AND_RETURN_VAL(wheelCamberAngle.yVals[i] >= -PxPi && wheelCamberAngle.yVals[i] <= PxPi, "PxVehicleSuspensionComplianceParams.wheelCamberAngle must be an array of points (x,y) with y in range [-Pi, Pi]", false); + } + + for (PxU32 i = 0; i < suspForceAppPoint.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(suspForceAppPoint.xVals[i] >= 0.0f && suspForceAppPoint.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.suspForceAppPoint[0] must be an array of points (x,y) with x in range [0, 1]", false); + } + for (PxU32 i = 0; i < tireForceAppPoint.nbDataPairs; i++) + { + PX_CHECK_AND_RETURN_VAL(tireForceAppPoint.xVals[i] >= 0.0f && tireForceAppPoint.xVals[i] <= 1.0f, "PxVehicleSuspensionComplianceParams.tireForceAppPoint[0] must be an array of points (x,y) with x in range [0, 1]", false); + } + return true; + } +}; + +/** +\brief Suspension force is computed by converting suspenson state to suspension force under the assumption of a linear spring. +@see PxVehicleSuspensionForceUpdate +*/ +struct PxVehicleSuspensionForceParams +{ + /** + \brief Spring strength of suspension. + + Range: (0, inf)
+ Unit: mass / (time^2) + */ + PxReal stiffness; + + /** + \brief Spring damper rate of suspension. + + Range: [0, inf)
+ Unit: mass / time + */ + PxReal damping; + + /** + \brief Part of the vehicle mass that is supported by the suspension spring. + + Range: (0, inf)
+ Unit: mass + */ + PxReal sprungMass; + + PX_FORCE_INLINE PxVehicleSuspensionForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(stiffness > 0.0f, "PxVehicleSuspensionForceParams.stiffness must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleSuspensionForceParams.damping must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(sprungMass > 0.0f, "PxVehicleSuspensionForceParams.sprungMass must be greater than zero", false); + return true; + } +}; + +/** +\brief Suspension force is computed by converting suspenson state to suspension force under the assumption of a linear spring. +@see PxVehicleSuspensionLegacyForceUpdate +@deprecated +*/ +struct PX_DEPRECATED PxVehicleSuspensionForceLegacyParams +{ + /** + \brief Spring strength of suspension. + + Range: (0, inf)
+ Unit: mass / (time^2) + */ + PxReal stiffness; + + /** + \brief Spring damper rate of suspension. + + Range: [0, inf)
+ Unit: mass / time + */ + PxReal damping; + + /** + \brief The suspension compression that balances the gravitational force acting on the sprung mass. + + Range: (0, inf)
+ Unit: length + */ + PxReal restDistance; + + /** + \brief The mass supported by the suspension spring. + + Range: (0, inf)
+ Unit: mass + */ + PxReal sprungMass; + + PX_FORCE_INLINE PxVehicleSuspensionForceLegacyParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleSuspensionForceLegacyParams r = *this; + r.restDistance *= (trgScale.scale / srcScale.scale); + return *this; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(stiffness > 0.0f, "PxVehicleSuspensionForceLegacyParams.stiffness must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(damping >= 0.0f, "PxVehicleSuspensionForceLegacyParams.damping must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(restDistance > 0.0f, "PxVehicleSuspensionForceLegacyParams.restDistance must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(sprungMass > 0.0f, "PxVehicleSuspensionForceLegacyParams.sprungMass must be greater than zero", false); + return true; + } + +}; + +/** +\brief The purpose of the anti-roll bar is to generate a torque to apply to the vehicle's rigid body that will reduce the jounce difference arising +between any pair of chosen wheels. If the chosen wheels share an axle, the anti-roll bar will attempt to reduce the roll angle of the vehicle's rigid body. +Alternatively, if the chosen wheels are the front and rear wheels along one side of the vehicle, the anti-roll bar will attempt to reduce the pitch angle of the +vehicle's rigid body. +*/ +struct PxVehicleAntiRollForceParams +{ + /* + \brief The anti-roll bar connects two wheels with indices wheel0 and wheel1 + \note wheel0 and wheel1 may be chosen to have the effect of an anti-dive bar or to have the effect of an anti-roll bar. + */ + PxU32 wheel0; + + /* + \brief The anti-roll bar connects two wheels with indices wheel0 and wheel1 + \note wheel0 and wheel1 may be chosen to have the effect of an anti-dive bar or to have the effect of an anti-roll bar. + */ + PxU32 wheel1; + + /* + \brief The linear stiffness of the anti-roll bar. + \note A positive stiffness will work to reduce the discrepancy in jounce between wheel0 and wheel1. + \note A negative stiffness will work to increase the discrepancy in jounce between wheel0 and wheel1. + + Unit: mass / (time^2) + */ + PxReal stiffness; + + PX_FORCE_INLINE PxVehicleAntiRollForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PX_UNUSED(srcScale); + PX_UNUSED(trgScale); + return *this; + } + + PX_FORCE_INLINE bool isValid(const PxVehicleAxleDescription& axleDesc) const + { + if (!PxIsFinite(stiffness)) + return false; + if (wheel0 == wheel1) + return false; + + //Check that each wheel id is a valid wheel. + const PxU32 wheelIds[2] = { wheel0, wheel1 }; + for (PxU32 k = 0; k < 2; k++) + { + const PxU32 wheelToFind = wheelIds[k]; + bool foundWheelInAxleDescription = false; + for (PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheel = axleDesc.wheelIdsInAxleOrder[i]; + if (wheel == wheelToFind) + { + foundWheelInAxleDescription = true; + } + } + if (!foundWheelInAxleDescription) + return false; + } + + return true; + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h new file mode 100644 index 0000000..af916c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/suspension/PxVehicleSuspensionStates.h @@ -0,0 +1,189 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +#define PX_VEHICLE_UNSPECIFIED_JOUNCE PX_MAX_F32 +#define PX_VEHICLE_UNSPECIFIED_SEPARATION PX_MAX_F32 + +/** + +*/ +struct PxVehicleSuspensionState +{ + /** + \brief jounce is the distance from maximum droop. + \note jounce is positive semi-definite + \note A value of 0.0 represents the suspension at maximum droop and zero suspension force. + \note A value of suspensionTravelDist represents the suspension at maximum compression. + \note jounce is clamped in range [0, suspensionTravelDist]. + */ + PxReal jounce; + + /** + \brief jounceSpeed is the rate of change of jounce. + */ + PxReal jounceSpeed; + + /** + \brief separation holds extra information about the contact state of the wheel with the ground. + + If the suspension travel range is enough to place the wheel on the ground, then separation will be 0. + If separation holds a negative value, then the wheel penetrates into the ground at maximum compression + as well as maximum droop. The suspension would need to go beyond maximum compression (ground normal + pointing in opposite direction of suspension) or beyond maximum droop (ground normal pointing in same + direction as suspension) to place the wheel on the ground. In that case the separation value defines + how much the wheel penetrates into the ground along the ground plane normal. This penetration may be + resolved by using a constraint that simulates the effect of a bump stop. + If separation holds a positive value, then the wheel does not penetrate the ground at maximum droop + but can not touch the ground because the suspension would need to expand beyond max droop to reach it + or because the suspension could not expand fast enough to reach the ground. + */ + PxReal separation; + + PX_FORCE_INLINE void setToDefault(const PxReal _jounce = PX_VEHICLE_UNSPECIFIED_JOUNCE, + const PxReal _separation = PX_VEHICLE_UNSPECIFIED_SEPARATION) + { + jounce = _jounce; + jounceSpeed = 0; + separation = _separation; + } +}; + +/** +\brief The effect of suspension compliance on toe and camber angle and on the tire and suspension force application points. +*/ +struct PxVehicleSuspensionComplianceState +{ + /** + \brief The toe angle in radians that arises from suspension compliance. + \note toe is expressed in the suspension frame. + */ + PxReal toe; + + /** + \brief The camber angle in radians that arises from suspension compliance. + \note camber is expressed in the suspension frame. + */ + PxReal camber; + + /** + \brief The tire force application point that arises from suspension compliance. + \note tireForceAppPoint is expressed in the suspension frame. + */ + PxVec3 tireForceAppPoint; + + /** + \brief The suspension force application point that arises from suspension compliance. + \note suspForceAppPoint is expressed in the suspension frame. + */ + PxVec3 suspForceAppPoint; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleSuspensionComplianceState)); + } +}; + +/** +\brief The force and torque for a single suspension to apply to the vehicle's rigid body. +*/ +struct PxVehicleSuspensionForce +{ + /** + \brief The force to apply to the rigid body. + \note force is expressed in the world frame. + + Unit: mass * length / (time^2) + */ + PxVec3 force; + + /** + \brief The torque to apply to the rigid body. + \note torque is expressed in the world frame. + + Unit: mass * (length^2) / (time^2) + */ + PxVec3 torque; + + /** + \brief The component of force that lies along the normal of the plane under the wheel. + \note normalForce may be used by the tire model as the tire load. + + Unit: mass * length / (time^2) + */ + PxReal normalForce; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleSuspensionForce)); + } +}; + +/** +\brief The anti-roll torque of all anti-roll bars accumulates in a single torque to apply +to the vehicle's rigid body. +*/ +struct PxVehicleAntiRollTorque +{ + /** + \brief The accumulated torque to apply to the rigid body. + \note antiRollTorque is expressed in the world frame. + + Unit: mass * (length^2) / (time^2) + */ + PxVec3 antiRollTorque; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleAntiRollTorque)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireComponents.h new file mode 100644 index 0000000..32b1f1f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireComponents.h @@ -0,0 +1,333 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "PxVehicleTireFunctions.h" +#include "PxVehicleTireParams.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleTireComponent : public PxVehicleComponent +{ +public: + + PxVehicleTireComponent() : PxVehicleComponent() {} + virtual ~PxVehicleTireComponent() {} + + virtual void getDataForTireComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& wheelRigidBody1DStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireCamberAngleStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireForces) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleTireComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData actuationStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData tireForceParams; + PxVehicleArrayData roadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData wheelRigidBody1DStates; + PxVehicleArrayData tireGripStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData tireSlipStates; + PxVehicleArrayData tireCamberAngleStates; + PxVehicleArrayData tireStickyStates; + PxVehicleArrayData tireForces; + + getDataForTireComponent(axleDescription, steerResponseStates, + rigidBodyState, actuationStates, wheelParams, suspensionParams, tireForceParams, + roadGeomStates, suspensionStates, suspensionComplianceStates, suspensionForces, + wheelRigidBody1DStates, tireGripStates, tireDirectionStates, tireSpeedStates, + tireSlipStates, tireCamberAngleStates, tireStickyStates, tireForces); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Compute the tire slip directions + PxVehicleTireDirsUpdate( + suspensionParams[wheelId], + steerResponseStates[wheelId], + roadGeomStates[wheelId], suspensionComplianceStates[wheelId], + *rigidBodyState, + context.frame, + tireDirectionStates[wheelId]); + + //Compute the rigid body speeds along the tire slip directions. + PxVehicleTireSlipSpeedsUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + steerResponseStates[wheelId], suspensionStates[wheelId], tireDirectionStates[wheelId], + *rigidBodyState, roadGeomStates[i], + context.frame, + tireSpeedStates[wheelId]); + + //Compute the tire slip angles. + PxVehicleTireSlipsUpdate( + wheelParams[wheelId], context.tireSlipParams, + actuationStates[wheelId], tireSpeedStates[wheelId], + wheelRigidBody1DStates[wheelId], + tireSlipStates[wheelId]); + + //Update the camber angle + PxVehicleTireCamberAnglesUpdate( + suspensionParams[wheelId], steerResponseStates[wheelId], roadGeomStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.frame, + tireCamberAngleStates[wheelId]); + + //Compute the friction + PxVehicleTireGripUpdate( + tireForceParams[wheelId], roadGeomStates[wheelId], + suspensionStates[wheelId], suspensionForces[wheelId], + tireSlipStates[wheelId], tireGripStates[wheelId]); + + //Update the tire sticky state + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireStickyStateUpdate( + *axleDescription, + wheelParams[wheelId], + context.tireStickyParams, + actuationStates, tireGripStates[wheelId], + tireSpeedStates[wheelId], wheelRigidBody1DStates[wheelId], + dt, + tireStickyStates[wheelId]); + + //If sticky tire is active set the slip angle to zero. + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireSlipsAccountingForStickyStatesUpdate( + tireStickyStates[wheelId], + tireSlipStates[wheelId]); + + //Compute the tire forces + PxVehicleTireForcesUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + tireForceParams[wheelId], + suspensionComplianceStates[wheelId], + tireGripStates[wheelId], tireDirectionStates[wheelId], + tireSlipStates[wheelId], tireCamberAngleStates[wheelId], + *rigidBodyState, + tireForces[wheelId]); + } + + return true; + } +}; + +/** + * @deprecated + */ +class PX_DEPRECATED PxVehicleLegacyTireComponent : public PxVehicleComponent +{ +public: + + PxVehicleLegacyTireComponent() : PxVehicleComponent() {} + virtual ~PxVehicleLegacyTireComponent() {} + + virtual void getDataForLegacyTireComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + const PxVehicleRigidBodyState*& rigidBodyState, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& tireForceParams, + PxVehicleArrayData& roadGeomStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& suspensionForces, + PxVehicleArrayData& wheelRigidBody1DStates, + PxVehicleArrayData& tireGripStates, + PxVehicleArrayData& tireDirectionStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& tireSlipStates, + PxVehicleArrayData& tireCamberAngleStates, + PxVehicleArrayData& tireStickyStates, + PxVehicleArrayData& tireForces) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleLegacyTireComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + const PxVehicleRigidBodyState* rigidBodyState; + PxVehicleArrayData actuationStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData tireForceParams; + PxVehicleArrayData roadGeomStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData suspensionForces; + PxVehicleArrayData wheelRigidBody1DStates; + PxVehicleArrayData tireGripStates; + PxVehicleArrayData tireDirectionStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData tireSlipStates; + PxVehicleArrayData tireCamberAngleStates; + PxVehicleArrayData tireStickyStates; + PxVehicleArrayData tireForces; + + getDataForLegacyTireComponent(axleDescription, steerResponseStates, + rigidBodyState, actuationStates, + wheelParams, suspensionParams, tireForceParams, + roadGeomStates, suspensionStates, suspensionComplianceStates, + suspensionForces, wheelRigidBody1DStates, + tireGripStates, tireDirectionStates, tireSpeedStates, tireSlipStates, + tireCamberAngleStates, tireStickyStates, tireForces); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + //Compute the tire slip directions + PxVehicleTireDirsLegacyUpdate( + suspensionParams[wheelId], + steerResponseStates[wheelId], + roadGeomStates[wheelId], *rigidBodyState, + context.frame, + tireDirectionStates[wheelId]); + + //Compute the rigid body speeds along the tire slip directions. + PxVehicleTireSlipSpeedsUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + steerResponseStates[wheelId], suspensionStates[wheelId], tireDirectionStates[wheelId], + *rigidBodyState, roadGeomStates[wheelId], + context.frame, + tireSpeedStates[wheelId]); + + //Compute the tire slip angles. + PxVehicleTireSlipsLegacyUpdate( + wheelParams[wheelId], context.tireSlipParams, + actuationStates[wheelId], tireSpeedStates[wheelId], + wheelRigidBody1DStates[wheelId], + tireSlipStates[wheelId]); + + //Update the camber angle + PxVehicleTireCamberAnglesUpdate( + suspensionParams[wheelId], steerResponseStates[wheelId], roadGeomStates[wheelId], + suspensionComplianceStates[wheelId], *rigidBodyState, + context.frame, + tireCamberAngleStates[wheelId]); + + //Compute the friction + PxVehicleTireGripUpdate( + tireForceParams[wheelId], roadGeomStates[wheelId], + suspensionStates[wheelId], suspensionForces[wheelId], + tireSlipStates[wheelId], tireGripStates[wheelId]); + + //Update the tire sticky state + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireStickyStateUpdate( + *axleDescription, + wheelParams[wheelId], + context.tireStickyParams, + actuationStates, tireGripStates[wheelId], + tireSpeedStates[wheelId], wheelRigidBody1DStates[wheelId], + dt, + tireStickyStates[wheelId]); + + //If sticky tire is active set the slip angle to zero. + // + //Note: this should be skipped if tires do not use the sticky feature + PxVehicleTireSlipsAccountingForStickyStatesUpdate( + tireStickyStates[wheelId], + tireSlipStates[wheelId]); + + //Compute the tire forces + PxVehicleTireForcesUpdate( + wheelParams[wheelId], suspensionParams[wheelId], + tireForceParams[wheelId], + suspensionComplianceStates[wheelId], + tireGripStates[wheelId], tireDirectionStates[wheelId], + tireSlipStates[wheelId], tireCamberAngleStates[wheelId], + *rigidBodyState, + tireForces[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireFunctions.h new file mode 100644 index 0000000..cd8cd14 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireFunctions.h @@ -0,0 +1,269 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleSuspensionParams; +struct PxVehicleRoadGeometryState; +struct PxVehicleRigidBodyState; +struct PxVehicleTireDirectionState; +struct PxVehicleSuspensionComplianceState; +struct PxVehicleWheelParams; +struct PxVehicleTireSpeedState; +struct PxVehicleWheelActuationState; +struct PxVehicleWheelRigidBody1dState; +struct PxVehicleTireSlipState; +struct PxVehicleSuspensionState; +struct PxVehicleTireCamberAngleState; +struct PxVehicleTireGripState; +struct PxVehicleTireForceParams; +struct PxVehicleSuspensionForce; +struct PxVehicleTireForce; +struct PxVehicleTireStickyState; + +/** +\brief Compute the longitudinal and lateral tire directions in the ground plane. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] roadGeometryState describes the plane of the road geometry under the wheel +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireDirectionState is the computed tire longitudinal and lateral directions in the world frame. +\note PxVehicleTireDirsLegacyUpdate replicates the tire direction calculation of PhysX 5.0 and earlier. +@deprecated +*/ +PX_DEPRECATED void PxVehicleTireDirsLegacyUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& tireDirectionState); + +/** +\brief Compute the longitudinal and lateral tire directions in the ground plane. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] roadGeometryState describes the plane of the road geometry under the wheel. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireDirectionState is the computed tire longitudinal and lateral directions in the world frame. +\note The difference between PxVehicleTireDirsUpdate and PxVehicleTireDirsLegacyUpdate is that +PxVehicleTireDirsUpdate accounts for suspension compliance while PxVehicleTireDirsLegacyUpdate does not. +*/ +void PxVehicleTireDirsUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& tireDirectionState); + +/** +\brief Project the rigid body velocity at the tire contact point along the tire longitudinal directions. +\param[in] wheelParams is a description of the wheel's radius and half-width. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] suspensionStates is the current suspension compression state. +\param[in] tireDirectionState is the tire's longitudinal and lateral directions in the ground plane. +\param[in] rigidBodyState describes the current pose and velocity of the vehicle's rigid body in the world frame. +\param[in] roadGeometryState describes the current velocity of the road geometry under each wheel. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireSpeedState is the components of rigid body velocity at the tire contact point along the +tire's longitudinal and lateral axes. +@see PxVehicleTireDirsUpdate +@see PxVehicleTireDirsLegacyUpdate +*/ +void PxVehicleTireSlipSpeedsUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxF32 steerAngle, const PxVehicleSuspensionState& suspensionStates, const PxVehicleTireDirectionState& tireDirectionState, + const PxVehicleRigidBodyState& rigidBodyState, const PxVehicleRoadGeometryState& roadGeometryState, + const PxVehicleFrame& frame, + PxVehicleTireSpeedState& tireSpeedState); + +/** +\brief Compute a tire's longitudinal and lateral slip angles. +\param[in] wheelParams describes the radius of the wheel. +\param[in] tireSlipParams describes how to manage small longitudinal speeds by setting minimum values on the +denominator of the quotients used to calculate lateral and longitudinal slip. +\param[in] actuationState describes whether a wheel is to be driven by a drive torque or not. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[out] tireSlipState is the computed tire longitudinal and lateral slips. +\note Longitudinal slip angle has the following theoretical form: (wheelRotationSpeed*wheelRadius - longitudinalSpeed)/|longitudinalSpeed| +\note Lateral slip angle has the following theoretical form: atan(lateralSpeed/|longitudinalSpeed|) +\note The calculation of both longitudinal and lateral slip angles avoid a zero denominator using minimum values for the denominator set in +tireSlipParams. +*/ +void PxVehicleTireSlipsUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleTireSlipParams& tireSlipParams, + const PxVehicleWheelActuationState& actuationState, PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + PxVehicleTireSlipState& tireSlipState); + +/** +@deprecated + +\brief Compute a tire's longitudinal and lateral slip angles. +\param[in] wheelParams describes the radius of the wheel. +\param[in] tireSlipParams describes how to manage small longitudinal speeds by setting minimum values on the +denominator of the quotients used to calculate lateral and longitudinal slip. +\param[in] actuationState describes whether a wheel is to be driven by a drive torque or not. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[out] tireSlipState is the computed tire longitudinal and lateral slips. +\note Longitudinal slip angle has the following theoretical form: (wheelRotationSpeed*wheelRadius - longitudinalSpeed)/|longitudinalSpeed| +\note Lateral slip angle has the following theoretical form: atan(lateralSpeed/|longitudinalSpeed|) +\note The calculation of both longitudinal and lateral slip angles avoid a zero denominator using minimum values for the denominator set in +tireSlipParams. +*/ +void PX_DEPRECATED PxVehicleTireSlipsLegacyUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleTireSlipParams& tireSlipParams, + const PxVehicleWheelActuationState& actuationState, PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + PxVehicleTireSlipState& tireSlipState); + + +/** +\brief Compute the camber angle of the wheel +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] steerAngle is the steer angle in radians to be applied to the wheel. +\param[in] roadGeometryState describes the plane of the road geometry under the wheel. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[in] frame is a description of the vehicle's lateral and longitudinal axes. +\param[out] tireCamberAngleState is the computed camber angle of the tire expressed in radians. +*/ +void PxVehicleTireCamberAnglesUpdate +(const PxVehicleSuspensionParams& suspensionParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireCamberAngleState& tireCamberAngleState); + +/** +\brief Compute the load and friction experienced by the tire. +\param[in] tireForceParams describes the tire's friction response to longitudinal lip angle and its load response. +\param[in] roadGeometryState describes the plane of the road geometry under the wheel. +\param[in] suspensionState is the current suspension compression state. +\param[in] suspensionForce is the force that the suspension exerts on the sprung mass of the suspension. +\param[in] tireSlipState is the tire longitudinal and lateral slip angles. +\param[out] tireGripState is the computed load and friction experienced by the tire. +\note If the suspension cannot place the wheel on the ground the tire load and friction will be 0.0. +*/ +void PxVehicleTireGripUpdate +(const PxVehicleTireForceParams& tireForceParams, + const PxVehicleRoadGeometryState& roadGeometryState, const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionForce& suspensionForce, + const PxVehicleTireSlipState& tireSlipState, + PxVehicleTireGripState& tireGripState); + +/** +\brief When a tire has been at a very low speed for a threshold time without application of drive torque, a +secondary tire model is applied to bring the tire to rest using velocity constraints that asymptotically approach zero speed +along the tire's lateral and longitudinal directions. This secondary tire model is referred to as the sticky tire model and the +tire is considered to be in the sticky tire state when the speed and time conditions are satisfied. The purpose of +PxVehicleTireStickyStateUpdate is to compute the target speeds of the sticky state and to record whether sticky state is +active or not. +\param[in] axleDescription is the axles of the vehicle and the wheels on each axle. +\param[in] wheelParams describes the radius of the wheel +\param[in] tireStickyParams describe the threshold speeds and times for the lateral and longitudinal sticky states. +\param[in] actuationStates describes whether each wheel experiences a drive torque. +\param[in] tireGripState is the load and friction experienced by the tire. +\param[in] tireSpeedState is the component of rigid body velocity at the tire contact point projected along the +tire's longitudinal and lateral axes. +\param[in] wheelRigidBody1dState is the wheel rotation speed. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleTireStickyStateUpdate +\param[out] tireStickyState is a description of the sticky state of the tire in the longitudinal and lateral directions. +\note The velocity constraints are maintained through integration with the PhysX scene using the function +PxVehiclePhysXConstraintStatesUpdate. Alternative implementations independent of PhysX are possible. +@see PxVehiclePhysXConstraintStatesUpdate +@see PxVehicleTireSlipsAccountingForStickyStatesUpdate +*/ +void PxVehicleTireStickyStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleWheelParams& wheelParams, + const PxVehicleTireStickyParams& tireStickyParams, + const PxVehicleArrayData& actuationStates, + const PxVehicleTireGripState& tireGripState, const PxVehicleTireSpeedState& tireSpeedState, const PxVehicleWheelRigidBody1dState& wheelRigidBody1dState, + const PxReal dt, + PxVehicleTireStickyState& tireStickyState); + +/** +\brief Set the tire longitudinal and lateral slip values to 0.0 in the event that the tire has entred tire sticky state. This is +necessary to avoid both tire models being simultaneously active and interfering with each other. +\param[in] tireStickyState is a description of the sticky state of the tire in the longitudinal and lateral directions. +\param[out] tireSlipState is the updated lateral and longudinal slip with either set to 0.0 in the event that the correspoinding +sticky state is active. +\note This function should not be invoked if there is no subsequent component to implement the sticky tire model. +*/ +void PxVehicleTireSlipsAccountingForStickyStatesUpdate +(const PxVehicleTireStickyState& tireStickyState, + PxVehicleTireSlipState& tireSlipState); + +/** +\brief Compute the longitudinal and lateral forces in the world frame that develop on the tire as a consequence of +the tire's slip angles, friction and load. +\param[in] wheelParams describes the radius and half-width of the wheel. +\param[in] suspensionParams describes the frame of the suspension and wheel. +\param[in] tireForceParams describes the conversion of slip angle, friction and load to a force along the longitudinal +and lateral directions of the tire. +\param[in] complianceState is a description of the camber and toe angle that arise from suspension compliance. +\param[out] tireGripState is the load and friction experienced by the tire. +\param[in] tireDirectionState is the tire's longitudinal and lateral directions in the ground plane. +\param[in] tireSlipState is the longitudinal and lateral slip angles. +\param[in] tireCamberAngleState is the camber angle of the tire expressed in radians. +\param[in] rigidBodyState describes the current pose of the vehicle's rigid body in the world frame. +\param[out] tireForce is the computed tire forces in the world frame. +*/ +void PxVehicleTireForcesUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleTireForceParams& tireForceParams, + const PxVehicleSuspensionComplianceState& complianceState, + const PxVehicleTireGripState& tireGripState, const PxVehicleTireDirectionState& tireDirectionState, + const PxVehicleTireSlipState& tireSlipState, const PxVehicleTireCamberAngleState& tireCamberAngleState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleTireForce& tireForce); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireHelpers.h new file mode 100644 index 0000000..5a6d1eb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireHelpers.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "PxVehicleTireStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the intention to accelerate by inspecting the actuation states of the wheels of a powered vehicle. +\param[in] poweredVehicleAxleDesc describes the axles and wheels of a powered vehicle in a jointed ensemble of vehicles. +\param[in] poweredVehicleActuationStates describes the drive state of each wheel of the powered vehicle. +@see PxVehicleTireStickyStateReset +*/ +bool PxVehicleAccelerationIntentCompute +(const PxVehicleAxleDescription& poweredVehicleAxleDesc, const PxVehicleArrayData& poweredVehicleActuationStates); + +/** +\brief Reset the sticky tire states of an unpowered vehicle if it is in a jointed ensemble of vehicles with at least one powered vehicle. +\param[in] poweredVehicleIntentionToAccelerate describes the state of the powered vehicle in an ensemble of jointed vehicles. +\param[in] unpoweredVehicleAxleDesc describes the axles and wheels of an unpowered vehicle towed by a powered vehicle. +\param[out] unpoweredVehicleStickyState is the sticky state of the wheels of an unpowered vehicle towed by a powered vehicle. +\note If any wheel on the powered vehicle is to receive a drive torque, the sticky tire states of the towed vehicle will be reset to the deactivated state. +\note poweredVehicleIntentionToAccelerate may be computed using PxVehicleAccelerationIntentCompute(). +@see PxVehicleAccelerationIntentCompute +*/ +void PxVehicleTireStickyStateReset +(const bool poweredVehicleIntentionToAccelerate, + const PxVehicleAxleDescription& unpoweredVehicleAxleDesc, + PxVehicleArrayData& unpoweredVehicleStickyState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireParams.h new file mode 100644 index 0000000..a47428a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireParams.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "PxVehicleTireStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleTireForceParams +{ + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. latStiffX describes the minimum normalized load (load/restLoad) that gives a + flat lateral stiffness response to load. + \note A value of 0.0 indicates that the tire lateral stiffness is independent of load and will adopt + the value #latStiffY for all values of tire load. + */ + PxReal latStiffX; + + /** + \brief Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and + flattens at large loads. latStiffY describes the maximum possible value of lateral stiffness that occurs + when (load/restLoad) >= #latStiffX. + + Unit: force per lateral slip = mass * length / (time^2) + */ + PxReal latStiffY; + + /** + \brief Tire Longitudinal stiffness + \note Longitudinal force can be approximated as longStiff*longitudinalSlip. + + Unit: force per longitudinal slip = mass * length / (time^2) + */ + PxReal longStiff; + + /** + \brief Tire camber stiffness + \note Camber force can be approximated as camberStiff*camberAngle. + + Unit: force per radian = mass * length / (time^2) + */ + PxReal camberStiff; + + /** + \brief Graph of friction vs longitudinal slip with 3 points. + \note frictionVsSlip[0][0] is always zero. + \note frictionVsSlip[0][1] is the friction available at zero longitudinal slip. + \note frictionVsSlip[1][0] is the value of longitudinal slip with maximum friction. + \note frictionVsSlip[1][1] is the maximum friction. + \note frictionVsSlip[2][0] is the end point of the graph. + \note frictionVsSlip[2][1] is the value of friction for slips greater than frictionVsSlip[2][0]. + \note The friction value is computed from the friction vs longitudinal slip graph using linear interpolation. + \note The friction value computed from the friction vs longitudinal slip graph is used to scale the friction + value of the road geometry. + \note frictionVsSlip[2][0] > frictionVsSlip[1][0] > frictionVsSlip[0][0] + \note frictionVsSlip[1][1] is typically greater than frictionVsSlip[0][1] + \note frictionVsSlip[2][1] is typically smaller than frictionVsSlip[1][1] + \note longitudinal slips > frictionVsSlip[2][0] use friction multiplier frictionVsSlip[2][1] + */ + PxReal frictionVsSlip[3][2]; //3 (x,y) points + + /** + \brief The rest load is the load that develops on the tire when the vehicle is at rest on a flat plane. + \note The rest load is approximately the product of gravitational acceleration and (sprungMass + wheelMass). + + Unit: force = mass * length / (time^2) + */ + PxReal restLoad; + + /** + \brief Tire load variation can be strongly dependent on the time-step so it is a good idea to filter it + to give less jerky handling behavior. + \note Tire load filtering is implemented by linear interpolating a graph containing just two points. + The x-axis of the graph is normalized tire load, while the y-axis is the filtered normalized tire load that is + to be applied during the tire force calculation. + \note The normalized load is the force acting downwards on the tire divided by restLoad. + \note The minimum possible normalized load is zero. + \note There are two points on the graph: (minNormalisedLoad, minNormalisedFilteredLoad) and (maxNormalisedLoad, maxFilteredNormalisedLoad). + \note Normalized loads less than minNormalisedLoad have filtered normalized load = minNormalisedFilteredLoad. + \note Normalized loads greater than maxNormalisedLoad have filtered normalized load = maxFilteredNormalisedLoad. + \note Normalized loads in-between are linearly interpolated between minNormalisedFilteredLoad and maxFilteredNormalisedLoad. + \note The tire load applied as input to the tire force computation is the filtered normalized load multiplied by the rest load. + \note loadFilter[0][0] is minNormalisedLoad + \note loadFilter[0][1] is minFilteredNormalisedLoad + \note loadFilter[1][0] is maxNormalisedLoad + \note loadFilter[1][1] is maxFilteredNormalisedLoad + */ + PxReal loadFilter[2][2]; //2 (x,y) points + + PX_FORCE_INLINE PxVehicleTireForceParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleTireForceParams r = *this; + const PxReal scale = trgScale.scale / srcScale.scale; + r.latStiffY *= scale; + r.longStiff *= scale; + r.camberStiff *= scale; + r.restLoad *= scale; + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(latStiffX >= 0, "PxVehicleTireForceParams.latStiffX must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(latStiffY > 0, "PxVehicleTireForceParams.latStiffY must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(longStiff > 0, "PxVehicleTireForceParams.longStiff must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(camberStiff >= 0, "PxVehicleTireForceParams.camberStiff must be greater than or equal zero", false); + PX_CHECK_AND_RETURN_VAL(restLoad > 0, "PxVehicleTireForceParams.restLoad must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(loadFilter[1][0] >= loadFilter[0][0], "PxVehicleTireForceParams.loadFilter[1][0] must be greater than or equal to PxVehicleTireForceParams.loadFilter[0][0]", false); + PX_CHECK_AND_RETURN_VAL(loadFilter[1][1] > 0, "PxVehicleTireLoadFilterData.loadFilter[1][1] must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(0.0f == loadFilter[0][0], "PxVehicleTireLoadFilterData.loadFilter[0][0] must be equal to zero", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[0][0] >= 0.0f && frictionVsSlip[0][1] >= 0.0f, "Illegal values for frictionVsSlip[0]", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[1][0] >= 0.0f && frictionVsSlip[1][1] >= 0.0f, "Illegal values for frictionVsSlip[1]", false); + PX_CHECK_AND_RETURN_VAL(frictionVsSlip[2][0] >= 0.0f && frictionVsSlip[2][1] >= 0.0f, "Illegal values for frictionVsSlip[2]", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireStates.h new file mode 100644 index 0000000..7e666db --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/tire/PxVehicleTireStates.h @@ -0,0 +1,181 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + + +/** +\brief PxVehicleTireDirectionState stores the world frame lateral and longtidinal axes of the tire after +projecting the wheel pose in the world frame onto the road geometry plane (also in the world frame). +*/ +struct PxVehicleTireDirectionState +{ + PxVec3 directions[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireDirectionState)); + } +}; + + +/** +\brief PxVehicleTireSpeedState stores the components of the instantaneous velocity of the rigid body at the tire contact point projected +along the lateral and longitudinal axes of the tire. +@see PxVehicleTireDirectionState +*/ +struct PxVehicleTireSpeedState +{ + PxReal speedStates[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireSpeedState)); + } +}; + +/** +\brief The lateral and longitudinal tire slips. +@see PxVehicleTireSpeedState +*/ +struct PxVehicleTireSlipState +{ + PxReal slips[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireSlipState)); + } +}; + +/** +\brief The load and friction experienced by a tire. +*/ +struct PxVehicleTireGripState +{ + /** + \brief The tire load + + Unit: force = mass * length / (time^2) + */ + PxReal load; + + /** + \brief The tire friction is the product of the road geometry friction and a friction response multiplier. + */ + PxReal friction; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireGripState)); + } +}; + +/** +\brief Camber angle of the tire relative to the ground plane. +*/ +struct PxVehicleTireCamberAngleState +{ + PxReal camberAngle; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireCamberAngleState)); + } +}; + +/** +\brief Prolonged low speeds in the lateral and longitudinal directions may be handled with "sticky" velocity constraints that activate after +a speed below a threshold has been recorded for a threshold time. +@see PxVehicleTireStickyParams +@see PxVehicleTireSpeedState +*/ +struct PxVehicleTireStickyState +{ + PxReal lowSpeedTime[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + bool activeStatus[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireStickyState)); + } +}; + +/** +\brief The longitudinal/lateral forces/torques that develop on the tire. +*/ +struct PxVehicleTireForce +{ + /* + \brief The tire forces that develop along the tire's longitudinal and lateral directions. Specified in the world frame. + */ + PxVec3 forces[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + /* + \brief The tire torques that develop around the tire's longitudinal and lateral directions. Specified in the world frame. + */ + PxVec3 torques[PxVehicleTireDirectionModes::eMAX_NB_PLANAR_DIRECTIONS]; + + /** + \brief The aligning moment may be propagated to a torque-driven steering controller. + */ + PxReal aligningMoment; + + /** + \brief The torque to apply to the wheel's 1d rigid body. + */ + PxReal wheelTorque; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleTireForce)); + } +}; + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h new file mode 100644 index 0000000..bb3ca84 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelComponents.h @@ -0,0 +1,120 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleComponent.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "PxVehicleWheelFunctions.h" +#include "PxVehicleWheelHelpers.h" + +#include "common/PxProfileZone.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +class PxVehicleWheelComponent : public PxVehicleComponent +{ +public: + + PxVehicleWheelComponent() : PxVehicleComponent() {} + virtual ~PxVehicleWheelComponent() {} + + virtual void getDataForWheelComponent( + const PxVehicleAxleDescription*& axleDescription, + PxVehicleArrayData& steerResponseStates, + PxVehicleArrayData& wheelParams, + PxVehicleArrayData& suspensionParams, + PxVehicleArrayData& actuationStates, + PxVehicleArrayData& suspensionStates, + PxVehicleArrayData& suspensionComplianceStates, + PxVehicleArrayData& tireSpeedStates, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleArrayData& wheelLocalPoses) = 0; + + virtual bool update(const PxReal dt, const PxVehicleSimulationContext& context) + { + PX_PROFILE_ZONE("PxVehicleWheelComponent::update", 0); + + const PxVehicleAxleDescription* axleDescription; + PxVehicleArrayData steerResponseStates; + PxVehicleArrayData wheelParams; + PxVehicleArrayData suspensionParams; + PxVehicleArrayData actuationStates; + PxVehicleArrayData suspensionStates; + PxVehicleArrayData suspensionComplianceStates; + PxVehicleArrayData tireSpeedStates; + PxVehicleArrayData wheelRigidBody1dStates; + PxVehicleArrayData wheelLocalPoses; + + getDataForWheelComponent(axleDescription, steerResponseStates, + wheelParams, suspensionParams, actuationStates, suspensionStates, + suspensionComplianceStates, tireSpeedStates, wheelRigidBody1dStates, + wheelLocalPoses); + + for (PxU32 i = 0; i < axleDescription->nbWheels; i++) + { + const PxU32 wheelId = axleDescription->wheelIdsInAxleOrder[i]; + + PxVehicleWheelRotationAngleUpdate( + wheelParams[wheelId], + actuationStates[wheelId], suspensionStates[wheelId], + tireSpeedStates[wheelId], + context.thresholdForwardSpeedForWheelAngleIntegration, dt, + wheelRigidBody1dStates[wheelId]); + + wheelLocalPoses[wheelId].localPose = PxVehicleComputeWheelLocalPose(context.frame, + suspensionParams[wheelId], + suspensionStates[wheelId], + suspensionComplianceStates[wheelId], + steerResponseStates[wheelId], + wheelRigidBody1dStates[wheelId]); + } + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h new file mode 100644 index 0000000..cd5588c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelFunctions.h @@ -0,0 +1,81 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams; +struct PxVehicleWheelActuationState; +struct PxVehicleSuspensionState; +struct PxVehicleTireSpeedState; +struct PxVehicleScale; +struct PxVehicleWheelRigidBody1dState; + +/** +\brief Forward integrate the rotation angle of a wheel +\note The rotation angle of the wheel plays no role in simulation but is important to compute the pose of the wheel for rendering. +\param[in] wheelParams describes the radius and half-width of the wheel +\param[in] actuationState describes whether the wheel has drive or brake torque applied to it. +\param[in] suspensionState describes whether the wheel touches the ground. +\param[in] tireSpeedState describes the components of rigid body velocity at the ground contact point along the tire's lateral and longitudinal directions. +\param[in] thresholdForwardSpeedForWheelAngleIntegration Forward wheel speed below which the wheel rotation speed gets blended with the rolling + speed (based on the forward wheel speed) which is then used to integrate the wheel rotation angle. At low forward wheel speed, the wheel + rotation speed can get unstable (depending on the tire model used) and, for example, oscillate. If brake or throttle is applied, there + will be no blending. +\param[in] dt is the simulation time that has lapsed since the last call to PxVehicleWheelRotationAngleUpdate +\param[in,out] wheelRigidBody1dState describes the current angular speed and angle of the wheel. +\note At low speeds and large timesteps, wheel rotation speed can become noisy due to singularities in the tire slip computations. +At low speeds, therefore, the wheel speed used for integrating the angle is a blend of current angular speed and rolling angular speed if the +wheel experiences neither brake nor drive torque and can be placed on the ground. The blended rotation speed gets stored in +PxVehicleWheelRigidBody1dState::correctedRotationSpeed. +*/ +void PxVehicleWheelRotationAngleUpdate +(const PxVehicleWheelParams& wheelParams, + const PxVehicleWheelActuationState& actuationState, const PxVehicleSuspensionState& suspensionState, const PxVehicleTireSpeedState& tireSpeedState, + const PxReal thresholdForwardSpeedForWheelAngleIntegration, const PxReal dt, + PxVehicleWheelRigidBody1dState& wheelRigidBody1dState); + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h new file mode 100644 index 0000000..5a62db2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelHelpers.h @@ -0,0 +1,221 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "vehicle2/PxVehicleFunctions.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "PxVehicleWheelParams.h" +#include "PxVehicleWheelStates.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief Compute the quaternion of a wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] camberAngle is the camber angle in radian sinduced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The quaterion of the wheel in the rigid body frame. +@see PxVehicleComputeWheelOrientation +*/ +PX_FORCE_INLINE PxQuat PxVehicleComputeWheelLocalOrientation +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxReal rotationAngle) +{ + const PxQuat wheelLocalOrientation = + (suspensionParams.suspensionAttachment.q * PxVehicleComputeRotation(frame, camberAngle, 0.0f, steerAngle + toeAngle))* + (suspensionParams.wheelAttachment.q * PxVehicleComputeRotation(frame, 0.0f, rotationAngle, 0.0f)); + return wheelLocalOrientation; +} + +/** +\brief Compute the quaternion of a wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyOrientation is the quaterion of the rigid body in the world frame. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The quaterion of the wheel in the world frame. +@see PxVehicleComputeWheelLocalOrientation +*/ +PX_FORCE_INLINE PxQuat PxVehicleComputeWheelOrientation +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxQuat& rigidBodyOrientation, const PxReal rotationAngle) +{ + const PxQuat wheelOrientation = rigidBodyOrientation * PxVehicleComputeWheelLocalOrientation(frame, suspensionParams, + camberAngle, toeAngle, steerAngle, rotationAngle); + return wheelOrientation; +} + +/** +\brief Compute the pose of the wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The pose of the wheel in the rigid body frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelLocalPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxReal rotationAngle) +{ + //Full equation: + //PxTransform(suspAttachment.p + suspParams.suspensionTravelDir*suspDist, suspAttachment.q) * + //PxTransform(PxVec3(0), PxQuat(camber, 0, steer+toe)) * + //wheelAttachment * + //PxTransform(PxVec3(0), PxQuat(0, rotation, 0)) + //Reduces to: + //PxTransform(suspAttachment.p + suspParams.suspensionTravelDir*suspDist, suspAttachment.q * PxQuat(camber, 0, steer+toe)) * + //PxTranfsorm(wheelAttachment.p, wheelAttachment.q * PxQuat(0, rotation, 0)) + const PxF32 suspDist = (suspensionState.jounce != PX_VEHICLE_UNSPECIFIED_JOUNCE) ? (suspensionParams.suspensionTravelDist - suspensionState.jounce) : 0.0f; + const PxTransform wheelLocalPose = + PxTransform( + suspensionParams.suspensionAttachment.p + suspensionParams.suspensionTravelDir*suspDist, + suspensionParams.suspensionAttachment.q*PxVehicleComputeRotation(frame, camberAngle, 0.0f, steerAngle + toeAngle))* + PxTransform( + suspensionParams.wheelAttachment.p, + suspensionParams.wheelAttachment.q*PxVehicleComputeRotation(frame, 0.0f, rotationAngle, 0.0f)); + return wheelLocalPose; +} + + +/** +\brief Compute the pose of the wheel in the rigid body frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] suspensionComplianceState is the camber and toe angles induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] wheelState is angle around the wheel's lateral axis. +\return The pose of the wheel in the rigid body frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelLocalPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, + const PxReal steerAngle, + const PxVehicleWheelRigidBody1dState& wheelState) +{ + return PxVehicleComputeWheelLocalPose(frame, suspensionParams, suspensionState, + suspensionComplianceState.camber, suspensionComplianceState.toe, steerAngle, + wheelState.rotationAngle); +} + +/** +\brief Compute the pose of the wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] camberAngle is the camber angle in radian induced by suspension compliance. +\param[in] toeAngle is the toe angle in radians induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[in] rotationAngle is the angle around the wheel's lateral axis. +\return The pose of the wheel in the world frame. +*/ +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, + const PxReal camberAngle, const PxReal toeAngle, const PxReal steerAngle, + const PxTransform& rigidBodyPose, const PxReal rotationAngle) +{ + const PxTransform wheelPose = rigidBodyPose * PxVehicleComputeWheelLocalPose(frame, suspensionParams, suspensionState, + camberAngle, toeAngle, steerAngle, rotationAngle); + return wheelPose; +} + +/** +\brief Compute the pose of the wheel in the world frame. +\param[in] frame describes the longitudinal and lateral axes of the vehicle. +\param[in] suspensionParams describes the suspension and wheel frames. +\param[in] suspensionState is the compression state of the suspenson. +\param[in] suspensionComplianceState is the camber and toe angles induced by suspension compliance. +\param[in] steerAngle is the steer angle in radians applied to the wheel. +\param[in] rigidBodyPose is the pose of the rigid body in the world frame. +\param[in] wheelState is angle around the wheel's lateral axis. +\return The pose of the wheel in the world frame. +*/ + +PX_FORCE_INLINE PxTransform PxVehicleComputeWheelPose +(const PxVehicleFrame& frame, + const PxVehicleSuspensionParams& suspensionParams, + const PxVehicleSuspensionState& suspensionState, const PxVehicleSuspensionComplianceState& suspensionComplianceState, const PxReal steerAngle, + const PxTransform& rigidBodyPose, const PxVehicleWheelRigidBody1dState& wheelState) +{ + return PxVehicleComputeWheelPose(frame, suspensionParams, suspensionState, + suspensionComplianceState.camber, suspensionComplianceState.toe, steerAngle, + rigidBodyPose, wheelState.rotationAngle); +} + +/** +\brief Check if the suspension could place the wheel on the ground or not. + +\param[in] suspState The state of the suspension to check. +\return True if the wheel connects to the ground, else false. + +@see PxVehicleSuspensionState +*/ +PX_FORCE_INLINE bool PxVehicleIsWheelOnGround(const PxVehicleSuspensionState& suspState) +{ + return (suspState.separation <= 0.0f); +} + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelParams.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelParams.h new file mode 100644 index 0000000..016f0cc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelParams.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxFoundation.h" + +#include "vehicle2/PxVehicleParams.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehicleWheelParams +{ + /** + \brief Radius of unit that includes metal wheel plus rubber tire. + + Range: (0, inf)
+ Unit: length + */ + PxReal radius; + + /** + \brief Half-width of unit that includes wheel plus tire. + + Range: (0, inf)
+ Unit: length + */ + PxReal halfWidth; + + /** + \brief Mass of unit that includes wheel plus tire. + + Range: (0, inf)
+ Unit: mass + */ + PxReal mass; + + /** + \brief Moment of inertia of unit that includes wheel plus tire about the rolling axis. + + Range: (0, inf)
+ Unit: mass * (length^2) + */ + PxReal moi; + + /** + \brief Damping rate applied to wheel. + + Range: [0, inf)
+ Unit: torque * time = mass * (length^2) / time + */ + PxReal dampingRate; + + PX_FORCE_INLINE PxVehicleWheelParams transformAndScale( + const PxVehicleFrame& srcFrame, const PxVehicleFrame& trgFrame, const PxVehicleScale& srcScale, const PxVehicleScale& trgScale) const + { + PX_UNUSED(srcFrame); + PX_UNUSED(trgFrame); + PxVehicleWheelParams r = *this; + const PxReal scale = trgScale.scale/srcScale.scale; + r.radius *= scale; + r.halfWidth *= scale; + r.moi *= (scale*scale); + r.dampingRate *= (scale*scale); + return r; + } + + PX_FORCE_INLINE bool isValid() const + { + PX_CHECK_AND_RETURN_VAL(radius > 0.0f, "PxVehicleWheelParams.radius must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(halfWidth > 0.0f, "PxVehicleWheelParams.halfWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mass > 0.0f, "PxVehicleWheelParams.mass must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(moi > 0.0f, "PxVehicleWheelParams.moi must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(dampingRate >= 0.0f, "PxVehicleWheelParams.dampingRate must be greater than or equal to zero", false); + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelStates.h b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelStates.h new file mode 100644 index 0000000..01b28d2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/include/vehicle2/wheel/PxVehicleWheelStates.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +/** \addtogroup vehicle2 + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMemory.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/** +\brief It is useful to know if a brake or drive torque is to be applied to a wheel. +*/ +struct PxVehicleWheelActuationState +{ + bool isBrakeApplied; //!< True if a brake torque is applied, false if not. + bool isDriveApplied; //!< True if a drive torque is applied, false if not. + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelActuationState)); + } +}; + +struct PxVehicleWheelRigidBody1dState +{ + /** + \brief The rotation speed of the wheel around the lateral axis. + + Unit: radians / time + */ + PxReal rotationSpeed; + + /** + \brief The corrected rotation speed of the wheel around the lateral axis in radians per second. + + At low forward wheel speed, the wheel rotation speed can get unstable (depending on the tire + model used) and, for example, oscillate. To integrate the wheel rotation angle, a (potentially) + blended rotation speed is used which gets stored in #correctedRotationSpeed. + + Unit: radians / time + + @see PxVehicleSimulationContext::thresholdForwardSpeedForWheelAngleIntegration + */ + PxReal correctedRotationSpeed; + + /** + \brief The accumulated angle of the wheel around the lateral axis in radians in range (-2*Pi,2*Pi) + */ + PxReal rotationAngle; + + PX_FORCE_INLINE void setToDefault() + { + PxMemZero(this, sizeof(PxVehicleWheelRigidBody1dState)); + } +}; + +struct PxVehicleWheelLocalPose +{ + PxTransform localPose; //!< The pose of the wheel in the rigid body frame. + + PX_FORCE_INLINE void setToDefault() + { + localPose = PxTransform(PxIdentity); + } +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/CMakeLists.txt b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/CMakeLists.txt new file mode 100644 index 0000000..620bbc6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/CMakeLists.txt @@ -0,0 +1,94 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +cmake_minimum_required(VERSION 3.7) + +project(PVDRuntime C CXX) + +set(PVDRuntimeBuilt 1 CACHE INTERNAL "PVDRuntimeBuilt") + +IF(NOT DEFINED CMAKEMODULES_VERSION) + SET(CMAKEMODULES_PATH $ENV{PM_CMakeModules_PATH} CACHE INTERNAL "Path to CMakeModules") + SET(CMAKEMODULES_NAME $ENV{PM_CMakeModules_NAME} CACHE INTERNAL "CMakeModules name") + SET(CMAKEMODULES_VERSION $ENV{PM_CMakeModules_VERSION} CACHE INTERNAL "CMakeModules version from generation batch") + + #TODO: More elegance + IF(NOT EXISTS ${CMAKEMODULES_PATH}) + MESSAGE(FATAL_ERROR "Could not find ${CMAKEMODULES_PATH}") + ENDIF() + +ENDIF() + +SET(CMAKE_MODULE_PATH ${CMAKEMODULES_PATH}) + +# This is required to be defined by external callers! +IF(NOT DEFINED PHYSX_ROOT_DIR) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable wasn't set.") +ENDIF() + +IF(NOT EXISTS ${PHYSX_ROOT_DIR}) + MESSAGE(FATAL_ERROR "PHYSX_ROOT_DIR variable was invalid.") +ENDIF() + +INCLUDE(NvidiaBuildOptions) + +IF(CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES debug checked profile release) + SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING + "Reset config to what we need" + FORCE) + + # Need to define these at least once. + SET(CMAKE_EXE_LINKER_FLAGS_CHECKED "") + SET(CMAKE_EXE_LINKER_FLAGS_PROFILE "") + SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") + SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "") + + # Build PDBs for all configurations + SET(CMAKE_EXE_LINKER_FLAGS "/DEBUG") + SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +ENDIF() + +SET(PROJECT_CMAKE_FILES_DIR compiler/cmake) +SET(PLATFORM_CMAKELISTS ${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +IF(NOT EXISTS ${PLATFORM_CMAKELISTS}) + MESSAGE(FATAL_ERROR "Unable to find platform CMakeLists.txt for ${TARGET_BUILD_PLATFORM} at ${PLATFORM_CMAKELISTS}") +ENDIF() + +# Include the platform specific CMakeLists +INCLUDE(${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) + +# Set folder Server to all Server projects +SET_PROPERTY(TARGET PVDRuntime PROPERTY FOLDER "PVDRuntime") + +INSTALL( + TARGETS PVDRuntime + EXPORT PhysXSDK + DESTINATION $<$:${PX_ROOT_LIB_DIR}/debug>$<$:${PX_ROOT_LIB_DIR}/release>$<$:${PX_ROOT_LIB_DIR}/checked>$<$:${PX_ROOT_LIB_DIR}/profile> + ) + \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/PVDRuntime.cmake b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/PVDRuntime.cmake new file mode 100644 index 0000000..63f1b23 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/PVDRuntime.cmake @@ -0,0 +1,116 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +# +# Build Server Test template +# +# Include here after the directories are defined so that the platform specific file can use the variables. + +include(${PHYSX_ROOT_DIR}/pvdruntime/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/PVDRuntime.cmake) + +SET(PVDRUNTIME_HEADERS + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdLibraryFunctions.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdCommands.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdDefines.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdReader.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdWriter.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdReadStream.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdWriteStream.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdFileReadStream.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdFileWriteStream.h + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdMemoryStream.h +) +SOURCE_GROUP(include FILES ${PVDRUNTIME_HEADERS}) + +SET(PVDRUNTIME_HEADERS_USER + ${PHYSX_ROOT_DIR}/pvdruntime/include/OmniPvdLoader.h +) + +INSTALL(FILES ${PVDRUNTIME_HEADERS} ${PVDRUNTIME_HEADERS_USER} DESTINATION pvdruntime/include) + +SET(PVDRUNTIME_SOURCES + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdLog.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdLog.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdReaderImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdReaderImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdWriterImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdWriterImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdFileReadStreamImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdFileWriteStreamImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryStreamImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h + ${PHYSX_ROOT_DIR}/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp +) +SOURCE_GROUP(src FILES ${PVDRUNTIME_SOURCES}) + +add_library(PVDRuntime SHARED + ${PVDRUNTIME_HEADERS} + ${PVDRUNTIME_SOURCES} +) + +TARGET_INCLUDE_DIRECTORIES(PVDRuntime + PRIVATE ${PHYSX_ROOT_DIR}/pvdruntime/include + PRIVATE ${PHYSX_ROOT_DIR}/pvdruntime/src +) + +TARGET_COMPILE_DEFINITIONS(PVDRuntime + PRIVATE ${PVDRUNTME_COMPILE_DEFS} +) + +IF(NV_USE_GAMEWORKS_OUTPUT_DIRS) + SET_TARGET_PROPERTIES(PVDRuntime PROPERTIES + RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PX_EXE_OUTPUT_DIRECTORY_DEBUG} + RUNTIME_OUTPUT_DIRECTORY_PROFILE ${PX_EXE_OUTPUT_DIRECTORY_PROFILE} + RUNTIME_OUTPUT_DIRECTORY_CHECKED ${PX_EXE_OUTPUT_DIRECTORY_CHECKED} + RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PX_EXE_OUTPUT_DIRECTORY_RELEASE} + + OUTPUT_NAME PVDRuntime + ) +ELSE() + IF(APPEND_CONFIG_NAME) + SET_TARGET_PROPERTIES(PVDRuntime PROPERTIES + DEBUG_OUTPUT_NAME PVDRuntimeDEBUG + PROFILE_OUTPUT_NAME PVDRuntimePROFILE + CHECKED_OUTPUT_NAME PVDRuntimeCHECKED + RELEASE_OUTPUT_NAME PVDRuntime + ) + ENDIF() +ENDIF() + + +TARGET_LINK_LIBRARIES(PVDRuntime + PUBLIC ${PVDRUNTIME_PLATFORM_LINKED_LIBS}) + +IF(PX_GENERATE_SOURCE_DISTRO) + LIST(APPEND SOURCE_DISTRO_FILE_LIST ${PVDRUNTIME_HEADERS}) + LIST(APPEND SOURCE_DISTRO_FILE_LIST ${PVDRUNTIME_SOURCES}) +ENDIF() \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt new file mode 100644 index 0000000..b9a4747 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/CMakeLists.txt @@ -0,0 +1,40 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_LINUX_COMPILE_DEFS) + MESSAGE(FATAL ERROR "Cloud uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "Cloud uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists + + +# Include all of the projects +INCLUDE(PVDRuntime.cmake) + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/PVDRuntime.cmake b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/PVDRuntime.cmake new file mode 100644 index 0000000..a00c40f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/linux/PVDRuntime.cmake @@ -0,0 +1,44 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +# +# Build ServerTest template +# + + +SET(PVDRUNTIME_COMPILE_DEFS + + # Common to all configurations + ${PHYSX_LINUX_COMPILE_DEFS};${PHYSX_LIBTYPE_DEFS}; + + $<$:${PHYSX_LINUX_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_LINUX_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_LINUX_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_LINUX_RELEASE_COMPILE_DEFS};> +) + +SET(PVDRUNTIME_PLATFORM_LINKED_LIBS +) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt new file mode 100644 index 0000000..4f1fc2a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/CMakeLists.txt @@ -0,0 +1,48 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +IF(NOT DEFINED PHYSX_WINDOWS_COMPILE_DEFS) + MESSAGE(FATAL ERROR "Cloud uses the PhysX compile defs, and they're not defined when they need to be.") +ENDIF() + +IF (NOT DEFINED PHYSX_CXX_FLAGS) + MESSAGE(FATAL ERROR "Cloud uses the PhysX CXX flags, and they're not defined when they need to be.") +ENDIF() + +# Get the CXX Flags from the Cached variables set by the PhysX CMakeLists +SET(CMAKE_CXX_FLAGS "${PHYSX_CXX_FLAGS} /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4577 /EHsc") + +SET(CMAKE_CXX_FLAGS_DEBUG "${PHYSX_CXX_FLAGS_DEBUG}") +SET(CMAKE_CXX_FLAGS_CHECKED "${PHYSX_CXX_FLAGS_CHECKED}") +SET(CMAKE_CXX_FLAGS_PROFILE "${PHYSX_CXX_FLAGS_PROFILE}") +SET(CMAKE_CXX_FLAGS_RELEASE "${PHYSX_CXX_FLAGS_RELEASE}") + +# Build PDBs for all configurations +SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") + +# Include all of the projects +INCLUDE(PVDRuntime.cmake) + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/PVDRuntime.cmake b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/PVDRuntime.cmake new file mode 100644 index 0000000..3d25145 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/compiler/cmake/windows/PVDRuntime.cmake @@ -0,0 +1,48 @@ +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## * Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## * Neither the name of NVIDIA CORPORATION nor the names of its +## contributors may be used to endorse or promote products derived +## from this software without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +## EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +## PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +## OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +## Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +# +# Build ServerTest template +# + +#IF(PX_CLOUD_GENERATE_STATIC_LIBRARIES) +# SET(GRIDSERVER_CLOUD_LIBTYPE CLOUD_STATIC_LIB) +#ENDIF() + +SET(PVDRUNTIME_COMPILE_DEFS + # Common to all configurations + WIN32;WIN64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;${PHYSX_LIBTYPE_DEFS}; + $<$:${PHYSX_WINDOWS_DEBUG_COMPILE_DEFS};> + $<$:${PHYSX_WINDOWS_CHECKED_COMPILE_DEFS};> + $<$:${PHYSX_WINDOWS_PROFILE_COMPILE_DEFS};> + $<$:${PHYSX_WINDOWS_RELEASE_COMPILE_DEFS};> +) + +SET(PVDRUNTIME_PLATFORM_LINKED_LIBS +) + +INSTALL(FILES $ + DESTINATION $<$:${PX_ROOT_LIB_DIR}/debug>$<$:${PX_ROOT_LIB_DIR}/release>$<$:${PX_ROOT_LIB_DIR}/checked>$<$:${PX_ROOT_LIB_DIR}/profile> OPTIONAL) \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdCommands.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdCommands.h new file mode 100644 index 0000000..514e54e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdCommands.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_COMMANDS_H +#define OMNI_PVD_COMMANDS_H + +struct OmniPvdCommandEnum +{ + enum Enum + { + eOmniPvdInvalid, + eOmniPvdRegisterClass, + eOmniPvdRegisterEnum, + eOmniPvdRegisterAttribute, + eOmniPvdRegisterClassAttribute, + eOmniPvdRegisterSetAttribute, + eOmniPvdSetAttribute, + eOmniPvdAddToSetAttribute, + eOmniPvdRemoveFromSetAttribute, + eOmniPvdCreateObject, + eOmniPvdDestroyObject, + eOmniPvdStartFrame, + eOmniPvdStopFrame + }; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdDefines.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdDefines.h new file mode 100644 index 0000000..dfcd5b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdDefines.h @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_DEFINES_H +#define OMNI_PVD_DEFINES_H + +#define OMNI_PVD_VERSION_MAJOR 0 +#define OMNI_PVD_VERSION_MINOR 3 +#define OMNI_PVD_VERSION_PATCH 0 + +//////////////////////////////////////////////////////////////////////////////// +// Versions so far : (major, minor, patch), top one is newest +// +// [0, 3, 0] +// writes/read out the base class handle in the class registration call +// backwards compatible with [0, 2, 0] and [0, 1, 42] +// [0, 2, 0] +// intermediate version was never official, no real change, but there are many files with this version +// [0, 1, 42] +// no proper base class written/read in the class registration call +// +//////////////////////////////////////////////////////////////////////////////// + +#include + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) +#define OMNI_PVD_WIN +#define OMNI_PVD_CALL __cdecl +#define OMNI_PVD_EXPORT extern "C" __declspec(dllexport) +#else +#ifdef __cdecl__ + #define OMNI_PVD_CALL __attribute__((__cdecl__)) +#else + #define OMNI_PVD_CALL +#endif +#if __GNUC__ >= 4 + #define OMNI_PVD_EXPORT extern "C" __attribute__((visibility("default"))) + #else + #define OMNI_PVD_EXPORT extern "C" +#endif +#endif + +typedef uint64_t OmniPvdObjectHandle; +typedef uint64_t OmniPvdContextHandle; +typedef uint32_t OmniPvdClassHandle; +typedef uint32_t OmniPvdAttributeHandle; +typedef uint16_t OmniPvdAttributeDataType; +typedef uint32_t OmniPvdVersionType; + +typedef void (OMNI_PVD_CALL *OmniPvdLogFunction)(char *logLine); + +struct OmniPvdDataTypeEnum +{ + enum Enum + { + eINT8, + eINT16, + eINT32, + eINT64, + eUINT8, + eUINT16, + eUINT32, + eUINT64, + eFLOAT32, + eFLOAT64, + eSTRING, + eOBJECT_HANDLE, + eENUM_VALUE, + eFLAGS_WORD + }; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileReadStream.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileReadStream.h new file mode 100644 index 0000000..3ae0500 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileReadStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_FILE_READ_STREAM_H +#define OMNI_PVD_FILE_READ_STREAM_H + +#include "OmniPvdReadStream.h" + +/** + * @brief Used to abstract a file read stream + * + * Used to set the filename, opening and closing it. + */ +class OmniPvdFileReadStream : public OmniPvdReadStream +{ +public: + virtual ~OmniPvdFileReadStream() + { + } + + /** + * @brief Sets the file name of the file to read from + * + * @param fileName The file name of the file to open + */ + virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0; + + /** + * @brief Opens the file + * + * @return True if the file opening was successfull + */ + virtual bool OMNI_PVD_CALL openFile() = 0; + + /** + * @brief Closes the file + * + * @return True if the file closing was successfull + */ + virtual bool OMNI_PVD_CALL closeFile() = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileWriteStream.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileWriteStream.h new file mode 100644 index 0000000..ea66eaf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdFileWriteStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_FILE_WRITE_STREAM_H +#define OMNI_PVD_FILE_WRITE_STREAM_H + +#include "OmniPvdWriteStream.h" + +/** + * @brief Used to abstract a file write stream + * + * Used to set the filename, opening and closing it. + */ +class OmniPvdFileWriteStream : public OmniPvdWriteStream +{ +public: + virtual ~OmniPvdFileWriteStream() + { + } + + /** + * @brief Sets the file name of the file to write to + * + * @param fileName The file name of the file to open + */ + virtual void OMNI_PVD_CALL setFileName(const char* fileName) = 0; + + /** + * @brief Opens the file + * + * @return True if the file opening was successfull + */ + virtual bool OMNI_PVD_CALL openFile() = 0; + + /** + * @brief Closes the file + * + * @return True if the file closing was successfull + */ + virtual bool OMNI_PVD_CALL closeFile() = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryFunctions.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryFunctions.h new file mode 100644 index 0000000..e292d22 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryFunctions.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#ifndef OMNI_PVD_LIBRARY_FUNCTIONS_H +#define OMNI_PVD_LIBRARY_FUNCTIONS_H + +#include "OmniPvdDefines.h" + +class OmniPvdReader; +class OmniPvdWriter; +class OmniPvdFileReadStream; +class OmniPvdFileWriteStream; +class OmniPvdMemoryStream; + +typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader *reader); + +typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter *writer); + +typedef OmniPvdFileReadStream* (OMNI_PVD_CALL *createOmniPvdFileReadStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdFileReadStreamFp)(OmniPvdFileReadStream *fileReadStream); + +typedef OmniPvdFileWriteStream* (OMNI_PVD_CALL *createOmniPvdFileWriteStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdFileWriteStreamFp)(OmniPvdFileWriteStream *fileWriteStream); + +typedef OmniPvdMemoryStream* (OMNI_PVD_CALL *createOmniPvdMemoryStreamFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdMemoryStreamFp)(OmniPvdMemoryStream *memoryStream); + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryHelpers.h new file mode 100644 index 0000000..e35b910 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLibraryHelpers.h @@ -0,0 +1,41 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef OMNI_PVD_LIBRARY_FUNCTIONS_H +#define OMNI_PVD_LIBRARY_FUNCTIONS_H + +#include "OmniPvdDefines.h" + +class OmniPvdReader; +class OmniPvdWriter; + +typedef OmniPvdReader* (OMNI_PVD_CALL *createOmniPvdReaderFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdReaderFp)(OmniPvdReader *reader); + +typedef OmniPvdWriter* (OMNI_PVD_CALL *createOmniPvdWriterFp)(); +typedef void (OMNI_PVD_CALL *destroyOmniPvdWriterFp)(OmniPvdWriter *writer); + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLoader.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLoader.h new file mode 100644 index 0000000..a15c0bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdLoader.h @@ -0,0 +1,176 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef OMNI_PVD_LOADER_H +#define OMNI_PVD_LOADER_H + +#include "OmniPvdWriter.h" +#include "OmniPvdReader.h" +#include "OmniPvdLibraryFunctions.h" + +#include + +#ifdef OMNI_PVD_WIN + #include +#elif defined(__linux__) + #include +#endif + +class OmniPvdLoader +{ +public: + OmniPvdLoader(); + ~OmniPvdLoader(); + bool loadOmniPvd(const char *libFile); + void unloadOmniPvd(); + void* mLibraryHandle; + + createOmniPvdWriterFp mCreateOmniPvdWriter; + destroyOmniPvdWriterFp mDestroyOmniPvdWriter; + + createOmniPvdReaderFp mCreateOmniPvdReader; + destroyOmniPvdReaderFp mDestroyOmniPvdReader; + + createOmniPvdFileReadStreamFp mCreateOmniPvdFileReadStream; + destroyOmniPvdFileReadStreamFp mDestroyOmniPvdFileReadStream; + + createOmniPvdFileWriteStreamFp mCreateOmniPvdFileWriteStream; + destroyOmniPvdFileWriteStreamFp mDestroyOmniPvdFileWriteStream; + + createOmniPvdMemoryStreamFp mCreateOmniPvdMemoryStream; + destroyOmniPvdMemoryStreamFp mDestroyOmniPvdMemoryStream; +}; + +inline OmniPvdLoader::OmniPvdLoader() +{ + mLibraryHandle = 0; + + mCreateOmniPvdWriter = 0; + mDestroyOmniPvdWriter = 0; + + mCreateOmniPvdReader = 0; + mDestroyOmniPvdReader = 0; + + mCreateOmniPvdFileReadStream = 0; + mDestroyOmniPvdFileReadStream = 0; + + mCreateOmniPvdFileWriteStream = 0; + mDestroyOmniPvdFileWriteStream = 0; + + mCreateOmniPvdMemoryStream = 0; + mDestroyOmniPvdMemoryStream = 0; +} + +inline OmniPvdLoader::~OmniPvdLoader() +{ + unloadOmniPvd(); +} + +inline bool OmniPvdLoader::loadOmniPvd(const char *libFile) +{ + +#ifdef OMNI_PVD_WIN + mLibraryHandle = LoadLibraryA(libFile); +#elif defined(__linux__) + mLibraryHandle = dlopen(libFile, RTLD_NOW); +#endif + + if (mLibraryHandle) + { +#ifdef OMNI_PVD_WIN + mCreateOmniPvdWriter = (createOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdWriter"); + mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdWriter"); + + mCreateOmniPvdReader = (createOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdReader"); + mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdReader"); + + mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileReadStream"); + mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileReadStream"); + + mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdFileWriteStream"); + mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdFileWriteStream"); + + mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "createOmniPvdMemoryStream"); + mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)GetProcAddress((HINSTANCE)mLibraryHandle, "destroyOmniPvdMemoryStream"); +#elif defined(__linux__) + mCreateOmniPvdWriter = (createOmniPvdWriterFp)dlsym(mLibraryHandle, "createOmniPvdWriter"); + mDestroyOmniPvdWriter = (destroyOmniPvdWriterFp)dlsym(mLibraryHandle, "destroyOmniPvdWriter"); + + mCreateOmniPvdReader = (createOmniPvdReaderFp)dlsym(mLibraryHandle, "createOmniPvdReader"); + mDestroyOmniPvdReader = (destroyOmniPvdReaderFp)dlsym(mLibraryHandle, "destroyOmniPvdReader"); + + mCreateOmniPvdFileReadStream = (createOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileReadStream"); + mDestroyOmniPvdFileReadStream = (destroyOmniPvdFileReadStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileReadStream"); + + mCreateOmniPvdFileWriteStream = (createOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "createOmniPvdFileWriteStream"); + mDestroyOmniPvdFileWriteStream = (destroyOmniPvdFileWriteStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdFileWriteStream"); + + mCreateOmniPvdMemoryStream = (createOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "createOmniPvdMemoryStream"); + mDestroyOmniPvdMemoryStream = (destroyOmniPvdMemoryStreamFp)dlsym(mLibraryHandle, "destroyOmniPvdMemoryStream"); + +#endif + + if ((!mCreateOmniPvdWriter) || + (!mDestroyOmniPvdWriter) || + (!mCreateOmniPvdReader) || + (!mDestroyOmniPvdReader) || + (!mCreateOmniPvdFileReadStream) || + (!mDestroyOmniPvdFileReadStream) || + (!mCreateOmniPvdFileWriteStream) || + (!mDestroyOmniPvdFileWriteStream) || + (!mCreateOmniPvdMemoryStream) || + (!mDestroyOmniPvdMemoryStream) + ) + { +#ifdef OMNI_PVD_WIN + FreeLibrary((HINSTANCE)mLibraryHandle); +#elif defined(__linux__) + dlclose(mLibraryHandle); +#endif + mLibraryHandle = 0; + return false; + } + } + else { + return false; + } + return true; +} + +inline void OmniPvdLoader::unloadOmniPvd() +{ + if (mLibraryHandle) + { +#ifdef OMNI_PVD_WIN + FreeLibrary((HINSTANCE)mLibraryHandle); +#elif defined(__linux__) + dlclose(mLibraryHandle); +#endif + mLibraryHandle = 0; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdMemoryStream.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdMemoryStream.h new file mode 100644 index 0000000..5d87c1a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdMemoryStream.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_MEMORY_STREAM_H +#define OMNI_PVD_MEMORY_STREAM_H + +#include "OmniPvdReadStream.h" +#include "OmniPvdWriteStream.h" + +/** + * @brief Used to abstract a memory read/write stream + * + * Used to get the read and write streams. + */ +class OmniPvdMemoryStream +{ +public: + virtual ~OmniPvdMemoryStream() + { + } + /** + * @brief Used to get the read stream + * + * @return The read stream + */ + virtual OmniPvdReadStream* OMNI_PVD_CALL getReadStream() = 0; + + /** + * @brief Used to get the write stream + * + * @return The write stream + */ + virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0; + + /** + * @brief Sets the buffer size in bytes of the memory streams + * + * @return The actually allocated length of the memory stream + */ + virtual uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength) = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReadStream.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReadStream.h new file mode 100644 index 0000000..d089d70 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReadStream.h @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_READ_STREAM_H +#define OMNI_PVD_READ_STREAM_H + +#include "OmniPvdDefines.h" + +/** + * @brief Used to abstract a memory read stream + * + * Allows to read and skip bytes as well as open/close it. + */ +class OmniPvdReadStream +{ +public: + virtual ~OmniPvdReadStream() + { + } + + /** + * @brief Read n bytes from the shared memory buffer + * + * @param bytes Reads n bytes into the destination pointer + * @param nbrBytes The requested number of bytes to read + * @return The actual number of bytes read + */ + virtual uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, const uint64_t nbrBytes) = 0; + + /** + * @brief Skip n bytes from the shared memory buffer + * + * @param nbrBytes The requested number of bytes to skip + * @return The actual number of bytes skipped + */ + virtual uint64_t OMNI_PVD_CALL skipBytes(const uint64_t nbrBytes) = 0; + + /** + * @brief Opens the read stream + * + * @return True if it succeeded + */ + virtual bool OMNI_PVD_CALL openStream() = 0; + + /** + * @brief Closes the read stream + * + * @return True if it succeeded + */ + virtual bool OMNI_PVD_CALL closeStream() = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReader.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReader.h new file mode 100644 index 0000000..f8d1a31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdReader.h @@ -0,0 +1,230 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_READER_H +#define OMNI_PVD_READER_H + +#include "OmniPvdDefines.h" +#include "OmniPvdCommands.h" +#include "OmniPvdReadStream.h" + +/** + * @brief Used to read debug information from an OmniPvdReadStream + * + * Using the getNextCommand function in a while loop for example one can traverse the stream one command after another. Given the command, different functions below will be available. + * + * Using the OmniPvdCommandEnum one can determine the type of command and like that use the appropriate get functions to extract the payload from the command. + */ + +class OmniPvdReader +{ +public: + virtual ~OmniPvdReader() + { + } + + /** + * @brief Sets the log function to print the internal debug messages of the OmniPVD Reader instance + * + * @param logFunction The function pointer to receive the log messages + */ + virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0; + + /** + * @brief Sets the read stream that contains the OmniPVD API command stream + * + * @param stream The OmniPvdReadStream that holds the stream of API calls/notifications + */ + virtual void OMNI_PVD_CALL setReadStream(OmniPvdReadStream* stream) = 0; + + /** + * @brief Extracts the versions from the binary file ro read and tests if the file is older or equal to that of the reader. + * + * @param majorVersion The major versions of the stream + * @param minorVersion The minor versions of the stream + * @param patch The patch number of the stream + * @return If the reading was possible to start or not + */ + virtual bool OMNI_PVD_CALL startReading(OmniPvdVersionType* majorVersion, OmniPvdVersionType* minorVersion, OmniPvdVersionType* patch) = 0; + + /** + * @brief The heartbeat function of the reader class. As long as the command that is returned is not equal to OmniPvdCommandEnum::eOmniPvdInvalid, then one can safely extract the data fields from the command. + * + * @return The command enum type + */ + virtual OmniPvdCommandEnum::Enum OMNI_PVD_CALL getNextCommand() = 0; + + /** + * @brief Returns the command type as an enumerator of the latest command + * + * @return The latest command enum type + */ + virtual OmniPvdCommandEnum::Enum OMNI_PVD_CALL getCommandType() = 0; + + /** + * @brief Returns the major version of the stream + * + * @return The major version + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getMajorVersion() = 0; + + /** + * @brief Returns the minor version of the stream + * + * @return The minor version + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getMinorVersion() = 0; + + /** + * @brief Returns the patch number of the stream + * + * @return The patch value + */ + virtual OmniPvdVersionType OMNI_PVD_CALL getPatch() = 0; + + /** + * @brief Returns the context handle of the latest commmnd, if it had one, else 0 + * + * @return The context handle of the latest command + */ + virtual OmniPvdContextHandle OMNI_PVD_CALL getContextHandle() = 0; + + /** + * @brief Returns the object handle of the latest commmnd, if it had one, else 0 + * + * @return The object handle of the latest command + */ + virtual OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle() = 0; + + /** + * @brief Returns the class handle of the latest commmnd, if it had one, else 0 + * + * @return The class handle of the latest command + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getClassHandle() = 0; + + /** + * @brief Returns the base class handle of the latest commmnd, if it had one, else 0 + * + * @return The base class handle of the latest command + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle() = 0; + + /** + * @brief Returns the attribute handle of the latest commmnd, if it had one, else 0 + * + * @return The attribute handle of the latest command + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle() = 0; + + /** + * @brief Returns the class name of the latest commmnd, if it had one, else a null terminated string of length 0 + * + * @return The string containing the class name + */ + virtual char* OMNI_PVD_CALL getClassName() = 0; + + /** + * @brief Returns the attribute name of the latest commmnd, if it had one, else a null terminated string of length 0 + * + * @return The string containing the attribute name + */ + virtual char* OMNI_PVD_CALL getAttributeName() = 0; + + /** + * @brief Returns the object name of the latest commmnd, if it had one, else a null terminated string of length 0 + * + * @return The string containing the object name + */ + virtual char* OMNI_PVD_CALL getObjectName() = 0; + + /** + * @brief Returns the attribute data pointer, the data is undefined if the last command did not contain attribute data + * + * @return The array containing the attribute data + */ + virtual uint8_t* OMNI_PVD_CALL getAttributeDataPointer() = 0; + + /** + * @brief Returns the attribute data type, the data is undefined if the last command did not contain attribute data + * + * @return The attribute data type + */ + virtual OmniPvdAttributeDataType OMNI_PVD_CALL getAttributeDataType() = 0; + + /** + * @brief Returns the attribute data length, the data length of the last command + * + * @return The attribute data length + */ + virtual uint32_t OMNI_PVD_CALL getAttributeDataLength() = 0; + + /** + * @brief Returns the number of elements contained in the last set operation + * + * @return The number of elements + */ + virtual uint32_t OMNI_PVD_CALL getAttributeNumberElements() = 0; + + /** + * @brief Returns the numberclass handle of the attribute class + * + * @return The attibute class handle + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle() = 0; + + /** + * @brief Returns the frame start value + * + * @return The frame ID value + */ + virtual uint64_t OMNI_PVD_CALL getFrameTimeStart() = 0; + + /** + * @brief Returns the frame stop value + * + * @return The frame ID value + */ + virtual uint64_t OMNI_PVD_CALL getFrameTimeStop() = 0; + + /** + * @brief Returns the class handle containing the enum values + * + * @return The enum class handle + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle() = 0; + + /** + * @brief Returns the enum value for a specific flag + * + * @return The enum value + */ + virtual uint32_t OMNI_PVD_CALL getEnumValue() = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriteStream.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriteStream.h new file mode 100644 index 0000000..d636a5a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriteStream.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_WRITE_STREAM_H +#define OMNI_PVD_WRITE_STREAM_H + +#include "OmniPvdDefines.h" + +/** + * @brief Used to abstract a memory write stream + * + * Allows to write bytes as well as open/close the stream. + */ +class OmniPvdWriteStream +{ +public: + virtual ~OmniPvdWriteStream() + { + } + + /** + * @brief Write n bytes to the shared memory buffer + * + * @param bytes pointer to the bytes to write + * @param nbrBytes The requested number of bytes to write + * @return The actual number of bytes written + */ + virtual uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, const uint64_t nbrBytes) = 0; + + /** + * @brief Flushes the writes + * + * @return The success of the operation + */ + virtual bool OMNI_PVD_CALL flush() = 0; + + /** + * @brief Opens the stream + * + * @return The success of the operation + */ + virtual bool OMNI_PVD_CALL openStream() = 0; + + /** + * @brief Closes the stream + * + * @return The success of the operation + */ + virtual bool OMNI_PVD_CALL closeStream() = 0; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriter.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriter.h new file mode 100644 index 0000000..1528d7d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/include/OmniPvdWriter.h @@ -0,0 +1,326 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_WRITER_H +#define OMNI_PVD_WRITER_H + +#include "OmniPvdDefines.h" +#include "OmniPvdWriteStream.h" + +/** + * @brief Used to write debug information to an OmniPvdWriteStream + * + * Allows the registration of OmniPVD classes and attributes, in a similar fashion to an object oriented language. A registration returns a unique identifier or handle. + * + * Once classes and attributes have been registered, one can create for example object instances of a class and set the values of the attributes of a specific object. + * + * Objects can be grouped by context using the context handle. The context handle is a user-specified handle which is passed to the set functions and object creation and destruction functions. + * + * Each context can have its own notion of time. The current time of a context can be exported with calls to the startFrame and stopFrame functions. + */ +class OmniPvdWriter +{ +public: + virtual ~OmniPvdWriter() + { + } + + /** + * @brief Sets the log function to print the internal debug messages of the OmniPVD API + * + * @param logFunction The function pointer to receive the log messages + */ + virtual void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction) = 0; + + /** + * @brief Sets the write stream to receive the API command stream + * + * @param writeStream The OmniPvdWriteStream to receive the stream of API calls/notifications + */ + virtual void OMNI_PVD_CALL setWriteStream(const OmniPvdWriteStream* writeStream) = 0; + + /** + * @brief Gets the pointer to the write stream + * + * @return A pointer to the write stream + */ + virtual OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream() = 0; + + /** + * @brief Registers an OmniPVD class + * + * Returns a unique handle to a class, which can be used to register class attributes and express object lifetimes with the createObject and destroyObject functions. Class inheritance can be described by calling registerClass with a base class handle. Derived classes inherit the attributes of the parent classes. + * + * @param className The class name + * @param baseClassHandle The handle to the base class. This handle is obtained by pre-registering the base class. Defaults to 0 which means the class has no parent class + * @return A unique class handle for the registered class + * + * @see OmniPvdWriter::registerAttribute() + * @see OmniPvdWriter::registerEnumValue() + * @see OmniPvdWriter::registerFlagsAttribute() + * @see OmniPvdWriter::registerClassAttribute() + * @see OmniPvdWriter::registerSetAttribute() + * @see OmniPvdWriter::createObject() + */ + virtual OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClassHandle = 0) = 0; + + /** + * @brief Registers an enum name and corresponding value for a pre-registered class. + * + * Registering enums happens in two steps. First, registerClass() is called with the name of the enum. This returns a class handle, which is used in a second step for the enum value registration with registerEnumValue(). If an enum has multiple values, registerEnumValue() has to be called with the different values. + * + * Note that enums differ from usual classes because their attributes, the enum values, do not change over time and there is no need to call setAttribute(). + * + * @param classHandle The handle from the registerClass() call + * @param attributeName The name of the enum value + * @param value The value of the enum value + * @return A unique attribute handle for the registered enum value + * + * @see OmniPvdWriter::registerClass() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(const OmniPvdClassHandle classHandle, const char* attributeName, const uint32_t value) = 0; + + /** + * @brief Registers an attribute. + * + * The class handle is obtained from a previous call to registerClass(). After registering an attribute, one gets an attribute handle which can be used to set data values of an attribute with setAttribute(). All attributes are treated as arrays, even if the attribute has only a single data item. Set nbrFields to 0 to indicate that the array has a variable length. + * + * @param classHandle The handle from the registerClass() call + * @param attributeName The attribute name + * @param attributeDataType The attribute data type // TODO: Change to type OmniPvdDataTypeEnum + * @param nbrFields The number of fields. Set this to 0 to indicate a variable length array + * @return A unique attribute handle for the registered attribute + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType, const uint32_t nbrFields) = 0; + + /** + * @brief Registers an attribute which is a flag. + * + * Use this function to indicate that a pre-registered class has a flag attribute, i.e., the attribute is a pre-registered enum. + * + * The returned attribute handle can be used in setAttribute() to set an object's flags. + * + * @param classHandle The handle from the registerClass() call of the class + * @param enumClassHandle The handle from the registerClass() call of the enum + * @param attributeName The attribute name + * @return A unique attribute handle for the registered flags attribute + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(const OmniPvdClassHandle classHandle, const OmniPvdClassHandle enumClassHandle, const char* attributeName) = 0; + + /** + * @brief Registers an attribute which is a class. + * + * Use this function to indicate that a pre-registered class has an attribute which is a pre-registered class. + * + * The returned attribute handle can be used in setAttribute() to set an object's class attribute. + * + * @param classHandle The handle from the registerClass() call of the class + * @param attributeName The attribute name + * @param classAttributeHandle The handle from the registerClass() call of the class attribute + * @return A unique handle for the registered class attribute + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::setAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdClassHandle classAttributeHandle) = 0; + + /** + * @brief Registers an attribute which is a set. + * + * A set is a collection of unique items and has a variable size. + * + * The returned attribute handle can be used in calls to addToSetAttribute() and removeFromSetAttribute(), to add an item to and remove it from a set, respectively. + * + * @param classHandle The handle from the registerClass() call of the class + * @param attributeName The attribute name + * @param attributeDataType The data type of items in the set attribute + * @return A unique handle for the registered set attribute + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::addToSetAttribute() + * @see OmniPvdWriter::removeFromSetAttribute() + */ + virtual OmniPvdAttributeHandle OMNI_PVD_CALL registerSetAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType) = 0; + + /** + * @brief Sets an attribute value. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param handleDepth The number of nested attribute handles requiref to identify the attribute + * @param attributeHandles The nested attribute handles needed to identify the attribute + * @param data The pointer to the data of the element(s) to remove from the set + * @param nbrBytes The number of bytes to be written + */ + virtual void OMNI_PVD_CALL setAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t *data, const uint32_t nbrBytes) = 0; + + /** + * @brief Sets an attribute value. + * + * Use the attribute handle from the registerAttribute() call to set the value of an attribute of an existing object. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param attributeHandle The handle from the registerAttribute() call + * @param data The pointer to the data + * @param nbrBytes The number of bytes to be written + * + * @see OmniPvdWriter::registerAttribute() + */ + virtual void OMNI_PVD_CALL setAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes) = 0; + + /** + * @brief Adds an item to a set attribute. + * + * Use the attribute handle(s) from the registerSetAttribute() call to add an item to a set attribute. + * + * An array of nested attribute handles is required to uniquely identify the attribute. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param handleDepth The number of nested attribute handles requiref to identify the attribute + * @param attributeHandles The nested attribute handles needed to identify the attribute + * @param data The pointer to the data of the element(s) to remove from the set + * @param nbrBytes The number of bytes to be written + */ + virtual void OMNI_PVD_CALL addToSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes) = 0; + + /** + * @brief Adds an item to a set attribute. + * + * Use the attribute handle from the registerSetAttribute() call to add an item to a set attribute. + * + * A set attribute is defined like a set in mathematics, where each element must be unique. + * + * The Shallow part of the function indicates that an array of nested attribute handles is not required to uniquely identify the attribute. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param attributeHandle The handle from the registerSetAttribute() call + * @param data The pointer to the data of the added set item + * @param nbrBytes The number of bytes to be written + * + * @see OmniPvdWriter::registerSetAttribute() + */ + virtual void OMNI_PVD_CALL addToSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes) = 0; + + /** + * @brief Removes an item from a set attribute, where the attribute is allowed to be nested + * + * A set attribute is defined like a set in mathematics, where each element must be unique. + * + * An array of nested attribute handles is required to uniquely identify the attribute. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param handleDepth The number of nested attribute handles require to identify the attribute + * @param attributeHandles The attribute handles needed to identify the attribute + * @param data The pointer to the data of the element(s) to remove from the set + * @param nbrBytes The number of bytes to be written + */ + virtual void OMNI_PVD_CALL removeFromSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes) = 0; + + /** + * @brief Removes an item from a set attribute + * + * A set attribute is defined like a set in mathematics, where each element must be unique. + * + * The Shallow part of the function indicates that an array of nested attribute handles is not required to uniquely identify the attribute. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param attributeHandle The handle from the registerSetAttribute() call + * @param data The pointer to the data of the removed set element(s) + * @param nbrBytes The number of bytes to be written + */ + virtual void OMNI_PVD_CALL removeFromSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes) = 0; + + /** + * @brief Creates an object creation event + * + * Indicates that an object is created. One can freely choose a context handle for grouping objects. + * + * The class handle is obtained from a registerClass() call. The object handle should be unique, but as it's not tracked by the OmniPVD API, it's important this is set to a valid handle such as the object's physical memory address. + * + * The object name can be freely choosen or not set. + * + * Create about object destruction event by calling destroyObject(). + * + * @param contextHandle The user-defined context handle for grouping objects + * @param classHandle The handle from the registerClass() call + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * @param objectName The user-defined name of the object. Can be the empty string + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::destroyObject() + */ + virtual void OMNI_PVD_CALL createObject(const OmniPvdContextHandle contextHandle, const OmniPvdClassHandle classHandle, const OmniPvdObjectHandle objectHandle, const char* objectName) = 0; + + /** + * @brief Creates an object destruction event + * + * Use this to indicate that an object is destroyed. Use the same user-defined context and object handles as were used in the create object calls. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param objectHandle The user-defined unique handle of the object. E.g. its physical memory address + * + * @see OmniPvdWriter::registerClass() + * @see OmniPvdWriter::createObject() + */ + virtual void OMNI_PVD_CALL destroyObject(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle) = 0; + + /** + * @brief Creates a frame start event + * + * Time or frames are counted separatly per user-defined context. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param timeStamp The timestamp of the frame start event + */ + virtual void OMNI_PVD_CALL startFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) = 0; + + /** + * @brief Creates a stop frame event + * + * Time is counted separately per user-defined context. + * + * @param contextHandle The user-defined context handle for grouping objects + * @param timeStamp The timestamp of the frame stop event + */ + virtual void OMNI_PVD_CALL stopFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) = 0; + + +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp new file mode 100644 index 0000000..520b6a4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.cpp @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdFileReadStreamImpl.h" + +OmniPvdFileReadStreamImpl::OmniPvdFileReadStreamImpl() +{ + mFileName = 0; + mFileWasOpened = false; + mPFile = 0; +} + +OmniPvdFileReadStreamImpl::~OmniPvdFileReadStreamImpl() +{ + closeFile(); + delete[] mFileName; + mFileName = 0; +} + +void OMNI_PVD_CALL OmniPvdFileReadStreamImpl::setFileName(const char* fileName) +{ + if (!fileName) return; + int n = (int)strlen(fileName) + 1; + if (n < 2) return; + delete[] mFileName; + mFileName = new char[n]; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + strcpy_s(mFileName, n, fileName); +#else + strcpy(mFileName, fileName); +#endif + mFileName[n - 1] = 0; +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openFile() +{ + if (mFileWasOpened) + { + return true; + } + if (!mFileName) + { + return false; + } + mPFile = 0; + mFileWasOpened = true; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + errno_t err = fopen_s(&mPFile, mFileName, "rb"); + if (err != 0) + { + mFileWasOpened = false; + } + else + { + fseek(mPFile, 0, SEEK_SET); + } +#else + mPFile = fopen(mFileName, "rb"); + if (mPFile) + { + fseek(mPFile, 0, SEEK_SET); + } + else + { + mFileWasOpened = false; + } +#endif + return mFileWasOpened; +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeFile() +{ + if (mFileWasOpened) + { + fclose(mPFile); + mPFile = 0; + mFileWasOpened = false; + } + return true; +} + +uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::readBytes(uint8_t* bytes, uint64_t nbrBytes) +{ + if (mFileWasOpened) + { + size_t result = fread(bytes, 1, nbrBytes, mPFile); + return (int)result; + } else { + return 0; + } +} + +uint64_t OMNI_PVD_CALL OmniPvdFileReadStreamImpl::skipBytes(const uint64_t nbrBytes) +{ + if (mFileWasOpened) + { + fseek(mPFile, (long)nbrBytes, SEEK_CUR); + return 0; + } + else { + return 0; + } +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::openStream() +{ + return openFile(); +} + +bool OMNI_PVD_CALL OmniPvdFileReadStreamImpl::closeStream() +{ + return closeFile(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h new file mode 100644 index 0000000..445431d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileReadStreamImpl.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_FILE_READ_STREAM_IMPL_H +#define OMNI_PVD_FILE_READ_STREAM_IMPL_H + +#include "OmniPvdFileReadStream.h" +#include +#include +#include + +class OmniPvdFileReadStreamImpl : public OmniPvdFileReadStream +{ +public: + OmniPvdFileReadStreamImpl(); + ~OmniPvdFileReadStreamImpl(); + void OMNI_PVD_CALL setFileName(const char *fileName); + bool OMNI_PVD_CALL openFile(); + bool OMNI_PVD_CALL closeFile(); + uint64_t OMNI_PVD_CALL readBytes(uint8_t* bytes, const uint64_t nbrBytes); + uint64_t OMNI_PVD_CALL skipBytes(const uint64_t nbrBytes); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + char* mFileName; + bool mFileWasOpened; + FILE* mPFile; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp new file mode 100644 index 0000000..a8bd6ce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.cpp @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdFileWriteStreamImpl.h" + +OmniPvdFileWriteStreamImpl::OmniPvdFileWriteStreamImpl() +{ + mFileName = 0; + mFileWasOpened = false; + mPFile = 0; +} + +OmniPvdFileWriteStreamImpl::~OmniPvdFileWriteStreamImpl() +{ + closeFile(); + delete[] mFileName; + mFileName = 0; +} + +void OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::setFileName(const char* fileName) +{ + if (!fileName) return; + int n = (int)strlen(fileName) + 1; + if (n < 2) return; + delete[] mFileName; + mFileName = new char[n]; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + strcpy_s(mFileName, n, fileName); +#else + strcpy(mFileName, fileName); +#endif + mFileName[n - 1] = 0; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openFile() +{ + if (mFileWasOpened) + { + return true; + } + if (!mFileName) + { + return false; + } + mPFile = 0; + mFileWasOpened = true; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + errno_t err = fopen_s(&mPFile, mFileName, "wb"); + if (err != 0) + { + mFileWasOpened = false; + } +#else + mPFile = fopen(mFileName, "wb"); +#endif + return mFileWasOpened; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeFile() +{ + if (mFileWasOpened) + { + fclose(mPFile); + mFileWasOpened = false; + } + return true; +} + +uint64_t OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::writeBytes(const uint8_t *bytes, const uint64_t nbrBytes) +{ + size_t result = 0; + if (mFileWasOpened) + { + result = fwrite(bytes, 1, nbrBytes, mPFile); + result++; + } + return result; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::flush() +{ + return true; +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::openStream() +{ + return openFile(); +} + +bool OMNI_PVD_CALL OmniPvdFileWriteStreamImpl::closeStream() +{ + return closeFile(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h new file mode 100644 index 0000000..71f8d1e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdFileWriteStreamImpl.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_FILE_WRITE_STREAM_IMPL_H +#define OMNI_PVD_FILE_WRITE_STREAM_IMPL_H + +#include "OmniPvdFileWriteStream.h" +#include +#include +#include + +class OmniPvdFileWriteStreamImpl : public OmniPvdFileWriteStream { +public: + OmniPvdFileWriteStreamImpl(); + ~OmniPvdFileWriteStreamImpl(); + void OMNI_PVD_CALL setFileName(const char *fileName); + bool OMNI_PVD_CALL openFile(); + bool OMNI_PVD_CALL closeFile(); + uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* bytes, const uint64_t nbrBytes); + bool OMNI_PVD_CALL flush(); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + char *mFileName; + bool mFileWasOpened; + FILE *mPFile; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.cpp new file mode 100644 index 0000000..93a2b1f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.cpp @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdHelpers.h" + +uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes) { + uint8_t lastBitGroupIndex = 0; + uint8_t shiftBits = 0; + for (int i = 0; i < 8; i++) { + if ((handle >> shiftBits) & 0x7f) { + lastBitGroupIndex = i; + } + shiftBits += 7; + } + shiftBits = 0; + for (int i = 0; i <= lastBitGroupIndex; i++) { + uint8_t currentBitGroup = (handle >> shiftBits) & 0x7f; + if (i < lastBitGroupIndex) { + currentBitGroup |= 0x80; // Set the continuation flag bit to true + } + bytes[i] = currentBitGroup; + shiftBits += 7; + } +} + +uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes) { + if (maxBytes > 8) { + maxBytes = 8; + } + uint64_t decompressedInt = 0; + uint8_t continueFlag = 1; + uint8_t readBytes = 0; + uint8_t shiftBits = 0; + while (continueFlag && (readBytes < maxBytes)) { + const uint8_t currentByte = *bytes; + uint64_t decompressedBits = currentByte & 0x7f; + continueFlag = currentByte & 0x80; + decompressedInt |= (decompressedBits << shiftBits); + shiftBits += 7; + if (continueFlag) { + bytes++; + } + } + return decompressedInt; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.h new file mode 100644 index 0000000..b64b3b9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdHelpers.h @@ -0,0 +1,37 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_HELPERS_H +#define OMNI_PVD_HELPERS_H + +#include + +extern uint8_t OmniPvdCompressInt(uint64_t handle, uint8_t *bytes); +extern uint64_t OmniPvdDeCompressInt(uint8_t *bytes, uint8_t maxBytes); + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp new file mode 100644 index 0000000..6ce68ef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLibraryFunctionsImpl.cpp @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdLibraryFunctions.h" +#include "OmniPvdReaderImpl.h" +#include "OmniPvdWriterImpl.h" +#include "OmniPvdFileReadStreamImpl.h" +#include "OmniPvdFileWriteStreamImpl.h" +#include "OmniPvdMemoryStreamImpl.h" + +OMNI_PVD_EXPORT OmniPvdReader* OMNI_PVD_CALL createOmniPvdReader() +{ + return new OmniPvdReaderImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdReader(OmniPvdReader *reader) +{ + OmniPvdReaderImpl *impl = (OmniPvdReaderImpl*)reader; + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdWriter* OMNI_PVD_CALL createOmniPvdWriter() +{ + return new OmniPvdWriterImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdWriter(OmniPvdWriter *writer) +{ + OmniPvdWriterImpl *impl = (OmniPvdWriterImpl*)writer; + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdFileReadStream* OMNI_PVD_CALL createOmniPvdFileReadStream() +{ + return new OmniPvdFileReadStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileReadStream(OmniPvdFileReadStream *readStream) +{ + OmniPvdFileReadStreamImpl *impl = (OmniPvdFileReadStreamImpl*)readStream; + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdFileWriteStream* OMNI_PVD_CALL createOmniPvdFileWriteStream() +{ + return new OmniPvdFileWriteStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdFileWriteStream(OmniPvdFileWriteStream *writeStream) +{ + OmniPvdFileWriteStreamImpl *impl = (OmniPvdFileWriteStreamImpl*)writeStream; + delete impl; +} + +OMNI_PVD_EXPORT OmniPvdMemoryStream* OMNI_PVD_CALL createOmniPvdMemoryStream() +{ + return new OmniPvdMemoryStreamImpl(); +} + +OMNI_PVD_EXPORT void OMNI_PVD_CALL destroyOmniPvdMemoryStream(OmniPvdMemoryStream *memoryStream) +{ + OmniPvdMemoryStreamImpl *impl = (OmniPvdMemoryStreamImpl*)memoryStream; + delete impl; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.cpp new file mode 100644 index 0000000..7951aa7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.cpp @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdLog.h" + +#include +#include + +OmniPvdLog::OmniPvdLog() +{ + mLogFunction = 0; +} + +OmniPvdLog::~OmniPvdLog() +{ +} + +void OmniPvdLog::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLogFunction = logFunction; +} + +void OmniPvdLog::outputLine(const char* fmt, ...) +{ + if (!mLogFunction) return; + char logLineBuff[2048]; + va_list args; + va_start(args, fmt); + vsprintf(logLineBuff, fmt, args); + va_end(args); + mLogFunction(logLineBuff); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.h new file mode 100644 index 0000000..f7af840 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdLog.h @@ -0,0 +1,43 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_LOG_H +#define OMNI_PVD_LOG_H + +#include "OmniPvdDefines.h" + +class OmniPvdLog { +public: + OmniPvdLog(); + ~OmniPvdLog(); + void setLogFunction(OmniPvdLogFunction logFunction); + void outputLine(const char* fmt, ...); + OmniPvdLogFunction mLogFunction; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp new file mode 100644 index 0000000..f907b5d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.cpp @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryReadStreamImpl.h" + +OmniPvdMemoryReadStreamImpl::OmniPvdMemoryReadStreamImpl() +{ +} + +OmniPvdMemoryReadStreamImpl::~OmniPvdMemoryReadStreamImpl() +{ +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes) +{ + return mMemoryStream->readBytes(destination, nbrBytes); +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::skipBytes(const uint64_t nbrBytes) +{ + return mMemoryStream->skipBytes(nbrBytes); +} + +bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::openStream() +{ + return true; +} + +bool OMNI_PVD_CALL OmniPvdMemoryReadStreamImpl::closeStream() +{ + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h new file mode 100644 index 0000000..49d6cf6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryReadStreamImpl.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_MEMORY_READ_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_READ_STREAM_IMPL_H + +#include "OmniPvdReadStream.h" + +class OmniPvdMemoryStreamImpl; + +class OmniPvdMemoryReadStreamImpl : public OmniPvdReadStream +{ +public: + OmniPvdMemoryReadStreamImpl(); + ~OmniPvdMemoryReadStreamImpl(); + + uint64_t OMNI_PVD_CALL readBytes(uint8_t* destination, const uint64_t nbrBytes); + uint64_t OMNI_PVD_CALL skipBytes(const uint64_t nbrBytes); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + OmniPvdMemoryStreamImpl* mMemoryStream; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp new file mode 100644 index 0000000..a58345a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.cpp @@ -0,0 +1,202 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryReadStreamImpl.h" +#include "OmniPvdMemoryWriteStreamImpl.h" +#include + +OmniPvdMemoryStreamImpl::OmniPvdMemoryStreamImpl() +{ + mReadStream = 0; + mWriteStream = 0; + + mBuffer = 0; + mBufferLength = 0; + mWrittenBytes = 0; + mWritePosition = 0; + mReadPosition = 0; + + mReadStream = new OmniPvdMemoryReadStreamImpl(); + mReadStream->mMemoryStream = this; + + mWriteStream = new OmniPvdMemoryWriteStreamImpl(); + mWriteStream->mMemoryStream = this; +} + +OmniPvdMemoryStreamImpl::~OmniPvdMemoryStreamImpl() +{ + delete[] mBuffer; + delete mReadStream; + delete mWriteStream; +} + +OmniPvdReadStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getReadStream() +{ + return mReadStream; +} + +OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdMemoryStreamImpl::getWriteStream() +{ + return mWriteStream; +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::setBufferSize(uint64_t bufferLength) +{ + if (bufferLength < mBufferLength) + { + return mBufferLength; + } + delete[] mBuffer; + mBuffer = new uint8_t[bufferLength]; + mBufferLength = bufferLength; + mWrittenBytes = 0; + mWritePosition = 0; + mReadPosition = 0; + return bufferLength; +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryStreamImpl::readBytes(uint8_t* destination, uint64_t nbrBytes) +{ + if (mWrittenBytes < 1) return 0; + + //////////////////////////////////////////////////////////////////////////////// + // Limit the number of bytes requested to requestedReadBytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t requestedReadBytes = nbrBytes; + if (requestedReadBytes > mBufferLength) + { + requestedReadBytes = mBufferLength; + } + if (requestedReadBytes > mWrittenBytes) + { + return 0; + } + + //////////////////////////////////////////////////////////////////////////////// + // Separate the reading of bytes into two operations: + // tail bytes : bytes from mReadPosition until maximum the end of the buffer + // head bytes : bytes from start of the buffer until maximum the mReadPosition-1 + //////////////////////////////////////////////////////////////////////////////// + + //////////////////////////////////////////////////////////////////////////////// + // Tail bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t tailBytes = mBufferLength - mReadPosition; + if (tailBytes > requestedReadBytes) + { + tailBytes = requestedReadBytes; + } + if (destination) + { + memcpy(destination, mBuffer + mReadPosition, tailBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Head bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t headBytes = requestedReadBytes - tailBytes; + if (destination) + { + memcpy(destination + tailBytes, mBuffer, headBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Update the internal parameters : mReadPosition and mWrittenBytes + //////////////////////////////////////////////////////////////////////////////// + mReadPosition += requestedReadBytes; + if (mReadPosition >= mBufferLength) + { + mReadPosition -= mBufferLength; + } + mWrittenBytes -= requestedReadBytes; + return requestedReadBytes; +} + +uint64_t OmniPvdMemoryStreamImpl::skipBytes(const uint64_t nbrBytes) +{ + return readBytes(0, nbrBytes); +} + +uint64_t OmniPvdMemoryStreamImpl::writeBytes(const uint8_t* source, const uint64_t nbrBytes) +{ + if (mWrittenBytes >= mBufferLength) + { + return 0; + } + + //////////////////////////////////////////////////////////////////////////////// + // Limit the number of bytes requested to requestedWriteBytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t requestedWriteBytes = nbrBytes; + if (requestedWriteBytes > mBufferLength) + { + requestedWriteBytes = mBufferLength; + } + uint64_t writeBytesLeft = mBufferLength - mWrittenBytes; + if (requestedWriteBytes > writeBytesLeft) + { + return 0; + //requestedWriteBytes = writeBytesLeft; + } + + //////////////////////////////////////////////////////////////////////////////// + // Tail bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t tailBytes = mBufferLength - mWritePosition; + if (tailBytes > requestedWriteBytes) + { + tailBytes = requestedWriteBytes; + } + if (source) + { + memcpy(mBuffer + mWritePosition, source, tailBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Head bytes + //////////////////////////////////////////////////////////////////////////////// + uint64_t headBytes = requestedWriteBytes - tailBytes; + if (source) + { + memcpy(mBuffer, source + tailBytes, headBytes); + } + //////////////////////////////////////////////////////////////////////////////// + // Update the internal parameters : mReadPosition and mWrittenBytes + //////////////////////////////////////////////////////////////////////////////// + mWritePosition += requestedWriteBytes; + if (mWritePosition >= mBufferLength) + { + mWritePosition -= mBufferLength; + } + mWrittenBytes += requestedWriteBytes; + return requestedWriteBytes; +} + +bool OmniPvdMemoryStreamImpl::flush() +{ + return true; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h new file mode 100644 index 0000000..7b5ce9e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryStreamImpl.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_MEMORY_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_STREAM_IMPL_H + +#include "OmniPvdMemoryStream.h" + +class OmniPvdMemoryReadStreamImpl; +class OmniPvdMemoryWriteStreamImpl; + +class OmniPvdMemoryStreamImpl : public OmniPvdMemoryStream +{ +public: + OmniPvdMemoryStreamImpl(); + ~OmniPvdMemoryStreamImpl(); + + OmniPvdReadStream* OMNI_PVD_CALL getReadStream(); + OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream(); + uint64_t OMNI_PVD_CALL setBufferSize(uint64_t bufferLength); + + //////////////////////////////////////////////////////////////////////////////// + // Read part + //////////////////////////////////////////////////////////////////////////////// + uint64_t readBytes(uint8_t* destination, uint64_t nbrBytes); + uint64_t skipBytes(const uint64_t nbrBytes); + + //////////////////////////////////////////////////////////////////////////////// + // Write part + //////////////////////////////////////////////////////////////////////////////// + uint64_t writeBytes(const uint8_t* source, const uint64_t nbrBytes); + bool flush(); + + //////////////////////////////////////////////////////////////////////////////// + // Read/write streams + //////////////////////////////////////////////////////////////////////////////// + OmniPvdMemoryReadStreamImpl *mReadStream; + OmniPvdMemoryWriteStreamImpl *mWriteStream; + + //////////////////////////////////////////////////////////////////////////////// + // Round robin buffer + //////////////////////////////////////////////////////////////////////////////// + uint8_t *mBuffer; + uint64_t mBufferLength; + uint64_t mWrittenBytes; + uint64_t mWritePosition; + uint64_t mReadPosition; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp new file mode 100644 index 0000000..262cca3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.cpp @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdMemoryStreamImpl.h" +#include "OmniPvdMemoryWriteStreamImpl.h" + +OmniPvdMemoryWriteStreamImpl::OmniPvdMemoryWriteStreamImpl() +{ +} + +OmniPvdMemoryWriteStreamImpl::~OmniPvdMemoryWriteStreamImpl() +{ +} + +uint64_t OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::writeBytes(const uint8_t* source, const uint64_t nbrBytes) +{ + return mMemoryStream->writeBytes(source, nbrBytes); +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::flush() +{ + return mMemoryStream->flush(); +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::openStream() +{ + return true; +} + +bool OMNI_PVD_CALL OmniPvdMemoryWriteStreamImpl::closeStream() +{ + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h new file mode 100644 index 0000000..11c2560 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdMemoryWriteStreamImpl.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H +#define OMNI_PVD_MEMORY_WRITE_STREAM_IMPL_H + +#include "OmniPvdWriteStream.h" + +class OmniPvdMemoryStreamImpl; + +class OmniPvdMemoryWriteStreamImpl : public OmniPvdWriteStream +{ +public: + OmniPvdMemoryWriteStreamImpl(); + ~OmniPvdMemoryWriteStreamImpl(); + uint64_t OMNI_PVD_CALL writeBytes(const uint8_t* source, const uint64_t nbrBytes); + bool OMNI_PVD_CALL flush(); + bool OMNI_PVD_CALL openStream(); + bool OMNI_PVD_CALL closeStream(); + + OmniPvdMemoryStreamImpl *mMemoryStream; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.cpp new file mode 100644 index 0000000..3951486 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.cpp @@ -0,0 +1,416 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdReaderImpl.h" + +#include + +OmniPvdReaderImpl::OmniPvdReaderImpl() +{ + mMajorVersion = OMNI_PVD_VERSION_MAJOR; + mMinorVersion = OMNI_PVD_VERSION_MINOR; + mPatch = OMNI_PVD_VERSION_PATCH; + mCmdType = OmniPvdCommandEnum::eOmniPvdInvalid; + mDataBuffer = 0; + mDataBuffAllocatedLen = 0; + mCmdAttributeDataPtr = 0; + mIsReadingStarted = false; + mReadBaseClassHandle = 1; +} + +OmniPvdReaderImpl::~OmniPvdReaderImpl() +{ + mCmdAttributeDataPtr = 0; + delete[] mDataBuffer; + mDataBuffer = 0; + mDataBuffAllocatedLen = 0; +} + +void OMNI_PVD_CALL OmniPvdReaderImpl::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLog.setLogFunction(logFunction); +} + +void OMNI_PVD_CALL OmniPvdReaderImpl::setReadStream(OmniPvdReadStream* stream) +{ + mStream = stream; + mStream->openStream(); +} + +bool OMNI_PVD_CALL OmniPvdReaderImpl::startReading(OmniPvdVersionType* majorVersion, OmniPvdVersionType* minorVersion, OmniPvdVersionType* patch) +{ + if (mIsReadingStarted) + { + return true; + } + if (mStream) + { + mStream->readBytes((uint8_t*)majorVersion, sizeof(OmniPvdVersionType)); + mStream->readBytes((uint8_t*)minorVersion, sizeof(OmniPvdVersionType)); + mStream->readBytes((uint8_t*)patch, sizeof(OmniPvdVersionType)); + + mCmdMajorVersion = *majorVersion; + mCmdMinorVersion = *minorVersion; + mCmdPatch = *patch; + + if ((mCmdMajorVersion == 0) && (mCmdMinorVersion < 3)) + { + mCmdBaseClassHandle = 0; + mReadBaseClassHandle = 0; + } + else + { + mCmdBaseClassHandle = 0; + mReadBaseClassHandle = 1; + } + + mLog.outputLine("OmniPvdRuntimeReaderImpl::startReading majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast(*majorVersion), static_cast(*minorVersion), static_cast(*patch)); + if ((*majorVersion) > mMajorVersion) + { + mLog.outputLine("[parser] major version too new\n"); + return false; + } + else if ((*majorVersion) == mMajorVersion) + { + if ((*minorVersion) > mMinorVersion) + { + mLog.outputLine("[parser] minor version too new\n"); + return false; + } + else if ((*minorVersion) == mMinorVersion) + { + if ((*patch) > mPatch) + { + mLog.outputLine("[parser] patch too new\n"); + return false; + } + } + } + mIsReadingStarted = true; + return true; + } + else { + return false; + } + +} + +OmniPvdCommandEnum::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getNextCommand() +{ + if (!mIsReadingStarted) + { + if (!startReading(&mCmdMajorVersion, &mCmdMinorVersion, &mCmdPatch)) + { + return OmniPvdCommandEnum::eOmniPvdInvalid; + } + } + mCmdType = OmniPvdCommandEnum::eOmniPvdInvalid; + if (mStream) { + unsigned char command; + if (mStream->readBytes(&command, 1)) + { + switch (command) { + case OmniPvdCommandEnum::eOmniPvdRegisterClass: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdRegisterClass; + mStream->readBytes((unsigned char*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + //////////////////////////////////////////////////////////////////////////////// + // Skip reading the base class if the stream is older or equal to (0,2,x) + //////////////////////////////////////////////////////////////////////////////// + if (mReadBaseClassHandle) + { + mStream->readBytes((unsigned char*)&mCmdBaseClassHandle, sizeof(OmniPvdClassHandle)); + } + mStream->readBytes((unsigned char*)&mCmdClassNameLen, sizeof(uint16_t)); + mStream->readBytes((unsigned char*)mCmdClassName, mCmdClassNameLen); + mCmdClassName[mCmdClassNameLen] = 0; // trailing zero + mLog.outputLine("[parser] register class (handle: %llu, name: %s)\n", static_cast(mCmdClassHandle), mCmdClassName); + } + break; + case OmniPvdCommandEnum::eOmniPvdRegisterAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdRegisterAttribute; + mStream->readBytes((unsigned char*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeDataType, sizeof(OmniPvdAttributeDataType)); + if (mCmdAttributeDataType == OmniPvdDataTypeEnum::eENUM_VALUE) + { + mStream->readBytes((unsigned char*)&mCmdEnumValue, sizeof(uint32_t)); + } + else if (mCmdAttributeDataType == OmniPvdDataTypeEnum::eFLAGS_WORD) + { + mStream->readBytes((unsigned char*)&mCmdEnumClassHandle, sizeof(uint32_t)); + } + else + { + mCmdEnumValue = 0; + mStream->readBytes((unsigned char*)&mCmdAttributeNbrFields, sizeof(uint32_t)); + } + mStream->readBytes((unsigned char*)&mCmdAttributeNameLen, sizeof(uint16_t)); + mStream->readBytes((unsigned char*)mCmdAttributeName, mCmdAttributeNameLen); + mCmdAttributeName[mCmdAttributeNameLen] = 0; // trailing zero + mLog.outputLine("[parser] register attribute (classHandle: %llu, handle: %llu, dataType: %llu, nrFields: %llu, name: %s)\n", static_cast(mCmdClassHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeDataType), static_cast(mCmdAttributeNbrFields), mCmdAttributeName); + } + break; + case OmniPvdCommandEnum::eOmniPvdRegisterClassAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdRegisterClassAttribute; + mStream->readBytes((unsigned char*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeNameLen, sizeof(uint16_t)); + mStream->readBytes((unsigned char*)mCmdAttributeName, mCmdAttributeNameLen); + mCmdAttributeName[mCmdAttributeNameLen] = 0; // trailing zero + mLog.outputLine("[parser] register class attribute (classHandle: %llu, handle: %llu, classAttributeHandle: %llu, name: %s)\n", static_cast(mCmdClassHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeClassHandle), mCmdAttributeName); + } + break; + case OmniPvdCommandEnum::eOmniPvdRegisterSetAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdRegisterSetAttribute; + mStream->readBytes((unsigned char*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeDataType, sizeof(OmniPvdAttributeDataType)); + mStream->readBytes((unsigned char*)&mCmdAttributeNameLen, sizeof(uint16_t)); + mStream->readBytes((unsigned char*)mCmdAttributeName, mCmdAttributeNameLen); + mCmdAttributeName[mCmdAttributeNameLen] = 0; // trailing zero + mLog.outputLine("[parser] register attributeSet (classHandle: %llu, handle: %llu, dataType: %llu, name: %s)\n", static_cast(mCmdClassHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeDataType), mCmdAttributeName); + } + break; + case OmniPvdCommandEnum::eOmniPvdSetAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdSetAttribute; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((unsigned char*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] set attribute (contextHandle:%llu, objectHandle: %llu, handle: %llu, dataLen: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdObjectHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeDataLen)); + } + break; + case OmniPvdCommandEnum::eOmniPvdAddToSetAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdAddToSetAttribute; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((unsigned char*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] add to attributeSet (contextHandle:%llu, objectHandle: %llu, attributeHandle: %llu, dataLen: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdObjectHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeDataLen)); + } + break; + case OmniPvdCommandEnum::eOmniPvdRemoveFromSetAttribute: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdRemoveFromSetAttribute; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((unsigned char*)&mCmdAttributeHandleDepth, sizeof(uint8_t)); + uint32_t* attributeHandleStack = mCmdAttributeHandleStack; + for (int i = 0; i < mCmdAttributeHandleDepth; i++) { + mStream->readBytes((unsigned char*)&mCmdAttributeHandle, sizeof(OmniPvdAttributeHandle)); + attributeHandleStack++; + } + mStream->readBytes((unsigned char*)&mCmdAttributeDataLen, sizeof(uint32_t)); + readLongDataFromStream(mCmdAttributeDataLen); + mLog.outputLine("[parser] remove from attributeSet (contextHandle:%llu, objectHandle: %llu, handle: %llu, dataLen: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdObjectHandle), static_cast(mCmdAttributeHandle), static_cast(mCmdAttributeDataLen)); + } + break; + case OmniPvdCommandEnum::eOmniPvdCreateObject: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdCreateObject; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdClassHandle, sizeof(OmniPvdClassHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectNameLen, sizeof(uint16_t)); + if (mCmdObjectNameLen) { + mStream->readBytes((unsigned char*)mCmdObjectName, mCmdObjectNameLen); + } + mCmdObjectName[mCmdObjectNameLen] = 0; // trailing zero + mLog.outputLine("[parser] create object (contextHandle: %llu, classHandle: %llu, objectHandle: %llu, name: %s)\n", static_cast(mCmdContextHandle), static_cast(mCmdClassHandle), static_cast(mCmdObjectHandle), mCmdObjectName); + } + break; + case OmniPvdCommandEnum::eOmniPvdDestroyObject: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdDestroyObject; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdObjectHandle, sizeof(OmniPvdObjectHandle)); + mLog.outputLine("[parser] destroy object (contextHandle: %llu, objectHandle: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdObjectHandle)); + } + break; + case OmniPvdCommandEnum::eOmniPvdStartFrame: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdStartFrame; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdFrameTimeStart, sizeof(uint64_t)); + mLog.outputLine("[parser] start frame (contextHandle: %llu, timeStamp: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdFrameTimeStart)); + } + break; + case OmniPvdCommandEnum::eOmniPvdStopFrame: + { + mCmdType = OmniPvdCommandEnum::eOmniPvdStopFrame; + mStream->readBytes((unsigned char*)&mCmdContextHandle, sizeof(OmniPvdContextHandle)); + mStream->readBytes((unsigned char*)&mCmdFrameTimeStop, sizeof(uint64_t)); + mLog.outputLine("[parser] stop frame (contextHandle: %llu, timeStamp: %llu)\n", static_cast(mCmdContextHandle), static_cast(mCmdFrameTimeStop)); + } + break; + default: + { + } + break; + } + return mCmdType; + } else { + return mCmdType; + } + } + else { + return mCmdType; + } +} + + +OmniPvdCommandEnum::Enum OMNI_PVD_CALL OmniPvdReaderImpl::getCommandType() +{ + return mCmdType; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMajorVersion() +{ + return mCmdMajorVersion; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getMinorVersion() +{ + return mCmdMinorVersion; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getPatch() +{ + return mCmdPatch; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getContextHandle() +{ + return mCmdContextHandle; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getClassHandle() +{ + return mCmdClassHandle; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getBaseClassHandle() +{ + return mCmdBaseClassHandle; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandle() { + return mCmdAttributeHandle; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getObjectHandle() { + return mCmdObjectHandle; +} + +char* OMNI_PVD_CALL OmniPvdReaderImpl::getClassName() { + return mCmdClassName; +} + +char* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeName() { + return mCmdAttributeName; +} + +char* OMNI_PVD_CALL OmniPvdReaderImpl::getObjectName() { + return mCmdObjectName; +} + +uint8_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataPointer() { + return mCmdAttributeDataPtr; +} + +uint16_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataType() { + return mCmdAttributeDataType; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeDataLength() { + return mCmdAttributeDataLen; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberElements() { + return mCmdAttributeNbrFields; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeClassHandle() { + return mCmdAttributeClassHandle; +} + +uint8_t OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeNumberHandles() { + return mCmdAttributeHandleDepth; +} + +uint32_t* OMNI_PVD_CALL OmniPvdReaderImpl::getAttributeHandles() { + return mCmdAttributeHandleStack; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStart() { + return mCmdFrameTimeStart; +} + +uint64_t OMNI_PVD_CALL OmniPvdReaderImpl::getFrameTimeStop() { + return mCmdFrameTimeStop; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdReaderImpl::getEnumClassHandle() +{ + return mCmdEnumClassHandle; +} + +uint32_t OMNI_PVD_CALL OmniPvdReaderImpl::getEnumValue() +{ + return mCmdEnumValue; +} + +void OmniPvdReaderImpl::readLongDataFromStream(uint32_t streamByteLen) { + if (streamByteLen < 1) return; + if (streamByteLen > mDataBuffAllocatedLen) { + delete[] mDataBuffer; + mDataBuffAllocatedLen = (uint32_t)(streamByteLen * 1.3f); + mDataBuffer = new uint8_t[mDataBuffAllocatedLen]; + mCmdAttributeDataPtr = mDataBuffer; + } + mStream->readBytes(mCmdAttributeDataPtr, streamByteLen); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.h new file mode 100644 index 0000000..ebeb85a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdReaderImpl.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_RUNTIME_READER_IMPL_H +#define OMNI_PVD_RUNTIME_READER_IMPL_H + +#include "OmniPvdReader.h" +#include "OmniPvdLog.h" + +class OmniPvdReaderImpl : public OmniPvdReader { +public: + OmniPvdReaderImpl(); + ~OmniPvdReaderImpl(); + + void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction); + void OMNI_PVD_CALL setReadStream(OmniPvdReadStream* stream); + bool OMNI_PVD_CALL startReading(OmniPvdVersionType* majorVersion, OmniPvdVersionType* minorVersion, OmniPvdVersionType* patch); + OmniPvdCommandEnum::Enum OMNI_PVD_CALL getNextCommand(); + OmniPvdCommandEnum::Enum OMNI_PVD_CALL getCommandType(); + + OmniPvdVersionType OMNI_PVD_CALL getMajorVersion(); + OmniPvdVersionType OMNI_PVD_CALL getMinorVersion(); + OmniPvdVersionType OMNI_PVD_CALL getPatch(); + + OmniPvdContextHandle OMNI_PVD_CALL getContextHandle(); + OmniPvdObjectHandle OMNI_PVD_CALL getObjectHandle(); + + OmniPvdClassHandle OMNI_PVD_CALL getClassHandle(); + OmniPvdClassHandle OMNI_PVD_CALL getBaseClassHandle(); + OmniPvdAttributeHandle OMNI_PVD_CALL getAttributeHandle(); + + char* OMNI_PVD_CALL getClassName(); + char* OMNI_PVD_CALL getAttributeName(); + char* OMNI_PVD_CALL getObjectName(); + + uint8_t* OMNI_PVD_CALL getAttributeDataPointer(); + OmniPvdAttributeDataType OMNI_PVD_CALL getAttributeDataType(); + uint32_t OMNI_PVD_CALL getAttributeDataLength(); + uint32_t OMNI_PVD_CALL getAttributeNumberElements(); + OmniPvdClassHandle OMNI_PVD_CALL getAttributeClassHandle(); + + uint8_t OMNI_PVD_CALL getAttributeNumberHandles(); + OmniPvdAttributeHandle* OMNI_PVD_CALL getAttributeHandles(); + + uint64_t OMNI_PVD_CALL getFrameTimeStart(); + uint64_t OMNI_PVD_CALL getFrameTimeStop(); + + OmniPvdClassHandle OMNI_PVD_CALL getEnumClassHandle(); + uint32_t OMNI_PVD_CALL getEnumValue(); + + // Internal helper + void readLongDataFromStream(uint32_t streamByteLen); + + OmniPvdLog mLog; + + OmniPvdReadStream *mStream; + + OmniPvdVersionType mMajorVersion; + OmniPvdVersionType mMinorVersion; + OmniPvdVersionType mPatch; + + OmniPvdCommandEnum::Enum mCmdType; + + OmniPvdVersionType mCmdMajorVersion; + OmniPvdVersionType mCmdMinorVersion; + OmniPvdVersionType mCmdPatch; + + OmniPvdContextHandle mCmdContextHandle; + OmniPvdObjectHandle mCmdObjectHandle; + + uint32_t mCmdClassHandle; + uint32_t mCmdBaseClassHandle; + uint32_t mCmdAttributeHandle; + + //////////////////////////////////////////////////////////////////////////////// + // TODO : take care of buffer length limit at read time! + //////////////////////////////////////////////////////////////////////////////// + char mCmdClassName[1000]; + char mCmdAttributeName[1000]; + char mCmdObjectName[1000]; + + uint16_t mCmdClassNameLen; + uint16_t mCmdAttributeNameLen; + uint16_t mCmdObjectNameLen; + + uint8_t* mCmdAttributeDataPtr; + OmniPvdAttributeDataType mCmdAttributeDataType; + uint32_t mCmdAttributeDataLen; + uint32_t mCmdAttributeNbrFields; + uint32_t mCmdEnumValue; + OmniPvdClassHandle mCmdEnumClassHandle; + OmniPvdClassHandle mCmdAttributeClassHandle; + + OmniPvdAttributeHandle mCmdAttributeHandleStack[32]; + uint8_t mCmdAttributeHandleDepth; + + uint64_t mCmdFrameTimeStart; + uint64_t mCmdFrameTimeStop; + + uint8_t *mDataBuffer; + uint32_t mDataBuffAllocatedLen; + + bool mIsReadingStarted; + uint8_t mReadBaseClassHandle; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.cpp new file mode 100644 index 0000000..4a5aa57 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.cpp @@ -0,0 +1,361 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdWriterImpl.h" +#include "OmniPvdCommands.h" +#include + +OmniPvdWriterImpl::OmniPvdWriterImpl() +{ + mLastClassHandle = 0; + mLastAttributeHandle = 0; + mIsFirstWrite = true; + mStream = 0; +} + +OmniPvdWriterImpl::~OmniPvdWriterImpl() +{ +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setLogFunction(OmniPvdLogFunction logFunction) +{ + mLog.setLogFunction(logFunction); +} + +void OmniPvdWriterImpl::setVersionHelper() +{ + if (mStream && mIsFirstWrite) + { + const OmniPvdVersionType omniPvdVersionMajor = OMNI_PVD_VERSION_MAJOR; + const OmniPvdVersionType omniPvdVersionMinor = OMNI_PVD_VERSION_MINOR; + const OmniPvdVersionType omniPvdVersionPatch = OMNI_PVD_VERSION_PATCH; + setVersion(omniPvdVersionMajor, omniPvdVersionMinor, omniPvdVersionPatch); + } +} + +void OmniPvdWriterImpl::setVersion(const OmniPvdVersionType majorVersion, const OmniPvdVersionType minorVersion, const OmniPvdVersionType patch) +{ + if (mStream && mIsFirstWrite) + { + if (!mStream->openStream()) + { + return; + } + mStream->writeBytes((unsigned char*)&majorVersion, sizeof(OmniPvdVersionType)); + mStream->writeBytes((unsigned char*)&minorVersion, sizeof(OmniPvdVersionType)); + mStream->writeBytes((unsigned char*)&patch, sizeof(OmniPvdVersionType)); + + mLog.outputLine("OmniPvdRuntimeWriterImpl::setVersion majorVersion(%lu), minorVersion(%lu), patch(%lu)", static_cast(majorVersion), static_cast(minorVersion), static_cast(patch)); + + mIsFirstWrite = false; + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setWriteStream(const OmniPvdWriteStream* stream) +{ + mLog.outputLine("OmniPvdRuntimeWriterImpl::setWriteStream"); + mStream = (OmniPvdWriteStream*)stream; +} + +OmniPvdWriteStream* OMNI_PVD_CALL OmniPvdWriterImpl::getWriteStream() +{ + return mStream; +} + +OmniPvdClassHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClass(const char* className, OmniPvdClassHandle baseClass) +{ + setVersionHelper(); + if (mStream) + { + mLog.outputLine("OmniPvdWriterImpl::registerClass className(%s)", className); + + int classNameLen = (int)strlen(className); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterClass; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastClassHandle++; + mStream->writeBytes((unsigned char*)&mLastClassHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&baseClass, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&classNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)className, classNameLen); + return mLastClassHandle; + } else { + return 0; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType, const uint32_t nbrFields) +{ + setVersionHelper(); + if (mStream) { + + mLog.outputLine("OmniPvdWriterImpl::registerAttribute classHandle(%llu), attributeName(%s), attributeDataType(%d), nbrFields(%llu)", static_cast(classHandle), attributeName, static_cast(attributeDataType), static_cast(nbrFields)); + + int attribNameLen = (int)strlen(attributeName); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastAttributeHandle++; + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->writeBytes((unsigned char*)&attributeDataType, sizeof(OmniPvdAttributeDataType)); + mStream->writeBytes((unsigned char*)&nbrFields, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)&attribNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return 0; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerFlagsAttribute(const OmniPvdClassHandle classHandle, const OmniPvdClassHandle enumClassHandle, const char* attributeName) +{ + setVersionHelper(); + if (mStream) { + + mLog.outputLine("OmniPvdWriterImpl::registerFlagsAttribute classHandle(%llu), enumClassHandle(%llu), attributeName(%s)", static_cast(classHandle), static_cast(enumClassHandle), attributeName); + + int attribNameLen = (int)strlen(attributeName); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterAttribute; + const OmniPvdAttributeDataType attributeDataType = OmniPvdDataTypeEnum::eFLAGS_WORD; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastAttributeHandle++; + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->writeBytes((unsigned char*)&attributeDataType, sizeof(OmniPvdAttributeDataType)); + mStream->writeBytes((unsigned char*)&enumClassHandle, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)&attribNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return 0; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerEnumValue(const OmniPvdClassHandle classHandle, const char* attributeName, uint32_t value) +{ + setVersionHelper(); + if (mStream) { + int attribNameLen = (int)strlen(attributeName); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterAttribute; + OmniPvdAttributeDataType attributeDataType = OmniPvdDataTypeEnum::eENUM_VALUE; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastAttributeHandle++; + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->writeBytes((unsigned char*)&attributeDataType, sizeof(OmniPvdAttributeDataType)); + mStream->writeBytes((unsigned char*)&value, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)&attribNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return 0; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerClassAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, OmniPvdClassHandle classAttributeHandle) +{ + setVersionHelper(); + if (mStream) + { + int attribNameLen = (int)strlen(attributeName); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterClassAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastAttributeHandle++; + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->writeBytes((unsigned char*)&classAttributeHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&attribNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else { + return 0; + } +} + +OmniPvdAttributeHandle OMNI_PVD_CALL OmniPvdWriterImpl::registerSetAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType) +{ + setVersionHelper(); + if (mStream) + { + int attribNameLen = (int)strlen(attributeName); + unsigned char command = OmniPvdCommandEnum::eOmniPvdRegisterSetAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mLastAttributeHandle++; + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&mLastAttributeHandle, sizeof(OmniPvdAttributeHandle)); + mStream->writeBytes((unsigned char*)&attributeDataType, sizeof(OmniPvdAttributeDataType)); + mStream->writeBytes((unsigned char*)&attribNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)attributeName, attribNameLen); + return mLastAttributeHandle; + } + else + { + return 0; + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdSetAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&objectHandle, sizeof(OmniPvdObjectHandle)); + mStream->writeBytes((unsigned char*)&handleDepth, sizeof(uint8_t)); + for (int i = 0; i < handleDepth; i++) + { + mStream->writeBytes((unsigned char*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + mStream->writeBytes((unsigned char*)&nbrBytes, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::setAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes) +{ + const uint8_t handleDepth = 1; + setAttribute(contextHandle, objectHandle, handleDepth, &attributeHandle, data, nbrBytes); +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::addToSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdAddToSetAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&objectHandle, sizeof(OmniPvdObjectHandle)); + mStream->writeBytes((unsigned char*)&handleDepth, sizeof(uint8_t)); + for (int i = 0; i < handleDepth; i++) + { + mStream->writeBytes((unsigned char*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + mStream->writeBytes((unsigned char*)&nbrBytes, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::addToSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes) +{ + const uint8_t handleDepth = 1; + addToSetAttribute(contextHandle, objectHandle, handleDepth, &attributeHandle, data, nbrBytes); +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::removeFromSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdRemoveFromSetAttribute; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&objectHandle, sizeof(OmniPvdObjectHandle)); + mStream->writeBytes((unsigned char*)&handleDepth, sizeof(uint8_t)); + for (int i = 0; i < handleDepth; i++) + { + mStream->writeBytes((unsigned char*)attributeHandles, sizeof(OmniPvdAttributeHandle)); + attributeHandles++; + } + mStream->writeBytes((unsigned char*)&nbrBytes, sizeof(uint32_t)); + mStream->writeBytes((unsigned char*)data, nbrBytes); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::removeFromSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes) +{ + const uint8_t handleDepth = 1; + removeFromSetAttribute(contextHandle, objectHandle, handleDepth, &attributeHandle, data, nbrBytes); +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::createObject(const OmniPvdContextHandle contextHandle, const OmniPvdClassHandle classHandle, const OmniPvdObjectHandle objectHandle, const char* objectName) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdCreateObject; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&classHandle, sizeof(OmniPvdClassHandle)); + mStream->writeBytes((unsigned char*)&objectHandle, sizeof(OmniPvdObjectHandle)); + int objectNameLen = 0; + if (objectName) + { + objectNameLen = (int)strlen(objectName); + mStream->writeBytes((unsigned char*)&objectNameLen, sizeof(uint16_t)); + mStream->writeBytes((unsigned char*)objectName, objectNameLen); + } + else + { + mStream->writeBytes((unsigned char*)&objectNameLen, sizeof(uint16_t)); + } + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::destroyObject(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdDestroyObject; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&objectHandle, sizeof(OmniPvdObjectHandle)); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::startFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdStartFrame; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&timeStamp, sizeof(uint64_t)); + } +} + +void OMNI_PVD_CALL OmniPvdWriterImpl::stopFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp) +{ + setVersionHelper(); + if (mStream) + { + unsigned char command = OmniPvdCommandEnum::eOmniPvdStopFrame; + mStream->writeBytes(&command, sizeof(uint8_t)); + mStream->writeBytes((unsigned char*)&contextHandle, sizeof(OmniPvdContextHandle)); + mStream->writeBytes((unsigned char*)&timeStamp, sizeof(uint64_t)); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.h new file mode 100644 index 0000000..e575fac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/pvdruntime/src/OmniPvdWriterImpl.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_WRITER_IMPL_H +#define OMNI_PVD_WRITER_IMPL_H + +#include "OmniPvdWriter.h" +#include "OmniPvdLog.h" + +class OmniPvdWriterImpl : public OmniPvdWriter { +public: + OmniPvdWriterImpl(); + ~OmniPvdWriterImpl(); + void OMNI_PVD_CALL setLogFunction(OmniPvdLogFunction logFunction); + void setVersionHelper(); + void setVersion(const OmniPvdVersionType majorVersion, const OmniPvdVersionType minorVersion, const OmniPvdVersionType patch); + void OMNI_PVD_CALL setWriteStream(const OmniPvdWriteStream* stream); + OmniPvdWriteStream* OMNI_PVD_CALL getWriteStream(); + + OmniPvdClassHandle OMNI_PVD_CALL registerClass(const char* className, OmniPvdClassHandle baseClass); + OmniPvdAttributeHandle OMNI_PVD_CALL registerEnumValue(const OmniPvdClassHandle classHandle, const char* attributeName, const uint32_t value); + OmniPvdAttributeHandle OMNI_PVD_CALL registerAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType, const uint32_t nbrFields); + OmniPvdAttributeHandle OMNI_PVD_CALL registerFlagsAttribute(const OmniPvdClassHandle classHandle, const OmniPvdClassHandle enumClassHandle, const char* attributeName); + OmniPvdAttributeHandle OMNI_PVD_CALL registerClassAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdClassHandle classAttributeHandle); + OmniPvdAttributeHandle OMNI_PVD_CALL registerSetAttribute(const OmniPvdClassHandle classHandle, const char* attributeName, const OmniPvdAttributeDataType attributeDataType); + void OMNI_PVD_CALL setAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes); + void OMNI_PVD_CALL setAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t *data, const uint32_t nbrBytes); + + void OMNI_PVD_CALL addToSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes); + void OMNI_PVD_CALL addToSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes); + + void OMNI_PVD_CALL removeFromSetAttribute(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const uint8_t handleDepth, const OmniPvdAttributeHandle* attributeHandles, const uint8_t* data, const uint32_t nbrBytes); + void OMNI_PVD_CALL removeFromSetAttributeShallow(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle, const OmniPvdAttributeHandle attributeHandle, const uint8_t* data, const uint32_t nbrBytes); + + void OMNI_PVD_CALL createObject(const OmniPvdContextHandle contextHandle, const OmniPvdClassHandle classHandle, const OmniPvdObjectHandle objectHandle, const char* objectName); + void OMNI_PVD_CALL destroyObject(const OmniPvdContextHandle contextHandle, const OmniPvdObjectHandle objectHandle); + void OMNI_PVD_CALL startFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp); + void OMNI_PVD_CALL stopFrame(const OmniPvdContextHandle contextHandle, const uint64_t timeStamp); + + bool mIsFirstWrite; + OmniPvdLog mLog; + OmniPvdWriteStream *mStream; + int mLastClassHandle; + int mLastAttributeHandle;}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsLoadLibrary.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsLoadLibrary.h new file mode 100644 index 0000000..6078048 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsLoadLibrary.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef CM_WINDOWS_LOADLIBRARY_H +#define CM_WINDOWS_LOADLIBRARY_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "common/windows/PxWindowsDelayLoadHook.h" + +#ifdef PX_SECURE_LOAD_LIBRARY +#include "nvSecureLoadLibrary.h" +#endif + + +namespace physx +{ +namespace Cm +{ + EXTERN_C IMAGE_DOS_HEADER __ImageBase; + + PX_INLINE HMODULE WINAPI loadLibrary(const char* name) + { +#ifdef PX_SECURE_LOAD_LIBRARY + HMODULE retVal = nvLoadSignedLibrary(name,true); + if(!retVal) + { + exit(1); + } + return retVal; +#else + return ::LoadLibraryA( name ); +#endif + }; + + PX_INLINE FARPROC WINAPI physXCommonDliNotePreLoadLibrary(const char* libraryName, const physx::PxDelayLoadHook* delayLoadHook) + { + if(!delayLoadHook) + { + return (FARPROC)loadLibrary(libraryName); + } + else + { + if(strstr(libraryName, "PhysXFoundation")) + { + return (FARPROC)Cm::loadLibrary(delayLoadHook->getPhysXFoundationDllName()); + } + + if(strstr(libraryName, "PhysXCommon")) + { + return (FARPROC)Cm::loadLibrary(delayLoadHook->getPhysXCommonDllName()); + } + } + return NULL; + } +} // namespace Cm +} // namespace physx + + +#endif // CM_WINDOWS_LOADLIBRARY_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsModuleUpdateLoader.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsModuleUpdateLoader.h new file mode 100644 index 0000000..86641ab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/include/windows/CmWindowsModuleUpdateLoader.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef CM_WINDOWS_MODULEUPDATELOADER_H +#define CM_WINDOWS_MODULEUPDATELOADER_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "common/PxPhysXCommonConfig.h" + + +namespace physx +{ +namespace Cm +{ + +#if PX_X64 +#define UPDATE_LOADER_DLL_NAME "PhysXUpdateLoader64.dll" +#else +#define UPDATE_LOADER_DLL_NAME "PhysXUpdateLoader.dll" +#endif + +class PX_PHYSX_COMMON_API CmModuleUpdateLoader +{ +public: + CmModuleUpdateLoader(const char* updateLoaderDllName); + + ~CmModuleUpdateLoader(); + + // Loads the given module through the update loader. Loads it from the path if + // the update loader doesn't find the requested module. Returns NULL if no + // module found. + HMODULE LoadModule(const char* moduleName, const char* appGUID); + +protected: + HMODULE mUpdateLoaderDllHandle; + FARPROC mGetUpdatedModuleFunc; +}; +} // namespace Cm +} // namespace physx + + +#endif // CM_WINDOWS_MODULEUPDATELOADER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmBlockArray.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmBlockArray.h new file mode 100644 index 0000000..491a713 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmBlockArray.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_BLOCK_ARRAY_H +#define CM_BLOCK_ARRAY_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMath.h" +#include "foundation/PxMemory.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxArray.h" + +namespace physx +{ +namespace Cm +{ + +template +class BlockArray +{ + PxArray mBlocks; + PxU32 mSize; + PxU32 mCapacity; + +public: + + BlockArray() : mSize(0), mCapacity(0) + { + } + + ~BlockArray() + { + for (PxU32 a = 0; a < mBlocks.size(); ++a) + { + for (PxU32 i = 0; i < SlabSize; ++i) + { + mBlocks[a][i].~T(); + } + PX_FREE(mBlocks[a]); + } + mBlocks.resize(0); + } + + void reserve(PxU32 capacity) + { + if (capacity > mCapacity) + { + PxU32 nbSlabsRequired = (capacity + SlabSize - 1) / SlabSize; + + PxU32 nbSlabsToAllocate = nbSlabsRequired - mBlocks.size(); + + mCapacity += nbSlabsToAllocate * SlabSize; + + for (PxU32 a = 0; a < nbSlabsToAllocate; ++a) + { + T* ts = reinterpret_cast(PX_ALLOC(sizeof(T) * SlabSize, "BlockArray")); + for(PxU32 i = 0; i < SlabSize; ++i) + PX_PLACEMENT_NEW(ts+i, T)(); + mBlocks.pushBack(ts); + } + } + } + + void resize(PxU32 size) + { + reserve(size); + for (PxU32 a = mSize; a < size; ++a) + { + mBlocks[a / SlabSize][a&(SlabSize - 1)].~T(); + mBlocks[a / SlabSize][a&(SlabSize-1)] = T(); + } + mSize = size; + } + + void forceSize_Unsafe(PxU32 size) + { + PX_ASSERT(size <= mCapacity); + mSize = size; + } + + void remove(PxU32 idx) + { + PX_ASSERT(idx < mSize); + for (PxU32 a = idx; a < mSize; ++a) + { + mBlocks[a / SlabSize][a&(SlabSize-1)] = mBlocks[(a + 1) / SlabSize][(a + 1) &(SlabSize-1)]; + } + + mSize--; + mBlocks[mSize / SlabSize][mSize&(SlabSize - 1)].~T(); + } + + void replaceWithLast(PxU32 idx) + { + PX_ASSERT(idx < mSize); + --mSize; + mBlocks[idx / SlabSize][idx%SlabSize] = mBlocks[mSize / SlabSize][mSize%SlabSize]; + } + + T& operator [] (const PxU32 idx) + { + PX_ASSERT(idx < mSize); + + return mBlocks[idx / SlabSize][idx%SlabSize]; + } + + const T& operator [] (const PxU32 idx) const + { + PX_ASSERT(idx < mSize); + + return mBlocks[idx / SlabSize][idx%SlabSize]; + } + + void pushBack(const T& item) + { + reserve(mSize + 1); + mBlocks[mSize / SlabSize][mSize%SlabSize] = item; + mSize++; + } + + PxU32 capacity() const { return mCapacity; } + + PxU32 size() const { return mSize; } +}; + +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp new file mode 100644 index 0000000..fd2f947 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.cpp @@ -0,0 +1,215 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CmCollection.h" + +using namespace physx; +using namespace Cm; + +void Collection::add(PxBase& object, PxSerialObjectId id) +{ + PxSerialObjectId originId = getId(object); + if( originId != PX_SERIAL_OBJECT_ID_INVALID) + { + if( originId != id) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxCollection::add called for an object that has an associated id already present in the collection!"); + } + return; + } + + if(id != PX_SERIAL_OBJECT_ID_INVALID) + { + if(!mIds.insert(id, &object)) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxCollection::add called with an id which is already used in the collection"); + return; + } + } + + mObjects[&object] = id; +} + +void Collection::remove(PxBase& object) +{ + PX_CHECK_AND_RETURN(contains(object), "PxCollection::remove called for an object not contained in the collection!"); + + const ObjectToIdMap::Entry* e = mObjects.find(&object); + if(e) + { + mIds.erase(e->second); + mObjects.erase(&object); + } +} + +bool Collection::contains(PxBase& object) const +{ + return mObjects.find(&object) != NULL; +} + +void Collection::addId(PxBase& object, PxSerialObjectId id) +{ + PX_CHECK_AND_RETURN(contains(object), "PxCollection::addId called for object that is not contained in the collection!"); + PX_CHECK_AND_RETURN(id != PX_SERIAL_OBJECT_ID_INVALID, "PxCollection::addId called with PxSerialObjectId being set to PX_SERIAL_OBJECT_ID_INVALID!"); + PX_CHECK_AND_RETURN(mIds.find(id) == NULL, "PxCollection::addId called with an id which is already used in the collection!"); + + const ObjectToIdMap::Entry* e = mObjects.find(&object); + if(e && e->second != PX_SERIAL_OBJECT_ID_INVALID) + mIds.erase(e->second); + + mIds.insert(id, &object); + mObjects[&object] = id; +} + +void Collection::removeId(PxSerialObjectId id) +{ + PX_CHECK_AND_RETURN(id != PX_SERIAL_OBJECT_ID_INVALID, "PxCollection::removeId called with PxSerialObjectId being set to PX_SERIAL_OBJECT_ID_INVALID!"); + PX_CHECK_AND_RETURN(mIds.find(id), "PxCollection::removeId called with PxSerialObjectId not contained in the collection!"); + const IdToObjectMap::Entry* e = mIds.find(id); + if(e) + { + mObjects[e->second] = PX_SERIAL_OBJECT_ID_INVALID; + mIds.erase(id); + } +} + +PxBase* Collection::find(PxSerialObjectId id) const +{ + PX_CHECK_AND_RETURN_NULL(id != PX_SERIAL_OBJECT_ID_INVALID, "PxCollection::find called with PxSerialObjectId being set to PX_SERIAL_OBJECT_ID_INVALID!"); + const IdToObjectMap::Entry* e = mIds.find(id); + return e ? static_cast(e->second) : NULL; +} + +void Collection::add(PxCollection& _collection) +{ + Collection& collection = static_cast(_collection); + PX_CHECK_AND_RETURN(this != &collection, "PxCollection::add(PxCollection&) called with itself!"); + + mObjects.reserve(mObjects.capacity() + collection.mObjects.size()); + const ObjectToIdMap::Entry* e = collection.mObjects.getEntries(); + for (PxU32 i = 0; i < collection.mObjects.size(); ++i) + { + PxSerialObjectId id = e[i].second; + if( id != PX_SERIAL_OBJECT_ID_INVALID) + { + if(!mIds.insert(id, e[i].first)) + { + if(mIds[id] != e[i].first) + { + PX_CHECK_MSG( false, "PxCollection::add(PxCollection&) called with conflicting id!"); + mObjects.insert(e[i].first, PX_SERIAL_OBJECT_ID_INVALID); + } + } + else + mObjects[ e[i].first ] = id; + } + else + mObjects.insert(e[i].first, PX_SERIAL_OBJECT_ID_INVALID); + } +} + +void Collection::remove(PxCollection& _collection) +{ + Collection& collection = static_cast(_collection); + PX_CHECK_AND_RETURN(this != &collection, "PxCollection::remove(PxCollection&) called with itself!"); + + const ObjectToIdMap::Entry* e = collection.mObjects.getEntries(); + for (PxU32 i = 0; i < collection.mObjects.size(); ++i) + { + const ObjectToIdMap::Entry* e1 = mObjects.find(e[i].first); + if(e1) + { + mIds.erase(e1->second); + mObjects.erase(e1->first); + } + } +} + +PxU32 Collection::getNbObjects() const +{ + return mObjects.size(); +} + +PxBase& Collection::getObject(PxU32 index) const +{ + PX_ASSERT(index < mObjects.size()); + return *mObjects.getEntries()[index].first; +} + +PxU32 Collection::getObjects(PxBase** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PX_CHECK_AND_RETURN_NULL(userBuffer != NULL, "PxCollection::getObjects called with userBuffer NULL!"); + PX_CHECK_AND_RETURN_NULL(bufferSize != 0, "PxCollection::getObjects called with bufferSize 0!"); + PxU32 dstIndex = 0; + const ObjectToIdMap::Entry* e = mObjects.getEntries(); + for (PxU32 srcIndex = startIndex; srcIndex < mObjects.size() && dstIndex < bufferSize; ++srcIndex) + userBuffer[dstIndex++] = e[srcIndex].first; + + return dstIndex; +} + +PxU32 Collection::getNbIds() const +{ + return mIds.size(); +} + +PxSerialObjectId Collection::getId(const PxBase& object) const +{ + const ObjectToIdMap::Entry* e = mObjects.find(const_cast(&object)); + return e ? e->second : PX_SERIAL_OBJECT_ID_INVALID; +} + +PxU32 Collection::getIds(PxSerialObjectId* userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PX_CHECK_AND_RETURN_NULL(userBuffer != NULL, "PxCollection::getIds called with userBuffer NULL!"); + PX_CHECK_AND_RETURN_NULL(bufferSize != 0, "PxCollection::getIds called with bufferSize 0!"); + PxU32 dstIndex = 0; + + IdToObjectMap::Iterator srcIt = (const_cast(mIds)).getIterator(); + + while (!srcIt.done() && dstIndex < bufferSize) + { + if(srcIt->first != PX_SERIAL_OBJECT_ID_INVALID) + { + if(startIndex > 0) + startIndex--; + else + userBuffer[dstIndex++] = srcIt->first; + } + srcIt++; + } + + return dstIndex; +} + +PxCollection* PxCreateCollection() +{ + return PX_NEW(Collection); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.h new file mode 100644 index 0000000..4cadc9a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmCollection.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_COLLECTION_H +#define CM_COLLECTION_H + +#include "common/PxCollection.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxAllocator.h" + +namespace physx +{ +namespace Cm +{ + template , + class Allocator = PxAllocator > + class CollectionHashMap : public PxCoalescedHashMap< Key, Value, HashFn, Allocator> + { + typedef physx::PxHashMapBase< Key, Value, HashFn, Allocator> MapBase; + typedef PxPair EntryData; + + public: + CollectionHashMap(PxU32 initialTableSize = 64, float loadFactor = 0.75f): + PxCoalescedHashMap< Key, Value, HashFn, Allocator>(initialTableSize,loadFactor) {} + + void insertUnique(const Key& k, const Value& v) + { + PX_PLACEMENT_NEW(MapBase::mBase.insertUnique(k), EntryData)(k,v); + } + }; + + class Collection : public PxCollection, public PxUserAllocated + { + public: + typedef CollectionHashMap ObjectToIdMap; + typedef CollectionHashMap IdToObjectMap; + + virtual void add(PxBase& object, PxSerialObjectId ref); + virtual void remove(PxBase& object); + virtual bool contains(PxBase& object) const; + virtual void addId(PxBase& object, PxSerialObjectId id); + virtual void removeId(PxSerialObjectId id); + virtual PxBase* find(PxSerialObjectId ref) const; + virtual void add(PxCollection& collection); + virtual void remove(PxCollection& collection); + virtual PxU32 getNbObjects() const; + virtual PxBase& getObject(PxU32 index) const; + virtual PxU32 getObjects(PxBase** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + virtual PxU32 getNbIds() const; + virtual PxSerialObjectId getId(const PxBase& object) const; + virtual PxU32 getIds(PxSerialObjectId* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + void release() { PX_DELETE_THIS; } + + // Only for internal use. Bypasses virtual calls, specialized behaviour. + PX_INLINE void internalAdd(PxBase* s, PxSerialObjectId id = PX_SERIAL_OBJECT_ID_INVALID) { mObjects.insertUnique(s, id); } + PX_INLINE PxU32 internalGetNbObjects() const { return mObjects.size(); } + PX_INLINE PxBase* internalGetObject(PxU32 i) const { PX_ASSERT(i1e-6f); + return (tan1+tan2)/(1-tan1*tan2); + } + + PX_FORCE_INLINE float computeAxisAndError(const PxVec3& r, const PxVec3& d, const PxVec3& twistAxis, PxVec3& axis) + { + // the point on the cone defined by the tanQ swing vector r + // this code is equal to quatFromTanQVector(r).rotate(PxVec3(1.0f, 0.0f, 0.0f); + PxVec3 p(1.f,0,0); + PxReal r2 = r.dot(r), a = 1-r2, b = 1/(1+r2), b2 = b*b; + PxReal v1 = 2*a*b2; + PxVec3 v2(a, 2*r.z, -2*r.y); // a*p + 2*r.cross(p); + PxVec3 coneLine = v1 * v2 - p; // already normalized + + // the derivative of coneLine in the direction d + PxReal rd = r.dot(d); + PxReal dv1 = -4*rd*(3-r2)*b2*b; + PxVec3 dv2(-2*rd, 2*d.z, -2*d.y); + + PxVec3 coneNormal = v1 * dv2 + dv1 * v2; + + axis = coneLine.cross(coneNormal)/coneNormal.magnitude(); + return coneLine.cross(axis).dot(twistAxis); + } + + // this is here because it's used in both LL and Extensions. However, it + // should STAY IN THE SDK CODE BASE because it's SDK-specific + + class ConeLimitHelper + { + public: + ConeLimitHelper(PxReal tanQSwingY, PxReal tanQSwingZ, PxReal tanQPadding) + : mTanQYMax(tanQSwingY), mTanQZMax(tanQSwingZ), mTanQPadding(tanQPadding) {} + + // whether the point is inside the (inwardly) padded cone - if it is, there's no limit + // constraint + + PX_FORCE_INLINE bool contains(const PxVec3& tanQSwing) const + { + PxReal tanQSwingYPadded = tanAdd(PxAbs(tanQSwing.y),mTanQPadding); + PxReal tanQSwingZPadded = tanAdd(PxAbs(tanQSwing.z),mTanQPadding); + return PxSqr(tanQSwingYPadded/mTanQYMax)+PxSqr(tanQSwingZPadded/mTanQZMax) <= 1; + } + + PX_FORCE_INLINE PxVec3 clamp(const PxVec3& tanQSwing, PxVec3& normal) const + { + PxVec3 p = PxEllipseClamp(tanQSwing, PxVec3(0,mTanQYMax,mTanQZMax)); + normal = PxVec3(0, p.y/PxSqr(mTanQYMax), p.z/PxSqr(mTanQZMax)); +#ifdef PX_PARANOIA_ELLIPSE_CHECK + PxReal err = PxAbs(PxSqr(p.y/mTanQYMax) + PxSqr(p.z/mTanQZMax) - 1); + PX_ASSERT(err<1e-3); +#endif + return p; + } + + // input is a swing quat, such that swing.x = twist.y = twist.z = 0, q = swing * twist + // The routine is agnostic to the sign of q.w (i.e. we don't need the minimal-rotation swing) + + // output is an axis such that positive rotation increases the angle outward from the + // limit (i.e. the image of the x axis), the error is the sine of the angular difference, + // positive if the twist axis is inside the cone + + bool getLimit(const PxQuat& swing, PxVec3& axis, PxReal& error) const + { + PX_ASSERT(swing.w>0); + PxVec3 twistAxis = swing.getBasisVector0(); + PxVec3 tanQSwing = PxVec3(0, PxTanHalf(swing.z,swing.w), -PxTanHalf(swing.y,swing.w)); + if(contains(tanQSwing)) + return false; + + PxVec3 normal, clamped = clamp(tanQSwing, normal); + + // rotation vector and ellipse normal + PxVec3 r(0,-clamped.z,clamped.y), d(0, -normal.z, normal.y); + + error = computeAxisAndError(r, d, twistAxis, axis); + + PX_ASSERT(PxAbs(axis.magnitude()-1)<1e-5f); + +#ifdef PX_PARANOIA_ELLIPSE_CHECK + bool inside = PxSqr(tanQSwing.y/mTanQYMax) + PxSqr(tanQSwing.z/mTanQZMax) <= 1; + PX_ASSERT(inside && error>-1e-4f || !inside && error<1e-4f); +#endif + return true; + } + + private: + + + PxReal mTanQYMax, mTanQZMax, mTanQPadding; + }; + + class ConeLimitHelperTanLess + { + public: + ConeLimitHelperTanLess(PxReal swingY, PxReal swingZ, PxReal padding) + : mYMax(swingY), mZMax(swingZ), mPadding(padding) {} + + // whether the point is inside the (inwardly) padded cone - if it is, there's no limit + // constraint + PX_FORCE_INLINE bool contains(const PxVec3& swing) const + { + // padded current swing angles + PxReal swingYPadded = PxAbs(swing.y) + mPadding; + PxReal swingZPadded = PxAbs(swing.z) + mPadding; + // if angle is within ellipse defined by mYMax/mZMax + return PxSqr(swingYPadded/mYMax)+PxSqr(swingZPadded/mZMax) <= 1; + } + + PX_FORCE_INLINE PxVec3 clamp(const PxVec3& swing, PxVec3& normal) const + { + // finds the closest point on the ellipse to a given point + PxVec3 p = PxEllipseClamp(swing, PxVec3(0,mYMax,mZMax)); + // normal to the point on ellipse + normal = PxVec3(0, p.y/PxSqr(mYMax), p.z/PxSqr(mZMax)); +#ifdef PX_PARANOIA_ELLIPSE_CHECK + PxReal err = PxAbs(PxSqr(p.y/mYMax) + PxSqr(p.z/mZMax) - 1); + PX_ASSERT(err<1e-3); +#endif + return p; + } + + // input is a swing quat, such that swing.x = twist.y = twist.z = 0, q = swing * twist + // The routine is agnostic to the sign of q.w (i.e. we don't need the minimal-rotation swing) + + // output is an axis such that positive rotation increases the angle outward from the + // limit (i.e. the image of the x axis), the error is the sine of the angular difference, + // positive if the twist axis is inside the cone + + bool getLimit(const PxQuat& swing, PxVec3& axis, PxReal& error) const + { + PX_ASSERT(swing.w>0); + PxVec3 twistAxis = swing.getBasisVector0(); + // get the angles from the swing quaternion + PxVec3 swingAngle(0.0f, 4 * PxAtan2(swing.y, 1 + swing.w), 4 * PxAtan2(swing.z, 1 + swing.w)); + if(contains(swingAngle)) + return false; + + PxVec3 normal, clamped = clamp(swingAngle, normal); + + // rotation vector and ellipse normal + PxVec3 r(0,PxTan(clamped.y/4),PxTan(clamped.z/4)), d(0, normal.y, normal.z); + + error = computeAxisAndError(r, d, twistAxis, axis); + + PX_ASSERT(PxAbs(axis.magnitude()-1)<1e-5f); + + return true; + } + + private: + PxReal mYMax, mZMax, mPadding; + }; + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmFlushPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmFlushPool.h new file mode 100644 index 0000000..1a2e91e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmFlushPool.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_FLUSH_POOL_H +#define CM_FLUSH_POOL_H + +#include "foundation/Px.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" + +/* +Pool used to allocate variable sized tasks. It's intended to be cleared after a short period (time step). +*/ + +namespace physx +{ +namespace Cm +{ + static const PxU32 sSpareChunkCount = 2; + + class FlushPool + { + PX_NOCOPY(FlushPool) + public: + FlushPool(PxU32 chunkSize) : mChunks("FlushPoolChunk"), mChunkIndex(0), mOffset(0), mChunkSize(chunkSize) + { + mChunks.pushBack(static_cast(PX_ALLOC(mChunkSize, "PxU8"))); + } + + ~FlushPool() + { + for (PxU32 i = 0; i < mChunks.size(); ++i) + PX_FREE(mChunks[i]); + } + + // alignment must be a power of two + void* allocate(PxU32 size, PxU32 alignment=16) + { + PxMutex::ScopedLock lock(mMutex); + return allocateNotThreadSafe(size, alignment); + } + + // alignment must be a power of two + void* allocateNotThreadSafe(PxU32 size, PxU32 alignment=16) + { + PX_ASSERT(PxIsPowerOfTwo(alignment)); + PX_ASSERT(size <= mChunkSize && !mChunks.empty()); + + // padding for alignment + size_t unalignedStart = size_t(mChunks[mChunkIndex]+mOffset); + PxU32 pad = PxU32(((unalignedStart+alignment-1)&~(size_t(alignment)-1)) - unalignedStart); + + if (mOffset + size + pad > mChunkSize) + { + mChunkIndex++; + mOffset = 0; + if (mChunkIndex >= mChunks.size()) + mChunks.pushBack(static_cast(PX_ALLOC(mChunkSize, "PxU8"))); + + // update padding to ensure new alloc is aligned + unalignedStart = size_t(mChunks[mChunkIndex]); + pad = PxU32(((unalignedStart+alignment-1)&~(size_t(alignment)-1)) - unalignedStart); + } + + void* ptr = mChunks[mChunkIndex] + mOffset + pad; + PX_ASSERT((size_t(ptr)&(size_t(alignment)-1)) == 0); + mOffset += size + pad; + return ptr; + } + + void clear(PxU32 spareChunkCount = sSpareChunkCount) + { + PxMutex::ScopedLock lock(mMutex); + + clearNotThreadSafe(spareChunkCount); + } + + void clearNotThreadSafe(PxU32 spareChunkCount = sSpareChunkCount) + { + PX_UNUSED(spareChunkCount); + + //release memory not used previously + PxU32 targetSize = mChunkIndex+sSpareChunkCount; + while (mChunks.size() > targetSize) + { + PxU8* ptr = mChunks.popBack(); + PX_FREE(ptr); + } + + mChunkIndex = 0; + mOffset = 0; + } + + void resetNotThreadSafe() + { + PxU8* firstChunk = mChunks[0]; + + for (PxU32 i = 1; i < mChunks.size(); ++i) + PX_FREE(mChunks[i]); + + mChunks.clear(); + mChunks.pushBack(firstChunk); + mChunkIndex = 0; + mOffset = 0; + } + + void lock() + { + mMutex.lock(); + } + + void unlock() + { + mMutex.unlock(); + } + + private: + PxMutex mMutex; + PxArray mChunks; + PxU32 mChunkIndex; + PxU32 mOffset; + PxU32 mChunkSize; + }; + + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmIDPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmIDPool.h new file mode 100644 index 0000000..1efe42f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmIDPool.h @@ -0,0 +1,204 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_ID_POOL_H +#define CM_ID_POOL_H + +#include "foundation/Px.h" +#include "foundation/PxArray.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Cm +{ + template + class IDPoolBase : public PxUserAllocated + { + protected: + PxU32 mCurrentID; + FreeBuffer mFreeIDs; + public: + IDPoolBase() : mCurrentID(0) {} + + void freeID(PxU32 id) + { + // Allocate on first call + // Add released ID to the array of free IDs + if(id == (mCurrentID - 1)) + --mCurrentID; + else + mFreeIDs.pushBack(id); + } + + void freeAll() + { + mCurrentID = 0; + mFreeIDs.clear(); + } + + PxU32 getNewID() + { + // If recycled IDs are available, use them + const PxU32 size = mFreeIDs.size(); + if(size) + { + // Recycle last ID + return mFreeIDs.popBack(); + } + // Else create a new ID + return mCurrentID++; + } + + PxU32 getNumUsedID() const + { + return mCurrentID - mFreeIDs.size(); + } + + PxU32 getMaxID() const + { + return mCurrentID; + } + + }; + + //This class extends IDPoolBase. This is mainly used for when it is unsafe for the application to free the id immediately so that it can + //defer the free process until it is safe to do so + template + class DeferredIDPoolBase : public IDPoolBase + { + FreeBuffer mDeferredFreeIDs; + public: + //release an index into the deferred list + void deferredFreeID(PxU32 id) + { + mDeferredFreeIDs.pushBack(id); + } + + //release the deferred indices into the free list + void processDeferredIds() + { + const PxU32 deferredFreeIDCount = mDeferredFreeIDs.size(); + for(PxU32 a = 0; a < deferredFreeIDCount;++a) + { + IDPoolBase::freeID(mDeferredFreeIDs[a]); + } + mDeferredFreeIDs.clear(); + } + + //release all indices + void freeAll() + { + mDeferredFreeIDs.clear(); + IDPoolBase::freeAll(); + } + + PxU32 getNumUsedID() const + { + return IDPoolBase::getNumUsedID() - mDeferredFreeIDs.size(); + } + + FreeBuffer& getDeferredFreeIDs() { return mDeferredFreeIDs; } + }; + + //This is spu friendly fixed size array + template + class InlineFixedArray + { + T mArr[N]; + PxU32 mSize; + public: + + InlineFixedArray() : mSize(0) + { + } + + ~InlineFixedArray(){} + + void pushBack(const T& t) + { + PX_ASSERT(mSize < N); + mArr[mSize++] = t; + } + + T popBack() + { + PX_ASSERT(mSize > 0); + return mArr[--mSize]; + } + + void clear() { mSize = 0; } + + T& operator [] (PxU32 index) { PX_ASSERT(index < N); return mArr[index]; } + + const T& operator [] (PxU32 index) const { PX_ASSERT(index < N); return mArr[index]; } + + PxU32 size() const { return mSize; } + }; + + //Fix size IDPool + template + class InlineIDPool : public IDPoolBase > + { + public: + PxU32 getNumRemainingIDs() + { + return Capacity - this->getNumUsedID(); + } + }; + + //Dynamic resize IDPool + class IDPool : public IDPoolBase > + { + }; + + + //This class is used to recycle indices. It supports deferred release, so that until processDeferredIds is called, + //released indices will not be reallocated. This class will fail if the calling code request more id than the InlineDeferredIDPoll + //has. It is the calling code's responsibility to ensure that this does not happen. + template + class InlineDeferredIDPool : public DeferredIDPoolBase > + { + public: + PxU32 getNumRemainingIDs() + { + return Capacity - IDPoolBase< InlineFixedArray >::getNumUsedID(); + } + }; + + //Dynamic resize DeferredIDPool + class DeferredIDPool : public DeferredIDPoolBase > + { + + }; + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmMatrix34.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmMatrix34.h new file mode 100644 index 0000000..5e61ab4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmMatrix34.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_MATRIX34_H +#define CM_MATRIX34_H + +#include "foundation/PxMat34.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Cm +{ + +#ifndef __CUDACC__ +// PT: similar to PxMat33Padded +class Matrix34FromTransform : public PxMat34 +{ +public: + //! Construct from a PxTransform + explicit PX_CUDA_CALLABLE PX_FORCE_INLINE Matrix34FromTransform(const PxTransform& other) + { + using namespace aos; + + const QuatV qV = V4LoadU(&other.q.x); + Vec3V column0V, column1V, column2V; + QuatGetMat33V(qV, column0V, column1V, column2V); + + // From "buildFrom" + // PT: TODO: investigate if these overlapping stores are a problem + V4StoreU(Vec4V_From_Vec3V(column0V), &m.column0.x); + V4StoreU(Vec4V_From_Vec3V(column1V), &m.column1.x); + V4StoreU(Vec4V_From_Vec3V(column2V), &m.column2.x); + + p = other.p; + } +}; +#endif + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPool.h new file mode 100644 index 0000000..425fd74 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPool.h @@ -0,0 +1,298 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_POOL_H +#define CM_POOL_H + +#include "foundation/PxSort.h" +#include "foundation/PxMutex.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxBitMap.h" + +namespace physx +{ +namespace Cm +{ + +/*! +Allocator for pools of data structures +Also decodes indices (which can be computed from handles) into objects. To make this +faster, the EltsPerSlab must be a power of two +*/ +template +class PoolList : public PxAllocatorTraits::Type +{ + typedef typename PxAllocatorTraits::Type Alloc; + PX_NOCOPY(PoolList) +public: + PX_INLINE PoolList(const Alloc& alloc, ArgumentType* argument, PxU32 eltsPerSlab) + : Alloc(alloc), + mEltsPerSlab(eltsPerSlab), + mSlabCount(0), + mFreeList(0), + mFreeCount(0), + mSlabs(NULL), + mArgument(argument) + { + PX_ASSERT(mEltsPerSlab>0); + PX_ASSERT((mEltsPerSlab & (mEltsPerSlab-1)) == 0); + mLog2EltsPerSlab = 0; + + for(mLog2EltsPerSlab=0; mEltsPerSlab!=PxU32(1< mFreeCount ? nbRequired - mFreeCount : 0; + + PxU32 nbElements = nbRequired - nbToAllocate; + + PxMemCopy(elements, mFreeList + (mFreeCount - nbElements), sizeof(T*) * nbElements); + //PxU32 originalFreeCount = mFreeCount; + mFreeCount -= nbElements; + + if (nbToAllocate) + { + PX_ASSERT(mFreeCount == 0); + + PxU32 nbSlabs = (nbToAllocate + mEltsPerSlab - 1) / mEltsPerSlab; //The number of slabs we need to allocate... + //allocate our slabs... + + PxU32 freeCount = mFreeCount; + + for (PxU32 i = 0; i < nbSlabs; ++i) + { + + //KS - would be great to allocate this using a single allocation but it will make releasing slabs fail later :( + T * mAddr = reinterpret_cast(Alloc::allocate(mEltsPerSlab * sizeof(T), __FILE__, __LINE__)); + if (!mAddr) + return nbElements; //Allocation failed so only return the set of elements we could allocate from the free list + + PxU32 newSlabCount = mSlabCount+1; + + // Make sure the usage bitmap is up-to-size + if (mUseBitmap.size() < newSlabCount*mEltsPerSlab) + { + mUseBitmap.resize(2 * newSlabCount*mEltsPerSlab); //set last element as not used + if (mFreeList) + Alloc::deallocate(mFreeList); + mFreeList = reinterpret_cast(Alloc::allocate(2 * newSlabCount * mEltsPerSlab * sizeof(T*), __FILE__, __LINE__)); + + T** slabs = reinterpret_cast(Alloc::allocate(2* newSlabCount *sizeof(T*), __FILE__, __LINE__)); + if (mSlabs) + { + PxMemCopy(slabs, mSlabs, sizeof(T*)*mSlabCount); + + Alloc::deallocate(mSlabs); + } + + mSlabs = slabs; + } + + mSlabs[mSlabCount++] = mAddr; + + PxU32 baseIndex = (mSlabCount-1) * mEltsPerSlab; + + //Now add all these to the mFreeList and elements... + PxI32 idx = PxI32(mEltsPerSlab - 1); + + for (; idx >= PxI32(nbToAllocate); --idx) + { + mFreeList[freeCount++] = PX_PLACEMENT_NEW(mAddr + idx, T(mArgument, baseIndex + idx)); + } + + PxU32 origElements = nbElements; + T** writeIdx = elements + nbElements; + for (; idx >= 0; --idx) + { + writeIdx[idx] = PX_PLACEMENT_NEW(mAddr + idx, T(mArgument, baseIndex + idx)); + nbElements++; + } + + nbToAllocate -= (nbElements - origElements); + } + + mFreeCount = freeCount; + } + + PX_ASSERT(nbElements == nbRequired); + + for (PxU32 a = 0; a < nbElements; ++a) + { + mUseBitmap.set(elements[a]->getIndex()); + } + + return nbRequired; + } + + // TODO: would be nice to add templated construct/destroy methods like ObjectPool + + PX_INLINE T* get() + { + if(mFreeCount == 0 && !extend()) + return 0; + T* element = mFreeList[--mFreeCount]; + mUseBitmap.set(element->getIndex()); + return element; + } + + PX_INLINE void put(T* element) + { + PxU32 i = element->getIndex(); + mUseBitmap.reset(i); + mFreeList[mFreeCount++] = element; + } + + /* + WARNING: Unlike findByIndexFast below, this method is NOT safe to use if another thread + is concurrently updating the pool (e.g. through put/get/extend/getIterator), since the + safety boundedTest uses mSlabCount and mUseBitmap. + */ + PX_FORCE_INLINE T* findByIndex(PxU32 index) const + { + if(index>=mSlabCount*mEltsPerSlab || !(mUseBitmap.boundedTest(index))) + return 0; + return mSlabs[index>>mLog2EltsPerSlab] + (index&(mEltsPerSlab-1)); + } + + /* + This call is safe to do while other threads update the pool. + */ + PX_FORCE_INLINE T* findByIndexFast(PxU32 index) const + { + return mSlabs[index>>mLog2EltsPerSlab] + (index&(mEltsPerSlab-1)); + } + + bool extend() + { + T * mAddr = reinterpret_cast(Alloc::allocate(mEltsPerSlab * sizeof(T), __FILE__, __LINE__)); + if(!mAddr) + return false; + + PxU32 newSlabCount = mSlabCount+1; + + // Make sure the usage bitmap is up-to-size + if(mUseBitmap.size() < newSlabCount*mEltsPerSlab) + { + mUseBitmap.resize(2* newSlabCount*mEltsPerSlab); //set last element as not used + if(mFreeList) + Alloc::deallocate(mFreeList); + mFreeList = reinterpret_cast(Alloc::allocate(2* newSlabCount * mEltsPerSlab * sizeof(T*), __FILE__, __LINE__)); + + T** slabs = reinterpret_cast(Alloc::allocate(2 * newSlabCount * sizeof(T*), __FILE__, __LINE__)); + if (mSlabs) + { + PxMemCopy(slabs, mSlabs, sizeof(T*)*mSlabCount); + + Alloc::deallocate(mSlabs); + } + + mSlabs = slabs; + } + + mSlabs[mSlabCount++] = mAddr; + + // Add to free list in descending order so that lowest indices get allocated first - + // the FW context code currently *relies* on this behavior to grab the zero-index volume + // which can't be allocated to the user. TODO: fix this + + PxU32 baseIndex = (mSlabCount-1) * mEltsPerSlab; + PxU32 freeCount = mFreeCount; + for(PxI32 i=PxI32(mEltsPerSlab-1);i>=0;i--) + mFreeList[freeCount++] = PX_PLACEMENT_NEW(mAddr+i, T(mArgument, baseIndex+ i)); + + mFreeCount = freeCount; + + return true; + } + + PX_INLINE PxU32 getMaxUsedIndex() const + { + return mUseBitmap.findLast(); + } + + PX_INLINE PxBitMap::Iterator getIterator() const + { + return PxBitMap::Iterator(mUseBitmap); + } + +private: + const PxU32 mEltsPerSlab; + PxU32 mSlabCount; + PxU32 mLog2EltsPerSlab; + T** mFreeList; + PxU32 mFreeCount; + T** mSlabs; + ArgumentType* mArgument; + PxBitMap mUseBitmap; +}; + + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPreallocatingPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPreallocatingPool.h new file mode 100644 index 0000000..76a0aac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPreallocatingPool.h @@ -0,0 +1,428 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_PREALLOCATING_POOL_H +#define CM_PREALLOCATING_POOL_H + +#include "foundation/Px.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxSort.h" +#include "foundation/PxArray.h" + +namespace physx +{ +namespace Cm +{ + +class PreallocatingRegion +{ +public: + PX_FORCE_INLINE PreallocatingRegion() : mMemory(NULL), mFirstFree(NULL), mNbElements(0) {} + + void init(PxU32 maxElements, PxU32 elementSize, const char* typeName) + { + mFirstFree = NULL; + mNbElements = 0; + PX_ASSERT(typeName); + PX_UNUSED(typeName); + mMemory = reinterpret_cast(PX_ALLOC(sizeof(PxU8)*elementSize*maxElements, typeName?typeName:"SceneSim Pool")); // ### addActor alloc + PX_ASSERT(elementSize*maxElements>=sizeof(void*)); + } + + void reset() + { + PX_FREE(mMemory); + } + + PX_FORCE_INLINE PxU8* allocateMemory(PxU32 maxElements, PxU32 elementSize) + { + if(mFirstFree) + { + PxU8* recycled = reinterpret_cast(mFirstFree); + + void** recycled32 = reinterpret_cast(recycled); + mFirstFree = *recycled32; + + return recycled; + } + else + { + if(mNbElements==maxElements) + return NULL; // Out of memory + + const PxU32 freeIndex = mNbElements++; + return mMemory + freeIndex * elementSize; + } + } + + void deallocateMemory(PxU32 maxElements, PxU32 elementSize, PxU8* element) + { + PX_ASSERT(element); + PX_ASSERT(element>=mMemory && element(element); + *recycled32 = mFirstFree; + + mFirstFree = element; + } + + PX_FORCE_INLINE bool operator < (const PreallocatingRegion& p) const + { + return mMemory < p.mMemory; + } + + PX_FORCE_INLINE bool operator > (const PreallocatingRegion& p) const + { + return mMemory > p.mMemory; + } + + PxU8* mMemory; + void* mFirstFree; + PxU32 mNbElements; +}; + + + +class PreallocatingRegionManager +{ + public: + PreallocatingRegionManager(PxU32 maxElements, PxU32 elementSize, const char* typeName) + : mMaxElements (maxElements) + , mElementSize (elementSize) + , mActivePoolIndex (0) + , mPools ("MyPoolManagerPools") + , mNeedsSorting (true) + , mTypeName (typeName) + { + PreallocatingRegion tmp; + tmp.init(maxElements, elementSize, mTypeName); + mPools.pushBack(tmp); + } + + ~PreallocatingRegionManager() + { + const PxU32 nbPools = mPools.size(); + for(PxU32 i=0;iavailableSpace) + { + PreallocatingRegion tmp; + tmp.init(maxElements, elementSize, mTypeName); + mPools.pushBack(tmp); + + availableSpace += maxElements; + } + } + + PX_FORCE_INLINE PxU8* allocateMemory() + { + PX_ASSERT(mActivePoolIndex>1; + + PreallocatingRegion& candidate = mPools[PxU32(mid)]; + if(contains(candidate.mMemory, slabSize, element)) + { + candidate.deallocateMemory(maxElements, elementSize, element); + + // when we sorted earlier we trashed the active index, but at least this region has a free element + if(mNeedsSorting) + mActivePoolIndex = PxU32(mid); + + mNeedsSorting = false; + return; + } + + if(candidate.mMemory=memory && element mPools; + bool mNeedsSorting; + const char* mTypeName; +}; + +template +class PreallocatingPool : public PxUserAllocated +{ + PreallocatingPool& operator=(const PreallocatingPool&); + +public: + PreallocatingPool(PxU32 maxElements, const char* typeName) : mPool(maxElements, sizeof(T), typeName) + { + } + + ~PreallocatingPool() + { + } + + PX_FORCE_INLINE void preAllocate(PxU32 n) + { + mPool.preAllocate(n); + } + + PX_INLINE T* allocate() + { + return reinterpret_cast(mPool.allocateMemory()); + } + + PX_FORCE_INLINE T* allocateAndPrefetch() + { + T* t = reinterpret_cast(mPool.allocateMemory()); + PxPrefetch(t, sizeof(T)); + return t; + } + + PX_INLINE T* construct() + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T()) : NULL; + } + + template + PX_INLINE T* construct(A1& a) + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T(a)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b) + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T(a,b)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c) + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T(a,b,c)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d) + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T(a,b,c,d)) : NULL; + } + + template + PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e) + { + T* t = reinterpret_cast(mPool.allocateMemory()); + return t ? PX_PLACEMENT_NEW(t, T(a,b,c,d,e)) : NULL; + } + + //// + + PX_INLINE T* construct(T* t) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T()); + } + + template + PX_INLINE T* construct(T* t, A1& a) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T(a)); + } + + template + PX_INLINE T* construct(T* t, A1& a, A2& b) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T(a,b)); + } + + template + PX_INLINE T* construct(T* t, A1& a, A2& b, A3& c) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T(a,b,c)); + } + + template + PX_INLINE T* construct(T* t, A1& a, A2& b, A3& c, A4& d) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T(a,b,c,d)); + } + + template + PX_INLINE T* construct(T* t, A1& a, A2& b, A3& c, A4& d, A5& e) + { + PX_ASSERT(t); + return PX_PLACEMENT_NEW(t, T(a,b,c,d,e)); + } + + PX_INLINE void destroy(T* const p) + { + if(p) + { + p->~T(); + mPool.deallocateMemory(reinterpret_cast(p)); + } + } + + PX_INLINE void releasePreallocated(T* const p) + { + if(p) + mPool.deallocateMemory(reinterpret_cast(p)); + } +protected: + PreallocatingRegionManager mPool; +}; + +template +class BufferedPreallocatingPool : public PreallocatingPool +{ + PxArray mDeletedElems; + PX_NOCOPY(BufferedPreallocatingPool) +public: + BufferedPreallocatingPool(PxU32 maxElements, const char* typeName) : PreallocatingPool(maxElements, typeName) + { + } + + PX_INLINE void destroy(T* const p) + { + if (p) + { + p->~T(); + mDeletedElems.pushBack(p); + } + } + + void processPendingDeletedElems() + { + for (PxU32 i = 0; i < mDeletedElems.size(); ++i) + this->mPool.deallocateMemory(reinterpret_cast(mDeletedElems[i])); + mDeletedElems.clear(); + } + + +}; + + + + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPriorityQueue.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPriorityQueue.h new file mode 100644 index 0000000..9c0a3ff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPriorityQueue.h @@ -0,0 +1,234 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_PRIORITY_QUEUE_H +#define CM_PRIORITY_QUEUE_H + +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxMemory.h" + +namespace physx +{ +namespace Cm +{ + template > + class PriorityQueueBase : protected Comparator // inherit so that stateless comparators take no space + { + public: + PriorityQueueBase(const Comparator& less, Element* elements) : Comparator(less), mHeapSize(0), mDataPtr(elements) + { + } + + ~PriorityQueueBase() + { + } + + //! Get the element with the highest priority + PX_FORCE_INLINE const Element top() const + { + return mDataPtr[0]; + } + + //! Get the element with the highest priority + PX_FORCE_INLINE Element top() + { + return mDataPtr[0]; + } + + //! Check to whether the priority queue is empty + PX_FORCE_INLINE bool empty() const + { + return (mHeapSize == 0); + } + + //! Empty the priority queue + PX_FORCE_INLINE void clear() + { + mHeapSize = 0; + } + + //! Insert a new element into the priority queue. Only valid when size() is less than Capacity + PX_FORCE_INLINE void push(const Element& value) + { + PxU32 newIndex; + PxU32 parentIndex = parent(mHeapSize); + + for (newIndex = mHeapSize; newIndex > 0 && compare(value, mDataPtr[parentIndex]); newIndex = parentIndex, parentIndex= parent(newIndex)) + { + mDataPtr[ newIndex ] = mDataPtr[parentIndex]; + } + mDataPtr[newIndex] = value; + mHeapSize++; + PX_ASSERT(valid()); + } + + //! Delete the highest priority element. Only valid when non-empty. + PX_FORCE_INLINE Element pop() + { + PX_ASSERT(mHeapSize > 0); + PxU32 i, child; + //try to avoid LHS + PxU32 tempHs = mHeapSize-1; + mHeapSize = tempHs; + Element min = mDataPtr[0]; + Element last = mDataPtr[tempHs]; + + for (i = 0; (child = left(i)) < tempHs; i = child) + { + /* Find highest priority child */ + const PxU32 rightChild = child + 1; + + child += ((rightChild < tempHs) & compare((mDataPtr[rightChild]), (mDataPtr[child]))) ? 1 : 0; + + if(compare(last, mDataPtr[child])) + break; + + mDataPtr[i] = mDataPtr[child]; + } + mDataPtr[ i ] = last; + + PX_ASSERT(valid()); + return min; + } + + //! Make sure the priority queue sort all elements correctly + bool valid() const + { + const Element& min = mDataPtr[0]; + for(PxU32 i=1; i> 1; + } + private: + PriorityQueueBase& operator = (const PriorityQueueBase); + }; + + template + class InlinePriorityQueue : public PriorityQueueBase + { + Element mData[Capacity]; + public: + InlinePriorityQueue(const Comparator& less = Comparator()) : PriorityQueueBase(less, mData) + { + } + + PX_FORCE_INLINE void push(Element& elem) + { + PX_ASSERT(this->mHeapSize < Capacity); + PriorityQueueBase::push(elem); + } + private: + InlinePriorityQueue& operator = (const InlinePriorityQueue); + }; + + template ::Type> + class PriorityQueue : public PriorityQueueBase, protected Alloc + { + PxU32 mCapacity; + public: + PriorityQueue(const Comparator& less = Comparator(), PxU32 initialCapacity = 0, Alloc alloc = Alloc()) + : PriorityQueueBase(less, NULL), Alloc(alloc), mCapacity(initialCapacity) + { + if(initialCapacity > 0) + this->mDataPtr = reinterpret_cast(Alloc::allocate(sizeof(Element)*initialCapacity, __FILE__, __LINE__)); + } + + ~PriorityQueue() + { + if(this->mDataPtr) + this->deallocate(this->mDataPtr); + } + + PX_FORCE_INLINE void push(Element& elem) + { + if(this->mHeapSize == mCapacity) + { + reserve((this->mHeapSize+1)*2); + } + PriorityQueueBase::push(elem); + } + + PX_FORCE_INLINE PxU32 capacity() + { + return mCapacity; + } + + PX_FORCE_INLINE void reserve(const PxU32 newCapacity) + { + if(newCapacity > mCapacity) + { + Element* newElems = reinterpret_cast(Alloc::allocate(sizeof(Element)*newCapacity, __FILE__, __LINE__)); + if(this->mDataPtr) + { + physx::PxMemCopy(newElems, this->mDataPtr, sizeof(Element) * this->mHeapSize); + Alloc::deallocate(this->mDataPtr); + } + this->mDataPtr = newElems; + mCapacity = newCapacity; + } + } + + private: + PriorityQueue& operator = (const PriorityQueue); + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp new file mode 100644 index 0000000..78b6b5e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.cpp @@ -0,0 +1,207 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "common/PxMetaData.h" +#include "foundation/PxBitUtils.h" +#include "CmPtrTable.h" +#include "CmUtils.h" + +using namespace physx; +using namespace Cm; + +PtrTable::PtrTable() : + mList (NULL), + mCount (0), + mOwnsMemory (true), + mBufferUsed (false) +{ +} + +PtrTable::~PtrTable() +{ + PX_ASSERT(mOwnsMemory); + PX_ASSERT(mCount == 0); + PX_ASSERT(mList == NULL); +} + +void PtrTable::clear(PtrTableStorageManager& sm) +{ + if(mOwnsMemory && mCount>1) + { + const PxU32 implicitCapacity = PxNextPowerOfTwo(PxU32(mCount)-1); + sm.deallocate(mList, implicitCapacity); + } + + mList = NULL; + mOwnsMemory = true; + mCount = 0; +} + +PxU32 PtrTable::find(const void* ptr) const +{ + const PxU32 nbPtrs = mCount; + void*const * PX_RESTRICT ptrs = getPtrs(); + + for(PxU32 i=0; i1) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mList, sizeof(void*)*mCount); + } +} + +void PtrTable::importExtraData(PxDeserializationContext& context) +{ + if(mCount>1) + mList = context.readExtraData(mCount); +} + +void PtrTable::realloc(PxU32 oldCapacity, PxU32 newCapacity, PtrTableStorageManager& sm) +{ + PX_ASSERT((mOwnsMemory && oldCapacity) || (!mOwnsMemory && oldCapacity == 0)); + PX_ASSERT(newCapacity); + + if(mOwnsMemory && sm.canReuse(oldCapacity, newCapacity)) + return; + + void** newMem = sm.allocate(newCapacity); + PxMemCopy(newMem, mList, mCount * sizeof(void*)); + + if(mOwnsMemory) + sm.deallocate(mList, oldCapacity); + + mList = newMem; + mOwnsMemory = true; +} + +void PtrTable::add(void* ptr, PtrTableStorageManager& sm) +{ + if(mCount == 0) // 0 -> 1, easy case + { + PX_ASSERT(mOwnsMemory); + PX_ASSERT(mList == NULL); + PX_ASSERT(!mBufferUsed); + mSingle = ptr; + mCount = 1; + mBufferUsed = true; + return; + } + + if(mCount == 1) // 1 -> 2, easy case + { + PX_ASSERT(mOwnsMemory); + PX_ASSERT(mBufferUsed); + + void* single = mSingle; + mList = sm.allocate(2); + mList[0] = single; + mBufferUsed = false; + mOwnsMemory = true; + } + else + { + PX_ASSERT(!mBufferUsed); + + if(!mOwnsMemory) // don't own the memory, must always alloc + realloc(0, PxNextPowerOfTwo(mCount), sm); // we're guaranteed nextPowerOfTwo(x) > x + + else if(PxIsPowerOfTwo(mCount)) // count is at implicit capacity, so realloc + realloc(mCount, PxU32(mCount)*2, sm); // ... to next higher power of 2 + + PX_ASSERT(mOwnsMemory); + } + + mList[mCount++] = ptr; +} + +void PtrTable::replaceWithLast(PxU32 index, PtrTableStorageManager& sm) +{ + PX_ASSERT(mCount!=0); + + if(mCount == 1) // 1 -> 0 easy case + { + PX_ASSERT(mOwnsMemory); + PX_ASSERT(mBufferUsed); + + mList = NULL; + mCount = 0; + mBufferUsed = false; + } + else if(mCount == 2) // 2 -> 1 easy case + { + PX_ASSERT(!mBufferUsed); + void* ptr = mList[1-index]; + if(mOwnsMemory) + sm.deallocate(mList, 2); + mSingle = ptr; + mCount = 1; + mBufferUsed = true; + mOwnsMemory = true; + } + else + { + PX_ASSERT(!mBufferUsed); + + mList[index] = mList[--mCount]; // remove before adjusting memory + + if(!mOwnsMemory) // don't own the memory, must alloc + realloc(0, PxNextPowerOfTwo(PxU32(mCount)-1), sm); // if currently a power of 2, don't jump to the next one + + else if(PxIsPowerOfTwo(mCount)) // own the memory, and implicit capacity requires that we downsize + realloc(PxU32(mCount)*2, PxU32(mCount), sm); // ... from the next power of 2, which was the old implicit capacity + + PX_ASSERT(mOwnsMemory); + } +} + +void Cm::PtrTable::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PtrTable) + + PX_DEF_BIN_METADATA_ITEM(stream, PtrTable, void, mSingle, PxMetaDataFlag::ePTR) // PT: this is actually a union, beware + PX_DEF_BIN_METADATA_ITEM(stream, PtrTable, PxU16, mCount, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PtrTable, bool, mOwnsMemory, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PtrTable, bool, mBufferUsed, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PtrTable, PxU32, mFreeSlot, 0) + + //------ Extra-data ------ + + // mList + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PtrTable, void, mBufferUsed, mCount, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::ePTR, PX_SERIAL_ALIGN) +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.h new file mode 100644 index 0000000..96f1f81 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmPtrTable.h @@ -0,0 +1,128 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_PTR_TABLE_H +#define CM_PTR_TABLE_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +class PxSerializationContext; +class PxDeserializationContext; + +namespace Cm +{ +class PtrTableStorageManager +{ + // This will typically be backed by a MultiPool implementation with fallback to the user + // allocator. For MultiPool, when deallocating we want to know what the previously requested size was + // so we can release into the right pool + +public: + + virtual void** allocate(PxU32 capacity) = 0; + virtual void deallocate(void** addr, PxU32 originalCapacity) = 0; + + // whether memory allocated at one capacity can (and should) be safely reused at a different capacity + // allows realloc-style reuse by clients. + + virtual bool canReuse(PxU32 originalCapacity, PxU32 newCapacity) = 0; +protected: + virtual ~PtrTableStorageManager() {} +}; + +// specialized class to hold an array of pointers with extrinsic storage management, +// serialization-compatible with 3.3.1 PtrTable +// +// note that extrinsic storage implies you *must* clear the table before the destructor runs +// +// capacity is implicit: +// if the memory is not owned (i.e. came from deserialization) then the capacity is exactly mCount +// else if mCount==0, capacity is 0 +// else the capacity is the power of 2 >= mCount +// +// one implication of this is that if we want to add or remove a pointer from unowned memory, we always realloc +struct PX_PHYSX_COMMON_API PtrTable +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PtrTable(); + ~PtrTable(); + + void add(void* ptr, PtrTableStorageManager& sm); + void replaceWithLast(PxU32 index, PtrTableStorageManager& sm); + void clear(PtrTableStorageManager& sm); + + PxU32 find(const void* ptr) const; + + PX_FORCE_INLINE PxU32 getCount() const { return mCount; } + PX_FORCE_INLINE void*const* getPtrs() const { return mCount == 1 ? &mSingle : mList; } + PX_FORCE_INLINE void** getPtrs() { return mCount == 1 ? &mSingle : mList; } + + // SERIALIZATION + + // 3.3.1 compatibility fixup: this implementation ALWAYS sets 'ownsMemory' if the size is 0 or 1 + PtrTable(const PxEMPTY) + { + mOwnsMemory = mCount<2; + if(mCount == 0) + mList = NULL; + } + + void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); + + static void getBinaryMetaData(physx::PxOutputStream& stream); + +private: + void realloc(PxU32 oldCapacity, PxU32 newCapacity, PtrTableStorageManager& sm); + + union + { + void* mSingle; + void** mList; + }; + + PxU16 mCount; + bool mOwnsMemory; + bool mBufferUsed; // dark magic in serialization requires this, otherwise redundant because it's logically equivalent to mCount == 1. +public: + PxU32 mFreeSlot; // PT: padding bytes on x64 +}; + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp new file mode 100644 index 0000000..60c96c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.cpp @@ -0,0 +1,559 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "foundation/PxAssert.h" +#include "CmRadixSort.h" + +// PT: code archeology: this initially came from ICE (IceRevisitedRadix.h/cpp). Consider putting it back the way it was initially. + +using namespace physx; +using namespace Cm; + +#if defined(__BIG_ENDIAN__) || defined(_XBOX) + #define H0_OFFSET 768 + #define H1_OFFSET 512 + #define H2_OFFSET 256 + #define H3_OFFSET 0 + #define BYTES_INC (3-j) +#else + #define H0_OFFSET 0 + #define H1_OFFSET 256 + #define H2_OFFSET 512 + #define H3_OFFSET 768 + #define BYTES_INC j +#endif + +#define CREATE_HISTOGRAMS(type, buffer) \ + /* Clear counters/histograms */ \ + PxMemZero(mHistogram1024, 256*4*sizeof(PxU32)); \ + \ + /* Prepare to count */ \ + const PxU8* PX_RESTRICT p = reinterpret_cast(input); \ + const PxU8* PX_RESTRICT pe = &p[nb*4]; \ + PxU32* PX_RESTRICT h0= &mHistogram1024[H0_OFFSET]; /* Histogram for first pass (LSB)*/ \ + PxU32* PX_RESTRICT h1= &mHistogram1024[H1_OFFSET]; /* Histogram for second pass */ \ + PxU32* PX_RESTRICT h2= &mHistogram1024[H2_OFFSET]; /* Histogram for third pass */ \ + PxU32* PX_RESTRICT h3= &mHistogram1024[H3_OFFSET]; /* Histogram for last pass (MSB)*/ \ + \ + bool AlreadySorted = true; /* Optimism... */ \ + \ + if(INVALID_RANKS) \ + { \ + /* Prepare for temporal coherence */ \ + const type* PX_RESTRICT Running = reinterpret_cast(buffer); \ + type PrevVal = *Running; \ + \ + while(p!=pe) \ + { \ + /* Read input buffer in previous sorted order */ \ + const type Val = *Running++; \ + /* Check whether already sorted or not */ \ + if(Val(input))+pass); + + // Check that byte's counter + if(CurCount[UniqueVal]==nb) + return NULL; + + return CurCount; +} + +RadixSort::RadixSort() : mCurrentSize(0), mRanks(NULL), mRanks2(NULL), mHistogram1024(0), mLinks256(0), mTotalCalls(0), mNbHits(0), mDeleteRanks(true) +{ + // Initialize indices + INVALIDATE_RANKS; +} + +RadixSort::~RadixSort() +{ +} + +/** + * Main sort routine. + * This one is for integer values. After the call, mRanks contains a list of indices in sorted order, i.e. in the order you may process your data. + * \param input [in] a list of integer values to sort + * \param nb [in] number of values to sort, must be < 2^31 + * \param hint [in] RADIX_SIGNED to handle negative values, RADIX_UNSIGNED if you know your input buffer only contains positive values + * \return Self-Reference + */ +RadixSort& RadixSort::Sort(const PxU32* input, PxU32 nb, RadixHint hint) +{ + PX_ASSERT(mHistogram1024); + PX_ASSERT(mLinks256); + PX_ASSERT(mRanks); + PX_ASSERT(mRanks2); + + // Checkings + if(!input || !nb || nb&0x80000000) + return *this; + + // Stats + mTotalCalls++; + + // Create histograms (counters). Counters for all passes are created in one run. + // Pros: read input buffer once instead of four times + // Cons: mHistogram1024 is 4Kb instead of 1Kb + // We must take care of signed/unsigned values for temporal coherence.... I just + // have 2 code paths even if just a single opcode changes. Self-modifying code, someone? + if(hint==RADIX_UNSIGNED) { CREATE_HISTOGRAMS(PxU32, input); } + else { CREATE_HISTOGRAMS(PxI32, input); } + + // Compute #negative values involved if needed + PxU32 NbNegativeValues = 0; + if(hint==RADIX_SIGNED) + { + // An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128 + // last values of the last histogram. Last histogram because that's the one for the Most Significant Byte, + // responsible for the sign. 128 last values because the 128 first ones are related to positive numbers. + PxU32* PX_RESTRICT h3= &mHistogram1024[768]; + for(PxU32 i=128;i<256;i++) NbNegativeValues += h3[i]; // 768 for last histogram, 128 for negative part + } + + // Radix sort, j is the pass number (0=LSB, 3=MSB) + for(PxU32 j=0;j<4;j++) + { +// CHECK_PASS_VALIDITY(j); + PxU8 UniqueVal; + const PxU32* PX_RESTRICT CurCount = CheckPassValidity(j, mHistogram1024, nb, input, UniqueVal); + + // Sometimes the fourth (negative) pass is skipped because all numbers are negative and the MSB is 0xFF (for example). This is + // not a problem, numbers are correctly sorted anyway. + if(CurCount) + { + PxU32** PX_RESTRICT Links256 = mLinks256; + + // Should we care about negative values? + if(j!=3 || hint==RADIX_UNSIGNED) + { + // Here we deal with positive values only + + // Create offsets + Links256[0] = mRanks2; + for(PxU32 i=1;i<256;i++) + Links256[i] = Links256[i-1] + CurCount[i-1]; + } + else + { + // This is a special case to correctly handle negative integers. They're sorted in the right order but at the wrong place. + + // Create biased offsets, in order for negative numbers to be sorted as well + Links256[0] = &mRanks2[NbNegativeValues]; // First positive number takes place after the negative ones + for(PxU32 i=1;i<128;i++) + Links256[i] = Links256[i-1] + CurCount[i-1]; // 1 to 128 for positive numbers + + // Fixing the wrong place for negative values + Links256[128] = mRanks2; + for(PxU32 i=129;i<256;i++) + Links256[i] = Links256[i-1] + CurCount[i-1]; + } + + // Perform Radix Sort + const PxU8* PX_RESTRICT InputBytes = reinterpret_cast(input); + InputBytes += BYTES_INC; + if(INVALID_RANKS) + { + for(PxU32 i=0;i(input2); + + // Allocate histograms & offsets on the stack + //PxU32 mHistogram1024[256*4]; + //PxU32* mLinks256[256]; + + // Create histograms (counters). Counters for all passes are created in one run. + // Pros: read input buffer once instead of four times + // Cons: mHistogram1024 is 4Kb instead of 1Kb + // Floating-point values are always supposed to be signed values, so there's only one code path there. + // Please note the floating point comparison needed for temporal coherence! Although the resulting asm code + // is dreadful, this is surprisingly not such a performance hit - well, I suppose that's a big one on first + // generation Pentiums....We can't make comparison on integer representations because, as Chris said, it just + // wouldn't work with mixed positive/negative values.... + { CREATE_HISTOGRAMS(float, input2); } + + // Compute #negative values involved if needed + PxU32 NbNegativeValues = 0; + // An efficient way to compute the number of negatives values we'll have to deal with is simply to sum the 128 + // last values of the last histogram. Last histogram because that's the one for the Most Significant Byte, + // responsible for the sign. 128 last values because the 128 first ones are related to positive numbers. + // ### is that ok on Apple ?! + PxU32* PX_RESTRICT h3= &mHistogram1024[768]; + for(PxU32 i=128;i<256;i++) NbNegativeValues += h3[i]; // 768 for last histogram, 128 for negative part + + // Radix sort, j is the pass number (0=LSB, 3=MSB) + for(PxU32 j=0;j<4;j++) + { + PxU8 UniqueVal; + const PxU32* PX_RESTRICT CurCount = CheckPassValidity(j, mHistogram1024, nb, input, UniqueVal); + // Should we care about negative values? + if(j!=3) + { + // Here we deal with positive values only +// CHECK_PASS_VALIDITY(j); +// const bool PerformPass = CheckPassValidity(j, mHistogram1024, nb, input); + + if(CurCount) + { + PxU32** PX_RESTRICT Links256 = mLinks256; + + // Create offsets + Links256[0] = mRanks2; + for(PxU32 i=1;i<256;i++) + Links256[i] = Links256[i-1] + CurCount[i-1]; + + // Perform Radix Sort + const PxU8* PX_RESTRICT InputBytes = reinterpret_cast(input); + InputBytes += BYTES_INC; + if(INVALID_RANKS) + { + for(PxU32 i=0;i>24; // Radix byte, same as above. AND is useless here (PxU32). + // ### cmp to be killed. Not good. Later. + if(Radix<128) *Links256[Radix]++ = i; // Number is positive, same as above + else *(--Links256[Radix]) = i; // Number is negative, flip the sorting order + } + VALIDATE_RANKS; + } + else + { + const PxU32* PX_RESTRICT Ranks = mRanks; + for(PxU32 i=0;i>24; // Radix byte, same as above. AND is useless here (PxU32). + // ### cmp to be killed. Not good. Later. + if(Radix<128) *Links256[Radix]++ = Ranks[i]; // Number is positive, same as above + else *(--Links256[Radix]) = Ranks[i]; // Number is negative, flip the sorting order + } + } + // Swap pointers for next pass. Valid indices - the most recent ones - are in mRanks after the swap. + PxU32* Tmp = mRanks; mRanks = mRanks2; mRanks2 = Tmp; + } + else + { + // The pass is useless, yet we still have to reverse the order of current list if all values are negative. + if(UniqueVal>=128) + { + if(INVALID_RANKS) + { + // ###Possible? + for(PxU32 i=0;iCurSize) + Resize(nb); + mCurrentSize = nb; + INVALIDATE_RANKS; + } +} + +/** + * Main sort routine. + * This one is for integer values. After the call, mRanks contains a list of indices in sorted order, i.e. in the order you may process your data. + * \param input [in] a list of integer values to sort + * \param nb [in] number of values to sort, must be < 2^31 + * \param hint [in] RADIX_SIGNED to handle negative values, RADIX_UNSIGNED if you know your input buffer only contains positive values + * \return Self-Reference + */ +RadixSortBuffered& RadixSortBuffered::Sort(const PxU32* input, PxU32 nb, RadixHint hint) +{ + // Checkings + if(!input || !nb || nb&0x80000000) + return *this; + + // Resize lists if needed + CheckResize(nb); + + //Set histogram buffers. + PxU32 histogram[1024]; + PxU32* links[256]; + mHistogram1024 = histogram; + mLinks256 = links; + + RadixSort::Sort(input, nb, hint); + return *this; +} + +/** + * Main sort routine. + * This one is for floating-point values. After the call, mRanks contains a list of indices in sorted order, i.e. in the order you may process your data. + * \param input2 [in] a list of floating-point values to sort + * \param nb [in] number of values to sort, must be < 2^31 + * \return Self-Reference + * \warning only sorts IEEE floating-point values + */ +RadixSortBuffered& RadixSortBuffered::Sort(const float* input2, PxU32 nb) +{ + // Checkings + if(!input2 || !nb || nb&0x80000000) + return *this; + + // Resize lists if needed + CheckResize(nb); + + //Set histogram buffers. + PxU32 histogram[1024]; + PxU32* links[256]; + mHistogram1024 = histogram; + mLinks256 = links; + + RadixSort::Sort(input2, nb); + return *this; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.h new file mode 100644 index 0000000..a54a2c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRadixSort.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_RADIX_SORT_H +#define CM_RADIX_SORT_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Cm +{ + enum RadixHint + { + RADIX_SIGNED, //!< Input values are signed + RADIX_UNSIGNED, //!< Input values are unsigned + + RADIX_FORCE_DWORD = 0x7fffffff + }; + +#define INVALIDATE_RANKS mCurrentSize|=0x80000000 +#define VALIDATE_RANKS mCurrentSize&=0x7fffffff +#define CURRENT_SIZE (mCurrentSize&0x7fffffff) +#define INVALID_RANKS (mCurrentSize&0x80000000) + + class PX_PHYSX_COMMON_API RadixSort + { + PX_NOCOPY(RadixSort) + public: + RadixSort(); + virtual ~RadixSort(); + // Sorting methods + RadixSort& Sort(const PxU32* input, PxU32 nb, RadixHint hint=RADIX_SIGNED); + RadixSort& Sort(const float* input, PxU32 nb); + + //! Access to results. mRanks is a list of indices in sorted order, i.e. in the order you may further process your data + PX_FORCE_INLINE const PxU32* GetRanks() const { return mRanks; } + + //! mIndices2 gets trashed on calling the sort routine, but otherwise you can recycle it the way you want. + PX_FORCE_INLINE PxU32* GetRecyclable() const { return mRanks2; } + + //! Returns the total number of calls to the radix sorter. + PX_FORCE_INLINE PxU32 GetNbTotalCalls() const { return mTotalCalls; } + //! Returns the number of eraly exits due to temporal coherence. + PX_FORCE_INLINE PxU32 GetNbHits() const { return mNbHits; } + + PX_FORCE_INLINE void invalidateRanks() { INVALIDATE_RANKS; } + + bool SetBuffers(PxU32* ranks0, PxU32* ranks1, PxU32* histogram1024, PxU32** links256); + protected: + PxU32 mCurrentSize; //!< Current size of the indices list + PxU32* mRanks; //!< Two lists, swapped each pass + PxU32* mRanks2; + PxU32* mHistogram1024; + PxU32** mLinks256; + // Stats + PxU32 mTotalCalls; //!< Total number of calls to the sort routine + PxU32 mNbHits; //!< Number of early exits due to coherence + + // Stack-radix + bool mDeleteRanks; //!< + }; + + #define StackRadixSort(name, ranks0, ranks1) \ + RadixSort name; \ + PxU32 histogramBuffer[1024]; \ + PxU32* linksBuffer[256]; \ + name.SetBuffers(ranks0, ranks1, histogramBuffer, linksBuffer); + + class PX_PHYSX_COMMON_API RadixSortBuffered : public RadixSort + { + public: + RadixSortBuffered(); + ~RadixSortBuffered(); + + void reset(); + + RadixSortBuffered& Sort(const PxU32* input, PxU32 nb, RadixHint hint=RADIX_SIGNED); + RadixSortBuffered& Sort(const float* input, PxU32 nb); + + private: + RadixSortBuffered(const RadixSortBuffered& object); + RadixSortBuffered& operator=(const RadixSortBuffered& object); + + // Internal methods + void CheckResize(PxU32 nb); + bool Resize(PxU32 nb); + }; +} +} + +#endif // CM_RADIX_SORT_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRandom.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRandom.h new file mode 100644 index 0000000..2db051c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRandom.h @@ -0,0 +1,223 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_RANDOM_H +#define CM_RANDOM_H + +#include "common/PxPhysXCommonConfig.h" +#define TEST_MAX_RAND 0xffff + +namespace physx +{ +namespace Cm +{ + class BasicRandom + { + public: + BasicRandom(PxU32 seed = 0) : mRnd(seed) {} + ~BasicRandom() {} + + PX_FORCE_INLINE void setSeed(PxU32 seed) { mRnd = seed; } + PX_FORCE_INLINE PxU32 getCurrentValue() const { return mRnd; } + PxU32 randomize() { mRnd = mRnd * 2147001325 + 715136305; return mRnd; } + + PX_FORCE_INLINE PxU32 rand() { return randomize() & 0xffff; } + PX_FORCE_INLINE PxU32 rand32() { return randomize() & 0xffffffff; } + + PxF32 rand(PxF32 a, PxF32 b) + { + const PxF32 r = rand32() / (static_cast(0xffffffff)); + return r * (b - a) + a; + } + + PxI32 rand(PxI32 a, PxI32 b) + { + return a + static_cast(rand32() % (b - a)); + } + + PxF32 randomFloat() + { + return rand() / (static_cast(0xffff)) - 0.5f; + } + PxF32 randomFloat32() + { + return rand32() / (static_cast(0xffffffff)) - 0.5f; + } + + PxF32 randomFloat32(PxReal a, PxReal b) { return rand32() / PxF32(0xffffffff)*(b - a) + a; } + void unitRandomPt(physx::PxVec3& v) + { + v = unitRandomPt(); + } + + void unitRandomQuat(physx::PxQuat& v) + { + v = unitRandomQuat(); + } + + PxVec3 unitRandomPt() + { + PxVec3 v; + do + { + v.x = randomFloat(); + v.y = randomFloat(); + v.z = randomFloat(); + } while (v.normalize() < 1e-6f); + return v; + } + + PxQuat unitRandomQuat() + { + PxQuat v; + do + { + v.x = randomFloat(); + v.y = randomFloat(); + v.z = randomFloat(); + v.w = randomFloat(); + } while (v.normalize() < 1e-6f); + + return v; + } + + private: + PxU32 mRnd; + }; + + //-------------------------------------- + // Fast, very good random numbers + // + // Period = 2^249 + // + // Kirkpatrick, S., and E. Stoll, 1981; A Very Fast Shift-Register + // Sequence Random Number Generator, Journal of Computational Physics, + // V. 40. + // + // Maier, W.L., 1991; A Fast Pseudo Random Number Generator, + // Dr. Dobb's Journal, May, pp. 152 - 157 + + class RandomR250 + { + public: + RandomR250(PxI32 s) + { + setSeed(s); + } + + void setSeed(PxI32 s) + { + BasicRandom lcg(s); + mIndex = 0; + + PxI32 j; + for (j = 0; j < 250; j++) // fill r250 buffer with bit values + mBuffer[j] = lcg.randomize(); + + for (j = 0; j < 250; j++) // set some MSBs to 1 + if (lcg.randomize() > 0x40000000L) + mBuffer[j] |= 0x80000000L; + + PxU32 msb = 0x80000000; // turn on diagonal bit + PxU32 mask = 0xffffffff; // turn off the leftmost bits + + for (j = 0; j < 32; j++) + { + const PxI32 k = 7 * j + 3; // select a word to operate on + mBuffer[k] &= mask; // turn off bits left of the diagonal + mBuffer[k] |= msb; // turn on the diagonal bit + mask >>= 1; + msb >>= 1; + } + } + + PxU32 randI() + { + PxI32 j; + + // wrap pointer around + if (mIndex >= 147) j = mIndex - 147; + else j = mIndex + 103; + + const PxU32 new_rand = mBuffer[mIndex] ^ mBuffer[j]; + mBuffer[mIndex] = new_rand; + + // increment pointer for next time + if (mIndex >= 249) mIndex = 0; + else mIndex++; + + return new_rand >> 1; + } + + PxReal randUnit() + { + PxU32 mask = (1 << 23) - 1; + return PxF32(randI()&(mask)) / PxF32(mask); + } + + PxReal rand(PxReal lower, PxReal upper) + { + return lower + randUnit() * (upper - lower); + } + + private: + PxU32 mBuffer[250]; + PxI32 mIndex; + }; + + static RandomR250 gRandomR250(0x95d6739b); + + PX_FORCE_INLINE PxU32 Rand() + { + return gRandomR250.randI() & TEST_MAX_RAND; + } + + PX_FORCE_INLINE PxF32 Rand(PxF32 a, PxF32 b) + { + const PxF32 r = static_cast(Rand()) / (static_cast(TEST_MAX_RAND)); + return r * (b - a) + a; + } + PX_FORCE_INLINE PxF32 RandLegacy(PxF32 a, PxF32 b) + { + const PxF32 r = static_cast(Rand()) / (static_cast(0x7fff) + 1.0f); + return r * (b - a) + a; + } + //returns numbers from [a, b-1] + PX_FORCE_INLINE PxI32 Rand(PxI32 a, PxI32 b) + { + return a + static_cast(Rand() % (b - a)); + } + + PX_FORCE_INLINE void SetSeed(PxU32 seed) + { + gRandomR250.setSeed(seed); + } + +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRefCountable.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRefCountable.h new file mode 100644 index 0000000..755fe5a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRefCountable.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_REFCOUNTABLE_H +#define CM_REFCOUNTABLE_H + +#include "foundation/PxAssert.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxAllocator.h" +#include "common/PxBase.h" + +namespace physx +{ +namespace Cm +{ + // PT: this is used to re-implement RefCountable using the ref-counter in PxBase, i.e. to dissociate + // the RefCountable data from the RefCountable code. The goal is to be able to store the ref counter + // in the padding bytes of PxBase, and also to avoid two v-table pointers in the class. + class RefCountableExt : public PxRefCounted + { + public: + + RefCountableExt() : PxRefCounted(0, PxBaseFlags(0)) {} + + void preExportDataReset() + { + mBuiltInRefCount = 1; + } + + void incRefCount() + { + volatile PxI32* val = reinterpret_cast(&mBuiltInRefCount); + PxAtomicIncrement(val); + // value better be greater than 1, or we've created a ref to an undefined object + PX_ASSERT(mBuiltInRefCount>1); + } + + void decRefCount() + { + PX_ASSERT(mBuiltInRefCount>0); + volatile PxI32* val = reinterpret_cast(&mBuiltInRefCount); + if(physx::PxAtomicDecrement(val) == 0) + onRefCountZero(); + } + + PX_FORCE_INLINE PxU32 getRefCount() const + { + return mBuiltInRefCount; + } + }; + + PX_FORCE_INLINE void RefCountable_preExportDataReset(PxRefCounted& base) { static_cast(base).preExportDataReset(); } + PX_FORCE_INLINE void RefCountable_incRefCount(PxRefCounted& base) { static_cast(base).incRefCount(); } + PX_FORCE_INLINE void RefCountable_decRefCount(PxRefCounted& base) { static_cast(base).decRefCount(); } + PX_FORCE_INLINE PxU32 RefCountable_getRefCount(const PxRefCounted& base) { return static_cast(base).getRefCount(); } + + // simple thread-safe reference count + // when the ref count is zero, the object is in an undefined state (pending delete) + + class RefCountable + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + RefCountable(const PxEMPTY) { PX_ASSERT(mRefCount == 1); } + void preExportDataReset() { mRefCount = 1; } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + explicit RefCountable(PxU32 initialCount = 1) + : mRefCount(PxI32(initialCount)) + { + PX_ASSERT(mRefCount!=0); + } + + virtual ~RefCountable() {} + + /** + Calls 'delete this;'. It needs to be overloaded for classes also deriving from + PxBase and call 'Cm::deletePxBase(this);' instead. + */ + virtual void onRefCountZero() + { + PX_DELETE_THIS; + } + + void incRefCount() + { + physx::PxAtomicIncrement(&mRefCount); + // value better be greater than 1, or we've created a ref to an undefined object + PX_ASSERT(mRefCount>1); + } + + void decRefCount() + { + PX_ASSERT(mRefCount>0); + if(physx::PxAtomicDecrement(&mRefCount) == 0) + onRefCountZero(); + } + + PX_FORCE_INLINE PxU32 getRefCount() const + { + return PxU32(mRefCount); + } + private: + volatile PxI32 mRefCount; + }; + + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRenderBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRenderBuffer.h new file mode 100644 index 0000000..9a07a64 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmRenderBuffer.h @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_RENDER_BUFFER_H +#define CM_RENDER_BUFFER_H + +#include "common/PxRenderBuffer.h" +#include "CmUtils.h" +#include "foundation/PxArray.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Cm +{ + /** + Implementation of PxRenderBuffer. + */ + class RenderBuffer : public PxRenderBuffer, public PxUserAllocated + { + + template + void append(PxArray& dst, const T* src, PxU32 count) + { + dst.reserve(dst.size() + count); + for(const T* end=src+count; src mPoints; + PxArray mLines; + PxArray mTriangles; + }; + +} // Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmScaling.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmScaling.h new file mode 100644 index 0000000..8ddae5a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmScaling.h @@ -0,0 +1,241 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_SCALING_H +#define CM_SCALING_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxMat34.h" +#include "foundation/PxSIMDHelpers.h" +#include "geometry/PxMeshScale.h" +#include "CmUtils.h" + +namespace physx +{ +namespace Cm +{ + // PT: same as PxMeshScale::toMat33() but faster + PX_FORCE_INLINE PxMat33 toMat33(const PxMeshScale& meshScale) + { + const PxMat33Padded rot(meshScale.rotation); + + PxMat33 trans = rot.getTranspose(); + trans.column0 *= meshScale.scale[0]; + trans.column1 *= meshScale.scale[1]; + trans.column2 *= meshScale.scale[2]; + return trans * rot; + } + + // class that can perform scaling fast. Relatively large size, generated from PxMeshScale on demand. + // CS: I've removed most usages of this class, because most of the time only one-way transform is needed. + // If you only need a temporary FastVertex2ShapeScaling, setup your transform as PxMat34Legacy and use + // normal matrix multiplication or a transform() overload to convert points and bounds between spaces. + class FastVertex2ShapeScaling + { + public: + PX_INLINE FastVertex2ShapeScaling() + { + //no scaling by default: + vertex2ShapeSkew = PxMat33(PxIdentity); + shape2VertexSkew = PxMat33(PxIdentity); + mFlipNormal = false; + } + + PX_INLINE explicit FastVertex2ShapeScaling(const PxMeshScale& scale) + { + init(scale); + } + + PX_INLINE FastVertex2ShapeScaling(const PxVec3& scale, const PxQuat& rotation) + { + init(scale, rotation); + } + + PX_INLINE void init(const PxMeshScale& scale) + { + init(scale.scale, scale.rotation); + } + + PX_INLINE void setIdentity() + { + vertex2ShapeSkew = PxMat33(PxIdentity); + shape2VertexSkew = PxMat33(PxIdentity); + mFlipNormal = false; + } + + PX_INLINE void init(const PxVec3& scale, const PxQuat& rotation) + { + // TODO: may want to optimize this for cases where we have uniform or axis aligned scaling! + // That would introduce branches and it's unclear to me whether that's faster than just doing the math. + // Lazy computation would be another option, at the cost of introducing even more branches. + + const PxMat33Padded R(rotation); + vertex2ShapeSkew = R.getTranspose(); + const PxMat33 diagonal = PxMat33::createDiagonal(scale); + vertex2ShapeSkew = vertex2ShapeSkew * diagonal; + vertex2ShapeSkew = vertex2ShapeSkew * R; + + /* + The inverse, is, explicitly: + shape2VertexSkew.setTransposed(R); + shape2VertexSkew.multiplyDiagonal(PxVec3(1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z)); + shape2VertexSkew *= R; + + It may be competitive to compute the inverse -- though this has a branch in it: + */ + + shape2VertexSkew = vertex2ShapeSkew.getInverse(); + + mFlipNormal = ((scale.x * scale.y * scale.z) < 0.0f); + } + + PX_FORCE_INLINE void flipNormal(PxVec3& v1, PxVec3& v2) const + { + if (mFlipNormal) + { + PxVec3 tmp = v1; v1 = v2; v2 = tmp; + } + } + + PX_FORCE_INLINE PxVec3 operator* (const PxVec3& src) const + { + return vertex2ShapeSkew * src; + } + + PX_FORCE_INLINE PxVec3 operator% (const PxVec3& src) const + { + return shape2VertexSkew * src; + } + + PX_FORCE_INLINE const PxMat33& getVertex2ShapeSkew() const + { + return vertex2ShapeSkew; + } + + PX_FORCE_INLINE const PxMat33& getShape2VertexSkew() const + { + return shape2VertexSkew; + } + + PX_INLINE PxMat34 getVertex2WorldSkew(const PxMat34& shape2world) const + { + const PxMat34 vertex2worldSkew = shape2world * getVertex2ShapeSkew(); + //vertex2worldSkew = shape2world * [vertex2shapeSkew, 0] + //[aR at] * [bR bt] = [aR * bR aR * bt + at] NOTE: order of operations important so it works when this ?= left ?= right. + return vertex2worldSkew; + } + + PX_INLINE PxMat34 getWorld2VertexSkew(const PxMat34& shape2world) const + { + //world2vertexSkew = shape2vertex * invPQ(shape2world) + //[aR 0] * [bR' -bR'*bt] = [aR * bR' -aR * bR' * bt + 0] + + const PxMat33 rotate( shape2world[0], shape2world[1], shape2world[2] ); + const PxMat33 M = getShape2VertexSkew() * rotate.getTranspose(); + return PxMat34(M[0], M[1], M[2], -M * shape2world[3]); + } + + //! Transforms a shape space OBB to a vertex space OBB. All 3 params are in and out. + void transformQueryBounds(PxVec3& center, PxVec3& extents, PxMat33& basis) const + { + basis.column0 = shape2VertexSkew * (basis.column0 * extents.x); + basis.column1 = shape2VertexSkew * (basis.column1 * extents.y); + basis.column2 = shape2VertexSkew * (basis.column2 * extents.z); + + center = shape2VertexSkew * center; + extents = PxOptimizeBoundingBox(basis); + } + + void transformPlaneToShapeSpace(const PxVec3& nIn, const PxReal dIn, PxVec3& nOut, PxReal& dOut) const + { + const PxVec3 tmp = shape2VertexSkew.transformTranspose(nIn); + const PxReal denom = 1.0f / tmp.magnitude(); + nOut = tmp * denom; + dOut = dIn * denom; + } + + PX_FORCE_INLINE bool flipsNormal() const { return mFlipNormal; } + + private: + PxMat33 vertex2ShapeSkew; + PxMat33 shape2VertexSkew; + bool mFlipNormal; + }; + + PX_FORCE_INLINE void getScaledVertices(PxVec3* v, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, bool idtMeshScale, const Cm::FastVertex2ShapeScaling& scaling) + { + if(idtMeshScale) + { + v[0] = v0; + v[1] = v1; + v[2] = v2; + } + else + { + const PxI32 winding = scaling.flipsNormal() ? 1 : 0; + v[0] = scaling * v0; + v[1+winding] = scaling * v1; + v[2-winding] = scaling * v2; + } + } + +} // namespace Cm + + +PX_INLINE PxMat34 operator*(const PxTransform& transform, const PxMeshScale& scale) +{ + const PxMat33Padded tmp(transform.q); + + return PxMat34(tmp * Cm::toMat33(scale), transform.p); +} + +PX_INLINE PxMat34 operator*(const PxMeshScale& scale, const PxTransform& transform) +{ + const PxMat33 scaleMat = Cm::toMat33(scale); + const PxMat33Padded t(transform.q); + const PxMat33 r = scaleMat * t; + const PxVec3 p = scaleMat * transform.p; + return PxMat34(r, p); +} + +PX_INLINE PxMat34 operator*(const PxMat34& transform, const PxMeshScale& scale) +{ + return PxMat34(transform.m * Cm::toMat33(scale), transform.p); +} + +PX_INLINE PxMat34 operator*(const PxMeshScale& scale, const PxMat34& transform) +{ + const PxMat33 scaleMat = Cm::toMat33(scale); + return PxMat34(scaleMat * transform.m, scaleMat * transform.p); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp new file mode 100644 index 0000000..dbf1756 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSerialize.cpp @@ -0,0 +1,416 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxUtilities.h" +#include "CmSerialize.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Cm; + +void physx::readChunk(PxI8& a, PxI8& b, PxI8& c, PxI8& d, PxInputStream& stream) +{ + stream.read(&a, sizeof(PxI8)); + stream.read(&b, sizeof(PxI8)); + stream.read(&c, sizeof(PxI8)); + stream.read(&d, sizeof(PxI8)); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU16 physx::readWord(bool mismatch, PxInputStream& stream) +{ + PxU16 d; + stream.read(&d, sizeof(PxU16)); + + if(mismatch) + flip(d); + return d; +} + +PxU32 physx::readDword(bool mismatch, PxInputStream& stream) +{ + PxU32 d; + stream.read(&d, sizeof(PxU32)); + + if(mismatch) + flip(d); + return d; +} + +PxF32 physx::readFloat(bool mismatch, PxInputStream& stream) +{ + union + { + PxU32 d; + PxF32 f; + } u; + + stream.read(&u.d, sizeof(PxU32)); + + if(mismatch) + flip(u.d); + return u.f; +} + +/////////////////////////////////////////////////////////////////////////////// + +void physx::writeWord(PxU16 value, bool mismatch, PxOutputStream& stream) +{ + if(mismatch) + flip(value); + stream.write(&value, sizeof(PxU16)); +} + +void physx::writeDword(PxU32 value, bool mismatch, PxOutputStream& stream) +{ + if(mismatch) + flip(value); + stream.write(&value, sizeof(PxU32)); +} + +void physx::writeFloat(PxF32 value, bool mismatch, PxOutputStream& stream) +{ + if(mismatch) + flip(value); + stream.write(&value, sizeof(PxF32)); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool physx::readFloatBuffer(PxF32* dest, PxU32 nbFloats, bool mismatch, PxInputStream& stream) +{ + stream.read(dest, sizeof(PxF32)*nbFloats); + if(mismatch) + { + for(PxU32 i=0;imaxIndex) + maxIndex = currentIndex; + } + return maxIndex; +} +PxU16 physx::computeMaxIndex(const PxU16* indices, PxU32 nbIndices) +{ + PxU16 maxIndex=0; + while(nbIndices--) + { + PxU16 currentIndex = *indices++; + if(currentIndex>maxIndex) + maxIndex = currentIndex; + } + return maxIndex; +} + +void physx::storeIndices(PxU32 maxIndex, PxU32 nbIndices, const PxU32* indices, PxOutputStream& stream, bool platformMismatch) +{ + if(maxIndex<=0xff) + { + for(PxU32 i=0;i(PxAlloca(nbIndices*sizeof(PxU8))); + stream.read(tmp, nbIndices*sizeof(PxU8)); + for(PxU32 i=0;i(PxAlloca(nbIndices*sizeof(PxU16))); + readWordBuffer(tmp, nbIndices, platformMismatch, stream); + for(PxU32 i=0;i(PxAlloca(nbIndices*sizeof(PxU8))); + stream.read(tmp, nbIndices*sizeof(PxU8)); + for(PxU32 i=0;i(&v); + PxU8 temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } + + PX_INLINE void flip(PxI16& v) + { + PxI8* b = reinterpret_cast(&v); + PxI8 temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } + + PX_INLINE void flip(PxU32& v) + { + PxU8* b = reinterpret_cast(&v); + + PxU8 temp = b[0]; + b[0] = b[3]; + b[3] = temp; + temp = b[1]; + b[1] = b[2]; + b[2] = temp; + } + + // MS: It is important to modify the value directly and not use a temporary variable or a return + // value. The reason for this is that a flipped float might have a bit pattern which indicates + // an invalid float. If such a float is assigned to another float, the bit pattern + // can change again (maybe to map invalid floats to a common invalid pattern?). + // When reading the float and flipping again, the changed bit pattern will result in a different + // float than the original one. + PX_INLINE void flip(PxF32& v) + { + PxU8* b = reinterpret_cast(&v); + + PxU8 temp = b[0]; + b[0] = b[3]; + b[3] = temp; + temp = b[1]; + b[1] = b[2]; + b[2] = temp; + } + + PX_INLINE void writeChunk(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxOutputStream& stream) + { + stream.write(&a, sizeof(PxI8)); + stream.write(&b, sizeof(PxI8)); + stream.write(&c, sizeof(PxI8)); + stream.write(&d, sizeof(PxI8)); + } + + void readChunk(PxI8& a, PxI8& b, PxI8& c, PxI8& d, PxInputStream& stream); + + PxU16 readWord(bool mismatch, PxInputStream& stream); + PxU32 readDword(bool mismatch, PxInputStream& stream); + PxF32 readFloat(bool mismatch, PxInputStream& stream); + + void writeWord(PxU16 value, bool mismatch, PxOutputStream& stream); + void writeDword(PxU32 value, bool mismatch, PxOutputStream& stream); + void writeFloat(PxF32 value, bool mismatch, PxOutputStream& stream); + + bool readFloatBuffer(PxF32* dest, PxU32 nbFloats, bool mismatch, PxInputStream& stream); + void writeFloatBuffer(const PxF32* src, PxU32 nb, bool mismatch, PxOutputStream& stream); + void writeWordBuffer(const PxU16* src, PxU32 nb, bool mismatch, PxOutputStream& stream); + void readWordBuffer(PxU16* dest, PxU32 nb, bool mismatch, PxInputStream& stream); + void writeWordBuffer(const PxI16* src, PxU32 nb, bool mismatch, PxOutputStream& stream); + void readWordBuffer(PxI16* dest, PxU32 nb, bool mismatch, PxInputStream& stream); + void writeByteBuffer(const PxU8* src, PxU32 nb, PxOutputStream& stream); + void readByteBuffer(PxU8* dest, PxU32 nb, PxInputStream& stream); + + bool writeHeader(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxU32 version, bool mismatch, PxOutputStream& stream); + bool readHeader(PxI8 a, PxI8 b, PxI8 c, PxI8 d, PxU32& version, bool& mismatch, PxInputStream& stream); + + PX_INLINE bool readIntBuffer(PxU32* dest, PxU32 nbInts, bool mismatch, PxInputStream& stream) + { + return readFloatBuffer(reinterpret_cast(dest), nbInts, mismatch, stream); + } + + PX_INLINE void writeIntBuffer(const PxU32* src, PxU32 nb, bool mismatch, PxOutputStream& stream) + { + writeFloatBuffer(reinterpret_cast(src), nb, mismatch, stream); + } + + PX_INLINE bool ReadDwordBuffer(PxU32* dest, PxU32 nb, bool mismatch, PxInputStream& stream) + { + return readFloatBuffer(reinterpret_cast(dest), nb, mismatch, stream); + } + + PX_INLINE void WriteDwordBuffer(const PxU32* src, PxU32 nb, bool mismatch, PxOutputStream& stream) + { + writeFloatBuffer(reinterpret_cast(src), nb, mismatch, stream); + } + + PxU32 computeMaxIndex(const PxU32* indices, PxU32 nbIndices); + PxU16 computeMaxIndex(const PxU16* indices, PxU32 nbIndices); + void storeIndices(PxU32 maxIndex, PxU32 nbIndices, const PxU32* indices, PxOutputStream& stream, bool platformMismatch); + void readIndices(PxU32 maxIndex, PxU32 nbIndices, PxU32* indices, PxInputStream& stream, bool platformMismatch); + + // PT: see PX-1163 + PX_FORCE_INLINE bool readBigEndianVersionNumber(PxInputStream& stream, bool mismatch_, PxU32& fileVersion, bool& mismatch) + { + // PT: allright this is going to be subtle: + // - in version 1 the data was always saved in big-endian format + // - *including the version number*! + // - so we cannot just read the version "as usual" using the passed mismatch param + + // PT: mismatch value for version 1 + mismatch = (PxLittleEndian() == 1); + + const PxU32 rawFileVersion = readDword(false, stream); + if(rawFileVersion==1) + { + // PT: this is a version-1 file with no flip + fileVersion = 1; + PX_ASSERT(!mismatch); + } + else + { + PxU32 fileVersionFlipped = rawFileVersion; + flip(fileVersionFlipped); + if(fileVersionFlipped==1) + { + // PT: this is a version-1 file with flip + fileVersion = 1; + PX_ASSERT(mismatch); + } + else + { + // PT: this is at least version 2 so we can process it "as usual" + mismatch = mismatch_; + fileVersion = mismatch_ ? fileVersionFlipped : rawFileVersion; + } + } + + PX_ASSERT(fileVersion<=3); + if(fileVersion>3) + return false; + return true; + } + +// PT: TODO: copied from IceSerialize.h, still needs to be refactored/cleaned up. +namespace Cm +{ + bool WriteHeader(PxU8 a, PxU8 b, PxU8 c, PxU8 d, PxU32 version, bool mismatch, PxOutputStream& stream); + bool ReadHeader(PxU8 a_, PxU8 b_, PxU8 c_, PxU8 d_, PxU32& version, bool& mismatch, PxInputStream& stream); + + void StoreIndices(PxU32 maxIndex, PxU32 nbIndices, const PxU32* indices, PxOutputStream& stream, bool platformMismatch); + void ReadIndices(PxU32 maxIndex, PxU32 nbIndices, PxU32* indices, PxInputStream& stream, bool platformMismatch); + + void StoreIndices(PxU16 maxIndex, PxU32 nbIndices, const PxU16* indices, PxOutputStream& stream, bool platformMismatch); + void ReadIndices(PxU16 maxIndex, PxU32 nbIndices, PxU16* indices, PxInputStream& stream, bool platformMismatch); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSpatialVector.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSpatialVector.h new file mode 100644 index 0000000..fc7f5a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmSpatialVector.h @@ -0,0 +1,532 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_SPATIAL_VECTOR_H +#define CM_SPATIAL_VECTOR_H + +#include "foundation/PxVec3.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxTransform.h" + +/*! +Combination of two R3 vectors. +*/ + +namespace physx +{ +namespace Cm +{ +PX_ALIGN_PREFIX(16) +class SpatialVector +{ +public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector() + {} + + //! Construct from two PxcVectors + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector(const PxVec3& lin, const PxVec3& ang) + : linear(lin), pad0(0.0f), angular(ang), pad1(0.0f) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE ~SpatialVector() + {} + + // PT: this one is very important. Without it, the Xbox compiler generates weird "float-to-int" and "int-to-float" LHS + // each time we copy a SpatialVector (see for example PIX on "solveSimpleGroupA" without this operator). + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator = (const SpatialVector& v) + { + linear = v.linear; + pad0 = 0.0f; + angular = v.angular; + pad1 = 0.0f; + } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector zero() { return SpatialVector(PxVec3(0),PxVec3(0)); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector operator+(const SpatialVector& v) const + { + return SpatialVector(linear+v.linear,angular+v.angular); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector operator-(const SpatialVector& v) const + { + return SpatialVector(linear-v.linear,angular-v.angular); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector operator-() const + { + return SpatialVector(-linear,-angular); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVector operator *(PxReal s) const + { + return SpatialVector(linear*s,angular*s); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator+=(const SpatialVector& v) + { + linear+=v.linear; + angular+=v.angular; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator-=(const SpatialVector& v) + { + linear-=v.linear; + angular-=v.angular; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal magnitude() const + { + return angular.magnitude() + linear.magnitude(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal dot(const SpatialVector& v) const + { + return linear.dot(v.linear) + angular.dot(v.angular); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const + { + return linear.isFinite() && angular.isFinite(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVector scale(PxReal l, PxReal a) const + { + return Cm::SpatialVector(linear*l, angular*a); + } + + PxVec3 linear; + PxReal pad0; + PxVec3 angular; + PxReal pad1; +} +PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +struct SpatialVectorF +{ +public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF() + {} + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF(const PxReal* v) + : pad0(0.0f), pad1(0.0f) + { + top.x = v[0]; top.y = v[1]; top.z = v[2]; + bottom.x = v[3]; bottom.y = v[4]; bottom.z = v[5]; + } + //! Construct from two PxcVectors + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF(const PxVec3& top_, const PxVec3& bottom_) + : top(top_), pad0(0.0f), bottom(bottom_), pad1(0.0f) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE ~SpatialVectorF() + {} + + // PT: this one is very important. Without it, the Xbox compiler generates weird "float-to-int" and "int-to-float" LHS + // each time we copy a SpatialVector (see for example PIX on "solveSimpleGroupA" without this operator). + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator = (const SpatialVectorF& v) + { + top = v.top; + pad0 = 0.0f; + bottom = v.bottom; + pad1 = 0.0f; + } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF Zero() { return SpatialVectorF(PxVec3(0), PxVec3(0)); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF operator+(const SpatialVectorF& v) const + { + return SpatialVectorF(top + v.top, bottom + v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF operator-(const SpatialVectorF& v) const + { + return SpatialVectorF(top - v.top, bottom - v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF operator-() const + { + return SpatialVectorF(-top, -bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF operator *(PxReal s) const + { + return SpatialVectorF(top*s, bottom*s); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF multiply(const SpatialVectorF& v) const + { + return SpatialVectorF(top.multiply(v.top), bottom.multiply(v.bottom)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator *= (const PxReal s) + { + top *= s; + bottom *= s; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator += (const SpatialVectorF& v) + { + top += v.top; + bottom += v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator -= (const SpatialVectorF& v) + { + top -= v.top; + bottom -= v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal magnitude() const + { + return top.magnitude() + bottom.magnitude(); + } + + PX_FORCE_INLINE PxReal magnitudeSquared() const + { + return top.magnitudeSquared() + bottom.magnitudeSquared(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal innerProduct(const SpatialVectorF& v) const + { + return bottom.dot(v.top) + top.dot(v.bottom); + /*PxVec3 p0 = bottom.multiply(v.top); + PxVec3 p1 = top.multiply(v.bottom); + + PxReal result = (((p1.y + p1.z) + (p0.z + p1.x)) + (p0.x + p0.y)); + return result;*/ + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal dot(const SpatialVectorF& v) const + { + return top.dot(v.top) + bottom.dot(v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal dot(const SpatialVector& v) const + { + return bottom.dot(v.angular) + top.dot(v.linear); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF cross(const SpatialVectorF& v) const + { + SpatialVectorF a; + a.top = top.cross(v.top); + a.bottom = top.cross(v.bottom) + bottom.cross(v.top); + return a; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF abs() const + { + return SpatialVectorF(top.abs(), bottom.abs()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF rotate(const PxTransform& rot) const + { + return SpatialVectorF(rot.rotate(top), rot.rotate(bottom)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialVectorF rotateInv(const PxTransform& rot) const + { + return SpatialVectorF(rot.rotateInv(top), rot.rotateInv(bottom)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const + { + return top.isFinite() && bottom.isFinite(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid(const PxReal maxV) const + { + const bool tValid = ((PxAbs(top.x) <= maxV) && (PxAbs(top.y) <= maxV) && (PxAbs(top.z) <= maxV)); + const bool bValid = ((PxAbs(bottom.x) <= maxV) && (PxAbs(bottom.y) <= maxV) && (PxAbs(bottom.z) <= maxV)); + + return tValid && bValid; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF scale(PxReal l, PxReal a) const + { + return Cm::SpatialVectorF(top*l, bottom*a); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void assignTo(PxReal* val) const + { + val[0] = top.x; val[1] = top.y; val[2] = top.z; + val[3] = bottom.x; val[4] = bottom.y; val[5] = bottom.z; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal& operator [] (const PxU32 index) + { + PX_ASSERT(index < 6); + if(index < 3) + return top[index]; + return bottom[index-3]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxReal& operator [] (const PxU32 index) const + { + PX_ASSERT(index < 6); + if (index < 3) + return top[index]; + return bottom[index-3]; + } + + PxVec3 top; + PxReal pad0; + PxVec3 bottom; + PxReal pad1; +} PX_ALIGN_SUFFIX(16); + +struct UnAlignedSpatialVector +{ +public: + //! Default constructor + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector() + {} + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector(const PxReal* v) + { + top.x = v[0]; top.y = v[1]; top.z = v[2]; + bottom.x = v[3]; bottom.y = v[4]; bottom.z = v[5]; + } + //! Construct from two PxcVectors + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector(const PxVec3& top_, const PxVec3& bottom_) + : top(top_), bottom(bottom_) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE ~UnAlignedSpatialVector() + {} + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator = (const SpatialVectorF& v) + { + top = v.top; + bottom = v.bottom; + } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector Zero() { return UnAlignedSpatialVector(PxVec3(0), PxVec3(0)); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector operator+(const UnAlignedSpatialVector& v) const + { + return UnAlignedSpatialVector(top + v.top, bottom + v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector operator-(const UnAlignedSpatialVector& v) const + { + return UnAlignedSpatialVector(top - v.top, bottom - v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector operator-() const + { + return UnAlignedSpatialVector(-top, -bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector operator *(PxReal s) const + { + return UnAlignedSpatialVector(top*s, bottom*s); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator *= (const PxReal s) + { + top *= s; + bottom *= s; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator += (const UnAlignedSpatialVector& v) + { + top += v.top; + bottom += v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator += (const SpatialVectorF& v) + { + top += v.top; + bottom += v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator -= (const UnAlignedSpatialVector& v) + { + top -= v.top; + bottom -= v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator -= (const SpatialVectorF& v) + { + top -= v.top; + bottom -= v.bottom; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal magnitude() const + { + return top.magnitude() + bottom.magnitude(); + } + + PX_FORCE_INLINE PxReal magnitudeSquared() const + { + return top.magnitudeSquared() + bottom.magnitudeSquared(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal innerProduct(const UnAlignedSpatialVector& v) const + { + return bottom.dot(v.top) + top.dot(v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal innerProduct(const SpatialVectorF& v) const + { + return bottom.dot(v.top) + top.dot(v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal dot(const UnAlignedSpatialVector& v) const + { + return top.dot(v.top) + bottom.dot(v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal dot(const SpatialVectorF& v) const + { + return top.dot(v.top) + bottom.dot(v.bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector cross(const UnAlignedSpatialVector& v) const + { + UnAlignedSpatialVector a; + a.top = top.cross(v.top); + a.bottom = top.cross(v.bottom) + bottom.cross(v.top); + return a; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector abs() const + { + return UnAlignedSpatialVector(top.abs(), bottom.abs()); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector rotate(const PxTransform& rot) const + { + return UnAlignedSpatialVector(rot.rotate(top), rot.rotate(bottom)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE UnAlignedSpatialVector rotateInv(const PxTransform& rot) const + { + return UnAlignedSpatialVector(rot.rotateInv(top), rot.rotateInv(bottom)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite() const + { + return top.isFinite() && bottom.isFinite(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isValid(const PxReal maxV) const + { + const bool tValid = ((top.x <= maxV) && (top.y <= maxV) && (top.z <= maxV)); + const bool bValid = ((bottom.x <= maxV) && (bottom.y <= maxV) && (bottom.z <= maxV)); + + return tValid && bValid; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector scale(PxReal l, PxReal a) const + { + return Cm::UnAlignedSpatialVector(top*l, bottom*a); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void assignTo(PxReal* val) const + { + val[0] = top.x; val[1] = top.y; val[2] = top.z; + val[3] = bottom.x; val[4] = bottom.y; val[5] = bottom.z; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal& operator [] (const PxU32 index) + { + PX_ASSERT(index < 6); + return (&top.x)[index]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxReal& operator [] (const PxU32 index) const + { + PX_ASSERT(index < 6); + return (&top.x)[index]; + } + + PxVec3 top; //12 12 + PxVec3 bottom; //12 24 +}; + +PX_ALIGN_PREFIX(16) +struct SpatialVectorV +{ + aos::Vec3V linear; + aos::Vec3V angular; + + PX_FORCE_INLINE SpatialVectorV() {} + PX_FORCE_INLINE SpatialVectorV(PxZERO): linear(aos::V3Zero()), angular(aos::V3Zero()) {} + PX_FORCE_INLINE SpatialVectorV(const Cm::SpatialVector& v): linear(aos::V3LoadA(&v.linear.x)), angular(aos::V3LoadA(&v.angular.x)) {} + PX_FORCE_INLINE SpatialVectorV(const aos::Vec3VArg l, const aos::Vec3VArg a): linear(l), angular(a) {} + PX_FORCE_INLINE SpatialVectorV(const SpatialVectorV& other): linear(other.linear), angular(other.angular) {} + + PX_FORCE_INLINE SpatialVectorV& operator=(const SpatialVectorV& other) { linear = other.linear; angular = other.angular; return *this; } + + PX_FORCE_INLINE SpatialVectorV operator+(const SpatialVectorV& other) const { return SpatialVectorV(aos::V3Add(linear,other.linear), + aos::V3Add(angular, other.angular)); } + + PX_FORCE_INLINE SpatialVectorV& operator+=(const SpatialVectorV& other) { linear = aos::V3Add(linear,other.linear); + angular = aos::V3Add(angular, other.angular); + return *this; + } + + PX_FORCE_INLINE SpatialVectorV operator-(const SpatialVectorV& other) const { return SpatialVectorV(aos::V3Sub(linear,other.linear), + aos::V3Sub(angular, other.angular)); } + + PX_FORCE_INLINE SpatialVectorV operator-() const { return SpatialVectorV(aos::V3Neg(linear), aos::V3Neg(angular)); } + + PX_FORCE_INLINE SpatialVectorV operator*(const aos::FloatVArg r) const { return SpatialVectorV(aos::V3Scale(linear,r), aos::V3Scale(angular,r)); } + + PX_FORCE_INLINE SpatialVectorV& operator-=(const SpatialVectorV& other) { linear = aos::V3Sub(linear,other.linear); + angular = aos::V3Sub(angular, other.angular); + return *this; + } + + PX_FORCE_INLINE aos::FloatV dot(const SpatialVectorV& other) const { return aos::V3SumElems(aos::V3Add(aos::V3Mul(linear, other.linear), aos::V3Mul(angular, other.angular))); } + + PX_FORCE_INLINE SpatialVectorV multiply(const SpatialVectorV& other) const { return SpatialVectorV(aos::V3Mul(linear, other.linear), aos::V3Mul(angular, other.angular)); } + + PX_FORCE_INLINE SpatialVectorV multiplyAdd(const SpatialVectorV& m, const SpatialVectorV& a) const { return SpatialVectorV(aos::V3MulAdd(linear, m.linear, a.linear), aos::V3MulAdd(angular, m.angular, a.angular)); } + + PX_FORCE_INLINE SpatialVectorV scale(const aos::FloatV& a, const aos::FloatV& b) const { return SpatialVectorV(aos::V3Scale(linear, a), aos::V3Scale(angular, b)); } + +}PX_ALIGN_SUFFIX(16); + +} // namespace Cm + +PX_COMPILE_TIME_ASSERT(sizeof(Cm::SpatialVector) == 32); +PX_COMPILE_TIME_ASSERT(sizeof(Cm::SpatialVectorV) == 32); + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTask.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTask.h new file mode 100644 index 0000000..d09e2af --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTask.h @@ -0,0 +1,274 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_TASK_H +#define CM_TASK_H + +#include "task/PxTask.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxMutex.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxFPU.h" + +namespace physx +{ +namespace Cm +{ + // wrapper around the public PxLightCpuTask + // internal SDK tasks should be inherited from + // this and override the runInternal() method + // to ensure that the correct floating point + // state is set / reset during execution + class Task : public physx::PxLightCpuTask + { + public: + Task(PxU64 contextId) + { + mContextID = contextId; + } + + virtual void run() + { +#if PX_SWITCH // special case because default rounding mode is not nearest + PX_FPU_GUARD; +#else + PX_SIMD_GUARD; +#endif + runInternal(); + } + + virtual void runInternal()=0; + }; + + // same as Cm::Task but inheriting from physx::PxBaseTask + // instead of PxLightCpuTask + class BaseTask : public physx::PxBaseTask + { + public: + + virtual void run() + { +#if PX_SWITCH // special case because default rounding mode is not nearest + PX_FPU_GUARD; +#else + PX_SIMD_GUARD; +#endif + runInternal(); + } + + virtual void runInternal()=0; + }; + + template + class DelegateTask : public Cm::Task, public PxUserAllocated + { + public: + + DelegateTask(PxU64 contextID, T* obj, const char* name) : Cm::Task(contextID), mObj(obj), mName(name) {} + + virtual void run() + { +#if PX_SWITCH // special case because default rounding mode is not nearest + PX_FPU_GUARD; +#else + PX_SIMD_GUARD; +#endif + (mObj->*Fn)(mCont); + } + + virtual void runInternal() + { + (mObj->*Fn)(mCont); + } + + virtual const char* getName() const + { + return mName; + } + + void setObject(T* obj) { mObj = obj; } + + private: + T* mObj; + const char* mName; + }; + + + /** + \brief A task that maintains a list of dependent tasks. + + This task maintains a list of dependent tasks that have their reference counts + reduced on completion of the task. + + The refcount is incremented every time a dependent task is added. + */ + class FanoutTask : public Cm::BaseTask + { + PX_NOCOPY(FanoutTask) + public: + FanoutTask(PxU64 contextID, const char* name) : Cm::BaseTask(), mRefCount(0), mName(name), mNotifySubmission(false) { mContextID = contextID; } + + virtual void runInternal() {} + + virtual const char* getName() const { return mName; } + + /** + Swap mDependents with mReferencesToRemove when refcount goes to 0. + */ + virtual void removeReference() + { + PxMutex::ScopedLock lock(mMutex); + if (!physx::PxAtomicDecrement(&mRefCount)) + { + // prevents access to mReferencesToRemove until release + physx::PxAtomicIncrement(&mRefCount); + mNotifySubmission = false; + PX_ASSERT(mReferencesToRemove.empty()); + for (PxU32 i = 0; i < mDependents.size(); i++) + mReferencesToRemove.pushBack(mDependents[i]); + mDependents.clear(); + mTm->getCpuDispatcher()->submitTask(*this); + } + } + + /** + \brief Increases reference count + */ + virtual void addReference() + { + PxMutex::ScopedLock lock(mMutex); + physx::PxAtomicIncrement(&mRefCount); + mNotifySubmission = true; + } + + /** + \brief Return the ref-count for this task + */ + PX_INLINE PxI32 getReference() const + { + return mRefCount; + } + + /** + Sets the task manager. Doesn't increase the reference count. + */ + PX_INLINE void setTaskManager(physx::PxTaskManager& tm) + { + mTm = &tm; + } + + /** + Adds a dependent task. It also sets the task manager querying it from the dependent task. + The refcount is incremented every time a dependent task is added. + */ + PX_INLINE void addDependent(physx::PxBaseTask& dependent) + { + PxMutex::ScopedLock lock(mMutex); + physx::PxAtomicIncrement(&mRefCount); + mTm = dependent.getTaskManager(); + mDependents.pushBack(&dependent); + dependent.addReference(); + mNotifySubmission = true; + } + + /** + Reduces reference counts of the continuation task and the dependent tasks, also + clearing the copy of continuation and dependents task list. + */ + virtual void release() + { + PxInlineArray referencesToRemove; + + { + PxMutex::ScopedLock lock(mMutex); + + const PxU32 contCount = mReferencesToRemove.size(); + referencesToRemove.reserve(contCount); + for (PxU32 i=0; i < contCount; ++i) + referencesToRemove.pushBack(mReferencesToRemove[i]); + + mReferencesToRemove.clear(); + // allow access to mReferencesToRemove again + if (mNotifySubmission) + { + removeReference(); + } + else + { + physx::PxAtomicDecrement(&mRefCount); + } + + // the scoped lock needs to get freed before the continuation tasks get (potentially) submitted because + // those continuation tasks might trigger events that delete this task and corrupt the memory of the + // mutex (for example, assume this task is a member of the scene then the submitted tasks cause the simulation + // to finish and then the scene gets released which in turn will delete this task. When this task then finally + // continues the heap memory will be corrupted. + } + + for (PxU32 i=0; i < referencesToRemove.size(); ++i) + referencesToRemove[i]->removeReference(); + } + + protected: + volatile PxI32 mRefCount; + const char* mName; + PxInlineArray mDependents; + PxInlineArray mReferencesToRemove; + bool mNotifySubmission; + PxMutex mMutex; // guarding mDependents and mNotifySubmission + }; + + + /** + \brief Specialization of FanoutTask class in order to provide the delegation mechanism. + */ + template + class DelegateFanoutTask : public FanoutTask, public PxUserAllocated + { + public: + DelegateFanoutTask(PxU64 contextID, T* obj, const char* name) : + FanoutTask(contextID, name), mObj(obj) { } + + virtual void runInternal() + { + physx::PxBaseTask* continuation = mReferencesToRemove.empty() ? NULL : mReferencesToRemove[0]; + (mObj->*Fn)(continuation); + } + + void setObject(T* obj) { mObj = obj; } + + private: + T* mObj; + }; + +} // namespace Cm + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTransformUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTransformUtils.h new file mode 100644 index 0000000..7d9df2b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmTransformUtils.h @@ -0,0 +1,137 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_TRANSFORM_UTILS_H +#define CM_TRANSFORM_UTILS_H + +#include "foundation/PxVecMath.h" + +namespace +{ + +using namespace physx::aos; + +// V3PrepareCross would help here, but it's not on all platforms yet... + +PX_FORCE_INLINE void transformFast(const FloatVArg wa, const Vec3VArg va, const Vec3VArg pa, + const FloatVArg wb, const Vec3VArg vb, const Vec3VArg pb, + FloatV& wo, Vec3V& vo, Vec3V& po) +{ + wo = FSub(FMul(wa, wb), V3Dot(va, vb)); + vo = V3ScaleAdd(va, wb, V3ScaleAdd(vb, wa, V3Cross(va, vb))); + + const Vec3V t1 = V3Scale(pb, FScaleAdd(wa, wa, FLoad(-0.5f))); + const Vec3V t2 = V3ScaleAdd(V3Cross(va, pb), wa, t1); + const Vec3V t3 = V3ScaleAdd(va, V3Dot(va, pb), t2); + + po = V3ScaleAdd(t3, FLoad(2.f), pa); +} + +PX_FORCE_INLINE void transformInvFast(const FloatVArg wa, const Vec3VArg va, const Vec3VArg pa, + const FloatVArg wb, const Vec3VArg vb, const Vec3VArg pb, + FloatV& wo, Vec3V& vo, Vec3V& po) +{ + wo = FScaleAdd(wa, wb, V3Dot(va, vb)); + vo = V3NegScaleSub(va, wb, V3ScaleAdd(vb, wa, V3Cross(vb, va))); + + const Vec3V pt = V3Sub(pb, pa); + const Vec3V t1 = V3Scale(pt, FScaleAdd(wa, wa, FLoad(-0.5f))); + const Vec3V t2 = V3ScaleAdd(V3Cross(pt, va), wa, t1); + const Vec3V t3 = V3ScaleAdd(va, V3Dot(va, pt), t2); + po = V3Add(t3,t3); +} + +} + +namespace physx +{ +namespace Cm +{ + +PX_FORCE_INLINE void getStaticGlobalPoseAligned(const PxTransform& actor2World, const PxTransform& shape2Actor, PxTransform& outTransform) +{ + using namespace aos; + + PX_ASSERT((size_t(&actor2World)&15) == 0); + PX_ASSERT((size_t(&shape2Actor)&15) == 0); + PX_ASSERT((size_t(&outTransform)&15) == 0); + + const Vec3V actor2WorldPos = V3LoadA(actor2World.p); + const QuatV actor2WorldRot = QuatVLoadA(&actor2World.q.x); + + const Vec3V shape2ActorPos = V3LoadA(shape2Actor.p); + const QuatV shape2ActorRot = QuatVLoadA(&shape2Actor.q.x); + + Vec3V v,p; + FloatV w; + + transformFast(V4GetW(actor2WorldRot), Vec3V_From_Vec4V(actor2WorldRot), actor2WorldPos, + V4GetW(shape2ActorRot), Vec3V_From_Vec4V(shape2ActorRot), shape2ActorPos, + w, v, p); + + V3StoreA(p, outTransform.p); + V4StoreA(V4SetW(v,w), &outTransform.q.x); +} + +PX_FORCE_INLINE void getDynamicGlobalPoseAligned(const PxTransform& body2World, const PxTransform& shape2Actor, const PxTransform& body2Actor, PxTransform& outTransform) +{ + PX_ASSERT((size_t(&body2World)&15) == 0); + PX_ASSERT((size_t(&shape2Actor)&15) == 0); + PX_ASSERT((size_t(&body2Actor)&15) == 0); + PX_ASSERT((size_t(&outTransform)&15) == 0); + + using namespace aos; + + const Vec3V shape2ActorPos = V3LoadA(shape2Actor.p); + const QuatV shape2ActorRot = QuatVLoadA(&shape2Actor.q.x); + + const Vec3V body2ActorPos = V3LoadA(body2Actor.p); + const QuatV body2ActorRot = QuatVLoadA(&body2Actor.q.x); + + const Vec3V body2WorldPos = V3LoadA(body2World.p); + const QuatV body2WorldRot = QuatVLoadA(&body2World.q.x); + + Vec3V v1, p1, v2, p2; + FloatV w1, w2; + + transformInvFast(V4GetW(body2ActorRot), Vec3V_From_Vec4V(body2ActorRot), body2ActorPos, + V4GetW(shape2ActorRot), Vec3V_From_Vec4V(shape2ActorRot), shape2ActorPos, + w1, v1, p1); + + transformFast(V4GetW(body2WorldRot), Vec3V_From_Vec4V(body2WorldRot), body2WorldPos, + w1, v1, p1, + w2, v2, p2); + + V3StoreA(p2, outTransform.p); + V4StoreA(V4SetW(v2, w2), &outTransform.q.x); +} + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmUtils.h new file mode 100644 index 0000000..25ed0f1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmUtils.h @@ -0,0 +1,302 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CM_UTILS_H +#define CM_UTILS_H + +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxBounds3.h" +#include "common/PxBase.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxArray.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxMemory.h" + +namespace physx +{ +namespace Cm +{ + +template +PX_FORCE_INLINE PxU32 getArrayOfPointers(DstType** PX_RESTRICT userBuffer, PxU32 bufferSize, PxU32 startIndex, SrcType*const* PX_RESTRICT src, PxU32 size) +{ + const PxU32 remainder = PxU32(PxMax(PxI32(size - startIndex), 0)); + const PxU32 writeCount = PxMin(remainder, bufferSize); + src += startIndex; + for(PxU32 i=0;i(src[i]); + return writeCount; +} + +PX_CUDA_CALLABLE PX_INLINE void transformInertiaTensor(const PxVec3& invD, const PxMat33& M, PxMat33& mIInv) +{ + const float axx = invD.x*M(0,0), axy = invD.x*M(1,0), axz = invD.x*M(2,0); + const float byx = invD.y*M(0,1), byy = invD.y*M(1,1), byz = invD.y*M(2,1); + const float czx = invD.z*M(0,2), czy = invD.z*M(1,2), czz = invD.z*M(2,2); + + mIInv(0,0) = axx*M(0,0) + byx*M(0,1) + czx*M(0,2); + mIInv(1,1) = axy*M(1,0) + byy*M(1,1) + czy*M(1,2); + mIInv(2,2) = axz*M(2,0) + byz*M(2,1) + czz*M(2,2); + + mIInv(0,1) = mIInv(1,0) = axx*M(1,0) + byx*M(1,1) + czx*M(1,2); + mIInv(0,2) = mIInv(2,0) = axx*M(2,0) + byx*M(2,1) + czx*M(2,2); + mIInv(1,2) = mIInv(2,1) = axy*M(2,0) + byy*M(2,1) + czy*M(2,2); +} + +// PT: TODO: refactor this with PxBounds3 header +PX_FORCE_INLINE PxVec3 basisExtent(const PxVec3& basis0, const PxVec3& basis1, const PxVec3& basis2, const PxVec3& extent) +{ + // extended basis vectors + const PxVec3 c0 = basis0 * extent.x; + const PxVec3 c1 = basis1 * extent.y; + const PxVec3 c2 = basis2 * extent.z; + + // find combination of base vectors that produces max. distance for each component = sum of abs() + return PxVec3 ( PxAbs(c0.x) + PxAbs(c1.x) + PxAbs(c2.x), + PxAbs(c0.y) + PxAbs(c1.y) + PxAbs(c2.y), + PxAbs(c0.z) + PxAbs(c1.z) + PxAbs(c2.z)); +} + +PX_FORCE_INLINE PxBounds3 basisExtent(const PxVec3& center, const PxVec3& basis0, const PxVec3& basis1, const PxVec3& basis2, const PxVec3& extent) +{ + const PxVec3 w = basisExtent(basis0, basis1, basis2, extent); + return PxBounds3(center - w, center + w); +} + +PX_FORCE_INLINE bool isValid(const PxVec3& c, const PxVec3& e) +{ + return (c.isFinite() && e.isFinite() && (((e.x >= 0.0f) && (e.y >= 0.0f) && (e.z >= 0.0f)) || + ((e.x == -PX_MAX_BOUNDS_EXTENTS) && + (e.y == -PX_MAX_BOUNDS_EXTENTS) && + (e.z == -PX_MAX_BOUNDS_EXTENTS)))); +} + +PX_FORCE_INLINE bool isEmpty(const PxVec3& c, const PxVec3& e) +{ + PX_UNUSED(c); + PX_ASSERT(isValid(c, e)); + return e.x<0.0f; +} + +// Array with externally managed storage. +// Allocation and resize policy are managed by the owner, +// Very minimal functionality right now, just POD types + +template +class OwnedArray +{ +public: + OwnedArray() + : mData(0) + , mCapacity(0) + , mSize(0) + {} + + ~OwnedArray() // owner must call releaseMem before destruction + { + PX_ASSERT(mCapacity==0); + } + + void pushBack(T& element, Owner& owner) + { + // there's a failure case if here if we push an existing element which causes a resize - + // a rare case not worth coding around; if you need it, copy the element then push it. + + PX_ASSERT(&element=mData+mSize); + if(mSize==mCapacity) + (owner.*realloc)(mData, mCapacity, mSize, IndexType(mSize+1)); + + PX_ASSERT(mData && mSize=mCapacity) + (owner.*realloc)(mData, mCapacity, mSize, capacity); + } + + void releaseMem(Owner &owner) + { + mSize = 0; + (owner.*realloc)(mData, mCapacity, 0, 0); + } + +private: + T* mData; + IndexType mCapacity; + IndexType mSize; + + // just in case someone tries to use a non-POD in here + union FailIfNonPod + { + T t; + int x; + }; +}; + +/** +Any object deriving from PxBase needs to call this function instead of 'delete object;'. + +We don't want to implement 'operator delete' in PxBase because that would impose how +memory of derived classes is allocated. Even though most or all of the time derived classes will +be user allocated, we don't want to put UserAllocatable into the API and derive from that. +*/ +template +PX_INLINE void deletePxBase(T* object) +{ + if(object->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_DELETE(object); + } + else + object->~T(); +} + +#define PX_PADDING_8 0xcd +#define PX_PADDING_16 0xcdcd +#define PX_PADDING_32 0xcdcdcdcd + +#if PX_CHECKED + /** + Macro to instantiate a type for serialization testing. + Note: Only use PX_NEW_SERIALIZED once in a scope. + */ + #define PX_NEW_SERIALIZED(v,T) \ + void* _buf = physx::PxReflectionAllocator().allocate(sizeof(T),__FILE__,__LINE__); \ + PxMarkSerializedMemory(_buf, sizeof(T)); \ + v = PX_PLACEMENT_NEW(_buf, T) + +#else + #define PX_NEW_SERIALIZED(v,T) v = PX_NEW(T) +#endif + +template +struct ArrayAccess: public PxArray +{ + void store(PxSerializationContext& context) const + { + if(this->mData && (this->mSize || this->capacity())) + context.writeData(this->mData, this->capacity()*sizeof(T)); + } + + void load(PxDeserializationContext& context) + { + if(this->mData && (this->mSize || this->capacity())) + this->mData = context.readExtraData(this->capacity()); + } +}; + +template +void exportArray(const PxArray& a, PxSerializationContext& context) +{ + static_cast&>(a).store(context); +} + +template +void importArray(PxArray& a, PxDeserializationContext& context) +{ + static_cast&>(a).load(context); +} + +template +void exportInlineArray(const PxInlineArray& a, PxSerializationContext& context) +{ + if(!a.isInlined()) + Cm::exportArray(a, context); +} + +template +void importInlineArray(PxInlineArray& a, PxDeserializationContext& context) +{ + if(!a.isInlined()) + Cm::importArray(a, context); +} + +template +static PX_INLINE T* reserveContainerMemory(PxArray& container, PxU32 nb) +{ + const PxU32 maxNbEntries = container.capacity(); + const PxU32 requiredSize = container.size() + nb; + + if(requiredSize>maxNbEntries) + { + const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2; + const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize); + container.reserve(newSize); + } + + T* buf = container.end(); + container.forceSize_Unsafe(requiredSize); + return buf; +} + +} // namespace Cm + + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp new file mode 100644 index 0000000..b52b415 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/CmVisualization.cpp @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CmVisualization.h" + +using namespace physx; +using namespace Cm; + +void Cm::visualizeJointFrames(PxRenderOutput& out, PxReal scale, const PxTransform& parent, const PxTransform& child) +{ + if(scale==0.0f) + return; + + out << parent << PxDebugBasis(PxVec3(scale, scale, scale) * 1.5f, + PxU32(PxDebugColor::eARGB_DARKRED), PxU32(PxDebugColor::eARGB_DARKGREEN), PxU32(PxDebugColor::eARGB_DARKBLUE)); + out << child << PxDebugBasis(PxVec3(scale, scale, scale)); +} + +void Cm::visualizeLinearLimit(PxRenderOutput& out, PxReal scale, const PxTransform& t0, const PxTransform& /*t1*/, PxReal value, bool active) +{ + if(scale==0.0f) + return; + + // debug circle is around z-axis, and we want it around x-axis + PxTransform r(t0.p+value*t0.q.getBasisVector0(), t0.q*PxQuat(PxPi/2,PxVec3(0,1.f,0))); + out << (active ? PxDebugColor::eARGB_RED : PxDebugColor::eARGB_GREY); + out << PxTransform(PxIdentity); + out << PxDebugArrow(t0.p,r.p-t0.p); + + out << r << PxDebugCircle(20, scale*0.3f); +} + +void Cm::visualizeAngularLimit(PxRenderOutput& out, PxReal scale, const PxTransform& t, PxReal lower, PxReal upper, bool active) +{ + if(scale==0.0f) + return; + + out << t << (active ? PxDebugColor::eARGB_RED : PxDebugColor::eARGB_GREY); + + out << PxRenderOutput::LINES + << PxVec3(0) << PxVec3(0, PxCos(lower), PxSin(lower)) * scale + << PxVec3(0) << PxVec3(0, PxCos(upper), PxSin(upper)) * scale; + + out << PxRenderOutput::LINESTRIP; + PxReal angle = lower, step = (upper-lower)/20; + + for(PxU32 i=0; i<=20; i++, angle += step) + out << PxVec3(0, PxCos(angle), PxSin(angle)) * scale; +} + +void Cm::visualizeLimitCone(PxRenderOutput& out, PxReal scale, const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ, bool active) +{ + if(scale==0.0f) + return; + + out << t << (active ? PxDebugColor::eARGB_RED : PxDebugColor::eARGB_GREY); + out << PxRenderOutput::LINES; + + PxVec3 prev(0,0,0); + + const PxU32 LINES = 32; + + for(PxU32 i=0;i<=LINES;i++) + { + PxReal angle = 2*PxPi/LINES*i; + PxReal c = PxCos(angle), s = PxSin(angle); + PxVec3 rv(0,-tanQSwingZ*s, tanQSwingY*c); + PxReal rv2 = rv.magnitudeSquared(); + PxQuat q = PxQuat(0,2*rv.y,2*rv.z,1-rv2) * (1/(1+rv2)); + PxVec3 a = q.rotate(PxVec3(1.0f,0,0)) * scale; + + out << prev << a << PxVec3(0) << a; + prev = a; + } +} + +void Cm::visualizeDoubleCone(PxRenderOutput& out, PxReal scale, const PxTransform& t, PxReal angle, bool active) +{ + if(scale==0.0f) + return; + + out << t << (active ? PxDebugColor::eARGB_RED : PxDebugColor::eARGB_GREY); + + const PxReal height = PxTan(angle); + + const PxU32 LINES = 32; + + out << PxRenderOutput::LINESTRIP; + + const PxReal step = PxPi*2/LINES; + + for(PxU32 i=0; i<=LINES; i++) + out << PxVec3(height, PxCos(step * i), PxSin(step * i)) * scale; + + angle = 0; + out << PxRenderOutput::LINESTRIP; + for(PxU32 i=0; i<=LINES; i++, angle += PxPi*2/LINES) + out << PxVec3(-height, PxCos(step * i), PxSin(step * i)) * scale; + + angle = 0; + out << PxRenderOutput::LINES; + for(PxU32 i=0;i + +using namespace physx; + +#pragma comment(lib, "delayimp") + +FARPROC WINAPI commonDelayHook(unsigned dliNotify, PDelayLoadInfo pdli) +{ + switch (dliNotify) { + case dliStartProcessing : + break; + + case dliNotePreLoadLibrary : + { + return Cm::physXCommonDliNotePreLoadLibrary(pdli->szDll,gCommonDelayLoadHook); + } + break; + + case dliNotePreGetProcAddress : + break; + + case dliFailLoadLib : + break; + + case dliFailGetProc : + break; + + case dliNoteEndProcessing : + break; + + default : + + return NULL; + } + + return NULL; +} + +PfnDliHook __pfnDliNotifyHook2 = commonDelayHook; + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/windows/CmWindowsModuleUpdateLoader.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/windows/CmWindowsModuleUpdateLoader.cpp new file mode 100644 index 0000000..c92aedf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/common/src/windows/CmWindowsModuleUpdateLoader.cpp @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifdef SUPPORT_UPDATE_LOADER_LOGGING +#if PX_X86 +#define NX_USE_SDK_DLLS +#include "PhysXUpdateLoader.h" +#endif +#endif /* SUPPORT_UPDATE_LOADER_LOGGING */ + +#include "windows/CmWindowsModuleUpdateLoader.h" +#include "windows/CmWindowsLoadLibrary.h" + +#include "stdio.h" + +namespace physx { namespace Cm { + +#if PX_VC +#pragma warning(disable: 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' +#endif + + +typedef HMODULE (*GetUpdatedModule_FUNC)(const char*, const char*); + +#ifdef SUPPORT_UPDATE_LOADER_LOGGING +#if PX_X86 +typedef void (*setLogging_FUNC)(PXUL_ErrorCode, pt2LogFunc); + +static void LogMessage(PXUL_ErrorCode messageType, char* message) +{ + switch(messageType) + { + case PXUL_ERROR_MESSAGES: + getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PhysX Update Loader Error: %s.", message); + break; + case PXUL_WARNING_MESSAGES: + getFoundation().error(PX_WARN, "PhysX Update Loader Warning: %s.", message); + break; + case PXUL_INFO_MESSAGES: + getFoundation().error(PX_INFO, "PhysX Update Loader Information: %s.", message); + break; + default: + getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "Unknown message type from update loader."); + break; + } +} +#endif +#endif /* SUPPORT_UPDATE_LOADER_LOGGING */ + +CmModuleUpdateLoader::CmModuleUpdateLoader(const char* updateLoaderDllName) + : mGetUpdatedModuleFunc(NULL) +{ + mUpdateLoaderDllHandle = loadLibrary(updateLoaderDllName); + + if (mUpdateLoaderDllHandle != NULL) + { + mGetUpdatedModuleFunc = GetProcAddress(mUpdateLoaderDllHandle, "GetUpdatedModule"); + +#ifdef SUPPORT_UPDATE_LOADER_LOGGING +#if PX_X86 + setLogging_FUNC setLoggingFunc; + setLoggingFunc = (setLogging_FUNC)GetProcAddress(mUpdateLoaderDllHandle, "setLoggingFunction"); + if(setLoggingFunc != NULL) + { + setLoggingFunc(PXUL_ERROR_MESSAGES, LogMessage); + } +#endif +#endif /* SUPPORT_UPDATE_LOADER_LOGGING */ + } +} + +CmModuleUpdateLoader::~CmModuleUpdateLoader() +{ + if (mUpdateLoaderDllHandle != NULL) + { + FreeLibrary(mUpdateLoaderDllHandle); + mUpdateLoaderDllHandle = NULL; + } +} + +HMODULE CmModuleUpdateLoader::LoadModule(const char* moduleName, const char* appGUID) +{ + HMODULE result = NULL; + + if (mGetUpdatedModuleFunc != NULL) + { + // Try to get the module through PhysXUpdateLoader + GetUpdatedModule_FUNC getUpdatedModuleFunc = (GetUpdatedModule_FUNC)mGetUpdatedModuleFunc; + result = getUpdatedModuleFunc(moduleName, appGUID); + } + else + { + // If no PhysXUpdateLoader, just load the DLL directly + result = loadLibrary(moduleName); + if (result == NULL) + { + const DWORD err = GetLastError(); + printf("%s:%i: loadLibrary error when loading %s: %lu\n", PX_FL, moduleName, err); + } + + } + + return result; +} + +}; // end of namespace +}; // end of namespace diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/include/PsFastXml.h b/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/include/PsFastXml.h new file mode 100644 index 0000000..ff77acd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/include/PsFastXml.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PSFASTXML_PSFASTXML_H +#define PSFASTXML_PSFASTXML_H + +#include "foundation/PxSimpleTypes.h" // defines basic data types; modify for your platform as needed. +#include "foundation/PxIO.h" +#include "foundation/PxAssert.h" +#include "foundation/PxAllocator.h" + +namespace physx +{ +namespace shdfnd +{ + +class FastXml +{ + PX_NOCOPY(FastXml) + + public: + class AttributePairs + { + int argc; + const char** argv; + + public: + AttributePairs() : argc(0), argv(NULL) + { + } + AttributePairs(int c, const char** v) : argc(c), argv(v) + { + } + + PX_INLINE int getNbAttr() const + { + return argc / 2; + } + + const char* getKey(uint32_t index) const + { + PX_ASSERT((index * 2) < uint32_t(argc)); + return argv[index * 2]; + } + + const char* getValue(uint32_t index) const + { + PX_ASSERT((index * 2 + 1) < uint32_t(argc)); + return argv[index * 2 + 1]; + } + + const char* get(const char* attr) const + { + int32_t count = argc / 2; + for(int32_t i = 0; i < count; ++i) + { + const char* key = argv[i * 2], *value = argv[i * 2 + 1]; + if(strcmp(key, attr) == 0) + return value; + } + + return NULL; + } + }; + + /*** + * Callbacks to the user with the contents of the XML file properly digested. + */ + class Callback + { + public: + virtual ~Callback() + { + } + virtual bool processComment(const char* comment) = 0; // encountered a comment in the XML + + // 'element' is the name of the element that is being closed. + // depth is the recursion depth of this element. + // Return true to continue processing the XML file. + // Return false to stop processing the XML file; leaves the read pointer of the stream right after this close + // tag. + // The bool 'isError' indicates whether processing was stopped due to an error, or intentionally canceled early. + virtual bool processClose(const char* element, uint32_t depth, bool& isError) = 0; // process the 'close' + // indicator for a previously + // encountered element + + // return true to continue processing the XML document, false to skip. + virtual bool processElement(const char* elementName, // name of the element + const char* elementData, // element data, null if none + const AttributePairs& attr, // attributes + int32_t lineno) = 0; // line number in the source XML file + + // process the XML declaration header + virtual bool processXmlDeclaration(const AttributePairs&, // attributes + const char* /*elementData*/, int32_t /*lineno*/) + { + return true; + } + + virtual bool processDoctype(const char* /*rootElement*/, // Root element tag + const char* /*type*/, // SYSTEM or PUBLIC + const char* /*fpi*/, // Formal Public Identifier + const char* /*uri*/) // Path to schema file + { + return true; + } + + virtual void* allocate(uint32_t size) + { + return PxGetBroadcastAllocator()->allocate(size, "FastXml", __FILE__, __LINE__); + } + + virtual void deallocate(void* ptr) + { + PxGetBroadcastAllocator()->deallocate(ptr); + } + }; + + virtual bool processXml(PxInputData& buff, bool streamFromMemory = false) = 0; + + virtual const char* getError(int32_t& lineno) = 0; // report the reason for a parsing error, and the line number + // where it occurred. + + FastXml() + { + } + + virtual void release(void) = 0; + + protected: + virtual ~FastXml() + { + } +}; + +FastXml* createFastXml(FastXml::Callback* iface); + +} // shdfnd +} // physx + +#endif // PSFASTXML_PSFASTXML_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp new file mode 100644 index 0000000..916659e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/fastxml/src/PsFastXml.cpp @@ -0,0 +1,833 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "foundation/PxFoundationConfig.h" +#include "foundation/PxAllocator.h" +#include "PsFastXml.h" +#include +#include +#include +#include + +using namespace physx; + +namespace +{ +#define MIN_CLOSE_COUNT 2 +#define DEFAULT_READ_BUFFER_SIZE (16 * 1024) +#define NUM_ENTITY 5 + +struct Entity +{ + const char* str; + unsigned int strLength; + char chr; +}; + +static const Entity entity[NUM_ENTITY] = { + { "<", 4, '<' }, { "&", 5, '&' }, { ">", 4, '>' }, { """, 6, '\"' }, { "'", 6, '\'' } +}; + +class MyFastXml : public physx::shdfnd::FastXml +{ + public: + enum CharType + { + CT_DATA, + CT_EOF, + CT_SOFT, + CT_END_OF_ELEMENT, // either a forward slash or a greater than symbol + CT_END_OF_LINE + }; + + MyFastXml(Callback* c) + { + mStreamFromMemory = true; + mCallback = c; + memset(mTypes, CT_DATA, sizeof(mTypes)); + mTypes[0] = CT_EOF; + mTypes[uint8_t(' ')] = mTypes[uint8_t('\t')] = CT_SOFT; + mTypes[uint8_t('/')] = mTypes[uint8_t('>')] = mTypes[uint8_t('?')] = CT_END_OF_ELEMENT; + mTypes[uint8_t('\n')] = mTypes[uint8_t('\r')] = CT_END_OF_LINE; + mError = 0; + mStackIndex = 0; + mFileBuf = NULL; + mReadBufferEnd = NULL; + mReadBuffer = NULL; + mReadBufferSize = DEFAULT_READ_BUFFER_SIZE; + mOpenCount = 0; + mLastReadLoc = 0; + for(uint32_t i = 0; i < (MAX_STACK + 1); i++) + { + mStack[i] = NULL; + mStackAllocated[i] = false; + } + } + + char* processClose(char c, const char* element, char* scan, int32_t argc, const char** argv, + FastXml::Callback* iface, bool& isError) + { + AttributePairs attr(argc, argv); + isError = true; // by default, if we return null it's due to an error. + if(c == '/' || c == '?') + { + char* slash = const_cast(static_cast(strchr(element, c))); + if(slash) + *slash = 0; + + if(c == '?' && strcmp(element, "xml") == 0) + { + if(!iface->processXmlDeclaration(attr, 0, mLineNo)) + return NULL; + } + else + { + if(!iface->processElement(element, 0, attr, mLineNo)) + { + mError = "User aborted the parsing process"; + return NULL; + } + + pushElement(element); + + const char* close = popElement(); + + if(!iface->processClose(close, mStackIndex, isError)) + { + return NULL; + } + } + + if(!slash) + ++scan; + } + else + { + scan = skipNextData(scan); + char* data = scan; // this is the data portion of the element, only copies memory if we encounter line feeds + char* dest_data = 0; + while(*scan && *scan != '<') + { + if(getCharType(scan) == CT_END_OF_LINE) + { + if(*scan == '\r') + mLineNo++; + dest_data = scan; + *dest_data++ = ' '; // replace the linefeed with a space... + scan = skipNextData(scan); + while(*scan && *scan != '<') + { + if(getCharType(scan) == CT_END_OF_LINE) + { + if(*scan == '\r') + mLineNo++; + *dest_data++ = ' '; // replace the linefeed with a space... + scan = skipNextData(scan); + } + else + { + *dest_data++ = *scan++; + } + } + break; + } + else if('&' == *scan) + { + dest_data = scan; + while(*scan && *scan != '<') + { + if('&' == *scan) + { + if(*(scan + 1) && *(scan + 1) == '#' && *(scan + 2)) + { + if(*(scan + 2) == 'x') + { + // Hexadecimal. + if(!*(scan + 3)) + break; + + char* q = scan + 3; + q = strchr(q, ';'); + + if(!q || !*q) + PX_ASSERT(0); + + --q; + char ch = char(*q > '9' ? (tolower(*q) - 'a' + 10) : *q - '0'); + if(*(--q) != tolower('x')) + ch |= char(*q > '9' ? (tolower(*q) - 'a' + 10) : *q - '0') << 4; + + *dest_data++ = ch; + } + else + { + // Decimal. + if(!*(scan + 2)) + break; + + const char* q = scan + 2; + q = strchr(q, ';'); + + if(!q || !*q) + PX_ASSERT(0); + + --q; + char ch = *q - '0'; + if(*(--q) != '#') + ch |= (*q - '0') * 10; + + *dest_data++ = ch; + } + + char* start = scan; + char* end = strchr(start, ';'); + if(end) + { + *end = 0; + scan = end + 1; + } + + continue; + } + + for(int i = 0; i < NUM_ENTITY; ++i) + { + if(strncmp(entity[i].str, scan, entity[i].strLength) == 0) + { + *dest_data++ = entity[i].chr; + scan += entity[i].strLength; + break; + } + } + } + else + { + *dest_data++ = *scan++; + } + } + break; + } + else + ++scan; + } + + if(*scan == '<') + { + if(scan[1] != '/') + { + PX_ASSERT(mOpenCount > 0); + mOpenCount--; + } + if(dest_data) + { + *dest_data = 0; + } + else + { + *scan = 0; + } + + scan++; // skip it.. + + if(*data == 0) + data = 0; + + if(!iface->processElement(element, data, attr, mLineNo)) + { + mError = "User aborted the parsing process"; + return 0; + } + + pushElement(element); + + // check for the comment use case... + if(scan[0] == '!' && scan[1] == '-' && scan[2] == '-') + { + scan += 3; + while(*scan && *scan == ' ') + ++scan; + + char* comment = scan; + char* comment_end = strstr(scan, "-->"); + if(comment_end) + { + *comment_end = 0; + scan = comment_end + 3; + if(!iface->processComment(comment)) + { + mError = "User aborted the parsing process"; + return 0; + } + } + } + else if(*scan == '/') + { + scan = processClose(scan, iface, isError); + if(scan == NULL) + { + return NULL; + } + } + } + else + { + mError = "Data portion of an element wasn't terminated properly"; + return NULL; + } + } + + if(mOpenCount < MIN_CLOSE_COUNT) + { + scan = readData(scan); + } + + return scan; + } + + char* processClose(char* scan, FastXml::Callback* iface, bool& isError) + { + const char* start = popElement(), *close = start; + if(scan[1] != '>') + { + scan++; + close = scan; + while(*scan && *scan != '>') + scan++; + *scan = 0; + } + + if(0 != strcmp(start, close)) + { + mError = "Open and closing tags do not match"; + return 0; + } + + if(!iface->processClose(close, mStackIndex, isError)) + { + // we need to set the read pointer! + uint32_t offset = uint32_t(mReadBufferEnd - scan) - 1; + uint32_t readLoc = mLastReadLoc - offset; + mFileBuf->seek(readLoc); + return NULL; + } + ++scan; + + return scan; + } + + virtual bool processXml(physx::PxInputData& fileBuf, bool streamFromMemory) + { + releaseMemory(); + mFileBuf = &fileBuf; + mStreamFromMemory = streamFromMemory; + return processXml(mCallback); + } + + // if we have finished processing the data we had pending.. + char* readData(char* scan) + { + for(uint32_t i = 0; i < (mStackIndex + 1); i++) + { + if(!mStackAllocated[i]) + { + const char* text = mStack[i]; + if(text) + { + uint32_t tlen = uint32_t(strlen(text)); + mStack[i] = static_cast(mCallback->allocate(tlen + 1)); + PxMemCopy(const_cast(static_cast(mStack[i])), text, tlen + 1); + mStackAllocated[i] = true; + } + } + } + + if(!mStreamFromMemory) + { + if(scan == NULL) + { + uint32_t seekLoc = mFileBuf->tell(); + mReadBufferSize = (mFileBuf->getLength() - seekLoc); + } + else + { + return scan; + } + } + + if(mReadBuffer == NULL) + { + mReadBuffer = static_cast(mCallback->allocate(mReadBufferSize + 1)); + } + uint32_t offset = 0; + uint32_t readLen = mReadBufferSize; + + if(scan) + { + offset = uint32_t(scan - mReadBuffer); + uint32_t copyLen = mReadBufferSize - offset; + if(copyLen) + { + PX_ASSERT(scan >= mReadBuffer); + memmove(mReadBuffer, scan, copyLen); + mReadBuffer[copyLen] = 0; + readLen = mReadBufferSize - copyLen; + } + offset = copyLen; + } + + uint32_t readCount = mFileBuf->read(&mReadBuffer[offset], readLen); + + while(readCount > 0) + { + + mReadBuffer[readCount + offset] = 0; // end of string terminator... + mReadBufferEnd = &mReadBuffer[readCount + offset]; + + const char* scan_ = &mReadBuffer[offset]; + while(*scan_) + { + if(*scan_ == '<' && scan_[1] != '/') + { + mOpenCount++; + } + scan_++; + } + + if(mOpenCount < MIN_CLOSE_COUNT) + { + uint32_t oldSize = uint32_t(mReadBufferEnd - mReadBuffer); + mReadBufferSize = mReadBufferSize * 2; + char* oldReadBuffer = mReadBuffer; + mReadBuffer = static_cast(mCallback->allocate(mReadBufferSize + 1)); + PxMemCopy(mReadBuffer, oldReadBuffer, oldSize); + mCallback->deallocate(oldReadBuffer); + offset = oldSize; + uint32_t readSize = mReadBufferSize - oldSize; + readCount = mFileBuf->read(&mReadBuffer[offset], readSize); + if(readCount == 0) + break; + } + else + { + break; + } + } + mLastReadLoc = mFileBuf->tell(); + + return mReadBuffer; + } + + bool processXml(FastXml::Callback* iface) + { + bool ret = true; + + const int MAX_ATTRIBUTE = 2048; // can't imagine having more than 2,048 attributes in a single element right? + + mLineNo = 1; + + char* element, *scan = readData(0); + + while(*scan) + { + + scan = skipNextData(scan); + + if(*scan == 0) + break; + + if(*scan == '<') + { + + if(scan[1] != '/') + { + PX_ASSERT(mOpenCount > 0); + mOpenCount--; + } + scan++; + + if(*scan == '?') // Allow xml declarations + { + scan++; + } + else if(scan[0] == '!' && scan[1] == '-' && scan[2] == '-') + { + scan += 3; + while(*scan && *scan == ' ') + scan++; + char* comment = scan, *comment_end = strstr(scan, "-->"); + if(comment_end) + { + *comment_end = 0; + scan = comment_end + 3; + if(!iface->processComment(comment)) + { + mError = "User aborted the parsing process"; + return false; + } + } + continue; + } + else if(scan[0] == '!') // Allow doctype + { + scan++; + + // DOCTYPE syntax differs from usual XML so we parse it here + + // Read DOCTYPE + const char* tag = "DOCTYPE"; + if(!strstr(scan, tag)) + { + mError = "Invalid DOCTYPE"; + return false; + } + + scan += strlen(tag); + + // Skip whites + while(CT_SOFT == getCharType(scan)) + ++scan; + + // Read rootElement + const char* rootElement = scan; + while(CT_DATA == getCharType(scan)) + ++scan; + + char* endRootElement = scan; + + // TODO: read remaining fields (fpi, uri, etc.) + while(CT_END_OF_ELEMENT != getCharType(scan++)) + ; + + *endRootElement = 0; + + if(!iface->processDoctype(rootElement, 0, 0, 0)) + { + mError = "User aborted the parsing process"; + return false; + } + + continue; // Restart loop + } + } + + if(*scan == '/') + { + bool isError; + scan = processClose(scan, iface, isError); + if(!scan) + { + if(isError) + { + mError = "User aborted the parsing process"; + } + return !isError; + } + } + else + { + if(*scan == '?') + scan++; + element = scan; + int32_t argc = 0; + const char* argv[MAX_ATTRIBUTE]; + bool close; + scan = nextSoftOrClose(scan, close); + if(close) + { + char c = *(scan - 1); + if(c != '?' && c != '/') + { + c = '>'; + } + *scan++ = 0; + bool isError; + scan = processClose(c, element, scan, argc, argv, iface, isError); + if(!scan) + { + if(isError) + { + mError = "User aborted the parsing process"; + } + return !isError; + } + } + else + { + if(*scan == 0) + { + return ret; + } + + *scan = 0; // place a zero byte to indicate the end of the element name... + scan++; + + while(*scan) + { + scan = skipNextData(scan); // advance past any soft seperators (tab or space) + + if(getCharType(scan) == CT_END_OF_ELEMENT) + { + char c = *scan++; + if('?' == c) + { + if('>' != *scan) //?> + { + PX_ASSERT(0); + return false; + } + + scan++; + } + bool isError; + scan = processClose(c, element, scan, argc, argv, iface, isError); + if(!scan) + { + if(isError) + { + mError = "User aborted the parsing process"; + } + return !isError; + } + break; + } + else + { + if(argc >= MAX_ATTRIBUTE) + { + mError = "encountered too many attributes"; + return false; + } + argv[argc] = scan; + scan = nextSep(scan); // scan up to a space, or an equal + if(*scan) + { + if(*scan != '=') + { + *scan = 0; + scan++; + while(*scan && *scan != '=') + scan++; + if(*scan == '=') + scan++; + } + else + { + *scan = 0; + scan++; + } + + if(*scan) // if not eof... + { + scan = skipNextData(scan); + if(*scan == '"') + { + scan++; + argc++; + argv[argc] = scan; + argc++; + while(*scan && *scan != 34) + scan++; + if(*scan == '"') + { + *scan = 0; + scan++; + } + else + { + mError = "Failed to find closing quote for attribute"; + return false; + } + } + else + { + // mError = "Expected quote to begin attribute"; + // return false; + // PH: let's try to have a more graceful fallback + argc--; + while(*scan != '/' && *scan != '>' && *scan != 0) + scan++; + } + } + } // if( *scan ) + } // if ( mTypes[*scan] + } // if( close ) + } // if( *scan == '/' + } // while( *scan ) + } + + if(mStackIndex) + { + mError = "Invalid file format"; + return false; + } + + return ret; + } + + const char* getError(int32_t& lineno) + { + const char* ret = mError; + lineno = mLineNo; + mError = 0; + return ret; + } + + virtual void release(void) + { + Callback* c = mCallback; // get the user allocator interface + MyFastXml* f = this; // cast the this pointer + f->~MyFastXml(); // explicitely invoke the destructor for this class + c->deallocate(f); // now free up the memory associated with it. + } + + private: + virtual ~MyFastXml(void) + { + releaseMemory(); + } + + PX_INLINE void releaseMemory(void) + { + mFileBuf = NULL; + mCallback->deallocate(mReadBuffer); + mReadBuffer = NULL; + mStackIndex = 0; + mReadBufferEnd = NULL; + mOpenCount = 0; + mLastReadLoc = 0; + mError = NULL; + for(uint32_t i = 0; i < (mStackIndex + 1); i++) + { + if(mStackAllocated[i]) + { + mCallback->deallocate(const_cast(static_cast(mStack[i]))); + mStackAllocated[i] = false; + } + mStack[i] = NULL; + } + } + + PX_INLINE CharType getCharType(char* scan) const + { + return mTypes[uint8_t(*scan)]; + } + + PX_INLINE char* nextSoftOrClose(char* scan, bool& close) + { + while(*scan && getCharType(scan) != CT_SOFT && *scan != '>') + scan++; + close = *scan == '>'; + return scan; + } + + PX_INLINE char* nextSep(char* scan) + { + while(*scan && getCharType(scan) != CT_SOFT && *scan != '=') + scan++; + return scan; + } + + PX_INLINE char* skipNextData(char* scan) + { + // while we have data, and we encounter soft seperators or line feeds... + while(*scan && (getCharType(scan) == CT_SOFT || getCharType(scan) == CT_END_OF_LINE)) + { + if(*scan == '\n') + mLineNo++; + scan++; + } + return scan; + } + + void pushElement(const char* element) + { + PX_ASSERT(mStackIndex < uint32_t(MAX_STACK)); + if(mStackIndex < uint32_t(MAX_STACK)) + { + if(mStackAllocated[mStackIndex]) + { + mCallback->deallocate(const_cast(static_cast(mStack[mStackIndex]))); + mStackAllocated[mStackIndex] = false; + } + mStack[mStackIndex++] = element; + } + } + + const char* popElement(void) + { + PX_ASSERT(mStackIndex > 0); + if(mStackAllocated[mStackIndex]) + { + mCallback->deallocate(const_cast(static_cast(mStack[mStackIndex]))); + mStackAllocated[mStackIndex] = false; + } + mStack[mStackIndex] = NULL; + return mStackIndex ? mStack[--mStackIndex] : NULL; + } + + static const int MAX_STACK = 2048; + + CharType mTypes[256]; + + physx::PxInputData* mFileBuf; + + char* mReadBuffer; + char* mReadBufferEnd; + + uint32_t mOpenCount; + uint32_t mReadBufferSize; + uint32_t mLastReadLoc; + + int32_t mLineNo; + const char* mError; + uint32_t mStackIndex; + const char* mStack[MAX_STACK + 1]; + bool mStreamFromMemory; + bool mStackAllocated[MAX_STACK + 1]; + Callback* mCallback; +}; +} + +namespace physx +{ +namespace shdfnd +{ + +FastXml* createFastXml(FastXml::Callback* iface) +{ + MyFastXml* m = static_cast(iface->allocate(sizeof(MyFastXml))); + if(m) + { + PX_PLACEMENT_NEW(m, MyFastXml(iface)); + } + return static_cast(m); +} +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/filebuf/include/PsFileBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/filebuf/include/PsFileBuffer.h new file mode 100644 index 0000000..9ba56d7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/filebuf/include/PsFileBuffer.h @@ -0,0 +1,247 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PSFILEBUFFER_PSFILEBUFFER_H +#define PSFILEBUFFER_PSFILEBUFFER_H + +#include "filebuf/PxFileBuf.h" + +#include "foundation/PxUserAllocated.h" +#include + +namespace physx +{ +namespace general_PxIOStream2 +{ + +//Use this class if you want to use your own allocator +class PxFileBufferBase : public PxFileBuf +{ +public: + PxFileBufferBase(const char *fileName,OpenMode mode) + { + mOpenMode = mode; + mFph = NULL; + mFileLength = 0; + mSeekRead = 0; + mSeekWrite = 0; + mSeekCurrent = 0; + switch ( mode ) + { + case OPEN_READ_ONLY: + mFph = fopen(fileName,"rb"); + break; + case OPEN_WRITE_ONLY: + mFph = fopen(fileName,"wb"); + break; + case OPEN_READ_WRITE_NEW: + mFph = fopen(fileName,"wb+"); + break; + case OPEN_READ_WRITE_EXISTING: + mFph = fopen(fileName,"rb+"); + break; + case OPEN_FILE_NOT_FOUND: + break; + } + if ( mFph ) + { + fseek(mFph,0L,SEEK_END); + mFileLength = static_cast(ftell(mFph)); + fseek(mFph,0L,SEEK_SET); + } + else + { + mOpenMode = OPEN_FILE_NOT_FOUND; + } + } + + virtual ~PxFileBufferBase() + { + close(); + } + + virtual void close() + { + if( mFph ) + { + fclose(mFph); + mFph = 0; + } + } + + virtual SeekType isSeekable(void) const + { + return mSeekType; + } + + virtual uint32_t read(void* buffer, uint32_t size) + { + uint32_t ret = 0; + if ( mFph ) + { + setSeekRead(); + ret = static_cast(::fread(buffer,1,size,mFph)); + mSeekRead+=ret; + mSeekCurrent+=ret; + } + return ret; + } + + virtual uint32_t peek(void* buffer, uint32_t size) + { + uint32_t ret = 0; + if ( mFph ) + { + uint32_t loc = tellRead(); + setSeekRead(); + ret = static_cast(::fread(buffer,1,size,mFph)); + mSeekCurrent+=ret; + seekRead(loc); + } + return ret; + } + + virtual uint32_t write(const void* buffer, uint32_t size) + { + uint32_t ret = 0; + if ( mFph ) + { + setSeekWrite(); + ret = static_cast(::fwrite(buffer,1,size,mFph)); + mSeekWrite+=ret; + mSeekCurrent+=ret; + if ( mSeekWrite > mFileLength ) + { + mFileLength = mSeekWrite; + } + } + return ret; + } + + virtual uint32_t tellRead(void) const + { + return mSeekRead; + } + + virtual uint32_t tellWrite(void) const + { + return mSeekWrite; + } + + virtual uint32_t seekRead(uint32_t loc) + { + mSeekRead = loc; + if ( mSeekRead > mFileLength ) + { + mSeekRead = mFileLength; + } + return mSeekRead; + } + + virtual uint32_t seekWrite(uint32_t loc) + { + mSeekWrite = loc; + if ( mSeekWrite > mFileLength ) + { + mSeekWrite = mFileLength; + } + return mSeekWrite; + } + + virtual void flush(void) + { + if ( mFph ) + { + ::fflush(mFph); + } + } + + virtual OpenMode getOpenMode(void) const + { + return mOpenMode; + } + + virtual uint32_t getFileLength(void) const + { + return mFileLength; + } + +private: + // Moves the actual file pointer to the current read location + void setSeekRead(void) + { + if ( mSeekRead != mSeekCurrent && mFph ) + { + if ( mSeekRead >= mFileLength ) + { + fseek(mFph,0L,SEEK_END); + } + else + { + fseek(mFph,static_cast(mSeekRead),SEEK_SET); + } + mSeekCurrent = mSeekRead = static_cast(ftell(mFph)); + } + } + // Moves the actual file pointer to the current write location + void setSeekWrite(void) + { + if ( mSeekWrite != mSeekCurrent && mFph ) + { + if ( mSeekWrite >= mFileLength ) + { + fseek(mFph,0L,SEEK_END); + } + else + { + fseek(mFph,static_cast(mSeekWrite),SEEK_SET); + } + mSeekCurrent = mSeekWrite = static_cast(ftell(mFph)); + } + } + + + FILE *mFph; + uint32_t mSeekRead; + uint32_t mSeekWrite; + uint32_t mSeekCurrent; + uint32_t mFileLength; + SeekType mSeekType; + OpenMode mOpenMode; +}; + +//Use this class if you want to use PhysX memory allocator +class PsFileBuffer: public PxFileBufferBase, public PxUserAllocated +{ +public: + PsFileBuffer(const char *fileName,OpenMode mode): PxFileBufferBase(fileName, mode) {} +}; + +} +using namespace general_PxIOStream2; +} + +#endif // PSFILEBUFFER_PSFILEBUFFER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp new file mode 100644 index 0000000..8fef160 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAllocator.cpp @@ -0,0 +1,28 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp new file mode 100644 index 0000000..590ca0c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdAssert.cpp @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxString.h" +#include + +#if PX_WINDOWS_FAMILY +#include +#elif PX_SWITCH +#include "foundation/switch/PxSwitchAbort.h" +#endif + +namespace +{ +class DefaultAssertHandler : public physx::PxAssertHandler +{ + virtual void operator()(const char* expr, const char* file, int line, bool& ignore) + { + PX_UNUSED(ignore); // is used only in debug windows config + char buffer[1024]; +#if PX_WINDOWS_FAMILY + sprintf_s(buffer, "%s(%d) : Assertion failed: %s\n", file, line, expr); +#else + sprintf(buffer, "%s(%d) : Assertion failed: %s\n", file, line, expr); +#endif + physx::PxPrintString(buffer); +#if PX_WINDOWS_FAMILY&& PX_DEBUG && PX_DEBUG_CRT + // _CrtDbgReport returns -1 on error, 1 on 'retry', 0 otherwise including 'ignore'. + // Hitting 'abort' will terminate the process immediately. + int result = _CrtDbgReport(_CRT_ASSERT, file, line, NULL, "%s", buffer); + int mode = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_REPORT_MODE); + ignore = _CRTDBG_MODE_WNDW == mode && result == 0; + if(ignore) + return; + __debugbreak(); +#elif PX_WINDOWS_FAMILY&& PX_CHECKED + __debugbreak(); +#elif PX_SWITCH + abort(buffer); +#else + abort(); +#endif + } +}; + +DefaultAssertHandler sAssertHandler; +physx::PxAssertHandler* sAssertHandlerPtr = &sAssertHandler; +} + +namespace physx +{ + +PxAssertHandler& PxGetAssertHandler() +{ + return *sAssertHandlerPtr; +} + +void PxSetAssertHandler(PxAssertHandler& handler) +{ + sAssertHandlerPtr = &handler; +} +} // end of physx namespace diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp new file mode 100644 index 0000000..28086b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.cpp @@ -0,0 +1,308 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxProfiler.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxString.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxPhysicsVersion.h" +#include "FdFoundation.h" + +namespace physx +{ + +Foundation::Foundation(PxErrorCallback& errc, PxAllocatorCallback& alloc) +: mAllocatorCallback(alloc) +, mErrorCallback(errc) +, mBroadcastingAllocator(alloc, errc) +, mBroadcastingError(errc) +, +#if PX_CHECKED + mReportAllocationNames(true), +#else + mReportAllocationNames(false), +#endif + mErrorMask(~0) +, mErrorMutex("Foundation::mErrorMutex") +, mTempAllocMutex("Foundation::mTempAllocMutex") +, mRefCount(0) +{ +} + +Foundation::~Foundation() +{ + // deallocate temp buffer allocations + PxAllocator alloc; + for(PxU32 i = 0; i < mTempAllocFreeTable.size(); ++i) + { + for(PxTempAllocatorChunk* ptr = mTempAllocFreeTable[i]; ptr;) + { + PxTempAllocatorChunk* next = ptr->mNext; + alloc.deallocate(ptr); + ptr = next; + } + } + mTempAllocFreeTable.reset(); +} + +Foundation& Foundation::getInstance() +{ + PX_ASSERT(mInstance); + return *mInstance; +} + +void Foundation::setInstance(Foundation& foundation) +{ + mInstance = &foundation; +} + +PxU32 Foundation::getWarnOnceTimestamp() +{ + PX_ASSERT(mInstance != NULL); + return mWarnOnceTimestap; +} + +bool Foundation::error(PxErrorCode::Enum c, const char* file, int line, const char* messageFmt, ...) +{ + va_list va; + va_start(va, messageFmt); + error(c, file, line, messageFmt, va); + va_end(va); + return false; +} + +bool Foundation::error(PxErrorCode::Enum e, const char* file, int line, const char* messageFmt, va_list va) +{ + PX_ASSERT(messageFmt); + if(e & mErrorMask) + { + // this function is reentrant but user's error callback may not be, so... + Mutex::ScopedLock lock(mErrorMutex); + + // using a static fixed size buffer here because: + // 1. vsnprintf return values differ between platforms + // 2. va_start is only usable in functions with ellipses + // 3. ellipses (...) cannot be passed to called function + // which would be necessary to dynamically grow the buffer here + + static const size_t bufSize = 1024; + char stringBuffer[bufSize]; + Pxvsnprintf(stringBuffer, bufSize, messageFmt, va); + + mBroadcastingError.reportError(e, stringBuffer, file, line); + } + return false; +} + +Foundation* Foundation::createInstance(PxU32 version, PxErrorCallback& errc, PxAllocatorCallback& alloc) +{ + if(version != PX_PHYSICS_VERSION) + { + char* buffer = new char[256]; + physx::Pxsnprintf(buffer, 256, "Wrong version: physics version is 0x%08x, tried to create 0x%08x", + PX_PHYSICS_VERSION, version); + errc.reportError(PxErrorCode::eINVALID_PARAMETER, buffer, __FILE__, __LINE__); + return 0; + } + + if(!mInstance) + { + // if we don't assign this here, the Foundation object can't create member + // subobjects which require the allocator + + mInstance = reinterpret_cast(alloc.allocate(sizeof(Foundation), "Foundation", __FILE__, __LINE__)); + + if(mInstance) + { + PX_PLACEMENT_NEW(mInstance, Foundation)(errc, alloc); + + PX_ASSERT(mInstance->mRefCount == 0); + mInstance->mRefCount = 1; + + // skip 0 which marks uninitialized timestaps in PX_WARN_ONCE + mWarnOnceTimestap = (mWarnOnceTimestap == PX_MAX_U32) ? 1 : mWarnOnceTimestap + 1; + + return mInstance; + } + else + { + errc.reportError(PxErrorCode::eINTERNAL_ERROR, "Memory allocation for foundation object failed.", __FILE__, + __LINE__); + } + } + else + { + errc.reportError(PxErrorCode::eINVALID_OPERATION, + "Foundation object exists already. Only one instance per process can be created.", __FILE__, + __LINE__); + } + + return 0; +} + +void Foundation::destroyInstance() +{ + PX_ASSERT(mInstance != NULL); + + if(mInstance->mRefCount == 1) + { + PxAllocatorCallback& alloc = mInstance->getAllocatorCallback(); + mInstance->~Foundation(); + alloc.deallocate(mInstance); + mInstance = 0; + } + else + { + mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Foundation destruction failed due to pending module references. Close/release all depending " + "modules first."); + } +} + +void Foundation::incRefCount() +{ + PX_ASSERT(mInstance != NULL); + + if(mInstance->mRefCount > 0) + mInstance->mRefCount++; + else + mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Foundation: Invalid registration detected."); +} + +void Foundation::decRefCount() +{ + PX_ASSERT(mInstance != NULL); + + if(mInstance->mRefCount > 0) + mInstance->mRefCount--; + else + mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Foundation: Invalid deregistration detected."); +} + +void Foundation::release() +{ + Foundation::destroyInstance(); +} + +PxU32 Foundation::getRefCount() +{ + return mInstance->mRefCount; +} + +Foundation* Foundation::mInstance = NULL; +PxU32 Foundation::mWarnOnceTimestap = 0; + +void Foundation::registerAllocationListener(physx::PxAllocationListener& listener) +{ + Mutex::ScopedLock lock(mListenerMutex); + mBroadcastingAllocator.registerListener(listener); +} + +void Foundation::deregisterAllocationListener(physx::PxAllocationListener& listener) +{ + Mutex::ScopedLock lock(mListenerMutex); + mBroadcastingAllocator.deregisterListener(listener); +} + +void Foundation::registerErrorCallback(PxErrorCallback& callback) +{ + Mutex::ScopedLock lock(mListenerMutex); + mBroadcastingError.registerListener(callback); +} + +void Foundation::deregisterErrorCallback(PxErrorCallback& callback) +{ + Mutex::ScopedLock lock(mListenerMutex); + mBroadcastingError.deregisterListener(callback); +} + +physx::PxProfilerCallback* gProfilerCallback = NULL; + +} // namespace physx + +physx::PxFoundation* PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, + physx::PxErrorCallback& errorCallback) +{ + return physx::Foundation::createInstance(version, errorCallback, allocator); +} + +void PxSetFoundationInstance(physx::PxFoundation& foundation) +{ + physx::Foundation::setInstance(static_cast(foundation)); +} + +physx::PxAllocatorCallback* PxGetAllocatorCallback() +{ + return &physx::Foundation::getInstance().getAllocatorCallback(); +} + +physx::PxAllocatorCallback* PxGetBroadcastAllocator() +{ + return &physx::Foundation::getInstance().getBroadcastAllocator(); +} + +physx::PxErrorCallback* PX_CALL_CONV PxGetErrorCallback() +{ + return &physx::Foundation::getInstance().getErrorCallback(); +} + +physx::PxErrorCallback* PX_CALL_CONV PxGetBroadcastError() +{ + return &physx::Foundation::getInstance().getInternalErrorCallback(); +} + +physx::PxFoundation& PxGetFoundation() +{ + return physx::Foundation::getInstance(); +} + +physx::PxProfilerCallback* PxGetProfilerCallback() +{ + return physx::gProfilerCallback; +} + +void PxSetProfilerCallback(physx::PxProfilerCallback* profiler) +{ + physx::gProfilerCallback = profiler; +} + +physx::PxU32 PxGetWarnOnceTimeStamp() +{ + return physx::Foundation::getWarnOnceTimestamp(); +} + +void PxDecFoundationRefCount() +{ + physx::Foundation::decRefCount(); +} + +void PxIncFoundationRefCount() +{ + physx::Foundation::incRefCount(); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.h b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.h new file mode 100644 index 0000000..719c7df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdFoundation.h @@ -0,0 +1,172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_FOUNDATION_PSFOUNDATION_H +#define PX_FOUNDATION_PSFOUNDATION_H + +#include "foundation/PxErrors.h" +#include "foundation/PxProfiler.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBroadcast.h" +#include "foundation/PxTempAllocator.h" +#include "foundation/PxMutex.h" + +#include + +namespace physx +{ + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4251) // class needs to have dll-interface to be used by clients of class +#endif + +class PX_FOUNDATION_API Foundation : public PxFoundation, public PxUserAllocated +{ + PX_NOCOPY(Foundation) + + public: + typedef PxMutexT Mutex; + typedef PxArray AllocFreeTable; + + public: + // factory + // note, you MUST eventually call release if createInstance returned true! + static Foundation* createInstance(PxU32 version, PxErrorCallback& errc, PxAllocatorCallback& alloc); + static Foundation& getInstance(); + static void setInstance(Foundation& foundation); + void release(); + static void incRefCount(); // this call requires a foundation object to exist already + static void decRefCount(); // this call requires a foundation object to exist already + static PxU32 getRefCount(); + + // Begin Errors + virtual PxErrorCallback& getErrorCallback() + { + return mErrorCallback; + } // Return the user's error callback + PxErrorCallback& getInternalErrorCallback() + { + return mBroadcastingError; + } // Return the broadcasting error callback + + virtual void registerErrorCallback(PxErrorCallback& listener); + virtual void deregisterErrorCallback(PxErrorCallback& listener); + + virtual void setErrorLevel(uint32_t mask) + { + mErrorMask = mask; + } + virtual uint32_t getErrorLevel() const + { + return mErrorMask; + } + + virtual bool error(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, ...); // Report errors with the + // broadcasting + virtual bool error(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, va_list); // error callback + + static PxU32 getWarnOnceTimestamp(); + + // End errors + + // Begin Allocations + virtual PxAllocatorCallback& getAllocatorCallback() + { + return mAllocatorCallback; + } // Return the user's allocator callback + PxAllocatorCallback& getBroadcastAllocator() + { + return mBroadcastingAllocator; + } // Return the broadcasting allocator + + virtual void registerAllocationListener(physx::PxAllocationListener& listener); + virtual void deregisterAllocationListener(physx::PxAllocationListener& listener); + + virtual bool getReportAllocationNames() const + { + return mReportAllocationNames; + } + virtual void setReportAllocationNames(bool value) + { + mReportAllocationNames = value; + } + + PX_INLINE AllocFreeTable& getTempAllocFreeTable() + { + return mTempAllocFreeTable; + } + PX_INLINE Mutex& getTempAllocMutex() + { + return mTempAllocMutex; + } + // End allocations + + private: + static void destroyInstance(); + + Foundation(PxErrorCallback& errc, PxAllocatorCallback& alloc); + ~Foundation(); + + // init order is tricky here: the mutexes require the allocator, the allocator may require the error stream + PxAllocatorCallback& mAllocatorCallback; + PxErrorCallback& mErrorCallback; + + PxBroadcastingAllocator mBroadcastingAllocator; + PxBroadcastingErrorCallback mBroadcastingError; + + bool mReportAllocationNames; + + uint32_t mErrorMask; + Mutex mErrorMutex; + + AllocFreeTable mTempAllocFreeTable; + Mutex mTempAllocMutex; + + Mutex mListenerMutex; + + static Foundation* mInstance; + PxU32 mRefCount; + static PxU32 mWarnOnceTimestap; +}; +#if PX_VC +#pragma warning(pop) +#endif + +PX_INLINE Foundation& getFoundation() +{ + return Foundation::getInstance(); +} + +} // namespace physx + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp new file mode 100644 index 0000000..9a8f73c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdMathUtils.cpp @@ -0,0 +1,239 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxSIMDHelpers.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxVec4.h" +#include "foundation/PxAssert.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxTransform.h" + +using namespace physx; +using namespace physx::intrinsics; + +PX_FOUNDATION_API PxTransform physx::PxTransformFromPlaneEquation(const PxPlane& plane) +{ + PxPlane p = plane; + p.normalize(); + + // special case handling for axis aligned planes + const PxReal halfsqrt2 = 0.707106781f; + PxQuat q; + if(2 == (p.n.x == 0.0f) + (p.n.y == 0.0f) + (p.n.z == 0.0f)) // special handling for axis aligned planes + { + if(p.n.x > 0) q = PxQuat(PxIdentity); + else if(p.n.x < 0) q = PxQuat(0, 0, 1.0f, 0); + else q = PxQuat(0.0f, -p.n.z, p.n.y, 1.0f) * halfsqrt2; + } + else q = PxShortestRotation(PxVec3(1.f,0,0), p.n); + + return PxTransform(-p.n * p.d, q); +} + +PX_FOUNDATION_API PxTransform physx::PxTransformFromSegment(const PxVec3& p0, const PxVec3& p1, PxReal* halfHeight) +{ + const PxVec3 axis = p1-p0; + const PxReal height = axis.magnitude(); + if(halfHeight) + *halfHeight = height/2; + + return PxTransform((p1+p0) * 0.5f, + height<1e-6f ? PxQuat(PxIdentity) : PxShortestRotation(PxVec3(1.f,0,0), axis/height)); +} + +PX_FOUNDATION_API PxQuat physx::PxShortestRotation(const PxVec3& v0, const PxVec3& v1) +{ + const PxReal d = v0.dot(v1); + const PxVec3 cross = v0.cross(v1); + + const PxQuat q = d > -1 ? PxQuat(cross.x, cross.y, cross.z, 1 + d) : PxAbs(v0.x) < 0.1f ? PxQuat(0.0f, v0.z, -v0.y, 0.0f) + : PxQuat(v0.y, -v0.x, 0.0f, 0.0f); + + return q.getNormalized(); +} + +// indexed rotation around axis, with sine and cosine of half-angle +static PxQuat indexedRotation(PxU32 axis, PxReal s, PxReal c) +{ + PxReal v[3] = { 0, 0, 0 }; + v[axis] = s; + return PxQuat(v[0], v[1], v[2], c); +} + +PX_FOUNDATION_API PxVec3 physx::PxDiagonalize(const PxMat33& m, PxQuat& massFrame) +{ + // jacobi rotation using quaternions (from an idea of Stan Melax, with fix for precision issues) + + const PxU32 MAX_ITERS = 24; + + PxQuat q(PxIdentity); + + PxMat33 d; + for(PxU32 i = 0; i < MAX_ITERS; i++) + { + // PT: removed for now, it makes one UT fail because the error is slightly above the threshold + //const PxMat33Padded axes(q); + const PxMat33 axes(q); + d = axes.getTranspose() * m * axes; + + const PxReal d0 = PxAbs(d[1][2]), d1 = PxAbs(d[0][2]), d2 = PxAbs(d[0][1]); + const PxU32 a = PxU32(d0 > d1 && d0 > d2 ? 0 : d1 > d2 ? 1 : 2); // rotation axis index, from largest off-diagonal + // element + + const PxU32 a1 = PxGetNextIndex3(a), a2 = PxGetNextIndex3(a1); + if(d[a1][a2] == 0.0f || PxAbs(d[a1][a1] - d[a2][a2]) > 2e6f * PxAbs(2.0f * d[a1][a2])) + break; + + PxReal w = (d[a1][a1] - d[a2][a2]) / (2.0f * d[a1][a2]); // cot(2 * phi), where phi is the rotation angle + PxReal absw = PxAbs(w); + + PxQuat r; + if(absw > 1000) + r = indexedRotation(a, 1 / (4 * w), 1.f); // h will be very close to 1, so use small angle approx instead + else + { + const PxReal t = 1 / (absw + PxSqrt(w * w + 1)); // absolute value of tan phi + const PxReal h = 1 / PxSqrt(t * t + 1); // absolute value of cos phi + + PX_ASSERT(h != 1); // |w|<1000 guarantees this with typical IEEE754 machine eps (approx 6e-8) + r = indexedRotation(a, PxSqrt((1 - h) / 2) * PxSign(w), PxSqrt((1 + h) / 2)); + } + + q = (q * r).getNormalized(); + } + + massFrame = q; + return PxVec3(d.column0.x, d.column1.y, d.column2.z); +} + +/** +\brief computes a oriented bounding box around the scaled basis. +\param basis Input = skewed basis, Output = (normalized) orthogonal basis. +\return Bounding box extent. +*/ +PxVec3 physx::PxOptimizeBoundingBox(PxMat33& basis) +{ + PxVec3* PX_RESTRICT vec = &basis[0]; // PT: don't copy vectors if not needed... + + // PT: since we store the magnitudes to memory, we can avoid the FCMPs afterwards + PxVec3 magnitude(vec[0].magnitudeSquared(), vec[1].magnitudeSquared(), vec[2].magnitudeSquared()); + + // find indices sorted by magnitude + unsigned int i = magnitude[1] > magnitude[0] ? 1 : 0u; + unsigned int j = magnitude[2] > magnitude[1 - i] ? 2 : 1 - i; + const unsigned int k = 3 - i - j; + + if(magnitude[i] < magnitude[j]) + PxSwap(i, j); + + PX_ASSERT(magnitude[i] >= magnitude[j] && magnitude[i] >= magnitude[k] && magnitude[j] >= magnitude[k]); + + // ortho-normalize basis + + PxReal invSqrt = PxRecipSqrt(magnitude[i]); + magnitude[i] *= invSqrt; + vec[i] *= invSqrt; // normalize the first axis + PxReal dotij = vec[i].dot(vec[j]); + PxReal dotik = vec[i].dot(vec[k]); + magnitude[i] += PxAbs(dotij) + PxAbs(dotik); // elongate the axis by projection of the other two + vec[j] -= vec[i] * dotij; // orthogonize the two remaining axii relative to vec[i] + vec[k] -= vec[i] * dotik; + + magnitude[j] = vec[j].normalize(); + PxReal dotjk = vec[j].dot(vec[k]); + magnitude[j] += PxAbs(dotjk); // elongate the axis by projection of the other one + vec[k] -= vec[j] * dotjk; // orthogonize vec[k] relative to vec[j] + + magnitude[k] = vec[k].normalize(); + + return magnitude; +} + +PxQuat physx::PxSlerp(const PxReal t, const PxQuat& left, const PxQuat& right) +{ + const PxReal quatEpsilon = (PxReal(1.0e-8f)); + + PxReal cosine = left.dot(right); + PxReal sign = PxReal(1); + if(cosine < 0) + { + cosine = -cosine; + sign = PxReal(-1); + } + + PxReal sine = PxReal(1) - cosine * cosine; + + if(sine >= quatEpsilon * quatEpsilon) + { + sine = PxSqrt(sine); + const PxReal angle = PxAtan2(sine, cosine); + const PxReal i_sin_angle = PxReal(1) / sine; + + const PxReal leftw = PxSin(angle * (PxReal(1) - t)) * i_sin_angle; + const PxReal rightw = PxSin(angle * t) * i_sin_angle * sign; + + return left * leftw + right * rightw; + } + + return left; +} + +void physx::PxIntegrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, + PxReal timeStep, PxTransform& result) +{ + result.p = curTrans.p + linvel * timeStep; + + // from void DynamicsContext::integrateAtomPose(PxsRigidBody* atom, Cm::BitMap &shapeChangedMap) const: + // Integrate the rotation using closed form quaternion integrator + PxReal w = angvel.magnitudeSquared(); + + if (w != 0.0f) + { + w = PxSqrt(w); + if (w != 0.0f) + { + const PxReal v = timeStep * w * 0.5f; + const PxReal q = PxCos(v); + const PxReal s = PxSin(v) / w; + + const PxVec3 pqr = angvel * s; + const PxQuat quatVel(pqr.x, pqr.y, pqr.z, 0); + PxQuat out; // need to have temporary, otherwise we may overwrite input if &curTrans == &result. + out = quatVel * curTrans.q; + out.x += curTrans.q.x * q; + out.y += curTrans.q.y * q; + out.z += curTrans.q.z * q; + out.w += curTrans.q.w * q; + result.q = out; + return; + } + } + // orientation stays the same - convert from quat to matrix: + result.q = curTrans.q; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp new file mode 100644 index 0000000..0c4bdd0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdString.cpp @@ -0,0 +1,170 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxString.h" +#include +#include +#include + +#if PX_WINDOWS_FAMILY +#pragma warning(push) +#pragma warning(disable : 4996) // unsafe string functions +#endif + +#if PX_APPLE_FAMILY +#pragma clang diagnostic push +// error : format string is not a string literal +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#endif + +namespace physx +{ +// cross-platform implementations + +int32_t Pxstrcmp(const char* str1, const char* str2) +{ + return ::strcmp(str1, str2); +} + +int32_t Pxstrncmp(const char* str1, const char* str2, size_t count) +{ + return ::strncmp(str1, str2, count); +} + +int32_t Pxsnprintf(char* dst, size_t dstSize, const char* format, ...) +{ + va_list arg; + va_start(arg, format); + int32_t r = Pxvsnprintf(dst, dstSize, format, arg); + va_end(arg); + return r; +} + +int32_t Pxsscanf(const char* buffer, const char* format, ...) +{ + va_list arg; + va_start(arg, format); +#if (PX_VC < 12) && !PX_LINUX + int32_t r = ::sscanf(buffer, format, arg); +#else + int32_t r = ::vsscanf(buffer, format, arg); +#endif + va_end(arg); + + return r; +} + +size_t Pxstrlcpy(char* dst, size_t dstSize, const char* src) +{ + size_t i = 0; + if(dst && dstSize) + { + for(; i + 1 < dstSize && src[i]; i++) // copy up to dstSize-1 bytes + dst[i] = src[i]; + dst[i] = 0; // always null-terminate + } + + while(src[i]) // read any remaining characters in the src string to get the length + i++; + + return i; +} + +size_t Pxstrlcat(char* dst, size_t dstSize, const char* src) +{ + size_t i = 0, s = 0; + if(dst && dstSize) + { + s = strlen(dst); + for(; i + s + 1 < dstSize && src[i]; i++) // copy until total is at most dstSize-1 + dst[i + s] = src[i]; + dst[i + s] = 0; // always null-terminate + } + + while(src[i]) // read any remaining characters in the src string to get the length + i++; + + return i + s; +} + +void Pxstrlwr(char* str) +{ + for(; *str; str++) + if(*str >= 'A' && *str <= 'Z') + *str += 32; +} + +void Pxstrupr(char* str) +{ + for(; *str; str++) + if(*str >= 'a' && *str <= 'z') + *str -= 32; +} + +int32_t Pxvsnprintf(char* dst, size_t dstSize, const char* src, va_list arg) +{ + +#if PX_VC // MSVC is not C99-compliant... + int32_t result = dst ? ::vsnprintf(dst, dstSize, src, arg) : -1; + if(dst && (result == int32_t(dstSize) || result < 0)) + dst[dstSize - 1] = 0; // string was truncated or there wasn't room for the NULL + if(result < 0) + result = _vscprintf(src, arg); // work out how long the answer would have been. +#else + int32_t result = ::vsnprintf(dst, dstSize, src, arg); +#endif + return result; +} + +int32_t Pxstricmp(const char* str, const char* str1) +{ +#if PX_VC + return (::_stricmp(str, str1)); +#else + return (::strcasecmp(str, str1)); +#endif +} + +int32_t Pxstrnicmp(const char* str, const char* str1, size_t n) +{ +#if PX_VC + return (::_strnicmp(str, str1, n)); +#else + return (::strncasecmp(str, str1, n)); +#endif +} + +}//namespace physx + +#if PX_APPLE_FAMILY +#pragma clang diagnostic pop +#endif + +#if PX_WINDOWS_FAMILY +#pragma warning(pop) +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp new file mode 100644 index 0000000..de3e9f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/FdTempAllocator.cpp @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMath.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxTempAllocator.h" +#include "FdFoundation.h" + +#if PX_VC +#pragma warning(disable : 4706) // assignment within conditional expression +#endif + +namespace physx +{ +namespace +{ +typedef PxTempAllocatorChunk Chunk; +typedef PxArray AllocFreeTable; + +PX_INLINE Foundation::AllocFreeTable& getFreeTable() +{ + return getFoundation().getTempAllocFreeTable(); +} +PX_INLINE Foundation::Mutex& getMutex() +{ + return getFoundation().getTempAllocMutex(); +} + +const PxU32 sMinIndex = 8; // 256B min +const PxU32 sMaxIndex = 17; // 128kB max +} + +void* PxTempAllocator::allocate(size_t size, const char* filename, PxI32 line) +{ + if(!size) + return 0; + + PxU32 index = PxMax(PxHighestSetBit(PxU32(size) + sizeof(Chunk) - 1), sMinIndex); + + Chunk* chunk = 0; + if(index < sMaxIndex) + { + Foundation::Mutex::ScopedLock lock(getMutex()); + + // find chunk up to 16x bigger than necessary + Chunk** it = getFreeTable().begin() + index - sMinIndex; + Chunk** end = PxMin(it + 3, getFreeTable().end()); + while(it < end && !(*it)) + ++it; + + if(it < end) + { + // pop top off freelist + chunk = *it; + *it = chunk->mNext; + index = PxU32(it - getFreeTable().begin() + sMinIndex); + } + else + // create new chunk + chunk = reinterpret_cast(PxAllocator().allocate(size_t(2 << index), filename, line)); + } + else + { + // too big for temp allocation, forward to base allocator + chunk = reinterpret_cast(PxAllocator().allocate(size + sizeof(Chunk), filename, line)); + } + + chunk->mIndex = index; + void* ret = chunk + 1; + PX_ASSERT((size_t(ret) & 0xf) == 0); // SDK types require at minimum 16 byte allignment. + return ret; +} + +void PxTempAllocator::deallocate(void* ptr) +{ + if(!ptr) + return; + + Chunk* chunk = reinterpret_cast(ptr) - 1; + PxU32 index = chunk->mIndex; + + if(index >= sMaxIndex) + return PxAllocator().deallocate(chunk); + + Foundation::Mutex::ScopedLock lock(getMutex()); + + index -= sMinIndex; + if(getFreeTable().size() <= index) + getFreeTable().resize(index + 1); + + chunk->mNext = getFreeTable()[index]; + getFreeTable()[index] = chunk; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp new file mode 100644 index 0000000..76d0739 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixAtomic.cpp @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAtomic.h" + +#if ! PX_EMSCRIPTEN +#define PAUSE() asm("nop") +#else +#define PAUSE() +#endif + +namespace physx +{ + +void* PxAtomicCompareExchangePointer(volatile void** dest, void* exch, void* comp) +{ + return __sync_val_compare_and_swap(const_cast(dest), comp, exch); +} + +PxI32 PxAtomicCompareExchange(volatile PxI32* dest, PxI32 exch, PxI32 comp) +{ + return __sync_val_compare_and_swap(dest, comp, exch); +} + +PxI32 PxAtomicIncrement(volatile PxI32* val) +{ + return __sync_add_and_fetch(val, 1); +} + +PxI32 PxAtomicDecrement(volatile PxI32* val) +{ + return __sync_sub_and_fetch(val, 1); +} + +PxI32 PxAtomicAdd(volatile PxI32* val, PxI32 delta) +{ + return __sync_add_and_fetch(val, delta); +} + +PxI32 PxAtomicMax(volatile PxI32* val, PxI32 val2) +{ + PxI32 oldVal, newVal; + + do + { + PAUSE(); + oldVal = *val; + + if(val2 > oldVal) + newVal = val2; + else + newVal = oldVal; + + } while(PxAtomicCompareExchange(val, newVal, oldVal) != oldVal); + + return *val; +} + +PxI32 PxAtomicExchange(volatile PxI32* val, PxI32 val2) +{ + PxI32 newVal, oldVal; + + do + { + PAUSE(); + oldVal = *val; + newVal = val2; + } while(PxAtomicCompareExchange(val, newVal, oldVal) != oldVal); + + return oldVal; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp new file mode 100644 index 0000000..dc9d5cf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixFPU.cpp @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include "foundation/PxFPU.h" + +#if !defined(__CYGWIN__) +#include +PX_COMPILE_TIME_ASSERT(8 * sizeof(uint32_t) >= sizeof(fenv_t)); +#endif + +#if PX_OSX && PX_X64 +// osx defines SIMD as standard for floating point operations. +#include +#endif + +physx::PxFPUGuard::PxFPUGuard() +{ +#if defined(__CYGWIN__) +#pragma message "FPUGuard::FPUGuard() is not implemented" +#elif PX_OSX + #if PX_X64 + mControlWords[0] = _mm_getcsr(); + // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) + _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); + #else + // Not supported + #endif +#elif defined(__EMSCRIPTEN__) +// not supported +#else + PX_COMPILE_TIME_ASSERT(sizeof(fenv_t) <= sizeof(mControlWords)); + + fegetenv(reinterpret_cast(mControlWords)); + fesetenv(FE_DFL_ENV); + +#if PX_LINUX + // need to explicitly disable exceptions because fesetenv does not modify + // the sse control word on 32bit linux (64bit is fine, but do it here just be sure) + fedisableexcept(FE_ALL_EXCEPT); +#endif + +#endif +} + +physx::PxFPUGuard::~PxFPUGuard() +{ +#if defined(__CYGWIN__) +#pragma message "PxFPUGuard::~PxFPUGuard() is not implemented" +#elif PX_OSX + #if PX_X64 + // restore control word and clear exception flags + // (setting exception state flags cause exceptions on the first following fp operation) + _mm_setcsr(mControlWords[0] & ~_MM_EXCEPT_MASK); + #else + // not supported + #endif +#elif defined(__EMSCRIPTEN__) +// not supported +#else + fesetenv(reinterpret_cast(mControlWords)); +#endif +} + +PX_FOUNDATION_API void physx::PxEnableFPExceptions() +{ +#if PX_LINUX && !defined(__EMSCRIPTEN__) + feclearexcept(FE_ALL_EXCEPT); + feenableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW); +#elif PX_OSX && PX_X64 + // clear any pending exceptions + // (setting exception state flags cause exceptions on the first following fp operation) + uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK; + + // enable all fp exceptions except inexact and underflow (common, benign) + // note: denorm has to be disabled as well because underflow can create denorms + _mm_setcsr((control & ~_MM_MASK_MASK) | _MM_MASK_INEXACT | _MM_MASK_UNDERFLOW | _MM_MASK_DENORM); +#endif +} + +PX_FOUNDATION_API void physx::PxDisableFPExceptions() +{ +#if PX_LINUX && !defined(__EMSCRIPTEN__) + fedisableexcept(FE_ALL_EXCEPT); +#elif PX_OSX && PX_X64 + // clear any pending exceptions + // (setting exception state flags cause exceptions on the first following fp operation) + uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK; + _mm_setcsr(control | _MM_MASK_MASK); +#endif +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp new file mode 100644 index 0000000..605460f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixMutex.cpp @@ -0,0 +1,199 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxMutex.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxThread.h" + +#include + +namespace physx +{ + +#if PX_LINUX && !defined(__ANDROID__) + +#include + +static int gMutexProtocol = PTHREAD_PRIO_INHERIT; + +PX_FORCE_INLINE bool isLegalProtocol(const int mutexProtocol) +{ + return + ( + (PTHREAD_PRIO_NONE == mutexProtocol) || + (PTHREAD_PRIO_INHERIT == mutexProtocol) || + ((PTHREAD_PRIO_PROTECT == mutexProtocol) && ((sched_getscheduler(0) == SCHED_FIFO) || (sched_getscheduler(0) == SCHED_RR))) + ); +} + +bool PxSetMutexProtocol(const int mutexProtocol) +{ + if(isLegalProtocol(mutexProtocol)) + { + gMutexProtocol = mutexProtocol; + return true; + } + return false; +} + +int PxGetMutexProtocol() +{ + return gMutexProtocol; +} + +#endif //PX_LINUX + + +namespace +{ +struct MutexUnixImpl +{ + pthread_mutex_t lock; + PxThread::Id owner; +}; + +MutexUnixImpl* getMutex(PxMutexImpl* impl) +{ + return reinterpret_cast(impl); +} +} + +PxMutexImpl::PxMutexImpl() +{ + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); +#if PX_LINUX && !defined(__ANDROID__) + pthread_mutexattr_setprotocol(&attr, gMutexProtocol); + pthread_mutexattr_setprioceiling(&attr, 0); +#endif + pthread_mutex_init(&getMutex(this)->lock, &attr); + pthread_mutexattr_destroy(&attr); +} + +PxMutexImpl::~PxMutexImpl() +{ + pthread_mutex_destroy(&getMutex(this)->lock); +} + +void PxMutexImpl::lock() +{ + int err = pthread_mutex_lock(&getMutex(this)->lock); + PX_ASSERT(!err); + PX_UNUSED(err); + +#if PX_DEBUG + getMutex(this)->owner = PxThread::getId(); +#endif +} + +bool PxMutexImpl::trylock() +{ + bool success = !pthread_mutex_trylock(&getMutex(this)->lock); +#if PX_DEBUG + if(success) + getMutex(this)->owner = PxThread::getId(); +#endif + return success; +} + +void PxMutexImpl::unlock() +{ +#if PX_DEBUG + if(getMutex(this)->owner != PxThread::getId()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Mutex must be unlocked only by thread that has already acquired lock"); + return; + } +#endif + + int err = pthread_mutex_unlock(&getMutex(this)->lock); + PX_ASSERT(!err); + PX_UNUSED(err); +} + +uint32_t PxMutexImpl::getSize() +{ + return sizeof(MutexUnixImpl); +} + +class ReadWriteLockImpl +{ + public: + PxMutex mutex; + volatile int readerCounter; +}; + +PxReadWriteLock::PxReadWriteLock() +{ + mImpl = reinterpret_cast(PX_ALLOC(sizeof(ReadWriteLockImpl), "ReadWriteLockImpl")); + PX_PLACEMENT_NEW(mImpl, ReadWriteLockImpl); + + mImpl->readerCounter = 0; +} + +PxReadWriteLock::~PxReadWriteLock() +{ + mImpl->~ReadWriteLockImpl(); + PX_FREE(mImpl); +} + +void PxReadWriteLock::lockReader(bool takeLock) +{ + if(takeLock) + mImpl->mutex.lock(); + + PxAtomicIncrement(&mImpl->readerCounter); + + if(takeLock) + mImpl->mutex.unlock(); +} + +void PxReadWriteLock::lockWriter() +{ + mImpl->mutex.lock(); + + // spin lock until no readers + while(mImpl->readerCounter); +} + +void PxReadWriteLock::unlockReader() +{ + PxAtomicDecrement(&mImpl->readerCounter); +} + +void PxReadWriteLock::unlockWriter() +{ + mImpl->mutex.unlock(); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp new file mode 100644 index 0000000..fb75dc9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixPrintString.cpp @@ -0,0 +1,40 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxString.h" +#include + +namespace physx +{ + +void PxPrintString(const char* str) +{ + puts(str); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp new file mode 100644 index 0000000..10c6393 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSList.cpp @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAllocator.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxSList.h" +#include "foundation/PxThread.h" +#include + +#if PX_EMSCRIPTEN +#define USE_MUTEX +#endif + +namespace physx +{ +namespace +{ +#if defined(USE_MUTEX) +class ScopedMutexLock +{ + pthread_mutex_t& mMutex; + + public: + PX_INLINE ScopedMutexLock(pthread_mutex_t& mutex) : mMutex(mutex) + { + pthread_mutex_lock(&mMutex); + } + + PX_INLINE ~ScopedMutexLock() + { + pthread_mutex_unlock(&mMutex); + } +}; + +typedef ScopedMutexLock ScopedLock; +#else +struct ScopedSpinLock +{ + PX_FORCE_INLINE ScopedSpinLock(volatile int32_t& lock) : mLock(lock) + { + while(__sync_lock_test_and_set(&mLock, 1)) + { + // spinning without atomics is usually + // causing less bus traffic. -> only one + // CPU is modifying the cache line. + while(lock) + PxSpinLockPause(); + } + } + + PX_FORCE_INLINE ~ScopedSpinLock() + { + __sync_lock_release(&mLock); + } + + private: + volatile int32_t& mLock; +}; + +typedef ScopedSpinLock ScopedLock; +#endif + +struct SListDetail +{ + PxSListEntry* head; +#if defined(USE_MUTEX) + pthread_mutex_t lock; +#else + volatile int32_t lock; +#endif +}; + +template +SListDetail* getDetail(T* impl) +{ + return reinterpret_cast(impl); +} +} + +PxSListImpl::PxSListImpl() +{ + getDetail(this)->head = NULL; + +#if defined(USE_MUTEX) + pthread_mutex_init(&getDetail(this)->lock, NULL); +#else + getDetail(this)->lock = 0; // 0 == unlocked +#endif +} + +PxSListImpl::~PxSListImpl() +{ +#if defined(USE_MUTEX) + pthread_mutex_destroy(&getDetail(this)->lock); +#endif +} + +void PxSListImpl::push(PxSListEntry* entry) +{ + ScopedLock lock(getDetail(this)->lock); + entry->mNext = getDetail(this)->head; + getDetail(this)->head = entry; +} + +PxSListEntry* PxSListImpl::pop() +{ + ScopedLock lock(getDetail(this)->lock); + PxSListEntry* result = getDetail(this)->head; + if(result != NULL) + getDetail(this)->head = result->mNext; + return result; +} + +PxSListEntry* PxSListImpl::flush() +{ + ScopedLock lock(getDetail(this)->lock); + PxSListEntry* result = getDetail(this)->head; + getDetail(this)->head = NULL; + return result; +} + +uint32_t PxSListImpl::getSize() +{ + return sizeof(SListDetail); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp new file mode 100644 index 0000000..fd8425e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSocket.cpp @@ -0,0 +1,479 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxSocket.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define INVALID_SOCKET -1 + +#ifndef SOMAXCONN +#define SOMAXCONN 5 +#endif + +namespace physx +{ + +const uint32_t PxSocket::DEFAULT_BUFFER_SIZE = 32768; + +class SocketImpl +{ + public: + SocketImpl(bool isBlocking); + virtual ~SocketImpl(); + + bool connect(const char* host, uint16_t port, uint32_t timeout); + bool listen(uint16_t port); + bool accept(bool block); + void disconnect(); + + void setBlocking(bool blocking); + + virtual uint32_t write(const uint8_t* data, uint32_t length); + virtual bool flush(); + uint32_t read(uint8_t* data, uint32_t length); + + PX_FORCE_INLINE bool isBlocking() const + { + return mIsBlocking; + } + PX_FORCE_INLINE bool isConnected() const + { + return mIsConnected; + } + PX_FORCE_INLINE const char* getHost() const + { + return mHost; + } + PX_FORCE_INLINE uint16_t getPort() const + { + return mPort; + } + + protected: + bool nonBlockingTimeout() const; + + int32_t mSocket; + int32_t mListenSocket; + const char* mHost; + uint16_t mPort; + bool mIsConnected; + bool mIsBlocking; + bool mListenMode; +}; + +void socketSetBlockingInternal(int32_t socket, bool blocking); + +SocketImpl::SocketImpl(bool isBlocking) +: mSocket(INVALID_SOCKET) +, mListenSocket(INVALID_SOCKET) +, mHost(NULL) +, mPort(0) +, mIsConnected(false) +, mIsBlocking(isBlocking) +, mListenMode(false) +{ +} + +SocketImpl::~SocketImpl() +{ +} + +bool SocketImpl::connect(const char* host, uint16_t port, uint32_t timeout) +{ + sockaddr_in socketAddress; + intrinsics::memSet(&socketAddress, 0, sizeof(sockaddr_in)); + socketAddress.sin_family = AF_INET; + socketAddress.sin_port = htons(port); + + // get host + hostent* hp = gethostbyname(host); + if(!hp) + { + in_addr a; + a.s_addr = inet_addr(host); + hp = gethostbyaddr(reinterpret_cast(&a), sizeof(in_addr), AF_INET); + if(!hp) + return false; + } + intrinsics::memCopy(&socketAddress.sin_addr, hp->h_addr_list[0], hp->h_length); + + // connect + mSocket = socket(AF_INET, SOCK_STREAM, 0); + if(mSocket == INVALID_SOCKET) + return false; + + socketSetBlockingInternal(mSocket, false); + + int connectRet = ::connect(mSocket, reinterpret_cast(&socketAddress), sizeof(socketAddress)); + if(connectRet < 0) + { + if(errno != EINPROGRESS) + { + disconnect(); + return false; + } + + // Setup poll function call to monitor the connect call. + // By querying for POLLOUT we're checking if the socket is + // ready for writing. + pollfd pfd; + pfd.fd = mSocket; + pfd.events = POLLOUT; + const int pollResult = ::poll(&pfd, 1, timeout /*milliseconds*/); + + const bool timeout = (pollResult == 0); + const bool error = (pollResult < 0); // an error inside poll happened. Can check error with `errno` variable. + if(timeout || error) + { + disconnect(); + return false; + } + else + { + PX_ASSERT(pollResult == 1); + + // check that event was precisely POLLOUT and not anything else (e.g., errors, hang-up) + bool test = (pfd.revents & POLLOUT) && !(pfd.revents & (~POLLOUT)); + if(!test) + { + disconnect(); + return false; + } + } + + // check if we are really connected, above code seems to return + // true if host is a unix machine even if the connection was + // not accepted. + char buffer; + if(recv(mSocket, &buffer, 0, 0) < 0) + { + if(errno != EWOULDBLOCK) + { + disconnect(); + return false; + } + } + } + + socketSetBlockingInternal(mSocket, mIsBlocking); + +#if PX_APPLE_FAMILY + int noSigPipe = 1; + setsockopt(mSocket, SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(int)); +#endif + + mIsConnected = true; + mPort = port; + mHost = host; + return true; +} + +bool SocketImpl::listen(uint16_t port) +{ + mListenSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if(mListenSocket == INVALID_SOCKET) + return false; + + // enable address reuse: "Address already in use" error message + int yes = 1; + if(setsockopt(mListenSocket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) + return false; + + mListenMode = true; + + sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = INADDR_ANY; + intrinsics::memSet(addr.sin_zero, '\0', sizeof addr.sin_zero); + + return bind(mListenSocket, reinterpret_cast(&addr), sizeof(addr)) != -1 && + ::listen(mListenSocket, SOMAXCONN) != -1; +} + +bool SocketImpl::accept(bool block) +{ + if(mIsConnected || !mListenMode) + return false; + + // set the listen socket to be non-blocking. + socketSetBlockingInternal(mListenSocket, block); + int32_t clientSocket = ::accept(mListenSocket, 0, 0); + if(clientSocket == INVALID_SOCKET) + return false; + + mSocket = clientSocket; + mIsConnected = true; + socketSetBlockingInternal(mSocket, mIsBlocking); // force the mode to whatever the user set + + return mIsConnected; +} + +void SocketImpl::disconnect() +{ + if(mListenSocket != INVALID_SOCKET) + { + close(mListenSocket); + mListenSocket = INVALID_SOCKET; + } + if(mSocket != INVALID_SOCKET) + { + if(mIsConnected) + { + socketSetBlockingInternal(mSocket, true); + shutdown(mSocket, SHUT_RDWR); + } + close(mSocket); + mSocket = INVALID_SOCKET; + } + mIsConnected = false; + mListenMode = false; + mPort = 0; + mHost = NULL; +} + +bool SocketImpl::nonBlockingTimeout() const +{ + return !mIsBlocking && errno == EWOULDBLOCK; +} + +void socketSetBlockingInternal(int32_t socket, bool blocking) +{ + int mode = fcntl(socket, F_GETFL, 0); + if(!blocking) + mode |= O_NONBLOCK; + else + mode &= ~O_NONBLOCK; + fcntl(socket, F_SETFL, mode); +} + +// should be cross-platform from here down + +void SocketImpl::setBlocking(bool blocking) +{ + if(blocking != mIsBlocking) + { + mIsBlocking = blocking; + if(isConnected()) + socketSetBlockingInternal(mSocket, blocking); + } +} + +bool SocketImpl::flush() +{ + return true; +} + +uint32_t SocketImpl::write(const uint8_t* data, uint32_t length) +{ + if(length == 0) + return 0; + + int sent = send(mSocket, reinterpret_cast(data), int32_t(length), 0); + + if(sent <= 0 && !nonBlockingTimeout()) + disconnect(); + + return uint32_t(sent > 0 ? sent : 0); +} + +uint32_t SocketImpl::read(uint8_t* data, uint32_t length) +{ + if(length == 0) + return 0; + + int32_t received = recv(mSocket, reinterpret_cast(data), int32_t(length), 0); + + if(received <= 0 && !nonBlockingTimeout()) + disconnect(); + + return uint32_t(received > 0 ? received : 0); +} + +class BufferedSocketImpl : public SocketImpl +{ + public: + BufferedSocketImpl(bool isBlocking) : SocketImpl(isBlocking), mBufferPos(0) + { + } + virtual ~BufferedSocketImpl() + { + } + bool flush(); + uint32_t write(const uint8_t* data, uint32_t length); + + private: + uint32_t mBufferPos; + uint8_t mBuffer[PxSocket::DEFAULT_BUFFER_SIZE]; +}; + +bool BufferedSocketImpl::flush() +{ + uint32_t totalBytesWritten = 0; + + while(totalBytesWritten < mBufferPos && mIsConnected) + totalBytesWritten += int32_t(SocketImpl::write(mBuffer + totalBytesWritten, mBufferPos - totalBytesWritten)); + + bool ret = (totalBytesWritten == mBufferPos); + mBufferPos = 0; + return ret; +} + +uint32_t BufferedSocketImpl::write(const uint8_t* data, uint32_t length) +{ + uint32_t bytesWritten = 0; + while(mBufferPos + length >= PxSocket::DEFAULT_BUFFER_SIZE) + { + uint32_t currentChunk = PxSocket::DEFAULT_BUFFER_SIZE - mBufferPos; + intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, currentChunk); + bytesWritten += uint32_t(currentChunk); // for the user, this is consumed even if we fail to shove it down a + // non-blocking socket + + uint32_t sent = SocketImpl::write(mBuffer, PxSocket::DEFAULT_BUFFER_SIZE); + mBufferPos = PxSocket::DEFAULT_BUFFER_SIZE - sent; + + if(sent < PxSocket::DEFAULT_BUFFER_SIZE) // non-blocking or error + { + if(sent) // we can reasonably hope this is rare + intrinsics::memMove(mBuffer, mBuffer + sent, mBufferPos); + + return bytesWritten; + } + length -= currentChunk; + } + + if(length > 0) + { + intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, length); + bytesWritten += length; + mBufferPos += length; + } + + return bytesWritten; +} + +PxSocket::PxSocket(bool inIsBuffering, bool isBlocking) +{ + if(inIsBuffering) + { + void* mem = PX_ALLOC(sizeof(BufferedSocketImpl), "BufferedSocketImpl"); + mImpl = PX_PLACEMENT_NEW(mem, BufferedSocketImpl)(isBlocking); + } + else + { + void* mem = PX_ALLOC(sizeof(SocketImpl), "SocketImpl"); + mImpl = PX_PLACEMENT_NEW(mem, SocketImpl)(isBlocking); + } +} + +PxSocket::~PxSocket() +{ + mImpl->flush(); + mImpl->disconnect(); + mImpl->~SocketImpl(); + PX_FREE(mImpl); +} + +bool PxSocket::connect(const char* host, uint16_t port, uint32_t timeout) +{ + return mImpl->connect(host, port, timeout); +} + +bool PxSocket::listen(uint16_t port) +{ + return mImpl->listen(port); +} + +bool PxSocket::accept(bool block) +{ + return mImpl->accept(block); +} + +void PxSocket::disconnect() +{ + mImpl->disconnect(); +} + +bool PxSocket::isConnected() const +{ + return mImpl->isConnected(); +} + +const char* PxSocket::getHost() const +{ + return mImpl->getHost(); +} + +uint16_t PxSocket::getPort() const +{ + return mImpl->getPort(); +} + +bool PxSocket::flush() +{ + if(!mImpl->isConnected()) + return false; + return mImpl->flush(); +} + +uint32_t PxSocket::write(const uint8_t* data, uint32_t length) +{ + if(!mImpl->isConnected()) + return 0; + return mImpl->write(data, length); +} + +uint32_t PxSocket::read(uint8_t* data, uint32_t length) +{ + if(!mImpl->isConnected()) + return 0; + return mImpl->read(data, length); +} + +void PxSocket::setBlocking(bool blocking) +{ + mImpl->setBlocking(blocking); +} + +bool PxSocket::isBlocking() const +{ + return mImpl->isBlocking(); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp new file mode 100644 index 0000000..a43a0e6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixSync.cpp @@ -0,0 +1,159 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxSync.h" + +#include +#include +#include +#include +#include + +namespace physx +{ + +namespace +{ +class SyncImpl +{ + public: + pthread_mutex_t mutex; + pthread_cond_t cond; + volatile int setCounter; + volatile bool is_set; +}; + +SyncImpl* getSync(PxSyncImpl* impl) +{ + return reinterpret_cast(impl); +} +} + +uint32_t PxSyncImpl::getSize() +{ + return sizeof(SyncImpl); +} + +struct PxUnixScopeLock +{ + PxUnixScopeLock(pthread_mutex_t& m) : mMutex(m) + { + pthread_mutex_lock(&mMutex); + } + + ~PxUnixScopeLock() + { + pthread_mutex_unlock(&mMutex); + } + + private: + pthread_mutex_t& mMutex; +}; + +PxSyncImpl::PxSyncImpl() +{ + int status = pthread_mutex_init(&getSync(this)->mutex, 0); + PX_ASSERT(!status); + status = pthread_cond_init(&getSync(this)->cond, 0); + PX_ASSERT(!status); + PX_UNUSED(status); + getSync(this)->is_set = false; + getSync(this)->setCounter = 0; +} + +PxSyncImpl::~PxSyncImpl() +{ + pthread_cond_destroy(&getSync(this)->cond); + pthread_mutex_destroy(&getSync(this)->mutex); +} + +void PxSyncImpl::reset() +{ + PxUnixScopeLock lock(getSync(this)->mutex); + getSync(this)->is_set = false; +} + +void PxSyncImpl::set() +{ + PxUnixScopeLock lock(getSync(this)->mutex); + if(!getSync(this)->is_set) + { + getSync(this)->is_set = true; + getSync(this)->setCounter++; + pthread_cond_broadcast(&getSync(this)->cond); + } +} + +bool PxSyncImpl::wait(uint32_t ms) +{ + PxUnixScopeLock lock(getSync(this)->mutex); + int lastSetCounter = getSync(this)->setCounter; + if(!getSync(this)->is_set) + { + if(ms == uint32_t(-1)) + { + // have to loop here and check is_set since pthread_cond_wait can return successfully + // even if it was not signaled by pthread_cond_broadcast (OS efficiency design decision) + int status = 0; + while(!status && !getSync(this)->is_set && (lastSetCounter == getSync(this)->setCounter)) + status = pthread_cond_wait(&getSync(this)->cond, &getSync(this)->mutex); + PX_ASSERT((!status && getSync(this)->is_set) || (lastSetCounter != getSync(this)->setCounter)); + } + else + { + timespec ts; + timeval tp; + gettimeofday(&tp, NULL); + uint32_t sec = ms / 1000; + uint32_t usec = (ms - 1000 * sec) * 1000; + + // sschirm: taking into account that us might accumulate to a second + // otherwise the pthread_cond_timedwait complains on osx. + usec = tp.tv_usec + usec; + uint32_t div_sec = usec / 1000000; + uint32_t rem_usec = usec - div_sec * 1000000; + + ts.tv_sec = tp.tv_sec + sec + div_sec; + ts.tv_nsec = rem_usec * 1000; + + // have to loop here and check is_set since pthread_cond_timedwait can return successfully + // even if it was not signaled by pthread_cond_broadcast (OS efficiency design decision) + int status = 0; + while(!status && !getSync(this)->is_set && (lastSetCounter == getSync(this)->setCounter)) + status = pthread_cond_timedwait(&getSync(this)->cond, &getSync(this)->mutex, &ts); + PX_ASSERT((!status && getSync(this)->is_set) || (status == ETIMEDOUT) || + (lastSetCounter != getSync(this)->setCounter)); + } + } + return getSync(this)->is_set || (lastSetCounter != getSync(this)->setCounter); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp new file mode 100644 index 0000000..96e06e2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixThread.cpp @@ -0,0 +1,468 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxThread.h" + +#include +#include +#include +#include +#include +#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN +#include +#include +#endif + +#if PX_APPLE_FAMILY +#include +#include +#include +#include +#endif + +#define PxSpinLockPause() asm("nop") + +namespace physx +{ + +namespace +{ + +typedef enum +{ + ePxThreadNotStarted, + ePxThreadStarted, + ePxThreadStopped +} PxThreadState; + +class ThreadImpl +{ + public: + PxThreadImpl::ExecuteFn fn; + void* arg; + volatile int32_t quitNow; + volatile int32_t threadStarted; + volatile int32_t state; + + pthread_t thread; + pid_t tid; + + uint32_t affinityMask; + const char* name; +}; + +ThreadImpl* getThread(PxThreadImpl* impl) +{ + return reinterpret_cast(impl); +} + +static void setTid(ThreadImpl& threadImpl) +{ +// query TID +// AM: TODO: neither of the below are implemented +#if PX_APPLE_FAMILY + threadImpl.tid = syscall(SYS_gettid); +#elif PX_EMSCRIPTEN + threadImpl.tid = pthread_self(); +#else + threadImpl.tid = syscall(__NR_gettid); +#endif + + // notify/unblock parent thread + PxAtomicCompareExchange(&(threadImpl.threadStarted), 1, 0); +} + +void* PxThreadStart(void* arg) +{ + ThreadImpl* impl = getThread(reinterpret_cast(arg)); + impl->state = ePxThreadStarted; + + // run setTid in thread's context + setTid(*impl); + + // then run either the passed in function or execute from the derived class (Runnable). + if(impl->fn) + (*impl->fn)(impl->arg); + else if(impl->arg) + (reinterpret_cast(impl->arg))->execute(); + return 0; +} +} + +uint32_t PxThreadImpl::getSize() +{ + return sizeof(ThreadImpl); +} + +PxThreadImpl::Id PxThreadImpl::getId() +{ + return Id(pthread_self()); +} + +PxThreadImpl::PxThreadImpl() +{ + getThread(this)->thread = 0; + getThread(this)->tid = 0; + getThread(this)->state = ePxThreadNotStarted; + getThread(this)->quitNow = 0; + getThread(this)->threadStarted = 0; + getThread(this)->fn = NULL; + getThread(this)->arg = NULL; + getThread(this)->affinityMask = 0; + getThread(this)->name = "set my name before starting me"; +} + +PxThreadImpl::PxThreadImpl(PxThreadImpl::ExecuteFn fn, void* arg, const char* name) +{ + getThread(this)->thread = 0; + getThread(this)->tid = 0; + getThread(this)->state = ePxThreadNotStarted; + getThread(this)->quitNow = 0; + getThread(this)->threadStarted = 0; + getThread(this)->fn = fn; + getThread(this)->arg = arg; + getThread(this)->affinityMask = 0; + getThread(this)->name = name; + + start(0, NULL); +} + +PxThreadImpl::~PxThreadImpl() +{ + if(getThread(this)->state == ePxThreadStarted) + kill(); +} + +void PxThreadImpl::start(uint32_t stackSize, PxRunnable* runnable) +{ + if(getThread(this)->state != ePxThreadNotStarted) + return; + + if(stackSize == 0) + stackSize = getDefaultStackSize(); + +#if defined(PTHREAD_STACK_MIN) + if(stackSize < PTHREAD_STACK_MIN) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxThreadImpl::start(): stack size was set below PTHREAD_STACK_MIN"); + stackSize = PTHREAD_STACK_MIN; + } +#endif + + if(runnable && !getThread(this)->arg && !getThread(this)->fn) + getThread(this)->arg = runnable; + + pthread_attr_t attr; + int status = pthread_attr_init(&attr); + PX_ASSERT(!status); + PX_UNUSED(status); + + status = pthread_attr_setstacksize(&attr, stackSize); + PX_ASSERT(!status); + status = pthread_create(&getThread(this)->thread, &attr, PxThreadStart, this); + PX_ASSERT(!status); + + // wait for thread to startup and write out TID + // otherwise TID dependent calls like setAffinity will fail. + while(PxAtomicCompareExchange(&(getThread(this)->threadStarted), 1, 1) == 0) + yield(); + + // here we are sure that getThread(this)->state >= ePxThreadStarted + + status = pthread_attr_destroy(&attr); + PX_ASSERT(!status); + + // apply stored affinity mask + if(getThread(this)->affinityMask) + setAffinityMask(getThread(this)->affinityMask); + + if (getThread(this)->name) + setName(getThread(this)->name); +} + +void PxThreadImpl::signalQuit() +{ + PxAtomicIncrement(&(getThread(this)->quitNow)); +} + +bool PxThreadImpl::waitForQuit() +{ + if(getThread(this)->state == ePxThreadNotStarted) + return false; + + // works also with a stopped/exited thread if the handle is still valid + pthread_join(getThread(this)->thread, NULL); + getThread(this)->state = ePxThreadStopped; + return true; +} + +bool PxThreadImpl::quitIsSignalled() +{ + return PxAtomicCompareExchange(&(getThread(this)->quitNow), 0, 0) != 0; +} + +#if defined(PX_GCC_FAMILY) +__attribute__((noreturn)) +#endif + void PxThreadImpl::quit() +{ + getThread(this)->state = ePxThreadStopped; + pthread_exit(0); +} + +void PxThreadImpl::kill() +{ +// TODO: Add workaround for lack of Android support. In a blog post. From 2009. +// Seriously wtf. +// http://igourd.blogspot.com/2009/05/work-around-on-pthreadcancel-for.html +#if !defined(__ANDROID__) + if(getThread(this)->state == ePxThreadStarted) + pthread_cancel(getThread(this)->thread); + getThread(this)->state = ePxThreadStopped; +#endif +} + +void PxThreadImpl::sleep(uint32_t ms) +{ + timespec sleepTime; + uint32_t remainder = ms % 1000; + sleepTime.tv_sec = ms - remainder; + sleepTime.tv_nsec = remainder * 1000000L; + + while(nanosleep(&sleepTime, &sleepTime) == -1) + continue; +} + +void PxThreadImpl::yield() +{ + sched_yield(); +} + +void PxThreadImpl::yieldProcessor() +{ +#if (PX_ARM || PX_A64) + __asm__ __volatile__("yield"); +#else + __asm__ __volatile__("pause"); +#endif +} + +uint32_t PxThreadImpl::setAffinityMask(uint32_t mask) +{ + // Same as windows impl if mask is zero + if(!mask) + return 0; + + getThread(this)->affinityMask = mask; + + uint64_t prevMask = 0; + + if(getThread(this)->state == ePxThreadStarted) + { +#if PX_EMSCRIPTEN + // not supported +#elif !PX_APPLE_FAMILY // Apple doesn't support syscall with getaffinity and setaffinity + int32_t errGet = syscall(__NR_sched_getaffinity, getThread(this)->tid, sizeof(prevMask), &prevMask); + if(errGet < 0) + return 0; + + int32_t errSet = syscall(__NR_sched_setaffinity, getThread(this)->tid, sizeof(mask), &mask); + if(errSet != 0) + return 0; +#endif + } + + return uint32_t(prevMask); +} + +void PxThreadImpl::setName(const char* name) +{ + getThread(this)->name = name; + + if (getThread(this)->state == ePxThreadStarted) + { + // not implemented because most unix APIs expect setName() + // to be called from the thread's context. Example see next comment: + + // this works only with the current thread and can rename + // the main process if used in the wrong context: + // prctl(PR_SET_NAME, reinterpret_cast(name) ,0,0,0); + PX_UNUSED(name); + } +} + +#if !PX_APPLE_FAMILY +static PxThreadPriority::Enum convertPriorityFromLinux(uint32_t inPrio, int policy) +{ + PX_COMPILE_TIME_ASSERT(PxThreadPriority::eLOW > PxThreadPriority::eHIGH); + PX_COMPILE_TIME_ASSERT(PxThreadPriority::eHIGH == 0); + + int maxL = sched_get_priority_max(policy); + int minL = sched_get_priority_min(policy); + int rangeL = maxL - minL; + int rangeNv = PxThreadPriority::eLOW - PxThreadPriority::eHIGH; + + // case for default scheduler policy + if(rangeL == 0) + return PxThreadPriority::eNORMAL; + + float floatPrio = (float(maxL - inPrio) * float(rangeNv)) / float(rangeL); + + return PxThreadPriority::Enum(int(roundf(floatPrio))); +} + +static int convertPriorityToLinux(PxThreadPriority::Enum inPrio, int policy) +{ + int maxL = sched_get_priority_max(policy); + int minL = sched_get_priority_min(policy); + int rangeL = maxL - minL; + int rangeNv = PxThreadPriority::eLOW - PxThreadPriority::eHIGH; + + // case for default scheduler policy + if(rangeL == 0) + return 0; + + float floatPrio = (float(PxThreadPriority::eLOW - inPrio) * float(rangeL)) / float(rangeNv); + + return minL + int(roundf(floatPrio)); +} +#endif + +void PxThreadImpl::setPriority(PxThreadPriority::Enum val) +{ + PX_UNUSED(val); +#if !PX_APPLE_FAMILY + int policy; + sched_param s_param; + pthread_getschedparam(getThread(this)->thread, &policy, &s_param); + s_param.sched_priority = convertPriorityToLinux(val, policy); + pthread_setschedparam(getThread(this)->thread, policy, &s_param); +#endif +} + +PxThreadPriority::Enum PxThreadImpl::getPriority(Id pthread) +{ + PX_UNUSED(pthread); +#if !PX_APPLE_FAMILY + int policy; + sched_param s_param; + int ret = pthread_getschedparam(pthread_t(pthread), &policy, &s_param); + if(ret == 0) + return convertPriorityFromLinux(s_param.sched_priority, policy); + else + return PxThreadPriority::eNORMAL; +#else + return PxThreadPriority::eNORMAL; +#endif +} + +uint32_t PxThreadImpl::getNbPhysicalCores() +{ +#if PX_APPLE_FAMILY + int count; + size_t size = sizeof(count); + return sysctlbyname("hw.physicalcpu", &count, &size, NULL, 0) ? 0 : count; +#else + // Linux exposes CPU topology using /sys/devices/system/cpu + // https://www.kernel.org/doc/Documentation/cputopology.txt + if(FILE* f = fopen("/sys/devices/system/cpu/possible", "r")) + { + int minIndex, maxIndex; + int n = fscanf(f, "%d-%d", &minIndex, &maxIndex); + fclose(f); + + if(n == 2) + return (maxIndex - minIndex) + 1; + else if(n == 1) + return minIndex + 1; + } + + // For non-Linux kernels this fallback is possibly the best we can do + // but will report logical (hyper-threaded) counts + int n = sysconf(_SC_NPROCESSORS_CONF); + if(n < 0) + return 0; + else + return n; +#endif +} + + +PxU32 PxTlsAlloc() +{ + pthread_key_t key; + int status = pthread_key_create(&key, NULL); + PX_ASSERT(!status); + PX_UNUSED(status); + return PxU32(key); +} + +void PxTlsFree(PxU32 index) +{ + int status = pthread_key_delete(pthread_key_t(index)); + PX_ASSERT(!status); + PX_UNUSED(status); +} + +void* PxTlsGet(PxU32 index) +{ + return reinterpret_cast(pthread_getspecific(pthread_key_t(index))); +} + +size_t PxTlsGetValue(PxU32 index) +{ + return reinterpret_cast(pthread_getspecific(pthread_key_t(index))); +} + +PxU32 PxTlsSet(PxU32 index, void* value) +{ + int status = pthread_setspecific(pthread_key_t(index), value); + PX_ASSERT(!status); + return !status; +} + +PxU32 PxTlsSetValue(PxU32 index, size_t value) +{ + int status = pthread_setspecific(pthread_key_t(index), reinterpret_cast(value)); + PX_ASSERT(!status); + return !status; +} + +// DM: On Linux x86-32, without implementation-specific restrictions +// the default stack size for a new thread should be 2 megabytes (kernel.org). +// NOTE: take care of this value on other architectures! +PxU32 PxThreadImpl::getDefaultStackSize() +{ + return 1 << 21; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp new file mode 100644 index 0000000..7b252ce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/unix/FdUnixTime.cpp @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxTime.h" + +#include +#include + +#if PX_APPLE_FAMILY +#include +#endif + +// Use real-time high-precision timer. +#if !PX_APPLE_FAMILY +#define CLOCKID CLOCK_REALTIME +#endif + +namespace physx +{ + +static const PxCounterFrequencyToTensOfNanos gCounterFreq = PxTime::getCounterFrequency(); + +const PxCounterFrequencyToTensOfNanos& PxTime::getBootCounterFrequency() +{ + return gCounterFreq; +} + +static PxF64 getTimeSeconds() +{ + static struct timeval _tv; + gettimeofday(&_tv, NULL); + return double(_tv.tv_sec) + double(_tv.tv_usec) * 0.000001; +} + +PxTime::PxTime() +{ + mLastTime = getTimeSeconds(); +} + +PxF64 PxTime::getElapsedSeconds() +{ + PxF64 curTime = getTimeSeconds(); + PxF64 diff = curTime - mLastTime; + mLastTime = curTime; + return diff; +} + +PxF64 PxTime::peekElapsedSeconds() +{ + PxF64 curTime = getTimeSeconds(); + PxF64 diff = curTime - mLastTime; + return diff; +} + +PxF64 PxTime::getLastTime() const +{ + return mLastTime; +} + +#if PX_APPLE_FAMILY +PxCounterFrequencyToTensOfNanos PxTime::getCounterFrequency() +{ + mach_timebase_info_data_t info; + mach_timebase_info(&info); + // mach_absolute_time * (info.numer/info.denom) is in units of nano seconds + return PxCounterFrequencyToTensOfNanos(info.numer, info.denom * 10); +} + +uint64_t PxTime::getCurrentCounterValue() +{ + return mach_absolute_time(); +} + +#else + +PxCounterFrequencyToTensOfNanos PxTime::getCounterFrequency() +{ + return PxCounterFrequencyToTensOfNanos(1, 10); +} + +uint64_t PxTime::getCurrentCounterValue() +{ + struct timespec mCurrTimeInt; + clock_gettime(CLOCKID, &mCurrTimeInt); + // Convert to nanos as this doesn't cause a large divide here + return (static_cast(mCurrTimeInt.tv_sec) * 1000000000) + (static_cast(mCurrTimeInt.tv_nsec)); +} +#endif + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsAtomic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsAtomic.cpp new file mode 100644 index 0000000..d82bb85 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsAtomic.cpp @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxAtomic.h" + +namespace physx +{ + +PxI32 PxAtomicExchange(volatile PxI32* val, PxI32 val2) +{ + return (PxI32)InterlockedExchange((volatile LONG*)val, (LONG)val2); +} + +PxI32 PxAtomicCompareExchange(volatile PxI32* dest, PxI32 exch, PxI32 comp) +{ + return (PxI32)InterlockedCompareExchange((volatile LONG*)dest, exch, comp); +} + +void* PxAtomicCompareExchangePointer(volatile void** dest, void* exch, void* comp) +{ + return InterlockedCompareExchangePointer((volatile PVOID*)dest, exch, comp); +} + +PxI32 PxAtomicIncrement(volatile PxI32* val) +{ + return (PxI32)InterlockedIncrement((volatile LONG*)val); +} + +PxI32 PxAtomicDecrement(volatile PxI32* val) +{ + return (PxI32)InterlockedDecrement((volatile LONG*)val); +} + +PxI32 PxAtomicAdd(volatile PxI32* val, PxI32 delta) +{ + LONG newValue, oldValue; + do + { + oldValue = *val; + newValue = oldValue + delta; + } while(InterlockedCompareExchange((volatile LONG*)val, newValue, oldValue) != oldValue); + + return newValue; +} + +PxI32 PxAtomicMax(volatile PxI32* val, PxI32 val2) +{ + // Could do this more efficiently in asm... + + LONG newValue, oldValue; + + do + { + oldValue = *val; + + if(val2 > oldValue) + newValue = val2; + else + newValue = oldValue; + + } while(InterlockedCompareExchange((volatile LONG*)val, newValue, oldValue) != oldValue); + + return newValue; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsFPU.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsFPU.cpp new file mode 100644 index 0000000..ec9e2ab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsFPU.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include "foundation/PxFPU.h" +#include "float.h" +#include "foundation/PxIntrinsics.h" + +#if PX_X64 || PX_ARM || PX_A64 +#define _MCW_ALL _MCW_DN | _MCW_EM | _MCW_RC +#else +#define _MCW_ALL _MCW_DN | _MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC +#endif + +physx::PxFPUGuard::PxFPUGuard() +{ +// default plus FTZ and DAZ +#if PX_X64 || PX_ARM || PX_A64 + // query current control word state + _controlfp_s(mControlWords, 0, 0); + + // set both x87 and sse units to default + DAZ + unsigned int cw; + _controlfp_s(&cw, _CW_DEFAULT | _DN_FLUSH, _MCW_ALL); +#else + // query current control word state + __control87_2(0, 0, mControlWords, mControlWords + 1); + + // set both x87 and sse units to default + DAZ + unsigned int x87, sse; + __control87_2(_CW_DEFAULT | _DN_FLUSH, _MCW_ALL, &x87, &sse); +#endif +} + +physx::PxFPUGuard::~PxFPUGuard() +{ + _clearfp(); + +#if PX_X64 || PX_ARM || PX_A64 + // reset FP state + unsigned int cw; + _controlfp_s(&cw, *mControlWords, _MCW_ALL); +#else + + // reset FP state + unsigned int x87, sse; + __control87_2(mControlWords[0], _MCW_ALL, &x87, 0); + __control87_2(mControlWords[1], _MCW_ALL, 0, &sse); +#endif +} + +void physx::PxEnableFPExceptions() +{ + // clear any pending exceptions + _clearfp(); + + // enable all fp exceptions except inexact and underflow (common, benign) + _controlfp_s(NULL, uint32_t(~_MCW_EM) | _EM_INEXACT | _EM_UNDERFLOW, _MCW_EM); +} + +void physx::PxDisableFPExceptions() +{ + _controlfp_s(NULL, _MCW_EM, _MCW_EM); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsMutex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsMutex.cpp new file mode 100644 index 0000000..f369e26 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsMutex.cpp @@ -0,0 +1,158 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxMutex.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxThread.h" + +namespace physx +{ + +namespace +{ +struct MutexWinImpl +{ + CRITICAL_SECTION mLock; + PxThread::Id mOwner; +}; + +MutexWinImpl* getMutex(PxMutexImpl* impl) +{ + return reinterpret_cast(impl); +} +} // namespace + + +PxMutexImpl::PxMutexImpl() +{ + InitializeCriticalSection(&getMutex(this)->mLock); + getMutex(this)->mOwner = 0; +} + +PxMutexImpl::~PxMutexImpl() +{ + DeleteCriticalSection(&getMutex(this)->mLock); +} + +void PxMutexImpl::lock() +{ + EnterCriticalSection(&getMutex(this)->mLock); + +#if PX_DEBUG + getMutex(this)->mOwner = PxThread::getId(); +#endif +} + +bool PxMutexImpl::trylock() +{ + bool success = TryEnterCriticalSection(&getMutex(this)->mLock) != 0; +#if PX_DEBUG + if(success) + getMutex(this)->mOwner = PxThread::getId(); +#endif + return success; +} + +void PxMutexImpl::unlock() +{ +#if PX_DEBUG + // ensure we are already holding the lock + if(getMutex(this)->mOwner != PxThread::getId()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Mutex must be unlocked only by thread that has already acquired lock"); + return; + } + +#endif + + LeaveCriticalSection(&getMutex(this)->mLock); +} + +uint32_t PxMutexImpl::getSize() +{ + return sizeof(MutexWinImpl); +} + +class ReadWriteLockImpl +{ + PX_NOCOPY(ReadWriteLockImpl) + public: + ReadWriteLockImpl() + { + } + PxMutex mutex; + volatile LONG readerCount; // handle recursive writer locking +}; + +PxReadWriteLock::PxReadWriteLock() +{ + mImpl = reinterpret_cast(PX_ALLOC(sizeof(ReadWriteLockImpl), "ReadWriteLockImpl")); + PX_PLACEMENT_NEW(mImpl, ReadWriteLockImpl); + + mImpl->readerCount = 0; +} + +PxReadWriteLock::~PxReadWriteLock() +{ + mImpl->~ReadWriteLockImpl(); + PX_FREE(mImpl); +} + +void PxReadWriteLock::lockReader(bool takeLock) +{ + if(takeLock) + mImpl->mutex.lock(); + + InterlockedIncrement(&mImpl->readerCount); + + if(takeLock) + mImpl->mutex.unlock(); +} + +void PxReadWriteLock::lockWriter() +{ + mImpl->mutex.lock(); + + // spin lock until no readers + while(mImpl->readerCount); +} + +void PxReadWriteLock::unlockReader() +{ + InterlockedDecrement(&mImpl->readerCount); +} + +void PxReadWriteLock::unlockWriter() +{ + mImpl->mutex.unlock(); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsPrintString.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsPrintString.cpp new file mode 100644 index 0000000..879c275 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsPrintString.cpp @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxString.h" +#include +#pragma warning(push) +#pragma warning(disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#include +#pragma warning(pop) + +#include +#include +#include + +namespace physx +{ + +void PxPrintString(const char* str) +{ + puts(str); // do not use printf here, since str can contain multiple % signs that will not be printed + OutputDebugStringA(str); + OutputDebugStringA("\n"); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSList.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSList.cpp new file mode 100644 index 0000000..a1ac200 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSList.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxSList.h" + +namespace physx +{ +namespace +{ +template +SLIST_HEADER* getDetail(T* impl) +{ + return reinterpret_cast(impl); +} +} + +PxSListImpl::PxSListImpl() +{ + InitializeSListHead(getDetail(this)); +} + +PxSListImpl::~PxSListImpl() +{ +} + +void PxSListImpl::push(PxSListEntry* entry) +{ + InterlockedPushEntrySList(getDetail(this), reinterpret_cast(entry)); +} + +PxSListEntry* PxSListImpl::pop() +{ + return reinterpret_cast(InterlockedPopEntrySList(getDetail(this))); +} + +PxSListEntry* PxSListImpl::flush() +{ + return reinterpret_cast(InterlockedFlushSList(getDetail(this))); +} + +uint32_t PxSListImpl::getSize() +{ + return sizeof(SLIST_HEADER); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSocket.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSocket.cpp new file mode 100644 index 0000000..c48b4ac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSocket.cpp @@ -0,0 +1,441 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMathIntrinsics.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxSocket.h" +#include "foundation/PxThread.h" +#include "foundation/PxArray.h" + +#include +#pragma comment(lib, "Ws2_32") + +namespace physx +{ + +const uint32_t PxSocket::DEFAULT_BUFFER_SIZE = 32768; + +class SocketImpl +{ + public: + SocketImpl(bool isBlocking); + virtual ~SocketImpl(); + + bool connect(const char* host, uint16_t port, uint32_t timeout); + bool listen(uint16_t port); + bool accept(bool block); + void disconnect(); + + void setBlocking(bool blocking); + + virtual uint32_t write(const uint8_t* data, uint32_t length); + virtual bool flush(); + uint32_t read(uint8_t* data, uint32_t length); + + PX_FORCE_INLINE bool isBlocking() const + { + return mIsBlocking; + } + PX_FORCE_INLINE bool isConnected() const + { + return mIsConnected; + } + PX_FORCE_INLINE const char* getHost() const + { + return mHost; + } + PX_FORCE_INLINE uint16_t getPort() const + { + return mPort; + } + + protected: + bool nonBlockingTimeout() const; + void setBlockingInternal(SOCKET socket, bool blocking); + + mutable SOCKET mSocket; + SOCKET mListenSocket; + const char* mHost; + uint16_t mPort; + mutable bool mIsConnected; + bool mIsBlocking; + bool mListenMode; + bool mSocketLayerIntialized; +}; + +SocketImpl::SocketImpl(bool isBlocking) +: mSocket(INVALID_SOCKET) +, mListenSocket(INVALID_SOCKET) +, mHost(NULL) +, mPort(0) +, mIsConnected(false) +, mIsBlocking(isBlocking) +, mListenMode(false) +, mSocketLayerIntialized(false) +{ + WORD vreq; + WSADATA wsaData; + vreq = MAKEWORD(2, 2); + mSocketLayerIntialized = (WSAStartup(vreq, &wsaData) == 0); +} + +SocketImpl::~SocketImpl() +{ + if(mSocketLayerIntialized) + WSACleanup(); +} + +void SocketImpl::setBlockingInternal(SOCKET socket, bool blocking) +{ + uint32_t mode = uint32_t(blocking ? 0 : 1); + ioctlsocket(socket, FIONBIO, (u_long*)&mode); +} + +#ifdef PX_VC11 +#pragma warning(push) +#pragma warning(disable : 4548) // for FD_SET on vc11 only +#endif +bool SocketImpl::connect(const char* host, uint16_t port, uint32_t timeout) +{ + if(!mSocketLayerIntialized) + return false; + + sockaddr_in socketAddress; + hostent* hp; + + intrinsics::memSet(&socketAddress, 0, sizeof(sockaddr_in)); + socketAddress.sin_family = AF_INET; + socketAddress.sin_port = htons(port); + + // get host + hp = gethostbyname(host); + if(!hp) + { + in_addr a; + a.s_addr = inet_addr(host); + hp = gethostbyaddr((const char*)&a, sizeof(in_addr), AF_INET); + if(!hp) + return false; + } + intrinsics::memCopy(&socketAddress.sin_addr, hp->h_addr_list[0], (uint32_t)hp->h_length); + + // connect + mSocket = socket(PF_INET, SOCK_STREAM, 0); + if(mSocket == INVALID_SOCKET) + return false; + + setBlockingInternal(mSocket, false); + + ::connect(mSocket, (sockaddr*)&socketAddress, sizeof(socketAddress)); + // Setup select function call to monitor the connect call. + fd_set writefs; + fd_set exceptfs; + FD_ZERO(&writefs); + FD_ZERO(&exceptfs); +#pragma warning(push) +#pragma warning(disable : 4127 4548) + FD_SET(mSocket, &writefs); + FD_SET(mSocket, &exceptfs); +#pragma warning(pop) + timeval timeout_; + timeout_.tv_sec = long(timeout / 1000); + timeout_.tv_usec = long(((timeout % 1000) * 1000)); + int selret = ::select(1, NULL, &writefs, &exceptfs, &timeout_); + int excepted = FD_ISSET(mSocket, &exceptfs); + int canWrite = FD_ISSET(mSocket, &writefs); + if(selret != 1 || excepted || !canWrite) + { + disconnect(); + return false; + } + + setBlockingInternal(mSocket, mIsBlocking); + + mIsConnected = true; + mPort = port; + mHost = host; + return true; +} +#ifdef PX_VC11 +#pragma warning(pop) +#endif + +bool SocketImpl::listen(uint16_t port) +{ + if(!mSocketLayerIntialized) + return false; + + mListenSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); + if(mListenSocket == INVALID_SOCKET) + return false; + + mListenMode = true; + + sockaddr_in addr; + intrinsics::memSet(&addr, 0, sizeof(sockaddr_in)); + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = htonl(INADDR_ANY); + return bind(mListenSocket, (sockaddr*)&addr, sizeof(addr)) == 0 && ::listen(mListenSocket, SOMAXCONN) == 0; +} + +bool SocketImpl::accept(bool block) +{ + if(mIsConnected || !mListenMode) + return false; + + // set the listen socket to be non-blocking. + setBlockingInternal(mListenSocket, block); + SOCKET clientSocket = ::accept(mListenSocket, 0, 0); + if(clientSocket == INVALID_SOCKET) + return false; + + mSocket = clientSocket; + mIsConnected = true; + setBlockingInternal(mSocket, mIsBlocking); // force the mode to whatever the user set + + return mIsConnected; +} + +void SocketImpl::disconnect() +{ + if(mListenSocket != INVALID_SOCKET) + { + closesocket(mListenSocket); + mListenSocket = INVALID_SOCKET; + } + if(mSocket != INVALID_SOCKET) + { + WSASendDisconnect(mSocket, NULL); + closesocket(mSocket); + mSocket = INVALID_SOCKET; + } + mIsConnected = false; + mListenMode = false; + mPort = 0; + mHost = NULL; +} + +bool SocketImpl::nonBlockingTimeout() const +{ + return !mIsBlocking && WSAGetLastError() == WSAEWOULDBLOCK; +} + +// should be cross-platform from here down + +void SocketImpl::setBlocking(bool blocking) +{ + if(blocking != mIsBlocking) + { + mIsBlocking = blocking; + if(isConnected()) + setBlockingInternal(mSocket, blocking); + } +} + +bool SocketImpl::flush() +{ + return true; +} + +uint32_t SocketImpl::write(const uint8_t* data, uint32_t length) +{ + if(length == 0) + return 0; + + int sent = send(mSocket, (const char*)data, (int32_t)length, 0); + + if(sent <= 0 && !nonBlockingTimeout()) + disconnect(); + + return uint32_t(sent > 0 ? sent : 0); +} + +uint32_t SocketImpl::read(uint8_t* data, uint32_t length) +{ + if(length == 0) + return 0; + + int32_t received = recv(mSocket, (char*)data, (int32_t)length, 0); + + if(received <= 0 && !nonBlockingTimeout()) + disconnect(); + + return uint32_t(received > 0 ? received : 0); +} + +class BufferedSocketImpl : public SocketImpl +{ + public: + BufferedSocketImpl(bool isBlocking) : SocketImpl(isBlocking), mBufferPos(0) + { + } + virtual ~BufferedSocketImpl() + { + } + bool flush(); + uint32_t write(const uint8_t* data, uint32_t length); + + private: + uint32_t mBufferPos; + uint8_t mBuffer[PxSocket::DEFAULT_BUFFER_SIZE]; +}; + +bool BufferedSocketImpl::flush() +{ + uint32_t totalBytesWritten = 0; + + while(totalBytesWritten < mBufferPos && mIsConnected) + totalBytesWritten += (int32_t)SocketImpl::write(mBuffer + totalBytesWritten, mBufferPos - totalBytesWritten); + + bool ret = (totalBytesWritten == mBufferPos); + mBufferPos = 0; + return ret; +} + +uint32_t BufferedSocketImpl::write(const uint8_t* data, uint32_t length) +{ + uint32_t bytesWritten = 0; + while(mBufferPos + length >= PxSocket::DEFAULT_BUFFER_SIZE) + { + uint32_t currentChunk = PxSocket::DEFAULT_BUFFER_SIZE - mBufferPos; + intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, currentChunk); + bytesWritten += (uint32_t)currentChunk; // for the user, this is consumed even if we fail to shove it down a + // non-blocking socket + + uint32_t sent = SocketImpl::write(mBuffer, PxSocket::DEFAULT_BUFFER_SIZE); + mBufferPos = PxSocket::DEFAULT_BUFFER_SIZE - sent; + + if(sent < PxSocket::DEFAULT_BUFFER_SIZE) // non-blocking or error + { + if(sent) // we can reasonably hope this is rare + intrinsics::memMove(mBuffer, mBuffer + sent, mBufferPos); + + return bytesWritten; + } + length -= currentChunk; + } + + if(length > 0) + { + intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, length); + bytesWritten += length; + mBufferPos += length; + } + + return bytesWritten; +} + +PxSocket::PxSocket(bool inIsBuffering, bool isBlocking) +{ + if(inIsBuffering) + { + void* mem = PX_ALLOC(sizeof(BufferedSocketImpl), "BufferedSocketImpl"); + mImpl = PX_PLACEMENT_NEW(mem, BufferedSocketImpl)(isBlocking); + } + else + { + void* mem = PX_ALLOC(sizeof(SocketImpl), "SocketImpl"); + mImpl = PX_PLACEMENT_NEW(mem, SocketImpl)(isBlocking); + } +} + +PxSocket::~PxSocket() +{ + mImpl->flush(); + mImpl->disconnect(); + mImpl->~SocketImpl(); + PX_FREE(mImpl); +} + +bool PxSocket::connect(const char* host, uint16_t port, uint32_t timeout) +{ + return mImpl->connect(host, port, timeout); +} + +bool PxSocket::listen(uint16_t port) +{ + return mImpl->listen(port); +} + +bool PxSocket::accept(bool block) +{ + return mImpl->accept(block); +} + +void PxSocket::disconnect() +{ + mImpl->disconnect(); +} + +bool PxSocket::isConnected() const +{ + return mImpl->isConnected(); +} + +const char* PxSocket::getHost() const +{ + return mImpl->getHost(); +} + +uint16_t PxSocket::getPort() const +{ + return mImpl->getPort(); +} + +bool PxSocket::flush() +{ + if(!mImpl->isConnected()) + return false; + return mImpl->flush(); +} + +uint32_t PxSocket::write(const uint8_t* data, uint32_t length) +{ + if(!mImpl->isConnected()) + return 0; + return mImpl->write(data, length); +} + +uint32_t PxSocket::read(uint8_t* data, uint32_t length) +{ + if(!mImpl->isConnected()) + return 0; + return mImpl->read(data, length); +} + +void PxSocket::setBlocking(bool blocking) +{ + mImpl->setBlocking(blocking); +} + +bool PxSocket::isBlocking() const +{ + return mImpl->isBlocking(); +} +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSync.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSync.cpp new file mode 100644 index 0000000..da8be69 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsSync.cpp @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxSync.h" + +namespace physx +{ +namespace +{ +HANDLE& getSync(PxSyncImpl* impl) +{ + return *reinterpret_cast(impl); +} +} + +uint32_t PxSyncImpl::getSize() +{ + return sizeof(HANDLE); +} + +PxSyncImpl::PxSyncImpl() +{ + getSync(this) = CreateEvent(0, true, false, 0); +} + +PxSyncImpl::~PxSyncImpl() +{ + CloseHandle(getSync(this)); +} + +void PxSyncImpl::reset() +{ + ResetEvent(getSync(this)); +} + +void PxSyncImpl::set() +{ + SetEvent(getSync(this)); +} + +bool PxSyncImpl::wait(uint32_t milliseconds) +{ + if(milliseconds == static_cast(-1)) + milliseconds = INFINITE; + + return WaitForSingleObject(getSync(this), milliseconds) == WAIT_OBJECT_0; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsThread.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsThread.cpp new file mode 100644 index 0000000..d5d6b9c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsThread.cpp @@ -0,0 +1,446 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/windows/PxWindowsInclude.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxAssert.h" +#include "foundation/PxThread.h" +#include "foundation/PxAlloca.h" + +// an exception for setting the thread name in Microsoft debuggers +#define NS_MS_VC_EXCEPTION 0x406D1388 + +namespace physx +{ + +namespace +{ + +#if PX_VC +#pragma warning(disable : 4061) // enumerator 'identifier' in switch of enum 'enumeration' is not handled +#pragma warning(disable : 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' +#endif + +// struct for naming a thread in the debugger +#pragma pack(push, 8) + +typedef struct tagTHREADNAME_INFO +{ + DWORD dwType; // Must be 0x1000. + LPCSTR szName; // Pointer to name (in user addr space). + DWORD dwThreadID; // Thread ID (-1=caller thread). + DWORD dwFlags; // Reserved for future use, must be zero. +} THREADNAME_INFO; + +#pragma pack(pop) + +class ThreadImpl +{ + public: + enum State + { + NotStarted, + Started, + Stopped + }; + + HANDLE thread; + LONG quitNow; // Should be 32bit aligned on SMP systems. + State state; + DWORD threadID; + + PxThreadImpl::ExecuteFn fn; + void* arg; + + uint32_t affinityMask; + const char* name; +}; + +static PX_FORCE_INLINE ThreadImpl* getThread(PxThreadImpl* impl) +{ + return reinterpret_cast(impl); +} + +static DWORD WINAPI PxThreadStart(LPVOID arg) +{ + ThreadImpl* impl = getThread((PxThreadImpl*)arg); + + // run either the passed in function or execute from the derived class (Runnable). + if(impl->fn) + (*impl->fn)(impl->arg); + else if(impl->arg) + ((PxRunnable*)impl->arg)->execute(); + return 0; +} + +// cache physical thread count +static uint32_t gPhysicalCoreCount = 0; +} + +uint32_t PxThreadImpl::getSize() +{ + return sizeof(ThreadImpl); +} + +PxThreadImpl::Id PxThreadImpl::getId() +{ + return static_cast(GetCurrentThreadId()); +} + +// fwd GetLogicalProcessorInformation() +typedef BOOL(WINAPI* LPFN_GLPI)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD); + +uint32_t PxThreadImpl::getNbPhysicalCores() +{ + if(!gPhysicalCoreCount) + { + // modified example code from: http://msdn.microsoft.com/en-us/library/ms683194 + LPFN_GLPI glpi; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL; + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL; + DWORD returnLength = 0; + DWORD processorCoreCount = 0; + DWORD byteOffset = 0; + + glpi = (LPFN_GLPI)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetLogicalProcessorInformation"); + + if(NULL == glpi) + { + // GetLogicalProcessorInformation not supported on OS < XP Service Pack 3 + return 0; + } + + DWORD rc = (DWORD)glpi(NULL, &returnLength); + PX_ASSERT(rc == FALSE); + PX_UNUSED(rc); + + // first query reports required buffer space + if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)PxAlloca(returnLength); + } + else + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "Error querying buffer size for number of physical processors"); + return 0; + } + + // retrieve data + rc = (DWORD)glpi(buffer, &returnLength); + if(rc != TRUE) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "Error querying number of physical processors"); + return 0; + } + + ptr = buffer; + + while(byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) + { + switch(ptr->Relationship) + { + case RelationProcessorCore: + processorCoreCount++; + break; + default: + break; + } + + byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); + ptr++; + } + + gPhysicalCoreCount = processorCoreCount; + } + + return gPhysicalCoreCount; +} + +PxThreadImpl::PxThreadImpl() +{ + getThread(this)->thread = NULL; + getThread(this)->state = ThreadImpl::NotStarted; + getThread(this)->quitNow = 0; + getThread(this)->fn = NULL; + getThread(this)->arg = NULL; + getThread(this)->affinityMask = 0; + getThread(this)->name = NULL; +} + +PxThreadImpl::PxThreadImpl(ExecuteFn fn, void* arg, const char* name) +{ + getThread(this)->thread = NULL; + getThread(this)->state = ThreadImpl::NotStarted; + getThread(this)->quitNow = 0; + getThread(this)->fn = fn; + getThread(this)->arg = arg; + getThread(this)->affinityMask = 0; + getThread(this)->name = name; + + start(0, NULL); +} + +PxThreadImpl::~PxThreadImpl() +{ + if(getThread(this)->state == ThreadImpl::Started) + kill(); + CloseHandle(getThread(this)->thread); +} + +void PxThreadImpl::start(uint32_t stackSize, PxRunnable* runnable) +{ + if(getThread(this)->state != ThreadImpl::NotStarted) + return; + getThread(this)->state = ThreadImpl::Started; + + if(runnable && !getThread(this)->arg && !getThread(this)->fn) + getThread(this)->arg = runnable; + + getThread(this)->thread = + CreateThread(NULL, stackSize, PxThreadStart, (LPVOID) this, CREATE_SUSPENDED, &getThread(this)->threadID); + if(!getThread(this)->thread) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PsWindowsThread::start: Failed to create thread."); + getThread(this)->state = ThreadImpl::NotStarted; + return; + } + + // set affinity, set name and resume + if(getThread(this)->affinityMask) + setAffinityMask(getThread(this)->affinityMask); + + if (getThread(this)->name) + setName(getThread(this)->name); + + DWORD rc = ResumeThread(getThread(this)->thread); + if(rc == DWORD(-1)) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PsWindowsThread::start: Failed to resume thread."); + getThread(this)->state = ThreadImpl::NotStarted; + return; + } +} + +void PxThreadImpl::signalQuit() +{ + InterlockedIncrement(&(getThread(this)->quitNow)); +} + +bool PxThreadImpl::waitForQuit() +{ + if(getThread(this)->state == ThreadImpl::NotStarted) + return false; + + WaitForSingleObject(getThread(this)->thread, INFINITE); + getThread(this)->state = ThreadImpl::Stopped; + return true; +} + +bool PxThreadImpl::quitIsSignalled() +{ + return InterlockedCompareExchange(&(getThread(this)->quitNow), 0, 0) != 0; +} + +void PxThreadImpl::quit() +{ + getThread(this)->state = ThreadImpl::Stopped; + ExitThread(0); +} + +void PxThreadImpl::kill() +{ + if(getThread(this)->state == ThreadImpl::Started) + TerminateThread(getThread(this)->thread, 0); + getThread(this)->state = ThreadImpl::Stopped; +} + +void PxThreadImpl::sleep(uint32_t ms) +{ + Sleep(ms); +} + +void PxThreadImpl::yield() +{ + SwitchToThread(); +} + +void PxThreadImpl::yieldProcessor() +{ + YieldProcessor(); +} + +uint32_t PxThreadImpl::setAffinityMask(uint32_t mask) +{ + if(mask) + { + // store affinity + getThread(this)->affinityMask = mask; + + // if thread already started apply immediately + if(getThread(this)->state == ThreadImpl::Started) + { + uint32_t err = uint32_t(SetThreadAffinityMask(getThread(this)->thread, mask)); + return err; + } + } + + return 0; +} + +void PxThreadImpl::setName(const char* name) +{ + getThread(this)->name = name; + + if (getThread(this)->state == ThreadImpl::Started) + { + // SetThreadDescription is preferred as it makes it possible for performance + // analysis tools to see the thread name. But it is only available on Windows 10. + // more info: https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code?view=vs-2019 + + // The SetThreadDescription API was brought in version 1607 of Windows 10. + typedef HRESULT(WINAPI * SetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription); + + auto set_thread_description_func = reinterpret_cast( + ::GetProcAddress(::GetModuleHandle("Kernel32.dll"), "SetThreadDescription")); + + if (set_thread_description_func) + { + wchar_t wname[128]; + size_t wchars = 0; + mbstowcs_s(&wchars, wname, strlen(name) + 1, name, _TRUNCATE); + + set_thread_description_func(getThread(this)->thread, wname); + } + + THREADNAME_INFO info; + info.dwType = 0x1000; + info.szName = name; + info.dwThreadID = getThread(this)->threadID; + info.dwFlags = 0; + + // C++ Exceptions are disabled for this project, but SEH is not (and cannot be) + // http://stackoverflow.com/questions/943087/what-exactly-will-happen-if-i-disable-c-exceptions-in-a-project + __try + { + RaiseException(NS_MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + // this runs if not attached to a debugger (thus not really naming the thread) + } + } +} + +void PxThreadImpl::setPriority(PxThreadPriority::Enum prio) +{ + BOOL rc = false; + switch(prio) + { + case PxThreadPriority::eHIGH: + rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_HIGHEST); + break; + case PxThreadPriority::eABOVE_NORMAL: + rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_ABOVE_NORMAL); + break; + case PxThreadPriority::eNORMAL: + rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_NORMAL); + break; + case PxThreadPriority::eBELOW_NORMAL: + rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_BELOW_NORMAL); + break; + case PxThreadPriority::eLOW: + rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_LOWEST); + break; + default: + break; + } + if(!rc) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PsWindowsThread::setPriority: Failed to set thread priority."); + } +} + +PxThreadPriority::Enum PxThreadImpl::getPriority(Id threadId) +{ + PxThreadPriority::Enum retval = PxThreadPriority::eLOW; + int priority = GetThreadPriority((HANDLE)threadId); + PX_COMPILE_TIME_ASSERT(THREAD_PRIORITY_HIGHEST > THREAD_PRIORITY_ABOVE_NORMAL); + if(priority >= THREAD_PRIORITY_HIGHEST) + retval = PxThreadPriority::eHIGH; + else if(priority >= THREAD_PRIORITY_ABOVE_NORMAL) + retval = PxThreadPriority::eABOVE_NORMAL; + else if(priority >= THREAD_PRIORITY_NORMAL) + retval = PxThreadPriority::eNORMAL; + else if(priority >= THREAD_PRIORITY_BELOW_NORMAL) + retval = PxThreadPriority::eBELOW_NORMAL; + return retval; +} + +PxU32 PxTlsAlloc() +{ + DWORD rv = ::TlsAlloc(); + PX_ASSERT(rv != TLS_OUT_OF_INDEXES); + return (PxU32)rv; +} + +void PxTlsFree(PxU32 index) +{ + ::TlsFree(index); +} + +void* PxTlsGet(PxU32 index) +{ + return ::TlsGetValue(index); +} + +size_t PxTlsGetValue(PxU32 index) +{ + return size_t(::TlsGetValue(index)); +} + +PxU32 PxTlsSet(PxU32 index, void* value) +{ + return PxU32(::TlsSetValue(index, value)); +} + +PxU32 PxTlsSetValue(PxU32 index, size_t value) +{ + return PxU32(::TlsSetValue(index, reinterpret_cast(value))); +} + +PxU32 PxThreadImpl::getDefaultStackSize() +{ + return 1048576; +}; + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsTime.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsTime.cpp new file mode 100644 index 0000000..4e28461 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/foundation/windows/FdWindowsTime.cpp @@ -0,0 +1,97 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxTime.h" +#include "foundation/windows/PxWindowsInclude.h" + +namespace +{ +int64_t getTimeTicks() +{ + LARGE_INTEGER a; + QueryPerformanceCounter(&a); + return a.QuadPart; +} + +double getTickDuration() +{ + LARGE_INTEGER a; + QueryPerformanceFrequency(&a); + return 1.0f / double(a.QuadPart); +} + +double sTickDuration = getTickDuration(); +} // namespace + +namespace physx +{ + +static const PxCounterFrequencyToTensOfNanos gCounterFreq = PxTime::getCounterFrequency(); + +const PxCounterFrequencyToTensOfNanos& PxTime::getBootCounterFrequency() +{ + return gCounterFreq; +} + +PxCounterFrequencyToTensOfNanos PxTime::getCounterFrequency() +{ + LARGE_INTEGER freq; + QueryPerformanceFrequency(&freq); + return PxCounterFrequencyToTensOfNanos(PxTime::sNumTensOfNanoSecondsInASecond, (uint64_t)freq.QuadPart); +} + +uint64_t PxTime::getCurrentCounterValue() +{ + LARGE_INTEGER ticks; + QueryPerformanceCounter(&ticks); + return (uint64_t)ticks.QuadPart; +} + +PxTime::PxTime() : mTickCount(0) +{ + getElapsedSeconds(); +} + +PxF64 PxTime::getElapsedSeconds() +{ + int64_t lastTickCount = mTickCount; + mTickCount = getTimeTicks(); + return (mTickCount - lastTickCount) * sTickDuration; +} + +PxF64 PxTime::peekElapsedSeconds() +{ + return (getTimeTicks() - mTickCount) * sTickDuration; +} + +PxF64 PxTime::getLastTime() const +{ + return mTickCount * sTickDuration; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuActorShapeMap.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuActorShapeMap.h new file mode 100644 index 0000000..77a60a4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuActorShapeMap.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_ACTOR_SHAPE_MAP_H +#define GU_ACTOR_SHAPE_MAP_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxHashMap.h" + +namespace physx +{ +namespace Gu +{ + typedef PxU64 ActorShapeData; + + #define PX_INVALID_INDEX 0xffffffff + + class ActorShapeMap + { + public: + PX_PHYSX_COMMON_API ActorShapeMap(); + PX_PHYSX_COMMON_API ~ActorShapeMap(); + + PX_PHYSX_COMMON_API bool add(PxU32 actorIndex, const void* actor, const void* shape, ActorShapeData actorShapeData); + PX_PHYSX_COMMON_API bool remove(PxU32 actorIndex, const void* actor, const void* shape, ActorShapeData* removed); + PX_PHYSX_COMMON_API ActorShapeData find(PxU32 actorIndex, const void* actor, const void* shape) const; + + struct ActorShape + { + PX_FORCE_INLINE ActorShape() {} + PX_FORCE_INLINE ActorShape(const void* actor, const void* shape) : mActor(actor), mShape(shape) {} + + const void* mActor; + const void* mShape; + + PX_FORCE_INLINE bool operator==(const ActorShape& p) const + { + return mActor == p.mActor && mShape == p.mShape; + } + }; + private: + PxHashMap mDatabase; + + struct Cache + { +// const void* mActor; + const void* mShape; + ActorShapeData mData; + }; + PxU32 mCacheSize; + Cache* mCache; + + void resizeCache(PxU32 index); + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBounds.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBounds.h new file mode 100644 index 0000000..cf9a622 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBounds.h @@ -0,0 +1,200 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BOUNDS_H +#define GU_BOUNDS_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxFlags.h" +#include "foundation/PxVecMath.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include +#include "GuBox.h" +#include "GuCenterExtents.h" +#include "GuSphere.h" +#include "GuCapsule.h" + +// PT: the PX_MAX_BOUNDS_EXTENTS value is too large and produces INF floats when the box values are squared in +// some collision routines. Thus, for the SQ subsystem we use this alternative (smaller) value to mark empty bounds. +// See PX-954 for details. +#define GU_EMPTY_BOUNDS_EXTENTS PxSqrt(0.25f * 1e33f) + +namespace physx +{ +namespace Gu +{ + PX_FORCE_INLINE void computeCapsuleBounds(PxBounds3& bounds, const PxCapsuleGeometry& capsuleGeom, const PxTransform& pose, float contactOffset=0.0f, float inflation=1.0f) + { + const PxVec3 d = pose.q.getBasisVector0(); + PxVec3 extents; + for(PxU32 ax = 0; ax<3; ax++) + extents[ax] = (PxAbs(d[ax]) * capsuleGeom.halfHeight + capsuleGeom.radius + contactOffset)*inflation; + bounds.minimum = pose.p - extents; + bounds.maximum = pose.p + extents; + } + + //'contactOffset' and 'inflation' should not be used at the same time, i.e. either contactOffset==0.0f, or inflation==1.0f + PX_PHYSX_COMMON_API void computeBounds(PxBounds3& bounds, const PxGeometry& geometry, const PxTransform& transform, float contactOffset, float inflation); //AABB in world space. + + PX_FORCE_INLINE PxBounds3 computeBounds(const PxGeometry& geometry, const PxTransform& pose) + { + PxBounds3 bounds; + computeBounds(bounds, geometry, pose, 0.0f, 1.0f); + return bounds; + } + + void computeGlobalBox(PxBounds3& bounds, PxU32 nbPrims, const PxBounds3* PX_RESTRICT boxes, const PxU32* PX_RESTRICT primitives); + + PX_PHYSX_COMMON_API void computeBoundsAroundVertices(PxBounds3& bounds, PxU32 nbVerts, const PxVec3* PX_RESTRICT verts); + PX_PHYSX_COMMON_API void computeLocalBoundsAndGeomEpsilon(const PxVec3* vertices, PxU32 nbVerties, PxBounds3& localBounds, PxReal& geomEpsilon); + + #define StoreBounds(bounds, minV, maxV) \ + V4StoreU(minV, &bounds.minimum.x); \ + PX_ALIGN(16, PxVec4) max4; \ + V4StoreA(maxV, &max4.x); \ + bounds.maximum = PxVec3(max4.x, max4.y, max4.z); + + // PT: TODO: - refactor with "inflateBounds" in GuBounds.cpp if possible + template + PX_FORCE_INLINE void inflateBounds(PxBounds3& dst, const PxBounds3& src, float enlargement) + { + const float coeff = 0.5f * enlargement; + if(useSIMD) + { + using namespace physx::aos; + + Vec4V minV = V4LoadU(&src.minimum.x); + Vec4V maxV = V4LoadU(&src.maximum.x); + const Vec4V eV = V4Scale(V4Sub(maxV, minV), FLoad(coeff)); + + minV = V4Sub(minV, eV); + maxV = V4Add(maxV, eV); + + StoreBounds(dst, minV, maxV); + } + else + { + // PT: this clumsy but necessary second codepath is used to read the last bound of the array + // (making sure we don't V4LoadU invalid memory). Implementation must stay in sync with the + // main codepath above. No, this is not very nice. + const PxVec3& minV = src.minimum; + const PxVec3& maxV = src.maximum; + const PxVec3 eV = (maxV - minV) * coeff; + dst.minimum = minV - eV; + dst.maximum = maxV + eV; + } + } + + class ShapeData + { + public: + + PX_PHYSX_COMMON_API ShapeData(const PxGeometry& g, const PxTransform& t, PxReal inflation); + + // PT: used by overlaps (box, capsule, convex) + PX_FORCE_INLINE const PxVec3& getPrunerBoxGeomExtentsInflated() const { return mPrunerBoxGeomExtents; } + + // PT: used by overlaps (box, capsule, convex) + PX_FORCE_INLINE const PxVec3& getPrunerWorldPos() const { return mGuBox.center; } + + PX_FORCE_INLINE const PxBounds3& getPrunerInflatedWorldAABB() const { return mPrunerInflatedAABB; } + + // PT: used by overlaps (box, capsule, convex) + PX_FORCE_INLINE const PxMat33& getPrunerWorldRot33() const { return mGuBox.rot; } + + // PT: this one only used by overlaps so far (for sphere shape, pruner level) + PX_FORCE_INLINE const Gu::Sphere& getGuSphere() const + { + PX_ASSERT(mType == PxGeometryType::eSPHERE); + return reinterpret_cast(mGuSphere); + } + + // PT: this one only used by sweeps so far (for box shape, NP level) + PX_FORCE_INLINE const Gu::Box& getGuBox() const + { + PX_ASSERT(mType == PxGeometryType::eBOX); + return mGuBox; + } + + // PT: this one used by sweeps (NP level) and overlaps (pruner level) - for capsule shape + PX_FORCE_INLINE const Gu::Capsule& getGuCapsule() const + { + PX_ASSERT(mType == PxGeometryType::eCAPSULE); + return reinterpret_cast(mGuCapsule); + } + + PX_FORCE_INLINE float getCapsuleHalfHeight() const + { + PX_ASSERT(mType == PxGeometryType::eCAPSULE); + return mGuBox.extents.x; + } + + PX_FORCE_INLINE PxU32 isOBB() const { return PxU32(mIsOBB); } + PX_FORCE_INLINE PxGeometryType::Enum getType() const { return PxGeometryType::Enum(mType); } + + PX_NOCOPY(ShapeData) + private: + + // PT: box: pre-inflated box extents + // capsule: pre-inflated extents of box-around-capsule + // convex: pre-inflated extents of box-around-convex + // sphere: not used + PxVec3 mPrunerBoxGeomExtents; // used for pruners. This volume encloses but can differ from the original shape + + // PT: + // + // box center = unchanged copy of initial shape's position, except for convex (position of box around convex) + // SIMD code will load it as a V4 (safe because member is not last of Gu structure) + // + // box rot = precomputed PxMat33 version of initial shape's rotation, except for convex (rotation of box around convex) + // SIMD code will load it as V4s (safe because member is not last of Gu structure) + // + // box extents = non-inflated initial box extents for box shape, half-height for capsule, otherwise not used + Gu::Box mGuBox; + + PxBounds3 mPrunerInflatedAABB; // precomputed AABB for the pruner shape + PxU16 mIsOBB; // true for OBB, false for AABB. Also used as padding for mPrunerInflatedAABB, don't move. + PxU16 mType; // shape's type + + // these union Gu shapes are only precomputed for narrow phase (not pruners), can be different from mPrunerVolume + // so need separate storage + union + { + PxU8 mGuCapsule[sizeof(Gu::Capsule)]; // 28 + PxU8 mGuSphere[sizeof(Gu::Sphere)]; // 16 + }; + }; + +// PT: please make sure it fits in "one" cache line +PX_COMPILE_TIME_ASSERT(sizeof(ShapeData)==128); + +} // namespace Gu + +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBox.h new file mode 100644 index 0000000..38addf3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuBox.h @@ -0,0 +1,223 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BOX_H +#define GU_BOX_H + +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + class Capsule; + + PX_PHYSX_COMMON_API void computeOBBPoints(PxVec3* PX_RESTRICT pts, const PxVec3& center, const PxVec3& extents, const PxVec3& base0, const PxVec3& base1, const PxVec3& base2); + + + /** + \brief Represents an oriented bounding box. + + As a center point, extents(radii) and a rotation. i.e. the center of the box is at the center point, + the box is rotated around this point with the rotation and it is 2*extents in width, height and depth. + */ + + /** + Box geometry + + The rot member describes the world space orientation of the box. + The center member gives the world space position of the box. + The extents give the local space coordinates of the box corner in the positive octant. + Dimensions of the box are: 2*extent. + Transformation to world space is: worldPoint = rot * localPoint + center + Transformation to local space is: localPoint = T(rot) * (worldPoint - center) + Where T(M) denotes the transpose of M. + */ +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + class PX_PHYSX_COMMON_API Box + { + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE Box() + { + } + + /** + \brief Constructor + + \param origin Center of the OBB + \param extent Extents/radii of the obb. + \param base rotation to apply to the obb. + */ + //! Construct from center, extent and rotation + PX_FORCE_INLINE Box(const PxVec3& origin, const PxVec3& extent, const PxMat33& base) : rot(base), center(origin), extents(extent) + {} + + //! Copy constructor + PX_FORCE_INLINE Box(const Box& other) : rot(other.rot), center(other.center), extents(other.extents) + {} + + /** + \brief Destructor + */ + PX_FORCE_INLINE ~Box() + { + } + + //! Assignment operator + PX_FORCE_INLINE const Box& operator=(const Box& other) + { + rot = other.rot; + center = other.center; + extents = other.extents; + return *this; + } + + /** + \brief Setups an empty box. + */ + PX_INLINE void setEmpty() + { + center = PxVec3(0); + extents = PxVec3(-PX_MAX_REAL, -PX_MAX_REAL, -PX_MAX_REAL); + rot = PxMat33(PxIdentity); + } + + /** + \brief Checks the box is valid. + + \return true if the box is valid + */ + PX_INLINE bool isValid() const + { + // Consistency condition for (Center, Extents) boxes: Extents >= 0.0f + if(extents.x < 0.0f) return false; + if(extents.y < 0.0f) return false; + if(extents.z < 0.0f) return false; + return true; + } + +///////////// + PX_FORCE_INLINE void setAxes(const PxVec3& axis0, const PxVec3& axis1, const PxVec3& axis2) + { + rot.column0 = axis0; + rot.column1 = axis1; + rot.column2 = axis2; + } + + PX_FORCE_INLINE PxVec3 rotate(const PxVec3& src) const + { + return rot * src; + } + + PX_FORCE_INLINE PxVec3 rotateInv(const PxVec3& src) const + { + return rot.transformTranspose(src); + } + + PX_FORCE_INLINE PxVec3 transform(const PxVec3& src) const + { + return rot * src + center; + } + + PX_FORCE_INLINE PxTransform getTransform() const + { + return PxTransform(center, PxQuat(rot)); + } + + PX_INLINE PxVec3 computeAABBExtent() const + { + const PxReal a00 = PxAbs(rot[0][0]); + const PxReal a01 = PxAbs(rot[0][1]); + const PxReal a02 = PxAbs(rot[0][2]); + + const PxReal a10 = PxAbs(rot[1][0]); + const PxReal a11 = PxAbs(rot[1][1]); + const PxReal a12 = PxAbs(rot[1][2]); + + const PxReal a20 = PxAbs(rot[2][0]); + const PxReal a21 = PxAbs(rot[2][1]); + const PxReal a22 = PxAbs(rot[2][2]); + + const PxReal ex = extents.x; + const PxReal ey = extents.y; + const PxReal ez = extents.z; + + return PxVec3( a00 * ex + a10 * ey + a20 * ez, + a01 * ex + a11 * ey + a21 * ez, + a02 * ex + a12 * ey + a22 * ez); + } + + /** + Computes the obb points. + \param pts [out] 8 box points + */ + PX_FORCE_INLINE void computeBoxPoints(PxVec3* PX_RESTRICT pts) const + { + Gu::computeOBBPoints(pts, center, extents, rot.column0, rot.column1, rot.column2); + } + + void create(const Gu::Capsule& capsule); + + PxMat33 rot; + PxVec3 center; + PxVec3 extents; + }; + PX_COMPILE_TIME_ASSERT(sizeof(Gu::Box) == 60); + + //! A padded version of Gu::Box, to safely load its data using SIMD + class BoxPadded : public Box + { + public: + PX_FORCE_INLINE BoxPadded() {} + PX_FORCE_INLINE ~BoxPadded() {} + PxU32 padding; + }; + PX_COMPILE_TIME_ASSERT(sizeof(Gu::BoxPadded) == 64); + +#if PX_VC + #pragma warning(pop) +#endif + +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCachedFuncs.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCachedFuncs.h new file mode 100644 index 0000000..4c84601 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCachedFuncs.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CACHED_FUNCS_H +#define GU_CACHED_FUNCS_H + +#include "GuRaycastTests.h" +#include "GuSweepTests.h" +#include "GuOverlapTests.h" + +namespace physx +{ +namespace Gu +{ + struct CachedFuncs + { + CachedFuncs() : + mCachedRaycastFuncs (Gu::getRaycastFuncTable()), + mCachedSweepFuncs (Gu::getSweepFuncTable()), + mCachedOverlapFuncs (Gu::getOverlapFuncTable()) + { + } + + const Gu::GeomRaycastTable& mCachedRaycastFuncs; + const Gu::GeomSweepFuncs& mCachedSweepFuncs; + const Gu::GeomOverlapTable* mCachedOverlapFuncs; + + PX_NOCOPY(CachedFuncs) + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCapsule.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCapsule.h new file mode 100644 index 0000000..3742eb1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCapsule.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CAPSULE_H +#define GU_CAPSULE_H + +/** \addtogroup geomutils +@{ +*/ + +#include "GuSegment.h" + +namespace physx +{ +namespace Gu +{ + +/** +\brief Represents a capsule. +*/ + class Capsule : public Segment + { + public: + /** + \brief Constructor + */ + PX_INLINE Capsule() + { + } + + /** + \brief Constructor + + \param seg Line segment to create capsule from. + \param _radius Radius of the capsule. + */ + PX_INLINE Capsule(const Segment& seg, PxF32 _radius) : Segment(seg), radius(_radius) + { + } + + /** + \brief Constructor + + \param _p0 First segment point + \param _p1 Second segment point + \param _radius Radius of the capsule. + */ + PX_INLINE Capsule(const PxVec3& _p0, const PxVec3& _p1, PxF32 _radius) : Segment(_p0, _p1), radius(_radius) + { + } + + /** + \brief Destructor + */ + PX_INLINE ~Capsule() + { + } + + PxF32 radius; + }; +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCenterExtents.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCenterExtents.h new file mode 100644 index 0000000..29ca0e1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCenterExtents.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CENTER_EXTENTS_H +#define GU_CENTER_EXTENTS_H + +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBounds3.h" + +namespace physx +{ +namespace Gu +{ + class CenterExtents : public physx::PxUserAllocated + { + public: + PX_FORCE_INLINE CenterExtents() {} + PX_FORCE_INLINE CenterExtents(const PxBounds3& b) { mCenter = b.getCenter(); mExtents = b.getExtents(); } + PX_FORCE_INLINE ~CenterExtents() {} + + PX_FORCE_INLINE void getMin(PxVec3& min) const { min = mCenter - mExtents; } + PX_FORCE_INLINE void getMax(PxVec3& max) const { max = mCenter + mExtents; } + + PX_FORCE_INLINE float getMin(PxU32 axis) const { return mCenter[axis] - mExtents[axis]; } + PX_FORCE_INLINE float getMax(PxU32 axis) const { return mCenter[axis] + mExtents[axis]; } + + PX_FORCE_INLINE PxVec3 getMin() const { return mCenter - mExtents; } + PX_FORCE_INLINE PxVec3 getMax() const { return mCenter + mExtents; } + + PX_FORCE_INLINE void setMinMax(const PxVec3& min, const PxVec3& max) + { + mCenter = (max + min)*0.5f; + mExtents = (max - min)*0.5f; + } + + PX_FORCE_INLINE PxU32 isInside(const CenterExtents& box) const + { + if(box.getMin(0)>getMin(0)) return 0; + if(box.getMin(1)>getMin(1)) return 0; + if(box.getMin(2)>getMin(2)) return 0; + if(box.getMax(0)= 0.0f) && (e.y >= 0.0f) && (e.z >= 0.0f)) || + ((e.x == -PX_MAX_BOUNDS_EXTENTS) && + (e.y == -PX_MAX_BOUNDS_EXTENTS) && + (e.z == -PX_MAX_BOUNDS_EXTENTS)))); + } + + PX_FORCE_INLINE PxBounds3 transformFast(const PxMat33& matrix) const + { + PX_ASSERT(isValid()); + return PxBounds3::basisExtent(matrix * mCenter, matrix, mExtents); + } + + PxVec3 mCenter; + PxVec3 mExtents; + }; + + //! A padded version of CenterExtents, to safely load its data using SIMD + class CenterExtentsPadded : public CenterExtents + { + public: + PX_FORCE_INLINE CenterExtentsPadded() {} + PX_FORCE_INLINE ~CenterExtentsPadded() {} + PxU32 padding; + }; + PX_COMPILE_TIME_ASSERT(sizeof(CenterExtentsPadded) == 7*4); + +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCooking.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCooking.h new file mode 100644 index 0000000..cae8458 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuCooking.h @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_H +#define GU_COOKING_H +/** \addtogroup geomutils +@{ +*/ + +// PT: TODO: the SDK always had this questionable design decision that all APIs can include all high-level public headers, +// regardless of where they fit in the header hierarchy. For example PhysXCommon can include headers from the higher-level +// PhysX DLL. We take advantage of that here by including PxCooking from PhysXCommon. That way we can reuse the same code +// as before without decoupling it from high-level classes like PxConvexMeshDesc/etc. A cleaner solution would be to decouple +// the two and only use PxConvexMeshDesc/etc in the higher level cooking DLL. The lower-level Gu functions below would then +// operate either on Gu-level types (see e.g. PxBVH / GuBVH which was done this way), or on basic types like float and ints +// to pass vertex & triangle data around. We could also split the kitchen-sink PxCookingParams structure into separate classes +// for convex / triangle mesh / etc. Overall there might be some more refactoring to do here, and that's why these functions +// have been put in the "semi public" Gu API for now, instead of the Px API (which is more strict in terms of backward +// compatibility and how we deal with deprecated functions). +#include "cooking/PxCooking.h" + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxMemory.h" + +namespace physx +{ + class PxInsertionCallback; + class PxOutputStream; + class PxBVHDesc; + class PxBVH; + class PxHeightField; + struct PxCookingParams; + + namespace immediateCooking + { + PX_FORCE_INLINE static void gatherStrided(const void* src, void* dst, PxU32 nbElem, PxU32 elemSize, PxU32 stride) + { + const PxU8* s = reinterpret_cast(src); + PxU8* d = reinterpret_cast(dst); + while(nbElem--) + { + PxMemCopy(d, s, elemSize); + d += elemSize; + s += stride; + } + } + + PX_INLINE static bool platformMismatch() + { + // Get current endianness (the one for the platform where cooking is performed) + const PxI8 currentEndian = PxLittleEndian(); + + const bool mismatch = currentEndian!=1; // The files must be little endian - we don't have big endian platforms anymore. + return mismatch; + } + + PX_C_EXPORT PX_PHYSX_COMMON_API PxInsertionCallback* getInsertionCallback(); // PT: should be a reference but using a pointer for C + + // BVH + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookBVH(const PxBVHDesc& desc, PxOutputStream& stream); + PX_C_EXPORT PX_PHYSX_COMMON_API PxBVH* createBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback); + + PX_FORCE_INLINE PxBVH* createBVH(const PxBVHDesc& desc) + { + return createBVH(desc, *getInsertionCallback()); + } + + // Heightfield + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream); + PX_C_EXPORT PX_PHYSX_COMMON_API PxHeightField* createHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback); + + PX_FORCE_INLINE PxHeightField* createHeightField(const PxHeightFieldDesc& desc) + { + return createHeightField(desc, *getInsertionCallback()); + } + + // Convex meshes + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition=NULL); + PX_C_EXPORT PX_PHYSX_COMMON_API PxConvexMesh* createConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition=NULL); + + PX_FORCE_INLINE PxConvexMesh* createConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc) + { + return createConvexMesh(params, desc, *getInsertionCallback()); + } + + PX_C_EXPORT PX_PHYSX_COMMON_API bool validateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc); + PX_C_EXPORT PX_PHYSX_COMMON_API bool computeHullPolygons(const PxCookingParams& params, const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices, + PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons); + + // Triangle meshes + PX_C_EXPORT PX_PHYSX_COMMON_API bool validateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc); + PX_C_EXPORT PX_PHYSX_COMMON_API PxTriangleMesh* createTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition=NULL); + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition=NULL); + + PX_FORCE_INLINE PxTriangleMesh* createTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc) + { + return createTriangleMesh(params, desc, *getInsertionCallback()); + } + + // Tetrahedron & soft body meshes + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream); + PX_C_EXPORT PX_PHYSX_COMMON_API PxTetrahedronMesh* createTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback); + + PX_FORCE_INLINE PxTetrahedronMesh* createTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc) + { + return createTetrahedronMesh(params, meshDesc, *getInsertionCallback()); + } + + PX_C_EXPORT PX_PHYSX_COMMON_API bool cookSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream); + + PX_C_EXPORT PX_PHYSX_COMMON_API PxSoftBodyMesh* createSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback); + + PX_FORCE_INLINE PxSoftBodyMesh* createSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc) + { + return createSoftBodyMesh(params, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, *getInsertionCallback()); + } + + PX_C_EXPORT PX_PHYSX_COMMON_API PxCollisionMeshMappingData* computeModelsMapping(const PxCookingParams& params, PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, + const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet = NULL); + + PX_C_EXPORT PX_PHYSX_COMMON_API PxCollisionTetrahedronMeshData* computeCollisionData(const PxCookingParams& params, const PxTetrahedronMeshDesc& collisionMeshDesc); + + PX_C_EXPORT PX_PHYSX_COMMON_API PxSimulationTetrahedronMeshData* computeSimulationData(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc); + + PX_C_EXPORT PX_PHYSX_COMMON_API PxSoftBodyMesh* assembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, + PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback); + + PX_C_EXPORT PX_PHYSX_COMMON_API PxSoftBodyMesh* assembleSoftBodyMesh_Sim(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, + PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback); + } +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTetrahedron.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTetrahedron.h new file mode 100644 index 0000000..32786ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTetrahedron.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_TETRAHEDRON_H +#define GU_DISTANCE_POINT_TETRAHEDRON_H + +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "common/PxPhysXCommonConfig.h" +#include "GuDistancePointTriangle.h" +#include "foundation/PxMathUtils.h" + +namespace physx +{ + namespace Gu + { + PX_PHYSX_COMMON_API PxVec4 PointOutsideOfPlane4(const PxVec3& p, const PxVec3& _a, const PxVec3& _b, + const PxVec3& _c, const PxVec3& _d); + + PX_PHYSX_COMMON_API PxVec3 closestPtPointTetrahedron(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec4& result); + + PX_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTetrahedron(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d) + { + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 ad = d - a; + const PxVec3 bc = c - b; + const PxVec3 bd = d - b; + + //point to face 0, 1, 2 + PxVec3 bestClosestPt = closestPtPointTriangle2(p, a, b, c, ab, ac); + PxVec3 diff = bestClosestPt - p; + PxReal bestSqDist = diff.dot(diff); + + // 0, 2, 3 + PxVec3 closestPt = closestPtPointTriangle2(p, a, c, d, ac, ad); + diff = closestPt - p; + PxReal sqDist = diff.dot(diff); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + // 0, 3, 1 + closestPt = closestPtPointTriangle2(p, a, d, b, ad, ab); + diff = closestPt - p; + sqDist = diff.dot(diff); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + // 1, 3, 2 + closestPt = closestPtPointTriangle2(p, b, d, c, bd, bc); + diff = closestPt - p; + sqDist = diff.dot(diff); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + return bestClosestPt; + } + + PX_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTetrahedronWithInsideCheck(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxReal eps = 0) + { + PxVec4 tmpBarycentric; + computeBarycentric(a, b, c, d, p, tmpBarycentric); + if ((tmpBarycentric.x >= -eps && tmpBarycentric.x <= 1.f + eps) && (tmpBarycentric.y >= -eps && tmpBarycentric.y <= 1.f + eps) && + (tmpBarycentric.z >= -eps && tmpBarycentric.z <= 1.f + eps) && (tmpBarycentric.w >= -eps && tmpBarycentric.w <= 1.f + eps)) + return p; + return closestPtPointTetrahedron(p, a, b, c, d); + } + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTriangle.h new file mode 100644 index 0000000..8dd3123 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistancePointTriangle.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_TRIANGLE_H +#define GU_DISTANCE_POINT_TRIANGLE_H + +#include "foundation/PxVec3.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + // PT: special version: + // - inlined + // - doesn't compute (s,t) output params + // - expects precomputed edges in input + PX_FORCE_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTriangle2(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& ab, const PxVec3& ac) + { + // Check if P in vertex region outside A + //const PxVec3 ab = b - a; + //const PxVec3 ac = c - a; + const PxVec3 ap = p - a; + const float d1 = ab.dot(ap); + const float d2 = ac.dot(ap); + if(d1<=0.0f && d2<=0.0f) + return a; // Barycentric coords 1,0,0 + + // Check if P in vertex region outside B + const PxVec3 bp = p - b; + const float d3 = ab.dot(bp); + const float d4 = ac.dot(bp); + if(d3>=0.0f && d4<=d3) + return b; // Barycentric coords 0,1,0 + + // Check if P in edge region of AB, if so return projection of P onto AB + const float vc = d1*d4 - d3*d2; + if(vc<=0.0f && d1>=0.0f && d3<=0.0f) + { + const float v = d1 / (d1 - d3); + return a + v * ab; // barycentric coords (1-v, v, 0) + } + + // Check if P in vertex region outside C + const PxVec3 cp = p - c; + const float d5 = ab.dot(cp); + const float d6 = ac.dot(cp); + if(d6>=0.0f && d5<=d6) + return c; // Barycentric coords 0,0,1 + + // Check if P in edge region of AC, if so return projection of P onto AC + const float vb = d5*d2 - d1*d6; + if(vb<=0.0f && d2>=0.0f && d6<=0.0f) + { + const float w = d2 / (d2 - d6); + return a + w * ac; // barycentric coords (1-w, 0, w) + } + + // Check if P in edge region of BC, if so return projection of P onto BC + const float va = d3*d6 - d5*d4; + if(va<=0.0f && (d4-d3)>=0.0f && (d5-d6)>=0.0f) + { + const float w = (d4-d3) / ((d4 - d3) + (d5-d6)); + return b + w * (c-b); // barycentric coords (0, 1-w, w) + } + + // P inside face region. Compute Q through its barycentric coords (u,v,w) + const float denom = 1.0f / (va + vb + vc); + const float v = vb * denom; + const float w = vc * denom; + return a + ab*v + ac*w; + } + + PX_PHYSX_COMMON_API PxVec3 closestPtPointTriangle(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, float& s, float& t); + + PX_FORCE_INLINE PxReal distancePointTriangleSquared(const PxVec3& point, + const PxVec3& triangleOrigin, + const PxVec3& triangleEdge0, + const PxVec3& triangleEdge1, + PxReal* param0=NULL, + PxReal* param1=NULL) + { + const PxVec3 pt0 = triangleEdge0 + triangleOrigin; + const PxVec3 pt1 = triangleEdge1 + triangleOrigin; + float s,t; + const PxVec3 cp = closestPtPointTriangle(point, triangleOrigin, pt0, pt1, s, t); + if(param0) + *param0 = s; + if(param1) + *param1 = t; + return (cp - point).magnitudeSquared(); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentBox.h new file mode 100644 index 0000000..19a462a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentBox.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_SEGMENT_BOX_H +#define GU_DISTANCE_SEGMENT_BOX_H + +#include "foundation/PxMat33.h" +#include "GuSegment.h" +#include "GuBox.h" + +namespace physx +{ +namespace Gu +{ + + //! Compute the smallest distance from the (finite) line segment to the box. + PX_PHYSX_COMMON_API PxReal distanceSegmentBoxSquared( const PxVec3& segmentPoint0, const PxVec3& segmentPoint1, + const PxVec3& boxOrigin, const PxVec3& boxExtent, const PxMat33& boxBase, + PxReal* segmentParam = NULL, + PxVec3* boxParam = NULL); + + PX_FORCE_INLINE PxReal distanceSegmentBoxSquared(const Gu::Segment& segment, const Gu::Box& box, PxReal* t = NULL, PxVec3* p = NULL) + { + return distanceSegmentBoxSquared(segment.p0, segment.p1, box.center, box.extents, box.rot, t, p); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentSegment.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentSegment.h new file mode 100644 index 0000000..f70d709 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuDistanceSegmentSegment.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_SEGMENT_SEGMENT_H +#define GU_DISTANCE_SEGMENT_SEGMENT_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuSegment.h" + +namespace physx +{ +namespace Gu +{ + // This version fixes accuracy issues (e.g. TTP 4617), but needs to do 2 square roots in order + // to find the normalized direction and length of the segments, and then + // a division in order to renormalize the output + + PX_PHYSX_COMMON_API PxReal distanceSegmentSegmentSquared( const PxVec3& origin0, const PxVec3& dir0, PxReal extent0, + const PxVec3& origin1, const PxVec3& dir1, PxReal extent1, + PxReal* s=NULL, PxReal* t=NULL); + + PX_PHYSX_COMMON_API PxReal distanceSegmentSegmentSquared( const PxVec3& origin0, const PxVec3& extent0, + const PxVec3& origin1, const PxVec3& extent1, + PxReal* s=NULL, PxReal* t=NULL); + + PX_FORCE_INLINE PxReal distanceSegmentSegmentSquared( const Gu::Segment& segment0, + const Gu::Segment& segment1, + PxReal* s=NULL, PxReal* t=NULL) + { + return distanceSegmentSegmentSquared( segment0.p0, segment0.computeDirection(), + segment1.p0, segment1.computeDirection(), + s, t); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuFactory.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuFactory.h new file mode 100644 index 0000000..f323aae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuFactory.h @@ -0,0 +1,48 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_FACTORY_H +#define GU_FACTORY_H + +#include "foundation/PxSimpleTypes.h" +#include "common/PxPhysXCommonConfig.h" +#include "GuPrunerTypedef.h" + +namespace physx +{ +namespace Gu +{ + class Pruner; + + PX_C_EXPORT PX_PHYSX_COMMON_API Gu::Pruner* createBucketPruner(PxU64 contextID); + PX_C_EXPORT PX_PHYSX_COMMON_API Gu::Pruner* createAABBPruner(PxU64 contextID, bool dynamic, Gu::CompanionPrunerType type, Gu::BVHBuildStrategy buildStrategy, PxU32 nbObjectsPerNode); + PX_C_EXPORT PX_PHYSX_COMMON_API Gu::Pruner* createIncrementalPruner(PxU64 contextID); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionBoxBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionBoxBox.h new file mode 100644 index 0000000..d4fb33a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionBoxBox.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_BOX_BOX_H +#define GU_INTERSECTION_BOX_BOX_H + +#include "foundation/PxMat33.h" +#include "foundation/PxBounds3.h" +#include "GuBox.h" + +namespace physx +{ +namespace Gu +{ + PX_PHYSX_COMMON_API bool intersectOBBOBB(const PxVec3& e0, const PxVec3& c0, const PxMat33& r0, const PxVec3& e1, const PxVec3& c1, const PxMat33& r1, bool full_test); + + PX_FORCE_INLINE bool intersectOBBAABB(const Gu::Box& obb, const PxBounds3& aabb) + { + PxVec3 center = aabb.getCenter(); + PxVec3 extents = aabb.getExtents(); + return intersectOBBOBB(obb.extents, obb.center, obb.rot, extents, center, PxMat33(PxIdentity), true); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTetrahedronBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTetrahedronBox.h new file mode 100644 index 0000000..c9566b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTetrahedronBox.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_TETRAHEDRON_BOX_H +#define GU_INTERSECTION_TETRAHEDRON_BOX_H + +#include "foundation/PxVec3.h" +#include "foundation/PxBounds3.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + class Box; + class BoxPadded; + + /** + Tests if a tetrahedron overlaps a box (AABB). + + \param a [in] tetrahedron's first point + \param b [in] tetrahedron's second point + \param c [in] tetrahedron's third point + \param d [in] tetrahedron's fourth point + \param box [in] The axis aligned box box to check for overlap + \return true if tetrahedron overlaps box + */ + PX_PHYSX_COMMON_API bool intersectTetrahedronBox(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxBounds3& box); + + +} // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBox.h new file mode 100644 index 0000000..04e1bbc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBox.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_TRIANGLE_BOX_H +#define GU_INTERSECTION_TRIANGLE_BOX_H + +#include "foundation/PxMat33.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + class Box; + class BoxPadded; + + /** + Tests if a triangle overlaps a box (AABB). This is the reference non-SIMD code. + + \param center [in] the box center + \param extents [in] the box extents + \param p0 [in] triangle's first point + \param p1 [in] triangle's second point + \param p2 [in] triangle's third point + \return true if triangle overlaps box + */ + PX_PHYSX_COMMON_API PxIntBool intersectTriangleBox_ReferenceCode(const PxVec3& center, const PxVec3& extents, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2); + + /** + Tests if a triangle overlaps a box (AABB). This is the optimized SIMD code. + + WARNING: the function has various SIMD requirements, left to the calling code: + - function will load 4 bytes after 'center'. Make sure it's safe to load from there. + - function will load 4 bytes after 'extents'. Make sure it's safe to load from there. + - function will load 4 bytes after 'p0'. Make sure it's safe to load from there. + - function will load 4 bytes after 'p1'. Make sure it's safe to load from there. + - function will load 4 bytes after 'p2'. Make sure it's safe to load from there. + If you can't guarantee these requirements, please use the non-SIMD reference code instead. + + \param center [in] the box center. + \param extents [in] the box extents + \param p0 [in] triangle's first point + \param p1 [in] triangle's second point + \param p2 [in] triangle's third point + \return true if triangle overlaps box + */ + PX_PHYSX_COMMON_API PxIntBool intersectTriangleBox_Unsafe(const PxVec3& center, const PxVec3& extents, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2); + + /** + Tests if a triangle overlaps a box (OBB). + + There are currently no SIMD-related requirements for p0, p1, p2. + + \param box [in] the box + \param p0 [in] triangle's first point + \param p1 [in] triangle's second point + \param p2 [in] triangle's third point + \return true if triangle overlaps box + */ + PX_PHYSX_COMMON_API PxIntBool intersectTriangleBox(const BoxPadded& box, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2); +} // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBoxRef.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBoxRef.h new file mode 100644 index 0000000..acabce6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleBoxRef.h @@ -0,0 +1,263 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_TRIANGLE_BOX_REF_H +#define GU_INTERSECTION_TRIANGLE_BOX_REF_H + +#include "foundation/PxVec3.h" + +/********************************************************/ +/* AABB-triangle overlap test code */ +/* by Tomas Akenine-M?r */ +/* Function: int triBoxOverlap(float boxcenter[3], */ +/* float boxhalfsize[3],float triverts[3][3]); */ +/* History: */ +/* 2001-03-05: released the code in its first version */ +/* 2001-06-18: changed the order of the tests, faster */ +/* */ +/* Acknowledgement: Many thanks to Pierre Terdiman for */ +/* suggestions and discussions on how to optimize code. */ +/* Thanks to David Hunt for finding a ">="-bug! */ +/********************************************************/ + +namespace physx +{ + +#define CROSS(dest,v1,v2) \ + dest.x=v1.y*v2.z-v1.z*v2.y; \ + dest.y=v1.z*v2.x-v1.x*v2.z; \ + dest.z=v1.x*v2.y-v1.y*v2.x; + +#define DOT(v1,v2) (v1.x*v2.x+v1.y*v2.y+v1.z*v2.z) + +#define FINDMINMAX(x0, x1, x2, minimum, maximum) \ + minimum = physx::intrinsics::selectMin(x0, x1); \ + maximum = physx::intrinsics::selectMax(x0, x1); \ + minimum = physx::intrinsics::selectMin(minimum, x2); \ + maximum = physx::intrinsics::selectMax(maximum, x2); + + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxIntBool planeBoxOverlap(const PxVec3& normal, PxReal d, const PxVec3& maxbox) + { + PxVec3 vmin, vmax; + + if (normal.x>0.0f) + { + vmin.x = -maxbox.x; + vmax.x = maxbox.x; + } + else + { + vmin.x = maxbox.x; + vmax.x = -maxbox.x; + } + + if (normal.y>0.0f) + { + vmin.y = -maxbox.y; + vmax.y = maxbox.y; + } + else + { + vmin.y = maxbox.y; + vmax.y = -maxbox.y; + } + + if (normal.z>0.0f) + { + vmin.z = -maxbox.z; + vmax.z = maxbox.z; + } + else + { + vmin.z = maxbox.z; + vmax.z = -maxbox.z; + } + + if(normal.dot(vmin) + d > 0.0f) + return PxIntFalse; + if(normal.dot(vmax) + d >= 0.0f) + return PxIntTrue; + return PxIntFalse; + } + + /*======================== X-tests ========================*/ +#define AXISTEST_X01(a, b, fa, fb) \ + p0 = a*v0.y - b*v0.z; \ + p2 = a*v2.y - b*v2.z; \ + minimum = physx::intrinsics::selectMin(p0, p2); \ + maximum = physx::intrinsics::selectMax(p0, p2); \ + rad = fa * extents.y + fb * extents.z; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + +#define AXISTEST_X2(a, b, fa, fb) \ + p0 = a*v0.y - b*v0.z; \ + p1 = a*v1.y - b*v1.z; \ + minimum = physx::intrinsics::selectMin(p0, p1); \ + maximum = physx::intrinsics::selectMax(p0, p1); \ + rad = fa * extents.y + fb * extents.z; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + + /*======================== Y-tests ========================*/ +#define AXISTEST_Y02(a, b, fa, fb) \ + p0 = -a*v0.x + b*v0.z; \ + p2 = -a*v2.x + b*v2.z; \ + minimum = physx::intrinsics::selectMin(p0, p2); \ + maximum = physx::intrinsics::selectMax(p0, p2); \ + rad = fa * extents.x + fb * extents.z; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + +#define AXISTEST_Y1(a, b, fa, fb) \ + p0 = -a*v0.x + b*v0.z; \ + p1 = -a*v1.x + b*v1.z; \ + minimum = physx::intrinsics::selectMin(p0, p1); \ + maximum = physx::intrinsics::selectMax(p0, p1); \ + rad = fa * extents.x + fb * extents.z; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + + /*======================== Z-tests ========================*/ +#define AXISTEST_Z12(a, b, fa, fb) \ + p1 = a*v1.x - b*v1.y; \ + p2 = a*v2.x - b*v2.y; \ + minimum = physx::intrinsics::selectMin(p1, p2); \ + maximum = physx::intrinsics::selectMax(p1, p2); \ + rad = fa * extents.x + fb * extents.y; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + +#define AXISTEST_Z0(a, b, fa, fb) \ + p0 = a*v0.x - b*v0.y; \ + p1 = a*v1.x - b*v1.y; \ + minimum = physx::intrinsics::selectMin(p0, p1); \ + maximum = physx::intrinsics::selectMax(p0, p1); \ + rad = fa * extents.x + fb * extents.y; \ + if(minimum>rad || maximum<-rad) return PxIntFalse; + + namespace Gu + { + template + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxIntBool intersectTriangleBox_RefImpl(const PxVec3& boxcenter, const PxVec3& extents, const PxVec3& tp0, const PxVec3& tp1, const PxVec3& tp2) + { + /* use separating axis theorem to test overlap between triangle and box */ + /* need to test for overlap in these directions: */ + /* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */ + /* we do not even need to test these) */ + /* 2) normal of the triangle */ + /* 3) crossproduct(edge from tri, {x,y,z}-directin) */ + /* this gives 3x3=9 more tests */ + + // This is the fastest branch on Sun - move everything so that the boxcenter is in (0,0,0) + const PxVec3 v0 = tp0 - boxcenter; + const PxVec3 v1 = tp1 - boxcenter; + const PxVec3 v2 = tp2 - boxcenter; + + if (bDoVertexChecks) + { + if (PxAbs(v0.x) <= extents.x && PxAbs(v0.y) <= extents.y && PxAbs(v0.z) <= extents.z) + return PxIntTrue; + if (PxAbs(v1.x) <= extents.x && PxAbs(v1.y) <= extents.y && PxAbs(v1.z) <= extents.z) + return PxIntTrue; + if (PxAbs(v2.x) <= extents.x && PxAbs(v2.y) <= extents.y && PxAbs(v2.z) <= extents.z) + return PxIntTrue; + } + + // compute triangle edges + const PxVec3 e0 = v1 - v0; // tri edge 0 + const PxVec3 e1 = v2 - v1; // tri edge 1 + const PxVec3 e2 = v0 - v2; // tri edge 2 + + float minimum, maximum, rad, p0, p1, p2; + + // Bullet 3: test the 9 tests first (this was faster) + float fex = PxAbs(e0.x); + float fey = PxAbs(e0.y); + float fez = PxAbs(e0.z); + AXISTEST_X01(e0.z, e0.y, fez, fey); + AXISTEST_Y02(e0.z, e0.x, fez, fex); + AXISTEST_Z12(e0.y, e0.x, fey, fex); + + fex = PxAbs(e1.x); + fey = PxAbs(e1.y); + fez = PxAbs(e1.z); + AXISTEST_X01(e1.z, e1.y, fez, fey); + AXISTEST_Y02(e1.z, e1.x, fez, fex); + AXISTEST_Z0(e1.y, e1.x, fey, fex); + + fex = PxAbs(e2.x); + fey = PxAbs(e2.y); + fez = PxAbs(e2.z); + AXISTEST_X2(e2.z, e2.y, fez, fey); + AXISTEST_Y1(e2.z, e2.x, fez, fex); + AXISTEST_Z12(e2.y, e2.x, fey, fex); + + // Bullet 1: + // first test overlap in the {x,y,z}-directions + // find minimum, maximum of the triangle each direction, and test for overlap in + // that direction -- this is equivalent to testing a minimal AABB around + // the triangle against the AABB + + // test in X-direction + FINDMINMAX(v0.x, v1.x, v2.x, minimum, maximum); + if(minimum>extents.x || maximum<-extents.x) + return PxIntFalse; + + // test in Y-direction + FINDMINMAX(v0.y, v1.y, v2.y, minimum, maximum); + if(minimum>extents.y || maximum<-extents.y) + return PxIntFalse; + + // test in Z-direction + FINDMINMAX(v0.z, v1.z, v2.z, minimum, maximum); + if(minimum>extents.z || maximum<-extents.z) + return PxIntFalse; + + // Bullet 2: + // test if the box intersects the plane of the triangle + // compute plane equation of triangle: normal*x+d=0 + PxVec3 normal; + CROSS(normal, e0, e1); + const float d = -DOT(normal, v0); // plane eq: normal.x+d=0 + if(!planeBoxOverlap(normal, d, extents)) + return PxIntFalse; + + return PxIntTrue; // box and triangle overlaps + } + } + +#undef CROSS +#undef DOT +#undef FINDMINMAX +#undef AXISTEST_X01 +#undef AXISTEST_X2 +#undef AXISTEST_Y02 +#undef AXISTEST_Y1 +#undef AXISTEST_Z12 +#undef AXISTEST_Z0 + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleTriangle.h new file mode 100644 index 0000000..7acc01c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuIntersectionTriangleTriangle.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_TRIANGLE_TRIANGLE_H +#define GU_INTERSECTION_TRIANGLE_TRIANGLE_H + +#include "GuSegment.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + /** + Tests if a two triangles intersect + + \param a1 [in] Fist point of the first triangle + \param b1 [in] Second point of the first triangle + \param c1 [in] Third point of the first triangle + \param a2 [in] Fist point of the second triangle + \param b2 [in] Second point of the second triangle + \param c2 [in] Third point of the second triangle + \param intersection [out] Line segment that represents all points that lie on the first and the second triangle + \return true if triangles intersect + */ + PX_PHYSX_COMMON_API bool trianglesIntersect(const PxVec3& a1, const PxVec3& b1, const PxVec3& c1, const PxVec3& a2, const PxVec3& b2, const PxVec3& c2, Segment* intersection = NULL); +} // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuOverlapTests.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuOverlapTests.h new file mode 100644 index 0000000..ae1d176 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuOverlapTests.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_OVERLAP_TESTS_H +#define GU_OVERLAP_TESTS_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxAssert.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundation.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" + +namespace physx +{ +namespace Gu +{ + class Capsule; + class Sphere; + + // PT: this is just a shadow of what it used to be. We currently don't use TRIGGER_INSIDE anymore, but I leave it for now, + // since I really want to put this back the way it was before. + enum TriggerStatus + { + TRIGGER_DISJOINT, + TRIGGER_INSIDE, + TRIGGER_OVERLAP + }; + + // PT: currently only used for convex triggers + struct TriggerCache + { + PxVec3 dir; + PxU16 state; + PxU16 gjkState; //gjk succeed or fail + }; + + #define UNUSED_OVERLAP_THREAD_CONTEXT NULL + + // PT: we use a define to be able to quickly change the signature of all overlap functions. + // (this also ensures they all use consistent names for passed parameters). + // \param[in] geom0 first geometry object + // \param[in] pose0 pose of first geometry object + // \param[in] geom1 second geometry object + // \param[in] pose1 pose of second geometry object + // \param[in] cache optional cached data for triggers + // \param[in] threadContext optional per-thread context + #define GU_OVERLAP_FUNC_PARAMS const PxGeometry& geom0, const PxTransform& pose0, \ + const PxGeometry& geom1, const PxTransform& pose1, \ + Gu::TriggerCache* cache, PxOverlapThreadContext* threadContext + + // PT: function pointer for Geom-indexed overlap functions + // See GU_OVERLAP_FUNC_PARAMS for function parameters details. + // \return true if an overlap was found, false otherwise + typedef bool (*GeomOverlapFunc) (GU_OVERLAP_FUNC_PARAMS); + + // PT: typedef for a bundle of all overlap functions, i.e. the function table itself (indexed by geom-type). + typedef GeomOverlapFunc GeomOverlapTable[PxGeometryType::eGEOMETRY_COUNT]; + + // PT: retrieves the overlap function table (for access by external non-Gu modules) + PX_PHYSX_COMMON_API const GeomOverlapTable* getOverlapFuncTable(); + + // dynamic registration of height fields + PX_PHYSX_COMMON_API void registerHeightFields(); + + PX_FORCE_INLINE bool overlap( const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + const GeomOverlapTable* PX_RESTRICT overlapFuncs, PxOverlapThreadContext* threadContext) + { + PX_CHECK_AND_RETURN_VAL(pose0.isValid(), "Gu::overlap(): pose0 is not valid.", false); + PX_CHECK_AND_RETURN_VAL(pose1.isValid(), "Gu::overlap(): pose1 is not valid.", false); + + if(geom0.getType() > geom1.getType()) + { + GeomOverlapFunc overlapFunc = overlapFuncs[geom1.getType()][geom0.getType()]; + PX_ASSERT(overlapFunc); + return overlapFunc(geom1, pose1, geom0, pose0, NULL, threadContext); + } + else + { + GeomOverlapFunc overlapFunc = overlapFuncs[geom0.getType()][geom1.getType()]; + PX_ASSERT(overlapFunc); + return overlapFunc(geom0, pose0, geom1, pose1, NULL, threadContext); + } + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPruner.h new file mode 100644 index 0000000..42bccaa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPruner.h @@ -0,0 +1,227 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PRUNER_H +#define GU_PRUNER_H + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxTransform.h" +#include "GuPrunerPayload.h" +#include "GuPrunerTypedef.h" + +namespace physx +{ + class PxRenderOutput; + class PxBounds3; + +namespace Gu +{ + class ShapeData; + + struct PrunerRaycastCallback + { + PrunerRaycastCallback() {} + virtual ~PrunerRaycastCallback() {} + + virtual bool invoke(PxReal& distance, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) = 0; + }; + + struct PrunerOverlapCallback + { + PrunerOverlapCallback() {} + virtual ~PrunerOverlapCallback() {} + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) = 0; + }; + + class BasePruner : public PxUserAllocated + { + public: + BasePruner() {} + virtual ~BasePruner() {} + + // shift the origin of the pruner objects + virtual void shiftOrigin(const PxVec3& shift) = 0; + + // additional 'internal' interface + virtual void visualize(PxRenderOutput&, PxU32, PxU32) const {} + }; + + class Pruner : public BasePruner + { + public: + Pruner() {} + virtual ~Pruner() {} + + /** + \brief Adds objects to the pruner. + + \param[out] results Returned handles for added objects + \param[in] bounds Bounds of added objects. These bounds are used as-is so they should be pre-inflated if inflation is needed. + \param[in] data Payloads for added objects. + \param[in] transforms Transforms of added objects. + \param[in] count Number of objects in the arrays + \param[in] hasPruningStructure True if added objects have pruning structure. The structure will be merged later, adding the objects will not invalidate the pruner. + + \return true if success, false if internal allocation failed. The first failing add results in a INVALID_PRUNERHANDLE. + + @see PxPruningStructure + */ + virtual bool addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count, bool hasPruningStructure) = 0; + + /** + \brief Removes objects from the pruner. + + \param[in] handles The objects to remove + \param[in] count The number of objects to remove + \param[in] removalCallback Optional callback, called for each removed object (giving access to its payload for keeping external structures in sync) + */ + virtual void removeObjects(const PrunerHandle* handles, PxU32 count, PrunerPayloadRemovalCallback* removalCallback) = 0; + + /** + \brief Updates objects with new bounds & transforms. + + There are two ways to use this function: + + 1) manual bounds update: you can manually update the bounds via "getPayloadData" calls prior to calling "updateObjects". + In this case "updateObjects" only notifies the system that the data for these objects has changed. In this mode the + "inflation", "boundsIndices", "newBounds" and "newTransforms" parameters should remain null. + + 2) synchronization mode: in this case the new bounds (and optionally the new transforms) have been computed by an + external source and "updateObjects" tells the system to update its data from passed buffers. The new bounds are + always inflated by the "inflation" parameter while being copied. "boundsIndices" is an optional remap table, allowing + this call to only update a subset of the existing bounds (i.e. the updated bounds don't have to be first copied to a + separate contiguous buffer). + + \param[in] handles The objects to update + \param[in] count The number of objects to update + \param[in] inflation Bounds inflation value + \param[in] boundsIndices The indices of the bounds in the bounds array (or NULL) + \param[in] newBounds Updated bounds array (or NULL) + \param[in] newTransforms Updated transforms array (or NULL) + */ + virtual void updateObjects(const PrunerHandle* handles, PxU32 count, float inflation=0.0f, const PxU32* boundsIndices=NULL, const PxBounds3* newBounds=NULL, const PxTransform32* newTransforms=NULL) = 0; + + /** + \brief Gets rid of internal accel struct. + */ + virtual void purge() = 0; + + /** + \brief Makes the queries consistent with previous changes. + + This function must be called before starting queries on an updated Pruner and assert otherwise. + */ + virtual void commit() = 0; + + /** + \brief Merges pruning structure to current pruner, parameters may differ for each pruner implementation. + + \param[in] mergeParams Implementation-dependent merge data + */ + virtual void merge(const void* mergeParams) = 0; + + /** + * Query functions + * + * Note: return value may disappear if PrunerCallback contains the necessary information + * currently it is still used for the dynamic pruner internally (to decide if added objects must be queried) + */ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const = 0; + virtual bool overlap(const Gu::ShapeData& queryVolume, PrunerOverlapCallback&) const = 0; + virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const = 0; + + /** + \brief Retrieves the object's payload and data associated with the handle. + + This function returns the payload associated with a given handle. Additionally it can return the + destination addresses for the object's bounds & transform. The user can then write the new bounds + and transform there, before eventually calling updateObjects(). + + \param[in] handle Object handle (initially returned by addObjects()) + \param[out] data Optional location where to store the internal data associated with the payload. + + \return The payload associated with the given handle. + */ + virtual const PrunerPayload& getPayloadData(PrunerHandle handle, PrunerPayloadData* data=NULL) const = 0; + + /** + \brief Preallocate space + + \param[in] nbEntries The number of entries to preallocate space for + */ + virtual void preallocate(PxU32 nbEntries) = 0; + + /** + \brief Sets object's transform + + \note This is equivalent to retrieving the transform's address with "getPayloadData" and writing + the transform there. + + \param[in] handle Object handle (initially returned by addObjects()) + \param[in] transform New transform + + \return True if success + */ + virtual bool setTransform(PrunerHandle handle, const PxTransform& transform) = 0; + + // PT: from the SQ branch, maybe temporary, unclear if a getType() function would be better etc + virtual bool isDynamic() const { return false; } + + virtual void getGlobalBounds(PxBounds3&) const = 0; + }; + + /** + * Pruner building accel structure over time base class + */ + class DynamicPruner : public Pruner + { + public: + + /** + * sets the rebuild hint rate used for step building the accel structure. + */ + virtual void setRebuildRateHint(PxU32 nbStepsForRebuild) = 0; + + /** + * Steps the accel structure build. + * synchronousCall specifies if initialization can happen. It should not initialize build when called from a different thread + * returns true if finished + */ + virtual bool buildStep(bool synchronousCall = true) = 0; + + /** + * Prepares new tree build + * returns true if new tree is needed + */ + virtual bool prepareBuild() = 0; + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerMergeData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerMergeData.h new file mode 100644 index 0000000..bba513a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerMergeData.h @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PRUNER_MERGE_DATA_H +#define GU_PRUNER_MERGE_DATA_H +/** \addtogroup physics +@{ */ + +#include "foundation/PxSimpleTypes.h" +namespace physx +{ + namespace Gu + { + struct BVHNode; + + // PT: TODO: refactor with BVHCoreData ? + struct AABBPrunerMergeData + { + AABBPrunerMergeData() + { + // PT: it's important to NOT initialize anything by default (for binary serialization) + } + + PxU32 mNbNodes; // Nb nodes in AABB tree + BVHNode* mAABBTreeNodes; // AABB tree runtime nodes + PxU32 mNbObjects; // Nb objects in AABB tree + PxU32* mAABBTreeIndices; // AABB tree indices + + void init(PxU32 nbNodes=0, BVHNode* nodes=NULL, PxU32 nbObjects=0, PxU32* indices=NULL) + { + mNbNodes = nbNodes; + mAABBTreeNodes = nodes; + mNbObjects = nbObjects; + mAABBTreeIndices = indices; + } + }; + } +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerPayload.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerPayload.h new file mode 100644 index 0000000..4d8ef3c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerPayload.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PRUNER_PAYLOAD_H +#define GU_PRUNER_PAYLOAD_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/Px.h" + +namespace physx +{ + class PxBounds3; + +namespace Gu +{ + // PT: anonymous payload structure used by the pruners. This is similar in spirit to a userData pointer. + struct PrunerPayload + { + size_t data[2]; // Enough space for two arbitrary pointers + + PX_FORCE_INLINE bool operator == (const PrunerPayload& other) const + { + return (data[0] == other.data[0]) && (data[1] == other.data[1]); + } + }; + + // PT: pointers to internal data associated with a pruner payload. The lifetime of these pointers + // is usually limited and they should be used immediately after retrieval. + struct PrunerPayloadData + { + PxBounds3* mBounds; // Pointer to internal bounds. + PxTransform* mTransform; // Pointer to internal transform, or NULL. + }; + + // PT: called for each removed payload. Gives users a chance to cleanup their data + // structures without duplicating the pruner-data to payload mapping on their side. + struct PrunerPayloadRemovalCallback + { + PrunerPayloadRemovalCallback() {} + virtual ~PrunerPayloadRemovalCallback() {} + + virtual void invoke(PxU32 nbRemoved, const PrunerPayload* removed) = 0; + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerTypedef.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerTypedef.h new file mode 100644 index 0000000..0b2194d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuPrunerTypedef.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PRUNER_TYPEDEF_H +#define GU_PRUNER_TYPEDEF_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ + namespace Gu + { + typedef PxU32 PrunerHandle; + static const PrunerHandle INVALID_PRUNERHANDLE = 0xffffffff; + + typedef PxU32 PoolIndex; + static const PxU32 INVALID_POOL_ID = 0xffffffff; + + typedef PxU32 TreeNodeIndex; + static const PxU32 INVALID_NODE_ID = 0xffffffff; + + enum CompanionPrunerType + { + COMPANION_PRUNER_NONE, + COMPANION_PRUNER_BUCKET, + COMPANION_PRUNER_INCREMENTAL, + COMPANION_PRUNER_AABB_TREE + }; + + enum BVHBuildStrategy + { + BVH_SPLATTER_POINTS, + BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER, + BVH_SAH + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuQuerySystem.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuQuerySystem.h new file mode 100644 index 0000000..867e6da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuQuerySystem.h @@ -0,0 +1,463 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_QUERY_SYSTEM_H +#define GU_QUERY_SYSTEM_H + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" +#include "foundation/PxBounds3.h" +#include "GuPruner.h" +#include "GuActorShapeMap.h" + +namespace physx +{ + class PxGeometry; + +namespace Gu +{ + class BVH; + + class Adapter + { + public: + Adapter() {} + virtual ~Adapter() {} + + virtual const PxGeometry& getGeometry(const PrunerPayload& payload) const = 0; + }; + + class PrunerFilter + { + public: + PrunerFilter() {} + virtual ~PrunerFilter() {} + + virtual bool processPruner(PxU32 prunerIndex/*, const PxQueryThreadContext* context*/) const = 0; + }; + + typedef PxU32 PrunerInfo; + PX_FORCE_INLINE PrunerInfo createPrunerInfo(PxU32 prunerIndex, bool isDynamic) { return (prunerIndex << 1) | PxU32(isDynamic); } + PX_FORCE_INLINE PxU32 getPrunerIndex(PrunerInfo info) { return PxU32(info)>>1; } + PX_FORCE_INLINE PxU32 getDynamic(PrunerInfo info) { return PxU32(info) & 1; } + + PX_FORCE_INLINE ActorShapeData createActorShapeData(PrunerInfo info, PrunerHandle h) { return (ActorShapeData(h) << 32) | ActorShapeData(info); } + PX_FORCE_INLINE PrunerInfo getPrunerInfo(ActorShapeData data) { return PrunerInfo(data); } + PX_FORCE_INLINE PrunerHandle getPrunerHandle(ActorShapeData data) { return PrunerHandle(data >> 32); } + + #define INVALID_ACTOR_SHAPE_DATA PxU64(-1) + + class QuerySystem : public PxUserAllocated + { + public: // PT: TODO: public only to implement checkPrunerIndex easily, revisit this + struct PrunerExt : public PxUserAllocated + { + PrunerExt(Pruner* pruner, PxU32 preallocated); + ~PrunerExt(); + + void flushMemory(); + + void addToDirtyList(PrunerHandle handle, PxU32 dynamic, const PxTransform& transform, const PxBounds3* userBounds=NULL); + void removeFromDirtyList(PrunerHandle handle); + bool processDirtyList(const Adapter& adapter, float inflation); + + Pruner* mPruner; + PxBitMap mDirtyMap; + PxArray mDirtyList; + PxU32 mNbStatic; // nb static objects in pruner + PxU32 mNbDynamic; // nb dynamic objects in pruner + bool mDirtyStatic; // true if dirty list contains a static + + struct Data + { + PxTransform mPose; + PxBounds3 mBounds; + }; + PxArray mDirtyData; + + PX_NOCOPY(PrunerExt) + }; + + public: + PX_PHYSX_COMMON_API QuerySystem(PxU64 contextID, float inflation, const Adapter& adapter, bool usesTreeOfPruners=false); + PX_PHYSX_COMMON_API ~QuerySystem(); + + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + PX_FORCE_INLINE const Adapter& getAdapter() const { return mAdapter; } + PX_FORCE_INLINE PxU32 getStaticTimestamp() const { return mStaticTimestamp; } + + PX_PHYSX_COMMON_API PxU32 addPruner(Pruner* pruner, PxU32 preallocated); + PX_PHYSX_COMMON_API void removePruner(PxU32 prunerIndex); + PX_FORCE_INLINE PxU32 getNbPruners() const { return mPrunerExt.size(); } + PX_FORCE_INLINE const Pruner* getPruner(PxU32 index) const { return mPrunerExt[index]->mPruner; } + PX_FORCE_INLINE Pruner* getPruner(PxU32 index) { return mPrunerExt[index]->mPruner; } + + PX_PHYSX_COMMON_API ActorShapeData addPrunerShape(const PrunerPayload& payload, PxU32 prunerIndex, bool dynamic, const PxTransform& transform, const PxBounds3* userBounds=NULL); + PX_PHYSX_COMMON_API void removePrunerShape(ActorShapeData data, PrunerPayloadRemovalCallback* removalCallback); + PX_PHYSX_COMMON_API void updatePrunerShape(ActorShapeData data, bool immediately, const PxTransform& transform, const PxBounds3* userBounds=NULL); + + PX_PHYSX_COMMON_API const PrunerPayload& getPayloadData(ActorShapeData data, PrunerPayloadData* ppd=NULL) const; + + PX_PHYSX_COMMON_API void commitUpdates(); + PX_PHYSX_COMMON_API void update(bool buildStep, bool commit); + PX_PHYSX_COMMON_API void sync(PxU32 prunerIndex, const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count); + + PX_PHYSX_COMMON_API void flushMemory(); + + PX_PHYSX_COMMON_API void raycast(const PxVec3& origin, const PxVec3& unitDir, float& inOutDistance, PrunerRaycastCallback& cb, const PrunerFilter* prunerFilter) const; + PX_PHYSX_COMMON_API void overlap(const ShapeData& queryVolume, PrunerOverlapCallback& cb, const PrunerFilter* prunerFilter) const; + PX_PHYSX_COMMON_API void sweep(const ShapeData& queryVolume, const PxVec3& unitDir, float& inOutDistance, PrunerRaycastCallback& cb, const PrunerFilter* prunerFilter) const; + + PxU32 startCustomBuildstep(); + void customBuildstep(PxU32 index); + void finishCustomBuildstep(); + + void createTreeOfPruners(); + private: + const Adapter& mAdapter; + PxArray mPrunerExt; + PxArray mDirtyPruners; + PxArray mFreePruners; + + Gu::BVH* mTreeOfPruners; + + const PxU64 mContextID; + PxU32 mStaticTimestamp; + const float mInflation; // SQ_PRUNER_EPSILON + + PxMutex mSQLock; // to make sure only one query updates the dirty pruner structure if multiple queries run in parallel + + volatile bool mPrunerNeedsUpdating; + volatile bool mTimestampNeedsUpdating; + const bool mUsesTreeOfPruners; + + void processDirtyLists(); + PX_FORCE_INLINE void invalidateStaticTimestamp() { mStaticTimestamp++; } + + PX_NOCOPY(QuerySystem) + }; +} +} + + +#include "geometry/PxGeometryHit.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "GuCachedFuncs.h" +#include "GuCapsule.h" +#include "GuBounds.h" + +#if PX_VC +#pragma warning(disable: 4355 ) // "this" used in base member initializer list +#endif + +namespace physx +{ +namespace Gu +{ + // PT: TODO: use templates instead of v-calls? + + // PT: we decouple the filter callback from the rest, so that the same filter callback can easily be reused for all pruner queries. + // This combines the pre-filter callback and fetching the payload's geometry in a single call. Return null to ignore that object. + struct PrunerFilterCallback + { + virtual ~PrunerFilterCallback() {} + + // Query's hit flags can be tweaked per object. (Note that 'hitFlags' is unused for overlaps though) + virtual const PxGeometry* validatePayload(const PrunerPayload& payload, PxHitFlags& hitFlags) = 0; + }; + + struct DefaultPrunerRaycastCallback : public PrunerRaycastCallback, public PxRaycastThreadContext + { + PxRaycastThreadContext* mContext; + PrunerFilterCallback& mFilterCB; + const GeomRaycastTable& mCachedRaycastFuncs; + const PxVec3& mOrigin; + const PxVec3& mDir; + PxGeomRaycastHit* mLocalHits; + const PxU32 mMaxLocalHits; + const PxHitFlags mHitFlags; + PxGeomRaycastHit mClosestHit; + PrunerPayload mClosestPayload; + bool mFoundHit; + const bool mAnyHit; + + DefaultPrunerRaycastCallback(PrunerFilterCallback& filterCB, const GeomRaycastTable& funcs, const PxVec3& origin, const PxVec3& dir, float distance, PxU32 maxLocalHits, PxGeomRaycastHit* localHits, PxHitFlags hitFlags, bool anyHit, PxRaycastThreadContext* context=NULL) : + mContext (context ? context : this), + mFilterCB (filterCB), + mCachedRaycastFuncs (funcs), + mOrigin (origin), + mDir (dir), + mLocalHits (localHits), + mMaxLocalHits (maxLocalHits), + mHitFlags (hitFlags), + mFoundHit (false), + mAnyHit (anyHit) + { + mClosestHit.distance = distance; + } + + virtual bool reportHits(const PrunerPayload& /*payload*/, PxU32 /*nbHits*/, PxGeomRaycastHit* /*hits*/) + { + return true; + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + PX_ASSERT(payloads && transforms); + + const PrunerPayload& payload = payloads[primIndex]; + + PxHitFlags filteredHitFlags = mHitFlags; + const PxGeometry* shapeGeom = mFilterCB.validatePayload(payload, filteredHitFlags); + if(!shapeGeom) + return true; + + const RaycastFunc func = mCachedRaycastFuncs[shapeGeom->getType()]; + const PxU32 nbHits = func(*shapeGeom, transforms[primIndex], mOrigin, mDir, aDist, filteredHitFlags, mMaxLocalHits, mLocalHits, sizeof(PxGeomRaycastHit), mContext); + if(!nbHits || !reportHits(payload, nbHits, mLocalHits)) + return true; + + const PxGeomRaycastHit& localHit = mLocalHits[0]; + if(localHit.distance < mClosestHit.distance) + { + mFoundHit = true; + if(mAnyHit) + return false; + + aDist = localHit.distance; + mClosestHit = localHit; + mClosestPayload = payload; + } + return true; + } + + PX_NOCOPY(DefaultPrunerRaycastCallback) + }; + + struct DefaultPrunerRaycastAnyCallback : public DefaultPrunerRaycastCallback + { + PxGeomRaycastHit mLocalHit; + + DefaultPrunerRaycastAnyCallback(PrunerFilterCallback& filterCB, const GeomRaycastTable& funcs, const PxVec3& origin, const PxVec3& dir, float distance) : + DefaultPrunerRaycastCallback (filterCB, funcs, origin, dir, distance, 1, &mLocalHit, PxHitFlag::eANY_HIT, true) {} + }; + + struct DefaultPrunerRaycastClosestCallback : public DefaultPrunerRaycastCallback + { + PxGeomRaycastHit mLocalHit; + + DefaultPrunerRaycastClosestCallback(PrunerFilterCallback& filterCB, const GeomRaycastTable& funcs, const PxVec3& origin, const PxVec3& dir, float distance, PxHitFlags hitFlags) : + DefaultPrunerRaycastCallback (filterCB, funcs, origin, dir, distance, 1, &mLocalHit, hitFlags, false) {} + }; + + struct DefaultPrunerOverlapCallback : public PrunerOverlapCallback, public PxOverlapThreadContext + { + PxOverlapThreadContext* mContext; + PrunerFilterCallback& mFilterCB; + const GeomOverlapTable* mCachedFuncs; + const PxGeometry& mGeometry; + const PxTransform& mPose; + PxHitFlags mUnused; + + DefaultPrunerOverlapCallback(PrunerFilterCallback& filterCB, const GeomOverlapTable* funcs, const PxGeometry& geometry, const PxTransform& pose, PxOverlapThreadContext* context=NULL) : + mContext (context ? context : this), + mFilterCB (filterCB), + mCachedFuncs (funcs), + mGeometry (geometry), + mPose (pose) + { + } + + virtual bool reportHit(const PrunerPayload& /*payload*/) + { + return true; + } + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + PX_ASSERT(payloads && transforms); + + const PrunerPayload& payload = payloads[primIndex]; + + const PxGeometry* shapeGeom = mFilterCB.validatePayload(payload, mUnused); + if(!shapeGeom || !Gu::overlap(mGeometry, mPose, *shapeGeom, transforms[primIndex], mCachedFuncs, mContext)) + return true; + + return reportHit(payload); + } + + PX_NOCOPY(DefaultPrunerOverlapCallback) + }; + + struct BoxShapeCast + { + static PX_FORCE_INLINE PxU32 sweep( const GeomSweepFuncs& sf, const PxGeometry& geom, const PxTransform& pose, + const PxGeometry& queryGeom, const PxTransform& queryPose, const ShapeData& queryVolume, + const PxVec3& unitDir, PxReal distance, PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* context) + { + PX_ASSERT(queryGeom.getType()==PxGeometryType::eBOX); + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepBoxFunc func = precise ? sf.preciseBoxMap[geom.getType()] : sf.boxMap[geom.getType()]; + return PxU32(func(geom, pose, static_cast(queryGeom), queryPose, queryVolume.getGuBox(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + }; + + struct SphereShapeCast + { + static PX_FORCE_INLINE PxU32 sweep( const GeomSweepFuncs& sf, const PxGeometry& geom, const PxTransform& pose, + const PxGeometry& queryGeom, const PxTransform& queryPose, const ShapeData& /*queryVolume*/, + const PxVec3& unitDir, PxReal distance, PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* context) + { + PX_ASSERT(queryGeom.getType()==PxGeometryType::eSPHERE); + // PT: we don't use sd.getGuSphere() here because PhysX doesn't expose a set of 'SweepSphereFunc' functions, + // we have to go through a capsule (which is then seen as a sphere internally when the half-length is zero). + const PxSphereGeometry& sphereGeom = static_cast(queryGeom); + const PxCapsuleGeometry capsuleGeom(sphereGeom.radius, 0.0f); + const Capsule worldCapsule(queryPose.p, queryPose.p, sphereGeom.radius); // AP: precompute? + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom.getType()] : sf.capsuleMap[geom.getType()]; + return PxU32(func(geom, pose, capsuleGeom, queryPose, worldCapsule, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + }; + + struct CapsuleShapeCast + { + static PX_FORCE_INLINE PxU32 sweep( const GeomSweepFuncs& sf, const PxGeometry& geom, const PxTransform& pose, + const PxGeometry& queryGeom, const PxTransform& queryPose, const ShapeData& queryVolume, + const PxVec3& unitDir, PxReal distance, PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* context) + { + PX_ASSERT(queryGeom.getType()==PxGeometryType::eCAPSULE); + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom.getType()] : sf.capsuleMap[geom.getType()]; + return PxU32(func(geom, pose, static_cast(queryGeom), queryPose, queryVolume.getGuCapsule(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + }; + + struct ConvexShapeCast + { + static PX_FORCE_INLINE PxU32 sweep( const GeomSweepFuncs& sf, const PxGeometry& geom, const PxTransform& pose, + const PxGeometry& queryGeom, const PxTransform& queryPose, const ShapeData& /*queryVolume*/, + const PxVec3& unitDir, PxReal distance, PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* context) + { + PX_ASSERT(queryGeom.getType()==PxGeometryType::eCONVEXMESH); + const SweepConvexFunc func = sf.convexMap[geom.getType()]; + return PxU32(func(geom, pose, static_cast(queryGeom), queryPose, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + }; + + struct DefaultPrunerSweepCallback : public PrunerRaycastCallback, public PxSweepThreadContext + { + virtual bool reportHit(const PrunerPayload& /*payload*/, PxGeomSweepHit& /*hit*/) + { + return true; + } + }; + + template + struct DefaultPrunerSweepCallbackT : public DefaultPrunerSweepCallback + { + PxSweepThreadContext* mContext; + PrunerFilterCallback& mFilterCB; + const GeomSweepFuncs& mCachedFuncs; + const PxGeometry& mGeometry; + const PxTransform& mPose; + const ShapeData& mQueryVolume; + const PxVec3& mDir; + PxGeomSweepHit mLocalHit; + const PxHitFlags mHitFlags; + PxGeomSweepHit mClosestHit; + PrunerPayload mClosestPayload; + bool mFoundHit; + const bool mAnyHit; + + DefaultPrunerSweepCallbackT(PrunerFilterCallback& filterCB, const GeomSweepFuncs& funcs, + const PxGeometry& geometry, const PxTransform& pose, const ShapeData& queryVolume, + const PxVec3& dir, float distance, PxHitFlags hitFlags, bool anyHit, PxSweepThreadContext* context=NULL) : + mContext (context ? context : this), + mFilterCB (filterCB), + mCachedFuncs (funcs), + mGeometry (geometry), + mPose (pose), + mQueryVolume (queryVolume), + mDir (dir), + mHitFlags (hitFlags), + mFoundHit (false), + mAnyHit (anyHit) + { + mClosestHit.distance = distance; + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + PX_ASSERT(payloads && transforms); + + const PrunerPayload& payload = payloads[primIndex]; + + PxHitFlags filteredHitFlags = mHitFlags; + const PxGeometry* shapeGeom = mFilterCB.validatePayload(payload, filteredHitFlags); + if(!shapeGeom) + return true; + + // PT: ### TODO: missing bit from PhysX version here + + const float inflation = 0.0f; // #### + const PxU32 retVal = ShapeCast::sweep(mCachedFuncs, *shapeGeom, transforms[primIndex], mGeometry, mPose, mQueryVolume, mDir, aDist, mLocalHit, filteredHitFlags, inflation, mContext); + + if(!retVal || !reportHit(payload, mLocalHit)) + return true; + + if(mLocalHit.distance < mClosestHit.distance) + { + mFoundHit = true; + if(mAnyHit) + return false; + + aDist = mLocalHit.distance; + mClosestHit = mLocalHit; + mClosestPayload = payload; + } + return true; + } + + PX_NOCOPY(DefaultPrunerSweepCallbackT) + }; + +typedef DefaultPrunerSweepCallbackT DefaultPrunerSphereSweepCallback; +typedef DefaultPrunerSweepCallbackT DefaultPrunerBoxSweepCallback; +typedef DefaultPrunerSweepCallbackT DefaultPrunerCapsuleSweepCallback; +typedef DefaultPrunerSweepCallbackT DefaultPrunerConvexSweepCallback; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuRaycastTests.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuRaycastTests.h new file mode 100644 index 0000000..9c86462 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuRaycastTests.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_RAYCAST_TESTS_H +#define GU_RAYCAST_TESTS_H + +#include "foundation/PxSimpleTypes.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" + +namespace physx +{ + #define UNUSED_RAYCAST_THREAD_CONTEXT NULL + + // PT: we use a define to be able to quickly change the signature of all raycast functions. + // (this also ensures they all use consistent names for passed parameters). + // \param[in] geom geometry object to raycast against + // \param[in] pose pose of geometry object + // \param[in] rayOrigin ray's origin + // \param[in] rayDir ray's unit dir + // \param[in] maxDist ray's length/max distance + // \param[in] hitFlags query behavior flags + // \param[in] maxHits max number of hits = size of 'hits' buffer + // \param[out] hits result buffer where to write raycast hits + // \param[in] stride size of hit structure + // \param[in] threadContext optional per-thread context + #define GU_RAY_FUNC_PARAMS const PxGeometry& geom, const PxTransform& pose, \ + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, \ + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride, PxRaycastThreadContext* threadContext + + namespace Gu + { + // PT: function pointer for Geom-indexed raycast functions + // See GU_RAY_FUNC_PARAMS for function parameters details. + // \return number of hits written to 'hits' result buffer + // \note there's no mechanism to report overflow. Returned number of hits is just clamped to maxHits. + typedef PxU32 (*RaycastFunc) (GU_RAY_FUNC_PARAMS); + + // PT: typedef for a bundle of all raycast functions, i.e. the function table itself (indexed by geom-type). + typedef RaycastFunc GeomRaycastTable[PxGeometryType::eGEOMETRY_COUNT]; + + // PT: retrieves the raycast function table (for access by external non-Gu modules) + PX_PHYSX_COMMON_API const GeomRaycastTable& getRaycastFuncTable(); + + } // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSegment.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSegment.h new file mode 100644 index 0000000..d531854 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSegment.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SEGMENT_H +#define GU_SEGMENT_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxVec3.h" + +namespace physx +{ +namespace Gu +{ + + /** + \brief Represents a line segment. + + Line segment geometry + In some cases this structure will be used to represent the infinite line that passes point0 and point1. + */ + class Segment + { + public: + /** + \brief Constructor + */ + PX_INLINE Segment() + { + } + + /** + \brief Constructor + */ + PX_INLINE Segment(const PxVec3& _p0, const PxVec3& _p1) : p0(_p0), p1(_p1) + { + } + + /** + \brief Copy constructor + */ + PX_INLINE Segment(const Segment& seg) : p0(seg.p0), p1(seg.p1) + { + } + + /** + \brief Destructor + */ + PX_INLINE ~Segment() + { + } + + //! Assignment operator + PX_INLINE Segment& operator=(const Segment& other) + { + p0 = other.p0; + p1 = other.p1; + return *this; + } + + //! Equality operator + PX_INLINE bool operator==(const Segment& other) const + { + return (p0==other.p0 && p1==other.p1); + } + + //! Inequality operator + PX_INLINE bool operator!=(const Segment& other) const + { + return (p0!=other.p0 || p1!=other.p1); + } + + PX_INLINE const PxVec3& getOrigin() const + { + return p0; + } + + //! Return the vector from point0 to point1 + PX_INLINE PxVec3 computeDirection() const + { + return p1 - p0; + } + + //! Return the vector from point0 to point1 + PX_INLINE void computeDirection(PxVec3& dir) const + { + dir = p1 - p0; + } + + //! Return the center of the segment segment + PX_INLINE PxVec3 computeCenter() const + { + return (p0 + p1)*0.5f; + } + + PX_INLINE PxF32 computeLength() const + { + return (p1-p0).magnitude(); + } + + PX_INLINE PxF32 computeSquareLength() const + { + return (p1-p0).magnitudeSquared(); + } + + // PT: TODO: remove this one + //! Return the square of the length of vector from point0 to point1 + PX_INLINE PxReal lengthSquared() const + { + return ((p1 - p0).magnitudeSquared()); + } + + // PT: TODO: remove this one + //! Return the length of vector from point0 to point1 + PX_INLINE PxReal length() const + { + return ((p1 - p0).magnitude()); + } + + /* PX_INLINE void setOriginDirection(const PxVec3& origin, const PxVec3& direction) + { + p0 = p1 = origin; + p1 += direction; + }*/ + + /** + \brief Computes a point on the segment + + \param[out] pt point on segment + \param[in] t point's parameter [t=0 => pt = mP0, t=1 => pt = mP1] + */ + PX_INLINE void computePoint(PxVec3& pt, PxF32 t) const + { + pt = p0 + t * (p1 - p0); + } + + // PT: TODO: remove this one + //! Return the point at parameter t along the line: point0 + t*(point1-point0) + PX_INLINE PxVec3 getPointAt(PxReal t) const + { + return (p1 - p0)*t + p0; + } + + PxVec3 p0; //!< Start of segment + PxVec3 p1; //!< End of segment + }; + PX_COMPILE_TIME_ASSERT(sizeof(Gu::Segment) == 24); +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSphere.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSphere.h new file mode 100644 index 0000000..8653711 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSphere.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SPHERE_H +#define GU_SPHERE_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxVec3.h" + +namespace physx +{ + +/** +\brief Represents a sphere defined by its center point and radius. +*/ +namespace Gu +{ + class Sphere + { + public: + /** + \brief Constructor + */ + PX_INLINE Sphere() + { + } + + /** + \brief Constructor + */ + PX_INLINE Sphere(const PxVec3& _center, PxF32 _radius) : center(_center), radius(_radius) + { + } + /** + \brief Copy constructor + */ + PX_INLINE Sphere(const Sphere& sphere) : center(sphere.center), radius(sphere.radius) + { + } + /** + \brief Destructor + */ + PX_INLINE ~Sphere() + { + } + + PX_INLINE void set(const PxVec3& _center, float _radius) { center = _center; radius = _radius; } + + /** + \brief Checks the sphere is valid. + + \return true if the sphere is valid + */ + PX_INLINE bool isValid() const + { + // Consistency condition for spheres: Radius >= 0.0f + return radius >= 0.0f; + } + + /** + \brief Tests if a point is contained within the sphere. + + \param[in] p the point to test + \return true if inside the sphere + */ + PX_INLINE bool contains(const PxVec3& p) const + { + return (center-p).magnitudeSquared() <= radius*radius; + } + + PxVec3 center; //!< Sphere's center + PxF32 radius; //!< Sphere's radius + }; +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSqInternal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSqInternal.h new file mode 100644 index 0000000..dbf0e90 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSqInternal.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SQ_INTERNAL_H +#define GU_SQ_INTERNAL_H + +#include "foundation/PxSimpleTypes.h" +#include "common/PxPhysXCommonConfig.h" + +#define SQ_DEBUG_VIZ_STATIC_COLOR PxU32(PxDebugColor::eARGB_BLUE) +#define SQ_DEBUG_VIZ_DYNAMIC_COLOR PxU32(PxDebugColor::eARGB_RED) +#define SQ_DEBUG_VIZ_STATIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKBLUE) +#define SQ_DEBUG_VIZ_DYNAMIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKRED) +#define SQ_DEBUG_VIZ_COMPOUND_COLOR PxU32(PxDebugColor::eARGB_MAGENTA) + +namespace physx +{ + class PxRenderOutput; + class PxBounds3; + + namespace Gu + { + class BVH; + class AABBTree; + class IncrementalAABBTree; + class IncrementalAABBTreeNode; + } + + class DebugVizCallback + { + public: + DebugVizCallback() {} + virtual ~DebugVizCallback() {} + virtual bool visualizeNode(const physx::Gu::IncrementalAABBTreeNode& node, const physx::PxBounds3& bounds) = 0; + }; +} + + PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::BVH* tree); + PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::AABBTree* tree); + PX_PHYSX_COMMON_API void visualizeTree(physx::PxRenderOutput& out, physx::PxU32 color, const physx::Gu::IncrementalAABBTree* tree, physx::DebugVizCallback* cb=NULL); + + // PT: macros to try limiting the code duplication in headers. Mostly it just redefines the + // SqPruner API in implementation classes, and you shouldn't have to worry about it. + // Note that this assumes pool-based pruners with an mPool class member (for now). + +#define DECLARE_BASE_PRUNER_API \ + virtual void shiftOrigin(const PxVec3& shift); \ + virtual void visualize(PxRenderOutput& out, PxU32 primaryColor, PxU32 secondaryColor) const; + +#define DECLARE_PRUNER_API_COMMON \ + virtual bool addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count, bool hasPruningStructure); \ + virtual void removeObjects(const PrunerHandle* handles, PxU32 count, PrunerPayloadRemovalCallback* removalCallback); \ + virtual void updateObjects(const PrunerHandle* handles, PxU32 count, float inflation, const PxU32* boundsIndices, const PxBounds3* newBounds, const PxTransform32* newTransforms); \ + virtual void purge(); \ + virtual void commit(); \ + virtual void merge(const void* mergeParams); \ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, Gu::PrunerRaycastCallback&) const; \ + virtual bool overlap(const Gu::ShapeData& queryVolume, Gu::PrunerOverlapCallback&) const; \ + virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, Gu::PrunerRaycastCallback&) const; \ + virtual const PrunerPayload& getPayloadData(PrunerHandle handle, PrunerPayloadData* data) const { return mPool.getPayloadData(handle, data); } \ + virtual void preallocate(PxU32 entries) { mPool.preallocate(entries); } \ + virtual bool setTransform(PrunerHandle handle, const PxTransform& transform) { return mPool.setTransform(handle, transform); } \ + virtual void getGlobalBounds(PxBounds3&) const; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSweepTests.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSweepTests.h new file mode 100644 index 0000000..7560445 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/include/GuSweepTests.h @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_TESTS_H +#define GU_SWEEP_TESTS_H + +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHit.h" +#include "geometry/PxGeometryQueryContext.h" + +namespace physx +{ + class PxConvexMeshGeometry; + class PxCapsuleGeometry; + class PxTriangle; + class PxBoxGeometry; + + #define UNUSED_SWEEP_THREAD_CONTEXT NULL + + // PT: TODO: unify this with raycast calls (names and order of params) + + // PT: we use defines to be able to quickly change the signature of all sweep functions. + // (this also ensures they all use consistent names for passed parameters). + // \param[in] geom geometry object to sweep against + // \param[in] pose pose of geometry object + // \param[in] unitDir sweep's unit dir + // \param[in] distance sweep's length/max distance + // \param[out] sweepHit hit result + // \param[in] hitFlags query behavior flags + // \param[in] inflation optional inflation value for swept shape + // \param[in] threadContext optional per-thread context + + // PT: sweep parameters for capsule + #define GU_CAPSULE_SWEEP_FUNC_PARAMS const PxGeometry& geom, const PxTransform& pose, \ + const PxCapsuleGeometry& capsuleGeom_, const PxTransform& capsulePose_, const Gu::Capsule& lss, \ + const PxVec3& unitDir, PxReal distance, \ + PxGeomSweepHit& sweepHit, const PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* threadContext + + // PT: sweep parameters for box + #define GU_BOX_SWEEP_FUNC_PARAMS const PxGeometry& geom, const PxTransform& pose, \ + const PxBoxGeometry& boxGeom_, const PxTransform& boxPose_, const Gu::Box& box, \ + const PxVec3& unitDir, PxReal distance, \ + PxGeomSweepHit& sweepHit, const PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* threadContext + + // PT: sweep parameters for convex + #define GU_CONVEX_SWEEP_FUNC_PARAMS const PxGeometry& geom, const PxTransform& pose, \ + const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, \ + const PxVec3& unitDir, PxReal distance, \ + PxGeomSweepHit& sweepHit, const PxHitFlags hitFlags, PxReal inflation, PxSweepThreadContext* threadContext + namespace Gu + { + class Capsule; + class Box; + + // PT: function pointer for Geom-indexed capsule sweep functions + // See GU_CAPSULE_SWEEP_FUNC_PARAMS for function parameters details. + // \return true if a hit was found, false otherwise + typedef bool (*SweepCapsuleFunc) (GU_CAPSULE_SWEEP_FUNC_PARAMS); + + // PT: function pointer for Geom-indexed box sweep functions + // See GU_BOX_SWEEP_FUNC_PARAMS for function parameters details. + // \return true if a hit was found, false otherwise + typedef bool (*SweepBoxFunc) (GU_BOX_SWEEP_FUNC_PARAMS); + + // PT: function pointer for Geom-indexed box sweep functions + // See GU_CONVEX_SWEEP_FUNC_PARAMS for function parameters details. + // \return true if a hit was found, false otherwise + typedef bool (*SweepConvexFunc) (GU_CONVEX_SWEEP_FUNC_PARAMS); + + // PT: typedef for bundles of all sweep functions, i.e. the function tables themselves (indexed by geom-type). + typedef SweepCapsuleFunc GeomSweepCapsuleTable [PxGeometryType::eGEOMETRY_COUNT]; + typedef SweepBoxFunc GeomSweepBoxTable [PxGeometryType::eGEOMETRY_COUNT]; + typedef SweepConvexFunc GeomSweepConvexTable [PxGeometryType::eGEOMETRY_COUNT]; + + struct GeomSweepFuncs + { + GeomSweepCapsuleTable capsuleMap; + GeomSweepCapsuleTable preciseCapsuleMap; + GeomSweepBoxTable boxMap; + GeomSweepBoxTable preciseBoxMap; + GeomSweepConvexTable convexMap; + }; + // PT: grabs all sweep function tables at once (for access by external non-Gu modules) + PX_PHYSX_COMMON_API const GeomSweepFuncs& getSweepFuncTable(); + + // PT: signature for sweep-vs-triangles functions. + // We use defines to be able to quickly change the signature of all sweep functions. + // (this also ensures they all use consistent names for passed parameters). + // \param[in] nbTris number of triangles in input array + // \param[in] triangles array of triangles to sweep the shape against + // \param[in] doubleSided true if input triangles are double-sided + // \param[in] x geom to sweep against input triangles + // \param[in] pose pose of geom x + // \param[in] unitDir sweep's unit dir + // \param[in] distance sweep's length/max distance + // \param[out] hit hit result + // \param[in] cachedIndex optional initial triangle index (must be markNodeForRefit(treeNodeIndex); + else // otherwise it means it should be in the bucket pruner + { + PX_ASSERT(&data[poolIndex]==&mPool.getPayloadData(handle)); + bool found = mBucketPruner.updateObject(currentBounds[poolIndex], currentTransforms[poolIndex], data[poolIndex], handle, poolIndex); + PX_UNUSED(found); PX_ASSERT(found); + } + + if(addToRefit) + mToRefit.pushBack(poolIndex); + } + } +} + +void AABBPruner::removeObjects(const PrunerHandle* handles, PxU32 count, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_PROFILE_ZONE("SceneQuery.prunerRemoveObjects", mPool.mContextID); + + if(!count) + return; + + mUncommittedChanges = true; + + for(PxU32 i=0; imarkNodeForRefit(treeNodeIndex); // mark the spot as blank + mBucketPruner.swapIndex(poolIndex, swappedData, poolRelocatedLastIndex); // if swapped index is in bucket pruner + } + else + { + bool status = mBucketPruner.removeObject(removedData, h, poolIndex, swappedData, poolRelocatedLastIndex); + // PT: removed assert to avoid crashing all UTs + //PX_ASSERT(status); + PX_UNUSED(status); + } + + mTreeMap.invalidate(poolIndex, poolRelocatedLastIndex, *mAABBTree); + if(mNewTree) + mNewTreeFixups.pushBack(NewTreeFixup(poolIndex, poolRelocatedLastIndex)); + } + } + + if (mPool.getNbActiveObjects()==0) + { + // this is just to make sure we release all the internal data once all the objects are out of the pruner + // since this is the only place we know that and we don't want to keep memory reserved + release(); + + // Pruner API requires a commit before the next query, even if we ended up removing the entire tree here. This + // forces that to happen. + mUncommittedChanges = true; + } +} + +bool AABBPruner::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& pcbArgName) const +{ + PX_ASSERT(!mUncommittedChanges); + + bool again = true; + + if(mAABBTree) + { + OverlapCallbackAdapter pcb(pcbArgName, mPool); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + } + break; + + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } + + if(again && mIncrementalRebuild && mBucketPruner.getNbObjects()) + again = mBucketPruner.overlap(queryVolume, pcbArgName); + + return again; +} + +bool AABBPruner::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + PX_ASSERT(!mUncommittedChanges); + + bool again = true; + + if(mAABBTree) + { + RaycastCallbackAdapter pcb(pcbArgName, mPool); + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + again = AABBTreeRaycast()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, aabb.getCenter(), unitDir, inOutDistance, aabb.getExtents(), pcb); + } + + if(again && mIncrementalRebuild && mBucketPruner.getNbObjects()) + again = mBucketPruner.sweep(queryVolume, unitDir, inOutDistance, pcbArgName); + + return again; +} + +bool AABBPruner::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + PX_ASSERT(!mUncommittedChanges); + + bool again = true; + + if(mAABBTree) + { + RaycastCallbackAdapter pcb(pcbArgName, mPool); + again = AABBTreeRaycast()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, origin, unitDir, inOutDistance, PxVec3(0.0f), pcb); + } + + if(again && mIncrementalRebuild && mBucketPruner.getNbObjects()) + again = mBucketPruner.raycast(origin, unitDir, inOutDistance, pcbArgName); + + return again; +} + +// This isn't part of the pruner virtual interface, but it is part of the public interface +// of AABBPruner - it gets called by SqManager to force a rebuild, and requires a commit() before +// queries can take place + +void AABBPruner::purge() +{ + release(); + mUncommittedChanges = true; // this ensures a commit() must happen before any query +} + +void AABBPruner::setRebuildRateHint(PxU32 nbStepsForRebuild) +{ + PX_ASSERT(nbStepsForRebuild > 3); + mRebuildRateHint = (nbStepsForRebuild-3); // looks like a magic number to account for the rebuild pipeline latency + mAdaptiveRebuildTerm = 0; +} + +// Commit either performs a refit if background rebuild is not yet finished +// or swaps the current tree for the second tree rebuilt in the background +void AABBPruner::commit() +{ + PX_PROFILE_ZONE("SceneQuery.prunerCommit", mPool.mContextID); + + if(!mUncommittedChanges && (mProgress != BUILD_FINISHED)) + // Q: seems like this is both for refit and finalization so is this is correct? + // i.e. in a situation when we started rebuilding a tree and didn't add anything since + // who is going to set mUncommittedChanges to true? + // A: it's set in buildStep at final stage, so that finalization is forced. + // Seems a bit difficult to follow and verify correctness. + return; + + mUncommittedChanges = false; + + if(!mAABBTree || !mIncrementalRebuild) + { +#if PX_CHECKED + if(!mIncrementalRebuild && mAABBTree) + PxGetFoundation().error(PxErrorCode::ePERF_WARNING, PX_FL, "SceneQuery static AABB Tree rebuilt, because a shape attached to a static actor was added, removed or moved, and PxSceneQueryDesc::staticStructure is set to eSTATIC_AABB_TREE."); +#endif + fullRebuildAABBTree(); + return; + } + + // Note: it is not safe to call AABBPruner::build() here + // because the first thread will perform one step of the incremental update, + // continue raycasting, while the second thread performs the next step in + // the incremental update + + // Calling Refit() below is safe. It will call + // StaticPruner::build() when necessary. Both will early + // exit if the tree is already up to date, if it is not already, then we + // must be the first thread performing raycasts on a dirty tree and other + // scene query threads will be locked out by the write lock in + // PrunerManager::flushUpdates() + + if (mProgress != BUILD_FINISHED) + { + // Calling refit because the second tree is not ready to be swapped in (mProgress != BUILD_FINISHED) + // Generally speaking as long as things keep moving the second build will never catch up with true state + refitUpdatedAndRemoved(); + } + else + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeFinalize", mPool.mContextID); + + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeSwitch", mPool.mContextID); + + PX_DELETE(mAABBTree); // delete the old tree + mCachedBoxes.release(); + mProgress = BUILD_NOT_STARTED; // reset the build state to initial + + // Adjust adaptive term to get closer to specified rebuild rate. + // perform an even division correction to make sure the rebuild rate adds up + if (mNbCalls > mRebuildRateHint) + mAdaptiveRebuildTerm++; + else if (mNbCalls < mRebuildRateHint) + mAdaptiveRebuildTerm--; + + // Switch trees +#if PX_DEBUG + mNewTree->validate(); +#endif + mAABBTree = mNewTree; // set current tree to progressively rebuilt tree + mNewTree = NULL; // clear out the progressively rebuild tree pointer + mNodeAllocator.release(); + } + + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeMapping", mPool.mContextID); + + // rebuild the tree map to match the current (newly built) tree + mTreeMap.initMap(PxMax(mPool.getNbActiveObjects(), mNbCachedBoxes), *mAABBTree); + + // The new mapping has been computed using only indices stored in the new tree. Those indices map the pruning pool + // we had when starting to build the tree. We need to re-apply recorded moves to fix the tree that finished rebuilding. + // AP: the problem here is while we are rebuilding the tree there are ongoing modifications to the current tree + // but the background build has a cached copy of all the AABBs at the time it was started + // (and will produce indices referencing those) + // Things that can happen in the meantime: update, remove, add, commit + for(NewTreeFixup* r = mNewTreeFixups.begin(); r < mNewTreeFixups.end(); r++) + { + // PT: we're not doing a full refit after this point anymore, so the remaining deleted objects must be manually marked for + // refit (otherwise their AABB in the tree would remain valid, leading to crashes when the corresponding index is 0xffffffff). + // We must do this before invalidating the corresponding tree nodes in the map, obviously (otherwise we'd be reading node + // indices that we already invalidated). + const PoolIndex poolIndex = r->removedIndex; + const TreeNodeIndex treeNodeIndex = mTreeMap[poolIndex]; + if(treeNodeIndex!=INVALID_NODE_ID) + mAABBTree->markNodeForRefit(treeNodeIndex); + + mTreeMap.invalidate(r->removedIndex, r->relocatedLastIndex, *mAABBTree); + } + mNewTreeFixups.clear(); // clear out the fixups since we just applied them all + } + + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeFinalRefit", mPool.mContextID); + + const PxU32 size = mToRefit.size(); + for(PxU32 i=0;imarkNodeForRefit(treeNodeIndex); + } + mToRefit.clear(); + refitUpdatedAndRemoved(); + } + + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeRemoveObjects", mPool.mContextID); + + PxU32 nbRemovedPairs = mBucketPruner.removeMarkedObjects(mTimeStamp-1); + PX_UNUSED(nbRemovedPairs); + + mNeedsNewTree = mBucketPruner.getNbObjects()>0; + } + } + + updateBucketPruner(); +} + +void AABBPruner::shiftOrigin(const PxVec3& shift) +{ + mPool.shiftOrigin(shift); + + if(mAABBTree) + mAABBTree->shiftOrigin(shift); + + if(mIncrementalRebuild) + mBucketPruner.shiftOrigin(shift); + + if(mNewTree) + mNewTree->shiftOrigin(shift); +} + +void AABBPruner::visualize(PxRenderOutput& out, PxU32 primaryColor, PxU32 secondaryColor) const +{ + // getAABBTree() asserts when pruner is dirty. NpScene::visualization() does not enforce flushUpdate. see DE7834 + visualizeTree(out, primaryColor, mAABBTree); + + // Render added objects not yet in the tree + out << PxTransform(PxIdentity); + out << PxU32(PxDebugColor::eARGB_WHITE); + + if(mIncrementalRebuild && mBucketPruner.getNbObjects()) + mBucketPruner.visualize(out, secondaryColor); +} + +bool AABBPruner::buildStep(bool synchronousCall) +{ + PX_PROFILE_ZONE("SceneQuery.prunerBuildStep", mPool.mContextID); + + PX_ASSERT(mIncrementalRebuild); + if(mNeedsNewTree) + { + if(mProgress==BUILD_NOT_STARTED) + { + if(!synchronousCall || !prepareBuild()) + return false; + } + else if(mProgress==BUILD_INIT) + { + mNewTree->progressiveBuild(mBuilder, mNodeAllocator, mBuildStats, 0, 0); + mProgress = BUILD_IN_PROGRESS; + mNbCalls = 0; + + // Use a heuristic to estimate the number of work units needed for rebuilding the tree. + // The general idea is to use the number of work units of the previous tree to build the new tree. + // This works fine as long as the number of leaves remains more or less the same for the old and the + // new tree. If that is not the case, this estimate can be way off and the work units per step will + // be either much too small or too large. Hence, in that case we will try to estimate the number of work + // units based on the number of leaves of the new tree as follows: + // + // - Assume new tree with n leaves is perfectly-balanced + // - Compute the depth of perfectly-balanced tree with n leaves + // - Estimate number of working units for the new tree + + const PxU32 depth = PxILog2(mBuilder.mNbPrimitives); // Note: This is the depth without counting the leaf layer + const PxU32 estimatedNbWorkUnits = depth * mBuilder.mNbPrimitives; // Estimated number of work units for new tree + const PxU32 estimatedNbWorkUnitsOld = mAABBTree ? mAABBTree->getTotalPrims() : 0; + if ((estimatedNbWorkUnits <= (estimatedNbWorkUnitsOld << 1)) && (estimatedNbWorkUnits >= (estimatedNbWorkUnitsOld >> 1))) + // The two estimates do not differ by more than a factor 2 + mTotalWorkUnits = estimatedNbWorkUnitsOld; + else + { + mAdaptiveRebuildTerm = 0; + mTotalWorkUnits = estimatedNbWorkUnits; + } + + const PxI32 totalWorkUnits = PxI32(mTotalWorkUnits + (mAdaptiveRebuildTerm * mBuilder.mNbPrimitives)); + mTotalWorkUnits = PxU32(PxMax(totalWorkUnits, 0)); + } + else if(mProgress==BUILD_IN_PROGRESS) + { + mNbCalls++; + const PxU32 Limit = 1 + (mTotalWorkUnits / mRebuildRateHint); + // looks like progressiveRebuild returns 0 when finished + if(!mNewTree->progressiveBuild(mBuilder, mNodeAllocator, mBuildStats, 1, Limit)) + { + // Done + mProgress = BUILD_NEW_MAPPING; +#if PX_DEBUG + mNewTree->validate(); +#endif + } + } + else if(mProgress==BUILD_NEW_MAPPING) + { + mNbCalls++; + mProgress = BUILD_FULL_REFIT; + + // PT: we can't call fullRefit without creating the new mapping first: the refit function will fetch boxes from + // the pool using "primitive indices" captured in the tree. But some of these indices may have been invalidated + // if objects got removed while the tree was built. So we need to invalidate the corresponding nodes before refit, + // that way the #prims will be zero and the code won't fetch a wrong box (which may now below to a different object). + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeMapping", mPool.mContextID); + + if(mNewTreeFixups.size()) + { + mNewTreeMap.initMap(PxMax(mPool.getNbActiveObjects(), mNbCachedBoxes), *mNewTree); + + // The new mapping has been computed using only indices stored in the new tree. Those indices map the pruning pool + // we had when starting to build the tree. We need to re-apply recorded moves to fix the tree. + for(NewTreeFixup* r = mNewTreeFixups.begin(); r < mNewTreeFixups.end(); r++) + mNewTreeMap.invalidate(r->removedIndex, r->relocatedLastIndex, *mNewTree); + + mNewTreeFixups.clear(); +#if PX_DEBUG + mNewTree->validate(); +#endif + } + } + } + else if(mProgress==BUILD_FULL_REFIT) + { + mNbCalls++; + mProgress = BUILD_LAST_FRAME; + + { + PX_PROFILE_ZONE("SceneQuery.prunerNewTreeFullRefit", mPool.mContextID); + + // We need to refit the new tree because objects may have moved while we were building it. + mNewTree->fullRefit(mPool.getCurrentWorldBoxes()); + } + } + else if(mProgress==BUILD_LAST_FRAME) + { + mProgress = BUILD_FINISHED; + } + + // This is required to be set because commit handles both refit and a portion of build finalization (why?) + // This is overly conservative also only necessary in case there were no updates at all to the tree since the last tree swap + // It also overly conservative in a sense that it could be set only if mProgress was just set to BUILD_FINISHED + // If run asynchronously from a different thread, we touched just the new AABB build phase, we should not mark the main tree as dirty + if(synchronousCall) + mUncommittedChanges = true; + + return mProgress==BUILD_FINISHED; + } + + return false; +} + +bool AABBPruner::prepareBuild() +{ + PX_PROFILE_ZONE("SceneQuery.prepareBuild", mPool.mContextID); + + PX_ASSERT(mIncrementalRebuild); + if(mNeedsNewTree) + { + if(mProgress==BUILD_NOT_STARTED) + { + const PxU32 nbObjects = mPool.getNbActiveObjects(); + if(!nbObjects) + return false; + + mNodeAllocator.release(); + PX_DELETE(mNewTree); + mNewTree = PX_NEW(AABBTree); + + mNbCachedBoxes = nbObjects; + + mCachedBoxes.init(nbObjects, mPool.getCurrentWorldBoxes()); + + // PT: objects currently in the bucket pruner will be in the new tree. They are marked with the + // current timestamp (mTimeStamp). However more objects can get added while we compute the new tree, + // and those ones will not be part of it. These new objects will be marked with the new timestamp + // value (mTimeStamp+1), and we can use these different values to remove the proper objects from + // the bucket pruner (when switching to the new tree). + mTimeStamp++; + + // notify the incremental pruner to swap trees (for incremental pruner companion) + mBucketPruner.timeStampChange(); + + mBuilder.reset(); + mBuilder.mNbPrimitives = mNbCachedBoxes; + mBuilder.mBounds = &mCachedBoxes; + mBuilder.mLimit = mNbObjectsPerNode; + mBuilder.mBuildStrategy = mBuildStrategy; + + mBuildStats.reset(); + + // start recording modifications to the tree made during rebuild to reapply (fix the new tree) eventually + PX_ASSERT(mNewTreeFixups.size()==0); + + mProgress = BUILD_INIT; + } + } + else + return false; + + return true; +} + +/** + * Builds an AABB-tree for objects in the pruning pool. + * \return true if success + */ +bool AABBPruner::fullRebuildAABBTree() +{ + PX_PROFILE_ZONE("SceneQuery.prunerFullRebuildAABBTree", mPool.mContextID); + + // Release possibly already existing tree + PX_DELETE(mAABBTree); + + // Don't bother building an AABB-tree if there isn't a single static object + const PxU32 nbObjects = mPool.getNbActiveObjects(); + if(!nbObjects) + return true; + + bool Status; + { + // Create a new tree + mAABBTree = PX_NEW(AABBTree); + + Status = mAABBTree->build(AABBTreeBuildParams(mNbObjectsPerNode, nbObjects, &mPool.getCurrentAABBTreeBounds(), mBuildStrategy), mNodeAllocator); + } + + // No need for the tree map for static pruner + if(mIncrementalRebuild) + mTreeMap.initMap(PxMax(nbObjects, mNbCachedBoxes), *mAABBTree); + + return Status; +} + +// called in the end of commit(), but only if mIncrementalRebuild is true +void AABBPruner::updateBucketPruner() +{ + PX_PROFILE_ZONE("SceneQuery.prunerUpdateBucketPruner", mPool.mContextID); + + PX_ASSERT(mIncrementalRebuild); + mBucketPruner.build(); +} + +void AABBPruner::release() // this can be called from purge() +{ + mBucketPruner.release(); + + mTimeStamp = 0; + + mTreeMap.release(); + mNewTreeMap.release(); + + mCachedBoxes.release(); + mBuilder.reset(); + mNodeAllocator.release(); + PX_DELETE(mNewTree); + PX_DELETE(mAABBTree); + + mNbCachedBoxes = 0; + mProgress = BUILD_NOT_STARTED; + mNewTreeFixups.clear(); + mUncommittedChanges = false; +} + +// Refit current tree +void AABBPruner::refitUpdatedAndRemoved() +{ + PX_PROFILE_ZONE("SceneQuery.prunerRefitUpdatedAndRemoved", mPool.mContextID); + + PX_ASSERT(mIncrementalRebuild); + AABBTree* tree = getAABBTree(); + if(!tree) + return; + +#if PX_DEBUG + tree->validate(); +#endif + + //### missing a way to skip work if not needed + + const PxU32 nbObjects = mPool.getNbActiveObjects(); + // At this point there still can be objects in the tree that are blanked out so it's an optimization shortcut (not required) + if(!nbObjects) + return; + + mBucketPruner.refitMarkedNodes(mPool.getCurrentWorldBoxes()); + tree->refitMarkedNodes(mPool.getCurrentWorldBoxes()); +} + +void AABBPruner::merge(const void* mergeParams) +{ + const AABBPrunerMergeData& pruningStructure = *reinterpret_cast (mergeParams); + + if(!pruningStructure.mAABBTreeNodes) + return; + + if(mAABBTree) + { + // index in pruning pool, where new objects were added + const PxU32 pruningPoolIndex = mPool.getNbActiveObjects() - pruningStructure.mNbObjects; + + // create tree from given nodes and indices + AABBTreeMergeData aabbTreeMergeParams(pruningStructure.mNbNodes, pruningStructure.mAABBTreeNodes, + pruningStructure.mNbObjects, pruningStructure.mAABBTreeIndices, pruningPoolIndex); + + if(!mIncrementalRebuild) + { + // merge tree directly + mAABBTree->mergeTree(aabbTreeMergeParams); + } + else + { + mBucketPruner.addTree(aabbTreeMergeParams, mTimeStamp); + } + } +} + +void AABBPruner::getGlobalBounds(PxBounds3& bounds) const +{ + if(mAABBTree && mAABBTree->getNodes()) + bounds = mAABBTree->getNodes()->mBV; + else + bounds.setEmpty(); + + if(mIncrementalRebuild && mBucketPruner.getNbObjects()) + { + PxBounds3 extBounds; + mBucketPruner.getGlobalBounds(extBounds); + bounds.include(extBounds); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.h new file mode 100644 index 0000000..494831c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBPruner.h @@ -0,0 +1,264 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABB_PRUNER_H +#define GU_AABB_PRUNER_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuExtendedBucketPruner.h" +#include "GuSqInternal.h" +#include "GuPruningPool.h" +#include "GuAABBTree.h" +#include "GuAABBTreeUpdateMap.h" +#include "GuAABBTreeBuildStats.h" + +namespace physx +{ +namespace Gu +{ + // PT: we build the new tree over a number of frames/states, in order to limit perf spikes in 'updatePruningTrees'. + // The states are as follows: + // + // BUILD_NOT_STARTED (1 frame, AABBPruner): + // + // This is the initial state, before the new (AABBTree) build even starts. In this frame/state, we perform the AABBPruner-related + // memory allocations: + // - the new AABB tree is allocated + // - the array of cached bounding boxes is allocated and filled + // + // BUILD_INIT (1 frame, AABBTree): + // + // This is the first frame in which the new tree gets built. It deserves its own special state since various things happen in the + // first frame, that do no happen in subsequent frames. Basically most initial AABBTree-related allocations happen here (but no + // build step per se). + // + // BUILD_IN_PROGRESS (N frames, AABBTree): + // + // This is the core build function, actually building the tree. This should be mostly allocation-free, except here and there when + // building non-complete trees, and during the last call when the tree is finally built. + // + // BUILD_NEW_MAPPING (1 frame, AABBPruner): + // + // After the new AABBTree is built, we recreate an AABBTreeUpdateMap for the new tree, and use it to invalidate nodes whose objects + // have been removed during the build. + // + // We need to do that before doing a full refit in the next stage/frame. If we don't do that, the refit code will fetch a wrong box, + // that may very well belong to an entirely new object. + // + // Note that this mapping/update map (mNewTreeMap) is temporary, and only needed for the next stage. + // + // BUILD_FULL_REFIT (1 frame, AABBPruner): + // + // Once the new update map is available, we fully refit the new tree. AABBs of moved objects get updated. AABBs of removed objects + // become empty. + // + // BUILD_LAST_FRAME (1 frame, AABBPruner): + // + // This is an artificial frame used to delay the tree switching code. The switch happens as soon as we reach the BUILD_FINISHED + // state, but we don't want to execute BUILD_FULL_REFIT and the switch in the same frame. This extra BUILD_LAST_FRAME stage buys + // us one frame, i.e. we have one frame in which we do BUILD_FULL_REFIT, and in the next frame we'll do both BUILD_LAST_FRAME / + // BUILD_FINISHED / the switch. + // + // BUILD_FINISHED (1 frame, AABBPruner): + // + // Several things happen in this 'finalization' frame/stage: + // - We switch the trees (old one is deleted, cached boxes are deleted, new tree pointer is setup) + // - A new (final) update map is created (mTreeMap). The map is used to invalidate objects that may have been removed during + // the BUILD_NEW_MAPPING and BUILD_FULL_REFIT frames. The nodes containing these removed objects are marked for refit. + // - Nodes containing objects that have moved during the BUILD_NEW_MAPPING and BUILD_FULL_REFIT frames are marked for refit. + // - We do a partial refit on the new tree, to take these final changes into account. This small partial refit is usually much + // cheaper than the full refit we previously performed here. + // - We remove old objects from the bucket pruner + // + enum BuildStatus + { + BUILD_NOT_STARTED, + BUILD_INIT, + BUILD_IN_PROGRESS, + BUILD_NEW_MAPPING, + BUILD_FULL_REFIT, + BUILD_LAST_FRAME, + BUILD_FINISHED, + + BUILD_FORCE_DWORD = 0xffffffff + }; + + // This class implements the Pruner interface for internal SQ use with some additional specialized functions + // The underlying data structure is a binary AABB tree + // AABBPruner supports insertions, removals and updates for dynamic objects + // The tree is either entirely rebuilt in a single frame (static pruner) or progressively rebuilt over multiple frames (dynamic pruner) + // The rebuild happens on a copy of the tree + // the copy is then swapped with current tree at the time commit() is called (only if mBuildState is BUILD_FINISHED), + // otherwise commit() will perform a refit operation applying any pending changes to the current tree + // While the tree is being rebuilt a temporary data structure (BucketPruner) is also kept in sync and used to speed up + // queries on updated objects that are not yet in either old or new tree. + // The requirements on the order of calls: + // commit() is required to be called before any queries to apply modifications + // queries can be issued on multiple threads after commit is called + // commit, buildStep, add/remove/update have to be called from the same thread or otherwise strictly serialized by external code + // and cannot be issued while a query is running + class AABBPruner : public DynamicPruner + { + PX_NOCOPY(AABBPruner) + public: + PX_PHYSX_COMMON_API AABBPruner(bool incrementalRebuild, PxU64 contextID, CompanionPrunerType cpType, BVHBuildStrategy buildStrategy=BVH_SPLATTER_POINTS, PxU32 nbObjectsPerNode=4); // true is equivalent to former dynamic pruner + virtual ~AABBPruner(); + + // BasePruner + DECLARE_BASE_PRUNER_API + //~BasePruner + + // Pruner + DECLARE_PRUNER_API_COMMON + virtual bool isDynamic() const { return mIncrementalRebuild; } + //~Pruner + + // DynamicPruner + virtual void setRebuildRateHint(PxU32 nbStepsForRebuild); // Besides the actual rebuild steps, 3 additional steps are needed. + virtual bool buildStep(bool synchronousCall = true); // returns true if finished + virtual bool prepareBuild(); // returns true if new tree is needed + //~DynamicPruner + + // direct access for test code + + PX_FORCE_INLINE PxU32 getNbAddedObjects() const { return mBucketPruner.getNbObjects(); } + PX_FORCE_INLINE const AABBTree* getAABBTree() const { PX_ASSERT(!mUncommittedChanges); return mAABBTree; } + PX_FORCE_INLINE AABBTree* getAABBTree() { PX_ASSERT(!mUncommittedChanges); return mAABBTree; } + PX_FORCE_INLINE void setAABBTree(AABBTree* tree) { mAABBTree = tree; } + PX_FORCE_INLINE const AABBTree* hasAABBTree() const { return mAABBTree; } + PX_FORCE_INLINE BuildStatus getBuildStatus() const { return mProgress; } + + // local functions +// private: + NodeAllocator mNodeAllocator; + + AABBTree* mAABBTree; // current active tree + AABBTreeBuildParams mBuilder; // this class deals with the details of the actual tree building + BuildStats mBuildStats; + + // tree with build in progress, assigned to mAABBTree in commit, when mProgress is BUILD_FINISHED + // created in buildStep(), BUILD_NOT_STARTED + // This is non-null when there is a tree rebuild going on in progress + // and thus also indicates that we have to start saving the fixups + AABBTree* mNewTree; + + // during rebuild the pool might change so we need a copy of boxes for the tree build + AABBTreeBounds mCachedBoxes; + PxU32 mNbCachedBoxes; + + // incremented in commit(), serves as a progress counter for rebuild + PxU32 mNbCalls; + + // PT: incremented each time we start building a new tree (i.e. effectively identifies a given tree) + // Timestamp is passed to bucket pruner to mark objects added there, linking them to a specific tree. + // When switching to the new tree, timestamp is used to remove old objects (now in the new tree) from + // the bucket pruner. + PxU32 mTimeStamp; + + // this pruner is used for queries on objects that are not in the current tree yet + // includes both the objects in the tree being rebuilt and all the objects added later + ExtendedBucketPruner mBucketPruner; + + BuildStatus mProgress; // current state of second tree build progress + + // Fraction (as in 1/Nth) of the total number of primitives + // that should be processed per step by the AABB builder + // so if this value is 1, all primitives will be rebuilt, 2 => 1/2 of primitives per step etc. + // see also mNbCalls, mNbCalls varies from 0 to mRebuildRateHint-1 + PxU32 mRebuildRateHint; + + // Estimate for how much work has to be done to rebuild the tree. + PxU32 mTotalWorkUnits; + + // Term to correct the work unit estimate if the rebuild rate is not matched + PxI32 mAdaptiveRebuildTerm; + + const PxU32 mNbObjectsPerNode; + const BVHBuildStrategy mBuildStrategy; + + PruningPool mPool; // Pool of AABBs + + // maps pruning pool indices to aabb tree indices + // maps to INVALID_NODE_ID if the pool entry was removed or "pool index is outside input domain" + // The map is the inverse of the tree mapping: (node[map[poolID]].primitive == poolID) + // So: + // treeNodeIndex = mTreeMap.operator[](poolIndex) + // aabbTree->treeNodes[treeNodeIndex].primitives[0] == poolIndex + AABBTreeUpdateMap mTreeMap; + // Temporary update map, see BuildStatus notes above for details + AABBTreeUpdateMap mNewTreeMap; + + // This is only set once in the constructor and is equivalent to isDynamicTree + // if it set to false then a 1-shot rebuild is performed in commit() + // bucket pruner is only used with incremental rebuild + const bool mIncrementalRebuild; + + // A rebuild can be triggered even when the Pruner is not dirty + // mUncommittedChanges is set to true in add, remove, update and buildStep + // mUncommittedChanges is set to false in commit + // mUncommittedChanges has to be false (commit() has to be called) in order to run a query as defined by the + // mUncommittedChanges is not set to true in add, when pruning structure is provided. Scene query shapes + // are merged to current AABB tree directly + // Pruner higher level API + bool mUncommittedChanges; + + // A new AABB tree is built if an object was added, removed or updated + // Changing objects during a build will trigger another rebuild right afterwards + // this is set to true if a new tree has to be created again after the current rebuild is done + bool mNeedsNewTree; + + // This struct is used to record modifications made to the pruner state + // while a tree is building in the background + // this is so we can apply the modifications to the tree at the time of completion + // the recorded fixup information is: removedIndex (in ::remove()) and + // lastIndexMoved which is the last index in the pruner array + // (since the way we remove from PruningPool is by swapping last into removed slot, + // we need to apply a fixup so that it syncs up that operation in the new tree) + struct NewTreeFixup + { + PX_FORCE_INLINE NewTreeFixup(PxU32 removedIndex_, PxU32 relocatedLastIndex_) + : removedIndex(removedIndex_), relocatedLastIndex(relocatedLastIndex_) {} + PxU32 removedIndex; + PxU32 relocatedLastIndex; + }; + PxArray mNewTreeFixups; + + PxArray mToRefit; + + // Internal methods + bool fullRebuildAABBTree(); // full rebuild function, used with static pruner mode + void release(); + void refitUpdatedAndRemoved(); + void updateBucketPruner(); + }; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp new file mode 100644 index 0000000..5a4bc4b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.cpp @@ -0,0 +1,1419 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuAABBTreeBounds.h" +#include "GuAABBTree.h" +#include "GuAABBTreeBuildStats.h" +#include "GuBounds.h" +#include "GuAABBTreeNode.h" +#include "GuSAH.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +void AABBTreeBounds::init(PxU32 nbBounds, const PxBounds3* bounds) +{ + PX_FREE(mBounds); + // PT: we always allocate one extra box, to make sure we can safely use V4 loads on the array + mBounds = PX_ALLOCATE(PxBounds3, (nbBounds + 1), "AABBTreeBounds"); + if(bounds) + PxMemCopy(mBounds, bounds, nbBounds*sizeof(PxBounds3)); +} + +void AABBTreeBounds::resize(PxU32 newSize, PxU32 previousSize) +{ + PxBounds3* newBounds = PX_ALLOCATE(PxBounds3, (newSize + 1), "AABBTreeBounds"); + if(mBounds && previousSize) + PxMemCopy(newBounds, mBounds, sizeof(PxBounds3)*previousSize); + PX_FREE(mBounds); + mBounds = newBounds; +} + +void AABBTreeBounds::release() +{ + if(!mUserAllocated) + PX_FREE(mBounds); +} + +/////////////////////////////////////////////////////////////////////////////// + +NodeAllocator::NodeAllocator() : mPool(NULL), mCurrentSlabIndex(0), mTotalNbNodes(0) +{ +} + +NodeAllocator::~NodeAllocator() +{ + release(); +} + +void NodeAllocator::release() +{ + const PxU32 nbSlabs = mSlabs.size(); + for (PxU32 i = 0; imNodeIndex = 0; + mPool->mNbPrimitives = nbPrimitives; + + mSlabs.pushBack(Slab(mPool, 1, estimatedFinalSize)); + mCurrentSlabIndex = 0; + mTotalNbNodes = 1; +} + +// PT: TODO: inline this? +AABBTreeBuildNode* NodeAllocator::getBiNode() +{ + mTotalNbNodes += 2; + Slab& currentSlab = mSlabs[mCurrentSlabIndex]; + if (currentSlab.mNbUsedNodes + 2 <= currentSlab.mMaxNbNodes) + { + AABBTreeBuildNode* biNode = currentSlab.mPool + currentSlab.mNbUsedNodes; + currentSlab.mNbUsedNodes += 2; + return biNode; + } + else + { + // Allocate new slab + const PxU32 size = 1024; + AABBTreeBuildNode* pool = PX_NEW(AABBTreeBuildNode)[size]; + PxMemZero(pool, sizeof(AABBTreeBuildNode)*size); + + mSlabs.pushBack(Slab(pool, 2, size)); + mCurrentSlabIndex++; + return pool; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 Gu::reshuffle(PxU32 nb, PxU32* const PX_RESTRICT prims, const PxVec3* PX_RESTRICT centers, float splitValue, PxU32 axis) +{ + // PT: to avoid calling the unsafe [] operator + const size_t ptrValue = size_t(centers) + axis*sizeof(float); + const PxVec3* PX_RESTRICT centersX = reinterpret_cast(ptrValue); + + // Loop through all node-related primitives. Their indices range from mNodePrimitives[0] to mNodePrimitives[mNbPrimitives-1]. + // Those indices map the global list in the tree builder. + PxU32 nbPos = 0; + for(PxU32 i=0; i splitValue) + { + // Swap entries + prims[i] = prims[nbPos]; + prims[nbPos] = index; + // Count primitives assigned to positive space + nbPos++; + } + } + return nbPos; +} + +static PxU32 split(const PxBounds3& box, PxU32 nb, PxU32* const PX_RESTRICT prims, PxU32 axis, const AABBTreeBuildParams& params) +{ + // Get node split value + float splitValue = 0.0f; + //float defaultSplitValue = box.getCenter(axis); + //(void)defaultSplitValue; + if(params.mBuildStrategy==BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER) + { + // PT: experimental attempt at replicating BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER, but with boxes instead of triangles. + const PxBounds3* bounds = params.mBounds->getBounds(); + for(PxU32 i=0;igetBounds(); + PX_ASSERT(boxes); + PX_ASSERT(primitives); + PX_ASSERT(nbPrims); + + Vec4V minV = V4LoadU(&boxes[primitives[0]].minimum.x); + Vec4V maxV = V4LoadU(&boxes[primitives[0]].maximum.x); + + meansV = V4LoadU(¶ms.mCache[primitives[0]].x); + + for (PxU32 i = 1; iparams.mLimit) + { + nbPos = nbPrims >> 1; + } + else return; + } + + // Now create children and assign their pointers. + mPos = allocator.getBiNode(); + + stats.increaseCount(2); + + // Assign children + PX_ASSERT(!isLeaf()); + AABBTreeBuildNode* Pos = const_cast(mPos); + AABBTreeBuildNode* Neg = Pos + 1; + Pos->mNodeIndex = mNodeIndex; + Pos->mNbPrimitives = nbPos; + Neg->mNodeIndex = mNodeIndex + nbPos; + Neg->mNbPrimitives = mNbPrimitives - nbPos; +} + +void AABBTreeBuildNode::_buildHierarchy(const AABBTreeBuildParams& params, BuildStats& stats, NodeAllocator& nodeBase, PxU32* const indices) +{ + // Subdivide current node + subdivide(params, stats, nodeBase, indices); + + // Recurse + if (!isLeaf()) + { + AABBTreeBuildNode* Pos = const_cast(getPos()); + PX_ASSERT(Pos); + AABBTreeBuildNode* Neg = Pos + 1; + Pos->_buildHierarchy(params, stats, nodeBase, indices); + Neg->_buildHierarchy(params, stats, nodeBase, indices); + } + + stats.mTotalPrims += mNbPrimitives; +} + +void AABBTreeBuildNode::subdivideSAH(const AABBTreeBuildParams& params, SAH_Buffers& buffers, BuildStats& stats, NodeAllocator& allocator, PxU32* const indices) +{ + PxU32* const PX_RESTRICT primitives = indices + mNodeIndex; + const PxU32 nbPrims = mNbPrimitives; + + // Compute global box for current node. The box is stored in mBV. + computeGlobalBox(mBV, nbPrims, params.mBounds->getBounds(), primitives); + + // Check the user-defined limit. Also ensures we stop subdividing if we reach a leaf node. + if (nbPrims <= params.mLimit) + return; + + ///// + + PxU32 leftCount; + if(!buffers.split(leftCount, nbPrims, primitives, params.mBounds->getBounds(), params.mCache)) + { + // Invalid split => fallback to previous strategy + subdivide(params, stats, allocator, indices); + return; + } + + ///// + + // Now create children and assign their pointers. + mPos = allocator.getBiNode(); + + stats.increaseCount(2); + + // Assign children + PX_ASSERT(!isLeaf()); + AABBTreeBuildNode* Pos = const_cast(mPos); + AABBTreeBuildNode* Neg = Pos + 1; + Pos->mNodeIndex = mNodeIndex; + Pos->mNbPrimitives = leftCount; + Neg->mNodeIndex = mNodeIndex + leftCount; + Neg->mNbPrimitives = mNbPrimitives - leftCount; +} + +void AABBTreeBuildNode::_buildHierarchySAH(const AABBTreeBuildParams& params, SAH_Buffers& sah, BuildStats& stats, NodeAllocator& nodeBase, PxU32* const indices) +{ + // Subdivide current node + subdivideSAH(params, sah, stats, nodeBase, indices); + + // Recurse + if (!isLeaf()) + { + AABBTreeBuildNode* Pos = const_cast(getPos()); + PX_ASSERT(Pos); + AABBTreeBuildNode* Neg = Pos + 1; + Pos->_buildHierarchySAH(params, sah, stats, nodeBase, indices); + Neg->_buildHierarchySAH(params, sah, stats, nodeBase, indices); + } + + stats.mTotalPrims += mNbPrimitives; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxU32* initAABBTreeBuild(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats) +{ + const PxU32 numPrimitives = params.mNbPrimitives; + + if(!numPrimitives) + return NULL; + + // Init stats + stats.setCount(1); + + // Initialize indices. This list will be modified during build. + PxU32* indices = PX_ALLOCATE(PxU32, numPrimitives, "AABB tree indices"); + // Identity permutation + for(PxU32 i=0;igetBounds(); + const float half = 0.5f; + const FloatV halfV = FLoad(half); + for(PxU32 i=0;i_buildHierarchySAH(params, buffers, stats, nodeAllocator, indices); + } + else + nodeAllocator.mPool->_buildHierarchy(params, stats, nodeAllocator, indices); + + return indices; +} + +void Gu::flattenTree(const NodeAllocator& nodeAllocator, BVHNode* dest, const PxU32* remap) +{ + // PT: gathers all build nodes allocated so far and flatten them to a linear destination array of smaller runtime nodes + PxU32 offset = 0; + const PxU32 nbSlabs = nodeAllocator.mSlabs.size(); + for(PxU32 s=0;s= nodeAllocator.mSlabs[j].mPool && pool[i].mPos < nodeAllocator.mSlabs[j].mPool + nodeAllocator.mSlabs[j].mNbUsedNodes) + { + localNodeIndex = PxU32(pool[i].mPos - nodeAllocator.mSlabs[j].mPool); + break; + } + nodeBase += nodeAllocator.mSlabs[j].mNbUsedNodes; + } + const PxU32 nodeIndex = nodeBase + localNodeIndex; + dest[offset].mData = nodeIndex << 1; + } + offset++; + } + } +} + +void Gu::buildAABBTree(PxU32 nbBounds, const AABBTreeBounds& bounds, PxArray& tree) +{ + PX_SIMD_GUARD + // build the BVH + BuildStats stats; + NodeAllocator nodeAllocator; + + PxU32* indices = buildAABBTree(AABBTreeBuildParams(1, nbBounds, &bounds), nodeAllocator, stats); + PX_ASSERT(indices); + + // store the computed hierarchy + tree.resize(stats.getCount()); + PX_ASSERT(tree.size() == nodeAllocator.mTotalNbNodes); + + // store the results into BVHNode list + flattenTree(nodeAllocator, tree.begin(), indices); + PX_FREE(indices); // PT: we don't need the indices for a complete tree +} + +/////////////////////////////////////////////////////////////////////////////// + +// Progressive building +class Gu::FIFOStack : public PxUserAllocated +{ +public: + FIFOStack() : mStack("SQFIFOStack"), mCurIndex(0) {} + ~FIFOStack() {} + + PX_FORCE_INLINE PxU32 getNbEntries() const { return mStack.size(); } + PX_FORCE_INLINE void push(AABBTreeBuildNode* entry) { mStack.pushBack(entry); } + bool pop(AABBTreeBuildNode*& entry); +private: + PxArray mStack; + PxU32 mCurIndex; //!< Current index within the container +}; + +bool Gu::FIFOStack::pop(AABBTreeBuildNode*& entry) +{ + const PxU32 NbEntries = mStack.size(); // Get current number of entries + if (!NbEntries) + return false; // Can be NULL when no value has been pushed. This is an invalid pop call. + entry = mStack[mCurIndex++]; // Get oldest entry, move to next one + if (mCurIndex == NbEntries) + { + // All values have been poped + mStack.clear(); + mCurIndex = 0; + } + return true; +} +//~Progressive building + +/////////////////////////////////////////////////////////////////////////////// + +BVHPartialRefitData::BVHPartialRefitData() : mParentIndices(NULL), mUpdateMap(NULL), mRefitHighestSetWord(0) +{ +} + +BVHPartialRefitData::~BVHPartialRefitData() +{ + releasePartialRefitData(true); +} + +void BVHPartialRefitData::releasePartialRefitData(bool clearRefitMap) +{ + PX_FREE(mParentIndices); + PX_FREE(mUpdateMap); + + if(clearRefitMap) + mRefitBitmask.clearAll(); + mRefitHighestSetWord = 0; +} + +static void createParentArray(PxU32 totalNbNodes, PxU32* parentIndices, const BVHNode* parentNode, const BVHNode* currentNode, const BVHNode* root) +{ + const PxU32 parentIndex = PxU32(parentNode - root); + const PxU32 currentIndex = PxU32(currentNode - root); + PX_ASSERT(parentIndexisLeaf()) + { + createParentArray(totalNbNodes, parentIndices, currentNode, currentNode->getPos(root), root); + createParentArray(totalNbNodes, parentIndices, currentNode, currentNode->getNeg(root), root); + } +} + +PxU32* BVHPartialRefitData::getParentIndices() +{ + // PT: lazy-create parent array. Memory is not wasted for purely static trees, or dynamic trees that only do "full refit". + if(!mParentIndices) + { + mParentIndices = PX_ALLOCATE(PxU32, mNbNodes, "AABB parent indices"); + createParentArray(mNbNodes, mParentIndices, mNodes, mNodes, mNodes); + } + return mParentIndices; +} + +void BVHPartialRefitData::createUpdateMap(PxU32 nbObjects) +{ + // PT: we need an "update map" for PxBVH + // PT: TODO: consider refactoring with the AABBtree version + PX_FREE(mUpdateMap); + + if(!nbObjects) + return; + + mUpdateMap = PX_ALLOCATE(PxU32, nbObjects, "UpdateMap"); + PxMemSet(mUpdateMap, 0xff, sizeof(PxU32)*nbObjects); + + const PxU32 nbNodes = mNbNodes; + const BVHNode* nodes = mNodes; + const PxU32* indices = mIndices; + for(TreeNodeIndex i=0;i>5) + ((nb_bits&31) ? 1 : 0); +} + +bool BitArray::init(PxU32 nb_bits) +{ + mSize = BitsToDwords(nb_bits); + // Get ram for n bits + PX_FREE(mBits); + mBits = PX_ALLOCATE(PxU32, mSize, "BitArray::mBits"); + // Set all bits to 0 + clearAll(); + return true; +} + +void BitArray::resize(PxU32 maxBitNumber) +{ + const PxU32 newSize = BitsToDwords(maxBitNumber); + if (newSize <= mSize) + return; + + PxU32* newBits = PX_ALLOCATE(PxU32, newSize, "BitArray::mBits"); + PxMemZero(newBits + mSize, (newSize - mSize) * sizeof(PxU32)); + PxMemCopy(newBits, mBits, mSize*sizeof(PxU32)); + PX_FREE(mBits); + mBits = newBits; + mSize = newSize; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxU32 getNbPrimitives(PxU32 data) { return (data>>1)&15; } +static PX_FORCE_INLINE const PxU32* getPrimitives(const PxU32* base, PxU32 data) { return base + (data>>5); } +static PX_FORCE_INLINE const BVHNode* getPos(const BVHNode* base, PxU32 data) { return base + (data>>1); } +static PX_FORCE_INLINE PxU32 isLeaf(PxU32 data) { return data&1; } + +template +static PX_FORCE_INLINE void refitNode(BVHNode* PX_RESTRICT current, const PxBounds3* PX_RESTRICT boxes, const PxU32* PX_RESTRICT indices, BVHNode* PX_RESTRICT const nodeBase) +{ + // PT: we can safely use V4 loads on both boxes and nodes here: + // - it's safe on boxes because we allocated one extra box in the pruning pool + // - it's safe on nodes because there's always some data within the node, after the BV + + const PxU32 data = current->mData; + + Vec4V resultMinV, resultMaxV; + if(isLeaf(data)) + { + const PxU32 nbPrims = getNbPrimitives(data); + if(nbPrims) + { + if(hasIndices) + { + const PxU32* primitives = getPrimitives(indices, data); + resultMinV = V4LoadU(&boxes[*primitives].minimum.x); + resultMaxV = V4LoadU(&boxes[*primitives].maximum.x); + + if(nbPrims>1) + { + const PxU32* last = primitives + nbPrims; + primitives++; + + while(primitives!=last) + { + resultMinV = V4Min(resultMinV, V4LoadU(&boxes[*primitives].minimum.x)); + resultMaxV = V4Max(resultMaxV, V4LoadU(&boxes[*primitives].maximum.x)); + primitives++; + } + } + } + else + { + PX_ASSERT(nbPrims==1); + const PxU32 primIndex = data>>5; + resultMinV = V4LoadU(&boxes[primIndex].minimum.x); + resultMaxV = V4LoadU(&boxes[primIndex].maximum.x); + } + } + else + { + // Might happen after a node has been invalidated + const float max = GU_EMPTY_BOUNDS_EXTENTS; + resultMinV = V4Load(max); + resultMaxV = V4Load(-max); + } + } + else + { + const BVHNode* pos = getPos(nodeBase, data); + const BVHNode* neg = pos+1; + + const PxBounds3& posBox = pos->mBV; + const PxBounds3& negBox = neg->mBV; + + resultMinV = V4Min(V4LoadU(&posBox.minimum.x), V4LoadU(&negBox.minimum.x)); +// resultMaxV = V4Max(V4LoadU(&posBox.maximum.x), V4LoadU(&negBox.maximum.x)); + +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) + Vec4V posMinV = V4LoadU(&posBox.minimum.z); + Vec4V negMinV = V4LoadU(&negBox.minimum.z); + posMinV = _mm_shuffle_ps(posMinV, posMinV, _MM_SHUFFLE(0, 3, 2, 1)); + negMinV = _mm_shuffle_ps(negMinV, negMinV, _MM_SHUFFLE(0, 3, 2, 1)); + resultMaxV = V4Max(posMinV, negMinV); +#else + // PT: fixes the perf issue but not really convincing + resultMaxV = Vec4V_From_Vec3V(V3Max(V3LoadU(&posBox.maximum.x), V3LoadU(&negBox.maximum.x))); +#endif + } + + // PT: the V4 stores overwrite the data after the BV, but we just put it back afterwards + V4StoreU(resultMinV, ¤t->mBV.minimum.x); + V4StoreU(resultMaxV, ¤t->mBV.maximum.x); + current->mData = data; +} + +template +static void refitLoop(const PxBounds3* PX_RESTRICT boxes, BVHNode* const PX_RESTRICT nodeBase, const PxU32* PX_RESTRICT indices, PxU32 nbNodes) +{ + PX_ASSERT(boxes); + PX_ASSERT(nodeBase); + // Bottom-up update + PxU32 index = nbNodes; + while(index--) + { + BVHNode* current = nodeBase + index; + if(index) + PxPrefetch(current - 1); + +// PxBounds3 before = current->mBV; + + if(hasIndices) + refitNode<1>(current, boxes, indices, nodeBase); + else + refitNode<0>(current, boxes, indices, nodeBase); + +// if(current->mBV.minimum==before.minimum && current->mBV.maximum==before.maximum) +// break; + } +} + +void BVHCoreData::fullRefit(const PxBounds3* boxes) +{ + if(mIndices) + refitLoop<1>(boxes, mNodes, mIndices, mNbNodes); + else + refitLoop<0>(boxes, mNodes, mIndices, mNbNodes); +} + +void BVHPartialRefitData::markNodeForRefit(TreeNodeIndex nodeIndex) +{ + BitArray* PX_RESTRICT refitBitmask = &mRefitBitmask; + + if(!refitBitmask->getBits()) + refitBitmask->init(mNbNodes); + + PX_ASSERT(nodeIndexisSet(currentIndex)) + { + // We can early exit if we already visited the node! + goto Exit; + } + else + { + refitBitmask->setBit(currentIndex); + const PxU32 currentMarkedWord = currentIndex>>5; + refitHighestSetWord = PxMax(refitHighestSetWord, currentMarkedWord); + + const PxU32 parentIndex = parentIndices[currentIndex]; + PX_ASSERT(parentIndex == 0 || parentIndex < currentIndex); + if(currentIndex == parentIndex) + break; + currentIndex = parentIndex; + } + } +Exit: + mRefitHighestSetWord = refitHighestSetWord; +} + +#define FIRST_VERSION +#ifdef FIRST_VERSION +template +static void refitMarkedLoop(const PxBounds3* PX_RESTRICT boxes, BVHNode* const PX_RESTRICT nodeBase, const PxU32* PX_RESTRICT indices, PxU32* PX_RESTRICT bits, PxU32 nbToGo) +{ +#ifdef _DEBUG + PxU32 nbRefit=0; +#endif + + PxU32 size = nbToGo; + + while(size--) + { + // Test 32 bits at a time + const PxU32 currentBits = bits[size]; + if(!currentBits) + continue; + + PxU32 index = (size+1)<<5; + PxU32 mask = PxU32(1<<((index-1)&31)); + PxU32 count=32; + while(count--) + { + index--; + PxPrefetch(nodeBase + index); + + PX_ASSERT(size==index>>5); + PX_ASSERT(mask==PxU32(1<<(index&31))); + if(currentBits & mask) + { + if(hasIndices) + refitNode<1>(nodeBase + index, boxes, indices, nodeBase); + else + refitNode<0>(nodeBase + index, boxes, indices, nodeBase); +#ifdef _DEBUG + nbRefit++; +#endif + } + mask>>=1; + } + bits[size] = 0; + } +} + +void BVHPartialRefitData::refitMarkedNodes(const PxBounds3* boxes) +{ + if(!mRefitBitmask.getBits()) + return; // No refit needed + + { + /*const*/ PxU32* bits = const_cast(mRefitBitmask.getBits()); + PxU32 size = mRefitHighestSetWord+1; +#ifdef _DEBUG + if(1) + { + const PxU32 totalSize = mRefitBitmask.getSize(); + for(PxU32 i=size;i(boxes, mNodes, mIndices, bits, size); + else + refitMarkedLoop<0>(boxes, mNodes, mIndices, bits, size); + + mRefitHighestSetWord = 0; +// mRefitBitmask.clearAll(); + } +} +#endif + + +//#define SECOND_VERSION +#ifdef SECOND_VERSION +void BVHPartialRefitData::refitMarkedNodes(const PxBounds3* boxes) +{ + /*const*/ PxU32* bits = const_cast(mRefitBitmask.getBits()); + if(!bits) + return; // No refit needed + + const PxU32 lastSetBit = mRefitBitmask.findLast(); + + const PxU32* indices = mIndices; + BVHNode* const nodeBase = mNodes; + + // PT: ### bitmap iterator pattern + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) + { + for(PxU32 b = bits[w]; b; b &= b-1) + { + const PxU32 index = (PxU32)(w<<5|PxLowestSetBit(b)); + + + + while(size--) + { + // Test 32 bits at a time + const PxU32 currentBits = bits[size]; + if(!currentBits) + continue; + + PxU32 index = (size+1)<<5; + PxU32 mask = PxU32(1<<((index-1)&31)); + PxU32 count=32; + while(count--) + { + index--; + PxPrefetch(nodeBase + index); + + PX_ASSERT(size==index>>5); + PX_ASSERT(mask==PxU32(1<<(index&31))); + if(currentBits & mask) + { + refitNode(nodeBase + index, boxes, indices, nodeBase); +#ifdef _DEBUG + nbRefit++; +#endif + } + mask>>=1; + } + bits[size] = 0; + } + mRefitHighestSetWord = 0; +// mRefitBitmask.clearAll(); + } +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +AABBTree::AABBTree() : mTotalPrims(0) +{ +// Progressive building + mStack = NULL; +//~Progressive building +} + +AABBTree::~AABBTree() +{ + release(false); +} + +void AABBTree::release(bool clearRefitMap) +{ +// Progressive building + PX_DELETE(mStack); +//~Progressive building + releasePartialRefitData(clearRefitMap); + // PT: TODO: move some to BVHCoreData dtor + PX_DELETE_ARRAY(mNodes); + PX_FREE(mIndices); + mNbNodes = 0; + mNbIndices = 0; +} + +// Initialize nodes/indices from the input tree merge data +void AABBTree::initTree(const AABBTreeMergeData& tree) +{ + PX_ASSERT(mIndices == NULL); + PX_ASSERT(mNodes == NULL); + PX_ASSERT(mParentIndices == NULL); + + // allocate,copy indices + mIndices = PX_ALLOCATE(PxU32, tree.mNbIndices, "AABB tree indices"); + mNbIndices = tree.mNbIndices; + PxMemCopy(mIndices, tree.mIndices, sizeof(PxU32)*tree.mNbIndices); + + // allocate,copy nodes + mNodes = PX_NEW(BVHNode)[tree.mNbNodes]; + mNbNodes = tree.mNbNodes; + PxMemCopy(mNodes, tree.mNodes, sizeof(BVHNode)*tree.mNbNodes); +} + +// Shift indices of the tree by offset. Used for merged trees, when initial indices needs to be shifted to match indices in current pruning pool +void AABBTree::shiftIndices(PxU32 offset) +{ + for (PxU32 i = 0; i < mNbIndices; i++) + { + mIndices[i] += offset; + } +} + +bool AABBTree::buildInit(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats) +{ + // Checkings + const PxU32 nbPrimitives = params.mNbPrimitives; + if(!nbPrimitives) + return false; + + // Release previous tree + release(); + + // Initialize indices. This list will be modified during build. + mNbIndices = nbPrimitives; + + PxU32* indices = initAABBTreeBuild(params, nodeAllocator, stats); + if(!indices) + return false; + + PX_ASSERT(!mIndices); + mIndices = indices; + + return true; +} + +void AABBTree::buildEnd(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, const BuildStats& stats) +{ + PX_FREE(params.mCache); + // Get back total number of nodes + mNbNodes = stats.getCount(); + mTotalPrims = stats.mTotalPrims; + + mNodes = PX_NEW(BVHNode)[mNbNodes]; + PX_ASSERT(mNbNodes==nodeAllocator.mTotalNbNodes); + flattenTree(nodeAllocator, mNodes); + nodeAllocator.release(); +} + +bool AABBTree::build(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator) +{ + const PxU32 nbPrimitives = params.mNbPrimitives; + if(!nbPrimitives) + return false; + + // Release previous tree + release(); + + BuildStats stats; + mNbIndices = nbPrimitives; + + mIndices = buildAABBTree(params, nodeAllocator, stats); + if(!mIndices) + return false; + + buildEnd(params, nodeAllocator, stats); + return true; +} + +void AABBTree::shiftOrigin(const PxVec3& shift) +{ + BVHNode* const nodeBase = mNodes; + const PxU32 totalNbNodes = mNbNodes; + for(PxU32 i=0; isubdivide(params, stats, nodeBase, indices); + + if(!node->isLeaf()) + { + AABBTreeBuildNode* pos = const_cast(node->getPos()); + PX_ASSERT(pos); + AABBTreeBuildNode* neg = pos + 1; + stack.push(neg); + stack.push(pos); + } + + stats.mTotalPrims += node->mNbPrimitives; + return node->mNbPrimitives; +} + +PxU32 AABBTree::progressiveBuild(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats, PxU32 progress, PxU32 limit) +{ + if(progress==0) + { + if(!buildInit(params, nodeAllocator, stats)) + return PX_INVALID_U32; + + mStack = PX_NEW(FIFOStack); + mStack->push(nodeAllocator.mPool); + return progress++; + } + else if(progress==1) + { + PxU32 stackCount = mStack->getNbEntries(); + if(stackCount) + { + PxU32 Total = 0; + const PxU32 Limit = limit; + while(Totalpop(Entry)) + Total += incrementalBuildHierarchy(*mStack, Entry, params, stats, nodeAllocator, mIndices); + else + break; + } + return progress; + } + + buildEnd(params, nodeAllocator, stats); + + PX_DELETE(mStack); + + return 0; // Done! + } + return PX_INVALID_U32; +} +//~Progressive building + +PX_FORCE_INLINE static void setLeafData(PxU32& leafData, const BVHNode& node, const PxU32 indicesOffset) +{ + const PxU32 index = indicesOffset + (node.mData >> 5); + const PxU32 nbPrims = node.getNbPrimitives(); + PX_ASSERT(nbPrims < 16); + leafData = (index << 5) | ((nbPrims & 15) << 1) | 1; +} + +// Copy the tree into nodes. Update node indices, leaf indices. +void AABBTree::addRuntimeChilds(PxU32& nodeIndex, const AABBTreeMergeData& treeParams) +{ + PX_ASSERT(nodeIndex < mNbNodes + treeParams.mNbNodes + 1); + const PxU32 baseNodeIndex = nodeIndex; + + // copy the src tree into dest tree nodes, update its data + for (PxU32 i = 0; i < treeParams.mNbNodes; i++) + { + PX_ASSERT(nodeIndex < mNbNodes + treeParams.mNbNodes + 1); + mNodes[nodeIndex].mBV = treeParams.mNodes[i].mBV; + if (treeParams.mNodes[i].isLeaf()) + { + setLeafData(mNodes[nodeIndex].mData, treeParams.mNodes[i], mNbIndices); + } + else + { + const PxU32 srcNodeIndex = baseNodeIndex + (treeParams.mNodes[i].getPosIndex()); + mNodes[nodeIndex].mData = srcNodeIndex << 1; + mParentIndices[srcNodeIndex] = nodeIndex; + mParentIndices[srcNodeIndex + 1] = nodeIndex; + } + nodeIndex++; + } +} + +// Merge tree into targetNode, where target node is a leaf +// 1. Allocate new nodes/parent, copy all the nodes/parents +// 2. Create new node at the end, copy the data from target node +// 3. Copy the merge tree after the new node, create the parent map for them, update the leaf indices +// Schematic view: +// Target Nodes: ...Tn... +// Input tree: R1->Rc0, Rc1... +// Merged tree: ...Tnc->...->Nc0,R1->Rc0,Rc1... +// where new node: Nc0==Tn and Tnc is not a leaf anymore and points to Nc0 + +void AABBTree::mergeRuntimeLeaf(BVHNode& targetNode, const AABBTreeMergeData& treeParams, PxU32 targetMergeNodeIndex) +{ + PX_ASSERT(mParentIndices); + PX_ASSERT(targetNode.isLeaf()); + + // 1. Allocate new nodes/parent, copy all the nodes/parents + // allocate new runtime pool with max combine number of nodes + // we allocate only 1 additional node each merge + BVHNode* newRuntimePool = PX_NEW(BVHNode)[mNbNodes + treeParams.mNbNodes + 1]; + PxU32* newParentIndices = PX_ALLOCATE(PxU32, (mNbNodes + treeParams.mNbNodes + 1), "AABB parent indices"); + + // copy the whole target nodes, we will add the new node at the end together with the merge tree + PxMemCopy(newRuntimePool, mNodes, sizeof(BVHNode)*(mNbNodes)); + PxMemCopy(newParentIndices, mParentIndices, sizeof(PxU32)*(mNbNodes)); + + // 2. Create new node at the end, copy the data from target node + PxU32 nodeIndex = mNbNodes; + // copy the targetNode at the end of the new nodes + newRuntimePool[nodeIndex].mBV = targetNode.mBV; + newRuntimePool[nodeIndex].mData = targetNode.mData; + // update the parent information + newParentIndices[nodeIndex] = targetMergeNodeIndex; + + // mark for refit + if (mRefitBitmask.getBits() && mRefitBitmask.isSet(targetMergeNodeIndex)) + { + mRefitBitmask.setBit(nodeIndex); + const PxU32 currentMarkedWord = nodeIndex >> 5; + mRefitHighestSetWord = PxMax(mRefitHighestSetWord, currentMarkedWord); + } + + // swap pointers + PX_DELETE_ARRAY(mNodes); + mNodes = newRuntimePool; + PX_FREE(mParentIndices); + mParentIndices = newParentIndices; + + // 3. Copy the merge tree after the new node, create the parent map for them, update the leaf indices + nodeIndex++; + addRuntimeChilds(nodeIndex, treeParams); + PX_ASSERT(nodeIndex == mNbNodes + 1 + treeParams.mNbNodes); + + // update the parent information for the input tree root node + mParentIndices[mNbNodes + 1] = targetMergeNodeIndex; + + // fix the child information for the target node, was a leaf before + mNodes[targetMergeNodeIndex].mData = mNbNodes << 1; + + // update the total number of nodes + mNbNodes = mNbNodes + 1 + treeParams.mNbNodes; +} + +// Merge tree into targetNode, where target node is not a leaf +// 1. Allocate new nodes/parent, copy the nodes/parents till targetNodePosIndex +// 2. Create new node , copy the data from target node +// 3. Copy the rest of the target tree nodes/parents at the end -> targetNodePosIndex + 1 + treeParams.mNbNodes +// 4. Copy the merge tree after the new node, create the parent map for them, update the leaf indices +// 5. Go through the nodes copied at the end and fix the parents/childs +// Schematic view: +// Target Nodes: ...Tn->...->Tc0,Tc1... +// Input tree: R1->Rc0, Rc1... +// Merged tree: ...Tn->...->Nc0,R1->Rc0,Rc1...,Tc0,Tc1... +// where new node: Nc0->...->Tc0,Tc1 +void AABBTree::mergeRuntimeNode(BVHNode& targetNode, const AABBTreeMergeData& treeParams, PxU32 targetMergeNodeIndex) +{ + PX_ASSERT(mParentIndices); + PX_ASSERT(!targetNode.isLeaf()); + + // Get the target node child pos, this is where we insert the new node and the input tree + const PxU32 targetNodePosIndex = targetNode.getPosIndex(); + + // 1. Allocate new nodes/parent, copy the nodes/parents till targetNodePosIndex + // allocate new runtime pool with max combine number of nodes + // we allocate only 1 additional node each merge + BVHNode* newRuntimePool = PX_NEW(BVHNode)[mNbNodes + treeParams.mNbNodes + 1]; + PxU32* newParentIndices = PX_ALLOCATE(PxU32, (mNbNodes + treeParams.mNbNodes + 1), "AABB parent indices"); + // copy the untouched part of the nodes and parents + PxMemCopy(newRuntimePool, mNodes, sizeof(BVHNode)*(targetNodePosIndex)); + PxMemCopy(newParentIndices, mParentIndices, sizeof(PxU32)*(targetNodePosIndex)); + + PxU32 nodeIndex = targetNodePosIndex; + // 2. Create new node , copy the data from target node + newRuntimePool[nodeIndex].mBV = targetNode.mBV; + newRuntimePool[nodeIndex].mData = ((targetNode.mData >> 1) + 1 + treeParams.mNbNodes) << 1; + // update parent information + newParentIndices[nodeIndex] = targetMergeNodeIndex; + + // handle mark for refit + if(mRefitBitmask.getBits() && mRefitBitmask.isSet(targetMergeNodeIndex)) + { + mRefitBitmask.setBit(nodeIndex); + const PxU32 currentMarkedWord = nodeIndex >> 5; + mRefitHighestSetWord = PxMax(mRefitHighestSetWord, currentMarkedWord); + } + + // 3. Copy the rest of the target tree nodes/parents at the end -> targetNodePosIndex + 1 + treeParams.mNbNodes + if(mNbNodes - targetNodePosIndex) + { + PX_ASSERT(mNbNodes - targetNodePosIndex > 0); + PxMemCopy(newRuntimePool + targetNodePosIndex + 1 + treeParams.mNbNodes, mNodes + targetNodePosIndex, sizeof(BVHNode)*(mNbNodes - targetNodePosIndex)); + PxMemCopy(newParentIndices + targetNodePosIndex + 1 + treeParams.mNbNodes, mParentIndices + targetNodePosIndex, sizeof(PxU32)*(mNbNodes - targetNodePosIndex)); + } + // swap the pointers, release the old memory + PX_DELETE_ARRAY(mNodes); + mNodes = newRuntimePool; + PX_FREE(mParentIndices); + mParentIndices = newParentIndices; + + // 4. Copy the merge tree after the new node, create the parent map for them, update the leaf indices + nodeIndex++; + addRuntimeChilds(nodeIndex, treeParams); + PX_ASSERT(nodeIndex == targetNodePosIndex + 1 + treeParams.mNbNodes); + // update the total number of nodes + mNbNodes = mNbNodes + 1 + treeParams.mNbNodes; + + // update the parent information for the input tree root node + mParentIndices[targetNodePosIndex + 1] = targetMergeNodeIndex; + + // 5. Go through the nodes copied at the end and fix the parents/childs + for (PxU32 i = targetNodePosIndex + 1 + treeParams.mNbNodes; i < mNbNodes; i++) + { + // check if the parent is the targetNode, if yes update the parent to new node + if(mParentIndices[i] == targetMergeNodeIndex) + { + mParentIndices[i] = targetNodePosIndex; + } + else + { + // if parent node has been moved, update the parent node + if(mParentIndices[i] >= targetNodePosIndex) + { + mParentIndices[i] = mParentIndices[i] + 1 + treeParams.mNbNodes; + } + else + { + // if parent has not been moved, update its child information + const PxU32 parentIndex = mParentIndices[i]; + // update the child information to point to Pos child + if(i % 2 != 0) + { + const PxU32 srcNodeIndex = mNodes[parentIndex].getPosIndex(); + // if child index points to a node that has been moved, update the child index + PX_ASSERT(!mNodes[parentIndex].isLeaf()); + PX_ASSERT(srcNodeIndex > targetNodePosIndex); + mNodes[parentIndex].mData = (1 + treeParams.mNbNodes + srcNodeIndex) << 1; + } + } + } + if(!mNodes[i].isLeaf()) + { + // update the child node index + const PxU32 srcNodeIndex = 1 + treeParams.mNbNodes + mNodes[i].getPosIndex(); + mNodes[i].mData = srcNodeIndex << 1; + } + } +} + +// traverse the target node, the tree is inside the targetNode, and find the best place where merge the tree +void AABBTree::traverseRuntimeNode(BVHNode& targetNode, const AABBTreeMergeData& treeParams, PxU32 nodeIndex) +{ + const BVHNode& srcNode = treeParams.getRootNode(); + PX_ASSERT(srcNode.mBV.isInside(targetNode.mBV)); + + // Check if the srcNode(tree) can fit inside any of the target childs. If yes, traverse the target tree child + BVHNode& targetPosChild = *targetNode.getPos(mNodes); + if(srcNode.mBV.isInside(targetPosChild.mBV)) + { + return traverseRuntimeNode(targetPosChild, treeParams, targetNode.getPosIndex()); + } + + BVHNode& targetNegChild = *targetNode.getNeg(mNodes); + if (srcNode.mBV.isInside(targetNegChild.mBV)) + { + return traverseRuntimeNode(targetNegChild, treeParams, targetNode.getNegIndex()); + } + + // we cannot traverse target anymore, lets add the srcTree to current target node + if(targetNode.isLeaf()) + mergeRuntimeLeaf(targetNode, treeParams, nodeIndex); + else + mergeRuntimeNode(targetNode, treeParams, nodeIndex); +} + +// Merge the input tree into current tree. +// Traverse the tree and find the smallest node, where the whole new tree fits. When we find the node +// we create one new node pointing to the original children and the to the input tree root. +void AABBTree::mergeTree(const AABBTreeMergeData& treeParams) +{ + // allocate new indices buffer + PxU32* newIndices = PX_ALLOCATE(PxU32, (mNbIndices + treeParams.mNbIndices), "AABB tree indices"); + PxMemCopy(newIndices, mIndices, sizeof(PxU32)*mNbIndices); + PX_FREE(mIndices); + mIndices = newIndices; + mTotalPrims += treeParams.mNbIndices; + + // copy the new indices, re-index using the provided indicesOffset. Note that indicesOffset + // must be provided, as original mNbIndices can be different than indicesOffset dues to object releases. + for (PxU32 i = 0; i < treeParams.mNbIndices; i++) + { + mIndices[mNbIndices + i] = treeParams.mIndicesOffset + treeParams.mIndices[i]; + } + + // check the mRefitBitmask if we fit all the new nodes + mRefitBitmask.resize(mNbNodes + treeParams.mNbNodes + 1); + + // create the parent information so we can update it + getParentIndices(); + + // if new tree is inside the root AABB we will traverse the tree to find better node where to attach the tree subnodes + // if the root is a leaf we merge with the root. + if(treeParams.getRootNode().mBV.isInside(mNodes[0].mBV) && !mNodes[0].isLeaf()) + { + traverseRuntimeNode(mNodes[0], treeParams, 0); + } + else + { + if(mNodes[0].isLeaf()) + { + mergeRuntimeLeaf(mNodes[0], treeParams, 0); + } + else + { + mergeRuntimeNode(mNodes[0], treeParams, 0); + } + + // increase the tree root AABB + mNodes[0].mBV.include(treeParams.getRootNode().mBV); + } + +#ifdef _DEBUG + //verify parent indices + for (PxU32 i = 0; i < mNbNodes; i++) + { + if (i) + { + PX_ASSERT(mNodes[mParentIndices[i]].getPosIndex() == i || mNodes[mParentIndices[i]].getNegIndex() == i); + } + if (!mNodes[i].isLeaf()) + { + PX_ASSERT(mParentIndices[mNodes[i].getPosIndex()] == i); + PX_ASSERT(mParentIndices[mNodes[i].getNegIndex()] == i); + } + } + + // verify the tree nodes, leafs + for (PxU32 i = 0; i < mNbNodes; i++) + { + if (mNodes[i].isLeaf()) + { + const PxU32 index = mNodes[i].mData >> 5; + const PxU32 nbPrim = mNodes[i].getNbPrimitives(); + PX_ASSERT(index + nbPrim <= mNbIndices + treeParams.mNbIndices); + } + else + { + const PxU32 nodeIndex = (mNodes[i].getPosIndex()); + PX_ASSERT(nodeIndex < mNbNodes); + } + } +#endif // _DEBUG + + mNbIndices += treeParams.mNbIndices; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.h new file mode 100644 index 0000000..1c48a6e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTree.h @@ -0,0 +1,333 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABBTREE_H +#define GU_AABBTREE_H + +#include "foundation/PxMemory.h" +#include "foundation/PxArray.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxUserAllocated.h" +#include "common/PxPhysXCommonConfig.h" +#include "GuPrunerTypedef.h" + +namespace physx +{ +namespace Gu +{ + struct BVHNode; + struct SAH_Buffers; + class NodeAllocator; + struct BuildStats; + class AABBTreeBounds; + + // PT: TODO: sometimes we export member functions, sometimes we export the whole class. What's the story here? + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + //! Contains AABB-tree build parameters + class PX_PHYSX_COMMON_API AABBTreeBuildParams : public PxUserAllocated + { + public: + AABBTreeBuildParams(PxU32 limit = 1, PxU32 nb_prims = 0, const AABBTreeBounds* bounds = NULL, BVHBuildStrategy bs = BVH_SPLATTER_POINTS) : + mLimit (limit), + mNbPrimitives (nb_prims), + mBounds (bounds), + mCache (NULL), + mBuildStrategy (bs) + { + } + ~AABBTreeBuildParams() + { + reset(); + } + + PX_FORCE_INLINE void reset() + { + mLimit = mNbPrimitives = 0; + mBounds = NULL; + PX_FREE(mCache); + } + + PxU32 mLimit; //!< Limit number of primitives / node. If limit is 1, build a complete tree (2*N-1 nodes) + PxU32 mNbPrimitives; //!< Number of (source) primitives. + const AABBTreeBounds* mBounds; //!< Shortcut to an app-controlled array of AABBs. + mutable PxVec3* mCache; //!< Cache for AABB centers - managed by build code. + BVHBuildStrategy mBuildStrategy; + }; + + //! AABB tree node used for building + class PX_PHYSX_COMMON_API AABBTreeBuildNode : public PxUserAllocated + { + public: + PX_FORCE_INLINE AABBTreeBuildNode() {} + PX_FORCE_INLINE ~AABBTreeBuildNode() {} + + PX_FORCE_INLINE const PxBounds3& getAABB() const { return mBV; } + PX_FORCE_INLINE const AABBTreeBuildNode* getPos() const { return mPos; } + PX_FORCE_INLINE const AABBTreeBuildNode* getNeg() const { const AABBTreeBuildNode* P = mPos; return P ? P + 1 : NULL; } + + PX_FORCE_INLINE bool isLeaf() const { return !getPos(); } + + PxBounds3 mBV; //!< Global bounding-volume enclosing all the node-related primitives + const AABBTreeBuildNode* mPos; //!< "Positive" & "Negative" children + + PxU32 mNodeIndex; //!< Index of node-related primitives (in the tree's mIndices array) + PxU32 mNbPrimitives; //!< Number of primitives for this node + + PX_FORCE_INLINE PxU32 getNbPrimitives() const { return mNbPrimitives; } + + PX_FORCE_INLINE PxU32 getNbRuntimePrimitives() const { return mNbPrimitives; } + PX_FORCE_INLINE void setNbRunTimePrimitives(PxU32 val) { mNbPrimitives = val; } + PX_FORCE_INLINE const PxU32* getPrimitives(const PxU32* base) const { return base + mNodeIndex; } + PX_FORCE_INLINE PxU32* getPrimitives(PxU32* base) { return base + mNodeIndex; } + + void subdivide(const AABBTreeBuildParams& params, BuildStats& stats, NodeAllocator& allocator, PxU32* const indices); + void subdivideSAH(const AABBTreeBuildParams& params, SAH_Buffers& sah, BuildStats& stats, NodeAllocator& allocator, PxU32* const indices); + void _buildHierarchy(const AABBTreeBuildParams& params, BuildStats& stats, NodeAllocator& allocator, PxU32* const indices); + void _buildHierarchySAH(const AABBTreeBuildParams& params, SAH_Buffers& sah, BuildStats& stats, NodeAllocator& allocator, PxU32* const indices); + }; + + //! For complete trees we can predict the final number of nodes and preallocate them. For incomplete trees we can't. + //! But we don't want to allocate nodes one by one (which would be quite slow), so we use this helper class to + //! allocate N nodes at once, while minimizing the amount of nodes allocated for nothing. An initial amount of + //! nodes is estimated using the max number for a complete tree, and the user-defined number of primitives per leaf. + //! In ideal cases this estimated number will be quite close to the final number of nodes. When that number is not + //! enough though, slabs of N=1024 extra nodes are allocated until the build is complete. + class PX_PHYSX_COMMON_API NodeAllocator : public PxUserAllocated + { + public: + NodeAllocator(); + ~NodeAllocator(); + + void release(); + void init(PxU32 nbPrimitives, PxU32 limit); + AABBTreeBuildNode* getBiNode(); + + AABBTreeBuildNode* mPool; + + struct Slab + { + PX_FORCE_INLINE Slab() {} + PX_FORCE_INLINE Slab(AABBTreeBuildNode* pool, PxU32 nbUsedNodes, PxU32 maxNbNodes) : mPool(pool), mNbUsedNodes(nbUsedNodes), mMaxNbNodes(maxNbNodes) {} + AABBTreeBuildNode* mPool; + PxU32 mNbUsedNodes; + PxU32 mMaxNbNodes; + }; + PxArray mSlabs; + PxU32 mCurrentSlabIndex; + PxU32 mTotalNbNodes; + }; +#if PX_VC +#pragma warning(pop) +#endif + + /* + * \brief Builds AABBtree from given parameters. + * \param params [in/out] AABBTree build params + * \param nodeAllocator [in/out] Node allocator + * \param stats [out] Statistics + * \return Indices buffer allocated during build, or NULL if failed + */ + PX_PHYSX_COMMON_API PxU32* buildAABBTree(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats); + + // PT: TODO: explain how users should call these functions and maybe revisit this + PX_PHYSX_COMMON_API void flattenTree(const NodeAllocator& nodeAllocator, BVHNode* dest, const PxU32* remap = NULL); + + PX_PHYSX_COMMON_API void buildAABBTree(PxU32 nbBounds, const AABBTreeBounds& bounds, PxArray& tree); + + PxU32 reshuffle(PxU32 nb, PxU32* const PX_RESTRICT prims, const PxVec3* PX_RESTRICT centers, float splitValue, PxU32 axis); + + class BitArray + { + public: + BitArray() : mBits(NULL), mSize(0) {} + BitArray(PxU32 nb_bits) { init(nb_bits); } + ~BitArray() { PX_FREE(mBits); } + + bool init(PxU32 nb_bits); + + // Data management + PX_FORCE_INLINE void setBit(PxU32 bit_number) + { + mBits[bit_number>>5] |= 1<<(bit_number&31); + } + PX_FORCE_INLINE void clearBit(PxU32 bit_number) + { + mBits[bit_number>>5] &= ~(1<<(bit_number&31)); + } + PX_FORCE_INLINE void toggleBit(PxU32 bit_number) + { + mBits[bit_number>>5] ^= 1<<(bit_number&31); + } + + PX_FORCE_INLINE void clearAll() { PxMemZero(mBits, mSize*4); } + PX_FORCE_INLINE void setAll() { PxMemSet(mBits, 0xff, mSize*4); } + + void resize(PxU32 maxBitNumber); + + // Data access + PX_FORCE_INLINE PxIntBool isSet(PxU32 bit_number) const + { + return PxIntBool(mBits[bit_number>>5] & (1<<(bit_number&31))); + } + + PX_FORCE_INLINE const PxU32* getBits() const { return mBits; } + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + + protected: + PxU32* mBits; //!< Array of bits + PxU32 mSize; //!< Size of the array in dwords + }; + + //! Contains AABB-tree merge parameters + class AABBTreeMergeData + { + public: + AABBTreeMergeData(PxU32 nbNodes, const BVHNode* nodes, PxU32 nbIndices, const PxU32* indices, PxU32 indicesOffset) : + mNbNodes(nbNodes), mNodes(nodes), mNbIndices(nbIndices), mIndices(indices), mIndicesOffset(indicesOffset) + { + } + + ~AABBTreeMergeData() {} + + PX_FORCE_INLINE const BVHNode& getRootNode() const { return *mNodes; } + + public: + PxU32 mNbNodes; //!< Number of nodes of AABB tree merge + const BVHNode* mNodes; //!< Nodes of AABB tree merge + + PxU32 mNbIndices; //!< Number of indices of AABB tree merge + const PxU32* mIndices; //!< Indices of AABB tree merge + + PxU32 mIndicesOffset; //!< Indices offset from pruning pool + }; + + // Progressive building + class FIFOStack; + //~Progressive building + + // PT: base class used to share some data and code between Gu::AABBtree and Gu::BVH. This is WIP and subject to change. + // Design dictated by refactoring necessities rather than a grand vision of something. + class BVHCoreData : public PxUserAllocated + { + public: + BVHCoreData() : mNbIndices(0), mNbNodes(0), mNodes(NULL), mIndices(NULL) {} + + PX_FORCE_INLINE PxU32 getNbIndices() const { return mNbIndices; } + PX_FORCE_INLINE const PxU32* getIndices() const { return mIndices; } + PX_FORCE_INLINE PxU32* getIndices() { return mIndices; } + PX_FORCE_INLINE void setIndices(PxU32* indices) { mIndices = indices; } + + PX_FORCE_INLINE PxU32 getNbNodes() const { return mNbNodes; } + PX_FORCE_INLINE const BVHNode* getNodes() const { return mNodes; } + PX_FORCE_INLINE BVHNode* getNodes() { return mNodes; } + + PX_PHYSX_COMMON_API void fullRefit(const PxBounds3* boxes); + + // PT: I'm leaving the above accessors here to avoid refactoring the SQ code using them, but members became public. + PxU32 mNbIndices; //!< Nb indices + PxU32 mNbNodes; //!< Number of nodes in the tree. + BVHNode* mNodes; //!< Linear pool of nodes. + PxU32* mIndices; //!< Indices in the app list. Indices are reorganized during build (permutation). + }; + + class BVHPartialRefitData : public BVHCoreData + { + public: + PX_PHYSX_COMMON_API BVHPartialRefitData(); + PX_PHYSX_COMMON_API ~BVHPartialRefitData(); + + PX_PHYSX_COMMON_API void releasePartialRefitData(bool clearRefitMap); + // adds node[index] to a list of nodes to refit when refitMarkedNodes is called + // Note that this includes updating the hierarchy up the chain + PX_PHYSX_COMMON_API void markNodeForRefit(TreeNodeIndex nodeIndex); + PX_PHYSX_COMMON_API void refitMarkedNodes(const PxBounds3* boxes); + + PX_FORCE_INLINE PxU32* getUpdateMap() { return mUpdateMap; } + + protected: + PxU32* mParentIndices; //!< PT: hot/cold split, keep parent data in separate array + PxU32* mUpdateMap; //!< PT: Local index to tree node index + BitArray mRefitBitmask; //!< bit is set for each node index in markForRefit + PxU32 mRefitHighestSetWord; + + PxU32* getParentIndices(); + public: + void createUpdateMap(PxU32 nbObjects); + }; + + //! AABB-tree, N primitives/leaf + // PT: TODO: each PX_PHYSX_COMMON_API is a cross-DLL call, should we split that class in Gu/Sq parts to minimize this? + class AABBTree : public BVHPartialRefitData + { + public: + PX_PHYSX_COMMON_API AABBTree(); + PX_PHYSX_COMMON_API ~AABBTree(); + // Build + PX_PHYSX_COMMON_API bool build(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator); + // Progressive building + PX_PHYSX_COMMON_API PxU32 progressiveBuild(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats, PxU32 progress, PxU32 limit); + //~Progressive building + PX_PHYSX_COMMON_API void release(bool clearRefitMap=true); + + // Merge tree with another one + PX_PHYSX_COMMON_API void mergeTree(const AABBTreeMergeData& tree); + // Initialize tree from given merge data + PX_PHYSX_COMMON_API void initTree(const AABBTreeMergeData& tree); + + // Data access + PX_FORCE_INLINE PxU32 getTotalPrims() const { return mTotalPrims; } + + PX_PHYSX_COMMON_API void shiftOrigin(const PxVec3& shift); + + // Shift indices of the tree by offset. Used for merged trees, when initial indices needs to be shifted to match indices in current pruning pool + PX_PHYSX_COMMON_API void shiftIndices(PxU32 offset); + +#if PX_DEBUG + void validate() {} +#endif + private: + PxU32 mTotalPrims; //!< Copy of final BuildStats::mTotalPrims + // Progressive building + FIFOStack* mStack; + //~Progressive building + bool buildInit(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, BuildStats& stats); + void buildEnd(const AABBTreeBuildParams& params, NodeAllocator& nodeAllocator, const BuildStats& stats); + // tree merge + void mergeRuntimeNode(BVHNode& targetNode, const AABBTreeMergeData& tree, PxU32 targetNodeIndex); + void mergeRuntimeLeaf(BVHNode& targetNode, const AABBTreeMergeData& tree, PxU32 targetNodeIndex); + void addRuntimeChilds(PxU32& nodeIndex, const AABBTreeMergeData& tree); + void traverseRuntimeNode(BVHNode& targetNode, const AABBTreeMergeData& tree, PxU32 nodeIndex); + }; +} // namespace Gu +} + +#endif // GU_AABBTREE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBounds.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBounds.h new file mode 100644 index 0000000..f6e2ac8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBounds.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABBTREE_BOUNDS_H +#define GU_AABBTREE_BOUNDS_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + class PX_PHYSX_COMMON_API AABBTreeBounds + { + public: + AABBTreeBounds() : mBounds(NULL), mUserAllocated(false) {} + ~AABBTreeBounds() { release(); } + + void init(PxU32 nbBounds, const PxBounds3* bounds=NULL); + void resize(PxU32 newSize, PxU32 previousSize); + void release(); + + PX_FORCE_INLINE PxBounds3* getBounds() { return mBounds; } + PX_FORCE_INLINE const PxBounds3* getBounds() const { return mBounds; } + + PX_FORCE_INLINE void moveFrom(AABBTreeBounds& source) + { + mBounds = source.mBounds; + source.mBounds = NULL; + } + + PX_FORCE_INLINE void takeOwnership() { mUserAllocated = true; } + PX_FORCE_INLINE bool ownsMemory() const { return mUserAllocated==false; } + PX_FORCE_INLINE void setBounds(PxBounds3* bounds) { mBounds = bounds; mUserAllocated=true; } + + private: + PxBounds3* mBounds; + PxU32 mUserAllocated; + }; + +} // namespace Gu +} + +#endif // GU_AABBTREE_BOUNDS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBuildStats.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBuildStats.h new file mode 100644 index 0000000..edad8b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeBuildStats.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABBTREE_BUILD_STATS_H +#define GU_AABBTREE_BUILD_STATS_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + //! Contains AABB-tree build statistics + struct PX_PHYSX_COMMON_API BuildStats + { + BuildStats() : mCount(0), mTotalPrims(0) {} + + PxU32 mCount; //!< Number of nodes created + PxU32 mTotalPrims; //!< Total accumulated number of primitives. Should be much higher than the source + //!< number of prims, since it accumulates all prims covered by each node (i.e. internal + //!< nodes too, not just leaf ones) + + // PT: everything's public so consider dropping these + PX_FORCE_INLINE void reset() { mCount = mTotalPrims = 0; } + PX_FORCE_INLINE void setCount(PxU32 nb) { mCount = nb; } + PX_FORCE_INLINE void increaseCount(PxU32 nb) { mCount += nb; } + PX_FORCE_INLINE PxU32 getCount() const { return mCount; } + }; + +} // namespace Gu +} + +#endif // GU_AABBTREE_BUILD_STATS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeNode.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeNode.h new file mode 100644 index 0000000..1c1b17e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeNode.h @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABBTREE_NODE_H +#define GU_AABBTREE_NODE_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +using namespace aos; + +namespace Gu +{ + struct BVHNode : public PxUserAllocated + { + public: + PX_FORCE_INLINE BVHNode() {} + PX_FORCE_INLINE ~BVHNode() {} + + PX_FORCE_INLINE PxU32 isLeaf() const { return mData&1; } + PX_FORCE_INLINE const PxU32* getPrimitives(const PxU32* base) const { return base + (mData>>5); } + PX_FORCE_INLINE PxU32* getPrimitives(PxU32* base) { return base + (mData>>5); } + PX_FORCE_INLINE PxU32 getPrimitiveIndex() const { return mData>>5; } + PX_FORCE_INLINE PxU32 getNbPrimitives() const { return (mData>>1)&15; } + PX_FORCE_INLINE PxU32 getPosIndex() const { return mData>>1; } + PX_FORCE_INLINE PxU32 getNegIndex() const { return (mData>>1) + 1; } + PX_FORCE_INLINE const BVHNode* getPos(const BVHNode* base) const { return base + (mData>>1); } + PX_FORCE_INLINE const BVHNode* getNeg(const BVHNode* base) const { const BVHNode* P = getPos(base); return P ? P+1 : NULL; } + PX_FORCE_INLINE BVHNode* getPos(BVHNode* base) { return base + (mData >> 1); } + PX_FORCE_INLINE BVHNode* getNeg(BVHNode* base) { BVHNode* P = getPos(base); return P ? P + 1 : NULL; } + + PX_FORCE_INLINE PxU32 getNbRuntimePrimitives() const { return (mData>>1)&15; } + PX_FORCE_INLINE void setNbRunTimePrimitives(PxU32 val) + { + PX_ASSERT(val<16); + PxU32 data = mData & ~(15<<1); + data |= val<<1; + mData = data; + } + + PX_FORCE_INLINE void getAABBCenterExtentsV(Vec3V* center, Vec3V* extents) const + { + const Vec4V minV = V4LoadU(&mBV.minimum.x); + const Vec4V maxV = V4LoadU(&mBV.maximum.x); + + const float half = 0.5f; + const FloatV halfV = FLoad(half); + + *extents = Vec3V_From_Vec4V(V4Scale(V4Sub(maxV, minV), halfV)); + *center = Vec3V_From_Vec4V(V4Scale(V4Add(maxV, minV), halfV)); + } + + PX_FORCE_INLINE void getAABBCenterExtentsV2(Vec3V* center, Vec3V* extents) const + { + const Vec4V minV = V4LoadU(&mBV.minimum.x); + const Vec4V maxV = V4LoadU(&mBV.maximum.x); + + *extents = Vec3V_From_Vec4V(V4Sub(maxV, minV)); + *center = Vec3V_From_Vec4V(V4Add(maxV, minV)); + } + + PxBounds3 mBV; // Global bounding-volume enclosing all the node-related primitives + PxU32 mData; // 27 bits node or prim index|4 bits #prims|1 bit leaf + }; + +} // namespace Gu +} + +#endif // GU_AABBTREE_NODE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeQuery.h new file mode 100644 index 0000000..3dc3323 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeQuery.h @@ -0,0 +1,303 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_AABBTREEQUERY_H +#define GU_AABBTREEQUERY_H + +#include "GuBVHTestsSIMD.h" +#include "GuAABBTreeBounds.h" +#include "foundation/PxInlineArray.h" +#include "GuAABBTreeNode.h" + +namespace physx +{ + namespace Gu + { +#define RAW_TRAVERSAL_STACK_SIZE 256 + + ////////////////////////////////////////////////////////////////////////// + + static PX_FORCE_INLINE void getBoundsTimesTwo(Vec4V& center, Vec4V& extents, const PxBounds3* bounds, PxU32 poolIndex) + { + const PxBounds3* objectBounds = bounds + poolIndex; + + // PT: it's safe to V4LoadU because the pointer comes from the AABBTreeBounds class + const Vec4V minV = V4LoadU(&objectBounds->minimum.x); + const Vec4V maxV = V4LoadU(&objectBounds->maximum.x); + + center = V4Add(maxV, minV); + extents = V4Sub(maxV, minV); + } + + ////////////////////////////////////////////////////////////////////////// + + template + static PX_FORCE_INLINE bool doOverlapLeafTest(const Test& test, const Node* node, const PxBounds3* bounds, const PxU32* indices, QueryCallback& visitor) + { + PxU32 nbPrims = node->getNbPrimitives(); + const bool doBoxTest = nbPrims > 1; + const PxU32* prims = tHasIndices ? node->getPrimitives(indices) : NULL; + while(nbPrims--) + { + const PxU32 primIndex = tHasIndices ? *prims++ : node->getPrimitiveIndex(); + if(doBoxTest) + { + Vec4V center2, extents2; + getBoundsTimesTwo(center2, extents2, bounds, primIndex); + + const float half = 0.5f; + const FloatV halfV = FLoad(half); + + const Vec4V extents_ = V4Scale(extents2, halfV); + const Vec4V center_ = V4Scale(center2, halfV); + + if(!test(Vec3V_From_Vec4V(center_), Vec3V_From_Vec4V(extents_))) + continue; + } + + if(!visitor.invoke(primIndex)) + return false; + } + return true; + } + + template + class AABBTreeOverlap + { + public: + bool operator()(const AABBTreeBounds& treeBounds, const Tree& tree, const Test& test, QueryCallback& visitor) + { + const PxBounds3* bounds = treeBounds.getBounds(); + + PxInlineArray stack; + stack.forceSize_Unsafe(RAW_TRAVERSAL_STACK_SIZE); + const Node* const nodeBase = tree.getNodes(); + stack[0] = nodeBase; + PxU32 stackIndex = 1; + + while(stackIndex > 0) + { + const Node* node = stack[--stackIndex]; + Vec3V center, extents; + node->getAABBCenterExtentsV(¢er, &extents); + while(test(center, extents)) + { + if(node->isLeaf()) + { + if(!doOverlapLeafTest(test, node, bounds, tree.getIndices(), visitor)) + return false; + break; + } + + const Node* children = node->getPos(nodeBase); + + node = children; + stack[stackIndex++] = children + 1; + if(stackIndex == stack.capacity()) + stack.resizeUninitialized(stack.capacity() * 2); + node->getAABBCenterExtentsV(¢er, &extents); + } + } + return true; + } + }; + + ////////////////////////////////////////////////////////////////////////// + + template // use inflate=true for sweeps, inflate=false for raycasts + static PX_FORCE_INLINE bool doLeafTest( const Node* node, Gu::RayAABBTest& test, const PxBounds3* bounds, const PxU32* indices, PxReal& maxDist, QueryCallback& pcb) + { + PxU32 nbPrims = node->getNbPrimitives(); + const bool doBoxTest = nbPrims > 1; + const PxU32* prims = tHasIndices ? node->getPrimitives(indices) : NULL; + while(nbPrims--) + { + const PxU32 primIndex = tHasIndices ? *prims++ : node->getPrimitiveIndex(); + if(doBoxTest) + { + Vec4V center_, extents_; + getBoundsTimesTwo(center_, extents_, bounds, primIndex); + + if(!test.check(Vec3V_From_Vec4V(center_), Vec3V_From_Vec4V(extents_))) + continue; + } + + // PT: + // - 'maxDist' is the current best distance. It can be seen as a "maximum allowed distance" (as passed to the + // template by users initially) but also as the "current minimum impact distance", so the name is misleading. + // Either way this is where we write & communicate the final/best impact distance to users. + // + // - the invoke function also takes a distance parameter, and this one is in/out. In input we must pass the + // current best distance to the leaf node, so that subsequent leaf-level queries can cull things away as + // much as possible. In output users return a shrunk distance value if they found a hit. We need to pass a + // copy of 'maxDist' ('md') since it would be too dangerous to rely on the arbitrary user code to always do + // the right thing. In particular if we'd pass 'maxDist' to invoke directly, and the called code would NOT + // respect the passed max value, it could potentially return a hit further than the best 'maxDist'. At which + // point the '(md < oldMaxDist)' test would fail but the damage would have already been done ('maxDist' would + // have already been overwritten with a larger value than before). Hence, we need 'md'. + // + // - now 'oldMaxDist' however is more subtle. In theory we wouldn't need it and we could just use '(md < maxDist)' + // in the test below. But that opens the door to subtle bugs: 'maxDist' is a reference to some value somewhere + // in the user's code, and we call the same user in invoke. It turns out that the invoke code can access and + // modify 'maxDist' on their side, even if we do not pass it to invoke. It's basically the same problem as + // before, but much more difficult to see. It does happen with the current PhysX implementations of the invoke + // functions: they modify the 'md' that we send them, but *also* 'maxDist' without the code below knowing + // about it. So the subsequent test fails again because md == maxDist. A potential solution would have been to + // work on a local copy of 'maxDist' in operator(), only writing out the final distance when returning from the + // function. Another solution used below is to introduce that local copy just here in the leaf code: that's + // where 'oldMaxDist' comes from. + + PxReal oldMaxDist = maxDist; + PxReal md = maxDist; + if(!pcb.invoke(md, primIndex)) + return false; + + if(md < oldMaxDist) + { + maxDist = md; + test.setDistance(md); + } + } + return true; + } + + ////////////////////////////////////////////////////////////////////////// + + template // use inflate=true for sweeps, inflate=false for raycasts + class AABBTreeRaycast + { + public: + bool operator()( + const AABBTreeBounds& treeBounds, const Tree& tree, + const PxVec3& origin, const PxVec3& unitDir, PxReal& maxDist, const PxVec3& inflation, + QueryCallback& pcb) + { + const PxBounds3* bounds = treeBounds.getBounds(); + + // PT: we will pass center*2 and extents*2 to the ray-box code, to save some work per-box + // So we initialize the test with values multiplied by 2 as well, to get correct results + Gu::RayAABBTest test(origin*2.0f, unitDir*2.0f, maxDist, inflation*2.0f); + + PxInlineArray stack; + stack.forceSize_Unsafe(RAW_TRAVERSAL_STACK_SIZE); + const Node* const nodeBase = tree.getNodes(); + stack[0] = nodeBase; + PxU32 stackIndex = 1; + + while(stackIndex--) + { + const Node* node = stack[stackIndex]; + Vec3V center, extents; + node->getAABBCenterExtentsV2(¢er, &extents); + if(test.check(center, extents)) // TODO: try timestamp ray shortening to skip this + { + while(!node->isLeaf()) + { + const Node* children = node->getPos(nodeBase); + + Vec3V c0, e0; + children[0].getAABBCenterExtentsV2(&c0, &e0); + const PxU32 b0 = test.check(c0, e0); + + Vec3V c1, e1; + children[1].getAABBCenterExtentsV2(&c1, &e1); + const PxU32 b1 = test.check(c1, e1); + + if(b0 && b1) // if both intersect, push the one with the further center on the stack for later + { + // & 1 because FAllGrtr behavior differs across platforms + const PxU32 bit = FAllGrtr(V3Dot(V3Sub(c1, c0), test.mDir), FZero()) & 1; + stack[stackIndex++] = children + bit; + node = children + (1 - bit); + if(stackIndex == stack.capacity()) + stack.resizeUninitialized(stack.capacity() * 2); + } + else if(b0) + node = children; + else if(b1) + node = children + 1; + else + goto skip_leaf_code; + } + + if(!doLeafTest(node, test, bounds, tree.getIndices(), maxDist, pcb)) + return false; + skip_leaf_code:; + } + } + return true; + } + }; + + + struct TraversalControl + { + enum Enum { + eDontGoDeeper, + eGoDeeper, + eGoDeeperNegFirst, + eAbort + }; + }; + + template + void traverseBVH(const Gu::BVHNode* nodes, T& traversalController, PxI32 rootNodeIndex = 0) + { + PxI32 index = rootNodeIndex; + + PxInlineArray todoStack; + + while (true) + { + const Gu::BVHNode& a = nodes[index]; + + TraversalControl::Enum control = traversalController.analyze(a, index); + if (control == TraversalControl::eAbort) + return; + if (!a.isLeaf() && (control == TraversalControl::eGoDeeper || control == TraversalControl::eGoDeeperNegFirst)) + { + if (control == TraversalControl::eGoDeeperNegFirst) + { + todoStack.pushBack(a.getPosIndex()); + index = a.getNegIndex(); //index gets processed next - assign negative index to it + } + else + { + todoStack.pushBack(a.getNegIndex()); + index = a.getPosIndex(); //index gets processed next - assign positive index to it + } + continue; + } + if (todoStack.empty()) break; + index = todoStack.popBack(); + } + } + } +} + +#endif // SQ_AABBTREEQUERY_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp new file mode 100644 index 0000000..95f22c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuAABBTreeUpdateMap.cpp @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuAABBTreeUpdateMap.h" +#include "GuAABBTree.h" +#include "GuAABBTreeNode.h" + +using namespace physx; +using namespace Gu; + +static const PxU32 SHRINK_THRESHOLD = 1024; + +void AABBTreeUpdateMap::initMap(PxU32 nbObjects, const AABBTree& tree) +{ + if(!nbObjects) + { + release(); + return; + } + + // Memory management + { + const PxU32 mapSize = nbObjects; + const PxU32 targetCapacity = mapSize + (mapSize>>2); + + PxU32 currentCapacity = mMapping.capacity(); + if( ( targetCapacity < (currentCapacity>>1) ) && ( (currentCapacity-targetCapacity) > SHRINK_THRESHOLD ) ) + { + // trigger reallocation of a smaller array, there is enough memory to save + currentCapacity = 0; + } + + if(mapSize > currentCapacity) + { + // the mapping values are invalid and reset below in any case + // so there is no need to copy the values at all + mMapping.reset(); + mMapping.reserve(targetCapacity); // since size is 0, reserve will also just allocate + } + + mMapping.forceSize_Unsafe(mapSize); + + for(PxU32 i=0;igetNbRuntimePrimitives(); + PX_ASSERT(nbPrims < 16); + + // retrieve the primitives pointer + PxU32* primitives = node0->getPrimitives(tree.getIndices()); + PX_ASSERT(primitives); + + // PT: look for desired pool index in the leaf + bool foundIt = false; + for(PxU32 i=0;isetNbRunTimePrimitives(last); + primitives[i] = INVALID_POOL_ID; // Mark primitive index as invalid in the node + mMapping[prunerIndex0] = INVALID_NODE_ID; // invalidate the node index for pool 0 + + // PT: swap within the leaf node. No need to update the mapping since they should all point + // to the same tree node anyway. + if(last!=i) + PxSwap(primitives[i], primitives[last]); + break; + } + } + PX_ASSERT(foundIt); + PX_UNUSED(foundIt); + } + + if (nodeIndex1!=INVALID_NODE_ID) + { + // PT: with multiple primitives per leaf, tree nodes may very well be the same for different pool indices. + // However the pool indices may be the same when a swap has been skipped in the pruning pool, in which + // case there is nothing to do. + if(prunerIndex0!=prunerIndex1) + { + PX_ASSERT(nodeIndex1 < tree.getNbNodes()); + PX_ASSERT(nodes[nodeIndex1].isLeaf()); + BVHNode* node1 = nodes + nodeIndex1; + const PxU32 nbPrims = node1->getNbRuntimePrimitives(); + PX_ASSERT(nbPrims < 16); + + // retrieve the primitives pointer + PxU32* primitives = node1->getPrimitives(tree.getIndices()); + PX_ASSERT(primitives); + + // PT: look for desired pool index in the leaf + bool foundIt = false; + for(PxU32 i=0;i mMapping; + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp new file mode 100644 index 0000000..7814385 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuActorShapeMap.cpp @@ -0,0 +1,141 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuActorShapeMap.h" +#include "foundation/PxMemory.h" + +using namespace physx; +using namespace Gu; + +namespace physx +{ + namespace Gu + { + /*PX_FORCE_INLINE*/ uint32_t PxComputeHash(const ActorShapeMap::ActorShape& owner) + { + PX_ASSERT(!(size_t(owner.mActor)&3)); + PX_ASSERT(!(size_t(owner.mShape)&3)); + const uint32_t id0 = uint32_t(size_t(owner.mActor)>>2); + const uint32_t id1 = uint32_t(size_t(owner.mShape)>>2); + const uint64_t mix = (uint64_t(id0)<<32)|uint64_t(id1); + return ::PxComputeHash(mix); + } + } +} + +ActorShapeMap::ActorShapeMap() : mCacheSize(0), mCache(NULL) +{ +} + +ActorShapeMap::~ActorShapeMap() +{ + PX_FREE(mCache); +} + +void ActorShapeMap::resizeCache(PxU32 index) +{ + PxU32 size = mCacheSize ? mCacheSize*2 : 64; + const PxU32 minSize = index+1; + if(minSize>size) + size = minSize*2; + + Cache* items = PX_ALLOCATE(Cache, size, "Cache"); + if(mCache) + PxMemCopy(items, mCache, mCacheSize*sizeof(Cache)); + PxMemZero(items+mCacheSize, (size-mCacheSize)*sizeof(Cache)); + PX_FREE(mCache); + mCache = items; + mCacheSize = size; +} + +bool ActorShapeMap::add(PxU32 actorIndex, const void* actor, const void* shape, ActorShapeData actorShapeData) +{ + if(actorIndex!=PX_INVALID_INDEX) + { + if(actorIndex>=mCacheSize) + resizeCache(actorIndex); + + //if(!mCache[actorIndex].mActor) + if(!mCache[actorIndex].mShape) + { + //mCache[actorIndex].mActor = actor; + mCache[actorIndex].mShape = shape; + mCache[actorIndex].mData = actorShapeData; + return true; + } + + //PX_ASSERT(mCache[actorIndex].mActor==actor); + PX_ASSERT(mCache[actorIndex].mShape); + if(mCache[actorIndex].mShape==shape) + { + mCache[actorIndex].mData = actorShapeData; + return false; + } + } + return mDatabase.insert(ActorShape(actor, shape), actorShapeData); +} + +bool ActorShapeMap::remove(PxU32 actorIndex, const void* actor, const void* shape, ActorShapeData* removed) +{ + if(actorIndex!=PX_INVALID_INDEX) + { + //if(mCache[actorIndex].mActor==actor && mCache[actorIndex].mShape==shape) + if(mCache[actorIndex].mShape==shape) + { + //mCache[actorIndex].mActor = NULL; + mCache[actorIndex].mShape = NULL; + PX_ASSERT(!mDatabase.erase(ActorShape(actor, shape))); + if(removed) + *removed = mCache[actorIndex].mData; + return true; + } + } + + PxHashMap::Entry removedEntry; + const bool found = mDatabase.erase(ActorShape(actor, shape), removedEntry); + if(found && removed) + *removed = removedEntry.second; + return found; +} + +ActorShapeData ActorShapeMap::find(PxU32 actorIndex, const void* actor, const void* shape) const +{ + if(actorIndex!=PX_INVALID_INDEX) + { + if(mCache[actorIndex].mShape==shape) + //if(mCache[actorIndex].mActor==actor && mCache[actorIndex].mShape==shape) + { + return mCache[actorIndex].mData; + } + } + + const PxHashMap::Entry* e = mDatabase.find(ActorShape(actor, shape)); + PX_ASSERT(e); + return e->second; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp new file mode 100644 index 0000000..338b873 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.cpp @@ -0,0 +1,992 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxFoundation.h" +#include "foundation/PxFPU.h" +#include "foundation/PxPlane.h" +#include "geometry/PxGeometryInternal.h" +#include "GuBVH.h" +#include "GuAABBTreeQuery.h" +#include "GuAABBTreeNode.h" +#include "GuAABBTreeBuildStats.h" +#include "GuMeshFactory.h" +#include "GuQuery.h" +#include "CmSerialize.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////// + +// PT: these two functions moved from cooking + +bool BVHData::build(PxU32 nbBounds, const void* boundsData, PxU32 boundsStride, float enlargement, PxU32 nbPrimsPerLeaf, BVHBuildStrategy bs) +{ + if(!nbBounds || !boundsData || boundsStride=16) + return false; + + mBounds.init(nbBounds); + + if(nbBounds) + { + const PxU8* sB = reinterpret_cast(boundsData); + for(PxU32 i=0; i(mBounds.getBounds()[i], *reinterpret_cast(sB), enlargement); + sB += boundsStride; + } + inflateBounds(mBounds.getBounds()[nbBounds-1], *reinterpret_cast(sB), enlargement); + } + mNbIndices = nbBounds; + + // build the BVH + BuildStats stats; + NodeAllocator nodeAllocator; + mIndices = buildAABBTree(AABBTreeBuildParams(nbPrimsPerLeaf, nbBounds, &mBounds, bs), nodeAllocator, stats); + if(!mIndices) + return false; + + // store the computed hierarchy + mNbNodes = stats.getCount(); + mNodes = PX_ALLOCATE(BVHNode, mNbNodes, "AABB tree nodes"); + PX_ASSERT(mNbNodes==nodeAllocator.mTotalNbNodes); + + // store the results into BVHNode list + if(nbPrimsPerLeaf==1) + { + // PT: with 1 prim/leaf we don't need the remap table anymore, we can just store the prim index in each tree node directly. + flattenTree(nodeAllocator, mNodes, mIndices); + PX_FREE(mIndices); + } + else + flattenTree(nodeAllocator, mNodes); + return true; +} + +// A.B. move to load code +#define PX_BVH_STRUCTURE_VERSION 1 + +bool BVHData::save(PxOutputStream& stream, bool endian) const +{ + // write header + if(!writeHeader('B', 'V', 'H', 'S', PX_BVH_STRUCTURE_VERSION, endian, stream)) + return false; + + // write mData members + writeDword(mNbIndices, endian, stream); + writeDword(mNbNodes, endian, stream); + + // write indices and bounds + for(PxU32 i=0; i(data.mNodes); + mData.mBounds.setBounds(reinterpret_cast(data.mBounds)); +} + +bool BVH::getInternalData(PxBVHInternalData& data, bool takeOwnership) const +{ + data.mNbIndices = mData.mNbIndices; + data.mNbNodes = mData.mNbNodes; + data.mNodeSize = sizeof(BVHNode); + data.mNodes = mData.mNodes; + data.mIndices = mData.mIndices; + data.mBounds = const_cast(mData.mBounds.getBounds()); + + if(takeOwnership) + const_cast(this)->mData.mBounds.takeOwnership(); + + return true; +} + +bool physx::PxGetBVHInternalData(PxBVHInternalData& data, const PxBVH& bvh, bool takeOwnership) +{ + return static_cast(bvh).getInternalData(data, takeOwnership); +} + +//~ PT: temporary for Kit + +BVH::BVH(MeshFactory* factory) : + PxBVH (PxType(PxConcreteType::eBVH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMeshFactory (factory) +{ +} + +BVH::BVH(MeshFactory* factory, BVHData& bvhData) : + PxBVH (PxType(PxConcreteType::eBVH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMeshFactory (factory), + mData (bvhData) +{ +} + +BVH::~BVH() +{ +} + +bool BVH::init(PxU32 nbPrims, AABBTreeBounds* bounds, const void* boundsData, PxU32 stride, BVHBuildStrategy bs, PxU32 nbPrimsPerLeaf, float enlargement) +{ + if(!nbPrims) + return false; + + if(bounds) + { + mData.mBounds.moveFrom(*bounds); + } + else + { + mData.mBounds.init(nbPrims); + PxBounds3* dst = mData.mBounds.getBounds(); + if(stride==sizeof(PxBounds3)) + { + PxMemCopy(dst, boundsData, sizeof(PxBounds3)*nbPrims); + } + else + { + if(nbPrims) + { + const PxU8* sB = reinterpret_cast(boundsData); + for(PxU32 i=0; i(mData.mBounds.getBounds()[i], *reinterpret_cast(sB), enlargement); + sB += stride; + } + inflateBounds(mData.mBounds.getBounds()[nbPrims-1], *reinterpret_cast(sB), enlargement); + } + } + } + mData.mNbIndices = nbPrims; + + // build the BVH + BuildStats stats; + NodeAllocator nodeAllocator; + mData.mIndices = buildAABBTree(AABBTreeBuildParams(nbPrimsPerLeaf, nbPrims, &mData.mBounds, bs), nodeAllocator, stats); + if(!mData.mIndices) + return false; + + // store the computed hierarchy + mData.mNbNodes = stats.getCount(); + mData.mNodes = PX_ALLOCATE(BVHNode, mData.mNbNodes, "AABB tree nodes"); + PX_ASSERT(mData.mNbNodes==nodeAllocator.mTotalNbNodes); + + // store the results into BVHNode list + if(nbPrimsPerLeaf==1) + { + // PT: with 1 prim/leaf we don't need the remap table anymore, we can just store the prim index in each tree node directly. + flattenTree(nodeAllocator, mData.mNodes, mData.mIndices); + PX_FREE(mData.mIndices); + } + else + flattenTree(nodeAllocator, mData.mNodes); + return true; +} + +bool BVH::load(PxInputStream& stream) +{ + // Import header + PxU32 version; + bool mismatch; + if(!readHeader('B', 'V', 'H', 'S', version, mismatch, stream)) + return false; + + // read numVolumes, numNodes together + //ReadDwordBuffer(&mData.mNbIndices, 2, mismatch, stream); + mData.mNbIndices = readDword(mismatch, stream); + mData.mNbNodes = readDword(mismatch, stream); + + // read indices + mData.mIndices = PX_ALLOCATE(PxU32, mData.mNbIndices, "BVH indices"); + ReadDwordBuffer(mData.mIndices, mData.mNbIndices, mismatch, stream); + + // read bounds + mData.mBounds.init(mData.mNbIndices); + readFloatBuffer(&mData.mBounds.getBounds()->minimum.x, mData.mNbIndices*(3 + 3), mismatch, stream); + + // read nodes + mData.mNodes = PX_ALLOCATE(BVHNode, mData.mNbNodes, "BVH nodes"); + for(PxU32 i = 0; i < mData.mNbNodes; i++) + { + ReadDwordBuffer(&mData.mNodes[i].mData, 1, mismatch, stream); + + readFloatBuffer(&mData.mNodes[i].mBV.minimum.x, 3 + 3, mismatch, stream); + } + return true; +} + +void BVH::release() +{ + decRefCount(); +} + +void BVH::onRefCountZero() +{ + ::onRefCountZero(this, mMeshFactory, false, "PxBVH::release: double deletion detected!"); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Query Implementation + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct BVHTree + { + PX_FORCE_INLINE BVHTree(const BVHData& data) : mRootNode(data.mNodes), mIndices(data.mIndices) {} + + const BVHNode* getNodes() const { return mRootNode; } + const PxU32* getIndices() const { return mIndices; } + + const BVHNode* mRootNode; + const PxU32* mIndices; + }; + + struct BVHCallback + { + BVHCallback(PxU32* hits, PxU32 numMaxHits): + mHits (hits), + mNbMaxHits (numMaxHits), + mCurrentHitsCount (0) + { + } + + PX_FORCE_INLINE bool invoke(PxReal&, PxU32 payload) + { + mHits[mCurrentHitsCount++] = payload; + if(mCurrentHitsCount == mNbMaxHits) + return false; + return true; + } + + PxU32* mHits; + PxU32 mNbMaxHits; + PxU32 mCurrentHitsCount; + }; + + struct BVHOverlapCallback + { + BVHOverlapCallback(PxU32* hits, PxU32 numMaxHits): + mHits (hits), + mNbMaxHits (numMaxHits), + mCurrentHitsCount (0) + { + } + + PX_FORCE_INLINE bool invoke(PxU32 payload) + { + mHits[mCurrentHitsCount++] = payload; + if(mCurrentHitsCount == mNbMaxHits) + return false; + return true; + } + + PxU32* mHits; + PxU32 mNbMaxHits; + PxU32 mCurrentHitsCount; + const PxU32* mVolumes; + }; +} + +PxU32 BVH::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT rayHits) const +{ + BVHCallback cbk(rayHits, maxHits); + if(mData.mIndices) + AABBTreeRaycast()(mData.mBounds, BVHTree(mData), origin, unitDir, maxDist, PxVec3(0.0f), cbk); + else + AABBTreeRaycast()(mData.mBounds, BVHTree(mData), origin, unitDir, maxDist, PxVec3(0.0f), cbk); + + return cbk.mCurrentHitsCount; +} + +PxU32 BVH::sweep(const PxBounds3& aabb, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT sweepHits) const +{ + BVHCallback cbk(sweepHits, maxHits); + if(mData.mIndices) + AABBTreeRaycast()(mData.mBounds, BVHTree(mData), aabb.getCenter(), unitDir, maxDist, aabb.getExtents(), cbk); + else + AABBTreeRaycast()(mData.mBounds, BVHTree(mData), aabb.getCenter(), unitDir, maxDist, aabb.getExtents(), cbk); + + return cbk.mCurrentHitsCount; +} + +PxU32 BVH::overlap(const PxBounds3& aabb, PxU32 maxHits, PxU32* PX_RESTRICT overlapHits) const +{ + BVHOverlapCallback cbk(overlapHits, maxHits); + const AABBAABBTest test(aabb); + if(mData.mIndices) + AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, cbk); + else + AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, cbk); + + return cbk.mCurrentHitsCount; +} + + +namespace +{ + struct RaycastAdapter + { + RaycastAdapter(PxBVHRaycastCallback& cb) : mCallback(cb), mAbort(false) {} + PX_FORCE_INLINE bool invoke(PxReal& distance, PxU32 index) + { + if(mAbort || !mCallback.reportHit(index, distance)) + { + mAbort = true; + return false; + } + return true; + } + PxBVHRaycastCallback& mCallback; + bool mAbort; + PX_NOCOPY(RaycastAdapter) + }; +} + +bool BVH::raycast(const PxVec3& origin, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const +{ + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + RaycastAdapter ra(cb); + if(mData.mIndices) + return AABBTreeRaycast()(mData.mBounds, BVHTree(mData), origin, unitDir, distance, PxVec3(0.0f), ra); + else + return AABBTreeRaycast()(mData.mBounds, BVHTree(mData), origin, unitDir, distance, PxVec3(0.0f), ra); +} + +namespace +{ + struct OverlapAdapter + { + OverlapAdapter(PxBVHOverlapCallback& cb) : mCallback(cb), mAbort(false) {} + PX_FORCE_INLINE bool invoke(PxU32 index) + { + if(mAbort || !mCallback.reportHit(index)) + { + mAbort = true; + return false; + } + return true; + } + PxBVHOverlapCallback& mCallback; + bool mAbort; + PX_NOCOPY(OverlapAdapter) + }; +} + +bool BVH::overlap(const ShapeData& queryVolume, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const +{ + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + OverlapAdapter oa(cb); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + } + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, 1.0f); + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + return false; +} + +bool BVH::overlap(const PxGeometry& geom, const PxTransform& pose, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const +{ + const ShapeData queryVolume(geom, pose, 0.0f); + return overlap(queryVolume, cb, flags); +} + +bool BVH::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const +{ + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + RaycastAdapter ra(cb); + if(mData.mIndices) + return AABBTreeRaycast()(mData.mBounds, BVHTree(mData), aabb.getCenter(), unitDir, distance, aabb.getExtents(), ra); + else + return AABBTreeRaycast()(mData.mBounds, BVHTree(mData), aabb.getCenter(), unitDir, distance, aabb.getExtents(), ra); +} + +bool BVH::sweep(const PxGeometry& geom, const PxTransform& pose, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const +{ + const ShapeData queryVolume(geom, pose, 0.0f); + return sweep(queryVolume, unitDir, distance, cb, flags); +} + +namespace +{ + PX_FORCE_INLINE bool planesAABBOverlap(const PxVec3& m, const PxVec3& d, const PxPlane* p, PxU32& outClipMask, PxU32 inClipMask) + { + PxU32 mask = 1; + PxU32 tmpOutClipMask = 0; + + while(mask<=inClipMask) + { + if(inClipMask & mask) + { + const float NP = d.x*fabsf(p->n.x) + d.y*fabsf(p->n.y) + d.z*fabsf(p->n.z); + const float MP = m.x*p->n.x + m.y*p->n.y + m.z*p->n.z + p->d; + + if(NP < MP) + return false; + if((-NP) < MP) + tmpOutClipMask |= mask; + } + mask+=mask; + p++; + } + + outClipMask = tmpOutClipMask; + return true; + } + + struct FrustumTest + { + FrustumTest(PxU32 nbPlanes, const PxPlane* planes) : mPlanes(planes), mMask((1< stack; + stack.forceSize_Unsafe(RAW_TRAVERSAL_STACK_SIZE); + stack[0] = node0; + PxU32 stackIndex = 1; + + while(stackIndex > 0) + { + const BVHNode* node = stack[--stackIndex]; + + while(1) + { + if(node->isLeaf()) + { + PxU32 nbPrims = node->getNbPrimitives(); + const PxU32* prims = indices ? node->getPrimitives(indices) : NULL; + while(nbPrims--) + { + const PxU32 primIndex = indices ? *prims++ : node->getPrimitiveIndex(); + if(!oa.invoke(primIndex)) + return false; + } + break; + } + else + { + const BVHNode* children = node->getPos(nodeBase); + node = children; + stack[stackIndex++] = children + 1; + if(stackIndex == stack.capacity()) + stack.resizeUninitialized(stack.capacity() * 2); + } + } + } + return true; +} + +bool BVH::cull(PxU32 nbPlanes, const PxPlane* planes, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const +{ + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + OverlapAdapter oa(cb); + const FrustumTest test(nbPlanes, planes); + + if(0) + { + // PT: this vanilla codepath is slower + if(mData.mIndices) + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + else + return AABBTreeOverlap()(mData.mBounds, BVHTree(mData), test, oa); + } + else + { + const PxBounds3* bounds = mData.mBounds.getBounds(); + const bool hasIndices = mData.mIndices!=NULL; + + PxInlineArray stack; + stack.forceSize_Unsafe(RAW_TRAVERSAL_STACK_SIZE); + const BVHNode* const nodeBase = mData.mNodes; + stack[0] = nodeBase; + PxU32 stackIndex = 1; + + while(stackIndex > 0) + { + const BVHNode* node = stack[--stackIndex]; + Vec3V center, extents; + node->getAABBCenterExtentsV(¢er, &extents); + while(test(center, extents)) + { + if(!test.mOutClipMask) + { + if(!dumpNode(oa, nodeBase, node, mData.mIndices)) + return false; + break; + } + else + { + if(node->isLeaf()) + { + PxU32 nbPrims = node->getNbPrimitives(); + const bool doBoxTest = nbPrims > 1; + const PxU32* prims = hasIndices ? node->getPrimitives(mData.mIndices) : NULL; + while(nbPrims--) + { + const PxU32 primIndex = hasIndices ? *prims++ : node->getPrimitiveIndex(); + if(doBoxTest) + { + Vec4V center2, extents2; + getBoundsTimesTwo(center2, extents2, bounds, primIndex); + + const float half = 0.5f; + const FloatV halfV = FLoad(half); + + const Vec4V extents_ = V4Scale(extents2, halfV); + const Vec4V center_ = V4Scale(center2, halfV); + + if(!test(Vec3V_From_Vec4V(center_), Vec3V_From_Vec4V(extents_))) + continue; + } + + if(!oa.invoke(primIndex)) + return false; + } + break; + } + + const BVHNode* children = node->getPos(nodeBase); + + node = children; + stack[stackIndex++] = children + 1; + if(stackIndex == stack.capacity()) + stack.resizeUninitialized(stack.capacity() * 2); + node->getAABBCenterExtentsV(¢er, &extents); + } + } + } + return true; + } +} + +void BVH::refit() +{ + mData.fullRefit(mData.mBounds.getBounds()); +} + +bool BVH::updateBoundsInternal(PxU32 localIndex, const PxBounds3& newBounds) +{ + if(localIndex>=mData.mNbIndices) + return false; + + PxBounds3* bounds = mData.mBounds.getBounds(); + + bounds[localIndex] = newBounds; + + // Lazy-create update map + if(!mData.getUpdateMap()) + mData.createUpdateMap(mData.mNbIndices); + + PxU32* mMapping = mData.getUpdateMap(); + if(mMapping) + { + const PxU32 treeNodeIndex = mMapping[localIndex]; + if(treeNodeIndex!=0xffffffff) + { + mData.markNodeForRefit(treeNodeIndex); + return true; + } + } + return false; +} + +bool BVH::updateBounds(PxU32 boundsIndex, const PxBounds3& newBounds) +{ + return updateBoundsInternal(boundsIndex, newBounds); +} + +void BVH::partialRefit() +{ + mData.refitMarkedNodes(mData.mBounds.getBounds()); +} + +bool BVH::traverse(PxBVHTraversalCallback& cb) const +{ + // PT: copy-pasted from AABBTreeOverlap and modified + + PxInlineArray stack; + stack.forceSize_Unsafe(RAW_TRAVERSAL_STACK_SIZE); + const BVHNode* const nodeBase = mData.getNodes(); + stack[0] = nodeBase; + PxU32 stackIndex = 1; + + while(stackIndex > 0) + { + const BVHNode* node = stack[--stackIndex]; + + while(cb.visitNode(node->mBV)) + { + if(node->isLeaf()) + { + if(mData.getIndices()) + { + if(!cb.reportLeaf(node->getNbPrimitives(), node->getPrimitives(mData.getIndices()))) + return false; + } + else + { + PX_ASSERT(node->getNbPrimitives()==1); + const PxU32 primIndex = node->getPrimitiveIndex(); + if(!cb.reportLeaf(node->getNbPrimitives(), &primIndex)) + return false; + } + break; + } + + const BVHNode* children = node->getPos(nodeBase); + node = children; + stack[stackIndex++] = children + 1; + if(stackIndex == stack.capacity()) + stack.resizeUninitialized(stack.capacity() * 2); + } + } + return true; +} + + + + +#include "geometry/PxMeshQuery.h" + +#define GU_BVH_STACK_SIZE 1024 // Default size of local stacks for non-recursive traversals. + +static bool doLeafVsLeaf(PxReportCallback& callback, const BVHNode* node0, const PxBounds3* bounds0, const PxU32* indices0, + const BVHNode* node1, const PxBounds3* bounds1, const PxU32* indices1, + bool& abort) +{ + PxGeomIndexPair* dst = callback.mBuffer; + PxU32 capacity = callback.mCapacity; + PxU32 currentSize = callback.mSize; + PX_ASSERT(currentSizegetNbPrimitives(); + const PxU32* prims0 = indices0 ? node0->getPrimitives(indices0) : NULL; + while(nbPrims0--) + { + const PxU32 primIndex0 = prims0 ? *prims0++ : node0->getPrimitiveIndex(); + + Vec3V center0, extents0; + { + Vec4V center2, extents2; + getBoundsTimesTwo(center2, extents2, bounds0, primIndex0); + + extents0 = Vec3V_From_Vec4V(V4Scale(extents2, halfV)); + center0 = Vec3V_From_Vec4V(V4Scale(center2, halfV)); + } + + PxU32 nbPrims1 = node1->getNbPrimitives(); + const PxU32* prims1 = indices1 ? node1->getPrimitives(indices1) : NULL; + while(nbPrims1--) + { + const PxU32 primIndex1 = prims1 ? *prims1++ : node1->getPrimitiveIndex(); + + Vec3V center1, extents1; + { + Vec4V center2, extents2; + getBoundsTimesTwo(center2, extents2, bounds1, primIndex1); + + extents1 = Vec3V_From_Vec4V(V4Scale(extents2, halfV)); + center1 = Vec3V_From_Vec4V(V4Scale(center2, halfV)); + } + + if(PxIntBool(V3AllGrtrOrEq(V3Add(extents0, extents1), V3Abs(V3Sub(center1, center0))))) + { + foundHit = true; + + // PT: TODO: refactor callback management code with BVH34 + dst[currentSize].id0 = primIndex0; + dst[currentSize].id1 = primIndex1; + currentSize++; + if(currentSize==capacity) + { + callback.mSize = 0; + if(!callback.flushResults(currentSize, dst)) + { + abort = true; + return foundHit; + } + dst = callback.mBuffer; + capacity = callback.mCapacity; + currentSize = callback.mSize; + } + + } + } + } + callback.mSize = currentSize; + return foundHit; +} + +static PX_FORCE_INLINE void pushChildren(PxGeomIndexPair* stack, PxU32& nb, PxU32 a, PxU32 b, PxU32 c, PxU32 d) +{ + stack[nb].id0 = a; + stack[nb].id1 = b; + nb++; + + stack[nb].id0 = c; + stack[nb].id1 = d; + nb++; +} + +static PX_NOINLINE bool abortQuery(PxReportCallback& callback, bool& abort) +{ + abort = true; + callback.mSize = 0; + return true; +} + +static bool BVH_BVH(PxReportCallback& callback, const BVH& tree0, const BVH& tree1, bool& _abort) +{ + const BVHNode* PX_RESTRICT node0 = tree0.getNodes(); + const BVHNode* PX_RESTRICT node1 = tree1.getNodes(); + PX_ASSERT(node0 && node1); + + const PxBounds3* bounds0 = tree0.getData().mBounds.getBounds(); + const PxBounds3* bounds1 = tree1.getData().mBounds.getBounds(); + + const PxU32* indices0 = tree0.getIndices(); + const PxU32* indices1 = tree1.getIndices(); + + { + PxU32 nb=1; + PxGeomIndexPair stack[GU_BVH_STACK_SIZE]; + stack[0].id0 = 0; + stack[0].id1 = 0; + + bool status = false; + + const BVHNode* const root0 = node0; + const BVHNode* const root1 = node1; + + do + { + const PxGeomIndexPair& childData = stack[--nb]; + node0 = root0 + childData.id0; + node1 = root1 + childData.id1; + + if(node0->mBV.intersects(node1->mBV)) + { + const PxU32 isLeaf0 = node0->isLeaf(); + const PxU32 isLeaf1 = node1->isLeaf(); + + if(isLeaf0) + { + if(isLeaf1) + { + bool abort; + if(doLeafVsLeaf(callback, node0, bounds0, indices0, node1, bounds1, indices1, abort)) + status = true; + if(abort) + return abortQuery(callback, _abort); + } + else + { + const PxU32 posIndex1 = node1->getPosIndex(); + pushChildren(stack, nb, childData.id0, posIndex1, childData.id0, posIndex1 + 1); + } + } + else if(isLeaf1) + { + const PxU32 posIndex0 = node0->getPosIndex(); + pushChildren(stack, nb, posIndex0, childData.id1, posIndex0 + 1, childData.id1); + } + else + { + const PxU32 posIndex0 = node0->getPosIndex(); + const PxU32 posIndex1 = node1->getPosIndex(); + pushChildren(stack, nb, posIndex0, posIndex1, posIndex0, posIndex1 + 1); + pushChildren(stack, nb, posIndex0 + 1, posIndex1, posIndex0 + 1, posIndex1 + 1); + } + } + }while(nb); + + return status; + } +} + +bool physx::PxFindOverlap(PxReportCallback& callback, const PxBVH& bvh0, const PxBVH& bvh1) +{ + PX_SIMD_GUARD + + // PT: TODO: refactor callback management code with BVH34 + + PxGeomIndexPair stackBuffer[256]; + bool mustResetBuffer; + if(callback.mBuffer) + { + PX_ASSERT(callback.mCapacity); + mustResetBuffer = false; + } + else + { + callback.mBuffer = stackBuffer; + PX_ASSERT(callback.mCapacity<=256); + if(callback.mCapacity==0 || callback.mCapacity>256) + { + callback.mCapacity = 256; + } + callback.mSize = 0; + mustResetBuffer = true; + } + + bool abort = false; + const bool status = BVH_BVH(callback, static_cast(bvh0), static_cast(bvh1), abort); + if(!abort) + { + const PxU32 currentSize = callback.mSize; + if(currentSize) + { + callback.mSize = 0; + callback.flushResults(currentSize, callback.mBuffer); + } + } + + if(mustResetBuffer) + callback.mBuffer = NULL; + return status; +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.h new file mode 100644 index 0000000..2d06793 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVH.h @@ -0,0 +1,147 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BVH_H +#define GU_BVH_H + +/** \addtogroup geomutils +@{ +*/ + +#include "geometry/PxBVH.h" + +#include "CmRefCountable.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxUserAllocated.h" +#include "GuAABBTreeBounds.h" +#include "GuAABBTree.h" + +namespace physx +{ + struct PxBVHInternalData; + +namespace Gu +{ + class MeshFactory; + struct BVHNode; + class ShapeData; + + class BVHData : public BVHPartialRefitData + { + public: + BVHData() {} + + BVHData(BVHData& other) + { + mNbIndices = other.mNbIndices; + mNbNodes = other.mNbNodes; + mIndices = other.mIndices; + mNodes = other.mNodes; + + mBounds.moveFrom(other.mBounds); + other.mIndices = NULL; + other.mNodes = NULL; + } + + ~BVHData() + { + if(mBounds.ownsMemory()) + { + mBounds.release(); + PX_FREE(mIndices); + PX_FREE(mNodes); // PT: TODO: fix this, unify with AABBTree version + } + mNbNodes = 0; + mNbIndices = 0; + } + + PX_PHYSX_COMMON_API bool build(PxU32 nbBounds, const void* boundsData, PxU32 boundsStride, float enlargement, PxU32 numPrimsPerLeaf, BVHBuildStrategy bs); + PX_PHYSX_COMMON_API bool save(PxOutputStream& stream, bool endian) const; + + AABBTreeBounds mBounds; + }; + + /** + \brief Represents a BVH. + */ + class BVH : public PxBVH, public PxUserAllocated, public Cm::RefCountable + { + public: + // PT: TODO: revisit these PX_PHYSX_COMMON_API calls. At the end of the day the issue is that things like PxUserAllocated aren't exported. + PX_PHYSX_COMMON_API BVH(MeshFactory* factory); + PX_PHYSX_COMMON_API BVH(MeshFactory* factory, BVHData& data); + PX_PHYSX_COMMON_API BVH(const PxBVHInternalData& data); + virtual ~BVH(); + + PX_PHYSX_COMMON_API bool init(PxU32 nbPrims, AABBTreeBounds* bounds, const void* boundsData, PxU32 stride, BVHBuildStrategy bs, PxU32 nbPrimsPerLeaf, float enlargement); + bool load(PxInputStream& desc); + void release(); + + // PxBVH + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const /*override*/; + virtual bool overlap(const PxGeometry& geom, const PxTransform& pose, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const /*override*/; + virtual bool sweep(const PxGeometry& geom, const PxTransform& pose, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const /*override*/; + virtual bool cull(PxU32 nbPlanes, const PxPlane* planes, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const /*override*/; + + virtual PxU32 raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT rayHits) const /*override*/; + virtual PxU32 sweep(const PxBounds3& aabb, const PxVec3& unitDir, PxReal maxDist, PxU32 maxHits, PxU32* PX_RESTRICT sweepHits) const /*override*/; + virtual PxU32 overlap(const PxBounds3& aabb, PxU32 maxHits, PxU32* PX_RESTRICT overlapHits) const /*override*/; + + virtual PxU32 getNbBounds() const /*override*/ { return mData.mNbIndices; } + virtual const PxBounds3* getBounds() const /*override*/ { return mData.mBounds.getBounds(); } + + virtual void refit() /*override*/; + virtual bool updateBounds(PxU32 boundsIndex, const PxBounds3& newBounds) /*override*/; + virtual void partialRefit() /*override*/; + + virtual bool traverse(PxBVHTraversalCallback& cb) const /*override*/; + //~PxBVH + + // Cm::RefCountable + virtual void onRefCountZero() /*override*/; + //~Cm::RefCountable + + PX_FORCE_INLINE const BVHNode* getNodes() const { return mData.mNodes; } + PX_FORCE_INLINE const PxU32* getIndices() const { return mData.mIndices; } + PX_FORCE_INLINE const BVHData& getData() const { return mData; } + + bool getInternalData(PxBVHInternalData&, bool) const; + bool updateBoundsInternal(PxU32 localIndex, const PxBounds3& bounds); + // PT: alternative implementations directly working on shape data + bool overlap(const ShapeData& shapeData, PxBVHOverlapCallback& cb, PxGeometryQueryFlags flags) const; + bool sweep(const ShapeData& shapeData, const PxVec3& unitDir, float distance, PxBVHRaycastCallback& cb, PxGeometryQueryFlags flags) const; + private: + MeshFactory* mMeshFactory; + BVHData mData; + }; +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVHTestsSIMD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVHTestsSIMD.h new file mode 100644 index 0000000..db1ecff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBVHTestsSIMD.h @@ -0,0 +1,257 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BVH_TESTS_SIMD_H +#define GU_BVH_TESTS_SIMD_H + +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ + using namespace aos; +namespace Gu +{ + +struct RayAABBTest +{ + PX_FORCE_INLINE RayAABBTest(const PxVec3& origin_, const PxVec3& unitDir_, const PxReal maxDist, const PxVec3& inflation_) + : mOrigin(V3LoadU(origin_)) + , mDir(V3LoadU(unitDir_)) + , mDirYZX(V3PermYZX(mDir)) + , mInflation(V3LoadU(inflation_)) + , mAbsDir(V3Abs(mDir)) + , mAbsDirYZX(V3PermYZX(mAbsDir)) + { + const PxVec3 ext = maxDist >= PX_MAX_F32 ? PxVec3( unitDir_.x == 0 ? origin_.x : PxSign(unitDir_.x)*PX_MAX_F32, + unitDir_.y == 0 ? origin_.y : PxSign(unitDir_.y)*PX_MAX_F32, + unitDir_.z == 0 ? origin_.z : PxSign(unitDir_.z)*PX_MAX_F32) + : origin_ + unitDir_ * maxDist; + mRayMin = V3Min(mOrigin, V3LoadU(ext)); + mRayMax = V3Max(mOrigin, V3LoadU(ext)); + } + + PX_FORCE_INLINE void setDistance(PxReal distance) + { + const Vec3V ext = V3ScaleAdd(mDir, FLoad(distance), mOrigin); + mRayMin = V3Min(mOrigin, ext); + mRayMax = V3Max(mOrigin, ext); + } + + template + PX_FORCE_INLINE PxU32 check(const Vec3V center, const Vec3V extents) const + { + const Vec3V iExt = TInflate ? V3Add(extents, mInflation) : extents; + + // coordinate axes + const Vec3V nodeMax = V3Add(center, iExt); + const Vec3V nodeMin = V3Sub(center, iExt); + + // cross axes + const Vec3V offset = V3Sub(mOrigin, center); + const Vec3V offsetYZX = V3PermYZX(offset); + const Vec3V iExtYZX = V3PermYZX(iExt); + + const Vec3V f = V3NegMulSub(mDirYZX, offset, V3Mul(mDir, offsetYZX)); + const Vec3V g = V3MulAdd(iExt, mAbsDirYZX, V3Mul(iExtYZX, mAbsDir)); + + const BoolV + maskA = V3IsGrtrOrEq(nodeMax, mRayMin), + maskB = V3IsGrtrOrEq(mRayMax, nodeMin), + maskC = V3IsGrtrOrEq(g, V3Abs(f)); + const BoolV andABCMasks = BAnd(BAnd(maskA, maskB), maskC); + + return BAllEqTTTT(andABCMasks); + } + + const Vec3V mOrigin, mDir, mDirYZX, mInflation, mAbsDir, mAbsDirYZX; + Vec3V mRayMin, mRayMax; +protected: + RayAABBTest& operator=(const RayAABBTest&); +}; + +// probably not worth having a SIMD version of this unless the traversal passes Vec3Vs +struct AABBAABBTest +{ + PX_FORCE_INLINE AABBAABBTest(const PxTransform&t, const PxBoxGeometry&b) + : mCenter(V3LoadU(t.p)) + , mExtents(V3LoadU(b.halfExtents)) + { } + + PX_FORCE_INLINE AABBAABBTest(const PxBounds3& b) + : mCenter(V3LoadU(b.getCenter())) + , mExtents(V3LoadU(b.getExtents())) + { } + + PX_FORCE_INLINE PxIntBool operator()(const Vec3V center, const Vec3V extents) const + { + //PxVec3 c; PxVec3_From_Vec3V(center, c); + //PxVec3 e; PxVec3_From_Vec3V(extents, e); + //if(PxAbs(c.x - mCenter.x) > mExtents.x + e.x) return IntFalse; + //if(PxAbs(c.y - mCenter.y) > mExtents.y + e.y) return IntFalse; + //if(PxAbs(c.z - mCenter.z) > mExtents.z + e.z) return IntFalse; + //return IntTrue; + return PxIntBool(V3AllGrtrOrEq(V3Add(mExtents, extents), V3Abs(V3Sub(center, mCenter)))); + } + +private: + AABBAABBTest& operator=(const AABBAABBTest&); + const Vec3V mCenter, mExtents; +}; + +struct SphereAABBTest +{ + PX_FORCE_INLINE SphereAABBTest(const PxTransform& t, const PxSphereGeometry& s) + : mCenter(V3LoadU(t.p)) + , mRadius2(FLoad(s.radius * s.radius)) + {} + + PX_FORCE_INLINE SphereAABBTest(const PxVec3& center, PxF32 radius) + : mCenter(V3LoadU(center)) + , mRadius2(FLoad(radius * radius)) + {} + + PX_FORCE_INLINE PxIntBool operator()(const Vec3V boxCenter, const Vec3V boxExtents) const + { + const Vec3V offset = V3Sub(mCenter, boxCenter); + const Vec3V closest = V3Clamp(offset, V3Neg(boxExtents), boxExtents); + const Vec3V d = V3Sub(offset, closest); + return PxIntBool(BAllEqTTTT(FIsGrtrOrEq(mRadius2, V3Dot(d, d)))); + } + +private: + SphereAABBTest& operator=(const SphereAABBTest&); + const Vec3V mCenter; + const FloatV mRadius2; +}; + +// The Opcode capsule-AABB traversal test seems to be *exactly* the same as the ray-box test inflated by the capsule radius (so not a true capsule/box test) +// and the code for the ray-box test is better. TODO: check the zero length case and use the sphere traversal if this one fails. +// (OTOH it's not that hard to adapt the Ray-AABB test to a capsule test) + +struct CapsuleAABBTest: private RayAABBTest +{ + PX_FORCE_INLINE CapsuleAABBTest(const PxVec3& origin, const PxVec3& unitDir, const PxReal length, const PxVec3& inflation) + : RayAABBTest(origin, unitDir, length, inflation) + {} + + PX_FORCE_INLINE PxIntBool operator()(const Vec3VArg center, const Vec3VArg extents) const + { + return PxIntBool(RayAABBTest::check(center, extents)); + } +}; + +template +struct OBBAABBTests +{ + OBBAABBTests(const PxVec3& pos, const PxMat33& rot, const PxVec3& halfExtentsInflated) + { + const Vec3V eps = V3Load(1e-6f); + + mT = V3LoadU(pos); + mExtents = V3LoadU(halfExtentsInflated); + + // storing the transpose matrices yields a simpler SIMD test + mRT = Mat33V_From_PxMat33(rot.getTranspose()); + mART = Mat33V(V3Add(V3Abs(mRT.col0), eps), V3Add(V3Abs(mRT.col1), eps), V3Add(V3Abs(mRT.col2), eps)); + mBB_xyz = M33TrnspsMulV3(mART, mExtents); + + if(fullTest) + { + const Vec3V eYZX = V3PermYZX(mExtents), eZXY = V3PermZXY(mExtents); + + mBB_123 = V3MulAdd(eYZX, V3PermZXY(mART.col0), V3Mul(eZXY, V3PermYZX(mART.col0))); + mBB_456 = V3MulAdd(eYZX, V3PermZXY(mART.col1), V3Mul(eZXY, V3PermYZX(mART.col1))); + mBB_789 = V3MulAdd(eYZX, V3PermZXY(mART.col2), V3Mul(eZXY, V3PermYZX(mART.col2))); + } + } + + // TODO: force inline it? + PxIntBool operator()(const Vec3V center, const Vec3V extents) const + { + const Vec3V t = V3Sub(mT, center); + + // class I - axes of AABB + if(V3OutOfBounds(t, V3Add(extents, mBB_xyz))) + return PxIntFalse; + + const Vec3V rX = mRT.col0, rY = mRT.col1, rZ = mRT.col2; + const Vec3V arX = mART.col0, arY = mART.col1, arZ = mART.col2; + + const FloatV eX = V3GetX(extents), eY = V3GetY(extents), eZ = V3GetZ(extents); + const FloatV tX = V3GetX(t), tY = V3GetY(t), tZ = V3GetZ(t); + + // class II - axes of OBB + { + const Vec3V v = V3ScaleAdd(rZ, tZ, V3ScaleAdd(rY, tY, V3Scale(rX, tX))); + const Vec3V v2 = V3ScaleAdd(arZ, eZ, V3ScaleAdd(arY, eY, V3ScaleAdd(arX, eX, mExtents))); + if(V3OutOfBounds(v, v2)) + return PxIntFalse; + } + + if(!fullTest) + return PxIntTrue; + + // class III - edge cross products. Almost all OBB tests early-out with type I or type II, + // so early-outs here probably aren't useful (TODO: profile) + + const Vec3V va = V3NegScaleSub(rZ, tY, V3Scale(rY, tZ)); + const Vec3V va2 = V3ScaleAdd(arY, eZ, V3ScaleAdd(arZ, eY, mBB_123)); + const BoolV ba = BOr(V3IsGrtr(va, va2), V3IsGrtr(V3Neg(va2), va)); + + const Vec3V vb = V3NegScaleSub(rX, tZ, V3Scale(rZ, tX)); + const Vec3V vb2 = V3ScaleAdd(arX, eZ, V3ScaleAdd(arZ, eX, mBB_456)); + const BoolV bb = BOr(V3IsGrtr(vb, vb2), V3IsGrtr(V3Neg(vb2), vb)); + + const Vec3V vc = V3NegScaleSub(rY, tX, V3Scale(rX, tY)); + const Vec3V vc2 = V3ScaleAdd(arX, eY, V3ScaleAdd(arY, eX, mBB_789)); + const BoolV bc = BOr(V3IsGrtr(vc, vc2), V3IsGrtr(V3Neg(vc2), vc)); + + return PxIntBool(BAllEqFFFF(BOr(ba, BOr(bb,bc)))); + } + + Vec3V mExtents; // extents of OBB + Vec3V mT; // translation of OBB + Mat33V mRT; // transpose of rotation matrix of OBB + Mat33V mART; // transpose of mRT, padded by epsilon + + Vec3V mBB_xyz; // extents of OBB along coordinate axes + Vec3V mBB_123; // projections of extents onto edge-cross axes + Vec3V mBB_456; + Vec3V mBB_789; +}; + +typedef OBBAABBTests OBBAABBTest; + +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp new file mode 100644 index 0000000..5989400 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBounds.cpp @@ -0,0 +1,620 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBounds.h" + +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxCustomGeometry.h" +#include "GuInternal.h" +#include "CmUtils.h" +#include "GuConvexMesh.h" +#include "GuConvexMeshData.h" +#include "GuTriangleMesh.h" +#include "GuTetrahedronMesh.h" +#include "GuHeightFieldData.h" +#include "GuHeightField.h" +#include "GuConvexUtilsInternal.h" +#include "GuBoxConversion.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +// Compute global box for current node. The box is stored in mBV. +void Gu::computeGlobalBox(PxBounds3& bounds, PxU32 nbPrims, const PxBounds3* PX_RESTRICT boxes, const PxU32* PX_RESTRICT primitives) +{ + PX_ASSERT(boxes); + PX_ASSERT(primitives); + PX_ASSERT(nbPrims); + + Vec4V minV = V4LoadU(&boxes[primitives[0]].minimum.x); + Vec4V maxV = V4LoadU(&boxes[primitives[0]].maximum.x); + + for (PxU32 i=1; ix); + verts++; + + minV = V4Min(minV, vertexV); + maxV = V4Max(maxV, vertexV); + } + + StoreBounds(bounds, minV, maxV); +} + +void Gu::computeLocalBoundsAndGeomEpsilon(const PxVec3* vertices, PxU32 nbVerties, PxBounds3& localBounds, PxReal& geomEpsilon) +{ + computeBoundsAroundVertices(localBounds, nbVerties, vertices); + + // Derive a good geometric epsilon from local bounds. We must do this before bounds extrusion for heightfields. + // + // From Charles Bloom: + // "Epsilon must be big enough so that the consistency condition abs(D(Hit)) + // <= Epsilon is satisfied for all queries. You want the smallest epsilon + // you can have that meets that constraint. Normal floats have a 24 bit + // mantissa. When you do any float addition, you may have round-off error + // that makes the result off by roughly 2^-24 * result. Our result is + // scaled by the position values. If our world is strictly required to be + // in a box of world size W (each coordinate in -W to W), then the maximum + // error is 2^-24 * W. Thus Epsilon must be at least >= 2^-24 * W. If + // you're doing coordinate transforms, that may scale your error up by some + // amount, so you'll need a bigger epsilon. In general something like + // 2^-22*W is reasonable. If you allow scaled transforms, it needs to be + // something like 2^-22*W*MAX_SCALE." + // PT: TODO: runtime checkings for this + PxReal eps = 0.0f; + for (PxU32 i = 0; i < 3; i++) + eps = PxMax(eps, PxMax(PxAbs(localBounds.maximum[i]), PxAbs(localBounds.minimum[i]))); + eps *= powf(2.0f, -22.0f); + geomEpsilon = eps; +} + +static PX_FORCE_INLINE void transformNoEmptyTest(PxVec3p& c, PxVec3p& ext, const PxMat33& rot, const PxVec3& pos, const CenterExtentsPadded& bounds) +{ + c = rot.transform(bounds.mCenter) + pos; + ext = Cm::basisExtent(rot.column0, rot.column1, rot.column2, bounds.mExtents); +} + +// PT: this one may have duplicates in GuBV4_BoxSweep_Internal.h & GuBV4_Raycast.cpp +static PX_FORCE_INLINE Vec4V multiply3x3V(const Vec4V p, const PxMat33Padded& mat_Padded) +{ + Vec4V ResV = V4Scale(V4LoadU(&mat_Padded.column0.x), V4GetX(p)); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat_Padded.column1.x), V4GetY(p))); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat_Padded.column2.x), V4GetZ(p))); + return ResV; +} + +static PX_FORCE_INLINE void transformNoEmptyTestV(PxVec3p& c, PxVec3p& ext, const PxMat33Padded& rot, const PxVec3& pos, const CenterExtentsPadded& bounds) +{ + const Vec4V boundsCenterV = V4LoadU(&bounds.mCenter.x); // PT: this load is safe since extents follow center in the class + + // PT: unfortunately we can't V4LoadU 'pos' directly (it can come directly from users!). So we have to live with this for now: + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&pos.x)); + // PT: but eventually we'd like to use the "unsafe" version (e.g. by switching p&q in PxTransform), which would save 6 instructions on Win32 + const Vec4V cV = V4Add(multiply3x3V(boundsCenterV, rot), posV); +// const Vec4V cV = V4Add(multiply3x3V(boundsCenterV, rot), V4LoadU(&pos.x)); // ### unsafe + V4StoreU(cV, &c.x); + + // extended basis vectors + const Vec4V boundsExtentsV = V4LoadU(&bounds.mExtents.x); // PT: this load is safe since bounds are padded + const Vec4V c0V = V4Scale(V4LoadU(&rot.column0.x), V4GetX(boundsExtentsV)); + const Vec4V c1V = V4Scale(V4LoadU(&rot.column1.x), V4GetY(boundsExtentsV)); + const Vec4V c2V = V4Scale(V4LoadU(&rot.column2.x), V4GetZ(boundsExtentsV)); + + // find combination of base vectors that produces max. distance for each component = sum of abs() + Vec4V extentsV = V4Add(V4Abs(c0V), V4Abs(c1V)); + extentsV = V4Add(extentsV, V4Abs(c2V)); + V4StoreU(extentsV, &ext.x); +} + +static PX_FORCE_INLINE PxU32 isNonIdentity(const PxVec3& scale) +{ + #define IEEE_1_0 0x3f800000 //!< integer representation of 1.0 + const PxU32* binary = reinterpret_cast(&scale.x); + return (binary[0] - IEEE_1_0)|(binary[1] - IEEE_1_0)|(binary[2] - IEEE_1_0); +} + +// PT: please don't inline this one - 300+ lines of rarely used code +static void computeScaledMatrix(PxMat33Padded& rot, const PxMeshScale& scale) +{ + rot = rot * Cm::toMat33(scale); +} + +static PX_FORCE_INLINE void transformNoEmptyTest(PxVec3p& c, PxVec3p& ext, const PxTransform& transform, const PxMeshScale& scale, const CenterExtentsPadded& bounds) +{ + PxMat33Padded rot(transform.q); + + if(isNonIdentity(scale.scale)) + computeScaledMatrix(rot, scale); + + transformNoEmptyTestV(c, ext, rot, transform.p, bounds); +} + +static PX_FORCE_INLINE void transformNoEmptyTest(PxVec3p& c, PxVec3p& ext, const PxVec3& pos, const PxMat33Padded& rot, const PxMeshScale& scale, const CenterExtentsPadded& bounds) +{ + if(scale.isIdentity()) + transformNoEmptyTest(c, ext, rot, pos, bounds); + else + transformNoEmptyTest(c, ext, rot * Cm::toMat33(scale), pos, bounds); +} + +static void computeMeshBounds(const PxTransform& pose, const CenterExtentsPadded* PX_RESTRICT localSpaceBounds, const PxMeshScale& meshScale, PxVec3p& origin, PxVec3p& extent) +{ + transformNoEmptyTest(origin, extent, pose, meshScale, *localSpaceBounds); +} + +static void computePlaneBounds(PxBounds3& bounds, const PxTransform& pose, float contactOffset, float inflation) +{ + // PT: A plane is infinite, so usually the bounding box covers the whole world. + // Now, in particular cases when the plane is axis-aligned, we can take + // advantage of this to compute a smaller bounding box anyway. + + // PT: we use PX_MAX_BOUNDS_EXTENTS to be compatible with PxBounds3::setMaximal, + // and to make sure that the value doesn't collide with the BP's sentinels. + const PxF32 bigValue = PX_MAX_BOUNDS_EXTENTS; +// const PxF32 bigValue = 1000000.0f; + PxVec3 minPt = PxVec3(-bigValue, -bigValue, -bigValue); + PxVec3 maxPt = PxVec3(bigValue, bigValue, bigValue); + + const PxVec3 planeNormal = pose.q.getBasisVector0(); + const PxPlane plane(pose.p, planeNormal); + + const float nx = PxAbs(planeNormal.x); + const float ny = PxAbs(planeNormal.y); + const float nz = PxAbs(planeNormal.z); + const float epsilon = 1e-6f; + const float oneMinusEpsilon = 1.0f - epsilon; + if(nx>oneMinusEpsilon && ny0.0f) maxPt.x = -plane.d + contactOffset; + else minPt.x = plane.d - contactOffset; + } + else if(nxoneMinusEpsilon && nz0.0f) maxPt.y = -plane.d + contactOffset; + else minPt.y = plane.d - contactOffset; + } + else if(nxoneMinusEpsilon) + { + if(planeNormal.z>0.0f) maxPt.z = -plane.d + contactOffset; + else minPt.z = plane.d - contactOffset; + } + + // PT: it is important to compute the min/max form directly without going through the + // center/extents intermediate form. With PX_MAX_BOUNDS_EXTENTS, those back-and-forth + // computations destroy accuracy. + + // PT: inflation actually destroys the bounds really. We keep it to please UTs but this is broken (DE10595). + // (e.g. for SQ 1% of PX_MAX_BOUNDS_EXTENTS is still a huge number, effectively making the AABB infinite and defeating the point of the above computation) + if(inflation!=1.0f) + { + const PxVec3 c = (maxPt + minPt)*0.5f; + const PxVec3 e = (maxPt - minPt)*0.5f*inflation; + minPt = c - e; + maxPt = c + e; + } + + bounds.minimum = minPt; + bounds.maximum = maxPt; +} + +static PX_FORCE_INLINE void inflateBounds(PxBounds3& bounds, const PxVec3p& origin, const PxVec3p& extents, float contactOffset, float inflation) +{ + Vec4V extentsV = V4LoadU(&extents.x); + extentsV = V4Add(extentsV, V4Load(contactOffset)); + extentsV = V4Scale(extentsV, FLoad(inflation)); + + const Vec4V originV = V4LoadU(&origin.x); + const Vec4V minV = V4Sub(originV, extentsV); + const Vec4V maxV = V4Add(originV, extentsV); + + StoreBounds(bounds, minV, maxV); +} + +static PX_FORCE_INLINE Vec4V basisExtentV(const PxMat33Padded& basis, const PxVec3& extent, float offset, float inflation) +{ + // extended basis vectors + const Vec4V c0V = V4Scale(V4LoadU(&basis.column0.x), FLoad(extent.x)); + const Vec4V c1V = V4Scale(V4LoadU(&basis.column1.x), FLoad(extent.y)); + const Vec4V c2V = V4Scale(V4LoadU(&basis.column2.x), FLoad(extent.z)); + + // find combination of base vectors that produces max. distance for each component = sum of abs() + Vec4V extentsV = V4Add(V4Abs(c0V), V4Abs(c1V)); + extentsV = V4Add(extentsV, V4Abs(c2V)); + extentsV = V4Add(extentsV, V4Load(offset)); + extentsV = V4Scale(extentsV, FLoad(inflation)); + return extentsV; +} + +static PX_FORCE_INLINE void computeMeshBounds(PxBounds3& bounds, float contactOffset, float inflation, const PxTransform& pose, const CenterExtentsPadded* PX_RESTRICT localSpaceBounds, const PxMeshScale& scale) +{ + PxVec3p origin, extents; + computeMeshBounds(pose, localSpaceBounds, scale, origin, extents); + + ::inflateBounds(bounds, origin, extents, contactOffset, inflation); +} + +static void computeTightBounds(PxBounds3& bounds, PxU32 nb, const PxVec3* PX_RESTRICT v, const PxMat33Padded& rot, const PxTransform& pose, float contactOffset, float inflation) +{ + Vec4V minV; + Vec4V maxV; + + { + const Vec4V vertexV = multiply3x3V(V4LoadU(&v->x), rot); + v++; + + minV = vertexV; + maxV = vertexV; + nb--; + } + + while(nb--) + { + const Vec4V vertexV = multiply3x3V(V4LoadU(&v->x), rot); + v++; + + minV = V4Min(minV, vertexV); + maxV = V4Max(maxV, vertexV); + } + + const Vec4V offsetV = V4Load(contactOffset); + minV = V4Sub(minV, offsetV); + maxV = V4Add(maxV, offsetV); + + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&pose.p.x)); + maxV = V4Add(maxV, posV); + minV = V4Add(minV, posV); + + // Inflation + { + const Vec4V centerV = V4Scale(V4Add(maxV, minV), FLoad(0.5f)); + const Vec4V extentsV = V4Scale(V4Sub(maxV, minV), FLoad(0.5f*inflation)); + maxV = V4Add(centerV, extentsV); + minV = V4Sub(centerV, extentsV); + } + + StoreBounds(bounds, minV, maxV); +} + +void Gu::computeBounds(PxBounds3& bounds, const PxGeometry& geometry, const PxTransform& pose, float contactOffset, float inflation) +{ + // Box, Convex, Mesh and HeightField will compute local bounds and pose to world space. + // Sphere, Capsule & Plane will compute world space bounds directly. + + switch(geometry.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& shape = static_cast(geometry); + const PxVec3 extents((shape.radius+contactOffset)*inflation); + bounds.minimum = pose.p - extents; + bounds.maximum = pose.p + extents; + } + break; + + case PxGeometryType::ePLANE: + { + computePlaneBounds(bounds, pose, contactOffset, inflation); + } + break; + + case PxGeometryType::eCAPSULE: + { + computeCapsuleBounds(bounds, static_cast(geometry), pose, contactOffset, inflation); + } + break; + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& shape = static_cast(geometry); + + const PxVec3p origin(pose.p); + + const PxMat33Padded basis(pose.q); + + const Vec4V extentsV = basisExtentV(basis, shape.halfExtents, contactOffset, inflation); + + const Vec4V originV = V4LoadU(&origin.x); + const Vec4V minV = V4Sub(originV, extentsV); + const Vec4V maxV = V4Add(originV, extentsV); + + StoreBounds(bounds, minV, maxV); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& shape = static_cast(geometry); + const Gu::ConvexHullData& hullData = static_cast(shape.convexMesh)->getHull(); + + const bool useTightBounds = shape.meshFlags & PxConvexMeshGeometryFlag::eTIGHT_BOUNDS; + if(useTightBounds) + { + PxMat33Padded rot(pose.q); + + if(isNonIdentity(shape.scale.scale)) + computeScaledMatrix(rot, shape.scale); + + computeTightBounds(bounds, hullData.mNbHullVertices, hullData.getHullVertices(), rot, pose, contactOffset, inflation); + } + else + computeMeshBounds(bounds, contactOffset, inflation, pose, &hullData.getPaddedBounds(), shape.scale); + } + break; + + case PxGeometryType::eTRIANGLEMESH: + { + const PxTriangleMeshGeometry& shape = static_cast(geometry); + const TriangleMesh* triangleMesh = static_cast(shape.triangleMesh); + + const bool useTightBounds = shape.meshFlags & PxMeshGeometryFlag::eTIGHT_BOUNDS; + if(useTightBounds) + { + PxMat33Padded rot(pose.q); + + if(isNonIdentity(shape.scale.scale)) + computeScaledMatrix(rot, shape.scale); + + computeTightBounds(bounds, triangleMesh->getNbVerticesFast(), triangleMesh->getVerticesFast(), rot, pose, contactOffset, inflation); + } + else + computeMeshBounds(bounds, contactOffset, inflation, pose, &triangleMesh->getPaddedBounds(), shape.scale); + } + break; + + case PxGeometryType::eHEIGHTFIELD: + { + const PxHeightFieldGeometry& shape = static_cast(geometry); + computeMeshBounds(bounds, contactOffset, inflation, pose, &static_cast(shape.heightField)->getData().getPaddedBounds(), PxMeshScale(PxVec3(shape.rowScale, shape.heightScale, shape.columnScale))); + } + break; + + case PxGeometryType::eTETRAHEDRONMESH: + { + const PxTetrahedronMeshGeometry& shape = static_cast(geometry); + computeMeshBounds(bounds, contactOffset, inflation, pose, &static_cast(shape.tetrahedronMesh)->getPaddedBounds(), PxMeshScale()); + } + break; + + case PxGeometryType::ePARTICLESYSTEM: + { + // implement! + PX_ASSERT(0); + } + break; + + case PxGeometryType::eHAIRSYSTEM: + { + // jcarius: Hairsystem bounds only available on GPU + bounds.setEmpty(); + } + break; + + case PxGeometryType::eCUSTOM: + { + const PxCustomGeometry& shape = static_cast(geometry); + + PxVec3p centre(0), extents(0); + if (shape.callbacks) + { + const PxBounds3 b = shape.callbacks->getLocalBounds(shape); + centre = b.getCenter(); extents = b.getExtents(); + } + + const PxVec3p origin(pose.transform(centre)); + + const PxMat33Padded basis(pose.q); + + const Vec4V extentsV = basisExtentV(basis, extents, contactOffset, inflation); + + const Vec4V originV = V4LoadU(&origin.x); + const Vec4V minV = V4Sub(originV, extentsV); + const Vec4V maxV = V4Add(originV, extentsV); + + StoreBounds(bounds, minV, maxV); + } + break; + + default: + { + PX_ASSERT(0); + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Gu::computeBounds: Unknown shape type."); + } + } +} + +static PX_FORCE_INLINE void computeBoxExtentsAroundCapsule(PxVec3& extents, const PxCapsuleGeometry& capsuleGeom, float inflation) +{ + extents.x = (capsuleGeom.radius + capsuleGeom.halfHeight) * inflation; + extents.y = capsuleGeom.radius * inflation; + extents.z = capsuleGeom.radius * inflation; +} + +static const PxReal SQ_PRUNER_INFLATION = 1.01f; // pruner test shape inflation (not narrow phase shape) + +static void computeMeshBounds(const PxVec3& pos, const PxMat33Padded& rot, const CenterExtentsPadded* PX_RESTRICT localSpaceBounds, const PxMeshScale& meshScale, PxVec3p& origin, PxVec3p& extent) +{ + PxPrefetchLine(localSpaceBounds); // PT: this one helps reducing L2 misses in transformNoEmptyTest + transformNoEmptyTest(origin, extent, pos, rot, meshScale, *localSpaceBounds); +} + +// PT: warning: this writes 4 bytes after the end of 'bounds'. Calling code must ensure it is safe to do so. +static PX_FORCE_INLINE void computeMinMaxBounds(PxBounds3* PX_RESTRICT bounds, const PxVec3p& c, const PxVec3p& e, float prunerInflation, float offset) +{ + const Vec4V extentsV = V4Scale(V4Add(V4LoadU(&e.x), V4Load(offset)), FLoad(prunerInflation)); + const Vec4V centerV = V4LoadU(&c.x); + const Vec4V minV = V4Sub(centerV, extentsV); + const Vec4V maxV = V4Add(centerV, extentsV); + V4StoreU(minV, &bounds->minimum.x); + V4StoreU(maxV, &bounds->maximum.x); +} + +ShapeData::ShapeData(const PxGeometry& g, const PxTransform& t, PxReal inflation) +{ + using namespace physx::aos; + + // PT: this cast to matrix is already done in GeometryUnion::computeBounds (e.g. for boxes). So we do it first, + // then we'll pass the matrix directly to computeBoundsShapeData, to avoid the double conversion. + const bool isOBB = PxAbs(t.q.w) < 0.999999f; + if(isOBB) + { + // PT: writes 4 bytes after 'rot' but it's safe since we then write 'center' just afterwards + buildFrom(mGuBox, t.q); + } + else + { + mGuBox.rot = PxMat33(PxIdentity); + } + + // PT: can't use V4Load here since there's no guarantee on 't.p' + // PT: must store 'center' after 'rot' now + mGuBox.center = t.p; + + // Compute AABB, used by the BucketPruner as cullBox + switch(g.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& shape = static_cast(g); + computeMinMaxBounds(&mPrunerInflatedAABB, mGuBox.center, PxVec3(0.0f), SQ_PRUNER_INFLATION, shape.radius+inflation); + + // + + reinterpret_cast(mGuSphere) = Sphere(t.p, shape.radius); + } + break; + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& shape = static_cast(g); + const PxVec3p extents = mGuBox.rot.column0.abs() * shape.halfHeight; + computeMinMaxBounds(&mPrunerInflatedAABB, mGuBox.center, extents, SQ_PRUNER_INFLATION, shape.radius+inflation); + + // + + Capsule& dstWorldCapsule = reinterpret_cast(mGuCapsule); // store a narrow phase version copy + getCapsule(dstWorldCapsule, shape, t); + + mGuBox.extents.x = shape.halfHeight; + + // compute PxBoxGeometry pruner geom around input capsule geom; transform remains unchanged + + computeBoxExtentsAroundCapsule(mPrunerBoxGeomExtents, shape, SQ_PRUNER_INFLATION); + } + break; + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& shape = static_cast(g); + // PT: cast is safe because 'rot' followed by other members + Vec4V extentsV = basisExtentV(static_cast(mGuBox.rot), shape.halfExtents, inflation, SQ_PRUNER_INFLATION); + + // PT: c/e-to-m/M conversion + const Vec4V centerV = V4LoadU(&mGuBox.center.x); + const Vec4V minV = V4Sub(centerV, extentsV); + const Vec4V maxV = V4Add(centerV, extentsV); + V4StoreU(minV, &mPrunerInflatedAABB.minimum.x); + V4StoreU(maxV, &mPrunerInflatedAABB.maximum.x); // PT: WARNING: writes past end of class + + // + + mGuBox.extents = shape.halfExtents; // PT: TODO: use SIMD + mPrunerBoxGeomExtents = shape.halfExtents*SQ_PRUNER_INFLATION; + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& shape = static_cast(g); + + const ConvexMesh* cm = static_cast(shape.convexMesh); + const ConvexHullData* hullData = &cm->getHull(); + + // PT: cast is safe since 'rot' is followed by other members of the box + PxVec3p center, extents; + computeMeshBounds(mGuBox.center, static_cast(mGuBox.rot), &hullData->getPaddedBounds(), shape.scale, center, extents); + + computeMinMaxBounds(&mPrunerInflatedAABB, center, extents, SQ_PRUNER_INFLATION, inflation); + + // + + Box prunerBox; + computeOBBAroundConvex(prunerBox, shape, cm, t); + mGuBox.rot = prunerBox.rot; // PT: TODO: optimize this copy + + // AP: pruners are now responsible for growing the OBB by 1% for overlap/sweep/GJK accuracy + mPrunerBoxGeomExtents = prunerBox.extents*SQ_PRUNER_INFLATION; + mGuBox.center = prunerBox.center; + } + break; + + default: + PX_ALWAYS_ASSERT_MESSAGE("PhysX internal error: Invalid shape in ShapeData contructor."); + } + + // PT: WARNING: these writes must stay after the above code + mIsOBB = PxU32(isOBB); + mType = PxU16(g.getType()); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp new file mode 100644 index 0000000..45b7180 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBox.cpp @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "GuBoxConversion.h" +#include "GuInternal.h" + +using namespace physx; + +void Gu::Box::create(const Gu::Capsule& capsule) +{ + // Box center = center of the two LSS's endpoints + center = capsule.computeCenter(); + + // Box orientation + const PxVec3 dir = capsule.p1 - capsule.p0; + const float d = dir.magnitude(); + if(d!=0.0f) + { + rot.column0 = dir / d; + PxComputeBasisVectors(rot.column0, rot.column1, rot.column2); + } + else + rot = PxMat33(PxIdentity); + + // Box extents + extents.x = capsule.radius + (d * 0.5f); + extents.y = capsule.radius; + extents.z = capsule.radius; +} + + +/** +Returns edges. +\return 24 indices (12 edges) indexing the list returned by ComputePoints() +*/ +const PxU8* Gu::getBoxEdges() +{ + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + static PxU8 Indices[] = { + 0, 1, 1, 2, 2, 3, 3, 0, + 7, 6, 6, 5, 5, 4, 4, 7, + 1, 5, 6, 2, + 3, 7, 4, 0 + }; + return Indices; +} + + +void Gu::computeOBBPoints(PxVec3* PX_RESTRICT pts, const PxVec3& center, const PxVec3& extents, const PxVec3& base0, const PxVec3& base1, const PxVec3& base2) +{ + PX_ASSERT(pts); + + // "Rotated extents" + const PxVec3 axis0 = base0 * extents.x; + const PxVec3 axis1 = base1 * extents.y; + const PxVec3 axis2 = base2 * extents.z; + + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + // Original code: 24 vector ops + /* pts[0] = box.center - Axis0 - Axis1 - Axis2; + pts[1] = box.center + Axis0 - Axis1 - Axis2; + pts[2] = box.center + Axis0 + Axis1 - Axis2; + pts[3] = box.center - Axis0 + Axis1 - Axis2; + pts[4] = box.center - Axis0 - Axis1 + Axis2; + pts[5] = box.center + Axis0 - Axis1 + Axis2; + pts[6] = box.center + Axis0 + Axis1 + Axis2; + pts[7] = box.center - Axis0 + Axis1 + Axis2;*/ + + // Rewritten: 12 vector ops + pts[0] = pts[3] = pts[4] = pts[7] = center - axis0; + pts[1] = pts[2] = pts[5] = pts[6] = center + axis0; + + PxVec3 tmp = axis1 + axis2; + pts[0] -= tmp; + pts[1] -= tmp; + pts[6] += tmp; + pts[7] += tmp; + + tmp = axis1 - axis2; + pts[2] += tmp; + pts[3] += tmp; + pts[4] -= tmp; + pts[5] -= tmp; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp new file mode 100644 index 0000000..f5fec4f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuBucketPruner.cpp @@ -0,0 +1,2727 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "foundation/PxBitUtils.h" +#include "GuBucketPruner.h" +#include "GuInternal.h" +#include "CmVisualization.h" +#include "CmRadixSort.h" + +using namespace physx::aos; + +using namespace physx; +using namespace Gu; + +#define INVALID_HANDLE 0xffffffff + +/* +TODO: +- if Core is always available, mSortedObjects could be replaced with just indices to mCoreObjects => less memory. +- UTS: + - test that queries against empty boxes all return false +- invalidate after 16 removes +- check shiftOrigin stuff (esp what happens to emptied boxes) + - isn't there a very hard-to-find bug waiting to happen in there, + when the shift touches the empty box and overrides mdata0/mdata1 with "wrong" values that break the sort? +- revisit updateObject/removeObject +- optimize/cache computation of free global bounds before clipRay + +- remove temp memory buffers (sorted arrays) +- take care of code duplication +- better code to generate SIMD 0x7fffffff +- refactor SIMD tests +- optimize: + - better split values + - optimize update (bitmap, less data copy, etc) + - use ray limits in traversal code too? + - the SIMD XBOX code operates on Min/Max rather than C/E. Change format? + - or just try the alternative ray-box code (as on PC) ==> pretty much exactly the same speed +*/ + +//#define VERIFY_SORT +//#define BRUTE_FORCE_LIMIT 32 +#define LOCAL_SIZE 256 // Size of various local arrays. Dynamic allocations occur if exceeded. +#define USE_SIMD // Use SIMD code or not (sanity performance check) +#define NODE_SORT // Enable/disable node sorting +#define NODE_SORT_MIN_COUNT 16 // Limit above which node sorting is performed +#if PX_INTEL_FAMILY + #if COMPILE_VECTOR_INTRINSICS + #define CAN_USE_MOVEMASK + #endif +#endif + +#define ALIGN16(size) ((unsigned(size)+15) & unsigned(~15)) + +#ifdef _DEBUG + #define AlignedLoad V4LoadU + #define AlignedStore V4StoreU +#else + #define AlignedLoad V4LoadA + #define AlignedStore V4StoreA +#endif + +// SAT-based ray-box overlap test has accuracy issues for long rays, so we clip them against the global AABB to limit these issues. +static void clipRay(const PxVec3& rayOrig, const PxVec3& rayDir, float& maxDist, const PxVec3& boxMin, const PxVec3& boxMax) +{ + const PxVec3 boxCenter = (boxMax + boxMin)*0.5f; + const PxVec3 boxExtents = (boxMax - boxMin)*0.5f; + const float dpc = boxCenter.dot(rayDir); + const float extentsMagnitude = boxExtents.magnitude(); + const float dpMin = dpc - extentsMagnitude; + const float dpMax = dpc + extentsMagnitude; + const float dpO = rayOrig.dot(rayDir); + const float boxLength = extentsMagnitude * 2.0f; + const float distToBox = PxMin(PxAbs(dpMin - dpO), PxAbs(dpMax - dpO)); + maxDist = distToBox + boxLength * 2.0f; +} + +BucketPrunerNode::BucketPrunerNode() +{ + for(PxU32 i=0;i<5;i++) + mBucketBox[i].setEmpty(); +} + +static const PxU8 gCodes[] = { 4, 4, 4, 4, 4, 3, 2, 2, + 4, 1, 0, 0, 4, 1, 0, 0, + 4, 1, 0, 0, 2, 1, 0, 0, + 3, 1, 0, 0, 2, 1, 0, 0}; + +#ifdef CAN_USE_MOVEMASK +/*static PX_FORCE_INLINE PxU32 classifyBox_x86(const BucketBox& box, const PxVec4& limits, const bool useY, const bool isCrossBucket) +{ + const Vec4V extents = AlignedLoad(&box.mExtents.x); + const Vec4V center = AlignedLoad(&box.mCenter.x); + const Vec4V plus = V4Add(extents, center); + const Vec4V minus = V4Sub(extents, center); + + Vec4V tmp; + if(useY) // PT: this is a constant so branch prediction works here + tmp = _mm_shuffle_ps(plus, minus, _MM_SHUFFLE(0,1,0,1)); + else + tmp = _mm_shuffle_ps(plus, minus, _MM_SHUFFLE(0,2,0,2)); + + const Vec4V comp = _mm_shuffle_ps(tmp, tmp, _MM_SHUFFLE(0,2,1,3)); // oh well, nm + + const PxU32 Code = (PxU32)_mm_movemask_ps(V4IsGrtr(V4LoadA(&limits.x), comp)); + return gCodes[Code | PxU32(isCrossBucket)<<4]; +}*/ + +static PX_FORCE_INLINE PxU32 classifyBox_x86(const Vec4V boxMin, const Vec4V boxMax, const PxVec4& limits, const bool useY, const bool isCrossBucket) +{ + const Vec4V plus = boxMax; + const Vec4V minus = V4Neg(boxMin); + + Vec4V tmp; + if(useY) // PT: this is a constant so branch prediction works here + tmp = _mm_shuffle_ps(plus, minus, _MM_SHUFFLE(0,1,0,1)); + else + tmp = _mm_shuffle_ps(plus, minus, _MM_SHUFFLE(0,2,0,2)); + + const Vec4V comp = _mm_shuffle_ps(tmp, tmp, _MM_SHUFFLE(0,2,1,3)); // oh well, nm + + const PxU32 Code = PxU32(_mm_movemask_ps(V4IsGrtr(V4LoadA(&limits.x), comp))); + return gCodes[Code | PxU32(isCrossBucket)<<4]; +} +#endif + +#ifdef CAN_USE_MOVEMASK + #if PX_DEBUG + #define USE_CLASSIFY_BOX + #endif +#else + #define USE_CLASSIFY_BOX +#endif + +#ifdef USE_CLASSIFY_BOX +static PX_FORCE_INLINE PxU32 classifyBox(const BucketBox& box, const float limitX, const float limitYZ, const PxU32 yz, const bool isCrossBucket) +{ + const bool upperPart = (box.mCenter[yz] + box.mExtents[yz])limitYZ; + const bool leftPart = (box.mCenter.x + box.mExtents.x)limitX; + + // Table-based box classification avoids many branches + const PxU32 Code = PxU32(rightPart)|(PxU32(leftPart)<<1)|(PxU32(lowerPart)<<2)|(PxU32(upperPart)<<3); + return gCodes[Code + (isCrossBucket ? 16 : 0)]; +} +#endif + +void BucketPrunerNode::classifyBoxes( float limitX, float limitYZ, + PxU32 nb, BucketBox* PX_RESTRICT boxes, const PrunerPayload* PX_RESTRICT objects, + const PxTransform* PX_RESTRICT transforms, + BucketBox* PX_RESTRICT sortedBoxes, PrunerPayload* PX_RESTRICT sortedObjects, + PxTransform* PX_RESTRICT sortedTransforms, + bool isCrossBucket, PxU32 sortAxis) +{ + const PxU32 yz = PxU32(sortAxis == 1 ? 2 : 1); + + #ifdef _DEBUG + { + float prev = boxes[0].mDebugMin; + for(PxU32 i=1;i=prev); + prev = current; + } + } + #endif + + // Local (stack-based) min/max bucket bounds + PX_ALIGN(16, PxVec4) bucketBoxMin[5]; + PX_ALIGN(16, PxVec4) bucketBoxMax[5]; + { + const PxBounds3 empty = PxBounds3::empty(); + for(PxU32 i=0;i<5;i++) + { + mCounters[i] = 0; + bucketBoxMin[i] = PxVec4(empty.minimum, 0.0f); + bucketBoxMax[i] = PxVec4(empty.maximum, 0.0f); + } + } + + { +#ifdef CAN_USE_MOVEMASK + // DS: order doesn't play nice with x86 shuffles :-| + PX_ALIGN(16, PxVec4) limits(-limitX, limitX, -limitYZ, limitYZ); + const bool useY = yz==1; +#endif + // Determine in which bucket each object falls, update bucket bounds + for(PxU32 i=0;i=prev); + prev = current; + } + } + } + #endif +} + +/////////////////////////////////////////////////////////////////////////////// + +static void processChildBuckets(PxU32 nbAllocated, + BucketBox* sortedBoxesInBucket, PrunerPayload* sortedObjectsInBucket, + PxTransform* sortedTransformsInBucket, + const BucketPrunerNode& bucket, BucketPrunerNode* PX_RESTRICT childBucket, + BucketBox* PX_RESTRICT baseBucketsBoxes, PrunerPayload* PX_RESTRICT baseBucketsObjects, + PxTransform* baseBucketTransforms, + PxU32 sortAxis) +{ + PX_UNUSED(nbAllocated); + + const PxU32 yz = PxU32(sortAxis == 1 ? 2 : 1); + for(PxU32 i=0;i<5;i++) + { + const PxU32 nbInBucket = bucket.mCounters[i]; + if(!nbInBucket) + { + childBucket[i].initCounters(); + continue; + } + BucketBox* bucketsBoxes = baseBucketsBoxes + bucket.mOffsets[i]; + PrunerPayload* bucketsObjects = baseBucketsObjects + bucket.mOffsets[i]; + PxTransform* bucketTransforms = baseBucketTransforms + bucket.mOffsets[i]; + PX_ASSERT(nbInBucket<=nbAllocated); + + const float limitX = bucket.mBucketBox[i].mCenter.x; + const float limitYZ = bucket.mBucketBox[i].mCenter[yz]; + const bool isCrossBucket = i==4; + childBucket[i].classifyBoxes(limitX, limitYZ, nbInBucket, bucketsBoxes, bucketsObjects, + bucketTransforms, + sortedBoxesInBucket, sortedObjectsInBucket, + sortedTransformsInBucket, + isCrossBucket, sortAxis); + + PxMemCopy(bucketsBoxes, sortedBoxesInBucket, sizeof(BucketBox)*nbInBucket); + PxMemCopy(bucketsObjects, sortedObjectsInBucket, sizeof(PrunerPayload)*nbInBucket); + PxMemCopy(bucketTransforms, sortedTransformsInBucket, sizeof(PxTransform)*nbInBucket); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxU32 encodeFloat(PxU32 newPos) +{ + //we may need to check on -0 and 0 + //But it should make no practical difference. + if(newPos & PX_SIGN_BITMASK) //negative? + return ~newPos;//reverse sequence of negative numbers + else + return newPos | PX_SIGN_BITMASK; // flip sign +} + +static PX_FORCE_INLINE void computeRayLimits(float& rayMin, float& rayMax, const PxVec3& rayOrig, const PxVec3& rayDir, float maxDist, PxU32 sortAxis) +{ + const float rayOrigValue = rayOrig[sortAxis]; + const float rayDirValue = rayDir[sortAxis] * maxDist; + rayMin = PxMin(rayOrigValue, rayOrigValue + rayDirValue); + rayMax = PxMax(rayOrigValue, rayOrigValue + rayDirValue); +} + +static PX_FORCE_INLINE void computeRayLimits(float& rayMin, float& rayMax, const PxVec3& rayOrig, const PxVec3& rayDir, float maxDist, const PxVec3& inflate, PxU32 sortAxis) +{ + const float inflateValue = inflate[sortAxis]; + const float rayOrigValue = rayOrig[sortAxis]; + const float rayDirValue = rayDir[sortAxis] * maxDist; + rayMin = PxMin(rayOrigValue, rayOrigValue + rayDirValue) - inflateValue; + rayMax = PxMax(rayOrigValue, rayOrigValue + rayDirValue) + inflateValue; +} + +static PX_FORCE_INLINE void encodeBoxMinMax(BucketBox& box, const PxU32 axis) +{ + const float min = box.mCenter[axis] - box.mExtents[axis]; + const float max = box.mCenter[axis] + box.mExtents[axis]; + + const PxU32* binaryMin = reinterpret_cast(&min); + const PxU32* binaryMax = reinterpret_cast(&max); + box.mData0 = encodeFloat(binaryMin[0]); + box.mData1 = encodeFloat(binaryMax[0]); +} + +/////////////////////////////////////////////////////////////////////////////// + +BucketPrunerCore::BucketPrunerCore(bool externalMemory) : + mCoreNbObjects (0), + mCoreCapacity (0), + mCoreBoxes (NULL), + mCoreObjects (NULL), + mCoreTransforms (NULL), + mCoreRemap (NULL), + mSortedWorldBoxes (NULL), + mSortedObjects (NULL), + mSortedTransforms (NULL), +#ifdef FREE_PRUNER_SIZE + mNbFree (0), +#endif + mSortedNb (0), + mSortedCapacity (0), + mSortAxis (0), + mDirty (false), + mOwnMemory (!externalMemory) +{ + mGlobalBox.setEmpty(); + + mLevel1.initCounters(); + + for(PxU32 i=0;i<5;i++) + mLevel2[i].initCounters(); + for(PxU32 j=0;j<5;j++) + for(PxU32 i=0;i<5;i++) + mLevel3[j][i].initCounters(); +} + +BucketPrunerCore::~BucketPrunerCore() +{ + release(); +} + +void BucketPrunerCore::release() +{ + mDirty = true; + mCoreNbObjects = 0; + + mCoreCapacity = 0; + if(mOwnMemory) + { + PX_FREE(mCoreBoxes); + PX_FREE(mCoreObjects); + PX_FREE(mCoreTransforms); + PX_FREE(mCoreRemap); + } + + PX_FREE(mSortedWorldBoxes); + PX_FREE(mSortedObjects); + PX_FREE(mSortedTransforms); + mSortedNb = 0; + mSortedCapacity = 0; + +#ifdef FREE_PRUNER_SIZE + mNbFree = 0; +#endif +#ifdef USE_REGULAR_HASH_MAP + mMap.clear(); +#else + mMap.purge(); +#endif +} + +void BucketPrunerCore::setExternalMemory(PxU32 nbObjects, PxBounds3* boxes, PrunerPayload* objects, PxTransform* transforms) +{ + PX_ASSERT(!mOwnMemory); + mCoreNbObjects = nbObjects; + mCoreBoxes = boxes; + mCoreObjects = objects; + mCoreTransforms = transforms; + mCoreRemap = NULL; +} + +void BucketPrunerCore::allocateSortedMemory(PxU32 nb) +{ + mSortedNb = nb; + if(nb<=mSortedCapacity && (nb>=mSortedCapacity/2)) + return; + + const PxU32 capacity = PxNextPowerOfTwo(nb); + mSortedCapacity = capacity; + + PxU32 bytesNeededForBoxes = capacity*sizeof(BucketBox); + bytesNeededForBoxes = ALIGN16(bytesNeededForBoxes); + + PxU32 bytesNeededForObjects = capacity*sizeof(PrunerPayload); + bytesNeededForObjects = ALIGN16(bytesNeededForObjects); + + // PT: TODO: I don't remember what this alignment is for, maybe we don't need it + PxU32 bytesNeededForTransforms = capacity*sizeof(PxTransform); + bytesNeededForTransforms = ALIGN16(bytesNeededForTransforms); + + PX_FREE(mSortedObjects); + PX_FREE(mSortedWorldBoxes); + PX_FREE(mSortedTransforms); + + mSortedWorldBoxes = reinterpret_cast(PX_ALLOC(bytesNeededForBoxes, "BucketPruner")); + mSortedObjects = reinterpret_cast(PX_ALLOC(bytesNeededForObjects, "BucketPruner")); + mSortedTransforms = reinterpret_cast(PX_ALLOC(bytesNeededForTransforms, "BucketPruner")); + + PX_ASSERT(!(size_t(mSortedWorldBoxes)&15)); + PX_ASSERT(!(size_t(mSortedObjects)&15)); + PX_ASSERT(!(size_t(mSortedTransforms)&15)); +} + +/////////////////////////////////////////////////////////////////////////////// + +void BucketPrunerCore::resizeCore() +{ + const PxU32 capacity = mCoreCapacity ? mCoreCapacity*2 : 32; + mCoreCapacity = capacity; + + const PxU32 bytesNeededForBoxes = capacity*sizeof(PxBounds3); + const PxU32 bytesNeededForObjects = capacity*sizeof(PrunerPayload); + const PxU32 bytesNeededForTransforms = capacity*sizeof(PxTransform); + const PxU32 bytesNeededForRemap = capacity*sizeof(PxU32); + + PxBounds3* newCoreBoxes = reinterpret_cast(PX_ALLOC(bytesNeededForBoxes, "BucketPruner")); + PrunerPayload* newCoreObjects = reinterpret_cast(PX_ALLOC(bytesNeededForObjects, "BucketPruner")); + PxTransform* newCoreTransforms = reinterpret_cast(PX_ALLOC(bytesNeededForTransforms, "BucketPruner")); + PxU32* newCoreRemap = reinterpret_cast(PX_ALLOC(bytesNeededForRemap, "BucketPruner")); + if(mCoreBoxes) + { + PxMemCopy(newCoreBoxes, mCoreBoxes, mCoreNbObjects*sizeof(PxBounds3)); + PX_FREE(mCoreBoxes); + } + if(mCoreObjects) + { + PxMemCopy(newCoreObjects, mCoreObjects, mCoreNbObjects*sizeof(PrunerPayload)); + PX_FREE(mCoreObjects); + } + if(mCoreTransforms) + { + PxMemCopy(newCoreTransforms, mCoreTransforms, mCoreNbObjects*sizeof(PxTransform)); + PX_FREE(mCoreTransforms); + } + if(mCoreRemap) + { + PxMemCopy(newCoreRemap, mCoreRemap, mCoreNbObjects*sizeof(PxU32)); + PX_FREE(mCoreRemap); + } + mCoreBoxes = newCoreBoxes; + mCoreObjects = newCoreObjects; + mCoreTransforms = newCoreTransforms; + mCoreRemap = newCoreRemap; +} + +PX_FORCE_INLINE void BucketPrunerCore::addObjectInternal(const PrunerPayload& object, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp) +{ + if(mCoreNbObjects==mCoreCapacity) + resizeCore(); + + const PxU32 index = mCoreNbObjects++; + mCoreObjects[index] = object; + mCoreBoxes[index] = worldAABB; // PT: TODO: check assembly here + mCoreTransforms[index] = transform; // PT: TODO: check assembly here + mCoreRemap[index] = 0xffffffff; + + // Objects are only inserted into the map once they're part of the main/core arrays. +#ifdef USE_REGULAR_HASH_MAP + bool ok = mMap.insert(object, BucketPrunerPair(index, timeStamp)); +#else + BucketPrunerPair* ok = mMap.addPair(object, index, timeStamp); +#endif + PX_UNUSED(ok); + PX_ASSERT(ok); +} + +bool BucketPrunerCore::addObject(const PrunerPayload& object, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp) +{ +/* + We should probably use a bigger payload/userData struct here, which would also contains the external handle. + (EDIT: we can't even do that, because of the setExternalMemory function) + When asked to update/remove an object it would be O(n) to find the proper object in the mSortedObjects array. + + - + + For removing it we can simply empty the corresponding box, and the object will never be returned from queries. + Maybe this isn't even true, since boxes are sorted along one axis. So marking a box as empty could break the code relying on a sorted order. + An alternative is to mark the external handle as invalid, and ignore the object when a hit is found. + + (EDIT: the sorting is now tested via data0/data1 anyway so we could mark the box as empty without breaking this) + + - + + For updating an object we would need to keep the (sub) array sorted (not the whole thing, only the array within a bucket). + We don't know the range (what part of the array maps to our bucket) but we may have the bucket ID somewhere? If we'd have this + we could parse the array left/right and resort just the right boxes. If we don't have this we may be able to "quickly" find the + range by traversing the tree, looking for the proper bucket. In any case I don't think there's a mapping to update within a bucket, + unlike in SAP or MBP. So we should be able to shuffle a bucket without having to update anything. For example there's no mapping + between the Core array and the Sorted array. It's a shame in a way because we'd need one, but it's not there - and in fact I think + we can free the Core array once Sorted is created, we don't need it at all. + + If we don't want to re-sort the full bucket we can just mark it as dirty and ignore the sort-based early exits in the queries. Then we + can incrementally resort it over N frames or something. + + This only works if the updated object remains in the same bucket though. If it moves to another bucket it becomes tempting to just remove + the object and re-insert it. + + - + + Now for adding an object, we can first have a "free pruner" and do the 16 next entries brute-force. Rebuilding every 16 objects might + give a good speedup already. Otherwise we need to do something more complicated. +*/ + + PX_ASSERT(mOwnMemory); + PX_ASSERT(!mDirty || !mNbFree); + if(!mDirty) + { +#ifdef FREE_PRUNER_SIZE + // In this path the structure is marked as valid. We do not want to invalidate it for each new object... + if(mNbFreesecond.mCoreIndex; + timeStamp = removedEntry->second.mTimeStamp; +#else + PxU32 coreIndex; // This is the object's index in the core arrays. + if(mMap.removePair(object, coreIndex, timeStamp)) + { +#endif + // In this codepath, the object we want to remove exists in the core arrays. + + // We will need to remove it from both the core arrays & the sorted arrays. + const PxU32 sortedIndex = mCoreRemap[coreIndex]; // This is the object's index in the sorted arrays. + +#ifdef USE_REGULAR_HASH_MAP + bool status = mMap.erase(object); + PX_ASSERT(status); + PX_UNUSED(status); +#endif + + // First let's deal with the core arrays + mCoreNbObjects--; + if(coreIndex!=mCoreNbObjects) + { + // If it wasn't the last object in the array, close the gaps as usual + const PrunerPayload& movedObject = mCoreObjects[mCoreNbObjects]; + mCoreBoxes[coreIndex] = mCoreBoxes[mCoreNbObjects]; + mCoreTransforms[coreIndex] = mCoreTransforms[mCoreNbObjects]; + mCoreObjects[coreIndex] = movedObject; + mCoreRemap[coreIndex] = mCoreRemap[mCoreNbObjects]; + + // Since we just moved the last object, its index in the core arrays has changed. + // We must reflect this change in the map. +#ifdef USE_REGULAR_HASH_MAP + BucketPrunerMap::Entry* movedEntry = const_cast(mMap.find(movedObject)); + PX_ASSERT(movedEntry->second.mCoreIndex==mCoreNbObjects); + movedEntry->second.mCoreIndex = coreIndex; +#else + BucketPrunerPair* movedEntry = const_cast(mMap.findPair(movedObject)); + PX_ASSERT(movedEntry->mCoreIndex==mCoreNbObjects); + movedEntry->mCoreIndex = coreIndex; +#endif + } + + // Now, let's deal with the sorted arrays. + // If the structure is dirty, the sorted arrays will be rebuilt from scratch so there's no need to + // update them right now. + if(!mDirty) + { + // If the structure is valid, we want to keep it this way to avoid rebuilding sorted arrays after + // each removal. We can't "close the gaps" easily here because order of objects in the arrays matters. + + // Instead we just invalidate the object by setting its bounding box as empty. + // Queries against empty boxes will never return a hit, so this effectively "removes" the object + // from any subsequent query results. Sorted arrays now contain a "disabled" object, until next build. + + // Invalidating the box does not invalidate the sorting, since it's now captured in mData0/mData1. + // That is, mData0/mData1 keep their previous integer-encoded values, as if the box/object was still here. + mSortedWorldBoxes[sortedIndex].mCenter = PxVec3(0.0f); + mSortedWorldBoxes[sortedIndex].mExtents = PxVec3(-GU_EMPTY_BOUNDS_EXTENTS); + // Note that we don't touch mSortedObjects here. We could, but this is not necessary. + } + return true; + } + +#ifdef FREE_PRUNER_SIZE + // Here, the object we want to remove exists in the free array. So we just parse it. + for(PxU32 i=0;i(mMap.find(movedObject)); + PX_ASSERT(movedEntry->second.mCoreIndex==coreNbObjects); + movedEntry->second.mCoreIndex = coreIndex; +#else + BucketPrunerPair* movedEntry = const_cast(mMap.findPair(movedObject)); + PX_ASSERT(movedEntry->mCoreIndex==coreNbObjects); + movedEntry->mCoreIndex = coreIndex; +#endif + } + + nbRemoved++; +#ifdef USE_REGULAR_HASH_MAP + bool status = mMap.erase(p.first); + PX_ASSERT(status); + PX_UNUSED(status); +#else + const PxU32 hashValue = PxComputeHash(p.mData) & mMap.mMask; + mMap.removePairInternal(p.mData, hashValue, i); +#endif + nbActivePairs--; + } + else i++; + } + mCoreNbObjects = coreNbObjects; + +#ifdef USE_REGULAR_HASH_MAP +#else + mMap.shrinkMemory(); +#endif + } + +#ifdef FREE_PRUNER_SIZE + // PT: ...then we look in the 'free' array + PxU32 i=0; + while(i0); + Vec4V mergedMinV = V4LoadU(&boxes[nb-1].minimum.x); + Vec4V mergedMaxV = Vec4V_From_Vec3V(V3LoadU(&boxes[nb-1].maximum.x)); + for(PxU32 i=0;i(sortedObjects); + for(PxU32 i=0;i + PX_CUDA_CALLABLE PX_FORCE_INLINE void tswap(T& x, T& y) + { + T tmp = x; + x = y; + y = tmp; + } + +/* PX_FORCE_INLINE __m128 DotV(const __m128 a, const __m128 b) + { + const __m128 dot1 = _mm_mul_ps(a, b); + const __m128 shuf1 = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(dot1), _MM_SHUFFLE(0,0,0,0))); + const __m128 shuf2 = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(dot1), _MM_SHUFFLE(1,1,1,1))); + const __m128 shuf3 = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(dot1), _MM_SHUFFLE(2,2,2,2))); + return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); + }*/ + +// PT: hmmm, by construction, isn't the order always the same for all bucket pruners? +// => maybe not because the bucket boxes are still around the merged aabbs, not around the bucket +// Still we could do something here +static /*PX_FORCE_INLINE*/ PxU32 sort(const BucketPrunerNode& parent, const PxVec3& rayDir) +{ + const PxU32 totalCount = parent.mCounters[0]+parent.mCounters[1]+parent.mCounters[2]+parent.mCounters[3]+parent.mCounters[4]; + if(totalCount(dp); + const PxU32* values = PxUnionCast(dp); + + PxU32 value0 = values[0]; + PxU32 value1 = values[1]; + PxU32 value2 = values[2]; + PxU32 value3 = values[3]; + PxU32 value4 = values[4]; + + for(PxU32 j=0;j<5-1;j++) + { + if(value1(dp); + +// const PxU32 mask = ~7U; + const PxU32 mask = 0x7ffffff8; + PxU32 value0 = (values[0]&mask); + PxU32 value1 = (values[1]&mask)|1; + PxU32 value2 = (values[2]&mask)|2; + PxU32 value3 = (values[3]&mask)|3; + PxU32 value4 = (values[4]&mask)|4; + +#define SORT_BLOCK \ + if(value1(PX_ALLOC(nb*sizeof(size_t), "")); +for(PxU32 i=0;iLOCAL_SIZE) + { + tempObjects = PX_ALLOCATE(PrunerPayload, nb, "BucketPruner"); + tempBoxes = PX_ALLOCATE(BucketBox, nb, "BucketPruner"); + tempTransforms = PX_ALLOCATE(PxTransform, nb, "BucketPruner"); + } + else + { + tempObjects = localTempObjects; + tempBoxes = localTempBoxes; + tempTransforms = localTempTransforms; + } + + mSortAxis = sortBoxes(nb, mCoreBoxes, mCoreObjects, mCoreTransforms, mGlobalBox, tempBoxes, tempObjects, tempTransforms); + + PX_ASSERT(mSortAxis); + + allocateSortedMemory(nb); + BucketBox* sortedBoxes = mSortedWorldBoxes; + PrunerPayload* sortedObjects = mSortedObjects; + PxTransform* sortedTransforms = mSortedTransforms; + + const PxU32 yz = PxU32(mSortAxis == 1 ? 2 : 1); + const float limitX = mGlobalBox.mCenter.x; + const float limitYZ = mGlobalBox.mCenter[yz]; + mLevel1.classifyBoxes(limitX, limitYZ, nb, tempBoxes, tempObjects, tempTransforms, sortedBoxes, sortedObjects, sortedTransforms, false, mSortAxis); + + processChildBuckets(nb, tempBoxes, tempObjects, tempTransforms, mLevel1, mLevel2, mSortedWorldBoxes, mSortedObjects, mSortedTransforms, mSortAxis); + + for(PxU32 j=0;j<5;j++) + processChildBuckets(nb, tempBoxes, tempObjects, tempTransforms, mLevel2[j], mLevel3[j], mSortedWorldBoxes + mLevel1.mOffsets[j], mSortedObjects + mLevel1.mOffsets[j], mSortedTransforms + mLevel1.mOffsets[j], mSortAxis); + + { + for(PxU32 i=0;iLOCAL_SIZE) + { + PX_FREE(tempTransforms); + PX_FREE(tempBoxes); + PX_FREE(tempObjects); + } + +for(PxU32 i=0;i(&MaskI)), DataV); + _mm_store_ps(&rayParams->mData.x, DataV); + _mm_store_ps(&rayParams->mData2.x, Data2V); + _mm_store_ps(&rayParams->mFDir.x, FDirV); + #else + const PxVec3 data = 0.5f * rayDir * maxDist; + rayParams->mData = data; + rayParams->mData2 = rayOrig + data; + rayParams->mFDir.x = PxAbs(data.x); + rayParams->mFDir.y = PxAbs(data.y); + rayParams->mFDir.z = PxAbs(data.z); + #endif + } + + template + static PX_FORCE_INLINE PxIntBool segmentAABB(const BucketBox& box, const RayParams* PX_RESTRICT params) + { + #ifdef USE_SIMD + const PxU32 maskI = 0x7fffffff; + const __m128 fdirV = _mm_load_ps(¶ms->mFDir.x); +// #ifdef _DEBUG + const __m128 extentsV = inflateT ? _mm_add_ps(_mm_loadu_ps(&box.mExtents.x), _mm_load_ps(¶ms->mInflate.x)) : _mm_loadu_ps(&box.mExtents.x); + const __m128 DV = _mm_sub_ps(_mm_load_ps(¶ms->mData2.x), _mm_loadu_ps(&box.mCenter.x)); +/* #else + const __m128 extentsV = inflateT ? _mm_add_ps(_mm_load_ps(&box.mExtents.x), _mm_load_ps(¶ms->mInflate.x)) : _mm_load_ps(&box.mExtents.x); + const __m128 DV = _mm_sub_ps(_mm_load_ps(¶ms->mData2.x), _mm_load_ps(&box.mCenter.x)); + #endif*/ + __m128 absDV = _mm_and_ps(DV, _mm_load1_ps(reinterpret_cast(&maskI))); + absDV = _mm_cmpgt_ps(absDV, _mm_add_ps(extentsV, fdirV)); + const PxU32 test = PxU32(_mm_movemask_ps(absDV)); + if(test&7) + return 0; + + const __m128 dataZYX_V = _mm_load_ps(¶ms->mData.x); + const __m128 dataXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(dataZYX_V), _MM_SHUFFLE(3,0,2,1))); + const __m128 DXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(DV), _MM_SHUFFLE(3,0,2,1))); + const __m128 fV = _mm_sub_ps(_mm_mul_ps(dataZYX_V, DXZY_V), _mm_mul_ps(dataXZY_V, DV)); + + const __m128 fdirZYX_V = _mm_load_ps(¶ms->mFDir.x); + const __m128 fdirXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(fdirZYX_V), _MM_SHUFFLE(3,0,2,1))); + const __m128 extentsXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(extentsV), _MM_SHUFFLE(3,0,2,1))); + const __m128 fg = _mm_add_ps(_mm_mul_ps(extentsV, fdirXZY_V), _mm_mul_ps(extentsXZY_V, fdirZYX_V)); + + __m128 absfV = _mm_and_ps(fV, _mm_load1_ps(reinterpret_cast(&maskI))); + absfV = _mm_cmpgt_ps(absfV, fg); + const PxU32 test2 = PxU32(_mm_movemask_ps(absfV)); + if(test2&7) + return 0; + return 1; + #else + const float boxExtentsx = inflateT ? box.mExtents.x + params->mInflate.x : box.mExtents.x; + const float Dx = params->mData2.x - box.mCenter.x; if(fabsf(Dx) > boxExtentsx + params->mFDir.x) return PxIntFalse; + + const float boxExtentsz = inflateT ? box.mExtents.z + params->mInflate.z : box.mExtents.z; + const float Dz = params->mData2.z - box.mCenter.z; if(fabsf(Dz) > boxExtentsz + params->mFDir.z) return PxIntFalse; + + const float boxExtentsy = inflateT ? box.mExtents.y + params->mInflate.y : box.mExtents.y; + const float Dy = params->mData2.y - box.mCenter.y; if(fabsf(Dy) > boxExtentsy + params->mFDir.y) return PxIntFalse; + + float f; + f = params->mData.y * Dz - params->mData.z * Dy; if(fabsf(f) > boxExtentsy*params->mFDir.z + boxExtentsz*params->mFDir.y) return PxIntFalse; + f = params->mData.z * Dx - params->mData.x * Dz; if(fabsf(f) > boxExtentsx*params->mFDir.z + boxExtentsz*params->mFDir.x) return PxIntFalse; + f = params->mData.x * Dy - params->mData.y * Dx; if(fabsf(f) > boxExtentsx*params->mFDir.y + boxExtentsy*params->mFDir.x) return PxIntFalse; + return PxIntTrue; + #endif + } +#else + #include "GuBVHTestsSIMD.h" + + typedef RayAABBTest BPRayAABBTest; + +template +static PX_FORCE_INLINE PxIntBool segmentAABB(const BucketBox& box, const BPRayAABBTest& test) +{ + return static_cast(test.check(V3LoadU(box.mCenter), V3LoadU(box.mExtents))); +} + +/*static PX_FORCE_INLINE IntBool segmentAABB(const BucketBox& box, const BPRayAABBTest& test, PxU32 rayMinLimitX, PxU32 rayMaxLimitX) +{ + if(rayMinLimitX>box.mData1) + return 0; + if(rayMaxLimitX +static bool processBucket( + PxU32 nb, const BucketBox* PX_RESTRICT baseBoxes, const PrunerPayload* PX_RESTRICT baseObjects, + const PxTransform* PX_RESTRICT baseTransforms, PxU32 offset, PxU32 totalAllocated, + const PxVec3& rayOrig, const PxVec3& rayDir, float& maxDist, +#ifdef CAN_USE_MOVEMASK + RayParams* PX_RESTRICT rayParams, +#else + BPRayAABBTest& test, const PxVec3& inflate, +#endif + PrunerRaycastCallback& pcbArgName, PxU32& _rayMinLimitInt, PxU32& _rayMaxLimitInt, PxU32 sortAxis) +{ + PX_UNUSED(totalAllocated); + + const BucketBox* PX_RESTRICT _boxes = baseBoxes + offset; + BucketPrunerRaycastAdapter pcb(pcbArgName, baseObjects + offset, baseTransforms + offset); + + PxU32 rayMinLimitInt = _rayMinLimitInt; + PxU32 rayMaxLimitInt = _rayMaxLimitInt; + + const BucketBox* last = _boxes + nb; + + PxU32 objectID = 0; + + while(_boxes!=last) + { + const BucketBox& currentBox = *_boxes++; + const PxU32 currentID = objectID++; + + if(currentBox.mData1rayMaxLimitInt) + goto Exit; + +#ifdef CAN_USE_MOVEMASK + if(!segmentAABB(currentBox, rayParams)) + continue; +#else + if(!segmentAABB(currentBox, test)) + continue; +#endif + + const float MaxDist = maxDist; + const bool again = pcb.invoke(maxDist, currentID); + if(!again) + return false; + if(maxDist < MaxDist) + { + float rayMinLimit, rayMaxLimit; +#ifdef CAN_USE_MOVEMASK + if(inflateT) + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, rayParams->mInflate, sortAxis); + else + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, sortAxis); + + precomputeRayData(rayParams, rayOrig, rayDir, maxDist); +#else + if(inflateT) + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, inflate, sortAxis); + else + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, sortAxis); + + test.setDistance(maxDist); +#endif + const PxU32* binaryMinLimit = reinterpret_cast(&rayMinLimit); + const PxU32* binaryMaxLimit = reinterpret_cast(&rayMaxLimit); + rayMinLimitInt = encodeFloat(binaryMinLimit[0]); + rayMaxLimitInt = encodeFloat(binaryMaxLimit[0]); + } + } +Exit: + + _rayMinLimitInt = rayMinLimitInt; + _rayMaxLimitInt = rayMaxLimitInt; + return true; +} + +#ifdef NODE_SORT +static PxU32 computeDirMask(const PxVec3& dir) +{ + const PxU32* binary = reinterpret_cast(&dir.x); + const PxU32 X = (binary[0])>>31; + const PxU32 Y = (binary[1])>>31; + const PxU32 Z = (binary[2])>>31; + return Z|(Y<<1)|(X<<2); +} +#endif + +template +static bool stab(const BucketPrunerCore& core, PrunerRaycastCallback& pcbArgName, const PxVec3& rayOrig, const PxVec3& rayDir, float& maxDist, const PxVec3 inflate) +{ + const PxU32 nb = core.mSortedNb; + if(!nb +#ifdef FREE_PRUNER_SIZE + && !core.mNbFree +#endif + ) + return true; + + if(maxDist==PX_MAX_F32) + { + /*const*/ PxVec3 boxMin = core.mGlobalBox.getMin() - inflate; + /*const*/ PxVec3 boxMax = core.mGlobalBox.getMax() + inflate; + +#ifdef FREE_PRUNER_SIZE + if(core.mNbFree) + { + // TODO: optimize this + PxBounds3 freeGlobalBounds; + freeGlobalBounds.setEmpty(); + for(PxU32 i=0;i(tmp, &rayParams)) +#else + if(segmentAABB(tmp, test)) +#endif + { + if(!pcb.invoke(maxDist, i)) + return false; + } + } +#endif + + if(!nb) + return true; + +#ifdef CAN_USE_MOVEMASK + if(!segmentAABB(core.mGlobalBox, &rayParams)) + return true; +#else + if(!segmentAABB(core.mGlobalBox, test)) + return true; +#endif + + const PxU32 sortAxis = core.mSortAxis; + float rayMinLimit, rayMaxLimit; + if(inflateT) + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, inflate, sortAxis); + else + computeRayLimits(rayMinLimit, rayMaxLimit, rayOrig, rayDir, maxDist, sortAxis); + + const PxU32* binaryMinLimit = reinterpret_cast(&rayMinLimit); + const PxU32* binaryMaxLimit = reinterpret_cast(&rayMaxLimit); + PxU32 rayMinLimitInt = encodeFloat(binaryMinLimit[0]); + PxU32 rayMaxLimitInt = encodeFloat(binaryMaxLimit[0]); +/* +float rayMinLimitX, rayMaxLimitX; +if(inflateT) + computeRayLimits(rayMinLimitX, rayMaxLimitX, rayOrig, rayDir, maxDist, inflate, 0); +else + computeRayLimits(rayMinLimitX, rayMaxLimitX, rayOrig, rayDir, maxDist, 0); + +PxU32 rayMinLimitIntX = encodeFloat(PX_IR(rayMinLimitX)); +PxU32 rayMaxLimitIntX = encodeFloat(PX_IR(rayMaxLimitX)); +*/ + + float currentDist = maxDist; + +#ifdef NODE_SORT + const PxU32 dirIndex = computeDirMask(rayDir); + PxU32 orderi = core.mLevel1.mOrder[dirIndex]; +// PxU32 orderi = sort(core.mLevel1, rayDir); + + for(PxU32 i_=0;i_<5;i_++) + { + const PxU32 i = orderi&7; orderi>>=3; +#else + for(PxU32 i=0;i<5;i++) + { +#endif + +#ifdef CAN_USE_MOVEMASK + if(core.mLevel1.mCounters[i] && segmentAABB(core.mLevel1.mBucketBox[i], &rayParams)) +#else + if(core.mLevel1.mCounters[i] && segmentAABB(core.mLevel1.mBucketBox[i], test)) +// if(core.mLevel1.mCounters[i] && segmentAABB(core.mLevel1.mBucketBox[i], test, rayMinLimitIntX, rayMaxLimitIntX)) +#endif + { + +#ifdef NODE_SORT + PxU32 orderj = core.mLevel2[i].mOrder[dirIndex]; +// PxU32 orderj = sort(core.mLevel2[i], rayDir); + + for(PxU32 j_=0;j_<5;j_++) + { + const PxU32 j = orderj&7; orderj>>=3; +#else + for(PxU32 j=0;j<5;j++) + { +#endif + +#ifdef CAN_USE_MOVEMASK + if(core.mLevel2[i].mCounters[j] && segmentAABB(core.mLevel2[i].mBucketBox[j], &rayParams)) +#else + if(core.mLevel2[i].mCounters[j] && segmentAABB(core.mLevel2[i].mBucketBox[j], test)) +// if(core.mLevel2[i].mCounters[j] && segmentAABB(core.mLevel2[i].mBucketBox[j], test, rayMinLimitIntX, rayMaxLimitIntX)) +#endif + { + const BucketPrunerNode& parent = core.mLevel3[i][j]; + const PxU32 parentOffset = core.mLevel1.mOffsets[i] + core.mLevel2[i].mOffsets[j]; + +#ifdef NODE_SORT + PxU32 orderk = parent.mOrder[dirIndex]; +// PxU32 orderk = sort(parent, rayDir); + + for(PxU32 k_=0;k_<5;k_++) + { + const PxU32 k = orderk&7; orderk>>=3; +#else + for(PxU32 k=0;k<5;k++) + { +#endif + const PxU32 nbInBucket = parent.mCounters[k]; +#ifdef CAN_USE_MOVEMASK + if(nbInBucket && segmentAABB(parent.mBucketBox[k], &rayParams)) +#else + if(nbInBucket && segmentAABB(parent.mBucketBox[k], test)) +// if(nbInBucket && segmentAABB(parent.mBucketBox[k], test, rayMinLimitIntX, rayMaxLimitIntX)) +#endif + { + const PxU32 offset = parentOffset + parent.mOffsets[k]; + const bool again = processBucket( nbInBucket, core.mSortedWorldBoxes, core.mSortedObjects, + core.mSortedTransforms, + offset, core.mSortedNb, + rayOrig, rayDir, currentDist, +#ifdef CAN_USE_MOVEMASK + &rayParams, +#else + test, inflate, +#endif + pcbArgName, + rayMinLimitInt, rayMaxLimitInt, + sortAxis); + if(!again) + return false; + } + } + } + } + } + } + + maxDist = currentDist; + return true; +} + +bool BucketPrunerCore::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcb) const +{ + return ::stab<0>(*this, pcb, origin, unitDir, inOutDistance, PxVec3(0.0f)); +} + +bool BucketPrunerCore::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcb) const +{ + const PxVec3 extents = queryVolume.getPrunerInflatedWorldAABB().getExtents(); + return ::stab<1>(*this, pcb, queryVolume.getPrunerInflatedWorldAABB().getCenter(), unitDir, inOutDistance, extents); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// PT: TODO: decoupling the pruner callback revealed quite a bug here: we call this processBucket function with an inflateT param, +// which is re-interpreted as "doAssert" for overlaps! What happened here? +template +static PX_FORCE_INLINE bool processBucket( PxU32 nb, const BucketBox* PX_RESTRICT baseBoxes, const PrunerPayload* PX_RESTRICT baseObjects, + const PxTransform* PX_RESTRICT baseTransforms, + PxU32 offset, PxU32 totalAllocated, + const Test& test, PrunerOverlapCallback& pcbArgName, + PxU32 minLimitInt, PxU32 maxLimitInt) +{ + PX_UNUSED(totalAllocated); + + const BucketBox* PX_RESTRICT boxes = baseBoxes + offset; + + BucketPrunerOverlapAdapter pcb(pcbArgName, baseObjects + offset, baseTransforms + offset); + + for(PxU32 i=0;imaxLimitInt) + { + if(doAssert) + PX_ASSERT(!test(currentBox)); + return true; + } + + if(test(currentBox)) + { + if(!pcb.invoke(i)) + return false; + } + } + return true; +} + +template +class BucketPrunerOverlapTraversal +{ +public: + PX_FORCE_INLINE BucketPrunerOverlapTraversal() {} + + /*PX_FORCE_INLINE*/ bool operator()(const BucketPrunerCore& core, const Test& test, PrunerOverlapCallback& pcbArgName, const PxBounds3& cullBox) const + { +#ifdef FREE_PRUNER_SIZE + BucketPrunerOverlapAdapter pcb(pcbArgName, core.mFreeObjects, core.mFreeTransforms); + + for(PxU32 i=0;i(&boxMinLimit); + const PxU32* binaryMaxLimit = reinterpret_cast(&boxMaxLimit); + const PxU32 rayMinLimitInt = encodeFloat(binaryMinLimit[0]); + const PxU32 rayMaxLimitInt = encodeFloat(binaryMaxLimit[0]); + + for(PxU32 i=0;i<5;i++) + { + if(core.mLevel1.mCounters[i] && test(core.mLevel1.mBucketBox[i])) + { + for(PxU32 j=0;j<5;j++) + { + if(core.mLevel2[i].mCounters[j] && test(core.mLevel2[i].mBucketBox[j])) + { + for(PxU32 k=0;k<5;k++) + { + const PxU32 nbInBucket = core.mLevel3[i][j].mCounters[k]; + if(nbInBucket && test(core.mLevel3[i][j].mBucketBox[k])) + { + const PxU32 offset = core.mLevel1.mOffsets[i] + core.mLevel2[i].mOffsets[j] + core.mLevel3[i][j].mOffsets[k]; + if(!processBucket(nbInBucket, core.mSortedWorldBoxes, core.mSortedObjects, + core.mSortedTransforms, + offset, core.mSortedNb, test, pcbArgName, rayMinLimitInt, rayMaxLimitInt)) + return false; + } + } + } + } + } + } + return true; + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef CAN_USE_MOVEMASK +PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) +{ + const PxI32 moveMask = _mm_movemask_ps(a); + return PxU32((moveMask & 0x7) == (0x7)); +} +#endif + +#ifdef USE_SIMD +struct SphereAABBTest_SIMD +{ + PX_FORCE_INLINE SphereAABBTest_SIMD(const Sphere& sphere) : + #ifdef CAN_USE_MOVEMASK + mCenter (V4LoadU(&sphere.center.x)), + #else + mCenter (V3LoadU(sphere.center)), + #endif + mRadius2(FLoad(sphere.radius * sphere.radius)) + {} + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + #ifdef CAN_USE_MOVEMASK + const Vec4V boxCenter = AlignedLoad(&box.mCenter.x); + const Vec4V boxExtents = AlignedLoad(&box.mExtents.x); + // + const Vec4V offset = V4Sub(mCenter, boxCenter); + const Vec4V closest = V4Clamp(offset, V4Neg(boxExtents), boxExtents); + const Vec4V d = V4Sub(offset, closest); + + const FloatV dot = V4Dot3(d,d); + return PxIntBool(BAllTrue3_R(FIsGrtrOrEq(mRadius2, dot))); + #else + const Vec3V boxCenter = V3LoadU(box.mCenter); + const Vec3V boxExtents = V3LoadU(box.mExtents); + // + const Vec3V offset = V3Sub(mCenter, boxCenter); + const Vec3V closest = V3Clamp(offset, V3Neg(boxExtents), boxExtents); + const Vec3V d = V3Sub(offset, closest); + return PxIntBool(BAllEqTTTT(FIsGrtrOrEq(mRadius2, V3Dot(d, d)))); + #endif + } + + PX_FORCE_INLINE PxIntBool operator()(const PxBounds3& bounds) const + { + BucketBox tmp; + tmp.mCenter = bounds.getCenter(); + tmp.mExtents = bounds.getExtents(); + return (*this)(tmp); + } + +private: + SphereAABBTest_SIMD& operator=(const SphereAABBTest_SIMD&); + #ifdef CAN_USE_MOVEMASK + const Vec4V mCenter; + #else + const Vec3V mCenter; + #endif + const FloatV mRadius2; +}; +#else +struct SphereAABBTest_Scalar +{ + PX_FORCE_INLINE SphereAABBTest_Scalar(const Sphere& sphere) : + mCenter (sphere.center), + mRadius2(sphere.radius * sphere.radius) + {} + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + const PxVec3 minimum = box.getMin(); + const PxVec3 maximum = box.getMax(); + + float d = 0.0f; + + //find the square of the distance + //from the sphere to the box + for(PxU32 i=0;i<3;i++) + { + if(mCenter[i]maximum[i]) + { + const float s = mCenter[i] - maximum[i]; + d += s*s; + } + } + return d <= mRadius2; + } + +private: + SphereAABBTest_Scalar& operator=(const SphereAABBTest_Scalar&); + const PxVec3 mCenter; + float mRadius2; +}; +#endif + +#ifdef USE_SIMD +typedef SphereAABBTest_SIMD BucketPrunerSphereAABBTest; +#else +typedef SphereAABBTest_Scalar BucketPrunerSphereAABBTest; +#endif + +/////////////////////////////////////////////////////////////////////////////// + +struct BucketPrunerAABBAABBTest +{ + PX_FORCE_INLINE BucketPrunerAABBAABBTest(const PxBounds3& queryBox) : mBox(queryBox) {} + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + // PT: we don't use PxBounds3::intersects() because isValid() asserts on our empty boxes! + const PxVec3 bucketMin = box.getMin(); + const PxVec3 bucketMax = box.getMax(); + return !(mBox.minimum.x > bucketMax.x || bucketMin.x > mBox.maximum.x || + mBox.minimum.y > bucketMax.y || bucketMin.y > mBox.maximum.y || + mBox.minimum.z > bucketMax.z || bucketMin.z > mBox.maximum.z); + } + + PX_FORCE_INLINE PxIntBool operator()(const PxBounds3& bounds) const + { + // PT: we don't use PxBounds3::intersects() because isValid() asserts on our empty boxes! + const PxVec3& bucketMin = bounds.minimum; + const PxVec3& bucketMax = bounds.maximum; + return !(mBox.minimum.x > bucketMax.x || bucketMin.x > mBox.maximum.x || + mBox.minimum.y > bucketMax.y || bucketMin.y > mBox.maximum.y || + mBox.minimum.z > bucketMax.z || bucketMin.z > mBox.maximum.z); + } +private: + BucketPrunerAABBAABBTest& operator=(const BucketPrunerAABBAABBTest&); + const PxBounds3 mBox; +}; + +/*struct BucketPrunerAABBAABBTest_SIMD +{ + PX_FORCE_INLINE BucketPrunerAABBAABBTest_SIMD(const PxBounds3& b) + : mCenter(V3LoadU(b.getCenter())) + , mExtents(V3LoadU(b.getExtents())) + {} + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + return V3AllGrtrOrEq(V3Add(mExtents, AlignedLoad(&box.mExtents.x)), V3Abs(V3Sub(AlignedLoad(&box.mCenter.x), mCenter))); + } +private: + BucketPrunerAABBAABBTest_SIMD& operator=(const BucketPrunerAABBAABBTest_SIMD&); + const Vec3V mCenter, mExtents; +};*/ + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef USE_SIMD +struct OBBAABBTest_SIMD +{ + OBBAABBTest_SIMD(const PxMat33& rotation, const PxVec3& translation, const PxVec3& extents) + { + const Vec3V eps = V3Load(1e-6f); + + mT = V3LoadU(translation); + mExtents = V3LoadU(extents); + + // storing the transpose matrices yields a simpler SIMD test + mRT = Mat33V_From_PxMat33(rotation.getTranspose()); + mART = Mat33V(V3Add(V3Abs(mRT.col0), eps), V3Add(V3Abs(mRT.col1), eps), V3Add(V3Abs(mRT.col2), eps)); + mBB_xyz = M33TrnspsMulV3(mART, mExtents); + +/* if(fullTest) + { + const Vec3V eYZX = V3PermYZX(mExtents), eZXY = V3PermZXY(mExtents); + + mBB_123 = V3MulAdd(eYZX, V3PermZXY(mART.col0), V3Mul(eZXY, V3PermYZX(mART.col0))); + mBB_456 = V3MulAdd(eYZX, V3PermZXY(mART.col1), V3Mul(eZXY, V3PermYZX(mART.col1))); + mBB_789 = V3MulAdd(eYZX, V3PermZXY(mART.col2), V3Mul(eZXY, V3PermYZX(mART.col2))); + }*/ + } + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + const Vec3V extentsV = V3LoadU(box.mExtents); + + const Vec3V t = V3Sub(mT, V3LoadU(box.mCenter)); + + // class I - axes of AABB + if(V3OutOfBounds(t, V3Add(extentsV, mBB_xyz))) + return PxIntFalse; + + const Vec3V rX = mRT.col0, rY = mRT.col1, rZ = mRT.col2; + const Vec3V arX = mART.col0, arY = mART.col1, arZ = mART.col2; + + const FloatV eX = V3GetX(extentsV), eY = V3GetY(extentsV), eZ = V3GetZ(extentsV); + const FloatV tX = V3GetX(t), tY = V3GetY(t), tZ = V3GetZ(t); + + // class II - axes of OBB + { + const Vec3V v = V3ScaleAdd(rZ, tZ, V3ScaleAdd(rY, tY, V3Scale(rX, tX))); + const Vec3V v2 = V3ScaleAdd(arZ, eZ, V3ScaleAdd(arY, eY, V3ScaleAdd(arX, eX, mExtents))); + if(V3OutOfBounds(v, v2)) + return PxIntFalse; + } + +// if(!fullTest) + return PxIntTrue; + +/* // class III - edge cross products. Almost all OBB tests early-out with type I or type II, + // so early-outs here probably aren't useful (TODO: profile) + + const Vec3V va = V3NegScaleSub(rZ, tY, V3Scale(rY, tZ)); + const Vec3V va2 = V3ScaleAdd(arY, eZ, V3ScaleAdd(arZ, eY, mBB_123)); + const BoolV ba = BOr(V3IsGrtr(va, va2), V3IsGrtr(V3Neg(va2), va)); + + const Vec3V vb = V3NegScaleSub(rX, tZ, V3Scale(rZ, tX)); + const Vec3V vb2 = V3ScaleAdd(arX, eZ, V3ScaleAdd(arZ, eX, mBB_456)); + const BoolV bb = BOr(V3IsGrtr(vb, vb2), V3IsGrtr(V3Neg(vb2), vb)); + + const Vec3V vc = V3NegScaleSub(rY, tX, V3Scale(rX, tY)); + const Vec3V vc2 = V3ScaleAdd(arX, eY, V3ScaleAdd(arY, eX, mBB_789)); + const BoolV bc = BOr(V3IsGrtr(vc, vc2), V3IsGrtr(V3Neg(vc2), vc)); + + return BAllEq(BOr(ba, BOr(bb,bc)), BFFFF());*/ + } + + PX_FORCE_INLINE PxIntBool operator()(const PxBounds3& bounds) const + { + BucketBox tmp; + tmp.mCenter = bounds.getCenter(); + tmp.mExtents = bounds.getExtents(); + return (*this)(tmp); + } + + Vec3V mExtents; // extents of OBB + Vec3V mT; // translation of OBB + Mat33V mRT; // transpose of rotation matrix of OBB + Mat33V mART; // transpose of mRT, padded by epsilon + Vec3V mBB_xyz; // extents of OBB along coordinate axes + +/* Vec3V mBB_123; // projections of extents onto edge-cross axes + Vec3V mBB_456; + Vec3V mBB_789;*/ +}; +#else +struct OBBAABBTest_Scalar +{ + OBBAABBTest_Scalar(const PxMat33& rotation, const PxVec3& translation, const PxVec3& extents) + { + mR = rotation; + mT = translation; + mExtents = extents; + + const PxVec3 eps(1e-6f); + mAR = PxMat33(mR[0].abs() + eps, mR[1].abs() + eps, mR[2].abs() + eps); // Epsilon prevents floating-point inaccuracies (strategy borrowed from RAPID) + mBB_xyz = mAR.transform(mExtents); // Precompute box-box data - Courtesy of Erwin de Vries + +/* PxReal ex = mExtents.x, ey = mExtents.y, ez = mExtents.z; + mBB_1 = ey*mAR[2].x + ez*mAR[1].x; mBB_2 = ez*mAR[0].x + ex*mAR[2].x; mBB_3 = ex*mAR[1].x + ey*mAR[0].x; + mBB_4 = ey*mAR[2].y + ez*mAR[1].y; mBB_5 = ez*mAR[0].y + ex*mAR[2].y; mBB_6 = ex*mAR[1].y + ey*mAR[0].y; + mBB_7 = ey*mAR[2].z + ez*mAR[1].z; mBB_8 = ez*mAR[0].z + ex*mAR[2].z; mBB_9 = ex*mAR[1].z + ey*mAR[0].z;*/ + } + + PX_FORCE_INLINE PxIntBool operator()(const BucketBox& box) const + { + const PxVec3& c = box.mCenter; + const PxVec3& e = box.mExtents; + + const PxVec3 T = mT - c; + // Class I : A's basis vectors + if(PxAbs(T.x) > e.x + mBB_xyz.x) return PxIntFalse; + if(PxAbs(T.y) > e.y + mBB_xyz.y) return PxIntFalse; + if(PxAbs(T.z) > e.z + mBB_xyz.z) return PxIntFalse; + + // Class II : B's basis vectors + if(PxAbs(T.dot(mR[0])) > e.dot(mAR[0]) + mExtents.x) return PxIntFalse; + if(PxAbs(T.dot(mR[1])) > e.dot(mAR[1]) + mExtents.y) return PxIntFalse; + if(PxAbs(T.dot(mR[2])) > e.dot(mAR[2]) + mExtents.z) return PxIntFalse; + + // Class III : 9 cross products + if(0) + { + if(PxAbs(T.z*mR[0].y - T.y*mR[0].z) > e.y*mAR[0].z + e.z*mAR[0].y + mBB_1) return PxIntFalse; // L = A0 x B0 + if(PxAbs(T.z*mR[1].y - T.y*mR[1].z) > e.y*mAR[1].z + e.z*mAR[1].y + mBB_2) return PxIntFalse; // L = A0 x B1 + if(PxAbs(T.z*mR[2].y - T.y*mR[2].z) > e.y*mAR[2].z + e.z*mAR[2].y + mBB_3) return PxIntFalse; // L = A0 x B2 + + if(PxAbs(T.x*mR[0].z - T.z*mR[0].x) > e.x*mAR[0].z + e.z*mAR[0].x + mBB_4) return PxIntFalse; // L = A1 x B0 + if(PxAbs(T.x*mR[1].z - T.z*mR[1].x) > e.x*mAR[1].z + e.z*mAR[1].x + mBB_5) return PxIntFalse; // L = A1 x B1 + if(PxAbs(T.x*mR[2].z - T.z*mR[2].x) > e.x*mAR[2].z + e.z*mAR[2].x + mBB_6) return PxIntFalse; // L = A1 x B2 + + if(PxAbs(T.y*mR[0].x - T.x*mR[0].y) > e.x*mAR[0].y + e.y*mAR[0].x + mBB_7) return PxIntFalse; // L = A2 x B0 + if(PxAbs(T.y*mR[1].x - T.x*mR[1].y) > e.x*mAR[1].y + e.y*mAR[1].x + mBB_8) return PxIntFalse; // L = A2 x B1 + if(PxAbs(T.y*mR[2].x - T.x*mR[2].y) > e.x*mAR[2].y + e.y*mAR[2].x + mBB_9) return PxIntFalse; // L = A2 x B2 + } + return PxIntTrue; + } + +private: + PxMat33 mR; // rotation matrix + PxMat33 mAR; // absolute rotation matrix + PxVec3 mT; // translation from obb space to model space + PxVec3 mExtents; + + PxVec3 mBB_xyz; + + float mBB_1, mBB_2, mBB_3; + float mBB_4, mBB_5, mBB_6; + float mBB_7, mBB_8, mBB_9; +}; +#endif + +#ifdef USE_SIMD +typedef OBBAABBTest_SIMD BucketPrunerOBBAABBTest; +#else +typedef OBBAABBTest_Scalar BucketPrunerOBBAABBTest; +#endif + +/////////////////////////////////////////////////////////////////////////////// + +bool BucketPrunerCore::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& pcb) const +{ + PX_ASSERT(!mDirty); + bool again = true; + + const PxBounds3& cullBox = queryVolume.getPrunerInflatedWorldAABB(); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const BucketPrunerOverlapTraversal overlap; + again = overlap(*this, + BucketPrunerOBBAABBTest( + queryVolume.getPrunerWorldRot33(), queryVolume.getPrunerWorldPos(), + queryVolume.getPrunerBoxGeomExtentsInflated()), + pcb, cullBox); + } + else + { + const BucketPrunerOverlapTraversal overlap; + again = overlap(*this, BucketPrunerAABBAABBTest(cullBox), pcb, cullBox); + } + } + break; + + case PxGeometryType::eCAPSULE: + { + const BucketPrunerOverlapTraversal overlap; + again = overlap(*this, + BucketPrunerOBBAABBTest( + queryVolume.getPrunerWorldRot33(), queryVolume.getPrunerWorldPos(), + queryVolume.getPrunerBoxGeomExtentsInflated()), + pcb, cullBox); + } + break; + + case PxGeometryType::eSPHERE: + { + const Sphere& sphere = queryVolume.getGuSphere(); + const PxVec3 sphereExtents(sphere.radius); + const BucketPrunerOverlapTraversal overlap; + again = overlap(*this, BucketPrunerSphereAABBTest(sphere), pcb, cullBox); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const BucketPrunerOverlapTraversal overlap; + again = overlap(*this, + BucketPrunerOBBAABBTest( + queryVolume.getPrunerWorldRot33(), queryVolume.getPrunerWorldPos(), + queryVolume.getPrunerBoxGeomExtentsInflated()), + pcb, cullBox); + } + break; + + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + return again; +} + +/////////////////////////////////////////////////////////////////////////////// + +void BucketPrunerCore::getGlobalBounds(PxBounds3& bounds) const +{ + // PT: TODO: refactor with similar code above in the file + const Vec4V centerV = V4LoadU(&mGlobalBox.mCenter.x); + const Vec4V extentsV = V4LoadU(&mGlobalBox.mExtents.x); + + Vec4V minV = V4Sub(centerV, extentsV); + Vec4V maxV = V4Add(centerV, extentsV); + +#ifdef FREE_PRUNER_SIZE + PxU32 nbFree = mNbFree; + if(nbFree) + { + const PxBounds3* freeBounds = mFreeBounds; + while(nbFree--) + { + minV = V4Min(minV, V4LoadU(&freeBounds->minimum.x)); + maxV = V4Max(maxV, V4LoadU(&freeBounds->maximum.x)); + freeBounds++; + } + } +#endif + + StoreBounds(bounds, minV, maxV); +} + +/////////////////////////////////////////////////////////////////////////////// + +void BucketPrunerCore::shiftOrigin(const PxVec3& shift) +{ +#ifdef FREE_PRUNER_SIZE + for(PxU32 i=0;i the pair is persistent + return &activePairs[offset]; +} + +// Internal version saving hash computation +PX_FORCE_INLINE BucketPrunerPair* BucketPrunerMap::findPair(const PrunerPayload& payload, PxU32 hashValue) const +{ + if(!mHashTable) + return NULL; // Nothing has been allocated yet + + BucketPrunerPair* PX_RESTRICT activePairs = mActivePairs; + const PxU32* PX_RESTRICT next = mNext; + + // Look for it in the table + PxU32 offset = mHashTable[hashValue]; + while(offset!=INVALID_ID && differentPair(activePairs[offset], payload)) + { + offset = next[offset]; // Better to have a separate array for this + } + if(offset==INVALID_ID) + return NULL; + PX_ASSERT(offset the pair is persistent + return &activePairs[offset]; +} + +/////////////////////////////////////////////////////////////////////////////// + +BucketPrunerPair* BucketPrunerMap::addPair(const PrunerPayload& payload, PxU32 coreIndex, PxU32 timeStamp) +{ + PxU32 hashValue = PxComputeHash(payload) & mMask; + + { + BucketPrunerPair* PX_RESTRICT p = findPair(payload, hashValue); + if(p) + { + PX_ASSERT(p->mCoreIndex==coreIndex); + PX_ASSERT(p->mTimeStamp==timeStamp); + return p; // Persistent pair + } + } + + // This is a new pair + if(mNbActivePairs >= mHashSize) + { + // Get more entries + mHashSize = PxNextPowerOfTwo(mNbActivePairs+1); + mMask = mHashSize-1; + + reallocPairs(); + + // Recompute hash value with new hash size + hashValue = PxComputeHash(payload) & mMask; // ### redundant hash computation here? + } + + BucketPrunerPair* PX_RESTRICT p = &mActivePairs[mNbActivePairs]; + p->mData = payload; + p->mCoreIndex = coreIndex; + p->mTimeStamp = timeStamp; + mNext[mNbActivePairs] = mHashTable[hashValue]; + mHashTable[hashValue] = mNbActivePairs++; + return p; +} + +/////////////////////////////////////////////////////////////////////////////// + +void BucketPrunerMap::removePairInternal(const PrunerPayload& /*payload*/, PxU32 hashValue, PxU32 pairIndex) +{ + // Walk the hash table to fix mNext + { + PxU32 offset = mHashTable[hashValue]; + PX_ASSERT(offset!=INVALID_ID); + + PxU32 previous=INVALID_ID; + while(offset!=pairIndex) + { + previous = offset; + offset = mNext[offset]; + } + + // Let us go/jump us + if(previous!=INVALID_ID) + { + PX_ASSERT(mNext[previous]==pairIndex); + mNext[previous] = mNext[pairIndex]; + } + // else we were the first + else mHashTable[hashValue] = mNext[pairIndex]; + // we're now free to reuse mNext[pairIndex] without breaking the list + } +#if PX_DEBUG + mNext[pairIndex]=INVALID_ID; +#endif + // Invalidate entry + + // Fill holes + if(1) + { + // 1) Remove last pair + const PxU32 lastPairIndex = mNbActivePairs-1; + if(lastPairIndex==pairIndex) + { + mNbActivePairs--; + } + else + { + const BucketPrunerPair* last = &mActivePairs[lastPairIndex]; + const PxU32 lastHashValue = PxComputeHash(last->mData) & mMask; + + // Walk the hash table to fix mNext + PxU32 offset = mHashTable[lastHashValue]; + PX_ASSERT(offset!=INVALID_ID); + + PxU32 previous=INVALID_ID; + while(offset!=lastPairIndex) + { + previous = offset; + offset = mNext[offset]; + } + + // Let us go/jump us + if(previous!=INVALID_ID) + { + PX_ASSERT(mNext[previous]==lastPairIndex); + mNext[previous] = mNext[lastPairIndex]; + } + // else we were the first + else mHashTable[lastHashValue] = mNext[lastPairIndex]; + // we're now free to reuse mNext[lastPairIndex] without breaking the list + +#if PX_DEBUG + mNext[lastPairIndex]=INVALID_ID; +#endif + + // Don't invalidate entry since we're going to shrink the array + + // 2) Re-insert in free slot + mActivePairs[pairIndex] = mActivePairs[lastPairIndex]; +#if PX_DEBUG + PX_ASSERT(mNext[pairIndex]==INVALID_ID); +#endif + mNext[pairIndex] = mHashTable[lastHashValue]; + mHashTable[lastHashValue] = pairIndex; + + mNbActivePairs--; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool BucketPrunerMap::removePair(const PrunerPayload& payload, PxU32& coreIndex, PxU32& timeStamp) +{ + const PxU32 hashValue = PxComputeHash(payload) & mMask; + const BucketPrunerPair* p = findPair(payload, hashValue); + if(!p) + return false; + PX_ASSERT(p->mData==payload); + + coreIndex = p->mCoreIndex; + timeStamp = p->mTimeStamp; + + removePairInternal(payload, hashValue, getPairIndex(p)); + + shrinkMemory(); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void BucketPrunerMap::shrinkMemory() +{ + // Check correct memory against actually used memory + const PxU32 correctHashSize = PxNextPowerOfTwo(mNbActivePairs); + if(mHashSize==correctHashSize) + return; + + if(mReservedMemory && correctHashSize < mReservedMemory) + return; + + // Reduce memory used + mHashSize = correctHashSize; + mMask = mHashSize-1; + + reallocPairs(); +} + +/////////////////////////////////////////////////////////////////////////////// + + static PX_FORCE_INLINE void storeDwords(PxU32* dest, PxU32 nb, PxU32 value) + { + while(nb--) + *dest++ = value; + } + +void BucketPrunerMap::reallocPairs() +{ + MBP_FREE(mHashTable); + mHashTable = reinterpret_cast(MBP_ALLOC(mHashSize*sizeof(PxU32))); + storeDwords(mHashTable, mHashSize, INVALID_ID); + + // Get some bytes for new entries + BucketPrunerPair* newPairs = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(BucketPrunerPair))); + PX_ASSERT(newPairs); + + PxU32* newNext = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(PxU32))); + PX_ASSERT(newNext); + + // Copy old data if needed + if(mNbActivePairs) + PxMemCopy(newPairs, mActivePairs, mNbActivePairs*sizeof(BucketPrunerPair)); + // ### check it's actually needed... probably only for pairs whose hash value was cut by the and + // yeah, since hash(id0, id1) is a constant + // However it might not be needed to recompute them => only less efficient but still ok + for(PxU32 i=0;i 3 bits/index => 3*5=15 bits total, for each of the 8 canonical directions + }PX_ALIGN_SUFFIX(16); + + PX_FORCE_INLINE PxU32 PxComputeHash(const PrunerPayload& payload) + { +#if PX_P64_FAMILY +// const PxU32 h0 = PxHash((const void*)payload.data[0]); +// const PxU32 h1 = PxHash((const void*)payload.data[1]); + const PxU32 h0 = PxU32(PX_MAX_U32 & payload.data[0]); + const PxU32 h1 = PxU32(PX_MAX_U32 & payload.data[1]); + return physx::PxComputeHash(PxU64(h0)|(PxU64(h1)<<32)); +#else + return physx::PxComputeHash(PxU64(payload.data[0])|(PxU64(payload.data[1])<<32)); +#endif + } + +#ifdef USE_REGULAR_HASH_MAP + struct BucketPrunerPair : public PxUserAllocated + { + PX_FORCE_INLINE BucketPrunerPair() {} + PX_FORCE_INLINE BucketPrunerPair(PxU32 index, PxU32 stamp) : mCoreIndex(index), mTimeStamp(stamp) {} + PxU32 mCoreIndex; // index in mCoreObjects + PxU32 mTimeStamp; + }; + typedef PxHashMap BucketPrunerMap; +#else + struct BucketPrunerPair : public PxUserAllocated + { + PrunerPayload mData; + PxU32 mCoreIndex; // index in mCoreObjects + PxU32 mTimeStamp; + }; + + // Custom hash-map - currently faster than the regular hash-map (PxHashMap), in particular for 'find-and-erase' operations. + class BucketPrunerMap : public PxUserAllocated + { + public: + BucketPrunerMap(); + ~BucketPrunerMap(); + + void purge(); + void shrinkMemory(); + + BucketPrunerPair* addPair (const PrunerPayload& payload, PxU32 coreIndex, PxU32 timeStamp); + bool removePair (const PrunerPayload& payload, PxU32& coreIndex, PxU32& timeStamp); + const BucketPrunerPair* findPair (const PrunerPayload& payload) const; + PX_FORCE_INLINE PxU32 getPairIndex(const BucketPrunerPair* pair) const + { + return (PxU32((size_t(pair) - size_t(mActivePairs)))/sizeof(BucketPrunerPair)); + } + + PxU32 mHashSize; + PxU32 mMask; + PxU32 mNbActivePairs; + PxU32* mHashTable; + PxU32* mNext; + BucketPrunerPair* mActivePairs; + PxU32 mReservedMemory; + + PX_FORCE_INLINE BucketPrunerPair* findPair(const PrunerPayload& payload, PxU32 hashValue) const; + void removePairInternal(const PrunerPayload& payload, PxU32 hashValue, PxU32 pairIndex); + void reallocPairs(); + void reserveMemory(PxU32 memSize); + }; +#endif + + class BucketPrunerCore : public PxUserAllocated + { + public: + PX_PHYSX_COMMON_API BucketPrunerCore(bool externalMemory=true); + PX_PHYSX_COMMON_API ~BucketPrunerCore(); + + void release(); + + void setExternalMemory(PxU32 nbObjects, PxBounds3* boxes, PrunerPayload* objects, PxTransform* transforms); + + PX_PHYSX_COMMON_API bool addObject(const PrunerPayload& object, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp=0); + bool removeObject(const PrunerPayload& object, PxU32& timeStamp); + bool updateObject(const PxBounds3& worldAABB, const PrunerPayload& object, const PxTransform& transform); + + // PT: look for objects marked with input timestamp everywhere in the structure, and remove them. This is the same + // as calling 'removeObject' individually for all these objects, but much more efficient. Returns number of removed objects. + PxU32 removeMarkedObjects(PxU32 timeStamp); + + PX_PHYSX_COMMON_API bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + PX_PHYSX_COMMON_API bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback&) const; + PX_PHYSX_COMMON_API bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + + void getGlobalBounds(PxBounds3& bounds) const; + + void shiftOrigin(const PxVec3& shift); + + void visualize(PxRenderOutput& out, PxU32 color) const; + + PX_FORCE_INLINE void build() { classifyBoxes(); } + +#ifdef FREE_PRUNER_SIZE + PX_FORCE_INLINE PxU32 getNbObjects() const { return mNbFree + mCoreNbObjects; } +#else + PX_FORCE_INLINE PxU32 getNbObjects() const { return mCoreNbObjects; } +#endif + +// private: + PxU32 mCoreNbObjects; // Current number of objects in core arrays + PxU32 mCoreCapacity; // Capacity of core arrays + PxBounds3* mCoreBoxes; // Core array + PrunerPayload* mCoreObjects; // Core array + PxTransform* mCoreTransforms; + PxU32* mCoreRemap; // Remaps core index to sorted index, i.e. sortedIndex = mCoreRemap[coreIndex] + + BucketBox* mSortedWorldBoxes; // Sorted array + PrunerPayload* mSortedObjects; // Sorted array + PxTransform* mSortedTransforms; +#ifdef FREE_PRUNER_SIZE + PxU32 mNbFree; // Current number of objects in the "free array" (mFreeObjects/mFreeBounds) + PrunerPayload mFreeObjects[FREE_PRUNER_SIZE]; // mNbFree objects are stored here + PxBounds3 mFreeBounds[FREE_PRUNER_SIZE]; // mNbFree object bounds are stored here + PxTransform mFreeTransforms[FREE_PRUNER_SIZE]; // mNbFree transforms are stored here + PxU32 mFreeStamps[FREE_PRUNER_SIZE]; +#endif + BucketPrunerMap mMap; // Maps (PrunerPayload) object to corresponding index in core array. + // Objects in the free array do not appear in this map. + PxU32 mSortedNb; + PxU32 mSortedCapacity; + PxU32 mSortAxis; + + BucketBox mGlobalBox; // Global bounds around all objects in the structure (except the ones in the "free" array) + BucketPrunerNode mLevel1; + BucketPrunerNode mLevel2[5]; + BucketPrunerNode mLevel3[5][5]; + + bool mDirty; + bool mOwnMemory; + private: + PX_PHYSX_COMMON_API void classifyBoxes(); + void allocateSortedMemory(PxU32 nb); + void resizeCore(); + PX_FORCE_INLINE void addObjectInternal(const PrunerPayload& object, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp); + }; + +#if PX_VC + #pragma warning(pop) +#endif + + class BucketPruner : public Pruner + { + public: + PX_PHYSX_COMMON_API BucketPruner(PxU64 contextID); + virtual ~BucketPruner(); + + // BasePruner + DECLARE_BASE_PRUNER_API + //~BasePruner + + // Pruner + DECLARE_PRUNER_API_COMMON + //~Pruner + + private: + BucketPrunerCore mCore; + PruningPool mPool; + }; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp new file mode 100644 index 0000000..2af2975 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCCTSweepTests.cpp @@ -0,0 +1,444 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxSphereGeometry.h" +#include "GuSweepTests.h" +#include "GuHeightFieldUtil.h" +#include "GuEntityReport.h" +#include "GuDistanceSegmentBox.h" +#include "GuDistancePointBox.h" +#include "GuSweepBoxSphere.h" +#include "GuSweepCapsuleBox.h" +#include "GuSweepBoxBox.h" +#include "GuSweepBoxTriangle_SAT.h" +#include "GuSweepTriangleUtils.h" +#include "GuInternal.h" +#include "foundation/PxVecMath.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace aos; + +static const bool gValidateBoxRadiusComputation = false; + +/////////////////////////////////////////// + +bool sweepCapsule_BoxGeom_Precise(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + PX_UNUSED(threadContext); + PX_UNUSED(inflation); + PX_UNUSED(capsulePose_); + PX_UNUSED(capsuleGeom_); + + const PxBoxGeometry& boxGeom = static_cast(geom); + + if (lss.p0 == lss.p1) // The capsule is actually a sphere + { + //TODO: Check if this is really faster than using a "sphere-aware" version of sweepCapsuleBox + + Box box; buildFrom(box, pose.p, boxGeom.halfExtents, pose.q); + if(!sweepBoxSphere(box, lss.radius, lss.p0, unitDir, distance, sweepHit.distance, sweepHit.normal, hitFlags)) + return false; + + sweepHit.normal = -sweepHit.normal; + sweepHit.flags = PxHitFlag::eNORMAL; + + if(hitFlags & PxHitFlag::ePOSITION && sweepHit.distance!=0.0f) + { + // The sweep test doesn't compute the impact point automatically, so we have to do it here. + const PxVec3 newSphereCenter = lss.p0 + unitDir * sweepHit.distance; + PxVec3 closest; + const PxReal d = distancePointBoxSquared(newSphereCenter, box.center, box.extents, box.rot, &closest); + PX_UNUSED(d); + // Compute point on the box, after sweep + closest = box.rotate(closest); + sweepHit.position = closest + box.center; + sweepHit.flags |= PxHitFlag::ePOSITION; + } + } + else + { + if(!sweepCapsuleBox(lss, pose, boxGeom.halfExtents, unitDir, distance, sweepHit.position, sweepHit.distance, sweepHit.normal, hitFlags)) + return false; + + sweepHit.flags = PxHitFlag::eNORMAL; + + if((hitFlags & PxHitFlag::ePOSITION) && sweepHit.distance!=0.0f) + { + // The sweep test doesn't compute the impact point automatically, so we have to do it here. + Capsule movedCaps = lss; + movedCaps.p0 += unitDir * sweepHit.distance; + movedCaps.p1 += unitDir * sweepHit.distance; + + Box box; + buildFrom(box, pose.p, boxGeom.halfExtents, pose.q); + + PxVec3 closest; + const PxReal d = distanceSegmentBoxSquared(movedCaps, box, NULL, &closest); + PX_UNUSED(d); + // Compute point on the box, after sweep + closest = pose.q.rotate(closest); + sweepHit.position = closest + pose.p; + sweepHit.flags |= PxHitFlag::ePOSITION; + } + } + return true; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool sweepBox_SphereGeom_Precise(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + + PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE); + const PxSphereGeometry& sphereGeom = static_cast(geom); + + // PT: move to relative space + const Box relBox(box.center - pose.p, box.extents, box.rot); + + const PxReal sphereRadius = sphereGeom.radius + inflation; + + if(!sweepBoxSphere(relBox, sphereRadius, PxVec3(0), -unitDir, distance, sweepHit.distance, sweepHit.normal, hitFlags)) + return false; + + sweepHit.flags = PxHitFlag::eNORMAL; + + if((hitFlags & PxHitFlag::ePOSITION) && sweepHit.distance!=0.0f) + { + // The sweep test doesn't compute the impact point automatically, so we have to do it here. + const PxVec3 motion = sweepHit.distance * unitDir; + const PxVec3 newSphereCenter = - motion; + PxVec3 closest; + const PxReal d = distancePointBoxSquared(newSphereCenter, relBox.center, relBox.extents, relBox.rot, &closest); + PX_UNUSED(d); + // Compute point on the box, after sweep + sweepHit.position = relBox.rotate(closest) + box.center + motion; // PT: undo move to local space here + sweepHit.flags |= PxHitFlag::ePOSITION; + } + return true; +} + +bool sweepBox_CapsuleGeom_Precise(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE); + PX_UNUSED(inflation); + PX_UNUSED(boxGeom_); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + // PT: move to relative space + const PxVec3 delta = box.center - pose.p; + Box relBox(delta, box.extents, box.rot); + + Capsule capsule; + const PxVec3 halfHeightVector = getCapsuleHalfHeightVector(pose, capsuleGeom); + capsule.p0 = halfHeightVector; + capsule.p1 = -halfHeightVector; + capsule.radius = capsuleGeom.radius; + + // PT: TODO: remove this. We convert to PxTansform here but inside sweepCapsuleBox we convert back to a matrix. + const PxTransform boxWorldPose(delta, boxPose_.q); + + PxVec3 n; + if(!sweepCapsuleBox(capsule, boxWorldPose, relBox.extents, -unitDir, distance, sweepHit.position, sweepHit.distance, n, hitFlags)) + return false; + + sweepHit.normal = -n; + sweepHit.flags = PxHitFlag::eNORMAL; + + if((hitFlags & PxHitFlag::ePOSITION) && sweepHit.distance!=0.0f) + { + // The sweep test doesn't compute the impact point automatically, so we have to do it here. + relBox.center += (unitDir * sweepHit.distance); + PxVec3 closest; + const PxReal d = distanceSegmentBoxSquared(capsule, relBox, NULL, &closest); + PX_UNUSED(d); + // Compute point on the box, after sweep + sweepHit.position = relBox.transform(closest) + pose.p; // PT: undo move to local space here + sweepHit.flags |= PxHitFlag::ePOSITION; + } + return true; +} + +bool sweepBox_BoxGeom_Precise(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + PX_UNUSED(threadContext); + PX_UNUSED(inflation); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + + const PxBoxGeometry& boxGeom = static_cast(geom); + + // PT: move to local space + const Box relBox(box.center - pose.p, box.extents, box.rot); + Box staticBox; buildFrom(staticBox, PxVec3(0), boxGeom.halfExtents, pose.q); + + if(!sweepBoxBox(relBox, staticBox, unitDir, distance, hitFlags, sweepHit)) + return false; + + if(sweepHit.distance!=0.0f) + sweepHit.position += pose.p; // PT: undo move to local space + return true; +} + +// PT: test: new version for CCT, based on code for general sweeps. Just to check it works or not with rotations +// TODO: refactor this and the similar code in sweptBox for box-vs-mesh. Not so easy though. +static bool sweepBoxVsTriangles(PxU32 nbTris, const PxTriangle* triangles, const Box& box, const PxVec3& unitDir, const PxReal distance, PxGeomSweepHit& sweepHit, + PxHitFlags hitFlags, bool isDoubleSided, const PxU32* cachedIndex) +{ + if(!nbTris) + return false; + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool doBackfaceCulling = !isDoubleSided && !meshBothSides; + + // Move to AABB space + PxMat34 worldToBox; + computeWorldToBoxMatrix(worldToBox, box); + + const PxVec3 localDir = worldToBox.rotate(unitDir); + const PxVec3 localMotion = localDir * distance; + + bool status = false; + sweepHit.distance = distance; //was PX_MAX_F32, but that may trigger an assert in the caller! + + const PxVec3 oneOverMotion( + localDir.x!=0.0f ? 1.0f/localMotion.x : 0.0f, + localDir.y!=0.0f ? 1.0f/localMotion.y : 0.0f, + localDir.z!=0.0f ? 1.0f/localMotion.z : 0.0f); + +// PT: experimental code, don't clean up before I test it more and validate it + +// Project box +/*float boxRadius0 = + PxAbs(dir.x) * box.extents.x + + PxAbs(dir.y) * box.extents.y + + PxAbs(dir.z) * box.extents.z;*/ + +float boxRadius = + PxAbs(localDir.x) * box.extents.x + + PxAbs(localDir.y) * box.extents.y + + PxAbs(localDir.z) * box.extents.z; + +if(gValidateBoxRadiusComputation) // PT: run this to check the box radius is correctly computed +{ + PxVec3 boxVertices2[8]; + box.computeBoxPoints(boxVertices2); + float dpmin = FLT_MAX; + float dpmax = -FLT_MAX; + for(int i=0;i<8;i++) + { + const float dp = boxVertices2[i].dot(unitDir); + if(dpdpmax) dpmax = dp; + } + const float goodRadius = (dpmax-dpmin)/2.0f; + PX_UNUSED(goodRadius); +} + +const float dpc0 = box.center.dot(unitDir); +float localMinDist = 1.0f; +#if PX_DEBUG + PxU32 totalTestsExpected = nbTris; + PxU32 totalTestsReal = 0; + PX_UNUSED(totalTestsExpected); + PX_UNUSED(totalTestsReal); +#endif + + const PxU32 idx = cachedIndex ? *cachedIndex : 0; + + PxVec3 bestTriNormal(0.0f); + + for(PxU32 ii=0;ii(geom); + + // Compute swept box + Box sweptBox; + computeSweptBox(sweptBox, box.extents, box.center, box.rot, unitDir, distance); + + //### Temp hack until we can directly collide the OBB against the HF + const PxTransform sweptBoxTR = sweptBox.getTransform(); + const PxBounds3 bounds = PxBounds3::poseExtent(sweptBoxTR, sweptBox.extents); + + sweepHit.distance = PX_MAX_F32; + + struct LocalReport : OverlapReport + { + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + for(PxU32 i=0; igetTriangle(*mPose, currentTriangle, NULL, NULL, triangleIndex, true, true); + + PxGeomSweepHit sweepHit_; + const bool b = sweepBoxVsTriangles(1, ¤tTriangle, mBox, mDir, mDist, sweepHit_, mHitFlags, mIsDoubleSided, NULL); + if(b && sweepHit_.distancedistance) + { + *mHit = sweepHit_; + mHit->faceIndex = triangleIndex; + mStatus = true; + } + } + return true; + } + + const HeightFieldUtil* mHFUtil; + const PxTransform* mPose; + PxGeomSweepHit* mHit; + bool mStatus; + Box mBox; + PxVec3 mDir; + float mDist; + PxHitFlags mHitFlags; + bool mIsDoubleSided; + } myReport; + + HeightFieldUtil hfUtil(heightFieldGeom); + + myReport.mBox = box; + myReport.mDir = unitDir; + myReport.mDist = distance; + myReport.mHitFlags = hitFlags; + myReport.mHFUtil = &hfUtil; + myReport.mStatus = false; + myReport.mPose = &pose; + myReport.mHit = &sweepHit; + const PxU32 meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + myReport.mIsDoubleSided = (heightFieldGeom.heightFieldFlags & PxMeshGeometryFlag::eDOUBLE_SIDED) || meshBothSides; + + hfUtil.overlapAABBTriangles(pose, bounds, myReport); + + return myReport.mStatus; +} + +bool Gu::sweepBoxTriangles_Precise(GU_SWEEP_TRIANGLES_FUNC_PARAMS(PxBoxGeometry)) +{ + PX_UNUSED(inflation); + + Box box; + buildFrom(box, pose.p, geom.halfExtents, pose.q); + + return sweepBoxVsTriangles(nbTris, triangles, box, unitDir, distance, hit, hitFlags, doubleSided, cachedIndex); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCallbackAdapter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCallbackAdapter.h new file mode 100644 index 0000000..386f1ff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCallbackAdapter.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CALLBACK_ADAPTER_H +#define GU_CALLBACK_ADAPTER_H + +#include "GuPruner.h" +#include "GuPruningPool.h" + +namespace physx +{ +namespace Gu +{ + struct RaycastCallbackAdapter + { + PX_FORCE_INLINE RaycastCallbackAdapter(PrunerRaycastCallback& pcb, const PruningPool& pool) : mCallback(pcb), mPool(pool) {} + + PX_FORCE_INLINE bool invoke(PxReal& distance, PxU32 primIndex) + { + return mCallback.invoke(distance, primIndex, mPool.getObjects(), mPool.getTransforms()); + } + + PrunerRaycastCallback& mCallback; + const PruningPool& mPool; + PX_NOCOPY(RaycastCallbackAdapter) + }; + + struct OverlapCallbackAdapter + { + PX_FORCE_INLINE OverlapCallbackAdapter(PrunerOverlapCallback& pcb, const PruningPool& pool) : mCallback(pcb), mPool(pool) {} + + PX_FORCE_INLINE bool invoke(PxU32 primIndex) + { + return mCallback.invoke(primIndex, mPool.getObjects(), mPool.getTransforms()); + } + + PrunerOverlapCallback& mCallback; + const PruningPool& mPool; + PX_NOCOPY(OverlapCallbackAdapter) + }; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp new file mode 100644 index 0000000..92462f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCapsule.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "GuInternal.h" +#include "GuBox.h" +#include "GuCapsule.h" + +using namespace physx; + +/** +* Computes an OBB surrounding the capsule. +* \param box [out] the OBB +*/ +void Gu::computeBoxAroundCapsule(const Gu::Capsule& capsule, Gu::Box& box) +{ + // Box center = center of the two capsule's endpoints + box.center = capsule.computeCenter(); + + // Box extents + const PxF32 d = (capsule.p0 - capsule.p1).magnitude(); + box.extents.x = capsule.radius + (d * 0.5f); + box.extents.y = capsule.radius; + box.extents.z = capsule.radius; + + // Box orientation + if(d==0.0f) + { + box.rot = PxMat33(PxIdentity); + } + else + { + PxVec3 dir, right, up; + PxComputeBasisVectors(capsule.p0, capsule.p1, dir, right, up); + box.setAxes(dir, right, up); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp new file mode 100644 index 0000000..ad8cd30 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.cpp @@ -0,0 +1,285 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "GuCookingSDF.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "GuSDF.h" +#include "GuCooking.h" + +namespace physx +{ + + struct MeshData + { + MeshData(const PxTriangleMeshDesc& desc) + { + m_positions.resize(desc.points.count); + m_indices.resize(desc.triangles.count * 3); + + immediateCooking::gatherStrided(desc.points.data, &m_positions[0], desc.points.count, sizeof(PxVec3), desc.points.stride); + immediateCooking::gatherStrided(desc.triangles.data, &m_indices[0], desc.triangles.count, 3 * sizeof(PxU32), desc.triangles.stride); + } + + void GetBounds(PxVec3& outMinExtents, PxVec3& outMaxExtents) const + { + PxVec3 minExtents(FLT_MAX); + PxVec3 maxExtents(-FLT_MAX); + + for (PxU32 i = 0; i < m_positions.size(); ++i) + { + const PxVec3& a = m_positions[i]; + + minExtents = a.minimum(minExtents); + maxExtents = a.maximum(maxExtents); + } + + outMinExtents = minExtents; + outMaxExtents = maxExtents; + } + + PxArray m_positions; + PxArray m_indices; + }; + + PX_PHYSX_COMMON_API void quantizeSparseSDF(PxSdfBitsPerSubgridPixel::Enum bitsPerSubgridPixel, + const PxArray& uncompressedSdfDataSubgrids, PxArray& compressedSdfDataSubgrids, + PxReal subgridsMinSdfValue, PxReal subgridsMaxSdfValue) + { + PxU32 bytesPerPixel = PxU32(bitsPerSubgridPixel); + + compressedSdfDataSubgrids.resize(uncompressedSdfDataSubgrids.size() * bytesPerPixel); + + PxReal* ptr32 = reinterpret_cast(compressedSdfDataSubgrids.begin()); + PxU16* ptr16 = reinterpret_cast(compressedSdfDataSubgrids.begin()); + PxU8* ptr8 = compressedSdfDataSubgrids.begin(); + + PxReal s = 1.0f / (subgridsMaxSdfValue - subgridsMinSdfValue); + + for (PxU32 i = 0; i < uncompressedSdfDataSubgrids.size(); ++i) + { + PxReal v = uncompressedSdfDataSubgrids[i]; + PxReal vNormalized = (v - subgridsMinSdfValue) * s; + switch (bitsPerSubgridPixel) + { + case PxSdfBitsPerSubgridPixel::e8_BIT_PER_PIXEL: + ptr8[i] = PxU8(255.0f * vNormalized); + break; + case PxSdfBitsPerSubgridPixel::e16_BIT_PER_PIXEL: + ptr16[i] = PxU16(65535.0f * vNormalized); + break; + case PxSdfBitsPerSubgridPixel::e32_BIT_PER_PIXEL: + ptr32[i] = v; + break; + } + } + } + + PX_FORCE_INLINE PxU32 idxCompact(PxU32 x, PxU32 y, PxU32 z, PxU32 width, PxU32 height) + { + return z * (width) * (height)+y * (width)+x; + } + + static bool createSDFSparse(PxTriangleMeshDesc& desc, PxSDFDesc& sdfDesc, PxArray& sdf, PxArray& sdfDataSubgrids, + PxArray& sdfSubgridsStartSlots) + { + PX_ASSERT(sdfDesc.subgridSize > 0); + + MeshData mesh(desc); + + PxVec3 meshLower, meshUpper; + if (sdfDesc.sdfBounds.isEmpty()) + mesh.GetBounds(meshLower, meshUpper); + else + { + meshLower = sdfDesc.sdfBounds.minimum; + meshUpper = sdfDesc.sdfBounds.maximum; + } + + PxVec3 edges = meshUpper - meshLower; + + const PxReal spacing = sdfDesc.spacing; + + // tweak spacing to avoid edge cases for vertices laying on the boundary + // just covers the case where an edge is a whole multiple of the spacing. + PxReal spacingEps = spacing * (1.0f - 1e-4f); + + // make sure to have at least one particle in each dimension + PxI32 dx, dy, dz; + dx = spacing > edges.x ? 1 : PxI32(edges.x / spacingEps); + dy = spacing > edges.y ? 1 : PxI32(edges.y / spacingEps); + dz = spacing > edges.z ? 1 : PxI32(edges.z / spacingEps); + + dx += 4; + dy += 4; + dz += 4; + + //Make sure that dx, dy and dz are multiple of subgridSize + dx = ((dx + sdfDesc.subgridSize - 1) / sdfDesc.subgridSize) * sdfDesc.subgridSize; + dy = ((dy + sdfDesc.subgridSize - 1) / sdfDesc.subgridSize) * sdfDesc.subgridSize; + dz = ((dz + sdfDesc.subgridSize - 1) / sdfDesc.subgridSize) * sdfDesc.subgridSize; + + PX_ASSERT(dx % sdfDesc.subgridSize == 0); + PX_ASSERT(dy % sdfDesc.subgridSize == 0); + PX_ASSERT(dz % sdfDesc.subgridSize == 0); + + // we shift the voxelization bounds so that the voxel centers + // lie symmetrically to the center of the object. this reduces the + // chance of missing features, and also better aligns the particles + // with the mesh + PxVec3 meshOffset; + meshOffset.x = 0.5f * (spacing - (edges.x - (dx - 1)*spacing)); + meshOffset.y = 0.5f * (spacing - (edges.y - (dy - 1)*spacing)); + meshOffset.z = 0.5f * (spacing - (edges.z - (dz - 1)*spacing)); + meshLower -= meshOffset; + + sdfDesc.meshLower = meshLower; + + sdfDesc.dims.x = dx; + sdfDesc.dims.y = dy; + sdfDesc.dims.z = dz; + + + PxReal narrowBandThickness = sdfDesc.narrowBandThicknessRelativeToSdfBoundsDiagonal * edges.magnitude(); + PxReal subgridsMinSdfValue, subgridsMaxSdfValue; + PxArray denseSdf; + { + PxArray sparseSdf; + Gu::SDFUsingWindingNumbersSparse(&mesh.m_positions[0], &mesh.m_indices[0], mesh.m_indices.size(), dx, dy, dz, + meshLower, meshLower + PxVec3(static_cast(dx), static_cast(dy), static_cast(dz)) * spacing, narrowBandThickness, sdfDesc.subgridSize, + sdf, sdfSubgridsStartSlots, sparseSdf, denseSdf, subgridsMinSdfValue, subgridsMaxSdfValue, 16); + + PxArray uncompressedSdfDataSubgrids; + Gu::convertSparseSDFTo3DTextureLayout(dx, dy, dz, sdfDesc.subgridSize, sdfSubgridsStartSlots.begin(), sparseSdf.begin(), sparseSdf.size(), uncompressedSdfDataSubgrids, + sdfDesc.sdfSubgrids3DTexBlockDim.x, sdfDesc.sdfSubgrids3DTexBlockDim.y, sdfDesc.sdfSubgrids3DTexBlockDim.z); + + if (sdfDesc.bitsPerSubgridPixel == 4) + { + //32bit values are stored as normal floats while 16bit and 8bit values are scaled to 0...1 range and then scaled back to original range + subgridsMinSdfValue = 0.0f; + subgridsMaxSdfValue = 1.0f; + } + + quantizeSparseSDF(sdfDesc.bitsPerSubgridPixel, uncompressedSdfDataSubgrids, sdfDataSubgrids, + subgridsMinSdfValue, subgridsMaxSdfValue); + } + + sdfDesc.sdf.count = sdf.size(); + sdfDesc.sdf.stride = sizeof(PxReal); + sdfDesc.sdf.data = sdf.begin(); + sdfDesc.sdfSubgrids.count = sdfDataSubgrids.size(); + sdfDesc.sdfSubgrids.stride = sizeof(PxU8); + sdfDesc.sdfSubgrids.data = sdfDataSubgrids.begin(); + sdfDesc.sdfStartSlots.count = sdfSubgridsStartSlots.size(); + sdfDesc.sdfStartSlots.stride = sizeof(PxU32); + sdfDesc.sdfStartSlots.data = sdfSubgridsStartSlots.begin(); + + sdfDesc.subgridsMinSdfValue = subgridsMinSdfValue; + sdfDesc.subgridsMaxSdfValue = subgridsMaxSdfValue; + + return true; + } + + static bool createSDF(PxTriangleMeshDesc& desc, PxSDFDesc& sdfDesc, PxArray& sdf, PxArray& sdfDataSubgrids, PxArray& sdfSubgridsStartSlots) + { + if (sdfDesc.subgridSize > 0) + { + return createSDFSparse(desc, sdfDesc, sdf, sdfDataSubgrids, sdfSubgridsStartSlots); + } + + MeshData mesh(desc); + + PxVec3 meshLower, meshUpper; + if (sdfDesc.sdfBounds.isEmpty()) + mesh.GetBounds(meshLower, meshUpper); + else + { + meshLower = sdfDesc.sdfBounds.minimum; + meshUpper = sdfDesc.sdfBounds.maximum; + } + + PxVec3 edges = meshUpper - meshLower; + + const PxReal spacing = sdfDesc.spacing; + + // tweak spacing to avoid edge cases for vertices laying on the boundary + // just covers the case where an edge is a whole multiple of the spacing. + PxReal spacingEps = spacing * (1.0f - 1e-4f); + + // make sure to have at least one particle in each dimension + PxI32 dx, dy, dz; + dx = spacing > edges.x ? 1 : PxI32(edges.x / spacingEps); + dy = spacing > edges.y ? 1 : PxI32(edges.y / spacingEps); + dz = spacing > edges.z ? 1 : PxI32(edges.z / spacingEps); + + dx += 4; + dy += 4; + dz += 4; + + const PxU32 numVoxels = dx * dy * dz; + + // we shift the voxelization bounds so that the voxel centers + // lie symmetrically to the center of the object. this reduces the + // chance of missing features, and also better aligns the particles + // with the mesh + PxVec3 meshOffset; + meshOffset.x = 0.5f * (spacing - (edges.x - (dx - 1)*spacing)); + meshOffset.y = 0.5f * (spacing - (edges.y - (dy - 1)*spacing)); + meshOffset.z = 0.5f * (spacing - (edges.z - (dz - 1)*spacing)); + meshLower -= meshOffset; + + sdfDesc.meshLower = meshLower; + + sdfDesc.dims.x = dx; + sdfDesc.dims.y = dy; + sdfDesc.dims.z = dz; + + sdf.resize(numVoxels); + Gu::SDFUsingWindingNumbers(&mesh.m_positions[0], &mesh.m_indices[0], mesh.m_indices.size(), dx, dy, dz, &sdf[0], meshLower, + meshLower + PxVec3(static_cast(dx), static_cast(dy), static_cast(dz)) * spacing, NULL, true, sdfDesc.numThreadsForSdfConstruction); + + sdfDesc.sdf.count = sdfDesc.dims.x * sdfDesc.dims.y * sdfDesc.dims.z; + sdfDesc.sdf.stride = sizeof(PxReal); + sdfDesc.sdf.data = &sdf[0]; + + return true; + } + + bool buildSDF(PxTriangleMeshDesc& desc, PxArray& sdf, PxArray& sdfDataSubgrids, PxArray& sdfSubgridsStartSlots) + { + PxSDFDesc& sdfDesc = *desc.sdfDesc; + + if (!sdfDesc.sdf.data && sdfDesc.spacing > 0.f) + { + // Calculate signed distance field here if no sdf data provided. + createSDF(desc, sdfDesc, sdf, sdfDataSubgrids, sdfSubgridsStartSlots); + sdfDesc.sdf.stride = sizeof(PxReal); + } + return true; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.h new file mode 100644 index 0000000..5f394fa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuCookingSDF.h @@ -0,0 +1,42 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_SDF_BUILDER_H +#define GU_COOKING_SDF_BUILDER_H + +#include "foundation/PxArray.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ + class PxTriangleMeshDesc; + + PX_PHYSX_COMMON_API bool buildSDF(PxTriangleMeshDesc& desc, PxArray& sdf, PxArray& sdfDataSubgrids, PxArray& sdfSubgridsStartSlots); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp new file mode 100644 index 0000000..345b673 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.cpp @@ -0,0 +1,866 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBitMap.h" +#include "GuExtendedBucketPruner.h" +#include "GuAABBTree.h" +#include "GuAABBTreeQuery.h" +#include "GuQuery.h" +#include "GuCallbackAdapter.h" +#include "GuSqInternal.h" + +using namespace physx; +using namespace Gu; + +#define EXT_NB_OBJECTS_PER_NODE 4 + +// PT: TODO: this is copied from SqBounds.h, should be either moved to Gu and shared or passed as a user parameter + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) + +ExtendedBucketPruner::ExtendedBucketPruner(PxU64 contextID, CompanionPrunerType type, const PruningPool* pool) : + mCompanion (createCompanionPruner(contextID, type, pool)), + mPruningPool (pool), + mMainTree (NULL), + mMergedTrees (NULL), + mCurrentTreeIndex (0), + mTreesDirty (false) +{ + // preallocated size for bounds, trees + mCurrentTreeCapacity = 32; + + mBounds.init(mCurrentTreeCapacity); + mMergedTrees = PX_ALLOCATE(MergedTree, mCurrentTreeCapacity, "AABB trees"); + mExtendedBucketPrunerMap.reserve(mCurrentTreeCapacity); + + // create empty main tree + mMainTree = PX_NEW(AABBTree); + + // create empty merge trees + for (PxU32 i = 0; i < mCurrentTreeCapacity; i++) + { + mMergedTrees[i].mTimeStamp = 0; + mMergedTrees[i].mTree = PX_NEW(AABBTree); + } +} + +////////////////////////////////////////////////////////////////////////// + +ExtendedBucketPruner::~ExtendedBucketPruner() +{ + // release main tree + PX_DELETE(mMainTree); + + // release merged trees + for (PxU32 i = 0; i < mCurrentTreeCapacity; i++) + { + AABBTree* aabbTree = mMergedTrees[i].mTree; + PX_DELETE(aabbTree); + } + + mBounds.release(); + PX_FREE(mMergedTrees); + + PX_DELETE(mCompanion); +} + +////////////////////////////////////////////////////////////////////////// +// release all objects in bucket pruner +void ExtendedBucketPruner::release() +{ + if(mCompanion) + mCompanion->release(); + + mMainTreeUpdateMap.release(); + mMergeTreeUpdateMap.release(); + + // release all objecs from the map + mExtendedBucketPrunerMap.clear(); + + // release all merged trees + for (PxU32 i = 0; i < mCurrentTreeCapacity; i++) + { + mMergedTrees[i].mTimeStamp = 0; + mMergedTrees[i].mTree->release(); + } + + // reset current tree index + mCurrentTreeIndex = 0; +} + +////////////////////////////////////////////////////////////////////////// +// Add a tree from a pruning structure +// 1. get new tree index +// 2. initialize merged tree, bounds +// 3. create update map for the merged tree +// 4. build new tree of trees from given trees bounds +// 5. add new objects into extended bucket pruner map +// 6. shift indices in the merged tree +void ExtendedBucketPruner::addTree(const AABBTreeMergeData& mergeData, PxU32 timeStamp) +{ + // check if we have to resize + if(mCurrentTreeIndex == mCurrentTreeCapacity) + { + resize(mCurrentTreeCapacity*2); + } + + // get current merge tree index + const PxU32 mergeTreeIndex = mCurrentTreeIndex++; + + // get payloads/userdata pointers - the pointers start at mIndicesOffset, thats where all + // objects were added before merge was called + const PrunerPayload* data = &mPruningPool->getObjects()[mergeData.mIndicesOffset]; + + // setup merged tree with the merge data and timestamp + mMergedTrees[mergeTreeIndex].mTimeStamp = timeStamp; + AABBTree& mergedTree = *mMergedTrees[mergeTreeIndex].mTree; + mergedTree.initTree(mergeData); + // set bounds + mBounds.getBounds()[mergeTreeIndex] = mergeData.getRootNode().mBV; + + // update temporally update map for the current merge tree, map is used to setup the base extended bucket pruner map + mMergeTreeUpdateMap.initMap(mergeData.mNbIndices, mergedTree); + + // create new base tree of trees + buildMainAABBTree(); + + // Add each object into extended bucket pruner hash map + for (PxU32 i = 0; i < mergeData.mNbIndices; i++) + { + ExtendedBucketPrunerData mapData; + mapData.mMergeIndex = mergeTreeIndex; + mapData.mTimeStamp = timeStamp; + PX_ASSERT(mMergeTreeUpdateMap[i] < mergedTree.getNbNodes()); + // get node information from the merge tree update map + mapData.mSubTreeNode = mMergeTreeUpdateMap[i]; + mExtendedBucketPrunerMap.insert(data[i], mapData); + } + // merged tree indices needs to be shifted now, we cannot shift it in init - the update map + // could not be constructed otherwise, as the indices wont start from 0. The indices + // needs to be shifted by offset from the pruning pool, where the new objects were added into the pruning pool. + mergedTree.shiftIndices(mergeData.mIndicesOffset); + +#if PX_DEBUG + checkValidity(); +#endif // PX_DEBUG +} + +////////////////////////////////////////////////////////////////////////// +// Builds the new main AABB tree with given current active merged trees and its bounds +void ExtendedBucketPruner::buildMainAABBTree() +{ + // create the AABB tree from given merged trees bounds + NodeAllocator nodeAllocator; + bool status = mMainTree->build(AABBTreeBuildParams(EXT_NB_OBJECTS_PER_NODE, mCurrentTreeIndex, &mBounds), nodeAllocator); + + PX_UNUSED(status); + PX_ASSERT(status); + + // Init main tree update map for the new main tree + mMainTreeUpdateMap.initMap(mCurrentTreeIndex, *mMainTree); +} + +////////////////////////////////////////////////////////////////////////// +// resize internal memory, buffers +void ExtendedBucketPruner::resize(PxU32 size) +{ + PX_ASSERT(size > mCurrentTreeCapacity); + mBounds.resize(size, mCurrentTreeCapacity); + + // allocate new merged trees + MergedTree* newMergeTrees = PX_ALLOCATE(MergedTree, size, "AABB trees"); + // copy previous merged trees + PxMemCopy(newMergeTrees, mMergedTrees, sizeof(MergedTree)*mCurrentTreeCapacity); + PX_FREE(mMergedTrees); + mMergedTrees = newMergeTrees; + // allocate new trees for merged trees + for (PxU32 i = mCurrentTreeCapacity; i < size; i++) + { + mMergedTrees[i].mTimeStamp = 0; + mMergedTrees[i].mTree = PX_NEW(AABBTree); + } + + mCurrentTreeCapacity = size; +} + +////////////////////////////////////////////////////////////////////////// +// Update object +bool ExtendedBucketPruner::updateObject(const PxBounds3& worldAABB, const PxTransform& transform, const PrunerPayload& object, PrunerHandle handle, const PoolIndex poolIndex) +{ + const ExtendedBucketPrunerMap::Entry* extendedPrunerEntry = mExtendedBucketPrunerMap.find(object); + + // if object is not in tree of trees, it is in bucket pruner core + if(!extendedPrunerEntry) + { + if(mCompanion) + mCompanion->updateObject(object, handle, worldAABB, transform, poolIndex); + } + else + { + const ExtendedBucketPrunerData& data = extendedPrunerEntry->second; + + PX_ASSERT(data.mMergeIndex < mCurrentTreeIndex); + + // update tree where objects belongs to + AABBTree& tree = *mMergedTrees[data.mMergeIndex].mTree; + PX_ASSERT(data.mSubTreeNode < tree.getNbNodes()); + // mark for refit node in merged tree + tree.markNodeForRefit(data.mSubTreeNode); + PX_ASSERT(mMainTreeUpdateMap[data.mMergeIndex] < mMainTree->getNbNodes()); + // mark for refit node in main aabb tree + mMainTree->markNodeForRefit(mMainTreeUpdateMap[data.mMergeIndex]); + mTreesDirty = true; + } + return true; +} + +////////////////////////////////////////////////////////////////////////// +// refit merged nodes +// 1. refit nodes in merged trees +// 2. check if after refit root node is valid - might happen edge case +// where all objects were released - the root node is then invalid +// in this edge case we need to compact the merged trees array +// and create new main AABB tree +// 3. If all merged trees bounds are valid - refit main tree +// 4. If bounds are invalid create new main AABB tree +void ExtendedBucketPruner::refitMarkedNodes(const PxBounds3* boxes) +{ + // if no tree needs update early exit + if(!mTreesDirty) + return; + + // refit trees and update bounds for main tree + PxU32 nbValidTrees = 0; + for (PxU32 i = mCurrentTreeIndex; i--; ) + { + AABBTree& tree = *mMergedTrees[i].mTree; + tree.refitMarkedNodes(boxes); + const PxBounds3& bounds = tree.getNodes()[0].mBV; + // check if bounds are valid, if all objects of the tree were released, the bounds + // will be invalid, in that case we cannot use this tree anymore. + if(bounds.isValid()) + { + nbValidTrees++; + } + mBounds.getBounds()[i] = bounds; + } + + if(nbValidTrees == mCurrentTreeIndex) + { + // no tree has been removed refit main tree + mMainTree->refitMarkedNodes(mBounds.getBounds()); + } + else + { + // edge case path, tree does not have a valid root node bounds - all objects from the tree were released + // we might even fire perf warning + // compact the tree array - no holes in the array, remember the swap position + PxU32* swapMap = PX_ALLOCATE(PxU32, (mCurrentTreeIndex + 1), "Swap Map"); + PxU32 writeIndex = 0; + for (PxU32 i = 0; i < mCurrentTreeIndex; i++) + { + AABBTree& tree = *mMergedTrees[i].mTree; + if(tree.getNodes()[0].mBV.isValid()) + { + // we have to store the tree into an empty location + if(i != writeIndex) + { + PX_ASSERT(writeIndex < i); + AABBTree* ptr = mMergedTrees[writeIndex].mTree; + mMergedTrees[writeIndex] = mMergedTrees[i]; + mMergedTrees[i].mTree = ptr; + mBounds.getBounds()[writeIndex] = mBounds.getBounds()[i]; + } + // remember the swap location + swapMap[i] = writeIndex; + writeIndex++; + } + else + { + // tree is not valid, release it + tree.release(); + mMergedTrees[i].mTimeStamp = 0; + } + + // remember the swap + swapMap[mCurrentTreeIndex] = i; + } + + PX_ASSERT(writeIndex == nbValidTrees); + + // new merged trees size + mCurrentTreeIndex = nbValidTrees; + + if(mCurrentTreeIndex) + { + // trees have changed, we need to rebuild the main tree + buildMainAABBTree(); + + // fixup the object entries, the merge index has changed + for (ExtendedBucketPrunerMap::Iterator iter = mExtendedBucketPrunerMap.getIterator(); !iter.done(); ++iter) + { + ExtendedBucketPrunerData& data = iter->second; + PX_ASSERT(swapMap[data.mMergeIndex] < nbValidTrees); + data.mMergeIndex = swapMap[data.mMergeIndex]; + } + } + else + { + // if there is no tree release the main tree + mMainTree->release(); + } + PX_FREE(swapMap); + } +#if PX_DEBUG + checkValidity(); +#endif + mTreesDirty = false; +} + +////////////////////////////////////////////////////////////////////////// +// remove object +bool ExtendedBucketPruner::removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex) +{ + ExtendedBucketPrunerMap::Entry dataEntry; + + // if object is not in tree of trees, it is in bucket pruner core + if (!mExtendedBucketPrunerMap.erase(object, dataEntry)) + { + // we need to call invalidateObjects, it might happen that the swapped object + // does belong to the extended bucket pruner, in that case the objects index + // needs to be swapped. + // do not call additional bucket pruner swap, that does happen during remove + swapIndex(objectIndex, swapObject, swapObjectIndex, false); + return mCompanion ? mCompanion->removeObject(object, handle, objectIndex, swapObjectIndex) : true; + } + else + { + const ExtendedBucketPrunerData& data = dataEntry.second; + + // mark tree nodes where objects belongs to + AABBTree& tree = *mMergedTrees[data.mMergeIndex].mTree; + PX_ASSERT(data.mSubTreeNode < tree.getNbNodes()); + // mark the merged tree for refit + tree.markNodeForRefit(data.mSubTreeNode); + PX_ASSERT(mMainTreeUpdateMap[data.mMergeIndex] < mMainTree->getNbNodes()); + // mark the main tree for refit + mMainTree->markNodeForRefit(mMainTreeUpdateMap[data.mMergeIndex]); + + // call invalidate object to swap the object indices in the merged trees + invalidateObject(data, objectIndex, swapObject, swapObjectIndex); + + mTreesDirty = true; + } +#if PX_DEBUG + checkValidity(); +#endif // PX_DEBUG + return true; +} + +////////////////////////////////////////////////////////////////////////// +// invalidate object +// remove the objectIndex from the merged tree +void ExtendedBucketPruner::invalidateObject(const ExtendedBucketPrunerData& data, PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex) +{ + // get the merged tree + AABBTree& tree = *mMergedTrees[data.mMergeIndex].mTree; + PX_ASSERT(data.mSubTreeNode < tree.getNbNodes()); + PX_ASSERT(tree.getNodes()[data.mSubTreeNode].isLeaf()); + // get merged tree node + BVHNode& node0 = tree.getNodes()[data.mSubTreeNode]; + const PxU32 nbPrims = node0.getNbRuntimePrimitives(); + PX_ASSERT(nbPrims <= EXT_NB_OBJECTS_PER_NODE); + + // retrieve the primitives pointer + PxU32* primitives = node0.getPrimitives(tree.getIndices()); + PX_ASSERT(primitives); + + // Look for desired pool index in the leaf + bool foundIt = false; + for (PxU32 i = 0; i < nbPrims; i++) + { + if (objectIndex == primitives[i]) + { + foundIt = true; + const PxU32 last = nbPrims - 1; + node0.setNbRunTimePrimitives(last); + primitives[i] = INVALID_POOL_ID; // Mark primitive index as invalid in the node + + // Swap within the leaf node. No need to update the mapping since they should all point + // to the same tree node anyway. + if (last != i) + PxSwap(primitives[i], primitives[last]); + break; + } + } + PX_ASSERT(foundIt); + PX_UNUSED(foundIt); + + swapIndex(objectIndex, swapObject, swapObjectIndex); +} + +// Swap object index +// if swapObject is in a merged tree its index needs to be swapped with objectIndex +void ExtendedBucketPruner::swapIndex(PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex, bool corePrunerIncluded) +{ + PX_UNUSED(corePrunerIncluded); + if (objectIndex == swapObjectIndex) + return; + + const ExtendedBucketPrunerMap::Entry* extendedPrunerSwapEntry = mExtendedBucketPrunerMap.find(swapObject); + + // if swapped object index is in extended pruner, we have to fix the primitives index + if (extendedPrunerSwapEntry) + { + const ExtendedBucketPrunerData& swapData = extendedPrunerSwapEntry->second; + AABBTree& swapTree = *mMergedTrees[swapData.mMergeIndex].mTree; + // With multiple primitives per leaf, tree nodes may very well be the same for different pool indices. + // However the pool indices may be the same when a swap has been skipped in the pruning pool, in which + // case there is nothing to do. + PX_ASSERT(swapData.mSubTreeNode < swapTree.getNbNodes()); + PX_ASSERT(swapTree.getNodes()[swapData.mSubTreeNode].isLeaf()); + BVHNode* node1 = swapTree.getNodes() + swapData.mSubTreeNode; + const PxU32 nbPrims = node1->getNbRuntimePrimitives(); + PX_ASSERT(nbPrims <= EXT_NB_OBJECTS_PER_NODE); + + // retrieve the primitives pointer + PxU32* primitives = node1->getPrimitives(swapTree.getIndices()); + PX_ASSERT(primitives); + + // look for desired pool index in the leaf + bool foundIt = false; + for (PxU32 i = 0; i < nbPrims; i++) + { + if (swapObjectIndex == primitives[i]) + { + foundIt = true; + primitives[i] = objectIndex; // point node to the pool object moved to + break; + } + } + PX_ASSERT(foundIt); + PX_UNUSED(foundIt); + } + else + { + if(corePrunerIncluded) + if(mCompanion) + mCompanion->swapIndex(objectIndex, swapObjectIndex); + } +} + +////////////////////////////////////////////////////////////////////////// +// Optimized removal of timestamped objects from the extended bucket pruner +PxU32 ExtendedBucketPruner::removeMarkedObjects(PxU32 timeStamp) +{ + // remove objects from the core bucket pruner + PxU32 retVal = mCompanion ? mCompanion->removeMarkedObjects(timeStamp) : 0; + + // nothing to be removed + if(!mCurrentTreeIndex) + return retVal; + + // if last merged tree is the timeStamp to remove, we can clear all + // this is safe as the merged trees array is time ordered, never shifted + if(mMergedTrees[mCurrentTreeIndex - 1].mTimeStamp == timeStamp) + { + retVal += mExtendedBucketPrunerMap.size(); + cleanTrees(); + return retVal; + } + + // get the highest index in the merged trees array, where timeStamp match + // we release than all trees till the index + PxU32 highestTreeIndex = 0xFFFFFFFF; + for (PxU32 i = 0; i < mCurrentTreeIndex; i++) + { + if(mMergedTrees[i].mTimeStamp == timeStamp) + highestTreeIndex = i; + else + break; + } + + // if no timestamp found early exit + if(highestTreeIndex == 0xFFFFFFFF) + return retVal; + + PX_ASSERT(highestTreeIndex < mCurrentTreeIndex); + // get offset, where valid trees start + const PxU32 mergeTreeOffset = highestTreeIndex + 1; + + // shrink the array to merged trees with a valid timeStamp + mCurrentTreeIndex = mCurrentTreeIndex - mergeTreeOffset; + // go over trees and swap released trees with valid trees from the back (valid trees are at the back) + for (PxU32 i = 0; i < mCurrentTreeIndex; i++) + { + // store bounds, timestamp + mBounds.getBounds()[i] = mMergedTrees[mergeTreeOffset + i].mTree->getNodes()[0].mBV; + mMergedTrees[i].mTimeStamp = mMergedTrees[mergeTreeOffset + i].mTimeStamp; + + // release the tree with timestamp + AABBTree* ptr = mMergedTrees[i].mTree; + ptr->release(); + + // store the valid tree + mMergedTrees[i].mTree = mMergedTrees[mergeTreeOffset + i].mTree; + // store the release tree at the offset + mMergedTrees[mergeTreeOffset + i].mTree = ptr; + mMergedTrees[mergeTreeOffset + i].mTimeStamp = 0; + } + // release the rest of the trees with not valid timestamp + for (PxU32 i = mCurrentTreeIndex; i <= highestTreeIndex; i++) + { + mMergedTrees[i].mTree->release(); + mMergedTrees[i].mTimeStamp = 0; + } + + // build new main AABB tree with only trees with valid valid timeStamp + buildMainAABBTree(); + + // remove all unnecessary trees and map entries + bool removeEntry = false; + PxU32 numRemovedEntries = 0; + ExtendedBucketPrunerMap::EraseIterator eraseIterator = mExtendedBucketPrunerMap.getEraseIterator(); + ExtendedBucketPrunerMap::Entry* entry = eraseIterator.eraseCurrentGetNext(removeEntry); + while (entry) + { + ExtendedBucketPrunerData& data = entry->second; + // data to be removed + if (data.mTimeStamp == timeStamp) + { + removeEntry = true; + numRemovedEntries++; + } + else + { + // update the merge index and main tree node index + PX_ASSERT(highestTreeIndex < data.mMergeIndex); + data.mMergeIndex -= mergeTreeOffset; + removeEntry = false; + } + entry = eraseIterator.eraseCurrentGetNext(removeEntry); + } + +#if PX_DEBUG + checkValidity(); +#endif // PX_DEBUG + // return the number of removed objects + return retVal + numRemovedEntries; +} + +////////////////////////////////////////////////////////////////////////// +// clean all trees, all objects have been released +void ExtendedBucketPruner::cleanTrees() +{ + for (PxU32 i = 0; i < mCurrentTreeIndex; i++) + { + mMergedTrees[i].mTree->release(); + mMergedTrees[i].mTimeStamp = 0; + } + mExtendedBucketPrunerMap.clear(); + mCurrentTreeIndex = 0; + mMainTree->release(); +} + +////////////////////////////////////////////////////////////////////////// +// shift origin +void ExtendedBucketPruner::shiftOrigin(const PxVec3& shift) +{ + mMainTree->shiftOrigin(shift); + + for(PxU32 i=0; ishiftOrigin(shift); + + if(mCompanion) + mCompanion->shiftOrigin(shift); +} + +////////////////////////////////////////////////////////////////////////// +// Queries implementation +////////////////////////////////////////////////////////////////////////// + +// Raycast/sweeps callback for main AABB tree +template +struct MainTreeRaycastPrunerCallback +{ + MainTreeRaycastPrunerCallback(const PxVec3& origin, const PxVec3& unitDir, const PxVec3& extent, PrunerRaycastCallback& prunerCallback, const PruningPool* pool, const MergedTree* mergedTrees) + : mOrigin(origin), mUnitDir(unitDir), mExtent(extent), mPrunerCallback(prunerCallback), mPruningPool(pool), mMergedTrees(mergedTrees) + { + } + + bool invoke(PxReal& distance, PxU32 primIndex) + { + const AABBTree* aabbTree = mMergedTrees[primIndex].mTree; + + // raycast the merged tree + RaycastCallbackAdapter pcb(mPrunerCallback, *mPruningPool); + return AABBTreeRaycast()(mPruningPool->getCurrentAABBTreeBounds(), *aabbTree, mOrigin, mUnitDir, distance, mExtent, pcb); + } + + PX_NOCOPY(MainTreeRaycastPrunerCallback) + +private: + const PxVec3& mOrigin; + const PxVec3& mUnitDir; + const PxVec3& mExtent; + PrunerRaycastCallback& mPrunerCallback; + const PruningPool* mPruningPool; + const MergedTree* mMergedTrees; +}; + +////////////////////////////////////////////////////////////////////////// +// raycast against the extended bucket pruner +bool ExtendedBucketPruner::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const +{ + bool again = mCompanion ? mCompanion->raycast(origin, unitDir, inOutDistance, prunerCallback) : true; + + if(again && mExtendedBucketPrunerMap.size()) + { + const PxVec3 extent(0.0f); + // main tree callback + MainTreeRaycastPrunerCallback pcb(origin, unitDir, extent, prunerCallback, mPruningPool, mMergedTrees); + // traverse the main tree + again = AABBTreeRaycast>()(mBounds, *mMainTree, origin, unitDir, inOutDistance, extent, pcb); + } + + return again; +} + +////////////////////////////////////////////////////////////////////////// +// overlap main tree callback +template +struct MainTreeOverlapPrunerCallback +{ + MainTreeOverlapPrunerCallback(const Test& test, PrunerOverlapCallback& prunerCallback, const PruningPool* pool, const MergedTree* mergedTrees) + : mTest(test), mPrunerCallback(prunerCallback), mPruningPool(pool), mMergedTrees(mergedTrees) + { + } + + bool invoke(PxU32 primIndex) + { + const AABBTree* aabbTree = mMergedTrees[primIndex].mTree; + // overlap the merged tree + OverlapCallbackAdapter pcb(mPrunerCallback, *mPruningPool); + return AABBTreeOverlap()(mPruningPool->getCurrentAABBTreeBounds(), *aabbTree, mTest, pcb); + } + + PX_NOCOPY(MainTreeOverlapPrunerCallback) + +private: + const Test& mTest; + PrunerOverlapCallback& mPrunerCallback; + const PruningPool* mPruningPool; + const MergedTree* mMergedTrees; +}; + +////////////////////////////////////////////////////////////////////////// +// overlap implementation +bool ExtendedBucketPruner::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const +{ + bool again = mCompanion ? mCompanion->overlap(queryVolume, prunerCallback) : true; + + if(again && mExtendedBucketPrunerMap.size()) + { + switch (queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if (queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + MainTreeOverlapPrunerCallback pcb(test, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeOverlap>()(mBounds, *mMainTree, test, pcb); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + MainTreeOverlapPrunerCallback pcb(test, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeOverlap>()(mBounds, *mMainTree, test, pcb); + } + } + break; + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + MainTreeOverlapPrunerCallback pcb(test, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeOverlap>()(mBounds, *mMainTree, test, pcb); + } + break; + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + MainTreeOverlapPrunerCallback pcb(test, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeOverlap>()(mBounds, *mMainTree, test, pcb); + } + break; + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + MainTreeOverlapPrunerCallback pcb(test, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeOverlap>()(mBounds, *mMainTree, test, pcb); + } + break; + + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } + + return again; +} + +////////////////////////////////////////////////////////////////////////// +// sweep implementation +bool ExtendedBucketPruner::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const +{ + bool again = mCompanion ? mCompanion->sweep(queryVolume, unitDir, inOutDistance, prunerCallback) : true; + + if(again && mExtendedBucketPrunerMap.size()) + { + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + const PxVec3 extents = aabb.getExtents(); + const PxVec3 center = aabb.getCenter(); + MainTreeRaycastPrunerCallback pcb(center, unitDir, extents, prunerCallback, mPruningPool, mMergedTrees); + again = AABBTreeRaycast>()(mBounds, *mMainTree, center, unitDir, inOutDistance, extents, pcb); + } + return again; +} + +////////////////////////////////////////////////////////////////////////// + +void ExtendedBucketPruner::getGlobalBounds(PxBounds3& bounds) const +{ + if(mCompanion) + mCompanion->getGlobalBounds(bounds); + else + bounds.setEmpty(); + + if(mExtendedBucketPrunerMap.size() && mMainTree && mMainTree->getNodes()) + bounds.include(mMainTree->getNodes()->mBV); +} + +////////////////////////////////////////////////////////////////////////// + +void ExtendedBucketPruner::visualize(PxRenderOutput& out, PxU32 color) const +{ + visualizeTree(out, color, mMainTree); + + for(PxU32 i=0; ivisualize(out, color); +} + +////////////////////////////////////////////////////////////////////////// + +#if PX_DEBUG +// extended bucket pruner validity check +bool ExtendedBucketPruner::checkValidity() +{ + PxBitMap testBitmap; + testBitmap.resizeAndClear(mCurrentTreeIndex); + for (PxU32 i = 0; i < mMainTree->getNbNodes(); i++) + { + const BVHNode& node = mMainTree->getNodes()[i]; + if(node.isLeaf()) + { + const PxU32 nbPrims = node.getNbRuntimePrimitives(); + PX_ASSERT(nbPrims <= EXT_NB_OBJECTS_PER_NODE); + + const PxU32* primitives = node.getPrimitives(mMainTree->getIndices()); + for (PxU32 j = 0; j < nbPrims; j++) + { + const PxU32 index = primitives[j]; + // check if index is correct + PX_ASSERT(index < mCurrentTreeIndex); + // mark the index in the test bitmap, must be once set only, all merged trees must be in the main tree + PX_ASSERT(testBitmap.test(index) == PxIntFalse); + testBitmap.set(index); + } + } + } + + PxBitMap mergeTreeTestBitmap; + mergeTreeTestBitmap.resizeAndClear(mPruningPool->getNbActiveObjects()); + for (PxU32 i = 0; i < mCurrentTreeIndex; i++) + { + // check if bounds are the same as the merged tree root bounds + PX_ASSERT(mBounds.getBounds()[i].maximum.x == mMergedTrees[i].mTree->getNodes()[0].mBV.maximum.x); + PX_ASSERT(mBounds.getBounds()[i].maximum.y == mMergedTrees[i].mTree->getNodes()[0].mBV.maximum.y); + PX_ASSERT(mBounds.getBounds()[i].maximum.z == mMergedTrees[i].mTree->getNodes()[0].mBV.maximum.z); + PX_ASSERT(mBounds.getBounds()[i].minimum.x == mMergedTrees[i].mTree->getNodes()[0].mBV.minimum.x); + PX_ASSERT(mBounds.getBounds()[i].minimum.y == mMergedTrees[i].mTree->getNodes()[0].mBV.minimum.y); + PX_ASSERT(mBounds.getBounds()[i].minimum.z == mMergedTrees[i].mTree->getNodes()[0].mBV.minimum.z); + + // check each tree + const AABBTree& mergedTree = *mMergedTrees[i].mTree; + for (PxU32 j = 0; j < mergedTree.getNbNodes(); j++) + { + const BVHNode& node = mergedTree.getNodes()[j]; + if (node.isLeaf()) + { + const PxU32 nbPrims = node.getNbRuntimePrimitives(); + PX_ASSERT(nbPrims <= EXT_NB_OBJECTS_PER_NODE); + + const PxU32* primitives = node.getPrimitives(mergedTree.getIndices()); + for (PxU32 k = 0; k < nbPrims; k++) + { + const PxU32 index = primitives[k]; + // check if index is correct + PX_ASSERT(index < mPruningPool->getNbActiveObjects()); + // mark the index in the test bitmap, must be once set only, all merged trees must be in the main tree + PX_ASSERT(mergeTreeTestBitmap.test(index) == PxIntFalse); + mergeTreeTestBitmap.set(index); + + const PrunerPayload& payload = mPruningPool->getObjects()[index]; + const ExtendedBucketPrunerMap::Entry* extendedPrunerSwapEntry = mExtendedBucketPrunerMap.find(payload); + PX_ASSERT(extendedPrunerSwapEntry); + + const ExtendedBucketPrunerData& data = extendedPrunerSwapEntry->second; + PX_ASSERT(data.mMergeIndex == i); + PX_ASSERT(data.mSubTreeNode == j); + } + } + } + } + for (PxU32 i = mCurrentTreeIndex; i < mCurrentTreeCapacity; i++) + { + PX_ASSERT(mMergedTrees[i].mTree->getIndices() == NULL); + PX_ASSERT(mMergedTrees[i].mTree->getNodes() == NULL); + } + for (ExtendedBucketPrunerMap::Iterator iter = mExtendedBucketPrunerMap.getIterator(); !iter.done(); ++iter) + { + const ExtendedBucketPrunerData& data = iter->second; + PX_ASSERT(mMainTreeUpdateMap[data.mMergeIndex] < mMainTree->getNbNodes()); + PX_ASSERT(data.mMergeIndex < mCurrentTreeIndex); + PX_ASSERT(data.mSubTreeNode < mMergedTrees[data.mMergeIndex].mTree->getNbNodes()); + } + return true; +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.h new file mode 100644 index 0000000..2d4e302 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuExtendedBucketPruner.h @@ -0,0 +1,188 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_EXTENDED_BUCKET_PRUNER_H +#define GU_EXTENDED_BUCKET_PRUNER_H + +#include "GuPrunerTypedef.h" +#include "GuAABBTreeUpdateMap.h" +#include "foundation/PxHashMap.h" +#include "GuAABBTreeBounds.h" +#include "GuSecondaryPruner.h" + +namespace physx +{ + class PxRenderOutput; + +namespace Gu +{ + class AABBTreeMergeData; + + // Extended bucket pruner data, if an object belongs to the tree of trees, we need to + // remember node for the sub tree, the tree it belongs to and the main tree node + struct ExtendedBucketPrunerData + { + PxU32 mTimeStamp; // timestamp + TreeNodeIndex mSubTreeNode; // sub tree node index + PxU32 mMergeIndex; // index in bounds and merged trees array + }; + + // Merged tree structure, holds tree and its timeStamp, released when no objects is in the tree + // or timeStamped objects are released + struct MergedTree + { + AABBTree* mTree; // AABB tree + size_t mTimeStamp; // + }; + + // hashing function for PrunerPayload key + // PT: TODO: move this to PrunerPayload? + struct ExtendedBucketPrunerHash + { + PX_FORCE_INLINE uint32_t operator()(const PrunerPayload& payload) const + { +#if PX_P64_FAMILY +// const PxU32 h0 = PxHash((const void*)payload.data[0]); +// const PxU32 h1 = PxHash((const void*)payload.data[1]); + const PxU32 h0 = PxU32(PX_MAX_U32 & payload.data[0]); + const PxU32 h1 = PxU32(PX_MAX_U32 & payload.data[1]); + return physx::PxComputeHash(PxU64(h0) | (PxU64(h1) << 32)); +#else + return physx::PxComputeHash(PxU64(payload.data[0]) | (PxU64(payload.data[1]) << 32)); +#endif + } + PX_FORCE_INLINE bool equal(const PrunerPayload& k0, const PrunerPayload& k1) const + { + return (k0.data[0] == k1.data[0]) && (k0.data[1] == k1.data[1]); + } + }; + + // A.B. replace, this is useless, need to be able to traverse the map and release while traversing, also eraseAt failed + typedef PxHashMap ExtendedBucketPrunerMap; + + // Extended bucket pruner holds single objects in a bucket pruner and AABBtrees in a tree of trees. + // Base usage of ExtendedBucketPruner is for dynamic AABBPruner new objects, that did not make it + // into new tree. Single objects go directly into a bucket pruner, while merged AABBtrees + // go into a tree of trees. + // PT: TODO: this is not a Pruner (doesn't use the Pruner API) so its name should be e.g. "ExtendedBucketPrunerCore". + // And it's also not always using a bucket pruner... so the whole "ExtendedBucketPruner" name everywhere is wrong. + class ExtendedBucketPruner + { + public: + ExtendedBucketPruner(PxU64 contextID, CompanionPrunerType type, const PruningPool* pool); + ~ExtendedBucketPruner(); + + // release + void release(); + + // add single object into a bucket pruner directly + PX_FORCE_INLINE bool addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, const PoolIndex poolIndex) + { + return mCompanion ? mCompanion->addObject(object, handle, worldAABB, transform, timeStamp, poolIndex) : true; + } + + // add AABB tree from pruning structure - adds new primitive into main AABB tree + void addTree(const AABBTreeMergeData& mergeData, PxU32 timeStamp); + + // update object + bool updateObject(const PxBounds3& worldAABB, const PxTransform& transform, const PrunerPayload& object, PrunerHandle handle, const PoolIndex poolIndex); + + // remove object, removed object is replaced in pruning pool by swapped object, indices needs to be updated + bool removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex); + + // swap object index, the object index can be in core pruner or tree of trees + void swapIndex(PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex, bool corePrunerIncluded = true); + + // refit marked nodes in tree of trees + void refitMarkedNodes(const PxBounds3* boxes); + + // notify timestampChange - swap trees in incremental pruner + PX_FORCE_INLINE void timeStampChange() + { + if(mCompanion) + mCompanion->timeStampChange(); + } + + // look for objects marked with input timestamp everywhere in the structure, and remove them. This is the same + // as calling 'removeObject' individually for all these objects, but much more efficient. Returns number of removed objects. + PxU32 removeMarkedObjects(PxU32 timeStamp); + + // queries against the pruner + bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback&) const; + bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + + // origin shift + void shiftOrigin(const PxVec3& shift); + + // debug visualize + void visualize(PxRenderOutput& out, PxU32 color) const; + + PX_FORCE_INLINE void build() + { + if(mCompanion) + mCompanion->build(); + } + + PX_FORCE_INLINE PxU32 getNbObjects() const + { + const PxU32 nb = mCompanion ? mCompanion->getNbObjects() : 0; + return nb + mExtendedBucketPrunerMap.size(); + } + + void getGlobalBounds(PxBounds3&) const; + private: + // separate call for indices invalidation, object can be either in AABBPruner or Bucket pruner, but the swapped object can be + // in the tree of trees + void invalidateObject(const ExtendedBucketPrunerData& object, PxU32 objectIndex, const PrunerPayload& swapObject, PxU32 swapObjectIndex); + + void resize(PxU32 size); + void buildMainAABBTree(); + void cleanTrees(); +#if PX_DEBUG + // Extended bucket pruner validity check + bool checkValidity(); +#endif + CompanionPruner* mCompanion; // Companion pruner for single objects + const PruningPool* mPruningPool; // Pruning pool from AABB pruner + ExtendedBucketPrunerMap mExtendedBucketPrunerMap; // Map holding objects from tree merge - objects in tree of trees + AABBTree* mMainTree; // Main tree holding merged trees + AABBTreeUpdateMap mMainTreeUpdateMap; // Main tree updated map - merged trees index to nodes + AABBTreeUpdateMap mMergeTreeUpdateMap; // Merged tree update map used while tree is merged + AABBTreeBounds mBounds; // Merged trees bounds used for main tree building + MergedTree* mMergedTrees; // Merged trees + PxU32 mCurrentTreeIndex; // Current trees index + PxU32 mCurrentTreeCapacity; // Current tress capacity + bool mTreesDirty; // Dirty marker + }; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp new file mode 100644 index 0000000..b86dade --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuFactory.cpp @@ -0,0 +1,51 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuFactory.h" +#include "GuAABBPruner.h" +#include "GuBucketPruner.h" +#include "GuIncrementalAABBPruner.h" + +using namespace physx; +using namespace Gu; + +Pruner* physx::Gu::createBucketPruner(PxU64 contextID) +{ + return PX_NEW(BucketPruner)(contextID); +} + +Pruner* physx::Gu::createAABBPruner(PxU64 contextID, bool dynamic, CompanionPrunerType cpType, BVHBuildStrategy buildStrategy, PxU32 nbObjectsPerNode) +{ + return PX_NEW(AABBPruner)(dynamic, contextID, cpType, buildStrategy, nbObjectsPerNode); +} + +Pruner* physx::Gu::createIncrementalPruner(PxU64 contextID) +{ + return PX_NEW(IncrementalAABBPruner)(32, contextID); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryChecks.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryChecks.h new file mode 100644 index 0000000..f61fc8e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryChecks.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GEOMETRY_CHECKS_H +#define GU_GEOMETRY_CHECKS_H + +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxParticleSystemGeometry.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHairSystemGeometry.h" +#include "geometry/PxCustomGeometry.h" + +namespace physx +{ + + // We sometimes overload capsule code for spheres, so every sphere should have + // valid capsule data (height = 0). This is preferable to a typedef so that we + // can maintain traits separately for a sphere, but some care is required to deal + // with the fact that when a reference to a capsule is extracted, it may have its + // type field set to eSPHERE + + template + struct PxcGeometryTraits + { + enum {TypeID = PxGeometryType::eINVALID }; + }; + template struct PxcGeometryTraits { enum { TypeID = PxcGeometryTraits::TypeID }; }; + + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eBOX }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eSPHERE }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eCAPSULE }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::ePLANE }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::ePARTICLESYSTEM}; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eCONVEXMESH }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eTRIANGLEMESH }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eTETRAHEDRONMESH }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eHEIGHTFIELD }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eHAIRSYSTEM }; }; + template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eCUSTOM }; }; + + template PX_CUDA_CALLABLE PX_FORCE_INLINE void checkType(const PxGeometry& geometry) + { + PX_ASSERT(PxU32(geometry.getType()) == PxU32(PxcGeometryTraits::TypeID)); + PX_UNUSED(geometry); + } + + template<> PX_CUDA_CALLABLE PX_FORCE_INLINE void checkType(const PxGeometry& geometry) + { + PX_ASSERT(geometry.getType() == PxGeometryType::eCAPSULE || geometry.getType() == PxGeometryType::eSPHERE); + PX_UNUSED(geometry); + } + + template<> PX_CUDA_CALLABLE PX_FORCE_INLINE void checkType(const PxGeometry& geometry) + { + PX_ASSERT(geometry.getType()== PxGeometryType::eCAPSULE || geometry.getType() == PxGeometryType::eSPHERE); + PX_UNUSED(geometry); + } +} + +// the shape structure relies on punning capsules and spheres +PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(physx::PxCapsuleGeometry, radius) == PX_OFFSET_OF(physx::PxSphereGeometry, radius)); + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp new file mode 100644 index 0000000..f770b79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGeometryQuery.cpp @@ -0,0 +1,491 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHairSystemGeometry.h" +#include "geometry/PxParticleSystemGeometry.h" +#include "geometry/PxCustomGeometry.h" +#include "foundation/PxAtomic.h" + +#include "GuInternal.h" +#include "GuOverlapTests.h" +#include "GuSweepTests.h" +#include "GuRaycastTests.h" +#include "GuBoxConversion.h" +#include "GuTriangleMesh.h" +#include "GuMTD.h" +#include "GuBounds.h" +#include "GuDistancePointSegment.h" +#include "GuConvexMesh.h" +#include "GuDistancePointBox.h" +#include "GuMidphaseInterface.h" +#include "foundation/PxFPU.h" + +#include "GuConvexEdgeFlags.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuPCMShapeConvex.h" +#include "GuPCMContactConvexCommon.h" + +using namespace physx; +using namespace Gu; + +extern GeomSweepFuncs gGeomSweepFuncs; +extern GeomOverlapTable gGeomOverlapMethodTable[]; +extern RaycastFunc gRaycastMap[PxGeometryType::eGEOMETRY_COUNT]; + +/////////////////////////////////////////////////////////////////////////////// + +bool PxGeometryQuery::isValid(const PxGeometry& g) +{ + switch(PxU32(g.getType())) + { + case PxGeometryType::eSPHERE: return static_cast(g).isValid(); + case PxGeometryType::ePLANE: return static_cast(g).isValid(); + case PxGeometryType::eCAPSULE: return static_cast(g).isValid(); + case PxGeometryType::eBOX: return static_cast(g).isValid(); + case PxGeometryType::eCONVEXMESH: return static_cast(g).isValid(); + case PxGeometryType::eTRIANGLEMESH: return static_cast(g).isValid(); + case PxGeometryType::eHEIGHTFIELD: return static_cast(g).isValid(); + case PxGeometryType::eTETRAHEDRONMESH: return static_cast(g).isValid(); + case PxGeometryType::ePARTICLESYSTEM: return static_cast(g).isValid(); + case PxGeometryType::eHAIRSYSTEM: return static_cast(g).isValid(); + case PxGeometryType::eCUSTOM: return static_cast(g).isValid(); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool PxGeometryQuery::sweep(const PxVec3& unitDir, const PxReal distance, + const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, + const PxReal inflation, PxGeometryQueryFlags queryFlags, PxSweepThreadContext* threadContext) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN_VAL(pose0.isValid(), "PxGeometryQuery::sweep(): pose0 is not valid.", false); + PX_CHECK_AND_RETURN_VAL(pose1.isValid(), "PxGeometryQuery::sweep(): pose1 is not valid.", false); + PX_CHECK_AND_RETURN_VAL(unitDir.isFinite(), "PxGeometryQuery::sweep(): unitDir is not valid.", false); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(distance), "PxGeometryQuery::sweep(): distance is not valid.", false); + PX_CHECK_AND_RETURN_VAL((distance >= 0.0f && !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) || distance > 0.0f, + "PxGeometryQuery::sweep(): sweep distance must be >=0 or >0 with eASSUME_NO_INITIAL_OVERLAP.", 0); +#if PX_CHECKED + if(!PxGeometryQuery::isValid(geom0)) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "Provided geometry 0 is not valid"); + + if(!PxGeometryQuery::isValid(geom1)) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "Provided geometry 1 is not valid"); +#endif + + const GeomSweepFuncs& sf = gGeomSweepFuncs; + + switch(geom0.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom0); + + const PxCapsuleGeometry capsuleGeom(sphereGeom.radius, 0.0f); + + const Capsule worldCapsule(pose0.p, pose0.p, sphereGeom.radius); + + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + + return func(geom1, pose1, capsuleGeom, pose0, worldCapsule, unitDir, distance, sweepHit, hitFlags, inflation, threadContext); + } + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + + Capsule worldCapsule; + getCapsule(worldCapsule, capsuleGeom, pose0); + + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + + return func(geom1, pose1, capsuleGeom, pose0, worldCapsule, unitDir, distance, sweepHit, hitFlags, inflation, threadContext); + } + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& boxGeom = static_cast(geom0); + + Box box; + buildFrom(box, pose0.p, boxGeom.halfExtents, pose0.q); + + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepBoxFunc func = precise ? sf.preciseBoxMap[geom1.getType()] : sf.boxMap[geom1.getType()]; + + return func(geom1, pose1, boxGeom, pose0, box, unitDir, distance, sweepHit, hitFlags, inflation, threadContext); + } + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + + const SweepConvexFunc func = sf.convexMap[geom1.getType()]; + + return func(geom1, pose1, convexGeom, pose0, unitDir, distance, sweepHit, hitFlags, inflation, threadContext); + } + default: + PX_CHECK_MSG(false, "PxGeometryQuery::sweep(): first geometry object parameter must be sphere, capsule, box or convex geometry."); + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool PxGeometryQuery::overlap( const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, + PxGeometryQueryFlags queryFlags, PxOverlapThreadContext* threadContext) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + return Gu::overlap(geom0, pose0, geom1, pose1, gGeomOverlapMethodTable, threadContext); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 PxGeometryQuery::raycast( const PxVec3& rayOrigin, const PxVec3& rayDir, + const PxGeometry& geom, const PxTransform& pose, + PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT rayHits, PxU32 stride, + PxGeometryQueryFlags queryFlags, PxRaycastThreadContext* threadContext) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN_VAL(rayDir.isFinite(), "PxGeometryQuery::raycast(): rayDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(rayOrigin.isFinite(), "PxGeometryQuery::raycast(): rayOrigin is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(pose.isValid(), "PxGeometryQuery::raycast(): pose is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(maxDist >= 0.0f, "PxGeometryQuery::raycast(): maxDist is negative.", false); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(maxDist), "PxGeometryQuery::raycast(): maxDist is not valid.", false); + PX_CHECK_AND_RETURN_VAL(PxAbs(rayDir.magnitudeSquared()-1)<1e-4f, "PxGeometryQuery::raycast(): ray direction must be unit vector.", false); + + const RaycastFunc func = gRaycastMap[geom.getType()]; + return func(geom, pose, rayOrigin, rayDir, maxDist, hitFlags, maxHits, rayHits, stride, threadContext); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool pointConvexDistance(PxVec3& normal_, PxVec3& closestPoint_, PxReal& sqDistance, const PxVec3& pt, const ConvexMesh* convexMesh, const PxMeshScale& meshScale, const PxTransform& convexPose); + +PxReal PxGeometryQuery::pointDistance(const PxVec3& point, const PxGeometry& geom, const PxTransform& pose, PxVec3* closestPoint, PxU32* closestIndex, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN_VAL(pose.isValid(), "PxGeometryQuery::pointDistance(): pose is not valid.", -1.0f); + + switch(geom.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom); + + const PxReal r = sphereGeom.radius; + + PxVec3 delta = point - pose.p; + const PxReal d = delta.magnitude(); + if(d<=r) + return 0.0f; + + if(closestPoint) + { + delta /= d; + *closestPoint = pose.p + delta * r; + } + + return (d - r)*(d - r); + } + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& capsGeom = static_cast(geom); + + Capsule capsule; + getCapsule(capsule, capsGeom, pose); + + const PxReal r = capsGeom.radius; + + PxReal param; + const PxReal sqDistance = distancePointSegmentSquared(capsule, point, ¶m); + if(sqDistance<=r*r) + return 0.0f; + + const PxReal d = physx::intrinsics::sqrt(sqDistance); + + if(closestPoint) + { + const PxVec3 cp = capsule.getPointAt(param); + + PxVec3 delta = point - cp; + delta.normalize(); + + *closestPoint = cp + delta * r; + } + return (d - r)*(d - r); + } + case PxGeometryType::eBOX: + { + const PxBoxGeometry& boxGeom = static_cast(geom); + + Box obb; + buildFrom(obb, pose.p, boxGeom.halfExtents, pose.q); + + PxVec3 boxParam; + const PxReal sqDistance = distancePointBoxSquared(point, obb, &boxParam); + if(closestPoint && sqDistance!=0.0f) + { + *closestPoint = obb.transform(boxParam); + } + return sqDistance; + } + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& convexGeom = static_cast(geom); + + PxVec3 normal, cp; + PxReal sqDistance; + const bool intersect = pointConvexDistance(normal, cp, sqDistance, point, static_cast(convexGeom.convexMesh), convexGeom.scale, pose); + if(!intersect && closestPoint) + *closestPoint = cp; + return sqDistance; + } + case PxGeometryType::eTRIANGLEMESH: + { + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + + PxU32 index; + float dist; + PxVec3 cp; + Midphase::pointMeshDistance(static_cast(meshGeom.triangleMesh), meshGeom, pose, point, FLT_MAX, index, dist, cp); + if(closestPoint) + *closestPoint = cp; + if(closestIndex) + *closestIndex = index; + return dist*dist; + } + default: + PX_CHECK_MSG(false, "PxGeometryQuery::pointDistance(): geometry object parameter must be sphere, capsule, box, convex or mesh geometry."); + break; + } + return -1.0f; +} + +/////////////////////////////////////////////////////////////////////////////// + +void PxGeometryQuery::computeGeomBounds(PxBounds3& bounds, const PxGeometry& geom, const PxTransform& pose, float offset, float inflation, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN(pose.isValid(), "PxGeometryQuery::computeGeomBounds(): pose is not valid."); + + Gu::computeBounds(bounds, geom, pose, offset, inflation); + PX_ASSERT(bounds.isValid()); +} + +PxBounds3 PxGeometryQuery::getWorldBounds(const PxGeometry& geom, const PxTransform& pose, float inflation) +{ + PX_SIMD_GUARD; + PX_CHECK_AND_RETURN_VAL(pose.isValid(), "PxGeometryQuery::getWorldBounds(): pose is not valid.", PxBounds3::empty()); + + PxBounds3 bounds; + Gu::computeBounds(bounds, geom, pose, 0.0f, inflation); + PX_ASSERT(bounds.isValid()); + return bounds; +} + +/////////////////////////////////////////////////////////////////////////////// + +extern GeomMTDFunc gGeomMTDMethodTable[][PxGeometryType::eGEOMETRY_COUNT]; + +bool PxGeometryQuery::computePenetration( PxVec3& mtd, PxF32& depth, + const PxGeometry& geom0, const PxTransform& pose0, + const PxGeometry& geom1, const PxTransform& pose1, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN_VAL(pose0.isValid(), "PxGeometryQuery::computePenetration(): pose0 is not valid.", false); + PX_CHECK_AND_RETURN_VAL(pose1.isValid(), "PxGeometryQuery::computePenetration(): pose1 is not valid.", false); + + if(geom0.getType() > geom1.getType()) + { + GeomMTDFunc mtdFunc = gGeomMTDMethodTable[geom1.getType()][geom0.getType()]; + PX_ASSERT(mtdFunc); + if(!mtdFunc(mtd, depth, geom1, pose1, geom0, pose0)) + return false; + mtd = -mtd; + return true; + } + else + { + GeomMTDFunc mtdFunc = gGeomMTDMethodTable[geom0.getType()][geom1.getType()]; + PX_ASSERT(mtdFunc); + return mtdFunc(mtd, depth, geom0, pose0, geom1, pose1); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool PxGeometryQuery::generateTriangleContacts(const PxGeometry& geom, const PxTransform& pose, const PxVec3 triangleVertices[3], PxU32 triangleIndex, PxReal contactDistance, PxReal meshContactMargin, PxReal toleranceLength, PxContactBuffer& contactBuffer) +{ + using namespace aos; + + const PxU32 triangleIndices[3]{ 0, 1, 2 }; + PxInlineArray deferredContacts; + Gu::MultiplePersistentContactManifold multiManifold; + multiManifold.initialize(); + PxContactBuffer contactBuffer0; contactBuffer0.reset(); + const PxTransformV geomTransform = loadTransformU(pose); + const PxTransformV triangleTransform = loadTransformU(PxTransform(PxIdentity)); + float radius0 = 0; + float radius1 = meshContactMargin; + + PxU32 oldCount = contactBuffer.count; + + switch (geom.getType()) + { + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& capsule = static_cast(geom); + radius0 = capsule.radius; + + const FloatV capsuleRadius = FLoad(capsule.radius); + const FloatV contactDist = FLoad(contactDistance + meshContactMargin); + const FloatV replaceBreakingThreshold = FMul(capsuleRadius, FLoad(0.001f)); + + const PxTransformV capsuleTransform = geomTransform; + const PxTransformV meshTransform = triangleTransform; + + multiManifold.setRelativeTransform(capsuleTransform); + + const Gu::CapsuleV capsuleV(V3LoadU(pose.p), V3LoadU(pose.q.rotate(PxVec3(capsule.halfHeight, 0, 0))), capsuleRadius); + + Gu::PCMCapsuleVsMeshContactGeneration contactGeneration(capsuleV, contactDist, replaceBreakingThreshold, capsuleTransform, meshTransform, multiManifold, contactBuffer0, &deferredContacts); + contactGeneration.processTriangle(triangleVertices, triangleIndex, Gu::ETD_CONVEX_EDGE_ALL, triangleIndices); + contactGeneration.processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE, false); + + break; + } + case PxGeometryType::eBOX: + { + const PxBoxGeometry& box = static_cast(geom); + + const PxBounds3 hullAABB(-box.halfExtents, box.halfExtents); + const Vec3V boxExtents = V3LoadU(box.halfExtents); + const FloatV minMargin = Gu::CalculatePCMBoxMargin(boxExtents, toleranceLength, GU_PCM_MESH_MANIFOLD_EPSILON); + + Cm::FastVertex2ShapeScaling idtScaling; + + const FloatV contactDist = FLoad(contactDistance + meshContactMargin); + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + BoxV boxV(V3Zero(), boxExtents); + + const PxTransformV boxTransform = geomTransform; + const PxTransformV meshTransform = triangleTransform; + + PolygonalData polyData; + PCMPolygonalBox polyBox(box.halfExtents); + polyBox.getPolygonalData(&polyData); + + Mat33V identity = M33Identity(); + SupportLocalImpl boxMap(boxV, boxTransform, identity, identity, true); + + Gu::PCMConvexVsMeshContactGeneration contactGeneration(contactDist, replaceBreakingThreshold, boxTransform, meshTransform, multiManifold, contactBuffer0, polyData, &boxMap, &deferredContacts, idtScaling, true, true, NULL); + contactGeneration.processTriangle(triangleVertices, triangleIndex, Gu::ETD_CONVEX_EDGE_ALL, triangleIndices); + contactGeneration.processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE, false); + + break; + } + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& convex = static_cast(geom); + + const ConvexHullData* hullData = _getHullData(convex); + + Cm::FastVertex2ShapeScaling convexScaling; + PxBounds3 hullAABB; + PolygonalData polyData; + const bool idtConvexScale = getPCMConvexData(convex, convexScaling, hullAABB, polyData); + const QuatV vQuat = QuatVLoadU(&convex.scale.rotation.x); + const Vec3V vScale = V3LoadU_SafeReadW(convex.scale.scale); + const FloatV minMargin = CalculatePCMConvexMargin(hullData, vScale, toleranceLength, GU_PCM_MESH_MANIFOLD_EPSILON); + + const ConvexHullV convexHull(hullData, V3Zero(), vScale, vQuat, idtConvexScale); + + const FloatV contactDist = FLoad(contactDistance + meshContactMargin); + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + const PxTransformV convexTransform = geomTransform; + const PxTransformV meshTransform = triangleTransform; + + SupportLocalImpl convexMap(convexHull, convexTransform, convexHull.vertex2Shape, convexHull.shape2Vertex, false); + + Gu::PCMConvexVsMeshContactGeneration contactGeneration(contactDist, replaceBreakingThreshold, convexTransform, meshTransform, multiManifold, contactBuffer0, polyData, &convexMap, &deferredContacts, convexScaling, idtConvexScale, true, NULL); + contactGeneration.processTriangle(triangleVertices, triangleIndex, Gu::ETD_CONVEX_EDGE_ALL, triangleIndices); + contactGeneration.processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE, false); + + break; + } + default: + break; + } + + for (PxU32 manifoldIndex = 0; manifoldIndex < multiManifold.mNumManifolds; ++manifoldIndex) + { + Gu::SinglePersistentContactManifold& manifold = *multiManifold.getManifold(manifoldIndex); + PxVec3 normal; V3StoreU(manifold.getWorldNormal(triangleTransform), normal); + for (PxU32 contactIndex = 0; contactIndex < manifold.getNumContacts(); ++contactIndex) + { + Gu::MeshPersistentContact& meshContact = manifold.getContactPoint(contactIndex); + PxContactPoint contact; + PxVec3 p0; V3StoreU(geomTransform.transform(meshContact.mLocalPointA), p0); p0 -= normal * radius0; + PxVec3 p1; V3StoreU(meshContact.mLocalPointB, p1); p1 += normal * radius1; + contact.point = (p0 + p1) * 0.5f; + contact.normal = normal; + contact.separation = normal.dot(p0 - p1); + contact.internalFaceIndex1 = triangleIndex; + contactBuffer.contact(contact); + } + } + + return oldCount < contactBuffer.count; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 PxCustomGeometry_getUniqueID() +{ + static PxU32 uniqueID(0); + PxAtomicIncrement(reinterpret_cast(&uniqueID)); + return uniqueID; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp new file mode 100644 index 0000000..abaf712 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuGjkQuery.cpp @@ -0,0 +1,277 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxGjkQuery.h" + +#include "GuInternal.h" +#include "GuOverlapTests.h" +#include "GuSweepTests.h" +#include "GuRaycastTests.h" +#include "GuBoxConversion.h" +#include "GuTriangleMesh.h" +#include "GuMTD.h" +#include "GuBounds.h" +#include "GuDistancePointSegment.h" +#include "GuConvexMesh.h" +#include "GuDistancePointBox.h" +#include "GuMidphaseInterface.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Gu; + +#include "GuGJK.h" +#include "GuGJKPenetration.h" +#include "GuGJKRaycast.h" +#include "GuEPA.h" +#include "geomutils/PxContactBuffer.h" + +using namespace aos; + +static PX_SUPPORT_INLINE PxVec3 Vec3V_To_PxVec3(const Vec3V& a) +{ + PxVec3 v; + V3StoreU(a, v); + return v; +} + +static PX_SUPPORT_INLINE PxReal FloatV_To_PxReal(const FloatV& a) +{ + PxF32 f; + FStore(a, &f); + return f; +} + +struct CustomConvexV : ConvexV +{ + const PxGjkQuery::Support* s; + PxReal supportScale; + + CustomConvexV(const PxGjkQuery::Support& _s) : ConvexV(Gu::ConvexType::eCUSTOM), s(&_s), supportScale(1.0f) + { + setMinMargin(FLoad(0.001f)); + setSweepMargin(FLoad(0.001f)); + } + PX_SUPPORT_INLINE Vec3V supportPoint(const PxI32 /*index*/) const + { + return supportLocal(V3LoadU(PxVec3(1, 0, 0))); + } + PX_SUPPORT_INLINE Vec3V supportLocal(const Vec3V& dir) const + { + return V3Scale(V3LoadU(s->supportLocal(Vec3V_To_PxVec3(dir))), FLoad(supportScale)); + } + PX_SUPPORT_INLINE Vec3V supportLocal(const Vec3V& dir, PxI32& index) const + { + index = 0; + return supportLocal(dir); + } + PX_SUPPORT_INLINE Vec3V supportRelative(const Vec3V& dir, const PxMatTransformV& aTob, const PxMatTransformV& aTobT) const + { + const Vec3V _dir = aTobT.rotate(dir); + const Vec3V p = supportLocal(_dir); + return aTob.transform(p); + } + PX_SUPPORT_INLINE Vec3V supportRelative(const Vec3V& dir, const PxMatTransformV& aTob, const PxMatTransformV& aTobT, PxI32& index) const + { + index = 0; + return supportRelative(dir, aTob, aTobT); + } +}; + +bool PxGjkQuery::proximityInfo(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB, PxReal contactDistance, PxReal toleranceLength, PxVec3& pointA, PxVec3& pointB, PxVec3& separatingAxis, PxReal& separation) +{ + const PxTransformV transf0 = loadTransformU(poseA); + const PxTransformV transf1 = loadTransformU(poseB); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + const PxReal degenerateScale = 0.001f; + + CustomConvexV supportA(a); + CustomConvexV supportB(b); + const RelativeConvex convexA(supportA, aToB); + const LocalConvex convexB(supportB); + + Vec3V initialSearchDir = aToB.p; + FloatV contactDist = FLoad((a.getMargin() + b.getMargin()) + contactDistance); + + Vec3V aPoints[4]; + Vec3V bPoints[4]; + PxU8 size = 0; + GjkOutput output; + + GjkStatus status = gjkPenetration(convexA, convexB, initialSearchDir, contactDist, true, aPoints, bPoints, size, output); + + if (status == GJK_DEGENERATE) + { + supportA.supportScale = supportB.supportScale = 1.0f - degenerateScale; + status = gjkPenetration(convexA, convexB, initialSearchDir, contactDist, true, aPoints, bPoints, size, output); + supportA.supportScale = supportB.supportScale = 1.0f; + } + + if (status == GJK_CONTACT || status == GJK_DEGENERATE) + { + separatingAxis = poseB.rotate(Vec3V_To_PxVec3(output.normal).getNormalized()); + pointA = poseB.transform(Vec3V_To_PxVec3(output.closestA)) - separatingAxis * a.getMargin(); + pointB = poseB.transform(Vec3V_To_PxVec3(output.closestB)) + separatingAxis * b.getMargin(); + separation = (pointA - pointB).dot(separatingAxis); + return true; + } + + if (status == EPA_CONTACT) + { + status = epaPenetration(convexA, convexB, aPoints, bPoints, size, true, FLoad(toleranceLength), output); + + if (status == EPA_CONTACT || status == EPA_DEGENERATE) + { + separatingAxis = poseB.rotate(Vec3V_To_PxVec3(output.normal).getNormalized()); + pointA = poseB.transform(Vec3V_To_PxVec3(output.closestA)) - separatingAxis * a.getMargin(); + pointB = poseB.transform(Vec3V_To_PxVec3(output.closestB)) + separatingAxis * b.getMargin(); + separation = (pointA - pointB).dot(separatingAxis); + return true; + } + } + + return false; +} + +struct PointConvexV : ConvexV +{ + Vec3V zero; + PointConvexV() : ConvexV(Gu::ConvexType::eCUSTOM) + { + zero = V3LoadU(PxVec3(0)); + setMinMargin(FLoad(0.001f)); + setSweepMargin(FLoad(0.001f)); + } + PX_SUPPORT_INLINE Vec3V supportPoint(const PxI32 /*index*/) const + { + return zero; + } + PX_SUPPORT_INLINE Vec3V supportLocal(const Vec3V& /*dir*/) const + { + return zero; + } + PX_SUPPORT_INLINE Vec3V supportLocal(const Vec3V& dir, PxI32& index) const + { + index = 0; + return supportLocal(dir); + } + PX_SUPPORT_INLINE Vec3V supportRelative(const Vec3V& dir, const PxMatTransformV& aTob, const PxMatTransformV& aTobT) const + { + const Vec3V _dir = aTobT.rotate(dir); + const Vec3V p = supportLocal(_dir); + return aTob.transform(p); + } + PX_SUPPORT_INLINE Vec3V supportRelative(const Vec3V& dir, const PxMatTransformV& aTob, const PxMatTransformV& aTobT, PxI32& index) const + { + index = 0; + return supportRelative(dir, aTob, aTobT); + } +}; + +bool PxGjkQuery::raycast(const Support& shape, const PxTransform& pose, const PxVec3& rayStart, const PxVec3& unitDir, PxReal maxDist, PxReal& t, PxVec3& n, PxVec3& p) +{ + const PxTransformV transf0 = loadTransformU(pose); + const PxTransformV transf1 = PxTransformV(V3LoadU(rayStart)); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + CustomConvexV supportA(shape); + PointConvexV supportB; + const RelativeConvex convexA(supportA, aToB); + const LocalConvex convexB(supportB); + + Vec3V initialDir = aToB.p; + FloatV initialLambda = FLoad(0); + Vec3V s = V3Zero(); + Vec3V r = V3LoadU(unitDir * maxDist); + FloatV lambda; + Vec3V normal, closestA; + + if (gjkRaycast(convexA, convexB, initialDir, initialLambda, s, r, lambda, normal, closestA, shape.getMargin())) + { + t = FloatV_To_PxReal(lambda) * maxDist; + n = -Vec3V_To_PxVec3(normal).getNormalized(); + p = Vec3V_To_PxVec3(closestA) + n * shape.getMargin() + rayStart; + return true; + } + + return false; +} + +bool PxGjkQuery::overlap(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB) +{ + const PxTransformV transf0 = loadTransformU(poseA); + const PxTransformV transf1 = loadTransformU(poseB); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + CustomConvexV supportA(a); + CustomConvexV supportB(b); + const RelativeConvex convexA(supportA, aToB); + const LocalConvex convexB(supportB); + + Vec3V initialSearchDir = aToB.p; + FloatV contactDist = FLoad(a.getMargin() + b.getMargin()); + Vec3V closestA, closestB, normal; + FloatV distance; + GjkStatus status = gjk(convexA, convexB, initialSearchDir, contactDist, closestA, closestB, normal, distance); + + return status == GJK_CLOSE || status == GJK_CONTACT; +} + +bool PxGjkQuery::sweep(const Support& a, const Support& b, const PxTransform& poseA, const PxTransform& poseB, const PxVec3& unitDir, PxReal maxDist, PxReal& t, PxVec3& n, PxVec3& p) +{ + const PxTransformV transf0 = loadTransformU(poseA); + const PxTransformV transf1 = loadTransformU(poseB); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + CustomConvexV supportA(a); + CustomConvexV supportB(b); + const RelativeConvex convexA(supportA, aToB); + const LocalConvex convexB(supportB); + + Vec3V initialDir = aToB.p; + FloatV initialLambda = FLoad(0); + Vec3V s = V3Zero(); + Vec3V r = V3LoadU(poseB.rotateInv(unitDir * maxDist)); + FloatV lambda; + Vec3V normal, closestA; + + if (gjkRaycast(convexA, convexB, initialDir, initialLambda, s, r, lambda, normal, closestA, a.getMargin() + b.getMargin())) + { + t = FloatV_To_PxReal(lambda) * maxDist; + n = poseB.rotate(-(Vec3V_To_PxVec3(normal)).getNormalized()); + p = poseB.transform(Vec3V_To_PxVec3(closestA)) + n * a.getMargin(); + return true; + } + + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp new file mode 100644 index 0000000..3c52a3f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.cpp @@ -0,0 +1,398 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// PT: TODO: this class isn't actually used at the moment +#define COMPILE_INCREMENTAL_AABB_PRUNER +#ifdef COMPILE_INCREMENTAL_AABB_PRUNER + +#include "common/PxProfileZone.h" +#include "CmVisualization.h" +#include "foundation/PxBitUtils.h" +#include "GuIncrementalAABBPruner.h" +#include "GuIncrementalAABBTree.h" +#include "GuCallbackAdapter.h" +#include "GuAABBTree.h" +#include "GuAABBTreeQuery.h" +#include "GuSphere.h" +#include "GuBox.h" +#include "GuCapsule.h" +#include "GuQuery.h" + +using namespace physx; +using namespace Gu; + +// PT: TODO: this is copied from SqBounds.h, should be either moved to Gu and shared or passed as a user parameter + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) + +#define PARANOIA_CHECKS 0 + +IncrementalAABBPruner::IncrementalAABBPruner(PxU32 sceneLimit, PxU64 contextID) : + mAABBTree (NULL), + mPool (contextID, TRANSFORM_CACHE_GLOBAL), + mContextID (contextID) +{ + mMapping.resizeUninitialized(sceneLimit); + mPool.preallocate(sceneLimit); + + mChangedLeaves.reserve(sceneLimit); +} + +IncrementalAABBPruner::~IncrementalAABBPruner() +{ + release(); +} + +bool IncrementalAABBPruner::addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count, bool ) +{ + PX_PROFILE_ZONE("SceneQuery.prunerAddObjects", mContextID); + + if(!count) + return true; + + const PxU32 valid = mPool.addObjects(results, bounds, data, transforms, count); + + if(mAABBTree) + { + for(PxU32 i=0;iinsert(poolIndex, mPool.getCurrentWorldBoxes(), mChangedLeaves); + updateMapping(poolIndex, node); + } + + #if PARANOIA_CHECKS + test(); + #endif + } + + return valid==count; +} + +void IncrementalAABBPruner::updateMapping(const PoolIndex poolIndex, IncrementalAABBTreeNode* node) +{ + // resize mapping if needed + if(mMapping.size() <= poolIndex) + { + mMapping.resize(mMapping.size() * 2); + } + + // if a node was split we need to update the node indices and also the sibling indices + if(!mChangedLeaves.empty()) + { + if(node && node->isLeaf()) + { + for(PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + mMapping[node->getPrimitives(NULL)[j]] = node; + } + } + + for(PxU32 i = 0; i < mChangedLeaves.size(); i++) + { + IncrementalAABBTreeNode* changedNode = mChangedLeaves[i]; + PX_ASSERT(changedNode->isLeaf()); + + for(PxU32 j = 0; j < changedNode->getNbPrimitives(); j++) + { + mMapping[changedNode->getPrimitives(NULL)[j]] = changedNode; + } + } + } + else + { + mMapping[poolIndex] = node; + } +} + +void IncrementalAABBPruner::updateObjects(const PrunerHandle* handles, PxU32 count, float inflation, const PxU32* boundsIndices, const PxBounds3* newBounds, const PxTransform32* newTransforms) +{ + PX_PROFILE_ZONE("SceneQuery.prunerUpdateObjects", mContextID); + + if(!count) + return; + + if(handles && boundsIndices && newBounds) + mPool.updateAndInflateBounds(handles, boundsIndices, newBounds, newTransforms, count, inflation); + + if(!mAABBTree) + return; + + const PxBounds3* poolBounds = mPool.getCurrentWorldBoxes(); + for(PxU32 i=0; iupdate(mMapping[poolIndex], poolIndex, poolBounds, mChangedLeaves); + // we removed node during update, need to update the mapping + updateMapping(poolIndex, node); + } + +#if PARANOIA_CHECKS + test(); +#endif +} + +void IncrementalAABBPruner::removeObjects(const PrunerHandle* handles, PxU32 count, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_PROFILE_ZONE("SceneQuery.prunerRemoveObjects", mContextID); + + if(!count) + return; + + for(PxU32 i=0; iremove(mMapping[poolIndex], poolIndex, mPool.getCurrentWorldBoxes()); + // if node moved to its parent + if (node && node->isLeaf()) + { + for (PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + mMapping[index] = node; + } + } + mMapping[poolIndex] = mMapping[poolRelocatedLastIndex]; + // fix indices if we made a swap + if(poolRelocatedLastIndex != poolIndex) + mAABBTree->fixupTreeIndices(mMapping[poolIndex], poolRelocatedLastIndex, poolIndex); + + if(!mAABBTree->getNodes()) + { + release(); + } + } + } + +#if PARANOIA_CHECKS + test(); +#endif +} + +bool IncrementalAABBPruner::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& pcbArgName) const +{ + bool again = true; + + if(mAABBTree && mAABBTree->getNodes()) + { + OverlapCallbackAdapter pcb(pcbArgName, mPool); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + } + break; + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, test, pcb); + } + break; + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } + + return again; +} + +bool IncrementalAABBPruner::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + bool again = true; + + if(mAABBTree && mAABBTree->getNodes()) + { + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + RaycastCallbackAdapter pcb(pcbArgName, mPool); + again = AABBTreeRaycast()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, aabb.getCenter(), unitDir, inOutDistance, aabb.getExtents(), pcb); + } + + return again; +} + +bool IncrementalAABBPruner::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + bool again = true; + + if(mAABBTree && mAABBTree->getNodes()) + { + RaycastCallbackAdapter pcb(pcbArgName, mPool); + again = AABBTreeRaycast()(mPool.getCurrentAABBTreeBounds(), *mAABBTree, origin, unitDir, inOutDistance, PxVec3(0.0f), pcb); + } + + return again; +} + +// This isn't part of the pruner virtual interface, but it is part of the public interface +// of AABBPruner - it gets called by SqManager to force a rebuild, and requires a commit() before +// queries can take place + +void IncrementalAABBPruner::purge() +{ + release(); +} + +// Commit either performs a refit if background rebuild is not yet finished +// or swaps the current tree for the second tree rebuilt in the background +void IncrementalAABBPruner::commit() +{ + PX_PROFILE_ZONE("SceneQuery.prunerCommit", mContextID); + + if (!mAABBTree) + { + fullRebuildAABBTree(); + return; + } +} + +void IncrementalAABBPruner::fullRebuildAABBTree() +{ + // Don't bother building an AABB-tree if there isn't a single static object + const PxU32 nbObjects = mPool.getNbActiveObjects(); + if (!nbObjects) + return; + + const PxU32 indicesSize = PxNextPowerOfTwo(nbObjects); + if(indicesSize > mMapping.size()) + { + mMapping.resizeUninitialized(indicesSize); + } + + // copy the temp optimized tree into the new incremental tree + mAABBTree = PX_NEW(IncrementalAABBTree)(); + + mAABBTree->build(AABBTreeBuildParams(INCR_NB_OBJECTS_PER_NODE, nbObjects, &mPool.getCurrentAABBTreeBounds()), mMapping); + +#if PARANOIA_CHECKS + test(); +#endif +} + +void IncrementalAABBPruner::shiftOrigin(const PxVec3& shift) +{ + mPool.shiftOrigin(shift); + + if(mAABBTree) + mAABBTree->shiftOrigin(shift); +} + +void IncrementalAABBPruner::visualize(PxRenderOutput& out, PxU32 primaryColor, PxU32 /*secondaryColor*/) const +{ + // getAABBTree() asserts when pruner is dirty. NpScene::visualization() does not enforce flushUpdate. see DE7834 + visualizeTree(out, primaryColor, mAABBTree); + + // Render added objects not yet in the tree + //out << PxTransform(PxIdentity); + //out << PxU32(PxDebugColor::eARGB_WHITE); +} + +void IncrementalAABBPruner::release() // this can be called from purge() +{ + PX_DELETE(mAABBTree); +} + +void IncrementalAABBPruner::test() +{ + if(mAABBTree) + { + mAABBTree->hierarchyCheck(mPool.getNbActiveObjects(), mPool.getCurrentWorldBoxes()); + for(PxU32 i = 0; i < mPool.getNbActiveObjects(); i++) + { + mAABBTree->checkTreeLeaf(mMapping[i], i); + } + } +} + +void IncrementalAABBPruner::merge(const void* ) +{ + //const AABBPrunerMergeData& pruningStructure = *reinterpret_cast (mergeParams); + + //if(mAABBTree) + //{ + // // index in pruning pool, where new objects were added + // const PxU32 pruningPoolIndex = mPool.getNbActiveObjects() - pruningStructure.mNbObjects; + + // // create tree from given nodes and indices + // AABBTreeMergeData aabbTreeMergeParams(pruningStructure.mNbNodes, pruningStructure.mAABBTreeNodes, + // pruningStructure.mNbObjects, pruningStructure.mAABBTreeIndices, pruningPoolIndex); + + // if (!mIncrementalRebuild) + // { + // // merge tree directly + // mAABBTree->mergeTree(aabbTreeMergeParams); + // } + // else + // { + // mBucketPruner.addTree(aabbTreeMergeParams, mTimeStamp); + // } + //} +} + +void IncrementalAABBPruner::getGlobalBounds(PxBounds3& bounds) const +{ + if(mAABBTree && mAABBTree->getNodes()) + { + StoreBounds(bounds, mAABBTree->getNodes()->mBVMin, mAABBTree->getNodes()->mBVMax); + } + else + bounds.setEmpty(); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.h new file mode 100644 index 0000000..47e2bef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPruner.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INCREMENTAL_AABB_PRUNER_H +#define GU_INCREMENTAL_AABB_PRUNER_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuPruner.h" +#include "GuPruningPool.h" +#include "GuIncrementalAABBTree.h" +#include "GuSqInternal.h" + +namespace physx +{ + class PxRenderOutput; + +namespace Gu +{ + class IncrementalAABBPruner : public Pruner + { + public: + PX_PHYSX_COMMON_API IncrementalAABBPruner(PxU32 sceneLimit, PxU64 contextID); + virtual ~IncrementalAABBPruner(); + + // BasePruner + DECLARE_BASE_PRUNER_API + //~BasePruner + + // Pruner + DECLARE_PRUNER_API_COMMON + //~Pruner + + // direct access for test code + PX_FORCE_INLINE const IncrementalAABBTree* getAABBTree() const { return mAABBTree; } + + private: + void release(); + void fullRebuildAABBTree(); + void test(); + void updateMapping(const PoolIndex poolIndex, IncrementalAABBTreeNode* node); + + IncrementalAABBTree* mAABBTree; + + PruningPool mPool; // Pool of AABBs + + PxArray mMapping; + + PxU64 mContextID; + NodeList mChangedLeaves; + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp new file mode 100644 index 0000000..560a51b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.cpp @@ -0,0 +1,413 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CmVisualization.h" +#include "GuIncrementalAABBPrunerCore.h" +#include "GuSqInternal.h" +#include "GuIncrementalAABBTree.h" +#include "GuCallbackAdapter.h" +#include "GuAABBTree.h" +#include "GuAABBTreeQuery.h" +#include "GuSphere.h" +#include "GuBox.h" +#include "GuCapsule.h" +#include "GuQuery.h" + +using namespace physx; +using namespace Gu; + +#define PARANOIA_CHECKS 0 + +// PT: TODO: this is copied from SqBounds.h, should be either moved to Gu and shared or passed as a user parameter + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) + +IncrementalAABBPrunerCore::IncrementalAABBPrunerCore(const PruningPool* pool) : + mCurrentTree (1), + mLastTree (0), + mPool (pool) +{ + mAABBTree[0].mapping.reserve(256); + mAABBTree[1].mapping.reserve(256); + mChangedLeaves.reserve(32); +} + +IncrementalAABBPrunerCore::~IncrementalAABBPrunerCore() +{ + release(); +} + +void IncrementalAABBPrunerCore::release() // this can be called from purge() +{ + for(PxU32 i = 0; i < NUM_TREES; i++) + { + PX_DELETE(mAABBTree[i].tree); + mAABBTree[i].mapping.clear(); + mAABBTree[i].timeStamp = 0; + } + mCurrentTree = 1; + mLastTree = 0; +} + +bool IncrementalAABBPrunerCore::addObject(const PoolIndex poolIndex, PxU32 timeStamp) +{ + CoreTree& tree = mAABBTree[mCurrentTree]; + if(!tree.tree || !tree.tree->getNodes()) + { + if(!tree.tree) + tree.tree = PX_NEW(IncrementalAABBTree)(); + tree.timeStamp = timeStamp; + } + PX_ASSERT(tree.timeStamp == timeStamp); + + mChangedLeaves.clear(); + IncrementalAABBTreeNode* node = tree.tree->insert(poolIndex, mPool->getCurrentWorldBoxes(), mChangedLeaves); + updateMapping(tree.mapping, poolIndex, node); + +#if PARANOIA_CHECKS + test(); +#endif + + return true; +} + +void IncrementalAABBPrunerCore::updateMapping(IncrementalPrunerMap& mapping, const PoolIndex poolIndex, IncrementalAABBTreeNode* node) +{ + // if some node leaves changed, we need to update mapping + if(!mChangedLeaves.empty()) + { + if(node && node->isLeaf()) + { + for(PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + mapping[index] = node; + } + } + + for(PxU32 i = 0; i < mChangedLeaves.size(); i++) + { + IncrementalAABBTreeNode* changedNode = mChangedLeaves[i]; + PX_ASSERT(changedNode->isLeaf()); + + for(PxU32 j = 0; j < changedNode->getNbPrimitives(); j++) + { + const PoolIndex index = changedNode->getPrimitives(NULL)[j]; + mapping[index] = changedNode; + } + } + } + else + { + PX_ASSERT(node->isLeaf()); + mapping[poolIndex] = node; + } +} + +bool IncrementalAABBPrunerCore::removeObject(const PoolIndex poolIndex, const PoolIndex poolRelocatedLastIndex, PxU32& timeStamp) +{ + // erase the entry and get the data + IncrementalPrunerMap::Entry entry; + bool foundEntry = true; + const PxU32 treeIndex = mAABBTree[mLastTree].mapping.erase(poolIndex, entry) ? mLastTree : mCurrentTree; + // if it was not found in the last tree look at the current tree + if(treeIndex == mCurrentTree) + foundEntry = mAABBTree[mCurrentTree].mapping.erase(poolIndex, entry); + + // exit somethings is wrong here, entry was not found here + // PT: removed assert to avoid crashing all UTs +// PX_ASSERT(foundEntry); + if(!foundEntry) + return false; + + // tree must exist + PX_ASSERT(mAABBTree[treeIndex].tree); + CoreTree& tree = mAABBTree[treeIndex]; + timeStamp = tree.timeStamp; + + // remove the poolIndex from the tree, update the tree bounds immediatelly + IncrementalAABBTreeNode* node = tree.tree->remove(entry.second, poolIndex, mPool->getCurrentWorldBoxes()); + if(node && node->isLeaf()) + { + for(PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + tree.mapping[index] = node; + } + } + + // nothing to swap, last object, early exit + if(poolIndex == poolRelocatedLastIndex) + { +#if PARANOIA_CHECKS + test(); +#endif + return true; + } + + // fix the indices, we need to swap the index with last index + // erase the relocated index from the tree it is + IncrementalPrunerMap::Entry relocatedEntry; + const PxU32 treeRelocatedIndex = mAABBTree[mCurrentTree].mapping.erase(poolRelocatedLastIndex, relocatedEntry) ? mCurrentTree : mLastTree; + foundEntry = true; + if(treeRelocatedIndex == mLastTree) + foundEntry = mAABBTree[mLastTree].mapping.erase(poolRelocatedLastIndex, relocatedEntry); + + if(foundEntry) + { + CoreTree& relocatedTree = mAABBTree[treeRelocatedIndex]; + + // set the new mapping + relocatedTree.mapping[poolIndex] = relocatedEntry.second; + // update the tree indices - swap + relocatedTree.tree->fixupTreeIndices(relocatedEntry.second, poolRelocatedLastIndex, poolIndex); + } + +#if PARANOIA_CHECKS + test(); +#endif + return true; +} + +void IncrementalAABBPrunerCore::swapIndex(const PoolIndex poolIndex, const PoolIndex poolRelocatedLastIndex) +{ + // fix the indices, we need to swap the index with last index + // erase the relocated index from the tre it is + IncrementalPrunerMap::Entry relocatedEntry; + const PxU32 treeRelocatedIndex = mAABBTree[mCurrentTree].mapping.erase(poolRelocatedLastIndex, relocatedEntry) ? mCurrentTree : mLastTree; + bool foundEntry = true; + if(treeRelocatedIndex == mLastTree) + foundEntry = mAABBTree[mLastTree].mapping.erase(poolRelocatedLastIndex, relocatedEntry); + + // relocated index is not here + if(!foundEntry) + return; + + CoreTree& relocatedTree = mAABBTree[treeRelocatedIndex]; + + // set the new mapping + relocatedTree.mapping[poolIndex] = relocatedEntry.second; + // update the tree indices - swap + relocatedTree.tree->fixupTreeIndices(relocatedEntry.second, poolRelocatedLastIndex, poolIndex); +} + +bool IncrementalAABBPrunerCore::updateObject(const PoolIndex poolIndex) +{ + const IncrementalPrunerMap::Entry* entry = mAABBTree[mLastTree].mapping.find(poolIndex); + const PxU32 treeIndex = entry ? mLastTree : mCurrentTree; + if(!entry) + entry = mAABBTree[mCurrentTree].mapping.find(poolIndex); + + // we have not found it + PX_ASSERT(entry); + if(!entry) + return false; + + CoreTree& tree = mAABBTree[treeIndex]; + mChangedLeaves.clear(); + IncrementalAABBTreeNode* node = tree.tree->updateFast(entry->second, poolIndex, mPool->getCurrentWorldBoxes(), mChangedLeaves); + if(!mChangedLeaves.empty() || node != entry->second) + updateMapping(tree.mapping, poolIndex, node); + +#if PARANOIA_CHECKS + test(false); +#endif + + return true; +} + +PxU32 IncrementalAABBPrunerCore::removeMarkedObjects(PxU32 timeStamp) +{ + // early exit is no tree exists + if(!mAABBTree[mLastTree].tree || !mAABBTree[mLastTree].tree->getNodes()) + { + PX_ASSERT(mAABBTree[mLastTree].mapping.size() == 0); + PX_ASSERT(!mAABBTree[mCurrentTree].tree || mAABBTree[mCurrentTree].timeStamp != timeStamp); + return 0; + } + + PX_UNUSED(timeStamp); + PX_ASSERT(timeStamp == mAABBTree[mLastTree].timeStamp); + + // release the last tree + CoreTree& tree = mAABBTree[mLastTree]; + PxU32 nbObjects = tree.mapping.size(); + tree.mapping.clear(); + tree.timeStamp = 0; + + tree.tree->release(); + + return nbObjects; +} + +bool IncrementalAABBPrunerCore::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& pcbArgName) const +{ + bool again = true; + OverlapCallbackAdapter pcb(pcbArgName, *mPool); + + for(PxU32 i = 0; i < NUM_TREES; i++) + { + const CoreTree& tree = mAABBTree[i]; + if(tree.tree && tree.tree->getNodes() && again) + { + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool->getCurrentAABBTreeBounds(), *tree.tree, test, pcb); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool->getCurrentAABBTreeBounds(), *tree.tree, test, pcb); + } + } + break; + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + again = AABBTreeOverlap()(mPool->getCurrentAABBTreeBounds(), *tree.tree, test, pcb); + } + break; + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool->getCurrentAABBTreeBounds(), *tree.tree, test, pcb); + } + break; + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + again = AABBTreeOverlap()(mPool->getCurrentAABBTreeBounds(), *tree.tree, test, pcb); + } + break; + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } + } + + return again; +} + +bool IncrementalAABBPrunerCore::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + bool again = true; + RaycastCallbackAdapter pcb(pcbArgName, *mPool); + + for(PxU32 i = 0; i < NUM_TREES; i++) + { + const CoreTree& tree = mAABBTree[i]; + if(tree.tree && tree.tree->getNodes() && again) + { + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + again = AABBTreeRaycast()(mPool->getCurrentAABBTreeBounds(), *tree.tree, aabb.getCenter(), unitDir, inOutDistance, aabb.getExtents(), pcb); + } + } + + return again; +} + +bool IncrementalAABBPrunerCore::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& pcbArgName) const +{ + bool again = true; + RaycastCallbackAdapter pcb(pcbArgName, *mPool); + + for(PxU32 i = 0; i < NUM_TREES; i++) + { + const CoreTree& tree = mAABBTree[i]; + if(tree.tree && tree.tree->getNodes() && again) + { + again = AABBTreeRaycast()(mPool->getCurrentAABBTreeBounds(), *tree.tree, origin, unitDir, inOutDistance, PxVec3(0.0f), pcb); + } + } + return again; +} + +void IncrementalAABBPrunerCore::getGlobalBounds(PxBounds3& bounds) const +{ + bounds.setEmpty(); + + // PT: TODO: optimize this + for(PxU32 i=0; igetNodes()) + { + PxBounds3 tmp; + StoreBounds(tmp, tree.tree->getNodes()->mBVMin, tree.tree->getNodes()->mBVMax); + bounds.include(tmp); + } + } +} + +void IncrementalAABBPrunerCore::shiftOrigin(const PxVec3& shift) +{ + for(PxU32 i = 0; i < NUM_TREES; i++) + { + if(mAABBTree[i].tree) + { + mAABBTree[i].tree->shiftOrigin(shift); + } + } +} + +void IncrementalAABBPrunerCore::visualize(PxRenderOutput& out, PxU32 color) const +{ + for(PxU32 i = 0; i < NUM_TREES; i++) + { + visualizeTree(out, color, mAABBTree[i].tree); + + // Render added objects not yet in the tree + //out << PxTransform(PxIdentity); + //out << PxU32(PxDebugColor::eARGB_WHITE); + } +} + +void IncrementalAABBPrunerCore::test(bool hierarchyCheck) +{ + PxU32 maxDepth[NUM_TREES] = { 0, 0 }; + for(PxU32 i=0; ihierarchyCheck(mPool->getCurrentWorldBoxes()); + for(IncrementalPrunerMap::Iterator iter = mAABBTree[i].mapping.getIterator(); !iter.done(); ++iter) + { + mAABBTree[i].tree->checkTreeLeaf(iter->second, iter->first); + const PxU32 depth = mAABBTree[i].tree->getTreeLeafDepth(iter->second); + if(depth > maxDepth[i]) + maxDepth[i] = depth; + } + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.h new file mode 100644 index 0000000..e5d15c0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBPrunerCore.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INCREMENTAL_AABB_PRUNER_CORE_H +#define GU_INCREMENTAL_AABB_PRUNER_CORE_H + +#include "GuPruner.h" +#include "GuIncrementalAABBTree.h" +#include "GuPruningPool.h" +#include "GuAABBTreeUpdateMap.h" +#include "foundation/PxHashMap.h" + +namespace physx +{ + class PxRenderOutput; + +namespace Gu +{ + typedef PxHashMap IncrementalPrunerMap; + + struct CoreTree + { + PX_FORCE_INLINE CoreTree() : timeStamp(0), tree(NULL) {} + + PxU32 timeStamp; + IncrementalAABBTree* tree; + IncrementalPrunerMap mapping; + }; + + class IncrementalAABBPrunerCore : public PxUserAllocated + { + public: + IncrementalAABBPrunerCore(const PruningPool* pool); + ~IncrementalAABBPrunerCore(); + + void release(); + + bool addObject(const PoolIndex poolIndex, PxU32 timeStamp); + bool removeObject(const PoolIndex poolIndex, const PoolIndex poolRelocatedLastIndex, PxU32& timeStamp); + + // if we swap object from bucket pruner index with an index in the regular AABB pruner + void swapIndex(const PoolIndex poolIndex, const PoolIndex poolRelocatedLastIndex); + + bool updateObject(const PoolIndex poolIndex); + + PxU32 removeMarkedObjects(PxU32 timeStamp); + + bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback&) const; + bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback&) const; + void getGlobalBounds(PxBounds3&) const; + + void shiftOrigin(const PxVec3& shift); + + void visualize(PxRenderOutput& out, PxU32 color) const; + + PX_FORCE_INLINE void timeStampChange() + { + // swap current and last tree + mLastTree = (mLastTree + 1) % 2; + mCurrentTree = (mCurrentTree + 1) % 2; + } + + void build() {} + + PX_FORCE_INLINE PxU32 getNbObjects() const { return mAABBTree[0].mapping.size() + mAABBTree[1].mapping.size(); } + + private: + void updateMapping(IncrementalPrunerMap& mapping, const PoolIndex poolIndex, IncrementalAABBTreeNode* node); + void test(bool hierarchyCheck = true); + + private: + static const PxU32 NUM_TREES = 2; + + PxU32 mCurrentTree; + PxU32 mLastTree; + CoreTree mAABBTree[NUM_TREES]; + const PruningPool* mPool; // Pruning pool from AABB pruner + NodeList mChangedLeaves; + }; + +}} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp new file mode 100644 index 0000000..a134f95 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.cpp @@ -0,0 +1,1068 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxFPU.h" +#include "foundation/PxMathUtils.h" +#include "GuIncrementalAABBTree.h" +#include "GuAABBTreeBuildStats.h" +#include "GuAABBTreeNode.h" +#include "GuBVH.h" + +using namespace physx; +using namespace aos; +using namespace Gu; + +#define SUPPORT_TREE_ROTATION 1 +#define DEALLOCATE_RESET 0 + +IncrementalAABBTree::IncrementalAABBTree(): + mIndicesPool("AABBTreeIndicesPool", 256), + mNodesPool("AABBTreeNodesPool", 256 ), + mRoot(NULL) +{ +} + +IncrementalAABBTree::~IncrementalAABBTree() +{ + release(); +} + +void IncrementalAABBTree::release() +{ + if(mRoot) + { + releaseNode(mRoot); + mRoot = NULL; + } +} + +void IncrementalAABBTree::releaseNode(IncrementalAABBTreeNode* node) +{ + PX_ASSERT(node); + if(node->isLeaf()) + { + mIndicesPool.deallocate(node->mIndices); + } + else + { + releaseNode(node->mChilds[0]); + releaseNode(node->mChilds[1]); + } + if(!node->mParent) + { + mNodesPool.deallocate(reinterpret_cast(node)); + return; + } + if(node->mParent->mChilds[1] == node) + { + mNodesPool.deallocate(reinterpret_cast(node->mParent->mChilds[0])); + } +} + +// check if node is inside the given bounds +PX_FORCE_INLINE static bool nodeInsideBounds(const Vec4V& nodeMin, const Vec4V& nodeMax, const Vec4V& parentMin, const Vec4V& parentMax) +{ + return !(PxIntBool(V4AnyGrtr3(parentMin, nodeMin)) || PxIntBool(V4AnyGrtr3(nodeMax, parentMax))); +} + +// update the node parent hierarchy, when insert happen, we can early exit when the node is inside its parent +// no further update is needed +PX_FORCE_INLINE static void updateHierarchyAfterInsert(IncrementalAABBTreeNode* node) +{ + IncrementalAABBTreeNode* parent = node->mParent; + IncrementalAABBTreeNode* testNode = node; + while(parent) + { + // check if we can early exit + if(!nodeInsideBounds(testNode->mBVMin, testNode->mBVMax, parent->mBVMin, parent->mBVMax)) + { + parent->mBVMin = V4Min(parent->mChilds[0]->mBVMin, parent->mChilds[1]->mBVMin); + parent->mBVMax = V4Max(parent->mChilds[0]->mBVMax, parent->mChilds[1]->mBVMax); + } + else + break; + testNode = parent; + parent = parent->mParent; + } +} + +// add an index into the leaf indices list and update the node bounds +PX_FORCE_INLINE static void addPrimitiveIntoNode(IncrementalAABBTreeNode* node, const PoolIndex index, const Vec4V& minV, const Vec4V& maxV) +{ + PX_ASSERT(node->isLeaf()); + AABBTreeIndices& nodeIndices = *node->mIndices; + PX_ASSERT(nodeIndices.nbIndices < INCR_NB_OBJECTS_PER_NODE); + + // store the new handle + nodeIndices.indices[nodeIndices.nbIndices++] = index; + + // increase the node bounds + node->mBVMin = V4Min(node->mBVMin, minV); + node->mBVMax = V4Max(node->mBVMax, maxV); + + updateHierarchyAfterInsert(node); +} + +// check if node does intersect with given bounds +PX_FORCE_INLINE static bool nodeIntersection(IncrementalAABBTreeNode& node, const Vec4V& minV, const Vec4V& maxV) +{ + return !(PxIntBool(V4AnyGrtr3(node.mBVMin, maxV)) || PxIntBool(V4AnyGrtr3(minV, node.mBVMax))); +} + +// traversal strategy +PX_FORCE_INLINE static PxU32 traversalDirection(const IncrementalAABBTreeNode& child0, const IncrementalAABBTreeNode& child1, const Vec4V& testCenterV, + bool testRotation, bool& rotateNode, PxU32& largesRotateNode) +{ + // traverse in the direction of a node which is closer + // we compare the node and object centers + const Vec4V centerCh0V = V4Add(child0.mBVMax, child0.mBVMin); + const Vec4V centerCh1V = V4Add(child1.mBVMax, child1.mBVMin); + + const Vec4V ch0D = V4Sub(testCenterV, centerCh0V); + const Vec4V ch1D = V4Sub(testCenterV, centerCh1V); + + if(testRotation) + { + // if some volume is 3x larger than we do a rotation + const float volumeCompare = 3.0f; + + PX_ALIGN(16, PxVec4) sizeCh0; + PX_ALIGN(16, PxVec4) sizeCh1; + const Vec4V sizeCh0V = V4Sub(child0.mBVMax, child0.mBVMin); + const Vec4V sizeCh1V = V4Sub(child1.mBVMax, child1.mBVMin); + V4StoreA(sizeCh0V, &sizeCh0.x); + V4StoreA(sizeCh1V, &sizeCh1.x); + + const float volumeCh0 = sizeCh0.x*sizeCh0.y*sizeCh0.z; + const float volumeCh1 = sizeCh1.x*sizeCh1.y*sizeCh1.z; + + if((volumeCh0*volumeCompare < volumeCh1) || (volumeCh1*volumeCompare < volumeCh0)) + { + largesRotateNode = (volumeCh0 > volumeCh1) ? 0u : 1u; + rotateNode = true; + } + } + + const BoolV con = FIsGrtr(V4Dot3(ch0D, ch0D), V4Dot3(ch1D, ch1D)); + return (BAllEqTTTT(con) == 1) ? PxU32(1) : PxU32(0); +} + +// remove an index from the leaf +PX_FORCE_INLINE static void removePrimitiveFromNode(IncrementalAABBTreeNode* node, const PoolIndex index) +{ + AABBTreeIndices& indices = *node->mIndices; + PX_ASSERT(indices.nbIndices > 1); + + for (PxU32 i = indices.nbIndices; i--; ) + { + if(node->mIndices->indices[i] == index) + { + node->mIndices->indices[i] = node->mIndices->indices[--indices.nbIndices]; + return; + } + } + // if handle was not found something is wrong here + PX_ASSERT(0); +} + +// check if bounds are equal with given node min/max +PX_FORCE_INLINE static bool boundsEqual(const Vec4V& testMin, const Vec4V& testMax, const Vec4V& nodeMin, const Vec4V& nodeMax) +{ + return (PxIntBool(V4AllEq(nodeMin, testMin)) && PxIntBool(V4AllEq(testMax, nodeMax))); +} + +// update the node hierarchy bounds when remove happen, we can early exit if the bounds are equal and no bounds update +// did happen +PX_FORCE_INLINE static void updateHierarchyAfterRemove(IncrementalAABBTreeNode* node, const PxBounds3* bounds) +{ + if(node->isLeaf()) + { + const AABBTreeIndices& indices = *node->mIndices; + PX_ASSERT(indices.nbIndices > 0); + + Vec4V bvMin = V4LoadU(&bounds[indices.indices[0]].minimum.x); + Vec4V bvMax = V4LoadU(&bounds[indices.indices[0]].maximum.x); + for(PxU32 i = 1; i < indices.nbIndices; i++) + { + const Vec4V minV = V4LoadU(&bounds[indices.indices[i]].minimum.x); + const Vec4V maxV = V4LoadU(&bounds[indices.indices[i]].maximum.x); + + bvMin = V4Min(bvMin, minV); + bvMax = V4Max(bvMax, maxV); + } + + node->mBVMin = V4ClearW(bvMin); + node->mBVMax = V4ClearW(bvMax); + } + else + { + node->mBVMin = V4Min(node->mChilds[0]->mBVMin, node->mChilds[1]->mBVMin); + node->mBVMax = V4Max(node->mChilds[0]->mBVMax, node->mChilds[1]->mBVMax); + } + + IncrementalAABBTreeNode* parent = node->mParent; + while(parent) + { + const Vec4V newMinV = V4Min(parent->mChilds[0]->mBVMin, parent->mChilds[1]->mBVMin); + const Vec4V newMaxV = V4Max(parent->mChilds[0]->mBVMax, parent->mChilds[1]->mBVMax); + + const bool earlyExit = boundsEqual(newMinV, newMaxV, parent->mBVMin, parent->mBVMax); + if(earlyExit) + break; + + parent->mBVMin = newMinV; + parent->mBVMax = newMaxV; + + parent = parent->mParent; + } +} + +// split the leaf node along the most significant axis +IncrementalAABBTreeNode* IncrementalAABBTree::splitLeafNode(IncrementalAABBTreeNode* node, const PoolIndex index, const Vec4V& minV, const Vec4V& maxV, const PxBounds3* bounds) +{ + PX_ASSERT(node->isLeaf()); + + IncrementalAABBTreeNode* returnNode = NULL; + + // create new pairs of nodes, parent will remain the node (the one we split) + IncrementalAABBTreeNode* child0 = reinterpret_cast(mNodesPool.allocate()); + IncrementalAABBTreeNode* child1 = child0 + 1; + AABBTreeIndices* newIndices = mIndicesPool.allocate(); + + // get the split axis + PX_ALIGN(16, PxVec4) vars; + PX_ALIGN(16, PxVec4) center; + const float half = 0.5f; + const FloatV halfV = FLoad(half); + const Vec4V newMinV = V4Min(node->mBVMin, minV); + const Vec4V newMaxV = V4Max(node->mBVMax, maxV); + const Vec4V centerV = V4Scale(V4Add(newMaxV, newMinV), halfV); + const Vec4V varsV = V4Sub(newMaxV, newMinV); + V4StoreA(varsV, &vars.x); + V4StoreA(centerV, ¢er.x); + const PxU32 axis = PxLargestAxis(PxVec3(vars.x, vars.y, vars.z)); + + // setup parent + child0->mParent = node; + child1->mParent = node; + child0->mIndices = node->mIndices; + child0->mChilds[1] = NULL; + child1->mIndices = newIndices; + child1->mChilds[1] = NULL; + + AABBTreeIndices& child0Indices = *child0->mIndices; // the original node indices + AABBTreeIndices& child1Indices = *child1->mIndices; // new empty indices + child1Indices.nbIndices = 0; + + // split the node + for(PxU32 i = child0Indices.nbIndices; i--;) + { + const PxBounds3& primitiveBounds = bounds[child0Indices.indices[i]]; + const float pCenter = primitiveBounds.getCenter(axis); + if(center[axis] >= pCenter) + { + // move to new node + child1Indices.indices[child1Indices.nbIndices++] = child0Indices.indices[i]; + child0Indices.nbIndices--; + child0Indices.indices[i] = child0Indices.indices[child0Indices.nbIndices]; + } + } + + // check where to put the new node, if there is still a free space + if(child0Indices.nbIndices == 0 || child1Indices.nbIndices == INCR_NB_OBJECTS_PER_NODE) + { + child0Indices.nbIndices = 1; + child0Indices.indices[0] = index; + returnNode = child0; + } + else + { + if(child0Indices.nbIndices == INCR_NB_OBJECTS_PER_NODE) + { + child1Indices.nbIndices = 1; + child1Indices.indices[0] = index; + returnNode = child1; + } + else + { + const PxBounds3& primitiveBounds = bounds[index]; + const float pCenter = primitiveBounds.getCenter(axis); + if(center[axis] >= pCenter) + { + // move to new node + child1Indices.indices[child1Indices.nbIndices++] = index; + returnNode = child1; + } + else + { + // move to old node + child0Indices.indices[child0Indices.nbIndices++] = index; + returnNode = child0; + } + } + } + + // update bounds for the new nodes + Vec4V bvMin = V4LoadU(&bounds[child0Indices.indices[0]].minimum.x); + Vec4V bvMax = V4LoadU(&bounds[child0Indices.indices[0]].maximum.x); + for(PxU32 i = 1; i < child0Indices.nbIndices; i++) + { + const Vec4V nodeMinV = V4LoadU(&bounds[child0Indices.indices[i]].minimum.x); + const Vec4V nodeMaxV = V4LoadU(&bounds[child0Indices.indices[i]].maximum.x); + + bvMin = V4Min(bvMin, nodeMinV); + bvMax = V4Max(bvMax, nodeMaxV); + } + child0->mBVMin = V4ClearW(bvMin); + child0->mBVMax = V4ClearW(bvMax); + + bvMin = V4LoadU(&bounds[child1Indices.indices[0]].minimum.x); + bvMax = V4LoadU(&bounds[child1Indices.indices[0]].maximum.x); + for(PxU32 i = 1; i < child1Indices.nbIndices; i++) + { + const Vec4V nodeMinV = V4LoadU(&bounds[child1Indices.indices[i]].minimum.x); + const Vec4V nodeMaxV = V4LoadU(&bounds[child1Indices.indices[i]].maximum.x); + + bvMin = V4Min(bvMin, nodeMinV); + bvMax = V4Max(bvMax, nodeMaxV); + } + child1->mBVMin = V4ClearW(bvMin); + child1->mBVMax = V4ClearW(bvMax); + + // node parent is the same, setup the new childs + node->mChilds[0] = child0; + node->mChilds[1] = child1; + node->mBVMin = newMinV; + node->mBVMax = newMaxV; + + updateHierarchyAfterInsert(node); + + PX_ASSERT(returnNode); + return returnNode; +} + +void IncrementalAABBTree::rotateTree(IncrementalAABBTreeNode* node, NodeList& changedLeaf, PxU32 largesRotateNodeIn, const PxBounds3* bounds, bool rotateAgain) +{ + PX_ASSERT(!node->isLeaf()); + + IncrementalAABBTreeNode* smallerNode = node->mChilds[(largesRotateNodeIn == 0) ? 1 : 0]; + IncrementalAABBTreeNode* largerNode = node->mChilds[largesRotateNodeIn]; + PX_ASSERT(!largerNode->isLeaf()); + + // take a leaf from larger node and add it to the smaller node + const Vec4V testCenterV = V4Add(smallerNode->mBVMax, smallerNode->mBVMin); + IncrementalAABBTreeNode* rotationNode = NULL; // store a node that seems not balanced + PxU32 largesRotateNode = 0; + bool rotateNode = false; + PxU32 traversalIndex = traversalDirection(*largerNode->mChilds[0], *largerNode->mChilds[1], testCenterV, false, rotateNode, largesRotateNode); + IncrementalAABBTreeNode* closestNode = largerNode->mChilds[traversalIndex]; + while(!closestNode->isLeaf()) + { + PxPrefetchLine(closestNode->mChilds[0]->mChilds[0]); + PxPrefetchLine(closestNode->mChilds[1]->mChilds[0]); + + traversalIndex = traversalDirection(*closestNode->mChilds[0], *closestNode->mChilds[1], testCenterV, false, rotateNode, largesRotateNode); + closestNode = closestNode->mChilds[traversalIndex]; + } + + // we have the leaf that we want to rotate + // create new parent and remove the current leaf + changedLeaf.findAndReplaceWithLast(closestNode); + IncrementalAABBTreeNode* parent = closestNode->mParent; + IncrementalAABBTreeNodePair* removedPair = reinterpret_cast(parent->mChilds[0]); + PX_ASSERT(!parent->isLeaf()); + + // copy the remaining child into parent + IncrementalAABBTreeNode* remainingChild = (parent->mChilds[0] == closestNode) ? parent->mChilds[1] : parent->mChilds[0]; + parent->mBVMax = remainingChild->mBVMax; + parent->mBVMin = remainingChild->mBVMin; + if(remainingChild->isLeaf()) + { + parent->mIndices = remainingChild->mIndices; + parent->mChilds[1] = NULL; + changedLeaf.findAndReplaceWithLast(remainingChild); + changedLeaf.pushBack(parent); + } + else + { + parent->mChilds[0] = remainingChild->mChilds[0]; + parent->mChilds[0]->mParent = parent; + parent->mChilds[1] = remainingChild->mChilds[1]; + parent->mChilds[1]->mParent = parent; + } + + // update the hieararchy after the node removal + if(parent->mParent) + { + updateHierarchyAfterRemove(parent->mParent, bounds); + } + + // find new spot for the node + // take a leaf from larger node and add it to the smaller node + IncrementalAABBTreeNode* newSpotNode = NULL; + if(smallerNode->isLeaf()) + { + newSpotNode = smallerNode; + } + else + { + const Vec4V testClosestNodeCenterV = V4Add(closestNode->mBVMax, closestNode->mBVMin); + rotationNode = NULL; // store a node that seems not balanced + largesRotateNode = 0; + rotateNode = false; + bool testRotation = rotateAgain; + traversalIndex = traversalDirection(*smallerNode->mChilds[0], *smallerNode->mChilds[1], testClosestNodeCenterV, testRotation, rotateNode, largesRotateNode); + if(rotateNode && !smallerNode->mChilds[largesRotateNode]->isLeaf()) + { + rotationNode = smallerNode; + testRotation = false; + } + newSpotNode = smallerNode->mChilds[traversalIndex]; + while(!newSpotNode->isLeaf()) + { + PxPrefetchLine(newSpotNode->mChilds[0]->mChilds[0]); + PxPrefetchLine(newSpotNode->mChilds[1]->mChilds[0]); + + traversalIndex = traversalDirection(*newSpotNode->mChilds[0], *newSpotNode->mChilds[1], testClosestNodeCenterV, testRotation, rotateNode, largesRotateNode); + if(!rotationNode && rotateNode && !newSpotNode->mChilds[largesRotateNode]->isLeaf()) + { + rotationNode = newSpotNode; + testRotation = false; + } + newSpotNode = newSpotNode->mChilds[traversalIndex]; + } + } + + // we have the closest leaf in the smaller child, lets merge it with the closestNode + if(newSpotNode->getNbPrimitives() + closestNode->getNbPrimitives() <= INCR_NB_OBJECTS_PER_NODE) + { + // all primitives fit into new spot, we merge here simply + AABBTreeIndices* targetIndices = newSpotNode->mIndices; + const AABBTreeIndices* sourceIndices = closestNode->mIndices; + for(PxU32 i = 0; i < sourceIndices->nbIndices; i++) + { + targetIndices->indices[targetIndices->nbIndices++] = sourceIndices->indices[i]; + } + PX_ASSERT(targetIndices->nbIndices <= INCR_NB_OBJECTS_PER_NODE); + if(changedLeaf.find(newSpotNode) == changedLeaf.end()) + changedLeaf.pushBack(newSpotNode); + mIndicesPool.deallocate(closestNode->mIndices); + + newSpotNode->mBVMin = V4Min(newSpotNode->mBVMin, closestNode->mBVMin); + newSpotNode->mBVMax = V4Max(newSpotNode->mBVMax, closestNode->mBVMax); + updateHierarchyAfterInsert(newSpotNode); + } + else + { + // we need to make new parent with newSpotNode and closestNode as childs + // create new pairs of nodes, parent will remain the node (the one we split) + IncrementalAABBTreeNode* child0 = reinterpret_cast(mNodesPool.allocate()); + IncrementalAABBTreeNode* child1 = child0 + 1; + + // setup parent + child0->mParent = newSpotNode; + child1->mParent = newSpotNode; + child0->mIndices = newSpotNode->mIndices; + child0->mChilds[1] = NULL; + child0->mBVMin = newSpotNode->mBVMin; + child0->mBVMax = newSpotNode->mBVMax; + child1->mIndices = closestNode->mIndices; + child1->mChilds[1] = NULL; + child1->mBVMin = closestNode->mBVMin; + child1->mBVMax = closestNode->mBVMax; + + // node parent is the same, setup the new childs + newSpotNode->mChilds[0] = child0; + newSpotNode->mChilds[1] = child1; + + newSpotNode->mBVMin = V4Min(child0->mBVMin, child1->mBVMin); + newSpotNode->mBVMax = V4Max(child0->mBVMax, child1->mBVMax); + + updateHierarchyAfterInsert(newSpotNode); + + changedLeaf.findAndReplaceWithLast(newSpotNode); + changedLeaf.pushBack(child0); + changedLeaf.pushBack(child1); + } + + // deallocate the closestNode, it has been moved +#if DEALLOCATE_RESET + removedPair->mNode0.mChilds[0] = NULL; + removedPair->mNode0.mChilds[1] = NULL; + + removedPair->mNode1.mChilds[0] = NULL; + removedPair->mNode1.mChilds[1] = NULL; +#endif + mNodesPool.deallocate(removedPair); + + // try to do one more rotation for the newly added node part of tree + if(rotationNode) + { + rotateTree(rotationNode, changedLeaf, largesRotateNode, bounds, false); + } +} + +// insert new bounds into tree +IncrementalAABBTreeNode* IncrementalAABBTree::insert(const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf) +{ + PX_SIMD_GUARD; + + // get the bounds, reset the W value + const Vec4V minV = V4ClearW(V4LoadU(&bounds[index].minimum.x)); + const Vec4V maxV = V4ClearW(V4LoadU(&bounds[index].maximum.x)); + + // check if tree is empty + if(!mRoot) + { + // make it a leaf + AABBTreeIndices* indices = mIndicesPool.construct(index); + mRoot = reinterpret_cast (mNodesPool.allocate()); + mRoot->mBVMin = minV; + mRoot->mBVMax = maxV; + mRoot->mIndices = indices; + mRoot->mChilds[1] = NULL; + mRoot->mParent = NULL; + + return mRoot; + } + else + { + // check if root is a leaf + if(mRoot->isLeaf()) + { + // if we still can insert the primitive into the leaf, or we need to split + if(mRoot->getNbPrimitives() < INCR_NB_OBJECTS_PER_NODE) + { + // simply add the primitive into the current leaf + addPrimitiveIntoNode(mRoot, index, minV, maxV); + return mRoot; + } + else + { + // need to split the node + // check if the leaf is not marked as changed, we need to remove it + if(!changedLeaf.empty()) + { + PX_ASSERT(changedLeaf.size() == 1); + if(changedLeaf[0] == mRoot) + changedLeaf.popBack(); + } + IncrementalAABBTreeNode* retNode = splitLeafNode(mRoot, index, minV, maxV, bounds); + mRoot = retNode->mParent; + IncrementalAABBTreeNode* sibling = (mRoot->mChilds[0] == retNode) ? mRoot->mChilds[1] : mRoot->mChilds[0]; + if(sibling->isLeaf()) + changedLeaf.pushBack(sibling); + changedLeaf.pushBack(retNode); + return retNode; + } + } + else + { + const Vec4V testCenterV = V4Add(maxV, minV); + IncrementalAABBTreeNode* returnNode = NULL; + IncrementalAABBTreeNode* rotationNode = NULL; // store a node that seems not balanced + PxU32 largesRotateNode = 0; + bool rotateNode = false; +#if SUPPORT_TREE_ROTATION + bool testRotation = true; +#else + bool testRotation = false; +#endif + // we dont need to modify root, lets traverse the tree to find the right spot + PxU32 traversalIndex = traversalDirection(*mRoot->mChilds[0], *mRoot->mChilds[1], testCenterV, testRotation, rotateNode, largesRotateNode); + if(rotateNode && !mRoot->mChilds[largesRotateNode]->isLeaf()) + { + rotationNode = mRoot; + testRotation = false; + } + IncrementalAABBTreeNode* baseNode = mRoot->mChilds[traversalIndex]; + while(!baseNode->isLeaf()) + { + PxPrefetchLine(baseNode->mChilds[0]->mChilds[0]); + PxPrefetchLine(baseNode->mChilds[1]->mChilds[0]); + + traversalIndex = traversalDirection(*baseNode->mChilds[0], *baseNode->mChilds[1], testCenterV, testRotation, rotateNode, largesRotateNode); + if(!rotationNode && rotateNode && !baseNode->mChilds[largesRotateNode]->isLeaf()) + { + rotationNode = baseNode; + testRotation = false; + } + baseNode = baseNode->mChilds[traversalIndex]; + } + + // if we still can insert the primitive into the leaf, or we need to split + if(baseNode->getNbPrimitives() < INCR_NB_OBJECTS_PER_NODE) + { + // simply add the primitive into the current leaf + addPrimitiveIntoNode(baseNode, index, minV, maxV); + returnNode = baseNode; + if(!changedLeaf.empty()) + { + PX_ASSERT(changedLeaf.size() == 1); + if(changedLeaf[0] != baseNode) + changedLeaf.pushBack(baseNode); + } + else + changedLeaf.pushBack(baseNode); + } + else + { + // split + // check if the leaf is not marked as changed, we need to remove it + if(!changedLeaf.empty()) + { + PX_ASSERT(changedLeaf.size() == 1); + if(changedLeaf[0] == baseNode) + changedLeaf.popBack(); + } + IncrementalAABBTreeNode* retNode = splitLeafNode(baseNode, index, minV, maxV, bounds); + const IncrementalAABBTreeNode* splitParent = retNode->mParent; + changedLeaf.pushBack(splitParent->mChilds[0]); + changedLeaf.pushBack(splitParent->mChilds[1]); + + returnNode = retNode; + } + + if(rotationNode) + { + rotateTree(rotationNode, changedLeaf, largesRotateNode, bounds, true); + returnNode = NULL; + } + + return returnNode; + } + } +} + +// update the index, do a full remove/insert update +IncrementalAABBTreeNode* IncrementalAABBTree::update(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf) +{ + PX_SIMD_GUARD; + + IncrementalAABBTreeNode* removedNode = remove(node, index, bounds); + if(removedNode && removedNode->isLeaf()) + { + changedLeaf.pushBack(removedNode); + } + return insert(index, bounds, changedLeaf); +} + +// update the index, faster version with a lazy update of objects that moved just a bit +IncrementalAABBTreeNode* IncrementalAABBTree::updateFast(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf) +{ + PX_SIMD_GUARD; + + const Vec4V minV = V4ClearW(V4LoadU(&bounds[index].minimum.x)); + const Vec4V maxV = V4ClearW(V4LoadU(&bounds[index].maximum.x)); + + // for update fast, we dont care if the tree gets slowly unbalanced, we are building a new tree already + if(nodeIntersection(*node, minV, maxV)) + { + updateHierarchyAfterRemove(node, bounds); + return node; + } + else + { + IncrementalAABBTreeNode* removedNode = remove(node, index, bounds); + if(removedNode && removedNode->isLeaf()) + { + changedLeaf.pushBack(removedNode); + } + return insert(index, bounds, changedLeaf); + } +} + +// remove primitive from the tree, return a node if it moved to its parent +IncrementalAABBTreeNode* IncrementalAABBTree::remove(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds) +{ + PX_SIMD_GUARD; + PX_ASSERT(node->isLeaf()); + // if we just remove the primitive from the list + if(node->getNbPrimitives() > 1) + { + removePrimitiveFromNode(node, index); + + // update the hierarchy + updateHierarchyAfterRemove(node, bounds); + return NULL; + } + else + { + // if root node and the last primitive remove root + if(node == mRoot) + { +#if DEALLOCATE_RESET + IncrementalAABBTreeNodePair* removedPair = reinterpret_cast(node); + removedPair->mNode0.mChilds[0] = NULL; + removedPair->mNode0.mChilds[1] = NULL; + + removedPair->mNode1.mChilds[0] = NULL; + removedPair->mNode1.mChilds[1] = NULL; +#endif + mNodesPool.deallocate(reinterpret_cast(node)); + mRoot = NULL; + return NULL; + } + else + { + // create new parent and remove the current leaf + IncrementalAABBTreeNode* parent = node->mParent; + IncrementalAABBTreeNodePair* removedPair = reinterpret_cast(parent->mChilds[0]); + PX_ASSERT(!parent->isLeaf()); + + // copy the remaining child into parent + IncrementalAABBTreeNode* remainingChild = (parent->mChilds[0] == node) ? parent->mChilds[1] : parent->mChilds[0]; + parent->mBVMax = remainingChild->mBVMax; + parent->mBVMin = remainingChild->mBVMin; + if(remainingChild->isLeaf()) + { + parent->mIndices = remainingChild->mIndices; + parent->mChilds[1] = NULL; + } + else + { + parent->mChilds[0] = remainingChild->mChilds[0]; + parent->mChilds[0]->mParent = parent; + parent->mChilds[1] = remainingChild->mChilds[1]; + parent->mChilds[1]->mParent = parent; + } + + if(parent->mParent) + { + updateHierarchyAfterRemove(parent->mParent, bounds); + } + + mIndicesPool.deallocate(node->mIndices); +#if DEALLOCATE_RESET + removedPair->mNode0.mChilds[0] = NULL; + removedPair->mNode0.mChilds[1] = NULL; + + removedPair->mNode1.mChilds[0] = NULL; + removedPair->mNode1.mChilds[1] = NULL; +#endif + mNodesPool.deallocate(removedPair); + return parent; + } + } +} + +// fixup the indices +void IncrementalAABBTree::fixupTreeIndices(IncrementalAABBTreeNode* node, const PoolIndex index, const PoolIndex newIndex) +{ + PX_ASSERT(node->isLeaf()); + + AABBTreeIndices& indices = *node->mIndices; + for(PxU32 i = 0; i < indices.nbIndices; i++) + { + if(indices.indices[i] == index) + { + indices.indices[i] = newIndex; + return; + } + } + PX_ASSERT(0); +} + +// shift node +static void shiftNode(IncrementalAABBTreeNode* node, const Vec4V& shiftV) +{ + node->mBVMax = V4Sub(node->mBVMax, shiftV); + node->mBVMin = V4Sub(node->mBVMin, shiftV); + + if(!node->isLeaf()) + { + shiftNode(node->mChilds[0], shiftV); + shiftNode(node->mChilds[1], shiftV); + } +} + +// shift origin +void IncrementalAABBTree::shiftOrigin(const PxVec3& shift) +{ + if(mRoot) + { + const Vec4V shiftV = V4ClearW(V4LoadU(&shift.x)); + + shiftNode(mRoot, shiftV); + } +} + +static void checkNode(IncrementalAABBTreeNode* node, IncrementalAABBTreeNode* parent, const PxBounds3* bounds, PoolIndex maxIndex, PxU32& numIndices, PxU32& numNodes) +{ + PX_ASSERT(node->mParent == parent); + PX_ASSERT(!parent->isLeaf()); + PX_ASSERT(parent->mChilds[0] == node || parent->mChilds[1] == node); + + numNodes++; + if(!node->isLeaf()) + { + PX_ASSERT(nodeInsideBounds(node->mChilds[0]->mBVMin, node->mChilds[0]->mBVMax, node->mBVMin, node->mBVMax)); + PX_ASSERT(nodeInsideBounds(node->mChilds[1]->mBVMin, node->mChilds[1]->mBVMax, node->mBVMin, node->mBVMax)); + + const Vec4V testMinV = V4Min(parent->mChilds[0]->mBVMin, parent->mChilds[1]->mBVMin); + const Vec4V testMaxV = V4Max(parent->mChilds[0]->mBVMax, parent->mChilds[1]->mBVMax); + + PX_UNUSED(testMinV); + PX_UNUSED(testMaxV); + PX_ASSERT(nodeInsideBounds(node->mBVMin, node->mBVMax, testMinV, testMaxV)); + + checkNode(node->mChilds[0], node, bounds, maxIndex, numIndices, numNodes); + checkNode(node->mChilds[1], node, bounds, maxIndex, numIndices, numNodes); + } + else + { + const AABBTreeIndices& indices = *node->mIndices; + PX_ASSERT(indices.nbIndices); + Vec4V testMinV = V4ClearW(V4LoadU(&bounds[indices.indices[0]].minimum.x)); + Vec4V testMaxV = V4ClearW(V4LoadU(&bounds[indices.indices[0]].maximum.x)); + for(PxU32 i = 0; i < indices.nbIndices; i++) + { + PX_ASSERT(indices.indices[i] < maxIndex); + numIndices++; + + const Vec4V minV = V4ClearW(V4LoadU(&bounds[indices.indices[i]].minimum.x)); + const Vec4V maxV = V4ClearW(V4LoadU(&bounds[indices.indices[i]].maximum.x)); + + testMinV = V4Min(testMinV, minV); + testMaxV = V4Max(testMaxV, maxV); + + PX_ASSERT(nodeInsideBounds(minV, maxV, node->mBVMin, node->mBVMax)); + } + + PX_ASSERT(boundsEqual(testMinV, testMaxV, node->mBVMin, node->mBVMax)); + } +} + +void IncrementalAABBTree::hierarchyCheck(PoolIndex maxIndex, const PxBounds3* bounds) +{ + PxU32 numHandles = 0; + PxU32 numPosNodes = 0; + PxU32 numNegNodes = 0; + if(mRoot && !mRoot->isLeaf()) + { + checkNode(mRoot->mChilds[0], mRoot, bounds, maxIndex, numHandles, numPosNodes); + checkNode(mRoot->mChilds[1], mRoot, bounds, maxIndex, numHandles, numNegNodes); + + PX_ASSERT(numHandles == maxIndex); + } +} + +void IncrementalAABBTree::hierarchyCheck(const PxBounds3* bounds) +{ + PxU32 numHandles = 0; + PxU32 numPosNodes = 0; + PxU32 numNegNodes = 0; + if(mRoot && !mRoot->isLeaf()) + { + checkNode(mRoot->mChilds[0], mRoot, bounds, 0xFFFFFFFF, numHandles, numPosNodes); + checkNode(mRoot->mChilds[1], mRoot, bounds, 0xFFFFFFFF, numHandles, numNegNodes); + } +} + +void IncrementalAABBTree::checkTreeLeaf(IncrementalAABBTreeNode* leaf, PoolIndex h) +{ + PX_ASSERT(leaf->isLeaf()); + + const AABBTreeIndices& indices = *leaf->mIndices; + bool found = false; + for(PxU32 i = 0; i < indices.nbIndices; i++) + { + if(indices.indices[i] == h) + { + found = true; + break; + } + } + PX_UNUSED(found); + PX_ASSERT(found); +} + +PxU32 IncrementalAABBTree::getTreeLeafDepth(IncrementalAABBTreeNode* leaf) +{ + PxU32 depth = 1; + IncrementalAABBTreeNode* parent = leaf->mParent; + while(parent) + { + depth++; + parent = parent->mParent; + } + return depth; +} + +// build the tree from given bounds +bool IncrementalAABBTree::build(const AABBTreeBuildParams& params, PxArray& mapping) +{ + // Init stats + BuildStats stats; + const PxU32 nbPrimitives = params.mNbPrimitives; + if (!nbPrimitives) + return false; + + PxU32* indices = buildAABBTree(params, mNodeAllocator, stats); + PX_ASSERT(indices); + + PX_FREE(params.mCache); + + IncrementalAABBTreeNode** treeNodes = PX_ALLOCATE(IncrementalAABBTreeNode*, stats.getCount(), "temp node helper array"); + PxMemSet(treeNodes, 0, sizeof(IncrementalAABBTreeNode*)*(stats.getCount())); + + clone(mapping, indices, treeNodes); + mRoot = treeNodes[0]; + mRoot->mParent = NULL; + + PX_FREE(indices); + PX_FREE(treeNodes); + + mNodeAllocator.release(); + return true; +} + +// clone the tree, the tree is computed in the NodeAllocator, similar to AABBTree flatten +void IncrementalAABBTree::clone(PxArray& mapping, const PxU32* _indices, IncrementalAABBTreeNode** treeNodes) +{ + PxU32 offset = 0; + const PxU32 nbSlabs = mNodeAllocator.mSlabs.size(); + for (PxU32 s = 0; s(mNodesPool.allocate()); + treeNodes[offset] = destNode; + } + + destNode->mBVMin = V4ClearW(V4LoadU(&pool[i].mBV.minimum.x)); + destNode->mBVMax = V4ClearW(V4LoadU(&pool[i].mBV.maximum.x)); + + if (pool[i].isLeaf()) + { + AABBTreeIndices* indices = mIndicesPool.allocate(); + destNode->mIndices = indices; + destNode->mChilds[1] = NULL; + indices->nbIndices = pool[i].getNbPrimitives(); + PX_ASSERT(indices->nbIndices <= 16); + const PxU32* sourceIndices = _indices + pool[i].mNodeIndex; + for (PxU32 iIndices = 0; iIndices < indices->nbIndices; iIndices++) + { + const PxU32 sourceIndex = sourceIndices[iIndices]; + indices->indices[iIndices] = sourceIndex; + PX_ASSERT(sourceIndex < mapping.size()); + mapping[sourceIndex] = destNode; + } + } + else + { + PX_ASSERT(pool[i].mPos); + PxU32 localNodeIndex = 0xffffffff; + PxU32 nodeBase = 0; + for (PxU32 j = 0; j= mNodeAllocator.mSlabs[j].mPool && pool[i].mPos < mNodeAllocator.mSlabs[j].mPool + mNodeAllocator.mSlabs[j].mNbUsedNodes) + { + localNodeIndex = PxU32(pool[i].mPos - mNodeAllocator.mSlabs[j].mPool); + break; + } + nodeBase += mNodeAllocator.mSlabs[j].mNbUsedNodes; + } + const PxU32 nodeIndex = nodeBase + localNodeIndex; + + IncrementalAABBTreeNode* child0 = treeNodes[nodeIndex]; + IncrementalAABBTreeNode* child1 = treeNodes[nodeIndex + 1]; + if(!child0) + { + PX_ASSERT(!child1); + child0 = reinterpret_cast(mNodesPool.allocate()); + child1 = child0 + 1; + treeNodes[nodeIndex] = child0; + treeNodes[nodeIndex + 1] = child1; + } + + destNode->mChilds[0] = child0; + destNode->mChilds[1] = child1; + child0->mParent = destNode; + child1->mParent = destNode; + } + offset++; + } + } +} + +void IncrementalAABBTree::copyNode(IncrementalAABBTreeNode& destNode, const BVHNode& sourceNode, + const BVHNode* nodeBase, IncrementalAABBTreeNode* parent, const PxU32* primitivesBase, + PxArray& mapping) +{ + destNode.mParent = parent; + destNode.mBVMin = V4ClearW(V4LoadU(&sourceNode.mBV.minimum.x)); + destNode.mBVMax = V4ClearW(V4LoadU(&sourceNode.mBV.maximum.x)); + if(sourceNode.isLeaf()) + { + AABBTreeIndices* indices = mIndicesPool.allocate(); + destNode.mIndices = indices; + indices->nbIndices = sourceNode.getNbPrimitives(); + const PxU32* sourceIndices = sourceNode.getPrimitives(primitivesBase); + for(PxU32 i = 0; i < indices->nbIndices; i++) + { + const PxU32 sourceIndex = sourceIndices[i]; + indices->indices[i] = sourceIndex; + mapping[sourceIndex] = &destNode; + } + } + else + { + IncrementalAABBTreeNodePair* nodePair = mNodesPool.construct(); + IncrementalAABBTreeNode* child0 = &nodePair->mNode0; + IncrementalAABBTreeNode* child1 = &nodePair->mNode1; + + destNode.mChilds[0] = child0; + destNode.mChilds[1] = child1; + + copyNode(*destNode.mChilds[0], *sourceNode.getPos(nodeBase), nodeBase, &destNode, primitivesBase, mapping); + copyNode(*destNode.mChilds[1], *sourceNode.getNeg(nodeBase), nodeBase, &destNode, primitivesBase, mapping); + } +} + +// build the tree from the prebuild AABB tree +void IncrementalAABBTree::copy(const BVH& bvh, PxArray& mapping) +{ + if(bvh.getNbBounds() == 0) + return; + + IncrementalAABBTreeNodePair* nodePair = mNodesPool.construct(); + mRoot = &nodePair->mNode0; + + const BVHNode* nodes = bvh.getNodes(); + copyNode(*mRoot, *nodes, nodes, NULL, bvh.getIndices(), mapping); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.h new file mode 100644 index 0000000..5aa0ade --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuIncrementalAABBTree.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INCREMENTAL_AABB_TREE_H +#define GU_INCREMENTAL_AABB_TREE_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxPool.h" +#include "common/PxPhysXCommonConfig.h" +#include "GuAABBTree.h" +#include "GuPrunerTypedef.h" + +namespace physx +{ + using namespace aos; + + namespace Gu + { + struct BVHNode; + class BVH; + + #define INCR_NB_OBJECTS_PER_NODE 4 + + // tree indices, can change in runtime + struct AABBTreeIndices + { + PX_FORCE_INLINE AABBTreeIndices(PoolIndex index) : nbIndices(1) + { + indices[0] = index; + for(PxU32 i=1; iindices[0]; } + PX_FORCE_INLINE PxU32* getPrimitives(PxU32*) { return &mIndices->indices[0]; } + PX_FORCE_INLINE PxU32 getNbPrimitives() const { return mIndices->nbIndices; } + PX_FORCE_INLINE PxU32 getPrimitiveIndex() const { return PX_INVALID_U32; } + + PX_FORCE_INLINE const IncrementalAABBTreeNode* getPos(const IncrementalAABBTreeNode*) const { return mChilds[0]; } + PX_FORCE_INLINE const IncrementalAABBTreeNode* getNeg(const IncrementalAABBTreeNode*) const { return mChilds[1]; } + + PX_FORCE_INLINE IncrementalAABBTreeNode* getPos(IncrementalAABBTreeNode*) { return mChilds[0]; } + PX_FORCE_INLINE IncrementalAABBTreeNode* getNeg(IncrementalAABBTreeNode*) { return mChilds[1]; } + + // PT: TODO: these functions are duplicates from the regular AABB tree node + PX_FORCE_INLINE void getAABBCenterExtentsV(physx::aos::Vec3V* center, physx::aos::Vec3V* extents) const + { + const float half = 0.5f; + const FloatV halfV = FLoad(half); + + *extents = Vec3V_From_Vec4V((V4Scale(V4Sub(mBVMax, mBVMin), halfV))); + *center = Vec3V_From_Vec4V((V4Scale(V4Add(mBVMax, mBVMin), halfV))); + } + + PX_FORCE_INLINE void getAABBCenterExtentsV2(physx::aos::Vec3V* center, physx::aos::Vec3V* extents) const + { + *extents = Vec3V_From_Vec4V((V4Sub(mBVMax, mBVMin))); + *center = Vec3V_From_Vec4V((V4Add(mBVMax, mBVMin))); + } + + Vec4V mBVMin; // Global bounding-volume min enclosing all the node-related primitives + Vec4V mBVMax; // Global bounding-volume max enclosing all the node-related primitives + IncrementalAABBTreeNode* mParent; // node parent + union + { + IncrementalAABBTreeNode* mChilds[2]; // childs of node if not a leaf + AABBTreeIndices* mIndices; // if leaf, indices information + }; + }; + + struct IncrementalAABBTreeNodePair + { + IncrementalAABBTreeNode mNode0; + IncrementalAABBTreeNode mNode1; + }; + + typedef PxArray NodeList; + + // incremental AABB tree, all changes are immediatelly reflected to the tree + class IncrementalAABBTree : public PxUserAllocated + { + public: + PX_PHYSX_COMMON_API IncrementalAABBTree(); + PX_PHYSX_COMMON_API ~IncrementalAABBTree(); + + // Build the tree for the first time + PX_PHYSX_COMMON_API bool build(const AABBTreeBuildParams& params, PxArray& mapping); + + // insert a new index into the tree + PX_PHYSX_COMMON_API IncrementalAABBTreeNode* insert(const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf); + + // update the object in the tree - full update insert/remove + PX_PHYSX_COMMON_API IncrementalAABBTreeNode* update(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf); + // update the object in the tree, faster method, that may unbalance the tree + PX_PHYSX_COMMON_API IncrementalAABBTreeNode* updateFast(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds, NodeList& changedLeaf); + + // remove object from the tree + PX_PHYSX_COMMON_API IncrementalAABBTreeNode* remove(IncrementalAABBTreeNode* node, const PoolIndex index, const PxBounds3* bounds); + + // fixup the tree indices, if we swapped the objects in the pruning pool + PX_PHYSX_COMMON_API void fixupTreeIndices(IncrementalAABBTreeNode* node, const PoolIndex index, const PoolIndex newIndex); + + // origin shift + PX_PHYSX_COMMON_API void shiftOrigin(const PxVec3& shift); + + // get the tree root node + PX_FORCE_INLINE const IncrementalAABBTreeNode* getNodes() const { return mRoot; } + + // define this function so we can share the scene query code with regular AABBTree + PX_FORCE_INLINE const PxU32* getIndices() const { return NULL; } + + // paranoia checks + PX_PHYSX_COMMON_API void hierarchyCheck(PoolIndex maxIndex, const PxBounds3* bounds); + PX_PHYSX_COMMON_API void hierarchyCheck(const PxBounds3* bounds); + PX_PHYSX_COMMON_API void checkTreeLeaf(IncrementalAABBTreeNode* leaf, PoolIndex h); + PX_PHYSX_COMMON_API PxU32 getTreeLeafDepth(IncrementalAABBTreeNode* leaf); + + PX_PHYSX_COMMON_API void release(); + + PX_PHYSX_COMMON_API void copy(const BVH& bvh, PxArray& mapping); + + private: + // clone the tree from the generic AABB tree that was built + void clone(PxArray& mapping, const PxU32* indices, IncrementalAABBTreeNode** treeNodes); + + void copyNode(IncrementalAABBTreeNode& destNode, const BVHNode& sourceNode, const BVHNode* nodeBase, + IncrementalAABBTreeNode* parent, const PxU32* primitivesBase, PxArray& mapping); + + // split leaf node, the newly added object does not fit in + IncrementalAABBTreeNode* splitLeafNode(IncrementalAABBTreeNode* node, const PoolIndex index, const Vec4V& minV, const Vec4V& maxV, const PxBounds3* bounds); + + void rotateTree(IncrementalAABBTreeNode* node, NodeList& changedLeaf, PxU32 largesRotateNode, const PxBounds3* bounds, bool rotateAgain); + + void releaseNode(IncrementalAABBTreeNode* node); + + PxPool mIndicesPool; + PxPool mNodesPool; + IncrementalAABBTreeNode* mRoot; + + NodeAllocator mNodeAllocator; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp new file mode 100644 index 0000000..f5803a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuInternal.cpp @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "geometry/PxCapsuleGeometry.h" +#include "foundation/PxIntrinsics.h" +#include "GuInternal.h" +#include "GuBox.h" +#include "GuVecPlane.h" +#include "foundation/PxVecMath.h" + +using namespace physx::aos; +using namespace physx; + +/** +Computes the aabb points. +\param pts [out] 8 box points +*/ +void Gu::computeBoxPoints(const PxBounds3& bounds, PxVec3* PX_RESTRICT pts) +{ + PX_ASSERT(pts); + + // Get box corners + const PxVec3& minimum = bounds.minimum; + const PxVec3& maximum = bounds.maximum; + + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + // Generate 8 corners of the bbox + pts[0] = PxVec3(minimum.x, minimum.y, minimum.z); + pts[1] = PxVec3(maximum.x, minimum.y, minimum.z); + pts[2] = PxVec3(maximum.x, maximum.y, minimum.z); + pts[3] = PxVec3(minimum.x, maximum.y, minimum.z); + pts[4] = PxVec3(minimum.x, minimum.y, maximum.z); + pts[5] = PxVec3(maximum.x, minimum.y, maximum.z); + pts[6] = PxVec3(maximum.x, maximum.y, maximum.z); + pts[7] = PxVec3(minimum.x, maximum.y, maximum.z); +} + +PxPlane Gu::getPlane(const PxTransform& pose) +{ + const PxVec3 n = pose.q.getBasisVector0(); + return PxPlane(n, -pose.p.dot(n)); +} + +void Gu::computeSweptBox(Gu::Box& dest, const PxVec3& extents, const PxVec3& center, const PxMat33& rot, const PxVec3& unitDir, const PxReal distance) +{ + PxVec3 R1, R2; + PxComputeBasisVectors(unitDir, R1, R2); + + PxReal dd[3]; + dd[0] = PxAbs(rot.column0.dot(unitDir)); + dd[1] = PxAbs(rot.column1.dot(unitDir)); + dd[2] = PxAbs(rot.column2.dot(unitDir)); + PxReal dmax = dd[0]; + PxU32 ax0=1; + PxU32 ax1=2; + if(dd[1]>dmax) + { + dmax=dd[1]; + ax0=0; + ax1=2; + } + if(dd[2]>dmax) + { + dmax=dd[2]; + ax0=0; + ax1=1; + } + if(dd[ax1] maxDistance) + return false; + + // If initial overlap happens, keep the triangle + if(triImpactDistance == 0.0f) + return true; + + // tris have "similar" impact distances if the difference is smaller than 2*distEpsilon + float distEpsilon = GU_EPSILON_SAME_DISTANCE; // pick a farther hit within distEpsilon that is more opposing than the previous closest hit + + // PT: make it a relative epsilon to make sure it still works with large distances + distEpsilon *= PxMax(1.0f, PxMax(triImpactDistance, bestImpactDistance)); + + // If new distance is more than epsilon closer than old distance + if(triImpactDistance < bestImpactDistance - distEpsilon) + return true; + + // If new distance is no more than epsilon farther than oldDistance and "face is more opposing than previous" + if(triImpactDistance < bestImpactDistance+distEpsilon && triAlignmentValue < bestAlignmentValue) + return true; + + // If alignment value is the same, but the new triangle is closer than the best distance + if(triAlignmentValue == bestAlignmentValue && triImpactDistance < bestImpactDistance) + return true; + + return false; + } + + PX_FORCE_INLINE bool keepTriangleBasic(float triImpactDistance, float bestImpactDistance, float maxDistance) + { + // Reject triangle if further than the maxDistance + if(triImpactDistance > maxDistance) + return false; + + // If initial overlap happens, keep the triangle + if(triImpactDistance == 0.0f) + return true; + + // If new distance is more than epsilon closer than old distance + if(triImpactDistance < bestImpactDistance) + return true; + + return false; + } + + PX_FORCE_INLINE PxVec3 cross100(const PxVec3& b) + { + return PxVec3(0.0f, -b.z, b.y); + } + PX_FORCE_INLINE PxVec3 cross010(const PxVec3& b) + { + return PxVec3(b.z, 0.0f, -b.x); + } + PX_FORCE_INLINE PxVec3 cross001(const PxVec3& b) + { + return PxVec3(-b.y, b.x, 0.0f); + } + + //! Compute point as combination of barycentric coordinates + PX_FORCE_INLINE PxVec3 computeBarycentricPoint(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxReal u, PxReal v) + { + // This seems to confuse the compiler... + // return (1.0f - u - v)*p0 + u*p1 + v*p2; + const PxF32 w = 1.0f - u - v; + return PxVec3(w * p0.x + u * p1.x + v * p2.x, w * p0.y + u * p1.y + v * p2.y, w * p0.z + u * p1.z + v * p2.z); + } + + PX_FORCE_INLINE PxReal computeTetrahedronVolume(const PxVec3& x0, const PxVec3& x1, const PxVec3& x2, const PxVec3& x3, PxMat33& edgeMatrix) + { + const PxVec3 u1 = x1 - x0; + const PxVec3 u2 = x2 - x0; + const PxVec3 u3 = x3 - x0; + + edgeMatrix = PxMat33(u1, u2, u3); + + const PxReal det = edgeMatrix.getDeterminant(); + + const PxReal volume = det / 6.0f; + return volume; + } + + PX_FORCE_INLINE PxReal computeTetrahedronVolume(const PxVec3& x0, const PxVec3& x1, const PxVec3& x2, const PxVec3& x3) + { + PxMat33 edgeMatrix; + return computeTetrahedronVolume(x0, x1, x2, x3, edgeMatrix); + } + + // IndexType should be PxU16 or PxU32. + template + PX_FORCE_INLINE PxReal computeTriangleMeshVolume(const PxVec3* vertices, const IndexType* indices, + const PxU32 numTriangles) + { + // See https://twitter.com/keenanisalive/status/1437178786286653445?lang=en + float volume = 0.0f; + + for(PxU32 i = 0; i < numTriangles; ++i) + { + PxVec3 v0 = vertices[indices[3*i]]; + PxVec3 v1 = vertices[indices[3 * i + 1]]; + PxVec3 v2 = vertices[indices[3 * i + 2]]; + + PxVec3 v0v1 = v0.cross(v1); + + volume += v0v1.dot(v2); + } + return volume / 6.0f; + } + + // IndexType should be PxU16 or PxU32. + // W in PxVec4 of vertices are ignored. + template + PX_FORCE_INLINE PxReal computeTriangleMeshVolume(const PxVec4* vertices, const IndexType* indices, + const PxU32 numTriangles) + { + // See https://twitter.com/keenanisalive/status/1437178786286653445?lang=en + float volume = 0.0f; + + for(PxU32 i = 0; i < numTriangles; ++i) + { + PxVec3 v0 = vertices[indices[3 * i]].getXYZ(); + PxVec3 v1 = vertices[indices[3 * i + 1]].getXYZ(); + PxVec3 v2 = vertices[indices[3 * i + 2]].getXYZ(); + + PxVec3 v0v1 = v0.cross(v1); + + volume += v0v1.dot(v2); + } + return volume / 6.0f; + } + + /*! + Extend an edge along its length by a factor + */ + PX_FORCE_INLINE void makeFatEdge(PxVec3& p0, PxVec3& p1, PxReal fatCoeff) + { + PxVec3 delta = p1 - p0; + + const PxReal m = delta.magnitude(); + if (m > 0.0f) + { + delta *= fatCoeff / m; + p0 -= delta; + p1 += delta; + } + } + +#if 0 + /*! + Extend an edge along its length by a factor + */ + PX_FORCE_INLINE void makeFatEdge(aos::Vec3V& p0, aos::Vec3V& p1, const aos::FloatVArg fatCoeff) + { + const aos::Vec3V delta = aos::V3Sub(p1, p0); + const aos::FloatV m = aos::V3Length(delta); + const aos::BoolV con = aos::FIsGrtr(m, aos::FZero()); + const aos::Vec3V fatDelta = aos::V3Scale(aos::V3ScaleInv(delta, m), fatCoeff); + p0 = aos::V3Sel(con, aos::V3Sub(p0, fatDelta), p0); + p1 = aos::V3Sel(con, aos::V3Add(p1, fatDelta), p1); + } +#endif + + PX_FORCE_INLINE PxU32 closestAxis(const PxVec3& v, PxU32& j, PxU32& k) + { + // find largest 2D plane projection + const PxF32 absPx = PxAbs(v.x); + const PxF32 absNy = PxAbs(v.y); + const PxF32 absNz = PxAbs(v.z); + + PxU32 m = 0; // x biggest axis + j = 1; + k = 2; + if (absNy > absPx && absNy > absNz) + { + // y biggest + j = 2; + k = 0; + m = 1; + } + else if (absNz > absPx) + { + // z biggest + j = 0; + k = 1; + m = 2; + } + return m; + } + + PX_FORCE_INLINE bool isAlmostZero(const PxVec3& v) + { + if (PxAbs(v.x) > 1e-6f || PxAbs(v.y) > 1e-6f || PxAbs(v.z) > 1e-6f) + return false; + return true; + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp new file mode 100644 index 0000000..5deb235 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.cpp @@ -0,0 +1,1462 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuMTD.h" +#include "GuDistancePointSegment.h" +#include "GuDistanceSegmentSegment.h" +#include "GuDistanceSegmentBox.h" +#include "GuVecBox.h" +#include "GuVecCapsule.h" +#include "GuVecConvexHullNoScale.h" +#include "GuInternal.h" +#include "GuContactMethodImpl.h" +#include "GuBoxConversion.h" +#include "GuPCMShapeConvex.h" +#include "GuPCMContactGen.h" +#include "GuConvexMesh.h" +#include "GuGJK.h" +#include "GuSphere.h" +#include "geomutils/PxContactBuffer.h" + +using namespace physx; +using namespace Gu; + +static PX_FORCE_INLINE float validateDepth(float depth) +{ + // PT: penetration depth must always be positive or null, but FPU accuracy being what it is, we sometimes + // end up with very small, epsilon-sized negative depths. We clamp those to zero, since they don't indicate + // real bugs in the MTD functions. However anything larger than epsilon is wrong, and caught with an assert. + const float epsilon = 1.e-3f; + + //ML: because we are shrunking the shape in this moment, so the depth might be larger than eps, this condition is no longer valid + //PX_ASSERT(depth>=-epsilon); + PX_UNUSED(epsilon); + return PxMax(depth, 0.0f); +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: the function names should follow the order in which the PxGeometryTypes are listed, +// i.e. computeMTD_Type0Type1 with Type0<=Type1. This is to guarantee that the proper results +// (following the desired convention) are returned from the PxGeometryQuery-level call. + +/////////////////////////////////////////////////////////////////////////////// + +static bool computeMTD_SphereSphere(PxVec3& mtd, PxF32& depth, const Sphere& sphere0, const Sphere& sphere1) +{ + const PxVec3 delta = sphere0.center - sphere1.center; + const PxReal d2 = delta.magnitudeSquared(); + const PxReal radiusSum = sphere0.radius + sphere1.radius; + + if(d2 > radiusSum*radiusSum) + return false; + + const PxF32 d = manualNormalize(mtd, delta, d2); + + depth = validateDepth(radiusSum - d); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool computeMTD_SphereCapsule(PxVec3& mtd, PxF32& depth, const Sphere& sphere, const Capsule& capsule) +{ + const PxReal radiusSum = sphere.radius + capsule.radius; + + PxReal u; + const PxReal d2 = distancePointSegmentSquared(capsule, sphere.center, &u); + + if(d2 > radiusSum*radiusSum) + return false; + + const PxVec3 normal = sphere.center - capsule.getPointAt(u); + + const PxReal lenSq = normal.magnitudeSquared(); + const PxF32 d = manualNormalize(mtd, normal, lenSq); + + depth = validateDepth(radiusSum - d); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +//This version is ported 1:1 from novodex +static PX_FORCE_INLINE bool ContactSphereBox(const PxVec3& sphereOrigin, + PxReal sphereRadius, + const PxVec3& boxExtents, +// const PxcCachedTransforms& boxCacheTransform, + const PxTransform& boxTransform, + PxVec3& point, + PxVec3& normal, + PxReal& separation, + PxReal contactDistance) +{ + //returns true on contact + const PxVec3 delta = sphereOrigin - boxTransform.p; // s1.center - s2.center; + PxVec3 dRot = boxTransform.rotateInv(delta); //transform delta into OBB body coords. + + //check if delta is outside ABB - and clip the vector to the ABB. + bool outside = false; + + if(dRot.x < -boxExtents.x) + { + outside = true; + dRot.x = -boxExtents.x; + } + else if(dRot.x > boxExtents.x) + { + outside = true; + dRot.x = boxExtents.x; + } + + if(dRot.y < -boxExtents.y) + { + outside = true; + dRot.y = -boxExtents.y; + } + else if(dRot.y > boxExtents.y) + { + outside = true; + dRot.y = boxExtents.y; + } + + if(dRot.z < -boxExtents.z) + { + outside = true; + dRot.z =-boxExtents.z; + } + else if(dRot.z > boxExtents.z) + { + outside = true; + dRot.z = boxExtents.z; + } + + if(outside) //if clipping was done, sphere center is outside of box. + { + point = boxTransform.rotate(dRot); //get clipped delta back in world coords. + normal = delta - point; //what we clipped away. + const PxReal lenSquared = normal.magnitudeSquared(); + const PxReal inflatedDist = sphereRadius + contactDistance; + if(lenSquared > inflatedDist * inflatedDist) + return false; //disjoint + + //normalize to make it into the normal: + separation = PxRecipSqrt(lenSquared); + normal *= separation; + separation *= lenSquared; + //any plane that touches the sphere is tangential, so a vector from contact point to sphere center defines normal. + //we could also use point here, which has same direction. + //this is either a faceFace or a vertexFace contact depending on whether the box's face or vertex collides, but we did not distinguish. + //We'll just use vertex face for now, this info isn't really being used anyway. + //contact point is point on surface of cube closest to sphere center. + point += boxTransform.p; + separation -= sphereRadius; + return true; + } + else + { + //center is in box, we definitely have a contact. + PxVec3 locNorm; //local coords contact normal + + PxVec3 absdRot; + absdRot = PxVec3(PxAbs(dRot.x), PxAbs(dRot.y), PxAbs(dRot.z)); + PxVec3 distToSurface = boxExtents - absdRot; //dist from embedded center to box surface along 3 dimensions. + + //find smallest element of distToSurface + if(distToSurface.y < distToSurface.x) + { + if(distToSurface.y < distToSurface.z) + { + //y + locNorm = PxVec3(0.0f, dRot.y > 0.0f ? 1.0f : -1.0f, 0.0f); + separation = -distToSurface.y; + } + else + { + //z + locNorm = PxVec3(0.0f,0.0f, dRot.z > 0.0f ? 1.0f : -1.0f); + separation = -distToSurface.z; + } + } + else + { + if(distToSurface.x < distToSurface.z) + { + //x + locNorm = PxVec3(dRot.x > 0.0f ? 1.0f : -1.0f, 0.0f, 0.0f); + separation = -distToSurface.x; + } + else + { + //z + locNorm = PxVec3(0.0f,0.0f, dRot.z > 0.0f ? 1.0f : -1.0f); + separation = -distToSurface.z; + } + } + //separation so far is just the embedding of the center point; we still have to push out all of the radius. + point = sphereOrigin; + normal = boxTransform.rotate(locNorm); + separation -= sphereRadius; + return true; + } +} + +static bool computeMTD_SphereBox(PxVec3& mtd, PxF32& depth, const Sphere& sphere, const Box& box) +{ + PxVec3 point; + if(!ContactSphereBox( sphere.center, sphere.radius, + box.extents, PxTransform(box.center, PxQuat(box.rot)), + point, mtd, depth, 0.0f)) + return false; + depth = validateDepth(-depth); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool computeMTD_CapsuleCapsule(PxVec3& mtd, PxF32& depth, const Capsule& capsule0, const Capsule& capsule1) +{ + PxReal s,t; + const PxReal d2 = distanceSegmentSegmentSquared(capsule0, capsule1, &s, &t); + + const PxReal radiusSum = capsule0.radius + capsule1.radius; + + if(d2 > radiusSum*radiusSum) + return false; + + const PxVec3 normal = capsule0.getPointAt(s) - capsule1.getPointAt(t); + + const PxReal lenSq = normal.magnitudeSquared(); + const PxF32 d = manualNormalize(mtd, normal, lenSq); + + depth = validateDepth(radiusSum - d); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE void reorderMTD(PxVec3& mtd, const PxVec3& center0, const PxVec3& center1) +{ + const PxVec3 witness = center0 - center1; + if(mtd.dot(witness) < 0.0f) + mtd = -mtd; +} + +static PX_FORCE_INLINE void projectBox(PxReal& min, PxReal& max, const PxVec3& axis, const Box& box) +{ + const PxReal boxCen = box.center.dot(axis); + const PxReal boxExt = + PxAbs(box.rot.column0.dot(axis)) * box.extents.x + + PxAbs(box.rot.column1.dot(axis)) * box.extents.y + + PxAbs(box.rot.column2.dot(axis)) * box.extents.z; + + min = boxCen - boxExt; + max = boxCen + boxExt; +} + +static bool PxcTestAxis(const PxVec3& axis, const Segment& segment, PxReal radius, const Box& box, PxReal& depth) +{ + // Project capsule + PxReal min0 = segment.p0.dot(axis); + PxReal max0 = segment.p1.dot(axis); + if(min0>max0) PxSwap(min0, max0); + min0 -= radius; + max0 += radius; + + // Project box + PxReal Min1, Max1; + projectBox(Min1, Max1, axis, box); + + // Test projections + if(max0=0.0f); + const PxReal d1 = Max1 - min0; + PX_ASSERT(d1>=0.0f); + depth = physx::intrinsics::selectMin(d0, d1); + return true; +} + +static bool PxcCapsuleOBBOverlap3(const Segment& segment, PxReal radius, const Box& box, PxReal* t=NULL, PxVec3* pp=NULL) +{ + PxVec3 Sep(0.0f); + PxReal PenDepth = PX_MAX_REAL; + + // Test normals + for(PxU32 i=0;i<3;i++) + { + PxReal d; + if(!PxcTestAxis(box.rot[i], segment, radius, box, d)) + return false; + + if(d capsule.radius*capsule.radius) + return false; + + if(d2 != 0.0f) + { + // PT: the capsule segment doesn't intersect the box => distance-based version + const PxVec3 onSegment = capsule.getPointAt(t); + onBox = box.center + box.rot.transform(onBox); + + PxVec3 normal = onSegment - onBox; + PxReal normalLen = normal.magnitude(); + + if(normalLen != 0.0f) + { + normal *= 1.0f/normalLen; + + mtd = normal; + depth = validateDepth(capsule.radius - PxSqrt(d2)); + return true; + } + } + + // PT: the capsule segment intersects the box => penetration-based version + return PxcCapsuleOBBOverlap3(capsule, capsule.radius, box, &depth, &mtd); +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool PxcTestAxis(const PxVec3& axis, const Box& box0, const Box& box1, PxReal& depth) +{ + // Project box + PxReal min0, max0; + projectBox(min0, max0, axis, box0); + + // Project box + PxReal Min1, Max1; + projectBox(Min1, Max1, axis, box1); + + // Test projections + if(max0=0.0f); + const PxReal d1 = Max1 - min0; + PX_ASSERT(d1>=0.0f); + depth = physx::intrinsics::selectMin(d0, d1); + return true; +} + +static PX_FORCE_INLINE bool testBoxBoxAxis(PxVec3& mtd, PxF32& depth, const PxVec3& axis, const Box& box0, const Box& box1) +{ + PxF32 d; + if(!PxcTestAxis(axis, box0, box1, d)) + return false; + if(dgetHull(); + const Vec3V vScale = V3LoadU_SafeReadW(meshScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&meshScale.rotation.x); + const ConvexHullV convexHull_(hullData, zeroV, vScale, vQuat, meshScale.isIdentity()); + + const PxMatTransformV aToB(convexPose.transformInv(transform0)); + + //const CapsuleV capsule(zeroV, zeroV, FZero());//this is a point + const CapsuleV capsule_(aToB.p, FZero());//this is a point + const LocalConvex capsule(capsule_); + const LocalConvex convexHull(convexHull_); + + status = gjk, LocalConvex >(capsule, convexHull, aToB.p, FMax(), closA, closB, normalV, dist); + } + + bool intersect = status == GJK_CONTACT; + if(intersect) + { + sqDistance = 0.0f; + } + else + { + const FloatV sqDist = FMul(dist, dist); + FStore(sqDist, &sqDistance); + V3StoreU(normalV, normal_); + V3StoreU(closB, closestPoint_); + + normal_ = convexPose.rotate(normal_); + closestPoint_ = convexPose.transform(closestPoint_); + } + + return intersect; +} + +static bool computeMTD_SphereConvex(PxVec3& mtd, PxF32& depth, const Sphere& sphere, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose) +{ + PxReal d2; + const ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + PxVec3 dummy; + if(!pointConvexDistance(mtd, dummy, d2, sphere.center, convexMesh, convexGeom.scale, convexPose)) + { + if(d2 > sphere.radius*sphere.radius) + return false; + + depth = validateDepth(sphere.radius - PxSqrt(d2)); + mtd = -mtd; + return true; + } + + // PT: if we reach this place, the sphere center touched the convex => switch to penetration-based code + PxU32 nbPolygons = convexMesh->getNbPolygonsFast(); + const HullPolygonData* polygons = convexMesh->getPolygons(); + const PxVec3 localSphereCenter = convexPose.transformInv(sphere.center); + PxReal dmax = -PX_MAX_F32; + while(nbPolygons--) + { + const HullPolygonData& polygon = *polygons++; + const PxF32 d = polygon.mPlane.distance(localSphereCenter); + if(d>dmax) + { + dmax = d; + mtd = convexPose.rotate(polygon.mPlane.n); + } + } + depth = validateDepth(sphere.radius - dmax); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +//ML : capsule will be in the local space of convexHullV +static bool internalComputeMTD_CapsuleConvex(const CapsuleV& capsule, const bool idtScale, const ConvexHullV& convexHullV, const aos::PxTransformV& transf1, + aos::FloatV& penetrationDepth, aos::Vec3V& normal) +{ + PolygonalData polyData; + getPCMConvexData(convexHullV, idtScale, polyData); + + PxU8 buff[sizeof(SupportLocalImpl)]; + + SupportLocal* map = (idtScale ? static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(static_cast(convexHullV), transf1, convexHullV.vertex2Shape, convexHullV.shape2Vertex, idtScale)) : + static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(convexHullV, transf1, convexHullV.vertex2Shape, convexHullV.shape2Vertex, idtScale))); + + return computeMTD(capsule, polyData, map, penetrationDepth, normal); +} + +static bool computeMTD_CapsuleConvex(PxVec3& mtd, PxF32& depth, const Capsule& capsule, const PxTransform& capsulePose, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose) +{ + const FloatV capsuleHalfHeight = FLoad(capsule.length()*0.5f); + const FloatV capsuleRadius = FLoad(capsule.radius); + + const Vec3V zeroV = V3Zero(); + // Convex mesh + const ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + const ConvexHullData* hull = &convexMesh->getHull(); + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + const ConvexHullV convexHullV(hull, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + //~Convex mesh + + const QuatV q0 = QuatVLoadU(&capsulePose.q.x); + const Vec3V p0 = V3LoadU(&capsulePose.p.x); + + const QuatV q1 = QuatVLoadU(&convexPose.q.x); + const Vec3V p1 = V3LoadU(&convexPose.p.x); + + const PxTransformV transf0(p0, q0); + const PxTransformV transf1(p1, q1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + Vec3V normal = zeroV; + FloatV penetrationDepth = FZero(); + + const CapsuleV capsuleV(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + + const bool idtScale = convexGeom.scale.isIdentity(); + bool hasContacts = internalComputeMTD_CapsuleConvex(capsuleV, idtScale, convexHullV, transf1, penetrationDepth, normal); + if(hasContacts) + { + FStore(penetrationDepth, &depth); + depth = validateDepth(depth); + V3StoreU(normal, mtd); + } + + return hasContacts; +} + +/////////////////////////////////////////////////////////////////////////////// +static bool internalComputeMTD_BoxConvex(const PxVec3 halfExtents, const BoxV& box, const bool idtScale, const ConvexHullV& convexHullV, const aos::PxTransformV& transf0, const aos::PxTransformV& transf1, + aos::FloatV& penetrationDepth, aos::Vec3V& normal) +{ + PolygonalData polyData0; + PCMPolygonalBox polyBox0(halfExtents); + polyBox0.getPolygonalData(&polyData0); + polyData0.mPolygonVertexRefs = gPCMBoxPolygonData; + + PolygonalData polyData1; + getPCMConvexData(convexHullV, idtScale, polyData1); + + Mat33V identity = M33Identity(); + SupportLocalImpl map0(box, transf0, identity, identity, true); + + PxU8 buff[sizeof(SupportLocalImpl)]; + + SupportLocal* map1 = (idtScale ? static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(static_cast(convexHullV), transf1, convexHullV.vertex2Shape, convexHullV.shape2Vertex, idtScale)) : + static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(convexHullV, transf1, convexHullV.vertex2Shape, convexHullV.shape2Vertex, idtScale))); + + return computeMTD(polyData0, polyData1, &map0, map1, penetrationDepth, normal); +} + +static bool computeMTD_BoxConvex(PxVec3& mtd, PxF32& depth, const Box& box, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose) +{ + const Vec3V zeroV = V3Zero(); + const PxTransform boxPose = box.getTransform(); + const Vec3V boxExtents = V3LoadU(box.extents); + const BoxV boxV(zeroV, boxExtents); + + // Convex mesh + const ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + const ConvexHullData* hull = &convexMesh->getHull(); + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + const ConvexHullV convexHullV(hull, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + //~Convex mesh + + const QuatV q0 = QuatVLoadU(&boxPose.q.x); + const Vec3V p0 = V3LoadU(&boxPose.p.x); + + const QuatV q1 = QuatVLoadU(&convexPose.q.x); + const Vec3V p1 = V3LoadU(&convexPose.p.x); + + const PxTransformV transf0(p0, q0); + const PxTransformV transf1(p1, q1); + + Vec3V normal=zeroV; + FloatV penetrationDepth=FZero(); + + const bool idtScale = convexGeom.scale.isIdentity(); + bool hasContacts = internalComputeMTD_BoxConvex(box.extents, boxV, idtScale, convexHullV, transf0, transf1, penetrationDepth, normal); + if(hasContacts) + { + FStore(penetrationDepth, &depth); + depth = validateDepth(depth); + V3StoreU(normal, mtd); + } + + return hasContacts; +} + +static bool internalComputeMTD_ConvexConvex(const bool idtScale0, const bool idtScale1, const ConvexHullV& convexHullV0, const ConvexHullV& convexHullV1, const aos::PxTransformV& transf0, const aos::PxTransformV& transf1, + aos::FloatV& penetrationDepth, aos::Vec3V& normal) +{ + PolygonalData polyData0, polyData1; + getPCMConvexData(convexHullV0, idtScale0, polyData0); + getPCMConvexData(convexHullV1, idtScale1, polyData1); + + PxU8 buff0[sizeof(SupportLocalImpl)]; + PxU8 buff1[sizeof(SupportLocalImpl)]; + + SupportLocal* map0 = (idtScale0 ? static_cast(PX_PLACEMENT_NEW(buff0, SupportLocalImpl)(static_cast(convexHullV0), transf0, convexHullV0.vertex2Shape, convexHullV0.shape2Vertex, idtScale0)) : + static_cast(PX_PLACEMENT_NEW(buff0, SupportLocalImpl)(convexHullV0, transf0, convexHullV0.vertex2Shape, convexHullV0.shape2Vertex, idtScale0))); + + SupportLocal* map1 = (idtScale1 ? static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(static_cast(convexHullV1), transf1, convexHullV1.vertex2Shape, convexHullV1.shape2Vertex, idtScale1)) : + static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(convexHullV1, transf1, convexHullV1.vertex2Shape, convexHullV1.shape2Vertex, idtScale1))); + + return computeMTD(polyData0, polyData1, map0, map1, penetrationDepth, normal); +} + +/////////////////////////////////////////////////////////////////////////////// +static bool computeMTD_ConvexConvex(PxVec3& mtd, PxF32& depth, const PxConvexMeshGeometry& convexGeom0, const PxTransform& convexPose0, const PxConvexMeshGeometry& convexGeom1, const PxTransform& convexPose1) +{ + using namespace aos; + + const Vec3V zeroV = V3Zero(); + // Convex mesh + const ConvexMesh* convexMesh0 = static_cast(convexGeom0.convexMesh); + const ConvexHullData* hull0 = &convexMesh0->getHull(); + const Vec3V vScale0 = V3LoadU_SafeReadW(convexGeom0.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat0 = QuatVLoadU(&convexGeom0.scale.rotation.x); + const ConvexHullV convexHullV0(hull0, zeroV, vScale0, vQuat0, convexGeom0.scale.isIdentity()); + //~Convex mesh + + // Convex mesh + const ConvexMesh* convexMesh1 = static_cast(convexGeom1.convexMesh); + const ConvexHullData* hull1 = &convexMesh1->getHull(); + const Vec3V vScale1 = V3LoadU_SafeReadW(convexGeom1.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat1 = QuatVLoadU(&convexGeom1.scale.rotation.x); + const ConvexHullV convexHullV1(hull1, zeroV, vScale1, vQuat1, convexGeom1.scale.isIdentity()); + //~Convex mesh + + const QuatV q0 = QuatVLoadU(&convexPose0.q.x); + const Vec3V p0 = V3LoadU(&convexPose0.p.x); + + const QuatV q1 = QuatVLoadU(&convexPose1.q.x); + const Vec3V p1 = V3LoadU(&convexPose1.p.x); + + const PxTransformV transf0(p0, q0); + const PxTransformV transf1(p1, q1); + + Vec3V normal = zeroV; + FloatV penetrationDepth = FZero(); + + const bool idtScale0 = convexGeom0.scale.isIdentity(); + const bool idtScale1 = convexGeom1.scale.isIdentity(); + + bool hasContacts = internalComputeMTD_ConvexConvex(idtScale0, idtScale1, convexHullV0, convexHullV1, transf0, transf1, penetrationDepth, normal); + + if(hasContacts) + { + FStore(penetrationDepth, &depth); + depth = validateDepth(depth); + V3StoreU(normal, mtd); + } + return hasContacts; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool computeMTD_SpherePlane(PxVec3& mtd, PxF32& depth, const Sphere& sphere, const PxPlane& plane) +{ + const PxReal d = plane.distance(sphere.center); + if(d>sphere.radius) + return false; + + mtd = plane.n; + depth = validateDepth(sphere.radius - d); + return true; +} + +static bool computeMTD_PlaneBox(PxVec3& mtd, PxF32& depth, const PxPlane& plane, const Box& box) +{ + PxVec3 pts[8]; + box.computeBoxPoints(pts); + + PxReal dmin = plane.distance(pts[0]); + for(PxU32 i=1;i<8;i++) + { + const PxReal d = plane.distance(pts[i]); + dmin = physx::intrinsics::selectMin(dmin, d); + } + if(dmin>0.0f) + return false; + + mtd = -plane.n; + depth = validateDepth(-dmin); + return true; +} + +static bool computeMTD_PlaneCapsule(PxVec3& mtd, PxF32& depth, const PxPlane& plane, const Capsule& capsule) +{ + const PxReal d0 = plane.distance(capsule.p0); + const PxReal d1 = plane.distance(capsule.p1); + const PxReal dmin = physx::intrinsics::selectMin(d0, d1) - capsule.radius; + if(dmin>0.0f) + return false; + + mtd = -plane.n; + depth = validateDepth(-dmin); + return true; +} + +static bool computeMTD_PlaneConvex(PxVec3& mtd, PxF32& depth, const PxPlane& plane, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose) +{ + const ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + PxU32 nbVerts = convexMesh->getNbVerts(); + const PxVec3* PX_RESTRICT verts = convexMesh->getVerts(); + + PxReal dmin = plane.distance(convexPose.transform(verts[0])); + for(PxU32 i=1;i0.0f) + return false; + + mtd = -plane.n; + depth = validateDepth(-dmin); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +static bool processContacts(PxVec3& mtd, PxF32& depth, const PxU32 nbContacts, const PxContactPoint* contacts) +{ + if(nbContacts) + { + PxVec3 mn(0.0f), mx(0.0f); + for(PxU32 i=0; igenerateContacts(geom0, geom1, pose0, pose1, FLT_EPSILON, FLT_EPSILON, 1.0f, contactBuffer)) + return false; + + return processContacts(mtd, depth, contactBuffer.count, contactBuffer.contacts); +} + +static bool GeomMTDCallback_NotSupported(GU_MTD_FUNC_PARAMS) +{ + PX_ALWAYS_ASSERT_MESSAGE("NOT SUPPORTED"); + PX_UNUSED(mtd); PX_UNUSED(depth); PX_UNUSED(geom0); PX_UNUSED(geom1); PX_UNUSED(pose0); PX_UNUSED(pose1); + + return false; +} + +static bool GeomMTDCallback_SphereSphere(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eSPHERE); + + const PxSphereGeometry& sphereGeom0 = static_cast(geom0); + const PxSphereGeometry& sphereGeom1 = static_cast(geom1); + + return computeMTD_SphereSphere(mtd, depth, Sphere(pose0.p, sphereGeom0.radius), Sphere(pose1.p, sphereGeom1.radius)); +} + +static bool GeomMTDCallback_SpherePlane(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::ePLANE); + PX_UNUSED(geom1); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + return computeMTD_SpherePlane(mtd, depth, Sphere(pose0.p, sphereGeom.radius), getPlane(pose1)); +} + +static bool GeomMTDCallback_SphereCapsule(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxCapsuleGeometry& capsuleGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose1, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + return computeMTD_SphereCapsule(mtd, depth, Sphere(pose0.p, sphereGeom.radius), capsule); +} + +static bool GeomMTDCallback_SphereBox(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxBoxGeometry& boxGeom = static_cast(geom1); + + Box obb; + buildFrom(obb, pose1.p, boxGeom.halfExtents, pose1.q); + + return computeMTD_SphereBox(mtd, depth, Sphere(pose0.p, sphereGeom.radius), obb); +} + +static bool GeomMTDCallback_SphereConvex(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + return computeMTD_SphereConvex(mtd, depth, Sphere(pose0.p, sphereGeom.radius), convexGeom, pose1); +} + +static bool GeomMTDCallback_SphereMesh(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + return computeMTD_SphereMesh(mtd, depth, Sphere(pose0.p, sphereGeom.radius), meshGeom, pose1); +} + +static bool GeomMTDCallback_PlaneCapsule(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + PX_UNUSED(geom0); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose1, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + return computeMTD_PlaneCapsule(mtd, depth, getPlane(pose0), capsule); +} + +static bool GeomMTDCallback_PlaneBox(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + PX_UNUSED(geom0); + + const PxBoxGeometry& boxGeom = static_cast(geom1); + + Box obb; + buildFrom(obb, pose1.p, boxGeom.halfExtents, pose1.q); + + return computeMTD_PlaneBox(mtd, depth, getPlane(pose0), obb); +} + +static bool GeomMTDCallback_PlaneConvex(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(geom0); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + return computeMTD_PlaneConvex(mtd, depth, getPlane(pose0), convexGeom, pose1); +} + +static bool GeomMTDCallback_CapsuleCapsule(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + + const PxCapsuleGeometry& capsuleGeom0 = static_cast(geom0); + const PxCapsuleGeometry& capsuleGeom1 = static_cast(geom1); + + Capsule capsule0; + getCapsuleSegment(pose0, capsuleGeom0, capsule0); + capsule0.radius = capsuleGeom0.radius; + + Capsule capsule1; + getCapsuleSegment(pose1, capsuleGeom1, capsule1); + capsule1.radius = capsuleGeom1.radius; + + return computeMTD_CapsuleCapsule(mtd, depth, capsule0, capsule1); +} + +static bool GeomMTDCallback_CapsuleBox(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxBoxGeometry& boxGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose0, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + Box obb; + buildFrom(obb, pose1.p, boxGeom.halfExtents, pose1.q); + + return computeMTD_CapsuleBox(mtd, depth, capsule, obb); +} + +static bool GeomMTDCallback_CapsuleConvex(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose0, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + return computeMTD_CapsuleConvex(mtd, depth, capsule, pose0, convexGeom, pose1); +} + +static bool GeomMTDCallback_CapsuleMesh(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose0, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + return computeMTD_CapsuleMesh(mtd, depth, capsule, meshGeom, pose1); +} + +static bool GeomMTDCallback_BoxBox(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + + const PxBoxGeometry& boxGeom0 = static_cast(geom0); + const PxBoxGeometry& boxGeom1 = static_cast(geom1); + + Box obb0; + buildFrom(obb0, pose0.p, boxGeom0.halfExtents, pose0.q); + + Box obb1; + buildFrom(obb1, pose1.p, boxGeom1.halfExtents, pose1.q); + + return computeMTD_BoxBox(mtd, depth, obb0, obb1); +} + +static bool GeomMTDCallback_BoxConvex(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + Box obb; + buildFrom(obb, pose0.p, boxGeom.halfExtents, pose0.q); + + return computeMTD_BoxConvex(mtd, depth, obb, convexGeom, pose1); +} + +static bool GeomMTDCallback_BoxMesh(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + Box obb; + buildFrom(obb, pose0.p, boxGeom.halfExtents, pose0.q); + + return computeMTD_BoxMesh(mtd, depth, obb, meshGeom, pose1); +} + +static bool GeomMTDCallback_ConvexConvex(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + + const PxConvexMeshGeometry& convexGeom0 = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom1 = static_cast(geom1); + + return computeMTD_ConvexConvex(mtd, depth, convexGeom0, pose0, convexGeom1, pose1); +} + +static bool GeomMTDCallback_ConvexMesh(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + return computeMTD_ConvexMesh(mtd, depth, convexGeom, pose0, meshGeom, pose1); +} + +static bool GeomMTDCallback_SphereHeightField(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxHeightFieldGeometry& meshGeom = static_cast(geom1); + + const Sphere sphere(pose0.p, sphereGeom.radius); + + return computeMTD_SphereHeightField(mtd, depth, sphere, meshGeom, pose1); +} + +static bool GeomMTDCallback_CapsuleHeightField(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxHeightFieldGeometry& meshGeom = static_cast(geom1); + + Capsule capsule; + getCapsuleSegment(pose0, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + return computeMTD_CapsuleHeightField(mtd, depth, capsule, meshGeom, pose1); +} + +static bool GeomMTDCallback_BoxHeightField(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxHeightFieldGeometry& meshGeom = static_cast(geom1); + + Box obb; + buildFrom(obb, pose0.p, boxGeom.halfExtents, pose0.q); + + return computeMTD_BoxHeightField(mtd, depth, obb, meshGeom, pose1); +} + +static bool GeomMTDCallback_ConvexHeightField(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const PxHeightFieldGeometry& meshGeom = static_cast(geom1); + + return computeMTD_ConvexHeightField(mtd, depth, convexGeom, pose0, meshGeom, pose1); +} + +static bool GeomMTDCallback_CustomGeometryGeometry(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType() == PxGeometryType::eCUSTOM); + + const PxCustomGeometry& customGeom = static_cast(geom0); + + return computeMTD_CustomGeometry(mtd, depth, customGeom, pose0, geom1, pose1); +} + +static bool GeomMTDCallback_GeometryCustomGeometry(GU_MTD_FUNC_PARAMS) +{ + PX_ASSERT(geom1.getType() == PxGeometryType::eCUSTOM); + + const PxCustomGeometry& customGeom = static_cast(geom1); + + if (computeMTD_CustomGeometry(mtd, depth, customGeom, pose1, geom0, pose0)) + { + mtd = -mtd; + return true; + } + + return false; +} + +Gu::GeomMTDFunc gGeomMTDMethodTable[][PxGeometryType::eGEOMETRY_COUNT] = +{ + //PxGeometryType::eSPHERE + { + GeomMTDCallback_SphereSphere, //PxGeometryType::eSPHERE + GeomMTDCallback_SpherePlane, //PxGeometryType::ePLANE + GeomMTDCallback_SphereCapsule, //PxGeometryType::eCAPSULE + GeomMTDCallback_SphereBox, //PxGeometryType::eBOX + GeomMTDCallback_SphereConvex, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_SphereMesh, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_SphereHeightField, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePLANE + { + 0, //PxGeometryType::eSPHERE + GeomMTDCallback_NotSupported, //PxGeometryType::ePLANE + GeomMTDCallback_PlaneCapsule, //PxGeometryType::eCAPSULE + GeomMTDCallback_PlaneBox, //PxGeometryType::eBOX + GeomMTDCallback_PlaneConvex, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCAPSULE + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + GeomMTDCallback_CapsuleCapsule, //PxGeometryType::eCAPSULE + GeomMTDCallback_CapsuleBox, //PxGeometryType::eBOX + GeomMTDCallback_CapsuleConvex, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_CapsuleMesh, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_CapsuleHeightField, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eBOX + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + GeomMTDCallback_BoxBox, //PxGeometryType::eBOX + GeomMTDCallback_BoxConvex, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_BoxMesh, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_BoxHeightField, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCONVEXMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + GeomMTDCallback_ConvexConvex, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_ConvexMesh, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_ConvexHeightField, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePARTICLESYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + GeomMTDCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTETRAHEDRONMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_NotSupported, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTRIANGLEMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHEIGHTFIELD + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + GeomMTDCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_GeometryCustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHAIRSYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + GeomMTDCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_CustomGeometryGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCUSTOM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + 0, //PxGeometryType::eHAIRSYSTEM + GeomMTDCallback_CustomGeometryGeometry, //PxGeometryType::eCUSTOM + }, +}; +PX_COMPILE_TIME_ASSERT(sizeof(gGeomMTDMethodTable) / sizeof(gGeomMTDMethodTable[0]) == PxGeometryType::eGEOMETRY_COUNT); diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.h new file mode 100644 index 0000000..1340217 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMTD.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_MTD_H +#define GU_MTD_H + +#include "foundation/PxVec3.h" +#include "geometry/PxGeometry.h" + +namespace physx +{ +namespace Gu +{ + // PT: we use a define to be able to quickly change the signature of all MTD functions. + // (this also ensures they all use consistent names for passed parameters). + // \param[out] mtd computed depenetration dir + // \param[out] depth computed depenetration depth + // \param[in] geom0 first geometry object + // \param[in] pose0 pose of first geometry object + // \param[in] geom1 second geometry object + // \param[in] pose1 pose of second geometry object + // \param[in] cache optional cached data for triggers + #define GU_MTD_FUNC_PARAMS PxVec3& mtd, PxF32& depth, \ + const PxGeometry& geom0, const PxTransform& pose0, \ + const PxGeometry& geom1, const PxTransform& pose1 + + // PT: function pointer for Geom-indexed MTD functions + // See GU_MTD_FUNC_PARAMS for function parameters details. + // \return true if an overlap was found, false otherwise + // \note depenetration vector D is equal to mtd * depth. It should be applied to the 1st object, to get out of the 2nd object. + typedef bool (*GeomMTDFunc) (GU_MTD_FUNC_PARAMS); + + PX_FORCE_INLINE PxF32 manualNormalize(PxVec3& mtd, const PxVec3& normal, PxReal lenSq) + { + const PxF32 len = PxSqrt(lenSq); + + // We do a *manual* normalization to check for singularity condition + if(lenSq < 1e-6f) + mtd = PxVec3(1.0f, 0.0f, 0.0f); // PT: zero normal => pick up random one + else + mtd = normal * 1.0f / len; + + return len; + } +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp new file mode 100644 index 0000000..ee3b17d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMaverickNode.cpp @@ -0,0 +1,146 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuMaverickNode.h" + +using namespace physx; +using namespace Gu; + +const PxU32 MaverickNode::mIndices[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + +bool MaverickNode::addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp) +{ + if(mNbFree +static void releaseObjects(PxCoalescedHashSet& objects) +{ + while(objects.size()) + { + T* object = objects.getEntries()[0]; + PX_ASSERT(RefCountable_getRefCount(*object)==1); + object->release(); + } +} + +// PT: needed because Gu::BVH is not a PxRefCounted object, although it derives from RefCountable +static void releaseObjects(PxCoalescedHashSet& objects) +{ + while(objects.size()) + { + Gu::BVH* object = objects.getEntries()[0]; + PX_ASSERT(object->getRefCount()==1); + object->release(); + } +} + +void MeshFactory::release() +{ + // Release all objects in case the user didn't do it + releaseObjects(mTriangleMeshes); + releaseObjects(mTetrahedronMeshes); + releaseObjects(mSoftBodyMeshes); + releaseObjects(mConvexMeshes); + releaseObjects(mHeightFields); + releaseObjects(mBVHs); + + PX_DELETE_THIS; +} + +template +static void addToHash(PxCoalescedHashSet& hash, T* element, PxMutex* mutex) +{ + if(!element) + return; + + if(mutex) + mutex->lock(); + + hash.insert(element); + + if(mutex) + mutex->unlock(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static void read8BitIndices(PxInputStream& stream, void* tris, PxU32 nbIndices, const bool has16BitIndices) +{ + PxU8 x; + if(has16BitIndices) + { + PxU16* tris16 = reinterpret_cast(tris); + for(PxU32 i=0;i(tris); + for(PxU32 i=0;i(tris); + stream.read(tris16, nbIndices*sizeof(PxU16)); + if(mismatch) + { + for(PxU32 i=0;i(tris); + PxU16 x; + for(PxU32 i=0;i(tris); + for(PxU32 i=0;i(tris); + stream.read(tris32, nbIndices*sizeof(PxU32)); + + if(mismatch) + { + for(PxU32 i=0;i=14) // this refers to PX_MESH_VERSION + midphaseID = readDword(mismatch, stream); + + // Check if old (incompatible) mesh format is loaded + if (version <= 9) // this refers to PX_MESH_VERSION + { + outputError(__LINE__, "Loading triangle mesh failed: " + "Deprecated mesh cooking format. Please recook your mesh in a new cooking format."); + PX_ALWAYS_ASSERT_MESSAGE("Obsolete cooked mesh found. Mesh version has been updated, please recook your meshes."); + return NULL; + } + + // Import serialization flags + const PxU32 serialFlags = readDword(mismatch, stream); + + // Import misc values + if (version <= 12) // this refers to PX_MESH_VERSION + { + // convexEdgeThreshold was removed in 3.4.0 + readFloat(mismatch, stream); + } + + TriangleMeshData* data; + if(midphaseID==PxMeshMidPhase::eBVH33) + data = PX_NEW(RTreeTriangleData); + else if(midphaseID==PxMeshMidPhase::eBVH34) + data = PX_NEW(BV4TriangleData); + else return NULL; + + // Import mesh + PxVec3* verts = data->allocateVertices(readDword(mismatch, stream)); + const PxU32 nbTris = readDword(mismatch, stream); + const bool force32 = (serialFlags & (IMSF_8BIT_INDICES|IMSF_16BIT_INDICES)) == 0; + + //ML: this will allocate CPU triangle indices and GPU triangle indices if we have GRB data built + void* tris = data->allocateTriangles(nbTris, force32, serialFlags & IMSF_GRB_DATA); + + stream.read(verts, sizeof(PxVec3)*data->mNbVertices); + if(mismatch) + { + for(PxU32 i=0;imNbVertices;i++) + { + flip(verts[i].x); + flip(verts[i].y); + flip(verts[i].z); + } + } + //TODO: stop support for format conversion on load!! + const PxU32 nbIndices = 3*data->mNbTriangles; + if(serialFlags & IMSF_8BIT_INDICES) + read8BitIndices(stream, tris, nbIndices, data->has16BitIndices()); + else if(serialFlags & IMSF_16BIT_INDICES) + read16BitIndices(stream, tris, nbIndices, data->has16BitIndices(), mismatch); + else + read32BitIndices(stream, tris, nbIndices, data->has16BitIndices(), mismatch); + + if(serialFlags & IMSF_MATERIALS) + { + PxU16* materials = data->allocateMaterials(); + stream.read(materials, sizeof(PxU16)*data->mNbTriangles); + if(mismatch) + { + for(PxU32 i=0;imNbTriangles;i++) + flip(materials[i]); + } + } + if(serialFlags & IMSF_FACE_REMAP) + { + PxU32* remap = data->allocateFaceRemap(); + readIndices(readDword(mismatch, stream), data->mNbTriangles, remap, stream, mismatch); + } + + if(serialFlags & IMSF_ADJACENCIES) + { + PxU32* adj = data->allocateAdjacencies(); + stream.read(adj, sizeof(PxU32)*data->mNbTriangles*3); + if(mismatch) + { + for(PxU32 i=0;imNbTriangles*3;i++) + flip(adj[i]); + } + } + + // PT: TODO better + if(midphaseID==PxMeshMidPhase::eBVH33) + { + if(!static_cast(data)->mRTree.load(stream, version, mismatch)) + { + outputError(__LINE__, "RTree binary image load error."); + PX_DELETE(data); + return NULL; + } + } + else if(midphaseID==PxMeshMidPhase::eBVH34) + { + BV4TriangleData* bv4data = static_cast(data); + if(!bv4data->mBV4Tree.load(stream, mismatch)) + { + outputError(__LINE__, "BV4 binary image load error."); + PX_DELETE(data); + return NULL; + } + + bv4data->mMeshInterface.setNbTriangles(nbTris); + bv4data->mMeshInterface.setNbVertices(data->mNbVertices); + if(data->has16BitIndices()) + bv4data->mMeshInterface.setPointers(NULL, reinterpret_cast(tris), verts); + else + bv4data->mMeshInterface.setPointers(reinterpret_cast(tris), NULL, verts); + bv4data->mBV4Tree.mMeshInterface = &bv4data->mMeshInterface; + } + else PX_ASSERT(0); + + // Import local bounds + data->mGeomEpsilon = readFloat(mismatch, stream); + readFloatBuffer(&data->mAABB.minimum.x, 6, mismatch, stream); + + PxU32 nb = readDword(mismatch, stream); + if(nb) + { + PX_ASSERT(nb==data->mNbTriangles); + data->allocateExtraTrigData(); + // No need to convert those bytes + stream.read(data->mExtraTrigData, nb*sizeof(PxU8)); + } + + if(serialFlags & IMSF_GRB_DATA) + { + PxU32 GRB_meshAdjVerticiesTotal = 0; + if(version < 15) + GRB_meshAdjVerticiesTotal = readDword(mismatch, stream); + + //read grb triangle indices + PX_ASSERT(data->mGRB_primIndices); + + if(serialFlags & IMSF_8BIT_INDICES) + read8BitIndices(stream, data->mGRB_primIndices, nbIndices, data->has16BitIndices()); + else if(serialFlags & IMSF_16BIT_INDICES) + read16BitIndices(stream, data->mGRB_primIndices, nbIndices, data->has16BitIndices(), mismatch); + else + read32BitIndices(stream, data->mGRB_primIndices, nbIndices, data->has16BitIndices(), mismatch); + + data->mGRB_primAdjacencies = PX_ALLOCATE(PxU32, data->mNbTriangles*4, "mGRB_primAdjacencies"); + data->mGRB_faceRemap = PX_ALLOCATE(PxU32, data->mNbTriangles, "mGRB_faceRemap"); + + if(serialFlags & IMSF_GRB_INV_REMAP) + data->mGRB_faceRemapInverse = PX_ALLOCATE(PxU32, data->mNbTriangles, "mGRB_faceRemapInverse"); + + stream.read(data->mGRB_primAdjacencies, sizeof(PxU32)*data->mNbTriangles*4); + if (version < 15) + { + //stream.read(data->mGRB_vertValency, sizeof(PxU32)*data->mNbVertices); + for (PxU32 i = 0; i < data->mNbVertices; ++i) + readDword(mismatch, stream); + //stream.read(data->mGRB_adjVertStart, sizeof(PxU32)*data->mNbVertices); + for (PxU32 i = 0; i < data->mNbVertices; ++i) + readDword(mismatch, stream); + //stream.read(data->mGRB_adjVertices, sizeof(PxU32)*GRB_meshAdjVerticiesTotal); + for (PxU32 i = 0; i < GRB_meshAdjVerticiesTotal; ++i) + readDword(mismatch, stream); + } + stream.read(data->mGRB_faceRemap, sizeof(PxU32)*data->mNbTriangles); + if(data->mGRB_faceRemapInverse) + stream.read(data->mGRB_faceRemapInverse, sizeof(PxU32)*data->mNbTriangles); + + if(mismatch) + { + for(PxU32 i=0;imNbTriangles*4;i++) + flip(reinterpret_cast(data->mGRB_primIndices)[i]); + + for(PxU32 i=0;imNbTriangles*4;i++) + flip(reinterpret_cast(data->mGRB_primAdjacencies)[i]); + } + + //read BV32 + data->mGRB_BV32Tree = PX_NEW(BV32Tree); + if (!data->mGRB_BV32Tree->load(stream, mismatch)) + { + outputError(__LINE__, "BV32 binary image load error."); + PX_DELETE(data); + return NULL; + } + + if (serialFlags & IMSF_VERT_MAPPING) + { + //import vertex mapping data + data->mNbTrianglesReferences = readDword(mismatch, stream); + data->mAccumulatedTrianglesRef = PX_ALLOCATE(PxU32, data->mNbVertices, "mAccumulatedTrianglesRef"); + data->mTrianglesReferences = PX_ALLOCATE(PxU32, data->mNbTrianglesReferences, "mTrianglesReferences"); + + stream.read(data->mAccumulatedTrianglesRef, data->mNbVertices * sizeof(PxU32)); + stream.read(data->mTrianglesReferences, data->mNbTrianglesReferences * sizeof(PxU32)); + } + } + + if (serialFlags & IMSF_SDF) + { + // Import sdf + SDF& sdfData = data->mSdfData; + sdfData.mMeshLower.x = readFloat(mismatch, stream); + sdfData.mMeshLower.y = readFloat(mismatch, stream); + sdfData.mMeshLower.z = readFloat(mismatch, stream); + sdfData.mSpacing = readFloat(mismatch, stream); + sdfData.mDims.x = readDword(mismatch, stream); + sdfData.mDims.y = readDword(mismatch, stream); + sdfData.mDims.z = readDword(mismatch, stream); + sdfData.mNumSdfs = readDword(mismatch, stream); + + sdfData.mNumSubgridSdfs = readDword(mismatch, stream); + sdfData.mNumStartSlots = readDword(mismatch, stream); + sdfData.mSubgridSize = readDword(mismatch, stream); + sdfData.mSdfSubgrids3DTexBlockDim.x = readDword(mismatch, stream); + sdfData.mSdfSubgrids3DTexBlockDim.y = readDword(mismatch, stream); + sdfData.mSdfSubgrids3DTexBlockDim.z = readDword(mismatch, stream); + + sdfData.mSubgridsMinSdfValue = readFloat(mismatch, stream); + sdfData.mSubgridsMaxSdfValue = readFloat(mismatch, stream); + sdfData.mBytesPerSparsePixel = readDword(mismatch, stream); + + PxReal* sdf = sdfData.allocateSdfs(sdfData.mMeshLower, sdfData.mSpacing, sdfData.mDims.x, sdfData.mDims.y, sdfData.mDims.z, + sdfData.mSubgridSize, sdfData.mSdfSubgrids3DTexBlockDim.x, sdfData.mSdfSubgrids3DTexBlockDim.y, sdfData.mSdfSubgrids3DTexBlockDim.z, + sdfData.mSubgridsMinSdfValue, sdfData.mSubgridsMaxSdfValue, sdfData.mBytesPerSparsePixel); + + stream.read(sdf, sizeof(PxReal) * sdfData.mNumSdfs); + readByteBuffer(sdfData.mSubgridSdf, sdfData.mNumSubgridSdfs, stream); + readIntBuffer(sdfData.mSubgridStartSlots, sdfData.mNumStartSlots, mismatch, stream); + } + + if (serialFlags & IMSF_INERTIA) + { + // Import inertia + stream.read(&data->mMass, sizeof(PxReal)); + readFloatBuffer(&data->mInertia(0, 0), 9, mismatch, stream); + readFloatBuffer(&data->mLocalCenterOfMass.x, 3, mismatch, stream); + } + + return data; +} + +static void readIndices(const PxU32 serialFlags, void* indices, const PxU32 nbIndices, + const bool has16BitIndices, const bool mismatch, PxInputStream& stream) +{ + if(serialFlags & IMSF_8BIT_INDICES) + read8BitIndices(stream, indices, nbIndices, has16BitIndices); + else if(serialFlags & IMSF_16BIT_INDICES) + read16BitIndices(stream, indices, nbIndices, has16BitIndices, mismatch); + else + read32BitIndices(stream, indices, nbIndices, has16BitIndices, mismatch); +} + +void MeshFactory::addTriangleMesh(TriangleMesh* np, bool lock) +{ + addToHash(mTriangleMeshes, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +PxTriangleMesh* MeshFactory::createTriangleMesh(TriangleMeshData& data) +{ + TriangleMesh* np; + + if(data.mType==PxMeshMidPhase::eBVH33) + { + PX_NEW_SERIALIZED(np, RTreeTriangleMesh)(this, data); + } + else if(data.mType==PxMeshMidPhase::eBVH34) + { + PX_NEW_SERIALIZED(np, BV4TriangleMesh)(this, data); + } + else return NULL; + + if(np) + addTriangleMesh(np); + + return np; +} + +// data injected by cooking lib for runtime cooking +PxTriangleMesh* MeshFactory::createTriangleMesh(void* data) +{ + return createTriangleMesh(*reinterpret_cast(data)); +} + +PxTriangleMesh* MeshFactory::createTriangleMesh(PxInputStream& desc) +{ + TriangleMeshData* data = ::loadMeshData(desc); + if(!data) + return NULL; + PxTriangleMesh* m = createTriangleMesh(*data); + PX_DELETE(data); + return m; +} + +bool MeshFactory::removeTriangleMesh(PxTriangleMesh& m) +{ + TriangleMesh* gu = static_cast(&m); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mTriangleMeshes.erase(gu); + return found; +} + +PxU32 MeshFactory::getNbTriangleMeshes() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mTriangleMeshes.size(); +} + +PxU32 MeshFactory::getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mTriangleMeshes.getEntries(), mTriangleMeshes.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +static TetrahedronMeshData* loadTetrahedronMeshData(PxInputStream& stream) +{ + // Import header + PxU32 version; + bool mismatch; + + if (!readHeader('T', 'E', 'M', 'E', version, mismatch, stream)) + return NULL; + + // Import serialization flags + const PxU32 serialFlags = readDword(mismatch, stream); + + TetrahedronMeshData* data = PX_NEW(TetrahedronMeshData); + + // Import mesh + const PxU32 nbVerts = readDword(mismatch, stream); + PxVec3* verts = data->allocateVertices(nbVerts); + + //const PxU32 nbSurfaceTriangles = readDword(mismatch, stream); + + const PxU32 nbTetrahedrons = readDword(mismatch, stream); + + //ML: this will allocate CPU tetrahedron indices and GPU tetrahedron indices and other GPU data if we have GRB data built + //void* tets = data->allocateTetrahedrons(nbTetrahedrons, serialFlags & IMSF_GRB_DATA); + data->allocateTetrahedrons(nbTetrahedrons, 1); + void* tets = data->mTetrahedrons; + + + stream.read(verts, sizeof(PxVec3)*data->mNbVertices); + //stream.read(restPoses, sizeof(PxMat33) * data->mNbTetrahedrons); + + if (mismatch) + { + for (PxU32 i = 0; i < data->mNbVertices; i++) + { + flip(verts[i].x); + flip(verts[i].y); + flip(verts[i].z); + } + } + + //TODO: stop support for format conversion on load!! + const PxU32 nbTetIndices = 4 * data->mNbTetrahedrons; + readIndices(serialFlags, tets, nbTetIndices, data->has16BitIndices(), mismatch, stream); + + // Import local bounds + data->mGeomEpsilon = readFloat(mismatch, stream); + readFloatBuffer(&data->mAABB.minimum.x, 6, mismatch, stream); + + return data; +} + +static bool loadSoftBodyMeshData(PxInputStream& stream, SoftBodyMeshData& data) +{ + // Import header + PxU32 version; + bool mismatch; + + if (!readHeader('S', 'O', 'M', 'E', version, mismatch, stream)) + return false; + + // Import serialization flags + const PxU32 serialFlags = readDword(mismatch, stream); + + // Import mesh + const PxU32 nbVerts = readDword(mismatch, stream); + PxVec3* verts = data.mCollisionMesh.allocateVertices(nbVerts); + + //const PxU32 nbSurfaceTriangles = readDword(mismatch, stream); + + const PxU32 nbTetrahedrons= readDword(mismatch, stream); + + //ML: this will allocate CPU tetrahedron indices and GPU tetrahedron indices and other GPU data if we have GRB data built + //void* tets = data.allocateTetrahedrons(nbTetrahedrons, serialFlags & IMSF_GRB_DATA); + data.mCollisionMesh.allocateTetrahedrons(nbTetrahedrons, 1); + if (serialFlags & IMSF_GRB_DATA) + data.mCollisionData.allocateCollisionData(nbTetrahedrons); + void* tets = data.mCollisionMesh.mTetrahedrons; + //void* surfaceTriangles = data.mCollisionData.allocateSurfaceTriangles(nbSurfaceTriangles); + + //void* restPoses = data.mTetraRestPoses; + + stream.read(verts, sizeof(PxVec3)*nbVerts); + //stream.read(restPoses, sizeof(PxMat33) * data.mNbTetrahedrons); + + if (mismatch) + { + for (PxU32 i = 0; i< nbVerts; i++) + { + flip(verts[i].x); + flip(verts[i].y); + flip(verts[i].z); + } + } + + //TODO: stop support for format conversion on load!! + const PxU32 nbTetIndices = 4 * nbTetrahedrons; + readIndices(serialFlags, tets, nbTetIndices, data.mCollisionMesh.has16BitIndices(), mismatch, stream); + + //const PxU32 nbSurfaceTriangleIndices = 3 * nbSurfaceTriangles; + //readIndices(serialFlags, surfaceTriangles, nbSurfaceTriangleIndices, data.mCollisionMesh.has16BitIndices(), mismatch, stream); + + ////using IMSF_ADJACENCIES for tetMesh tetrahedron surface hint + //if (serialFlags & IMSF_ADJACENCIES) + //{ + // PxU8* surfaceHints = reinterpret_cast(data.mTetraSurfaceHint); + // stream.read(surfaceHints, sizeof(PxU8)*data.mNbTetrahedrons); + //} + + if (serialFlags & IMSF_MATERIALS) + { + PxU16* materials = data.mCollisionMesh.allocateMaterials(); + stream.read(materials, sizeof(PxU16)*nbTetrahedrons); + if (mismatch) + { + for (PxU32 i = 0; i < nbTetrahedrons; i++) + flip(materials[i]); + } + } + + if (serialFlags & IMSF_FACE_REMAP) + { + PxU32* remap = data.mCollisionData.allocateFaceRemap(nbTetrahedrons); + readIndices(readDword(mismatch, stream), nbTetrahedrons, remap, stream, mismatch); + } + + /*if (serialFlags & IMSF_ADJACENCIES) + { + PxU32* adj = data.allocateAdjacencies(); + stream.read(adj, sizeof(PxU32)*data.mNbTetrahedrons * 4); + if (mismatch) + { + for (PxU32 i = 0; imCollisionData.mBV4Tree.load(stream, mismatch)) + { + outputError(__LINE__, "BV4 binary image load error."); + //PX_DELETE(data); + return false; + } + + bv4data->mCollisionData.mMeshInterface.setNbTetrahedrons(nbTetrahedrons); + bv4data->mCollisionData.mMeshInterface.setNbVertices(nbVerts); + if (data.mCollisionMesh.has16BitIndices()) + bv4data->mCollisionData.mMeshInterface.setPointers(NULL, reinterpret_cast(tets), verts); + else + bv4data->mCollisionData.mMeshInterface.setPointers(reinterpret_cast(tets), NULL, verts); + + bv4data->mCollisionData.mBV4Tree.mMeshInterface = &bv4data->mCollisionData.mMeshInterface; + + // Import local bounds + data.mCollisionMesh.mGeomEpsilon = readFloat(mismatch, stream); + readFloatBuffer(&data.mCollisionMesh.mAABB.minimum.x, 6, mismatch, stream); + + if (serialFlags & IMSF_GRB_DATA) + { + /*PxU32 GRB_meshAdjVerticiesTotal = 0; + if (version < 15) + GRB_meshAdjVerticiesTotal = readDword(mismatch, stream);*/ + + //read grb tetrahedron indices + PX_ASSERT(data.mCollisionData.mGRB_primIndices); + + //read tetrahedron indices + readIndices(serialFlags, data.mCollisionData.mGRB_primIndices, nbTetIndices, data.mCollisionMesh.has16BitIndices(), mismatch, stream); + + //data.mGRB_primAdjacencies = static_cast(PX_NEW(PxU32)[data.mNbTetrahedrons * 4]); + + //data.mGRB_surfaceTriIndices = static_cast(PX_NEW(PxU32)[data.mNbTriangles * 3]); + data.mCollisionData.mGRB_faceRemap = PX_ALLOCATE(PxU32, data.mCollisionMesh.mNbTetrahedrons, "mGRB_faceRemap"); + + data.mCollisionData.mGRB_faceRemapInverse = PX_ALLOCATE(PxU32, data.mCollisionMesh.mNbTetrahedrons, "mGRB_faceRemapInverse"); + + //data.mGRB_surfaceTriangleIndice = PX_NEW(PxU32)[data.mNbSurfaceTriangles * 3]; + + //stream.read(data.mGRB_primAdjacencies, sizeof(PxU32)*data.mNbTetrahedrons * 4); + stream.read(data.mCollisionData.mGRB_tetraSurfaceHint, sizeof(PxU8) * data.mCollisionMesh.mNbTetrahedrons); + stream.read(data.mCollisionData.mGRB_faceRemap, sizeof(PxU32) * data.mCollisionMesh.mNbTetrahedrons); + stream.read(data.mCollisionData.mGRB_faceRemapInverse, sizeof(PxU32) * data.mCollisionMesh.mNbTetrahedrons); + //stream.read(data.mGRB_surfaceTriangleIndice, sizeof(PxU32) * data.mNbSurfaceTriangles * 3); + + stream.read(data.mCollisionData.mTetraRestPoses, sizeof(PxMat33) * nbTetrahedrons); + + if (mismatch) + { + for (PxU32 i = 0; i(data.mCollisionData.mGRB_primIndices)[i]); + } + + //read BV32 + data.mCollisionData.mGRB_BV32Tree = PX_NEW(BV32Tree); + if (!data.mCollisionData.mGRB_BV32Tree->load(stream, mismatch)) + { + outputError(__LINE__, "BV32 binary image load error."); + //PX_DELETE(data); + return false; + } + + const PxU32 nbGridModelTetrahedrons = readDword(mismatch, stream); + const PxU32 nbGridModelVertices = readDword(mismatch, stream); + const PxU32 nbGridModelPartitions = readDword(mismatch, stream); + const PxU32 nbGMMaxTetsPerPartition = readDword(mismatch, stream); + const PxU32 nbGMRemapOutputSize = readDword(mismatch, stream); + PxU32 numTetsPerElement = 4; + if(version >= 2) + numTetsPerElement = readDword(mismatch, stream); + const PxU32 nbGMTotalTetReferenceCount = readDword(mismatch, stream); + const PxU32 nbTetRemapSize = readDword(mismatch, stream); + + const PxU32 numVertsPerElement = numTetsPerElement == 6 ? 8 : 4; + const PxU32 numSimElements = nbGridModelTetrahedrons / numTetsPerElement; + + data.mSimulationData.mGridModelMaxTetsPerPartitions = nbGMMaxTetsPerPartition; + data.mSimulationData.mNumTetsPerElement = numTetsPerElement; + data.mMappingData.mTetsRemapSize = nbTetRemapSize; + + /*data.allocateGridModelData(nbGridModelTetrahedrons, nbGridModelVertices, + data.mCollisionMesh.mNbVertices, nbGridModelPartitions, nbGMRemapOutputSize, + nbGMTotalTetReferenceCount, nbTetRemapSize, data.mCollisionMesh.mNbTetrahedrons, + serialFlags & IMSF_GRB_DATA);*/ + data.mSimulationMesh.allocateTetrahedrons(nbGridModelTetrahedrons, serialFlags & IMSF_GRB_DATA); + data.mSimulationMesh.allocateVertices(nbGridModelVertices, serialFlags & IMSF_GRB_DATA); + data.mSimulationData.allocateGridModelData(nbGridModelTetrahedrons, nbGridModelVertices, + data.mCollisionMesh.mNbVertices, nbGridModelPartitions, nbGMRemapOutputSize, numTetsPerElement, serialFlags & IMSF_GRB_DATA); + data.mMappingData.allocatemappingData(data.mCollisionMesh.mNbVertices, nbTetRemapSize, data.mCollisionMesh.mNbTetrahedrons, serialFlags & IMSF_GRB_DATA); + + data.mMappingData.allocateTetRefData(nbGMTotalTetReferenceCount, data.mCollisionMesh.mNbVertices, serialFlags & IMSF_GRB_DATA); + + const PxU32 nbGridModelIndices = 4 * nbGridModelTetrahedrons; + readIndices(serialFlags, data.mSimulationMesh.mTetrahedrons, nbGridModelIndices, data.mSimulationMesh.has16BitIndices(), mismatch, stream); + + //stream.read(data.mGridModelVerticesInvMass, sizeof(PxVec4) * nbGridModelVertices); + stream.read(data.mSimulationMesh.mVertices, sizeof(PxVec3) * nbGridModelVertices); + + if (serialFlags & IMSF_MATERIALS) + { + PxU16* materials = data.mSimulationMesh.allocateMaterials(); + stream.read(materials, sizeof(PxU16)*nbGridModelTetrahedrons); + if (mismatch) + { + for (PxU32 i = 0; i < nbTetrahedrons; i++) + flip(materials[i]); + } + } + stream.read(data.mSimulationData.mGridModelInvMass, sizeof(PxReal) * nbGridModelVertices); + + stream.read(data.mSimulationData.mGridModelTetraRestPoses, sizeof(PxMat33) * nbGridModelTetrahedrons); + + stream.read(data.mSimulationData.mGridModelOrderedTetrahedrons, sizeof(PxU32) * numSimElements); + + stream.read(data.mSimulationData.mGMRemapOutputCP, sizeof(PxU32) * numSimElements * numVertsPerElement); + + stream.read(data.mSimulationData.mGMAccumulatedPartitionsCP, sizeof(PxU32) * nbGridModelPartitions); + + stream.read(data.mSimulationData.mGMAccumulatedCopiesCP, sizeof(PxU32) * data.mSimulationMesh.mNbVertices); + + stream.read(data.mMappingData.mCollisionAccumulatedTetrahedronsRef, sizeof(PxU32) * data.mCollisionMesh.mNbVertices); + + stream.read(data.mMappingData.mCollisionTetrahedronsReferences, sizeof(PxU32) * data.mMappingData.mCollisionNbTetrahedronsReferences); + + stream.read(data.mMappingData.mCollisionSurfaceVertsHint, sizeof(PxU8) * data.mCollisionMesh.mNbVertices); + + stream.read(data.mMappingData.mCollisionSurfaceVertToTetRemap, sizeof(PxU32) * data.mCollisionMesh.mNbVertices); + + //stream.read(data->mVertsBarycentricInGridModel, sizeof(PxReal) * 4 * data->mNbVertices); + stream.read(data.mSimulationData.mGMPullIndices, sizeof(PxU32) * numSimElements * numVertsPerElement); + + //stream.read(data->mVertsBarycentricInGridModel, sizeof(PxReal) * 4 * data->mNbVertices); + stream.read(data.mMappingData.mVertsBarycentricInGridModel, sizeof(PxReal) * 4 * data.mCollisionMesh.mNbVertices); + + stream.read(data.mMappingData.mVertsRemapInGridModel, sizeof(PxU32) * data.mCollisionMesh.mNbVertices); + + stream.read(data.mMappingData.mTetsRemapColToSim, sizeof(PxU32) *nbTetRemapSize); + + stream.read(data.mMappingData.mTetsAccumulatedRemapColToSim, sizeof(PxU32) * data.mCollisionMesh.mNbTetrahedrons); + } + return true; +} + +void MeshFactory::addTetrahedronMesh(TetrahedronMesh* np, bool lock) +{ + addToHash(mTetrahedronMeshes, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +void MeshFactory::addSoftBodyMesh(SoftBodyMesh* np, bool lock) +{ + addToHash(mSoftBodyMeshes, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +PxSoftBodyMesh* MeshFactory::createSoftBodyMesh(PxInputStream& desc) +{ + TetrahedronMeshData mSimulationMesh; + SoftBodySimulationData mSimulationData; + TetrahedronMeshData mCollisionMesh; + SoftBodyCollisionData mCollisionData; + CollisionMeshMappingData mMappingData; + SoftBodyMeshData data(mSimulationMesh, mSimulationData, mCollisionMesh, mCollisionData, mMappingData); + if (!::loadSoftBodyMeshData(desc, data)) + return NULL; + PxSoftBodyMesh* m = createSoftBodyMesh(data); + //PX_DELETE(data); + return m; +} + +PxTetrahedronMesh* MeshFactory::createTetrahedronMesh(PxInputStream& desc) +{ + TetrahedronMeshData* data = ::loadTetrahedronMeshData(desc); + if (!data) + return NULL; + PxTetrahedronMesh* m = createTetrahedronMesh(*data); + PX_DELETE(data); + return m; +} + +PxTetrahedronMesh* MeshFactory::createTetrahedronMesh(TetrahedronMeshData& data) +{ + TetrahedronMesh* np = NULL; + PX_NEW_SERIALIZED(np, TetrahedronMesh)(this, data); + //PX_ASSERT(false); + //PX_UNUSED(data); + + if (np) + addTetrahedronMesh(np); + + return np; +} + +// data injected by cooking lib for runtime cooking +PxTetrahedronMesh* MeshFactory::createTetrahedronMesh(void* data) +{ + return createTetrahedronMesh(*reinterpret_cast(data)); +} + +PxSoftBodyMesh* MeshFactory::createSoftBodyMesh(Gu::SoftBodyMeshData& data) +{ + SoftBodyMesh* np = NULL; + PX_NEW_SERIALIZED(np, SoftBodyMesh)(this, data); + + if (np) + addSoftBodyMesh(np); + + return np; +} + +// data injected by cooking lib for runtime cooking +PxSoftBodyMesh* MeshFactory::createSoftBodyMesh(void* data) +{ + return createSoftBodyMesh(*reinterpret_cast(data)); +} + +bool MeshFactory::removeSoftBodyMesh(PxSoftBodyMesh& tetMesh) +{ + SoftBodyMesh* gu = static_cast(&tetMesh); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mSoftBodyMeshes.erase(gu); + return found; +} + +bool MeshFactory::removeTetrahedronMesh(PxTetrahedronMesh& tetMesh) +{ + TetrahedronMesh* gu = static_cast(&tetMesh); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mTetrahedronMeshes.erase(gu); + return found; +} + +PxU32 MeshFactory::getNbSoftBodyMeshes() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mSoftBodyMeshes.size(); +} + +PxU32 MeshFactory::getNbTetrahedronMeshes() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mTetrahedronMeshes.size(); +} + +PxU32 MeshFactory::getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mTetrahedronMeshes.getEntries(), mTetrahedronMeshes.size()); +} + +PxU32 MeshFactory::getSoftBodyMeshes(PxSoftBodyMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mSoftBodyMeshes.getEntries(), mSoftBodyMeshes.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void MeshFactory::addConvexMesh(ConvexMesh* np, bool lock) +{ + addToHash(mConvexMeshes, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +// data injected by cooking lib for runtime cooking +PxConvexMesh* MeshFactory::createConvexMesh(void* data) +{ + return createConvexMesh(*reinterpret_cast(data)); +} + +PxConvexMesh* MeshFactory::createConvexMesh(ConvexHullInitData& data) +{ + ConvexMesh* np; + PX_NEW_SERIALIZED(np, ConvexMesh)(this, data); + if (np) + addConvexMesh(np); + + return np; +} + +PxConvexMesh* MeshFactory::createConvexMesh(PxInputStream& desc) +{ + ConvexMesh* np; + PX_NEW_SERIALIZED(np, ConvexMesh)(this); + if(!np) + return NULL; + + if(!np->load(desc)) + { + RefCountable_decRefCount(*np); + return NULL; + } + + addConvexMesh(np); + return np; +} + +bool MeshFactory::removeConvexMesh(PxConvexMesh& m) +{ + ConvexMesh* gu = static_cast(&m); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mConvexMeshes.erase(gu); + return found; +} + +PxU32 MeshFactory::getNbConvexMeshes() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mConvexMeshes.size(); +} + +PxU32 MeshFactory::getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mConvexMeshes.getEntries(), mConvexMeshes.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void MeshFactory::addHeightField(HeightField* np, bool lock) +{ + addToHash(mHeightFields, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +PxHeightField* MeshFactory::createHeightField(void* heightFieldMeshData) +{ + HeightField* np; + PX_NEW_SERIALIZED(np, HeightField)(this, *reinterpret_cast(heightFieldMeshData)); + if(np) + addHeightField(np); + + return np; +} + +PxHeightField* MeshFactory::createHeightField(PxInputStream& stream) +{ + HeightField* np; + PX_NEW_SERIALIZED(np, HeightField)(this); + if(!np) + return NULL; + + if(!np->load(stream)) + { + RefCountable_decRefCount(*np); + return NULL; + } + + addHeightField(np); + return np; +} + +bool MeshFactory::removeHeightField(PxHeightField& hf) +{ + HeightField* gu = static_cast(&hf); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mHeightFields.erase(gu); + return found; +} + +PxU32 MeshFactory::getNbHeightFields() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mHeightFields.size(); +} + +PxU32 MeshFactory::getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mHeightFields.getEntries(), mHeightFields.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void MeshFactory::addFactoryListener(Gu::MeshFactoryListener& listener ) +{ + PxMutex::ScopedLock lock(mTrackingMutex); + mFactoryListeners.pushBack( &listener ); +} + +void MeshFactory::removeFactoryListener(Gu::MeshFactoryListener& listener ) +{ + PxMutex::ScopedLock lock(mTrackingMutex); + for ( PxU32 idx = 0; idx < mFactoryListeners.size(); ++idx ) + { + if ( mFactoryListeners[idx] == &listener ) + { + mFactoryListeners.replaceWithLast( idx ); + --idx; + } + } +} + +void MeshFactory::notifyFactoryListener(const PxBase* base, PxType typeID) +{ + const PxU32 nbListeners = mFactoryListeners.size(); + for(PxU32 i=0; ionMeshFactoryBufferRelease(base, typeID); +} + +#if PX_SUPPORT_OMNI_PVD +void MeshFactory::notifyListenersAdd(const PxBase* base) +{ + for (PxU32 i = 0; i < mFactoryListeners.size(); i++) + mFactoryListeners[i]->onObjectAdd(base); +} +void MeshFactory::notifyListenersRemove(const PxBase* base) +{ + for (PxU32 i = 0; i < mFactoryListeners.size(); i++) + mFactoryListeners[i]->onObjectRemove(base); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void MeshFactory::addBVH(BVH* np, bool lock) +{ + addToHash(mBVHs, np, lock ? &mTrackingMutex : NULL); + OMNI_PVD_NOTIFY_ADD(np); +} + +// data injected by cooking lib for runtime cooking +PxBVH* MeshFactory::createBVH(void* data) +{ + return createBVH(*reinterpret_cast(data)); +} + +PxBVH* MeshFactory::createBVH(BVHData& data) +{ + BVH* np; + PX_NEW_SERIALIZED(np, BVH)(this, data); + if (np) + addBVH(np); + + return np; +} + +PxBVH* MeshFactory::createBVH(PxInputStream& desc) +{ + BVH* np; + PX_NEW_SERIALIZED(np, BVH)(this); + if(!np) + return NULL; + + if(!np->load(desc)) + { + np->decRefCount(); + return NULL; + } + + addBVH(np); + return np; +} + +bool MeshFactory::removeBVH(PxBVH& m) +{ + BVH* gu = static_cast(&m); + OMNI_PVD_NOTIFY_REMOVE(gu); + PxMutex::ScopedLock lock(mTrackingMutex); + bool found = mBVHs.erase(gu); + return found; +} + +PxU32 MeshFactory::getNbBVHs() const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return mBVHs.size(); +} + +PxU32 MeshFactory::getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(mTrackingMutex); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mBVHs.getEntries(), mBVHs.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool MeshFactory::remove(PxBase& obj) +{ + const PxType type = obj.getConcreteType(); + if(type==PxConcreteType::eHEIGHTFIELD) + return removeHeightField(static_cast(obj)); + else if(type==PxConcreteType::eCONVEX_MESH) + return removeConvexMesh(static_cast(obj)); + else if(type==PxConcreteType::eTRIANGLE_MESH_BVH33 || type==PxConcreteType::eTRIANGLE_MESH_BVH34) + return removeTriangleMesh(static_cast(obj)); + else if(type==PxConcreteType::eTETRAHEDRON_MESH) + return removeTetrahedronMesh(static_cast(obj)); + else if (type == PxConcreteType::eSOFTBODY_MESH) + return removeSoftBodyMesh(static_cast(obj)); + else if(type==PxConcreteType::eBVH) + return removeBVH(static_cast(obj)); + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class StandaloneInsertionCallback : public PxInsertionCallback + { + public: + StandaloneInsertionCallback() {} + + virtual PxBase* buildObjectFromData(PxConcreteType::Enum type, void* data) + { + if(type == PxConcreteType::eTRIANGLE_MESH_BVH33) + { + TriangleMesh* np; + PX_NEW_SERIALIZED(np, RTreeTriangleMesh)(NULL, *reinterpret_cast(data)); + return np; + } + + if(type == PxConcreteType::eTRIANGLE_MESH_BVH34) + { + TriangleMesh* np; + PX_NEW_SERIALIZED(np, BV4TriangleMesh)(NULL, *reinterpret_cast(data)); + return np; + } + + if(type == PxConcreteType::eCONVEX_MESH) + { + ConvexMesh* np; + PX_NEW_SERIALIZED(np, ConvexMesh)(NULL, *reinterpret_cast(data)); + return np; + } + + if(type == PxConcreteType::eHEIGHTFIELD) + { + HeightField* np; + PX_NEW_SERIALIZED(np, HeightField)(NULL, *reinterpret_cast(data)); + return np; + } + + if(type == PxConcreteType::eBVH) + { + BVH* np; + PX_NEW_SERIALIZED(np, BVH)(NULL, *reinterpret_cast(data)); + return np; + } + + if (type == PxConcreteType::eTETRAHEDRON_MESH) + { + TetrahedronMesh* np; + PX_NEW_SERIALIZED(np, TetrahedronMesh)(NULL, *reinterpret_cast(data)); + return np; + } + + if (type == PxConcreteType::eSOFTBODY_MESH) + { + SoftBodyMesh* np; + PX_NEW_SERIALIZED(np, SoftBodyMesh)(NULL, *reinterpret_cast(data)); + return np; + } + + outputError(__LINE__, "Inserting object failed: " + "Object type not supported for buildObjectFromData."); + return NULL; + } + }gSAIC; +} + +PxInsertionCallback* physx::immediateCooking::getInsertionCallback() +{ + return &gSAIC; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.h new file mode 100644 index 0000000..7ede379 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMeshFactory.h @@ -0,0 +1,199 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_MESH_FACTORY_H +#define GU_MESH_FACTORY_H + +#include "foundation/PxIO.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxUserAllocated.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxBVH.h" +#include "PxPhysXConfig.h" + +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" + +// PT: added for platforms that compile the onRefCountZero template immediately +#include "CmUtils.h" +#include "foundation/PxFoundation.h" + +namespace physx +{ +namespace Gu +{ + class ConvexMesh; + class HeightField; + class TriangleMesh; + class TriangleMeshData; + class SoftBodyMesh; + class SoftBodyMeshData; + class TetrahedronMesh; + class TetrahedronMeshData; + class BVH; + struct ConvexHullInitData; + class BVHData; + + class MeshFactoryListener + { + protected: + virtual ~MeshFactoryListener(){} + public: + virtual void onMeshFactoryBufferRelease(const PxBase* object, PxType type) = 0; +#if PX_SUPPORT_OMNI_PVD + virtual void onObjectAdd(const PxBase*) {} + virtual void onObjectRemove(const PxBase*) {} +#endif + }; + + #if PX_VC + #pragma warning(push) + #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class + #endif + + class PX_PHYSX_COMMON_API MeshFactory : public PxUserAllocated + { + PX_NOCOPY(MeshFactory) + public: + MeshFactory(); + protected: + virtual ~MeshFactory(); + + public: + void release(); + + // Triangle meshes + void addTriangleMesh(Gu::TriangleMesh* np, bool lock=true); + PxTriangleMesh* createTriangleMesh(PxInputStream& stream); + PxTriangleMesh* createTriangleMesh(void* triangleMeshData); + bool removeTriangleMesh(PxTriangleMesh&); + PxU32 getNbTriangleMeshes() const; + PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Tetrahedron meshes + void addTetrahedronMesh(Gu::TetrahedronMesh* np, bool lock = true); + PxTetrahedronMesh* createTetrahedronMesh(PxInputStream& stream); + PxTetrahedronMesh* createTetrahedronMesh(void* tetrahedronMeshData); + bool removeTetrahedronMesh(PxTetrahedronMesh&); + PxU32 getNbTetrahedronMeshes() const; + PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // SoftBody meshes + void addSoftBodyMesh(Gu::SoftBodyMesh* np, bool lock = true); + PxSoftBodyMesh* createSoftBodyMesh(PxInputStream& stream); + PxSoftBodyMesh* createSoftBodyMesh(void* tetrahedronMeshData); + bool removeSoftBodyMesh(PxSoftBodyMesh&); + PxU32 getNbSoftBodyMeshes() const; + PxU32 getSoftBodyMeshes(PxSoftBodyMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Convexes + void addConvexMesh(Gu::ConvexMesh* np, bool lock=true); + PxConvexMesh* createConvexMesh(PxInputStream&); + PxConvexMesh* createConvexMesh(void* convexMeshData); + bool removeConvexMesh(PxConvexMesh&); + PxU32 getNbConvexMeshes() const; + PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Heightfields + void addHeightField(Gu::HeightField* np, bool lock=true); + PxHeightField* createHeightField(void* heightFieldMeshData); + PxHeightField* createHeightField(PxInputStream&); + bool removeHeightField(PxHeightField&); + PxU32 getNbHeightFields() const; + PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // BVH + void addBVH(Gu::BVH* np, bool lock=true); + PxBVH* createBVH(PxInputStream&); + PxBVH* createBVH(void* bvhData); + bool removeBVH(PxBVH&); + PxU32 getNbBVHs() const; + PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + void addFactoryListener(MeshFactoryListener& listener); + void removeFactoryListener(MeshFactoryListener& listener); + void notifyFactoryListener(const PxBase*, PxType typeID); + + bool remove(PxBase&); + + protected: + + PxTriangleMesh* createTriangleMesh(Gu::TriangleMeshData& data); + PxTetrahedronMesh* createTetrahedronMesh(Gu::TetrahedronMeshData& data); + PxSoftBodyMesh* createSoftBodyMesh(Gu::SoftBodyMeshData& data); + PxConvexMesh* createConvexMesh(Gu::ConvexHullInitData& data); + PxBVH* createBVH(Gu::BVHData& data); + + mutable PxMutex mTrackingMutex; + private: + PxCoalescedHashSet mTriangleMeshes; + PxCoalescedHashSet mTetrahedronMeshes; + PxCoalescedHashSet mSoftBodyMeshes; + PxCoalescedHashSet mConvexMeshes; + PxCoalescedHashSet mHeightFields; + PxCoalescedHashSet mBVHs; + + PxArray mFactoryListeners; + +#if PX_SUPPORT_OMNI_PVD + protected: + void notifyListenersAdd(const PxBase*); + void notifyListenersRemove(const PxBase*); +#endif + }; + #if PX_VC + #pragma warning(pop) + #endif + + template + PX_INLINE void onRefCountZero(T* object, Gu::MeshFactory* mf, bool cndt, const char* errorMsg) + { + if(mf) + { + if(cndt || mf->remove(*object)) + { + const PxType type = object->getConcreteType(); + Cm::deletePxBase(object); + mf->notifyFactoryListener(object, type); + return; + } + + // PT: if we reach this point, we didn't find the mesh in the Physics object => don't delete! + // This prevents deleting the object twice. + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, errorMsg); + } + else + Cm::deletePxBase(object); + } + } + +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp new file mode 100644 index 0000000..7c14099 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuMetaData.cpp @@ -0,0 +1,485 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIO.h" +#include "common/PxMetaData.h" +#include "GuHeightField.h" +#include "GuConvexMeshData.h" +#include "GuBigConvexData2.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "GuTriangleMeshBV4.h" +#include "GuTriangleMeshRTree.h" +#include "foundation/PxIntrinsics.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_Valency(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, Valency) + PX_DEF_BIN_METADATA_ITEM(stream, Valency, PxU16, mCount, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Valency, PxU16, mOffset, 0) +} + +static void getBinaryMetaData_BigConvexRawData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, BigConvexRawData) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU16, mSubdiv, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU16, mNbSamples, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU8, mSamples, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU32, mNbVerts, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU32, mNbAdjVerts, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, Valency, mValencies, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexRawData, PxU8, mAdjacentVerts, PxMetaDataFlag::ePTR) +} + +void SDF::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, SDF) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxVec3, mMeshLower, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxReal, mSpacing, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, Dim3, mDims, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxReal, mNumSdfs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxReal, mSdf, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU32, mSubgridSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU32, mNumStartSlots, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU32, mSubgridStartSlots, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU32, mNumSubgridSdfs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU8, mSubgridSdf, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, Dim3, mSdfSubgrids3DTexBlockDim, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxReal, mSubgridsMinSdfValue, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxReal, mSubgridsMaxSdfValue, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SDF, PxU32, mBytesPerSparsePixel, 0) +} + +void BigConvexData::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_Valency(stream); + getBinaryMetaData_BigConvexRawData(stream); + + PX_DEF_BIN_METADATA_CLASS(stream, BigConvexData) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexData, BigConvexRawData, mData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BigConvexData, void, mVBuffer, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + // mData.mSamples + // PT: can't use one array of PxU16 since we don't want to flip those bytes during conversion. + // PT: We only align the first array for DE1340, but the second one shouldn't be aligned since + // both are written as one unique block of memory. + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, BigConvexData, PxU8, mData.mNbSamples, PX_SERIAL_ALIGN, 0) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, BigConvexData, PxU8, mData.mNbSamples, 0, 0) + + // mData.mValencies + // PT: same here, we must only align the first array + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, BigConvexData, Valency, mData.mNbVerts, PX_SERIAL_ALIGN, 0) + PX_DEF_BIN_METADATA_EXTRA_ALIGN(stream, BigConvexData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, BigConvexData, PxU8, mData.mNbAdjVerts, 0, 0) +} + +static void getBinaryMetaData_InternalObjectsData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, InternalObjectsData) + PX_DEF_BIN_METADATA_ITEM(stream, InternalObjectsData, PxReal, mRadius, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, InternalObjectsData, PxReal, mExtents, 0) +} + +static void getBinaryMetaData_HullPolygonData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, HullPolygonData) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, HullPolygonData, PxReal, mPlane, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HullPolygonData, PxU16, mVRef8, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HullPolygonData, PxU8, mNbVerts, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HullPolygonData, PxU8, mMinIndex, 0) +} + +static void getBinaryMetaData_ConvexHullData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ConvexHullData) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, PxBounds3, mAABB, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, PxVec3, mCenterOfMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, HullPolygonData, mPolygons, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, BigConvexRawData, mBigConvexRawData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, SDF, mSdfData, PxMetaDataFlag::ePTR) + + //ML: the most significant bit of mNbEdges is used to indicate whether we have grb data or not. However, we don't support grb data + //in serialization so we have to mask the most significant bit and force the contact gen run on CPU code path + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, PxU16, mNbEdges, PxMetaDataFlag::eCOUNT_MASK_MSB) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, PxU8, mNbHullVertices, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, PxU8, mNbPolygons, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexHullData, InternalObjectsData, mInternal, 0) +} + +void Gu::ConvexMesh::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_InternalObjectsData(stream); + getBinaryMetaData_HullPolygonData(stream); + getBinaryMetaData_ConvexHullData(stream); + BigConvexData::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream,ConvexMesh) + PX_DEF_BIN_METADATA_BASE_CLASS(stream,ConvexMesh, PxBase) + + // + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, ConvexHullData, mHullData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, PxU32, mNb, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, SDF, mSdfData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, BigConvexData, mBigConvexData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, PxReal, mMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, PxMat33, mInertia, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConvexMesh, GuMeshFactory, mMeshFactory, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + // mHullData.mPolygons (Gu::HullPolygonData, PxVec3, PxU8*2, PxU8) + // PT: we only align the first array since the other ones are contained within it + + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, HullPolygonData, mHullData.mNbPolygons, PX_SERIAL_ALIGN, 0) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxVec3, mHullData.mNbHullVertices, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mHullData.mNbEdges, 0, PxMetaDataFlag::eCOUNT_MASK_MSB) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mHullData.mNbEdges, 0, PxMetaDataFlag::eCOUNT_MASK_MSB) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mHullData.mNbHullVertices, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mHullData.mNbHullVertices, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mHullData.mNbHullVertices, 0, 0) + + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, Gu::ConvexMesh, PxU8, mNb, 0, PxMetaDataFlag::eCOUNT_MASK_MSB) + PX_DEF_BIN_METADATA_EXTRA_ALIGN(stream, ConvexMesh, 4) + // mBigConvexData + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, Gu::ConvexMesh, BigConvexData, mBigConvexData, PX_SERIAL_ALIGN) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PxHeightFieldSample(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxHeightFieldSample) + PX_DEF_BIN_METADATA_ITEM(stream, PxHeightFieldSample, PxI16, height, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxHeightFieldSample, PxBitAndByte, materialIndex0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxHeightFieldSample, PxBitAndByte, materialIndex1, 0) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxBitAndByte, PxU8) +} + +static void getBinaryMetaData_HeightFieldData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxHeightFieldFlags, PxU16) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxHeightFieldFormat::Enum, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, HeightFieldData) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxBounds3, mAABB, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU32, rows, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU32, columns, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU32, rowLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU32, colLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU32, nbColumns, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxHeightFieldSample, samples, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxReal, convexEdgeThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxHeightFieldFlags, flags, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxU16, paddAfterFlags, PxMetaDataFlag::ePADDING) +#endif + PX_DEF_BIN_METADATA_ITEM(stream, HeightFieldData, PxHeightFieldFormat::Enum, format, 0) +} + +void Gu::HeightField::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_PxHeightFieldSample(stream); + getBinaryMetaData_HeightFieldData(stream); + + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxMaterialTableIndex, PxU16) + + PX_DEF_BIN_METADATA_VCLASS(stream, HeightField) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, HeightField, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, HeightFieldData, mData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, PxU32, mSampleStride, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, PxU32, mNbSamples, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, PxReal, mMinHeight, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, PxReal, mMaxHeight, 0) + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, PxU32, mModifyCount, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, HeightField, GuMeshFactory, mMeshFactory, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + // mData.samples + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, HeightField, PxHeightFieldSample, mNbSamples, PX_SERIAL_ALIGN, 0) // PT: ### try to remove mNbSamples later +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_RTreePage(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, RTreePage) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, minx, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, miny, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, minz, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, maxx, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, maxy, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxReal, maxz, 0, RTREE_N) + PX_DEF_BIN_METADATA_ITEMS(stream, RTreePage, PxU32, ptrs, 0, RTREE_N) +} + +void RTree::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_RTreePage(stream); + + PX_DEF_BIN_METADATA_CLASS(stream, RTree) + + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxVec4, mBoundsMin, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxVec4, mBoundsMax, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxVec4, mInvDiagonal, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxVec4, mDiagonalScaler, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mPageSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mNumRootPages, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mNumLevels, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mTotalNodes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mTotalPages, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, PxU32, mFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RTree, RTreePage, mPages, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + // mPages + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream,RTree, RTreePage, mTotalPages, 128, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void SourceMeshBase::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, SourceMeshBase) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMeshBase, PxU32, mNbVerts, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMeshBase, PxVec3, mVerts, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMeshBase, PxU32, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMeshBase, PxU32, mRemap, PxMetaDataFlag::ePTR) +} + +void SourceMesh::getBinaryMetaData(PxOutputStream& stream) +{ + // SourceMesh + PX_DEF_BIN_METADATA_VCLASS(stream, SourceMesh) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, SourceMesh, SourceMeshBase) + + PX_DEF_BIN_METADATA_ITEM(stream, SourceMesh, PxU32, mNbTris, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMesh, void, mTriangles32, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, SourceMesh, void, mTriangles16, PxMetaDataFlag::ePTR) +} + +static void getBinaryMetaData_BVDataPackedQ(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, QuantizedAABB) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxU16, mData[0].mExtents, 0) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxI16, mData[0].mCenter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxU16, mData[1].mExtents, 0) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxI16, mData[1].mCenter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxU16, mData[2].mExtents, 0) + PX_DEF_BIN_METADATA_ITEM(stream, QuantizedAABB, PxI16, mData[2].mCenter, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, BVDataPackedQ) + PX_DEF_BIN_METADATA_ITEM(stream, BVDataPackedQ, QuantizedAABB, mAABB, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BVDataPackedQ, PxU32, mData, 0) +} + +static void getBinaryMetaData_BVDataPackedNQ(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, CenterExtents) + PX_DEF_BIN_METADATA_ITEM(stream, CenterExtents, PxVec3, mCenter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, CenterExtents, PxVec3, mExtents, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, BVDataPackedNQ) + PX_DEF_BIN_METADATA_ITEM(stream, BVDataPackedNQ, CenterExtents, mAABB, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BVDataPackedNQ, PxU32, mData, 0) +} + +void BV4Tree::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_BVDataPackedQ(stream); + getBinaryMetaData_BVDataPackedNQ(stream); + + PX_DEF_BIN_METADATA_CLASS(stream, LocalBounds) + PX_DEF_BIN_METADATA_ITEM(stream, LocalBounds, PxVec3, mCenter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, LocalBounds, float, mExtentsMagnitude, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, BV4Tree) + + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, void, mMeshInterface, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, LocalBounds, mLocalBounds, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, PxU32, mNbNodes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, void, mNodes, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, PxU32, mInitData, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, PxVec3, mCenterOrMinCoeff, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, PxVec3, mExtentsOrMaxCoeff, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, bool, mUserAllocated, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, bool, mQuantized, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, bool, mIsEdgeSet, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4Tree, bool, mPadding, PxMetaDataFlag::ePADDING) + + //------ Extra-data ------ + +// PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream, BV4Tree, BVDataPackedQ, mNbNodes, 16, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, BV4Tree, BVDataPackedQ, mQuantized, mNbNodes, PxMetaDataFlag::Enum(0), PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, BV4Tree, BVDataPackedNQ, mQuantized, mNbNodes, PxMetaDataFlag::eCONTROL_FLIP, PX_SERIAL_ALIGN) +} + +/////////////////////////////////////////////////////////////////////////////// + +void Gu::TriangleMesh::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, TriangleMesh) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, TriangleMesh, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mNbVertices, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mNbTriangles, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxVec3, mVertices, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, void, mTriangles, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxBounds3, mAABB, 0) // PT: warning, this is actually a CenterExtents + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU8, mExtraTrigData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mGeomEpsilon, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU8, mFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU16, mMaterialIndices, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mFaceRemap, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mAdjacencies, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, GuMeshFactory, mMeshFactory, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, void, mEdgeList, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxMat33, mInertia, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxVec3, mLocalCenterOfMass, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, void, mGRB_triIndices, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, void, mGRB_triAdjacencies, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mGRB_faceRemap, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mGRB_faceRemapInverse, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, void, mGRB_BV32Tree, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxVec3, mSdfData.mMeshLower, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mSdfData.mSpacing, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mDims.x, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mDims.y, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mDims.z, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mNumSdfs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mSdfData.mSdf, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mSubgridSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mNumStartSlots, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mSubgridStartSlots, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mNumSubgridSdfs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU8, mSdfData.mSubgridSdf, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mSdfSubgrids3DTexBlockDim.x, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mSdfSubgrids3DTexBlockDim.y, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mSdfSubgrids3DTexBlockDim.z, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mSdfData.mSubgridsMinSdfValue, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxReal, mSdfData.mSubgridsMaxSdfValue, 0) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mSdfData.mBytesPerSparsePixel, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mAccumulatedTrianglesRef, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mTrianglesReferences, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, TriangleMesh, PxU32, mNbTrianglesReferences, 0) + + //------ Extra-data ------ + + // mVertices + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxVec3, mVertices, mNbVertices, 0, PX_SERIAL_ALIGN) + + // mTriangles + // PT: quite tricky here: we exported either an array of PxU16s or an array of PxU32s. We trick the converter by + // pretending we exported both, with the same control variable (m16BitIndices) but opposed control flags. Also there's + // no way to capture "mNumTriangles*3" using the macros, so we just pretend we exported 3 buffers instead of 1. + // But since in reality it's all the same buffer, only the first one is declared as aligned. + + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU16, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, 0, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU16, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU16, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU32, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, PxMetaDataFlag::eCONTROL_FLIP, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU32, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, PxMetaDataFlag::eCONTROL_FLIP, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS_MASKED_CONTROL(stream, TriangleMesh, PxU32, mFlags, PxTriangleMeshFlag::e16_BIT_INDICES, mNbTriangles, PxMetaDataFlag::eCONTROL_FLIP, 0) + + // mExtraTrigData + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU8, mExtraTrigData, mNbTriangles, 0, PX_SERIAL_ALIGN) + + // mMaterialIndices + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU16, mMaterialIndices, mNbTriangles, 0, PX_SERIAL_ALIGN) + + // mFaceRemap + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mFaceRemap, mNbTriangles, 0, PX_SERIAL_ALIGN) + + // mAdjacencies + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mAdjacencies, mNbTriangles, 0, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mAdjacencies, mNbTriangles, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mAdjacencies, mNbTriangles, 0, 0) + + // mSdf + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxReal, mSdfData.mSdf, mSdfData.mNumSdfs, 0, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mSdfData.mSubgridStartSlots, mSdfData.mNumStartSlots, 0, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU8, mSdfData.mSubgridSdf, mSdfData.mNumSubgridSdfs, 0, PX_SERIAL_ALIGN) + + // mAccumulatedTrianglesRef +// PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mAccumulatedTrianglesRef, mNbTrianglesReferences, 0, PX_SERIAL_ALIGN) + + // mTrianglesReferences +// PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, TriangleMesh, PxU32, mTrianglesReferences, mNbTrianglesReferences, 0, PX_SERIAL_ALIGN) + +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, TriangleMesh, PxU32, mPaddingFromInternalMesh, PxMetaDataFlag::ePADDING) +#endif +} + +void Gu::RTreeTriangleMesh::getBinaryMetaData(PxOutputStream& stream) +{ + RTree::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, RTreeTriangleMesh) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, RTreeTriangleMesh, TriangleMesh) + + PX_DEF_BIN_METADATA_ITEM(stream, RTreeTriangleMesh, RTree, mRTree, 0) +} + +void Gu::BV4TriangleMesh::getBinaryMetaData(PxOutputStream& stream) +{ + SourceMeshBase::getBinaryMetaData(stream); + SourceMesh::getBinaryMetaData(stream); + BV4Tree::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, BV4TriangleMesh) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, BV4TriangleMesh, TriangleMesh) + + PX_DEF_BIN_METADATA_ITEM(stream, BV4TriangleMesh, SourceMesh, mMeshInterface, 0) + PX_DEF_BIN_METADATA_ITEM(stream, BV4TriangleMesh, BV4Tree, mBV4Tree, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp new file mode 100644 index 0000000..5516879 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuOverlapTests.cpp @@ -0,0 +1,815 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuOverlapTests.h" +#include "GuIntersectionBoxBox.h" +#include "GuIntersectionSphereBox.h" +#include "GuDistancePointSegment.h" +#include "GuDistanceSegmentBox.h" +#include "GuDistanceSegmentSegment.h" +#include "GuSphere.h" +#include "GuBoxConversion.h" +#include "GuInternal.h" +#include "GuVecCapsule.h" +#include "GuVecConvexHull.h" +#include "GuVecBox.h" +#include "GuConvexMesh.h" +#include "GuHillClimbing.h" +#include "GuGJK.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCustomGeometry.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; + +// PT: TODO: why don't we use ShapeData for overlaps? + +//returns the maximal vertex in shape space +// PT: this function should be removed. We already have 2 different project hull functions in PxcShapeConvex & GuGJKObjectSupport, this one looks like a weird mix of both! +static PxVec3 projectHull_( const ConvexHullData& hull, + float& minimum, float& maximum, + const PxVec3& localDir, // expected to be normalized + const PxMat33& vert2ShapeSkew) +{ + PX_ASSERT(localDir.isNormalized()); + + //use property that x|My == Mx|y for symmetric M to avoid having to transform vertices. + const PxVec3 vertexSpaceDir = vert2ShapeSkew * localDir; + + const PxVec3* Verts = hull.getHullVertices(); + const PxVec3* bestVert = NULL; + + if(!hull.mBigConvexRawData) // Brute-force, local space. Experiments show break-even point is around 32 verts. + { + PxU32 NbVerts = hull.mNbHullVertices; + float min_ = PX_MAX_F32; + float max_ = -PX_MAX_F32; + while(NbVerts--) + { + const float dp = (*Verts).dot(vertexSpaceDir); + min_ = physx::intrinsics::selectMin(min_, dp); + if(dp > max_) { max_ = dp; bestVert = Verts; } + + Verts++; + } + minimum = min_; + maximum = max_; + + PX_ASSERT(bestVert != NULL); + + return vert2ShapeSkew * *bestVert; + } + else //*/if(1) // This version is better for objects with a lot of vertices + { + const PxU32 Offset = ComputeCubemapNearestOffset(vertexSpaceDir, hull.mBigConvexRawData->mSubdiv); + PxU32 MinID = hull.mBigConvexRawData->mSamples[Offset]; + PxU32 MaxID = hull.mBigConvexRawData->getSamples2()[Offset]; + + localSearch(MinID, -vertexSpaceDir, Verts, hull.mBigConvexRawData); + localSearch(MaxID, vertexSpaceDir, Verts, hull.mBigConvexRawData); + + minimum = (Verts[MinID].dot(vertexSpaceDir)); + maximum = (Verts[MaxID].dot(vertexSpaceDir)); + + PX_ASSERT(maximum >= minimum); + + return vert2ShapeSkew * Verts[MaxID]; + } +} + +static bool intersectSphereConvex(const PxTransform& sphereTransform, float radius, const ConvexMesh& mesh, const PxMeshScale& meshScale, const PxTransform& convexGlobalPose, + PxVec3*) +{ + using namespace aos; + const Vec3V zeroV = V3Zero(); + const ConvexHullData* hullData = &mesh.getHull(); + const FloatV sphereRadius = FLoad(radius); + const Vec3V vScale = V3LoadU_SafeReadW(meshScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&meshScale.rotation.x); + + const PxMatTransformV aToB(convexGlobalPose.transformInv(sphereTransform)); + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, meshScale.isIdentity()); + const CapsuleV capsule(aToB.p, sphereRadius); + + Vec3V contactA, contactB, normal; + FloatV dist; + const LocalConvex convexA(capsule); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); + + GjkStatus status = gjk(convexA, convexB, initialSearchDir, FZero(), contactA, contactB, normal, dist); + + return status == GJK_CONTACT; +} + +static bool intersectCapsuleConvex( const PxCapsuleGeometry& capsGeom, const PxTransform& capsGlobalPose, + const ConvexMesh& mesh, const PxMeshScale& meshScale, const PxTransform& convexGlobalPose, + PxVec3*) +{ + using namespace aos; + + const Vec3V zeroV = V3Zero(); + const ConvexHullData* hull = &mesh.getHull(); + + const FloatV capsuleHalfHeight = FLoad(capsGeom.halfHeight); + const FloatV capsuleRadius = FLoad(capsGeom.radius); + + const Vec3V vScale = V3LoadU_SafeReadW(meshScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&meshScale.rotation.x); + + const PxMatTransformV aToB(convexGlobalPose.transformInv(capsGlobalPose)); + + const ConvexHullV convexHull(hull, zeroV, vScale, vQuat, meshScale.isIdentity()); + const CapsuleV capsule(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + + Vec3V contactA, contactB, normal; + FloatV dist; + const LocalConvex convexA(capsule); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); + + GjkStatus status = gjk(convexA, convexB, initialSearchDir, FZero(), contactA, contactB, normal, dist); + + return status == GJK_CONTACT; +} + +static bool intersectBoxConvex(const PxBoxGeometry& boxGeom, const PxTransform& boxGlobalPose, + const ConvexMesh& mesh, const PxMeshScale& meshScale, const PxTransform& convexGlobalPose, + PxVec3*) +{ + // AP: see archived non-GJK version in //sw/physx/dev/pterdiman/graveyard/contactConvexBox.cpp + using namespace aos; + const Vec3V zeroV = V3Zero(); + const ConvexHullData* hull = &mesh.getHull(); + + const Vec3V vScale = V3LoadU_SafeReadW(meshScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&meshScale.rotation.x); + const Vec3V boxExtents = V3LoadU(boxGeom.halfExtents); + const PxMatTransformV aToB(convexGlobalPose.transformInv(boxGlobalPose)); + + const ConvexHullV convexHull(hull, zeroV, vScale, vQuat, meshScale.isIdentity()); + const BoxV box(zeroV, boxExtents); + + Vec3V contactA, contactB, normal; + FloatV dist; + const RelativeConvex convexA(box, aToB); + const LocalConvex convexB(convexHull); + + GjkStatus status = gjk(convexA, convexB, aToB.p, FZero(), contactA, contactB, normal, dist); + + //PX_PRINTF("BOX status = %i, overlap = %i, PxVec3(%f, %f, %f)\n", status, overlap, boxGlobalPose.p.x, boxGlobalPose.p.y, boxGlobalPose.p.z); + + return status == GJK_CONTACT; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxVec3* getCachedAxis(TriggerCache* cache) +{ + if(cache && cache->state==TRIGGER_OVERLAP) + return &cache->dir; + else + return NULL; +} + +static PX_FORCE_INLINE bool updateTriggerCache(bool overlap, TriggerCache* cache) +{ + if(cache) + { + if(overlap) + cache->state = TRIGGER_OVERLAP; + else + cache->state = TRIGGER_DISJOINT; + } + return overlap; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Sphere-vs-shape + +static bool GeomOverlapCallback_SphereSphere(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eSPHERE); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom0 = static_cast(geom0); + const PxSphereGeometry& sphereGeom1 = static_cast(geom1); + + const PxVec3 delta = pose1.p - pose0.p; + const PxReal r = sphereGeom0.radius + sphereGeom1.radius; + return delta.magnitudeSquared() <= r*r; // PT: objects are defined as closed, so we return 'true' in case of equality +} + +static bool GeomOverlapCallback_SpherePlane(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::ePLANE); + PX_UNUSED(cache); + PX_UNUSED(geom1); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + + return getPlane(pose1).distance(pose0.p) <= sphereGeom.radius; // PT: objects are defined as closed, so we return 'true' in case of equality +} + +static bool GeomOverlapCallback_SphereCapsule(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxCapsuleGeometry& capsuleGeom = static_cast(geom1); + + // PT: TODO: remove this useless conversion + const PxVec3 capsuleHalfHeightVector = getCapsuleHalfHeightVector(pose1, capsuleGeom); + const PxReal r = sphereGeom.radius + capsuleGeom.radius; + + return distancePointSegmentSquared(capsuleHalfHeightVector, -capsuleHalfHeightVector, pose0.p - pose1.p) <= r*r; // PT: objects are defined as closed, so we return 'true' in case of equality +} + +static bool GeomOverlapCallback_SphereBox(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxBoxGeometry& boxGeom = static_cast(geom1); + + // PT: TODO: remove this useless conversion + Box obb; + buildFrom(obb, pose1.p, boxGeom.halfExtents, pose1.q); + + return intersectSphereBox(Sphere(pose0.p, sphereGeom.radius), obb); +} + +static bool GeomOverlapCallback_SphereConvex(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + PxVec3 cachedSepAxis; + PxVec3* tmp = getCachedAxis(cache); + if(tmp) + cachedSepAxis = *tmp; + else + cachedSepAxis = PxVec3(0,0,1.f); + + const bool overlap = intersectSphereConvex(pose0, sphereGeom.radius, + *cm, + convexGeom.scale, pose1, + &cachedSepAxis); + + if(cache && overlap) + cache->dir = cachedSepAxis; + + return updateTriggerCache(overlap, cache); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Plane-vs-shape + +static bool GeomOverlapCallback_PlaneCapsule(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + PX_UNUSED(threadContext); + PX_UNUSED(cache); + PX_UNUSED(geom0); + +// const PxPlaneGeometry& planeGeom = static_cast(geom0); + const PxCapsuleGeometry& capsuleGeom = static_cast(geom1); + + // PT: TODO: remove this useless conversion + Capsule capsule; + getCapsule(capsule, capsuleGeom, pose1); + + const PxPlane plane = getPlane(pose0); + + // We handle the capsule-plane collision with 2 sphere-plane collisions. + // Seems ok so far, since plane is infinite. + + if(plane.distance(capsule.p0) <= capsule.radius) // PT: objects are defined as closed, so we return 'true' in case of equality + return true; + + if(plane.distance(capsule.p1) <= capsule.radius) // PT: objects are defined as closed, so we return 'true' in case of equality + return true; + + return false; +} + +/*static bool intersectPlaneBox(const PxPlane& plane, const Box& box) +{ + PxVec3 pts[8]; + box.computeBoxPoints(pts); + + for(PxU32 i=0;i<8;i++) + { + if(plane.distance(pts[i]) <= 0.0f) // PT: objects are defined as closed, so we return 'true' in case of equality + return true; + } + return false; +}*/ + +static bool GeomOverlapCallback_PlaneBox(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + PX_UNUSED(threadContext); + PX_UNUSED(cache); + PX_UNUSED(geom0); + +// const PxPlaneGeometry& planeGeom = static_cast(geom0); + const PxBoxGeometry& boxGeom = static_cast(geom1); + + // I currently use the same code as for contact generation but maybe we could do something faster (in theory testing + // only 2 pts is enough). + + const Matrix34FromTransform absPose(pose1); + const PxPlane worldPlane = getPlane(pose0); + + for(int vx=-1; vx<=1; vx+=2) + for(int vy=-1; vy<=1; vy+=2) + for(int vz=-1; vz<=1; vz+=2) + { + const PxVec3 v = absPose.transform(PxVec3(PxReal(vx),PxReal(vy),PxReal(vz)).multiply(boxGeom.halfExtents)); + + if(worldPlane.distance(v) <= 0.0f) // PT: objects are defined as closed, so we return 'true' in case of equality + return true; + } + return false; +} + +static bool GeomOverlapCallback_PlaneConvex(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::ePLANE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(threadContext); + PX_UNUSED(cache); + PX_UNUSED(geom0); + +// const PxPlaneGeometry& planeGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + //find plane normal in shape space of convex: + const PxTransform plane2convex = pose1.getInverse().transform(pose0); + + const PxPlane shapeSpacePlane = getPlane(plane2convex); + + PxReal minimum, maximum; + projectHull_(cm->getHull(), minimum, maximum, shapeSpacePlane.n, toMat33(convexGeom.scale)); + + return (minimum <= -shapeSpacePlane.d); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Capsule-vs-shape + +static bool GeomOverlapCallback_CapsuleCapsule(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCAPSULE); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom0 = static_cast(geom0); + const PxCapsuleGeometry& capsuleGeom1 = static_cast(geom1); + + // PT: move computation to local space for improved accuracy + const PxVec3 delta = pose1.p - pose0.p; + + // PT: TODO: remove this useless conversion + const PxVec3 capsuleHalfHeightVector0 = getCapsuleHalfHeightVector(pose0, capsuleGeom0); + const PxVec3 capsuleHalfHeightVector1 = getCapsuleHalfHeightVector(pose1, capsuleGeom1); + + const PxReal squareDist = distanceSegmentSegmentSquared(-capsuleHalfHeightVector0, capsuleHalfHeightVector0*2.0f, + delta-capsuleHalfHeightVector1, capsuleHalfHeightVector1*2.0f); + const PxReal r = capsuleGeom0.radius + capsuleGeom1.radius; + return squareDist <= r*r; // PT: objects are defined as closed, so we return 'true' in case of equality +} + +static bool GeomOverlapCallback_CapsuleBox(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxBoxGeometry& boxGeom = static_cast(geom1); + + // PT: move computation to local space for improved accuracy + const PxVec3 delta = pose1.p - pose0.p; + + // PT: TODO: remove this useless conversion + const PxVec3 capsuleHalfHeightVector = getCapsuleHalfHeightVector(pose0, capsuleGeom); + + // PT: TODO: remove this useless conversion + const PxMat33Padded obbRot(pose1.q); + + // PT: objects are defined as closed, so we return 'true' in case of equality + return distanceSegmentBoxSquared(capsuleHalfHeightVector, -capsuleHalfHeightVector, delta, boxGeom.halfExtents, obbRot) <= capsuleGeom.radius*capsuleGeom.radius; +} + +static bool GeomOverlapCallback_CapsuleConvex(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + + PxVec3 cachedSepAxis; + PxVec3* tmp = getCachedAxis(cache); + if(tmp) + cachedSepAxis = *tmp; + else + cachedSepAxis = PxVec3(0,0,1.0f); + + const bool overlap = intersectCapsuleConvex(capsuleGeom, pose0, *cm, convexGeom.scale, pose1, &cachedSepAxis); + + if(cache && overlap) + cache->dir = cachedSepAxis; + + return updateTriggerCache(overlap, cache); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Box-vs-shape + +static bool GeomOverlapCallback_BoxBox(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eBOX); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxBoxGeometry& boxGeom0 = static_cast(geom0); + const PxBoxGeometry& boxGeom1 = static_cast(geom1); + + // PT: TODO: remove this useless conversion + return intersectOBBOBB( boxGeom0.halfExtents, pose0.p, PxMat33Padded(pose0.q), + boxGeom1.halfExtents, pose1.p, PxMat33Padded(pose1.q), true); +} + +static bool GeomOverlapCallback_BoxConvex(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(threadContext); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom = static_cast(geom1); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + PxVec3 cachedSepAxis; + PxVec3* tmp = getCachedAxis(cache); + if(tmp) + cachedSepAxis = *tmp; + else + cachedSepAxis = PxVec3(0.0f, 0.0f, 1.0f); + + const bool overlap = intersectBoxConvex(boxGeom, pose0, *cm, convexGeom.scale, pose1, &cachedSepAxis); + + if(cache && overlap) + cache->dir = cachedSepAxis; + + return updateTriggerCache(overlap, cache); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// Convex-vs-shape +static bool GeomOverlapCallback_ConvexConvex(GU_OVERLAP_FUNC_PARAMS) +{ + using namespace aos; + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eCONVEXMESH); + PX_UNUSED(threadContext); + + const Vec3V zeroV = V3Zero(); + const PxConvexMeshGeometry& convexGeom0 = static_cast(geom0); + const PxConvexMeshGeometry& convexGeom1 = static_cast(geom1); + const ConvexMesh* cm0 = static_cast(convexGeom0.convexMesh); + const ConvexMesh* cm1 = static_cast(convexGeom1.convexMesh); + + bool overlap; + { + const ConvexHullData* hullData0 = &cm0->getHull(); + const ConvexHullData* hullData1 = &cm1->getHull(); + + const Vec3V vScale0 = V3LoadU_SafeReadW(convexGeom0.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat0 = QuatVLoadU(&convexGeom0.scale.rotation.x); + const Vec3V vScale1 = V3LoadU_SafeReadW(convexGeom1.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat1 = QuatVLoadU(&convexGeom1.scale.rotation.x); + + const QuatV q0 = QuatVLoadU(&pose0.q.x); + const Vec3V p0 = V3LoadU(&pose0.p.x); + + const QuatV q1 = QuatVLoadU(&pose1.q.x); + const Vec3V p1 = V3LoadU(&pose1.p.x); + + const PxTransformV transf0(p0, q0); + const PxTransformV transf1(p1, q1); + + const PxMatTransformV aToB(transf1.transformInv(transf0)); + + const ConvexHullV convexHull0(hullData0, zeroV, vScale0, vQuat0, convexGeom0.scale.isIdentity()); + const ConvexHullV convexHull1(hullData1, zeroV, vScale1, vQuat1, convexGeom1.scale.isIdentity()); + + Vec3V contactA, contactB, normal; + FloatV dist; + const RelativeConvex convexA(convexHull0, aToB); + const LocalConvex convexB(convexHull1); + + GjkStatus status = gjk(convexA, convexB, aToB.p, FZero(), contactA, contactB, normal, dist); + overlap = (status == GJK_CONTACT); + } + + return updateTriggerCache(overlap, cache); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static bool GeomOverlapCallback_NotSupported(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ALWAYS_ASSERT_MESSAGE("NOT SUPPORTED"); + PX_UNUSED(threadContext); + PX_UNUSED(cache); + PX_UNUSED(pose0); + PX_UNUSED(pose1); + PX_UNUSED(geom0); + PX_UNUSED(geom1); + return false; +} + +static bool GeomOverlapCallback_HeightfieldUnregistered(GU_OVERLAP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(cache); + PX_UNUSED(geom0); + PX_UNUSED(geom1); + PX_UNUSED(pose0); + PX_UNUSED(pose1); + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Height Field Overlap test called with height fields unregistered "); +} + +bool GeomOverlapCallback_SphereMesh (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_CapsuleMesh (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_BoxMesh (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_ConvexMesh (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_MeshMesh (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_SphereHeightfield (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_CapsuleHeightfield (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_BoxHeightfield (GU_OVERLAP_FUNC_PARAMS); +bool GeomOverlapCallback_ConvexHeightfield (GU_OVERLAP_FUNC_PARAMS); + +static bool GeomOverlapCallback_CustomGeometry(GU_OVERLAP_FUNC_PARAMS) +{ + PX_UNUSED(cache); + + if(geom0.getType() == PxGeometryType::eCUSTOM) + return static_cast(geom0).callbacks->overlap(geom0, pose0, geom1, pose1, threadContext); + + if(geom1.getType() == PxGeometryType::eCUSTOM) + return static_cast(geom1).callbacks->overlap(geom1, pose1, geom0, pose0, threadContext); + + return false; +} + +GeomOverlapTable gGeomOverlapMethodTable[] = +{ + //PxGeometryType::eSPHERE + { + GeomOverlapCallback_SphereSphere, //PxGeometryType::eSPHERE + GeomOverlapCallback_SpherePlane, //PxGeometryType::ePLANE + GeomOverlapCallback_SphereCapsule, //PxGeometryType::eCAPSULE + GeomOverlapCallback_SphereBox, //PxGeometryType::eBOX + GeomOverlapCallback_SphereConvex, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_SphereMesh, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_HeightfieldUnregistered, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePLANE + { + 0, //PxGeometryType::eSPHERE + GeomOverlapCallback_NotSupported, //PxGeometryType::ePLANE + GeomOverlapCallback_PlaneCapsule, //PxGeometryType::eCAPSULE + GeomOverlapCallback_PlaneBox, //PxGeometryType::eBOX + GeomOverlapCallback_PlaneConvex, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCAPSULE + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + GeomOverlapCallback_CapsuleCapsule, //PxGeometryType::eCAPSULE + GeomOverlapCallback_CapsuleBox, //PxGeometryType::eBOX + GeomOverlapCallback_CapsuleConvex, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_CapsuleMesh, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_HeightfieldUnregistered, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eBOX + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + GeomOverlapCallback_BoxBox, //PxGeometryType::eBOX + GeomOverlapCallback_BoxConvex, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_BoxMesh, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_HeightfieldUnregistered, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCONVEXMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + GeomOverlapCallback_ConvexConvex, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_ConvexMesh, //PxGeometryType::eTRIANGLEMESH //not used: mesh always uses swept method for midphase. + GeomOverlapCallback_HeightfieldUnregistered, //PxGeometryType::eHEIGHTFIELD //TODO: make HF midphase that will mask this + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePARTICLESYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTETRAHEDRONMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_NotSupported, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTRIANGLEMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + GeomOverlapCallback_MeshMesh, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHEIGHTFIELD + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + GeomOverlapCallback_NotSupported, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHAIRSYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + GeomOverlapCallback_NotSupported, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCUSTOM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + 0, //PxGeometryType::eHAIRSYSTEM + GeomOverlapCallback_CustomGeometry, //PxGeometryType::eCUSTOM + }, +}; +PX_COMPILE_TIME_ASSERT(sizeof(gGeomOverlapMethodTable) / sizeof(gGeomOverlapMethodTable[0]) == PxGeometryType::eGEOMETRY_COUNT); + +const GeomOverlapTable* Gu::getOverlapFuncTable() +{ + return gGeomOverlapMethodTable; +} + +void registerHeightFields_Raycasts(); +void registerHeightFields_Sweeps(); +void Gu::registerHeightFields() +{ + registerHeightFields_Raycasts(); + registerHeightFields_Sweeps(); + + gGeomOverlapMethodTable[PxGeometryType::eSPHERE][PxGeometryType::eHEIGHTFIELD] = GeomOverlapCallback_SphereHeightfield; + gGeomOverlapMethodTable[PxGeometryType::eCAPSULE][PxGeometryType::eHEIGHTFIELD] = GeomOverlapCallback_CapsuleHeightfield; + gGeomOverlapMethodTable[PxGeometryType::eBOX][PxGeometryType::eHEIGHTFIELD] = GeomOverlapCallback_BoxHeightfield; + gGeomOverlapMethodTable[PxGeometryType::eCONVEXMESH][PxGeometryType::eHEIGHTFIELD] = GeomOverlapCallback_ConvexHeightfield; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp new file mode 100644 index 0000000..3ce0878 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.cpp @@ -0,0 +1,265 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPruningPool.h" +#include "foundation/PxMemory.h" +#include "common/PxProfileZone.h" + +using namespace physx; +using namespace Gu; + +PruningPool::PruningPool(PxU64 contextID, TransformCacheMode mode) : + mNbObjects (0), + mMaxNbObjects (0), + mObjects (NULL), + mTransforms (NULL), + mTransformCacheMode (mode), + mHandleToIndex (NULL), + mIndexToHandle (NULL), + mFirstRecycledHandle(INVALID_PRUNERHANDLE), + mContextID (contextID) +{ +} + +PruningPool::~PruningPool() +{ + mWorldBoxes.release(); + PX_FREE(mIndexToHandle); + PX_FREE(mHandleToIndex); + PX_FREE(mTransforms); + PX_FREE(mObjects); +} + +bool PruningPool::resize(PxU32 newCapacity) +{ + PX_PROFILE_ZONE("PruningPool::resize", mContextID); + + const bool useTransforms = mTransformCacheMode!=TRANSFORM_CACHE_UNUSED; + PxTransform* newTransforms = useTransforms ? PX_ALLOCATE(PxTransform, newCapacity, "Pruner transforms") : NULL; + if(useTransforms && !newTransforms) + return false; + + PrunerPayload* newData = PX_ALLOCATE(PrunerPayload, newCapacity, "PrunerPayload*"); + PrunerHandle* newIndexToHandle = PX_ALLOCATE(PrunerHandle, newCapacity, "Pruner Index Mapping"); + PoolIndex* newHandleToIndex = PX_ALLOCATE(PoolIndex, newCapacity, "Pruner Index Mapping"); + if( (!newData) || (!newIndexToHandle) || (!newHandleToIndex)) + { + PX_FREE(newHandleToIndex); + PX_FREE(newIndexToHandle); + PX_FREE(newTransforms); + PX_FREE(newData); + return false; + } + + mWorldBoxes.resize(newCapacity, mNbObjects); + + if(mObjects) PxMemCopy(newData, mObjects, mNbObjects*sizeof(PrunerPayload)); + if(mTransforms) PxMemCopy(newTransforms, mTransforms, mNbObjects*sizeof(PxTransform)); + if(mIndexToHandle) PxMemCopy(newIndexToHandle, mIndexToHandle, mNbObjects*sizeof(PrunerHandle)); + if(mHandleToIndex) PxMemCopy(newHandleToIndex, mHandleToIndex, mMaxNbObjects*sizeof(PoolIndex)); // PT: why mMaxNbObjects here? on purpose? + mMaxNbObjects = newCapacity; + + PX_FREE(mIndexToHandle); + PX_FREE(mHandleToIndex); + PX_FREE(mTransforms); + PX_FREE(mObjects); + mObjects = newData; + mTransforms = newTransforms; + mHandleToIndex = newHandleToIndex; + mIndexToHandle = newIndexToHandle; + + return true; +} + +void PruningPool::preallocate(PxU32 newCapacity) +{ + if(newCapacity>mMaxNbObjects) + resize(newCapacity); +} + +PxU32 PruningPool::addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count) +{ + PX_PROFILE_ZONE("PruningPool::addObjects", mContextID); + + PX_ASSERT((!transforms && mTransformCacheMode==TRANSFORM_CACHE_UNUSED) || (transforms && mTransformCacheMode!=TRANSFORM_CACHE_UNUSED)); + + for(PxU32 i=0;i(newCapacity, 64))) + //if(!resize(PxMax(mMaxNbObjects*2, 64))) + { + // pool can return an invalid handle if memory alloc fails + // should probably have an error here or not handle this + results[i] = INVALID_PRUNERHANDLE; // PT: we need to write the potentially invalid handle to let users know which object failed first + return i; + } + } + PX_ASSERT(mNbObjects!=mMaxNbObjects); + + const PoolIndex index = mNbObjects++; + + // update mHandleToIndex and mIndexToHandle mappings + PrunerHandle handle; + if(mFirstRecycledHandle != INVALID_PRUNERHANDLE) + { + // mFirstRecycledHandle is an entry into a freelist for removed slots + // this path is only taken if we have any removed slots + handle = mFirstRecycledHandle; + mFirstRecycledHandle = mHandleToIndex[handle]; + } + else + { + handle = index; + } + + // PT: TODO: investigate why we added mIndexToHandle/mHandleToIndex. The initial design with 'Prunable' objects didn't need these arrays. + + // PT: these arrays are "parallel" + mWorldBoxes.getBounds() [index] = bounds[i]; // store the payload/userData and AABB in parallel arrays + mObjects [index] = data[i]; + mIndexToHandle [index] = handle; + if(transforms && mTransforms) + mTransforms [index] = transforms[i]; + + mHandleToIndex[handle] = index; + results[i] = handle; + } + return count; +} + +PoolIndex PruningPool::removeObject(PrunerHandle h, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_PROFILE_ZONE("PruningPool::removeObject", mContextID); + + PX_ASSERT(mNbObjects); + + // remove the object and its AABB by provided PrunerHandle and update mHandleToIndex and mIndexToHandle mappings + const PoolIndex indexOfRemovedObject = mHandleToIndex[h]; // retrieve object's index from handle + + if(removalCallback) + removalCallback->invoke(1, &mObjects[indexOfRemovedObject]); + + const PoolIndex indexOfLastObject = --mNbObjects; // swap the object at last index with index + if(indexOfLastObject!=indexOfRemovedObject) + { + // PT: move last object's data to recycled spot (from removed object) + + // PT: the last object has moved so we need to handle the mappings for this object + // PT: TODO: investigate where this double-mapping comes from. It was not needed in the original design. + + // PT: these arrays are "parallel" + PxBounds3* bounds = mWorldBoxes.getBounds(); + const PrunerHandle handleOfLastObject = mIndexToHandle[indexOfLastObject]; + bounds [indexOfRemovedObject] = bounds [indexOfLastObject]; + mObjects [indexOfRemovedObject] = mObjects [indexOfLastObject]; + if(mTransforms) + mTransforms [indexOfRemovedObject] = mTransforms [indexOfLastObject]; + mIndexToHandle [indexOfRemovedObject] = handleOfLastObject; + + mHandleToIndex[handleOfLastObject] = indexOfRemovedObject; + } + + // mHandleToIndex also stores the freelist for removed handles (in place of holes formed by removed handles) + mHandleToIndex[h] = mFirstRecycledHandle; // update linked list of available recycled handles + mFirstRecycledHandle = h; // update the list head + + return indexOfLastObject; +} + +void PruningPool::shiftOrigin(const PxVec3& shift) +{ + PX_PROFILE_ZONE("PruningPool::shiftOrigin", mContextID); + + const PxU32 nb = mNbObjects; + PxBounds3* bounds = mWorldBoxes.getBounds(); + for(PxU32 i=0; i +static void updateAndInflateBounds(PruningPool& pool, const PrunerHandle* PX_RESTRICT handles, const PxU32* PX_RESTRICT boundsIndices, const PxBounds3* PX_RESTRICT newBounds, + const PxTransform32* PX_RESTRICT newTransforms, PxU32 count, float epsilon) +{ + PxBounds3* PX_RESTRICT bounds = pool.mWorldBoxes.getBounds(); + PxTransform* PX_RESTRICT transforms = hasTransforms ? pool.mTransforms : NULL; + + if(boundsIndices) + { + while(count--) + { + const PoolIndex poolIndex = pool.getIndex(*handles++); + PX_ASSERT(poolIndex!=INVALID_PRUNERHANDLE); + + const PxU32 remappedIndex = *boundsIndices++; + + if(hasTransforms) + transforms[poolIndex] = newTransforms[remappedIndex].transform; + + inflateBounds(bounds[poolIndex], newBounds[remappedIndex], epsilon); + } + } + else + { + while(count--) + { + const PoolIndex poolIndex = pool.getIndex(*handles++); + PX_ASSERT(poolIndex!=INVALID_PRUNERHANDLE); + + if(hasTransforms) + { + transforms[poolIndex] = newTransforms->transform; + newTransforms++; + } + + inflateBounds(bounds[poolIndex], *newBounds++, epsilon); + } + } +} + +void PruningPool::updateAndInflateBounds(const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* newBounds, + const PxTransform32* newTransforms, PxU32 count, float epsilon) +{ + PX_PROFILE_ZONE("PruningPool::updateAndInflateBounds", mContextID); + + if(mTransforms) + ::updateAndInflateBounds<1>(*this, handles, boundsIndices, newBounds, newTransforms, count, epsilon); + else + ::updateAndInflateBounds<0>(*this, handles, boundsIndices, newBounds, NULL, count, epsilon); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.h new file mode 100644 index 0000000..519af2f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuPruningPool.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PRUNING_POOL_H +#define GU_PRUNING_POOL_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuPrunerTypedef.h" +#include "GuPrunerPayload.h" +#include "GuBounds.h" +#include "GuAABBTreeBounds.h" + +namespace physx +{ +namespace Gu +{ + enum TransformCacheMode + { + TRANSFORM_CACHE_UNUSED, + TRANSFORM_CACHE_LOCAL, + TRANSFORM_CACHE_GLOBAL + }; + + // This class is designed to maintain a two way mapping between pair(PrunerPayload/userdata,AABB) and PrunerHandle + // Internally there's also an index for handles (AP: can be simplified?) + // This class effectively stores bounded pruner payloads/userdata, returns a PrunerHandle and allows O(1) + // access to them using a PrunerHandle + // Supported operations are add, remove, update bounds + class PX_PHYSX_COMMON_API PruningPool : public PxUserAllocated + { + PX_NOCOPY(PruningPool) + public: + PruningPool(PxU64 contextID, TransformCacheMode mode/*=TRANSFORM_CACHE_UNUSED*/); + ~PruningPool(); + + PX_FORCE_INLINE const PrunerPayload& getPayloadData(PrunerHandle handle, PrunerPayloadData* data=NULL) const + { + const PoolIndex index = getIndex(handle); + if(data) + { + PxBounds3* wb = const_cast(mWorldBoxes.getBounds()); + data->mBounds = wb + index; + data->mTransform = mTransforms ? mTransforms + index : NULL; + } + return mObjects[index]; + } + + void shiftOrigin(const PxVec3& shift); + + // PT: adds 'count' objects to the pool. Needs 'count' bounds and 'count' payloads passed as input. Writes out 'count' handles + // in 'results' array. Function returns number of successfully added objects, ideally 'count' but can be less in case we run + // out of memory. + PxU32 addObjects(PrunerHandle* results, const PxBounds3* bounds, const PrunerPayload* data, const PxTransform* transforms, PxU32 count); + + // this function will swap the last object with the hole formed by removed PrunerHandle object + // and return the removed last object's index in the pool + PoolIndex removeObject(PrunerHandle h, PrunerPayloadRemovalCallback* removalCallback); + + // Data access + PX_FORCE_INLINE PoolIndex getIndex(PrunerHandle h)const { return mHandleToIndex[h]; } + PX_FORCE_INLINE PrunerPayload* getObjects() const { return mObjects; } + PX_FORCE_INLINE const PxTransform* getTransforms() const { return mTransforms; } + PX_FORCE_INLINE PxTransform* getTransforms() { return mTransforms; } + PX_FORCE_INLINE bool setTransform(PrunerHandle handle, const PxTransform& transform) + { + if(!mTransforms) + return false; + mTransforms[getIndex(handle)] = transform; + return true; + } + PX_FORCE_INLINE PxU32 getNbActiveObjects() const { return mNbObjects; } + PX_FORCE_INLINE const PxBounds3* getCurrentWorldBoxes() const { return mWorldBoxes.getBounds(); } + PX_FORCE_INLINE PxBounds3* getCurrentWorldBoxes() { return mWorldBoxes.getBounds(); } + PX_FORCE_INLINE const AABBTreeBounds& getCurrentAABBTreeBounds() const { return mWorldBoxes; } + + void updateAndInflateBounds(const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* newBounds, const PxTransform32* newTransforms, PxU32 count, float epsilon); + void preallocate(PxU32 entries); +// protected: + + PxU32 mNbObjects; //!< Current number of objects + PxU32 mMaxNbObjects; //!< Max. number of objects (capacity for mWorldBoxes, mObjects) + + //!< these arrays are parallel + AABBTreeBounds mWorldBoxes; //!< List of world boxes, stores mNbObjects, capacity=mMaxNbObjects + PrunerPayload* mObjects; //!< List of objects, stores mNbObjects, capacity=mMaxNbObjects + PxTransform* mTransforms; + const TransformCacheMode mTransformCacheMode; +// private: + PoolIndex* mHandleToIndex; //!< Maps from PrunerHandle to internal index (payload/userData index in mObjects) + PrunerHandle* mIndexToHandle; //!< Inverse map from objectIndex to PrunerHandle + + // this is the head of a list of holes formed in mHandleToIndex by removed handles + // the rest of the list is stored in holes in mHandleToIndex (in place) + PrunerHandle mFirstRecycledHandle; + + PxU64 mContextID; + + bool resize(PxU32 newCapacity); + }; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuery.h new file mode 100644 index 0000000..c566b38 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuery.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_QUERY_H +#define GU_QUERY_H + +#include "GuBounds.h" +#include "GuBVHTestsSIMD.h" + +namespace physx +{ +namespace Gu +{ + // PT: TODO: the various V3LoadUs in the base tests like SphereAABBTest could be avoided + + // PT: TODO: check inflation is consistent in all of these. Looks like it's not. + + struct DefaultOBBAABBTest : OBBAABBTest + { + PX_FORCE_INLINE DefaultOBBAABBTest(const ShapeData& queryVolume) : + OBBAABBTest(queryVolume.getPrunerWorldPos(), + queryVolume.getPrunerWorldRot33(), + queryVolume.getPrunerBoxGeomExtentsInflated()) {} + }; + + struct DefaultAABBAABBTest : AABBAABBTest + { + PX_FORCE_INLINE DefaultAABBAABBTest(const ShapeData& queryVolume) : + AABBAABBTest(queryVolume.getPrunerInflatedWorldAABB()) {} + }; + + struct DefaultSphereAABBTest : SphereAABBTest + { + PX_FORCE_INLINE DefaultSphereAABBTest(const ShapeData& queryVolume) : + SphereAABBTest( queryVolume.getGuSphere().center, + queryVolume.getGuSphere().radius) {} + }; + + struct DefaultCapsuleAABBTest : CapsuleAABBTest + { + PX_FORCE_INLINE DefaultCapsuleAABBTest(const ShapeData& queryVolume, float inflation) : + CapsuleAABBTest(queryVolume.getGuCapsule().p1, + queryVolume.getPrunerWorldRot33().column0, + queryVolume.getCapsuleHalfHeight()*2.0f, + PxVec3(queryVolume.getGuCapsule().radius*inflation)) {} + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp new file mode 100644 index 0000000..02feb18 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuQuerySystem.cpp @@ -0,0 +1,829 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuQuerySystem.h" +#include "GuBounds.h" +#include "GuBVH.h" +#include "foundation/PxAlloca.h" +#include "common/PxProfileZone.h" + +using namespace physx; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +bool contains(PxArray& pruners, PxU32 index) +{ + const PxU32 nb = pruners.size(); + for(PxU32 i=0;ipreallocate(preallocated); +} + +QuerySystem::PrunerExt::~PrunerExt() +{ + PX_DELETE(mPruner); +} + +void QuerySystem::PrunerExt::flushMemory() +{ + if(!mDirtyList.size()) + mDirtyList.reset(); + + // PT: TODO: flush bitmap here + + // PT: TODO: flush pruner here? +} + +// PT: ok things became more complicated than before here. We'd like to delay the update of *both* the transform and the bounds, +// since immediately updating only one of them doesn't make much sense (it invalidates the pruner's data structure anyway). When both +// are delayed it gives users the ability to query the pruners *without* commiting the changes, i.e. they can query the old snapshot +// for as long as they please (i.e. a raycast wouldn't automatically trigger a structure update). +// +// Now the problem is that we need to store (at least) the transform until the update actually happens, and the initial code didn't +// support this. We also want to do this in an efficient way, which of course makes things more difficult. +// +// A naive version would simply use a per-pruner hashmap between the PrunerHandle and its data. Might be slower than before. +// +// Another version could build on the initial bitmap-based solution and use arrays of transforms/bounds as companions to the array +// of PrunerHandle (or we could mix all that data in a single structure). The issue with this is that two consecutive updates on the +// same object wouldn't work anymore: the second call would check the bitmap, see that the bit is set already, and skip the work. +// We'd need to update the cached data instead, i.e. we'd need a mapping between the PrunerHandle and its position in mDirtyList. +// And we don't have that. +// +// A potential way to fix this could be to allow the same PrunerHandle to appear multiple times in mDirtyList, with the assumption +// that users will not update the same object multiple times very often (...). The way it would work: +// - during "add", dirtyMap is set, handle/transform/bounds are pushed to mDirtyList. +// - during "remove", dirtyMap is reset *and that's it*. We don't bother purging mDirtyList (i.e. we kill the current O(n) search there) +// - during "process" we use dirtyMap to validate the update. If bit is cleared, ignore mDirtyList entry. Duplicate entries work as long +// as mDirtyList is processed in linear order. One issue is that the current mDirtyList is also passed to the pruner as-is for the +// update, so we'd need to rebuild a separate array for that and/or make sure all pruners accept duplicate entries in that array. +// Deep down that specific rabbit hole we'll actually find the recently discovered issue regarding the mToRefit array... +// +// Bit tricky. This is only for user-updates anyway (as opposed to sim updates) so this probably doesn't need ultimate perf? Note however +// that we "remove from dirty list" when an object is removed, which happens all the time with or without user updates (e.g. streaming etc). + +static const bool gUseOldCode = false; + +void QuerySystem::PrunerExt::addToDirtyList(PrunerHandle handle, PxU32 dynamic, const PxTransform& transform, const PxBounds3* userBounds) +{ + PxBitMap& dirtyMap = mDirtyMap; + { + if(dirtyMap.size() <= handle) + { + PxU32 size = PxMax(dirtyMap.size()*2, 1024); + const PxU32 minSize = handle+1; + if(minSize>size) + size = minSize*2; + dirtyMap.resize(size); + PX_ASSERT(handlegetPayloadData(handle, &payloadData); + + computeBounds(*payloadData.mBounds, adapter.getGeometry(pp), *payloadData.mTransform, 0.0f, inflation); + } + // PT: batch update happens after the loop instead of once per loop iteration + mPruner->updateObjects(prunerHandles, numDirtyList); + mDirtyList.clear(); + } + else + { + // PT: TODO: this stuff is not 100% satisfying, since we do allow the same object to be updated multiple times. + // Would be nice to revisit & improve at some point. + + PrunerHandle* prunerHandles = mDirtyList.begin(); + + PxU32 nbValid = 0; + for(PxU32 i=0; igetPayloadData(handle, &payloadData); + + *payloadData.mTransform = mDirtyData[i].mPose; + + if(mDirtyData[i].mBounds.isEmpty()) + computeBounds(*payloadData.mBounds, adapter.getGeometry(pp), mDirtyData[i].mPose, 0.0f, inflation); + else + *payloadData.mBounds = mDirtyData[i].mBounds; + + prunerHandles[nbValid++] = handle; + } + else + { + // PT: if not set, object has been added to the list then removed + } + } + + // PT: batch update happens after the loop instead of once per loop iteration + mPruner->updateObjects(prunerHandles, nbValid); + + // PT: have to reset the bits *after* the above loop now. Unclear if clearing the + // whole map would be faster ("it depends" I guess). + while(nbValid--) + { + const PrunerHandle handle = *prunerHandles++; + mDirtyMap.reset(handle); + } + + mDirtyList.clear(); + mDirtyData.clear(); + } + + const bool ret = mDirtyStatic; + mDirtyStatic = false; + return ret; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE QuerySystem::PrunerExt* checkPrunerIndex(PxU32 prunerIndex, const PxArray& prunerExt) +{ + if(prunerIndex>=prunerExt.size() || !prunerExt[prunerIndex]) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "Invalid pruner index"); + return NULL; + } + + return prunerExt[prunerIndex]; +} + +QuerySystem::QuerySystem(PxU64 contextID, float inflation, const Adapter& adapter, bool usesTreeOfPruners) : + mAdapter (adapter), + mTreeOfPruners (NULL), + mContextID (contextID), + mStaticTimestamp (0), + mInflation (inflation), + mPrunerNeedsUpdating (false), + mTimestampNeedsUpdating (false), + mUsesTreeOfPruners (usesTreeOfPruners) + //mBatchUserUpdates (batchUserUpdates) +{ +} + +QuerySystem::~QuerySystem() +{ + PX_DELETE(mTreeOfPruners); + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;imNbStatic) + invalidateStaticTimestamp(); + + PX_DELETE(pe); + mPrunerExt[prunerIndex] = NULL; + + mFreePruners.pushBack(prunerIndex); + + // We don't bother searching mDirtyPruners since it's going to be cleared next frame +} + +void QuerySystem::flushMemory() +{ + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iflushMemory(); + } +} + +ActorShapeData QuerySystem::addPrunerShape(const PrunerPayload& payload, PxU32 prunerIndex, bool dynamic, const PxTransform& transform, const PxBounds3* userBounds) +{ + PrunerExt* pe = checkPrunerIndex(prunerIndex, mPrunerExt); + if(!pe) + return INVALID_ACTOR_SHAPE_DATA; + + mPrunerNeedsUpdating = true; + + if(dynamic) + { + pe->mNbDynamic++; + } + else + { + pe->mNbStatic++; + invalidateStaticTimestamp(); + } + + PX_ASSERT(pe->mPruner); + + const PxBounds3* boundsPtr; + PxBounds3 bounds; + if(userBounds) + { + boundsPtr = userBounds; + } + else + { + computeBounds(bounds, mAdapter.getGeometry(payload), transform, 0.0f, 1.0f + mInflation); + boundsPtr = &bounds; + } + + PrunerHandle handle; + pe->mPruner->addObjects(&handle, boundsPtr, &payload, &transform, 1, false); + + return createActorShapeData(createPrunerInfo(prunerIndex, dynamic), handle); +} + +void QuerySystem::removePrunerShape(ActorShapeData data, PrunerPayloadRemovalCallback* removalCallback) +{ + const PrunerInfo info = getPrunerInfo(data); + const PxU32 prunerIndex = getPrunerIndex(info); + + PrunerExt* pe = checkPrunerIndex(prunerIndex, mPrunerExt); + if(!pe) + return; + + mPrunerNeedsUpdating = true; + const PxU32 dynamic = getDynamic(info); + + const PrunerHandle handle = getPrunerHandle(data); + + PX_ASSERT(pe->mPruner); + + if(dynamic) + { + PX_ASSERT(pe->mNbDynamic); + pe->mNbDynamic--; + } + else + { + PX_ASSERT(pe->mNbStatic); + pe->mNbStatic--; + invalidateStaticTimestamp(); + } + + //if(mBatchUserUpdates) + pe->removeFromDirtyList(handle); + pe->mPruner->removeObjects(&handle, 1, removalCallback); +} + +void QuerySystem::updatePrunerShape(ActorShapeData data, bool immediately, const PxTransform& transform, const PxBounds3* userBounds) +{ + const PrunerInfo info = getPrunerInfo(data); + const PxU32 prunerIndex = getPrunerIndex(info); + + PrunerExt* pe = checkPrunerIndex(prunerIndex, mPrunerExt); + if(!pe) + return; + + mPrunerNeedsUpdating = true; + const PxU32 dynamic = getDynamic(info); + const PrunerHandle handle = getPrunerHandle(data); + + PX_ASSERT(pe->mPruner); + + Pruner* pruner = pe->mPruner; + + if(immediately) + { + if(!dynamic) + invalidateStaticTimestamp(); + + PrunerPayloadData payloadData; + const PrunerPayload& pp = pruner->getPayloadData(handle, &payloadData); + + *payloadData.mTransform = transform; + + if(userBounds) + *payloadData.mBounds = *userBounds; + else + computeBounds(*payloadData.mBounds, mAdapter.getGeometry(pp), transform, 0.0f, 1.0f + mInflation); + + // PT: TODO: would it be better to pass the bounds & transform directly to this function? + pruner->updateObjects(&handle, 1); + } + else + { + // PT: we don't update the static timestamp immediately, so that users can query the + // old state of the structure without invalidating their caches. This will be resolved + // in processDirtyLists. + + if(gUseOldCode) + pruner->setTransform(handle, transform); + + // PT: we don't shrink mDirtyList anymore in removePrunerShape so the size of that array can be reused as + // a flag telling us whether we already encountered this pruner or not. If not, we add its index to mDirtyPruners. + // Goal is to avoid processing all pruners in processDirtyLists. + if(!pe->mDirtyList.size()) + { + PX_ASSERT(!contains(mDirtyPruners, prunerIndex)); + mDirtyPruners.pushBack(prunerIndex); + } + else + { + PX_ASSERT(contains(mDirtyPruners, prunerIndex)); + } + + pe->addToDirtyList(handle, dynamic, transform, userBounds); + } +} + +const PrunerPayload& QuerySystem::getPayloadData(ActorShapeData data, PrunerPayloadData* ppd) const +{ + const PrunerInfo info = getPrunerInfo(data); + const PxU32 prunerIndex = getPrunerIndex(info); + + PX_ASSERT(checkPrunerIndex(prunerIndex, mPrunerExt)); + + const PrunerHandle handle = getPrunerHandle(data); + + PX_ASSERT(mPrunerExt[prunerIndex]->mPruner); + return mPrunerExt[prunerIndex]->mPruner->getPayloadData(handle, ppd); +} + +void QuerySystem::processDirtyLists() +{ + PX_PROFILE_ZONE("QuerySystem.processDirtyLists", mContextID); + + const PxU32 nbDirtyPruners = mDirtyPruners.size(); + if(!nbDirtyPruners) + return; + + // must already have acquired writer lock here + + const float inflation = 1.0f + mInflation; + + bool mustInvalidateStaticTimestamp = false; + for(PxU32 ii=0;iiprocessDirtyList(mAdapter, inflation)) + mustInvalidateStaticTimestamp = true; + } + + if(mustInvalidateStaticTimestamp) + invalidateStaticTimestamp(); + + mDirtyPruners.clear(); +} + +void QuerySystem::update(bool buildStep, bool commit) +{ + PX_PROFILE_ZONE("QuerySystem::update", mContextID); + + if(!buildStep && !commit) + { + //mPrunerNeedsUpdating = true; // PT: removed, why was it here? + return; + } + + // flush user modified objects +// if(mBatchUserUpdates) + processDirtyLists(); + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;imPruner; + if(pruner) + { + if(buildStep && pruner->isDynamic()) + static_cast(pruner)->buildStep(true); + + if(commit) + pruner->commit(); + } + } + + if(commit) + { + if(mUsesTreeOfPruners) + createTreeOfPruners(); + } + + mPrunerNeedsUpdating = !commit; +} + +void QuerySystem::commitUpdates() +{ + PX_PROFILE_ZONE("QuerySystem.commitUpdates", mContextID); + + if(mPrunerNeedsUpdating) + { + mSQLock.lock(); + + if(mPrunerNeedsUpdating) + { + //if(mBatchUserUpdates) + processDirtyLists(); + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;imPruner; + if(pruner) + pruner->commit(); + } + + if(mUsesTreeOfPruners) + createTreeOfPruners(); + + PxMemoryBarrier(); + mPrunerNeedsUpdating = false; + } + mSQLock.unlock(); + } +} + +PxU32 QuerySystem::startCustomBuildstep() +{ + PX_PROFILE_ZONE("QuerySystem.startCustomBuildstep", mContextID); + + mTimestampNeedsUpdating = false; + + return mPrunerExt.size(); +} + +void QuerySystem::customBuildstep(PxU32 index) +{ + PX_PROFILE_ZONE("QuerySystem.customBuildstep", mContextID); + + PX_ASSERT(indexmPruner; + + //void QuerySystem::processDirtyLists() + { + PX_PROFILE_ZONE("QuerySystem.processDirtyLists", mContextID); + // must already have acquired writer lock here + const float inflation = 1.0f + mInflation; + // PT: note that we don't use the mDirtyPruners array here + if(pe->processDirtyList(mAdapter, inflation)) + mTimestampNeedsUpdating = true; + } + + if(pruner) + { + if(pruner->isDynamic()) + static_cast(pruner)->buildStep(true); // PT: "true" because that parameter was made for PxSceneQuerySystem::sceneQueryBuildStep(), not us + + pruner->commit(); + } +} + +void QuerySystem::finishCustomBuildstep() +{ + PX_PROFILE_ZONE("QuerySystem.finishCustomBuildstep", mContextID); + + if(mUsesTreeOfPruners) + createTreeOfPruners(); + + mPrunerNeedsUpdating = false; + if(mTimestampNeedsUpdating) + invalidateStaticTimestamp(); + + mDirtyPruners.clear(); +} + +void QuerySystem::sync(PxU32 prunerIndex, const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count) +{ + if(!count) + return; + + PrunerExt* pe = checkPrunerIndex(prunerIndex, mPrunerExt); + if(!pe) + return; + + Pruner* pruner = pe->mPruner; + if(pruner) + pruner->updateObjects(handles, count, mInflation, boundsIndices, bounds, transforms); +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct LocalRaycastCB : PxBVHRaycastCallback + { + LocalRaycastCB(const PxArray& pruners, const PrunerFilter* prunerFilter, const PxVec3& origin, const PxVec3& unitDir, PrunerRaycastCallback& cb) : + mPrunerExt(pruners), mPrunerFilter(prunerFilter), mOrigin(origin), mUnitDir(unitDir), mCB(cb) {} + + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) + { + QuerySystem::PrunerExt* pe = mPrunerExt[boundsIndex]; // Can be NULL if the pruner has been removed + if(pe && (!mPrunerFilter || mPrunerFilter->processPruner(boundsIndex))) + { + Pruner* pruner = pe->mPruner; + if(!pruner->raycast(mOrigin, mUnitDir, distance, mCB)) + return false; + } + return true; + } + + const PxArray& mPrunerExt; + const PrunerFilter* mPrunerFilter; + const PxVec3& mOrigin; + const PxVec3& mUnitDir; + PrunerRaycastCallback& mCB; + + PX_NOCOPY(LocalRaycastCB) + }; + + struct LocalOverlapCB : PxBVHOverlapCallback + { + LocalOverlapCB(const PxArray& pruners, const PrunerFilter* prunerFilter, const ShapeData& queryVolume, PrunerOverlapCallback& cb) : + mPrunerExt(pruners), mPrunerFilter(prunerFilter), mQueryVolume(queryVolume), mCB(cb) {} + + virtual bool reportHit(PxU32 boundsIndex) + { + QuerySystem::PrunerExt* pe = mPrunerExt[boundsIndex]; // Can be NULL if the pruner has been removed + if(pe && (!mPrunerFilter || mPrunerFilter->processPruner(boundsIndex))) + { + Pruner* pruner = pe->mPruner; + if(!pruner->overlap(mQueryVolume, mCB)) + return false; + } + return true; + } + + const PxArray& mPrunerExt; + const PrunerFilter* mPrunerFilter; + const ShapeData& mQueryVolume; + PrunerOverlapCallback& mCB; + + PX_NOCOPY(LocalOverlapCB) + }; + + struct LocalSweepCB : PxBVHRaycastCallback + { + LocalSweepCB(const PxArray& pruners, const PrunerFilter* prunerFilter, const ShapeData& queryVolume, const PxVec3& unitDir, PrunerRaycastCallback& cb) : + mPrunerExt(pruners), mPrunerFilter(prunerFilter), mQueryVolume(queryVolume), mUnitDir(unitDir), mCB(cb) {} + + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) + { + QuerySystem::PrunerExt* pe = mPrunerExt[boundsIndex]; // Can be NULL if the pruner has been removed + if(pe && (!mPrunerFilter || mPrunerFilter->processPruner(boundsIndex))) + { + Pruner* pruner = pe->mPruner; + if(!pruner->sweep(mQueryVolume, mUnitDir, distance, mCB)) + return false; + } + return true; + } + + const PxArray& mPrunerExt; + const PrunerFilter* mPrunerFilter; + const ShapeData& mQueryVolume; + const PxVec3& mUnitDir; + PrunerRaycastCallback& mCB; + + PX_NOCOPY(LocalSweepCB) + }; +} + +void QuerySystem::raycast(const PxVec3& origin, const PxVec3& unitDir, float& inOutDistance, PrunerRaycastCallback& cb, const PrunerFilter* prunerFilter) const +{ + if(mTreeOfPruners) + { + LocalRaycastCB localCB(mPrunerExt, prunerFilter, origin, unitDir, cb); + mTreeOfPruners->raycast(origin, unitDir, inOutDistance, localCB, PxGeometryQueryFlag::Enum(0)); + } + else + { + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iprocessPruner(i)) + { + Pruner* pruner = pe->mPruner; + if(!pruner->raycast(origin, unitDir, inOutDistance, cb)) + return; + } + } + } +} + +void QuerySystem::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& cb, const PrunerFilter* prunerFilter) const +{ + if(mTreeOfPruners) + { + LocalOverlapCB localCB(mPrunerExt, prunerFilter, queryVolume, cb); + mTreeOfPruners->overlap(queryVolume, localCB, PxGeometryQueryFlag::Enum(0)); + } + else + { + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iprocessPruner(i)) + { + Pruner* pruner = pe->mPruner; + if(!pruner->overlap(queryVolume, cb)) + return; + } + } + } +} + +void QuerySystem::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, float& inOutDistance, PrunerRaycastCallback& cb, const PrunerFilter* prunerFilter) const +{ + if(mTreeOfPruners) + { + LocalSweepCB localCB(mPrunerExt, prunerFilter, queryVolume, unitDir, cb); + mTreeOfPruners->sweep(queryVolume, unitDir, inOutDistance, localCB, PxGeometryQueryFlag::Enum(0)); + } + else + { + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iprocessPruner(i)) + { + Pruner* pruner = pe->mPruner; + if(!pruner->sweep(queryVolume, unitDir, inOutDistance, cb)) + return; + } + } + } +} + +void QuerySystem::createTreeOfPruners() +{ + PX_PROFILE_ZONE("QuerySystem.createTreeOfPruners", mContextID); + + PX_DELETE(mTreeOfPruners); + + mTreeOfPruners = PX_NEW(BVH)(NULL); + + const PxU32 nb = mPrunerExt.size(); + + PxBounds3* prunerBounds = reinterpret_cast(PxAlloca(sizeof(PxBounds3)*(nb+1))); + + PxU32 nbBounds = 0; + for(PxU32 i=0;imPruner; + if(pruner) + pruner->getGlobalBounds(prunerBounds[nbBounds++]); + } + + mTreeOfPruners->init(nbBounds, NULL, prunerBounds, sizeof(PxBounds3), BVH_SPLATTER_POINTS, 1, 0.01f); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp new file mode 100644 index 0000000..92cbda0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuRaycastTests.cpp @@ -0,0 +1,655 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "geometry/PxCustomGeometry.h" +#include "GuMidphaseInterface.h" +#include "GuInternal.h" +#include "GuIntersectionRayCapsule.h" +#include "GuIntersectionRaySphere.h" +#include "GuIntersectionRayPlane.h" +#include "GuHeightFieldUtil.h" +#include "GuDistancePointSegment.h" +#include "GuConvexMesh.h" +#include "CmScaling.h" + +using namespace physx; +using namespace Gu; + +////////////////////////////////////////////////// raycasts ////////////////////////////////////////////////////////////////// +PxU32 raycast_box(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + PX_ASSERT(maxHits && hits); + PX_UNUSED(threadContext); + PX_UNUSED(maxHits); + PX_UNUSED(stride); + const PxBoxGeometry& boxGeom = static_cast(geom); + + const PxTransform& absPose = pose; + + PxVec3 localOrigin = rayOrigin - absPose.p; + localOrigin = absPose.q.rotateInv(localOrigin); + + const PxVec3 localDir = absPose.q.rotateInv(rayDir); + + PxVec3 localImpact; + PxReal t; + PxU32 rval = rayAABBIntersect2(-boxGeom.halfExtents, boxGeom.halfExtents, localOrigin, localDir, localImpact, t); + if(!rval) + return 0; + + if(t>maxDist) + return 0; + + hits->distance = t; //worldRay.orig.distance(hit.worldImpact); //should be the same, assuming ray dir was normalized!! + hits->faceIndex = 0xffffffff; + hits->u = 0.0f; + hits->v = 0.0f; + + PxHitFlags outFlags = PxHitFlags(0); + if((hitFlags & PxHitFlag::ePOSITION)) + { + outFlags |= PxHitFlag::ePOSITION; + if(t!=0.0f) + hits->position = absPose.transform(localImpact); + else + hits->position = rayOrigin; + } + + // Compute additional information if needed + if(hitFlags & PxHitFlag::eNORMAL) + { + outFlags |= PxHitFlag::eNORMAL; + + //Because rayAABBIntersect2 set t = 0 if start point inside shape + if(t == 0) + { + hits->normal = -rayDir; + } + else + { + //local space normal is: + rval--; + PxVec3 n(0.0f); + n[rval] = PxReal((localImpact[rval] > 0.0f) ? 1.0f : -1.0f); + hits->normal = absPose.q.rotate(n); + } + } + else + { + hits->normal = PxVec3(0.0f); + } + hits->flags = outFlags; + return 1; +} + +PxU32 raycast_sphere(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE); + PX_ASSERT(maxHits && hits); + PX_UNUSED(threadContext); + PX_UNUSED(maxHits); + PX_UNUSED(stride); + + const PxSphereGeometry& sphereGeom = static_cast(geom); + + if(!intersectRaySphere(rayOrigin, rayDir, maxDist, pose.p, sphereGeom.radius, hits->distance, &hits->position)) + return 0; + + /* // PT: should be useless now + hit.distance = worldRay.orig.distance(hit.worldImpact); + if(hit.distance>maxDist) + return false; + */ + // PT: we can't avoid computing the position here since it's needed to compute the normal anyway + hits->faceIndex = 0xffffffff; + hits->u = 0.0f; + hits->v = 0.0f; + + // Compute additional information if needed + PxHitFlags outFlags = PxHitFlag::ePOSITION; + if(hitFlags & PxHitFlag::eNORMAL) + { + // User requested impact normal + //Because intersectRaySphere set distance = 0 if start point inside shape + if(hits->distance == 0.0f) + { + hits->normal = -rayDir; + } + else + { + hits->normal = hits->position - pose.p; + hits->normal.normalize(); + } + outFlags |= PxHitFlag::eNORMAL; + } + else + { + hits->normal = PxVec3(0.0f); + } + hits->flags = outFlags; + + return 1; +} + +PxU32 raycast_capsule(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE); + PX_ASSERT(maxHits && hits); + PX_UNUSED(threadContext); + PX_UNUSED(maxHits); + PX_UNUSED(stride); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + // TODO: PT: could we simplify this ? + Capsule capsule; + getCapsuleSegment(pose, capsuleGeom, capsule); + capsule.radius = capsuleGeom.radius; + + PxReal t = 0.0f; + if(!intersectRayCapsule(rayOrigin, rayDir, capsule, t)) + return 0; + + if(t<0.0f || t>maxDist) + return 0; + + // PT: we can't avoid computing the position here since it's needed to compute the normal anyway + hits->position = rayOrigin + rayDir*t; // PT: will be rayOrigin for t=0.0f (i.e. what the spec wants) + hits->distance = t; + hits->faceIndex = 0xffffffff; + hits->u = 0.0f; + hits->v = 0.0f; + + // Compute additional information if needed + PxHitFlags outFlags = PxHitFlag::ePOSITION; + if(hitFlags & PxHitFlag::eNORMAL) + { + outFlags |= PxHitFlag::eNORMAL; + + if(t==0.0f) + { + hits->normal = -rayDir; + } + else + { + PxReal capsuleT; + distancePointSegmentSquared(capsule, hits->position, &capsuleT); + capsule.computePoint(hits->normal, capsuleT); + hits->normal = hits->position - hits->normal; //this should never be zero. It should have a magnitude of the capsule radius. + hits->normal.normalize(); + } + } + else + { + hits->normal = PxVec3(0.0f); + } + hits->flags = outFlags; + + return 1; +} + +PxU32 raycast_plane(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::ePLANE); + PX_ASSERT(maxHits && hits); + PX_UNUSED(threadContext); + PX_UNUSED(hitFlags); + PX_UNUSED(maxHits); + PX_UNUSED(stride); + PX_UNUSED(geom); +// const PxPlaneGeometry& planeGeom = static_cast(geom); + + // Perform backface culling so that we can pick objects beyond planes + const PxPlane plane = getPlane(pose); + if(rayDir.dot(plane.n)>=0.0f) + return false; + + PxReal distanceAlongLine; + if(!intersectRayPlane(rayOrigin, rayDir, plane, distanceAlongLine, &hits->position)) + return 0; + + /* + PxReal test = worldRay.orig.distance(hit.worldImpact); + + PxReal dd; + PxVec3 pp; + PxSegmentPlaneIntersect(worldRay.orig, worldRay.orig+worldRay.dir*1000.0f, plane, dd, pp); + */ + + if(distanceAlongLine<0.0f) + return 0; + + if(distanceAlongLine>maxDist) + return 0; + + hits->distance = distanceAlongLine; + hits->faceIndex = 0xffffffff; + hits->u = 0.0f; + hits->v = 0.0f; + hits->flags = PxHitFlag::ePOSITION|PxHitFlag::eNORMAL; + hits->normal = plane.n; + return 1; +} + +PxU32 raycast_convexMesh(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eCONVEXMESH); + PX_ASSERT(maxHits && hits); + PX_ASSERT(PxAbs(rayDir.magnitudeSquared()-1)<1e-4f); + PX_UNUSED(threadContext); + PX_UNUSED(maxHits); + PX_UNUSED(stride); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + + PxGeomRaycastHit& hit = *hits; + + //scaling: transform the ray to vertex space + const PxMat34 world2vertexSkew = convexGeom.scale.getInverse() * pose.getInverse(); + + //ConvexMesh* cmesh = static_cast(convexGeom.convexMesh); + const PxU32 nPolys = convexMesh->getNbPolygonsFast(); + const HullPolygonData* PX_RESTRICT polysEA = convexMesh->getPolygons(); + const HullPolygonData* polys = polysEA; + + const PxVec3 vrayOrig = world2vertexSkew.transform(rayOrigin); + const PxVec3 vrayDir = world2vertexSkew.rotate(rayDir); + + /* + Purely convex planes based algorithm + Iterate all planes of convex, with following rules: + * determine of ray origin is inside them all or not. + * planes parallel to ray direction are immediate early out if we're on the outside side (plane normal is sep axis) + * else + - for all planes the ray direction "enters" from the front side, track the one furthest along the ray direction (A) + - for all planes the ray direction "exits" from the back side, track the one furthest along the negative ray direction (B) + if the ray origin is outside the convex and if along the ray, A comes before B, the directed line stabs the convex at A + */ + bool originInsideAllPlanes = true; + PxReal latestEntry = -FLT_MAX; + PxReal earliestExit = FLT_MAX; +// PxU32 bestPolygonIndex = 0; + hit.faceIndex = 0xffffffff; + + for(PxU32 i=0;i 0.0f) + originInsideAllPlanes = false; //origin not behind plane == ray starts outside the convex. + + if(dn > 1E-7f) //the ray direction "exits" from the back side + { + earliestExit = physx::intrinsics::selectMin(earliestExit, distAlongRay); + } + else if(dn < -1E-7f) //the ray direction "enters" from the front side + { + if(distAlongRay > latestEntry) + { + latestEntry = distAlongRay; + hit.faceIndex = i; + } + } + else + { + //plane normal and ray dir are orthogonal + if(distToPlane > 0.0f) + return 0; //a plane is parallel with ray -- and we're outside the ray -- we definitely miss the entire convex! + } + } + + if(originInsideAllPlanes) //ray starts inside convex + { + hit.distance = 0.0f; + hit.faceIndex = 0xffffffff; + hit.u = 0.0f; + hit.v = 0.0f; + hit.position = rayOrigin; + hit.normal = -rayDir; + hit.flags = PxHitFlag::eNORMAL|PxHitFlag::ePOSITION; + return 1; + } + + // AP: changed to latestEntry < maxDist-1e-5f so that we have a conservatively negative result near end of ray + if(latestEntry < earliestExit && latestEntry > 0.0f && latestEntry < maxDist-1e-5f) + { + PxHitFlags outFlags = PxHitFlag::eFACE_INDEX; + if(hitFlags & PxHitFlag::ePOSITION) + { + outFlags |= PxHitFlag::ePOSITION; + const PxVec3 pointOnPlane = vrayOrig + latestEntry * vrayDir; + hit.position = pose.transform(Cm::toMat33(convexGeom.scale) * pointOnPlane); + } + hit.distance = latestEntry; + hit.u = 0.0f; + hit.v = 0.0f; + hit.normal = PxVec3(0.0f); + + // Compute additional information if needed + if(hitFlags & PxHitFlag::eNORMAL) + { + outFlags |= PxHitFlag::eNORMAL; + //when we have nonuniform scaling we actually have to transform by the transpose of the inverse of vertex2worldSkew.M == transpose of world2vertexSkew: + hit.normal = world2vertexSkew.rotateTranspose(polys[hit.faceIndex].mPlane.n); + hit.normal.normalize(); + } + hit.flags = outFlags; + return 1; + } + return 0; +} + +PxU32 raycast_particlesystem(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::ePARTICLESYSTEM); + PX_ASSERT(PxAbs(rayDir.magnitudeSquared() - 1)<1e-4f); + PX_UNUSED(threadContext); + PX_UNUSED(stride); + PX_UNUSED(rayDir); + PX_UNUSED(pose); + PX_UNUSED(rayOrigin); + PX_UNUSED(maxHits); + PX_UNUSED(maxDist); + PX_UNUSED(hits); + PX_UNUSED(hitFlags); + PX_UNUSED(geom); + + return 0; +} + +PxU32 raycast_softbody(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eTETRAHEDRONMESH); + PX_ASSERT(PxAbs(rayDir.magnitudeSquared() - 1)<1e-4f); + + PX_UNUSED(threadContext); + PX_UNUSED(stride); + PX_UNUSED(rayDir); + PX_UNUSED(pose); + PX_UNUSED(rayOrigin); + PX_UNUSED(maxHits); + PX_UNUSED(maxDist); + PX_UNUSED(hits); + PX_UNUSED(hitFlags); + + const PxTetrahedronMeshGeometry& meshGeom = static_cast(geom); + + PX_UNUSED(meshGeom); + + //ML: need to implement raycastTetrahedronMesh + return 0; +} + +PxU32 raycast_triangleMesh(GU_RAY_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_ASSERT(geom.getType() == PxGeometryType::eTRIANGLEMESH); + PX_ASSERT(PxAbs(rayDir.magnitudeSquared()-1)<1e-4f); + + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + return Midphase::raycastTriangleMesh(meshData, meshGeom, pose, rayOrigin, rayDir, maxDist, hitFlags, maxHits, hits, stride); +} + +PxU32 raycast_hairsystem(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eHAIRSYSTEM); + PX_ASSERT(PxAbs(rayDir.magnitudeSquared() - 1)<1e-4f); + + PX_UNUSED(threadContext); + PX_UNUSED(stride); + PX_UNUSED(rayDir); + PX_UNUSED(pose); + PX_UNUSED(rayOrigin); + PX_UNUSED(maxHits); + PX_UNUSED(maxDist); + PX_UNUSED(hits); + PX_UNUSED(hitFlags); + PX_UNUSED(geom); + + return 0; +} + +namespace +{ + struct HFTraceSegmentCallback + { + PX_NOCOPY(HFTraceSegmentCallback) + public: + PxU8* mHits; + const PxU32 mMaxHits; + const PxU32 mStride; + PxU32 mNbHits; + const HeightFieldUtil& mUtil; + const PxTransform& mPose; + const PxVec3& mRayDir; + const PxVec3& mLocalRayDir; + const PxVec3& mLocalRayOrig; + const PxHitFlags mHitFlags; + const bool mIsDoubleSided; + + HFTraceSegmentCallback( PxGeomRaycastHit* hits, PxU32 maxHits, PxU32 stride, const PxHitFlags hitFlags, const HeightFieldUtil& hfUtil, const PxTransform& pose, + const PxVec3& rayDir, const PxVec3& localRayDir, const PxVec3& localRayOrig, + bool isDoubleSided) : + mHits (reinterpret_cast(hits)), + mMaxHits (maxHits), + mStride (stride), + mNbHits (0), + mUtil (hfUtil), + mPose (pose), + mRayDir (rayDir), + mLocalRayDir (localRayDir), + mLocalRayOrig (localRayOrig), + mHitFlags (hitFlags), + mIsDoubleSided (isDoubleSided) + { + PX_ASSERT(maxHits > 0); + } + + PX_FORCE_INLINE bool onEvent(PxU32, const PxU32*) + { + return true; + } + + PX_FORCE_INLINE bool underFaceHit(const HeightFieldUtil&, const PxVec3&, const PxVec3&, PxF32, PxF32, PxF32, PxU32) + { + return true; // true means continue traversal + } + + PxAgain faceHit(const HeightFieldUtil&, const PxVec3& aHitPoint, PxU32 aTriangleIndex, PxReal u, PxReal v) + { + // traversal is strictly sorted so there's no need to sort hits + if(mNbHits >= mMaxHits) + return false; // false = stop traversal + + PxGeomRaycastHit& hit = *reinterpret_cast(mHits); + mNbHits++; + mHits += mStride; + hit.position = aHitPoint; + hit.faceIndex = aTriangleIndex; + hit.u = u; + hit.v = v; + hit.flags = PxHitFlag::eUV | PxHitFlag::eFACE_INDEX; // UVs and face index are always set + + if(mHitFlags & PxHitFlag::eNORMAL) + { + // We need the normal for the dot product. + PxVec3 normal = mPose.q.rotate(mUtil.getNormalAtShapePoint(hit.position.x, hit.position.z)); + normal.normalize(); + if(mIsDoubleSided && normal.dot(mRayDir) > 0.0f) // comply with normal spec for double sided (should always face opposite rayDir) + hit.normal = -normal; + else + hit.normal = normal; + hit.flags |= PxHitFlag::eNORMAL; + } + + hit.distance = physx::intrinsics::selectMax(0.f, (hit.position - mLocalRayOrig).dot(mLocalRayDir)); + + if(mHitFlags & PxHitFlag::ePOSITION) + { + hit.position = mPose.transform(hit.position); + hit.flags |= PxHitFlag::ePOSITION; + } + return (mNbHits < mMaxHits); // true = continue traversal, false = stop traversal + } + }; +} + +PxU32 raycast_heightField(GU_RAY_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eHEIGHTFIELD); + PX_ASSERT(maxHits && hits); + PX_UNUSED(threadContext); + + const PxHeightFieldGeometry& hfGeom = static_cast(geom); + + const PxTransform invAbsPose = pose.getInverse(); + const PxVec3 localRayOrig = invAbsPose.transform(rayOrigin); + const PxVec3 localRayDir = invAbsPose.rotate(rayDir); + + const bool isDoubleSided = hfGeom.heightFieldFlags.isSet(PxMeshGeometryFlag::eDOUBLE_SIDED); + const bool bothSides = isDoubleSided || (hitFlags & PxHitFlag::eMESH_BOTH_SIDES); + + const HeightFieldTraceUtil hfUtil(hfGeom); + + PxVec3 normRayDir = localRayDir; + normRayDir.normalizeSafe(); // nothing will happen if length is < PX_NORMALIZATION_EPSILON + + // pretest if we intersect HF bounds. If no early exit, if yes move the origin and shorten the maxDist + // to deal with precision issues with large maxDist + PxBounds3 hfLocalBounds; + hfUtil.computeLocalBounds(hfLocalBounds); + + // PT: inflate the bounds like we do in the scene-tree (see PX-1179) + const PxVec3 center = hfLocalBounds.getCenter(); + const PxVec3 extents = hfLocalBounds.getExtents() * 1.01f; //SQ_PRUNER_INFLATION; + hfLocalBounds.minimum = center - extents; + hfLocalBounds.maximum = center + extents; + + PxVec3 localImpact; + PxReal t; // closest intersection, t==0 hit inside + PxU32 rval = rayAABBIntersect2(hfLocalBounds.minimum, hfLocalBounds.maximum, localRayOrig, localRayDir, localImpact, t); + // early exit we miss the AABB + if (!rval) + return 0; + if (t > maxDist) + return 0; + + // PT: if eMESH_ANY is used then eMESH_MULTIPLE won't be, and we'll stop the query after 1 hit is found. There is no difference + // between 'any hit' and 'closest hit' for HFs since hits are reported in order. + HFTraceSegmentCallback callback(hits, hitFlags.isSet(PxHitFlag::eMESH_MULTIPLE) ? maxHits : 1, stride, hitFlags, hfUtil, pose, + rayDir, localRayDir, localRayOrig, isDoubleSided); // make sure we return only 1 hit without eMESH_MULTIPLE + + PxReal offset = 0.0f; + PxReal maxDistOffset = maxDist; + PxVec3 localRayOrigOffset = localRayOrig; + + // if we don't start inside the AABB box, offset the start pos, because of precision issues with large maxDist + if(t > 0.0f) + { + offset = t - GU_RAY_SURFACE_OFFSET; + // move the rayOrig to offset start pos + localRayOrigOffset = localRayOrig + normRayDir*offset; + } + + // shorten the maxDist of the offset that was cut off and clip it + // we pick either the original maxDist, if maxDist is huge we clip it + maxDistOffset = PxMin(maxDist - offset, GU_RAY_SURFACE_OFFSET + 2.0f * PxMax(hfLocalBounds.maximum.x - hfLocalBounds.minimum.x, PxMax(hfLocalBounds.maximum.y - hfLocalBounds.minimum.y, hfLocalBounds.maximum.z - hfLocalBounds.minimum.z))); + + hfUtil.traceSegment(localRayOrigOffset, normRayDir, maxDistOffset, + &callback, hfLocalBounds, !bothSides); + return callback.mNbHits; +} + +static PxU32 raycast_heightField_unregistered(GU_RAY_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(stride); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(rayOrigin); + PX_UNUSED(rayDir); + PX_UNUSED(maxDist); + PX_UNUSED(hitFlags); + PX_UNUSED(maxHits); + PX_UNUSED(hits); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Height Field Raycast test called with height fields unregistered "); + return 0; +} + +static PxU32 raycast_custom(GU_RAY_FUNC_PARAMS) +{ + const PxCustomGeometry& customGeom = static_cast(geom); + if(customGeom.isValid()) + return customGeom.callbacks->raycast(rayOrigin, rayDir, geom, pose, maxDist, hitFlags, maxHits, hits, stride, threadContext); + + return 0; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// PT: table is not static because it's accessed as 'extern' within Gu (bypassing the function call). +RaycastFunc gRaycastMap[] = +{ + raycast_sphere, + raycast_plane, + raycast_capsule, + raycast_box, + raycast_convexMesh, + raycast_particlesystem, + raycast_softbody, + raycast_triangleMesh, + raycast_heightField_unregistered, + raycast_hairsystem, + raycast_custom +}; +PX_COMPILE_TIME_ASSERT(sizeof(gRaycastMap) / sizeof(gRaycastMap[0]) == PxGeometryType::eGEOMETRY_COUNT); + +// PT: the function is used by external modules (Np, CCT, Sq) +const Gu::GeomRaycastTable& Gu::getRaycastFuncTable() +{ + return gRaycastMap; +} + +void registerHeightFields_Raycasts() +{ + gRaycastMap[PxGeometryType::eHEIGHTFIELD] = raycast_heightField; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp new file mode 100644 index 0000000..4f1c2ab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSAH.cpp @@ -0,0 +1,192 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxMemory.h" +#include "GuSAH.h" + +using namespace physx; +using namespace Gu; + +static PX_FORCE_INLINE float getSurfaceArea(const PxBounds3& bounds) +{ + const PxVec3 e = bounds.maximum - bounds.minimum; + return 2.0f * (e.x * e.y + e.x * e.z + e.y * e.z); +} + +SAH_Buffers::SAH_Buffers(PxU32 nb_prims) +{ + mKeys = PX_ALLOCATE(float, nb_prims, "temp"); + mCumulativeLower = PX_ALLOCATE(float, nb_prims, "temp"); + mCumulativeUpper = PX_ALLOCATE(float, nb_prims, "temp"); + mNb = nb_prims; +} + +SAH_Buffers::~SAH_Buffers() +{ + PX_FREE(mKeys); + PX_FREE(mCumulativeLower); + PX_FREE(mCumulativeUpper); +} + +bool SAH_Buffers::split(PxU32& leftCount, PxU32 nb, const PxU32* PX_RESTRICT prims, const PxBounds3* PX_RESTRICT boxes, const PxVec3* PX_RESTRICT centers) +{ + PxU32 bestAxis = 0; + PxU32 bestIndex = 0; + float bestCost = PX_MAX_F32; + + PX_ASSERT(nb<=mNb); + for(PxU32 axis=0;axis<3;axis++) + { + const PxU32* sorted; + { + float* keys = mKeys; + for(PxU32 i=0;i begin; --i) { + bbox.extend(bboxes[references[axis][i]]); + costs[axis][i] = bbox.half_area() * (end - i); + } + bbox = BoundingBox::empty(); + auto best_split = std::pair(std::numeric_limits::max(), end); + for (size_t i = begin; i < end - 1; ++i) { + bbox.extend(bboxes[references[axis][i]]); + auto cost = bbox.half_area() * (i + 1 - begin) + costs[axis][i + 1]; + if (cost < best_split.first) + best_split = std::make_pair(cost, i + 1); + } + return best_split; + }*/ + + if(1) + { + // two passes over data to calculate upper and lower bounds + PxBounds3 lower = PxBounds3::empty(); + PxBounds3 upper = PxBounds3::empty(); +// lower.minimum = lower.maximum = PxVec3(0.0f); +// upper.minimum = upper.maximum = PxVec3(0.0f); + +#if PX_ENABLE_ASSERTS + float prevLowerCenter = -PX_MAX_F32; + float prevUpperCenter = PX_MAX_F32; +#endif + for(PxU32 i=0; i=prevLowerCenter); + lower.include(boxes[prims[lowSortedIndex]]); +#if PX_ENABLE_ASSERTS + prevLowerCenter = centers[prims[lowSortedIndex]][axis]; +#endif + //upper.Union(m_faceBounds[faces[numFaces - i - 1]]); + PX_ASSERT(centers[prims[highSortedIndex]][axis]<=prevUpperCenter); + upper.include(boxes[prims[highSortedIndex]]); +#if PX_ENABLE_ASSERTS + prevUpperCenter = centers[prims[highSortedIndex]][axis]; +#endif + + cumulativeLower[i] = getSurfaceArea(lower); + cumulativeUpper[nb - i - 1] = getSurfaceArea(upper); + } + +// const float invTotalSA = 1.0f / cumulativeUpper[0]; + + // test all split positions + for (PxU32 i = 0; i < nb - 1; ++i) + { + const float pBelow = cumulativeLower[i];// * invTotalSA; + const float pAbove = cumulativeUpper[i];// * invTotalSA; + +// const float cost = 0.125f + (pBelow * i + pAbove * float(nb - i)); + const float cost = (pBelow * i + pAbove * float(nb - i)); + if(cost <= bestCost) + { + bestCost = cost; + bestIndex = i; + bestAxis = axis; + } + } + } + } + + leftCount = bestIndex + 1; + + if(leftCount==1 || leftCount==nb) + { + // Invalid split + return false; + } + +/* + // re-sort by best axis + FaceSorter predicate(&m_vertices[0], &m_indices[0], m_numFaces * 3, bestAxis); + std::sort(faces, faces + numFaces, predicate); + + return bestIndex + 1; +*/ + + { + PxU32* tmp = reinterpret_cast(mKeys); + PxMemCopy(tmp, prims, nb*sizeof(PxU32)); + + const PxU32* bestOrder = mSorters[bestAxis].GetRanks(); + + PxU32* dst = const_cast(prims); + for(PxU32 i=0;i 0) + { + //Sparse sdf + PX_ASSERT(dimX % subgridSize == 0); + PX_ASSERT(dimY % subgridSize == 0); + PX_ASSERT(dimZ % subgridSize == 0); + + PxU32 x = dimX / subgridSize; + PxU32 y = dimY / subgridSize; + PxU32 z = dimZ / subgridSize; + + mNumSdfs = (x + 1) * (y + 1) * (z + 1); + mNumSubgridSdfs = mBytesPerSparsePixel * sdfSubgrids3DTexBlockDimX * (subgridSize + 1) * sdfSubgrids3DTexBlockDimY * (subgridSize + 1) * sdfSubgrids3DTexBlockDimZ * (subgridSize + 1); + mNumStartSlots = x * y * z; + + mSubgridSdf = PX_ALLOCATE(PxU8, mNumSubgridSdfs, "PxU8"); + mSubgridStartSlots = PX_ALLOCATE(PxU32, mNumStartSlots, "PxU32"); + mSdf = PX_ALLOCATE(PxReal, mNumSdfs, "PxReal"); + } + else + { + //Dense sdf - no sparse grid data required + mSubgridStartSlots = NULL; + mSubgridSdf = NULL; + + mNumSdfs = dimX * dimY*dimZ; + mNumSubgridSdfs = 0; + mNumStartSlots = 0; + mSdf = PX_ALLOCATE(PxReal, mNumSdfs, "PxReal"); + } + + return mSdf; + } + + + + void buildTree(const PxU32* triangles, const PxU32 numTriangles, const PxVec3* points, PxArray& tree, PxF32 enlargement = 1e-4f) + { + //Computes a bounding box for every triangle in triangles + Gu::AABBTreeBounds boxes; + boxes.init(numTriangles); + for (PxU32 i = 0; i < numTriangles; ++i) + { + const PxU32* tri = &triangles[3 * i]; + PxBounds3 box = PxBounds3::empty(); + box.include(points[tri[0]]); + box.include(points[tri[1]]); + box.include(points[tri[2]]); + box.fattenFast(enlargement); + boxes.getBounds()[i] = box; + } + + Gu::buildAABBTree(numTriangles, boxes, tree); + } + + class LineSegmentTrimeshIntersectionTraversalController + { + private: + const PxU32* mTriangles; + const PxVec3* mPoints; + PxVec3 mSegmentStart; + PxVec3 mSegmentEnd; + PxVec3 mDirection; + bool mIntersects; + + public: + LineSegmentTrimeshIntersectionTraversalController(const PxU32* triangles, const PxVec3* points, PxVec3 segmentStart, PxVec3 segmentEnd) + : mTriangles(triangles), mPoints(points), mSegmentStart(segmentStart), mSegmentEnd(segmentEnd), mDirection(segmentEnd - segmentStart), mIntersects(false) + { + } + + void reset(PxVec3 segmentStart, PxVec3 segmentEnd) + { + mSegmentStart = segmentStart; + mSegmentEnd = segmentEnd; + mDirection = segmentEnd - segmentStart; + mIntersects = false; + } + + bool intersectionDetected() const + { + return mIntersects; + } + + PX_FORCE_INLINE Gu::TraversalControl::Enum analyze(const Gu::BVHNode& node, PxI32) + { + if (node.isLeaf()) + { + PxI32 j = node.getPrimitiveIndex(); + const PxU32* tri = &mTriangles[3 * j]; + + PxReal at, au, av; + if (Gu::intersectRayTriangle(mSegmentStart, mDirection, mPoints[tri[0]], mPoints[tri[1]], mPoints[tri[2]], at, au, av, false, 1e-4f) && at >= 0.0f && at <= 1.0f) + { + mIntersects = true; + return TraversalControl::eAbort; + } + + return TraversalControl::eDontGoDeeper; + } + + PxReal tnear, tfar; + if (Gu::intersectRayAABB(node.mBV.minimum, node.mBV.maximum, mSegmentStart, mDirection, tnear, tfar) >= 0 && ((tnear >= 0.0f && tnear <= 1.0f) || (tfar >= 0.0f && tfar <= 1.0f) || node.mBV.contains(mSegmentStart))) + return TraversalControl::eGoDeeper; + return TraversalControl::eDontGoDeeper; + } + + private: + PX_NOCOPY(LineSegmentTrimeshIntersectionTraversalController) + }; + + class ClosestDistanceToTrimeshTraversalController + { + private: + PxReal mClosestDistanceSquared; + const PxU32* mTriangles; + const PxVec3* mPoints; + const Gu::BVHNode* mNodes; + PxVec3 mQueryPoint; + PxVec3 mClosestPoint; + PxI32 mClosestTriId; + + public: + PX_FORCE_INLINE ClosestDistanceToTrimeshTraversalController(const PxU32* triangles, const PxVec3* points, Gu::BVHNode* nodes, const PxVec3& queryPoint) : + mTriangles(triangles), mPoints(points), mNodes(nodes), mQueryPoint(queryPoint), mClosestPoint(0.0f), mClosestTriId(-1) + { + mClosestDistanceSquared = PX_MAX_F32; + } + + PX_FORCE_INLINE void setQueryPoint(const PxVec3& queryPoint) + { + this->mQueryPoint = queryPoint; + mClosestDistanceSquared = FLT_MAX; + mClosestPoint = PxVec3(0.0f); + mClosestTriId = -1; + } + + PX_FORCE_INLINE const PxVec3& closestPoint() const + { + return mClosestPoint; + } + + PX_FORCE_INLINE PxReal distancePointBoxSquared(const PxBounds3& box, const PxVec3& point) + { + PxVec3 closestPt = box.minimum.maximum(box.maximum.minimum(point)); + + return (closestPt - point).magnitudeSquared(); + } + + PX_FORCE_INLINE Gu::TraversalControl::Enum analyze(const Gu::BVHNode& node, PxI32) + { + if (distancePointBoxSquared(node.mBV, mQueryPoint) >= mClosestDistanceSquared) + return Gu::TraversalControl::eDontGoDeeper; + + if (node.isLeaf()) + { + const PxI32 j = node.getPrimitiveIndex(); + const PxU32* tri = &mTriangles[3 * j]; + + + aos::FloatV t1, t2; + aos::Vec3V q = V3LoadU(mQueryPoint); + aos::Vec3V a = V3LoadU(mPoints[tri[0]]); + aos::Vec3V b = V3LoadU(mPoints[tri[1]]); + aos::Vec3V c = V3LoadU(mPoints[tri[2]]); + aos::Vec3V cp; + aos::FloatV d = Gu::distancePointTriangleSquared(q, a, b, c, t1, t2, cp); + PxReal d2; + FStore(d, &d2); + PxVec3 closest; + V3StoreU(cp, closest); + + //PxReal t1, t2; + //const PxVec3 closest = Gu::closestPtPointTriangle(mQueryPoint, mPoints[tri[0]], mPoints[tri[1]], mPoints[tri[2]], t1, t2); + //PxReal d2 = (closest - mQueryPoint).magnitudeSquared(); + if (d2 < mClosestDistanceSquared) + { + mClosestDistanceSquared = d2; + mClosestTriId = j; + mClosestPoint = closest; + } + return Gu::TraversalControl::eDontGoDeeper; + } + + const Gu::BVHNode& nodePos = mNodes[node.getPosIndex()]; + const PxReal distSquaredPos = distancePointBoxSquared(nodePos.mBV, mQueryPoint); + const Gu::BVHNode& nodeNeg = mNodes[node.getNegIndex()]; + const PxReal distSquaredNeg = distancePointBoxSquared(nodeNeg.mBV, mQueryPoint); + + if (distSquaredPos < distSquaredNeg) + { + if (distSquaredPos < mClosestDistanceSquared) + return Gu::TraversalControl::eGoDeeper; + } + else + { + if (distSquaredNeg < mClosestDistanceSquared) + return Gu::TraversalControl::eGoDeeperNegFirst; + } + return Gu::TraversalControl::eDontGoDeeper; + } + + PxI32 getClosestTriId() const { return mClosestTriId; } + + void setClosestStart(const PxReal closestDistanceSquared, PxI32 closestTriangle, const PxVec3& closestPoint) + { + mClosestDistanceSquared = closestDistanceSquared; + mClosestTriId = closestTriangle; + mClosestPoint = closestPoint; + } + + private: + PX_NOCOPY(ClosestDistanceToTrimeshTraversalController) + }; + + void windingNumbers(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + PxReal* windingNumbers, PxVec3 min, PxVec3 max, PxVec3* sampleLocations) + { + const PxVec3 extents(max - min); + const PxVec3 delta(extents.x / width, extents.y / height, extents.z / depth); + const PxVec3 offset = min + PxVec3(0.5f * delta.x, 0.5f * delta.y, 0.5f * delta.z); + + PxArray tree; + buildTree(indices, numTriangleIndices / 3, vertices, tree); + + PxHashMap clusters; + Gu::precomputeClusterInformation(tree.begin(), indices, numTriangleIndices / 3, vertices, clusters); + + for (PxU32 x = 0; x < width; ++x) + { + for (PxU32 y = 0; y < height; ++y) + { + for (PxU32 z = 0; z < depth; ++z) + { + PxVec3 queryPoint(x * delta.x + offset.x, y * delta.y + offset.y, z * delta.z + offset.z); + PxReal windingNumber = Gu::computeWindingNumber(tree.begin(), queryPoint, clusters, indices, vertices); + windingNumbers[z * width * height + y * width + x] = windingNumber; // > 0.5f ? PxU32(-1) : 0; + if (sampleLocations) + sampleLocations[z * width * height + y * width + x] = queryPoint; + } + } + } + } + + struct Range + { + PxI32 mStart; + PxI32 mEnd; + bool mInsideStart; + bool mInsideEnd; + + Range(PxI32 start, PxI32 end, bool insideStart, bool insideEnd) : mStart(start), mEnd(end), mInsideStart(insideStart), mInsideEnd(insideEnd) { } + }; + + class GridQueryPointSampler + { + PxVec3 mOrigin; + PxVec3 mCellSize; + PxI32 mOffsetX, mOffsetY, mOffsetZ; + PxI32 mStepX, mStepY, mStepZ; + + public: + GridQueryPointSampler() {} + + GridQueryPointSampler(const PxVec3& origin, const PxVec3& cellSize, bool cellCenteredSamples, + PxI32 offsetX = 0, PxI32 offsetY = 0, PxI32 offsetZ = 0, PxI32 stepX = 1, PxI32 stepY = 1, PxI32 stepZ = 1) + : mCellSize(cellSize), mOffsetX(offsetX), mOffsetY(offsetY), mOffsetZ(offsetZ), mStepX(stepX), mStepY(stepY), mStepZ(stepZ) + { + if (cellCenteredSamples) + mOrigin = origin + 0.5f * cellSize; + else + mOrigin = origin; + } + + PX_FORCE_INLINE PxVec3 getOrigin() + { + return mOrigin; + } + + PX_FORCE_INLINE PxVec3 getActiveCellSize() + { + return PxVec3(mCellSize.x * mStepX, mCellSize.y * mStepY, mCellSize.z * mStepZ); + } + + PX_FORCE_INLINE PxVec3 getPoint(PxI32 x, PxI32 y, PxI32 z) + { + return PxVec3(mOrigin.x + (x * mStepX + mOffsetX) * mCellSize.x, + mOrigin.y + (y * mStepY + mOffsetY) * mCellSize.y, + mOrigin.z + (z * mStepZ + mOffsetZ) * mCellSize.z); + } + }; + + struct SDFCalculationData + { + const PxVec3* vertices; + const PxU32* indices; + PxU32 numTriangleIndices; + PxU32 width; + PxU32 height; + PxU32 depth; + PxReal* sdf; + PxVec3* sampleLocations; + GridQueryPointSampler* pointSampler; + + PxArray* tree; + PxHashMap* clusters; + PxI32 batchSize = 32; + PxI32 end; + PxI32* progress; + + bool optimizeInsideOutsideCalculation; //Toggle to enable an additional optimization for faster inside/outside classification + bool signOnly; + }; + + + + void windingNumbersInsideCheck(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + bool* insideResult, PxVec3 min, PxVec3 max, PxVec3* sampleLocations) + { +#if PX_DEBUG + PxBounds3 bounds(min, max); + for (PxU32 i = 0; i < numTriangleIndices; ++i) + PX_ASSERT(bounds.contains(vertices[indices[i]])); +#endif + + const PxVec3 extents(max - min); + const PxVec3 delta(extents.x / width, extents.y / height, extents.z / depth); + const PxVec3 offset = min + PxVec3(0.5f * delta.x, 0.5f * delta.y, -0.5f * delta.z); + + PxArray tree; + buildTree(indices, numTriangleIndices / 3, vertices, tree); + + PxHashMap clusters; + Gu::precomputeClusterInformation(tree.begin(), indices, numTriangleIndices / 3, vertices, clusters); + + LineSegmentTrimeshIntersectionTraversalController intersector(indices, vertices, PxVec3(0.0f), PxVec3(0.0f)); + + PxArray stack; + for (PxU32 x = 0; x < width; ++x) + { + for (PxU32 y = 0; y < height; ++y) + { + stack.pushBack(Range(0, depth+2, false, false)); + while (stack.size() > 0) + { + Range r = stack.popBack(); + + PxI32 center = (r.mStart + r.mEnd) / 2; + if (center == r.mStart) + { + if (r.mStart > 0 && r.mStart <= PxI32(depth)) + { + insideResult[(r.mStart - 1) * width * height + y * width + x] = r.mInsideStart; + if (sampleLocations) + sampleLocations[(r.mStart - 1) * width * height + y * width + x] = PxVec3(x * delta.x + offset.x, y * delta.y + offset.y, r.mStart * delta.z + offset.z); + } + continue; + } + + PxVec3 queryPoint = PxVec3(x * delta.x + offset.x, y * delta.y + offset.y, center * delta.z + offset.z); + bool inside = Gu::computeWindingNumber(tree.begin(), queryPoint, clusters, indices, vertices) > 0.5f; + + if (inside != r.mInsideStart) + stack.pushBack(Range(r.mStart, center, r.mInsideStart, inside)); + else + { + PxVec3 p = PxVec3(x * delta.x + offset.x, y * delta.y + offset.y, r.mStart * delta.z + offset.z); + intersector.reset(p, queryPoint); + Gu::traverseBVH(tree.begin(), intersector); + if (!intersector.intersectionDetected()) + { + PxI32 e = PxMin(center, PxI32(depth) + 1); + for (PxI32 z = PxMax(1, r.mStart); z < e; ++z) + { + insideResult[(z - 1) * width * height + y * width + x] = inside; + if (sampleLocations) + sampleLocations[(z - 1) * width * height + y * width + x] = queryPoint; + } + } + else + stack.pushBack(Range(r.mStart, center, r.mInsideStart, inside)); + } + + + if (inside != r.mInsideEnd) + stack.pushBack(Range(center, r.mEnd, inside, r.mInsideEnd)); + else + { + PxVec3 p = PxVec3(x * delta.x + offset.x, y * delta.y + offset.y, r.mEnd * delta.z + offset.z); + intersector.reset(queryPoint, p); + Gu::traverseBVH(tree.begin(), intersector); + if (!intersector.intersectionDetected()) + { + PxI32 e = PxMin(r.mEnd, PxI32(depth) + 1); + for (PxI32 z = PxMax(1, center); z < e; ++z) + { + insideResult[(z - 1) * width * height + y * width + x] = inside; + if (sampleLocations) + sampleLocations[(z - 1) * width * height + y * width + x] = queryPoint; + } + } + else + stack.pushBack(Range(center, r.mEnd, inside, r.mInsideEnd)); + } + } + } + } + } + + + + void idToXYZ(PxU32 id, PxU32 sizeX, PxU32 sizeY, PxU32& xi, PxU32& yi, PxU32& zi) + { + xi = id % sizeX; id /= sizeX; + yi = id % sizeY; + zi = id / sizeY; + } + + void idToXY(PxU32 id, PxU32 sizeX, PxU32& xi, PxU32& yi) + { + xi = id % sizeX; + yi = id / sizeX; + } + + void* computeSDFThreadJob(void* data) + { + SDFCalculationData& d = *reinterpret_cast(data); + + PxI32 lastTriangle = -1; + + PxArray stack; + LineSegmentTrimeshIntersectionTraversalController intersector(d.indices, d.vertices, PxVec3(0.0f), PxVec3(0.0f)); + + PxI32 start = physx::PxAtomicAdd(d.progress, d.batchSize) - d.batchSize; + while (start < d.end) + { + PxI32 end = PxMin(d.end, start + d.batchSize); + + PxU32 yStart, zStart; + idToXY(start, d.height, yStart, zStart); + for (PxI32 id = start; id < end; ++id) + { + PxU32 y, z; + idToXY(id, d.height, y, z); + if (y < yStart) + yStart = 0; + + if (d.optimizeInsideOutsideCalculation) + { + stack.pushBack(Range(0, d.width + 2, false, false)); + while (stack.size() > 0) + { + Range r = stack.popBack(); + + PxI32 center = (r.mStart + r.mEnd) / 2; + if (center == r.mStart) + { + if (r.mStart > 0 && r.mStart <= PxI32(d.width)) + { + if (r.mInsideStart) + d.sdf[z * d.width * d.height + y * d.width + (r.mStart - 1)] *= -1.0f; + } + continue; + } + + PxVec3 queryPoint = d.pointSampler->getPoint(center - 1, y, z); + + + bool inside = false; + bool computeWinding = true; + if (id > start && y > yStart) + { + PxReal s = d.sdf[z * d.width * d.height + (y - 1) * d.width + (center - 1)]; + if (PxAbs(s) > d.pointSampler->getActiveCellSize().y) + { + inside = s < 0.0f; + computeWinding = false; + } + } + + if (computeWinding) + inside = Gu::computeWindingNumber(d.tree->begin(), queryPoint, *d.clusters, d.indices, d.vertices) > 0.5f; + + + if (inside != r.mInsideStart) + stack.pushBack(Range(r.mStart, center, r.mInsideStart, inside)); + else + { + PxVec3 p = d.pointSampler->getPoint(r.mStart - 1, y, z); + intersector.reset(p, queryPoint); + Gu::traverseBVH(d.tree->begin(), intersector); + if (!intersector.intersectionDetected()) + { + PxI32 e = PxMin(center, PxI32(d.width) + 1); + for (PxI32 x = PxMax(1, r.mStart); x < e; ++x) + { + if (inside) + d.sdf[z * d.width * d.height + y * d.width + (x - 1)] *= -1.0f; + } + } + else + stack.pushBack(Range(r.mStart, center, r.mInsideStart, inside)); + } + + + if (inside != r.mInsideEnd) + stack.pushBack(Range(center, r.mEnd, inside, r.mInsideEnd)); + else + { + PxVec3 p = d.pointSampler->getPoint(r.mEnd - 1, y, z); + intersector.reset(queryPoint, p); + Gu::traverseBVH(d.tree->begin(), intersector); + if (!intersector.intersectionDetected()) + { + PxI32 e = PxMin(r.mEnd, PxI32(d.width) + 1); + for (PxI32 x = PxMax(1, center); x < e; ++x) + { + if (inside) + d.sdf[z * d.width * d.height + y * d.width + (x - 1)] *= -1.0f; + } + } + else + stack.pushBack(Range(center, r.mEnd, inside, r.mInsideEnd)); + } + } + } + + if (!d.signOnly) + { + for (PxU32 x = 0; x < d.width; ++x) + { + const PxI32 index = z * d.width * d.height + y * d.width + x; + + PxVec3 queryPoint = d.pointSampler->getPoint(x, y, z); + + ClosestDistanceToTrimeshTraversalController cd(d.indices, d.vertices, d.tree->begin(), PxVec3(0.0f)); + cd.setQueryPoint(queryPoint); + + if (lastTriangle != -1) + { + //Warm-start the query with a lower-bound distance based on the triangle found by the previous query. + //This helps to cull the tree traversal more effectively in the closest point query. + PxU32 i0 = d.indices[3 * lastTriangle]; + PxU32 i1 = d.indices[3 * lastTriangle + 1]; + PxU32 i2 = d.indices[3 * lastTriangle + 2]; + + PxReal s, t; + + const PxVec3 closest = Gu::closestPtPointTriangle(queryPoint, d.vertices[i0], d.vertices[i1], d.vertices[i2], s, t); + PxReal d2 = (closest - queryPoint).magnitudeSquared(); + + cd.setClosestStart(d2, lastTriangle, closest); + } + + Gu::traverseBVH(d.tree->begin(), cd); + PxVec3 closestPoint = cd.closestPoint(); + PxReal closestDistance = (closestPoint - queryPoint).magnitude(); + + lastTriangle = cd.getClosestTriId(); + + PxReal sign = 1.f; + if (!d.optimizeInsideOutsideCalculation) + { + PxReal windingNumber = Gu::computeWindingNumber(d.tree->begin(), queryPoint, *d.clusters, d.indices, d.vertices); + sign = windingNumber > 0.5f ? -1.f : 1.f; + } + + d.sdf[index] *= closestDistance * sign; + if (d.sampleLocations) + d.sampleLocations[index] = queryPoint; + } + } + } + start = physx::PxAtomicAdd(d.progress, d.batchSize) - d.batchSize; + } + return NULL; + } + + + PxU32 idx(PxU32 x, PxU32 y, PxU32 z, PxU32 width, PxU32 height) + { + return z * (width + 1) * (height + 1) + y * (width + 1) + x; + } + + PX_FORCE_INLINE PxU32 idxCompact(PxU32 x, PxU32 y, PxU32 z, PxU32 width, PxU32 height) + { + return z * (width) * (height)+y * (width)+x; + } + + struct PxI32x3 + { + PxI32x3(PxI32 x_, PxI32 y_, PxI32 z_) : x(x_), y(y_), z(z_) + {} + + PxI32 x; + PxI32 y; + PxI32 z; + }; + + //Applies per pixel operations similar to the one uses by the fast marching methods to build SDFs out of binary image bitmaps + //This allows to fill in correct distance values in regions where meshes habe holes + struct PixelProcessor + { + PxVec3 mCellSize; + PxI32 mWidth; + PxI32 mHeight; + PxI32 mDepth; + + PixelProcessor(PxVec3 cellSize, PxI32 width, PxI32 height, PxI32 depth) : + mCellSize(cellSize), mWidth(width), mHeight(height), mDepth(depth) + { + } + + //Estimates distance values near at mesh holes by estimating the location of the mesh surface. This can be done by analyzing + //the sign change of the imperfect SDF. The signs are computed using winding numbers which are immune to meshes with holes. + bool init(PxI32x3 p, const PxReal* sdf, PxReal& newValue) const + { + PxReal initialValue = sdf[idxCompact(p.x, p.y, p.z, mWidth, mHeight)]; + + newValue = PxAbs(initialValue); + + for (PxI32 z = PxMax(0, p.z - 1); z <= PxMin(mDepth - 1, p.z + 1); ++z) + for (PxI32 y = PxMax(0, p.y - 1); y <= PxMin(mHeight - 1, p.y + 1); ++y) + for (PxI32 x = PxMax(0, p.x - 1); x <= PxMin(mWidth - 1, p.x + 1); ++x) + { + if (x == p.x && y == p.y && z == p.z) + continue; + + PxReal value = sdf[idxCompact(x, y, z, mWidth, mHeight)]; + + if (PxSign(initialValue) != PxSign(value)) + { + PxReal distance = 0; + if (x != p.x) + distance += mCellSize.x*mCellSize.x; + if (y != p.y) + distance += mCellSize.y*mCellSize.y; + if (z != p.z) + distance += mCellSize.z*mCellSize.z; + + distance = PxSqrt(distance); + + PxReal delta = PxAbs(value - initialValue); + + if (0.99f*delta > distance) + { + PxReal scaling = distance / delta; + PxReal v = 0.99f * scaling * initialValue; + newValue = PxMin(newValue, PxAbs(v)); + } + } + } + + if (initialValue < 0) + newValue = -newValue; + + if (newValue !=initialValue) + return true; + return false; + } + + //Processes a pixel in a 3D sdf by applying the rule from the fast marching method. Only works on pixels with the same sign. + bool process(PxI32x3 p, PxReal* sdf, PxReal& newValue) const + { + PxReal initialValue = sdf[idxCompact(p.x, p.y, p.z, mWidth, mHeight)]; + if (initialValue == 0.0f) + return false; + + PxReal sign = PxSign(initialValue); + newValue = PxAbs(initialValue); + + for (PxI32 z = PxMax(0, p.z - 1); z <= PxMin(mDepth - 1, p.z + 1); ++z) + for (PxI32 y = PxMax(0, p.y - 1); y <= PxMin(mHeight - 1, p.y + 1); ++y) + for (PxI32 x = PxMax(0, p.x - 1); x <= PxMin(mWidth - 1, p.x + 1); ++x) + { + if (x == p.x && y == p.y && z == p.z) + continue; + + PxReal value = sdf[idxCompact(x, y, z, mWidth, mHeight)]; + + if (sign == PxSign(value)) + { + PxReal distance = 0; + if (x != p.x) + distance += mCellSize.x*mCellSize.x; + if (y != p.y) + distance += mCellSize.y*mCellSize.y; + if (z != p.z) + distance += mCellSize.z*mCellSize.z; + + distance = PxSqrt(distance); + + PxReal absValue = PxAbs(value); + + if(absValue + 1.01f*distance < newValue) + newValue = absValue + distance; + } + } + + newValue = sign * newValue; + if (newValue != initialValue) + { + sdf[idxCompact(p.x, p.y, p.z, mWidth, mHeight)] = newValue; + return true; + } + return false; + } + }; + + //Allows to store the new value of a SDF pixel to apply the change later. This avoids the need of double buffering the SDF data. + struct Mutation + { + PxI32x3 mIndex; + PxReal mNewValue; + + Mutation(const PxI32x3& index, PxReal newValue) : mIndex(index), mNewValue(newValue) + { + } + }; + + void applyMutations(PxArray& mutations, PxU32 start, PxU32 end, PxReal* sdfs, PxU32 width, PxU32 height) + { + for (PxU32 i = start; i < end; ++i) + { + Mutation m = mutations[i]; + sdfs[idxCompact(m.mIndex.x, m.mIndex.y, m.mIndex.z, width, height)] = m.mNewValue; + } + } + + //Approximates the solution of an Eikonal equation on a dense grid + void fixSdfForNonClosedGeometry(PxU32 width, PxU32 height, PxU32 depth, + PxReal* sdf, const PxVec3& cellSize) + { + PxArray mutations; + + PixelProcessor processor(cellSize, width, height, depth); + + for (PxU32 z = 0; z < depth; ++z) + for (PxU32 y = 0; y < height; ++y) + for (PxU32 x = 0; x < width; ++x) + { + //Process only cells where a sign change occurs + PxReal newValue; + if (processor.init(PxI32x3(x, y, z), sdf, newValue)) + mutations.pushBack(Mutation(PxI32x3(x, y, z), newValue)); + } + + + applyMutations(mutations, 0, mutations.size(), sdf, width, height); + + PxU32 maxMutationLoops = 1000; + PxU32 counter = 0; + + while (mutations.size() > 0 && counter < maxMutationLoops) + { + PxU32 size = mutations.size(); + + for (PxU32 i = 0; i < size; ++i) + { + PxI32x3 p = mutations[i].mIndex; + + //Process neighbors of item on stack + for (PxI32 z = PxMax(0, p.z - 1); z <= PxMin(PxI32(depth) - 1, p.z + 1); ++z) + for (PxI32 y = PxMax(0, p.y - 1); y <= PxMin(PxI32(height) - 1, p.y + 1); ++y) + for (PxI32 x = PxMax(0, p.x - 1); x <= PxMin(PxI32(width) - 1, p.x + 1); ++x) + { + if (x == p.x && y == p.y && z == p.z) + continue; + PxReal newValue; + if (processor.process(PxI32x3(x, y, z), sdf, newValue)) + mutations.pushBack(Mutation(PxI32x3(x, y, z), newValue)); + } + } + mutations.removeRange(0, size); + ++counter; + } + + //For safety reasons: Check all cells again + for (PxU32 z = 0; z < depth; ++z) + for (PxU32 y = 0; y < height; ++y) + for (PxU32 x = 0; x < width; ++x) + { + //Look at all neighbors + PxReal newValue; + if (processor.init(PxI32x3(x, y, z), sdf, newValue)) + mutations.pushBack(Mutation(PxI32x3(x, y, z), newValue)); + } + + counter = 0; + while (mutations.size() > 0 && counter < maxMutationLoops) + { + PxU32 size = mutations.size(); + + for (PxU32 i = 0; i < size; ++i) + { + PxI32x3 p = mutations[i].mIndex; + + //Process neighbors of item on stack + for (PxI32 z = PxMax(0, p.z - 1); z <= PxMin(PxI32(depth) - 1, p.z + 1); ++z) + for (PxI32 y = PxMax(0, p.y - 1); y <= PxMin(PxI32(height) - 1, p.y + 1); ++y) + for (PxI32 x = PxMax(0, p.x - 1); x <= PxMin(PxI32(width) - 1, p.x + 1); ++x) + { + if (x == p.x && y == p.y && z == p.z) + continue; + PxReal newValue; + if (processor.process(PxI32x3(x, y, z), sdf, newValue)) + mutations.pushBack(Mutation(PxI32x3(x, y, z), newValue)); + } + } + mutations.removeRange(0, size); + ++counter; + } + } + + + + void SDFUsingWindingNumbers(PxArray& tree, PxHashMap& clusters, const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + PxReal* sdf, GridQueryPointSampler& sampler, PxVec3* sampleLocations, PxU32 numThreads, bool isWatertight, bool allVerticesInsideSamplingBox) + { + bool optimizeInsideOutsideCalculation = allVerticesInsideSamplingBox && isWatertight; + numThreads = PxMax(numThreads, 1u); + + PxI32 progress = 0; + + PxArray threads; + PxArray perThreadData; + + for (PxU32 i = 0; i < numThreads; ++i) + { + perThreadData.pushBack(SDFCalculationData()); + + SDFCalculationData& d = perThreadData[i]; + d.vertices = vertices; + d.indices = indices; + d.numTriangleIndices = numTriangleIndices; + d.width = width; + d.height = height; + d.depth = depth; + d.sdf = sdf; + d.sampleLocations = sampleLocations; + d.optimizeInsideOutsideCalculation = optimizeInsideOutsideCalculation; + + + d.pointSampler = &sampler; + + d.progress = &progress; + + d.tree = &tree; + + d.clusters = &clusters; + + d.end = depth * height; + + d.signOnly = false; + } + + PxU32 l = width * height * depth; + for (PxU32 i = 0; i < l; ++i) + sdf[i] = 1.0f; + + for (PxU32 i = 0; i < numThreads; ++i) + { + if (perThreadData.size() == 1) + computeSDFThreadJob(&perThreadData[i]); + else + { + threads.pushBack(PX_NEW(PxThread)(computeSDFThreadJob, &perThreadData[i], "thread")); + threads[i]->start(); + } + } + + for (PxU32 i = 0; i < threads.size(); ++i) + { + threads[i]->waitForQuit(); + } + + for (PxU32 i = 0; i < threads.size(); ++i) + { + threads[i]->~PxThreadT(); + PX_FREE(threads[i]); + } + + if (!isWatertight) + fixSdfForNonClosedGeometry(width, height, depth, sdf, sampler.getActiveCellSize()); + } + + + + void SDFUsingWindingNumbers(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + PxReal* sdf, PxVec3 minExtents, PxVec3 maxExtents, PxVec3* sampleLocations, bool cellCenteredSamples, PxU32 numThreads) + { + PxArray tree; + buildTree(indices, numTriangleIndices / 3, vertices, tree); + + PxHashMap clusters; + Gu::precomputeClusterInformation(tree.begin(), indices, numTriangleIndices / 3, vertices, clusters); + + const PxVec3 extents(maxExtents - minExtents); + GridQueryPointSampler sampler(minExtents, PxVec3(extents.x / width, extents.y / height, extents.z / depth), cellCenteredSamples); + + + bool isWatertight = MeshAnalyzer::checkMeshWatertightness(reinterpret_cast(indices), numTriangleIndices / 3); + bool allSamplesInsideBox = true; + PxBounds3 box(minExtents, maxExtents); + for (PxU32 i = 0; i < numTriangleIndices; ++i) + { + PxVec3 v = vertices[indices[i]]; + if (!box.contains(v)) + { + allSamplesInsideBox = false; + break; + } + } + + SDFUsingWindingNumbers(tree, clusters, vertices, indices, numTriangleIndices, width, height, depth, sdf, sampler, sampleLocations, numThreads, isWatertight, allSamplesInsideBox); + } + + PX_FORCE_INLINE void getCellCoords(PxU32 numCellsX, PxU32 numCellsY, PxU32 cellNr, PxU32& x, PxU32& y, PxU32& z) + { + x = cellNr % numCellsX; + cellNr /= numCellsX; + y = cellNr % numCellsY; + z = cellNr / numCellsY; + } + + PX_FORCE_INLINE PxU32 encodeTriple(PxU32 x, PxU32 y, PxU32 z) + { + PX_ASSERT(x >= 0 && x < 1024); + PX_ASSERT(y >= 0 && y < 1024); + PX_ASSERT(z >= 0 && z < 1024); + return (z << 20) | (y << 10) | x; + } + + + struct Interval + { + PxReal min; + PxReal max; + + Interval() : min(FLT_MAX), max(-FLT_MAX) + {} + + Interval(PxReal min_, PxReal max_) : min(min_), max(max_) + {} + + bool overlaps(const Interval& i) + { + return !(min > i.max || i.min > max); + } + }; + + void convertSparseSDFTo3DTextureLayout(PxU32 width, PxU32 height, PxU32 depth, PxU32 cellsPerSubgrid, + PxU32* sdfFineStartSlots, const PxReal* sdfFineSubgridsIn, PxU32 sdfFineSubgridsSize, PxArray& subgrids3DTexFormat, + PxU32& numSubgridsX, PxU32& numSubgridsY, PxU32& numSubgridsZ) + { + PxU32 valuesPerSubgrid = (cellsPerSubgrid + 1)*(cellsPerSubgrid + 1)*(cellsPerSubgrid + 1); + PX_ASSERT(sdfFineSubgridsSize % valuesPerSubgrid == 0); + PxU32 numSubgrids = sdfFineSubgridsSize / valuesPerSubgrid; + + PxReal cubicRoot = PxPow(PxReal(numSubgrids), 1.0f / 3.0f); + //PX_UNUSED(cubicRoot); + PxU32 up = PxMax(1u, PxU32(PxCeil(cubicRoot))); + + PxU32 debug = numSubgrids; + + //Arrange numSubgrids in a 3d layout + numSubgridsX = PxMin(up, numSubgrids); + numSubgrids = (numSubgrids + up - 1) / up; + numSubgridsY = PxMin(up, numSubgrids); + numSubgrids = (numSubgrids + up - 1) / up; + numSubgridsZ = PxMin(up, numSubgrids); + + + PxU32 debug2 = numSubgridsX * numSubgridsY * numSubgridsZ; + PX_ASSERT(debug2 >= debug); + PX_UNUSED(debug); + PX_UNUSED(debug2); + + PxU32 size = valuesPerSubgrid * numSubgridsX * numSubgridsY * numSubgridsZ; + PxReal placeholder = 1234567; + subgrids3DTexFormat.resize(/*sdfFineSubgridsSize*/size, placeholder); + + PxU32 w = width / cellsPerSubgrid; + PxU32 h = height / cellsPerSubgrid; + PxU32 d = depth / cellsPerSubgrid; + PxU32 l = (w)*(h)*(d); + for (PxU32 i = 0; i < l; ++i) + { + PxU32 startSlot = sdfFineStartSlots[i]; + if (startSlot != 0xFFFFFFFF) + { + PxU32 baseIndex = startSlot * (cellsPerSubgrid + 1) * (cellsPerSubgrid + 1) * (cellsPerSubgrid + 1); + const PxReal* sdfFine = &sdfFineSubgridsIn[baseIndex]; + + PxU32 startSlotX, startSlotY, startSlotZ; + getCellCoords(numSubgridsX, numSubgridsY, startSlot, startSlotX, startSlotY, startSlotZ); + + sdfFineStartSlots[i] = encodeTriple(startSlotX, startSlotY, startSlotZ); + + for (PxU32 zLocal = 0; zLocal <= cellsPerSubgrid; ++zLocal) + { + for (PxU32 yLocal = 0; yLocal <= cellsPerSubgrid; ++yLocal) + { + for (PxU32 xLocal = 0; xLocal <= cellsPerSubgrid; ++xLocal) + { + PxReal sdfValue = sdfFine[idx(xLocal, yLocal, zLocal, cellsPerSubgrid, cellsPerSubgrid)]; + PxU32 index = idxCompact(xLocal + startSlotX * (cellsPerSubgrid + 1), yLocal + startSlotY * (cellsPerSubgrid + 1), zLocal + startSlotZ * (cellsPerSubgrid + 1), + numSubgridsX * (cellsPerSubgrid + 1), numSubgridsY * (cellsPerSubgrid + 1)); + PX_ASSERT(subgrids3DTexFormat[index] == placeholder); + subgrids3DTexFormat[index] = sdfValue; + } + } + } + } + } + } + + + PX_FORCE_INLINE PxReal lerp(PxReal a, PxReal b, float t) + { + return a + t * (b - a); + } + + PX_FORCE_INLINE PxReal bilerp( + PxReal f00, + PxReal f10, + PxReal f01, + PxReal f11, + PxReal tx, PxReal ty) + { + PxReal a = lerp(f00, f10, tx); + PxReal b = lerp(f01, f11, tx); + return lerp( + a, + b, + ty); + } + + PX_FORCE_INLINE PxReal trilerp( + PxReal f000, + PxReal f100, + PxReal f010, + PxReal f110, + PxReal f001, + PxReal f101, + PxReal f011, + PxReal f111, + PxReal tx, + PxReal ty, + PxReal tz) + { + PxReal a = bilerp(f000, f100, f010, f110, tx, ty); + PxReal b = bilerp(f001, f101, f011, f111, tx, ty); + return lerp( + a, + b, + tz); + } + + template + class DenseSDF + { + public: + PxU32 width, height, depth; + private: + T* sdf; + + public: + DenseSDF(PxU32 width, PxU32 height, PxU32 depth, T* sdf) + { + initialize(width, height, depth, sdf); + } + + DenseSDF() {} + + void initialize(PxU32 width_, PxU32 height_, PxU32 depth_, T* sdf_) + { + this->width = width_; + this->height = height_; + this->depth = depth_; + this->sdf = sdf_; + } + + PxU32 memoryConsumption() + { + return (width + 1) * (height + 1) * (depth + 1) * sizeof(T); + } + + PxReal sampleSDFDirect(const PxVec3& samplePoint) + { + const PxU32 xBase = PxClamp(PxU32(samplePoint.x), 0u, width - 1); + const PxU32 yBase = PxClamp(PxU32(samplePoint.y), 0u, height - 1); + const PxU32 zBase = PxClamp(PxU32(samplePoint.z), 0u, depth - 1); + + return trilerp( + sdf[idx(xBase, yBase, zBase, width, height)], + sdf[idx(xBase + 1, yBase, zBase, width, height)], + sdf[idx(xBase, yBase + 1, zBase, width, height)], + sdf[idx(xBase + 1, yBase + 1, zBase, width, height)], + sdf[idx(xBase, yBase, zBase + 1, width, height)], + sdf[idx(xBase + 1, yBase, zBase + 1, width, height)], + sdf[idx(xBase, yBase + 1, zBase + 1, width, height)], + sdf[idx(xBase + 1, yBase + 1, zBase + 1, width, height)], samplePoint.x - xBase, samplePoint.y - yBase, samplePoint.z - zBase); + } + }; + + void SDFUsingWindingNumbersSparse(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + const PxVec3& minExtents, const PxVec3& maxExtents, PxReal narrowBandThickness, PxU32 cellsPerSubgrid, + PxArray& sdfCoarse, PxArray& sdfFineStartSlots, PxArray& subgridData, PxArray& denseSdf, + PxReal& subgridsMinSdfValue, PxReal& subgridsMaxSdfValue, PxU32 numThreads) + { + PX_ASSERT(width % cellsPerSubgrid == 0); + PX_ASSERT(height % cellsPerSubgrid == 0); + PX_ASSERT(depth % cellsPerSubgrid == 0); + + const PxVec3 extents(maxExtents - minExtents); + const PxVec3 delta(extents.x / width, extents.y / height, extents.z / depth); + + PxU32 w = width / cellsPerSubgrid; + PxU32 h = height / cellsPerSubgrid; + PxU32 d = depth / cellsPerSubgrid; + + denseSdf.resize((width + 1) * (height + 1) * (depth + 1)); + SDFUsingWindingNumbers(vertices, indices, numTriangleIndices, width + 1, height + 1, depth + 1, denseSdf.begin(), minExtents, maxExtents + delta, NULL, false, numThreads); + + sdfCoarse.clear(); + sdfFineStartSlots.clear(); + subgridData.clear(); + + sdfCoarse.reserve((w + 1) * (h + 1) * (d + 1)); + sdfFineStartSlots.reserve(w * h * d); + + for (PxU32 zBlock = 0; zBlock < d; ++zBlock) + for (PxU32 yBlock = 0; yBlock < h; ++yBlock) + for (PxU32 xBlock = 0; xBlock < w; ++xBlock) + { + sdfFineStartSlots.pushBack(0xFFFFFFFF); + } + + for (PxU32 zBlock = 0; zBlock <= d; ++zBlock) + for (PxU32 yBlock = 0; yBlock <= h; ++yBlock) + for (PxU32 xBlock = 0; xBlock <= w; ++xBlock) + { + PxU32 x = xBlock * cellsPerSubgrid; + PxU32 y = yBlock * cellsPerSubgrid; + PxU32 z = zBlock * cellsPerSubgrid; + const PxU32 index = idx(x, y, z, width, height); + PX_ASSERT(index < denseSdf.size()); + PxReal sdfValue = denseSdf[index]; + sdfCoarse.pushBack(sdfValue); + } + + + for (PxU32 zBlock = 0; zBlock <= d; ++zBlock) + for (PxU32 yBlock = 0; yBlock <= h; ++yBlock) + for (PxU32 xBlock = 0; xBlock <= w; ++xBlock) + { + PxU32 x = xBlock * cellsPerSubgrid; + PxU32 y = yBlock * cellsPerSubgrid; + PxU32 z = zBlock * cellsPerSubgrid; + + const PxU32 index = idx(x, y, z, width, height); + const PxU32 indexCoarse = idx(xBlock, yBlock, zBlock, w, h); + PX_ASSERT(sdfCoarse[indexCoarse] == denseSdf[index]); + PX_UNUSED(indexCoarse); + PX_UNUSED(index); + } + + + Interval narrowBandInterval(-narrowBandThickness, narrowBandThickness); + + DenseSDF coarseEval(w, h, d, sdfCoarse.begin()); + PxReal s = 1.0f / cellsPerSubgrid; + + const PxReal errorThreshold = 1e-6f * extents.magnitude(); + subgridsMaxSdfValue = -FLT_MAX; + subgridsMinSdfValue = FLT_MAX; + for (PxU32 zBlock = 0; zBlock < d; ++zBlock) + { + for (PxU32 yBlock = 0; yBlock < h; ++yBlock) + { + for (PxU32 xBlock = 0; xBlock < w; ++xBlock) + { + bool subgridRequired = false; + Interval inverval; + PxReal maxAbsError = 0.0f; + for (PxU32 zLocal = 0; zLocal <= cellsPerSubgrid; ++zLocal) + { + for (PxU32 yLocal = 0; yLocal <= cellsPerSubgrid; ++yLocal) + { + for (PxU32 xLocal = 0; xLocal <= cellsPerSubgrid; ++xLocal) + { + PxU32 x = xBlock * cellsPerSubgrid + xLocal; + PxU32 y = yBlock * cellsPerSubgrid + yLocal; + PxU32 z = zBlock * cellsPerSubgrid + zLocal; + + const PxU32 index = idx(x, y, z, width, height); + PxReal sdfValue = denseSdf[index]; + inverval.max = PxMax(inverval.max, sdfValue); + inverval.min = PxMin(inverval.min, sdfValue); + + maxAbsError = PxMax(maxAbsError, PxAbs(sdfValue - coarseEval.sampleSDFDirect(PxVec3(xBlock + xLocal * s, yBlock + yLocal * s, zBlock + zLocal * s)))); + } + } + } + + subgridRequired = narrowBandInterval.overlaps(inverval); + if (maxAbsError < errorThreshold) + subgridRequired = false; //No need for a subgrid if the coarse SDF is already almost exact + + if (subgridRequired) + { + subgridsMaxSdfValue = PxMax(subgridsMaxSdfValue, inverval.max); + subgridsMinSdfValue = PxMin(subgridsMinSdfValue, inverval.min); + } + } + } + } + + + PxU32 subgridIndexer = 0; + for (PxU32 zBlock = 0; zBlock < d; ++zBlock) + { + for (PxU32 yBlock = 0; yBlock < h; ++yBlock) + { + for (PxU32 xBlock = 0; xBlock < w; ++xBlock) + { + bool subgridRequired = false; + Interval inverval; + PxReal maxAbsError = 0.0f; + for (PxU32 zLocal = 0; zLocal <= cellsPerSubgrid; ++zLocal) + { + for (PxU32 yLocal = 0; yLocal <= cellsPerSubgrid; ++yLocal) + { + for (PxU32 xLocal = 0; xLocal <= cellsPerSubgrid; ++xLocal) + { + PxU32 x = xBlock * cellsPerSubgrid + xLocal; + PxU32 y = yBlock * cellsPerSubgrid + yLocal; + PxU32 z = zBlock * cellsPerSubgrid + zLocal; + + const PxU32 index = idx(x, y, z, width, height); // z * (width + 1) * (height + 1) + y * (width + 1) + x; + PxReal sdfValue = denseSdf[index]; + inverval.max = PxMax(inverval.max, sdfValue); + inverval.min = PxMin(inverval.min, sdfValue); + + maxAbsError = PxMax(maxAbsError, PxAbs(sdfValue - coarseEval.sampleSDFDirect(PxVec3(xBlock + xLocal * s, yBlock + yLocal * s, zBlock + zLocal * s)))); + } + } + } + + subgridRequired = narrowBandInterval.overlaps(inverval); + if (maxAbsError < errorThreshold) + subgridRequired = false; //No need for a subgrid if the coarse SDF is already almost exact + + //For debugging + if (cellsPerSubgrid == 1) + subgridRequired = false; + + //subgridRequired = true; + + if (subgridRequired) + { + for (PxU32 zLocal = 0; zLocal <= cellsPerSubgrid; ++zLocal) + { + for (PxU32 yLocal = 0; yLocal <= cellsPerSubgrid; ++yLocal) + { + for (PxU32 xLocal = 0; xLocal <= cellsPerSubgrid; ++xLocal) + { + PxU32 x = xBlock * cellsPerSubgrid + xLocal; + PxU32 y = yBlock * cellsPerSubgrid + yLocal; + PxU32 z = zBlock * cellsPerSubgrid + zLocal; + + const PxU32 index = z * (width + 1) * (height + 1) + y * (width + 1) + x; + PxReal sdfValue = denseSdf[index]; + + subgridData.pushBack(sdfValue); + } + } + } + sdfFineStartSlots[idxCompact(xBlock, yBlock, zBlock, w, h)] = subgridIndexer; + ++subgridIndexer; + } + } + } + } + } + + + PX_FORCE_INLINE void decodeTriple(PxU32 id, PxU32& x, PxU32& y, PxU32& z) + { + x = id & 0x000003FF; + id = id >> 10; + y = id & 0x000003FF; + id = id >> 10; + z = id & 0x000003FF; + } + + PX_FORCE_INLINE PxReal decode(PxU8* data, PxU32 bytesPerSparsePixel, PxReal subgridsMinSdfValue, PxReal subgridsMaxSdfValue) + { + switch (bytesPerSparsePixel) + { + case 1: + return PxReal(data[0]) * (1.0f / 255.0f) * (subgridsMaxSdfValue - subgridsMinSdfValue) + subgridsMinSdfValue; + case 2: + { + PxU16* ptr = reinterpret_cast(data); + return PxReal(ptr[0]) * (1.0f / 65535.0f) * (subgridsMaxSdfValue - subgridsMinSdfValue) + subgridsMinSdfValue; + } + case 4: + //If 4 bytes per subgrid pixel are available, then normal floats are used. No need to + //de-normalize integer values since the floats already contain real distance values + PxReal* ptr = reinterpret_cast(data); + return ptr[0]; + } + return 0; + } + + PX_FORCE_INLINE PxReal decode(const Gu::SDF& sdf, PxI32 xx, PxI32 yy, PxI32 zz) + { + if (xx < 0 || yy < 0 || zz < 0 || xx > PxI32(sdf.mDims.x) || yy > PxI32(sdf.mDims.y) || zz > PxI32(sdf.mDims.z)) + return 1.0f; //Return a value >0 that counts as outside + + const PxU32 nbX = sdf.mDims.x / sdf.mSubgridSize; + const PxU32 nbY = sdf.mDims.y / sdf.mSubgridSize; + const PxU32 nbZ = sdf.mDims.z / sdf.mSubgridSize; + + PxU32 xBase = xx / sdf.mSubgridSize; + PxU32 yBase = yy / sdf.mSubgridSize; + PxU32 zBase = zz / sdf.mSubgridSize; + + PxU32 x = xx % sdf.mSubgridSize; + PxU32 y = yy % sdf.mSubgridSize; + PxU32 z = zz % sdf.mSubgridSize; + + if (xBase == nbX) + { + --xBase; + x = sdf.mSubgridSize; + } + if (yBase == nbY) + { + --yBase; + y = sdf.mSubgridSize; + } + if (zBase == nbZ) + { + --zBase; + z = sdf.mSubgridSize; + } + + PxU32 startId = sdf.mSubgridStartSlots[zBase * (nbX) * (nbY)+yBase * (nbX)+xBase]; + if (startId != 0xFFFFFFFFu) + { + decodeTriple(startId, xBase, yBase, zBase); + xBase *= (sdf.mSubgridSize + 1); + yBase *= (sdf.mSubgridSize + 1); + zBase *= (sdf.mSubgridSize + 1); + + const PxU32 w = sdf.mSdfSubgrids3DTexBlockDim.x * (sdf.mSubgridSize + 1); + const PxU32 h = sdf.mSdfSubgrids3DTexBlockDim.y * (sdf.mSubgridSize + 1); + const PxU32 index = idxCompact(xBase + x, yBase + y, zBase + z, w, h); + return decode(&sdf.mSubgridSdf[sdf.mBytesPerSparsePixel * index], + sdf.mBytesPerSparsePixel, sdf.mSubgridsMinSdfValue, sdf.mSubgridsMaxSdfValue); + } + else + { + DenseSDF coarseEval(nbX, nbY, nbZ, sdf.mSdf); + + PxReal s = 1.0f / sdf.mSubgridSize; + return coarseEval.sampleSDFDirect(PxVec3(xBase + x * s, yBase + y * s, zBase + z * s)); + } + } + + PX_FORCE_INLINE PxU64 key(PxI32 xId, PxI32 yId, PxI32 zId) + { + const PxI32 offset = 1 << 19; + return (PxU64(zId + offset) << 42) | (PxU64(yId + offset) << 21) | (PxU64(xId + offset) << 0); + } + + const PxI32 offsets[3][3][3] = { { {0,-1,0}, {0,-1,-1}, {0,0,-1} }, + { {0,0,-1}, {-1,0,-1}, {-1,0,0} } , + { {-1,0,0}, {-1,-1,0}, {0,-1,0} } }; + + const PxI32 projections[3][2] = { {1, 2}, {2, 0}, {0, 1} }; + + PX_FORCE_INLINE PxReal dirSign(PxI32 principalDirection, const PxVec3& start, const PxVec3& middle, const PxVec3& end) + { + PxReal a0 = middle[projections[principalDirection][0]] - start[projections[principalDirection][0]]; + PxReal a1 = middle[projections[principalDirection][1]] - start[projections[principalDirection][1]]; + + PxReal b0 = end[projections[principalDirection][0]] - middle[projections[principalDirection][0]]; + PxReal b1 = end[projections[principalDirection][1]] - middle[projections[principalDirection][1]]; + + return a0 * b1 - a1 * b0; + } + + PX_FORCE_INLINE PxI32 indexOfMostConcaveCorner(PxI32 principalDirection, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d) + { + PxReal minimum = 0; + PxI32 result = -1; + PxReal s = dirSign(principalDirection, a, b, c); + if (s <= minimum) + { + minimum = s; + result = 1; + } + s = dirSign(principalDirection, b, c, d); + if (s <= minimum) + { + minimum = s; + result = 2; + } + s = dirSign(principalDirection, c, d, a); + if (s <= minimum) + { + minimum = s; + result = 3; + } + s = dirSign(principalDirection, d, a, b); + if (s <= minimum) + { + minimum = s; + result = 0; + } + return result; + } + + bool generatePointInCell(const Gu::SDF& sdf, PxI32 x, PxI32 y, PxI32 z, PxVec3& point, PxReal corners[2][2][2]) + { + const PxReal threshold = 0.0f; + + PxU32 positiveCounter = 0; + PxU32 negativeCounter = 0; + for (PxI32 xx = 0; xx <= 1; ++xx) for (PxI32 yy = 0; yy <= 1; ++yy) for (PxI32 zz = 0; zz <= 1; ++zz) + { + PxReal v = corners[xx][yy][zz]; + if (v > 0) + ++positiveCounter; + if (v < 0) + ++negativeCounter; + } + PxBounds3 box; + box.minimum = sdf.mMeshLower + PxVec3(x * sdf.mSpacing, y * sdf.mSpacing, z * sdf.mSpacing); + box.maximum = box.minimum + PxVec3(sdf.mSpacing); + if (positiveCounter == 8 || negativeCounter == 8) + { + //Nothing to do because surface does not cross the current cell + } + else + { + //If point is not completely inside or outside, then find a point inside the cube that divides it into 8 cuboids + PxU32 counter = 0; + PxVec3 sum(0.0f); + for (PxI32 a = 0; a <= 1; ++a) for (PxI32 b = 0; b <= 1; ++b) + { + PxReal p = corners[a][b][0]; + PxReal q = corners[a][b][1]; + + if ((p <= threshold && q >= threshold) || (q <= threshold && p >= threshold)) + { + PxReal t = (q != p) ? PxClamp((threshold - p) / (q - p), 0.0f, 1.0f) : 0.5f; + sum += PxVec3(PxReal(a), PxReal(b), t); + ++counter; + } + } + for (PxI32 a = 0; a <= 1; ++a) for (PxI32 b = 0; b <= 1; ++b) + { + PxReal p = corners[b][0][a]; + PxReal q = corners[b][1][a]; + + if ((p <= threshold && q >= threshold) || (q <= threshold && p >= threshold)) + { + PxReal t = (q != p) ? PxClamp((threshold - p) / (q - p), 0.0f, 1.0f) : 0.5f; + sum += PxVec3(PxReal(b), t, PxReal(a)); + ++counter; + } + } + for (PxI32 a = 0; a <= 1; ++a) for (PxI32 b = 0; b <= 1; ++b) + { + PxReal p = corners[0][a][b]; + PxReal q = corners[1][a][b]; + + if ((p <= threshold && q >= threshold) || (q <= threshold && p >= threshold)) + { + PxReal t = (q != p) ? PxClamp((threshold - p) / (q - p), 0.0f, 1.0f) : 0.5f; + sum += PxVec3(t, PxReal(a), PxReal(b)); + ++counter; + } + } + if (counter > 0) + { + point = box.minimum + sum * (sdf.mSpacing / counter); + return true; + } + } + + return false; + } + + PX_FORCE_INLINE bool generatePointInCell(const Gu::SDF& sdf, PxI32 x, PxI32 y, PxI32 z, PxVec3& point) + { + PxReal corners[2][2][2]; + for (PxI32 xx = 0; xx <= 1; ++xx) for (PxI32 yy = 0; yy <= 1; ++yy) for (PxI32 zz = 0; zz <= 1; ++zz) + { + PxReal v = decode(sdf, x + xx, y + yy, z + zz); + corners[xx][yy][zz] = v; + } + return generatePointInCell(sdf, x, y, z, point, corners); + } + + PX_FORCE_INLINE bool generatePointInCellUsingCache(const Gu::SDF& sdf, PxI32 xBase, PxI32 yBase, PxI32 zBase, PxI32 x, PxI32 y, PxI32 z, PxVec3& point, const PxArray& cache) + { + PxReal corners[2][2][2]; + for (PxI32 xx = 0; xx <= 1; ++xx) for (PxI32 yy = 0; yy <= 1; ++yy) for (PxI32 zz = 0; zz <= 1; ++zz) + { + PxReal v = cache[idxCompact(x + xx, y + yy, z + zz, sdf.mSubgridSize + 1, sdf.mSubgridSize + 1)]; + corners[xx][yy][zz] = v; + } + return generatePointInCell(sdf, xBase * sdf.mSubgridSize + x, yBase * sdf.mSubgridSize + y, zBase * sdf.mSubgridSize + z, point, corners); + } + + PX_FORCE_INLINE PxReal getDenseSDFValue(const Gu::SDF& sdf, PxI32 x, PxI32 y, PxI32 z) + { + if (x < 0 || y < 0 || z < 0 || x >= PxI32(sdf.mDims.x) || y >= PxI32(sdf.mDims.y) || z >= PxI32(sdf.mDims.z)) + return 1.0; //Return a value >0 that counts as outside + + return sdf.mSdf[idxCompact(x, y, z, sdf.mDims.x, sdf.mDims.y)]; + } + + PX_FORCE_INLINE bool generatePointInCellDense(const Gu::SDF& sdf, PxI32 x, PxI32 y, PxI32 z, PxVec3& point) + { + PxReal corners[2][2][2]; + for (PxI32 xx = 0; xx <= 1; ++xx) for (PxI32 yy = 0; yy <= 1; ++yy) for (PxI32 zz = 0; zz <= 1; ++zz) + { + PxReal v = getDenseSDFValue(sdf, x + xx, y + yy, z + zz); + corners[xx][yy][zz] = v; + } + return generatePointInCell(sdf, x, y, z, point, corners); + } + + PX_FORCE_INLINE bool canSkipSubgrid(const Gu::SDF& sdf, PxI32 i, PxI32 j, PxI32 k) + { + const PxReal t = 0.1f * sdf.mSpacing; + const PxI32 nbX = sdf.mDims.x / sdf.mSubgridSize; + const PxI32 nbY = sdf.mDims.y / sdf.mSubgridSize; + const PxI32 nbZ = sdf.mDims.z / sdf.mSubgridSize; + + if (i < 0 || j < 0 || k < 0 || i >= nbX || j >= nbY || k >= nbZ) + return false; + + if (sdf.mSubgridStartSlots[k * (nbX) * (nbY)+j * (nbX)+i] == 0xFFFFFFFFu) + { + PxU32 positiveCounter = 0; + PxU32 negativeCounter = 0; + for (PxI32 xx = 0; xx <= 1; ++xx) for (PxI32 yy = 0; yy <= 1; ++yy) for (PxI32 zz = 0; zz <= 1; ++zz) + { + PxReal v = decode(sdf, (i + xx)* sdf.mSubgridSize, (j + yy) * sdf.mSubgridSize, (k + zz) * sdf.mSubgridSize); + if (v > t) + ++positiveCounter; + if (v < t) + ++negativeCounter; + } + if (positiveCounter == 8 || negativeCounter == 8) + return true; + } + return false; + } + + void createTriangles(PxI32 xId, PxI32 yId, PxI32 zId, PxReal d0, PxReal ds[3], const PxHashMap& cellToPoint, const PxArray& points, PxArray& triangleIndices) + { + bool flipTriangleOrientation = false; + const PxReal threshold = 0.0f; + + PxI32 num = 0; + for (PxI32 dim = 0; dim < 3; dim++) + { + PxReal d = ds[dim]; + if ((d0 <= threshold && d >= threshold) || (d <= threshold && d0 >= threshold)) + num++; + } + if (num == 0) + return; + + + PxI32 buffer[4]; + const PxPair* f = cellToPoint.find(key(xId, yId, zId)); + if (!f) + return; + + buffer[0] = f->second; + PxVec3 v0 = points[buffer[0]]; + + for (PxI32 dim = 0; dim < 3; dim++) + { + PxReal d = ds[dim]; + bool b1 = d0 <= threshold && d >= threshold; + bool b2 = d <= threshold && d0 >= threshold; + if (b1 || b2) + { + bool flip = flipTriangleOrientation == b1; + bool skip = false; + + for (PxI32 ii = 0; ii < 3; ++ii) + { + f = cellToPoint.find(key(xId + offsets[dim][ii][0], yId + offsets[dim][ii][1], zId + offsets[dim][ii][2])); + if (f) + buffer[ii + 1] = f->second; + else + skip = true; + } + if (skip) + continue; + + PxI32 shift = PxMax(0, indexOfMostConcaveCorner(dim, v0, points[buffer[1]], points[buffer[2]], points[buffer[3]])) % 2; + + //Split the quad into two triangles + for (PxI32 ii = 0; ii < 2; ++ii) + { + triangleIndices.pushBack(buffer[shift]); + if (flip) + { + for (PxI32 jj = 2; jj >= 1; --jj) + triangleIndices.pushBack(buffer[(ii + jj + shift) % 4]); + } + else + { + for (PxI32 jj = 1; jj < 3; ++jj) + triangleIndices.pushBack(buffer[(ii + jj + shift) % 4]); + } + } + } + } + } + + + void extractIsosurfaceFromSDF(const Gu::SDF& sdf, PxArray& isosurfaceVertices, PxArray& isosurfaceTriangleIndices) + { + isosurfaceVertices.clear(); + isosurfaceTriangleIndices.clear(); + + const PxI32 nbX = sdf.mDims.x / PxMax(1u, sdf.mSubgridSize); + const PxI32 nbY = sdf.mDims.y / PxMax(1u, sdf.mSubgridSize); + const PxI32 nbZ = sdf.mDims.z / PxMax(1u, sdf.mSubgridSize); + + PxHashMap cellToPoint; + + if (sdf.mSubgridSize == 0) + { + //Dense SDF + for (PxI32 k = -1; k <= nbZ; ++k) + for (PxI32 j = -1; j <= nbY; ++j) + for (PxI32 i = -1; i <= nbX; ++i) + { + PxVec3 p; + if (generatePointInCellDense(sdf, i, j, k, p)) + { + cellToPoint.insert(key(i, j, k), isosurfaceVertices.size()); + isosurfaceVertices.pushBack(p); + } + } + } + else + { + PxArray sdfCache; + sdfCache.resize((sdf.mSubgridSize + 1) * (sdf.mSubgridSize + 1) * (sdf.mSubgridSize + 1)); + + for (PxI32 k = -1; k <= nbZ; ++k) + { + for (PxI32 j = -1; j <= nbY; ++j) + { + for (PxI32 i = -1; i <= nbX; ++i) + { + if (canSkipSubgrid(sdf, i, j, k)) + continue; + + for (PxU32 z = 0; z <= sdf.mSubgridSize; ++z) + for (PxU32 y = 0; y <= sdf.mSubgridSize; ++y) + for (PxU32 x = 0; x <= sdf.mSubgridSize; ++x) + sdfCache[idxCompact(x, y, z, sdf.mSubgridSize + 1, sdf.mSubgridSize + 1)] = decode(sdf, i * sdf.mSubgridSize + x, j * sdf.mSubgridSize + y, k * sdf.mSubgridSize + z); + + //Process the subgrid + for (PxU32 z = 0; z < sdf.mSubgridSize; ++z) + { + for (PxU32 y = 0; y < sdf.mSubgridSize; ++y) + { + for (PxU32 x = 0; x < sdf.mSubgridSize; ++x) + { + PxVec3 p; + PxU32 xId = i * sdf.mSubgridSize + x; + PxU32 yId = j * sdf.mSubgridSize + y; + PxU32 zId = k * sdf.mSubgridSize + z; + if (generatePointInCellUsingCache(sdf, i, j, k, x, y, z, p, sdfCache)) + { + cellToPoint.insert(key(xId, yId, zId), isosurfaceVertices.size()); + isosurfaceVertices.pushBack(p); + } + } + } + } + } + } + } + } + + if (sdf.mSubgridSize == 0) + { + for (PxI32 k = -1; k <= nbZ; ++k) + for (PxI32 j = -1; j <= nbY; ++j) + for (PxI32 i = -1; i <= nbX; ++i) + { + PxReal d0 = getDenseSDFValue(sdf, i, j, k); + PxReal ds[3]; + ds[0] = getDenseSDFValue(sdf, i + 1, j, k); + ds[1] = getDenseSDFValue(sdf, i, j + 1, k); + ds[2] = getDenseSDFValue(sdf, i, j, k + 1); + + createTriangles(i, j, k, d0, ds, cellToPoint, isosurfaceVertices, isosurfaceTriangleIndices); + } + } + else + { + for (PxI32 k = -1; k <= nbZ; ++k) + { + for (PxI32 j = -1; j <= nbY; ++j) + { + for (PxI32 i = -1; i <= nbX; ++i) + { + if (canSkipSubgrid(sdf, i, j, k)) + continue; + + //Process the subgrid + for (PxU32 z = 0; z < sdf.mSubgridSize; ++z) + { + for (PxU32 y = 0; y < sdf.mSubgridSize; ++y) + { + for (PxU32 x = 0; x < sdf.mSubgridSize; ++x) + { + PxReal d0 = decode(sdf, i * sdf.mSubgridSize + x, j * sdf.mSubgridSize + y, k * sdf.mSubgridSize + z); + PxReal ds[3]; + ds[0] = decode(sdf, i * sdf.mSubgridSize + x + 1, j * sdf.mSubgridSize + y, k * sdf.mSubgridSize + z); + ds[1] = decode(sdf, i * sdf.mSubgridSize + x, j * sdf.mSubgridSize + y + 1, k * sdf.mSubgridSize + z); + ds[2] = decode(sdf, i * sdf.mSubgridSize + x, j * sdf.mSubgridSize + y, k * sdf.mSubgridSize + z + 1); + + createTriangles(x + i * sdf.mSubgridSize, y + j * sdf.mSubgridSize, z + k * sdf.mSubgridSize, d0, ds, cellToPoint, isosurfaceVertices, isosurfaceTriangleIndices); + } + } + } + } + } + } + } + } +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.h new file mode 100644 index 0000000..52468c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSDF.h @@ -0,0 +1,270 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SDF_H +#define GU_SDF_H +/** \addtogroup geomutils +@{ +*/ + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVec3.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxArray.h" + +namespace physx +{ + namespace Gu + { + /** + \brief Represents dimensions of signed distance field + */ + class Dim3 + { + public: + /** + \brief Constructor + */ + Dim3() + { + } + + /** + \brief Constructor + */ + Dim3(PxZERO d) : x(0), y(0), z(0) + { + PX_UNUSED(d); + } + + /** + \brief Constructor + */ + Dim3(PxU32 _x, PxU32 _y, PxU32 _z) : x(_x), y(_y), z(_z) + { + } + + /** + \brief Copy constructor + */ + Dim3(const Dim3& d) : x(d.x), y(d.y), z(d.z) + { + } + + PxU32 x; //!< Size of X dimension + PxU32 y; //!< Size of Y dimension + PxU32 z; //!< Size of Z dimension + }; + + /** + \brief Represents a signed distance field. + */ + class SDF : public PxUserAllocated + { + public: + +// PX_SERIALIZATION + SDF(const PxEMPTY) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + /** + \brief Constructor + */ + SDF() : mSdf(NULL), mSubgridStartSlots(NULL), mSubgridSdf(NULL) + { + } + + /** + \brief Constructor + */ + SDF(PxZERO s) + : mMeshLower(PxZero), mSpacing(0.0f), mDims(PxZero), mNumSdfs(0), mSdf(NULL), + mSubgridSize(PxZero), mNumStartSlots(0), mSubgridStartSlots(NULL), mNumSubgridSdfs(0), mSubgridSdf(NULL), mSdfSubgrids3DTexBlockDim(PxZero), + mSubgridsMinSdfValue(0.0f), mSubgridsMaxSdfValue(0.0f), mBytesPerSparsePixel(0) + { + PX_UNUSED(s); + } + + /** + \brief Copy constructor + */ + SDF(const SDF& sdf) + : mMeshLower(sdf.mMeshLower), mSpacing(sdf.mSpacing), mDims(sdf.mDims), mNumSdfs(sdf.mNumSdfs), mSdf(sdf.mSdf), + mSubgridSize(sdf.mSubgridSize), mNumStartSlots(sdf.mNumStartSlots), mSubgridStartSlots(sdf.mSubgridStartSlots), mNumSubgridSdfs(sdf.mNumSubgridSdfs), mSubgridSdf(sdf.mSubgridSdf), mSdfSubgrids3DTexBlockDim(sdf.mSdfSubgrids3DTexBlockDim), + mSubgridsMinSdfValue(sdf.mSubgridsMinSdfValue), mSubgridsMaxSdfValue(sdf.mSubgridsMaxSdfValue), mBytesPerSparsePixel(sdf.mBytesPerSparsePixel) + { + } + + /** + \brief Destructor + */ + ~SDF(); + + + PxReal* allocateSdfs(const PxVec3& meshLower, const PxReal& spacing, const PxU32 dimX, const PxU32 dimY, const PxU32 dimZ, + const PxU32 subgridSize, const PxU32 sdfSubgrids3DTexBlockDimX, const PxU32 sdfSubgrids3DTexBlockDimY, const PxU32 sdfSubgrids3DTexBlockDimZ, + PxReal subgridsMinSdfValue, PxReal subgridsMaxSdfValue, PxU32 bytesPerSparsePixel); + + PxVec3 mMeshLower; //!< Lower bound of the original mesh + PxReal mSpacing; //!< Spacing of each sdf voxel + Dim3 mDims; //!< Dimension of the sdf + PxU32 mNumSdfs; //!< Number of sdf values + PxReal* mSdf; //!< Array of sdf + + // Additional data to support sparse grid SDFs + PxU32 mSubgridSize; //!< The number of cells in a sparse subgrid block (full block has mSubgridSize^3 cells and (mSubgridSize+1)^3 samples). If set to zero, this indicates that only a dense background grid SDF is used without sparse blocks + PxU32 mNumStartSlots; //!< Array length of mSubgridStartSlots. Only used for serialization + PxU32* mSubgridStartSlots; //!< Array with start indices into the subgrid texture for every subgrid block. 10bits for z coordinate, 10bits for y and 10bits for x + PxU32 mNumSubgridSdfs; //!< Array length of mSubgridSdf. Only used for serialization + PxU8* mSubgridSdf; //!< The data to create the 3d texture containg the packed subgrid blocks. Stored as PxU8 to support multiple formats (8, 16 and 32 bits per pixel) + Dim3 mSdfSubgrids3DTexBlockDim; //!< Subgrid sdf is layed out as a 3d texture including packed blocks of size (mSubgridSize+1)^3 + PxReal mSubgridsMinSdfValue; //!< The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + PxReal mSubgridsMaxSdfValue; //!< The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + PxU32 mBytesPerSparsePixel; //!< The number of bytes per subgrid pixel + }; + + /** + \brief Returns the number of times a point is enclosed by a triangle mesh. Therefore points with a winding number of 0 lie oufside of the mesh, others lie inside. The sign of the winding number + is dependent ond the triangle orientation. For close meshes, a robust inside/outside check should not test for a value of 0 exactly, inside = PxAbs(windingNumber) > 0.5f should be preferred. + + \param[in] vertices The triangle mesh's vertices + \param[in] indices The triangle mesh's indices + \param[in] numTriangleIndices The number of indices + \param[in] width The number of grid points along the x direction + \param[in] height The number of grid points along the y direction + \param[in] depth The number of grid points along the z direction + \param[out] windingNumbers The winding number for the center of every grid cell, index rule is: index = z * width * height + y * width + x + \param[in] minExtents The grid's lower corner + \param[in] maxExtents The grid's upper corner + \param[out] sampleLocations Optional buffer to output the grid sample locations, index rule is: index = z * width * height + y * width + x + */ + PX_PHYSX_COMMON_API void windingNumbers(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + PxReal* windingNumbers, PxVec3 minExtents, PxVec3 maxExtents, PxVec3* sampleLocations = NULL); + + /** + \brief Returns if a point is enclosed by a triangle mesh. + + \param[in] vertices The triangle mesh's vertices + \param[in] indices The triangle mesh's indices + \param[in] numTriangleIndices The number of indices + \param[in] width The number of grid points along the x direction + \param[in] height The number of grid points along the y direction + \param[in] depth The number of grid points along the z direction + \param[out] insideResult Booleans that indicate if the center of a grid cell is inside or outside, index rule is: index = z * width * height + y * width + x + \param[in] minExtents The grid's lower corner, the box formed by minExtent and maxExtent must include all vertices + \param[in] maxExtents The grid's upper corner, the box formed by minExtent and maxExtent must include all vertices + \param[out] sampleLocations Optional buffer to output the grid sample locations, index rule is: index = z * width * height + y * width + x + */ + PX_PHYSX_COMMON_API void windingNumbersInsideCheck(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + bool* insideResult, PxVec3 minExtents, PxVec3 maxExtents, PxVec3* sampleLocations = NULL); + + /** + \brief Returns the distance to the mesh's surface for all samples in a grid. The sign is dependent on the triangle orientation. Negative distances indicate that a sample is inside the mesh, positive + distances mean the sample is outside of the mesh. + + \param[in] vertices The triangle mesh's vertices + \param[in] indices The triangle mesh's indices + \param[in] numTriangleIndices The number of indices + \param[in] width The number of grid points along the x direction + \param[in] height The number of grid points along the y direction + \param[in] depth The number of grid points along the z direction + \param[out] sdf The signed distance field (negative values indicate that a point is inside of the mesh), index rule is: index = z * width * height + y * width + x + \param[in] minExtents The grid's lower corner, the box formed by minExtent and maxExtent must include all vertices + \param[in] maxExtents The grid's upper corner, the box formed by minExtent and maxExtent must include all vertices + \param[out] sampleLocations Optional buffer to output the grid sample locations, index rule is: index = z * width * height + y * width + x + \param[in] cellCenteredSamples Determines if the sample points are chosen at cell centers or at cell origins + \param[in] numThreads The number of cpu threads to use during the computation + */ + PX_PHYSX_COMMON_API void SDFUsingWindingNumbers(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + PxReal* sdf, PxVec3 minExtents, PxVec3 maxExtents, PxVec3* sampleLocations = NULL, bool cellCenteredSamples = true, PxU32 numThreads = 1); + + /** + \brief Returns the distance to the mesh's surface for all samples in a grid. The sign is dependent on the triangle orientation. Negative distances indicate that a sample is inside the mesh, positive + distances mean the sample is outside of the mesh. Near mesh surfaces, a higher resolution is available than further away from the surface (sparse sdf format) to save memory. + The samples are not cell centered but located at the cell origin. This is a requirement of the sparse grid format. + + \param[in] vertices The triangle mesh's vertices + \param[in] indices The triangle mesh's indices + \param[in] numTriangleIndices The number of indices + \param[in] width The number of grid points along the x direction + \param[in] height The number of grid points along the y direction + \param[in] depth The number of grid points along the z direction + \param[in] minExtents The grid's lower corner, the box formed by minExtent and maxExtent must include all vertices + \param[in] maxExtents The grid's upper corner, the box formed by minExtent and maxExtent must include all vertices + + \param[in] narrowBandThicknessRelativeToExtentDiagonal The thickness of the narrow band as a fraction of the sdf box diagonal length. Can be as small as 0 but a value of at least 0.01 is recommended. + \param[in] cellsPerSubgrid The number of cells in a sparse subgrid block (full block has mSubgridSize^3 cells and (mSubgridSize+1)^3 samples) + \param[out] sdfCoarse The coarse sdf as a dense 3d array of lower resolution (resulution is (with/cellsPerSubgrid+1, height/cellsPerSubgrid+1, depth/cellsPerSubgrid+1)) + \param[out] sdfFineStartSlots The start slot indices of the subgrid blocks. If a subgrid block is empty, the start slot will be 0xFFFFFFFF + \param[out] subgridData The array containing subgrid data blocks + \param[out] denseSdf Provides acces to the denxe sdf that is used for compuation internally + \param[out] subgridsMinSdfValue The minimum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + \param[out] subgridsMaxSdfValue The maximum value over all subgrid blocks. Used if normalized textures are used which is the case for 8 and 16bit formats + \param[in] numThreads The number of cpu threads to use during the computation + */ + PX_PHYSX_COMMON_API void SDFUsingWindingNumbersSparse(const PxVec3* vertices, const PxU32* indices, PxU32 numTriangleIndices, PxU32 width, PxU32 height, PxU32 depth, + const PxVec3& minExtents, const PxVec3& maxExtents, PxReal narrowBandThicknessRelativeToExtentDiagonal, PxU32 cellsPerSubgrid, + PxArray& sdfCoarse, PxArray& sdfFineStartSlots, PxArray& subgridData, PxArray& denseSdf, + PxReal& subgridsMinSdfValue, PxReal& subgridsMaxSdfValue, PxU32 numThreads = 1); + + + /** + \brief Converts a sparse grid sdf to a format that can be used to create a 3d texture. 3d textures support very efficient + trilinear interpolation on the GPU which is very important during sdf evaluation. + + \param[in] width The number of grid points along the x direction + \param[in] height The number of grid points along the y direction + \param[in] depth The number of grid points along the z direction + \param[in] cellsPerSubgrid The number of cells in a sparse subgrid block (full block has mSubgridSize^3 cells and (mSubgridSize+1)^3 samples) + \param[in,out] sdfFineStartSlots Array with linear start indices into the subgrid data array. This array gets converted by this method to start indices for every subgrid block in the 3d texture. The result uses 10bits for z coordinate, 10bits for y and 10bits for x + \param[in] sdfFineSubgridsIn Subgrid data array + \param[in] sdfFineSubgridsSize Number of elements in sdfFineSubgridsIn + \param[out] subgrids3DTexFormat The subgrid data organized in a 3d texture compatible order + \param[out] numSubgridsX Number of subgrid blocks in the 3d texture along x. The full texture dimension along x will be numSubgridsX*(cellsPerSubgrid+1). + \param[out] numSubgridsY Number of subgrid blocks in the 3d texture along y. The full texture dimension along y will be numSubgridsY*(cellsPerSubgrid+1). + \param[out] numSubgridsZ Number of subgrid blocks in the 3d texture along z. The full texture dimension along z will be numSubgridsZ*(cellsPerSubgrid+1). + */ + PX_PHYSX_COMMON_API void convertSparseSDFTo3DTextureLayout(PxU32 width, PxU32 height, PxU32 depth, PxU32 cellsPerSubgrid, + PxU32* sdfFineStartSlots, const PxReal* sdfFineSubgridsIn, PxU32 sdfFineSubgridsSize, PxArray& subgrids3DTexFormat, + PxU32& numSubgridsX, PxU32& numSubgridsY, PxU32& numSubgridsZ); + + /** + \brief Extracts an isosurface as a triangular mesh from a signed distance function + + \param[in] sdf The signed distance function + \param[out] isosurfaceVertices The vertices of the extracted isosurface + \param[out] isosurfaceTriangleIndices The triangles of the extracted isosurface + */ + PX_PHYSX_COMMON_API void extractIsosurfaceFromSDF(const Gu::SDF& sdf, PxArray& isosurfaceVertices, PxArray& isosurfaceTriangleIndices); + } +} + +/** @} */ +#endif + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp new file mode 100644 index 0000000..149c379 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.cpp @@ -0,0 +1,1071 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSecondaryPruner.h" +#include "GuBucketPruner.h" +#include "GuIncrementalAABBPrunerCore.h" + +//#define USE_DEBUG_PRINTF + +#ifdef USE_DEBUG_PRINTF + #include +#endif + +using namespace physx; +using namespace Gu; + +class CompanionPrunerBucket : public CompanionPruner +{ + public: + CompanionPrunerBucket() : mPrunerCore(false) {} + virtual ~CompanionPrunerBucket() {} + + virtual bool addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, PoolIndex poolIndex) + { + PX_UNUSED(poolIndex); + PX_UNUSED(handle); + return mPrunerCore.addObject(object, worldAABB, transform, timeStamp); + } + virtual bool updateObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PoolIndex poolIndex) + { + PX_UNUSED(poolIndex); + PX_UNUSED(handle); + return mPrunerCore.updateObject(worldAABB, object, transform); + } + virtual bool removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, PxU32 swapObjectIndex) + { + PX_UNUSED(objectIndex); + PX_UNUSED(swapObjectIndex); + PX_UNUSED(handle); + PxU32 timeStamp; + return mPrunerCore.removeObject(object, timeStamp); + } + virtual void swapIndex(PxU32 objectIndex, PxU32 swapObjectIndex) + { + PX_UNUSED(objectIndex); + PX_UNUSED(swapObjectIndex); + } + virtual PxU32 removeMarkedObjects(PxU32 timeStamp) { return mPrunerCore.removeMarkedObjects(timeStamp); } + virtual void shiftOrigin(const PxVec3& shift) { mPrunerCore.shiftOrigin(shift); } + virtual void timeStampChange() { } + virtual void build() { mPrunerCore.build(); } + virtual PxU32 getNbObjects() const { return mPrunerCore.getNbObjects(); } + virtual void release() { mPrunerCore.release(); } + virtual void visualize(PxRenderOutput& out, PxU32 color) const { mPrunerCore.visualize(out, color); } + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.raycast(origin, unitDir, inOutDistance, prunerCallback); + return true; + } + virtual bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.overlap(queryVolume, prunerCallback); + return true; + } + virtual bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.sweep(queryVolume, unitDir, inOutDistance, prunerCallback); + return true; + } + virtual void getGlobalBounds(PxBounds3& bounds) const + { + mPrunerCore.getGlobalBounds(bounds); + } + + BucketPrunerCore mPrunerCore; +}; + +class CompanionPrunerIncremental : public CompanionPruner +{ + public: + CompanionPrunerIncremental(const PruningPool* pool) : mPrunerCore(pool) {} + virtual ~CompanionPrunerIncremental() {} + + virtual bool addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, PoolIndex poolIndex) + { + PX_UNUSED(worldAABB); + PX_UNUSED(transform); + PX_UNUSED(object); + PX_UNUSED(handle); + return mPrunerCore.addObject(poolIndex, timeStamp); + } + virtual bool updateObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PoolIndex poolIndex) + { + PX_UNUSED(worldAABB); + PX_UNUSED(transform); + PX_UNUSED(object); + PX_UNUSED(handle); + return mPrunerCore.updateObject(poolIndex); + } + virtual bool removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, PxU32 swapObjectIndex) + { + PX_UNUSED(object); + PX_UNUSED(handle); + PxU32 timeStamp; + return mPrunerCore.removeObject(objectIndex, swapObjectIndex, timeStamp); + } + virtual void swapIndex(PxU32 objectIndex, PxU32 swapObjectIndex) + { + mPrunerCore.swapIndex(objectIndex, swapObjectIndex); + } + virtual PxU32 removeMarkedObjects(PxU32 timeStamp) { return mPrunerCore.removeMarkedObjects(timeStamp); } + virtual void shiftOrigin(const PxVec3& shift) { mPrunerCore.shiftOrigin(shift); } + virtual void timeStampChange() { mPrunerCore.timeStampChange(); } + virtual void build() { mPrunerCore.build(); } + virtual PxU32 getNbObjects() const { return mPrunerCore.getNbObjects(); } + virtual void release() { mPrunerCore.release(); } + virtual void visualize(PxRenderOutput& out, PxU32 color) const { mPrunerCore.visualize(out, color); } + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.raycast(origin, unitDir, inOutDistance, prunerCallback); + return true; + } + virtual bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.overlap(queryVolume, prunerCallback); + return true; + } + virtual bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const + { + if(mPrunerCore.getNbObjects()) + return mPrunerCore.sweep(queryVolume, unitDir, inOutDistance, prunerCallback); + return true; + } + virtual void getGlobalBounds(PxBounds3& bounds) const + { + mPrunerCore.getGlobalBounds(bounds); + } + + IncrementalAABBPrunerCore mPrunerCore; +}; + + + +#define USE_MAVERICK_NODE + +#include "GuActorShapeMap.h" +#include "GuBVH.h" +#include "GuAABBTreeNode.h" +#include "GuAABBTreeBuildStats.h" +#include "GuAABBTreeQuery.h" +#include "GuQuery.h" +#ifdef USE_MAVERICK_NODE + #include "GuMaverickNode.h" +#endif + +static const bool gUpdateTreeWhenRemovingObject = false; +static const bool gUpdateObjectBoundsWhenRemovingObject = true; + +class CompanionPrunerAABBTree : public CompanionPruner +{ + enum DirtyFlags + { + NEEDS_REBUILD = (1<<0), + NEEDS_REFIT = (1<<1) + }; + + public: + CompanionPrunerAABBTree(PxU64 contextID, const PruningPool* pool); + virtual ~CompanionPrunerAABBTree(); + + virtual bool addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, PoolIndex poolIndex); + virtual bool updateObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PoolIndex poolIndex); + virtual bool removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, PxU32 swapObjectIndex); + virtual void swapIndex(PxU32 objectIndex, PxU32 swapObjectIndex); + virtual PxU32 removeMarkedObjects(PxU32 timeStamp); + virtual void shiftOrigin(const PxVec3& shift); + virtual void timeStampChange(); + virtual void build(); + virtual PxU32 getNbObjects() const; + virtual void release(); + virtual void visualize(PxRenderOutput& out, PxU32 color) const; + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const; + virtual bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const; + virtual bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const; + virtual void getGlobalBounds(PxBounds3& bounds) const; + + // PT: we have multiple options here, not sure which one is best: + // - use a Gu:BVH + // - use a Gu:AABBTree + // - use a full blown Pruner + // - use/reference the master PruningPool or not + // - use a hashmap + // - use PoolIndex + // - use PrunerHandle + // - somehow return our own local index to caller and use that + // + // The current implementation uses a PxBVH, a reference to the master PruningPool, and PrunerHandles. + +#ifdef USE_MAVERICK_NODE + MaverickNode mMaverick; +#endif + const PruningPool* mPool; + + struct LocalData + { + PX_FORCE_INLINE LocalData(PxU32 timestamp, PrunerHandle handle) : mTimestamp(timestamp), mHandle(handle) {} + + PxU32 mTimestamp; + PrunerHandle mHandle; + + PX_FORCE_INLINE void setRemoved() + { + mTimestamp = 0xffffffff; + mHandle = 0xffffffff; + } + + PX_FORCE_INLINE bool isValid(PxU32 lastValidTimestamp) const + { + return mHandle != 0xffffffff && mTimestamp>=lastValidTimestamp; + } + }; + PxArray mLocalData; + + BVH* mBVH; + PxU32* mRemap; // Pruner handle to local index + PxU32 mMapSize; + PxU32 mDirtyFlags; + PxU32 mLastValidTimestamp; + + PX_FORCE_INLINE PxU32 getNbObjectsFast() const { return mLocalData.size(); } + + bool addObjectInternal(PrunerHandle handle, PxU32 timeStamp); + void releaseInternal(); + void resizeMap(PxU32 index); +}; + +CompanionPrunerAABBTree::CompanionPrunerAABBTree(PxU64 /*contextID*/, const PruningPool* pool) : mPool(pool), + mBVH (NULL), + mRemap (NULL), + mMapSize (0), + mDirtyFlags (0), + mLastValidTimestamp (0) +{ +} + +CompanionPrunerAABBTree::~CompanionPrunerAABBTree() +{ + releaseInternal(); +} + +void CompanionPrunerAABBTree::releaseInternal() +{ + PX_DELETE(mBVH); + PX_FREE(mRemap); + mMapSize = 0; + mDirtyFlags = 0; + mLastValidTimestamp = 0; +} + +void CompanionPrunerAABBTree::resizeMap(PxU32 index) +{ + PxU32 size = mMapSize ? mMapSize*2 : 64; + const PxU32 minSize = index+1; + if(minSize>size) + size = minSize*2; + + PxU32* items = PX_ALLOCATE(PxU32, size, "Map"); + if(mRemap) + PxMemCopy(items, mRemap, mMapSize*sizeof(PxU32)); + PxMemSet(items+mMapSize, 0xff, (size-mMapSize)*sizeof(PxU32)); + PX_FREE(mRemap); + mRemap = items; + mMapSize = size; +} + +bool CompanionPrunerAABBTree::addObjectInternal(PrunerHandle handle, PxU32 timeStamp) +{ + const PxU32 localIndex = getNbObjectsFast(); + +#ifdef USE_DEBUG_PRINTF + printf("add %d %d to local %d\n", handle, timeStamp, localIndex); +#endif + + PX_ASSERT(handle!=0xffffffff); + if(handle>=mMapSize) + resizeMap(handle); + + PX_ASSERT(mRemap[handle]==0xffffffff || !mLocalData[mRemap[handle]].isValid(mLastValidTimestamp)); + mRemap[handle] = localIndex; + + mLocalData.pushBack(LocalData(timeStamp, handle)); + + PX_DELETE(mBVH); + mDirtyFlags = NEEDS_REBUILD; + + // PT: TODO: why didn't we return a secondary pruner handle from here? Could have been stored in the padding bytes of the pruning pool's transform array for example + return true; +} + +bool CompanionPrunerAABBTree::addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, PoolIndex poolIndex) +{ + PX_UNUSED(object); + PX_UNUSED(worldAABB); + PX_UNUSED(transform); + PX_UNUSED(timeStamp); + PX_UNUSED(poolIndex); + +#ifdef USE_MAVERICK_NODE + if(mMaverick.addObject(object, handle, worldAABB, transform, timeStamp)) + return true; + + PxU32 nbToAdd = mMaverick.mNbFree; + for(PxU32 i=0;iupdateBoundsInternal(localIndex, worldAABB)) + mDirtyFlags |= NEEDS_REFIT; + + return true; +} + +bool CompanionPrunerAABBTree::removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, PxU32 swapObjectIndex) +{ + PX_UNUSED(object); + PX_UNUSED(objectIndex); + PX_UNUSED(swapObjectIndex); + PX_UNUSED(handle); + +#ifdef USE_MAVERICK_NODE + PxU32 unused; + if(mMaverick.removeObject(handle, unused)) + return true; +#endif + + PX_ASSERT(handle(mBVH->getData()); + const PxU32 nbNodes = data.mNbNodes; + PX_UNUSED(nbNodes); + BVHNode* nodes = data.mNodes; + PxU32* indices = data.mIndices; + PxBounds3* bounds = data.mBounds.getBounds(); + + if(gUpdateObjectBoundsWhenRemovingObject) + { + // Invalidates the object bounds, not always needed + // The node bounds would need recomputing, and the branch refit + bounds[localIndex].minimum = PxVec3(GU_EMPTY_BOUNDS_EXTENTS); + bounds[localIndex].maximum = PxVec3(-GU_EMPTY_BOUNDS_EXTENTS); + } + + PxU32* mMapping = data.getUpdateMap(); + if(gUpdateTreeWhenRemovingObject && mMapping) + { + // PT: note: the following codepath has only one part (as opposed to the equivalent code in AABBTreeUpdateMap) + // because it operates on our local indices, not on (pruning) pool indices. The difference is that our local + // array can have holes in it for removed objects, while the AABBTree's update code works with the PruningPool + // (no holes). + + const PxU32 treeNodeIndex = mMapping[localIndex]; + + if(treeNodeIndex!=0xffffffff) + { + PX_ASSERT(treeNodeIndex < nbNodes); + PX_ASSERT(nodes[treeNodeIndex].isLeaf()); + + BVHNode* node = nodes + treeNodeIndex; + const PxU32 nbPrims = node->getNbRuntimePrimitives(); + PX_ASSERT(nbPrims < 16); + + // retrieve the primitives pointer + PxU32* primitives = node->getPrimitives(indices); + PX_ASSERT(primitives); + + // PT: look for desired local index in the leaf + bool foundIt = false; + for(PxU32 i=0;isetNbRunTimePrimitives(last); + + primitives[i] = 0xffffffff; // Mark primitive index as invalid in the node + mMapping[localIndex] = 0xffffffff; // invalidate the node index for pool 0 + + // PT: swap within the leaf node. No need to update the mapping since they should all point + // to the same tree node anyway. + if(last!=i) + PxSwap(primitives[i], primitives[last]); + + // PT: breaking here means we couldn't reuse that loop to update the node bounds + break; + } + } + PX_ASSERT(foundIt); + PX_UNUSED(foundIt); + } + } + } + return true; +} + +void CompanionPrunerAABBTree::swapIndex(PxU32 objectIndex, PxU32 swapObjectIndex) +{ + PX_UNUSED(objectIndex); + PX_UNUSED(swapObjectIndex); +} + +PxU32 CompanionPrunerAABBTree::removeMarkedObjects(PxU32 timeStamp) +{ +#ifdef USE_DEBUG_PRINTF + printf("removeMarkedObjects %d\n", timeStamp); +#endif + PX_UNUSED(timeStamp); + + //printf("removeMarkedObjects %d\n", timeStamp); + mLastValidTimestamp = timeStamp+1; + + // PT: TODO: consider updating our local data as well here but is it worth it? + if(0) + { + const PxU32 nbObjects = getNbObjectsFast(); + for(PxU32 i=0;i(mBVH->getData()); + + PxU32 nbNodes = data.mNbNodes; + BVHNode* nodes = data.mNodes; + while(nbNodes--) + { + nodes->mBV.minimum -= shift; + nodes->mBV.maximum -= shift; + nodes++; + } + + PxU32 nbObjects = getNbObjectsFast(); + PxBounds3* bounds = data.mBounds.getBounds(); + while(nbObjects--) + { + if(!bounds->isEmpty()) + { + bounds->minimum -= shift; + bounds->maximum -= shift; + } + bounds++; + } + } + +#ifdef USE_MAVERICK_NODE + mMaverick.shiftOrigin(shift); +#endif +} + +void CompanionPrunerAABBTree::timeStampChange() +{ +} + +void CompanionPrunerAABBTree::build() +{ + if(!mDirtyFlags) // PT: necessary, extended bucket pruner calls this without checking first + return; + + const PxU32 needsRebuild = mDirtyFlags & NEEDS_REBUILD; + const PxU32 needsRefit = mDirtyFlags & NEEDS_REFIT; + + mDirtyFlags = 0; + + // PT: we want fast build for this one + const PxU32 numPrimsPerLeaf = 15; + + if(needsRebuild) + { + PX_DELETE(mBVH); + + PxU32 nbObjects = getNbObjectsFast(); + if(!nbObjects) + return; + + if(1) + { +// PT: you know what forget it just rebuild the whole map +PX_FREE(mRemap); +PxU32* newRemap = PX_ALLOCATE(PxU32, mMapSize, "Map"); +PxMemSet(newRemap, 0xff, mMapSize*sizeof(PxU32)); +mRemap = newRemap; + + PxU32 offset = 0; + PxU32 nb = nbObjects; + while(nb--) + { + if(!mLocalData[offset].isValid(mLastValidTimestamp)) + { + if(0 && mLocalData[offset].mHandle!=0xffffffff) + { + //PX_ASSERT(mRemap[mLocalData[offset].mHandle]==offset); + mRemap[mLocalData[offset].mHandle] = 0xffffffff; + } + + // This object has been removed, plug the hole + const LocalData& movedData = mLocalData[--nbObjects]; + + if(movedData.isValid(mLastValidTimestamp)) + { +#ifdef USE_DEBUG_PRINTF + printf("move %d %d from %d to %d\n", movedData.mHandle, movedData.mTimestamp, nbObjects, offset); + if(movedData.mHandle==22) + { + int stop = 1; + (void)stop; + } +#endif + //PX_ASSERT(mRemap[movedData.mHandle]==nbObjects); + //mRemap[movedData.mHandle] = offset; +mRemap[movedData.mHandle] = offset; + } +#ifdef USE_DEBUG_PRINTF + else + printf("skip remap %d %d from %d to %d\n", movedData.mHandle, movedData.mTimestamp, nbObjects, offset); +#endif + mLocalData[offset] = movedData; + } + else + { +mRemap[mLocalData[offset].mHandle] = offset; + offset++; + } + } + nbObjects = offset; + mLocalData.forceSize_Unsafe(offset); + if(!nbObjects) + return; + } + + if(1) + { + AABBTreeBounds bounds; + bounds.init(nbObjects); + // PT: TODO: inflation? + const PxBounds3* currentBounds = mPool->getCurrentWorldBoxes(); + PxBounds3* dst = bounds.getBounds(); + for(PxU32 i=0; igetIndex(localData.mHandle); + dst[i] = currentBounds[poolIndex]; + } + + mBVH = PX_NEW(BVH)(NULL); + bool status = mBVH->init(nbObjects, &bounds, NULL, 0, BVH_SPLATTER_POINTS, numPrimsPerLeaf, 0.0); + PX_ASSERT(status); + PX_UNUSED(status); + } + + { + BVHData& data = const_cast(mBVH->getData()); + data.createUpdateMap(getNbObjectsFast()); + } + + return; + } + + if(needsRefit && mBVH) + { + BVHData& data = const_cast(mBVH->getData()); + data.refitMarkedNodes(data.mBounds.getBounds()); + } +} + +PxU32 CompanionPrunerAABBTree::getNbObjects() const +{ + PxU32 nb = getNbObjectsFast(); +#ifdef USE_MAVERICK_NODE + nb += mMaverick.getNbPrimitives(); +#endif + return nb; +} + +void CompanionPrunerAABBTree::release() +{ + releaseInternal(); +} + +void CompanionPrunerAABBTree::visualize(PxRenderOutput& out, PxU32 color) const +{ + visualizeTree(out, color, mBVH); +} + +namespace +{ + struct BVHTree + { + PX_FORCE_INLINE BVHTree(const BVHData& data) : mRootNode(data.mNodes), mIndices(data.mIndices) {} + + const BVHNode* getNodes() const { return mRootNode; } + const PxU32* getIndices() const { return mIndices; } + + const BVHNode* mRootNode; + const PxU32* mIndices; + }; + + struct RaycastAdapter + { + RaycastAdapter(const CompanionPrunerAABBTree& owner, PrunerRaycastCallback& cb, PxU32 lastValidTimestamp) : mOwner(owner), mCallback(cb), mLastValidTimestamp(lastValidTimestamp), mAbort(false) {} + + PX_FORCE_INLINE bool invoke(PxReal& distance, PxU32 index) + { + if(!mOwner.mLocalData[index].isValid(mLastValidTimestamp)) + return true; // PT: object has been removed, tree data hasn't been updated accordingly + + const PxU32 handle = mOwner.mLocalData[index].mHandle; +// if(gUpdateTreeWhenRemovingObject) + { + PX_ASSERT(handle!=0xffffffff); + } +/* else + { + if(handle==0xffffffff) + { + // PT: object has been removed, tree data hasn't been updated accordingly + return true; + } + }*/ + const PoolIndex poolIndex = mOwner.mPool->getIndex(handle); + + const PxTransform* currentTransforms = mOwner.mPool->getTransforms(); + const PrunerPayload* currentPayloads = mOwner.mPool->getObjects(); + + if(mAbort || !mCallback.invoke(distance, poolIndex, currentPayloads, currentTransforms)) + { + mAbort = true; + return false; + } + return true; + } + + const CompanionPrunerAABBTree& mOwner; + PrunerRaycastCallback& mCallback; + const PxU32 mLastValidTimestamp; + bool mAbort; + PX_NOCOPY(RaycastAdapter) + }; + + struct OverlapAdapter + { + OverlapAdapter(const CompanionPrunerAABBTree& owner, PrunerOverlapCallback& cb, PxU32 lastValidTimestamp) : mOwner(owner), mCallback(cb), mLastValidTimestamp(lastValidTimestamp), mAbort(false) {} + + PX_FORCE_INLINE bool invoke(PxU32 index) + { + if(!mOwner.mLocalData[index].isValid(mLastValidTimestamp)) + return true; // PT: object has been removed, tree data hasn't been updated accordingly + + const PxU32 handle = mOwner.mLocalData[index].mHandle; + PX_ASSERT(handle!=0xffffffff); + const PoolIndex poolIndex = mOwner.mPool->getIndex(handle); + + const PxTransform* currentTransforms = mOwner.mPool->getTransforms(); + const PrunerPayload* currentPayloads = mOwner.mPool->getObjects(); + + if(mAbort || !mCallback.invoke(poolIndex, currentPayloads, currentTransforms)) + { + mAbort = true; + return false; + } + return true; + } + + const CompanionPrunerAABBTree& mOwner; + PrunerOverlapCallback& mCallback; + const PxU32 mLastValidTimestamp; + bool mAbort; + PX_NOCOPY(OverlapAdapter) + }; + +#ifdef USE_MAVERICK_NODE + struct MaverickRaycastAdapter + { + MaverickRaycastAdapter(const MaverickNode& owner, PrunerRaycastCallback& cb) : mOwner(owner), mCallback(cb), mAbort(false) {} + + PX_FORCE_INLINE bool invoke(PxReal& distance, PxU32 index) + { + if(mAbort || !mCallback.invoke(distance, index, mOwner.mFreeObjects, mOwner.mFreeTransforms)) + { + mAbort = true; + return false; + } + return true; + } + + const MaverickNode& mOwner; + PrunerRaycastCallback& mCallback; + bool mAbort; + PX_NOCOPY(MaverickRaycastAdapter) + }; + + struct MaverickOverlapAdapter + { + MaverickOverlapAdapter(const MaverickNode& owner, PrunerOverlapCallback& cb) : mOwner(owner), mCallback(cb), mAbort(false) {} + + PX_FORCE_INLINE bool invoke(PxU32 index) + { + if(mAbort || !mCallback.invoke(index, mOwner.mFreeObjects, mOwner.mFreeTransforms)) + { + mAbort = true; + return false; + } + return true; + } + + const MaverickNode& mOwner; + PrunerOverlapCallback& mCallback; + bool mAbort; + PX_NOCOPY(MaverickOverlapAdapter) + }; +#endif +} + +bool CompanionPrunerAABBTree::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const +{ + PX_UNUSED(origin); + PX_UNUSED(unitDir); + PX_UNUSED(inOutDistance); + PX_UNUSED(prunerCallback); + + PX_ASSERT(!mDirtyFlags); +// if(mDirtyFlags) +// const_cast(this)->build(); + +#ifdef USE_MAVERICK_NODE + { + MaverickRaycastAdapter ra(mMaverick, prunerCallback); + Gu::RayAABBTest test(origin*2.0f, unitDir*2.0f, inOutDistance, PxVec3(0.0f)); + if(!doLeafTest(&mMaverick, test, mMaverick.mFreeBounds, NULL, inOutDistance, ra)) + return false; + } +#endif + + if(mBVH) + { + RaycastAdapter ra(*this, prunerCallback, mLastValidTimestamp); + return AABBTreeRaycast()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), origin, unitDir, inOutDistance, PxVec3(0.0f), ra); + } + return true; +} + +// PT: TODO: this is copied from SqBounds.h, should be either moved to Gu and shared or passed as a user parameter + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) + +bool CompanionPrunerAABBTree::overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const +{ + PX_UNUSED(queryVolume); + PX_UNUSED(prunerCallback); + + PX_ASSERT(!mDirtyFlags); +// if(mDirtyFlags) +// const_cast(this)->build(); + +#ifdef USE_MAVERICK_NODE + { + MaverickOverlapAdapter ra(mMaverick, prunerCallback); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + if(!doOverlapLeafTest(test, &mMaverick, mMaverick.mFreeBounds, NULL, ra)) + return false; + } + else + { + const DefaultAABBAABBTest test(queryVolume); + if(!doOverlapLeafTest(test, &mMaverick, mMaverick.mFreeBounds, NULL, ra)) + return false; + } + } + break; + + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + if(!doOverlapLeafTest(test, &mMaverick, mMaverick.mFreeBounds, NULL, ra)) + return false; + } + break; + + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + if(!doOverlapLeafTest(test, &mMaverick, mMaverick.mFreeBounds, NULL, ra)) + return false; + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + if(!doOverlapLeafTest(test, &mMaverick, mMaverick.mFreeBounds, NULL, ra)) + return false; + } + break; + + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } +#endif + + if(mBVH) + { + OverlapAdapter ra(*this, prunerCallback, mLastValidTimestamp); + + switch(queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + return AABBTreeOverlap()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), test, ra); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + return AABBTreeOverlap()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), test, ra); + } + } + + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + //const DefaultCapsuleAABBTest test(queryVolume, 1.0f); + return AABBTreeOverlap()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), test, ra); + } + + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + return AABBTreeOverlap()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), test, ra); + } + + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + return AABBTreeOverlap()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), test, ra); + } + + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + } + return true; +} + +bool CompanionPrunerAABBTree::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const +{ + PX_UNUSED(queryVolume); + PX_UNUSED(unitDir); + PX_UNUSED(inOutDistance); + PX_UNUSED(prunerCallback); + + PX_ASSERT(!mDirtyFlags); +// if(mDirtyFlags) +// const_cast(this)->build(); + +#ifdef USE_MAVERICK_NODE + { + MaverickRaycastAdapter ra(mMaverick, prunerCallback); + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + Gu::RayAABBTest test(aabb.getCenter()*2.0f, unitDir*2.0f, inOutDistance, aabb.getExtents()); + if(!doLeafTest(&mMaverick, test, mMaverick.mFreeBounds, NULL, inOutDistance, ra)) + return false; + } +#endif + + if(mBVH) + { + RaycastAdapter ra(*this, prunerCallback, mLastValidTimestamp); + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + return AABBTreeRaycast()(mBVH->getData().mBounds, BVHTree(mBVH->getData()), aabb.getCenter(), unitDir, inOutDistance, aabb.getExtents(), ra); + } + return true; +} + + class PxBounds3Padded : public PxBounds3 + { + public: + PX_FORCE_INLINE PxBounds3Padded() {} + PX_FORCE_INLINE ~PxBounds3Padded() {} + PxU32 padding; + }; + +void CompanionPrunerAABBTree::getGlobalBounds(PxBounds3& bounds) const +{ + PxBounds3Padded tmp; + + if(mBVH) + { + tmp.minimum = mBVH->getNodes()->mBV.minimum; + tmp.maximum = mBVH->getNodes()->mBV.maximum; + } + else + tmp.setEmpty(); + + Vec4V minV = V4LoadU(&tmp.minimum.x); + Vec4V maxV = V4LoadU(&tmp.maximum.x); +#ifdef USE_MAVERICK_NODE + { + PxU32 nbFree = mMaverick.mNbFree; + if(nbFree) + { + const PxBounds3* freeBounds = mMaverick.mFreeBounds; + while(nbFree--) + { + minV = V4Min(minV, V4LoadU(&freeBounds->minimum.x)); + maxV = V4Max(maxV, V4LoadU(&freeBounds->maximum.x)); + freeBounds++; + } + } + } +#endif + StoreBounds(bounds, minV, maxV); +} + + + +CompanionPruner* physx::Gu::createCompanionPruner(PxU64 contextID, CompanionPrunerType type, const PruningPool* pool) +{ + if(0) +// return NULL; + return PX_NEW(CompanionPrunerAABBTree)(contextID, pool); + //return PX_NEW(CompanionPrunerBucket); +// return PX_NEW(CompanionPrunerIncremental)(pool); + + PX_UNUSED(contextID); + switch(type) + { + case COMPANION_PRUNER_NONE: return NULL; + case COMPANION_PRUNER_BUCKET: return PX_NEW(CompanionPrunerBucket); + case COMPANION_PRUNER_INCREMENTAL: return PX_NEW(CompanionPrunerIncremental)(pool); + case COMPANION_PRUNER_AABB_TREE: return PX_NEW(CompanionPrunerAABBTree)(contextID, pool); + } + return NULL; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.h new file mode 100644 index 0000000..0f801da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSecondaryPruner.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SECONDARY_PRUNER_H +#define GU_SECONDARY_PRUNER_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuPruner.h" + +namespace physx +{ + class PxRenderOutput; + +namespace Gu +{ + class PruningPool; + + class CompanionPruner : public PxUserAllocated + { + public: + CompanionPruner() {} + virtual ~CompanionPruner() {} + + virtual bool addObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PxU32 timeStamp, PoolIndex poolIndex) = 0; + virtual bool updateObject(const PrunerPayload& object, PrunerHandle handle, const PxBounds3& worldAABB, const PxTransform& transform, PoolIndex poolIndex) = 0; + virtual bool removeObject(const PrunerPayload& object, PrunerHandle handle, PxU32 objectIndex, PxU32 swapObjectIndex) = 0; + virtual void swapIndex(PxU32 objectIndex, PxU32 swapObjectIndex) = 0; + virtual PxU32 removeMarkedObjects(PxU32 timeStamp) = 0; + virtual void shiftOrigin(const PxVec3& shift) = 0; + virtual void timeStampChange() = 0; + virtual void build() = 0; + virtual PxU32 getNbObjects() const = 0; + virtual void release() = 0; + virtual void visualize(PxRenderOutput& out, PxU32 color) const = 0; + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const = 0; + virtual bool overlap(const ShapeData& queryVolume, PrunerOverlapCallback& prunerCallback) const = 0; + virtual bool sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, PrunerRaycastCallback& prunerCallback) const = 0; + virtual void getGlobalBounds(PxBounds3&) const = 0; + }; + + CompanionPruner* createCompanionPruner(PxU64 contextID, CompanionPrunerType type, const PruningPool* pool); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp new file mode 100644 index 0000000..3a7562b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSqInternal.cpp @@ -0,0 +1,101 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSqInternal.h" +#include "CmVisualization.h" +#include "GuAABBTree.h" +#include "GuAABBTreeNode.h" +#include "GuIncrementalAABBTree.h" +#include "GuBVH.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; + +static void drawBVH(const BVHNode* root, const BVHNode* node, PxRenderOutput& out_) +{ + renderOutputDebugBox(out_, node->mBV); + if(node->isLeaf()) + return; + drawBVH(root, node->getPos(root), out_); + drawBVH(root, node->getNeg(root), out_); +} + +void visualizeTree(PxRenderOutput& out, PxU32 color, const BVH* tree) +{ + if(tree && tree->getNodes()) + { + out << PxTransform(PxIdentity); + out << color; + drawBVH(tree->getNodes(), tree->getNodes(), out); + } +} + +void visualizeTree(PxRenderOutput& out, PxU32 color, const AABBTree* tree) +{ + if(tree && tree->getNodes()) + { + out << PxTransform(PxIdentity); + out << color; + drawBVH(tree->getNodes(), tree->getNodes(), out); + } +} + +void visualizeTree(PxRenderOutput& out, PxU32 color, const IncrementalAABBTree* tree, DebugVizCallback* cb) +{ + if(tree && tree->getNodes()) + { + struct Local + { + static void _draw(const IncrementalAABBTreeNode* root, const IncrementalAABBTreeNode* node, PxRenderOutput& out_, DebugVizCallback* cb) + { + PxBounds3 bounds; + V4StoreU(node->mBVMin, &bounds.minimum.x); + PX_ALIGN(16, PxVec4) max4; + V4StoreA(node->mBVMax, &max4.x); + bounds.maximum = PxVec3(max4.x, max4.y, max4.z); + + bool discard = false; + if(cb) + discard = cb->visualizeNode(*node, bounds); + + if(!discard) + Cm::renderOutputDebugBox(out_, bounds); + + if(node->isLeaf()) + return; + _draw(root, node->getPos(root), out_, cb); + _draw(root, node->getNeg(root), out_, cb); + } + }; + out << PxTransform(PxIdentity); + out << color; + Local::_draw(tree->getNodes(), tree->getNodes(), out, cb); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp new file mode 100644 index 0000000..96b5a94 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.cpp @@ -0,0 +1,1151 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxConvexMeshGeometry.h" +#include "GuHeightFieldUtil.h" +#include "GuEntityReport.h" +#include "GuConvexMesh.h" +#include "GuSweepSharedTests.h" +#include "GuConvexUtilsInternal.h" +#include "GuTriangleMesh.h" +#include "GuVecBox.h" +#include "GuVecTriangle.h" +#include "GuVecConvexHullNoScale.h" +#include "GuMidphaseInterface.h" +#include "GuPCMContactConvexCommon.h" +#include "GuSweepMTD.h" +#include "GuPCMShapeConvex.h" +#include "GuDistanceSegmentSegment.h" +#include "GuDistancePointSegment.h" +#include "GuInternal.h" +#include "GuConvexEdgeFlags.h" +#include "GuMTD.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace aos; + +#define BATCH_TRIANGLE_NUMBER 32u + +struct MTDTriangle : public PxTriangle +{ +public: + PxU8 extraTriData;//active edge flag data +}; + +struct MeshMTDGenerationCallback : MeshHitCallback +{ +public: + + PxArray& container; + + MeshMTDGenerationCallback(PxArray& tempContainer) + : MeshHitCallback(CallbackMode::eMULTIPLE), container(tempContainer) + { + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3&, const PxVec3&, const PxVec3&, PxReal&, const PxU32*) + { + container.pushBack(hit.faceIndex); + + return true; + } + + void operator=(const MeshMTDGenerationCallback&) {} +}; + +static bool getMTDPerTriangle(const MeshPersistentContact* manifoldContacts, const PxU32 numContacts, const PxU32 triangleIndex, Vec3V& normal, Vec3V& closestA, Vec3V& closestB, PxU32& faceIndex, FloatV& deepestPen) +{ + FloatV deepest = V4GetW(manifoldContacts[0].mLocalNormalPen); + PxU32 index = 0; + for(PxU32 k=1; k& tempContainer) +{ + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + Box vertexSpaceBox; + computeVertexSpaceOBB(vertexSpaceBox, bound, pose, meshGeom.scale); + + MeshMTDGenerationCallback callback(tempContainer); + Midphase::intersectOBB(meshData, vertexSpaceBox, callback, true); +} + +// PT: TODO: refactor with EntityReportContainerCallback +struct MidPhaseQueryLocalReport : OverlapReport +{ + MidPhaseQueryLocalReport(PxArray& _container) : container(_container) + { + + } + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + for(PxU32 i=0; i& container; + +private: + MidPhaseQueryLocalReport operator=(MidPhaseQueryLocalReport& report); +}; + +static void midPhaseQuery(const HeightFieldUtil& hfUtil, const PxTransform& pose, const PxBounds3& bounds, PxArray& tempContainer) +{ + MidPhaseQueryLocalReport localReport(tempContainer); + hfUtil.overlapAABBTriangles(pose, bounds, localReport); +} + +static bool calculateMTD( const CapsuleV& capsuleV, const FloatVArg inflatedRadiusV, const bool isDoubleSide, const MTDTriangle* triangles, const PxU32 nbTriangles, const PxU32 startIndex, MeshPersistentContact* manifoldContacts, + PxU32& numContacts, Vec3V& normal, Vec3V& closestA, Vec3V& closestB, PxU32& faceIndex, FloatV& mtd) +{ + const FloatV zero = FZero(); + bool hadContacts = false; + FloatV deepestPen = mtd; + + for(PxU32 j=0; j(triMeshGeom.triangleMesh); + const PxU8* extraTrigData = triMesh->getExtraTrigData(); + const bool flipsNormal = triMeshGeom.scale.hasNegativeDeterminant(); + + //inflated the capsule by 15% in case of some disagreement between sweep and mtd calculation. If sweep said initial overlap, but mtd has a positive separation, + //we are still be able to return a valid normal but we should zero the distance. + const FloatV inflatedRadiusV = FLoad(inflatedRadius*1.15f); + + const PxMat34 vertexToWorldSkew = pose * triMeshGeom.scale; + + const Vec3V zeroV = V3Zero(); + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 4; + + ///// + + for(PxU32 i=0; icomputeWorldTriangle(triangles[k], currentTriangleIndex, vertexToWorldSkew, flipsNormal); + triangles[k].extraTriData = getConvexEdgeFlags(extraTrigData, currentTriangleIndex); + } + + //ML: mtd has back face culling, so if the capsule's center is below the triangle, we won't generate any contacts + hadContacts = calculateMTD(capsuleV, inflatedRadiusV, isDoubleSided, triangles, nbTrigs, startIndex, manifoldContacts, numContacts, normal, closestA, closestB, triangleIndex, mtd) || hadContacts; + } + + if(!hadContacts) + break; + + triangleIndex = tempContainer[triangleIndex]; + foundInitial = true; + } + + //move the capsule to depenetrate it + + const FloatV distV = FSub(mtd, capsuleV.radius); + if(FAllGrtr(FZero(), distV)) + { + Vec3V center = capsuleV.getCenter(); + const Vec3V t = V3Scale(normal, distV); + translation = V3Sub(translation, t); + center = V3Sub(center, t); + capsuleV.setCenter(center); + } + else + { + if(i == 0) + { + //First iteration so keep this normal + hit.distance = 0.0f; + V3StoreU(closestA, hit.position); + V3StoreU(normal, hit.normal); + hit.faceIndex = triangleIndex; + return true; + } + break; + } + } + + return finalizeMTD(hit, translation, closestA, triangleIndex, foundInitial); +} + + +bool physx::Gu::computeCapsule_HeightFieldMTD(const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, CapsuleV& capsuleV, PxReal inflatedRadius, bool isDoubleSided, PxGeomSweepHit& hit) +{ + //inflated the capsule by 1% in case of some disagreement between sweep and mtd calculation.If sweep said initial overlap, but mtd has a positive separation, + //we are still be able to return a valid normal but we should zero the distance. + const FloatV inflatedRadiusV = FLoad(inflatedRadius*1.01f); + + const HeightFieldUtil hfUtil(heightFieldGeom); + + const Vec3V zeroV = V3Zero(); + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 4; + + ///// + + for(PxU32 i=0; i(triMeshGeom.triangleMesh); + const PxU8* extraTrigData = triMesh->getExtraTrigData(); + const bool flipsNormal = triMeshGeom.scale.hasNegativeDeterminant(); + + const Vec3V zeroV = V3Zero(); + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + Vec3V worldNormal = zeroV, worldContactA = zeroV;//, worldContactB = zeroV; + + Box box = _box; + + const QuatV q0 = QuatVLoadU(&boxTransform.q.x); + const Vec3V p0 = V3LoadU(&boxTransform.p.x); + + const Vec3V boxExtents = V3LoadU(box.extents); + const FloatV minMargin = CalculateMTDBoxMargin(boxExtents); + const FloatV inflationV = FAdd(FLoad(inflation), minMargin); + PxReal boundInflation; + FStore(inflationV, &boundInflation); + + box.extents += PxVec3(boundInflation); + const BoxV boxV(zeroV, boxExtents); + + Vec3V boxCenter = V3LoadU(box.center); + + //create the polyData based on the original data + PolygonalData polyData; + const PCMPolygonalBox polyBox(_box.extents); + polyBox.getPolygonalData(&polyData); + + const Mat33V identity = M33Identity(); + + const PxMat34 meshToWorldSkew = pose * triMeshGeom.scale; + + PxTransformV boxTransformV(p0, q0);//box + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 4; + + ///// + + for(PxU32 i=0; i boxMap(boxV, boxTransformV, identity, identity, true); + + boxMap.setShapeSpaceCenterofMass(zeroV); + // Move to AABB space + PxMat34 WorldToBox; + computeWorldToBoxMatrix(WorldToBox, box); + const PxMat34 meshToBox = WorldToBox*meshToWorldSkew; + + const Mat33V rot(V3LoadU(meshToBox.m.column0), V3LoadU(meshToBox.m.column1), V3LoadU(meshToBox.m.column2)); + const PxMatTransformV meshToConvex(V3LoadU(meshToBox.p), rot); + + FloatV mtd; + { + bool hadContacts = false; + + const PxU32 nbBatches = (nbTriangles + BATCH_TRIANGLE_NUMBER - 1)/BATCH_TRIANGLE_NUMBER; + mtd = FMax(); + MTDTriangle triangles[BATCH_TRIANGLE_NUMBER]; + for(PxU32 a = 0; a < nbBatches; ++a) + { + const PxU32 startIndex = a * BATCH_TRIANGLE_NUMBER; + const PxU32 nbTrigs = PxMin(nbTriangles - startIndex, BATCH_TRIANGLE_NUMBER); + for(PxU32 k=0; kgetLocalTriangle(triangles[k], currentTriangleIndex, flipsNormal); + triangles[k].extraTriData = getConvexEdgeFlags(extraTrigData, currentTriangleIndex); + } + + //ML: mtd has back face culling, so if the capsule's center is below the triangle, we won't generate any contacts + hadContacts = calculateMTD(polyData, &boxMap, boxTransformV, meshToConvex, isDoubleSided, inflationV, triangles, nbTrigs, startIndex, manifoldContacts, numContacts, normal, closestA, closestB, triangleIndex, mtd) || hadContacts; + } + + if(!hadContacts) + break; + + triangleIndex = tempContainer[triangleIndex]; + foundInitial = true; + } + + const FloatV distV = mtd; + worldNormal = boxTransformV.rotate(normal); + worldContactA = boxTransformV.transform(closestA); + if(FAllGrtr(FZero(), distV)) + { + const Vec3V t = V3Scale(worldNormal, mtd); + translation = V3Sub(translation, t); + boxCenter = V3Sub(boxCenter, t); + V3StoreU(boxCenter, box.center); + } + else + { + if(i == 0) + { + //First iteration so keep this normal + hit.distance = 0.0f; + V3StoreU(worldContactA, hit.position); + V3StoreU(worldNormal, hit.normal); + hit.faceIndex = triangleIndex; + return true; + } + break; + } + } + + return finalizeMTD(hit, translation, worldContactA, triangleIndex, foundInitial); +} + +bool physx::Gu::computeBox_HeightFieldMTD(const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, const Box& _box, const PxTransform& boxTransform, PxReal inflation, bool isDoubleSided, PxGeomSweepHit& hit) +{ + const HeightFieldUtil hfUtil(heightFieldGeom); + + const Vec3V zeroV = V3Zero(); + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + Vec3V worldNormal = zeroV, worldContactA = zeroV;//, worldContactB = zeroV; + + Box box = _box; + + const QuatV q0 = QuatVLoadU(&boxTransform.q.x); + const Vec3V p0 = V3LoadU(&boxTransform.p.x); + + const Vec3V boxExtents = V3LoadU(box.extents); + const FloatV minMargin = CalculateMTDBoxMargin(boxExtents); + const FloatV inflationV = FAdd(FLoad(inflation), minMargin); + //const FloatV inflationV = FLoad(inflation); + + PxReal boundInflation; + FStore(inflationV, &boundInflation); + box.extents += PxVec3(boundInflation); + + const BoxV boxV(zeroV, boxExtents); + + Vec3V boxCenter = V3LoadU(box.center); + + //create the polyData based on the original box + PolygonalData polyData; + const PCMPolygonalBox polyBox(_box.extents); + polyBox.getPolygonalData(&polyData); + + const Mat33V identity = M33Identity(); + + const Matrix34FromTransform meshToWorldSkew(pose); + + PxTransformV boxTransformV(p0, q0);//box + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 4; + + ///// + + for(PxU32 i=0; i boxMap(boxV, boxTransformV, identity, identity, true); + boxMap.setShapeSpaceCenterofMass(zeroV); + // Move to AABB space + PxMat34 WorldToBox; + computeWorldToBoxMatrix(WorldToBox, box); + const PxMat34 meshToBox = WorldToBox*meshToWorldSkew; + + const Mat33V rot(V3LoadU(meshToBox.m.column0), V3LoadU(meshToBox.m.column1), V3LoadU(meshToBox.m.column2)); + const PxMatTransformV meshToConvex(V3LoadU(meshToBox.p), rot); + + FloatV mtd; + { + bool hadContacts = false; + + const PxU32 nbBatches = (nbTriangles + BATCH_TRIANGLE_NUMBER - 1)/BATCH_TRIANGLE_NUMBER; + mtd = FMax(); + MTDTriangle triangles[BATCH_TRIANGLE_NUMBER]; + for(PxU32 a = 0; a < nbBatches; ++a) + { + const PxU32 startIndex = a * BATCH_TRIANGLE_NUMBER; + const PxU32 nbTrigs = PxMin(nbTriangles - startIndex, BATCH_TRIANGLE_NUMBER); + for(PxU32 k=0; k(triMeshGeom.triangleMesh); + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + const PxU8* extraTrigData = triMesh->getExtraTrigData(); + const bool flipsNormal = triMeshGeom.scale.hasNegativeDeterminant(); + + ConvexHullData* hullData = &cm->getHull(); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + + FastVertex2ShapeScaling convexScaling; + if(!idtScaleConvex) + convexScaling.init(convexGeom.scale); + + const PxVec3 _shapeSpaceCenterOfMass = convexScaling * hullData->mCenterOfMass; + const Vec3V shapeSpaceCenterOfMass = V3LoadU(_shapeSpaceCenterOfMass); + + const QuatV q0 = QuatVLoadU(&convexPose.q.x); + const Vec3V p0 = V3LoadU(&convexPose.p.x); + PxTransformV convexTransformV(p0, q0); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + const ConvexHullV convexHull(hullData, V3Zero(), vScale, vQuat, idtScaleConvex); + PX_ALIGN(16, PxU8 convexBuff[sizeof(SupportLocalImpl)]); + + const FloatV convexMargin = CalculateMTDConvexMargin(hullData, vScale); + const FloatV inflationV = FAdd(FLoad(inflation), convexMargin); + PxReal boundInflation; + FStore(inflationV, &boundInflation); + + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + + const PxMat34 meshToWorldSkew = pose * triMeshGeom.scale; + + PolygonalData polyData; + getPCMConvexData(convexHull, idtScaleConvex, polyData); + + Vec3V center = p0; + PxTransform tempConvexPose = convexPose; + Vec3V worldNormal = zeroV, worldContactA = zeroV;//, worldContactB = zeroV; + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 2; // PT: TODO: why 2 here instead of 4? + + ///// + + for(PxU32 i=0; i(PX_PLACEMENT_NEW(convexBuff, SupportLocalImpl)(static_cast(convexHull), convexTransformV, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex)) : + static_cast(PX_PLACEMENT_NEW(convexBuff, SupportLocalImpl)(convexHull, convexTransformV, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex)); + + convexMap->setShapeSpaceCenterofMass(shapeSpaceCenterOfMass); + + Box hullOBB; + computeOBBAroundConvex(hullOBB, convexGeom, cm, tempConvexPose); + + hullOBB.extents += PxVec3(boundInflation); + + midPhaseQuery(triMeshGeom, pose, hullOBB, tempContainer); + } + + // Get results + const PxU32 nbTriangles = tempContainer.size(); + if(!nbTriangles) + break; + + // Move to AABB space + const Matrix34FromTransform worldToConvex(tempConvexPose.getInverse()); + const PxMat34 meshToConvex = worldToConvex*meshToWorldSkew; + + const Mat33V rot(V3LoadU(meshToConvex.m.column0), V3LoadU(meshToConvex.m.column1), V3LoadU(meshToConvex.m.column2)); + const PxMatTransformV meshToConvexV(V3LoadU(meshToConvex.p), rot); + + FloatV mtd; + { + bool hadContacts = false; + + const PxU32 nbBatches = (nbTriangles + BATCH_TRIANGLE_NUMBER - 1)/BATCH_TRIANGLE_NUMBER; + mtd = FMax(); + MTDTriangle triangles[BATCH_TRIANGLE_NUMBER]; + for(PxU32 a = 0; a < nbBatches; ++a) + { + const PxU32 startIndex = a * BATCH_TRIANGLE_NUMBER; + const PxU32 nbTrigs = PxMin(nbTriangles - startIndex, BATCH_TRIANGLE_NUMBER); + for(PxU32 k=0; kgetLocalTriangle(triangles[k], currentTriangleIndex, flipsNormal); + triangles[k].extraTriData = getConvexEdgeFlags(extraTrigData, currentTriangleIndex); + } + + //ML: mtd has back face culling, so if the capsule's center is below the triangle, we won't generate any contacts + hadContacts = calculateMTD(polyData, convexMap, convexTransformV, meshToConvexV, isDoubleSided, inflationV, triangles, nbTrigs, startIndex, manifoldContacts, numContacts, normal, closestA, closestB, triangleIndex, mtd) || hadContacts; + } + + if(!hadContacts) + break; + + triangleIndex = tempContainer[triangleIndex]; + foundInitial = true; + } + + const FloatV distV = mtd; + worldNormal = convexTransformV.rotate(normal); + worldContactA = convexTransformV.transform(closestA); + if(FAllGrtr(FZero(), distV)) + { + const Vec3V t = V3Scale(worldNormal, mtd); + translation = V3Sub(translation, t); + center = V3Sub(center, t); + } + else + { + if(i == 0) + { + //First iteration so keep this normal + hit.distance = 0.0f; + V3StoreU(worldContactA, hit.position); + V3StoreU(worldNormal, hit.normal); + hit.faceIndex = triangleIndex; + return true; + } + break; + } + } + + return finalizeMTD(hit, translation, worldContactA, triangleIndex, foundInitial); +} + +bool physx::Gu::computeConvex_HeightFieldMTD(const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, PxReal inflation, bool isDoubleSided, PxGeomSweepHit& hit) +{ + const HeightFieldUtil hfUtil(heightFieldGeom); + + const Vec3V zeroV = V3Zero(); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + ConvexHullData* hullData = &cm->getHull(); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + + FastVertex2ShapeScaling convexScaling; + if(!idtScaleConvex) + convexScaling.init(convexGeom.scale); + + const PxVec3 _shapeSpaceCenterOfMass = convexScaling * hullData->mCenterOfMass; + const Vec3V shapeSpaceCenterOfMass = V3LoadU(_shapeSpaceCenterOfMass); + + const QuatV q0 = QuatVLoadU(&convexPose.q.x); + const Vec3V p0 = V3LoadU(&convexPose.p.x); + PxTransformV convexTransformV(p0, q0); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, idtScaleConvex); + PX_ALIGN(16, PxU8 convexBuff[sizeof(SupportLocalImpl)]); + + const FloatV convexMargin = CalculateMTDConvexMargin(hullData, vScale); + const FloatV inflationV = FAdd(FLoad(inflation), convexMargin); + PxReal boundInflation; + FStore(inflationV, &boundInflation); + + Vec3V closestA = zeroV, closestB = zeroV, normal = zeroV; + Vec3V worldNormal = zeroV, worldContactA = zeroV;//, worldContactB = zeroV; + + PolygonalData polyData; + getPCMConvexData(convexHull, idtScaleConvex, polyData); + + Vec3V center = p0; + PxTransform tempConvexPose = convexPose; + const Matrix34FromTransform meshToWorldSkew(pose); + + ///// + + MeshPersistentContact manifoldContacts[64]; + PxU32 numContacts = 0; + + PxArray tempContainer; + tempContainer.reserve(128); + + PxU32 triangleIndex = 0xfffffff; + Vec3V translation = zeroV; + bool foundInitial = false; + const PxU32 iterations = 2; // PT: TODO: why 2 here instead of 4? + + ///// + + for(PxU32 i=0; i(PX_PLACEMENT_NEW(convexBuff, SupportLocalImpl)(static_cast(convexHull), convexTransformV, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex)) : + static_cast(PX_PLACEMENT_NEW(convexBuff, SupportLocalImpl)(convexHull, convexTransformV, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex)); + + convexMap->setShapeSpaceCenterofMass(shapeSpaceCenterOfMass); + + Box hullOBB; + computeOBBAroundConvex(hullOBB, convexGeom, cm, tempConvexPose); + + hullOBB.extents += PxVec3(boundInflation); + + const PxBounds3 bounds = PxBounds3::basisExtent(hullOBB.center, hullOBB.rot, hullOBB.extents); + + midPhaseQuery(hfUtil, pose, bounds, tempContainer); + } + + // Get results + const PxU32 nbTriangles = tempContainer.size(); + if(!nbTriangles) + break; + + // Move to AABB space + const Matrix34FromTransform worldToConvex(tempConvexPose.getInverse()); + const PxMat34 meshToConvex = worldToConvex*meshToWorldSkew; + + const Mat33V rot(V3LoadU(meshToConvex.m.column0), V3LoadU(meshToConvex.m.column1), V3LoadU(meshToConvex.m.column2)); + const PxMatTransformV meshToConvexV(V3LoadU(meshToConvex.p), rot); + + FloatV mtd; + { + bool hadContacts = false; + + const PxU32 nbBatches = (nbTriangles + BATCH_TRIANGLE_NUMBER - 1)/BATCH_TRIANGLE_NUMBER; + mtd = FMax(); + MTDTriangle triangles[BATCH_TRIANGLE_NUMBER]; + for(PxU32 a = 0; a < nbBatches; ++a) + { + const PxU32 startIndex = a * BATCH_TRIANGLE_NUMBER; + const PxU32 nbTrigs = PxMin(nbTriangles - startIndex, BATCH_TRIANGLE_NUMBER); + for(PxU32 k=0; k d) + { + index = i; + dmin = d; + } + } + hit.normal = plane.n; + hit.distance = dmin; + hit.position = pts[index] - plane.n*dmin; + return true; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +bool physx::Gu::computePlane_ConvexMTD(const PxPlane& plane, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, PxGeomSweepHit& hit) +{ + const ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + const FastVertex2ShapeScaling convexScaling(convexGeom.scale); + PxU32 nbVerts = convexMesh->getNbVerts(); + const PxVec3* PX_RESTRICT verts = convexMesh->getVerts(); + + PxVec3 worldPointMin = convexPose.transform(convexScaling * verts[0]); + PxReal dmin = plane.distance(worldPointMin); + for(PxU32 i=1;i d) + { + dmin = d; + worldPointMin = worldPoint; + } + } + + hit.normal = plane.n; + hit.distance = dmin; + hit.position = worldPointMin - plane.n * dmin; + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.h new file mode 100644 index 0000000..d9e8991 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepMTD.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_MTD_H +#define GU_SWEEP_MTD_H + +namespace physx +{ + class PxConvexMeshGeometry; + class PxTriangleMeshGeometry; + class PxGeometry; + class PxHeightFieldGeometry; + +namespace Gu +{ + class Sphere; + class Capsule; + + bool computeCapsule_TriangleMeshMTD(const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, Gu::CapsuleV& capsuleV, PxReal inflatedRadius, bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeCapsule_HeightFieldMTD(const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, Gu::CapsuleV& capsuleV, PxReal inflatedRadius, bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeBox_TriangleMeshMTD(const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, const Gu::Box& box, const PxTransform& boxTransform, PxReal inflation, + bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeBox_HeightFieldMTD( const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, const Gu::Box& box, const PxTransform& boxTransform, PxReal inflation, bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeConvex_TriangleMeshMTD( const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexTransform, PxReal inflation, + bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeConvex_HeightFieldMTD( const PxHeightFieldGeometry& heightFieldGeom, const PxTransform& pose, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexTransform, PxReal inflation, bool isDoubleSided, PxGeomSweepHit& hit); + + bool computeSphere_SphereMTD(const Sphere& sphere0, const Sphere& sphere1, PxGeomSweepHit& hit); + bool computeSphere_CapsuleMTD(const Sphere& sphere, const Capsule& capsule, PxGeomSweepHit& hit); + + bool computeCapsule_CapsuleMTD(const Capsule& capsule0, const Capsule& capsule1, PxGeomSweepHit& hit); + + bool computePlane_CapsuleMTD(const PxPlane& plane, const Capsule& capsule, PxGeomSweepHit& hit); + bool computePlane_BoxMTD(const PxPlane& plane, const Box& box, PxGeomSweepHit& hit); + bool computePlane_ConvexMTD(const PxPlane& plane, const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, PxGeomSweepHit& hit); + + // PT: wrapper just to avoid duplicating these lines. + PX_FORCE_INLINE void setupSweepHitForMTD(PxGeomSweepHit& sweepHit, bool hasContacts, const PxVec3& unitDir) + { + sweepHit.flags = PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + if(!hasContacts) + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + else + { + //ML: touching contact. We need to overwrite the normal to the negative of sweep direction + if(sweepHit.distance == 0.0f && sweepHit.normal.isZero()) + sweepHit.normal = -unitDir; + + sweepHit.flags |= PxHitFlag::ePOSITION; + } + } +} + +} + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp new file mode 100644 index 0000000..b4dd221 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.cpp @@ -0,0 +1,758 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "GuSweepTests.h" +#include "GuHeightFieldUtil.h" +#include "CmScaling.h" +#include "GuConvexMesh.h" +#include "GuIntersectionRayPlane.h" +#include "GuVecBox.h" +#include "GuVecCapsule.h" +#include "GuVecConvexHull.h" +#include "GuSweepMTD.h" +#include "GuSweepSphereCapsule.h" +#include "GuSweepCapsuleCapsule.h" +#include "GuSweepTriangleUtils.h" +#include "GuSweepCapsuleTriangle.h" +#include "GuInternal.h" +#include "GuGJKRaycast.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +static const PxReal gEpsilon = .01f; + +//#define USE_VIRTUAL_GJK +#ifdef USE_VIRTUAL_GJK +static bool virtualGjkRaycastPenetration(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, + aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation, const bool initialOverlap) +{ + return gjkRaycastPenetration(a, b, initialDir, initialLambda, s, r, lambda, normal, closestA, _inflation, initialOverlap); +} +#endif + +static PxU32 computeSweepConvexPlane( + const PxConvexMeshGeometry& convexGeom, ConvexHullData* hullData, const PxU32& nbPolys, const PxTransform& pose, + const PxVec3& impact_, const PxVec3& unitDir) +{ + PX_ASSERT(nbPolys); + + const PxVec3 impact = impact_ - unitDir * gEpsilon; + + const PxVec3 localPoint = pose.transformInv(impact); + const PxVec3 localDir = pose.rotateInv(unitDir); + + const FastVertex2ShapeScaling scaling(convexGeom.scale); + + PxU32 minIndex = 0; + PxReal minD = PX_MAX_REAL; + for(PxU32 j=0; jmPolygons[j].mPlane; + + PxPlane plane; + scaling.transformPlaneToShapeSpace(pl.n, pl.d, plane.n, plane.d); + + PxReal d = plane.distance(localPoint); + if(d<0.0f) + continue; + + const PxReal tweak = plane.n.dot(localDir) * gEpsilon; + d += tweak; + + if(dmNbPolygons, pose, sweepHit.position, unitDir); + sweepHit.flags |= PxHitFlag::eFACE_INDEX; + } + return true; +} + +static PX_FORCE_INLINE bool hasInitialOverlap(PxGeomSweepHit& sweepHit, const PxVec3& unitDir, + const FloatVArg toi, + const Vec3VArg normal, const Vec3VArg closestA, + const PxTransformV& convexPose, + const bool isMtd, const bool impactPointOnTheOtherShape) +{ + sweepHit.flags = PxHitFlag::eNORMAL; + + const FloatV zero = FZero(); + if(FAllGrtrOrEq(zero, toi)) + { + //ML: initial overlap + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const FloatV length = toi; + const Vec3V worldPointA = convexPose.transform(closestA); + const Vec3V worldNormal = V3Normalize(convexPose.rotate(normal)); + if(impactPointOnTheOtherShape) + { + const Vec3V destWorldPointA = V3NegScaleSub(worldNormal, length, worldPointA); + V3StoreU(worldNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + } + else + { + const Vec3V destNormal = V3Neg(worldNormal); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(worldPointA, sweepHit.position); + } + FStore(length, &sweepHit.distance); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + sweepHit.faceIndex = 0xffffffff; + return true; + } + return false; +} + +///////////////////////////////////////////////// sweepCapsule/Sphere ////////////////////////////////////////////////////// +bool sweepCapsule_SphereGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + + PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE); + const PxSphereGeometry& sphereGeom = static_cast(geom); + + const Sphere sphere(pose.p, sphereGeom.radius+inflation); + + if(!sweepSphereCapsule(sphere, lss, -unitDir, distance, sweepHit.distance, sweepHit.position, sweepHit.normal, hitFlags)) + return false; + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + + if(isMtd) + { + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + + if(sweepHit.distance == 0.f) + { + //intialOverlap + if(lss.p0 == lss.p1) + { + //sphere + return computeSphere_SphereMTD(sphere, Sphere(lss.p0, lss.radius), sweepHit); + } + else + { + //capsule + return computeSphere_CapsuleMTD(sphere, lss, sweepHit); + } + } + } + else + { + if(sweepHit.distance!=0.0f) + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + else + sweepHit.flags = PxHitFlag::eNORMAL; + } + return true; +} + +bool sweepCapsule_PlaneGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + + PX_ASSERT(geom.getType() == PxGeometryType::ePLANE); + PX_UNUSED(geom); +// const PxPlaneGeometry& planeGeom = static_cast(geom); + + const PxPlane& worldPlane = getPlane(pose); + + const PxF32 capsuleRadius = lss.radius + inflation; + + PxU32 index = 0; + PxVec3 pts[2]; + + PxReal minDp = PX_MAX_REAL; + + sweepHit.faceIndex = 0xFFFFffff; // spec says face index is undefined for planes + + // Find extreme point on the capsule + // AP: removed if (lss.p0 == lss.p1 clause because it wasn't properly computing minDp) + pts[0] = lss.p0; + pts[1] = lss.p1; + for(PxU32 i=0; i<2; i++) + { + const PxReal dp = pts[i].dot(worldPlane.n); + if(dp 0 && sweepHit.distance <= distance) + { + sweepHit.normal = worldPlane.n; + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + return true; + } + return false; +} + +bool sweepCapsule_CapsuleGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + + PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE); + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + Capsule staticCapsule; + getCapsule(staticCapsule, capsuleGeom, pose); + staticCapsule.radius +=inflation; + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + + PxU16 outFlags; + if(!sweepCapsuleCapsule(lss, staticCapsule, -unitDir, distance, sweepHit.distance, sweepHit.position, sweepHit.normal, hitFlags, outFlags)) + return false; + + sweepHit.flags = PxHitFlags(outFlags); + if(sweepHit.distance == 0.0f) + { + //initial overlap + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + return computeCapsule_CapsuleMTD(lss, staticCapsule, sweepHit); + } + } + return true; +} + +bool sweepCapsule_ConvexGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_ASSERT(geom.getType() == PxGeometryType::eCONVEXMESH); + + using namespace aos; + + PX_ASSERT(geom.getType() == PxGeometryType::eCONVEXMESH); + const PxConvexMeshGeometry& convexGeom = static_cast(geom); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + ConvexHullData* hullData = &convexMesh->getHull(); + + const Vec3V zeroV = V3Zero(); + const FloatV zero = FZero(); + const FloatV dist = FLoad(distance); + const Vec3V worldDir = V3LoadU(unitDir); + + const PxTransformV capPose = loadTransformU(capsulePose_); + const PxTransformV convexPose = loadTransformU(pose); + + const PxMatTransformV aToB(convexPose.transformInv(capPose)); + + const FloatV capsuleHalfHeight = FLoad(capsuleGeom_.halfHeight); + const FloatV capsuleRadius = FLoad(lss.radius); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + + const CapsuleV capsule(aToB.p, aToB.rotate( V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + + const Vec3V dir = convexPose.rotateInv(V3Neg(V3Scale(worldDir, dist))); + + bool isMtd = hitFlags & PxHitFlag::eMTD; + + FloatV toi; + Vec3V closestA, normal;//closestA and normal is in the local space of convex hull + const LocalConvex convexA(capsule); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, lss.radius + inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, lss.radius + inflation, isMtd)) + return false; +#endif + if(hasInitialOverlap(sweepHit, unitDir, toi, normal, closestA, convexPose, isMtd, true)) + return true; + + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V worldPointA = convexPose.transform(closestA); + const FloatV length = FMul(dist, toi); + const Vec3V destNormal = V3Normalize(convexPose.rotate(normal)); + const Vec3V destWorldPointA = V3ScaleAdd(worldDir, length, worldPointA); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + + return computeFaceIndex(sweepHit, hitFlags, convexGeom, hullData, pose, unitDir); +} + +///////////////////////////////////////////////// sweepBox ////////////////////////////////////////////////////// + +bool sweepBox_PlaneGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::ePLANE); + PX_UNUSED(threadContext); + PX_UNUSED(geom); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + +// const PxPlaneGeometry& planeGeom = static_cast(geom); + + sweepHit.faceIndex = 0xFFFFffff; // spec says face index is undefined for planes + + PxPlane worldPlane = getPlane(pose); + worldPlane.d -=inflation; + + // Find extreme point on the box + PxVec3 boxPts[8]; + box.computeBoxPoints(boxPts); + PxU32 index = 0; + PxReal minDp = PX_MAX_REAL; + for(PxU32 i=0;i<8;i++) + { + const PxReal dp = boxPts[i].dot(worldPlane.n); + + if(dp 0 && sweepHit.distance <= distance) + { + sweepHit.normal = worldPlane.n; + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + return true; + } + return false; +} + +bool sweepBox_ConvexGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(boxGeom_); + + using namespace aos; + PX_ASSERT(geom.getType() == PxGeometryType::eCONVEXMESH); + const PxConvexMeshGeometry& convexGeom = static_cast(geom); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + ConvexHullData* hullData = &convexMesh->getHull(); + + const Vec3V zeroV = V3Zero(); + const FloatV zero = FZero(); + + const PxTransformV boxPose = loadTransformU(boxPose_); + const PxTransformV convexPose = loadTransformU(pose); + + const PxMatTransformV aToB(convexPose.transformInv(boxPose)); + + const Vec3V boxExtents = V3LoadU(box.extents); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + + const BoxV boxV(zeroV, boxExtents); + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + + const Vec3V worldDir = V3LoadU(unitDir); + const FloatV dist = FLoad(distance); + const Vec3V dir = convexPose.rotateInv(V3Neg(V3Scale(worldDir, dist))); + + bool isMtd = hitFlags & PxHitFlag::eMTD; + + FloatV toi; + Vec3V closestA, normal; + const RelativeConvex convexA(boxV, aToB); + const LocalConvex convexB(convexHull); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration,LocalConvex >(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#endif + if(hasInitialOverlap(sweepHit, unitDir, toi, normal, closestA, convexPose, isMtd, true)) + return true; + + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destNormal = V3Normalize(convexPose.rotate(normal)); + const FloatV length = FMul(dist, toi); + const Vec3V worldPointA = convexPose.transform(closestA); + const Vec3V destWorldPointA = V3ScaleAdd(worldDir, length, worldPointA); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + + return computeFaceIndex(sweepHit, hitFlags, convexGeom, hullData, pose, unitDir); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool Gu::sweepCapsuleTriangles(GU_SWEEP_TRIANGLES_FUNC_PARAMS(PxCapsuleGeometry)) +{ + Capsule capsule; + getCapsule(capsule, geom, pose); + capsule.radius +=inflation; + + // Compute swept box + Box capsuleBox; + computeBoxAroundCapsule(capsule, capsuleBox); + + BoxPadded sweptBounds; + computeSweptBox(sweptBounds, capsuleBox.extents, capsuleBox.center, capsuleBox.rot, unitDir, distance); + + PxVec3 triNormal; + return sweepCapsuleTriangles_Precise(nbTris, triangles, capsule, unitDir, distance, cachedIndex, hit, triNormal, hitFlags, doubleSided, &sweptBounds); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool sweepConvex_SphereGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE); + const PxSphereGeometry& sphereGeom = static_cast(geom); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + ConvexHullData* hullData = &convexMesh->getHull(); + + const Vec3V zeroV = V3Zero(); + const FloatV zero= FZero(); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + + const FloatV sphereRadius = FLoad(sphereGeom.radius); + + const PxTransformV sphereTransf = loadTransformU(pose); + const PxTransformV convexTransf = loadTransformU(convexPose); + + const PxMatTransformV aToB(convexTransf.transformInv(sphereTransf)); + + const Vec3V worldDir = V3LoadU(unitDir); + const FloatV dist = FLoad(distance); + const Vec3V dir = convexTransf.rotateInv(V3Scale(worldDir, dist)); + + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + //CapsuleV capsule(zeroV, sphereRadius); + const CapsuleV capsule(aToB.p, sphereRadius); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + + FloatV toi; + Vec3V closestA, normal; + const LocalConvex convexA(capsule); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, sphereGeom.radius+inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, sphereGeom.radius+inflation, isMtd)) + return false; +#endif + if(hasInitialOverlap(sweepHit, unitDir, toi, normal, closestA, convexPose, isMtd, false)) + return true; + + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destNormal = V3Neg(V3Normalize(convexTransf.rotate(normal))); + const FloatV length = FMul(dist, toi); + const Vec3V destWorldPointA = convexTransf.transform(closestA); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + sweepHit.faceIndex = 0xffffffff; + return true; +} + +bool sweepConvex_PlaneGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::ePLANE); + PX_UNUSED(hitFlags); + PX_UNUSED(geom); + PX_UNUSED(threadContext); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + ConvexHullData* hullData = &convexMesh->getHull(); + + sweepHit.faceIndex = 0xFFFFffff; // spec says face index is undefined for planes + + const PxVec3* PX_RESTRICT hullVertices = hullData->getHullVertices(); + PxU32 numHullVertices = hullData->mNbHullVertices; + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + + const FastVertex2ShapeScaling convexScaling(convexGeom.scale); + + PxPlane plane = getPlane(pose); + plane.d -=inflation; + + sweepHit.distance = distance; + bool status = false; + bool initialOverlap = false; + while(numHullVertices--) + { + const PxVec3& vertex = *hullVertices++; + const PxVec3 worldPt = convexPose.transform(convexScaling * vertex); + float t; + PxVec3 pointOnPlane; + if(intersectRayPlane(worldPt, unitDir, plane, t, &pointOnPlane)) + { + if(plane.distance(worldPt) <= 0.0f) + { + initialOverlap = true; + break; + //// Convex touches plane + //sweepHit.distance = 0.0f; + //sweepHit.flags = PxHitFlag::eNORMAL; + //sweepHit.normal = -unitDir; + //return true; + } + + if(t > 0.0f && t <= sweepHit.distance) + { + sweepHit.distance = t; + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + sweepHit.position = pointOnPlane; + sweepHit.normal = plane.n; + status = true; + } + } + } + + if(initialOverlap) + { + if(isMtd) + { + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL; + return computePlane_ConvexMTD(plane, convexGeom, convexPose, sweepHit); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.flags = PxHitFlag::eNORMAL; + sweepHit.normal = -unitDir; + return true; + } + } + return status; +} + +bool sweepConvex_CapsuleGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE); + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + Capsule capsule; + getCapsule(capsule, capsuleGeom, pose); + + // remove PxHitFlag::eFACE_INDEX, not neeeded to compute. + PxHitFlags tempHitFlags = hitFlags; + tempHitFlags &= ~PxHitFlag::eFACE_INDEX; + + if(!sweepCapsule_ConvexGeom(convexGeom, convexPose, capsuleGeom, pose, capsule, -unitDir, distance, sweepHit, tempHitFlags, inflation, threadContext)) + return false; + + if(sweepHit.flags & PxHitFlag::ePOSITION) + sweepHit.position += unitDir * sweepHit.distance; + + sweepHit.normal = -sweepHit.normal; + sweepHit.faceIndex = 0xffffffff; + return true; +} + +bool sweepConvex_BoxGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + const PxBoxGeometry& boxGeom = static_cast(geom); + + Box box; + buildFrom(box, pose.p, boxGeom.halfExtents, pose.q); + + // remove PxHitFlag::eFACE_INDEX, not neeeded to compute. + PxHitFlags tempHitFlags = hitFlags; + tempHitFlags &= ~PxHitFlag::eFACE_INDEX; + + if(!sweepBox_ConvexGeom(convexGeom, convexPose, boxGeom, pose, box, -unitDir, distance, sweepHit, tempHitFlags, inflation, threadContext)) + return false; + + if(sweepHit.flags & PxHitFlag::ePOSITION) + sweepHit.position += unitDir * sweepHit.distance; + + sweepHit.normal = -sweepHit.normal; + sweepHit.faceIndex = 0xffffffff; + return true; +} + +bool sweepConvex_ConvexGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + using namespace aos; + PX_ASSERT(geom.getType() == PxGeometryType::eCONVEXMESH); + const PxConvexMeshGeometry& otherConvexGeom = static_cast(geom); + ConvexMesh& otherConvexMesh = *static_cast(otherConvexGeom.convexMesh); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + ConvexHullData* hullData = &convexMesh->getHull(); + + ConvexHullData* otherHullData = &otherConvexMesh.getHull(); + + const Vec3V zeroV = V3Zero(); + const FloatV zero = FZero(); + + const Vec3V otherVScale = V3LoadU_SafeReadW(otherConvexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV otherVQuat = QuatVLoadU(&otherConvexGeom.scale.rotation.x); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexGeom.scale.rotation.x); + + const PxTransformV otherTransf = loadTransformU(pose); + const PxTransformV convexTransf = loadTransformU(convexPose); + + const Vec3V worldDir = V3LoadU(unitDir); + const FloatV dist = FLoad(distance); + const Vec3V dir = convexTransf.rotateInv(V3Scale(worldDir, dist)); + + const PxMatTransformV aToB(convexTransf.transformInv(otherTransf)); + + const ConvexHullV otherConvexHull(otherHullData, zeroV, otherVScale, otherVQuat, otherConvexGeom.scale.isIdentity()); + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, convexGeom.scale.isIdentity()); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + + FloatV toi; + Vec3V closestA, normal; + const RelativeConvex convexA(otherConvexHull, aToB); + const LocalConvex convexB(convexHull); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#endif + if(hasInitialOverlap(sweepHit, unitDir, toi, normal, closestA, convexPose, isMtd, false)) + return true; + + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V worldPointA = convexTransf.transform(closestA); + const Vec3V destNormal = V3Neg(V3Normalize(convexTransf.rotate(normal))); + const FloatV length = FMul(dist, toi); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(worldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + + return computeFaceIndex(sweepHit, hitFlags, otherConvexGeom, otherHullData, pose, unitDir); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.h new file mode 100644 index 0000000..9a53026 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepSharedTests.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_SHARED_TESTS_H +#define GU_SWEEP_SHARED_TESTS_H + +#include "GuBoxConversion.h" + +namespace physx +{ +PX_FORCE_INLINE void computeWorldToBoxMatrix(PxMat34& worldToBox, const physx::Gu::Box& box) +{ + PxMat34 boxToWorld; + physx::buildMatrixFromBox(boxToWorld, box); + worldToBox = boxToWorld.getInverseRT(); +} + +PX_FORCE_INLINE PxU32 getTriangleIndex(PxU32 i, PxU32 cachedIndex) +{ + PxU32 triangleIndex; + if(i==0) triangleIndex = cachedIndex; + else if(i==cachedIndex) triangleIndex = 0; + else triangleIndex = i; + return triangleIndex; +} +} + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp new file mode 100644 index 0000000..049b458 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuSweepTests.cpp @@ -0,0 +1,726 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCustomGeometry.h" +#include "GuSweepTests.h" +#include "GuVecCapsule.h" +#include "GuVecBox.h" +#include "GuVecTriangle.h" +#include "GuSweepTriangleUtils.h" +#include "GuInternal.h" +#include "GuGJKRaycast.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +//#define USE_VIRTUAL_GJK +#ifdef USE_VIRTUAL_GJK +static bool virtualGjkRaycastPenetration(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, + aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation, const bool initialOverlap) +{ + return gjkRaycastPenetration(a, b, initialDir, initialLambda, s, r, lambda, normal, closestA, _inflation, initialOverlap); +} +#endif + +bool sweepCapsule_BoxGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(hitFlags); + PX_UNUSED(threadContext); + + using namespace aos; + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + const PxBoxGeometry& boxGeom = static_cast(geom); + + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents0 = V3LoadU(boxGeom.halfExtents); + const FloatV dist = FLoad(distance); + const Vec3V worldDir = V3LoadU(unitDir); + + const PxTransformV capPos = loadTransformU(capsulePose_); + const PxTransformV boxPos = loadTransformU(pose); + + const PxMatTransformV aToB(boxPos.transformInv(capPos)); + + const FloatV capsuleHalfHeight = FLoad(capsuleGeom_.halfHeight); + const FloatV capsuleRadius = FLoad(lss.radius); + + BoxV box(zeroV, boxExtents0); + CapsuleV capsule(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + + const Vec3V dir = boxPos.rotateInv(V3Neg(V3Scale(worldDir, dist))); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + FloatV toi = FMax(); + Vec3V closestA, normal;//closestA and normal is in the local space of box + const LocalConvex convexA(capsule); + const LocalConvex convexB(box); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), box.getCenter()); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, lss.radius + inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, lss.radius + inflation, isMtd)) + return false; +#endif + sweepHit.flags = PxHitFlag::eNORMAL; + + if(FAllGrtrOrEq(zero, toi)) + { + //initial overlap + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V worldPointA = boxPos.transform(closestA); + const Vec3V destNormal = boxPos.rotate(normal); + const FloatV length = toi; + const Vec3V destWorldPointA = V3NegScaleSub(destNormal, length, worldPointA); + V3StoreU(destWorldPointA, sweepHit.position); + V3StoreU(destNormal, sweepHit.normal); + FStore(length, &sweepHit.distance); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + } + else + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V worldPointA = boxPos.transform(closestA); + const Vec3V destNormal = boxPos.rotate(normal); + const FloatV length = FMul(dist, toi); + const Vec3V destWorldPointA = V3ScaleAdd(worldDir, length, worldPointA); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + return true; +} + +bool sweepBox_SphereGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eSPHERE); + PX_UNUSED(threadContext); + PX_UNUSED(hitFlags); + PX_UNUSED(boxGeom_); + + const PxSphereGeometry& sphereGeom = static_cast(geom); + + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents = V3LoadU(box.extents); + const FloatV worldDist = FLoad(distance); + const Vec3V unitDirV = V3LoadU(unitDir); + + const FloatV sphereRadius = FLoad(sphereGeom.radius); + + const PxTransformV spherePos = loadTransformU(pose); + const PxTransformV boxPos = loadTransformU(boxPose_); + + const PxMatTransformV aToB(boxPos.transformInv(spherePos)); + + const BoxV boxV(zeroV, boxExtents); + const CapsuleV capsuleV(aToB.p, sphereRadius); + + //transform into b space + const Vec3V dir = boxPos.rotateInv(V3Scale(unitDirV, worldDist)); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + FloatV toi; + Vec3V closestA, normal;//closestA and normal is in the local space of box + const Vec3V initialSearchDir = V3Sub(capsuleV.getCenter(), boxV.getCenter()); + const LocalConvex convexA(capsuleV); + const LocalConvex convexB(boxV); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, sphereGeom.radius+inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, sphereGeom.radius+inflation, isMtd)) + return false; +#endif + sweepHit.flags = PxHitFlag::eNORMAL; + + //initial overlap + if(FAllGrtrOrEq(zero, toi)) + { + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destWorldPointA = boxPos.transform(closestA); + const Vec3V destNormal = V3Neg(boxPos.rotate(normal)); + const FloatV length = toi; + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + } + else + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destWorldPointA = boxPos.transform(closestA); + const Vec3V destNormal = V3Neg(boxPos.rotate(normal)); + const FloatV length = FMul(worldDist, toi); + V3StoreU(destNormal, sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + return true; +} + +bool sweepBox_CapsuleGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + using namespace aos; + PX_ASSERT(geom.getType() == PxGeometryType::eCAPSULE); + PX_UNUSED(threadContext); + PX_UNUSED(hitFlags); + PX_UNUSED(boxGeom_); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + const FloatV capsuleHalfHeight = FLoad(capsuleGeom.halfHeight); + const FloatV capsuleRadius = FLoad(capsuleGeom.radius); + + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents = V3LoadU(box.extents); + const FloatV worldDist = FLoad(distance); + const Vec3V unitDirV = V3LoadU(unitDir); + + const PxTransformV capPos = loadTransformU(pose); + const PxTransformV boxPos = loadTransformU(boxPose_); + + const PxMatTransformV aToB(boxPos.transformInv(capPos)); + + const BoxV boxV(zeroV, boxExtents); + const CapsuleV capsuleV(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + + //transform into b space + const Vec3V dir = boxPos.rotateInv(V3Scale(unitDirV, worldDist)); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + FloatV toi; + Vec3V closestA, normal;//closestA and normal is in the local space of box + const Vec3V initialSearchDir = V3Sub(capsuleV.getCenter(), boxV.getCenter()); + const LocalConvex convexA(capsuleV); + const LocalConvex convexB(boxV); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, capsuleGeom.radius+inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, capsuleGeom.radius+inflation, isMtd)) + return false; +#endif + sweepHit.flags = PxHitFlag::eNORMAL; + + //initial overlap + if(FAllGrtrOrEq(zero, toi)) + { + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + //initial overlap is toi < 0 + const FloatV length = toi; + const Vec3V destWorldPointA = boxPos.transform(closestA); + const Vec3V destNormal = boxPos.rotate(normal); + V3StoreU(V3Neg(destNormal), sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + return true; + } + else + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destWorldPointA = boxPos.transform(closestA); + const Vec3V destNormal = boxPos.rotate(normal); + const FloatV length = FMul(worldDist, toi); + V3StoreU(V3Neg(destNormal), sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + return true; +} + +bool sweepBox_BoxGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eBOX); + PX_UNUSED(threadContext); + PX_UNUSED(boxGeom_); + + const PxBoxGeometry& boxGeom = static_cast(geom); + + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents0 = V3LoadU(boxGeom.halfExtents); + const Vec3V boxExtents1 = V3LoadU(box.extents); + const FloatV worldDist = FLoad(distance); + const Vec3V unitDirV = V3LoadU(unitDir); + + const PxTransformV boxTrans0 = loadTransformU(pose); + const PxTransformV boxTrans1 = loadTransformU(boxPose_); + + const PxMatTransformV aToB(boxTrans1.transformInv(boxTrans0)); + + const BoxV box0(zeroV, boxExtents0); + const BoxV box1(zeroV, boxExtents1); + + //transform into b space + const Vec3V dir = boxTrans1.rotateInv(V3Scale(unitDirV, worldDist)); + const bool isMtd = hitFlags & PxHitFlag::eMTD; + FloatV toi; + Vec3V closestA, normal;//closestA and normal is in the local space of box + const RelativeConvex convexA(box0, aToB); + const LocalConvex convexB(box1); +#ifdef USE_VIRTUAL_GJK + if(!virtualGjkRaycastPenetration(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#else + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, aToB.p, zero, zeroV, dir, toi, normal, closestA, inflation, isMtd)) + return false; +#endif + sweepHit.flags = PxHitFlag::eNORMAL; + if(FAllGrtrOrEq(zero, toi)) + { + if(isMtd) + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const FloatV length = toi; + const Vec3V destWorldPointA = boxTrans1.transform(closestA); + const Vec3V destNormal = V3Normalize(boxTrans1.rotate(normal)); + V3StoreU(V3Neg(destNormal), sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + } + else + { + sweepHit.flags |= PxHitFlag::ePOSITION; + const Vec3V destWorldPointA = boxTrans1.transform(closestA); + const Vec3V destNormal = V3Normalize(boxTrans1.rotate(normal)); + const FloatV length = FMul(worldDist, toi); + V3StoreU(V3Neg(destNormal), sweepHit.normal); + V3StoreU(destWorldPointA, sweepHit.position); + FStore(length, &sweepHit.distance); + } + return true; +} + +bool Gu::sweepBoxTriangles(GU_SWEEP_TRIANGLES_FUNC_PARAMS(PxBoxGeometry)) +{ + PX_UNUSED(hitFlags); + + if(!nbTris) + return false; + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool doBackfaceCulling = !doubleSided && !meshBothSides; + + Box box; + buildFrom(box, pose.p, geom.halfExtents, pose.q); + + PxGeomSweepHit sweepHit; + // Move to AABB space + PxMat34 worldToBox; + computeWorldToBoxMatrix(worldToBox, box); + + const PxVec3 localDir = worldToBox.rotate(unitDir); + const PxVec3 localMotion = localDir * distance; + + const Vec3V base0 = V3LoadU(worldToBox.m.column0); + const Vec3V base1 = V3LoadU(worldToBox.m.column1); + const Vec3V base2 = V3LoadU(worldToBox.m.column2); + const Mat33V matV(base0, base1, base2); + const Vec3V p = V3LoadU(worldToBox.p); + const PxMatTransformV worldToBoxV(p, matV); + + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents = V3LoadU(box.extents); + const Vec3V boxDir = V3LoadU(localDir); + const FloatV inflationV = FLoad(inflation); + const Vec3V absBoxDir = V3Abs(boxDir); + const FloatV boxRadiusV = FAdd(V3Dot(absBoxDir, boxExtents), inflationV); + BoxV boxV(zeroV, boxExtents); + +#if PX_DEBUG + PxU32 totalTestsExpected = nbTris; + PxU32 totalTestsReal = 0; + PX_UNUSED(totalTestsExpected); + PX_UNUSED(totalTestsReal); +#endif + + Vec3V boxLocalMotion = V3LoadU(localMotion); + Vec3V minClosestA = zeroV, minNormal = zeroV; + PxU32 minTriangleIndex = 0; + PxVec3 bestTriNormal(0.0f); + FloatV dist = FLoad(distance); + + const PxTransformV boxPos = loadTransformU(pose); + + bool status = false; + + const PxU32 idx = cachedIndex ? *cachedIndex : 0; + + for(PxU32 ii=0;ii convexA(triangleV); + const LocalConvex convexB(boxV); + const Vec3V initialSearchDir = V3Sub(triangleV.getCenter(), boxV.getCenter()); +#ifdef USE_VIRTUAL_GJK + if(virtualGjkRaycastPenetration(convexA, convexB, initialSearchDir, zero, zeroV, boxLocalMotion, lambda, normal, closestA, inflation, false)) +#else + if(gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, boxLocalMotion, lambda, normal, closestA, inflation, false)) +#endif + { + //hitCount++; + + if(FAllGrtrOrEq(zero, lambda)) + { + hit.distance = 0.0f; + hit.faceIndex = triangleIndex; + hit.normal = -unitDir; + hit.flags = PxHitFlag::eNORMAL; + return true; + } + + dist = FMul(dist, lambda); + boxLocalMotion = V3Scale(boxDir, dist); + minClosestA = closestA; + minNormal = normal; + minTriangleIndex = triangleIndex; + V3StoreU(triNormal, bestTriNormal); + status = true; + if(hitFlags & PxHitFlag::eMESH_ANY) + break; + } + } + + if(!status) + return false; + + hit.faceIndex = minTriangleIndex; + const Vec3V destNormal = V3Neg(V3Normalize(boxPos.rotate(minNormal))); + const Vec3V destWorldPointA = boxPos.transform(minClosestA); + V3StoreU(destNormal, hit.normal); + V3StoreU(destWorldPointA, hit.position); + FStore(dist, &hit.distance); + + // PT: by design, returned normal is opposed to the sweep direction. + if(shouldFlipNormal(hit.normal, meshBothSides, doubleSided, bestTriNormal, unitDir)) + hit.normal = -hit.normal; + + hit.flags = PxHitFlag::ePOSITION|PxHitFlag::eNORMAL; + return true; +} + +bool sweepCapsule_SphereGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_PlaneGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_CapsuleGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_BoxGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_BoxGeom_Precise (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_ConvexGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_MeshGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); +bool sweepCapsule_HeightFieldGeom (GU_CAPSULE_SWEEP_FUNC_PARAMS); + +bool sweepBox_SphereGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_SphereGeom_Precise (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_PlaneGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_CapsuleGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_CapsuleGeom_Precise (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_BoxGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_BoxGeom_Precise (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_ConvexGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_MeshGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_HeightFieldGeom (GU_BOX_SWEEP_FUNC_PARAMS); +bool sweepBox_HeightFieldGeom_Precise(GU_BOX_SWEEP_FUNC_PARAMS); + +bool sweepConvex_SphereGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_PlaneGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_CapsuleGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_BoxGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_ConvexGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_MeshGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); +bool sweepConvex_HeightFieldGeom (GU_CONVEX_SWEEP_FUNC_PARAMS); + +static bool sweepCapsule_InvalidGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(lss); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return false; +} + +static bool sweepBox_InvalidGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(box); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return false; +} + +static bool sweepConvex_InvalidGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(convexGeom); + PX_UNUSED(convexPose); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return false; +} + +static bool sweepCapsule_HeightfieldUnregistered(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(lss); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Height Field Sweep test called with height fields unregistered "); +} + +static bool sweepBox_HeightfieldUnregistered(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(box); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Height Field Sweep test called with height fields unregistered "); +} + +static bool sweepConvex_HeightfieldUnregistered(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(geom); + PX_UNUSED(pose); + PX_UNUSED(convexGeom); + PX_UNUSED(convexPose); + PX_UNUSED(unitDir); + PX_UNUSED(distance); + PX_UNUSED(sweepHit); + PX_UNUSED(hitFlags); + PX_UNUSED(inflation); + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Height Field Sweep test called with height fields unregistered "); +} + +static bool sweepCapsule_CustomGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(lss); + if(geom.getType() == PxGeometryType::eCUSTOM) + return static_cast(geom).callbacks->sweep(unitDir, distance, geom, pose, capsuleGeom_, capsulePose_, sweepHit, hitFlags, inflation, threadContext); + return false; +} + +static bool sweepBox_CustomGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(box); + if(geom.getType() == PxGeometryType::eCUSTOM) + return static_cast(geom).callbacks->sweep(unitDir, distance, geom, pose, boxGeom_, boxPose_, sweepHit, hitFlags, inflation, threadContext); + return false; +} + +static bool sweepConvex_CustomGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + if(geom.getType() == PxGeometryType::eCUSTOM) + return static_cast(geom).callbacks->sweep(unitDir, distance, geom, pose, convexGeom, convexPose, sweepHit, hitFlags, inflation, threadContext); + return false; +} + +Gu::GeomSweepFuncs gGeomSweepFuncs = +{ + { + sweepCapsule_SphereGeom, + sweepCapsule_PlaneGeom, + sweepCapsule_CapsuleGeom, + sweepCapsule_BoxGeom, + sweepCapsule_ConvexGeom, + sweepCapsule_InvalidGeom, + sweepCapsule_InvalidGeom, + sweepCapsule_MeshGeom, + sweepCapsule_HeightfieldUnregistered, + sweepCapsule_InvalidGeom, + sweepCapsule_CustomGeom + }, + { + sweepCapsule_SphereGeom, + sweepCapsule_PlaneGeom, + sweepCapsule_CapsuleGeom, + sweepCapsule_BoxGeom_Precise, + sweepCapsule_ConvexGeom, + sweepCapsule_InvalidGeom, + sweepCapsule_InvalidGeom, + sweepCapsule_MeshGeom , + sweepCapsule_HeightfieldUnregistered, + sweepCapsule_InvalidGeom, + sweepCapsule_CustomGeom + }, + { + sweepBox_SphereGeom, + sweepBox_PlaneGeom, + sweepBox_CapsuleGeom, + sweepBox_BoxGeom, + sweepBox_ConvexGeom, + sweepBox_InvalidGeom, + sweepBox_InvalidGeom, + sweepBox_MeshGeom, + sweepBox_HeightfieldUnregistered, + sweepBox_InvalidGeom, + sweepBox_CustomGeom + }, + { + sweepBox_SphereGeom_Precise, + sweepBox_PlaneGeom, + sweepBox_CapsuleGeom_Precise, + sweepBox_BoxGeom_Precise, + sweepBox_ConvexGeom, + sweepBox_InvalidGeom, + sweepBox_InvalidGeom, + sweepBox_MeshGeom, + sweepBox_HeightfieldUnregistered, + sweepBox_InvalidGeom, + sweepBox_CustomGeom + }, + { + sweepConvex_SphereGeom, // 0 + sweepConvex_PlaneGeom, // 1 + sweepConvex_CapsuleGeom, // 2 + sweepConvex_BoxGeom, // 3 + sweepConvex_ConvexGeom, // 4 + sweepConvex_InvalidGeom, // 5 + sweepConvex_InvalidGeom, // 6 + sweepConvex_MeshGeom, // 7 + sweepConvex_HeightfieldUnregistered, // 8 + sweepConvex_InvalidGeom, // 9 + sweepConvex_CustomGeom // 10 + } +}; + +PX_PHYSX_COMMON_API const GeomSweepFuncs& Gu::getSweepFuncTable() +{ + return gGeomSweepFuncs; +} + +void registerHeightFields_Sweeps() +{ + gGeomSweepFuncs.capsuleMap[PxGeometryType::eHEIGHTFIELD] = sweepCapsule_HeightFieldGeom; + gGeomSweepFuncs.preciseCapsuleMap[PxGeometryType::eHEIGHTFIELD] = sweepCapsule_HeightFieldGeom; + gGeomSweepFuncs.boxMap[PxGeometryType::eHEIGHTFIELD] = sweepBox_HeightFieldGeom; + gGeomSweepFuncs.preciseBoxMap[PxGeometryType::eHEIGHTFIELD] = sweepBox_HeightFieldGeom_Precise; + gGeomSweepFuncs.convexMap[PxGeometryType::eHEIGHTFIELD] = sweepConvex_HeightFieldGeom; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp new file mode 100644 index 0000000..9c3207b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.cpp @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuWindingNumberT.h" +#include "GuWindingNumber.h" + +namespace physx +{ +namespace Gu +{ + PxF32 computeWindingNumber(const Gu::BVHNode* tree, const PxVec3& q, PxF32 beta, const PxHashMap& clusters, + const PxU32* triangles, const PxVec3* points) + { + return Gu::computeWindingNumber(tree, q, beta, clusters, triangles, points); + } + + PxF32 computeWindingNumber(const Gu::BVHNode* tree, const PxVec3& q, const PxHashMap& clusters, + const PxU32* triangles, const PxVec3* points) + { + return Gu::computeWindingNumber(tree, q, 2.0f, clusters, triangles, points); + } + + void precomputeClusterInformation(const Gu::BVHNode* tree, const PxU32* triangles, const PxU32 numTriangles, + const PxVec3* points, PxHashMap& result, PxI32 rootNodeIndex) + { + Gu::precomputeClusterInformation(tree, triangles, numTriangles, points, result, rootNodeIndex); + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.h new file mode 100644 index 0000000..ae42fa0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumber.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_WINDING_NUMBER_H +#define GU_WINDING_NUMBER_H + +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" +#include "GuWindingNumberCluster.h" + +namespace physx +{ +namespace Gu +{ + struct BVHNode; + + typedef ClusterApproximationT ClusterApproximation; + + PX_PHYSX_COMMON_API PxF32 computeWindingNumber(const Gu::BVHNode* tree, const PxVec3& q, const PxHashMap& clusters, + const PxU32* triangles, const PxVec3* points); + + PX_PHYSX_COMMON_API PxF32 computeWindingNumber(const Gu::BVHNode* tree, const PxVec3& q, PxF32 beta, const PxHashMap& clusters, + const PxU32* triangles, const PxVec3* points); + + PX_PHYSX_COMMON_API void precomputeClusterInformation(const Gu::BVHNode* tree, const PxU32* triangles, const PxU32 numTriangles, + const PxVec3* points, PxHashMap& result, PxI32 rootNodeIndex = 0); +} +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberCluster.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberCluster.h new file mode 100644 index 0000000..e29769d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberCluster.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_WINDING_NUMBER_CLUSTER_H +#define GU_WINDING_NUMBER_CLUSTER_H + +/** \addtogroup geomutils +@{ +*/ + +namespace physx +{ +namespace Gu +{ + template + struct ClusterApproximationT + { + R Radius; + R AreaSum; + V3 WeightedCentroid; + V3 WeightedNormalSum; + + PX_FORCE_INLINE ClusterApproximationT() {} + + PX_FORCE_INLINE ClusterApproximationT(R radius, R areaSum, const V3& weightedCentroid, const V3& weightedNormalSum) : + Radius(radius), AreaSum(areaSum), WeightedCentroid(weightedCentroid), WeightedNormalSum(weightedNormalSum) + { } + }; +} +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberT.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberT.h new file mode 100644 index 0000000..1415893 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/GuWindingNumberT.h @@ -0,0 +1,332 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_WINDING_NUMBER_T_H +#define GU_WINDING_NUMBER_T_H + +/** \addtogroup geomutils +@{ +*/ + +#include "GuTriangle.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxVec3.h" +#include "GuBVH.h" +#include "GuAABBTreeQuery.h" +#include "GuAABBTreeNode.h" +#include "GuWindingNumberCluster.h" + +namespace physx +{ +namespace Gu +{ + using Triangle = Gu::IndexedTriangleT; + + template + struct SecondOrderClusterApproximationT : public ClusterApproximationT + { + PxMat33 WeightedOuterProductSum; + + PX_FORCE_INLINE SecondOrderClusterApproximationT() {} + + PX_FORCE_INLINE SecondOrderClusterApproximationT(R radius, R areaSum, const V3& weightedCentroid, const V3& weightedNormalSum, const PxMat33& weightedOuterProductSum) : + ClusterApproximationT(radius, areaSum, weightedCentroid, weightedNormalSum), WeightedOuterProductSum(weightedOuterProductSum) + { } + }; + + //Evaluates a first order winding number approximation for a given cluster (cluster = bunch of triangles) + template + PX_FORCE_INLINE R firstOrderClusterApproximation(const V3& weightedCentroid, const V3& weightedNormalSum, + const V3& evaluationPoint) + { + const V3 dir = weightedCentroid - evaluationPoint; + const R l = dir.magnitude(); + return (R(0.25 / 3.141592653589793238462643383) / (l * l * l)) * weightedNormalSum.dot(dir); + } + template + PX_FORCE_INLINE R clusterApproximation(const ClusterApproximationT& c, const V3& evaluationPoint) + { + return firstOrderClusterApproximation(c.WeightedCentroid, c.WeightedNormalSum, evaluationPoint); + } + + //Evaluates a second order winding number approximation for a given cluster (cluster = bunch of triangles) + template + PX_FORCE_INLINE R secondOrderClusterApproximation(const V3& weightedCentroid, const V3& weightedNormalSum, + const PxMat33& weightedOuterProductSum, const V3& evaluationPoint) + { + const V3 dir = weightedCentroid - evaluationPoint; + const R l = dir.magnitude(); + const R l2 = l * l; + const R scaling = R(0.25 / 3.141592653589793238462643383) / (l2 * l); + const R firstOrder = scaling * weightedNormalSum.dot(dir); + + const R scaling2 = -R(3.0) * scaling / l2; + const R m11 = scaling + scaling2 * dir.x * dir.x, m12 = scaling2 * dir.x * dir.y, m13 = scaling2 * dir.x * dir.z; + const R m21 = scaling2 * dir.y * dir.x, m22 = scaling + scaling2 * dir.y * dir.y, m23 = scaling2 * dir.y * dir.z; + const R m31 = scaling2 * dir.z * dir.x, m32 = scaling2 * dir.z * dir.y, m33 = scaling + scaling2 * dir.z * dir.z; + + return firstOrder + (weightedOuterProductSum.column0.x * m11 + weightedOuterProductSum.column1.x * m12 + weightedOuterProductSum.column2.x * m13 + + weightedOuterProductSum.column0.y * m21 + weightedOuterProductSum.column1.y * m22 + weightedOuterProductSum.column2.y * m23 + + weightedOuterProductSum.column0.z * m31 + weightedOuterProductSum.column1.z * m32 + weightedOuterProductSum.column2.z * m33); + } + template + PX_FORCE_INLINE R clusterApproximation(const SecondOrderClusterApproximationT& c, const V3& evaluationPoint) + { + return secondOrderClusterApproximation(c.WeightedCentroid, c.WeightedNormalSum, c.WeightedOuterProductSum, evaluationPoint); + } + + //Computes parameters to approximately represent a cluster (cluster = bunch of triangles) to be used to compute a winding number approximation + template + void approximateCluster(const PxArray& triangleSet, PxU32 start, PxU32 end, const PxU32* triangles, const V3* points, + const PxArray& triangleAreas, const PxArray& triangleNormalsTimesTriangleArea, const PxArray& triangleCentroids, ClusterApproximationT& cluster) + { + V3 weightedCentroid(0., 0., 0.); + R areaSum = 0; + V3 weightedNormalSum(0., 0., 0.); + + for (PxU32 i = start; i < end; ++i) + { + PxI32 triId = triangleSet[i]; + areaSum += triangleAreas[triId]; + weightedCentroid += triangleCentroids[triId] * triangleAreas[triId]; + weightedNormalSum += triangleNormalsTimesTriangleArea[triId]; + } + weightedCentroid = weightedCentroid / areaSum; + + R radiusSquared = 0; + for (PxU32 i = start; i < end; ++i) + { + PxI32 triId = triangleSet[i]; + const PxU32* tri = &triangles[3 * triId]; + R d2 = (weightedCentroid - points[tri[0]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + d2 = (weightedCentroid - points[tri[1]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + d2 = (weightedCentroid - points[tri[2]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + } + cluster = ClusterApproximationT(PxSqrt(radiusSquared), areaSum, weightedCentroid, weightedNormalSum/*, weightedOuterProductSum*/); + } + + //Computes parameters to approximately represent a cluster (cluster = bunch of triangles) to be used to compute a winding number approximation + template + void approximateCluster(const PxArray& triangleSet, PxU32 start, PxU32 end, const PxU32* triangles, const V3* points, + const PxArray& triangleAreas, const PxArray& triangleNormalsTimesTriangleArea, const PxArray& triangleCentroids, SecondOrderClusterApproximationT& cluster) + { + V3 weightedCentroid(0., 0., 0.); + R areaSum = 0; + V3 weightedNormalSum(0., 0., 0.); + + for (PxU32 i = start; i < end; ++i) + { + PxI32 triId = triangleSet[i]; + areaSum += triangleAreas[triId]; + weightedCentroid += triangleCentroids[triId] * triangleAreas[triId]; + weightedNormalSum += triangleNormalsTimesTriangleArea[triId]; + } + weightedCentroid = weightedCentroid / areaSum; + + R radiusSquared = 0; + PxMat33 weightedOuterProductSum(PxZERO::PxZero); + for (PxU32 i = start; i < end; ++i) + { + PxI32 triId = triangleSet[i]; + const PxU32* tri = &triangles[3 * triId]; + R d2 = (weightedCentroid - points[tri[0]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + d2 = (weightedCentroid - points[tri[1]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + d2 = (weightedCentroid - points[tri[2]]).magnitudeSquared(); + if (d2 > radiusSquared) radiusSquared = d2; + + weightedOuterProductSum = weightedOuterProductSum + PxMat33::outer(triangleCentroids[triId] - weightedCentroid, triangleNormalsTimesTriangleArea[triId]); + } + cluster = SecondOrderClusterApproximationT(PxSqrt(radiusSquared), areaSum, weightedCentroid, weightedNormalSum, weightedOuterProductSum); + } + + //Exact winding number evaluation, needs to be called for every triangle close to the winding number query point + template + PX_FORCE_INLINE R evaluateExact(V3 a, V3 b, V3 c, const V3& p) + { + const R twoOver4PI = R(0.5 / 3.141592653589793238462643383); + + a -= p; + b -= p; + c -= p; + + const R la = a.magnitude(), + lb = b.magnitude(), + lc = c.magnitude(); + + const R y = a.x * b.y * c.z - a.x * b.z * c.y - a.y * b.x * c.z + a.y * b.z * c.x + a.z * b.x * c.y - a.z * b.y * c.x; + const R x = (la * lb * lc + (a.x * b.x + a.y * b.y + a.z * b.z) * lc + + (b.x * c.x + b.y * c.y + b.z * c.z) * la + (c.x * a.x + c.y * a.y + c.z * a.z) * lb); + return twoOver4PI * PxAtan2(y, x); + } + + struct Section + { + PxI32 start; + PxI32 end; + + Section(PxI32 s, PxI32 e) : start(s), end(e) + {} + }; + + //Helper method that recursively traverses the given BVH tree and computes a cluster approximation for every node and links it to the node + template + void precomputeClusterInformation(PxI32 nodeId, const BVHNode* tree, const PxU32* triangles, const PxU32 numTriangles, + const V3* points, PxHashMap>& infos, const PxArray triangleAreas, + const PxArray& triangleNormalsTimesTriangleArea, const PxArray& triangleCentroids) + { + PxArray stack; + stack.pushBack(nodeId); + PxArray
returnStack; + + PxArray triIndices; + triIndices.reserve(numTriangles); + infos.reserve(PxU32(1.2f*numTriangles)); + + while (stack.size() > 0) + { + nodeId = stack.popBack(); + + if (nodeId >= 0) + { + const BVHNode& node = tree[nodeId]; + if (node.isLeaf()) + { + triIndices.pushBack(node.getPrimitiveIndex()); + returnStack.pushBack(Section(triIndices.size() - 1, triIndices.size())); + continue; + } + + stack.pushBack(-nodeId - 1); //Marker for return index + stack.pushBack(node.getPosIndex()); + stack.pushBack(node.getPosIndex() + 1); + } + else + { + Section trianglesA = returnStack.popBack(); + Section trianglesB = returnStack.popBack(); + Section sum(trianglesB.start, trianglesA.end); + + nodeId = -nodeId - 1; + ClusterApproximationT c; + approximateCluster(triIndices, sum.start, sum.end, triangles, points, triangleAreas, triangleNormalsTimesTriangleArea, triangleCentroids, c); + infos.insert(PxU32(nodeId), c); + + returnStack.pushBack(sum); + } + } + } + + //Precomputes a cluster approximation for every node in the BVH tree + template + void precomputeClusterInformation(const BVHNode* tree, const PxU32* triangles, const PxU32 numTriangles, + const V3* points, PxHashMap>& result, PxI32 rootNodeIndex) + { + PxArray triangleAreas; + triangleAreas.resize(numTriangles); + PxArray triangleNormalsTimesTriangleArea; + triangleNormalsTimesTriangleArea.resize(numTriangles); + PxArray triangleCentroids; + triangleCentroids.resize(numTriangles); + + for (PxU32 i = 0; i < numTriangles; ++i) + { + const PxU32* tri = &triangles[3 * i]; + const V3& a = points[tri[0]]; + const V3& b = points[tri[1]]; + const V3& c = points[tri[2]]; + triangleNormalsTimesTriangleArea[i] = (b - a).cross(c - a) * R(0.5); + triangleAreas[i] = triangleNormalsTimesTriangleArea[i].magnitude(); + triangleCentroids[i] = (a + b + c) * R(1.0 / 3.0); + } + + result.clear(); + precomputeClusterInformation(rootNodeIndex, tree, triangles, numTriangles, points, result, triangleAreas, triangleNormalsTimesTriangleArea, triangleCentroids); + } + + template + class WindingNumberTraversalController + { + public: + R mWindingNumber = 0; + private: + const PxU32* mTriangles; + const V3* mPoints; + const PxHashMap>& mClusters; + V3 mQueryPoint; + R mDistanceThresholdBeta; + + public: + PX_FORCE_INLINE WindingNumberTraversalController(const PxU32* triangles, const V3* points, + const PxHashMap>& clusters, const V3& queryPoint, R distanceThresholdBeta = 2) + : mTriangles(triangles), mPoints(points), mClusters(clusters), mQueryPoint(queryPoint), mDistanceThresholdBeta(distanceThresholdBeta) + { } + + PX_FORCE_INLINE Gu::TraversalControl::Enum analyze(const BVHNode& node, PxI32 nodeIndex) + { + if (node.isLeaf()) + { + PX_ASSERT(node.getNbPrimitives() == 1); + const PxU32* tri = &mTriangles[3 * node.getPrimitiveIndex()]; + mWindingNumber += evaluateExact(mPoints[tri[0]], mPoints[tri[1]], mPoints[tri[2]], mQueryPoint); + return Gu::TraversalControl::eDontGoDeeper; + } + const ClusterApproximationT& cluster = mClusters.find(nodeIndex)->second; + const R distSquared = (mQueryPoint - cluster.WeightedCentroid).magnitudeSquared(); + const R threshold = mDistanceThresholdBeta * cluster.Radius; + if (distSquared > threshold * threshold) + { + //mWindingNumber += secondOrderClusterApproximation(cluster.WeightedCentroid, cluster.WeightedNormalSum, cluster.WeightedOuterProductSum, mQueryPoint); + mWindingNumber += firstOrderClusterApproximation(cluster.WeightedCentroid, cluster.WeightedNormalSum, mQueryPoint); // secondOrderClusterApproximation(cluster.WeightedCentroid, cluster.WeightedNormalSum, cluster.WeightedOuterProductSum, mQueryPoint); + return Gu::TraversalControl::eDontGoDeeper; + } + return Gu::TraversalControl::eGoDeeper; + } + + private: + PX_NOCOPY(WindingNumberTraversalController) + }; + + template + R computeWindingNumber(const BVHNode* tree, const V3& q, R beta, const PxHashMap>& clusters, + const PxU32* triangles, const V3* points) + { + WindingNumberTraversalController c(triangles, points, clusters, q, beta); + traverseBVH>(tree, c); + return c.mWindingNumber; + } +} +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp new file mode 100644 index 0000000..9045393 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.cpp @@ -0,0 +1,724 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuVecCapsule.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecTriangle.h" +#include "GuGJKRaycast.h" +#include "GuCCDSweepConvexMesh.h" +#include "GuHeightFieldUtil.h" +#include "foundation/PxInlineArray.h" +#include "GuEntityReport.h" +#include "PxContact.h" +#include "GuDistancePointTriangle.h" +#include "GuBox.h" +#include "GuInternal.h" +#include "GuBoxConversion.h" +#include "GuConvexUtilsInternal.h" +#include "GuMidphaseInterface.h" +#include "geometry/PxGeometryQuery.h" + +// PT: this one makes the "behavior after impact" PEEL test "fail" (rocks stop after impact) +// It also makes these UTs fail: +// [ FAILED ] CCDReportTest.CCD_soakTest_mesh +// [ FAILED ] CCDNegativeScalingTest.SLOW_ccdNegScaledMesh +static const bool gUseGeometryQuery = false; + +// PT: this one seems to work. +// Timings for PEEL's "limits of speculative contacts test2", for 3 runs: +// false: true: +// Time: 504 220 +// Time: 89 7 +// Time: 5 84 +// Time: 8 11 +// Time: 423 56 +// Time: 103 14 +// Time: 10 11 +// Time: 10 9 +// Time: 418 60 +// Time: 139 17 +// Time: 9 9 +// Time: 9 10 +static const bool gUseGeometryQueryEst = false; + +//#define CCD_BASIC_PROFILING +#ifdef CCD_BASIC_PROFILING + #include +#endif + +namespace physx +{ +namespace Gu +{ + +PxReal SweepShapeTriangle(GU_TRIANGLE_SWEEP_METHOD_ARGS); + +using namespace aos; + +namespace +{ +struct AccumCallback: public MeshHitCallback +{ + PX_NOCOPY(AccumCallback) + public: + + PxInlineArray& mResult; + AccumCallback(PxInlineArray& result) + : MeshHitCallback(CallbackMode::eMULTIPLE), + mResult(result) + { + } + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& hit, const PxVec3&, const PxVec3&, const PxVec3&, PxReal&, const PxU32*) + { + mResult.pushBack(hit.faceIndex); + return true; + } +}; + +// PT: TODO: refactor with MidPhaseQueryLocalReport +struct EntityReportContainerCallback : public OverlapReport +{ + PxInlineArray& container; + EntityReportContainerCallback(PxInlineArray& container_) : container(container_) + { + container.forceSize_Unsafe(0); + } + virtual ~EntityReportContainerCallback() {} + + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + for(PxU32 i=0; igetLocalTriangle(localTri, mTriangleIndex, false); // PT: 'false': no need to flip winding to compute bounds + + //gotta take bounds in shape space because building it in vertex space and transforming it out would skew it. + bounds = PxBounds3::empty(); + bounds.include(transform.transform(mVertex2ShapeSkew * localTri.verts[0])); + bounds.include(transform.transform(mVertex2ShapeSkew * localTri.verts[1])); + bounds.include(transform.transform(mVertex2ShapeSkew * localTri.verts[2])); +} + +PxVec3 TriangleHelper::getPolygonNormal() const +{ + PxTriangle localTri; + getMeshData()->getLocalTriangle(localTri, mTriangleIndex, mVertex2ShapeSkew.flipsNormal()); + + const PxVec3 t0 = mVertex2ShapeSkew * localTri.verts[0]; + const PxVec3 t1 = mVertex2ShapeSkew * localTri.verts[1]; + const PxVec3 t2 = mVertex2ShapeSkew * localTri.verts[2]; + const PxVec3 v0 = t0 - t1; + const PxVec3 v1 = t0 - t2; + const PxVec3 nor = v0.cross(v1); + return nor.getNormalized(); +} + +} + +PxReal SweepAnyShapeHeightfield(GU_SWEEP_METHOD_ARGS) +{ + PX_UNUSED(toiEstimate); + + PX_ASSERT(shape1.mGeometry->getType()==PxGeometryType::eHEIGHTFIELD); + const HeightFieldUtil hfUtil(static_cast(*shape1.mGeometry)); + + PxInlineArray tempContainer; + + EntityReportContainerCallback callback(tempContainer); + + const PxVec3 trA = transform0.p - lastTm0.p; + const PxVec3 trB = transform1.p - lastTm1.p; + + const PxVec3 relTr = trA - trB; + const PxVec3 halfRelTr = relTr * 0.5f; + + const PxVec3 ext = shape0.mExtents + halfRelTr.abs() + PxVec3(restDistance); + const PxVec3 cent = shape0.mCenter + halfRelTr; + + const PxBounds3 bounds0(cent - ext, cent + ext); + + hfUtil.overlapAABBTriangles(transform1, bounds0, callback); + + PxArray orderedContainer(tempContainer.size()); + + PxArray distanceEntries(tempContainer.size()); + + PxU32* orderedList = orderedContainer.begin(); + PxF32* distances = reinterpret_cast(distanceEntries.begin()); + + const PxVec3 origin = shape0.mCenter; + const PxVec3 extent = shape0.mExtents + PxVec3(restDistance); + + PxReal minTOI = PX_MAX_REAL; + + PxU32 numTrigs = tempContainer.size(); + PxU32* trianglesIndices = tempContainer.begin(); + + PxU32 count = 0; + for(PxU32 a = 0; a < numTrigs; ++a) + { + PxTriangle tri; + hfUtil.getTriangle(shape1.mPrevTransform, tri, 0, 0, trianglesIndices[a], true, true); + + PxVec3 resultNormal = -(tri.verts[1]-tri.verts[0]).cross(tri.verts[2]-tri.verts[0]); + resultNormal.normalize(); + + if(relTr.dot(resultNormal) >= fastMovingThreshold) + { + PxBounds3 bounds; + bounds.setEmpty(); + bounds.include(tri.verts[0]); + bounds.include(tri.verts[1]); + bounds.include(tri.verts[2]); + + PxF32 toi = sweepAABBAABB(origin, extent * 1.1f, bounds.getCenter(), (bounds.getExtents() + PxVec3(0.01f, 0.01f, 0.01f)) * 1.1f, trA, trB); + + PxU32 index = 0; + if(toi <= 1.f) + { + for(PxU32 b = count; b > 0; --b) + { + if(distances[b-1] <= toi) + { + //shuffle down and swap + index = b; + break; + } + PX_ASSERT(b > 0); + PX_ASSERT(b < numTrigs); + distances[b] = distances[b-1]; + orderedList[b] = orderedList[b-1]; + } + PX_ASSERT(index < numTrigs); + orderedList[index] = trianglesIndices[a]; + distances[index] = toi; + count++; + } + } + } + + worldNormal = PxVec3(PxReal(0)); + worldPoint = PxVec3(PxReal(0)); + Cm::FastVertex2ShapeScaling idScale; + PxU32 ccdFaceIndex = PXC_CONTACT_NO_FACE_INDEX; + + const PxVec3 sphereCenter(shape0.mPrevTransform.p); + const PxF32 inSphereRadius = shape0.mFastMovingThreshold; + const PxF32 inRadSq = inSphereRadius * inSphereRadius; + + const PxVec3 sphereCenterInTr1 = transform1.transformInv(sphereCenter); + const PxVec3 sphereCenterInTr1T0 = transform1.transformInv(lastTm0.p); + + PxVec3 tempWorldNormal(0.f), tempWorldPoint(0.f); + + for (PxU32 ti = 0; ti < count; ti++) + { + PxTriangle tri; + hfUtil.getTriangle(lastTm1, tri, 0, 0, orderedList[ti], false, false); + + PxVec3 resultNormal, resultPoint; + + TriangleV triangle(V3LoadU(tri.verts[0]), V3LoadU(tri.verts[1]), V3LoadU(tri.verts[2])); + + //do sweep + + PxReal res = SweepShapeTriangle( + *shape0.mGeometry, *shape1.mGeometry, transform0, transform1, lastTm0, lastTm1, restDistance, + resultNormal, resultPoint, Cm::FastVertex2ShapeScaling(), triangle, + 0.f); + + if(res <= 0.f) + { + res = 0.f; + + const PxVec3 v0 = tri.verts[1] - tri.verts[0]; + const PxVec3 v1 = tri.verts[2] - tri.verts[0]; + + //Now we have a 0 TOI, lets see if the in-sphere hit it! + + PxF32 distanceSq = distancePointTriangleSquared( sphereCenterInTr1, tri.verts[0], v0, v1); + + if(distanceSq < inRadSq) + { + const PxVec3 nor = v0.cross(v1); + const PxF32 distance = PxSqrt(distanceSq); + res = distance - inSphereRadius; + const PxF32 d = nor.dot(tri.verts[0]); + const PxF32 dd = nor.dot(sphereCenterInTr1T0); + if((dd - d) > 0.f) + { + //back side, penetration + res = -(2.f * inSphereRadius - distance); + } + } + } + + if (res < minTOI) + { + const PxVec3 v0 = tri.verts[1] - tri.verts[0]; + const PxVec3 v1 = tri.verts[2] - tri.verts[0]; + + PxVec3 resultNormal1 = v0.cross(v1); + resultNormal1.normalize(); + //if(norDotRel > 1e-6f) + { + tempWorldNormal = resultNormal1; + tempWorldPoint = resultPoint; + minTOI = res; + ccdFaceIndex = orderedList[ti]; + } + } + } + + worldNormal = transform1.rotate(tempWorldNormal); + worldPoint = tempWorldPoint; + + outCCDFaceIndex = ccdFaceIndex; + + return minTOI; +} + +PxReal SweepEstimateAnyShapeHeightfield(GU_SWEEP_ESTIMATE_ARGS) +{ + PX_ASSERT(shape1.mGeometry->getType()==PxGeometryType::eHEIGHTFIELD); + const HeightFieldUtil hfUtil(static_cast(*shape1.mGeometry)); + + PxInlineArray tempContainer; + + EntityReportContainerCallback callback(tempContainer); + + const PxTransform& transform0 = shape0.mCurrentTransform; + const PxTransform& lastTr0 = shape0.mPrevTransform; + const PxTransform& transform1 = shape1.mCurrentTransform; + const PxTransform& lastTr1 = shape1.mPrevTransform; + + const PxVec3 trA = transform0.p - lastTr0.p; + const PxVec3 trB = transform1.p - lastTr1.p; + + const PxVec3 relTr = trA - trB; + const PxVec3 halfRelTr = relTr * 0.5f; + + const PxVec3 extents = shape0.mExtents + halfRelTr.abs() + PxVec3(restDistance); + const PxVec3 center = shape0.mCenter + halfRelTr; + + const PxBounds3 bounds0(center - extents, center + extents); + + hfUtil.overlapAABBTriangles(transform1, bounds0, callback); + + PxVec3 origin = shape0.mCenter; + PxVec3 extent = shape0.mExtents; + + PxReal minTOI = PX_MAX_REAL; + + PxU32 numTrigs = tempContainer.size(); + PxU32* trianglesIndices = tempContainer.begin(); + + for(PxU32 a = 0; a < numTrigs; ++a) + { + PxTriangle tri; + hfUtil.getTriangle(shape1.mPrevTransform, tri, 0, 0, trianglesIndices[a], true, true); + + PxVec3 resultNormal = -(tri.verts[1]-tri.verts[0]).cross(tri.verts[2]-tri.verts[0]); + resultNormal.normalize(); + + if(relTr.dot(resultNormal) >= fastMovingThreshold) + { + PxBounds3 bounds; + bounds.setEmpty(); + bounds.include(tri.verts[0]); + bounds.include(tri.verts[1]); + bounds.include(tri.verts[2]); + + PxF32 toi = sweepAABBAABB(origin, extent * 1.1f, bounds.getCenter(), (bounds.getExtents() + PxVec3(0.01f, 0.01f, 0.01f)) * 1.1f, trA, trB); + + minTOI = PxMin(minTOI, toi); + } + } + + return minTOI; +} + +PxReal SweepAnyShapeMesh(GU_SWEEP_METHOD_ARGS) +{ + PX_UNUSED(toiEstimate); + // this is the trimesh midphase for convex vs mesh sweep. shape0 is the convex shape. + + const PxVec3 trA = transform0.p - lastTm0.p; + const PxVec3 trB = transform1.p - lastTm1.p; + + const PxVec3 relTr = trA - trB; + PxVec3 unitDir = relTr; + const PxReal length = unitDir.normalize(); + + PX_UNUSED(restDistance); + PX_UNUSED(fastMovingThreshold); + + if(gUseGeometryQuery) + { + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(unitDir, length, *shape0.mGeometry, lastTm0, *shape1.mGeometry, lastTm1, sweepHit, PxHitFlag::eDEFAULT, 0.0f, PxGeometryQueryFlag::Enum(0), NULL)) + //if(!PxGeometryQuery::sweep(unitDir, length, *shape0.mGeometry, transform0, *shape1.mGeometry, transform1, sweepHit, PxHitFlag::eDEFAULT, 0.0f, PxGeometryQueryFlag::Enum(0), NULL)) + return PX_MAX_REAL; + + worldNormal = sweepHit.normal; + worldPoint = sweepHit.position; + outCCDFaceIndex = sweepHit.faceIndex; + + return sweepHit.distance/length; + } + else + { + // Get actual shape data + PX_ASSERT(shape1.mGeometry->getType()==PxGeometryType::eTRIANGLEMESH); + const PxTriangleMeshGeometry& shapeMesh = static_cast(*shape1.mGeometry); + + const Cm::FastVertex2ShapeScaling meshScaling(shapeMesh.scale); + + const PxMat33 matRot(PxIdentity); + + //1) Compute the swept bounds + Box sweptBox; + computeSweptBox(sweptBox, shape0.mExtents, shape0.mCenter, matRot, unitDir, length); + + Box vertexSpaceBox; + if (shapeMesh.scale.isIdentity()) + vertexSpaceBox = transformBoxOrthonormal(sweptBox, transform1.getInverse()); + else + computeVertexSpaceOBB(vertexSpaceBox, sweptBox, transform1, shapeMesh.scale); + + vertexSpaceBox.extents += PxVec3(restDistance); + + PxInlineArray tempContainer; + + AccumCallback callback(tempContainer); + + // AP scaffold: early out opportunities, should probably use fat raycast + Midphase::intersectOBB(_getMeshData(shapeMesh), vertexSpaceBox, callback, true); + + if (tempContainer.size() == 0) + return PX_MAX_REAL; + + // Intersection found, fetch triangles + PxU32 numTrigs = tempContainer.size(); + const PxU32* triangleIndices = tempContainer.begin(); + + PxVec3 origin = shape0.mCenter; + PxVec3 extent = shape0.mExtents + PxVec3(restDistance); + + PxInlineArray orderedContainer; + orderedContainer.resize(tempContainer.size()); + + PxInlineArray distanceEntries; + distanceEntries.resize(tempContainer.size()); + + PxU32* orderedList = orderedContainer.begin(); + PxF32* distances = reinterpret_cast(distanceEntries.begin()); + + PxReal minTOI = PX_MAX_REAL; + + PxU32 count = 0; + for(PxU32 a = 0; a < numTrigs; ++a) + { + const TriangleHelper convexPartOfMesh1(shapeMesh, meshScaling, triangleIndices[a]); + + const PxVec3 resultNormal = -transform1.rotate(convexPartOfMesh1.getPolygonNormal()); + + if(relTr.dot(resultNormal) >= fastMovingThreshold) + { + PxBounds3 bounds; + convexPartOfMesh1.getBounds(bounds, lastTm1); + //OK, we have all 3 vertices, now calculate bounds... + + PxF32 toi = sweepAABBAABB(origin, extent, bounds.getCenter(), bounds.getExtents() + PxVec3(0.02f, 0.02f, 0.02f), trA, trB); + + PxU32 index = 0; + if(toi <= 1.f) + { + for(PxU32 b = count; b > 0; --b) + { + if(distances[b-1] <= toi) + { + //shuffle down and swap + index = b; + break; + } + PX_ASSERT(b > 0); + PX_ASSERT(b < numTrigs); + distances[b] = distances[b-1]; + orderedList[b] = orderedList[b-1]; + } + PX_ASSERT(index < numTrigs); + orderedList[index] = triangleIndices[a]; + distances[index] = toi; + count++; + } + } + } + + PxVec3 tempWorldNormal(0.f), tempWorldPoint(0.f); + + Cm::FastVertex2ShapeScaling idScale; + PxU32 ccdFaceIndex = PXC_CONTACT_NO_FACE_INDEX; + + const PxVec3 sphereCenter(lastTm1.p); + const PxF32 inSphereRadius = shape0.mFastMovingThreshold; + //PxF32 inRadSq = inSphereRadius * inSphereRadius; + + const PxVec3 sphereCenterInTransform1 = transform1.transformInv(sphereCenter); + + const PxVec3 sphereCenterInTransform0p = transform1.transformInv(lastTm0.p); + + for (PxU32 ti = 0; ti < count /*&& PxMax(minTOI, 0.f) >= distances[ti]*/; ti++) + { + const TriangleHelper convexPartOfMesh1(shapeMesh, meshScaling, orderedList[ti]); + + PxVec3 resultNormal, resultPoint; + PxTriangle localTri; + _getMeshData(shapeMesh)->getLocalTriangle(localTri, orderedList[ti], meshScaling.flipsNormal()); + + const PxVec3 v0 = meshScaling * localTri.verts[0]; + const PxVec3 v1 = meshScaling * localTri.verts[1]; + const PxVec3 v2 = meshScaling * localTri.verts[2]; + + TriangleV triangle(V3LoadU(v0), V3LoadU(v1), V3LoadU(v2)); + + //do sweep + PxReal res = SweepShapeTriangle( + *shape0.mGeometry, *shape1.mGeometry, transform0, transform1, lastTm0, lastTm1, restDistance, + resultNormal, resultPoint, Cm::FastVertex2ShapeScaling(), triangle, + 0.f); + + resultNormal = -resultNormal; + + if(res <= 0.f) + { + res = 0.f; + + const PxF32 inRad = inSphereRadius + restDistance; + const PxF32 inRadSq = inRad*inRad; + + const PxVec3 vv0 = v1 - v0; + const PxVec3 vv1 = v2 - v0; + const PxVec3 nor = vv0.cross(vv1); + + //Now we have a 0 TOI, lets see if the in-sphere hit it! + + const PxF32 distanceSq = distancePointTriangleSquared( sphereCenterInTransform1, v0, vv0, vv1); + + if(distanceSq < inRadSq) + { + const PxF32 distance = PxSqrt(distanceSq); + res = distance - inRad; + const PxF32 d = nor.dot(v0); + const PxF32 dd = nor.dot(sphereCenterInTransform0p); + if((dd - d) < 0.f) + { + //back side, penetration + res = -(2.f * inRad - distance); + } + } + PX_ASSERT(PxIsFinite(res)); + resultNormal = transform1.rotate(convexPartOfMesh1.getPolygonNormal()); + } + + if (res < minTOI) + { + tempWorldNormal = resultNormal;//convexPartOfMesh1.getPolygonNormal(0);//transform1.rotate(convexPartOfMesh1.getPolygonNormal(0)); + tempWorldPoint = resultPoint; + minTOI = res; + ccdFaceIndex = orderedList[ti]; + } + } + + worldNormal = tempWorldNormal;//transform1.rotate(tempWorldNormal); + worldPoint = tempWorldPoint; + outCCDFaceIndex = ccdFaceIndex; + return minTOI; + } +} + +/** +\brief This code performs a conservative estimate of the TOI of a shape v mesh. +*/ +PxReal SweepEstimateAnyShapeMesh(GU_SWEEP_ESTIMATE_ARGS) +{ + // this is the trimesh midphase for convex vs mesh sweep. shape0 is the convex shape. + // Get actual shape data + PX_ASSERT(shape1.mGeometry->getType()==PxGeometryType::eTRIANGLEMESH); + const PxTriangleMeshGeometry& shapeMesh = static_cast(*shape1.mGeometry); + + const PxTransform& transform0 = shape0.mCurrentTransform; + const PxTransform& lastTr0 = shape0.mPrevTransform; + const PxTransform& transform1 = shape1.mCurrentTransform; + const PxTransform& lastTr1 = shape1.mPrevTransform; + + const PxVec3 trA = transform0.p - lastTr0.p; + const PxVec3 trB = transform1.p - lastTr1.p; + + const PxVec3 relTr = trA - trB; + PxVec3 unitDir = relTr; + const PxReal length = unitDir.normalize(); + +#ifdef CCD_BASIC_PROFILING + unsigned long long time = __rdtsc(); +#endif + + if(gUseGeometryQueryEst) + { + PX_UNUSED(restDistance); + PX_UNUSED(fastMovingThreshold); + PX_UNUSED(shapeMesh); + { + PxGeomSweepHit sweepHit; + + bool status = PxGeometryQuery::sweep(unitDir, length, *shape0.mGeometry, lastTr0, *shape1.mGeometry, lastTr1, sweepHit, PxHitFlag::eDEFAULT, 0.0f, PxGeometryQueryFlag::Enum(0), NULL); +#ifdef CCD_BASIC_PROFILING + unsigned long long time2 = __rdtsc(); + printf("Time: %d\n", PxU32(time2 - time)/1024); +#endif + return status ? sweepHit.distance/length : PX_MAX_REAL; + } + } + else + { + const Cm::FastVertex2ShapeScaling meshScaling(shapeMesh.scale); + + const PxMat33 matRot(PxIdentity); + + //1) Compute the swept bounds + Box sweptBox; + computeSweptBox(sweptBox, shape0.mExtents, shape0.mCenter, matRot, unitDir, length); + + Box vertexSpaceBox; + computeVertexSpaceOBB(vertexSpaceBox, sweptBox, transform1, shapeMesh.scale); + + vertexSpaceBox.extents += PxVec3(restDistance); + + // TODO: implement a cached mode that fetches the trigs from a cache rather than per opcode if there is little motion. + + struct CB : MeshHitCallback + { + PxReal minTOI; + PxReal sumFastMovingThresh; + const PxTriangleMeshGeometry& shapeMesh; + const Cm::FastVertex2ShapeScaling& meshScaling; + const PxVec3& relTr; + const PxVec3& trA; + const PxVec3& trB; + const PxTransform& transform1; + const PxVec3& origin; + const PxVec3& extent; + + CB(PxReal aSumFast, const PxTriangleMeshGeometry& aShapeMesh, const Cm::FastVertex2ShapeScaling& aMeshScaling, + const PxVec3& aRelTr, const PxVec3& atrA, const PxVec3& atrB, const PxTransform& aTransform1, const PxVec3& aOrigin, const PxVec3& aExtent) + : MeshHitCallback(CallbackMode::eMULTIPLE), + sumFastMovingThresh(aSumFast), shapeMesh(aShapeMesh), meshScaling(aMeshScaling), relTr(aRelTr), trA(atrA), trB(atrB), + transform1(aTransform1), origin(aOrigin), extent(aExtent) + { + minTOI = PX_MAX_REAL; + } + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& hit, const PxVec3&, const PxVec3&, const PxVec3&, PxReal& shrunkMaxT, const PxU32*) + { + const TriangleHelper convexPartOfMesh1(shapeMesh, meshScaling, hit.faceIndex); + const PxVec3 resultNormal = -transform1.rotate(convexPartOfMesh1.getPolygonNormal()); + if(relTr.dot(resultNormal) >= sumFastMovingThresh) + { + PxBounds3 bounds; + convexPartOfMesh1.getBounds(bounds, transform1); + //OK, we have all 3 vertices, now calculate bounds... + + PxF32 toi = sweepAABBAABB( + origin, extent * 1.1f, bounds.getCenter(), (bounds.getExtents() + PxVec3(0.01f, 0.01f, 0.01f)) * 1.1f, trA, trB); + + minTOI = PxMin(minTOI, toi); + shrunkMaxT = minTOI; + } + + return (minTOI > 0.0f); // stop traversal if minTOI == 0.0f + } + + void operator=(const CB&) {} + }; + + const PxVec3& origin = shape0.mCenter; + const PxVec3 extent = shape0.mExtents + PxVec3(restDistance); + + CB callback(fastMovingThreshold, shapeMesh, meshScaling, relTr, trA, trB, transform1, origin, extent); + Midphase::intersectOBB(_getMeshData(shapeMesh), vertexSpaceBox, callback, true); + +#ifdef CCD_BASIC_PROFILING + unsigned long long time2 = __rdtsc(); + printf("Time: %d\n", PxU32(time2 - time)/1024); +#endif + + return callback.minTOI; + } +} + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.h new file mode 100644 index 0000000..bdc2dd5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepConvexMesh.h @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CCD_SWEEP_CONVEX_MESH_H +#define GU_CCD_SWEEP_CONVEX_MESH_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVecTransform.h" +#include "CmScaling.h" + +#define GU_TRIANGLE_SWEEP_METHOD_ARGS \ + const PxGeometry& shape0, \ + const PxGeometry& shape1, \ + const PxTransform& transform0, \ + const PxTransform& transform1, \ + const PxTransform& lastTm0, \ + const PxTransform& lastTm1, \ + PxReal restDistance, \ + PxVec3& worldNormal, \ + PxVec3& worldPoint, \ + const Cm::FastVertex2ShapeScaling& meshScaling, \ + Gu::TriangleV& triangle, \ + const PxF32 toiEstimate + +#define GU_SWEEP_METHOD_ARGS \ + const Gu::CCDShape& shape0, \ + const Gu::CCDShape& shape1, \ + const PxTransform& transform0, \ + const PxTransform& transform1, \ + const PxTransform& lastTm0, \ + const PxTransform& lastTm1, \ + PxReal restDistance, \ + PxVec3& worldNormal, \ + PxVec3& worldPoint, \ + const PxF32 toiEstimate, \ + PxU32& outCCDFaceIndex, \ + const PxReal fastMovingThreshold + +#define GU_SWEEP_ESTIMATE_ARGS \ + const CCDShape& shape0, \ + const CCDShape& shape1, \ + const PxReal restDistance, \ + const PxReal fastMovingThreshold + +#define GU_SWEEP_METHOD_ARGS_UNUSED \ + const Gu::CCDShape& /*shape0*/, \ + const Gu::CCDShape& /*shape1*/, \ + const PxTransform& /*transform0*/, \ + const PxTransform& /*transform1*/, \ + const PxTransform& /*lastTm0*/, \ + const PxTransform& /*lastTm1*/, \ + PxReal /*restDistance*/, \ + PxVec3& /*worldNormal*/, \ + PxVec3& /*worldPoint*/, \ + const PxF32 /*toiEstimate*/, \ + PxU32& /*outCCDFaceIndex*/, \ + const PxReal /*fastMovingThreshold*/ + +namespace physx +{ +namespace Gu +{ + struct CCDShape + { + const PxGeometry* mGeometry; + PxReal mFastMovingThreshold; //The CCD threshold for this shape + PxTransform mPrevTransform; //This shape's previous transform + PxTransform mCurrentTransform; //This shape's current transform + PxVec3 mExtents; //The extents of this shape's AABB + PxVec3 mCenter; //The center of this shape's AABB + PxU32 mUpdateCount; //How many times this shape has been updated in the CCD. This is correlated with the CCD body's update count. + }; + + PX_FORCE_INLINE PxF32 sweepAABBAABB(const PxVec3& centerA, const PxVec3& extentsA, const PxVec3& centerB, const PxVec3& extentsB, const PxVec3& trA, const PxVec3& trB) + { + //Sweep 2 AABBs against each other, return the TOI when they hit else PX_MAX_REAL if they don't hit + const PxVec3 cAcB = centerA - centerB; + const PxVec3 sumExtents = extentsA + extentsB; + + //Initial hit + if(PxAbs(cAcB.x) <= sumExtents.x && + PxAbs(cAcB.y) <= sumExtents.y && + PxAbs(cAcB.z) <= sumExtents.z) + return 0.f; + + //No initial hit - perform the sweep + const PxVec3 relTr = trB - trA; + PxF32 tfirst = 0.f; + PxF32 tlast = 1.f; + + const PxVec3 aMax = centerA + extentsA; + const PxVec3 aMin = centerA - extentsA; + const PxVec3 bMax = centerB + extentsB; + const PxVec3 bMin = centerB - extentsB; + + const PxF32 eps = 1e-6f; + + for(PxU32 a = 0; a < 3; ++a) + { + if(relTr[a] < -eps) + { + if(bMax[a] < aMin[a]) + return PX_MAX_REAL; + if(aMax[a] < bMin[a]) + tfirst = PxMax((aMax[a] - bMin[a])/relTr[a], tfirst); + if(bMax[a] > aMin[a]) + tlast = PxMin((aMin[a] - bMax[a])/relTr[a], tlast); + } + else if(relTr[a] > eps) + { + if(bMin[a] > aMax[a]) + return PX_MAX_REAL; + if(bMax[a] < aMin[a]) + tfirst = PxMax((aMin[a] - bMax[a])/relTr[a], tfirst); + if(aMax[a] > bMin[a]) + tlast = PxMin((aMax[a] - bMin[a])/relTr[a], tlast); + } + else + { + if(bMax[a] < aMin[a] || bMin[a] > aMax[a]) + return PX_MAX_REAL; + } + + //No hit + if(tfirst > tlast) + return PX_MAX_REAL; + } + //There was a hit so return the TOI + return tfirst; + } + + PX_PHYSX_COMMON_API PxReal SweepShapeShape(GU_SWEEP_METHOD_ARGS); + + PX_PHYSX_COMMON_API PxReal SweepEstimateAnyShapeHeightfield(GU_SWEEP_ESTIMATE_ARGS); + + PX_PHYSX_COMMON_API PxReal SweepEstimateAnyShapeMesh(GU_SWEEP_ESTIMATE_ARGS); +} +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp new file mode 100644 index 0000000..6534cc7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/ccd/GuCCDSweepPrimitives.cpp @@ -0,0 +1,384 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuVecCapsule.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecTriangle.h" +#include "GuGJKRaycast.h" +#include "GuCCDSweepConvexMesh.h" +#include "GuGJKType.h" +#include "geometry/PxSphereGeometry.h" + +//#define USE_VIRTUAL_GJK + +namespace physx +{ +namespace Gu +{ + +using namespace aos; + +template PX_FORCE_INLINE PxReal getRadius(const PxGeometry&) +{ + return 0; +} + +template<> PX_FORCE_INLINE PxReal getRadius(const PxGeometry& g) +{ + PX_ASSERT(g.getType() == PxGeometryType::eCAPSULE || g.getType() == PxGeometryType::eSPHERE); + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxSphereGeometry, radius) == PX_OFFSET_OF(PxCapsuleGeometry, radius)); + return static_cast(g).radius; +} + +#ifdef USE_VIRTUAL_GJK +static bool virtualGjkRaycastPenetration(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, + aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation, const bool initialOverlap) +{ + return gjkRaycastPenetration(a, b, initialDir, initialLambda, s, r, lambda, normal, closestA, _inflation, initialOverlap); +} +#endif + +template +static PX_FORCE_INLINE PxReal CCDSweep( ConvexA& a, ConvexB& b, const PxTransform& transform0, const PxTransform& transform1, const PxTransform& lastTm0, const PxTransform& lastTm1, + const aos::FloatV& toiEstimate, PxVec3& worldPoint, PxVec3& worldNormal, PxReal inflation = 0.0f) +{ + PX_UNUSED(toiEstimate); //KS - TODO - can we use this again? + using namespace aos; + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&lastTm0.p.x); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&lastTm1.p.x); + + const PxTransformV tr0(p0, q0); + const PxTransformV tr1(p1, q1); + + const PxMatTransformV aToB(tr1.transformInv(tr0)); + + const Vec3V trans0p = V3LoadU(transform0.p); + const Vec3V trans1p = V3LoadU(transform1.p); + const Vec3V trA = V3Sub(trans0p, p0); + const Vec3V trB = V3Sub(trans1p, p1); + const Vec3V relTr = tr1.rotateInv(V3Sub(trB, trA)); + + FloatV lambda; + Vec3V closestA, normal; + const FloatV initialLambda = FZero(); + const RelativeConvex convexA(a, aToB); + const LocalConvex convexB(b); +#ifdef USE_VIRTUAL_GJK + if(virtualGjkRaycastPenetration(convexA, convexB, aToB.p, initialLambda, V3Zero(), relTr, lambda, normal, closestA, inflation, true)) +#else + if(gjkRaycastPenetration, LocalConvex >(convexA, convexB, aToB.p, initialLambda, V3Zero(), relTr, lambda, normal, closestA, inflation, true)) +#endif + { + //Adjust closestA because it will be on the surface of convex a in its initial position (s). If the TOI > 0, we need to move + //the point along the sweep direction to get the world-space hit position. + PxF32 res; + FStore(lambda, &res); + closestA = V3ScaleAdd(trA, FMax(lambda, FZero()), tr1.transform(closestA)); + normal = tr1.rotate(normal); + + V3StoreU(normal, worldNormal); + V3StoreU(closestA, worldPoint); + return res; + } + return PX_MAX_REAL; +} + +// +// lookup table for geometry-vs-geometry sweeps +// + +PxReal UnimplementedSweep (GU_SWEEP_METHOD_ARGS_UNUSED) +{ + return PX_MAX_REAL; //no impact +} + +template +static PxReal SweepGeomGeom(GU_SWEEP_METHOD_ARGS) +{ + PX_UNUSED(outCCDFaceIndex); + PX_UNUSED(fastMovingThreshold); + + const PxGeometry& g0 = *shape0.mGeometry; + const PxGeometry& g1 = *shape1.mGeometry; + + typename ConvexGeom::Type geom0(g0); + typename ConvexGeom::Type geom1(g1); + + return CCDSweep(geom0, geom1, transform0, transform1, lastTm0, lastTm1, FLoad(toiEstimate), worldPoint, worldNormal, restDistance+getRadius(g0)+getRadius(g1) ); +} + +typedef PxReal (*SweepMethod) (GU_SWEEP_METHOD_ARGS); + +PxReal SweepAnyShapeHeightfield(GU_SWEEP_METHOD_ARGS); +PxReal SweepAnyShapeMesh(GU_SWEEP_METHOD_ARGS); + +SweepMethod g_SweepMethodTable[][PxGeometryType::eGEOMETRY_COUNT] = +{ + //PxGeometryType::eSPHERE + { + SweepGeomGeom, //PxGeometryType::eSPHERE + UnimplementedSweep, //PxGeometryType::ePLANE + SweepGeomGeom, //PxGeometryType::eCAPSULE + SweepGeomGeom, //PxGeometryType::eBOX + SweepGeomGeom, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + SweepAnyShapeMesh, //PxGeometryType::eTRIANGLEMESH + SweepAnyShapeHeightfield, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePLANE + { + 0, //PxGeometryType::eSPHERE + UnimplementedSweep, //PxGeometryType::ePLANE + UnimplementedSweep, //PxGeometryType::eCAPSULE + UnimplementedSweep, //PxGeometryType::eBOX + UnimplementedSweep, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + UnimplementedSweep, //PxGeometryType::eTRIANGLEMESH + UnimplementedSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCAPSULE + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + SweepGeomGeom, //PxGeometryType::eCAPSULE + SweepGeomGeom, //PxGeometryType::eBOX + SweepGeomGeom, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + SweepAnyShapeMesh, //PxGeometryType::eTRIANGLEMESH + SweepAnyShapeHeightfield, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eBOX + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + SweepGeomGeom, //PxGeometryType::eBOX + SweepGeomGeom, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + SweepAnyShapeMesh, //PxGeometryType::eTRIANGLEMESH + SweepAnyShapeHeightfield, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCONVEXMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + SweepGeomGeom, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + SweepAnyShapeMesh, //PxGeometryType::eTRIANGLEMESH + SweepAnyShapeHeightfield, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::ePARTICLESYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + UnimplementedSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + UnimplementedSweep, //PxGeometryType::eTRIANGLEMESH + UnimplementedSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTETRAHEDRONMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + UnimplementedSweep, //PxGeometryType::eTETRAHEDRONMESH + UnimplementedSweep, //PxGeometryType::eTRIANGLEMESH + UnimplementedSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eTRIANGLEMESH + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + UnimplementedSweep, //PxGeometryType::eTRIANGLEMESH + UnimplementedSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHEIGHTFIELD + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + UnimplementedSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eHAIRSYSTEM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + UnimplementedSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, + + //PxGeometryType::eCUSTOM + { + 0, //PxGeometryType::eSPHERE + 0, //PxGeometryType::ePLANE + 0, //PxGeometryType::eCAPSULE + 0, //PxGeometryType::eBOX + 0, //PxGeometryType::eCONVEXMESH + 0, //PxGeometryType::ePARTICLESYSTEM + 0, //PxGeometryType::eTETRAHEDRONMESH + 0, //PxGeometryType::eTRIANGLEMESH + 0, //PxGeometryType::eHEIGHTFIELD + 0, //PxGeometryType::eHAIRSYSTEM + UnimplementedSweep, //PxGeometryType::eCUSTOM + }, +}; +PX_COMPILE_TIME_ASSERT(sizeof(g_SweepMethodTable) / sizeof(g_SweepMethodTable[0]) == PxGeometryType::eGEOMETRY_COUNT); + +PxReal SweepShapeShape(GU_SWEEP_METHOD_ARGS) +{ + const PxGeometryType::Enum type0 = shape0.mGeometry->getType(); + const PxGeometryType::Enum type1 = shape1.mGeometry->getType(); + + return g_SweepMethodTable[type0][type1](shape0, shape1, transform0, transform1, lastTm0, lastTm1, + restDistance, worldNormal, worldPoint, toiEstimate, outCCDFaceIndex, fastMovingThreshold); +} + +// +// lookup table for sweeps agains triangles +// + +PxReal UnimplementedTriangleSweep(GU_TRIANGLE_SWEEP_METHOD_ARGS) +{ + PX_UNUSED(shape0); + PX_UNUSED(shape1); + PX_UNUSED(transform0); + PX_UNUSED(transform1); + PX_UNUSED(lastTm0); + PX_UNUSED(lastTm1); + PX_UNUSED(restDistance); + PX_UNUSED(worldNormal); + PX_UNUSED(worldPoint); + PX_UNUSED(meshScaling); + PX_UNUSED(triangle); + PX_UNUSED(toiEstimate); + + return 1e10f; //no impact +} + +template +PxReal SweepGeomTriangles(GU_TRIANGLE_SWEEP_METHOD_ARGS) +{ + PX_UNUSED(meshScaling); + PX_UNUSED(shape1); + + const PxGeometry& g = shape0; + //Geom geom(g); + typename ConvexGeom::Type geom(g); + + return CCDSweep(triangle, geom, transform1, transform0, lastTm1, lastTm0, FLoad(toiEstimate), worldPoint, worldNormal, restDistance+getRadius(g) ); +} + +typedef PxReal (*TriangleSweepMethod) (GU_TRIANGLE_SWEEP_METHOD_ARGS); +TriangleSweepMethod g_TriangleSweepMethodTable[] = +{ + SweepGeomTriangles, //PxGeometryType::eSPHERE + UnimplementedTriangleSweep, //PxGeometryType::ePLANE + SweepGeomTriangles, //PxGeometryType::eCAPSULE + SweepGeomTriangles, //PxGeometryType::eBOX + SweepGeomTriangles, //PxGeometryType::eCONVEXMESH + UnimplementedTriangleSweep, //PxGeometryType::ePARTICLESYSTEM + UnimplementedTriangleSweep, //PxGeometryType::eTETRAHEDRONMESH + UnimplementedTriangleSweep, //PxGeometryType::eTRIANGLEMESH + UnimplementedTriangleSweep, //PxGeometryType::eHEIGHTFIELD + UnimplementedTriangleSweep, //PxGeometryType::eHAIRSYSTEM + UnimplementedTriangleSweep, //PxGeometryType::eCUSTOM +}; +PX_COMPILE_TIME_ASSERT(sizeof(g_TriangleSweepMethodTable) / sizeof(g_TriangleSweepMethodTable[0]) == PxGeometryType::eGEOMETRY_COUNT); + +PxReal SweepShapeTriangle(GU_TRIANGLE_SWEEP_METHOD_ARGS) +{ + const PxGeometryType::Enum type0 = shape0.getType(); + const TriangleSweepMethod method = g_TriangleSweepMethodTable[type0]; + return method(shape0, shape1, transform0, transform1, lastTm0, lastTm1, restDistance, worldNormal, worldPoint, meshScaling, triangle, toiEstimate); +} + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp new file mode 100644 index 0000000..cf376bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuAdjacencies.cpp @@ -0,0 +1,662 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "GuEdgeList.h" +#include "GuAdjacencies.h" +#include "CmSerialize.h" +#include "CmRadixSort.h" + +// PT: code archeology: this initially came from ICE (IceAdjacencies.h/cpp). Consider putting it back the way it was initially. + +using namespace physx; +using namespace Gu; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +/** + * Flips the winding. + */ +void AdjTriangle::Flip() +{ +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + // Call the Triangle method + IndexedTriangle::Flip(); +#endif + + // Flip links. We flipped vertex references 1 & 2, i.e. links 0 & 1. + physx::PxSwap(mATri[0], mATri[1]); +} + +/** + * Computes the number of boundary edges in a triangle. + * \return the number of boundary edges. (0 => 3) + */ +PxU32 AdjTriangle::ComputeNbBoundaryEdges() const +{ + // Look for boundary edges + PxU32 Nb = 0; + if(IS_BOUNDARY(mATri[0])) Nb++; + if(IS_BOUNDARY(mATri[1])) Nb++; + if(IS_BOUNDARY(mATri[2])) Nb++; + return Nb; +} + +/** + * Computes the number of valid neighbors. + * \return the number of neighbors. (0 => 3) + */ +PxU32 AdjTriangle::ComputeNbNeighbors() const +{ + PxU32 Nb = 0; + if(!IS_BOUNDARY(mATri[0])) Nb++; + if(!IS_BOUNDARY(mATri[1])) Nb++; + if(!IS_BOUNDARY(mATri[2])) Nb++; + return Nb; +} + +/** + * Checks whether the triangle has a particular neighbor or not. + * \param tref [in] the triangle reference to look for + * \param index [out] the corresponding index in the triangle (NULL if not needed) + * \return true if the triangle has the given neighbor + */ +bool AdjTriangle::HasNeighbor(PxU32 tref, PxU32* index) const +{ + // ### could be optimized + if(!IS_BOUNDARY(mATri[0]) && MAKE_ADJ_TRI(mATri[0])==tref) { if(index) *index = 0; return true; } + if(!IS_BOUNDARY(mATri[1]) && MAKE_ADJ_TRI(mATri[1])==tref) { if(index) *index = 1; return true; } + if(!IS_BOUNDARY(mATri[2]) && MAKE_ADJ_TRI(mATri[2])==tref) { if(index) *index = 2; return true; } + return false; +} + +Adjacencies::Adjacencies() : mNbFaces(0), mFaces(NULL) +{ +} + +Adjacencies::~Adjacencies() +{ + PX_DELETE_ARRAY(mFaces); +} + +/** + * Computes the number of boundary edges. + * \return the number of boundary edges. + */ +PxU32 Adjacencies::ComputeNbBoundaryEdges() const +{ + if(!mFaces) + return 0; + + // Look for boundary edges + PxU32 Nb = 0; + for(PxU32 i=0;iComputeNbBoundaryEdges(); + } + return Nb; +} + +/** + * Computes the boundary vertices. A boundary vertex is defined as a vertex shared by at least one boundary edge. + * \param nb_verts [in] the number of vertices + * \param bound_status [out] a user-provided array of bool + * \return true if success. The user-array is filled with true or false (boundary vertex / not boundary vertex) + */ +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY +bool Adjacencies::GetBoundaryVertices(PxU32 nb_verts, bool* bound_status) const +#else +bool Adjacencies::GetBoundaryVertices(PxU32 nb_verts, bool* bound_status, const IndexedTriangle32* faces) const +#endif +{ + // We need the adjacencies + if(!mFaces || !bound_status || !nb_verts) + return outputError(__LINE__, "Adjacencies::GetBoundaryVertices: NULL parameter!"); + +#ifndef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + if(!faces) + return outputError(__LINE__, "Adjacencies::GetBoundaryVertices: NULL parameter!"); +#endif + + // Init + PxMemZero(bound_status, nb_verts*sizeof(bool)); + + // Loop through faces + for(PxU32 i=0;imATri[0])) + { + // Two boundary vertices: 0 - 1 +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + PxU32 VRef0 = CurTri->v[0]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = CurTri->v[1]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#else + PxU32 VRef0 = faces[i].mRef[0]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = faces[i].mRef[1]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#endif + } + if(IS_BOUNDARY(CurTri->mATri[1])) + { + // Two boundary vertices: 0 - 2 +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + PxU32 VRef0 = CurTri->v[0]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = CurTri->v[2]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#else + PxU32 VRef0 = faces[i].mRef[0]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = faces[i].mRef[2]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#endif + } + if(IS_BOUNDARY(CurTri->mATri[2])) + { + // Two boundary vertices: 1 - 2 +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + PxU32 VRef0 = CurTri->v[1]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = CurTri->v[2]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#else + PxU32 VRef0 = faces[i].mRef[1]; if(VRef0>=nb_verts) return false; bound_status[VRef0] = true; + PxU32 VRef1 = faces[i].mRef[2]; if(VRef1>=nb_verts) return false; bound_status[VRef1] = true; +#endif + } + } + + return true; +} + +/** + * Assigns a new edge code to the counterpart link of a given link. + * \param link [in] the link to modify - shouldn't be a boundary link + * \param edge_nb [in] the new edge number + */ +void Adjacencies::AssignNewEdgeCode(PxU32 link, PxU8 edge_nb) +{ + if(!IS_BOUNDARY(link)) + { + PxU32 Id = MAKE_ADJ_TRI(link); // Triangle ID + PxU32 Edge = GET_EDGE_NB(link); // Counterpart edge ID + AdjTriangle* Tri = &mFaces[Id]; // Adjacent triangle + + // Get link whose edge code is invalid + PxU32 AdjLink = Tri->mATri[Edge]; // Link to ourself (i.e. to 'link') + SET_EDGE_NB(AdjLink, edge_nb); // Assign new edge code + Tri->mATri[Edge] = AdjLink; // Put link back + } +} + +/** + * Modifies the existing database so that reference 'vref' of triangle 'curtri' becomes the last one. + * Provided reference must already exist in provided triangle. + * \param cur_tri [in] the triangle + * \param vref [in] the reference + * \return true if success. + */ +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY +bool Adjacencies::MakeLastRef(AdjTriangle& cur_tri, PxU32 vref) +#else +bool Adjacencies::MakeLastRef(AdjTriangle& cur_tri, PxU32 vref, IndexedTriangle32* cur_topo) +#endif +{ +#ifndef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + if(!cur_topo) + return outputError(__LINE__, "Adjacencies::MakeLastRef: NULL parameter!"); +#endif + // We want pattern (x y vref) + // Edge 0-1 is (x y) + // Edge 0-2 is (x vref) + // Edge 1-2 is (y vref) + + // First thing is to scroll the existing references in order for vref to become the last one. Scrolling assures winding order is conserved. + + // Edge code need fixing as well: + // The two MSB for each link encode the counterpart edge in adjacent triangle. We swap the link positions, but adjacent triangles remain the + // same. In other words, edge codes are still valid for current triangle since counterpart edges have not been swapped. *BUT* edge codes of + // the three possible adjacent triangles *are* now invalid. We need to fix edge codes, but for adjacent triangles... + +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + if(cur_tri.v[0]==vref) +#else + if(cur_topo->mRef[0]==vref) +#endif + { + // Pattern is (vref x y) + // Edge 0-1 is (vref x) + // Edge 0-2 is (vref y) + // Edge 1-2 is (x y) + + // Catch original data +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + PxU32 Ref0 = cur_tri.v[0]; PxU32 Link01 = cur_tri.mATri[0]; + PxU32 Ref1 = cur_tri.v[1]; PxU32 Link02 = cur_tri.mATri[1]; + PxU32 Ref2 = cur_tri.v[2]; PxU32 Link12 = cur_tri.mATri[2]; + + // Swap + cur_tri.v[0] = Ref1; + cur_tri.v[1] = Ref2; + cur_tri.v[2] = Ref0; +#else + PxU32 Ref0 = cur_topo->mRef[0]; PxU32 Link01 = cur_tri.mATri[0]; + PxU32 Ref1 = cur_topo->mRef[1]; PxU32 Link02 = cur_tri.mATri[1]; + PxU32 Ref2 = cur_topo->mRef[2]; PxU32 Link12 = cur_tri.mATri[2]; + + // Swap + cur_topo->mRef[0] = Ref1; + cur_topo->mRef[1] = Ref2; + cur_topo->mRef[2] = Ref0; +#endif + cur_tri.mATri[0] = Link12; // Edge 0-1 now encodes Ref1-Ref2, i.e. previous Link12 + cur_tri.mATri[1] = Link01; // Edge 0-2 now encodes Ref1-Ref0, i.e. previous Link01 + cur_tri.mATri[2] = Link02; // Edge 1-2 now encodes Ref2-Ref0, i.e. previous Link02 + + // Fix edge codes + AssignNewEdgeCode(Link01, 1); + AssignNewEdgeCode(Link02, 2); + AssignNewEdgeCode(Link12, 0); + + return true; + } +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + else if(cur_tri.v[1]==vref) +#else + else if(cur_topo->mRef[1]==vref) +#endif + { + // Pattern is (x vref y) + // Edge 0-1 is (x vref) + // Edge 0-2 is (x y) + // Edge 1-2 is (vref y) + + // Catch original data +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + PxU32 Ref0 = cur_tri.v[0]; PxU32 Link01 = cur_tri.mATri[0]; + PxU32 Ref1 = cur_tri.v[1]; PxU32 Link02 = cur_tri.mATri[1]; + PxU32 Ref2 = cur_tri.v[2]; PxU32 Link12 = cur_tri.mATri[2]; + + // Swap + cur_tri.v[0] = Ref2; + cur_tri.v[1] = Ref0; + cur_tri.v[2] = Ref1; +#else + PxU32 Ref0 = cur_topo->mRef[0]; PxU32 Link01 = cur_tri.mATri[0]; + PxU32 Ref1 = cur_topo->mRef[1]; PxU32 Link02 = cur_tri.mATri[1]; + PxU32 Ref2 = cur_topo->mRef[2]; PxU32 Link12 = cur_tri.mATri[2]; + + // Swap + cur_topo->mRef[0] = Ref2; + cur_topo->mRef[1] = Ref0; + cur_topo->mRef[2] = Ref1; +#endif + cur_tri.mATri[0] = Link02; // Edge 0-1 now encodes Ref2-Ref0, i.e. previous Link02 + cur_tri.mATri[1] = Link12; // Edge 0-2 now encodes Ref2-Ref1, i.e. previous Link12 + cur_tri.mATri[2] = Link01; // Edge 1-2 now encodes Ref0-Ref1, i.e. previous Link01 + + // Fix edge codes + AssignNewEdgeCode(Link01, 2); + AssignNewEdgeCode(Link02, 0); + AssignNewEdgeCode(Link12, 1); + + return true; + } +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + else if(cur_tri.v[2]==vref) +#else + else if(cur_topo->mRef[2]==vref) +#endif + { + // Nothing to do, provided reference already is the last one + return true; + } + + // Here the provided reference doesn't belong to the provided triangle. + return false; +} + +bool Adjacencies::Load(PxInputStream& stream) +{ + // Import header + PxU32 Version; + bool Mismatch; + if(!ReadHeader('A', 'D', 'J', 'A', Version, Mismatch, stream)) + return false; + + // Import adjacencies + mNbFaces = readDword(Mismatch, stream); + mFaces = PX_NEW(AdjTriangle)[mNbFaces]; + stream.read(mFaces, sizeof(AdjTriangle)*mNbFaces); + + return true; +} + +//#ifdef PX_COOKING + + //! An edge class used to compute the adjacency structures. + class AdjEdge : public EdgeData, public PxUserAllocated + { + public: + PX_INLINE AdjEdge() {} + PX_INLINE ~AdjEdge() {} + + PxU32 mFaceNb; //!< Owner face + }; + + /** + * Adds a new edge to the database. + * \param ref0 [in] vertex reference for the new edge + * \param ref1 [in] vertex reference for the new edge + * \param face [in] owner face + */ + static void AddEdge(PxU32 ref0, PxU32 ref1, PxU32 face, PxU32& nb_edges, AdjEdge* edges) + { + // Store edge data + edges[nb_edges].Ref0 = ref0; + edges[nb_edges].Ref1 = ref1; + edges[nb_edges].mFaceNb = face; + nb_edges++; + } + + /** + * Adds a new triangle to the database. + * \param ref0 [in] vertex reference for the new triangle + * \param ref1 [in] vertex reference for the new triangle + * \param ref2 [in] vertex reference for the new triangle + * \param id [in] triangle index + */ + static void AddTriangle(PxU32 ref0, PxU32 ref1, PxU32 ref2, PxU32 id, AdjTriangle* faces, PxU32& nb_edges, AdjEdge* edges) + { +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + // Store vertex-references + faces[id].v[0] = ref0; + faces[id].v[1] = ref1; + faces[id].v[2] = ref2; +#endif + // Reset links + faces[id].mATri[0] = PX_INVALID_U32; + faces[id].mATri[1] = PX_INVALID_U32; + faces[id].mATri[2] = PX_INVALID_U32; + + // Add edge 01 to database + if(ref0(__LINE__, "Adjacencies::UpdateLink: invalid edge reference"); + + // Update links. The two most significant bits contain the counterpart edge's ID. + faces[first_tri].mATri[EdgeNb0] = second_tri |(PxU32(EdgeNb1)<<30); + faces[second_tri].mATri[EdgeNb1] = first_tri |(PxU32(EdgeNb0)<<30); +#endif + return true; + } + + /** + * Creates the adjacency structures. + * \return true if success. + */ +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + static bool CreateDatabase(AdjTriangle* faces, PxU32 nb_edges, const AdjEdge* edges) +#else + static bool CreateDatabase(AdjTriangle* faces, PxU32 nb_edges, const AdjEdge* edges, const ADJACENCIESCREATE& create) +#endif + { + RadixSortBuffered Core; + { + // Multiple sorts - this rewritten version uses less ram + // PT: TTP 2994: the mesh has 343000+ edges, so yeah, sure, allocating more than 1mb on the stack causes overflow... + PxU32* VRefs = PX_ALLOCATE(PxU32, nb_edges, "tmp"); + + // Sort according to mRef0, then mRef1 + PxU32 i; + for(i=0;i(__LINE__, "Adjacencies::CreateDatabase: can't work on non-manifold meshes."); + } + else + { + // Here we have a new edge (LastRef0, LastRef1) shared by Count triangles stored in TmpBuffer + if(Count==2) + { + // if Count==1 => edge is a boundary edge: it belongs to a single triangle. + // Hence there's no need to update a link to an adjacent triangle. +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + if(!UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1, faces)) return false; +#else + if(!UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1, faces, create)) return false; +#endif + } + // Reset for next edge + Count = 0; + TmpBuffer[Count++] = Face; + LastRef0 = Ref0; + LastRef1 = Ref1; + } + } + bool Status = true; +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + if(Count==2) Status = UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1, faces); +#else + if(Count==2) Status = UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1, faces, create); +#endif + return Status; + } + +AdjacenciesBuilder::AdjacenciesBuilder() +{ +} + +AdjacenciesBuilder::~AdjacenciesBuilder() +{ +} + +/** + * Initializes the component. + * \param create [in] the creation structure + * \return true if success. + */ +bool AdjacenciesBuilder::Init(const ADJACENCIESCREATE& create) +{ + if(!create.NbFaces) + return false; + + // Get some bytes + mNbFaces = create.NbFaces; + mFaces = PX_NEW(AdjTriangle)[mNbFaces]; + + AdjEdge* Edges = PX_NEW(AdjEdge)[mNbFaces*3]; + PxU32 NbEdges=0; + + // Feed me with triangles..... + for(PxU32 i=0;i>30) //!< Transforms a link into a counterpart edge ID. +// #define IS_BOUNDARY(x) (x==PX_INVALID_U32) //!< Returns true for boundary edges. + #define IS_BOUNDARY(x) ((x & ADJ_TRIREF_MASK)==ADJ_TRIREF_MASK) //!< Returns true for boundary edges. + + // Forward declarations + class Adjacencies; + + enum SharedEdgeIndex + { + EDGE01 = 0, + EDGE02 = 1, + EDGE12 = 2 + }; + +/* PX_INLINE void GetEdgeIndices(SharedEdgeIndex edge_index, PxU32& id0, PxU32& id1) + { + if(edge_index==0) + { + id0 = 0; + id1 = 1; + } + else if(edge_index==1) + { + id0 = 0; + id1 = 2; + } + else if(edge_index==2) + { + id0 = 1; + id1 = 2; + } + }*/ + + //! Sets a new edge code + #define SET_EDGE_NB(link, code) \ + link&=ADJ_TRIREF_MASK; \ + link|=code<<30; \ + + //! A triangle class used to compute the adjacency structures. + class AdjTriangle +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + : public IndexedTriangle +#else + : public PxUserAllocated +#endif + { + public: + //! Constructor + PX_INLINE AdjTriangle() {} + //! Destructor + PX_INLINE ~AdjTriangle() {} + + /** + * Computes the number of boundary edges in a triangle. + * \return the number of boundary edges. (0 => 3) + */ + PxU32 ComputeNbBoundaryEdges() const; + + /** + * Computes the number of valid neighbors. + * \return the number of neighbors. (0 => 3) + */ + PxU32 ComputeNbNeighbors() const; + + /** + * Checks whether the triangle has a particular neighbor or not. + * \param tref [in] the triangle reference to look for + * \param index [out] the corresponding index in the triangle (NULL if not needed) + * \return true if the triangle has the given neighbor + */ + bool HasNeighbor(PxU32 tref, PxU32* index=NULL) const; + + /** + * Flips the winding. + */ + void Flip(); + + // Data access + PX_INLINE PxU32 GetLink(SharedEdgeIndex edge_index) const { return mATri[edge_index]; } + PX_INLINE PxU32 GetAdjTri(SharedEdgeIndex edge_index) const { return MAKE_ADJ_TRI(mATri[edge_index]); } + PX_INLINE PxU32 GetAdjEdge(SharedEdgeIndex edge_index) const { return GET_EDGE_NB(mATri[edge_index]); } + PX_INLINE PxIntBool IsBoundaryEdge(SharedEdgeIndex edge_index) const { return IS_BOUNDARY(mATri[edge_index]); } +#ifdef MSH_ADJACENCIES_INCLUDE_CONVEX_BITS + PX_INLINE PxIntBool HasActiveEdge01() const { return PxIntBool(IS_CONVEX_EDGE(mATri[EDGE01])); } + PX_INLINE PxIntBool HasActiveEdge20() const { return PxIntBool(IS_CONVEX_EDGE(mATri[EDGE02])); } + PX_INLINE PxIntBool HasActiveEdge12() const { return PxIntBool(IS_CONVEX_EDGE(mATri[EDGE12])); } + PX_INLINE PxIntBool HasActiveEdge(PxU32 i) const { return PxIntBool(IS_CONVEX_EDGE(mATri[i])); } +#endif +// private: + //! Links/References of adjacent triangles. The 2 most significant bits contains the counterpart edge in the adjacent triangle. + //! mATri[0] refers to edge 0-1 + //! mATri[1] refers to edge 0-2 + //! mATri[2] refers to edge 1-2 + PxU32 mATri[3]; + }; + + //! The adjacencies creation structure. + struct ADJACENCIESCREATE + { + //! Constructor + ADJACENCIESCREATE() : NbFaces(0), DFaces(NULL), WFaces(NULL) + { +#ifdef MSH_ADJACENCIES_INCLUDE_CONVEX_BITS + Verts = NULL; + Epsilon = 0.1f; +// Epsilon = 0.001f; +#endif + } + + PxU32 NbFaces; //!< Number of faces in source topo + const PxU32* DFaces; //!< List of faces (dwords) or NULL + const PxU16* WFaces; //!< List of faces (words) or NULL +#ifdef MSH_ADJACENCIES_INCLUDE_CONVEX_BITS + const PxVec3* Verts; + float Epsilon; +#endif + }; + + class Adjacencies : public PxUserAllocated + { + public: + Adjacencies(); + ~Adjacencies(); + + PxU32 mNbFaces; //!< Number of faces involved in the computation. + AdjTriangle* mFaces; //!< A list of AdjTriangles (one/face) + + bool Load(PxInputStream& stream); + // Basic mesh walking + PX_INLINE const AdjTriangle* GetAdjacentFace(const AdjTriangle& current_tri, SharedEdgeIndex edge_nb) const + { + // No checkings here, make sure mFaces has been created + + // Catch the link + PxU32 Link = current_tri.GetLink(edge_nb); + + // Returns NULL for boundary edges + if(IS_BOUNDARY(Link)) return NULL; + + // Else transform into face index + PxU32 Id = MAKE_ADJ_TRI(Link); + + // Possible counterpart edge is: + // PxU32 Edge = GET_EDGE_NB(Link); + + // And returns adjacent triangle + return &mFaces[Id]; + } + // Helpers + PxU32 ComputeNbBoundaryEdges() const; +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + bool GetBoundaryVertices(PxU32 nb_verts, bool* bound_status) const; +#else + bool GetBoundaryVertices(PxU32 nb_verts, bool* bound_status, const IndexedTriangle32* faces) const; +#endif + // +#ifdef MSH_ADJACENCIES_INCLUDE_TOPOLOGY + bool MakeLastRef(AdjTriangle& cur_tri, PxU32 vref); +#else + bool MakeLastRef(AdjTriangle& cur_tri, PxU32 vref, IndexedTriangle32* cur_topo); +#endif + private: + // New edge codes assignment + void AssignNewEdgeCode(PxU32 link, PxU8 edge_nb); + }; + +//#ifdef PX_COOKING + class AdjacenciesBuilder : public Adjacencies + { + public: + AdjacenciesBuilder(); + ~AdjacenciesBuilder(); + + bool Init(const ADJACENCIESCREATE& create); +// bool Save(Stream& stream) const; + }; +//#endif +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp new file mode 100644 index 0000000..696f3bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.cpp @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "GuBarycentricCoordinates.h" + +using namespace physx; +using namespace aos; + +void Gu::barycentricCoordinates(const Vec3VArg p, const Vec3VArg a, const Vec3VArg b, FloatV& v) +{ + const Vec3V v0 = V3Sub(a, p); + const Vec3V v1 = V3Sub(b, p); + const Vec3V d = V3Sub(v1, v0); + const FloatV denominator = V3Dot(d, d); + const FloatV numerator = V3Dot(V3Neg(v0), d); + const FloatV zero = FZero(); + const FloatV denom = FSel(FIsGrtr(denominator, zero), FRecip(denominator), zero); + v = FMul(numerator, denom); +} + +void Gu::barycentricCoordinates(const aos::Vec3VArg p, const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c, aos::FloatV& v, aos::FloatV& w) +{ + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + + const Vec3V n = V3Cross(ab, ac); + + const VecCrossV crossA = V3PrepareCross(V3Sub(a, p)); + const VecCrossV crossB = V3PrepareCross(V3Sub(b, p)); + const VecCrossV crossC = V3PrepareCross(V3Sub(c, p)); + const Vec3V bCrossC = V3Cross(crossB, crossC); + const Vec3V cCrossA = V3Cross(crossC, crossA); + const Vec3V aCrossB = V3Cross(crossA, crossB); + + const FloatV va = V3Dot(n, bCrossC);//edge region of BC, signed area rbc, u = S(rbc)/S(abc) for a + const FloatV vb = V3Dot(n, cCrossA);//edge region of AC, signed area rac, v = S(rca)/S(abc) for b + const FloatV vc = V3Dot(n, aCrossB);//edge region of AB, signed area rab, w = S(rab)/S(abc) for c + const FloatV totalArea =FAdd(va, FAdd(vb, vc)); + const FloatV zero = FZero(); + const FloatV denom = FSel(FIsEq(totalArea, zero), zero, FRecip(totalArea)); + v = FMul(vb, denom); + w = FMul(vc, denom); + +} + +/* + v0 = b - a; + v1 = c - a; + v2 = p - a; +*/ +void Gu::barycentricCoordinates(const Vec3VArg v0, const Vec3VArg v1, const Vec3VArg v2, FloatV& v, FloatV& w) +{ + const FloatV d00 = V3Dot(v0, v0); + const FloatV d01 = V3Dot(v0, v1); + const FloatV d11 = V3Dot(v1, v1); + const FloatV d20 = V3Dot(v2, v0); + const FloatV d21 = V3Dot(v2, v1); + const FloatV denom = FRecip(FSub(FMul(d00,d11), FMul(d01, d01))); + v = FMul(FSub(FMul(d11, d20), FMul(d01, d21)), denom); + w = FMul(FSub(FMul(d00, d21), FMul(d01, d20)), denom); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.h new file mode 100644 index 0000000..008e3cf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBarycentricCoordinates.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BARYCENTRIC_COORDINATES_H +#define GU_BARYCENTRIC_COORDINATES_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Gu +{ + //calculate the barycentric coorinates for a point in a segment + void barycentricCoordinates(const aos::Vec3VArg p, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + aos::FloatV& v); + + //calculate the barycentric coorinates for a point in a triangle + void barycentricCoordinates(const aos::Vec3VArg p, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + const aos::Vec3VArg c, + aos::FloatV& v, + aos::FloatV& w); + + void barycentricCoordinates(const aos::Vec3VArg v0, + const aos::Vec3VArg v1, + const aos::Vec3VArg v2, + aos::FloatV& v, + aos::FloatV& w); + + PX_INLINE aos::BoolV isValidTriangleBarycentricCoord(const aos::FloatVArg v, const aos::FloatVArg w) + { + using namespace aos; + const FloatV zero = FNeg(FEps()); + const FloatV one = FAdd(FOne(), FEps()); + + const BoolV con0 = BAnd(FIsGrtrOrEq(v, zero), FIsGrtrOrEq(one, v)); + const BoolV con1 = BAnd(FIsGrtrOrEq(w, zero), FIsGrtrOrEq(one, w)); + const BoolV con2 = FIsGrtr(one, FAdd(v, w)); + return BAnd(con0, BAnd(con1, con2)); + } + + PX_INLINE aos::BoolV isValidTriangleBarycentricCoord2(const aos::Vec4VArg vwvw) + { + using namespace aos; + const Vec4V eps = V4Splat(FEps()); + const Vec4V zero =V4Neg(eps); + const Vec4V one = V4Add(V4One(), eps); + + const Vec4V v0v1v0v1 = V4PermXZXZ(vwvw); + const Vec4V w0w1w0w1 = V4PermYWYW(vwvw); + + const BoolV con0 = BAnd(V4IsGrtrOrEq(v0v1v0v1, zero), V4IsGrtrOrEq(one, v0v1v0v1)); + const BoolV con1 = BAnd(V4IsGrtrOrEq(w0w1w0w1, zero), V4IsGrtrOrEq(one, w0w1w0w1)); + const BoolV con2 = V4IsGrtr(one, V4Add(v0v1v0v1, w0w1w0w1)); + return BAnd(con0, BAnd(con1, con2)); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBoxConversion.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBoxConversion.h new file mode 100644 index 0000000..07bb516 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuBoxConversion.h @@ -0,0 +1,120 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BOX_CONVERSION_H +#define GU_BOX_CONVERSION_H + +#include "GuBox.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxMat34.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ + // PT: builds rot from quat. WARNING: writes 4 bytes after 'dst.rot'. + PX_FORCE_INLINE void buildFrom(Gu::Box& dst, const PxQuat& q) + { + using namespace aos; + const QuatV qV = V4LoadU(&q.x); + Vec3V column0, column1, column2; + QuatGetMat33V(qV, column0, column1, column2); + // PT: TODO: investigate if these overlapping stores are a problem + V4StoreU(Vec4V_From_Vec3V(column0), &dst.rot.column0.x); + V4StoreU(Vec4V_From_Vec3V(column1), &dst.rot.column1.x); + V4StoreU(Vec4V_From_Vec3V(column2), &dst.rot.column2.x); + } + + PX_FORCE_INLINE void buildFrom(Gu::Box& dst, const PxVec3& center, const PxVec3& extents, const PxQuat& q) + { + using namespace aos; + // PT: writes 4 bytes after 'rot' but it's safe since we then write 'center' just afterwards + buildFrom(dst, q); + dst.center = center; + dst.extents = extents; + } + + PX_FORCE_INLINE void buildMatrixFromBox(PxMat34& mat34, const Gu::Box& box) + { + mat34.m = box.rot; + mat34.p = box.center; + } + + // SD: function is now the same as FastVertex2ShapeScaling::transformQueryBounds + // PT: lots of LHS in that one. TODO: revisit... + PX_INLINE Gu::Box transform(const PxMat34& transfo, const Gu::Box& box) + { + Gu::Box ret; + PxMat33& obbBasis = ret.rot; + + obbBasis.column0 = transfo.rotate(box.rot.column0 * box.extents.x); + obbBasis.column1 = transfo.rotate(box.rot.column1 * box.extents.y); + obbBasis.column2 = transfo.rotate(box.rot.column2 * box.extents.z); + + ret.center = transfo.transform(box.center); + ret.extents = PxOptimizeBoundingBox(obbBasis); + return ret; + } + + PX_INLINE Gu::Box transformBoxOrthonormal(const Gu::Box& box, const PxTransform& t) + { + Gu::Box ret; + PxMat33& obbBasis = ret.rot; + obbBasis.column0 = t.rotate(box.rot.column0); + obbBasis.column1 = t.rotate(box.rot.column1); + obbBasis.column2 = t.rotate(box.rot.column2); + ret.center = t.transform(box.center); + ret.extents = box.extents; + return ret; + } + + /** + \brief recomputes the OBB after an arbitrary transform by a 4x4 matrix. + \param mtx [in] the transform matrix + \param obb [out] the transformed OBB + */ + PX_INLINE void rotate(const Gu::Box& src, const PxMat34& mtx, Gu::Box& obb) + { + // The extents remain constant + obb.extents = src.extents; + // The center gets x-formed + obb.center = mtx.transform(src.center); + // Combine rotations + obb.rot = mtx.m * src.rot; + } + +// PT: TODO: move this to a better place + PX_FORCE_INLINE void getInverse(PxMat33& dstRot, PxVec3& dstTrans, const PxMat33& srcRot, const PxVec3& srcTrans) + { + const PxMat33 invRot = srcRot.getInverse(); + dstTrans = invRot.transform(-srcTrans); + dstRot = invRot; + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeCache.h new file mode 100644 index 0000000..90d75f4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeCache.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_EDGECACHE_H +#define GU_EDGECACHE_H + +#include "foundation/PxMemory.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxHash.h" + +namespace physx +{ +namespace Gu +{ + class EdgeCache + { +#define NUM_EDGES_IN_CACHE 64 //must be power of 2. 32 lines result in 10% extra work (due to cache misses), 64 lines in 6% extra work, 128 lines in 4%. + public: + EdgeCache() + { + PxMemZero(cacheLines, NUM_EDGES_IN_CACHE*sizeof(CacheLine)); + } + + PxU32 hash(PxU32 key) const + { + return (NUM_EDGES_IN_CACHE - 1) & PxComputeHash(key); //Only a 16 bit hash would be needed here. + } + + bool isInCache(PxU8 vertex0, PxU8 vertex1) + { + PX_ASSERT(vertex1 >= vertex0); + PxU16 key = PxU16((vertex0 << 8) | vertex1); + PxU32 h = hash(key); + CacheLine& cl = cacheLines[h]; + if (cl.fullKey == key) + { + return true; + } + else //cache the line now as it's about to be processed + { + cl.fullKey = key; + return false; + } + } + + private: + struct CacheLine + { + PxU16 fullKey; + }; + CacheLine cacheLines[NUM_EDGES_IN_CACHE]; +#undef NUM_EDGES_IN_CACHE + }; +} + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp new file mode 100644 index 0000000..2334d79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuEdgeList.cpp @@ -0,0 +1,719 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "geometry/PxTriangle.h" +#include "GuEdgeList.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxPlane.h" +#include "CmRadixSort.h" +#include "CmSerialize.h" + +// PT: code archeology: this initially came from ICE (IceEdgeList.h/cpp). Consider putting it back the way it was initially. +// It makes little sense that something like EdgeList is in GeomUtils but some equivalent class like Adjacencies in is Cooking. + +using namespace physx; +using namespace Gu; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +EdgeList::EdgeList() : + mNbEdges (0), + mEdges (NULL), + mNbFaces (0), + mEdgeFaces (NULL), + mEdgeToTriangles (NULL), + mFacesByEdges (NULL) +{ +} + +EdgeList::~EdgeList() +{ + PX_FREE(mFacesByEdges); + PX_FREE(mEdgeToTriangles); + PX_FREE(mEdges); + PX_FREE(mEdgeFaces); +} + +bool EdgeList::load(PxInputStream& stream) +{ + // Import header + PxU32 Version; + bool Mismatch; + if(!ReadHeader('E', 'D', 'G', 'E', Version, Mismatch, stream)) + return false; + + // Import edges + mNbEdges = readDword(Mismatch, stream); + mEdges = PX_ALLOCATE(EdgeData, mNbEdges, "EdgeData"); + stream.read(mEdges, sizeof(EdgeData)*mNbEdges); + + mNbFaces = readDword(Mismatch, stream); + mEdgeFaces = PX_ALLOCATE(EdgeTriangleData, mNbFaces, "EdgeTriangleData"); + stream.read(mEdgeFaces, sizeof(EdgeTriangleData)*mNbFaces); + + mEdgeToTriangles = PX_ALLOCATE(EdgeDescData, mNbEdges, "EdgeDescData"); + stream.read(mEdgeToTriangles, sizeof(EdgeDescData)*mNbEdges); + + PxU32 LastOffset = mEdgeToTriangles[mNbEdges-1].Offset + mEdgeToTriangles[mNbEdges-1].Count; + mFacesByEdges = PX_ALLOCATE(PxU32, LastOffset, "EdgeList FacesByEdges"); + stream.read(mFacesByEdges, sizeof(PxU32)*LastOffset); + + return true; +} + +/** + * Initializes the edge-list. + * \param create [in] edge-list creation structure + * \return true if success. + */ +bool EdgeList::init(const EDGELISTCREATE& create) +{ + const bool FacesToEdges = create.Verts ? true : create.FacesToEdges; + const bool EdgesToFaces = create.Verts ? true : create.EdgesToFaces; + + // "FacesToEdges" maps each face to three edges. + if(FacesToEdges && !createFacesToEdges(create.NbFaces, create.DFaces, create.WFaces)) + return false; + + // "EdgesToFaces" maps each edge to the set of faces sharing this edge + if(EdgesToFaces && !createEdgesToFaces(create.NbFaces, create.DFaces, create.WFaces)) + return false; + + // Create active edges + if(create.Verts && !computeActiveEdges(create.NbFaces, create.DFaces, create.WFaces, create.Verts, create.Epsilon)) + return false; + + // Get rid of useless data + if(!create.FacesToEdges) + PX_FREE(mEdgeFaces); + + if(!create.EdgesToFaces) + { + PX_FREE(mEdgeToTriangles); + PX_FREE(mFacesByEdges); + } + + return true; +} + +/** + * Computes FacesToEdges. + * After the call: + * - mNbEdges is updated with the number of non-redundant edges + * - mEdges is a list of mNbEdges edges (one edge is 2 vertex-references) + * - mEdgesRef is a list of nbfaces structures with 3 indexes in mEdges for each face + * + * \param nb_faces [in] a number of triangles + * \param dfaces [in] list of triangles with PxU32 vertex references (or NULL) + * \param wfaces [in] list of triangles with PxU16 vertex references (or NULL) + * \return true if success. + */ +bool EdgeList::createFacesToEdges(PxU32 nb_faces, const PxU32* dfaces, const PxU16* wfaces) +{ + if(!nb_faces || (!dfaces && !wfaces)) + return outputError(__LINE__, "EdgeList::CreateFacesToEdges: NULL parameter!"); + + if(mEdgeFaces) + return true; // Already computed! + + // 1) Get some bytes: I need one EdgesRefs for each face, and some temp buffers + mEdgeFaces = PX_ALLOCATE(EdgeTriangleData, nb_faces, "mEdgeFaces"); // Link faces to edges + PxU32* VRefs0 = PX_ALLOCATE(PxU32, nb_faces*3, "Tmp"); // Temp storage + PxU32* VRefs1 = PX_ALLOCATE(PxU32, nb_faces*3, "Tmp"); // Temp storage + EdgeData* Buffer = PX_ALLOCATE(EdgeData, nb_faces*3, "Tmp"); // Temp storage + + // 2) Create a full redundant list of 3 edges / face. + for(PxU32 i=0;i stored in temp buffer + Buffer[mNbEdges].Ref0 = SortedRef0; + Buffer[mNbEdges].Ref1 = SortedRef1; + mNbEdges++; + } + PreviousRef0 = SortedRef0; + PreviousRef1 = SortedRef1; + + // Create mEdgesRef on the fly + mEdgeFaces[Face/3].mLink[ID] = mNbEdges-1; + } + + // 5) Here, mNbEdges==#non redundant edges + mEdges = PX_ALLOCATE(EdgeData, mNbEdges, "EdgeData"); + + // Create real edges-list. + PxMemCopy(mEdges, Buffer, mNbEdges*sizeof(EdgeData)); + + // 6) Free ram and exit + PX_FREE(Buffer); + PX_FREE(VRefs1); + PX_FREE(VRefs0); + + return true; +} + +/** + * Computes EdgesToFaces. + * After the call: + * - mEdgeToTriangles is created + * - mFacesByEdges is created + * + * \param nb_faces [in] a number of triangles + * \param dfaces [in] list of triangles with PxU32 vertex references (or NULL) + * \param wfaces [in] list of triangles with PxU16 vertex references (or NULL) + * \return true if success. + */ +bool EdgeList::createEdgesToFaces(PxU32 nb_faces, const PxU32* dfaces, const PxU16* wfaces) +{ + // 1) I need FacesToEdges ! + if(!createFacesToEdges(nb_faces, dfaces, wfaces)) + return false; + + // 2) Get some bytes: one Pair structure / edge + mEdgeToTriangles = PX_ALLOCATE(EdgeDescData, mNbEdges, "EdgeDescData"); + PxMemZero(mEdgeToTriangles, sizeof(EdgeDescData)*mNbEdges); + + // 3) Create Counters, ie compute the #faces sharing each edge + for(PxU32 i=0;i(__LINE__, "EdgeList::ComputeActiveEdges: NULL parameter!"); + + PxU32 NbEdges = getNbEdges(); + if(!NbEdges) + return outputError(__LINE__, "ActiveEdges::ComputeConvexEdges: no edges in edge list!"); + + const EdgeData* Edges = getEdges(); + if(!Edges) + return outputError(__LINE__, "ActiveEdges::ComputeConvexEdges: no edge data in edge list!"); + + const EdgeDescData* ED = getEdgeToTriangles(); + if(!ED) + return outputError(__LINE__, "ActiveEdges::ComputeConvexEdges: no edge-to-triangle in edge list!"); + + const PxU32* FBE = getFacesByEdges(); + if(!FBE) + return outputError(__LINE__, "ActiveEdges::ComputeConvexEdges: no faces-by-edges in edge list!"); + + // We first create active edges in a temporaray buffer. We have one bool / edge. + bool* ActiveEdges = PX_ALLOCATE(bool, NbEdges, "bool"); + + // Loop through edges and look for convex ones + bool* CurrentMark = ActiveEdges; + + while(NbEdges--) + { + // Get number of triangles sharing current edge + const PxU32 Count = ED->Count; + // Boundary edges are active => keep them (actually they're silhouette edges directly) + // Internal edges can be active => test them + // Singular edges ? => discard them + bool Active = false; + if(Count==1) + { + Active = true; + } + else if(Count==2) + { + const PxU32 FaceIndex0 = FBE[ED->Offset+0]*3; + const PxU32 FaceIndex1 = FBE[ED->Offset+1]*3; + + PxU32 VRef00, VRef01, VRef02; + PxU32 VRef10, VRef11, VRef12; + + if(dfaces) + { + VRef00 = dfaces[FaceIndex0+0]; + VRef01 = dfaces[FaceIndex0+1]; + VRef02 = dfaces[FaceIndex0+2]; + VRef10 = dfaces[FaceIndex1+0]; + VRef11 = dfaces[FaceIndex1+1]; + VRef12 = dfaces[FaceIndex1+2]; + } + else //if(wfaces) + { + PX_ASSERT(wfaces); + VRef00 = wfaces[FaceIndex0+0]; + VRef01 = wfaces[FaceIndex0+1]; + VRef02 = wfaces[FaceIndex0+2]; + VRef10 = wfaces[FaceIndex1+0]; + VRef11 = wfaces[FaceIndex1+1]; + VRef12 = wfaces[FaceIndex1+2]; + } + + { + // We first check the opposite vertex against the plane + + const PxU32 Op = OppositeVertex(VRef00, VRef01, VRef02, Edges->Ref0, Edges->Ref1); + + const PxPlane PL1(verts[VRef10], verts[VRef11], verts[VRef12]); + + if(PL1.distance(verts[Op])<0.0f) // If opposite vertex is below the plane, i.e. we discard concave edges + { + const PxTriangle T0(verts[VRef00], verts[VRef01], verts[VRef02]); + const PxTriangle T1(verts[VRef10], verts[VRef11], verts[VRef12]); + + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + const float a = PxComputeAngle(N0, N1); + + if(fabsf(a)>epsilon) + Active = true; + } + else + { + const PxTriangle T0(verts[VRef00], verts[VRef01], verts[VRef02]); + const PxTriangle T1(verts[VRef10], verts[VRef11], verts[VRef12]); + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + + if(N0.dot(N1) < -0.999f) + Active = true; + } +//Active = true; + } + + } + else + { + //Connected to more than 2 + //We need to loop through the triangles and count the number of unique triangles (considering back-face triangles as non-unique). If we end up with more than 2 unique triangles, + //then by definition this is an inactive edge. However, if we end up with 2 unique triangles (say like a double-sided tesselated surface), then it depends on the same rules as above + + const PxU32 FaceInd0 = FBE[ED->Offset]*3; + PxU32 VRef00, VRef01, VRef02; + PxU32 VRef10=0, VRef11=0, VRef12=0; + if(dfaces) + { + VRef00 = dfaces[FaceInd0+0]; + VRef01 = dfaces[FaceInd0+1]; + VRef02 = dfaces[FaceInd0+2]; + } + else //if(wfaces) + { + PX_ASSERT(wfaces); + VRef00 = wfaces[FaceInd0+0]; + VRef01 = wfaces[FaceInd0+1]; + VRef02 = wfaces[FaceInd0+2]; + } + + PxU32 numUniqueTriangles = 1; + bool doubleSided0 = false; + bool doubleSided1 = 0; + + for(PxU32 a = 1; a < Count; ++a) + { + const PxU32 FaceInd = FBE[ED->Offset+a]*3; + + PxU32 VRef0, VRef1, VRef2; + if(dfaces) + { + VRef0 = dfaces[FaceInd+0]; + VRef1 = dfaces[FaceInd+1]; + VRef2 = dfaces[FaceInd+2]; + } + else //if(wfaces) + { + PX_ASSERT(wfaces); + VRef0 = wfaces[FaceInd+0]; + VRef1 = wfaces[FaceInd+1]; + VRef2 = wfaces[FaceInd+2]; + } + + if(((VRef0 != VRef00) && (VRef0 != VRef01) && (VRef0 != VRef02)) || + ((VRef1 != VRef00) && (VRef1 != VRef01) && (VRef1 != VRef02)) || + ((VRef2 != VRef00) && (VRef2 != VRef01) && (VRef2 != VRef02))) + { + //Not the same as trig 0 + if(numUniqueTriangles == 2) + { + if(((VRef0 != VRef10) && (VRef0 != VRef11) && (VRef0 != VRef12)) || + ((VRef1 != VRef10) && (VRef1 != VRef11) && (VRef1 != VRef12)) || + ((VRef2 != VRef10) && (VRef2 != VRef11) && (VRef2 != VRef12))) + { + //Too many unique triangles - terminate and mark as inactive + numUniqueTriangles++; + break; + } + else + { + const PxTriangle T0(verts[VRef10], verts[VRef11], verts[VRef12]); + const PxTriangle T1(verts[VRef0], verts[VRef1], verts[VRef2]); + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + + if(N0.dot(N1) < -0.999f) + doubleSided1 = true; + } + } + else + { + VRef10 = VRef0; + VRef11 = VRef1; + VRef12 = VRef2; + numUniqueTriangles++; + } + } + else + { + //Check for double sided... + const PxTriangle T0(verts[VRef00], verts[VRef01], verts[VRef02]); + const PxTriangle T1(verts[VRef0], verts[VRef1], verts[VRef2]); + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + + if(N0.dot(N1) < -0.999f) + doubleSided0 = true; + } + } + + if(numUniqueTriangles == 1) + Active = true; + if(numUniqueTriangles == 2) + { + //Potentially active. Let's check the angles between the surfaces... + + if(doubleSided0 || doubleSided1) + { + + // Plane PL1 = faces[FBE[ED->Offset+1]].PlaneEquation(verts); + const PxPlane PL1(verts[VRef10], verts[VRef11], verts[VRef12]); + + // if(PL1.Distance(verts[Op])<-epsilon) Active = true; + //if(PL1.distance(verts[Op])<0.0f) // If opposite vertex is below the plane, i.e. we discard concave edges + //KS - can't test signed distance for concave edges. This is a double-sided poly + { + const PxTriangle T0(verts[VRef00], verts[VRef01], verts[VRef02]); + const PxTriangle T1(verts[VRef10], verts[VRef11], verts[VRef12]); + + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + const float a = PxComputeAngle(N0, N1); + + if(fabsf(a)>epsilon) + Active = true; + } + } + else + { + + //Not double sided...must have had a bunch of duplicate triangles!!!! + //Treat as normal + const PxU32 Op = OppositeVertex(VRef00, VRef01, VRef02, Edges->Ref0, Edges->Ref1); + + // Plane PL1 = faces[FBE[ED->Offset+1]].PlaneEquation(verts); + const PxPlane PL1(verts[VRef10], verts[VRef11], verts[VRef12]); + + // if(PL1.Distance(verts[Op])<-epsilon) Active = true; + if(PL1.distance(verts[Op])<0.0f) // If opposite vertex is below the plane, i.e. we discard concave edges + { + const PxTriangle T0(verts[VRef00], verts[VRef01], verts[VRef02]); + const PxTriangle T1(verts[VRef10], verts[VRef11], verts[VRef12]); + + PxVec3 N0, N1; + T0.normal(N0); + T1.normal(N1); + const float a = PxComputeAngle(N0, N1); + + if(fabsf(a)>epsilon) + Active = true; + } + } + } + else + { + //Lots of triangles all smooshed together. Just activate the edge in this case + Active = true; + } + + } + + *CurrentMark++ = Active; + ED++; + Edges++; + } + + // Now copy bits back into already existing edge structures + // - first in edge triangles + for(PxU32 i=0;iMaxIndex) MaxIndex = VRef0; + if(VRef1>MaxIndex) MaxIndex = VRef1; + if(VRef2>MaxIndex) MaxIndex = VRef2; + } + + MaxIndex++; + bool* ActiveVerts = PX_ALLOCATE(bool, MaxIndex, "bool"); + PxMemZero(ActiveVerts, MaxIndex*sizeof(bool)); + + PX_ASSERT(dfaces || wfaces); + for(PxU32 i=0;i mark edge vertices as active + PxU32 r0, r1; + if(j==0) { r0=0; r1=1; } + else if(j==1) { r0=1; r1=2; } + else /*if(j==2)*/ { PX_ASSERT(j==2); r0=0; r1=2; } + ActiveVerts[VRef[r0]] = ActiveVerts[VRef[r1]] = true; + } + } + } + +/* for(PxU32 i=0;i mark edge vertices as inactive + PxU32 r0, r1; + if(j==0) { r0=0; r1=1; } + if(j==1) { r0=1; r1=2; } + if(j==2) { r0=0; r1=2; } + ActiveVerts[VRef[r0]] = ActiveVerts[VRef[r1]] = false; + } + } + }*/ + + // Now stuff this into the structure + for(PxU32 i=0;itriangle mapping + struct EdgeTriangleData + { + PxU32 mLink[3]; + }; + PX_COMPILE_TIME_ASSERT(sizeof(EdgeTriangleData) == 12); + + enum + { + MSH_EDGE_LINK_MASK = 0x0fffffff, + MSH_ACTIVE_EDGE_MASK = 0x80000000, + MSH_ACTIVE_VERTEX_MASK = 0x40000000 + }; + + class EdgeTriangleAC + { + public: + PX_INLINE static PxU32 GetEdge01(const EdgeTriangleData& data) { return data.mLink[0] & MSH_EDGE_LINK_MASK; } + PX_INLINE static PxU32 GetEdge12(const EdgeTriangleData& data) { return data.mLink[1] & MSH_EDGE_LINK_MASK; } + PX_INLINE static PxU32 GetEdge20(const EdgeTriangleData& data) { return data.mLink[2] & MSH_EDGE_LINK_MASK; } + PX_INLINE static PxU32 GetEdge(const EdgeTriangleData& data, PxU32 i) { return data.mLink[i] & MSH_EDGE_LINK_MASK; } + + PX_INLINE static PxIntBool HasActiveEdge01(const EdgeTriangleData& data) { return PxIntBool(data.mLink[0] & MSH_ACTIVE_EDGE_MASK); } + PX_INLINE static PxIntBool HasActiveEdge12(const EdgeTriangleData& data) { return PxIntBool(data.mLink[1] & MSH_ACTIVE_EDGE_MASK); } + PX_INLINE static PxIntBool HasActiveEdge20(const EdgeTriangleData& data) { return PxIntBool(data.mLink[2] & MSH_ACTIVE_EDGE_MASK); } + PX_INLINE static PxIntBool HasActiveEdge(const EdgeTriangleData& data, PxU32 i) { return PxIntBool(data.mLink[i] & MSH_ACTIVE_EDGE_MASK); } + }; + + //! The edge-list creation structure. + struct EDGELISTCREATE + { + EDGELISTCREATE() : + NbFaces (0), + DFaces (NULL), + WFaces (NULL), + FacesToEdges (false), + EdgesToFaces (false), + Verts (NULL), + Epsilon (0.1f) + {} + + PxU32 NbFaces; //!< Number of faces in source topo + const PxU32* DFaces; //!< List of faces (dwords) or NULL + const PxU16* WFaces; //!< List of faces (words) or NULL + + bool FacesToEdges; + bool EdgesToFaces; + const PxVec3* Verts; + float Epsilon; + }; + + class EdgeList : public PxUserAllocated + { + public: + PX_PHYSX_COMMON_API EdgeList(); + PX_PHYSX_COMMON_API ~EdgeList(); + + PX_PHYSX_COMMON_API bool init(const EDGELISTCREATE& create); + + bool load(PxInputStream& stream); + + PX_FORCE_INLINE PxU32 getNbEdges() const { return mNbEdges; } + PX_FORCE_INLINE const EdgeData* getEdges() const { return mEdges; } + PX_FORCE_INLINE const EdgeData& getEdge(PxU32 edge_index) const { return mEdges[edge_index]; } + + PX_FORCE_INLINE PxU32 getNbFaces() const { return mNbFaces; } + PX_FORCE_INLINE const EdgeTriangleData* getEdgeTriangles() const { return mEdgeFaces; } + PX_FORCE_INLINE const EdgeTriangleData& getEdgeTriangle(PxU32 face_index) const { return mEdgeFaces[face_index]; } + + PX_FORCE_INLINE const EdgeDescData* getEdgeToTriangles() const { return mEdgeToTriangles; } + PX_FORCE_INLINE const EdgeDescData& getEdgeToTriangles(PxU32 edge_index) const { return mEdgeToTriangles[edge_index]; } + PX_FORCE_INLINE const PxU32* getFacesByEdges() const { return mFacesByEdges; } + PX_FORCE_INLINE PxU32 getFacesByEdges(PxU32 face_index) const { return mFacesByEdges[face_index]; } + + private: + // The edge list + PxU32 mNbEdges; //!< Number of edges in the list + EdgeData* mEdges; //!< List of edges + // Faces to edges + PxU32 mNbFaces; //!< Number of faces for which we have data + EdgeTriangleData* mEdgeFaces; //!< Array of edge-triangles referencing mEdges + // Edges to faces + EdgeDescData* mEdgeToTriangles; //!< An EdgeDesc structure for each edge + PxU32* mFacesByEdges; //!< A pool of face indices + + bool createFacesToEdges(PxU32 nb_faces, const PxU32* dfaces, const PxU16* wfaces); + bool createEdgesToFaces(PxU32 nb_faces, const PxU32* dfaces, const PxU16* wfaces); + bool computeActiveEdges(PxU32 nb_faces, const PxU32* dfaces, const PxU16* wfaces, const PxVec3* verts, float epsilon); + }; + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp new file mode 100644 index 0000000..37beeb2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.cpp @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "foundation/PxArray.h" +#include "GuMeshAnalysis.h" + +using namespace physx; +using namespace Gu; + +PX_FORCE_INLINE PxU64 key(PxI32 a, PxI32 b) +{ + if (a < b) + return ((PxU64(a)) << 32) | (PxU64(b)); + else + return ((PxU64(b)) << 32) | (PxU64(a)); +} + +#define INITIAL_VALUE -3 + +const static PxU32 neighborEdges[3][2] = { { 0, 1 }, { 2, 0 }, { 1, 2 } }; +//const static PxU32 triTip[3] = { 2, 1, 0 }; +bool MeshAnalyzer::buildTriangleAdjacency(const Triangle* tris, PxU32 numTriangles, PxArray& result, PxHashMap& edges) +{ + PxU32 l = 4 * numTriangles; //Still factor 4 - waste one entry per triangle to get a power of 2 which allows for bit shift usage instead of modulo + result.clear(); + result.resize(l, -1); + + for (PxU32 i = 3; i < l; i += 4) + result[i] = INITIAL_VALUE; //Mark the fields that get never accessed because they are just not used, this is useful for debugging + + edges.clear(); + for (PxU32 i = 0; i < numTriangles; ++i) + { + const Triangle& tri = tris[i]; + if (tri[0] < 0) + continue; + + for (PxU32 j = 0; j < 3; ++j) + { + PxU64 edge = key(tri[neighborEdges[j][0]], tri[neighborEdges[j][1]]); + if (const PxPair* ptr = edges.find(edge)) + { + if (ptr->second < 0) + return false; //Edge shared by more than 2 triangles + if (result[4 * i + j] == -4 || result[ptr->second] == -4) + { + result[4 * i + j] = -4; //Mark as non-manifold edge + result[ptr->second] = -4; + } + else + { + if (result[4 * i + j] != -1 || result[ptr->second] != -1) + { + result[4 * i + j] = -4; //Mark as non-manifold edge + result[ptr->second] = -4; + } + + result[4 * i + j] = ptr->second; + result[ptr->second] = 4 * i + j; + } + edges.erase(ptr->first); + edges.insert(edge, -1); //Mark as processed + } + else + edges.insert(edge, 4 * i + j); + } + } + return true; +} + +PxI32 indexOf(const Triangle& tri, PxI32 node) +{ + if (tri[0] == node) return 0; + if (tri[1] == node) return 1; + if (tri[2] == node) return 2; + return -1; +} + +bool MeshAnalyzer::checkConsistentTriangleOrientation(const Triangle* tris, PxU32 numTriangles, PxArray& flip, PxHashMap& edges) +{ + PxArray adj; + if (!buildTriangleAdjacency(tris, numTriangles, adj, edges)) + return false; + + PxU32 l = numTriangles; + PxArray done; + done.resize(l, false); + flip.clear(); + flip.resize(l, false); + + PxArray> connectedTriangleGroups; + + PxU32 seedIndex = 0; + PxArray stack; + + while (true) + { + if (stack.size() == 0) + { + while (seedIndex < done.size() && done[seedIndex]) + ++seedIndex; + + if (seedIndex == done.size()) + break; + + done[seedIndex] = true; + flip[seedIndex] = false; + stack.pushBack(seedIndex); + PxArray currentGroup; + currentGroup.pushBack(seedIndex); + connectedTriangleGroups.pushBack(currentGroup); + } + + PxI32 index = stack.popBack(); + bool f = flip[index]; + const Triangle& tri = tris[index]; + + for (PxU32 i = 0; i < 3; ++i) + { + if (adj[4 * index + i] >= 0 && !done[adj[4 * index + i] >> 2]) + { + PxI32 neighborTriIndex = adj[4 * index + i] >> 2; + + done[neighborTriIndex] = true; + connectedTriangleGroups[connectedTriangleGroups.size() - 1].pushBack(neighborTriIndex); + + const Triangle& neighborTri = tris[neighborTriIndex]; + PxI32 j = indexOf(neighborTri, tri[neighborEdges[i][0]]); + flip[neighborTriIndex] = (neighborTri[(j + 1) % 3] == tri[neighborEdges[i][1]]) != f; + + stack.pushBack(neighborTriIndex); + } + } + } + + return true; +} + +bool MeshAnalyzer::makeTriOrientationConsistent(Triangle* tris, PxU32 numTriangles, bool invertOrientation) +{ + PxHashMap edges; + PxArray flipTriangle; + + if (!checkConsistentTriangleOrientation(tris, numTriangles, flipTriangle, edges)) + return false; + + for (PxU32 i = 0; i < flipTriangle.size(); ++i) + { + Triangle& t = tris[i]; + if (flipTriangle[i] != invertOrientation) + PxSwap(t[0], t[1]); + } + return true; +} + +bool MeshAnalyzer::checkMeshWatertightness(const Triangle* tris, PxU32 numTriangles) +{ + PxArray flip; + PxHashMap edges; + if (!MeshAnalyzer::checkConsistentTriangleOrientation(tris, numTriangles, flip, edges)) + return false; + + for (PxHashMap::Iterator iter = edges.getIterator(); !iter.done(); ++iter) + if (iter->second >= 0) + { + return false; + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.h new file mode 100644 index 0000000..6842e55 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshAnalysis.h @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_MESH_ANALYSIS_H +#define GU_MESH_ANALYSIS_H + +#include "foundation/Px.h" +#include "common/PxPhysXCommonConfig.h" +#include "GuTriangle.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxSort.h" + +namespace physx +{ +namespace Gu +{ + using Triangle = Gu::IndexedTriangleT; + + + class MeshAnalyzer + { + struct Range + { + PxI32 start; + PxI32 end; //Exclusive + + Range(PxI32 start_, PxI32 end_) + { + start = start_; + end = end_; + } + + PxI32 Length() const { return end - start; } + }; + + template + static void splitRanges(PxArray& mergeRanges, const PxArray& indexer, const PxArray& points, PxI32 dimIndex, S tol) + { + PxArray newMergeRanges; + + for (PxU32 i = 0; i < mergeRanges.size(); ++i) + { + const Range& r = mergeRanges[i]; + PxI32 start = r.start; + for (PxI32 j = r.start + 1; j < r.end; ++j) + { + //PxF64 delta = PxAbs(points[start][dimIndex] - points[j - 1][dimIndex]); + S delta = PxAbs(points[indexer[j]][dimIndex] - points[indexer[j - 1]][dimIndex]); + if (delta > tol) + { + if (j - start > 1) + newMergeRanges.pushBack(Range(start, j)); + start = j; + } + } + if (r.end - start > 1) + newMergeRanges.pushBack(Range(start, r.end)); + } + + mergeRanges.clear(); + for (PxU32 i = 0; i < newMergeRanges.size(); ++i) + mergeRanges.pushBack(newMergeRanges[i]); + } + + template + struct Comparer + { + const T* points; + PxU32 dimension; + + Comparer(const T* points_, const PxU32 dimension_) : points(points_), dimension(dimension_) {} + + bool operator()(const PxI32& a, const PxI32& b) const + { + return points[a][dimension] > points[b][dimension]; + } + + private: + PX_NOCOPY(Comparer) + }; + + public: + template + static void mapDuplicatePoints(const PxArray& points, PxArray& result, S duplicateDistanceManhattanMetric = static_cast(1e-6)) + { + result.reserve(points.size()); + result.forceSize_Unsafe(points.size()); + + PxArray indexer; + indexer.reserve(points.size()); + indexer.forceSize_Unsafe(points.size()); + for (PxU32 i = 0; i < points.size(); ++i) + { + indexer[i] = i; + result[i] = i; + } + + Comparer comparer(points.begin(), 0); + PxSort(indexer.begin(), indexer.size(), comparer); + + PxArray mergeRanges; + mergeRanges.pushBack(Range(0, points.size())); + splitRanges(mergeRanges, indexer, points, 0, duplicateDistanceManhattanMetric); + + comparer.dimension = 1; + for (PxU32 i = 0; i < mergeRanges.size(); ++i) + { + const Range& r = mergeRanges[i]; + PxSort(indexer.begin() + r.start, r.Length(), comparer); + } + splitRanges(mergeRanges, indexer, points, 1, duplicateDistanceManhattanMetric); + + comparer.dimension = 2; + for (PxU32 i = 0; i < mergeRanges.size(); ++i) + { + const Range& r = mergeRanges[i]; + PxSort(indexer.begin() + r.start, r.Length(), comparer); + } + splitRanges(mergeRanges, indexer, points, 2, duplicateDistanceManhattanMetric); + + //Merge the ranges + for (PxU32 i = 0; i < mergeRanges.size(); ++i) + { + const Range& r = mergeRanges[i]; + PxSort(indexer.begin() + r.start, r.Length()); + for (PxI32 j = r.start + 1; j < r.end; ++j) + result[indexer[j]] = result[indexer[r.start]]; + } + } + + PX_PHYSX_COMMON_API static bool buildTriangleAdjacency(const Triangle* tris, PxU32 numTriangles, PxArray& result, PxHashMap& edges); + PX_PHYSX_COMMON_API static bool checkConsistentTriangleOrientation(const Triangle* tris, PxU32 numTriangles, PxArray& flip, PxHashMap& edges); + PX_PHYSX_COMMON_API static bool makeTriOrientationConsistent(Triangle* tris, PxU32 numTriangles, bool invertOrientation = false); + PX_PHYSX_COMMON_API static bool checkMeshWatertightness(const Triangle* tris, PxU32 numTriangles); + }; +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp new file mode 100644 index 0000000..2e70338 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuMeshCleaner.cpp @@ -0,0 +1,230 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "foundation/PxMemory.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBitUtils.h" +#include "GuMeshCleaner.h" + +using namespace physx; +using namespace Gu; + +struct Indices +{ + PxU32 mRef[3]; + + PX_FORCE_INLINE bool operator!=(const Indices&v) const { return mRef[0] != v.mRef[0] || mRef[1] != v.mRef[1] || mRef[2] != v.mRef[2]; } +}; + +static PX_FORCE_INLINE PxU32 getHashValue(const PxVec3& v) +{ + const PxU32* h = reinterpret_cast(&v.x); + const PxU32 f = (h[0]+h[1]*11-(h[2]*17)) & 0x7fffffff; // avoid problems with +-0 + return (f>>22)^(f>>12)^(f); +} + +static PX_FORCE_INLINE PxU32 getHashValue(const Indices& v) +{ +// const PxU32* h = v.mRef; +// const PxU32 f = (h[0]+h[1]*11-(h[2]*17)) & 0x7fffffff; // avoid problems with +-0 +// return (f>>22)^(f>>12)^(f); + + PxU32 a = v.mRef[0]; + PxU32 b = v.mRef[1]; + PxU32 c = v.mRef[2]; + a=a-b; a=a-c; a=a^(c >> 13); + b=b-c; b=b-a; b=b^(a << 8); + c=c-a; c=c-b; c=c^(b >> 13); + a=a-b; a=a-c; a=a^(c >> 12); + b=b-c; b=b-a; b=b^(a << 16); + c=c-a; c=c-b; c=c^(b >> 5); + a=a-b; a=a-c; a=a^(c >> 3); + b=b-c; b=b-a; b=b^(a << 10); + c=c-a; c=c-b; c=c^(b >> 15); + return c; +} + +MeshCleaner::MeshCleaner(PxU32 nbVerts, const PxVec3* srcVerts, PxU32 nbTris, const PxU32* srcIndices, PxF32 meshWeldTolerance) +{ + PxVec3* cleanVerts = PX_ALLOCATE(PxVec3, nbVerts, "MeshCleaner"); + PX_ASSERT(cleanVerts); + + PxU32* indices = PX_ALLOCATE(PxU32, (nbTris*3), "MeshCleaner"); + + PxU32* remapTriangles = PX_ALLOCATE(PxU32, nbTris, "MeshCleaner"); + + PxU32* vertexIndices = NULL; + if(meshWeldTolerance!=0.0f) + { + vertexIndices = PX_ALLOCATE(PxU32, nbVerts, "MeshCleaner"); + const PxF32 weldTolerance = 1.0f / meshWeldTolerance; + // snap to grid + for(PxU32 i=0; i=nbVerts || vref1>=nbVerts || vref2>=nbVerts) + continue; + + // PT: you can still get zero-area faces when the 3 vertices are perfectly aligned + const PxVec3& p0 = srcVerts[vref0]; + const PxVec3& p1 = srcVerts[vref1]; + const PxVec3& p2 = srcVerts[vref2]; + const float area2 = ((p0 - p1).cross(p0 - p2)).magnitudeSquared(); + if(area2==0.0f) + continue; + + vref0 = remapVerts[vref0]; + vref1 = remapVerts[vref1]; + vref2 = remapVerts[vref2]; + if(vref0==vref1 || vref1==vref2 || vref2==vref0) + continue; + + indices[nbCleanedTris*3+0] = vref0; + indices[nbCleanedTris*3+1] = vref1; + indices[nbCleanedTris*3+2] = vref2; + remapTriangles[nbCleanedTris] = i; + nbCleanedTris++; + } + PX_FREE(remapVerts); + + PxU32 nbToGo = nbCleanedTris; + nbCleanedTris = 0; + PxMemSet(hashTable, 0xff, hashSize * sizeof(PxU32)); + + Indices* const I = reinterpret_cast(indices); + bool idtRemap = true; + for(PxU32 i=0;i +PxU32 kmeans_cluster(const Vec* input, + PxU32 inputCount, + PxU32 clumpCount, + Vec* clusters, + PxU32* outputIndices, + Type threshold, // controls how long it works to converge towards a least errors solution. + Type collapseDistance) // distance between clumps to consider them to be essentially equal. +{ + PxU32 convergeCount = 64; // maximum number of iterations attempting to converge to a solution.. + PxU32* counts = PX_ALLOCATE(PxU32, clumpCount, "PxU32"); + Type error=0; + if ( inputCount <= clumpCount ) // if the number of input points is less than our clumping size, just return the input points. + { + clumpCount = inputCount; + for (PxU32 i=0; i threshold ); // keep going until the error is reduced by this threshold amount. + + PX_FREE(centroids); + } + + // ok..now we prune the clumps if necessary. + // The rules are; first, if a clump has no 'counts' then we prune it as it's unused. + // The second, is if the centroid of this clump is essentially the same (based on the distance tolerance) + // as an existing clump, then it is pruned and all indices which used to point to it, now point to the one + // it is closest too. + PxU32 outCount = 0; // number of clumps output after pruning performed. + Type d2 = collapseDistance*collapseDistance; // squared collapse distance. + for (PxU32 i=0; i(input, inputSize, clumpCount, outputClusters, outputIndices, errorThreshold, collapseDistance); +} + +class QuantizerImpl : public Quantizer, public PxUserAllocated +{ +public: + QuantizerImpl(void) + { + mScale = PxVec3(1.0f, 1.0f, 1.0f); + mCenter = PxVec3(0.0f, 0.0f, 0.0f); + } + + // Use the k-means quantizer, similar results, but much slower. + virtual const PxVec3* kmeansQuantize3D(PxU32 vcount, + const PxVec3* vertices, + PxU32 stride, + bool denormalizeResults, + PxU32 maxVertices, + PxU32& outVertsCount) + { + const PxVec3* ret = NULL; + outVertsCount = 0; + mNormalizedInput.clear(); + mQuantizedOutput.clear(); + + if ( vcount > 0 ) + { + normalizeInput(vcount,vertices, stride); + + PxVec3* quantizedOutput = PX_ALLOCATE(PxVec3, vcount, "PxVec3"); + PxU32* quantizedIndices = PX_ALLOCATE(PxU32, vcount, "PxU32"); + outVertsCount = kmeans_cluster3d(&mNormalizedInput[0], vcount, maxVertices, quantizedOutput, quantizedIndices, 0.01f, 0.0001f ); + if ( outVertsCount > 0 ) + { + if ( denormalizeResults ) + { + for (PxU32 i=0; i (vertices); + mNormalizedInput.clear(); + mQuantizedOutput.clear(); + PxBounds3 bounds; + bounds.setEmpty(); + for (PxU32 i=0; i (vtx); + vtx += stride; + + bounds.include(v); + } + + mCenter = bounds.getCenter(); + + PxVec3 dim = bounds.getDimensions(); + dim *= 1.001f; + mScale = dim*0.5f; + + for (PxU32 i = 0; i < 3; i++) + { + if(dim[i] == 0) + mScale[i] = 1.0f; + } + + PxVec3 recip; + recip.x = 1.0f / mScale.x; + recip.y = 1.0f / mScale.y; + recip.z = 1.0f / mScale.z; + + vtx = reinterpret_cast (vertices); + for (PxU32 i=0; i (vtx); + vtx += stride; + + v = (v - mCenter).multiply(recip); + + mNormalizedInput.pushBack(v); + } + } + + virtual ~QuantizerImpl() + { + } + + private: + PxVec3 mScale; + PxVec3 mCenter; + PxArray mNormalizedInput; + PxArray mQuantizedOutput; +}; + +Quantizer* physx::Gu::createQuantizer() +{ + return PX_NEW(QuantizerImpl); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.h new file mode 100644 index 0000000..a3f2cd8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuQuantizer.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_QUANTIZER_H +#define GU_QUANTIZER_H + +#include "foundation/Px.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + ////////////////////////////////////////////////////////////////////////// + // K-means quantization class + // see http://en.wikipedia.org/wiki/K-means_clustering + // implementation from John Ratcliff http://codesuppository.blogspot.ch/2010/12/k-means-clustering-algorithm.html + class Quantizer + { + public: + // quantize the input vertices + virtual const PxVec3* kmeansQuantize3D( PxU32 vcount, + const PxVec3* vertices, + PxU32 stride, + bool denormalizeResults, + PxU32 maxVertices, + PxU32& outVertsCount) = 0; + + // returns the denormalized scale + virtual const PxVec3& getDenormalizeScale() const = 0; + + // returns the denormalized center + virtual const PxVec3& getDenormalizeCenter() const = 0; + + // release internal data + virtual void release() = 0; + + + protected: + virtual ~Quantizer() + { + } + }; + + // creates the quantizer class + Quantizer * createQuantizer(); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp new file mode 100644 index 0000000..5b6bb0b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuSeparatingAxes.cpp @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSeparatingAxes.h" + +using namespace physx; + +union FloatInt +{ + float f; + PxU32 i; +}; + +bool Gu::SeparatingAxes::addAxis(const PxVec3& axis) +{ + PxU32 numAxes = getNumAxes(); + const PxVec3* PX_RESTRICT axes = getAxes(); + const PxVec3* PX_RESTRICT axes_end = axes + numAxes; + while(axes0.9999f) + return false; + axes++; + } + +#ifdef SEP_AXIS_FIXED_MEMORY + if(mNbAxes(f), mNbVerts, RADIX_UNSIGNED); + + for(PxU32 i=0;i(f), mNbVerts, RADIX_UNSIGNED); + + for(PxU32 i=0;i(f), mNbVerts, RADIX_UNSIGNED).GetRanks(); + + PX_FREE(f); + + mNbRVerts = 0; + const PxU32 Junk[] = {PX_INVALID_U32, PX_INVALID_U32, PX_INVALID_U32}; + const PxU32* Previous = Junk; + mRVerts = PX_ALLOCATE(PxVec3, mNbVerts, "PxVec3"); + PxU32 Nb = mNbVerts; + while(Nb--) + { + const PxU32 Vertex = *Sorted++; // Vertex number + + const PxU32* current = reinterpret_cast(&mVerts[Vertex]); + if(current[0]!=Previous[0] || current[1]!=Previous[1] || current[2]!=Previous[2]) + mRVerts[mNbRVerts++] = mVerts[Vertex]; + + Previous = current; + + mXRef[Vertex] = mNbRVerts-1; + } + + if(rc) + { + rc->CrossRef = mXRef; + rc->NbRVerts = mNbRVerts; + rc->RVerts = mRVerts; + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.h new file mode 100644 index 0000000..248aa39 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/common/GuVertexReducer.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VERTEX_REDUCER_H +#define GU_VERTEX_REDUCER_H + +#include "foundation/PxVec3.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + //! Vertex cloud reduction result structure + struct REDUCEDCLOUD + { + // Out + PxVec3* RVerts; //!< Reduced list + PxU32 NbRVerts; //!< Reduced number of vertices + PxU32* CrossRef; //!< nb_verts remapped indices + }; + + class ReducedVertexCloud + { + public: + ReducedVertexCloud(const PxVec3* verts, PxU32 nb_verts); + ~ReducedVertexCloud(); + + ReducedVertexCloud& clean(); + bool reduce(REDUCEDCLOUD* rc=NULL); + + PX_FORCE_INLINE PxU32 getNbVerts() const { return mNbVerts; } + PX_FORCE_INLINE PxU32 getNbReducedVerts() const { return mNbRVerts; } + PX_FORCE_INLINE const PxVec3* getReducedVerts() const { return mRVerts; } + PX_FORCE_INLINE const PxVec3& getReducedVertex(PxU32 i) const { return mRVerts[i]; } + PX_FORCE_INLINE const PxU32* getCrossRefTable() const { return mXRef; } + + private: + // Original vertex cloud + PxU32 mNbVerts; //!< Number of vertices + const PxVec3* mVerts; //!< List of vertices (pointer copy) + + // Reduced vertex cloud + PxU32 mNbRVerts; //!< Reduced number of vertices + PxVec3* mRVerts; //!< Reduced list of vertices + PxU32* mXRef; //!< Cross-reference table (used to remap topologies) + }; +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp new file mode 100644 index 0000000..288dd55 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactBoxBox.cpp @@ -0,0 +1,695 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuContactMethodImpl.h" +#include "CmMatrix34.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +#define MAX_NB_CTCS 8 + 12*5 + 6*4 +#define ABS_GREATER(x, y) (PxAbs(x) > (y)) +#define ABS_SMALLER_EQUAL(x, y) (PxAbs(x) <= (y)) +//#define AIR(x) ((PxU32&)(x)&SIGN_BITMASK) +//#define ABS_GREATER(x, y) (AIR(x) > IR(y)) +//#define ABS_SMALLER_EQUAL(x, y) (AIR(x) <= IR(y)) + +#if PX_X86 && !PX_OSX + + // Some float optimizations ported over from novodex. + + //returns non zero if the value is negative. + #define PXC_IS_NEGATIVE(x) (((PxU32&)(x)) & 0x80000000) + +#else + + //On most platforms using the integer rep is worse(produces LHSs) since the CPU has more registers. + + //returns non zero if the value is negative. + #define PXC_IS_NEGATIVE(x) ((x) < 0.0f) + +#endif + + +enum +{ + AXIS_A0, AXIS_A1, AXIS_A2, + AXIS_B0, AXIS_B1, AXIS_B2 +}; + +struct VertexInfo +{ + PxVec3 pos; + bool penetrate; + bool area; +}; + +/*static PxI32 doBoxBoxContactGeneration(PxVec3 ctcPts[MAX_NB_CTCS], PxReal depths[MAX_NB_CTCS], PxVec3* ctcNrm, + const PxVec3& extents0, const PxVec3& extents1, + PxU32& collisionData, + const PxMat34& transform0, const PxMat34& transform1, PxReal contactDistance);*/ + +static PxI32 doBoxBoxContactGeneration(PxContactBuffer& contactBuffer, + const PxVec3& extents0, const PxVec3& extents1, + PxU32& collisionData, + const PxMat34& transform0, const PxMat34& transform1, PxReal contactDistance); + +bool Gu::contactBoxBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + // Get actual shape data + const PxBoxGeometry& shapeBox0 = checkedCast(shape0); + const PxBoxGeometry& shapeBox1 = checkedCast(shape1); + + PxU32 pd = PxU32(cache.mPairData); + PxI32 Nb = doBoxBoxContactGeneration(contactBuffer, + shapeBox0.halfExtents, shapeBox1.halfExtents, + pd, + Matrix34FromTransform(transform0), Matrix34FromTransform(transform1), + params.mContactDistance); + + cache.mPairData = PxTo8(pd); + + if(!Nb) + { + cache.mPairData = 0; // Mark as separated for temporal coherence + return false; // WARNING: the contact stream code below used to output stuff even for 0 contacts (!). Now we just return here. + } + return true; +} + +// face => 4 vertices of a face of the cube (i.e. a quad) +static PX_FORCE_INLINE PxReal IsInYZ(const PxReal y, const PxReal z, const VertexInfo** PX_RESTRICT face) +{ + // Warning, indices have been remapped. We're now actually like this: + // + // 3+------+2 + // | | | + // | *--| + // | (y,z)| + // 0+------+1 + PxReal PreviousY = face[3]->pos.y; + PxReal PreviousZ = face[3]->pos.z; + + // Loop through quad vertices + for(PxI32 i=0; i<4; i++) + { + const PxReal CurrentY = face[i]->pos.y; + const PxReal CurrentZ = face[i]->pos.z; + + // |CurrentY - PreviousY y - PreviousY| + // |CurrentZ - PreviousZ z - PreviousZ| + // => similar to backface culling, check each one of the 4 triangles are consistent, in which case + // the point is within the parallelogram. + if((CurrentY - PreviousY)*(z - PreviousZ) - (CurrentZ - PreviousZ)*(y - PreviousY) >= 0.0f) return -1.0f; + + PreviousY = CurrentY; + PreviousZ = CurrentZ; + } + + PxReal x = face[0]->pos.x; + { + const PxReal ay = y - face[0]->pos.y; + const PxReal az = z - face[0]->pos.z; + + PxVec3 b = face[1]->pos - face[0]->pos; // ### could be precomputed ? + x += b.x * (ay*b.y + az*b.z) / b.magnitudeSquared(); // ### could be precomputed ? + + b = face[3]->pos - face[0]->pos; // ### could be precomputed ? + x += b.x * (ay*b.y + az*b.z) / b.magnitudeSquared(); // ### could be precomputed ? + } + + return x; +} + +// Test with respect to the quad defined by (0,-y1,-z1) and (0,y1,z1) +// +------+ y1 y +// | | | +// | * | | +// | | | +// +------+ -y1 *-----z +static PxI32 generateContacts(//PxVec3 ctcPts[], PxReal depths[], + PxContactBuffer& contactBuffer, const PxVec3& contactNormal, + PxReal y1, PxReal z1, const PxVec3& box2, + const PxMat34& transform0, const PxMat34& transform1, PxReal contactDistance) +{ +// PxI32 NbContacts=0; + contactBuffer.reset(); + y1 += contactDistance; + z1 += contactDistance; + + const PxMat34 trans1to0 = transform0.getInverseRT() * transform1; + + VertexInfo vtx[8]; // The 8 cube vertices +// PxI32 i; + + // 6+------+7 + // /| /| + // / | / | + // / 4+---/--+5 + // 2+------+3 / y z + // | / | / | / + // |/ |/ |/ + // 0+------+1 *---x + + { + const PxVec3 ex = trans1to0.m.column0 * box2.x; + const PxVec3 ey = trans1to0.m.column1 * box2.y; + const PxVec3 ez = trans1to0.m.column2 * box2.z; + + /* + vtx[0].pos = mat.pos - ex - ey - ez; + vtx[1].pos = mat.pos + ex - ey - ez; + vtx[2].pos = mat.pos - ex + ey - ez; + vtx[3].pos = mat.pos + ex + ey - ez; + vtx[4].pos = mat.pos - ex - ey + ez; + vtx[5].pos = mat.pos + ex - ey + ez; + vtx[6].pos = mat.pos - ex + ey + ez; + vtx[7].pos = mat.pos + ex + ey + ez; + */ + + // 12 vector ops = 12*3 = 36 FPU ops + vtx[0].pos = vtx[2].pos = vtx[4].pos = vtx[6].pos = trans1to0.p - ex; + vtx[1].pos = vtx[3].pos = vtx[5].pos = vtx[7].pos = trans1to0.p + ex; + + PxVec3 e = ey+ez; + vtx[0].pos -= e; + vtx[1].pos -= e; + vtx[6].pos += e; + vtx[7].pos += e; + + e = ey-ez; + vtx[2].pos += e; + vtx[3].pos += e; + vtx[4].pos -= e; + vtx[5].pos -= e; + } + + // Create vertex info for 8 vertices + for(PxU32 i=0; i<8; i++) + { + // Vertex suivant + VertexInfo& p = vtx[i]; + // test the point with respect to the x = 0 plane + // if(p.pos.x < 0) + if(p.pos.x < -contactDistance) //if(PXC_IS_NEGATIVE(p.pos.x)) + { + p.area = false; + p.penetrate = false; + continue; + } + + { + // we penetrated the quad plane + p.penetrate = true; + // test to see if we are in the quad + // PxAbs => thus we test Y with respect to -Y1 and +Y1 (same for Z) + // if(PxAbs(p->pos.y) <= y1 && PxAbs(p->pos.z) <= z1) + if(ABS_SMALLER_EQUAL(p.pos.y, y1) && ABS_SMALLER_EQUAL(p.pos.z, z1)) + { + // the point is inside the quad + p.area=true; + // Since we are testing with respect to x = 0, the penetration is directly the x coordinate. +// depths[NbContacts] = p.pos.x; + + // We take the vertex as the impact point +// ctcPts[NbContacts++] = p.pos; + contactBuffer.contact(p.pos, contactNormal, -p.pos.x); + } + else + { + p.area=false; + } + } + } + + // Teste 12 edges on the quad + static const PxI32 indices[]={ 0,1, 1,3, 3,2, 2,0, 4,5, 5,7, 7,6, 6,4, 0,4, 1,5, 2,6, 3,7, }; + const PxI32* runningLine = indices; + const PxI32* endLine = runningLine+24; + while(runningLine!=endLine) + { + // The two vertices of the current edge + const VertexInfo* p1 = &vtx[*runningLine++]; + const VertexInfo* p2 = &vtx[*runningLine++]; + + // Penetrate|Area|Penetrate|Area => 16 cases + + // We only take the edges that at least penetrated the quad's plane into account. + if(p1->penetrate || p2->penetrate) + // if(p1->penetrate + p2->penetrate) // One branch only + { + // If at least one of the two vertices is not in the quad... + if(!p1->area || !p2->area) + // if(!p1->area + !p2->area) // One branch only + { + // Test y + if(p1->pos.y > p2->pos.y) { const VertexInfo* tmp=p1; p1=p2; p2=tmp; } + // Impact on the +Y1 edge of the quad + if(p1->pos.y < +y1 && p2->pos.y >= +y1) + // => a point under Y1, the other above + { + // Case 1 + PxReal a = (+y1 - p1->pos.y)/(p2->pos.y - p1->pos.y); + PxReal z = p1->pos.z + (p2->pos.z - p1->pos.z)*a; + if(PxAbs(z) <= z1) + { + PxReal x = p1->pos.x + (p2->pos.x - p1->pos.x)*a; + if(x+contactDistance>=0.0f) + { +// depths[NbContacts] = x; +// ctcPts[NbContacts++] = PxVec3(x, y1, z); + contactBuffer.contact(PxVec3(x, y1, z), contactNormal, -x); + } + } + } + // Impact on the edge -Y1 of the quad + if(p1->pos.y < -y1 && p2->pos.y >= -y1) + { + // Case 2 + PxReal a = (-y1 - p1->pos.y)/(p2->pos.y - p1->pos.y); + PxReal z = p1->pos.z + (p2->pos.z - p1->pos.z)*a; + if(PxAbs(z) <= z1) + { + PxReal x = p1->pos.x + (p2->pos.x - p1->pos.x)*a; + if(x+contactDistance>=0.0f) + { +// depths[NbContacts] = x; +// ctcPts[NbContacts++] = PxVec3(x, -y1, z); + contactBuffer.contact(PxVec3(x, -y1, z), contactNormal, -x); + } + } + } + + // Test z + if(p1->pos.z > p2->pos.z) { const VertexInfo* tmp=p1; p1=p2; p2=tmp; } + // Impact on the edge +Z1 of the quad + if(p1->pos.z < +z1 && p2->pos.z >= +z1) + { + // Case 3 + PxReal a = (+z1 - p1->pos.z)/(p2->pos.z - p1->pos.z); + PxReal y = p1->pos.y + (p2->pos.y - p1->pos.y)*a; + if(PxAbs(y) <= y1) + { + PxReal x = p1->pos.x + (p2->pos.x - p1->pos.x)*a; + if(x+contactDistance>=0.0f) + { +// depths[NbContacts] = x; +// ctcPts[NbContacts++] = PxVec3(x, y, z1); + contactBuffer.contact(PxVec3(x, y, z1), contactNormal, -x); + } + } + } + // Impact on the edge -Z1 of the quad + if(p1->pos.z < -z1 && p2->pos.z >= -z1) + { + // Case 4 + PxReal a = (-z1 - p1->pos.z)/(p2->pos.z - p1->pos.z); + PxReal y = p1->pos.y + (p2->pos.y - p1->pos.y)*a; + if(PxAbs(y) <= y1) + { + PxReal x = p1->pos.x + (p2->pos.x - p1->pos.x)*a; + if(x+contactDistance>=0.0f) + { +// depths[NbContacts] = x; +// ctcPts[NbContacts++] = PxVec3(x, y, -z1); + contactBuffer.contact(PxVec3(x, y, -z1), contactNormal, -x); + } + } + } + } + + // The case where one point penetrates the plane, and the other is not in the quad. + if((!p1->penetrate && !p2->area) || (!p2->penetrate && !p1->area)) + { + // Case 5 + PxReal a = (-p1->pos.x)/(p2->pos.x - p1->pos.x); + PxReal y = p1->pos.y + (p2->pos.y - p1->pos.y)*a; + if(PxAbs(y) <= y1) + { + PxReal z = p1->pos.z + (p2->pos.z - p1->pos.z)*a; + if(PxAbs(z) <= z1) + { +// depths[NbContacts] = 0; +// ctcPts[NbContacts++] = PxVec3(0, y, z); + contactBuffer.contact(PxVec3(0, y, z), contactNormal, 0); + } + } + } + + } + } + + { + // 6 quads => 6 faces of the cube + static const PxI32 face[][4]={ {0,1,3,2}, {1,5,7,3}, {5,4,6,7}, {4,0,2,6}, {2,3,7,6}, {0,4,5,1} }; + PxI32 addflg=0; + for(PxU32 i=0; i<6 && addflg!=0x0f; i++) + { + const PxI32* p = face[i]; + const VertexInfo* q[4]; + if((q[0]=&vtx[p[0]])->penetrate && (q[1]=&vtx[p[1]])->penetrate && (q[2]=&vtx[p[2]])->penetrate && (q[3]=&vtx[p[3]])->penetrate) + { + if(!q[0]->area || !q[1]->area || !q[2]->area || !q[3]->area) + { + if(!(addflg&1)) { PxReal x = IsInYZ(-y1, -z1, q); if(x>=0.0f) { addflg|=1; contactBuffer.contact(PxVec3(x, -y1, -z1), contactNormal, -x); /*depths[NbContacts]=x; ctcPts[NbContacts++] = PxVec3(x, -y1, -z1);*/ } } + if(!(addflg&2)) { PxReal x = IsInYZ(+y1, -z1, q); if(x>=0.0f) { addflg|=2; contactBuffer.contact(PxVec3(x, +y1, -z1), contactNormal, -x); /*depths[NbContacts]=x; ctcPts[NbContacts++] = PxVec3(x, +y1, -z1);*/ } } + if(!(addflg&4)) { PxReal x = IsInYZ(-y1, +z1, q); if(x>=0.0f) { addflg|=4; contactBuffer.contact(PxVec3(x, -y1, +z1), contactNormal, -x); /*depths[NbContacts]=x; ctcPts[NbContacts++] = PxVec3(x, -y1, +z1);*/ } } + if(!(addflg&8)) { PxReal x = IsInYZ(+y1, +z1, q); if(x>=0.0f) { addflg|=8; contactBuffer.contact(PxVec3(x, +y1, +z1), contactNormal, -x); /*depths[NbContacts]=x; ctcPts[NbContacts++] = PxVec3(x, +y1, +z1);*/ } } + } + } + } + } + +// for(i=0; i=0.0f && d=0 !! otherwise bug at sep = 0 + } + + collisionData = PxU32(minIndex + 1); // Leave "0" for separation + +#if PX_X86 + const PxU32 sign = PXC_IS_NEGATIVE(d1[minIndex]); +#else + const PxU32 sign = PxU32(PXC_IS_NEGATIVE(d1[minIndex])); +#endif + PxMat34 trs; + PxVec3 ctcNrm; + + switch(minIndex) + { + default: + return 0; + + case AXIS_A0: +// *ctcNrm = axis00; + if(sign) + { + ctcNrm = axis00; + trs.m = transform0.m; + trs.p = transform0.p - extents0.x*axis00; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis00; + + trs.m.column0 = -axis00; + trs.m.column1 = -axis01; + trs.m.column2 = axis02; + trs.p = transform0.p + extents0.x*axis00; + } +// return generateContacts(ctcPts, depths, extents0.y, extents0.z, extents1, trs, transform1, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents0.y, extents0.z, extents1, trs, transform1, contactDistance); + + case AXIS_A1: +// *ctcNrm = axis01; + trs.m.column2 = axis00; // Factored out + if(sign) + { + ctcNrm = axis01; + trs.m.column0 = axis01; + trs.m.column1 = axis02; + trs.p = transform0.p - extents0.y*axis01; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis01; + + trs.m.column0 = -axis01; + trs.m.column1 = -axis02; + trs.p = transform0.p + extents0.y*axis01; + } +// return generateContacts(ctcPts, depths, extents0.z, extents0.x, extents1, trs, transform1, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents0.z, extents0.x, extents1, trs, transform1, contactDistance); + + case AXIS_A2: +// *ctcNrm = axis02; + trs.m.column2 = axis01; // Factored out + + if(sign) + { + ctcNrm = axis02; + trs.m.column0 = axis02; + trs.m.column1 = axis00; + trs.p = transform0.p - extents0.z*axis02; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis02; + + trs.m.column0 = -axis02; + trs.m.column1 = -axis00; + trs.p = transform0.p + extents0.z*axis02; + } +// return generateContacts(ctcPts, depths, extents0.x, extents0.y, extents1, trs, transform1, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents0.x, extents0.y, extents1, trs, transform1, contactDistance); + + case AXIS_B0: +// *ctcNrm = axis10; + if(sign) + { + ctcNrm = axis10; + trs.m.column0 = -axis10; + trs.m.column1 = -axis11; + trs.m.column2 = axis12; + trs.p = transform1.p + extents1.x*axis10; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis10; + trs.m = transform1.m; + trs.p = transform1.p - extents1.x*axis10; + + } +// return generateContacts(ctcPts, depths, extents1.y, extents1.z, extents0, trs, transform0, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents1.y, extents1.z, extents0, trs, transform0, contactDistance); + + case AXIS_B1: +// *ctcNrm = axis11; + trs.m.column2 = axis10; // Factored out + if(sign) + { + ctcNrm = axis11; + trs.m.column0 = -axis11; + trs.m.column1 = -axis12; + trs.p = transform1.p + extents1.y*axis11; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis11; + + trs.m.column0 = axis11; + trs.m.column1 = axis12; + trs.m.column2 = axis10; + trs.p = transform1.p - extents1.y*axis11; + } +// return generateContacts(ctcPts, depths, extents1.z, extents1.x, extents0, trs, transform0, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents1.z, extents1.x, extents0, trs, transform0, contactDistance); + + case AXIS_B2: +// *ctcNrm = axis12; + trs.m.column2 = axis11; // Factored out + + if(sign) + { + ctcNrm = axis12; + trs.m.column0 = -axis12; + trs.m.column1 = -axis10; + trs.p = transform1.p + extents1.z*axis12; + } + else + { +// *ctcNrm = -*ctcNrm; + ctcNrm = -axis12; + + trs.m.column0 = axis12; + trs.m.column1 = axis10; + trs.p = transform1.p - extents1.z*axis12; + } + +// return generateContacts(ctcPts, depths, extents1.x, extents1.y, extents0, trs, transform0, contactDistance); + return generateContacts(contactBuffer, ctcNrm, extents1.x, extents1.y, extents0, trs, transform0, contactDistance); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp new file mode 100644 index 0000000..f7b5c6b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleBox.cpp @@ -0,0 +1,442 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuIntersectionRayBox.h" +#include "GuDistanceSegmentBox.h" +#include "GuInternal.h" +#include "GuContactMethodImpl.h" +#include "GuBoxConversion.h" + +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Gu; + +/*namespace Gu +{ +const PxU8* getBoxEdges(); +}*/ + +///////// + /*#include "common/PxRenderOutput.h" + #include "PxsContext.h" + static void gVisualizeBox(const Box& box, PxcNpThreadContext& context, PxU32 color=0xffffff) + { + PxMat33 rot(box.base.column0, box.base.column1, box.base.column2); + PxMat44 m(rot, box.origin); + + DebugBox db(box.extent); + + PxRenderOutput& out = context.mRenderOutput; + out << color << m; + out << db; + } + static void gVisualizeLine(const PxVec3& a, const PxVec3& b, PxcNpThreadContext& context, PxU32 color=0xffffff) + { + PxMat44 m = PxMat44::identity(); + + RenderOutput& out = context.mRenderOutput; + out << color << m << RenderOutput::LINES << a << b; + }*/ +///////// + +static const PxReal fatBoxEdgeCoeff = 0.01f; + +static bool intersectEdgeEdgePreca(const PxVec3& p1, const PxVec3& p2, const PxVec3& v1, const PxPlane& plane, PxU32 i, PxU32 j, float coeff, const PxVec3& dir, const PxVec3& p3, const PxVec3& p4, PxReal& dist, PxVec3& ip) +{ + // if colliding edge (p3,p4) does not cross plane return no collision + // same as if p3 and p4 on same side of plane return 0 + // + // Derivation: + // d3 = d(p3, P) = (p3 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // d4 = d(p4, P) = (p4 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // if d3 and d4 have the same sign, they're on the same side of the plane => no collision + // We test both sides at the same time by only testing Sign(d3 * d4). + // ### put that in the Plane class + // ### also check that code in the triangle class that might be similar + const PxReal d3 = plane.distance(p3); + PxReal temp = d3 * plane.distance(p4); + if(temp>0.0f) return false; + + // if colliding edge (p3,p4) and plane are parallel return no collision + PxVec3 v2 = p4 - p3; + + temp = plane.n.dot(v2); + if(temp==0.0f) return false; // ### epsilon would be better + + // compute intersection point of plane and colliding edge (p3,p4) + ip = p3-v2*(d3/temp); + + // compute distance of intersection from line (ip, -dir) to line (p1,p2) + dist = (v1[i]*(ip[j]-p1[j])-v1[j]*(ip[i]-p1[i]))*coeff; + if(dist<0.0f) return false; + + // compute intersection point on edge (p1,p2) line + ip -= dist*dir; + + // check if intersection point (ip) is between edge (p1,p2) vertices + temp = (p1.x-ip.x)*(p2.x-ip.x)+(p1.y-ip.y)*(p2.y-ip.y)+(p1.z-ip.z)*(p2.z-ip.z); + if(temp<0.0f) return true; // collision found + + return false; // no collision +} + +static bool GuTestAxis(const PxVec3& axis, const Segment& segment, PxReal radius, const Box& box, PxReal& depth) +{ + // Project capsule + PxReal min0 = segment.p0.dot(axis); + PxReal max0 = segment.p1.dot(axis); + if(min0>max0) PxSwap(min0, max0); + min0 -= radius; + max0 += radius; + + // Project box + PxReal Min1, Max1; + { + const PxReal BoxCen = box.center.dot(axis); + const PxReal BoxExt = + PxAbs(box.rot.column0.dot(axis)) * box.extents.x + + PxAbs(box.rot.column1.dot(axis)) * box.extents.y + + PxAbs(box.rot.column2.dot(axis)) * box.extents.z; + + Min1 = BoxCen - BoxExt; + Max1 = BoxCen + BoxExt; + } + + // Test projections + if(max0=0.0f); + const PxReal d1 = Max1 - min0; + PX_ASSERT(d1>=0.0f); + depth = physx::intrinsics::selectMin(d0, d1); + return true; +} + +static bool GuCapsuleOBBOverlap3(const Segment& segment, PxReal radius, const Box& box, PxReal* t=NULL, PxVec3* pp=NULL) +{ + PxVec3 Sep(PxReal(0)); + PxReal PenDepth = PX_MAX_REAL; + + // Test normals + for(PxU32 i=0;i<3;i++) + { + PxReal d; + if(!GuTestAxis(box.rot[i], segment, radius, box, d)) + return false; + + if(d(shape0); + const PxBoxGeometry& shapeBox = checkedCast(shape1); + + // PT: TODO: move computations to local space + + // Capsule data + Segment worldSegment; + getCapsuleSegment(transform0, shapeCapsule, worldSegment); + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; + + // Box data + Box worldBox; + buildFrom(worldBox, transform1.p, shapeBox.halfExtents, transform1.q); + + // Collision detection + PxReal t; + PxVec3 onBox; + const PxReal squareDist = distanceSegmentBoxSquared(worldSegment.p0, worldSegment.p1, worldBox.center, worldBox.extents, worldBox.rot, &t, &onBox); + + if(squareDist >= inflatedRadius*inflatedRadius) + return false; + + PX_ASSERT(contactBuffer.count==0); + + if(squareDist != 0.0f) + { + // PT: the capsule segment doesn't intersect the box => distance-based version + const PxVec3 onSegment = worldSegment.getPointAt(t); + onBox = worldBox.center + worldBox.rot.transform(onBox); + + PxVec3 normal = onSegment - onBox; + PxReal normalLen = normal.magnitude(); + + if(normalLen > 0.0f) + { + normal *= 1.0f/normalLen; + + // PT: generate VF contacts for segment's vertices vs box + GuGenerateVFContacts(contactBuffer, worldSegment, shapeCapsule.radius, worldBox, normal, params.mContactDistance); + + // PT: early exit if we already have 2 stable contacts + if(contactBuffer.count==2) + return true; + + // PT: else generate slower EE contacts + GuGenerateEEContacts2(contactBuffer, worldSegment, shapeCapsule.radius, worldBox, normal, params.mContactDistance); + + // PT: run VF case for box-vertex-vs-capsule only if we don't have any contact yet + if(!contactBuffer.count) + contactBuffer.contact(onBox, normal, sqrtf(squareDist) - shapeCapsule.radius); + } + else + { + // On linux we encountered the following: + // For a case where a segment endpoint lies on the surface of a box, the squared distance between segment and box was tiny but still larger than 0. + // However, the computation of the normal length was exactly 0. In that case we should have switched to the penetration based version so we do it now + // instead. + goto PenetrationBasedCode; + } + } + else + { + PenetrationBasedCode: + + // PT: the capsule segment intersects the box => penetration-based version + + // PT: compute penetration vector (MTD) + PxVec3 sepAxis; + PxReal depth; + if(!GuCapsuleOBBOverlap3(worldSegment, shapeCapsule.radius, worldBox, &depth, &sepAxis)) return false; + + // PT: generate VF contacts for segment's vertices vs box + GuGenerateVFContacts(contactBuffer, worldSegment, shapeCapsule.radius, worldBox, sepAxis, params.mContactDistance); + + // PT: early exit if we already have 2 stable contacts + if(contactBuffer.count==2) + return true; + + // PT: else generate slower EE contacts + GuGenerateEEContacts(contactBuffer, worldSegment, shapeCapsule.radius, worldBox, sepAxis); + + if(!contactBuffer.count) + { + contactBuffer.contact(worldSegment.computeCenter(), sepAxis, -(shapeCapsule.radius + depth)); + return true; + } + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp new file mode 100644 index 0000000..a0a69fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleCapsule.cpp @@ -0,0 +1,148 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuDistanceSegmentSegment.h" +#include "GuContactMethodImpl.h" +#include "GuInternal.h" + +using namespace physx; + +bool Gu::contactCapsuleCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxCapsuleGeometry& capsuleGeom0 = checkedCast(shape0); + const PxCapsuleGeometry& capsuleGeom1 = checkedCast(shape1); + + // PT: get capsules in local space + PxVec3 dir[2]; + Segment segment[2]; + { + const PxVec3 capsuleLocalSegment0 = getCapsuleHalfHeightVector(transform0, capsuleGeom0); + const PxVec3 capsuleLocalSegment1 = getCapsuleHalfHeightVector(transform1, capsuleGeom1); + + const PxVec3 delta = transform1.p - transform0.p; + segment[0].p0 = capsuleLocalSegment0; + segment[0].p1 = -capsuleLocalSegment0; + dir[0] = -capsuleLocalSegment0*2.0f; + segment[1].p0 = capsuleLocalSegment1 + delta; + segment[1].p1 = -capsuleLocalSegment1 + delta; + dir[1] = -capsuleLocalSegment1*2.0f; + } + + // PT: compute distance between capsules' segments + PxReal s,t; + const PxReal squareDist = distanceSegmentSegmentSquared(segment[0], segment[1], &s, &t); + const PxReal radiusSum = capsuleGeom0.radius + capsuleGeom1.radius; + const PxReal inflatedSum = radiusSum + params.mContactDistance; + const PxReal inflatedSumSquared = inflatedSum*inflatedSum; + + if(squareDist >= inflatedSumSquared) + return false; + + // PT: TODO: optimize this away + PxReal segLen[2]; + segLen[0] = dir[0].magnitude(); + segLen[1] = dir[1].magnitude(); + + if (segLen[0]) dir[0] *= 1.0f / segLen[0]; + if (segLen[1]) dir[1] *= 1.0f / segLen[1]; + + if (PxAbs(dir[0].dot(dir[1])) > 0.9998f) //almost parallel, ca. 1 degree difference --> generate two contact points at ends + { + PxU32 numCons = 0; + + PxReal segLenEps[2]; + segLenEps[0] = segLen[0] * 0.001f;//0.1% error is ok. + segLenEps[1] = segLen[1] * 0.001f; + + //project the two end points of each onto the axis of the other and take those 4 points. + //we could also generate a single normal at the single closest point, but this would be 'unstable'. + + for (PxU32 destShapeIndex = 0; destShapeIndex < 2; destShapeIndex ++) + { + for (PxU32 startEnd = 0; startEnd < 2; startEnd ++) + { + const PxU32 srcShapeIndex = 1-destShapeIndex; + //project start/end of srcShapeIndex onto destShapeIndex. + PxVec3 pos[2]; + pos[destShapeIndex] = startEnd ? segment[srcShapeIndex].p1 : segment[srcShapeIndex].p0; + const PxReal p = dir[destShapeIndex].dot(pos[destShapeIndex] - segment[destShapeIndex].p0); + if (p >= -segLenEps[destShapeIndex] && p <= (segLen[destShapeIndex] + segLenEps[destShapeIndex])) + { + pos[srcShapeIndex] = p * dir[destShapeIndex] + segment[destShapeIndex].p0; + + PxVec3 normal = pos[1] - pos[0]; + + const PxReal normalLenSq = normal.magnitudeSquared(); + if (normalLenSq > 1e-6f && normalLenSq < inflatedSumSquared) + { + const PxReal distance = PxSqrt(normalLenSq); + normal *= 1.0f/distance; + PxVec3 point = pos[1] - normal * (srcShapeIndex ? capsuleGeom1 : capsuleGeom0).radius; + point += transform0.p; + contactBuffer.contact(point, normal, distance - radiusSum); + numCons++; + } + } + } + } + + if (numCons) //if we did not have contacts, then we may have the case where they are parallel, but are stacked end to end, in which case the old code will generate good contacts. + return true; + } + + // Collision response + PxVec3 pos1 = segment[0].getPointAt(s); + PxVec3 pos2 = segment[1].getPointAt(t); + + PxVec3 normal = pos1 - pos2; + + const PxReal normalLenSq = normal.magnitudeSquared(); + if (normalLenSq < 1e-6f) + { + // PT: TODO: revisit this. "FW" sounds old. + // Zero normal -> pick the direction of segment 0. + // Not always accurate but consistent with FW. + if (segLen[0] > 1e-6f) + normal = dir[0]; + else + normal = PxVec3(1.0f, 0.0f, 0.0f); + } + else + { + normal *= PxRecipSqrt(normalLenSq); + } + + pos1 += transform0.p; + contactBuffer.contact(pos1 - normal * capsuleGeom0.radius, normal, PxSqrt(squareDist) - radiusSum); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp new file mode 100644 index 0000000..8760e61 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleConvex.cpp @@ -0,0 +1,577 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuConvexMesh.h" +#include "GuConvexHelper.h" +#include "GuContactMethodImpl.h" +#include "GuVecConvexHull.h" +#include "GuVecCapsule.h" +#include "GuInternal.h" +#include "GuGJK.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +/////////// +// #include "PxRenderOutput.h" +// #include "PxsContext.h" +// static void gVisualizeLine(const PxVec3& a, const PxVec3& b, PxcNpThreadContext& context, PxU32 color=0xffffff) +// { +// PxMat44 m = PxMat44::identity(); +// +// PxRenderOutput& out = context.mRenderOutput; +// out << color << m << RenderOutput::LINES << a << b; +// } +/////////// + +static const PxReal fatConvexEdgeCoeff = 0.01f; + +static bool intersectEdgeEdgePreca(const PxVec3& p1, const PxVec3& p2, const PxVec3& v1, const PxPlane& plane, PxU32 i, PxU32 j, float coeff, const PxVec3& dir, const PxVec3& p3, const PxVec3& p4, PxReal& dist, PxVec3& ip, float limit) +{ + // if colliding edge (p3,p4) does not cross plane return no collision + // same as if p3 and p4 on same side of plane return 0 + // + // Derivation: + // d3 = d(p3, P) = (p3 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // d4 = d(p4, P) = (p4 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // if d3 and d4 have the same sign, they're on the same side of the plane => no collision + // We test both sides at the same time by only testing Sign(d3 * d4). + // ### put that in the Plane class + // ### also check that code in the triangle class that might be similar + const PxReal d3 = plane.distance(p3); + PxReal temp = d3 * plane.distance(p4); + if(temp>0.0f) + return false; + + // if colliding edge (p3,p4) and plane are parallel return no collision + PxVec3 v2 = p4 - p3; + + temp = plane.n.dot(v2); + if(temp==0.0f) + return false; // ### epsilon would be better + + // compute intersection point of plane and colliding edge (p3,p4) + ip = p3-v2*(d3/temp); + + // compute distance of intersection from line (ip, -dir) to line (p1,p2) + dist = (v1[i]*(ip[j]-p1[j])-v1[j]*(ip[i]-p1[i]))*coeff; + if(distmax0) PxSwap(min0, max0); + min0 -= radius; + max0 += radius; + + // Project convex + PxReal Min1, Max1; + (polyData.mProjectHull)(polyData, axis, worldTM, scaling, Min1, Max1); + + // Test projections + if(max0=0.0f); + const PxReal d1 = Max1 - min0; + PX_ASSERT(d1>=0.0f); + depth = physx::intrinsics::selectMin(d0, d1); + return true; +} + +static bool GuCapsuleConvexOverlap(const Segment& segment, PxReal radius, + const PolygonalData& polyData, + const FastVertex2ShapeScaling& scaling, + const PxTransform& transform, + PxReal* t, PxVec3* pp, bool isSphere) +{ + // TODO: + // - test normal & edge in same loop + // - local space + // - use precomputed face value + // - optimize projection + + PxVec3 Sep(0,0,0); + PxReal PenDepth = PX_MAX_REAL; + + PxU32 nbPolys = polyData.mNbPolygons; + const HullPolygonData* polys = polyData.mPolygons; + + const Matrix34FromTransform worldTM(transform); + + // Test normals + for(PxU32 i=0;i 1E-7f) //the ray direction "exits" from the back side + { + earliestExit = physx::intrinsics::selectMin(earliestExit, distAlongRay); + } + else if (dn < -1E-7f) //the ray direction "enters" from the front side + { +/* if (distAlongRay > latestEntry) + { + latestEntry = distAlongRay; + }*/ + latestEntry = physx::intrinsics::selectMax(latestEntry, distAlongRay); + } + else + { + //plane normal and ray dir are orthogonal + if(distToPlane > 0.0f) + return false; //a plane is parallel with ray -- and we're outside the ray -- we definitely miss the entire convex! + } + } + + if(latestEntry < earliestExit && latestEntry != -FLT_MAX && latestEntry < maxDist-1e-5f) + { + t = latestEntry; + return true; + } + return false; +} + +// PT: version based on Gu::raycast_convexMesh to handle scaling, but modified to make sure it works when ray starts inside the convex +static void GuGenerateVFContacts2(PxContactBuffer& contactBuffer, + // + const PxTransform& convexPose, + const PolygonalData& polyData, // Convex data + const PxMeshScale& scale, + // + PxU32 nbPts, + const PxVec3* PX_RESTRICT points, + const PxReal radius, // Capsule's radius + // + const PxVec3& normal, + const PxReal contactDistance) +{ + PX_ASSERT(PxAbs(normal.magnitudeSquared()-1)<1e-4f); + + //scaling: transform the ray to vertex space + const PxMat34 world2vertexSkew = scale.getInverse() * convexPose.getInverse(); + + const PxVec3 vrayDir = world2vertexSkew.rotate( -normal ); + + const PxReal maxDist = contactDistance + radius; + + for(PxU32 i=0;i(shape0); + if(shape0.getType()==PxGeometryType::eSPHERE) + shapeCapsule.halfHeight = 0.0f; + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + + PxVec3 onSegment, onConvex; + PxReal distance; + PxVec3 normal_; + { + const ConvexMesh* cm = static_cast(shapeConvex.convexMesh); + + using namespace aos; + Vec3V closA, closB, normalV; + GjkStatus status; + FloatV dist; + { + const Vec3V zeroV = V3Zero(); + const ConvexHullData* hullData = &cm->getHull(); + + const FloatV capsuleHalfHeight = FLoad(shapeCapsule.halfHeight); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + + const PxMatTransformV aToB(transform1.transformInv(transform0)); + + const ConvexHullV convexHull(hullData, zeroV, vScale, vQuat, shapeConvex.scale.isIdentity()); + + //transform capsule(a) into the local space of convexHull(b), treat capsule as segment + const CapsuleV capsule(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), FZero()); + + const LocalConvex convexA(capsule); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(convexA.getCenter(), convexB.getCenter()); + + status = gjk, LocalConvex >(convexA, convexB, initialSearchDir, FMax(),closA, closB, normalV, dist); + } + + if(status == GJK_CONTACT) + distance = 0.f; + else + { + //const FloatV sqDist = FMul(dist, dist); + V3StoreU(closB, onConvex); + FStore(dist, &distance); + V3StoreU(normalV, normal_); + onConvex = transform1.transform(onConvex); + normal_ = transform1.rotate(normal_); + } + } + + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; + + if(distance >= inflatedRadius) + return false; + + Segment worldSegment; + getCapsuleSegment(transform0, shapeCapsule, worldSegment); + + const bool isSphere = worldSegment.p0 == worldSegment.p1; + const PxU32 nbPts = PxU32(isSphere ? 1 : 2); + + PX_ASSERT(contactBuffer.count==0); + + FastVertex2ShapeScaling convexScaling; + const bool idtConvexScale = shapeConvex.scale.isIdentity(); + if(!idtConvexScale) + convexScaling.init(shapeConvex.scale); + + PolygonalData polyData; + getPolygonalData_Convex(&polyData, _getHullData(shapeConvex), convexScaling); + +// if(0) + if(distance > 0.f) + { + // PT: the capsule segment doesn't intersect the convex => distance-based version + PxVec3 normal = -normal_; + + // PT: generate VF contacts for segment's vertices vs convex + GuGenerateVFContacts2( contactBuffer, + transform1, polyData, shapeConvex.scale, + nbPts, &worldSegment.p0, shapeCapsule.radius, + normal, params.mContactDistance); + + // PT: early exit if we already have 2 stable contacts + if(contactBuffer.count==2) + return true; + + // PT: else generate slower EE contacts + if(!isSphere) + { + const Matrix34FromTransform worldTM(transform1); + GuGenerateEEContacts2b(contactBuffer, worldSegment, shapeCapsule.radius, + worldTM, polyData, convexScaling, + normal, params.mContactDistance); + } + + // PT: run VF case for convex-vertex-vs-capsule only if we don't have any contact yet + if(!contactBuffer.count) + { +// gVisualizeLine(onConvex, onConvex + normal, context, PxDebugColor::eARGB_RED); + //PxReal distance = PxSqrt(sqDistance); + contactBuffer.contact(onConvex, normal, distance - shapeCapsule.radius); + } + } + else + { + // PT: the capsule segment intersects the convex => penetration-based version +//printf("Penetration-based:\n"); + + // PT: compute penetration vector (MTD) + PxVec3 SepAxis; + if(!GuCapsuleConvexOverlap(worldSegment, shapeCapsule.radius, polyData, convexScaling, transform1, NULL, &SepAxis, isSphere)) + { +//printf("- no overlap\n"); + return false; + } + + // PT: generate VF contacts for segment's vertices vs convex + GuGenerateVFContacts2( contactBuffer, + transform1, polyData, shapeConvex.scale, + nbPts, &worldSegment.p0, shapeCapsule.radius, + SepAxis, params.mContactDistance); + + // PT: early exit if we already have 2 stable contacts +//printf("- %d VF contacts\n", contactBuffer.count); + if(contactBuffer.count==2) + return true; + + // PT: else generate slower EE contacts + if(!isSphere) + { + GuGenerateEEContacts(contactBuffer, worldSegment, shapeCapsule.radius, params.mContactDistance, polyData, transform1, convexScaling, SepAxis); +//printf("- %d total contacts\n", contactBuffer.count); + } + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp new file mode 100644 index 0000000..678a230 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCapsuleMesh.cpp @@ -0,0 +1,637 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuIntersectionEdgeEdge.h" +#include "GuDistanceSegmentTriangle.h" +#include "GuIntersectionRayTriangle.h" +#include "GuIntersectionTriangleBox.h" +#include "GuInternal.h" +#include "GuContactMethodImpl.h" +#include "GuFeatureCode.h" +#include "GuMidphaseInterface.h" +#include "GuEntityReport.h" +#include "GuHeightFieldUtil.h" +#include "GuConvexEdgeFlags.h" +#include "GuBox.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +#define DEBUG_RENDER_MESHCONTACTS 0 + +#if DEBUG_RENDER_MESHCONTACTS +#include "PxPhysics.h" +#include "PxScene.h" +#endif + +#define USE_AABB_TRI_CULLING + +//#define USE_CAPSULE_TRI_PROJ_CULLING +//#define USE_CAPSULE_TRI_SAT_CULLING +#define VISUALIZE_TOUCHED_TRIS 0 +#define VISUALIZE_CULLING_BOX 0 + +#if VISUALIZE_TOUCHED_TRIS +#include "PxRenderOutput.h" +#include "PxsContactManager.h" +#include "PxsContext.h" +static void gVisualizeLine(const PxVec3& a, const PxVec3& b, PxcNpThreadContext& context, PxU32 color=0xffffff) +{ + PxMat44 m = PxMat44::identity(); + + PxRenderOutput& out = context.mRenderOutput; + out << color << m << PxRenderOutput::LINES << a << b; +} +static void gVisualizeTri(const PxVec3& a, const PxVec3& b, const PxVec3& c, PxcNpThreadContext& context, PxU32 color=0xffffff) +{ + PxMat44 m = PxMat44::identity(); + + PxRenderOutput& out = context.mRenderOutput; + out << color << m << PxRenderOutput::TRIANGLES << a << b << c; +} + +static PxU32 gColors[8] = { 0xff0000ff, 0xff00ff00, 0xffff0000, + 0xff00ffff, 0xffff00ff, 0xffffff00, + 0xff000080, 0xff008000}; +#endif + +static const float fatBoxEdgeCoeff = 0.01f; + +static bool PxcTestAxis(const PxVec3& axis, const Segment& segment, PxReal radius, + const PxVec3* PX_RESTRICT triVerts, PxReal& depth) +{ + // Project capsule + PxReal min0 = segment.p0.dot(axis); + PxReal max0 = segment.p1.dot(axis); + if(min0>max0) PxSwap(min0, max0); + min0 -= radius; + max0 += radius; + + // Project triangle + float Min1, Max1; + { + Min1 = Max1 = triVerts[0].dot(axis); + const PxReal dp1 = triVerts[1].dot(axis); + Min1 = physx::intrinsics::selectMin(Min1, dp1); + Max1 = physx::intrinsics::selectMax(Max1, dp1); + const PxReal dp2 = triVerts[2].dot(axis); + Min1 = physx::intrinsics::selectMin(Min1, dp2); + Max1 = physx::intrinsics::selectMax(Max1, dp2); + } + + // Test projections + if(max0=0.0f); + const PxReal d1 = Max1 - min0; + PX_ASSERT(d1>=0.0f); + depth = physx::intrinsics::selectMin(d0, d1); + return true; +} + +PX_FORCE_INLINE static PxVec3 PxcComputeTriangleNormal(const PxVec3* PX_RESTRICT triVerts) +{ + return ((triVerts[0]-triVerts[1]).cross(triVerts[0]-triVerts[2])).getNormalized(); +} + +PX_FORCE_INLINE static PxVec3 PxcComputeTriangleCenter(const PxVec3* PX_RESTRICT triVerts) +{ + static const PxReal inv3 = 1.0f / 3.0f; + return (triVerts[0] + triVerts[1] + triVerts[2]) * inv3; +} + +static bool PxcCapsuleTriOverlap3(PxU8 edgeFlags, const Segment& segment, PxReal radius, const PxVec3* PX_RESTRICT triVerts, + PxReal* PX_RESTRICT t=NULL, PxVec3* PX_RESTRICT pp=NULL) +{ + PxReal penDepth = PX_MAX_REAL; + + // Test normal + PxVec3 sep = PxcComputeTriangleNormal(triVerts); + if(!PxcTestAxis(sep, segment, radius, triVerts, penDepth)) + return false; + + // Test edges + // ML:: use the active edge flag instead of the concave flag + const PxU32 activeEdgeFlag[] = {ETD_CONVEX_EDGE_01, ETD_CONVEX_EDGE_12, ETD_CONVEX_EDGE_20}; + const PxVec3 capsuleAxis = (segment.p1 - segment.p0).getNormalized(); + for(PxU32 i=0;i<3;i++) + { + //bool active =((edgeFlags & ignoreEdgeFlag[i]) == 0); + + if(edgeFlags & activeEdgeFlag[i]) + { + + const PxVec3 e0 = triVerts[i]; +// const PxVec3 e1 = triVerts[(i+1)%3]; + const PxVec3 e1 = triVerts[PxGetNextIndex3(i)]; + const PxVec3 edge = e0 - e1; + + PxVec3 cross = capsuleAxis.cross(edge); + if(!isAlmostZero(cross)) + { + cross = cross.getNormalized(); + PxReal d; + if(!PxcTestAxis(cross, segment, radius, triVerts, d)) + return false; + if(dgetRenderBuffer()) << PxRenderOutput::LINES << PxDebugColor::eARGB_BLUE // red + << Hit << (Hit + wn * 10.0f); + #endif + } + } +} + +// PT: PxcGenerateEEContacts2 uses a segment-triangle distance function, which breaks when the segment +// intersects the triangle, in which case you need to switch to a penetration-depth computation. +// If you don't do this thin capsules don't work. +static void PxcGenerateEEContacts( const PxMat34& meshAbsPose, PxContactBuffer& contactBuffer, const Segment& segment, const PxReal radius, + const PxVec3* PX_RESTRICT triVerts, const PxVec3& normal, PxU32 triangleIndex) +{ + PxVec3 s0 = segment.p0; + PxVec3 s1 = segment.p1; + makeFatEdge(s0, s1, fatBoxEdgeCoeff); + + for(PxU32 i=0;i<3;i++) + { + PxReal dist; + PxVec3 ip; + if(intersectEdgeEdge(triVerts[i], triVerts[PxGetNextIndex3(i)], -normal, s0, s1, dist, ip)) + { + ip = meshAbsPose.transform(ip); + const PxVec3 wn = meshAbsPose.rotate(normal); + + contactBuffer.contact(ip, wn, - (radius + dist), triangleIndex); + #if DEBUG_RENDER_MESHCONTACTS + PxScene *s; PxGetPhysics().getScenes(&s, 1, 0); + PxRenderOutput((PxRenderBufferImpl&)s->getRenderBuffer()) << PxRenderOutput::LINES << PxDebugColor::eARGB_BLUE // red + << ip << (ip + wn * 10.0f); + #endif + } + } +} + +static void PxcGenerateEEContacts2( const PxMat34& meshAbsPose, PxContactBuffer& contactBuffer, const Segment& segment, const PxReal radius, + const PxVec3* PX_RESTRICT triVerts, const PxVec3& normal, PxU32 triangleIndex, PxReal contactDistance) +{ + PxVec3 s0 = segment.p0; + PxVec3 s1 = segment.p1; + makeFatEdge(s0, s1, fatBoxEdgeCoeff); + + for(PxU32 i=0;i<3;i++) + { + PxReal dist; + PxVec3 ip; + if(intersectEdgeEdge(triVerts[i], triVerts[PxGetNextIndex3(i)], normal, s0, s1, dist, ip) && dist < radius+contactDistance) + { + ip = meshAbsPose.transform(ip); + const PxVec3 wn = meshAbsPose.rotate(normal); + + contactBuffer.contact(ip, wn, dist - radius, triangleIndex); + #if DEBUG_RENDER_MESHCONTACTS + PxScene *s; PxGetPhysics().getScenes(&s, 1, 0); + PxRenderOutput((PxRenderBufferImpl&)s->getRenderBuffer()) << PxRenderOutput::LINES << PxDebugColor::eARGB_BLUE // red + << ip << (ip + wn * 10.0f); + #endif + } + } +} + +namespace +{ +struct CapsuleMeshContactGeneration +{ + PxContactBuffer& mContactBuffer; + const PxMat34 mMeshAbsPose; + const Segment& mMeshCapsule; +#ifdef USE_AABB_TRI_CULLING + PxVec3p mBC; + PxVec3p mBE; +#endif + PxReal mInflatedRadius; + PxReal mContactDistance; + PxReal mShapeCapsuleRadius; + + CapsuleMeshContactGeneration(PxContactBuffer& contactBuffer, const PxTransform& transform1, const Segment& meshCapsule, PxReal inflatedRadius, PxReal contactDistance, PxReal shapeCapsuleRadius) : + mContactBuffer (contactBuffer), + mMeshAbsPose (Matrix34FromTransform(transform1)), + mMeshCapsule (meshCapsule), + mInflatedRadius (inflatedRadius), + mContactDistance (contactDistance), + mShapeCapsuleRadius (shapeCapsuleRadius) + { + PX_ASSERT(contactBuffer.count==0); +#ifdef USE_AABB_TRI_CULLING + mBC = (meshCapsule.p0 + meshCapsule.p1)*0.5f; + const PxVec3p be = (meshCapsule.p0 - meshCapsule.p1)*0.5f; + mBE.x = fabsf(be.x) + inflatedRadius; + mBE.y = fabsf(be.y) + inflatedRadius; + mBE.z = fabsf(be.z) + inflatedRadius; +#endif + } + + void processTriangle(PxU32 triangleIndex, const PxTrianglePadded& tri, PxU8 extraData/*, const PxU32* vertInds*/) + { +#ifdef USE_AABB_TRI_CULLING + #if VISUALIZE_CULLING_BOX + { + PxRenderOutput& out = context.mRenderOutput; + PxTransform idt = PxTransform(PxIdentity); + out << idt; + out << 0xffffffff; + out << PxDebugBox(mBC, mBE, true); + } + #endif +#endif + const PxVec3& p0 = tri.verts[0]; + const PxVec3& p1 = tri.verts[1]; + const PxVec3& p2 = tri.verts[2]; + +#ifdef USE_AABB_TRI_CULLING + // PT: this one is safe because triangle class is padded + // PT: TODO: is this test really needed? Not done in midphase already? + if(!intersectTriangleBox_Unsafe(mBC, mBE, p0, p1, p2)) + return; +#endif + +#ifdef USE_CAPSULE_TRI_PROJ_CULLING + PxVec3 triCenter = (p0 + p1 + p2)*0.33333333f; + PxVec3 delta = mBC - triCenter; + + PxReal depth; + if(!PxcTestAxis(delta, mMeshCapsule, mInflatedRadius, tri.verts, depth)) + return; +#endif + +#if VISUALIZE_TOUCHED_TRIS + gVisualizeTri(p0, p1, p2, context, PxDebugColor::eARGB_RED); +#endif + +#ifdef USE_CAPSULE_TRI_SAT_CULLING + PxVec3 SepAxis; + if(!PxcCapsuleTriOverlap3(extraData, mMeshCapsule, mInflatedRadius, tri.verts, NULL, &SepAxis)) + return; +#endif + + PxReal t,u,v; + const PxVec3 p1_p0 = p1 - p0; + const PxVec3 p2_p0 = p2 - p0; + const PxReal squareDist = distanceSegmentTriangleSquared(mMeshCapsule, p0, p1_p0, p2_p0, &t, &u, &v); + + // PT: do cheaper test first! + if(squareDist >= mInflatedRadius*mInflatedRadius) + return; + + // PT: backface culling without the normalize + // PT: TODO: consider doing before the segment-triangle distance test if it's cheaper + const PxVec3 planeNormal = p1_p0.cross(p2_p0); + const PxF32 planeD = planeNormal.dot(p0); // PT: actually -d compared to PxcPlane + if(planeNormal.dot(mBC) < planeD) + return; + + if(squareDist > 0.001f*0.001f) + { + // Contact information + PxVec3 normal; + if(selectNormal(extraData, u, v)) + { + normal = planeNormal.getNormalized(); + } + else + { + const PxVec3 pointOnTriangle = computeBarycentricPoint(p0, p1, p2, u, v); + + const PxVec3 pointOnSegment = mMeshCapsule.getPointAt(t); + normal = pointOnSegment - pointOnTriangle; + const PxReal l = normal.magnitude(); + if(l == 0.0f) + return; + normal = normal / l; + } + + PxcGenerateEEContacts2(mMeshAbsPose, mContactBuffer, mMeshCapsule, mShapeCapsuleRadius, tri.verts, normal, triangleIndex, mContactDistance); + PxcGenerateVFContacts(mMeshAbsPose, mContactBuffer, mMeshCapsule, mShapeCapsuleRadius, tri.verts, normal, triangleIndex, mContactDistance); + } + else + { + PxVec3 SepAxis; + if(!PxcCapsuleTriOverlap3(extraData, mMeshCapsule, mInflatedRadius, tri.verts, NULL, &SepAxis)) + return; + + PxcGenerateEEContacts(mMeshAbsPose, mContactBuffer, mMeshCapsule, mShapeCapsuleRadius, tri.verts, SepAxis, triangleIndex); + PxcGenerateVFContacts(mMeshAbsPose, mContactBuffer, mMeshCapsule, mShapeCapsuleRadius, tri.verts, SepAxis, triangleIndex, mContactDistance); + } + } + +private: + CapsuleMeshContactGeneration& operator=(const CapsuleMeshContactGeneration&); +}; + +struct CapsuleMeshContactGenerationCallback_NoScale : MeshHitCallback +{ + CapsuleMeshContactGeneration mGeneration; + const TriangleMesh* mMeshData; + + CapsuleMeshContactGenerationCallback_NoScale( + PxContactBuffer& contactBuffer, + const PxTransform& transform1, const Segment& meshCapsule, + PxReal inflatedRadius, PxReal contactDistance, + PxReal shapeCapsuleRadius, const TriangleMesh* meshData + ) : + MeshHitCallback (CallbackMode::eMULTIPLE), + mGeneration (contactBuffer, transform1, meshCapsule, inflatedRadius, contactDistance, shapeCapsuleRadius), + mMeshData (meshData) + { + PX_ASSERT(contactBuffer.count==0); + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* /*vInds*/) + { + PxTrianglePadded tri; + // PT: TODO: revisit this, avoid the copy + tri.verts[0] = v0; + tri.verts[1] = v1; + tri.verts[2] = v2; + + const PxU32 triangleIndex = hit.faceIndex; + + //ML::set all the edges to be active, if the mExtraTrigData exist, we overwrite this flag + const PxU8 extraData = getConvexEdgeFlags(mMeshData->getExtraTrigData(), triangleIndex); + + mGeneration.processTriangle(triangleIndex, tri, extraData); + return true; + } + +private: + CapsuleMeshContactGenerationCallback_NoScale& operator=(const CapsuleMeshContactGenerationCallback_NoScale&); +}; + +struct CapsuleMeshContactGenerationCallback_Scale : CapsuleMeshContactGenerationCallback_NoScale +{ + const FastVertex2ShapeScaling& mScaling; + + CapsuleMeshContactGenerationCallback_Scale( + PxContactBuffer& contactBuffer, + const PxTransform& transform1, const Segment& meshCapsule, + PxReal inflatedRadius, const FastVertex2ShapeScaling& scaling, PxReal contactDistance, + PxReal shapeCapsuleRadius, const TriangleMesh* meshData + ) : + CapsuleMeshContactGenerationCallback_NoScale(contactBuffer, transform1, meshCapsule, inflatedRadius, contactDistance, shapeCapsuleRadius, meshData), + mScaling (scaling) + { + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* /*vInds*/) + { + PxTrianglePadded tri; + getScaledVertices(tri.verts, v0, v1, v2, false, mScaling); + + const PxU32 triangleIndex = hit.faceIndex; + + //ML::set all the edges to be active, if the mExtraTrigData exist, we overwrite this flag + PxU8 extraData = getConvexEdgeFlags(mMeshData->getExtraTrigData(), triangleIndex); + + if(mScaling.flipsNormal()) + flipConvexEdgeFlags(extraData); + + mGeneration.processTriangle(triangleIndex, tri, extraData); + return true; + } + +private: + CapsuleMeshContactGenerationCallback_Scale& operator=(const CapsuleMeshContactGenerationCallback_Scale&); +}; + +} + +// PT: computes local capsule without going to world-space +static PX_FORCE_INLINE Segment computeLocalCapsule(const PxTransform& transform0, const PxTransform& transform1, const PxCapsuleGeometry& shapeCapsule) +{ + const PxVec3 halfHeight = getCapsuleHalfHeightVector(transform0, shapeCapsule); + const PxVec3 delta = transform1.p - transform0.p; + return Segment( + transform1.rotateInv(halfHeight - delta), + transform1.rotateInv(-halfHeight - delta)); +} + +bool Gu::contactCapsuleMesh(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; //AM: inflate! + const Segment meshCapsule = computeLocalCapsule(transform0, transform1, shapeCapsule); + + const TriangleMesh* meshData = _getMeshData(shapeMesh); + + //bound the capsule in shape space by an OBB: + Box queryBox; + { + const Capsule queryCapsule(meshCapsule, inflatedRadius); + queryBox.create(queryCapsule); + } + + if(shapeMesh.scale.isIdentity()) + { + CapsuleMeshContactGenerationCallback_NoScale callback(contactBuffer, transform1, meshCapsule, + inflatedRadius, params.mContactDistance, shapeCapsule.radius, meshData); + + // PT: TODO: switch to capsule query here + Midphase::intersectOBB(meshData, queryBox, callback, true); + } + else + { + const FastVertex2ShapeScaling meshScaling(shapeMesh.scale); + + CapsuleMeshContactGenerationCallback_Scale callback(contactBuffer, transform1, meshCapsule, + inflatedRadius, meshScaling, params.mContactDistance, shapeCapsule.radius, meshData); + + //switched from capsuleCollider to boxCollider so we can support nonuniformly scaled meshes by scaling the query region: + + //apply the skew transform to the box: + meshScaling.transformQueryBounds(queryBox.center, queryBox.extents, queryBox.rot); + + Midphase::intersectOBB(meshData, queryBox, callback, true); + } + return contactBuffer.count > 0; +} + +namespace +{ +struct CapsuleHeightfieldContactGenerationCallback : OverlapReport +{ + CapsuleMeshContactGeneration mGeneration; + const HeightFieldUtil& mHfUtil; + const PxTransform& mTransform1; + + CapsuleHeightfieldContactGenerationCallback( + PxContactBuffer& contactBuffer, + const PxTransform& transform1, const HeightFieldUtil& hfUtil, const Segment& meshCapsule, + PxReal inflatedRadius, PxReal contactDistance, PxReal shapeCapsuleRadius + ) : + mGeneration (contactBuffer, transform1, meshCapsule, inflatedRadius, contactDistance, shapeCapsuleRadius), + mHfUtil (hfUtil), + mTransform1 (transform1) + { + PX_ASSERT(contactBuffer.count==0); + } + + // PT: TODO: refactor/unify with similar code in other places + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + const PxU8 nextInd[] = {2,0,1}; + + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxU32 vertIndices[3]; + PxTrianglePadded currentTriangle; // in world space + PxU32 adjInds[3]; + mHfUtil.getTriangle(mTransform1, currentTriangle, vertIndices, adjInds, triangleIndex, false, false); + + PxVec3 normal; + currentTriangle.normal(normal); + + PxU8 triFlags = 0; //KS - temporary until we can calculate triFlags for HF + + for(PxU32 a = 0; a < 3; ++a) + { + if(adjInds[a] != 0xFFFFFFFF) + { + PxTriangle adjTri; + mHfUtil.getTriangle(mTransform1, adjTri, NULL, NULL, adjInds[a], false, false); + //We now compare the triangles to see if this edge is active + + PxVec3 adjNormal; + adjTri.denormalizedNormal(adjNormal); + PxU32 otherIndex = nextInd[a]; + PxF32 projD = adjNormal.dot(currentTriangle.verts[otherIndex] - adjTri.verts[0]); + if(projD < 0.f) + { + adjNormal.normalize(); + + PxF32 proj = adjNormal.dot(normal); + + if(proj < 0.999f) + { + triFlags |= 1 << (a+3); + } + } + } + else + { + triFlags |= 1 << (a+3); + } + } + + mGeneration.processTriangle(triangleIndex, currentTriangle, triFlags); + } + return true; + } + +private: + CapsuleHeightfieldContactGenerationCallback& operator=(const CapsuleHeightfieldContactGenerationCallback&); +}; +} + +bool Gu::contactCapsuleHeightfield(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + const PxHeightFieldGeometry& shapeMesh = checkedCast(shape1); + + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; //AM: inflate! + const Segment meshCapsule = computeLocalCapsule(transform0, transform1, shapeCapsule); + + // We must be in local space to use the cache + + const HeightFieldUtil hfUtil(shapeMesh); + + CapsuleHeightfieldContactGenerationCallback callback( + contactBuffer, transform1, hfUtil, meshCapsule, inflatedRadius, params.mContactDistance, shapeCapsule.radius); + + //switched from capsuleCollider to boxCollider so we can support nonuniformly scaled meshes by scaling the query region: + + //bound the capsule in shape space by an AABB: + + // PT: TODO: improve these bounds (see computeCapsuleBounds) + hfUtil.overlapAABBTriangles(transform0, transform1, getLocalCapsuleBounds(inflatedRadius, shapeCapsule.halfHeight), callback); + + return contactBuffer.count > 0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp new file mode 100644 index 0000000..5842792 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexConvex.cpp @@ -0,0 +1,1030 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuContactPolygonPolygon.h" +#include "GuConvexHelper.h" +#include "GuInternal.h" +#include "GuSeparatingAxes.h" +#include "GuContactMethodImpl.h" + +#include "foundation/PxFPU.h" +#include "foundation/PxAlloca.h" +#include "CmMatrix34.h" + +// csigg: the single reference of gEnableOptims (below) has been +// replaced with the actual value to prevent ios64 compiler crash. +// static const int gEnableOptims = 1; +#define CONVEX_CONVEX_ROUGH_FIRST_PASS +#define TEST_INTERNAL_OBJECTS +#ifdef TEST_INTERNAL_OBJECTS + #define USE_BOX_DATA +#endif + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace aos; +using namespace intrinsics; + +#ifdef TEST_INTERNAL_OBJECTS +#ifdef USE_BOX_DATA +PX_FORCE_INLINE void BoxSupport(const float extents[3], const PxVec3& sv, float p[3]) +{ + const PxU32* iextents = reinterpret_cast(extents); + const PxU32* isv = reinterpret_cast(&sv); + PxU32* ip = reinterpret_cast(p); + + ip[0] = iextents[0]|(isv[0]&PX_SIGN_BITMASK); + ip[1] = iextents[1]|(isv[1]&PX_SIGN_BITMASK); + ip[2] = iextents[2]|(isv[2]&PX_SIGN_BITMASK); +} +#endif + +#if PX_DEBUG +static const PxReal testInternalObjectsEpsilon = 1.0e-3f; +#endif + +#ifdef DO_NOT_REMOVE + PX_FORCE_INLINE void testInternalObjects_( const PxVec3& delta_c, const PxVec3& axis, + const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxMat34& tr0, const PxMat34& tr1, + float& dmin, float contactDistance) + { + { +/* float projected0 = axis.dot(tr0.p); + float projected1 = axis.dot(tr1.p); + float min0 = projected0 - polyData0.mInternal.mRadius; + float max0 = projected0 + polyData0.mInternal.mRadius; + float min1 = projected1 - polyData1.mInternal.mRadius; + float max1 = projected1 + polyData1.mInternal.mRadius; +*/ + float MinMaxRadius = polyData0.mInternal.mRadius + polyData1.mInternal.mRadius; + PxVec3 delta = tr0.p - tr1.p; + const PxReal dp = axis.dot(delta); +// const PxReal dp2 = axis.dot(delta_c); + +// const PxReal d0 = max0 - min1; +// const PxReal d0 = projected0 + polyData0.mInternal.mRadius - projected1 + polyData1.mInternal.mRadius; +// const PxReal d0 = projected0 - projected1 + polyData0.mInternal.mRadius + polyData1.mInternal.mRadius; +// const PxReal d0 = projected0 - projected1 + MinMaxRadius; +// const PxReal d0 = axis.dot(tr0.p) - axis.dot(tr1.p) + MinMaxRadius; +// const PxReal d0 = axis.dot(tr0.p - tr1.p) + MinMaxRadius; +// const PxReal d0 = MinMaxRadius + axis.dot(delta); + const PxReal d0 = MinMaxRadius + dp; + +// const PxReal d1 = max1 - min0; +// const PxReal d1 = projected1 + polyData1.mInternal.mRadius - projected0 + polyData0.mInternal.mRadius; +// const PxReal d1 = projected1 - projected0 + polyData1.mInternal.mRadius + polyData0.mInternal.mRadius; +// const PxReal d1 = projected1 - projected0 + MinMaxRadius; +// const PxReal d1 = axis.dot(tr1.p) - axis.dot(tr0.p) + MinMaxRadius; +// const PxReal d1 = axis.dot(tr1.p - tr0.p) + MinMaxRadius; +// const PxReal d1 = MinMaxRadius - axis.dot(delta); + const PxReal d1 = MinMaxRadius - dp; + + dmin = selectMin(d0, d1); + return; + } + + #ifdef USE_BOX_DATA + const PxVec3 localAxis0 = tr0.rotateTranspose(axis); + const PxVec3 localAxis1 = tr1.rotateTranspose(axis); + + const float dp = delta_c.dot(axis); + + float p0[3]; + BoxSupport(polyData0.mInternal.mExtents, localAxis0, p0); + float p1[3]; + BoxSupport(polyData1.mInternal.mExtents, localAxis1, p1); + + const float Radius0 = p0[0]*localAxis0.x + p0[1]*localAxis0.y + p0[2]*localAxis0.z; + const float Radius1 = p1[0]*localAxis1.x + p1[1]*localAxis1.y + p1[2]*localAxis1.z; + + const float MinRadius = selectMax(Radius0, polyData0.mInternal.mRadius); + const float MaxRadius = selectMax(Radius1, polyData1.mInternal.mRadius); + #else + const float dp = delta_c.dot(axis); + const float MinRadius = polyData0.mInternal.mRadius; + const float MaxRadius = polyData1.mInternal.mRadius; + #endif + const float MinMaxRadius = MaxRadius + MinRadius; + const float d0 = MinMaxRadius + dp; + const float d1 = MinMaxRadius - dp; + + dmin = selectMin(d0, d1); + } +#endif + +static PX_FORCE_INLINE bool testInternalObjects( const PxVec3& delta_c, const PxVec3& axis, + const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxMat34& tr0, const PxMat34& tr1, + float dmin) +{ +#ifdef USE_BOX_DATA + const PxVec3 localAxis0 = tr0.rotateTranspose(axis); + const PxVec3 localAxis1 = tr1.rotateTranspose(axis); + + const float dp = delta_c.dot(axis); + + float p0[3]; + BoxSupport(polyData0.mInternal.mExtents, localAxis0, p0); + float p1[3]; + BoxSupport(polyData1.mInternal.mExtents, localAxis1, p1); + + const float Radius0 = p0[0]*localAxis0.x + p0[1]*localAxis0.y + p0[2]*localAxis0.z; + const float Radius1 = p1[0]*localAxis1.x + p1[1]*localAxis1.y + p1[2]*localAxis1.z; + + const float MinRadius = selectMax(Radius0, polyData0.mInternal.mRadius); + const float MaxRadius = selectMax(Radius1, polyData1.mInternal.mRadius); +#else + const float dp = delta_c.dot(axis); + const float MinRadius = polyData0.mInternal.mRadius; + const float MaxRadius = polyData1.mInternal.mRadius; +#endif + const float MinMaxRadius = MaxRadius + MinRadius; + const float d0 = MinMaxRadius + dp; + const float d1 = MinMaxRadius - dp; + + const float depth = selectMin(d0, d1); + if(depth>dmin) + return false; + return true; +} +#endif + +PX_FORCE_INLINE float PxcMultiplyAdd3x4(PxU32 i, const PxVec3& p0, const PxVec3& p1, const PxMat34& world) +{ + return (p1.x + p0.x) * world.m.column0[i] + (p1.y + p0.y) * world.m.column1[i] + (p1.z + p0.z) * world.m.column2[i] + 2.0f * world.p[i]; +} + +PX_FORCE_INLINE float PxcMultiplySub3x4(PxU32 i, const PxVec3& p0, const PxVec3& p1, const PxMat34& world) +{ + return (p1.x - p0.x) * world.m.column0[i] + (p1.y - p0.y) * world.m.column1[i] + (p1.z - p0.z) * world.m.column2[i]; +} + +static PX_FORCE_INLINE bool testNormal( const PxVec3& axis, PxReal min0, PxReal max0, + const PolygonalData& polyData1, + const PxMat34& m1to0, + const FastVertex2ShapeScaling& scaling1, + PxReal& depth, PxReal contactDistance) +{ + //The separating axis we want to test is a face normal of hull0 + PxReal min1, max1; + (polyData1.mProjectHull)(polyData1, axis, m1to0, scaling1, min1, max1); + + if(max0+contactDistance boxExtent.x + fAWdU[0]) return false; + + dir.y = PxcMultiplySub3x4(1, p0, p1, world); + boxExtent.y = maximum.y - minimum.y; + diff.y = (PxcMultiplyAdd3x4(1, p0, p1, world) - (maximum.y+minimum.y)); + fAWdU[1] = PxAbs(dir.y); + if(PxAbs(diff.y)> boxExtent.y + fAWdU[1]) return false; + + dir.z = PxcMultiplySub3x4(2, p0, p1, world); + boxExtent.z = maximum.z - minimum.z; + diff.z = (PxcMultiplyAdd3x4(2, p0, p1, world) - (maximum.z+minimum.z)); + fAWdU[2] = PxAbs(dir.z); + if(PxAbs(diff.z)> boxExtent.z + fAWdU[2]) return false; + + PxReal f; + f = dir.y * diff.z - dir.z*diff.y; if(PxAbs(f)>boxExtent.y*fAWdU[2] + boxExtent.z*fAWdU[1]) return false; + f = dir.z * diff.x - dir.x*diff.z; if(PxAbs(f)>boxExtent.x*fAWdU[2] + boxExtent.z*fAWdU[0]) return false; + f = dir.x * diff.y - dir.y*diff.x; if(PxAbs(f)>boxExtent.x*fAWdU[1] + boxExtent.y*fAWdU[0]) return false; + return true; +} + +#define EXPERIMENT + +/* +Edge culling can clearly be improved : in ConvexTest02 for example, edges don't even touch the other mesh sometimes. +*/ +static void PxcFindSeparatingAxes( SeparatingAxes& sa, const PxU32* PX_RESTRICT indices, PxU32 numPolygons, + const PolygonalData& polyData, + const PxMat34& world0, const PxPlane& plane, + const PxMat34& m0to1, const PxBounds3& aabb, PxReal contactDistance, + const FastVertex2ShapeScaling& scaling) +{ +// EdgeCache edgeCache; // PT: TODO: check this is actually useful + const PxVec3* PX_RESTRICT vertices = polyData.mVerts; + const HullPolygonData* PX_RESTRICT polygons = polyData.mPolygons; + const PxU8* PX_RESTRICT vrefsBase = polyData.mPolygonVertexRefs; + + while(numPolygons--) + { + //Get current polygon + const HullPolygonData& P = polygons[*indices++]; + const PxU8* PX_RESTRICT VData = vrefsBase + P.mVRef8; + + // Loop through polygon vertices == polygon edges + PxU32 numVerts = P.mNbVerts; + +#ifdef EXPERIMENT + PxVec3 p0,p1; + PxU8 VRef0 = VData[0]; + p0 = scaling * vertices[VRef0]; + bool b0 = plane.distance(p0) <= contactDistance; +#endif + + for(PxU32 j = 0; j < numVerts; j++) + { + PxU32 j1 = j+1; + if(j1 >= numVerts) j1 = 0; + +#ifndef EXPERIMENT + PxU8 VRef0 = VData[j]; +#endif + PxU8 VRef1 = VData[j1]; + +// PxOrder(VRef0, VRef1); //make sure edge (a,b) == edge (b,a) +// if (edgeCache.isInCache(VRef0, VRef1)) +// continue; + + //transform points //TODO: once this works we could transform plan instead, that is more efficient!! + +#ifdef EXPERIMENT + p1 = scaling * vertices[VRef1]; +#else + const PxVec3 p0 = scaling * vertices[VRef0]; + const PxVec3 p1 = scaling * vertices[VRef1]; +#endif + + // Cheap but effective culling! +#ifdef EXPERIMENT + bool b1 = plane.distance(p1) <= contactDistance; + if(b0 || b1) +#else + if(plane.signedDistanceHessianNormalForm(p0) <= contactDistance || + plane.signedDistanceHessianNormalForm(p1) <= contactDistance) +#endif + { + if(PxcSegmentAABBIntersect(p0, p1, aabb.minimum, aabb.maximum, m0to1)) + { + // Create current edge. We're only interested in different edge directions so we normalize. + const PxVec3 currentEdge = world0.rotate(p0 - p1).getNormalized(); + sa.addAxis(currentEdge); + } + } +#ifdef EXPERIMENT + VRef0 = VRef1; + p0 = p1; + b0 = b1; +#endif + } + } +} + +static bool PxcTestFacesSepAxesBackface(const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + const PxMat34& m1to0, const PxVec3& delta, + PxReal& dmin, PxVec3& sep, PxU32& id, PxU32* PX_RESTRICT indices_, PxU32& numIndices, + PxReal contactDistance, float toleranceLength +#ifdef TEST_INTERNAL_OBJECTS + , const PxVec3& worldDelta +#endif + ) +{ + PX_UNUSED(toleranceLength); // Only used in Debug + id = PX_INVALID_U32; + PxU32* indices = indices_; + + const PxU32 num = polyData0.mNbPolygons; + const PxVec3* PX_RESTRICT vertices = polyData0.mVerts; + const HullPolygonData* PX_RESTRICT polygons = polyData0.mPolygons; + + //transform delta from hull0 shape into vertex space: + const PxVec3 vertSpaceDelta = scaling0 % delta; + + // PT: prefetch polygon data + { + const PxU32 dataSize = num*sizeof(HullPolygonData); + for(PxU32 offset=0; offset < dataSize; offset+=128) + PxPrefetchLine(polygons, offset); + } + + for(PxU32 i=0; i < num; i++) + { + const HullPolygonData& P = polygons[i]; + const PxPlane& PL = P.mPlane; + + // Do backface-culling + if(PL.n.dot(vertSpaceDelta) < 0.0f) + continue; + + //normals transform by inverse transpose: (and transpose(skew) == skew as its symmetric) + PxVec3 shapeSpaceNormal = scaling0 % PL.n; + //renormalize: (Arr!) + const PxReal magnitude = shapeSpaceNormal.normalize(); // PT: We need to find a way to skip this normalize + +#ifdef TEST_INTERNAL_OBJECTS + +/* +const PxVec3 worldNormal_ = world0.rotate(shapeSpaceNormal); +PxReal d0; +bool test0 = PxcTestSeparatingAxis(polyData0, polyData1, world0, world1, scaling0, scaling1, worldNormal_, d0, contactDistance); + +PxReal d1; +const float invMagnitude0 = 1.0f / magnitude; +bool test1 = PxcTestNormal(shapeSpaceNormal, P.getMin(vertices) * invMagnitude0, P.getMax() * invMagnitude0, polyData1, m1to0, scaling1, d1, contactDistance); + +PxReal d2; +testInternalObjects_(worldDelta, worldNormal_, polyData0, polyData1, world0, world1, d2, contactDistance); +*/ + + const PxVec3 worldNormal = world0.rotate(shapeSpaceNormal); + if(!testInternalObjects(worldDelta, worldNormal, polyData0, polyData1, world0, world1, dmin)) + { + #if PX_DEBUG + PxReal d; + const float invMagnitude = 1.0f / magnitude; + if(testNormal(shapeSpaceNormal, P.getMin(vertices) * invMagnitude, P.getMax() * invMagnitude, polyData1, m1to0, scaling1, d, contactDistance)) //note how we scale scalars by skew magnitude change as we do plane d-s. + { + PX_ASSERT(d + testInternalObjectsEpsilon*toleranceLength >= dmin); + } + #endif + continue; + } +#endif + + *indices++ = i; + + //////////////////// + /* + //gotta transform minimum and maximum from vertex to shape space! + //I think they transform like the 'd' of the plane, basically by magnitude division! + //unfortunately I am not certain of that, so let's convert them to a point in vertex space, transform that, and then convert back to a plane d. + + //let's start by transforming the plane's d: + //a point on the plane: + + PxVec3 vertSpaceDPoint = PL.normal * -PL.d; + + //make sure this is on the plane: + PxReal distZero = PL.signedDistanceHessianNormalForm(vertSpaceDPoint); //should be zero + + //transform: + + PxVec3 shapeSpaceDPoint = cache.mVertex2ShapeSkew[skewIndex] * vertSpaceDPoint; + + //make into a d offset again by projecting along the plane: + PxcPlane shapeSpacePlane(shapeSpaceNormal, shapeSpaceDPoint); + + //see what D is!! + + + //NOTE: for boxes scale[0] is always id so this is all redundant. Hopefully for convex convex it will become useful! + */ + + //////////////////// + + PxReal d; + const float invMagnitude = 1.0f / magnitude; + if(!testNormal(shapeSpaceNormal, P.getMin(vertices) * invMagnitude, P.getMax() * invMagnitude, polyData1, m1to0, scaling1, d, contactDistance)) //note how we scale scalars by skew magnitude change as we do plane d-s. + return false; + + if(d < dmin) + { +#ifdef TEST_INTERNAL_OBJECTS + sep = worldNormal; +#else + sep = world0.rotate(shapeSpaceNormal); +#endif + dmin = d; + id = i; + } + } + + numIndices = PxU32(indices - indices_); + + PX_ASSERT(id!=PX_INVALID_U32); //Should never happen with this version + + return true; +} + +// PT: isolating this piece of code allows us to better see what happens in PIX. For some reason it looks +// like isolating it creates *less* LHS than before, but I don't understand why. There's still a lot of +// bad stuff there anyway +//PX_FORCE_INLINE +static void prepareData(PxPlane& witnessPlane0, PxPlane& witnessPlane1, + PxBounds3& aabb0, PxBounds3& aabb1, + const PxBounds3& hullBounds0, const PxBounds3& hullBounds1, + const PxPlane& vertSpacePlane0, const PxPlane& vertSpacePlane1, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + const PxMat34& m0to1, const PxMat34& m1to0, + PxReal contactDistance + ) +{ + scaling0.transformPlaneToShapeSpace(vertSpacePlane0.n, vertSpacePlane0.d, witnessPlane0.n, witnessPlane0.d); + scaling1.transformPlaneToShapeSpace(vertSpacePlane1.n, vertSpacePlane1.d, witnessPlane1.n, witnessPlane1.d); + + //witnessPlane0 = witnessPlane0.getTransformed(m0to1); + //witnessPlane1 = witnessPlane1.getTransformed(m1to0); + const PxVec3 newN0 = m0to1.rotate(witnessPlane0.n); + witnessPlane0 = PxPlane(newN0, witnessPlane0.d - m0to1.p.dot(newN0)); + const PxVec3 newN1 = m1to0.rotate(witnessPlane1.n); + witnessPlane1 = PxPlane(newN1, witnessPlane1.d - m1to0.p.dot(newN1)); + + aabb0 = hullBounds0; + aabb1 = hullBounds1; + + //gotta inflate // PT: perfect LHS recipe here.... + const PxVec3 inflate(contactDistance); + aabb0.minimum -= inflate; + aabb1.minimum -= inflate; + aabb0.maximum += inflate; + aabb1.maximum += inflate; +} + +static bool PxcBruteForceOverlapBackface( const PxBounds3& hullBounds0, const PxBounds3& hullBounds1, + const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + const PxMat34& m0to1, const PxMat34& m1to0, const PxVec3& delta, + PxU32& id0, PxU32& id1, + PxReal& depth, PxVec3& sep, PxcSepAxisType& code, PxReal contactDistance, float toleranceLength) +{ + const PxVec3 localDelta0 = world0.rotateTranspose(delta); + PxU32* PX_RESTRICT indices0 = reinterpret_cast(PxAlloca(polyData0.mNbPolygons*sizeof(PxU32))); + + PxU32 numIndices0; + PxReal dmin0 = PX_MAX_REAL; + PxVec3 vec0; + if(!PxcTestFacesSepAxesBackface(polyData0, polyData1, world0, world1, scaling0, scaling1, m1to0, localDelta0, dmin0, vec0, id0, indices0, numIndices0, contactDistance, toleranceLength +#ifdef TEST_INTERNAL_OBJECTS + , -delta +#endif + )) + return false; + + const PxVec3 localDelta1 = world1.rotateTranspose(delta); + + PxU32* PX_RESTRICT indices1 = reinterpret_cast(PxAlloca(polyData1.mNbPolygons*sizeof(PxU32))); + + PxU32 numIndices1; + PxReal dmin1 = PX_MAX_REAL; + PxVec3 vec1; + if(!PxcTestFacesSepAxesBackface(polyData1, polyData0, world1, world0, scaling1, scaling0, m0to1, -localDelta1, dmin1, vec1, id1, indices1, numIndices1, contactDistance, toleranceLength +#ifdef TEST_INTERNAL_OBJECTS + , delta +#endif + )) + return false; + + PxReal dmin = dmin0; + PxVec3 vec = vec0; + code = SA_NORMAL0; + + if(dmin1 < dmin) + { + dmin = dmin1; + vec = vec1; + code = SA_NORMAL1; + } + + PX_ASSERT(id0!=PX_INVALID_U32); + PX_ASSERT(id1!=PX_INVALID_U32); + + // Brute-force find a separating axis + SeparatingAxes mSA0; + SeparatingAxes mSA1; + mSA0.reset(); + mSA1.reset(); + PxPlane witnessPlane0; + PxPlane witnessPlane1; + PxBounds3 aabb0, aabb1; + + prepareData(witnessPlane0, witnessPlane1, + aabb0, aabb1, + hullBounds0, hullBounds1, + polyData0.mPolygons[id0].mPlane, + polyData1.mPolygons[id1].mPlane, + scaling0, scaling1, + m0to1, m1to0, + contactDistance); + + // Find possibly separating axes + PxcFindSeparatingAxes(mSA0, indices0, numIndices0, polyData0, world0, witnessPlane1, m0to1, aabb1, contactDistance, scaling0); + PxcFindSeparatingAxes(mSA1, indices1, numIndices1, polyData1, world1, witnessPlane0, m1to0, aabb0, contactDistance, scaling1); +// PxcFindSeparatingAxes(context.mSA0, &id0, 1, hull0, world0, witnessPlane1, m0to1, aabbMin1, aabbMax1); +// PxcFindSeparatingAxes(context.mSA1, &id1, 1, hull1, world1, witnessPlane0, m1to0, aabbMin0, aabbMax0); + + const PxU32 numEdges0 = mSA0.getNumAxes(); + const PxVec3* PX_RESTRICT edges0 = mSA0.getAxes(); + + const PxU32 numEdges1 = mSA1.getNumAxes(); + const PxVec3* PX_RESTRICT edges1 = mSA1.getAxes(); + + // Worst case = convex test 02 with big meshes: 23 & 23 edges => 23*23 = 529 tests! + // printf("%d - %d\n", NbEdges0, NbEdges1); // maximum = ~20 in test scenes. + + for(PxU32 i=0; i < numEdges0; i++) + { + const PxVec3& edge0 = edges0[i]; + for(PxU32 j=0; j < numEdges1; j++) + { + const PxVec3& edge1 = edges1[j]; + + PxVec3 sepAxis = edge0.cross(edge1); + if(!isAlmostZero(sepAxis)) + { + sepAxis = sepAxis.getNormalized(); + +#ifdef TEST_INTERNAL_OBJECTS + if(!testInternalObjects(-delta, sepAxis, polyData0, polyData1, world0, world1, dmin)) + { + #if PX_DEBUG + PxReal d; + if(testSeparatingAxis(polyData0, polyData1, world0, world1, scaling0, scaling1, sepAxis, d, contactDistance)) + { + PX_ASSERT(d + testInternalObjectsEpsilon*toleranceLength >= dmin); + } + #endif + continue; + } +#endif + PxReal d; + if(!testSeparatingAxis(polyData0, polyData1, world0, world1, scaling0, scaling1, sepAxis, d, contactDistance)) + return false; + + if(d= dmin); + } + #endif + continue; + } +#endif + + PxReal d; + const float invMagnitude = 1.0f / magnitude; + if(!testNormal(shapeSpaceNormal, P.getMin(vertices) * invMagnitude, P.getMax() * invMagnitude, /*hull1,*/ polyData1, m1to0, scaling1, d, contactDistance)) //note how we scale scalars by skew magnitude change as we do plane d-s. + return false; + + if(d < dmin) + { +#ifdef TEST_INTERNAL_OBJECTS + sep = worldNormal; +#else + sep = world0.rotate(shapeSpaceNormal); +#endif + dmin = d; + id = i; + } + } + + PX_ASSERT(id!=PX_INVALID_U32); //Should never happen with this version + + return true; +} + +static bool GuBruteForceOverlapBackfaceRoughPass( const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + const PxMat34& m0to1, const PxMat34& m1to0, const PxVec3& delta, + PxU32& id0, PxU32& id1, + PxReal& depth, PxVec3& sep, PxcSepAxisType& code, PxReal contactDistance, PxReal toleranceLength) +{ + PxReal dmin0 = PX_MAX_REAL; + PxReal dmin1 = PX_MAX_REAL; + PxVec3 vec0, vec1; + + const PxVec3 localDelta0 = world0.rotateTranspose(delta); + const PxVec3 localCenter1in0 = m1to0.transform(polyData1.mCenter); + if(!GuTestFacesSepAxesBackfaceRoughPass(polyData0, polyData1, world0, world1, scaling0, scaling1, m1to0, localCenter1in0, localDelta0, dmin0, vec0, id0, contactDistance, toleranceLength +#ifdef TEST_INTERNAL_OBJECTS + , -delta +#endif + )) + return false; + + const PxVec3 localDelta1 = world1.rotateTranspose(delta); + const PxVec3 localCenter0in1 = m0to1.transform(polyData0.mCenter); + if(!GuTestFacesSepAxesBackfaceRoughPass(polyData1, polyData0, world1, world0, scaling1, scaling0, m0to1, localCenter0in1, -localDelta1, dmin1, vec1, id1, contactDistance, toleranceLength +#ifdef TEST_INTERNAL_OBJECTS + , delta +#endif + )) + return false; + + PxReal dmin = dmin0; + PxVec3 vec = vec0; + code = SA_NORMAL0; + + if(dmin1 < dmin) + { + dmin = dmin1; + vec = vec1; + code = SA_NORMAL1; + } + + PX_ASSERT(id0!=PX_INVALID_U32); + PX_ASSERT(id1!=PX_INVALID_U32); + + depth = dmin; + sep = vec; + + return true; +} + +static bool GuContactHullHull( const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxBounds3& hullBounds0, const PxBounds3& hullBounds1, + const PxTransform& transform0, const PxTransform& transform1, + const NarrowPhaseParams& params, PxContactBuffer& contactBuffer, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + bool idtScale0, bool idtScale1); + +// Box-convex contact generation +// this can no longer share code with convex-convex because that case needs scaling for both shapes, while this only needs it for one, which may be significant perf wise. +// +// PT: duplicating the full convex-vs-convex codepath is a lot worse. Look at it this way: if scaling is really "significant perf wise" then we made the whole convex-convex +// codepath significantly slower, and this is a lot more important than just box-vs-convex. The proper approach is to share the code and make sure scaling is NOT a perf hit. +// PT: please leave this function in the same translation unit as PxcContactHullHull. + +bool Gu::contactBoxConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxBoxGeometry& shapeBox = checkedCast(shape0); + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + + FastVertex2ShapeScaling idtScaling; + + const PxBounds3 boxBounds(-shapeBox.halfExtents, shapeBox.halfExtents); + + PolygonalData polyData0; + PolygonalBox polyBox(shapeBox.halfExtents); + polyBox.getPolygonalData(&polyData0); + + /////// + + FastVertex2ShapeScaling convexScaling; + PxBounds3 convexBounds; + PolygonalData polyData1; + const bool idtScale = getConvexData(shapeConvex, convexScaling, convexBounds, polyData1); + + return GuContactHullHull( polyData0, polyData1, boxBounds, convexBounds, + transform0, transform1, params, contactBuffer, + idtScaling, convexScaling, true, idtScale); +} + +// PT: please leave this function in the same translation unit as PxcContactHullHull. +bool Gu::contactConvexConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxConvexMeshGeometry& shapeConvex0 = checkedCast(shape0); + const PxConvexMeshGeometry& shapeConvex1 = checkedCast(shape1); + + FastVertex2ShapeScaling scaling0, scaling1; + PxBounds3 convexBounds0, convexBounds1; + PolygonalData polyData0, polyData1; + const bool idtScale0 = getConvexData(shapeConvex0, scaling0, convexBounds0, polyData0); + const bool idtScale1 = getConvexData(shapeConvex1, scaling1, convexBounds1, polyData1); + + return GuContactHullHull( polyData0, polyData1, convexBounds0, convexBounds1, + transform0, transform1, params, contactBuffer, + scaling0, scaling1, idtScale0, idtScale1); +} + +static bool GuContactHullHull( const PolygonalData& polyData0, const PolygonalData& polyData1, + const PxBounds3& hullBounds0, const PxBounds3& hullBounds1, + const PxTransform& transform0, const PxTransform& transform1, + const NarrowPhaseParams& params, PxContactBuffer& contactBuffer, + const FastVertex2ShapeScaling& scaling0, const FastVertex2ShapeScaling& scaling1, + bool idtScale0, bool idtScale1) +{ + // Compute matrices + const Matrix34FromTransform world0(transform0); + const Matrix34FromTransform world1(transform1); + + const PxVec3 worldCenter0 = world0.transform(polyData0.mCenter); + const PxVec3 worldCenter1 = world1.transform(polyData1.mCenter); + + const PxVec3 deltaC = worldCenter1 - worldCenter0; + + PxReal depth; + + /////////////////////////////////////////////////////////////////////////// + + // Early-exit test: quickly discard obviously non-colliding cases. + // PT: we used to skip this when objects were touching, which provided a small speedup (saving 2 full hull projections). + // We may want to add this back at some point in the future, if possible. + if(true) //AM: now we definitely want to test the cached axis to get the depth value for the cached axis, even if we had a contact before. + { + if(!testSeparatingAxis(polyData0, polyData1, world0, world1, scaling0, scaling1, deltaC, depth, params.mContactDistance)) + //there was no contact previously and we reject using the same prev. axis. + return false; + } + + /////////////////////////////////////////////////////////////////////////// + + // Compute relative transforms + PxTransform t0to1 = transform1.transformInv(transform0); + PxTransform t1to0 = transform0.transformInv(transform1); + + PxU32 c0(0x7FFF); + PxU32 c1(0x7FFF); + PxVec3 worldNormal; + + const Matrix34FromTransform m0to1(t0to1); + const Matrix34FromTransform m1to0(t1to0); + +#ifdef CONVEX_CONVEX_ROUGH_FIRST_PASS + // PT: it is a bad idea to skip the rough pass, for two reasons: + // 1) performance. The rough pass is obviously a lot faster. + // 2) stability. The "skipIt" optimization relies on the rough pass being present to catch the cases where it fails. If you disable the rough pass + // "skipIt" can skip the whole work, contacts get lost, and we never "try again" ==> explosions +// bool TryRoughPass = (contactDistance == 0.0f); //Rough first pass doesn't work with dist based for some reason. + for(int TryRoughPass = 1 /*gEnableOptims*/; 0 <= TryRoughPass; --TryRoughPass) + { +#endif + + { + PxcSepAxisType code; + PxU32 id0, id1; + //PxReal depth; +#ifdef CONVEX_CONVEX_ROUGH_FIRST_PASS + bool Status; + if(TryRoughPass) + { + Status = GuBruteForceOverlapBackfaceRoughPass(polyData0, polyData1, world0, world1, scaling0, scaling1, m0to1, m1to0, deltaC, id0, id1, depth, worldNormal, code, params.mContactDistance, params.mToleranceLength); + } + else + { + Status = PxcBruteForceOverlapBackface( +// hull0, hull1, + hullBounds0, hullBounds1, + polyData0, polyData1, world0, world1, scaling0, scaling1, m0to1, m1to0, deltaC, id0, id1, depth, worldNormal, code, params.mContactDistance, params.mToleranceLength); + } + + if(!Status) +#else + if(!PxcBruteForceOverlapBackface( +// hull0, hull1, + hullBounds0, hullBounds1, + polyData0, polyData1, + world0, world1, scaling0, scaling1, m0to1, m1to0, deltaC, id0, id1, depth, worldNormal, code, contactDistance)) +#endif + return false; + + if(deltaC.dot(worldNormal) < 0.0f) + worldNormal = -worldNormal; + +/* +worldNormal = -partialSep; +depth = -partialDepth; +code = SA_EE; +*/ + + if(code==SA_NORMAL0) + { + c0 = id0; + c1 = (polyData1.mSelectClosestEdgeCB)(polyData1, scaling1, world1.rotateTranspose(-worldNormal)); + } + else if(code==SA_NORMAL1) + { + c0 = (polyData0.mSelectClosestEdgeCB)(polyData0, scaling0, world0.rotateTranspose(worldNormal)); + c1 = id1; + } + else if(code==SA_EE) + { + c0 = (polyData0.mSelectClosestEdgeCB)(polyData0, scaling0, world0.rotateTranspose(worldNormal)); + c1 = (polyData1.mSelectClosestEdgeCB)(polyData1, scaling1, world1.rotateTranspose(-worldNormal)); + } + } + + const HullPolygonData& HP0 = polyData0.mPolygons[c0]; + const HullPolygonData& HP1 = polyData1.mPolygons[c1]; + // PT: prefetching those guys saves ~600.000 cycles in convex-convex benchmark + PxPrefetchLine(&HP0.mPlane); + PxPrefetchLine(&HP1.mPlane); + + //ok, we have a new depth value. convert to real distance. +// PxReal separation = -depth; //depth was either computed in initial cached-axis check, or better, when skipIt was false, in sep axis search. +// if (separation < 0.0f) +// separation = 0.0f; //we don't want to store penetration values. + const PxReal separation = fsel(depth, 0.0f, -depth); + + PxVec3 worldNormal0; + PX_ALIGN(16, PxPlane) shapeSpacePlane0; + if(idtScale0) + { + V4StoreA(V4LoadU(&HP0.mPlane.n.x), &shapeSpacePlane0.n.x); + worldNormal0 = world0.rotate(HP0.mPlane.n); + } + else + { + scaling0.transformPlaneToShapeSpace(HP0.mPlane.n,HP0.mPlane.d,shapeSpacePlane0.n,shapeSpacePlane0.d); + worldNormal0 = world0.rotate(shapeSpacePlane0.n); + } + + PxVec3 worldNormal1; + PX_ALIGN(16, PxPlane) shapeSpacePlane1; + if(idtScale1) + { + V4StoreA(V4LoadU(&HP1.mPlane.n.x), &shapeSpacePlane1.n.x); + worldNormal1 = world1.rotate(HP1.mPlane.n); + } + else + { + scaling1.transformPlaneToShapeSpace(HP1.mPlane.n,HP1.mPlane.d,shapeSpacePlane1.n,shapeSpacePlane1.d); + worldNormal1 = world1.rotate(shapeSpacePlane1.n); + } + + PxIntBool flag; + { + const PxReal d0 = PxAbs(worldNormal0.dot(worldNormal)); + const PxReal d1 = PxAbs(worldNormal1.dot(worldNormal)); + bool f = d0>d1; //which face normal is the separating axis closest to. + flag = f; + } + +////////////////////NEW DIST HANDLING////////////////////// + PX_ASSERT(separation >= 0.0f); //be sure this got fetched somewhere in the chaos above. + + const PxReal cCCDEpsilon = params.mMeshContactMargin; + const PxReal contactGenPositionShift = separation + cCCDEpsilon; //if we're at a distance, shift so we're in penetration. + + const PxVec3 contactGenPositionShiftVec = worldNormal * -contactGenPositionShift; //shift one of the bodies this distance toward the other just for Pierre's contact generation. Then the bodies should be penetrating exactly by MIN_SEPARATION_FOR_PENALTY - ideal conditions for this contact generator. + + //note: for some reason this has to change sign! + + //this will make contact gen always generate contacts at about MSP. Shift them back to the true real distance, and then to a solver compliant distance given that + //the solver converges to MSP penetration, while we want it to converge to 0 penetration. + //to real distance: + + //The system: We always shift convex 0 (arbitrary). If the contact is attached to convex 0 then we will need to shift the contact point, otherwise not. + const PxVec3 newp = world0.p - contactGenPositionShiftVec; + const PxMat34 world0_Tweaked(world0.m.column0, world0.m.column1, world0.m.column2, newp); + PxTransform shifted0(newp, transform0.q); + + t0to1 = transform1.transformInv(shifted0); + t1to0 = shifted0.transformInv(transform1); + const Matrix34FromTransform m0to1_Tweaked(t0to1); + const Matrix34FromTransform m1to0_Tweaked(t1to0); + +////////////////////////////////////////////////// + //pretransform convex polygon if we have scaling! + PxVec3* scaledVertices0; + PxU8* stackIndices0; + GET_SCALEX_CONVEX(scaledVertices0, stackIndices0, idtScale0, HP0.mNbVerts, scaling0, polyData0.mVerts, polyData0.getPolygonVertexRefs(HP0)) + + //pretransform convex polygon if we have scaling! + PxVec3* scaledVertices1; + PxU8* stackIndices1; + GET_SCALEX_CONVEX(scaledVertices1, stackIndices1, idtScale1, HP1.mNbVerts, scaling1, polyData1.mVerts, polyData1.getPolygonVertexRefs(HP1)) + + // So we need to switch: + // - HP0, HP1 + // - scaledVertices0, scaledVertices1 + // - stackIndices0, stackIndices1 + // - world0, world1 + // - shapeSpacePlane0, shapeSpacePlane1 + // - worldNormal0, worldNormal1 + // - m0to1, m1to0 + // - true, false + const PxMat33 RotT0 = findRotationMatrixFromZ(shapeSpacePlane0.n); + const PxMat33 RotT1 = findRotationMatrixFromZ(shapeSpacePlane1.n); + + if(flag) + { + if(contactPolygonPolygonExt(HP0.mNbVerts, scaledVertices0, stackIndices0, world0_Tweaked, shapeSpacePlane0, RotT0, + HP1.mNbVerts, scaledVertices1, stackIndices1, world1, shapeSpacePlane1, RotT1, + worldNormal0, m0to1_Tweaked, m1to0_Tweaked, + PXC_CONTACT_NO_FACE_INDEX, PXC_CONTACT_NO_FACE_INDEX, + contactBuffer, + true, contactGenPositionShiftVec, contactGenPositionShift)) + return true; + } + else + { + if(contactPolygonPolygonExt(HP1.mNbVerts, scaledVertices1, stackIndices1, world1, shapeSpacePlane1, RotT1, + HP0.mNbVerts, scaledVertices0, stackIndices0, world0_Tweaked, shapeSpacePlane0, RotT0, + worldNormal1, m1to0_Tweaked, m0to1_Tweaked, + PXC_CONTACT_NO_FACE_INDEX, PXC_CONTACT_NO_FACE_INDEX, + contactBuffer, + false, contactGenPositionShiftVec, contactGenPositionShift)) + return true; + } + +#ifdef CONVEX_CONVEX_ROUGH_FIRST_PASS + } +#endif + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp new file mode 100644 index 0000000..68fde71 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactConvexMesh.cpp @@ -0,0 +1,1465 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" + +#include "GuConvexUtilsInternal.h" +#include "GuInternal.h" +#include "GuContactPolygonPolygon.h" +#include "GuConvexEdgeFlags.h" +#include "GuSeparatingAxes.h" +#include "GuContactMethodImpl.h" +#include "GuMidphaseInterface.h" +#include "GuConvexHelper.h" +#include "GuTriangleCache.h" +#include "GuHeightFieldUtil.h" +#include "GuEntityReport.h" +#include "GuIntersectionTriangleBox.h" +#include "GuBox.h" + +#include "CmUtils.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxFPU.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace aos; +using namespace intrinsics; + +//sizeof(SavedContactData)/sizeof(PxU32) = 17, 1088/17 = 64 triangles in the local array +#define LOCAL_CONTACTS_SIZE 1088 + +#define LOCAL_TOUCHED_TRIG_SIZE 192 + +//#define USE_TRIANGLE_NORMAL +#define TEST_INTERNAL_OBJECTS + +static PX_FORCE_INLINE void projectTriangle(const PxVec3& localSpaceDirection, const PxVec3* PX_RESTRICT triangle, PxReal& min1, PxReal& max1) +{ + const PxReal dp0 = triangle[0].dot(localSpaceDirection); + const PxReal dp1 = triangle[1].dot(localSpaceDirection); + min1 = selectMin(dp0, dp1); + max1 = selectMax(dp0, dp1); + + const PxReal dp2 = triangle[2].dot(localSpaceDirection); + min1 = selectMin(min1, dp2); + max1 = selectMax(max1, dp2); +} + +#ifdef TEST_INTERNAL_OBJECTS + +static PX_FORCE_INLINE void boxSupport(const float extents[3], const PxVec3& sv, float p[3]) +{ + const PxU32* iextents = reinterpret_cast(extents); + const PxU32* isv = reinterpret_cast(&sv); + PxU32* ip = reinterpret_cast(p); + + ip[0] = iextents[0]|(isv[0]&PX_SIGN_BITMASK); + ip[1] = iextents[1]|(isv[1]&PX_SIGN_BITMASK); + ip[2] = iextents[2]|(isv[2]&PX_SIGN_BITMASK); +} + +#if PX_DEBUG +static const PxReal testInternalObjectsEpsilon = 1.0e-3f; +#endif + +static PX_FORCE_INLINE bool testInternalObjects(const PxVec3& localAxis0, + const PolygonalData& polyData0, + const PxVec3* PX_RESTRICT triangleInHullSpace, + float dmin) +{ + PxReal min1, max1; + projectTriangle(localAxis0, triangleInHullSpace, min1, max1); + + const float dp = polyData0.mCenter.dot(localAxis0); + + float p0[3]; + boxSupport(polyData0.mInternal.mExtents, localAxis0, p0); + const float Radius0 = p0[0]*localAxis0.x + p0[1]*localAxis0.y + p0[2]*localAxis0.z; + const float bestRadius = selectMax(Radius0, polyData0.mInternal.mRadius); + const PxReal min0 = dp - bestRadius; + const PxReal max0 = dp + bestRadius; + + const PxReal d0 = max0 - min1; + const PxReal d1 = max1 - min0; + + const float depth = selectMin(d0, d1); + if(depth>dmin) + return false; + return true; +} +#endif + +static PX_FORCE_INLINE bool testNormal( const PxVec3& sepAxis, PxReal min0, PxReal max0, + const PxVec3* PX_RESTRICT triangle, + PxReal& depth, PxReal contactDistance) +{ + PxReal min1, max1; + projectTriangle(sepAxis, triangle, min1, max1); + + if(max0+contactDistance 0.0f) +#else + // ### this is dubious since the triangle center is likely to be very close to the hull, if not inside. Why not use the triangle normal? + if(PL.distance(witness) < 0.0f) +#endif + continue; //backface culled + + *hullIndices++ = i; + + const PxVec3 sepAxis = m0to1.rotate(PL.n); + const PxReal dp = sepAxis.dot(trans); + + PxReal d; + if(!testNormal(sepAxis, P.getMin(vertices) + dp, P.getMax() + dp, triangle, + d, contactDistance)) + return false; + + if(d < dmin) + { + dmin = d; + sep = sepAxis; + id = i; + } + } + } + else + { +#ifndef USE_TRIANGLE_NORMAL + //transform delta from hull0 shape into vertex space: + const PxVec3 vertSpaceWitness = convexScaling % witness; +#endif + for(PxU32 i=0; i 0.0f) +#else + // ### this is dubious since the triangle center is likely to be very close to the hull, if not inside. Why not use the triangle normal? + if(PL.distance(vertSpaceWitness) < 0.0f) +#endif + continue; //backface culled + + //normals transform by inverse transpose: (and transpose(skew) == skew as its symmetric) + PxVec3 shapeSpaceNormal = convexScaling % PL.n; + //renormalize: (Arr!) + const PxReal magnitude = shapeSpaceNormal.normalize(); + + *hullIndices++ = i; + const PxVec3 sepAxis = m0to1.rotate(shapeSpaceNormal); + PxReal d; + const PxReal dp = sepAxis.dot(trans); + + const float oneOverM = 1.0f / magnitude; + if(!testNormal(sepAxis, P.getMin(vertices) * oneOverM + dp, P.getMax() * oneOverM + dp, triangle, + d, contactDistance)) + return false; + + if(d < dmin) + { + dmin = d; + sep = sepAxis; + id = i; + } + } + } + numHullIndices = PxU32(hullIndices - hullIndices_); + } + + // Backup + if(id == PX_INVALID_U32) + { + if(idtConvexScale) + { + for(PxU32 i=0; i=numVerts) j1 = 0; + + const PxU32 VRef0 = data[j]; + const PxU32 VRef1 = data[j1]; + + if(edgeCulling(vertexSpacePlane, hullVerts[VRef0], hullVerts[VRef1], contactDistance)) + { + const PxVec3 currentHullEdge = m0to1.rotate(convexScaling * (hullVerts[VRef0] - hullVerts[VRef1])); //matrix mult is distributive! + + PxVec3 sepAxis = currentHullEdge.cross(currentPolyEdge); + if(!isAlmostZero(sepAxis)) + SA.addAxis(sepAxis.getNormalized()); + } + } + } + } + + dmin = PX_MAX_REAL; + PxU32 numAxes = SA.getNumAxes(); + const PxVec3* PX_RESTRICT axes = SA.getAxes(); + +#ifdef TEST_INTERNAL_OBJECTS + PxVec3 triangleInHullSpace[3]; + if(numAxes) + { + triangleInHullSpace[0] = m1to0.transform(triangle[0]); + triangleInHullSpace[1] = m1to0.transform(triangle[1]); + triangleInHullSpace[2] = m1to0.transform(triangle[2]); + } +#endif + + while(numAxes--) + { + const PxVec3& currentAxis = *axes++; + +#ifdef TEST_INTERNAL_OBJECTS + const PxVec3 localAxis0 = m1to0.rotate(currentAxis); + if(!testInternalObjects(localAxis0, polyData0, triangleInHullSpace, dmin)) + { + #if PX_DEBUG + PxReal dtest; + if(testSepAxis(currentAxis, polyData0, triangle, m0to1, convexScaling, dtest, contactDistance)) + { + PX_ASSERT(dtest + testInternalObjectsEpsilon*toleranceLength >= dmin); + } + #endif + continue; + } +#endif + + PxReal d; + if(!testSepAxis(currentAxis, polyData0, triangle, + m0to1, convexScaling, d, contactDistance)) + { + return false; + } + + if(d < dmin) + { + dmin = d; + vec = currentAxis; + } + } + return true; +} + +static bool triangleConvexTest( const PolygonalData& polyData0, + const PxU8 triFlags, + PxU32 index, const PxVec3* PX_RESTRICT localPoints, + const PxPlane& localPlane, + const PxVec3& groupCenterHull, + const PxMat34& world0, const PxMat34& world1, const PxMat34& m0to1, const PxMat34& m1to0, + const FastVertex2ShapeScaling& convexScaling, + PxReal contactDistance, PxReal toleranceLength, + PxVec3& groupAxis, PxReal& groupMinDepth, bool& faceContact, + bool idtConvexScale + ) +{ + PxU32 id0 = PX_INVALID_U32; + PxReal dmin0 = PX_MAX_REAL; + PxVec3 vec0; + + PxU32 numHullIndices = 0; + PxU32* PX_RESTRICT const hullIndices = reinterpret_cast(PxAlloca(polyData0.mNbPolygons*sizeof(PxU32))); + + // PT: we test the hull normals first because they don't need any hull projection. If we can early exit thanks + // to those, we completely avoid all hull projections. + bool status = testFacesSepAxesBackface(polyData0, world0, world1, m0to1, groupCenterHull, localPoints, + convexScaling, numHullIndices, hullIndices, dmin0, vec0, id0, contactDistance, idtConvexScale); + if(!status) + return false; + + groupAxis = PxVec3(0); + groupMinDepth = PX_MAX_REAL; + + const PxReal eps = 0.0001f; // DE7748 + + //Test in mesh-space + PxVec3 sepAxis; + PxReal depth; + + { + // Test triangle normal + PxReal d; + if(!testSepAxis(localPlane.n, polyData0, localPoints, + m0to1, convexScaling, d, contactDistance)) + return false; + + if(d& mDelayedContacts; + CacheMap mEdgeCache; + CacheMap mVertCache; + + const Matrix34FromTransform m0to1; + const Matrix34FromTransform m1to0; + + PxVec3 mHullCenterMesh; + PxVec3 mHullCenterWorld; + + const PolygonalData& mPolyData0; + const PxMat34& mWorld0; + const PxMat34& mWorld1; + + const FastVertex2ShapeScaling& mConvexScaling; + + PxReal mContactDistance; + PxReal mToleranceLength; + bool mIdtMeshScale, mIdtConvexScale; + PxReal mCCDEpsilon; + const PxTransform& mTransform0; + const PxTransform& mTransform1; + PxContactBuffer& mContactBuffer; + bool mAnyHits; + + ConvexMeshContactGeneration( + PxInlineArray& delayedContacts, + const PxTransform& t0to1, const PxTransform& t1to0, + const PolygonalData& polyData0, const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& convexScaling, + PxReal contactDistance, + PxReal toleranceLength, + bool idtConvexScale, + PxReal cCCDEpsilon, + const PxTransform& transform0, const PxTransform& transform1, + PxContactBuffer& contactBuffer + ); + + void processTriangle(const PxVec3* verts, PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds); + void generateLastContacts(); + + bool generateContacts( + const PxPlane& localPlane, + const PxVec3* PX_RESTRICT localPoints, + const PxVec3& triCenter, PxVec3& groupAxis, + PxReal groupMinDepth, PxU32 index) const; + + private: + ConvexMeshContactGeneration& operator=(const ConvexMeshContactGeneration&); + }; + +// 17 entries. 1088/17 = 64 triangles in the local array +struct SavedContactData +{ + PxU32 mTriangleIndex; // 1 + PxVec3 mVerts[3]; // 10 + PxU32 mInds[3]; // 13 + PxVec3 mGroupAxis; // 16 + PxReal mGroupMinDepth; // 17 +}; +} + +ConvexMeshContactGeneration::ConvexMeshContactGeneration( + PxInlineArray& delayedContacts, + const PxTransform& t0to1, const PxTransform& t1to0, + const PolygonalData& polyData0, const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& convexScaling, + PxReal contactDistance, + PxReal toleranceLength, + bool idtConvexScale, + PxReal cCCDEpsilon, + const PxTransform& transform0, const PxTransform& transform1, + PxContactBuffer& contactBuffer +) : + mDelayedContacts(delayedContacts), + m0to1 (t0to1), + m1to0 (t1to0), + mPolyData0 (polyData0), + mWorld0 (world0), + mWorld1 (world1), + mConvexScaling (convexScaling), + mContactDistance(contactDistance), + mToleranceLength(toleranceLength), + mIdtConvexScale (idtConvexScale), + mCCDEpsilon (cCCDEpsilon), + mTransform0 (transform0), + mTransform1 (transform1), + mContactBuffer (contactBuffer) +{ + delayedContacts.forceSize_Unsafe(0); + mAnyHits = false; + + // Hull center in local space + const PxVec3& hullCenterLocal = mPolyData0.mCenter; + // Hull center in mesh space + mHullCenterMesh = m0to1.transform(hullCenterLocal); + // Hull center in world space + mHullCenterWorld = mWorld0.transform(hullCenterLocal); +} + +struct ConvexMeshContactGenerationCallback : MeshHitCallback +{ + ConvexMeshContactGeneration mGeneration; + const FastVertex2ShapeScaling& mMeshScaling; + const PxU8* PX_RESTRICT mExtraTrigData; + bool mIdtMeshScale; + const TriangleMesh* mMeshData; + const BoxPadded& mBox; + + ConvexMeshContactGenerationCallback( + PxInlineArray& delayedContacts, + const PxTransform& t0to1, const PxTransform& t1to0, + const PolygonalData& polyData0, const PxMat34& world0, const PxMat34& world1, + const TriangleMesh* meshData, + const PxU8* PX_RESTRICT extraTrigData, + const FastVertex2ShapeScaling& meshScaling, + const FastVertex2ShapeScaling& convexScaling, + PxReal contactDistance, + PxReal toleranceLength, + bool idtMeshScale, bool idtConvexScale, + PxReal cCCDEpsilon, + const PxTransform& transform0, const PxTransform& transform1, + PxContactBuffer& contactBuffer, + const BoxPadded& box + ) : + MeshHitCallback (CallbackMode::eMULTIPLE), + mGeneration (delayedContacts, t0to1, t1to0, polyData0, world0, world1, convexScaling, contactDistance, toleranceLength, idtConvexScale, cCCDEpsilon, transform0, transform1, contactBuffer), + mMeshScaling (meshScaling), + mExtraTrigData (extraTrigData), + mIdtMeshScale (idtMeshScale), + mMeshData (meshData), + mBox (box) + { + } + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* vinds) + { + // PT: this one is safe because incoming vertices from midphase are always safe to V4Load (by design) + // PT: TODO: is this test really needed? Not done in midphase already? + if(!intersectTriangleBox(mBox, v0, v1, v2)) + return true; + + PxVec3 verts[3]; + getScaledVertices(verts, v0, v1, v2, mIdtMeshScale, mMeshScaling); + + const PxU32 triangleIndex = hit.faceIndex; + + PxU8 extraData = getConvexEdgeFlags(mExtraTrigData, triangleIndex); + + const PxU32* vertexIndices = vinds; + PxU32 localStorage[3]; + if(mMeshScaling.flipsNormal()) + { + flipConvexEdgeFlags(extraData); + localStorage[0] = vinds[0]; + localStorage[1] = vinds[2]; + localStorage[2] = vinds[1]; + vertexIndices = localStorage; + } + + mGeneration.processTriangle(verts, triangleIndex, extraData, vertexIndices); + return true; + } + +protected: + ConvexMeshContactGenerationCallback &operator=(const ConvexMeshContactGenerationCallback &); +}; + +bool ConvexMeshContactGeneration::generateContacts( + const PxPlane& localPlane, + const PxVec3* PX_RESTRICT localPoints, + const PxVec3& triCenter, PxVec3& groupAxis, + PxReal groupMinDepth, PxU32 index) const +{ + const PxVec3 worldGroupCenter = mWorld1.transform(triCenter); + const PxVec3 deltaC = mHullCenterWorld - worldGroupCenter; + if(deltaC.dot(groupAxis) < 0.0f) + groupAxis = -groupAxis; + + const PxU32 id = (mPolyData0.mSelectClosestEdgeCB)(mPolyData0, mConvexScaling, mWorld0.rotateTranspose(-groupAxis)); + + const HullPolygonData& HP = mPolyData0.mPolygons[id]; + PX_ALIGN(16, PxPlane) shapeSpacePlane0; + if(mIdtConvexScale) + V4StoreA(V4LoadU(&HP.mPlane.n.x), &shapeSpacePlane0.n.x); + else + mConvexScaling.transformPlaneToShapeSpace(HP.mPlane.n, HP.mPlane.d, shapeSpacePlane0.n, shapeSpacePlane0.d); + + const PxVec3 hullNormalWorld = mWorld0.rotate(shapeSpacePlane0.n); + + const PxReal d0 = PxAbs(hullNormalWorld.dot(groupAxis)); + + const PxVec3 triNormalWorld = mWorld1.rotate(localPlane.n); + const PxReal d1 = PxAbs(triNormalWorld.dot(groupAxis)); + const bool d0biggerd1 = d0 > d1; + +////////////////////NEW DIST HANDLING////////////////////// + //TODO: skip this if there is no dist involved! + +PxReal separation = - groupMinDepth; //convert to real distance. + +separation = fsel(separation, separation, 0.0f); //don't do anything when penetrating! + +//printf("\nseparation = %f", separation); + +PxReal contactGenPositionShift = separation + mCCDEpsilon; //if we're at a distance, shift so we're within penetration. + +PxVec3 contactGenPositionShiftVec = groupAxis * contactGenPositionShift; //shift one of the bodies this distance toward the other just for Pierre's contact generation. Then the bodies should be penetrating exactly by MIN_SEPARATION_FOR_PENALTY - ideal conditions for this contact generator. + +//note: for some reason this has to change sign! + +//this will make contact gen always generate contacts at about MSP. Shift them back to the true real distance, and then to a solver compliant distance given that +//the solver converges to MSP penetration, while we want it to converge to 0 penetration. +//to real distance: +// PxReal polyPolySeparationShift = separation; //(+ or - depending on which way normal goes) + +//The system: We always shift convex 0 (arbitrary). If the contact is attached to convex 0 then we will need to shift the contact point, otherwise not. + +//TODO: make these overwrite orig location if its safe to do so. + +PxMat34 world0_(mWorld0); +PxTransform transform0_(mTransform0); + +world0_.p -= contactGenPositionShiftVec; +transform0_.p = world0_.p; //reset this too. + +const PxTransform t0to1_ = mTransform1.transformInv(transform0_); +const PxTransform t1to0_ = transform0_.transformInv(mTransform1); +const Matrix34FromTransform m0to1_(t0to1_); +const Matrix34FromTransform m1to0_(t1to0_); + + PxVec3* scaledVertices0; + PxU8* stackIndices0; + GET_SCALEX_CONVEX(scaledVertices0, stackIndices0, mIdtConvexScale, HP.mNbVerts, mConvexScaling, mPolyData0.mVerts, mPolyData0.getPolygonVertexRefs(HP)) + + const PxU8 indices[3] = {0, 1, 2}; + + const PxMat33 RotT0 = findRotationMatrixFromZ(shapeSpacePlane0.n); + const PxMat33 RotT1 = findRotationMatrixFromZ(localPlane.n); + + if(d0biggerd1) + { + if(contactPolygonPolygonExt( + HP.mNbVerts, scaledVertices0, stackIndices0, world0_, shapeSpacePlane0, + RotT0, + 3, localPoints, indices, mWorld1, localPlane, + RotT1, + hullNormalWorld, m0to1_, m1to0_, PXC_CONTACT_NO_FACE_INDEX, index, + mContactBuffer, + true, + contactGenPositionShiftVec, contactGenPositionShift)) + { + return true; + } + } + else + { + if(contactPolygonPolygonExt( + 3, localPoints, indices, mWorld1, localPlane, + RotT1, + HP.mNbVerts, scaledVertices0, stackIndices0, world0_, shapeSpacePlane0, + RotT0, + triNormalWorld, m1to0_, m0to1_, PXC_CONTACT_NO_FACE_INDEX, index, + mContactBuffer, + false, + contactGenPositionShiftVec, contactGenPositionShift)) + { + return true; + } + } + return false; +} + +enum FeatureCode +{ + FC_VERTEX0, + FC_VERTEX1, + FC_VERTEX2, + FC_EDGE01, + FC_EDGE12, + FC_EDGE20, + FC_FACE, + + FC_UNDEFINED +}; + +static FeatureCode computeFeatureCode(const PxVec3& point, const PxVec3* verts) +{ + const PxVec3& triangleOrigin = verts[0]; + const PxVec3 triangleEdge0 = verts[1] - verts[0]; + const PxVec3 triangleEdge1 = verts[2] - verts[0]; + + const PxVec3 kDiff = triangleOrigin - point; + const PxReal fA00 = triangleEdge0.magnitudeSquared(); + const PxReal fA01 = triangleEdge0.dot(triangleEdge1); + const PxReal fA11 = triangleEdge1.magnitudeSquared(); + const PxReal fB0 = kDiff.dot(triangleEdge0); + const PxReal fB1 = kDiff.dot(triangleEdge1); + const PxReal fDet = PxAbs(fA00*fA11 - fA01*fA01); + const PxReal u = fA01*fB1-fA11*fB0; + const PxReal v = fA01*fB0-fA00*fB1; + + FeatureCode fc = FC_UNDEFINED; + + if(u + v <= fDet) + { + if(u < 0.0f) + { + if(v < 0.0f) // region 4 + { + if(fB0 < 0.0f) + { + if(-fB0 >= fA00) + fc = FC_VERTEX1; + else + fc = FC_EDGE01; + } + else + { + if(fB1 >= 0.0f) + fc = FC_VERTEX0; + else if(-fB1 >= fA11) + fc = FC_VERTEX2; + else + fc = FC_EDGE20; + } + } + else // region 3 + { + if(fB1 >= 0.0f) + fc = FC_VERTEX0; + else if(-fB1 >= fA11) + fc = FC_VERTEX2; + else + fc = FC_EDGE20; + } + } + else if(v < 0.0f) // region 5 + { + if(fB0 >= 0.0f) + fc = FC_VERTEX0; + else if(-fB0 >= fA00) + fc = FC_VERTEX1; + else + fc = FC_EDGE01; + } + else // region 0 + { + // minimum at interior PxVec3 + if(fDet==0.0f) + fc = FC_VERTEX0; + else + fc = FC_FACE; + } + } + else + { + PxReal fTmp0, fTmp1, fNumer, fDenom; + + if(u < 0.0f) // region 2 + { + fTmp0 = fA01 + fB0; + fTmp1 = fA11 + fB1; + if(fTmp1 > fTmp0) + { + fNumer = fTmp1 - fTmp0; + fDenom = fA00-2.0f*fA01+fA11; + if(fNumer >= fDenom) + fc = FC_VERTEX1; + else + fc = FC_EDGE12; + } + else + { + if(fTmp1 <= 0.0f) + fc = FC_VERTEX2; + else if(fB1 >= 0.0f) + fc = FC_VERTEX0; + else + fc = FC_EDGE20; + } + } + else if(v < 0.0f) // region 6 + { + fTmp0 = fA01 + fB1; + fTmp1 = fA00 + fB0; + if(fTmp1 > fTmp0) + { + fNumer = fTmp1 - fTmp0; + fDenom = fA00-2.0f*fA01+fA11; + if(fNumer >= fDenom) + fc = FC_VERTEX2; + else + fc = FC_EDGE12; + } + else + { + if(fTmp1 <= 0.0f) + fc = FC_VERTEX1; + else if(fB0 >= 0.0f) + fc = FC_VERTEX0; + else + fc = FC_EDGE01; + } + } + else // region 1 + { + fNumer = fA11 + fB1 - fA01 - fB0; + if(fNumer <= 0.0f) + { + fc = FC_VERTEX2; + } + else + { + fDenom = fA00-2.0f*fA01+fA11; + if(fNumer >= fDenom) + fc = FC_VERTEX1; + else + fc = FC_EDGE12; + } + } + } + return fc; +} + + +//static bool validateVertex(PxU32 vref, const PxU32 count, const ContactPoint* PX_RESTRICT contacts, const TriangleMesh& meshData) +//{ +// PxU32 previous = 0xffffffff; +// for(PxU32 i=0;itvref1) +// PxSwap(tvref0, tvref1); +// +// if(tvref0==vref0 && tvref1==vref1) +// return false; +// return true; +//} + +//static bool validateEdge(PxU32 vref0, PxU32 vref1, const PxU32 count, const ContactPoint* PX_RESTRICT contacts, const TriangleMesh& meshData) +//{ +// if(vref0>vref1) +// PxSwap(vref0, vref1); +// +// PxU32 previous = 0xffffffff; +// for(PxU32 i=0;ivref1) +// PxSwap(vref0, vref1); +// +// for(PxU32 i=0;i(mDelayedContacts.end()); + mDelayedContacts.forceSize_Unsafe(newSize); + + cd->mTriangleIndex = triangleIndex; + cd->mVerts[0] = verts[0]; + cd->mVerts[1] = verts[1]; + cd->mVerts[2] = verts[2]; + cd->mInds[0] = vertInds[0]; + cd->mInds[1] = vertInds[1]; + cd->mInds[2] = vertInds[2]; + cd->mGroupAxis = groupAxis; + cd->mGroupMinDepth = groupMinDepth; + } +} + +void ConvexMeshContactGeneration::generateLastContacts() +{ + // Process delayed contacts + PxU32 nbEntries = mDelayedContacts.size(); + if(nbEntries) + { + nbEntries /= sizeof(SavedContactData)/sizeof(PxU32); + + // PT: TODO: replicate this fix in sphere-vs-mesh ###FIX + //const PxU32 count = mContactBuffer.count; + //const ContactPoint* PX_RESTRICT contacts = mContactBuffer.contacts; + + const SavedContactData* PX_RESTRICT cd = reinterpret_cast(mDelayedContacts.begin()); + for(PxU32 i=0;i delayedContacts; + + ConvexMeshContactGenerationCallback blockCallback( + delayedContacts, + t0to1, t1to0, polyData0, world0, world1, meshData, meshData->getExtraTrigData(), meshScaling, + convexScaling, params.mContactDistance, params.mToleranceLength, + idtMeshScale, idtConvexScale, params.mMeshContactMargin, + transform0, transform1, + contactBuffer, hullOBB + ); + + Midphase::intersectOBB(meshData, hullOBB, blockCallback, false); + + blockCallback.mGeneration.generateLastContacts(); + + return blockCallback.mGeneration.mAnyHits; +} + +///////////// + +bool Gu::contactConvexMesh(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + const bool idtScaleMesh = shapeMesh.scale.isIdentity(); + + FastVertex2ShapeScaling meshScaling; + if(!idtScaleMesh) + meshScaling.init(shapeMesh.scale); + + FastVertex2ShapeScaling convexScaling; + PxBounds3 hullAABB; + PolygonalData polyData0; + const bool idtScaleConvex = getConvexData(shapeConvex, convexScaling, hullAABB, polyData0); + + return contactHullMesh2(polyData0, hullAABB, shapeMesh, transform0, transform1, params, contactBuffer, convexScaling, meshScaling, idtScaleConvex, idtScaleMesh); +} + +bool Gu::contactBoxMesh(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxBoxGeometry& shapeBox = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + PolygonalData polyData0; + PolygonalBox polyBox(shapeBox.halfExtents); + polyBox.getPolygonalData(&polyData0); + + const PxBounds3 hullAABB(-shapeBox.halfExtents, shapeBox.halfExtents); + + const bool idtScaleMesh = shapeMesh.scale.isIdentity(); + + FastVertex2ShapeScaling meshScaling; + if(!idtScaleMesh) + meshScaling.init(shapeMesh.scale); + + FastVertex2ShapeScaling idtScaling; + return contactHullMesh2(polyData0, hullAABB, shapeMesh, transform0, transform1, params, contactBuffer, idtScaling, meshScaling, true, idtScaleMesh); +} + +///////////// + +namespace +{ +struct ConvexVsHeightfieldContactGenerationCallback : OverlapReport +{ + ConvexMeshContactGeneration mGeneration; + HeightFieldUtil& mHfUtil; + + ConvexVsHeightfieldContactGenerationCallback( + HeightFieldUtil& hfUtil, + PxInlineArray& delayedContacts, + const PxTransform& t0to1, const PxTransform& t1to0, + const PolygonalData& polyData0, const PxMat34& world0, const PxMat34& world1, + const FastVertex2ShapeScaling& convexScaling, + PxReal contactDistance, + PxReal toleranceLength, + bool idtConvexScale, + PxReal cCCDEpsilon, + const PxTransform& transform0, const PxTransform& transform1, + PxContactBuffer& contactBuffer + ) : mGeneration(delayedContacts, t0to1, t1to0, polyData0, world0, world1, convexScaling, contactDistance, toleranceLength, idtConvexScale, cCCDEpsilon, transform0, + transform1, contactBuffer), + mHfUtil(hfUtil) + { + } + + // PT: TODO: refactor/unify with similar code in other places + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + const PxU8 nextInd[] = {2,0,1}; + + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxU32 vertIndices[3]; + PxTriangle currentTriangle; // in world space + PxU32 adjInds[3]; + mHfUtil.getTriangle(mGeneration.mTransform1, currentTriangle, vertIndices, adjInds, triangleIndex, false, false); + + PxVec3 normal; + currentTriangle.normal(normal); + + PxU8 triFlags = 0; //KS - temporary until we can calculate triFlags for HF + + for(PxU32 a = 0; a < 3; ++a) + { + if(adjInds[a] != 0xFFFFFFFF) + { + PxTriangle adjTri; + mHfUtil.getTriangle(mGeneration.mTransform1, adjTri, NULL, NULL, adjInds[a], false, false); + //We now compare the triangles to see if this edge is active + + PxVec3 adjNormal; + adjTri.denormalizedNormal(adjNormal); + PxU32 otherIndex = nextInd[a]; + PxF32 projD = adjNormal.dot(currentTriangle.verts[otherIndex] - adjTri.verts[0]); + if(projD < 0.f) + { + adjNormal.normalize(); + + PxF32 proj = adjNormal.dot(normal); + + if(proj < 0.999f) + { + triFlags |= 1 << (a+3); + } + } + } + else + triFlags |= (1 << (a+3)); + } + mGeneration.processTriangle(currentTriangle.verts, triangleIndex, triFlags, vertIndices); + } + return true; + } + +protected: + ConvexVsHeightfieldContactGenerationCallback &operator=(const ConvexVsHeightfieldContactGenerationCallback &); +}; +} + +static bool contactHullHeightfield2(const PolygonalData& polyData0, const PxBounds3& hullAABB, const PxHeightFieldGeometry& shape1, + const PxTransform& transform0, const PxTransform& transform1, + const NarrowPhaseParams& params, PxContactBuffer& contactBuffer, + const FastVertex2ShapeScaling& convexScaling, + bool idtConvexScale) +{ + //We need to create a callback that fills triangles from the HF + + HeightFieldUtil hfUtil(shape1); + + const Matrix34FromTransform world0(transform0); + const Matrix34FromTransform world1(transform1); + + //////////////////// + + // Compute relative transforms + const PxTransform t0to1 = transform1.transformInv(transform0); + const PxTransform t1to0 = transform0.transformInv(transform1); + + PxInlineArray delayedContacts; + + ConvexVsHeightfieldContactGenerationCallback blockCallback(hfUtil, delayedContacts, t0to1, t1to0, polyData0, world0, world1, convexScaling, params.mContactDistance, params.mToleranceLength, + idtConvexScale, params.mMeshContactMargin, transform0, transform1, contactBuffer); + + hfUtil.overlapAABBTriangles0to1(t0to1, hullAABB, blockCallback); + + blockCallback.mGeneration.generateLastContacts(); + + return blockCallback.mGeneration.mAnyHits; +} + +bool Gu::contactConvexHeightfield(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + //Create a triangle cache from the HF triangles and then feed triangles to NP mesh methods + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape0); + const PxHeightFieldGeometry& shapeMesh = checkedCast(shape1); + + FastVertex2ShapeScaling convexScaling; + PxBounds3 hullAABB; + PolygonalData polyData0; + const bool idtScaleConvex = getConvexData(shapeConvex, convexScaling, hullAABB, polyData0); + const PxVec3 inflation(params.mContactDistance); + hullAABB.minimum -= inflation; + hullAABB.maximum += inflation; + + return contactHullHeightfield2(polyData0, hullAABB, shapeMesh, transform0, transform1, params, contactBuffer, convexScaling, idtScaleConvex); +} + +bool Gu::contactBoxHeightfield(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + //Create a triangle cache from the HF triangles and then feed triangles to NP mesh methods + const PxHeightFieldGeometry& shapeMesh = checkedCast(shape1); + const PxBoxGeometry& shapeBox = checkedCast(shape0); + + PolygonalData polyData0; + PolygonalBox polyBox(shapeBox.halfExtents); + polyBox.getPolygonalData(&polyData0); + + const PxVec3 inflatedExtents = shapeBox.halfExtents + PxVec3(params.mContactDistance); + + const PxBounds3 hullAABB = PxBounds3(-inflatedExtents, inflatedExtents); + + const FastVertex2ShapeScaling idtScaling; + + return contactHullHeightfield2(polyData0, hullAABB, shapeMesh, transform0, transform1, params, contactBuffer, idtScaling, true); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp new file mode 100644 index 0000000..bbb4fc9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactCustomGeometry.cpp @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +bool Gu::contactCustomGeometryGeometry(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxCustomGeometry& customGeom = checkedCast(shape0); + const PxGeometry& otherGeom = shape1; + + customGeom.callbacks->generateContacts(customGeom, otherGeom, transform0, transform1, + params.mContactDistance, params.mMeshContactMargin, params.mToleranceLength, + contactBuffer); + return true; +} + +bool Gu::contactGeometryCustomGeometry(GU_CONTACT_METHOD_ARGS) +{ + bool res = contactCustomGeometryGeometry(shape1, shape0, transform1, transform0, params, cache, contactBuffer, renderOutput); + + for (PxU32 i = 0; i < contactBuffer.count; ++i) + contactBuffer.contacts[i].normal = -contactBuffer.contacts[i].normal; + + return res; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactMethodImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactMethodImpl.h new file mode 100644 index 0000000..521da5e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactMethodImpl.h @@ -0,0 +1,201 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONTACTMETHODIMPL_H +#define GU_CONTACTMETHODIMPL_H + +#include "foundation/PxAssert.h" +#include "common/PxPhysXCommonConfig.h" +#include "collision/PxCollisionDefs.h" +#include "GuGeometryChecks.h" + +namespace physx +{ + class PxGeometry; + class PxRenderOutput; + class PxContactBuffer; + +namespace Gu +{ + class PersistentContactManifold; + class MultiplePersistentContactManifold; + + struct NarrowPhaseParams + { + PX_FORCE_INLINE NarrowPhaseParams(PxReal contactDistance, PxReal meshContactMargin, PxReal toleranceLength) : + mContactDistance(contactDistance), + mMeshContactMargin(meshContactMargin), + mToleranceLength(toleranceLength) {} + + PxReal mContactDistance; + PxReal mMeshContactMargin; // PT: Margin used to generate mesh contacts. Temp & unclear, should be removed once GJK is default path. + PxReal mToleranceLength; // PT: copy of PxTolerancesScale::length + }; + + enum ManifoldFlags + { + IS_MANIFOLD = (1<<0), + IS_MULTI_MANIFOLD = (1<<1) + }; + + struct Cache : public PxCache + { + Cache() + { + } + + PX_FORCE_INLINE void setManifold(void* manifold) + { + PX_ASSERT((size_t(manifold) & 0xF) == 0); + mCachedData = reinterpret_cast(manifold); + mManifoldFlags |= IS_MANIFOLD; + } + + PX_FORCE_INLINE void setMultiManifold(void* manifold) + { + PX_ASSERT((size_t(manifold) & 0xF) == 0); + mCachedData = reinterpret_cast(manifold); + mManifoldFlags |= IS_MANIFOLD|IS_MULTI_MANIFOLD; + } + + PX_FORCE_INLINE PxU8 isManifold() const + { + return PxU8(mManifoldFlags & IS_MANIFOLD); + } + + PX_FORCE_INLINE PxU8 isMultiManifold() const + { + return PxU8(mManifoldFlags & IS_MULTI_MANIFOLD); + } + + PX_FORCE_INLINE PersistentContactManifold& getManifold() + { + PX_ASSERT(isManifold()); + PX_ASSERT(!isMultiManifold()); + PX_ASSERT((uintptr_t(mCachedData) & 0xf) == 0); + return *reinterpret_cast(mCachedData); + } + + PX_FORCE_INLINE MultiplePersistentContactManifold& getMultipleManifold() + { + PX_ASSERT(isManifold()); + PX_ASSERT(isMultiManifold()); + PX_ASSERT((uintptr_t(mCachedData) & 0xf) == 0); + return *reinterpret_cast(mCachedData); + } + }; +} + +template PX_CUDA_CALLABLE PX_FORCE_INLINE const Geom& checkedCast(const PxGeometry& geom) +{ + checkType(geom); + return static_cast(geom); +} + +#define GU_CONTACT_METHOD_ARGS \ + const PxGeometry& shape0, \ + const PxGeometry& shape1, \ + const PxTransform& transform0, \ + const PxTransform& transform1, \ + const Gu::NarrowPhaseParams& params, \ + Gu::Cache& cache, \ + PxContactBuffer& contactBuffer, \ + PxRenderOutput* renderOutput + +#define GU_CONTACT_METHOD_ARGS_UNUSED \ + const PxGeometry&, \ + const PxGeometry&, \ + const PxTransform&, \ + const PxTransform&, \ + const Gu::NarrowPhaseParams&, \ + Gu::Cache&, \ + PxContactBuffer&, \ + PxRenderOutput* + +namespace Gu +{ + PX_PHYSX_COMMON_API bool contactSphereSphere(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactSphereCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactSphereBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactCapsuleCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactCapsuleBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactCapsuleConvex(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactBoxBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactBoxConvex(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactConvexConvex(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool contactSphereMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactCapsuleMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactBoxMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactConvexMesh(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool contactSphereHeightfield(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactCapsuleHeightfield(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactBoxHeightfield(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactConvexHeightfield(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool contactSpherePlane(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactPlaneBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactPlaneCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactPlaneConvex(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool contactCustomGeometryGeometry(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool contactGeometryCustomGeometry(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactSphereMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactCapsuleMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactBoxMesh(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactConvexMesh(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactSphereHeightField(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactCapsuleHeightField(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactBoxHeightField(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactConvexHeightField(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactPlaneCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactPlaneBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactPlaneConvex(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactSphereSphere(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactSpherePlane(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactSphereCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactSphereBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactSphereConvex(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactCapsuleCapsule(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactCapsuleBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactCapsuleConvex(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactBoxBox(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactBoxConvex(GU_CONTACT_METHOD_ARGS); + PX_PHYSX_COMMON_API bool pcmContactConvexConvex(GU_CONTACT_METHOD_ARGS); + + PX_PHYSX_COMMON_API bool pcmContactGeometryCustomGeometry(GU_CONTACT_METHOD_ARGS); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp new file mode 100644 index 0000000..b07f75a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneBox.cpp @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxUnionCast.h" +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" +#include "CmMatrix34.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Cm; + +bool Gu::contactPlaneBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + PX_UNUSED(shape0); + + // Get actual shape data + //const PxPlaneGeometry& shapePlane = checkedCast(shape0); + const PxBoxGeometry& shapeBox = checkedCast(shape1); + + const PxVec3 negPlaneNormal = -transform0.q.getBasisVector0(); + + //Make sure we have a normalized plane + //PX_ASSERT(PxAbs(shape0.mNormal.magnitudeSquared() - 1.0f) < 0.000001f); + + const Matrix34FromTransform boxMatrix(transform1); + const Matrix34FromTransform boxToPlane(transform0.transformInv(transform1)); + + PxVec3 point; + + PX_ASSERT(contactBuffer.count==0); + +/* for(int vx=-1; vx<=1; vx+=2) + for(int vy=-1; vy<=1; vy+=2) + for(int vz=-1; vz<=1; vz+=2) + { + //point = boxToPlane.transform(PxVec3(shapeBox.halfExtents.x*vx, shapeBox.halfExtents.y*vy, shapeBox.halfExtents.z*vz)); + //PxReal planeEq = point.x; + //Optimized a bit + point.set(shapeBox.halfExtents.x*vx, shapeBox.halfExtents.y*vy, shapeBox.halfExtents.z*vz); + const PxReal planeEq = boxToPlane.m.column0.x*point.x + boxToPlane.m.column1.x*point.y + boxToPlane.m.column2.x*point.z + boxToPlane.p.x; + + if(planeEq <= contactDistance) + { + contactBuffer.contact(boxMatrix.transform(point), negPlaneNormal, planeEq); + + //no point in making more than 4 contacts. + if (contactBuffer.count >= 6) //was: 4) actually, with strong interpenetration more than just the bottom surface goes through, + //and we want to find the *deepest* 4 vertices, really. + return true; + } + }*/ + + // PT: the above code is shock full of LHS/FCMPs. And there's no point in limiting the number of contacts to 6 when the max possible is 8. + + const PxReal limit = params.mContactDistance - boxToPlane.p.x; + const PxReal dx = shapeBox.halfExtents.x; + const PxReal dy = shapeBox.halfExtents.y; + const PxReal dz = shapeBox.halfExtents.z; + const PxReal bxdx = boxToPlane.m.column0.x * dx; + const PxReal bxdy = boxToPlane.m.column1.x * dy; + const PxReal bxdz = boxToPlane.m.column2.x * dz; + + PxReal depths[8]; + depths[0] = bxdx + bxdy + bxdz - limit; + depths[1] = bxdx + bxdy - bxdz - limit; + depths[2] = bxdx - bxdy + bxdz - limit; + depths[3] = bxdx - bxdy - bxdz - limit; + depths[4] = - bxdx + bxdy + bxdz - limit; + depths[5] = - bxdx + bxdy - bxdz - limit; + depths[6] = - bxdx - bxdy + bxdz - limit; + depths[7] = - bxdx - bxdy - bxdz - limit; + + //const PxU32* binary = reinterpret_cast(depths); + const PxU32* binary = PxUnionCast(depths); + + if(binary[0] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(dx, dy, dz)), negPlaneNormal, depths[0] + params.mContactDistance); + if(binary[1] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(dx, dy, -dz)), negPlaneNormal, depths[1] + params.mContactDistance); + if(binary[2] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(dx, -dy, dz)), negPlaneNormal, depths[2] + params.mContactDistance); + if(binary[3] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(dx, -dy, -dz)), negPlaneNormal, depths[3] + params.mContactDistance); + if(binary[4] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(-dx, dy, dz)), negPlaneNormal, depths[4] + params.mContactDistance); + if(binary[5] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(-dx, dy, -dz)), negPlaneNormal, depths[5] + params.mContactDistance); + if(binary[6] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(-dx, -dy, dz)), negPlaneNormal, depths[6] + params.mContactDistance); + if(binary[7] & PX_SIGN_BITMASK) + contactBuffer.contact(boxMatrix.transform(PxVec3(-dx, -dy, -dz)), negPlaneNormal, depths[7] + params.mContactDistance); + + return contactBuffer.count > 0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp new file mode 100644 index 0000000..4190698 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneCapsule.cpp @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" +#include "GuInternal.h" +#include "GuSegment.h" + +using namespace physx; + +bool Gu::contactPlaneCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + PX_UNUSED(shape0); + + // Get actual shape data + //const PxPlaneGeometry& shapePlane = checkedCast(shape0); + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape1); + + const PxTransform capsuleToPlane = transform0.transformInv(transform1); + + //Capsule in plane space + Segment segment; + getCapsuleSegment(capsuleToPlane, shapeCapsule, segment); + + const PxVec3 negPlaneNormal = transform0.q.getBasisVector0(); + + bool contact = false; + + const PxReal separation0 = segment.p0.x - shapeCapsule.radius; + const PxReal separation1 = segment.p1.x - shapeCapsule.radius; + if(separation0 <= params.mContactDistance) + { + const PxVec3 temp(segment.p0.x - shapeCapsule.radius, segment.p0.y, segment.p0.z); + const PxVec3 point = transform0.transform(temp); + contactBuffer.contact(point, -negPlaneNormal, separation0); + contact = true; + } + + if(separation1 <= params.mContactDistance) + { + const PxVec3 temp(segment.p1.x - shapeCapsule.radius, segment.p1.y, segment.p1.z); + const PxVec3 point = transform0.transform(temp); + contactBuffer.contact(point, -negPlaneNormal, separation1); + contact = true; + } + return contact; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp new file mode 100644 index 0000000..6db7790 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPlaneConvex.cpp @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuConvexMeshData.h" +#include "GuContactMethodImpl.h" +#include "GuConvexMesh.h" +#include "CmScaling.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Cm; + +bool Gu::contactPlaneConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + PX_UNUSED(shape0); + + // Get actual shape data + //const PxPlaneGeometry& shapePlane = checkedCast(shape0); + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + const PxVec3* PX_RESTRICT hullVertices = hullData->getHullVertices(); + PxU32 numHullVertices = hullData->mNbHullVertices; +// PxPrefetch128(hullVertices); + + // Plane is implicitly <1,0,0> 0 in localspace + const Matrix34FromTransform convexToPlane0 (transform0.transformInv(transform1)); + const PxMat33 convexToPlane_rot(convexToPlane0[0], convexToPlane0[1], convexToPlane0[2] ); + + bool idtScale = shapeConvex.scale.isIdentity(); + FastVertex2ShapeScaling convexScaling; // PT: TODO: remove default ctor + if(!idtScale) + convexScaling.init(shapeConvex.scale); + + const PxMat34 convexToPlane(convexToPlane_rot * convexScaling.getVertex2ShapeSkew(), convexToPlane0[3]); + + //convexToPlane = context.mVertex2ShapeSkew[1].getVertex2WorldSkew(convexToPlane); + + const Matrix34FromTransform planeToW(transform0); + + // This is rather brute-force + + bool status = false; + + const PxVec3 contactNormal = -planeToW.m.column0; + + while(numHullVertices--) + { + const PxVec3& vertex = *hullVertices++; +// if(numHullVertices) +// PxPrefetch128(hullVertices); + + const PxVec3 pointInPlane = convexToPlane.transform(vertex); //TODO: this multiply could be factored out! + if(pointInPlane.x <= params.mContactDistance) + { +// const PxVec3 pointInW = planeToW.transform(pointInPlane); +// contactBuffer.contact(pointInW, -planeToW.m.column0, pointInPlane.x); + status = true; + PxContactPoint* PX_RESTRICT pt = contactBuffer.contact(); + if(pt) + { + pt->normal = contactNormal; + pt->point = planeToW.transform(pointInPlane); + pt->separation = pointInPlane.x; + pt->internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + } + } + } + return status; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp new file mode 100644 index 0000000..6490a15 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.cpp @@ -0,0 +1,861 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "geomutils/PxContactBuffer.h" + +#include "GuContactPolygonPolygon.h" +#include "GuShapeConvex.h" +#include "GuInternal.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Gu; + +#define CONTACT_REDUCTION + +/* +void gVisualizeLocalLine(const PxVec3& a, const PxVec3& b, const PxMat34& m, PxsContactManager& manager) //temp debug +{ + RenderOutput out = manager.getContext()->getRenderOutput(); + out << 0xffffff << m << RenderOutput::LINES << a << b; +} +*/ + +#ifdef CONTACT_REDUCTION +static PX_FORCE_INLINE PxReal dot2D(const PxVec3& v0, const PxVec3& v1) +{ + return v0.x * v1.x + v0.y * v1.y; +} + +static void ContactReductionAllIn( PxContactBuffer& contactBuffer, PxU32 nbExistingContacts, PxU32 numIn, + const PxMat33& rotT, + const PxVec3* PX_RESTRICT vertices, const PxU8* PX_RESTRICT indices) +{ + // Number of contacts created by current call + const PxU32 nbNewContacts = contactBuffer.count - nbExistingContacts; + + if(nbNewContacts<=4) + return; // no reduction for less than 4 verts + + // We have 3 different numbers here: + // - numVerts = number of vertices in the convex polygon we're dealing with + // - numIn = number of those that were "inside" the other convex polygon (should be <= numVerts) + // - contactBuffer.count = total number of contacts *from both polygons* (that's the catch here) + // The fast path can only be chosen when the contact buffer contains all the verts from current polygon, + // i.e. when contactBuffer.count == numIn == numVerts + + PxContactPoint* PX_RESTRICT ctcs = contactBuffer.contacts + nbExistingContacts; + + if(numIn == nbNewContacts) + { + // Codepath 1: all vertices generated a contact + + PxReal deepestSeparation = ctcs[0].separation; + PxU32 deepestIndex = 0; + for(PxU32 i=1; i ctcs[i].separation) + { + deepestSeparation = ctcs[i].separation; + deepestIndex = i; + } + } + + PxU32 index = 0; + const PxU32 step = (numIn<<16)>>2; // Fixed point math, don't use floats here please + bool needsExtraPoint = true; + for(PxU32 i=0;i<4;i++) + { + const PxU32 contactIndex = index>>16; + ctcs[i] = ctcs[contactIndex]; + if(contactIndex==deepestIndex) + needsExtraPoint = false; + index += step; + } + + if(needsExtraPoint) + { + ctcs[4] = ctcs[deepestIndex]; + contactBuffer.count = nbExistingContacts + 5; + } + else + { + contactBuffer.count = nbExistingContacts + 4; + } + +/* PT: TODO: investigate why this one does not work + PxU32 index = deepestIndex<<16; + const PxU32 step = (numIn<<16)>>2; // Fixed point math, don't use floats here please + for(PxU32 i=0;i<4;i++) + { + PxU32 contactIndex = index>>16; + if(contactIndex>=numIn) + contactIndex -= numIn; + ctcs[i] = ctcs[contactIndex]; + index += step; + } + contactBuffer.count = nbExistingContacts + 4;*/ + } + else + { + // Codepath 2: all vertices are "in" but only some of them generated a contact + + // WARNING: this path doesn't work when the buffer contains vertices from both polys. + + // TODO: precompute those axes + const PxU32 nbAxes = 8; + PxVec3 dirs[nbAxes]; + float angle = 0.0f; + const float angleStep = PxDegToRad(180.0f/float(nbAxes)); + for(PxU32 i=0;imaxVariance) + { + maxVariance = variance; + bestAxis = i; + } + } + + const PxVec3 u = dirs[bestAxis]; + const PxVec3 v = PxVec3(-u.y, u.x, 0.0f); + // PxVec3(1.0f, 0.0f, 0.0f) => PxVec3(0.0f, 1.0f, 0.0f) + // PxVec3(0.0f, 1.0f, 0.0f) => PxVec3(-1.0f, 0.0f, 0.0f) + // PxVec3(-1.0f, 1.0f, 0.0f) => PxVec3(-1.0f, -1.0f, 0.0f) + // PxVec3(1.0f, 1.0f, 0.0f) => PxVec3(-1.0f, 1.0f, 0.0f) + + float dpminu = PX_MAX_F32; + float dpmaxu = -PX_MAX_F32; + float dpminv = PX_MAX_F32; + float dpmaxv = -PX_MAX_F32; + PxU32 indexMinU = 0; + PxU32 indexMaxU = 0; + PxU32 indexMinV = 0; + PxU32 indexMaxV = 0; + + for(PxU32 i=0;idpmaxu) + { + dpmaxu=dpu; + indexMaxU = i; + } + + if(dpvdpmaxv) + { + dpmaxv=dpv; + indexMaxV = i; + } + } + + if(indexMaxU == indexMinU) + indexMaxU = 0xffffffff; + if(indexMinV == indexMinU || indexMinV == indexMaxU) + indexMinV = 0xffffffff; + if(indexMaxV == indexMinU || indexMaxV == indexMaxU || indexMaxV == indexMinV) + indexMaxV = 0xffffffff; + + PxU32 newCount = 0; + for(PxU32 i=0;i0.0f && y>0.0f && z<0.0f) return TRUE; + // else return FALSE; +// return (( IR(z) & ~(IR(x)|IR(y)) ) & SIGN_BITMASK) != 0; + if(x>0.0f && y>0.0f && z<0.0f) return true; + else return false; +} + + + enum OutCode + { + OUT_XP = (1<<0), + OUT_XN = (1<<1), + OUT_YP = (1<<2), + OUT_YN = (1<<3) + }; + +static +//PX_FORCE_INLINE +bool PointInConvexPolygon2D_OutCodes(const float* PX_RESTRICT pgon2D, PxU32 numVerts, const PxReal tx, const PxReal ty, const PxReal maxX, const PxReal maxY, PxU8& outCodes) +{ + PxU32 out = 0; + if(tx<0.0f) out |= OUT_XN; + if(ty<0.0f) out |= OUT_YN; + if(tx>maxX) out |= OUT_XP; + if(ty>maxY) out |= OUT_YP; + outCodes = PxU8(out); + if(out) + return false; + + if(numVerts==3) + return pointInTriangle2D( tx, ty, + pgon2D[0], pgon2D[1], + pgon2D[2] - pgon2D[0], + pgon2D[3] - pgon2D[1], + pgon2D[4] - pgon2D[0], + pgon2D[5] - pgon2D[1]); + +#define X 0 +#define Y 1 + + const PxReal* PX_RESTRICT vtx0_ = pgon2D + (numVerts-1)*2; + const PxReal* PX_RESTRICT vtx1_ = pgon2D; + + const int* PX_RESTRICT ivtx0 = reinterpret_cast(vtx0_); + const int* PX_RESTRICT ivtx1 = reinterpret_cast(vtx1_); + //const int itx = (int&)tx; + //const int ity = (int&)ty; +// const int ity = PX_SIR(ty); + const int* tmp = reinterpret_cast(&ty); + const int ity = *tmp; + + // get test bit for above/below X axis + int yflag0 = ivtx0[Y] >= ity; + + int InsideFlag = 0; + + while(numVerts--) + { + const int yflag1 = ivtx1[Y] >= ity; + if(yflag0 != yflag1) + { + const PxReal* PX_RESTRICT vtx0 = reinterpret_cast(ivtx0); + const PxReal* PX_RESTRICT vtx1 = reinterpret_cast(ivtx1); + if( ((vtx1[Y]-ty) * (vtx0[X]-vtx1[X]) > (vtx1[X]-tx) * (vtx0[Y]-vtx1[Y])) == yflag1 ) + { + if(InsideFlag == 1) return false; + + InsideFlag++; + } + } + yflag0 = yflag1; + ivtx0 = ivtx1; + ivtx1 += 2; + } +#undef X +#undef Y + + return InsideFlag & 1; +} + +// Helper function to detect contact between two edges +PX_FORCE_INLINE bool EdgeEdgeContactSpecial(const PxVec3& v1, const PxPlane& plane, + const PxVec3& p1, const PxVec3& p2, const PxVec3& dir, const PxVec3& p3, const PxVec3& p4, + PxReal& dist, PxVec3& ip, unsigned int i, unsigned int j, float coeff) +{ + const PxReal d3 = plane.distance(p3); + PxReal temp = d3 * plane.distance(p4); + if(temp > 0.0f) + return false; + + // if colliding edge (p3,p4) and plane are parallel return no collision + const PxVec3 v2 = (p4-p3); + temp = plane.n.dot(v2); + if(temp == 0.0f) // ### epsilon would be better + return false; + + // compute intersection point of plane and colliding edge (p3,p4) + ip = p3-v2*(d3/temp); + + // compute distance of intersection from line (ip, -dir) to line (p1,p2) + dist = (v1[i]*(ip[j]-p1[j])-v1[j]*(ip[i]-p1[i])) * coeff; + if(dist < 0.0f) + return false; + + // compute intersection point on edge (p1,p2) line + ip -= dist*dir; + + // check if intersection point (ip) is between edge (p1,p2) vertices + temp = (p1.x-ip.x)*(p2.x-ip.x)+(p1.y-ip.y)*(p2.y-ip.y)+(p1.z-ip.z)*(p2.z-ip.z); + if(temp<0.0f) + return true; // collision found + + return false; //no collision +} + +//This one can also handle 2 vertex 'polygons' (useful for capsule surface segments) and can shift the results before contact generation. +bool Gu::contactPolygonPolygonExt( PxU32 numVerts0, const PxVec3* vertices0, const PxU8* indices0, //polygon 0 + const PxMat34& world0, const PxPlane& localPlane0, //xform of polygon 0, plane of polygon + const PxMat33& rotT0, + // + PxU32 numVerts1, const PxVec3* PX_RESTRICT vertices1, const PxU8* PX_RESTRICT indices1, //polygon 1 + const PxMat34& world1, const PxPlane& localPlane1, //xform of polygon 1, plane of polygon + const PxMat33& rotT1, + // + const PxVec3& worldSepAxis, //world normal of separating plane - this is the world space normal of polygon0!! + const PxMat34& transform0to1, const PxMat34& transform1to0, //transforms between polygons + PxU32 /*polyIndex0*/, PxU32 polyIndex1, //feature indices for contact callback + PxContactBuffer& contactBuffer, + bool flipNormal, const PxVec3& posShift, PxReal sepShift) // shape order, result shift +{ + const PxVec3 n = flipNormal ? -worldSepAxis : worldSepAxis; + + PX_ASSERT(indices0 != NULL && indices1 != NULL); + + // - optimize "from to" computation + // - do the raycast case && EE tests in same space as 2D case... + // - project all edges at the same time ? + PxU32 NumIn = 0; + bool status = false; + + void* PX_RESTRICT stackMemory; + { + const PxU32 maxNumVert = PxMax(numVerts0, numVerts1); + stackMemory = PxAlloca(maxNumVert * sizeof(PxVec3)); + } + + const PxU32 size0 = numVerts0 * sizeof(bool); + bool* PX_RESTRICT flags0 = reinterpret_cast(PxAlloca(size0)); + PxU8* PX_RESTRICT outCodes0 = reinterpret_cast(PxAlloca(size0)); +// PxMemZero(flags0, size0); +// PxMemZero(outCodes0, size0); + + const PxU32 size1 = numVerts1 * sizeof(bool); + bool* PX_RESTRICT flags1 = reinterpret_cast(PxAlloca(size1)); + PxU8* PX_RESTRICT outCodes1 = reinterpret_cast(PxAlloca(size1)); +// PxMemZero(flags1, size1); +// PxMemZero(outCodes1, size1); + +#ifdef CONTACT_REDUCTION + // We want to do contact reduction on newly created contacts, not on all the already existing ones... + PxU32 nbExistingContacts = contactBuffer.count; + PxU32 nbCurrentContacts=0; + PxU8 indices[PxContactBuffer::MAX_CONTACTS]; +#endif + + { + //polygon 1 + float* PX_RESTRICT verts2D = NULL; + float minX=0, minY=0; + float maxX=0, maxY=0; + + const PxVec3 localDir = -world1.rotateTranspose(worldSepAxis); //contactNormal in hull1 space + //that's redundant, its equal to -localPlane1.d + const PxMat34 t0to2D = transformTranspose(rotT1, transform0to1); //transform from hull0 to RotT + + PxReal dn = localDir.dot(localPlane1.n); //if the contactNormal == +-(normal of poly0) is NOT orthogonal to poly1 ...this is just to protect the division below. + + // PT: TODO: if "numVerts1>2" we may skip more + if (numVerts1 > 2 //no need to test whether we're 'inside' ignore capsule segments and points +// if(!(-1E-7 < dn && dn < 1E-7)) + && dn >= 1E-7f) // PT: it should never be negative so this unique test is enough + { + dn = 1.0f / dn; + const float ld1 = -localPlane1.d; // PT: unavoidable "int-to-float" LHS here, so we only want to read it once! + + // Lazy-transform vertices + if(!verts2D) + { + verts2D = reinterpret_cast(stackMemory); + //Project points + transformVertices( + minX, minY, + maxX, maxY, + verts2D, numVerts1, vertices1, indices1, rotT1); + } + + for(PxU32 i=0; i < numVerts0; i++) //for all vertices of poly0 + { + const PxVec3& p = vertices0[indices0[i]]; + const float p0_z = transformZ(p, t0to2D); //transform ith vertex of poly0 to RotT + + const PxVec3 pIn1 = transform0to1.transform(p); //transform vertex to hull1 space, in which we have the poly1 vertices. + + const PxReal dd = (p0_z - ld1) * dn; //(p0_z + localPlane1.d) is the depth of the vertex behind the triangle measured along the triangle's normal. + //we convert this to being measured along the 'contact normal' using the division. + +// if(dd < 0.0f) //if the penetrating vertex will have a penetration along the contact normal: +// PX_ASSERT(dd <= 0.0f); // PT: dn is always positive, so dd is always negative + { + float px, py; + transform2DT(px, py, pIn1 - dd*localDir, rotT1); //project vertex into poly1 plane along CONTACT NORMAL - not the polygon's normal. + + const bool res = PointInConvexPolygon2D_OutCodes(verts2D, numVerts1, px-minX, py-minY, maxX, maxY, outCodes0[i]); + flags0[i] = res; + if(res) + { + NumIn++; + + if(p0_z < ld1) + { + status = true; // PT: keep this first to avoid an LHS when leaving the function + + PxContactPoint* PX_RESTRICT ctc = contactBuffer.contact(); + if(ctc) + { +#ifdef CONTACT_REDUCTION + indices[nbCurrentContacts++] = indices0[i]; +#endif + ctc->normal = n; + ctc->point = world0.transform(p) + (flipNormal ? posShift : PxVec3(0.0f)); + ctc->separation = dd + sepShift; + ctc->internalFaceIndex1 = polyIndex1; + } + } + } + } + } + } + else + { + PxMemZero(flags0, size0); + PxMemZero(outCodes0, size0); + } + + if(NumIn == numVerts0) + { + //All vertices0 are inside polygon 1 +#ifdef CONTACT_REDUCTION + ContactReductionAllIn(contactBuffer, nbExistingContacts, NumIn, rotT0, vertices0, indices); +#endif + return status; + } + +#ifdef CONTACT_REDUCTION + ContactReductionAllIn(contactBuffer, nbExistingContacts, NumIn, rotT0, vertices0, indices); +#endif + +#ifdef CONTACT_REDUCTION + nbExistingContacts = contactBuffer.count; + nbCurrentContacts = 0; +#endif + NumIn = 0; + verts2D = NULL; + + //Polygon 0 + const PxMat34 t1to2D = transformTranspose(rotT0, transform1to0); + + if (numVerts0 > 2) //no need to test whether we're 'inside' ignore capsule segments and points + { + const float ld0 = -localPlane0.d; // PT: unavoidable "int-to-float" LHS here, so we only want to read it once! + + // Lazy-transform vertices + if(!verts2D) + { + verts2D = reinterpret_cast(stackMemory); + //Project vertices + transformVertices( + minX, minY, + maxX, maxY, + verts2D, numVerts0, vertices0, indices0, rotT0); + } + + for(PxU32 i=0; i < numVerts1; i++) + { + const PxVec3& p = vertices1[indices1[i]]; + + float px, py; + transform2D(px, py, p, t1to2D); + + const bool res = PointInConvexPolygon2D_OutCodes(verts2D, numVerts0, px-minX, py-minY, maxX, maxY, outCodes1[i]); + flags1[i] = res; + if(res) + { + NumIn++; + + const float pz = transformZ(p, t1to2D); + if(pz < ld0) + { + status = true; // PT: keep this first to avoid an LHS when leaving the function + + // PT: in theory, with this contact point we should use "worldSepAxis" as a contact normal. + // However we want to output the same normal for all contact points not to break friction + // patches!!! In theory again, it should be exactly the same since the contact point at + // time of impact is supposed to be the same on both bodies. In practice however, and with + // a depth-based engine, this is not the case. So the contact point here is not exactly + // right, but preserving the friction patch seems more important. + + PxContactPoint* PX_RESTRICT ctc = contactBuffer.contact(); + if(ctc) + { +#ifdef CONTACT_REDUCTION + indices[nbCurrentContacts++] = indices1[i]; +#endif + ctc->normal = n; + ctc->point = world1.transform(p) + (flipNormal ? PxVec3(0.0f) : posShift); + ctc->separation = (pz - ld0) + sepShift; + ctc->internalFaceIndex1 = polyIndex1; + } + } + } + } + + if(NumIn == numVerts1) + { + //all vertices 1 are inside polygon 0 +#ifdef CONTACT_REDUCTION + ContactReductionAllIn(contactBuffer, nbExistingContacts, NumIn, rotT1, vertices1, indices); +#endif + return status; + } +#ifdef CONTACT_REDUCTION + ContactReductionAllIn(contactBuffer, nbExistingContacts, NumIn, rotT1, vertices1, indices); +#endif + } + else + { + PxMemZero(flags1, size1); + PxMemZero(outCodes1, size1); + } + } + + //Edge/edge case + //Calculation done in space 0 + PxVec3* PX_RESTRICT verts1in0 = reinterpret_cast(stackMemory); + for(PxU32 i=0; i= 2 && numVerts1 >= 2)//useless if one of them is degenerate. + for(PxU32 j=0; j= numVerts1) j1 = 0; + +// if(!(flags1[j] ^ flags1[j1])) +// continue; + if(flags1[j] && flags1[j1]) + continue; + if(outCodes1[j]&outCodes1[j1]) + continue; + + const PxVec3& p0 = verts1in0[j]; + const PxVec3& p1 = verts1in0[j1]; + +// gVisualizeLocalLine(vertices1[indices1[j]], vertices1[indices1[j1]], world1, callback.getManager()); + + const PxVec3 v1 = p1-p0; + const PxVec3 planeNormal = v1.cross(localPlane0.n); + const PxPlane plane(planeNormal, -(planeNormal.dot(p0))); + + // find largest 2D plane projection + PxU32 _i, _j; + closestAxis(planeNormal, _i, _j); + + const PxReal coeff = 1.0f / (v1[_i]*localPlane0.n[_j]-v1[_j]*localPlane0.n[_i]); + + for(PxU32 i=0; i= numVerts0) i1 = 0; + +// if(!(flags0[i] ^ flags0[i1])) +// continue; + if(flags0[i] && flags0[i1]) + continue; + if(outCodes0[i]&outCodes0[i1]) + continue; + + const PxVec3& p0b = vertices0[indices0[i]]; + const PxVec3& p1b = vertices0[indices0[i1]]; + +// gVisualizeLocalLine(p0b, p1b, world0, callback.getManager()); + + PxReal dist; + PxVec3 p; + + if(EdgeEdgeContactSpecial(v1, plane, p0, p1, localPlane0.n, p0b, p1b, dist, p, _i, _j, coeff)) + { + status = true; // PT: keep this first to avoid an LHS when leaving the function +/* p = world0.transform(p); + + //contacts are generated on the edges of polygon 1 + //we only have to shift the position of polygon 1 if flipNormal is false, because + //in this case convex 0 gets passed as polygon 1, and it is convex 0 that was shifted. + if (!flipNormal) + p += posShift; + + contactBuffer.contact(p, n, -dist + sepShift, polyIndex0, polyIndex1, convexID);*/ + + PxContactPoint* PX_RESTRICT ctc = contactBuffer.contact(); + if(ctc) + { + ctc->normal = n; + ctc->point = world0.transform(p) + (flipNormal ? PxVec3(0.0f) : posShift); + ctc->separation = -dist + sepShift; + ctc->internalFaceIndex1 = polyIndex1; + } + } + } + } + return status; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.h new file mode 100644 index 0000000..97655c1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactPolygonPolygon.h @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONTACTPOLYGONPOLYGON_H +#define GU_CONTACTPOLYGONPOLYGON_H + +#include "foundation/Px.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +class PxContactBuffer; + +namespace Cm +{ + class FastVertex2ShapeScaling; +} + +namespace Gu +{ + +PX_PHYSX_COMMON_API PxMat33 findRotationMatrixFromZ(const PxVec3& to); + +PX_PHYSX_COMMON_API bool contactPolygonPolygonExt( PxU32 numVerts0, const PxVec3* vertices0, const PxU8* indices0,//polygon 0 + const PxMat34& world0, const PxPlane& localPlane0, //xform of polygon 0, plane of polygon + const PxMat33& RotT0, + + PxU32 numVerts1, const PxVec3* vertices1, const PxU8* indices1,//polygon 1 + const PxMat34& world1, const PxPlane& localPlane1, //xform of polygon 1, plane of polygon + const PxMat33& RotT1, + + const PxVec3& worldSepAxis, //world normal of separating plane - this is the world space normal of polygon0!! + const PxMat34& transform0to1, const PxMat34& transform1to0,//transforms between polygons + PxU32 polyIndex0, PxU32 polyIndex1, //face indices for contact callback, + PxContactBuffer& contactBuffer, + bool flipNormal, const PxVec3& posShift, float sepShift + ); // shape order, post gen shift. +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp new file mode 100644 index 0000000..1918c16 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereBox.cpp @@ -0,0 +1,173 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +//This version is ported 1:1 from novodex +static PX_FORCE_INLINE bool ContactSphereBox(const PxVec3& sphereOrigin, + PxReal sphereRadius, + const PxVec3& boxExtents, +// const PxcCachedTransforms& boxCacheTransform, + const PxTransform& boxTransform, + PxVec3& point, + PxVec3& normal, + PxReal& separation, + PxReal contactDistance) +{ +// const PxTransform& boxTransform = boxCacheTransform.getShapeToWorld(); + + //returns true on contact + const PxVec3 delta = sphereOrigin - boxTransform.p; // s1.center - s2.center; + PxVec3 dRot = boxTransform.rotateInv(delta); //transform delta into OBB body coords. + + //check if delta is outside ABB - and clip the vector to the ABB. + bool outside = false; + + if (dRot.x < -boxExtents.x) + { + outside = true; + dRot.x = -boxExtents.x; + } + else if (dRot.x > boxExtents.x) + { + outside = true; + dRot.x = boxExtents.x; + } + + if (dRot.y < -boxExtents.y) + { + outside = true; + dRot.y = -boxExtents.y; + } + else if (dRot.y > boxExtents.y) + { + outside = true; + dRot.y = boxExtents.y; + } + + if (dRot.z < -boxExtents.z) + { + outside = true; + dRot.z =-boxExtents.z; + } + else if (dRot.z > boxExtents.z) + { + outside = true; + dRot.z = boxExtents.z; + } + + if (outside) //if clipping was done, sphere center is outside of box. + { + point = boxTransform.rotate(dRot); //get clipped delta back in world coords. + normal = delta - point; //what we clipped away. + const PxReal lenSquared = normal.magnitudeSquared(); + const PxReal inflatedDist = sphereRadius + contactDistance; + if (lenSquared > inflatedDist * inflatedDist) + return false; //disjoint + + //normalize to make it into the normal: + separation = PxRecipSqrt(lenSquared); + normal *= separation; + separation *= lenSquared; + //any plane that touches the sphere is tangential, so a vector from contact point to sphere center defines normal. + //we could also use point here, which has same direction. + //this is either a faceFace or a vertexFace contact depending on whether the box's face or vertex collides, but we did not distinguish. + //We'll just use vertex face for now, this info isn't really being used anyway. + //contact point is point on surface of cube closest to sphere center. + point += boxTransform.p; + separation -= sphereRadius; + return true; + } + else + { + //center is in box, we definitely have a contact. + PxVec3 locNorm; //local coords contact normal + + /*const*/ PxVec3 absdRot; + absdRot = PxVec3(PxAbs(dRot.x), PxAbs(dRot.y), PxAbs(dRot.z)); + /*const*/ PxVec3 distToSurface = boxExtents - absdRot; //dist from embedded center to box surface along 3 dimensions. + + //find smallest element of distToSurface + if (distToSurface.y < distToSurface.x) + { + if (distToSurface.y < distToSurface.z) + { + //y + locNorm = PxVec3(0.0f, dRot.y > 0.0f ? 1.0f : -1.0f, 0.0f); + separation = -distToSurface.y; + } + else + { + //z + locNorm = PxVec3(0.0f,0.0f, dRot.z > 0.0f ? 1.0f : -1.0f); + separation = -distToSurface.z; + } + } + else + { + if (distToSurface.x < distToSurface.z) + { + //x + locNorm = PxVec3(dRot.x > 0.0f ? 1.0f : -1.0f, 0.0f, 0.0f); + separation = -distToSurface.x; + } + else + { + //z + locNorm = PxVec3(0.0f,0.0f, dRot.z > 0.0f ? 1.0f : -1.0f); + separation = -distToSurface.z; + } + } + //separation so far is just the embedding of the center point; we still have to push out all of the radius. + point = sphereOrigin; + normal = boxTransform.rotate(locNorm); + separation -= sphereRadius; + return true; + } +} + +bool Gu::contactSphereBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxSphereGeometry& sphereGeom = checkedCast(shape0); + const PxBoxGeometry& boxGeom = checkedCast(shape1); + + PxVec3 normal; + PxVec3 point; + PxReal separation; + if(!ContactSphereBox(transform0.p, sphereGeom.radius, boxGeom.halfExtents, transform1, point, normal, separation, params.mContactDistance)) + return false; + + contactBuffer.contact(point, normal, separation); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp new file mode 100644 index 0000000..bf974df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereCapsule.cpp @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuDistancePointSegment.h" +#include "GuContactMethodImpl.h" +#include "GuInternal.h" + +using namespace physx; + +bool Gu::contactSphereCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxSphereGeometry& sphereGeom = checkedCast(shape0); + const PxCapsuleGeometry& capsuleGeom = checkedCast(shape1); + + // PT: get capsule in local space + const PxVec3 capsuleLocalSegment = getCapsuleHalfHeightVector(transform1, capsuleGeom); + const Segment localSegment(capsuleLocalSegment, -capsuleLocalSegment); + + // PT: get sphere in capsule space + const PxVec3 sphereCenterInCapsuleSpace = transform0.p - transform1.p; + + const PxReal radiusSum = sphereGeom.radius + capsuleGeom.radius; + const PxReal inflatedSum = radiusSum + params.mContactDistance; + + // PT: compute distance between sphere center & capsule's segment + PxReal u; + const PxReal squareDist = distancePointSegmentSquared(localSegment, sphereCenterInCapsuleSpace, &u); + if(squareDist >= inflatedSum*inflatedSum) + return false; + + // PT: compute contact normal + PxVec3 normal = sphereCenterInCapsuleSpace - localSegment.getPointAt(u); + + // We do a *manual* normalization to check for singularity condition + const PxReal lenSq = normal.magnitudeSquared(); + if(lenSq==0.0f) + normal = PxVec3(1.0f, 0.0f, 0.0f); // PT: zero normal => pick up random one + else + normal *= PxRecipSqrt(lenSq); + + // PT: compute contact point + const PxVec3 point = sphereCenterInCapsuleSpace + transform1.p - normal * sphereGeom.radius; + + // PT: output unique contact + contactBuffer.contact(point, normal, PxSqrt(squareDist) - radiusSum); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp new file mode 100644 index 0000000..b5e8f8b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereMesh.cpp @@ -0,0 +1,621 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "common/PxRenderOutput.h" +#include "GuDistancePointTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuFeatureCode.h" +#include "GuMidphaseInterface.h" +#include "GuEntityReport.h" +#include "GuHeightFieldUtil.h" +#include "GuBox.h" + +#include "foundation/PxSort.h" + +#define DEBUG_RENDER_MESHCONTACTS 0 + +using namespace physx; +using namespace Gu; + +static const bool gDrawTouchedTriangles = false; + +static void outputErrorMessage() +{ +#if PX_CHECKED + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Dropping contacts in sphere vs mesh: exceeded limit of 64 "); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: a customized version that also returns the feature code +static PxVec3 closestPtPointTriangle(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, float& s, float& t, FeatureCode& fc) +{ + // Check if P in vertex region outside A + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 ap = p - a; + const float d1 = ab.dot(ap); + const float d2 = ac.dot(ap); + if(d1<=0.0f && d2<=0.0f) + { + s = 0.0f; + t = 0.0f; + fc = FC_VERTEX0; + return a; // Barycentric coords 1,0,0 + } + + // Check if P in vertex region outside B + const PxVec3 bp = p - b; + const float d3 = ab.dot(bp); + const float d4 = ac.dot(bp); + if(d3>=0.0f && d4<=d3) + { + s = 1.0f; + t = 0.0f; + fc = FC_VERTEX1; + return b; // Barycentric coords 0,1,0 + } + + // Check if P in edge region of AB, if so return projection of P onto AB + const float vc = d1*d4 - d3*d2; + if(vc<=0.0f && d1>=0.0f && d3<=0.0f) + { + const float v = d1 / (d1 - d3); + s = v; + t = 0.0f; + fc = FC_EDGE01; + return a + v * ab; // barycentric coords (1-v, v, 0) + } + + // Check if P in vertex region outside C + const PxVec3 cp = p - c; + const float d5 = ab.dot(cp); + const float d6 = ac.dot(cp); + if(d6>=0.0f && d5<=d6) + { + s = 0.0f; + t = 1.0f; + fc = FC_VERTEX2; + return c; // Barycentric coords 0,0,1 + } + + // Check if P in edge region of AC, if so return projection of P onto AC + const float vb = d5*d2 - d1*d6; + if(vb<=0.0f && d2>=0.0f && d6<=0.0f) + { + const float w = d2 / (d2 - d6); + s = 0.0f; + t = w; + fc = FC_EDGE20; + return a + w * ac; // barycentric coords (1-w, 0, w) + } + + // Check if P in edge region of BC, if so return projection of P onto BC + const float va = d3*d6 - d5*d4; + if(va<=0.0f && (d4-d3)>=0.0f && (d5-d6)>=0.0f) + { + const float w = (d4-d3) / ((d4 - d3) + (d5-d6)); + s = 1.0f-w; + t = w; + fc = FC_EDGE12; + return b + w * (c-b); // barycentric coords (0, 1-w, w) + } + + // P inside face region. Compute Q through its barycentric coords (u,v,w) + const float denom = 1.0f / (va + vb + vc); + const float v = vb * denom; + const float w = vc * denom; + s = v; + t = w; + fc = FC_FACE; + return a + ab*v + ac*w; +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: we use a separate structure to make sorting faster +struct SortKey +{ + float mSquareDist; + PxU32 mIndex; + + PX_FORCE_INLINE bool operator < (const SortKey& data) const + { + return mSquareDist < data.mSquareDist; + } +}; + +struct TriangleData +{ + PxVec3 mDelta; + FeatureCode mFC; + PxU32 mTriangleIndex; + PxU32 mVRef[3]; +}; + +struct CachedTriangleIndices +{ + PxU32 mVRef[3]; +}; + +static PX_FORCE_INLINE bool validateSquareDist(PxReal squareDist) +{ + return squareDist>0.0001f; +} + +static bool validateEdge(PxU32 vref0, PxU32 vref1, const CachedTriangleIndices* cachedTris, PxU32 nbCachedTris) +{ + while(nbCachedTris--) + { + const CachedTriangleIndices& inds = *cachedTris++; + const PxU32 vi0 = inds.mVRef[0]; + const PxU32 vi1 = inds.mVRef[1]; + const PxU32 vi2 = inds.mVRef[2]; + + if(vi0==vref0) + { + if(vi1==vref1 || vi2==vref1) + return false; + } + else if(vi1==vref0) + { + if(vi0==vref1 || vi2==vref1) + return false; + } + else if(vi2==vref0) + { + if(vi1==vref1 || vi0==vref1) + return false; + } + } + return true; +} + +static bool validateVertex(PxU32 vref, const CachedTriangleIndices* cachedTris, PxU32 nbCachedTris) +{ + while(nbCachedTris--) + { + const CachedTriangleIndices& inds = *cachedTris++; + if(inds.mVRef[0]==vref || inds.mVRef[1]==vref || inds.mVRef[2]==vref) + return false; + } + return true; +} + +namespace +{ + class NullAllocator + { + public: + PX_FORCE_INLINE NullAllocator() { } + PX_FORCE_INLINE void* allocate(size_t, const char*, int) { return NULL; } + PX_FORCE_INLINE void deallocate(void*) { } + }; + +struct SphereMeshContactGeneration +{ + const PxSphereGeometry& mShapeSphere; + const PxTransform& mTransform0; + const PxTransform& mTransform1; + PxContactBuffer& mContactBuffer; + const PxVec3& mSphereCenterShape1Space; + PxF32 mInflatedRadius2; + PxU32 mNbDelayed; + TriangleData mSavedData[PxContactBuffer::MAX_CONTACTS]; + SortKey mSortKey[PxContactBuffer::MAX_CONTACTS]; + PxU32 mNbCachedTris; + CachedTriangleIndices mCachedTris[PxContactBuffer::MAX_CONTACTS]; + PxRenderOutput* mRenderOutput; + + SphereMeshContactGeneration(const PxSphereGeometry& shapeSphere, const PxTransform& transform0, const PxTransform& transform1, + PxContactBuffer& contactBuffer, const PxVec3& sphereCenterShape1Space, PxF32 inflatedRadius, + PxRenderOutput* renderOutput) : + mShapeSphere (shapeSphere), + mTransform0 (transform0), + mTransform1 (transform1), + mContactBuffer (contactBuffer), + mSphereCenterShape1Space (sphereCenterShape1Space), + mInflatedRadius2 (inflatedRadius*inflatedRadius), + mNbDelayed (0), + mNbCachedTris (0), + mRenderOutput (renderOutput) + { + } + + PX_FORCE_INLINE void cacheTriangle(PxU32 ref0, PxU32 ref1, PxU32 ref2) + { + const PxU32 nb = mNbCachedTris++; + mCachedTris[nb].mVRef[0] = ref0; + mCachedTris[nb].mVRef[1] = ref1; + mCachedTris[nb].mVRef[2] = ref2; + } + + PX_FORCE_INLINE void addContact(const PxVec3& d, PxReal squareDist, PxU32 triangleIndex) + { + float dist; + PxVec3 delta; + if(validateSquareDist(squareDist)) + { + // PT: regular contact. Normalize 'delta'. + dist = PxSqrt(squareDist); + delta = d / dist; + } + else + { + // PT: singular contact: 'd' is the non-unit triangle's normal in this case. + dist = 0.0f; + delta = -d.getNormalized(); + } + + const PxVec3 worldNormal = -mTransform1.rotate(delta); + + const PxVec3 localHit = mSphereCenterShape1Space + mShapeSphere.radius*delta; + const PxVec3 hit = mTransform1.transform(localHit); + + if(!mContactBuffer.contact(hit, worldNormal, dist - mShapeSphere.radius, triangleIndex)) + outputErrorMessage(); + } + + void processTriangle(PxU32 triangleIndex, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, const PxU32* vertInds) + { + // PT: compute closest point between sphere center and triangle + PxReal u, v; + FeatureCode fc; + const PxVec3 cp = closestPtPointTriangle(mSphereCenterShape1Space, v0, v1, v2, u, v, fc); + + // PT: compute 'delta' vector between closest point and sphere center + const PxVec3 delta = cp - mSphereCenterShape1Space; + const PxReal squareDist = delta.magnitudeSquared(); + if(squareDist >= mInflatedRadius2) + return; + + // PT: backface culling without the normalize + // PT: TODO: consider doing before the pt-triangle distance test if it's cheaper + // PT: TODO: e0/e1 already computed in closestPtPointTriangle + const PxVec3 e0 = v1 - v0; + const PxVec3 e1 = v2 - v0; + const PxVec3 planeNormal = e0.cross(e1); + const PxF32 planeD = planeNormal.dot(v0); // PT: actually -d compared to PxcPlane + if(planeNormal.dot(mSphereCenterShape1Space) < planeD) + return; + + // PT: for a regular contact, 'delta' is non-zero (and so is 'squareDist'). However when the sphere's center exactly touches + // the triangle, then both 'delta' and 'squareDist' become zero. This needs to be handled as a special case to avoid dividing + // by zero. We will use the triangle's normal as a contact normal in this special case. + // + // 'validateSquareDist' is called twice because there are conflicting goals here. We could call it once now and already + // compute the proper data for generating the contact. But this would mean doing a square-root and a division right here, + // even when the contact is not actually needed in the end. We could also call it only once in "addContact', but the plane's + // normal would not always be available (in case of delayed contacts), and thus it would need to be either recomputed (slower) + // or stored within 'TriangleData' (using more memory). Calling 'validateSquareDist' twice is a better option overall. + PxVec3 d; + if(validateSquareDist(squareDist)) + d = delta; + else + d = planeNormal; + + if(fc==FC_FACE) + { + addContact(d, squareDist, triangleIndex); + + if(mNbCachedTrismDelta = d; + saved->mVRef[0] = vertInds[0]; + saved->mVRef[1] = vertInds[1]; + saved->mVRef[2] = vertInds[2]; + saved->mFC = fc; + saved->mTriangleIndex = triangleIndex; + } + else outputErrorMessage(); + } + } + + void generateLastContacts() + { + const PxU32 count = mNbDelayed; + if(!count) + return; + + PxSort(mSortKey, count, PxLess(), NullAllocator(), PxContactBuffer::MAX_CONTACTS); + + TriangleData* touchedTris = mSavedData; + for(PxU32 i=0;i +{ + SphereMeshContactGeneration mGeneration; + const TriangleMesh& mMeshData; + + SphereMeshContactGenerationCallback_NoScale(const TriangleMesh& meshData, const PxSphereGeometry& shapeSphere, + const PxTransform& transform0, const PxTransform& transform1, PxContactBuffer& contactBuffer, + const PxVec3& sphereCenterShape1Space, PxF32 inflatedRadius, PxRenderOutput* renderOutput + ) : MeshHitCallback (CallbackMode::eMULTIPLE), + mGeneration (shapeSphere, transform0, transform1, contactBuffer, sphereCenterShape1Space, inflatedRadius, renderOutput), + mMeshData (meshData) + { + } + + virtual ~SphereMeshContactGenerationCallback_NoScale() + { + mGeneration.generateLastContacts(); + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* vinds) + { + if(gDrawTouchedTriangles) + { + (*mGeneration.mRenderOutput) << 0xffffffff; + (*mGeneration.mRenderOutput) << PxMat44(PxIdentity); + const PxVec3 wp0 = mGeneration.mTransform1.transform(v0); + const PxVec3 wp1 = mGeneration.mTransform1.transform(v1); + const PxVec3 wp2 = mGeneration.mTransform1.transform(v2); + mGeneration.mRenderOutput->outputSegment(wp0, wp1); + mGeneration.mRenderOutput->outputSegment(wp1, wp2); + mGeneration.mRenderOutput->outputSegment(wp2, wp0); + } + + mGeneration.processTriangle(hit.faceIndex, v0, v1, v2, vinds); + return true; + } + +protected: + SphereMeshContactGenerationCallback_NoScale &operator=(const SphereMeshContactGenerationCallback_NoScale &); +}; + +struct SphereMeshContactGenerationCallback_Scale : SphereMeshContactGenerationCallback_NoScale +{ + const Cm::FastVertex2ShapeScaling& mMeshScaling; + + SphereMeshContactGenerationCallback_Scale(const TriangleMesh& meshData, const PxSphereGeometry& shapeSphere, + const PxTransform& transform0, const PxTransform& transform1, const Cm::FastVertex2ShapeScaling& meshScaling, + PxContactBuffer& contactBuffer, const PxVec3& sphereCenterShape1Space, PxF32 inflatedRadius, PxRenderOutput* renderOutput + ) : SphereMeshContactGenerationCallback_NoScale(meshData, shapeSphere, + transform0, transform1, contactBuffer, sphereCenterShape1Space, inflatedRadius, renderOutput), + mMeshScaling (meshScaling) + { + } + + virtual ~SphereMeshContactGenerationCallback_Scale() {} + + virtual PxAgain processHit(const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* vinds) + { + PxVec3 verts[3]; + getScaledVertices(verts, v0, v1, v2, false, mMeshScaling); + + const PxU32* vertexIndices = vinds; + PxU32 localStorage[3]; + if(mMeshScaling.flipsNormal()) + { + localStorage[0] = vinds[0]; + localStorage[1] = vinds[2]; + localStorage[2] = vinds[1]; + vertexIndices = localStorage; + } + + if(gDrawTouchedTriangles) + { + (*mGeneration.mRenderOutput) << 0xffffffff; + (*mGeneration.mRenderOutput) << PxMat44(PxIdentity); + const PxVec3 wp0 = mGeneration.mTransform1.transform(verts[0]); + const PxVec3 wp1 = mGeneration.mTransform1.transform(verts[1]); + const PxVec3 wp2 = mGeneration.mTransform1.transform(verts[2]); + mGeneration.mRenderOutput->outputSegment(wp0, wp1); + mGeneration.mRenderOutput->outputSegment(wp1, wp2); + mGeneration.mRenderOutput->outputSegment(wp2, wp0); + } + + mGeneration.processTriangle(hit.faceIndex, verts[0], verts[1], verts[2], vertexIndices); + return true; + } +protected: + SphereMeshContactGenerationCallback_Scale &operator=(const SphereMeshContactGenerationCallback_Scale &); +}; + +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Gu::contactSphereMesh(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + // We must be in local space to use the cache + const PxVec3 sphereCenterInMeshSpace = transform1.transformInv(transform0.p); + const PxReal inflatedRadius = shapeSphere.radius + params.mContactDistance; + const TriangleMesh* meshData = _getMeshData(shapeMesh); + + // mesh scale is not baked into cached verts + if(shapeMesh.scale.isIdentity()) + { + SphereMeshContactGenerationCallback_NoScale callback( + *meshData, shapeSphere, transform0, transform1, + contactBuffer, sphereCenterInMeshSpace, inflatedRadius, renderOutput); + + // PT: TODO: switch to sphere query here + const Box obb(sphereCenterInMeshSpace, PxVec3(inflatedRadius), PxMat33(PxIdentity)); + Midphase::intersectOBB(meshData, obb, callback, true); + } + else + { + const Cm::FastVertex2ShapeScaling meshScaling(shapeMesh.scale); + + SphereMeshContactGenerationCallback_Scale callback( + *meshData, shapeSphere, transform0, transform1, + meshScaling, contactBuffer, sphereCenterInMeshSpace, inflatedRadius, renderOutput); + + PxVec3 obbCenter = sphereCenterInMeshSpace; + PxVec3 obbExtents = PxVec3(inflatedRadius); + PxMat33 obbRot(PxIdentity); + meshScaling.transformQueryBounds(obbCenter, obbExtents, obbRot); + + const Box obb(obbCenter, obbExtents, obbRot); + + Midphase::intersectOBB(meshData, obb, callback, true); + } + return contactBuffer.count > 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ +struct SphereHeightfieldContactGenerationCallback : OverlapReport +{ + SphereMeshContactGeneration mGeneration; + HeightFieldUtil& mHfUtil; + + SphereHeightfieldContactGenerationCallback( + HeightFieldUtil& hfUtil, + const PxSphereGeometry& shapeSphere, + const PxTransform& transform0, + const PxTransform& transform1, + PxContactBuffer& contactBuffer, + const PxVec3& sphereCenterInMeshSpace, + PxF32 inflatedRadius, + PxRenderOutput* renderOutput + ) : + mGeneration (shapeSphere, transform0, transform1, contactBuffer, sphereCenterInMeshSpace, inflatedRadius, renderOutput), + mHfUtil (hfUtil) + { + } + + // PT: TODO: refactor/unify with similar code in other places + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + while(nb--) + { + const PxU32 triangleIndex = *indices++; + PxU32 vertIndices[3]; + PxTriangle currentTriangle; + mHfUtil.getTriangle(mGeneration.mTransform1, currentTriangle, vertIndices, NULL, triangleIndex, false, false); + + mGeneration.processTriangle(triangleIndex, currentTriangle.verts[0], currentTriangle.verts[1], currentTriangle.verts[2], vertIndices); + } + return true; + } +protected: + SphereHeightfieldContactGenerationCallback &operator=(const SphereHeightfieldContactGenerationCallback &); +}; +} + +bool Gu::contactSphereHeightfield(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxHeightFieldGeometry& shapeMesh = checkedCast(shape1); + + HeightFieldUtil hfUtil(shapeMesh); + + const PxReal inflatedRadius = shapeSphere.radius + params.mContactDistance; + + PxBounds3 localBounds; + const PxVec3 localSphereCenter = getLocalSphereData(localBounds, transform0, transform1, inflatedRadius); + + SphereHeightfieldContactGenerationCallback blockCallback(hfUtil, shapeSphere, transform0, transform1, contactBuffer, localSphereCenter, inflatedRadius, renderOutput); + + hfUtil.overlapAABBTriangles(localBounds, blockCallback); + + blockCallback.mGeneration.generateLastContacts(); + + return contactBuffer.count > 0; +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp new file mode 100644 index 0000000..51dfea2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSpherePlane.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +bool Gu::contactSpherePlane(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + PX_UNUSED(shape1); + + // Get actual shape data + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + //const PxPlaneGeometry& shapePlane = checkedCast(shape1); + + //Sphere in plane space + const PxVec3 sphere = transform1.transformInv(transform0.p); + + //Make sure we have a normalized plane + //The plane is implicitly n=<1,0,0> d=0 (in plane-space) + //PX_ASSERT(PxAbs(shape1.mNormal.magnitudeSquared() - 1.0f) < 0.000001f); + + //Separation + const PxReal separation = sphere.x - shapeSphere.radius; + + if(separation<=params.mContactDistance) + { + const PxVec3 normal = transform1.q.getBasisVector0(); + const PxVec3 point = transform0.p - normal * shapeSphere.radius; + contactBuffer.contact(point, normal, separation); + return true; + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp new file mode 100644 index 0000000..22557c1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuContactSphereSphere.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +bool Gu::contactSphereSphere(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + const PxSphereGeometry& sphereGeom0 = checkedCast(shape0); + const PxSphereGeometry& sphereGeom1 = checkedCast(shape1); + + PxVec3 delta = transform0.p - transform1.p; + + const PxReal distanceSq = delta.magnitudeSquared(); + const PxReal radiusSum = sphereGeom0.radius + sphereGeom1.radius; + const PxReal inflatedSum = radiusSum + params.mContactDistance; + if(distanceSq >= inflatedSum*inflatedSum) + return false; + + // We do a *manual* normalization to check for singularity condition + const PxReal magn = PxSqrt(distanceSq); + if(magn<=0.00001f) + delta = PxVec3(1.0f, 0.0f, 0.0f); // PT: spheres are exactly overlapping => can't create normal => pick up random one + else + delta *= 1.0f/magn; + + // PT: TODO: why is this formula different from the original code? + const PxVec3 contact = delta * ((sphereGeom0.radius + magn - sphereGeom1.radius)*-0.5f) + transform0.p; + + contactBuffer.contact(contact, delta, magn - radiusSum); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp new file mode 100644 index 0000000..66ff2c5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.cpp @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuConvexEdgeFlags.h" +#include "GuFeatureCode.h" + +using namespace physx; +using namespace Gu; + +static FeatureCode computeFeatureCode(PxReal u, PxReal v) +{ + // Analysis + if(u==0.0f) + { + if(v==0.0f) + { + // Vertex 0 + return FC_VERTEX0; + } + else if(v==1.0f) + { + // Vertex 2 + return FC_VERTEX2; + } + else + { + // Edge 0-2 + return FC_EDGE20; + } + } + else if(u==1.0f) + { + if(v==0.0f) + { + // Vertex 1 + return FC_VERTEX1; + } + } + else + { + if(v==0.0f) + { + // Edge 0-1 + return FC_EDGE01; + } + else + { + if((u+v)>=0.9999f) + { + // Edge 1-2 + return FC_EDGE12; + } + else + { + // Face + return FC_FACE; + } + } + } + return FC_UNDEFINED; +} + + +bool Gu::selectNormal(PxU8 data, PxReal u, PxReal v) +{ + bool useFaceNormal = false; + const FeatureCode FC = computeFeatureCode(u, v); + switch(FC) + { + case FC_VERTEX0: + if(!(data & (Gu::ETD_CONVEX_EDGE_01|Gu::ETD_CONVEX_EDGE_20))) + useFaceNormal = true; + break; + case FC_VERTEX1: + if(!(data & (Gu::ETD_CONVEX_EDGE_01|Gu::ETD_CONVEX_EDGE_12))) + useFaceNormal = true; + break; + case FC_VERTEX2: + if(!(data & (Gu::ETD_CONVEX_EDGE_12|Gu::ETD_CONVEX_EDGE_20))) + useFaceNormal = true; + break; + case FC_EDGE01: + if(!(data & Gu::ETD_CONVEX_EDGE_01)) + useFaceNormal = true; + break; + case FC_EDGE12: + if(!(data & Gu::ETD_CONVEX_EDGE_12)) + useFaceNormal = true; + break; + case FC_EDGE20: + if(!(data & Gu::ETD_CONVEX_EDGE_20)) + useFaceNormal = true; + break; + case FC_FACE: + useFaceNormal = true; + break; + case FC_UNDEFINED: + break; + }; + return useFaceNormal; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.h new file mode 100644 index 0000000..09bb62e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/contact/GuFeatureCode.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_FEATURE_CODE_H +#define GU_FEATURE_CODE_H + +namespace physx +{ +namespace Gu +{ + enum FeatureCode + { + FC_VERTEX0, + FC_VERTEX1, + FC_VERTEX2, + FC_EDGE01, + FC_EDGE12, + FC_EDGE20, + FC_FACE, + + FC_UNDEFINED + }; + + bool selectNormal(PxU8 data, PxReal u, PxReal v); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp new file mode 100644 index 0000000..0c1ca1d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.cpp @@ -0,0 +1,201 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxAllocator.h" +#include "GuBigConvexData2.h" +#include "GuCubeIndex.h" +#include "CmUtils.h" +#include "CmSerialize.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +BigConvexData::BigConvexData() : mVBuffer(NULL) +{ + mData.mSubdiv = 0; + mData.mNbSamples = 0; + mData.mSamples = NULL; + + ////// + + mData.mNbVerts = 0; + mData.mNbAdjVerts = 0; + mData.mValencies = NULL; + mData.mAdjacentVerts = NULL; +} + +BigConvexData::~BigConvexData() +{ + PX_FREE(mData.mSamples); + + /////////// + + if(mVBuffer) + { + PX_FREE(mVBuffer); + } + else + { + // Allocated from somewhere else!! + PX_FREE(mData.mValencies); + PX_FREE(mData.mAdjacentVerts); + } +} + +void BigConvexData::CreateOffsets() +{ + // Create offsets (radix style) + mData.mValencies[0].mOffset = 0; + for(PxU32 i=1;i(mVBuffer); + mData.mAdjacentVerts = (reinterpret_cast(mVBuffer)) + sizeof(Gu::Valency)*numVerts; + + PX_ASSERT(0 == (size_t(mData.mAdjacentVerts) & 0xf)); + PX_ASSERT(Version==2); + + { + PxU16* temp = reinterpret_cast(mData.mValencies); + + PxU32 MaxIndex = readDword(Mismatch, stream); + ReadIndices(PxTo16(MaxIndex), mData.mNbVerts, temp, stream, Mismatch); + + // We transform from: + // + // |5555|4444|3333|2222|1111|----|----|----|----|----| + // + // to: + // + // |5555|4444|4444|2222|3333|----|2222|----|1111|----| + // + for(PxU32 i=0;i(PX_ALLOC(sizeof(PxU8)*mData.mNbSamples*2, "BigConvex Samples Data")); + + // These byte buffers shouldn't need converting + stream.read(mData.mSamples, sizeof(PxU8)*mData.mNbSamples*2); + + //load the valencies + return VLoad(stream); +} + +// PX_SERIALIZATION +void BigConvexData::exportExtraData(PxSerializationContext& stream) +{ + if(mData.mSamples) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mData.mSamples, sizeof(PxU8)*mData.mNbSamples*2); + } + + if(mData.mValencies) + { + stream.alignData(PX_SERIAL_ALIGN); + PxU32 numVerts = (mData.mNbVerts+3)&~3; + const PxU32 TotalSize = sizeof(Gu::Valency)*numVerts + sizeof(PxU8)*mData.mNbAdjVerts; + stream.writeData(mData.mValencies, TotalSize); + } +} + +void BigConvexData::importExtraData(PxDeserializationContext& context) +{ + if(mData.mSamples) + mData.mSamples = context.readExtraData(PxU32(mData.mNbSamples*2)); + + if(mData.mValencies) + { + context.alignExtraData(); + PxU32 numVerts = (mData.mNbVerts+3)&~3; + mData.mValencies = context.readExtraData(numVerts); + mData.mAdjacentVerts = context.readExtraData(mData.mNbAdjVerts); + + } +} +//~PX_SERIALIZATION + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.h new file mode 100644 index 0000000..14017e5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData.h @@ -0,0 +1,97 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BIG_CONVEX_DATA_H +#define GU_BIG_CONVEX_DATA_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ + +class BigConvexDataBuilder; +class PxcHillClimb; +class BigConvexData; + +// Data + +namespace Gu +{ + +struct Valency +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxU16 mCount; + PxU16 mOffset; +}; +PX_COMPILE_TIME_ASSERT(sizeof(Gu::Valency) == 4); + +struct BigConvexRawData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + // Support vertex map + PxU16 mSubdiv; // "Gaussmap" subdivision + PxU16 mNbSamples; // Total #samples in gaussmap PT: this is not even needed at runtime! + + PxU8* mSamples; + PX_FORCE_INLINE const PxU8* getSamples2() const + { + return mSamples + mNbSamples; + } + //~Support vertex map + + // Valencies data + PxU32 mNbVerts; //!< Number of vertices + PxU32 mNbAdjVerts; //!< Total number of adjacent vertices ### PT: this is useless at runtime and should not be stored here + Gu::Valency* mValencies; //!< A list of mNbVerts valencies (= number of neighbors) + PxU8* mAdjacentVerts; //!< List of adjacent vertices + //~Valencies data +}; +#if PX_P64_FAMILY +PX_COMPILE_TIME_ASSERT(sizeof(Gu::BigConvexRawData) == 40); +#else +PX_COMPILE_TIME_ASSERT(sizeof(Gu::BigConvexRawData) == 24); +#endif + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData2.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData2.h new file mode 100644 index 0000000..98c927b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuBigConvexData2.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BIG_CONVEX_DATA2_H +#define GU_BIG_CONVEX_DATA2_H + +#include "common/PxPhysXCommonConfig.h" +#include "common/PxMetaData.h" +#include "GuBigConvexData.h" + +namespace physx +{ + class PxSerializationContext; + class PxDeserializationContext; + + class PX_PHYSX_COMMON_API BigConvexData : public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + BigConvexData(const PxEMPTY) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + BigConvexData(); + ~BigConvexData(); + // Support vertex map + bool Load(PxInputStream& stream); + + PxU32 ComputeOffset(const PxVec3& dir) const; + PxU32 ComputeNearestOffset(const PxVec3& dir) const; + + // Data access + PX_INLINE PxU32 GetSubdiv() const { return mData.mSubdiv; } + PX_INLINE PxU32 GetNbSamples() const { return mData.mNbSamples; } + //~Support vertex map + + // Valencies + // Data access + PX_INLINE PxU32 GetNbVerts() const { return mData.mNbVerts; } + PX_INLINE const Gu::Valency* GetValencies() const { return mData.mValencies; } + PX_INLINE PxU16 GetValency(PxU32 i) const { return mData.mValencies[i].mCount; } + PX_INLINE PxU16 GetOffset(PxU32 i) const { return mData.mValencies[i].mOffset; } + PX_INLINE const PxU8* GetAdjacentVerts() const { return mData.mAdjacentVerts; } + + PX_INLINE PxU16 GetNbNeighbors(PxU32 i) const { return mData.mValencies[i].mCount; } + PX_INLINE const PxU8* GetNeighbors(PxU32 i) const { return &mData.mAdjacentVerts[mData.mValencies[i].mOffset]; } + +// PX_SERIALIZATION + void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); +//~PX_SERIALIZATION + Gu::BigConvexRawData mData; + protected: + void* mVBuffer; + // Internal methods + void CreateOffsets(); + bool VLoad(PxInputStream& stream); + //~Valencies + friend class BigConvexDataBuilder; + }; + +} + +#endif // BIG_CONVEX_DATA_H + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexEdgeFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexEdgeFlags.h new file mode 100644 index 0000000..e0bf8c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexEdgeFlags.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONVEX_EDGE_FLAGS_H +#define GU_CONVEX_EDGE_FLAGS_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ +namespace Gu +{ + enum ExtraTrigDataFlag + { + ETD_SILHOUETTE_EDGE_01 = (1 << 0), //First edge is a silhouette edge + ETD_SILHOUETTE_EDGE_12 = (1 << 1), //Second edge is a silhouette edge + ETD_SILHOUETTE_EDGE_20 = (1 << 2), //Third edge is a silhouette edge + ETD_CONVEX_EDGE_01 = (1<<3), // PT: important value, don't change + ETD_CONVEX_EDGE_12 = (1<<4), // PT: important value, don't change + ETD_CONVEX_EDGE_20 = (1<<5), // PT: important value, don't change + + ETD_CONVEX_EDGE_ALL = ETD_CONVEX_EDGE_01|ETD_CONVEX_EDGE_12|ETD_CONVEX_EDGE_20 + }; + + // PT: helper function to make sure we use the proper default flags everywhere + PX_FORCE_INLINE PxU8 getConvexEdgeFlags(const PxU8* extraTrigData, PxU32 triangleIndex) + { + return extraTrigData ? extraTrigData[triangleIndex] : PxU8(ETD_CONVEX_EDGE_ALL); + } + + PX_FORCE_INLINE void flipConvexEdgeFlags(PxU8& extraData) + { + // PT: this is a fix for PX-2327. When we flip the winding we also need to flip the precomputed edge flags. + // 01 => 02 + // 12 => 21 + // 20 => 10 + + const PxU8 convex01 = extraData & Gu::ETD_CONVEX_EDGE_01; + const PxU8 convex12 = extraData & Gu::ETD_CONVEX_EDGE_12; + const PxU8 convex20 = extraData & Gu::ETD_CONVEX_EDGE_20; + const PxU8 silhouette01 = extraData & Gu::ETD_SILHOUETTE_EDGE_01; + const PxU8 silhouette12 = extraData & Gu::ETD_SILHOUETTE_EDGE_12; + const PxU8 silhouette20 = extraData & Gu::ETD_SILHOUETTE_EDGE_20; + extraData = convex12|silhouette12; + if(convex01) + extraData |= Gu::ETD_CONVEX_EDGE_20; + if(convex20) + extraData |= Gu::ETD_CONVEX_EDGE_01; + if(silhouette01) + extraData |= Gu::ETD_SILHOUETTE_EDGE_20; + if(silhouette20) + extraData |= Gu::ETD_SILHOUETTE_EDGE_01; + } +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp new file mode 100644 index 0000000..39e7c51 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexHelper.cpp @@ -0,0 +1,135 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxUtilities.h" +#include "GuConvexHelper.h" +#include "GuInternal.h" +#include "GuConvexMesh.h" + +using namespace physx; +using namespace Gu; + +// PT: we can't call alloca in a function and we want to avoid defines or duplicating the code. This makes it a bit tricky to write. +void Gu::getScaledConvex( PxVec3*& scaledVertices, PxU8*& scaledIndices, PxVec3* dstVertices, PxU8* dstIndices, + bool idtConvexScale, const PxVec3* srcVerts, const PxU8* srcIndices, PxU32 nbVerts, const Cm::FastVertex2ShapeScaling& convexScaling) +{ + //pretransform convex polygon if we have scaling! + if(idtConvexScale) // PT: the scale is always 1 for boxes so no need to test the type + { + scaledVertices = const_cast(srcVerts); + scaledIndices = const_cast(srcIndices); + } + else + { + scaledIndices = dstIndices; + scaledVertices = dstVertices; + for(PxU32 i=0; imAABB.isEmpty()); + bounds = hullData->mAABB.transformFast(scaling.getVertex2ShapeSkew()); + + getPolygonalData_Convex(&polyData, hullData, scaling); + + // PT: non-uniform scaling invalidates the "internal objects" optimization, since our internal sphere + // might become an ellipsoid or something. Just disable the optimization if scaling is used... + if(!idtScale) + polyData.mInternal.reset(); + + return idtScale; +} + +PxU32 Gu::findUniqueConvexEdges(PxU32 maxNbEdges, ConvexEdge* PX_RESTRICT edges, PxU32 numPolygons, const Gu::HullPolygonData* PX_RESTRICT polygons, const PxU8* PX_RESTRICT vertexData) +{ + PxU32 nbEdges = 0; + + while(numPolygons--) + { + const HullPolygonData& polygon = *polygons++; + const PxU8* vRefBase = vertexData + polygon.mVRef8; + PxU32 numEdges = polygon.mNbVerts; + + PxU32 a = numEdges - 1; + PxU32 b = 0; + while(numEdges--) + { + PxU8 vi0 = vRefBase[a]; + PxU8 vi1 = vRefBase[b]; + + if(vi1 < vi0) + { + PxU8 tmp = vi0; + vi0 = vi1; + vi1 = tmp; + } + + bool found=false; + for(PxU32 i=0;i(PxAlloca(nbVerts * sizeof(PxVec3))), \ + idtScaling ? NULL : reinterpret_cast(PxAlloca(nbVerts * sizeof(PxU8))), \ + idtScaling, srcVerts, srcIndices, nbVerts, scaling); + + bool getConvexData(const PxConvexMeshGeometry& shapeConvex, Cm::FastVertex2ShapeScaling& scaling, PxBounds3& bounds, PolygonalData& polyData); + + struct ConvexEdge + { + PxU8 vref0; + PxU8 vref1; + PxVec3 normal; // warning: non-unit vector! + }; + + PxU32 findUniqueConvexEdges(PxU32 maxNbEdges, ConvexEdge* PX_RESTRICT edges, PxU32 numPolygons, const Gu::HullPolygonData* PX_RESTRICT polygons, const PxU8* PX_RESTRICT vertexData); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp new file mode 100644 index 0000000..48f6b7e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.cpp @@ -0,0 +1,450 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxFoundation.h" +#include "GuConvexMesh.h" +#include "GuBigConvexData2.h" +#include "GuMeshFactory.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +bool ConvexMesh::getPolygonData(PxU32 i, PxHullPolygon& data) const +{ + if(i>=mHullData.mNbPolygons) + return false; + + const HullPolygonData& poly = mHullData.mPolygons[i]; + data.mPlane[0] = poly.mPlane.n.x; + data.mPlane[1] = poly.mPlane.n.y; + data.mPlane[2] = poly.mPlane.n.z; + data.mPlane[3] = poly.mPlane.d; + data.mNbVerts = poly.mNbVerts; + data.mIndexBase = poly.mVRef8; + return true; +} + +static void initConvexHullData(ConvexHullData& data) +{ + data.mAABB.setEmpty(); + data.mCenterOfMass = PxVec3(0); + data.mNbEdges = PxBitAndWord(); + data.mNbHullVertices = 0; + data.mNbPolygons = 0; + data.mPolygons = NULL; + data.mBigConvexRawData = NULL; + data.mInternal.mRadius = 0.0f; + data.mInternal.mExtents[0] = data.mInternal.mExtents[1] = data.mInternal.mExtents[2] = 0.0f; +} + +ConvexMesh::ConvexMesh(MeshFactory* factory) : + PxConvexMesh (PxConcreteType::eCONVEX_MESH, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mNb (0), + mSdfData (NULL), + mBigConvexData (NULL), + mMass (0), + mInertia (PxMat33(PxIdentity)), + mMeshFactory (factory) +{ + initConvexHullData(mHullData); +} + +ConvexMesh::ConvexMesh(MeshFactory* factory, ConvexHullInitData& data) : + PxConvexMesh (PxConcreteType::eCONVEX_MESH, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mNb (data.mNb), + mSdfData (data.mSdfData), + mBigConvexData (data.mBigConvexData), + mMass (data.mMass), + mInertia (data.mInertia), + mMeshFactory (factory) +{ + mHullData = data.mHullData; +} + +ConvexMesh::~ConvexMesh() +{ + if(getBaseFlags()&PxBaseFlag::eOWNS_MEMORY) + { + PX_FREE(mHullData.mPolygons); + PX_DELETE(mBigConvexData); + PX_DELETE(mSdfData); + } +} + +bool ConvexMesh::isGpuCompatible() const +{ + PxReal maxR = PxMax(mHullData.mInternal.mExtents[0], PxMax(mHullData.mInternal.mExtents[1], mHullData.mInternal.mExtents[2])); + PxReal minR = mHullData.mInternal.mRadius; + + PxReal ratio = maxR/minR; + + return mHullData.mNbHullVertices <= 64 && + mHullData.mNbPolygons <= 64 && + mHullData.mPolygons[0].mNbVerts <= 32 && + mHullData.mNbEdges.isBitSet() && + ratio < 100.f; +} + +void ConvexMesh::exportExtraData(PxSerializationContext& context) +{ + context.alignData(PX_SERIAL_ALIGN); + const PxU32 bufferSize = computeBufferSize(mHullData, getNb()); + context.writeData(mHullData.mPolygons, bufferSize); + + if(mBigConvexData) + { + context.alignData(PX_SERIAL_ALIGN); + context.writeData(mBigConvexData, sizeof(BigConvexData)); + + mBigConvexData->exportExtraData(context); + } +} + +void ConvexMesh::importExtraData(PxDeserializationContext& context) +{ + const PxU32 bufferSize = computeBufferSize(mHullData, getNb()); + mHullData.mPolygons = reinterpret_cast(context.readExtraData(bufferSize)); + + if(mBigConvexData) + { + mBigConvexData = context.readExtraData(); + PX_PLACEMENT_NEW(mBigConvexData, BigConvexData(PxEmpty)); + mBigConvexData->importExtraData(context); + mHullData.mBigConvexRawData = &mBigConvexData->mData; + } +} + +ConvexMesh* ConvexMesh::createObject(PxU8*& address, PxDeserializationContext& context) +{ + ConvexMesh* obj = PX_PLACEMENT_NEW(address, ConvexMesh(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(ConvexMesh); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +static bool convexHullLoad(ConvexHullData& data, PxInputStream& stream, PxBitAndDword& bufferSize) +{ + PxU32 version; + bool Mismatch; + if(!ReadHeader('C', 'L', 'H', 'L', version, Mismatch, stream)) + return false; + + if(version<=8) + { + if(!ReadHeader('C', 'V', 'H', 'L', version, Mismatch, stream)) + return false; + } + + PxU32 Nb; + + // Import figures + { + PxU32 tmp[4]; + ReadDwordBuffer(tmp, 4, Mismatch, stream); + data.mNbHullVertices = PxTo8(tmp[0]); + data.mNbEdges = PxTo16(tmp[1]); + data.mNbPolygons = PxTo8(tmp[2]); + Nb = tmp[3]; + } + + //AM: In practice the old aligner approach wastes 20 bytes and there is no reason to 20 byte align this data. + //I changed the code to just 4 align for the time being. + //On consoles if anything we will need to make this stuff 16 byte align vectors to have any sense, which will have to be done by padding data structures. + PX_ASSERT(sizeof(HullPolygonData) % sizeof(PxReal) == 0); //otherwise please pad it. + PX_ASSERT(sizeof(PxVec3) % sizeof(PxReal) == 0); + + PxU32 bytesNeeded = computeBufferSize(data, Nb); + + PX_FREE(data.mPolygons); // Load() can be called for an existing convex mesh. In that case we need to free the memory first. + + bufferSize = Nb; + void* mDataMemory = PX_ALLOC(bytesNeeded, "ConvexHullData data"); + + PxU8* address = reinterpret_cast(mDataMemory); + + data.mPolygons = reinterpret_cast(address); address += sizeof(HullPolygonData) * data.mNbPolygons; + PxVec3* mDataHullVertices = reinterpret_cast(address); address += sizeof(PxVec3) * data.mNbHullVertices; + PxU8* mDataFacesByEdges8 = address; address += sizeof(PxU8) * data.mNbEdges * 2; + PxU8* mDataFacesByVertices8 = address; address += sizeof(PxU8) * data.mNbHullVertices * 3; + PxU16* mEdges = reinterpret_cast(address); address += data.mNbEdges.isBitSet() ? (sizeof(PxU16) * data.mNbEdges * 2) : 0; + PxU8* mDataVertexData8 = address; address += sizeof(PxU8) * Nb; // PT: leave that one last, so that we don't need to serialize "Nb" + + PX_ASSERT(!(size_t(mDataHullVertices) % sizeof(PxReal))); + PX_ASSERT(!(size_t(data.mPolygons) % sizeof(PxReal))); + PX_ASSERT(size_t(address)<=size_t(mDataMemory)+bytesNeeded); + + // Import vertices + readFloatBuffer(&mDataHullVertices->x, PxU32(3*data.mNbHullVertices), Mismatch, stream); + + if(version<=6) + { + PxU16 useUnquantizedNormals = readWord(Mismatch, stream); + PX_UNUSED(useUnquantizedNormals); + } + + // Import polygons + stream.read(data.mPolygons, data.mNbPolygons*sizeof(HullPolygonData)); + + if(Mismatch) + { + for(PxU32 i=0;iLoad(stream); + mHullData.mBigConvexRawData = &mBigConvexData->mData; + } + } + + //Import Sdf data + PxF32 sdfFlag = readFloat(mismatch, stream); + if (sdfFlag != -1.0f) + { + PX_ASSERT(sdfFlag == 1.0f); //otherwise file is corrupt + + PX_DELETE(mSdfData); + PX_NEW_SERIALIZED(mSdfData, SDF); + + if (mSdfData) + { + // Import sdf values + mSdfData->mMeshLower.x = readFloat(mismatch, stream); + mSdfData->mMeshLower.y = readFloat(mismatch, stream); + mSdfData->mMeshLower.z = readFloat(mismatch, stream); + mSdfData->mSpacing = readFloat(mismatch, stream); + mSdfData->mDims.x = readDword(mismatch, stream); + mSdfData->mDims.y = readDword(mismatch, stream); + mSdfData->mDims.z = readDword(mismatch, stream); + mSdfData->mNumSdfs = readDword(mismatch, stream); + + mSdfData->mNumSubgridSdfs = readDword(mismatch, stream); + mSdfData->mNumStartSlots = readDword(mismatch, stream); + mSdfData->mSubgridSize = readDword(mismatch, stream); + mSdfData->mSdfSubgrids3DTexBlockDim.x = readDword(mismatch, stream); + mSdfData->mSdfSubgrids3DTexBlockDim.y = readDword(mismatch, stream); + mSdfData->mSdfSubgrids3DTexBlockDim.z = readDword(mismatch, stream); + + mSdfData->mSubgridsMinSdfValue = readFloat(mismatch, stream); + mSdfData->mSubgridsMaxSdfValue = readFloat(mismatch, stream); + mSdfData->mBytesPerSparsePixel = readDword(mismatch, stream); + + //allocate sdf + mSdfData->allocateSdfs(mSdfData->mMeshLower, mSdfData->mSpacing, mSdfData->mDims.x, mSdfData->mDims.y, mSdfData->mDims.z, + mSdfData->mSubgridSize, mSdfData->mSdfSubgrids3DTexBlockDim.x, mSdfData->mSdfSubgrids3DTexBlockDim.y, mSdfData->mSdfSubgrids3DTexBlockDim.z, + mSdfData->mSubgridsMinSdfValue, mSdfData->mSubgridsMaxSdfValue, mSdfData->mBytesPerSparsePixel); + + readFloatBuffer(mSdfData->mSdf, mSdfData->mNumSdfs, mismatch, stream); + readByteBuffer(mSdfData->mSubgridSdf, mSdfData->mNumSubgridSdfs, stream); + readIntBuffer(mSdfData->mSubgridStartSlots, mSdfData->mNumStartSlots, mismatch, stream); + + mHullData.mSdfData = mSdfData; + } + } + + +/* + printf("\n\n"); + printf("COM: %f %f %f\n", massInfo.centerOfMass.x, massInfo.centerOfMass.y, massInfo.centerOfMass.z); + printf("BND: %f %f %f\n", mHullData.aabb.getCenter().x, mHullData.aabb.getCenter().y, mHullData.aabb.getCenter().z); + printf("CNT: %f %f %f\n", mHullData.mCenterxx.x, mHullData.mCenterxx.y, mHullData.mCenterxx.z); + printf("COM-BND: %f BND-CNT: %f, CNT-COM: %f\n", (massInfo.centerOfMass - mHullData.aabb.getCenter()).magnitude(), (mHullData.aabb.getCenter() - mHullData.mCenterxx).magnitude(), (mHullData.mCenterxx - massInfo.centerOfMass).magnitude()); +*/ + +// TEST_INTERNAL_OBJECTS + readFloatBuffer(&mHullData.mInternal.mRadius, 4, mismatch, stream); + + PX_ASSERT(PxVec3(mHullData.mInternal.mExtents[0], mHullData.mInternal.mExtents[1], mHullData.mInternal.mExtents[2]).isFinite()); + PX_ASSERT(mHullData.mInternal.mExtents[0] != 0.0f); + PX_ASSERT(mHullData.mInternal.mExtents[1] != 0.0f); + PX_ASSERT(mHullData.mInternal.mExtents[2] != 0.0f); +//~TEST_INTERNAL_OBJECTS + return true; +} + +void ConvexMesh::release() +{ + RefCountable_decRefCount(*this); +} + +void ConvexMesh::onRefCountZero() +{ + // when the mesh failed to load properly, it will not have been added to the convex array + ::onRefCountZero(this, mMeshFactory, !getBufferSize(), "PxConvexMesh::release: double deletion detected!"); +} + +void ConvexMesh::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 ConvexMesh::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +void ConvexMesh::getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const +{ + mass = ConvexMesh::getMass(); + localInertia = ConvexMesh::getInertia(); + localCenterOfMass = ConvexMesh::getHull().mCenterOfMass; +} + +PxBounds3 ConvexMesh::getLocalBounds() const +{ + PX_ASSERT(mHullData.mAABB.isValid()); + return PxBounds3::centerExtents(mHullData.mAABB.mCenter, mHullData.mAABB.mExtents); +} + +const PxReal* ConvexMesh::getSDF() const +{ + if(mSdfData) + return mSdfData->mSdf; + + return NULL; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.h new file mode 100644 index 0000000..a3504b6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMesh.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONVEX_MESH_H +#define GU_CONVEX_MESH_H + +#include "foundation/PxBitAndData.h" +#include "common/PxMetaData.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "foundation/PxUserAllocated.h" +#include "CmRefCountable.h" +#include "common/PxRenderOutput.h" +#include "GuConvexMeshData.h" + +namespace physx +{ +class BigConvexData; + +namespace Gu +{ + class MeshFactory; + struct HullPolygonData; + + PX_INLINE PxU32 computeBufferSize(const Gu::ConvexHullData& data, PxU32 nb) + { + PxU32 bytesNeeded = sizeof(Gu::HullPolygonData) * data.mNbPolygons; + bytesNeeded += sizeof(PxVec3) * data.mNbHullVertices; + bytesNeeded += sizeof(PxU8) * data.mNbEdges * 2; // mFacesByEdges8 + bytesNeeded += sizeof(PxU8) * data.mNbHullVertices * 3; // mFacesByVertices8; + bytesNeeded += data.mNbEdges.isBitSet() ? (sizeof(PxU16) * data.mNbEdges * 2) : 0; // mEdges; + bytesNeeded += sizeof(PxU8) * nb; // mVertexData8 + + //4 align the whole thing! + const PxU32 mod = bytesNeeded % sizeof(PxReal); + if (mod) + bytesNeeded += sizeof(PxReal) - mod; + return bytesNeeded; + } + + struct ConvexHullInitData + { + ConvexHullData mHullData; + PxU32 mNb; + PxReal mMass; + PxMat33 mInertia; + BigConvexData* mBigConvexData; + SDF* mSdfData; + }; + + // 0: includes raycast map + // 1: discarded raycast map + // 2: support map not always there + // 3: support stackless trees for non-recursive collision queries + // 4: no more opcode model + // 5: valencies table and gauss map combined, only exported over a vertex count treshold that depends on the platform cooked for. + // 6: removed support for edgeData16. + // 7: removed support for edge8Data. + // 8: removed support for triangles. + // 9: removed local sphere. + //10: removed geometric center. + //11: removed mFlags, and mERef16 from Poly; nbVerts is just a byte. + //12: removed explicit minimum, maximum from Poly + //13: internal objects + //14: SDF + #define PX_CONVEX_VERSION 14 + + class ConvexMesh : public PxConvexMesh, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + ConvexMesh(PxBaseFlags baseFlags) : PxConvexMesh(baseFlags), mHullData(PxEmpty), mNb(PxEmpty) + { + mNb.setBit(); + } + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + virtual void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); + PX_PHYSX_COMMON_API static ConvexMesh* createObject(PxU8*& address, PxDeserializationContext& context); + PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); + void resolveReferences(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&){} + //~PX_SERIALIZATION + ConvexMesh(MeshFactory* factory); + + ConvexMesh(MeshFactory* factory, ConvexHullInitData& data); + + bool load(PxInputStream& stream); + + // PxBase + virtual void onRefCountZero(); + //~PxBase + + // PxRefCounted + virtual PxU32 getReferenceCount() const; + virtual void acquireReference(); + //~PxRefCounted + + // PxConvexMesh + virtual void release(); + virtual PxU32 getNbVertices() const { return mHullData.mNbHullVertices; } + virtual const PxVec3* getVertices() const { return mHullData.getHullVertices(); } + virtual const PxU8* getIndexBuffer() const { return mHullData.getVertexData8(); } + virtual PxU32 getNbPolygons() const { return mHullData.mNbPolygons; } + virtual bool getPolygonData(PxU32 i, PxHullPolygon& data) const; + virtual bool isGpuCompatible() const; + + virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const; + virtual PxBounds3 getLocalBounds() const; + virtual const PxReal* getSDF() const; + + //~PxConvexMesh + + PX_FORCE_INLINE PxU32 getNbVerts() const { return mHullData.mNbHullVertices; } + PX_FORCE_INLINE const PxVec3* getVerts() const { return mHullData.getHullVertices(); } + PX_FORCE_INLINE PxU32 getNbPolygonsFast() const { return mHullData.mNbPolygons; } + PX_FORCE_INLINE const HullPolygonData& getPolygon(PxU32 i) const { return mHullData.mPolygons[i]; } + PX_FORCE_INLINE const HullPolygonData* getPolygons() const { return mHullData.mPolygons; } + PX_FORCE_INLINE PxU32 getNbEdges() const { return mHullData.mNbEdges; } + + PX_FORCE_INLINE const ConvexHullData& getHull() const { return mHullData; } + PX_FORCE_INLINE ConvexHullData& getHull() { return mHullData; } + PX_FORCE_INLINE const CenterExtents& getLocalBoundsFast() const { return mHullData.mAABB; } + PX_FORCE_INLINE PxReal getMass() const { return mMass; } + PX_FORCE_INLINE void setMass(PxReal mass) { mMass = mass; } + PX_FORCE_INLINE const PxMat33& getInertia() const { return mInertia; } + PX_FORCE_INLINE void setInertia(const PxMat33& inertia) { mInertia = inertia; } + + PX_FORCE_INLINE BigConvexData* getBigConvexData() const { return mBigConvexData; } + PX_FORCE_INLINE void setBigConvexData(BigConvexData* bcd) { mBigConvexData = bcd; } + + PX_FORCE_INLINE PxU32 getBufferSize() const { return computeBufferSize(mHullData, getNb()); } + + virtual ~ConvexMesh(); + + PX_FORCE_INLINE void setMeshFactory(MeshFactory* f) { mMeshFactory = f; } + PX_FORCE_INLINE void setNb(PxU32 nb) { mNb = nb; } + + protected: + ConvexHullData mHullData; + PxBitAndDword mNb; // ### PT: added for serialization. Try to remove later? + + SDF* mSdfData; + BigConvexData* mBigConvexData; //!< optional, only for large meshes! PT: redundant with ptr in chull data? Could also be end of other buffer + PxReal mMass; //this is mass assuming a unit density that can be scaled by instances! + PxMat33 mInertia; //in local space of mesh! + private: + MeshFactory* mMeshFactory; // PT: changed to pointer for serialization + + PX_FORCE_INLINE PxU32 getNb() const { return mNb; } + PX_FORCE_INLINE PxU32 ownsMemory() const { return PxU32(!mNb.isBitSet()); } + }; + + PX_FORCE_INLINE const Gu::ConvexHullData* _getHullData(const PxConvexMeshGeometry& convexGeom) + { + return &static_cast(convexGeom.convexMesh)->getHull(); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMeshData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMeshData.h new file mode 100644 index 0000000..388a03b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexMeshData.h @@ -0,0 +1,219 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONVEX_MESH_DATA_H +#define GU_CONVEX_MESH_DATA_H + +#include "foundation/PxPlane.h" +#include "foundation/PxBitAndData.h" + +#include "foundation/PxIntrinsics.h" +#include "GuCenterExtents.h" +#include "CmSerialize.h" +#include "GuSDF.h" + +// Data definition + +namespace physx +{ +namespace Gu +{ + struct BigConvexRawData; + + struct HullPolygonData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + // PT: this structure won't be allocated with PX_NEW because polygons aren't allocated alone (with a dedicated alloc). + // Instead they are part of a unique allocation/buffer containing all data for the ConvexHullData class (polygons, followed by + // hull vertices, edge data, etc). As a result, ctors for embedded classes like PxPlane won't be called. + + PxPlane mPlane; //!< Plane equation for this polygon //Could drop 4th elem as it can be computed from any vertex as: d = - p.dot(n); + PxU16 mVRef8; //!< Offset of vertex references in hull vertex data (CS: can we assume indices are tightly packed and offsets are ascending?? DrawObjects makes and uses this assumption) + PxU8 mNbVerts; //!< Number of vertices/edges in the polygon + PxU8 mMinIndex; //!< Index of the polygon vertex that has minimal projection along this plane's normal. + + PX_FORCE_INLINE PxReal getMin(const PxVec3* PX_RESTRICT hullVertices) const //minimum of projection of the hull along this plane normal + { + return mPlane.n.dot(hullVertices[mMinIndex]); + } + + PX_FORCE_INLINE PxReal getMax() const { return -mPlane.d; } //maximum of projection of the hull along this plane normal + }; + + PX_FORCE_INLINE void flipData(Gu::HullPolygonData& data) + { + flip(data.mPlane.n.x); + flip(data.mPlane.n.y); + flip(data.mPlane.n.z); + flip(data.mPlane.d); + flip(data.mVRef8); + } + // PT: if this one breaks, please make sure the 'flipData' function is properly updated. + PX_COMPILE_TIME_ASSERT(sizeof(Gu::HullPolygonData) == 20); + +// TEST_INTERNAL_OBJECTS + struct InternalObjectsData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + PxReal mRadius; + PxReal mExtents[3]; + + PX_FORCE_INLINE void reset() + { + mRadius = 0.0f; + mExtents[0] = 0.0f; + mExtents[1] = 0.0f; + mExtents[2] = 0.0f; + } + }; + PX_COMPILE_TIME_ASSERT(sizeof(Gu::InternalObjectsData) == 16); +//~TEST_INTERNAL_OBJECTS + + struct ConvexHullData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + // PT: WARNING: bounds must be followed by at least 32bits of data for safe SIMD loading + CenterExtents mAABB; //!< bounds TODO: compute this on the fly from first 6 vertices in the vertex array. We'll of course need to sort the most extreme ones to the front. + PxVec3 mCenterOfMass; //in local space of mesh! + + // PT: WARNING: mNbHullVertices *must* appear before mBigConvexRawData for ConvX to be able to do "big raw data" surgery + + PxBitAndWord mNbEdges; //!(mAABB); + } + + PX_FORCE_INLINE const PxVec3* getHullVertices() const //!< Convex hull vertices + { + const char* tmp = reinterpret_cast(mPolygons); + tmp += sizeof(Gu::HullPolygonData) * mNbPolygons; + return reinterpret_cast(tmp); + } + + PX_FORCE_INLINE const PxU8* getFacesByEdges8() const //!< for each edge, gives 2 adjacent polygons; used by convex-convex code to come up with all the convex' edge normals. + { + const char* tmp = reinterpret_cast(mPolygons); + tmp += sizeof(Gu::HullPolygonData) * mNbPolygons; + tmp += sizeof(PxVec3) * mNbHullVertices; + return reinterpret_cast(tmp); + } + + PX_FORCE_INLINE const PxU8* getFacesByVertices8() const //!< for each edge, gives 2 adjacent polygons; used by convex-convex code to come up with all the convex' edge normals. + { + const char* tmp = reinterpret_cast(mPolygons); + tmp += sizeof(Gu::HullPolygonData) * mNbPolygons; + tmp += sizeof(PxVec3) * mNbHullVertices; + tmp += sizeof(PxU8) * mNbEdges * 2; + return reinterpret_cast(tmp); + } + + //If we don't build the convex hull with grb data, we will return NULL pointer + PX_FORCE_INLINE const PxU16* getVerticesByEdges16() const //!< Vertex indices indexed by unique edges + { + if (mNbEdges.isBitSet()) + { + const char* tmp = reinterpret_cast(mPolygons); + tmp += sizeof(Gu::HullPolygonData) * mNbPolygons; + tmp += sizeof(PxVec3) * mNbHullVertices; + tmp += sizeof(PxU8) * mNbEdges * 2; + tmp += sizeof(PxU8) * mNbHullVertices * 3; + return reinterpret_cast(tmp); + } + return NULL; + } + + PX_FORCE_INLINE const PxU8* getVertexData8() const //!< Vertex indices indexed by hull polygons + { + const char* tmp = reinterpret_cast(mPolygons); + tmp += sizeof(Gu::HullPolygonData) * mNbPolygons; + tmp += sizeof(PxVec3) * mNbHullVertices; + tmp += sizeof(PxU8) * mNbEdges * 2; + tmp += sizeof(PxU8) * mNbHullVertices * 3; + if (mNbEdges.isBitSet()) + tmp += sizeof(PxU16) * mNbEdges * 2; + return reinterpret_cast(tmp); + } + + }; + #if PX_P64_FAMILY + PX_COMPILE_TIME_ASSERT(sizeof(Gu::ConvexHullData) == 80); + #else + PX_COMPILE_TIME_ASSERT(sizeof(Gu::ConvexHullData) == 68); + #endif + + // PT: 'getPaddedBounds()' is only safe if we make sure the bounds member is followed by at least 32bits of data + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(Gu::ConvexHullData, mCenterOfMass)>=PX_OFFSET_OF(Gu::ConvexHullData, mAABB)+4); + +} // namespace Gu + +} + +//#pragma PX_POP_PACK + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp new file mode 100644 index 0000000..325ced8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.cpp @@ -0,0 +1,43 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuVecBox.h" + +namespace physx +{ + const aos::BoolV boxVertexTable[8] = { + aos::BFFFF(),//--- + aos::BTFFF(),//+-- + aos::BFTFF(),//-+- + aos::BTTFF(),//++- + aos::BFFTF(),//--+ + aos::BTFTF(),//+-+ + aos::BFTTF(),//-++ + aos::BTTTF(),//+++ + }; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.h new file mode 100644 index 0000000..5bcb109 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexSupportTable.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONVEX_SUPPORT_TABLE_H +#define GU_CONVEX_SUPPORT_TABLE_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuVecConvex.h" +#include "foundation/PxVecTransform.h" + +namespace physx +{ +namespace Gu +{ + + class TriangleV; + class CapsuleV; + class BoxV; + class ConvexHullV; + class ConvexHullNoScaleV; + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + class SupportLocal + { + public: + aos::Vec3V shapeSpaceCenterOfMass; + const aos::PxTransformV& transform; + const aos::Mat33V& vertex2Shape; + const aos::Mat33V& shape2Vertex; + const bool isIdentityScale; + + SupportLocal(const aos::PxTransformV& _transform, const aos::Mat33V& _vertex2Shape, const aos::Mat33V& _shape2Vertex, const bool _isIdentityScale = true): transform(_transform), + vertex2Shape(_vertex2Shape), shape2Vertex(_shape2Vertex), isIdentityScale(_isIdentityScale) + { + } + + PX_FORCE_INLINE void setShapeSpaceCenterofMass(const aos::Vec3VArg _shapeSpaceCenterOfMass) + { + shapeSpaceCenterOfMass = _shapeSpaceCenterOfMass; + } + virtual ~SupportLocal() {} + virtual aos::Vec3V doSupport(const aos::Vec3VArg dir) const = 0; + virtual void doSupport(const aos::Vec3VArg dir, aos::FloatV& min, aos::FloatV& max) const = 0; + virtual void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* verts)const = 0; + + protected: + SupportLocal& operator=(const SupportLocal&); + }; +#if PX_VC + #pragma warning(pop) +#endif + + template + class SupportLocalImpl : public SupportLocal + { + + public: + const Convex& conv; + SupportLocalImpl(const Convex& _conv, const aos::PxTransformV& _transform, const aos::Mat33V& _vertex2Shape, const aos::Mat33V& _shape2Vertex, const bool _isIdentityScale = true) : + SupportLocal(_transform, _vertex2Shape, _shape2Vertex, _isIdentityScale), conv(_conv) + { + } + + aos::Vec3V doSupport(const aos::Vec3VArg dir) const + { + //return conv.supportVertsLocal(dir); + return conv.supportLocal(dir); + } + + void doSupport(const aos::Vec3VArg dir, aos::FloatV& min, aos::FloatV& max) const + { + return conv.supportLocal(dir, min, max); + } + + void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* verts) const + { + conv.populateVerts(inds, numInds, originalVerts, verts); + } + + protected: + SupportLocalImpl& operator=(const SupportLocalImpl&); + + }; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp new file mode 100644 index 0000000..241a625 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.cpp @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "GuConvexUtilsInternal.h" +#include "GuBoxConversion.h" +#include "GuConvexMesh.h" +#include "CmScaling.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +void Gu::computeHullOBB(Box& hullOBB, const PxBounds3& hullAABB, float offset, + const PxMat34& convexPose, + const PxMat34& meshPose, const FastVertex2ShapeScaling& meshScaling, bool idtScaleMesh) +{ + // transform bounds = mesh space + const PxMat34 m0to1 = meshPose.transformTranspose(convexPose); + + hullOBB.extents = hullAABB.getExtents() + PxVec3(offset); + hullOBB.center = m0to1.transform(hullAABB.getCenter()); + hullOBB.rot = m0to1.m; + + if(!idtScaleMesh) + meshScaling.transformQueryBounds(hullOBB.center, hullOBB.extents, hullOBB.rot); +} + +void Gu::computeVertexSpaceOBB(Box& dst, const Box& src, const PxTransform& meshPose, const PxMeshScale& meshScale) +{ + // AP scaffold failure in x64 debug in GuConvexUtilsInternal.cpp + //PX_ASSERT("Performance warning - this path shouldn't execute for identity mesh scale." && !meshScale.isIdentity()); + + dst = transform(meshScale.getInverse() * Matrix34FromTransform(meshPose.getInverse()), src); +} + +void Gu::computeOBBAroundConvex( + Box& obb, const PxConvexMeshGeometry& convexGeom, const PxConvexMesh* cm, const PxTransform& convexPose) +{ + const CenterExtents& aabb = static_cast(cm)->getLocalBoundsFast(); + + if(convexGeom.scale.isIdentity()) + { + const PxMat33Padded m(convexPose.q); + obb = Gu::Box(m.transform(aabb.mCenter) + convexPose.p, aabb.mExtents, m); + } + else + { + obb = transform(Matrix34FromTransform(convexPose) * toMat33(convexGeom.scale), Box(aabb.mCenter, aabb.mExtents, PxMat33(PxIdentity))); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.h new file mode 100644 index 0000000..4beadf5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuConvexUtilsInternal.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CONVEX_UTILS_INTERNALS_H +#define GU_CONVEX_UTILS_INTERNALS_H + +#include "foundation/Px.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +class PxMeshScale; +class PxConvexMeshGeometry; +class PxConvexMesh; + +namespace Cm +{ + class FastVertex2ShapeScaling; +} + +namespace Gu +{ + class Box; + + void computeHullOBB( + Gu::Box& hullOBB, const PxBounds3& hullAABB, float offset, const PxMat34& world0, + const PxMat34& world1, const Cm::FastVertex2ShapeScaling& meshScaling, bool idtScaleMesh); + + // src = input + // computes a box in vertex space (including skewed scale) from src world box + void computeVertexSpaceOBB(Gu::Box& dst, const Gu::Box& src, const PxTransform& meshPose, const PxMeshScale& meshScale); + + PX_PHYSX_COMMON_API void computeOBBAroundConvex( + Gu::Box& obb, const PxConvexMeshGeometry& convexGeom, const PxConvexMesh* cm, const PxTransform& convexPose); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuCubeIndex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuCubeIndex.h new file mode 100644 index 0000000..4b44284 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuCubeIndex.h @@ -0,0 +1,153 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_CUBE_INDEX_H +#define GU_CUBE_INDEX_H + +#include "foundation/PxVec3.h" +#include "foundation/PxFPU.h" + +namespace physx +{ + + enum CubeIndex + { + CUBE_RIGHT, + CUBE_LEFT, + CUBE_TOP, + CUBE_BOTTOM, + CUBE_FRONT, + CUBE_BACK, + + CUBE_FORCE_DWORD = 0x7fffffff + }; + + /* + It's pretty straightforwards in concept (though the execution in hardware is + a bit crufty and complex). You use a 3D texture coord to look up a texel in + a cube map. First you find which of the axis has the largest value (i.e. + X,Y,Z), and then the sign of that axis decides which face you are going to + use. Which is why the faces are called +X, -X, +Y, -Y, +Z, -Z - after their + principle axis. Then you scale the vector so that the largest value is +/-1. + Then use the other two as 2D coords to look up your texel (with a 0.5 scale + & offset). + + For example, vector (0.4, -0.2, -0.5). Largest value is the Z axis, and it's + -ve, so we're reading from the -Z map. Scale so that this Z axis is +/-1, + and you get the vector (0.8, -0.4, -1.0). So now use the other two values to + look up your texel. So we look up texel (0.8, -0.4). The scale & offset move + the -1->+1 range into the usual 0->1 UV range, so we actually look up texel + (0.9, 0.3). The filtering is extremely complex, especially where three maps + meet, but that's a hardware problem :-) + */ + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /** + * Cubemap lookup function. + * + * To transform returned uvs into mapping coordinates : + * u += 1.0f; u *= 0.5f; + * v += 1.0f; v *= 0.5f; + * + * \fn CubemapLookup(const PxVec3& direction, float& u, float& v) + * \param direction [in] a direction vector + * \param u [out] impact coordinate on the unit cube, in [-1,1] + * \param v [out] impact coordinate on the unit cube, in [-1,1] + * \return cubemap texture index + */ + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + PX_INLINE CubeIndex CubemapLookup(const PxVec3& direction, float& u, float& v); + + PX_INLINE PxU32 ComputeCubemapOffset(const PxVec3& dir, PxU32 subdiv) + { + float u,v; + const CubeIndex CI = CubemapLookup(dir, u, v); + + // Remap to [0, subdiv[ + const float Coeff = 0.5f * float(subdiv-1); + u += 1.0f; u *= Coeff; + v += 1.0f; v *= Coeff; + + // Compute offset + return PxU32(CI)*(subdiv*subdiv) + PxU32(u)*subdiv + PxU32(v); + } + + + PX_INLINE PxU32 ComputeCubemapNearestOffset(const PxVec3& dir, PxU32 subdiv) + { + float u,v; + const CubeIndex CI = CubemapLookup(dir, u, v); + + // Remap to [0, subdiv] + const float Coeff = 0.5f * float(subdiv-1); + u += 1.0f; u *= Coeff; + v += 1.0f; v *= Coeff; + + // Compute offset + return PxU32(CI)*(subdiv*subdiv) + PxU32(u + 0.5f)*subdiv + PxU32(v + 0.5f); + } + + + PX_INLINE CubeIndex CubemapLookup(const PxVec3& direction, float& u, float& v) + { + const PxU32* binary = reinterpret_cast(&direction.x); + + const PxU32 absPx = binary[0] & ~PX_SIGN_BITMASK; + const PxU32 absNy = binary[1] & ~PX_SIGN_BITMASK; + const PxU32 absNz = binary[2] & ~PX_SIGN_BITMASK; + + PxU32 Index1 = 0; //x biggest axis + PxU32 Index2 = 1; + PxU32 Index3 = 2; + if( (absNy > absPx) & (absNy > absNz)) + { + //y biggest + Index2 = 2; + Index3 = 0; + Index1 = 1; + } + else if(absNz > absPx) + { + //z biggest + Index2 = 0; + Index3 = 1; + Index1 = 2; + } + + const PxF32* data = &direction.x; + const float Coeff = 1.0f / fabsf(data[Index1]); + u = data[Index2] * Coeff; + v = data[Index3] * Coeff; + + const PxU32 Sign = binary[Index1]>>31; + return CubeIndex(Sign|(Index1+Index1)); + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp new file mode 100644 index 0000000..e7eee38 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.cpp @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "foundation/PxAssert.h" +#include "foundation/PxUserAllocated.h" +#include "GuHillClimbing.h" +#include "GuBigConvexData2.h" + +namespace physx +{ + +void localSearch(PxU32& id, const PxVec3& dir, const PxVec3* verts, const Gu::BigConvexRawData* val) +{ + // WARNING: there is a problem on x86 with a naive version of this code, where truncation + // of values from 80 bits to 32 bits as they're stored in memory means that iteratively moving to + // an adjacent vertex of greater support can go into an infinite loop. So we use a version which + // never visits a vertex twice. Note - this might not be enough for GJK, since local + // termination of the support function might not be enough to ensure convergence of GJK itself. + + // if we got here, we'd better have vertices and valencies + PX_ASSERT(verts && val); + + class TinyBitMap + { + public: + PxU32 m[8]; + PX_FORCE_INLINE TinyBitMap() { m[0] = m[1] = m[2] = m[3] = m[4] = m[5] = m[6] = m[7] = 0; } + PX_FORCE_INLINE void set(PxU8 v) { m[v>>5] |= 1<<(v&31); } + PX_FORCE_INLINE bool get(PxU8 v) const { return (m[v>>5] & 1<<(v&31)) != 0; } + }; + + TinyBitMap visited; + + const Gu::Valency* Valencies = val->mValencies; + const PxU8* Adj = val->mAdjacentVerts; + + PX_ASSERT(Valencies && Adj); + + // Get the initial value and the initial vertex + float MaxVal = dir.dot(verts[id]); + PxU32 NextVtx = id; + + do + { + PxU16 NbNeighbors = Valencies[NextVtx].mCount; + const PxU8* Run = Adj + Valencies[NextVtx].mOffset; + id = NextVtx; + while(NbNeighbors--) + { + const PxU8 Neighbor = *Run++; + + if(!visited.get(Neighbor)) + { + visited.set(Neighbor); + + const float CurVal = dir.dot(verts[Neighbor]); + + if(CurVal>MaxVal) + { + MaxVal = CurVal; + NextVtx = Neighbor; + } + } + } + } while(NextVtx!=id); +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.h new file mode 100644 index 0000000..ea0e8c6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuHillClimbing.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_HILL_CLIMBING_H +#define GU_HILL_CLIMBING_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ + namespace Gu + { + struct BigConvexRawData; + } + + void localSearch(PxU32& id, const PxVec3& dir, const PxVec3* verts, const Gu::BigConvexRawData* val); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp new file mode 100644 index 0000000..ef3b583 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.cpp @@ -0,0 +1,515 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuShapeConvex.h" +#include "GuBigConvexData.h" +#include "GuEdgeList.h" +#include "GuInternal.h" + +#include "foundation/PxMat34.h" +#include "GuHillClimbing.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Gu; + +static PX_FORCE_INLINE PxU32 selectClosestPolygon(PxReal& maxDp_, PxU32 numPolygons, const Gu::HullPolygonData* polys, const PxVec3& axis) +{ + float maxDp = polys[0].mPlane.n.dot(axis); + PxU32 closest = 0; + + // Loop through polygons + for(PxU32 i=1; i maxDp) + { + maxDp = dp; + closest = i; + } + } + maxDp_ = maxDp; + return closest; +} + +static PxU32 SelectClosestEdgeCB_Convex(const PolygonalData& data, const Cm::FastVertex2ShapeScaling& scaling, const PxVec3& localSpaceDirection) +{ + //vertex1TOShape1Skew is a symmetric matrix. + //it has the property that (vertex1TOShape1Skew * v)|localSpaceDirection == (vertex1TOShape1Skew * localSpaceDirection)|v + const PxVec3 vertexSpaceDirection = scaling * localSpaceDirection; + + const Gu::HullPolygonData* PX_RESTRICT polys = data.mPolygons; + + PxReal maxDp; + // ##might not be needed + PxU32 closest = ::selectClosestPolygon(maxDp, data.mNbPolygons, polys, vertexSpaceDirection); + + // Since the convex is closed, at least some poly must satisfy this + PX_ASSERT(maxDp>=0); + + const PxU32 numEdges = data.mNbEdges; + const PxU8* const edgeToFace = data.mFacesByEdges; + + //Loop through edges + PxU32 closestEdge = 0xffffffff; + PxReal maxDpSq = maxDp * maxDp; + for(PxU32 i=0; i < numEdges; i++) + { + const PxU8 f0 = edgeToFace[i*2]; + const PxU8 f1 = edgeToFace[i*2+1]; + + // unnormalized edge normal + const PxVec3 edgeNormal = polys[f0].mPlane.n + polys[f1].mPlane.n; + const PxReal enMagSq = edgeNormal.magnitudeSquared(); + //Test normal of current edge - squared test is valid if dp and maxDp both >= 0 + const float dp = edgeNormal.dot(vertexSpaceDirection); + if(dp>=0.0f && dp*dp>maxDpSq*enMagSq) + { + maxDpSq = dp*dp/enMagSq; + closestEdge = i; + } + } + + if(closestEdge!=0xffffffff) + { + const PxU8* FBE = edgeToFace; + + const PxU32 f0 = FBE[closestEdge*2]; + const PxU32 f1 = FBE[closestEdge*2+1]; + + const PxReal dp0 = polys[f0].mPlane.n.dot(vertexSpaceDirection); + const PxReal dp1 = polys[f1].mPlane.n.dot(vertexSpaceDirection); + if(dp0>dp1) + closest = f0; + else + closest = f1; + } + return closest; +} + +// Hull projection callback for "small" hulls +static void HullProjectionCB_SmallConvex(const PolygonalData& data, const PxVec3& dir, + const PxMat34& world, + const Cm::FastVertex2ShapeScaling& scaling, + PxReal& min, PxReal& max) +{ + const PxVec3 localSpaceDirection = world.rotateTranspose(dir); + //vertex1TOShape1Skew is a symmetric matrix. + //it has the property that (vertex1TOShape1Skew * v)|localSpaceDirection == (vertex1TOShape1Skew * localSpaceDirection)|v + const PxVec3 vertexSpaceDirection = scaling * localSpaceDirection; + + // PT: prevents aliasing + PxReal minimum = PX_MAX_REAL; + PxReal maximum = -PX_MAX_REAL; + + //brute-force, localspace + { + const PxVec3* PX_RESTRICT verts = data.mVerts; + PxU32 numVerts = data.mNbVerts; + while(numVerts--) + { + const PxReal dp = (*verts++).dot(vertexSpaceDirection); + minimum = physx::intrinsics::selectMin(minimum, dp); + maximum = physx::intrinsics::selectMax(maximum, dp); + } + + } + + const PxReal offset = world.p.dot(dir); + min = minimum + offset; + max = maximum + offset; +} + +static PxU32 computeNearestOffset(const PxU32 subdiv, const PxVec3& dir) +{ + // ComputeCubemapNearestOffset(const Point& dir, udword subdiv) + + // PT: ok so why exactly was the code duplicated here? + // PxU32 CI = CubemapLookup(dir,u,v) + + PxU32 index; + PxReal coeff; + // find largest axis + PxReal absNx = PxAbs(dir.x); + PxReal absNy = PxAbs(dir.y); + PxReal absNz = PxAbs(dir.z); + + if( absNy > absNx && + absNy > absNz) + { + //y biggest + index = 1; + coeff = 1.0f/absNy; + } + else if(absNz > absNx) + { + index = 2; + coeff = 1.0f/absNz; + } + else + { + index = 0; + coeff = 1.0f/absNx; + } + + union + { + PxU32 aU32; + PxReal aFloat; + } conv; + + conv.aFloat = dir[index]; + PxU32 sign = conv.aU32>>31; + + const PxU32 index2 = PxGetNextIndex3(index); + const PxU32 index3 = PxGetNextIndex3(index2); + PxReal u = dir[index2] * coeff; + PxReal v = dir[index3] * coeff; + + PxU32 CI = (sign | (index+index)); + + //Remap to [0, subdiv[ + coeff = 0.5f * PxReal(subdiv-1); + u += 1.0f; u *= coeff; + v += 1.0f; v *= coeff; + + //Round to nearest + PxU32 ui = PxU32(u); + PxU32 vi = PxU32(v); + + PxReal du = u - PxReal(ui); + PxReal dv = v - PxReal(vi); + if(du>0.5f) ui++; + if(dv>0.5f) vi++; + + //Compute offset + return CI*(subdiv*subdiv) + ui*subdiv + vi; +} + +// Hull projection callback for "big" hulls +static void HullProjectionCB_BigConvex(const PolygonalData& data, const PxVec3& dir, const PxMat34& world, const Cm::FastVertex2ShapeScaling& scaling, PxReal& minimum, PxReal& maximum) +{ + const PxVec3* PX_RESTRICT verts = data.mVerts; + + const PxVec3 localSpaceDirection = world.rotateTranspose(dir); + //vertex1TOShape1Skew is a symmetric matrix. + //it has the property that (vertex1TOShape1Skew * v)|localSpaceDirection == (vertex1TOShape1Skew * localSpaceDirection)|v + const PxVec3 vertexSpaceDirection = scaling * localSpaceDirection; //NB: triangles are always shape 1! eek! + + // This version is better for objects with a lot of vertices + const Gu::BigConvexRawData* bigData = data.mBigData; + PxU32 minID = 0, maxID = 0; + { + const PxU32 offset = computeNearestOffset(bigData->mSubdiv, -vertexSpaceDirection); + minID = bigData->mSamples[offset]; + maxID = bigData->getSamples2()[offset]; + } + + // Do hillclimbing! + localSearch(minID, -vertexSpaceDirection, verts, bigData); + localSearch(maxID, vertexSpaceDirection, verts, bigData); + + const PxReal offset = world.p.dot(dir); + minimum = offset + verts[minID].dot(vertexSpaceDirection); + maximum = offset + verts[maxID].dot(vertexSpaceDirection); + PX_ASSERT(maximum >= minimum); +} + +void Gu::getPolygonalData_Convex(PolygonalData* PX_RESTRICT dst, const Gu::ConvexHullData* PX_RESTRICT src, const Cm::FastVertex2ShapeScaling& scaling) +{ + dst->mCenter = scaling * src->mCenterOfMass; + dst->mNbVerts = src->mNbHullVertices; + dst->mNbPolygons = src->mNbPolygons; + dst->mNbEdges = src->mNbEdges; + dst->mPolygons = src->mPolygons; + dst->mVerts = src->getHullVertices(); + dst->mPolygonVertexRefs = src->getVertexData8(); + dst->mFacesByEdges = src->getFacesByEdges8(); + +// TEST_INTERNAL_OBJECTS + dst->mInternal = src->mInternal; +//~TEST_INTERNAL_OBJECTS + + dst->mBigData = src->mBigConvexRawData; + + // This threshold test doesnt cost much and many customers cook on PC and use this on 360. + // 360 has a much higher threshold than PC(and it makes a big difference) + // PT: the cool thing is that this test is now done once by contact generation call, not once by hull projection + if(!src->mBigConvexRawData) + dst->mProjectHull = HullProjectionCB_SmallConvex; + else + dst->mProjectHull = HullProjectionCB_BigConvex; + dst->mSelectClosestEdgeCB = SelectClosestEdgeCB_Convex; +} + +// Box emulating convex mesh + +// Face0: 0-1-2-3 +// Face1: 1-5-6-2 +// Face2: 5-4-7-6 +// Face3: 4-0-3-7 +// Face4; 3-2-6-7 +// Face5: 4-5-1-0 + +// 7+------+6 0 = --- +// /| /| 1 = +-- +// / | / | 2 = ++- +// / 4+---/--+5 3 = -+- +// 3+------+2 / y z 4 = --+ +// | / | / | / 5 = +-+ +// |/ |/ |/ 6 = +++ +// 0+------+1 *---x 7 = -++ + +static const PxU8 gPxcBoxPolygonData[] = { + 0, 1, 2, 3, + 1, 5, 6, 2, + 5, 4, 7, 6, + 4, 0, 3, 7, + 3, 2, 6, 7, + 4, 5, 1, 0, +}; + +#define INVSQRT2 0.707106781188f //!< 1 / sqrt(2) +static PxVec3 gPxcBoxEdgeNormals[] = +{ + PxVec3(0, -INVSQRT2, -INVSQRT2), // 0-1 + PxVec3(INVSQRT2, 0, -INVSQRT2), // 1-2 + PxVec3(0, INVSQRT2, -INVSQRT2), // 2-3 + PxVec3(-INVSQRT2, 0, -INVSQRT2), // 3-0 + + PxVec3(0, INVSQRT2, INVSQRT2), // 7-6 + PxVec3(INVSQRT2, 0, INVSQRT2), // 6-5 + PxVec3(0, -INVSQRT2, INVSQRT2), // 5-4 + PxVec3(-INVSQRT2, 0, INVSQRT2), // 4-7 + + PxVec3(INVSQRT2, -INVSQRT2, 0), // 1-5 + PxVec3(INVSQRT2, INVSQRT2, 0), // 6-2 + PxVec3(-INVSQRT2, INVSQRT2, 0), // 3-7 + PxVec3(-INVSQRT2, -INVSQRT2, 0) // 4-0 +}; +#undef INVSQRT2 + +// ### needs serious checkings + // Flags(16), Count(16), Offset(32); +static Gu::EdgeDescData gPxcBoxEdgeDesc[] = { + {Gu::PX_EDGE_ACTIVE, 2, 0}, + {Gu::PX_EDGE_ACTIVE, 2, 2}, + {Gu::PX_EDGE_ACTIVE, 2, 4}, + {Gu::PX_EDGE_ACTIVE, 2, 6}, + {Gu::PX_EDGE_ACTIVE, 2, 8}, + {Gu::PX_EDGE_ACTIVE, 2, 10}, + {Gu::PX_EDGE_ACTIVE, 2, 12}, + {Gu::PX_EDGE_ACTIVE, 2, 14}, + {Gu::PX_EDGE_ACTIVE, 2, 16}, + {Gu::PX_EDGE_ACTIVE, 2, 18}, + {Gu::PX_EDGE_ACTIVE, 2, 20}, + {Gu::PX_EDGE_ACTIVE, 2, 22}, +}; + +// ### needs serious checkings +static PxU8 gPxcBoxFaceByEdge[] = { + 0,5, // Edge 0-1 + 0,1, // Edge 1-2 + 0,4, // Edge 2-3 + 0,3, // Edge 3-0 + 2,4, // Edge 7-6 + 1,2, // Edge 6-5 + 2,5, // Edge 5-4 + 2,3, // Edge 4-7 + 1,5, // Edge 1-5 + 1,4, // Edge 6-2 + 3,4, // Edge 3-7 + 3,5, // Edge 4-0 +}; + +static PxU32 SelectClosestEdgeCB_Box(const PolygonalData& data, const Cm::FastVertex2ShapeScaling& scaling, const PxVec3& localDirection) +{ + PX_UNUSED(scaling); + + PxReal maxDp; + // ##might not be needed + PxU32 closest = ::selectClosestPolygon(maxDp, 6, data.mPolygons, localDirection); + + PxU32 numEdges = 12; + const PxVec3* PX_RESTRICT edgeNormals = gPxcBoxEdgeNormals; + + //Loop through edges + PxU32 closestEdge = 0xffffffff; + for(PxU32 i=0; i < numEdges; i++) + { + //Test normal of current edge + const float dp = edgeNormals[i].dot(localDirection); + if(dp>maxDp) + { + maxDp = dp; + closestEdge = i; + } + } + + if(closestEdge!=0xffffffff) + { + const Gu::EdgeDescData* PX_RESTRICT ED = gPxcBoxEdgeDesc; + const PxU8* PX_RESTRICT FBE = gPxcBoxFaceByEdge; + + PX_ASSERT(ED[closestEdge].Count==2); + const PxU32 f0 = FBE[ED[closestEdge].Offset]; + const PxU32 f1 = FBE[ED[closestEdge].Offset+1]; + + const PxReal dp0 = data.mPolygons[f0].mPlane.n.dot(localDirection); + const PxReal dp1 = data.mPolygons[f1].mPlane.n.dot(localDirection); + if(dp0>dp1) + closest = f0; + else + closest = f1; + } + + return closest; +} + +static PX_FORCE_INLINE void projectBox(PxVec3& p, const PxVec3& localDir, const PxVec3& extents) +{ + // PT: the original code didn't have branches or FPU comparisons. Why rewrite it ? +// p.x = (localDir.x >= 0) ? extents.x : -extents.x; +// p.y = (localDir.y >= 0) ? extents.y : -extents.y; +// p.z = (localDir.z >= 0) ? extents.z : -extents.z; + p.x = physx::intrinsics::fsel(localDir.x, extents.x, -extents.x); + p.y = physx::intrinsics::fsel(localDir.y, extents.y, -extents.y); + p.z = physx::intrinsics::fsel(localDir.z, extents.z, -extents.z); +} + +static void HullProjectionCB_Box(const PolygonalData& data, const PxVec3& dir, const PxMat34& world, const Cm::FastVertex2ShapeScaling& scaling, PxReal& minimum, PxReal& maximum) +{ + PX_UNUSED(scaling); + + const PxVec3 localDir = world.rotateTranspose(dir); + + PxVec3 p; + projectBox(p, localDir, *data.mHalfSide); + + const PxReal offset = world.p.dot(dir); + const PxReal tmp = p.dot(localDir); + maximum = offset + tmp; + minimum = offset - tmp; +} + +PolygonalBox::PolygonalBox(const PxVec3& halfSide) : mHalfSide(halfSide) +{ + //Precompute the convex data + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + PxVec3 minimum = -mHalfSide; + PxVec3 maximum = mHalfSide; + // Generate 8 corners of the bbox + mVertices[0] = PxVec3(minimum.x, minimum.y, minimum.z); + mVertices[1] = PxVec3(maximum.x, minimum.y, minimum.z); + mVertices[2] = PxVec3(maximum.x, maximum.y, minimum.z); + mVertices[3] = PxVec3(minimum.x, maximum.y, minimum.z); + mVertices[4] = PxVec3(minimum.x, minimum.y, maximum.z); + mVertices[5] = PxVec3(maximum.x, minimum.y, maximum.z); + mVertices[6] = PxVec3(maximum.x, maximum.y, maximum.z); + mVertices[7] = PxVec3(minimum.x, maximum.y, maximum.z); + + //Setup the polygons + for(PxU8 i=0; i < 6; i++) + { + mPolygons[i].mNbVerts = 4; + mPolygons[i].mVRef8 = PxU16(i*4); + } + + // ### planes needs *very* careful checks + // X axis + mPolygons[1].mPlane.n = PxVec3(1.0f, 0.0f, 0.0f); + mPolygons[1].mPlane.d = -mHalfSide.x; + mPolygons[3].mPlane.n = PxVec3(-1.0f, 0.0f, 0.0f); + mPolygons[3].mPlane.d = -mHalfSide.x; + + mPolygons[1].mMinIndex = 0; + mPolygons[3].mMinIndex = 1; + +// mPolygons[1].mMinObsolete = -mHalfSide.x; +// mPolygons[3].mMinObsolete = -mHalfSide.x; + + PX_ASSERT(mPolygons[1].getMin(mVertices) == -mHalfSide.x); + PX_ASSERT(mPolygons[3].getMin(mVertices) == -mHalfSide.x); + + + // Y axis + mPolygons[4].mPlane.n = PxVec3(0.f, 1.0f, 0.0f); + mPolygons[4].mPlane.d = -mHalfSide.y; + mPolygons[5].mPlane.n = PxVec3(0.0f, -1.0f, 0.0f); + mPolygons[5].mPlane.d = -mHalfSide.y; + + mPolygons[4].mMinIndex = 0; + mPolygons[5].mMinIndex = 2; +// mPolygons[4].mMinObsolete = -mHalfSide.y; +// mPolygons[5].mMinObsolete = -mHalfSide.y; + + PX_ASSERT(mPolygons[4].getMin(mVertices) == -mHalfSide.y); + PX_ASSERT(mPolygons[5].getMin(mVertices) == -mHalfSide.y); + + // Z axis + mPolygons[2].mPlane.n = PxVec3(0.f, 0.0f, 1.0f); + mPolygons[2].mPlane.d = -mHalfSide.z; + mPolygons[0].mPlane.n = PxVec3(0.0f, 0.0f, -1.0f); + mPolygons[0].mPlane.d = -mHalfSide.z; + + mPolygons[2].mMinIndex = 0; + mPolygons[0].mMinIndex = 4; +// mPolygons[2].mMinObsolete = -mHalfSide.z; +// mPolygons[0].mMinObsolete = -mHalfSide.z; + PX_ASSERT(mPolygons[2].getMin(mVertices) == -mHalfSide.z); + PX_ASSERT(mPolygons[0].getMin(mVertices) == -mHalfSide.z); +} + +void PolygonalBox::getPolygonalData(PolygonalData* PX_RESTRICT dst) const +{ + dst->mCenter = PxVec3(0.0f, 0.0f, 0.0f); + dst->mNbVerts = 8; + dst->mNbPolygons = 6; + dst->mPolygons = mPolygons; + dst->mNbEdges = 0; + dst->mVerts = mVertices; + dst->mPolygonVertexRefs = gPxcBoxPolygonData; + dst->mFacesByEdges = NULL; + dst->mInternal.mRadius = 0.0f; + dst->mInternal.mExtents[0] = 0.0f; + dst->mInternal.mExtents[1] = 0.0f; + dst->mInternal.mExtents[2] = 0.0f; +// dst->mBigData = NULL; + dst->mHalfSide = &mHalfSide; + dst->mProjectHull = HullProjectionCB_Box; + dst->mSelectClosestEdgeCB = SelectClosestEdgeCB_Box; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.h new file mode 100644 index 0000000..dd92557 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/convex/GuShapeConvex.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SHAPECONVEX_H +#define GU_SHAPECONVEX_H + +#include "GuConvexMeshData.h" +#include "CmScaling.h" + +namespace physx +{ +namespace Gu +{ + struct PolygonalData; + typedef void (*HullPrefetchCB) (PxU32 numVerts, const PxVec3* PX_RESTRICT verts); + typedef void (*HullProjectionCB) (const PolygonalData& data, const PxVec3& dir, const PxMat34& world2hull, const Cm::FastVertex2ShapeScaling& scaling, PxReal& minimum, PxReal& maximum); + typedef PxU32 (*SelectClosestEdgeCB) (const PolygonalData& data, const Cm::FastVertex2ShapeScaling& scaling, const PxVec3& localDirection); + + struct PolygonalData + { + // Data + Gu::InternalObjectsData mInternal; + PxMeshScale mScale; + PxVec3 mCenter; + PxU32 mNbVerts; + PxU32 mNbPolygons; + PxU32 mNbEdges; + const Gu::HullPolygonData* mPolygons; + const PxVec3* mVerts; + const PxU8* mPolygonVertexRefs; + const PxU8* mFacesByEdges; + const PxU16* mVerticesByEdges; + + union + { + const Gu::BigConvexRawData* mBigData; // Only for big convexes + const PxVec3* mHalfSide; // Only for boxes + }; + + // Code + HullProjectionCB mProjectHull; + SelectClosestEdgeCB mSelectClosestEdgeCB; + + PX_FORCE_INLINE const PxU8* getPolygonVertexRefs(const Gu::HullPolygonData& poly) const + { + return mPolygonVertexRefs + poly.mVRef8; + } + }; + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + class PX_PHYSX_COMMON_API PolygonalBox + { + public: + PolygonalBox(const PxVec3& halfSide); + + void getPolygonalData(PolygonalData* PX_RESTRICT dst) const; + + const PxVec3& mHalfSide; + PxVec3 mVertices[8]; + Gu::HullPolygonData mPolygons[6]; + private: + PolygonalBox& operator=(const PolygonalBox&); + }; +#if PX_VC + #pragma warning(pop) +#endif + + void getPolygonalData_Convex(PolygonalData* PX_RESTRICT dst, const Gu::ConvexHullData* PX_RESTRICT src, const Cm::FastVertex2ShapeScaling& scaling); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp new file mode 100644 index 0000000..315e57f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBVH.cpp @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuCooking.h" +#include "GuBVH.h" +#include "foundation/PxFPU.h" +#include "cooking/PxBVHDesc.h" +#include "common/PxInsertionCallback.h" + +using namespace physx; +using namespace Gu; + +static bool buildBVH(const PxBVHDesc& desc, BVHData& data, const char* errorMessage) +{ + if(!desc.isValid()) + { +#if PX_CHECKED + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, errorMessage); +#else + PX_UNUSED(errorMessage); +#endif + return false; + } + + BVHBuildStrategy bs; + if(desc.buildStrategy==PxBVHBuildStrategy::eFAST) + bs = BVH_SPLATTER_POINTS; + else if(desc.buildStrategy==PxBVHBuildStrategy::eDEFAULT) + bs = BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER; + else //if(desc.buildStrategy==PxBVHBuildStrategy::eSAH) + bs = BVH_SAH; + + return data.build(desc.bounds.count, desc.bounds.data, desc.bounds.stride, desc.enlargement, desc.numPrimsPerLeaf, bs); +} + +bool immediateCooking::cookBVH(const PxBVHDesc& desc, PxOutputStream& stream) +{ + PX_FPU_GUARD; + + BVHData bvhData; + if(!buildBVH(desc, bvhData, "Cooking::cookBVH: user-provided BVH descriptor is invalid!")) + return false; + + return bvhData.save(stream, platformMismatch()); +} + +PxBVH* immediateCooking::createBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback) +{ + PX_FPU_GUARD; + + BVHData bvhData; + if(!buildBVH(desc, bvhData, "Cooking::createBVH: user-provided BVH descriptor is invalid!")) + return NULL; + + return static_cast(insertionCallback.buildObjectFromData(PxConcreteType::eBVH, &bvhData)); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp new file mode 100644 index 0000000..3d3fc25 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.cpp @@ -0,0 +1,350 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "cooking/PxCooking.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVecMath.h" + +#include "GuConvexMeshData.h" +#include "GuBigConvexData2.h" +#include "GuIntersectionRayPlane.h" + +#include "GuCookingBigConvexDataBuilder.h" + +#include "GuCookingConvexHullBuilder.h" + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +using namespace physx; +using namespace Gu; +using namespace aos; + +static const PxU32 gSupportVersion = 0; +static const PxU32 gVersion = 0; + +BigConvexDataBuilder::BigConvexDataBuilder(const Gu::ConvexHullData* hull, BigConvexData* gm, const PxVec3* hullVerts) : mHullVerts(hullVerts) +{ + mSVM = gm; + mHull = hull; +} + +BigConvexDataBuilder::~BigConvexDataBuilder() +{ +} + +bool BigConvexDataBuilder::initialize() +{ + mSVM->mData.mSamples = PX_ALLOCATE(PxU8, mSVM->mData.mNbSamples*2u, "mData.mSamples"); + +#if PX_DEBUG +// printf("SVM: %d bytes\n", mNbSamples*sizeof(PxU8)*2); +#endif + + return true; +} + +bool BigConvexDataBuilder::save(PxOutputStream& stream, bool platformMismatch) const +{ + // Export header + if(!Cm::WriteHeader('S', 'U', 'P', 'M', gSupportVersion, platformMismatch, stream)) + return false; + + // Export header + if(!Cm::WriteHeader('G', 'A', 'U', 'S', gVersion, platformMismatch, stream)) + return false; + + // Export basic info + writeDword(mSVM->mData.mSubdiv, platformMismatch, stream); // PT: could now write Word here + writeDword(mSVM->mData.mNbSamples, platformMismatch, stream); // PT: could now write Word here + + // Save map data + // It's an array of bytes so we don't care about 'PlatformMismatch' + stream.write(mSVM->mData.mSamples, sizeof(PxU8)*mSVM->mData.mNbSamples*2); + + if(!saveValencies(stream, platformMismatch)) + return false; + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// compute valencies for each vertex +// we dont compute the edges again here, we have them temporary stored in mHullDataFacesByAllEdges8 structure +bool BigConvexDataBuilder::computeValencies(const ConvexHullBuilder& meshBuilder) +{ + // Create valencies + const PxU32 numVertices = meshBuilder.mHull->mNbHullVertices; + mSVM->mData.mNbVerts = numVertices; + + // Get ram for valencies and adjacent verts + const PxU32 numAlignedVerts = (numVertices+3)&~3; + const PxU32 TotalSize = sizeof(Gu::Valency)*numAlignedVerts + sizeof(PxU8)*meshBuilder.mHull->mNbEdges*2u; + mSVM->mVBuffer = PX_ALLOC(TotalSize, "BigConvexData data"); + mSVM->mData.mValencies = reinterpret_cast(mSVM->mVBuffer); + mSVM->mData.mAdjacentVerts = (reinterpret_cast(mSVM->mVBuffer)) + sizeof(Gu::Valency)*numAlignedVerts; + + PxMemZero(mSVM->mData.mValencies, numVertices*sizeof(Gu::Valency)); + PxU8 vertexMarker[256]; + PxMemZero(vertexMarker,numVertices); + + // Compute valencies + for (PxU32 i = 0; i < meshBuilder.mHull->mNbPolygons; i++) + { + const PxU32 numVerts = meshBuilder.mHullDataPolygons[i].mNbVerts; + const PxU8* Data = meshBuilder.mHullDataVertexData8 + meshBuilder.mHullDataPolygons[i].mVRef8; + for (PxU32 j = 0; j < numVerts; j++) + { + mSVM->mData.mValencies[Data[j]].mCount++; + PX_ASSERT(mSVM->mData.mValencies[Data[j]].mCount != 0xffff); + } + } + + // Create offsets + mSVM->CreateOffsets(); + + // mNbAdjVerts = mOffsets[mNbVerts-1] + mValencies[mNbVerts-1]; + mSVM->mData.mNbAdjVerts = PxU32(mSVM->mData.mValencies[mSVM->mData.mNbVerts - 1].mOffset + mSVM->mData.mValencies[mSVM->mData.mNbVerts - 1].mCount); + PX_ASSERT(mSVM->mData.mNbAdjVerts == PxU32(meshBuilder.mHull->mNbEdges * 2)); + + // Create adjacent vertices + // parse the polygons and its vertices + for (PxU32 i = 0; i < meshBuilder.mHull->mNbPolygons; i++) + { + PxU32 numVerts = meshBuilder.mHullDataPolygons[i].mNbVerts; + const PxU8* Data = meshBuilder.mHullDataVertexData8 + meshBuilder.mHullDataPolygons[i].mVRef8; + for (PxU32 j = 0; j < numVerts; j++) + { + const PxU8 vertexIndex = Data[j]; + PxU8 numAdj = 0; + // if we did not parsed this vertex, traverse to the adjacent face and then + // again to next till we hit back the original polygon + if(vertexMarker[vertexIndex] == 0) + { + PxU8 prevIndex = Data[(j+1)%numVerts]; + mSVM->mData.mAdjacentVerts[mSVM->mData.mValencies[vertexIndex].mOffset++] = prevIndex; + numAdj++; + // now traverse the neighbors + const PxU16 edgeIndex = PxU16(meshBuilder.mEdgeData16[meshBuilder.mHullDataPolygons[i].mVRef8 + j]*2); + PxU8 n0 = meshBuilder.mHullDataFacesByEdges8[edgeIndex]; + PxU8 n1 = meshBuilder.mHullDataFacesByEdges8[edgeIndex + 1]; + + PxU32 neighborPolygon = n0 == i ? n1 : n0; + while (neighborPolygon != i) + { + PxU32 numNeighborVerts = meshBuilder.mHullDataPolygons[neighborPolygon].mNbVerts; + const PxU8* neighborData = meshBuilder.mHullDataVertexData8 + meshBuilder.mHullDataPolygons[neighborPolygon].mVRef8; + PxU32 nextEdgeIndex = 0; + // search in the neighbor face for the tested vertex + for (PxU32 k = 0; k < numNeighborVerts; k++) + { + // search the vertexIndex + if(neighborData[k] == vertexIndex) + { + const PxU8 nextIndex = neighborData[(k+1)%numNeighborVerts]; + // next index already there, pick the previous + if(nextIndex == prevIndex) + { + prevIndex = k == 0 ? neighborData[numNeighborVerts - 1] : neighborData[k-1]; + nextEdgeIndex = k == 0 ? numNeighborVerts - 1 : k-1; + } + else + { + prevIndex = nextIndex; + nextEdgeIndex = k; + } + mSVM->mData.mAdjacentVerts[mSVM->mData.mValencies[vertexIndex].mOffset++] = prevIndex; + numAdj++; + break; + } + } + + // now move to next neighbor + const PxU16 edgeIndex2 = PxU16(meshBuilder.mEdgeData16[(meshBuilder.mHullDataPolygons[neighborPolygon].mVRef8 + nextEdgeIndex)]*2); + n0 = meshBuilder.mHullDataFacesByEdges8[edgeIndex2]; + n1 = meshBuilder.mHullDataFacesByEdges8[edgeIndex2 + 1]; + + neighborPolygon = n0 == neighborPolygon ? n1 : n0; + } + vertexMarker[vertexIndex] = numAdj; + } + } + } + + // Recreate offsets + mSVM->CreateOffsets(); + return true; +} + +////////////////////////////////////////////////////////////////////////// +// compute the min dot product from the verts for given dir +void BigConvexDataBuilder::precomputeSample(const PxVec3& dir, PxU8& startIndex_, float negativeDir) +{ + PxU8 startIndex = startIndex_; + + const PxVec3* verts = mHullVerts; + const Valency* valency = mSVM->mData.mValencies; + const PxU8* adjacentVerts = mSVM->mData.mAdjacentVerts; + + // we have only 256 verts + PxU32 smallBitMap[8] = {0,0,0,0,0,0,0,0}; + + float minimum = negativeDir * verts[startIndex].dot(dir); + PxU32 initialIndex = startIndex; + do + { + initialIndex = startIndex; + const PxU32 numNeighbours = valency[startIndex].mCount; + const PxU32 offset = valency[startIndex].mOffset; + + for (PxU32 a = 0; a < numNeighbours; ++a) + { + const PxU8 neighbourIndex = adjacentVerts[offset + a]; + const float dist = negativeDir * verts[neighbourIndex].dot(dir); + if (dist < minimum) + { + const PxU32 ind = PxU32(neighbourIndex >> 5); + const PxU32 mask = PxU32(1 << (neighbourIndex & 31)); + if ((smallBitMap[ind] & mask) == 0) + { + smallBitMap[ind] |= mask; + minimum = dist; + startIndex = neighbourIndex; + } + } + } + + } while (startIndex != initialIndex); + + startIndex_ = startIndex; +} + +////////////////////////////////////////////////////////////////////////// +// Precompute the min/max vertices for cube directions. +bool BigConvexDataBuilder::precompute(PxU32 subdiv) +{ + mSVM->mData.mSubdiv = PxTo16(subdiv); + mSVM->mData.mNbSamples = PxTo16(6 * subdiv*subdiv); + + if (!initialize()) + return false; + + PxU8 startIndex[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + PxU8 startIndex2[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + const float halfSubdiv = float(subdiv - 1) * 0.5f; + for (PxU32 j = 0; j < subdiv; j++) + { + for (PxU32 i = j; i < subdiv; i++) + { + const float iSubDiv = 1.0f - i / halfSubdiv; + const float jSubDiv = 1.0f - j / halfSubdiv; + + PxVec3 tempDir(1.0f, iSubDiv, jSubDiv); + // we need to normalize only once, then we permute the components + // as before for each i,j and j,i face direction + tempDir.normalize(); + + const PxVec3 dirs[12] = { + PxVec3(-tempDir.x, tempDir.y, tempDir.z), + PxVec3(tempDir.x, tempDir.y, tempDir.z), + + PxVec3(tempDir.z, -tempDir.x, tempDir.y), + PxVec3(tempDir.z, tempDir.x, tempDir.y), + + PxVec3(tempDir.y, tempDir.z, -tempDir.x), + PxVec3(tempDir.y, tempDir.z, tempDir.x), + + PxVec3(-tempDir.x, tempDir.z, tempDir.y), + PxVec3(tempDir.x, tempDir.z, tempDir.y), + + PxVec3(tempDir.y, -tempDir.x, tempDir.z), + PxVec3(tempDir.y, tempDir.x, tempDir.z), + + PxVec3(tempDir.z, tempDir.y, -tempDir.x), + PxVec3(tempDir.z, tempDir.y, tempDir.x) + }; + + // compute in each direction + negative/positive dot, we have + // then two start indexes, which are used then for hill climbing + for (PxU32 dStep = 0; dStep < 12; dStep++) + { + precomputeSample(dirs[dStep], startIndex[dStep], 1.0f); + precomputeSample(dirs[dStep], startIndex2[dStep], -1.0f); + } + + // decompose the vector results into face directions + for (PxU32 k = 0; k < 6; k++) + { + const PxU32 ksub = k*subdiv*subdiv; + const PxU32 offset = j + i*subdiv + ksub; + const PxU32 offset2 = i + j*subdiv + ksub; + PX_ASSERT(offset < mSVM->mData.mNbSamples); + PX_ASSERT(offset2 < mSVM->mData.mNbSamples); + + mSVM->mData.mSamples[offset] = startIndex[k]; + mSVM->mData.mSamples[offset + mSVM->mData.mNbSamples] = startIndex2[k]; + + mSVM->mData.mSamples[offset2] = startIndex[k + 6]; + mSVM->mData.mSamples[offset2 + mSVM->mData.mNbSamples] = startIndex2[k + 6]; + } + } + } + return true; +} + +static const PxU32 gValencyVersion = 2; + +////////////////////////////////////////////////////////////////////////// + +bool BigConvexDataBuilder::saveValencies(PxOutputStream& stream, bool platformMismatch) const +{ + // Export header + if(!Cm::WriteHeader('V', 'A', 'L', 'E', gValencyVersion, platformMismatch, stream)) + return false; + + writeDword(mSVM->mData.mNbVerts, platformMismatch, stream); + writeDword(mSVM->mData.mNbAdjVerts, platformMismatch, stream); + + { + PxU16* temp = PX_ALLOCATE(PxU16, mSVM->mData.mNbVerts, "tmp"); + for(PxU32 i=0;imData.mNbVerts;i++) + temp[i] = mSVM->mData.mValencies[i].mCount; + + const PxU32 maxIndex = computeMaxIndex(temp, mSVM->mData.mNbVerts); + writeDword(maxIndex, platformMismatch, stream); + Cm::StoreIndices(PxTo16(maxIndex), mSVM->mData.mNbVerts, temp, stream, platformMismatch); + + PX_FREE(temp); + } + stream.write(mSVM->mData.mAdjacentVerts, mSVM->mData.mNbAdjVerts); + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.h new file mode 100644 index 0000000..3ef4463 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingBigConvexDataBuilder.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_BIG_CONVEX_DATA_BUILDER_H +#define GU_COOKING_BIG_CONVEX_DATA_BUILDER_H + +#include "foundation/PxMemory.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ + class BigConvexData; + class ConvexHullBuilder; + + class BigConvexDataBuilder : public PxUserAllocated + { + public: + BigConvexDataBuilder(const Gu::ConvexHullData* hull, BigConvexData* gm, const PxVec3* hullVerts); + ~BigConvexDataBuilder(); + // Support vertex map + bool precompute(PxU32 subdiv); + + bool initialize(); + + bool save(PxOutputStream& stream, bool platformMismatch) const; + + bool computeValencies(const ConvexHullBuilder& meshBuilder); + //~Support vertex map + + // Valencies + bool saveValencies(PxOutputStream& stream, bool platformMismatch) const; + //~Valencies + protected: + PX_FORCE_INLINE void precomputeSample(const PxVec3& dir, PxU8& startIndex, float negativeDir); + + private: + const Gu::ConvexHullData* mHull; + BigConvexData* mSVM; + const PxVec3* mHullVerts; + + }; + +} + +#endif // BIG_CONVEX_DATA_BUILDER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp new file mode 100644 index 0000000..5408106 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.cpp @@ -0,0 +1,709 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "cooking/PxCooking.h" + +#include "GuEdgeList.h" +#include "GuTriangle.h" +#include "GuConvexMesh.h" +#include "GuMeshCleaner.h" +#include "GuCookingConvexHullBuilder.h" +#include "GuCookingConvexHullLib.h" +#include "foundation/PxArray.h" +#include "foundation/PxVecMath.h" +#include "CmRadixSort.h" + +// PT: TODO: refactor/revisit this, looks like it comes from an old ICE file + +// 7: added mHullDataFacesByVertices8 +// 8: added mEdges +// 9: removed duplicite 'C', 'V', 'H', 'L' header +static const physx::PxU32 gVersion = 9; + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace aos; + +#define USE_PRECOMPUTED_HULL_PROJECTION + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +// default constructor +ConvexHullBuilder::ConvexHullBuilder(ConvexHullData* hull, const bool buildGRBData) : + mHullDataHullVertices (NULL), + mHullDataPolygons (NULL), + mHullDataVertexData8 (NULL), + mHullDataFacesByEdges8 (NULL), + mHullDataFacesByVertices8 (NULL), + mEdgeData16 (NULL), + mEdges (NULL), + mHull (hull), + mBuildGRBData (buildGRBData) +{ +} + +////////////////////////////////////////////////////////////////////////// +// default destructor +ConvexHullBuilder::~ConvexHullBuilder() +{ + PX_FREE(mEdgeData16); + PX_FREE(mEdges); + + PX_FREE(mHullDataHullVertices); + PX_FREE(mHullDataPolygons); + PX_FREE(mHullDataVertexData8); + PX_FREE(mHullDataFacesByEdges8); + PX_FREE(mHullDataFacesByVertices8); +} + +////////////////////////////////////////////////////////////////////////// +// initialize the convex hull +// \param nbVerts [in] number of vertices used +// \param verts [in] vertices array +// \param indices [in] indices array +// \param nbPolygons [in] number of polygons +// \param hullPolygons [in] polygons array +// \param doValidation [in] specifies whether we should run the validation code +// \param hullLib [in] if hullLib is provided, we can reuse the hull create data, hulllib is NULL in case of user provided polygons +bool ConvexHullBuilder::init(PxU32 nbVerts, const PxVec3* verts, const PxU32* indices, const PxU32 nbIndices, + const PxU32 nbPolygons, const PxHullPolygon* hullPolygons, bool doValidation, ConvexHullLib* hullLib) +{ + PX_ASSERT(indices); + PX_ASSERT(verts); + PX_ASSERT(hullPolygons); + PX_ASSERT(nbVerts); + PX_ASSERT(nbPolygons); + + mHullDataHullVertices = NULL; + mHullDataPolygons = NULL; + mHullDataVertexData8 = NULL; + mHullDataFacesByEdges8 = NULL; + mHullDataFacesByVertices8 = NULL; + + mEdges = NULL; + mEdgeData16 = NULL; + + mHull->mNbHullVertices = PxTo8(nbVerts); + // allocate additional vec3 for V4 safe load in VolumeInteration + mHullDataHullVertices = PX_ALLOCATE(PxVec3, (mHull->mNbHullVertices + 1), "PxVec3"); + PxMemCopy(mHullDataHullVertices, verts, mHull->mNbHullVertices*sizeof(PxVec3)); + + // Cleanup + mHull->mNbPolygons = 0; + PX_FREE(mHullDataVertexData8); + PX_FREE(mHullDataPolygons); + + if(nbPolygons>255) + return outputError(__LINE__, "ConvexHullBuilder::init: convex hull has more than 255 polygons!"); + + // Precompute hull polygon structures + mHull->mNbPolygons = PxTo8(nbPolygons); + mHullDataPolygons = PX_ALLOCATE(HullPolygonData, mHull->mNbPolygons, "Gu::HullPolygonData"); + + mHullDataVertexData8 = PX_ALLOCATE(PxU8, nbIndices, "mHullDataVertexData8"); + PxU8* dest = mHullDataVertexData8; + for(PxU32 i=0;i=3); // Else something very wrong happened... + mHullDataPolygons[i].mNbVerts = PxTo8(numVerts); + + for (PxU32 j = 0; j < numVerts; j++) + { + dest[j] = PxTo8(indices[inPolygon.mIndexBase + j]); + } + + mHullDataPolygons[i].mPlane = PxPlane(inPolygon.mPlane[0],inPolygon.mPlane[1],inPolygon.mPlane[2],inPolygon.mPlane[3]); + + // Next one + dest += numVerts; + } + + if(!calculateVertexMapTable(nbPolygons, (hullLib != NULL) ? false : true)) + return false; + + // moved create edge list here from save, copy. This is a part of the validation process and + // we need to create the edge list anyway + if(!hullLib || !hullLib->createEdgeList(nbIndices, mHullDataVertexData8, &mHullDataFacesByEdges8, &mEdgeData16, &mEdges)) + { + if (!createEdgeList(doValidation, nbIndices)) + return false; + } + else + { + mHull->mNbEdges = PxU16(nbIndices/2); + } + +#ifdef USE_PRECOMPUTED_HULL_PROJECTION + // Loop through polygons + for (PxU32 j = 0; j < nbPolygons; j++) + { + // Precompute hull projection along local polygon normal + PxU32 NbVerts = mHull->mNbHullVertices; + const PxVec3* Verts = mHullDataHullVertices; + HullPolygonData& polygon = mHullDataPolygons[j]; + PxReal min = PX_MAX_F32; + PxU8 minIndex = 0xff; + for (PxU8 i = 0; i < NbVerts; i++) + { + float dp = (*Verts++).dot(polygon.mPlane.n); + if (dp < min) + { + min = dp; + minIndex = i; + } + } + polygon.mMinIndex = minIndex; + } +#endif + + if(doValidation) + return checkHullPolygons(); + else + return true; +} + +////////////////////////////////////////////////////////////////////////// +// hull polygons check +bool ConvexHullBuilder::checkHullPolygons() const +{ + const PxVec3* hullVerts = mHullDataHullVertices; + const PxU8* vertexData = mHullDataVertexData8; + HullPolygonData* hullPolygons = mHullDataPolygons; + + // Check hull validity + if(!hullVerts || !hullPolygons) + return false; + + if(mHull->mNbPolygons<4) + return false; + + PxVec3 max(-FLT_MAX,-FLT_MAX,-FLT_MAX); + + PxVec3 hullMax = hullVerts[0]; + PxVec3 hullMin = hullVerts[0]; + + for(PxU32 j=0;jmNbHullVertices;j++) + { + const PxVec3& hullVert = hullVerts[j]; + if(fabsf(hullVert.x) > max.x) + max.x = fabsf(hullVert.x); + + if(fabsf(hullVert.y) > max.y) + max.y = fabsf(hullVert.y); + + if(fabsf(hullVert.z) > max.z) + max.z = fabsf(hullVert.z); + + if (hullVert.x > hullMax.x) + { + hullMax.x = hullVert.x; + } + else if (hullVert.x < hullMin.x) + { + hullMin.x = hullVert.x; + } + + if (hullVert.y > hullMax.y) + { + hullMax.y = hullVert.y; + } + else if (hullVert.y < hullMin.y) + { + hullMin.y = hullVert.y; + } + + if (hullVert.z > hullMax.z) + { + hullMax.z = hullVert.z; + } + else if (hullVert.z < hullMin.z) + { + hullMin.z = hullVert.z; + } + } + + // compute the test epsilon the same way we construct the hull, verts are considered coplanar within this epsilon + const float planeTolerance = 0.02f; + const float testEpsilon = PxMax(planeTolerance * (PxMax(PxAbs(hullMax.x), PxAbs(hullMin.x)) + + PxMax(PxAbs(hullMax.y), PxAbs(hullMin.y)) + + PxMax(PxAbs(hullMax.z), PxAbs(hullMin.z))), planeTolerance); + + max += PxVec3(testEpsilon, testEpsilon, testEpsilon); + + PxVec3 testVectors[8]; + bool foundPlane[8]; + for (PxU32 i = 0; i < 8; i++) + { + foundPlane[i] = false; + } + + testVectors[0] = PxVec3(max.x,max.y,max.z); + testVectors[1] = PxVec3(max.x,-max.y,-max.z); + testVectors[2] = PxVec3(max.x,max.y,-max.z); + testVectors[3] = PxVec3(max.x,-max.y,max.z); + testVectors[4] = PxVec3(-max.x,max.y,max.z); + testVectors[5] = PxVec3(-max.x,-max.y,max.z); + testVectors[6] = PxVec3(-max.x,max.y,-max.z); + testVectors[7] = PxVec3(-max.x,-max.y,-max.z); + + + // Extra convex hull validity check. This is less aggressive than previous convex decomposer! + // Loop through polygons + for(PxU32 i=0;imNbPolygons;i++) + { + const PxPlane& P = hullPolygons[i].mPlane; + + for (PxU32 k = 0; k < 8; k++) + { + if(!foundPlane[k]) + { + const float d = P.distance(testVectors[k]); + if(d >= 0) + { + foundPlane[k] = true; + } + } + } + + // Test hull vertices against polygon plane + for(PxU32 j=0;jmNbHullVertices;j++) + { + // Don't test vertex if it belongs to plane (to prevent numerical issues) + PxU32 nb = hullPolygons[i].mNbVerts; + bool discard=false; + for(PxU32 k=0;k0.0001f) + //if(d>0.02f) + if(d > testEpsilon) + return outputError(__LINE__, "Gu::ConvexMesh::checkHullPolygons: Some hull vertices seems to be too far from hull planes."); + } + } + } + + for (PxU32 i = 0; i < 8; i++) + { + if(!foundPlane[i]) + return outputError(__LINE__, "Gu::ConvexMesh::checkHullPolygons: Hull seems to have opened volume or do (some) faces have reversed winding?"); + } + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// hull data store +PX_COMPILE_TIME_ASSERT(sizeof(EdgeDescData)==8); +PX_COMPILE_TIME_ASSERT(sizeof(EdgeData)==8); +bool ConvexHullBuilder::save(PxOutputStream& stream, bool platformMismatch) const +{ + // Export header + if(!WriteHeader('C', 'L', 'H', 'L', gVersion, platformMismatch, stream)) + return false; + + // Export figures + + //embed grb flag into mNbEdges + PxU16 hasGRBData = PxU16(mBuildGRBData); + hasGRBData = PxU16(hasGRBData << 15); + PX_ASSERT(mHull->mNbEdges <( (1 << 15) - 1)); + const PxU16 nbEdges = PxU16(mHull->mNbEdges | hasGRBData); + writeDword(mHull->mNbHullVertices, platformMismatch, stream); + writeDword(nbEdges, platformMismatch, stream); + writeDword(computeNbPolygons(), platformMismatch, stream); // Use accessor to lazy-build + PxU32 nb=0; + for(PxU32 i=0;imNbPolygons;i++) + nb += mHullDataPolygons[i].mNbVerts; + writeDword(nb, platformMismatch, stream); + + // Export triangles + + writeFloatBuffer(&mHullDataHullVertices->x, PxU32(mHull->mNbHullVertices*3), platformMismatch, stream); + + // Export polygons + // TODO: allow lazy-evaluation + // We can't really store the buffer in one run anymore! + for(PxU32 i=0;imNbPolygons;i++) + { + HullPolygonData tmpCopy = mHullDataPolygons[i]; + if(platformMismatch) + flipData(tmpCopy); + + stream.write(&tmpCopy, sizeof(HullPolygonData)); + } + + // PT: why not storeBuffer here? + for(PxU32 i=0;imNbEdges*2)); + stream.write(mHullDataFacesByVertices8, PxU32(mHull->mNbHullVertices*3)); + + if (mBuildGRBData) + writeWordBuffer(mEdges, PxU32(mHull->mNbEdges * 2), platformMismatch, stream); + + return true; +} + +////////////////////////////////////////////////////////////////////////// +bool ConvexHullBuilder::copy(ConvexHullData& hullData, PxU32& mNb) +{ + // set the numbers + hullData.mNbHullVertices = mHull->mNbHullVertices; + PxU16 hasGRBData = PxU16(mBuildGRBData); + hasGRBData = PxU16(hasGRBData << 15); + PX_ASSERT(mHull->mNbEdges <((1 << 15) - 1)); + hullData.mNbEdges = PxU16(mHull->mNbEdges | hasGRBData);; + hullData.mNbPolygons = PxTo8(computeNbPolygons()); + PxU32 nb = 0; + for (PxU32 i = 0; i < mHull->mNbPolygons; i++) + nb += mHullDataPolygons[i].mNbVerts; + + mNb = nb; + + PxU32 bytesNeeded = computeBufferSize(hullData, nb); + + // allocate the memory first. + void* dataMemory = PX_ALLOC(bytesNeeded, "ConvexHullData data"); + + PxU8* address = reinterpret_cast(dataMemory); + + // set data pointers + hullData.mPolygons = reinterpret_cast(address); address += sizeof(HullPolygonData) * hullData.mNbPolygons; + PxVec3* dataHullVertices = reinterpret_cast(address); address += sizeof(PxVec3) * hullData.mNbHullVertices; + PxU8* dataFacesByEdges8 = reinterpret_cast(address); address += sizeof(PxU8) * hullData.mNbEdges * 2; + PxU8* dataFacesByVertices8 = reinterpret_cast(address); address += sizeof(PxU8) * hullData.mNbHullVertices * 3; + PxU16* dataEdges = reinterpret_cast(address); address += hullData.mNbEdges.isBitSet() ? sizeof(PxU16) *hullData.mNbEdges * 2 : 0; + PxU8* dataVertexData8 = reinterpret_cast(address); address += sizeof(PxU8) * nb; // PT: leave that one last, so that we don't need to serialize "Nb" + + PX_ASSERT(!(size_t(dataHullVertices) % sizeof(PxReal))); + PX_ASSERT(!(size_t(hullData.mPolygons) % sizeof(PxReal))); + PX_ASSERT(size_t(address) <= size_t(dataMemory) + bytesNeeded); + + PX_ASSERT(mHullDataHullVertices); + PX_ASSERT(mHullDataPolygons); + PX_ASSERT(mHullDataVertexData8); + PX_ASSERT(mHullDataFacesByEdges8); + PX_ASSERT(mHullDataFacesByVertices8); + + // copy the data + PxMemCopy(dataHullVertices, &mHullDataHullVertices->x, PxU32(mHull->mNbHullVertices * 3)*sizeof(float)); + PxMemCopy(hullData.mPolygons, mHullDataPolygons , hullData.mNbPolygons*sizeof(HullPolygonData)); + PxMemCopy(dataVertexData8, mHullDataVertexData8, nb); + PxMemCopy(dataFacesByEdges8,mHullDataFacesByEdges8, PxU32(mHull->mNbEdges * 2)); + if (mBuildGRBData) + PxMemCopy(dataEdges, mEdges, PxU32(mHull->mNbEdges * 2) * sizeof(PxU16)); + PxMemCopy(dataFacesByVertices8, mHullDataFacesByVertices8, PxU32(mHull->mNbHullVertices * 3)); + return true; +} + +////////////////////////////////////////////////////////////////////////// +// calculate vertex map table +bool ConvexHullBuilder::calculateVertexMapTable(PxU32 nbPolygons, bool userPolygons) +{ + mHullDataFacesByVertices8 = PX_ALLOCATE(PxU8, mHull->mNbHullVertices*3u, "mHullDataFacesByVertices8"); + PxU8 vertexMarker[256]; + PxMemSet(vertexMarker, 0, mHull->mNbHullVertices); + + for (PxU32 i = 0; i < nbPolygons; i++) + { + const HullPolygonData& polygon = mHullDataPolygons[i]; + for (PxU32 k = 0; k < polygon.mNbVerts; ++k) + { + const PxU8 index = mHullDataVertexData8[polygon.mVRef8 + k]; + if (vertexMarker[index] < 3) + { + //Found a polygon + mHullDataFacesByVertices8[index*3 + vertexMarker[index]++] = PxTo8(i); + } + } + } + + bool noPlaneShift = false; + for (PxU32 i = 0; i < mHull->mNbHullVertices; ++i) + { + if(vertexMarker[i] != 3) + noPlaneShift = true; + } + + if (noPlaneShift) + { + //PCM will use the original shape, which means it will have a huge performance drop + if (!userPolygons) + outputError(__LINE__, "ConvexHullBuilder: convex hull does not have vertex-to-face info! Try to use different convex mesh cooking settings."); + else + outputError(__LINE__, "ConvexHullBuilder: convex hull does not have vertex-to-face info! Some of the vertices have less than 3 neighbor polygons. The vertex is most likely inside a polygon or on an edge between 2 polygons, please remove those vertices."); + for (PxU32 i = 0; i < mHull->mNbHullVertices; ++i) + { + mHullDataFacesByVertices8[i * 3 + 0] = 0xFF; + mHullDataFacesByVertices8[i * 3 + 1] = 0xFF; + mHullDataFacesByVertices8[i * 3 + 2] = 0xFF; + } + return false; + } + + return true; +} + + +////////////////////////////////////////////////////////////////////////// +// create edge list +bool ConvexHullBuilder::createEdgeList(bool doValidation, PxU32 nbEdges) +{ + // Code below could be greatly simplified if we assume manifold meshes! + + //feodorb: ok, let's assume manifold meshes, since the code before this change + //would fail on non-maniflold meshes anyways + + // We need the adjacency graph for hull polygons, similar to what we have for triangles. + // - sort the polygon edges and walk them in order + // - each edge should appear exactly twice since a convex is a manifold mesh without boundary edges + // - the polygon index is implicit when we walk the sorted list => get the 2 polygons back and update adjacency graph + // + // Two possible structures: + // - polygon to edges: needed for local search (actually: polygon to polygons) + // - edge to polygons: needed to compute edge normals on-the-fly + + // Below is largely copied from the edge-list code + + // Polygon to edges: + // + // We're dealing with convex polygons made of N vertices, defining N edges. For each edge we want the edge in + // an edge array. + // + // Edges to polygon: + // + // For each edge in the array, we want two polygon indices - ie an edge. + + // 0) Compute the total size needed for "polygon to edges" + const PxU32 nbPolygons = mHull->mNbPolygons; + PxU32 nbEdgesUnshared = nbEdges; + + // in a manifold mesh, each edge is repeated exactly twice as it shares exactly 2 faces + if (nbEdgesUnshared % 2 != 0) + return outputError(__LINE__, "Cooking::cookConvexMesh: non-manifold mesh cannot be used, invalid mesh!"); + + // 1) Get some bytes: I need one EdgesRefs for each face, and some temp buffers + + // Face indices by edge indices. First face is the one where the edge is ordered from tail to head. + PX_FREE(mHullDataFacesByEdges8); + mHullDataFacesByEdges8 = PX_ALLOCATE(PxU8, nbEdgesUnshared, "mHullDataFacesByEdges8"); + + PxU32* tempBuffer = PX_ALLOCATE(PxU32, nbEdgesUnshared*8, "tmp"); // Temp storage + PxU32* bufferAdd = tempBuffer; + PxU32* PX_RESTRICT vRefs0 = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* PX_RESTRICT vRefs1 = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* polyIndex = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* vertexIndex = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* polyIndex2 = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* vertexIndex2 = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* edgeIndex = tempBuffer; tempBuffer += nbEdgesUnshared; + PxU32* edgeData = tempBuffer; tempBuffer += nbEdgesUnshared; + + // TODO avoroshilov: use the same "tempBuffer" + bool* flippedVRefs = PX_ALLOCATE(bool, nbEdgesUnshared, "tmp"); // Temp storage + + PxU32* run0 = vRefs0; + PxU32* run1 = vRefs1; + PxU32* run2 = polyIndex; + PxU32* run3 = vertexIndex; + bool* run4 = flippedVRefs; + + // 2) Create a full redundant list of edges + PxU32 edgeCounter = 0; + for(PxU32 i=0;ivRef1; + + if (flipped) + physx::PxSwap(vRef0, vRef1); + + *run0++ = vRef0; + *run1++ = vRef1; + *run2++ = i; + *run3++ = j; + *run4++ = flipped; + edgeData[edgeCounter] = edgeCounter; + edgeCounter++; + } + } + PX_ASSERT(PxU32(run0-vRefs0)==nbEdgesUnshared); + PX_ASSERT(PxU32(run1-vRefs1)==nbEdgesUnshared); + + // 3) Sort the list according to both keys (VRefs0 and VRefs1) + Cm::RadixSortBuffered sorter; + const PxU32* PX_RESTRICT sorted = sorter.Sort(vRefs1, nbEdgesUnshared,Cm::RADIX_UNSIGNED).Sort(vRefs0, nbEdgesUnshared,Cm::RADIX_UNSIGNED).GetRanks(); + + PX_FREE(mEdges); + // Edges by their tail and head VRefs. NbEdgesUnshared == nbEdges * 2 + // mEdges[edgeIdx*2 + 0] = tailVref, mEdges[edgeIdx*2 + 1] = headVref + // Tails and heads should be consistent with face refs, so that the edge is given in the order of + // his first face and opposite to the order of his second face + mEdges = PX_ALLOCATE(PxU16, nbEdgesUnshared, "mEdges"); + + PX_FREE(mEdgeData16); + // Face to edge mapping + mEdgeData16 = PX_ALLOCATE(PxU16, nbEdgesUnshared, "mEdgeData16"); + + // TODO avoroshilov: remove this comment + //mHull->mNbEdges = PxTo16(nbEdgesUnshared / 2); // #non-redundant edges + + mHull->mNbEdges = 0; // #non-redundant edges + + // 4) Loop through all possible edges + // - clean edges list by removing redundant edges + // - create EdgesRef list + // mNbFaces = nbFaces; + + // TODO avoroshilov: + PxU32 numFacesPerEdgeVerificationCounter = 0; + + PxU16* edgeVertOutput = mEdges; + + PxU32 previousRef0 = PX_INVALID_U32; + PxU32 previousRef1 = PX_INVALID_U32; + PxU32 previousPolyId = PX_INVALID_U32; + + PxU16 nbHullEdges = 0; + for (PxU32 i = 0; i < nbEdgesUnshared; i++) + { + const PxU32 sortedIndex = sorted[i]; // Between 0 and Nb + const PxU32 polyID = polyIndex[sortedIndex]; // Poly index + const PxU32 vertexID = vertexIndex[sortedIndex]; // Poly index + PxU32 sortedRef0 = vRefs0[sortedIndex]; // (SortedRef0, SortedRef1) is the sorted edge + PxU32 sortedRef1 = vRefs1[sortedIndex]; + bool flipped = flippedVRefs[sortedIndex]; + + if (sortedRef0 != previousRef0 || sortedRef1 != previousRef1) + { + // TODO avoroshilov: remove this? + if (i != 0 && numFacesPerEdgeVerificationCounter != 1) + return outputError(__LINE__, "Cooking::cookConvexMesh: non-manifold mesh cannot be used, invalid mesh!"); + + numFacesPerEdgeVerificationCounter = 0; + + // ### TODO: change this in edge list as well + previousRef0 = sortedRef0; + previousRef1 = sortedRef1; + previousPolyId = polyID; + + //feodorb:restore the original order of VRefs (tail and head) + if (flipped) + physx::PxSwap(sortedRef0, sortedRef1); + + *edgeVertOutput++ = PxTo16(sortedRef0); + *edgeVertOutput++ = PxTo16(sortedRef1); + + nbHullEdges++; + } + else + { + mHullDataFacesByEdges8[(nbHullEdges - 1) * 2] = PxTo8(previousPolyId); + mHullDataFacesByEdges8[(nbHullEdges - 1) * 2 + 1] = PxTo8(polyID); + + ++numFacesPerEdgeVerificationCounter; + } + + mEdgeData16[mHullDataPolygons[polyID].mVRef8 + vertexID] = PxTo16(i / 2); + + // Create mEdgesRef on the fly + + polyIndex2[i] = polyID; + vertexIndex2[i] = vertexID; + edgeIndex[i] = PxU32(nbHullEdges - 1); + } + + mHull->mNbEdges = nbHullEdges; + + ////////////////////// + + // 2) Get some bytes: one Pair structure / edge + // create this structure only for validation purpose + // 3) Create Counters, ie compute the #faces sharing each edge + if(doValidation) + { + // + sorted = sorter.Sort(vertexIndex2, nbEdgesUnshared, Cm::RADIX_UNSIGNED).Sort(polyIndex2, nbEdgesUnshared, Cm::RADIX_UNSIGNED).GetRanks(); + + for (PxU32 i = 0; i < nbEdgesUnshared; i++) edgeData[i] = edgeIndex[sorted[i]]; + + const PxU16 nbToGo = PxU16(mHull->mNbEdges); + EdgeDescData* edgeToTriangles = PX_ALLOCATE(EdgeDescData, nbToGo, "edgeToTriangles"); + PxMemZero(edgeToTriangles, sizeof(EdgeDescData)*nbToGo); + + PxU32* data = edgeData; + for(PxU32 i=0;i(__LINE__, "Cooking::cookConvexMesh: non-manifold mesh cannot be used, invalid mesh!"); + } + PX_FREE(edgeToTriangles); + } + + // TODO avoroshilov: use the same "tempBuffer" + PX_FREE(flippedVRefs); + + // ### free temp ram + PX_FREE(bufferAdd); + + return true; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.h new file mode 100644 index 0000000..c2fe080 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullBuilder.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_CONVEX_HULL_BUILDER_H +#define GU_COOKING_CONVEX_HULL_BUILDER_H + +#include "cooking/PxCooking.h" + +#include "GuConvexMeshData.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + struct PxHullPolygon; + class ConvexHullLib; + + namespace Gu + { + struct EdgeDescData; + struct ConvexHullData; + } // namespace Gu + + class ConvexHullBuilder : public PxUserAllocated + { + public: + ConvexHullBuilder(Gu::ConvexHullData* hull, const bool buildGRBData); + ~ConvexHullBuilder(); + + bool init(PxU32 nbVerts, const PxVec3* verts, const PxU32* indices, const PxU32 nbIndices, const PxU32 nbPolygons, + const PxHullPolygon* hullPolygons, bool doValidation = true, ConvexHullLib* hullLib = NULL); + + bool save(PxOutputStream& stream, bool platformMismatch) const; + bool copy(Gu::ConvexHullData& hullData, PxU32& nb); + + bool createEdgeList(bool doValidation, PxU32 nbEdges); + bool checkHullPolygons() const; + + bool calculateVertexMapTable(PxU32 nbPolygons, bool userPolygons = false); + + PX_INLINE PxU32 computeNbPolygons() const + { + PX_ASSERT(mHull->mNbPolygons); + return mHull->mNbPolygons; + } + + PxVec3* mHullDataHullVertices; + Gu::HullPolygonData* mHullDataPolygons; + PxU8* mHullDataVertexData8; + PxU8* mHullDataFacesByEdges8; + PxU8* mHullDataFacesByVertices8; + + PxU16* mEdgeData16; //!< Edge indices indexed by hull polygons + PxU16* mEdges; //!< Edge to vertex mapping + + Gu::ConvexHullData* mHull; + bool mBuildGRBData; + }; +} + +#endif + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp new file mode 100644 index 0000000..8471cc7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.cpp @@ -0,0 +1,285 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuCookingConvexHullLib.h" +#include "GuQuantizer.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxMemory.h" + +using namespace physx; +using namespace Gu; + +namespace local +{ + ////////////////////////////////////////////////////////////////////////// + // constants + static const float DISTANCE_EPSILON = 0.000001f; // close enough to consider two floating point numbers to be 'the same'. + static const float RESIZE_VALUE = 0.01f; // if the provided points AABB is very thin resize it to this size + + ////////////////////////////////////////////////////////////////////////// + // checks if points form a valid AABB cube, if not construct a default CUBE + static bool checkPointsAABBValidity(PxU32 numPoints, const PxVec3* points, PxU32 stride , float distanceEpsilon, + float resizeValue, PxU32& vcount, PxVec3* vertices, bool fCheck = false) + { + const char* vtx = reinterpret_cast (points); + PxBounds3 bounds; + bounds.setEmpty(); + + // get the bounding box + for (PxU32 i = 0; i < numPoints; i++) + { + const PxVec3& p = *reinterpret_cast (vtx); + vtx += stride; + + bounds.include(p); + + vertices[i] = p; + } + + PxVec3 dim = bounds.getDimensions(); + PxVec3 center = bounds.getCenter(); + + // special case, the AABB is very thin or user provided us with only input 2 points + // we construct an AABB cube and return it + if ( dim.x < distanceEpsilon || dim.y < distanceEpsilon || dim.z < distanceEpsilon || numPoints < 3 ) + { + float len = FLT_MAX; + + // pick the shortest size bigger than the distance epsilon + if ( dim.x > distanceEpsilon && dim.x < len ) + len = dim.x; + if ( dim.y > distanceEpsilon && dim.y < len ) + len = dim.y; + if ( dim.z > distanceEpsilon && dim.z < len ) + len = dim.z; + + // if the AABB is small in all dimensions, resize it + if ( len == FLT_MAX ) + { + dim = PxVec3(resizeValue); + } + // if one edge is small, set to 1/5th the shortest non-zero edge. + else + { + if ( dim.x < distanceEpsilon ) + dim.x = PxMin(len * 0.05f, resizeValue); + else + dim.x *= 0.5f; + if ( dim.y < distanceEpsilon ) + dim.y = PxMin(len * 0.05f, resizeValue); + else + dim.y *= 0.5f; + if ( dim.z < distanceEpsilon ) + dim.z = PxMin(len * 0.05f, resizeValue); + else + dim.z *= 0.5f; + } + + // construct the AABB + const PxVec3 extPos = center + dim; + const PxVec3 extNeg = center - dim; + + if(fCheck) + vcount = 0; + + vertices[vcount++] = extNeg; + vertices[vcount++] = PxVec3(extPos.x,extNeg.y,extNeg.z); + vertices[vcount++] = PxVec3(extPos.x,extPos.y,extNeg.z); + vertices[vcount++] = PxVec3(extNeg.x,extPos.y,extNeg.z); + vertices[vcount++] = PxVec3(extNeg.x,extNeg.y,extPos.z); + vertices[vcount++] = PxVec3(extPos.x,extNeg.y,extPos.z); + vertices[vcount++] = extPos; + vertices[vcount++] = PxVec3(extNeg.x,extPos.y,extPos.z); + return true; // return cube + } + + vcount = numPoints; + return false; + } + +} + + +////////////////////////////////////////////////////////////////////////// +// shift vertices around origin and normalize point cloud, remove duplicates! +bool ConvexHullLib::shiftAndcleanupVertices(PxU32 svcount, const PxVec3* svertices, PxU32 stride, + PxU32& vcount, PxVec3* vertices) +{ + mShiftedVerts = PX_ALLOCATE(PxVec3, svcount, "PxVec3"); + const char* vtx = reinterpret_cast (svertices); + PxBounds3 bounds; + bounds.setEmpty(); + + // get the bounding box + for (PxU32 i = 0; i < svcount; i++) + { + const PxVec3& p = *reinterpret_cast (vtx); + vtx += stride; + + bounds.include(p); + } + mOriginShift = bounds.getCenter(); + vtx = reinterpret_cast (svertices); + for (PxU32 i = 0; i < svcount; i++) + { + const PxVec3& p = *reinterpret_cast (vtx); + vtx += stride; + + mShiftedVerts[i] = p - mOriginShift; + } + return cleanupVertices(svcount, mShiftedVerts, sizeof(PxVec3), vcount, vertices); +} + +////////////////////////////////////////////////////////////////////////// +// Shift verts/planes in the desc back +void ConvexHullLib::shiftConvexMeshDesc(PxConvexMeshDesc& desc) +{ + PX_ASSERT(mConvexMeshDesc.flags & PxConvexFlag::eSHIFT_VERTICES); + + PxVec3* points = reinterpret_cast(const_cast(desc.points.data)); + for(PxU32 i = 0; i < desc.points.count; i++) + { + points[i] = points[i] + mOriginShift; + } + + PxHullPolygon* polygons = reinterpret_cast(const_cast(desc.polygons.data)); + for(PxU32 i = 0; i < desc.polygons.count; i++) + { + polygons[i].mPlane[3] -= PxVec3(polygons[i].mPlane[0], polygons[i].mPlane[1], polygons[i].mPlane[2]).dot(mOriginShift); + } +} + +////////////////////////////////////////////////////////////////////////// +// normalize point cloud, remove duplicates! +bool ConvexHullLib::cleanupVertices(PxU32 svcount, const PxVec3* svertices, PxU32 stride, + PxU32& vcount, PxVec3* vertices) +{ + if (svcount == 0) + return false; + + const PxVec3* verticesToClean = svertices; + PxU32 numVerticesToClean = svcount; + Quantizer* quantizer = NULL; + + // if quantization is enabled, parse the input vertices and produce new qantized vertices, + // that will be then cleaned the same way + if (mConvexMeshDesc.flags & PxConvexFlag::eQUANTIZE_INPUT) + { + quantizer = createQuantizer(); + PxU32 vertsOutCount; + const PxVec3* vertsOut = quantizer->kmeansQuantize3D(svcount, svertices, stride,true, mConvexMeshDesc.quantizedCount, vertsOutCount); + + if (vertsOut) + { + numVerticesToClean = vertsOutCount; + verticesToClean = vertsOut; + } + } + + const float distanceEpsilon = local::DISTANCE_EPSILON * mCookingParams.scale.length; + const float resizeValue = local::RESIZE_VALUE * mCookingParams.scale.length; + + vcount = 0; + // check for the AABB from points, if its very tiny return a resized CUBE + if (local::checkPointsAABBValidity(numVerticesToClean, verticesToClean, stride, distanceEpsilon, resizeValue, vcount, vertices, false)) + { + if (quantizer) + quantizer->release(); + return true; + } + + if(vcount < 4) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "ConvexHullLib::cleanupVertices: Less than four valid vertices were found. Provide at least four valid (e.g. each at a different position) vertices."); + + if (quantizer) + quantizer->release(); + return true; +} + +void ConvexHullLib::swapLargestFace(PxConvexMeshDesc& desc) +{ + const PxHullPolygon* polygons = reinterpret_cast(desc.polygons.data); + PxHullPolygon* polygonsOut = const_cast(polygons); + + PxU32 largestFace = 0; + for (PxU32 i = 1; i < desc.polygons.count; i++) + { + if(polygons[largestFace].mNbVerts < polygons[i].mNbVerts) + largestFace = i; + } + + // early exit if no swap needs to be done + if(largestFace == 0) + return; + + const PxU32* indices = reinterpret_cast(desc.indices.data); + mSwappedIndices = PX_ALLOCATE(PxU32, desc.indices.count, "PxU32"); + + PxHullPolygon replacedPolygon = polygons[0]; + PxHullPolygon largestPolygon = polygons[largestFace]; + polygonsOut[0] = polygons[largestFace]; + polygonsOut[largestFace] = replacedPolygon; + + // relocate indices + PxU16 indexBase = 0; + for (PxU32 i = 0; i < desc.polygons.count; i++) + { + if(i == 0) + { + PxMemCopy(mSwappedIndices, &indices[largestPolygon.mIndexBase],sizeof(PxU32)*largestPolygon.mNbVerts); + polygonsOut[0].mIndexBase = indexBase; + indexBase += largestPolygon.mNbVerts; + } + else + { + if(i == largestFace) + { + PxMemCopy(&mSwappedIndices[indexBase], &indices[replacedPolygon.mIndexBase], sizeof(PxU32)*replacedPolygon.mNbVerts); + polygonsOut[i].mIndexBase = indexBase; + indexBase += replacedPolygon.mNbVerts; + } + else + { + PxMemCopy(&mSwappedIndices[indexBase], &indices[polygons[i].mIndexBase], sizeof(PxU32)*polygons[i].mNbVerts); + polygonsOut[i].mIndexBase = indexBase; + indexBase += polygons[i].mNbVerts; + } + } + } + + PX_ASSERT(indexBase == desc.indices.count); + + desc.indices.data = mSwappedIndices; +} + +ConvexHullLib::~ConvexHullLib() +{ + PX_FREE(mSwappedIndices); + PX_FREE(mShiftedVerts); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.h new file mode 100644 index 0000000..8d4ec0b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullLib.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_CONVEX_HULL_LIB_H +#define GU_COOKING_CONVEX_HULL_LIB_H + +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxCooking.h" + +namespace physx +{ + ////////////////////////////////////////////////////////////////////////// + // base class for the convex hull libraries - inflation based and quickhull + class ConvexHullLib + { + PX_NOCOPY(ConvexHullLib) + public: + // functions + ConvexHullLib(const PxConvexMeshDesc& desc, const PxCookingParams& params) + : mConvexMeshDesc(desc), mCookingParams(params), mSwappedIndices(NULL), + mShiftedVerts(NULL) + { + } + + virtual ~ConvexHullLib(); + + // computes the convex hull from provided points + virtual PxConvexMeshCookingResult::Enum createConvexHull() = 0; + + // fills the PxConvexMeshDesc with computed hull data + virtual void fillConvexMeshDesc(PxConvexMeshDesc& desc) = 0; + + // compute the edge list information if possible + virtual bool createEdgeList(const PxU32 nbIndices, const PxU8* indices, PxU8** hullDataFacesByEdges8, PxU16** edgeData16, PxU16** edges) = 0; + + static const PxU32 gpuMaxVertsPerFace = 31; + + protected: + + // clean input vertices from duplicates, normalize etc. + bool cleanupVertices(PxU32 svcount, // input vertex count + const PxVec3* svertices, // vertices + PxU32 stride, // stride + PxU32& vcount, // output number of vertices + PxVec3* vertices); // location to store the results. + + // shift vertices around origin and clean input vertices from duplicates, normalize etc. + bool shiftAndcleanupVertices(PxU32 svcount, // input vertex count + const PxVec3* svertices, // vertices + PxU32 stride, // stride + PxU32& vcount, // output number of vertices + PxVec3* vertices); // location to store the results. + + void swapLargestFace(PxConvexMeshDesc& desc); + + void shiftConvexMeshDesc(PxConvexMeshDesc& desc); + + protected: + const PxConvexMeshDesc& mConvexMeshDesc; + const PxCookingParams& mCookingParams; + PxU32* mSwappedIndices; + PxVec3 mOriginShift; + PxVec3* mShiftedVerts; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp new file mode 100644 index 0000000..cfd45a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.cpp @@ -0,0 +1,924 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxBounds3.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxSIMDHelpers.h" + +#include "GuCookingConvexHullUtils.h" +#include "GuCookingVolumeIntegration.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVecMath.h" +#include "GuBox.h" +#include "GuConvexMeshData.h" + +using namespace physx; +using namespace aos; +using namespace Gu; + +namespace local +{ + static const float MIN_ADJACENT_ANGLE = 3.0f; // in degrees - result wont have two adjacent facets within this angle of each other. + static const float MAXDOT_MINANG = cosf(PxDegToRad(MIN_ADJACENT_ANGLE)); // adjacent angle for dot product tests + + ////////////////////////////////////////////////////////////////////////// + // helper class for ConvexHullCrop + class VertFlag + { + public: + PxU8 planetest; + PxU8 undermap; + PxU8 overmap; + }; + + //////////////////////////////////////////////////////////////////////////| + // helper class for ConvexHullCrop + class EdgeFlag + { + public: + PxI16 undermap; + }; + + //////////////////////////////////////////////////////////////////////////| + // helper class for ConvexHullCrop + class Coplanar + { + public: + PxU16 ea; + PxU8 v0; + PxU8 v1; + }; + + ////////////////////////////////////////////////////////////////////////// + // plane test + enum PlaneTestResult + { + eCOPLANAR = 0, + eUNDER = 1 << 0, + eOVER = 1 << 1 + }; + + ////////////////////////////////////////////////////////////////////////// + // test where vertex lies in respect to the plane + static PlaneTestResult planeTest(const PxPlane& p, const PxVec3& v, float epsilon) + { + const float a = v.dot(p.n) + p.d; + PlaneTestResult flag = (a > epsilon) ? eOVER : ((a < -epsilon) ? eUNDER : eCOPLANAR); + return flag; + } + + // computes the OBB for this set of points relative to this transform matrix. SIMD version + void computeOBBSIMD(PxU32 vcount, const Vec4V* points, Vec4V& sides, const QuatV& rot, Vec4V& trans) + { + PX_ASSERT(vcount); + + Vec4V minV = V4Load(PX_MAX_F32); + Vec4V maxV = V4Load(-PX_MAX_F32); + for (PxU32 i = 0; i < vcount; i++) + { + const Vec4V& vertexV = points[i]; + const Vec4V t = V4Sub(vertexV, trans); + const Vec4V v = Vec4V_From_Vec3V(QuatRotateInv(rot, Vec3V_From_Vec4V(t))); + + minV = V4Min(minV, v); + maxV = V4Max(maxV, v); + } + + sides = V4Sub(maxV, minV); + + Mat33V tmpMat; + QuatGetMat33V(rot, tmpMat.col0, tmpMat.col1, tmpMat.col2); + const FloatV coe = FLoad(0.5f); + + const Vec4V deltaVec = V4Sub(maxV, V4Scale(sides, coe)); + + const Vec4V t0 = V4Scale(Vec4V_From_Vec3V(tmpMat.col0), V4GetX(deltaVec)); + trans = V4Add(trans, t0); + + const Vec4V t1 = V4Scale(Vec4V_From_Vec3V(tmpMat.col1), V4GetY(deltaVec)); + trans = V4Add(trans, t1); + + const Vec4V t2 = V4Scale(Vec4V_From_Vec3V(tmpMat.col2), V4GetZ(deltaVec)); + trans = V4Add(trans, t2); + } +} + +////////////////////////////////////////////////////////////////////////// +// construct the base cube from given min/max +ConvexHull::ConvexHull(const PxVec3& bmin, const PxVec3& bmax, const PxArray& inPlanes) +: mInputPlanes(inPlanes) +{ + // min max verts of the cube - 8 verts + mVertices.pushBack(PxVec3(bmin.x, bmin.y, bmin.z)); // --- + mVertices.pushBack(PxVec3(bmin.x, bmin.y, bmax.z)); // --+ + mVertices.pushBack(PxVec3(bmin.x, bmax.y, bmin.z)); // -+- + mVertices.pushBack(PxVec3(bmin.x, bmax.y, bmax.z)); // -++ + mVertices.pushBack(PxVec3(bmax.x, bmin.y, bmin.z)); // +-- + mVertices.pushBack(PxVec3(bmax.x, bmin.y, bmax.z)); // +-+ + mVertices.pushBack(PxVec3(bmax.x, bmax.y, bmin.z)); // ++- + mVertices.pushBack(PxVec3(bmax.x, bmax.y, bmax.z)); // +++ + + // cube planes - 6 planes + mFacets.pushBack(PxPlane(PxVec3(-1.f, 0, 0), bmin.x)); // 0,1,3,2 + mFacets.pushBack(PxPlane(PxVec3(1.f, 0, 0), -bmax.x)); // 6,7,5,4 + mFacets.pushBack(PxPlane(PxVec3(0, -1.f, 0), bmin.y)); // 0,4,5,1 + mFacets.pushBack(PxPlane(PxVec3(0, 1.f, 0), -bmax.y)); // 3,7,6,2 + mFacets.pushBack(PxPlane(PxVec3(0, 0, -1.f), bmin.z)); // 0,2,6,4 + mFacets.pushBack(PxPlane(PxVec3(0, 0, 1.f), -bmax.z)); // 1,5,7,3 + + // cube edges - 24 edges + mEdges.pushBack(HalfEdge(11, 0, 0)); + mEdges.pushBack(HalfEdge(23, 1, 0)); + mEdges.pushBack(HalfEdge(15, 3, 0)); + mEdges.pushBack(HalfEdge(16, 2, 0)); + + mEdges.pushBack(HalfEdge(13, 6, 1)); + mEdges.pushBack(HalfEdge(21, 7, 1)); + mEdges.pushBack(HalfEdge(9, 5, 1)); + mEdges.pushBack(HalfEdge(18, 4, 1)); + + mEdges.pushBack(HalfEdge(19, 0, 2)); + mEdges.pushBack(HalfEdge(6, 4, 2)); + mEdges.pushBack(HalfEdge(20, 5, 2)); + mEdges.pushBack(HalfEdge(0, 1, 2)); + + mEdges.pushBack(HalfEdge(22, 3, 3)); + mEdges.pushBack(HalfEdge(4, 7, 3)); + mEdges.pushBack(HalfEdge(17, 6, 3)); + mEdges.pushBack(HalfEdge(2, 2, 3)); + + mEdges.pushBack(HalfEdge(3, 0, 4)); + mEdges.pushBack(HalfEdge(14, 2, 4)); + mEdges.pushBack(HalfEdge(7, 6, 4)); + mEdges.pushBack(HalfEdge(8, 4, 4)); + + mEdges.pushBack(HalfEdge(10, 1, 5)); + mEdges.pushBack(HalfEdge(5, 5, 5)); + mEdges.pushBack(HalfEdge(12, 7, 5)); + mEdges.pushBack(HalfEdge(1, 3, 5)); +} + +////////////////////////////////////////////////////////////////////////// +// create the initial convex hull from given OBB +ConvexHull::ConvexHull(const PxVec3& extent, const PxTransform& transform, const PxArray& inPlanes) + : mInputPlanes(inPlanes) +{ + // get the OBB corner points + PxVec3 extentPoints[8]; + const PxMat33Padded rot(transform.q); + Gu::computeOBBPoints(extentPoints, transform.p, extent, rot.column0, rot.column1, rot.column2); + + mVertices.pushBack(PxVec3(extentPoints[0].x, extentPoints[0].y, extentPoints[0].z)); // --- + mVertices.pushBack(PxVec3(extentPoints[4].x, extentPoints[4].y, extentPoints[4].z)); // --+ + mVertices.pushBack(PxVec3(extentPoints[3].x, extentPoints[3].y, extentPoints[3].z)); // -+- + mVertices.pushBack(PxVec3(extentPoints[7].x, extentPoints[7].y, extentPoints[7].z)); // -++ + mVertices.pushBack(PxVec3(extentPoints[1].x, extentPoints[1].y, extentPoints[1].z)); // +-- + mVertices.pushBack(PxVec3(extentPoints[5].x, extentPoints[5].y, extentPoints[5].z)); // +-+ + mVertices.pushBack(PxVec3(extentPoints[2].x, extentPoints[2].y, extentPoints[2].z)); // ++- + mVertices.pushBack(PxVec3(extentPoints[6].x, extentPoints[6].y, extentPoints[6].z)); // +++ + + // cube planes - 6 planes + PxPlane plane0(extentPoints[0], extentPoints[4], extentPoints[7]); // 0,1,3,2 + mFacets.pushBack(PxPlane(plane0.n, plane0.d)); + + PxPlane plane1(extentPoints[2], extentPoints[6], extentPoints[5]); // 6,7,5,4 + mFacets.pushBack(PxPlane(plane1.n, plane1.d)); + + PxPlane plane2(extentPoints[0], extentPoints[1], extentPoints[5]); // 0,4,5,1 + mFacets.pushBack(PxPlane(plane2.n, plane2.d)); + + PxPlane plane3(extentPoints[7], extentPoints[6], extentPoints[2]); // 3,7,6,2 + mFacets.pushBack(PxPlane(plane3.n, plane3.d)); + + PxPlane plane4(extentPoints[0], extentPoints[3], extentPoints[2]); // 0,2,6,4 + mFacets.pushBack(PxPlane(plane4.n, plane4.d)); + + PxPlane plane5(extentPoints[4], extentPoints[5], extentPoints[6]); // 1,5,7,3 + mFacets.pushBack(PxPlane(plane5.n, plane5.d)); + + // cube edges - 24 edges + mEdges.pushBack(HalfEdge(11, 0, 0)); + mEdges.pushBack(HalfEdge(23, 1, 0)); + mEdges.pushBack(HalfEdge(15, 3, 0)); + mEdges.pushBack(HalfEdge(16, 2, 0)); + + mEdges.pushBack(HalfEdge(13, 6, 1)); + mEdges.pushBack(HalfEdge(21, 7, 1)); + mEdges.pushBack(HalfEdge(9, 5, 1)); + mEdges.pushBack(HalfEdge(18, 4, 1)); + + mEdges.pushBack(HalfEdge(19, 0, 2)); + mEdges.pushBack(HalfEdge(6, 4, 2)); + mEdges.pushBack(HalfEdge(20, 5, 2)); + mEdges.pushBack(HalfEdge(0, 1, 2)); + + mEdges.pushBack(HalfEdge(22, 3, 3)); + mEdges.pushBack(HalfEdge(4, 7, 3)); + mEdges.pushBack(HalfEdge(17, 6, 3)); + mEdges.pushBack(HalfEdge(2, 2, 3)); + + mEdges.pushBack(HalfEdge(3, 0, 4)); + mEdges.pushBack(HalfEdge(14, 2, 4)); + mEdges.pushBack(HalfEdge(7, 6, 4)); + mEdges.pushBack(HalfEdge(8, 4, 4)); + + mEdges.pushBack(HalfEdge(10, 1, 5)); + mEdges.pushBack(HalfEdge(5, 5, 5)); + mEdges.pushBack(HalfEdge(12, 7, 5)); + mEdges.pushBack(HalfEdge(1, 3, 5)); +} + +////////////////////////////////////////////////////////////////////////// +// finds the candidate plane, returns -1 otherwise +PxI32 ConvexHull::findCandidatePlane(float planeTestEpsilon, float epsilon) const +{ + PxI32 p = -1; + float md = 0.0f; + PxU32 i, j; + for (i = 0; i < mInputPlanes.size(); i++) + { + float d = 0.0f; + float dmax = 0.0f; + float dmin = 0.0f; + for (j = 0; j < mVertices.size(); j++) + { + dmax = PxMax(dmax, mVertices[j].dot(mInputPlanes[i].n) + mInputPlanes[i].d); + dmin = PxMin(dmin, mVertices[j].dot(mInputPlanes[i].n) + mInputPlanes[i].d); + } + + float dr = dmax - dmin; + if (dr < planeTestEpsilon) + dr = 1.0f; // shouldn't happen. + d = dmax / dr; + // we have a better candidate try another one + if (d <= md) + continue; + // check if we dont have already that plane or if the normals are nearly the same + for (j = 0; j local::MAXDOT_MINANG) + { + for (PxU32 k = 0; k < mEdges.size(); k++) + { + if (mEdges[k].p != j) + continue; + if (mVertices[mEdges[k].v].dot(mInputPlanes[i].n) + mInputPlanes[i].d < 0) + { + d = 0; // so this plane wont get selected. + break; + } + } + } + } + if (d>md) + { + p = PxI32(i); + md = d; + } + } + return (md > epsilon) ? p : -1; +} + +////////////////////////////////////////////////////////////////////////// +// internal hull check +bool ConvexHull::assertIntact(float epsilon) const +{ + PxU32 i; + PxU32 estart = 0; + for (i = 0; i < mEdges.size(); i++) + { + if (mEdges[estart].p != mEdges[i].p) + { + estart = i; + } + PxU32 inext = i + 1; + if (inext >= mEdges.size() || mEdges[inext].p != mEdges[i].p) + { + inext = estart; + } + PX_ASSERT(mEdges[inext].p == mEdges[i].p); + PxI16 nb = mEdges[i].ea; + if (nb == 255 || nb == -1) + return false; + PX_ASSERT(nb != -1); + PX_ASSERT(i == PxU32(mEdges[PxU32(nb)].ea)); + // Check that the vertex of the next edge is the vertex of the adjacent half edge. + // Otherwise the two half edges are not really adjacent and we have a hole. + PX_ASSERT(mEdges[PxU32(nb)].v == mEdges[inext].v); + if (!(mEdges[PxU32(nb)].v == mEdges[inext].v)) + return false; + } + + for (i = 0; i < mEdges.size(); i++) + { + PX_ASSERT(local::eCOPLANAR == local::planeTest(mFacets[mEdges[i].p], mVertices[mEdges[i].v], epsilon)); + if (local::eCOPLANAR != local::planeTest(mFacets[mEdges[i].p], mVertices[mEdges[i].v], epsilon)) + return false; + if (mEdges[estart].p != mEdges[i].p) + { + estart = i; + } + PxU32 i1 = i + 1; + if (i1 >= mEdges.size() || mEdges[i1].p != mEdges[i].p) { + i1 = estart; + } + PxU32 i2 = i1 + 1; + if (i2 >= mEdges.size() || mEdges[i2].p != mEdges[i].p) { + i2 = estart; + } + if (i == i2) + continue; // i sliced tangent to an edge and created 2 meaningless edges + + // check the face normal against the triangle from edges + PxVec3 localNormal = (mVertices[mEdges[i1].v] - mVertices[mEdges[i].v]).cross(mVertices[mEdges[i2].v] - mVertices[mEdges[i1].v]); + const float m = localNormal.magnitude(); + if (m == 0.0f) + localNormal = PxVec3(1.f, 0.0f, 0.0f); + localNormal *= (1.0f / m); + if (localNormal.dot(mFacets[mEdges[i].p].n) <= 0.0f) + return false; + } + return true; +} + +// returns the maximum number of vertices on a face +PxU32 ConvexHull::maxNumVertsPerFace() const +{ + PxU32 maxVerts = 0; + PxU32 currentVerts = 0; + PxU32 estart = 0; + for (PxU32 i = 0; i < mEdges.size(); i++) + { + if (mEdges[estart].p != mEdges[i].p) + { + if(currentVerts > maxVerts) + { + maxVerts = currentVerts + 1; + } + currentVerts = 0; + estart = i; + } + else + { + currentVerts++; + } + } + return maxVerts; +} + +////////////////////////////////////////////////////////////////////////// +// slice the input convexHull with the slice plane +ConvexHull* physx::convexHullCrop(const ConvexHull& convex, const PxPlane& slice, float planeTestEpsilon) +{ + static const PxU8 invalidIndex = PxU8(-1); + PxU32 i; + PxU32 vertCountUnder = 0; // Running count of the vertices UNDER the slicing plane. + + PX_ASSERT(convex.getEdges().size() < 480); + + // Arrays of mapping information associated with features in the input convex. + // edgeflag[i].undermap - output index of input edge convex->edges[i] + // vertflag[i].undermap - output index of input vertex convex->vertices[i] + // vertflag[i].planetest - the side-of-plane classification of convex->vertices[i] + // (There are other members but they are unused.) + local::EdgeFlag edgeFlag[512]; + local::VertFlag vertFlag[256]; + + // Lists of output features. Populated during clipping. + // Coplanar edges have one sibling in tmpunderedges and one in coplanaredges. + // coplanaredges holds the sibling that belong to the new polygon created from slicing. + ConvexHull::HalfEdge tmpUnderEdges[512]; // The output edge list. + PxPlane tmpUnderPlanes[128]; // The output plane list. + local::Coplanar coplanarEdges[512]; // The coplanar edge list. + + PxU32 coplanarEdgesNum = 0; // Running count of coplanar edges. + + // Created vertices on the slicing plane (stored for output after clipping). + PxArray createdVerts; + + // Logical OR of individual vertex flags. + PxU32 convexClipFlags = 0; + + // Classify each vertex against the slicing plane as OVER | COPLANAR | UNDER. + // OVER - Vertex is over (outside) the slicing plane. Will not be output. + // COPLANAR - Vertex is on the slicing plane. A copy will be output. + // UNDER - Vertex is under (inside) the slicing plane. Will be output. + // We keep an array of information structures for each vertex in the input convex. + // vertflag[i].undermap - The (computed) index of convex->vertices[i] in the output. + // invalidIndex for OVER vertices - they are not output. + // initially invalidIndex for COPLANAR vertices - set later. + // vertflag[i].overmap - Unused - we don't care about the over part. + // vertflag[i].planetest - The classification (clip flag) of convex->vertices[i]. + for (i = 0; i < convex.getVertices().size(); i++) + { + local::PlaneTestResult vertexClipFlag = local::planeTest(slice, convex.getVertices()[i], planeTestEpsilon); + switch (vertexClipFlag) + { + case local::eOVER: + case local::eCOPLANAR: + vertFlag[i].undermap = invalidIndex; // Initially invalid for COPLANAR + vertFlag[i].overmap = invalidIndex; + break; + case local::eUNDER: + vertFlag[i].undermap = PxTo8(vertCountUnder++); + vertFlag[i].overmap = invalidIndex; + break; + } + vertFlag[i].planetest = PxU8(vertexClipFlag); + convexClipFlags |= vertexClipFlag; + } + + // Check special case: everything UNDER or COPLANAR. + // This way we know we wont end up with silly faces / edges later on. + if ((convexClipFlags & local::eOVER) == 0) + { + // Just return a copy of the same convex. + ConvexHull* dst = PX_NEW(ConvexHull)(convex); + return dst; + } + + PxU16 underEdgeCount = 0; // Running count of output edges. + PxU16 underPlanesCount = 0; // Running count of output planes. + + // Clipping Loop + // ============= + // + // for each plane + // + // for each edge + // + // if first UNDER & second !UNDER + // output current edge -> tmpunderedges + // if we have done the sibling + // connect current edge to its sibling + // set vout = first vertex of sibling + // else if second is COPLANAR + // if we havent already copied it + // copy second -> createdverts + // set vout = index of created vertex + // else + // generate a new vertex -> createdverts + // set vout = index of created vertex + // if vin is already set and vin != vout (non-trivial edge) + // output coplanar edge -> tmpunderedges (one sibling) + // set coplanaredge to new edge index (for connecting the other sibling) + // + // else if first !UNDER & second UNDER + // if we have done the sibling + // connect current edge to its sibling + // set vin = second vertex of sibling (this is a bit of a pain) + // else if first is COPLANAR + // if we havent already copied it + // copy first -> createdverts + // set vin = index of created vertex + // else + // generate a new vertex -> createdverts + // set vin = index of created vertex + // if vout is already set and vin != vout (non-trivial edge) + // output coplanar edge -> tmpunderedges (one sibling) + // set coplanaredge to new edge index (for connecting the other sibling) + // output current edge -> tmpunderedges + // + // else if first UNDER & second UNDER + // output current edge -> tmpunderedges + // + // next edge + // + // if part of current plane was UNDER + // output current plane -> tmpunderplanes + // + // if coplanaredge is set + // output coplanar edge -> coplanaredges + // + // next plane + // + + // Indexing is a bit tricky here: + // + // e0 - index of the current edge + // e1 - index of the next edge + // estart - index of the first edge in the current plane + // currentplane - index of the current plane + // enextface - first edge of next plane + + PxU32 e0 = 0; + + for (PxU32 currentplane = 0; currentplane < convex.getFacets().size(); currentplane++) + { + + PxU32 eStart = e0; + PxU32 eNextFace = 0xffffffff; + PxU32 e1 = e0 + 1; + + PxU8 vout = invalidIndex; + PxU8 vin = invalidIndex; + + PxU32 coplanarEdge = invalidIndex; + + // Logical OR of individual vertex flags in the current plane. + PxU32 planeSide = 0; + + do{ + + // Next edge modulo logic + if (e1 >= convex.getEdges().size() || convex.getEdges()[e1].p != currentplane) + { + eNextFace = e1; + e1 = eStart; + } + + const ConvexHull::HalfEdge& edge0 = convex.getEdges()[e0]; + const ConvexHull::HalfEdge& edge1 = convex.getEdges()[e1]; + const ConvexHull::HalfEdge& edgea = convex.getEdges()[PxU32(edge0.ea)]; + + planeSide |= vertFlag[edge0.v].planetest; + + if (vertFlag[edge0.v].planetest == local::eUNDER && vertFlag[edge1.v].planetest != local::eUNDER) + { + // first is UNDER, second is COPLANAR or OVER + + // Output current edge. + edgeFlag[e0].undermap = short(underEdgeCount); + tmpUnderEdges[underEdgeCount].v = vertFlag[edge0.v].undermap; + tmpUnderEdges[underEdgeCount].p = PxU8(underPlanesCount); + PX_ASSERT(tmpUnderEdges[underEdgeCount].v != invalidIndex); + + if (PxU32(edge0.ea) < e0) + { + // We have already done the sibling. + // Connect current edge to its sibling. + PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex); + tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap; + tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount); + // Set vout = first vertex of (output, clipped) sibling. + vout = tmpUnderEdges[edgeFlag[edge0.ea].undermap].v; + } + else if (vertFlag[edge1.v].planetest == local::eCOPLANAR) + { + // Boundary case. + // We output coplanar vertices once. + if (vertFlag[edge1.v].undermap == invalidIndex) + { + createdVerts.pushBack(convex.getVertices()[edge1.v]); + // Remember the index so we don't output it again. + vertFlag[edge1.v].undermap = PxTo8(vertCountUnder++); + } + vout = vertFlag[edge1.v].undermap; + } + else + { + // Add new vertex. + const PxPlane& p0 = convex.getFacets()[edge0.p]; + const PxPlane& pa = convex.getFacets()[edgea.p]; + createdVerts.pushBack(threePlaneIntersection(p0, pa, slice)); + vout = PxTo8(vertCountUnder++); + } + + // We added an edge, increment the counter + underEdgeCount++; + + if (vin != invalidIndex && vin != vout) + { + // We already have vin and a non-trivial edge + // Output coplanar edge + PX_ASSERT(vout != invalidIndex); + coplanarEdge = underEdgeCount; + tmpUnderEdges[underEdgeCount].v = vout; + tmpUnderEdges[underEdgeCount].p = PxU8(underPlanesCount); + tmpUnderEdges[underEdgeCount].ea = invalidIndex; + underEdgeCount++; + } + } + else if (vertFlag[edge0.v].planetest != local::eUNDER && vertFlag[edge1.v].planetest == local::eUNDER) + { + // First is OVER or COPLANAR, second is UNDER. + + if (PxU32(edge0.ea) < e0) + { + // We have already done the sibling. + // We need the second vertex of the sibling. + // Which is the vertex of the next edge in the adjacent poly. + int nea = edgeFlag[edge0.ea].undermap + 1; + int p = tmpUnderEdges[edgeFlag[edge0.ea].undermap].p; + if (nea >= underEdgeCount || tmpUnderEdges[nea].p != p) + { + // End of polygon, next edge is first edge + nea -= 2; + while (nea > 0 && tmpUnderEdges[nea - 1].p == p) + nea--; + } + vin = tmpUnderEdges[nea].v; + PX_ASSERT(vin < vertCountUnder); + } + else if (vertFlag[edge0.v].planetest == local::eCOPLANAR) + { + // Boundary case. + // We output coplanar vertices once. + if (vertFlag[edge0.v].undermap == invalidIndex) + { + createdVerts.pushBack(convex.getVertices()[edge0.v]); + // Remember the index so we don't output it again. + vertFlag[edge0.v].undermap = PxTo8(vertCountUnder++); + } + vin = vertFlag[edge0.v].undermap; + } + else + { + // Add new vertex. + const PxPlane& p0 = convex.getFacets()[edge0.p]; + const PxPlane& pa = convex.getFacets()[edgea.p]; + createdVerts.pushBack(threePlaneIntersection(p0, pa, slice)); + vin = PxTo8(vertCountUnder++); + } + + if (vout != invalidIndex && vin != vout) + { + // We have been in and out, Add the coplanar edge + coplanarEdge = underEdgeCount; + tmpUnderEdges[underEdgeCount].v = vout; + tmpUnderEdges[underEdgeCount].p = PxTo8(underPlanesCount); + tmpUnderEdges[underEdgeCount].ea = invalidIndex; + underEdgeCount++; + } + + // Output current edge. + tmpUnderEdges[underEdgeCount].v = vin; + tmpUnderEdges[underEdgeCount].p = PxTo8(underPlanesCount); + edgeFlag[e0].undermap = short(underEdgeCount); + + if (PxU32(edge0.ea) < e0) + { + // We have already done the sibling. + // Connect current edge to its sibling. + PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex); + tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap; + tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount); + } + + PX_ASSERT(edgeFlag[e0].undermap == underEdgeCount); + underEdgeCount++; + } + else if (vertFlag[edge0.v].planetest == local::eUNDER && vertFlag[edge1.v].planetest == local::eUNDER) + { + // Both UNDER + + // Output current edge. + edgeFlag[e0].undermap = short(underEdgeCount); + tmpUnderEdges[underEdgeCount].v = vertFlag[edge0.v].undermap; + tmpUnderEdges[underEdgeCount].p = PxTo8(underPlanesCount); + if (PxU32(edge0.ea) < e0) + { + // We have already done the sibling. + // Connect current edge to its sibling. + PX_ASSERT(edgeFlag[edge0.ea].undermap != invalidIndex); + tmpUnderEdges[underEdgeCount].ea = edgeFlag[edge0.ea].undermap; + tmpUnderEdges[edgeFlag[edge0.ea].undermap].ea = short(underEdgeCount); + } + underEdgeCount++; + } + + e0 = e1; + e1++; // do the modulo at the beginning of the loop + + } while (e0 != eStart); + + e0 = eNextFace; + + if (planeSide & local::eUNDER) + { + // At least part of current plane is UNDER. + // Output current plane. + tmpUnderPlanes[underPlanesCount] = convex.getFacets()[currentplane]; + underPlanesCount++; + } + + if (coplanarEdge != invalidIndex) + { + // We have a coplanar edge. + // Add to coplanaredges for later processing. + // (One sibling is in place but one is missing) + PX_ASSERT(vin != invalidIndex); + PX_ASSERT(vout != invalidIndex); + PX_ASSERT(coplanarEdge != 511); + coplanarEdges[coplanarEdgesNum].ea = PxU8(coplanarEdge); + coplanarEdges[coplanarEdgesNum].v0 = vin; + coplanarEdges[coplanarEdgesNum].v1 = vout; + coplanarEdgesNum++; + } + + // Reset coplanar edge infos for next poly + vin = invalidIndex; + vout = invalidIndex; + coplanarEdge = invalidIndex; + } + + // Add the new plane to the mix: + if (coplanarEdgesNum > 0) + { + tmpUnderPlanes[underPlanesCount++] = slice; + } + + // Sort the coplanar edges in winding order. + for (i = 0; i < coplanarEdgesNum - 1; i++) + { + if (coplanarEdges[i].v1 != coplanarEdges[i + 1].v0) + { + PxU32 j = 0; + for (j = i + 2; j < coplanarEdgesNum; j++) + { + if (coplanarEdges[i].v1 == coplanarEdges[j].v0) + { + local::Coplanar tmp = coplanarEdges[i + 1]; + coplanarEdges[i + 1] = coplanarEdges[j]; + coplanarEdges[j] = tmp; + break; + } + } + if (j >= coplanarEdgesNum) + { + // PX_ASSERT(j(desc.points.data)); + const PxU32* ind = (reinterpret_cast(desc.indices.data)); + const PxHullPolygon* polygons = (reinterpret_cast(desc.polygons.data)); + PxVec3 mean(0.0f); + for (PxU32 i = 0; i < desc.points.count; i++) + mean += verts[i]; + mean *= (1.0f / desc.points.count); + + PxU8* indices = PX_ALLOCATE(PxU8, desc.indices.count, "PxU8"); + for (PxU32 i = 0; i < desc.indices.count; i++) + { + indices[i] = PxTo8(ind[i]); + } + // we need to move the polygon data to internal format + Gu::HullPolygonData* polygonData = PX_ALLOCATE(Gu::HullPolygonData, desc.polygons.count, "Gu::HullPolygonData"); + for (PxU32 i = 0; i < desc.polygons.count; i++) + { + polygonData[i].mPlane = PxPlane(polygons[i].mPlane[0], polygons[i].mPlane[1], polygons[i].mPlane[2], polygons[i].mPlane[3]); + polygonData[i].mNbVerts = PxTo8(polygons[i].mNbVerts); + polygonData[i].mVRef8 = polygons[i].mIndexBase; + } + + PxConvexMeshDesc inDesc; + inDesc.points.data = desc.points.data; + inDesc.points.count = desc.points.count; + + inDesc.polygons.data = polygonData; + inDesc.polygons.count = desc.polygons.count; + + inDesc.indices.data = indices; + inDesc.indices.count = desc.indices.count; + + // compute volume integrals to get basis axis + if(computeVolumeIntegralsEberly(inDesc, 1.0f, integrals, mean, desc.flags & PxConvexFlag::eFAST_INERTIA_COMPUTATION)) + { + Vec4V* pointsV = PX_ALLOCATE(Vec4V, desc.points.count, "Vec4V"); + for (PxU32 i = 0; i < desc.points.count; i++) + { + // safe to V4 load, same as volume integration - we allocate one more vector + pointsV[i] = V4LoadU(&verts[i].x); + } + + PxMat33 inertia; + integrals.getOriginInertia(inertia); + PxQuat inertiaQuat; + PxDiagonalize(inertia, inertiaQuat); + const PxMat33Padded baseAxis(inertiaQuat); + Vec4V center = V4LoadU(&integrals.COM.x); + + const PxU32 numSteps = 20; + const float subStep = PxDegToRad(float(360/numSteps)); + + float bestVolume = FLT_MAX; + + for (PxU32 axis = 0; axis < 3; axis++) + { + for (PxU32 iStep = 0; iStep < numSteps; iStep++) + { + PxQuat quat(iStep*subStep, baseAxis[axis]); + + Vec4V transV = center; + Vec4V psidesV; + + const QuatV rotV = QuatVLoadU(&quat.x); + local::computeOBBSIMD(desc.points.count, pointsV, psidesV, rotV, transV); + + PxVec3 psides; + V3StoreU(Vec3V_From_Vec4V(psidesV), psides); + + const float volume = psides[0] * psides[1] * psides[2]; // the volume of the cube + + if (volume <= bestVolume) + { + bestVolume = volume; + sides = psides; + + V4StoreU(rotV, &matrix.q.x); + V3StoreU(Vec3V_From_Vec4V(transV), matrix.p); + } + } + } + + PX_FREE(pointsV); + } + else + { + PX_FREE(indices); + PX_FREE(polygonData); + return false; + } + + PX_FREE(indices); + PX_FREE(polygonData); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.h new file mode 100644 index 0000000..50b5404 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexHullUtils.h @@ -0,0 +1,171 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_CONVEX_HULL_UTILS_H +#define GU_COOKING_CONVEX_HULL_UTILS_H + +#include "foundation/PxMemory.h" +#include "foundation/PxPlane.h" +#include "cooking/PxConvexMeshDesc.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxArray.h" + +namespace physx +{ + + ////////////////////////////////////////////////////////////////////////// + // helper class for hull construction, holds the vertices and planes together + // while cropping the hull with planes + class ConvexHull : public PxUserAllocated + { + public: + + // Helper class for halfedge representation + class HalfEdge + { + public: + PxI16 ea; // the other half of the edge (index into edges list) + PxU8 v; // the vertex at the start of this edge (index into vertices list) + PxU8 p; // the facet on which this edge lies (index into facets list) + HalfEdge(){} + HalfEdge(PxI16 _ea, PxU8 _v, PxU8 _p) :ea(_ea), v(_v), p(_p){} + }; + + ConvexHull& operator = (const ConvexHull&); + + // construct the base cube hull from given max/min AABB + ConvexHull(const PxVec3& bmin, const PxVec3& bmax, const PxArray& inPlanes); + + // construct the base cube hull from given OBB + ConvexHull(const PxVec3& extent, const PxTransform& transform, const PxArray& inPlanes); + + // copy constructor + ConvexHull(const ConvexHull& srcHull) + : mInputPlanes(srcHull.getInputPlanes()) + { + copyHull(srcHull); + } + + // construct plain hull + ConvexHull(const PxArray& inPlanes) + : mInputPlanes(inPlanes) + { + } + + // finds the candidate plane, returns -1 otherwise + PxI32 findCandidatePlane(float planetestepsilon, float epsilon) const; + + // internal check of the hull integrity + bool assertIntact(float epsilon) const; + + // return vertices + const PxArray& getVertices() const + { + return mVertices; + } + + // return edges + const PxArray& getEdges() const + { + return mEdges; + } + + // return faces + const PxArray& getFacets() const + { + return mFacets; + } + + // return input planes + const PxArray& getInputPlanes() const + { + return mInputPlanes; + } + + // return vertices + PxArray& getVertices() + { + return mVertices; + } + + // return edges + PxArray& getEdges() + { + return mEdges; + } + + // return faces + PxArray& getFacets() + { + return mFacets; + } + + // returns the maximum number of vertices on a face + PxU32 maxNumVertsPerFace() const; + + // copy the hull from source + void copyHull(const ConvexHull& src) + { + mVertices.resize(src.getVertices().size()); + mEdges.resize(src.getEdges().size()); + mFacets.resize(src.getFacets().size()); + + PxMemCopy(mVertices.begin(), src.getVertices().begin(), src.getVertices().size()*sizeof(PxVec3)); + PxMemCopy(mEdges.begin(), src.getEdges().begin(), src.getEdges().size()*sizeof(HalfEdge)); + PxMemCopy(mFacets.begin(), src.getFacets().begin(), src.getFacets().size()*sizeof(PxPlane)); + } + + private: + PxArray mVertices; + PxArray mEdges; + PxArray mFacets; + const PxArray& mInputPlanes; + }; + + //////////////////////////////////////////////////////////////////////////| + // Crops the hull with a provided plane and with given epsilon + // returns new hull if succeeded + ConvexHull* convexHullCrop(const ConvexHull& convex, const PxPlane& slice, float planetestepsilon); + + //////////////////////////////////////////////////////////////////////////| + // three planes intersection + PX_FORCE_INLINE PxVec3 threePlaneIntersection(const PxPlane& p0, const PxPlane& p1, const PxPlane& p2) + { + PxMat33 mp = (PxMat33(p0.n, p1.n, p2.n)).getTranspose(); + PxMat33 mi = (mp).getInverse(); + PxVec3 b(p0.d, p1.d, p2.d); + return -mi.transform(b); + } + + ////////////////////////////////////////////////////////////////////////// + // Compute OBB around given convex hull + bool computeOBBFromConvex(const PxConvexMeshDesc& desc, PxVec3& sides, PxTransform& matrix); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp new file mode 100644 index 0000000..1ebae13 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMesh.cpp @@ -0,0 +1,243 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuCooking.h" +#include "GuCookingConvexMeshBuilder.h" +#include "GuCookingQuickHullConvexHullLib.h" +#include "GuConvexMesh.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxFPU.h" +#include "common/PxInsertionCallback.h" + +using namespace physx; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +// cook convex mesh from given desc, internal function to be shared between create/cook convex mesh +static bool cookConvexMeshInternal(const PxCookingParams& params, const PxConvexMeshDesc& desc_, ConvexMeshBuilder& meshBuilder, ConvexHullLib* hullLib, PxConvexMeshCookingResult::Enum* condition) +{ + if(condition) + *condition = PxConvexMeshCookingResult::eFAILURE; + + if(!desc_.isValid()) + return outputError(__LINE__, "Cooking::cookConvexMesh: user-provided convex mesh descriptor is invalid!"); + + if(params.areaTestEpsilon <= 0.0f) + return outputError(__LINE__, "Cooking::cookConvexMesh: provided cooking parameter areaTestEpsilon is invalid!"); + + if(params.planeTolerance < 0.0f) + return outputError(__LINE__, "Cooking::cookConvexMesh: provided cooking parameter planeTolerance is invalid!"); + + PxConvexMeshDesc desc = desc_; + bool polygonsLimitReached = false; + + // the convex will be cooked from provided points + if(desc_.flags & PxConvexFlag::eCOMPUTE_CONVEX) + { + PX_ASSERT(hullLib); + + // clean up the indices information, it could have been set by accident + desc.flags &= ~PxConvexFlag::e16_BIT_INDICES; + desc.indices.count = 0; + desc.indices.data = NULL; + desc.indices.stride = 0; + desc.polygons.count = 0; + desc.polygons.data = NULL; + desc.polygons.stride = 0; + + PxConvexMeshCookingResult::Enum res = hullLib->createConvexHull(); + if(res == PxConvexMeshCookingResult::eSUCCESS || res == PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED) + { + if(res == PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED) + polygonsLimitReached = true; + + hullLib->fillConvexMeshDesc(desc); + } + else + { + if(res == PxConvexMeshCookingResult::eZERO_AREA_TEST_FAILED) + { + *condition = PxConvexMeshCookingResult::eZERO_AREA_TEST_FAILED; + } + + return false; + } + } + + if(desc.points.count >= 256) + return outputError(__LINE__, "Cooking::cookConvexMesh: user-provided hull must have less than 256 vertices!"); + + if(desc.polygons.count >= 256) + return outputError(__LINE__, "Cooking::cookConvexMesh: user-provided hull must have less than 256 faces!"); + + if (desc.flags & PxConvexFlag::eGPU_COMPATIBLE) + { + if (desc.points.count > 64) + return outputError(__LINE__, "Cooking::cookConvexMesh: GPU-compatible user-provided hull must have less than 65 vertices!"); + + if (desc.polygons.count > 64) + return outputError(__LINE__, "Cooking::cookConvexMesh: GPU-compatible user-provided hull must have less than 65 faces!"); + } + + + if(!meshBuilder.build(desc, params.gaussMapLimit, false, hullLib)) + return false; + + if(condition) + *condition = polygonsLimitReached ? PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED : PxConvexMeshCookingResult::eSUCCESS; + + return true; +} + +static ConvexHullLib* createHullLib(PxConvexMeshDesc& desc, const PxCookingParams& params) +{ + if(desc.flags & PxConvexFlag::eCOMPUTE_CONVEX) + { + const PxU16 gpuMaxVertsLimit = 64; + const PxU16 gpuMaxFacesLimit = 64; + + // GRB supports 64 verts max + if(desc.flags & PxConvexFlag::eGPU_COMPATIBLE) + { + desc.vertexLimit = PxMin(desc.vertexLimit, gpuMaxVertsLimit); + desc.polygonLimit = PxMin(desc.polygonLimit, gpuMaxFacesLimit); + } + + return PX_NEW(QuickHullConvexHullLib) (desc, params); + } + return NULL; +} + +bool immediateCooking::cookConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc_, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition) +{ + PX_FPU_GUARD; + + // choose cooking library if needed + PxConvexMeshDesc desc = desc_; + ConvexHullLib* hullLib = createHullLib(desc, params); + + ConvexMeshBuilder meshBuilder(params.buildGPUData); + if(!cookConvexMeshInternal(params, desc, meshBuilder, hullLib, condition)) + { + PX_DELETE(hullLib); + return false; + } + + // save the cooked results into stream + if(!meshBuilder.save(stream, platformMismatch())) + { + if(condition) + *condition = PxConvexMeshCookingResult::eFAILURE; + + PX_DELETE(hullLib); + return false; + } + + PX_DELETE(hullLib); + return true; +} + +PxConvexMesh* immediateCooking::createConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc_, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition) +{ + PX_FPU_GUARD; + + // choose cooking library if needed + PxConvexMeshDesc desc = desc_; + ConvexHullLib* hullLib = createHullLib(desc, params); + + // cook the mesh + ConvexMeshBuilder meshBuilder(params.buildGPUData); + if(!cookConvexMeshInternal(params, desc, meshBuilder, hullLib, condition)) + { + PX_DELETE(hullLib); + return NULL; + } + + // copy the constructed data into the new mesh + + ConvexHullInitData meshData; + meshBuilder.copy(meshData); + + // insert into physics + PxConvexMesh* convexMesh = static_cast(insertionCallback.buildObjectFromData(PxConcreteType::eCONVEX_MESH, &meshData)); + if(!convexMesh) + { + if(condition) + *condition = PxConvexMeshCookingResult::eFAILURE; + PX_DELETE(hullLib); + return NULL; + } + + PX_DELETE(hullLib); + return convexMesh; +} + +bool immediateCooking::validateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc) +{ + ConvexMeshBuilder mesh(params.buildGPUData); + return mesh.build(desc, params.gaussMapLimit, true); +} + +bool immediateCooking::computeHullPolygons(const PxCookingParams& params, const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices, + PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) +{ + PxVec3* geometry = reinterpret_cast(PxAlloca(sizeof(PxVec3)*mesh.points.count)); + immediateCooking::gatherStrided(mesh.points.data, geometry, mesh.points.count, sizeof(PxVec3), mesh.points.stride); + + PxU32* topology = reinterpret_cast(PxAlloca(sizeof(PxU32)*3*mesh.triangles.count)); + if(mesh.flags & PxMeshFlag::e16_BIT_INDICES) + { + // conversion; 16 bit index -> 32 bit index & stride + PxU32* dest = topology; + const PxU32* pastLastDest = topology + 3*mesh.triangles.count; + const PxU8* source = reinterpret_cast(mesh.triangles.data); + while (dest < pastLastDest) + { + const PxU16 * trig16 = reinterpret_cast(source); + *dest++ = trig16[0]; + *dest++ = trig16[1]; + *dest++ = trig16[2]; + source += mesh.triangles.stride; + } + } + else + { + immediateCooking::gatherStrided(mesh.triangles.data, topology, mesh.triangles.count, sizeof(PxU32) * 3, mesh.triangles.stride); + } + + ConvexMeshBuilder meshBuilder(params.buildGPUData); + if(!meshBuilder.computeHullPolygons(mesh.points.count, geometry, mesh.triangles.count, topology, inCallback, nbVerts, vertices, nbIndices, indices, nbPolygons, hullPolygons)) + return false; + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp new file mode 100644 index 0000000..cfef7b9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.cpp @@ -0,0 +1,612 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuConvexMesh.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxAlloca.h" +#include "GuCooking.h" +#include "GuBigConvexData2.h" +#include "GuBounds.h" +#include "GuCookingVolumeIntegration.h" +#include "GuCookingConvexMeshBuilder.h" +#include "GuCookingBigConvexDataBuilder.h" +#include "CmUtils.h" +#include "foundation/PxVecMath.h" +#include "GuCookingSDF.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +ConvexMeshBuilder::ConvexMeshBuilder(const bool buildGRBData) : hullBuilder(&mHullData, buildGRBData), mSdfData(NULL), mBigConvexData(NULL), mMass(0.0f), mInertia(PxIdentity) +{ +} + +ConvexMeshBuilder::~ConvexMeshBuilder() +{ + PX_DELETE(mSdfData); + PX_DELETE(mBigConvexData); +} + +// load the mesh data from given polygons +bool ConvexMeshBuilder::build(const PxConvexMeshDesc& desc, PxU32 gaussMapVertexLimit, bool validateOnly, ConvexHullLib* hullLib) +{ + if(!desc.isValid()) + return outputError(__LINE__, "Gu::ConvexMesh::loadFromDesc: desc.isValid() failed!"); + + if(!loadConvexHull(desc, hullLib)) + return false; + + // Compute local bounds (*after* hull has been created) + PxBounds3 minMaxBounds; + computeBoundsAroundVertices(minMaxBounds, mHullData.mNbHullVertices, hullBuilder.mHullDataHullVertices); + mHullData.mAABB = CenterExtents(minMaxBounds); + + if(mHullData.mNbHullVertices > gaussMapVertexLimit) + { + if(!computeGaussMaps()) + { + return false; + } + } + + if(validateOnly) + return true; + +// TEST_INTERNAL_OBJECTS + computeInternalObjects(); +//~TEST_INTERNAL_OBJECTS + + if (desc.sdfDesc) + { + computeSDF(desc); + } + + return true; +} + +PX_COMPILE_TIME_ASSERT(sizeof(PxMaterialTableIndex)==sizeof(PxU16)); +bool ConvexMeshBuilder::save(PxOutputStream& stream, bool platformMismatch) const +{ + // Export header + if(!writeHeader('C', 'V', 'X', 'M', PX_CONVEX_VERSION, platformMismatch, stream)) + return false; + + // Export serialization flags + PxU32 serialFlags = 0; + + writeDword(serialFlags, platformMismatch, stream); + + if(!hullBuilder.save(stream, platformMismatch)) + return false; + + // Export local bounds +// writeFloat(geomEpsilon, platformMismatch, stream); + writeFloat(0.0f, platformMismatch, stream); + writeFloat(mHullData.mAABB.getMin(0), platformMismatch, stream); + writeFloat(mHullData.mAABB.getMin(1), platformMismatch, stream); + writeFloat(mHullData.mAABB.getMin(2), platformMismatch, stream); + writeFloat(mHullData.mAABB.getMax(0), platformMismatch, stream); + writeFloat(mHullData.mAABB.getMax(1), platformMismatch, stream); + writeFloat(mHullData.mAABB.getMax(2), platformMismatch, stream); + + // Export mass info + writeFloat(mMass, platformMismatch, stream); + writeFloatBuffer(reinterpret_cast(&mInertia), 9, platformMismatch, stream); + writeFloatBuffer(&mHullData.mCenterOfMass.x, 3, platformMismatch, stream); + + // Export gaussmaps + if(mBigConvexData) + { + writeFloat(1.0f, platformMismatch, stream); //gauss map flag true + BigConvexDataBuilder SVMB(&mHullData, mBigConvexData, hullBuilder.mHullDataHullVertices); + SVMB.save(stream, platformMismatch); + } + else + writeFloat(-1.0f, platformMismatch, stream); //gauss map flag false + + if (mSdfData) + { + writeFloat(1.0f, platformMismatch, stream); //sdf flag true + // Export sdf values + writeFloat(mSdfData->mMeshLower.x, platformMismatch, stream); + writeFloat(mSdfData->mMeshLower.y, platformMismatch, stream); + writeFloat(mSdfData->mMeshLower.z, platformMismatch, stream); + writeFloat(mSdfData->mSpacing, platformMismatch, stream); + writeDword(mSdfData->mDims.x, platformMismatch, stream); + writeDword(mSdfData->mDims.y, platformMismatch, stream); + writeDword(mSdfData->mDims.z, platformMismatch, stream); + writeDword(mSdfData->mNumSdfs, platformMismatch, stream); + + writeDword(mSdfData->mNumSubgridSdfs, platformMismatch, stream); + writeDword(mSdfData->mNumStartSlots, platformMismatch, stream); + writeDword(mSdfData->mSubgridSize, platformMismatch, stream); + writeDword(mSdfData->mSdfSubgrids3DTexBlockDim.x, platformMismatch, stream); + writeDword(mSdfData->mSdfSubgrids3DTexBlockDim.y, platformMismatch, stream); + writeDword(mSdfData->mSdfSubgrids3DTexBlockDim.z, platformMismatch, stream); + + writeFloat(mSdfData->mSubgridsMinSdfValue, platformMismatch, stream); + writeFloat(mSdfData->mSubgridsMaxSdfValue, platformMismatch, stream); + writeDword(mSdfData->mBytesPerSparsePixel, platformMismatch, stream); + + writeFloatBuffer(mSdfData->mSdf, mSdfData->mNumSdfs, platformMismatch, stream); + writeByteBuffer(mSdfData->mSubgridSdf, mSdfData->mNumSubgridSdfs, stream); + writeIntBuffer(mSdfData->mSubgridStartSlots, mSdfData->mNumStartSlots, platformMismatch, stream); + } + else + writeFloat(-1.0f, platformMismatch, stream); //sdf flag false + +// TEST_INTERNAL_OBJECTS + writeFloat(mHullData.mInternal.mRadius, platformMismatch, stream); + writeFloat(mHullData.mInternal.mExtents[0], platformMismatch, stream); + writeFloat(mHullData.mInternal.mExtents[1], platformMismatch, stream); + writeFloat(mHullData.mInternal.mExtents[2], platformMismatch, stream); +//~TEST_INTERNAL_OBJECTS + return true; +} + +////////////////////////////////////////////////////////////////////////// +// instead of saving the data into stream, we copy the mesh data +// into internal Gu::ConvexMesh. +bool ConvexMeshBuilder::copy(Gu::ConvexHullInitData& hullData) +{ + // hull builder data copy + PxU32 nb = 0; + hullBuilder.copy(hullData.mHullData, nb); + hullData.mNb = nb; + + hullData.mInertia = mInertia; + hullData.mMass = mMass; + + // mass props + hullData.mHullData.mAABB = mHullData.mAABB; + hullData.mHullData.mCenterOfMass = mHullData.mCenterOfMass; + + // big convex data + if(mBigConvexData) + { + hullData.mHullData.mBigConvexRawData = &mBigConvexData->mData; + hullData.mBigConvexData = mBigConvexData; + mBigConvexData = NULL; + } + else + { + hullData.mHullData.mBigConvexRawData = NULL; + hullData.mBigConvexData = NULL; + } + + if (mSdfData) + { + hullData.mHullData.mSdfData = mSdfData; + hullData.mSdfData = mSdfData; + } + else + { + hullData.mHullData.mSdfData = NULL; + hullData.mSdfData = NULL; + mSdfData = NULL; + } + + // internal data + hullData.mHullData.mInternal.mRadius = mHullData.mInternal.mRadius; + hullData.mHullData.mInternal.mExtents[0] = mHullData.mInternal.mExtents[0]; + hullData.mHullData.mInternal.mExtents[1] = mHullData.mInternal.mExtents[1]; + hullData.mHullData.mInternal.mExtents[2] = mHullData.mInternal.mExtents[2]; + + return true; +} + +// compute mass and inertia of the convex mesh +void ConvexMeshBuilder::computeMassInfo(bool lowerPrecision) +{ + if(mMass <= 0.0f) //not yet computed. + { + PxIntegrals integrals; + PxConvexMeshDesc meshDesc; + meshDesc.points.count = mHullData.mNbHullVertices; + meshDesc.points.data = hullBuilder.mHullDataHullVertices; + meshDesc.points.stride = sizeof(PxVec3); + + meshDesc.polygons.data = hullBuilder.mHullDataPolygons; + meshDesc.polygons.stride = sizeof(Gu::HullPolygonData); + meshDesc.polygons.count = hullBuilder.mHull->mNbPolygons; + + meshDesc.indices.data = hullBuilder.mHullDataVertexData8; + + // using the centroid of the convex for the volume integration solved accuracy issues in cases where the inertia tensor + // ended up close to not being positive definite and after a few further transforms the diagonalized inertia tensor ended + // up with negative values. + PxVec3 mean(0.0f); + for(PxU32 i=0; i < mHullData.mNbHullVertices; i++) + mean += hullBuilder.mHullDataHullVertices[i]; + mean *= (1.0f / mHullData.mNbHullVertices); + + if(computeVolumeIntegralsEberly(meshDesc, 1.0f, integrals, mean, lowerPrecision)) + { + integrals.getOriginInertia(mInertia); + mHullData.mCenterOfMass = integrals.COM; + + //note: the mass will be negative for an inside-out mesh! + if(mInertia.column0.isFinite() && mInertia.column1.isFinite() && mInertia.column2.isFinite() + && mHullData.mCenterOfMass.isFinite() && PxIsFinite(PxReal(integrals.mass))) + { + if (integrals.mass < 0) + { + outputError(__LINE__, "Gu::ConvexMesh: Mesh has a negative volume! Is it open or do (some) faces have reversed winding? (Taking absolute value.)"); + integrals.mass = -integrals.mass; + mInertia = -mInertia; + } + + mMass = PxReal(integrals.mass); //set mass to valid value. + return; + } + } + outputError(__LINE__, "Gu::ConvexMesh: Error computing mesh mass properties!\n"); + } +} + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4996) // permitting use of gatherStrided until we have a replacement. +#endif + +bool ConvexMeshBuilder::loadConvexHull(const PxConvexMeshDesc& desc, ConvexHullLib* hullLib) +{ + // gather points + PxVec3* geometry = reinterpret_cast(PxAlloca(sizeof(PxVec3)*desc.points.count)); + immediateCooking::gatherStrided(desc.points.data, geometry, desc.points.count, sizeof(PxVec3), desc.points.stride); + + PxU32* topology = NULL; + + // gather indices + // store the indices into topology if we have the polygon data + if(desc.indices.data) + { + topology = reinterpret_cast(PxAlloca(sizeof(PxU32)*desc.indices.count)); + if (desc.flags & PxConvexFlag::e16_BIT_INDICES) + { + // conversion; 16 bit index -> 32 bit index & stride + PxU32* dest = topology; + const PxU32* pastLastDest = topology + desc.indices.count; + const PxU8* source = reinterpret_cast(desc.indices.data); + while (dest < pastLastDest) + { + const PxU16 * trig16 = reinterpret_cast(source); + *dest++ = *trig16; + source += desc.indices.stride; + } + } + else + { + immediateCooking::gatherStrided(desc.indices.data, topology, desc.indices.count, sizeof(PxU32), desc.indices.stride); + } + } + + // gather polygons + PxHullPolygon* hullPolygons = NULL; + if(desc.polygons.data) + { + hullPolygons = reinterpret_cast(PxAlloca(sizeof(PxHullPolygon)*desc.polygons.count)); + immediateCooking::gatherStrided(desc.polygons.data,hullPolygons,desc.polygons.count,sizeof(PxHullPolygon),desc.polygons.stride); + + // if user polygons, make sure the largest one is the first one + if (!hullLib) + { + PxU32 largestPolygon = 0; + for (PxU32 i = 1; i < desc.polygons.count; i++) + { + if(hullPolygons[i].mNbVerts > hullPolygons[largestPolygon].mNbVerts) + largestPolygon = i; + } + if(largestPolygon != 0) + { + PxHullPolygon movedPolygon = hullPolygons[0]; + hullPolygons[0] = hullPolygons[largestPolygon]; + hullPolygons[largestPolygon] = movedPolygon; + } + } + } + + const bool doValidation = desc.flags & PxConvexFlag::eDISABLE_MESH_VALIDATION ? false : true; + if(!hullBuilder.init(desc.points.count, geometry, topology, desc.indices.count, desc.polygons.count, hullPolygons, doValidation, hullLib)) + return outputError(__LINE__, "Gu::ConvexMesh::loadConvexHull: convex hull init failed!"); + + computeMassInfo(desc.flags & PxConvexFlag::eFAST_INERTIA_COMPUTATION); + + return true; +} + +#if PX_VC +#pragma warning(pop) +#endif + +// compute polygons from given triangles. This is support function used in extensions. We do not accept triangles as an input for convex mesh desc. +bool ConvexMeshBuilder::computeHullPolygons(const PxU32& nbVerts,const PxVec3* verts, const PxU32& nbTriangles, const PxU32* triangles, PxAllocatorCallback& inAllocator, + PxU32& outNbVerts, PxVec3*& outVertices , PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& polygons) +{ + if(!hullBuilder.computeHullPolygons(nbVerts,verts,nbTriangles,triangles)) + return outputError(__LINE__, "ConvexMeshBuilder::computeHullPolygons: compute convex hull polygons failed. Provided triangles dont form a convex hull."); + + outNbVerts = hullBuilder.mHull->mNbHullVertices; + nbPolygons = hullBuilder.mHull->mNbPolygons; + + outVertices = reinterpret_cast(inAllocator.allocate(outNbVerts*sizeof(PxVec3),"PxVec3",__FILE__,__LINE__)); + PxMemCopy(outVertices,hullBuilder.mHullDataHullVertices,outNbVerts*sizeof(PxVec3)); + + nbIndices = 0; + for (PxU32 i = 0; i < nbPolygons; i++) + { + nbIndices += hullBuilder.mHullDataPolygons[i].mNbVerts; + } + + indices = reinterpret_cast(inAllocator.allocate(nbIndices*sizeof(PxU32),"PxU32",__FILE__,__LINE__)); + for (PxU32 i = 0; i < nbIndices; i++) + { + indices[i] = hullBuilder.mHullDataVertexData8[i]; + } + + polygons = reinterpret_cast(inAllocator.allocate(nbPolygons*sizeof(PxHullPolygon),"PxHullPolygon",__FILE__,__LINE__)); + + for (PxU32 i = 0; i < nbPolygons; i++) + { + const Gu::HullPolygonData& polygonData = hullBuilder.mHullDataPolygons[i]; + PxHullPolygon& outPolygon = polygons[i]; + outPolygon.mPlane[0] = polygonData.mPlane.n.x; + outPolygon.mPlane[1] = polygonData.mPlane.n.y; + outPolygon.mPlane[2] = polygonData.mPlane.n.z; + outPolygon.mPlane[3] = polygonData.mPlane.d; + + outPolygon.mNbVerts = polygonData.mNbVerts; + outPolygon.mIndexBase = polygonData.mVRef8; + + for (PxU32 j = 0; j < polygonData.mNbVerts; j++) + { + PX_ASSERT(indices[outPolygon.mIndexBase + j] == hullBuilder.mHullDataVertexData8[polygonData.mVRef8+j]); + } + } + + return true; +} + +// compute big convex data +bool ConvexMeshBuilder::computeGaussMaps() +{ + // The number of polygons is limited to 256 because the gaussmap encode 256 polys maximum + + PxU32 density = 16; + // density = 64; + // density = 8; + // density = 2; + + PX_DELETE(mBigConvexData); + PX_NEW_SERIALIZED(mBigConvexData,BigConvexData); + BigConvexDataBuilder SVMB(&mHullData, mBigConvexData, hullBuilder.mHullDataHullVertices); + // valencies we need to compute first, they are needed for min/max precompute + SVMB.computeValencies(hullBuilder); + SVMB.precompute(density); + + return true; +} + +// TEST_INTERNAL_OBJECTS + +static void ComputeInternalExtent(Gu::ConvexHullData& data, const Gu::HullPolygonData* hullPolys) +{ + const PxVec3 e = data.mAABB.getMax() - data.mAABB.getMin(); + + // PT: For that formula, see %SDKRoot%\InternalDocumentation\Cooking\InternalExtents.png + const float r = data.mInternal.mRadius / sqrtf(3.0f); + + const float epsilon = 1E-7f; + + const PxU32 largestExtent = PxLargestAxis(e); + PxU32 e0 = PxGetNextIndex3(largestExtent); + PxU32 e1 = PxGetNextIndex3(e0); + if(e[e0] < e[e1]) + PxSwap(e0,e1); + + data.mInternal.mExtents[0] = FLT_MAX; + data.mInternal.mExtents[1] = FLT_MAX; + data.mInternal.mExtents[2] = FLT_MAX; + + // PT: the following code does ray-vs-plane raycasts. + + // find the largest box along the largest extent, with given internal radius + for(PxU32 i = 0; i < data.mNbPolygons; i++) + { + // concurrent with search direction + const float d = hullPolys[i].mPlane.n[largestExtent]; + if((-epsilon < d && d < epsilon)) + continue; + + const float numBase = -hullPolys[i].mPlane.d - hullPolys[i].mPlane.n.dot(data.mCenterOfMass); + const float denBase = 1.0f/hullPolys[i].mPlane.n[largestExtent]; + const float numn0 = r * hullPolys[i].mPlane.n[e0]; + const float numn1 = r * hullPolys[i].mPlane.n[e1]; + + float num = numBase - numn0 - numn1; + float ext = PxMax(fabsf(num*denBase), r); + if(ext < data.mInternal.mExtents[largestExtent]) + data.mInternal.mExtents[largestExtent] = ext; + + num = numBase - numn0 + numn1; + ext = PxMax(fabsf(num *denBase), r); + if(ext < data.mInternal.mExtents[largestExtent]) + data.mInternal.mExtents[largestExtent] = ext; + + num = numBase + numn0 + numn1; + ext = PxMax(fabsf(num *denBase), r); + if(ext < data.mInternal.mExtents[largestExtent]) + data.mInternal.mExtents[largestExtent] = ext; + + num = numBase + numn0 - numn1; + ext = PxMax(fabsf(num *denBase), r); + if(ext < data.mInternal.mExtents[largestExtent]) + data.mInternal.mExtents[largestExtent] = ext; + } + + // Refine the box along e0,e1 + for(PxU32 i = 0; i < data.mNbPolygons; i++) + { + const float denumAdd = hullPolys[i].mPlane.n[e0] + hullPolys[i].mPlane.n[e1]; + const float denumSub = hullPolys[i].mPlane.n[e0] - hullPolys[i].mPlane.n[e1]; + + const float numBase = -hullPolys[i].mPlane.d - hullPolys[i].mPlane.n.dot(data.mCenterOfMass); + const float numn0 = data.mInternal.mExtents[largestExtent] * hullPolys[i].mPlane.n[largestExtent]; + + if(!(-epsilon < denumAdd && denumAdd < epsilon)) + { + float num = numBase - numn0; + float ext = PxMax(fabsf(num/ denumAdd), r); + if(ext < data.mInternal.mExtents[e0]) + data.mInternal.mExtents[e0] = ext; + + num = numBase + numn0; + ext = PxMax(fabsf(num / denumAdd), r); + if(ext < data.mInternal.mExtents[e0]) + data.mInternal.mExtents[e0] = ext; + } + + if(!(-epsilon < denumSub && denumSub < epsilon)) + { + float num = numBase - numn0; + float ext = PxMax(fabsf(num / denumSub), r); + if(ext < data.mInternal.mExtents[e0]) + data.mInternal.mExtents[e0] = ext; + + num = numBase + numn0; + ext = PxMax(fabsf(num / denumSub), r); + if(ext < data.mInternal.mExtents[e0]) + data.mInternal.mExtents[e0] = ext; + } + } + data.mInternal.mExtents[e1] = data.mInternal.mExtents[e0]; +} + +////////////////////////////////////////////////////////////////////////// +// compute internal objects, get the internal extent and radius +void ConvexMeshBuilder::computeInternalObjects() +{ + const Gu::HullPolygonData* hullPolys = hullBuilder.mHullDataPolygons; + Gu::ConvexHullData& data = mHullData; + + // compute the internal radius + data.mInternal.mRadius = FLT_MAX; + for(PxU32 i=0;i triangleIndice(numTotalTriangles * 3); + + PxU32 startIndex = 0; + for (PxU32 i = 0; i < nbPolygons; ++i) + { + const Gu::HullPolygonData& polyData = hullPolys[i]; + const PxU32 nbTriangles = polyData.mNbVerts - 2; + const PxU8 vref0 = polygons[polyData.mVRef8]; + + for (PxU32 j = 0; j < nbTriangles; ++j) + { + const PxU32 index = startIndex + j * 3; + + const PxU32 vref1 = polygons[polyData.mVRef8 + 0 + j + 1]; + const PxU32 vref2 = polygons[polyData.mVRef8 + 0 + j + 2]; + triangleIndice[index + 0] = vref0; + triangleIndice[index + 1] = vref1; + triangleIndice[index + 2] = vref2; + + } + startIndex += nbTriangles * 3; + } + + PxArray sdfData; + PxArray sdfDataSubgrids; + PxArray sdfSubgridsStartSlots; + + PxTriangleMeshDesc triDesc; + triDesc.points.count = nbVerts; + triDesc.points.stride = sizeof(PxVec3); + triDesc.points.data = verts; + triDesc.triangles.count = numTotalTriangles; + triDesc.triangles.stride = sizeof(PxU32) * 3; + triDesc.triangles.data = triangleIndice.begin(); + triDesc.flags &= (~PxMeshFlag::e16_BIT_INDICES); + triDesc.sdfDesc = desc.sdfDesc; + + buildSDF(triDesc, sdfData, sdfDataSubgrids, sdfSubgridsStartSlots); + + PxSDFDesc& sdfDesc = *desc.sdfDesc; + + PxReal* sdf = mSdfData->allocateSdfs(sdfDesc.meshLower, sdfDesc.spacing, sdfDesc.dims.x, sdfDesc.dims.y, sdfDesc.dims.z, + sdfDesc.subgridSize, sdfDesc.sdfSubgrids3DTexBlockDim.x, sdfDesc.sdfSubgrids3DTexBlockDim.y, sdfDesc.sdfSubgrids3DTexBlockDim.z, + sdfDesc.subgridsMinSdfValue, sdfDesc.subgridsMaxSdfValue, sdfDesc.bitsPerSubgridPixel); + + //copy, and compact to get rid of strides: + immediateCooking::gatherStrided(sdfDesc.sdf.data, sdf, sdfDesc.dims.x*sdfDesc.dims.y*sdfDesc.dims.z, sizeof(PxReal), sdfDesc.sdf.stride); + +} +//~TEST_INTERNAL_OBJECTS diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.h new file mode 100644 index 0000000..bc1ad8c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexMeshBuilder.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_CONVEX_MESH_BUILDER_H +#define GU_COOKING_CONVEX_MESH_BUILDER_H + +#include "cooking/PxCooking.h" + +#include "GuConvexMeshData.h" +#include "GuCookingConvexPolygonsBuilder.h" +#include "GuSDF.h" + +namespace physx +{ + class BigConvexData; + namespace Gu + { + struct ConvexHullInitData; + } + + ////////////////////////////////////////////////////////////////////////// + // Convex mesh builder, creates the convex mesh from given polygons and creates internal data + class ConvexMeshBuilder + { + public: + ConvexMeshBuilder(const bool buildGRBData); + ~ConvexMeshBuilder(); + + // loads the computed or given convex hull from descriptor. + // the descriptor does contain polygons directly, triangles are not allowed + bool build(const PxConvexMeshDesc&, PxU32 gaussMapVertexLimit, bool validateOnly = false, ConvexHullLib* hullLib = NULL); + + // save the convex mesh into stream + bool save(PxOutputStream& stream, bool platformMismatch) const; + + // copy the convex mesh into internal convex mesh, which can be directly used then + bool copy(Gu::ConvexHullInitData& convexData); + + // loads the convex mesh from given polygons + bool loadConvexHull(const PxConvexMeshDesc&, ConvexHullLib* hullLib); + + // computed hull polygons from given triangles + bool computeHullPolygons(const PxU32& nbVerts,const PxVec3* verts, const PxU32& nbTriangles, const PxU32* triangles, PxAllocatorCallback& inAllocator, + PxU32& outNbVerts, PxVec3*& outVertices, PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& polygons); + + // compute big convex data + bool computeGaussMaps(); + + // compute mass, inertia tensor + void computeMassInfo(bool lowerPrecision); +// TEST_INTERNAL_OBJECTS + // internal objects + void computeInternalObjects(); +//~TEST_INTERNAL_OBJECTS + + void computeSDF(const PxConvexMeshDesc& desc); + + // set big convex data + void setBigConvexData(BigConvexData* data) { mBigConvexData = data; } + + mutable ConvexPolygonsBuilder hullBuilder; + + protected: + Gu::ConvexHullData mHullData; + Gu::SDF* mSdfData; + BigConvexData* mBigConvexData; //!< optional, only for large meshes! PT: redundant with ptr in chull data? Could also be end of other buffer + PxReal mMass; //this is mass assuming a unit density that can be scaled by instances! + PxMat33 mInertia; //in local space of mesh! + + }; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp new file mode 100644 index 0000000..be2e610 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.cpp @@ -0,0 +1,1331 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxUserAllocated.h" +#include "GuAdjacencies.h" +#include "GuMeshCleaner.h" +#include "GuVertexReducer.h" +#include "foundation/PxArray.h" + +#include "GuCookingConvexPolygonsBuilder.h" + +using namespace physx; +using namespace Gu; + +#define USE_PRECOMPUTED_HULL_PROJECTION + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** +* Computes the center of the hull. It should be inside it ! +* \param center [out] hull center +* \return true if success +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +static bool computeGeomCenter(PxVec3& center, PxU32 numFaces, const IndexedTriangle32* PX_RESTRICT faces, const PxVec3* PX_RESTRICT hullVerts, PxU32 nbHullVertices) +{ + if (!nbHullVertices || !hullVerts) + return false; + + // Use the topological method + float totalArea = 0.0f; + center = PxVec3(0); + for (PxU32 i = 0; i < numFaces; i++) + { + IndexedTriangle32 curTri(faces[i].mRef[0], faces[i].mRef[1], faces[i].mRef[2]); + const float area = curTri.area(hullVerts); + PxVec3 curCenter; curTri.center(hullVerts, curCenter); + center += area * curCenter; + totalArea += area; + } + center /= totalArea; + + return true; +} + +////////////////////////////////////////////////////////////////////////// +//! A generic couple structure +class Pair : public PxUserAllocated +{ +public: + PX_FORCE_INLINE Pair() {} + PX_FORCE_INLINE Pair(PxU32 i0, PxU32 i1) : id0(i0), id1(i1) {} + PX_FORCE_INLINE ~Pair() {} + + //! Operator for "if(Pair==Pair)" + PX_FORCE_INLINE bool operator==(const Pair& p) const { return (id0==p.id0) && (id1==p.id1); } + //! Operator for "if(Pair!=Pair)" + PX_FORCE_INLINE bool operator!=(const Pair& p) const { return (id0!=p.id0) || (id1!=p.id1); } + + PxU32 id0; //!< First index of the pair + PxU32 id1; //!< Second index of the pair +}; +PX_COMPILE_TIME_ASSERT(sizeof(Pair)==8); + +////////////////////////////////////////////////////////////////////////// +// construct a plane +template +PX_INLINE PxPlane PlaneEquation(const T& t, const PxVec3* verts) +{ + const PxVec3& p0 = verts[t.mRef[0]]; + const PxVec3& p1 = verts[t.mRef[1]]; + const PxVec3& p2 = verts[t.mRef[2]]; + return PxPlane(p0, p1, p2); +} + +////////////////////////////////////////////////////////////////////////// +// negate plane +static PX_FORCE_INLINE void negatePlane(HullPolygonData& data) +{ + data.mPlane.n = -data.mPlane.n; + data.mPlane.d = -data.mPlane.d; +} + +////////////////////////////////////////////////////////////////////////// +// Inverse a buffer in-place +static bool inverseBuffer(PxU32 nbEntries, PxU8* entries) +{ + if(!nbEntries || !entries) return false; + + for(PxU32 i=0; i < (nbEntries>>1); i++) + PxSwap(entries[i], entries[nbEntries-1-i]); + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// Extracts a line-strip from a list of non-sorted line-segments (slow) +static bool findLineStrip(PxArray& lineStrip, const PxArray& lineSegments) +{ + // Ex: + // + // 4-2 + // 0-1 + // 2-3 + // 4-0 + // 7-3 + // 7-1 + // + // => 0-1-7-3-2-4-0 + + // 0-0-1-1-2-2-3-3-4-4-7-7 + + // 0-1 + // 0-4 + // 1-7 + // 2-3 + // 2-4 + // 3-7 + + // Naive implementation below + + PxArray Copy(lineSegments); + +RunAgain: + { + PxU32 nbSegments = Copy.size(); + for(PxU32 j=0;j remove both + PX_ASSERT(Copy.size()>=2); + Copy.remove(i); + Copy.remove(j); + goto RunAgain; + } + } + } + // Goes through when everything's fine + } + + PxU32 ref0 = 0xffffffff; + PxU32 ref1 = 0xffffffff; + if(Copy.size()>=1) + { + Pair* Segments = Copy.begin(); + if(Segments) + { + ref0 = Segments->id0; + ref1 = Segments->id1; + lineStrip.pushBack(ref0); + lineStrip.pushBack(ref1); + PX_ASSERT(Copy.size()>=1); + Copy.remove(0); + } + } + +Wrap: + // Look for same vertex ref in remaining segments + PxU32 nb = Copy.size(); + if(!nb) + { + // ### check the line is actually closed? + return true; + } + + for(PxU32 i=0;i r1 - x + lineStrip.pushBack(newRef0); // Output the other reference + ref0 = newRef1; + ref1 = newRef0; + Copy.remove(i); + goto Wrap; + } + } + return false; +} + +////////////////////////////////////////////////////////////////////////// +// Test for duplicate triangles +PX_COMPILE_TIME_ASSERT(sizeof(IndexedTriangle32)==sizeof(PxVec3)); // ... +static bool TestDuplicateTriangles(PxU32& nbFaces, IndexedTriangle32* faces, bool repair) +{ + if(!nbFaces || !faces) + return true; + + IndexedTriangle32* indices32 = reinterpret_cast(PxAlloca(nbFaces*sizeof(IndexedTriangle32))); + for(PxU32 i=0;i(indices32), nbFaces); + REDUCEDCLOUD rc; + reducer.reduce(&rc); + if(rc.NbRVerts(&rc.RVerts[i]); + faces[i].mRef[0] = curTri->mRef[0]; + faces[i].mRef[1] = curTri->mRef[1]; + faces[i].mRef[2] = curTri->mRef[2]; + } + } + return false; // Test failed + } + return true; // Test succeeded +} + +////////////////////////////////////////////////////////////////////////// +// plane culling test +static PX_FORCE_INLINE bool testCulling(const IndexedTriangle32& triangle, const PxVec3* verts, const PxVec3& center) +{ + const PxPlane plane(verts[triangle.mRef[0]], verts[triangle.mRef[1]], verts[triangle.mRef[2]]); + return plane.distance(center)>0.0f; +} + +////////////////////////////////////////////////////////////////////////// +// face normals test +static bool TestUnifiedNormals(PxU32 nbVerts, const PxVec3* verts, PxU32 nbFaces, IndexedTriangle32* faces, bool repair) +{ + if(!nbVerts || !verts || !nbFaces || !faces) + return false; + + // Unify normals so that all hull faces are well oriented + + // Compute geometric center - we need a vertex inside the hull + const float coeff = 1.0f / float(nbVerts); + PxVec3 geomCenter(0.0f, 0.0f, 0.0f); + for(PxU32 i=0;imRef, 0.0f); + if (!cleaner.mNbTris) + return false; + + nbVerts = cleaner.mNbVerts; + nbFaces = cleaner.mNbTris; + + PxMemCopy(verts, cleaner.mVerts, cleaner.mNbVerts*sizeof(PxVec3)); + + for (PxU32 i = 0; i < cleaner.mNbTris; i++) + { + faces[i].mRef[0] = cleaner.mIndices[i * 3 + 0]; + faces[i].mRef[1] = cleaner.mIndices[i * 3 + 1]; + faces[i].mRef[2] = cleaner.mIndices[i * 3 + 2]; + } + + // Get rid of duplicates + TestDuplicateTriangles(nbFaces, faces, true); + + // Unify normals + TestUnifiedNormals(nbVerts, verts, nbFaces, faces, true); + + // Remove zero-area triangles + // TestZeroAreaTriangles(nbFaces, faces, verts, true); + + // Unify normals again + TestUnifiedNormals(nbVerts, verts, nbFaces, faces, true); + + // Get rid of duplicates again + TestDuplicateTriangles(nbFaces, faces, true); + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// check the newly constructed faces +static bool CheckFaces(PxU32 nbFaces, const IndexedTriangle32* faces, PxU32 nbVerts, const PxVec3* verts) +{ + // Remove const since we use functions that can do both testing & repairing. But we won't change the data. + IndexedTriangle32* f = const_cast(faces); + + // Test duplicate faces + if(!TestDuplicateTriangles(nbFaces, f, false)) + return false; + + // Test unified normals + if(!TestUnifiedNormals(nbVerts, verts, nbFaces, f, false)) + return false; + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// compute the newell plane from the face verts +static bool computeNewellPlane(PxPlane& plane, PxU32 nbVerts, const PxU8* indices, const PxVec3* verts) +{ + if(!nbVerts || !indices || !verts) + return false; + + PxVec3 centroid(0,0,0), normal(0,0,0); + for(PxU32 i=nbVerts-1, j=0; j& polygon_data, const ConvexPolygonsBuilder& hull, PxArray& triangle_data, PxArray& redundantVertices) +{ + const PxU32* dFaces = reinterpret_cast(hull.getFaces()); + bool needToSplitPolygons = false; + + bool* polygonMarkers = reinterpret_cast(PxAlloca(nb_polygons*sizeof(bool))); + PxMemZero(polygonMarkers, nb_polygons*sizeof(bool)); + + bool* redundancyMarkers = reinterpret_cast(PxAlloca(redundantVertices.size()*sizeof(bool))); + PxMemZero(redundancyMarkers, redundantVertices.size()*sizeof(bool)); + + // parse through the redundant vertices and if we cannot remove them split just the actual polygon if possible + PxArray polygonsContainer; + PxU32 numEntries = 0; + for (PxU32 i = redundantVertices.size(); i--;) + { + numEntries = 0; + polygonsContainer.clear(); + // go through polygons, if polygons does have only 3 verts we cannot remove any vertex from it, try to decompose the second one + PxU32* Data = polygon_data.begin(); + for(PxU32 t=0;t=3); // Else something very wrong happened... + + for(PxU32 j=0;j newPolygon_data; + PxArray newTriangle_data; + PxU32 newNb_polygons = 0; + + PxU32* data = polygon_data.begin(); + PxU32* triData = triangle_data.begin(); + for(PxU32 i=0;i& polygon_data, const ConvexHull& hull) +* \param nb_polygons [out] number of extracted polygons +* \param polygon_data [out] polygon data: (Nb indices, index 0, index 1... index N)(Nb indices, index 0, index 1... index N)(...) +* \param hull [in] convex hull +* \param triangle_data [out] triangle data +* \param rendundantVertices [out] redundant vertices found inside the polygons - we want to remove them because of PCM +* \return true if success +*/ +static bool extractHullPolygons(PxU32& nb_polygons, PxArray& polygon_data, const ConvexPolygonsBuilder& hull, PxArray* triangle_data, PxArray& rendundantVertices) +{ + PxU32 nbFaces = hull.getNbFaces(); + const PxVec3* hullVerts = hull.mHullDataHullVertices; + const PxU32 nbVertices = hull.mHull->mNbHullVertices; + + const PxU16* wFaces = NULL; + const PxU32* dFaces = reinterpret_cast(hull.getFaces()); + PX_ASSERT(wFaces || dFaces); + + ADJACENCIESCREATE create; + create.NbFaces = nbFaces; + create.DFaces = dFaces; + create.WFaces = wFaces; + create.Verts = hullVerts; + //Create.Epsilon = 0.01f; // PT: trying to fix Rob Elam bug. Also fixes TTP 2467 + // Create.Epsilon = 0.001f; // PT: for "Bruno's bug" + create.Epsilon = 0.005f; // PT: middle-ground seems to fix both. Expose this param? + + + AdjacenciesBuilder adj; + if(!adj.Init(create)) return false; + + PxU32 nbBoundaryEdges = adj.ComputeNbBoundaryEdges(); + if(nbBoundaryEdges) return false; // A valid hull shouldn't have open edges!! + + bool* markers = reinterpret_cast(PxAlloca(nbFaces*sizeof(bool))); + PxMemZero(markers, nbFaces*sizeof(bool)); + + PxU8* vertexMarkers = reinterpret_cast(PxAlloca(nbVertices*sizeof(PxU8))); + PxMemZero(vertexMarkers, nbVertices*sizeof(PxU8)); + + PxU32 currentFace = 0; // Start with first triangle + nb_polygons = 0; + do + { + currentFace = 0; + while(currentFace& indices, const AdjTriangle* faces, PxU32 current, bool* inMarkers) + { + if(inMarkers[current]) return; + inMarkers[current] = true; + + indices.pushBack(current); + const AdjTriangle& AT = faces[current]; + + // We can floodfill through inactive edges since the mesh is convex (inactive==planar) + if(!AT.HasActiveEdge01()) FloodFill(indices, faces, AT.GetAdjTri(EDGE01), inMarkers); + if(!AT.HasActiveEdge20()) FloodFill(indices, faces, AT.GetAdjTri(EDGE02), inMarkers); + if(!AT.HasActiveEdge12()) FloodFill(indices, faces, AT.GetAdjTri(EDGE12), inMarkers); + } + + static bool GetNeighborFace(PxU32 index,PxU32 triangleIndex,const AdjTriangle* faces, const PxU32* dfaces, PxU32& neighbor, PxU32& current) + { + PxU32 currentIndex = index; + PxU32 previousIndex = index; + bool firstFace = true; + bool next = true; + while (next) + { + const AdjTriangle& currentAT = faces[currentIndex]; + PxU32 refTr0 = dfaces[currentIndex*3 + 0]; + PxU32 refTr1 = dfaces[currentIndex*3 + 1]; + + PxU32 edge[2]; + edge[0] = 1; + edge[1] = 2; + if(triangleIndex == refTr0) + { + edge[0] = 0; + edge[1] = 1; + } + else + { + if(triangleIndex == refTr1) + { + edge[0] = 0; + edge[1] = 2; + } + } + + if(currentAT.HasActiveEdge(edge[0]) && currentAT.HasActiveEdge(edge[1])) + { + return false; + } + + if(!currentAT.HasActiveEdge(edge[0]) && !currentAT.HasActiveEdge(edge[1])) + { + // not interested in testing transition vertices + if(currentIndex == index) + { + return false; + } + + // transition one + for (PxU32 i = 0; i < 2; i++) + { + PxU32 testIndex = currentAT.GetAdjTri(SharedEdgeIndex(edge[i])); + + // exit if we circle around the vertex back to beginning + if(testIndex == index && previousIndex != index) + { + return false; + } + + if(testIndex != previousIndex) + { + // move to next + previousIndex = currentIndex; + currentIndex = testIndex; + break; + } + } + } + else + { + if(!currentAT.HasActiveEdge(edge[0])) + { + PxU32 t = edge[0]; + edge[0] = edge[1]; + edge[1] = t; + } + + if(currentAT.HasActiveEdge(edge[0])) + { + PxU32 testIndex = currentAT.GetAdjTri(SharedEdgeIndex(edge[0])); + if(firstFace) + { + firstFace = false; + } + else + { + neighbor = testIndex; + current = currentIndex; + return true; + } + } + + if(!currentAT.HasActiveEdge(edge[1])) + { + PxU32 testIndex = currentAT.GetAdjTri(SharedEdgeIndex(edge[1])); + if(testIndex != index) + { + previousIndex = currentIndex; + currentIndex = testIndex; + } + } + } + + } + + return false; + } + + static bool CheckFloodFillFace(PxU32 index,const AdjTriangle* faces, const PxU32* dfaces) + { + if(!dfaces) + return true; + + const AdjTriangle& checkedAT = faces[index]; + + PxU32 refTr0 = dfaces[index*3 + 0]; + PxU32 refTr1 = dfaces[index*3 + 1]; + PxU32 refTr2 = dfaces[index*3 + 2]; + + for (PxU32 i = 0; i < 3; i++) + { + if(!checkedAT.HasActiveEdge(i)) + { + PxU32 testTr0 = refTr1; + PxU32 testTr1 = refTr2; + PxU32 testIndex0 = 0; + PxU32 testIndex1 = 1; + if(i == 0) + { + testTr0 = refTr0; + testTr1 = refTr1; + testIndex0 = 1; + testIndex1 = 2; + } + else + { + if(i == 1) + { + testTr0 = refTr0; + testTr1 = refTr2; + testIndex0 = 0; + testIndex1 = 2; + } + } + + PxU32 adjFaceTested = checkedAT.GetAdjTri(SharedEdgeIndex(testIndex0)); + + PxU32 neighborIndex00; + PxU32 neighborIndex01; + bool found0 = GetNeighborFace(index,testTr0,faces,dfaces, neighborIndex00, neighborIndex01); + PxU32 neighborIndex10; + PxU32 neighborIndex11; + bool found1 = GetNeighborFace(adjFaceTested,testTr0,faces,dfaces, neighborIndex10, neighborIndex11); + + if(found0 && found1 && neighborIndex00 == neighborIndex11 && neighborIndex01 == neighborIndex10) + { + return false; + } + + adjFaceTested = checkedAT.GetAdjTri(SharedEdgeIndex(testIndex1)); + found0 = GetNeighborFace(index,testTr1,faces,dfaces,neighborIndex00,neighborIndex01); + found1 = GetNeighborFace(adjFaceTested,testTr1,faces,dfaces,neighborIndex10,neighborIndex11); + + if(found0 && found1 && neighborIndex00 == neighborIndex11 && neighborIndex01 == neighborIndex10) + { + return false; + } + + } + } + + return true; + } + + static bool CheckFloodFill(PxArray& indices,AdjTriangle* faces,bool* inMarkers, const PxU32* dfaces) + { + bool valid = true; + + for(PxU32 i=0;i indices; // Indices of triangles forming hull polygon + + bool doFill = true; + while (doFill) + { + Local::FloodFill(indices, adj.mFaces, currentFace, markers); + + doFill = Local::CheckFloodFill(indices,adj.mFaces,markers, dFaces); + } + + // Now it would be nice to recreate a closed linestrip, similar to silhouette extraction. The line is composed of active edges, this time. + + + PxArray activeSegments; + //Container ActiveSegments; + // Loop through triangles composing the polygon + for(PxU32 i=0;i lineStrip; + if(findLineStrip(lineStrip, activeSegments)) + { + PxU32 nb = lineStrip.size(); + if(nb) + { + const PxU32* entries = lineStrip.begin(); + PX_ASSERT(entries[0] == entries[nb-1]); // findLineStrip() is designed that way. Might not be what we want! + + // We get rid of the last (duplicated) index + polygon_data.pushBack(nb-1); + for (PxU32 i = 0; i < nb-1; i++) + { + vertexMarkers[entries[i]]++; + polygon_data.pushBack(entries[i]); + } + nb_polygons++; + + // Loop through vertices composing the line strip polygon end mark the redundant vertices inside the polygon + for(PxU32 i=0;ipushBack(indices.size()); + for (PxU32 j = 0; j < indices.size(); j++) + triangle_data->pushBack(indices[j]); + } + } + } + else + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Meshmerizer::extractHullPolygons: line strip extraction failed"); + } + } + while(currentFace!=nbFaces); + + for (PxU32 i = 0; i < nbVertices; i++) + { + if(vertexMarkers[i] < 3) + { + if(rendundantVertices.find(i) == rendundantVertices.end()) + rendundantVertices.pushBack(i); + } + } + + if(rendundantVertices.size() > 0 && triangle_data) + checkRedundantVertices(nb_polygons,polygon_data,hull,*triangle_data,rendundantVertices); + + return true; +} + +////////////////////////////////////////////////////////////////////////// + +ConvexPolygonsBuilder::ConvexPolygonsBuilder(ConvexHullData* hull, const bool buildGRBData) + : ConvexHullBuilder(hull, buildGRBData), mNbHullFaces(0), mFaces(NULL) +{ +} + +////////////////////////////////////////////////////////////////////////// + +ConvexPolygonsBuilder::~ConvexPolygonsBuilder() +{ + PX_FREE(mFaces); +} + +////////////////////////////////////////////////////////////////////////// +// compute hull polygons from given hull triangles +bool ConvexPolygonsBuilder::computeHullPolygons(const PxU32& nbVerts,const PxVec3* verts, const PxU32& nbTriangles, const PxU32* triangles) +{ + PX_ASSERT(triangles); + PX_ASSERT(verts); + + mHullDataHullVertices = NULL; + mHullDataPolygons = NULL; + mHullDataVertexData8 = NULL; + mHullDataFacesByEdges8 = NULL; + mHullDataFacesByVertices8 = NULL; + + mNbHullFaces = nbTriangles; + mHull->mNbHullVertices = PxTo8(nbVerts); + // allocate additional vec3 for V4 safe load in VolumeInteration + mHullDataHullVertices = PX_ALLOCATE(PxVec3, (mHull->mNbHullVertices + 1), "PxVec3"); + PxMemCopy(mHullDataHullVertices, verts, mHull->mNbHullVertices*sizeof(PxVec3)); + + mFaces = PX_ALLOCATE(IndexedTriangle32, mNbHullFaces, "mFaces"); + for(PxU32 i=0;imNbHullVertices; + CleanFaces(mNbHullFaces, hullAsIndexedTriangle, nbHullVerts, mHullDataHullVertices); + PX_ASSERT(nbHullVerts<256); + mHull->mNbHullVertices = PxTo8(nbHullVerts); + + // ...and then run the full tests again. + if(!CheckFaces(mNbHullFaces, hullAsIndexedTriangle, mHull->mNbHullVertices, mHullDataHullVertices)) + return false; + + // Transform triangles-to-polygons + if(!createPolygonData()) + return false; + + return checkHullPolygons(); +} + +/** +* Computes polygon data. +* \return true if success +*/ +bool ConvexPolygonsBuilder::createPolygonData() +{ + // Cleanup + mHull->mNbPolygons = 0; + PX_FREE(mHullDataVertexData8); + PX_FREE(mHullDataFacesByVertices8); + PX_FREE(mHullDataPolygons); + + // Extract polygon data from triangle data + PxArray temp; + PxArray temp2; + PxArray rendundantVertices; + PxU32 nbPolygons; + if(!extractHullPolygons(nbPolygons, temp, *this, &temp2,rendundantVertices)) + return false; + + PxVec3* reducedHullDataHullVertices = mHullDataHullVertices; + PxU8 numReducedHullDataVertices = mHull->mNbHullVertices; + + if(rendundantVertices.size() > 0) + { + numReducedHullDataVertices = PxTo8(mHull->mNbHullVertices - rendundantVertices.size()); + reducedHullDataHullVertices = PX_ALLOCATE(PxVec3, numReducedHullDataVertices, "Reduced vertices hull data"); + PxU8* remapTable = PX_ALLOCATE(PxU8, mHull->mNbHullVertices, "remapTable"); + + PxU8 currentIndex = 0; + for (PxU8 i = 0; i < mHull->mNbHullVertices; i++) + { + if(rendundantVertices.find(i) == rendundantVertices.end()) + { + PX_ASSERT(currentIndex < numReducedHullDataVertices); + reducedHullDataHullVertices[currentIndex] = mHullDataHullVertices[i]; + remapTable[i] = currentIndex; + currentIndex++; + } + else + { + remapTable[i] = 0xFF; + } + } + + PxU32* data = temp.begin(); + for(PxU32 i=0;i=3); // Else something very wrong happened... + + for(PxU32 j=0;jmNbHullVertices); + data[j] = remapTable[data[j]]; + } + + data += nbVerts; + } + + PX_FREE(remapTable); + } + + if(nbPolygons>255) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "ConvexHullBuilder: convex hull has more than 255 polygons!"); + + // Precompute hull polygon structures + mHull->mNbPolygons = PxTo8(nbPolygons); + mHullDataPolygons = PX_ALLOCATE(HullPolygonData, mHull->mNbPolygons, "Gu::HullPolygonData"); + PxMemZero(mHullDataPolygons, sizeof(HullPolygonData)*mHull->mNbPolygons); + + // The winding hasn't been preserved so we need to handle this. Basically we need to "unify normals" + // exactly as we did at hull creation time - except this time we work on polygons + PxVec3 geomCenter; + computeGeomCenter(geomCenter, mNbHullFaces, mFaces, mHullDataHullVertices, mHull->mNbHullVertices); + + // Loop through polygons + // We have N polygons => remove N entries for number of vertices + PxU32 tmp = temp.size() - nbPolygons; + mHullDataVertexData8 = PX_ALLOCATE(PxU8, tmp, "mHullDataVertexData8"); + PxU8* dest = mHullDataVertexData8; + const PxU32* data = temp.begin(); + const PxU32* triData = temp2.begin(); + for(PxU32 i=0;i=3); // Else something very wrong happened... + mHullDataPolygons[i].mNbVerts = PxTo8(nbVerts); + + PxU32 index = 0; + for(PxU32 j=0;j(mFaces[triIndex]); + const PxPlane PL = PlaneEquation(T, mHullDataHullVertices); + if(k==0 && PL.n.dot(mHullDataPolygons[i].mPlane.n) < 0.0f) + { + flip = true; + } + } + if(flip) + { + negatePlane(mHullDataPolygons[i]); + inverseBuffer(mHullDataPolygons[i].mNbVerts, dest); + } + + for(PxU32 j=0;jmNbHullVertices;j++) + { + float d = - (mHullDataPolygons[i].mPlane.n).dot(mHullDataHullVertices[j]); + if(d0.0f) + { + inverseBuffer(mHullDataPolygons[i].mNbVerts, dest); + + negatePlane(mHullDataPolygons[i]); + PX_ASSERT(mHullDataPolygons[i].mPlane.distance(geomCenter)<=0.0f); + } + + // Next one + data += nbVerts; // Skip vertex indices + dest += mHullDataPolygons[i].mNbVerts; + } + + if(reducedHullDataHullVertices != mHullDataHullVertices) + { + PxMemCopy(mHullDataHullVertices,reducedHullDataHullVertices,sizeof(PxVec3)*numReducedHullDataVertices); + PX_FREE(reducedHullDataHullVertices); + + mHull->mNbHullVertices = numReducedHullDataVertices; + } + + //calculate the vertex map table + if(!calculateVertexMapTable(nbPolygons)) + return false; + +#ifdef USE_PRECOMPUTED_HULL_PROJECTION + // Loop through polygons + for(PxU32 j=0;jmNbHullVertices; + const PxVec3* verts = mHullDataHullVertices; + HullPolygonData& polygon = mHullDataPolygons[j]; + PxReal min = PX_MAX_F32; + PxU8 minIndex = 0xff; + for (PxU8 i = 0; i < nbVerts; i++) + { + float dp = (*verts++).dot(polygon.mPlane.n); + if(dp < min) + { + min = dp; + minIndex = i; + } + } + polygon.mMinIndex = minIndex; + } +#endif + + // Triangulate newly created polygons to recreate a clean vertex cloud. + return createTrianglesFromPolygons(); +} + +////////////////////////////////////////////////////////////////////////// +// create back triangles from polygons +bool ConvexPolygonsBuilder::createTrianglesFromPolygons() +{ + if (!mHull->mNbPolygons || !mHullDataPolygons) return false; + + PxU32 maxNbTriangles = 0; + for (PxU32 i = 0; i < mHull->mNbPolygons; i++) + { + if (mHullDataPolygons[i].mNbVerts < 3) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "ConvexHullBuilder::CreateTrianglesFromPolygons: convex hull has a polygon with less than 3 vertices!"); + + maxNbTriangles += mHullDataPolygons[i].mNbVerts - 2; + } + + IndexedTriangle32* tmpFaces = PX_ALLOCATE(IndexedTriangle32, maxNbTriangles, "tmpFaces"); + + IndexedTriangle32* currFace = tmpFaces; + PxU32 nbTriangles = 0; + const PxU8* vertexData = mHullDataVertexData8; + const PxVec3* hullVerts = mHullDataHullVertices; + for (PxU32 i = 0; i < mHull->mNbPolygons; i++) + { + const PxU8* data = vertexData + mHullDataPolygons[i].mVRef8; + PxU32 nbVerts = mHullDataPolygons[i].mNbVerts; + + // Triangulate the polygon such that all all generated triangles have one and the same vertex + // in common. + // + // Make sure to avoid creating zero area triangles. Imagine the following polygon: + // + // 4 3 + // *------------------* + // | | + // *---*----*----*----* + // 5 6 0 1 2 + // + // Choosing vertex 0 as the shared vertex, the following zero area triangles will be created: + // [0 1 2], [0 5 6] + // + // Check for these triangles and discard them + // Note: Such polygons should only occur if the user defines the convex hull, i.e., the triangles + // of the convex shape, himself. If the convex hull is built from the vertices only, the + // hull algorithm removes the useless vertices. + // + for (PxU32 j = 0; j < nbVerts - 2; j++) + { + currFace->mRef[0] = data[0]; + currFace->mRef[1] = data[(j + 1) % nbVerts]; + currFace->mRef[2] = data[(j + 2) % nbVerts]; + + const PxVec3& p0 = hullVerts[currFace->mRef[0]]; + const PxVec3& p1 = hullVerts[currFace->mRef[1]]; + const PxVec3& p2 = hullVerts[currFace->mRef[2]]; + + const float area = ((p1 - p0).cross(p2 - p0)).magnitudeSquared(); + + if (area != 0.0f) // Else discard the triangle + { + nbTriangles++; + currFace++; + } + } + } + + PX_FREE(mFaces); + IndexedTriangle32* faces; + PX_ASSERT(nbTriangles <= maxNbTriangles); + if (maxNbTriangles == nbTriangles) + { + // No zero area triangles, hence the face buffer has correct size and can be used directly. + faces = tmpFaces; + } + else + { + // Resize face buffer because some triangles were discarded. + faces = PX_ALLOCATE(IndexedTriangle32, nbTriangles, "mFaces"); + if (!faces) // PT: TODO: is there a reason why we test the alloc result here and nowhere else? + { + PX_FREE(tmpFaces); + return false; + } + PxMemCopy(faces, tmpFaces, sizeof(IndexedTriangle32)*nbTriangles); + PX_FREE(tmpFaces); + } + mFaces = faces; + mNbHullFaces = nbTriangles; + // TODO: at this point useless vertices should be removed from the hull. The current fix is to initialize + // support vertices to known valid vertices, but it's not really convincing. + + // Re-unify normals + PxVec3 geomCenter; + computeGeomCenter(geomCenter, mNbHullFaces, mFaces, mHullDataHullVertices, mHull->mNbHullVertices); + + for (PxU32 i = 0; i < mNbHullFaces; i++) + { + const PxPlane P(hullVerts[mFaces[i].mRef[0]], + hullVerts[mFaces[i].mRef[1]], + hullVerts[mFaces[i].mRef[2]]); + if (P.distance(geomCenter) > 0.0f) + { + mFaces[i].flip(); + } + } + return true; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.h new file mode 100644 index 0000000..dab7bc9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingConvexPolygonsBuilder.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_CONVEX_POLYGONS_BUILDER_H +#define GU_COOKING_CONVEX_POLYGONS_BUILDER_H + +#include "GuCookingConvexHullBuilder.h" +#include "GuTriangle.h" + +namespace physx +{ + ////////////////////////////////////////////////////////////////////////// + // extended convex hull builder for a case where we build polygons from input triangles + class ConvexPolygonsBuilder : public ConvexHullBuilder + { + public: + ConvexPolygonsBuilder(Gu::ConvexHullData* hull, const bool buildGRBData); + ~ConvexPolygonsBuilder(); + + bool computeHullPolygons(const PxU32& nbVerts,const PxVec3* verts, const PxU32& nbTriangles, const PxU32* triangles); + + PX_FORCE_INLINE PxU32 getNbFaces()const { return mNbHullFaces; } + PX_FORCE_INLINE const Gu::IndexedTriangle32* getFaces() const { return mFaces; } + + private: + bool createPolygonData(); + bool createTrianglesFromPolygons(); + + PxU32 mNbHullFaces; //!< Number of faces in the convex hull + Gu::IndexedTriangle32* mFaces; //!< Triangles. + }; +} + +#endif + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingGrbTriangleMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingGrbTriangleMesh.h new file mode 100644 index 0000000..699a190 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingGrbTriangleMesh.h @@ -0,0 +1,301 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_GRB_TRIANGLE_MESH_H +#define GU_COOKING_GRB_TRIANGLE_MESH_H + +#include "foundation/PxPlane.h" +#include "foundation/PxSort.h" +#include "GuMeshData.h" +#include "GuTriangle.h" +#include "GuEdgeList.h" +#include "cooking/PxCooking.h" +#include "CmRadixSort.h" + +//#define CHECK_OLD_CODE_VS_NEW_CODE + +namespace physx +{ +namespace Gu +{ +PX_ALIGN_PREFIX(16) +struct uint4 +{ + unsigned int x, y, z, w; +} +PX_ALIGN_SUFFIX(16); + + +// TODO avoroshilov: remove duplicate definitions +static const PxU32 BOUNDARY = 0xffffffff; +static const PxU32 NONCONVEX_FLAG = 0x80000000; + +#ifdef CHECK_OLD_CODE_VS_NEW_CODE + +struct EdgeTriLookup +{ + PxU32 edgeId0, edgeId1; + PxU32 triId; + + bool operator < (const EdgeTriLookup& edge1) const + { + return edgeId0 < edge1.edgeId0 || (edgeId0 == edge1.edgeId0 && edgeId1 < edge1.edgeId1); + } + + bool operator <=(const EdgeTriLookup& edge1) const + { + return edgeId0 < edge1.edgeId0 || (edgeId0 == edge1.edgeId0 && edgeId1 <= edge1.edgeId1); + } +}; + +static PxU32 binarySearch(const EdgeTriLookup* __restrict data, const PxU32 numElements, const EdgeTriLookup& value) +{ + PxU32 left = 0; + PxU32 right = numElements; + + while ((right - left) > 1) + { + const PxU32 pos = (left + right) / 2; + const EdgeTriLookup& element = data[pos]; + if (element <= value) + { + left = pos; + } + else + { + right = pos; + } + } + + return left; +} + +// slightly different behavior from collide2: boundary edges are filtered out + +static PxU32 findAdjacent(const PxVec3* triVertices, const PxVec3* triNormals, const IndexedTriangle32* triIndices, + PxU32 nbTris, PxU32 i0, PxU32 i1, const PxPlane& plane, + EdgeTriLookup* triLookups, PxU32 triangleIndex) +{ + PxU32 result = BOUNDARY; + PxReal bestCos = -FLT_MAX; + + EdgeTriLookup lookup; + lookup.edgeId0 = PxMin(i0, i1); + lookup.edgeId1 = PxMax(i0, i1); + + PxU32 startIndex = binarySearch(triLookups, nbTris * 3, lookup); + + for (PxU32 a = startIndex; a > 0; --a) + { + if (triLookups[a - 1].edgeId0 == lookup.edgeId0 && triLookups[a - 1].edgeId1 == lookup.edgeId1) + startIndex = a - 1; + else + break; + } + + for (PxU32 a = startIndex; a < nbTris * 3; ++a) + { + const EdgeTriLookup& edgeTri = triLookups[a]; + + if (edgeTri.edgeId0 != lookup.edgeId0 || edgeTri.edgeId1 != lookup.edgeId1) + break; + + if (edgeTri.triId == triangleIndex) + continue; + + const IndexedTriangle32& triIdx = triIndices[edgeTri.triId]; + const PxU32 vIdx0 = triIdx.mRef[0]; + const PxU32 vIdx1 = triIdx.mRef[1]; + const PxU32 vIdx2 = triIdx.mRef[2]; + + const PxU32 other = vIdx0 + vIdx1 + vIdx2 - (i0 + i1); + + const PxReal c = plane.n.dot(triNormals[edgeTri.triId]); + + if (plane.distance(triVertices[other]) >= 0 && c > 0.f) + return NONCONVEX_FLAG | edgeTri.triId; + + if (c>bestCos) + { + bestCos = c; + result = edgeTri.triId; + } + } + + return result; +} +#endif + +static PxU32 findAdjacent(const PxVec3* triVertices, const PxVec3* triNormals, const IndexedTriangle32* triIndices, const PxU32* faceByEdge, PxU32 nbTris, PxU32 i0, PxU32 i1, const PxPlane& plane, PxU32 triangleIndex) +{ + PxU32 result = BOUNDARY; + PxReal bestCos = -FLT_MAX; + + for(PxU32 i=0; i= 0 && c > 0.f) + return NONCONVEX_FLAG | candidateTriIndex; + + if(c>bestCos) + { + bestCos = c; + result = candidateTriIndex; + } + } + + return result; +} + +static void buildAdjacencies(uint4* triAdjacencies, PxVec3* tempNormalsPerTri_prealloc, const PxVec3* triVertices, const IndexedTriangle32* triIndices, PxU32 nbTris) +{ +#ifdef CHECK_OLD_CODE_VS_NEW_CODE + { + EdgeTriLookup* edgeLookups = PX_ALLOCATE(EdgeTriLookup, (nbTris * 3), "edgeLookups"); + + for (PxU32 i = 0; i < nbTris; i++) + { + const IndexedTriangle32& triIdx = triIndices[i]; + const PxU32 vIdx0 = triIdx.mRef[0]; + const PxU32 vIdx1 = triIdx.mRef[1]; + const PxU32 vIdx2 = triIdx.mRef[2]; + + tempNormalsPerTri_prealloc[i] = (triVertices[vIdx1] - triVertices[vIdx0]).cross(triVertices[vIdx2] - triVertices[vIdx0]).getNormalized(); + + edgeLookups[i * 3].edgeId0 = PxMin(vIdx0, vIdx1); + edgeLookups[i * 3].edgeId1 = PxMax(vIdx0, vIdx1); + edgeLookups[i * 3].triId = i; + + edgeLookups[i * 3 + 1].edgeId0 = PxMin(vIdx1, vIdx2); + edgeLookups[i * 3 + 1].edgeId1 = PxMax(vIdx1, vIdx2); + edgeLookups[i * 3 + 1].triId = i; + + edgeLookups[i * 3 + 2].edgeId0 = PxMin(vIdx0, vIdx2); + edgeLookups[i * 3 + 2].edgeId1 = PxMax(vIdx0, vIdx2); + edgeLookups[i * 3 + 2].triId = i; + } + + PxSort(edgeLookups, PxU32(nbTris * 3)); + + for (PxU32 i = 0; i < nbTris; i++) + { + const IndexedTriangle32& triIdx = triIndices[i]; + const PxU32 vIdx0 = triIdx.mRef[0]; + const PxU32 vIdx1 = triIdx.mRef[1]; + const PxU32 vIdx2 = triIdx.mRef[2]; + + const PxPlane triPlane(triVertices[vIdx0], tempNormalsPerTri_prealloc[i]); + uint4 triAdjIdx; + + triAdjIdx.x = findAdjacent(triVertices, tempNormalsPerTri_prealloc, triIndices, nbTris, vIdx0, vIdx1, triPlane, edgeLookups, i); + triAdjIdx.y = findAdjacent(triVertices, tempNormalsPerTri_prealloc, triIndices, nbTris, vIdx1, vIdx2, triPlane, edgeLookups, i); + triAdjIdx.z = findAdjacent(triVertices, tempNormalsPerTri_prealloc, triIndices, nbTris, vIdx2, vIdx0, triPlane, edgeLookups, i); + triAdjIdx.w = 0; + + triAdjacencies[i] = triAdjIdx; + } + + PX_FREE(edgeLookups); + } +#endif + + if(1) + { + EDGELISTCREATE create; + create.NbFaces = nbTris; + create.DFaces = triIndices->mRef; + create.WFaces = NULL; + create.FacesToEdges = true; + create.EdgesToFaces = true; + // PT: important: do NOT set the vertices, it triggers computation of edge flags that we don't need + //create.Verts = triVertices; + EdgeList edgeList; + if(edgeList.init(create)) + { + for(PxU32 i=0; iloadFromDesc(desc)) + { + PX_DELETE(hf); + return NULL; + } + + // create heightfield and set the HF data + HeightField* heightField = static_cast(insertionCallback.buildObjectFromData(PxConcreteType::eHEIGHTFIELD, &hf->mData)); + if(!heightField) + { + PX_DELETE(hf); + return NULL; + } + + // copy the HeightField variables + heightField->mSampleStride = hf->mSampleStride; + heightField->mNbSamples = hf->mNbSamples; + heightField->mMinHeight = hf->mMinHeight; + heightField->mMaxHeight = hf->mMaxHeight; + heightField->mModifyCount = hf->mModifyCount; + + PX_DELETE(hf); + return heightField; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp new file mode 100644 index 0000000..1b1630f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.cpp @@ -0,0 +1,2554 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuCookingQuickHullConvexHullLib.h" +#include "GuCookingConvexHullUtils.h" + +#include "foundation/PxAllocator.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxSort.h" +#include "foundation/PxUtilities.h" + +#include "foundation/PxMath.h" +#include "foundation/PxPlane.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxMemory.h" + +using namespace physx; + +namespace local +{ + ////////////////////////////////////////////////////////////////////////// + static const float MIN_ADJACENT_ANGLE = 3.0f; // in degrees - result wont have two adjacent facets within this angle of each other. + static const float PLANE_THICKNES = 3.0f * PX_EPS_F32; // points within this distance are considered on a plane + static const float MAXDOT_MINANG = cosf(PxDegToRad(MIN_ADJACENT_ANGLE)); // adjacent angle for dot product tests + + ////////////////////////////////////////////////////////////////////////// + + struct QuickHullFace; + class ConvexHull; + class HullPlanes; + + ////////////////////////////////////////////////////////////////////////// + template + class MemBlock + { + public: + MemBlock(PxU32 preallocateSize) + : mPreallocateSize(preallocateSize), mCurrentBlock(0), mCurrentIndex(0) + { + PX_ASSERT(preallocateSize); + T* block = PX_ALLOCATE(T, preallocateSize, "Quickhull MemBlock"); + mBlocks.pushBack(block); + } + + MemBlock() + : mPreallocateSize(0), mCurrentBlock(0), mCurrentIndex(0) + { + } + + void init(PxU32 preallocateSize) + { + PX_ASSERT(preallocateSize); + mPreallocateSize = preallocateSize; + T* block = PX_ALLOCATE(T, preallocateSize, "Quickhull MemBlock"); + if(useIndexing) + { + for (PxU32 i = 0; i < mPreallocateSize; i++) + { + // placement new to index data + PX_PLACEMENT_NEW(&block[i], T)(i); + } + } + mBlocks.pushBack(block); + } + + ~MemBlock() + { + for (PxU32 i = 0; i < mBlocks.size(); i++) + { + PX_FREE(mBlocks[i]); + } + mBlocks.clear(); + } + + void reset() + { + for (PxU32 i = 0; i < mBlocks.size(); i++) + { + PX_FREE(mBlocks[i]); + } + mBlocks.clear(); + + mCurrentBlock = 0; + mCurrentIndex = 0; + + init(mPreallocateSize); + } + + T* getItem(PxU32 index) + { + const PxU32 block = index/mPreallocateSize; + const PxU32 itemIndex = index % mPreallocateSize; + PX_ASSERT(block <= mCurrentBlock); + PX_ASSERT(itemIndex < mPreallocateSize); + return &(mBlocks[block])[itemIndex]; + } + + T* getFreeItem() + { + PX_ASSERT(mPreallocateSize); + // check if we have enough space in block, otherwise allocate new block + if(mCurrentIndex < mPreallocateSize) + { + return &(mBlocks[mCurrentBlock])[mCurrentIndex++]; + } + else + { + T* block = PX_ALLOCATE(T, mPreallocateSize, "Quickhull MemBlock"); + mCurrentBlock++; + if (useIndexing) + { + for (PxU32 i = 0; i < mPreallocateSize; i++) + { + // placement new to index data + PX_PLACEMENT_NEW(&block[i], T)(mCurrentBlock*mPreallocateSize + i); + } + } + mBlocks.pushBack(block); + mCurrentIndex = 0; + return &(mBlocks[mCurrentBlock])[mCurrentIndex++]; + } + } + + private: + PxU32 mPreallocateSize; + PxU32 mCurrentBlock; + PxU32 mCurrentIndex; + PxArray mBlocks; + }; + + ////////////////////////////////////////////////////////////////////////// + // representation of quick hull vertex + struct QuickHullVertex + { + PxVec3 point; // point vector + PxU32 index; // point index for compare + float dist; // distance from plane if necessary + + QuickHullVertex* next; // link to next vertex, linked list used for conflict list + + PX_FORCE_INLINE bool operator==(const QuickHullVertex& vertex) const + { + return index == vertex.index ? true : false; + } + + PX_FORCE_INLINE bool operator <(const QuickHullVertex& vertex) const + { + return dist < vertex.dist ? true : false; + } + }; + + ////////////////////////////////////////////////////////////////////////// + // representation of quick hull half edge + struct QuickHullHalfEdge + { + QuickHullHalfEdge() : prev(NULL), next(NULL), twin(NULL), face(NULL), edgeIndex(0xFFFFFFFF) + { + } + + QuickHullHalfEdge(PxU32 ) + : prev(NULL), next(NULL), twin(NULL), face(NULL), edgeIndex(0xFFFFFFFF) + { + } + + QuickHullVertex tail; // tail vertex, head vertex is the tail of the twin + + QuickHullHalfEdge* prev; // previous edge + QuickHullHalfEdge* next; // next edge + QuickHullHalfEdge* twin; // twin/opposite edge + + QuickHullFace* face; // face where the edge belong + + PxU32 edgeIndex; // edge index used for edge creation + + PX_FORCE_INLINE const QuickHullVertex& getTail() const + { + return tail; + } + + PX_FORCE_INLINE const QuickHullVertex& getHead() const + { + PX_ASSERT(twin); + return twin->tail; + } + + PX_FORCE_INLINE void setTwin(QuickHullHalfEdge* edge) + { + twin = edge; + edge->twin = this; + } + + PX_FORCE_INLINE QuickHullFace* getOppositeFace() const + { + return twin->face; + } + + float getOppositeFaceDistance() const; + }; + + ////////////////////////////////////////////////////////////////////////// + + typedef PxArray QuickHullVertexArray; + typedef PxArray QuickHullHalfEdgeArray; + typedef PxArray QuickHullFaceArray; + + ////////////////////////////////////////////////////////////////////////// + // representation of quick hull face + struct QuickHullFace + { + enum FaceState + { + eVISIBLE, + eDELETED, + eNON_CONVEX + }; + + QuickHullHalfEdge* edge; // starting edge + PxU16 numEdges; // num edges on the face + QuickHullVertex* conflictList; // conflict list, used to determine unclaimed vertices + + PxVec3 normal; // Newell plane normal + float area; // face area + PxVec3 centroid; // face centroid + + float planeOffset; // Newell plane offset + float expandOffset; // used for plane expansion if vertex limit reached + + FaceState state; // face validity state + + QuickHullFace* nextFace; // used to indicate next free face in faceList + PxU32 index; // face index for compare identification + PxU8 outIndex; // face index used for output descriptor + + public: + QuickHullFace() + : edge(NULL), numEdges(0), conflictList(NULL), area(0.0f), planeOffset(0.0f), expandOffset(-FLT_MAX), + state(eVISIBLE), nextFace(NULL), outIndex(0) + { + } + + QuickHullFace(PxU32 ind) + : edge(NULL), numEdges(0), conflictList(NULL), area(0.0f), planeOffset(0.0f), expandOffset(-FLT_MAX), + state(eVISIBLE), nextFace(NULL), index(ind), outIndex(0) + { + } + + ~QuickHullFace() + { + } + + // get edge on index + PX_FORCE_INLINE QuickHullHalfEdge* getEdge(PxU32 i) const + { + QuickHullHalfEdge* he = edge; + while (i > 0) + { + he = he->next; + i--; + } + return he; + } + + // distance from a plane to provided point + PX_FORCE_INLINE float distanceToPlane(const PxVec3 p) const + { + return normal.dot(p) - planeOffset; + } + + // compute face normal and centroid + PX_FORCE_INLINE void computeNormalAndCentroid() + { + PX_ASSERT(edge); + normal = PxVec3(PxZero); + numEdges = 1; + + QuickHullHalfEdge* testEdge = edge; + QuickHullHalfEdge* startEdge = NULL; + float maxDist = 0.0f; + for (PxU32 i = 0; i < 3; i++) + { + const float d = (testEdge->tail.point - testEdge->next->tail.point).magnitudeSquared(); + if (d > maxDist) + { + maxDist = d; + startEdge = testEdge; + } + testEdge = testEdge->next; + } + PX_ASSERT(startEdge); + + QuickHullHalfEdge* he = startEdge->next; + const PxVec3& p0 = startEdge->tail.point; + const PxVec3 d = he->tail.point - p0; + centroid = startEdge->tail.point; + + do + { + numEdges++; + centroid += he->tail.point; + + normal += d.cross(he->next->tail.point - p0); + + he = he->next; + } while (he != startEdge); + + area = normal.normalize(); + centroid *= (1.0f / float(numEdges)); + + planeOffset = normal.dot(centroid); + } + + // merge adjacent face + bool mergeAdjacentFace(QuickHullHalfEdge* halfEdge, QuickHullFaceArray& discardedFaces); + + // check face consistency + bool checkFaceConsistency(); + + private: + // connect halfedges + QuickHullFace* connectHalfEdges(QuickHullHalfEdge* hedgePrev, QuickHullHalfEdge* hedge); + + // check if the face does have only 3 vertices + PX_FORCE_INLINE bool isTriangle() const + { + return numEdges == 3 ? true : false; + } + + }; + + ////////////////////////////////////////////////////////////////////////// + struct QuickHullResult + { + enum Enum + { + eSUCCESS, // ok + eZERO_AREA_TEST_FAILED, // area test failed for simplex + eVERTEX_LIMIT_REACHED, // vertex limit reached need to expand hull + ePOLYGONS_LIMIT_REACHED, // polygons hard limit reached + eFAILURE // general failure + }; + }; + + ////////////////////////////////////////////////////////////////////////// + // Quickhull base class holding the hull during construction + class QuickHull : public PxUserAllocated + { + PX_NOCOPY(QuickHull) + public: + + QuickHull(const PxCookingParams& params, const PxConvexMeshDesc& desc); + + ~QuickHull(); + + // preallocate the edges, faces, vertices + void preallocate(PxU32 numVertices); + + // parse the input verts, store them into internal format + void parseInputVertices(const PxVec3* verts, PxU32 numVerts); + + // release the hull and data + void releaseHull(); + + // sets the precomputed min/max data + void setPrecomputedMinMax(const QuickHullVertex* minVertex,const QuickHullVertex* maxVertex, const float tolerance,const float planeTolerance); + + // main entry function to build the hull from provided points + QuickHullResult::Enum buildHull(); + + PxU32 maxNumVertsPerFace() const; + + protected: + // compute min max verts + void computeMinMaxVerts(); + + // find the initial simplex + bool findSimplex(); + + // add the initial simplex + void addSimplex(QuickHullVertex* simplex, bool flipTriangle); + + // finds next point to add + QuickHullVertex* nextPointToAdd(QuickHullFace*& eyeFace); + + // adds point to the hull + bool addPointToHull(const QuickHullVertex* vertex, QuickHullFace& face, bool& addFailed); + + // creates new face from given triangles + QuickHullFace* createTriangle(const QuickHullVertex& v0, const QuickHullVertex& v1, const QuickHullVertex& v2); + + // adds point to the face conflict list + void addPointToFace(QuickHullFace& face, QuickHullVertex* vertex, float dist); + + // removes eye point from the face conflict list + void removeEyePointFromFace(QuickHullFace& face, const QuickHullVertex* vertex); + + // calculate the horizon fro the eyePoint against a given face + void calculateHorizon(const PxVec3& eyePoint, QuickHullHalfEdge* edge, QuickHullFace& face, QuickHullHalfEdgeArray& horizon, QuickHullFaceArray& removedFaces); + + // adds new faces from given horizon and eyePoint + void addNewFacesFromHorizon(const QuickHullVertex* eyePoint, const QuickHullHalfEdgeArray& horizon, QuickHullFaceArray& newFaces); + + // merge adjacent face + bool doAdjacentMerge(QuickHullFace& face, bool mergeWrtLargeFace, bool& mergeFailed); + + // merge adjacent face doing normal test + bool doPostAdjacentMerge(QuickHullFace& face, const float minAngle); + + // delete face points + void deleteFacePoints(QuickHullFace& faceToDelete, QuickHullFace* absorbingFace); + + // resolve unclaimed points + void resolveUnclaimedPoints(const QuickHullFaceArray& newFaces); + + // merges polygons with similar normals + void postMergeHull(); + + // check if 2 faces can be merged + bool canMergeFaces(const QuickHullHalfEdge& he); + + // get next free face + PX_FORCE_INLINE QuickHullFace* getFreeHullFace() + { + return mFreeFaces.getFreeItem(); + } + + // get next free half edge + PX_FORCE_INLINE QuickHullHalfEdge* getFreeHullHalfEdge() + { + return mFreeHalfEdges.getFreeItem(); + } + + PX_FORCE_INLINE PxU32 getNbHullVerts() { return mOutputNumVertices; } + + protected: + friend class physx::QuickHullConvexHullLib; + + const PxCookingParams& mCookingParams; // cooking params + const PxConvexMeshDesc& mConvexDesc; // convex desc + + PxVec3 mInteriorPoint; // interior point for int/ext tests + + PxU32 mMaxVertices; // maximum number of vertices (can be different as we may add vertices during the cleanup + PxU32 mNumVertices; // actual number of input vertices + PxU32 mOutputNumVertices; // num vertices of the computed hull + PxU32 mTerminalVertex; // in case we failed to generate hull in a regular run we set the terminal vertex and rerun + + QuickHullVertex* mVerticesList; // vertices list preallocated + MemBlock mFreeHalfEdges; // free half edges + MemBlock mFreeFaces; // free faces + + QuickHullFaceArray mHullFaces; // actual hull faces, contains also invalid and not used faces + PxU32 mNumHullFaces; // actual number of hull faces + + bool mPrecomputedMinMax; // if we got the precomputed min/max values + QuickHullVertex mMinVertex[3]; // min vertex + QuickHullVertex mMaxVertex[3]; // max vertex + float mTolerance; // hull tolerance, used for plane thickness and merge strategy + float mPlaneTolerance; // used for post merge stage + + QuickHullVertexArray mUnclaimedPoints; // holds temp unclaimed points + + QuickHullHalfEdgeArray mHorizon; // array for horizon computation + QuickHullFaceArray mNewFaces; // new faces created during horizon computation + QuickHullFaceArray mRemovedFaces; // removd faces during horizon computation + QuickHullFaceArray mDiscardedFaces; // discarded faces during face merging + }; + + ////////////////////////////////////////////////////////////////////////// + // return the distance from opposite face + float QuickHullHalfEdge::getOppositeFaceDistance() const + { + PX_ASSERT(face); + PX_ASSERT(twin); + return face->distanceToPlane(twin->face->centroid); + } + + ////////////////////////////////////////////////////////////////////////// + // merge adjacent face from provided half edge. + // 1. set new half edges + // 2. connect the new half edges - check we did not produced redundant triangles, discard them + // 3. recompute the plane and check consistency + // Returns false if merge failed + bool QuickHullFace::mergeAdjacentFace(QuickHullHalfEdge* hedgeAdj, QuickHullFaceArray& discardedFaces) + { + QuickHullFace* oppFace = hedgeAdj->getOppositeFace(); + + discardedFaces.pushBack(oppFace); + oppFace->state = QuickHullFace::eDELETED; + + QuickHullHalfEdge* hedgeOpp = hedgeAdj->twin; + + QuickHullHalfEdge* hedgeAdjPrev = hedgeAdj->prev; + QuickHullHalfEdge* hedgeAdjNext = hedgeAdj->next; + QuickHullHalfEdge* hedgeOppPrev = hedgeOpp->prev; + QuickHullHalfEdge* hedgeOppNext = hedgeOpp->next; + + // check if we are lining up with the face in adjPrev dir + QuickHullHalfEdge* breakEdge = hedgeAdjPrev; + while (hedgeAdjPrev->getOppositeFace() == oppFace) + { + hedgeAdjPrev = hedgeAdjPrev->prev; + hedgeOppNext = hedgeOppNext->next; + + // Edge case merge face is degenerated and we need to abort merging + if (hedgeAdjPrev == breakEdge) + { + return false; + } + } + + // check if we are lining up with the face in adjNext dir + breakEdge = hedgeAdjNext; + while (hedgeAdjNext->getOppositeFace() == oppFace) + { + hedgeOppPrev = hedgeOppPrev->prev; + hedgeAdjNext = hedgeAdjNext->next; + + // Edge case merge face is degenerated and we need to abort merging + if (hedgeAdjNext == breakEdge) + { + return false; + } + } + + QuickHullHalfEdge* hedge; + + // set new face owner for the line up edges + for (hedge = hedgeOppNext; hedge != hedgeOppPrev->next; hedge = hedge->next) + { + hedge->face = this; + } + + // if we are about to delete the shared edge, check if its not the starting edge of the face + if (hedgeAdj == edge) + { + edge = hedgeAdjNext; + } + + // handle the half edges at the head + QuickHullFace* discardedFace; + discardedFace = connectHalfEdges(hedgeOppPrev, hedgeAdjNext); + if (discardedFace != NULL) + { + discardedFaces.pushBack(discardedFace); + } + + // handle the half edges at the tail + discardedFace = connectHalfEdges(hedgeAdjPrev, hedgeOppNext); + if (discardedFace != NULL) + { + discardedFaces.pushBack(discardedFace); + } + + computeNormalAndCentroid(); + PX_ASSERT(checkFaceConsistency()); + + return true; + } + + ////////////////////////////////////////////////////////////////////////// + // connect half edges of 2 adjacent faces + // if we find redundancy - edges are in a line, we drop the addional face if it is just a skinny triangle + QuickHullFace* QuickHullFace::connectHalfEdges(QuickHullHalfEdge* hedgePrev, QuickHullHalfEdge* hedge) + { + QuickHullFace* discardedFace = NULL; + + // redundant edge - can be in a line + if (hedgePrev->getOppositeFace() == hedge->getOppositeFace()) + { + // then there is a redundant edge that we can get rid off + QuickHullFace* oppFace = hedge->getOppositeFace(); + QuickHullHalfEdge* hedgeOpp; + + if (hedgePrev == edge) + { + edge = hedge; + } + + // check if its not a skinny face with just 3 vertices - 3 edges + if (oppFace->isTriangle()) + { + // then we can get rid of the opposite face altogether + hedgeOpp = hedge->twin->prev->twin; + + oppFace->state = QuickHullFace::eDELETED; + discardedFace = oppFace; + } + else + { + // if not triangle, merge the 2 opposite halfedges into one + hedgeOpp = hedge->twin->next; + + if (oppFace->edge == hedgeOpp->prev) + { + oppFace->edge = hedgeOpp; + } + hedgeOpp->prev = hedgeOpp->prev->prev; + hedgeOpp->prev->next = hedgeOpp; + } + + hedge->prev = hedgePrev->prev; + hedge->prev->next = hedge; + + hedge->twin = hedgeOpp; + hedgeOpp->twin = hedge; + + // oppFace was modified, so need to recompute + oppFace->computeNormalAndCentroid(); + } + else + { + // just merge the halfedges + hedgePrev->next = hedge; + hedge->prev = hedgePrev; + } + return discardedFace; + } + + ////////////////////////////////////////////////////////////////////////// + // check face consistency + bool QuickHullFace::checkFaceConsistency() + { + // do a sanity check on the face + QuickHullHalfEdge* hedge = edge; + PxU32 numv = 0; + + // check degenerate face + do + { + numv++; + hedge = hedge->next; + } while (hedge != edge); + + // degenerate face found + PX_ASSERT(numv > 2); + + numv = 0; + hedge = edge; + do + { + QuickHullHalfEdge* hedgeOpp = hedge->twin; + + // check if we have twin set + PX_ASSERT(hedgeOpp != NULL); + + // twin for the twin must be the original edge + PX_ASSERT(hedgeOpp->twin == hedge); + + QuickHullFace* oppFace = hedgeOpp->face; + + PX_UNUSED(oppFace); + + // opposite edge face must be set and valid + PX_ASSERT(oppFace != NULL); + PX_ASSERT(oppFace->state != QuickHullFace::eDELETED); + + // edges face must be this one + PX_ASSERT(hedge->face == this); + + hedge = hedge->next; + } while (hedge != edge); + + return true; + } + + ////////////////////////////////////////////////////////////////////////// + + QuickHull::QuickHull(const PxCookingParams& params, const PxConvexMeshDesc& desc) + : mCookingParams(params), mConvexDesc(desc), mOutputNumVertices(0), mTerminalVertex(0xFFFFFFFF), mVerticesList(NULL), mNumHullFaces(0), mPrecomputedMinMax(false), + mTolerance(-1.0f), mPlaneTolerance(-1.0f) + { + } + + ////////////////////////////////////////////////////////////////////////// + + QuickHull::~QuickHull() + { + } + + ////////////////////////////////////////////////////////////////////////// + // sets the precomputed min/max values + void QuickHull::setPrecomputedMinMax(const QuickHullVertex* minVertex,const QuickHullVertex* maxVertex, const float tolerance,const float planeTolerance) + { + for (PxU32 i = 0; i < 3; i++) + { + mMinVertex[i] = minVertex[i]; + mMaxVertex[i] = maxVertex[i]; + } + + mTolerance = tolerance; + mPlaneTolerance = planeTolerance; + + mPrecomputedMinMax = true; + } + + ////////////////////////////////////////////////////////////////////////// + // preallocate internal buffers + void QuickHull::preallocate(PxU32 numVertices) + { + PX_ASSERT(numVertices > 0); + + // max num vertices = numVertices + mMaxVertices = PxMax(PxU32(8), numVertices); // 8 is min, since we can expand to AABB during the clean vertices phase + mVerticesList = PX_ALLOCATE(QuickHullVertex, mMaxVertices, "QuickHullVertex"); + + // estimate the max half edges + PxU32 maxHalfEdges = (3 * mMaxVertices - 6) * 3; + mFreeHalfEdges.init(maxHalfEdges); + + // estimate the max faces + PxU32 maxFaces = (2 * mMaxVertices - 4); + mFreeFaces.init(maxFaces*2); + + mHullFaces.reserve(maxFaces); + mUnclaimedPoints.reserve(numVertices); + + mNewFaces.reserve(32); + mRemovedFaces.reserve(32); + mDiscardedFaces.reserve(32); + mHorizon.reserve(PxMin(numVertices,PxU32(128))); + } + + ////////////////////////////////////////////////////////////////////////// + // release internal buffers + void QuickHull::releaseHull() + { + PX_FREE(mVerticesList); + mHullFaces.clear(); + } + + ////////////////////////////////////////////////////////////////////////// + // returns the maximum number of vertices on a face + PxU32 QuickHull::maxNumVertsPerFace() const + { + PxU32 numFaces = mHullFaces.size(); + PxU32 maxVerts = 0; + for (PxU32 i = 0; i < numFaces; i++) + { + const local::QuickHullFace& face = *mHullFaces[i]; + if (face.state == local::QuickHullFace::eVISIBLE) + { + if (face.numEdges > maxVerts) + maxVerts = face.numEdges; + } + } + return maxVerts; + } + + ////////////////////////////////////////////////////////////////////////// + // parse the input vertices and store them in the hull + void QuickHull::parseInputVertices(const PxVec3* verts, PxU32 numVerts) + { + PX_ASSERT(verts); + PX_ASSERT(numVerts <= mMaxVertices); + + mNumVertices = numVerts; + for (PxU32 i = 0; i < numVerts; i++) + { + mVerticesList[i].point = verts[i]; + mVerticesList[i].index = i; + } + } + + ////////////////////////////////////////////////////////////////////////// + // compute min max verts + void QuickHull::computeMinMaxVerts() + { + for (PxU32 i = 0; i < 3; i++) + { + mMinVertex[i] = mVerticesList[0]; + mMaxVertex[i] = mVerticesList[0]; + } + + PxVec3 max = mVerticesList[0].point; + PxVec3 min = mVerticesList[0].point; + + // get the max min vertices along the x,y,z + for (PxU32 i = 1; i < mNumVertices; i++) + { + const QuickHullVertex& testVertex = mVerticesList[i]; + const PxVec3& testPoint = testVertex.point; + if (testPoint.x > max.x) + { + max.x = testPoint.x; + mMaxVertex[0] = testVertex; + } + else if (testPoint.x < min.x) + { + min.x = testPoint.x; + mMinVertex[0] = testVertex; + } + + if (testPoint.y > max.y) + { + max.y = testPoint.y; + mMaxVertex[1] = testVertex; + } + else if (testPoint.y < min.y) + { + min.y = testPoint.y; + mMinVertex[1] = testVertex; + } + + if (testPoint.z > max.z) + { + max.z = testPoint.z; + mMaxVertex[2] = testVertex; + } + else if (testPoint.z < min.z) + { + min.z = testPoint.z; + mMinVertex[2] = testVertex; + } + } + + const float sizeTol = (max.x-min.x + max.y - min.y + max.z - min.z)*0.5f; + mTolerance = PxMax(local::PLANE_THICKNES * sizeTol, local::PLANE_THICKNES); + mPlaneTolerance = PxMax(mCookingParams.planeTolerance * sizeTol, mCookingParams.planeTolerance); + } + + ////////////////////////////////////////////////////////////////////////// + // find the initial simplex + // 1. search in max axis from compute min,max + // 2. 3rd point is the furthest vertex from the initial line + // 3. 4th vertex is along the line, 3rd vertex normal + bool QuickHull::findSimplex() + { + float max = 0; + PxU32 imax = 0; + + for (PxU32 i = 0; i < 3; i++) + { + float diff = mMaxVertex[i].point[i] - mMinVertex[i].point[i]; + if (diff > max) + { + max = diff; + imax = i; + } + } + + if (max <= mTolerance) + // should not happen as we clear the vertices before and expand them if they are really close to each other + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "QuickHullConvexHullLib::findSimplex: Simplex input points appers to be almost at the same place"); + + QuickHullVertex simplex[4]; + + // set first two vertices to be those with the greatest + // one dimensional separation + simplex[0] = mMaxVertex[imax]; + simplex[1] = mMinVertex[imax]; + + // set third vertex to be the vertex farthest from + // the line between simplex[0] and simplex[1] + PxVec3 normal; + float maxDist = 0; + PxVec3 u01 = (simplex[1].point - simplex[0].point); + u01.normalize(); + + for (PxU32 i = 0; i < mNumVertices; i++) + { + const QuickHullVertex& testVert = mVerticesList[i]; + const PxVec3& testPoint = testVert.point; + const PxVec3 diff = testPoint - simplex[0].point; + const PxVec3 xprod = u01.cross(diff); + const float lenSqr = xprod.magnitudeSquared(); + if (lenSqr > maxDist && testVert.index != simplex[0].index && testVert.index != simplex[1].index) + { + maxDist = lenSqr; + simplex[2] = testVert; + normal = xprod; + } + } + + if (PxSqrt(maxDist) <= mTolerance) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "QuickHullConvexHullLib::findSimplex: Simplex input points appers to be colinear."); + + normal.normalize(); + + // set the forth vertex in the normal direction + const float d0 = simplex[2].point.dot(normal); + maxDist = 0.0f; + for (PxU32 i = 0; i < mNumVertices; i++) + { + const QuickHullVertex& testVert = mVerticesList[i]; + const PxVec3& testPoint = testVert.point; + const float dist = PxAbs(testPoint.dot(normal) - d0); + if (dist > maxDist && testVert.index != simplex[0].index && + testVert.index != simplex[1].index && testVert.index != simplex[2].index) + { + maxDist = dist; + simplex[3] = testVert; + } + } + + if (PxAbs(maxDist) <= mTolerance) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "QuickHullConvexHullLib::findSimplex: Simplex input points appers to be coplanar."); + + // now create faces from those triangles + addSimplex(&simplex[0], simplex[3].point.dot(normal) - d0 < 0); + + return true; + } + + ////////////////////////////////////////////////////////////////////////// + // create triangle from given vertices, produce new face and connect the half edges + QuickHullFace* QuickHull::createTriangle(const QuickHullVertex& v0, const QuickHullVertex& v1, const QuickHullVertex& v2) + { + QuickHullFace* face = getFreeHullFace(); + + QuickHullHalfEdge* he0 = getFreeHullHalfEdge(); + he0->face = face; + he0->tail = v0; + + QuickHullHalfEdge* he1 = getFreeHullHalfEdge(); + he1->face = face; + he1->tail = v1; + + QuickHullHalfEdge* he2 = getFreeHullHalfEdge(); + he2->face = face; + he2->tail = v2; + + he0->prev = he2; + he0->next = he1; + he1->prev = he0; + he1->next = he2; + he2->prev = he1; + he2->next = he0; + + face->edge = he0; + face->nextFace = NULL; + + // compute the normal and offset + face->computeNormalAndCentroid(); + return face; + } + + + ////////////////////////////////////////////////////////////////////////// + // add initial simplex to the quickhull + // construct triangles from the simplex points and connect them with half edges + void QuickHull::addSimplex(QuickHullVertex* simplex, bool flipTriangle) + { + PX_ASSERT(simplex); + + // get interior point + PxVec3 vectorSum = simplex[0].point; + for (PxU32 i = 1; i < 4; i++) + { + vectorSum += simplex[i].point; + } + mInteriorPoint = vectorSum / 4.0f; + + QuickHullFace* tris[4]; + // create the triangles from the initial simplex + if (flipTriangle) + { + tris[0] = createTriangle(simplex[0], simplex[1], simplex[2]); + tris[1] = createTriangle(simplex[3], simplex[1], simplex[0]); + tris[2] = createTriangle(simplex[3], simplex[2], simplex[1]); + tris[3] = createTriangle(simplex[3], simplex[0], simplex[2]); + + for (PxU32 i = 0; i < 3; i++) + { + PxU32 k = (i + 1) % 3; + tris[i + 1]->getEdge(1)->setTwin(tris[k + 1]->getEdge(0)); + tris[i + 1]->getEdge(2)->setTwin(tris[0]->getEdge(k)); + } + } + else + { + tris[0] = createTriangle(simplex[0], simplex[2], simplex[1]); + tris[1] = createTriangle(simplex[3], simplex[0], simplex[1]); + tris[2] = createTriangle(simplex[3], simplex[1], simplex[2]); + tris[3] = createTriangle(simplex[3], simplex[2], simplex[0]); + + for (PxU32 i = 0; i < 3; i++) + { + PxU32 k = (i + 1) % 3; + tris[i + 1]->getEdge(0)->setTwin(tris[k + 1]->getEdge(1)); + tris[i + 1]->getEdge(2)->setTwin(tris[0]->getEdge((3 - i) % 3)); + } + } + + // push back the first 4 faces created from the simplex + for (PxU32 i = 0; i < 4; i++) + { + mHullFaces.pushBack(tris[i]); + } + mNumHullFaces = 4; + + // go through points and add point to faces if they are on the plane + for (PxU32 i = 0; i < mNumVertices; i++) + { + const QuickHullVertex& v = mVerticesList[i]; + + if (v == simplex[0] || v == simplex[1] || v == simplex[2] || v == simplex[3]) + { + continue; + } + + float maxDist = mTolerance; + QuickHullFace* maxFace = NULL; + for (PxU32 k = 0; k < 4; k++) + { + const float dist = tris[k]->distanceToPlane(v.point); + if (dist > maxDist) + { + maxFace = tris[k]; + maxDist = dist; + } + } + + if (maxFace != NULL) + { + addPointToFace(*maxFace, &mVerticesList[i], maxDist); + } + } + } + + ////////////////////////////////////////////////////////////////////////// + // adds a point to the conflict list + // the trick here is to store the most furthest point as the last, thats the only one we care about + // the rest is not important, we just need to store them and claim to new faces later, if the + // faces most furthest point is the current global maximum + void QuickHull::addPointToFace(QuickHullFace& face, QuickHullVertex* vertex, float dist) + { + // if we dont have a conflict list, store the vertex as the first one in the conflict list + vertex->dist = dist; + if(!face.conflictList) + { + face.conflictList = vertex; + vertex->dist = dist; + vertex->next = NULL; + return; + } + + PX_ASSERT(face.conflictList); + + // this is not the furthest vertex, store it as next in the linked list + if (face.conflictList->dist > dist) + { + vertex->next = face.conflictList->next; + face.conflictList->next = vertex; + } + else + { + // this is the furthest vertex, store it as first in the linked list + vertex->next = face.conflictList; + face.conflictList = vertex; + } + } + + ////////////////////////////////////////////////////////////////////////// + // removes eye point from a conflict list + // we know that the vertex must the last, as we store it at the back, so just popback() + void QuickHull::removeEyePointFromFace(QuickHullFace& face, const QuickHullVertex* vertex) + { + PX_UNUSED(vertex); + // the picked vertex should always be the first in the linked list + PX_ASSERT(face.conflictList == vertex); + + face.conflictList = face.conflictList->next; + } + + ////////////////////////////////////////////////////////////////////////// + // merge polygons with similar normals + void QuickHull::postMergeHull() + { + // merge faces with similar normals + for (PxU32 i = 0; i < mHullFaces.size(); i++) + { + QuickHullFace& face = *mHullFaces[i]; + + if (face.state == QuickHullFace::eVISIBLE) + { + PX_ASSERT(face.checkFaceConsistency()); + while (doPostAdjacentMerge(face, local::MAXDOT_MINANG)); + } + } + } + + ////////////////////////////////////////////////////////////////////////// + // builds the hull + // 1. find the initial simplex + // 2. check if simplex has a valid area + // 3. add vertices to the hull. We add vertex most furthest from the hull + // 4. terminate if hull limit reached or we have added all vertices + QuickHullResult::Enum QuickHull::buildHull() + { + QuickHullVertex* eyeVtx = NULL; + QuickHullFace* eyeFace; + + // compute the vertex min max along x,y,z + if(!mPrecomputedMinMax) + computeMinMaxVerts(); + + // find the initial simplex of the hull + if (!findSimplex()) + { + return QuickHullResult::eFAILURE; + } + + // simplex area test + const bool useAreaTest = mConvexDesc.flags & PxConvexFlag::eCHECK_ZERO_AREA_TRIANGLES ? true : false; + const float areaEpsilon = mCookingParams.areaTestEpsilon * 2.0f; + if (useAreaTest) + { + for (PxU32 i = 0; i < mHullFaces.size(); i++) + { + if (mHullFaces[i]->area < areaEpsilon) + { + return QuickHullResult::eZERO_AREA_TEST_FAILED; + } + } + } + + // add points to the hull + PxU32 numVerts = 4; // initial vertex count - simplex vertices + while ((eyeVtx = nextPointToAdd(eyeFace)) != NULL && eyeVtx->index != mTerminalVertex) + { + // if plane shifting vertex limit, we need the reduced hull + if((mConvexDesc.flags & PxConvexFlag::ePLANE_SHIFTING) && (numVerts >= mConvexDesc.vertexLimit)) + break; + + bool addFailed = false; + PX_ASSERT(eyeFace); + if (!addPointToHull(eyeVtx, *eyeFace, addFailed)) + { + mOutputNumVertices = numVerts; + // we hit the polygons hard limit + return QuickHullResult::ePOLYGONS_LIMIT_REACHED; + } + // We failed to add the vertex, store the vertex as terminal vertex and re run the hull generator + if(addFailed) + { + // set the terminal vertex + mTerminalVertex = eyeVtx->index; + + // reset the edges/faces memory + mFreeHalfEdges.reset(); + mFreeFaces.reset(); + + // reset the hull state + mHullFaces.clear(); + mNumHullFaces = 0; + mUnclaimedPoints.clear(); + mHorizon.clear(); + mNewFaces.clear(); + mRemovedFaces.clear(); + mDiscardedFaces.clear(); + + // rerun the hull generator + return buildHull(); + } + numVerts++; + } + mOutputNumVertices = numVerts; + + // vertex limit has been reached. We did not stopped the iteration, since we + // will use the produced hull to compute OBB from it and use the planes + // to slice the initial OBB + if (numVerts > mConvexDesc.vertexLimit) + { + return QuickHullResult::eVERTEX_LIMIT_REACHED; + } + + return QuickHullResult::eSUCCESS; + } + + ////////////////////////////////////////////////////////////////////////// + // finds the best point to add to the hull + // go through the faces conflict list and pick the global maximum + QuickHullVertex* QuickHull::nextPointToAdd(QuickHullFace*& eyeFace) + { + QuickHullVertex* eyeVtx = NULL; + QuickHullFace* eyeF = NULL; + float maxDist = mPlaneTolerance; + for (PxU32 i = 0; i < mHullFaces.size(); i++) + { + if (mHullFaces[i]->state == QuickHullFace::eVISIBLE && mHullFaces[i]->conflictList) + { + const float dist = mHullFaces[i]->conflictList->dist; + if (maxDist < dist) + { + maxDist = dist; + eyeVtx = mHullFaces[i]->conflictList; + eyeF = mHullFaces[i]; + } + } + } + + eyeFace = eyeF; + return eyeVtx; + } + + ////////////////////////////////////////////////////////////////////////// + // adds vertex to the hull + // sets addFailed to true if we failed to add a point because the merging failed + // this can happen as the face plane equation changes and some faces might become concave + // returns false if the new faces count would hit the hull face hard limit (255) + bool QuickHull::addPointToHull(const QuickHullVertex* eyeVtx, QuickHullFace& eyeFace, bool& addFailed) + { + addFailed = false; + + // removes the eyePoint from the conflict list + removeEyePointFromFace(eyeFace, eyeVtx); + + // calculates the horizon from the eyePoint + calculateHorizon(eyeVtx->point, NULL, eyeFace, mHorizon, mRemovedFaces); + + // check if we dont hit the polygons hard limit + if (mNumHullFaces + mHorizon.size() > mConvexDesc.polygonLimit) + { + // make the faces visible again and quit + for (PxU32 i = 0; i < mRemovedFaces.size(); i++) + { + mRemovedFaces[i]->state = QuickHullFace::eVISIBLE; + } + mNumHullFaces += mRemovedFaces.size(); + return false; + } + + // adds new faces from given horizon and eyePoint + addNewFacesFromHorizon(eyeVtx, mHorizon, mNewFaces); + + bool mergeFailed = false; + // first merge pass ... merge faces which are non-convex + // as determined by the larger face + for (PxU32 i = 0; i < mNewFaces.size(); i++) + { + QuickHullFace& face = *mNewFaces[i]; + + if (face.state == QuickHullFace::eVISIBLE) + { + PX_ASSERT(face.checkFaceConsistency()); + while (doAdjacentMerge(face, true, mergeFailed)); + } + } + if (mergeFailed) + { + addFailed = true; + return true; + } + + // second merge pass ... merge faces which are non-convex + // wrt either face + for (PxU32 i = 0; i < mNewFaces.size(); i++) + { + QuickHullFace& face = *mNewFaces[i]; + if (face.state == QuickHullFace::eNON_CONVEX) + { + face.state = QuickHullFace::eVISIBLE; + while (doAdjacentMerge(face, false, mergeFailed)); + } + } + if (mergeFailed) + { + addFailed = true; + return true; + } + + resolveUnclaimedPoints(mNewFaces); + + mHorizon.clear(); + mNewFaces.clear(); + mRemovedFaces.clear(); + + return true; + } + + ////////////////////////////////////////////////////////////////////////// + // merge adjacent faces + // We merge 2 adjacent faces if they lie on the same thick plane defined by the mTolerance + // we do this in 2 steps to ensure we dont leave non-convex faces + bool QuickHull::doAdjacentMerge(QuickHullFace& face, bool mergeWrtLargeFace, bool& mergeFailed) + { + QuickHullHalfEdge* hedge = face.edge; + mergeFailed = false; + + bool convex = true; + do + { + const QuickHullFace& oppFace = *hedge->getOppositeFace(); + bool merge = false; + + if (mergeWrtLargeFace) + { + // merge faces if they are parallel or non-convex + // wrt to the larger face; otherwise, just mark + // the face non-convex for the second pass. + if (face.area > oppFace.area) + { + if (hedge->getOppositeFaceDistance() > -mTolerance) + { + merge = true; + } + else if (hedge->twin->getOppositeFaceDistance() > -mTolerance) + { + convex = false; + } + } + else + { + if (hedge->twin->getOppositeFaceDistance() > -mTolerance) + { + merge = true; + } + else if (hedge->getOppositeFaceDistance() > -mTolerance) + { + convex = false; + } + } + } + else + { + // then merge faces if they are definitively non-convex + if (hedge->getOppositeFaceDistance() > -mTolerance || + hedge->twin->getOppositeFaceDistance() > -mTolerance) + { + merge = true; + } + } + + if (merge) + { + mDiscardedFaces.clear(); + if (!face.mergeAdjacentFace(hedge, mDiscardedFaces)) + { + mergeFailed = true; + return false; + } + mNumHullFaces -= mDiscardedFaces.size(); + for (PxU32 i = 0; i < mDiscardedFaces.size(); i++) + { + deleteFacePoints(*mDiscardedFaces[i], &face); + } + PX_ASSERT(face.checkFaceConsistency()); + return true; + } + hedge = hedge->next; + } while (hedge != face.edge); + + if (!convex) + { + face.state = QuickHullFace::eNON_CONVEX; + } + return false; + } + + ////////////////////////////////////////////////////////////////////////// + // merge adjacent faces doing normal test + // we try to merge more aggressively 2 faces with the same normal. + bool QuickHull::doPostAdjacentMerge(QuickHullFace& face, const float maxdot_minang) + { + QuickHullHalfEdge* hedge = face.edge; + + do + { + const QuickHullFace& oppFace = *hedge->getOppositeFace(); + bool merge = false; + const PxVec3& ni = face.normal; + const PxVec3& nj = oppFace.normal; + const float dotP = ni.dot(nj); + + if (dotP > maxdot_minang) + { + if (face.area >= oppFace.area) + { + // check if we can merge the 2 faces + merge = canMergeFaces(*hedge); + } + } + + if (merge) + { + QuickHullFaceArray discardedFaces; + face.mergeAdjacentFace(hedge, discardedFaces); + mNumHullFaces -= discardedFaces.size(); + for (PxU32 i = 0; i < discardedFaces.size(); i++) + { + deleteFacePoints(*discardedFaces[i], &face); + } + PX_ASSERT(face.checkFaceConsistency()); + return true; + } + hedge = hedge->next; + } while (hedge != face.edge); + + return false; + } + + ////////////////////////////////////////////////////////////////////////// + // checks if 2 adjacent faces can be merged + // 1. creates a face with merged vertices + // 2. computes new normal and centroid + // 3. checks that all verts are not too far away from the plane + // 4. checks that the new polygon is still convex + // 5. checks if we are about to merge only 2 neighbor faces, we dont + // want to merge additional faces, that might corrupt the convexity + bool QuickHull::canMergeFaces(const QuickHullHalfEdge& he) + { + const QuickHullFace& face1 = *he.face; + const QuickHullFace& face2 = *he.twin->face; + + // construct the merged face + PX_ALLOCA(edges, QuickHullHalfEdge, (face1.numEdges + face2.numEdges)); + PxMemSet(edges, 0, (face1.numEdges + face2.numEdges)*sizeof(QuickHullHalfEdge)); + QuickHullFace mergedFace; + mergedFace.edge = &edges[0]; + + // copy the first face edges + PxU32 currentEdge = 0; + const QuickHullHalfEdge* heTwin = NULL; + const QuickHullHalfEdge* heCopy = NULL; + const QuickHullHalfEdge* startEdge = (face1.edge != &he) ? face1.edge : face1.edge->next; + const QuickHullHalfEdge* copyHe = startEdge; + do + { + edges[currentEdge].face = &mergedFace; + edges[currentEdge].tail = copyHe->tail; + if(copyHe == &he) + { + heTwin = copyHe->twin; + heCopy = &edges[currentEdge]; + } + const PxU32 nextIndex = (copyHe->next == startEdge) ? 0 : currentEdge + 1; + const PxU32 prevIndex = (currentEdge == 0) ? face1.numEdges - 1 : currentEdge - 1; + edges[currentEdge].next = &edges.mPointer[nextIndex]; + edges[currentEdge].prev = &edges.mPointer[prevIndex]; + + currentEdge++; + copyHe = copyHe->next; + } while (copyHe != startEdge); + + // copy the second face edges + copyHe = face2.edge; + do + { + edges[currentEdge].face = &mergedFace; + edges[currentEdge].tail = copyHe->tail; + if(heTwin == copyHe) + heTwin = &edges[currentEdge]; + const PxU32 nextIndex = (copyHe->next == face2.edge) ? face1.numEdges : currentEdge + 1; + const PxU32 prevIndex = (currentEdge == face1.numEdges) ? face1.numEdges + face2.numEdges - 1 : currentEdge - 1; + edges[currentEdge].next = &edges.mPointer[nextIndex]; + edges[currentEdge].prev = &edges.mPointer[prevIndex]; + + currentEdge++; + copyHe = copyHe->next; + } while (copyHe != face2.edge); + + PX_ASSERT(heTwin); + + QuickHullHalfEdge* hedgeAdjPrev = heCopy->prev; + QuickHullHalfEdge* hedgeAdjNext = heCopy->next; + QuickHullHalfEdge* hedgeOppPrev = heTwin->prev; + QuickHullHalfEdge* hedgeOppNext = heTwin->next; + + hedgeOppPrev->next = hedgeAdjNext; + hedgeAdjNext->prev = hedgeOppPrev; + + hedgeAdjPrev->next = hedgeOppNext; + hedgeOppNext->prev = hedgeAdjPrev; + + // compute normal and centroid + mergedFace.computeNormalAndCentroid(); + + // test the vertex distance + const float maxDist = mPlaneTolerance; + for(PxU32 iVerts=0; iVerts< mNumVertices; iVerts++) + { + const QuickHullVertex& vertex = mVerticesList[iVerts]; + const float dist = mergedFace.distanceToPlane(vertex.point); + if (dist > maxDist) + { + return false; + } + } + + // check the convexity + QuickHullHalfEdge* qhe = mergedFace.edge; + do + { + const QuickHullVertex& vertex = qhe->tail; + const QuickHullVertex& nextVertex = qhe->next->tail; + + PxVec3 edgeVector = nextVertex.point - vertex.point; + edgeVector.normalize(); + const PxVec3 outVector = -mergedFace.normal.cross(edgeVector); + + QuickHullHalfEdge* testHe = qhe->next; + do + { + const QuickHullVertex& testVertex = testHe->tail; + const float dist = (testVertex.point - vertex.point).dot(outVector); + + if (dist > mTolerance) + return false; + + testHe = testHe->next; + } while (testHe != qhe->next); + + qhe = qhe->next; + } while (qhe != mergedFace.edge); + + + const QuickHullFace* oppFace = he.getOppositeFace(); + + QuickHullHalfEdge* hedgeOpp = he.twin; + + hedgeAdjPrev = he.prev; + hedgeAdjNext = he.next; + hedgeOppPrev = hedgeOpp->prev; + hedgeOppNext = hedgeOpp->next; + + // check if we are lining up with the face in adjPrev dir + while (hedgeAdjPrev->getOppositeFace() == oppFace) + { + hedgeAdjPrev = hedgeAdjPrev->prev; + hedgeOppNext = hedgeOppNext->next; + } + + // check if we are lining up with the face in adjNext dir + while (hedgeAdjNext->getOppositeFace() == oppFace) + { + hedgeOppPrev = hedgeOppPrev->prev; + hedgeAdjNext = hedgeAdjNext->next; + } + + // no redundant merges, just clean merge of 2 neighbour faces + if (hedgeOppPrev->getOppositeFace() == hedgeAdjNext->getOppositeFace()) + { + return false; + } + + if (hedgeAdjPrev->getOppositeFace() == hedgeOppNext->getOppositeFace()) + { + return false; + } + + return true; + } + + ////////////////////////////////////////////////////////////////////////// + // delete face points and store them as unclaimed, so we can add them back to new faces later + void QuickHull::deleteFacePoints(QuickHullFace& face, QuickHullFace* absorbingFace) + { + // no conflict list for this face + if(!face.conflictList) + return; + + QuickHullVertex* unclaimedVertex = face.conflictList; + QuickHullVertex* vertexToClaim = NULL; + while (unclaimedVertex) + { + vertexToClaim = unclaimedVertex; + unclaimedVertex = unclaimedVertex->next; + vertexToClaim->next = NULL; + if (!absorbingFace) + { + mUnclaimedPoints.pushBack(vertexToClaim); + } + else + { + const float dist = absorbingFace->distanceToPlane(vertexToClaim->point); + if (dist > mTolerance) + { + addPointToFace(*absorbingFace, vertexToClaim, dist); + } + else + { + mUnclaimedPoints.pushBack(vertexToClaim); + } + } + } + + face.conflictList = NULL; + } + + ////////////////////////////////////////////////////////////////////////// + // calculate the horizon from the eyePoint against a given face + void QuickHull::calculateHorizon(const PxVec3& eyePoint, QuickHullHalfEdge* edge0, QuickHullFace& face, QuickHullHalfEdgeArray& horizon, QuickHullFaceArray& removedFaces) + { + deleteFacePoints(face, NULL); + face.state = QuickHullFace::eDELETED; + removedFaces.pushBack(&face); + mNumHullFaces--; + QuickHullHalfEdge* edge; + if (edge0 == NULL) + { + edge0 = face.getEdge(0); + edge = edge0; + } + else + { + edge = edge0->next; + } + + do + { + QuickHullFace* oppFace = edge->getOppositeFace(); + if (oppFace->state == QuickHullFace::eVISIBLE) + { + const float dist = oppFace->distanceToPlane(eyePoint); + if (dist > mTolerance) + { + calculateHorizon(eyePoint, edge->twin, *oppFace, horizon, removedFaces); + } + else + { + horizon.pushBack(edge); + } + } + edge = edge->next; + } while (edge != edge0); + } + + ////////////////////////////////////////////////////////////////////////// + // adds new faces from given horizon and eyePoint + void QuickHull::addNewFacesFromHorizon(const QuickHullVertex* eyePoint, const QuickHullHalfEdgeArray& horizon, QuickHullFaceArray& newFaces) + { + QuickHullHalfEdge* hedgeSidePrev = NULL; + QuickHullHalfEdge* hedgeSideBegin = NULL; + + for (PxU32 i = 0; i < horizon.size(); i++) + { + const QuickHullHalfEdge& horizonHe = *horizon[i]; + + QuickHullFace* face = createTriangle(*eyePoint, horizonHe.getHead(), horizonHe.getTail()); + mHullFaces.pushBack(face); + mNumHullFaces++; + face->getEdge(2)->setTwin(horizonHe.twin); + + QuickHullHalfEdge* hedgeSide = face->edge; + if (hedgeSidePrev != NULL) + { + hedgeSide->next->setTwin(hedgeSidePrev); + } + else + { + hedgeSideBegin = hedgeSide; + } + newFaces.pushBack(face); + hedgeSidePrev = hedgeSide; + } + hedgeSideBegin->next->setTwin(hedgeSidePrev); + } + + ////////////////////////////////////////////////////////////////////////// + // resolve unclaimed points + void QuickHull::resolveUnclaimedPoints(const QuickHullFaceArray& newFaces) + { + for (PxU32 i = 0; i < mUnclaimedPoints.size(); i++) + { + QuickHullVertex* vtx = mUnclaimedPoints[i]; + + float maxDist = mTolerance; + QuickHullFace* maxFace = NULL; + for (PxU32 j = 0; j < newFaces.size(); j++) + { + const QuickHullFace& newFace = *newFaces[j]; + if (newFace.state == QuickHullFace::eVISIBLE) + { + const float dist = newFace.distanceToPlane(vtx->point); + if (dist > maxDist) + { + maxDist = dist; + maxFace = newFaces[j]; + } + } + } + if (maxFace != NULL) + { + addPointToFace(*maxFace, vtx, maxDist); + } + } + + mUnclaimedPoints.clear(); + } + + ////////////////////////////////////////////////////////////////////////// + // helper struct for hull expand point + struct ExpandPoint + { + PxPlane plane[3]; // the 3 planes that will give us the point + PxU32 planeIndex[3]; // index of the planes for identification + + bool operator==(const ExpandPoint& expPoint) const + { + if (expPoint.planeIndex[0] == planeIndex[0] && expPoint.planeIndex[1] == planeIndex[1] && + expPoint.planeIndex[2] == planeIndex[2]) + return true; + else + return false; +} + }; + +////////////////////////////////////////////////////////////////////////// + // gets the half edge neighbors and form the expand point + void getExpandPoint(const QuickHullHalfEdge& he, ExpandPoint& expandPoint, const PxArray* translationTable = NULL) + { + // set the first 2 - the edge face and the twin face + expandPoint.planeIndex[0] = (translationTable) ? ((*translationTable)[he.face->index]) : (he.face->index); + + PxU32 index = translationTable ? ((*translationTable)[he.twin->face->index]) : he.twin->face->index; + if (index < expandPoint.planeIndex[0]) + { + expandPoint.planeIndex[1] = expandPoint.planeIndex[0]; + expandPoint.planeIndex[0] = index; + } + else + { + expandPoint.planeIndex[1] = index; + } + + // now the 3rd one is the next he twin index + index = translationTable ? (*translationTable)[he.next->twin->face->index] : he.next->twin->face->index; + if (index < expandPoint.planeIndex[0]) + { + expandPoint.planeIndex[2] = expandPoint.planeIndex[1]; + expandPoint.planeIndex[1] = expandPoint.planeIndex[0]; + expandPoint.planeIndex[0] = index; + } + else + { + if (index < expandPoint.planeIndex[1]) + { + expandPoint.planeIndex[2] = expandPoint.planeIndex[1]; + expandPoint.planeIndex[1] = index; + } + else + { + expandPoint.planeIndex[2] = index; + } + } + } + + ////////////////////////////////////////////////////////////////////////// + // adds the expand point, don't add similar point + void addExpandPoint(const ExpandPoint& expandPoint, PxArray& expandPoints) + { + for (PxU32 i = expandPoints.size(); i--;) + { + if (expandPoint == expandPoints[i]) + { + return; + } + } + + expandPoints.pushBack(expandPoint); + } + + ////////////////////////////////////////////////////////////////////////// + // helper for 3 planes intersection + static PxVec3 threePlaneIntersection(const PxPlane &p0, const PxPlane &p1, const PxPlane &p2) + { + PxMat33 mp = (PxMat33(p0.n, p1.n, p2.n)).getTranspose(); + PxMat33 mi = (mp).getInverse(); + PxVec3 b(p0.d, p1.d, p2.d); + return -mi.transform(b); + } +} + +////////////////////////////////////////////////////////////////////////// + +QuickHullConvexHullLib::QuickHullConvexHullLib(const PxConvexMeshDesc& desc, const PxCookingParams& params) + : ConvexHullLib(desc, params),mQuickHull(NULL), mCropedConvexHull(NULL), mOutMemoryBuffer(NULL), mFaceTranslateTable(NULL) +{ + mQuickHull = PX_NEW(local::QuickHull)(params, desc); + mQuickHull->preallocate(desc.points.count); +} + +////////////////////////////////////////////////////////////////////////// + +QuickHullConvexHullLib::~QuickHullConvexHullLib() +{ + mQuickHull->releaseHull(); + PX_DELETE(mQuickHull); + + PX_DELETE(mCropedConvexHull); + + PX_FREE(mOutMemoryBuffer); + mFaceTranslateTable = NULL; // memory is a part of mOutMemoryBuffer +} + +////////////////////////////////////////////////////////////////////////// +// create the hull +// 1. clean the input vertices +// 2. check we can construct the simplex, if not expand the input verts +// 3. prepare the quickhull - preallocate, parse input verts +// 4. construct the hull +// 5. post merge faces if limit not reached +// 6. if limit reached, expand the hull +PxConvexMeshCookingResult::Enum QuickHullConvexHullLib::createConvexHull() +{ + PxConvexMeshCookingResult::Enum res = PxConvexMeshCookingResult::eFAILURE; + + PxU32 vcount = mConvexMeshDesc.points.count; + if ( vcount < 8 ) + vcount = 8; + + PxVec3* outvsource = PX_ALLOCATE(PxVec3, vcount, "PxVec3"); + PxU32 outvcount; + + // cleanup the vertices first + if(mConvexMeshDesc.flags & PxConvexFlag::eSHIFT_VERTICES) + { + if(!shiftAndcleanupVertices(mConvexMeshDesc.points.count, reinterpret_cast (mConvexMeshDesc.points.data), mConvexMeshDesc.points.stride, + outvcount, outvsource)) + { + PX_FREE(outvsource); + return res; + } + } + else + { + if(!cleanupVertices(mConvexMeshDesc.points.count, reinterpret_cast (mConvexMeshDesc.points.data), mConvexMeshDesc.points.stride, + outvcount, outvsource)) + { + PX_FREE(outvsource); + return res; + } + } + + local::QuickHullVertex minimumVertex[3]; + local::QuickHullVertex maximumVertex[3]; + float tolerance; + float planeTolerance; + bool canReuse = cleanupForSimplex(outvsource, outvcount, &minimumVertex[0], &maximumVertex[0], tolerance, planeTolerance); + + mQuickHull->parseInputVertices(outvsource,outvcount); + + if(canReuse) + { + mQuickHull->setPrecomputedMinMax(minimumVertex, maximumVertex, tolerance, planeTolerance); + } + + local::QuickHullResult::Enum qhRes = mQuickHull->buildHull(); + + switch(qhRes) + { + case local::QuickHullResult::eZERO_AREA_TEST_FAILED: + res = PxConvexMeshCookingResult::eZERO_AREA_TEST_FAILED; + break; + case local::QuickHullResult::eSUCCESS: + mQuickHull->postMergeHull(); + res = PxConvexMeshCookingResult::eSUCCESS; + break; + case local::QuickHullResult::ePOLYGONS_LIMIT_REACHED: + if(mQuickHull->getNbHullVerts() > mConvexMeshDesc.vertexLimit) + { + // expand the hull + if(mConvexMeshDesc.flags & PxConvexFlag::ePLANE_SHIFTING) + res = expandHull(); + else + res = expandHullOBB(); + } + res = PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED; + break; + case local::QuickHullResult::eVERTEX_LIMIT_REACHED: + { + // expand the hull + if(mConvexMeshDesc.flags & PxConvexFlag::ePLANE_SHIFTING) + res = expandHull(); + else + res = expandHullOBB(); + } + break; + case local::QuickHullResult::eFAILURE: + break; + }; + + // check if we need to build GRB compatible mesh + // if hull was cropped we already have a compatible mesh, if not check + // the max verts per face + if((mConvexMeshDesc.flags & PxConvexFlag::eGPU_COMPATIBLE) && !mCropedConvexHull && + (res == PxConvexMeshCookingResult::eSUCCESS || res == PxConvexMeshCookingResult::ePOLYGONS_LIMIT_REACHED)) + { + PX_ASSERT(mQuickHull); + // if we hit the vertex per face limit, expand the hull by cropping OBB + if(mQuickHull->maxNumVertsPerFace() > gpuMaxVertsPerFace) + { + res = expandHullOBB(); + } + } + + PX_FREE(outvsource); + return res; +} + +////////////////////////////////////////////////////////////////////////// +// fixup the input vertices to be not colinear or coplanar for the initial simplex find +bool QuickHullConvexHullLib::cleanupForSimplex(PxVec3* vertices, PxU32 vertexCount, local::QuickHullVertex* minimumVertex, + local::QuickHullVertex* maximumVertex, float& tolerance, float& planeTolerance) +{ + bool retVal = true; + + for (PxU32 i = 0; i < 3; i++) + { + minimumVertex[i].point = vertices[0]; + minimumVertex[i].index = 0; + maximumVertex[i].point = vertices[0]; + maximumVertex[i].index = 0; + + } + + PxVec3 max = vertices[0]; + PxVec3 min = vertices[0]; + + // get the max min vertices along the x,y,z + for (PxU32 i = 1; i < vertexCount; i++) + { + const PxVec3& testPoint = vertices[i]; + if (testPoint.x > max.x) + { + max.x = testPoint.x; + maximumVertex[0].point = testPoint; + maximumVertex[0].index = i; + } + else if (testPoint.x < min.x) + { + min.x = testPoint.x; + minimumVertex[0].point = testPoint; + minimumVertex[0].index = i; + } + + if (testPoint.y > max.y) + { + max.y = testPoint.y; + maximumVertex[1].point = testPoint; + maximumVertex[1].index = i; + } + else if (testPoint.y < min.y) + { + min.y = testPoint.y; + minimumVertex[1].point = testPoint; + minimumVertex[1].index = i; + } + + if (testPoint.z > max.z) + { + max.z = testPoint.z; + maximumVertex[2].point = testPoint; + maximumVertex[2].index = i; + } + else if (testPoint.z < min.z) + { + min.z = testPoint.z; + minimumVertex[2].point = testPoint; + minimumVertex[2].index = i; + } + } + + const float sizeTol = (max.x-min.x + max.y - min.y + max.z - min.z)*0.5f; + tolerance = PxMax(local::PLANE_THICKNES * sizeTol, local::PLANE_THICKNES); + planeTolerance = PxMax(mCookingParams.planeTolerance *sizeTol, mCookingParams.planeTolerance); + + float fmax = 0; + PxU32 imax = 0; + + for (PxU32 i = 0; i < 3; i++) + { + float diff = (maximumVertex[i].point)[i] - (minimumVertex[i].point)[i]; + if (diff > fmax) + { + fmax = diff; + imax = i; + } + } + + PxVec3 simplex[4]; + + // set first two vertices to be those with the greatest + // one dimensional separation + simplex[0] = maximumVertex[imax].point; + simplex[1] = minimumVertex[imax].point; + + // set third vertex to be the vertex farthest from + // the line between simplex[0] and simplex[1] + PxVec3 normal; + float maxDist = 0; + imax = 0; + PxVec3 u01 = (simplex[1] - simplex[0]); + u01.normalize(); + + for (PxU32 i = 0; i < vertexCount; i++) + { + const PxVec3& testPoint = vertices[i]; + const PxVec3 diff = testPoint - simplex[0]; + const PxVec3 xprod = u01.cross(diff); + const float lenSqr = xprod.magnitudeSquared(); + if (lenSqr > maxDist) + { + maxDist = lenSqr; + simplex[2] = testPoint; + normal = xprod; + imax = i; + } + } + + if (PxSqrt(maxDist) < planeTolerance) + { + // points are collinear, we have to move the point further + PxVec3 u02 = simplex[2] - simplex[0]; + float fT = u02.dot(u01); + const float sqrLen = u01.magnitudeSquared(); + fT /= sqrLen; + PxVec3 n = u02 - fT*u01; + n.normalize(); + const PxVec3 mP = simplex[2] + n * planeTolerance; + simplex[2] = mP; + vertices[imax] = mP; + retVal = false; + } + normal.normalize(); + + // set the forth vertex in the normal direction + float d0 = simplex[2].dot(normal); + maxDist = 0.0f; + imax = 0; + for (PxU32 i = 0; i < vertexCount; i++) + { + const PxVec3& testPoint = vertices[i]; + float dist = PxAbs(testPoint.dot(normal) - d0); + if (dist > maxDist) + { + maxDist = dist; + simplex[3] = testPoint; + imax = i; + } + } + + if (PxAbs(maxDist) < planeTolerance) + { + const float dist = (vertices[imax].dot(normal) - d0); + if (dist > 0) + vertices[imax] = vertices[imax] + normal * planeTolerance; + else + vertices[imax] = vertices[imax] - normal * planeTolerance; + retVal = false; + } + + return retVal; +} + +////////////////////////////////////////////////////////////////////////// +// expand the hull with the from the limited triangles set +// expand hull will do following steps: +// 1. get expand points from hull that form the best hull with given vertices +// 2. expand the planes to have all vertices inside the planes volume +// 3. compute new points by 3 adjacency planes intersections +// 4. take those points and create the hull from them +PxConvexMeshCookingResult::Enum QuickHullConvexHullLib::expandHull() +{ + PxArray expandPoints; + expandPoints.reserve(mQuickHull->mNumVertices); + + // go over faces and gather expand points + for (PxU32 i = 0; i < mQuickHull->mHullFaces.size(); i++) + { + const local::QuickHullFace& face = *mQuickHull->mHullFaces[i]; + if(face.state == local::QuickHullFace::eVISIBLE) + { + local::ExpandPoint expandPoint; + local::QuickHullHalfEdge* he = face.edge; + local::getExpandPoint(*he, expandPoint); + local::addExpandPoint(expandPoint, expandPoints); + he = he->next; + while (he != face.edge) + { + local::getExpandPoint(*he, expandPoint); + local::addExpandPoint(expandPoint, expandPoints); + he = he->next; + } + } + } + + + // go over the planes now and expand them + for(PxU32 iVerts=0;iVerts< mQuickHull->mNumVertices;iVerts++) + { + const local::QuickHullVertex& vertex = mQuickHull->mVerticesList[iVerts]; + + for (PxU32 i = 0; i < mQuickHull->mHullFaces.size(); i++) + { + local::QuickHullFace& face = *mQuickHull->mHullFaces[i]; + if(face.state == local::QuickHullFace::eVISIBLE) + { + const float dist = face.distanceToPlane(vertex.point); + if(dist > 0 && dist > face.expandOffset) + { + face.expandOffset = dist; + } + } + } + } + + // fill the expand points planes + for(PxU32 i=0;imFreeFaces.getItem(expandPoint.planeIndex[k]); + PX_ASSERT(face.index == expandPoint.planeIndex[k]); + PxPlane plane; + plane.n = face.normal; + plane.d = -face.planeOffset; + if(face.expandOffset > 0.0f) + plane.d -= face.expandOffset; + expandPoint.plane[k] = plane; + } + } + + // now find the plane intersection + PX_ALLOCA(vertices,PxVec3,expandPoints.size()); + for(PxU32 i=0;imCookingParams, mQuickHull->mConvexDesc); + newHull->preallocate(expandPoints.size()); + newHull->parseInputVertices(vertices,expandPoints.size()); + + local::QuickHullResult::Enum qhRes = newHull->buildHull(); + switch(qhRes) + { + case local::QuickHullResult::eZERO_AREA_TEST_FAILED: + { + newHull->releaseHull(); + PX_DELETE(newHull); + return PxConvexMeshCookingResult::eZERO_AREA_TEST_FAILED; + } + case local::QuickHullResult::eSUCCESS: + case local::QuickHullResult::eVERTEX_LIMIT_REACHED: + case local::QuickHullResult::ePOLYGONS_LIMIT_REACHED: + { + mQuickHull->releaseHull(); + PX_DELETE(mQuickHull); + mQuickHull = newHull; + } + break; + case local::QuickHullResult::eFAILURE: + { + newHull->releaseHull(); + PX_DELETE(newHull); + return PxConvexMeshCookingResult::eFAILURE; + } + }; + + return PxConvexMeshCookingResult::eSUCCESS; +} + +////////////////////////////////////////////////////////////////////////// +// expand the hull from the limited triangles set +// 1. collect all planes +// 2. create OBB from the input verts +// 3. slice the OBB with the planes +// 5. iterate till vlimit is reached +PxConvexMeshCookingResult::Enum QuickHullConvexHullLib::expandHullOBB() +{ + PxArray expandPlanes; + expandPlanes.reserve(mQuickHull->mHullFaces.size()); + + // collect expand planes + for (PxU32 i = 0; i < mQuickHull->mHullFaces.size(); i++) + { + local::QuickHullFace& face = *mQuickHull->mHullFaces[i]; + if (face.state == local::QuickHullFace::eVISIBLE) + { + PxPlane plane; + plane.n = face.normal; + plane.d = -face.planeOffset; + if (face.expandOffset > 0.0f) + plane.d -= face.expandOffset; + + expandPlanes.pushBack(plane); + } + } + + + PxTransform obbTransform; + PxVec3 sides; + + // compute the OBB + PxConvexMeshDesc convexDesc; + fillConvexMeshDescFromQuickHull(convexDesc); + convexDesc.flags = mConvexMeshDesc.flags; + computeOBBFromConvex(convexDesc, sides, obbTransform); + + // free the memory used for the convex mesh desc + PX_FREE(mOutMemoryBuffer); + mFaceTranslateTable = NULL; + + // crop the OBB + PxU32 maxplanes = PxMin(PxU32(256), expandPlanes.size()); + + ConvexHull* c = PX_NEW(ConvexHull)(sides*0.5f,obbTransform, expandPlanes); + + const float planeTolerance = mQuickHull->mPlaneTolerance; + const float epsilon = mQuickHull->mTolerance; + + PxI32 k; + while (maxplanes-- && (k = c->findCandidatePlane(planeTolerance, epsilon)) >= 0) + { + ConvexHull* tmp = c; + c = convexHullCrop(*tmp, expandPlanes[PxU32(k)], planeTolerance); + if (c == NULL) + { + c = tmp; + break; + } // might want to debug this case better!!! + if (!c->assertIntact(planeTolerance)) + { + PX_DELETE(c); + c = tmp; + break; + } // might want to debug this case better too!!! + + // check for vertex limit + if (c->getVertices().size() > mConvexMeshDesc.vertexLimit) + { + PX_DELETE(c); + c = tmp; + maxplanes = 0; + break; + } + // check for vertex limit per face if necessary, GRB supports max 32 verts per face + if ((mConvexMeshDesc.flags & PxConvexFlag::eGPU_COMPATIBLE) && c->maxNumVertsPerFace() > gpuMaxVertsPerFace) + { + PX_DELETE(c); + c = tmp; + maxplanes = 0; + break; + } + PX_DELETE(tmp); + } + + PX_ASSERT(c->assertIntact(planeTolerance)); + + mCropedConvexHull = c; + + return PxConvexMeshCookingResult::eSUCCESS; +} + +////////////////////////////////////////////////////////////////////////// + +bool QuickHullConvexHullLib::createEdgeList(const PxU32 nbIndices, const PxU8* indices, PxU8** outHullDataFacesByEdges8, PxU16** outEdgeData16, PxU16** outEdges) +{ + // if we croped hull, we dont have the edge information, early exit + if (mCropedConvexHull) + return false; + + PX_ASSERT(mQuickHull); + + // Make sure we did recieved empty buffers + PX_ASSERT(*outHullDataFacesByEdges8 == NULL); + PX_ASSERT(*outEdges == NULL); + PX_ASSERT(*outEdgeData16 == NULL); + + // Allocated the out bufferts + PxU8* hullDataFacesByEdges8 = PX_ALLOCATE(PxU8, nbIndices, "hullDataFacesByEdges8"); + PxU16* edges = PX_ALLOCATE(PxU16, nbIndices, "edges"); + PxU16* edgeData16 = PX_ALLOCATE(PxU16, nbIndices, "edgeData16"); + + *outHullDataFacesByEdges8 = hullDataFacesByEdges8; + *outEdges = edges; + *outEdgeData16 = edgeData16; + + PxU16 edgeIndex = 0; + PxU32 edgeOffset = 0; + for(PxU32 i = 0; i < mQuickHull->mNumHullFaces; i++) + { + const local::QuickHullFace& face = *mQuickHull->mHullFaces[mFaceTranslateTable[i]]; + + // Face must be visible + PX_ASSERT(face.state == local::QuickHullFace::eVISIBLE); + + // parse the edges + const PxU32 startEdgeOffset = edgeOffset; + local::QuickHullHalfEdge* hedge = face.edge; + do + { + // check if hedge has been stored + if(hedge->edgeIndex == 0xFFFFFFFF) + { + edges[edgeIndex*2] = indices[edgeOffset]; + edges[edgeIndex*2 + 1] = indices[(hedge->next != face.edge) ? edgeOffset + 1 : startEdgeOffset]; + + hullDataFacesByEdges8[edgeIndex*2] = hedge->face->outIndex; + hullDataFacesByEdges8[edgeIndex*2 + 1] = hedge->next->twin->face->outIndex; + + edgeData16[edgeOffset] = edgeIndex; + + hedge->edgeIndex = edgeIndex; + hedge->next->twin->prev->edgeIndex = edgeIndex; + + edgeIndex++; + } + else + { + edgeData16[edgeOffset] = PxTo16(hedge->edgeIndex); + } + + hedge = hedge->next; + edgeOffset++; + } while (hedge != face.edge); + } + + return true; +} + +////////////////////////////////////////////////////////////////////////// +// fill the descriptor with computed verts, indices and polygons +void QuickHullConvexHullLib::fillConvexMeshDesc(PxConvexMeshDesc& desc) +{ + if (mCropedConvexHull) + fillConvexMeshDescFromCroppedHull(desc); + else + fillConvexMeshDescFromQuickHull(desc); + + if(mConvexMeshDesc.flags & PxConvexFlag::eSHIFT_VERTICES) + shiftConvexMeshDesc(desc); +} + +////////////////////////////////////////////////////////////////////////// +// fill the descriptor with computed verts, indices and polygons from quickhull convex +void QuickHullConvexHullLib::fillConvexMeshDescFromQuickHull(PxConvexMeshDesc& desc) +{ + // get the number of indices needed + PxU32 numIndices = 0; + PxU32 numFaces = mQuickHull->mHullFaces.size(); + PxU32 numFacesOut = 0; + PxU32 largestFace = 0; // remember the largest face, we store it as the first face, required for GRB test (max 32 vers per face supported) + for (PxU32 i = 0; i < numFaces; i++) + { + const local::QuickHullFace& face = *mQuickHull->mHullFaces[i]; + if(face.state == local::QuickHullFace::eVISIBLE) + { + numFacesOut++; + numIndices += face.numEdges; + if(face.numEdges > mQuickHull->mHullFaces[largestFace]->numEdges) + largestFace = i; + } + } + + // allocate out buffers + const PxU32 indicesBufferSize = sizeof(PxU32)*numIndices; + const PxU32 verticesBufferSize = sizeof(PxVec3)*(mQuickHull->mNumVertices + 1); + const PxU32 facesBufferSize = sizeof(PxHullPolygon)*numFacesOut; + const PxU32 faceTranslationTableSize = sizeof(PxU16)*numFacesOut; + const PxU32 translationTableSize = sizeof(PxU32)*mQuickHull->mNumVertices; + const PxU32 bufferMemorySize = indicesBufferSize + verticesBufferSize + facesBufferSize + faceTranslationTableSize + translationTableSize; + mOutMemoryBuffer = reinterpret_cast(PX_ALLOC(bufferMemorySize, "ConvexMeshDesc")); + + PxU32* indices = reinterpret_cast (mOutMemoryBuffer); + PxVec3* vertices = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize); + PxHullPolygon* polygons = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize + verticesBufferSize); + mFaceTranslateTable = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize + verticesBufferSize + facesBufferSize); + PxI32* translateTable = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize + verticesBufferSize + facesBufferSize + faceTranslationTableSize); + PxMemSet(translateTable,-1,mQuickHull->mNumVertices*sizeof(PxU32)); + + // go over the hullPolygons and mark valid vertices, create translateTable + PxU32 numVertices = 0; + for (PxU32 i = 0; i < numFaces; i++) + { + const local::QuickHullFace& face = *mQuickHull->mHullFaces[i]; + if(face.state == local::QuickHullFace::eVISIBLE) + { + local::QuickHullHalfEdge* he = face.edge; + if(translateTable[he->tail.index] == -1) + { + vertices[numVertices] = he->tail.point; + translateTable[he->tail.index] = PxI32(numVertices); + numVertices++; + } + he = he->next; + while (he != face.edge) + { + if(translateTable[he->tail.index] == -1) + { + vertices[numVertices] = he->tail.point; + translateTable[he->tail.index] = PxI32(numVertices); + numVertices++; + } + he = he->next; + } + } + } + + + desc.points.count = numVertices; + desc.points.data = vertices; + desc.points.stride = sizeof(PxVec3); + + desc.indices.count = numIndices; + desc.indices.data = indices; + desc.indices.stride = sizeof(PxU32); + + desc.polygons.count = numFacesOut; + desc.polygons.data = polygons; + desc.polygons.stride = sizeof(PxHullPolygon); + + PxU16 indexOffset = 0; + numFacesOut = 0; + for (PxU32 i = 0; i < numFaces; i++) + { + // faceIndex - store the largest face first then the rest + PxU32 faceIndex; + if(i == 0) + { + faceIndex = largestFace; + } + else + { + faceIndex = (i == largestFace) ? 0 : i; + } + + local::QuickHullFace& face = *mQuickHull->mHullFaces[faceIndex]; + if(face.state == local::QuickHullFace::eVISIBLE) + { + //create index data + local::QuickHullHalfEdge* he = face.edge; + PxU32 index = 0; + he->edgeIndex = 0xFFFFFFFF; + indices[index + indexOffset] = PxU32(translateTable[he->tail.index]); + index++; + he = he->next; + while (he != face.edge) + { + indices[index + indexOffset] = PxU32(translateTable[he->tail.index]); + index++; + he->edgeIndex = 0xFFFFFFFF; + he = he->next; + } + + // create polygon + PxHullPolygon polygon; + polygon.mPlane[0] = face.normal[0]; + polygon.mPlane[1] = face.normal[1]; + polygon.mPlane[2] = face.normal[2]; + polygon.mPlane[3] = -face.planeOffset; + + polygon.mIndexBase = indexOffset; + polygon.mNbVerts = face.numEdges; + indexOffset += face.numEdges; + polygons[numFacesOut] = polygon; + mFaceTranslateTable[numFacesOut] = PxTo16(faceIndex); + face.outIndex = PxTo8(numFacesOut); + numFacesOut++; + } + } + + PX_ASSERT(mQuickHull->mNumHullFaces == numFacesOut); +} + +////////////////////////////////////////////////////////////////////////// +// fill the desc from cropped hull data +void QuickHullConvexHullLib::fillConvexMeshDescFromCroppedHull(PxConvexMeshDesc& outDesc) +{ + PX_ASSERT(mCropedConvexHull); + + // allocate the output buffers + const PxU32 numIndices = mCropedConvexHull->getEdges().size(); + const PxU32 numPolygons = mCropedConvexHull->getFacets().size(); + const PxU32 numVertices = mCropedConvexHull->getVertices().size(); + const PxU32 indicesBufferSize = sizeof(PxU32)*numIndices; + const PxU32 facesBufferSize = sizeof(PxHullPolygon)*numPolygons; + const PxU32 verticesBufferSize = sizeof(PxVec3)*(numVertices + 1); // allocate additional vec3 for V4 safe load in VolumeInteration + const PxU32 bufferMemorySize = indicesBufferSize + verticesBufferSize + facesBufferSize; + mOutMemoryBuffer = reinterpret_cast(PX_ALLOC(bufferMemorySize, "ConvexMeshDesc")); + + // parse the hullOut and fill the result with vertices and polygons + PxU32* indicesOut = reinterpret_cast (mOutMemoryBuffer); + PxHullPolygon* polygonsOut = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize); + PxVec3* vertsOut = reinterpret_cast (mOutMemoryBuffer + indicesBufferSize + facesBufferSize); + PxMemCopy(vertsOut, mCropedConvexHull->getVertices().begin(), sizeof(PxVec3)*numVertices); + + PxU32 i = 0; + PxU32 k = 0; + PxU32 j = 1; + while (i < mCropedConvexHull->getEdges().size()) + { + j = 1; + PxHullPolygon& polygon = polygonsOut[k]; + // get num indices per polygon + while (j + i < mCropedConvexHull->getEdges().size() && mCropedConvexHull->getEdges()[i].p == mCropedConvexHull->getEdges()[i + j].p) + { + j++; + } + polygon.mNbVerts = PxTo16(j); + polygon.mIndexBase = PxTo16(i); + + // get the plane + polygon.mPlane[0] = mCropedConvexHull->getFacets()[k].n[0]; + polygon.mPlane[1] = mCropedConvexHull->getFacets()[k].n[1]; + polygon.mPlane[2] = mCropedConvexHull->getFacets()[k].n[2]; + + polygon.mPlane[3] = mCropedConvexHull->getFacets()[k].d; + + while (j--) + { + indicesOut[i] = mCropedConvexHull->getEdges()[i].v; + i++; + } + k++; + } + + PX_ASSERT(k == mCropedConvexHull->getFacets().size()); + + outDesc.indices.count = numIndices; + outDesc.indices.stride = sizeof(PxU32); + outDesc.indices.data = indicesOut; + + outDesc.points.count = numVertices; + outDesc.points.stride = sizeof(PxVec3); + outDesc.points.data = vertsOut; + + outDesc.polygons.count = numPolygons; + outDesc.polygons.stride = sizeof(PxHullPolygon); + outDesc.polygons.data = polygonsOut; + + swapLargestFace(outDesc); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.h new file mode 100644 index 0000000..2bce1fe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingQuickHullConvexHullLib.h @@ -0,0 +1,97 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_QUICKHULL_CONVEXHULLLIB_H +#define GU_COOKING_QUICKHULL_CONVEXHULLLIB_H + +#include "GuCookingConvexHullLib.h" +#include "foundation/PxArray.h" +#include "foundation/PxUserAllocated.h" + +namespace local +{ + class QuickHull; + struct QuickHullVertex; +} + +namespace physx +{ + class ConvexHull; + + ////////////////////////////////////////////////////////////////////////// + // Quickhull lib constructs the hull from given input points. The resulting hull + // will only contain a subset of the input points. The algorithm does incrementally + // adds most furthest vertices to the starting simplex. The produced hulls are build with high precision + // and produce more stable and correct results, than the legacy algorithm. + class QuickHullConvexHullLib: public ConvexHullLib, public PxUserAllocated + { + PX_NOCOPY(QuickHullConvexHullLib) + public: + + // functions + QuickHullConvexHullLib(const PxConvexMeshDesc& desc, const PxCookingParams& params); + + ~QuickHullConvexHullLib(); + + // computes the convex hull from provided points + virtual PxConvexMeshCookingResult::Enum createConvexHull(); + + // fills the convexmeshdesc with computed hull data + virtual void fillConvexMeshDesc(PxConvexMeshDesc& desc); + + // provide the edge list information + virtual bool createEdgeList(const PxU32, const PxU8* , PxU8** , PxU16** , PxU16** ); + + protected: + // if vertex limit reached we need to expand the hull using the OBB slicing + PxConvexMeshCookingResult::Enum expandHullOBB(); + + // if vertex limit reached we need to expand the hull using the plane shifting + PxConvexMeshCookingResult::Enum expandHull(); + + // checks for collinearity and co planarity + // returns true if the simplex was ok, we can reuse the computed tolerances and min/max values + bool cleanupForSimplex(PxVec3* vertices, PxU32 vertexCount, local::QuickHullVertex* minimumVertex, + local::QuickHullVertex* maximumVertex, float& tolerance, float& planeTolerance); + + // fill the result desc from quick hull convex + void fillConvexMeshDescFromQuickHull(PxConvexMeshDesc& desc); + + // fill the result desc from cropped hull convex + void fillConvexMeshDescFromCroppedHull(PxConvexMeshDesc& desc); + + private: + local::QuickHull* mQuickHull; // the internal quick hull representation + ConvexHull* mCropedConvexHull; //the hull cropped from OBB, used for vertex limit path + + PxU8* mOutMemoryBuffer; // memory buffer used for output data + PxU16* mFaceTranslateTable; // translation table mapping output faces to internal quick hull table + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp new file mode 100644 index 0000000..dd1fe22 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.cpp @@ -0,0 +1,2868 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#define USE_GJK_VIRTUAL + +#include "GuCookingTetrahedronMesh.h" +#include "GuTetrahedron.h" +#include "GuInternal.h" +#include "foundation/PxHashMap.h" +#include "GuCookingTriangleMesh.h" +#include "GuBV4Build.h" +#include "GuBV32Build.h" +#include "GuDistancePointTetrahedron.h" +#ifdef USE_GJK_VIRTUAL + #include "GuGJKTest.h" +#else + #include "GuGJKUtil.h" + #include "GuGJK.h" +#endif +#include "GuVecTetrahedron.h" +#include "GuGJKType.h" +#include "GuCooking.h" +#include "GuBounds.h" +#include "CmSerialize.h" +#include "foundation/PxFPU.h" +#include "common/PxInsertionCallback.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/*TetrahedronMeshBuilder::TetrahedronMeshBuilder(const PxCookingParams& params) : mParams(params) +{ + +}*/ + +void TetrahedronMeshBuilder::recordTetrahedronIndices(const TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, bool buildGPUData) +{ + if (buildGPUData) + { + PX_ASSERT(!(collisionMesh.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + PX_ASSERT(collisionData.mGRB_primIndices); + + //copy the BV4 tetrahedron indices to mGRB_primIndices + PxMemCopy(collisionData.mGRB_primIndices, collisionMesh.mTetrahedrons, sizeof(IndTetrahedron32) * collisionMesh.mNbTetrahedrons); + } +} + +class SortedTriangleInds +{ +public: + + SortedTriangleInds() {} + + SortedTriangleInds(const PxU32 ref0, const PxU32 ref1, const PxU32 ref2) + { + initialize(ref0, ref1, ref2); + } + + SortedTriangleInds(const PxU16 ref0, const PxU16 ref1, const PxU16 ref2) + { + initialize(PxU32(ref0), PxU32(ref1), PxU32(ref2)); + } + + void initialize(const PxU32 ref0, const PxU32 ref1, const PxU32 ref2) + { + mOrigRef[0] = ref0; + mOrigRef[1] = ref1; + mOrigRef[2] = ref2; + if (ref0 < ref1 && ref0 < ref2) + { + mRef0 = ref0; + mRef1 = PxMin(ref1, ref2); + mRef2 = PxMax(ref1, ref2); + } + else if (ref1 < ref2) + { + mRef0 = ref1; + mRef1 = PxMin(ref0, ref2); + mRef2 = PxMax(ref0, ref2); + } + else + { + mRef0 = ref2; + mRef1 = PxMin(ref0, ref1); + mRef2 = PxMax(ref0, ref1); + } + } + + bool operator == (const SortedTriangleInds& other) const + { + return other.mRef0 == mRef0 && other.mRef1 == mRef1 && other.mRef2 == mRef2; + } + + static uint32_t hash(const SortedTriangleInds key) + { + uint64_t k0 = (key.mRef0 & 0xffff); + uint64_t k1 = (key.mRef1 & 0xffff); + uint64_t k2 = (key.mRef2 & 0xffff); + + uint64_t k = (k2 << 32) | (k1 << 16) | k0; + k += ~(k << 32); + k ^= (k >> 22); + k += ~(k << 13); + k ^= (k >> 8); + k += (k << 3); + k ^= (k >> 15); + k += ~(k << 27); + k ^= (k >> 31); + return uint32_t(UINT32_MAX & k); + } + + void setTetIndex(const PxU32 tetIndex) + { + mTetIndex = tetIndex; + } + + PxU32 getTetIndex() + { + return mTetIndex; + } + + PxU32 mOrigRef[3]; + + PxU32 mRef0; + PxU32 mRef1; + PxU32 mRef2; + + PxU32 mTetIndex; +}; + +struct SortedTriangleIndsHash +{ + uint32_t operator()(const SortedTriangleInds& k) const + { + return SortedTriangleInds::hash(k); + } + bool equal(const SortedTriangleInds& k0, const SortedTriangleInds& k1) const + { + return k0 == k1; + } +}; + +bool TetrahedronMeshBuilder::importMesh(const PxTetrahedronMeshDesc& collisionMeshDesc, const PxCookingParams& params, + TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, bool validateMesh) +{ + PX_UNUSED(validateMesh); + //convert and clean the input mesh + //this is where the mesh data gets copied from user mem to our mem + + PxVec3* verts = collisionMesh.allocateVertices(collisionMeshDesc.points.count); + + collisionMesh.allocateTetrahedrons(collisionMeshDesc.tetrahedrons.count, 1); + if (params.buildGPUData) + collisionData.allocateCollisionData(collisionMeshDesc.tetrahedrons.count); + + TetrahedronT* tets = reinterpret_cast*>(collisionMesh.mTetrahedrons); + + //copy, and compact to get rid of strides: + immediateCooking::gatherStrided(collisionMeshDesc.points.data, verts, collisionMesh.mNbVertices, sizeof(PxVec3), collisionMeshDesc.points.stride); + +#if PX_CHECKED + // PT: check all input vertices are valid + for (PxU32 i = 0; i < collisionMeshDesc.points.count; i++) + { + const PxVec3& p = verts[i]; + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + return PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "input mesh contains corrupted vertex data"); + } +#endif + + TetrahedronT* dest = tets; + const TetrahedronT* pastLastDest = tets + collisionMesh.mNbTetrahedrons; + const PxU8* source = reinterpret_cast(collisionMeshDesc.tetrahedrons.data); + + //4 combos of 16 vs 32, feed in collisionMesh.mTetrahedrons + if (collisionMeshDesc.flags & PxMeshFlag::e16_BIT_INDICES) + { + while (dest < pastLastDest) + { + const PxU16 *tet16 = reinterpret_cast(source); + dest->v[0] = tet16[0]; + dest->v[1] = tet16[1]; + dest->v[2] = tet16[2]; + dest->v[3] = tet16[3]; + dest++; + source += collisionMeshDesc.tetrahedrons.stride; + } + } + else + { + while (dest < pastLastDest) + { + const PxU32 * tet32 = reinterpret_cast(source); + dest->v[0] = tet32[0]; + dest->v[1] = tet32[1]; + dest->v[2] = tet32[2]; + dest->v[3] = tet32[3]; + dest++; + source += collisionMeshDesc.tetrahedrons.stride; + } + } + + //copy the material index list if any: + if (collisionMeshDesc.materialIndices.data) + { + PxFEMMaterialTableIndex* materials = collisionMesh.allocateMaterials(); + immediateCooking::gatherStrided(collisionMeshDesc.materialIndices.data, materials, collisionMesh.mNbTetrahedrons, sizeof(PxMaterialTableIndex), collisionMeshDesc.materialIndices.stride); + + // Check material indices + for (PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; i++) PX_ASSERT(materials[i] != 0xffff); + } + + // we need to fill the remap table if no cleaning was done + if (params.suppressTriangleMeshRemapTable == false) + { + PX_ASSERT(collisionData.mFaceRemap == NULL); + collisionData.mFaceRemap = PX_ALLOCATE(PxU32, collisionMesh.mNbTetrahedrons, "mFaceRemap"); + for (PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; i++) + collisionData.mFaceRemap[i] = i; + } + + return true; +} + +void TetrahedronMeshBuilder::createGRBMidPhaseAndData(const PxU32 originalTetrahedronCount, TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, const PxCookingParams& params) +{ + PX_UNUSED(originalTetrahedronCount); + if (params.buildGPUData) + { + PX_ASSERT(!(collisionMesh.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + BV32Tree* bv32Tree = PX_NEW(BV32Tree); + collisionData.mGRB_BV32Tree = bv32Tree; + + BV32TetrahedronMeshBuilder::createMidPhaseStructure(params, collisionMesh, *bv32Tree, collisionData); + + //create surface triangles, one tetrahedrons has 4 triangles + PxHashMap triIndsMap; + + //for trigs index stride conversion and eventual reordering is also needed, I don't think flexicopy can do that for us. + + IndTetrahedron32* dest = reinterpret_cast(collisionData.mGRB_primIndices); + + for(PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; ++i) + { + IndTetrahedron32& tetInd = dest[i]; + + SortedTriangleInds t0(tetInd.mRef[0], tetInd.mRef[1], tetInd.mRef[2]); + t0.setTetIndex(i); + triIndsMap[t0] += 1; + + SortedTriangleInds t1(tetInd.mRef[1], tetInd.mRef[3], tetInd.mRef[2]); + t1.setTetIndex(i); + triIndsMap[t1] += 1; + + SortedTriangleInds t2(tetInd.mRef[0], tetInd.mRef[3], tetInd.mRef[1]); + t2.setTetIndex(i); + triIndsMap[t2] += 1; + + SortedTriangleInds t3(tetInd.mRef[0], tetInd.mRef[2], tetInd.mRef[3]); + t3.setTetIndex(i); + triIndsMap[t3] += 1; + } + + PxMemZero(collisionData.mGRB_tetraSurfaceHint, collisionMesh.mNbTetrahedrons * sizeof(PxU8)); + + PxU8* tetHint = reinterpret_cast(collisionData.mGRB_tetraSurfaceHint); + + PxU32 triCount = 0; + //compute the surface triangles for the tetrahedron mesh + for (PxHashMap::Iterator iter = triIndsMap.getIterator(); !iter.done(); ++iter) + { + SortedTriangleInds key = iter->first; + + // only output faces that are referenced by one tet (open faces) + if (iter->second == 1) + { + PxU8 triHint = 0; + IndTetrahedron32& localTetra = dest[key.mTetIndex]; + for (PxU32 i = 0; i < 3; ++i) + { + if (key.mOrigRef[i] == localTetra.mRef[0]) + triHint |= 1; + else if (key.mOrigRef[i] == localTetra.mRef[1]) + triHint |= (1 << 1); + else if (key.mOrigRef[i] == localTetra.mRef[2]) + triHint |= (1 << 2); + else if (key.mOrigRef[i] == localTetra.mRef[3]) + triHint |= (1 << 3); + } + + //if this tetrahedron isn't surface tetrahedron, hint will be zero + //otherwise, the first 4 bits will indicate the indice of the + //surface triangle + + PxU32 mask = 0; + if (triHint == 7) //0111 + { + mask = 1 << 0; + } + else if (triHint == 11)//1011 + { + mask = 1 << 1; + } + else if (triHint == 13)//1101 + { + mask = 1 << 2; + } + else //1110 + { + mask = 1 << 3; + } + + tetHint[key.mTetIndex] |= mask; + + triCount++; + } + } + +#if BV32_VALIDATE + IndTetrahedron32* grbTriIndices = reinterpret_cast(collisionData.mGRB_primIndices); + IndTetrahedron32* cpuTriIndices = reinterpret_cast(collisionMesh.mTetrahedrons); + //map CPU remap triangle index to GPU remap triangle index + for (PxU32 i = 0; i < nbTetrahedrons; ++i) + { + PX_ASSERT(grbTriIndices[i].mRef[0] == cpuTriIndices[collisionData.mGRB_faceRemap[i]].mRef[0]); + PX_ASSERT(grbTriIndices[i].mRef[1] == cpuTriIndices[collisionData.mGRB_faceRemap[i]].mRef[1]); + PX_ASSERT(grbTriIndices[i].mRef[2] == cpuTriIndices[collisionData.mGRB_faceRemap[i]].mRef[2]); + PX_ASSERT(grbTriIndices[i].mRef[3] == cpuTriIndices[collisionData.mGRB_faceRemap[i]].mRef[3]); + } +#endif + } +} + +void computeRestPoseAndPointMass(TetrahedronT* tetIndices, const PxU32 nbTets, + const PxVec3* verts, PxReal* invMasses, PxMat33* restPoses) +{ + for (PxU32 i = 0; i < nbTets; ++i) + { + TetrahedronT& tetInd = tetIndices[i]; + PxMat33 Q; + const PxReal volume = computeTetrahedronVolume(verts[tetInd.v[0]], verts[tetInd.v[1]], verts[tetInd.v[2]], verts[tetInd.v[3]], Q); + if (volume <= 1.e-9f) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeRestPoseAndPointMass(): tretrahedron is degenerate or inverted"); + } + + // add volume fraction to particles + if (invMasses != NULL) + { + invMasses[tetInd.v[0]] += volume * 0.25f; + invMasses[tetInd.v[1]] += volume * 0.25f; + invMasses[tetInd.v[2]] += volume * 0.25f; + invMasses[tetInd.v[3]] += volume * 0.25f; + } + + restPoses[i] = Q.getInverse(); + } +} + +#define MAX_NUM_PARTITIONS 32 + +PxU32 computeTetrahedronPartition(const TetrahedronT* tets, const PxU32 partitionStartIndex, PxU32* partitionProgresses, + const PxU32 numTetsPerElement) +{ + PxU32 combinedMask = 0xFFFFFFFF; + + for (PxU32 i = 0; i < numTetsPerElement; ++i) + { + PxU32 partitionA = partitionProgresses[tets[i].v[0]]; + PxU32 partitionB = partitionProgresses[tets[i].v[1]]; + PxU32 partitionC = partitionProgresses[tets[i].v[2]]; + PxU32 partitionD = partitionProgresses[tets[i].v[3]]; + + combinedMask &= (~partitionA & ~partitionB & ~partitionC & ~partitionD); + } + PxU32 availablePartition = combinedMask == 0 ? MAX_NUM_PARTITIONS : PxLowestSetBit(combinedMask); + + if (availablePartition == MAX_NUM_PARTITIONS) + return 0xFFFFFFFF; + + const PxU32 partitionBit = (1u << availablePartition); + + for (PxU32 i = 0; i < numTetsPerElement; ++i) + { + PxU32 partitionA = partitionProgresses[tets[i].v[0]]; + PxU32 partitionB = partitionProgresses[tets[i].v[1]]; + PxU32 partitionC = partitionProgresses[tets[i].v[2]]; + PxU32 partitionD = partitionProgresses[tets[i].v[3]]; + + partitionA |= partitionBit; + partitionB |= partitionBit; + partitionC |= partitionBit; + partitionD |= partitionBit; + + partitionProgresses[tets[i].v[0]] = partitionA; + partitionProgresses[tets[i].v[1]] = partitionB; + partitionProgresses[tets[i].v[2]] = partitionC; + partitionProgresses[tets[i].v[3]] = partitionD; + } + + availablePartition += partitionStartIndex; + + return availablePartition; +} + +void classifyTetrahedrons(const TetrahedronT* tets, const PxU32 numTets, const PxU32 numVerts, const PxU32 numTetsPerElement, + PxU32* partitionProgresses, PxU32* tempTetrahedrons, PxArray& tetrahedronsPerPartition) +{ + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * numVerts); + + PxU32 numUnpartitionedTetrahedrons = 0; + //compute partitions for each tetrahedron in the grid model + + for (PxU32 i = 0; i < numTets; i += numTetsPerElement) + { + const TetrahedronT* tet = &tets[i]; + + const PxU32 availablePartition = computeTetrahedronPartition(tet, 0, partitionProgresses, numTetsPerElement); + + if (availablePartition == 0xFFFFFFFF) + { + tempTetrahedrons[numUnpartitionedTetrahedrons++] = i; + continue; + } + + tetrahedronsPerPartition[availablePartition]++; + } + + PxU32 partitionStartIndex = 0; + + while (numUnpartitionedTetrahedrons > 0) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * numVerts); + + partitionStartIndex += MAX_NUM_PARTITIONS; + //Keep partitioning the un-partitioned constraints and blat the whole thing to 0! + tetrahedronsPerPartition.resize(MAX_NUM_PARTITIONS + tetrahedronsPerPartition.size()); + PxMemZero(tetrahedronsPerPartition.begin() + partitionStartIndex, sizeof(PxU32) * MAX_NUM_PARTITIONS); + + PxU32 newNumUnpartitionedConstraints = 0; + + for (PxU32 i = 0; i < numUnpartitionedTetrahedrons; ++i) + { + const PxU32 tetInd = tempTetrahedrons[i]; + + const TetrahedronT* tet = &tets[tetInd]; + + const PxU32 availablePartition = computeTetrahedronPartition(tet, partitionStartIndex, partitionProgresses, numTetsPerElement); + + if (availablePartition == 0xFFFFFFFF) + { + tempTetrahedrons[newNumUnpartitionedConstraints++] = tetInd; + continue; + } + + tetrahedronsPerPartition[availablePartition]++; + } + + numUnpartitionedTetrahedrons = newNumUnpartitionedConstraints; + } +} + +void writeTetrahedrons(const TetrahedronT* tets, const PxU32 numTets, const PxU32 numVerts, const PxU32 numTetsPerElement, + PxU32* partitionProgresses, PxU32* tempTetrahedrons, PxU32* orderedTetrahedrons, + PxU32* accumulatedTetrahedronPerPartition) +{ + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * numVerts); + + PxU32 numUnpartitionedTetrahedrons = 0; + + for (PxU32 i = 0; i < numTets; i += numTetsPerElement) + { + const TetrahedronT* tet = &tets[i]; + + const PxU32 availablePartition = computeTetrahedronPartition(tet, 0, partitionProgresses, numTetsPerElement); + + if (availablePartition == 0xFFFFFFFF) + { + tempTetrahedrons[numUnpartitionedTetrahedrons++] = i; + continue; + } + + //output tetrahedron + orderedTetrahedrons[accumulatedTetrahedronPerPartition[availablePartition]++] = i; + } + + PxU32 partitionStartIndex = 0; + + while (numUnpartitionedTetrahedrons > 0) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * numVerts); + + partitionStartIndex += MAX_NUM_PARTITIONS; + + PxU32 newNumUnpartitionedConstraints = 0; + + for (PxU32 i = 0; i < numUnpartitionedTetrahedrons; ++i) + { + const PxU32 tetInd = tempTetrahedrons[i]; + const TetrahedronT* tet = &tets[tetInd]; + + const PxU32 availablePartition = computeTetrahedronPartition(tet, partitionStartIndex, partitionProgresses, numTetsPerElement); + + if (availablePartition == 0xFFFFFFFF) + { + tempTetrahedrons[newNumUnpartitionedConstraints++] = tetInd; + continue; + } + + //output tetrahedrons + orderedTetrahedrons[accumulatedTetrahedronPerPartition[availablePartition]++] = tetInd; + } + + numUnpartitionedTetrahedrons = newNumUnpartitionedConstraints; + } +} + +PxU32* computeGridModelTetrahedronPartitions(const TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData) +{ + const PxU32 numTets = simulationMesh.mNbTetrahedrons; + const PxU32 numVerts = simulationMesh.mNbVertices; + + //each grid model verts has a partition progress counter + PxU32* partitionProgresses = PX_ALLOCATE(PxU32, numVerts, "partitionProgress"); + + //this store the tetrahedron index for the unpartitioned tetrahedrons + PxU32* tempTetrahedrons = PX_ALLOCATE(PxU32, numTets, "tempTetrahedrons"); + + PxArray tetrahedronsPerPartition; + tetrahedronsPerPartition.reserve(MAX_NUM_PARTITIONS); + tetrahedronsPerPartition.forceSize_Unsafe(MAX_NUM_PARTITIONS); + + PxMemZero(tetrahedronsPerPartition.begin(), sizeof(PxU32) * MAX_NUM_PARTITIONS); + + const TetrahedronT* tetGM = reinterpret_cast*>(simulationMesh.mTetrahedrons); + + classifyTetrahedrons(tetGM, numTets, numVerts, simulationData.mNumTetsPerElement, partitionProgresses, + tempTetrahedrons, tetrahedronsPerPartition); + + //compute number of partitions + PxU32 maxPartition = 0; + for (PxU32 a = 0; a < tetrahedronsPerPartition.size(); ++a, maxPartition++) + { + if (tetrahedronsPerPartition[a] == 0) + break; + } + + PxU32* accumulatedTetrahedronPerPartition = PX_ALLOCATE(PxU32, maxPartition, "accumulatedTetrahedronPerPartition"); + + //compute run sum + PxU32 accumulation = 0; + for (PxU32 a = 0; a < maxPartition; ++a) + { + PxU32 count = tetrahedronsPerPartition[a]; + accumulatedTetrahedronPerPartition[a] = accumulation; + accumulation += count; + } + + PX_ASSERT(accumulation*simulationData.mNumTetsPerElement == numTets); + + simulationData.mGridModelOrderedTetrahedrons = PX_ALLOCATE(PxU32, numTets, "mGridModelPartitionTetrahedrons"); + simulationData.mGridModelNbPartitions = maxPartition; + + PxU32* orderedTetrahedrons = simulationData.mGridModelOrderedTetrahedrons; + + writeTetrahedrons(tetGM, numTets, numVerts, simulationData.mNumTetsPerElement, partitionProgresses, tempTetrahedrons, + orderedTetrahedrons, accumulatedTetrahedronPerPartition); + + ////validate ordertedTetrahedrons + //for (PxU32 i = 0; i < numTets; ++i) + //{ + // PxU32 tetrahedronIdx = orderedTetrahedrons[i]; + // for (PxU32 j = i + 1; j < numTets; ++j) + // { + // PxU32 tetIdx = orderedTetrahedrons[j]; + // PX_ASSERT(tetrahedronIdx != tetIdx); + // } + //} + + PX_FREE(partitionProgresses); + PX_FREE(tempTetrahedrons); + + return accumulatedTetrahedronPerPartition; +} + +bool findSlot(const TetrahedronT* tetraIndices, bool* occupied, const PxU32 tetrahedronIdx, + const PxU32 offset, const PxU32 sVertInd, const PxU32 workIndex) +{ + const TetrahedronT& tetraInd = tetraIndices[tetrahedronIdx]; + + for (PxU32 i = 0; i < 4; ++i) + { + const PxU32 dVertInd = i * offset + workIndex; + if (sVertInd == tetraInd.v[i] && (!occupied[dVertInd])) + { + occupied[dVertInd] = true; + return true; + } + } + + return false; +} + +//output to remapOutput +bool findSlot(const TetrahedronT* tetraIndices, bool* occupied, const PxU32 tetrahedronIdx, + const PxU32 offset, const PxU32 sVertInd, const PxU32 sVertIndOffset, PxU32* remapOutput, + PxU32* accumulatedWriteBackIndex, const PxU32 workIndex) +{ + const TetrahedronT& tetraInd = tetraIndices[tetrahedronIdx]; + + for (PxU32 i = 0; i < 4; ++i) + { + const PxU32 dVertIndOffset = i * offset + workIndex; + if (sVertInd == tetraInd.v[i] && (!occupied[dVertIndOffset])) + { + remapOutput[sVertIndOffset] = dVertIndOffset; + accumulatedWriteBackIndex[dVertIndOffset] = sVertIndOffset; + occupied[dVertIndOffset] = true; + return true; + } + } + + return false; +} + +void computeNumberOfCopiesPerVerts(const PxU32 maximumPartitions, PxU32* combineAccumulatedTetraPerPartitions, + const TetrahedronT* tetraIndices, const PxU32* orderedTetrahedrons, const PxU32 offset, bool* occupied, PxU32* numCopiesEachVerts) +{ + //compute numCopiesEachVerts + PxU32 startId = 0; + for (PxU32 i = 0; i < maximumPartitions; ++i) + { + PxU32 endId = combineAccumulatedTetraPerPartitions[i]; + + for (PxU32 j = startId; j < endId; ++j) + { + const PxU32 tetrahedronInd = orderedTetrahedrons[j]; + + const TetrahedronT& tetraInd = tetraIndices[tetrahedronInd]; + + for (PxU32 b = 0; b < 4; ++b) + { + const PxU32 vertInd = tetraInd.v[b]; + + bool found = false; + for (PxU32 k = i + 1; k < maximumPartitions; ++k) + { + const PxU32 tStartId = combineAccumulatedTetraPerPartitions[k - 1]; + const PxU32 tEndId = combineAccumulatedTetraPerPartitions[k]; + + bool foundSlotInThisPartition = false; + for (PxU32 a = tStartId; a < tEndId; ++a) + { + const PxU32 otherTetrahedronInd = orderedTetrahedrons[a]; + if (findSlot(tetraIndices, occupied, otherTetrahedronInd, offset, vertInd, a)) + { + foundSlotInThisPartition = true; + break; + } + } + + if (foundSlotInThisPartition) + { + found = true; + break; + } + } + + if (!found) + { + numCopiesEachVerts[vertInd]++; + } + + } + + } + + startId = endId; + } +} + +//compute remapOutput +void computeRemapOutputForVertsAndAccumulatedBuffer(const PxU32 maximumPartitions, PxU32* combineAccumulatedTetraPerPartitions, + const TetrahedronT* tetraIndices, const PxU32* orderedTetrahedrons, const PxU32 offset, bool* occupied, PxU32* tempNumCopiesEachVerts, const PxU32* accumulatedCopies, + const PxU32 numVerts, PxU32* remapOutput, + PxU32* accumulatedWriteBackIndex, const PxU32 totalNumCopies) +{ + PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * numVerts); + + const PxU32 totalNumVerts = offset * 4; + + PxMemZero(occupied, sizeof(bool) * totalNumVerts); + + //initialize accumulatedWriteBackIndex to itself + for (PxU32 i = 0; i < totalNumVerts; ++i) + { + accumulatedWriteBackIndex[i] = i; + } + + //compute remap output + PxU32 startId = 0; + for (PxU32 i = 0; i < maximumPartitions; ++i) + { + const PxU32 endId = combineAccumulatedTetraPerPartitions[i]; + + for (PxU32 j = startId; j < endId; ++j) + { + const PxU32 tetrahedronsIdx = orderedTetrahedrons[j]; + const TetrahedronT& tetraInd = tetraIndices[tetrahedronsIdx]; + + for (PxU32 b = 0; b < 4; ++b) + { + const PxU32 vertInd = tetraInd.v[b]; + const PxU32 vertOffset = j + offset * b; + bool found = false; + for (PxU32 k = i + 1; k < maximumPartitions; ++k) + { + const PxU32 tStartId = combineAccumulatedTetraPerPartitions[k-1]; + const PxU32 tEndId = combineAccumulatedTetraPerPartitions[k]; + + bool foundSlotInThisPartition = false; + for (PxU32 a = tStartId; a < tEndId; ++a) + { + const PxU32 otherTetrahedronInd = orderedTetrahedrons[a]; + if (findSlot(tetraIndices, occupied, otherTetrahedronInd, offset, vertInd, + vertOffset, remapOutput, accumulatedWriteBackIndex, a)) + { + foundSlotInThisPartition = true; + break; + } + } + + if (foundSlotInThisPartition) + { + found = true; + break; + } + } + + if (!found) + { + const PxU32 abVertStartInd = vertInd == 0 ? 0 : accumulatedCopies[vertInd - 1]; + const PxU32 index = totalNumVerts + abVertStartInd + tempNumCopiesEachVerts[vertInd]; + + //remapOutput for the current vert index + remapOutput[vertOffset] = index; + //const PxU32 writebackIndex = abVertStartInd + tempNumCopiesEachVerts[vertInd]; + //accumulatedWriteBackIndex[writebackIndex] = vertOffset; + + remapOutput[index] = vertOffset; + + tempNumCopiesEachVerts[vertInd]++; + } + } + } + + startId = endId; + } + + //PxU32* writeBackBuffer = &accumulatedWriteBackIndex[totalNumVerts]; + PxU32* accumulatedBufferRemap = &remapOutput[totalNumVerts]; + for (PxU32 i = 0; i < totalNumCopies; ++i) + { + PxU32 originalIndex = accumulatedBufferRemap[i]; + PxU32 wbIndex0, wbIndex1; + do + { + wbIndex0 = originalIndex; + wbIndex1 = accumulatedWriteBackIndex[wbIndex0]; + originalIndex = wbIndex1; + + } while (wbIndex0 != wbIndex1); + + accumulatedBufferRemap[i] = wbIndex1; + } +} + +//void combineGridModelPartitions(const TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, PxU32** accumulatedTetrahedronPerPartitions) +//{ +// const PxU32 numTets = simulationMesh.mNbTetrahedrons; +// const PxU32 numVerts = simulationMesh.mNbVertices; + +// const PxU32 nbPartitions = simulationData.mGridModelNbPartitions; + +// PxU32* accumulatedTetrahedronPerPartition = *accumulatedTetrahedronPerPartitions; + +// +// const PxU32 maximumPartitions = 8; +// PxU32* combineAccumulatedTetraPerPartitions = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * maximumPartitions, "combineAccumulatedTetraPerPartitions")); +// simulationData.mGMAccumulatedPartitionsCP = combineAccumulatedTetraPerPartitions; +// +// PxMemZero(combineAccumulatedTetraPerPartitions, sizeof(PxU32) * maximumPartitions); + +// const PxU32 maxAccumulatedPartitionsPerPartitions = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +// PxU32* orderedTetrahedrons = simulationData.mGridModelOrderedTetrahedrons; + +// PxU32* tempOrderedTetrahedrons = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * numTets, "tempOrderedTetrahedrons")); + +// const TetrahedronT* tetrahedrons = reinterpret_cast*>( simulationMesh.mTetrahedrons); +// +// const PxU32 maxAccumulatedCP = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +// const PxU32 partitionArraySize = maxAccumulatedCP * maximumPartitions; +// const PxU32 nbPartitionTables = partitionArraySize * numVerts; + +// PxU32* tempPartitionTablePerVert = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * nbPartitionTables, "tempPartitionTablePerVert")); +// PxU32* tempRemapTablePerVert = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * nbPartitionTables, "tempRemapTablePerVert")); + +// PxU32* pullIndices = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * numTets*4, "tempRemapTablePerVert")); +// PxU32* lastRef = reinterpret_cast(PX_ALLOC(sizeof(PxU32)* maxAccumulatedCP*numVerts, "refCounts")); + +// PxU32* accumulatedCopiesEachVerts = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * numVerts, "accumulatedCopiesEachVerts")); +// simulationData.mGMAccumulatedCopiesCP = accumulatedCopiesEachVerts; + +// PxU32* tempNumCopiesEachVerts = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * numVerts, "numCopiesEachVerts")); +// PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * numVerts); + +// PxMemSet(pullIndices, 0xffffffff, sizeof(PxU32)*numTets*4); +// PxMemSet(lastRef, 0xffffffff, sizeof(PxU32)*maxAccumulatedCP*numVerts); + +// //initialize partitionTablePerVert +// for (PxU32 i = 0; i < nbPartitionTables; ++i) +// { +// tempPartitionTablePerVert[i] = 0xffffffff; +// tempRemapTablePerVert[i] = 0xffffffff; +// +// } + +// PxU32 maxTetPerPartitions = 0; +// PxU32 count = 0; + +// const PxU32 totalNumVerts = numTets * 4; + +// PxU32 totalCopies = numVerts * maxAccumulatedCP; +// simulationData.mGridModelNbPartitions = maximumPartitions; +// simulationData.mGMRemapOutputSize = totalNumVerts + totalCopies; + +// ////allocate enough memory for the verts and the accumulation buffer +// //PxVec4* orderedVertsInMassCP = reinterpret_cast(PX_ALLOC(sizeof(PxVec4) * totalNumVerts, "mGMOrderedVertInvMassCP")); +// //data.mGMOrderedVertInvMassCP = orderedVertsInMassCP; + +// //compute remap table +// PxU32* remapOutput = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * simulationData.mGMRemapOutputSize, "remapOutput")); +// simulationData.mGMRemapOutputCP = remapOutput; + + +// for (PxU32 i = 0; i < maximumPartitions; ++i) +// { +// PxU32 totalTets = 0; +// for (PxU32 j = 0; j < maxAccumulatedPartitionsPerPartitions; ++j) +// { +// PxU32 partitionId = i + maximumPartitions * j; +// if (partitionId < nbPartitions) +// { +// const PxU32 startInd = partitionId == 0 ? 0 : accumulatedTetrahedronPerPartition[partitionId - 1]; +// const PxU32 endInd = accumulatedTetrahedronPerPartition[partitionId]; + +// for (PxU32 k = startInd; k < endInd; ++k) +// { +// const PxU32 tetraInd = orderedTetrahedrons[k]; +// tempOrderedTetrahedrons[count] = tetraInd; +// //tempCombinedTetraIndices[count] = tetGM[tetraInd]; +// //tempTetRestPose[count] = tetRestPose[tetraInd]; + +// PxU32 index = i * maxAccumulatedCP + j; + +// TetrahedronT tet = tetrahedrons[tetraInd]; +// tempPartitionTablePerVert[tet.v[0] * partitionArraySize + index] = count; +// tempPartitionTablePerVert[tet.v[1] * partitionArraySize + index] = count + numTets; +// tempPartitionTablePerVert[tet.v[2] * partitionArraySize + index] = count + numTets * 2; +// tempPartitionTablePerVert[tet.v[3] * partitionArraySize + index] = count + numTets * 3; + +// if (lastRef[tet.v[0] * maxAccumulatedCP + j] == 0xffffffff) +// { +// pullIndices[4 * count] = tet.v[0]; +// tempNumCopiesEachVerts[tet.v[0]]++; +// } +// else +// { +// remapOutput[lastRef[tet.v[0] * maxAccumulatedCP + j]] = count; +// } +// lastRef[tet.v[0] * maxAccumulatedCP + j] = 4*count; + +// if (lastRef[tet.v[1] * maxAccumulatedCP + j] == 0xffffffff) +// { +// pullIndices[4 * count + 1] = tet.v[1]; +// tempNumCopiesEachVerts[tet.v[1]]++; +// } +// else +// { +// remapOutput[lastRef[tet.v[1] * maxAccumulatedCP + j]] = count + numTets; +// } +// lastRef[tet.v[1] * maxAccumulatedCP + j] = 4*count + 1; + +// if (lastRef[tet.v[2] * maxAccumulatedCP + j] == 0xffffffff) +// { +// pullIndices[4 * count + 2] = tet.v[2]; +// tempNumCopiesEachVerts[tet.v[2]]++; +// +// } +// else +// { +// remapOutput[lastRef[tet.v[2] * maxAccumulatedCP + j]] = count + 2*numTets; +// } +// lastRef[tet.v[2] * maxAccumulatedCP + j] = 4*count+2; + +// if (lastRef[tet.v[3] * maxAccumulatedCP + j] == 0xffffffff) +// { +// pullIndices[4 * count + 3] = tet.v[3]; +// tempNumCopiesEachVerts[tet.v[3]]++; +// } +// else +// { +// remapOutput[lastRef[tet.v[3] * maxAccumulatedCP + j]] = count + 3*numTets; +// } +// lastRef[tet.v[3] * maxAccumulatedCP + j] = 4*count+3; + +// count++; +// } + +// totalTets += (endInd - startInd); +// } +// } + +// combineAccumulatedTetraPerPartitions[i] = count; +// maxTetPerPartitions = PxMax(maxTetPerPartitions, totalTets); +// } + +// //Last bit - output accumulation buffer... + +// +// PxU32 outIndex = 0; +// simulationData.mGridModelMaxTetsPerPartitions = maxTetPerPartitions; + +// //If this commented out, we don't use combined partition anymore +// PxMemCopy(orderedTetrahedrons, tempOrderedTetrahedrons, sizeof(PxU32) * numTets); + + +// /*bool* tempOccupied = reinterpret_cast ( PX_ALLOC(sizeof(bool) * totalNumVerts, "tempOccupied")); +// PxMemZero(tempOccupied, sizeof(bool) * totalNumVerts);*/ + +// +// //data.mGridModelNbPartitions = maximumPartitions; +// //data.mGMRemapOutputSize = totalNumVerts + totalCopies; +// simulationData.mGridModelNbPartitions = maximumPartitions; +// simulationData.mGMRemapOutputSize = totalNumVerts + totalCopies; + +// //data.mGMOrderedVertInvMassCP = orderedVertsInMassCP; +// //mGMOrderedVertInvMassCP = orderedVertsInMassCP; + +// //Last bit - output accumulation buffer... + +// outIndex = 0; +// for (PxU32 i = 0; i < numVerts; ++i) +// { + +// for (PxU32 j = 0; j < maxAccumulatedCP; ++j) +// { +// if (lastRef[i * maxAccumulatedCP + j] != 0xffffffff) +// { +// remapOutput[lastRef[i * maxAccumulatedCP + j]] = totalNumVerts + outIndex++; +// } +// } +// accumulatedCopiesEachVerts[i] = outIndex; +// } + + +// PX_ASSERT(count == numTets); + +// simulationData.mGridModelMaxTetsPerPartitions = maxTetPerPartitions; + +// simulationData.mGMPullIndices = pullIndices; + +// //If this commented out, we don't use combined partition anymore +// PxMemCopy(orderedTetrahedrons, tempOrderedTetrahedrons, sizeof(PxU32) * numTets); + +// PX_FREE(tempNumCopiesEachVerts); +// PX_FREE(tempOrderedTetrahedrons); +// PX_FREE(tempPartitionTablePerVert); +// PX_FREE(tempRemapTablePerVert); +// +// PX_FREE(lastRef); + +//} + +void combineGridModelPartitions(const TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, PxU32** accumulatedTetrahedronPerPartitions) +{ +const PxU32 numTets = simulationMesh.mNbTetrahedrons; +const PxU32 numVerts = simulationMesh.mNbVertices; + +const PxU32 nbPartitions = simulationData.mGridModelNbPartitions; + +PxU32* accumulatedTetrahedronPerPartition = *accumulatedTetrahedronPerPartitions; + +const PxU32 maximumPartitions = 8; +PxU32* combineAccumulatedTetraPerPartitions = PX_ALLOCATE(PxU32, maximumPartitions, "combineAccumulatedTetraPerPartitions"); +simulationData.mGMAccumulatedPartitionsCP = combineAccumulatedTetraPerPartitions; + +PxMemZero(combineAccumulatedTetraPerPartitions, sizeof(PxU32) * maximumPartitions); + +const PxU32 maxAccumulatedPartitionsPerPartitions = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +PxU32* orderedTetrahedrons = simulationData.mGridModelOrderedTetrahedrons; + +PxU32* tempOrderedTetrahedrons = PX_ALLOCATE(PxU32, numTets, "tempOrderedTetrahedrons"); + +const TetrahedronT* tetrahedrons = reinterpret_cast*>(simulationMesh.mTetrahedrons); + +const PxU32 maxAccumulatedCP = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +const PxU32 partitionArraySize = maxAccumulatedCP * maximumPartitions; +const PxU32 nbPartitionTables = partitionArraySize * numVerts; + +PxU32* tempPartitionTablePerVert = PX_ALLOCATE(PxU32, nbPartitionTables, "tempPartitionTablePerVert"); +PxU32* tempRemapTablePerVert = PX_ALLOCATE(PxU32, nbPartitionTables, "tempRemapTablePerVert"); + +PxU32* pullIndices = PX_ALLOCATE(PxU32, (numTets * 4), "tempRemapTablePerVert"); +PxU32* lastRef = PX_ALLOCATE(PxU32, (maxAccumulatedCP*numVerts), "refCounts"); + +PxU32* accumulatedCopiesEachVerts = PX_ALLOCATE(PxU32, numVerts, "accumulatedCopiesEachVerts"); +simulationData.mGMAccumulatedCopiesCP = accumulatedCopiesEachVerts; + +PxU32* tempNumCopiesEachVerts = PX_ALLOCATE(PxU32, numVerts, "numCopiesEachVerts"); +PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * numVerts); + +PxMemSet(pullIndices, 0xffffffff, sizeof(PxU32)*numTets * 4); +PxMemSet(lastRef, 0xffffffff, sizeof(PxU32)*maxAccumulatedCP*numVerts); + +//initialize partitionTablePerVert +for (PxU32 i = 0; i < nbPartitionTables; ++i) +{ + tempPartitionTablePerVert[i] = 0xffffffff; + tempRemapTablePerVert[i] = 0xffffffff; + +} + +PxU32 maxTetPerPartitions = 0; +PxU32 count = 0; + +const PxU32 totalNumVerts = numTets * 4; + +PxU32 totalCopies = numVerts * maxAccumulatedCP; +simulationData.mGridModelNbPartitions = maximumPartitions; +simulationData.mGMRemapOutputSize = totalNumVerts + totalCopies; + +////allocate enough memory for the verts and the accumulation buffer +//PxVec4* orderedVertsInMassCP = reinterpret_cast(PX_ALLOC(sizeof(PxVec4) * totalNumVerts, "mGMOrderedVertInvMassCP")); +//data.mGMOrderedVertInvMassCP = orderedVertsInMassCP; + +//compute remap table +PxU32* remapOutput = PX_ALLOCATE(PxU32, simulationData.mGMRemapOutputSize, "remapOutput"); +simulationData.mGMRemapOutputCP = remapOutput; + +for (PxU32 i = 0; i < maximumPartitions; ++i) +{ + PxU32 totalTets = 0; + for (PxU32 j = 0; j < maxAccumulatedPartitionsPerPartitions; ++j) + { + PxU32 partitionId = i + maximumPartitions * j; + if (partitionId < nbPartitions) + { + const PxU32 startInd = partitionId == 0 ? 0 : accumulatedTetrahedronPerPartition[partitionId - 1]; + const PxU32 endInd = accumulatedTetrahedronPerPartition[partitionId]; + + for (PxU32 k = startInd; k < endInd; ++k) + { + const PxU32 tetraInd = orderedTetrahedrons[k]; + tempOrderedTetrahedrons[count] = tetraInd; + //tempCombinedTetraIndices[count] = tetGM[tetraInd]; + //tempTetRestPose[count] = tetRestPose[tetraInd]; + + PxU32 index = i * maxAccumulatedCP + j; + + TetrahedronT tet = tetrahedrons[tetraInd]; + tempPartitionTablePerVert[tet.v[0] * partitionArraySize + index] = count; + tempPartitionTablePerVert[tet.v[1] * partitionArraySize + index] = count + numTets; + tempPartitionTablePerVert[tet.v[2] * partitionArraySize + index] = count + numTets * 2; + tempPartitionTablePerVert[tet.v[3] * partitionArraySize + index] = count + numTets * 3; + + if (lastRef[tet.v[0] * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * count] = tet.v[0]; + tempNumCopiesEachVerts[tet.v[0]]++; + } + else + { + remapOutput[lastRef[tet.v[0] * maxAccumulatedCP + j]] = count; + } + lastRef[tet.v[0] * maxAccumulatedCP + j] = 4 * count; + + if (lastRef[tet.v[1] * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * count + 1] = tet.v[1]; + tempNumCopiesEachVerts[tet.v[1]]++; + } + else + { + remapOutput[lastRef[tet.v[1] * maxAccumulatedCP + j]] = count + numTets; + } + lastRef[tet.v[1] * maxAccumulatedCP + j] = 4 * count + 1; + + if (lastRef[tet.v[2] * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * count + 2] = tet.v[2]; + tempNumCopiesEachVerts[tet.v[2]]++; + } + else + { + remapOutput[lastRef[tet.v[2] * maxAccumulatedCP + j]] = count + 2 * numTets; + } + lastRef[tet.v[2] * maxAccumulatedCP + j] = 4 * count + 2; + + if (lastRef[tet.v[3] * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * count + 3] = tet.v[3]; + tempNumCopiesEachVerts[tet.v[3]]++; + } + else + { + remapOutput[lastRef[tet.v[3] * maxAccumulatedCP + j]] = count + 3 * numTets; + } + lastRef[tet.v[3] * maxAccumulatedCP + j] = 4 * count + 3; + + count++; + } + + totalTets += (endInd - startInd); + } + } + + combineAccumulatedTetraPerPartitions[i] = count; + maxTetPerPartitions = PxMax(maxTetPerPartitions, totalTets); +} + +//Last bit - output accumulation buffer... + +PxU32 outIndex = 0; +for (PxU32 i = 0; i < numVerts; ++i) +{ + + for (PxU32 j = 0; j < maxAccumulatedCP; ++j) + { + if (lastRef[i * maxAccumulatedCP + j] != 0xffffffff) + { + remapOutput[lastRef[i * maxAccumulatedCP + j]] = totalNumVerts + outIndex++; + } + } + accumulatedCopiesEachVerts[i] = outIndex; +} + +PX_ASSERT(count == numTets); + +simulationData.mGridModelMaxTetsPerPartitions = maxTetPerPartitions; + +simulationData.mGMPullIndices = pullIndices; + +//If this commented out, we don't use combined partition anymore +PxMemCopy(orderedTetrahedrons, tempOrderedTetrahedrons, sizeof(PxU32) * numTets); + +PX_FREE(tempNumCopiesEachVerts); +PX_FREE(tempOrderedTetrahedrons); +PX_FREE(tempPartitionTablePerVert); +PX_FREE(tempRemapTablePerVert); +PX_FREE(lastRef); +} + +const PxI32 tetIndicesFromVoxels[8] = { 0, 1, 3, 14, 6, 11, 2, 18 }; +//const PxI32 tets6PerVoxel[24] = { 0,1,6,2, 0,1,4,6, 1,4,6,5, 1,2,3,6, 1,3,7,6, 1,5,6,7 }; + +void combineGridModelPartitionsHexMesh(const TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, PxU32** accumulatedTetrahedronPerPartitions) +{ +//const PxU32 numTets = simulationMesh.mNbTetrahedrons; +const PxU32 numElements = simulationMesh.mNbTetrahedrons/simulationData.mNumTetsPerElement; +const PxU32 numVerts = simulationMesh.mNbVertices; + +const PxU32 NumVertsPerElement = 8; + +const PxU32 nbPartitions = simulationData.mGridModelNbPartitions; + +PxU32* accumulatedTetrahedronPerPartition = *accumulatedTetrahedronPerPartitions; + +const PxU32 maximumPartitions = 8; +PxU32* combineAccumulatedTetraPerPartitions = PX_ALLOCATE(PxU32, maximumPartitions, "combineAccumulatedTetraPerPartitions"); +simulationData.mGMAccumulatedPartitionsCP = combineAccumulatedTetraPerPartitions; + +PxMemZero(combineAccumulatedTetraPerPartitions, sizeof(PxU32) * maximumPartitions); + +const PxU32 maxAccumulatedPartitionsPerPartitions = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +PxU32* orderedTetrahedrons = simulationData.mGridModelOrderedTetrahedrons; + +PxU32* tempOrderedTetrahedrons = PX_ALLOCATE(PxU32, numElements, "tempOrderedTetrahedrons"); + +const TetrahedronT* tetrahedrons = reinterpret_cast*>(simulationMesh.mTetrahedrons); + +const PxU32 maxAccumulatedCP = (nbPartitions + maximumPartitions - 1) / maximumPartitions; + +const PxU32 partitionArraySize = maxAccumulatedCP * maximumPartitions; +const PxU32 nbPartitionTables = partitionArraySize * numVerts; + +PxU32* tempPartitionTablePerVert = PX_ALLOCATE(PxU32, nbPartitionTables, "tempPartitionTablePerVert"); +PxU32* tempRemapTablePerVert = PX_ALLOCATE(PxU32, nbPartitionTables, "tempRemapTablePerVert"); + +PxU32* pullIndices = PX_ALLOCATE(PxU32, (numElements * NumVertsPerElement), "tempRemapTablePerVert"); +PxU32* lastRef = PX_ALLOCATE(PxU32, (maxAccumulatedCP*numVerts), "refCounts"); + +PxU32* accumulatedCopiesEachVerts = PX_ALLOCATE(PxU32, numVerts, "accumulatedCopiesEachVerts"); +simulationData.mGMAccumulatedCopiesCP = accumulatedCopiesEachVerts; + +PxU32* tempNumCopiesEachVerts = PX_ALLOCATE(PxU32, numVerts, "numCopiesEachVerts"); +PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * numVerts); + +PxMemSet(pullIndices, 0xffffffff, sizeof(PxU32)*numElements * NumVertsPerElement); +PxMemSet(lastRef, 0xffffffff, sizeof(PxU32)*maxAccumulatedCP*numVerts); + +//initialize partitionTablePerVert +for (PxU32 i = 0; i < nbPartitionTables; ++i) +{ + tempPartitionTablePerVert[i] = 0xffffffff; + tempRemapTablePerVert[i] = 0xffffffff; + +} + +PxU32 maxTetPerPartitions = 0; +PxU32 count = 0; + +const PxU32 totalNumVerts = numElements* NumVertsPerElement; + +PxU32 totalCopies = numVerts * maxAccumulatedCP; +simulationData.mGridModelNbPartitions = maximumPartitions; +simulationData.mGMRemapOutputSize = totalNumVerts + totalCopies; + +////allocate enough memory for the verts and the accumulation buffer +//PxVec4* orderedVertsInMassCP = reinterpret_cast(PX_ALLOC(sizeof(PxVec4) * totalNumVerts, "mGMOrderedVertInvMassCP")); +//data.mGMOrderedVertInvMassCP = orderedVertsInMassCP; + +//compute remap table +PxU32* remapOutput = PX_ALLOCATE(PxU32, simulationData.mGMRemapOutputSize, "remapOutput"); +simulationData.mGMRemapOutputCP = remapOutput; + +for (PxU32 i = 0; i < maximumPartitions; ++i) +{ + PxU32 totalTets = 0; + for (PxU32 j = 0; j < maxAccumulatedPartitionsPerPartitions; ++j) + { + PxU32 partitionId = i + maximumPartitions * j; + if (partitionId < nbPartitions) + { + const PxU32 startInd = partitionId == 0 ? 0 : accumulatedTetrahedronPerPartition[partitionId - 1]; + const PxU32 endInd = accumulatedTetrahedronPerPartition[partitionId]; + + for (PxU32 k = startInd; k < endInd; ++k) + { + const PxU32 tetraInd = orderedTetrahedrons[k]; + tempOrderedTetrahedrons[count] = tetraInd; + + PxU32 index = i * maxAccumulatedCP + j; + + const PxU32* tetInds = reinterpret_cast(&tetrahedrons[tetraInd]); + + for (PxU32 v = 0; v < 4; ++v) + { + PxU32 vertInd = tetInds[tetIndicesFromVoxels[v]]; + tempPartitionTablePerVert[vertInd * partitionArraySize + index] = count + numElements * v; + + if (lastRef[vertInd * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * count + v] = vertInd; + tempNumCopiesEachVerts[vertInd]++; + } + else + { + remapOutput[lastRef[vertInd * maxAccumulatedCP + j]] = count + v * numElements; + } + lastRef[vertInd * maxAccumulatedCP + j] = 4 * count + v; + } + + for (PxU32 v = 0; v < 4; ++v) + { + //vertex index + PxU32 vertInd = tetInds[tetIndicesFromVoxels[v+4]]; + //Where the vertex data will be written to/read from + tempPartitionTablePerVert[vertInd * partitionArraySize + index] = count + numElements * (v+4); + + if (lastRef[vertInd * maxAccumulatedCP + j] == 0xffffffff) + { + pullIndices[4 * (count + numElements) + v] = vertInd; + tempNumCopiesEachVerts[vertInd]++; + } + else + { + remapOutput[lastRef[vertInd * maxAccumulatedCP + j]] = count + (v+4) * numElements; + } + lastRef[vertInd * maxAccumulatedCP + j] = 4 * (numElements + count) + v; + } + + count++; + } + + totalTets += (endInd - startInd); + } + } + + combineAccumulatedTetraPerPartitions[i] = count; + maxTetPerPartitions = PxMax(maxTetPerPartitions, totalTets); +} + +//Last bit - output accumulation buffer... + +PxU32 outIndex = 0; +for (PxU32 i = 0; i < numVerts; ++i) +{ + + for (PxU32 j = 0; j < maxAccumulatedCP; ++j) + { + if (lastRef[i * maxAccumulatedCP + j] != 0xffffffff) + { + remapOutput[lastRef[i * maxAccumulatedCP + j]] = totalNumVerts + outIndex++; + } + } + accumulatedCopiesEachVerts[i] = outIndex; +} + + +PX_ASSERT(count == numElements); + +simulationData.mGridModelMaxTetsPerPartitions = maxTetPerPartitions; + +simulationData.mGMPullIndices = pullIndices; + +//If this commented out, we don't use combined partition anymore +PxMemCopy(orderedTetrahedrons, tempOrderedTetrahedrons, sizeof(PxU32) * numElements); + +PX_FREE(tempNumCopiesEachVerts); +PX_FREE(tempOrderedTetrahedrons); +PX_FREE(tempPartitionTablePerVert); +PX_FREE(tempRemapTablePerVert); +PX_FREE(lastRef); + +} + +struct DistanceCheck +{ + //input + PxVec3* mVerts; + IndTetrahedron32* mTetrahedron32; + PxVec3 mOriginalVert; + + //output + PxU32 mTetInd; + PxReal mDistanceSq; + PxVec3 mClosestPoint; + + //these data are for validation only + PxU32 mNbPrimsPerLeaf; + PxU32 mNbPrims; +}; + +static bool gDistanceNodeCheckCallback(const AABBTreeNode* current, void* userData) +{ + DistanceCheck* Data = reinterpret_cast(userData); + const PxVec3& p = Data->mOriginalVert; + + const AABBTreeNode* posNode = current->getPos(); + const AABBTreeNode* negNode = current->getNeg(); + + PxReal distanceSqP = PX_MAX_F32; + if (posNode) + { + const PxBounds3& posAABB = posNode->getAABB(); + const PxVec3 posClosest = posAABB.minimum.maximum(p.minimum(posAABB.maximum)); + distanceSqP = (posClosest - p).magnitudeSquared(); + } + + PxReal distanceSqN = PX_MAX_F32; + + if (negNode) + { + const PxBounds3& negAABB = negNode->getAABB(); + const PxVec3 negClosest = negAABB.minimum.maximum(p.minimum(negAABB.maximum)); + distanceSqN = (negClosest - p).magnitudeSquared(); + } + + return distanceSqP <= distanceSqN ? true : false; +} + +static bool gDistanceCheckCallback(const AABBTreeNode* current, PxU32 /*depth*/, void* userData) +{ + DistanceCheck* Data = reinterpret_cast(userData); + const PxVec3& p = Data->mOriginalVert; + + if (current->isLeaf()) + { + const PxU32 n = current->getNbPrimitives(); + PX_ASSERT(n <= Data->mNbPrimsPerLeaf); + + PxU32* Prims = const_cast(current->getPrimitives()); + PX_UNUSED(Prims); + + const PxVec3* verts = Data->mVerts; + + for (PxU32 i = 0; i < n; i++) + { + PX_ASSERT(Prims[i] < Data->mNbPrims); + const PxU32 tetId = Prims[i]; + const IndTetrahedron32& tetrahedron = Data->mTetrahedron32[tetId]; + PX_UNUSED(tetrahedron); + const PxVec3 a = verts[tetrahedron.mRef[0]]; + const PxVec3 b = verts[tetrahedron.mRef[1]]; + const PxVec3 c = verts[tetrahedron.mRef[2]]; + const PxVec3 d = verts[tetrahedron.mRef[3]]; + //compute distance between the vert and the tetrahedron + const PxVec4 result = PointOutsideOfPlane4(p, a, b, c, d); + + if (result.x >= 0.f && result.y >= 0.f && result.z >= 0.f && result.w >= 0.f) + { + //point is inside the tetrahedron + Data->mClosestPoint = closestPtPointTetrahedron(p, a, b, c, d); + Data->mDistanceSq = 0.f; + Data->mTetInd = tetId; + } + else + { + //point is outside the tetrahedron + const PxVec3 closestP = closestPtPointTetrahedron(p, a, b, c, d, result); + const PxReal distanceSq = (closestP - p).magnitudeSquared(); + if (distanceSq < Data->mDistanceSq) + { + Data->mClosestPoint = closestP; + Data->mDistanceSq = distanceSq; + Data->mTetInd = tetId; + } + } + } + } + else + { + //compute distance + + const PxBounds3& aabb = current->getAABB(); + + const PxVec3& min = aabb.minimum; + const PxVec3& max = aabb.maximum; + + const PxVec3 closest = min.maximum(p.minimum(max)); + PxReal distanceSq = (closest-p).magnitudeSquared(); + + if (distanceSq > Data->mDistanceSq) + return false; + } + return true; +} + +struct OverlapCheck +{ + //input + IndTetrahedron32 mColTetrahedron32; + PxVec3* mColMeshVerts; + PxBounds3 mColTetBound; + PxVec3* mSimMeshVerts; + IndTetrahedron32* mSimMeshTetra; + + //output + PxArray mSimTetraIndices; + + //these data are for validation only + PxU32 mNbPrimsPerLeaf; + PxU32 mNbPrims; +}; + +static bool gOverlapCallback(const AABBTreeNode* current, PxU32 /*depth*/, void* userData) +{ + OverlapCheck* Data = reinterpret_cast(userData); + const PxBounds3& bound = Data->mColTetBound; + + if (current->isLeaf()) + { + const PxU32 n = current->getNbPrimitives(); + PX_ASSERT(n <= Data->mNbPrimsPerLeaf); + + PxU32* Prims = const_cast(current->getPrimitives()); + PX_UNUSED(Prims); + + const IndTetrahedron32& colTetInd = Data->mColTetrahedron32; + + const PxVec3 a0 = Data->mColMeshVerts[colTetInd.mRef[0]]; + const PxVec3 a1 = Data->mColMeshVerts[colTetInd.mRef[1]]; + const PxVec3 a2 = Data->mColMeshVerts[colTetInd.mRef[2]]; + const PxVec3 a3 = Data->mColMeshVerts[colTetInd.mRef[3]]; + + const PxVec3 center0 = (a0 + a1 + a2 + a3) * 0.25f; + + TetrahedronV tetV(aos::V3LoadU(a0), aos::V3LoadU(a1), aos::V3LoadU(a2), + aos::V3LoadU(a3)); + const LocalConvex convexA(tetV); + + aos::FloatV contactDist = aos::FLoad(1e-4f); + + const PxVec3* verts = Data->mSimMeshVerts; + + for (PxU32 i = 0; i < n; i++) + { + PX_ASSERT(Prims[i] < Data->mNbPrims); + const PxU32 tetId = Prims[i]; + const IndTetrahedron32& tetrahedron = Data->mSimMeshTetra[tetId]; + + const PxVec3 b0 = verts[tetrahedron.mRef[0]]; + const PxVec3 b1 = verts[tetrahedron.mRef[1]]; + const PxVec3 b2 = verts[tetrahedron.mRef[2]]; + const PxVec3 b3 = verts[tetrahedron.mRef[3]]; + const PxVec3 center1 = (b0 + b1 + b2 + b3) * 0.25f; + + const PxVec3 dir = center1 - center0; + + TetrahedronV tetV2(aos::V3LoadU(b0), aos::V3LoadU(b1), aos::V3LoadU(b2), + aos::V3LoadU(b3)); + tetV2.setMinMargin(aos::FEps()); + const LocalConvex convexB(tetV2); + + GjkOutput output; + +#ifdef USE_GJK_VIRTUAL + GjkStatus status = testGjk(convexA, convexB, aos::V3LoadU(dir), contactDist, output.closestA, + output.closestB, output.normal, output.penDep); +#else + GjkStatus status = gjk(convexA, convexB, aos::V3LoadU(dir), contactDist, output.closestA, + output.closestB, output.normal, output.penDep); +#endif + if (status == GjkStatus::GJK_CLOSE || status == GjkStatus::GJK_CONTACT) + { + Data->mSimTetraIndices.pushBack(tetId); + } + } + } + else + { + const PxBounds3& aabb = current->getAABB(); + return bound.intersects(aabb); + } + return true; +} + +void TetrahedronMeshBuilder::createCollisionModelMapping(const TetrahedronMeshData& collisionMesh, const SoftBodyCollisionData& collisionData, CollisionMeshMappingData& mappingData) +{ + const PxU32 nbVerts = collisionMesh.mNbVertices; + + mappingData.mCollisionAccumulatedTetrahedronsRef = PX_ALLOCATE(PxU32, nbVerts, "tetCounts"); + + PxU32* tempCounts = PX_ALLOCATE(PxU32, nbVerts, "tempCounts"); + + PxU32* tetCounts = mappingData.mCollisionAccumulatedTetrahedronsRef; + + PxMemZero(tetCounts, sizeof(PxU32) * nbVerts); + PxMemZero(tempCounts, sizeof(PxU32) * nbVerts); + + const PxU32 nbTetrahedrons = collisionMesh.mNbTetrahedrons; + + IndTetrahedron32* tetra = reinterpret_cast(collisionData.mGRB_primIndices); + + for (PxU32 i = 0; i < nbTetrahedrons; i++) + { + IndTetrahedron32& tet = tetra[i]; + + tetCounts[tet.mRef[0]]++; + tetCounts[tet.mRef[1]]++; + tetCounts[tet.mRef[2]]++; + tetCounts[tet.mRef[3]]++; + } + + //compute runsum + PxU32 totalReference = 0; + for (PxU32 i = 0; i < nbVerts; ++i) + { + PxU32 originalReference = tetCounts[i]; + tetCounts[i] = totalReference; + totalReference += originalReference; + } + + mappingData.mCollisionTetrahedronsReferences = PX_ALLOCATE(PxU32, totalReference, "mGMMappedTetrahedrons"); + mappingData.mCollisionNbTetrahedronsReferences = totalReference; + + PxU32* tetrahedronRefs = mappingData.mCollisionTetrahedronsReferences; + + for (PxU32 i = 0; i < nbTetrahedrons; i++) + { + IndTetrahedron32& tet = tetra[i]; + + const PxU32 ind0 = tet.mRef[0]; + const PxU32 ind1 = tet.mRef[1]; + const PxU32 ind2 = tet.mRef[2]; + const PxU32 ind3 = tet.mRef[3]; + + tetrahedronRefs[tetCounts[ind0] + tempCounts[ind0]] = i; + tempCounts[ind0]++; + + tetrahedronRefs[tetCounts[ind1] + tempCounts[ind1]] = i; + tempCounts[ind1]++; + + tetrahedronRefs[tetCounts[ind2] + tempCounts[ind2]] = i; + tempCounts[ind2]++; + + tetrahedronRefs[tetCounts[ind3] + tempCounts[ind3]] = i; + tempCounts[ind3]++; + } + + PxVec3* verts = collisionMesh.mVertices; + + PxU8* tetHint = reinterpret_cast(collisionData.mGRB_tetraSurfaceHint); + + IndTetrahedron32* surfaceTets = PX_ALLOCATE(IndTetrahedron32, nbTetrahedrons, "surfaceTets"); + + PxU8* surfaceVertsHint = PX_ALLOCATE(PxU8, nbVerts, "surfaceVertsHint"); + PxU32* surfaceVertToTetRemap = PX_ALLOCATE(PxU32, nbVerts, "surfaceVertToTetRemap"); + PxMemSet(surfaceVertsHint, 0, nbVerts); + + PxU32 nbSurfaceTets = 0; + + for (PxU32 i = 0; i < nbTetrahedrons; i++) + { + IndTetrahedron32& originalTet = tetra[i]; + + PxU8 hint = tetHint[i]; + //This is a surface triangle + if (hint != 0) + { + IndTetrahedron32& tet = surfaceTets[nbSurfaceTets]; + tet.mRef[0] = originalTet.mRef[0]; + tet.mRef[1] = originalTet.mRef[1]; + tet.mRef[2] = originalTet.mRef[2]; + tet.mRef[3] = originalTet.mRef[3]; + + if (hint & 1) //0111 + { + if (surfaceVertsHint[originalTet.mRef[0]] == 0) + { + surfaceVertsHint[originalTet.mRef[0]] = 1; + surfaceVertToTetRemap[originalTet.mRef[0]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[1]] == 0) + { + surfaceVertsHint[originalTet.mRef[1]] = 1; + surfaceVertToTetRemap[originalTet.mRef[1]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[2]] == 0) + { + surfaceVertsHint[originalTet.mRef[2]] = 1; + surfaceVertToTetRemap[originalTet.mRef[2]] = i; + } + } + + if (hint & 2)//1011 + { + if (surfaceVertsHint[originalTet.mRef[0]] == 0) + { + surfaceVertsHint[originalTet.mRef[0]] = 1; + surfaceVertToTetRemap[originalTet.mRef[0]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[1]] == 0) + { + surfaceVertsHint[originalTet.mRef[1]] = 1; + surfaceVertToTetRemap[originalTet.mRef[1]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[3]] == 0) + { + surfaceVertsHint[originalTet.mRef[3]] = 1; + surfaceVertToTetRemap[originalTet.mRef[3]] = i; + } + } + + if (hint & 4) //1101 + { + if (surfaceVertsHint[originalTet.mRef[0]] == 0) + { + surfaceVertsHint[originalTet.mRef[0]] = 1; + surfaceVertToTetRemap[originalTet.mRef[0]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[2]] == 0) + { + surfaceVertsHint[originalTet.mRef[2]] = 1; + surfaceVertToTetRemap[originalTet.mRef[2]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[3]] == 0) + { + surfaceVertsHint[originalTet.mRef[3]] = 1; + surfaceVertToTetRemap[originalTet.mRef[3]] = i; + } + } + + if (hint & 8)//1110 + { + if (surfaceVertsHint[originalTet.mRef[1]] == 0) + { + surfaceVertsHint[originalTet.mRef[1]] = 1; + surfaceVertToTetRemap[originalTet.mRef[1]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[2]] == 0) + { + surfaceVertsHint[originalTet.mRef[2]] = 1; + surfaceVertToTetRemap[originalTet.mRef[2]] = i; + } + + if (surfaceVertsHint[originalTet.mRef[3]] == 0) + { + surfaceVertsHint[originalTet.mRef[3]] = 1; + surfaceVertToTetRemap[originalTet.mRef[3]] = i; + } + } + + nbSurfaceTets++; + } + } + + PxU32 numSurfaceVerts = 0; + for (PxU32 i = 0; i < nbVerts; ++i) + { + PxU32 hint = surfaceVertsHint[i]; + if (hint) + numSurfaceVerts++; + } + + mappingData.mCollisionSurfaceVertsHint = PX_ALLOCATE(PxU8, nbVerts, "mCollisionSurfaceVertsHint"); + mappingData.mCollisionSurfaceVertToTetRemap = PX_ALLOCATE(PxU32, nbVerts, "mCollisionSurfaceVertToTetRemap"); + + PxMemCopy(mappingData.mCollisionSurfaceVertsHint, surfaceVertsHint, sizeof(PxU8)*nbVerts); + PxMemCopy(mappingData.mCollisionSurfaceVertToTetRemap, surfaceVertToTetRemap, sizeof(PxU32)*nbVerts); + + //Build the tree based on surface tetra + TetrahedronSourceMesh meshInterface; + // const PxReal gBoxEpsilon = 0.1f; + meshInterface.initRemap(); + meshInterface.setNbVertices(collisionMesh.mNbVertices); + meshInterface.setNbTetrahedrons(nbSurfaceTets); + + meshInterface.setPointers(surfaceTets, NULL, verts); + + const PxU32 nbPrimsPerLeaf = 4; + BV4_AABBTree aabbTree; + + if (!aabbTree.buildFromMesh(meshInterface, nbPrimsPerLeaf)) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "BV4_AABBTree tree failed to build."); + return; + } + + PX_FREE(tempCounts); + PX_FREE(surfaceTets); + PX_FREE(surfaceVertsHint); + PX_FREE(surfaceVertToTetRemap); +} + +/*//Keep for debugging & verification +void writeTets(const char* path, const PxVec3* tetPoints, PxU32 numPoints, const IndTetrahedron32* tets, PxU32 numTets) +{ + FILE *fp; + + fp = fopen(path, "w+"); + fprintf(fp, "# Tetrahedral mesh generated using\n\n"); + + + fprintf(fp, "# %d vertices\n", numPoints); + for (PxU32 i = 0; i < numPoints; ++i) + { + fprintf(fp, "v %f %f %f\n", PxF64(tetPoints[i].x), PxF64(tetPoints[i].y), PxF64(tetPoints[i].z)); + } + + fprintf(fp, "\n"); + fprintf(fp, "# %d tetrahedra\n", numTets); + for (PxU32 i = 0; i < numTets; ++i) + { + fprintf(fp, "t %d %d %d %d\n", tets[i].mRef[0], tets[i].mRef[1], tets[i].mRef[2], tets[i].mRef[3]); + } + + fclose(fp); +}*/ + +void TetrahedronMeshBuilder::computeModelsMapping(TetrahedronMeshData& simulationMesh, + const TetrahedronMeshData& collisionMesh, const SoftBodyCollisionData& collisionData, + CollisionMeshMappingData& mappingData, bool buildGPUData, const PxBoundedData* vertexToTet) +{ + createCollisionModelMapping(collisionMesh, collisionData, mappingData); + + if (buildGPUData) + { + const PxU32 gridModelNbVerts = simulationMesh.mNbVertices; + PxVec3* gridModelVertices = PX_ALLOCATE(PxVec3, gridModelNbVerts, "gridModelVertices"); + + PxVec3* gridModelVerticesInvMass = simulationMesh.mVertices; + + for (PxU32 i = 0; i < gridModelNbVerts; ++i) + { + gridModelVertices[i] = gridModelVerticesInvMass[i]; + } + + PX_ASSERT(!(collisionMesh.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + TetrahedronSourceMesh meshInterface; + // const PxReal gBoxEpsilon = 0.1f; + meshInterface.initRemap(); + meshInterface.setNbVertices(simulationMesh.mNbVertices); + meshInterface.setNbTetrahedrons(simulationMesh.mNbTetrahedrons); + + IndTetrahedron32* tetrahedron32 = reinterpret_cast(simulationMesh.mTetrahedrons); + meshInterface.setPointers(tetrahedron32, NULL, gridModelVertices); + + //writeTets("C:\\tmp\\grid.tet", gridModelVertices, simulationMesh.mNbVertices, tetrahedron32, simulationMesh.mNbTetrahedrons); + //writeTets("C:\\tmp\\col.tet", mVertices, mNbVertices, reinterpret_cast(mTetrahedrons), mNbTetrahedrons); + + const PxU32 nbPrimsPerLeaf = 2; + BV4_AABBTree aabbTree; + + if (!aabbTree.buildFromMesh(meshInterface, nbPrimsPerLeaf)) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "BV32 tree failed to build."); + return; + } + + const PxU32 nbTetModelVerts = collisionMesh.mNbVertices; + + mappingData.mVertsBarycentricInGridModel = reinterpret_cast(PX_ALLOC(nbTetModelVerts * sizeof(PxReal) * 4, "mVertsInfoMapOriginalGridModel")); + mappingData.mVertsRemapInGridModel = reinterpret_cast(PX_ALLOC(nbTetModelVerts * sizeof(PxU32), "mVertsRemapInGridModel")); + + PxReal* vertsBarycentricInGridModel = mappingData.mVertsBarycentricInGridModel; + PxU32* vertsRemapInGridModel = mappingData.mVertsRemapInGridModel; + + if (vertexToTet && vertexToTet->count == nbTetModelVerts) + { + for (PxU32 i = 0; i < nbTetModelVerts; ++i) + { + vertsRemapInGridModel[i] = vertexToTet->at(i); + + const PxVec3& p = collisionMesh.mVertices[i]; + + IndTetrahedron32& tetra = tetrahedron32[vertsRemapInGridModel[i]]; + const PxVec3& a = gridModelVertices[tetra.mRef[0]]; + const PxVec3& b = gridModelVertices[tetra.mRef[1]]; + const PxVec3& c = gridModelVertices[tetra.mRef[2]]; + const PxVec3& d = gridModelVertices[tetra.mRef[3]]; + + PxVec4 bary; + computeBarycentric(a, b, c, d, p, bary); + +#if PX_DEBUG + const PxReal eps = 1e-4f; + PX_ASSERT((bary.x >= -eps && bary.x <= 1.f + eps) && (bary.y >= -eps && bary.y <= 1.f + eps) && + (bary.z >= -eps && bary.z <= 1.f + eps) && (bary.w >= -eps && bary.w <= 1.f + eps)); + + PX_ASSERT(vertexToTet->at(i) >= 0); +#endif + + const PxU32 index = i * 4; + vertsBarycentricInGridModel[index] = bary.x; + vertsBarycentricInGridModel[index + 1] = bary.y; + vertsBarycentricInGridModel[index + 2] = bary.z; + vertsBarycentricInGridModel[index + 3] = bary.w; + } + } + else + { + for (PxU32 i = 0; i < nbTetModelVerts; ++i) + { + DistanceCheck result; + result.mVerts = gridModelVertices; + result.mTetrahedron32 = tetrahedron32; + + result.mOriginalVert = collisionMesh.mVertices[i]; + + result.mDistanceSq = PX_MAX_F32; + result.mNbPrimsPerLeaf = 2; + result.mNbPrims = simulationMesh.mNbTetrahedrons; + + aabbTree.walkDistance(gDistanceCheckCallback, gDistanceNodeCheckCallback, &result); + + IndTetrahedron32& tetra = tetrahedron32[result.mTetInd]; + + const PxVec3& a = gridModelVertices[tetra.mRef[0]]; + const PxVec3& b = gridModelVertices[tetra.mRef[1]]; + const PxVec3& c = gridModelVertices[tetra.mRef[2]]; + const PxVec3& d = gridModelVertices[tetra.mRef[3]]; + + PxVec4 bary; + computeBarycentric(a, b, c, d, result.mOriginalVert, bary); + +#if PX_DEBUG + const PxReal eps = 1e-4f; + PX_ASSERT((bary.x >= -eps && bary.x <= 1.f + eps) && (bary.y >= -eps && bary.y <= 1.f + eps) && + (bary.z >= -eps && bary.z <= 1.f + eps) && (bary.w >= -eps && bary.w <= 1.f + eps)); +#endif + + const PxU32 index = i * 4; + vertsBarycentricInGridModel[index] = bary.x; + vertsBarycentricInGridModel[index + 1] = bary.y; + vertsBarycentricInGridModel[index + 2] = bary.z; + vertsBarycentricInGridModel[index + 3] = bary.w; + + vertsRemapInGridModel[i] = result.mTetInd; + } + } + + PxU16* colMaterials = collisionMesh.mMaterialIndices; + PxU16* simMaterials = NULL; + const PxU32 nbSimMeshTetra = simulationMesh.mNbTetrahedrons; + + if (colMaterials) + { + simMaterials = simulationMesh.allocateMaterials(); + for (PxU32 i = 0; i < nbSimMeshTetra; ++i) + { + simMaterials[i] = 0xffff; + } + } + + const PxU32 nbColMeshTetra = collisionMesh.mNbTetrahedrons; + PxArray tetIndiceRunSum; + tetIndiceRunSum.reserve(nbColMeshTetra * 4); + + mappingData.mTetsAccumulatedRemapColToSim = reinterpret_cast( PX_ALLOC(sizeof(PxU32) * nbColMeshTetra, "mTetsAccumulatedRemapColToSim")); + + PxU32* runSum = mappingData.mTetsAccumulatedRemapColToSim; + + PxU32 offset = 0; + + IndTetrahedron32* colTetra = reinterpret_cast(collisionData.mGRB_primIndices); + + OverlapCheck result; + result.mSimTetraIndices.reserve(100); + + //IndTetrahedron32* simTetra = reinterpret_cast(simulationMesh.mTetrahedrons); + + for (PxU32 i = 0; i < nbColMeshTetra; ++i) + { + IndTetrahedron32& tetInd = colTetra[i]; + const PxVec3 a = collisionMesh.mVertices[tetInd.mRef[0]]; + const PxVec3 b = collisionMesh.mVertices[tetInd.mRef[1]]; + const PxVec3 c = collisionMesh.mVertices[tetInd.mRef[2]]; + const PxVec3 d = collisionMesh.mVertices[tetInd.mRef[3]]; + + const PxVec3 max = a.maximum(b.maximum(c.maximum(d))); + const PxVec3 min = a.minimum(b.minimum(c.minimum(d))); + PxBounds3 bound(min, max); + + result.mSimTetraIndices.forceSize_Unsafe(0); + + result.mColMeshVerts = collisionMesh.mVertices; + result.mColTetBound = bound; + result.mColTetrahedron32 = tetInd; + + result.mSimMeshTetra = tetrahedron32; + result.mSimMeshVerts = gridModelVertices; + + result.mNbPrimsPerLeaf = 2; + result.mNbPrims = simulationMesh.mNbTetrahedrons; + + aabbTree.walk(gOverlapCallback, &result); + + const PxU32 size = result.mSimTetraIndices.size(); + + PX_ASSERT(size > 0); + + for (PxU32 j = 0; j < size; ++j) + { + const PxU32 simTetraInd = result.mSimTetraIndices[j]; + if (simMaterials && simMaterials[simTetraInd] == 0xffff) + simMaterials[simTetraInd] = colMaterials[i]; + tetIndiceRunSum.pushBack(simTetraInd); + } + + offset += size; + runSum[i] = offset; + } + + if (simMaterials) + { + //loop through all the simMaterials to make sure material indices has valid material index. If not, + //we will use the first material index for the tet materials + for (PxU32 i = 0; i < nbSimMeshTetra; ++i) + { + if (simMaterials[i] == 0xffff) + simMaterials[i] = 0; + } + } + + mappingData.mTetsRemapSize = tetIndiceRunSum.size(); + mappingData.mTetsRemapColToSim = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * mappingData.mTetsRemapSize, "mTetsRemapInSimModel")); + PxMemCopy(mappingData.mTetsRemapColToSim, tetIndiceRunSum.begin(), sizeof(PxU32) * mappingData.mTetsRemapSize); + +#if PX_DEBUG + for (PxU32 i = 0; i < tetIndiceRunSum.size(); ++i) + { + PX_ASSERT(tetIndiceRunSum[i] < 0xFFFFFFFF); + } + for (PxU32 i = 1; i < collisionMesh.mNbTetrahedrons; ++i) + { + PX_ASSERT(runSum[i - 1] < runSum[i]); + } +#endif + + PX_FREE(gridModelVertices); + } +} + +PX_FORCE_INLINE PxF32 tetVolume(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d) +{ + return (-1.0f / 6.0f) * (a - d).dot((b - d).cross(c - d)); +} + +template +static void writeToSimTetraIndice(const T* tetIndices, const PxVec3* verts, TetrahedronT* dest) +{ + const PxVec3 a = verts[tetIndices[0]]; + const PxVec3 b = verts[tetIndices[1]]; + const PxVec3 c = verts[tetIndices[2]]; + const PxVec3 d = verts[tetIndices[3]]; + if (tetVolume(a, b, c, d) < 0.f) + { + dest->v[0] = tetIndices[1]; + dest->v[1] = tetIndices[0]; + dest->v[2] = tetIndices[2]; + dest->v[3] = tetIndices[3]; + } + else + { + dest->v[0] = tetIndices[0]; + dest->v[1] = tetIndices[1]; + dest->v[2] = tetIndices[2]; + dest->v[3] = tetIndices[3]; + } +} + +void TetrahedronMeshBuilder::computeTetData(const PxTetrahedronMeshDesc& desc, TetrahedronMeshData& mesh) +{ + const PxU32 tetMeshNbPoints = desc.points.count; + const PxU32 tetMeshNbTets = desc.tetrahedrons.count; + mesh.mNbVertices = tetMeshNbPoints; + mesh.mVertices = PX_ALLOCATE(PxVec3, tetMeshNbPoints, "mVertices"); + mesh.mNbTetrahedrons = tetMeshNbTets; + mesh.mTetrahedrons = PX_ALLOC(tetMeshNbTets * sizeof(TetrahedronT), "mTetrahedrons"); + + mesh.mFlags = desc.flags; //TODO: flags are not of same type... + + computeLocalBoundsAndGeomEpsilon(mesh.mVertices, tetMeshNbPoints, mesh.mAABB, mesh.mGeomEpsilon); +} + +bool transferMass(PxI32 a, PxI32 b, PxArray& newMasses, const PxReal* mass, PxReal maxRatio, PxReal smoothingSpeed) +{ + const PxReal mA = mass[a]; + const PxReal mB = mass[b]; + const PxReal ratio = PxMax(mA, mB) / PxMin(mA, mB); + if (ratio > maxRatio) + { + const PxReal delta = smoothingSpeed * PxMin(mA, mB); + if (mA > mB) + { + newMasses[a] -= delta; + newMasses[b] += delta; + } + else + { + newMasses[a] += delta; + newMasses[b] -= delta; + } + return true; + } + return false; +} + +void smoothMassRatiosWhilePreservingTotalMass( PxReal* massPerNode, PxU32 numNodes, const PxU32* tets, PxI32 numTets, PxReal maxRatio /*= 2.0f*/, PxReal smoothingSpeed = 0.25f) +{ + if (maxRatio == FLT_MAX) + return; + + PxArray newMasses; + newMasses.resize(numNodes); + for (PxU32 i = 0; i < numNodes; ++i) + newMasses[i] = massPerNode[i]; + + const PxU32 tetEdges[6][2] = { {0, 1}, {0, 2}, {0, 3}, {1, 2}, {1, 3}, {2, 3} }; + + PxU32 l = 4 * numTets; + + PxU32 counter = 0; + bool success = true; + while (success) + { + ++counter; + success = false; + + for (PxU32 i = 0; i < l; i += 4) + { + for (PxU32 j = 0; j < 6; ++j) + success = success || transferMass(tets[i + tetEdges[j][0]], tets[i + tetEdges[j][1]], newMasses, massPerNode, maxRatio, smoothingSpeed); + } + + for (PxU32 i = 0; i < numNodes; ++i) + massPerNode[i] = newMasses[i]; + + if (counter > 100000) + break; + } + //printf("%i", counter); +} + +void TetrahedronMeshBuilder::computeSimData(const PxTetrahedronMeshDesc& desc, TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, const PxCookingParams& params) +{ + const PxU32 simTetMeshNbPoints = desc.points.count; + const PxU32 simTetMeshNbTets = desc.tetrahedrons.count; + simulationMesh.mNbVertices = simTetMeshNbPoints; + simulationMesh.mVertices = reinterpret_cast(PX_ALLOC(simTetMeshNbPoints * sizeof(PxVec3), "mGridModelVertices")); + simulationData.mGridModelInvMass = reinterpret_cast(PX_ALLOC(simTetMeshNbPoints * sizeof(PxReal), "mGridModelInvMass")); + simulationMesh.mNbTetrahedrons = simTetMeshNbTets; + simulationMesh.mTetrahedrons = PX_ALLOC(simTetMeshNbTets * sizeof(TetrahedronT), "mGridModelTetrahedrons"); + simulationData.mNumTetsPerElement = desc.tetsPerElement; + + immediateCooking::gatherStrided(desc.points.data, simulationMesh.mVertices, simTetMeshNbPoints, sizeof(PxVec3), desc.points.stride); + + TetrahedronT* gridModelTetrahedrons = reinterpret_cast*>(simulationMesh.mTetrahedrons); + + for (PxU32 i = 0; i < simTetMeshNbPoints; ++i) + simulationData.mGridModelInvMass[i] = 0; + + TetrahedronT* dest = gridModelTetrahedrons; + const TetrahedronT* pastLastDest = gridModelTetrahedrons + simTetMeshNbTets; + + const PxU8* source = reinterpret_cast(desc.tetrahedrons.data); + if (desc.flags & PxMeshFlag::e16_BIT_INDICES) + { + while (dest < pastLastDest) + { + const PxU16* tet16 = reinterpret_cast(source); + writeToSimTetraIndice(tet16, simulationMesh.mVertices, dest); + dest++; + source += desc.tetrahedrons.stride; + } + } + else + { + while (dest < pastLastDest) + { + const PxU32* tet32 = reinterpret_cast(source); + writeToSimTetraIndice(tet32, simulationMesh.mVertices, dest); + dest++; + source += desc.tetrahedrons.stride; + } + } + + simulationData.mGridModelTetraRestPoses = PX_ALLOCATE(PxMat33, desc.tetrahedrons.count, "mGridModelTetraRestPoses"); + + computeRestPoseAndPointMass(gridModelTetrahedrons, simulationMesh.mNbTetrahedrons, + simulationMesh.mVertices, simulationData.mGridModelInvMass, simulationData.mGridModelTetraRestPoses); + + PxU32* accumulatedTetrahedronPerPartition = computeGridModelTetrahedronPartitions(simulationMesh, simulationData); + if (simulationData.mNumTetsPerElement == 1) + combineGridModelPartitions(simulationMesh, simulationData, &accumulatedTetrahedronPerPartition); + else + combineGridModelPartitionsHexMesh(simulationMesh, simulationData, &accumulatedTetrahedronPerPartition); + + smoothMassRatiosWhilePreservingTotalMass(simulationData.mGridModelInvMass, simulationMesh.mNbVertices, reinterpret_cast(gridModelTetrahedrons), simulationMesh.mNbTetrahedrons, params.maxWeightRatioInTet); + +#if PX_DEBUG + PxReal max = 0; + PxReal min = FLT_MAX; + for (PxU32 i = 0; i < simulationMesh.mNbVertices; ++i) + { + PxReal w = simulationData.mGridModelInvMass[i]; + max = PxMax(w, max); + min = PxMin(w, min); + } + PxReal ratio = max / min; + PX_UNUSED(ratio); +#endif + + for (PxU32 i = 0; i < simulationMesh.mNbVertices; ++i) + { + simulationData.mGridModelInvMass[i] = 1.0f / simulationData.mGridModelInvMass[i]; + } + + PX_FREE(accumulatedTetrahedronPerPartition); + + + //const PxU32 gridModelNbVerts = simulationMesh.mNbVertices; + //PxVec3* gridModelVertices = reinterpret_cast(PX_ALLOC(gridModelNbVerts * sizeof(PxVec3), "gridModelVertices")); + + //PxVec4* gridModelVerticesInvMass = simulationMesh.mVerticesInvMass; + + //for (PxU32 i = 0; i < gridModelNbVerts; ++i) + //{ + // gridModelVertices[i] = gridModelVerticesInvMass[i].getXYZ(); + //} + + //writeTets("C:\\tmp\\grid.tet", gridModelVertices, simulationMesh.mNbVertices, reinterpret_cast(simulationMesh.mTetrahedrons), simulationMesh.mNbTetrahedrons); + //writeTets("C:\\tmp\\col.tet", mVertices, mNbVertices, reinterpret_cast(mTetrahedrons), mNbTetrahedrons); + + //PX_FREE(gridModelVertices); +} + +bool TetrahedronMeshBuilder::computeCollisionData(const PxTetrahedronMeshDesc& collisionMeshDesc, TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, + const PxCookingParams& params, bool validateMesh) +{ + const PxU32 originalTetrahedronCount = collisionMeshDesc.tetrahedrons.count; + // Create a local copy that we can modify + PxTetrahedronMeshDesc desc = collisionMeshDesc; + + // Save simple params + { + // Handle implicit topology + PxU32* topology = NULL; + if (!desc.tetrahedrons.data) + { + // We'll create 32-bit indices + desc.flags &= ~PxMeshFlag::e16_BIT_INDICES; + desc.tetrahedrons.stride = sizeof(PxU32) * 4; + + { + // Non-indexed mesh => create implicit topology + desc.tetrahedrons.count = desc.points.count / 4; + // Create default implicit topology + topology = PX_ALLOCATE(PxU32, desc.points.count, "topology"); + for (PxU32 i = 0; i < desc.points.count; i++) + topology[i] = i; + desc.tetrahedrons.data = topology; + } + } + // Continue as usual using our new descriptor + + // Convert and clean the input mesh + if (!importMesh(collisionMeshDesc, params, collisionMesh, collisionData, validateMesh)) + { + PX_FREE(topology); + return false; + } + + // Cleanup if needed + PX_FREE(topology); + } + + //copy the original tetrahedron indices to grb tetrahedron indices if buildGRBData is true + + createMidPhaseStructure(collisionMesh, collisionData, params); + + recordTetrahedronIndices(collisionMesh, collisionData, params.buildGPUData); + + // Compute local bounds + computeLocalBoundsAndGeomEpsilon(collisionMesh.mVertices, collisionMesh.mNbVertices, collisionMesh.mAABB, collisionMesh.mGeomEpsilon); + + createGRBMidPhaseAndData(originalTetrahedronCount, collisionMesh, collisionData, params); + + // Use collisionData.mGRB_primIndices rather than collisionMesh.mTetrahedrons: we want rest poses for the topology-remapped mesh, which is the actual one in simulation. + computeRestPoseAndPointMass(reinterpret_cast*>(collisionData.mGRB_primIndices), collisionMesh.mNbTetrahedrons, collisionMesh.mVertices, NULL, collisionData.mTetraRestPoses); + + return true; +} + +bool TetrahedronMeshBuilder::loadFromDesc(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + PxSoftBodySimulationDataDesc softbodyDataDesc, TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, + TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, CollisionMeshMappingData& mappingData, const PxCookingParams& params, bool validateMesh) +{ + if (!simulationMeshDesc.isValid() || !collisionMeshDesc.isValid() || !softbodyDataDesc.isValid()) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "TetrahedronMesh::loadFromDesc: desc.isValid() failed!"); + + // verify the mesh params + if (!params.midphaseDesc.isValid()) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "TetrahedronMesh::loadFromDesc: mParams.midphaseDesc.isValid() failed!"); + + if (!computeCollisionData(collisionMeshDesc, collisionMesh, collisionData, params, validateMesh)) + return false; + computeSimData(simulationMeshDesc, simulationMesh, simulationData, params); + computeModelsMapping(simulationMesh, collisionMesh, collisionData, mappingData, params.buildGPUData, &softbodyDataDesc.vertexToTet); + +#if PX_DEBUG + for (PxU32 i = 0; i < collisionMesh.mNbVertices; ++i) { + PX_ASSERT(mappingData.mVertsRemapInGridModel[i] < simulationMesh.mNbTetrahedrons); + } +#endif + + return true; +} + +static void writeIndice(const PxU32 serialFlags, const PxU32* indices, const PxU32 nbIndices, + const bool platformMismatch, PxOutputStream& stream) +{ + //write out tetrahedron indices + if (serialFlags & IMSF_8BIT_INDICES) + { + for (PxU32 i = 0; i < nbIndices; i++) + { + PxI8 data = PxI8(indices[i]); + stream.write(&data, sizeof(PxU8)); + } + } + else if (serialFlags & IMSF_16BIT_INDICES) + { + + for (PxU32 i = 0; i < nbIndices; i++) + writeWord(PxTo16(indices[i]), platformMismatch, stream); + } + else + { + writeIntBuffer(indices, nbIndices, platformMismatch, stream); + } +} + +bool TetrahedronMeshBuilder::saveTetrahedronMeshData(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params, const TetrahedronMeshData& mesh) +{ + // Export header + if (!writeHeader('T', 'E', 'M', 'E', PX_TET_MESH_VERSION, platformMismatch, stream)) + return false; + + // Export serialization flags + PxU32 serialFlags = 0; + + // Compute serialization flags for indices + PxU32 maxIndex = 0; + const TetrahedronT* tets = reinterpret_cast*>(mesh.mTetrahedrons); + + for (PxU32 i = 0; i < mesh.mNbTetrahedrons; i++) + { + if (tets[i].v[0] > maxIndex) maxIndex = tets[i].v[0]; + if (tets[i].v[1] > maxIndex) maxIndex = tets[i].v[1]; + if (tets[i].v[2] > maxIndex) maxIndex = tets[i].v[2]; + if (tets[i].v[3] > maxIndex) maxIndex = tets[i].v[3]; + } + + bool force32 = (params.meshPreprocessParams & PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES); + if (maxIndex <= 0xFFFF && !force32) + serialFlags |= (maxIndex <= 0xFF ? IMSF_8BIT_INDICES : IMSF_16BIT_INDICES); + writeDword(serialFlags, platformMismatch, stream); + + // Export mesh + writeDword(mesh.mNbVertices, platformMismatch, stream); + //writeDword(collisionData.mNbSurfaceTriangles, platformMismatch, stream); + writeDword(mesh.mNbTetrahedrons, platformMismatch, stream); + + writeFloatBuffer(&mesh.mVertices->x, mesh.mNbVertices * 3, platformMismatch, stream); + + const PxU32 nbTetIndices = mesh.mNbTetrahedrons * 4; + //write out tetrahedron indices + writeIndice(serialFlags, tets->v, nbTetIndices, platformMismatch, stream); + + // Export local bounds + writeFloat(mesh.mGeomEpsilon, platformMismatch, stream); + + writeFloat(mesh.mAABB.minimum.x, platformMismatch, stream); + writeFloat(mesh.mAABB.minimum.y, platformMismatch, stream); + writeFloat(mesh.mAABB.minimum.z, platformMismatch, stream); + writeFloat(mesh.mAABB.maximum.x, platformMismatch, stream); + writeFloat(mesh.mAABB.maximum.y, platformMismatch, stream); + writeFloat(mesh.mAABB.maximum.z, platformMismatch, stream); + + return true; +} + +bool TetrahedronMeshBuilder::saveSoftBodyMeshData(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params, + const TetrahedronMeshData& simulationMesh, const SoftBodySimulationData& simulationData, const TetrahedronMeshData& collisionMesh, + const SoftBodyCollisionData& collisionData, const CollisionMeshMappingData& mappingData) +{ + // Export header + if (!writeHeader('S', 'O', 'M', 'E', PX_SOFTBODY_MESH_VERSION, platformMismatch, stream)) + return false; + + // Export serialization flags + PxU32 serialFlags = 0; + if (collisionMesh.mMaterialIndices) serialFlags |= IMSF_MATERIALS; + if (collisionData.mFaceRemap) serialFlags |= IMSF_FACE_REMAP; + //if (mTetraSurfaceHint) serialFlags |= IMSF_ADJACENCIES; // using IMSF_ADJACENCIES to represent surfaceHint for tetrahedron mesh + //if (mAdjacencies) serialFlags |= IMSF_ADJACENCIES; + if (params.buildGPUData) serialFlags |= IMSF_GRB_DATA; + // Compute serialization flags for indices + PxU32 maxIndex = 0; + const TetrahedronT* tets = reinterpret_cast*>(collisionMesh.mTetrahedrons); + + for (PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; i++) + { + if (tets[i].v[0] > maxIndex) maxIndex = tets[i].v[0]; + if (tets[i].v[1] > maxIndex) maxIndex = tets[i].v[1]; + if (tets[i].v[2] > maxIndex) maxIndex = tets[i].v[2]; + if (tets[i].v[3] > maxIndex) maxIndex = tets[i].v[3]; + } + + const TetrahedronT* gridModelTets = reinterpret_cast*>(simulationMesh.mTetrahedrons); + + for (PxU32 i = 0; i < simulationMesh.mNbTetrahedrons; i++) + { + if (gridModelTets[i].v[0] > maxIndex) maxIndex = gridModelTets[i].v[0]; + if (gridModelTets[i].v[1] > maxIndex) maxIndex = gridModelTets[i].v[1]; + if (gridModelTets[i].v[2] > maxIndex) maxIndex = gridModelTets[i].v[2]; + if (gridModelTets[i].v[3] > maxIndex) maxIndex = gridModelTets[i].v[3]; + } + + bool force32 = (params.meshPreprocessParams & PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES); + if (maxIndex <= 0xFFFF && !force32) + serialFlags |= (maxIndex <= 0xFF ? IMSF_8BIT_INDICES : IMSF_16BIT_INDICES); + writeDword(serialFlags, platformMismatch, stream); + + // Export mesh + writeDword(collisionMesh.mNbVertices, platformMismatch, stream); + //writeDword(collisionData.mNbSurfaceTriangles, platformMismatch, stream); + writeDword(collisionMesh.mNbTetrahedrons, platformMismatch, stream); + + writeFloatBuffer(&collisionMesh.mVertices->x, collisionMesh.mNbVertices * 3, platformMismatch, stream); + + const PxU32 nbTetIndices = collisionMesh.mNbTetrahedrons * 4; + //write out tetrahedron indices + writeIndice(serialFlags, tets->v, nbTetIndices, platformMismatch, stream); + + //const PxU32 nbSurfaceTriangleIndices = collisionData.mNbSurfaceTriangles * 3; + //const IndexedTriangle32* surfaceTriangles = reinterpret_cast(collisionData.mSurfaceTriangles); + //write out surface triangle indices + //writeIndice(serialFlags, surfaceTriangles->v, nbSurfaceTriangleIndices, platformMismatch, stream); + + if (collisionMesh.mMaterialIndices) + writeWordBuffer(collisionMesh.mMaterialIndices, collisionMesh.mNbTetrahedrons, platformMismatch, stream); + + if (collisionData.mFaceRemap) + { + PxU32 maxId = computeMaxIndex(collisionData.mFaceRemap, collisionMesh.mNbTetrahedrons); + writeDword(maxId, platformMismatch, stream); + storeIndices(maxId, collisionMesh.mNbTetrahedrons, collisionData.mFaceRemap, stream, platformMismatch); + // writeIntBuffer(mMeshData.mFaceRemap, mMeshData.mNbTriangles, platformMismatch, stream); + } + +/* if (mAdjacencies) + writeIntBuffer(mAdjacencies, mNbTetrahedrons * 4, platformMismatch, stream);*/ + + // Export midphase structure + saveMidPhaseStructure(stream, platformMismatch, collisionData); + + // Export local bounds + writeFloat(collisionMesh.mGeomEpsilon, platformMismatch, stream); + + writeFloat(collisionMesh.mAABB.minimum.x, platformMismatch, stream); + writeFloat(collisionMesh.mAABB.minimum.y, platformMismatch, stream); + writeFloat(collisionMesh.mAABB.minimum.z, platformMismatch, stream); + writeFloat(collisionMesh.mAABB.maximum.x, platformMismatch, stream); + writeFloat(collisionMesh.mAABB.maximum.y, platformMismatch, stream); + writeFloat(collisionMesh.mAABB.maximum.z, platformMismatch, stream); + + // GRB write ----------------------------------------------------------------- + if (params.buildGPUData) + { + const PxU32* tetIndices = reinterpret_cast(collisionData.mGRB_primIndices); + writeIndice(serialFlags, tetIndices, nbTetIndices, platformMismatch, stream); + + //writeIntBuffer(reinterpret_cast(mMeshData.mGRB_triIndices), , mMeshData.mNbTriangles*3, platformMismatch, stream); + + //writeIntBuffer(reinterpret_cast(mGRB_surfaceTriIndices), mNbTriangles*3, platformMismatch, stream); + stream.write(collisionData.mGRB_tetraSurfaceHint, collisionMesh.mNbTetrahedrons * sizeof(PxU8)); + + //writeIntBuffer(reinterpret_cast(mGRB_primAdjacencies), mNbTetrahedrons * 4, platformMismatch, stream); + writeIntBuffer(collisionData.mGRB_faceRemap, collisionMesh.mNbTetrahedrons, platformMismatch, stream); + writeIntBuffer(collisionData.mGRB_faceRemapInverse, collisionMesh.mNbTetrahedrons, platformMismatch, stream); + + stream.write(collisionData.mTetraRestPoses, collisionMesh.mNbTetrahedrons * sizeof(PxMat33)); + + //Export GPU midphase structure + BV32TriangleMeshBuilder::saveMidPhaseStructure(collisionData.mGRB_BV32Tree, stream, platformMismatch); + + writeDword(simulationMesh.mNbTetrahedrons, platformMismatch, stream); + writeDword(simulationMesh.mNbVertices, platformMismatch, stream); + writeDword(simulationData.mGridModelNbPartitions, platformMismatch, stream); + writeDword(simulationData.mGridModelMaxTetsPerPartitions, platformMismatch, stream); + writeDword(simulationData.mGMRemapOutputSize, platformMismatch, stream); + writeDword(simulationData.mNumTetsPerElement, platformMismatch, stream); + writeDword(mappingData.mCollisionNbTetrahedronsReferences, platformMismatch, stream); + writeDword(mappingData.mTetsRemapSize, platformMismatch, stream); + + const PxU32 nbGridModeIndices = 4 * simulationMesh.mNbTetrahedrons; + const PxU32* gridModelTetIndices = reinterpret_cast(simulationMesh.mTetrahedrons); + writeIndice(serialFlags, gridModelTetIndices, nbGridModeIndices, platformMismatch, stream); + + const PxU32 numVertsPerElement = simulationData.mNumTetsPerElement == 6 ? 8 : 4; + const PxU32 numElements = simulationMesh.mNbTetrahedrons / simulationData.mNumTetsPerElement; + + writeFloatBuffer(&simulationMesh.mVertices->x, simulationMesh.mNbVertices * 3, platformMismatch, stream); + + if (simulationMesh.mMaterialIndices) + writeWordBuffer(simulationMesh.mMaterialIndices, simulationMesh.mNbTetrahedrons, platformMismatch, stream); + + + writeFloatBuffer(simulationData.mGridModelInvMass, simulationMesh.mNbVertices * 1, platformMismatch, stream); + + stream.write(simulationData.mGridModelTetraRestPoses, simulationMesh.mNbTetrahedrons * sizeof(PxMat33)); + + stream.write(simulationData.mGridModelOrderedTetrahedrons, numElements * sizeof(PxU32)); + + stream.write(simulationData.mGMRemapOutputCP, numElements * numVertsPerElement * sizeof(PxU32)); + + stream.write(simulationData.mGMAccumulatedPartitionsCP, simulationData.mGridModelNbPartitions * sizeof(PxU32)); + + stream.write(simulationData.mGMAccumulatedCopiesCP, simulationMesh.mNbVertices * sizeof(PxU32)); + + stream.write(mappingData.mCollisionAccumulatedTetrahedronsRef, collisionMesh.mNbVertices * sizeof(PxU32)); + + stream.write(mappingData.mCollisionTetrahedronsReferences, mappingData.mCollisionNbTetrahedronsReferences * sizeof(PxU32)); + + stream.write(mappingData.mCollisionSurfaceVertsHint, collisionMesh.mNbVertices * sizeof(PxU8)); + + stream.write(mappingData.mCollisionSurfaceVertToTetRemap, collisionMesh.mNbVertices * sizeof(PxU32)); + + stream.write(simulationData.mGMPullIndices, numElements * numVertsPerElement *sizeof(PxU32)); + + writeFloatBuffer(mappingData.mVertsBarycentricInGridModel, collisionMesh.mNbVertices * 4, platformMismatch, stream); + + writeIntBuffer(mappingData.mVertsRemapInGridModel, collisionMesh.mNbVertices, platformMismatch, stream); + + writeIntBuffer(mappingData.mTetsRemapColToSim, mappingData.mTetsRemapSize, platformMismatch, stream); + + writeIntBuffer(mappingData.mTetsAccumulatedRemapColToSim, collisionMesh.mNbTetrahedrons, platformMismatch, stream); + } + + // End of GRB write ---------------------------------------------------------- + + return true; +} + +void TetrahedronMeshBuilder::createMidPhaseStructure(TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, const PxCookingParams& params) +{ + const PxReal gBoxEpsilon = 2e-4f; + + TetrahedronSourceMesh& meshInterface = collisionData.mMeshInterface; + // const PxReal gBoxEpsilon = 0.1f; + meshInterface.initRemap(); + meshInterface.setNbVertices(collisionMesh.mNbVertices); + meshInterface.setNbTetrahedrons(collisionMesh.mNbTetrahedrons); + + IndTetrahedron32* tetrahedrons32 = NULL; + IndTetrahedron16* tetrahedrons16 = NULL; + if (collisionMesh.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) + { + tetrahedrons16 = reinterpret_cast(collisionMesh.mTetrahedrons); + } + else + { + tetrahedrons32 = reinterpret_cast(collisionMesh.mTetrahedrons); + } + + collisionData.mMeshInterface.setPointers(tetrahedrons32, tetrahedrons16, collisionMesh.mVertices); + + const PxU32 nbTetsPerLeaf = 15; + + if (!BuildBV4Ex(collisionData.mBV4Tree, meshInterface, gBoxEpsilon, nbTetsPerLeaf, false)) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "BV4 tree failed to build."); + return; + } + + const PxU32* order = meshInterface.getRemap(); + if (!params.suppressTriangleMeshRemapTable || params.buildGPUData) + { + PxU32* newMap = PX_ALLOCATE(PxU32, collisionMesh.mNbTetrahedrons, "mFaceRemap"); + for (PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; i++) + newMap[i] = collisionData.mFaceRemap ? collisionData.mFaceRemap[order[i]] : order[i]; + PX_FREE(collisionData.mFaceRemap); + collisionData.mFaceRemap = newMap; + } + + meshInterface.releaseRemap(); +} + +void TetrahedronMeshBuilder::saveMidPhaseStructure(PxOutputStream& stream, bool mismatch, const SoftBodyCollisionData& collisionData) +{ + // PT: in version 1 we defined "mismatch" as: + // const bool mismatch = (littleEndian() == 1); + // i.e. the data was *always* saved to file in big-endian format no matter what. + // In version>1 we now do the same as for other structures in the SDK: the data is + // exported either as little or big-endian depending on the passed parameter. + const PxU32 bv4StructureVersion = 3; + + writeChunk('B', 'V', '4', ' ', stream); + writeDword(bv4StructureVersion, mismatch, stream); + + writeFloat(collisionData.mBV4Tree.mLocalBounds.mCenter.x, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mLocalBounds.mCenter.y, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mLocalBounds.mCenter.z, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mLocalBounds.mExtentsMagnitude, mismatch, stream); + + writeDword(collisionData.mBV4Tree.mInitData, mismatch, stream); + + writeFloat(collisionData.mBV4Tree.mCenterOrMinCoeff.x, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mCenterOrMinCoeff.y, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mCenterOrMinCoeff.z, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mExtentsOrMaxCoeff.x, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mExtentsOrMaxCoeff.y, mismatch, stream); + writeFloat(collisionData.mBV4Tree.mExtentsOrMaxCoeff.z, mismatch, stream); + + // PT: version 3 + writeDword(PxU32(collisionData.mBV4Tree.mQuantized), mismatch, stream); + + writeDword(collisionData.mBV4Tree.mNbNodes, mismatch, stream); + +#ifdef GU_BV4_USE_SLABS + // PT: we use BVDataPacked to get the size computation right, but we're dealing with BVDataSwizzled here! + const PxU32 NodeSize = collisionData.mBV4Tree.mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + stream.write(collisionData.mBV4Tree.mNodes, NodeSize*collisionData.mBV4Tree.mNbNodes); + PX_ASSERT(!mismatch); +#else + #error Not implemented +#endif +} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void BV32TetrahedronMeshBuilder::createMidPhaseStructure(const PxCookingParams& params, TetrahedronMeshData& collisionMesh, BV32Tree& bv32Tree, SoftBodyCollisionData& collisionData) +{ + PX_UNUSED(params); + PX_UNUSED(collisionMesh); + PX_UNUSED(bv32Tree); + const PxReal gBoxEpsilon = 2e-4f; + + TetrahedronSourceMesh meshInterface; + // const PxReal gBoxEpsilon = 0.1f; + meshInterface.initRemap(); + meshInterface.setNbVertices(collisionMesh.mNbVertices); + meshInterface.setNbTetrahedrons(collisionMesh.mNbTetrahedrons); + + //meshInterface.setNbVertices(meshData.mNbVertices); + //meshInterface.setNbTriangles(meshData.mNbTriangles); + + PX_ASSERT(!(collisionMesh.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + IndTetrahedron32* tetrahedron32 = reinterpret_cast(collisionData.mGRB_primIndices); + + meshInterface.setPointers(tetrahedron32, NULL, collisionMesh.mVertices); + + PxU32 nbTetrahedronPerLeaf = 32; + + if (!BuildBV32Ex(bv32Tree, meshInterface, gBoxEpsilon, nbTetrahedronPerLeaf)) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "BV32 tree failed to build."); + return; + } + + const PxU32* order = meshInterface.getRemap(); + + if (collisionMesh.mMaterialIndices) + { + PxFEMMaterialTableIndex* newMat = PX_ALLOCATE(PxFEMMaterialTableIndex, collisionMesh.mNbTetrahedrons, "mMaterialIndices"); + for (PxU32 i = 0; i < collisionMesh.mNbTetrahedrons; i++) + newMat[i] = collisionMesh.mMaterialIndices[order[i]]; + PX_FREE(collisionMesh.mMaterialIndices); + collisionMesh.mMaterialIndices = newMat; + } + + //suppressTriangleMeshRemapTable can use for tetrahedron mesh remap table + if (!params.suppressTriangleMeshRemapTable || params.buildGPUData) + { + PxU32* newMap = PX_ALLOCATE(PxU32, collisionMesh.mNbTetrahedrons, "mGRB_faceRemap"); + for (PxU32 i = 0; i1 we now do the same as for other structures in the SDK: the data is + // exported either as little or big-endian depending on the passed parameter. + const PxU32 bv32StructureVersion = 2; + + writeChunk('B', 'V', '3', '2', stream); + writeDword(bv32StructureVersion, mismatch, stream); + + writeFloat(bv32Tree->mLocalBounds.mCenter.x, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mCenter.y, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mCenter.z, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mExtentsMagnitude, mismatch, stream); + + writeDword(bv32Tree->mInitData, mismatch, stream); + + writeDword(bv32Tree->mNbPackedNodes, mismatch, stream); + + PX_ASSERT(bv32Tree->mNbPackedNodes > 0); + for (PxU32 i = 0; i < bv32Tree->mNbPackedNodes; ++i) + { + BV32DataPacked& node = bv32Tree->mPackedNodes[i]; + + const PxU32 nbElements = node.mNbNodes * 4; + writeDword(node.mNbNodes, mismatch, stream); + writeDword(node.mDepth, mismatch, stream); + WriteDwordBuffer(node.mData, node.mNbNodes, mismatch, stream); + writeFloatBuffer(&node.mMin[0].x, nbElements, mismatch, stream); + writeFloatBuffer(&node.mMax[0].x, nbElements, mismatch, stream); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool immediateCooking::cookTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream) +{ + TetrahedronMeshData data; + TetrahedronMeshBuilder::computeTetData(meshDesc, data); + TetrahedronMeshBuilder::saveTetrahedronMeshData(stream, platformMismatch(), params, data); + return true; +} + +PxTetrahedronMesh* immediateCooking::createTetrahedronMesh(const PxCookingParams& /*params*/, const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback) +{ + PX_FPU_GUARD; + + TetrahedronMeshData tetData; + TetrahedronMeshBuilder::computeTetData(meshDesc, tetData); + + PxConcreteType::Enum type = PxConcreteType::eTETRAHEDRON_MESH; + PxTetrahedronMesh* tetMesh = static_cast(insertionCallback.buildObjectFromData(type, &tetData)); + + return tetMesh; +} + +bool immediateCooking::cookSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream) +{ + PX_FPU_GUARD; + + TetrahedronMeshData simulationMesh; + SoftBodySimulationData simulationData; + TetrahedronMeshData collisionMesh; + SoftBodyCollisionData collisionData; + CollisionMeshMappingData mappingData; + SoftBodyMeshData data(simulationMesh, simulationData, collisionMesh, collisionData, mappingData); + if(!TetrahedronMeshBuilder::loadFromDesc(simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, data.mSimulationMesh, data.mSimulationData, data.mCollisionMesh, data.mCollisionData, data.mMappingData, params, false)) + return false; + + TetrahedronMeshBuilder::saveSoftBodyMeshData(stream, platformMismatch(), params, data.mSimulationMesh, data.mSimulationData, data.mCollisionMesh, data.mCollisionData, data.mMappingData); + return true; +} + +PxSoftBodyMesh* immediateCooking::createSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback) +{ + PX_UNUSED(simulationMeshDesc); + PX_UNUSED(collisionMeshDesc); + PX_UNUSED(softbodyDataDesc); + PX_UNUSED(insertionCallback); + + // cooking code does lots of float bitwise reinterpretation that generates exceptions + PX_FPU_GUARD; + + TetrahedronMeshData simulationMesh; + SoftBodySimulationData simulationData; + TetrahedronMeshData collisionMesh; + SoftBodyCollisionData collisionData; + CollisionMeshMappingData mappingData; + SoftBodyMeshData data(simulationMesh, simulationData, collisionMesh, collisionData, mappingData); + if(!TetrahedronMeshBuilder::loadFromDesc(simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, data.mSimulationMesh, data.mSimulationData, data.mCollisionMesh, data.mCollisionData, data.mMappingData, params, false)) + return NULL; + + PxConcreteType::Enum type = PxConcreteType::eSOFTBODY_MESH; + PxSoftBodyMesh* tetMesh = static_cast(insertionCallback.buildObjectFromData(type, &data)); + + /*SoftbodySimulationTetrahedronMesh simulationMesh(data.simulationMesh, data.simulationData); + SoftbodyCollisionTetrahedronMesh collisionMesh(data.collisionMesh, data.collisionData); + SoftbodyShapeMapping embedding(data.mappingData); + + SoftBodyMesh* tetMesh = NULL; + PX_NEW_SERIALIZED(tetMesh, SoftBodyMesh)(simulationMesh, collisionMesh, embedding);*/ + + return tetMesh; +} + +PxCollisionMeshMappingData* immediateCooking::computeModelsMapping(const PxCookingParams& params, PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, + const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet) +{ + CollisionMeshMappingData* mappingData = PX_NEW(CollisionMeshMappingData); + TetrahedronMeshBuilder::computeModelsMapping(*static_cast(&simulationMesh), + *static_cast(&collisionMesh), *static_cast(&collisionData), *mappingData, params.buildGPUData, vertexToTet); + return mappingData; +} + +PxCollisionTetrahedronMeshData* immediateCooking::computeCollisionData(const PxCookingParams& params, const PxTetrahedronMeshDesc& collisionMeshDesc) +{ + PX_UNUSED(collisionMeshDesc); + + TetrahedronMeshData* mesh = PX_NEW(TetrahedronMeshData); + SoftBodyCollisionData* collisionData = PX_NEW(SoftBodyCollisionData); + + if(!TetrahedronMeshBuilder::computeCollisionData(collisionMeshDesc, *mesh, *collisionData, params, false)) { + PX_FREE(mesh); + PX_FREE(collisionData); + return NULL; + } + CollisionTetrahedronMeshData* data = PX_NEW(CollisionTetrahedronMeshData); + data->mMesh = mesh; + data->mCollisionData = collisionData; + return data; +} + +PxSimulationTetrahedronMeshData* immediateCooking::computeSimulationData(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc) +{ + TetrahedronMeshData* mesh = PX_NEW(TetrahedronMeshData); + SoftBodySimulationData* simulationData = PX_NEW(SoftBodySimulationData); + //KS - This really needs the collision mesh as well. + TetrahedronMeshBuilder::computeSimData(simulationMeshDesc, *mesh, *simulationData, params); + SimulationTetrahedronMeshData* data = PX_NEW(SimulationTetrahedronMeshData); + data->mMesh = mesh; + data->mSimulationData = simulationData; + return data; +} + +PxSoftBodyMesh* immediateCooking::assembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, + PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) +{ + SoftBodyMeshData data(static_cast(simulationMesh), + static_cast(simulationData), + static_cast(collisionMesh), + static_cast(collisionData), + static_cast(mappingData)); + + PxConcreteType::Enum type = PxConcreteType::eSOFTBODY_MESH; + PxSoftBodyMesh* tetMesh = static_cast(insertionCallback.buildObjectFromData(type, &data)); + + return tetMesh; +} + +PxSoftBodyMesh* immediateCooking::assembleSoftBodyMesh_Sim(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, + PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) +{ + return assembleSoftBodyMesh(*simulationMesh.getMesh(), *simulationMesh.getData(), *collisionMesh.getMesh(), *collisionMesh.getData(), mappingData, insertionCallback); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.h new file mode 100644 index 0000000..786d093 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTetrahedronMesh.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef GU_COOKING_TETRAHEDRON_MESH_H +#define GU_COOKING_TETRAHEDRON_MESH_H + +#include "cooking/PxCooking.h" +#include "GuMeshData.h" + +namespace physx +{ + class TetrahedronMeshBuilder + { + PX_NOCOPY(TetrahedronMeshBuilder) + public: + + static bool loadFromDesc(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + PxSoftBodySimulationDataDesc softbodyDataDesc, Gu::TetrahedronMeshData& simulationMesh, Gu::SoftBodySimulationData& simulationData, + Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, Gu::CollisionMeshMappingData& mappingData, const PxCookingParams& params, bool validateMesh = false); + static bool saveTetrahedronMeshData(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params, + const Gu::TetrahedronMeshData& mesh); + static bool saveSoftBodyMeshData(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params, + const Gu::TetrahedronMeshData& simulationMesh, const Gu::SoftBodySimulationData& simulationData, const Gu::TetrahedronMeshData& collisionMesh, + const Gu::SoftBodyCollisionData& collisionData, const Gu::CollisionMeshMappingData& mappingData); + + //PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH34; } + static void createMidPhaseStructure(Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, const PxCookingParams& params); + static void saveMidPhaseStructure(PxOutputStream& stream, bool mismatch, const Gu::SoftBodyCollisionData& collisionData); + + static void computeTetData(const PxTetrahedronMeshDesc& desc, Gu::TetrahedronMeshData& mesh); + + static void createGRBMidPhaseAndData(const PxU32 originalTriangleCount, Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, const PxCookingParams& params); + static void computeSimData(const PxTetrahedronMeshDesc& desc, Gu::TetrahedronMeshData& simulationMesh, Gu::SoftBodySimulationData& simulationData, const PxCookingParams& params); + static void computeModelsMapping(Gu::TetrahedronMeshData& simulationMesh, const Gu::TetrahedronMeshData& collisionMesh, const Gu::SoftBodyCollisionData& collisionData, + Gu::CollisionMeshMappingData& mappingData, bool buildGPUData, const PxBoundedData* vertexToTet); + static void createCollisionModelMapping(const Gu::TetrahedronMeshData& collisionMesh, const Gu::SoftBodyCollisionData& collisionData, Gu::CollisionMeshMappingData& mappingData); + + static void recordTetrahedronIndices(const Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, bool buildGPUData); + static bool importMesh(const PxTetrahedronMeshDesc& collisionMeshDesc, const PxCookingParams& params, + Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, bool validate = false); + + static bool computeCollisionData(const PxTetrahedronMeshDesc& collisionMeshDesc, Gu::TetrahedronMeshData& collisionMesh, Gu::SoftBodyCollisionData& collisionData, + const PxCookingParams& params, bool validateMesh = false); + }; + + class BV32TetrahedronMeshBuilder + { + public: + static void createMidPhaseStructure(const PxCookingParams& params, Gu::TetrahedronMeshData& meshData, Gu::BV32Tree& bv32Tree, Gu::SoftBodyCollisionData& collisionData); + static void saveMidPhaseStructure(Gu::BV32Tree* tree, PxOutputStream& stream, bool mismatch); + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp new file mode 100644 index 0000000..b6ea9bb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.cpp @@ -0,0 +1,1405 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuCooking.h" +#include "cooking/PxTriangleMeshDesc.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxSort.h" +#include "foundation/PxFPU.h" +#include "common/PxInsertionCallback.h" + +#include "GuRTreeCooking.h" +#include "GuCookingTriangleMesh.h" +#include "GuEdgeList.h" +#include "GuMeshCleaner.h" +#include "GuConvexEdgeFlags.h" +#include "GuTriangle.h" +#include "GuBV4Build.h" +#include "GuBV32Build.h" +#include "GuBounds.h" +#include "CmSerialize.h" +#include "GuCookingGrbTriangleMesh.h" +#include "GuCookingVolumeIntegration.h" +#include "GuCookingSDF.h" +#include "GuMeshAnalysis.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +TriangleMeshBuilder::TriangleMeshBuilder(TriangleMeshData& m, const PxCookingParams& params) : + mEdgeList (NULL), + mParams (params), + mMeshData (m) +{ +} + +TriangleMeshBuilder::~TriangleMeshBuilder() +{ + PX_DELETE(mEdgeList); +} + +void TriangleMeshBuilder::remapTopology(const PxU32* order) +{ + if(!mMeshData.mNbTriangles) + return; + + GU_PROFILE_ZONE("remapTopology") + + // Remap one array at a time to limit memory usage + + IndexedTriangle32* newTopo = PX_ALLOCATE(IndexedTriangle32, mMeshData.mNbTriangles, "IndexedTriangle32"); + for(PxU32 i=0;i(mMeshData.mTriangles)[order[i]]; + PX_FREE(mMeshData.mTriangles); + mMeshData.mTriangles = newTopo; + + if(mMeshData.mMaterialIndices) + { + PxMaterialTableIndex* newMat = PX_ALLOCATE(PxMaterialTableIndex, mMeshData.mNbTriangles, "mMaterialIndices"); + for(PxU32 i=0;i(__LINE__, "TriangleMesh: Enable mesh welding with 0 weld tolerance!"); + else + meshWeldTolerance = mParams.meshWeldTolerance; + } + MeshCleaner cleaner(mMeshData.mNbVertices, mMeshData.mVertices, mMeshData.mNbTriangles, reinterpret_cast(mMeshData.mTriangles), meshWeldTolerance); + if(!cleaner.mNbTris) + return false; + + if(validate) + { + // if we do only validate, we check if cleaning did not remove any verts or triangles. + // such a mesh can be then directly used for cooking without clean flag + if((cleaner.mNbVerts != mMeshData.mNbVertices) || (cleaner.mNbTris != mMeshData.mNbTriangles)) + return false; + } + + // PT: deal with the remap table + { + // PT: TODO: optimize this + if(cleaner.mRemap) + { + const PxU32 newNbTris = cleaner.mNbTris; + + // Remap material array + if(mMeshData.mMaterialIndices) + { + PxMaterialTableIndex* tmp = PX_ALLOCATE(PxMaterialTableIndex, newNbTris, "mMaterialIndices"); + for(PxU32 i=0;i(mMeshData.mTriangles)[i].mRef[0] = vref0; + reinterpret_cast(mMeshData.mTriangles)[i].mRef[1] = vref1; + reinterpret_cast(mMeshData.mTriangles)[i].mRef[2] = vref2; + + if( (v[vref0] - v[vref1]).magnitudeSquared() >= testLength + || (v[vref1] - v[vref2]).magnitudeSquared() >= testLength + || (v[vref2] - v[vref0]).magnitudeSquared() >= testLength + ) + bigTriangle = true; + } + if(bigTriangle) + { + if(condition) + *condition = PxTriangleMeshCookingResult::eLARGE_TRIANGLE; + outputError(__LINE__, "TriangleMesh: triangles are too big, reduce their size to increase simulation stability!"); + } + } + + return true; +} + +static EdgeList* createEdgeList(const TriangleMeshData& meshData) +{ + EDGELISTCREATE create; + create.NbFaces = meshData.mNbTriangles; + if(meshData.has16BitIndices()) + { + create.DFaces = NULL; + create.WFaces = reinterpret_cast(meshData.mTriangles); + } + else + { + create.DFaces = reinterpret_cast(meshData.mTriangles); + create.WFaces = NULL; + } + create.FacesToEdges = true; + create.EdgesToFaces = true; + create.Verts = meshData.mVertices; + //create.Epsilon = 0.1f; + // create.Epsilon = convexEdgeThreshold; + EdgeList* edgeList = PX_NEW(EdgeList); + if(!edgeList->init(create)) + { + PX_DELETE(edgeList); + } + return edgeList; +} + +void TriangleMeshBuilder::createSharedEdgeData(bool buildAdjacencies, bool buildActiveEdges) +{ + GU_PROFILE_ZONE("createSharedEdgeData") + + const bool savedFlag = buildActiveEdges; + + if(buildAdjacencies) // building edges is required if buildAdjacencies is requested + buildActiveEdges = true; + + PX_ASSERT(mMeshData.mExtraTrigData == NULL); + PX_ASSERT(mMeshData.mAdjacencies == NULL); + + if(!buildActiveEdges) + return; + + const PxU32 nTrigs = mMeshData.mNbTriangles; + if(0x40000000 <= nTrigs) + { + //mesh is too big for this algo, need to be able to express trig indices in 30 bits, and still have an index reserved for "unused": + outputError(__LINE__, "TriangleMesh: mesh is too big for this algo!"); + return; + } + + mMeshData.mExtraTrigData = PX_ALLOCATE(PxU8, nTrigs, "mExtraTrigData"); + PxMemZero(mMeshData.mExtraTrigData, sizeof(PxU8)*nTrigs); + + const IndexedTriangle32* trigs = reinterpret_cast(mMeshData.mTriangles); + + mEdgeList = createEdgeList(mMeshData); + + if(mEdgeList) + { + PX_ASSERT(mEdgeList->getNbFaces()==mMeshData.mNbTriangles); + if(mEdgeList->getNbFaces()==mMeshData.mNbTriangles) + { + for(PxU32 i=0;igetNbFaces();i++) + { + const EdgeTriangleData& ET = mEdgeList->getEdgeTriangle(i); + // Replicate flags + if(EdgeTriangleAC::HasActiveEdge01(ET)) + mMeshData.mExtraTrigData[i] |= ETD_CONVEX_EDGE_01; + if(EdgeTriangleAC::HasActiveEdge12(ET)) + mMeshData.mExtraTrigData[i] |= ETD_CONVEX_EDGE_12; + if(EdgeTriangleAC::HasActiveEdge20(ET)) + mMeshData.mExtraTrigData[i] |= ETD_CONVEX_EDGE_20; + } + } + } + + // fill the adjacencies + if(buildAdjacencies) + { + mMeshData.mAdjacencies = PX_ALLOCATE(PxU32, nTrigs*3, "mAdjacencies"); + memset(mMeshData.mAdjacencies, 0xFFFFffff, sizeof(PxU32)*nTrigs*3); + + PxU32 NbEdges = mEdgeList->getNbEdges(); + const EdgeDescData* ED = mEdgeList->getEdgeToTriangles(); + const EdgeData* Edges = mEdgeList->getEdges(); + const PxU32* FBE = mEdgeList->getFacesByEdges(); + + while(NbEdges--) + { + // Get number of triangles sharing current edge + const PxU32 Count = ED->Count; + + if(Count > 1) + { + const PxU32 FaceIndex0 = FBE[ED->Offset+0]; + const PxU32 FaceIndex1 = FBE[ED->Offset+1]; + + const EdgeData& edgeData = *Edges; + const IndexedTriangle32& T0 = trigs[FaceIndex0]; + const IndexedTriangle32& T1 = trigs[FaceIndex1]; + + const PxU32 offset0 = T0.findEdgeCCW(edgeData.Ref0,edgeData.Ref1); + const PxU32 offset1 = T1.findEdgeCCW(edgeData.Ref0,edgeData.Ref1); + + mMeshData.setTriangleAdjacency(FaceIndex0, FaceIndex1, offset0); + mMeshData.setTriangleAdjacency(FaceIndex1, FaceIndex0, offset1); + } + ED++; + Edges++; + } + } + +#if PX_DEBUG + for(PxU32 i=0;igetEdgeTriangle(i); + PX_ASSERT((EdgeTriangleAC::HasActiveEdge01(ET) && (mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_01)) || (!EdgeTriangleAC::HasActiveEdge01(ET) && !(mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_01))); + PX_ASSERT((EdgeTriangleAC::HasActiveEdge12(ET) && (mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_12)) || (!EdgeTriangleAC::HasActiveEdge12(ET) && !(mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_12))); + PX_ASSERT((EdgeTriangleAC::HasActiveEdge20(ET) && (mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_20)) || (!EdgeTriangleAC::HasActiveEdge20(ET) && !(mMeshData.mExtraTrigData[i] & ETD_CONVEX_EDGE_20))); + } +#endif + + // PT: respect the PxMeshPreprocessingFlag::eDISABLE_ACTIVE_EDGES_PRECOMPUTE flag. This is important for + // deformable meshes - even if the edge data was needed on-the-fly to compute adjacencies. + if(!savedFlag) + PX_FREE(mMeshData.mExtraTrigData); +} + +void TriangleMeshBuilder::createVertMapping() +{ + GU_PROFILE_ZONE("createVertMapping") + + const PxU32 nbVerts = mMeshData.mNbVertices; + + mMeshData.mAccumulatedTrianglesRef = PX_ALLOCATE(PxU32, nbVerts, "accumulatedTrianglesRef"); + + PxU32* tempCounts = PX_ALLOCATE(PxU32, nbVerts, "tempCounts"); + + PxU32* triangleCounts = mMeshData.mAccumulatedTrianglesRef; + + PxMemZero(triangleCounts, sizeof(PxU32) * nbVerts); + PxMemZero(tempCounts, sizeof(PxU32) * nbVerts); + + const PxU32 nbTriangles = mMeshData.mNbTriangles; + + IndexedTriangle32* triangles = reinterpret_cast(mMeshData.mGRB_primIndices); + + for (PxU32 i = 0; i < nbTriangles; i++) + { + IndexedTriangle32& triangle = triangles[i]; + + triangleCounts[triangle.mRef[0]]++; + triangleCounts[triangle.mRef[1]]++; + triangleCounts[triangle.mRef[2]]++; + } + + //compute runsum + PxU32 totalReference = 0; + for (PxU32 i = 0; i < nbVerts; ++i) + { + PxU32 originalReference = triangleCounts[i]; + triangleCounts[i] = totalReference; + totalReference += originalReference; + } + + PX_ASSERT(totalReference == nbTriangles * 3); + + mMeshData.mTrianglesReferences = PX_ALLOCATE(PxU32, totalReference, "mTrianglesReferences"); + mMeshData.mNbTrianglesReferences = totalReference; + + PxU32* triangleRefs = mMeshData.mTrianglesReferences; + + for (PxU32 i = 0; i < nbTriangles; i++) + { + IndexedTriangle32& triangle = triangles[i]; + + const PxU32 ind0 = triangle.mRef[0]; + const PxU32 ind1 = triangle.mRef[1]; + const PxU32 ind2 = triangle.mRef[2]; + + triangleRefs[triangleCounts[ind0] + tempCounts[ind0]] = i; + tempCounts[ind0]++; + + triangleRefs[triangleCounts[ind1] + tempCounts[ind1]] = i; + tempCounts[ind1]++; + + triangleRefs[triangleCounts[ind2] + tempCounts[ind2]] = i; + tempCounts[ind2]++; + } + + PX_FREE(tempCounts); +} + +void TriangleMeshBuilder::recordTriangleIndices() +{ + if (mParams.buildGPUData) + { + PX_ASSERT(!(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + PX_ASSERT(mMeshData.mGRB_primIndices); + + //copy the BV4 triangle indices to GPU triangle indices buffer + PxMemCopy(mMeshData.mGRB_primIndices, mMeshData.mTriangles, sizeof(IndTri32) *mMeshData.mNbTriangles); + } +} + +void TriangleMeshBuilder::createGRBData() +{ + GU_PROFILE_ZONE("buildAdjacencies") + + const PxU32 numTris = mMeshData.mNbTriangles; + + PX_ASSERT(!(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + // Core: Mesh data + /////////////////////////////////////////////////////////////////////////////////// + + // (by using adjacency info generated by physx cooker) + PxVec3* tempNormalsPerTri_prealloc = PX_ALLOCATE(PxVec3, numTris, "tempNormalsPerTri_prealloc"); + + mMeshData.mGRB_primAdjacencies = PX_ALLOCATE(uint4, numTris, "GRB_triAdjacencies"); + + buildAdjacencies( + reinterpret_cast(mMeshData.mGRB_primAdjacencies), + tempNormalsPerTri_prealloc, + mMeshData.mVertices, + reinterpret_cast(mMeshData.mGRB_primIndices), + numTris + ); + + PX_FREE(tempNormalsPerTri_prealloc); +} + +void TriangleMeshBuilder::createGRBMidPhaseAndData(const PxU32 originalTriangleCount) +{ + PX_UNUSED(originalTriangleCount); + if (mParams.buildGPUData) + { + PX_ASSERT(!(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + BV32Tree* bv32Tree = PX_NEW(BV32Tree); + mMeshData.mGRB_BV32Tree = bv32Tree; + + BV32TriangleMeshBuilder::createMidPhaseStructure(mParams, mMeshData, *bv32Tree); + + createGRBData(); + + if (mParams.meshPreprocessParams & PxMeshPreprocessingFlag::eENABLE_VERT_MAPPING || mParams.buildGPUData) + { + createVertMapping(); + } + +#if BV32_VALIDATE + IndTri32* grbTriIndices = reinterpret_cast(mMeshData.mGRB_primIndices); + IndTri32* cpuTriIndices = reinterpret_cast(mMeshData.mTriangles); + //map CPU remap triangle index to GPU remap triangle index + for (PxU32 i = 0; i < mMeshData.mNbTriangles; ++i) + { + PX_ASSERT(grbTriIndices[i].mRef[0] == cpuTriIndices[mMeshData.mGRB_faceRemap[i]].mRef[0]); + PX_ASSERT(grbTriIndices[i].mRef[1] == cpuTriIndices[mMeshData.mGRB_faceRemap[i]].mRef[1]); + PX_ASSERT(grbTriIndices[i].mRef[2] == cpuTriIndices[mMeshData.mGRB_faceRemap[i]].mRef[2]); + } +#endif + } +} + +bool TriangleMeshBuilder::loadFromDescInternal(PxTriangleMeshDesc& desc, PxTriangleMeshCookingResult::Enum* condition, bool validateMesh) +{ +#ifdef PROFILE_MESH_COOKING + printf("\n"); +#endif + + const PxU32 originalTriangleCount = desc.triangles.count; + if (!desc.isValid()) + return outputError(__LINE__, "TriangleMesh::loadFromDesc: desc.isValid() failed!"); + + // verify the mesh params + if (!mParams.midphaseDesc.isValid()) + return outputError(__LINE__, "TriangleMesh::loadFromDesc: mParams.midphaseDesc.isValid() failed!"); + + // Save simple params + { + // Handle implicit topology + PxU32* topology = NULL; + if (!desc.triangles.data) + { + // We'll create 32-bit indices + desc.flags &= ~PxMeshFlag::e16_BIT_INDICES; + desc.triangles.stride = sizeof(PxU32) * 3; + + { + // Non-indexed mesh => create implicit topology + desc.triangles.count = desc.points.count / 3; + // Create default implicit topology + topology = PX_ALLOCATE(PxU32, desc.points.count, "topology"); + for (PxU32 i = 0; i(mMeshData.mTriangles), mMeshData.mNbTriangles)) + { + buildInertiaTensor(); + return; + } + + PxArray points; + PxArray triangleIndices; + extractIsosurfaceFromSDF(mMeshData.mSdfData, points, triangleIndices); + + PxTriangleMeshDesc simpleMesh; + + simpleMesh.points.count = points.size(); + simpleMesh.points.stride = sizeof(PxVec3); + simpleMesh.points.data = points.begin(); + simpleMesh.triangles.count = triangleIndices.size() / 3; + simpleMesh.triangles.stride = sizeof(PxU32) * 3; + simpleMesh.triangles.data = triangleIndices.begin(); + simpleMesh.flags &= (~PxMeshFlag::e16_BIT_INDICES); + + PxIntegrals integrals; + computeVolumeIntegrals(simpleMesh, 1, integrals); + + integrals.getOriginInertia(mMeshData.mInertia); + mMeshData.mMass = PxReal(integrals.mass); + mMeshData.mLocalCenterOfMass = integrals.COM; +} + +// +// When suppressTriangleMeshRemapTable is true, the face remap table is not created. This saves a significant amount of memory, +// but the SDK will not be able to provide information about which mesh triangle is hit in collisions, sweeps or raycasts hits. +// +// The sequence is as follows: + +bool TriangleMeshBuilder::loadFromDesc(const PxTriangleMeshDesc& _desc, PxTriangleMeshCookingResult::Enum* condition, bool validateMesh) +{ + PxTriangleMeshDesc desc = _desc; + return loadFromDescInternal(desc, condition, validateMesh); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool TriangleMeshBuilder::save(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params) const +{ + // Export header + if(!writeHeader('M', 'E', 'S', 'H', PX_MESH_VERSION, platformMismatch, stream)) + return false; + + // Export midphase ID + writeDword(getMidphaseID(), platformMismatch, stream); + + // Export serialization flags + PxU32 serialFlags = 0; + if(mMeshData.mMaterialIndices) serialFlags |= IMSF_MATERIALS; + if(mMeshData.mFaceRemap) serialFlags |= IMSF_FACE_REMAP; + if(mMeshData.mAdjacencies) serialFlags |= IMSF_ADJACENCIES; + if (params.buildGPUData) serialFlags |= IMSF_GRB_DATA; + if (mMeshData.mGRB_faceRemapInverse) serialFlags |= IMSF_GRB_INV_REMAP; + // Compute serialization flags for indices + PxU32 maxIndex=0; + const IndexedTriangle32* tris = reinterpret_cast(mMeshData.mTriangles); + for(PxU32 i=0;imaxIndex) maxIndex = tris[i].mRef[0]; + if(tris[i].mRef[1]>maxIndex) maxIndex = tris[i].mRef[1]; + if(tris[i].mRef[2]>maxIndex) maxIndex = tris[i].mRef[2]; + } + + bool enableSdf = mMeshData.mSdfData.mSdf ? true : false; + + if(enableSdf) serialFlags |= IMSF_SDF; + + bool enableInertia = (params.meshPreprocessParams & PxMeshPreprocessingFlag::eENABLE_INERTIA) || enableSdf; + if(enableInertia) + serialFlags |= IMSF_INERTIA; + + bool force32 = (params.meshPreprocessParams & PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES); + if (maxIndex <= 0xFFFF && !force32) + serialFlags |= (maxIndex <= 0xFF ? IMSF_8BIT_INDICES : IMSF_16BIT_INDICES); + + bool enableVertexMapping = (params.buildGPUData || (params.meshPreprocessParams & PxMeshPreprocessingFlag::eENABLE_VERT_MAPPING)); + if (enableVertexMapping) + serialFlags |= IMSF_VERT_MAPPING; + + writeDword(serialFlags, platformMismatch, stream); + + // Export mesh + writeDword(mMeshData.mNbVertices, platformMismatch, stream); + writeDword(mMeshData.mNbTriangles, platformMismatch, stream); + writeFloatBuffer(&mMeshData.mVertices->x, mMeshData.mNbVertices*3, platformMismatch, stream); + if(serialFlags & IMSF_8BIT_INDICES) + { + const PxU32* indices = tris->mRef; + for(PxU32 i=0;imRef; + for(PxU32 i=0;imRef, mMeshData.mNbTriangles*3, platformMismatch, stream); + + if(mMeshData.mMaterialIndices) + writeWordBuffer(mMeshData.mMaterialIndices, mMeshData.mNbTriangles, platformMismatch, stream); + + if(mMeshData.mFaceRemap) + { + PxU32 maxId = computeMaxIndex(mMeshData.mFaceRemap, mMeshData.mNbTriangles); + writeDword(maxId, platformMismatch, stream); + storeIndices(maxId, mMeshData.mNbTriangles, mMeshData.mFaceRemap, stream, platformMismatch); +// writeIntBuffer(mMeshData.mFaceRemap, mMeshData.mNbTriangles, platformMismatch, stream); + } + + if(mMeshData.mAdjacencies) + writeIntBuffer(mMeshData.mAdjacencies, mMeshData.mNbTriangles*3, platformMismatch, stream); + + // Export midphase structure + saveMidPhaseStructure(stream, platformMismatch); + + // Export local bounds + writeFloat(mMeshData.mGeomEpsilon, platformMismatch, stream); + + writeFloat(mMeshData.mAABB.minimum.x, platformMismatch, stream); + writeFloat(mMeshData.mAABB.minimum.y, platformMismatch, stream); + writeFloat(mMeshData.mAABB.minimum.z, platformMismatch, stream); + writeFloat(mMeshData.mAABB.maximum.x, platformMismatch, stream); + writeFloat(mMeshData.mAABB.maximum.y, platformMismatch, stream); + writeFloat(mMeshData.mAABB.maximum.z, platformMismatch, stream); + + if(mMeshData.mExtraTrigData) + { + writeDword(mMeshData.mNbTriangles, platformMismatch, stream); + // No need to convert those bytes + stream.write(mMeshData.mExtraTrigData, mMeshData.mNbTriangles*sizeof(PxU8)); + } + else + writeDword(0, platformMismatch, stream); + + // GRB write ----------------------------------------------------------------- + if (params.buildGPUData) + { + const PxU32* indices = reinterpret_cast(mMeshData.mGRB_primIndices); + if (serialFlags & IMSF_8BIT_INDICES) + { + for (PxU32 i = 0; i(mMeshData.mGRB_triIndices), , mMeshData.mNbTriangles*3, platformMismatch, stream); + + //writeIntBuffer(reinterpret_cast(mMeshData.mGRB_triIndices), mMeshData.mNbTriangles*4, platformMismatch, stream); + + writeIntBuffer(reinterpret_cast(mMeshData.mGRB_primAdjacencies), mMeshData.mNbTriangles*4, platformMismatch, stream); + writeIntBuffer(mMeshData.mGRB_faceRemap, mMeshData.mNbTriangles, platformMismatch, stream); + if(mMeshData.mGRB_faceRemapInverse) + writeIntBuffer(mMeshData.mGRB_faceRemapInverse, mMeshData.mNbTriangles, platformMismatch, stream); + + //Export GPU midphase structure + BV32Tree* bv32Tree = mMeshData.mGRB_BV32Tree; + BV32TriangleMeshBuilder::saveMidPhaseStructure(bv32Tree, stream, platformMismatch); + + //Export vertex mapping + if (enableVertexMapping) + { + writeDword(mMeshData.mNbTrianglesReferences, platformMismatch, stream); + + stream.write(mMeshData.mAccumulatedTrianglesRef, mMeshData.mNbVertices * sizeof(PxU32)); + + stream.write(mMeshData.mTrianglesReferences, mMeshData.mNbTrianglesReferences * sizeof(PxU32)); + } + } + + // End of GRB write ---------------------------------------------------------- + + // Export sdf values + if (enableSdf) + { + writeFloat(mMeshData.mSdfData.mMeshLower.x, platformMismatch, stream); + writeFloat(mMeshData.mSdfData.mMeshLower.y, platformMismatch, stream); + writeFloat(mMeshData.mSdfData.mMeshLower.z, platformMismatch, stream); + writeFloat(mMeshData.mSdfData.mSpacing, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mDims.x, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mDims.y, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mDims.z, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mNumSdfs, platformMismatch, stream); + + writeDword(mMeshData.mSdfData.mNumSubgridSdfs, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mNumStartSlots, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mSubgridSize, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mSdfSubgrids3DTexBlockDim.x, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mSdfSubgrids3DTexBlockDim.y, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mSdfSubgrids3DTexBlockDim.z, platformMismatch, stream); + + writeFloat(mMeshData.mSdfData.mSubgridsMinSdfValue, platformMismatch, stream); + writeFloat(mMeshData.mSdfData.mSubgridsMaxSdfValue, platformMismatch, stream); + writeDword(mMeshData.mSdfData.mBytesPerSparsePixel, platformMismatch, stream); + + writeFloatBuffer(mMeshData.mSdfData.mSdf, mMeshData.mSdfData.mNumSdfs, platformMismatch, stream); + writeByteBuffer(mMeshData.mSdfData.mSubgridSdf, mMeshData.mSdfData.mNumSubgridSdfs, stream); + writeIntBuffer(mMeshData.mSdfData.mSubgridStartSlots, mMeshData.mSdfData.mNumStartSlots, platformMismatch, stream); + } + + //Export Inertia tensor + if(enableInertia) + { + writeFloat(mMeshData.mMass, platformMismatch, stream); + writeFloatBuffer(reinterpret_cast(&mMeshData.mInertia), 9, platformMismatch, stream); + writeFloatBuffer(&mMeshData.mLocalCenterOfMass.x, 3, platformMismatch, stream); + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4996) // permitting use of gatherStrided until we have a replacement. +#endif + +bool TriangleMeshBuilder::importMesh(const PxTriangleMeshDesc& desc,const PxCookingParams& params,PxTriangleMeshCookingResult::Enum* condition, bool validate) +{ + //convert and clean the input mesh + //this is where the mesh data gets copied from user mem to our mem + + PxVec3* verts = mMeshData.allocateVertices(desc.points.count); + IndexedTriangle32* tris = reinterpret_cast(mMeshData.allocateTriangles(desc.triangles.count, true, PxU32(params.buildGPUData))); + + //copy, and compact to get rid of strides: + immediateCooking::gatherStrided(desc.points.data, verts, mMeshData.mNbVertices, sizeof(PxVec3), desc.points.stride); + +#if PX_CHECKED + // PT: check all input vertices are valid + for(PxU32 i=0;i(__LINE__, "input mesh contains corrupted vertex data"); + } +#endif + + //for trigs index stride conversion and eventual reordering is also needed, I don't think flexicopy can do that for us. + + IndexedTriangle32* dest = tris; + const IndexedTriangle32* pastLastDest = tris + mMeshData.mNbTriangles; + const PxU8* source = reinterpret_cast(desc.triangles.data); + + //4 combos of 16 vs 32 and flip vs no flip + PxU32 c = (desc.flags & PxMeshFlag::eFLIPNORMALS)?PxU32(1):0; + if (desc.flags & PxMeshFlag::e16_BIT_INDICES) + { + //index stride conversion is also needed, I don't think flexicopy can do that for us. + while (dest < pastLastDest) + { + const PxU16 * trig16 = reinterpret_cast(source); + dest->mRef[0] = trig16[0]; + dest->mRef[1] = trig16[1+c]; + dest->mRef[2] = trig16[2-c]; + dest ++; + source += desc.triangles.stride; + } + } + else + { + while (dest < pastLastDest) + { + const PxU32 * trig32 = reinterpret_cast(source); + dest->mRef[0] = trig32[0]; + dest->mRef[1] = trig32[1+c]; + dest->mRef[2] = trig32[2-c]; + dest ++; + source += desc.triangles.stride; + } + } + + //copy the material index list if any: + if(desc.materialIndices.data) + { + PxMaterialTableIndex* materials = mMeshData.allocateMaterials(); + immediateCooking::gatherStrided(desc.materialIndices.data, materials, mMeshData.mNbTriangles, sizeof(PxMaterialTableIndex), desc.materialIndices.stride); + + // Check material indices + for(PxU32 i=0;i it works with a clean mesh + + if (!(params.meshPreprocessParams & PxMeshPreprocessingFlag::eDISABLE_CLEAN_MESH) || validate) + { + if(!cleanMesh(validate, condition)) + { + if(!validate) + outputError(__LINE__, "cleaning the mesh failed"); + return false; + } + } + else + { + // we need to fill the remap table if no cleaning was done + if(params.suppressTriangleMeshRemapTable == false) + { + PX_ASSERT(mMeshData.mFaceRemap == NULL); + mMeshData.mFaceRemap = PX_ALLOCATE(PxU32, mMeshData.mNbTriangles, "mFaceRemap"); + for (PxU32 i = 0; i < mMeshData.mNbTriangles; i++) + mMeshData.mFaceRemap[i] = i; + } + } + + if (mParams.meshPreprocessParams & PxMeshPreprocessingFlag::eENABLE_INERTIA) + { + buildInertiaTensor(); + } + + // Copy sdf data if enabled + if (desc.sdfDesc) + { + PxArray sdfData; + PxArray sdfDataSubgrids; + PxArray sdfSubgridsStartSlots; + + PxTriangleMeshDesc newDesc; + newDesc.points.count = mMeshData.mNbVertices; + newDesc.points.stride = sizeof(PxVec3); + newDesc.points.data = mMeshData.mVertices; + newDesc.triangles.count = mMeshData.mNbTriangles; + newDesc.triangles.stride = sizeof(PxU32) * 3; + newDesc.triangles.data = mMeshData.mTriangles; + newDesc.flags &= (~PxMeshFlag::e16_BIT_INDICES); + newDesc.sdfDesc = desc.sdfDesc; + + buildSDF(newDesc, sdfData, sdfDataSubgrids, sdfSubgridsStartSlots); + + PxSDFDesc& sdfDesc = *desc.sdfDesc; + + PxReal* sdf = mMeshData.mSdfData.allocateSdfs(sdfDesc.meshLower, sdfDesc.spacing, sdfDesc.dims.x, sdfDesc.dims.y, sdfDesc.dims.z, + sdfDesc.subgridSize, sdfDesc.sdfSubgrids3DTexBlockDim.x, sdfDesc.sdfSubgrids3DTexBlockDim.y, sdfDesc.sdfSubgrids3DTexBlockDim.z, + sdfDesc.subgridsMinSdfValue, sdfDesc.subgridsMaxSdfValue, sdfDesc.bitsPerSubgridPixel); + + + if (sdfDesc.subgridSize > 0) + { + //Sparse sdf + immediateCooking::gatherStrided(sdfDesc.sdf.data, sdf, sdfDesc.sdf.count, sizeof(PxReal), sdfDesc.sdf.stride); + + immediateCooking::gatherStrided(sdfDesc.sdfSubgrids.data, mMeshData.mSdfData.mSubgridSdf, + sdfDesc.sdfSubgrids.count, + sizeof(PxU8), sdfDesc.sdfSubgrids.stride); + immediateCooking::gatherStrided(sdfDesc.sdfStartSlots.data, mMeshData.mSdfData.mSubgridStartSlots, sdfDesc.sdfStartSlots.count, sizeof(PxU32), sdfDesc.sdfStartSlots.stride); + } + else + { + //copy, and compact to get rid of strides: + immediateCooking::gatherStrided(sdfDesc.sdf.data, sdf, sdfDesc.dims.x*sdfDesc.dims.y*sdfDesc.dims.z, sizeof(PxReal), sdfDesc.sdf.stride); + } + + //Make sure there is always a valid inertia tensor for meshes with an SDF + buildInertiaTensorFromSDF(); + +#if PX_CHECKED + // SN: check all input sdf values are valid + for (PxU32 i = 0; i < sdfDesc.sdf.count; ++i) + { + if (!PxIsFinite(sdf[i])) + return outputError(__LINE__, "input sdf contains corrupted data"); + } +#endif + } + + return true; +} + +#if PX_VC +#pragma warning(pop) +#endif +/////////////////////////////////////////////////////////////////////////////// + +void TriangleMeshBuilder::checkMeshIndicesSize() +{ + TriangleMeshData& m = mMeshData; + + // check if we can change indices from 32bits to 16bits + if(m.mNbVertices <= 0xffff && !m.has16BitIndices()) + { + const PxU32 numTriangles = m.mNbTriangles; + PxU32* PX_RESTRICT indices32 = reinterpret_cast (m.mTriangles); + PxU32* PX_RESTRICT grbIndices32 = reinterpret_cast(m.mGRB_primIndices); + + m.mTriangles = 0; // force a realloc + m.allocateTriangles(numTriangles, false, grbIndices32 != NULL ? 1u : 0u); + PX_ASSERT(m.has16BitIndices()); // realloc'ing without the force32bit flag changed it. + + PxU16* PX_RESTRICT indices16 = reinterpret_cast (m.mTriangles); + for (PxU32 i = 0; i < numTriangles * 3; i++) + indices16[i] = PxTo16(indices32[i]); + + PX_FREE(indices32); + + if (grbIndices32) + { + PxU16* PX_RESTRICT grbIndices16 = reinterpret_cast (m.mGRB_primIndices); + for (PxU32 i = 0; i < numTriangles * 3; i++) + grbIndices16[i] = PxTo16(grbIndices32[i]); + } + + PX_FREE(grbIndices32); + + onMeshIndexFormatChange(); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +BV4TriangleMeshBuilder::BV4TriangleMeshBuilder(const PxCookingParams& params) : TriangleMeshBuilder(mData, params) +{ +} + +BV4TriangleMeshBuilder::~BV4TriangleMeshBuilder() +{ +} + +void BV4TriangleMeshBuilder::onMeshIndexFormatChange() +{ + IndTri32* triangles32 = NULL; + IndTri16* triangles16 = NULL; + if(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) + triangles16 = reinterpret_cast(mMeshData.mTriangles); + else + triangles32 = reinterpret_cast(mMeshData.mTriangles); + + mData.mMeshInterface.setPointers(triangles32, triangles16, mMeshData.mVertices); +} + +void BV4TriangleMeshBuilder::createMidPhaseStructure() +{ + GU_PROFILE_ZONE("createMidPhaseStructure_BV4") + + const float gBoxEpsilon = 2e-4f; +// const float gBoxEpsilon = 0.1f; + mData.mMeshInterface.initRemap(); + mData.mMeshInterface.setNbVertices(mMeshData.mNbVertices); + mData.mMeshInterface.setNbTriangles(mMeshData.mNbTriangles); + + IndTri32* triangles32 = NULL; + IndTri16* triangles16 = NULL; + if (mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) + triangles16 = reinterpret_cast(mMeshData.mTriangles); + else + triangles32 = reinterpret_cast(mMeshData.mTriangles); + + mData.mMeshInterface.setPointers(triangles32, triangles16, mMeshData.mVertices); + + PX_ASSERT(mParams.midphaseDesc.getType() == PxMeshMidPhase::eBVH34); + const PxU32 nbTrisPerLeaf = mParams.midphaseDesc.mBVH34Desc.numPrimsPerLeaf; + const bool quantized = mParams.midphaseDesc.mBVH34Desc.quantized; + + const PxBVH34BuildStrategy::Enum strategy = mParams.midphaseDesc.mBVH34Desc.buildStrategy; + BV4_BuildStrategy gubs = BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER; // Default + if(strategy==PxBVH34BuildStrategy::eSAH) + gubs = BV4_SAH; + else if(strategy==PxBVH34BuildStrategy::eFAST) + gubs = BV4_SPLATTER_POINTS; + if(!BuildBV4Ex(mData.mBV4Tree, mData.mMeshInterface, gBoxEpsilon, nbTrisPerLeaf, quantized, gubs)) + { + outputError(__LINE__, "BV4 tree failed to build."); + return; + } + + { + GU_PROFILE_ZONE("..BV4 remap") + +// remapTopology(mData.mMeshInterface); + + const PxU32* order = mData.mMeshInterface.getRemap(); + if(mMeshData.mMaterialIndices) + { + PxMaterialTableIndex* newMat = PX_ALLOCATE(PxMaterialTableIndex, mMeshData.mNbTriangles, "mMaterialIndices"); + for(PxU32 i=0;i1 we now do the same as for other structures in the SDK: the data is + // exported either as little or big-endian depending on the passed parameter. + const PxU32 bv4StructureVersion = 3; + + writeChunk('B', 'V', '4', ' ', stream); + writeDword(bv4StructureVersion, mismatch, stream); + + writeFloat(mData.mBV4Tree.mLocalBounds.mCenter.x, mismatch, stream); + writeFloat(mData.mBV4Tree.mLocalBounds.mCenter.y, mismatch, stream); + writeFloat(mData.mBV4Tree.mLocalBounds.mCenter.z, mismatch, stream); + writeFloat(mData.mBV4Tree.mLocalBounds.mExtentsMagnitude, mismatch, stream); + + writeDword(mData.mBV4Tree.mInitData, mismatch, stream); + + writeFloat(mData.mBV4Tree.mCenterOrMinCoeff.x, mismatch, stream); + writeFloat(mData.mBV4Tree.mCenterOrMinCoeff.y, mismatch, stream); + writeFloat(mData.mBV4Tree.mCenterOrMinCoeff.z, mismatch, stream); + writeFloat(mData.mBV4Tree.mExtentsOrMaxCoeff.x, mismatch, stream); + writeFloat(mData.mBV4Tree.mExtentsOrMaxCoeff.y, mismatch, stream); + writeFloat(mData.mBV4Tree.mExtentsOrMaxCoeff.z, mismatch, stream); + + // PT: version 3 + writeDword(PxU32(mData.mBV4Tree.mQuantized), mismatch, stream); + + writeDword(mData.mBV4Tree.mNbNodes, mismatch, stream); + +#ifdef GU_BV4_USE_SLABS + // PT: we use BVDataPacked to get the size computation right, but we're dealing with BVDataSwizzled here! + const PxU32 NodeSize = mData.mBV4Tree.mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + stream.write(mData.mBV4Tree.mNodes, NodeSize*mData.mBV4Tree.mNbNodes); + PX_ASSERT(!mismatch); +#else + #error Not implemented +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +void BV32TriangleMeshBuilder::createMidPhaseStructure(const PxCookingParams& params, TriangleMeshData& meshData, BV32Tree& bv32Tree) +{ + GU_PROFILE_ZONE("createMidPhaseStructure_BV32") + + const float gBoxEpsilon = 2e-4f; + + SourceMesh meshInterface; + // const float gBoxEpsilon = 0.1f; + meshInterface.initRemap(); + meshInterface.setNbVertices(meshData.mNbVertices); + meshInterface.setNbTriangles(meshData.mNbTriangles); + + PX_ASSERT(!(meshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES)); + + IndTri32* triangles32 = reinterpret_cast(meshData.mGRB_primIndices); + + meshInterface.setPointers(triangles32, NULL, meshData.mVertices); + + const PxU32 nbTrisPerLeaf = 32; + + if (!BuildBV32Ex(bv32Tree, meshInterface, gBoxEpsilon, nbTrisPerLeaf)) + { + outputError(__LINE__, "BV32 tree failed to build."); + return; + } + + { + GU_PROFILE_ZONE("..BV32 remap") + + const PxU32* order = meshInterface.getRemap(); + + if (!params.suppressTriangleMeshRemapTable || params.buildGPUData) + { + PxU32* newMap = PX_ALLOCATE(PxU32, meshData.mNbTriangles, "mGRB_faceRemap"); + for (PxU32 i = 0; i1 we now do the same as for other structures in the SDK: the data is + // exported either as little or big-endian depending on the passed parameter. + const PxU32 bv32StructureVersion = 2; + + writeChunk('B', 'V', '3', '2', stream); + writeDword(bv32StructureVersion, mismatch, stream); + + writeFloat(bv32Tree->mLocalBounds.mCenter.x, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mCenter.y, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mCenter.z, mismatch, stream); + writeFloat(bv32Tree->mLocalBounds.mExtentsMagnitude, mismatch, stream); + + writeDword(bv32Tree->mInitData, mismatch, stream); + + writeDword(bv32Tree->mNbPackedNodes, mismatch, stream); + + PX_ASSERT(bv32Tree->mNbPackedNodes > 0); + for (PxU32 i = 0; i < bv32Tree->mNbPackedNodes; ++i) + { + BV32DataPacked& node = bv32Tree->mPackedNodes[i]; + + const PxU32 nbElements = node.mNbNodes * 4; + writeDword(node.mNbNodes, mismatch, stream); + writeDword(node.mDepth, mismatch, stream); + WriteDwordBuffer(node.mData, node.mNbNodes, mismatch, stream); + writeFloatBuffer(&node.mMin[0].x, nbElements, mismatch, stream); + writeFloatBuffer(&node.mMax[0].x, nbElements, mismatch, stream); + } + + writeDword(bv32Tree->mMaxTreeDepth, mismatch, stream); + + PX_ASSERT(bv32Tree->mMaxTreeDepth > 0); + + for (PxU32 i = 0; i < bv32Tree->mMaxTreeDepth; ++i) + { + BV32DataDepthInfo& info = bv32Tree->mTreeDepthInfo[i]; + + writeDword(info.offset, mismatch, stream); + writeDword(info.count, mismatch, stream); + } + + WriteDwordBuffer(bv32Tree->mRemapPackedNodeIndexWithDepth, bv32Tree->mNbPackedNodes, mismatch, stream); +} + +/////////////////////////////////////////////////////////////////////////////// + +RTreeTriangleMeshBuilder::RTreeTriangleMeshBuilder(const PxCookingParams& params) : TriangleMeshBuilder(mData, params) +{ +} + +RTreeTriangleMeshBuilder::~RTreeTriangleMeshBuilder() +{ +} + +struct RTreeCookerRemap : RTreeCooker::RemapCallback +{ + PxU32 mNbTris; + RTreeCookerRemap(PxU32 numTris) : mNbTris(numTris) + { + } + + virtual void remap(PxU32* val, PxU32 start, PxU32 leafCount) + { + PX_ASSERT(leafCount > 0); + PX_ASSERT(leafCount <= 16); // sanity check + PX_ASSERT(start < mNbTris); + PX_ASSERT(start+leafCount <= mNbTris); + PX_ASSERT(val); + LeafTriangles lt; + // here we remap from ordered leaf index in the rtree to index in post-remap in triangles + // this post-remap will happen later + lt.SetData(leafCount, start); + *val = lt.Data; + } +}; + +void RTreeTriangleMeshBuilder::createMidPhaseStructure() +{ + GU_PROFILE_ZONE("createMidPhaseStructure_RTREE") + + const PxReal meshSizePerformanceTradeOff = mParams.midphaseDesc.mBVH33Desc.meshSizePerformanceTradeOff; + const PxMeshCookingHint::Enum meshCookingHint = mParams.midphaseDesc.mBVH33Desc.meshCookingHint; + + PxArray resultPermute; + RTreeCookerRemap rc(mMeshData.mNbTriangles); + RTreeCooker::buildFromTriangles( + mData.mRTree, + mMeshData.mVertices, mMeshData.mNbVertices, + (mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) ? reinterpret_cast(mMeshData.mTriangles) : NULL, + !(mMeshData.mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) ? reinterpret_cast(mMeshData.mTriangles) : NULL, + mMeshData.mNbTriangles, resultPermute, &rc, meshSizePerformanceTradeOff, meshCookingHint); + + PX_ASSERT(resultPermute.size() == mMeshData.mNbTriangles); + + remapTopology(resultPermute.begin()); +} + +void RTreeTriangleMeshBuilder::saveMidPhaseStructure(PxOutputStream& stream, bool mismatch) const +{ + // PT: in version 1 we defined "mismatch" as: + // const bool mismatch = (littleEndian() == 1); + // i.e. the data was *always* saved to file in big-endian format no matter what. + // In version>1 we now do the same as for other structures in the SDK: the data is + // exported either as little or big-endian depending on the passed parameter. + const PxU32 rtreeStructureVersion = 2; + + // save the RTree root structure followed immediately by RTreePage pages to an output stream + writeChunk('R', 'T', 'R', 'E', stream); + + writeDword(rtreeStructureVersion, mismatch, stream); + const RTree& d = mData.mRTree; + writeFloatBuffer(&d.mBoundsMin.x, 4, mismatch, stream); + writeFloatBuffer(&d.mBoundsMax.x, 4, mismatch, stream); + writeFloatBuffer(&d.mInvDiagonal.x, 4, mismatch, stream); + writeFloatBuffer(&d.mDiagonalScaler.x, 4, mismatch, stream); + writeDword(d.mPageSize, mismatch, stream); + writeDword(d.mNumRootPages, mismatch, stream); + writeDword(d.mNumLevels, mismatch, stream); + writeDword(d.mTotalNodes, mismatch, stream); + writeDword(d.mTotalPages, mismatch, stream); + PxU32 unused = 0; writeDword(unused, mismatch, stream); // backwards compatibility + for (PxU32 j = 0; j < d.mTotalPages; j++) + { + writeFloatBuffer(d.mPages[j].minx, RTREE_N, mismatch, stream); + writeFloatBuffer(d.mPages[j].miny, RTREE_N, mismatch, stream); + writeFloatBuffer(d.mPages[j].minz, RTREE_N, mismatch, stream); + writeFloatBuffer(d.mPages[j].maxx, RTREE_N, mismatch, stream); + writeFloatBuffer(d.mPages[j].maxy, RTREE_N, mismatch, stream); + writeFloatBuffer(d.mPages[j].maxz, RTREE_N, mismatch, stream); + WriteDwordBuffer(d.mPages[j].ptrs, RTREE_N, mismatch, stream); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool immediateCooking::validateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc) +{ + // cooking code does lots of float bitwise reinterpretation that generates exceptions + PX_FPU_GUARD; + + if(!desc.isValid()) + return outputError(__LINE__, "Cooking::validateTriangleMesh: user-provided triangle mesh descriptor is invalid!"); + + // PT: validation code doesn't look at midphase data, so ideally we wouldn't build the midphase structure at all here. + if(params.midphaseDesc.getType() == PxMeshMidPhase::eBVH33) + { + RTreeTriangleMeshBuilder builder(params); + return builder.loadFromDesc(desc, NULL, true /*doValidate*/); + } + else if(params.midphaseDesc.getType() == PxMeshMidPhase::eBVH34) + { + BV4TriangleMeshBuilder builder(params); + return builder.loadFromDesc(desc, NULL, true /*doValidate*/); + } + else + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxTriangleMesh* immediateCooking::createTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition) +{ + struct Local + { + static PxTriangleMesh* createTriangleMesh(const PxCookingParams& params, TriangleMeshBuilder& builder, const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition) + { + // cooking code does lots of float bitwise reinterpretation that generates exceptions + PX_FPU_GUARD; + + if(condition) + *condition = PxTriangleMeshCookingResult::eSUCCESS; + if(!builder.loadFromDesc(desc, condition, false)) + return NULL; + + // check if the indices can be moved from 32bits to 16bits + if(!(params.meshPreprocessParams & PxMeshPreprocessingFlag::eFORCE_32BIT_INDICES)) + builder.checkMeshIndicesSize(); + + PxConcreteType::Enum type; + if(builder.getMidphaseID()==PxMeshMidPhase::eBVH33) + type = PxConcreteType::eTRIANGLE_MESH_BVH33; + else + type = PxConcreteType::eTRIANGLE_MESH_BVH34; + + return static_cast(insertionCallback.buildObjectFromData(type, &builder.getMeshData())); + } + }; + + if(params.midphaseDesc.getType() == PxMeshMidPhase::eBVH33) + { + RTreeTriangleMeshBuilder builder(params); + return Local::createTriangleMesh(params, builder, desc, insertionCallback, condition); + } + else + { + BV4TriangleMeshBuilder builder(params); + return Local::createTriangleMesh(params, builder, desc, insertionCallback, condition); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool immediateCooking::cookTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition) +{ + struct Local + { + static bool cookTriangleMesh(const PxCookingParams& params, TriangleMeshBuilder& builder, const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition) + { + // cooking code does lots of float bitwise reinterpretation that generates exceptions + PX_FPU_GUARD; + + if(condition) + *condition = PxTriangleMeshCookingResult::eSUCCESS; + if(!builder.loadFromDesc(desc, condition, false)) + return false; + + builder.save(stream, immediateCooking::platformMismatch(), params); + return true; + } + }; + + if(params.midphaseDesc.getType() == PxMeshMidPhase::eBVH33) + { + RTreeTriangleMeshBuilder builder(params); + return Local::cookTriangleMesh(params, builder, desc, stream, condition); + } + else + { + BV4TriangleMeshBuilder builder(params); + return Local::cookTriangleMesh(params, builder, desc, stream, condition); + } +} + +/////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.h new file mode 100644 index 0000000..2164676 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingTriangleMesh.h @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_TRIANGLE_MESH_H +#define GU_COOKING_TRIANGLE_MESH_H + +#include "GuMeshData.h" +#include "cooking/PxCooking.h" + +namespace physx +{ + namespace Gu + { + class EdgeList; + } + + class TriangleMeshBuilder + { + public: + TriangleMeshBuilder(Gu::TriangleMeshData& mesh, const PxCookingParams& params); + virtual ~TriangleMeshBuilder(); + + virtual PxMeshMidPhase::Enum getMidphaseID() const = 0; + // Called by base code when midphase structure should be built + virtual void createMidPhaseStructure() = 0; + + // Called by base code when midphase structure should be saved + virtual void saveMidPhaseStructure(PxOutputStream& stream, bool mismatch) const = 0; + // Called by base code when mesh index format has changed and the change should be reflected in midphase structure + virtual void onMeshIndexFormatChange() {} + + bool cleanMesh(bool validate, PxTriangleMeshCookingResult::Enum* condition); + void remapTopology(const PxU32* order); + + void createVertMapping(); + void createSharedEdgeData(bool buildAdjacencies, bool buildActiveEdges); + + void recordTriangleIndices(); + void createGRBMidPhaseAndData(const PxU32 originalTriangleCount); + void createGRBData(); + + bool loadFromDesc(const PxTriangleMeshDesc&, PxTriangleMeshCookingResult::Enum* condition, bool validate = false); + + bool save(PxOutputStream& stream, bool platformMismatch, const PxCookingParams& params) const; + void checkMeshIndicesSize(); + PX_FORCE_INLINE Gu::TriangleMeshData& getMeshData() { return mMeshData; } + protected: + //void computeLocalBounds(); + bool importMesh(const PxTriangleMeshDesc& desc, const PxCookingParams& params, PxTriangleMeshCookingResult::Enum* condition, bool validate = false); + + + bool loadFromDescInternal(PxTriangleMeshDesc&, PxTriangleMeshCookingResult::Enum* condition, bool validate = false); + + void buildInertiaTensor(); + void buildInertiaTensorFromSDF(); + + TriangleMeshBuilder& operator=(const TriangleMeshBuilder&); + Gu::EdgeList* mEdgeList; + const PxCookingParams& mParams; + Gu::TriangleMeshData& mMeshData; + }; + + class RTreeTriangleMeshBuilder : public TriangleMeshBuilder + { + public: + RTreeTriangleMeshBuilder(const PxCookingParams& params); + virtual ~RTreeTriangleMeshBuilder(); + + virtual PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH33; } + virtual void createMidPhaseStructure(); + virtual void saveMidPhaseStructure(PxOutputStream& stream, bool mismatch) const; + + Gu::RTreeTriangleData mData; + }; + + class BV4TriangleMeshBuilder : public TriangleMeshBuilder + { + public: + BV4TriangleMeshBuilder(const PxCookingParams& params); + virtual ~BV4TriangleMeshBuilder(); + + virtual PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH34; } + virtual void createMidPhaseStructure(); + virtual void saveMidPhaseStructure(PxOutputStream& stream, bool mismatch) const; + virtual void onMeshIndexFormatChange(); + + Gu::BV4TriangleData mData; + }; + + class BV32TriangleMeshBuilder + { + public: + static void createMidPhaseStructure(const PxCookingParams& params, Gu::TriangleMeshData& meshData, Gu::BV32Tree& bv32Tree); + static void saveMidPhaseStructure(Gu::BV32Tree* tree, PxOutputStream& stream, bool mismatch); + }; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp new file mode 100644 index 0000000..e71f74c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.cpp @@ -0,0 +1,733 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +/* +* This code computes volume integrals needed to compute mass properties of polyhedral bodies. +* Based on public domain code by Brian Mirtich. +*/ +#include "foundation/PxMemory.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "cooking/PxConvexMeshDesc.h" + +#include "GuCookingVolumeIntegration.h" +#include "GuConvexMeshData.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVecMath.h" + +// PT: code archeology: this initially came from ICE (IceVolumeIntegration.h/cpp). Consider revisiting. + +namespace physx +{ + using namespace aos; + +namespace +{ + class VolumeIntegrator + { + PX_NOCOPY(VolumeIntegrator) + public: + VolumeIntegrator(const PxSimpleTriangleMesh& mesh, PxF64 density) : mMass(0.0), mDensity(density), mMesh(mesh) {} + ~VolumeIntegrator() {} + + bool computeVolumeIntegrals(PxIntegrals& ir); + private: + struct Normal + { + PxVec3 normal; + PxF32 w; + }; + + struct Face + { + PxF64 Norm[3]; + PxF64 w; + PxU32 Verts[3]; + }; + + // Data structures + PxF64 mMass; //!< Mass + PxF64 mDensity; //!< Density + const PxSimpleTriangleMesh& mMesh; + + PxU32 mA; //!< Alpha + PxU32 mB; //!< Beta + PxU32 mC; //!< Gamma + + // Projection integrals + PxF64 mP1; + PxF64 mPa; //!< Pi Alpha + PxF64 mPb; //!< Pi Beta + PxF64 mPaa; //!< Pi Alpha^2 + PxF64 mPab; //!< Pi AlphaBeta + PxF64 mPbb; //!< Pi Beta^2 + PxF64 mPaaa; //!< Pi Alpha^3 + PxF64 mPaab; //!< Pi Alpha^2Beta + PxF64 mPabb; //!< Pi AlphaBeta^2 + PxF64 mPbbb; //!< Pi Beta^3 + + // Face integrals + PxF64 mFa; //!< FAlpha + PxF64 mFb; //!< FBeta + PxF64 mFc; //!< FGamma + PxF64 mFaa; //!< FAlpha^2 + PxF64 mFbb; //!< FBeta^2 + PxF64 mFcc; //!< FGamma^2 + PxF64 mFaaa; //!< FAlpha^3 + PxF64 mFbbb; //!< FBeta^3 + PxF64 mFccc; //!< FGamma^3 + PxF64 mFaab; //!< FAlpha^2Beta + PxF64 mFbbc; //!< FBeta^2Gamma + PxF64 mFcca; //!< FGamma^2Alpha + + // The 10 volume integrals + PxF64 mT0; //!< ~Total mass + PxF64 mT1[3]; //!< Location of the center of mass + PxF64 mT2[3]; //!< Moments of inertia + PxF64 mTP[3]; //!< Products of inertia + + // Internal methods + // bool Init(); + PxVec3 computeCenterOfMass(); + void computeInertiaTensor(PxF64* J); + void computeCOMInertiaTensor(PxF64* J); + void computeFaceNormal(Face & f, PxU32 * indices); + + void computeProjectionIntegrals(const Face& f); + void computeFaceIntegrals(const Face& f); + }; + + #define X 0u + #define Y 1u + #define Z 2u + + void VolumeIntegrator::computeFaceNormal(Face & f, PxU32 * indices) + { + const PxU8 * vertPointer = reinterpret_cast(mMesh.points.data); + + const PxU32 stride = mMesh.points.stride; + + //two edges + const PxVec3 d1 = (*reinterpret_cast(vertPointer + stride * indices[1] )) - (*reinterpret_cast(vertPointer + stride * indices[0] )); + const PxVec3 d2 = (*reinterpret_cast(vertPointer + stride * indices[2] )) - (*reinterpret_cast(vertPointer + stride * indices[1] )); + + PxVec3 normal = d1.cross(d2); + + normal.normalizeSafe(); + + f.w = - PxF64(normal.dot((*reinterpret_cast(vertPointer + stride * indices[0] )) )); + + f.Norm[0] = PxF64(normal.x); + f.Norm[1] = PxF64(normal.y); + f.Norm[2] = PxF64(normal.z); + } + + /** + * Computes volume integrals for a polyhedron by summing surface integrals over its faces. + * \param ir [out] a result structure. + * \return true if success + */ + bool VolumeIntegrator::computeVolumeIntegrals(PxIntegrals& ir) + { + // Clear all integrals + mT0 = mT1[X] = mT1[Y] = mT1[Z] = mT2[X] = mT2[Y] = mT2[Z] = mTP[X] = mTP[Y] = mTP[Z] = 0; + + Face f; + const PxU8* trigPointer = reinterpret_cast(mMesh.triangles.data); + const PxU32 nbTris = mMesh.triangles.count; + const PxU32 stride = mMesh.triangles.stride; + for(PxU32 i=0;i(trigPointer))[0]; + f.Verts[1] = (reinterpret_cast(trigPointer))[1]; + f.Verts[2] = (reinterpret_cast(trigPointer))[2]; + } + else + { + f.Verts[0] = (reinterpret_cast(trigPointer)[0]); + f.Verts[1] = (reinterpret_cast(trigPointer)[1]); + f.Verts[2] = (reinterpret_cast(trigPointer)[2]); + } + + if (mMesh.flags & PxMeshFlag::eFLIPNORMALS) + { + PxU32 t = f.Verts[1]; + f.Verts[1] = f.Verts[2]; + f.Verts[2] = t; + } + + //compute face normal: + computeFaceNormal(f,f.Verts); + + if(f.Norm[X] * f.Norm[X] + f.Norm[Y] * f.Norm[Y] + f.Norm[Z] * f.Norm[Z] < 1e-20) + continue; + + // Compute alpha/beta/gamma as the right-handed permutation of (x,y,z) that maximizes |n| + const PxF64 nx = fabs(f.Norm[X]); + const PxF64 ny = fabs(f.Norm[Y]); + const PxF64 nz = fabs(f.Norm[Z]); + if (nx > ny && nx > nz) mC = X; + else mC = (ny > nz) ? Y : Z; + mA = (mC + 1) % 3; + mB = (mA + 1) % 3; + + // Compute face contribution + computeFaceIntegrals(f); + + // Update integrals + mT0 += f.Norm[X] * ((mA == X) ? mFa : ((mB == X) ? mFb : mFc)); + + mT1[mA] += f.Norm[mA] * mFaa; + mT1[mB] += f.Norm[mB] * mFbb; + mT1[mC] += f.Norm[mC] * mFcc; + + mT2[mA] += f.Norm[mA] * mFaaa; + mT2[mB] += f.Norm[mB] * mFbbb; + mT2[mC] += f.Norm[mC] * mFccc; + + mTP[mA] += f.Norm[mA] * mFaab; + mTP[mB] += f.Norm[mB] * mFbbc; + mTP[mC] += f.Norm[mC] * mFcca; + } + + mT1[X] /= 2; mT1[Y] /= 2; mT1[Z] /= 2; + mT2[X] /= 3; mT2[Y] /= 3; mT2[Z] /= 3; + mTP[X] /= 2; mTP[Y] /= 2; mTP[Z] /= 2; + + // Fill result structure + ir.COM = computeCenterOfMass(); + computeInertiaTensor(reinterpret_cast(ir.inertiaTensor)); + computeCOMInertiaTensor(reinterpret_cast(ir.COMInertiaTensor)); + ir.mass = mMass; + return true; + } + + /** + * Computes the center of mass. + * \return The center of mass. + */ + PxVec3 VolumeIntegrator::computeCenterOfMass() + { + // Compute center of mass + PxVec3 COM(0.0f); + if(mT0!=0.0) + { + COM.x = float(mT1[X] / mT0); + COM.y = float(mT1[Y] / mT0); + COM.z = float(mT1[Z] / mT0); + } + return COM; + } + + /** + * Setups the inertia tensor relative to the origin. + * \param it [out] the returned inertia tensor. + */ + void VolumeIntegrator::computeInertiaTensor(PxF64* it) + { + PxF64 J[3][3]; + + // Compute inertia tensor + J[X][X] = mDensity * (mT2[Y] + mT2[Z]); + J[Y][Y] = mDensity * (mT2[Z] + mT2[X]); + J[Z][Z] = mDensity * (mT2[X] + mT2[Y]); + + J[X][Y] = J[Y][X] = - mDensity * mTP[X]; + J[Y][Z] = J[Z][Y] = - mDensity * mTP[Y]; + J[Z][X] = J[X][Z] = - mDensity * mTP[Z]; + + PxMemCopy(it, J, 9*sizeof(PxF64)); + } + + /** + * Setups the inertia tensor relative to the COM. + * \param it [out] the returned inertia tensor. + */ + void VolumeIntegrator::computeCOMInertiaTensor(PxF64* it) + { + PxF64 J[3][3]; + + mMass = mDensity * mT0; + + const PxVec3 COM = computeCenterOfMass(); + const PxVec3 MassCOM(PxF32(mMass) * COM); + const PxVec3 MassCOM2(MassCOM.x * COM.x, MassCOM.y * COM.y, MassCOM.z * COM.z); + + // Compute initial inertia tensor + computeInertiaTensor(reinterpret_cast(J)); + + // Translate inertia tensor to center of mass + // Huyghens' theorem: + // Jx'x' = Jxx - m*(YG^2+ZG^2) + // Jy'y' = Jyy - m*(ZG^2+XG^2) + // Jz'z' = Jzz - m*(XG^2+YG^2) + // XG, YG, ZG = new origin + // YG^2+ZG^2 = dx^2 + J[X][X] -= PxF64(MassCOM2.y + MassCOM2.z); + J[Y][Y] -= PxF64(MassCOM2.z + MassCOM2.x); + J[Z][Z] -= PxF64(MassCOM2.x + MassCOM2.y); + + // Huyghens' theorem: + // Jx'y' = Jxy - m*XG*YG + // Jy'z' = Jyz - m*YG*ZG + // Jz'x' = Jzx - m*ZG*XG + // ### IS THE SIGN CORRECT ? + J[X][Y] = J[Y][X] += PxF64(MassCOM.x * COM.y); + J[Y][Z] = J[Z][Y] += PxF64(MassCOM.y * COM.z); + J[Z][X] = J[X][Z] += PxF64(MassCOM.z * COM.x); + + PxMemCopy(it, J, 9*sizeof(PxF64)); + } + + /** + * Computes integrals over a face projection from the coordinates of the projections vertices. + * \param f [in] a face structure. + */ + void VolumeIntegrator::computeProjectionIntegrals(const Face& f) + { + mP1 = mPa = mPb = mPaa = mPab = mPbb = mPaaa = mPaab = mPabb = mPbbb = 0.0; + + const PxU8* vertPointer = reinterpret_cast(mMesh.points.data); + const PxU32 stride = mMesh.points.stride; + for(PxU32 i=0;i<3;i++) + { + const PxVec3& p0 = *reinterpret_cast(vertPointer + stride * (f.Verts[i]) ); + const PxVec3& p1 = *reinterpret_cast(vertPointer + stride * (f.Verts[(i+1) % 3]) ); + + const PxF64 a0 = PxF64(p0[mA]); + const PxF64 b0 = PxF64(p0[mB]); + const PxF64 a1 = PxF64(p1[mA]); + const PxF64 b1 = PxF64(p1[mB]); + + const PxF64 da = a1 - a0; // DeltaA + const PxF64 db = b1 - b0; // DeltaB + + const PxF64 a0_2 = a0 * a0; // Alpha0^2 + const PxF64 a0_3 = a0_2 * a0; // ... + const PxF64 a0_4 = a0_3 * a0; + + const PxF64 b0_2 = b0 * b0; + const PxF64 b0_3 = b0_2 * b0; + const PxF64 b0_4 = b0_3 * b0; + + const PxF64 a1_2 = a1 * a1; + const PxF64 a1_3 = a1_2 * a1; + + const PxF64 b1_2 = b1 * b1; + const PxF64 b1_3 = b1_2 * b1; + + const PxF64 C1 = a1 + a0; + + const PxF64 Ca = a1*C1 + a0_2; + const PxF64 Caa = a1*Ca + a0_3; + const PxF64 Caaa = a1*Caa + a0_4; + + const PxF64 Cb = b1*(b1 + b0) + b0_2; + const PxF64 Cbb = b1*Cb + b0_3; + const PxF64 Cbbb = b1*Cbb + b0_4; + + const PxF64 Cab = 3*a1_2 + 2*a1*a0 + a0_2; + const PxF64 Kab = a1_2 + 2*a1*a0 + 3*a0_2; + + const PxF64 Caab = a0*Cab + 4*a1_3; + const PxF64 Kaab = a1*Kab + 4*a0_3; + + const PxF64 Cabb = 4*b1_3 + 3*b1_2*b0 + 2*b1*b0_2 + b0_3; + const PxF64 Kabb = b1_3 + 2*b1_2*b0 + 3*b1*b0_2 + 4*b0_3; + + mP1 += db*C1; + mPa += db*Ca; + mPaa += db*Caa; + mPaaa += db*Caaa; + mPb += da*Cb; + mPbb += da*Cbb; + mPbbb += da*Cbbb; + mPab += db*(b1*Cab + b0*Kab); + mPaab += db*(b1*Caab + b0*Kaab); + mPabb += da*(a1*Cabb + a0*Kabb); + } + + mP1 /= 2.0; + mPa /= 6.0; + mPaa /= 12.0; + mPaaa /= 20.0; + mPb /= -6.0; + mPbb /= -12.0; + mPbbb /= -20.0; + mPab /= 24.0; + mPaab /= 60.0; + mPabb /= -60.0; + } + + #define SQR(x) ((x)*(x)) //!< Returns x square + #define CUBE(x) ((x)*(x)*(x)) //!< Returns x cube + + /** + * Computes surface integrals over a polyhedral face from the integrals over its projection. + * \param f [in] a face structure. + */ + void VolumeIntegrator::computeFaceIntegrals(const Face& f) + { + computeProjectionIntegrals(f); + + const PxF64 w = f.w; + const PxF64* n = f.Norm; + const PxF64 k1 = 1 / n[mC]; + const PxF64 k2 = k1 * k1; + const PxF64 k3 = k2 * k1; + const PxF64 k4 = k3 * k1; + + mFa = k1 * mPa; + mFb = k1 * mPb; + mFc = -k2 * (n[mA]*mPa + n[mB]*mPb + w*mP1); + + mFaa = k1 * mPaa; + mFbb = k1 * mPbb; + mFcc = k3 * (SQR(n[mA])*mPaa + 2*n[mA]*n[mB]*mPab + SQR(n[mB])*mPbb + w*(2*(n[mA]*mPa + n[mB]*mPb) + w*mP1)); + + mFaaa = k1 * mPaaa; + mFbbb = k1 * mPbbb; + mFccc = -k4 * (CUBE(n[mA])*mPaaa + 3*SQR(n[mA])*n[mB]*mPaab + + 3*n[mA]*SQR(n[mB])*mPabb + CUBE(n[mB])*mPbbb + + 3*w*(SQR(n[mA])*mPaa + 2*n[mA]*n[mB]*mPab + SQR(n[mB])*mPbb) + + w*w*(3*(n[mA]*mPa + n[mB]*mPb) + w*mP1)); + + mFaab = k1 * mPaab; + mFbbc = -k2 * (n[mA]*mPabb + n[mB]*mPbbb + w*mPbb); + mFcca = k3 * (SQR(n[mA])*mPaaa + 2*n[mA]*n[mB]*mPaab + SQR(n[mB])*mPabb + w*(2*(n[mA]*mPaa + n[mB]*mPab) + w*mPa)); + } + + /* + * This code computes volume integrals needed to compute mass properties of polyhedral bodies. + * Based on public domain code by David Eberly. + */ + + class VolumeIntegratorEberly + { + PX_NOCOPY(VolumeIntegratorEberly) + public: + VolumeIntegratorEberly(const PxConvexMeshDesc& desc, PxF64 density) : mDesc(desc), mMass(0), mMassR(0), mDensity(density) {} + ~VolumeIntegratorEberly() {} + + bool computeVolumeIntegralsSIMD(PxIntegrals& ir, const PxVec3& origin); + bool computeVolumeIntegrals(PxIntegrals& ir, const PxVec3& origin); + + private: + const PxConvexMeshDesc& mDesc; + PxF64 mMass; + PxReal mMassR; + PxF64 mDensity; + }; + + PX_FORCE_INLINE void subexpressions(PxF64 w0, PxF64 w1, PxF64 w2, PxF64& f1, PxF64& f2, PxF64& f3, PxF64& g0, PxF64& g1, PxF64& g2) + { + PxF64 temp0 = w0 + w1; + f1 = temp0 + w2; + PxF64 temp1 = w0*w0; + PxF64 temp2 = temp1 + w1*temp0; + f2 = temp2 + w2*f1; + f3 = w0*temp1 + w1*temp2 + w2*f2; + g0 = f2 + w0*(f1 + w0); + g1 = f2 + w1*(f1 + w1); + g2 = f2 + w2*(f1 + w2); + } + + PX_FORCE_INLINE void subexpressionsSIMD(const Vec4V& w0, const Vec4V& w1, const Vec4V& w2, + Vec4V& f1, Vec4V& f2, Vec4V& f3, Vec4V& g0, Vec4V& g1, Vec4V& g2) + { + const Vec4V temp0 = V4Add(w0, w1); + f1 = V4Add(temp0, w2); + const Vec4V temp1 = V4Mul(w0,w0); + const Vec4V temp2 = V4MulAdd(w1, temp0, temp1); + f2 = V4MulAdd(w2, f1, temp2); + + // f3 = w0.multiply(temp1) + w1.multiply(temp2) + w2.multiply(f2); + const Vec4V ad0 = V4Mul(w0, temp1); + const Vec4V ad1 = V4MulAdd(w1, temp2, ad0); + f3 = V4MulAdd(w2, f2, ad1); + + g0 = V4MulAdd(w0, V4Add(f1, w0), f2); // f2 + w0.multiply(f1 + w0); + g1 = V4MulAdd(w1, V4Add(f1, w1), f2); // f2 + w1.multiply(f1 + w1); + g2 = V4MulAdd(w2, V4Add(f1, w2), f2); // f2 + w2.multiply(f1 + w2); + } + + /** + * Computes volume integrals for a polyhedron by summing surface integrals over its faces. SIMD version + * \param ir [out] a result structure. + * \param origin [in] the origin of the mesh vertices. All vertices will be shifted accordingly prior to computing the volume integrals. + Can improve accuracy, for example, if the centroid is used in the case of a convex mesh. Note: the returned inertia will not be relative to this origin but relative to (0,0,0). + * \return true if success + */ + bool VolumeIntegratorEberly::computeVolumeIntegralsSIMD(PxIntegrals& ir, const PxVec3& origin) + { + FloatV mult = FLoad(1.0f/6.0f); + const Vec4V multV = V4Load(1.0f/24.0f); + const Vec4V multV2 = V4Load(1.0f/60.0f); + const Vec4V multVV = V4Load(1.0f/120.0f); + + // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx + FloatV intg = FLoad(0.0f); + Vec4V intgV = V4Load(0.0f); + Vec4V intgV2 = V4Load(0.0f); + Vec4V intgVV = V4Load(0.0f); + + const Vec4V originV = Vec4V_From_PxVec3_WUndefined(origin); + const FloatV zeroV = FLoad(0.0f); + + const PxVec3* hullVerts = static_cast (mDesc.points.data); + const Gu::HullPolygonData* hullPolygons = static_cast (mDesc.polygons.data); + + for (PxU32 i = 0; i < mDesc.polygons.count; i++) + { + const Gu::HullPolygonData& polygon = hullPolygons[i]; + const PxU8* data = static_cast(mDesc.indices.data) + polygon.mVRef8; + const PxU32 nbVerts = polygon.mNbVerts; + + PX_ASSERT(nbVerts > 2); + + const Vec4V normalV = V4LoadU(&polygon.mPlane.n.x); + + for (PxU32 j = 0; j < nbVerts - 2; j++) + { + // Should be safe to V4Load, we allocate one more vertex each time + const Vec4V vertex0 = V4LoadU(&hullVerts[data[0]].x); + const Vec4V vertex1 = V4LoadU(&hullVerts[data[j + 1]].x); + const Vec4V vertex2 = V4LoadU(&hullVerts[data[j + 2]].x); + + const Vec4V p0 = V4Sub(vertex0, originV); + Vec4V p1 = V4Sub(vertex1, originV); + Vec4V p2 = V4Sub(vertex2, originV); + + const Vec4V p0YZX = V4PermYZXW(p0); + const Vec4V p1YZX = V4PermYZXW(p1); + const Vec4V p2YZX = V4PermYZXW(p2); + + // get edges and cross product of edges + Vec4V d = V4Cross(V4Sub(p1, p0), V4Sub(p2, p0)); // (p1 - p0).cross(p2 - p0); + + const FloatV dist = V4Dot3(d, normalV); + //if(cp.dot(normalV) < 0) + if(FAllGrtr(zeroV, dist)) + { + d = V4Neg(d); + Vec4V temp = p1; + p1 = p2; + p2 = temp; + } + + // compute integral terms + Vec4V f1; Vec4V f2; Vec4V f3; Vec4V g0; Vec4V g1; Vec4V g2; + + subexpressionsSIMD(p0, p1, p2, f1, f2, f3, g0, g1, g2); + + // update integrals + intg = FScaleAdd(V4GetX(d), V4GetX(f1), intg); //intg += d.x*f1.x; + + intgV = V4MulAdd(d, f2, intgV); // intgV +=d.multiply(f2); + intgV2 = V4MulAdd(d, f3, intgV2); // intgV2 += d.multiply(f3); + + const Vec4V ad0 = V4Mul(p0YZX, g0); + const Vec4V ad1 = V4MulAdd(p1YZX, g1, ad0); + const Vec4V ad2 = V4MulAdd(p2YZX, g2, ad1); + intgVV = V4MulAdd(d, ad2, intgVV); //intgVV += d.multiply(p0YZX.multiply(g0) + p1YZX.multiply(g1) + p2YZX.multiply(g2)); + } + } + + intg = FMul(intg, mult); // intg *= mult; + intgV = V4Mul(intgV, multV); + intgV2 = V4Mul(intgV2, multV2); + intgVV = V4Mul(intgVV, multVV); + + // center of mass ir.COM = intgV/mMassR; + const Vec4V comV = V4ScaleInv(intgV, intg); + // we rewrite the mass, but then we set it back + V4StoreU(comV, &ir.COM.x); + + FStore(intg, &mMassR); + ir.mass = PxF64(mMassR); // = intg; + + PxVec3 intg2; + V3StoreU(Vec3V_From_Vec4V(intgV2), intg2); + + PxVec3 intVV; + V3StoreU(Vec3V_From_Vec4V(intgVV), intVV); + + // inertia tensor relative to the provided origin parameter + ir.inertiaTensor[0][0] = PxF64(intg2.y + intg2.z); + ir.inertiaTensor[1][1] = PxF64(intg2.x + intg2.z); + ir.inertiaTensor[2][2] = PxF64(intg2.x + intg2.y); + ir.inertiaTensor[0][1] = ir.inertiaTensor[1][0] = PxF64(-intVV.x); + ir.inertiaTensor[1][2] = ir.inertiaTensor[2][1] = PxF64(-intVV.y); + ir.inertiaTensor[0][2] = ir.inertiaTensor[2][0] = PxF64(-intVV.z); + + // inertia tensor relative to center of mass + ir.COMInertiaTensor[0][0] = ir.inertiaTensor[0][0] -PxF64(mMassR*(ir.COM.y*ir.COM.y+ir.COM.z*ir.COM.z)); + ir.COMInertiaTensor[1][1] = ir.inertiaTensor[1][1] -PxF64(mMassR*(ir.COM.z*ir.COM.z+ir.COM.x*ir.COM.x)); + ir.COMInertiaTensor[2][2] = ir.inertiaTensor[2][2] -PxF64(mMassR*(ir.COM.x*ir.COM.x+ir.COM.y*ir.COM.y)); + ir.COMInertiaTensor[0][1] = ir.COMInertiaTensor[1][0] = (ir.inertiaTensor[0][1] +PxF64(mMassR*ir.COM.x*ir.COM.y)); + ir.COMInertiaTensor[1][2] = ir.COMInertiaTensor[2][1] = (ir.inertiaTensor[1][2] +PxF64(mMassR*ir.COM.y*ir.COM.z)); + ir.COMInertiaTensor[0][2] = ir.COMInertiaTensor[2][0] = (ir.inertiaTensor[0][2] +PxF64(mMassR*ir.COM.z*ir.COM.x)); + + // inertia tensor relative to (0,0,0) + if (!origin.isZero()) + { + PxVec3 sum = ir.COM + origin; + ir.inertiaTensor[0][0] -= PxF64(mMassR*((ir.COM.y*ir.COM.y+ir.COM.z*ir.COM.z) - (sum.y*sum.y+sum.z*sum.z))); + ir.inertiaTensor[1][1] -= PxF64(mMassR*((ir.COM.z*ir.COM.z+ir.COM.x*ir.COM.x) - (sum.z*sum.z+sum.x*sum.x))); + ir.inertiaTensor[2][2] -= PxF64(mMassR*((ir.COM.x*ir.COM.x+ir.COM.y*ir.COM.y) - (sum.x*sum.x+sum.y*sum.y))); + ir.inertiaTensor[0][1] = ir.inertiaTensor[1][0] = ir.inertiaTensor[0][1] + PxF64(mMassR*((ir.COM.x*ir.COM.y) - (sum.x*sum.y))); + ir.inertiaTensor[1][2] = ir.inertiaTensor[2][1] = ir.inertiaTensor[1][2] + PxF64(mMassR*((ir.COM.y*ir.COM.z) - (sum.y*sum.z))); + ir.inertiaTensor[0][2] = ir.inertiaTensor[2][0] = ir.inertiaTensor[0][2] + PxF64(mMassR*((ir.COM.z*ir.COM.x) - (sum.z*sum.x))); + ir.COM = sum; + } + + return true; + } + + /** + * Computes volume integrals for a polyhedron by summing surface integrals over its faces. + * \param ir [out] a result structure. + * \param origin [in] the origin of the mesh vertices. All vertices will be shifted accordingly prior to computing the volume integrals. + Can improve accuracy, for example, if the centroid is used in the case of a convex mesh. Note: the returned inertia will not be relative to this origin but relative to (0,0,0). + * \return true if success + */ + bool VolumeIntegratorEberly::computeVolumeIntegrals(PxIntegrals& ir, const PxVec3& origin) + { + const PxF64 mult[10] = {1.0/6.0,1.0/24.0,1.0/24.0,1.0/24.0,1.0/60.0,1.0/60.0,1.0/60.0,1.0/120.0,1.0/120.0,1.0/120.0}; + PxF64 intg[10] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}; // order: 1, x, y, z, x^2, y^2, z^2, xy, yz, zx + const PxVec3* hullVerts = static_cast (mDesc.points.data); + + for (PxU32 i = 0; i < mDesc.polygons.count; i++) + { + const Gu::HullPolygonData& polygon = (static_cast (mDesc.polygons.data))[i]; + const PxU8* Data = static_cast(mDesc.indices.data) + polygon.mVRef8; + const PxU32 NbVerts = polygon.mNbVerts; + for (PxU32 j = 0; j < NbVerts - 2; j++) + { + const PxVec3 p0 = hullVerts[Data[0]] - origin; + PxVec3 p1 = hullVerts[Data[(j + 1) % NbVerts]] - origin; + PxVec3 p2 = hullVerts[Data[(j + 2) % NbVerts]] - origin; + + PxVec3 cp = (p1 - p0).cross(p2 - p0); + + if(cp.dot(polygon.mPlane.n) < 0) + { + cp = -cp; + PxSwap(p1,p2); + } + + PxF64 x0 = PxF64(p0.x); PxF64 y0 = PxF64(p0.y); PxF64 z0 = PxF64(p0.z); + PxF64 x1 = PxF64(p1.x); PxF64 y1 = PxF64(p1.y); PxF64 z1 = PxF64(p1.z); + PxF64 x2 = PxF64(p2.x); PxF64 y2 = PxF64(p2.y); PxF64 z2 = PxF64(p2.z); + + // get edges and cross product of edges + PxF64 d0 = PxF64(cp.x); PxF64 d1 = PxF64(cp.y); PxF64 d2 = PxF64(cp.z); + + // compute integral terms + PxF64 f1x; PxF64 f2x; PxF64 f3x; PxF64 g0x; PxF64 g1x; PxF64 g2x; + PxF64 f1y; PxF64 f2y; PxF64 f3y; PxF64 g0y; PxF64 g1y; PxF64 g2y; + PxF64 f1z; PxF64 f2z; PxF64 f3z; PxF64 g0z; PxF64 g1z; PxF64 g2z; + + subexpressions(x0, x1, x2, f1x, f2x, f3x, g0x, g1x, g2x); + subexpressions(y0, y1, y2, f1y, f2y, f3y, g0y, g1y, g2y); + subexpressions(z0, z1, z2, f1z, f2z, f3z, g0z, g1z, g2z); + + // update integrals + intg[0] += d0*f1x; + intg[1] += d0*f2x; intg[2] += d1*f2y; intg[3] += d2*f2z; + intg[4] += d0*f3x; intg[5] += d1*f3y; intg[6] += d2*f3z; + intg[7] += d0*(y0*g0x + y1*g1x + y2*g2x); + intg[8] += d1*(z0*g0y + z1*g1y + z2*g2y); + intg[9] += d2*(x0*g0z + x1*g1z + x2*g2z); + } + } + + for (PxU32 i = 0; i < 10; i++) + { + intg[i] *= mult[i]; + } + + ir.mass = mMass = intg[0]; + // center of mass + ir.COM.x = PxReal(intg[1]/mMass); + ir.COM.y = PxReal(intg[2]/mMass); + ir.COM.z = PxReal(intg[3]/mMass); + + // inertia tensor relative to the provided origin parameter + ir.inertiaTensor[0][0] = intg[5]+intg[6]; + ir.inertiaTensor[1][1] = intg[4]+intg[6]; + ir.inertiaTensor[2][2] = intg[4]+intg[5]; + ir.inertiaTensor[0][1] = ir.inertiaTensor[1][0] = -intg[7]; + ir.inertiaTensor[1][2] = ir.inertiaTensor[2][1] = -intg[8]; + ir.inertiaTensor[0][2] = ir.inertiaTensor[2][0] = -intg[9]; + + // inertia tensor relative to center of mass + ir.COMInertiaTensor[0][0] = ir.inertiaTensor[0][0] -mMass*PxF64((ir.COM.y*ir.COM.y+ir.COM.z*ir.COM.z)); + ir.COMInertiaTensor[1][1] = ir.inertiaTensor[1][1] -mMass*PxF64((ir.COM.z*ir.COM.z+ir.COM.x*ir.COM.x)); + ir.COMInertiaTensor[2][2] = ir.inertiaTensor[2][2] -mMass*PxF64((ir.COM.x*ir.COM.x+ir.COM.y*ir.COM.y)); + ir.COMInertiaTensor[0][1] = ir.COMInertiaTensor[1][0] = (ir.inertiaTensor[0][1] +mMass*PxF64(ir.COM.x*ir.COM.y)); + ir.COMInertiaTensor[1][2] = ir.COMInertiaTensor[2][1] = (ir.inertiaTensor[1][2] +mMass*PxF64(ir.COM.y*ir.COM.z)); + ir.COMInertiaTensor[0][2] = ir.COMInertiaTensor[2][0] = (ir.inertiaTensor[0][2] +mMass*PxF64(ir.COM.z*ir.COM.x)); + + // inertia tensor relative to (0,0,0) + if (!origin.isZero()) + { + PxVec3 sum = ir.COM + origin; + ir.inertiaTensor[0][0] -= mMass*PxF64((ir.COM.y*ir.COM.y+ir.COM.z*ir.COM.z) - (sum.y*sum.y+sum.z*sum.z)); + ir.inertiaTensor[1][1] -= mMass*PxF64((ir.COM.z*ir.COM.z+ir.COM.x*ir.COM.x) - (sum.z*sum.z+sum.x*sum.x)); + ir.inertiaTensor[2][2] -= mMass*PxF64((ir.COM.x*ir.COM.x+ir.COM.y*ir.COM.y) - (sum.x*sum.x+sum.y*sum.y)); + ir.inertiaTensor[0][1] = ir.inertiaTensor[1][0] = ir.inertiaTensor[0][1] + mMass*PxF64((ir.COM.x*ir.COM.y) - (sum.x*sum.y)); + ir.inertiaTensor[1][2] = ir.inertiaTensor[2][1] = ir.inertiaTensor[1][2] + mMass*PxF64((ir.COM.y*ir.COM.z) - (sum.y*sum.z)); + ir.inertiaTensor[0][2] = ir.inertiaTensor[2][0] = ir.inertiaTensor[0][2] + mMass*PxF64((ir.COM.z*ir.COM.x) - (sum.z*sum.x)); + ir.COM = sum; + } + + return true; + } +} // namespace + +// Wrapper +bool computeVolumeIntegrals(const PxSimpleTriangleMesh& mesh, PxReal density, PxIntegrals& integrals) +{ + VolumeIntegrator v(mesh, PxF64(density)); + return v.computeVolumeIntegrals(integrals); +} + +// Wrapper +bool computeVolumeIntegralsEberly(const PxConvexMeshDesc& mesh, PxReal density, PxIntegrals& integrals, const PxVec3& origin, bool useSimd) +{ + VolumeIntegratorEberly v(mesh, PxF64(density)); + if(useSimd) + return v.computeVolumeIntegralsSIMD(integrals, origin); + else + return v.computeVolumeIntegrals(integrals, origin); +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.h new file mode 100644 index 0000000..bfb97e1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuCookingVolumeIntegration.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_VOLUME_INTEGRATION_H +#define GU_COOKING_VOLUME_INTEGRATION_H +/** \addtogroup foundation + @{ +*/ + +#include "foundation/Px.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" + +namespace physx +{ +class PxSimpleTriangleMesh; +class PxConvexMeshDesc; + +/** +\brief Data structure used to store mass properties. +*/ +struct PxIntegrals +{ + PxVec3 COM; //!< Center of mass + PxF64 mass; //!< Total mass + PxF64 inertiaTensor[3][3]; //!< Inertia tensor (mass matrix) relative to the origin + PxF64 COMInertiaTensor[3][3]; //!< Inertia tensor (mass matrix) relative to the COM + + /** + \brief Retrieve the inertia tensor relative to the center of mass. + + \param inertia Inertia tensor. + */ + void getInertia(PxMat33& inertia) + { + for(PxU32 j=0;j<3;j++) + { + for(PxU32 i=0;i<3;i++) + { + inertia(i,j) = PxF32(COMInertiaTensor[i][j]); + } + } + } + + /** + \brief Retrieve the inertia tensor relative to the origin. + + \param inertia Inertia tensor. + */ + void getOriginInertia(PxMat33& inertia) + { + for(PxU32 j=0;j<3;j++) + { + for(PxU32 i=0;i<3;i++) + { + inertia(i,j) = PxF32(inertiaTensor[i][j]); + } + } + } + }; + + bool computeVolumeIntegrals(const PxSimpleTriangleMesh& mesh, PxReal density, PxIntegrals& integrals); + + // specialized method taking polygons directly, so we don't need to compute and store triangles for each polygon + bool computeVolumeIntegralsEberly(const PxConvexMeshDesc& mesh, PxReal density, PxIntegrals& integrals, const PxVec3& origin, bool useSimd); // Eberly simplified method +} + + /** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp new file mode 100644 index 0000000..404a745 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.cpp @@ -0,0 +1,970 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "foundation/PxMemory.h" +#include "common/PxTolerancesScale.h" + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxSort.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxInlineArray.h" +#include "GuRTree.h" +#include "GuRTreeCooking.h" + +#define PRINT_RTREE_COOKING_STATS 0 // AP: keeping this frequently used macro for diagnostics/benchmarking + +#if PRINT_RTREE_COOKING_STATS +#include +#endif + +using namespace physx::Gu; +using namespace physx::aos; + +namespace physx +{ + +// Google "wikipedia QuickSelect" for algorithm explanation +namespace quickSelect { + + #define SWAP32(x, y) { PxU32 tmp = y; y = x; x = tmp; } + + // left is the index of the leftmost element of the subarray + // right is the index of the rightmost element of the subarray (inclusive) + // number of elements in subarray = right-left+1 + template + PxU32 partition(PxU32* PX_RESTRICT a, PxU32 left, PxU32 right, PxU32 pivotIndex, const LtEq& cmpLtEq) + { + PX_ASSERT(pivotIndex >= left && pivotIndex <= right); + PxU32 pivotValue = a[pivotIndex]; + SWAP32(a[pivotIndex], a[right]) // Move pivot to end + PxU32 storeIndex = left; + for (PxU32 i = left; i < right; i++) // left <= i < right + if (cmpLtEq(a[i], pivotValue)) + { + SWAP32(a[i], a[storeIndex]); + storeIndex++; + } + SWAP32(a[storeIndex], a[right]); // Move pivot to its final place + for (PxU32 i = left; i < storeIndex; i++) + PX_ASSERT(cmpLtEq(a[i], a[storeIndex])); + for (PxU32 i = storeIndex+1; i <= right; i++) + PX_ASSERT(cmpLtEq(a[storeIndex], a[i])); + return storeIndex; + } + + // left is the index of the leftmost element of the subarray + // right is the index of the rightmost element of the subarray (inclusive) + // number of elements in subarray = right-left+1 + // recursive version + template + void quickFindFirstK(PxU32* PX_RESTRICT a, PxU32 left, PxU32 right, PxU32 k, const LtEq& cmpLtEq) + { + PX_ASSERT(k <= right-left+1); + if (right > left) + { + // select pivotIndex between left and right + PxU32 pivotIndex = (left + right) >> 1; + PxU32 pivotNewIndex = partition(a, left, right, pivotIndex, cmpLtEq); + // now all elements to the left of pivotNewIndex are < old value of a[pivotIndex] (bottom half values) + if (pivotNewIndex > left + k) // new condition + quickFindFirstK(a, left, pivotNewIndex-1, k, cmpLtEq); + if (pivotNewIndex < left + k) + quickFindFirstK(a, pivotNewIndex+1, right, k+left-pivotNewIndex-1, cmpLtEq); + } + } + + // non-recursive version + template + void quickSelectFirstK(PxU32* PX_RESTRICT a, PxU32 left, PxU32 right, PxU32 k, const LtEq& cmpLtEq) + { + PX_ASSERT(k <= right-left+1); + for (;;) + { + PxU32 pivotIndex = (left+right) >> 1; + PxU32 pivotNewIndex = partition(a, left, right, pivotIndex, cmpLtEq); + PxU32 pivotDist = pivotNewIndex - left + 1; + if (pivotDist == k) + return; + else if (k < pivotDist) + { + PX_ASSERT(pivotNewIndex > 0); + right = pivotNewIndex - 1; + } + else + { + k = k - pivotDist; + left = pivotNewIndex+1; + } + } + } + +} // namespace quickSelect + +// Intermediate non-quantized representation for RTree node in a page (final format is SIMD transposed page) +struct RTreeNodeNQ +{ + PxBounds3 bounds; + PxI32 childPageFirstNodeIndex; // relative to the beginning of all build tree nodes array + PxI32 leafCount; // -1 for empty nodes, 0 for non-terminal nodes, number of enclosed tris if non-zero (LeafTriangles), also means a terminal node + + struct U {}; // selector struct for uninitialized constructor + RTreeNodeNQ(U) {} // uninitialized constructor + RTreeNodeNQ() : bounds(PxBounds3::empty()), childPageFirstNodeIndex(-1), leafCount(0) {} +}; + +// SIMD version of bounds class +struct PxBounds3V +{ + struct U {}; // selector struct for uninitialized constructor + Vec3V mn, mx; + PxBounds3V(Vec3VArg mn_, Vec3VArg mx_) : mn(mn_), mx(mx_) {} + PxBounds3V(U) {} // uninitialized constructor + + PX_FORCE_INLINE Vec3V getExtents() const { return V3Sub(mx, mn); } + PX_FORCE_INLINE void include(const PxBounds3V& other) { mn = V3Min(mn, other.mn); mx = V3Max(mx, other.mx); } + + // convert vector extents to PxVec3 + PX_FORCE_INLINE const PxVec3 getMinVec3() const { PxVec3 ret; V3StoreU(mn, ret); return ret; } + PX_FORCE_INLINE const PxVec3 getMaxVec3() const { PxVec3 ret; V3StoreU(mx, ret); return ret; } +}; + +static void buildFromBounds( + Gu::RTree& resultTree, const PxBounds3V* allBounds, PxU32 numBounds, + PxArray& resultPermute, RTreeCooker::RemapCallback* rc, Vec3VArg allMn, Vec3VArg allMx, + PxReal sizePerfTradeOff, PxMeshCookingHint::Enum hint); + +///////////////////////////////////////////////////////////////////////// +void RTreeCooker::buildFromTriangles( + Gu::RTree& result, const PxVec3* verts, PxU32 numVerts, const PxU16* tris16, const PxU32* tris32, PxU32 numTris, + PxArray& resultPermute, RTreeCooker::RemapCallback* rc, PxReal sizePerfTradeOff01, PxMeshCookingHint::Enum hint) +{ + PX_UNUSED(numVerts); + PxArray allBounds; + allBounds.reserve(numTris); + Vec3V allMn = Vec3V_From_FloatV(FMax()), allMx = Vec3V_From_FloatV(FNegMax()); + Vec3V eps = V3Splat(FLoad(5e-4f)); // AP scaffold: use PxTolerancesScale here? + + // build RTree AABB bounds from triangles, conservative bound inflation is also performed here + for(PxU32 i = 0; i < numTris; i ++) + { + PxU32 i0, i1, i2; + PxU32 i3 = i*3; + if(tris16) + { + i0 = tris16[i3]; i1 = tris16[i3+1]; i2 = tris16[i3+2]; + } else + { + i0 = tris32[i3]; i1 = tris32[i3+1]; i2 = tris32[i3+2]; + } + PX_ASSERT_WITH_MESSAGE(i0 < numVerts && i1 < numVerts && i2 < numVerts ,"Input mesh triangle's vertex index exceeds specified numVerts."); + Vec3V v0 = V3LoadU(verts[i0]), v1 = V3LoadU(verts[i1]), v2 = V3LoadU(verts[i2]); + Vec3V mn = V3Sub(V3Min(V3Min(v0, v1), v2), eps); // min over 3 verts, subtract eps to inflate + Vec3V mx = V3Add(V3Max(V3Max(v0, v1), v2), eps); // max over 3 verts, add eps to inflate + allMn = V3Min(allMn, mn); allMx = V3Max(allMx, mx); + allBounds.pushBack(PxBounds3V(mn, mx)); + } + + buildFromBounds(result, allBounds.begin(), numTris, resultPermute, rc, allMn, allMx, sizePerfTradeOff01, hint); +} + +///////////////////////////////////////////////////////////////////////// +// Fast but lower quality 4-way split sorting using repeated application of quickselect + +// comparator template struct for sortin gbounds centers given a coordinate index (x,y,z=0,1,2) +struct BoundsLTE +{ + PxU32 coordIndex; + const PxVec3* PX_RESTRICT boundCenters; // AP: precomputed centers are faster than recomputing the centers + BoundsLTE(PxU32 coordIndex_, const PxVec3* boundCenters_) + : coordIndex(coordIndex_), boundCenters(boundCenters_) + {} + + PX_FORCE_INLINE bool operator()(const PxU32 & idx1, const PxU32 & idx2) const + { + PxF32 center1 = boundCenters[idx1][coordIndex]; + PxF32 center2 = boundCenters[idx2][coordIndex]; + return (center1 <= center2); + } +}; + +// ====================================================================== +// Quick sorting method +// recursive sorting procedure: +// 1. find min and max extent along each axis for the current cluster +// 2. split input cluster into two 3 times using quickselect, splitting off a quarter of the initial cluster size each time +// 3. the axis is potentialy different for each split using the following +// approximate splitting heuristic - reduce max length by some estimated factor to encourage split along other axis +// since we cut off between a quarter to a half of elements in this direction per split +// the reduction for first split should be *0.75f but we use 0.8 +// to account for some node overlap. This is somewhat of an arbitrary choice and there's room for improvement. +// 4. recurse on new clusters (goto step 1) +// +struct SubSortQuick +{ + static const PxReal reductionFactors[RTREE_N-1]; + + enum { NTRADEOFF = 9 }; + static const PxU32 stopAtTrisPerLeaf1[NTRADEOFF]; // presets for PxCookingParams::meshSizePerformanceTradeoff implementation + + const PxU32* permuteEnd; + const PxU32* permuteStart; + const PxBounds3V* allBounds; + PxArray boundCenters; + PxU32 maxBoundsPerLeafPage; + + // initialize the context for the sorting routine + SubSortQuick(PxU32* permute, const PxBounds3V* allBounds_, PxU32 allBoundsSize, PxReal sizePerfTradeOff01) + : allBounds(allBounds_) + { + permuteEnd = permute + allBoundsSize; + permuteStart = permute; + PxU32 boundsCount = allBoundsSize; + boundCenters.reserve(boundsCount); // AP - measured that precomputing centers helps with perf significantly (~20% on 1k verts) + for(PxU32 i = 0; i < boundsCount; i++) + boundCenters.pushBack( allBounds[i].getMinVec3() + allBounds[i].getMaxVec3() ); + PxU32 iTradeOff = PxMin( PxU32(PxMax(0.0f, sizePerfTradeOff01)*NTRADEOFF), NTRADEOFF-1 ); + maxBoundsPerLeafPage = stopAtTrisPerLeaf1[iTradeOff]; + } + + // implements the sorting/splitting procedure + void sort4( + PxU32* PX_RESTRICT permute, const PxU32 clusterSize, // beginning and size of current recursively processed cluster + PxArray& resultTree, PxU32& maxLevels, + PxBounds3V& subTreeBound, PxU32 level = 0) + { + if(level == 0) + maxLevels = 1; + else + maxLevels = PxMax(maxLevels, level+1); + + PX_ASSERT(permute + clusterSize <= permuteEnd); + PX_ASSERT(maxBoundsPerLeafPage >= RTREE_N-1); + + const PxU32 cluster4 = PxMax(clusterSize/RTREE_N, 1); + + PX_ASSERT(clusterSize > 0); + // find min and max world bound for current cluster + Vec3V mx = allBounds[permute[0]].mx, mn = allBounds[permute[0]].mn; PX_ASSERT(permute[0] < boundCenters.size()); + for(PxU32 i = 1; i < clusterSize; i ++) + { + PX_ASSERT(permute[i] < boundCenters.size()); + mx = V3Max(mx, allBounds[permute[i]].mx); + mn = V3Min(mn, allBounds[permute[i]].mn); + } + PX_ALIGN_PREFIX(16) PxReal maxElem[4] PX_ALIGN_SUFFIX(16); + V3StoreA(V3Sub(mx, mn), *reinterpret_cast(maxElem)); // compute the dimensions and store into a scalar maxElem array + + // split along the longest axis + const PxU32 maxDiagElement = PxU32(maxElem[0] > maxElem[1] && maxElem[0] > maxElem[2] ? 0 : (maxElem[1] > maxElem[2] ? 1 : 2)); + BoundsLTE cmpLte(maxDiagElement, boundCenters.begin()); + + const PxU32 startNodeIndex = resultTree.size(); + resultTree.resizeUninitialized(startNodeIndex+RTREE_N); // at each recursion level we add 4 nodes to the tree + + PxBounds3V childBound( (PxBounds3V::U()) ); // start off uninitialized for performance + const PxI32 leftover = PxMax(PxI32(clusterSize - cluster4*(RTREE_N-1)), 0); + PxU32 totalCount = 0; + for(PxU32 i = 0; i < RTREE_N; i++) + { + // split off cluster4 count nodes out of the entire cluster for each i + const PxU32 clusterOffset = cluster4*i; + PxU32 count1; // cluster4 or leftover depending on whether it's the last cluster + if(i < RTREE_N-1) + { + // only need to so quickSelect for the first pagesize-1 clusters + if(clusterOffset <= clusterSize-1) + { + quickSelect::quickSelectFirstK(permute, clusterOffset, clusterSize-1, cluster4, cmpLte); + // approximate heuristic - reduce max length by some estimated factor to encourage split along other axis + // since we cut off a quarter of elements in this direction the reduction should be *0.75f but we use 0.8 + // to account for some node overlap. This is somewhat of an arbitrary choice though + maxElem[cmpLte.coordIndex] *= reductionFactors[i]; + // recompute cmpLte.coordIndex from updated maxElements + cmpLte.coordIndex = PxU32(maxElem[0] > maxElem[1] && maxElem[0] > maxElem[2] ? 0 : (maxElem[1] > maxElem[2] ? 1 : 2)); + } + count1 = cluster4; + } else + { + count1 = PxU32(leftover); + // verify that leftover + sum of previous clusters adds up to clusterSize or leftover is 0 + // leftover can be 0 if clusterSize higher index = better perf +static const PxU32 NTRADEOFF = 15; + // % -24 -23 -17 -15 -10 -8 -5 -3 0 +3 +3 +5 +7 +8 +9 - % raycast MeshSurface*Random benchmark perf + // K 717 734 752 777 793 811 824 866 903 939 971 1030 1087 1139 1266 - testzone size in K + // # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - preset number +static const PxU32 stopAtTrisPerPage[NTRADEOFF] = { 64, 60, 56, 48, 46, 44, 40, 36, 32, 28, 24, 20, 16, 12, 12}; +static const PxU32 stopAtTrisPerLeaf[NTRADEOFF] = { 16, 14, 12, 10, 9, 8, 8, 6, 5, 5, 5, 4, 4, 4, 2}; // capped at 2 anyway + +///////////////////////////////////////////////////////////////////////// +// comparator struct for sorting the bounds along a specified coordIndex (coordIndex=0,1,2 for X,Y,Z) +struct SortBoundsPredicate +{ + PxU32 coordIndex; + const PxBounds3V* allBounds; + SortBoundsPredicate(PxU32 coordIndex_, const PxBounds3V* allBounds_) : coordIndex(coordIndex_), allBounds(allBounds_) + {} + + bool operator()(const PxU32 & idx1, const PxU32 & idx2) const + { + // using the bounds center for comparison + PxF32 center1 = V3ReadXYZ(allBounds[idx1].mn)[coordIndex] + V3ReadXYZ(allBounds[idx1].mx)[coordIndex]; + PxF32 center2 = V3ReadXYZ(allBounds[idx2].mn)[coordIndex] + V3ReadXYZ(allBounds[idx2].mx)[coordIndex]; + return (center1 < center2); + } +}; + + +///////////////////////////////////////////////////////////////////////// +// auxiliary class for SAH build (SAH = surface area heuristic) +struct Interval +{ + PxU32 start, count; + Interval(PxU32 s, PxU32 c) : start(s), count(c) {} +}; + +// SAH function - returns surface area for given AABB extents +static PX_FORCE_INLINE void PxSAH(const Vec3VArg v, PxF32& sah) +{ + FStore(V3Dot(v, V3PermZXY(v)), &sah); // v.x*v.y + v.y*v.z + v.x*v.z; +} + +struct SubSortSAH +{ + PxU32* PX_RESTRICT permuteStart, *PX_RESTRICT tempPermute; + const PxBounds3V* PX_RESTRICT allBounds; + PxF32* PX_RESTRICT metricL; + PxF32* PX_RESTRICT metricR; + const PxU32* PX_RESTRICT xOrder, *PX_RESTRICT yOrder, *PX_RESTRICT zOrder; + const PxU32* PX_RESTRICT xRanks, *PX_RESTRICT yRanks, *PX_RESTRICT zRanks; + PxU32* PX_RESTRICT tempRanks; + PxU32 nbTotalBounds; + PxU32 iTradeOff; + + // precompute various values used during sort + SubSortSAH( + PxU32* permute, const PxBounds3V* allBounds_, PxU32 numBounds, + const PxU32* xOrder_, const PxU32* yOrder_, const PxU32* zOrder_, + const PxU32* xRanks_, const PxU32* yRanks_, const PxU32* zRanks_, PxReal sizePerfTradeOff01) + : permuteStart(permute), allBounds(allBounds_), + xOrder(xOrder_), yOrder(yOrder_), zOrder(zOrder_), + xRanks(xRanks_), yRanks(yRanks_), zRanks(zRanks_), nbTotalBounds(numBounds) + { + metricL = PX_ALLOCATE(PxF32, numBounds, "metricL"); + metricR = PX_ALLOCATE(PxF32, numBounds, "metricR"); + tempPermute = PX_ALLOCATE(PxU32, (numBounds*2+1), "tempPermute"); + tempRanks = PX_ALLOCATE(PxU32, numBounds, "tempRanks"); + iTradeOff = PxMin( PxU32(PxMax(0.0f, sizePerfTradeOff01)*NTRADEOFF), NTRADEOFF-1 ); + } + + ~SubSortSAH() // release temporarily used memory + { + PX_FREE(metricL); + PX_FREE(metricR); + PX_FREE(tempPermute); + PX_FREE(tempRanks); + } + + //////////////////////////////////////////////////////////////////// + // returns split position for second array start relative to permute ptr + PxU32 split(PxU32* permute, PxU32 clusterSize) + { + if(clusterSize <= 1) + return 0; + if(clusterSize == 2) + return 1; + + PxI32 minCount = clusterSize >= 4 ? 2 : 1; + PxI32 splitStartL = minCount; // range=[startL->endL) + PxI32 splitEndL = PxI32(clusterSize-minCount); + PxI32 splitStartR = PxI32(clusterSize-splitStartL); // range=(endR<-startR], startR > endR + PxI32 splitEndR = PxI32(clusterSize-splitEndL); + PX_ASSERT(splitEndL-splitStartL == splitStartR-splitEndR); + PX_ASSERT(splitStartL <= splitEndL); + PX_ASSERT(splitStartR >= splitEndR); + PX_ASSERT(splitEndR >= 1); + PX_ASSERT(splitEndL < PxI32(clusterSize)); + + // pick the best axis with some splitting metric + // axis index is X=0, Y=1, Z=2 + PxF32 minMetric[3]; + PxU32 minMetricSplit[3]; + const PxU32* ranks3[3] = { xRanks, yRanks, zRanks }; + const PxU32* orders3[3] = { xOrder, yOrder, zOrder }; + for(PxU32 coordIndex = 0; coordIndex <= 2; coordIndex++) + { + SortBoundsPredicate sortPredicateLR(coordIndex, allBounds); + + const PxU32* rank = ranks3[coordIndex]; + const PxU32* order = orders3[coordIndex]; + + // build ranks in tempPermute + if(clusterSize == nbTotalBounds) // AP: about 4% perf gain from this optimization + { + // if this is a full cluster sort, we already have it done + for(PxU32 i = 0; i < clusterSize; i ++) + tempPermute[i] = order[i]; + } else + { + // sort the tempRanks + for(PxU32 i = 0; i < clusterSize; i ++) + tempRanks[i] = rank[permute[i]]; + PxSort(tempRanks, clusterSize); + for(PxU32 i = 0; i < clusterSize; i ++) // convert back from ranks to indices + tempPermute[i] = order[tempRanks[i]]; + } + + // we consider overlapping intervals for minimum sum of metrics + // left interval is from splitStartL up to splitEndL + // right interval is from splitStartR down to splitEndR + + + // first compute the array metricL + Vec3V boundsLmn = allBounds[tempPermute[0]].mn; // init with 0th bound + Vec3V boundsLmx = allBounds[tempPermute[0]].mx; // init with 0th bound + PxI32 ii; + for(ii = 1; ii < splitStartL; ii++) // sweep right to include all bounds up to splitStartL-1 + { + boundsLmn = V3Min(boundsLmn, allBounds[tempPermute[ii]].mn); + boundsLmx = V3Max(boundsLmx, allBounds[tempPermute[ii]].mx); + } + + PxU32 countL0 = 0; + for(ii = splitStartL; ii <= splitEndL; ii++) // compute metric for inclusive bounds from splitStartL to splitEndL + { + boundsLmn = V3Min(boundsLmn, allBounds[tempPermute[ii]].mn); + boundsLmx = V3Max(boundsLmx, allBounds[tempPermute[ii]].mx); + PxSAH(V3Sub(boundsLmx, boundsLmn), metricL[countL0++]); + } + // now we have metricL + + // now compute the array metricR + Vec3V boundsRmn = allBounds[tempPermute[clusterSize-1]].mn; // init with last bound + Vec3V boundsRmx = allBounds[tempPermute[clusterSize-1]].mx; // init with last bound + for(ii = PxI32(clusterSize-2); ii > splitStartR; ii--) // include bounds to the left of splitEndR down to splitStartR + { + boundsRmn = V3Min(boundsRmn, allBounds[tempPermute[ii]].mn); + boundsRmx = V3Max(boundsRmx, allBounds[tempPermute[ii]].mx); + } + + PxU32 countR0 = 0; + for(ii = splitStartR; ii >= splitEndR; ii--) // continue sweeping left, including bounds and recomputing the metric + { + boundsRmn = V3Min(boundsRmn, allBounds[tempPermute[ii]].mn); + boundsRmx = V3Max(boundsRmx, allBounds[tempPermute[ii]].mx); + PxSAH(V3Sub(boundsRmx, boundsRmn), metricR[countR0++]); + } + + PX_ASSERT((countL0 == countR0) && (countL0 == PxU32(splitEndL-splitStartL+1))); + + // now iterate over splitRange and compute the minimum sum of SAHLeft*countLeft + SAHRight*countRight + PxU32 minMetricSplitPosition = 0; + PxF32 minMetricLocal = PX_MAX_REAL; + const PxI32 hsI32 = PxI32(clusterSize/2); + const PxI32 splitRange = (splitEndL-splitStartL+1); + for(ii = 0; ii < splitRange; ii++) + { + PxF32 countL = PxF32(ii+minCount); // need to add minCount since ii iterates over splitRange + PxF32 countR = PxF32(splitRange-ii-1+minCount); + PX_ASSERT(PxU32(countL + countR) == clusterSize); + + const PxF32 metric = (countL*metricL[ii] + countR*metricR[splitRange-ii-1]); + const PxU32 splitPos = PxU32(ii+splitStartL); + if(metric < minMetricLocal || + (metric <= minMetricLocal && // same metric but more even split + PxAbs(PxI32(splitPos)-hsI32) < PxAbs(PxI32(minMetricSplitPosition)-hsI32))) + { + minMetricLocal = metric; + minMetricSplitPosition = splitPos; + } + } + + minMetric[coordIndex] = minMetricLocal; + minMetricSplit[coordIndex] = minMetricSplitPosition; + + // sum of axis lengths for both left and right AABBs + } + + PxU32 winIndex = 2; + if(minMetric[0] <= minMetric[1] && minMetric[0] <= minMetric[2]) + winIndex = 0; + else if(minMetric[1] <= minMetric[2]) + winIndex = 1; + + const PxU32* rank = ranks3[winIndex]; + const PxU32* order = orders3[winIndex]; + if(clusterSize == nbTotalBounds) // AP: about 4% gain from this special case optimization + { + // if this is a full cluster sort, we already have it done + for(PxU32 i = 0; i < clusterSize; i ++) + permute[i] = order[i]; + } else + { + // sort the tempRanks + for(PxU32 i = 0; i < clusterSize; i ++) + tempRanks[i] = rank[permute[i]]; + PxSort(tempRanks, clusterSize); + for(PxU32 i = 0; i < clusterSize; i ++) + permute[i] = order[tempRanks[i]]; + } + + PxU32 splitPoint = minMetricSplit[winIndex]; + if(clusterSize == 3 && splitPoint == 0) + splitPoint = 1; // special case due to rounding + return splitPoint; + } + + // compute surface area for a given split + PxF32 computeSA(const PxU32* permute, const Interval& split) // both permute and i are relative + { + PX_ASSERT(split.count >= 1); + Vec3V bmn = allBounds[permute[split.start]].mn; + Vec3V bmx = allBounds[permute[split.start]].mx; + for(PxU32 i = 1; i < split.count; i++) + { + const PxBounds3V& b1 = allBounds[permute[split.start+i]]; + bmn = V3Min(bmn, b1.mn); bmx = V3Max(bmx, b1.mx); + } + + PxF32 ret; PxSAH(V3Sub(bmx, bmn), ret); + return ret; + } + + //////////////////////////////////////////////////////////////////// + // main SAH sort routine + void sort4(PxU32* permute, PxU32 clusterSize, + PxArray& resultTree, PxU32& maxLevels, PxU32 level = 0, RTreeNodeNQ* parentNode = NULL) + { + PX_UNUSED(parentNode); + + if(level == 0) + maxLevels = 1; + else + maxLevels = PxMax(maxLevels, level+1); + + PxU32 splitPos[RTREE_N]; + for(PxU32 j = 0; j < RTREE_N; j++) + splitPos[j] = j+1; + + if(clusterSize >= RTREE_N) + { + // split into RTREE_N number of regions via RTREE_N-1 subsequent splits + // each split is represented as a current interval + // we iterate over currently active intervals and compute it's surface area + // then we split the interval with maximum surface area + // AP scaffold: possible optimization - seems like computeSA can be cached for unchanged intervals + PxInlineArray splits; + splits.pushBack(Interval(0, clusterSize)); + for(PxU32 iSplit = 0; iSplit < RTREE_N-1; iSplit++) + { + PxF32 maxSAH = -FLT_MAX; + PxU32 maxSplit = 0xFFFFffff; + for(PxU32 i = 0; i < splits.size(); i++) + { + if(splits[i].count == 1) + continue; + PxF32 SAH = computeSA(permute, splits[i])*splits[i].count; + if(SAH > maxSAH) + { + maxSAH = SAH; + maxSplit = i; + } + } + PX_ASSERT(maxSplit != 0xFFFFffff); + + // maxSplit is now the index of the interval in splits array with maximum surface area + // we now split it into 2 using the split() function + Interval old = splits[maxSplit]; + PX_ASSERT(old.count > 1); + PxU32 splitLocal = split(permute+old.start, old.count); // relative split pos + + PX_ASSERT(splitLocal >= 1); + PX_ASSERT(old.count-splitLocal >= 1); + splits.pushBack(Interval(old.start, splitLocal)); + splits.pushBack(Interval(old.start+splitLocal, old.count-splitLocal)); + splits.replaceWithLast(maxSplit); + splitPos[iSplit] = old.start+splitLocal; + } + + // verification code, make sure split counts add up to clusterSize + PX_ASSERT(splits.size() == RTREE_N); + PxU32 sum = 0; + PX_UNUSED(sum); + for(PxU32 j = 0; j < RTREE_N; j++) + sum += splits[j].count; + PX_ASSERT(sum == clusterSize); + } + else // clusterSize < RTREE_N + { + // make it so splitCounts based on splitPos add up correctly for small cluster sizes + for(PxU32 i = clusterSize; i < RTREE_N-1; i++) + splitPos[i] = clusterSize; + } + + // sort splitPos index array using quicksort (just a few values) + PxSort(splitPos, RTREE_N-1); + splitPos[RTREE_N-1] = clusterSize; // splitCount[n] is computed as splitPos[n+1]-splitPos[n], so we need to add this last value + + // now compute splitStarts and splitCounts from splitPos[] array. Also perform a bunch of correctness verification + PxU32 splitStarts[RTREE_N]; + PxU32 splitCounts[RTREE_N]; + splitStarts[0] = 0; + splitCounts[0] = splitPos[0]; + PxU32 sumCounts = splitCounts[0]; + PX_UNUSED(sumCounts); + for(PxU32 j = 1; j < RTREE_N; j++) + { + splitStarts[j] = splitPos[j-1]; + PX_ASSERT(splitStarts[j-1]<=splitStarts[j]); + splitCounts[j] = splitPos[j]-splitPos[j-1]; + PX_ASSERT(splitCounts[j] > 0 || clusterSize < RTREE_N); + sumCounts += splitCounts[j]; + PX_ASSERT(splitStarts[j-1]+splitCounts[j-1]<=splitStarts[j]); + } + PX_ASSERT(sumCounts == clusterSize); + PX_ASSERT(splitStarts[RTREE_N-1]+splitCounts[RTREE_N-1]<=clusterSize); + + // mark this cluster as terminal based on clusterSize <= stopAtTrisPerPage parameter for current iTradeOff user specified preset + bool terminalClusterByTotalCount = (clusterSize <= stopAtTrisPerPage[iTradeOff]); + // iterate over splitCounts for the current cluster, if any of counts exceed 16 (which is the maximum supported by LeafTriangles + // we cannot mark this cluster as terminal (has to be split more) + for(PxU32 s = 0; s < RTREE_N; s++) + if(splitCounts[s] > 16) // LeafTriangles doesn't support > 16 tris + terminalClusterByTotalCount = false; + + // iterate over all the splits + for(PxU32 s = 0; s < RTREE_N; s++) + { + RTreeNodeNQ rtn; + PxU32 splitCount = splitCounts[s]; + if(splitCount > 0) // splits shouldn't be empty generally + { + // sweep left to right and compute min and max SAH for each individual bound in current split + PxBounds3V b = allBounds[permute[splitStarts[s]]]; + PxF32 sahMin; PxSAH(b.getExtents(), sahMin); + PxF32 sahMax = sahMin; + // AP scaffold - looks like this could be optimized (we are recomputing bounds top down) + for(PxU32 i = 1; i < splitCount; i++) + { + PxU32 localIndex = i + splitStarts[s]; + const PxBounds3V& b1 = allBounds[permute[localIndex]]; + PxF32 sah1; PxSAH(b1.getExtents(), sah1); + sahMin = PxMin(sahMin, sah1); + sahMax = PxMax(sahMax, sah1); + b.include(b1); + } + + rtn.bounds.minimum = V3ReadXYZ(b.mn); + rtn.bounds.maximum = V3ReadXYZ(b.mx); + + // if bounds differ widely (according to some heuristic preset), we continue splitting + // this is important for a mixed cluster with large and small triangles + bool okSAH = (sahMax/sahMin < 40.0f); + if(!okSAH) + terminalClusterByTotalCount = false; // force splitting this cluster + + bool stopSplitting = // compute the final splitting criterion + splitCount <= 2 || (okSAH && splitCount <= 3) // stop splitting at 2 nodes or if SAH ratio is OK and splitCount <= 3 + || terminalClusterByTotalCount || splitCount <= stopAtTrisPerLeaf[iTradeOff]; + if(stopSplitting) + { + // this is a terminal page then, mark as such + // first node index is relative to the top level input array beginning + rtn.childPageFirstNodeIndex = PxI32(splitStarts[s]+(permute-permuteStart)); + rtn.leafCount = PxI32(splitCount); + PX_ASSERT(splitCount <= 16); // LeafTriangles doesn't support more + } + else + { + // this is not a terminal page, we will recompute this later, after we recurse on subpages (label ZZZ) + rtn.childPageFirstNodeIndex = -1; + rtn.leafCount = 0; + } + } + else // splitCount == 0 at this point, this is an empty paddding node (with current presets it's very rare) + { + PX_ASSERT(splitCount == 0); + rtn.bounds.setEmpty(); + rtn.childPageFirstNodeIndex = -1; + rtn.leafCount = -1; + } + resultTree.pushBack(rtn); // push the new node into the resultTree array + } + + if(terminalClusterByTotalCount) // abort recursion if terminal cluster + return; + + // recurse on subpages + PxU32 parentIndex = resultTree.size() - RTREE_N; // save the parentIndex as specified (array can be resized during recursion) + for(PxU32 s = 0; sleafCount == 0) // only split pages that were marked as non-terminal during splitting (see "label ZZZ" above) + { + // all child nodes will be pushed inside of this recursive call, + // so we set the child pointer for parent node to resultTree.size() + sParent->childPageFirstNodeIndex = PxI32(resultTree.size()); + sort4(permute+splitStarts[s], splitCounts[s], resultTree, maxLevels, level+1, sParent); + } + } + } +}; + + + + +///////////////////////////////////////////////////////////////////////// +// initializes the input permute array with identity permutation +// and shuffles it so that new sorted index, newIndex = resultPermute[oldIndex] +static void buildFromBounds( + Gu::RTree& result, const PxBounds3V* allBounds, PxU32 numBounds, + PxArray& permute, RTreeCooker::RemapCallback* rc, Vec3VArg allMn, Vec3VArg allMx, + PxReal sizePerfTradeOff01, PxMeshCookingHint::Enum hint) +{ + PX_UNUSED(sizePerfTradeOff01); + PxBounds3V treeBounds(allMn, allMx); + + // start off with an identity permutation + permute.resize(0); + permute.reserve(numBounds+1); + for(PxU32 j = 0; j < numBounds; j ++) + permute.pushBack(j); + const PxU32 sentinel = 0xABCDEF01; + permute.pushBack(sentinel); + + // load sorted nodes into an RTreeNodeNQ tree representation + // build the tree structure from sorted nodes + const PxU32 pageSize = RTREE_N; + PxArray resultTree; + resultTree.reserve(numBounds*2); + + PxU32 maxLevels = 0; + if(hint == PxMeshCookingHint::eSIM_PERFORMANCE) // use high quality SAH build + { + PxArray xRanks(numBounds), yRanks(numBounds), zRanks(numBounds), xOrder(numBounds), yOrder(numBounds), zOrder(numBounds); + PxMemCopy(xOrder.begin(), permute.begin(), sizeof(xOrder[0])*numBounds); + PxMemCopy(yOrder.begin(), permute.begin(), sizeof(yOrder[0])*numBounds); + PxMemCopy(zOrder.begin(), permute.begin(), sizeof(zOrder[0])*numBounds); + // sort by shuffling the permutation, precompute sorted ranks for x,y,z-orders + PxSort(xOrder.begin(), xOrder.size(), SortBoundsPredicate(0, allBounds)); + for(PxU32 i = 0; i < numBounds; i++) xRanks[xOrder[i]] = i; + PxSort(yOrder.begin(), yOrder.size(), SortBoundsPredicate(1, allBounds)); + for(PxU32 i = 0; i < numBounds; i++) yRanks[yOrder[i]] = i; + PxSort(zOrder.begin(), zOrder.size(), SortBoundsPredicate(2, allBounds)); + for(PxU32 i = 0; i < numBounds; i++) zRanks[zOrder[i]] = i; + + SubSortSAH ss(permute.begin(), allBounds, numBounds, + xOrder.begin(), yOrder.begin(), zOrder.begin(), xRanks.begin(), yRanks.begin(), zRanks.begin(), sizePerfTradeOff01); + ss.sort4(permute.begin(), numBounds, resultTree, maxLevels); + } else + { // use fast cooking path + PX_ASSERT(hint == PxMeshCookingHint::eCOOKING_PERFORMANCE); + SubSortQuick ss(permute.begin(), allBounds, numBounds, sizePerfTradeOff01); + PxBounds3V discard((PxBounds3V::U())); + ss.sort4(permute.begin(), permute.size()-1, resultTree, maxLevels, discard); // AP scaffold: need to implement build speed/runtime perf slider + } + + PX_ASSERT(permute[numBounds] == sentinel); // verify we didn't write past the array + permute.popBack(); // discard the sentinel value + + #if PRINT_RTREE_COOKING_STATS // stats code + PxU32 totalLeafTris = 0; + PxU32 numLeaves = 0; + PxI32 maxLeafTris = 0; + PxU32 numEmpty = 0; + for(PxU32 i = 0; i < resultTree.size(); i++) + { + PxI32 leafCount = resultTree[i].leafCount; + numEmpty += (resultTree[i].bounds.isEmpty()); + if(leafCount > 0) + { + numLeaves++; + totalLeafTris += leafCount; + if(leafCount > maxLeafTris) + maxLeafTris = leafCount; + } + } + + printf("AABBs total/empty=%d/%d\n", resultTree.size(), numEmpty); + printf("numTris=%d, numLeafAABBs=%d, avgTrisPerLeaf=%.2f, maxTrisPerLeaf = %d\n", + numBounds, numLeaves, PxF32(totalLeafTris)/numLeaves, maxLeafTris); + #endif + + PX_ASSERT(RTREE_N*sizeof(RTreeNodeQ) == sizeof(RTreePage)); // needed for nodePtrMultiplier computation to be correct + const int nodePtrMultiplier = sizeof(RTreeNodeQ); // convert offset as count in qnodes to page ptr + + // Quantize the tree. AP scaffold - might be possible to merge this phase with the page pass below this loop + PxArray qtreeNodes; + PxU32 firstEmptyIndex = PxU32(-1); + PxU32 resultCount = resultTree.size(); + qtreeNodes.reserve(resultCount); + + for(PxU32 i = 0; i < resultCount; i++) // AP scaffold - eliminate this pass + { + RTreeNodeNQ & u = resultTree[i]; + RTreeNodeQ q; + q.setLeaf(u.leafCount > 0); // set the leaf flag + if(u.childPageFirstNodeIndex == -1) // empty node? + { + if(firstEmptyIndex == PxU32(-1)) + firstEmptyIndex = qtreeNodes.size(); + q.minx = q.miny = q.minz = FLT_MAX; // AP scaffold improvement - use empty 1e30 bounds instead and reference a valid leaf + q.maxx = q.maxy = q.maxz = -FLT_MAX; // that will allow to remove the empty node test from the runtime + + q.ptr = firstEmptyIndex*nodePtrMultiplier; PX_ASSERT((q.ptr & 1) == 0); + q.setLeaf(true); // label empty node as leaf node + } else + { + // non-leaf node + q.minx = u.bounds.minimum.x; + q.miny = u.bounds.minimum.y; + q.minz = u.bounds.minimum.z; + q.maxx = u.bounds.maximum.x; + q.maxy = u.bounds.maximum.y; + q.maxz = u.bounds.maximum.z; + if(u.leafCount > 0) + { + q.ptr = PxU32(u.childPageFirstNodeIndex); + rc->remap(&q.ptr, q.ptr, PxU32(u.leafCount)); + PX_ASSERT(q.isLeaf()); // remap is expected to set the isLeaf bit + } + else + { + // verify that all children bounds are included in the parent bounds + for(PxU32 s = 0; s < RTREE_N; s++) + { + const RTreeNodeNQ& child = resultTree[u.childPageFirstNodeIndex+s]; + PX_UNUSED(child); + // is a sentinel node or is inside parent's bounds + PX_ASSERT(child.leafCount == -1 || child.bounds.isInside(u.bounds)); + } + + q.ptr = PxU32(u.childPageFirstNodeIndex * nodePtrMultiplier); + PX_ASSERT(q.ptr % RTREE_N == 0); + q.setLeaf(false); + } + } + qtreeNodes.pushBack(q); + } + + // build the final rtree image + result.mInvDiagonal = PxVec4(1.0f); + PX_ASSERT(qtreeNodes.size() % RTREE_N == 0); + result.mTotalNodes = qtreeNodes.size(); + result.mTotalPages = result.mTotalNodes / pageSize; + result.mPages = static_cast( + PxAlignedAllocator<128>().allocate(sizeof(RTreePage)*result.mTotalPages, PX_FL)); + result.mBoundsMin = PxVec4(V3ReadXYZ(treeBounds.mn), 0.0f); + result.mBoundsMax = PxVec4(V3ReadXYZ(treeBounds.mx), 0.0f); + result.mDiagonalScaler = (result.mBoundsMax - result.mBoundsMin) / 65535.0f; + result.mPageSize = pageSize; + result.mNumLevels = maxLevels; + PX_ASSERT(result.mTotalNodes % pageSize == 0); + result.mNumRootPages = 1; + + for(PxU32 j = 0; j < result.mTotalPages; j++) + { + RTreePage& page = result.mPages[j]; + for(PxU32 k = 0; k < RTREE_N; k ++) + { + const RTreeNodeQ& n = qtreeNodes[j*RTREE_N+k]; + page.maxx[k] = n.maxx; + page.maxy[k] = n.maxy; + page.maxz[k] = n.maxz; + page.minx[k] = n.minx; + page.miny[k] = n.miny; + page.minz[k] = n.minz; + page.ptrs[k] = n.ptr; + } + } + + //printf("Tree size=%d\n", result.mTotalPages*sizeof(RTreePage)); +#if PX_DEBUG + result.validate(); // make sure the child bounds are included in the parent and other validation +#endif +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.h new file mode 100644 index 0000000..3e1905e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/cooking/GuRTreeCooking.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_COOKING_RTREE_H +#define GU_COOKING_RTREE_H + +#include "cooking/PxCooking.h" + +#include "foundation/PxArray.h" +#include "GuMeshData.h" +#include "GuRTree.h" + +namespace physx +{ + struct RTreeCooker + { + struct RemapCallback // a callback to convert indices from triangle to LeafTriangles or other uses + { + virtual ~RemapCallback() {} + virtual void remap(PxU32* rtreePtr, PxU32 start, PxU32 leafCount) = 0; + }; + + // triangles will be remapped so that newIndex = resultPermute[oldIndex] + static void buildFromTriangles( + Gu::RTree& resultTree, const PxVec3* verts, PxU32 numVerts, const PxU16* tris16, const PxU32* tris32, PxU32 numTris, + PxArray& resultPermute, RemapCallback* rc, PxReal sizePerfTradeOff01, PxMeshCookingHint::Enum hint); + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp new file mode 100644 index 0000000..57d3b91 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.cpp @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuDistancePointBox.h" + +using namespace physx; + +PxReal Gu::distancePointBoxSquared( const PxVec3& point, + const PxVec3& boxOrigin, const PxVec3& boxExtent, const PxMat33& boxBase, + PxVec3* boxParam) +{ + // Compute coordinates of point in box coordinate system + const PxVec3 diff = point - boxOrigin; + + PxVec3 closest( boxBase.column0.dot(diff), + boxBase.column1.dot(diff), + boxBase.column2.dot(diff)); + + // Project test point onto box + PxReal sqrDistance = 0.0f; + for(PxU32 ax=0; ax<3; ax++) + { + if(closest[ax] < -boxExtent[ax]) + { + const PxReal delta = closest[ax] + boxExtent[ax]; + sqrDistance += delta*delta; + closest[ax] = -boxExtent[ax]; + } + else if(closest[ax] > boxExtent[ax]) + { + const PxReal delta = closest[ax] - boxExtent[ax]; + sqrDistance += delta*delta; + closest[ax] = boxExtent[ax]; + } + } + + if(boxParam) *boxParam = closest; + + return sqrDistance; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.h new file mode 100644 index 0000000..0b839cc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointBox.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_BOX_H +#define GU_DISTANCE_POINT_BOX_H + +#include "GuBox.h" + +namespace physx +{ +namespace Gu +{ + /** + Return the square of the minimum distance from the surface of the box to the given point. + \param point The point + \param boxOrigin The origin of the box + \param boxExtent The extent of the box + \param boxBase The orientation of the box + \param boxParam Set to coordinates of the closest point on the box in its local space + */ + PX_PHYSX_COMMON_API PxReal distancePointBoxSquared( const PxVec3& point, + const PxVec3& boxOrigin, + const PxVec3& boxExtent, + const PxMat33& boxBase, + PxVec3* boxParam=NULL); + + /** + Return the square of the minimum distance from the surface of the box to the given point. + \param point The point + \param box The box + \param boxParam Set to coordinates of the closest point on the box in its local space + */ + PX_FORCE_INLINE PxReal distancePointBoxSquared( const PxVec3& point, + const Gu::Box& box, + PxVec3* boxParam=NULL) + { + return distancePointBoxSquared(point, box.center, box.extents, box.rot, boxParam); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointSegment.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointSegment.h new file mode 100644 index 0000000..0cb962d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointSegment.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_SEGMENT_H +#define GU_DISTANCE_POINT_SEGMENT_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuSegment.h" + +namespace physx +{ +namespace Gu +{ + // dir = p1 - p0 + PX_FORCE_INLINE PxReal distancePointSegmentSquaredInternal(const PxVec3& p0, const PxVec3& dir, const PxVec3& point, PxReal* param=NULL) + { + PxVec3 diff = point - p0; + PxReal fT = diff.dot(dir); + + if(fT<=0.0f) + { + fT = 0.0f; + } + else + { + const PxReal sqrLen = dir.magnitudeSquared(); + if(fT>=sqrLen) + { + fT = 1.0f; + diff -= dir; + } + else + { + fT /= sqrLen; + diff -= fT*dir; + } + } + + if(param) + *param = fT; + + return diff.magnitudeSquared(); + } + + /** + A segment is defined by S(t) = mP0 * (1 - t) + mP1 * t, with 0 <= t <= 1 + Alternatively, a segment is S(t) = Origin + t * Direction for 0 <= t <= 1. + Direction is not necessarily unit length. The end points are Origin = mP0 and Origin + Direction = mP1. + */ + PX_FORCE_INLINE PxReal distancePointSegmentSquared(const PxVec3& p0, const PxVec3& p1, const PxVec3& point, PxReal* param=NULL) + { + return distancePointSegmentSquaredInternal(p0, p1 - p0, point, param); + } + + PX_INLINE PxReal distancePointSegmentSquared(const Gu::Segment& segment, const PxVec3& point, PxReal* param=NULL) + { + return distancePointSegmentSquared(segment.p0, segment.p1, point, param); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp new file mode 100644 index 0000000..71a2458 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.cpp @@ -0,0 +1,121 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuDistancePointTetrahedron.h" +#include "GuDistancePointTriangle.h" + +using namespace physx; + +PxVec4 Gu::PointOutsideOfPlane4(const PxVec3& p, const PxVec3& _a, const PxVec3& _b, + const PxVec3& _c, const PxVec3& _d) +{ + const PxVec3 ap = p - _a; + const PxVec3 ab = _b - _a; + const PxVec3 ac = _c - _a; + const PxVec3 ad = _d - _a; + + const PxVec3 v0 = ab.cross(ac); + const float signa0 = v0.dot(ap); + const float signd0 = v0.dot(ad);// V3Dot(v0, _d); + + const PxVec3 v1 = ac.cross(ad); + const float signa1 = v1.dot(ap); + const float signd1 = v1.dot(ab); + + const PxVec3 v2 = ad.cross(ab); + const float signa2 = v2.dot(ap); + const float signd2 = v2.dot(ac);// V3Dot(v2, _c); + + const PxVec3 bd = _d - _b; + const PxVec3 bc = _c - _b; + + const PxVec3 v3 = bd.cross(bc); + const float signd3 = v3.dot(p - _b); + const float signa3 = v3.dot(_a - _b); + + //if combined signDist is leass zero, p is outside of that face + PxVec4 result = PxVec4(signa0 * signd0, signa1 * signd1, signa2 * signd2, signa3 * signd3); + + return result; +} + +PxVec3 Gu::closestPtPointTetrahedron(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec4& result) +{ + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 ad = d - a; + const PxVec3 bc = c - b; + const PxVec3 bd = d - b; + //point is outside of this face + PxVec3 bestClosestPt(0.f, 0.f, 0.f); + PxReal bestSqDist = PX_MAX_F32; + if (result.x < 0.f) + { + // 0, 1, 2 + bestClosestPt = closestPtPointTriangle2(p, a, b, c, ab, ac); + bestSqDist = bestClosestPt.dot(bestClosestPt); + } + + if (result.y < 0.f) + { + // 0, 2, 3 + const PxVec3 closestPt = closestPtPointTriangle2(p, a, c, d, ac, ad); + const PxReal sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + } + + if (result.z < 0.f) + { + // 0, 3, 1 + const PxVec3 closestPt = closestPtPointTriangle2(p, a, d, b, ad, ab); + const PxReal sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + } + + if (result.w < 0.f) + { + // 1, 3, 2 + const PxVec3 closestPt = closestPtPointTriangle2(p, b, d, c, bd, bc); + const PxReal sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + } + + return bestClosestPt; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.h new file mode 100644 index 0000000..c341b69 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTetrahedron.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_TETRAHEDRON_H +#define GU_DISTANCE_POINT_TETRAHEDRON_H + +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "GuDistancePointTriangle.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ + namespace Gu + { + PX_PHYSX_COMMON_API PxVec4 PointOutsideOfPlane4(const PxVec3& p, const PxVec3& _a, const PxVec3& _b, + const PxVec3& _c, const PxVec3& _d); + + PX_PHYSX_COMMON_API PxVec3 closestPtPointTetrahedron(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxVec4& result); + + PX_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTetrahedron(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d) + { + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 ad = d - a; + const PxVec3 bc = c - b; + const PxVec3 bd = d - b; + + //point to face 0, 1, 2 + PxVec3 bestClosestPt = closestPtPointTriangle2(p, a, b, c, ab, ac); + PxReal bestSqDist = bestClosestPt.dot(bestClosestPt); + + // 0, 2, 3 + PxVec3 closestPt = closestPtPointTriangle2(p, a, c, d, ac, ad); + PxReal sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + // 0, 3, 1 + closestPt = closestPtPointTriangle2(p, a, d, b, ad, ab); + sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + // 1, 3, 2 + closestPt = closestPtPointTriangle2(p, b, d, c, bd, bc); + sqDist = closestPt.dot(closestPt); + if (sqDist < bestSqDist) + { + bestClosestPt = closestPt; + bestSqDist = sqDist; + } + + return bestClosestPt; + } + + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp new file mode 100644 index 0000000..2761d4c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.cpp @@ -0,0 +1,352 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "GuDistancePointTriangle.h" +#include "GuDistancePointTriangleSIMD.h" + +using namespace physx; + +// Based on Christer Ericson's book +PxVec3 Gu::closestPtPointTriangle(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, float& s, float& t) +{ + // Check if P in vertex region outside A + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 ap = p - a; + const float d1 = ab.dot(ap); + const float d2 = ac.dot(ap); + if(d1<=0.0f && d2<=0.0f) + { + s = 0.0f; + t = 0.0f; + return a; // Barycentric coords 1,0,0 + } + + // Check if P in vertex region outside B + const PxVec3 bp = p - b; + const float d3 = ab.dot(bp); + const float d4 = ac.dot(bp); + if(d3>=0.0f && d4<=d3) + { + s = 1.0f; + t = 0.0f; + return b; // Barycentric coords 0,1,0 + } + + // Check if P in edge region of AB, if so return projection of P onto AB + const float vc = d1*d4 - d3*d2; + if(vc<=0.0f && d1>=0.0f && d3<=0.0f) + { + const float v = d1 / (d1 - d3); + s = v; + t = 0.0f; + return a + v * ab; // barycentric coords (1-v, v, 0) + } + + // Check if P in vertex region outside C + const PxVec3 cp = p - c; + const float d5 = ab.dot(cp); + const float d6 = ac.dot(cp); + if(d6>=0.0f && d5<=d6) + { + s = 0.0f; + t = 1.0f; + return c; // Barycentric coords 0,0,1 + } + + // Check if P in edge region of AC, if so return projection of P onto AC + const float vb = d5*d2 - d1*d6; + if(vb<=0.0f && d2>=0.0f && d6<=0.0f) + { + const float w = d2 / (d2 - d6); + s = 0.0f; + t = w; + return a + w * ac; // barycentric coords (1-w, 0, w) + } + + // Check if P in edge region of BC, if so return projection of P onto BC + const float va = d3*d6 - d5*d4; + if(va<=0.0f && (d4-d3)>=0.0f && (d5-d6)>=0.0f) + { + const float w = (d4-d3) / ((d4 - d3) + (d5-d6)); + s = 1.0f-w; + t = w; + return b + w * (c-b); // barycentric coords (0, 1-w, w) + } + + // P inside face region. Compute Q through its barycentric coords (u,v,w) + const float denom = 1.0f / (va + vb + vc); + const float v = vb * denom; + const float w = vc * denom; + s = v; + t = w; + return a + ab*v + ac*w; +} + +//aos::FloatV Gu::distancePointTriangleSquared( const aos::Vec3VArg p, +// const aos::Vec3VArg a, +// const aos::Vec3VArg b, +// const aos::Vec3VArg c, +// aos::FloatV& u, +// aos::FloatV& v, +// aos::Vec3V& closestP) +//{ +// using namespace aos; +// +// const FloatV zero = FZero(); +// const FloatV one = FOne(); +// //const Vec3V zero = V3Zero(); +// const Vec3V ab = V3Sub(b, a); +// const Vec3V ac = V3Sub(c, a); +// const Vec3V bc = V3Sub(c, b); +// const Vec3V ap = V3Sub(p, a); +// const Vec3V bp = V3Sub(p, b); +// const Vec3V cp = V3Sub(p, c); +// +// const FloatV d1 = V3Dot(ab, ap); // snom +// const FloatV d2 = V3Dot(ac, ap); // tnom +// const FloatV d3 = V3Dot(ab, bp); // -sdenom +// const FloatV d4 = V3Dot(ac, bp); // unom = d4 - d3 +// const FloatV d5 = V3Dot(ab, cp); // udenom = d5 - d6 +// const FloatV d6 = V3Dot(ac, cp); // -tdenom +// const FloatV unom = FSub(d4, d3); +// const FloatV udenom = FSub(d5, d6); +// +// //check if p in vertex region outside a +// const BoolV con00 = FIsGrtr(zero, d1); // snom <= 0 +// const BoolV con01 = FIsGrtr(zero, d2); // tnom <= 0 +// const BoolV con0 = BAnd(con00, con01); // vertex region a +// const FloatV u0 = zero; +// const FloatV v0 = zero; +// +// //check if p in vertex region outside b +// const BoolV con10 = FIsGrtrOrEq(d3, zero); +// const BoolV con11 = FIsGrtrOrEq(d3, d4); +// const BoolV con1 = BAnd(con10, con11); // vertex region b +// const FloatV u1 = one; +// const FloatV v1 = zero; +// +// //check if p in vertex region outside c +// const BoolV con20 = FIsGrtrOrEq(d6, zero); +// const BoolV con21 = FIsGrtrOrEq(d6, d5); +// const BoolV con2 = BAnd(con20, con21); // vertex region c +// const FloatV u2 = zero; +// const FloatV v2 = one; +// +// //check if p in edge region of AB +// const FloatV vc = FSub(FMul(d1, d4), FMul(d3, d2)); +// +// const BoolV con30 = FIsGrtr(zero, vc); +// const BoolV con31 = FIsGrtrOrEq(d1, zero); +// const BoolV con32 = FIsGrtr(zero, d3); +// const BoolV con3 = BAnd(con30, BAnd(con31, con32)); +// const FloatV sScale = FDiv(d1, FSub(d1, d3)); +// const Vec3V closest3 = V3Add(a, V3Scale(ab, sScale)); +// const FloatV u3 = sScale; +// const FloatV v3 = zero; +// +// //check if p in edge region of BC +// const FloatV va = FSub(FMul(d3, d6),FMul(d5, d4)); +// const BoolV con40 = FIsGrtr(zero, va); +// const BoolV con41 = FIsGrtrOrEq(d4, d3); +// const BoolV con42 = FIsGrtrOrEq(d5, d6); +// const BoolV con4 = BAnd(con40, BAnd(con41, con42)); +// const FloatV uScale = FDiv(unom, FAdd(unom, udenom)); +// const Vec3V closest4 = V3Add(b, V3Scale(bc, uScale)); +// const FloatV u4 = FSub(one, uScale); +// const FloatV v4 = uScale; +// +// //check if p in edge region of AC +// const FloatV vb = FSub(FMul(d5, d2), FMul(d1, d6)); +// const BoolV con50 = FIsGrtr(zero, vb); +// const BoolV con51 = FIsGrtrOrEq(d2, zero); +// const BoolV con52 = FIsGrtr(zero, d6); +// const BoolV con5 = BAnd(con50, BAnd(con51, con52)); +// const FloatV tScale = FDiv(d2, FSub(d2, d6)); +// const Vec3V closest5 = V3Add(a, V3Scale(ac, tScale)); +// const FloatV u5 = zero; +// const FloatV v5 = tScale; +// +// //P must project inside face region. Compute Q using Barycentric coordinates +// const FloatV denom = FRecip(FAdd(va, FAdd(vb, vc))); +// const FloatV t = FMul(vb, denom); +// const FloatV w = FMul(vc, denom); +// const Vec3V bCom = V3Scale(ab, t); +// const Vec3V cCom = V3Scale(ac, w); +// const Vec3V closest6 = V3Add(a, V3Add(bCom, cCom)); +// const FloatV u6 = t; +// const FloatV v6 = w; +// +// const Vec3V closest= V3Sel(con0, a, V3Sel(con1, b, V3Sel(con2, c, V3Sel(con3, closest3, V3Sel(con4, closest4, V3Sel(con5, closest5, closest6)))))); +// u = FSel(con0, u0, FSel(con1, u1, FSel(con2, u2, FSel(con3, u3, FSel(con4, u4, FSel(con5, u5, u6)))))); +// v = FSel(con0, v0, FSel(con1, v1, FSel(con2, v2, FSel(con3, v3, FSel(con4, v4, FSel(con5, v5, v6)))))); +// closestP = closest; +// +// const Vec3V vv = V3Sub(p, closest); +// +// return V3Dot(vv, vv); +//} + + +aos::FloatV Gu::distancePointTriangleSquared( const aos::Vec3VArg p, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + const aos::Vec3VArg c, + aos::FloatV& u, + aos::FloatV& v, + aos::Vec3V& closestP) +{ + using namespace aos; + + const FloatV zero = FZero(); + const FloatV one = FOne(); + //const Vec3V zero = V3Zero(); + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V bc = V3Sub(c, b); + const Vec3V ap = V3Sub(p, a); + const Vec3V bp = V3Sub(p, b); + const Vec3V cp = V3Sub(p, c); + + const FloatV d1 = V3Dot(ab, ap); // snom + const FloatV d2 = V3Dot(ac, ap); // tnom + const FloatV d3 = V3Dot(ab, bp); // -sdenom + const FloatV d4 = V3Dot(ac, bp); // unom = d4 - d3 + const FloatV d5 = V3Dot(ab, cp); // udenom = d5 - d6 + const FloatV d6 = V3Dot(ac, cp); // -tdenom + const FloatV unom = FSub(d4, d3); + const FloatV udenom = FSub(d5, d6); + + //check if p in vertex region outside a + const BoolV con00 = FIsGrtr(zero, d1); // snom <= 0 + const BoolV con01 = FIsGrtr(zero, d2); // tnom <= 0 + const BoolV con0 = BAnd(con00, con01); // vertex region a + + if(BAllEqTTTT(con0)) + { + u = zero; + v = zero; + const Vec3V vv = V3Sub(p, a); + closestP = a; + return V3Dot(vv, vv); + } + + //check if p in vertex region outside b + const BoolV con10 = FIsGrtrOrEq(d3, zero); + const BoolV con11 = FIsGrtrOrEq(d3, d4); + const BoolV con1 = BAnd(con10, con11); // vertex region b + if(BAllEqTTTT(con1)) + { + u = one; + v = zero; + const Vec3V vv = V3Sub(p, b); + closestP = b; + return V3Dot(vv, vv); + } + + //check if p in vertex region outside c + const BoolV con20 = FIsGrtrOrEq(d6, zero); + const BoolV con21 = FIsGrtrOrEq(d6, d5); + const BoolV con2 = BAnd(con20, con21); // vertex region c + if(BAllEqTTTT(con2)) + { + u = zero; + v = one; + const Vec3V vv = V3Sub(p, c); + closestP = c; + return V3Dot(vv, vv); + } + + //check if p in edge region of AB + const FloatV vc = FSub(FMul(d1, d4), FMul(d3, d2)); + + const BoolV con30 = FIsGrtr(zero, vc); + const BoolV con31 = FIsGrtrOrEq(d1, zero); + const BoolV con32 = FIsGrtr(zero, d3); + const BoolV con3 = BAnd(con30, BAnd(con31, con32)); + if(BAllEqTTTT(con3)) + { + const FloatV sScale = FDiv(d1, FSub(d1, d3)); + const Vec3V closest3 = V3Add(a, V3Scale(ab, sScale)); + u = sScale; + v = zero; + const Vec3V vv = V3Sub(p, closest3); + closestP = closest3; + return V3Dot(vv, vv); + } + + //check if p in edge region of BC + const FloatV va = FSub(FMul(d3, d6),FMul(d5, d4)); + const BoolV con40 = FIsGrtr(zero, va); + const BoolV con41 = FIsGrtrOrEq(d4, d3); + const BoolV con42 = FIsGrtrOrEq(d5, d6); + const BoolV con4 = BAnd(con40, BAnd(con41, con42)); + if(BAllEqTTTT(con4)) + { + const FloatV uScale = FDiv(unom, FAdd(unom, udenom)); + const Vec3V closest4 = V3Add(b, V3Scale(bc, uScale)); + u = FSub(one, uScale); + v = uScale; + const Vec3V vv = V3Sub(p, closest4); + closestP = closest4; + return V3Dot(vv, vv); + } + + //check if p in edge region of AC + const FloatV vb = FSub(FMul(d5, d2), FMul(d1, d6)); + const BoolV con50 = FIsGrtr(zero, vb); + const BoolV con51 = FIsGrtrOrEq(d2, zero); + const BoolV con52 = FIsGrtr(zero, d6); + const BoolV con5 = BAnd(con50, BAnd(con51, con52)); + if(BAllEqTTTT(con5)) + { + const FloatV tScale = FDiv(d2, FSub(d2, d6)); + const Vec3V closest5 = V3Add(a, V3Scale(ac, tScale)); + u = zero; + v = tScale; + const Vec3V vv = V3Sub(p, closest5); + closestP = closest5; + return V3Dot(vv, vv); + } + + //P must project inside face region. Compute Q using Barycentric coordinates + const FloatV denom = FRecip(FAdd(va, FAdd(vb, vc))); + const FloatV t = FMul(vb, denom); + const FloatV w = FMul(vc, denom); + const Vec3V bCom = V3Scale(ab, t); + const Vec3V cCom = V3Scale(ac, w); + const Vec3V closest6 = V3Add(a, V3Add(bCom, cCom)); + u = t; + v = w; + closestP = closest6; + + const Vec3V vv = V3Sub(p, closest6); + + return V3Dot(vv, vv); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.h new file mode 100644 index 0000000..8dd3123 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangle.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_TRIANGLE_H +#define GU_DISTANCE_POINT_TRIANGLE_H + +#include "foundation/PxVec3.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + // PT: special version: + // - inlined + // - doesn't compute (s,t) output params + // - expects precomputed edges in input + PX_FORCE_INLINE PX_CUDA_CALLABLE PxVec3 closestPtPointTriangle2(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& ab, const PxVec3& ac) + { + // Check if P in vertex region outside A + //const PxVec3 ab = b - a; + //const PxVec3 ac = c - a; + const PxVec3 ap = p - a; + const float d1 = ab.dot(ap); + const float d2 = ac.dot(ap); + if(d1<=0.0f && d2<=0.0f) + return a; // Barycentric coords 1,0,0 + + // Check if P in vertex region outside B + const PxVec3 bp = p - b; + const float d3 = ab.dot(bp); + const float d4 = ac.dot(bp); + if(d3>=0.0f && d4<=d3) + return b; // Barycentric coords 0,1,0 + + // Check if P in edge region of AB, if so return projection of P onto AB + const float vc = d1*d4 - d3*d2; + if(vc<=0.0f && d1>=0.0f && d3<=0.0f) + { + const float v = d1 / (d1 - d3); + return a + v * ab; // barycentric coords (1-v, v, 0) + } + + // Check if P in vertex region outside C + const PxVec3 cp = p - c; + const float d5 = ab.dot(cp); + const float d6 = ac.dot(cp); + if(d6>=0.0f && d5<=d6) + return c; // Barycentric coords 0,0,1 + + // Check if P in edge region of AC, if so return projection of P onto AC + const float vb = d5*d2 - d1*d6; + if(vb<=0.0f && d2>=0.0f && d6<=0.0f) + { + const float w = d2 / (d2 - d6); + return a + w * ac; // barycentric coords (1-w, 0, w) + } + + // Check if P in edge region of BC, if so return projection of P onto BC + const float va = d3*d6 - d5*d4; + if(va<=0.0f && (d4-d3)>=0.0f && (d5-d6)>=0.0f) + { + const float w = (d4-d3) / ((d4 - d3) + (d5-d6)); + return b + w * (c-b); // barycentric coords (0, 1-w, w) + } + + // P inside face region. Compute Q through its barycentric coords (u,v,w) + const float denom = 1.0f / (va + vb + vc); + const float v = vb * denom; + const float w = vc * denom; + return a + ab*v + ac*w; + } + + PX_PHYSX_COMMON_API PxVec3 closestPtPointTriangle(const PxVec3& p, const PxVec3& a, const PxVec3& b, const PxVec3& c, float& s, float& t); + + PX_FORCE_INLINE PxReal distancePointTriangleSquared(const PxVec3& point, + const PxVec3& triangleOrigin, + const PxVec3& triangleEdge0, + const PxVec3& triangleEdge1, + PxReal* param0=NULL, + PxReal* param1=NULL) + { + const PxVec3 pt0 = triangleEdge0 + triangleOrigin; + const PxVec3 pt1 = triangleEdge1 + triangleOrigin; + float s,t; + const PxVec3 cp = closestPtPointTriangle(point, triangleOrigin, pt0, pt1, s, t); + if(param0) + *param0 = s; + if(param1) + *param1 = t; + return (cp - point).magnitudeSquared(); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangleSIMD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangleSIMD.h new file mode 100644 index 0000000..77645b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistancePointTriangleSIMD.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_POINT_TRIANGLE_SIMD_H +#define GU_DISTANCE_POINT_TRIANGLE_SIMD_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Gu +{ + + PX_PHYSX_COMMON_API aos::FloatV distancePointTriangleSquared( const aos::Vec3VArg point, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + const aos::Vec3VArg c, + aos::FloatV& u, + aos::FloatV& v, + aos::Vec3V& closestP); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp new file mode 100644 index 0000000..e193521 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentBox.cpp @@ -0,0 +1,548 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuDistanceSegmentBox.h" +#include "GuDistancePointBox.h" +#include "GuDistanceSegmentSegment.h" +#include "GuDistancePointSegment.h" +#include "GuIntersectionRayBox.h" + +using namespace physx; + +static void face(unsigned int i0, unsigned int i1, unsigned int i2, PxVec3& rkPnt, const PxVec3& rkDir, const PxVec3& extents, const PxVec3& rkPmE, PxReal* pfLParam, PxReal& rfSqrDistance) +{ + PxVec3 kPpE; + PxReal fLSqr, fInv, fTmp, fParam, fT, fDelta; + + kPpE[i1] = rkPnt[i1] + extents[i1]; + kPpE[i2] = rkPnt[i2] + extents[i2]; + if(rkDir[i0]*kPpE[i1] >= rkDir[i1]*rkPmE[i0]) + { + if(rkDir[i0]*kPpE[i2] >= rkDir[i2]*rkPmE[i0]) + { + // v[i1] >= -e[i1], v[i2] >= -e[i2] (distance = 0) + if(pfLParam) + { + rkPnt[i0] = extents[i0]; + fInv = 1.0f/rkDir[i0]; + rkPnt[i1] -= rkDir[i1]*rkPmE[i0]*fInv; + rkPnt[i2] -= rkDir[i2]*rkPmE[i0]*fInv; + *pfLParam = -rkPmE[i0]*fInv; + } + } + else + { + // v[i1] >= -e[i1], v[i2] < -e[i2] + fLSqr = rkDir[i0]*rkDir[i0] + rkDir[i2]*rkDir[i2]; + fTmp = fLSqr*kPpE[i1] - rkDir[i1]*(rkDir[i0]*rkPmE[i0] + rkDir[i2]*kPpE[i2]); + if(fTmp <= 2.0f*fLSqr*extents[i1]) + { + fT = fTmp/fLSqr; + fLSqr += rkDir[i1]*rkDir[i1]; + fTmp = kPpE[i1] - fT; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*fTmp + rkDir[i2]*kPpE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + fTmp*fTmp + kPpE[i2]*kPpE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = fT - extents[i1]; + rkPnt[i2] = -extents[i2]; + } + } + else + { + fLSqr += rkDir[i1]*rkDir[i1]; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*rkPmE[i1] + rkDir[i2]*kPpE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + rkPmE[i1]*rkPmE[i1] + kPpE[i2]*kPpE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = extents[i1]; + rkPnt[i2] = -extents[i2]; + } + } + } + } + else + { + if ( rkDir[i0]*kPpE[i2] >= rkDir[i2]*rkPmE[i0] ) + { + // v[i1] < -e[i1], v[i2] >= -e[i2] + fLSqr = rkDir[i0]*rkDir[i0] + rkDir[i1]*rkDir[i1]; + fTmp = fLSqr*kPpE[i2] - rkDir[i2]*(rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1]); + if(fTmp <= 2.0f*fLSqr*extents[i2]) + { + fT = fTmp/fLSqr; + fLSqr += rkDir[i2]*rkDir[i2]; + fTmp = kPpE[i2] - fT; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1] + rkDir[i2]*fTmp; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + kPpE[i1]*kPpE[i1] + fTmp*fTmp + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = -extents[i1]; + rkPnt[i2] = fT - extents[i2]; + } + } + else + { + fLSqr += rkDir[i2]*rkDir[i2]; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1] + rkDir[i2]*rkPmE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + kPpE[i1]*kPpE[i1] + rkPmE[i2]*rkPmE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = -extents[i1]; + rkPnt[i2] = extents[i2]; + } + } + } + else + { + // v[i1] < -e[i1], v[i2] < -e[i2] + fLSqr = rkDir[i0]*rkDir[i0]+rkDir[i2]*rkDir[i2]; + fTmp = fLSqr*kPpE[i1] - rkDir[i1]*(rkDir[i0]*rkPmE[i0] + rkDir[i2]*kPpE[i2]); + if(fTmp >= 0.0f) + { + // v[i1]-edge is closest + if ( fTmp <= 2.0f*fLSqr*extents[i1] ) + { + fT = fTmp/fLSqr; + fLSqr += rkDir[i1]*rkDir[i1]; + fTmp = kPpE[i1] - fT; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*fTmp + rkDir[i2]*kPpE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + fTmp*fTmp + kPpE[i2]*kPpE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = fT - extents[i1]; + rkPnt[i2] = -extents[i2]; + } + } + else + { + fLSqr += rkDir[i1]*rkDir[i1]; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*rkPmE[i1] + rkDir[i2]*kPpE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + rkPmE[i1]*rkPmE[i1] + kPpE[i2]*kPpE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = extents[i1]; + rkPnt[i2] = -extents[i2]; + } + } + return; + } + + fLSqr = rkDir[i0]*rkDir[i0] + rkDir[i1]*rkDir[i1]; + fTmp = fLSqr*kPpE[i2] - rkDir[i2]*(rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1]); + if(fTmp >= 0.0f) + { + // v[i2]-edge is closest + if(fTmp <= 2.0f*fLSqr*extents[i2]) + { + fT = fTmp/fLSqr; + fLSqr += rkDir[i2]*rkDir[i2]; + fTmp = kPpE[i2] - fT; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1] + rkDir[i2]*fTmp; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + kPpE[i1]*kPpE[i1] + fTmp*fTmp + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = -extents[i1]; + rkPnt[i2] = fT - extents[i2]; + } + } + else + { + fLSqr += rkDir[i2]*rkDir[i2]; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1] + rkDir[i2]*rkPmE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + kPpE[i1]*kPpE[i1] + rkPmE[i2]*rkPmE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = -extents[i1]; + rkPnt[i2] = extents[i2]; + } + } + return; + } + + // (v[i1],v[i2])-corner is closest + fLSqr += rkDir[i2]*rkDir[i2]; + fDelta = rkDir[i0]*rkPmE[i0] + rkDir[i1]*kPpE[i1] + rkDir[i2]*kPpE[i2]; + fParam = -fDelta/fLSqr; + rfSqrDistance += rkPmE[i0]*rkPmE[i0] + kPpE[i1]*kPpE[i1] + kPpE[i2]*kPpE[i2] + fDelta*fParam; + + if(pfLParam) + { + *pfLParam = fParam; + rkPnt[i0] = extents[i0]; + rkPnt[i1] = -extents[i1]; + rkPnt[i2] = -extents[i2]; + } + } + } +} + +static void caseNoZeros(PxVec3& rkPnt, const PxVec3& rkDir, const PxVec3& extents, PxReal* pfLParam, PxReal& rfSqrDistance) +{ + PxVec3 kPmE(rkPnt.x - extents.x, rkPnt.y - extents.y, rkPnt.z - extents.z); + + PxReal fProdDxPy, fProdDyPx, fProdDzPx, fProdDxPz, fProdDzPy, fProdDyPz; + + fProdDxPy = rkDir.x*kPmE.y; + fProdDyPx = rkDir.y*kPmE.x; + if(fProdDyPx >= fProdDxPy) + { + fProdDzPx = rkDir.z*kPmE.x; + fProdDxPz = rkDir.x*kPmE.z; + if(fProdDzPx >= fProdDxPz) + { + // line intersects x = e0 + face(0, 1, 2, rkPnt, rkDir, extents, kPmE, pfLParam, rfSqrDistance); + } + else + { + // line intersects z = e2 + face(2, 0, 1, rkPnt, rkDir, extents, kPmE, pfLParam, rfSqrDistance); + } + } + else + { + fProdDzPy = rkDir.z*kPmE.y; + fProdDyPz = rkDir.y*kPmE.z; + if(fProdDzPy >= fProdDyPz) + { + // line intersects y = e1 + face(1, 2, 0, rkPnt, rkDir, extents, kPmE, pfLParam, rfSqrDistance); + } + else + { + // line intersects z = e2 + face(2, 0, 1, rkPnt, rkDir, extents, kPmE, pfLParam, rfSqrDistance); + } + } +} + +static void case0(unsigned int i0, unsigned int i1, unsigned int i2, PxVec3& rkPnt, const PxVec3& rkDir, const PxVec3& extents, PxReal* pfLParam, PxReal& rfSqrDistance) +{ + PxReal fPmE0 = rkPnt[i0] - extents[i0]; + PxReal fPmE1 = rkPnt[i1] - extents[i1]; + PxReal fProd0 = rkDir[i1]*fPmE0; + PxReal fProd1 = rkDir[i0]*fPmE1; + PxReal fDelta, fInvLSqr, fInv; + + if(fProd0 >= fProd1) + { + // line intersects P[i0] = e[i0] + rkPnt[i0] = extents[i0]; + + PxReal fPpE1 = rkPnt[i1] + extents[i1]; + fDelta = fProd0 - rkDir[i0]*fPpE1; + if(fDelta >= 0.0f) + { + fInvLSqr = 1.0f/(rkDir[i0]*rkDir[i0] + rkDir[i1]*rkDir[i1]); + rfSqrDistance += fDelta*fDelta*fInvLSqr; + if(pfLParam) + { + rkPnt[i1] = -extents[i1]; + *pfLParam = -(rkDir[i0]*fPmE0+rkDir[i1]*fPpE1)*fInvLSqr; + } + } + else + { + if(pfLParam) + { + fInv = 1.0f/rkDir[i0]; + rkPnt[i1] -= fProd0*fInv; + *pfLParam = -fPmE0*fInv; + } + } + } + else + { + // line intersects P[i1] = e[i1] + rkPnt[i1] = extents[i1]; + + PxReal fPpE0 = rkPnt[i0] + extents[i0]; + fDelta = fProd1 - rkDir[i1]*fPpE0; + if(fDelta >= 0.0f) + { + fInvLSqr = 1.0f/(rkDir[i0]*rkDir[i0] + rkDir[i1]*rkDir[i1]); + rfSqrDistance += fDelta*fDelta*fInvLSqr; + if(pfLParam) + { + rkPnt[i0] = -extents[i0]; + *pfLParam = -(rkDir[i0]*fPpE0+rkDir[i1]*fPmE1)*fInvLSqr; + } + } + else + { + if(pfLParam) + { + fInv = 1.0f/rkDir[i1]; + rkPnt[i0] -= fProd1*fInv; + *pfLParam = -fPmE1*fInv; + } + } + } + + if(rkPnt[i2] < -extents[i2]) + { + fDelta = rkPnt[i2] + extents[i2]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i2] = -extents[i2]; + } + else if ( rkPnt[i2] > extents[i2] ) + { + fDelta = rkPnt[i2] - extents[i2]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i2] = extents[i2]; + } +} + +static void case00(unsigned int i0, unsigned int i1, unsigned int i2, PxVec3& rkPnt, const PxVec3& rkDir, const PxVec3& extents, PxReal* pfLParam, PxReal& rfSqrDistance) +{ + PxReal fDelta; + + if(pfLParam) + *pfLParam = (extents[i0] - rkPnt[i0])/rkDir[i0]; + + rkPnt[i0] = extents[i0]; + + if(rkPnt[i1] < -extents[i1]) + { + fDelta = rkPnt[i1] + extents[i1]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i1] = -extents[i1]; + } + else if(rkPnt[i1] > extents[i1]) + { + fDelta = rkPnt[i1] - extents[i1]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i1] = extents[i1]; + } + + if(rkPnt[i2] < -extents[i2]) + { + fDelta = rkPnt[i2] + extents[i2]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i2] = -extents[i2]; + } + else if(rkPnt[i2] > extents[i2]) + { + fDelta = rkPnt[i2] - extents[i2]; + rfSqrDistance += fDelta*fDelta; + rkPnt[i2] = extents[i2]; + } +} + +static void case000(PxVec3& rkPnt, const PxVec3& extents, PxReal& rfSqrDistance) +{ + PxReal fDelta; + + if(rkPnt.x < -extents.x) + { + fDelta = rkPnt.x + extents.x; + rfSqrDistance += fDelta*fDelta; + rkPnt.x = -extents.x; + } + else if(rkPnt.x > extents.x) + { + fDelta = rkPnt.x - extents.x; + rfSqrDistance += fDelta*fDelta; + rkPnt.x = extents.x; + } + + if(rkPnt.y < -extents.y) + { + fDelta = rkPnt.y + extents.y; + rfSqrDistance += fDelta*fDelta; + rkPnt.y = -extents.y; + } + else if(rkPnt.y > extents.y) + { + fDelta = rkPnt.y - extents.y; + rfSqrDistance += fDelta*fDelta; + rkPnt.y = extents.y; + } + + if(rkPnt.z < -extents.z) + { + fDelta = rkPnt.z + extents.z; + rfSqrDistance += fDelta*fDelta; + rkPnt.z = -extents.z; + } + else if(rkPnt.z > extents.z) + { + fDelta = rkPnt.z - extents.z; + rfSqrDistance += fDelta*fDelta; + rkPnt.z = extents.z; + } +} + +//! Compute the smallest distance from the (infinite) line to the box. +static PxReal distanceLineBoxSquared(const PxVec3& lineOrigin, const PxVec3& lineDirection, + const PxVec3& boxOrigin, const PxVec3& boxExtent, const PxMat33& boxBase, + PxReal* lineParam, + PxVec3* boxParam) +{ + const PxVec3& axis0 = boxBase.column0; + const PxVec3& axis1 = boxBase.column1; + const PxVec3& axis2 = boxBase.column2; + + // compute coordinates of line in box coordinate system + const PxVec3 diff = lineOrigin - boxOrigin; + PxVec3 pnt(diff.dot(axis0), diff.dot(axis1), diff.dot(axis2)); + PxVec3 dir(lineDirection.dot(axis0), lineDirection.dot(axis1), lineDirection.dot(axis2)); + + // Apply reflections so that direction vector has nonnegative components. + bool reflect[3]; + for(unsigned int i=0;i<3;i++) + { + if(dir[i]<0.0f) + { + pnt[i] = -pnt[i]; + dir[i] = -dir[i]; + reflect[i] = true; + } + else + { + reflect[i] = false; + } + } + + PxReal sqrDistance = 0.0f; + + if(dir.x>0.0f) + { + if(dir.y>0.0f) + { + if(dir.z>0.0f) caseNoZeros(pnt, dir, boxExtent, lineParam, sqrDistance); // (+,+,+) + else case0(0, 1, 2, pnt, dir, boxExtent, lineParam, sqrDistance); // (+,+,0) + } + else + { + if(dir.z>0.0f) case0(0, 2, 1, pnt, dir, boxExtent, lineParam, sqrDistance); // (+,0,+) + else case00(0, 1, 2, pnt, dir, boxExtent, lineParam, sqrDistance); // (+,0,0) + } + } + else + { + if(dir.y>0.0f) + { + if(dir.z>0.0f) case0(1, 2, 0, pnt, dir, boxExtent, lineParam, sqrDistance); // (0,+,+) + else case00(1, 0, 2, pnt, dir, boxExtent, lineParam, sqrDistance); // (0,+,0) + } + else + { + if(dir.z>0.0f) case00(2, 0, 1, pnt, dir, boxExtent, lineParam, sqrDistance); // (0,0,+) + else + { + case000(pnt, boxExtent, sqrDistance); // (0,0,0) + if(lineParam) + *lineParam = 0.0f; + } + } + } + + if(boxParam) + { + // undo reflections + for(unsigned int i=0;i<3;i++) + { + if(reflect[i]) + pnt[i] = -pnt[i]; + } + + *boxParam = pnt; + } + + return sqrDistance; +} + +//! Compute the smallest distance from the (finite) line segment to the box. +PxReal Gu::distanceSegmentBoxSquared( const PxVec3& segmentPoint0, const PxVec3& segmentPoint1, + const PxVec3& boxOrigin, const PxVec3& boxExtent, const PxMat33& boxBase, + PxReal* segmentParam, + PxVec3* boxParam) +{ + // compute coordinates of line in box coordinate system + + PxReal lp; + PxVec3 bp; + PxReal sqrDistance = distanceLineBoxSquared(segmentPoint0, segmentPoint1 - segmentPoint0, boxOrigin, boxExtent, boxBase, &lp, &bp); + if(lp>=0.0f) + { + if(lp<=1.0f) + { + if(segmentParam) + *segmentParam = lp; + if(boxParam) + *boxParam = bp; + return sqrDistance; + } + else + { + if(segmentParam) + *segmentParam = 1.0f; + return Gu::distancePointBoxSquared(segmentPoint1, boxOrigin, boxExtent, boxBase, boxParam); + } + } + else + { + if(segmentParam) + *segmentParam = 0.0f; + return Gu::distancePointBoxSquared(segmentPoint0, boxOrigin, boxExtent, boxBase, boxParam); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp new file mode 100644 index 0000000..940cd6e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegment.cpp @@ -0,0 +1,574 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuDistanceSegmentSegment.h" +#include "GuDistanceSegmentSegmentSIMD.h" + +using namespace physx; +using namespace aos; + +static const float ZERO_TOLERANCE = 1e-06f; + +// S0 = origin + extent * dir; +// S1 = origin - extent * dir; +PxReal Gu::distanceSegmentSegmentSquared( const PxVec3& origin0, const PxVec3& dir0, PxReal extent0, + const PxVec3& origin1, const PxVec3& dir1, PxReal extent1, + PxReal* param0, PxReal* param1) +{ + const PxVec3 kDiff = origin0 - origin1; + const PxReal fA01 = -dir0.dot(dir1); + const PxReal fB0 = kDiff.dot(dir0); + const PxReal fB1 = -kDiff.dot(dir1); + const PxReal fC = kDiff.magnitudeSquared(); + const PxReal fDet = PxAbs(1.0f - fA01*fA01); + PxReal fS0, fS1, fSqrDist, fExtDet0, fExtDet1, fTmpS0, fTmpS1; + + if (fDet >= ZERO_TOLERANCE) + { + // segments are not parallel + fS0 = fA01*fB1-fB0; + fS1 = fA01*fB0-fB1; + fExtDet0 = extent0*fDet; + fExtDet1 = extent1*fDet; + + if (fS0 >= -fExtDet0) + { + if (fS0 <= fExtDet0) + { + if (fS1 >= -fExtDet1) + { + if (fS1 <= fExtDet1) // region 0 (interior) + { + // minimum at two interior points of 3D lines + PxReal fInvDet = 1.0f/fDet; + fS0 *= fInvDet; + fS1 *= fInvDet; + fSqrDist = fS0*(fS0+fA01*fS1+2.0f*fB0) + fS1*(fA01*fS0+fS1+2.0f*fB1)+fC; + } + else // region 3 (side) + { + fS1 = extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 < -extent0) + { + fS0 = -extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 <= extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + } + } + else // region 7 (side) + { + fS1 = -extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 < -extent0) + { + fS0 = -extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 <= extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + } + } + else + { + if (fS1 >= -fExtDet1) + { + if (fS1 <= fExtDet1) // region 1 (side) + { + fS0 = extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 < -extent1) + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 <= extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0)+fC; + } + else + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + else // region 2 (corner) + { + fS1 = extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 < -extent0) + { + fS0 = -extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 <= extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 < -extent1) + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 <= extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0) + fC; + } + else + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + } + } + else // region 8 (corner) + { + fS1 = -extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 < -extent0) + { + fS0 = -extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 <= extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 > extent1) + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 >= -extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0) + fC; + } + else + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + } + } + } + else + { + if (fS1 >= -fExtDet1) + { + if (fS1 <= fExtDet1) // region 5 (side) + { + fS0 = -extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 < -extent1) + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 <= extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0)+fC; + } + else + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + else // region 4 (corner) + { + fS1 = extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 > extent0) + { + fS0 = extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 >= -extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = -extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 < -extent1) + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 <= extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0) + fC; + } + else + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + } + } + else // region 6 (corner) + { + fS1 = -extent1; + fTmpS0 = -(fA01*fS1+fB0); + if (fTmpS0 > extent0) + { + fS0 = extent0; + fSqrDist = fS0*(fS0-2.0f*fTmpS0) + fS1*(fS1+2.0f*fB1)+fC; + } + else if (fTmpS0 >= -extent0) + { + fS0 = fTmpS0; + fSqrDist = -fS0*fS0+fS1*(fS1+2.0f*fB1)+fC; + } + else + { + fS0 = -extent0; + fTmpS1 = -(fA01*fS0+fB1); + if (fTmpS1 < -extent1) + { + fS1 = -extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + else if (fTmpS1 <= extent1) + { + fS1 = fTmpS1; + fSqrDist = -fS1*fS1+fS0*(fS0+2.0f*fB0) + fC; + } + else + { + fS1 = extent1; + fSqrDist = fS1*(fS1-2.0f*fTmpS1) + fS0*(fS0+2.0f*fB0)+fC; + } + } + } + } + } + else + { + // The segments are parallel. + PxReal fE0pE1 = extent0 + extent1; + PxReal fSign = (fA01 > 0.0f ? -1.0f : 1.0f); + PxReal b0Avr = 0.5f*(fB0 - fSign*fB1); + PxReal fLambda = -b0Avr; + if(fLambda < -fE0pE1) + { + fLambda = -fE0pE1; + } + else if(fLambda > fE0pE1) + { + fLambda = fE0pE1; + } + + fS1 = -fSign*fLambda*extent1/fE0pE1; + fS0 = fLambda + fSign*fS1; + fSqrDist = fLambda*(fLambda + 2.0f*b0Avr) + fC; + } + + if(param0) + *param0 = fS0; + if(param1) + *param1 = fS1; + + // account for numerical round-off error + return physx::intrinsics::selectMax(0.0f, fSqrDist); +} + +PxReal Gu::distanceSegmentSegmentSquared( const PxVec3& origin0, const PxVec3& extent0, + const PxVec3& origin1, const PxVec3& extent1, + PxReal* param0, + PxReal* param1) +{ + // Some conversion is needed between the old & new code + // Old: + // segment (s0, s1) + // origin = s0 + // extent = s1 - s0 + // + // New: + // s0 = origin + extent * dir; + // s1 = origin - extent * dir; + + // dsequeira: is this really sensible? We use a highly optimized Wild Magic routine, + // then use a segment representation that requires an expensive conversion to/from... + + PxVec3 dir0 = extent0; + const PxVec3 center0 = origin0 + extent0*0.5f; + PxReal length0 = extent0.magnitude(); //AM: change to make it work for degenerate (zero length) segments. + const bool b0 = length0 != 0.0f; + PxReal oneOverLength0 = 0.0f; + if(b0) + { + oneOverLength0 = 1.0f / length0; + dir0 *= oneOverLength0; + length0 *= 0.5f; + } + + PxVec3 dir1 = extent1; + const PxVec3 center1 = origin1 + extent1*0.5f; + PxReal length1 = extent1.magnitude(); + const bool b1 = length1 != 0.0f; + PxReal oneOverLength1 = 0.0f; + if(b1) + { + oneOverLength1 = 1.0f / length1; + dir1 *= oneOverLength1; + length1 *= 0.5f; + } + + // the return param vals have -extent = s0, extent = s1 + + const PxReal d2 = distanceSegmentSegmentSquared(center0, dir0, length0, + center1, dir1, length1, + param0, param1); + + //ML : This is wrong for some reason, I guess it has precision issue + //// renormalize into the 0 = s0, 1 = s1 range + //if (param0) + // *param0 = b0 ? ((*param0) * oneOverLength0 * 0.5f + 0.5f) : 0.0f; + //if (param1) + // *param1 = b1 ? ((*param1) * oneOverLength1 * 0.5f + 0.5f) : 0.0f; + + if(param0) + *param0 = b0 ? ((length0 + (*param0))*oneOverLength0) : 0.0f; + if(param1) + *param1 = b1 ? ((length1 + (*param1))*oneOverLength1) : 0.0f; + + return d2; +} + +/* + S0 = origin + extent * dir; + S1 = origin + extent * dir; + dir is the vector from start to end point + p1 is the start point of segment1 + d1 is the direction vector(q1 - p1) + p2 is the start point of segment2 + d2 is the direction vector(q2 - p2) +*/ + +FloatV Gu::distanceSegmentSegmentSquared( const Vec3VArg p1, + const Vec3VArg d1, + const Vec3VArg p2, + const Vec3VArg d2, + FloatV& s, + FloatV& t) +{ + const FloatV zero = FZero(); + const FloatV one = FOne(); + const FloatV eps = FEps(); + + const Vec3V r = V3Sub(p1, p2); + const Vec4V combinedDot = V3Dot4(d1, d1, d2, d2, d1, d2, d1, r); + const Vec4V combinedRecip = V4Sel(V4IsGrtr(combinedDot, V4Splat(eps)), V4Recip(combinedDot), V4Splat(zero)); + const FloatV a = V4GetX(combinedDot); + const FloatV e = V4GetY(combinedDot); + const FloatV b = V4GetZ(combinedDot); + const FloatV c = V4GetW(combinedDot); + const FloatV aRecip = V4GetX(combinedRecip);//FSel(FIsGrtr(a, eps), FRecip(a), zero); + const FloatV eRecip = V4GetY(combinedRecip);//FSel(FIsGrtr(e, eps), FRecip(e), zero); + + const FloatV f = V3Dot(d2, r); + + /* + s = (b*f - c*e)/(a*e - b*b); + t = (a*f - b*c)/(a*e - b*b); + + s = (b*t - c)/a; + t = (b*s + f)/e; + */ + + //if segments not parallel, the general non-degenerated case, compute closest point on two segments and clamp to segment1 + const FloatV denom = FSub(FMul(a, e), FMul(b, b)); + const FloatV temp = FSub(FMul(b, f), FMul(c, e)); + const FloatV s0 = FClamp(FDiv(temp, denom), zero, one); + + //if segment is parallel, demon < eps + const BoolV con2 = FIsGrtr(eps, denom);//FIsEq(denom, zero); + const FloatV sTmp = FSel(con2, FHalf(), s0); + + //compute point on segment2 closest to segment1 + //const FloatV tTmp = FMul(FAdd(FMul(b, sTmp), f), eRecip); + const FloatV tTmp = FMul(FScaleAdd(b, sTmp, f), eRecip); + + //if t is in [zero, one], done. otherwise clamp t + const FloatV t2 = FClamp(tTmp, zero, one); + + //recompute s for the new value + const FloatV comp = FMul(FSub(FMul(b,t2), c), aRecip); + const FloatV s2 = FClamp(comp, zero, one); + + s = s2; + t = t2; + + const Vec3V closest1 = V3ScaleAdd(d1, s2, p1);//V3Add(p1, V3Scale(d1, tempS)); + const Vec3V closest2 = V3ScaleAdd(d2, t2, p2);//V3Add(p2, V3Scale(d2, tempT)); + const Vec3V vv = V3Sub(closest1, closest2); + return V3Dot(vv, vv); +} + + + + +/* + segment (p, d) and segment (p02, d02) + segment (p, d) and segment (p12, d12) + segment (p, d) and segment (p22, d22) + segment (p, d) and segment (p32, d32) +*/ +Vec4V Gu::distanceSegmentSegmentSquared4( const Vec3VArg p, const Vec3VArg d0, + const Vec3VArg p02, const Vec3VArg d02, + const Vec3VArg p12, const Vec3VArg d12, + const Vec3VArg p22, const Vec3VArg d22, + const Vec3VArg p32, const Vec3VArg d32, + Vec4V& s, Vec4V& t) +{ + const Vec4V zero = V4Zero(); + const Vec4V one = V4One(); + const Vec4V eps = V4Eps(); + const Vec4V half = V4Splat(FHalf()); + + const Vec4V d0X = V4Splat(V3GetX(d0)); + const Vec4V d0Y = V4Splat(V3GetY(d0)); + const Vec4V d0Z = V4Splat(V3GetZ(d0)); + const Vec4V pX = V4Splat(V3GetX(p)); + const Vec4V pY = V4Splat(V3GetY(p)); + const Vec4V pZ = V4Splat(V3GetZ(p)); + + Vec4V d024 = Vec4V_From_Vec3V(d02); + Vec4V d124 = Vec4V_From_Vec3V(d12); + Vec4V d224 = Vec4V_From_Vec3V(d22); + Vec4V d324 = Vec4V_From_Vec3V(d32); + + Vec4V p024 = Vec4V_From_Vec3V(p02); + Vec4V p124 = Vec4V_From_Vec3V(p12); + Vec4V p224 = Vec4V_From_Vec3V(p22); + Vec4V p324 = Vec4V_From_Vec3V(p32); + + Vec4V d0123X, d0123Y, d0123Z; + Vec4V p0123X, p0123Y, p0123Z; + + PX_TRANSPOSE_44_34(d024, d124, d224, d324, d0123X, d0123Y, d0123Z); + PX_TRANSPOSE_44_34(p024, p124, p224, p324, p0123X, p0123Y, p0123Z); + + const Vec4V rX = V4Sub(pX, p0123X); + const Vec4V rY = V4Sub(pY, p0123Y); + const Vec4V rZ = V4Sub(pZ, p0123Z); + + //TODO - store this in a transposed state and avoid so many dot products? + + const FloatV dd = V3Dot(d0, d0); + + const Vec4V e = V4MulAdd(d0123Z, d0123Z, V4MulAdd(d0123X, d0123X, V4Mul(d0123Y, d0123Y))); + const Vec4V b = V4MulAdd(d0Z, d0123Z, V4MulAdd(d0X, d0123X, V4Mul(d0Y, d0123Y))); + const Vec4V c = V4MulAdd(d0Z, rZ, V4MulAdd(d0X, rX, V4Mul(d0Y, rY))); + const Vec4V f = V4MulAdd(d0123Z, rZ, V4MulAdd(d0123X, rX, V4Mul(d0123Y, rY))); + + const Vec4V a(V4Splat(dd)); + + const Vec4V aRecip(V4Recip(a)); + const Vec4V eRecip(V4Recip(e)); + + //if segments not parallell, compute closest point on two segments and clamp to segment1 + const Vec4V denom = V4Sub(V4Mul(a, e), V4Mul(b, b)); + const Vec4V temp = V4Sub(V4Mul(b, f), V4Mul(c, e)); + const Vec4V s0 = V4Clamp(V4Div(temp, denom), zero, one); + + //test whether segments are parallel + const BoolV con2 = V4IsGrtrOrEq(eps, denom); + const Vec4V sTmp = V4Sel(con2, half, s0); + + //compute point on segment2 closest to segment1 + const Vec4V tTmp = V4Mul(V4Add(V4Mul(b, sTmp), f), eRecip); + + //if t is in [zero, one], done. otherwise clamp t + const Vec4V t2 = V4Clamp(tTmp, zero, one); + + //recompute s for the new value + const Vec4V comp = V4Mul(V4Sub(V4Mul(b,t2), c), aRecip); + const BoolV aaNearZero = V4IsGrtrOrEq(eps, a); // check if aRecip is valid (aa>eps) + const Vec4V s2 = V4Sel(aaNearZero, V4Zero(), V4Clamp(comp, zero, one)); + + /* s = V4Sel(con0, zero, V4Sel(con1, cd, s2)); + t = V4Sel(con1, zero, V4Sel(con0, cg, t2)); */ + s = s2; + t = t2; + + const Vec4V closest1X = V4MulAdd(d0X, s2, pX); + const Vec4V closest1Y = V4MulAdd(d0Y, s2, pY); + const Vec4V closest1Z = V4MulAdd(d0Z, s2, pZ); + + const Vec4V closest2X = V4MulAdd(d0123X, t2, p0123X); + const Vec4V closest2Y = V4MulAdd(d0123Y, t2, p0123Y); + const Vec4V closest2Z = V4MulAdd(d0123Z, t2, p0123Z); + + const Vec4V vvX = V4Sub(closest1X, closest2X); + const Vec4V vvY = V4Sub(closest1Y, closest2Y); + const Vec4V vvZ = V4Sub(closest1Z, closest2Z); + + const Vec4V vd = V4MulAdd(vvX, vvX, V4MulAdd(vvY, vvY, V4Mul(vvZ, vvZ))); + + return vd; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegmentSIMD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegmentSIMD.h new file mode 100644 index 0000000..3c68e3f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentSegmentSIMD.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_SEGMENT_SEGMENT_SIMD_H +#define GU_DISTANCE_SEGMENT_SEGMENT_SIMD_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Gu +{ + PX_PHYSX_COMMON_API aos::FloatV distanceSegmentSegmentSquared( const aos::Vec3VArg p1, const aos::Vec3VArg d1, const aos::Vec3VArg p2, const aos::Vec3VArg d2, + aos::FloatV& param0, + aos::FloatV& param1); + + /* + This function do four segment segment closest point test in one go + */ + aos::Vec4V distanceSegmentSegmentSquared4( const aos::Vec3VArg p, const aos::Vec3VArg d, + const aos::Vec3VArg p02, const aos::Vec3VArg d02, + const aos::Vec3VArg p12, const aos::Vec3VArg d12, + const aos::Vec3VArg p22, const aos::Vec3VArg d22, + const aos::Vec3VArg p32, const aos::Vec3VArg d32, + aos::Vec4V& s, aos::Vec4V& t); +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp new file mode 100644 index 0000000..7203652 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.cpp @@ -0,0 +1,540 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIntrinsics.h" +#include "GuDistanceSegmentTriangle.h" +#include "GuDistanceSegmentTriangleSIMD.h" +#include "GuDistancePointTriangle.h" +#include "GuDistancePointTriangleSIMD.h" +#include "GuDistanceSegmentSegment.h" +#include "GuDistanceSegmentSegmentSIMD.h" +#include "GuBarycentricCoordinates.h" + +using namespace physx; +using namespace Gu; + +// ptchernev: +// The Magic Software code uses a relative error test for parallel case. +// The Novodex code does not presumably as an optimization. +// Since the Novodex code is working in the trunk I see no reason +// to reintroduce the relative error test here. + +// PT: this might just be because the relative error test has been added +// after we grabbed the code. I don't remember making this change. A good +// idea would be NOT to refactor Magic's code, to easily grab updated +// versions from the website............................................. + +// ptchernev: +// The code has been modified to use a relative error test since the absolute +// test would break down for small geometries. (TTP 4021) + +static PX_FORCE_INLINE void updateClosestHit( PxReal fSqrDist0, PxReal fR0, PxReal fS0, PxReal fT0, + PxReal& fSqrDist, PxReal& fR, PxReal& fS, PxReal& fT) +{ + if(fSqrDist0 < fSqrDist) + { + fSqrDist = fSqrDist0; + fR = fR0; + fS = fS0; + fT = fT0; + } +} + +PxReal Gu::distanceSegmentTriangleSquared( const PxVec3& origin, const PxVec3& dir, + const PxVec3& p0, const PxVec3& triEdge0, const PxVec3& triEdge1, + PxReal* t, PxReal* u, PxReal* v) +{ + const PxReal fA00 = dir.magnitudeSquared(); + if(fA00 < 1e-6f*1e-6f) + { + if(t) + *t = 0.0f; + return distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, u, v); + } + const PxVec3 kDiff = p0 - origin; + const PxReal fA01 = -(dir.dot(triEdge0)); + const PxReal fA02 = -(dir.dot(triEdge1)); + const PxReal fA11 = triEdge0.magnitudeSquared(); + const PxReal fA12 = triEdge0.dot(triEdge1); + const PxReal fA22 = triEdge1.dot(triEdge1); + const PxReal fB0 = -(kDiff.dot(dir)); + const PxReal fB1 = kDiff.dot(triEdge0); + const PxReal fB2 = kDiff.dot(triEdge1); + const PxReal fCof00 = fA11*fA22-fA12*fA12; + const PxReal fCof01 = fA02*fA12-fA01*fA22; + const PxReal fCof02 = fA01*fA12-fA02*fA11; + const PxReal fDet = fA00*fCof00+fA01*fCof01+fA02*fCof02; + + PxReal fSqrDist, fSqrDist0, fR, fS, fT, fR0, fS0, fT0; + + // Set up for a relative error test on the angle between ray direction + // and triangle normal to determine parallel/nonparallel status. + const PxVec3 kNormal = triEdge0.cross(triEdge1); + const PxReal fDot = kNormal.dot(dir); + if(fDot*fDot >= 1e-6f*dir.magnitudeSquared()*kNormal.magnitudeSquared()) + { + const PxReal fCof11 = fA00*fA22-fA02*fA02; + const PxReal fCof12 = fA02*fA01-fA00*fA12; + const PxReal fCof22 = fA00*fA11-fA01*fA01; + const PxReal fInvDet = fDet == 0.0f ? 0.0f : 1.0f/fDet; + const PxReal fRhs0 = -fB0*fInvDet; + const PxReal fRhs1 = -fB1*fInvDet; + const PxReal fRhs2 = -fB2*fInvDet; + + fR = fCof00*fRhs0+fCof01*fRhs1+fCof02*fRhs2; + fS = fCof01*fRhs0+fCof11*fRhs1+fCof12*fRhs2; + fT = fCof02*fRhs0+fCof12*fRhs1+fCof22*fRhs2; + + if(fR < 0.0f) + { + if(fS+fT <= 1.0f) + { + if(fS < 0.0f) + { + if(fT < 0.0f) // region 4m + { + // minimum on face s=0 or t=0 or r=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR0, &fS0); + fT0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 3m + { + // minimum on face s=0 or r=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + } + fSqrDist0 = distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else if(fT < 0.0f) // region 5m + { + // minimum on face t=0 or r=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + fSqrDist0 = distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 0m + { + // minimum on face r=0 + fSqrDist = distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, &fS, &fT); + fR = 0.0f; + } + } + else + { + if(fS < 0.0f) // region 2m + { + // minimum on face s=0 or s+t=1 or r=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else if(fT < 0.0f) // region 6m + { + // minimum on face t=0 or s+t=1 or r=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 1m + { + // minimum on face s+t=1 or r=0 + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR, &fT); + fS = 1.0f-fT; + } + fSqrDist0 = distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + } + else if(fR <= 1.0f) + { + if(fS+fT <= 1.0f) + { + if(fS < 0.0f) + { + if(fT < 0.0f) // region 4 + { + // minimum on face s=0 or t=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR0, &fS0); + fT0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 3 + { + // minimum on face s=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + } + } + else if(fT < 0.0f) // region 5 + { + // minimum on face t=0 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + } + else // region 0 + { + // global minimum is interior, done + fSqrDist = fR*(fA00*fR+fA01*fS+fA02*fT+2.0f*fB0) + +fS*(fA01*fR+fA11*fS+fA12*fT+2.0f*fB1) + +fT*(fA02*fR+fA12*fS+fA22*fT+2.0f*fB2) + +kDiff.magnitudeSquared(); + } + } + else + { + if(fS < 0.0f) // region 2 + { + // minimum on face s=0 or s+t=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else if(fT < 0.0f) // region 6 + { + // minimum on face t=0 or s+t=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 1 + { + // minimum on face s+t=1 + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR, &fT); + fS = 1.0f-fT; + } + } + } + else // fR > 1 + { + if(fS+fT <= 1.0f) + { + if(fS < 0.0f) + { + if(fT < 0.0f) // region 4p + { + // minimum on face s=0 or t=0 or r=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR0, &fS0); + fT0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 3p + { + // minimum on face s=0 or r=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + } + const PxVec3 kPt = origin+dir; + fSqrDist0 = distancePointTriangleSquared(kPt, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 1.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else if(fT < 0.0f) // region 5p + { + // minimum on face t=0 or r=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + + const PxVec3 kPt = origin+dir; + fSqrDist0 = distancePointTriangleSquared(kPt, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 1.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 0p + { + // minimum face on r=1 + const PxVec3 kPt = origin+dir; + fSqrDist = distancePointTriangleSquared(kPt, p0, triEdge0, triEdge1, &fS, &fT); + fR = 1.0f; + } + } + else + { + if(fS < 0.0f) // region 2p + { + // minimum on face s=0 or s+t=1 or r=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR, &fT); + fS = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else if(fT < 0.0f) // region 6p + { + // minimum on face t=0 or s+t=1 or r=1 + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + else // region 1p + { + // minimum on face s+t=1 or r=1 + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1-triEdge0; + fSqrDist = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR, &fT); + fS = 1.0f-fT; + } + const PxVec3 kPt = origin+dir; + fSqrDist0 = distancePointTriangleSquared(kPt, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 1.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + } + } + else + { + // segment and triangle are parallel + fSqrDist = distanceSegmentSegmentSquared(origin, dir, p0, triEdge0, &fR, &fS); + fT = 0.0f; + + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, p0, triEdge1, &fR0, &fT0); + fS0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + + const PxVec3 kTriSegOrig = p0+triEdge0; + const PxVec3 kTriSegDir = triEdge1 - triEdge0; + fSqrDist0 = distanceSegmentSegmentSquared(origin, dir, kTriSegOrig, kTriSegDir, &fR0, &fT0); + fS0 = 1.0f-fT0; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + + fSqrDist0 = distancePointTriangleSquared(origin, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 0.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + + const PxVec3 kPt = origin+dir; + fSqrDist0 = distancePointTriangleSquared(kPt, p0, triEdge0, triEdge1, &fS0, &fT0); + fR0 = 1.0f; + updateClosestHit(fSqrDist0, fR0, fS0, fT0, fSqrDist, fR, fS, fT); + } + + if(t) *t = fR; + if(u) *u = fS; + if(v) *v = fT; + + // account for numerical round-off error + return physx::intrinsics::selectMax(0.0f, fSqrDist); +} + + +/* + closest0 is the closest point on segment pq + closest1 is the closest point on triangle abc +*/ +aos::FloatV Gu::distanceSegmentTriangleSquared( const aos::Vec3VArg p, const aos::Vec3VArg q, + const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c, + aos::Vec3V& closest0, aos::Vec3V& closest1) +{ + using namespace aos; + const FloatV zero = FZero(); + //const FloatV one = FOne(); + //const FloatV parallelTolerance = FloatV_From_F32(PX_PARALLEL_TOLERANCE); + + const Vec3V pq = V3Sub(q, p); + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V bc = V3Sub(c, b); + const Vec3V ap = V3Sub(p, a); + const Vec3V aq = V3Sub(q, a); + + //This is used to calculate the barycentric coordinate + const FloatV d00 = V3Dot(ab,ab); + const FloatV d01 = V3Dot(ab, ac); + const FloatV d11 = V3Dot(ac, ac); + const FloatV tDenom = FSub(FMul(d00, d11), FMul(d01, d01)); + + const FloatV bdenom = FSel(FIsGrtr(tDenom, zero), FRecip(tDenom), zero); + + const Vec3V n =V3Normalize(V3Cross(ab, ac)); // normalize vector + + //compute the closest point of p and triangle plane abc + const FloatV dist3 = V3Dot(ap, n); + const FloatV sqDist3 = FMul(dist3, dist3); + + + //compute the closest point of q and triangle plane abc + const FloatV dist4 = V3Dot(aq, n); + const FloatV sqDist4 = FMul(dist4, dist4); + const FloatV dMul = FMul(dist3, dist4); + const BoolV con = FIsGrtr(zero, dMul); + + + // intersect with the plane + if(BAllEqTTTT(con)) + { + //compute the intersect point + const FloatV nom = FNeg(V3Dot(n, ap)); + const FloatV denom = FRecip(V3Dot(n, pq)); + const FloatV t = FMul(nom, denom); + const Vec3V ip = V3ScaleAdd(pq, t, p);//V3Add(p, V3Scale(pq, t)); + const Vec3V v2 = V3Sub(ip, a); + const FloatV d20 = V3Dot(v2, ab); + const FloatV d21 = V3Dot(v2, ac); + const FloatV v0 = FMul(FSub(FMul(d11, d20), FMul(d01, d21)), bdenom); + const FloatV w0 = FMul(FSub(FMul(d00, d21), FMul(d01, d20)), bdenom); + const BoolV con0 = isValidTriangleBarycentricCoord(v0, w0); + if(BAllEqTTTT(con0)) + { + closest0 = closest1 = ip; + return zero; + } + } + + + Vec4V t40, t41; + const Vec4V sqDist44 = distanceSegmentSegmentSquared4(p,pq,a,ab, b,bc, a,ac, a,ab, t40, t41); + + const FloatV t00 = V4GetX(t40); + const FloatV t10 = V4GetY(t40); + const FloatV t20 = V4GetZ(t40); + + const FloatV t01 = V4GetX(t41); + const FloatV t11 = V4GetY(t41); + const FloatV t21 = V4GetZ(t41); + + const FloatV sqDist0(V4GetX(sqDist44)); + const FloatV sqDist1(V4GetY(sqDist44)); + const FloatV sqDist2(V4GetZ(sqDist44)); + + const Vec3V closestP00 = V3ScaleAdd(pq, t00, p); + const Vec3V closestP01 = V3ScaleAdd(ab, t01, a); + + const Vec3V closestP10 = V3ScaleAdd(pq, t10, p); + const Vec3V closestP11 = V3ScaleAdd(bc, t11, b); + + const Vec3V closestP20 = V3ScaleAdd(pq, t20, p); + const Vec3V closestP21 = V3ScaleAdd(ac, t21, a); + + + //Get the closest point of all edges + const BoolV con20 = FIsGrtr(sqDist1, sqDist0); + const BoolV con21 = FIsGrtr(sqDist2, sqDist0); + const BoolV con2 = BAnd(con20,con21); + const BoolV con30 = FIsGrtrOrEq(sqDist0, sqDist1); + const BoolV con31 = FIsGrtr(sqDist2, sqDist1); + const BoolV con3 = BAnd(con30, con31); + const FloatV sqDistPE = FSel(con2, sqDist0, FSel(con3, sqDist1, sqDist2)); + //const FloatV tValue = FSel(con2, t00, FSel(con3, t10, t20)); + const Vec3V closestPE0 = V3Sel(con2, closestP00, V3Sel(con3, closestP10, closestP20)); // closestP on segment + const Vec3V closestPE1 = V3Sel(con2, closestP01, V3Sel(con3, closestP11, closestP21)); // closestP on triangle + + + const Vec3V closestP31 = V3NegScaleSub(n, dist3, p);//V3Sub(p, V3Scale(n, dist3)); + const Vec3V closestP30 = p; + + //Compute the barycentric coordinate for project point of q + const Vec3V pV20 = V3Sub(closestP31, a); + const FloatV pD20 = V3Dot(pV20, ab); + const FloatV pD21 = V3Dot(pV20, ac); + const FloatV v0 = FMul(FSub(FMul(d11, pD20), FMul(d01, pD21)), bdenom); + const FloatV w0 = FMul(FSub(FMul(d00, pD21), FMul(d01, pD20)), bdenom); + + //check closestP3 is inside the triangle + const BoolV con0 = isValidTriangleBarycentricCoord(v0, w0); + + + + const Vec3V closestP41 = V3NegScaleSub(n, dist4, q);// V3Sub(q, V3Scale(n, dist4)); + const Vec3V closestP40 = q; + + //Compute the barycentric coordinate for project point of q + const Vec3V qV20 = V3Sub(closestP41, a); + const FloatV qD20 = V3Dot(qV20, ab); + const FloatV qD21 = V3Dot(qV20, ac); + const FloatV v1 = FMul(FSub(FMul(d11, qD20), FMul(d01, qD21)), bdenom); + const FloatV w1 = FMul(FSub(FMul(d00, qD21), FMul(d01, qD20)), bdenom); + + const BoolV con1 = isValidTriangleBarycentricCoord(v1, w1); + + /* + p is interior point but not q + */ + const BoolV d0 = FIsGrtr(sqDistPE, sqDist3); + const Vec3V c00 = V3Sel(d0, closestP30, closestPE0); + const Vec3V c01 = V3Sel(d0, closestP31, closestPE1); + + /* + q is interior point but not p + */ + const BoolV d1 = FIsGrtr(sqDistPE, sqDist4); + const Vec3V c10 = V3Sel(d1, closestP40, closestPE0); + const Vec3V c11 = V3Sel(d1, closestP41, closestPE1); + + /* + p and q are interior point + */ + const BoolV d2 = FIsGrtr(sqDist4, sqDist3); + const Vec3V c20 = V3Sel(d2, closestP30, closestP40); + const Vec3V c21 = V3Sel(d2, closestP31, closestP41); + + const BoolV cond2 = BAnd(con0, con1); + + const Vec3V closestP0 = V3Sel(cond2, c20, V3Sel(con0, c00, V3Sel(con1, c10, closestPE0))); + const Vec3V closestP1 = V3Sel(cond2, c21, V3Sel(con0, c01, V3Sel(con1, c11, closestPE1))); + + const Vec3V vv = V3Sub(closestP1, closestP0); + closest0 = closestP0; + closest1 = closestP1; + return V3Dot(vv, vv); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.h new file mode 100644 index 0000000..ff2e57e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangle.h @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_SEGMENT_TRIANGLE_H +#define GU_DISTANCE_SEGMENT_TRIANGLE_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuSegment.h" + +namespace physx +{ +namespace Gu +{ + + PX_PHYSX_COMMON_API PxReal distanceSegmentTriangleSquared( + const PxVec3& segmentOrigin, const PxVec3& segmentExtent, + const PxVec3& triangleOrigin, const PxVec3& triangleEdge0, const PxVec3& triangleEdge1, + PxReal* t=NULL, PxReal* u=NULL, PxReal* v=NULL); + + PX_INLINE PxReal distanceSegmentTriangleSquared( + const Gu::Segment& segment, + const PxVec3& triangleOrigin, + const PxVec3& triangleEdge0, + const PxVec3& triangleEdge1, + PxReal* t=NULL, + PxReal* u=NULL, + PxReal* v=NULL) + { + return distanceSegmentTriangleSquared( + segment.p0, segment.computeDirection(), triangleOrigin, triangleEdge0, triangleEdge1, t, u, v); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangleSIMD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangleSIMD.h new file mode 100644 index 0000000..94b2a95 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/distance/GuDistanceSegmentTriangleSIMD.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_DISTANCE_SEGMENT_TRIANGLE_SIMD_H +#define GU_DISTANCE_SEGMENT_TRIANGLE_SIMD_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Gu +{ + + /* + closest0 is the closest point on segment pq + closest1 is the closest point on triangle abc + */ + PX_PHYSX_COMMON_API aos::FloatV distanceSegmentTriangleSquared( + const aos::Vec3VArg p, const aos::Vec3VArg q, + const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c, + aos::Vec3V& closest0, aos::Vec3V& closest1); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp new file mode 100644 index 0000000..bdcae5f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.cpp @@ -0,0 +1,623 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuEPA.h" +#include "GuEPAFacet.h" +#include "GuGJKSimplex.h" +#include "CmPriorityQueue.h" +#include "foundation/PxAllocator.h" + +namespace physx +{ +namespace Gu +{ + using namespace aos; + + class ConvexV; + + struct FacetDistanceComparator + { + bool operator()(const Facet* left, const Facet* right) const + { + return *left < *right; + } + }; + + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + class EPA + { + public: + EPA(){} + GjkStatus PenetrationDepth(const GjkConvex& a, const GjkConvex& b, const aos::Vec3V* PX_RESTRICT A, const aos::Vec3V* PX_RESTRICT B, const PxU8 size, const bool takeCoreShape, + const FloatV tolerenceLength, GjkOutput& output); + bool expandPoint(const GjkConvex& a, const GjkConvex& b, PxI32& numVerts, const FloatVArg upperBound); + bool expandSegment(const GjkConvex& a, const GjkConvex& b, PxI32& numVerts, const FloatVArg upperBound); + bool expandTriangle(PxI32& numVerts, const FloatVArg upperBound); + + Facet* addFacet(const PxU32 i0, const PxU32 i1, const PxU32 i2, const aos::FloatVArg upper); + + bool originInTetrahedron(const aos::Vec3VArg p1, const aos::Vec3VArg p2, const aos::Vec3VArg p3, const aos::Vec3VArg p4); + + Cm::InlinePriorityQueue heap; + aos::Vec3V aBuf[MaxSupportPoints]; + aos::Vec3V bBuf[MaxSupportPoints]; + Facet facetBuf[MaxFacets]; + EdgeBuffer edgeBuffer; + EPAFacetManager facetManager; + + private: + PX_NOCOPY(EPA) + }; +#if PX_VC + #pragma warning(pop) +#endif + + PX_FORCE_INLINE bool EPA::originInTetrahedron(const aos::Vec3VArg p1, const aos::Vec3VArg p2, const aos::Vec3VArg p3, const aos::Vec3VArg p4) + { + using namespace aos; + return BAllEqFFFF(PointOutsideOfPlane4(p1, p2, p3, p4)) == 1; + } + + static PX_FORCE_INLINE void doSupport(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg dir, aos::Vec3V& supportA, aos::Vec3V& supportB, aos::Vec3V& support) + { + const Vec3V tSupportA = a.support(V3Neg(dir)); + const Vec3V tSupportB = b.support(dir); + //avoid LHS + supportA = tSupportA; + supportB = tSupportB; + support = V3Sub(tSupportA, tSupportB); + } + + GjkStatus epaPenetration(const GjkConvex& a, const GjkConvex& b, const PxU8* PX_RESTRICT aInd, const PxU8* PX_RESTRICT bInd, const PxU8 size, + const bool takeCoreShape, const FloatV tolerenceLength, GjkOutput& output) + { + + PX_ASSERT(size > 0 && size <=4); + + Vec3V A[4]; + Vec3V B[4]; + + //ML: we construct a simplex based on the gjk simplex indices + for(PxU32 i=0; i 0 && size <=4); + + const Vec3V* A = aPnt; + const Vec3V* B = bPnt; + + EPA epa; + + return epa.PenetrationDepth(a, b, A, B, size, takeCoreShape, tolerenceLength, output); + } + + //ML: this function returns the signed distance of a point to a plane + PX_FORCE_INLINE aos::FloatV Facet::getPlaneDist(const aos::Vec3VArg p, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf) const + { + const Vec3V pa0(aBuf[m_indices[0]]); + const Vec3V pb0(bBuf[m_indices[0]]); + const Vec3V p0 = V3Sub(pa0, pb0); + + return V3Dot(m_planeNormal, V3Sub(p, p0)); + } + + //ML: This function: + // (1)calculates the distance from orign((0, 0, 0)) to a triangle plane + // (2) rejects triangle if the triangle is degenerate (two points are identical) + // (3) rejects triangle to be added into the heap if the plane distance is large than upper + aos::BoolV Facet::isValid2(const PxU32 i0, const PxU32 i1, const PxU32 i2, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, + const aos::FloatVArg upper) + { + using namespace aos; + const FloatV eps = FEps(); + + const Vec3V pa0(aBuf[i0]); + const Vec3V pa1(aBuf[i1]); + const Vec3V pa2(aBuf[i2]); + + const Vec3V pb0(bBuf[i0]); + const Vec3V pb1(bBuf[i1]); + const Vec3V pb2(bBuf[i2]); + + const Vec3V p0 = V3Sub(pa0, pb0); + const Vec3V p1 = V3Sub(pa1, pb1); + const Vec3V p2 = V3Sub(pa2, pb2); + + const Vec3V v0 = V3Sub(p1, p0); + const Vec3V v1 = V3Sub(p2, p0); + + const Vec3V denormalizedNormal = V3Cross(v0, v1); + FloatV norValue = V3Dot(denormalizedNormal, denormalizedNormal); + //if norValue < eps, this triangle is degenerate + const BoolV con = FIsGrtr(norValue, eps); + norValue = FSel(con, norValue, FOne()); + + const Vec3V planeNormal = V3Scale(denormalizedNormal, FRsqrt(norValue)); + const FloatV planeDist = V3Dot(planeNormal, p0); + + m_planeNormal = planeNormal; + FStore(planeDist, &m_planeDist); + + return BAnd(con, FIsGrtrOrEq(upper, planeDist)); + } + + //ML: if the triangle is valid(not degenerate and within lower and upper bound), we need to add it into the heap. Otherwise, we just return + //the triangle so that the facet can be linked to other facets in the expanded polytope. + Facet* EPA::addFacet(const PxU32 i0, const PxU32 i1, const PxU32 i2, const aos::FloatVArg upper) + { + using namespace aos; + PX_ASSERT(i0 != i1 && i0 != i2 && i1 != i2); + //ML: we move the control in the calling code so we don't need to check weather we will run out of facets or not + PX_ASSERT(facetManager.getNumUsedID() < MaxFacets); + + const PxU32 facetId = facetManager.getNewID(); + PxPrefetchLine(&facetBuf[facetId], 128); + + Facet * facet = PX_PLACEMENT_NEW(&facetBuf[facetId],Facet(i0, i1, i2)); + facet->m_FacetId = PxU8(facetId); + + const BoolV validTriangle = facet->isValid2(i0, i1, i2, aBuf, bBuf, upper); + + if(BAllEqTTTT(validTriangle)) + { + heap.push(facet); + facet->m_inHeap = true; + } + else + { + facet->m_inHeap = false; + } + return facet; + } + + //ML: this function performs a flood fill over the boundary of the current polytope. + void Facet::silhouette(const PxU32 _index, const aos::Vec3VArg w, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, EdgeBuffer& edgeBuffer, EPAFacetManager& manager) + { + using namespace aos; + const FloatV zero = FZero(); + Edge stack[MaxFacets]; + stack[0] = Edge(this, _index); + PxI32 size = 1; + while(size--) + { + Facet* const PX_RESTRICT f = stack[size].m_facet; + const PxU32 index = stack[size].m_index; + PX_ASSERT(f->Valid()); + + if(!f->m_obsolete) + { + //ML: if the point is above the facet, the facet has an reflex edge, which will make the polytope concave. Therefore, we need to + //remove this facet and make sure the expanded polytope is convex. + const FloatV pointPlaneDist = f->getPlaneDist(w, aBuf, bBuf); + + if(FAllGrtr(zero, pointPlaneDist)) + { + //ML: facet isn't visible from w (we don't have a reflex edge), this facet will be on the boundary and part of the new polytope so that + //we will push it into our edgeBuffer + if(!edgeBuffer.Insert(f, index)) + return; + } + else + { + //ML:facet is visible from w, therefore, we need to remove this facet from the heap and push its adjacent facets onto the stack + f->m_obsolete = true; // Facet is visible from w + const PxU32 next(incMod3(index)); + const PxU32 next2(incMod3(next)); + stack[size++] = Edge(f->m_adjFacets[next2],PxU32(f->m_adjEdges[next2])); + stack[size++] = Edge(f->m_adjFacets[next], PxU32(f->m_adjEdges[next])); + + PX_ASSERT(size <= MaxFacets); + if(!f->m_inHeap) + { + //if the facet isn't in the heap, we can release that memory + manager.deferredFreeID(f->m_FacetId); + } + } + } + } + } + + //ML: this function perform flood fill for the adjancent facet and store the boundary facet into the edgeBuffer + void Facet::silhouette(const aos::Vec3VArg w, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, EdgeBuffer& edgeBuffer, EPAFacetManager& manager) + { + m_obsolete = true; + for(PxU32 a = 0; a < 3; ++a) + { + m_adjFacets[a]->silhouette(PxU32(m_adjEdges[a]), w, aBuf, bBuf, edgeBuffer, manager); + } + } + + bool EPA::expandPoint(const GjkConvex& a, const GjkConvex& b, PxI32& numVerts, const FloatVArg upperBound) + { + const Vec3V x = V3UnitX(); + Vec3V q0 = V3Sub(aBuf[0], bBuf[0]); + Vec3V q1; + doSupport(a, b, x, aBuf[1], bBuf[1], q1); + if (V3AllEq(q0, q1)) + return false; + return expandSegment(a, b, numVerts, upperBound); + } + + //ML: this function use the segement to create a triangle + bool EPA::expandSegment(const GjkConvex& a, const GjkConvex& b, PxI32& numVerts, const FloatVArg upperBound) + { + const Vec3V q0 = V3Sub(aBuf[0], bBuf[0]); + const Vec3V q1 = V3Sub(aBuf[1], bBuf[1]); + const Vec3V v = V3Sub(q1, q0); + const Vec3V absV = V3Abs(v); + + const FloatV x = V3GetX(absV); + const FloatV y = V3GetY(absV); + const FloatV z = V3GetZ(absV); + + Vec3V axis = V3UnitX(); + const BoolV con0 = BAnd(FIsGrtr(x, y), FIsGrtr(z, y)); + if (BAllEqTTTT(con0)) + { + axis = V3UnitY(); + } + else if(FAllGrtr(x, z)) + { + axis = V3UnitZ(); + } + + const Vec3V n = V3Normalize(V3Cross(axis, v)); + Vec3V q2; + doSupport(a, b, n, aBuf[2], bBuf[2], q2); + + return expandTriangle(numVerts, upperBound); + } + + bool EPA::expandTriangle(PxI32& numVerts, const FloatVArg upperBound) + { + numVerts = 3; + + Facet * PX_RESTRICT f0 = addFacet(0, 1, 2, upperBound); + Facet * PX_RESTRICT f1 = addFacet(1, 0, 2, upperBound); + + if(heap.empty()) + return false; + + f0->link(0, f1, 0); + f0->link(1, f1, 2); + f0->link(2, f1, 1); + + return true; + } + + //ML: this function calculates contact information. If takeCoreShape flag is true, this means the two closest points will be on the core shape used in the support functions. + //For example, we treat sphere/capsule as a point/segment in the support function for GJK/EPA, so that the core shape for sphere/capsule is a point/segment. For PCM, we need + //to take the point from the core shape because this will allows us recycle the contacts more stably. For SQ sweeps, we need to take the point on the surface of the sphere/capsule + //when we calculate MTD because this is what will be reported to the user. Therefore, the takeCoreShape flag will be set to be false in SQ. + static void calculateContactInformation(const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, Facet* facet, const GjkConvex& a, const GjkConvex& b, const bool takeCoreShape, GjkOutput& output) + { + const FloatV zero = FZero(); + Vec3V _pa, _pb; + facet->getClosestPoint(aBuf, bBuf, _pa, _pb); + + //dist > 0 means two shapes are penetrated. If dist < 0(when origin isn't inside the polytope), two shapes status are unknown + const FloatV dist = FAbs(facet->getPlaneDist()); + + const Vec3V planeNormal = V3Neg(facet->getPlaneNormal()); + + if(takeCoreShape) + { + output.closestA = _pa; + output.closestB = _pb; + output.normal = planeNormal; + output.penDep = FNeg(dist); + } + else + { + //for sphere/capusule to take the surface point + const BoolV aQuadratic = a.isMarginEqRadius(); + const BoolV bQuadratic = b.isMarginEqRadius(); + + const FloatV marginA = FSel(aQuadratic, a.getMargin(), zero); + const FloatV marginB = FSel(bQuadratic, b.getMargin(), zero); + const FloatV sumMargin = FAdd(marginA, marginB); + output.closestA = V3NegScaleSub(planeNormal, marginA, _pa); + output.closestB = V3ScaleAdd(planeNormal, marginB, _pb); + output.normal = planeNormal; + output.penDep = FNeg(FAdd(dist, sumMargin)); + } + } + + //ML: This function returns one of three status codes: + //(1)EPA_FAIL: the algorithm failed to create a valid polytope(the origin wasn't inside the polytope) from the input simplex + //(2)EPA_CONTACT : the algorithm found the MTD and converged successfully. + //(3)EPA_DEGENERATE: the algorithm cannot make further progress and the result is unknown. + GjkStatus EPA::PenetrationDepth(const GjkConvex& a, const GjkConvex& b, const aos::Vec3V* PX_RESTRICT A, const aos::Vec3V* PX_RESTRICT B, const PxU8 size, const bool takeCoreShape, + const FloatV tolerenceLength, GjkOutput& output) + { + + using namespace aos; + + PX_UNUSED(tolerenceLength); + + PxPrefetchLine(&facetBuf[0]); + PxPrefetchLine(&facetBuf[0], 128); + + const FloatV zero = FZero(); + + const FloatV _max = FMax(); + FloatV upper_bound(_max); + + aBuf[0]=A[0]; aBuf[1]=A[1]; aBuf[2]=A[2]; aBuf[3]=A[3]; + bBuf[0]=B[0]; bBuf[1]=B[1]; bBuf[2]=B[2]; bBuf[3]=B[3]; + + PxI32 numVertsLocal = 0; + + heap.clear(); + + //if the simplex isn't a tetrahedron, we need to construct one before we can expand it + switch (size) + { + case 1: + { + // Touching contact. Yes, we have a collision and the penetration will be zero + if(!expandPoint(a, b, numVertsLocal, upper_bound)) + return EPA_FAIL; + break; + } + case 2: + { + // We have a line segment inside the Minkowski sum containing the + // origin. we need to construct two back to back triangles which link to each other + if(!expandSegment(a, b, numVertsLocal, upper_bound)) + return EPA_FAIL; + break; + } + case 3: + { + // We have a triangle inside the Minkowski sum containing + // the origin. We need to construct two back to back triangles which link to each other + if(!expandTriangle(numVertsLocal, upper_bound)) + return EPA_FAIL; + + break; + + } + case 4: + { + //check for input face normal. All face normals in this tetrahedron should be all pointing either inwards or outwards. If all face normals are pointing outward, we are good to go. Otherwise, we need to + //shuffle the input vertexes and make sure all face normals are pointing outward + const Vec3V pa0(aBuf[0]); + const Vec3V pa1(aBuf[1]); + const Vec3V pa2(aBuf[2]); + const Vec3V pa3(aBuf[3]); + + const Vec3V pb0(bBuf[0]); + const Vec3V pb1(bBuf[1]); + const Vec3V pb2(bBuf[2]); + const Vec3V pb3(bBuf[3]); + + const Vec3V p0 = V3Sub(pa0, pb0); + const Vec3V p1 = V3Sub(pa1, pb1); + const Vec3V p2 = V3Sub(pa2, pb2); + const Vec3V p3 = V3Sub(pa3, pb3); + + const Vec3V v1 = V3Sub(p1, p0); + const Vec3V v2 = V3Sub(p2, p0); + + const Vec3V planeNormal = V3Normalize(V3Cross(v1, v2)); + + const FloatV signDist = V3Dot(planeNormal, V3Sub(p3, p0)); + + if (FAllGrtr(signDist, zero)) + { + //shuffle the input vertexes + const Vec3V tempA0 = aBuf[2]; + const Vec3V tempB0 = bBuf[2]; + aBuf[2] = aBuf[1]; + bBuf[2] = bBuf[1]; + aBuf[1] = tempA0; + bBuf[1] = tempB0; + } + + Facet * PX_RESTRICT f0 = addFacet(0, 1, 2, upper_bound); + Facet * PX_RESTRICT f1 = addFacet(0, 3, 1, upper_bound); + Facet * PX_RESTRICT f2 = addFacet(0, 2, 3, upper_bound); + Facet * PX_RESTRICT f3 = addFacet(1, 3, 2, upper_bound); + + if (heap.empty()) + return EPA_FAIL; + +#if EPA_DEBUG + PX_ASSERT(f0->m_planeDist >= -1e-2f); + PX_ASSERT(f1->m_planeDist >= -1e-2f); + PX_ASSERT(f2->m_planeDist >= -1e-2f); + PX_ASSERT(f3->m_planeDist >= -1e-2f); +#endif + + f0->link(0, f1, 2); + f0->link(1, f3, 2); + f0->link(2, f2, 0); + f1->link(0, f2, 2); + f1->link(1, f3, 0); + f2->link(1, f3, 1); + numVertsLocal = 4; + + break; + } + } + + + const FloatV minMargin = FMin(a.getMinMargin(), b.getMinMargin()); + const FloatV eps = FMul(minMargin, FLoad(0.1f)); + + Facet* PX_RESTRICT facet = NULL; + + Vec3V tempa, tempb, q; + + do + { + + facetManager.processDeferredIds(); + facet = heap.pop(); //get the shortest distance triangle of origin from the list + facet->m_inHeap = false; + + if (!facet->isObsolete()) + { + PxPrefetchLine(edgeBuffer.m_pEdges); + PxPrefetchLine(edgeBuffer.m_pEdges,128); + PxPrefetchLine(edgeBuffer.m_pEdges,256); + + const Vec3V planeNormal = facet->getPlaneNormal(); + const FloatV planeDist = facet->getPlaneDist(); + + tempa = a.support(planeNormal); + tempb = b.support(V3Neg(planeNormal)); + + q = V3Sub(tempa, tempb); + + PxPrefetchLine(&aBuf[numVertsLocal],128); + PxPrefetchLine(&bBuf[numVertsLocal],128); + + //calculate the distance from support point to the origin along the plane normal. Because the support point is search along + //the plane normal, which means the distance should be positive. However, if the origin isn't contained in the polytope, dist + //might be negative + const FloatV dist = V3Dot(q, planeNormal); + + const BoolV con0 = FIsGrtrOrEq(eps, FAbs(FSub(dist, planeDist))); + + if (BAllEqTTTT(con0)) + { + calculateContactInformation(aBuf, bBuf, facet, a, b, takeCoreShape, output); + + if (takeCoreShape) + { + const FloatV toleranceEps = FMul(FLoad(1e-3f), tolerenceLength); + const Vec3V dif = V3Sub(output.closestA, output.closestB); + const FloatV pen = FAdd(FAbs(output.penDep), toleranceEps); + const FloatV sqDif = V3Dot(dif, dif); + const FloatV length = FSel(FIsGrtr(sqDif, zero), FSqrt(sqDif), zero); + if (FAllGrtr(length, pen)) + return EPA_DEGENERATE; + } + return EPA_CONTACT; + + } + + //update the upper bound to the minimum between existing upper bound and the distance + upper_bound = FMin(upper_bound, dist); + + aBuf[numVertsLocal]=tempa; + bBuf[numVertsLocal]=tempb; + + const PxU32 index =PxU32(numVertsLocal++); + + // Compute the silhouette cast by the new vertex + // Note that the new vertex is on the positive side + // of the current facet, so the current facet will + // not be in the polytope. Start local search + // from this facet. + + edgeBuffer.MakeEmpty(); + + facet->silhouette(q, aBuf, bBuf, edgeBuffer, facetManager); + + if (!edgeBuffer.IsValid()) + { + calculateContactInformation(aBuf, bBuf, facet, a, b, takeCoreShape, output); + return EPA_DEGENERATE; + } + + Edge* PX_RESTRICT edge=edgeBuffer.Get(0); + + PxU32 bufferSize=edgeBuffer.Size(); + + //check to see whether we have enough space in the facet manager to create new facets + if(bufferSize > facetManager.getNumRemainingIDs()) + { + calculateContactInformation(aBuf, bBuf, facet, a, b, takeCoreShape, output); + return EPA_DEGENERATE; + } + + Facet *firstFacet = addFacet(edge->getTarget(), edge->getSource(),index, upper_bound); + PX_ASSERT(firstFacet); + firstFacet->link(0, edge->getFacet(), edge->getIndex()); + + Facet * PX_RESTRICT lastFacet = firstFacet; + +#if EPA_DEBUG + bool degenerate = false; + for(PxU32 i=1; (igetTarget(), edge->getSource(),index, upper_bound); + PX_ASSERT(newFacet); + const bool b0 = newFacet->link(0, edge->getFacet(), edge->getIndex()); + const bool b1 = newFacet->link(2, lastFacet, 1); + degenerate = degenerate || !b0 || !b1; + lastFacet = newFacet; + } + + if (degenerate) + PxDebugBreak(); +#else + for (PxU32 i = 1; igetTarget(), edge->getSource(), index, upper_bound); + newFacet->link(0, edge->getFacet(), edge->getIndex()); + newFacet->link(2, lastFacet, 1); + lastFacet = newFacet; + } +#endif + + firstFacet->link(2, lastFacet, 1); + } + facetManager.freeID(facet->m_FacetId); + + } + while((heap.size() > 0) && FAllGrtr(upper_bound, heap.top()->getPlaneDist()) && numVertsLocal != MaxSupportPoints); + + calculateContactInformation(aBuf, bBuf, facet, a, b, takeCoreShape, output); + return EPA_DEGENERATE; + } +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.h new file mode 100644 index 0000000..0f71a51 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPA.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_EPA_H +#define GU_EPA_H + +#include "GuGJKUtil.h" +#include "GuGJKType.h" + +namespace physx +{ + +namespace Gu +{ + //ML: The main entry point for EPA. + // + //This function returns one of three status codes: + //(1)EPA_FAIL: the algorithm failed to create a valid polytope(the origin wasn't inside the polytope) from the input simplex. + //(2)EPA_CONTACT : the algorithm found the MTD and converged successfully. + //(3)EPA_DEGENERATE: the algorithm cannot make further progress and the result is unknown. + + GjkStatus epaPenetration( const GjkConvex& a, //convex a in the space of convex b + const GjkConvex& b, //convex b + const PxU8* PX_RESTRICT aInd, //warm start index for convex a to create an initial simplex + const PxU8* PX_RESTRICT bInd, //warm start index for convex b to create an initial simplex + const PxU8 size, //number of warm-start indices + const bool takeCoreShape, //indicates whether we take support point from the core shape or surface of capsule/sphere + const aos::FloatV tolerenceLength, //the length of meter + GjkOutput& output); //result + + GjkStatus epaPenetration( const GjkConvex& a, //convex a in the space of convex b + const GjkConvex& b, //convex b + const aos::Vec3V* PX_RESTRICT aPnt, //warm start point for convex a to create an initial simplex + const aos::Vec3V* PX_RESTRICT bPnt, //warm start point for convex b to create an initial simplex + const PxU8 size, //number of warm-start indices + const bool takeCoreShape, //indicates whether we take support point from the core shape or surface of capsule/sphere + const aos::FloatV tolerenceLength, //the length of meter + GjkOutput& output); //result +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPAFacet.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPAFacet.h new file mode 100644 index 0000000..121e5f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuEPAFacet.h @@ -0,0 +1,304 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_EPA_FACET_H +#define GU_EPA_FACET_H + +#include "foundation/PxVecMath.h" +#include "foundation/PxFPU.h" +#include "foundation/PxUtilities.h" +#include "CmIDPool.h" + +#if (defined __GNUC__ && defined _DEBUG) +#define PX_EPA_FORCE_INLINE +#else +#define PX_EPA_FORCE_INLINE PX_FORCE_INLINE +#endif + +#define EPA_DEBUG 0 + +namespace physx +{ +#define MaxEdges 32 +#define MaxFacets 64 +#define MaxSupportPoints 64 + +namespace Gu +{ + const PxU32 lookUp[3] = {1, 2, 0}; + + PX_FORCE_INLINE PxU32 incMod3(PxU32 i) { return lookUp[i]; } + + class EdgeBuffer; + class Edge; + typedef Cm::InlineDeferredIDPool EPAFacetManager; + + class Facet + { + public: + + Facet() + { + } + + PX_FORCE_INLINE Facet(const PxU32 _i0, const PxU32 _i1, const PxU32 _i2) + : m_obsolete(false), m_inHeap(false) + { + m_indices[0]= PxToI8(_i0); + m_indices[1]= PxToI8(_i1); + m_indices[2]= PxToI8(_i2); + + m_adjFacets[0] = m_adjFacets[1] = m_adjFacets[2] = NULL; + m_adjEdges[0] = m_adjEdges[1] = m_adjEdges[2] = -1; + } + + + PX_FORCE_INLINE void invalidate() + { + m_adjFacets[0] = m_adjFacets[1] = m_adjFacets[2] = NULL; + m_adjEdges[0] = m_adjEdges[1] = m_adjEdges[2] = -1; + } + + PX_FORCE_INLINE bool Valid() + { + return (m_adjFacets[0] != NULL) & (m_adjFacets[1] != NULL) & (m_adjFacets[2] != NULL); + } + + PX_FORCE_INLINE PxU32 operator[](const PxU32 i) const + { + return PxU32(m_indices[i]); + } + + //create ajacency information + bool link(const PxU32 edge0, Facet* PX_RESTRICT facet, const PxU32 edge1); + + PX_FORCE_INLINE bool isObsolete() const { return m_obsolete; } + + //calculate the signed distance from a point to a plane + PX_FORCE_INLINE aos::FloatV getPlaneDist(const aos::Vec3VArg p, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf) const; + + //check to see whether the triangle is a valid triangle, calculate plane normal and plane distance at the same time + aos::BoolV isValid2(const PxU32 i0, const PxU32 i1, const PxU32 i2, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, + const aos::FloatVArg upper); + + //return the absolute value for the plane distance from origin + PX_FORCE_INLINE aos::FloatV getPlaneDist() const + { + return aos::FLoad(m_planeDist); + } + + //return the plane normal + PX_FORCE_INLINE aos::Vec3V getPlaneNormal()const + { + return m_planeNormal; + } + + //calculate the closest points for a shape pair + void getClosestPoint(const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, aos::Vec3V& closestA, + aos::Vec3V& closestB); + + //calculate the closest points for a shape pair + //void getClosestPoint(const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, aos::FloatV& v, aos::FloatV& w); + + //performs a flood fill over the boundary of the current polytope. + void silhouette(const aos::Vec3VArg w, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, EdgeBuffer& edgeBuffer, EPAFacetManager& manager); + + + //m_planeDist is positive + bool operator <(const Facet& b) const + { + return m_planeDist < b.m_planeDist; + } + + //store all the boundary facets for the new polytope in the edgeBuffer and free indices when an old facet isn't part of the boundary anymore + PX_FORCE_INLINE void silhouette(const PxU32 index, const aos::Vec3VArg w, const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, EdgeBuffer& edgeBuffer, + EPAFacetManager& manager); + + aos::Vec3V m_planeNormal; //16 + PxF32 m_planeDist; +#if EPA_DEBUG + PxF32 m_lambda1; + PxF32 m_lambda2; +#endif + + Facet* PX_RESTRICT m_adjFacets[3]; //the triangle adjacent to edge i in this triangle //32 + PxI8 m_adjEdges[3]; //the edge connected with the corresponding triangle //35 + PxI8 m_indices[3]; //the index of vertices of the triangle //38 + bool m_obsolete; //a flag to denote whether the triangle are still part of the bundeary of the new polytope //39 + bool m_inHeap; //a flag to indicate whether the triangle is in the heap //40 + PxU8 m_FacetId; //41 //73 + + }; + + + class Edge + { + public: + PX_FORCE_INLINE Edge() {} + PX_FORCE_INLINE Edge(Facet * PX_RESTRICT facet, const PxU32 index) : m_facet(facet), m_index(index) {} + PX_FORCE_INLINE Edge(const Edge& other) : m_facet(other.m_facet), m_index(other.m_index){} + + PX_FORCE_INLINE Edge& operator = (const Edge& other) + { + m_facet = other.m_facet; + m_index = other.m_index; + return *this; + } + + PX_FORCE_INLINE Facet *getFacet() const { return m_facet; } + PX_FORCE_INLINE PxU32 getIndex() const { return m_index; } + + //get out the associated start vertex index in this edge from the facet + PX_FORCE_INLINE PxU32 getSource() const + { + PX_ASSERT(m_index < 3); + return (*m_facet)[m_index]; + } + + //get out the associated end vertex index in this edge from the facet + PX_FORCE_INLINE PxU32 getTarget() const + { + PX_ASSERT(m_index < 3); + return (*m_facet)[incMod3(m_index)]; + } + + Facet* PX_RESTRICT m_facet; + PxU32 m_index; + }; + + + class EdgeBuffer + { + public: + EdgeBuffer() : m_Size(0), m_OverFlow(false) + { + } + + Edge* Insert(Facet* PX_RESTRICT facet, const PxU32 index) + { + if (m_Size < MaxEdges) + { + Edge* pEdge = &m_pEdges[m_Size++]; + pEdge->m_facet = facet; + pEdge->m_index = index; + return pEdge; + } + m_OverFlow = true; + return NULL; + } + + Edge* Get(const PxU32 index) + { + PX_ASSERT(index < m_Size); + return &m_pEdges[index]; + } + + PxU32 Size() + { + return m_Size; + } + + bool IsValid() + { + return m_Size > 0 && !m_OverFlow; + } + + void MakeEmpty() + { + m_Size = 0; + m_OverFlow = false; + } + + Edge m_pEdges[MaxEdges]; + PxU32 m_Size; + bool m_OverFlow; + }; + + //ML: calculate MTD points for a shape pair + PX_FORCE_INLINE void Facet::getClosestPoint(const aos::Vec3V* PX_RESTRICT aBuf, const aos::Vec3V* PX_RESTRICT bBuf, aos::Vec3V& closestA, + aos::Vec3V& closestB) + { + using namespace aos; + + const Vec3V pa0(aBuf[m_indices[0]]); + const Vec3V pa1(aBuf[m_indices[1]]); + const Vec3V pa2(aBuf[m_indices[2]]); + + const Vec3V pb0(bBuf[m_indices[0]]); + const Vec3V pb1(bBuf[m_indices[1]]); + const Vec3V pb2(bBuf[m_indices[2]]); + + const Vec3V p0 = V3Sub(pa0, pb0); + const Vec3V p1 = V3Sub(pa1, pb1); + const Vec3V p2 = V3Sub(pa2, pb2); + + const Vec3V v0 = V3Sub(p1, p0); + const Vec3V v1 = V3Sub(p2, p0); + + const Vec3V closestP = V3Scale(m_planeNormal, FLoad(m_planeDist)); + const Vec3V v2 = V3Sub(closestP, p0); + //calculate barycentric coordinates + const FloatV d00 = V3Dot(v0, v0); + const FloatV d01 = V3Dot(v0, v1); + const FloatV d11 = V3Dot(v1, v1); + + const FloatV d20 = V3Dot(v2, v0); + const FloatV d21 = V3Dot(v2, v1); + + const FloatV det = FNegScaleSub(d01, d01, FMul(d00, d11));//FSub( FMul(v1dv1, v2dv2), FMul(v1dv2, v1dv2) ); // non-negative + const FloatV recip = FSel(FIsGrtr(det, FEps()), FRecip(det), FZero()); + + const FloatV lambda1 = FMul(FNegScaleSub(d01, d21, FMul(d11, d20)), recip); + const FloatV lambda2 = FMul(FNegScaleSub(d01, d20, FMul(d00, d21)), recip); + +#if EPA_DEBUG + FStore(lambda1, &m_lambda1); + FStore(lambda2, &m_lambda2); +#endif + + const FloatV u = FSub(FOne(), FAdd(lambda1, lambda2)); + closestA = V3ScaleAdd(pa0, u, V3ScaleAdd(pa1, lambda1, V3Scale(pa2, lambda2))); + closestB = V3ScaleAdd(pb0, u, V3ScaleAdd(pb1, lambda1, V3Scale(pb2, lambda2))); + } + + //ML: create adjacency informations for both facets + PX_FORCE_INLINE bool Facet::link(const PxU32 edge0, Facet * PX_RESTRICT facet, const PxU32 edge1) + { + m_adjFacets[edge0] = facet; + m_adjEdges[edge0] = PxToI8(edge1); + facet->m_adjFacets[edge1] = this; + facet->m_adjEdges[edge1] = PxToI8(edge0); + + return (m_indices[edge0] == facet->m_indices[incMod3(edge1)]) && (m_indices[incMod3(edge0)] == facet->m_indices[edge1]); + } + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJK.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJK.h new file mode 100644 index 0000000..c0ad41b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJK.h @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJK_H +#define GU_GJK_H + + +#include "GuGJKType.h" +#include "GuGJKUtil.h" +#include "GuConvexSupportTable.h" +#include "GuGJKSimplex.h" +#include "foundation/PxFPU.h" + +#define GJK_SEPERATING_AXIS_VALIDATE 0 + +namespace physx +{ +namespace Gu +{ + + class ConvexV; + +#if GJK_SEPERATING_AXIS_VALIDATE + template + static void validateSeparatingAxis(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg separatingAxis) + { + using namespace aos; + const Vec3V minV0 = a.ConvexA::support(V3Neg(separatingAxis)); + const Vec3V maxV0 = a.ConvexA::support(separatingAxis); + + const Vec3V minV1 = b.ConvexB::support(V3Neg(separatingAxis)); + const Vec3V maxV1 = b.ConvexB::support(separatingAxis); + + const FloatV min0 = V3Dot(minV0, separatingAxis); + const FloatV max0 = V3Dot(maxV0, separatingAxis); + + const FloatV min1 = V3Dot(minV1, separatingAxis); + const FloatV max1 = V3Dot(maxV1, separatingAxis); + + PX_ASSERT(FAllGrtr(min1, max0) || FAllGrtr(min0, max1)); + } +#endif + + + /* + + initialSearchDir :initial search direction in the mincowsky sum, it should be in the local space of ConvexB + closestA :it is the closest point in ConvexA in the local space of ConvexB if acceptance threshold is sufficent large. Otherwise, it will be garbage + closestB :it is the closest point in ConvexB in the local space of ConvexB if acceptance threshold is sufficent large. Otherwise, it will be garbage + normal :normal pointing from ConvexA to ConvexB in the local space of ConvexB if acceptance threshold is sufficent large. Otherwise, it will be garbage + distance :the distance of the closest points between ConvexA and ConvexB if acceptance threshold is sufficent large. Otherwise, it will be garbage + contactDist :the distance which we will generate contact information if ConvexA and ConvexB are both separated within contactDist + */ + + //*Each convex has + //* a support function + //* a margin - the amount by which we shrunk the shape for a convex or box. If the shape are sphere/capsule, margin is the radius + //* a minMargin - some percentage of margin, which is used to determine the termination condition for gjk + + //*We'll report: + //* GJK_NON_INTERSECT if the sign distance between the shapes is greater than the sum of the margins and the the contactDistance + //* GJK_CLOSE if the minimum distance between the shapes is less than the sum of the margins and the the contactDistance + //* GJK_CONTACT if the two shapes are overlapped with each other + template + GjkStatus gjk(const ConvexA& a, const ConvexB& b, const aos::Vec3V& initialSearchDir, const aos::FloatV& contactDist, aos::Vec3V& closestA, aos::Vec3V& closestB, aos::Vec3V& normal, + aos::FloatV& distance) + { + using namespace aos; + Vec3V Q[4]; + Vec3V A[4]; + Vec3V B[4]; + + const FloatV zero = FZero(); + PxU32 size=0; + + //const Vec3V _initialSearchDir = aToB.p; + Vec3V closest = V3Sel(FIsGrtr(V3Dot(initialSearchDir, initialSearchDir), zero), initialSearchDir, V3UnitX()); + Vec3V v = V3Normalize(closest); + + // ML: eps2 is the square value of an epsilon value which applied in the termination condition for two shapes overlap. + // GJK will terminate based on sq(v) < eps and indicate that two shapes are overlapping. + // we calculate the eps based on 10% of the minimum margin of two shapes + const FloatV tenPerc = FLoad(0.1f); + const FloatV minMargin = FMin(a.getMinMargin(), b.getMinMargin()); + const FloatV eps = FMax(FLoad(1e-6f), FMul(minMargin, tenPerc)); + + // ML:epsRel is square value of 1.5% which applied to the distance of a closest point(v) to the origin. + // If |v|- v/|v|.dot(w) < epsRel*|v|, + // two shapes are clearly separated, GJK terminate and return non intersect. + // This adjusts the termination condition based on the length of v + // which avoids ill-conditioned terminations. + const FloatV epsRel = FLoad(0.000225f);//1.5%. + + FloatV dist = FMax(); + FloatV prevDist; + Vec3V prevClos, prevDir; + + const BoolV bTrue = BTTTT(); + BoolV bNotTerminated = bTrue; + BoolV bNotDegenerated = bTrue; + + //ML: we treate sphere as a point and capsule as segment in the support function, so that we need to add on radius + const BoolV aQuadratic = a.isMarginEqRadius(); + const BoolV bQuadratic = b.isMarginEqRadius(); + + const FloatV sumMargin = FAdd(FSel(aQuadratic, a.getMargin(), zero), FSel(bQuadratic, b.getMargin(), zero)); + const FloatV separatingDist = FAdd(sumMargin, contactDist); + const FloatV relDif = FSub(FOne(), epsRel); + + do + { + prevDist = dist; + prevClos = closest; + prevDir = v; + + //de-virtualize, we don't need to use a normalize direction to get the support point + //this will allow the cpu better pipeline the normalize calculation while it does the + //support map + const Vec3V supportA=a.ConvexA::support(V3Neg(closest)); + const Vec3V supportB=b.ConvexB::support(closest); + + //calculate the support point + const Vec3V support = V3Sub(supportA, supportB); + + const FloatV signDist = V3Dot(v, support); + + if(FAllGrtr(signDist, separatingDist)) + { + //ML:gjk found a separating axis for these two objects and the distance is large than the seperating distance, gjk might not converage so that + //we won't generate contact information +#if GJK_SEPERATING_AXIS_VALIDATE + validateSeparatingAxis(a, b, v); +#endif + return GJK_NON_INTERSECT; + } + + const BoolV con = BAnd(FIsGrtr(signDist, sumMargin), FIsGrtr(signDist, FMul(relDif, dist))); + + if(BAllEqTTTT(con)) + { + //ML:: gjk converage and we get the closest point information + Vec3V closA, closB; + //normal point from A to B + const Vec3V n = V3Neg(v); + getClosestPoint(Q, A, B, closest, closA, closB, size); + closestA = V3Sel(aQuadratic, V3ScaleAdd(n, a.getMargin(), closA), closA); + closestB = V3Sel(bQuadratic, V3NegScaleSub(n, b.getMargin(), closB), closB); + distance = FMax(zero, FSub(dist, sumMargin)); + normal = n;//V3Normalize(V3Neg(closest)); + return GJK_CLOSE; + } + + PX_ASSERT(size < 4); + A[size]=supportA; + B[size]=supportB; + Q[size++]=support; + + //calculate the closest point between two convex hull + closest = GJKCPairDoSimplex(Q, A, B, support, size); + + dist = V3Length(closest); + v = V3ScaleInv(closest, dist); + bNotDegenerated = FIsGrtr(prevDist, dist); + bNotTerminated = BAnd(FIsGrtr(dist, eps), bNotDegenerated); + }while(BAllEqTTTT(bNotTerminated)); + + if(BAllEqTTTT(bNotDegenerated)) + { + //GJK_CONTACT + distance = zero; + return GJK_CONTACT; + } + + //GJK degenerated, use the previous closest point + const FloatV acceptancePerc = FLoad(0.2f); + const FloatV acceptanceMargin = FMul(acceptancePerc, FMin(a.getMargin(), b.getMargin())); + const FloatV acceptanceDist = FSel(FIsGrtr(sumMargin, zero), sumMargin, acceptanceMargin); + Vec3V closA, closB; + const Vec3V n = V3Neg(prevDir);//V3Normalize(V3Neg(prevClos)); + getClosestPoint(Q, A, B, prevClos, closA, closB, size); + closestA = V3Sel(aQuadratic, V3ScaleAdd(n, a.getMargin(), closA), closA); + closestB = V3Sel(bQuadratic, V3NegScaleSub(n, b.getMargin(), closB), closB); + normal = n; + dist = FMax(zero, FSub(prevDist, sumMargin)); + distance = dist; + + return FAllGrtr(dist, acceptanceDist) ? GJK_CLOSE: GJK_CONTACT; + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKPenetration.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKPenetration.h new file mode 100644 index 0000000..5e73d46 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKPenetration.h @@ -0,0 +1,334 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJK_PENETRATION_H +#define GU_GJK_PENETRATION_H + + +#include "GuConvexSupportTable.h" +#include "GuGJKSimplex.h" +#include "GuVecConvexHullNoScale.h" +#include "GuGJKUtil.h" +#include "foundation/PxUtilities.h" +#include "GuGJKType.h" + +#define GJK_VALIDATE 0 + + +namespace physx +{ +namespace Gu +{ + + class ConvexV; + + + PX_FORCE_INLINE void assignWarmStartValue(PxU8* PX_RESTRICT aIndices, PxU8* PX_RESTRICT bIndices, PxU8& size_, PxI32* PX_RESTRICT aInd, PxI32* PX_RESTRICT bInd, PxU32 size ) + { + if(aIndices) + { + PX_ASSERT(bIndices); + size_ = PxTo8(size); + for(PxU32 i=0; i + PX_NOINLINE GjkStatus gjkPenetration(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg contactDist, const bool takeCoreShape, + PxU8* PX_RESTRICT aIndices, PxU8* PX_RESTRICT bIndices, aos::Vec3V* PX_RESTRICT aPoints, aos::Vec3V* PX_RESTRICT bPoints, PxU8& warmStartSize, + GjkOutput& output) + { + using namespace aos; + + //ML: eps is the threshold that uses to determine whether two (shrunk) shapes overlap. We calculate eps2 based on 10% of the minimum margin of two shapes + const FloatV minMargin = FMin(a.ConvexA::getMinMargin(), b.ConvexB::getMinMargin()); + const FloatV eps = FMul(minMargin, FLoad(0.1f)); + + //const FloatV eps2 = FMul(_eps2, _eps2); + //ML: epsRel2 is the square of 0.01. This is used to scale the square distance of a closest point to origin to determine whether two shrunk shapes overlap in the margin, but + //they don't overlap. + //const FloatV epsRel2 = FMax(FLoad(0.0001), eps2); + + // ML:epsRel is square value of 1.5% which applied to the distance of a closest point(v) to the origin. + // If |v|- v/|v|.dot(w) < epsRel*|v|=>(|v|*(1-epsRel) < v/|v|.dot(w)), + // two shapes are clearly separated, GJK terminate and return non intersect. + // This adjusts the termination condition based on the length of v + // which avoids ill-conditioned terminations. + const FloatV epsRel = FLoad(0.000225f);//1.5%. + const FloatV relDif = FSub(FOne(), epsRel); + + const FloatV zero = FZero(); + + //capsule/sphere will have margin which is its radius + const FloatV marginA = a.getMargin(); + const FloatV marginB = b.getMargin(); + + const BoolV aQuadratic = a.isMarginEqRadius(); + const BoolV bQuadratic = b.isMarginEqRadius(); + const FloatV tMarginA = FSel(aQuadratic, marginA, zero); + const FloatV tMarginB = FSel(bQuadratic, marginB, zero); + + const FloatV sumMargin = FAdd(tMarginA, tMarginB); + const FloatV sumExpandedMargin = FAdd(sumMargin, contactDist); + + FloatV dist = FMax(); + FloatV prevDist = dist; + const Vec3V zeroV = V3Zero(); + Vec3V prevClos = zeroV; + + const BoolV bTrue = BTTTT(); + BoolV bNotTerminated = bTrue; + BoolV bNotDegenerated = bTrue; + Vec3V closest; + + Vec3V Q[4]; + Vec3V* A = aPoints; + Vec3V* B = bPoints; + PxI32 aInd[4]; + PxI32 bInd[4]; + Vec3V supportA = zeroV, supportB = zeroV, support=zeroV; + Vec3V v; + + PxU32 size = 0;//_size; + + + //ML: if _size!=0, which means we pass in the previous frame simplex so that we can warm-start the simplex. + //In this case, GJK will normally terminate in one iteration + if(warmStartSize != 0) + { + for(PxU32 i=0; i sqMargin * sq(v), which means the original objects do not intesect, GJK terminate with GJK_NON_INTERSECT. + //(3)two shapes don't overlap. However, they interect within margin distance. if sq(v)- vw < epsRel2*sq(v), this means the shrunk shapes interect in the margin, + // GJK terminate with GJK_CONTACT. + while(BAllEqTTTT(bNotTerminated)) + { + //prevDist, prevClos are used to store the previous iteration's closest point and the square distance from the closest point + //to origin in Mincowski space + prevDist = dist; + prevClos = closest; + + //de-virtualize + supportA = a.ConvexA::support(V3Neg(closest), aInd[size]); + supportB = b.ConvexB::support(closest, bInd[size]); + + //calculate the support point + support = V3Sub(supportA, supportB); + + const FloatV vw = V3Dot(v, support); + if(FAllGrtr(vw, sumExpandedMargin)) + { + assignWarmStartValue(aIndices, bIndices, warmStartSize, aInd, bInd, size); + return GJK_NON_INTERSECT; + } + + //if(FAllGrtr(FMul(epsRel, dist), FSub(dist, vw))) + if(FAllGrtr(vw, FMul(dist, relDif))) + { + assignWarmStartValue(aIndices, bIndices, warmStartSize, aInd, bInd, size); + PX_ASSERT(FAllGrtr(dist, FEps())); + //const Vec3V n = V3ScaleInv(closest, dist);//normalise + output.normal = v; + Vec3V closA, closB; + getClosestPoint(Q, A, B, closest, closA, closB, size); + //ML: if one of the shape is sphere/capsule and the takeCoreShape flag is true, the contact point for sphere/capsule will be the sphere center or a point in the + //capsule segment. This will increase the stability for the manifold recycling code. Otherwise, we will return a contact point on the surface for sphere/capsule + //while the takeCoreShape flag is set to be false + if(takeCoreShape) + { + output.closestA= closA; + output.closestB = closB; + output.penDep = dist; + + } + else + { + //This is for capsule/sphere want to take the surface point. For box/convex, + //we need to get rid of margin + output.closestA = V3NegScaleSub(v, tMarginA, closA); + output.closestB = V3ScaleAdd(v, tMarginB, closB); + output.penDep = FSub(dist, sumMargin); + } + + return GJK_CONTACT; + } + + A[size] = supportA; + B[size] = supportB; + Q[size++]=support; + PX_ASSERT(size <= 4); + + //calculate the closest point between two convex hull + closest = GJKCPairDoSimplex(Q, A, B, aInd, bInd, support, size); + + dist = V3Length(closest); + v = V3ScaleInv(closest, dist); + + bNotDegenerated = FIsGrtr(prevDist, dist); + bNotTerminated = BAnd(FIsGrtr(dist, eps), bNotDegenerated); + } + + if(BAllEqFFFF(bNotDegenerated)) + { + assignWarmStartValue(aIndices, bIndices, warmStartSize, aInd, bInd, size-1); + + //Reset back to older closest point + dist = prevDist; + closest = prevClos;//V3Sub(closA, closB); + Vec3V closA, closB; + getClosestPoint(Q, A, B, closest, closA, closB, size); + + //PX_ASSERT(FAllGrtr(dist, FEps())); + const Vec3V n = V3ScaleInv(prevClos, prevDist);//normalise + output.normal = n; + + output.searchDir = v; + + if(takeCoreShape) + { + output.closestA = closA; + output.closestB = closB; + output.penDep = dist; + } + else + { + //This is for capsule/sphere want to take the surface point. For box/convex, + //we need to get rid of margin + output.closestA = V3NegScaleSub(n, tMarginA, closA); + output.closestB = V3ScaleAdd(n, tMarginB, closB); + output.penDep = FSub(dist, sumMargin); + if (FAllGrtrOrEq(sumMargin, dist)) + return GJK_CONTACT; + } + + return GJK_DEGENERATE; + } + else + { + //this two shapes are deeply intersected with each other, we need to use EPA algorithm to calculate MTD + assignWarmStartValue(aIndices, bIndices, warmStartSize, aInd, bInd, size); + return EPA_CONTACT; + + } + } + template + PX_NOINLINE GjkStatus gjkPenetration(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg contactDist, const bool takeCoreShape, + PxU8* PX_RESTRICT aIndices, PxU8* PX_RESTRICT bIndices, PxU8& warmStartSize, + GjkOutput& output) + { + aos::Vec3V aPoints[4], bPoints[4]; + return gjkPenetration(a, b, initialSearchDir, contactDist, takeCoreShape, aIndices, bIndices, aPoints, bPoints, warmStartSize, output); + } + template + PX_NOINLINE GjkStatus gjkPenetration(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg contactDist, const bool takeCoreShape, + aos::Vec3V* PX_RESTRICT aPoints, aos::Vec3V* PX_RESTRICT bPoints, PxU8& warmStartSize, + GjkOutput& output) + { + PxU8 aIndices[4], bIndices[4]; + return gjkPenetration(a, b, initialSearchDir, contactDist, takeCoreShape, aIndices, bIndices, aPoints, bPoints, warmStartSize, output); + } +}//Gu + +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKRaycast.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKRaycast.h new file mode 100644 index 0000000..1ef136a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKRaycast.h @@ -0,0 +1,288 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJKRAYCAST_H +#define GU_GJKRAYCAST_H + +#include "GuGJKType.h" +#include "GuGJKSimplex.h" +#include "GuConvexSupportTable.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" + +namespace physx +{ + +namespace Gu +{ + /* + ConvexA is in the local space of ConvexB + lambda : the time of impact(TOI) + initialLambda : the start time of impact value (disable) + s : the sweep ray origin + r : the normalized sweep ray direction scaled by the sweep distance. r should be in ConvexB's space + normal : the contact normal + inflation : the amount by which we inflate the swept shape. If the inflated shapes aren't initially-touching, + the TOI will return the time at which both shapes are at a distance equal to inflation separated. If inflation is 0 + the TOI will return the time at which both shapes are touching. + */ + template + bool gjkRaycast(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg initialDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation) + { + PX_UNUSED(initialLambda); + + using namespace aos; + + const FloatV inflation = FLoad(_inflation); + const Vec3V zeroV = V3Zero(); + const FloatV zero = FZero(); + const FloatV one = FOne(); + const BoolV bTrue = BTTTT(); + + const FloatV maxDist = FLoad(PX_MAX_REAL); + + FloatV _lambda = zero;//initialLambda; + Vec3V x = V3ScaleAdd(r, _lambda, s); + PxU32 size=1; + + //const Vec3V dir = V3Sub(a.getCenter(), b.getCenter()); + const Vec3V _initialSearchDir = V3Sel(FIsGrtr(V3Dot(initialDir, initialDir), FEps()), initialDir, V3UnitX()); + const Vec3V initialSearchDir = V3Normalize(_initialSearchDir); + + const Vec3V initialSupportA(a.ConvexA::support(V3Neg(initialSearchDir))); + const Vec3V initialSupportB( b.ConvexB::support(initialSearchDir)); + + Vec3V Q[4] = {V3Sub(initialSupportA, initialSupportB), zeroV, zeroV, zeroV}; //simplex set + Vec3V A[4] = {initialSupportA, zeroV, zeroV, zeroV}; //ConvexHull a simplex set + Vec3V B[4] = {initialSupportB, zeroV, zeroV, zeroV}; //ConvexHull b simplex set + + Vec3V v = V3Neg(Q[0]); + Vec3V supportA = initialSupportA; + Vec3V supportB = initialSupportB; + Vec3V support = Q[0]; + + const FloatV minMargin = FMin(a.ConvexA::getSweepMargin(), b.ConvexB::getSweepMargin()); + const FloatV eps1 = FMul(minMargin, FLoad(0.1f)); + const FloatV inflationPlusEps(FAdd(eps1, inflation)); + const FloatV eps2 = FMul(eps1, eps1); + + const FloatV inflation2 = FMul(inflationPlusEps, inflationPlusEps); + + Vec3V clos(Q[0]); + Vec3V preClos = clos; + //Vec3V closA(initialSupportA); + FloatV sDist = V3Dot(v, v); + FloatV minDist = sDist; + //Vec3V closAA = initialSupportA; + //Vec3V closBB = initialSupportB; + + BoolV bNotTerminated = FIsGrtr(sDist, eps2); + BoolV bNotDegenerated = bTrue; + + Vec3V nor = v; + + while(BAllEqTTTT(bNotTerminated)) + { + minDist = sDist; + preClos = clos; + + const Vec3V vNorm = V3Normalize(v); + const Vec3V nvNorm = V3Neg(vNorm); + + supportA=a.ConvexA::support(vNorm); + supportB=V3Add(x, b.ConvexB::support(nvNorm)); + + //calculate the support point + support = V3Sub(supportA, supportB); + const Vec3V w = V3Neg(support); + const FloatV vw = FSub(V3Dot(vNorm, w), inflationPlusEps); + if(FAllGrtr(vw, zero)) + { + const FloatV vr = V3Dot(vNorm, r); + if(FAllGrtrOrEq(vr, zero)) + { + return false; + } + else + { + const FloatV _oldLambda = _lambda; + _lambda = FSub(_lambda, FDiv(vw, vr)); + if(FAllGrtr(_lambda, _oldLambda)) + { + if(FAllGrtr(_lambda, one)) + { + return false; + } + const Vec3V bPreCenter = x; + x = V3ScaleAdd(r, _lambda, s); + + const Vec3V offSet =V3Sub(x, bPreCenter); + const Vec3V b0 = V3Add(B[0], offSet); + const Vec3V b1 = V3Add(B[1], offSet); + const Vec3V b2 = V3Add(B[2], offSet); + + B[0] = b0; + B[1] = b1; + B[2] = b2; + + Q[0]=V3Sub(A[0], b0); + Q[1]=V3Sub(A[1], b1); + Q[2]=V3Sub(A[2], b2); + + supportB = V3Add(x, b.ConvexB::support(nvNorm)); + support = V3Sub(supportA, supportB); + minDist = maxDist; + nor = v; + //size=0; + } + } + } + + PX_ASSERT(size < 4); + A[size]=supportA; + B[size]=supportB; + Q[size++]=support; + + //calculate the closest point between two convex hull + clos = GJKCPairDoSimplex(Q, A, B, support, size); + v = V3Neg(clos); + sDist = V3Dot(clos, clos); + + bNotDegenerated = FIsGrtr(minDist, sDist); + bNotTerminated = BAnd(FIsGrtr(sDist, inflation2), bNotDegenerated); + } + + const BoolV aQuadratic = a.isMarginEqRadius(); + //ML:if the Minkowski sum of two objects are too close to the original(eps2 > sDist), we can't take v because we will lose lots of precision. Therefore, we will take + //previous configuration's normal which should give us a reasonable approximation. This effectively means that, when we do a sweep with inflation, we always keep v because + //the shapes converge separated. If we do a sweep without inflation, we will usually use the previous configuration's normal. + nor = V3Sel(BAnd(FIsGrtr(sDist, eps2), bNotDegenerated), v, nor); + nor = V3Neg(V3NormalizeSafe(nor, V3Zero())); + normal = nor; + lambda = _lambda; + + const Vec3V closestP = V3Sel(bNotDegenerated, clos, preClos); + Vec3V closA = zeroV, closB = zeroV; + getClosestPoint(Q, A, B, closestP, closA, closB, size); + closestA = V3Sel(aQuadratic, V3NegScaleSub(nor, a.getMargin(), closA), closA); + + return true; + } + + + /* + ConvexA is in the local space of ConvexB + lambda : the time of impact(TOI) + initialLambda : the start time of impact value (disable) + s : the sweep ray origin in ConvexB's space + r : the normalized sweep ray direction scaled by the sweep distance. r should be in ConvexB's space + normal : the contact normal in ConvexB's space + closestA : the tounching contact in ConvexB's space + inflation : the amount by which we inflate the swept shape. If the inflated shapes aren't initially-touching, + the TOI will return the time at which both shapes are at a distance equal to inflation separated. If inflation is 0 + the TOI will return the time at which both shapes are touching. + */ + template + bool gjkRaycastPenetration(const ConvexA& a, const ConvexB& b, const aos::Vec3VArg initialDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, + aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation, const bool initialOverlap) + { + using namespace aos; + Vec3V closA; + Vec3V norm; + FloatV _lambda; + if(gjkRaycast(a, b, initialDir, initialLambda, s, r, _lambda, norm, closA, _inflation)) + { + const FloatV zero = FZero(); + lambda = _lambda; + if(FAllEq(_lambda, zero) && initialOverlap) + { + //time of impact is zero, the sweep shape is intesect, use epa to get the normal and contact point + const FloatV contactDist = getSweepContactEps(a.getMargin(), b.getMargin()); + + FloatV sDist(zero); + PxU8 aIndices[4]; + PxU8 bIndices[4]; + PxU8 size=0; + GjkOutput output; + + //PX_COMPILE_TIME_ASSERT(typename Shrink::Type != Gu::BoxV); + +#ifdef USE_VIRTUAL_GJK + GjkStatus status = gjkPenetration(a, b, +#else + typename ConvexA::ConvexGeomType convexA = a.getGjkConvex(); + typename ConvexB::ConvexGeomType convexB = b.getGjkConvex(); + + GjkStatus status = gjkPenetration(convexA, convexB, +#endif + initialDir, contactDist, false, aIndices, bIndices, size, output); + //norm = V3Neg(norm); + if(status == GJK_CONTACT) + { + closA = output.closestA; + sDist = output.penDep; + norm = output.normal; + } + else if(status == EPA_CONTACT) + { + status = epaPenetration(a, b, aIndices, bIndices, size, false, FLoad(1.f), output); + + if (status == EPA_CONTACT || status == EPA_DEGENERATE) + { + closA = output.closestA; + sDist = output.penDep; + norm = output.normal; + } + else + { + //ML: if EPA fail, we will use the ray direction as the normal and set pentration to be zero + closA = V3Zero(); + sDist = zero; + norm = V3Normalize(V3Neg(r)); + } + } + else + { + //ML:: this will be gjk degenerate case. However, we can still + //reply on the previous iteration's closest feature information + closA = output.closestA; + sDist = output.penDep; + norm = output.normal; + } + lambda = FMin(zero, sDist); + } + closestA = closA; + normal = norm; + return true; + } + return false; + } +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp new file mode 100644 index 0000000..a9b750e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.cpp @@ -0,0 +1,215 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuGJKSimplex.h" + +namespace physx +{ +namespace Gu +{ + + using namespace aos; + + static Vec3V getClosestPtPointTriangle(Vec3V* PX_RESTRICT Q, const BoolVArg bIsOutside4, PxU32* indices, PxU32& size) + { + FloatV bestSqDist = FMax(); + + PxU32 _indices[3] = {0, 1, 2}; + + Vec3V closestPt = V3Zero(); + + if(BAllEqTTTT(BGetX(bIsOutside4))) + { + //use the original indices, size, v and w + bestSqDist = closestPtPointTriangleBaryCentric(Q[0], Q[1], Q[2], indices, size, closestPt); + } + + if(BAllEqTTTT(BGetY(bIsOutside4))) + { + + PxU32 _size = 3; + _indices[0] = 0; _indices[1] = 2; _indices[2] = 3; + Vec3V tClosestPt; + const FloatV sqDist = closestPtPointTriangleBaryCentric(Q[0], Q[2], Q[3], _indices, _size, tClosestPt); + + const BoolV con = FIsGrtr(bestSqDist, sqDist); + if(BAllEqTTTT(con)) + { + closestPt = tClosestPt; + bestSqDist = sqDist; + + indices[0] = _indices[0]; + indices[1] = _indices[1]; + indices[2] = _indices[2]; + + size = _size; + } + } + + if(BAllEqTTTT(BGetZ(bIsOutside4))) + { + PxU32 _size = 3; + + _indices[0] = 0; _indices[1] = 3; _indices[2] = 1; + + Vec3V tClosestPt; + const FloatV sqDist = closestPtPointTriangleBaryCentric(Q[0], Q[3], Q[1], _indices, _size, tClosestPt); + + const BoolV con = FIsGrtr(bestSqDist, sqDist); + if(BAllEqTTTT(con)) + { + closestPt = tClosestPt; + bestSqDist = sqDist; + + indices[0] = _indices[0]; + indices[1] = _indices[1]; + indices[2] = _indices[2]; + + size = _size; + } + + } + + if(BAllEqTTTT(BGetW(bIsOutside4))) + { + + + PxU32 _size = 3; + _indices[0] = 1; _indices[1] = 3; _indices[2] = 2; + Vec3V tClosestPt; + const FloatV sqDist = closestPtPointTriangleBaryCentric(Q[1], Q[3], Q[2], _indices, _size, tClosestPt); + + const BoolV con = FIsGrtr(bestSqDist, sqDist); + + if(BAllEqTTTT(con)) + { + closestPt = tClosestPt; + bestSqDist = sqDist; + + indices[0] = _indices[0]; + indices[1] = _indices[1]; + indices[2] = _indices[2]; + + size = _size; + } + } + + return closestPt; + } + + PX_NOALIAS Vec3V closestPtPointTetrahedron(Vec3V* PX_RESTRICT Q, Vec3V* PX_RESTRICT A, Vec3V* PX_RESTRICT B, PxU32& size) + { + + const FloatV eps = FLoad(1e-4f); + const Vec3V a = Q[0]; + const Vec3V b = Q[1]; + const Vec3V c = Q[2]; + const Vec3V d = Q[3]; + + //degenerated + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V n = V3Normalize(V3Cross(ab, ac)); + const FloatV signDist = V3Dot(n, V3Sub(d, a)); + if(FAllGrtr(eps, FAbs(signDist))) + { + size = 3; + return closestPtPointTriangle(Q, A, B, size); + } + + const BoolV bIsOutside4 = PointOutsideOfPlane4(a, b, c, d); + + if(BAllEqFFFF(bIsOutside4)) + { + //All inside + return V3Zero(); + } + + PxU32 indices[3] = {0, 1, 2}; + + const Vec3V closest = getClosestPtPointTriangle(Q, bIsOutside4, indices, size); + + const Vec3V q0 = Q[indices[0]]; const Vec3V q1 = Q[indices[1]]; const Vec3V q2 = Q[indices[2]]; + const Vec3V a0 = A[indices[0]]; const Vec3V a1 = A[indices[1]]; const Vec3V a2 = A[indices[2]]; + const Vec3V b0 = B[indices[0]]; const Vec3V b1 = B[indices[1]]; const Vec3V b2 = B[indices[2]]; + Q[0] = q0; Q[1] = q1; Q[2] = q2; + A[0] = a0; A[1] = a1; A[2] = a2; + B[0] = b0; B[1] = b1; B[2] = b2; + + return closest; + } + + PX_NOALIAS Vec3V closestPtPointTetrahedron(Vec3V* PX_RESTRICT Q, Vec3V* PX_RESTRICT A, Vec3V* PX_RESTRICT B, PxI32* PX_RESTRICT aInd, PxI32* PX_RESTRICT bInd, PxU32& size) + { + + const FloatV eps = FLoad(1e-4f); + const Vec3V zeroV = V3Zero(); + + const Vec3V a = Q[0]; + const Vec3V b = Q[1]; + const Vec3V c = Q[2]; + const Vec3V d = Q[3]; + + //degenerated + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V n = V3Normalize(V3Cross(ab, ac)); + const FloatV signDist = V3Dot(n, V3Sub(d, a)); + if(FAllGrtr(eps, FAbs(signDist))) + { + size = 3; + return closestPtPointTriangle(Q, A, B, aInd, bInd, size); + } + + const BoolV bIsOutside4 = PointOutsideOfPlane4(a, b, c, d); + + if(BAllEqFFFF(bIsOutside4)) + { + //All inside + return zeroV; + } + + PxU32 indices[3] = {0, 1, 2}; + const Vec3V closest = getClosestPtPointTriangle(Q, bIsOutside4, indices, size); + + const Vec3V q0 = Q[indices[0]]; const Vec3V q1 = Q[indices[1]]; const Vec3V q2 = Q[indices[2]]; + const Vec3V a0 = A[indices[0]]; const Vec3V a1 = A[indices[1]]; const Vec3V a2 = A[indices[2]]; + const Vec3V b0 = B[indices[0]]; const Vec3V b1 = B[indices[1]]; const Vec3V b2 = B[indices[2]]; + const PxI32 _aInd0 = aInd[indices[0]]; const PxI32 _aInd1 = aInd[indices[1]]; const PxI32 _aInd2 = aInd[indices[2]]; + const PxI32 _bInd0 = bInd[indices[0]]; const PxI32 _bInd1 = bInd[indices[1]]; const PxI32 _bInd2 = bInd[indices[2]]; + Q[0] = q0; Q[1] = q1; Q[2] = q2; + A[0] = a0; A[1] = a1; A[2] = a2; + B[0] = b0; B[1] = b1; B[2] = b2; + aInd[0] = _aInd0; aInd[1] = _aInd1; aInd[2] = _aInd2; + bInd[0] = _bInd0; bInd[1] = _bInd1; bInd[2] = _bInd2; + + return closest; + } +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.h new file mode 100644 index 0000000..0e513ac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKSimplex.h @@ -0,0 +1,448 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJKSIMPLEX_H +#define GU_GJKSIMPLEX_H + +#include "foundation/PxVecMath.h" +#include "GuBarycentricCoordinates.h" + +#if (defined __GNUC__ && defined _DEBUG) +#define PX_GJK_INLINE PX_INLINE +#define PX_GJK_FORCE_INLINE PX_INLINE +#else +#define PX_GJK_INLINE PX_INLINE +#define PX_GJK_FORCE_INLINE PX_FORCE_INLINE +#endif + + +namespace physx +{ +namespace Gu +{ + PX_NOALIAS aos::Vec3V closestPtPointTetrahedron(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* PX_RESTRICT A, aos::Vec3V* PX_RESTRICT B, PxU32& size); + + PX_NOALIAS aos::Vec3V closestPtPointTetrahedron(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* PX_RESTRICT A, aos::Vec3V* PX_RESTRICT B, PxI32* PX_RESTRICT aInd, PxI32* PX_RESTRICT bInd, + PxU32& size); + + PX_NOALIAS PX_FORCE_INLINE aos::BoolV PointOutsideOfPlane4(const aos::Vec3VArg _a, const aos::Vec3VArg _b, const aos::Vec3VArg _c, const aos::Vec3VArg _d) + { + using namespace aos; + + const Vec4V zero = V4Load(0.f); + + const Vec3V ab = V3Sub(_b, _a); + const Vec3V ac = V3Sub(_c, _a); + const Vec3V ad = V3Sub(_d, _a); + const Vec3V bd = V3Sub(_d, _b); + const Vec3V bc = V3Sub(_c, _b); + + const Vec3V v0 = V3Cross(ab, ac); + const Vec3V v1 = V3Cross(ac, ad); + const Vec3V v2 = V3Cross(ad, ab); + const Vec3V v3 = V3Cross(bd, bc); + + const FloatV signa0 = V3Dot(v0, _a); + const FloatV signa1 = V3Dot(v1, _a); + const FloatV signa2 = V3Dot(v2, _a); + const FloatV signd3 = V3Dot(v3, _a); + + const FloatV signd0 = V3Dot(v0, _d); + const FloatV signd1 = V3Dot(v1, _b); + const FloatV signd2 = V3Dot(v2, _c); + const FloatV signa3 = V3Dot(v3, _b); + + const Vec4V signa = V4Merge(signa0, signa1, signa2, signa3); + const Vec4V signd = V4Merge(signd0, signd1, signd2, signd3); + return V4IsGrtrOrEq(V4Mul(signa, signd), zero);//same side, outside of the plane + } + + PX_NOALIAS PX_FORCE_INLINE aos::Vec3V closestPtPointSegment(aos::Vec3V* PX_RESTRICT Q, PxU32& size) + { + using namespace aos; + const Vec3V a = Q[0]; + const Vec3V b = Q[1]; + + //const Vec3V origin = V3Zero(); + const FloatV zero = FZero(); + const FloatV one = FOne(); + + //Test degenerated case + const Vec3V ab = V3Sub(b, a); + const FloatV denom = V3Dot(ab, ab); + const Vec3V ap = V3Neg(a);//V3Sub(origin, a); + const FloatV nom = V3Dot(ap, ab); + const BoolV con = FIsGrtrOrEq(FEps(), denom);//FIsEq(denom, zero); + //TODO - can we get rid of this branch? The problem is size, which isn't a vector! + if(BAllEqTTTT(con)) + { + size = 1; + return Q[0]; + } + + /* const PxU32 count = BAllEq(con, bTrue); + size = 2 - count;*/ + + const FloatV tValue = FClamp(FDiv(nom, denom), zero, one); + return V3ScaleAdd(ab, tValue, a); + } + + PX_FORCE_INLINE void getClosestPoint(const aos::Vec3V* PX_RESTRICT Q, const aos::Vec3V* PX_RESTRICT A, const aos::Vec3V* PX_RESTRICT B, const aos::Vec3VArg closest, aos::Vec3V& closestA, aos::Vec3V& closestB, const PxU32 size) + { + using namespace aos; + + switch(size) + { + case 1: + { + closestA = A[0]; + closestB = B[0]; + break; + } + case 2: + { + FloatV v; + barycentricCoordinates(closest, Q[0], Q[1], v); + const Vec3V av = V3Sub(A[1], A[0]); + const Vec3V bv = V3Sub(B[1], B[0]); + closestA = V3ScaleAdd(av, v, A[0]); + closestB = V3ScaleAdd(bv, v, B[0]); + + break; + } + case 3: + { + //calculate the Barycentric of closest point p in the mincowsky sum + FloatV v, w; + barycentricCoordinates(closest, Q[0], Q[1], Q[2], v, w); + + const Vec3V av0 = V3Sub(A[1], A[0]); + const Vec3V av1 = V3Sub(A[2], A[0]); + const Vec3V bv0 = V3Sub(B[1], B[0]); + const Vec3V bv1 = V3Sub(B[2], B[0]); + + closestA = V3Add(A[0], V3Add(V3Scale(av0, v), V3Scale(av1, w))); + closestB = V3Add(B[0], V3Add(V3Scale(bv0, v), V3Scale(bv1, w))); + } + }; + } + + PX_NOALIAS PX_GJK_FORCE_INLINE aos::FloatV closestPtPointTriangleBaryCentric(const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c, + PxU32* PX_RESTRICT indices, PxU32& size, aos::Vec3V& closestPt) + { + using namespace aos; + + size = 3; + const FloatV zero = FZero(); + const FloatV eps = FEps(); + + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + + const Vec3V n = V3Cross(ab, ac); + //ML: if the shape is oblong, the degeneracy test sometime can't catch the degeneracy in the tetraheron. Therefore, we need to make sure we still can ternimate with the previous + //triangle by returning the maxinum distance. + const FloatV nn = V3Dot(n, n); + if (FAllEq(nn, zero)) + return FMax(); + + //const FloatV va = FNegScaleSub(d5, d4, FMul(d3, d6));//edge region of BC + //const FloatV vb = FNegScaleSub(d1, d6, FMul(d5, d2));//edge region of AC + //const FloatV vc = FNegScaleSub(d3, d2, FMul(d1, d4));//edge region of AB + + //const FloatV va = V3Dot(n, V3Cross(b, c));//edge region of BC, signed area rbc, u = S(rbc)/S(abc) for a + //const FloatV vb = V3Dot(n, V3Cross(c, a));//edge region of AC, signed area rac, v = S(rca)/S(abc) for b + //const FloatV vc = V3Dot(n, V3Cross(a, b));//edge region of AB, signed area rab, w = S(rab)/S(abc) for c + + const VecCrossV crossA = V3PrepareCross(a); + const VecCrossV crossB = V3PrepareCross(b); + const VecCrossV crossC = V3PrepareCross(c); + const Vec3V bCrossC = V3Cross(crossB, crossC); + const Vec3V cCrossA = V3Cross(crossC, crossA); + const Vec3V aCrossB = V3Cross(crossA, crossB); + + const FloatV va = V3Dot(n, bCrossC);//edge region of BC, signed area rbc, u = S(rbc)/S(abc) for a + const FloatV vb = V3Dot(n, cCrossA);//edge region of AC, signed area rac, v = S(rca)/S(abc) for b + const FloatV vc = V3Dot(n, aCrossB);//edge region of AB, signed area rab, w = S(rab)/S(abc) for c + + const BoolV isFacePoints = BAnd(FIsGrtrOrEq(va, zero), BAnd(FIsGrtrOrEq(vb, zero), FIsGrtrOrEq(vc, zero))); + + //face region + if(BAllEqTTTT(isFacePoints)) + { + const FloatV t = FDiv(V3Dot(n, a), nn); + const Vec3V q = V3Scale(n, t); + closestPt = q; + return V3Dot(q, q); + } + + const Vec3V ap = V3Neg(a); + const Vec3V bp = V3Neg(b); + const Vec3V cp = V3Neg(c); + + const FloatV d1 = V3Dot(ab, ap); // snom + const FloatV d2 = V3Dot(ac, ap); // tnom + const FloatV d3 = V3Dot(ab, bp); // -sdenom + const FloatV d4 = V3Dot(ac, bp); // unom = d4 - d3 + const FloatV d5 = V3Dot(ab, cp); // udenom = d5 - d6 + const FloatV d6 = V3Dot(ac, cp); // -tdenom + + const FloatV unom = FSub(d4, d3); + const FloatV udenom = FSub(d5, d6); + + size = 2; + //check if p in edge region of AB + const BoolV con30 = FIsGrtrOrEq(zero, vc); + const BoolV con31 = FIsGrtrOrEq(d1, zero); + const BoolV con32 = FIsGrtrOrEq(zero, d3); + const BoolV con3 = BAnd(con30, BAnd(con31, con32));//edge AB region + if(BAllEqTTTT(con3)) + { + const FloatV toRecipAB = FSub(d1, d3); + const FloatV recipAB = FSel(FIsGrtr(FAbs(toRecipAB), eps), FRecip(toRecipAB), zero); + const FloatV t = FMul(d1, recipAB); + const Vec3V q = V3ScaleAdd(ab, t, a); + closestPt = q; + return V3Dot(q, q); + } + + //check if p in edge region of BC + const BoolV con40 = FIsGrtrOrEq(zero, va); + const BoolV con41 = FIsGrtrOrEq(d4, d3); + const BoolV con42 = FIsGrtrOrEq(d5, d6); + const BoolV con4 = BAnd(con40, BAnd(con41, con42)); //edge BC region + if(BAllEqTTTT(con4)) + { + const Vec3V bc = V3Sub(c, b); + const FloatV toRecipBC = FAdd(unom, udenom); + const FloatV recipBC = FSel(FIsGrtr(FAbs(toRecipBC), eps), FRecip(toRecipBC), zero); + const FloatV t = FMul(unom, recipBC); + indices[0] = indices[1]; + indices[1] = indices[2]; + const Vec3V q = V3ScaleAdd(bc, t, b); + closestPt = q; + return V3Dot(q, q); + } + + //check if p in edge region of AC + const BoolV con50 = FIsGrtrOrEq(zero, vb); + const BoolV con51 = FIsGrtrOrEq(d2, zero); + const BoolV con52 = FIsGrtrOrEq(zero, d6); + + const BoolV con5 = BAnd(con50, BAnd(con51, con52));//edge AC region + if(BAllEqTTTT(con5)) + { + const FloatV toRecipAC = FSub(d2, d6); + const FloatV recipAC = FSel(FIsGrtr(FAbs(toRecipAC), eps), FRecip(toRecipAC), zero); + const FloatV t = FMul(d2, recipAC); + indices[1]=indices[2]; + const Vec3V q = V3ScaleAdd(ac, t, a); + closestPt = q; + return V3Dot(q, q); + } + + size = 1; + //check if p in vertex region outside a + const BoolV con00 = FIsGrtrOrEq(zero, d1); // snom <= 0 + const BoolV con01 = FIsGrtrOrEq(zero, d2); // tnom <= 0 + const BoolV con0 = BAnd(con00, con01); // vertex region a + if(BAllEqTTTT(con0)) + { + closestPt = a; + return V3Dot(a, a); + } + + //check if p in vertex region outside b + const BoolV con10 = FIsGrtrOrEq(d3, zero); + const BoolV con11 = FIsGrtrOrEq(d3, d4); + const BoolV con1 = BAnd(con10, con11); // vertex region b + if(BAllEqTTTT(con1)) + { + indices[0] = indices[1]; + closestPt = b; + return V3Dot(b, b); + } + + //p is in vertex region outside c + indices[0] = indices[2]; + closestPt = c; + return V3Dot(c, c); + } + + PX_NOALIAS PX_GJK_FORCE_INLINE aos::Vec3V closestPtPointTriangle(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* A, aos::Vec3V* B, PxU32& size) + { + using namespace aos; + + size = 3; + + const FloatV eps = FEps(); + const Vec3V a = Q[0]; + const Vec3V b = Q[1]; + const Vec3V c = Q[2]; + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V signArea = V3Cross(ab, ac);//0.5*(abXac) + const FloatV area = V3Dot(signArea, signArea); + if(FAllGrtrOrEq(eps, area)) + { + //degenerate + size = 2; + return closestPtPointSegment(Q, size); + } + + PxU32 _size; + PxU32 indices[3]={0, 1, 2}; + Vec3V closestPt; + closestPtPointTriangleBaryCentric(a, b, c, indices, _size, closestPt); + + if(_size != 3) + { + const Vec3V q0 = Q[indices[0]]; const Vec3V q1 = Q[indices[1]]; + const Vec3V a0 = A[indices[0]]; const Vec3V a1 = A[indices[1]]; + const Vec3V b0 = B[indices[0]]; const Vec3V b1 = B[indices[1]]; + + Q[0] = q0; Q[1] = q1; + A[0] = a0; A[1] = a1; + B[0] = b0; B[1] = b1; + + size = _size; + } + + return closestPt; + } + + PX_NOALIAS PX_GJK_FORCE_INLINE aos::Vec3V closestPtPointTriangle(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* A, aos::Vec3V* B, PxI32* PX_RESTRICT aInd, PxI32* PX_RESTRICT bInd, + PxU32& size) + { + using namespace aos; + + size = 3; + + const FloatV eps = FEps(); + + const Vec3V a = Q[0]; + const Vec3V b = Q[1]; + const Vec3V c = Q[2]; + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V signArea = V3Cross(ab, ac);//0.5*(abXac) + const FloatV area = V3Dot(signArea, signArea); + if(FAllGrtrOrEq(eps, area)) + { + //degenerate + size = 2; + return closestPtPointSegment(Q, size); + } + + PxU32 _size; + PxU32 indices[3]={0, 1, 2}; + Vec3V closestPt; + closestPtPointTriangleBaryCentric(a, b, c, indices, _size, closestPt); + + if(_size != 3) + { + const Vec3V q0 = Q[indices[0]]; const Vec3V q1 = Q[indices[1]]; + const Vec3V a0 = A[indices[0]]; const Vec3V a1 = A[indices[1]]; + const Vec3V b0 = B[indices[0]]; const Vec3V b1 = B[indices[1]]; + const PxI32 aInd0 = aInd[indices[0]]; const PxI32 aInd1 = aInd[indices[1]]; + const PxI32 bInd0 = bInd[indices[0]]; const PxI32 bInd1 = bInd[indices[1]]; + + Q[0] = q0; Q[1] = q1; + A[0] = a0; A[1] = a1; + B[0] = b0; B[1] = b1; + aInd[0] = aInd0; aInd[1] = aInd1; + bInd[0] = bInd0; bInd[1] = bInd1; + + size = _size; + } + + return closestPt; + } + + PX_NOALIAS PX_FORCE_INLINE aos::Vec3V GJKCPairDoSimplex(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* PX_RESTRICT A, aos::Vec3V* PX_RESTRICT B, const aos::Vec3VArg support, + PxU32& size) + { + using namespace aos; + + //const PxU32 tempSize = size; + //calculate a closest from origin to the simplex + switch(size) + { + case 1: + { + return support; + } + case 2: + { + return closestPtPointSegment(Q, size); + } + case 3: + { + return closestPtPointTriangle(Q, A, B, size); + } + case 4: + return closestPtPointTetrahedron(Q, A, B, size); + default: + PX_ASSERT(0); + } + return support; + } + + PX_NOALIAS PX_FORCE_INLINE aos::Vec3V GJKCPairDoSimplex(aos::Vec3V* PX_RESTRICT Q, aos::Vec3V* PX_RESTRICT A, aos::Vec3V* PX_RESTRICT B, PxI32* PX_RESTRICT aInd, PxI32* PX_RESTRICT bInd, + const aos::Vec3VArg support, PxU32& size) + { + using namespace aos; + + //const PxU32 tempSize = size; + //calculate a closest from origin to the simplex + switch(size) + { + case 1: + { + return support; + } + case 2: + { + return closestPtPointSegment(Q, size); + } + case 3: + { + return closestPtPointTriangle(Q, A, B, aInd, bInd, size); + } + case 4: + return closestPtPointTetrahedron(Q, A, B, aInd, bInd, size); + default: + PX_ASSERT(0); + } + return support; + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp new file mode 100644 index 0000000..61f0873 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.cpp @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuGJK.h" +#include "GuGJKRaycast.h" +#include "GuGJKPenetration.h" +#include "GuGJKTest.h" + +namespace physx +{ +namespace Gu +{ +using namespace aos; + +GjkStatus testGjk(const GjkConvex& a, const GjkConvex& b, const Vec3VArg initialSearchDir, const FloatVArg contactDist, Vec3V& closestA, Vec3V& closestB, Vec3V& normal, FloatV& dist) +{ + return gjk(a, b, initialSearchDir, contactDist, closestA, closestB, normal, dist); +} + +bool testGjkRaycast(const GjkConvex& a, const GjkConvex& b, const Vec3VArg initialSearchDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, aos::FloatV& lambda, + aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal inflation) +{ + return gjkRaycast(a, b, initialSearchDir, initialLambda, s, r, lambda, normal, closestA, inflation); +} + +GjkStatus testGjkPenetration(const GjkConvex& a, const GjkConvex& b, const Vec3VArg initialSearchDir, const FloatVArg contactDist, + PxU8* aIndices, PxU8* bIndices, PxU8& size, GjkOutput& output) +{ + return gjkPenetration(a, b, initialSearchDir, contactDist, true, + aIndices, bIndices, size, output); +} + +GjkStatus testEpaPenetration(const GjkConvex& a, const GjkConvex& b, const PxU8* aIndices, const PxU8* bIndices, const PxU8 size, + GjkOutput& output) +{ + return epaPenetration(a, b, aIndices, bIndices, size, true, aos::FLoad(1.f), output); +} + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.h new file mode 100644 index 0000000..619e92b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKTest.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJK_TEST_H +#define GU_GJK_TEST_H + +#include "common/PxPhysXCommonConfig.h" +#include "GuGJKUtil.h" + +namespace physx +{ +namespace Gu +{ + struct GjkConvex; + + PX_PHYSX_COMMON_API GjkStatus testGjk(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg contactDist, aos::Vec3V& closestA, aos::Vec3V& closestB, + aos::Vec3V& normal, aos::FloatV& dist); + + PX_PHYSX_COMMON_API bool testGjkRaycast(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg initialLambda, const aos::Vec3VArg s, const aos::Vec3VArg r, + aos::FloatV& lambda, aos::Vec3V& normal, aos::Vec3V& closestA, const PxReal _inflation, const bool initialOverlap); + + PX_PHYSX_COMMON_API GjkStatus testGjkPenetration(const GjkConvex& a, const GjkConvex& b, const aos::Vec3VArg initialSearchDir, const aos::FloatVArg contactDist, + PxU8* aIndices, PxU8* bIndices, PxU8& size, GjkOutput& output); + + PX_PHYSX_COMMON_API GjkStatus testEpaPenetration(const GjkConvex& a, const GjkConvex& b, const PxU8* aIndices, const PxU8* bIndices, const PxU8 size, + GjkOutput& output); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKType.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKType.h new file mode 100644 index 0000000..7699f19 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKType.h @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJKTYPE_H +#define GU_GJKTYPE_H + +#include "GuVecConvex.h" +#include "foundation/PxVecTransform.h" + +namespace physx +{ +namespace Gu +{ + class ConvexHullV; + class ConvexHullNoScaleV; + class BoxV; + + template struct ConvexGeom { typedef Convex Type; }; + template <> struct ConvexGeom { typedef ConvexHullV Type; }; + template <> struct ConvexGeom { typedef ConvexHullNoScaleV Type; }; + template <> struct ConvexGeom { typedef BoxV Type; }; + + struct GjkConvex + { + GjkConvex(const ConvexV& convex) : mConvex(convex) {} + virtual ~GjkConvex() {} + + PX_FORCE_INLINE aos::FloatV getMinMargin() const { return mConvex.getMinMargin(); } + PX_FORCE_INLINE aos::BoolV isMarginEqRadius() const { return mConvex.isMarginEqRadius(); } + PX_FORCE_INLINE bool getMarginIsRadius() const { return mConvex.getMarginIsRadius(); } + PX_FORCE_INLINE aos::FloatV getMargin() const { return mConvex.getMargin(); } + + template + PX_FORCE_INLINE const Convex& getConvex() const { return static_cast(mConvex); } + + virtual aos::Vec3V supportPoint(const PxI32 index) const { return doVirtualSupportPoint(index); } + virtual aos::Vec3V support(const aos::Vec3VArg v) const { return doVirtualSupport(v); } + virtual aos::Vec3V support(const aos::Vec3VArg dir, PxI32& index) const { return doVirtualSupport(dir, index); } + virtual aos::FloatV getSweepMargin() const { return doVirtualGetSweepMargin(); } + virtual aos::Vec3V getCenter() const = 0; + + protected: + const ConvexV& mConvex; + + private: + // PT: following functions call the v-table. I think this curious pattern is needed for the de-virtualization + // approach used in the GJK code, combined with the GuGJKTest file that is only used externally. + aos::Vec3V doVirtualSupportPoint(const PxI32 index) const { return supportPoint(index); } + aos::Vec3V doVirtualSupport(const aos::Vec3VArg v) const { return support(v); } + aos::Vec3V doVirtualSupport(const aos::Vec3VArg dir, PxI32& index) const { return support(dir, index); } + aos::FloatV doVirtualGetSweepMargin() const { return getSweepMargin(); } + + //PX_NOCOPY(GjkConvex) + GjkConvex& operator = (const GjkConvex&); + }; + + template + struct LocalConvex : public GjkConvex + { + LocalConvex(const Convex& convex) : GjkConvex(convex){} + + // PT: I think we omit the virtual on purpose here, for the de-virtualization approach, i.e. the code calls these + // functions directly (bypassing the v-table). In fact I think we don't need virtuals at all here, it's probably + // only for external cases and/or cases where we want to reduce code size. + // The mix of virtual/force-inline/inline below is confusing/unclear. + + // GjkConvex + PX_FORCE_INLINE aos::Vec3V supportPoint(const PxI32 index) const { return getConvex().supportPoint(index); } + aos::Vec3V support(const aos::Vec3VArg v) const { return getConvex().supportLocal(v); } + aos::Vec3V support(const aos::Vec3VArg dir, PxI32& index) const { return getConvex().supportLocal(dir, index); } + PX_INLINE aos::FloatV getSweepMargin() const { return getConvex().getSweepMargin(); } + virtual aos::Vec3V getCenter() const { return getConvex().getCenter(); } + //~GjkConvex + + //ML: we can't force inline function, otherwise win modern will throw compiler error + PX_INLINE LocalConvex::Type > getGjkConvex() const + { + return LocalConvex::Type >(static_cast::Type&>(GjkConvex::mConvex)); + } + + typedef LocalConvex::Type > ConvexGeomType; + + typedef Convex Type; + + private: + //PX_NOCOPY(LocalConvex) + LocalConvex& operator = (const LocalConvex&); + }; + + template + struct RelativeConvex : public GjkConvex + { + RelativeConvex(const Convex& convex, const aos::PxMatTransformV& aToB) : GjkConvex(convex), mAToB(aToB), mAToBTransposed(aToB) + { + aos::V3Transpose(mAToBTransposed.rot.col0, mAToBTransposed.rot.col1, mAToBTransposed.rot.col2); + } + + // GjkConvex + PX_FORCE_INLINE aos::Vec3V supportPoint(const PxI32 index) const { return mAToB.transform(getConvex().supportPoint(index)); } + aos::Vec3V support(const aos::Vec3VArg v) const { return getConvex().supportRelative(v, mAToB, mAToBTransposed); } + aos::Vec3V support(const aos::Vec3VArg dir, PxI32& index) const { return getConvex().supportRelative(dir, mAToB, mAToBTransposed, index); } + PX_INLINE aos::FloatV getSweepMargin() const { return getConvex().getSweepMargin(); } + virtual aos::Vec3V getCenter() const { return mAToB.transform(getConvex().getCenter()); } + //~GjkConvex + + PX_FORCE_INLINE const aos::PxMatTransformV& getRelativeTransform() const { return mAToB; } + + //ML: we can't force inline function, otherwise win modern will throw compiler error + PX_INLINE RelativeConvex::Type > getGjkConvex() const + { + return RelativeConvex::Type >(static_cast::Type&>(GjkConvex::mConvex), mAToB); + } + + typedef RelativeConvex::Type > ConvexGeomType; + + typedef Convex Type; + + private: + //PX_NOCOPY(RelativeConvex) + RelativeConvex& operator = (const RelativeConvex&); + + const aos::PxMatTransformV& mAToB; + aos::PxMatTransformV mAToBTransposed; // PT: precomputed mAToB transpose (because 'rotate' is faster than 'rotateInv') + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKUtil.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKUtil.h new file mode 100644 index 0000000..6f6aa43 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuGJKUtil.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_GJKUTIL_H +#define GU_GJKUTIL_H + +#include "foundation/PxVecMath.h" + +/* + This file is used to avoid the inner loop cross DLL calls +*/ +namespace physx +{ +namespace Gu +{ + +enum GjkStatus +{ + GJK_NON_INTERSECT, // two shapes doesn't intersect + GJK_CLOSE, // two shapes doesn't intersect and gjk algorithm will return closest point information + GJK_CONTACT, // two shapes overlap within margin + GJK_UNDEFINED, // undefined status + GJK_DEGENERATE, // gjk can't converage + + EPA_CONTACT, // two shapes intersect + EPA_DEGENERATE, // epa can't converage + EPA_FAIL // epa fail to construct an initial polygon to work with +}; + +struct GjkOutput +{ +public: + GjkOutput() + { + using namespace aos; + closestA = closestB = normal = V3Zero(); + penDep = FZero(); + } + aos::Vec3V closestA; + aos::Vec3V closestB; + aos::Vec3V normal; + aos::Vec3V searchDir; + aos::FloatV penDep; +}; + +}//Gu +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecBox.h new file mode 100644 index 0000000..447ae17 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecBox.h @@ -0,0 +1,225 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_BOX_H +#define GU_VEC_BOX_H + +/** \addtogroup geomutils +@{ +*/ +#include "foundation/PxTransform.h" +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxBoxGeometry.h" +#include "foundation/PxVecTransform.h" +#include "GuVecConvex.h" +#include "GuConvexSupportTable.h" + +namespace physx +{ +PX_PHYSX_COMMON_API extern const aos::BoolV boxVertexTable[8]; + +namespace Gu +{ + +#define BOX_MARGIN_RATIO 0.15f +#define BOX_MIN_MARGIN_RATIO 0.05f +#define BOX_SWEEP_MARGIN_RATIO 0.05f + +#define BOX_MARGIN_CCD_RATIO 0.01f +#define BOX_MIN_MARGIN_CCD_RATIO 0.005f + + + class CapsuleV; + + + PX_FORCE_INLINE void CalculateBoxMargin(const aos::Vec3VArg extent, PxReal& margin, PxReal& minMargin, PxReal& sweepMargin, + const PxReal marginR = BOX_MARGIN_RATIO, const PxReal minMarginR = BOX_MIN_MARGIN_RATIO) + { + using namespace aos; + + PxReal minExtent; + const FloatV min = V3ExtractMin(extent); + FStore(min, &minExtent); + + margin = minExtent * marginR; + minMargin = minExtent * minMarginR; + sweepMargin = minExtent * BOX_SWEEP_MARGIN_RATIO; + } + + PX_FORCE_INLINE aos::FloatV CalculateBoxTolerance(const aos::Vec3VArg extent) + { + using namespace aos; + + const FloatV r0 = FLoad(0.01f); + const FloatV min = V3ExtractMin(extent);//FMin(V3GetX(extent), FMin(V3GetY(extent), V3GetZ(extent))); + return FMul(min, r0); + } + + //This method is called in the PCM contact gen for the refreshing contacts + PX_FORCE_INLINE aos::FloatV CalculatePCMBoxMargin(const aos::Vec3VArg extent, const PxReal toleranceLength, const PxReal toleranceMarginRatio = BOX_MARGIN_RATIO) + { + using namespace aos; + + const FloatV min = V3ExtractMin(extent);//FMin(V3GetX(extent), FMin(V3GetY(extent), V3GetZ(extent))); + const FloatV toleranceMargin = FLoad(toleranceLength * toleranceMarginRatio); + return FMin(FMul(min, FLoad(BOX_MARGIN_RATIO)), toleranceMargin); + } + + PX_FORCE_INLINE aos::FloatV CalculateMTDBoxMargin(const aos::Vec3VArg extent) + { + using namespace aos; + + const FloatV min = V3ExtractMin(extent);//FMin(V3GetX(extent), FMin(V3GetY(extent), V3GetZ(extent))); + return FMul(min, FLoad(BOX_MARGIN_RATIO)); + } + + class BoxV : public ConvexV + { + public: + + /** + \brief Constructor + */ + PX_INLINE BoxV() : ConvexV(ConvexType::eBOX) + { + } + + PX_FORCE_INLINE BoxV(const aos::Vec3VArg origin, const aos::Vec3VArg extent) : + ConvexV(ConvexType::eBOX, origin), extents(extent) + { + CalculateBoxMargin(extent, margin, minMargin, sweepMargin); + } + + //this constructor is used by the CCD system + PX_FORCE_INLINE BoxV(const PxGeometry& geom) : ConvexV(ConvexType::eBOX, aos::V3Zero()) + { + using namespace aos; + const PxBoxGeometry& boxGeom = static_cast(geom); + const Vec3V extent = aos::V3LoadU(boxGeom.halfExtents); + extents = extent; + CalculateBoxMargin(extent, margin, minMargin, sweepMargin, BOX_MARGIN_CCD_RATIO, BOX_MIN_MARGIN_CCD_RATIO); + } + + /** + \brief Destructor + */ + PX_INLINE ~BoxV() + { + } + + PX_FORCE_INLINE void resetMargin(const PxReal toleranceLength) + { + minMargin = PxMin(toleranceLength * BOX_MIN_MARGIN_RATIO, minMargin); + } + + //! Assignment operator + PX_FORCE_INLINE const BoxV& operator=(const BoxV& other) + { + center = other.center; + extents = other.extents; + margin = other.margin; + minMargin = other.minMargin; + sweepMargin = other.sweepMargin; + return *this; + } + + PX_FORCE_INLINE void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* verts)const + { + using namespace aos; + + for(PxU32 i=0; i(geom); + + const Vec3V axis = V3Scale(V3UnitX(), FLoad(capsuleGeom.halfHeight)); + const FloatV r = FLoad(capsuleGeom.radius); + p0 = axis; + p1 = V3Neg(axis); + radius = r; + FStore(radius, &margin); + FStore(radius, &minMargin); + FStore(radius, &sweepMargin); + bMarginIsRadius = true; + } + + /** + \brief Constructor + + \param _radius Radius of the capsule. + */ + + /** + \brief Destructor + */ + PX_INLINE ~CapsuleV() + { + } + + PX_FORCE_INLINE void initialize(const aos::Vec3VArg _p0, const aos::Vec3VArg _p1, const aos::FloatVArg _radius) + { + using namespace aos; + radius = _radius; + p0 = _p0; + p1 = _p1; + FStore(radius, &margin); + FStore(radius, &minMargin); + FStore(radius, &sweepMargin); + center = V3Scale(V3Add(_p0, _p1), FHalf()); + } + + PX_INLINE aos::Vec3V computeDirection() const + { + return aos::V3Sub(p1, p0); + } + + PX_FORCE_INLINE aos::FloatV getRadius() const + { + return radius; + } + + PX_FORCE_INLINE aos::Vec3V supportPoint(const PxI32 index)const + { + return (&p0)[1-index]; + } + + PX_FORCE_INLINE void getIndex(const aos::BoolV con, PxI32& index)const + { + using namespace aos; + const VecI32V v = VecI32V_From_BoolV(con); + const VecI32V t = VecI32V_And(v, VecI32V_One()); + PxI32_From_VecI32V(t, &index); + } + + PX_FORCE_INLINE void setCenter(const aos::Vec3VArg _center) + { + using namespace aos; + Vec3V offset = V3Sub(_center, center); + center = _center; + + p0 = V3Add(p0, offset); + p1 = V3Add(p1, offset); + } + + //dir, p0 and p1 are in the local space of dir + PX_FORCE_INLINE aos::Vec3V supportLocal(const aos::Vec3VArg dir)const + { + using namespace aos; + //const Vec3V _dir = V3Normalize(dir); + const FloatV dist0 = V3Dot(p0, dir); + const FloatV dist1 = V3Dot(p1, dir); + return V3Sel(FIsGrtr(dist0, dist1), p0, p1); + } + + PX_FORCE_INLINE aos::Vec3V supportRelative(const aos::Vec3VArg dir, const aos::PxMatTransformV& aToB, const aos::PxMatTransformV& aTobT) const + { + using namespace aos; + //transform dir into the local space of a +// const Vec3V _dir = aToB.rotateInv(dir); + const Vec3V _dir = aTobT.rotate(dir); + const Vec3V p = supportLocal(_dir); + //transform p back to the local space of b + return aToB.transform(p); + } + + //dir, p0 and p1 are in the local space of dir + PX_FORCE_INLINE aos::Vec3V supportLocal(const aos::Vec3VArg dir, PxI32& index)const + { + using namespace aos; + + const FloatV dist0 = V3Dot(p0, dir); + const FloatV dist1 = V3Dot(p1, dir); + const BoolV comp = FIsGrtr(dist0, dist1); + getIndex(comp, index); + return V3Sel(comp, p0, p1); + } + + PX_FORCE_INLINE aos::Vec3V supportRelative( const aos::Vec3VArg dir, const aos::PxMatTransformV& aToB, + const aos::PxMatTransformV& aTobT, PxI32& index)const + { + using namespace aos; + //transform dir into the local space of a +// const Vec3V _dir = aToB.rotateInv(dir); + const Vec3V _dir = aTobT.rotate(dir); + + const Vec3V p = supportLocal(_dir, index); + //transform p back to the local space of b + return aToB.transform(p); + } + + + PX_FORCE_INLINE aos::Vec3V supportLocal(aos::Vec3V& support, const PxI32& index, const aos::BoolV comp)const + { + PX_UNUSED(index); + + using namespace aos; + const Vec3V p = V3Sel(comp, p0, p1); + support = p; + return p; + } + + PX_FORCE_INLINE aos::FloatV getSweepMargin() const + { + return aos::FZero(); + } + + //don't change the order of p0 and p1, the getPoint function depend on the order + aos::Vec3V p0; //!< Start of segment + aos::Vec3V p1; //!< End of segment + aos::FloatV radius; + }; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvex.h new file mode 100644 index 0000000..d530218 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvex.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_CONVEX_H +#define GU_VEC_CONVEX_H + +#include "foundation/PxVecMath.h" + +#define PX_SUPPORT_INLINE PX_FORCE_INLINE +#define PX_SUPPORT_FORCE_INLINE PX_FORCE_INLINE + +namespace physx +{ +namespace Gu +{ + + struct ConvexType + { + enum Type + { + eCONVEXHULL, + eCONVEXHULLNOSCALE, + eSPHERE, + eBOX, + eCAPSULE, + eTRIANGLE, + eTETRAHEDRON, + eCUSTOM + }; + }; + + class ConvexV + { + public: + + PX_FORCE_INLINE ConvexV(const ConvexType::Type type_) : type(type_), bMarginIsRadius(false) + { + margin = 0.f; + minMargin = 0.f; + sweepMargin = 0.f; + center = aos::V3Zero(); + } + + PX_FORCE_INLINE ConvexV(const ConvexType::Type type_, const aos::Vec3VArg center_) : type(type_), bMarginIsRadius(false) + { + using namespace aos; + center = center_; + margin = 0.f; + minMargin = 0.f; + sweepMargin = 0.f; + } + + //everytime when someone transform the object, they need to up + PX_FORCE_INLINE void setCenter(const aos::Vec3VArg _center) + { + center = _center; + } + + PX_FORCE_INLINE void setMargin(const aos::FloatVArg margin_) + { + aos::FStore(margin_, &margin); + } + + PX_FORCE_INLINE void setMargin(const PxReal margin_) + { + margin = margin_; + } + + + PX_FORCE_INLINE void setMinMargin(const aos::FloatVArg minMargin_) + { + aos::FStore(minMargin_, & minMargin); + } + + PX_FORCE_INLINE void setSweepMargin(const aos::FloatVArg sweepMargin_) + { + aos::FStore(sweepMargin_, &sweepMargin); + } + + PX_FORCE_INLINE aos::Vec3V getCenter()const + { + return center; + } + + PX_FORCE_INLINE aos::FloatV getMargin() const + { + return aos::FLoad(margin); + } + + PX_FORCE_INLINE aos::FloatV getMinMargin() const + { + return aos::FLoad(minMargin); + } + + PX_FORCE_INLINE aos::FloatV getSweepMargin() const + { + return aos::FLoad(sweepMargin); + } + + PX_FORCE_INLINE ConvexType::Type getType() const + { + return type; + } + + PX_FORCE_INLINE aos::BoolV isMarginEqRadius()const + { + return aos::BLoad(bMarginIsRadius); + } + + PX_FORCE_INLINE bool getMarginIsRadius() const + { + return bMarginIsRadius; + } + + PX_FORCE_INLINE PxReal getMarginF() const + { + return margin; + } + + + protected: + ~ConvexV(){} + aos::Vec3V center; + PxReal margin; //margin is the amount by which we shrunk the shape for a convex or box. If the shape are sphere/capsule, margin is the radius + PxReal minMargin; //minMargin is some percentage of marginBase, which is used to determine the termination condition for gjk + PxReal sweepMargin; //sweepMargin minMargin is some percentage of marginBase, which is used to determine the termination condition for gjkRaycast + ConvexType::Type type; + bool bMarginIsRadius; + }; + + PX_FORCE_INLINE aos::FloatV getContactEps(const aos::FloatV& _marginA, const aos::FloatV& _marginB) + { + using namespace aos; + + const FloatV ratio = FLoad(0.25f); + const FloatV minMargin = FMin(_marginA, _marginB); + + return FMul(minMargin, ratio); + } + + PX_FORCE_INLINE aos::FloatV getSweepContactEps(const aos::FloatV& _marginA, const aos::FloatV& _marginB) + { + using namespace aos; + + const FloatV ratio = FLoad(100.f); + const FloatV minMargin = FAdd(_marginA, _marginB); + + return FMul(minMargin, ratio); + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvexHull.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvexHull.h new file mode 100644 index 0000000..730860c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecConvexHull.h @@ -0,0 +1,540 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_CONVEXHULL_H +#define GU_VEC_CONVEXHULL_H + +#include "common/PxPhysXCommonConfig.h" +#include "geometry/PxMeshScale.h" +#include "GuConvexMesh.h" +#include "GuVecConvex.h" +#include "GuConvexMeshData.h" +#include "GuBigConvexData.h" +#include "GuConvexSupportTable.h" +#include "GuCubeIndex.h" +#include "foundation/PxFPU.h" +#include "foundation/PxVecQuat.h" +#include "GuShapeConvex.h" + +namespace physx +{ +namespace Gu +{ +#define CONVEX_MARGIN_RATIO 0.1f +#define CONVEX_MIN_MARGIN_RATIO 0.05f +#define CONVEX_SWEEP_MARGIN_RATIO 0.025f +#define TOLERANCE_MARGIN_RATIO 0.08f +#define TOLERANCE_MIN_MARGIN_RATIO 0.05f + + + //This margin is used in Persistent contact manifold + PX_SUPPORT_FORCE_INLINE aos::FloatV CalculatePCMConvexMargin(const Gu::ConvexHullData* hullData, const aos::Vec3VArg scale, + const PxReal toleranceLength, const PxReal toleranceRatio = TOLERANCE_MIN_MARGIN_RATIO) + { + + using namespace aos; + const Vec3V extents= V3Mul(V3LoadU(hullData->mInternal.mExtents), scale); + const FloatV min = V3ExtractMin(extents); + const FloatV toleranceMargin = FLoad(toleranceLength * toleranceRatio); + //ML: 25% of the minimum extents of the internal AABB as this convex hull's margin + return FMin(FMul(min, FLoad(0.25f)), toleranceMargin); + } + + PX_SUPPORT_FORCE_INLINE aos::FloatV CalculateMTDConvexMargin(const Gu::ConvexHullData* hullData, const aos::Vec3VArg scale) + { + using namespace aos; + const Vec3V extents = V3Mul(V3LoadU(hullData->mInternal.mExtents), scale); + const FloatV min = V3ExtractMin(extents); + //ML: 25% of the minimum extents of the internal AABB as this convex hull's margin + return FMul(min, FLoad(0.25f)); + } + + + //This minMargin is used in PCM contact gen + PX_SUPPORT_FORCE_INLINE void CalculateConvexMargin(const InternalObjectsData& internalObject, PxReal& margin, PxReal& minMargin, PxReal& sweepMargin, + const aos::Vec3VArg scale) + { + using namespace aos; + + const Vec3V extents = V3Mul(V3LoadU(internalObject.mExtents), scale); + const FloatV min_ = V3ExtractMin(extents); + + PxReal minExtent; + FStore(min_, &minExtent); + + //margin is used as acceptanceTolerance for overlap. + margin = minExtent * CONVEX_MARGIN_RATIO; + //minMargin is used in the GJK termination condition + minMargin = minExtent * CONVEX_MIN_MARGIN_RATIO; + //this is used for sweep(gjkRaycast) + sweepMargin = minExtent * CONVEX_SWEEP_MARGIN_RATIO; + } + + + PX_SUPPORT_FORCE_INLINE aos::Mat33V ConstructSkewMatrix(const aos::Vec3VArg scale, const aos::QuatVArg rotation) + { + using namespace aos; + Mat33V rot; + QuatGetMat33V(rotation, rot.col0, rot.col1, rot.col2); + Mat33V trans = M33Trnsps(rot); + trans.col0 = V3Scale(trans.col0, V3GetX(scale)); + trans.col1 = V3Scale(trans.col1, V3GetY(scale)); + trans.col2 = V3Scale(trans.col2, V3GetZ(scale)); + return M33MulM33(trans, rot); + } + + PX_SUPPORT_FORCE_INLINE void ConstructSkewMatrix(const aos::Vec3VArg scale, const aos::QuatVArg rotation, aos::Mat33V& vertex2Shape, aos::Mat33V& shape2Vertex, aos::Vec3V& center, const bool idtScale) + { + using namespace aos; + + PX_ASSERT(!V3AllEq(scale, V3Zero())); + + if(idtScale) + { + //create identity buffer + const Mat33V identity = M33Identity(); + vertex2Shape = identity; + shape2Vertex = identity; + } + else + { + const FloatV scaleX = V3GetX(scale); + const Vec3V invScale = V3Recip(scale); + + //this is uniform scale + if(V3AllEq(V3Splat(scaleX), scale)) + { + vertex2Shape = M33Diagonal(scale); + shape2Vertex = M33Diagonal(invScale); + } + else + { + Mat33V rot; + QuatGetMat33V(rotation, rot.col0, rot.col1, rot.col2); + const Mat33V trans = M33Trnsps(rot); + /* + vertex2shape + skewMat = Inv(R)*Diagonal(scale)*R; + */ + + const Mat33V temp(V3Scale(trans.col0, scaleX), V3Scale(trans.col1, V3GetY(scale)), V3Scale(trans.col2, V3GetZ(scale))); + vertex2Shape = M33MulM33(temp, rot); + + //don't need it in the support function + /* + shape2Vertex + invSkewMat =(invSkewMat)= Inv(R)*Diagonal(1/scale)*R; + */ + + shape2Vertex.col0 = V3Scale(trans.col0, V3GetX(invScale)); + shape2Vertex.col1 = V3Scale(trans.col1, V3GetY(invScale)); + shape2Vertex.col2 = V3Scale(trans.col2, V3GetZ(invScale)); + shape2Vertex = M33MulM33(shape2Vertex, rot); + + //shape2Vertex = M33Inverse(vertex2Shape); + } + + //transform center to shape space + center = M33MulV3(vertex2Shape, center); + } + } + + PX_SUPPORT_FORCE_INLINE aos::Mat33V ConstructVertex2ShapeMatrix(const aos::Vec3VArg scale, const aos::QuatVArg rotation) + { + using namespace aos; + Mat33V rot; + QuatGetMat33V(rotation, rot.col0, rot.col1, rot.col2); + const Mat33V trans = M33Trnsps(rot); + /* + vertex2shape + skewMat = Inv(R)*Diagonal(scale)*R; + */ + + const Mat33V temp(V3Scale(trans.col0, V3GetX(scale)), V3Scale(trans.col1, V3GetY(scale)), V3Scale(trans.col2, V3GetZ(scale))); + return M33MulM33(temp, rot); + } + + + class ConvexHullV : public ConvexV + { + + class TinyBitMap + { + public: + PxU32 m[8]; + PX_FORCE_INLINE TinyBitMap() { m[0] = m[1] = m[2] = m[3] = m[4] = m[5] = m[6] = m[7] = 0; } + PX_FORCE_INLINE void set(PxU8 v) { m[v >> 5] |= 1 << (v & 31); } + PX_FORCE_INLINE bool get(PxU8 v) const { return (m[v >> 5] & 1 << (v & 31)) != 0; } + }; + + + public: + /** + \brief Constructor + */ + PX_SUPPORT_INLINE ConvexHullV() : ConvexV(ConvexType::eCONVEXHULL) + { + } + + PX_SUPPORT_INLINE ConvexHullV(const Gu::ConvexHullData* _hullData, const aos::Vec3VArg _center, const aos::Vec3VArg scale, const aos::QuatVArg scaleRot, + const bool idtScale) : + ConvexV(ConvexType::eCONVEXHULL, _center) + { + using namespace aos; + + hullData = _hullData; + const PxVec3* PX_RESTRICT tempVerts = _hullData->getHullVertices(); + verts = tempVerts; + numVerts = _hullData->mNbHullVertices; + CalculateConvexMargin(_hullData->mInternal, margin, minMargin, sweepMargin, scale); + ConstructSkewMatrix(scale, scaleRot, vertex2Shape, shape2Vertex, center, idtScale); + data = _hullData->mBigConvexRawData; + } + + PX_SUPPORT_INLINE ConvexHullV(const Gu::ConvexHullData* _hullData, const aos::Vec3VArg _center) : + ConvexV(ConvexType::eCONVEXHULL, _center) + { + using namespace aos; + + hullData = _hullData; + verts = _hullData->getHullVertices(); + numVerts = _hullData->mNbHullVertices; + data = _hullData->mBigConvexRawData; + } + + //this is used by CCD system + PX_SUPPORT_INLINE ConvexHullV(const PxGeometry& geom) : ConvexV(ConvexType::eCONVEXHULL, aos::V3Zero()) + { + using namespace aos; + const PxConvexMeshGeometry& convexGeom = static_cast(geom); + const Gu::ConvexHullData* hData = _getHullData(convexGeom); + + const Vec3V vScale = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vRot = QuatVLoadU(&convexGeom.scale.rotation.x); + const bool idtScale = convexGeom.scale.isIdentity(); + + hullData = hData; + const PxVec3* PX_RESTRICT tempVerts = hData->getHullVertices(); + verts = tempVerts; + numVerts = hData->mNbHullVertices; + CalculateConvexMargin(hData->mInternal, margin, minMargin, sweepMargin, vScale); + ConstructSkewMatrix(vScale, vRot, vertex2Shape, shape2Vertex, center, idtScale); + + data = hData->mBigConvexRawData; + } + + //this is used by convex vs tetrahedron collision + PX_SUPPORT_INLINE ConvexHullV(const Gu::PolygonalData& polyData, const Cm::FastVertex2ShapeScaling& convexScale) : + ConvexV(ConvexType::eCONVEXHULL, aos::V3LoadU(polyData.mCenter)) + { + using namespace aos; + + const Vec3V vScale = V3LoadU(polyData.mScale.scale); + + verts = polyData.mVerts; + numVerts = PxU8(polyData.mNbVerts); + CalculateConvexMargin(polyData.mInternal, margin, minMargin, sweepMargin, vScale); + + const PxMat33& v2s = convexScale.getVertex2ShapeSkew(); + const PxMat33& s2v = convexScale.getShape2VertexSkew(); + + vertex2Shape.col0 = V3LoadU(v2s.column0); + vertex2Shape.col1 = V3LoadU(v2s.column1); + vertex2Shape.col2 = V3LoadU(v2s.column2); + + shape2Vertex.col0 = V3LoadU(s2v.column0); + shape2Vertex.col1 = V3LoadU(s2v.column1); + shape2Vertex.col2 = V3LoadU(s2v.column2); + + data = polyData.mBigData; + + } + + PX_SUPPORT_INLINE void initialize(const Gu::ConvexHullData* _hullData, const aos::Vec3VArg _center, const aos::Vec3VArg scale, + const aos::QuatVArg scaleRot, const bool idtScale) + { + using namespace aos; + + const PxVec3* tempVerts = _hullData->getHullVertices(); + CalculateConvexMargin(_hullData->mInternal, margin, minMargin, sweepMargin, scale); + ConstructSkewMatrix(scale, scaleRot, vertex2Shape, shape2Vertex, center, idtScale); + + verts = tempVerts; + numVerts = _hullData->mNbHullVertices; + //rot = _rot; + + center = _center; + + // searchIndex = 0; + data = _hullData->mBigConvexRawData; + + hullData = _hullData; + if (_hullData->mBigConvexRawData) + { + PxPrefetchLine(hullData->mBigConvexRawData->mValencies); + PxPrefetchLine(hullData->mBigConvexRawData->mValencies, 128); + PxPrefetchLine(hullData->mBigConvexRawData->mAdjacentVerts); + } + } + + + + PX_FORCE_INLINE void resetMargin(const PxReal toleranceLength) + { + const PxReal toleranceMinMargin = toleranceLength * TOLERANCE_MIN_MARGIN_RATIO; + const PxReal toleranceMargin = toleranceLength * TOLERANCE_MARGIN_RATIO; + + margin = PxMin(margin, toleranceMargin); + minMargin = PxMin(minMargin, toleranceMinMargin); + } + + PX_FORCE_INLINE aos::Vec3V supportPoint(const PxI32 index)const + { + using namespace aos; + + return M33MulV3(vertex2Shape, V3LoadU_SafeReadW(verts[index])); // PT: safe because of the way vertex memory is allocated in ConvexHullData (and 'verts' is initialized with ConvexHullData::getHullVertices()) + } + + PX_NOINLINE PxU32 hillClimbing(const aos::Vec3VArg _dir)const + { + using namespace aos; + + const Gu::Valency* valency = data->mValencies; + const PxU8* adjacentVerts = data->mAdjacentVerts; + + //NotSoTinyBitMap visited; + PxU32 smallBitMap[8] = {0,0,0,0,0,0,0,0}; + + // PxU32 index = searchIndex; + PxU32 index = 0; + + { + PxVec3 vertexSpaceDirection; + V3StoreU(_dir, vertexSpaceDirection); + const PxU32 offset = ComputeCubemapNearestOffset(vertexSpaceDirection, data->mSubdiv); + //const PxU32 offset = ComputeCubemapOffset(vertexSpaceDirection, data->mSubdiv); + index = data->mSamples[offset]; + } + + Vec3V maxPoint = V3LoadU_SafeReadW(verts[index]); // PT: safe because of the way vertex memory is allocated in ConvexHullData (and 'verts' is initialized with ConvexHullData::getHullVertices()) + FloatV max = V3Dot(maxPoint, _dir); + + PxU32 initialIndex = index; + + do + { + initialIndex = index; + const PxU32 numNeighbours = valency[index].mCount; + const PxU32 offset = valency[index].mOffset; + + for(PxU32 a = 0; a < numNeighbours; ++a) + { + const PxU32 neighbourIndex = adjacentVerts[offset + a]; + + const Vec3V vertex = V3LoadU_SafeReadW(verts[neighbourIndex]); // PT: safe because of the way vertex memory is allocated in ConvexHullData (and 'verts' is initialized with ConvexHullData::getHullVertices()) + const FloatV dist = V3Dot(vertex, _dir); + if(FAllGrtr(dist, max)) + { + const PxU32 ind = neighbourIndex>>5; + const PxU32 mask = PxU32(1 << (neighbourIndex & 31)); + if((smallBitMap[ind] & mask) == 0) + { + smallBitMap[ind] |= mask; + max = dist; + index = neighbourIndex; + } + } + } + + }while(index != initialIndex); + + return index; + } + + PX_SUPPORT_INLINE PxU32 bruteForceSearch(const aos::Vec3VArg _dir)const + { + using namespace aos; + //brute force + PxVec3 dir; + V3StoreU(_dir, dir); + + PxReal max = verts[0].dot(dir); + PxU32 maxIndex = 0; + + for (PxU32 i = 1; i < numVerts; ++i) + { + const PxReal dist = verts[i].dot(dir); + if (dist > max) + { + max = dist; + maxIndex = i; + } + } + return maxIndex; + } + + //points are in vertex space, _dir in vertex space + PX_NOINLINE PxU32 supportVertexIndex(const aos::Vec3VArg _dir)const + { + using namespace aos; + if(data) + return hillClimbing(_dir); + else + return bruteForceSearch(_dir); + } + + //dir is in the vertex space + PX_SUPPORT_INLINE void bruteForceSearchMinMax(const aos::Vec3VArg _dir, aos::FloatV& min, aos::FloatV& max)const + { + using namespace aos; + + //brute force + PxVec3 dir; + V3StoreU(_dir, dir); + //get the support point from the orignal margin + PxReal _max = verts[0].dot(dir); + PxReal _min = _max; + + for(PxU32 i = 1; i < numVerts; ++i) + { + const PxReal dist = verts[i].dot(dir); + _max = PxMax(dist, _max); + _min = PxMin(dist, _min); + } + min = FLoad(_min); + max = FLoad(_max); + } + + //This function is used in the full contact manifold generation code, points are in vertex space. + //This function support scaling, _dir is in the shape space + PX_SUPPORT_INLINE void supportVertexMinMax(const aos::Vec3VArg _dir, aos::FloatV& min, aos::FloatV& max)const + { + using namespace aos; + + //dir is in the vertex space + const Vec3V dir = M33TrnspsMulV3(vertex2Shape, _dir); + + if(data) + { + const PxU32 maxIndex= hillClimbing(dir); + const PxU32 minIndex= hillClimbing(V3Neg(dir)); + const Vec3V maxPoint= M33MulV3(vertex2Shape, V3LoadU_SafeReadW(verts[maxIndex])); // PT: safe because of the way vertex memory is allocated in ConvexHullData (and 'verts' is initialized with ConvexHullData::getHullVertices()) + const Vec3V minPoint= M33MulV3(vertex2Shape, V3LoadU_SafeReadW(verts[minIndex])); // PT: safe because of the way vertex memory is allocated in ConvexHullData (and 'verts' is initialized with ConvexHullData::getHullVertices()) + min = V3Dot(_dir, minPoint); + max = V3Dot(_dir, maxPoint); + } + else + { + //dir is in the vertex space + bruteForceSearchMinMax(dir, min, max); + } + } + + //This function is used in the full contact manifold generation code + PX_SUPPORT_INLINE void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* _verts)const + { + using namespace aos; + + for(PxU32 i=0; i(x)) +} + +} + +#endif // diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecPlane.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecPlane.h new file mode 100644 index 0000000..a079562 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecPlane.h @@ -0,0 +1,222 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_PLANE_H +#define GU_VEC_PLANE_H +/** \addtogroup geomutils +@{ +*/ + +#include "foundation/PxVec3.h" +#include "foundation/PxPlane.h" +#include "foundation/PxVecMath.h" + +/** +\brief Representation of a plane. + +Plane equation used: a*x + b*y + c*z + d = 0 +*/ +namespace physx +{ +namespace Gu +{ + + class PlaneV + { + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE PlaneV() + { + } + + /** + \brief Constructor from a normal and a distance + */ + PX_FORCE_INLINE PlaneV(const aos::FloatVArg nx, const aos::FloatVArg ny, const aos::FloatVArg nz, const aos::FloatVArg _d) + { + set(nx, ny, nz, _d); + } + + PX_FORCE_INLINE PlaneV(const PxPlane& plane) + { + using namespace aos; + const Vec3V _n = V3LoadU(plane.n); + const FloatV _d = FLoad(plane.d); + nd = V4SetW(Vec4V_From_Vec3V(_n), _d); + } + + + /** + \brief Constructor from three points + */ + PX_FORCE_INLINE PlaneV(const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2) + { + set(p0, p1, p2); + } + + /** + \brief Constructor from a normal and a distance + */ + PX_FORCE_INLINE PlaneV(const aos::Vec3VArg _n, const aos::FloatVArg _d) + { + nd = aos::V4SetW(aos::Vec4V_From_Vec3V(_n), _d); + } + + /** + \brief Copy constructor + */ + PX_FORCE_INLINE PlaneV(const PlaneV& plane) : nd(plane.nd) + { + } + + /** + \brief Destructor + */ + PX_FORCE_INLINE ~PlaneV() + { + } + + /** + \brief Sets plane to zero. + */ + PX_FORCE_INLINE PlaneV& setZero() + { + nd = aos::V4Zero(); + return *this; + } + + PX_FORCE_INLINE PlaneV& set(const aos::FloatVArg nx, const aos::FloatVArg ny, const aos::FloatVArg nz, const aos::FloatVArg _d) + { + + using namespace aos; + const Vec3V n= V3Merge(nx, ny, nz); + nd = V4SetW(Vec4V_From_Vec3V(n), _d); + return *this; + } + + PX_FORCE_INLINE PlaneV& set(const aos::Vec3VArg _normal, aos::FloatVArg _d) + { + nd = aos::V4SetW(aos::Vec4V_From_Vec3V(_normal), _d); + return *this; + } + + /** + \brief Computes the plane equation from 3 points. + */ + PlaneV& set(const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2) + { + using namespace aos; + const Vec3V edge0 = V3Sub(p1, p0); + const Vec3V edge1 = V3Sub(p2, p0); + + const Vec3V n = V3Normalize(V3Cross(edge0, edge1)); + // See comments in set() for computation of d + const FloatV d = FNeg(V3Dot(p0, n)); + nd = V4SetW(Vec4V_From_Vec3V(n), d); + return *this; + } + + /*** + \brief Computes distance, assuming plane is normalized + \sa normalize + */ + PX_FORCE_INLINE aos::FloatV distance(const aos::Vec3VArg p) const + { + // Valid for plane equation a*x + b*y + c*z + d = 0 + using namespace aos; + const Vec3V n = Vec3V_From_Vec4V(nd); + return FAdd(V3Dot(p, n), V4GetW(nd)); + } + + PX_FORCE_INLINE aos::BoolV belongs(const aos::Vec3VArg p) const + { + using namespace aos; + const FloatV eps = FLoad(1.0e-7f); + return FIsGrtr(eps, FAbs(distance(p))); + } + + /** + \brief projects p into the plane + */ + PX_FORCE_INLINE aos::Vec3V project(const aos::Vec3VArg p) const + { + // Pretend p is on positive side of plane, i.e. plane.distance(p)>0. + // To project the point we have to go in a direction opposed to plane's normal, i.e.: + using namespace aos; + const Vec3V n = Vec3V_From_Vec4V(nd); + return V3Sub(p, V3Scale(n, V4GetW(nd))); + + } + + PX_FORCE_INLINE aos::FloatV signedDistanceHessianNormalForm(const aos::Vec3VArg point) const + { + using namespace aos; + const Vec3V n = Vec3V_From_Vec4V(nd); + return FAdd(V3Dot(n, point), V4GetW(nd)); + } + + PX_FORCE_INLINE aos::Vec3V getNormal() const + { + return aos::Vec3V_From_Vec4V(nd); + } + + PX_FORCE_INLINE aos::FloatV getSignDist() const + { + return aos::V4GetW(nd); + } + + /** + \brief find an arbitrary point in the plane + */ + PX_FORCE_INLINE aos::Vec3V pointInPlane() const + { + // Project origin (0,0,0) to plane: + // (0) - normal * distance(0) = - normal * ((p|(0)) + d) = -normal*d + using namespace aos; + const Vec3V n = Vec3V_From_Vec4V(nd); + return V3Neg(V3Scale(n, V4GetW(nd))); + } + + PX_FORCE_INLINE void normalize() + { + using namespace aos; + const Vec3V n = Vec3V_From_Vec4V(nd); + const FloatV denom = FRecip(V3Length(n)); + V4Scale(nd, denom); + } + + aos::Vec4V nd; //!< The normal to the plan , w store the distance from the origin + }; +} + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecSphere.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecSphere.h new file mode 100644 index 0000000..e117151 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecSphere.h @@ -0,0 +1,242 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_SPHERE_H +#define GU_VEC_SPHERE_H +/** \addtogroup geomutils +@{ +*/ + +#include "geometry/PxSphereGeometry.h" +#include "GuVecConvex.h" +#include "GuConvexSupportTable.h" + +/** +\brief Represents a sphere defined by its center point and radius. +*/ +namespace physx +{ +namespace Gu +{ + class SphereV : public ConvexV + { + public: + /** + \brief Constructor + */ + PX_INLINE SphereV(): ConvexV(ConvexType::eSPHERE) + { + radius = aos::FZero(); + bMarginIsRadius = true; + } + + PX_INLINE SphereV(const aos::Vec3VArg _center, const aos::FloatV _radius) : ConvexV(ConvexType::eSPHERE, _center) + { + using namespace aos; + radius = _radius; + FStore(radius, &margin); + FStore(radius, &minMargin); + FStore(radius, &sweepMargin); + bMarginIsRadius = true; + } + + + /** + \brief Copy constructor + */ + PX_INLINE SphereV(const SphereV& sphere) : ConvexV(ConvexType::eSPHERE), radius(sphere.radius) + { + + margin = sphere.margin; + minMargin = sphere.minMargin; + sweepMargin = sphere.sweepMargin; + bMarginIsRadius = true; + } + + PX_INLINE SphereV(const PxGeometry& geom) : ConvexV(ConvexType::eSPHERE, aos::V3Zero()) + { + using namespace aos; + const PxSphereGeometry& sphereGeom = static_cast(geom); + const FloatV r = FLoad(sphereGeom.radius); + radius = r; + margin = sphereGeom.radius; + minMargin = sphereGeom.radius; + sweepMargin = sphereGeom.radius; + bMarginIsRadius = true; + } + + /** + \brief Destructor + */ + PX_INLINE ~SphereV() + { + } + + PX_INLINE void setV(const aos::Vec3VArg _center, const aos::FloatVArg _radius) + { + center = _center; + radius = _radius; + } + + /** + \brief Checks the sphere is valid. + + \return true if the sphere is valid + */ + PX_INLINE bool isValid() const + { + // Consistency condition for spheres: Radius >= 0.0f + using namespace aos; + return BAllEqTTTT(FIsGrtrOrEq(radius, FZero())) != 0; + } + + /** + \brief Tests if a point is contained within the sphere. + + \param[in] p the point to test + \return true if inside the sphere + */ + PX_INLINE bool contains(const aos::Vec3VArg p) const + { + using namespace aos; + const FloatV rr = FMul(radius, radius); + const FloatV cc = V3LengthSq(V3Sub(center, p)); + return FAllGrtrOrEq(rr, cc) != 0; + } + + /** + \brief Tests if a sphere is contained within the sphere. + + \param sphere [in] the sphere to test + \return true if inside the sphere + */ + PX_INLINE bool contains(const SphereV& sphere) const + { + using namespace aos; + + const Vec3V centerDif= V3Sub(center, sphere.center); + const FloatV radiusDif = FSub(radius, sphere.radius); + const FloatV cc = V3Dot(centerDif, centerDif); + const FloatV rr = FMul(radiusDif, radiusDif); + + const BoolV con0 = FIsGrtrOrEq(radiusDif, FZero());//might contain + const BoolV con1 = FIsGrtr(rr, cc);//return true + return BAllEqTTTT(BAnd(con0, con1))==1; + } + + /** + \brief Tests if a box is contained within the sphere. + + \param minimum [in] minimum value of the box + \param maximum [in] maximum value of the box + \return true if inside the sphere + */ + PX_INLINE bool contains(const aos::Vec3VArg minimum, const aos::Vec3VArg maximum) const + { + + //compute the sphere which wrap around the box + using namespace aos; + const FloatV zero = FZero(); + const FloatV half = FHalf(); + + const Vec3V boxSphereCenter = V3Scale(V3Add(maximum, minimum), half); + const Vec3V v = V3Scale(V3Sub(maximum, minimum), half); + const FloatV boxSphereR = V3Length(v); + + const Vec3V w = V3Sub(center, boxSphereCenter); + const FloatV wLength = V3Length(w); + const FloatV dif = FSub(FSub(radius, wLength), boxSphereR); + + return FAllGrtrOrEq(dif, zero) != 0; + } + + /** + \brief Tests if the sphere intersects another sphere + + \param sphere [in] the other sphere + \return true if spheres overlap + */ + PX_INLINE bool intersect(const SphereV& sphere) const + { + using namespace aos; + const Vec3V centerDif = V3Sub(center, sphere.center); + const FloatV cc = V3Dot(centerDif, centerDif); + const FloatV r = FAdd(radius, sphere.radius); + const FloatV rr = FMul(r, r); + return FAllGrtrOrEq(rr, cc) != 0; + } + + //return point in local space + PX_FORCE_INLINE aos::Vec3V getPoint(const PxU8) + { + return aos::V3Zero(); + } + // + //sweep code need to have full version + PX_FORCE_INLINE aos::Vec3V supportSweep(const aos::Vec3VArg dir)const + { + using namespace aos; + const Vec3V _dir = V3Normalize(dir); + return V3ScaleAdd(_dir, radius, center); + } + + //make the support function the same as support margin + PX_FORCE_INLINE aos::Vec3V support(const aos::Vec3VArg)const + { + return center;//_margin is the same as radius + } + + + PX_FORCE_INLINE aos::Vec3V supportMargin(const aos::Vec3VArg dir, const aos::FloatVArg _margin, aos::Vec3V& support)const + { + PX_UNUSED(_margin); + PX_UNUSED(dir); + + support = center; + return center;//_margin is the same as radius + } + + PX_FORCE_INLINE aos::BoolV isMarginEqRadius()const + { + return aos::BTTTT(); + } + + PX_FORCE_INLINE aos::FloatV getSweepMargin() const + { + return aos::FZero(); + } + + + aos::FloatV radius; //!< Sphere's center, w component is radius + + }; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTetrahedron.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTetrahedron.h new file mode 100644 index 0000000..f3a8677 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTetrahedron.h @@ -0,0 +1,248 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_TETRAHEDRON_H +#define GU_VEC_TETRAHEDRON_H +/** \addtogroup geomutils +@{ +*/ + +#include "GuVecConvex.h" +#include "GuConvexSupportTable.h" +#include "GuDistancePointTriangleSIMD.h" + +namespace physx +{ + namespace Gu + { + + + class TetrahedronV : public ConvexV + { + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE TetrahedronV() : ConvexV(ConvexType::eTETRAHEDRON) + { + margin = 0.02f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + /** + \brief Constructor + + \param[in] p0 Point 0 + \param[in] p1 Point 1 + \param[in] p2 Point 2 + \param[in] p3 Point 3 + */ + + PX_FORCE_INLINE TetrahedronV(const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2, + const aos::Vec3VArg p3) : ConvexV(ConvexType::eTETRAHEDRON) + { + using namespace aos; + //const FloatV zero = FZero(); + const FloatV num = FLoad(0.25f); + center = V3Scale(V3Add(V3Add(p0, p1), V3Add(p2, p3)), num); + //vertsX store all the x elements form those four point + vertsX = V4SetW(V4SetZ(V4SetY(Vec4V_From_Vec3V(p0), V3GetX(p1)), V3GetX(p2)), V3GetX(p3)); + //vertsY store all the y elements from those four point + vertsY = V4SetW(V4SetZ(V4SetY(V4Splat(V3GetY(p0)), V3GetY(p1)), V3GetY(p2)), V3GetY(p3)); + //vertsZ store all the z elements from those four point + vertsZ = V4SetW(V4SetZ(V4SetY(V4Splat(V3GetZ(p0)), V3GetZ(p1)), V3GetZ(p2)), V3GetZ(p3)); + + verts[0] = p0; verts[1] = p1; verts[2] = p2; verts[3] = p3; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + + PX_FORCE_INLINE TetrahedronV(const PxVec3* pts) : ConvexV(ConvexType::eTETRAHEDRON) + { + using namespace aos; + const Vec3V p0 = V3LoadU(pts[0]); + const Vec3V p1 = V3LoadU(pts[1]); + const Vec3V p2 = V3LoadU(pts[2]); + const Vec3V p3 = V3LoadU(pts[3]); + const FloatV num = FLoad(0.25f); + center = V3Scale(V3Add(V3Add(p0, p1), V3Add(p2, p3)), num); + + vertsX = V4SetW(V4SetZ(V4SetY(Vec4V_From_Vec3V(p0), V3GetX(p1)), V3GetX(p2)), V3GetX(p3)); + vertsY = V4SetW(V4SetZ(V4SetY(V4Splat(V3GetY(p0)), V3GetY(p1)), V3GetY(p2)), V3GetY(p3)); + vertsZ = V4SetW(V4SetZ(V4SetY(V4Splat(V3GetZ(p0)), V3GetZ(p1)), V3GetZ(p2)), V3GetZ(p3)); + + verts[0] = p0; verts[1] = p1; verts[2] = p2; verts[3] = p3; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + + /** + \brief Copy constructor + + \param[in] tetrahedron Tetrahedron to copy + */ + PX_FORCE_INLINE TetrahedronV(const Gu::TetrahedronV& tetrahedron) : ConvexV(ConvexType::eTETRAHEDRON) + { + using namespace aos; + vertsX = tetrahedron.vertsX; + vertsY = tetrahedron.vertsY; + vertsZ = tetrahedron.vertsZ; + + verts[0] = tetrahedron.verts[0]; + verts[1] = tetrahedron.verts[1]; + verts[2] = tetrahedron.verts[2]; + verts[3] = tetrahedron.verts[3]; + + center = tetrahedron.center; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + /** + \brief Destructor + */ + PX_FORCE_INLINE ~TetrahedronV() + { + } + + + PX_FORCE_INLINE aos::FloatV getSweepMargin() const + { + return aos::FMax(); + } + + PX_FORCE_INLINE void setCenter(const aos::Vec3VArg _center) + { + using namespace aos; + Vec3V offset = V3Sub(_center, center); + center = _center; + vertsX = V4Add(vertsX, V4Splat(V3GetX(offset))); + vertsY = V4Add(vertsY, V4Splat(V3GetY(offset))); + vertsZ = V4Add(vertsZ, V4Splat(V3GetZ(offset))); + + verts[0] = V3Add(verts[0], offset); + verts[1] = V3Add(verts[1], offset); + verts[2] = V3Add(verts[2], offset); + verts[3] = V3Add(verts[3], offset); + } + + PX_FORCE_INLINE aos::Vec4V getProjection(const aos::Vec3VArg dir) const + { + using namespace aos; + + const Vec4V dx = V4Scale(vertsX, V3GetX(dir)); + const Vec4V dy = V4Scale(vertsY, V3GetY(dir)); + const Vec4V dz = V4Scale(vertsZ, V3GetZ(dir)); + + return V4Add(dx, V4Add(dy, dz)); + } + + //dir is in local space, verts in the local space + PX_FORCE_INLINE aos::Vec3V supportLocal(const aos::Vec3VArg dir) const + { + using namespace aos; + + const Vec4V d = getProjection(dir); + + const FloatV d0 = V4GetX(d); + const FloatV d1 = V4GetY(d); + const FloatV d2 = V4GetZ(d); + const FloatV d3 = V4GetW(d); + + const BoolV con0 = BAnd(BAnd(FIsGrtr(d0, d1), FIsGrtr(d0, d2)), FIsGrtr(d0, d3)); + const BoolV con1 = BAnd(FIsGrtr(d1, d2), FIsGrtr(d1, d3)); + const BoolV con2 = FIsGrtr(d2, d3); + return V3Sel(con0, verts[0], V3Sel(con1, verts[1], V3Sel(con2, verts[2], verts[3]))); + } + + + //dir is in b space + PX_FORCE_INLINE aos::Vec3V supportRelative(const aos::Vec3VArg dir, const aos::PxMatTransformV& aToB, const aos::PxMatTransformV& aTobT) const + { + using namespace aos; + //verts are in local space + // const Vec3V _dir = aToB.rotateInv(dir); //transform dir back to a space + const Vec3V _dir = aTobT.rotate(dir); //transform dir back to a space + const Vec3V maxPoint = supportLocal(_dir); + return aToB.transform(maxPoint);//transform maxPoint to the b space + } + + PX_FORCE_INLINE aos::Vec3V supportLocal(const aos::Vec3VArg dir, PxI32& index) const + { + + using namespace aos; + + const Vec4V d = getProjection(dir); + const FloatV d0 = V4GetX(d); + const FloatV d1 = V4GetY(d); + const FloatV d2 = V4GetZ(d); + const FloatV d3 = V4GetW(d); + + const BoolV con0 = BAnd(BAnd(FIsGrtr(d0, d1), FIsGrtr(d0, d2)), FIsGrtr(d0, d3)); + const BoolV con1 = BAnd(FIsGrtr(d1, d2), FIsGrtr(d1, d3)); + const BoolV con2 = FIsGrtr(d2, d3); + + + const VecI32V vIndex = VecI32V_Sel(con0, I4Load(0), VecI32V_Sel(con1, I4Load(1), VecI32V_Sel(con2, I4Load(2), I4Load(3)))); + PxI32_From_VecI32V(vIndex, &index); + + //return V3Sel(con0, v0, V3Sel(con1, v1, v2)); + return verts[index]; + } + + PX_FORCE_INLINE aos::Vec3V supportRelative(const aos::Vec3VArg dir, const aos::PxMatTransformV& aToB, + const aos::PxMatTransformV& aTobT, PxI32& index)const + { + //don't put margin in the triangle + using namespace aos; + //transfer dir into the local space of triangle + // const Vec3V _dir = aToB.rotateInv(dir); + const Vec3V _dir = aTobT.rotate(dir); + return aToB.transform(supportLocal(_dir, index));//transform the support poin to b space + } + + PX_FORCE_INLINE aos::Vec3V supportPoint(const PxI32 index)const + { + return verts[index]; + } + + /** + \brief Array of Vertices. + */ + aos::Vec3V verts[4]; + aos::Vec4V vertsX; + aos::Vec4V vertsY; + aos::Vec4V vertsZ; + }; + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTriangle.h new file mode 100644 index 0000000..9e44fdb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/gjk/GuVecTriangle.h @@ -0,0 +1,267 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_VEC_TRIANGLE_H +#define GU_VEC_TRIANGLE_H +/** \addtogroup geomutils + @{ +*/ + +#include "GuVecConvex.h" +#include "GuConvexSupportTable.h" +#include "GuDistancePointTriangleSIMD.h" + +namespace physx +{ +namespace Gu +{ + + + class TriangleV : public ConvexV + { + public: + /** + \brief Constructor + */ + PX_FORCE_INLINE TriangleV() : ConvexV(ConvexType::eTRIANGLE) + { + margin = 0.02f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + /** + \brief Constructor + + \param[in] p0 Point 0 + \param[in] p1 Point 1 + \param[in] p2 Point 2 + */ + + PX_FORCE_INLINE TriangleV(const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2): ConvexV(ConvexType::eTRIANGLE) + { + using namespace aos; + //const FloatV zero = FZero(); + const FloatV num = FLoad(0.333333f); + center = V3Scale(V3Add(V3Add(p0, p1), p2), num); + verts[0] = p0; + verts[1] = p1; + verts[2] = p2; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + + PX_FORCE_INLINE TriangleV(const PxVec3* pts) : ConvexV(ConvexType::eTRIANGLE) + { + using namespace aos; + const Vec3V p0 = V3LoadU(pts[0]); + const Vec3V p1 = V3LoadU(pts[1]); + const Vec3V p2 = V3LoadU(pts[2]); + const FloatV num = FLoad(0.333333f); + center = V3Scale(V3Add(V3Add(p0, p1), p2), num); + verts[0] = p0; + verts[1] = p1; + verts[2] = p2; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + + /** + \brief Copy constructor + + \param[in] triangle Tri to copy + */ + PX_FORCE_INLINE TriangleV(const Gu::TriangleV& triangle) : ConvexV(ConvexType::eTRIANGLE) + { + using namespace aos; + verts[0] = triangle.verts[0]; + verts[1] = triangle.verts[1]; + verts[2] = triangle.verts[2]; + + center = triangle.center; + margin = 0.f; + minMargin = PX_MAX_REAL; + sweepMargin = PX_MAX_REAL; + } + /** + \brief Destructor + */ + PX_FORCE_INLINE ~TriangleV() + { + } + + PX_FORCE_INLINE void populateVerts(const PxU8* inds, PxU32 numInds, const PxVec3* originalVerts, aos::Vec3V* vertexs)const + { + using namespace aos; + + for(PxU32 i=0; i(mData.rows * mData.columns); +} + +HeightField* HeightField::createObject(PxU8*& address, PxDeserializationContext& context) +{ + HeightField* obj = PX_PLACEMENT_NEW(address, HeightField(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(HeightField); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void HeightField::release() +{ + RefCountable_decRefCount(*this); +} + +void HeightField::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 HeightField::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool HeightField::modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc& desc, bool shrinkBounds) +{ + const PxU32 nbCols = getNbColumns(); + const PxU32 nbRows = getNbRows(); + PX_CHECK_AND_RETURN_NULL(desc.format == mData.format, "Gu::HeightField::modifySamples: desc.format mismatch"); + //PX_CHECK_AND_RETURN_NULL(startCol + desc.nbColumns <= nbCols, + // "Gu::HeightField::modifySamples: startCol + nbColumns out of range"); + //PX_CHECK_AND_RETURN_NULL(startRow + desc.nbRows <= nbRows, + // "Gu::HeightField::modifySamples: startRow + nbRows out of range"); + //PX_CHECK_AND_RETURN_NULL(desc.samples.stride == mSampleStride, "Gu::HeightField::modifySamples: desc.samples.stride mismatch"); + + // by default bounds don't shrink since the whole point of this function is to avoid modifying the whole HF + // unless shrinkBounds is specified. then the bounds will be fully recomputed later + PxReal minHeight = mMinHeight; + PxReal maxHeight = mMaxHeight; + PxU32 hiRow = PxMin(PxU32(PxMax(0, startRow + PxI32(desc.nbRows))), nbRows); + PxU32 hiCol = PxMin(PxU32(PxMax(0, startCol + PxI32(desc.nbColumns))), nbCols); + for (PxU32 row = PxU32(PxMax(startRow, 0)); row < hiRow; row++) + { + for (PxU32 col = PxU32(PxMax(startCol, 0)); col < hiCol; col++) + { + const PxU32 vertexIndex = col + row*nbCols; + PxHeightFieldSample* targetSample = &mData.samples[vertexIndex]; + + // update target sample from source sample + const PxHeightFieldSample& sourceSample = + (reinterpret_cast(desc.samples.data))[col - startCol + (row - startRow) * desc.nbColumns]; + *targetSample = sourceSample; + + if(isCollisionVertexPreca(vertexIndex, row, col, PxHeightFieldMaterial::eHOLE)) + targetSample->materialIndex1.setBit(); + else + targetSample->materialIndex1.clearBit(); + + // grow (but not shrink) the height extents + const PxReal h = getHeight(vertexIndex); + minHeight = physx::intrinsics::selectMin(h, minHeight); + maxHeight = physx::intrinsics::selectMax(h, maxHeight); + } + } + + if (shrinkBounds) + { + // do a full recompute on vertical bounds to allow shrinking + minHeight = PX_MAX_REAL; + maxHeight = -PX_MAX_REAL; + // have to recompute the min&max from scratch... + for (PxU32 vertexIndex = 0; vertexIndex < nbRows * nbCols; vertexIndex ++) + { + // update height extents + const PxReal h = getHeight(vertexIndex); + minHeight = physx::intrinsics::selectMin(h, minHeight); + maxHeight = physx::intrinsics::selectMax(h, maxHeight); + } + } + mMinHeight = minHeight; + mMaxHeight = maxHeight; + + // update local space aabb + CenterExtents& bounds = mData.mAABB; + bounds.mCenter.y = (maxHeight + minHeight)*0.5f; + bounds.mExtents.y = (maxHeight - minHeight)*0.5f; + + mModifyCount++; + + return true; +} + +bool HeightField::load(PxInputStream& stream) +{ + // release old memory + releaseMemory(); + + // Import header + PxU32 version; + bool endian; + if(!readHeader('H', 'F', 'H', 'F', version, endian, stream)) + return false; + + // load mData + mData.rows = readDword(endian, stream); + mData.columns = readDword(endian, stream); + if(version>=2) + { + mData.rowLimit = readDword(endian, stream); + mData.colLimit = readDword(endian, stream); + mData.nbColumns = readDword(endian, stream); + } + else + { + mData.rowLimit = PxU32(readFloat(endian, stream)); + mData.colLimit = PxU32(readFloat(endian, stream)); + mData.nbColumns = PxU32(readFloat(endian, stream)); + } + const float thickness = readFloat(endian, stream); + PX_UNUSED(thickness); + mData.convexEdgeThreshold = readFloat(endian, stream); + + PxU16 flags = readWord(endian, stream); + mData.flags = PxHeightFieldFlags(flags); + + PxU32 format = readDword(endian, stream); + mData.format = PxHeightFieldFormat::Enum(format); + + PxBounds3 minMaxBounds; + minMaxBounds.minimum.x = readFloat(endian, stream); + minMaxBounds.minimum.y = readFloat(endian, stream); + minMaxBounds.minimum.z = readFloat(endian, stream); + minMaxBounds.maximum.x = readFloat(endian, stream); + minMaxBounds.maximum.y = readFloat(endian, stream); + minMaxBounds.maximum.z = readFloat(endian, stream); + mData.mAABB = CenterExtents(minMaxBounds); + + mSampleStride = readDword(endian, stream); + mNbSamples = readDword(endian, stream); + mMinHeight = readFloat(endian, stream); + mMaxHeight = readFloat(endian, stream); + + // allocate height samples + mData.samples = NULL; + const PxU32 nbVerts = mData.rows * mData.columns; + if (nbVerts > 0) + { + mData.samples = PX_ALLOCATE(PxHeightFieldSample, nbVerts, "PxHeightFieldSample"); + if (mData.samples == NULL) + return PxGetFoundation().error(PxErrorCode::eOUT_OF_MEMORY, PX_FL, "Gu::HeightField::load: PX_ALLOC failed!"); + + stream.read(mData.samples, mNbSamples*sizeof(PxHeightFieldSample)); + if (endian) + for(PxU32 i = 0; i < mNbSamples; i++) + { + PxHeightFieldSample& s = mData.samples[i]; + PX_ASSERT(sizeof(PxU16) == sizeof(s.height)); + flip(s.height); + } + } + + return true; +} + +bool HeightField::loadFromDesc(const PxHeightFieldDesc& desc) +{ + // verify descriptor + PX_CHECK_AND_RETURN_NULL(desc.isValid(), "Gu::HeightField::loadFromDesc: desc.isValid() failed!"); + + // release old memory + releaseMemory(); + + // copy trivial data + mData.format = desc.format; + mData.rows = desc.nbRows; + mData.columns = desc.nbColumns; + mData.convexEdgeThreshold = desc.convexEdgeThreshold; + mData.flags = desc.flags; + mSampleStride = desc.samples.stride; + + mData.rowLimit = mData.rows - 2; + mData.colLimit = mData.columns - 2; + mData.nbColumns = desc.nbColumns; + + // allocate and copy height samples + // compute extents too + mData.samples = NULL; + const PxU32 nbVerts = desc.nbRows * desc.nbColumns; + mMinHeight = PX_MAX_REAL; + mMaxHeight = -PX_MAX_REAL; + + if(nbVerts > 0) + { + mData.samples = PX_ALLOCATE(PxHeightFieldSample, nbVerts, "PxHeightFieldSample"); + if(!mData.samples) + return PxGetFoundation().error(PxErrorCode::eOUT_OF_MEMORY, PX_FL, "Gu::HeightField::load: PX_ALLOC failed!"); + + const PxU8* PX_RESTRICT src = reinterpret_cast(desc.samples.data); + PxHeightFieldSample* PX_RESTRICT dst = mData.samples; + PxI16 minHeight = PX_MAX_I16; + PxI16 maxHeight = PX_MIN_I16; + for(PxU32 i=0;i(src); + *dst++ = sample; + const PxI16 height = sample.height; + minHeight = height < minHeight ? height : minHeight; + maxHeight = height > maxHeight ? height : maxHeight; + src += desc.samples.stride; + } + mMinHeight = PxReal(minHeight); + mMaxHeight = PxReal(maxHeight); + } + + PX_ASSERT(mMaxHeight >= mMinHeight); + + parseTrianglesForCollisionVertices(PxHeightFieldMaterial::eHOLE); + +// PT: "mNbSamples" only used by binary converter + mNbSamples = mData.rows * mData.columns; + + //Compute local space aabb. + PxBounds3 bounds; + bounds.minimum.y = getMinHeight(); + bounds.maximum.y = getMaxHeight(); + + bounds.minimum.x = 0; + bounds.maximum.x = PxReal(getNbRowsFast() - 1); + bounds.minimum.z = 0; + bounds.maximum.z = PxReal(getNbColumnsFast() - 1); + mData.mAABB=bounds; + + return true; +} + +bool HeightField::save(PxOutputStream& stream, bool endian) +{ + // write header + if(!writeHeader('H', 'F', 'H', 'F', PX_HEIGHTFIELD_VERSION, endian, stream)) + return false; + + const Gu::HeightFieldData& hfData = getData(); + + // write mData members + writeDword(hfData.rows, endian, stream); + writeDword(hfData.columns, endian, stream); + writeDword(hfData.rowLimit, endian, stream); + writeDword(hfData.colLimit, endian, stream); + writeDword(hfData.nbColumns, endian, stream); + writeFloat(0.0f, endian, stream); // thickness + writeFloat(hfData.convexEdgeThreshold, endian, stream); + writeWord(hfData.flags, endian, stream); + writeDword(hfData.format, endian, stream); + + writeFloat(hfData.mAABB.getMin(0), endian, stream); + writeFloat(hfData.mAABB.getMin(1), endian, stream); + writeFloat(hfData.mAABB.getMin(2), endian, stream); + writeFloat(hfData.mAABB.getMax(0), endian, stream); + writeFloat(hfData.mAABB.getMax(1), endian, stream); + writeFloat(hfData.mAABB.getMax(2), endian, stream); + + // write this-> members + writeDword(mSampleStride, endian, stream); + writeDword(mNbSamples, endian, stream); + writeFloat(mMinHeight, endian, stream); + writeFloat(mMaxHeight, endian, stream); + + // write samples + for(PxU32 i=0; i destBufferSize) n = destBufferSize; + PxMemCopy(destBuffer, mData.samples, n); + + return n; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void HeightField::releaseMemory() +{ + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_FREE(mData.samples); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct EdgeData + { + PxU32 edgeIndex; + PxU32 cell; + PxU32 row; + PxU32 column; + }; +} + +// PT: TODO: use those faster functions everywhere +static PxU32 getVertexEdgeIndices(const HeightField& heightfield, PxU32 vertexIndex, PxU32 row, PxU32 column, EdgeData edgeIndices[8]) +{ + const PxU32 nbColumns = heightfield.getData().columns; + const PxU32 nbRows = heightfield.getData().rows; + PX_ASSERT((vertexIndex / nbColumns)==row); + PX_ASSERT((vertexIndex % nbColumns)==column); + + PxU32 count = 0; + + if (row > 0) + { +// edgeIndices[count++] = 3 * (vertexIndex - nbColumns) + 2; + const PxU32 cell = vertexIndex - nbColumns; + edgeIndices[count].edgeIndex = 3 * cell + 2; + edgeIndices[count].cell = cell; + edgeIndices[count].row = row-1; + edgeIndices[count].column = column; + count++; + } + + if (column < nbColumns-1) + { + if (row > 0) + { + if (!heightfield.isZerothVertexShared(vertexIndex - nbColumns)) + { +// edgeIndices[count++] = 3 * (vertexIndex - nbColumns) + 1; + const PxU32 cell = vertexIndex - nbColumns; + edgeIndices[count].edgeIndex = 3 * cell + 1; + edgeIndices[count].cell = cell; + edgeIndices[count].row = row-1; + edgeIndices[count].column = column; + count++; + } + } +// edgeIndices[count++] = 3 * vertexIndex; + edgeIndices[count].edgeIndex = 3 * vertexIndex; + edgeIndices[count].cell = vertexIndex; + edgeIndices[count].row = row; + edgeIndices[count].column = column; + count++; + + if (row < nbRows - 1) + { + if (heightfield.isZerothVertexShared(vertexIndex)) + { +// edgeIndices[count++] = 3 * vertexIndex + 1; + edgeIndices[count].edgeIndex = 3 * vertexIndex + 1; + edgeIndices[count].cell = vertexIndex; + edgeIndices[count].row = row; + edgeIndices[count].column = column; + count++; + } + } + } + + if (row < nbRows - 1) + { +// edgeIndices[count++] = 3 * vertexIndex + 2; + edgeIndices[count].edgeIndex = 3 * vertexIndex + 2; + edgeIndices[count].cell = vertexIndex; + edgeIndices[count].row = row; + edgeIndices[count].column = column; + count++; + } + + if (column > 0) + { + if (row < nbRows - 1) + { + if (!heightfield.isZerothVertexShared(vertexIndex - 1)) + { +// edgeIndices[count++] = 3 * (vertexIndex - 1) + 1; + const PxU32 cell = vertexIndex - 1; + edgeIndices[count].edgeIndex = 3 * cell + 1; + edgeIndices[count].cell = cell; + edgeIndices[count].row = row; + edgeIndices[count].column = column-1; + count++; + } + } +// edgeIndices[count++] = 3 * (vertexIndex - 1); + const PxU32 cell = vertexIndex - 1; + edgeIndices[count].edgeIndex = 3 * cell; + edgeIndices[count].cell = cell; + edgeIndices[count].row = row; + edgeIndices[count].column = column-1; + count++; + if (row > 0) + { + if (heightfield.isZerothVertexShared(vertexIndex - nbColumns - 1)) + { +// edgeIndices[count++] = 3 * (vertexIndex - nbColumns - 1) + 1; + const PxU32 cell1 = vertexIndex - nbColumns - 1; + edgeIndices[count].edgeIndex = 3 * cell1 + 1; + edgeIndices[count].cell = cell1; + edgeIndices[count].row = row-1; + edgeIndices[count].column = column-1; + count++; + } + } + } + return count; +} + +static PxU32 getEdgeTriangleIndices(const HeightField& heightfield, const EdgeData& edgeData, PxU32* PX_RESTRICT triangleIndices) +{ + const PxU32 nbColumns = heightfield.getData().columns; + const PxU32 nbRows = heightfield.getData().rows; + + const PxU32 edgeIndex = edgeData.edgeIndex; + const PxU32 cell = edgeData.cell; + const PxU32 row = edgeData.row; + const PxU32 column = edgeData.column; + PX_ASSERT(cell==edgeIndex / 3); + PX_ASSERT(row==cell / nbColumns); + PX_ASSERT(column==cell % nbColumns); + PxU32 count = 0; + switch (edgeIndex - cell*3) + { + case 0: + if (column < nbColumns - 1) + { + if (row > 0) + { + if (heightfield.isZerothVertexShared(cell - nbColumns)) + triangleIndices[count++] = ((cell - nbColumns) << 1); + else + triangleIndices[count++] = ((cell - nbColumns) << 1) + 1; + } + if (row < nbRows - 1) + { + if (heightfield.isZerothVertexShared(cell)) + triangleIndices[count++] = (cell << 1) + 1; + else + triangleIndices[count++] = cell << 1; + } + } + break; + case 1: + if ((row < nbRows - 1) && (column < nbColumns - 1)) + { + triangleIndices[count++] = cell << 1; + triangleIndices[count++] = (cell << 1) + 1; + } + break; + case 2: + if (row < nbRows - 1) + { + if (column > 0) + { + triangleIndices[count++] = ((cell - 1) << 1) + 1; + } + if (column < nbColumns - 1) + { + triangleIndices[count++] = cell << 1; + } + } + break; + } + + return count; +} + +PX_FORCE_INLINE PxU32 anyHole(PxU32 doubleMatIndex, PxU16 holeMaterialIndex) +{ + return PxU32((doubleMatIndex & 0xFFFF) == holeMaterialIndex) | (PxU32(doubleMatIndex >> 16) == holeMaterialIndex); +} + +void HeightField::parseTrianglesForCollisionVertices(PxU16 holeMaterialIndex) +{ + const PxU32 nbColumns = getNbColumnsFast(); + const PxU32 nbRows = getNbRowsFast(); + + PxBitMap rowHoles[2]; + rowHoles[0].resizeAndClear(nbColumns + 1); + rowHoles[1].resizeAndClear(nbColumns + 1); + + for (PxU32 iCol = 0; iCol < nbColumns; iCol++) + { + if (anyHole(getMaterialIndex01(iCol), holeMaterialIndex)) + { + rowHoles[0].set(iCol); + rowHoles[0].set(iCol + 1); + } + PxU32 vertIndex = iCol; + if(isCollisionVertexPreca(vertIndex, 0, iCol, holeMaterialIndex)) + mData.samples[vertIndex].materialIndex1.setBit(); + else + mData.samples[vertIndex].materialIndex1.clearBit(); + } + + PxU32 nextRow = 1, currentRow = 0; + for (PxU32 iRow = 1; iRow < nbRows; iRow++) + { + PxU32 rowOffset = iRow*nbColumns; + for (PxU32 iCol = 0; iCol < nbColumns; iCol++) + { + const PxU32 vertIndex = rowOffset + iCol; // column index plus current row offset (vertex/cell index) + if(anyHole(getMaterialIndex01(vertIndex), holeMaterialIndex)) + { + rowHoles[currentRow].set(iCol); + rowHoles[currentRow].set(iCol + 1); + rowHoles[nextRow].set(iCol); + rowHoles[nextRow].set(iCol + 1); + } + + if ((iCol == 0) || (iCol == nbColumns - 1) || (iRow == nbRows - 1) || rowHoles[currentRow].test(iCol)) + { + if(isCollisionVertexPreca(vertIndex, iRow, iCol, holeMaterialIndex)) + mData.samples[vertIndex].materialIndex1.setBit(); + else + mData.samples[vertIndex].materialIndex1.clearBit(); + } else + { + if (isConvexVertex(vertIndex, iRow, iCol)) + mData.samples[vertIndex].materialIndex1.setBit(); + } + } + + rowHoles[currentRow].clear(); + + // swap prevRow and prevPrevRow + nextRow ^= 1; currentRow ^= 1; + } +} + +bool HeightField::isSolidVertex(PxU32 vertexIndex, PxU32 row, PxU32 column, PxU16 holeMaterialIndex, bool& nbSolid) const +{ + // check if solid and boundary + // retrieve edge indices for current vertexIndex + EdgeData edgeIndices[8]; + const PxU32 edgeCount = ::getVertexEdgeIndices(*this, vertexIndex, row, column, edgeIndices); + + PxU32 faceCounts[8]; + PxU32 faceIndices[2 * 8]; + PxU32* dst = faceIndices; + for (PxU32 i = 0; i < edgeCount; i++) + { + faceCounts[i] = ::getEdgeTriangleIndices(*this, edgeIndices[i], dst); + dst += 2; + } + + nbSolid = false; + const PxU32* currentfaceIndices = faceIndices; // parallel array of pairs of face indices per edge index + for (PxU32 i = 0; i < edgeCount; i++) + { + if (faceCounts[i] > 1) + { + const PxU16& material0 = getTriangleMaterial(currentfaceIndices[0]); + const PxU16& material1 = getTriangleMaterial(currentfaceIndices[1]); + // ptchernev TODO: this is a bit arbitrary + if (material0 != holeMaterialIndex) + { + nbSolid = true; + if (material1 == holeMaterialIndex) + return true; // edge between solid and hole => return true + } + if (material1 != holeMaterialIndex) + { + nbSolid = true; + if (material0 == holeMaterialIndex) + return true; // edge between hole and solid => return true + } + } + else + { + if (getTriangleMaterial(currentfaceIndices[0]) != holeMaterialIndex) + return true; + } + currentfaceIndices += 2; // 2 face indices per edge + } + return false; +} + +bool HeightField::isCollisionVertexPreca(PxU32 vertexIndex, PxU32 row, PxU32 column, PxU16 holeMaterialIndex) const +{ +#ifdef PX_HEIGHTFIELD_DEBUG + PX_ASSERT(isValidVertex(vertexIndex)); +#endif + PX_ASSERT((vertexIndex / getNbColumnsFast()) == row); + PX_ASSERT((vertexIndex % getNbColumnsFast()) == column); + + // check boundary conditions - boundary edges shouldn't produce collision with eNO_BOUNDARY_EDGES flag + if(mData.flags & PxHeightFieldFlag::eNO_BOUNDARY_EDGES) + if ((row == 0) || (column == 0) || (row >= mData.rows-1) || (column >= mData.columns-1)) + return false; + + bool nbSolid; + if(isSolidVertex(vertexIndex, row, column, holeMaterialIndex, nbSolid)) + return true; + + // return true if it is boundary or solid and convex + return (nbSolid && isConvexVertex(vertexIndex, row, column)); +} + +// AP: this naming is confusing and inconsistent with return value. the function appears to compute vertex coord rather than cell coords +// it would most likely be better to stay in cell coords instead, since fractional vertex coords just do not make any sense +PxU32 HeightField::computeCellCoordinates(PxReal x, PxReal z, PxReal& fracX, PxReal& fracZ) const +{ + namespace i = physx::intrinsics; + + x = i::selectMax(x, 0.0f); + z = i::selectMax(z, 0.0f); +#if 0 // validation code for scaled clamping epsilon computation + for (PxReal ii = 1.0f; ii < 100000.0f; ii+=1.0f) + { + PX_UNUSED(ii); + PX_ASSERT(PxFloor(ii+(1-1e-7f*ii)) == ii); + } +#endif + const PxF32 epsx = 1.0f - PxAbs(x+1.0f) * 1e-6f; // epsilon needs to scale with values of x,z... + const PxF32 epsz = 1.0f - PxAbs(z+1.0f) * 1e-6f; + PxF32 x1 = i::selectMin(x, float(mData.rowLimit)+epsx); + PxF32 z1 = i::selectMin(z, float(mData.colLimit)+epsz); + x = PxFloor(x1); + fracX = x1 - x; + z = PxFloor(z1); + fracZ = z1 - z; + PX_ASSERT(x >= 0.0f && x < PxF32(mData.rows)); + PX_ASSERT(z >= 0.0f && z < PxF32(mData.columns)); + + const PxU32 vertexIndex = PxU32(x) * mData.nbColumns + PxU32(z); + PX_ASSERT(vertexIndex < mData.rows*mData.columns); + + return vertexIndex; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.h new file mode 100644 index 0000000..67cbf21 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightField.h @@ -0,0 +1,1231 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_HEIGHTFIELD_H +#define GU_HEIGHTFIELD_H + +#include "geometry/PxHeightFieldSample.h" +#include "geometry/PxHeightFieldDesc.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxHeightFieldGeometry.h" + +#include "foundation/PxUserAllocated.h" +#include "CmRefCountable.h" +#include "GuSphere.h" +#include "GuHeightFieldData.h" + +//#define PX_HEIGHTFIELD_VERSION 0 +//#define PX_HEIGHTFIELD_VERSION 1 // tiled version that was needed for PS3 only has been removed +#define PX_HEIGHTFIELD_VERSION 2 // some floats are now integers + +namespace physx +{ +class PxHeightFieldDesc; + +namespace Gu +{ +class MeshFactory; +class HeightField : public PxHeightField, public PxUserAllocated +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + HeightField(PxBaseFlags baseFlags) : PxHeightField(baseFlags), mData(PxEmpty), mModifyCount(0) {} + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + PX_FORCE_INLINE void setMeshFactory(MeshFactory* f) { mMeshFactory = f; } + PX_PHYSX_COMMON_API static HeightField* createObject(PxU8*& address, PxDeserializationContext& context); + PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); + void resolveReferences(PxDeserializationContext&) {} + + virtual void requiresObjects(PxProcessPxBaseCallback&){} +//~PX_SERIALIZATION + HeightField(MeshFactory* factory); + HeightField(MeshFactory* factory, Gu::HeightFieldData& data); + // PxHeightField + virtual void release(); + virtual PxU32 saveCells(void* destBuffer, PxU32 destBufferSize) const; + virtual bool modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc& subfieldDesc, bool shrinkBounds); + virtual PxU32 getNbRows() const { return mData.rows; } + virtual PxU32 getNbColumns() const { return mData.columns; } + virtual PxHeightFieldFormat::Enum getFormat() const { return mData.format; } + virtual PxU32 getSampleStride() const { return sizeof(PxHeightFieldSample); } + virtual PxReal getConvexEdgeThreshold() const { return mData.convexEdgeThreshold; } + virtual PxHeightFieldFlags getFlags() const { return mData.flags; } + virtual PxReal getHeight(PxReal x, PxReal z) const { return getHeightInternal(x, z); } + virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const + { + return getTriangleMaterial(triangleIndex); + } + + virtual PxVec3 getTriangleNormal(PxTriangleID triangleIndex) const + { + return getTriangleNormalInternal(triangleIndex); + } + + virtual const PxHeightFieldSample& getSample(PxU32 row, PxU32 column) const + { + const PxU32 cell = row * getNbColumnsFast() + column; + return getSample(cell); + } + virtual PxU32 getTimestamp() const { return mModifyCount; } + //~PxHeightField + + // PxRefCounted + virtual void acquireReference(); + virtual PxU32 getReferenceCount() const; + //~PxRefCounted + + // PxBase + virtual void onRefCountZero(); + //~PxBase + bool loadFromDesc(const PxHeightFieldDesc&); + bool load(PxInputStream&); + bool save(PxOutputStream& stream, bool endianSwap); + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbRowsFast() const { return mData.rows; } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbColumnsFast() const { return mData.columns; } + PX_FORCE_INLINE PxHeightFieldFormat::Enum getFormatFast() const { return mData.format; } + PX_FORCE_INLINE PxU32 getFlagsFast() const { return mData.flags; } + + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isZerothVertexShared(PxU32 vertexIndex) const + { + // return (getSample(vertexIndex).tessFlag & PxHeightFieldTessFlag::e0TH_VERTEX_SHARED); + return getSample(vertexIndex).tessFlag() != 0; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 getMaterialIndex0(PxU32 vertexIndex) const { return getSample(vertexIndex).materialIndex0; } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 getMaterialIndex1(PxU32 vertexIndex) const { return getSample(vertexIndex).materialIndex1; } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMaterialIndex01(PxU32 vertexIndex) const + { + const PxHeightFieldSample& sample = getSample(vertexIndex); + return PxU32(sample.materialIndex0 | (sample.materialIndex1 << 16)); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getHeight(PxU32 vertexIndex) const + { + return PxReal(getSample(vertexIndex).height); + } + + PX_INLINE PxReal getHeightInternal2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ) const; + PX_FORCE_INLINE PxReal getHeightInternal(PxReal x, PxReal z) const + { + PxReal fracX, fracZ; + const PxU32 vertexIndex = computeCellCoordinates(x, z, fracX, fracZ); + + return getHeightInternal2(vertexIndex, fracX, fracZ); + } + + PX_FORCE_INLINE bool isValidVertex(PxU32 vertexIndex) const { return vertexIndex < mData.rows*mData.columns; } + + PX_INLINE PxVec3 getVertex(PxU32 vertexIndex) const; + PX_INLINE bool isConvexVertex(PxU32 vertexIndex, PxU32 row, PxU32 column) const; + + PX_INLINE bool isValidEdge(PxU32 edgeIndex) const; + PX_INLINE PxU32 getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2]) const; + PX_INLINE PxU32 getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2], PxU32 cell, PxU32 row, PxU32 column) const; + PX_INLINE void getEdgeVertexIndices(PxU32 edgeIndex, PxU32& vertexIndex0, PxU32& vertexIndex1) const; + // PX_INLINE bool isConvexEdge(PxU32 edgeIndex) const; + PX_INLINE bool isConvexEdge(PxU32 edgeIndex, PxU32 cell, PxU32 row, PxU32 column) const; + PX_FORCE_INLINE bool isConvexEdge(PxU32 edgeIndex) const + { + const PxU32 cell = edgeIndex / 3; + const PxU32 row = cell / mData.columns; + const PxU32 column = cell % mData.columns; + return isConvexEdge(edgeIndex, cell, row, column); + } + + PxU32 computeCellCoordinates(PxReal x, PxReal z, PxReal& fracX, PxReal& fracZ) const; + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMin(PxReal x, PxU32 nb) const + { + if(x<0.0f) + return 0; + if(x>PxReal(nb)) + return nb; + + const PxReal cx = PxFloor(x); + const PxU32 icx = PxU32(cx); + return icx; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMax(PxReal x, PxU32 nb) const + { + if(x<0.0f) + return 0; + if(x>PxReal(nb)) + return nb; + + const PxReal cx = PxCeil(x); + const PxU32 icx = PxU32(cx); + return icx; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMinRow(PxReal x) const { return getMin(x, mData.rows-2); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMaxRow(PxReal x) const { return getMax(x, mData.rows-1); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMinColumn(PxReal z) const { return getMin(z, mData.columns-2); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getMaxColumn(PxReal z) const { return getMax(z, mData.columns-1); } + + PX_CUDA_CALLABLE PX_INLINE bool isValidTriangle(PxU32 triangleIndex) const; + PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFirstTriangle(PxU32 triangleIndex) const { return ((triangleIndex & 0x1) == 0); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 getTriangleMaterial(PxU32 triangleIndex) const + { + return isFirstTriangle(triangleIndex) ? getMaterialIndex0(triangleIndex >> 1) : getMaterialIndex1(triangleIndex >> 1); + } + + PX_CUDA_CALLABLE PX_INLINE void getTriangleVertexIndices(PxU32 triangleIndex, PxU32& vertexIndex0, PxU32& vertexIndex1, PxU32& vertexIndex2) const; + PX_CUDA_CALLABLE PX_INLINE PxVec3 getTriangleNormalInternal(PxU32 triangleIndex) const; + PX_INLINE void getTriangleAdjacencyIndices(PxU32 triangleIndex,PxU32 vertexIndex0, PxU32 vertexIndex1, PxU32 vertexIndex2, PxU32& adjacencyIndex0, PxU32& adjacencyIndex1, PxU32& adjacencyIndex2) const; + + PX_INLINE PxVec3 getNormal_2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff) const; + PX_FORCE_INLINE PxVec3 getNormal_(PxReal x, PxReal z, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff) const + { + PxReal fracX, fracZ; + const PxU32 vertexIndex = computeCellCoordinates(x, z, fracX, fracZ); + + return getNormal_2(vertexIndex, fracX, fracZ, xcoeff, ycoeff, zcoeff); + } + + PX_INLINE PxU32 getTriangleIndex(PxReal x, PxReal z) const; + PX_INLINE PxU32 getTriangleIndex2(PxU32 cell, PxReal fracX, PxReal fracZ) const; + PX_FORCE_INLINE PxU16 getMaterial(PxReal x, PxReal z) const + { + return getTriangleMaterial(getTriangleIndex(x, z)); + } + + PX_FORCE_INLINE PxReal getMinHeight() const { return mMinHeight; } + PX_FORCE_INLINE PxReal getMaxHeight() const { return mMaxHeight; } + + PX_FORCE_INLINE const Gu::HeightFieldData& getData() const { return mData; } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void getTriangleVertices(PxU32 triangleIndex, PxU32 row, PxU32 column, PxVec3& v0, PxVec3& v1, PxVec3& v2) const; + + // checks if current vertex is solid or not + bool isSolidVertex(PxU32 vertexIndex, PxU32 row, PxU32 coloumn, PxU16 holeMaterialIndex, bool& nbSolid) const; + + // PT: TODO: I think we could drop that whole precomputation thing now + // if precomputed bitmap define is used, the collision vertex information + // is precomputed during create height field and stored as a bit in materialIndex1 + PX_PHYSX_COMMON_API bool isCollisionVertexPreca(PxU32 vertexIndex, PxU32 row, PxU32 column, PxU16 holeMaterialIndex) const; + void parseTrianglesForCollisionVertices(PxU16 holeMaterialIndex); + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxHeightFieldSample& getSample(PxU32 vertexIndex) const + { + PX_ASSERT(isValidVertex(vertexIndex)); + return mData.samples[vertexIndex]; + } +#ifdef __CUDACC__ + PX_CUDA_CALLABLE void setSamplePtr(PxHeightFieldSample* s) { mData.samples = s; } +#endif + Gu::HeightFieldData mData; + PxU32 mSampleStride; + PxU32 mNbSamples; // PT: added for platform conversion. Try to remove later. + PxReal mMinHeight; + PxReal mMaxHeight; + PxU32 mModifyCount; + + void releaseMemory(); + virtual ~HeightField(); + +private: + MeshFactory* mMeshFactory; // PT: changed to pointer for serialization +}; + +} // namespace Gu + +PX_INLINE PxVec3 Gu::HeightField::getVertex(PxU32 vertexIndex) const +{ + const PxU32 row = vertexIndex / mData.columns; + const PxU32 column = vertexIndex % mData.columns; +// return PxVec3(PxReal(row), getHeight(row * mData.columns + column), PxReal(column)); + return PxVec3(PxReal(row), getHeight(vertexIndex), PxReal(column)); +} + +// PT: only called from "isCollisionVertex", should move +PX_INLINE bool Gu::HeightField::isConvexVertex(PxU32 vertexIndex, PxU32 row, PxU32 column) const +{ +#ifdef PX_HEIGHTFIELD_DEBUG + PX_ASSERT(isValidVertex(vertexIndex)); +#endif + PX_ASSERT((vertexIndex / mData.columns)==row); + PX_ASSERT((vertexIndex % mData.columns)==column); + +// PxReal h0 = PxReal(2) * getHeight(vertexIndex); + PxI32 h0 = getSample(vertexIndex).height; + h0 += h0; + + bool definedInX, definedInZ; + PxI32 convexityX, convexityZ; + + if ((row > 0) && (row < mData.rows - 1)) + { +// convexityX = h0 - getHeight(vertexIndex + mData.columns) - getHeight(vertexIndex - mData.columns); + convexityX = h0 - getSample(vertexIndex + mData.columns).height - getSample(vertexIndex - mData.columns).height; + definedInX = true; + } + else + { + convexityX = 0; + definedInX = false; + } + + if ((column > 0) && (column < mData.columns - 1)) + { +// convexityZ = h0 - getHeight(vertexIndex + 1) - getHeight(vertexIndex - 1); + convexityZ = h0 - getSample(vertexIndex + 1).height - getSample(vertexIndex - 1).height; + definedInZ = true; + } + else + { + convexityZ = 0; + definedInZ = false; + } + + if(definedInX || definedInZ) + { + // PT: use XOR here + // saddle points +/* if ((convexityX > 0) && (convexityZ < 0)) + return false; + if ((convexityX < 0) && (convexityZ > 0)) + return false;*/ + if(((convexityX ^ convexityZ) & 0x80000000)==0) + return false; + + const PxReal value = PxReal(convexityX + convexityZ); + return value > mData.convexEdgeThreshold; + } + + // this has to be one of the two corner vertices + return true; +} + +PX_INLINE bool Gu::HeightField::isValidEdge(PxU32 edgeIndex) const +{ + const PxU32 cell = (edgeIndex / 3); + const PxU32 row = cell / mData.columns; + const PxU32 column = cell % mData.columns; +// switch (edgeIndex % 3) + switch (edgeIndex - cell*3) + { + case 0: + if (row > mData.rows - 1) return false; + if (column >= mData.columns - 1) return false; + break; + case 1: + if (row >= mData.rows - 1) return false; + if (column >= mData.columns - 1) return false; + break; + case 2: + if (row >= mData.rows - 1) return false; + if (column > mData.columns - 1) return false; + break; + } + return true; +} + +PX_INLINE PxU32 Gu::HeightField::getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2]) const +{ + const PxU32 cell = edgeIndex / 3; + const PxU32 row = cell / mData.columns; + const PxU32 column = cell % mData.columns; + PxU32 count = 0; +// switch (edgeIndex % 3) + switch (edgeIndex - cell*3) + { + case 0: + if (column < mData.columns - 1) + { + if (row > 0) + { +/* if (isZerothVertexShared(cell - mData.columns)) + triangleIndices[count++] = ((cell - mData.columns) << 1); + else + triangleIndices[count++] = ((cell - mData.columns) << 1) + 1;*/ + triangleIndices[count++] = ((cell - mData.columns) << 1) + 1 - isZerothVertexShared(cell - mData.columns); + } + if (row < mData.rows - 1) + { +/* if (isZerothVertexShared(cell)) + triangleIndices[count++] = (cell << 1) + 1; + else + triangleIndices[count++] = cell << 1;*/ + triangleIndices[count++] = (cell << 1) + isZerothVertexShared(cell); + } + } + break; + case 1: + if ((row < mData.rows - 1) && (column < mData.columns - 1)) + { + triangleIndices[count++] = cell << 1; + triangleIndices[count++] = (cell << 1) + 1; + } + break; + case 2: + if (row < mData.rows - 1) + { + if (column > 0) + triangleIndices[count++] = ((cell - 1) << 1) + 1; + if (column < mData.columns - 1) + triangleIndices[count++] = cell << 1; + } + break; + } + return count; +} + +PX_INLINE PxU32 Gu::HeightField::getEdgeTriangleIndices(PxU32 edgeIndex, PxU32 triangleIndices[2], PxU32 cell, PxU32 row, PxU32 column) const +{ +// const PxU32 cell = edgeIndex / 3; +// const PxU32 row = cell / mData.columns; +// const PxU32 column = cell % mData.columns; + PxU32 count = 0; +// switch (edgeIndex % 3) + switch (edgeIndex - cell*3) + { + case 0: + if (column < mData.columns - 1) + { + if (row > 0) + { +/* if (isZerothVertexShared(cell - mData.columns)) + triangleIndices[count++] = ((cell - mData.columns) << 1); + else + triangleIndices[count++] = ((cell - mData.columns) << 1) + 1;*/ + triangleIndices[count++] = ((cell - mData.columns) << 1) + 1 - isZerothVertexShared(cell - mData.columns); + } + if (row < mData.rows - 1) + { +/* if (isZerothVertexShared(cell)) + triangleIndices[count++] = (cell << 1) + 1; + else + triangleIndices[count++] = cell << 1;*/ + triangleIndices[count++] = (cell << 1) + isZerothVertexShared(cell); + } + } + break; + case 1: + if ((row < mData.rows - 1) && (column < mData.columns - 1)) + { + triangleIndices[count++] = cell << 1; + triangleIndices[count++] = (cell << 1) + 1; + } + break; + case 2: + if (row < mData.rows - 1) + { + if (column > 0) + triangleIndices[count++] = ((cell - 1) << 1) + 1; + if (column < mData.columns - 1) + triangleIndices[count++] = cell << 1; + } + break; + } + return count; +} + +PX_INLINE void Gu::HeightField::getEdgeVertexIndices(PxU32 edgeIndex, PxU32& vertexIndex0, PxU32& vertexIndex1) const +{ + const PxU32 cell = edgeIndex / 3; +// switch (edgeIndex % 3) + switch (edgeIndex - cell*3) + { + case 0: + vertexIndex0 = cell; + vertexIndex1 = cell + 1; + break; + case 1: + { +/* if (isZerothVertexShared(cell)) + { + vertexIndex0 = cell; + vertexIndex1 = cell + mData.columns + 1; + } + else + { + vertexIndex0 = cell + 1; + vertexIndex1 = cell + mData.columns; + }*/ + const bool b = isZerothVertexShared(cell); + vertexIndex0 = cell + 1 - b; + vertexIndex1 = cell + mData.columns + b; + } + break; + case 2: + vertexIndex0 = cell; + vertexIndex1 = cell + mData.columns; + break; + } +} + +PX_INLINE bool Gu::HeightField::isConvexEdge(PxU32 edgeIndex, PxU32 cell, PxU32 row, PxU32 column) const +{ +// const PxU32 cell = edgeIndex / 3; + PX_ASSERT(cell == edgeIndex / 3); + +// const PxU32 row = cell / mData.columns; + PX_ASSERT(row == cell / mData.columns); + if (row > mData.rows-2) return false; + +// const PxU32 column = cell % mData.columns; + PX_ASSERT(column == cell % mData.columns); + if (column > mData.columns-2) return false; + +// PxReal h0 = 0, h1 = 0, h2 = 0, h3 = 0; +// PxReal convexity = 0; + PxI32 h0 = 0, h1 = 0, h2 = 0, h3 = 0; + PxI32 convexity = 0; + +// switch (edgeIndex % 3) + switch (edgeIndex - cell*3) + { + case 0: + { + if (row < 1) return false; +/* if(isZerothVertexShared(cell - mData.columns)) + { + // <------ COL + // +----+ 0 R + // | / /# O + // | / / # W + // | / / # | + // |/ / # | + // + +====1 | + // | + // | + // | + // | + // | + // | + // V + // +// h0 = getHeight(cell - mData.columns); +// h1 = getHeight(cell); + h0 = getSample(cell - mData.columns).height; + h1 = getSample(cell).height; + } + else + { + // <------ COL + // 0 +----+ R + // #\ \ | O + // # \ \ | W + // # \ \ | | + // # \ \| | + // 1====+ + | + // | + // | + // | + // | + // | + // | + // V + // +// h0 = getHeight(cell - mData.columns + 1); +// h1 = getHeight(cell + 1); + h0 = getSample(cell - mData.columns + 1).height; + h1 = getSample(cell + 1).height; + }*/ + const bool b0 = !isZerothVertexShared(cell - mData.columns); + h0 = getSample(cell - mData.columns + b0).height; + h1 = getSample(cell + b0).height; + +/* if(isZerothVertexShared(cell)) + { + // <------ COL + // R + // O + // W + // | + // | + // | + // 2====+ 0 | + // # / /| | + // # / / | | + // # / / | | + // #/ / | | + // 3 +----+ | + // V + // +// h2 = getHeight(cell + 1); +// h3 = getHeight(cell + mData.columns + 1); + h2 = getSample(cell + 1).height; + h3 = getSample(cell + mData.columns + 1).height; + } + else + { + // <------ COL + // R + // O + // W + // | + // | + // | + // + +====2 | + // |\ \ # | + // | \ \ # | + // | \ \ # | + // | \ \# | + // +----+ 3 | + // V + // +// h2 = getHeight(cell); +// h3 = getHeight(cell + mData.columns); + h2 = getSample(cell).height; + h3 = getSample(cell + mData.columns).height; + }*/ + const bool b1 = isZerothVertexShared(cell); + h2 = getSample(cell + b1).height; + h3 = getSample(cell + mData.columns + b1).height; + + //convex = (h3-h2) < (h1-h0); + convexity = (h1-h0) - (h3-h2); + } + break; + case 1: +// h0 = getHeight(cell); +// h1 = getHeight(cell + 1); +// h2 = getHeight(cell + mData.columns); +// h3 = getHeight(cell + mData.columns + 1); + h0 = getSample(cell).height; + h1 = getSample(cell + 1).height; + h2 = getSample(cell + mData.columns).height; + h3 = getSample(cell + mData.columns + 1).height; + if (isZerothVertexShared(cell)) + //convex = (h0 + h3) > (h1 + h2); + convexity = (h0 + h3) - (h1 + h2); + else + //convex = (h2 + h1) > (h0 + h3); + convexity = (h2 + h1) - (h0 + h3); + break; + case 2: + { + if (column < 1) return false; +/* if(isZerothVertexShared(cell-1)) + { + // <-------------- COL + // 1====0 + R + // + / /| O + // + / / | W + // + / / | | + // +/ / | | + // + +----+ V + // +// h0 = getHeight(cell - 1); +// h1 = getHeight(cell); + h0 = getSample(cell - 1).height; + h1 = getSample(cell).height; + } + else + { + // <-------------- COL + // + +----+ R + // +\ \ | O + // + \ \ | W + // + \ \ | | + // + \ \| | + // 1====0 + V + // +// h0 = getHeight(cell - 1 + mData.columns); +// h1 = getHeight(cell + mData.columns); + h0 = getSample(cell - 1 + mData.columns).height; + h1 = getSample(cell + mData.columns).height; + }*/ + const PxU32 offset0 = isZerothVertexShared(cell-1) ? 0 : mData.columns; + h0 = getSample(cell - 1 + offset0).height; + h1 = getSample(cell + offset0).height; + +/* if(isZerothVertexShared(cell)) + { + // <-------------- COL + // +----+ + R + // | / /+ O + // | / / + W + // | / / + | + // |/ / + | + // + 3====2 V + // +// h2 = getHeight(cell + mData.columns); +// h3 = getHeight(cell + mData.columns + 1); + h2 = getSample(cell + mData.columns).height; + h3 = getSample(cell + mData.columns + 1).height; + } + else + { + // <-------------- COL + // + 3====2 R + // |\ \ + O + // | \ \ + W + // | \ \ + | + // | \ \+ | + // +----+ + V + // +// h2 = getHeight(cell); +// h3 = getHeight(cell + 1); + h2 = getSample(cell).height; + h3 = getSample(cell + 1).height; + }*/ + const PxU32 offset1 = isZerothVertexShared(cell) ? mData.columns : 0; + h2 = getSample(cell + offset1).height; + h3 = getSample(cell + offset1 + 1).height; + + //convex = (h3-h2) < (h1-h0); + convexity = (h1-h0) - (h3-h2); + } + break; + } + + const PxI32 threshold = PxI32(mData.convexEdgeThreshold); + return convexity > threshold; +} + +PX_INLINE bool Gu::HeightField::isValidTriangle(PxU32 triangleIndex) const +{ + const PxU32 cell = triangleIndex >> 1; + const PxU32 row = cell / mData.columns; + if (row >= (mData.rows - 1)) return false; + const PxU32 column = cell % mData.columns; + if (column >= (mData.columns - 1)) return false; + return true; +} + +PX_INLINE void Gu::HeightField::getTriangleVertexIndices(PxU32 triangleIndex, PxU32& vertexIndex0, PxU32& vertexIndex1, PxU32& vertexIndex2) const +{ + const PxU32 cell = triangleIndex >> 1; + if (isZerothVertexShared(cell)) + { + // <---- COL + // 0----2 1 R + // | 1 / /| O + // | / / | W + // | / / | | + // |/ / 0 | | + // 1 2----0 V + // + if (isFirstTriangle(triangleIndex)) + { + vertexIndex0 = cell + mData.columns; + vertexIndex1 = cell; + vertexIndex2 = cell + mData.columns + 1; + } + else + { + vertexIndex0 = cell + 1; + vertexIndex1 = cell + mData.columns + 1; + vertexIndex2 = cell; + } + } + else + { + // <---- COL + // 2 1----0 R + // |\ \ 0 | O + // | \ \ | W + // | \ \ | | + // | 1 \ \| | + // 0----1 2 V + // + if (isFirstTriangle(triangleIndex)) + { + vertexIndex0 = cell; + vertexIndex1 = cell + 1; + vertexIndex2 = cell + mData.columns; + } + else + { + vertexIndex0 = cell + mData.columns + 1; + vertexIndex1 = cell + mData.columns; + vertexIndex2 = cell + 1; + } + } +} + +PX_INLINE void Gu::HeightField::getTriangleAdjacencyIndices(PxU32 triangleIndex, PxU32 vertexIndex0, PxU32 vertexIndex1, PxU32 vertexIndex2, PxU32& adjacencyIndex0, PxU32& adjacencyIndex1, PxU32& adjacencyIndex2) const +{ + PX_UNUSED(vertexIndex0); + PX_UNUSED(vertexIndex1); + PX_UNUSED(vertexIndex2); + + const PxU32 cell = triangleIndex >> 1; + if (isZerothVertexShared(cell)) + { + // <---- COL + // 0----2 1 R + // | 1 / /| O + // | / / | W + // | / / | | + // |/ / 0 | | + // 1 2----0 V + // + if (isFirstTriangle(triangleIndex)) + { + adjacencyIndex0 = 0xFFFFFFFF; + adjacencyIndex1 = triangleIndex + 1; + adjacencyIndex2 = 0xFFFFFFFF; + + if((cell % (mData.columns) != 0)) + { + adjacencyIndex0 = triangleIndex - 1; + } + + if((cell / mData.columns != mData.rows - 2)) + { + const PxU32 tMod = isZerothVertexShared(cell + mData.columns) ? 1u : 0u; + adjacencyIndex2 = ((cell + mData.columns) * 2) + tMod; + } + } + else + { + adjacencyIndex0 = 0xFFFFFFFF; + adjacencyIndex1 = triangleIndex - 1; + adjacencyIndex2 = 0xFFFFFFFF; + + if(cell % (mData.columns) < (mData.columns - 2)) + { + adjacencyIndex0 = triangleIndex + 1; + } + + if(cell >= mData.columns - 1) + { + const PxU32 tMod = isZerothVertexShared(cell - mData.columns) ? 0u : 1u; + adjacencyIndex2 = ((cell - mData.columns) * 2) + tMod; + } + } + } + else + { + // <---- COL + // 2 1----0 R + // |\ \ 0 | O + // | \ \ | W + // | \ \ | | + // | 1 \ \| | + // 0----1 2 V + // + if (isFirstTriangle(triangleIndex)) + { + adjacencyIndex0 = 0xFFFFFFFF; + adjacencyIndex1 = triangleIndex + 1; + adjacencyIndex2 = 0xFFFFFFFF; + + if(cell >= mData.columns - 1) + { + const PxU32 tMod = isZerothVertexShared(cell - mData.columns) ? 0u : 1u; + adjacencyIndex0 = ((cell - (mData.columns)) * 2) + tMod; + } + + if((cell % (mData.columns) != 0)) + { + adjacencyIndex2 = triangleIndex - 1; + } + } + else + { + adjacencyIndex0 = 0xFFFFFFFF; + adjacencyIndex1 = triangleIndex - 1; + adjacencyIndex2 = 0xFFFFFFFF; + + if((cell / mData.columns != mData.rows - 2)) + { + const PxU32 tMod = isZerothVertexShared(cell + mData.columns) ? 1u : 0u; + adjacencyIndex0 = (cell + (mData.columns)) * 2 + tMod; + } + + if(cell % (mData.columns) < (mData.columns - 2)) + { + adjacencyIndex2 = triangleIndex + 1; + } + } + } +} + +PX_INLINE PxVec3 Gu::HeightField::getTriangleNormalInternal(PxU32 triangleIndex) const +{ + PxU32 v0, v1, v2; + getTriangleVertexIndices(triangleIndex, v0, v1, v2); + +// const PxReal h0 = getHeight(v0); +// const PxReal h1 = getHeight(v1); +// const PxReal h2 = getHeight(v2); + const PxI32 h0 = getSample(v0).height; + const PxI32 h1 = getSample(v1).height; + const PxI32 h2 = getSample(v2).height; + + const float thickness = 0.0f; + const PxReal coeff = physx::intrinsics::fsel(thickness, -1.0f, 1.0f); + +// PxVec3 n(0,1,0); + const PxU32 cell = triangleIndex >> 1; + if (isZerothVertexShared(cell)) + { + // <---- COL + // 0----2 1 R + // | 1 / /| O + // | / / | W + // | / / | | + // |/ / 0 | | + // 1 2----0 V + // + if (isFirstTriangle(triangleIndex)) + { +// n.x = -(h0-h1); +// n.z = -(h2-h0); + return PxVec3(coeff*PxReal(h1-h0), coeff, coeff*PxReal(h0-h2)); + } + else + { +// n.x = -(h1-h0); +// n.z = -(h0-h2); + return PxVec3(coeff*PxReal(h0-h1), coeff, coeff*PxReal(h2-h0)); + } + } + else + { + // <---- COL + // 2 1----0 R + // |\ \ 0 | O + // | \ \ | W + // | \ \ | | + // | 1 \ \| | + // 0----1 2 V + // + if (isFirstTriangle(triangleIndex)) + { +// n.x = -(h2-h0); +// n.z = -(h1-h0); + return PxVec3(coeff*PxReal(h0-h2), coeff, coeff*PxReal(h0-h1)); + } + else + { +// n.x = -(h0-h2); +// n.z = -(h0-h1); + return PxVec3(coeff*PxReal(h2-h0), coeff, coeff*PxReal(h1-h0)); + } + } +// return n; +} + +PX_INLINE PxReal Gu::HeightField::getHeightInternal2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ) const +{ + if (isZerothVertexShared(vertexIndex)) + { + // <----Z---+ + // +----+ | + // | /| | + // | / | X + // | / | | + // |/ | | + // +----+ | + // V + const PxReal h0 = getHeight(vertexIndex); + const PxReal h2 = getHeight(vertexIndex + mData.columns + 1); + if (fracZ > fracX) + { + // <----Z---+ + // 1----0 | + // | / | + // | / X + // | / | + // |/ | + // 2 | + // V + const PxReal h1 = getHeight(vertexIndex + 1); + return h0 + fracZ*(h1-h0) + fracX*(h2-h1); + } + else + { + // <----Z---+ + // 0 | + // /| | + // / | X + // / | | + // / | | + // 2----1 | + // V + const PxReal h1 = getHeight(vertexIndex + mData.columns); + return h0 + fracX*(h1-h0) + fracZ*(h2-h1); + } + } + else + { + // <----Z---+ + // +----+ | + // |\ | | + // | \ | X + // | \ | | + // | \| | + // +----+ | + // V + const PxReal h2 = getHeight(vertexIndex + mData.columns); + const PxReal h1 = getHeight(vertexIndex + 1); + if (fracX + fracZ < 1.0f) + { + // <----Z---+ + // 1----0 | + // \ | | + // \ | X + // \ | | + // \| | + // 2 | + // V + const PxReal h0 = getHeight(vertexIndex); + return h0 + fracZ*(h1-h0) + fracX*(h2-h0); + } + else + { + // <----Z---+ + // 1 | + // |\ | + // | \ X + // | \ | + // | \ | + // 0----2 | + // V + // + // Note that we need to flip fracX and fracZ since we are moving the origin + const PxReal h0 = getHeight(vertexIndex + mData.columns + 1); + return h0 + (1.0f - fracZ)*(h2-h0) + (1.0f - fracX)*(h1-h0); + } + } +} + +PX_INLINE PxVec3 Gu::HeightField::getNormal_2(PxU32 vertexIndex, PxReal fracX, PxReal fracZ, PxReal xcoeff, PxReal ycoeff, PxReal zcoeff) const +{ + PxVec3 normal; + if (isZerothVertexShared(vertexIndex)) + { + // <----Z---+ + // +----+ | + // | /| | + // | / | X + // | / | | + // |/ | | + // +----+ | + // V +// const PxReal h0 = getHeight(vertexIndex); +// const PxReal h2 = getHeight(vertexIndex + mData.columns + 1); + const PxI32 ih0 = getSample(vertexIndex).height; + const PxI32 ih2 = getSample(vertexIndex + mData.columns + 1).height; + if (fracZ >= fracX) + { + // <----Z---+ + // 1----0 | + // | / | + // | / X + // | / | + // |/ | + // 2 | + // V +// const PxReal h0 = getHeight(vertexIndex); +// const PxReal h1 = getHeight(vertexIndex + 1); +// const PxReal h2 = getHeight(vertexIndex + mData.columns + 1); +// normal.set(-(h2-h1), 1.0f, -(h1-h0)); + const PxI32 ih1 = getSample(vertexIndex + 1).height; + normal = PxVec3(PxReal(ih1 - ih2)*xcoeff, ycoeff, PxReal(ih0 - ih1)*zcoeff); + } + else + { + // <----Z---+ + // 0 | + // /| | + // / | X + // / | | + // / | | + // 2----1 | + // V +// const PxReal h0 = getHeight(vertexIndex); +// const PxReal h1 = getHeight(vertexIndex + mData.columns); +// const PxReal h2 = getHeight(vertexIndex + mData.columns + 1); +// normal.set(-(h1-h0), 1.0f, -(h2-h1)); + const PxI32 ih1 = getSample(vertexIndex + mData.columns).height; + normal = PxVec3(PxReal(ih0 - ih1)*xcoeff, ycoeff, PxReal(ih1 - ih2)*zcoeff); + } + } + else + { + // <----Z---+ + // +----+ | + // |\ | | + // | \ | X + // | \ | | + // | \| | + // +----+ | + // V + const PxI32 ih1 = getSample(vertexIndex + 1).height; + const PxI32 ih2 = getSample(vertexIndex + mData.columns).height; + if (fracX + fracZ <= PxReal(1)) + { + // <----Z---+ + // 1----0 | + // \ | | + // \ | X + // \ | | + // \| | + // 2 | + // V +// const PxReal h0 = getHeight(vertexIndex); +// const PxReal h1 = getHeight(vertexIndex + 1); +// const PxReal h2 = getHeight(vertexIndex + mData.columns); +// normal.set(-(h2-h0), 1.0f, -(h1-h0)); + const PxI32 ih0 = getSample(vertexIndex).height; +// const PxI32 ih1 = getSample(vertexIndex + 1).height; +// const PxI32 ih2 = getSample(vertexIndex + mData.columns).height; + normal = PxVec3(PxReal(ih0 - ih2)*xcoeff, ycoeff, PxReal(ih0 - ih1)*zcoeff); + } + else + { + // <----Z---+ + // 2 | + // |\ | + // | \ X + // | \ | + // | \ | + // 0----1 | + // V + // + // Note that we need to flip fracX and fracZ since we are moving the origin +// const PxReal h2 = getHeight(vertexIndex + 1); +// const PxReal h1 = getHeight(vertexIndex + mData.columns); +// const PxReal h0 = getHeight(vertexIndex + mData.columns + 1); +// normal.set(-(h0-h2), 1.0f, -(h0-h1)); +// const PxI32 ih2 = getSample(vertexIndex + 1).height; +// const PxI32 ih1 = getSample(vertexIndex + mData.columns).height; + const PxI32 ih0 = getSample(vertexIndex + mData.columns + 1).height; +// normal.set(PxReal(ih2 - ih0), 1.0f, PxReal(ih1b - ih0)); + normal = PxVec3(PxReal(ih1 - ih0)*xcoeff, ycoeff, PxReal(ih2 - ih0)*zcoeff); + } + } + return normal; +} + +PX_INLINE PxU32 Gu::HeightField::getTriangleIndex2(PxU32 cell, PxReal fracX, PxReal fracZ) const +{ + if (isZerothVertexShared(cell)) + return (fracZ > fracX) ? (cell << 1) + 1 : (cell << 1); + else + return (fracX + fracZ > 1) ? (cell << 1) + 1 : (cell << 1); +} + +PX_INLINE PxU32 Gu::HeightField::getTriangleIndex(PxReal x, PxReal z) const +{ + PxReal fracX, fracZ; + const PxU32 cell = computeCellCoordinates(x, z, fracX, fracZ); + + return getTriangleIndex2(cell, fracX, fracZ); +} + +PX_FORCE_INLINE void Gu::HeightField::getTriangleVertices(PxU32 triangleIndex, PxU32 row, PxU32 column, PxVec3& v0, PxVec3& v1, PxVec3& v2) const +{ + PxU32 cell = triangleIndex >> 1; + PX_ASSERT(row * getNbColumnsFast() + column == cell); + + PxReal h0 = getHeight(cell); + PxReal h1 = getHeight(cell + 1); + PxReal h2 = getHeight(cell + getNbColumnsFast()); + PxReal h3 = getHeight(cell + getNbColumnsFast() + 1); + + if (isFirstTriangle(triangleIndex)) + { + if (isZerothVertexShared(cell)) + { + // <---- COL + // 1 R + // /| O + // / | W + // / | | + // / 0 | | + // 2----0 V + // + v0 = PxVec3(PxReal(row + 1), h2, PxReal(column )); + v1 = PxVec3(PxReal(row ), h0, PxReal(column )); + v2 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1)); + } + else + { + // <---- COL + // 1----0 R + // \ 0 | O + // \ | W + // \ | | + // \| | + // 2 V + // + v0 = PxVec3(PxReal(row ), h0, PxReal(column )); + v1 = PxVec3(PxReal(row ), h1, PxReal(column + 1)); + v2 = PxVec3(PxReal(row + 1), h2, PxReal(column )); + } + } + else + { + if (isZerothVertexShared(cell)) + { + // <---- COL + // 0----2 R + // | 1 / O + // | / W + // | / | + // |/ | + // 1 V + // + v0 = PxVec3(PxReal(row ), h1, PxReal(column + 1)); + v1 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1)); + v2 = PxVec3(PxReal(row ), h0, PxReal(column )); + } + else + { + // <---- COL + // 2 R + // |\ O + // | \ W + // | \ | + // | 1 \ | + // 0----1 V + // + v0 = PxVec3(PxReal(row + 1), h3, PxReal(column + 1)); + v1 = PxVec3(PxReal(row + 1), h2, PxReal(column )); + v2 = PxVec3(PxReal(row ), h1, PxReal(column + 1)); + } + } +} + +PX_FORCE_INLINE const Gu::HeightFieldData* _getHFData(const PxHeightFieldGeometry& hfGeom) +{ + return &static_cast(hfGeom.heightField)->getData(); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldData.h new file mode 100644 index 0000000..50091d1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldData.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_HEIGHTFIELD_DATA_H +#define GU_HEIGHTFIELD_DATA_H + +#include "foundation/PxSimpleTypes.h" +#include "geometry/PxHeightFieldFlag.h" +#include "geometry/PxHeightFieldSample.h" +#include "GuCenterExtents.h" + +namespace physx +{ + +namespace Gu +{ + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif +struct PX_PHYSX_COMMON_API HeightFieldData +{ +// PX_SERIALIZATION + PX_FORCE_INLINE HeightFieldData() {} + PX_FORCE_INLINE HeightFieldData(const PxEMPTY) : flags(PxEmpty) {} +//~PX_SERIALIZATION + + //properties + // PT: WARNING: bounds must be followed by at least 32bits of data for safe SIMD loading + CenterExtents mAABB; + PxU32 rows; // PT: WARNING: don't change this member's name (used in ConvX) + PxU32 columns; // PT: WARNING: don't change this member's name (used in ConvX) + PxU32 rowLimit; + PxU32 colLimit; + PxU32 nbColumns; + PxHeightFieldSample* samples; // PT: WARNING: don't change this member's name (used in ConvX) + PxReal convexEdgeThreshold; + + PxHeightFieldFlags flags; + + PxHeightFieldFormat::Enum format; + + PX_FORCE_INLINE const CenterExtentsPadded& getPaddedBounds() const + { + // PT: see compile-time assert below + return static_cast(mAABB); + } +}; +#if PX_VC + #pragma warning(pop) +#endif + + // PT: 'getPaddedBounds()' is only safe if we make sure the bounds member is followed by at least 32bits of data + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(Gu::HeightFieldData, rows)>=PX_OFFSET_OF(Gu::HeightFieldData, mAABB)+4); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp new file mode 100644 index 0000000..9f8022e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.cpp @@ -0,0 +1,229 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxMeshScale.h" + +#include "GuHeightFieldUtil.h" +#include "GuSweepSharedTests.h" +#include "GuHeightField.h" +#include "GuEntityReport.h" +#include "foundation/PxIntrinsics.h" +#include "CmScaling.h" + +using namespace physx; + +void Gu::HeightFieldUtil::computeLocalBounds(PxBounds3& bounds) const +{ + const PxMeshScale scale(PxVec3(mHfGeom->rowScale, mHfGeom->heightScale, mHfGeom->columnScale), PxQuat(PxIdentity)); + const PxMat33 mat33 = Cm::toMat33(scale); + + bounds.minimum = mat33.transform(mHeightField->getData().mAABB.getMin()); + bounds.maximum = mat33.transform(mHeightField->getData().mAABB.getMax()); + + // PT: HFs will assert in Gu::intersectRayAABB2() if we don't deal with that + const float deltaY = GU_MIN_AABB_EXTENT*0.5f - (bounds.maximum.y - bounds.minimum.y); + if(deltaY>0.0f) + { + bounds.maximum.y += deltaY*0.6f; + bounds.minimum.y -= deltaY*0.6f; + } +} + +static PX_FORCE_INLINE bool reportTriangle(Gu::OverlapReport& callback, PxU32 material, PxU32* PX_RESTRICT indexBuffer, const PxU32 bufferSize, PxU32& indexBufferUsed, PxU32 triangleIndex) +{ + if(material != PxHeightFieldMaterial::eHOLE) + { + indexBuffer[indexBufferUsed++] = triangleIndex; + + if(indexBufferUsed >= bufferSize) + { + if(!callback.reportTouchedTris(indexBufferUsed, indexBuffer)) + return false; + indexBufferUsed = 0; + } + } + return true; +} + +void Gu::HeightFieldUtil::overlapAABBTriangles(const PxBounds3& bounds, OverlapReport& callback, PxU32 batchSize) const +{ + PX_ASSERT(batchSize<=HF_OVERLAP_REPORT_BUFFER_SIZE); + PX_ASSERT(!bounds.isEmpty()); + + PxBounds3 localBounds = bounds; + + localBounds.minimum.x *= mOneOverRowScale; + localBounds.minimum.y *= mOneOverHeightScale; + localBounds.minimum.z *= mOneOverColumnScale; + + localBounds.maximum.x *= mOneOverRowScale; + localBounds.maximum.y *= mOneOverHeightScale; + localBounds.maximum.z *= mOneOverColumnScale; + + if(mHfGeom->rowScale < 0.0f) + PxSwap(localBounds.minimum.x, localBounds.maximum.x); + + if(mHfGeom->columnScale < 0.0f) + PxSwap(localBounds.minimum.z, localBounds.maximum.z); + + // early exit for aabb does not overlap in XZ plane + // DO NOT MOVE: since rowScale / columnScale may be negative this has to be done after scaling localBounds + const PxU32 nbRows = mHeightField->getNbRowsFast(); + const PxU32 nbColumns = mHeightField->getNbColumnsFast(); + if(localBounds.minimum.x > float(nbRows - 1)) + return; + if(localBounds.minimum.z > float(nbColumns - 1)) + return; + if(localBounds.maximum.x < 0.0f) + return; + if(localBounds.maximum.z < 0.0f) + return; + + const PxU32 minRow = mHeightField->getMinRow(localBounds.minimum.x); + const PxU32 maxRow = mHeightField->getMaxRow(localBounds.maximum.x); + const PxU32 minColumn = mHeightField->getMinColumn(localBounds.minimum.z); + const PxU32 maxColumn = mHeightField->getMaxColumn(localBounds.maximum.z); + const PxU32 deltaColumn = maxColumn - minColumn; + + const PxU32 maxNbTriangles = 2 * deltaColumn * (maxRow - minRow); + if(!maxNbTriangles) + return; + + const PxU32 bufferSize = batchSize<=HF_OVERLAP_REPORT_BUFFER_SIZE ? batchSize : HF_OVERLAP_REPORT_BUFFER_SIZE; + PxU32 indexBuffer[HF_OVERLAP_REPORT_BUFFER_SIZE]; + PxU32 indexBufferUsed = 0; + + PxU32 offset = minRow * nbColumns + minColumn; + + const PxReal miny = localBounds.minimum.y; + const PxReal maxy = localBounds.maximum.y; + const PxU32 columnStride = nbColumns - deltaColumn; + + for(PxU32 row=minRow; rowgetHeight(offset); + const PxReal h1 = mHeightField->getHeight(offset + 1); + const PxReal h2 = mHeightField->getHeight(offset + nbColumns); + const PxReal h3 = mHeightField->getHeight(offset + nbColumns + 1); + + const bool bmax = maxy < h0 && maxy < h1 && maxy < h2 && maxy < h3; + const bool bmin = miny > h0 && miny > h1 && miny > h2 && miny > h3; + + if(!(bmax || bmin)) + { + if(!reportTriangle(callback, mHeightField->getMaterialIndex0(offset), indexBuffer, bufferSize, indexBufferUsed, offset << 1)) + return; + + if(!reportTriangle(callback, mHeightField->getMaterialIndex1(offset), indexBuffer, bufferSize, indexBufferUsed, (offset << 1) + 1)) + return; + } + offset++; + } + offset += columnStride; + } + + if(indexBufferUsed > 0) + callback.reportTouchedTris(indexBufferUsed, indexBuffer); +} + +PxU32 Gu::HeightFieldUtil::getTriangle(const PxTransform& pose, PxTriangle& worldTri, + PxU32* _vertexIndices, PxU32* adjacencyIndices, PxTriangleID triangleIndex, bool worldSpaceTranslation, bool worldSpaceRotation) const +{ +#if PX_CHECKED + if (!mHeightField->isValidTriangle(triangleIndex)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "HeightFieldShape::getTriangle: Invalid triangle index!"); + return 0; + } +#endif + + PxVec3 handedness(1.0f); // Vector to invert normal coordinates according to the heightfield scales + bool wrongHanded = false; + if (mHfGeom->columnScale < 0) + { + wrongHanded = !wrongHanded; + handedness.z = -1.0f; + } + if (mHfGeom->rowScale < 0) + { + wrongHanded = !wrongHanded; + handedness.x = -1.0f; + } + +/* if (0) // ptchernev: Iterating over triangles becomes a pain. + { + if (mHeightField.getTriangleMaterial(triangleIndex) == mHfGeom.holeMaterialIndex) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "HeightFieldShape::getTriangle: Non-existing triangle (triangle has hole material)!"); + return 0; + } + }*/ + + PxU32 vertexIndices[3]; + mHeightField->getTriangleVertexIndices(triangleIndex, vertexIndices[0], vertexIndices[1+wrongHanded], vertexIndices[2-wrongHanded]); + + if(adjacencyIndices) + { + mHeightField->getTriangleAdjacencyIndices( triangleIndex, vertexIndices[0], vertexIndices[1+wrongHanded], vertexIndices[2-wrongHanded], + adjacencyIndices[wrongHanded ? 2 : 0], adjacencyIndices[1], adjacencyIndices[wrongHanded ? 0 : 2]); + } + + if(_vertexIndices) + { + _vertexIndices[0] = vertexIndices[0]; + _vertexIndices[1] = vertexIndices[1]; + _vertexIndices[2] = vertexIndices[2]; + } + + if (worldSpaceRotation) + { + if (worldSpaceTranslation) + { + for (PxU32 vi = 0; vi < 3; vi++) + worldTri.verts[vi] = hf2worldp(pose, mHeightField->getVertex(vertexIndices[vi])); + } + else + { + for (PxU32 vi = 0; vi < 3; vi++) + { + // TTP 2390 + // local space here is rotated (but not translated) world space + worldTri.verts[vi] = pose.q.rotate(hf2shapep(mHeightField->getVertex(vertexIndices[vi]))); + } + } + } + else + { + const PxVec3 offset = worldSpaceTranslation ? pose.p : PxVec3(0.0f); + for (PxU32 vi = 0; vi < 3; vi++) + worldTri.verts[vi] = hf2shapep(mHeightField->getVertex(vertexIndices[vi])) + offset; + } + return PxU32(mHeightField->getTriangleMaterial(triangleIndex) != PxHeightFieldMaterial::eHOLE); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.h new file mode 100644 index 0000000..050c150 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuHeightFieldUtil.h @@ -0,0 +1,838 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_HEIGHTFIELD_UTIL_H +#define GU_HEIGHTFIELD_UTIL_H + +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxTriangle.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxSIMDHelpers.h" + +#include "GuHeightField.h" +#include "../intersection/GuIntersectionRayTriangle.h" +#include "../intersection/GuIntersectionRayBox.h" + +namespace physx +{ +#define HF_SWEEP_REPORT_BUFFER_SIZE 64 +#define HF_OVERLAP_REPORT_BUFFER_SIZE 64 + +namespace Gu +{ + class OverlapReport; + + // PT: this is used in the context of sphere-vs-heightfield overlaps + PX_FORCE_INLINE PxVec3 getLocalSphereData(PxBounds3& localBounds, const PxTransform& pose0, const PxTransform& pose1, float radius) + { + const PxVec3 localSphereCenter = pose1.transformInv(pose0.p); + + const PxVec3 extents(radius); + localBounds.minimum = localSphereCenter - extents; + localBounds.maximum = localSphereCenter + extents; + + return localSphereCenter; + } + + PX_FORCE_INLINE PxBounds3 getLocalCapsuleBounds(float radius, float halfHeight) + { + const PxVec3 extents(halfHeight + radius, radius, radius); + return PxBounds3(-extents, extents); + } + + class PX_PHYSX_COMMON_API HeightFieldUtil + { + public: + PxReal mOneOverRowScale; + PxReal mOneOverHeightScale; + PxReal mOneOverColumnScale; + const Gu::HeightField* mHeightField; + const PxHeightFieldGeometry* mHfGeom; + + PX_FORCE_INLINE HeightFieldUtil(const PxHeightFieldGeometry& hfGeom) : mHeightField(static_cast(hfGeom.heightField)), mHfGeom(&hfGeom) + { + const PxReal absRowScale = PxAbs(mHfGeom->rowScale); + const PxReal absColScale = PxAbs(mHfGeom->columnScale); + //warning #1931-D on WIIU: sizeof is not a type, variable, or dereferenced pointer expression + PX_COMPILE_TIME_ASSERT(sizeof(reinterpret_cast(0)->height) == 2); + //PxReal minHeightPerSample = PX_MIN_HEIGHTFIELD_Y_SCALE; + PX_ASSERT(mHfGeom->heightScale >= PX_MIN_HEIGHTFIELD_Y_SCALE); + PX_ASSERT(absRowScale >= PX_MIN_HEIGHTFIELD_XZ_SCALE); + PX_ASSERT(absColScale >= PX_MIN_HEIGHTFIELD_XZ_SCALE); + PX_UNUSED(absRowScale); + PX_UNUSED(absColScale); + //using physx::intrinsics::fsel; + //mOneOverHeightScale = fsel(mHfGeom->heightScale - minHeightPerSample, 1.0f / mHfGeom->heightScale, 1.0f / minHeightPerSample); + mOneOverHeightScale = 1.0f / mHfGeom->heightScale; + mOneOverRowScale = 1.0f / mHfGeom->rowScale; + mOneOverColumnScale = 1.0f / mHfGeom->columnScale; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const Gu::HeightField& getHeightField() const { return *mHeightField; } + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxHeightFieldGeometry& getHeightFieldGeometry() const { return *mHfGeom; } + + PX_FORCE_INLINE PxReal getOneOverRowScale() const { return mOneOverRowScale; } + PX_FORCE_INLINE PxReal getOneOverHeightScale() const { return mOneOverHeightScale; } + PX_FORCE_INLINE PxReal getOneOverColumnScale() const { return mOneOverColumnScale; } + + void computeLocalBounds(PxBounds3& bounds) const; + + PX_FORCE_INLINE PxReal getHeightAtShapePoint(PxReal x, PxReal z) const + { + return mHfGeom->heightScale * mHeightField->getHeightInternal(x * mOneOverRowScale, z * mOneOverColumnScale); + } + + PX_FORCE_INLINE PxVec3 getNormalAtShapePoint(PxReal x, PxReal z) const + { + return mHeightField->getNormal_(x * mOneOverRowScale, z * mOneOverColumnScale, mOneOverRowScale, mOneOverHeightScale, mOneOverColumnScale); + } + + PxU32 getTriangle(const PxTransform&, PxTriangle& worldTri, PxU32* vertexIndices, PxU32* adjacencyIndices, PxTriangleID triangleIndex, bool worldSpaceTranslation=true, bool worldSpaceRotation=true) const; + + void overlapAABBTriangles(const PxBounds3& localBounds, OverlapReport& callback, PxU32 batchSize=HF_OVERLAP_REPORT_BUFFER_SIZE) const; + + PX_FORCE_INLINE void overlapAABBTriangles0to1(const PxTransform& pose0to1, const PxBounds3& bounds0, OverlapReport& callback, PxU32 batchSize=HF_OVERLAP_REPORT_BUFFER_SIZE) const + { + // PT: TODO: optimize PxBounds3::transformFast + //overlapAABBTriangles(PxBounds3::transformFast(pose0to1, bounds0), callback, batchSize); + { + // PT: below is the equivalent, slightly faster code. Still not optimal but better. + // PT: TODO: refactor with GuBounds.cpp + + const PxMat33Padded basis(pose0to1.q); + + // PT: TODO: pass c/e directly + const PxBounds3 b = PxBounds3::basisExtent(pose0to1.transform(bounds0.getCenter()), basis, bounds0.getExtents()); + + overlapAABBTriangles(b, callback, batchSize); + } + } + + PX_FORCE_INLINE void overlapAABBTriangles(const PxTransform& pose1, const PxBounds3& bounds0, OverlapReport& callback, PxU32 batchSize=HF_OVERLAP_REPORT_BUFFER_SIZE) const + { + overlapAABBTriangles0to1(pose1.getInverse(), bounds0, callback, batchSize); + } + + PX_FORCE_INLINE void overlapAABBTriangles(const PxTransform& pose0, const PxTransform& pose1, const PxBounds3& bounds0, OverlapReport& callback, PxU32 batchSize=HF_OVERLAP_REPORT_BUFFER_SIZE) const + { + overlapAABBTriangles0to1(pose1.transformInv(pose0), bounds0, callback, batchSize); + } + + PX_FORCE_INLINE PxVec3 hf2shapen(const PxVec3& v) const + { + return PxVec3(v.x * mOneOverRowScale, v.y * mOneOverHeightScale, v.z * mOneOverColumnScale); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 shape2hfp(const PxVec3& v) const + { + return PxVec3(v.x * mOneOverRowScale, v.y * mOneOverHeightScale, v.z * mOneOverColumnScale); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 hf2shapep(const PxVec3& v) const + { + return PxVec3(v.x * mHfGeom->rowScale, v.y * mHfGeom->heightScale, v.z * mHfGeom->columnScale); + } + + PX_INLINE PxVec3 hf2worldp(const PxTransform& pose, const PxVec3& v) const + { + const PxVec3 s = hf2shapep(v); + return pose.transform(s); + } + + PX_INLINE PxVec3 hf2worldn(const PxTransform& pose, const PxVec3& v) const + { + const PxVec3 s = hf2shapen(v); + return pose.q.rotate(s); + } + }; + + class PX_PHYSX_COMMON_API HeightFieldTraceUtil : public HeightFieldUtil + { + public: + PX_FORCE_INLINE HeightFieldTraceUtil(const PxHeightFieldGeometry& hfGeom) : HeightFieldUtil(hfGeom) {} + + // floor and ceil don't clamp down exact integers but we want that + static PX_FORCE_INLINE PxF32 floorDown(PxF32 x) { PxF32 f = PxFloor(x); return (f == x) ? f-1 : f; } + static PX_FORCE_INLINE PxF32 ceilUp (PxF32 x) { PxF32 f = PxCeil (x); return (f == x) ? f+1 : f; } + + // helper class for testing triangle height and reporting the overlapped triangles + template + class OverlapTraceSegment + { + public: + // helper rectangle struct + struct OverlapRectangle + { + PxI32 mMinu; + PxI32 mMaxu; + PxI32 mMinv; + PxI32 mMaxv; + + void invalidate() + { + mMinu = 1; + mMaxu = -1; + mMinv = 1; + mMaxv = -1; + } + }; + + // helper line struct + struct OverlapLine + { + bool mColumn; + PxI32 mLine; + PxI32 mMin; + PxI32 mMax; + + void invalidate() + { + mMin = 1; + mMax = -1; + } + }; + + public: + void operator = (OverlapTraceSegment&) {} + + OverlapTraceSegment(const HeightFieldUtil& hfUtil,const Gu::HeightField& hf) + : mInitialized(false), mHfUtil(hfUtil), mHf(hf), mNbIndices(0) {} + + PX_FORCE_INLINE bool initialized() const { return mInitialized; } + + // prepare for iterations, set the expand u|v + PX_INLINE void prepare(const PxVec3& aP0, const PxVec3& aP1, const PxVec3& overlapObjectExtent, PxF32& expandu, PxF32& expandv) + { + // height test bounds + mMinY = (PxMin(aP1.y,aP0.y) - overlapObjectExtent.y) * mHfUtil.getOneOverHeightScale(); + mMaxY = (PxMax(aP1.y,aP0.y) + overlapObjectExtent.y) * mHfUtil.getOneOverHeightScale(); + + // sets the clipping variables + mMinRow = PxI32(mHf.getMinRow((PxMin(aP1.x,aP0.x) - overlapObjectExtent.x)* mHfUtil.getOneOverRowScale())); + mMaxRow = PxI32(mHf.getMaxRow((PxMax(aP1.x,aP0.x) + overlapObjectExtent.x)* mHfUtil.getOneOverRowScale())); + mMinColumn = PxI32(mHf.getMinColumn((PxMin(aP1.z,aP0.z) - overlapObjectExtent.z)* mHfUtil.getOneOverColumnScale())); + mMaxColumn = PxI32(mHf.getMaxColumn((PxMax(aP1.z,aP0.z) + overlapObjectExtent.z)* mHfUtil.getOneOverColumnScale())); + + // sets the expanded u|v coordinates + expandu = PxCeil(overlapObjectExtent.x*mHfUtil.getOneOverRowScale()); + expandv = PxCeil(overlapObjectExtent.z*mHfUtil.getOneOverColumnScale()); + + // sets the offset that will be overlapped in each axis + mOffsetU = PxI32(expandu) + 1; + mOffsetV = PxI32(expandv) + 1; + } + + // sets all necessary variables and makes initial rectangle setup and overlap + PX_INLINE bool init(const PxI32 ui, const PxI32 vi, const PxI32 nbVi, const PxI32 step_ui, const PxI32 step_vi, T* aCallback) + { + mInitialized = true; + mCallback = aCallback; + mNumColumns = nbVi; + mStep_ui = step_ui > 0 ? 0 : -1; + mStep_vi = step_vi > 0 ? 0 : -1; + + // sets the rectangles + mCurrentRectangle.invalidate(); + mPreviousRectangle.mMinu = ui - mOffsetU; + mPreviousRectangle.mMaxu = ui + mOffsetU; + mPreviousRectangle.mMinv = vi - mOffsetV; + mPreviousRectangle.mMaxv = vi + mOffsetV; + + // visits all cells in given initial rectangle + if(!visitCells(mPreviousRectangle)) + return false; + + // reports all overlaps + if(!reportOverlaps()) + return false; + + return true; + } + + // u|v changed, check for new rectangle - compare with previous one and parse + // the added line, which is a result from the rectangle compare + PX_INLINE bool step(const PxI32 ui, const PxI32 vi) + { + mCurrentRectangle.mMinu = ui - mOffsetU; + mCurrentRectangle.mMaxu = ui + mOffsetU; + mCurrentRectangle.mMinv = vi - mOffsetV; + mCurrentRectangle.mMaxv = vi + mOffsetV; + OverlapLine line; + computeRectangleDifference(mCurrentRectangle,mPreviousRectangle,line); + + if(!visitCells(line)) + return false; + if(!reportOverlaps()) + return false; + + mPreviousRectangle = mCurrentRectangle; + return true; + } + + PX_INLINE void computeRectangleDifference(const OverlapRectangle& currentRectangle, const OverlapRectangle& previousRectangle, OverlapLine& line) + { + // check if u changes - add the row for visit + if(currentRectangle.mMinu != previousRectangle.mMinu) + { + line.mColumn = false; + line.mLine = currentRectangle.mMinu < previousRectangle.mMinu ? currentRectangle.mMinu : currentRectangle.mMaxu; + line.mMin = currentRectangle.mMinv; + line.mMax = currentRectangle.mMaxv; + return; + } + + // check if v changes - add the column for visit + if(currentRectangle.mMinv != previousRectangle.mMinv) + { + line.mColumn = true; + line.mLine = currentRectangle.mMinv < previousRectangle.mMinv ? currentRectangle.mMinv : currentRectangle.mMaxv; + line.mMin = currentRectangle.mMinu; + line.mMax = currentRectangle.mMaxu; + } + } + + // visits all cells in given rectangle + PX_INLINE bool visitCells(const OverlapRectangle& rectangle) + { + for(PxI32 ui = rectangle.mMinu + mStep_ui; ui <= rectangle.mMaxu + mStep_ui; ui++) + { + if(ui < mMinRow) + continue; + if(ui >= mMaxRow) + break; + for(PxI32 vi = rectangle.mMinv + mStep_vi; vi <= rectangle.mMaxv + mStep_vi; vi++) + { + if(vi < mMinColumn) + continue; + if(vi >= mMaxColumn) + break; + const PxI32 vertexIndex = ui*mNumColumns + vi; + if(!testVertexIndex(PxU32(vertexIndex))) + return false; + } + } + return true; + } + + // visits all cells in given line - can be row or column + PX_INLINE bool visitCells(const OverlapLine& line) + { + if(line.mMin > line.mMax) + return true; + + if(line.mColumn) + { + const PxI32 vi = line.mLine + mStep_vi; + // early exit if column is out of hf clip area + if(vi < mMinColumn) + return true; + if(vi >= mMaxColumn) + return true; + + for(PxI32 ui = line.mMin + mStep_ui; ui <= line.mMax + mStep_ui; ui++) + { + // early exit or continue if row is out of hf clip area + if(ui >= mMaxRow) + break; + // continue if we did not reach the valid area, we can still get there + if(ui < mMinRow) + continue; + // if the cell has not been tested test and report + if(!testVertexIndex(PxU32(mNumColumns * ui + vi))) + return false; + } + } + else + { + const PxI32 ui = line.mLine + mStep_ui; + // early exit if row is out of hf clip area + if(ui < mMinRow) + return true; + if(ui >= mMaxRow) + return true; + + for(PxI32 vi = line.mMin + mStep_vi; vi <= line.mMax + mStep_vi; vi++) + { + // early exit or continue if column is out of hf clip area + if(vi >= mMaxColumn) + break; + // continue if we did not reach the valid area, we can still get there + if(vi < mMinColumn) + continue; + // if the cell has not been tested test and report + if(!testVertexIndex(PxU32(mNumColumns * ui + vi))) + return false; + } + } + return true; + } + + // does height check and if succeeded adds to report + PX_INLINE bool testVertexIndex(const PxU32 vertexIndex) + { + const PxReal h0 = mHf.getHeight(vertexIndex); + const PxReal h1 = mHf.getHeight(vertexIndex + 1); + const PxReal h2 = mHf.getHeight(vertexIndex + mNumColumns); + const PxReal h3 = mHf.getHeight(vertexIndex + mNumColumns + 1); + // actual height test, if some height pass we accept the cell + if(!((mMaxY < h0 && mMaxY < h1 && mMaxY < h2 && mMaxY < h3) || (mMinY > h0 && mMinY > h1 && mMinY > h2 && mMinY > h3))) + { + // check if the triangle is not a hole + if(mHf.getMaterialIndex0(vertexIndex) != PxHeightFieldMaterial::eHOLE) + { + if(!addIndex(vertexIndex*2)) + return false; + } + if(mHf.getMaterialIndex1(vertexIndex) != PxHeightFieldMaterial::eHOLE) + { + if(!addIndex(vertexIndex*2 + 1)) + return false; + } + } + return true; + } + + // add triangle index, if we get out of buffer size, report them + bool addIndex(PxU32 triangleIndex) + { + if(mNbIndices == HF_SWEEP_REPORT_BUFFER_SIZE) + { + if(!reportOverlaps()) + return false; + } + + mIndexBuffer[mNbIndices++] = triangleIndex; + return true; + } + + PX_FORCE_INLINE bool reportOverlaps() + { + if(mNbIndices) + { + if(!mCallback->onEvent(mNbIndices, mIndexBuffer)) + return false; + mNbIndices = 0; + } + return true; + } + + private: + bool mInitialized; + const HeightFieldUtil& mHfUtil; + const Gu::HeightField& mHf; + T* mCallback; + PxI32 mOffsetU; + PxI32 mOffsetV; + float mMinY; + float mMaxY; + PxI32 mMinRow; + PxI32 mMaxRow; + PxI32 mMinColumn; + PxI32 mMaxColumn; + PxI32 mNumColumns; + PxI32 mStep_ui; + PxI32 mStep_vi; + OverlapRectangle mPreviousRectangle; + OverlapRectangle mCurrentRectangle; + PxU32 mIndexBuffer[HF_SWEEP_REPORT_BUFFER_SIZE]; + PxU32 mNbIndices; + }; + + // If useUnderFaceCalblack is false, traceSegment will report segment/triangle hits via + // faceHit(const Gu::HeightFieldUtil& hf, const PxVec3& point, PxU32 triangleIndex) + // Otherwise traceSegment will report all triangles the segment passes under via + // underFaceHit(const Gu::HeightFieldUtil& hf, const PxVec3& triNormal, const PxVec3& crossedEdge, + // PxF32 x, PxF32 z, PxF32 rayHeight, PxU32 triangleIndex) + // where x,z is the point of previous intercept in hf coords, rayHeight is at that same point + // crossedEdge is the edge vector crossed from last call to underFaceHit, undefined for first call + // Note that underFaceHit can be called when a line is above a triangle if it's within AABB for that hf cell + // Note that backfaceCull is ignored if useUnderFaceCallback is true + // overlapObjectExtent (localSpace) and overlap are used for triangle collecting using an inflated tracesegment + // Note that hfLocalBounds are passed as a parameter instead of being computed inside the traceSegment. + // The localBounds can be obtained: PxBounds3 hfLocalBounds; hfUtil.computeLocalBounds(hfLocalBounds); and passed as + // a parameter. + template + PX_INLINE void traceSegment(const PxVec3& aP0, const PxVec3& rayDir, const float rayLength , T* aCallback, const PxBounds3& hfLocalBounds, bool backfaceCull, + const PxVec3* overlapObjectExtent = NULL) const + { + PxF32 tnear, tfar; + if(!Gu::intersectRayAABB2(hfLocalBounds.minimum, hfLocalBounds.maximum, aP0, rayDir, rayLength, tnear, tfar)) + return; + + const PxVec3 p0 = aP0 + rayDir * tnear; + const PxVec3 p1 = aP0 + rayDir * tfar; + + // helper class used for overlap tests + OverlapTraceSegment overlapTraceSegment(*this, *mHeightField); + + // values which expand the HF area + PxF32 expandu = 0.0f, expandv = 0.0f; + + if (overlap) + { + // setup overlap variables + overlapTraceSegment.prepare(aP0,aP0 + rayDir*rayLength,*overlapObjectExtent,expandu,expandv); + } + + // row = x|u, column = z|v + const PxF32 rowScale = mHfGeom->rowScale, columnScale = mHfGeom->columnScale, heightScale = mHfGeom->heightScale; + const PxI32 nbVi = PxI32(mHeightField->getNbColumnsFast()), nbUi = PxI32(mHeightField->getNbRowsFast()); + PX_ASSERT(nbVi > 0 && nbUi > 0); + + // clampEps is chosen so that we get a reasonable clamp value for 65536*0.9999999f = 65535.992187500000 + const PxF32 clampEps = 1e-7f; // shrink u,v to within 1e-7 away from the world bounds + + // we now clamp uvs to [1e-7, rowLimit-1e-7] to avoid out of range uvs and eliminate related checks in the loop + const PxF32 nbUcells = PxF32(nbUi-1)*(1.0f-clampEps), nbVcells = PxF32(nbVi-1)*(1.0f-clampEps); + + // if u0,v0 is near an integer, shift up or down in direction opposite to du,dv by PxMax(|u,v|*1e-7, 1e-7) + // (same direction as du,dv for u1,v1) + // we do this to ensure that we get at least one intersection with u or v when near the cell edge to eliminate special cases in the loop + // we need to extend the field for the inflated radius, we will now operate even with negative u|v + + // map p0 from (x, z, y) to (u0, v0, h0) + // we need to use the unclamped values, otherwise we change the direction of the traversal + const PxF32 uu0 = p0.x * mOneOverRowScale; + PxF32 u0 = PxMin(PxMax(uu0, 1e-7f - expandu), nbUcells + expandu); // multiplication rescales the u,v grid steps to 1 + const PxF32 uv0 = p0.z * mOneOverColumnScale; + PxF32 v0 = PxMin(PxMax(uv0, 1e-7f - expandv), nbVcells + expandv); + const PxReal h0 = p0.y; // we don't scale y + + // map p1 from (x, z, y) to (u1, v1, h1) + // we need to use the unclamped values, otherwise we change the direction of the traversal + const PxF32 uu1 = p1.x * mOneOverRowScale; + const PxF32 uv1 = p1.z * mOneOverColumnScale; + const PxReal h1 = p1.y; // we don't scale y + + PxF32 du = uu1 - uu0, dv = uv1 - uv0; // recompute du, dv from adjusted uvs + const PxReal dh = h1 - h0; + + // grid u&v step is always either 1 or -1, we precompute as both integers and floats to avoid conversions + // so step_uif is +/-1.0f, step_ui is +/-1 + const PxF32 step_uif = PxSign(du), step_vif = PxSign(dv); + const PxI32 step_ui = PxI32(step_uif), step_vi = PxI32(step_vif); + + // clamp magnitude of du, dv to at least clampEpsilon to avoid special cases when dividing + const PxF32 divEpsilon = 1e-10f; + if(PxAbs(du) < divEpsilon) + du = step_uif * divEpsilon; + if(PxAbs(dv) < divEpsilon) + dv = step_vif * divEpsilon; + + const PxVec3 auhP0(aP0.x*mOneOverRowScale, aP0.y, aP0.z*mOneOverColumnScale); + const PxVec3 duhv(rayDir.x*rayLength*mOneOverRowScale, rayDir.y*rayLength, rayDir.z*rayLength*mOneOverColumnScale); + const PxReal duhvLength = duhv.magnitude(); + PxVec3 duhvNormalized = duhv; + if(duhvLength > PX_NORMALIZATION_EPSILON) + duhvNormalized *= 1.0f/duhvLength; + + // Math derivation: + // points on 2d segment are parametrized as: [u0,v0] + t [du, dv]. We solve for t_u[n], t for nth u-intercept + // u0 + t_un du = un + // t_un = (un-u0) / du + // t_un1 = (un+1-u0) / du ; we use +1 since we rescaled the grid step to 1 + // therefore step_tu = t_un - t_un1 = 1/du + + // seed the initial integer cell coordinates with u0, v0 rounded up or down with standard PxFloor/Ceil behavior + // to ensure we have the correct first cell between (ui,vi) and (ui+step_ui,vi+step_vi) + PxI32 ui = (du > 0.0f) ? PxI32(PxFloor(u0)) : PxI32(PxCeil(u0)); + PxI32 vi = (dv > 0.0f) ? PxI32(PxFloor(v0)) : PxI32(PxCeil(v0)); + + // find the nearest integer u, v in ray traversal direction and corresponding tu and tv + const PxReal uhit0 = du > 0.0f ? ceilUp(u0) : floorDown(u0); + const PxReal vhit0 = dv > 0.0f ? ceilUp(v0) : floorDown(v0); + + // tu, tv can be > 1 but since the loop is structured as do {} while(tMin < tEnd) we still visit the first cell + PxF32 last_tu = 0.0f, last_tv = 0.0f; + PxReal tu = (uhit0 - uu0) / du; + PxReal tv = (vhit0 - uv0) / dv; + if(tu < 0.0f) // negative value may happen, as we may have started out of the AABB (since we did enlarge it) + tu = PxAbs(clampEps / du); + if(tv < 0.0f) // negative value may happen, as we may have started out of the AABB (since we did enlarge it) + tv = PxAbs(clampEps / dv); + + // compute step_tu and step_tv; t steps per grid cell in u and v direction + const PxReal step_tu = 1.0f / PxAbs(du), step_tv = 1.0f / PxAbs(dv); + + // t advances at the same rate for u, v and h therefore we can compute h at u,v grid intercepts + #define COMPUTE_H_FROM_T(t) (h0 + (t) * dh) + + const PxF32 hEpsilon = 1e-4f; + PxF32 uif = PxF32(ui), vif = PxF32(vi); + + // these are used to remap h values to correspond to u,v increasing order + PxI32 uflip = 1-step_ui; /*0 or 2*/ + PxI32 vflip = (1-step_vi)/2; /*0 or 1*/ + + // this epsilon is needed to ensure that we include the last [t, t+1] range in the do {} while(t= 0 - expandu && ui < nbUi + expandu && vi >= 0 - expandv && vi < nbVi + expandv); + PX_ASSERT(ui+step_ui >= 0 - expandu && ui+step_ui < nbUi + expandu && vi+step_vi >= 0 - expandv && vi+step_vi < nbVi + expandv); + + // handle overlap in overlapCallback + if(overlap) + { + if(!overlapTraceSegment.initialized()) + { + // initial overlap and setup + if(!overlapTraceSegment.init(ui,vi,nbVi,step_ui,step_vi,aCallback)) + return; + } + else + { + // overlap step + if(!overlapTraceSegment.step(ui,vi)) + return; + } + } + else + { + const PxU32 colIndex0 = PxU32(nbVi * ui + vi); + const PxU32 colIndex1 = PxU32(nbVi * (ui + step_ui) + vi); + const PxReal h[4] = { // h[0]=h00, h[1]=h01, h[2]=h10, h[3]=h11 - oriented relative to step_uv + hf.getHeight(colIndex0) * heightScale, hf.getHeight(colIndex0 + step_vi) * heightScale, + hf.getHeight(colIndex1) * heightScale, hf.getHeight(colIndex1 + step_vi) * heightScale }; + + PxF32 minH = PxMin(PxMin(h[0], h[1]), PxMin(h[2], h[3])); + PxF32 maxH = PxMax(PxMax(h[0], h[1]), PxMax(h[2], h[3])); + + // how much space in h have we covered from previous to current u or v intercept + PxF32 hLineCellRangeMin = PxMin(hLinePrev, hLineNext); + PxF32 hLineCellRangeMax = PxMax(hLinePrev, hLineNext); + + // do a quick overlap test in h, this should be rejecting the vast majority of tests + if(!(hLineCellRangeMin-hEpsilon > maxH || hLineCellRangeMax+hEpsilon < minH) || + (useUnderFaceCallback && hLineCellRangeMax < maxH)) + { + // arrange h so that h00 corresponds to min(uif, uif+step_uif) h10 to max et c. + // this is only needed for backface culling to work so we know the proper winding order without branches + // uflip is 0 or 2, vflip is 0 or 1 (corresponding to positive and negative ui_step and vi_step) + const PxF32 h00 = h[0+uflip+vflip]; + const PxF32 h01 = h[1+uflip-vflip]; + const PxF32 h10 = h[2-uflip+vflip]; + const PxF32 h11 = h[3-uflip-vflip]; + + const PxF32 minuif = PxMin(uif, uif+step_uif); + const PxF32 maxuif = PxMax(uif, uif+step_uif); + const PxF32 minvif = PxMin(vif, vif+step_vif); + const PxF32 maxvif = PxMax(vif, vif+step_vif); + const PxVec3 p00(minuif, h00, minvif); + const PxVec3 p01(minuif, h01, maxvif); + const PxVec3 p10(maxuif, h10, minvif); + const PxVec3 p11(maxuif, h11, maxvif); + + const PxF32 enlargeEpsilon = 0.0001f; + const PxVec3* p00a = &p00, *p01a = &p01, *p10a = &p10, *p11a = &p11; + PxU32 minui = PxU32(PxMin(ui+step_ui, ui)), minvi = PxU32(PxMin(vi+step_vi, vi)); + + // row = x|u, column = z|v + const PxU32 vertIndex = nbVi * minui + minvi; + const PxU32 cellIndex = vertIndex; // this adds a dummy unused cell in the end of each row; was -minui + bool isZVS = hf.isZerothVertexShared(vertIndex); + if(!isZVS) + { + // rotate the pointers for flipped edge cells + p10a = &p00; + p00a = &p01; + p01a = &p11; + p11a = &p10; + } + + // For triangle index computation, see illustration in Gu::HeightField::getTriangleNormal() + // Since row = u, column = v + // for zeroth vert shared the 10 index is the corner of the 0-index triangle, and 01 is 1-index + // if zeroth vertex is not shared, the 00 index is the corner of 0-index triangle + if(!useUnderFaceCallback) + { + PxReal triT0 = PX_MAX_REAL, triT1 = PX_MAX_REAL; + bool hit0 = false, hit1 = false; + PxF32 triU0, triV0, triU1, triV1; + + // PT: TODO: consider testing hole first and skipping ray-tri test. Might be faster. + if(Gu::intersectRayTriangle(auhP0, duhvNormalized, *p10a, *p00a, *p11a, triT0, triU0, triV0, backfaceCull, enlargeEpsilon) && triT0 >= 0.0f && triT0 <= duhvLength && (hf.getMaterialIndex0(vertIndex) != PxHeightFieldMaterial::eHOLE)) + { + hit0 = true; + } + else + triT0 = PX_MAX_REAL; + + if(Gu::intersectRayTriangle(auhP0, duhvNormalized, *p01a, *p11a, *p00a, triT1, triU1, triV1, backfaceCull, enlargeEpsilon) && triT1 >= 0.0f && triT1 <= duhvLength && (hf.getMaterialIndex1(vertIndex) != PxHeightFieldMaterial::eHOLE)) + { + hit1 = true; + } + else + triT1 = PX_MAX_REAL; + + if(hit0 && triT0 <= triT1) + { + const PxVec3 hitPoint((auhP0.x + duhvNormalized.x*triT0) * rowScale, auhP0.y + duhvNormalized.y * triT0, (auhP0.z + duhvNormalized.z*triT0) * columnScale); + if(!aCallback->faceHit(*this, hitPoint, cellIndex*2, triU0, triV0)) + return; + if(hit1) // possible to hit both triangles in a cell with eMESH_MULTIPLE + { + PxVec3 hitPoint1((auhP0.x + duhvNormalized.x*triT1) * rowScale, auhP0.y + duhvNormalized.y * triT1, (auhP0.z + duhvNormalized.z*triT1) * columnScale); + if(!aCallback->faceHit(*this, hitPoint1, cellIndex*2 + 1, triU1, triV1)) + return; + } + } + else if(hit1 && triT1 <= triT0) + { + PxVec3 hitPoint((auhP0.x + duhvNormalized.x*triT1) * rowScale, auhP0.y + duhvNormalized.y * triT1, (auhP0.z + duhvNormalized.z*triT1) * columnScale); + if(!aCallback->faceHit(*this, hitPoint, cellIndex*2 + 1, triU1, triV1)) + return; + if(hit0) // possible to hit both triangles in a cell with eMESH_MULTIPLE + { + PxVec3 hitPoint1((auhP0.x + duhvNormalized.x*triT0) * rowScale, auhP0.y + duhvNormalized.y * triT0, (auhP0.z + duhvNormalized.z*triT0) * columnScale); + if(!aCallback->faceHit(*this, hitPoint1, cellIndex*2, triU0, triV0)) + return; + } + } + } + else + { + // TODO: quite a few optimizations are possible here. edges can be shared, intersectRayTriangle inlined etc + // Go to shape space. Height is already in shape space so we only scale x and z + const PxVec3 p00s(p00a->x * rowScale, p00a->y, p00a->z * columnScale); + const PxVec3 p01s(p01a->x * rowScale, p01a->y, p01a->z * columnScale); + const PxVec3 p10s(p10a->x * rowScale, p10a->y, p10a->z * columnScale); + const PxVec3 p11s(p11a->x * rowScale, p11a->y, p11a->z * columnScale); + + PxVec3 triNormals[2] = { (p00s - p10s).cross(p11s - p10s), (p11s - p01s).cross(p00s-p01s) }; + triNormals[0] *= PxRecipSqrt(triNormals[0].magnitudeSquared()); + triNormals[1] *= PxRecipSqrt(triNormals[1].magnitudeSquared()); + // since the heightfield can be mirrored with negative rowScale or columnScale, this assert doesn't hold + //PX_ASSERT(triNormals[0].y >= 0.0f && triNormals[1].y >= 0.0f); + + // at this point we need to compute the edge direction that we crossed + // also since we don't DDA the w we need to find u,v for w-intercept (w refers to diagonal adjusted with isZVS) + const PxF32 wnu = isZVS ? -1.0f : 1.0f, wnv = 1.0f; // uv-normal to triangle edge that splits the cell + const PxF32 wpu = uif + 0.5f * step_uif, wpv = vif + 0.5f * step_vif; // a point on triangle edge that splits the cell + // note that (wpu, wpv) is on both edges (for isZVS and non-ZVS cases) which is nice + + // we clamp tNext to 1 because we still want to issue callbacks even if we stay in one cell + // note that tNext can potentially be arbitrarily large for a segment contained within a cell + const PxF32 tNext = PxMin(PxMin(tu, tv), 1.0f), tPrev = PxMax(last_tu, last_tv); + + // compute uvs corresponding to tPrev, tNext + const PxF32 unext = u0 + tNext*du, vnext = v0 + tNext*dv; + const PxF32 uprev = u0 + tPrev*du, vprev = v0 + tPrev*dv; + + const PxReal& h00_ = h[0], &h01_ = h[1], &h10_ = h[2]/*, h11_ = h[3]*/; // aliases for step-oriented h + + // (wpu, wpv) is a point on the diagonal + // we compute a dot of ((unext, vnext) - (wpu, wpv), wn) to see on which side of triangle edge we are + // if the dot is positive we need to add 1 to triangle index + const PxU32 dotPrevGtz = PxU32(((uprev - wpu) * wnu + (vprev - wpv) * wnv) > 0); + const PxU32 dotNextGtz = PxU32(((unext - wpu) * wnu + (vnext - wpv) * wnv) > 0); + const PxU32 triIndex0 = cellIndex*2 + dotPrevGtz; + const PxU32 triIndex1 = cellIndex*2 + dotNextGtz; + PxU32 isHole0 = PxU32(hf.getMaterialIndex0(vertIndex) == PxHeightFieldMaterial::eHOLE); + PxU32 isHole1 = PxU32(hf.getMaterialIndex1(vertIndex) == PxHeightFieldMaterial::eHOLE); + if(triIndex0 > triIndex1) + PxSwap(isHole0, isHole1); + + // TODO: compute height at u,v inside here, change callback param to PxVec3 + PxVec3 crossedEdge; + if(last_tu > last_tv) // previous intercept was at u, so we use u=const edge + crossedEdge = PxVec3(0.0f, h01_-h00_, step_vif * columnScale); + else // previous intercept at v, use v=const edge + crossedEdge = PxVec3(step_uif * rowScale, h10_-h00_, 0.0f); + + if(!isHole0 && !aCallback->underFaceHit(*this, triNormals[dotPrevGtz], crossedEdge, + uprev * rowScale, vprev * columnScale, COMPUTE_H_FROM_T(tPrev), triIndex0)) + return; + + if(triIndex1 != triIndex0 && !isHole1) // if triIndex0 != triIndex1 that means we cross the triangle edge + { + // Need to compute tw, the t for ray intersecting the diagonal within the current cell + // dot((wnu, wnv), (u0+tw*du, v0+tw*dv)-(wpu, wpv)) = 0 + // wnu*(u0+tw*du-wpu) + wnv*(v0+tw*dv-wpv) = 0 + // wnu*u0+wnv*v0-wnu*wpu-wnv*wpv + tw*(du*wnu + dv*wnv) = 0 + const PxF32 denom = du*wnu + dv*wnv; + if(PxAbs(denom) > 1e-6f) + { + const PxF32 tw = (wnu*(wpu-u0)+wnv*(wpv-v0)) / denom; + if(!aCallback->underFaceHit(*this, triNormals[dotNextGtz], p10s-p01s, + (u0+tw*du) * rowScale, (v0+tw*dv) * columnScale, COMPUTE_H_FROM_T(tw), triIndex1)) + return; + } + } + } + } + } + + if(tu < tv) + { + last_tu = tu; + ui += step_ui; + // AP: very rare condition, wasn't able to repro but we need this if anyway (DE6565) + if(ui+step_ui< (0 - expandu) || ui+step_ui>=(nbUi + expandu)) // should hold true for ui without step from previous iteration + break; + uif += step_uif; + tu += step_tu; + } + else + { + last_tv = tv; + vi += step_vi; + // AP: very rare condition, wasn't able to repro but we need this if anyway (DE6565) + if(vi+step_vi< (0 - expandv) || vi+step_vi>=(nbVi + expandv)) // should hold true for vi without step from previous iteration + break; + vif += step_vif; + tv += step_tv; + } + hLinePrev = hLineNext; + } + // since min(tu,tv) is the END of the active interval we need to check if PREVIOUS min(tu,tv) was past interval end + // since we update tMinUV in the beginning of the loop, at this point it stores the min(last tu,last tv) + while (tMinUV < tEnd); + #undef COMPUTE_H_FROM_T + } + }; + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp new file mode 100644 index 0000000..877d5c5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuOverlapTestsHF.cpp @@ -0,0 +1,361 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuOverlapTests.h" +#include "GuHeightFieldUtil.h" +#include "GuBoxConversion.h" +#include "GuInternal.h" +#include "GuVecConvexHull.h" +#include "GuEntityReport.h" +#include "GuDistancePointTriangle.h" +#include "GuIntersectionCapsuleTriangle.h" +#include "GuDistanceSegmentTriangle.h" +#include "GuBounds.h" +#include "GuBV4_Common.h" +#include "GuVecTriangle.h" +#include "GuConvexMesh.h" +#include "GuGJK.h" +#include "geometry/PxSphereGeometry.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct HeightfieldOverlapReport : Gu::OverlapReport + { + PX_NOCOPY(HeightfieldOverlapReport) + public: + HeightfieldOverlapReport(const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose) : mHfUtil(hfGeom), mHFPose(hfPose), mOverlap(PxIntFalse) {} + + const HeightFieldUtil mHfUtil; + const PxTransform& mHFPose; + PxIntBool mOverlap; + }; +} + +bool GeomOverlapCallback_SphereHeightfield(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxHeightFieldGeometry& hfGeom = static_cast(geom1); + + struct SphereOverlapReport : HeightfieldOverlapReport + { + Sphere mLocalSphere; + + SphereOverlapReport(const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose, const PxVec3& localSphereCenter, float sphereRadius) : HeightfieldOverlapReport(hfGeom, hfPose) + { + mLocalSphere.center = localSphereCenter; + mLocalSphere.radius = sphereRadius * sphereRadius; + } + + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxTriangle currentTriangle; + mHfUtil.getTriangle(mHFPose, currentTriangle, NULL, NULL, triangleIndex, false, false); + + const PxVec3& p0 = currentTriangle.verts[0]; + const PxVec3& p1 = currentTriangle.verts[1]; + const PxVec3& p2 = currentTriangle.verts[2]; + + const PxVec3 edge10 = p1 - p0; + const PxVec3 edge20 = p2 - p0; + const PxVec3 cp = closestPtPointTriangle2(mLocalSphere.center, p0, p1, p2, edge10, edge20); + const float sqrDist = (cp - mLocalSphere.center).magnitudeSquared(); + if(sqrDist <= mLocalSphere.radius) // mLocalSphere.radius has been pre-squared in the ctor + { + mOverlap = PxIntTrue; + return false; + } + } + return true; + } + }; + + PxBounds3 localBounds; + const PxVec3 localSphereCenter = getLocalSphereData(localBounds, pose0, pose1, sphereGeom.radius); + + SphereOverlapReport report(hfGeom, pose1, localSphereCenter, sphereGeom.radius); + + report.mHfUtil.overlapAABBTriangles(localBounds, report, 4); + return report.mOverlap!=PxIntFalse; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool GeomOverlapCallback_CapsuleHeightfield(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxHeightFieldGeometry& hfGeom = static_cast(geom1); + + struct CapsuleOverlapReport : HeightfieldOverlapReport + { + Capsule mLocalCapsule; + CapsuleTriangleOverlapData mData; + + CapsuleOverlapReport(const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose) : HeightfieldOverlapReport(hfGeom, hfPose) {} + + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxTriangle currentTriangle; + mHfUtil.getTriangle(mHFPose, currentTriangle, NULL, NULL, triangleIndex, false, false); + + const PxVec3& p0 = currentTriangle.verts[0]; + const PxVec3& p1 = currentTriangle.verts[1]; + const PxVec3& p2 = currentTriangle.verts[2]; + + if(0) + { + PxReal t,u,v; + const PxVec3 p1_p0 = p1 - p0; + const PxVec3 p2_p0 = p2 - p0; + const PxReal sqrDist = distanceSegmentTriangleSquared(mLocalCapsule, p0, p1_p0, p2_p0, &t, &u, &v); + if(sqrDist <= mLocalCapsule.radius*mLocalCapsule.radius) + { + mOverlap = PxIntTrue; + return false; + } + } + else + { + const PxVec3 normal = (p0 - p1).cross(p0 - p2); + if(intersectCapsuleTriangle(normal, p0, p1, p2, mLocalCapsule, mData)) + { + mOverlap = PxIntTrue; + return false; + } + } + } + return true; + } + }; + + CapsuleOverlapReport report(hfGeom, pose1); + + // PT: TODO: move away from internal header + const PxVec3 tmp = getCapsuleHalfHeightVector(pose0, capsuleGeom); + + // PT: TODO: refactor - but might be difficult because we reuse relPose for two tasks here + const PxTransform relPose = pose1.transformInv(pose0); + const PxVec3 localDelta = pose1.rotateInv(tmp); + + report.mLocalCapsule.p0 = relPose.p + localDelta; + report.mLocalCapsule.p1 = relPose.p - localDelta; + report.mLocalCapsule.radius = capsuleGeom.radius; + report.mData.init(report.mLocalCapsule); + + PxBounds3 localBounds; + computeCapsuleBounds(localBounds, capsuleGeom, relPose); + + report.mHfUtil.overlapAABBTriangles(localBounds, report, 4); + //hfUtil.overlapAABBTriangles(pose0, pose1, getLocalCapsuleBounds(capsuleGeom.radius, capsuleGeom.halfHeight), report, 4); + return report.mOverlap!=PxIntFalse; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxIntBool intersectTriangleBoxBV4(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, + const PxMat33& rotModelToBox, const PxVec3& transModelToBox, const PxVec3& extents); + +bool GeomOverlapCallback_BoxHeightfield(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxHeightFieldGeometry& hfGeom = static_cast(geom1); + + struct BoxOverlapReport : HeightfieldOverlapReport + { + PxMat33 mRModelToBox; + PxVec3p mTModelToBox; + PxVec3p mBoxExtents; + + BoxOverlapReport(const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose) : HeightfieldOverlapReport(hfGeom, hfPose) {} + + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxTrianglePadded currentTriangle; + mHfUtil.getTriangle(mHFPose, currentTriangle, NULL, NULL, triangleIndex, false, false); + + if(intersectTriangleBoxBV4(currentTriangle.verts[0], currentTriangle.verts[1], currentTriangle.verts[2], mRModelToBox, mTModelToBox, mBoxExtents)) + { + mOverlap = PxIntTrue; + return false; + } + } + return true; + } + }; + + BoxOverlapReport report(hfGeom, pose1); + + // PT: TODO: revisit / refactor all this code + const PxTransform relPose = pose1.transformInv(pose0); + Box localBox; + buildFrom(localBox, relPose.p, boxGeom.halfExtents, relPose.q); + + invertBoxMatrix(report.mRModelToBox, report.mTModelToBox, localBox); + + report.mBoxExtents = localBox.extents; + + PxBounds3 localBounds; + { + // PT: TODO: refactor with bounds code? + const PxMat33& basis = localBox.rot; + + // extended basis vectors + const Vec4V c0V = V4Scale(V4LoadU(&basis.column0.x), FLoad(localBox.extents.x)); + const Vec4V c1V = V4Scale(V4LoadU(&basis.column1.x), FLoad(localBox.extents.y)); + const Vec4V c2V = V4Scale(V4LoadU(&basis.column2.x), FLoad(localBox.extents.z)); + + // find combination of base vectors that produces max. distance for each component = sum of abs() + Vec4V extentsV = V4Add(V4Abs(c0V), V4Abs(c1V)); + extentsV = V4Add(extentsV, V4Abs(c2V)); + + const PxVec3p origin(localBox.center); + + const Vec4V originV = V4LoadU(&origin.x); + const Vec4V minV = V4Sub(originV, extentsV); + const Vec4V maxV = V4Add(originV, extentsV); + + StoreBounds(localBounds, minV, maxV); + } + report.mHfUtil.overlapAABBTriangles(localBounds, report, 4); + return report.mOverlap!=PxIntFalse; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool GeomOverlapCallback_ConvexHeightfield(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eHEIGHTFIELD); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const PxHeightFieldGeometry& hfGeom = static_cast(geom1); + + struct ConvexOverlapReport : HeightfieldOverlapReport + { + ConvexHullV mConvex; + PxMatTransformV aToB; + + ConvexOverlapReport(const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose) : HeightfieldOverlapReport(hfGeom, hfPose) {} + + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + while(nb--) + { + const PxU32 triangleIndex = *indices++; + + PxTrianglePadded currentTriangle; + mHfUtil.getTriangle(mHFPose, currentTriangle, NULL, NULL, triangleIndex, false, false); + + const PxVec3& p0 = currentTriangle.verts[0]; + const PxVec3& p1 = currentTriangle.verts[1]; + const PxVec3& p2 = currentTriangle.verts[2]; + + // PT: TODO: consider adding an extra triangle-vs-box culling test here + + // PT: TODO: optimize + const Vec3V v0 = V3LoadU(p0); + const Vec3V v1 = V3LoadU(p1); + const Vec3V v2 = V3LoadU(p2); + + // PT: TODO: refactor with ConvexVsMeshOverlapCallback + TriangleV triangle(v0, v1, v2); + Vec3V contactA, contactB, normal; + FloatV dist; + const RelativeConvex convexA(triangle, aToB); + const LocalConvex convexB(mConvex); + const GjkStatus status = gjk(convexA, convexB, aToB.p, FZero(), contactA, contactB, normal, dist); + if(status == GJK_CONTACT || status == GJK_CLOSE)// || FAllGrtrOrEq(mSqTolerance, sqDist)) + { + mOverlap = PxIntTrue; + return false; + } + } + return true; + } + }; + + ConvexOverlapReport report(hfGeom, pose1); + + const ConvexMesh* cm = static_cast(convexGeom.convexMesh); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + + { + const ConvexHullData* hullData = &cm->getHull(); + + const Vec3V vScale0 = V3LoadU_SafeReadW(convexGeom.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat0 = QuatVLoadU(&convexGeom.scale.rotation.x); + + report.mConvex = ConvexHullV(hullData, V3Zero(), vScale0, vQuat0, idtScaleConvex); + // PT: TODO: is that transform correct? It looks like the opposite of what we do for other prims? + report.aToB = PxMatTransformV(pose0.transformInv(pose1)); + //report.aToB = PxMatTransformV(pose1.transformInv(pose0)); + } + + const PxTransform relPose = pose1.transformInv(pose0); + + PxBounds3 localBounds; + computeBounds(localBounds, convexGeom, relPose, 0.0f, 1.0f); + + report.mHfUtil.overlapAABBTriangles(localBounds, report, 4); + return report.mOverlap!=PxIntFalse; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp new file mode 100644 index 0000000..28c2e20 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/hf/GuSweepsHF.cpp @@ -0,0 +1,604 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepTests.h" +#include "GuHeightFieldUtil.h" +#include "GuEntityReport.h" +#include "GuVecCapsule.h" +#include "GuSweepMTD.h" +#include "GuSweepTriangleUtils.h" +#include "GuVecBox.h" +#include "CmScaling.h" +#include "GuSweepCapsuleTriangle.h" +#include "GuInternal.h" +#include "GuGJKRaycast.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +#include "GuSweepConvexTri.h" + +#define AbortTraversal false +#define ContinueTraversal true + +#if PX_VC + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +/////////////////////////////////////////////////////////////////////////////// + +class HeightFieldTraceSegmentSweepHelper +{ + PX_NOCOPY(HeightFieldTraceSegmentSweepHelper) +public: + HeightFieldTraceSegmentSweepHelper(const HeightFieldTraceUtil& hfUtil, const PxVec3& aabbExtentHfLocalSpace) + : mHfUtil(hfUtil), mOverlapObjectExtent(aabbExtentHfLocalSpace) + { + mHfUtil.computeLocalBounds(mLocalBounds); + // extend the bounds + mLocalBounds.minimum = mLocalBounds.minimum - aabbExtentHfLocalSpace; + mLocalBounds.maximum = mLocalBounds.maximum + aabbExtentHfLocalSpace; + } + + template + PX_INLINE void traceSegment(const PxVec3& aP0, const PxVec3& rayDirNorm, const float rayLength, T* aCallback) const + { + mHfUtil.traceSegment(aP0, rayDirNorm, rayLength, aCallback, mLocalBounds, false, &mOverlapObjectExtent); + } + +private: + const HeightFieldTraceUtil& mHfUtil; + const PxVec3& mOverlapObjectExtent; + PxBounds3 mLocalBounds; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class HeightFieldTraceSegmentReport : public EntityReport +{ + PX_NOCOPY(HeightFieldTraceSegmentReport) +public: + + HeightFieldTraceSegmentReport(const HeightFieldUtil& hfUtil, const PxHitFlags hitFlags) : + mHfUtil (hfUtil), + mHitFlags (hitFlags), + mStatus (false), + mInitialOverlap (false), + mIsDoubleSided ((hfUtil.getHeightFieldGeometry().heightFieldFlags & PxMeshGeometryFlag::eDOUBLE_SIDED) || (hitFlags & PxHitFlag::eMESH_BOTH_SIDES)), + mIsAnyHit (hitFlags & PxHitFlag::eMESH_ANY) + { + } + + bool underFaceHit(const Gu::HeightFieldUtil&, const PxVec3&, const PxVec3&, PxF32, PxF32, PxF32, PxU32) + { + return true; + } + + bool faceHit(const Gu::HeightFieldUtil&, const PxVec3&, PxU32, PxReal, PxReal) + { + return true; + } + + protected: + const HeightFieldUtil& mHfUtil; + const PxHitFlags mHitFlags; + bool mStatus; + bool mInitialOverlap; + const bool mIsDoubleSided; + const bool mIsAnyHit; +}; + +/////////////////////////////////////////////////////////////////////////////// + +class CapsuleTraceSegmentReport : public HeightFieldTraceSegmentReport +{ + PX_NOCOPY(CapsuleTraceSegmentReport) +public: + CapsuleTraceSegmentReport( const HeightFieldUtil& hfUtil, const PxHitFlags hitFlags, + const Capsule& inflatedCapsule, + const PxVec3& unitDir, PxGeomSweepHit& sweepHit, const PxTransform& pose, PxReal distance) : + HeightFieldTraceSegmentReport (hfUtil, hitFlags), + mInflatedCapsule (inflatedCapsule), + mUnitDir (unitDir), + mSweepHit (sweepHit), + mPose (pose), + mDistance (distance) + { + mSweepHit.faceIndex = 0xFFFFffff; + } + + virtual bool onEvent(PxU32 nb, const PxU32* indices) + { + PX_ALIGN_PREFIX(16) PxU8 tribuf[HF_SWEEP_REPORT_BUFFER_SIZE*sizeof(PxTriangle)] PX_ALIGN_SUFFIX(16); + PxTriangle* tmpT = reinterpret_cast(tribuf); + PX_ASSERT(nb <= HF_SWEEP_REPORT_BUFFER_SIZE); + for(PxU32 i=0; i(geom); + + const Capsule inflatedCapsule(lss.p0, lss.p1, lss.radius + inflation); + + // Compute swept box + Box capsuleBox; + computeBoxAroundCapsule(inflatedCapsule, capsuleBox); + + const PxVec3 capsuleAABBExtents = capsuleBox.computeAABBExtent(); + + const HeightFieldTraceUtil hfUtil(hfGeom); + CapsuleTraceSegmentReport myReport(hfUtil, hitFlags, inflatedCapsule, unitDir, sweepHit, pose, distance); + + sweepHit.distance = PX_MAX_F32; + + // need hf local space stuff + const PxTransform inversePose = pose.getInverse(); + const PxVec3 centerLocalSpace = inversePose.transform(capsuleBox.center); + const PxVec3 sweepDirLocalSpace = inversePose.rotate(unitDir); + const PxVec3 capsuleAABBBExtentHfLocalSpace = PxBounds3::basisExtent(centerLocalSpace, PxMat33Padded(inversePose.q), capsuleAABBExtents).getExtents(); + + HeightFieldTraceSegmentSweepHelper traceSegmentHelper(hfUtil, capsuleAABBBExtentHfLocalSpace); + traceSegmentHelper.traceSegment(centerLocalSpace, sweepDirLocalSpace, distance, &myReport); + + return myReport.finalizeHit(sweepHit, hfGeom, pose, lss, inflatedCapsule, unitDir); +} + +/////////////////////////////////////////////////////////////////////////////// + +class ConvexTraceSegmentReport : public HeightFieldTraceSegmentReport +{ + PX_NOCOPY(ConvexTraceSegmentReport) +public: + ConvexTraceSegmentReport( const HeightFieldUtil& hfUtil, const ConvexHullData& hull, const PxMeshScale& convexScale, + const PxTransform& convexPose, const PxTransform& heightFieldPose, + const PxVec3& unitDir, PxReal distance, PxHitFlags hitFlags, PxReal inflation) : + HeightFieldTraceSegmentReport (hfUtil, hitFlags), + mUnitDir (unitDir), + mInflation (inflation) + { + using namespace aos; + mSweepHit.faceIndex = 0xFFFFffff; + mSweepHit.distance = distance; + const Vec3V worldDir = V3LoadU(unitDir); + const FloatV dist = FLoad(distance); + const QuatV q0 = QuatVLoadU(&heightFieldPose.q.x); + const Vec3V p0 = V3LoadU(&heightFieldPose.p.x); + + const QuatV q1 = QuatVLoadU(&convexPose.q.x); + const Vec3V p1 = V3LoadU(&convexPose.p.x); + + const PxTransformV meshTransf(p0, q0); + const PxTransformV convexTransf(p1, q1); + + mMeshToConvex = convexTransf.transformInv(meshTransf); + mConvexPoseV = convexTransf; + mConvexSpaceDir = convexTransf.rotateInv(V3Neg(V3Scale(worldDir, dist))); + mDistance = dist; + + const Vec3V vScale = V3LoadU_SafeReadW(convexScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexScale.rotation.x); + + mMeshSpaceUnitDir = heightFieldPose.rotateInv(unitDir); + mConvexHull.initialize(&hull, V3Zero(), vScale, vQuat, convexScale.isIdentity()); + } + + virtual bool onEvent(PxU32 nbEntities, const PxU32* entities) + { + const PxTransform idt(PxIdentity); + for(PxU32 i=0; i(geom); + + const Matrix34FromTransform convexTM(convexPose); + const Matrix34FromTransform meshTM(pose); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + + FastVertex2ShapeScaling convexScaling; + if(!idtScaleConvex) + convexScaling.init(convexGeom.scale); + + PX_ASSERT(!convexMesh->getLocalBoundsFast().isEmpty()); + const PxBounds3 hullAABBLocalSpace = convexMesh->getLocalBoundsFast().transformFast(convexScaling.getVertex2ShapeSkew()); + + const HeightFieldTraceUtil hfUtil(hfGeom); + ConvexTraceSegmentReport entityReport( + hfUtil, convexMesh->getHull(), convexGeom.scale, convexPose, pose, -unitDir, distance, hitFlags, inflation); + + // need hf local space stuff + const PxBounds3 hullAABB = PxBounds3::transformFast(convexPose, hullAABBLocalSpace); + const PxVec3 aabbExtents = hullAABB.getExtents() + PxVec3(inflation); + const PxTransform inversePose = pose.getInverse(); + const PxVec3 centerLocalSpace = inversePose.transform(hullAABB.getCenter()); + const PxVec3 sweepDirLocalSpace = inversePose.rotate(unitDir); + const PxVec3 convexAABBExtentHfLocalSpace = PxBounds3::basisExtent(centerLocalSpace, PxMat33Padded(inversePose.q), aabbExtents).getExtents(); + + HeightFieldTraceSegmentSweepHelper traceSegmentHelper(hfUtil, convexAABBExtentHfLocalSpace); + traceSegmentHelper.traceSegment(centerLocalSpace, sweepDirLocalSpace, distance, &entityReport); + + return entityReport.finalizeHit(sweepHit, hfGeom, pose, convexGeom, convexPose, unitDir, inflation); +} + +/////////////////////////////////////////////////////////////////////////////// + +class BoxTraceSegmentReport : public HeightFieldTraceSegmentReport +{ + PX_NOCOPY(BoxTraceSegmentReport) +public: + BoxTraceSegmentReport( const HeightFieldUtil& hfUtil, const PxHitFlags hitFlags, + const PxTransformV& worldToBoxV, const PxTransform& pose, const BoxV& box, const PxVec3& localMotion, + PxGeomSweepHit& sweepHit, PxReal inflation) : + HeightFieldTraceSegmentReport (hfUtil, hitFlags), + mWorldToBoxV (worldToBoxV), + mPose (pose), + mBox (box), + mLocalMotion (localMotion), + mSweepHit (sweepHit), + mInflation (inflation) + { + mMinToi = FMax(); + mSweepHit.faceIndex = 0xFFFFffff; + } + + virtual bool onEvent(PxU32 nb, const PxU32* indices) + { + const FloatV zero = FZero(); + const Vec3V zeroV = V3Zero(); + const Vec3V dir = V3LoadU(mLocalMotion); + //FloatV minToi = FMax(); + FloatV toi; + Vec3V closestA, normal;//closestA and normal is in the local space of box + + for(PxU32 i=0; i convexA(triangle); + const LocalConvex convexB(mBox); + const Vec3V initialSearchDir = V3Sub(triangle.getCenter(), mBox.getCenter()); + + if(gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, dir, toi, normal, closestA, mInflation, false)) + { + mStatus = true; + if(FAllGrtr(toi, zero)) + { + if(FAllGrtr(mMinToi, toi)) + { + mMinToi = toi; + FStore(toi, &mSweepHit.distance); + V3StoreU(normal, mSweepHit.normal); + V3StoreU(closestA, mSweepHit.position); + mSweepHit.faceIndex = triangleIndex; + + if(mIsAnyHit) + return AbortTraversal; + } + } + else + { + mSweepHit.distance = 0.0f; + mSweepHit.faceIndex = triangleIndex; + mInitialOverlap = true; + return AbortTraversal; + } + } + } + return ContinueTraversal; + } + + bool finalizeHit(PxGeomSweepHit& sweepHit, + const PxHeightFieldGeometry& hfGeom, const PxTransform& pose, + const PxTransform& boxPose_, const Box& box, + const PxVec3& unitDir, PxReal distance, PxReal inflation) + { + if(!mStatus) + return false; + + if(mInitialOverlap) + { + // PT: TODO: consider using 'setInitialOverlapResults' here + + sweepHit.flags = PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + + if(mHitFlags & PxHitFlag::eMTD) + { + const bool hasContacts = computeBox_HeightFieldMTD(hfGeom, pose, box, boxPose_, inflation, mIsDoubleSided, sweepHit); + + //ML: the center of mass is below the surface, we won't have MTD contact generate + if(!hasContacts) + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + else + { + sweepHit.flags |= PxHitFlag::ePOSITION; + } + } + else + { + sweepHit.distance = 0.0f; + sweepHit.normal = -unitDir; + } + } + else + { + PxVec3 n = sweepHit.normal.getNormalized(); + if((n.dot(mLocalMotion))>0.0f) + n = -n; + + sweepHit.distance *= distance; // stored as toi [0,1] during computation -> scale + sweepHit.normal = boxPose_.rotate(n); + sweepHit.position = boxPose_.transform(sweepHit.position); + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + } + return true; + } + + private: + const PxTransformV& mWorldToBoxV; + const PxTransform& mPose; + const BoxV& mBox; + FloatV mMinToi; + const PxVec3 mLocalMotion; + PxGeomSweepHit& mSweepHit; + const PxReal mInflation; +}; + +bool sweepBox_HeightFieldGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eHEIGHTFIELD); + PX_UNUSED(threadContext); + PX_UNUSED(boxGeom_); + PX_UNUSED(hitFlags); + + const PxHeightFieldGeometry& hfGeom = static_cast(geom); + + const PxVec3 boxAABBExtent = box.computeAABBExtent() + PxVec3(inflation); + + // Move to AABB space + PX_ALIGN_PREFIX(16) PxTransform WorldToBox PX_ALIGN_SUFFIX(16); + WorldToBox = boxPose_.getInverse(); + + const QuatV q1 = QuatVLoadA(&WorldToBox.q.x); + const Vec3V p1 = V3LoadA(&WorldToBox.p.x); + const PxTransformV WorldToBoxV(p1, q1); + + const PxVec3 motion = unitDir * distance; + const PxVec3 localMotion = WorldToBox.rotate(motion); + + const BoxV boxV(V3Zero(), V3LoadU(box.extents)); + + sweepHit.distance = PX_MAX_F32; + + const HeightFieldTraceUtil hfUtil(hfGeom); + BoxTraceSegmentReport myReport(hfUtil, hitFlags, WorldToBoxV, pose, boxV, localMotion, sweepHit, inflation); + + // need hf local space stuff + const PxTransform inversePose = pose.getInverse(); + const PxVec3 centerLocalSpace = inversePose.transform(box.center); + const PxVec3 sweepDirLocalSpace = inversePose.rotate(unitDir); + const PxVec3 boxAABBExtentInHfLocalSpace = PxBounds3::basisExtent(centerLocalSpace, PxMat33Padded(inversePose.q), boxAABBExtent).getExtents(); + + HeightFieldTraceSegmentSweepHelper traceSegmentHelper(hfUtil, boxAABBExtentInHfLocalSpace); + traceSegmentHelper.traceSegment(centerLocalSpace, sweepDirLocalSpace, distance, &myReport); + + return myReport.finalizeHit(sweepHit, hfGeom, pose, boxPose_, box, unitDir, distance, inflation); +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp new file mode 100644 index 0000000..412bfa2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionBoxBox.cpp @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionBoxBox.h" + +using namespace physx; + +bool Gu::intersectOBBOBB(const PxVec3& e0, const PxVec3& c0, const PxMat33& r0, const PxVec3& e1, const PxVec3& c1, const PxMat33& r1, bool full_test) +{ + // Translation, in parent frame + const PxVec3 v = c1 - c0; + // Translation, in A's frame + const PxVec3 T(v.dot(r0[0]), v.dot(r0[1]), v.dot(r0[2])); + + // B's basis with respect to A's local frame + PxReal R[3][3]; + PxReal FR[3][3]; + PxReal ra, rb, t; + + // Calculate rotation matrix + for(PxU32 i=0;i<3;i++) + { + for(PxU32 k=0;k<3;k++) + { + R[i][k] = r0[i].dot(r1[k]); + FR[i][k] = 1e-6f + PxAbs(R[i][k]); // Precompute fabs matrix + } + } + + // A's basis vectors + for(PxU32 i=0;i<3;i++) + { + ra = e0[i]; + + rb = e1[0]*FR[i][0] + e1[1]*FR[i][1] + e1[2]*FR[i][2]; + + t = PxAbs(T[i]); + + if(t > ra + rb) return false; + } + + // B's basis vectors + for(PxU32 k=0;k<3;k++) + { + ra = e0[0]*FR[0][k] + e0[1]*FR[1][k] + e0[2]*FR[2][k]; + + rb = e1[k]; + + t = PxAbs(T[0]*R[0][k] + T[1]*R[1][k] + T[2]*R[2][k]); + + if( t > ra + rb ) return false; + } + + if(full_test) + { + //9 cross products + + //L = A0 x B0 + ra = e0[1]*FR[2][0] + e0[2]*FR[1][0]; + rb = e1[1]*FR[0][2] + e1[2]*FR[0][1]; + t = PxAbs(T[2]*R[1][0] - T[1]*R[2][0]); + if(t > ra + rb) return false; + + //L = A0 x B1 + ra = e0[1]*FR[2][1] + e0[2]*FR[1][1]; + rb = e1[0]*FR[0][2] + e1[2]*FR[0][0]; + t = PxAbs(T[2]*R[1][1] - T[1]*R[2][1]); + if(t > ra + rb) return false; + + //L = A0 x B2 + ra = e0[1]*FR[2][2] + e0[2]*FR[1][2]; + rb = e1[0]*FR[0][1] + e1[1]*FR[0][0]; + t = PxAbs(T[2]*R[1][2] - T[1]*R[2][2]); + if(t > ra + rb) return false; + + //L = A1 x B0 + ra = e0[0]*FR[2][0] + e0[2]*FR[0][0]; + rb = e1[1]*FR[1][2] + e1[2]*FR[1][1]; + t = PxAbs(T[0]*R[2][0] - T[2]*R[0][0]); + if(t > ra + rb) return false; + + //L = A1 x B1 + ra = e0[0]*FR[2][1] + e0[2]*FR[0][1]; + rb = e1[0]*FR[1][2] + e1[2]*FR[1][0]; + t = PxAbs(T[0]*R[2][1] - T[2]*R[0][1]); + if(t > ra + rb) return false; + + //L = A1 x B2 + ra = e0[0]*FR[2][2] + e0[2]*FR[0][2]; + rb = e1[0]*FR[1][1] + e1[1]*FR[1][0]; + t = PxAbs(T[0]*R[2][2] - T[2]*R[0][2]); + if(t > ra + rb) return false; + + //L = A2 x B0 + ra = e0[0]*FR[1][0] + e0[1]*FR[0][0]; + rb = e1[1]*FR[2][2] + e1[2]*FR[2][1]; + t = PxAbs(T[1]*R[0][0] - T[0]*R[1][0]); + if(t > ra + rb) return false; + + //L = A2 x B1 + ra = e0[0]*FR[1][1] + e0[1]*FR[0][1]; + rb = e1[0] *FR[2][2] + e1[2]*FR[2][0]; + t = PxAbs(T[1]*R[0][1] - T[0]*R[1][1]); + if(t > ra + rb) return false; + + //L = A2 x B2 + ra = e0[0]*FR[1][2] + e0[1]*FR[0][2]; + rb = e1[0]*FR[2][1] + e1[1]*FR[2][0]; + t = PxAbs(T[1]*R[0][2] - T[0]*R[1][2]); + if(t > ra + rb) return false; + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp new file mode 100644 index 0000000..69b6af4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.cpp @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionCapsuleTriangle.h" +#include "GuDistancePointSegment.h" + +using namespace physx; +using namespace Gu; + +bool Gu::intersectCapsuleTriangle(const PxVec3& N, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const Gu::Capsule& capsule, const CapsuleTriangleOverlapData& params) +{ + PX_ASSERT(capsule.p0!=capsule.p1); + + { + const PxReal d2 = distancePointSegmentSquaredInternal(capsule.p0, params.mCapsuleDir, p0); + if(d2<=capsule.radius*capsule.radius) + return true; + } + +// const PxVec3 N = (p0 - p1).cross(p0 - p2); + + if(!testAxis(p0, p1, p2, capsule, N)) + return false; + + if(!testAxis(p0, p1, p2, capsule, computeEdgeAxis(p0, p1 - p0, capsule.p0, params.mCapsuleDir, params.mBDotB, params.mOneOverBDotB))) + return false; + + if(!testAxis(p0, p1, p2, capsule, computeEdgeAxis(p1, p2 - p1, capsule.p0, params.mCapsuleDir, params.mBDotB, params.mOneOverBDotB))) + return false; + + if(!testAxis(p0, p1, p2, capsule, computeEdgeAxis(p2, p0 - p2, capsule.p0, params.mCapsuleDir, params.mBDotB, params.mOneOverBDotB))) + return false; + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.h new file mode 100644 index 0000000..395128e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionCapsuleTriangle.h @@ -0,0 +1,135 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_CAPSULE_TRIANGLE_H +#define GU_INTERSECTION_CAPSULE_TRIANGLE_H + +#include "GuCapsule.h" +#include "foundation/PxUtilities.h" + +namespace physx +{ +namespace Gu +{ + // PT: precomputed data for capsule-triangle test. Useful when testing the same capsule vs several triangles. + struct CapsuleTriangleOverlapData + { + PxVec3 mCapsuleDir; + float mBDotB; + float mOneOverBDotB; + + void init(const Capsule& capsule) + { + const PxVec3 dir = capsule.p1 - capsule.p0; + const float BDotB = dir.dot(dir); + mCapsuleDir = dir; + mBDotB = BDotB; + mOneOverBDotB = BDotB!=0.0f ? 1.0f/BDotB : 0.0f; + } + }; + + // PT: tests if projections of capsule & triangle overlap on given axis + PX_FORCE_INLINE PxU32 testAxis(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const Capsule& capsule, const PxVec3& axis) + { + // Project capsule + float min0 = capsule.p0.dot(axis); + float max0 = capsule.p1.dot(axis); + if(min0>max0) + PxSwap(min0, max0); + const float MR = axis.magnitude()*capsule.radius; + min0 -= MR; + max0 += MR; + + // Project triangle + float min1, max1; + { + min1 = max1 = p0.dot(axis); + float dp = p1.dot(axis); + if(dpmax1) max1 = dp; + dp = p2.dot(axis); + if(dpmax1) max1 = dp; + } + + // Test projections + if(max01.0f) + { + u = 1.0f; + t = (ADotB + ADotT) / ADotA; + t = PxClamp(t, 0.0f, 1.0f); + } + return T + b*u - a*t; + } + + /** + * Checks if a capsule intersects a triangle. + * + * \param normal [in] triangle normal (orientation does not matter) + * \param p0 [in] triangle's first point + * \param p1 [in] triangle's second point + * \param p2 [in] triangle's third point + * \param capsule [in] capsule + * \param params [in] precomputed capsule params + * \return true if capsule overlaps triangle + */ + bool intersectCapsuleTriangle(const PxVec3& normal, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const Gu::Capsule& capsule, const CapsuleTriangleOverlapData& params); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp new file mode 100644 index 0000000..105d62d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.cpp @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionEdgeEdge.h" +#include "GuInternal.h" + +using namespace physx; + +bool Gu::intersectEdgeEdge(const PxVec3& p1, const PxVec3& p2, const PxVec3& dir, const PxVec3& p3, const PxVec3& p4, PxReal& dist, PxVec3& ip) +{ + const PxVec3 v1 = p2 - p1; + + // Build plane P based on edge (p1, p2) and direction (dir) + PxPlane plane; + plane.n = v1.cross(dir); + plane.d = -(plane.n.dot(p1)); + + // if colliding edge (p3,p4) does not cross plane return no collision + // same as if p3 and p4 on same side of plane return 0 + // + // Derivation: + // d3 = d(p3, P) = (p3 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // d4 = d(p4, P) = (p4 | plane.n) - plane.d; Reversed sign compared to Plane::Distance() because plane.d is negated. + // if d3 and d4 have the same sign, they're on the same side of the plane => no collision + // We test both sides at the same time by only testing Sign(d3 * d4). + // ### put that in the Plane class + // ### also check that code in the triangle class that might be similar + const PxReal d3 = plane.distance(p3); + PxReal temp = d3 * plane.distance(p4); + if(temp>0.0f) return false; + + // if colliding edge (p3,p4) and plane are parallel return no collision + PxVec3 v2 = p4 - p3; + + temp = plane.n.dot(v2); + if(temp==0.0f) return false; // ### epsilon would be better + + // compute intersection point of plane and colliding edge (p3,p4) + ip = p3-v2*(d3/temp); + + // find largest 2D plane projection + PxU32 i,j; + closestAxis(plane.n, i, j); + + // compute distance of intersection from line (ip, -dir) to line (p1,p2) + dist = (v1[i]*(ip[j]-p1[j])-v1[j]*(ip[i]-p1[i]))/(v1[i]*dir[j]-v1[j]*dir[i]); + if(dist<0.0f) return false; + + // compute intersection point on edge (p1,p2) line + ip -= dist*dir; + + // check if intersection point (ip) is between edge (p1,p2) vertices + temp = (p1.x-ip.x)*(p2.x-ip.x)+(p1.y-ip.y)*(p2.y-ip.y)+(p1.z-ip.z)*(p2.z-ip.z); + if(temp<1e-3f) return true; // collision found + + return false; // no collision +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.h new file mode 100644 index 0000000..3b056a2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionEdgeEdge.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_EDGE_EDGE_H +#define GU_INTERSECTION_EDGE_EDGE_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + + // collide edge (p1,p2) moving in direction (dir) colliding + // width edge (p3,p4). Return true on a collision with + // collision distance (dist) and intersection point (ip) + // note: dist and ip are invalid if function returns false. + // note: ip is on (p1,p2), not (p1+dist*dir,p2+dist*dir) + PX_PHYSX_COMMON_API bool intersectEdgeEdge(const PxVec3& p1, const PxVec3& p2, const PxVec3& dir, const PxVec3& p3, const PxVec3& p4, PxReal& dist, PxVec3& ip); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRay.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRay.h new file mode 100644 index 0000000..777d904 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRay.h @@ -0,0 +1,37 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_RAY_H +#define GU_INTERSECTION_RAY_H + +// PT: small distance between a ray origin and a potentially hit surface. Should be small enough to +// limit accuracy issues coming from large distance values, but not too close to the surface to make +// sure we don't start inside the shape. +#define GU_RAY_SURFACE_OFFSET 10.0f + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp new file mode 100644 index 0000000..32e236d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayBox.cpp @@ -0,0 +1,448 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "foundation/PxMathIntrinsics.h" +#include "foundation/PxFPU.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionRayBoxSIMD.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** +* Computes a ray-AABB intersection. +* Original code by Andrew Woo, from "Graphics Gems", Academic Press, 1990 +* Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500) +* Epsilon value added by Klaus Hartmann. (discarding it saves a few cycles only) +* +* Hence this version is faster as well as more robust than the original one. +* +* Should work provided: +* 1) the integer representation of 0.0f is 0x00000000 +* 2) the sign bit of the float is the most significant one +* +* Report bugs: p.terdiman@codercorner.com +* +* \param aabb [in] the axis-aligned bounding box +* \param origin [in] ray origin +* \param dir [in] ray direction +* \param coord [out] impact coordinates +* \return true if ray intersects AABB +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#define RAYAABB_EPSILON 0.00001f +bool Gu::rayAABBIntersect(const PxVec3& minimum, const PxVec3& maximum, const PxVec3& origin, const PxVec3& _dir, PxVec3& coord) +{ + PxIntBool Inside = PxIntTrue; + PxVec3 MaxT(-1.0f, -1.0f, -1.0f); + const PxReal* dir = &_dir.x; + const PxU32* idir = reinterpret_cast(dir); + // Find candidate planes. + for(PxU32 i=0;i<3;i++) + { + if(origin[i] < minimum[i]) + { + coord[i] = minimum[i]; + Inside = PxIntFalse; + + // Calculate T distances to candidate planes + if(idir[i]) +// if(PX_IR(dir[i])) + MaxT[i] = (minimum[i] - origin[i]) / dir[i]; + } + else if(origin[i] > maximum[i]) + { + coord[i] = maximum[i]; + Inside = PxIntFalse; + + // Calculate T distances to candidate planes + if(idir[i]) +// if(PX_IR(dir[i])) + MaxT[i] = (maximum[i] - origin[i]) / dir[i]; + } + } + + // Ray origin inside bounding box + if(Inside) + { + coord = origin; + return true; + } + + // Get largest of the maxT's for final choice of intersection + PxU32 WhichPlane = 0; + if(MaxT[1] > MaxT[WhichPlane]) WhichPlane = 1; + if(MaxT[2] > MaxT[WhichPlane]) WhichPlane = 2; + + // Check final candidate actually inside box + const PxU32* tmp = reinterpret_cast(&MaxT[WhichPlane]); + if((*tmp)&PX_SIGN_BITMASK) +// if(PX_IR(MaxT[WhichPlane])&PX_SIGN_BITMASK) + return false; + + for(PxU32 i=0;i<3;i++) + { + if(i!=WhichPlane) + { + coord[i] = origin[i] + MaxT[WhichPlane] * dir[i]; +#ifdef RAYAABB_EPSILON + if(coord[i] < minimum[i] - RAYAABB_EPSILON || coord[i] > maximum[i] + RAYAABB_EPSILON) +#else + if(coord[i] < minimum[i] || coord[i] > maximum[i]) +#endif + return false; + } + } + return true; // ray hits box +} + + + +/** +* Computes a ray-AABB intersection. +* Original code by Andrew Woo, from "Graphics Gems", Academic Press, 1990 +* Optimized code by Pierre Terdiman, 2000 (~20-30% faster on my Celeron 500) +* Epsilon value added by Klaus Hartmann. (discarding it saves a few cycles only) +* Return of intersected face code and parameter by Adam! Also modified behavior for ray starts inside AABB. 2004 :-p +* +* Hence this version is faster as well as more robust than the original one. +* +* Should work provided: +* 1) the integer representation of 0.0f is 0x00000000 +* 2) the sign bit of the float is the most significant one +* +* Report bugs: p.terdiman@codercorner.com +* +* \param minimum [in] the smaller corner of the bounding box +* \param maximum [in] the larger corner of the bounding box +* \param origin [in] ray origin +* \param _dir [in] ray direction +* \param coord [out] impact coordinates +* \param t [out] t such that coord = origin + dir * t +* \return false if ray does not intersect AABB, or ray origin is inside AABB. Else: + 1 + coordinate index of box axis that was hit + + Note: sign bit that determines if the minimum (0) or maximum (1) of the axis was hit is equal to sign(coord[returnVal-1]). +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +PxU32 Gu::rayAABBIntersect2(const PxVec3& minimum, const PxVec3& maximum, const PxVec3& origin, const PxVec3& _dir, PxVec3& coord, PxReal & t) +{ + PxIntBool Inside = PxIntTrue; + PxVec3 MaxT(-1.0f, -1.0f, -1.0f); + const PxReal* dir = &_dir.x; + const PxU32* idir = reinterpret_cast(dir); + // Find candidate planes. + for(PxU32 i=0;i<3;i++) + { + if(origin[i] < minimum[i]) + { + coord[i] = minimum[i]; + Inside = PxIntFalse; + + // Calculate T distances to candidate planes + if(idir[i]) +// if(PX_IR(dir[i])) + MaxT[i] = (minimum[i] - origin[i]) / dir[i]; + } + else if(origin[i] > maximum[i]) + { + coord[i] = maximum[i]; + Inside = PxIntFalse; + + // Calculate T distances to candidate planes + if(idir[i]) +// if(PX_IR(dir[i])) + MaxT[i] = (maximum[i] - origin[i]) / dir[i]; + } + } + + // Ray origin inside bounding box + if(Inside) + { + coord = origin; + t = 0; + return 1; + } + + // Get largest of the maxT's for final choice of intersection + PxU32 WhichPlane = 0; + if(MaxT[1] > MaxT[WhichPlane]) WhichPlane = 1; + if(MaxT[2] > MaxT[WhichPlane]) WhichPlane = 2; + + // Check final candidate actually inside box + const PxU32* tmp = reinterpret_cast(&MaxT[WhichPlane]); + if((*tmp)&PX_SIGN_BITMASK) +// if(PX_IR(MaxT[WhichPlane])&PX_SIGN_BITMASK) + return 0; + + for(PxU32 i=0;i<3;i++) + { + if(i!=WhichPlane) + { + coord[i] = origin[i] + MaxT[WhichPlane] * dir[i]; +#ifdef RAYAABB_EPSILON + if(coord[i] < minimum[i] - RAYAABB_EPSILON || coord[i] > maximum[i] + RAYAABB_EPSILON) return 0; +#else + if(coord[i] < minimum[i] || coord[i] > maximum[i]) return 0; +#endif + } + } + t = MaxT[WhichPlane]; + return 1 + WhichPlane; // ray hits box +} + +// Collide ray defined by ray origin (ro) and ray direction (rd) +// with the bounding box. Returns -1 on no collision and the face index +// for first intersection if a collision is found together with +// the distance to the collision points (tnear and tfar) + +// ptchernev: +// Should we use an enum, or should we keep the anonymous ints? +// Should we increment the return code by one (return 0 for non intersection)? + +int Gu::intersectRayAABB(const PxVec3& minimum, const PxVec3& maximum, const PxVec3& ro, const PxVec3& rd, float& tnear, float& tfar) +{ + // Refactor + int ret=-1; + + tnear = -PX_MAX_F32; + tfar = PX_MAX_F32; + // PT: why did we change the initial epsilon value? + #define LOCAL_EPSILON PX_EPS_F32 + //#define LOCAL_EPSILON 0.0001f + + for(unsigned int a=0;a<3;a++) + { + if(rd[a]>-LOCAL_EPSILON && rd[a]maximum[a]) + return -1; + } + else + { + const PxReal OneOverDir = 1.0f / rd[a]; + PxReal t1 = (minimum[a]-ro[a]) * OneOverDir; + PxReal t2 = (maximum[a]-ro[a]) * OneOverDir; + + unsigned int b = a; + if(t1>t2) + { + PxReal t=t1; + t1=t2; + t2=t; + b += 3; + } + + if(t1>tnear) + { + tnear = t1; + ret = int(b); + } + if(t2tfar || tfartfar || tfar-LOCAL_EPSILON && rd.xmaximum.x) + return -1; + if(physx::intrinsics::abs(rd.y)-LOCAL_EPSILON && rd.ymaximum.y) + return -1; + if(physx::intrinsics::abs(rd.z)-LOCAL_EPSILON && rd.zmaximum.z) + return -1; + + PxReal t1x = (minimum.x - ro.x) * oneOverDir.x; + PxReal t2x = (maximum.x - ro.x) * oneOverDir.x; + PxReal t1y = (minimum.y - ro.y) * oneOverDir.y; + PxReal t2y = (maximum.y - ro.y) * oneOverDir.y; + PxReal t1z = (minimum.z - ro.z) * oneOverDir.z; + PxReal t2z = (maximum.z - ro.z) * oneOverDir.z; + + int bx; + int by; + int bz; + + if(t1x>t2x) + { + PxReal t=t1x; t1x=t2x; t2x=t; + bx = 3; + } + else + { + bx = 0; + } + + if(t1y>t2y) + { + PxReal t=t1y; t1y=t2y; t2y=t; + by = 4; + } + else + { + by = 1; + } + + if(t1z>t2z) + { + PxReal t=t1z; t1z=t2z; t2z=t; + bz = 5; + } + else + { + bz = 2; + } + + int ret; +// if(t1x>tnear) // PT: no need to test for the first value + { + tnear = t1x; + ret = bx; + } +// tfar = PxMin(tfar, t2x); + tfar = t2x; // PT: no need to test for the first value + + if(t1y>tnear) + { + tnear = t1y; + ret = by; + } + tfar = PxMin(tfar, t2y); + + if(t1z>tnear) + { + tnear = t1z; + ret = bz; + } + tfar = PxMin(tfar, t2z); + + if(tnear>tfar || tfar= GU_MIN_AABB_EXTENT*0.5f); + PX_ASSERT(maximum.y-minimum.y >= GU_MIN_AABB_EXTENT*0.5f); + PX_ASSERT(maximum.z-minimum.z >= GU_MIN_AABB_EXTENT*0.5f); + // not using vector math due to vector to integer pipeline penalties. TODO: verify that it's indeed faster + namespace i = physx::intrinsics; + + // P+tD=a; t=(a-P)/D + // t=(a - p.x)*1/d.x = a/d.x +(- p.x/d.x) + const PxF32 dEpsilon = 1e-9f; + // using recipFast fails height field unit tests case where a ray cast from y=10000 to 0 gets clipped to 0.27 in y + PxF32 invDx = i::recip(i::selectMax(i::abs(rd.x), dEpsilon) * i::sign(rd.x)); +#ifdef RAYAABB_EPSILON + PxF32 tx0 = (minimum.x - RAYAABB_EPSILON - ro.x) * invDx; + PxF32 tx1 = (maximum.x + RAYAABB_EPSILON - ro.x) * invDx; +#else + PxF32 tx0 = (minimum.x - ro.x) * invDx; + PxF32 tx1 = (maximum.x - ro.x) * invDx; +#endif + PxF32 txMin = i::selectMin(tx0, tx1); + PxF32 txMax = i::selectMax(tx0, tx1); + + PxF32 invDy = i::recip(i::selectMax(i::abs(rd.y), dEpsilon) * i::sign(rd.y)); +#ifdef RAYAABB_EPSILON + PxF32 ty0 = (minimum.y - RAYAABB_EPSILON - ro.y) * invDy; + PxF32 ty1 = (maximum.y + RAYAABB_EPSILON - ro.y) * invDy; +#else + PxF32 ty0 = (minimum.y - ro.y) * invDy; + PxF32 ty1 = (maximum.y - ro.y) * invDy; +#endif + PxF32 tyMin = i::selectMin(ty0, ty1); + PxF32 tyMax = i::selectMax(ty0, ty1); + + PxF32 invDz = i::recip(i::selectMax(i::abs(rd.z), dEpsilon) * i::sign(rd.z)); +#ifdef RAYAABB_EPSILON + PxF32 tz0 = (minimum.z - RAYAABB_EPSILON - ro.z) * invDz; + PxF32 tz1 = (maximum.z + RAYAABB_EPSILON - ro.z) * invDz; +#else + PxF32 tz0 = (minimum.z - ro.z) * invDz; + PxF32 tz1 = (maximum.z - ro.z) * invDz; +#endif + PxF32 tzMin = i::selectMin(tz0, tz1); + PxF32 tzMax = i::selectMax(tz0, tz1); + + PxF32 maxOfNears = i::selectMax(i::selectMax(txMin, tyMin), tzMin); + PxF32 minOfFars = i::selectMin(i::selectMin(txMax, tyMax), tzMax); + + tnear = i::selectMax(maxOfNears, 0.0f); + tfar = i::selectMin(minOfFars, maxDist); + + return (tnear tmax) + PxSwap(tmin, tmax); + + return true; +} + +PxU32 Gu::intersectRayCapsuleInternal(const PxVec3& rayOrigin, const PxVec3& rayDir, const PxVec3& capsuleP0, const PxVec3& capsuleP1, float radius, PxReal s[2]) +{ + const float radius2 = radius * radius; + + const PxVec3 AB = capsuleP1 - capsuleP0; + const PxVec3 AO = rayOrigin - capsuleP0; + + const float AB_dot_d = AB.dot(rayDir); + const float AB_dot_AO = AB.dot(AO); + const float AB_dot_AB = AB.dot(AB); + + const float OneOverABDotAB = AB_dot_AB!=0.0f ? 1.0f / AB_dot_AB : 0.0f; + const float m = AB_dot_d * OneOverABDotAB; + const float n = AB_dot_AO * OneOverABDotAB; + + const PxVec3 Q = rayDir - (AB * m); + const PxVec3 R = AO - (AB * n); + + const float a = Q.dot(Q); + const float b = 2.0f * Q.dot(R); + const float c = R.dot(R) - radius2; + + if(a == 0.0f) + { + float atmin, atmax, btmin, btmax; + if( !intersectRaySphere(rayOrigin, rayDir, capsuleP0, radius2, atmin, atmax) + || !intersectRaySphere(rayOrigin, rayDir, capsuleP1, radius2, btmin, btmax)) + return 0; + + s[0] = atmin < btmin ? atmin : btmin; + return 1; + } + + const float discriminant = b * b - 4.0f * a * c; + if(discriminant < 0.0f) + return 0; + + const float OneOver2A = 1.0f / (2.0f * a); + const float sqrtDet = sqrtf(discriminant); + + float tmin = (-b - sqrtDet) * OneOver2A; + float tmax = (-b + sqrtDet) * OneOver2A; + if(tmin > tmax) + PxSwap(tmin, tmax); + + const float t_k1 = tmin * m + n; + if(t_k1 < 0.0f) + { + float stmin, stmax; + if(intersectRaySphere(rayOrigin, rayDir, capsuleP0, radius2, stmin, stmax)) + s[0] = stmin; + else + return 0; + } + else if(t_k1 > 1.0f) + { + float stmin, stmax; + if(intersectRaySphere(rayOrigin, rayDir, capsuleP1, radius2, stmin, stmax)) + s[0] = stmin; + else + return 0; + } + else + s[0] = tmin; + return 1; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.h new file mode 100644 index 0000000..8fd0b9e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayCapsule.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_RAY_CAPSULE_H +#define GU_INTERSECTION_RAY_CAPSULE_H + +#include "GuCapsule.h" +#include "GuDistancePointSegment.h" +#include "GuIntersectionRay.h" + +namespace physx +{ +namespace Gu +{ + PxU32 intersectRayCapsuleInternal(const PxVec3& origin, const PxVec3& dir, const PxVec3& p0, const PxVec3& p1, float radius, PxReal s[2]); + + PX_FORCE_INLINE bool intersectRayCapsule(const PxVec3& origin, const PxVec3& dir, const PxVec3& p0, const PxVec3& p1, float radius, PxReal& t) + { + // PT: move ray origin close to capsule, to solve accuracy issues. + // We compute the distance D between the ray origin and the capsule's segment. + // Then E = D - radius = distance between the ray origin and the capsule. + // We can move the origin freely along 'dir' up to E units before touching the capsule. + PxReal l = distancePointSegmentSquaredInternal(p0, p1 - p0, origin); + l = PxSqrt(l) - radius; + + // PT: if this becomes negative or null, the ray starts inside the capsule and we can early exit + if(l<=0.0f) + { + t = 0.0f; + return true; + } + + // PT: we remove an arbitrary GU_RAY_SURFACE_OFFSET units to E, to make sure we don't go close to the surface. + // If we're moving in the direction of the capsule, the origin is now about GU_RAY_SURFACE_OFFSET units from it. + // If we're moving away from the capsule, the ray won't hit the capsule anyway. + // If l is smaller than GU_RAY_SURFACE_OFFSET we're close enough, accuracy is good, there is nothing to do. + if(l>GU_RAY_SURFACE_OFFSET) + l -= GU_RAY_SURFACE_OFFSET; + else + l = 0.0f; + + // PT: move origin closer to capsule and do the raycast + PxReal s[2]; + const PxU32 nbHits = Gu::intersectRayCapsuleInternal(origin + l*dir, dir, p0, p1, radius, s); + if(!nbHits) + return false; + + // PT: keep closest hit only + if(nbHits == 1) + t = s[0]; + else + t = (s[0] < s[1]) ? s[0] : s[1]; + + // PT: fix distance (smaller than expected after moving ray close to capsule) + t += l; + return true; + } + + PX_FORCE_INLINE bool intersectRayCapsule(const PxVec3& origin, const PxVec3& dir, const Gu::Capsule& capsule, PxReal& t) + { + return Gu::intersectRayCapsule(origin, dir, capsule.p0, capsule.p1, capsule.radius, t); + } +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayPlane.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayPlane.h new file mode 100644 index 0000000..445e616 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayPlane.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_RAY_PLANE_H +#define GU_INTERSECTION_RAY_PLANE_H + +#include "foundation/PxPlane.h" + +namespace physx +{ +namespace Gu +{ + // Returns true if line and plane are not parallel + PX_INLINE bool intersectRayPlane(const PxVec3& orig, const PxVec3& dir, const PxPlane& plane, float& distanceAlongLine, PxVec3* pointOnPlane = NULL) + { + const float dn = dir.dot(plane.n); + if(-1E-7f < dn && dn < 1E-7f) + return false; // parallel + + distanceAlongLine = -plane.distance(orig)/dn; + + if(pointOnPlane) + *pointOnPlane = orig + distanceAlongLine * dir; + + return true; + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp new file mode 100644 index 0000000..26d5898 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.cpp @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec3.h" +#include "GuIntersectionRaySphere.h" +#include "GuIntersectionRay.h" + +using namespace physx; + +// Based on GD Mag code, but now works correctly when origin is inside the sphere. +// This version has limited accuracy. +bool Gu::intersectRaySphereBasic(const PxVec3& origin, const PxVec3& dir, PxReal length, const PxVec3& center, PxReal radius, PxReal& dist, PxVec3* hit_pos) +{ + // get the offset vector + const PxVec3 offset = center - origin; + + // get the distance along the ray to the center point of the sphere + const PxReal ray_dist = dir.dot(offset); + + // get the squared distances + const PxReal off2 = offset.dot(offset); + const PxReal rad_2 = radius * radius; + if(off2 <= rad_2) + { + // we're in the sphere + if(hit_pos) + *hit_pos = origin; + dist = 0.0f; + return true; + } + + if(ray_dist <= 0 || (ray_dist - length) > radius) + { + // moving away from object or too far away + return false; + } + + // find hit distance squared + const PxReal d = rad_2 - (off2 - ray_dist * ray_dist); + if(d<0.0f) + { + // ray passes by sphere without hitting + return false; + } + + // get the distance along the ray + dist = ray_dist - PxSqrt(d); + if(dist > length) + { + // hit point beyond length + return false; + } + + // sort out the details + if(hit_pos) + *hit_pos = origin + dir * dist; + return true; +} + +// PT: modified version calls the previous function, but moves the ray origin closer to the sphere. The test accuracy is +// greatly improved as a result. This is an idea proposed on the GD-Algorithms list by Eddie Edwards. +// See: http://www.codercorner.com/blog/?p=321 +bool Gu::intersectRaySphere(const PxVec3& origin, const PxVec3& dir, PxReal length, const PxVec3& center, PxReal radius, PxReal& dist, PxVec3* hit_pos) +{ + const PxVec3 x = origin - center; + PxReal l = PxSqrt(x.dot(x)) - radius - GU_RAY_SURFACE_OFFSET; + +// if(l<0.0f) +// l=0.0f; + l = physx::intrinsics::selectMax(l, 0.0f); + + bool status = intersectRaySphereBasic(origin + l*dir, dir, length - l, center, radius, dist, hit_pos); + if(status) + { +// dist += l/length; + dist += l; + } + return status; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.h new file mode 100644 index 0000000..3638770 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRaySphere.h @@ -0,0 +1,48 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_RAY_SPHERE_H +#define GU_INTERSECTION_RAY_SPHERE_H + +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ +namespace Gu +{ + // PT: basic version, limited accuracy, might fail for long rays vs small spheres + PX_PHYSX_COMMON_API bool intersectRaySphereBasic(const PxVec3& origin, const PxVec3& dir, PxReal length, const PxVec3& center, PxReal radius, PxReal& dist, PxVec3* hit_pos = NULL); + + // PT: version with improved accuracy + PX_PHYSX_COMMON_API bool intersectRaySphere(const PxVec3& origin, const PxVec3& dir, PxReal length, const PxVec3& center, PxReal radius, PxReal& dist, PxVec3* hit_pos = NULL); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayTriangle.h new file mode 100644 index 0000000..51c00c3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionRayTriangle.h @@ -0,0 +1,177 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_RAY_TRIANGLE_H +#define GU_INTERSECTION_RAY_TRIANGLE_H + +#include "foundation/PxVec3.h" +#include "common/PxPhysXCommonConfig.h" + +namespace physx +{ + +namespace Gu +{ + // PT: this is used for backface culling. It existed in Moller's original code already. Basically this is only to avoid dividing by zero. + // This should not depend on what units are used, and neither should it depend on the size of triangles. A large triangle with the same + // orientation as a small triangle should be backface culled the same way. A triangle whose orientation does not change should not suddenly + // become culled or visible when we scale it. + // + // An absolute epsilon is fine here. The computation will work fine for small triangles, and large triangles will simply make 'det' larger, + // more and more inaccurate, but it won't suddenly make it negative. + // + // Using FLT_EPSILON^2 ensures that triangles whose edges are smaller than FLT_EPSILON long are rejected. This epsilon makes the code work + // for very small triangles, while still preventing divisions by too small values. + #define GU_CULLING_EPSILON_RAY_TRIANGLE FLT_EPSILON*FLT_EPSILON + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /** + * Computes a ray-triangle intersection test. + * From Tomas Moeller's "Fast Minimum Storage Ray-Triangle Intersection" + * Could be optimized and cut into 2 methods (culled or not). Should make a batch one too to avoid the call overhead, or make it inline. + * + * \param orig [in] ray origin + * \param dir [in] ray direction + * \param vert0 [in] triangle vertex + * \param vert1 [in] triangle vertex + * \param vert2 [in] triangle vertex + * \param at [out] distance + * \param au [out] impact barycentric coordinate + * \param av [out] impact barycentric coordinate + * \param cull [in] true to use backface culling + * \param enlarge [in] enlarge triangle by specified epsilon in UV space to avoid false near-edge rejections + * \return true on overlap + * \note u, v and t will remain unchanged if false is returned. + */ + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE bool intersectRayTriangle( const PxVec3& orig, const PxVec3& dir, + const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, + PxReal& at, PxReal& au, PxReal& av, + bool cull, float enlarge=0.0f) + { + // Find vectors for two edges sharing vert0 + const PxVec3 edge1 = vert1 - vert0; + const PxVec3 edge2 = vert2 - vert0; + + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); // error ~ |v2-v0| + + // If determinant is near zero, ray lies in plane of triangle + const PxReal det = edge1.dot(pvec); // error ~ |v2-v0|*|v1-v0| + + if(cull) + { + if(detuvlimit2) + return false; + + // Prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + const PxReal v = dir.dot(qvec); + if(vuvlimit2) + return false; + + // Calculate t, scale parameters, ray intersects triangle + const PxReal t = edge2.dot(qvec); + + const PxReal inv_det = 1.0f / det; + at = t*inv_det; + au = u*inv_det; + av = v*inv_det; + } + else + { + // the non-culling branch + if(PxAbs(det)1.0f+enlarge) + return false; + + // prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + const PxReal v = dir.dot(qvec) * inv_det; + if(v<-enlarge || (u+v)>1.0f+enlarge) + return false; + + // Calculate t, ray intersects triangle + const PxReal t = edge2.dot(qvec) * inv_det; + + at = t; + au = u; + av = v; + } + return true; + } + + /* \note u, v and t will remain unchanged if false is returned. */ + PX_FORCE_INLINE bool intersectRayTriangleCulling( const PxVec3& orig, const PxVec3& dir, + const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, + PxReal& t, PxReal& u, PxReal& v, + float enlarge=0.0f) + { + return intersectRayTriangle(orig, dir, vert0, vert1, vert2, t, u, v, true, enlarge); + } + + /* \note u, v and t will remain unchanged if false is returned. */ + PX_FORCE_INLINE bool intersectRayTriangleNoCulling( const PxVec3& orig, const PxVec3& dir, + const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, + PxReal& t, PxReal& u, PxReal& v, + float enlarge=0.0f) + { + return intersectRayTriangle(orig, dir, vert0, vert1, vert2, t, u, v, false, enlarge); + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp new file mode 100644 index 0000000..5b8ffe6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionSphereBox.h" +#include "GuSphere.h" +#include "GuBox.h" + +using namespace physx; + +bool Gu::intersectSphereBox(const Sphere& sphere, const Box& box) +{ + const PxVec3 delta = sphere.center - box.center; + PxVec3 dRot = box.rot.transformTranspose(delta); //transform delta into OBB body coords. (use method call!) + + //check if delta is outside AABB - and clip the vector to the AABB. + bool outside = false; + + if(dRot.x < -box.extents.x) + { + outside = true; + dRot.x = -box.extents.x; + } + else if(dRot.x > box.extents.x) + { + outside = true; + dRot.x = box.extents.x; + } + + if(dRot.y < -box.extents.y) + { + outside = true; + dRot.y = -box.extents.y; + } + else if(dRot.y > box.extents.y) + { + outside = true; + dRot.y = box.extents.y; + } + + if(dRot.z < -box.extents.z) + { + outside = true; + dRot.z = -box.extents.z; + } + else if(dRot.z > box.extents.z) + { + outside = true; + dRot.z = box.extents.z; + } + + if(outside) //if clipping was done, sphere center is outside of box. + { + const PxVec3 clippedDelta = box.rot.transform(dRot); //get clipped delta back in world coords. + + const PxVec3 clippedVec = delta - clippedDelta; //what we clipped away. + const PxReal lenSquared = clippedVec.magnitudeSquared(); + const PxReal radius = sphere.radius; + if(lenSquared > radius * radius) // PT: objects are defined as closed, so we return 'true' in case of equality + return false; //disjoint + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.h new file mode 100644 index 0000000..d0b5ffc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionSphereBox.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_INTERSECTION_SPHERE_BOX_H +#define GU_INTERSECTION_SPHERE_BOX_H + +namespace physx +{ +namespace Gu +{ + class Sphere; + class Box; + + /** + Checks if a sphere intersects a box. Based on: Jim Arvo, A Simple Method for Box-Sphere Intersection Testing, Graphics Gems, pp. 247-250. + + \param sphere [in] sphere + \param box [in] box + + \return true if sphere overlaps box (or exactly touches it) + */ + bool intersectSphereBox(const Gu::Sphere& sphere, const Gu::Box& box); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp new file mode 100644 index 0000000..dd7b89a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTetrahedronBox.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionTetrahedronBox.h" +#include "foundation/PxBasicTemplates.h" +#include "GuIntersectionTriangleBox.h" +#include "GuBox.h" + +using namespace physx; + +namespace physx +{ +namespace Gu +{ + bool intersectTetrahedronBox(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d, const PxBounds3& box) + { + if (box.contains(a) || box.contains(b) || box.contains(c) || box.contains(d)) + return true; + + PxBounds3 tetBox = PxBounds3::empty(); + tetBox.include(a); + tetBox.include(b); + tetBox.include(c); + tetBox.include(d); + tetBox.fattenFast(1e-6f); + + if (!box.intersects(tetBox)) + return false; + + Gu::BoxPadded boxP; + boxP.center = box.getCenter(); + boxP.extents = box.getExtents(); + boxP.rot = PxMat33(PxIdentity); + return intersectTriangleBox(boxP, a, b, c) || intersectTriangleBox(boxP, a, b, d) || intersectTriangleBox(boxP, a, c, d) || intersectTriangleBox(boxP, b, c, d); + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp new file mode 100644 index 0000000..ede356a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleBox.cpp @@ -0,0 +1,193 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionTriangleBox.h" +#include "GuIntersectionTriangleBoxRef.h" +#include "GuBox.h" +#include "foundation/PxVecMath.h" + +using namespace physx; + +PxIntBool Gu::intersectTriangleBox_ReferenceCode(const PxVec3& boxcenter, const PxVec3& extents, const PxVec3& tp0, const PxVec3& tp1, const PxVec3& tp2) +{ + return intersectTriangleBox_RefImpl(boxcenter, extents, tp0, tp1, tp2); +} + +using namespace aos; + +static PX_FORCE_INLINE int testClassIIIAxes(const Vec4V& e0V, const Vec4V v0V, const Vec4V v1V, const Vec4V v2V, const PxVec3& extents) +{ + const Vec4V e0XZY_V = V4PermYZXW(e0V); + + const Vec4V v0XZY_V = V4PermYZXW(v0V); + const Vec4V p0V = V4NegMulSub(v0XZY_V, e0V, V4Mul(v0V, e0XZY_V)); + + const Vec4V v1XZY_V = V4PermYZXW(v1V); + const Vec4V p1V = V4NegMulSub(v1XZY_V, e0V, V4Mul(v1V, e0XZY_V)); + + const Vec4V v2XZY_V = V4PermYZXW(v2V); + const Vec4V p2V = V4NegMulSub(v2XZY_V, e0V, V4Mul(v2V, e0XZY_V)); + + Vec4V minV = V4Min(p0V, p1V); + minV = V4Min(minV, p2V); + + const Vec4V extentsV = V4LoadU(&extents.x); + const Vec4V fe0ZYX_V = V4Abs(e0V); + + const Vec4V fe0XZY_V = V4PermYZXW(fe0ZYX_V); + const Vec4V extentsXZY_V = V4PermYZXW(extentsV); + Vec4V radV = V4MulAdd(extentsV, fe0XZY_V, V4Mul(extentsXZY_V, fe0ZYX_V)); + + if(V4AnyGrtr3(minV, radV)) + return 0; + + Vec4V maxV = V4Max(p0V, p1V); + maxV = V4Max(maxV, p2V); + + radV = V4Sub(V4Zero(), radV); + + if(V4AnyGrtr3(radV, maxV)) + return 0; + return 1; +} + +static const VecU32V signV = U4LoadXYZW(0x80000000, 0x80000000, 0x80000000, 0x80000000); + +static PX_FORCE_INLINE PxIntBool intersectTriangleBoxInternal(const Vec4V v0V, const Vec4V v1V, const Vec4V v2V, const PxVec3& extents) +{ + // Test box axes + { + Vec4V extentsV = V4LoadU(&extents.x); + + { + const Vec4V cV = V4Abs(v0V); + if(V4AllGrtrOrEq3(extentsV, cV)) + return 1; + } + + Vec4V minV = V4Min(v0V, v1V); + minV = V4Min(minV, v2V); + + if(V4AnyGrtr3(minV, extentsV)) + return 0; + + Vec4V maxV = V4Max(v0V, v1V); + maxV = V4Max(maxV, v2V); + extentsV = V4Sub(V4Zero(), extentsV); + + if(V4AnyGrtr3(extentsV, maxV)) + return 0; + } + + // Test if the box intersects the plane of the triangle + const Vec4V e0V = V4Sub(v1V, v0V); + const Vec4V e1V = V4Sub(v2V, v1V); + { + const Vec4V normalV = V4Cross(e0V, e1V); + const Vec4V dV = Vec4V_From_FloatV(V4Dot3(normalV, v0V)); + + const Vec4V extentsV = V4LoadU(&extents.x); + VecU32V normalSignsV = V4U32and(VecU32V_ReinterpretFrom_Vec4V(normalV), signV); + const Vec4V maxV = Vec4V_ReinterpretFrom_VecU32V(V4U32or(VecU32V_ReinterpretFrom_Vec4V(extentsV), normalSignsV)); + + Vec4V tmpV = Vec4V_From_FloatV(V4Dot3(normalV, maxV)); + if(V4AnyGrtr3(dV, tmpV)) + return 0; + + normalSignsV = V4U32xor(normalSignsV, signV); + const Vec4V minV = Vec4V_ReinterpretFrom_VecU32V(V4U32or(VecU32V_ReinterpretFrom_Vec4V(extentsV), normalSignsV)); + + tmpV = Vec4V_From_FloatV(V4Dot3(normalV, minV)); + if(V4AnyGrtr3(tmpV, dV)) + return 0; + } + + // Edge-edge tests + { + if(!testClassIIIAxes(e0V, v0V, v1V, v2V, extents)) + return 0; + if(!testClassIIIAxes(e1V, v0V, v1V, v2V, extents)) + return 0; + const Vec4V e2V = V4Sub(v0V, v2V); + if(!testClassIIIAxes(e2V, v0V, v1V, v2V, extents)) + return 0; + } + return 1; +} + +// PT: a SIMD version of Tomas Moller's triangle-box SAT code +PxIntBool Gu::intersectTriangleBox_Unsafe(const PxVec3& center, const PxVec3& extents, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2) +{ + // Move everything so that the boxcenter is in (0,0,0) + const Vec4V BoxCenterV = V4LoadU(¢er.x); + const Vec4V v0V = V4Sub(V4LoadU(&p0.x), BoxCenterV); + const Vec4V v1V = V4Sub(V4LoadU(&p1.x), BoxCenterV); + const Vec4V v2V = V4Sub(V4LoadU(&p2.x), BoxCenterV); + + return intersectTriangleBoxInternal(v0V, v1V, v2V, extents); +} + +PxIntBool Gu::intersectTriangleBox(const BoxPadded& box, const PxVec3& p0_, const PxVec3& p1_, const PxVec3& p2_) +{ + // PT: TODO: SIMDify this part + + // PxVec3p ensures we can safely V4LoadU the data + const PxVec3p p0 = box.rotateInv(p0_ - box.center); + const PxVec3p p1 = box.rotateInv(p1_ - box.center); + const PxVec3p p2 = box.rotateInv(p2_ - box.center); + + const Vec4V v0V = V4LoadU(&p0.x); + const Vec4V v1V = V4LoadU(&p1.x); + const Vec4V v2V = V4LoadU(&p2.x); + + return intersectTriangleBoxInternal(v0V, v1V, v2V, box.extents); +} + +static PX_FORCE_INLINE Vec4V multiply3x3V(const Vec4V p, const PxMat33& mat) +{ + const FloatV xxxV = V4GetX(p); + const FloatV yyyV = V4GetY(p); + const FloatV zzzV = V4GetZ(p); + + Vec4V ResV = V4Scale(V4LoadU(&mat.column0.x), xxxV); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.column1.x), yyyV)); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.column2.x), zzzV)); + return ResV; +} + +// PT: warning: all params must be safe to V4LoadU +PxIntBool intersectTriangleBoxBV4( const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, + const PxMat33& rotModelToBox, const PxVec3& transModelToBox, const PxVec3& extents) +{ + const Vec4V transModelToBoxV = V4LoadU(&transModelToBox.x); + const Vec4V v0V = V4Add(multiply3x3V(V4LoadU(&p0.x), rotModelToBox), transModelToBoxV); + const Vec4V v1V = V4Add(multiply3x3V(V4LoadU(&p1.x), rotModelToBox), transModelToBoxV); + const Vec4V v2V = V4Add(multiply3x3V(V4LoadU(&p2.x), rotModelToBox), transModelToBoxV); + + return intersectTriangleBoxInternal(v0V, v1V, v2V, extents); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp new file mode 100644 index 0000000..b139b84 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/intersection/GuIntersectionTriangleTriangle.cpp @@ -0,0 +1,161 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuIntersectionTriangleTriangle.h" +#include "foundation/PxPlane.h" + +namespace physx +{ +namespace Gu +{ + + //Based on the paper A Fast Triangle-Triangle Intersection Test by T. Moeller + //http://web.stanford.edu/class/cs277/resources/papers/Moller1997b.pdf + struct Interval + { + PxReal min; + PxReal max; + PxVec3 minPoint; + PxVec3 maxPoint; + + PX_FORCE_INLINE Interval() : min(FLT_MAX), max(-FLT_MAX), minPoint(PxVec3(NAN)), maxPoint(PxVec3(NAN)) { } + + PX_FORCE_INLINE static bool overlapOrTouch(const Interval& a, const Interval& b) + { + return !(a.min > b.max || b.min > a.max); + } + + PX_FORCE_INLINE static Interval intersection(const Interval& a, const Interval& b) + { + Interval result; + if (!overlapOrTouch(a, b)) + return result; + + if (a.min > b.min) + { + result.min = a.min; + result.minPoint = a.minPoint; + } + else + { + result.min = b.min; + result.minPoint = b.minPoint; + } + + if (a.max < b.max) + { + result.max = a.max; + result.maxPoint = a.maxPoint; + } + else + { + result.max = b.max; + result.maxPoint = b.maxPoint; + } + return result; + } + + PX_FORCE_INLINE void include(PxReal d, const PxVec3& p) + { + if (d < min) { min = d; minPoint = p; } + if (d > max) { max = d; maxPoint = p; } + } + }; + + static Interval computeInterval(PxReal distanceA, PxReal distanceB, PxReal distanceC, const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& dir) + { + Interval i; + + const bool bA = distanceA > 0; + const bool bB = distanceB > 0; + const bool bC = distanceC > 0; + distanceA = PxAbs(distanceA); + distanceB = PxAbs(distanceB); + distanceC = PxAbs(distanceC); + + if (bA != bB) + { + const PxVec3 p = (distanceA / (distanceA + distanceB)) * b + (distanceB / (distanceA + distanceB)) * a; + i.include(dir.dot(p), p); + } + if (bA != bC) + { + const PxVec3 p = (distanceA / (distanceA + distanceC)) * c + (distanceC / (distanceA + distanceC)) * a; + i.include(dir.dot(p), p); + } + if (bB != bC) + { + const PxVec3 p = (distanceB / (distanceB + distanceC)) * c + (distanceC / (distanceB + distanceC)) * b; + i.include(dir.dot(p), p); + } + + return i; + } + + bool trianglesIntersect(const PxVec3& a1, const PxVec3& b1, const PxVec3& c1, const PxVec3& a2, const PxVec3& b2, const PxVec3& c2, Segment* intersection) + { + const PxPlane p1(a1, b1, c1); + const PxReal p1ToA = p1.distance(a2); + const PxReal p1ToB = p1.distance(b2); + const PxReal p1ToC = p1.distance(c2); + + if ((p1ToA > 0) == (p1ToB > 0) && (p1ToA > 0) == (p1ToC > 0)) + return false; + + const PxPlane p2(a2, b2, c2); + const PxReal p2ToA = p2.distance(a1); + const PxReal p2ToB = p2.distance(b1); + const PxReal p2ToC = p2.distance(c1); + + if ((p2ToA > 0) == (p2ToB > 0) && (p2ToA > 0) == (p2ToC > 0)) + return false; + + PxVec3 intersectionDirection = p1.n.cross(p2.n); + const PxReal l2 = intersectionDirection.magnitudeSquared(); + if (l2 < 1e-12f) + return false; //Coplanar triangles + + intersectionDirection *= 1.0f / PxSqrt(l2); + + const Interval i1 = computeInterval(p2ToA, p2ToB, p2ToC, a1, b1, c1, intersectionDirection); + const Interval i2 = computeInterval(p1ToA, p1ToB, p1ToC, a2, b2, c2, intersectionDirection); + + if (Interval::overlapOrTouch(i1, i2)) + { + if (intersection) + { + const Interval i = Interval::intersection(i1, i2); + intersection->p0 = i.minPoint; + intersection->p1 = i.maxPoint; + } + return true; + } + return false; + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp new file mode 100644 index 0000000..47beda2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.cpp @@ -0,0 +1,450 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "GuBV32.h" +#include "CmSerialize.h" +#include "CmUtils.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVecMath.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +BV32Tree::BV32Tree(SourceMesh* meshInterface, const PxBounds3& localBounds) +{ + reset(); + init(meshInterface, localBounds); +} + +BV32Tree::BV32Tree() +{ + reset(); +} + +void BV32Tree::release() +{ + if (!mUserAllocated) + { + PX_DELETE_ARRAY(mNodes); + PX_FREE(mPackedNodes); + PX_FREE(mTreeDepthInfo); + PX_FREE(mRemapPackedNodeIndexWithDepth); + } + mNodes = NULL; + mNbNodes = 0; + mMaxTreeDepth = 0; +} + +BV32Tree::~BV32Tree() +{ + release(); +} + +void BV32Tree::reset() +{ + mMeshInterface = NULL; + mNbNodes = 0; + mNodes = NULL; + mNbPackedNodes = 0; + mPackedNodes = NULL; + mMaxTreeDepth = 0; + mTreeDepthInfo = NULL; + mRemapPackedNodeIndexWithDepth = NULL; + mInitData = 0; + mUserAllocated = false; +} + +void BV32Tree::operator=(BV32Tree& v) +{ + mMeshInterface = v.mMeshInterface; + mLocalBounds = v.mLocalBounds; + mNbNodes = v.mNbNodes; + mNodes = v.mNodes; + mInitData = v.mInitData; + mUserAllocated = v.mUserAllocated; + v.reset(); +} + +bool BV32Tree::init(SourceMeshBase* meshInterface, const PxBounds3& localBounds) +{ + mMeshInterface = meshInterface; + mLocalBounds.init(localBounds); + return true; +} + +// PX_SERIALIZATION +BV32Tree::BV32Tree(const PxEMPTY) +{ + mUserAllocated = true; +} + +void BV32Tree::exportExtraData(PxSerializationContext& stream) +{ + stream.alignData(16); + stream.writeData(mPackedNodes, mNbNodes*sizeof(BV32DataPacked)); +} + +void BV32Tree::importExtraData(PxDeserializationContext& context) +{ + context.alignExtraData(16); + mPackedNodes = context.readExtraData(mNbNodes); +} +//~PX_SERIALIZATION + +bool BV32Tree::load(PxInputStream& stream, bool mismatch_) +{ + PX_ASSERT(!mUserAllocated); + + release(); + + PxI8 a, b, c, d; + readChunk(a, b, c, d, stream); + if(a != 'B' || b != 'V' || c != '3' || d != '2') + return false; + + bool mismatch; + PxU32 fileVersion; + if(!readBigEndianVersionNumber(stream, mismatch_, fileVersion, mismatch)) + return false; + + mLocalBounds.mCenter.x = readFloat(mismatch, stream); + mLocalBounds.mCenter.y = readFloat(mismatch, stream); + mLocalBounds.mCenter.z = readFloat(mismatch, stream); + mLocalBounds.mExtentsMagnitude = readFloat(mismatch, stream); + + mInitData = readDword(mismatch, stream); + + /*const PxU32 nbNodes = readDword(mismatch, stream); + mNbNodes = nbNodes; + + if (nbNodes) + { + BV32Data* nodes = PX_NEW(BV32Data)[nbNodes]; + + mNodes = nodes; + PxMarkSerializedMemory(nodes, sizeof(BV32Data)*nbNodes); + + for (PxU32 i = 0; i(PX_ALLOC(sizeof(BV32DataPacked)*nbPackedNodes, "BV32DataPacked")); + + PxMarkSerializedMemory(mPackedNodes, sizeof(BV32DataPacked)*nbPackedNodes); + + for (PxU32 i = 0; i < nbPackedNodes; ++i) + { + BV32DataPacked& node = mPackedNodes[i]; + node.mNbNodes = readDword(mismatch, stream); + PX_ASSERT(node.mNbNodes > 0); + node.mDepth = readDword(mismatch, stream); + ReadDwordBuffer(node.mData, node.mNbNodes, mismatch, stream); + const PxU32 nbElements = 4 * node.mNbNodes; + readFloatBuffer(&node.mMin[0].x, nbElements, mismatch, stream); + readFloatBuffer(&node.mMax[0].x, nbElements, mismatch, stream); + + } + } + + const PxU32 maxTreeDepth = readDword(mismatch, stream); + mMaxTreeDepth = maxTreeDepth; + + if (maxTreeDepth > 0) + { + mTreeDepthInfo = reinterpret_cast(PX_ALLOC(sizeof(BV32DataDepthInfo)*maxTreeDepth, "BV32DataDepthInfo")); + + for (PxU32 i = 0; i < maxTreeDepth; ++i) + { + BV32DataDepthInfo& info = mTreeDepthInfo[i]; + + info.offset = readDword(mismatch, stream); + info.count = readDword(mismatch, stream); + } + + mRemapPackedNodeIndexWithDepth = reinterpret_cast(PX_ALLOC(sizeof(PxU32)*nbPackedNodes, "PxU32")); + + ReadDwordBuffer(mRemapPackedNodeIndexWithDepth, nbPackedNodes, mismatch, stream); + } + + + return true; +} + + +void BV32Tree::calculateLeafNode(BV32Data& node) +{ + if (!node.isLeaf()) + { + const PxU32 nbChildren = node.getNbChildren(); + const PxU32 offset = node.getChildOffset(); + //calcualte how many children nodes are leaf nodes + PxU32 nbLeafNodes = 0; + for (PxU32 i = 0; i < nbChildren; ++i) + { + BV32Data& child = mNodes[offset + i]; + + if (child.isLeaf()) + { + nbLeafNodes++; + } + } + + node.mNbLeafNodes = nbLeafNodes; + for (PxU32 i = 0; i < nbChildren; ++i) + { + BV32Data& child = mNodes[offset + i]; + calculateLeafNode(child); + } + + } +} + + + +void BV32Tree::createSOAformatNode(BV32DataPacked& packedData, + const BV32Data& node, const PxU32 childOffset, PxU32& currentIndex, PxU32& nbPackedNodes) +{ + + //found the next 32 nodes and fill it in SOA format + + const PxU32 nbChildren = node.getNbChildren(); + const PxU32 offset = node.getChildOffset(); + + packedData.mDepth = node.mDepth; + + for (PxU32 i = 0; i < nbChildren; ++i) + { + BV32Data& child = mNodes[offset + i]; + + packedData.mMin[i] = PxVec4(child.mMin, 0.f); + packedData.mMax[i] = PxVec4(child.mMax, 0.f); + packedData.mData[i] = PxU32(child.mData); + } + + packedData.mNbNodes = nbChildren; + + PxU32 NbToGo = 0; + PxU32 NextIDs[32]; + PxMemSet(NextIDs, PX_INVALID_U32, sizeof(PxU32) * 32); + const BV32Data* ChildNodes[32]; + PxMemSet(ChildNodes, 0, sizeof(BV32Data*) * 32); + + + for (PxU32 i = 0; i< nbChildren; i++) + { + BV32Data& child = mNodes[offset + i]; + + if (!child.isLeaf()) + { + const PxU32 NextID = currentIndex; + + const PxU32 ChildSize = child.getNbChildren() - child.mNbLeafNodes; + currentIndex += ChildSize; + + //packedData.mData[i] = (packedData.mData[i] & ((1 << GU_BV4_CHILD_OFFSET_SHIFT_COUNT) - 1)) | (NextID << GU_BV4_CHILD_OFFSET_SHIFT_COUNT); + packedData.mData[i] = (packedData.mData[i] & ((1 << GU_BV4_CHILD_OFFSET_SHIFT_COUNT) - 1)) | ((childOffset + NbToGo) << GU_BV4_CHILD_OFFSET_SHIFT_COUNT); + + NextIDs[NbToGo] = NextID; + ChildNodes[NbToGo] = &child; + NbToGo++; + } + } + + nbPackedNodes += NbToGo; + for (PxU32 i = 0; i < NbToGo; ++i) + { + const BV32Data& child = *ChildNodes[i]; + + BV32DataPacked& childData = mPackedNodes[childOffset+i]; + + createSOAformatNode(childData, child, NextIDs[i], currentIndex, nbPackedNodes); + + } + +} + +bool BV32Tree::refit(float epsilon) +{ + using namespace physx::aos; + + if (!mPackedNodes) + { + PxBounds3 bounds; + bounds.setEmpty(); + if (mMeshInterface) + { + PxU32 nbVerts = mMeshInterface->getNbVertices(); + const PxVec3* verts = mMeshInterface->getVerts(); + while (nbVerts--) + bounds.include(*verts++); + mLocalBounds.init(bounds); + } + return true; + } + + class PxBounds3Padded : public PxBounds3 + { + public: + PX_FORCE_INLINE PxBounds3Padded() {} + PX_FORCE_INLINE ~PxBounds3Padded() {} + PxU32 padding; + }; + + PxU32 nb = mNbPackedNodes; + + while (nb--) + { + BV32DataPacked* PX_RESTRICT current = mPackedNodes + nb; + const PxU32 nbChildren = current->mNbNodes; + + for (PxU32 j = 0; j< nbChildren; j++) + { + if (current->isLeaf(j)) + { + PxU32 nbTets = current->getNbReferencedPrimitives(j); + PxU32 primIndex = current->getPrimitiveStartIndex(j); + + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); + + //TetrahedronPointers + do + { + PX_ASSERT(primIndex< mMeshInterface->getNbPrimitives()); + + + //meshInterface->getTriangle(VP, primIndex); + Vec4V tMin, tMax; + mMeshInterface->getPrimitiveBox(primIndex, tMin, tMax); + minV = V4Min(minV, tMin); + maxV = V4Max(maxV, tMax); + + primIndex++; + } while (--nbTets); + + const Vec4V epsilonV = V4Load(epsilon); + minV = V4Sub(minV, epsilonV); + maxV = V4Add(maxV, epsilonV); + + PxBounds3Padded refitBox; + V4StoreU_Safe(minV, &refitBox.minimum.x); + V4StoreU_Safe(maxV, &refitBox.maximum.x); + + current->mMin[j].x = refitBox.minimum.x; + current->mMin[j].y = refitBox.minimum.y; + current->mMin[j].z = refitBox.minimum.z; + current->mMax[j].x = refitBox.maximum.x; + current->mMax[j].y = refitBox.maximum.y; + current->mMax[j].z = refitBox.maximum.z; + } + else + { + PxU32 childOffset = current->getChildOffset(j); + + PX_ASSERT(childOffset < mNbPackedNodes); + + BV32DataPacked* next = mPackedNodes + childOffset; + + const PxU32 nextNbChilds = next->mNbNodes; + + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); + + for (PxU32 a = 0; a < nextNbChilds; ++a) + { + const Vec4V tMin = V4LoadU(&next->mMin[a].x); + const Vec4V tMax = V4LoadU(&next->mMax[a].x); + + minV = V4Min(minV, tMin); + maxV = V4Max(maxV, tMax); + } + + PxBounds3Padded refitBox; + V4StoreU_Safe(minV, &refitBox.minimum.x); + V4StoreU_Safe(maxV, &refitBox.maximum.x); + + current->mMin[j].x = refitBox.minimum.x; + current->mMin[j].y = refitBox.minimum.y; + current->mMin[j].z = refitBox.minimum.z; + + current->mMax[j].x = refitBox.maximum.x; + current->mMax[j].y = refitBox.maximum.y; + current->mMax[j].z = refitBox.maximum.z; + } + } + } + + BV32DataPacked* root = mPackedNodes; + { + PxBounds3 globalBounds; + globalBounds.setEmpty(); + + const PxU32 nbChildren = root->mNbNodes; + + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); + + for (PxU32 a = 0; a < nbChildren; ++a) + { + const Vec4V tMin = V4LoadU(&root->mMin[a].x); + const Vec4V tMax = V4LoadU(&root->mMax[a].x); + + minV = V4Min(minV, tMin); + maxV = V4Max(maxV, tMax); + } + + PxBounds3Padded refitBox; + V4StoreU_Safe(minV, &refitBox.minimum.x); + V4StoreU_Safe(maxV, &refitBox.maximum.x); + globalBounds.minimum.x = refitBox.minimum.x; + globalBounds.minimum.y = refitBox.minimum.y; + globalBounds.minimum.z = refitBox.minimum.z; + + globalBounds.maximum.x = refitBox.maximum.x; + globalBounds.maximum.y = refitBox.maximum.y; + globalBounds.maximum.z = refitBox.maximum.z; + + mLocalBounds.init(globalBounds); + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.h new file mode 100644 index 0000000..214be38 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32.h @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV32_H +#define GU_BV32_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxVec4.h" +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxArray.h" +#include "GuBV4.h" + +namespace physx +{ + namespace Gu + { + struct BV32Data : public physx::PxUserAllocated + { + PxVec3 mMin; + PxVec3 mMax; + PxU32 mNbLeafNodes; + PxU32 mDepth; + size_t mData; + + PX_FORCE_INLINE BV32Data() : mNbLeafNodes(0), mDepth(0), mData(PX_INVALID_U32) + { + setEmpty(); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 isLeaf() const { return mData & 1; } + + //if the node is leaf, + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbReferencedPrimitives() const { PX_ASSERT(isLeaf()); return PxU32((mData >>1)&63); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getPrimitiveStartIndex() const { PX_ASSERT(isLeaf()); return PxU32(mData >> 7); } + + //PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getPrimitive() const { return mData >> 1; } + //if the node isn't leaf, we will get the childOffset + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getChildOffset() const { PX_ASSERT(!isLeaf()); return PxU32(mData >> GU_BV4_CHILD_OFFSET_SHIFT_COUNT); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbChildren() const { PX_ASSERT(!isLeaf()); return ((mData) & ((1 << GU_BV4_CHILD_OFFSET_SHIFT_COUNT) - 1))>>1; } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void getMinMax(PxVec3& min, PxVec3& max) const + { + //min = mCenter - mExtents; + //max = mCenter + mExtents; + min = mMin; + max = mMax; + } + + PX_FORCE_INLINE void setEmpty() + { + //mCenter = PxVec3(0.0f, 0.0f, 0.0f); + //mExtents = PxVec3(-1.0f, -1.0f, -1.0f); + + mMin = PxVec3(PX_MAX_F32); + mMax = PxVec3(-PX_MAX_F32); + } + + }; + + PX_ALIGN_PREFIX(16) + struct BV32DataPacked + { + /*PxVec4 mCenter[32]; + PxVec4 mExtents[32];*/ + PxVec4 mMin[32]; + PxVec4 mMax[32]; + PxU32 mData[32]; + PxU32 mNbNodes; + PxU32 mDepth; + PxU32 padding[2]; + + PX_CUDA_CALLABLE PX_FORCE_INLINE BV32DataPacked() : mNbNodes(0), mDepth(0) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 isLeaf(const PxU32 index) const { return mData[index] & 1; } + //if the node is leaf + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbReferencedPrimitives(const PxU32 index) const { PX_ASSERT(isLeaf(index)); return (mData[index] >> 1) & 63; } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getPrimitiveStartIndex(const PxU32 index) const { PX_ASSERT(isLeaf(index)); return (mData[index] >> 7); } + //if the node isn't leaf, we will get the childOffset + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getChildOffset(const PxU32 index) const { PX_ASSERT(!isLeaf(index)); return mData[index] >> GU_BV4_CHILD_OFFSET_SHIFT_COUNT; } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNbChildren(const PxU32 index) const { PX_ASSERT(!isLeaf(index)); return ((mData[index])& ((1 << GU_BV4_CHILD_OFFSET_SHIFT_COUNT) - 1)) >> 1; } + } + PX_ALIGN_SUFFIX(16); + + //This struct store the start and end index of the packed node at the same depth level in the tree + struct BV32DataDepthInfo + { + public: + PxU32 offset; + PxU32 count; + }; + + class BV32Tree : public physx::PxUserAllocated + { + public: + // PX_SERIALIZATION + BV32Tree(const PxEMPTY); + void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + BV32Tree(); + BV32Tree(SourceMesh* meshInterface, const PxBounds3& localBounds); + ~BV32Tree(); + + bool refit(const float epsilon); + + bool load(PxInputStream& stream, bool mismatch); + + void calculateLeafNode(BV32Data& node); + void createSOAformatNode(BV32DataPacked& packedData, const BV32Data& node, const PxU32 childOffset, PxU32& currentIndex, PxU32& nbPackedNodes); + + void reset(); + void operator = (BV32Tree& v); + + bool init(SourceMeshBase* meshInterface, const PxBounds3& localBounds); + void release(); + + SourceMeshBase* mMeshInterface; + LocalBounds mLocalBounds; + + PxU32 mNbNodes; + BV32Data* mNodes; + BV32DataPacked* mPackedNodes; + PxU32 mNbPackedNodes; + PxU32* mRemapPackedNodeIndexWithDepth; + BV32DataDepthInfo* mTreeDepthInfo; + PxU32 mMaxTreeDepth; + PxU32 mInitData; + bool mUserAllocated; // PT: please keep these 4 bytes right after mCenterOrMinCoeff/mExtentsOrMaxCoeff for safe V4 loading + bool mPadding[2]; + }; + + } // namespace Gu +} + +#endif // GU_BV32_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp new file mode 100644 index 0000000..9d3dbbc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.cpp @@ -0,0 +1,673 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec4.h" +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxMemory.h" +#include "geometry/PxTriangle.h" + +#include "GuBV32Build.h" +#include "GuBV32.h" +#include "GuCenterExtents.h" +#include "GuBV4Build.h" + +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +struct BV32Node : public physx::PxUserAllocated +{ + BV32Node() : mNbChildBVNodes(0) + {} + + BV32Data mBVData[32]; + PxU32 mNbChildBVNodes; + + PX_FORCE_INLINE size_t isLeaf(PxU32 i) const { return mBVData[i].mData & 1; } + PX_FORCE_INLINE PxU32 getPrimitive(PxU32 i) const { return PxU32(mBVData[i].mData >> 1); } + PX_FORCE_INLINE const BV32Node* getChild(PxU32 i) const { return reinterpret_cast(mBVData[i].mData); } + + + PxU32 getSize() const + { + return sizeof(BV32Data)*mNbChildBVNodes; + } +}; + + +static void fillInNodes(const AABBTreeNode* current_node, const PxU32 startIndex, const PxU32 endIndex, const AABBTreeNode** NODES, PxU32& stat) +{ + + if (startIndex + 1 == endIndex) + { + //fill in nodes + const AABBTreeNode* P = current_node->getPos(); + const AABBTreeNode* N = current_node->getNeg(); + NODES[startIndex] = P; + NODES[endIndex] = N; + stat += 2; + } + else + { + const AABBTreeNode* P = current_node->getPos(); + const AABBTreeNode* N = current_node->getNeg(); + const PxU32 midIndex = startIndex + ((endIndex - startIndex) / 2); + if (!P->isLeaf()) + fillInNodes(P, startIndex, midIndex, NODES, stat); + else + { + NODES[startIndex] = P; + stat++; + } + + if (!N->isLeaf()) + fillInNodes(N, midIndex + 1, endIndex, NODES, stat); + else + { + NODES[midIndex + 1] = N; + stat++; + } + } +} + + + +static void setPrimitive(const BV4_AABBTree& source, BV32Node* node32, PxU32 i, const AABBTreeNode* node, float epsilon) +{ + const PxU32 nbPrims = node->getNbPrimitives(); + PX_ASSERT(nbPrims<=32); + const PxU32* indexBase = source.getIndices(); + const PxU32* prims = node->getPrimitives(); + const PxU32 offset = PxU32(prims - indexBase); + +#if BV32_VALIDATE + for (PxU32 j = 0; jmBVData[i].mMin = node->getAABB().minimum; + node32->mBVData[i].mMax = node->getAABB().maximum; + if (epsilon != 0.0f) + { + node32->mBVData[i].mMin -= PxVec3(epsilon); + node32->mBVData[i].mMax += PxVec3(epsilon); + } + node32->mBVData[i].mData = (primitiveIndex << 1) | 1; +} + +static BV32Node* setNode(const BV4_AABBTree& source, BV32Node* node32, PxU32 i, const AABBTreeNode* node, float epsilon) +{ + BV32Node* child = NULL; + + if (node) + { + if (node->isLeaf()) + { + setPrimitive(source, node32, i, node, epsilon); + } + else + { + + node32->mBVData[i].mMin = node->getAABB().minimum; + node32->mBVData[i].mMax = node->getAABB().maximum; + if (epsilon != 0.0f) + { + node32->mBVData[i].mMin -= PxVec3(epsilon); + node32->mBVData[i].mMax += PxVec3(epsilon); + } + + child = PX_NEW(BV32Node); + node32->mBVData[i].mData = size_t(child); + } + } + + return child; +} + + +static void buildBV32(const BV4_AABBTree& source, BV32Node* tmp, const AABBTreeNode* current_node, float epsilon, PxU32& nbNodes) +{ + PX_ASSERT(!current_node->isLeaf()); + + const AABBTreeNode* NODES[32]; + PxMemSet(NODES, 0, sizeof(AABBTreeNode*) * 32); + + fillInNodes(current_node, 0, 31, NODES, tmp->mNbChildBVNodes); + + PxU32 left = 0; + PxU32 right = 31; + + while (left < right) + { + + //sweep from the front + while (leftmNbChildBVNodes; + + for (PxU32 i = 0; i < tmp->mNbChildBVNodes; ++i) + { + const AABBTreeNode* tempNode = NODES[i]; + BV32Node* Child = setNode(source, tmp, i, tempNode, epsilon); + if (Child) + { + buildBV32(source, Child, tempNode, epsilon, nbNodes); + } + } + +} + +// +//static void validateTree(const AABBTree& Source, const AABBTreeNode* currentNode) +//{ +// if (currentNode->isLeaf()) +// { +// const PxU32* indexBase = Source.getIndices(); +// const PxU32* prims = currentNode->getPrimitives(); +// const PxU32 offset = PxU32(prims - indexBase); +// const PxU32 nbPrims = currentNode->getNbPrimitives(); +// for (PxU32 j = 0; jgetPos(); +// validateTree(Source, pos); +// const AABBTreeNode* neg = currentNode->getNeg(); +// validateTree(Source, neg); +// } +//} + +#if BV32_VALIDATE +static void validateNodeBound(const BV32Node* currentNode, SourceMeshBase* mesh, float epsilon) +{ + const PxU32 nbPrimitivesFromMesh = mesh->getNbPrimitives(); + const PxReal eps = 1e-5f; + const PxU32 nbNodes = currentNode->mNbChildBVNodes; + for (PxU32 i = 0; i < nbNodes; ++i) + { + const BV32Node* node = currentNode->getChild(i); + if (currentNode->isLeaf(i)) + { + BV32Data data = currentNode->mBVData[i]; + PxU32 nbPrimitives = data.getNbReferencedPrimitives(); + PxU32 startIndex = data.getPrimitiveStartIndex(); + + PX_ASSERT(startIndex< nbPrimitivesFromMesh); + + PxVec3 min(PX_MAX_F32, PX_MAX_F32, PX_MAX_F32); + PxVec3 max(-PX_MAX_F32, -PX_MAX_F32, -PX_MAX_F32); + const PxVec3* verts = mesh->getVerts(); + + if (mesh->getMeshType() == SourceMeshBase::MeshType::TRI_MESH) + { + const IndTri32* triIndices = static_cast(mesh)->getTris32(); + for (PxU32 j = 0; j < nbPrimitives; ++j) + { + IndTri32 index = triIndices[startIndex + j]; + + for (PxU32 k = 0; k < 3; ++k) + { + const PxVec3& v = verts[index.mRef[k]]; + + min.x = (min.x > v.x) ? v.x : min.x; + min.y = (min.y > v.y) ? v.y : min.y; + min.z = (min.z > v.z) ? v.z : min.z; + + max.x = (max.x < v.x) ? v.x : max.x; + max.y = (max.y < v.y) ? v.y : max.y; + max.z = (max.z < v.z) ? v.z : max.z; + } + } + } + else + { + const IndTetrahedron32* tetIndices = static_cast(mesh)->getTetrahedrons32(); + for (PxU32 j = 0; j < nbPrimitives; ++j) + { + IndTetrahedron32 index = tetIndices[startIndex + j]; + + for (PxU32 k = 0; k < 4; ++k) + { + const PxVec3& v = verts[index.mRef[k]]; + + min.x = (min.x > v.x) ? v.x : min.x; + min.y = (min.y > v.y) ? v.y : min.y; + min.z = (min.z > v.z) ? v.z : min.z; + + max.x = (max.x < v.x) ? v.x : max.x; + max.y = (max.y < v.y) ? v.y : max.y; + max.z = (max.z < v.z) ? v.z : max.z; + } + } + } + + PxVec3 dMin, dMax; + data.getMinMax(dMin, dMax); + + const PxVec3 difMin = min - dMin; + const PxVec3 difMax = dMax - max; + PX_ASSERT(PxAbs(difMin.x - epsilon) < eps && PxAbs(difMin.y - epsilon) < eps && PxAbs(difMin.z - epsilon) < eps); + PX_ASSERT(PxAbs(difMax.x - epsilon) < eps && PxAbs(difMax.y - epsilon) < eps && PxAbs(difMax.z - epsilon) < eps); + + } + else + { + validateNodeBound(node, mesh, epsilon); + } + } +} +#endif + +static bool BuildBV32Internal(BV32Tree& bv32Tree, const BV4_AABBTree& Source, SourceMeshBase* mesh, float epsilon) +{ + GU_PROFILE_ZONE("..BuildBV32Internal") + + const PxU32 nbPrimitives = mesh->getNbPrimitives(); + if (nbPrimitives <= 32) + { + bv32Tree.mNbPackedNodes = 1; + bv32Tree.mPackedNodes = reinterpret_cast(PX_ALLOC(sizeof(BV32DataPacked), "BV32DataPacked")); + BV32DataPacked& packedData = bv32Tree.mPackedNodes[0]; + packedData.mNbNodes = 1; + packedData.mMin[0] = PxVec4(Source.getBV().minimum, 0.f); + packedData.mMax[0] = PxVec4(Source.getBV().maximum, 0.f); + packedData.mData[0] = (nbPrimitives << 1) | 1; + bv32Tree.mMaxTreeDepth = 1; + bv32Tree.mTreeDepthInfo = reinterpret_cast(PX_ALLOC(sizeof(BV32DataDepthInfo), "BV32DataDepthInfo")); + bv32Tree.mRemapPackedNodeIndexWithDepth = reinterpret_cast(PX_ALLOC(sizeof(PxU32), "PxU32")); + bv32Tree.mTreeDepthInfo[0].offset = 0; + bv32Tree.mTreeDepthInfo[0].count = 1; + bv32Tree.mRemapPackedNodeIndexWithDepth[0] = 0; + + return bv32Tree.init(mesh, Source.getBV()); + } + + { + GU_PROFILE_ZONE("...._checkMD") + struct Local + { + static void _checkMD(const AABBTreeNode* current_node, PxU32& md, PxU32& cd) + { + cd++; + md = PxMax(md, cd); + + if (current_node->getPos()) { _checkMD(current_node->getPos(), md, cd); cd--; } + if (current_node->getNeg()) { _checkMD(current_node->getNeg(), md, cd); cd--; } + } + + static void _check(AABBTreeNode* current_node) + { + if (current_node->isLeaf()) + return; + + AABBTreeNode* P = const_cast(current_node->getPos()); + AABBTreeNode* N = const_cast(current_node->getNeg()); + { + PxU32 MDP = 0; PxU32 CDP = 0; _checkMD(P, MDP, CDP); + PxU32 MDN = 0; PxU32 CDN = 0; _checkMD(N, MDN, CDN); + + if (MDP>MDN) + // if(MDP(Source.getNodes())); + } + + + PxU32 nbNodes = 1; + BV32Node* Root32 = PX_NEW(BV32Node); + + { + GU_PROFILE_ZONE("....buildBV32") + buildBV32(Source, Root32, Source.getNodes(), epsilon, nbNodes); + } + +#if BV32_VALIDATE + validateNodeBound(Root32, mesh, epsilon); +#endif + + if (!bv32Tree.init(mesh, Source.getBV())) + return false; + BV32Tree* T = &bv32Tree; + + PxU32 MaxDepth = 0; + + // Version with variable-sized nodes in single stream + { + GU_PROFILE_ZONE("...._flatten") + + struct Local + { + static void _flatten(BV32Data* const dest, const PxU32 box_id, PxU32& current_id, const BV32Node* current, PxU32& max_depth, PxU32& current_depth, const PxU32 nb_nodes) + { + // Entering a new node => increase depth + current_depth++; + // Keep track of max depth + if (current_depth>max_depth) + max_depth = current_depth; + + for (PxU32 i = 0; imNbChildBVNodes; i++) + { + dest[box_id + i].mMin = current->mBVData[i].mMin; + dest[box_id + i].mMax = current->mBVData[i].mMax; + dest[box_id + i].mData = PxU32(current->mBVData[i].mData); + dest[box_id + i].mDepth = current_depth; + + PX_ASSERT(box_id + i < nb_nodes); + } + + PxU32 NbToGo = 0; + PxU32 NextIDs[32]; + PxMemSet(NextIDs, PX_INVALID_U32, sizeof(PxU32)*32); + const BV32Node* ChildNodes[32]; + PxMemSet(ChildNodes, 0, sizeof(BV32Node*)*32); + + BV32Data* data = dest + box_id; + for (PxU32 i = 0; imNbChildBVNodes; i++) + { + PX_ASSERT(current->mBVData[i].mData != PX_INVALID_U32); + + if (!current->isLeaf(i)) + { + + const BV32Node* ChildNode = current->getChild(i); + + const PxU32 NextID = current_id; + + const PxU32 ChildSize = ChildNode->mNbChildBVNodes; + current_id += ChildSize; + + const PxU32 ChildType = ChildNode->mNbChildBVNodes << 1; + data[i].mData = size_t(ChildType + (NextID << GU_BV4_CHILD_OFFSET_SHIFT_COUNT)); + //PX_ASSERT(data[i].mData == size_t(ChildType+(NextID<<3))); + + PX_ASSERT(box_id + i < nb_nodes); + + NextIDs[NbToGo] = NextID; + ChildNodes[NbToGo] = ChildNode; + NbToGo++; + } + } + + + + for (PxU32 i = 0; imNbChildBVNodes+1; + + BV32Data* Nodes = PX_NEW(BV32Data)[nbNodes]; + Nodes[0].mMin = Source.getBV().minimum; + Nodes[0].mMax = Source.getBV().maximum; + + const PxU32 ChildType = Root32->mNbChildBVNodes << 1; + Nodes[0].mData = size_t(ChildType + (1 << GU_BV4_CHILD_OFFSET_SHIFT_COUNT)); + + const PxU32 nbChilden = Nodes[0].getNbChildren(); + + PX_UNUSED(nbChilden); + + + T->mInitData = CurID; + + PxU32 CurrentDepth = 0; + + Local::_flatten(Nodes, 1, CurID, Root32, MaxDepth, CurrentDepth, nbNodes); + + PX_ASSERT(CurID == nbNodes); + + T->mNbNodes = nbNodes; + + T->mNodes = Nodes; + } + + + { + GU_PROFILE_ZONE("....calculateLeafNode") + bv32Tree.calculateLeafNode(bv32Tree.mNodes[0]); + } + + bv32Tree.mPackedNodes = PX_ALLOCATE(BV32DataPacked, nbNodes, "BV32DataPacked"); + bv32Tree.mNbPackedNodes = nbNodes; + bv32Tree.mMaxTreeDepth = MaxDepth; + + PxU32 nbPackedNodes = 1; + PxU32 currentIndex = bv32Tree.mNodes[0].getNbChildren() - bv32Tree.mNodes[0].mNbLeafNodes + 1; + BV32DataPacked& packedData = bv32Tree.mPackedNodes[0]; + //BV32DataDepth& depthData = bv32Tree.mMaxDepthForPackedNodes[0]; + { + GU_PROFILE_ZONE("....createSOAformatNode") + bv32Tree.createSOAformatNode(packedData, bv32Tree.mNodes[0], 1, currentIndex, nbPackedNodes); + } + + PX_ASSERT(nbPackedNodes == currentIndex); + PX_ASSERT(nbPackedNodes > 0); + + bv32Tree.mNbPackedNodes = nbPackedNodes; + +#if BV32_VALIDATE + + /*for (PxU32 i = 0; i < nbNodes; ++i) + { + BV32Data& iNode = bv32Tree.mNodes[i]; + for (PxU32 j = i+1; j < nbNodes; ++j) + { + BV32Data& jNode = bv32Tree.mNodes[j]; + PX_ASSERT(iNode.mDepth <= jNode.mDepth); + } + }*/ + +#endif + + { + GU_PROFILE_ZONE("....depth stuff") + + //bv32Tree.mMaxDepthForPackedNodes = reinterpret_cast(PX_ALLOC(sizeof(BV32DataDepth)*MaxDepth, "BV32DataDepth")); + + bv32Tree.mTreeDepthInfo = PX_ALLOCATE(BV32DataDepthInfo, MaxDepth, "BV32DataDepthInfo"); + + PxU32 totalCount = 0; + for (PxU32 i = 0; i < MaxDepth; ++i) + { + PxU32 count = 0; + for (PxU32 j = 0; j < nbPackedNodes; ++j) + { + BV32DataPacked& jPackedData = bv32Tree.mPackedNodes[j]; + if (jPackedData.mDepth == i) + { + count++; + } + } + + bv32Tree.mTreeDepthInfo[i].offset = totalCount; + bv32Tree.mTreeDepthInfo[i].count = count; + totalCount += count; + } + + PX_ASSERT(totalCount == nbPackedNodes); + bv32Tree.mRemapPackedNodeIndexWithDepth = PX_ALLOCATE(PxU32, nbPackedNodes, "PxU32"); + + for (PxU32 i = 0; i < MaxDepth; ++i) + { + PxU32 count = 0; + const PxU32 offset = bv32Tree.mTreeDepthInfo[i].offset; + PxU32* treeDepth = &bv32Tree.mRemapPackedNodeIndexWithDepth[offset]; + for (PxU32 j = 0; j < nbPackedNodes; ++j) + { + BV32DataPacked& jPackedData = bv32Tree.mPackedNodes[j]; + if (jPackedData.mDepth == i) + { + treeDepth[count++] = j; + } + } + } + +#if BV32_VALIDATE + for (PxU32 i = MaxDepth; i > 0; i--) + { + const PxU32 iOffset = bv32Tree.mTreeDepthInfo[i - 1].offset; + const PxU32 iCount = bv32Tree.mTreeDepthInfo[i - 1].count; + PxU32* iRempapNodeIndex = &bv32Tree.mRemapPackedNodeIndexWithDepth[iOffset]; + + for (PxU32 j = 0; j < iCount; ++j) + { + const PxU32 nodeIndex = iRempapNodeIndex[j]; + BV32DataPacked& currentNode = bv32Tree.mPackedNodes[nodeIndex]; + PX_ASSERT(currentNode.mDepth == i - 1); + } + + } +#endif + } + return true; +} +///// + +struct ReorderData32 +{ + //const SourceMesh* mMesh; + SourceMeshBase* mMesh; + PxU32* mOrder; + PxU32 mNbPrimitivesPerLeaf; + PxU32 mIndex; + PxU32 mNbPrimitives; + PxU32 mStats[32]; +}; + +static bool gReorderCallback(const AABBTreeNode* current, PxU32 /*depth*/, void* userData) +{ + ReorderData32* Data = reinterpret_cast(userData); + if (current->isLeaf()) + { + const PxU32 n = current->getNbPrimitives(); + PX_ASSERT(n > 0); + PX_ASSERT(n <= Data->mNbPrimitivesPerLeaf); + Data->mStats[n-1]++; + PxU32* Prims = const_cast(current->getPrimitives()); + + for (PxU32 i = 0; imNbPrimitives); + Data->mOrder[Data->mIndex] = Prims[i]; + PX_ASSERT(Data->mIndexmNbPrimitives); + Prims[i] = Data->mIndex; + Data->mIndex++; + } + } + return true; +} + + +bool physx::Gu::BuildBV32Ex(BV32Tree& tree, SourceMeshBase& mesh, float epsilon, PxU32 nbPrimitivesPerLeaf) +{ + const PxU32 nbPrimitives = mesh.getNbPrimitives(); + + BV4_AABBTree Source; + { + GU_PROFILE_ZONE("..BuildBV32Ex_buildFromMesh") + +// if (!Source.buildFromMesh(mesh, nbPrimitivesPerLeaf, BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER)) + if (!Source.buildFromMesh(mesh, nbPrimitivesPerLeaf, BV4_SAH)) + return false; + } + + { + GU_PROFILE_ZONE("..BuildBV32Ex_remap") + + PxU32* order = PX_ALLOCATE(PxU32, nbPrimitives, "BV32"); + ReorderData32 RD; + RD.mMesh = &mesh; + RD.mOrder = order; + RD.mNbPrimitivesPerLeaf = nbPrimitivesPerLeaf; + RD.mIndex = 0; + RD.mNbPrimitives = nbPrimitives; + for (PxU32 i = 0; i<32; i++) + RD.mStats[i] = 0; + Source.walk(gReorderCallback, &RD); + PX_ASSERT(RD.mIndex == nbPrimitives); + mesh.remapTopology(order); + PX_FREE(order); + // for(PxU32 i=0;i<16;i++) + // printf("%d: %d\n", i, RD.mStats[i]); + } + + + /*if (mesh.getNbPrimitives() <= nbPrimitivesPerLeaf) + return tree.init(&mesh, Source.getBV());*/ + + return BuildBV32Internal(tree, Source, &mesh, epsilon); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.h new file mode 100644 index 0000000..6ac9a7c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV32Build.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV32_BUILD_H +#define GU_BV32_BUILD_H + +#include "foundation/PxSimpleTypes.h" +#include "common/PxPhysXCommonConfig.h" + +#define BV32_VALIDATE 0 + +namespace physx +{ + namespace Gu + { + class BV32Tree; + class SourceMeshBase; + + bool BuildBV32Ex(BV32Tree& tree, SourceMeshBase& mesh, float epsilon, PxU32 nbPrimitivesPerLeaf); + + } // namespace Gu +} + +#endif // GU_BV32_BUILD_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp new file mode 100644 index 0000000..df52676 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.cpp @@ -0,0 +1,737 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "GuBV4.h" +#include "GuBV4_Common.h" +#include "CmSerialize.h" +#include "foundation/PxVecMath.h" +#include "common/PxSerialFramework.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +SourceMeshBase::SourceMeshBase(MeshType meshType) : mNbVerts(0), mVerts(NULL), mType(meshType), mRemap(NULL) +{ +} + +SourceMeshBase::~SourceMeshBase() +{ + PX_FREE(mRemap); +} + +/////////////////////////////////////////////////////////////////////////////// + +TetrahedronSourceMesh::TetrahedronSourceMesh() : SourceMeshBase(MeshType::TET_MESH) +{ + reset(); +} + +TetrahedronSourceMesh::~TetrahedronSourceMesh() +{ +} + +void TetrahedronSourceMesh::reset() +{ + mNbVerts = 0; + mVerts = NULL; + mNbTetrahedrons = 0; + mTetrahedrons32 = NULL; + mTetrahedrons16 = NULL; + mRemap = NULL; +} + +void TetrahedronSourceMesh::operator=(TetrahedronSourceMesh& v) +{ + mNbVerts = v.mNbVerts; + mVerts = v.mVerts; + mNbTetrahedrons = v.mNbTetrahedrons; + mTetrahedrons32 = v.mTetrahedrons32; + mTetrahedrons16 = v.mTetrahedrons16; + v.reset(); +} + +void TetrahedronSourceMesh::remapTopology(const PxU32* order) +{ + if(!mNbTetrahedrons) + return; + + if(mTetrahedrons32) + { + IndTetrahedron32* newTopo = PX_NEW(IndTetrahedron32)[mNbTetrahedrons]; + for(PxU32 i = 0; ix); + const Vec4V v1V = V4LoadU(&VP.Vertex[1]->x); + const Vec4V v2V = V4LoadU(&VP.Vertex[2]->x); + const Vec4V v3V = V4LoadU(&VP.Vertex[3]->x); + minV = V4Min(v0V, v1V); + minV = V4Min(minV, v2V); + minV = V4Min(minV, v3V); + + maxV = V4Max(v0V, v1V); + maxV = V4Max(maxV, v2V); + maxV = V4Max(maxV, v3V); +} + +void TetrahedronSourceMesh::refit(const PxU32 primitiveInd, PxBounds3& refitBox) +{ + TetrahedronPointers VP; + getTetrahedron(VP, primitiveInd); + + refitBox.include(*VP.Vertex[0]); + refitBox.include(*VP.Vertex[1]); + refitBox.include(*VP.Vertex[2]); + refitBox.include(*VP.Vertex[3]); +} + +/////////////////////////////////////////////////////////////////////////////// + +SourceMesh::SourceMesh() : SourceMeshBase(MeshType::TRI_MESH) +{ + reset(); +} + +SourceMesh::~SourceMesh() +{ +} + +void SourceMesh::reset() +{ + mNbVerts = 0; + mVerts = NULL; + mNbTris = 0; + mTriangles32 = NULL; + mTriangles16 = NULL; + mRemap = NULL; +} + +void SourceMesh::operator=(SourceMesh& v) +{ + mNbVerts = v.mNbVerts; + mVerts = v.mVerts; + mNbTris = v.mNbTris; + mTriangles32 = v.mTriangles32; + mTriangles16 = v.mTriangles16; + mRemap = v.mRemap; + v.reset(); +} + +void SourceMesh::remapTopology(const PxU32* order) +{ + if(!mNbTris) + return; + + if(mTriangles32) + { + IndTri32* newTopo = PX_NEW(IndTri32)[mNbTris]; + for(PxU32 i=0;ix); + const Vec4V v1V = V4LoadU(&VP.Vertex[1]->x); + const Vec4V v2V = V4LoadU(&VP.Vertex[2]->x); + minV = V4Min(v0V, v1V); + minV = V4Min(minV, v2V); + + maxV = V4Max(v0V, v1V); + maxV = V4Max(maxV, v2V); +} + +void SourceMesh::refit(const PxU32 primitiveInd, PxBounds3& refitBox) +{ + VertexPointers VP; + getTriangle(VP, primitiveInd); + + refitBox.include(*VP.Vertex[0]); + refitBox.include(*VP.Vertex[1]); + refitBox.include(*VP.Vertex[2]); +} + +bool SourceMesh::isValid() const +{ + if(!mNbTris || !mNbVerts) return false; + if(!mVerts) return false; + if(!mTriangles32 && !mTriangles16) return false; + return true; +} + +///// + +BV4Tree::BV4Tree(SourceMesh* meshInterface, const PxBounds3& localBounds) +{ + reset(); + init(meshInterface, localBounds); +} + +BV4Tree::BV4Tree() +{ + reset(); +} + +void BV4Tree::release() +{ + if(!mUserAllocated) + { +#ifdef GU_BV4_USE_SLABS + PX_FREE(mNodes); +// PX_DELETE(mNodes); +#else + PX_DELETE_ARRAY(mNodes); +#endif + } + + mNodes = NULL; + mNbNodes = 0; + reset(); +} + +BV4Tree::~BV4Tree() +{ + release(); +} + +void BV4Tree::reset() +{ + mMeshInterface = NULL; + //mTetrahedronMeshInterface = NULL; + mNbNodes = 0; + mNodes = NULL; + mInitData = 0; + mCenterOrMinCoeff = PxVec3(0.0f); + mExtentsOrMaxCoeff = PxVec3(0.0f); + mUserAllocated = false; + mQuantized = false; + mIsEdgeSet = false; +} + +void BV4Tree::operator=(BV4Tree& v) +{ + mMeshInterface = v.mMeshInterface; + //mTetrahedronMeshInterface = v.mTetrahedronMeshInterface; + mLocalBounds = v.mLocalBounds; + mNbNodes = v.mNbNodes; + mNodes = v.mNodes; + mInitData = v.mInitData; + mCenterOrMinCoeff = v.mCenterOrMinCoeff; + mExtentsOrMaxCoeff = v.mExtentsOrMaxCoeff; + mUserAllocated = v.mUserAllocated; + mQuantized = v.mQuantized; + mIsEdgeSet = false; + v.reset(); +} + +bool BV4Tree::init(SourceMeshBase* meshInterface, const PxBounds3& localBounds) +{ + mMeshInterface = meshInterface; + mLocalBounds.init(localBounds); + return true; +} + +//bool BV4Tree::init(TetrahedronSourceMesh* meshInterface, const PxBounds3& localBounds) +//{ +// mTetrahedronMeshInterface = meshInterface; +// mLocalBounds.init(localBounds); +// return true; +//} + +// PX_SERIALIZATION +BV4Tree::BV4Tree(const PxEMPTY) : mLocalBounds(PxEmpty) +{ + mUserAllocated = true; + mIsEdgeSet = false; +} + +void BV4Tree::exportExtraData(PxSerializationContext& stream) +{ + if(mNbNodes) + { + stream.alignData(16); + const PxU32 nodeSize = mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + stream.writeData(mNodes, mNbNodes*nodeSize); + } +} + +void BV4Tree::importExtraData(PxDeserializationContext& context) +{ + if(mNbNodes) + { + context.alignExtraData(16); + if(mQuantized) + mNodes = context.readExtraData(mNbNodes); + else + mNodes = context.readExtraData(mNbNodes); + } +} +//~PX_SERIALIZATION + +bool BV4Tree::load(PxInputStream& stream, bool mismatch_) +{ + PX_ASSERT(!mUserAllocated); + + release(); + + PxI8 a, b, c, d; + readChunk(a, b, c, d, stream); + if(a!='B' || b!='V' || c!='4' || d!=' ') + return false; + + bool mismatch; + PxU32 fileVersion; + if(!readBigEndianVersionNumber(stream, mismatch_, fileVersion, mismatch)) + return false; + + readFloatBuffer(&mLocalBounds.mCenter.x, 3, mismatch, stream); + mLocalBounds.mExtentsMagnitude = readFloat(mismatch, stream); + + mInitData = readDword(mismatch, stream); + + readFloatBuffer(&mCenterOrMinCoeff.x, 3, mismatch, stream); + readFloatBuffer(&mExtentsOrMaxCoeff.x, 3, mismatch, stream); + + // PT: version 3 + if(fileVersion>=3) + { + const PxU32 Quantized = readDword(mismatch, stream); + mQuantized = Quantized!=0; + } + else + mQuantized = true; + + const PxU32 nbNodes = readDword(mismatch, stream); + mNbNodes = nbNodes; + + if(nbNodes) + { + PxU32 dataSize = 0; +#ifdef GU_BV4_USE_SLABS + const PxU32 nodeSize = mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + dataSize = nodeSize*nbNodes; + void* nodes = PX_ALLOC(dataSize, "BV4 nodes"); // PT: PX_NEW breaks alignment here +// BVDataPacked* nodes = reinterpret_cast(PX_ALLOC(sizeof(BVDataPacked)*nbNodes, "BV4 nodes")); // PT: PX_NEW breaks alignment here + mNodes = nodes; +#else + BVDataPacked* nodes = PX_NEW(BVDataPacked)[nbNodes]; + mNodes = nodes; +#endif +// PxMarkSerializedMemory(nodes, dataSize); + + stream.read(nodes, dataSize); + PX_ASSERT(!mismatch); + } + else mNodes = NULL; + + mIsEdgeSet = false; + + return true; +} + +#define VERSION2 +#ifdef VERSION1 +bool BV4Tree::refit(PxBounds3& globalBounds, float epsilon) +{ + if(mQuantized) + + if(!mNodes) + { + PxBounds3 bounds; + bounds.setEmpty(); + if(mMeshInterface) + { + PxU32 nbVerts = mMeshInterface->getNbVertices(); + const PxVec3* verts = mMeshInterface->getVerts(); + while(nbVerts--) + bounds.include(*verts++); + mLocalBounds.init(bounds); + } + if(mTetrahedronMeshInterface) + { + PX_ASSERT(0); + } + return true; + } + + class PxBounds3Padded : public PxBounds3 + { + public: + PX_FORCE_INLINE PxBounds3Padded() {} + PX_FORCE_INLINE ~PxBounds3Padded() {} + PxU32 padding; + }; + + PX_ASSERT(!(mNbNodes&3)); + PxU32 nb = mNbNodes/4; + BVDataSwizzledNQ* data = reinterpret_cast(mNodes); + while(nb--) + { + BVDataSwizzledNQ* PX_RESTRICT current = data + nb; + + for(PxU32 j=0;j<4;j++) + { + if(current->getChildData(j)==PX_INVALID_U32) + continue; + + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); + + if(current->isLeaf(j)) + { + PxU32 primIndex = current->getPrimitive(j); + + PxU32 nbToGo = getNbPrimitives(primIndex); + VertexPointers VP; + do + { + PX_ASSERT(primIndexgetNbTriangles()); + mMeshInterface->getTriangle(VP, primIndex); + + const Vec4V v0V = V4LoadU(&VP.Vertex[0]->x); + const Vec4V v1V = V4LoadU(&VP.Vertex[1]->x); + const Vec4V v2V = V4LoadU(&VP.Vertex[2]->x); + minV = V4Min(minV, v0V); + minV = V4Min(minV, v1V); + minV = V4Min(minV, v2V); + maxV = V4Max(maxV, v0V); + maxV = V4Max(maxV, v1V); + maxV = V4Max(maxV, v2V); + + primIndex++; + }while(nbToGo--); + + const Vec4V epsilonV = V4Load(epsilon); + minV = V4Sub(minV, epsilonV); + maxV = V4Add(maxV, epsilonV); + } + else + { + PxU32 childOffset = current->getChildOffset(j); + PX_ASSERT(!(childOffset&3)); + childOffset>>=2; + PX_ASSERT(childOffset>nb); + const PxU32 childType = current->getChildType(j); + + // PT: TODO: revisit SIMD here, not great + const BVDataSwizzledNQ* PX_RESTRICT next = data + childOffset; + { + { + const Vec4V childMinV = V4LoadXYZW(next->mMinX[0], next->mMinY[0], next->mMinZ[0], 0.0f); + const Vec4V childMaxV = V4LoadXYZW(next->mMaxX[0], next->mMaxY[0], next->mMaxZ[0], 0.0f); +// minV = V4Min(minV, childMinV); +// maxV = V4Max(maxV, childMaxV); + minV = childMinV; + maxV = childMaxV; + } + + { + const Vec4V childMinV = V4LoadXYZW(next->mMinX[1], next->mMinY[1], next->mMinZ[1], 0.0f); + const Vec4V childMaxV = V4LoadXYZW(next->mMaxX[1], next->mMaxY[1], next->mMaxZ[1], 0.0f); + minV = V4Min(minV, childMinV); + maxV = V4Max(maxV, childMaxV); + } + +/* { + const Vec4V childMinV0 = V4LoadXYZW(next->mMinX[0], next->mMinY[0], next->mMinZ[0], 0.0f); + const Vec4V childMaxV0 = V4LoadXYZW(next->mMaxX[0], next->mMaxY[0], next->mMaxZ[0], 0.0f); + const Vec4V childMinV1 = V4LoadXYZW(next->mMinX[1], next->mMinY[1], next->mMinZ[1], 0.0f); + const Vec4V childMaxV1 = V4LoadXYZW(next->mMaxX[1], next->mMaxY[1], next->mMaxZ[1], 0.0f); + minV = V4Min(childMinV0, childMinV1); + maxV = V4Max(childMaxV0, childMaxV1); + }*/ + + if(childType>0) + { + const Vec4V childMinV = V4LoadXYZW(next->mMinX[2], next->mMinY[2], next->mMinZ[2], 0.0f); + const Vec4V childMaxV = V4LoadXYZW(next->mMaxX[2], next->mMaxY[2], next->mMaxZ[2], 0.0f); + minV = V4Min(minV, childMinV); + maxV = V4Max(maxV, childMaxV); + } + + if(childType>1) + { + const Vec4V childMinV = V4LoadXYZW(next->mMinX[3], next->mMinY[3], next->mMinZ[3], 0.0f); + const Vec4V childMaxV = V4LoadXYZW(next->mMaxX[3], next->mMaxY[3], next->mMaxZ[3], 0.0f); + minV = V4Min(minV, childMinV); + maxV = V4Max(maxV, childMaxV); + } + } + } + + PxBounds3Padded refitBox; + V4StoreU_Safe(minV, &refitBox.minimum.x); + V4StoreU_Safe(maxV, &refitBox.maximum.x); + + current->mMinX[j] = refitBox.minimum.x; + current->mMinY[j] = refitBox.minimum.y; + current->mMinZ[j] = refitBox.minimum.z; + current->mMaxX[j] = refitBox.maximum.x; + current->mMaxY[j] = refitBox.maximum.y; + current->mMaxZ[j] = refitBox.maximum.z; + } + } + + BVDataSwizzledNQ* root = reinterpret_cast(mNodes); + { + globalBounds.setEmpty(); + + for(PxU32 j=0;j<4;j++) + { + if(root->getChildData(j)==PX_INVALID_U32) + continue; + + PxBounds3 refitBox; + refitBox.minimum.x = root->mMinX[j]; + refitBox.minimum.y = root->mMinY[j]; + refitBox.minimum.z = root->mMinZ[j]; + refitBox.maximum.x = root->mMaxX[j]; + refitBox.maximum.y = root->mMaxY[j]; + refitBox.maximum.z = root->mMaxZ[j]; + globalBounds.include(refitBox); + } + + mLocalBounds.init(globalBounds); + } + return true; +} +#endif + +#ifdef VERSION2 +bool BV4Tree::refit(PxBounds3& globalBounds, float epsilon) +{ + if(mQuantized) + return false; + + if(!mNodes) + { + globalBounds.setEmpty(); + if(mMeshInterface) + { + PxU32 nbVerts = mMeshInterface->getNbVertices(); + const PxVec3* verts = mMeshInterface->getVerts(); + while(nbVerts--) + globalBounds.include(*verts++); + mLocalBounds.init(globalBounds); + } + return true; + } + + class PxBounds3Padded : public PxBounds3 + { + public: + PX_FORCE_INLINE PxBounds3Padded() {} + PX_FORCE_INLINE ~PxBounds3Padded() {} + PxU32 padding; + }; + + PX_ASSERT(!(mNbNodes&3)); + PxU32 nb = mNbNodes/4; + BVDataSwizzledNQ* data = reinterpret_cast(mNodes); + + while(nb--) + { + BVDataSwizzledNQ* PX_RESTRICT current = data + nb; + + for(PxU32 j=0;j<4;j++) + { + if(current->getChildData(j)==PX_INVALID_U32) + continue; + + if(current->isLeaf(j)) + { + PxU32 primIndex = current->getPrimitive(j); + + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); + + PxU32 nbToGo = getNbPrimitives(primIndex); + //VertexPointers VP; + do + { + PX_ASSERT(primIndex< mMeshInterface->getNbPrimitives()); + + + //meshInterface->getTriangle(VP, primIndex); + Vec4V tMin, tMax; + mMeshInterface->getPrimitiveBox(primIndex, tMin, tMax); + minV = V4Min(minV, tMin); + maxV = V4Max(maxV, tMax); + + /* const Vec4V v0V = V4LoadU(&VP.Vertex[0]->x); + const Vec4V v1V = V4LoadU(&VP.Vertex[1]->x); + const Vec4V v2V = V4LoadU(&VP.Vertex[2]->x); + minV = V4Min(minV, v0V); + minV = V4Min(minV, v1V); + minV = V4Min(minV, v2V); + maxV = V4Max(maxV, v0V); + maxV = V4Max(maxV, v1V); + maxV = V4Max(maxV, v2V);*/ + + primIndex++; + }while(nbToGo--); + + const Vec4V epsilonV = V4Load(epsilon); + minV = V4Sub(minV, epsilonV); + maxV = V4Add(maxV, epsilonV); + + PxBounds3Padded refitBox; + V4StoreU_Safe(minV, &refitBox.minimum.x); + V4StoreU_Safe(maxV, &refitBox.maximum.x); + + current->mMinX[j] = refitBox.minimum.x; + current->mMinY[j] = refitBox.minimum.y; + current->mMinZ[j] = refitBox.minimum.z; + current->mMaxX[j] = refitBox.maximum.x; + current->mMaxY[j] = refitBox.maximum.y; + current->mMaxZ[j] = refitBox.maximum.z; + } + else + { + PxU32 childOffset = current->getChildOffset(j); + PX_ASSERT(!(childOffset&3)); + childOffset>>=2; + PX_ASSERT(childOffset>nb); + const PxU32 childType = current->getChildType(j); + + const BVDataSwizzledNQ* PX_RESTRICT next = data + childOffset; + { + current->mMinX[j] = PxMin(next->mMinX[0], next->mMinX[1]); + current->mMinY[j] = PxMin(next->mMinY[0], next->mMinY[1]); + current->mMinZ[j] = PxMin(next->mMinZ[0], next->mMinZ[1]); + current->mMaxX[j] = PxMax(next->mMaxX[0], next->mMaxX[1]); + current->mMaxY[j] = PxMax(next->mMaxY[0], next->mMaxY[1]); + current->mMaxZ[j] = PxMax(next->mMaxZ[0], next->mMaxZ[1]); + + if(childType>0) + { + current->mMinX[j] = PxMin(current->mMinX[j], next->mMinX[2]); + current->mMinY[j] = PxMin(current->mMinY[j], next->mMinY[2]); + current->mMinZ[j] = PxMin(current->mMinZ[j], next->mMinZ[2]); + current->mMaxX[j] = PxMax(current->mMaxX[j], next->mMaxX[2]); + current->mMaxY[j] = PxMax(current->mMaxY[j], next->mMaxY[2]); + current->mMaxZ[j] = PxMax(current->mMaxZ[j], next->mMaxZ[2]); + } + + if(childType>1) + { + current->mMinX[j] = PxMin(current->mMinX[j], next->mMinX[3]); + current->mMinY[j] = PxMin(current->mMinY[j], next->mMinY[3]); + current->mMinZ[j] = PxMin(current->mMinZ[j], next->mMinZ[3]); + current->mMaxX[j] = PxMax(current->mMaxX[j], next->mMaxX[3]); + current->mMaxY[j] = PxMax(current->mMaxY[j], next->mMaxY[3]); + current->mMaxZ[j] = PxMax(current->mMaxZ[j], next->mMaxZ[3]); + } + } + } + } + } + + BVDataSwizzledNQ* root = reinterpret_cast(mNodes); + { + globalBounds.setEmpty(); + + for(PxU32 j=0;j<4;j++) + { + if(root->getChildData(j)==PX_INVALID_U32) + continue; + + PxBounds3 refitBox; + refitBox.minimum.x = root->mMinX[j]; + refitBox.minimum.y = root->mMinY[j]; + refitBox.minimum.z = root->mMinZ[j]; + refitBox.maximum.x = root->mMaxX[j]; + refitBox.maximum.y = root->mMaxY[j]; + refitBox.maximum.z = root->mMaxZ[j]; + globalBounds.include(refitBox); + } + + mLocalBounds.init(globalBounds); + } + return true; +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.h new file mode 100644 index 0000000..a2156df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4.h @@ -0,0 +1,382 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_H +#define GU_BV4_H + +#include "foundation/PxBounds3.h" +#include "GuBV4Settings.h" +#include "GuCenterExtents.h" +#include "GuTriangle.h" +#include "foundation/PxVecMath.h" +#include "common/PxPhysXCommonConfig.h" + +#define V4LoadU_Safe physx::aos::V4LoadU // PT: prefix needed on Linux. Sigh. +#define V4LoadA_Safe V4LoadA +#define V4StoreA_Safe V4StoreA +#define V4StoreU_Safe V4StoreU + +namespace physx +{ + class PxSerializationContext; + class PxDeserializationContext; + +namespace Gu +{ + struct VertexPointers + { + const PxVec3* Vertex[3]; + }; + + struct TetrahedronPointers + { + const PxVec3* Vertex[4]; + }; + + // PT: TODO: make this more generic, rename to IndQuad32, refactor with GRB's int4 + class IndTetrahedron32 : public physx::PxUserAllocated + { + public: + public: + PX_FORCE_INLINE IndTetrahedron32() {} + PX_FORCE_INLINE IndTetrahedron32(PxU32 r0, PxU32 r1, PxU32 r2, PxU32 r3) { mRef[0] = r0; mRef[1] = r1; mRef[2] = r2; mRef[3] = r3; } + PX_FORCE_INLINE IndTetrahedron32(const IndTetrahedron32& tetrahedron) + { + mRef[0] = tetrahedron.mRef[0]; + mRef[1] = tetrahedron.mRef[1]; + mRef[2] = tetrahedron.mRef[2]; + mRef[3] = tetrahedron.mRef[3]; + } + PX_FORCE_INLINE ~IndTetrahedron32() {} + PxU32 mRef[4]; + }; + PX_COMPILE_TIME_ASSERT(sizeof(IndTetrahedron32) == 16); + + // PT: TODO: make this more generic, rename to IndQuad16 + class IndTetrahedron16 : public physx::PxUserAllocated + { + public: + public: + PX_FORCE_INLINE IndTetrahedron16() {} + PX_FORCE_INLINE IndTetrahedron16(PxU16 r0, PxU16 r1, PxU16 r2, PxU16 r3) { mRef[0] = r0; mRef[1] = r1; mRef[2] = r2; mRef[3] = r3; } + PX_FORCE_INLINE IndTetrahedron16(const IndTetrahedron16& tetrahedron) + { + mRef[0] = tetrahedron.mRef[0]; + mRef[1] = tetrahedron.mRef[1]; + mRef[2] = tetrahedron.mRef[2]; + mRef[3] = tetrahedron.mRef[3]; + } + PX_FORCE_INLINE ~IndTetrahedron16() {} + PxU16 mRef[4]; + }; + PX_COMPILE_TIME_ASSERT(sizeof(IndTetrahedron16) == 8); + + typedef IndexedTriangle32 IndTri32; + typedef IndexedTriangle16 IndTri16; + + PX_FORCE_INLINE void getVertexReferences(PxU32& vref0, PxU32& vref1, PxU32& vref2, PxU32 index, const IndTri32* T32, const IndTri16* T16) + { + if(T32) + { + const IndTri32* PX_RESTRICT tri = T32 + index; + vref0 = tri->mRef[0]; + vref1 = tri->mRef[1]; + vref2 = tri->mRef[2]; + } + else + { + const IndTri16* PX_RESTRICT tri = T16 + index; + vref0 = tri->mRef[0]; + vref1 = tri->mRef[1]; + vref2 = tri->mRef[2]; + } + } + + PX_FORCE_INLINE void getVertexReferences(PxU32& vref0, PxU32& vref1, PxU32& vref2, PxU32& vref3, PxU32 index, const IndTetrahedron32* T32, const IndTetrahedron16* T16) + { + if(T32) + { + const IndTetrahedron32* PX_RESTRICT tet = T32 + index; + vref0 = tet->mRef[0]; + vref1 = tet->mRef[1]; + vref2 = tet->mRef[2]; + vref3 = tet->mRef[3]; + } + else + { + const IndTetrahedron16* PX_RESTRICT tet = T16 + index; + vref0 = tet->mRef[0]; + vref1 = tet->mRef[1]; + vref2 = tet->mRef[2]; + vref3 = tet->mRef[3]; + } + } + + class SourceMeshBase : public physx::PxUserAllocated + { + public: + enum MeshType + { + TRI_MESH, + TET_MESH, + FORCE_DWORD = 0x7fffffff + }; + SourceMeshBase(MeshType meshType); + virtual ~SourceMeshBase(); + + SourceMeshBase(const PxEMPTY) {} + static void getBinaryMetaData(PxOutputStream& stream); + + PxU32 mNbVerts; + const PxVec3* mVerts; + + PX_FORCE_INLINE PxU32 getNbVertices() const { return mNbVerts; } + PX_FORCE_INLINE const PxVec3* getVerts() const { return mVerts; } + + PX_FORCE_INLINE void setNbVertices(PxU32 nb) { mNbVerts = nb; } + + PX_FORCE_INLINE void initRemap() { mRemap = NULL; } + PX_FORCE_INLINE const PxU32* getRemap() const { return mRemap; } + PX_FORCE_INLINE void releaseRemap() { PX_FREE(mRemap); } + + PX_FORCE_INLINE MeshType getMeshType() const { return mType; } + + // PT: TODO: check whether adding these vcalls affected build & runtime performance + virtual PxU32 getNbPrimitives() const = 0; + virtual void remapTopology(const PxU32* order) = 0; + virtual void getPrimitiveBox(const PxU32 primitiveInd, physx::aos::Vec4V& minV, physx::aos::Vec4V& maxV) = 0; + virtual void refit(const PxU32 primitiveInd, PxBounds3& refitBox) = 0; + + protected: + MeshType mType; + PxU32* mRemap; + }; + + class SourceMesh : public SourceMeshBase + { + public: + SourceMesh(); + virtual ~SourceMesh(); + // PX_SERIALIZATION + SourceMesh(const PxEMPTY) : SourceMeshBase(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + void reset(); + void operator = (SourceMesh& v); + + PxU32 mNbTris; + IndTri32* mTriangles32; + IndTri16* mTriangles16; + + PX_FORCE_INLINE PxU32 getNbTriangles() const { return mNbTris; } + PX_FORCE_INLINE const IndTri32* getTris32() const { return mTriangles32; } + PX_FORCE_INLINE const IndTri16* getTris16() const { return mTriangles16; } + + PX_FORCE_INLINE void setNbTriangles(PxU32 nb) { mNbTris = nb; } + + // SourceMeshBase + virtual PxU32 getNbPrimitives() const { return getNbTriangles(); } + virtual void remapTopology(const PxU32* order); + virtual void getPrimitiveBox(const PxU32 primitiveInd, physx::aos::Vec4V& minV, physx::aos::Vec4V& maxV); + virtual void refit(const PxU32 primitiveInd, PxBounds3& refitBox); + //~SourceMeshBase + + PX_FORCE_INLINE void setPointers(IndTri32* tris32, IndTri16* tris16, const PxVec3* verts) + { + mTriangles32 = tris32; + mTriangles16 = tris16; + mVerts = verts; + } + + bool isValid() const; + + PX_FORCE_INLINE void getTriangle(VertexPointers& vp, PxU32 index) const + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, index, mTriangles32, mTriangles16); + vp.Vertex[0] = mVerts + VRef0; + vp.Vertex[1] = mVerts + VRef1; + vp.Vertex[2] = mVerts + VRef2; + } + }; + + class TetrahedronSourceMesh : public SourceMeshBase + { + public: + TetrahedronSourceMesh(); + virtual ~TetrahedronSourceMesh(); + // PX_SERIALIZATION + TetrahedronSourceMesh(const PxEMPTY) : SourceMeshBase(TET_MESH) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + void reset(); + void operator = (TetrahedronSourceMesh& v); + + PxU32 mNbTetrahedrons; + IndTetrahedron32* mTetrahedrons32; + IndTetrahedron16* mTetrahedrons16; + + PX_FORCE_INLINE PxU32 getNbTetrahedrons() const { return mNbTetrahedrons; } + PX_FORCE_INLINE const IndTetrahedron32* getTetrahedrons32() const { return mTetrahedrons32; } + PX_FORCE_INLINE const IndTetrahedron16* getTetrahedrons16() const { return mTetrahedrons16; } + + PX_FORCE_INLINE void setNbTetrahedrons(PxU32 nb) { mNbTetrahedrons = nb; } + + // SourceMeshBase + virtual PxU32 getNbPrimitives() const { return getNbTetrahedrons(); } + virtual void remapTopology(const PxU32* order); + virtual void getPrimitiveBox(const PxU32 primitiveInd, physx::aos::Vec4V& minV, physx::aos::Vec4V& maxV); + virtual void refit(const PxU32 primitiveInd, PxBounds3& refitBox); + //~SourceMeshBase + + PX_FORCE_INLINE void setPointers(IndTetrahedron32* tets32, IndTetrahedron16* tets16, const PxVec3* verts) + { + mTetrahedrons32 = tets32; + mTetrahedrons16 = tets16; + mVerts = verts; + } + + bool isValid() const; + + PX_FORCE_INLINE void getTetrahedron(TetrahedronPointers& vp, PxU32 index) const + { + PxU32 VRef0, VRef1, VRef2, VRef3; + getVertexReferences(VRef0, VRef1, VRef2, VRef3, index, mTetrahedrons32, mTetrahedrons16); + vp.Vertex[0] = mVerts + VRef0; + vp.Vertex[1] = mVerts + VRef1; + vp.Vertex[2] = mVerts + VRef2; + vp.Vertex[3] = mVerts + VRef3; + } + }; + + struct LocalBounds + { + // PX_SERIALIZATION + LocalBounds(const PxEMPTY) {} + //~PX_SERIALIZATION + LocalBounds() : mCenter(PxVec3(0.0f)), mExtentsMagnitude(0.0f) {} + + PxVec3 mCenter; + float mExtentsMagnitude; + + PX_FORCE_INLINE void init(const PxBounds3& bounds) + { + mCenter = bounds.getCenter(); + // PT: TODO: compute mag first, then multiplies by 0.5f (TA34704) + mExtentsMagnitude = bounds.getExtents().magnitude(); + } + }; + + class QuantizedAABB + { + public: + + struct Data + { + PxU16 mExtents; //!< Quantized extents + PxI16 mCenter; //!< Quantized center + }; + Data mData[3]; + }; + PX_COMPILE_TIME_ASSERT(sizeof(QuantizedAABB)==12); + + ///// + + #define GU_BV4_CHILD_OFFSET_SHIFT_COUNT 11 + static PX_FORCE_INLINE PxU32 getChildOffset(PxU32 data) { return data>>GU_BV4_CHILD_OFFSET_SHIFT_COUNT; } + static PX_FORCE_INLINE PxU32 getChildType(PxU32 data) { return (data>>1)&3; } + + template + struct BVDataPackedT + { + BoxType mAABB; + PxU32 mData; + + PX_FORCE_INLINE PxU32 isLeaf() const { return mData&1; } + PX_FORCE_INLINE PxU32 getPrimitive() const { return mData>>1; } + PX_FORCE_INLINE PxU32 getChildOffset() const { return mData>>GU_BV4_CHILD_OFFSET_SHIFT_COUNT;} + PX_FORCE_INLINE PxU32 getChildType() const { return (mData>>1)&3; } + PX_FORCE_INLINE PxU32 getChildData() const { return mData; } + + PX_FORCE_INLINE void encodePNS(PxU32 code) + { + PX_ASSERT(code<256); + mData |= code<<3; + } + PX_FORCE_INLINE PxU32 decodePNSNoShift() const { return mData; } + }; + + typedef BVDataPackedT BVDataPackedQ; + typedef BVDataPackedT BVDataPackedNQ; + + // PT: TODO: align class to 16? (TA34704) + class BV4Tree : public physx::PxUserAllocated + { + public: + // PX_SERIALIZATION + BV4Tree(const PxEMPTY); + void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + BV4Tree(); + BV4Tree(SourceMesh* meshInterface, const PxBounds3& localBounds); + ~BV4Tree(); + + bool refit(PxBounds3& globalBounds, float epsilon); + + bool load(PxInputStream& stream, bool mismatch); + + void reset(); + void operator = (BV4Tree& v); + + bool init(SourceMeshBase* meshInterface, const PxBounds3& localBounds); + void release(); + + SourceMeshBase* mMeshInterface; + + LocalBounds mLocalBounds; + + PxU32 mNbNodes; + void* mNodes; // PT: BVDataPacked / BVDataSwizzled + PxU32 mInitData; + // PT: the dequantization coeffs are only used for quantized trees + PxVec3 mCenterOrMinCoeff; // PT: dequantization coeff, either for Center or Min (depending on AABB format) + PxVec3 mExtentsOrMaxCoeff; // PT: dequantization coeff, either for Extents or Max (depending on AABB format) + bool mUserAllocated; // PT: please keep these 4 bytes right after mCenterOrMinCoeff/mExtentsOrMaxCoeff for safe V4 loading + bool mQuantized; // PT: true for quantized trees + bool mIsEdgeSet; // PT: equivalent to RTree::IS_EDGE_SET + bool mPadding; + }; + +} // namespace Gu +} + +#endif // GU_BV4_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp new file mode 100644 index 0000000..bfa68b8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Build.cpp @@ -0,0 +1,1818 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxVec4.h" +#include "foundation/PxMemory.h" +#include "GuAABBTreeBuildStats.h" +#include "GuAABBTree.h" +#include "GuSAH.h" +#include "GuBounds.h" +#include "GuBV4Build.h" +#include "GuBV4.h" +#include + +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#define GU_BV4_USE_NODE_POOLS + +static PX_FORCE_INLINE PxU32 largestAxis(const PxVec4& v) +{ + const float* Vals = &v.x; + PxU32 m = 0; + if(Vals[1] > Vals[m]) m = 1; + if(Vals[2] > Vals[m]) m = 2; + return m; +} + +BV4_AABBTree::BV4_AABBTree() : mIndices(NULL), mPool(NULL), mTotalNbNodes(0) +{ +} + +BV4_AABBTree::~BV4_AABBTree() +{ + release(); +} + +void BV4_AABBTree::release() +{ + PX_DELETE_ARRAY(mPool); + PX_FREE(mIndices); +} + +namespace +{ + struct BuildParams + { + PX_FORCE_INLINE BuildParams(const PxBounds3* boxes, const PxVec3* centers, const AABBTreeNode* const node_base, const PxU32 limit, const SourceMesh* mesh) : + mBoxes(boxes), mCenters(centers), mNodeBase(node_base), mLimit(limit), mMesh(mesh) {} + + const PxBounds3* mBoxes; + const PxVec3* mCenters; + const AABBTreeNode* const mNodeBase; + const PxU32 mLimit; + const SourceMesh* mMesh; + PX_NOCOPY(BuildParams) + }; +} + +static PxU32 local_Split(const AABBTreeNode* PX_RESTRICT node, const PxBounds3* PX_RESTRICT /*Boxes*/, const PxVec3* PX_RESTRICT centers, PxU32 axis, const BuildParams& params) +{ + const PxU32 nb = node->mNbPrimitives; + PxU32* PX_RESTRICT prims = node->mNodePrimitives; + + // Get node split value + float splitValue = 0.0f; + if(params.mMesh) + { + VertexPointers VP; + for(PxU32 i=0;igetTriangle(VP, prims[i]); + splitValue += (*VP.Vertex[0])[axis]; + splitValue += (*VP.Vertex[1])[axis]; + splitValue += (*VP.Vertex[2])[axis]; + } + splitValue /= float(nb*3); + } + else + splitValue = node->mBV.getCenter(axis); + + return reshuffle(nb, prims, centers, splitValue, axis); +} + +static bool local_Subdivide(AABBTreeNode* PX_RESTRICT node, BuildStats& stats, const BuildParams& params) +{ + const PxU32* PX_RESTRICT prims = node->mNodePrimitives; + const PxU32 nb = node->mNbPrimitives; + + const PxBounds3* PX_RESTRICT boxes = params.mBoxes; + const PxVec3* PX_RESTRICT centers = params.mCenters; + + // Compute bv & means at the same time + Vec4V meansV; + { + Vec4V minV = V4LoadU(&boxes[prims[0]].minimum.x); + Vec4V maxV = V4LoadU(&boxes[prims[0]].maximum.x); + meansV = V4LoadU(¢ers[prims[0]].x); + + for(PxU32 i=1;imBV.minimum = PxVec3(mergedMin.x, mergedMin.y, mergedMin.z); + node->mBV.maximum = PxVec3(mergedMax.x, mergedMax.y, mergedMax.z); + } + +#ifndef GU_BV4_FILL_GAPS +// // Stop subdividing if we reach a leaf node. This is always performed here, +// // else we could end in trouble if user overrides this. +// if(nb==1) +// return false; + if(nb<=params.mLimit) + return false; +#endif + + bool validSplit = true; + PxU32 nbPos; + { + // Compute variances + Vec4V varsV = V4Zero(); + for(PxU32 i=0;ilimit) + { + nbPos = node->mNbPrimitives>>1; + + if(1) + { + // Test 3 axes, take the best + float results[3]; + nbPos = local_Split(node, boxes, centers, 0, params); results[0] = float(nbPos)/float(node->mNbPrimitives); + nbPos = local_Split(node, boxes, centers, 1, params); results[1] = float(nbPos)/float(node->mNbPrimitives); + nbPos = local_Split(node, boxes, centers, 2, params); results[2] = float(nbPos)/float(node->mNbPrimitives); + results[0]-=0.5f; results[0]*=results[0]; + results[1]-=0.5f; results[1]*=results[1]; + results[2]-=0.5f; results[2]*=results[2]; + PxU32 Min=0; + if(results[1]mNbPrimitives) + nbPos = node->mNbPrimitives>>1; + } + } + //else return + } + +#ifdef GU_BV4_FILL_GAPS + // We split the node a last time before returning when we're below the limit, for the "fill the gaps" strategy + if(nb<=params.mLimit) + { + node->mNextSplit = nbPos; + return false; + } +#endif + + // Now create children and assign their pointers. + // We use a pre-allocated linear pool for complete trees [Opcode 1.3] + const PxU32 count = stats.getCount(); + node->mPos = size_t(params.mNodeBase + count); + + // Update stats + stats.increaseCount(2); + + // Assign children + AABBTreeNode* pos = const_cast(node->getPos()); + AABBTreeNode* neg = const_cast(node->getNeg()); + pos->mNodePrimitives = node->mNodePrimitives; + pos->mNbPrimitives = nbPos; + neg->mNodePrimitives = node->mNodePrimitives + nbPos; + neg->mNbPrimitives = node->mNbPrimitives - nbPos; + return true; +} + +static bool local_Subdivide_SAH(AABBTreeNode* PX_RESTRICT node, BuildStats& stats, const BuildParams& params, SAH_Buffers& buffers) +{ + const PxU32* prims = node->mNodePrimitives; + const PxU32 nb = node->mNbPrimitives; + + const PxBounds3* PX_RESTRICT boxes = params.mBoxes; + const PxVec3* PX_RESTRICT centers = params.mCenters; + + // Compute bv + computeGlobalBox(node->mBV, nb, boxes, prims); + +#ifndef GU_BV4_FILL_GAPS +// // Stop subdividing if we reach a leaf node. This is always performed here, +// // else we could end in trouble if user overrides this. +// if(nb==1) +// return false; + if(nb<=params.mLimit) + return false; +#endif + + PxU32 leftCount; + if(!buffers.split(leftCount, nb, prims, boxes, centers)) + { + // Invalid split => fallback to previous strategy + return local_Subdivide(node, stats, params); + } + +#ifdef GU_BV4_FILL_GAPS + // We split the node a last time before returning when we're below the limit, for the "fill the gaps" strategy + if(nb<=params.mLimit) + { + node->mNextSplit = leftCount; + return false; + } +#endif + + // Now create children and assign their pointers. + // We use a pre-allocated linear pool for complete trees [Opcode 1.3] + const PxU32 count = stats.getCount(); + node->mPos = size_t(params.mNodeBase + count); + + // Update stats + stats.increaseCount(2); + + // Assign children + AABBTreeNode* pos = const_cast(node->getPos()); + AABBTreeNode* neg = const_cast(node->getNeg()); + pos->mNodePrimitives = node->mNodePrimitives; + pos->mNbPrimitives = leftCount; + neg->mNodePrimitives = node->mNodePrimitives + leftCount; + neg->mNbPrimitives = node->mNbPrimitives - leftCount; + return true; +} + +// PT: TODO: consider local_BuildHierarchy & local_BuildHierarchy_SAH + +static void local_BuildHierarchy(AABBTreeNode* PX_RESTRICT node, BuildStats& stats, const BuildParams& params) +{ + if(local_Subdivide(node, stats, params)) + { + AABBTreeNode* pos = const_cast(node->getPos()); + AABBTreeNode* neg = const_cast(node->getNeg()); + local_BuildHierarchy(pos, stats, params); + local_BuildHierarchy(neg, stats, params); + } +} + +static void local_BuildHierarchy_SAH(AABBTreeNode* PX_RESTRICT node, BuildStats& stats, const BuildParams& params, SAH_Buffers& buffers) +{ + if(local_Subdivide_SAH(node, stats, params, buffers)) + { + AABBTreeNode* pos = const_cast(node->getPos()); + AABBTreeNode* neg = const_cast(node->getNeg()); + local_BuildHierarchy_SAH(pos, stats, params, buffers); + local_BuildHierarchy_SAH(neg, stats, params, buffers); + } +} + +bool BV4_AABBTree::buildFromMesh(SourceMeshBase& mesh, PxU32 limit, BV4_BuildStrategy strategy) +{ + const PxU32 nbBoxes = mesh.getNbPrimitives(); + if(!nbBoxes) + return false; + PxBounds3* boxes = PX_ALLOCATE(PxBounds3, (nbBoxes + 1), "BV4"); // PT: +1 to safely V4Load/V4Store the last element + PxVec3* centers = PX_ALLOCATE(PxVec3, (nbBoxes + 1), "BV4"); // PT: +1 to safely V4Load/V4Store the last element + const FloatV halfV = FLoad(0.5f); + for (PxU32 i = 0; imNodePrimitives = mIndices; + mPool->mNbPrimitives = nbBoxes; + + // Build the hierarchy + if(strategy==BV4_SPLATTER_POINTS||strategy==BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER) + { + // PT: not sure what the equivalent would be for tet-meshes here + SourceMesh* triMesh = NULL; + if(strategy==BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER) + { + if(mesh.getMeshType()==SourceMeshBase::TRI_MESH) + triMesh = static_cast(&mesh); + } + local_BuildHierarchy(mPool, Stats, BuildParams(boxes, centers, mPool, limit, triMesh)); + } + else if(strategy==BV4_SAH) + { + SAH_Buffers sah(nbBoxes); + local_BuildHierarchy_SAH(mPool, Stats, BuildParams(boxes, centers, mPool, limit, NULL), sah); + } + else + return false; + + // Get back total number of nodes + mTotalNbNodes = Stats.getCount(); + } + + PX_FREE(centers); + PX_FREE(boxes); + + if(0) + printf("Tree depth: %d\n", walk(NULL, NULL)); + + return true; +} + +PxU32 BV4_AABBTree::walk(WalkingCallback cb, void* userData) const +{ + // Call it without callback to compute max depth + PxU32 maxDepth = 0; + PxU32 currentDepth = 0; + + struct Local + { + static void _walk(const AABBTreeNode* current_node, PxU32& max_depth, PxU32& current_depth, WalkingCallback callback, void* userData_) + { + // Checkings + if(!current_node) + return; + // Entering a new node => increase depth + current_depth++; + // Keep track of max depth + if(current_depth>max_depth) + max_depth = current_depth; + + // Callback + if(callback && !(callback)(current_node, current_depth, userData_)) + return; + + // Recurse + if(current_node->getPos()) { _walk(current_node->getPos(), max_depth, current_depth, callback, userData_); current_depth--; } + if(current_node->getNeg()) { _walk(current_node->getNeg(), max_depth, current_depth, callback, userData_); current_depth--; } + } + }; + Local::_walk(mPool, maxDepth, currentDepth, cb, userData); + return maxDepth; +} + +PxU32 BV4_AABBTree::walkDistance(WalkingCallback cb, WalkingDistanceCallback cb2, void* userData) const +{ + // Call it without callback to compute max depth + PxU32 maxDepth = 0; + PxU32 currentDepth = 0; + + struct Local + { + static void _walk(const AABBTreeNode* current_node, PxU32& max_depth, PxU32& current_depth, WalkingCallback callback, WalkingDistanceCallback distanceCheck, void* userData_) + { + // Checkings + if (!current_node) + return; + // Entering a new node => increase depth + current_depth++; + // Keep track of max depth + if (current_depth > max_depth) + max_depth = current_depth; + + // Callback + if (callback && !(callback)(current_node, current_depth, userData_)) + return; + + // Recurse + bool posHint = distanceCheck && (distanceCheck)(current_node, userData_); + if (posHint) + { + if (current_node->getPos()) { _walk(current_node->getPos(), max_depth, current_depth, callback, distanceCheck, userData_); current_depth--; } + if (current_node->getNeg()) { _walk(current_node->getNeg(), max_depth, current_depth, callback, distanceCheck, userData_); current_depth--; } + } + else + { + if (current_node->getNeg()) { _walk(current_node->getNeg(), max_depth, current_depth, callback, distanceCheck, userData_); current_depth--; } + if (current_node->getPos()) { _walk(current_node->getPos(), max_depth, current_depth, callback, distanceCheck, userData_); current_depth--; } + } + } + }; + Local::_walk(mPool, maxDepth, currentDepth, cb, cb2, userData); + return maxDepth; +} + + + +#include "GuBV4_Internal.h" + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT +// PT: see http://www.codercorner.com/blog/?p=734 +static PxU32 precomputeNodeSorting(const PxBounds3& box0, const PxBounds3& box1) +{ + const PxVec3 C0 = box0.getCenter(); + const PxVec3 C1 = box1.getCenter(); + + PxVec3 dirPPP(1.0f, 1.0f, 1.0f); dirPPP.normalize(); + PxVec3 dirPPN(1.0f, 1.0f, -1.0f); dirPPN.normalize(); + PxVec3 dirPNP(1.0f, -1.0f, 1.0f); dirPNP.normalize(); + PxVec3 dirPNN(1.0f, -1.0f, -1.0f); dirPNN.normalize(); + PxVec3 dirNPP(-1.0f, 1.0f, 1.0f); dirNPP.normalize(); + PxVec3 dirNPN(-1.0f, 1.0f, -1.0f); dirNPN.normalize(); + PxVec3 dirNNP(-1.0f, -1.0f, 1.0f); dirNNP.normalize(); + PxVec3 dirNNN(-1.0f, -1.0f, -1.0f); dirNNN.normalize(); + + const PxVec3 deltaC = C0 - C1; + const bool bPPP = deltaC.dot(dirPPP)<0.0f; + const bool bPPN = deltaC.dot(dirPPN)<0.0f; + const bool bPNP = deltaC.dot(dirPNP)<0.0f; + const bool bPNN = deltaC.dot(dirPNN)<0.0f; + const bool bNPP = deltaC.dot(dirNPP)<0.0f; + const bool bNPN = deltaC.dot(dirNPN)<0.0f; + const bool bNNP = deltaC.dot(dirNNP)<0.0f; + const bool bNNN = deltaC.dot(dirNNN)<0.0f; + + PxU32 code = 0; + if(!bPPP) + code |= (1<<7); // Bit 0: PPP + if(!bPPN) + code |= (1<<6); // Bit 1: PPN + if(!bPNP) + code |= (1<<5); // Bit 2: PNP + if(!bPNN) + code |= (1<<4); // Bit 3: PNN + if(!bNPP) + code |= (1<<3); // Bit 4: NPP + if(!bNPN) + code |= (1<<2); // Bit 5: NPN + if(!bNNP) + code |= (1<<1); // Bit 6: NNP + if(!bNNN) + code |= (1<<0); // Bit 7: NNN + return code; +} +#endif + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Common.h" +#endif + +// PT: warning, not the same as CenterExtents::setEmpty() +static void setEmpty(CenterExtents& box) +{ + box.mCenter = PxVec3(0.0f, 0.0f, 0.0f); + box.mExtents = PxVec3(-1.0f, -1.0f, -1.0f); +} + +// Data: +// 1 bit for leaf/no leaf +// 2 bits for child-node type +// 8 bits for PNS +// => 32 - 1 - 2 - 8 = 21 bits left for encoding triangle index or node *offset* +// => limited to 2.097.152 triangles +// => and 2Mb-large trees (this one may not work out well in practice) +// ==> lines marked with //* have been changed to address this. Now we don't store offsets in bytes directly +// but in BVData indices. There's more work at runtime calculating addresses, but now the format can support +// 2 million single nodes. +// +// That being said we only need 3*8 = 24 bits in total, so that could be only 6 bits in each BVData. +// For type0: we have 2 nodes, we need 8 bits => 6 bits/node = 12 bits available, ok +// For type1: we have 3 nodes, we need 8*2 = 16 bits => 6 bits/node = 18 bits available, ok +// For type2: we have 4 nodes, we need 8*3 = 24 bits => 6 bits/node = 24 bits available, ok +//#pragma pack(1) +struct BVData : public physx::PxUserAllocated +{ + BVData(); + CenterExtents mAABB; + size_t mData; +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + PxU32 mTempPNS; +#endif +}; +//#pragma pack() + +BVData::BVData() : mData(PX_INVALID_U32) +{ + setEmpty(mAABB); +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + mTempPNS = 0; +#endif +} + +struct BV4Node : public physx::PxUserAllocated +{ + PX_FORCE_INLINE BV4Node() {} + PX_FORCE_INLINE ~BV4Node() {} + + BVData mBVData[4]; + + PX_FORCE_INLINE size_t isLeaf(PxU32 i) const { return mBVData[i].mData&1; } + PX_FORCE_INLINE PxU32 getPrimitive(PxU32 i) const { return PxU32(mBVData[i].mData>>1); } + PX_FORCE_INLINE const BV4Node* getChild(PxU32 i) const { return reinterpret_cast(mBVData[i].mData); } + + PxU32 getType() const + { + PxU32 Nb=0; + for(PxU32 i=0;i<4;i++) + { + if(mBVData[i].mData!=PX_INVALID_U32) + Nb++; + } + return Nb; + } + + PxU32 getSize() const + { + const PxU32 type = getType(); + return sizeof(BVData)*type; + } +}; + +#define NB_NODES_PER_SLAB 256 +struct BV4BuildParams +{ + PX_FORCE_INLINE BV4BuildParams(const BV4_AABBTree& source, const SourceMesh* mesh, float epsilon) : mSource(source), mMesh(mesh), mEpsilon(epsilon) +#ifdef GU_BV4_USE_NODE_POOLS + ,mTop(NULL) +#endif + {} + ~BV4BuildParams(); + + const BV4_AABBTree& mSource; + const SourceMesh* mMesh; + + // Stats + PxU32 mNbNodes; + PxU32 mStats[4]; + + // + float mEpsilon; + +#ifdef GU_BV4_USE_NODE_POOLS + // + struct Slab : public physx::PxUserAllocated + { + BV4Node mNodes[NB_NODES_PER_SLAB]; + PxU32 mNbUsedNodes; + Slab* mNext; + }; + Slab* mTop; + + BV4Node* allocateNode(); + void releaseNodes(); +#endif + + PX_NOCOPY(BV4BuildParams) +}; + +BV4BuildParams::~BV4BuildParams() +{ +#ifdef GU_BV4_USE_NODE_POOLS + releaseNodes(); +#endif +} + +#ifdef GU_BV4_USE_NODE_POOLS +BV4Node* BV4BuildParams::allocateNode() +{ + if(!mTop || mTop->mNbUsedNodes==NB_NODES_PER_SLAB) + { + Slab* newSlab = PX_NEW(Slab); + newSlab->mNbUsedNodes = 0; + newSlab->mNext = mTop; + mTop = newSlab; + } + return &mTop->mNodes[mTop->mNbUsedNodes++]; +} + +void BV4BuildParams::releaseNodes() +{ + Slab* current = mTop; + while(current) + { + Slab* next = current->mNext; + PX_DELETE(current); + current = next; + } + mTop = NULL; +} +#endif + +static PX_FORCE_INLINE void setupBounds(BV4Node* node4, PxU32 i, const AABBTreeNode* node, float epsilon) +{ + node4->mBVData[i].mAABB = node->getAABB(); + if(epsilon!=0.0f) + node4->mBVData[i].mAABB.mExtents += PxVec3(epsilon); +} + +static void setPrimitive(const BV4_AABBTree& source, BV4Node* node4, PxU32 i, const AABBTreeNode* node, float epsilon) +{ + const PxU32 nbPrims = node->getNbPrimitives(); + PX_ASSERT(nbPrims<16); + const PxU32* indexBase = source.getIndices(); + const PxU32* prims = node->getPrimitives(); + const PxU32 offset = PxU32(prims - indexBase); + for(PxU32 j=0;jmBVData[i].mData = (primitiveIndex<<1)|1; +} + +#ifdef GU_BV4_FILL_GAPS +static bool splitPrimitives(const BV4BuildParams& params, BV4Node* node4, PxU32 i, const AABBTreeNode* node) +{ + if(!params.mMesh) + return false; + + const PxU32 nbPrims = node->getNbPrimitives(); + PX_ASSERT(nbPrims<16); + if(nbPrims<2) + return false; + + const PxU32* indexBase = params.mSource.getIndices(); + const PxU32* prims = node->getPrimitives(); + PxU32 offset = PxU32(prims - indexBase); + + // In theory we should reshuffle the list but it would mean updating the remap table again. + // A way to avoid that would be to virtually split & sort the triangles directly in the BV2 + // source tree, before the initial remap table is created. + + //const PxU32 splitPrims = NbPrims/2; // ### actually should be the number in the last split in bv2 + const PxU32 splitPrims = node->mNextSplit; + PxU32 j=0; + for(PxU32 ii=0;ii<2;ii++) + { + const PxU32 currentNb = ii==0 ? splitPrims : (nbPrims-splitPrims); + + PxBounds3 bounds = PxBounds3::empty(); + for(PxU32 k=0;kgetTris32(), params.mMesh->getTris16()); + + // PT: TODO: SIMD + const PxVec3* verts = params.mMesh->getVerts(); + bounds.include(verts[vref0]); + bounds.include(verts[vref1]); + bounds.include(verts[vref2]); + + j++; + } + PX_ASSERT(bounds.isInside(node->mBV)); + const PxU32 primitiveIndex = (offset<<4)|(currentNb&15); + +// SetupBounds(node4, i, node, context.mEpsilon); + node4->mBVData[i+ii].mAABB = bounds; + if(params.mEpsilon!=0.0f) + node4->mBVData[i+ii].mAABB.mExtents += PxVec3(params.mEpsilon); + + node4->mBVData[i+ii].mData = (primitiveIndex<<1)|1; + + offset += currentNb; + } + return true; +} +#endif + +static BV4Node* setNode(const BV4_AABBTree& source, BV4Node* node4, PxU32 i, const AABBTreeNode* node, BV4BuildParams& params) +{ + BV4Node* child = NULL; + if(node->isLeaf()) + { + setPrimitive(source, node4, i, node, params.mEpsilon); + } + else + { + setupBounds(node4, i, node, params.mEpsilon); + + params.mNbNodes++; +#ifdef GU_BV4_USE_NODE_POOLS + child = params.allocateNode(); +#else + child = PX_NEW(BV4Node); +#endif + node4->mBVData[i].mData = size_t(child); + } + return child; +} + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT +static inline PxBounds3 getMinMaxBox(const CenterExtents& box) +{ + if(box.mExtents.x>=0.0f && box.mExtents.y>=0.0f && box.mExtents.z>=0.0f) +// if(!box.isEmpty()) // ### asserts! + return PxBounds3::centerExtents(box.mCenter, box.mExtents); + else + return PxBounds3::empty(); +} + +static void FigureOutPNS(BV4Node* node) +{ + // ____A____ + // P N + // __|__ __|__ + // PP PN NP NN + + const CenterExtents& box0 = node->mBVData[0].mAABB; + const CenterExtents& box1 = node->mBVData[1].mAABB; + const CenterExtents& box2 = node->mBVData[2].mAABB; + const CenterExtents& box3 = node->mBVData[3].mAABB; + + // PT: TODO: SIMD, optimize + const PxBounds3 boxPP = getMinMaxBox(box0); + const PxBounds3 boxPN = getMinMaxBox(box1); + const PxBounds3 boxNP = getMinMaxBox(box2); + const PxBounds3 boxNN = getMinMaxBox(box3); + + PxBounds3 boxP = boxPP; boxP.include(boxPN); + PxBounds3 boxN = boxNP; boxN.include(boxNN); + + node->mBVData[0].mTempPNS = precomputeNodeSorting(boxP, boxN); + node->mBVData[1].mTempPNS = precomputeNodeSorting(boxPP, boxPN); + node->mBVData[2].mTempPNS = precomputeNodeSorting(boxNP, boxNN); +} +#endif + +/*static bool hasTwoLeafChildren(const AABBTreeNode* current_node) +{ + if(current_node->isLeaf()) + return false; + const AABBTreeNode* P = current_node->getPos(); + const AABBTreeNode* N = current_node->getNeg(); + return P->isLeaf() && N->isLeaf(); +}*/ + +static void buildBV4(const BV4_AABBTree& source, BV4Node* tmp, const AABBTreeNode* current_node, BV4BuildParams& params) +{ + PX_ASSERT(!current_node->isLeaf()); + + // In the regular tree we have current node A, and: + // ____A____ + // P N + // __|__ __|__ + // PP PN NP NN + // + // For PNS we have: + // bit0 to sort P|N + // bit1 to sort PP|PN + // bit2 to sort NP|NN + // + // As much as possible we need to preserve the original order in BV4, if we want to reuse the same PNS bits. + // + // bit0|bit1|bit2 Order 8bits code + // 0 0 0 PP PN NP NN 0 1 2 3 + // 0 0 1 PP PN NN NP 0 1 3 2 + // 0 1 0 PN PP NP NN 1 0 2 3 + // 0 1 1 PN PP NN NP 1 0 3 2 + // 1 0 0 NP NN PP PN 2 3 0 1 + // 1 0 1 NN NP PP PN 3 2 0 1 + // 1 1 0 NP NN PN PP 2 3 1 0 + // 1 1 1 NN NP PN PP 3 2 1 0 + // + // So we can fetch/compute the sequence from the bits, combine it with limitations from the node type, and process the nodes in order. In theory. + // 8*8bits => the whole thing fits in a single 64bit register, so we could potentially use a "register LUT" here. + + const AABBTreeNode* P = current_node->getPos(); + const AABBTreeNode* N = current_node->getNeg(); + + const bool PLeaf = P->isLeaf(); + const bool NLeaf = N->isLeaf(); + + if(PLeaf) + { + if(NLeaf) + { + // Case 1: P and N are both leaves: + // ____A____ + // P N + // => store as (P,N) and keep bit0 +#ifndef GU_BV4_FILL_GAPS + params.mStats[0]++; + // PN leaves => store 2 triangle pointers, lose 50% of node space + setPrimitive(source, tmp, 0, P, params.mEpsilon); + setPrimitive(source, tmp, 1, N, params.mEpsilon); +#else + { + PxU32 nextIndex = 2; + if(!splitPrimitives(params, tmp, 0, P)) + { + setPrimitive(source, tmp, 0, P, params.mEpsilon); + nextIndex = 1; + } + + if(!splitPrimitives(params, tmp, nextIndex, N)) + setPrimitive(source, tmp, nextIndex, N, params.mEpsilon); + + const PxU32 statIndex = tmp->getType(); + if(statIndex==4) + params.mStats[3]++; + else if(statIndex==3) + params.mStats[1]++; + else if(statIndex==2) + params.mStats[0]++; + else + PX_ASSERT(0); + } +#endif + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT0 + tmp->mBVData[0].mTempPNS = precomputeNodeSorting(P->mBV, N->mBV); +#endif +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + FigureOutPNS(tmp); +#endif + } + else + { + // Case 2: P leaf, N no leaf + // ____A____ + // P N + // __|__ + // NP NN + // => store as (P,NP,NN), keep bit0 and bit2 +//#define NODE_FUSION +#ifdef NODE_FUSION + // P leaf => store 1 triangle pointers and 2 node pointers + // => 3 slots used, 25% wasted + + const AABBTreeNode* NP = N->getPos(); + const AABBTreeNode* NN = N->getNeg(); + + BV4Node* ChildNP; + BV4Node* ChildNN; + + #ifdef GU_BV4_FILL_GAPS + if(splitPrimitives(params, tmp, 0, P)) + { + // We used up the empty slot, continue as usual in slot 2 + ChildNP = setNode(source, tmp, 2, NP, params); + ChildNN = setNode(source, tmp, 3, NN, params); + } + else + #endif + { + // We oouldn't split the prims, continue searching for a way to use the empty slot + setPrimitive(source, tmp, 0, P, params.mEpsilon); + + PxU32 c=0; + if(hasTwoLeafChildren(NP)) + { + // Drag the terminal leaves directly into this BV4 node, drop internal node NP + setPrimitive(source, tmp, 1, NP->getPos(), params.mEpsilon); + setPrimitive(source, tmp, 2, NP->getNeg(), params.mEpsilon); + ChildNP = NULL; + c=1; + } + else + { + ChildNP = setNode(source, tmp, 1, NP, params); + } + + if(c==0 && hasTwoLeafChildren(NN)) + { + // Drag the terminal leaves directly into this BV4 node, drop internal node NN + setPrimitive(source, tmp, 2, NN->getPos(), params.mEpsilon); + setPrimitive(source, tmp, 3, NN->getNeg(), params.mEpsilon); + ChildNN = NULL; + } + else + { + #ifdef GU_BV4_FILL_GAPS + if(c==0 && NN->isLeaf()) + { + ChildNN = NULL; + if(!splitPrimitives(params, tmp, 2, NN)) + setPrimitive(source, tmp, 2, NN, params.mEpsilon); + } + else + #endif + { + ChildNN = setNode(source, tmp, 2+c, NN, params); + } + } + } + + const PxU32 statIndex = tmp->getType(); + if(statIndex==4) + params.mStats[3]++; + else if(statIndex==3) + params.mStats[1]++; + else if(statIndex==2) + params.mStats[0]++; + else + PX_ASSERT(0); +#else + params.mStats[1]++; + // P leaf => store 1 triangle pointers and 2 node pointers + // => 3 slots used, 25% wasted + setPrimitive(source, tmp, 0, P, params.mEpsilon); + + const AABBTreeNode* NP = N->getPos(); + const AABBTreeNode* NN = N->getNeg(); + + BV4Node* ChildNP = setNode(source, tmp, 1, NP, params); + BV4Node* ChildNN = setNode(source, tmp, 2, NN, params); +#endif + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT0 + tmp->mBVData[0].mTempPNS = precomputeNodeSorting(P->mBV, N->mBV); + tmp->mBVData[2].mTempPNS = precomputeNodeSorting(NP->mBV, NN->mBV); +#endif +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + FigureOutPNS(tmp); +#endif + + if(ChildNP) + buildBV4(source, ChildNP, NP, params); + if(ChildNN) + buildBV4(source, ChildNN, NN, params); + } + } + else + { + if(NLeaf) + { + // Note: this case doesn't exist anymore because of the node reorganizing for shadow rays + + // Case 3: P no leaf, N leaf + // ____A____ + // P N + // __|__ + // PP PN + // => store as (PP,PN,N), keep bit0 and bit1 + params.mStats[2]++; + + // N leaf => store 1 triangle pointers and 2 node pointers + // => 3 slots used, 25% wasted + setPrimitive(source, tmp, 2, N, params.mEpsilon); + + // + + const AABBTreeNode* PP = P->getPos(); + const AABBTreeNode* PN = P->getNeg(); + + BV4Node* ChildPP = setNode(source, tmp, 0, PP, params); + BV4Node* ChildPN = setNode(source, tmp, 1, PN, params); + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT0 + tmp->mBVData[0].mTempPNS = precomputeNodeSorting(P->mBV, N->mBV); + tmp->mBVData[1].mTempPNS = precomputeNodeSorting(PP->mBV, PN->mBV); +#endif +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + FigureOutPNS(tmp); +#endif + + if(ChildPP) + buildBV4(source, ChildPP, PP, params); + if(ChildPN) + buildBV4(source, ChildPN, PN, params); + } + else + { + // Case 4: P and N are no leaves: + // => store as (PP,PN,NP,NN), keep bit0/bit1/bit2 + params.mStats[3]++; + + // No leaves => store 4 node pointers + const AABBTreeNode* PP = P->getPos(); + const AABBTreeNode* PN = P->getNeg(); + const AABBTreeNode* NP = N->getPos(); + const AABBTreeNode* NN = N->getNeg(); + + BV4Node* ChildPP = setNode(source, tmp, 0, PP, params); + BV4Node* ChildPN = setNode(source, tmp, 1, PN, params); + BV4Node* ChildNP = setNode(source, tmp, 2, NP, params); + BV4Node* ChildNN = setNode(source, tmp, 3, NN, params); + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT0 + tmp->mBVData[0].mTempPNS = precomputeNodeSorting(P->mBV, N->mBV); + tmp->mBVData[1].mTempPNS = precomputeNodeSorting(PP->mBV, PN->mBV); + tmp->mBVData[2].mTempPNS = precomputeNodeSorting(NP->mBV, NN->mBV); +#endif +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + FigureOutPNS(tmp); +#endif + if(ChildPP) + buildBV4(source, ChildPP, PP, params); + if(ChildPN) + buildBV4(source, ChildPN, PN, params); + if(ChildNP) + buildBV4(source, ChildNP, NP, params); + if(ChildNN) + buildBV4(source, ChildNN, NN, params); + } + } +} + +#ifdef GU_BV4_USE_SLABS +static void computeMaxValues(const BV4Node* current, PxVec3& MinMax, PxVec3& MaxMax) +#else +static void computeMaxValues(const BV4Node* current, PxVec3& CMax, PxVec3& EMax) +#endif +{ + for(PxU32 i=0; i<4; i++) + { + if(current->mBVData[i].mData != PX_INVALID_U32) + { + const CenterExtents& Box = current->mBVData[i].mAABB; +#ifdef GU_BV4_USE_SLABS + const PxVec3 Min = Box.mCenter - Box.mExtents; + const PxVec3 Max = Box.mCenter + Box.mExtents; + if(fabsf(Min.x)>MinMax.x) MinMax.x = fabsf(Min.x); + if(fabsf(Min.y)>MinMax.y) MinMax.y = fabsf(Min.y); + if(fabsf(Min.z)>MinMax.z) MinMax.z = fabsf(Min.z); + if(fabsf(Max.x)>MaxMax.x) MaxMax.x = fabsf(Max.x); + if(fabsf(Max.y)>MaxMax.y) MaxMax.y = fabsf(Max.y); + if(fabsf(Max.z)>MaxMax.z) MaxMax.z = fabsf(Max.z); +#else + if(fabsf(Box.mCenter.x)>CMax.x) CMax.x = fabsf(Box.mCenter.x); + if(fabsf(Box.mCenter.y)>CMax.y) CMax.y = fabsf(Box.mCenter.y); + if(fabsf(Box.mCenter.z)>CMax.z) CMax.z = fabsf(Box.mCenter.z); + if(fabsf(Box.mExtents.x)>EMax.x) EMax.x = fabsf(Box.mExtents.x); + if(fabsf(Box.mExtents.y)>EMax.y) EMax.y = fabsf(Box.mExtents.y); + if(fabsf(Box.mExtents.z)>EMax.z) EMax.z = fabsf(Box.mExtents.z); +#endif + if(!current->isLeaf(i)) + { + const BV4Node* ChildNode = current->getChild(i); +#ifdef GU_BV4_USE_SLABS + computeMaxValues(ChildNode, MinMax, MaxMax); +#else + computeMaxValues(ChildNode, CMax, EMax); +#endif + } + } + } +} + +// PT: duplicated for now.... + +static void flattenQ( BVDataPackedQ* const dest, const PxU32 box_id, PxU32& current_id, const BV4Node* current, PxU32& max_depth, PxU32& current_depth, + const PxVec3& CQuantCoeff, const PxVec3& EQuantCoeff, const PxVec3& mCenterCoeff, const PxVec3& mExtentsCoeff) +{ + // Entering a new node => increase depth + current_depth++; + // Keep track of max depth + if(current_depth>max_depth) + max_depth = current_depth; + +// dest[box_id] = *current; + const PxU32 CurrentType = current->getType(); + for(PxU32 i=0; imBVData[i].mAABB; +#ifdef GU_BV4_USE_SLABS + const PxVec3 m = Box.mCenter - Box.mExtents; + const PxVec3 M = Box.mCenter + Box.mExtents; + + dest[box_id + i].mAABB.mData[0].mCenter = PxI16(m.x * CQuantCoeff.x); + dest[box_id + i].mAABB.mData[1].mCenter = PxI16(m.y * CQuantCoeff.y); + dest[box_id + i].mAABB.mData[2].mCenter = PxI16(m.z * CQuantCoeff.z); + dest[box_id + i].mAABB.mData[0].mExtents = PxU16(PxI16(M.x * EQuantCoeff.x)); + dest[box_id + i].mAABB.mData[1].mExtents = PxU16(PxI16(M.y * EQuantCoeff.y)); + dest[box_id + i].mAABB.mData[2].mExtents = PxU16(PxI16(M.z * EQuantCoeff.z)); + + if (1) + { + for (PxU32 j = 0; j<3; j++) + { + // Dequantize the min/max + // const float qmin = float(dest[box_id+i].mAABB.mData[j].mCenter) * mCenterCoeff[j]; + // const float qmax = float(PxI16(dest[box_id+i].mAABB.mData[j].mExtents)) * mExtentsCoeff[j]; + // Compare real & dequantized values + /* if(qmaxm[j]) + { + int stop=1; + }*/ + bool CanLeave; + do + { + CanLeave = true; + const float qmin = float(dest[box_id + i].mAABB.mData[j].mCenter) * mCenterCoeff[j]; + const float qmax = float(PxI16(dest[box_id + i].mAABB.mData[j].mExtents)) * mExtentsCoeff[j]; + + if (qmaxm[j]) + { + if (dest[box_id + i].mAABB.mData[j].mCenter) + { + dest[box_id + i].mAABB.mData[j].mCenter--; + CanLeave = false; + } + } + } while (!CanLeave); + } + } +#else // GU_BV4_USE_SLABS + dest[box_id + i].mAABB.mData[0].mCenter = PxI16(Box.mCenter.x * CQuantCoeff.x); + dest[box_id + i].mAABB.mData[1].mCenter = PxI16(Box.mCenter.y * CQuantCoeff.y); + dest[box_id + i].mAABB.mData[2].mCenter = PxI16(Box.mCenter.z * CQuantCoeff.z); + dest[box_id + i].mAABB.mData[0].mExtents = PxU16(Box.mExtents.x * EQuantCoeff.x); + dest[box_id + i].mAABB.mData[1].mExtents = PxU16(Box.mExtents.y * EQuantCoeff.y); + dest[box_id + i].mAABB.mData[2].mExtents = PxU16(Box.mExtents.z * EQuantCoeff.z); + + // Fix quantized boxes + if (1) + { + // Make sure the quantized box is still valid + const PxVec3 Max = Box.mCenter + Box.mExtents; + const PxVec3 Min = Box.mCenter - Box.mExtents; + // For each axis + for (PxU32 j = 0; j<3; j++) + { // Dequantize the box center + const float qc = float(dest[box_id + i].mAABB.mData[j].mCenter) * mCenterCoeff[j]; + bool FixMe = true; + do + { // Dequantize the box extent + const float qe = float(dest[box_id + i].mAABB.mData[j].mExtents) * mExtentsCoeff[j]; + // Compare real & dequantized values + if (qc + qeMin[j]) dest[box_id + i].mAABB.mData[j].mExtents++; + else FixMe = false; + // Prevent wrapping + if (!dest[box_id + i].mAABB.mData[j].mExtents) + { + dest[box_id + i].mAABB.mData[j].mExtents = 0xffff; + FixMe = false; + } + } while (FixMe); + } + } +#endif // GU_BV4_USE_SLABS + + dest[box_id + i].mData = PxU32(current->mBVData[i].mData); +// dest[box_id+i].encodePNS(current->mBVData[i].mTempPNS); + } + + PxU32 NbToGo = 0; + PxU32 NextIDs[4] = { PX_INVALID_U32, PX_INVALID_U32, PX_INVALID_U32, PX_INVALID_U32 }; + const BV4Node* ChildNodes[4] = { NULL,NULL,NULL,NULL }; + + BVDataPackedQ* data = dest + box_id; + for(PxU32 i=0; i<4; i++) + { + if(current->mBVData[i].mData != PX_INVALID_U32 && !current->isLeaf(i)) + { + const BV4Node* ChildNode = current->getChild(i); + + const PxU32 NextID = current_id; +#ifdef GU_BV4_USE_SLABS + current_id += 4; +#else + const PxU32 ChildSize = ChildNode->getType(); + current_id += ChildSize; +#endif + const PxU32 ChildType = (ChildNode->getType() - 2) << 1; + data[i].mData = size_t(ChildType + (NextID << GU_BV4_CHILD_OFFSET_SHIFT_COUNT)); + //PX_ASSERT(data[i].mData == size_t(ChildType+(NextID<<3))); + + NextIDs[NbToGo] = NextID; + ChildNodes[NbToGo] = ChildNode; + NbToGo++; + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + data[i].encodePNS(current->mBVData[i].mTempPNS); +#endif +//#define DEPTH_FIRST +#ifdef DEPTH_FIRST + _Flatten(dest, NextID, current_id, ChildNode, max_depth, current_depth, CQuantCoeff, EQuantCoeff, mCenterCoeff, mExtentsCoeff, quantized); + current_depth--; +#endif + } +#ifdef GU_BV4_USE_SLABS + if (current->mBVData[i].mData == PX_INVALID_U32) + { + data[i].mAABB.mData[0].mExtents = 0; + data[i].mAABB.mData[1].mExtents = 0; + data[i].mAABB.mData[2].mExtents = 0; + data[i].mAABB.mData[0].mCenter = 0; + data[i].mAABB.mData[1].mCenter = 0; + data[i].mAABB.mData[2].mCenter = 0; + data[i].mData = PX_INVALID_U32; + } +#endif + } + +#ifndef DEPTH_FIRST + for(PxU32 i=0; i increase depth + current_depth++; + // Keep track of max depth + if(current_depth>max_depth) + max_depth = current_depth; + +// dest[box_id] = *current; + const PxU32 CurrentType = current->getType(); + for(PxU32 i=0; imBVData[i].mAABB; + dest[box_id + i].mAABB.mCenter = Box.mCenter - Box.mExtents; + dest[box_id + i].mAABB.mExtents = Box.mCenter + Box.mExtents; +#else // GU_BV4_USE_SLABS + dest[box_id + i].mAABB = current->mBVData[i].mAABB; +#endif // GU_BV4_USE_SLABS + + dest[box_id + i].mData = PxU32(current->mBVData[i].mData); +// dest[box_id+i].encodePNS(current->mBVData[i].mTempPNS); + } + + PxU32 NbToGo = 0; + PxU32 NextIDs[4] = { PX_INVALID_U32, PX_INVALID_U32, PX_INVALID_U32, PX_INVALID_U32 }; + const BV4Node* ChildNodes[4] = { NULL,NULL,NULL,NULL }; + + BVDataPackedNQ* data = dest + box_id; + for(PxU32 i=0; i<4; i++) + { + if(current->mBVData[i].mData != PX_INVALID_U32 && !current->isLeaf(i)) + { + const BV4Node* ChildNode = current->getChild(i); + + const PxU32 NextID = current_id; +#ifdef GU_BV4_USE_SLABS + current_id += 4; +#else + const PxU32 ChildSize = ChildNode->getType(); + current_id += ChildSize; +#endif + const PxU32 ChildType = (ChildNode->getType() - 2) << 1; + data[i].mData = size_t(ChildType + (NextID << GU_BV4_CHILD_OFFSET_SHIFT_COUNT)); + //PX_ASSERT(data[i].mData == size_t(ChildType+(NextID<<3))); + + NextIDs[NbToGo] = NextID; + ChildNodes[NbToGo] = ChildNode; + NbToGo++; + +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + data[i].encodePNS(current->mBVData[i].mTempPNS); +#endif +//#define DEPTH_FIRST +#ifdef DEPTH_FIRST + _Flatten(dest, NextID, current_id, ChildNode, max_depth, current_depth, CQuantCoeff, EQuantCoeff, mCenterCoeff, mExtentsCoeff, quantized); + current_depth--; +#endif + } +#ifdef GU_BV4_USE_SLABS + if (current->mBVData[i].mData == PX_INVALID_U32) + { + data[i].mAABB.mCenter = PxVec3(0.0f); + data[i].mAABB.mExtents = PxVec3(0.0f); + data[i].mData = PX_INVALID_U32; + } +#endif + } + +#ifndef DEPTH_FIRST + for(PxU32 i=0; imQuantized = quantized; + + // Version with variable-sized nodes in single stream + { + const PxU32 NbSingleNodes = Params.mStats[0] * 2 + (Params.mStats[1] + Params.mStats[2]) * 3 + Params.mStats[3] * 4; + + PxU32 CurID = Root->getType(); + PxU32 InitData = PX_INVALID_U32; +#ifdef GU_BV4_USE_SLABS + PX_UNUSED(NbSingleNodes); + const PxU32 NbNeeded = (Params.mStats[0] + Params.mStats[1] + Params.mStats[2] + Params.mStats[3]) * 4; + + // PT: TODO: refactor with code in BV4Tree::load +// BVDataPacked* Nodes = reinterpret_cast(PX_ALLOC(sizeof(BVDataPacked)*NbNeeded, "BV4 nodes")); // PT: PX_NEW breaks alignment here +// BVDataPacked* Nodes = PX_NEW(BVDataPacked)[NbNeeded]; + void* nodes; + { + + const PxU32 nodeSize = T->mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + const PxU32 dataSize = nodeSize*NbNeeded; + nodes = PX_ALLOC(dataSize, "BV4 nodes"); // PT: PX_NEW breaks alignment here + } + + if (CurID == 2) + { + InitData = 0; + } + else if (CurID == 3) + { + InitData = 2; + } + else if (CurID == 4) + { + InitData = 4; + } + + CurID = 4; +// PxU32 CurID = 4; +// PxU32 InitData = 4; +#else + BVDataPacked* Nodes = PX_NEW(BVDataPacked)[NbSingleNodes]; + + if (CurID == 2) + { + InitData = 0; + } + else if (CurID == 3) + { + InitData = 2; + } + else if (CurID == 4) + { + InitData = 4; + } +#endif + + T->mInitData = InitData; + PxU32 MaxDepth = 0; + PxU32 CurrentDepth = 0; + + PxVec3 CQuantCoeff(0.0f); + PxVec3 EQuantCoeff(0.0f); + if(T->mQuantized) + { +#ifdef GU_BV4_USE_SLABS + PxVec3 MinQuantCoeff, MaxQuantCoeff; + + // Get max values + PxVec3 MinMax(-FLT_MAX); + PxVec3 MaxMax(-FLT_MAX); + computeMaxValues(Root, MinMax, MaxMax); + + const PxU32 nbm = 15; + + // Compute quantization coeffs + const float MinCoeff = float((1 << nbm) - 1); + const float MaxCoeff = float((1 << nbm) - 1); + MinQuantCoeff.x = MinMax.x != 0.0f ? MinCoeff / MinMax.x : 0.0f; + MinQuantCoeff.y = MinMax.y != 0.0f ? MinCoeff / MinMax.y : 0.0f; + MinQuantCoeff.z = MinMax.z != 0.0f ? MinCoeff / MinMax.z : 0.0f; + MaxQuantCoeff.x = MaxMax.x != 0.0f ? MaxCoeff / MaxMax.x : 0.0f; + MaxQuantCoeff.y = MaxMax.y != 0.0f ? MaxCoeff / MaxMax.y : 0.0f; + MaxQuantCoeff.z = MaxMax.z != 0.0f ? MaxCoeff / MaxMax.z : 0.0f; + // Compute and save dequantization coeffs + T->mCenterOrMinCoeff.x = MinMax.x / MinCoeff; + T->mCenterOrMinCoeff.y = MinMax.y / MinCoeff; + T->mCenterOrMinCoeff.z = MinMax.z / MinCoeff; + T->mExtentsOrMaxCoeff.x = MaxMax.x / MaxCoeff; + T->mExtentsOrMaxCoeff.y = MaxMax.y / MaxCoeff; + T->mExtentsOrMaxCoeff.z = MaxMax.z / MaxCoeff; + + CQuantCoeff = MinQuantCoeff; + EQuantCoeff = MaxQuantCoeff; +#else + // Get max values + PxVec3 CMax(-FLT_MAX); + PxVec3 EMax(-FLT_MAX); + computeMaxValues(Root, CMax, EMax); + + const PxU32 nbc = 15; + const PxU32 nbe = 16; +// const PxU32 nbc=7; +// const PxU32 nbe=8; + + const float UnitQuantError = 2.0f / 65535.0f; + EMax.x += CMax.x*UnitQuantError; + EMax.y += CMax.y*UnitQuantError; + EMax.z += CMax.z*UnitQuantError; + + // Compute quantization coeffs + const float CCoeff = float((1 << nbc) - 1); + CQuantCoeff.x = CMax.x != 0.0f ? CCoeff / CMax.x : 0.0f; + CQuantCoeff.y = CMax.y != 0.0f ? CCoeff / CMax.y : 0.0f; + CQuantCoeff.z = CMax.z != 0.0f ? CCoeff / CMax.z : 0.0f; + const float ECoeff = float((1 << nbe) - 32); + EQuantCoeff.x = EMax.x != 0.0f ? ECoeff / EMax.x : 0.0f; + EQuantCoeff.y = EMax.y != 0.0f ? ECoeff / EMax.y : 0.0f; + EQuantCoeff.z = EMax.z != 0.0f ? ECoeff / EMax.z : 0.0f; + // Compute and save dequantization coeffs + T->mCenterOrMinCoeff.x = CMax.x / CCoeff; + T->mCenterOrMinCoeff.y = CMax.y / CCoeff; + T->mCenterOrMinCoeff.z = CMax.z / CCoeff; + T->mExtentsOrMaxCoeff.x = EMax.x / ECoeff; + T->mExtentsOrMaxCoeff.y = EMax.y / ECoeff; + T->mExtentsOrMaxCoeff.z = EMax.z / ECoeff; +#endif + flattenQ(reinterpret_cast(nodes), 0, CurID, Root, MaxDepth, CurrentDepth, CQuantCoeff, EQuantCoeff, T->mCenterOrMinCoeff, T->mExtentsOrMaxCoeff); + } + else + { + flattenNQ(reinterpret_cast(nodes), 0, CurID, Root, MaxDepth, CurrentDepth, CQuantCoeff, EQuantCoeff, T->mCenterOrMinCoeff, T->mExtentsOrMaxCoeff); + } + +#ifdef GU_BV4_USE_NODE_POOLS + Params.releaseNodes(); +#endif + +#ifdef GU_BV4_USE_SLABS + // PT: TODO: revisit this, don't duplicate everything + if(T->mQuantized) + { + BVDataPackedQ* _nodes = reinterpret_cast(nodes); + + PX_COMPILE_TIME_ASSERT(sizeof(BVDataSwizzledQ) == sizeof(BVDataPackedQ) * 4); + BVDataPackedQ* Copy = PX_ALLOCATE(BVDataPackedQ, NbNeeded, "BVDataPackedQ"); + PxMemCopy(Copy, nodes, sizeof(BVDataPackedQ)*NbNeeded); + for (PxU32 i = 0; i(_nodes + i * 4); + for (PxU32 j = 0; j<4; j++) + { + // We previously stored m/M within c/e so we just need to swizzle now + const QuantizedAABB& Box = Src[j].mAABB; + Dst->mX[j].mMin = Box.mData[0].mCenter; + Dst->mY[j].mMin = Box.mData[1].mCenter; + Dst->mZ[j].mMin = Box.mData[2].mCenter; + Dst->mX[j].mMax = PxI16(Box.mData[0].mExtents); + Dst->mY[j].mMax = PxI16(Box.mData[1].mExtents); + Dst->mZ[j].mMax = PxI16(Box.mData[2].mExtents); + Dst->mData[j] = Src[j].mData; + } + } + PX_FREE(Copy); + } + else + { + BVDataPackedNQ* _nodes = reinterpret_cast(nodes); + PX_COMPILE_TIME_ASSERT(sizeof(BVDataSwizzledNQ) == sizeof(BVDataPackedNQ) * 4); + BVDataPackedNQ* Copy = PX_ALLOCATE(BVDataPackedNQ, NbNeeded, "BVDataPackedNQ"); + PxMemCopy(Copy, nodes, sizeof(BVDataPackedNQ)*NbNeeded); + for (PxU32 i = 0; i(_nodes + i * 4); + for (PxU32 j = 0; j<4; j++) + { + // We previously stored m/M within c/e so we just need to swizzle now + const CenterExtents& Box = Src[j].mAABB; + Dst->mMinX[j] = Box.mCenter.x; + Dst->mMinY[j] = Box.mCenter.y; + Dst->mMinZ[j] = Box.mCenter.z; + Dst->mMaxX[j] = Box.mExtents.x; + Dst->mMaxY[j] = Box.mExtents.y; + Dst->mMaxZ[j] = Box.mExtents.z; + Dst->mData[j] = Src[j].mData; + } + } + PX_FREE(Copy); + + if(0) + { + const PxVec3 eps(epsilon); + float maxError = 0.0f; + PxU32 nb = NbNeeded/4; + BVDataSwizzledNQ* data = reinterpret_cast(nodes); + while(nb--) + { + BVDataSwizzledNQ* current = data + nb; + + for(PxU32 j=0;j<4;j++) + { + if(current->getChildData(j)==PX_INVALID_U32) + continue; + + const PxBounds3 localBox( PxVec3(current->mMinX[j], current->mMinY[j], current->mMinZ[j]), + PxVec3(current->mMaxX[j], current->mMaxY[j], current->mMaxZ[j])); + PxBounds3 refitBox; + refitBox.setEmpty(); + + if(current->isLeaf(j)) + { + PxU32 primIndex = current->getPrimitive(j); + + PxU32 nbToGo = getNbPrimitives(primIndex); + + do + { + PX_ASSERT(primIndexmMeshInterface->getNbPrimitives()); + + T->mMeshInterface->refit(primIndex, refitBox); + + primIndex++; + }while(nbToGo--); + } + else + { + PxU32 childOffset = current->getChildOffset(j); + PX_ASSERT(!(childOffset&3)); + childOffset>>=2; + PX_ASSERT(childOffset>nb); + const PxU32 childType = current->getChildType(j); + + const BVDataSwizzledNQ* next = data + childOffset; + { + if(childType>1) + { + const PxBounds3 childBox( PxVec3(next->mMinX[3], next->mMinY[3], next->mMinZ[3]), + PxVec3(next->mMaxX[3], next->mMaxY[3], next->mMaxZ[3])); + refitBox.include(childBox); + } + + if(childType>0) + { + const PxBounds3 childBox( PxVec3(next->mMinX[2], next->mMinY[2], next->mMinZ[2]), + PxVec3(next->mMaxX[2], next->mMaxY[2], next->mMaxZ[2])); + refitBox.include(childBox); + } + + { + const PxBounds3 childBox( PxVec3(next->mMinX[1], next->mMinY[1], next->mMinZ[1]), + PxVec3(next->mMaxX[1], next->mMaxY[1], next->mMaxZ[1])); + refitBox.include(childBox); + } + + { + const PxBounds3 childBox( PxVec3(next->mMinX[0], next->mMinY[0], next->mMinZ[0]), + PxVec3(next->mMaxX[0], next->mMaxY[0], next->mMaxZ[0])); + refitBox.include(childBox); + } + } + } + refitBox.minimum -= eps; + refitBox.maximum += eps; + { + float error = (refitBox.minimum - localBox.minimum).magnitude(); + if(error>maxError) + maxError = error; + } + { + float error = (refitBox.maximum - localBox.maximum).magnitude(); + if(error>maxError) + maxError = error; + } + } + } + printf("maxError: %f\n", double(maxError)); + } + } + PX_ASSERT(CurID == NbNeeded); + T->mNbNodes = NbNeeded; +#else + PX_ASSERT(CurID == NbSingleNodes); + T->mNbNodes = NbSingleNodes; +#endif + T->mNodes = nodes; + } + return true; +} + +static bool BuildBV4Internal(BV4Tree& tree, const BV4_AABBTree& source, SourceMeshBase* mesh, float epsilon, bool quantized) +{ + GU_PROFILE_ZONE("..BuildBV4Internal") + + if(mesh->getNbPrimitives()<=4) + return tree.init(mesh, source.getBV()); + + { + GU_PROFILE_ZONE("....CheckMD") + + struct Local + { + static void _checkMD(const AABBTreeNode* current_node, PxU32& md, PxU32& cd) + { + cd++; + md = PxMax(md, cd); + + if(current_node->getPos()) { _checkMD(current_node->getPos(), md, cd); cd--; } + if(current_node->getNeg()) { _checkMD(current_node->getNeg(), md, cd); cd--; } + } + + static void _check(AABBTreeNode* current_node) + { + if(current_node->isLeaf()) + return; + + AABBTreeNode* P = const_cast(current_node->getPos()); + AABBTreeNode* N = const_cast(current_node->getNeg()); + { + PxU32 MDP = 0; PxU32 CDP = 0; _checkMD(P, MDP, CDP); + PxU32 MDN = 0; PxU32 CDN = 0; _checkMD(N, MDN, CDN); + + if(MDP>MDN) +// if(MDP(source.getNodes())); + } + + // PT: not sure what the equivalent would be for tet-meshes here + SourceMesh* triMesh = NULL; + if(mesh->getMeshType()==SourceMeshBase::TRI_MESH) + triMesh = static_cast(mesh); + + BV4BuildParams Params(source, triMesh, epsilon); + Params.mNbNodes=1; // Root node + Params.mStats[0]=0; + Params.mStats[1]=0; + Params.mStats[2]=0; + Params.mStats[3]=0; + +#ifdef GU_BV4_USE_NODE_POOLS + BV4Node* Root = Params.allocateNode(); +#else + BV4Node* Root = PX_NEW(BV4Node); +#endif + { + GU_PROFILE_ZONE("....buildBV4") + buildBV4(source, Root, source.getNodes(), Params); + } + + if(!tree.init(mesh, source.getBV())) + return false; + + return BuildBV4FromRoot(tree, Root, Params, quantized, epsilon); +} + +///// + +#define REORDER_STATS_SIZE 16 +struct ReorderData +{ +public: + PxU32* mOrder; + PxU32 mNbPrimsPerLeaf; + PxU32 mIndex; + PxU32 mNbPrims; + PxU32 mStats[REORDER_STATS_SIZE]; + const SourceMeshBase* mMesh; +}; + +static bool gReorderCallback(const AABBTreeNode* current, PxU32 /*depth*/, void* userData) +{ + ReorderData* Data = reinterpret_cast(userData); + if(current->isLeaf()) + { + const PxU32 n = current->getNbPrimitives(); + PX_ASSERT(n<=Data->mNbPrimsPerLeaf); + Data->mStats[n]++; + PxU32* Prims = const_cast(current->getPrimitives()); + + for(PxU32 i=0;imNbPrims); + Data->mOrder[Data->mIndex] = Prims[i]; + PX_ASSERT(Data->mIndexmNbPrims); + Prims[i] = Data->mIndex; + Data->mIndex++; + } + } + return true; +} + +bool physx::Gu::BuildBV4Ex(BV4Tree& tree, SourceMeshBase& mesh, float epsilon, PxU32 nbPrimitivePerLeaf, bool quantized, BV4_BuildStrategy strategy) +{ + //either number of triangle or number of tetrahedron + const PxU32 nbPrimitives = mesh.getNbPrimitives(); + + BV4_AABBTree Source; + { + GU_PROFILE_ZONE("..BuildBV4Ex_buildFromMesh") + if(!Source.buildFromMesh(mesh, nbPrimitivePerLeaf, strategy)) + return false; + } + + { + GU_PROFILE_ZONE("..BuildBV4Ex_remap") + PxU32* orderArray = PX_ALLOCATE(PxU32, nbPrimitives, "BV4"); + ReorderData RD; + RD.mMesh = &mesh; + RD.mOrder = orderArray; + RD.mNbPrimsPerLeaf = nbPrimitivePerLeaf; + RD.mIndex = 0; + RD.mNbPrims = nbPrimitives; + for(PxU32 i=0;i no release + mNbPrimitives = 0; + } + // Data access + PX_FORCE_INLINE const PxBounds3& getAABB() const { return mBV; } + + PX_FORCE_INLINE const AABBTreeNode* getPos() const { return reinterpret_cast(mPos); } + PX_FORCE_INLINE const AABBTreeNode* getNeg() const { const AABBTreeNode* P = getPos(); return P ? P+1 : NULL; } + + PX_FORCE_INLINE bool isLeaf() const { return !getPos(); } + + PxBounds3 mBV; // Global bounding-volume enclosing all the node-related primitives + size_t mPos; // "Positive" & "Negative" children + + // Data access + PX_FORCE_INLINE const PxU32* getPrimitives() const { return mNodePrimitives; } + PX_FORCE_INLINE PxU32 getNbPrimitives() const { return mNbPrimitives; } + + PxU32* mNodePrimitives; //!< Node-related primitives (shortcut to a position in mIndices below) + PxU32 mNbPrimitives; //!< Number of primitives for this node +#ifdef GU_BV4_FILL_GAPS + PxU32 mNextSplit; +#endif + }; + + typedef bool (*WalkingCallback) (const AABBTreeNode* current, PxU32 depth, void* userData); + typedef bool (*WalkingDistanceCallback) (const AABBTreeNode* current, void* userData); + + enum BV4_BuildStrategy + { + BV4_SPLATTER_POINTS, + BV4_SPLATTER_POINTS_SPLIT_GEOM_CENTER, + BV4_SAH + }; + + // PT: TODO: refactor with SQ version (TA34704) + class BV4_AABBTree : public physx::PxUserAllocated + { + public: + BV4_AABBTree(); + ~BV4_AABBTree(); + + bool buildFromMesh(SourceMeshBase& mesh, PxU32 limit, BV4_BuildStrategy strategy=BV4_SPLATTER_POINTS); + void release(); + + PX_FORCE_INLINE const PxU32* getIndices() const { return mIndices; } //!< Catch the indices + PX_FORCE_INLINE PxU32 getNbNodes() const { return mTotalNbNodes; } //!< Catch the number of nodes + + PX_FORCE_INLINE const PxU32* getPrimitives() const { return mPool->mNodePrimitives; } + PX_FORCE_INLINE PxU32 getNbPrimitives() const { return mPool->mNbPrimitives; } + PX_FORCE_INLINE const AABBTreeNode* getNodes() const { return mPool; } + PX_FORCE_INLINE const PxBounds3& getBV() const { return mPool->mBV; } + + PxU32 walk(WalkingCallback callback, void* userData) const; + PxU32 walkDistance(WalkingCallback callback, WalkingDistanceCallback distancCallback, void* userData) const; + private: + PxU32* mIndices; //!< Indices in the app list. Indices are reorganized during build (permutation). + AABBTreeNode* mPool; //!< Linear pool of nodes for complete trees. Null otherwise. [Opcode 1.3] + PxU32 mTotalNbNodes; //!< Number of nodes in the tree. + }; + + bool BuildBV4Ex(BV4Tree& tree, SourceMeshBase& mesh, float epsilon, PxU32 nbPrimitivePerLeaf, bool quantized, BV4_BuildStrategy strategy=BV4_SPLATTER_POINTS); + +} // namespace Gu +} + +#endif // GU_BV4_BUILD_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Settings.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Settings.h new file mode 100644 index 0000000..b263528 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4Settings.h @@ -0,0 +1,66 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SETTINGS_H +#define GU_BV4_SETTINGS_H + + // PT: "BV4" ported from "Opcode 2.0". Available compile-time options are: + #define GU_BV4_STACK_SIZE 256 // Default size of local stacks for non-recursive traversals. + #define GU_BV4_PRECOMPUTED_NODE_SORT // Use node sorting or not. This should probably always be enabled. +// #define GU_BV4_QUANTIZED_TREE // Use AABB quantization/compression or not. + #define GU_BV4_USE_SLABS // Use swizzled data format or not. Swizzled = faster raycasts, but slower overlaps & larger trees. +// #define GU_BV4_COMPILE_NON_QUANTIZED_TREE // + #define GU_BV4_FILL_GAPS + +//#define PROFILE_MESH_COOKING +#ifdef PROFILE_MESH_COOKING + #include + #include + + struct LocalProfileZone + { + LocalProfileZone(const char* name) + { + mName = name; + mTime = __rdtsc(); + } + ~LocalProfileZone() + { + mTime = __rdtsc() - mTime; + printf("%s: %d\n", mName, unsigned int(mTime/1024)); + } + + const char* mName; + unsigned long long mTime; + }; + #define GU_PROFILE_ZONE(name) LocalProfileZone zone(name); +#else + #define GU_PROFILE_ZONE(name) +#endif + +#endif // GU_BV4_SETTINGS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBAABBSweepTest.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBAABBSweepTest.h new file mode 100644 index 0000000..1360479 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBAABBSweepTest.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_AABB_AABB_SWEEP_TEST_H +#define GU_BV4_AABB_AABB_SWEEP_TEST_H + +#ifndef GU_BV4_USE_SLABS + PX_FORCE_INLINE PxIntBool BV4_SegmentAABBOverlap(const PxVec3& center, const PxVec3& extents, const PxVec3& extents2, const RayParams* PX_RESTRICT params) + { + const Vec4V fdirV = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V extentsV = V4Add(V4LoadU(&extents.x), V4LoadU(&extents2.x)); + const Vec4V DV = V4Sub(V4LoadA_Safe(¶ms->mData2_PaddedAligned.x), V4LoadU(¢er.x)); + const Vec4V absDV = V4Abs(DV); + const BoolV resDV = V4IsGrtr(absDV, V4Add(extentsV, fdirV)); + const PxU32 test = BGetBitMask(resDV); + if(test&7) + return 0; + + if(1) + { + const Vec4V dataZYX_V = V4LoadA_Safe(¶ms->mData_PaddedAligned.x); + const Vec4V dataXZY_V = V4Perm<1, 2, 0, 3>(dataZYX_V); + const Vec4V DXZY_V = V4Perm<1, 2, 0, 3>(DV); + const Vec4V fV = V4Sub(V4Mul(dataZYX_V, DXZY_V), V4Mul(dataXZY_V, DV)); + + const Vec4V fdirZYX_V = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V fdirXZY_V = V4Perm<1, 2, 0, 3>(fdirZYX_V); + const Vec4V extentsXZY_V = V4Perm<1, 2, 0, 3>(extentsV); + // PT: TODO: use V4MulAdd here (TA34704) + const Vec4V fg = V4Add(V4Mul(extentsV, fdirXZY_V), V4Mul(extentsXZY_V, fdirZYX_V)); + + const Vec4V absfV = V4Abs(fV); + const BoolV resAbsfV = V4IsGrtr(absfV, fg); + const PxU32 test2 = BGetBitMask(resAbsfV); + if(test2&7) + return 0; + return 1; + } + } + +#ifdef GU_BV4_QUANTIZED_TREE + template + PX_FORCE_INLINE PxIntBool BV4_SegmentAABBOverlap(const T* PX_RESTRICT node, const PxVec3& extents2, const RayParams* PX_RESTRICT params) + { + const VecI32V testV = I4LoadA((PxI32*)node->mAABB.mData); + const VecI32V qextentsV = VecI32V_And(testV, I4Load(0x0000ffff)); + const VecI32V qcenterV = VecI32V_RightShift(testV, 16); + const Vec4V centerV0 = V4Mul(Vec4V_From_VecI32V(qcenterV), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); + const Vec4V extentsV0 = V4Mul(Vec4V_From_VecI32V(qextentsV), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + + const Vec4V fdirV = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V extentsV = V4Add(extentsV0, V4LoadU(&extents2.x)); + const Vec4V DV = V4Sub(V4LoadA_Safe(¶ms->mData2_PaddedAligned.x), centerV0); + const Vec4V absDV = V4Abs(DV); + const BoolV res = V4IsGrtr(absDV, V4Add(extentsV, fdirV)); + const PxU32 test = BGetBitMask(res); + if(test&7) + return 0; + + if(1) + { + const Vec4V dataZYX_V = V4LoadA_Safe(¶ms->mData_PaddedAligned.x); + const Vec4V dataXZY_V = V4Perm<1, 2, 0, 3>(dataZYX_V); + const Vec4V DXZY_V = V4Perm<1, 2, 0, 3>(DV); + + const Vec4V fV = V4Sub(V4Mul(dataZYX_V, DXZY_V), V4Mul(dataXZY_V, DV)); + + const Vec4V fdirZYX_V = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V fdirXZY_V = V4Perm<1, 2, 0, 3>(fdirZYX_V); + const Vec4V extentsXZY_V = V4Perm<1, 2, 0, 3>(extentsV); + // PT: TODO: use V4MulAdd here (TA34704) + const Vec4V fg = V4Add(V4Mul(extentsV, fdirXZY_V), V4Mul(extentsXZY_V, fdirZYX_V)); + + const Vec4V absfV = V4Abs(fV); + const BoolV res2 = V4IsGrtr(absfV, fg); + const PxU32 test2 = BGetBitMask(res2); + if(test2&7) + return 0; + return 1; + } + } +#endif +#endif + +#endif // GU_BV4_AABB_AABB_SWEEP_TEST_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp new file mode 100644 index 0000000..831c73f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_AABBSweep.cpp @@ -0,0 +1,36 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; + +#define SWEEP_AABB_IMPL +#include "foundation/PxVecMath.h" +using namespace physx::aos; +#include "GuBV4_BoxSweep_Internal.h" diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxBoxOverlapTest.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxBoxOverlapTest.h new file mode 100644 index 0000000..bcaa035 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxBoxOverlapTest.h @@ -0,0 +1,198 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_BOX_BOX_OVERLAP_TEST_H +#define GU_BV4_BOX_BOX_OVERLAP_TEST_H + +#ifndef GU_BV4_USE_SLABS + PX_FORCE_INLINE PxIntBool BV4_BoxBoxOverlap(const PxVec3& extents, const PxVec3& center, const OBBTestParams* PX_RESTRICT params) + { + const Vec4V extentsV = V4LoadU(&extents.x); + + const Vec4V TV = V4Sub(V4LoadA_Safe(¶ms->mTBoxToModel_PaddedAligned.x), V4LoadU(¢er.x)); + { + const Vec4V absTV = V4Abs(TV); + const BoolV resTV = V4IsGrtr(absTV, V4Add(extentsV, V4LoadA_Safe(¶ms->mBB_PaddedAligned.x))); + const PxU32 test = BGetBitMask(resTV); + if(test&7) + return 0; + } + + Vec4V tV; + { + const Vec4V T_YZX_V = V4Perm<1, 2, 0, 3>(TV); + const Vec4V T_ZXY_V = V4Perm<2, 0, 1, 3>(TV); + + tV = V4Mul(TV, V4LoadA_Safe(¶ms->mPreca0_PaddedAligned.x)); + tV = V4Add(tV, V4Mul(T_YZX_V, V4LoadA_Safe(¶ms->mPreca1_PaddedAligned.x))); + tV = V4Add(tV, V4Mul(T_ZXY_V, V4LoadA_Safe(¶ms->mPreca2_PaddedAligned.x))); + } + + Vec4V t2V; + { + const Vec4V extents_YZX_V = V4Perm<1, 2, 0, 3>(extentsV); + const Vec4V extents_ZXY_V = V4Perm<2, 0, 1, 3>(extentsV); + + t2V = V4Mul(extentsV, V4LoadA_Safe(¶ms->mPreca0b_PaddedAligned.x)); + t2V = V4Add(t2V, V4Mul(extents_YZX_V, V4LoadA_Safe(¶ms->mPreca1b_PaddedAligned.x))); + t2V = V4Add(t2V, V4Mul(extents_ZXY_V, V4LoadA_Safe(¶ms->mPreca2b_PaddedAligned.x))); + t2V = V4Add(t2V, V4LoadA_Safe(¶ms->mBoxExtents_PaddedAligned.x)); + } + + { + const Vec4V abstV = V4Abs(tV); + const BoolV resB = V4IsGrtr(abstV, t2V); + const PxU32 test = BGetBitMask(resB); + if(test&7) + return 0; + } + return 1; + } + +#ifdef GU_BV4_QUANTIZED_TREE + template + PX_FORCE_INLINE PxIntBool BV4_BoxBoxOverlap(const T* PX_RESTRICT node, const OBBTestParams* PX_RESTRICT params) + { +// A.B. enable new version only for intel non simd path +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) +// #define NEW_VERSION +#endif +#ifdef NEW_VERSION + SSE_CONST4(maskV, 0x7fffffff); + SSE_CONST4(maskQV, 0x0000ffff); +#endif + +#ifdef NEW_VERSION + Vec4V centerV = V4LoadA((float*)node->mAABB.mData); + __m128 extentsV = _mm_castsi128_ps(_mm_and_si128(_mm_castps_si128(centerV), SSE_CONST(maskQV))); + extentsV = V4Mul(_mm_cvtepi32_ps(_mm_castps_si128(extentsV)), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + centerV = _mm_castsi128_ps(_mm_srai_epi32(_mm_castps_si128(centerV), 16)); + centerV = V4Mul(_mm_cvtepi32_ps(_mm_castps_si128(centerV)), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); +#else + const VecI32V centerVI = I4LoadA((PxI32*)node->mAABB.mData); + const VecI32V extentsVI = VecI32V_And(centerVI, I4Load(0x0000ffff)); + const Vec4V extentsV = V4Mul(Vec4V_From_VecI32V(extentsVI), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + const VecI32V centerVShift = VecI32V_RightShift(centerVI, 16); + const Vec4V centerV = V4Mul(Vec4V_From_VecI32V(centerVShift), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); +#endif + + const Vec4V TV = V4Sub(V4LoadA_Safe(¶ms->mTBoxToModel_PaddedAligned.x), centerV); + { +#ifdef NEW_VERSION + const __m128 absTV = _mm_and_ps(TV, SSE_CONSTF(maskV)); +#else + const Vec4V absTV = V4Abs(TV); +#endif + const BoolV resTV = V4IsGrtr(absTV, V4Add(extentsV, V4LoadA_Safe(¶ms->mBB_PaddedAligned.x))); + const PxU32 test = BGetBitMask(resTV); + if(test&7) + return 0; + } + + Vec4V tV; + { + const Vec4V T_YZX_V = V4Perm<1, 2, 0, 3>(TV); + const Vec4V T_ZXY_V = V4Perm<2, 0, 1, 3>(TV); + + tV = V4Mul(TV, V4LoadA_Safe(¶ms->mPreca0_PaddedAligned.x)); + tV = V4Add(tV, V4Mul(T_YZX_V, V4LoadA_Safe(¶ms->mPreca1_PaddedAligned.x))); + tV = V4Add(tV, V4Mul(T_ZXY_V, V4LoadA_Safe(¶ms->mPreca2_PaddedAligned.x))); + } + + Vec4V t2V; + { + const Vec4V extents_YZX_V = V4Perm<1, 2, 0, 3>(extentsV); + const Vec4V extents_ZXY_V = V4Perm<2, 0, 1, 3>(extentsV); + + t2V = V4Mul(extentsV, V4LoadA_Safe(¶ms->mPreca0b_PaddedAligned.x)); + t2V = V4Add(t2V, V4Mul(extents_YZX_V, V4LoadA_Safe(¶ms->mPreca1b_PaddedAligned.x))); + t2V = V4Add(t2V, V4Mul(extents_ZXY_V, V4LoadA_Safe(¶ms->mPreca2b_PaddedAligned.x))); + t2V = V4Add(t2V, V4LoadA_Safe(¶ms->mBoxExtents_PaddedAligned.x)); + } + + { +#ifdef NEW_VERSION + const __m128 abstV = _mm_and_ps(tV, SSE_CONSTF(maskV)); +#else + const Vec4V abstV = V4Abs(tV); +#endif + const BoolV resB = V4IsGrtr(abstV, t2V); + const PxU32 test = BGetBitMask(resB); + if(test&7) + return 0; + } + return 1; + } +#endif // GU_BV4_QUANTIZED_TREE +#endif // GU_BV4_USE_SLABS + +#ifdef GU_BV4_USE_SLABS + PX_FORCE_INLINE PxIntBool BV4_BoxBoxOverlap(const Vec4V boxCenter, const Vec4V extentsV, const OBBTestParams* PX_RESTRICT params) + { + const Vec4V TV = V4Sub(V4LoadA_Safe(¶ms->mTBoxToModel_PaddedAligned.x), boxCenter); + { + const Vec4V absTV = V4Abs(TV); + const BoolV res = V4IsGrtr(absTV, V4Add(extentsV, V4LoadA_Safe(¶ms->mBB_PaddedAligned.x))); + const PxU32 test = BGetBitMask(res); + if(test&7) + return 0; + } + + Vec4V tV; + { + const Vec4V T_YZX_V = V4Perm<1, 2, 0, 3>(TV); + const Vec4V T_ZXY_V = V4Perm<2, 0, 1, 3>(TV); + + tV = V4Mul(TV, V4LoadA_Safe(¶ms->mPreca0_PaddedAligned.x)); + tV = V4Add(tV, V4Mul(T_YZX_V, V4LoadA_Safe(¶ms->mPreca1_PaddedAligned.x))); + tV = V4Add(tV, V4Mul(T_ZXY_V, V4LoadA_Safe(¶ms->mPreca2_PaddedAligned.x))); + } + + Vec4V t2V; + { + const Vec4V extents_YZX_V = V4Perm<1, 2, 0, 3>(extentsV); + const Vec4V extents_ZXY_V = V4Perm<2, 0, 1, 3>(extentsV); + + t2V = V4Mul(extentsV, V4LoadA_Safe(¶ms->mPreca0b_PaddedAligned.x)); + t2V = V4Add(t2V, V4Mul(extents_YZX_V, V4LoadA_Safe(¶ms->mPreca1b_PaddedAligned.x))); + t2V = V4Add(t2V, V4Mul(extents_ZXY_V, V4LoadA_Safe(¶ms->mPreca2b_PaddedAligned.x))); + t2V = V4Add(t2V, V4LoadA_Safe(¶ms->mBoxExtents_PaddedAligned.x)); + } + + { + const Vec4V abstV = V4Abs(tV); + const BoolV resB = V4IsGrtr(abstV, t2V); + const PxU32 test = BGetBitMask(resB); + if(test&7) + return 0; + } + return 1; + } +#endif // GU_BV4_USE_SLABS + +#endif // GU_BV4_BOX_BOX_OVERLAP_TEST_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp new file mode 100644 index 0000000..a034aca --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap.cpp @@ -0,0 +1,544 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; +using namespace physx::aos; + +#include "GuInternal.h" +#include "GuDistancePointSegment.h" +#include "GuIntersectionCapsuleTriangle.h" +#include "GuBV4_BoxOverlap_Internal.h" +#include "GuBV4_BoxBoxOverlapTest.h" + +// Box overlap any + +struct OBBParams : OBBTestParams +{ + const IndTri32* PX_RESTRICT mTris32; + const IndTri16* PX_RESTRICT mTris16; + const PxVec3* PX_RESTRICT mVerts; + + PxMat33 mRModelToBox_Padded; //!< Rotation from model space to obb space + PxVec3p mTModelToBox_Padded; //!< Translation from model space to obb space +}; + +struct OBBTetParams : OBBTestParams +{ + const IndTetrahedron32* PX_RESTRICT mTets32; + const IndTetrahedron16* PX_RESTRICT mTets16; + const PxVec3* PX_RESTRICT mVerts; + + PxMat33 mRModelToBox_Padded; //!< Rotation from model space to obb space + PxVec3p mTModelToBox_Padded; //!< Translation from model space to obb space +}; + +// PT: TODO: this used to be inlined so we lost some perf by moving to PhysX's version. Revisit. (TA34704) +PxIntBool intersectTriangleBoxBV4(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, + const PxMat33& rotModelToBox, const PxVec3& transModelToBox, const PxVec3& extents); +namespace +{ +class LeafFunction_BoxOverlapAny +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const OBBParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + if(intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + return 1; + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +template +static PX_FORCE_INLINE void setupBoxParams(ParamsT* PX_RESTRICT params, const Box& localBox, const BV4Tree* PX_RESTRICT tree, const SourceMesh* PX_RESTRICT mesh) +{ + invertBoxMatrix(params->mRModelToBox_Padded, params->mTModelToBox_Padded, localBox); + params->mTBoxToModel_PaddedAligned = localBox.center; + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + + params->precomputeBoxData(localBox.extents, &localBox.rot); +} + +template +static PX_FORCE_INLINE void setupBoxParams(ParamsT* PX_RESTRICT params, const Box& localBox, const BV4Tree* PX_RESTRICT tree, const TetrahedronSourceMesh* PX_RESTRICT mesh) +{ + invertBoxMatrix(params->mRModelToBox_Padded, params->mTModelToBox_Padded, localBox); + params->mTBoxToModel_PaddedAligned = localBox.center; + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + + params->precomputeBoxData(localBox.extents, &localBox.rot); +} + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamNoOrder_OBBOBB.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_SwizzledNoOrder.h" +#endif + +#define GU_BV4_PROCESS_STREAM_NO_ORDER +#include "GuBV4_Internal.h" + +PxIntBool BV4_OverlapBoxAny(const Box& box, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned) +{ + const SourceMesh* PX_RESTRICT mesh =static_cast(tree.mMeshInterface); + + Box localBox; + computeLocalBox(localBox, box, worldm_Aligned); + + OBBParams Params; + setupBoxParams(&Params, localBox, &tree, mesh); + + if(tree.mNodes) + return processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbPrimitives(); + PX_ASSERT(nbTris<16); + return LeafFunction_BoxOverlapAny::doLeafTest(&Params, nbTris); + } +} + + +// Box overlap all + +struct OBBParamsAll : OBBParams +{ + PxU32 mNbHits; + PxU32 mMaxNbHits; + PxU32* mHits; +}; + +namespace +{ +class LeafFunction_BoxOverlapAll +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(OBBParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + if(intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + OBBParamsAll* ParamsAll = static_cast(params); + if(ParamsAll->mNbHits==ParamsAll->mMaxNbHits) + return 1; + ParamsAll->mHits[ParamsAll->mNbHits] = primIndex; + ParamsAll->mNbHits++; + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +} + +PxU32 BV4_OverlapBoxAll(const Box& box, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + Box localBox; + computeLocalBox(localBox, box, worldm_Aligned); + + OBBParamsAll Params; + Params.mNbHits = 0; + Params.mMaxNbHits = size; + Params.mHits = results; + setupBoxParams(&Params, localBox, &tree, mesh); + + if(tree.mNodes) + overflow = processStreamNoOrder(tree, &Params)!=0; + else + { + const PxU32 nbTris = mesh->getNbPrimitives(); + PX_ASSERT(nbTris<16); + overflow = LeafFunction_BoxOverlapAll::doLeafTest(&Params, nbTris)!=0; + } + return Params.mNbHits; +} + +// Box overlap - callback version + +struct OBBParamsCB : OBBParams +{ + MeshOverlapCallback mCallback; + void* mUserData; +}; + +struct OBBTetParamsCB : OBBTetParams +{ + TetMeshOverlapCallback mCallback; + void* mUserData; +}; + +namespace +{ +class LeafFunction_BoxOverlapCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const OBBParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + + do + { + + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + if (intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + if ((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], primIndex, vrefs)) + return 1; + } + + primIndex++; + }while(nbToGo--); + + return 0; + } + + static PX_FORCE_INLINE PxIntBool doLeafTest(const OBBTetParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2, VRef3; + getVertexReferences(VRef0, VRef1, VRef2, VRef3, primIndex, params->mTets32, params->mTets16); + + if (intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + const PxU32 vrefs[4] = { VRef0, VRef1, VRef2, VRef3}; + if ((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mVerts[VRef3], primIndex, vrefs)) + return 1; + } + + if (intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef3], params->mVerts[VRef1], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + const PxU32 vrefs[4] = { VRef0, VRef1, VRef2, VRef3 }; + if ((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mVerts[VRef3], primIndex, vrefs)) + return 1; + } + + if (intersectTriangleBoxBV4(params->mVerts[VRef1], params->mVerts[VRef3], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + const PxU32 vrefs[4] = { VRef0, VRef1, VRef2, VRef3 }; + if ((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mVerts[VRef3], primIndex, vrefs)) + return 1; + } + + if (intersectTriangleBoxBV4(params->mVerts[VRef0], params->mVerts[VRef3], params->mVerts[VRef2], params->mRModelToBox_Padded, params->mTModelToBox_Padded, params->mBoxExtents_PaddedAligned)) + { + const PxU32 vrefs[4] = { VRef0, VRef1, VRef2, VRef3 }; + if ((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params->mVerts[VRef3], primIndex, vrefs)) + return 1; + } + primIndex++; + } while (nbToGo--); + + return 0; + } +}; +} + +void BV4_OverlapBoxCB(const Box& localBox, const BV4Tree& tree, MeshOverlapCallback callback, void* userData) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + OBBParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupBoxParams(&Params, localBox, &tree, mesh); + + if(tree.mNodes) + processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbPrimitives(); + PX_ASSERT(nbTris<16); + LeafFunction_BoxOverlapCB::doLeafTest(&Params, nbTris); + } +} + +void BV4_OverlapBoxCB(const Box& localBox, const BV4Tree& tree, TetMeshOverlapCallback callback, void* userData) +{ + const TetrahedronSourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + OBBTetParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupBoxParams(&Params, localBox, &tree, mesh); + + if (tree.mNodes) + processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTetrahedrons = mesh->getNbTetrahedrons(); + PX_ASSERT(nbTetrahedrons<16); + LeafFunction_BoxOverlapCB::doLeafTest(&Params, nbTetrahedrons); + } +} + +// Capsule overlap any + +struct CapsuleParamsAny : OBBParams +{ + Capsule mLocalCapsule; // Capsule in mesh space + CapsuleTriangleOverlapData mData; +}; + +// PT: TODO: try to refactor this one with the PhysX version (TA34704) +static bool CapsuleVsTriangle_SAT(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const CapsuleParamsAny* PX_RESTRICT params) +{ +// PX_ASSERT(capsule.p0!=capsule.p1); + + { + const PxReal d2 = distancePointSegmentSquaredInternal(params->mLocalCapsule.p0, params->mData.mCapsuleDir, p0); + if(d2<=params->mLocalCapsule.radius*params->mLocalCapsule.radius) + return 1; + } + + const PxVec3 N = (p0 - p1).cross(p0 - p2); + + if(!testAxis(p0, p1, p2, params->mLocalCapsule, N)) + return 0; + + const float BDotB = params->mData.mBDotB; + const float oneOverBDotB = params->mData.mOneOverBDotB; + const PxVec3& capP0 = params->mLocalCapsule.p0; + const PxVec3& capDir = params->mData.mCapsuleDir; + + if(!testAxis(p0, p1, p2, params->mLocalCapsule, computeEdgeAxis(p0, p1 - p0, capP0, capDir, BDotB, oneOverBDotB))) + return 0; + + if(!testAxis(p0, p1, p2, params->mLocalCapsule, computeEdgeAxis(p1, p2 - p1, capP0, capDir, BDotB, oneOverBDotB))) + return 0; + + if(!testAxis(p0, p1, p2, params->mLocalCapsule, computeEdgeAxis(p2, p0 - p2, capP0, capDir, BDotB, oneOverBDotB))) + return 0; + + return 1; +} + +static PxIntBool PX_FORCE_INLINE capsuleTriangle(const CapsuleParamsAny* PX_RESTRICT params, PxU32 primIndex) +{ + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + return CapsuleVsTriangle_SAT(params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params); +} + +namespace +{ +class LeafFunction_CapsuleOverlapAny +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const OBBParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(capsuleTriangle(static_cast(params), primIndex)) + return 1; + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +template +static PX_FORCE_INLINE void setupCapsuleParams(ParamsT* PX_RESTRICT params, const Capsule& capsule, const BV4Tree* PX_RESTRICT tree, const PxMat44* PX_RESTRICT worldm_Aligned, const SourceMesh* PX_RESTRICT mesh) +{ + computeLocalCapsule(params->mLocalCapsule, capsule, worldm_Aligned); + + params->mData.init(params->mLocalCapsule); + + Box localBox; + computeBoxAroundCapsule(params->mLocalCapsule, localBox); + + setupBoxParams(params, localBox, tree, mesh); +} + +PxIntBool BV4_OverlapCapsuleAny(const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleParamsAny Params; + setupCapsuleParams(&Params, capsule, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + return processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + return LeafFunction_CapsuleOverlapAny::doLeafTest(&Params, nbTris); + } +} + + +// Capsule overlap all + +struct CapsuleParamsAll : CapsuleParamsAny +{ + PxU32 mNbHits; + PxU32 mMaxNbHits; + PxU32* mHits; +}; + +namespace +{ +class LeafFunction_CapsuleOverlapAll +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(OBBParams* PX_RESTRICT params, PxU32 primIndex) + { + CapsuleParamsAll* ParamsAll = static_cast(params); + + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(capsuleTriangle(ParamsAll, primIndex)) + { + if(ParamsAll->mNbHits==ParamsAll->mMaxNbHits) + return 1; + ParamsAll->mHits[ParamsAll->mNbHits] = primIndex; + ParamsAll->mNbHits++; + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +PxU32 BV4_OverlapCapsuleAll(const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleParamsAll Params; + Params.mNbHits = 0; + Params.mMaxNbHits = size; + Params.mHits = results; + setupCapsuleParams(&Params, capsule, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + overflow = processStreamNoOrder(tree, &Params)!=0; + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + overflow = LeafFunction_CapsuleOverlapAll::doLeafTest(&Params, nbTris)!=0; + } + return Params.mNbHits; +} + +// Capsule overlap - callback version + +struct CapsuleParamsCB : CapsuleParamsAny +{ + MeshOverlapCallback mCallback; + void* mUserData; +}; + +namespace +{ +class LeafFunction_CapsuleOverlapCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const CapsuleParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + if(CapsuleVsTriangle_SAT(p0, p1, p2, params)) + { + const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + if((params->mCallback)(params->mUserData, p0, p1, p2, primIndex, vrefs)) + return 1; + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: this one is currently not used +void BV4_OverlapCapsuleCB(const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshOverlapCallback callback, void* userData) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupCapsuleParams(&Params, capsule, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + LeafFunction_CapsuleOverlapCB::doLeafTest(&Params, nbTris); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap_Internal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap_Internal.h new file mode 100644 index 0000000..44f99ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxOverlap_Internal.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_BOX_OVERLAP_INTERNAL_H +#define GU_BV4_BOX_OVERLAP_INTERNAL_H + +#include "GuBV4_Common.h" + + template + PX_FORCE_INLINE void precomputeData(ParamsT* PX_RESTRICT dst, PxMat33* PX_RESTRICT absRot, const PxMat33* PX_RESTRICT boxToModelR) + { + // Precompute absolute box-to-model rotation matrix + dst->mPreca0_PaddedAligned.x = boxToModelR->column0.x; + dst->mPreca0_PaddedAligned.y = boxToModelR->column1.y; + dst->mPreca0_PaddedAligned.z = boxToModelR->column2.z; + + dst->mPreca1_PaddedAligned.x = boxToModelR->column0.y; + dst->mPreca1_PaddedAligned.y = boxToModelR->column1.z; + dst->mPreca1_PaddedAligned.z = boxToModelR->column2.x; + + dst->mPreca2_PaddedAligned.x = boxToModelR->column0.z; + dst->mPreca2_PaddedAligned.y = boxToModelR->column1.x; + dst->mPreca2_PaddedAligned.z = boxToModelR->column2.y; + + // Epsilon value prevents floating-point inaccuracies (strategy borrowed from RAPID) + const PxReal epsilon = 1e-6f; + absRot->column0.x = dst->mPreca0b_PaddedAligned.x = epsilon + fabsf(boxToModelR->column0.x); + absRot->column0.y = dst->mPreca1b_PaddedAligned.x = epsilon + fabsf(boxToModelR->column0.y); + absRot->column0.z = dst->mPreca2b_PaddedAligned.x = epsilon + fabsf(boxToModelR->column0.z); + + absRot->column1.x = dst->mPreca2b_PaddedAligned.y = epsilon + fabsf(boxToModelR->column1.x); + absRot->column1.y = dst->mPreca0b_PaddedAligned.y = epsilon + fabsf(boxToModelR->column1.y); + absRot->column1.z = dst->mPreca1b_PaddedAligned.y = epsilon + fabsf(boxToModelR->column1.z); + + absRot->column2.x = dst->mPreca1b_PaddedAligned.z = epsilon + fabsf(boxToModelR->column2.x); + absRot->column2.y = dst->mPreca2b_PaddedAligned.z = epsilon + fabsf(boxToModelR->column2.y); + absRot->column2.z = dst->mPreca0b_PaddedAligned.z = epsilon + fabsf(boxToModelR->column2.z); + } + + template + PX_FORCE_INLINE void setupBoxData(ParamsT* PX_RESTRICT dst, const PxVec3& extents, const PxMat33* PX_RESTRICT mAR) + { + dst->mBoxExtents_PaddedAligned = extents; + + const float Ex = extents.x; + const float Ey = extents.y; + const float Ez = extents.z; + dst->mBB_PaddedAligned.x = Ex*mAR->column0.x + Ey*mAR->column1.x + Ez*mAR->column2.x; + dst->mBB_PaddedAligned.y = Ex*mAR->column0.y + Ey*mAR->column1.y + Ez*mAR->column2.y; + dst->mBB_PaddedAligned.z = Ex*mAR->column0.z + Ey*mAR->column1.z + Ez*mAR->column2.z; + } + + struct OBBTestParams // Data needed to perform the OBB-OBB overlap test + { + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mTBoxToModel_PaddedAligned); //!< Translation from obb space to model space + BV4_ALIGN16(PxVec3p mBB_PaddedAligned); + BV4_ALIGN16(PxVec3p mBoxExtents_PaddedAligned); + + BV4_ALIGN16(PxVec3p mPreca0_PaddedAligned); + BV4_ALIGN16(PxVec3p mPreca1_PaddedAligned); + BV4_ALIGN16(PxVec3p mPreca2_PaddedAligned); + BV4_ALIGN16(PxVec3p mPreca0b_PaddedAligned); + BV4_ALIGN16(PxVec3p mPreca1b_PaddedAligned); + BV4_ALIGN16(PxVec3p mPreca2b_PaddedAligned); + + PX_FORCE_INLINE void precomputeBoxData(const PxVec3& extents, const PxMat33* PX_RESTRICT box_to_model) + { + PxMat33 absRot; //!< Absolute rotation matrix + precomputeData(this, &absRot, box_to_model); + + setupBoxData(this, extents, &absRot); + } + }; + +#endif // GU_BV4_BOX_OVERLAP_INTERNAL_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Internal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Internal.h new file mode 100644 index 0000000..c386596 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Internal.h @@ -0,0 +1,517 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepTriangleUtils.h" +#include "GuSweepBoxTriangle_FeatureBased.h" +#include "GuSweepBoxTriangle_SAT.h" +#include "GuBV4_BoxOverlap_Internal.h" + +// PT: for box-sweeps please refer to %SDKRoot%\InternalDocumentation\GU\Sweep strategies.ppt. +// We use: +// - method 3 if the box is an AABB (SWEEP_AABB_IMPL is defined) +// - method 2 if the box is an OBB (SWEEP_AABB_IMPL is undefined) + +#ifdef SWEEP_AABB_IMPL + // PT: TODO: refactor structure (TA34704) + struct RayParams + { + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); + #ifndef GU_BV4_USE_SLABS + BV4_ALIGN16(PxVec3p mData2_PaddedAligned); + BV4_ALIGN16(PxVec3p mFDir_PaddedAligned); + BV4_ALIGN16(PxVec3p mData_PaddedAligned); + BV4_ALIGN16(PxVec3p mLocalDir_PaddedAligned); + #endif + BV4_ALIGN16(PxVec3p mOrigin_Padded); // PT: TODO: this one could be switched to PaddedAligned & V4LoadA (TA34704) + }; + + #include "GuBV4_AABBAABBSweepTest.h" +#else + #include "GuBV4_BoxBoxOverlapTest.h" +#endif + +#include "GuBV4_BoxSweep_Params.h" + +static PX_FORCE_INLINE Vec4V multiply3x3V(const Vec4V p, const PxMat33& mat_Padded) +{ + const FloatV xxxV = V4GetX(p); + const FloatV yyyV = V4GetY(p); + const FloatV zzzV = V4GetZ(p); + + Vec4V ResV = V4Scale(V4LoadU_Safe(&mat_Padded.column0.x), xxxV); + ResV = V4Add(ResV, V4Scale(V4LoadU_Safe(&mat_Padded.column1.x), yyyV)); + ResV = V4Add(ResV, V4Scale(V4LoadU_Safe(&mat_Padded.column2.x), zzzV)); + + return ResV; +} + +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static bool /*__fastcall*/ triBoxSweep(BoxSweepParams* PX_RESTRICT params, PxU32 primIndex, bool nodeSorting=true) +{ + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + // Don't bother doing the actual sweep test if the triangle is too far away + if(1) + { + const float dp0 = p0.dot(params->mLocalDir_Padded); + const float dp1 = p1.dot(params->mLocalDir_Padded); + const float dp2 = p2.dot(params->mLocalDir_Padded); + + float TriMin = PxMin(dp0, dp1); + TriMin = PxMin(TriMin, dp2); + + if(TriMin >= params->mOffset + params->mStabbedFace.mDistance) + return false; + } + + PxTrianglePadded triBoxSpace; + const Vec4V transModelToBoxV = V4LoadU_Safe(¶ms->mTModelToBox_Padded.x); + const Vec4V v0V = V4Add(multiply3x3V(V4LoadU_Safe(&p0.x), params->mRModelToBox_Padded), transModelToBoxV); + V4StoreU_Safe(v0V, &triBoxSpace.verts[0].x); + const Vec4V v1V = V4Add(multiply3x3V(V4LoadU_Safe(&p1.x), params->mRModelToBox_Padded), transModelToBoxV); + V4StoreU_Safe(v1V, &triBoxSpace.verts[1].x); + const Vec4V v2V = V4Add(multiply3x3V(V4LoadU_Safe(&p2.x), params->mRModelToBox_Padded), transModelToBoxV); + V4StoreU_Safe(v2V, &triBoxSpace.verts[2].x); + + float Dist; + if(triBoxSweepTestBoxSpace_inlined(triBoxSpace, params->mOriginalExtents_Padded, params->mOriginalDir_Padded*params->mStabbedFace.mDistance, params->mOneOverDir_Padded, 1.0f, Dist, params->mBackfaceCulling)) + { + // PT: TODO: these muls & divs may not be needed at all - we just pass the unit dir/inverse dir to the sweep code. Revisit. (TA34704) + Dist *= params->mStabbedFace.mDistance; + params->mOneOverDir_Padded = params->mOneOverOriginalDir / Dist; + params->mStabbedFace.mDistance = Dist; + params->mStabbedFace.mTriangleID = primIndex; + // PT: TODO: revisit this (TA34704) + params->mP0 = triBoxSpace.verts[0]; + params->mP1 = triBoxSpace.verts[1]; + params->mP2 = triBoxSpace.verts[2]; +// V4StoreU_Safe(v0V, ¶ms->mP0.x); +// V4StoreU_Safe(v1V, ¶ms->mP1.x); +// V4StoreU_Safe(v2V, ¶ms->mP2.x); + + if(nodeSorting) + { +#ifdef SWEEP_AABB_IMPL + #ifndef GU_BV4_USE_SLABS + setupRayData(params, Dist, params->mOrigin_Padded, params->mLocalDir_PaddedAligned); + #endif +#else + params->ShrinkOBB(Dist); +#endif + } + return true; + } + return false; +} + +namespace +{ +class LeafFunction_BoxSweepClosest +{ +public: + static PX_FORCE_INLINE void doLeafTest(BoxSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + triBoxSweep(params, primIndex); + primIndex++; + }while(nbToGo--); + } +}; + +class LeafFunction_BoxSweepAny +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(BoxSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triBoxSweep(params, primIndex)) + return 1; + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: TODO: refactor with sphere/capsule versions (TA34704) +static PX_FORCE_INLINE bool computeImpactData(const Box& box, const PxVec3& dir, SweepHit* PX_RESTRICT hit, const BoxSweepParams* PX_RESTRICT params, bool isDoubleSided, bool meshBothSides) +{ + if(params->mStabbedFace.mTriangleID==PX_INVALID_U32) + return false; // We didn't touch any triangle + + if(hit) + { + const float t = params->mStabbedFace.mDistance; + hit->mTriangleID = params->mStabbedFace.mTriangleID; + hit->mDistance = t; + + if(t==0.0f) + { + hit->mPos = PxVec3(0.0f); + hit->mNormal = -dir; + } + else + { + // PT: TODO: revisit/optimize/use this (TA34704) + const PxTriangle triInBoxSpace(params->mP0, params->mP1, params->mP2); + PxHitFlags outFlags = PxHitFlag::Enum(0); + computeBoxLocalImpact(hit->mPos, hit->mNormal, outFlags, box, params->mOriginalDir_Padded, triInBoxSpace, PxHitFlag::ePOSITION|PxHitFlag::eNORMAL, isDoubleSided, meshBothSides, t); + } + } + return true; +} + +template +static PX_FORCE_INLINE void setupBoxSweepParams(ParamsT* PX_RESTRICT params, const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree* PX_RESTRICT tree, const SourceMesh* PX_RESTRICT mesh, PxU32 flags) +{ + params->mStabbedFace.mTriangleID = PX_INVALID_U32; + setupParamsFlags(params, flags); + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + + prepareSweepData(localBox, localDir, maxDist, params); + +#ifdef SWEEP_AABB_IMPL + params->mOrigin_Padded = localBox.center; + #ifndef GU_BV4_USE_SLABS + params->mLocalDir_PaddedAligned = localDir; + setupRayData(params, maxDist, localBox.center, localDir); + #endif +#endif +} + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#ifdef SWEEP_AABB_IMPL + #include "GuBV4_ProcessStreamOrdered_SegmentAABB_Inflated.h" + #include "GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h" + #ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_KajiyaNoOrder.h" + #include "GuBV4_Slabs_KajiyaOrdered.h" + #endif +#else + #include "GuBV4_ProcessStreamOrdered_OBBOBB.h" + #include "GuBV4_ProcessStreamNoOrder_OBBOBB.h" + #ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_SwizzledNoOrder.h" + #include "GuBV4_Slabs_SwizzledOrdered.h" + #endif +#endif + +#ifdef SWEEP_AABB_IMPL + #define GU_BV4_PROCESS_STREAM_RAY_NO_ORDER + #define GU_BV4_PROCESS_STREAM_RAY_ORDERED +#else + #define GU_BV4_PROCESS_STREAM_NO_ORDER + #define GU_BV4_PROCESS_STREAM_ORDERED +#endif +#include "GuBV4_Internal.h" + +#ifdef SWEEP_AABB_IMPL +PxIntBool Sweep_AABB_BV4(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags) +#else +PxIntBool Sweep_OBB_BV4(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags) +#endif +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + BoxSweepParams Params; + setupBoxSweepParams(&Params, localBox, localDir, maxDist, &tree, mesh, flags); + + if(tree.mNodes) + { +#ifdef SWEEP_AABB_IMPL + if(Params.mEarlyExit) + processStreamRayNoOrder<1, LeafFunction_BoxSweepAny>(tree, &Params); + else + processStreamRayOrdered<1, LeafFunction_BoxSweepClosest>(tree, &Params); +#else + if(Params.mEarlyExit) + processStreamNoOrder(tree, &Params); + else + processStreamOrdered(tree, &Params); +#endif + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); + + return computeImpactData(localBox, localDir, hit, &Params, (flags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (flags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); +} + + + +// PT: box sweep callback version - currently not used + +namespace +{ + struct BoxSweepParamsCB : BoxSweepParams + { + // PT: these new members are only here to call computeImpactData during traversal :( + // PT: TODO: most of them may not be needed + Box mBoxCB; // Box in original space (maybe not local/mesh space) + PxVec3 mDirCB; // Dir in original space (maybe not local/mesh space) + const PxMat44* mWorldm_Aligned; + PxU32 mFlags; + + SweepUnlimitedCallback mCallback; + void* mUserData; + float mMaxDist; + bool mNodeSorting; + }; + +class LeafFunction_BoxSweepCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(BoxSweepParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triBoxSweep(params, primIndex, params->mNodeSorting)) + { + // PT: TODO: in this version we must compute the impact data immediately, + // which is a terrible idea in general, but I'm not sure what else I can do. + SweepHit hit; + const bool b = computeImpactData(params->mBoxCB, params->mDirCB, &hit, params, (params->mFlags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (params->mFlags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); + PX_ASSERT(b); + + // PT: then replicate part from BV4_BoxSweepSingle: + if(b && params->mWorldm_Aligned) + { + // Move to world space + // PT: TODO: optimize (TA34704) + hit.mPos = params->mWorldm_Aligned->transform(hit.mPos); + hit.mNormal = params->mWorldm_Aligned->rotate(hit.mNormal); + } + + reportUnlimitedCallbackHit(params, hit); + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +} + +// PT: for design decisions in this function, refer to the comments of BV4_GenericSweepCB(). +// PT: 'worldm_Aligned' is only here to move back results to world space, but input is already in local space. +#ifdef SWEEP_AABB_IMPL +void Sweep_AABB_BV4_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting) +#else +void Sweep_OBB_BV4_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting) +#endif +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + BoxSweepParamsCB Params; + Params.mBoxCB = localBox; + Params.mDirCB = localDir; + Params.mWorldm_Aligned = worldm_Aligned; + Params.mFlags = flags; + + Params.mCallback = callback; + Params.mUserData = userData; + Params.mMaxDist = maxDist; + Params.mNodeSorting = nodeSorting; + setupBoxSweepParams(&Params, localBox, localDir, maxDist, &tree, mesh, flags); + + PX_ASSERT(!Params.mEarlyExit); + + if(tree.mNodes) + { + if(nodeSorting) + { +#ifdef SWEEP_AABB_IMPL + processStreamRayOrdered<1, LeafFunction_BoxSweepCB>(tree, &Params); +#else + processStreamOrdered(tree, &Params); +#endif + } + else + { +#ifdef SWEEP_AABB_IMPL + processStreamRayNoOrder<1, LeafFunction_BoxSweepCB>(tree, &Params); +#else + processStreamNoOrder(tree, &Params); +#endif + } + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); +} + + + + +// New callback-based box sweeps. Reuses code above, allow early exits. Some init code may be done in vain +// since the leaf tests are not performed (we don't do box-sweeps-vs-tri since the box is only a BV around +// the actual shape, say a convex) + +namespace +{ +struct GenericSweepParamsCB : BoxSweepParams +{ + MeshSweepCallback mCallback; + void* mUserData; +}; + +class LeafFunction_BoxSweepClosestCB +{ +public: + static PX_FORCE_INLINE void doLeafTest(GenericSweepParamsCB* PX_RESTRICT params, PxU32 prim_index) + { + PxU32 nbToGo = getNbPrimitives(prim_index); + do + { + // PT: in the regular version we'd do a box-vs-triangle sweep test here + // Instead we just grab the triangle and send it to the callback + // + // This can be used for regular "closest hit" sweeps, when the scale is not identity or + // when the box is just around a more complex shape (e.g. convex). In this case we want + // the calling code to compute a convex-triangle distance, and then we want to shrink + // the ray/box while doing an ordered traversal. + // + // For "sweep all" or "sweep any" purposes we want to either report all hits or early exit + // as soon as we find one. There is no need for shrinking or ordered traversals here. + + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, prim_index, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + // Don't bother doing the actual sweep test if the triangle is too far away + const float dp0 = p0.dot(params->mLocalDir_Padded); + const float dp1 = p1.dot(params->mLocalDir_Padded); + const float dp2 = p2.dot(params->mLocalDir_Padded); + + float TriMin = PxMin(dp0, dp1); + TriMin = PxMin(TriMin, dp2); + + if(TriMin < params->mOffset + params->mStabbedFace.mDistance) + { +// const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + float Dist = params->mStabbedFace.mDistance; + if((params->mCallback)(params->mUserData, p0, p1, p2, prim_index, /*vrefs,*/ Dist)) + return; // PT: TODO: we return here but the ordered path doesn't really support early exits (TA34704) + + if(DistmStabbedFace.mDistance) + { + params->mStabbedFace.mDistance = Dist; + params->mStabbedFace.mTriangleID = prim_index; +#ifdef SWEEP_AABB_IMPL + #ifndef GU_BV4_USE_SLABS + setupRayData(params, Dist, params->mOrigin_Padded, params->mLocalDir_PaddedAligned); + #endif +#else + params->ShrinkOBB(Dist); +#endif + } + } + + prim_index++; + }while(nbToGo--); + } +}; + +class LeafFunction_BoxSweepAnyCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(GenericSweepParamsCB* PX_RESTRICT params, PxU32 prim_index) + { + PxU32 nbToGo = getNbPrimitives(prim_index); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, prim_index, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + { +// const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + float Dist = params->mStabbedFace.mDistance; + if((params->mCallback)(params->mUserData, p0, p1, p2, prim_index, /*vrefs,*/ Dist)) + return 1; + } + + prim_index++; + }while(nbToGo--); + + return 0; + } +}; +} + +#ifdef SWEEP_AABB_IMPL +void GenericSweep_AABB_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, MeshSweepCallback callback, void* userData, PxU32 flags) +#else +void GenericSweep_OBB_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, MeshSweepCallback callback, void* userData, PxU32 flags) +#endif +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + GenericSweepParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupBoxSweepParams(&Params, localBox, localDir, maxDist, &tree, mesh, flags); + + if(tree.mNodes) + { +#ifdef SWEEP_AABB_IMPL + if(Params.mEarlyExit) + processStreamRayNoOrder<1, LeafFunction_BoxSweepAnyCB>(tree, &Params); + else + processStreamRayOrdered<1, LeafFunction_BoxSweepClosestCB>(tree, &Params); +#else + if(Params.mEarlyExit) + processStreamNoOrder(tree, &Params); + else + processStreamOrdered(tree, &Params); +#endif + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Params.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Params.h new file mode 100644 index 0000000..88f1883 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_BoxSweep_Params.h @@ -0,0 +1,210 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This is used by the box-sweep & capsule-sweep code + +#if PX_VC + #pragma warning(disable: 4505) // unreferenced local function has been removed +#endif + +#include "foundation/PxBasicTemplates.h" + +namespace +{ +#ifdef SWEEP_AABB_IMPL +struct BoxSweepParams : RayParams +#else +struct BoxSweepParams : OBBTestParams +#endif +{ + const IndTri32* PX_RESTRICT mTris32; + const IndTri16* PX_RESTRICT mTris16; + const PxVec3* PX_RESTRICT mVerts; + +#ifndef SWEEP_AABB_IMPL + Box mLocalBox; +#endif + PxVec3 mLocalDir_Padded; + RaycastHitInternal mStabbedFace; + + PxU32 mBackfaceCulling; + PxU32 mEarlyExit; + + PxVec3 mP0, mP1, mP2; + PxVec3 mBestTriNormal; + + float mOffset; + PxVec3 mProj; + PxVec3 mDP; + +#ifndef SWEEP_AABB_IMPL + PxMat33 mAR; //!< Absolute rotation matrix +#endif + + PxMat33 mRModelToBox_Padded; //!< Rotation from model space to obb space + PxVec3 mTModelToBox_Padded; //!< Translation from model space to obb space + PxVec3 mOriginalExtents_Padded; + PxVec3 mOriginalDir_Padded; + PxVec3 mOneOverDir_Padded; + PxVec3 mOneOverOriginalDir; + +#ifndef SWEEP_AABB_IMPL + PX_FORCE_INLINE void ShrinkOBB(float d) + { + const PxVec3 BoxExtents = mDP + d * mProj; + mTBoxToModel_PaddedAligned = mLocalBox.center + mLocalDir_Padded*d*0.5f; + + setupBoxData(this, BoxExtents, &mAR); + } +#endif +}; +} + +// PT: TODO: check asm again in PhysX version, compare to original (TA34704) +static void prepareSweepData(const Box& box, const PxVec3& dir, float maxDist, BoxSweepParams* PX_RESTRICT params) +{ + invertBoxMatrix(params->mRModelToBox_Padded, params->mTModelToBox_Padded, box); + + params->mOriginalExtents_Padded = box.extents; + + const PxVec3 OriginalDir = params->mRModelToBox_Padded.transform(dir); + params->mOriginalDir_Padded = OriginalDir; + + const PxVec3 OneOverOriginalDir(OriginalDir.x!=0.0f ? 1.0f/OriginalDir.x : 0.0f, + OriginalDir.y!=0.0f ? 1.0f/OriginalDir.y : 0.0f, + OriginalDir.z!=0.0f ? 1.0f/OriginalDir.z : 0.0f); + + params->mOneOverOriginalDir = OneOverOriginalDir; + params->mOneOverDir_Padded = OneOverOriginalDir / maxDist; + + { + const Box& LocalBox = box; + const PxVec3& LocalDir = dir; + + params->mLocalDir_Padded = LocalDir; + params->mStabbedFace.mDistance = maxDist; +#ifndef SWEEP_AABB_IMPL + params->mLocalBox = LocalBox; // PT: TODO: check asm for operator= +#endif + + PxMat33 boxToModelR; + + // Original code: + // OBB::CreateOBB(LocalBox, LocalDir, 0.5f) + { + PxVec3 R1, R2; + { + float dd[3]; + dd[0] = fabsf(LocalBox.rot.column0.dot(LocalDir)); + dd[1] = fabsf(LocalBox.rot.column1.dot(LocalDir)); + dd[2] = fabsf(LocalBox.rot.column2.dot(LocalDir)); + float dmax = dd[0]; + PxU32 ax0=1; + PxU32 ax1=2; + if(dd[1]>dmax) + { + dmax=dd[1]; + ax0=0; + ax1=2; + } + if(dd[2]>dmax) + { + dmax=dd[2]; + ax0=0; + ax1=1; + } + if(dd[ax1]mRBoxToModel + boxToModelR.column0 = LocalDir; + boxToModelR.column1 = R1; + boxToModelR.column2 = R2; + + // Original code: + // float Offset[3]; + // 0.5f comes from the Offset[r]*0.5f, doesn't mean 'd' is 0.5f + params->mProj.x = 0.5f; + params->mProj.y = LocalDir.dot(R1)*0.5f; + params->mProj.z = LocalDir.dot(R2)*0.5f; + + // Original code: + //mExtents[r] = Offset[r]*0.5f + fabsf(box.mRot[0]|R)*box.mExtents.x + fabsf(box.mRot[1]|R)*box.mExtents.y + fabsf(box.mRot[2]|R)*box.mExtents.z; + // => we store the first part of the computation, minus 'Offset[r]*0.5f' + for(PxU32 r=0;r<3;r++) + { + const PxVec3& R = boxToModelR[r]; + params->mDP[r] = fabsf(LocalBox.rot.column0.dot(R)*LocalBox.extents.x) + + fabsf(LocalBox.rot.column1.dot(R)*LocalBox.extents.y) + + fabsf(LocalBox.rot.column2.dot(R)*LocalBox.extents.z); + } + // In the original code, both mCenter & mExtents depend on 'd', and thus we will need to recompute these two members. + // + // For mExtents we have: + // + // float Offset[3]; + // Offset[0] = d; + // Offset[1] = d*(dir|R1); + // Offset[2] = d*(dir|R2); + // + // mExtents[r] = Offset[r]*0.5f + fabsf(box.mRot[0]|R)*box.mExtents.x + fabsf(box.mRot[1]|R)*box.mExtents.y + fabsf(box.mRot[2]|R)*box.mExtents.z; + // <=> mExtents[r] = Offset[r]*0.5f + Params.mDP[r]; We precompute the second part that doesn't depend on d, stored in mDP + // <=> mExtents[r] = Params.mProj[r]*d + Params.mDP[r]; We extract d from the first part, store what is left in mProj + // + // Thus in ShrinkOBB the code needed to update the extents is just: + // mBoxExtents = mDP + d * mProj; + // + // For mCenter we have: + // + // mCenter = box.mCenter + dir*d*0.5f; + // + // So we simply use this formula directly, with the new d. Result is stored in 'mTBoxToModel' +/* + PX_FORCE_INLINE void ShrinkOBB(float d) + { + mBoxExtents = mDP + d * mProj; + mTBoxToModel = mLocalBox.mCenter + mLocalDir*d*0.5f; +*/ + } + + // This one is for culling tris, unrelated to CreateOBB + params->mOffset = params->mDP.x + LocalBox.center.dot(LocalDir); + +#ifndef SWEEP_AABB_IMPL + precomputeData(params, ¶ms->mAR, &boxToModelR); + + params->ShrinkOBB(maxDist); +#endif + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp new file mode 100644 index 0000000..316e15c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep.cpp @@ -0,0 +1,171 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +#include "GuSweepSphereTriangle.h" +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#include "GuInternal.h" + +#include "GuBV4_BoxOverlap_Internal.h" +#include "GuBV4_BoxSweep_Params.h" + +namespace +{ + struct CapsuleSweepParams : BoxSweepParams + { + Capsule mLocalCapsule; + PxVec3 mCapsuleCenter; + PxVec3 mExtrusionDir; + float mBestAlignmentValue; + float mBestDistance; + float mMaxDist; + +// PX_FORCE_INLINE float getReportDistance() const { return mStabbedFace.mDistance; } + PX_FORCE_INLINE float getReportDistance() const { return mBestDistance; } + }; +} + +#include "GuBV4_CapsuleSweep_Internal.h" +#include "GuBV4_BoxBoxOverlapTest.h" + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamOrdered_OBBOBB.h" +#include "GuBV4_ProcessStreamNoOrder_OBBOBB.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_SwizzledNoOrder.h" + #include "GuBV4_Slabs_SwizzledOrdered.h" +#endif + +#define GU_BV4_PROCESS_STREAM_NO_ORDER +#define GU_BV4_PROCESS_STREAM_ORDERED +#include "GuBV4_Internal.h" + +PxIntBool BV4_CapsuleSweepSingle(const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleSweepParams Params; + setupCapsuleParams(&Params, capsule, dir, maxDist, &tree, mesh, flags); + + if(tree.mNodes) + { + if(Params.mEarlyExit) + processStreamNoOrder(tree, &Params); + else + processStreamOrdered(tree, &Params); + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); + + return computeImpactDataT(capsule, dir, hit, &Params, NULL, (flags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (flags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); +} + +// PT: capsule sweep callback version - currently not used + +namespace +{ + struct CapsuleSweepParamsCB : CapsuleSweepParams + { + // PT: these new members are only here to call computeImpactDataT during traversal :( + // PT: TODO: most of them may not be needed + // PT: TODO: for example mCapsuleCB probably dup of mLocalCapsule + Capsule mCapsuleCB; // Capsule in original space (maybe not local/mesh space) + PxVec3 mDirCB; // Dir in original space (maybe not local/mesh space) + const PxMat44* mWorldm_Aligned; + PxU32 mFlags; + + SweepUnlimitedCallback mCallback; + void* mUserData; + bool mNodeSorting; + }; + +class LeafFunction_CapsuleSweepCB +{ +public: + + static PX_FORCE_INLINE PxIntBool doLeafTest(CapsuleSweepParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triCapsuleSweep(params, primIndex, params->mNodeSorting)) + { + // PT: TODO: in this version we must compute the impact data immediately, + // which is a terrible idea in general, but I'm not sure what else I can do. + SweepHit hit; + const bool b = computeImpactDataT(params->mCapsuleCB, params->mDirCB, &hit, params, params->mWorldm_Aligned, (params->mFlags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (params->mFlags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); + PX_ASSERT(b); + PX_UNUSED(b); + + reportUnlimitedCallbackHit(params, hit); + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: for design decisions in this function, refer to the comments of BV4_GenericSweepCB(). +void BV4_CapsuleSweepCB(const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleSweepParamsCB Params; + Params.mCapsuleCB = capsule; + Params.mDirCB = dir; + Params.mWorldm_Aligned = worldm_Aligned; + Params.mFlags = flags; + + Params.mCallback = callback; + Params.mUserData = userData; + Params.mMaxDist = maxDist; + Params.mNodeSorting = nodeSorting; + setupCapsuleParams(&Params, capsule, dir, maxDist, &tree, mesh, flags); + + PX_ASSERT(!Params.mEarlyExit); + + if(tree.mNodes) + { + if(nodeSorting) + processStreamOrdered(tree, &Params); + else + processStreamNoOrder(tree, &Params); + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp new file mode 100644 index 0000000..9075905 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweepAA.cpp @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +#include "GuSweepSphereTriangle.h" +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#include "GuBV4_Common.h" +#include "GuInternal.h" + +#define SWEEP_AABB_IMPL + + // PT: TODO: refactor structure (TA34704) + struct RayParams + { + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); + #ifndef GU_BV4_USE_SLABS + BV4_ALIGN16(PxVec3p mData2_PaddedAligned); + BV4_ALIGN16(PxVec3p mFDir_PaddedAligned); + BV4_ALIGN16(PxVec3p mData_PaddedAligned); + BV4_ALIGN16(PxVec3p mLocalDir_PaddedAligned); + #endif + BV4_ALIGN16(PxVec3p mOrigin_Padded); // PT: TODO: this one could be switched to PaddedAligned & V4LoadA (TA34704) + }; + +#include "GuBV4_BoxSweep_Params.h" + +namespace +{ + struct CapsuleSweepParams : BoxSweepParams + { + Capsule mLocalCapsule; + PxVec3 mCapsuleCenter; + PxVec3 mExtrusionDir; + float mBestAlignmentValue; + float mBestDistance; + float mMaxDist; + +// PX_FORCE_INLINE float getReportDistance() const { return mStabbedFace.mDistance; } + PX_FORCE_INLINE float getReportDistance() const { return mBestDistance; } + }; +} + +#include "GuBV4_CapsuleSweep_Internal.h" +#include "GuBV4_AABBAABBSweepTest.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamOrdered_SegmentAABB_Inflated.h" +#include "GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_KajiyaNoOrder.h" + #include "GuBV4_Slabs_KajiyaOrdered.h" +#endif + +#define GU_BV4_PROCESS_STREAM_RAY_NO_ORDER +#define GU_BV4_PROCESS_STREAM_RAY_ORDERED +#include "GuBV4_Internal.h" + +PxIntBool BV4_CapsuleSweepSingleAA(const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + CapsuleSweepParams Params; + setupCapsuleParams(&Params, capsule, dir, maxDist, &tree, mesh, flags); + + if(tree.mNodes) + { + if(Params.mEarlyExit) + processStreamRayNoOrder<1, LeafFunction_CapsuleSweepAny>(tree, &Params); + else + processStreamRayOrdered<1, LeafFunction_CapsuleSweepClosest>(tree, &Params); + } + else + doBruteForceTests(mesh->getNbPrimitives(), &Params); + + return computeImpactDataT(capsule, dir, hit, &Params, NULL, (flags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (flags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep_Internal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep_Internal.h new file mode 100644 index 0000000..a30851d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_CapsuleSweep_Internal.h @@ -0,0 +1,442 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_CAPSULE_SWEEP_INTERNAL_H +#define GU_BV4_CAPSULE_SWEEP_INTERNAL_H + +// PT: for capsule-sweeps please refer to %SDKRoot%\InternalDocumentation\GU\Sweep strategies.ppt. +// We use: +// - method 3 if the capsule is axis-aligned (SWEEP_AABB_IMPL is defined) +// - method 2 otherwise (SWEEP_AABB_IMPL is undefined) + +// PT: TODO: get rid of that one +static PX_FORCE_INLINE bool sweepSphereVSTriangle( const PxVec3& center, const float radius, + const PxVec3* PX_RESTRICT triVerts, const PxVec3& triUnitNormal, + const PxVec3& unitDir, + float& curT, bool& directHit) +{ + float currentDistance; + if(!sweepSphereVSTri(triVerts, triUnitNormal, center, radius, unitDir, currentDistance, directHit, true)) + return false; + + // PT: using ">" or ">=" is enough to block the CCT or not in the DE5967 visual test. Change to ">=" if a repro is needed. + if(currentDistance > curT + GU_EPSILON_SAME_DISTANCE * PxMax(1.0f, curT)) + return false; + curT = currentDistance; + return true; +} + +static PX_FORCE_INLINE bool sweepSphereVSQuad( const PxVec3& center, const float radius, + const PxVec3* PX_RESTRICT quadVerts, const PxVec3& quadUnitNormal, + const PxVec3& unitDir, + float& curT) +{ + float currentDistance; + if(!sweepSphereVSQuad(quadVerts, quadUnitNormal, center, radius, unitDir, currentDistance)) + return false; + + // PT: using ">" or ">=" is enough to block the CCT or not in the DE5967 visual test. Change to ">=" if a repro is needed. + if(currentDistance > curT + GU_EPSILON_SAME_DISTANCE * PxMax(1.0f, curT)) + return false; + curT = currentDistance; + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static bool /*__fastcall*/ testTri( const CapsuleSweepParams* PX_RESTRICT params, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxVec3& N, + const PxVec3& unitDir, const float capsuleRadius, const float dpc0, float& curT, bool& status) +{ + // PT: TODO: check the assembly here (TA34704) + PxVec3 currentTri[3]; + // PT: TODO: optimize this copy (TA34704) + currentTri[0] = p0; + currentTri[1] = p1; + currentTri[2] = p2; + + // PT: beware, culling is only ok on the sphere I think + if(rejectTriangle(params->mCapsuleCenter, unitDir, curT, capsuleRadius, currentTri, dpc0)) + return false; + + float magnitude = N.magnitude(); + if(magnitude==0.0f) + return false; + + PxVec3 triNormal = N / magnitude; + + bool DirectHit; + if(sweepSphereVSTriangle(params->mCapsuleCenter, capsuleRadius, currentTri, triNormal, unitDir, curT, DirectHit)) + { + status = true; + } + return DirectHit; +} + +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static void /*__fastcall*/ testQuad(const CapsuleSweepParams* PX_RESTRICT params, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxVec3& p3, const PxVec3& N, + const PxVec3& unitDir, const float capsuleRadius, const float dpc0, float& curT, bool& status) +{ + // PT: TODO: optimize this copy (TA34704) + PxVec3 currentQuad[4]; + currentQuad[0] = p0; + currentQuad[1] = p1; + currentQuad[2] = p2; + currentQuad[3] = p3; + + // PT: beware, culling is only ok on the sphere I think + if(rejectQuad(params->mCapsuleCenter, unitDir, curT, capsuleRadius, currentQuad, dpc0)) + return; + + float magnitude = N.magnitude(); + if(magnitude==0.0f) + return; + + PxVec3 triNormal = N / magnitude; + + if(sweepSphereVSQuad(params->mCapsuleCenter, capsuleRadius, currentQuad, triNormal, unitDir, curT)) + { + status = true; + } +} + +static PX_FORCE_INLINE float Set2(const PxVec3& p0, const PxVec3& n, const PxVec3& p) +{ + return (p-p0).dot(n); +} + +static PX_FORCE_INLINE bool sweepCapsuleVsTriangle(const CapsuleSweepParams* PX_RESTRICT params, const PxTriangle& triangle, float& t, bool isDoubleSided, PxVec3& normal) +{ + const PxVec3& unitDir = params->mLocalDir_Padded; + + // Create triangle normal + PxVec3 denormalizedNormal = (triangle.verts[0] - triangle.verts[1]).cross(triangle.verts[0] - triangle.verts[2]); + + normal = denormalizedNormal; + + // Backface culling + const bool culled = denormalizedNormal.dot(unitDir) > 0.0f; + if(culled) + { + if(!isDoubleSided) + return false; + + denormalizedNormal = -denormalizedNormal; + } + + const float capsuleRadius = params->mLocalCapsule.radius; + float curT = params->mStabbedFace.mDistance;// + GU_EPSILON_SAME_DISTANCE*20.0f; + const float dpc0 = params->mCapsuleCenter.dot(unitDir); + + bool status = false; + + // Extrude mesh on the fly + const PxVec3 p0 = triangle.verts[0] - params->mExtrusionDir; + const PxVec3 p1 = triangle.verts[1+culled] - params->mExtrusionDir; + const PxVec3 p2 = triangle.verts[2-culled] - params->mExtrusionDir; + + const PxVec3 p0b = triangle.verts[0] + params->mExtrusionDir; + const PxVec3 p1b = triangle.verts[1+culled] + params->mExtrusionDir; + const PxVec3 p2b = triangle.verts[2-culled] + params->mExtrusionDir; + + const float extrusionSign = denormalizedNormal.dot(params->mExtrusionDir); + + const PxVec3 p2b_p1b = p2b - p1b; + const PxVec3 p0b_p1b = p0b - p1b; + const PxVec3 p2b_p2 = 2.0f * params->mExtrusionDir; + const PxVec3 p1_p1b = -p2b_p2; + + const PxVec3 N1 = p2b_p1b.cross(p0b_p1b); + const float dp0 = Set2(p0b, N1, params->mCapsuleCenter); + + const PxVec3 N2 = (p2 - p1).cross(p0 - p1); + const float dp1 = -Set2(p0, N2, params->mCapsuleCenter); + + bool directHit; + if(extrusionSign >= 0.0f) + directHit = testTri(params, p0b, p1b, p2b, N1, unitDir, capsuleRadius, dpc0, curT, status); + else + directHit = testTri(params, p0, p1, p2, N2, unitDir, capsuleRadius, dpc0, curT, status); + + const PxVec3 N3 = p2b_p1b.cross(p1_p1b); + const float dp2 = -Set2(p1, N3, params->mCapsuleCenter); + if(!directHit) + { + const float dp = N3.dot(unitDir); + if(dp*extrusionSign>=0.0f) + testQuad(params, p1, p1b, p2, p2b, N3, unitDir, capsuleRadius, dpc0, curT, status); + } + + const PxVec3 N5 = p2b_p2.cross(p0 - p2); + const float dp3 = -Set2(p0, N5, params->mCapsuleCenter); + if(!directHit) + { + const float dp = N5.dot(unitDir); + if(dp*extrusionSign>=0.0f) + testQuad(params, p2, p2b, p0, p0b, N5, unitDir, capsuleRadius, dpc0, curT, status); + } + + const PxVec3 N7 = p1_p1b.cross(p0b_p1b); + const float dp4 = -Set2(p0b, N7, params->mCapsuleCenter); + if(!directHit) + { + const float dp = N7.dot(unitDir); + if(dp*extrusionSign>=0.0f) + testQuad(params, p0, p0b, p1, p1b, N7, unitDir, capsuleRadius, dpc0, curT, status); + } + + if(1) + { + bool originInside = true; + if(extrusionSign<0.0f) + { + if(dp0<0.0f || dp1<0.0f || dp2<0.0f || dp3<0.0f || dp4<0.0f) + originInside = false; + } + else + { + if(dp0>0.0f || dp1>0.0f || dp2>0.0f || dp3>0.0f || dp4>0.0f) + originInside = false; + } + if(originInside) + { + t = 0.0f; + return true; + } + } + + if(!status) + return false; // We didn't touch any triangle + + t = curT; + + return true; +} + +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static bool /*__fastcall*/ triCapsuleSweep(CapsuleSweepParams* PX_RESTRICT params, PxU32 primIndex, bool nodeSorting=true) +{ + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + const PxTriangle Tri(p0, p1, p2); // PT: TODO: check calls to empty ctor/dtor here (TA34704) + + const bool isDoubleSided = params->mBackfaceCulling==0; + + float dist; + PxVec3 denormalizedNormal; + if(sweepCapsuleVsTriangle(params, Tri, dist, isDoubleSided, denormalizedNormal)) + { + denormalizedNormal.normalize(); + const PxReal alignmentValue = computeAlignmentValue(denormalizedNormal, params->mLocalDir_Padded); + + if(keepTriangle(dist, alignmentValue, params->mBestDistance, params->mBestAlignmentValue, params->mMaxDist)) + { + params->mStabbedFace.mDistance = dist; + params->mStabbedFace.mTriangleID = primIndex; + + params->mP0 = p0; + params->mP1 = p1; + params->mP2 = p2; + + params->mBestDistance = PxMin(params->mBestDistance, dist); // exact lower bound + params->mBestAlignmentValue = alignmentValue; + params->mBestTriNormal = denormalizedNormal; + + if(nodeSorting) + { +#ifdef SWEEP_AABB_IMPL + #ifndef GU_BV4_USE_SLABS + //setupRayData(params, dist, params->mOrigin_Padded, params->mLocalDir_PaddedAligned); + setupRayData(params, params->mBestDistance, params->mOrigin_Padded, params->mLocalDir_PaddedAligned); + #endif +#else + //params->ShrinkOBB(dist); + params->ShrinkOBB(params->mBestDistance); +#endif + } + return true; + } + /// + else if(keepTriangleBasic(dist, params->mBestDistance, params->mMaxDist)) + { + params->mStabbedFace.mDistance = dist; + params->mBestDistance = PxMin(params->mBestDistance, dist); // exact lower bound + } + /// + } + return false; +} + +#include "GuDistanceSegmentTriangleSIMD.h" + +namespace +{ +class LeafFunction_CapsuleSweepClosest +{ +public: + static PX_FORCE_INLINE void doLeafTest(CapsuleSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + triCapsuleSweep(params, primIndex); + primIndex++; + }while(nbToGo--); + } +}; + +class LeafFunction_CapsuleSweepAny +{ +public: + + static PX_FORCE_INLINE PxIntBool doLeafTest(CapsuleSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triCapsuleSweep(params, primIndex)) + return 1; + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +class ImpactFunctionCapsule +{ +public: + static PX_FORCE_INLINE void computeImpact(PxVec3& impactPos, PxVec3& impactNormal, const Capsule& capsule, const PxVec3& dir, const PxReal t, const PxTrianglePadded& triangle) + { + const PxVec3 delta = dir * t; + const PxVec3p P0 = capsule.p0 + delta; + const PxVec3p P1 = capsule.p1 + delta; + Vec3V pointOnSeg, pointOnTri; + distanceSegmentTriangleSquared( + // PT: we use PxVec3p so it is safe to V4LoadU P0 and P1 + V3LoadU_SafeReadW(P0), V3LoadU_SafeReadW(P1), + // PT: we use PxTrianglePadded so it is safe to V4LoadU the triangle vertices + V3LoadU_SafeReadW(triangle.verts[0]), V3LoadU_SafeReadW(triangle.verts[1]), V3LoadU_SafeReadW(triangle.verts[2]), + pointOnSeg, pointOnTri); + + PxVec3 localImpactPos, tmp; + V3StoreU(pointOnTri, localImpactPos); + V3StoreU(pointOnSeg, tmp); + + // PT: TODO: refactor with computeSphereTriImpactData (TA34704) + PxVec3 localImpactNormal = tmp - localImpactPos; + const float M = localImpactNormal.magnitude(); + if(M<1e-3f) + { + localImpactNormal = (triangle.verts[0] - triangle.verts[1]).cross(triangle.verts[0] - triangle.verts[2]); + localImpactNormal.normalize(); + } + else + localImpactNormal /= M; + + impactPos = localImpactPos; + impactNormal = localImpactNormal; + } +}; +} + +static void computeBoxAroundCapsule(const Capsule& capsule, Box& box, PxVec3& extrusionDir) +{ + // Box center = center of the two capsule's endpoints + box.center = capsule.computeCenter(); + + extrusionDir = (capsule.p0 - capsule.p1)*0.5f; + const PxF32 d = extrusionDir.magnitude(); + + // Box extents + box.extents.x = capsule.radius + d; + box.extents.y = capsule.radius; + box.extents.z = capsule.radius; + + // Box orientation + if(d==0.0f) + { + box.rot = PxMat33(PxIdentity); + } + else + { + PxVec3 dir, right, up; + PxComputeBasisVectors(capsule.p0, capsule.p1, dir, right, up); + box.setAxes(dir, right, up); + } +} + +template +static PX_FORCE_INLINE void setupCapsuleParams(ParamsT* PX_RESTRICT params, const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree* PX_RESTRICT tree, const SourceMesh* PX_RESTRICT mesh, PxU32 flags) +{ + params->mStabbedFace.mTriangleID = PX_INVALID_U32; + params->mBestAlignmentValue = 2.0f; + params->mBestDistance = maxDist + GU_EPSILON_SAME_DISTANCE; + params->mMaxDist = maxDist; + + setupParamsFlags(params, flags); + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + + params->mLocalCapsule = capsule; + + Box localBox; + computeBoxAroundCapsule(capsule, localBox, params->mExtrusionDir); + + params->mCapsuleCenter = localBox.center; + + const PxVec3& localDir = dir; + +#ifdef SWEEP_AABB_IMPL + const PxVec3& localP0 = params->mLocalCapsule.p0; + const PxVec3& localP1 = params->mLocalCapsule.p1; + const PxVec3 sweepOrigin = (localP0+localP1)*0.5f; + const PxVec3 sweepExtents = PxVec3(params->mLocalCapsule.radius) + (localP0-localP1).abs()*0.5f; + + #ifndef GU_BV4_USE_SLABS + params->mLocalDir_PaddedAligned = localDir; + #endif + params->mOrigin_Padded = sweepOrigin; + + const Box aabb(sweepOrigin, sweepExtents, PxMat33(PxIdentity)); + prepareSweepData(aabb, localDir, maxDist, params); // PT: TODO: optimize this call for idt rotation (TA34704) + + #ifndef GU_BV4_USE_SLABS + setupRayData(params, maxDist, sweepOrigin, localDir); + #endif +#else + prepareSweepData(localBox, localDir, maxDist, params); +#endif +} + +#endif // GU_BV4_CAPSULE_SWEEP_INTERNAL_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Common.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Common.h new file mode 100644 index 0000000..6a249ac --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Common.h @@ -0,0 +1,457 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_COMMON_H +#define GU_BV4_COMMON_H + +#include "foundation/PxMat44.h" +#include "geometry/PxTriangle.h" +#include "GuBox.h" +#include "GuSphere.h" +#include "GuCapsule.h" +#include "GuBV4.h" + +#define BV4_ALIGN16(x) PX_ALIGN_PREFIX(16) x PX_ALIGN_SUFFIX(16) + +namespace physx +{ +namespace Gu +{ + enum QueryModifierFlag + { + QUERY_MODIFIER_ANY_HIT = (1<<0), + QUERY_MODIFIER_DOUBLE_SIDED = (1<<1), + QUERY_MODIFIER_MESH_BOTH_SIDES = (1<<2) + }; + + template + PX_FORCE_INLINE void setupParamsFlags(ParamsT* PX_RESTRICT params, PxU32 flags) + { + params->mBackfaceCulling = (flags & (QUERY_MODIFIER_DOUBLE_SIDED|QUERY_MODIFIER_MESH_BOTH_SIDES)) ? 0 : 1u; + params->mEarlyExit = flags & QUERY_MODIFIER_ANY_HIT; + } + + enum HitCode + { + HIT_NONE = 0, //!< No hit + HIT_CONTINUE = 1, //!< Hit found, but keep looking for closer one + HIT_EXIT = 2 //!< Hit found, you can early-exit (raycast any) + }; + + class RaycastHitInternal : public physx::PxUserAllocated + { + public: + PX_FORCE_INLINE RaycastHitInternal() {} + PX_FORCE_INLINE ~RaycastHitInternal() {} + + float mDistance; + PxU32 mTriangleID; + }; + + class SweepHit : public physx::PxUserAllocated + { + public: + PX_FORCE_INLINE SweepHit() {} + PX_FORCE_INLINE ~SweepHit() {} + + PxU32 mTriangleID; //!< Index of touched face + float mDistance; //!< Impact distance + + PxVec3 mPos; + PxVec3 mNormal; + }; + + typedef HitCode (*MeshRayCallback) (void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, float dist, float u, float v); + typedef bool (*MeshOverlapCallback) (void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, const PxU32* vertexIndices); + typedef bool (*TetMeshOverlapCallback) (void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxVec3& p3, PxU32 tetIndex, const PxU32* vertexIndices); + typedef bool (*MeshSweepCallback) (void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, /*const PxU32* vertexIndices,*/ float& dist); + typedef bool (*SweepUnlimitedCallback) (void* userData, const SweepHit& hit); + + template + PX_FORCE_INLINE void reportUnlimitedCallbackHit(ParamsT* PX_RESTRICT params, const SweepHit& hit) + { + // PT: we can't reuse the MeshSweepCallback here since it's designed for doing the sweep test inside the callback + // (in the user's code) rather than inside the traversal code. So we use the SweepUnlimitedCallback instead to + // report the already fully computed hit to users. + // PT: TODO: this may not be very efficient, since computing the full hit is expensive. If we use this codepath + // to implement the Epic Tweak, the resulting code will not be optimal. + (params->mCallback)(params->mUserData, hit); + + // PT: the existing traversal code already shrunk the ray. For real "sweep all" calls we must undo that by reseting the max dist. + // (params->mStabbedFace.mDistance is used in computeImpactDataX code, so we need it before that point - we can't simply avoid + // modifying this value before this point). + if(!params->mNodeSorting) + params->mStabbedFace.mDistance = params->mMaxDist; + } + + PX_FORCE_INLINE void invertPRMatrix(PxMat44* PX_RESTRICT dest, const PxMat44* PX_RESTRICT src) + { + const float m30 = src->column3.x; + const float m31 = src->column3.y; + const float m32 = src->column3.z; + + const float m00 = src->column0.x; + const float m01 = src->column0.y; + const float m02 = src->column0.z; + + dest->column0.x = m00; + dest->column1.x = m01; + dest->column2.x = m02; + dest->column3.x = -(m30*m00 + m31*m01 + m32*m02); + + const float m10 = src->column1.x; + const float m11 = src->column1.y; + const float m12 = src->column1.z; + + dest->column0.y = m10; + dest->column1.y = m11; + dest->column2.y = m12; + dest->column3.y = -(m30*m10 + m31*m11 + m32*m12); + + const float m20 = src->column2.x; + const float m21 = src->column2.y; + const float m22 = src->column2.z; + + dest->column0.z = m20; + dest->column1.z = m21; + dest->column2.z = m22; + dest->column3.z = -(m30*m20 + m31*m21 + m32*m22); + + dest->column0.w = 0.0f; + dest->column1.w = 0.0f; + dest->column2.w = 0.0f; + dest->column3.w = 1.0f; + } + + PX_FORCE_INLINE void invertBoxMatrix(PxMat33& m, PxVec3& t, const Gu::Box& box) + { + const float m30 = box.center.x; + const float m31 = box.center.y; + const float m32 = box.center.z; + + const float m00 = box.rot.column0.x; + const float m01 = box.rot.column0.y; + const float m02 = box.rot.column0.z; + + m.column0.x = m00; + m.column1.x = m01; + m.column2.x = m02; + t.x = -(m30*m00 + m31*m01 + m32*m02); + + const float m10 = box.rot.column1.x; + const float m11 = box.rot.column1.y; + const float m12 = box.rot.column1.z; + + m.column0.y = m10; + m.column1.y = m11; + m.column2.y = m12; + t.y = -(m30*m10 + m31*m11 + m32*m12); + + const float m20 = box.rot.column2.x; + const float m21 = box.rot.column2.y; + const float m22 = box.rot.column2.z; + + m.column0.z = m20; + m.column1.z = m21; + m.column2.z = m22; + t.z = -(m30*m20 + m31*m21 + m32*m22); + } + +#ifdef GU_BV4_USE_SLABS + // PT: this class moved here to make things compile with pedantic compilers. + + // PT: now duplicated because not easy to do otherwise + + struct BVDataSwizzledQ : public physx::PxUserAllocated + { + struct Data + { + PxI16 mMin; //!< Quantized min + PxI16 mMax; //!< Quantized max + }; + + Data mX[4]; + Data mY[4]; + Data mZ[4]; + + PxU32 mData[4]; + + PX_FORCE_INLINE PxU32 isLeaf(PxU32 i) const { return mData[i]&1; } + PX_FORCE_INLINE PxU32 getPrimitive(PxU32 i) const { return mData[i]>>1; } + PX_FORCE_INLINE PxU32 getChildOffset(PxU32 i) const { return mData[i]>>GU_BV4_CHILD_OFFSET_SHIFT_COUNT; } + PX_FORCE_INLINE PxU32 getChildType(PxU32 i) const { return (mData[i]>>1)&3; } + PX_FORCE_INLINE PxU32 getChildData(PxU32 i) const { return mData[i]; } + PX_FORCE_INLINE PxU32 decodePNSNoShift(PxU32 i) const { return mData[i]; } + }; + + struct BVDataSwizzledNQ : public physx::PxUserAllocated + { + float mMinX[4]; + float mMinY[4]; + float mMinZ[4]; + float mMaxX[4]; + float mMaxY[4]; + float mMaxZ[4]; + + PxU32 mData[4]; + + PX_FORCE_INLINE PxU32 isLeaf(PxU32 i) const { return mData[i]&1; } + PX_FORCE_INLINE PxU32 getPrimitive(PxU32 i) const { return mData[i]>>1; } + PX_FORCE_INLINE PxU32 getChildOffset(PxU32 i) const { return mData[i]>>GU_BV4_CHILD_OFFSET_SHIFT_COUNT; } + PX_FORCE_INLINE PxU32 getChildType(PxU32 i) const { return (mData[i]>>1)&3; } + PX_FORCE_INLINE PxU32 getChildData(PxU32 i) const { return mData[i]; } + PX_FORCE_INLINE PxU32 decodePNSNoShift(PxU32 i) const { return mData[i]; } + }; + +#else + #define SSE_CONST4(name, val) static const __declspec(align(16)) PxU32 name[4] = { (val), (val), (val), (val) } + #define SSE_CONST(name) *(const __m128i *)&name + #define SSE_CONSTF(name) *(const __m128 *)&name +#endif + + PX_FORCE_INLINE PxU32 getNbPrimitives(PxU32& primIndex) + { + PxU32 NbToGo = (primIndex & 15)-1; + primIndex>>=4; + return NbToGo; + } + + template + PX_FORCE_INLINE void setupMeshPointersAndQuantizedCoeffs(ParamsT* PX_RESTRICT params, const SourceMesh* PX_RESTRICT mesh, const BV4Tree* PX_RESTRICT tree) + { + using namespace physx::aos; + + params->mTris32 = mesh->getTris32(); + params->mTris16 = mesh->getTris16(); + params->mVerts = mesh->getVerts(); + + V4StoreA_Safe(V4LoadU_Safe(&tree->mCenterOrMinCoeff.x), ¶ms->mCenterOrMinCoeff_PaddedAligned.x); + V4StoreA_Safe(V4LoadU_Safe(&tree->mExtentsOrMaxCoeff.x), ¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + } + + template + PX_FORCE_INLINE void setupMeshPointersAndQuantizedCoeffs(ParamsT* PX_RESTRICT params, const TetrahedronSourceMesh* PX_RESTRICT mesh, const BV4Tree* PX_RESTRICT tree) + { + params->mTets32 = mesh->getTetrahedrons32(); + params->mTets16 = mesh->getTetrahedrons16(); + params->mVerts = mesh->getVerts(); + + V4StoreA_Safe(V4LoadU_Safe(&tree->mCenterOrMinCoeff.x), ¶ms->mCenterOrMinCoeff_PaddedAligned.x); + V4StoreA_Safe(V4LoadU_Safe(&tree->mExtentsOrMaxCoeff.x), ¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + } + + PX_FORCE_INLINE void rotateBox(Gu::Box& dst, const PxMat44& m, const Gu::Box& src) + { + // The extents remain constant + dst.extents = src.extents; + // The center gets x-formed + dst.center = m.transform(src.center); + // Combine rotations + // PT: TODO: revisit.. this is awkward... grab 3x3 part of 4x4 matrix (TA34704) + const PxMat33 tmp( PxVec3(m.column0.x, m.column0.y, m.column0.z), + PxVec3(m.column1.x, m.column1.y, m.column1.z), + PxVec3(m.column2.x, m.column2.y, m.column2.z)); + dst.rot = tmp * src.rot; + } + + PX_FORCE_INLINE PxVec3 inverseRotate(const PxMat44* PX_RESTRICT src, const PxVec3& p) + { + const float m00 = src->column0.x; + const float m01 = src->column0.y; + const float m02 = src->column0.z; + + const float m10 = src->column1.x; + const float m11 = src->column1.y; + const float m12 = src->column1.z; + + const float m20 = src->column2.x; + const float m21 = src->column2.y; + const float m22 = src->column2.z; + + return PxVec3( m00*p.x + m01*p.y + m02*p.z, + m10*p.x + m11*p.y + m12*p.z, + m20*p.x + m21*p.y + m22*p.z); + } + + PX_FORCE_INLINE PxVec3 inverseTransform(const PxMat44* PX_RESTRICT src, const PxVec3& p) + { + const float m30 = src->column3.x; + const float m31 = src->column3.y; + const float m32 = src->column3.z; + + const float m00 = src->column0.x; + const float m01 = src->column0.y; + const float m02 = src->column0.z; + + const float m10 = src->column1.x; + const float m11 = src->column1.y; + const float m12 = src->column1.z; + + const float m20 = src->column2.x; + const float m21 = src->column2.y; + const float m22 = src->column2.z; + + return PxVec3( m00*p.x + m01*p.y + m02*p.z -(m30*m00 + m31*m01 + m32*m02), + m10*p.x + m11*p.y + m12*p.z -(m30*m10 + m31*m11 + m32*m12), + m20*p.x + m21*p.y + m22*p.z -(m30*m20 + m31*m21 + m32*m22)); + } + + PX_FORCE_INLINE void computeLocalRay(PxVec3& localDir, PxVec3& localOrigin, const PxVec3& dir, const PxVec3& origin, const PxMat44* PX_RESTRICT worldm_Aligned) + { + if(worldm_Aligned) + { + localDir = inverseRotate(worldm_Aligned, dir); + localOrigin = inverseTransform(worldm_Aligned, origin); + } + else + { + localDir = dir; + localOrigin = origin; + } + } + + PX_FORCE_INLINE void computeLocalSphere(float& radius2, PxVec3& local_center, const Sphere& sphere, const PxMat44* PX_RESTRICT worldm_Aligned) + { + radius2 = sphere.radius * sphere.radius; + if(worldm_Aligned) + { + local_center = inverseTransform(worldm_Aligned, sphere.center); + } + else + { + local_center = sphere.center; + } + } + + PX_FORCE_INLINE void computeLocalCapsule(Capsule& localCapsule, const Capsule& capsule, const PxMat44* PX_RESTRICT worldm_Aligned) + { + localCapsule.radius = capsule.radius; + if(worldm_Aligned) + { + localCapsule.p0 = inverseTransform(worldm_Aligned, capsule.p0); + localCapsule.p1 = inverseTransform(worldm_Aligned, capsule.p1); + } + else + { + localCapsule.p0 = capsule.p0; + localCapsule.p1 = capsule.p1; + } + } + + PX_FORCE_INLINE void computeLocalBox(Gu::Box& dst, const Gu::Box& src, const PxMat44* PX_RESTRICT worldm_Aligned) + { + if(worldm_Aligned) + { + PxMat44 invWorldM; + invertPRMatrix(&invWorldM, worldm_Aligned); + + rotateBox(dst, invWorldM, src); + } + else + { + dst = src; // PT: TODO: check asm for operator= (TA34704) + } + } + + template + static PX_FORCE_INLINE bool computeImpactDataT(const ShapeT& shape, const PxVec3& dir, SweepHit* PX_RESTRICT hit, const ParamsT* PX_RESTRICT params, const PxMat44* PX_RESTRICT worldm, bool isDoubleSided, bool meshBothSides) + { + if(params->mStabbedFace.mTriangleID==PX_INVALID_U32) + return false; // We didn't touch any triangle + + if(hit) + { + const float t = params->getReportDistance(); + hit->mTriangleID = params->mStabbedFace.mTriangleID; + hit->mDistance = t; + + if(t==0.0f) + { + hit->mPos = PxVec3(0.0f); + hit->mNormal = -dir; + } + else + { + // PT: TODO: we shouldn't compute impact in world space, and in fact moving this to local space is necessary if we want to reuse this for box-sweeps (TA34704) + PxTrianglePadded WP; + if(worldm) + { + WP.verts[0] = worldm->transform(params->mP0); + WP.verts[1] = worldm->transform(params->mP1); + WP.verts[2] = worldm->transform(params->mP2); + } + else + { + WP.verts[0] = params->mP0; + WP.verts[1] = params->mP1; + WP.verts[2] = params->mP2; + } + + PxVec3 impactNormal; + ImpactFunctionT::computeImpact(hit->mPos, impactNormal, shape, dir, t, WP); + + // PT: by design, returned normal is opposed to the sweep direction. + if(shouldFlipNormal(impactNormal, meshBothSides, isDoubleSided, params->mBestTriNormal, dir)) + impactNormal = -impactNormal; + + hit->mNormal = impactNormal; + } + } + return true; + } + + // PT: we don't create a structure for small meshes with just a few triangles. We use brute-force tests on these. + template + void doBruteForceTests(PxU32 nbTris, ParamsT* PX_RESTRICT params) + { + PX_ASSERT(nbTris<16); + if(params->mEarlyExit) + LeafFunction_AnyT::doLeafTest(params, nbTris); + else + LeafFunction_ClosestT::doLeafTest(params, nbTris); + } + +#ifndef GU_BV4_USE_SLABS + template + PX_FORCE_INLINE void setupRayData(ParamsT* PX_RESTRICT params, float max_dist, const PxVec3& origin, const PxVec3& dir) + { + const float Half = 0.5f*max_dist; + const FloatV HalfV = FLoad(Half); + const Vec4V DataV = V4Scale(V4LoadU(&dir.x), HalfV); + const Vec4V Data2V = V4Add(V4LoadU(&origin.x), DataV); + const Vec4V FDirV = V4Abs(DataV); + V4StoreA_Safe(DataV, ¶ms->mData_PaddedAligned.x); + V4StoreA_Safe(Data2V, ¶ms->mData2_PaddedAligned.x); + V4StoreA_Safe(FDirV, ¶ms->mFDir_PaddedAligned.x); + } +#endif + +} +} + +#endif // GU_BV4_COMMON_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Internal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Internal.h new file mode 100644 index 0000000..6c03792 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Internal.h @@ -0,0 +1,298 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_INTERNAL_H +#define GU_BV4_INTERNAL_H + +#include "foundation/PxFPU.h" + + // PT: the general structure is that there is a root "process stream" function which is the entry point for the query. + // It then calls "process node" functions for each traversed node, except for the Slabs-based raycast versions that deal + // with 4 nodes at a time within the "process stream" function itself. When a leaf is found, "doLeafTest" functors + // passed to the "process stream" entry point are called. +#ifdef GU_BV4_USE_SLABS + // PT: Linux tries to compile templates even when they're not used so I had to wrap them all with defines to avoid build errors. Blame the only platform that does this. + #ifdef GU_BV4_PROCESS_STREAM_NO_ORDER + template + PX_FORCE_INLINE PxIntBool processStreamNoOrder(const BV4Tree& tree, ParamsT* PX_RESTRICT params) + { + if(tree.mQuantized) + return BV4_ProcessStreamSwizzledNoOrderQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + else + return BV4_ProcessStreamSwizzledNoOrderNQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + } + #endif + + #ifdef GU_BV4_PROCESS_STREAM_ORDERED + template + PX_FORCE_INLINE void processStreamOrdered(const BV4Tree& tree, ParamsT* PX_RESTRICT params) + { + if(tree.mQuantized) + BV4_ProcessStreamSwizzledOrderedQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + else + BV4_ProcessStreamSwizzledOrderedNQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + } + #endif + + #ifdef GU_BV4_PROCESS_STREAM_RAY_NO_ORDER + template + PX_FORCE_INLINE PxIntBool processStreamRayNoOrder(const BV4Tree& tree, ParamsT* PX_RESTRICT params) + { + if(tree.mQuantized) + return BV4_ProcessStreamKajiyaNoOrderQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + else + return BV4_ProcessStreamKajiyaNoOrderNQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + } + #endif + + #ifdef GU_BV4_PROCESS_STREAM_RAY_ORDERED + template + PX_FORCE_INLINE void processStreamRayOrdered(const BV4Tree& tree, ParamsT* PX_RESTRICT params) + { + if(tree.mQuantized) + BV4_ProcessStreamKajiyaOrderedQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + else + BV4_ProcessStreamKajiyaOrderedNQ(reinterpret_cast(tree.mNodes), tree.mInitData, params); + } + #endif +#else + #define processStreamNoOrder BV4_ProcessStreamNoOrder + #define processStreamOrdered BV4_ProcessStreamOrdered2 + #define processStreamRayNoOrder(a, b) BV4_ProcessStreamNoOrder + #define processStreamRayOrdered(a, b) BV4_ProcessStreamOrdered2 +#endif + +#ifndef GU_BV4_USE_SLABS +#ifdef GU_BV4_PRECOMPUTED_NODE_SORT + // PT: see http://www.codercorner.com/blog/?p=734 + + // PT: TODO: refactor with dup in bucket pruner (TA34704) + PX_FORCE_INLINE PxU32 computeDirMask(const PxVec3& dir) + { + // XYZ + // --- + // --+ + // -+- + // -++ + // +-- + // +-+ + // ++- + // +++ + + const PxU32 X = PX_IR(dir.x)>>31; + const PxU32 Y = PX_IR(dir.y)>>31; + const PxU32 Z = PX_IR(dir.z)>>31; + const PxU32 bitIndex = Z|(Y<<1)|(X<<2); + return 1u< + static PxIntBool BV4_ProcessStreamNoOrder(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + const PxU32 nodeType = getChildType(childData); + + if(nodeType>1 && BV4_ProcessNodeNoOrder(stack, nb, node, params)) + return 1; + if(nodeType>0 && BV4_ProcessNodeNoOrder(stack, nb, node, params)) + return 1; + if(BV4_ProcessNodeNoOrder(stack, nb, node, params)) + return 1; + if(BV4_ProcessNodeNoOrder(stack, nb, node, params)) + return 1; + + }while(nb); + + return 0; + } + + template + static void BV4_ProcessStreamOrdered(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + const PxU32 dirMask = computeDirMask(params->mLocalDir)<<3; + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const PxU8* PX_RESTRICT ord = order + decodePNS(node, dirMask)*4; + const PxU32 limit = 2 + getChildType(childData); + + BV4_ProcessNodeOrdered(stack, nb, node, params, ord[0], limit); + BV4_ProcessNodeOrdered(stack, nb, node, params, ord[1], limit); + BV4_ProcessNodeOrdered(stack, nb, node, params, ord[2], limit); + BV4_ProcessNodeOrdered(stack, nb, node, params, ord[3], limit); + }while(Nb); + } + + // Alternative, experimental version using PNS + template + static void BV4_ProcessStreamOrdered2(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; + const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; + const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<(code, node, params); + BV4_ProcessNodeOrdered2(code, node, params); + if(nodeType>0) + BV4_ProcessNodeOrdered2(code, node, params); + if(nodeType>1) + BV4_ProcessNodeOrdered2(code, node, params); + + if(code) + { + // PT: TODO: check which implementation is best on each platform (TA34704) +#define FOURTH_TEST // Version avoids computing the PNS index, and also avoids all non-constant shifts. Full of branches though. Fastest on Win32. +#ifdef FOURTH_TEST + { + if(node[0].decodePNSNoShift() & dirMask) // Bit2 + { + if(node[1].decodePNSNoShift() & dirMask) // Bit1 + { + if(node[2].decodePNSNoShift() & dirMask) // Bit0 + PNS_BLOCK2(3,2,1,0) // 7 + else + PNS_BLOCK2(2,3,1,0) // 6 + } + else + { + if(node[2].decodePNSNoShift() & dirMask) // Bit0 + PNS_BLOCK2(3,2,0,1) // 5 + else + PNS_BLOCK2(2,3,0,1) // 4 + } + } + else + { + if(node[1].decodePNSNoShift() & dirMask) // Bit1 + { + if(node[2].decodePNSNoShift() & dirMask) // Bit0 + PNS_BLOCK2(1,0,3,2) // 3 + else + PNS_BLOCK2(1,0,2,3) // 2 + } + else + { + if(node[2].decodePNSNoShift() & dirMask) // Bit0 + PNS_BLOCK2(0,1,3,2) // 1 + else + PNS_BLOCK2(0,1,2,3) // 0 + } + } + } +#endif + } + }while(nb); + } +#endif // GU_BV4_USE_SLABS + +#endif // GU_BV4_INTERNAL_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp new file mode 100644 index 0000000..e6f7d8f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_MeshMeshOverlap.cpp @@ -0,0 +1,1485 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; +using namespace physx::aos; + +#include "GuBV4_BoxOverlap_Internal.h" +#include "GuBV4_BoxBoxOverlapTest.h" + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamNoOrder_OBBOBB.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_SwizzledNoOrder.h" +#endif + +//#include +#include "geometry/PxMeshQuery.h" + +//! if OPC_TRITRI_EPSILON_TEST is true then we do a check (if |dv|b) \ + { \ + const float _c=a; \ + a=b; \ + b=_c; \ + } + +//! Edge to edge test based on Franlin Antonio's gem: "Faster Line Segment Intersection", in Graphics Gems III, pp. 199-202 +#define EDGE_EDGE_TEST(V0, U0, U1) \ + Bx = U0[i0] - U1[i0]; \ + By = U0[i1] - U1[i1]; \ + Cx = V0[i0] - U0[i0]; \ + Cy = V0[i1] - U0[i1]; \ + f = Ay*Bx - Ax*By; \ + d = By*Cx - Bx*Cy; \ + if((f>0.0f && d>=0.0f && d<=f) || (f<0.0f && d<=0.0f && d>=f)) \ + { \ + const float e=Ax*Cy - Ay*Cx; \ + if(f>0.0f) \ + { \ + if(e>=0.0f && e<=f) return 1; \ + } \ + else \ + { \ + if(e<=0.0f && e>=f) return 1; \ + } \ + } + +//! TO BE DOCUMENTED +#define EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2) \ +{ \ + float Bx,By,Cx,Cy,d,f; \ + const float Ax = V1[i0] - V0[i0]; \ + const float Ay = V1[i1] - V0[i1]; \ + /* test edge U0,U1 against V0,V1 */ \ + EDGE_EDGE_TEST(V0, U0, U1); \ + /* test edge U1,U2 against V0,V1 */ \ + EDGE_EDGE_TEST(V0, U1, U2); \ + /* test edge U2,U1 against V0,V1 */ \ + EDGE_EDGE_TEST(V0, U2, U0); \ +} + +//! TO BE DOCUMENTED +#define POINT_IN_TRI(V0, U0, U1, U2) \ +{ \ + /* is T1 completly inside T2? */ \ + /* check if V0 is inside tri(U0,U1,U2) */ \ + float a = U1[i1] - U0[i1]; \ + float b = -(U1[i0] - U0[i0]); \ + float c = -a*U0[i0] - b*U0[i1]; \ + float d0 = a*V0[i0] + b*V0[i1] + c; \ + \ + a = U2[i1] - U1[i1]; \ + b = -(U2[i0] - U1[i0]); \ + c = -a*U1[i0] - b*U1[i1]; \ + const float d1 = a*V0[i0] + b*V0[i1] + c; \ + \ + a = U0[i1] - U2[i1]; \ + b = -(U0[i0] - U2[i0]); \ + c = -a*U2[i0] - b*U2[i1]; \ + const float d2 = a*V0[i0] + b*V0[i1] + c; \ + if(d0*d1>0.0f) \ + { \ + if(d0*d2>0.0f) return 1; \ + } \ +} + +//! TO BE DOCUMENTED +static PxU32 CoplanarTriTri(const PxVec3& n, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, const PxVec3& u0, const PxVec3& u1, const PxVec3& u2) +{ + float A[3]; + short i0,i1; + /* first project onto an axis-aligned plane, that maximizes the area */ + /* of the triangles, compute indices: i0,i1. */ + A[0] = fabsf(n[0]); + A[1] = fabsf(n[1]); + A[2] = fabsf(n[2]); + if(A[0]>A[1]) + { + if(A[0]>A[2]) + { + i0=1; /* A[0] is greatest */ + i1=2; + } + else + { + i0=0; /* A[2] is greatest */ + i1=1; + } + } + else /* A[0]<=A[1] */ + { + if(A[2]>A[1]) + { + i0=0; /* A[2] is greatest */ + i1=1; + } + else + { + i0=0; /* A[1] is greatest */ + i1=2; + } + } + + /* test all edges of triangle 1 against the edges of triangle 2 */ + EDGE_AGAINST_TRI_EDGES(v0, v1, u0, u1, u2); + EDGE_AGAINST_TRI_EDGES(v1, v2, u0, u1, u2); + EDGE_AGAINST_TRI_EDGES(v2, v0, u0, u1, u2); + + /* finally, test if tri1 is totally contained in tri2 or vice versa */ + POINT_IN_TRI(v0, u0, u1, u2); + POINT_IN_TRI(u0, v0, v1, v2); + + return 0; +} + +//! TO BE DOCUMENTED +#define NEWCOMPUTE_INTERVALS(VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, A, B, C, X0, X1) \ +{ \ + if(D0D1>0.0f) \ + { \ + /* here we know that D0D2<=0.0 */ \ + /* that is D0, D1 are on the same side, D2 on the other or on the plane */ \ + A=VV2; B=(VV0 - VV2)*D2; C=(VV1 - VV2)*D2; X0=D2 - D0; X1=D2 - D1; \ + } \ + else if(D0D2>0.0f) \ + { \ + /* here we know that d0d1<=0.0 */ \ + A=VV1; B=(VV0 - VV1)*D1; C=(VV2 - VV1)*D1; X0=D1 - D0; X1=D1 - D2; \ + } \ + else if(D1*D2>0.0f || D0!=0.0f) \ + { \ + /* here we know that d0d1<=0.0 or that D0!=0.0 */ \ + A=VV0; B=(VV1 - VV0)*D0; C=(VV2 - VV0)*D0; X0=D0 - D1; X1=D0 - D2; \ + } \ + else if(D1!=0.0f) \ + { \ + A=VV1; B=(VV0 - VV1)*D1; C=(VV2 - VV1)*D1; X0=D1 - D0; X1=D1 - D2; \ + } \ + else if(D2!=0.0f) \ + { \ + A=VV2; B=(VV0 - VV2)*D2; C=(VV1 - VV2)*D2; X0=D2 - D0; X1=D2 - D1; \ + } \ + else \ + { \ + /* triangles are coplanar */ \ + return ignoreCoplanar ? 0 : CoplanarTriTri(N1, V0, V1, V2, U0, U1, U2); \ + } \ +} + +namespace +{ + PX_ALIGN_PREFIX(16) + struct TriangleData + { + PxVec3p mV0, mV1, mV2; + PxVec3 mNormal; + float mD; + + PX_FORCE_INLINE void init(const PxVec3& V0, const PxVec3& V1, const PxVec3& V2) + { + // 45 lines of asm (x64) + const Vec4V V0V = V4LoadU(&V0.x); + const Vec4V V1V = V4LoadU(&V1.x); + const Vec4V V2V = V4LoadU(&V2.x); + + const Vec4V E1V = V4Sub(V1V, V0V); + const Vec4V E2V = V4Sub(V2V, V0V); + const Vec4V NV = V4Cross(E1V, E2V); + const FloatV dV = FNeg(V4Dot3(NV, V0V)); + + V4StoreA(V0V, &mV0.x); + V4StoreA(V1V, &mV1.x); + V4StoreA(V2V, &mV2.x); + V4StoreA(NV, &mNormal.x); + FStore(dV, &mD); + + // 62 lines of asm (x64) + // const PxVec3 E1 = V1 - V0; + // const PxVec3 E2 = V2 - V0; + // const PxVec3 N = E1.cross(E2); + // mV0 = V0; + // mV1 = V1; + // mV2 = V2; + // mNormal = N; + // mD = -N.dot(V0); + } + }PX_ALIGN_SUFFIX(16); +} + +static PxU32 TriTriOverlap(const TriangleData& data0, const TriangleData& data1, bool ignoreCoplanar) +{ + const PxVec3& V0 = data0.mV0; + const PxVec3& V1 = data0.mV1; + const PxVec3& V2 = data0.mV2; + const PxVec3& U0 = data1.mV0; + const PxVec3& U1 = data1.mV1; + const PxVec3& U2 = data1.mV2; + + const PxVec3& N1 = data0.mNormal; + float du0, du1, du2, du0du1, du0du2; + { + const float d1 = data0.mD; + + // Put U0,U1,U2 into plane equation 1 to compute signed distances to the plane + du0 = N1.dot(U0) + d1; + du1 = N1.dot(U1) + d1; + du2 = N1.dot(U2) + d1; + + // Coplanarity robustness check +#ifdef OPC_TRITRI_EPSILON_TEST + if(fabsf(du0)0.0f && du0du2>0.0f) // same sign on all of them + not equal 0 ? + return 0; // no intersection occurs + } + + const PxVec3& N2 = data1.mNormal; + float dv0, dv1, dv2, dv0dv1, dv0dv2; + { + const float d2 = data1.mD; + + // put V0,V1,V2 into plane equation 2 + dv0 = N2.dot(V0) + d2; + dv1 = N2.dot(V1) + d2; + dv2 = N2.dot(V2) + d2; + + #ifdef OPC_TRITRI_EPSILON_TEST + if(fabsf(dv0)0.0f && dv0dv2>0.0f) // same sign on all of them + not equal 0 ? + return 0; // no intersection occurs + } + + // Compute direction of intersection line + // Compute and index to the largest component of D + short index = 0; + { + const PxVec3 D = N1.cross(N2); + + float max = fabsf(D[0]); + const float bb = fabsf(D[1]); + const float cc = fabsf(D[2]); + if(bb>max) + { + max=bb; + index=1; + } + if(cc>max) + { + max=cc; + index=2; + } + } + + // This is the simplified projection onto L + const float vp0 = V0[index]; + const float vp1 = V1[index]; + const float vp2 = V2[index]; + + const float up0 = U0[index]; + const float up1 = U1[index]; + const float up2 = U2[index]; + + // Compute interval for triangle 1 + float a,b,c,x0,x1; + NEWCOMPUTE_INTERVALS(vp0,vp1,vp2,dv0,dv1,dv2,dv0dv1,dv0dv2,a,b,c,x0,x1); + + // Compute interval for triangle 2 + float d,e,f,y0,y1; + NEWCOMPUTE_INTERVALS(up0,up1,up2,du0,du1,du2,du0du1,du0du2,d,e,f,y0,y1); + + const float xx=x0*x1; + const float yy=y0*y1; + const float xxyy=xx*yy; + + float isect1[2], isect2[2]; + + float tmp=a*xxyy; + isect1[0]=tmp+b*x1*yy; + isect1[1]=tmp+c*x0*yy; + + tmp=d*xxyy; + isect2[0]=tmp+e*xx*y1; + isect2[1]=tmp+f*xx*y0; + + SORT(isect1[0],isect1[1]); + SORT(isect2[0],isect2[1]); + + if(isect1[1]x); + + Vec4V ResV = V4Scale(c0, V4GetX(vertexV)); + ResV = V4Add(ResV, V4Scale(c1, V4GetY(vertexV))); + ResV = V4Add(ResV, V4Scale(c2, V4GetZ(vertexV))); + ResV = V4Add(ResV, c3); + + V4StoreU(ResV, &dst->x); +} + +static bool doLeafVsLeaf(PxReportCallback& callback, const PxU32 prim0, const PxU32 prim1, const SourceMesh* mesh0, const SourceMesh* mesh1, const PxMat44* mat0to1, bool mustFlip, bool& abort, bool ignoreCoplanar) +{ + TriangleData data0[16]; + TriangleData data1[16]; + + PxU32 nb0 = 0; + PxU32 startPrim0; + { + PxU32 primIndex0 = prim0; + PxU32 nbTris0 = getNbPrimitives(primIndex0); + startPrim0 = primIndex0; + const PxVec3* verts0 = mesh0->getVerts(); + do + { + PX_ASSERT(primIndex0getNbTriangles()); + PxU32 VRef00, VRef01, VRef02; + getVertexReferences(VRef00, VRef01, VRef02, primIndex0++, mesh0->getTris32(), mesh0->getTris16()); + PX_ASSERT(VRef00getNbVertices()); + PX_ASSERT(VRef01getNbVertices()); + PX_ASSERT(VRef02getNbVertices()); + + if(mat0to1) + { + //const PxVec3 p0 = mat0to1->transform(verts0[VRef00]); + //const PxVec3 p1 = mat0to1->transform(verts0[VRef01]); + //const PxVec3 p2 = mat0to1->transform(verts0[VRef02]); + //data0[nb0++].init(p0, p1, p2); + + const Vec4V c0 = V4LoadU(&mat0to1->column0.x); + const Vec4V c1 = V4LoadU(&mat0to1->column1.x); + const Vec4V c2 = V4LoadU(&mat0to1->column2.x); + const Vec4V c3 = V4LoadU(&mat0to1->column3.x); + + PxVec3p p0, p1, p2; + transformV(&p0, &verts0[VRef00], c0, c1, c2, c3); + transformV(&p1, &verts0[VRef01], c0, c1, c2, c3); + transformV(&p2, &verts0[VRef02], c0, c1, c2, c3); + + data0[nb0++].init(p0, p1, p2); + } + else + { + data0[nb0++].init(verts0[VRef00], verts0[VRef01], verts0[VRef02]); + } + + }while(nbTris0--); + } + + PxU32 nb1 = 0; + PxU32 startPrim1; + { + PxU32 primIndex1 = prim1; + PxU32 nbTris1 = getNbPrimitives(primIndex1); + startPrim1 = primIndex1; + const PxVec3* verts1 = mesh1->getVerts(); + do + { + PX_ASSERT(primIndex1getNbTriangles()); + PxU32 VRef10, VRef11, VRef12; + getVertexReferences(VRef10, VRef11, VRef12, primIndex1++, mesh1->getTris32(), mesh1->getTris16()); + PX_ASSERT(VRef10getNbVertices()); + PX_ASSERT(VRef11getNbVertices()); + PX_ASSERT(VRef12getNbVertices()); + + data1[nb1++].init(verts1[VRef10], verts1[VRef11], verts1[VRef12]); + + }while(nbTris1--); + } + + PX_ASSERT(nb0<=16); + PX_ASSERT(nb1<=16); + + PxGeomIndexPair* dst = callback.mBuffer; + PxU32 capacity = callback.mCapacity; + PxU32 currentSize = callback.mSize; + PX_ASSERT(currentSize& callback, const SourceMesh* mesh0, const SourceMesh* mesh1, const PxMat44* mat0to1, const BV4Tree& tree, bool mustFlip, bool ignoreCoplanar) : + mCallback (callback), + mMesh0 (mesh0), + mMesh1 (mesh1), + mMat0to1 (mat0to1), + mMustFlip (mustFlip), + mStatus (false), + mIgnoreCoplanar (ignoreCoplanar) + { + V4StoreA_Safe(V4LoadU_Safe(&tree.mCenterOrMinCoeff.x), &mCenterOrMinCoeff_PaddedAligned.x); + V4StoreA_Safe(V4LoadU_Safe(&tree.mExtentsOrMaxCoeff.x), &mExtentsOrMaxCoeff_PaddedAligned.x); + + PxMat33 mLocalBox_rot; + if(mat0to1) + mLocalBox_rot = PxMat33(PxVec3(mat0to1->column0.x, mat0to1->column0.y, mat0to1->column0.z), + PxVec3(mat0to1->column1.x, mat0to1->column1.y, mat0to1->column1.z), + PxVec3(mat0to1->column2.x, mat0to1->column2.y, mat0to1->column2.z)); + else + mLocalBox_rot = PxMat33(PxIdentity); + + precomputeData(this, &mAbsRot, &mLocalBox_rot); + } + + void setupForTraversal(const PxVec3p& center, const PxVec3p& extents) + { + if(mMat0to1) + { + const Vec4V c0 = V4LoadU(&mMat0to1->column0.x); + const Vec4V c1 = V4LoadU(&mMat0to1->column1.x); + const Vec4V c2 = V4LoadU(&mMat0to1->column2.x); + const Vec4V c3 = V4LoadU(&mMat0to1->column3.x); + transformV(&mTBoxToModel_PaddedAligned, ¢er, c0, c1, c2, c3); + } + else + mTBoxToModel_PaddedAligned = center; + + setupBoxData(this, extents, &mAbsRot); + } + + PxMat33 mAbsRot; //!< Absolute rotation matrix + PxReportCallback& mCallback; + const SourceMesh* const mMesh0; + const SourceMesh* const mMesh1; + const PxMat44* const mMat0to1; + PxU32 mPrimIndex0; + const bool mMustFlip; + bool mStatus; + const bool mIgnoreCoplanar; + + PX_NOCOPY(MeshMeshParams) +}; + +class LeafFunction_MeshMesh +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(MeshMeshParams* PX_RESTRICT params, PxU32 primIndex1) + { + bool abort; + if(doLeafVsLeaf(params->mCallback, params->mPrimIndex0, primIndex1, params->mMesh0, params->mMesh1, params->mMat0to1, params->mMustFlip, abort, params->mIgnoreCoplanar)) + params->mStatus = true; + return PxIntBool(abort); + } +}; +} + +static PX_FORCE_INLINE void getBox(Vec4V& centerV, Vec4V& extentsV, const BVDataSwizzledQ* PX_RESTRICT node, PxU32 i, const PxVec3p* PX_RESTRICT centerOrMinCoeff_PaddedAligned, const PxVec3p* PX_RESTRICT extentsOrMaxCoeff_PaddedAligned) +{ + // Dequantize box0 + //OPC_SLABS_GET_MIN_MAX(tn0, i) + const VecI32V minVi = I4LoadXYZW(node->mX[i].mMin, node->mY[i].mMin, node->mZ[i].mMin, 0); + const Vec4V minCoeffV = V4LoadA_Safe(¢erOrMinCoeff_PaddedAligned->x); + Vec4V minV = V4Mul(Vec4V_From_VecI32V(minVi), minCoeffV); + const VecI32V maxVi = I4LoadXYZW(node->mX[i].mMax, node->mY[i].mMax, node->mZ[i].mMax, 0); + const Vec4V maxCoeffV = V4LoadA_Safe(&extentsOrMaxCoeff_PaddedAligned->x); + Vec4V maxV = V4Mul(Vec4V_From_VecI32V(maxVi), maxCoeffV); + + // OPC_SLABS_GET_CEQ(i) + const FloatV HalfV = FLoad(0.5f); + centerV = V4Scale(V4Add(maxV, minV), HalfV); + extentsV = V4Scale(V4Sub(maxV, minV), HalfV); +} + +static PX_FORCE_INLINE void getBox(Vec4V& centerV, Vec4V& extentsV, const BVDataSwizzledNQ* PX_RESTRICT node, PxU32 i, const PxVec3p* PX_RESTRICT /*centerOrMinCoeff_PaddedAligned*/, const PxVec3p* PX_RESTRICT /*extentsOrMaxCoeff_PaddedAligned*/) +{ + const FloatV HalfV = FLoad(0.5f); + const Vec4V minV = V4LoadXYZW(node->mMinX[i], node->mMinY[i], node->mMinZ[i], 0.0f); + const Vec4V maxV = V4LoadXYZW(node->mMaxX[i], node->mMaxY[i], node->mMaxZ[i], 0.0f); + centerV = V4Scale(V4Add(maxV, minV), HalfV); + extentsV = V4Scale(V4Sub(maxV, minV), HalfV); +} + +static PX_FORCE_INLINE PxIntBool doLeafVsNode(const BVDataPackedQ* const PX_RESTRICT root, const BVDataSwizzledQ* PX_RESTRICT node, PxU32 i, MeshMeshParams* PX_RESTRICT params) +{ + return BV4_ProcessStreamSwizzledNoOrderQ(root, node->getChildData(i), params); +} + +static PX_FORCE_INLINE PxIntBool doLeafVsNode(const BVDataPackedNQ* const PX_RESTRICT root, const BVDataSwizzledNQ* PX_RESTRICT node, PxU32 i, MeshMeshParams* PX_RESTRICT params) +{ + return BV4_ProcessStreamSwizzledNoOrderNQ(root, node->getChildData(i), params); +} + +static void getBox(Vec4V& centerV, Vec4V& extentsV, PxU32 nbVerts, const PxVec3* PX_RESTRICT verts) +{ + Vec4V minV = V4LoadU(&verts[0].x); + Vec4V maxV = minV; + + for(PxU32 i=1; i& callback, bool& abort) +{ + abort = true; + callback.mSize = 0; + return true; +} + +static PX_NOINLINE bool doSmallMeshVsSmallMesh(PxReportCallback& callback, const SourceMesh* mesh0, const SourceMesh* mesh1, const PxMat44* mat0to1, bool& _abort, bool ignoreCoplanar) +{ + const PxU32 nbTris0 = mesh0->getNbTriangles(); + PX_ASSERT(nbTris0<16); + const PxU32 nbTris1 = mesh1->getNbTriangles(); + PX_ASSERT(nbTris1<16); + + bool abort; + bool status = false; + if(doLeafVsLeaf(callback, nbTris0, nbTris1, mesh0, mesh1, mat0to1, false, abort, ignoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + return status; +} + +template +static PX_NOINLINE bool doSmallMeshVsTree( PxReportCallback& callback, MeshMeshParams& params, + const PackedNodeT* PX_RESTRICT node, const SourceMesh* mesh0, const SourceMesh* mesh1, bool& _abort) +{ + const PxU32 nbTris = mesh0->getNbTriangles(); + PX_ASSERT(nbTris<16); + + { + BV4_ALIGN16(PxVec3p boxCenter); + BV4_ALIGN16(PxVec3p boxExtents); + + Vec4V centerV, extentsV; + getBox(centerV, extentsV, mesh0->getNbVertices(), mesh0->getVerts()); + V4StoreA(centerV, &boxCenter.x); + V4StoreA(extentsV, &boxExtents.x); + + params.setupForTraversal(boxCenter, boxExtents); + params.mPrimIndex0 = nbTris; + } + + const PackedNodeT* const root = node; + const SwizzledNodeT* tn = reinterpret_cast(node); + + bool status = false; + for(PxU32 i=0;i<4;i++) + { + if(tn->mData[i]==0xffffffff) + continue; + + Vec4V centerV1, extentsV1; + getBox(centerV1, extentsV1, tn, i, ¶ms.mCenterOrMinCoeff_PaddedAligned, ¶ms.mExtentsOrMaxCoeff_PaddedAligned); + + if(BV4_BoxBoxOverlap(centerV1, extentsV1, ¶ms)) + { + if(tn->isLeaf(i)) + { + bool abort; + if(doLeafVsLeaf(callback, nbTris, tn->getPrimitive(i), mesh0, mesh1, params.mMat0to1, params.mMustFlip, abort, params.mIgnoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + } + else + { + if(doLeafVsNode(root, tn, i, ¶ms)) + return abortQuery(callback, _abort); + } + } + } + + return status || params.mStatus; +} + +template +static bool BV4_OverlapMeshVsMeshT(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, bool& _abort, bool ignoreCoplanar) +{ + const SourceMesh* mesh0 = static_cast(tree0.mMeshInterface); + const SourceMesh* mesh1 = static_cast(tree1.mMeshInterface); + + const PackedNodeT0* PX_RESTRICT node0 = reinterpret_cast(tree0.mNodes); + const PackedNodeT1* PX_RESTRICT node1 = reinterpret_cast(tree1.mNodes); + PX_ASSERT(node0 || node1); + + if(!node0 && node1) + { + MeshMeshParams ParamsForTree1Traversal(callback, mesh0, mesh1, mat0to1, tree1, false, ignoreCoplanar); + return doSmallMeshVsTree(callback, ParamsForTree1Traversal, node1, mesh0, mesh1, _abort); + } + else if(node0 && !node1) + { + MeshMeshParams ParamsForTree0Traversal(callback, mesh1, mesh0, mat1to0, tree0, true, ignoreCoplanar); + return doSmallMeshVsTree(callback, ParamsForTree0Traversal, node0, mesh1, mesh0, _abort); + } + else + { + PX_ASSERT(node0); + PX_ASSERT(node1); + + MeshMeshParams ParamsForTree1Traversal(callback, mesh0, mesh1, mat0to1, tree1, false, ignoreCoplanar); + MeshMeshParams ParamsForTree0Traversal(callback, mesh1, mesh0, mat1to0, tree0, true, ignoreCoplanar); + + BV4_ALIGN16(PxVec3p boxCenter0); + BV4_ALIGN16(PxVec3p boxExtents0); + BV4_ALIGN16(PxVec3p boxCenter1); + BV4_ALIGN16(PxVec3p boxExtents1); + + struct indexPair + { + PxU32 index0; + PxU32 index1; + }; + + PxU32 nb=1; + indexPair stack[GU_BV4_STACK_SIZE]; + stack[0].index0 = tree0.mInitData; + stack[0].index1 = tree1.mInitData; + + bool status = false; + + const PackedNodeT0* const root0 = node0; + const PackedNodeT1* const root1 = node1; + + do + { + const indexPair& childData = stack[--nb]; + node0 = root0 + getChildOffset(childData.index0); + node1 = root1 + getChildOffset(childData.index1); + + const SwizzledNodeT0* tn0 = reinterpret_cast(node0); + const SwizzledNodeT1* tn1 = reinterpret_cast(node1); + + for(PxU32 i=0;i<4;i++) + { + if(tn0->mData[i]==0xffffffff) + continue; + + Vec4V centerV0, extentsV0; + getBox(centerV0, extentsV0, tn0, i, &ParamsForTree0Traversal.mCenterOrMinCoeff_PaddedAligned, &ParamsForTree0Traversal.mExtentsOrMaxCoeff_PaddedAligned); + V4StoreA(centerV0, &boxCenter0.x); + V4StoreA(extentsV0, &boxExtents0.x); + + ParamsForTree1Traversal.setupForTraversal(boxCenter0, boxExtents0); + + for(PxU32 j=0;j<4;j++) + { + if(tn1->mData[j]==0xffffffff) + continue; + + Vec4V centerV1, extentsV1; + getBox(centerV1, extentsV1, tn1, j, &ParamsForTree1Traversal.mCenterOrMinCoeff_PaddedAligned, &ParamsForTree1Traversal.mExtentsOrMaxCoeff_PaddedAligned); + + if(BV4_BoxBoxOverlap(centerV1, extentsV1, &ParamsForTree1Traversal)) + { + const PxU32 isLeaf0 = tn0->isLeaf(i); + const PxU32 isLeaf1 = tn1->isLeaf(j); + + if(isLeaf0) + { + if(isLeaf1) + { + bool abort; + if(doLeafVsLeaf(callback, tn0->getPrimitive(i), tn1->getPrimitive(j), mesh0, mesh1, mat0to1, false, abort, ignoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + } + else + { + ParamsForTree1Traversal.mPrimIndex0 = tn0->getPrimitive(i); + if(doLeafVsNode(root1, tn1, j, &ParamsForTree1Traversal)) + return abortQuery(callback, _abort); + } + } + else + { + if(isLeaf1) + { + V4StoreA(centerV1, &boxCenter1.x); + V4StoreA(extentsV1, &boxExtents1.x); + + ParamsForTree0Traversal.setupForTraversal(boxCenter1, boxExtents1); + + ParamsForTree0Traversal.mPrimIndex0 = tn1->getPrimitive(j); + if(doLeafVsNode(root0, tn0, i, &ParamsForTree0Traversal)) + return abortQuery(callback, _abort); + } + else + { + stack[nb].index0 = tn0->getChildData(i); + stack[nb].index1 = tn1->getChildData(j); + nb++; + } + } + } + } + } + + }while(nb); + + return status || ParamsForTree0Traversal.mStatus || ParamsForTree1Traversal.mStatus; + } +} + +// PT: each mesh can be: +// 1) a small mesh without tree +// 2) a regular mesh with a quantized tree +// 3) a regular mesh with a non-quantized tree +// +// So for mesh-vs-mesh that's 3*3 = 9 possibilities. Some of them are redundant (e.g. 1 vs 2 and 2 vs 1) so it comes down to: +// 1) small mesh vs small mesh +// 2) small mesh vs quantized tree +// 3) small mesh vs non-quantized tree +// 4) non-quantized tree vs non-quantized tree +// 5) quantized tree vs non-quantized tree +// 6) quantized tree vs quantized tree +// => 6 codepaths +// +// But for each of this codepath the query can be: +// - all hits or any hits +// - using PxRegularReportCallback / PxLocalStorageReportCallback / PxExternalStorageReportCallback / PxDynamicArrayReportCallback +// So for each codepath that's 2*4 = 8 possible queries. +// +// Thus we'd need 6*8 = 48 different test cases. +// +// This gets worse if we take scaling into account. + +bool BV4_OverlapMeshVsMesh(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, PxMeshMeshQueryFlags meshMeshFlags) +{ + PxGeomIndexPair stackBuffer[256]; + bool mustResetBuffer; + if(callback.mBuffer) + { + PX_ASSERT(callback.mCapacity); + mustResetBuffer = false; + } + else + { + callback.mBuffer = stackBuffer; + PX_ASSERT(callback.mCapacity<=256); + if(callback.mCapacity==0 || callback.mCapacity>256) + { + callback.mCapacity = 256; + } + callback.mSize = 0; + mustResetBuffer = true; + } + + const bool ignoreCoplanar = meshMeshFlags & PxMeshMeshQueryFlag::eDISCARD_COPLANAR; + + bool status; + bool abort = false; + if(!tree0.mNodes && !tree1.mNodes) + { + const SourceMesh* mesh0 = static_cast(tree0.mMeshInterface); + const SourceMesh* mesh1 = static_cast(tree1.mMeshInterface); + status = doSmallMeshVsSmallMesh(callback, mesh0, mesh1, mat0to1, abort, ignoreCoplanar); + } + else + { + if(tree0.mQuantized) + { + if(tree1.mQuantized) + status = BV4_OverlapMeshVsMeshT(callback, tree0, tree1, mat0to1, mat1to0, abort, ignoreCoplanar); + else + status = BV4_OverlapMeshVsMeshT(callback, tree0, tree1, mat0to1, mat1to0, abort, ignoreCoplanar); + } + else + { + if(tree1.mQuantized) + status = BV4_OverlapMeshVsMeshT(callback, tree0, tree1, mat0to1, mat1to0, abort, ignoreCoplanar); + else + status = BV4_OverlapMeshVsMeshT(callback, tree0, tree1, mat0to1, mat1to0, abort, ignoreCoplanar); + } + } + + if(!abort) + { + const PxU32 currentSize = callback.mSize; + if(currentSize) + { + callback.mSize = 0; + callback.flushResults(currentSize, callback.mBuffer); + } + } + + if(mustResetBuffer) + callback.mBuffer = NULL; + return status; +} + + + + +// PT: experimental version supporting scaling. Passed matrices etc are all temporary. + +#include "geometry/PxMeshScale.h" +#include "CmMatrix34.h" +#include "CmScaling.h" +#include "GuConvexUtilsInternal.h" +#include "GuBoxConversion.h" + +using namespace Cm; + +// PT/ dups from NpDebugViz.cpp +static PX_FORCE_INLINE Vec4V multiply3x3V_(const Vec4V p, const PxMat34& mat) +{ + Vec4V ResV = V4Scale(V4LoadU(&mat.m.column0.x), V4GetX(p)); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.m.column1.x), V4GetY(p))); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.m.column2.x), V4GetZ(p))); + return ResV; +} + +// PT: beware, needs padding at the end of dst/src +static PX_FORCE_INLINE void transformV_(PxVec3* dst, const PxVec3* src, const Vec4V p, const PxMat34& mat) +{ + const Vec4V vertexV = V4LoadU(&src->x); + const Vec4V transformedV = V4Add(multiply3x3V_(vertexV, mat), p); + V4StoreU(transformedV, &dst->x); +} + +// PT: Following ones fetched from GuBounds.cpp and adapted to Vec4V inputs. +// TODO: refactor! this is just a test + +// PT: this one may have duplicates in GuBV4_BoxSweep_Internal.h & GuBV4_Raycast.cpp +static PX_FORCE_INLINE Vec4V multiply3x3V_(const Vec4V p, const PxMat33Padded& mat_Padded) +{ + Vec4V ResV = V4Scale(V4LoadU(&mat_Padded.column0.x), V4GetX(p)); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat_Padded.column1.x), V4GetY(p))); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat_Padded.column2.x), V4GetZ(p))); + return ResV; +} + +static PX_FORCE_INLINE void transformNoEmptyTestV(Vec4V& c, Vec4V& ext, const PxMat33Padded& rot, const PxVec3& pos, Vec4V boundsCenterV, Vec4V boundsExtentsV) +{ + // PT: unfortunately we can't V4LoadU 'pos' directly (it can come directly from users!). So we have to live with this for now: + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&pos.x)); + // PT: but eventually we'd like to use the "unsafe" version (e.g. by switching p&q in PxTransform), which would save 6 instructions on Win32 + const Vec4V cV = V4Add(multiply3x3V_(boundsCenterV, rot), posV); + + c = cV; + + // extended basis vectors + const Vec4V c0V = V4Scale(V4LoadU(&rot.column0.x), V4GetX(boundsExtentsV)); + const Vec4V c1V = V4Scale(V4LoadU(&rot.column1.x), V4GetY(boundsExtentsV)); + const Vec4V c2V = V4Scale(V4LoadU(&rot.column2.x), V4GetZ(boundsExtentsV)); + + // find combination of base vectors that produces max. distance for each component = sum of abs() + Vec4V extentsV = V4Add(V4Abs(c0V), V4Abs(c1V)); + extentsV = V4Add(extentsV, V4Abs(c2V)); + + ext = extentsV; +} + +static PX_FORCE_INLINE void transformNoEmptyTest(const PxMat34& absPose, Vec4V& c, Vec4V& ext, Vec4V boundsCenterV, Vec4V boundsExtentsV) +{ + transformNoEmptyTestV(c, ext, static_cast(absPose.m), absPose.p, boundsCenterV, boundsExtentsV); +} + +static void computeMeshBounds(const PxMat34& absPose, Vec4V boundsCenterV, Vec4V boundsExtentsV, Vec4V& origin, Vec4V& extent) +{ + transformNoEmptyTest(absPose, origin, extent, boundsCenterV, boundsExtentsV); +} + +static bool doLeafVsLeaf_Scaled(PxReportCallback& callback, const PxU32 prim0, const PxU32 prim1, const SourceMesh* mesh0, const SourceMesh* mesh1, + const PxMat34& absPose0, const PxMat34& absPose1, bool mustFlip, bool& abort, bool ignoreCoplanar) +{ + TriangleData data0[16]; + TriangleData data1[16]; + + PxU32 nb0 = 0; + PxU32 startPrim0; + { + PxU32 primIndex0 = prim0; + PxU32 nbTris0 = getNbPrimitives(primIndex0); + startPrim0 = primIndex0; + const PxVec3* verts0 = mesh0->getVerts(); + do + { + PX_ASSERT(primIndex0getNbTriangles()); + PxU32 VRef00, VRef01, VRef02; + getVertexReferences(VRef00, VRef01, VRef02, primIndex0++, mesh0->getTris32(), mesh0->getTris16()); + PX_ASSERT(VRef00getNbVertices()); + PX_ASSERT(VRef01getNbVertices()); + PX_ASSERT(VRef02getNbVertices()); + + PxVec3p p0, p1, p2; + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&absPose0.p.x)); + transformV_(&p0, &verts0[VRef00], posV, absPose0); + transformV_(&p1, &verts0[VRef01], posV, absPose0); + transformV_(&p2, &verts0[VRef02], posV, absPose0); + data0[nb0++].init(p0, p1, p2); + + }while(nbTris0--); + } + + PxU32 nb1 = 0; + PxU32 startPrim1; + { + PxU32 primIndex1 = prim1; + PxU32 nbTris1 = getNbPrimitives(primIndex1); + startPrim1 = primIndex1; + const PxVec3* verts1 = mesh1->getVerts(); + do + { + PX_ASSERT(primIndex1getNbTriangles()); + PxU32 VRef10, VRef11, VRef12; + getVertexReferences(VRef10, VRef11, VRef12, primIndex1++, mesh1->getTris32(), mesh1->getTris16()); + PX_ASSERT(VRef10getNbVertices()); + PX_ASSERT(VRef11getNbVertices()); + PX_ASSERT(VRef12getNbVertices()); + + PxVec3p p0, p1, p2; + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&absPose1.p.x)); + transformV_(&p0, &verts1[VRef10], posV, absPose1); + transformV_(&p1, &verts1[VRef11], posV, absPose1); + transformV_(&p2, &verts1[VRef12], posV, absPose1); + data1[nb1++].init(p0, p1, p2); + + }while(nbTris1--); + } + + PX_ASSERT(nb0<=16); + PX_ASSERT(nb1<=16); + + PxGeomIndexPair* dst = callback.mBuffer; + PxU32 capacity = callback.mCapacity; + PxU32 currentSize = callback.mSize; + PX_ASSERT(currentSize& callback, const SourceMesh* mesh0, const SourceMesh* mesh1, + const PxMat34& absPose0, const PxMat34& absPose1, bool& _abort, bool ignoreCoplanar) +{ + const PxU32 nbTris0 = mesh0->getNbTriangles(); + PX_ASSERT(nbTris0<16); + const PxU32 nbTris1 = mesh1->getNbTriangles(); + PX_ASSERT(nbTris1<16); + + bool abort; + bool status = false; + if(doLeafVsLeaf_Scaled(callback, nbTris0, nbTris1, mesh0, mesh1, absPose0, absPose1, false, abort, ignoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + return status; +} + +namespace +{ + +// PT: this bit from NpDebugViz.cpp, visualizeTriangleMesh() +static PxMat34 getAbsPose(const PxTransform& meshPose, const PxMeshScale& meshScale) +{ + const PxMat33Padded m33(meshPose.q); + return PxMat34(m33 * toMat33(meshScale), meshPose.p); +} + +struct MeshMeshParams_Scaled : MeshMeshParams +{ + PX_FORCE_INLINE MeshMeshParams_Scaled(PxReportCallback& callback, const SourceMesh* mesh0, const SourceMesh* mesh1, + const PxTransform& meshPose0, const PxTransform& meshPose1, + const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, + const PxMat34& absPose0, const PxMat34& absPose1, + const PxMat44* mat0to1, const BV4Tree& tree, bool mustFlip, bool ignoreCoplanar) : + MeshMeshParams(callback, mesh0, mesh1, mat0to1, tree, mustFlip, ignoreCoplanar), + mMeshPose0(meshPose0), + mMeshPose1(meshPose1), + mMeshScale0(meshScale0), + mMeshScale1(meshScale1), + mAbsPose0(absPose0), + mAbsPose1(absPose1) + { + } + + PxMat33 mRModelToBox_Padded; //!< Rotation from model space to obb space + PxVec3p mTModelToBox_Padded; //!< Translation from model space to obb space + + const PxTransform& mMeshPose0; + const PxTransform& mMeshPose1; + const PxMeshScale& mMeshScale0; + const PxMeshScale& mMeshScale1; + const PxMat34& mAbsPose0; + const PxMat34& mAbsPose1; + + PX_NOCOPY(MeshMeshParams_Scaled) +}; + +template +static PX_FORCE_INLINE void setupBoxParams2(ParamsT* PX_RESTRICT params, const Box& localBox) +{ + invertBoxMatrix(params->mRModelToBox_Padded, params->mTModelToBox_Padded, localBox); + params->mTBoxToModel_PaddedAligned = localBox.center; + + params->precomputeBoxData(localBox.extents, &localBox.rot); +} + +class LeafFunction_MeshMesh_Scaled +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(MeshMeshParams_Scaled* PX_RESTRICT params, PxU32 primIndex1) + { + bool abort; + if(doLeafVsLeaf_Scaled(params->mCallback, params->mPrimIndex0, primIndex1, params->mMesh0, params->mMesh1, + params->mAbsPose0, params->mAbsPose1, + params->mMustFlip, abort, params->mIgnoreCoplanar)) + params->mStatus = true; + return PxIntBool(abort); + } +}; + + PX_FORCE_INLINE PxIntBool BV4_AABBAABBOverlap(const Vec4VArg boxCenter0V, const Vec4VArg extents0V, const Vec4VArg boxCenter1V, const Vec4VArg extents1V) + { + const Vec4V absTV = V4Abs(V4Sub(boxCenter0V, boxCenter1V)); + const BoolV res = V4IsGrtr(absTV, V4Add(extents0V, extents1V)); + const PxU32 test = BGetBitMask(res); + if(test&7) + return 0; + return 1; + } +} + +static PX_FORCE_INLINE PxIntBool doLeafVsNode_Scaled(const BVDataPackedQ* const PX_RESTRICT root, const BVDataSwizzledQ* PX_RESTRICT node, PxU32 i, MeshMeshParams_Scaled* PX_RESTRICT params) +{ + return BV4_ProcessStreamSwizzledNoOrderQ(root, node->getChildData(i), params); +} + +static PX_FORCE_INLINE PxIntBool doLeafVsNode_Scaled(const BVDataPackedNQ* const PX_RESTRICT root, const BVDataSwizzledNQ* PX_RESTRICT node, PxU32 i, MeshMeshParams_Scaled* PX_RESTRICT params) +{ + return BV4_ProcessStreamSwizzledNoOrderNQ(root, node->getChildData(i), params); +} + +static void computeVertexSpaceOBB(Box& dst, const Box& src, const PxMat34& inverse) +{ + dst = transform(inverse, src); +} + +template +static PX_NOINLINE bool doSmallMeshVsTree_Scaled( PxReportCallback& callback, MeshMeshParams_Scaled& params, + const PackedNodeT* PX_RESTRICT node, const SourceMesh* mesh0, const SourceMesh* mesh1, bool& _abort) +{ + const PxU32 nbTris = mesh0->getNbTriangles(); + PX_ASSERT(nbTris<16); + + Vec4V scaledCenterV, scaledExtentV; + Box vertexOBB; // query box in vertex space +// { + BV4_ALIGN16(PxVec3p boxCenter); + BV4_ALIGN16(PxVec3p boxExtents); + + Vec4V centerV, extentsV; + getBox(centerV, extentsV, mesh0->getNbVertices(), mesh0->getVerts()); + + computeMeshBounds(params.mAbsPose0, centerV, extentsV, scaledCenterV, scaledExtentV); + centerV = scaledCenterV; + extentsV = scaledExtentV; + + V4StoreA(centerV, &boxCenter.x); + V4StoreA(extentsV, &boxExtents.x); + + Box box; + buildFrom(box, boxCenter, boxExtents, PxQuat(PxIdentity)); + + computeVertexSpaceOBB(vertexOBB, box, params.mMeshPose1, params.mMeshScale1); + + params.setupForTraversal(boxCenter, boxExtents); + + setupBoxParams2(¶ms, vertexOBB); + + params.mPrimIndex0 = nbTris; +// } + + const PackedNodeT* const root = node; + const SwizzledNodeT* tn = reinterpret_cast(node); + + bool status = false; + for(PxU32 i=0;i<4;i++) + { + if(tn->mData[i]==0xffffffff) + continue; + + Vec4V centerV1, extentsV1; + getBox(centerV1, extentsV1, tn, i, ¶ms.mCenterOrMinCoeff_PaddedAligned, ¶ms.mExtentsOrMaxCoeff_PaddedAligned); + + Vec4V scaledCenterV1, scaledExtentV1; + computeMeshBounds(params.mAbsPose1, centerV1, extentsV1, scaledCenterV1, scaledExtentV1); + centerV1 = scaledCenterV1; + extentsV1 = scaledExtentV1; + + if(BV4_AABBAABBOverlap(scaledCenterV, scaledExtentV, scaledCenterV1, scaledExtentV1)) + { + if(tn->isLeaf(i)) + { + bool abort; + if(doLeafVsLeaf_Scaled(callback, nbTris, tn->getPrimitive(i), mesh0, mesh1, params.mAbsPose0, params.mAbsPose1, params.mMustFlip, abort, params.mIgnoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + } + else + { + if(doLeafVsNode_Scaled(root, tn, i, ¶ms)) + return abortQuery(callback, _abort); + } + } + } + + return status || params.mStatus; +} + +template +static bool BV4_OverlapMeshVsMeshT_Scaled(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, + const PxTransform& meshPose0, const PxTransform& meshPose1, + const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, + const PxMat34& absPose0, const PxMat34& absPose1, + bool& _abort, bool ignoreCoplanar) +{ + const SourceMesh* mesh0 = static_cast(tree0.mMeshInterface); + const SourceMesh* mesh1 = static_cast(tree1.mMeshInterface); + + const PackedNodeT0* PX_RESTRICT node0 = reinterpret_cast(tree0.mNodes); + const PackedNodeT1* PX_RESTRICT node1 = reinterpret_cast(tree1.mNodes); + PX_ASSERT(node0 || node1); + + if(!node0 && node1) + { + MeshMeshParams_Scaled ParamsForTree1Traversal(callback, mesh0, mesh1, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, mat0to1, tree1, false, ignoreCoplanar); + return doSmallMeshVsTree_Scaled(callback, ParamsForTree1Traversal, node1, mesh0, mesh1, _abort); + } + else if(node0 && !node1) + { + MeshMeshParams_Scaled ParamsForTree0Traversal(callback, mesh1, mesh0, meshPose1, meshPose0, meshScale1, meshScale0, absPose1, absPose0, mat1to0, tree0, true, ignoreCoplanar); + return doSmallMeshVsTree_Scaled(callback, ParamsForTree0Traversal, node0, mesh1, mesh0, _abort); + } + else + { + PX_ASSERT(node0); + PX_ASSERT(node1); + + // ### some useless computations in there now + MeshMeshParams_Scaled ParamsForTree1Traversal(callback, mesh0, mesh1, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, mat0to1, tree1, false, ignoreCoplanar); + MeshMeshParams_Scaled ParamsForTree0Traversal(callback, mesh1, mesh0, meshPose1, meshPose0, meshScale1, meshScale0, absPose1, absPose0, mat1to0, tree0, true, ignoreCoplanar); + + const PxMat34 inverse0 = meshScale0.getInverse() * Matrix34FromTransform(meshPose0.getInverse()); + const PxMat34 inverse1 = meshScale1.getInverse() * Matrix34FromTransform(meshPose1.getInverse()); + + BV4_ALIGN16(PxVec3p boxCenter0); + BV4_ALIGN16(PxVec3p boxExtents0); + BV4_ALIGN16(PxVec3p boxCenter1); + BV4_ALIGN16(PxVec3p boxExtents1); + + struct indexPair + { + PxU32 index0; + PxU32 index1; + }; + + PxU32 nb=1; + indexPair stack[GU_BV4_STACK_SIZE]; + stack[0].index0 = tree0.mInitData; + stack[0].index1 = tree1.mInitData; + + bool status = false; + + const PackedNodeT0* const root0 = node0; + const PackedNodeT1* const root1 = node1; + + do + { + const indexPair& childData = stack[--nb]; + node0 = root0 + getChildOffset(childData.index0); + node1 = root1 + getChildOffset(childData.index1); + + const SwizzledNodeT0* tn0 = reinterpret_cast(node0); + const SwizzledNodeT1* tn1 = reinterpret_cast(node1); + + for(PxU32 i=0;i<4;i++) + { + if(tn0->mData[i]==0xffffffff) + continue; + + Vec4V centerV0, extentsV0; + getBox(centerV0, extentsV0, tn0, i, &ParamsForTree0Traversal.mCenterOrMinCoeff_PaddedAligned, &ParamsForTree0Traversal.mExtentsOrMaxCoeff_PaddedAligned); + + Vec4V scaledCenterV0, scaledExtentV0; + computeMeshBounds(absPose0, centerV0, extentsV0, scaledCenterV0, scaledExtentV0); + centerV0 = scaledCenterV0; + extentsV0 = scaledExtentV0; + + V4StoreA(centerV0, &boxCenter0.x); + V4StoreA(extentsV0, &boxExtents0.x); + + for(PxU32 j=0;j<4;j++) + { + if(tn1->mData[j]==0xffffffff) + continue; + + Vec4V centerV1, extentsV1; + getBox(centerV1, extentsV1, tn1, j, &ParamsForTree1Traversal.mCenterOrMinCoeff_PaddedAligned, &ParamsForTree1Traversal.mExtentsOrMaxCoeff_PaddedAligned); + + Vec4V scaledCenterV1, scaledExtentV1; + computeMeshBounds(absPose1, centerV1, extentsV1, scaledCenterV1, scaledExtentV1); + centerV1 = scaledCenterV1; + extentsV1 = scaledExtentV1; + + if(BV4_AABBAABBOverlap(scaledCenterV0, scaledExtentV0, scaledCenterV1, scaledExtentV1)) + { + const PxU32 isLeaf0 = tn0->isLeaf(i); + const PxU32 isLeaf1 = tn1->isLeaf(j); + + if(isLeaf0) + { + if(isLeaf1) + { + bool abort; + if(doLeafVsLeaf_Scaled(callback, tn0->getPrimitive(i), tn1->getPrimitive(j), mesh0, mesh1, absPose0, absPose1, false, abort, ignoreCoplanar)) + status = true; + if(abort) + return abortQuery(callback, _abort); + } + else + { + Box box; + buildFrom(box, boxCenter0, boxExtents0, PxQuat(PxIdentity)); + + Box vertexOBB; // query box in vertex space + computeVertexSpaceOBB(vertexOBB, box, inverse1); + + setupBoxParams2(&ParamsForTree1Traversal, vertexOBB); + + ParamsForTree1Traversal.mPrimIndex0 = tn0->getPrimitive(i); + if(doLeafVsNode_Scaled(root1, tn1, j, &ParamsForTree1Traversal)) + return abortQuery(callback, _abort); + } + } + else + { + if(isLeaf1) + { + V4StoreA(centerV1, &boxCenter1.x); + V4StoreA(extentsV1, &boxExtents1.x); + + Box box; + buildFrom(box, boxCenter1, boxExtents1, PxQuat(PxIdentity)); + + Box vertexOBB; // query box in vertex space + computeVertexSpaceOBB(vertexOBB, box, inverse0); + + setupBoxParams2(&ParamsForTree0Traversal, vertexOBB); + + ParamsForTree0Traversal.mPrimIndex0 = tn1->getPrimitive(j); + if(doLeafVsNode_Scaled(root0, tn0, i, &ParamsForTree0Traversal)) + return abortQuery(callback, _abort); + } + else + { + stack[nb].index0 = tn0->getChildData(i); + stack[nb].index1 = tn1->getChildData(j); + nb++; + } + } + } + } + } + + }while(nb); + + return status || ParamsForTree0Traversal.mStatus || ParamsForTree1Traversal.mStatus; + } +} + +bool BV4_OverlapMeshVsMesh(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, + const PxTransform& meshPose0, const PxTransform& meshPose1, + const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, + PxMeshMeshQueryFlags meshMeshFlags) +{ + PxGeomIndexPair stackBuffer[256]; + bool mustResetBuffer; + if(callback.mBuffer) + { + PX_ASSERT(callback.mCapacity); + mustResetBuffer = false; + } + else + { + callback.mBuffer = stackBuffer; + PX_ASSERT(callback.mCapacity<=256); + if(callback.mCapacity==0 || callback.mCapacity>256) + { + callback.mCapacity = 256; + } + callback.mSize = 0; + mustResetBuffer = true; + } + + // PT: TODO: we now compute this pose eagerly rather than lazily. Maybe revisit this later. + const PxMat34 absPose0 = getAbsPose(meshPose0, meshScale0); + const PxMat34 absPose1 = getAbsPose(meshPose1, meshScale1); + + const bool ignoreCoplanar = meshMeshFlags & PxMeshMeshQueryFlag::eDISCARD_COPLANAR; + + bool status; + bool abort = false; + if(!tree0.mNodes && !tree1.mNodes) + { + const SourceMesh* mesh0 = static_cast(tree0.mMeshInterface); + const SourceMesh* mesh1 = static_cast(tree1.mMeshInterface); + + status = doSmallMeshVsSmallMesh_Scaled(callback, mesh0, mesh1, absPose0, absPose1, abort, ignoreCoplanar); + } + else + { + if(tree0.mQuantized) + { + if(tree1.mQuantized) + status = BV4_OverlapMeshVsMeshT_Scaled(callback, tree0, tree1, mat0to1, mat1to0, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, abort, ignoreCoplanar); + else + status = BV4_OverlapMeshVsMeshT_Scaled(callback, tree0, tree1, mat0to1, mat1to0, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, abort, ignoreCoplanar); + } + else + { + if(tree1.mQuantized) + status = BV4_OverlapMeshVsMeshT_Scaled(callback, tree0, tree1, mat0to1, mat1to0, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, abort, ignoreCoplanar); + else + status = BV4_OverlapMeshVsMeshT_Scaled(callback, tree0, tree1, mat0to1, mat1to0, meshPose0, meshPose1, meshScale0, meshScale1, absPose0, absPose1, abort, ignoreCoplanar); + } + } + + if(!abort) + { + const PxU32 currentSize = callback.mSize; + if(currentSize) + { + callback.mSize = 0; + callback.flushResults(currentSize, callback.mBuffer); + } + } + + if(mustResetBuffer) + callback.mBuffer = NULL; + + return status; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp new file mode 100644 index 0000000..3b1db57 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_OBBSweep.cpp @@ -0,0 +1,167 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; +#include "GuBV4_BoxSweep_Internal.h" + +PxIntBool Sweep_AABB_BV4(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags); +void GenericSweep_AABB_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, MeshSweepCallback callback, void* userData, PxU32 flags); +void Sweep_AABB_BV4_CB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting); + +// PT: TODO: optimize this (TA34704) +static PX_FORCE_INLINE void computeLocalData(Box& localBox, PxVec3& localDir, const Box& box, const PxVec3& dir, const PxMat44* PX_RESTRICT worldm_Aligned) +{ + if(worldm_Aligned) + { + PxMat44 IWM; + invertPRMatrix(&IWM, worldm_Aligned); + + localDir = IWM.rotate(dir); + + rotateBox(localBox, IWM, box); + } + else + { + localDir = dir; + localBox = box; // PT: TODO: check asm for operator= (TA34704) + } +} + +static PX_FORCE_INLINE bool isAxisAligned(const PxVec3& axis) +{ + const PxReal minLimit = 1e-3f; + const PxReal maxLimit = 1.0f - 1e-3f; + + const PxReal absX = PxAbs(axis.x); + if(absX>minLimit && absXminLimit && absYminLimit && absZmPos = worldm_Aligned->transform(hit->mPos); + hit->mNormal = worldm_Aligned->rotate(hit->mNormal); + } + return Status; +} + +// PT: for design decisions in this function, refer to the comments of BV4_GenericSweepCB(). +void BV4_BoxSweepCB(const Box& box, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting) +{ + Box localBox; + PxVec3 localDir; + computeLocalData(localBox, localDir, box, dir, worldm_Aligned); + + if(isAABB(localBox)) + Sweep_AABB_BV4_CB(localBox, localDir, maxDist, tree, worldm_Aligned, callback, userData, flags, nodeSorting); + else + Sweep_OBB_BV4_CB(localBox, localDir, maxDist, tree, worldm_Aligned, callback, userData, flags, nodeSorting); +} + + +// PT: this generic sweep uses an OBB because this is the most versatile volume, but it does not mean this function is +// a "box sweep function" per-se. In fact it could be used all alone to implement all sweeps in the SDK (but that would +// have an impact on performance). +// +// So the idea here is simply to provide and use a generic function for everything that the BV4 code does not support directly. +// In particular this should be used: +// - for convex sweeps (where the OBB is the box around the swept convex) +// - for non-trivial sphere/capsule/box sweeps where mesh scaling or inflation +// +// By design we don't do leaf tests inside the BV4 traversal code here (because we don't support them, e.g. convex +// sweeps. If we could do them inside the BV4 traversal code, like we do for regular sweeps, then this would not be a generic +// sweep function, but instead a built-in, natively supported query). So the leaf tests are performed outside of BV4, in the +// client code, through MeshSweepCallback. This has a direct impact on the design & parameters of MeshSweepCallback. +// +// On the other hand this is used for "regular sweeps with shapes we don't natively support", i.e. SweepSingle kind of queries. +// This means that we need to support an early-exit codepath (without node-sorting) and a regular sweep single codepath (with +// node sorting) for this generic function. The leaf tests are external, but everything traversal-related should be exactly the +// same as the regular box-sweep function otherwise. +// +// As a consequence, this function is not well-suited to implement "unlimited results" kind of queries, a.k.a. "sweep all": +// +// - for regular sphere/capsule/box "sweep all" queries, the leaf tests should be internal (same as sweep single queries). This +// means the existing MeshSweepCallback can't be reused. +// +// - there is no need to support "sweep any" (it is already supported by the other sweep functions). +// +// - there may be no need for ordered traversal/node sorting/ray shrinking, since we want to return all results anyway. But this +// may not be true if the "sweep all" function is used to emulate the Epic Tweak. In that case we still want to shrink the ray +// and use node sorting. Since both versions are useful, we should probably have a bool param to enable/disable node sorting. +// +// - we are interested in all hits so we can't delay the computation of impact data (computing it only once in the end, for the +// closest hit). We actually need to compute the data for all hits, possibly within the traversal code. +void BV4_GenericSweepCB(const Box& localBox, const PxVec3& localDir, float maxDist, const BV4Tree& tree, MeshSweepCallback callback, void* userData, bool anyHit) +{ + const PxU32 flags = anyHit ? PxU32(QUERY_MODIFIER_ANY_HIT) : 0; + + if(isAABB(localBox)) + GenericSweep_AABB_CB(localBox, localDir, maxDist, tree, callback, userData, flags); + else + GenericSweep_OBB_CB(localBox, localDir, maxDist, tree, callback, userData, flags); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_OBBOBB.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_OBBOBB.h new file mode 100644 index 0000000..3b9f7c2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_OBBOBB.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_PROCESS_STREAM_NOORDER_OBB_OBB_H +#define GU_BV4_PROCESS_STREAM_NOORDER_OBB_OBB_H + +#ifdef GU_BV4_USE_SLABS +/* template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_Swizzled(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzled* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CE(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + }*/ + + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_SwizzledQ(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CEQ(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + } + + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_SwizzledNQ(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledNQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CENQ(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + } + +#else + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_BoxBoxOverlap(node+i, params)) + #else + if(BV4_BoxBoxOverlap(node[i].mAABB.mExtents, node[i].mAABB.mCenter, params)) + #endif + { + if(node[i].isLeaf()) + { + if(LeafTestT::doLeafTest(params, node[i].getPrimitive())) + return 1; + } + else + Stack[Nb++] = node[i].getChildData(); + } + return 0; + } +#endif + +#endif // GU_BV4_PROCESS_STREAM_NOORDER_OBB_OBB_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB.h new file mode 100644 index 0000000..cd33fab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_H +#define GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_H + +#ifndef GU_BV4_USE_SLABS + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_SegmentAABBOverlap(node+i, params)) + #else + if(BV4_SegmentAABBOverlap(node[i].mAABB.mCenter, node[i].mAABB.mExtents, params)) + #endif + { + if(node[i].isLeaf()) + { + if(LeafTestT::doLeafTest(params, node[i].getPrimitive())) + return 1; + } + else + Stack[Nb++] = node[i].getChildData(); + } + return 0; + } +#endif + +#endif // GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h new file mode 100644 index 0000000..bfa2fff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_INFLATED_H +#define GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_INFLATED_H + +#ifndef GU_BV4_USE_SLABS + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_SegmentAABBOverlap(node+i, params->mOriginalExtents_Padded, params)) + #else + if(BV4_SegmentAABBOverlap(node[i].mAABB.mCenter, node[i].mAABB.mExtents, params->mOriginalExtents_Padded, params)) + #endif + { + if(node[i].isLeaf()) + { + if(LeafTestT::doLeafTest(params, node[i].getPrimitive())) + return 1; + } + else + Stack[Nb++] = node[i].getChildData(); + } + return 0; + } +#endif + +#endif // GU_BV4_PROCESS_STREAM_NOORDER_SEGMENT_AABB_INFLATED_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SphereAABB.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SphereAABB.h new file mode 100644 index 0000000..0cfd76c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamNoOrder_SphereAABB.h @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_PROCESS_STREAM_NOORDER_SPHERE_AABB_H +#define GU_BV4_PROCESS_STREAM_NOORDER_SPHERE_AABB_H + +#ifdef GU_BV4_USE_SLABS +/* template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_Swizzled(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzled* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { +// OPC_SLABS_GET_CE(i) + OPC_SLABS_GET_CE2(i) + + if(BV4_SphereAABBOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + }*/ + + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_SwizzledQ(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CE2Q(i) + + if(BV4_SphereAABBOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + } + + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder_SwizzledNQ(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledNQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CE2NQ(i) + + if(BV4_SphereAABBOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + { + if(LeafTestT::doLeafTest(params, node->getPrimitive(i))) + return 1; + } + else + Stack[Nb++] = node->getChildData(i); + } + return 0; + } + +#else + template + PX_FORCE_INLINE PxIntBool BV4_ProcessNodeNoOrder(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_SphereAABBOverlap(node+i, params)) + #else + if(BV4_SphereAABBOverlap(node[i].mAABB.mCenter, node[i].mAABB.mExtents, params)) + #endif + { + if(node[i].isLeaf()) + { + if(LeafTestT::doLeafTest(params, node[i].getPrimitive())) + return 1; + } + else + Stack[Nb++] = node[i].getChildData(); + } + return 0; + } +#endif + +#endif // GU_BV4_PROCESS_STREAM_NOORDER_SPHERE_AABB_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamOrdered_OBBOBB.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamOrdered_OBBOBB.h new file mode 100644 index 0000000..c5d6336 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_ProcessStreamOrdered_OBBOBB.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_PROCESS_STREAM_ORDERED_OBB_OBB_H +#define GU_BV4_PROCESS_STREAM_ORDERED_OBB_OBB_H + +#ifdef GU_BV4_USE_SLABS +/* template + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_Swizzled(PxU32& code, const BVDataSwizzled* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CE(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + LeafTestT::doLeafTest(params, node->getPrimitive(i)); + else + code |= 1< + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_SwizzledQ(PxU32& code, const BVDataSwizzledQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CEQ(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + LeafTestT::doLeafTest(params, node->getPrimitive(i)); + else + code |= 1< + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2_SwizzledNQ(PxU32& code, const BVDataSwizzledNQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + OPC_SLABS_GET_CENQ(i) + + if(BV4_BoxBoxOverlap(centerV, extentsV, params)) + { + if(node->isLeaf(i)) + LeafTestT::doLeafTest(params, node->getPrimitive(i)); + else + code |= 1< + PX_FORCE_INLINE void BV4_ProcessNodeOrdered(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params, PxU32 i, PxU32 limit) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(i + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2(PxU32& code, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_BoxBoxOverlap(node+i, params)) + #else + if(BV4_BoxBoxOverlap(node[i].mAABB.mExtents, node[i].mAABB.mCenter, params)) + #endif + { + if(node[i].isLeaf()) + LeafTestT::doLeafTest(params, node[i].getPrimitive()); + else + code |= 1< + PX_FORCE_INLINE void BV4_ProcessNodeOrdered(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params, PxU32 i, PxU32 limit) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(i + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2(PxU32& code, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_SegmentAABBOverlap(node+i, params)) + #else + if(BV4_SegmentAABBOverlap(node[i].mAABB.mCenter, node[i].mAABB.mExtents, params)) + #endif + { + if(node[i].isLeaf()) + LeafTestT::doLeafTest(params, node[i].getPrimitive()); + else + code |= 1< + PX_FORCE_INLINE void BV4_ProcessNodeOrdered(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params, PxU32 i, PxU32 limit) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(imOriginalExtents, params)) + #else + if(imOriginalExtents, params)) + #endif + { + if(node[i].isLeaf()) + LeafTestT::doLeafTest(params, node[i].getPrimitive()); + else + Stack[Nb++] = node[i].getChildData(); + } + } + + template + PX_FORCE_INLINE void BV4_ProcessNodeOrdered2(PxU32& code, const BVDataPacked* PX_RESTRICT node, ParamsT* PX_RESTRICT params) + { + #ifdef GU_BV4_QUANTIZED_TREE + if(BV4_SegmentAABBOverlap(node+i, params->mOriginalExtents_Padded, params)) + #else + if(BV4_SegmentAABBOverlap(node[i].mAABB.mCenter, node[i].mAABB.mExtents, params->mOriginalExtents_Padded, params)) + #endif + { + if(node[i].isLeaf()) + LeafTestT::doLeafTest(params, node[i].getPrimitive()); + else + code |= 1< +PX_FORCE_INLINE PxIntBool RayTriOverlapT(PxGeomRaycastHit& mStabbedFace, const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, const T* PX_RESTRICT params) +{ +#ifdef TO_SEE + if(0) + { + const Vec4V vert0V = V4LoadU(&vert0.x); + const Vec4V edge1V = V4Sub(V4LoadU(&vert1.x), vert0V); + const Vec4V edge2V = V4Sub(V4LoadU(&vert2.x), vert0V); + + const Vec4V localDirV = V4LoadU(¶ms->mLocalDir_Padded.x); + const Vec4V pvecV = V4Cross(localDirV, edge2V); + const __m128 detV = DotV(edge1V, pvecV); + + if(params->mBackfaceCulling) + { + const Vec4V tvecV = V4Sub(V4LoadU(¶ms->mOrigin_Padded.x), vert0V); + const Vec4V qvecV = V4Cross(tvecV, edge1V); + const __m128 uV = DotV(tvecV, pvecV); + const __m128 vV = DotV(localDirV, qvecV); + const __m128 dV = DotV(edge2V, qvecV); + + if(1) // best so far, alt impl, looks like it's exactly the same speed, might be better for platforms that don't have good movemask + { + const float localEpsilon = GU_CULLING_EPSILON_RAY_TRIANGLE; + const __m128 localEpsilonV = _mm_load1_ps(&localEpsilon); + __m128 res = (_mm_cmpgt_ps(localEpsilonV, detV)); + const __m128 geomEpsilonV = _mm_load1_ps(¶ms->mGeomEpsilon); + // PT: strange. PhysX version not the same as usual. One more mul needed here :( + const __m128 enlargeCoeffV = _mm_mul_ps(detV, geomEpsilonV); +// res = _mm_or_ps(res, _mm_min_ps(dV, _mm_min_ps(_mm_add_ps(uV, geomEpsilonV), _mm_add_ps(vV, geomEpsilonV)))); +// res = _mm_or_ps(res, _mm_cmpgt_ps(_mm_max_ps(uV, _mm_add_ps(uV, vV)), _mm_add_ps(detV, geomEpsilonV))); + res = _mm_or_ps(res, _mm_min_ps(dV, _mm_min_ps(_mm_add_ps(uV, enlargeCoeffV), _mm_add_ps(vV, enlargeCoeffV)))); + res = _mm_or_ps(res, _mm_cmpgt_ps(_mm_max_ps(uV, _mm_add_ps(uV, vV)), _mm_add_ps(detV, enlargeCoeffV))); + const int cndt = _mm_movemask_ps(res); + if(cndt) + return 0; + } + + const float one = 1.0f; + const __m128 oneV = _mm_load1_ps(&one); + const __m128 OneOverDetV = _mm_div_ps(oneV, detV); + _mm_store_ss(&mStabbedFace.distance, _mm_mul_ps(dV, OneOverDetV)); + _mm_store_ss(&mStabbedFace.u, _mm_mul_ps(uV, OneOverDetV)); + _mm_store_ss(&mStabbedFace.v, _mm_mul_ps(vV, OneOverDetV)); + return 1; + } + else + { + const __m128 tvecV = V4Sub(V4LoadU(¶ms->mOrigin_Padded.x), vert0V); // const Point tvec = params->mOrigin - vert0; + const __m128 qvecV = V4Cross(tvecV, edge1V); // const Point qvec = tvec^edge1; + + const float localEpsilon = GU_CULLING_EPSILON_RAY_TRIANGLE; + const __m128 localEpsilonV = _mm_load1_ps(&localEpsilon); + const __m128 absDet = _mm_max_ps(detV, V4Sub(_mm_setzero_ps(), detV)); + const int cndt = _mm_movemask_ps(_mm_cmpgt_ps(localEpsilonV, absDet)); + + const float one = 1.0f; + const __m128 oneV = _mm_load1_ps(&one); + const __m128 OneOverDetV = _mm_div_ps(oneV, detV); + + const __m128 uV = _mm_mul_ps(DotV(tvecV, pvecV), OneOverDetV); + const __m128 vV = _mm_mul_ps(DotV(localDirV, qvecV), OneOverDetV); + const __m128 dV = _mm_mul_ps(DotV(edge2V, qvecV), OneOverDetV); + + const __m128 geomEpsilonV = _mm_load1_ps(¶ms->mGeomEpsilon); + + const int cndt2 = _mm_movemask_ps(_mm_min_ps(dV, _mm_min_ps(_mm_add_ps(uV, geomEpsilonV), _mm_add_ps(vV, geomEpsilonV)))); + + const int cndt3 = _mm_movemask_ps(_mm_cmpgt_ps(_mm_max_ps(uV, _mm_add_ps(uV, vV)), _mm_add_ps(oneV, geomEpsilonV))); + + if(cndt|cndt3|cndt2) + return 0; + + _mm_store_ss(&mStabbedFace.distance, dV); + _mm_store_ss(&mStabbedFace.u, uV); + _mm_store_ss(&mStabbedFace.v, vV); + return 1; + } + } + else +#endif + { + + // Find vectors for two edges sharing vert0 + const PxVec3 edge1 = vert1 - vert0; + const PxVec3 edge2 = vert2 - vert0; + + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = params->mLocalDir_Padded.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const float det = edge1.dot(pvec); + + if(params->mBackfaceCulling) + { + if(detmOrigin_Padded - vert0; + + // Calculate U parameter and test bounds + const float u = tvec.dot(pvec); + + const PxReal enlargeCoeff = params->mGeomEpsilon*det; + const PxReal uvlimit = -enlargeCoeff; + const PxReal uvlimit2 = det + enlargeCoeff; + + if(u < uvlimit || u > uvlimit2) + return 0; + + // Prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + const float v = params->mLocalDir_Padded.dot(qvec); + if(v < uvlimit || (u + v) > uvlimit2) + return 0; + + // Calculate t, scale parameters, ray intersects triangle + const float d = edge2.dot(qvec); + // Det > 0 so we can early exit here + // Intersection point is valid if distance is positive (else it can just be a face behind the orig point) + if(d<0.0f) + return 0; + + // Else go on + const float OneOverDet = 1.0f / det; + mStabbedFace.distance = d * OneOverDet; + mStabbedFace.u = u * OneOverDet; + mStabbedFace.v = v * OneOverDet; + } + else + { + if(PxAbs(det)mOrigin_Padded - vert0; + + const float u = tvec.dot(pvec) * OneOverDet; + if(u<-params->mGeomEpsilon || u>1.0f+params->mGeomEpsilon) + return 0; + + // prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + const float v = params->mLocalDir_Padded.dot(qvec) * OneOverDet; + if(v < -params->mGeomEpsilon || (u + v) > 1.0f + params->mGeomEpsilon) + return 0; + + // Calculate t, ray intersects triangle + const float d = edge2.dot(qvec) * OneOverDet; + // Intersection point is valid if distance is positive (else it can just be a face behind the orig point) + if(d<0.0f) + return 0; + mStabbedFace.distance = d; + mStabbedFace.u = u; + mStabbedFace.v = v; + } + return 1; + } +} + +#if PX_VC +#pragma warning ( disable : 4324 ) +#endif + +struct RayParams +{ + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); +// Organized in the order they are accessed +#ifndef GU_BV4_USE_SLABS + BV4_ALIGN16(PxVec3p mData2_PaddedAligned); + BV4_ALIGN16(PxVec3p mFDir_PaddedAligned); + BV4_ALIGN16(PxVec3p mData_PaddedAligned); +#endif + const IndTri32* PX_RESTRICT mTris32; + const IndTri16* PX_RESTRICT mTris16; + const PxVec3* PX_RESTRICT mVerts; + PxVec3 mLocalDir_Padded; + PxVec3 mOrigin_Padded; + + float mGeomEpsilon; + PxU32 mBackfaceCulling; + + RaycastHitInternalUV mStabbedFace; + PxU32 mEarlyExit; + + PxVec3 mOriginalExtents_Padded; // Added to please the slabs code + + BV4_ALIGN16(PxVec3p mP0_PaddedAligned); + BV4_ALIGN16(PxVec3p mP1_PaddedAligned); + BV4_ALIGN16(PxVec3p mP2_PaddedAligned); +}; + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE void updateParamsAfterImpact(RayParams* PX_RESTRICT params, PxU32 primIndex, PxU32 VRef0, PxU32 VRef1, PxU32 VRef2, const PxGeomRaycastHit& StabbedFace) +{ + V4StoreA_Safe(V4LoadU_Safe(¶ms->mVerts[VRef0].x), ¶ms->mP0_PaddedAligned.x); + V4StoreA_Safe(V4LoadU_Safe(¶ms->mVerts[VRef1].x), ¶ms->mP1_PaddedAligned.x); + V4StoreA_Safe(V4LoadU_Safe(¶ms->mVerts[VRef2].x), ¶ms->mP2_PaddedAligned.x); + + params->mStabbedFace.mTriangleID = primIndex; + params->mStabbedFace.mDistance = StabbedFace.distance; + params->mStabbedFace.mU = StabbedFace.u; + params->mStabbedFace.mV = StabbedFace.v; +} + +namespace +{ +class LeafFunction_RaycastClosest +{ +public: + static /*PX_FORCE_INLINE*/ PxIntBool doLeafTest(RayParams* PX_RESTRICT params, PxU32 primIndex) + { + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& StabbedFace = reinterpret_cast(buffer); + + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + if(RayTriOverlapT(StabbedFace, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params)) + { + if(StabbedFace.distancemStabbedFace.mDistance) //### just for a corner case UT in PhysX :( + { + updateParamsAfterImpact(params, primIndex, VRef0, VRef1, VRef2, StabbedFace); + +#ifndef GU_BV4_USE_SLABS + setupRayData(params, StabbedFace.distance, params->mOrigin_Padded, params->mLocalDir_Padded); +#endif + } + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +class LeafFunction_RaycastAny +{ +public: + static /*PX_FORCE_INLINE*/ PxIntBool doLeafTest(RayParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& StabbedFace = reinterpret_cast(buffer); + if(RayTriOverlapT(StabbedFace, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params)) + { + if(StabbedFace.distancemStabbedFace.mDistance) //### just for a corner case UT in PhysX :( + { + updateParamsAfterImpact(params, primIndex, VRef0, VRef1, VRef2, StabbedFace); + return 1; + } + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +static PX_FORCE_INLINE Vec4V multiply3x3V_Aligned(const Vec4V p, const PxMat44* PX_RESTRICT mat) +{ + const FloatV xxxV = V4GetX(p); + const FloatV yyyV = V4GetY(p); + const FloatV zzzV = V4GetZ(p); + + Vec4V ResV = V4Scale(V4LoadA(&mat->column0.x), xxxV); + ResV = V4Add(ResV, V4Scale(V4LoadA(&mat->column1.x), yyyV)); + ResV = V4Add(ResV, V4Scale(V4LoadA(&mat->column2.x), zzzV)); + return ResV; +} + +static PX_FORCE_INLINE PxIntBool computeImpactData(PxGeomRaycastHit* PX_RESTRICT hit, const RayParams* PX_RESTRICT params, const PxMat44* PX_RESTRICT worldm_Aligned, PxHitFlags /*hitFlags*/) +{ + if(params->mStabbedFace.mTriangleID!=PX_INVALID_U32 /*&& !params->mEarlyExit*/) //### PhysX needs the raycast data even for "any hit" :( + { + const float u = params->mStabbedFace.mU; + const float v = params->mStabbedFace.mV; + const float d = params->mStabbedFace.mDistance; + const PxU32 id = params->mStabbedFace.mTriangleID; + hit->u = u; + hit->v = v; + hit->distance = d; + hit->faceIndex = id; + + { + const Vec4V P0V = V4LoadA_Safe(¶ms->mP0_PaddedAligned.x); + const Vec4V P1V = V4LoadA_Safe(¶ms->mP1_PaddedAligned.x); + const Vec4V P2V = V4LoadA_Safe(¶ms->mP2_PaddedAligned.x); + + const FloatV uV = FLoad(params->mStabbedFace.mU); + const FloatV vV = FLoad(params->mStabbedFace.mV); + const float w = 1.0f - params->mStabbedFace.mU - params->mStabbedFace.mV; + const FloatV wV = FLoad(w); + //pt = (1.0f - u - v)*p0 + u*p1 + v*p2; + Vec4V LocalPtV = V4Scale(P1V, uV); + LocalPtV = V4Add(LocalPtV, V4Scale(P2V, vV)); + LocalPtV = V4Add(LocalPtV, V4Scale(P0V, wV)); + + const Vec4V LocalNormalV = V4Cross(V4Sub(P0V, P1V), V4Sub(P0V, P2V)); + + BV4_ALIGN16(PxVec3p tmp_PaddedAligned); + if(worldm_Aligned) + { + const Vec4V TransV = V4LoadA(&worldm_Aligned->column3.x); + V4StoreU_Safe(V4Add(multiply3x3V_Aligned(LocalPtV, worldm_Aligned), TransV), &hit->position.x); + V4StoreA_Safe(multiply3x3V_Aligned(LocalNormalV, worldm_Aligned), &tmp_PaddedAligned.x); + } + else + { + V4StoreU_Safe(LocalPtV, &hit->position.x); + V4StoreA_Safe(LocalNormalV, &tmp_PaddedAligned.x); + } + tmp_PaddedAligned.normalize(); + hit->normal = tmp_PaddedAligned; // PT: TODO: check asm here (TA34704) + } + } + return params->mStabbedFace.mTriangleID!=PX_INVALID_U32; +} + +static PX_FORCE_INLINE float clipRay(const PxVec3& ray_orig, const PxVec3& ray_dir, const LocalBounds& local_bounds) +{ + const float dpc = local_bounds.mCenter.dot(ray_dir); + const float dpMin = dpc - local_bounds.mExtentsMagnitude; + const float dpMax = dpc + local_bounds.mExtentsMagnitude; + const float dpO = ray_orig.dot(ray_dir); + const float boxLength = local_bounds.mExtentsMagnitude * 2.0f; + const float distToBox = PxMin(fabsf(dpMin - dpO), fabsf(dpMax - dpO)); + return distToBox + boxLength * 2.0f; +} + +template +static PX_FORCE_INLINE void setupRayParams(ParamsT* PX_RESTRICT params, const PxVec3& origin, const PxVec3& dir, const BV4Tree* PX_RESTRICT tree, const PxMat44* PX_RESTRICT world, const SourceMesh* PX_RESTRICT mesh, float maxDist, float geomEpsilon, PxU32 flags) +{ + params->mGeomEpsilon = geomEpsilon; + setupParamsFlags(params, flags); + + computeLocalRay(params->mLocalDir_Padded, params->mOrigin_Padded, dir, origin, world); + + // PT: TODO: clipRay may not be needed with GU_BV4_USE_SLABS (TA34704) + const float MaxDist = clipRay(params->mOrigin_Padded, params->mLocalDir_Padded, tree->mLocalBounds); + maxDist = PxMin(maxDist, MaxDist); + params->mStabbedFace.mDistance = maxDist; + params->mStabbedFace.mTriangleID = PX_INVALID_U32; + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + +#ifndef GU_BV4_USE_SLABS + setupRayData(params, maxDist, params->mOrigin_Padded, params->mLocalDir_Padded); +#endif +} + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamOrdered_SegmentAABB.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_KajiyaNoOrder.h" + #include "GuBV4_Slabs_KajiyaOrdered.h" +#endif + +#define GU_BV4_PROCESS_STREAM_RAY_NO_ORDER +#define GU_BV4_PROCESS_STREAM_RAY_ORDERED +#include "GuBV4_Internal.h" + +#ifndef GU_BV4_USE_SLABS +#ifdef GU_BV4_QUANTIZED_TREE + +// A.B. enable new version only for intel non simd path +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) +// #define NEW_VERSION +#endif // PX_INTEL_FAMILY && !PX_SIMD_DISABLED + +static PX_FORCE_INLINE /*PX_NOINLINE*/ PxIntBool BV4_SegmentAABBOverlap(const BVDataPacked* PX_RESTRICT node, const RayParams* PX_RESTRICT params) +{ +#ifdef NEW_VERSION + SSE_CONST4(maskV, 0x7fffffff); + SSE_CONST4(maskQV, 0x0000ffff); +#endif + +#ifdef NEW_VERSION + Vec4V centerV = V4LoadA((float*)node->mAABB.mData); + __m128 extentsV = _mm_castsi128_ps(_mm_and_si128(_mm_castps_si128(centerV), SSE_CONST(maskQV))); + extentsV = V4Mul(_mm_cvtepi32_ps(_mm_castps_si128(extentsV)), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + centerV = _mm_castsi128_ps(_mm_srai_epi32(_mm_castps_si128(centerV), 16)); + centerV = V4Mul(_mm_cvtepi32_ps(_mm_castps_si128(centerV)), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); +#else + const VecI32V centerVI = I4LoadA((PxI32*)node->mAABB.mData); + const VecI32V extentsVI = VecI32V_And(centerVI, I4Load(0x0000ffff)); + const Vec4V extentsV = V4Mul(Vec4V_From_VecI32V(extentsVI), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + const VecI32V centerVShift = VecI32V_RightShift(centerVI, 16); + const Vec4V centerV = V4Mul(Vec4V_From_VecI32V(centerVShift), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); +#endif + + const Vec4V fdirV = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V DV = V4Sub(V4LoadA_Safe(¶ms->mData2_PaddedAligned.x), centerV); + +#ifdef NEW_VERSION + __m128 absDV = _mm_and_ps(DV, SSE_CONSTF(maskV)); +#else + Vec4V absDV = V4Abs(DV); +#endif + + const BoolV resDV = V4IsGrtr(absDV, V4Add(extentsV, fdirV)); + const PxU32 test = BGetBitMask(resDV); + if(test&7) + return 0; + + if(1) + { + const Vec4V dataZYX_V = V4LoadA_Safe(¶ms->mData_PaddedAligned.x); + const Vec4V dataXZY_V = V4Perm<1, 2, 0, 3>(dataZYX_V); + const Vec4V DXZY_V = V4Perm<1, 2, 0, 3>(DV); + + const Vec4V fV = V4Sub(V4Mul(dataZYX_V, DXZY_V), V4Mul(dataXZY_V, DV)); + + const Vec4V fdirZYX_V = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V fdirXZY_V = V4Perm<1, 2, 0, 3>(fdirZYX_V); + const Vec4V extentsXZY_V = V4Perm<1, 2, 0, 3>(extentsV); + + // PT: TODO: use V4MulAdd here (TA34704) + const Vec4V fg = V4Add(V4Mul(extentsV, fdirXZY_V), V4Mul(extentsXZY_V, fdirZYX_V)); + +#ifdef NEW_VERSION + __m128 absfV = _mm_and_ps(fV, SSE_CONSTF(maskV)); +#else + Vec4V absfV = V4Abs(fV); +#endif + const BoolV resfV = V4IsGrtr(absfV, fg); + const PxU32 test2 = BGetBitMask(resfV); + if(test2&7) + return 0; + return 1; + } +} +#else +static PX_FORCE_INLINE /*PX_NOINLINE*/ PxIntBool BV4_SegmentAABBOverlap(const PxVec3& center, const PxVec3& extents, const RayParams* PX_RESTRICT params) +{ + const PxU32 maskI = 0x7fffffff; + + const Vec4V fdirV = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const Vec4V extentsV = V4LoadU(&extents.x); + + const Vec4V DV = V4Sub(V4LoadA_Safe(¶ms->mData2_PaddedAligned.x), V4LoadU(¢er.x)); //###center should be aligned + + __m128 absDV = _mm_and_ps(DV, _mm_load1_ps((float*)&maskI)); + + absDV = _mm_cmpgt_ps(absDV, V4Add(extentsV, fdirV)); + const PxU32 test = (PxU32)_mm_movemask_ps(absDV); + if(test&7) + return 0; + + if(1) + { + const Vec4V dataZYX_V = V4LoadA_Safe(¶ms->mData_PaddedAligned.x); + const __m128 dataXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(dataZYX_V), _MM_SHUFFLE(3,0,2,1))); + const __m128 DXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(DV), _MM_SHUFFLE(3,0,2,1))); + const Vec4V fV = V4Sub(V4Mul(dataZYX_V, DXZY_V), V4Mul(dataXZY_V, DV)); + + const Vec4V fdirZYX_V = V4LoadA_Safe(¶ms->mFDir_PaddedAligned.x); + const __m128 fdirXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(fdirZYX_V), _MM_SHUFFLE(3,0,2,1))); + const __m128 extentsXZY_V = _mm_castsi128_ps(_mm_shuffle_epi32(_mm_castps_si128(extentsV), _MM_SHUFFLE(3,0,2,1))); + // PT: TODO: use V4MulAdd here (TA34704) + const Vec4V fg = V4Add(V4Mul(extentsV, fdirXZY_V), V4Mul(extentsXZY_V, fdirZYX_V)); + + __m128 absfV = _mm_and_ps(fV, _mm_load1_ps((float*)&maskI)); + absfV = _mm_cmpgt_ps(absfV, fg); + const PxU32 test2 = (PxU32)_mm_movemask_ps(absfV); + if(test2&7) + return 0; + return 1; + } +} +#endif +#endif + +PxIntBool BV4_RaycastSingle(const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxGeomRaycastHit* PX_RESTRICT hit, float maxDist, float geomEpsilon, PxU32 flags, PxHitFlags hitFlags) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + RayParams Params; + setupRayParams(&Params, origin, dir, &tree, worldm_Aligned, mesh, maxDist, geomEpsilon, flags); + + if(tree.mNodes) + { + if(Params.mEarlyExit) + processStreamRayNoOrder<0, LeafFunction_RaycastAny>(tree, &Params); + else + processStreamRayOrdered<0, LeafFunction_RaycastClosest>(tree, &Params); + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); + + return computeImpactData(hit, &Params, worldm_Aligned, hitFlags); +} + + + +// Callback-based version + +namespace +{ +struct RayParamsCB : RayParams +{ + MeshRayCallback mCallback; + void* mUserData; +}; + +class LeafFunction_RaycastCB +{ +public: + static PxIntBool doLeafTest(RayParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& StabbedFace = reinterpret_cast(buffer); + if(RayTriOverlapT(StabbedFace, p0, p1, p2, params)) + { + if(StabbedFace.distancemStabbedFace.mDistance) + { + HitCode Code = (params->mCallback)(params->mUserData, p0, p1, p2, primIndex, StabbedFace.distance, StabbedFace.u, StabbedFace.v); + if(Code==HIT_EXIT) + return 1; + } + + // PT: TODO: no shrinking here? (TA34704) + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +} + +#include "GuBV4_ProcessStreamNoOrder_SegmentAABB.h" + +void BV4_RaycastCB(const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, float maxDist, float geomEpsilon, PxU32 flags, MeshRayCallback callback, void* userData) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + //### beware, some parameters in the struct aren't used + RayParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupRayParams(&Params, origin, dir, &tree, worldm_Aligned, mesh, maxDist, geomEpsilon, flags); + + if(tree.mNodes) + processStreamRayNoOrder<0, LeafFunction_RaycastCB>(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); +// if(Params.mEarlyExit) +// LeafFunction_BoxSweepAnyCB::doLeafTest(&Params, nbTris); +// else + LeafFunction_RaycastCB::doLeafTest(&Params, nbTris); + } +} + +// Raycast all + +namespace +{ +struct RayParamsAll : RayParams +{ + PX_FORCE_INLINE RayParamsAll(PxGeomRaycastHit* hits, PxU32 maxNbHits, PxU32 stride, const PxMat44* mat, PxHitFlags hitFlags) : + mHits (reinterpret_cast(hits)), + mNbHits (0), + mMaxNbHits (maxNbHits), + mStride (stride), + mWorld_Aligned (mat), + mHitFlags (hitFlags) + { + } + + PxU8* mHits; + PxU32 mNbHits; + const PxU32 mMaxNbHits; + const PxU32 mStride; + const PxMat44* mWorld_Aligned; + const PxHitFlags mHitFlags; + + PX_NOCOPY(RayParamsAll) +}; + +class LeafFunction_RaycastAll +{ +public: + static /*PX_FORCE_INLINE*/ PxIntBool doLeafTest(RayParams* PX_RESTRICT p, PxU32 primIndex) + { + RayParamsAll* params = static_cast(p); + + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + PxGeomRaycastHit& StabbedFace = *reinterpret_cast(params->mHits); + if(RayTriOverlapT(StabbedFace, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], params)) + { + if(StabbedFace.distancemStabbedFace.mDistance) + { + updateParamsAfterImpact(params, primIndex, VRef0, VRef1, VRef2, StabbedFace); + + computeImpactData(&StabbedFace, params, params->mWorld_Aligned, params->mHitFlags); + + params->mNbHits++; + params->mHits += params->mStride; + if(params->mNbHits==params->mMaxNbHits) + return 1; + } + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: this function is not used yet, but eventually it should be +PxU32 BV4_RaycastAll(const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 maxNbHits, PxU32 stride, float maxDist, float geomEpsilon, PxU32 flags, PxHitFlags hitFlags) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + RayParamsAll Params(hits, maxNbHits, stride, worldm_Aligned, hitFlags); + setupRayParams(&Params, origin, dir, &tree, worldm_Aligned, mesh, maxDist, geomEpsilon, flags); + + if(tree.mNodes) + processStreamRayNoOrder<0, LeafFunction_RaycastAll>(tree, &Params); + else + { + PX_ASSERT(0); + } + return Params.mNbHits; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs.h new file mode 100644 index 0000000..bb5725f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs.h @@ -0,0 +1,176 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SLABS_H +#define GU_BV4_SLABS_H + +#include "foundation/PxFPU.h" +#include "GuBV4_Common.h" + +#ifdef GU_BV4_USE_SLABS + + // PT: contains code for tree-traversal using the swizzled format. + // PT: ray traversal based on Kay & Kajiya's slab intersection code, but using SIMD to do 4 ray-vs-AABB tests at a time. + // PT: other (ordered or unordered) traversals just process one node at a time, similar to the non-swizzled format. + + #define BV4_SLABS_FIX + #define BV4_SLABS_SORT + + #define PNS_BLOCK3(a, b, c, d) { \ + if(code2 & (1<getChildData(a); } \ + if(code2 & (1<getChildData(b); } \ + if(code2 & (1<getChildData(c); } \ + if(code2 & (1<getChildData(d); } } \ + + #define OPC_SLABS_GET_MIN_MAX(i) \ + const VecI32V minVi = I4LoadXYZW(node->mX[i].mMin, node->mY[i].mMin, node->mZ[i].mMin, 0); \ + const Vec4V minCoeffV = V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x); \ + Vec4V minV = V4Mul(Vec4V_From_VecI32V(minVi), minCoeffV); \ + const VecI32V maxVi = I4LoadXYZW(node->mX[i].mMax, node->mY[i].mMax, node->mZ[i].mMax, 0); \ + const Vec4V maxCoeffV = V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); \ + Vec4V maxV = V4Mul(Vec4V_From_VecI32V(maxVi), maxCoeffV); \ + + #define OPC_SLABS_GET_CEQ(i) \ + OPC_SLABS_GET_MIN_MAX(i) \ + const FloatV HalfV = FLoad(0.5f); \ + const Vec4V centerV = V4Scale(V4Add(maxV, minV), HalfV); \ + const Vec4V extentsV = V4Scale(V4Sub(maxV, minV), HalfV); + + #define OPC_SLABS_GET_CE2Q(i) \ + OPC_SLABS_GET_MIN_MAX(i) \ + const Vec4V centerV = V4Add(maxV, minV); \ + const Vec4V extentsV = V4Sub(maxV, minV); + + #define OPC_SLABS_GET_CENQ(i) \ + const FloatV HalfV = FLoad(0.5f); \ + const Vec4V minV = V4LoadXYZW(node->mMinX[i], node->mMinY[i], node->mMinZ[i], 0.0f); \ + const Vec4V maxV = V4LoadXYZW(node->mMaxX[i], node->mMaxY[i], node->mMaxZ[i], 0.0f); \ + const Vec4V centerV = V4Scale(V4Add(maxV, minV), HalfV); \ + const Vec4V extentsV = V4Scale(V4Sub(maxV, minV), HalfV); + + #define OPC_SLABS_GET_CE2NQ(i) \ + const Vec4V minV = V4LoadXYZW(node->mMinX[i], node->mMinY[i], node->mMinZ[i], 0.0f); \ + const Vec4V maxV = V4LoadXYZW(node->mMaxX[i], node->mMaxY[i], node->mMaxZ[i], 0.0f); \ + const Vec4V centerV = V4Add(maxV, minV); \ + const Vec4V extentsV = V4Sub(maxV, minV); + +#define OPC_DEQ4(part2xV, part1xV, mMember, minCoeff, maxCoeff) \ +{ \ + part2xV = V4LoadA(reinterpret_cast(tn->mMember)); \ + part1xV = Vec4V_ReinterpretFrom_VecI32V(VecI32V_And(VecI32V_ReinterpretFrom_Vec4V(part2xV), I4Load(0x0000ffff))); \ + part1xV = Vec4V_ReinterpretFrom_VecI32V(VecI32V_RightShift(VecI32V_LeftShift(VecI32V_ReinterpretFrom_Vec4V(part1xV),16), 16)); \ + part1xV = V4Mul(Vec4V_From_VecI32V(VecI32V_ReinterpretFrom_Vec4V(part1xV)), minCoeff); \ + part2xV = Vec4V_ReinterpretFrom_VecI32V(VecI32V_RightShift(VecI32V_ReinterpretFrom_Vec4V(part2xV), 16)); \ + part2xV = V4Mul(Vec4V_From_VecI32V(VecI32V_ReinterpretFrom_Vec4V(part2xV)), maxCoeff); \ +} + +#define SLABS_INIT\ + Vec4V maxT4 = V4Load(params->mStabbedFace.mDistance);\ + const Vec4V rayP = V4LoadU_Safe(¶ms->mOrigin_Padded.x);\ + Vec4V rayD = V4LoadU_Safe(¶ms->mLocalDir_Padded.x);\ + const VecU32V raySign = V4U32and(VecU32V_ReinterpretFrom_Vec4V(rayD), signMask);\ + const Vec4V rayDAbs = V4Abs(rayD);\ + Vec4V rayInvD = Vec4V_ReinterpretFrom_VecU32V(V4U32or(raySign, VecU32V_ReinterpretFrom_Vec4V(V4Max(rayDAbs, epsFloat4))));\ + rayD = rayInvD;\ + rayInvD = V4RecipFast(rayInvD);\ + rayInvD = V4Mul(rayInvD, V4NegMulSub(rayD, rayInvD, twos));\ + const Vec4V rayPinvD = V4NegMulSub(rayInvD, rayP, zeroes);\ + const Vec4V rayInvDsplatX = V4SplatElement<0>(rayInvD);\ + const Vec4V rayInvDsplatY = V4SplatElement<1>(rayInvD);\ + const Vec4V rayInvDsplatZ = V4SplatElement<2>(rayInvD);\ + const Vec4V rayPinvDsplatX = V4SplatElement<0>(rayPinvD);\ + const Vec4V rayPinvDsplatY = V4SplatElement<1>(rayPinvD);\ + const Vec4V rayPinvDsplatZ = V4SplatElement<2>(rayPinvD); + +#define SLABS_TEST\ + const Vec4V tminxa0 = V4MulAdd(minx4a, rayInvDsplatX, rayPinvDsplatX);\ + const Vec4V tminya0 = V4MulAdd(miny4a, rayInvDsplatY, rayPinvDsplatY);\ + const Vec4V tminza0 = V4MulAdd(minz4a, rayInvDsplatZ, rayPinvDsplatZ);\ + const Vec4V tmaxxa0 = V4MulAdd(maxx4a, rayInvDsplatX, rayPinvDsplatX);\ + const Vec4V tmaxya0 = V4MulAdd(maxy4a, rayInvDsplatY, rayPinvDsplatY);\ + const Vec4V tmaxza0 = V4MulAdd(maxz4a, rayInvDsplatZ, rayPinvDsplatZ);\ + const Vec4V tminxa = V4Min(tminxa0, tmaxxa0);\ + const Vec4V tmaxxa = V4Max(tminxa0, tmaxxa0);\ + const Vec4V tminya = V4Min(tminya0, tmaxya0);\ + const Vec4V tmaxya = V4Max(tminya0, tmaxya0);\ + const Vec4V tminza = V4Min(tminza0, tmaxza0);\ + const Vec4V tmaxza = V4Max(tminza0, tmaxza0);\ + const Vec4V maxOfNeasa = V4Max(V4Max(tminxa, tminya), tminza);\ + const Vec4V minOfFarsa = V4Min(V4Min(tmaxxa, tmaxya), tmaxza);\ + + #define SLABS_TEST2\ + BoolV ignore4a = V4IsGrtr(epsFloat4, minOfFarsa); /* if tfar is negative, ignore since its a ray, not a line */\ + ignore4a = BOr(ignore4a, V4IsGrtr(maxOfNeasa, maxT4)); /* if tnear is over maxT, ignore this result */\ + BoolV resa4 = V4IsGrtr(maxOfNeasa, minOfFarsa); /* if 1 => fail */\ + resa4 = BOr(resa4, ignore4a);\ + const PxU32 code = BGetBitMask(resa4);\ + if(code==15)\ + continue; + +#define SLABS_PNS \ + if(code2) \ + { \ + if(tn->decodePNSNoShift(0) & dirMask) \ + { \ + if(tn->decodePNSNoShift(1) & dirMask) \ + { \ + if(tn->decodePNSNoShift(2) & dirMask) \ + PNS_BLOCK3(3,2,1,0) \ + else \ + PNS_BLOCK3(2,3,1,0) \ + } \ + else \ + { \ + if(tn->decodePNSNoShift(2) & dirMask) \ + PNS_BLOCK3(3,2,0,1) \ + else \ + PNS_BLOCK3(2,3,0,1) \ + } \ + } \ + else \ + { \ + if(tn->decodePNSNoShift(1) & dirMask) \ + { \ + if(tn->decodePNSNoShift(2) & dirMask) \ + PNS_BLOCK3(1,0,3,2) \ + else \ + PNS_BLOCK3(1,0,2,3) \ + } \ + else \ + { \ + if(tn->decodePNSNoShift(2) & dirMask) \ + PNS_BLOCK3(0,1,3,2) \ + else \ + PNS_BLOCK3(0,1,2,3) \ + } \ + } \ + } + +#endif // GU_BV4_USE_SLABS + +#endif // GU_BV4_SLABS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaNoOrder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaNoOrder.h new file mode 100644 index 0000000..4ab1894 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaNoOrder.h @@ -0,0 +1,305 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SLABS_KAJIYA_NO_ORDER_H +#define GU_BV4_SLABS_KAJIYA_NO_ORDER_H + +#include "GuBVConstants.h" + +#ifdef REMOVED + // Kajiya, no sort + template + static PxIntBool BV4_ProcessStreamKajiyaNoOrder(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + /// + + Vec4V fattenAABBsX, fattenAABBsY, fattenAABBsZ; + if(inflateT) + { + Vec4V fattenAABBs4 = V4LoadU_Safe(¶ms->mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + +#ifdef GU_BV4_QUANTIZED_TREE + const Vec4V minCoeffV = V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x); + const Vec4V maxCoeffV = V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + const Vec4V minCoeffxV = V4SplatElement<0>(minCoeffV); + const Vec4V minCoeffyV = V4SplatElement<1>(minCoeffV); + const Vec4V minCoeffzV = V4SplatElement<2>(minCoeffV); + const Vec4V maxCoeffxV = V4SplatElement<0>(maxCoeffV); + const Vec4V maxCoeffyV = V4SplatElement<1>(maxCoeffV); + const Vec4V maxCoeffzV = V4SplatElement<2>(maxCoeffV); +#endif + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzled* tn = reinterpret_cast(node); + +#ifdef GU_BV4_QUANTIZED_TREE + Vec4V minx4a; + Vec4V maxx4a; + OPC_DEQ4(maxx4a, minx4a, mX, minCoeffxV, maxCoeffxV) + + Vec4V miny4a; + Vec4V maxy4a; + OPC_DEQ4(maxy4a, miny4a, mY, minCoeffyV, maxCoeffyV) + + Vec4V minz4a; + Vec4V maxz4a; + OPC_DEQ4(maxz4a, minz4a, mZ, minCoeffzV, maxCoeffzV) +#else + Vec4V minx4a = V4LoadA(tn->mMinX); + Vec4V miny4a = V4LoadA(tn->mMinY); + Vec4V minz4a = V4LoadA(tn->mMinZ); + + Vec4V maxx4a = V4LoadA(tn->mMaxX); + Vec4V maxy4a = V4LoadA(tn->mMaxY); + Vec4V maxz4a = V4LoadA(tn->mMaxZ); +#endif + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + + SLABS_TEST2 + +#define DO_LEAF_TEST(x) \ + {if(tn->isLeaf(x)) \ + { \ + if(LeafTestT::doLeafTest(params, tn->getPrimitive(x))) \ + return 1; \ + } \ + else \ + stack[nb++] = tn->getChildData(x);} + + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + }while(nb); + + return 0; + } +#undef DO_LEAF_TEST +#endif + + +#define DO_LEAF_TEST(x) \ + {if(tn->isLeaf(x)) \ + { \ + if(LeafTestT::doLeafTest(params, tn->getPrimitive(x))) \ + return 1; \ + } \ + else \ + stack[nb++] = tn->getChildData(x);} + + + // Kajiya, no sort + template + static PxIntBool BV4_ProcessStreamKajiyaNoOrderQ(const BVDataPackedQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + /// + + Vec4V fattenAABBsX, fattenAABBsY, fattenAABBsZ; + if(inflateT) + { + Vec4V fattenAABBs4 = V4LoadU_Safe(¶ms->mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + + const Vec4V minCoeffV = V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x); + const Vec4V maxCoeffV = V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + const Vec4V minCoeffxV = V4SplatElement<0>(minCoeffV); + const Vec4V minCoeffyV = V4SplatElement<1>(minCoeffV); + const Vec4V minCoeffzV = V4SplatElement<2>(minCoeffV); + const Vec4V maxCoeffxV = V4SplatElement<0>(maxCoeffV); + const Vec4V maxCoeffyV = V4SplatElement<1>(maxCoeffV); + const Vec4V maxCoeffzV = V4SplatElement<2>(maxCoeffV); + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledQ* tn = reinterpret_cast(node); + + Vec4V minx4a; + Vec4V maxx4a; + OPC_DEQ4(maxx4a, minx4a, mX, minCoeffxV, maxCoeffxV) + + Vec4V miny4a; + Vec4V maxy4a; + OPC_DEQ4(maxy4a, miny4a, mY, minCoeffyV, maxCoeffyV) + + Vec4V minz4a; + Vec4V maxz4a; + OPC_DEQ4(maxz4a, minz4a, mZ, minCoeffzV, maxCoeffzV) + + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + + SLABS_TEST2 + + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + }while(nb); + + return 0; + } + + + // Kajiya, no sort + template + static PxIntBool BV4_ProcessStreamKajiyaNoOrderNQ(const BVDataPackedNQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedNQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + /// + + Vec4V fattenAABBsX, fattenAABBsY, fattenAABBsZ; + if(inflateT) + { + Vec4V fattenAABBs4 = V4LoadU_Safe(¶ms->mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledNQ* tn = reinterpret_cast(node); + + Vec4V minx4a = V4LoadA(tn->mMinX); + Vec4V miny4a = V4LoadA(tn->mMinY); + Vec4V minz4a = V4LoadA(tn->mMinZ); + + Vec4V maxx4a = V4LoadA(tn->mMaxX); + Vec4V maxy4a = V4LoadA(tn->mMaxY); + Vec4V maxz4a = V4LoadA(tn->mMaxZ); + + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + + SLABS_TEST2 + + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + }while(nb); + + return 0; + } + + +#undef DO_LEAF_TEST + +#endif // GU_BV4_SLABS_KAJIYA_NO_ORDER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaOrdered.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaOrdered.h new file mode 100644 index 0000000..7f4d647 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_KajiyaOrdered.h @@ -0,0 +1,570 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SLABS_KAJIYA_ORDERED_H +#define GU_BV4_SLABS_KAJIYA_ORDERED_H + +#include "GuBVConstants.h" + +#ifdef REMOVED + // Kajiya + PNS + template + static void BV4_ProcessStreamKajiyaOrdered(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + +#ifdef BV4_SLABS_SORT + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + +#ifdef GU_BV4_QUANTIZED_TREE + const Vec4V minCoeffV = V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x); + const Vec4V maxCoeffV = V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + const Vec4V minCoeffxV = V4SplatElement<0>(minCoeffV); + const Vec4V minCoeffyV = V4SplatElement<1>(minCoeffV); + const Vec4V minCoeffzV = V4SplatElement<2>(minCoeffV); + const Vec4V maxCoeffxV = V4SplatElement<0>(maxCoeffV); + const Vec4V maxCoeffyV = V4SplatElement<1>(maxCoeffV); + const Vec4V maxCoeffzV = V4SplatElement<2>(maxCoeffV); +#endif + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzled* tn = reinterpret_cast(node); + +#ifdef GU_BV4_QUANTIZED_TREE + Vec4V minx4a; + Vec4V maxx4a; + OPC_DEQ4(maxx4a, minx4a, mX, minCoeffxV, maxCoeffxV) + + Vec4V miny4a; + Vec4V maxy4a; + OPC_DEQ4(maxy4a, miny4a, mY, minCoeffyV, maxCoeffyV) + + Vec4V minz4a; + Vec4V maxz4a; + OPC_DEQ4(maxz4a, minz4a, mZ, minCoeffzV, maxCoeffzV) +#else + Vec4V minx4a = V4LoadA(tn->mMinX); + Vec4V miny4a = V4LoadA(tn->mMinY); + Vec4V minz4a = V4LoadA(tn->mMinZ); + + Vec4V maxx4a = V4LoadA(tn->mMaxX); + Vec4V maxy4a = V4LoadA(tn->mMaxY); + Vec4V maxz4a = V4LoadA(tn->mMaxZ); +#endif + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + +#ifdef BV4_SLABS_FIX + if(inflateT) + V4StoreA(maxOfNeasa, &distances4[0]); +#endif + + SLABS_TEST2 + +#ifdef BV4_SLABS_SORT + #ifdef BV4_SLABS_FIX + // PT: for some unknown reason the Linux/OSX compilers fail to understand this version +/* #define DO_LEAF_TEST(x) \ + { \ + if(!inflateT) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<mStabbedFace.mDistance) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<mStabbedFace.mDistance + GU_EPSILON_SAME_DISTANCE) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + SLABS_PNS +#else + #define DO_LEAF_TEST(x) \ + {if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + stack[nb++] = tn->getChildData(x); \ + }} + + + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) +#endif + + }while(nb); + } +#undef DO_LEAF_TEST +#endif + + + +#ifdef BV4_SLABS_SORT + #ifdef BV4_SLABS_FIX + // PT: for some unknown reason the Linux/OSX compilers fail to understand this version +/* #define DO_LEAF_TEST(x) \ + { \ + if(!inflateT) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<mStabbedFace.mDistance) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<mStabbedFace.mDistance + GU_EPSILON_SAME_DISTANCE) \ + { \ + if(tn->isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + code2 |= 1<isLeaf(x)) \ + { \ + LeafTestT::doLeafTest(params, tn->getPrimitive(x)); \ + maxT4 = V4Load(params->mStabbedFace.mDistance); \ + } \ + else \ + { \ + stack[nb++] = tn->getChildData(x); \ + }} +#endif + + // Kajiya + PNS + template + static void BV4_ProcessStreamKajiyaOrderedQ(const BVDataPackedQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + +#ifdef BV4_SLABS_SORT + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + + const Vec4V minCoeffV = V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x); + const Vec4V maxCoeffV = V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x); + const Vec4V minCoeffxV = V4SplatElement<0>(minCoeffV); + const Vec4V minCoeffyV = V4SplatElement<1>(minCoeffV); + const Vec4V minCoeffzV = V4SplatElement<2>(minCoeffV); + const Vec4V maxCoeffxV = V4SplatElement<0>(maxCoeffV); + const Vec4V maxCoeffyV = V4SplatElement<1>(maxCoeffV); + const Vec4V maxCoeffzV = V4SplatElement<2>(maxCoeffV); + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledQ* tn = reinterpret_cast(node); + + Vec4V minx4a; + Vec4V maxx4a; + OPC_DEQ4(maxx4a, minx4a, mX, minCoeffxV, maxCoeffxV) + + Vec4V miny4a; + Vec4V maxy4a; + OPC_DEQ4(maxy4a, miny4a, mY, minCoeffyV, maxCoeffyV) + + Vec4V minz4a; + Vec4V maxz4a; + OPC_DEQ4(maxz4a, minz4a, mZ, minCoeffzV, maxCoeffzV) + + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + +#ifdef BV4_SLABS_FIX + if(inflateT) + V4StoreA(maxOfNeasa, &distances4[0]); +#endif + + SLABS_TEST2 + +#ifdef BV4_SLABS_SORT + PxU32 code2 = 0; + PxU32 nbHits = 0; + const PxU32 nodeType = getChildType(childData); + + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + //SLABS_PNS + + if(nbHits==1) + { + PNS_BLOCK3(0,1,2,3) + } + else + { + SLABS_PNS + } +#else + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) +#endif + + }while(nb); + } + + + // Kajiya + PNS + template + static void BV4_ProcessStreamKajiyaOrderedNQ(const BVDataPackedNQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedNQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + +#ifdef BV4_SLABS_SORT + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<mOriginalExtents_Padded.x); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + /// + + SLABS_INIT + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledNQ* tn = reinterpret_cast(node); + + Vec4V minx4a = V4LoadA(tn->mMinX); + Vec4V miny4a = V4LoadA(tn->mMinY); + Vec4V minz4a = V4LoadA(tn->mMinZ); + + Vec4V maxx4a = V4LoadA(tn->mMaxX); + Vec4V maxy4a = V4LoadA(tn->mMaxY); + Vec4V maxz4a = V4LoadA(tn->mMaxZ); + + if(inflateT) + { + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + SLABS_TEST + +#ifdef BV4_SLABS_FIX + if(inflateT) + V4StoreA(maxOfNeasa, &distances4[0]); +#endif + + SLABS_TEST2 + +#ifdef BV4_SLABS_SORT + PxU32 code2 = 0; + PxU32 nbHits = 0; + const PxU32 nodeType = getChildType(childData); + + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) + + //SLABS_PNS + if(nbHits==1) + { + PNS_BLOCK3(0,1,2,3) + } + else + { + SLABS_PNS + } +#else + const PxU32 nodeType = getChildType(childData); + if(!(code&8) && nodeType>1) + DO_LEAF_TEST(3) + + if(!(code&4) && nodeType>0) + DO_LEAF_TEST(2) + + if(!(code&2)) + DO_LEAF_TEST(1) + + if(!(code&1)) + DO_LEAF_TEST(0) +#endif + + }while(nb); + } + +#undef DO_LEAF_TEST + +#endif // GU_BV4_SLABS_KAJIYA_ORDERED_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledNoOrder.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledNoOrder.h new file mode 100644 index 0000000..d4b3a3d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledNoOrder.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SLABS_SWIZZLED_NO_ORDER_H +#define GU_BV4_SLABS_SWIZZLED_NO_ORDER_H + + // Generic, no sort +/* template + static PxIntBool BV4_ProcessStreamSwizzledNoOrder(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzled* tn = reinterpret_cast(node); + + const PxU32 nodeType = getChildType(childData); + + if(nodeType>1 && BV4_ProcessNodeNoOrder_Swizzled(stack, nb, tn, params)) + return 1; + if(nodeType>0 && BV4_ProcessNodeNoOrder_Swizzled(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_Swizzled(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_Swizzled(stack, nb, tn, params)) + return 1; + + }while(nb); + + return 0; + }*/ + + template + static PxIntBool BV4_ProcessStreamSwizzledNoOrderQ(const BVDataPackedQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledQ* tn = reinterpret_cast(node); + + const PxU32 nodeType = getChildType(childData); + + if(nodeType>1 && BV4_ProcessNodeNoOrder_SwizzledQ(stack, nb, tn, params)) + return 1; + if(nodeType>0 && BV4_ProcessNodeNoOrder_SwizzledQ(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_SwizzledQ(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_SwizzledQ(stack, nb, tn, params)) + return 1; + + }while(nb); + + return 0; + } + + template + static PxIntBool BV4_ProcessStreamSwizzledNoOrderNQ(const BVDataPackedNQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedNQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + node = root + getChildOffset(childData); + + const BVDataSwizzledNQ* tn = reinterpret_cast(node); + + const PxU32 nodeType = getChildType(childData); + + if(nodeType>1 && BV4_ProcessNodeNoOrder_SwizzledNQ(stack, nb, tn, params)) + return 1; + if(nodeType>0 && BV4_ProcessNodeNoOrder_SwizzledNQ(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_SwizzledNQ(stack, nb, tn, params)) + return 1; + if(BV4_ProcessNodeNoOrder_SwizzledNQ(stack, nb, tn, params)) + return 1; + + }while(nb); + + return 0; + } + +#endif // GU_BV4_SLABS_SWIZZLED_NO_ORDER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledOrdered.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledOrdered.h new file mode 100644 index 0000000..9d021a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_Slabs_SwizzledOrdered.h @@ -0,0 +1,156 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV4_SLABS_SWIZZLED_ORDERED_H +#define GU_BV4_SLABS_SWIZZLED_ORDERED_H + + // Generic + PNS +/* template + static void BV4_ProcessStreamSwizzledOrdered(const BVDataPacked* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPacked* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<(node); + + PxU32 code2 = 0; + BV4_ProcessNodeOrdered2_Swizzled(code2, tn, params); + BV4_ProcessNodeOrdered2_Swizzled(code2, tn, params); + if(nodeType>0) + BV4_ProcessNodeOrdered2_Swizzled(code2, tn, params); + if(nodeType>1) + BV4_ProcessNodeOrdered2_Swizzled(code2, tn, params); + + SLABS_PNS + + }while(nb); + }*/ + + // Generic + PNS + template + static void BV4_ProcessStreamSwizzledOrderedQ(const BVDataPackedQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<(node); + + PxU32 code2 = 0; + BV4_ProcessNodeOrdered2_SwizzledQ(code2, tn, params); + BV4_ProcessNodeOrdered2_SwizzledQ(code2, tn, params); + if(nodeType>0) + BV4_ProcessNodeOrdered2_SwizzledQ(code2, tn, params); + if(nodeType>1) + BV4_ProcessNodeOrdered2_SwizzledQ(code2, tn, params); + + SLABS_PNS + + }while(nb); + } + + // Generic + PNS + template + static void BV4_ProcessStreamSwizzledOrderedNQ(const BVDataPackedNQ* PX_RESTRICT node, PxU32 initData, ParamsT* PX_RESTRICT params) + { + const BVDataPackedNQ* root = node; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + const PxU32* tmp = reinterpret_cast(¶ms->mLocalDir_Padded); + const PxU32 X = tmp[0]>>31; + const PxU32 Y = tmp[1]>>31; + const PxU32 Z = tmp[2]>>31; +// const PxU32 X = PX_IR(params->mLocalDir_Padded.x)>>31; +// const PxU32 Y = PX_IR(params->mLocalDir_Padded.y)>>31; +// const PxU32 Z = PX_IR(params->mLocalDir_Padded.z)>>31; + const PxU32 bitIndex = 3+(Z|(Y<<1)|(X<<2)); + const PxU32 dirMask = 1u<(node); + + PxU32 code2 = 0; + BV4_ProcessNodeOrdered2_SwizzledNQ(code2, tn, params); + BV4_ProcessNodeOrdered2_SwizzledNQ(code2, tn, params); + if(nodeType>0) + BV4_ProcessNodeOrdered2_SwizzledNQ(code2, tn, params); + if(nodeType>1) + BV4_ProcessNodeOrdered2_SwizzledNQ(code2, tn, params); + + SLABS_PNS + + }while(nb); + } + + +#endif // GU_BV4_SLABS_SWIZZLED_ORDERED_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp new file mode 100644 index 0000000..c75cdb2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereOverlap.cpp @@ -0,0 +1,617 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; + +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#include "GuBV4_Common.h" +#include "GuSphere.h" +#include "GuDistancePointTriangle.h" + +#if PX_VC +#pragma warning ( disable : 4324 ) +#endif + +// Sphere overlap any + +struct SphereParams +{ + const IndTri32* PX_RESTRICT mTris32; + const IndTri16* PX_RESTRICT mTris16; + const PxVec3* PX_RESTRICT mVerts; + + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); + + BV4_ALIGN16(PxVec3 mCenter_PaddedAligned); float mRadius2; +#ifdef GU_BV4_USE_SLABS + BV4_ALIGN16(PxVec3 mCenter_PaddedAligned2); float mRadius22; +#endif +}; + +#ifndef GU_BV4_USE_SLABS +// PT: TODO: refactor with bucket pruner code (TA34704) +static PX_FORCE_INLINE PxIntBool BV4_SphereAABBOverlap(const PxVec3& center, const PxVec3& extents, const SphereParams* PX_RESTRICT params) +{ + const Vec4V mCenter = V4LoadA_Safe(¶ms->mCenter_PaddedAligned.x); + const FloatV mRadius2 = FLoad(params->mRadius2); + + const Vec4V boxCenter = V4LoadU(¢er.x); + const Vec4V boxExtents = V4LoadU(&extents.x); + + const Vec4V offset = V4Sub(mCenter, boxCenter); + const Vec4V closest = V4Clamp(offset, V4Neg(boxExtents), boxExtents); + const Vec4V d = V4Sub(offset, closest); + + const PxU32 test = (PxU32)_mm_movemask_ps(FIsGrtrOrEq(mRadius2, V4Dot3(d, d))); + return (test & 0x7) == 0x7; +} +#endif + +static PX_FORCE_INLINE PxIntBool SphereTriangle(const SphereParams* PX_RESTRICT params, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2) +{ + { + const float sqrDist = (p0 - params->mCenter_PaddedAligned).magnitudeSquared(); + if(sqrDist <= params->mRadius2) + return 1; + } + + const PxVec3 edge10 = p1 - p0; + const PxVec3 edge20 = p2 - p0; + const PxVec3 cp = closestPtPointTriangle2(params->mCenter_PaddedAligned, p0, p1, p2, edge10, edge20); + const float sqrDist = (cp - params->mCenter_PaddedAligned).magnitudeSquared(); + return sqrDist <= params->mRadius2; +} + +// PT: TODO: evaluate if SIMD distance function would be faster here (TA34704) +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static /*PX_FORCE_INLINE*/ PxIntBool /*__fastcall*/ SphereTriangle(const SphereParams* PX_RESTRICT params, PxU32 primIndex) +{ + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + return SphereTriangle(params, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2]); +} + +namespace +{ +class LeafFunction_SphereOverlapAny +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const SphereParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(SphereTriangle(params, primIndex)) + return 1; + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +template +static PX_FORCE_INLINE void setupSphereParams(ParamsT* PX_RESTRICT params, const Sphere& sphere, const BV4Tree* PX_RESTRICT tree, const PxMat44* PX_RESTRICT worldm_Aligned, const SourceMesh* PX_RESTRICT mesh) +{ + computeLocalSphere(params->mRadius2, params->mCenter_PaddedAligned, sphere, worldm_Aligned); + +#ifdef GU_BV4_USE_SLABS + params->mCenter_PaddedAligned2 = params->mCenter_PaddedAligned*2.0f; + params->mRadius22 = params->mRadius2*4.0f; +#endif + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); +} + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" + + static PX_FORCE_INLINE PxIntBool BV4_SphereAABBOverlap(const Vec4V boxCenter, const Vec4V boxExtents, const SphereParams* PX_RESTRICT params) + { + const Vec4V mCenter = V4LoadA_Safe(¶ms->mCenter_PaddedAligned2.x); + const FloatV mRadius2 = FLoad(params->mRadius22); + + const Vec4V offset = V4Sub(mCenter, boxCenter); + const Vec4V closest = V4Clamp(offset, V4Neg(boxExtents), boxExtents); + const Vec4V d = V4Sub(offset, closest); + + const PxU32 test = BGetBitMask(FIsGrtrOrEq(mRadius2, V4Dot3(d, d))); + return (test & 0x7) == 0x7; + } +#else + #ifdef GU_BV4_QUANTIZED_TREE + static PX_FORCE_INLINE PxIntBool BV4_SphereAABBOverlap(const BVDataPacked* PX_RESTRICT node, const SphereParams* PX_RESTRICT params) + { + const VecI32V testV = I4LoadA((const PxI32*)&node->mAABB.mData[0]); + const VecI32V qextentsV = VecI32V_And(testV, I4LoadXYZW(0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff)); + const VecI32V qcenterV = VecI32V_RightShift(testV, 16); + const Vec4V boxCenter = V4Mul(Vec4V_From_VecI32V(qcenterV), V4LoadA_Safe(¶ms->mCenterOrMinCoeff_PaddedAligned.x)); + const Vec4V boxExtents = V4Mul(Vec4V_From_VecI32V(qextentsV), V4LoadA_Safe(¶ms->mExtentsOrMaxCoeff_PaddedAligned.x)); + + const Vec4V mCenter = V4LoadA_Safe(¶ms->mCenter_PaddedAligned.x); + const FloatV mRadius2 = FLoad(params->mRadius2); + + const Vec4V offset = V4Sub(mCenter, boxCenter); + const Vec4V closest = V4Clamp(offset, V4Neg(boxExtents), boxExtents); + const Vec4V d = V4Sub(offset, closest); + + const PxU32 test = BGetBitMask(FIsGrtrOrEq(mRadius2, V4Dot3(d, d))); + return (test & 0x7) == 0x7; + } + #endif +#endif + +#include "GuBV4_ProcessStreamNoOrder_SphereAABB.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_SwizzledNoOrder.h" +#endif + +#define GU_BV4_PROCESS_STREAM_NO_ORDER +#include "GuBV4_Internal.h" + +PxIntBool BV4_OverlapSphereAny(const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned) +{ + const SourceMesh* PX_RESTRICT mesh =static_cast(tree.mMeshInterface); + + SphereParams Params; + setupSphereParams(&Params, sphere, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + return processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbPrimitives(); + PX_ASSERT(nbTris<16); + return LeafFunction_SphereOverlapAny::doLeafTest(&Params, nbTris); + } +} + +// Sphere overlap all + +struct SphereParamsAll : SphereParams +{ + PxU32 mNbHits; + PxU32 mMaxNbHits; + PxU32* mHits; +}; + +namespace +{ +class LeafFunction_SphereOverlapAll +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(SphereParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(SphereTriangle(params, primIndex)) + { + SphereParamsAll* ParamsAll = static_cast(params); + if(ParamsAll->mNbHits==ParamsAll->mMaxNbHits) + return 1; + ParamsAll->mHits[ParamsAll->mNbHits] = primIndex; + ParamsAll->mNbHits++; + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +PxU32 BV4_OverlapSphereAll(const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + SphereParamsAll Params; + Params.mNbHits = 0; + Params.mMaxNbHits = size; + Params.mHits = results; + + setupSphereParams(&Params, sphere, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + overflow = processStreamNoOrder(tree, &Params)!=0; + else + { + const PxU32 nbTris = mesh->getNbPrimitives(); + PX_ASSERT(nbTris<16); + overflow = LeafFunction_SphereOverlapAll::doLeafTest(&Params, nbTris)!=0; + } + return Params.mNbHits; +} + + +// Sphere overlap - callback version + +struct SphereParamsCB : SphereParams +{ + MeshOverlapCallback mCallback; + void* mUserData; +}; + +namespace +{ +class LeafFunction_SphereOverlapCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(const SphereParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + if(SphereTriangle(params, p0, p1, p2)) + { + const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + if((params->mCallback)(params->mUserData, p0, p1, p2, primIndex, vrefs)) + return 1; + } + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: this one is currently not used +void BV4_OverlapSphereCB(const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshOverlapCallback callback, void* userData) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + SphereParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + setupSphereParams(&Params, sphere, &tree, worldm_Aligned, mesh); + + if(tree.mNodes) + processStreamNoOrder(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + LeafFunction_SphereOverlapCB::doLeafTest(&Params, nbTris); + } +} + + + + + +// Point distance query +// Implemented here as a variation on the sphere-overlap codepath + +// TODO: +// * visit closest nodes first +// - revisit inlining +// - lazy-compute final results +// - SIMD +// - return uvs +// - maxDist input param + +struct PointDistanceParams : SphereParams +{ + PxVec3 mClosestPt; + PxU32 mIndex; +}; + +namespace +{ +class LeafFunction_PointDistance +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(SphereParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + const PxVec3 edge10 = p1 - p0; + const PxVec3 edge20 = p2 - p0; + const PxVec3 cp = closestPtPointTriangle2(params->mCenter_PaddedAligned, p0, p1, p2, edge10, edge20); + const float sqrDist = (cp - params->mCenter_PaddedAligned).magnitudeSquared(); + if(sqrDist <= params->mRadius2) + { + PointDistanceParams* Params = static_cast(params); + Params->mClosestPt = cp; + Params->mIndex = primIndex; + Params->mRadius2 = sqrDist; +#ifdef GU_BV4_USE_SLABS + Params->mRadius22 = sqrDist*4.0f; +#endif + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +namespace +{ + static PX_FORCE_INLINE PxIntBool BV4_SphereAABBOverlap2(const Vec4V boxCenter, const Vec4V boxExtents, const SphereParams* PX_RESTRICT params, float* PX_RESTRICT _d) + { + const Vec4V mCenter = V4LoadA_Safe(¶ms->mCenter_PaddedAligned2.x); + const FloatV mRadius2 = FLoad(params->mRadius22); + + const Vec4V offset = V4Sub(mCenter, boxCenter); + const Vec4V closest = V4Clamp(offset, V4Neg(boxExtents), boxExtents); + const Vec4V d = V4Sub(offset, closest); + + const FloatV dot = V4Dot3(d, d); + FStore(dot, _d); + + const PxU32 test = BGetBitMask(FIsGrtrOrEq(mRadius2, dot)); + return (test & 0x7) == 0x7; + } + + template + PX_FORCE_INLINE void BV4_ProcessNodeNoOrder_SwizzledQ2(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params, float* PX_RESTRICT _d) + { + OPC_SLABS_GET_CE2Q(i) + + if(BV4_SphereAABBOverlap2(centerV, extentsV, params, _d)) + { + if(node->isLeaf(i)) + LeafTestT::doLeafTest(params, node->getPrimitive(i)); + else + Stack[Nb++] = node->getChildData(i); + } + } + + template + PX_FORCE_INLINE void BV4_ProcessNodeNoOrder_SwizzledNQ2(PxU32* PX_RESTRICT Stack, PxU32& Nb, const BVDataSwizzledNQ* PX_RESTRICT node, ParamsT* PX_RESTRICT params, float* PX_RESTRICT _d) + { + OPC_SLABS_GET_CE2NQ(i) + + if(BV4_SphereAABBOverlap2(centerV, extentsV, params, _d)) + { + if(node->isLeaf(i)) + { + LeafTestT::doLeafTest(params, node->getPrimitive(i)); + } + else + Stack[Nb++] = node->getChildData(i); + } + } + + static PX_FORCE_INLINE void sort(PxU32* next, float* di, PxU32 i, PxU32 j) + { + if(di[i]minDist) // PT: "wrong" side on purpose, it's a LIFO stack + { + minDist = di[i]; + minIndex = i; + } + } + stack[nb++] = next[minIndex]; + nbMore--; + PxSwap(next[minIndex], next[nbMore]); + PxSwap(di[minIndex], di[nbMore]); + } + } + else + { + switch(nbMore) + { + case 1: + { + stack[nb++] = next[0]; + break; + } + + case 2: + { + sort(next, di, 0, 1); + PX_ASSERT(di[0]>=di[1]); + stack[nb++] = next[0]; + stack[nb++] = next[1]; + break; + } + + case 3: + { + sort(next, di, 0, 1); + sort(next, di, 1, 2); + sort(next, di, 0, 1); + PX_ASSERT(di[0]>=di[1]); + PX_ASSERT(di[1]>=di[2]); + stack[nb++] = next[0]; + stack[nb++] = next[1]; + stack[nb++] = next[2]; + break; + } + + case 4: + { + sort(next, di, 0, 1); + sort(next, di, 2, 3); + sort(next, di, 0, 2); + sort(next, di, 1, 3); + sort(next, di, 1, 2); + PX_ASSERT(di[0]>=di[1]); + PX_ASSERT(di[1]>=di[2]); + PX_ASSERT(di[2]>=di[3]); + stack[nb++] = next[0]; + stack[nb++] = next[1]; + stack[nb++] = next[2]; + stack[nb++] = next[3]; + break; + } + } + } + } +} + +void BV4_PointDistance(const PxVec3& point, const BV4Tree& tree, float maxDist, PxU32& index, float& dist, PxVec3& cp/*, const PxMat44* PX_RESTRICT worldm_Aligned*/) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + const float limit = sqrtf(sqrtf(PX_MAX_F32)); + if(maxDist>limit) + maxDist = limit; + + PointDistanceParams Params; + setupSphereParams(&Params, Sphere(point, maxDist), &tree, NULL/*worldm_Aligned*/, mesh); + + if(tree.mNodes) + { + if(0) + { + // PT: unfortunately distance queries don't map nicely to the current BV4 framework + // This works but it doesn't visit closest nodes first so it's suboptimal. We also + // cannot use the ordered traversal since it's based on PNS, i.e. a fixed ray direction. + processStreamNoOrder(tree, &Params); + } + + PxU32 initData = tree.mInitData; + PointDistanceParams* PX_RESTRICT params = &Params; + + if(tree.mQuantized) + { + const BVDataPackedQ* PX_RESTRICT nodes = reinterpret_cast(tree.mNodes); + + const BVDataPackedQ* root = nodes; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + nodes = root + getChildOffset(childData); + + const BVDataSwizzledQ* tn = reinterpret_cast(nodes); + + const PxU32 nodeType = getChildType(childData); + + PxU32 nbMore=0; + PxU32 next[4]; + float di[4]; + + if(nodeType>1) + BV4_ProcessNodeNoOrder_SwizzledQ2(next, nbMore, tn, params, &di[nbMore]); + if(nodeType>0) + BV4_ProcessNodeNoOrder_SwizzledQ2(next, nbMore, tn, params, &di[nbMore]); + BV4_ProcessNodeNoOrder_SwizzledQ2(next, nbMore, tn, params, &di[nbMore]); + BV4_ProcessNodeNoOrder_SwizzledQ2(next, nbMore, tn, params, &di[nbMore]); + + sortCandidates(nbMore, next, di, stack, nb); + + }while(nb); + } + else + { + const BVDataPackedNQ* PX_RESTRICT nodes = reinterpret_cast(tree.mNodes); + + const BVDataPackedNQ* root = nodes; + + PxU32 nb=1; + PxU32 stack[GU_BV4_STACK_SIZE]; + stack[0] = initData; + + do + { + const PxU32 childData = stack[--nb]; + nodes = root + getChildOffset(childData); + + const BVDataSwizzledNQ* tn = reinterpret_cast(nodes); + + const PxU32 nodeType = getChildType(childData); + + PxU32 nbMore=0; + PxU32 next[4]; + float di[4]; + + if(nodeType>1) + BV4_ProcessNodeNoOrder_SwizzledNQ2(next, nbMore, tn, params, &di[nbMore]); + if(nodeType>0) + BV4_ProcessNodeNoOrder_SwizzledNQ2(next, nbMore, tn, params, &di[nbMore]); + BV4_ProcessNodeNoOrder_SwizzledNQ2(next, nbMore, tn, params, &di[nbMore]); + BV4_ProcessNodeNoOrder_SwizzledNQ2(next, nbMore, tn, params, &di[nbMore]); + + sortCandidates(nbMore, next, di, stack, nb); + + }while(nb); + } + } + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + LeafFunction_PointDistance::doLeafTest(&Params, nbTris); + } + + index = Params.mIndex; + dist = sqrtf(Params.mRadius2); + cp = Params.mClosestPt; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp new file mode 100644 index 0000000..ec10e39 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBV4_SphereSweep.cpp @@ -0,0 +1,391 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxMat44.h" +#include "GuBV4.h" +#include "GuBox.h" +#include "GuSphere.h" +#include "GuSweepSphereTriangle.h" + +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#include "GuBV4_Common.h" + +// PT: for sphere-sweeps we use method 3 in %SDKRoot%\InternalDocumentation\GU\Sweep strategies.ppt + +namespace +{ + // PT: TODO: refactor structure (TA34704) + struct RayParams + { + BV4_ALIGN16(PxVec3p mCenterOrMinCoeff_PaddedAligned); + BV4_ALIGN16(PxVec3p mExtentsOrMaxCoeff_PaddedAligned); +#ifndef GU_BV4_USE_SLABS + BV4_ALIGN16(PxVec3p mData2_PaddedAligned); + BV4_ALIGN16(PxVec3p mFDir_PaddedAligned); + BV4_ALIGN16(PxVec3p mData_PaddedAligned); +#endif + BV4_ALIGN16(PxVec3p mLocalDir_Padded); // PT: TODO: this one could be switched to PaddedAligned & V4LoadA (TA34704) + BV4_ALIGN16(PxVec3p mOrigin_Padded); // PT: TODO: this one could be switched to PaddedAligned & V4LoadA (TA34704) + }; + + struct SphereSweepParams : RayParams + { + const IndTri32* PX_RESTRICT mTris32; + const IndTri16* PX_RESTRICT mTris16; + const PxVec3* PX_RESTRICT mVerts; + + PxVec3 mOriginalExtents_Padded; + + RaycastHitInternal mStabbedFace; + PxU32 mBackfaceCulling; + PxU32 mEarlyExit; + + PxVec3 mP0, mP1, mP2; + PxVec3 mBestTriNormal; + float mBestAlignmentValue; + float mBestDistance; + float mMaxDist; + +// PX_FORCE_INLINE float getReportDistance() const { return mStabbedFace.mDistance; } + PX_FORCE_INLINE float getReportDistance() const { return mBestDistance; } + }; +} + +#include "GuBV4_AABBAABBSweepTest.h" + +// PT: TODO: __fastcall removed to make it compile everywhere. Revisit. +static bool /*__fastcall*/ triSphereSweep(SphereSweepParams* PX_RESTRICT params, PxU32 primIndex, bool nodeSorting=true) +{ + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + const PxVec3& p0 = params->mVerts[VRef0]; + const PxVec3& p1 = params->mVerts[VRef1]; + const PxVec3& p2 = params->mVerts[VRef2]; + + PxVec3 normal = (p1 - p0).cross(p2 - p0); + + // Backface culling + const bool culled = params->mBackfaceCulling && normal.dot(params->mLocalDir_Padded) > 0.0f; + if(culled) + return false; + + const PxTriangle T(p0, p1, p2); // PT: TODO: check potential bad ctor/dtor here (TA34704) <= or avoid creating the tri, not needed anymore + + normal.normalize(); + + // PT: TODO: we lost some perf when switching to PhysX version. Revisit/investigate. (TA34704) + float dist; + bool directHit; + if(!sweepSphereVSTri(T.verts, normal, params->mOrigin_Padded, params->mOriginalExtents_Padded.x, params->mLocalDir_Padded, dist, directHit, true)) + return false; + + const PxReal alignmentValue = computeAlignmentValue(normal, params->mLocalDir_Padded); + if(keepTriangle(dist, alignmentValue, params->mBestDistance, params->mBestAlignmentValue, params->mMaxDist)) + { + params->mStabbedFace.mDistance = dist; + params->mStabbedFace.mTriangleID = primIndex; + params->mP0 = p0; + params->mP1 = p1; + params->mP2 = p2; + params->mBestDistance = PxMin(params->mBestDistance, dist); // exact lower bound + params->mBestAlignmentValue = alignmentValue; + params->mBestTriNormal = normal; + if(nodeSorting) + { +#ifndef GU_BV4_USE_SLABS + setupRayData(params, params->mBestDistance, params->mOrigin_Padded, params->mLocalDir_Padded); + //setupRayData(params, dist, params->mOrigin_Padded, params->mLocalDir_Padded); +#endif + } + return true; + } + // + else if(keepTriangleBasic(dist, params->mBestDistance, params->mMaxDist)) + { + params->mStabbedFace.mDistance = dist; + params->mBestDistance = PxMin(params->mBestDistance, dist); // exact lower bound + } + // + return false; +} + +namespace +{ +class LeafFunction_SphereSweepClosest +{ +public: + static PX_FORCE_INLINE void doLeafTest(SphereSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + triSphereSweep(params, primIndex); + primIndex++; + }while(nbToGo--); + } +}; + +class LeafFunction_SphereSweepAny +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(SphereSweepParams* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triSphereSweep(params, primIndex)) + return 1; + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; + +class ImpactFunctionSphere +{ +public: + static PX_FORCE_INLINE void computeImpact(PxVec3& impactPos, PxVec3& impactNormal, const Sphere& sphere, const PxVec3& dir, const PxReal t, const PxTrianglePadded& triangle) + { + computeSphereTriImpactData(impactPos, impactNormal, sphere.center, dir, t, triangle); + } +}; +} + +template +static PX_FORCE_INLINE void setupSphereParams(ParamsT* PX_RESTRICT params, const Sphere& sphere, const PxVec3& dir, float maxDist, const BV4Tree* PX_RESTRICT tree, const PxMat44* PX_RESTRICT worldm_Aligned, const SourceMesh* PX_RESTRICT mesh, PxU32 flags) +{ + params->mOriginalExtents_Padded = PxVec3(sphere.radius); + params->mStabbedFace.mTriangleID = PX_INVALID_U32; + params->mStabbedFace.mDistance = maxDist; + params->mBestDistance = PX_MAX_REAL; + params->mBestAlignmentValue = 2.0f; + params->mMaxDist = maxDist; + setupParamsFlags(params, flags); + + setupMeshPointersAndQuantizedCoeffs(params, mesh, tree); + + computeLocalRay(params->mLocalDir_Padded, params->mOrigin_Padded, dir, sphere.center, worldm_Aligned); + +#ifndef GU_BV4_USE_SLABS + setupRayData(params, maxDist, params->mOrigin_Padded, params->mLocalDir_Padded); +#endif +} + +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs.h" +#endif +#include "GuBV4_ProcessStreamOrdered_SegmentAABB_Inflated.h" +#include "GuBV4_ProcessStreamNoOrder_SegmentAABB_Inflated.h" +#ifdef GU_BV4_USE_SLABS + #include "GuBV4_Slabs_KajiyaNoOrder.h" + #include "GuBV4_Slabs_KajiyaOrdered.h" +#endif + +#define GU_BV4_PROCESS_STREAM_RAY_NO_ORDER +#define GU_BV4_PROCESS_STREAM_RAY_ORDERED +#include "GuBV4_Internal.h" + +PxIntBool BV4_SphereSweepSingle(const Sphere& sphere, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepHit* PX_RESTRICT hit, PxU32 flags) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + SphereSweepParams Params; + setupSphereParams(&Params, sphere, dir, maxDist, &tree, worldm_Aligned, mesh, flags); + + if(tree.mNodes) + { + if(Params.mEarlyExit) + processStreamRayNoOrder<1, LeafFunction_SphereSweepAny>(tree, &Params); + else + processStreamRayOrdered<1, LeafFunction_SphereSweepClosest>(tree, &Params); + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); + + return computeImpactDataT(sphere, dir, hit, &Params, worldm_Aligned, (flags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (flags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); +} + +// PT: sphere sweep callback version - currently not used + +namespace +{ + struct SphereSweepParamsCB : SphereSweepParams + { + // PT: these new members are only here to call computeImpactDataT during traversal :( + // PT: TODO: most of them may not be needed if we just move sphere to local space before traversal + Sphere mSphere; // Sphere in original space (maybe not local/mesh space) + PxVec3 mDir; // Dir in original space (maybe not local/mesh space) + const PxMat44* mWorldm_Aligned; + PxU32 mFlags; + + SweepUnlimitedCallback mCallback; + void* mUserData; + bool mNodeSorting; + }; + +class LeafFunction_SphereSweepCB +{ +public: + static PX_FORCE_INLINE PxIntBool doLeafTest(SphereSweepParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + if(triSphereSweep(params, primIndex, params->mNodeSorting)) + { + // PT: TODO: in this version we must compute the impact data immediately, + // which is a terrible idea in general, but I'm not sure what else I can do. + SweepHit hit; + const bool b = computeImpactDataT(params->mSphere, params->mDir, &hit, params, params->mWorldm_Aligned, (params->mFlags & QUERY_MODIFIER_DOUBLE_SIDED)!=0, (params->mFlags & QUERY_MODIFIER_MESH_BOTH_SIDES)!=0); + PX_ASSERT(b); + PX_UNUSED(b); + + reportUnlimitedCallbackHit(params, hit); + } + + primIndex++; + }while(nbToGo--); + + return 0; + } +}; +} + +// PT: for design decisions in this function, refer to the comments of BV4_GenericSweepCB(). +void BV4_SphereSweepCB(const Sphere& sphere, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting) +{ + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + SphereSweepParamsCB Params; + Params.mSphere = sphere; + Params.mDir = dir; + Params.mWorldm_Aligned = worldm_Aligned; + Params.mFlags = flags; + + Params.mCallback = callback; + Params.mUserData = userData; + Params.mMaxDist = maxDist; + Params.mNodeSorting = nodeSorting; + setupSphereParams(&Params, sphere, dir, maxDist, &tree, worldm_Aligned, mesh, flags); + + PX_ASSERT(!Params.mEarlyExit); + + if(tree.mNodes) + { + if(nodeSorting) + processStreamRayOrdered<1, LeafFunction_SphereSweepCB>(tree, &Params); + else + processStreamRayNoOrder<1, LeafFunction_SphereSweepCB>(tree, &Params); + } + else + doBruteForceTests(mesh->getNbTriangles(), &Params); +} + + +// Old box sweep callback version, using sphere code + +namespace +{ +struct BoxSweepParamsCB : SphereSweepParams +{ + MeshSweepCallback mCallback; + void* mUserData; +}; + +class ExLeafTestSweepCB +{ +public: + static PX_FORCE_INLINE void doLeafTest(BoxSweepParamsCB* PX_RESTRICT params, PxU32 primIndex) + { + PxU32 nbToGo = getNbPrimitives(primIndex); + do + { + PxU32 VRef0, VRef1, VRef2; + getVertexReferences(VRef0, VRef1, VRef2, primIndex, params->mTris32, params->mTris16); + + { +// const PxU32 vrefs[3] = { VRef0, VRef1, VRef2 }; + float dist = params->mStabbedFace.mDistance; + if((params->mCallback)(params->mUserData, params->mVerts[VRef0], params->mVerts[VRef1], params->mVerts[VRef2], primIndex, /*vrefs,*/ dist)) + return; + + if(distmStabbedFace.mDistance) + { + params->mStabbedFace.mDistance = dist; +#ifndef GU_BV4_USE_SLABS + setupRayData(params, dist, params->mOrigin_Padded, params->mLocalDir_Padded); +#endif + } + } + + primIndex++; + }while(nbToGo--); + } +}; +} + +void BV4_GenericSweepCB_Old(const PxVec3& origin, const PxVec3& extents, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshSweepCallback callback, void* userData) +{ + BoxSweepParamsCB Params; + Params.mCallback = callback; + Params.mUserData = userData; + Params.mOriginalExtents_Padded = extents; + + Params.mStabbedFace.mTriangleID = PX_INVALID_U32; + Params.mStabbedFace.mDistance = maxDist; + + computeLocalRay(Params.mLocalDir_Padded, Params.mOrigin_Padded, dir, origin, worldm_Aligned); + +#ifndef GU_BV4_USE_SLABS + setupRayData(&Params, maxDist, Params.mOrigin_Padded, Params.mLocalDir_Padded); +#endif + + const SourceMesh* PX_RESTRICT mesh = static_cast(tree.mMeshInterface); + + setupMeshPointersAndQuantizedCoeffs(&Params, mesh, &tree); + + if(tree.mNodes) + processStreamRayOrdered<1, ExLeafTestSweepCB>(tree, &Params); + else + { + const PxU32 nbTris = mesh->getNbTriangles(); + PX_ASSERT(nbTris<16); + ExLeafTestSweepCB::doLeafTest(&Params, nbTris); + } +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBVConstants.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBVConstants.h new file mode 100644 index 0000000..642b8b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuBVConstants.h @@ -0,0 +1,43 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_BV_CONSTANTS_H +#define GU_BV_CONSTANTS_H + +#include "foundation/PxVecMath.h" + +namespace +{ + const physx::aos::VecU32V signMask = physx::aos::U4LoadXYZW((physx::PxU32(1)<<31), (physx::PxU32(1)<<31), (physx::PxU32(1)<<31), (physx::PxU32(1)<<31)); + const physx::aos::Vec4V epsFloat4 = physx::aos::V4Load(1e-9f); + const physx::aos::Vec4V zeroes = physx::aos::V4Zero(); + const physx::aos::Vec4V twos = physx::aos::V4Load(2.0f); + const physx::aos::Vec4V epsInflateFloat4 = physx::aos::V4Load(1e-7f); +} + +#endif // GU_BV_CONSTANTS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshData.h new file mode 100644 index 0000000..866d532 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshData.h @@ -0,0 +1,644 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_MESH_DATA_H +#define GU_MESH_DATA_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" +#include "foundation/PxBounds3.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTetrahedronMesh.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxAllocator.h" +#include "GuRTree.h" +#include "GuBV4.h" +#include "GuBV32.h" +#include "GuSDF.h" + +namespace physx +{ +namespace Gu { + +// 1: support stackless collision trees for non-recursive collision queries +// 2: height field functionality not supported anymore +// 3: mass struct removed +// 4: bounding sphere removed +// 5: RTree added, opcode tree still in the binary image, physx 3.0 +// 6: opcode tree removed from binary image +// 7: convex decomposition is out +// 8: adjacency information added +// 9: removed leaf triangles and most of opcode data, changed rtree layout +// 10: float rtrees +// 11: new build, isLeaf added to page +// 12: isLeaf is now the lowest bit in ptrs +// 13: TA30159 removed deprecated convexEdgeThreshold and bumped version +// 14: added midphase ID +// 15: GPU data simplification +// 16: vertex2Face mapping enabled by default if using GPU + +#define PX_MESH_VERSION 16 +#define PX_TET_MESH_VERSION 1 +#define PX_SOFTBODY_MESH_VERSION 2 + +// these flags are used to indicate/validate the contents of a cooked mesh file +enum InternalMeshSerialFlag +{ + IMSF_MATERIALS = (1<<0), //!< if set, the cooked mesh file contains per-triangle material indices + IMSF_FACE_REMAP = (1<<1), //!< if set, the cooked mesh file contains a remap table + IMSF_8BIT_INDICES = (1<<2), //!< if set, the cooked mesh file contains 8bit indices (topology) + IMSF_16BIT_INDICES = (1<<3), //!< if set, the cooked mesh file contains 16bit indices (topology) + IMSF_ADJACENCIES = (1<<4), //!< if set, the cooked mesh file contains adjacency structures + IMSF_GRB_DATA = (1<<5), //!< if set, the cooked mesh file contains GRB data structures + IMSF_SDF = (1<<6), //!< if set, the cooked mesh file contains SDF data structures + IMSF_VERT_MAPPING = (1<<7), //!< if set, the cooked mesh file contains vertex mapping information + IMSF_GRB_INV_REMAP = (1<<8), //!< if set, the cooked mesh file contains vertex inv mapping information. Required for cloth + IMSF_INERTIA = (1<<9) //!< if set, the cooked mesh file contains inertia tensor for the mesh +}; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + class MeshDataBase : public PxUserAllocated + { + public: + PxMeshMidPhase::Enum mType; + PxU8 mFlags; + PxU32 mNbVertices; + PxVec3* mVertices; + + PxReal mMass; //this is mass assuming a unit density that can be scaled by instances! + PxMat33 mInertia; //in local space of mesh! + PxVec3 mLocalCenterOfMass; //local space com + + PxBounds3 mAABB; + PxReal mGeomEpsilon; + + PxU32* mFaceRemap; + + // GRB data ------------------------- + void* mGRB_primIndices; //!< GRB: GPU-friendly primitive indices(either triangle or tetrahedron) + PxU32* mGRB_faceRemap; //!< GRB: this remap the GPU triangle indices to CPU triangle indices + PxU32* mGRB_faceRemapInverse; // + // End of GRB data ------------------ + + // SDF data + SDF mSdfData; + + //Cloth data : each vert has a list of associated triangles in the mesh, this is for attachement constraints to enable default filtering + PxU32* mAccumulatedTrianglesRef;//runsum + PxU32* mTrianglesReferences; + PxU32 mNbTrianglesReferences; + + MeshDataBase() : + mFlags (0), + mNbVertices (0), + mVertices (NULL), + mMass (0.f), + mInertia (PxZero), + mLocalCenterOfMass (0.f), + mAABB (PxBounds3::empty()), + mGeomEpsilon (0.0f), + mFaceRemap (NULL), + mGRB_primIndices (NULL), + mGRB_faceRemap (NULL), + mGRB_faceRemapInverse (NULL), + mSdfData (PxZero), + mAccumulatedTrianglesRef(NULL), + mTrianglesReferences (NULL), + mNbTrianglesReferences (0) + { + } + + virtual ~MeshDataBase() + { + PX_FREE(mVertices); + PX_FREE(mFaceRemap); + PX_FREE(mGRB_primIndices); + PX_FREE(mGRB_faceRemap); + PX_FREE(mGRB_faceRemapInverse); + + PX_FREE(mAccumulatedTrianglesRef); + + PX_FREE(mTrianglesReferences); + } + + PX_NOINLINE PxVec3* allocateVertices(PxU32 nbVertices) + { + PX_ASSERT(!mVertices); + // PT: we allocate one more vertex to make sure it's safe to V4Load the last one + const PxU32 nbAllocatedVerts = nbVertices + 1; + mVertices = PX_ALLOCATE(PxVec3, nbAllocatedVerts, "PxVec3"); + mNbVertices = nbVertices; + return mVertices; + } + + PX_FORCE_INLINE bool has16BitIndices() const + { + return (mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) ? true : false; + } + }; + + class TriangleMeshData : public MeshDataBase + { + public: + + PxU32 mNbTriangles; + void* mTriangles; + + PxU32* mAdjacencies; + PxU8* mExtraTrigData; + PxU16* mMaterialIndices; + + // GRB data ------------------------- + void* mGRB_primAdjacencies; //!< GRB: adjacency data, with BOUNDARY and NONCONVEX flags (flags replace adj indices where applicable) [uin4] + Gu::BV32Tree* mGRB_BV32Tree; + // End of GRB data ------------------ + + TriangleMeshData() : + mNbTriangles (0), + mTriangles (NULL), + mAdjacencies (NULL), + mExtraTrigData (NULL), + mMaterialIndices (NULL), + mGRB_primAdjacencies (NULL), + mGRB_BV32Tree (NULL) + { + } + + virtual ~TriangleMeshData() + { + PX_FREE(mTriangles); + PX_FREE(mAdjacencies); + PX_FREE(mMaterialIndices); + PX_FREE(mExtraTrigData); + PX_FREE(mGRB_primAdjacencies); + PX_DELETE(mGRB_BV32Tree); + } + + PX_NOINLINE PxU32* allocateAdjacencies() + { + PX_ASSERT(mNbTriangles); + PX_ASSERT(!mAdjacencies); + mAdjacencies = PX_ALLOCATE(PxU32, mNbTriangles * 3, "mAdjacencies"); + mFlags |= PxTriangleMeshFlag::eADJACENCY_INFO; + return mAdjacencies; + } + + PX_NOINLINE PxU32* allocateFaceRemap() + { + PX_ASSERT(mNbTriangles); + PX_ASSERT(!mFaceRemap); + mFaceRemap = PX_ALLOCATE(PxU32, mNbTriangles, "mFaceRemap"); + return mFaceRemap; + } + + PX_NOINLINE void* allocateTriangles(PxU32 nbTriangles, bool force32Bit, PxU32 allocateGPUData = 0) + { + PX_ASSERT(mNbVertices); + PX_ASSERT(!mTriangles); + + bool index16 = mNbVertices <= 0xffff && !force32Bit; + if(index16) + mFlags |= PxTriangleMeshFlag::e16_BIT_INDICES; + + mTriangles = PX_ALLOC(nbTriangles * (index16 ? sizeof(PxU16) : sizeof(PxU32)) * 3, "mTriangles"); + if (allocateGPUData) + mGRB_primIndices = PX_ALLOC(nbTriangles * (index16 ? sizeof(PxU16) : sizeof(PxU32)) * 3, "mGRB_triIndices"); + mNbTriangles = nbTriangles; + return mTriangles; + } + + PX_NOINLINE PxU16* allocateMaterials() + { + PX_ASSERT(mNbTriangles); + PX_ASSERT(!mMaterialIndices); + mMaterialIndices = PX_ALLOCATE(PxU16, mNbTriangles, "mMaterialIndices"); + return mMaterialIndices; + } + + PX_NOINLINE PxU8* allocateExtraTrigData() + { + PX_ASSERT(mNbTriangles); + PX_ASSERT(!mExtraTrigData); + mExtraTrigData = PX_ALLOCATE(PxU8, mNbTriangles, "mExtraTrigData"); + return mExtraTrigData; + } + + PX_FORCE_INLINE void setTriangleAdjacency(PxU32 triangleIndex, PxU32 adjacency, PxU32 offset) + { + PX_ASSERT(mAdjacencies); + mAdjacencies[triangleIndex*3 + offset] = adjacency; + } + }; + + class RTreeTriangleData : public TriangleMeshData + { + public: + RTreeTriangleData() { mType = PxMeshMidPhase::eBVH33; } + virtual ~RTreeTriangleData() {} + + Gu::RTree mRTree; + }; + + class BV4TriangleData : public TriangleMeshData + { + public: + BV4TriangleData() { mType = PxMeshMidPhase::eBVH34; } + virtual ~BV4TriangleData() {} + + Gu::SourceMesh mMeshInterface; + Gu::BV4Tree mBV4Tree; + }; + + // PT: TODO: the following classes should probably be in their own specific files (e.g. GuTetrahedronMeshData.h, GuSoftBodyMeshData.h) + + class TetrahedronMeshData : public PxTetrahedronMeshData + { + public: + PxU32 mNbVertices; + PxVec3* mVertices; + PxU16* mMaterialIndices; //each tetrahedron should have a material index + + PxU32 mNbTetrahedrons; + void* mTetrahedrons; //IndTetrahedron32 + + PxU8 mFlags; + + PxReal mGeomEpsilon; + PxBounds3 mAABB; + + TetrahedronMeshData() : + mNbVertices(0), + mVertices(NULL), + mMaterialIndices(NULL), + mNbTetrahedrons(0), + mTetrahedrons(NULL), + mFlags(0), + mGeomEpsilon(0.0f), + mAABB(PxBounds3::empty()) + {} + + TetrahedronMeshData(PxVec3* vertices, PxU32 nbVertices, void* tetrahedrons, PxU32 nbTetrahedrons, PxU8 flags, PxReal geomEpsilon, PxBounds3 aabb) : + mNbVertices(nbVertices), + mVertices(vertices), + mNbTetrahedrons(nbTetrahedrons), + mTetrahedrons(tetrahedrons), + mFlags(flags), + mGeomEpsilon(geomEpsilon), + mAABB(aabb) + {} + + void allocateTetrahedrons(const PxU32 nbGridTetrahedrons, const PxU32 allocateGPUData = 0) + { + if (allocateGPUData) + { + mTetrahedrons = PX_ALLOC(nbGridTetrahedrons * sizeof(PxU32) * 4, "mGridModelTetrahedrons"); + } + + mNbTetrahedrons = nbGridTetrahedrons; + } + + PxVec3* allocateVertices(PxU32 nbVertices, const PxU32 allocateGPUData = 1) + { + PX_ASSERT(!mVertices); + // PT: we allocate one more vertex to make sure it's safe to V4Load the last one + if (allocateGPUData) + { + const PxU32 nbAllocatedVerts = nbVertices + 1; + mVertices = PX_ALLOCATE(PxVec3, nbAllocatedVerts, "PxVec3"); + } + mNbVertices = nbVertices; + return mVertices; + } + + PxU16* allocateMaterials() + { + PX_ASSERT(mNbTetrahedrons); + PX_ASSERT(!mMaterialIndices); + mMaterialIndices = PX_ALLOCATE(PxU16, mNbTetrahedrons, "mMaterialIndices"); + return mMaterialIndices; + } + + PX_FORCE_INLINE bool has16BitIndices() const + { + return (mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) ? true : false; + } + + ~TetrahedronMeshData() + { + PX_FREE(mTetrahedrons); + PX_FREE(mVertices); + PX_FREE(mMaterialIndices) + } + }; + + class SoftBodyCollisionData : public PxSoftBodyCollisionData + { + public: + PxU32* mFaceRemap; + + // GRB data ------------------------- + void * mGRB_primIndices; //!< GRB: GPU-friendly primitive indices(either triangle or tetrahedron) + PxU32* mGRB_faceRemap; //!< GRB: this remap the GPU triangle indices to CPU triangle indices + PxU32* mGRB_faceRemapInverse; + Gu::BV32Tree* mGRB_BV32Tree; + PxU8* mGRB_tetraSurfaceHint; + + + // End of GRB data ------------------ + Gu::TetrahedronSourceMesh mMeshInterface; + Gu::BV4Tree mBV4Tree; + + PxMat33* mTetraRestPoses; + + + SoftBodyCollisionData() : + mFaceRemap(NULL), + mGRB_primIndices(NULL), + mGRB_faceRemap(NULL), + mGRB_faceRemapInverse(NULL), + mGRB_BV32Tree(NULL), + mGRB_tetraSurfaceHint(NULL), + mTetraRestPoses(NULL) + {} + + virtual ~SoftBodyCollisionData() + { + PX_FREE(mGRB_tetraSurfaceHint); + PX_DELETE(mGRB_BV32Tree); + PX_FREE(mFaceRemap); + PX_FREE(mGRB_primIndices); + PX_FREE(mGRB_faceRemap); + PX_FREE(mGRB_faceRemapInverse); + PX_FREE(mTetraRestPoses); + } + + PxU32* allocateFaceRemap(PxU32 nbTetrahedrons) + { + PX_ASSERT(nbTetrahedrons); + PX_ASSERT(!mFaceRemap); + mFaceRemap = PX_ALLOCATE(PxU32, nbTetrahedrons, "mFaceRemap"); + return mFaceRemap; + } + + void allocateCollisionData(PxU32 nbTetrahedrons) + { + mGRB_primIndices = PX_ALLOC(nbTetrahedrons * 4 * sizeof(PxU32), "mGRB_primIndices"); + mGRB_tetraSurfaceHint = PX_ALLOCATE(PxU8, nbTetrahedrons, "mGRB_tetraSurfaceHint"); + + mTetraRestPoses = PX_ALLOCATE(PxMat33, nbTetrahedrons, "mTetraRestPoses"); + + + } + }; + + class CollisionMeshMappingData : public PxCollisionMeshMappingData + { + public: + PxReal* mVertsBarycentricInGridModel; + PxU32* mVertsRemapInGridModel; + + PxU32* mTetsRemapColToSim; + PxU32 mTetsRemapSize; + PxU32* mTetsAccumulatedRemapColToSim; //runsum, size of number of tetrahedrons in collision mesh + + //in the collision model, each vert has a list of associated simulation tetrahedrons, this is for attachement constraints to enable default filtering + PxU32* mCollisionAccumulatedTetrahedronsRef;//runsum + PxU32* mCollisionTetrahedronsReferences; + PxU32 mCollisionNbTetrahedronsReferences; + + PxU32* mCollisionSurfaceVertToTetRemap; + PxU8* mCollisionSurfaceVertsHint; + + CollisionMeshMappingData() : + mVertsBarycentricInGridModel(NULL), + mVertsRemapInGridModel(NULL), + mTetsRemapColToSim(NULL), + mTetsRemapSize(0), + mTetsAccumulatedRemapColToSim(NULL), + mCollisionAccumulatedTetrahedronsRef(NULL), + mCollisionTetrahedronsReferences(NULL), + mCollisionNbTetrahedronsReferences(0), + mCollisionSurfaceVertToTetRemap(NULL), + mCollisionSurfaceVertsHint(NULL) + { + + } + + virtual ~CollisionMeshMappingData() + { + PX_FREE(mVertsBarycentricInGridModel); + PX_FREE(mVertsRemapInGridModel); + PX_FREE(mTetsRemapColToSim); + PX_FREE(mTetsAccumulatedRemapColToSim); + PX_FREE(mCollisionAccumulatedTetrahedronsRef); + PX_FREE(mCollisionTetrahedronsReferences); + PX_FREE(mCollisionSurfaceVertsHint); + PX_FREE(mCollisionSurfaceVertToTetRemap); + } + + void allocatemappingData(const PxU32 nbVerts, const PxU32 tetRemapSize, const PxU32 nbColTetrahedrons, const PxU32 allocateGPUData = 0) + { + if (allocateGPUData) + { + mVertsBarycentricInGridModel = reinterpret_cast(PX_ALLOC(nbVerts * sizeof(PxReal) * 4, "mVertsBarycentricInGridModel")); + mVertsRemapInGridModel = reinterpret_cast(PX_ALLOC(nbVerts * sizeof(PxU32), "mVertsRemapInGridModel")); + mTetsRemapColToSim = reinterpret_cast(PX_ALLOC(tetRemapSize * sizeof(PxU32), "mTetsRemapInSimModel")); + mTetsAccumulatedRemapColToSim = reinterpret_cast(PX_ALLOC(nbColTetrahedrons * sizeof(PxU32), "mTetsAccumulatedRemapInSimModel")); + mCollisionSurfaceVertsHint = reinterpret_cast(PX_ALLOC(nbVerts * sizeof(PxU8), "mCollisionSurfaceVertsHint")); + mCollisionSurfaceVertToTetRemap = reinterpret_cast(PX_ALLOC(nbVerts * sizeof(PxU32), "mCollisionSurfaceVertToTetRemap")); + } + mTetsRemapSize = tetRemapSize; + } + + void allocateTetRefData(const PxU32 totalTetReference, const PxU32 nbCollisionVerts, const PxU32 allocateGPUData /*= 0*/) + { + if (allocateGPUData) + { + mCollisionAccumulatedTetrahedronsRef = reinterpret_cast(PX_ALLOC(nbCollisionVerts * sizeof(PxU32), "mGMAccumulatedTetrahedronsRef")); + mCollisionTetrahedronsReferences = reinterpret_cast(PX_ALLOC(totalTetReference * sizeof(PxU32), "mGMTetrahedronsReferences")); + + } + + mCollisionNbTetrahedronsReferences = totalTetReference; + } + + virtual void release() + { + PX_DELETE_THIS; + } + }; + + class SoftBodySimulationData : public PxSoftBodySimulationData + { + public: + PxReal* mGridModelInvMass; + + PxMat33* mGridModelTetraRestPoses; + + PxU32 mGridModelNbPartitions; + PxU32 mGridModelMaxTetsPerPartitions; + + PxU32* mGridModelOrderedTetrahedrons; // the corresponding tetrahedron index for the runsum + + PxU32* mGMRemapOutputCP; + PxU32* mGMAccumulatedPartitionsCP; //runsum for the combined partition + PxU32* mGMAccumulatedCopiesCP; //runsum for the vert copies in combined partitions + + PxU32 mGMRemapOutputSize; + + PxU32* mGMPullIndices; + + PxU32 mNumTetsPerElement; + + SoftBodySimulationData() : + mGridModelInvMass(NULL), + mGridModelTetraRestPoses(NULL), + mGridModelNbPartitions(0), + mGridModelOrderedTetrahedrons(NULL), + mGMRemapOutputCP(NULL), + mGMAccumulatedPartitionsCP(NULL), + mGMAccumulatedCopiesCP(NULL), + mGMRemapOutputSize(0), + mGMPullIndices(NULL) + {} + + virtual ~SoftBodySimulationData() + { + PX_FREE(mGridModelInvMass); + PX_FREE(mGridModelTetraRestPoses); + PX_FREE(mGridModelOrderedTetrahedrons); + PX_FREE(mGMRemapOutputCP); + PX_FREE(mGMAccumulatedPartitionsCP); + PX_FREE(mGMAccumulatedCopiesCP); + PX_FREE(mGMPullIndices); + } + + void allocateGridModelData(const PxU32 nbGridTetrahedrons, const PxU32 nbGridVerts, + const PxU32 nbVerts, const PxU32 nbPartitions, const PxU32 remapOutputSize, const PxU32 numTetsPerElement, const PxU32 allocateGPUData = 0) + { + PX_UNUSED(nbVerts); + + if (allocateGPUData) + { + const PxU32 numElements = nbGridTetrahedrons / numTetsPerElement; + const PxU32 numVertsPerElement = numTetsPerElement == 6 ? 8 : 4; + + mGridModelInvMass = reinterpret_cast(PX_ALLOC(nbGridVerts * sizeof(float), "mGridModelInvMass")); + mGridModelTetraRestPoses = reinterpret_cast(PX_ALLOC(nbGridTetrahedrons * sizeof(PxMat33), "mGridModelTetraRestPoses")); + + mGridModelOrderedTetrahedrons = reinterpret_cast(PX_ALLOC(numElements * sizeof(PxU32), "mGridModelOrderedTetrahedrons")); + mGMRemapOutputCP = reinterpret_cast(PX_ALLOC(remapOutputSize * sizeof(PxU32), "mGMRemapOutputCP")); + mGMAccumulatedPartitionsCP = reinterpret_cast(PX_ALLOC(nbPartitions * sizeof(PxU32), "mGMAccumulatedPartitionsCP")); + mGMAccumulatedCopiesCP = reinterpret_cast(PX_ALLOC(nbGridVerts * sizeof(PxU32), "mGMAccumulatedCopiesCP")); + mGMPullIndices = reinterpret_cast(PX_ALLOC(numElements * numVertsPerElement * sizeof(PxU32) , "mGMPullIndices")); + } + + mGridModelNbPartitions = nbPartitions; + mGMRemapOutputSize = remapOutputSize; + } + }; + + class CollisionTetrahedronMeshData : public PxCollisionTetrahedronMeshData + { + public: + TetrahedronMeshData* mMesh; + SoftBodyCollisionData* mCollisionData; + + virtual PxTetrahedronMeshData* getMesh() { return mMesh; } + virtual const PxTetrahedronMeshData* getMesh() const { return mMesh; } + virtual PxSoftBodyCollisionData* getData() { return mCollisionData; } + virtual const PxSoftBodyCollisionData* getData() const { return mCollisionData; } + + virtual ~CollisionTetrahedronMeshData() + { + PX_FREE(mMesh); + PX_FREE(mCollisionData); + } + + virtual void release() + { + PX_DELETE_THIS; + } + }; + + class SimulationTetrahedronMeshData : public PxSimulationTetrahedronMeshData + { + public: + TetrahedronMeshData* mMesh; + SoftBodySimulationData* mSimulationData; + + virtual PxTetrahedronMeshData* getMesh() { return mMesh; } + virtual PxSoftBodySimulationData* getData() { return mSimulationData; } + + virtual ~SimulationTetrahedronMeshData() + { + PX_FREE(mMesh); + PX_FREE(mSimulationData); + } + + virtual void release() + { + PX_DELETE_THIS; + } + }; + + class SoftBodyMeshData : public PxUserAllocated + { + PX_NOCOPY(SoftBodyMeshData) + public: + TetrahedronMeshData& mSimulationMesh; + SoftBodySimulationData& mSimulationData; + TetrahedronMeshData& mCollisionMesh; + SoftBodyCollisionData& mCollisionData; + CollisionMeshMappingData& mMappingData; + + SoftBodyMeshData(TetrahedronMeshData& simulationMesh, SoftBodySimulationData& simulationData, + TetrahedronMeshData& collisionMesh, SoftBodyCollisionData& collisionData, CollisionMeshMappingData& mappingData) : + mSimulationMesh(simulationMesh), + mSimulationData(simulationData), + mCollisionMesh(collisionMesh), + mCollisionData(collisionData), + mMappingData(mappingData) + { } + }; + +#if PX_VC +#pragma warning(pop) +#endif + + +} // namespace Gu + +} + +#endif // #ifdef GU_MESH_DATA_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp new file mode 100644 index 0000000..b0e2e38 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMeshQuery.cpp @@ -0,0 +1,313 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "geometry/PxMeshQuery.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxGeometryQuery.h" + +#include "GuInternal.h" +#include "GuEntityReport.h" +#include "GuHeightFieldUtil.h" +#include "GuBoxConversion.h" +#include "GuIntersectionTriangleBox.h" +#include "CmScaling.h" +#include "GuSweepTests.h" +#include "GuMidphaseInterface.h" +#include "foundation/PxFPU.h" + +using namespace physx; +using namespace Gu; + +namespace { + + class HfTrianglesEntityReport2 : public OverlapReport, public LimitedResults + { + public: + HfTrianglesEntityReport2( + PxU32* results, PxU32 maxResults, PxU32 startIndex, + HeightFieldUtil& hfUtil, + const PxVec3& boxCenter, const PxVec3& boxExtents, const PxQuat& boxRot, + bool aabbOverlap) : + LimitedResults (results, maxResults, startIndex), + mHfUtil (hfUtil), + mAABBOverlap (aabbOverlap) + { + buildFrom(mBox2Hf, boxCenter, boxExtents, boxRot); + } + + virtual bool reportTouchedTris(PxU32 nbEntities, const PxU32* entities) + { + if(mAABBOverlap) + { + while(nbEntities--) + if(!add(*entities++)) + return false; + } + else + { + const PxTransform idt(PxIdentity); + for(PxU32 i=0; i(triGeom.triangleMesh); + + PX_CHECK_AND_RETURN(triangleIndexgetNbTriangles(), "PxMeshQuery::getTriangle: triangle index is out of bounds"); + + if(adjacencyIndices && !tm->getAdjacencies()) + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Adjacency information not created. Set buildTriangleAdjacencies on Cooking params."); + + const PxMat34 vertex2worldSkew = globalPose * triGeom.scale; + tm->computeWorldTriangle(triangle, triangleIndex, vertex2worldSkew, triGeom.scale.hasNegativeDeterminant(), vertexIndices, adjacencyIndices); +} + +/////////////////////////////////////////////////////////////////////////////// + +void physx::PxMeshQuery::getTriangle(const PxHeightFieldGeometry& hfGeom, const PxTransform& globalPose, PxTriangleID triangleIndex, PxTriangle& triangle, PxU32* vertexIndices, PxU32* adjacencyIndices) +{ + HeightFieldUtil hfUtil(hfGeom); + + hfUtil.getTriangle(globalPose, triangle, vertexIndices, adjacencyIndices, triangleIndex, true, true); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 physx::PxMeshQuery::findOverlapTriangleMesh( + const PxGeometry& geom, const PxTransform& geomPose, + const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshPose, + PxU32* results, PxU32 maxResults, PxU32 startIndex, bool& overflow, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + + LimitedResults limitedResults(results, maxResults, startIndex); + + const TriangleMesh* tm = static_cast(meshGeom.triangleMesh); + + switch(geom.getType()) + { + case PxGeometryType::eBOX: + { + const PxBoxGeometry& boxGeom = static_cast(geom); + + Box box; + buildFrom(box, geomPose.p, boxGeom.halfExtents, geomPose.q); + + Midphase::intersectBoxVsMesh(box, *tm, meshPose, meshGeom.scale, &limitedResults); + break; + } + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& capsGeom = static_cast(geom); + + Capsule capsule; + getCapsule(capsule, capsGeom, geomPose); + + Midphase::intersectCapsuleVsMesh(capsule, *tm, meshPose, meshGeom.scale, &limitedResults); + break; + } + + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom); + Midphase::intersectSphereVsMesh(Sphere(geomPose.p, sphereGeom.radius), *tm, meshPose, meshGeom.scale, &limitedResults); + break; + } + + default: + { + PX_CHECK_MSG(false, "findOverlapTriangleMesh: Only box, capsule and sphere geometries are supported."); + } + } + + overflow = limitedResults.mOverflow; + return limitedResults.mNbResults; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool physx::PxMeshQuery::findOverlapTriangleMesh( PxReportCallback& callback, + const PxTriangleMeshGeometry& meshGeom0, const PxTransform& meshPose0, + const PxTriangleMeshGeometry& meshGeom1, const PxTransform& meshPose1, + PxGeometryQueryFlags queryFlags, PxMeshMeshQueryFlags meshMeshFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + + const TriangleMesh* tm0 = static_cast(meshGeom0.triangleMesh); + const TriangleMesh* tm1 = static_cast(meshGeom1.triangleMesh); + + // PT: only implemented for BV4 + if(!tm0 || !tm1 || tm0->getConcreteType()!=PxConcreteType::eTRIANGLE_MESH_BVH34 || tm1->getConcreteType()!=PxConcreteType::eTRIANGLE_MESH_BVH34) + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxMeshQuery::findOverlapTriangleMesh(): only available between two BVH34 triangles meshes."); + + // PT: ...so we don't need a table like for the other ops, just go straight to BV4 + return intersectMeshVsMesh_BV4(callback, *tm0, *tm1, meshPose0, meshPose1, meshGeom0.scale, meshGeom1.scale, meshMeshFlags); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 physx::PxMeshQuery::findOverlapHeightField( const PxGeometry& geom, const PxTransform& geomPose, + const PxHeightFieldGeometry& hfGeom, const PxTransform& hfPose, + PxU32* results, PxU32 maxResults, PxU32 startIndex, bool& overflow, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + + const PxTransform localPose0 = hfPose.transformInv(geomPose); + PxBoxGeometry boxGeom; + + switch(geom.getType()) + { + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& cap = static_cast(geom); + boxGeom.halfExtents = PxVec3(cap.halfHeight+cap.radius, cap.radius, cap.radius); + // PT: TODO: improve these bounds - see computeCapsuleBounds + } + break; + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sph = static_cast(geom); + boxGeom.halfExtents = PxVec3(sph.radius); + + // PT: TODO: could this codepath be improved using the following? + //PxBounds3 localBounds; + //const PxVec3 localSphereCenter = getLocalSphereData(localBounds, pose0, pose1, sphereGeom.radius); + } + break; + case PxGeometryType::eBOX: + boxGeom = static_cast(geom); + break; + default: + { + overflow = false; + PX_CHECK_AND_RETURN_VAL(false, "findOverlapHeightField: Only box, sphere and capsule queries are supported.", false); + } + } + + const bool isAABB = ((localPose0.q.x == 0.0f) && (localPose0.q.y == 0.0f) && (localPose0.q.z == 0.0f)); + + PxBounds3 bounds; + if (isAABB) + bounds = PxBounds3::centerExtents(localPose0.p, boxGeom.halfExtents); + else + bounds = PxBounds3::poseExtent(localPose0, boxGeom.halfExtents); // box.halfExtents is really extent + + HeightFieldUtil hfUtil(hfGeom); + HfTrianglesEntityReport2 entityReport(results, maxResults, startIndex, hfUtil, localPose0.p, boxGeom.halfExtents, localPose0.q, isAABB); + + hfUtil.overlapAABBTriangles(bounds, entityReport); + overflow = entityReport.mOverflow; + return entityReport.mNbResults; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool physx::PxMeshQuery::sweep( const PxVec3& unitDir, const PxReal maxDistance, + const PxGeometry& geom, const PxTransform& pose, + PxU32 triangleCount, const PxTriangle* triangles, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, + const PxU32* cachedIndex, const PxReal inflation, bool doubleSided, PxGeometryQueryFlags queryFlags) +{ + PX_SIMD_GUARD_CNDT(queryFlags & PxGeometryQueryFlag::eSIMD_GUARD) + PX_CHECK_AND_RETURN_VAL(pose.isValid(), "PxMeshQuery::sweep(): pose is not valid.", false); + PX_CHECK_AND_RETURN_VAL(unitDir.isFinite(), "PxMeshQuery::sweep(): unitDir is not valid.", false); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(maxDistance), "PxMeshQuery::sweep(): distance is not valid.", false); + PX_CHECK_AND_RETURN_VAL(maxDistance > 0, "PxMeshQuery::sweep(): sweep distance must be greater than 0.", false); + + PX_PROFILE_ZONE("MeshQuery.sweep", 0); + + const PxReal distance = PxMin(maxDistance, PX_MAX_SWEEP_DISTANCE); + + switch(geom.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom); + + const PxCapsuleGeometry capsuleGeom(sphereGeom.radius, 0.0f); + + return sweepCapsuleTriangles( triangleCount, triangles, doubleSided, capsuleGeom, pose, unitDir, distance, + sweepHit, cachedIndex, inflation, hitFlags); + } + + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& capsuleGeom = static_cast(geom); + + return sweepCapsuleTriangles( triangleCount, triangles, doubleSided, capsuleGeom, pose, unitDir, distance, + sweepHit, cachedIndex, inflation, hitFlags); + } + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& boxGeom = static_cast(geom); + + if(hitFlags & PxHitFlag::ePRECISE_SWEEP) + { + return sweepBoxTriangles_Precise( triangleCount, triangles, doubleSided, boxGeom, pose, unitDir, distance, sweepHit, cachedIndex, + inflation, hitFlags); + } + else + { + return sweepBoxTriangles( triangleCount, triangles, doubleSided, boxGeom, pose, unitDir, distance, sweepHit, cachedIndex, + inflation, hitFlags); + } + } + default: + PX_CHECK_MSG(false, "PxMeshQuery::sweep(): geometry object parameter must be sphere, capsule or box geometry."); + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp new file mode 100644 index 0000000..c74ba78 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseBV4.cpp @@ -0,0 +1,1085 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangleMeshGeometry.h" + +#include "GuBV4.h" +using namespace physx; +using namespace Gu; + +#include "foundation/PxVecMath.h" +using namespace physx::aos; + +#include "GuSweepMesh.h" +#include "GuBV4Build.h" +#include "GuBV4_Common.h" +#include "GuSphere.h" +#include "GuCapsule.h" +#include "GuBoxConversion.h" +#include "GuConvexUtilsInternal.h" +#include "GuVecTriangle.h" +#include "GuIntersectionTriangleBox.h" +#include "GuIntersectionCapsuleTriangle.h" +#include "GuIntersectionRayBox.h" +#include "GuTriangleMeshBV4.h" +#include "CmScaling.h" +#include "CmMatrix34.h" + +// This file contains code specific to the BV4 midphase. + +// PT: TODO: revisit/inline static sweep functions (TA34704) + +using namespace physx; +using namespace Gu; +using namespace Cm; + +PxIntBool BV4_RaycastSingle (const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxGeomRaycastHit* PX_RESTRICT hit, float maxDist, float geomEpsilon, PxU32 flags, PxHitFlags hitFlags); +PxU32 BV4_RaycastAll (const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 maxNbHits, float maxDist, PxU32 stride, float geomEpsilon, PxU32 flags, PxHitFlags hitFlags); +void BV4_RaycastCB (const PxVec3& origin, const PxVec3& dir, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, float maxDist, float geomEpsilon, PxU32 flags, MeshRayCallback callback, void* userData); + +PxIntBool BV4_OverlapSphereAny (const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned); +PxU32 BV4_OverlapSphereAll (const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow); +void BV4_OverlapSphereCB (const Sphere& sphere, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshOverlapCallback callback, void* userData); + +PxIntBool BV4_OverlapBoxAny (const Box& box, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned); +PxU32 BV4_OverlapBoxAll (const Box& box, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow); +void BV4_OverlapBoxCB (const Box& box, const BV4Tree& tree, MeshOverlapCallback callback, void* userData); + +void BV4_OverlapBoxCB (const Box& box, const BV4Tree& tree, TetMeshOverlapCallback callback, void* userData); + +PxIntBool BV4_OverlapCapsuleAny (const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned); +PxU32 BV4_OverlapCapsuleAll (const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, PxU32* results, PxU32 size, bool& overflow); +void BV4_OverlapCapsuleCB (const Capsule& capsule, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshOverlapCallback callback, void* userData); + +PxIntBool BV4_SphereSweepSingle (const Sphere& sphere, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepHit* PX_RESTRICT hit, PxU32 flags); +void BV4_SphereSweepCB (const Sphere& sphere, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting); + +PxIntBool BV4_BoxSweepSingle (const Box& box, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepHit* PX_RESTRICT hit, PxU32 flags); +void BV4_BoxSweepCB (const Box& box, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags, bool nodeSorting); + +PxIntBool BV4_CapsuleSweepSingle (const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags); +PxIntBool BV4_CapsuleSweepSingleAA(const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, SweepHit* PX_RESTRICT hit, PxU32 flags); +void BV4_CapsuleSweepCB (const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags); +void BV4_CapsuleSweepAACB (const Capsule& capsule, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, SweepUnlimitedCallback callback, void* userData, PxU32 flags); + +void BV4_GenericSweepCB_Old (const PxVec3& origin, const PxVec3& extents, const PxVec3& dir, float maxDist, const BV4Tree& tree, const PxMat44* PX_RESTRICT worldm_Aligned, MeshSweepCallback callback, void* userData); +void BV4_GenericSweepCB (const Box& box, const PxVec3& dir, float maxDist, const BV4Tree& tree, MeshSweepCallback callback, void* userData, bool anyHit); + +static PX_FORCE_INLINE void setIdentity(PxMat44& m) +{ + m.column0 = PxVec4(1.0f, 0.0f, 0.0f, 0.0f); + m.column1 = PxVec4(0.0f, 1.0f, 0.0f, 0.0f); + m.column2 = PxVec4(0.0f, 0.0f, 1.0f, 0.0f); + m.column3 = PxVec4(0.0f, 0.0f, 0.0f, 1.0f); +} + +// PT: TODO: PX-566 +static PX_FORCE_INLINE void setRotation(PxMat44& m, const PxQuat& q) +{ + const PxReal x = q.x; + const PxReal y = q.y; + const PxReal z = q.z; + const PxReal w = q.w; + + const PxReal x2 = x + x; + const PxReal y2 = y + y; + const PxReal z2 = z + z; + + const PxReal xx = x2*x; + const PxReal yy = y2*y; + const PxReal zz = z2*z; + + const PxReal xy = x2*y; + const PxReal xz = x2*z; + const PxReal xw = x2*w; + + const PxReal yz = y2*z; + const PxReal yw = y2*w; + const PxReal zw = z2*w; + + m.column0 = PxVec4(1.0f - yy - zz, xy + zw, xz - yw, 0.0f); + m.column1 = PxVec4(xy - zw, 1.0f - xx - zz, yz + xw, 0.0f); + m.column2 = PxVec4(xz + yw, yz - xw, 1.0f - xx - yy, 0.0f); +} + +#define IEEE_1_0 0x3f800000 //!< integer representation of 1.0 +static PX_FORCE_INLINE const PxMat44* setupWorldMatrix(PxMat44& world, const float* meshPos, const float* meshRot) +{ +// world = PxMat44(PxIdentity); + setIdentity(world); + + bool isIdt = true; + if(meshRot) + { + const PxU32* Bin = reinterpret_cast(meshRot); + if(Bin[0]!=0 || Bin[1]!=0 || Bin[2]!=0 || Bin[3]!=IEEE_1_0) + { +// const PxQuat Q(meshRot[0], meshRot[1], meshRot[2], meshRot[3]); +// world = PxMat44(Q); + setRotation(world, PxQuat(meshRot[0], meshRot[1], meshRot[2], meshRot[3])); + isIdt = false; + } + } + + if(meshPos) + { + const PxU32* Bin = reinterpret_cast(meshPos); + if(Bin[0]!=0 || Bin[1]!=0 || Bin[2]!=0) + { +// world.setPosition(PxVec3(meshPos[0], meshPos[1], meshPos[2])); + world.column3.x = meshPos[0]; + world.column3.y = meshPos[1]; + world.column3.z = meshPos[2]; + isIdt = false; + } + } + return isIdt ? NULL : &world; +} + +static PX_FORCE_INLINE PxU32 setupFlags(bool anyHit, bool doubleSided, bool meshBothSides) +{ + PxU32 flags = 0; + if(anyHit) + flags |= QUERY_MODIFIER_ANY_HIT; + if(doubleSided) + flags |= QUERY_MODIFIER_DOUBLE_SIDED; + if(meshBothSides) + flags |= QUERY_MODIFIER_MESH_BOTH_SIDES; + return flags; +} + +static PxIntBool boxSweepVsMesh(SweepHit& h, const BV4Tree& tree, const float* meshPos, const float* meshRot, const Box& box, const PxVec3& dir, float maxDist, bool anyHit, bool doubleSided, bool meshBothSides) +{ + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, meshPos, meshRot); + + const PxU32 flags = setupFlags(anyHit, doubleSided, meshBothSides); + return BV4_BoxSweepSingle(box, dir, maxDist, tree, TM, &h, flags); +} + +static PxIntBool sphereSweepVsMesh(SweepHit& h, const BV4Tree& tree, const PxVec3& center, float radius, const PxVec3& dir, float maxDist, const PxMat44* TM, const PxU32 flags) +{ + // PT: TODO: avoid this copy (TA34704) + const Sphere tmp(center, radius); + + return BV4_SphereSweepSingle(tmp, dir, maxDist, tree, TM, &h, flags); +} + +static bool capsuleSweepVsMesh(SweepHit& h, const BV4Tree& tree, const Capsule& capsule, const PxVec3& dir, float maxDist, const PxMat44* TM, const PxU32 flags) +{ + Capsule localCapsule; + computeLocalCapsule(localCapsule, capsule, TM); + + // PT: TODO: optimize + PxVec3 localDir, unused; + computeLocalRay(localDir, unused, dir, dir, TM); + + const PxVec3 capsuleDir = localCapsule.p1 - localCapsule.p0; + PxU32 nbNullComponents = 0; + const float epsilon = 1e-3f; + if(PxAbs(capsuleDir.x)transform(h.mPos); + h.mNormal = TM->rotate(h.mNormal); + } + return status!=0; +} + +static PX_FORCE_INLINE void boxSweepVsMeshCBOld(const BV4Tree& tree, const float* meshPos, const float* meshRot, const PxVec3& center, const PxVec3& extents, const PxVec3& dir, float maxDist, MeshSweepCallback callback, void* userData) +{ + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, meshPos, meshRot); + + BV4_GenericSweepCB_Old(center, extents, dir, maxDist, tree, TM, callback, userData); +} + +// + +static PX_FORCE_INLINE bool raycastVsMesh(PxGeomRaycastHit& hitData, const BV4Tree& tree, const float* meshPos, const float* meshRot, const PxVec3& orig, const PxVec3& dir, float maxDist, float geomEpsilon, bool doubleSided, PxHitFlags hitFlags) +{ + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, meshPos, meshRot); + + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + const PxU32 flags = setupFlags(anyHit, doubleSided, false); + + if(!BV4_RaycastSingle(orig, dir, tree, TM, &hitData, maxDist, geomEpsilon, flags, hitFlags)) + return false; + + return true; +} + +/*static PX_FORCE_INLINE PxU32 raycastVsMeshAll(PxRaycastHit* hits, PxU32 maxNbHits, const BV4Tree& tree, const float* meshPos, const float* meshRot, const PxVec3& orig, const PxVec3& dir, float maxDist, float geomEpsilon, bool doubleSided, PxHitFlags hitFlags) +{ + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, meshPos, meshRot); + + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + const PxU32 flags = setupFlags(anyHit, doubleSided, false); + + return BV4_RaycastAll(orig, dir, tree, TM, hits, maxNbHits, maxDist, geomEpsilon, flags, hitFlags); +}*/ + +static PX_FORCE_INLINE void raycastVsMeshCB(const BV4Tree& tree, const PxVec3& orig, const PxVec3& dir, float maxDist, float geomEpsilon, bool doubleSided, MeshRayCallback callback, void* userData) +{ + const PxU32 flags = setupFlags(false, doubleSided, false); + BV4_RaycastCB(orig, dir, tree, NULL, maxDist, geomEpsilon, flags, callback, userData); +} + +struct BV4RaycastCBParams +{ + PX_FORCE_INLINE BV4RaycastCBParams( PxGeomRaycastHit* hits, PxU32 maxHits, PxU32 stride, const PxMeshScale* scale, const PxTransform* pose, + const PxMat34* world2vertexSkew, PxU32 hitFlags, + const PxVec3& rayDir, bool isDoubleSided, float distCoeff) : + mDstBase (reinterpret_cast(hits)), + mHitNum (0), + mMaxHits (maxHits), + mStride (stride), + mScale (scale), + mPose (pose), + mWorld2vertexSkew (world2vertexSkew), + mHitFlags (hitFlags), + mRayDir (rayDir), + mIsDoubleSided (isDoubleSided), + mDistCoeff (distCoeff) + { + } + + PxU8* mDstBase; + PxU32 mHitNum; + const PxU32 mMaxHits; + const PxU32 mStride; + const PxMeshScale* mScale; + const PxTransform* mPose; + const PxMat34* mWorld2vertexSkew; + const PxU32 mHitFlags; + const PxVec3& mRayDir; + const bool mIsDoubleSided; + float mDistCoeff; + +private: + BV4RaycastCBParams& operator=(const BV4RaycastCBParams&); +}; + +static PX_FORCE_INLINE PxVec3 processLocalNormal(const PxMat34* PX_RESTRICT world2vertexSkew, const PxTransform* PX_RESTRICT pose, const PxVec3& localNormal, const PxVec3& rayDir, const bool isDoubleSided) +{ + PxVec3 normal; + if(world2vertexSkew) + normal = world2vertexSkew->rotateTranspose(localNormal); + else + normal = pose->rotate(localNormal); + normal.normalize(); + + // PT: figure out correct normal orientation (DE7458) + // - if the mesh is single-sided the normal should be the regular triangle normal N, regardless of eMESH_BOTH_SIDES. + // - if the mesh is double-sided the correct normal can be either N or -N. We take the one opposed to ray direction. + if(isDoubleSided && normal.dot(rayDir) > 0.0f) + normal = -normal; + return normal; +} + +static HitCode gRayCallback(void* userData, const PxVec3& lp0, const PxVec3& lp1, const PxVec3& lp2, PxU32 triangleIndex, float dist, float u, float v) +{ + BV4RaycastCBParams* params = reinterpret_cast(userData); + + if(params->mHitNum == params->mMaxHits) + return HIT_EXIT; + + PxGeomRaycastHit& hit = *reinterpret_cast(params->mDstBase); + + hit.distance = dist * params->mDistCoeff; + hit.u = u; + hit.v = v; + hit.faceIndex = triangleIndex; + + PxVec3 localImpact = (1.0f - u - v)*lp0 + u*lp1 + v*lp2; + if(params->mWorld2vertexSkew) + { + localImpact = params->mScale->transform(localImpact); + if(params->mScale->hasNegativeDeterminant()) + PxSwap(hit.u, hit.v); // have to swap the UVs though since they were computed in mesh local space + } + + hit.position = params->mPose->transform(localImpact); + hit.flags = PxHitFlag::ePOSITION|PxHitFlag::eUV|PxHitFlag::eFACE_INDEX; + + PxVec3 normal(0.0f); + // Compute additional information if needed + if(params->mHitFlags & PxHitFlag::eNORMAL) + { + const PxVec3 localNormal = (lp1 - lp0).cross(lp2 - lp0); + normal = processLocalNormal(params->mWorld2vertexSkew, params->mPose, localNormal, params->mRayDir, params->mIsDoubleSided); + hit.flags |= PxHitFlag::eNORMAL; + } + hit.normal = normal; + + params->mHitNum++; + params->mDstBase += params->mStride; + + return HIT_NONE; +} + +PxU32 physx::Gu::raycast_triangleMesh_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4TriangleMesh* meshData = static_cast(mesh); + + const bool multipleHits = hitFlags & PxHitFlag::eMESH_MULTIPLE; + const bool idtScale = meshGeom.scale.isIdentity(); + + const bool isDoubleSided = meshGeom.meshFlags.isSet(PxMeshGeometryFlag::eDOUBLE_SIDED); + const bool bothSides = isDoubleSided || (hitFlags & PxHitFlag::eMESH_BOTH_SIDES); + + const BV4Tree& tree = static_cast(meshData)->getBV4Tree(); + if(idtScale && !multipleHits) + { + bool b = raycastVsMesh(*hits, tree, &pose.p.x, &pose.q.x, rayOrigin, rayDir, maxDist, meshData->getGeomEpsilon(), bothSides, hitFlags); + if(b) + { + PxHitFlags dstFlags = PxHitFlag::ePOSITION|PxHitFlag::eUV|PxHitFlag::eFACE_INDEX; + + // PT: TODO: pass flags to BV4 code (TA34704) + if(hitFlags & PxHitFlag::eNORMAL) + { + dstFlags |= PxHitFlag::eNORMAL; + if(isDoubleSided) + { + PxVec3 normal = hits->normal; + // PT: figure out correct normal orientation (DE7458) + // - if the mesh is single-sided the normal should be the regular triangle normal N, regardless of eMESH_BOTH_SIDES. + // - if the mesh is double-sided the correct normal can be either N or -N. We take the one opposed to ray direction. + if(normal.dot(rayDir) > 0.0f) + normal = -normal; + hits->normal = normal; + } + } + else + { + hits->normal = PxVec3(0.0f); + } + hits->flags = dstFlags; + } + return PxU32(b); + } + +/* + if(idtScale && multipleHits) + { + PxU32 nbHits = raycastVsMeshAll(hits, maxHits, tree, &pose.p.x, &pose.q.x, rayOrigin, rayDir, maxDist, meshData->getGeomEpsilon(), bothSides, hitFlags); + + return nbHits; + } +*/ + + //scaling: transform the ray to vertex space + PxVec3 orig, dir; + PxMat34 world2vertexSkew; + PxMat34* world2vertexSkewP = NULL; + PxReal distCoeff = 1.0f; + if(idtScale) + { + orig = pose.transformInv(rayOrigin); + dir = pose.rotateInv(rayDir); + } + else + { + world2vertexSkew = meshGeom.scale.getInverse() * pose.getInverse(); + world2vertexSkewP = &world2vertexSkew; + orig = world2vertexSkew.transform(rayOrigin); + dir = world2vertexSkew.rotate(rayDir); + { + distCoeff = dir.normalize(); + maxDist *= distCoeff; + maxDist += 1e-3f; + distCoeff = 1.0f/distCoeff; + } + } + + if(!multipleHits) + { + bool b = raycastVsMesh(*hits, tree, NULL, NULL, orig, dir, maxDist, meshData->getGeomEpsilon(), bothSides, hitFlags); + if(b) + { + hits->distance *= distCoeff; + hits->position = pose.transform(meshGeom.scale.transform(hits->position)); + PxHitFlags dstFlags = PxHitFlag::ePOSITION|PxHitFlag::eUV|PxHitFlag::eFACE_INDEX; + + if(meshGeom.scale.hasNegativeDeterminant()) + PxSwap(hits->u, hits->v); // have to swap the UVs though since they were computed in mesh local space + + // PT: TODO: pass flags to BV4 code (TA34704) + // Compute additional information if needed + if(hitFlags & PxHitFlag::eNORMAL) + { + dstFlags |= PxHitFlag::eNORMAL; + hits->normal = processLocalNormal(world2vertexSkewP, &pose, hits->normal, rayDir, isDoubleSided); + } + else + { + hits->normal = PxVec3(0.0f); + } + hits->flags = dstFlags; + } + return PxU32(b); + } + + BV4RaycastCBParams callback(hits, maxHits, stride, &meshGeom.scale, &pose, world2vertexSkewP, hitFlags, rayDir, isDoubleSided, distCoeff); + + raycastVsMeshCB( tree, + orig, dir, + maxDist, meshData->getGeomEpsilon(), bothSides, + gRayCallback, &callback); + return callback.mHitNum; +} + +namespace +{ +struct IntersectShapeVsMeshCallback +{ + IntersectShapeVsMeshCallback(LimitedResults* results, bool flipNormal) : mResults(results), mAnyHits(false), mFlipNormal(flipNormal) {} + + LimitedResults* mResults; + bool mAnyHits; + bool mFlipNormal; + + PX_FORCE_INLINE bool recordHit(PxU32 faceIndex, PxIntBool hit) + { + if(hit) + { + mAnyHits = true; + if(mResults) + mResults->add(faceIndex); + else + return false; // abort traversal if we are only interested in firstContact (mResults is NULL) + } + return true; // if we are here, either no triangles were hit or multiple results are expected => continue traversal + } +}; + +// PT: TODO: get rid of this (TA34704) +struct IntersectSphereVsMeshCallback : IntersectShapeVsMeshCallback +{ + PX_FORCE_INLINE IntersectSphereVsMeshCallback(const PxMeshScale& meshScale, const PxTransform& meshTransform, const Sphere& sphere, LimitedResults* r, bool flipNormal) + : IntersectShapeVsMeshCallback(r, flipNormal) + { + mVertexToShapeSkew = toMat33(meshScale); + mLocalCenter = meshTransform.transformInv(sphere.center); // sphereCenterInMeshSpace + mSphereRadius2 = sphere.radius*sphere.radius; + } + + PxMat33 mVertexToShapeSkew; + PxVec3 mLocalCenter; // PT: sphere center in local/mesh space + PxF32 mSphereRadius2; + + PX_FORCE_INLINE PxAgain processHit(PxU32 faceIndex, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2) + { + const Vec3V v0 = V3LoadU(mVertexToShapeSkew * av0); + const Vec3V v1 = V3LoadU(mVertexToShapeSkew * (mFlipNormal ? av2 : av1)); + const Vec3V v2 = V3LoadU(mVertexToShapeSkew * (mFlipNormal ? av1 : av2)); + + FloatV dummy1, dummy2; + Vec3V closestP; + PxReal dist2; + FStore(distancePointTriangleSquared(V3LoadU(mLocalCenter), v0, v1, v2, dummy1, dummy2, closestP), &dist2); + return recordHit(faceIndex, dist2 <= mSphereRadius2); + } +}; + +// PT: TODO: get rid of this (TA34704) +struct IntersectCapsuleVsMeshCallback : IntersectShapeVsMeshCallback +{ + PX_FORCE_INLINE IntersectCapsuleVsMeshCallback(const PxMeshScale& meshScale, const PxTransform& meshTransform, const Capsule& capsule, LimitedResults* r, bool flipNormal) + : IntersectShapeVsMeshCallback(r, flipNormal) + { + mVertexToShapeSkew = toMat33(meshScale); + + // transform world capsule to mesh shape space + mLocalCapsule.p0 = meshTransform.transformInv(capsule.p0); + mLocalCapsule.p1 = meshTransform.transformInv(capsule.p1); + mLocalCapsule.radius = capsule.radius; + mParams.init(mLocalCapsule); + } + + PxMat33 mVertexToShapeSkew; + Capsule mLocalCapsule; // PT: capsule in mesh/local space + CapsuleTriangleOverlapData mParams; + + PX_FORCE_INLINE PxAgain processHit(PxU32 faceIndex, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2) + { + const PxVec3 v0 = mVertexToShapeSkew * av0; + const PxVec3 v1 = mVertexToShapeSkew * (mFlipNormal ? av2 : av1); + const PxVec3 v2 = mVertexToShapeSkew * (mFlipNormal ? av1 : av2); + const PxVec3 normal = (v0 - v1).cross(v0 - v2); + bool hit = intersectCapsuleTriangle(normal, v0, v1, v2, mLocalCapsule, mParams); + return recordHit(faceIndex, hit); + } +}; + +// PT: TODO: get rid of this (TA34704) +struct IntersectBoxVsMeshCallback : IntersectShapeVsMeshCallback +{ + PX_FORCE_INLINE IntersectBoxVsMeshCallback(const PxMeshScale& meshScale, const PxTransform& meshTransform, const Box& box, LimitedResults* r, bool flipNormal) + : IntersectShapeVsMeshCallback(r, flipNormal) + { + const PxMat33 vertexToShapeSkew = toMat33(meshScale); + + // mesh scale needs to be included - inverse transform and optimize the box + const PxMat33 vertexToWorldSkew_Rot = PxMat33Padded(meshTransform.q) * vertexToShapeSkew; + const PxVec3& vertexToWorldSkew_Trans = meshTransform.p; + + PxMat34 tmp; + buildMatrixFromBox(tmp, box); + const PxMat34 inv = tmp.getInverseRT(); + const PxMat34 _vertexToWorldSkew(vertexToWorldSkew_Rot, vertexToWorldSkew_Trans); + + mVertexToBox = inv * _vertexToWorldSkew; + mBoxCenter = PxVec3(0.0f); + mBoxExtents = box.extents; // extents do not change + } + + PxMat34 mVertexToBox; + PxVec3p mBoxExtents, mBoxCenter; + + PX_FORCE_INLINE PxAgain processHit(PxU32 faceIndex, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2) + { + const PxVec3p v0 = mVertexToBox.transform(av0); + const PxVec3p v1 = mVertexToBox.transform(mFlipNormal ? av2 : av1); + const PxVec3p v2 = mVertexToBox.transform(mFlipNormal ? av1 : av2); + + // PT: this one is safe because we're using PxVec3p for all parameters + const PxIntBool hit = intersectTriangleBox_Unsafe(mBoxCenter, mBoxExtents, v0, v1, v2); + return recordHit(faceIndex, hit); + } +}; +} + +static bool gSphereVsMeshCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, const PxU32* /*vertexIndices*/) +{ + IntersectSphereVsMeshCallback* callback = reinterpret_cast(userData); + return !callback->processHit(triangleIndex, p0, p1, p2); +} + +static bool gCapsuleVsMeshCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, const PxU32* /*vertexIndices*/) +{ + IntersectCapsuleVsMeshCallback* callback = reinterpret_cast(userData); + return !callback->processHit(triangleIndex, p0, p1, p2); +} + +static bool gBoxVsMeshCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, const PxU32* /*vertexIndices*/) +{ + IntersectBoxVsMeshCallback* callback = reinterpret_cast(userData); + return !callback->processHit(triangleIndex, p0, p1, p2); +} + +bool physx::Gu::intersectSphereVsMesh_BV4(const Sphere& sphere, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + PX_ASSERT(triMesh.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4Tree& tree = static_cast(triMesh).getBV4Tree(); + + if(meshScale.isIdentity()) + { + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, &meshTransform.p.x, &meshTransform.q.x); + if(results) + { + const PxU32 nbResults = BV4_OverlapSphereAll(sphere, tree, TM, results->mResults, results->mMaxResults, results->mOverflow); + results->mNbResults = nbResults; + return nbResults!=0; + } + else + { + return BV4_OverlapSphereAny(sphere, tree, TM)!=0; + } + } + else + { + // PT: TODO: we don't need to use this callback here (TA34704) + IntersectSphereVsMeshCallback callback(meshScale, meshTransform, sphere, results, meshScale.hasNegativeDeterminant()); + + const Box worldOBB_(sphere.center, PxVec3(sphere.radius), PxMat33(PxIdentity)); + Box vertexOBB; + computeVertexSpaceOBB(vertexOBB, worldOBB_, meshTransform, meshScale); + + BV4_OverlapBoxCB(vertexOBB, tree, gSphereVsMeshCallback, &callback); + return callback.mAnyHits; + } +} + +bool physx::Gu::intersectBoxVsMesh_BV4(const Box& box, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + PX_ASSERT(triMesh.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4Tree& tree = static_cast(triMesh).getBV4Tree(); + + if(meshScale.isIdentity()) + { + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, &meshTransform.p.x, &meshTransform.q.x); + if(results) + { + const PxU32 nbResults = BV4_OverlapBoxAll(box, tree, TM, results->mResults, results->mMaxResults, results->mOverflow); + results->mNbResults = nbResults; + return nbResults!=0; + } + else + { + return BV4_OverlapBoxAny(box, tree, TM)!=0; + } + } + else + { + // PT: TODO: we don't need to use this callback here (TA34704) + IntersectBoxVsMeshCallback callback(meshScale, meshTransform, box, results, meshScale.hasNegativeDeterminant()); + + Box vertexOBB; // query box in vertex space + computeVertexSpaceOBB(vertexOBB, box, meshTransform, meshScale); + + BV4_OverlapBoxCB(vertexOBB, tree, gBoxVsMeshCallback, &callback); + return callback.mAnyHits; + } +} + +bool physx::Gu::intersectCapsuleVsMesh_BV4(const Capsule& capsule, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + PX_ASSERT(triMesh.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4Tree& tree = static_cast(triMesh).getBV4Tree(); + + if(meshScale.isIdentity()) + { + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, &meshTransform.p.x, &meshTransform.q.x); + if(results) + { + const PxU32 nbResults = BV4_OverlapCapsuleAll(capsule, tree, TM, results->mResults, results->mMaxResults, results->mOverflow); + results->mNbResults = nbResults; + return nbResults!=0; + } + else + { + return BV4_OverlapCapsuleAny(capsule, tree, TM)!=0; + } + } + else + { + // PT: TODO: we don't need to use this callback here (TA34704) + IntersectCapsuleVsMeshCallback callback(meshScale, meshTransform, capsule, results, meshScale.hasNegativeDeterminant()); + + // make vertex space OBB + Box vertexOBB; + Box worldOBB_; + worldOBB_.create(capsule); // AP: potential optimization (meshTransform.inverse is already in callback.mCapsule) + computeVertexSpaceOBB(vertexOBB, worldOBB_, meshTransform, meshScale); + + BV4_OverlapBoxCB(vertexOBB, tree, gCapsuleVsMeshCallback, &callback); + return callback.mAnyHits; + } +} + +// PT: TODO: get rid of this (TA34704) +static bool gVolumeCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, const PxU32* vertexIndices) +{ + MeshHitCallback* callback = reinterpret_cast*>(userData); + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& hit = reinterpret_cast(buffer); + hit.faceIndex = triangleIndex; + PxReal dummy; + return !callback->processHit(hit, p0, p1, p2, dummy, vertexIndices); +} + +static bool gTetVolumeCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const PxVec3& p3, PxU32 tetIndex, const PxU32* vertexIndices) +{ + TetMeshHitCallback* callback = reinterpret_cast*>(userData); + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& hit = reinterpret_cast(buffer); + hit.faceIndex = tetIndex; + PxReal dummy; + return !callback->processHit(hit, p0, p1, p2, p3, dummy, vertexIndices); +} + +void physx::Gu::intersectOBB_BV4(const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned) +{ + PX_UNUSED(checkObbIsAligned); + PX_UNUSED(bothTriangleSidesCollide); + BV4_OverlapBoxCB(obb, static_cast(mesh)->getBV4Tree(), gVolumeCallback, &callback); +} + +void physx::Gu::intersectOBB_BV4(const TetrahedronMesh* mesh, const Box& obb, TetMeshHitCallback& callback) +{ + BV4_OverlapBoxCB(obb, static_cast(mesh)->getBV4Tree(), gTetVolumeCallback, &callback); +} + + + + +#include "GuVecCapsule.h" +#include "GuSweepMTD.h" + +static bool gCapsuleMeshSweepCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, /*const PxU32* vertexIndices,*/ float& dist) +{ + SweepCapsuleMeshHitCallback* callback = reinterpret_cast(userData); + PxGeomRaycastHit meshHit; + meshHit.faceIndex = triangleIndex; + return !callback->SweepCapsuleMeshHitCallback::processHit(meshHit, p0, p1, p2, dist, NULL/*vertexIndices*/); +} + +// PT: TODO: refactor/share bits of this (TA34704) +bool physx::Gu::sweepCapsule_MeshGeom_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Capsule& lss, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4TriangleMesh* meshData = static_cast(mesh); + + const Capsule inflatedCapsule(lss.p0, lss.p1, lss.radius + inflation); + + const bool isIdentity = triMeshGeom.scale.isIdentity(); + bool isDoubleSided = (triMeshGeom.meshFlags & PxMeshGeometryFlag::eDOUBLE_SIDED); + const PxU32 meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + + if(isIdentity) + { + const BV4Tree& tree = meshData->getBV4Tree(); + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, &pose.p.x, &pose.q.x); + + const PxU32 flags = setupFlags(anyHit, isDoubleSided, meshBothSides!=0); + + SweepHit hitData; + if(lss.p0==lss.p1) + { + if(!sphereSweepVsMesh(hitData, tree, inflatedCapsule.p0, inflatedCapsule.radius, unitDir, distance, TM, flags)) + return false; + } + else + { + if(!capsuleSweepVsMesh(hitData, tree, inflatedCapsule, unitDir, distance, TM, flags)) + return false; + } + + sweepHit.distance = hitData.mDistance; + sweepHit.position = hitData.mPos; + sweepHit.normal = hitData.mNormal; + sweepHit.faceIndex = hitData.mTriangleID; + + if(hitData.mDistance==0.0f) + { + sweepHit.flags = PxHitFlag::eNORMAL; + + if(meshBothSides) + isDoubleSided = true; + + // PT: TODO: consider using 'setInitialOverlapResults' here + bool hasContacts = false; + if(hitFlags & PxHitFlag::eMTD) + { + const Vec3V p0 = V3LoadU(inflatedCapsule.p0); + const Vec3V p1 = V3LoadU(inflatedCapsule.p1); + const FloatV radius = FLoad(lss.radius); + CapsuleV capsuleV; + capsuleV.initialize(p0, p1, radius); + + //we need to calculate the MTD + hasContacts = computeCapsule_TriangleMeshMTD(triMeshGeom, pose, capsuleV, inflatedCapsule.radius, isDoubleSided, sweepHit); + } + setupSweepHitForMTD(sweepHit, hasContacts, unitDir); + } + else + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + return true; + } + + // compute sweptAABB + const PxVec3 localP0 = pose.transformInv(inflatedCapsule.p0); + const PxVec3 localP1 = pose.transformInv(inflatedCapsule.p1); + PxVec3 sweepOrigin = (localP0+localP1)*0.5f; + PxVec3 sweepDir = pose.rotateInv(unitDir); + PxVec3 sweepExtents = PxVec3(inflatedCapsule.radius) + (localP0-localP1).abs()*0.5f; + PxReal distance1 = distance; + PxReal distCoef = 1.0f; + PxMat34 poseWithScale; + if(!isIdentity) + { + poseWithScale = pose * triMeshGeom.scale; + distance1 = computeSweepData(triMeshGeom, sweepOrigin, sweepExtents, sweepDir, distance); + distCoef = distance1 / distance; + } else + poseWithScale = Matrix34FromTransform(pose); + + SweepCapsuleMeshHitCallback callback(sweepHit, poseWithScale, distance, isDoubleSided, inflatedCapsule, unitDir, hitFlags, triMeshGeom.scale.hasNegativeDeterminant(), distCoef); + + boxSweepVsMeshCBOld(meshData->getBV4Tree(), NULL, NULL, sweepOrigin, sweepExtents, sweepDir, distance1, gCapsuleMeshSweepCallback, &callback); + + if(meshBothSides) + isDoubleSided = true; + + return callback.finalizeHit(sweepHit, inflatedCapsule, triMeshGeom, pose, isDoubleSided); +} + +#include "GuSweepSharedTests.h" +static bool gBoxMeshSweepCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, /*const PxU32* vertexIndices,*/ float& dist) +{ + SweepBoxMeshHitCallback* callback = reinterpret_cast(userData); + PxGeomRaycastHit meshHit; + meshHit.faceIndex = triangleIndex; + return !callback->SweepBoxMeshHitCallback::processHit(meshHit, p0, p1, p2, dist, NULL/*vertexIndices*/); +} + +// PT: TODO: refactor/share bits of this (TA34704) +bool physx::Gu::sweepBox_MeshGeom_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4TriangleMesh* meshData = static_cast(mesh); + + const bool isIdentity = triMeshGeom.scale.isIdentity(); + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool isDoubleSided = triMeshGeom.meshFlags & PxMeshGeometryFlag::eDOUBLE_SIDED; + + if(isIdentity && inflation==0.0f) + { + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + + // PT: TODO: this is wrong, we shouldn't actually sweep the inflated version +// const PxVec3 inflated = (box.extents + PxVec3(inflation)) * 1.01f; + // PT: TODO: avoid this copy +// const Box tmp(box.center, inflated, box.rot); + + SweepHit hitData; +// if(!boxSweepVsMesh(hitData, meshData->getBV4Tree(), &pose.p.x, &pose.q.x, tmp, unitDir, distance, anyHit, isDoubleSided, meshBothSides)) + if(!boxSweepVsMesh(hitData, meshData->getBV4Tree(), &pose.p.x, &pose.q.x, box, unitDir, distance, anyHit, isDoubleSided, meshBothSides)) + return false; + + sweepHit.distance = hitData.mDistance; + sweepHit.position = hitData.mPos; + sweepHit.normal = hitData.mNormal; + sweepHit.faceIndex = hitData.mTriangleID; + + if(hitData.mDistance==0.0f) + { + sweepHit.flags = PxHitFlag::eNORMAL; + + const bool bothTriangleSidesCollide = isDoubleSided || meshBothSides; + const PxTransform boxTransform = box.getTransform(); + + bool hasContacts = false; + if(hitFlags & PxHitFlag::eMTD) + hasContacts = computeBox_TriangleMeshMTD(triMeshGeom, pose, box, boxTransform, inflation, bothTriangleSidesCollide, sweepHit); + + setupSweepHitForMTD(sweepHit, hasContacts, unitDir); + } + else + { + sweepHit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + } + return true; + } + + // PT: TODO: revisit this codepath, we don't need to sweep an AABB all the time (TA34704) + + PxMat34 meshToWorldSkew; + PxVec3 sweptAABBMeshSpaceExtents, meshSpaceOrigin, meshSpaceDir; + + // Input sweep params: geom, pose, box, unitDir, distance + // We convert the origin from world space to mesh local space + // and convert the box+pose to mesh space AABB + if(isIdentity) + { + meshToWorldSkew = Matrix34FromTransform(pose); + const PxMat33Padded worldToMeshRot(pose.q.getConjugate()); // extract rotation matrix from pose.q + meshSpaceOrigin = worldToMeshRot.transform(box.center - pose.p); + meshSpaceDir = worldToMeshRot.transform(unitDir) * distance; + PxMat33 boxToMeshRot = worldToMeshRot * box.rot; + sweptAABBMeshSpaceExtents = boxToMeshRot.column0.abs() * box.extents.x + + boxToMeshRot.column1.abs() * box.extents.y + + boxToMeshRot.column2.abs() * box.extents.z; + } + else + { + meshToWorldSkew = pose * triMeshGeom.scale; + const PxMat33 meshToWorldSkew_Rot = PxMat33Padded(pose.q) * toMat33(triMeshGeom.scale); + const PxVec3& meshToWorldSkew_Trans = pose.p; + + PxMat33 worldToVertexSkew_Rot; + PxVec3 worldToVertexSkew_Trans; + getInverse(worldToVertexSkew_Rot, worldToVertexSkew_Trans, meshToWorldSkew_Rot, meshToWorldSkew_Trans); + + //make vertex space OBB + Box vertexSpaceBox1; + const PxMat34 worldToVertexSkew(worldToVertexSkew_Rot, worldToVertexSkew_Trans); + vertexSpaceBox1 = transform(worldToVertexSkew, box); + // compute swept aabb + sweptAABBMeshSpaceExtents = vertexSpaceBox1.computeAABBExtent(); + + meshSpaceOrigin = worldToVertexSkew.transform(box.center); + meshSpaceDir = worldToVertexSkew.rotate(unitDir*distance); // also applies scale to direction/length + } + + sweptAABBMeshSpaceExtents += PxVec3(inflation); // inflate the bounds with additive inflation + sweptAABBMeshSpaceExtents *= 1.01f; // fatten the bounds to account for numerical discrepancies + + PxReal dirLen = PxMax(meshSpaceDir.magnitude(), 1e-5f); + PxReal distCoeff = 1.0f; + if (!isIdentity) + distCoeff = dirLen / distance; + + // Move to AABB space + PxMat34 worldToBox; + computeWorldToBoxMatrix(worldToBox, box); + + const bool bothTriangleSidesCollide = isDoubleSided || meshBothSides; + + const PxMat34Padded meshToBox = worldToBox*meshToWorldSkew; + const PxTransform boxTransform = box.getTransform(); // PT: TODO: this is not needed when there's no hit (TA34704) + + const PxVec3 localDir = worldToBox.rotate(unitDir); + const PxVec3 localDirDist = localDir*distance; + SweepBoxMeshHitCallback callback( // using eMULTIPLE with shrinkMaxT + CallbackMode::eMULTIPLE, meshToBox, distance, bothTriangleSidesCollide, box, localDirDist, localDir, unitDir, hitFlags, inflation, triMeshGeom.scale.hasNegativeDeterminant(), distCoeff); + + const PxVec3 dir = meshSpaceDir/dirLen; + boxSweepVsMeshCBOld(meshData->getBV4Tree(), NULL, NULL, meshSpaceOrigin, sweptAABBMeshSpaceExtents, dir, dirLen, gBoxMeshSweepCallback, &callback); + + return callback.finalizeHit(sweepHit, triMeshGeom, pose, boxTransform, localDir, meshBothSides, isDoubleSided); +} + +static bool gConvexVsMeshSweepCallback(void* userData, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, PxU32 triangleIndex, /*const PxU32* vertexIndices,*/ float& dist) +{ + SweepConvexMeshHitCallback* callback = reinterpret_cast(userData); + PX_ALIGN_PREFIX(16) char buffer[sizeof(PxGeomRaycastHit)] PX_ALIGN_SUFFIX(16); + PxGeomRaycastHit& hit = reinterpret_cast(buffer); + hit.faceIndex = triangleIndex; + return !callback->SweepConvexMeshHitCallback::processHit(hit, p0, p1, p2, dist, NULL/*vertexIndices*/); +} + +void physx::Gu::sweepConvex_MeshGeom_BV4(const TriangleMesh* mesh, const Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool anyHit) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4TriangleMesh* meshData = static_cast(mesh); + BV4_GenericSweepCB(hullBox, localDir, distance, meshData->getBV4Tree(), gConvexVsMeshSweepCallback, &callback, anyHit); +} + + + + +void BV4_PointDistance(const PxVec3& point, const BV4Tree& tree, float maxDist, PxU32& index, float& dist, PxVec3& cp/*, const PxMat44* PX_RESTRICT worldm_Aligned*/); + +void Gu::pointMeshDistance_BV4(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, const PxVec3& point, float maxDist + , PxU32& index, float& dist, PxVec3& closestPt) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4TriangleMesh* meshData = static_cast(mesh); + + const BV4Tree& tree = static_cast(meshData)->getBV4Tree(); + + const bool idtScale = meshGeom.scale.isIdentity(); +/* if(idtScale) + { + BV4_ALIGN16(PxMat44 World); + const PxMat44* TM = setupWorldMatrix(World, &pose.p.x, &pose.q.x); + + PxU32 index; + float dist; + PxVec3 cp; + BV4_PointDistance(point, tree, index, dist, cp, TM); + } + else*/ + + if(idtScale) + { + const PxVec3 orig = pose.transformInv(point); + PxVec3 cp; + BV4_PointDistance(orig, tree, maxDist, index, dist, cp); + closestPt = pose.transform(cp); + } + else + { + // Scaling: transform the point to vertex space + const PxMat34 world2vertexSkew = meshGeom.scale.getInverse() * pose.getInverse(); + const PxVec3 orig = world2vertexSkew.transform(point); + PxVec3 cp; + BV4_PointDistance(orig, tree, maxDist, index, dist, cp); + // PT: TODO: do we need to fix the distance when mesh scale is not idt? + closestPt = pose.transform(meshGeom.scale.transform(cp)); + } +} + + + + +bool BV4_OverlapMeshVsMesh(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, PxMeshMeshQueryFlags meshMeshFlags); + +bool BV4_OverlapMeshVsMesh(PxReportCallback& callback, const BV4Tree& tree0, const BV4Tree& tree1, const PxMat44* mat0to1, const PxMat44* mat1to0, + const PxTransform& meshPose0, const PxTransform& meshPose1, + const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, + PxMeshMeshQueryFlags meshMeshFlags); + +bool physx::Gu::intersectMeshVsMesh_BV4(PxReportCallback& callback, const TriangleMesh& triMesh0, const TriangleMesh& triMesh1, const PxTransform& meshPose0, const PxTransform& meshPose1, const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, PxMeshMeshQueryFlags meshMeshFlags) +{ + PX_ASSERT(triMesh0.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + PX_ASSERT(triMesh1.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH34); + const BV4Tree& tree0 = static_cast(triMesh0).getBV4Tree(); + const BV4Tree& tree1 = static_cast(triMesh1).getBV4Tree(); + + const PxTransform t0to1 = meshPose1.transformInv(meshPose0); + const PxTransform t1to0 = meshPose0.transformInv(meshPose1); + + BV4_ALIGN16(PxMat44 World0to1); + const PxMat44* TM0to1 = setupWorldMatrix(World0to1, &t0to1.p.x, &t0to1.q.x); + + BV4_ALIGN16(PxMat44 World1to0); + const PxMat44* TM1to0 = setupWorldMatrix(World1to0, &t1to0.p.x, &t1to0.q.x); + + if(!meshScale0.isIdentity() || !meshScale1.isIdentity()) + return BV4_OverlapMeshVsMesh(callback, tree0, tree1, TM0to1, TM1to0, meshPose0, meshPose1, meshScale0, meshScale1, meshMeshFlags)!=0; + else + return BV4_OverlapMeshVsMesh(callback, tree0, tree1, TM0to1, TM1to0, meshMeshFlags)!=0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseInterface.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseInterface.h new file mode 100644 index 0000000..5c0091f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseInterface.h @@ -0,0 +1,378 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_MIDPHASE_INTERFACE_H +#define GU_MIDPHASE_INTERFACE_H + +#include "GuOverlapTests.h" +#include "GuRaycastTests.h" +#include "GuTriangleMesh.h" +#include "GuTetrahedronMesh.h" +#include "foundation/PxVecMath.h" +#include "PxQueryReport.h" +#include "geometry/PxMeshQuery.h" // PT: TODO: revisit this include + +// PT: this file contains the common interface for all midphase implementations. Specifically the Midphase namespace contains the +// midphase-related entry points, dispatching calls to the proper implementations depending on the triangle mesh's type. The rest of it +// is simply classes & structs shared by all implementations. + +namespace physx +{ + class PxMeshScale; + class PxTriangleMeshGeometry; +namespace Cm +{ + class FastVertex2ShapeScaling; +} + +namespace Gu +{ + struct ConvexHullData; + + struct CallbackMode { enum Enum { eANY, eCLOSEST, eMULTIPLE }; }; + + template + struct MeshHitCallback + { + CallbackMode::Enum mode; + + MeshHitCallback(CallbackMode::Enum aMode) : mode(aMode) {} + + PX_FORCE_INLINE bool inAnyMode() const { return mode == CallbackMode::eANY; } + PX_FORCE_INLINE bool inClosestMode() const { return mode == CallbackMode::eCLOSEST; } + PX_FORCE_INLINE bool inMultipleMode() const { return mode == CallbackMode::eMULTIPLE; } + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const HitType& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal& shrunkMaxT, const PxU32* vIndices) = 0; + + virtual ~MeshHitCallback() {} + }; + + template + struct TetMeshHitCallback + { + CallbackMode::Enum mode; + + TetMeshHitCallback(CallbackMode::Enum aMode) : mode(aMode) {} + + PX_FORCE_INLINE bool inAnyMode() const { return mode == CallbackMode::eANY; } + PX_FORCE_INLINE bool inClosestMode() const { return mode == CallbackMode::eCLOSEST; } + PX_FORCE_INLINE bool inMultipleMode() const { return mode == CallbackMode::eMULTIPLE; } + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const HitType& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, const PxVec3& v3, PxReal& shrunkMaxT, const PxU32* vIndices) = 0; + + virtual ~TetMeshHitCallback() {} + }; + + + + struct SweepConvexMeshHitCallback; + + struct LimitedResults + { + PxU32* mResults; + PxU32 mNbResults; + PxU32 mMaxResults; + PxU32 mStartIndex; + PxU32 mNbSkipped; + bool mOverflow; + + PX_FORCE_INLINE LimitedResults(PxU32* results, PxU32 maxResults, PxU32 startIndex) + : mResults(results), mMaxResults(maxResults), mStartIndex(startIndex) + { + reset(); + } + + PX_FORCE_INLINE void reset() + { + mNbResults = 0; + mNbSkipped = 0; + mOverflow = false; + } + + PX_FORCE_INLINE bool add(PxU32 index) + { + if(mNbResults>=mMaxResults) + { + mOverflow = true; + return false; + } + + if(mNbSkipped>=mStartIndex) + mResults[mNbResults++] = index; + else + mNbSkipped++; + + return true; + } + }; + + // RTree forward declarations + PX_PHYSX_COMMON_API PxU32 raycast_triangleMesh_RTREE(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride); + PX_PHYSX_COMMON_API bool intersectSphereVsMesh_RTREE(const Sphere& sphere, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API bool intersectBoxVsMesh_RTREE (const Box& box, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API bool intersectCapsuleVsMesh_RTREE(const Capsule& capsule, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API void intersectOBB_RTREE(const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned); + PX_PHYSX_COMMON_API bool sweepCapsule_MeshGeom_RTREE( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Capsule& lss, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + PX_PHYSX_COMMON_API bool sweepBox_MeshGeom_RTREE( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + PX_PHYSX_COMMON_API void sweepConvex_MeshGeom_RTREE(const TriangleMesh* mesh, const Gu::Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool anyHit); + PX_PHYSX_COMMON_API void pointMeshDistance_RTREE(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, const PxVec3& point, float maxDist, PxU32& index, float& dist, PxVec3& closestPt); + + // BV4 forward declarations + PX_PHYSX_COMMON_API PxU32 raycast_triangleMesh_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride); + PX_PHYSX_COMMON_API bool intersectSphereVsMesh_BV4 (const Sphere& sphere, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API bool intersectBoxVsMesh_BV4 (const Box& box, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API bool intersectCapsuleVsMesh_BV4 (const Capsule& capsule, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + PX_PHYSX_COMMON_API void intersectOBB_BV4(const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned); + PX_PHYSX_COMMON_API void intersectOBB_BV4(const TetrahedronMesh* mesh, const Box& obb, TetMeshHitCallback& callback); + PX_PHYSX_COMMON_API bool sweepCapsule_MeshGeom_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Capsule& lss, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + PX_PHYSX_COMMON_API bool sweepBox_MeshGeom_BV4( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + PX_PHYSX_COMMON_API void sweepConvex_MeshGeom_BV4(const TriangleMesh* mesh, const Gu::Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool anyHit); + PX_PHYSX_COMMON_API void pointMeshDistance_BV4(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, const PxVec3& point, float maxDist, PxU32& index, float& dist, PxVec3& closestPt); + PX_PHYSX_COMMON_API bool intersectMeshVsMesh_BV4(PxReportCallback& callback, const TriangleMesh& triMesh0, const TriangleMesh& triMesh1, const PxTransform& meshPose0, const PxTransform& meshPose1, const PxMeshScale& meshScale0, const PxMeshScale& meshScale1, PxMeshMeshQueryFlags meshMeshFlags); + + typedef PxU32 (*MidphaseRaycastFunction)( const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride); + + typedef bool (*MidphaseSphereOverlapFunction) (const Sphere& sphere, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + typedef bool (*MidphaseBoxOverlapFunction) (const Box& box, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + typedef bool (*MidphaseCapsuleOverlapFunction) (const Capsule& capsule, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results); + typedef void (*MidphaseBoxCBOverlapFunction) (const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned); + + typedef bool (*MidphaseCapsuleSweepFunction)( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Capsule& lss, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + typedef bool (*MidphaseBoxSweepFunction)( const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Gu::Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation); + typedef void (*MidphaseConvexSweepFunction)( const TriangleMesh* mesh, const Gu::Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool anyHit); + typedef void (*MidphasePointMeshFunction)(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, const PxVec3& point, float maxDist, PxU32& index, float& dist, PxVec3& closestPt); + + static const MidphaseRaycastFunction gMidphaseRaycastTable[PxMeshMidPhase::eLAST] = + { + raycast_triangleMesh_RTREE, + raycast_triangleMesh_BV4, + }; + + static const MidphaseSphereOverlapFunction gMidphaseSphereOverlapTable[PxMeshMidPhase::eLAST] = + { + intersectSphereVsMesh_RTREE, + intersectSphereVsMesh_BV4, + }; + + static const MidphaseBoxOverlapFunction gMidphaseBoxOverlapTable[PxMeshMidPhase::eLAST] = + { + intersectBoxVsMesh_RTREE, + intersectBoxVsMesh_BV4, + }; + + static const MidphaseCapsuleOverlapFunction gMidphaseCapsuleOverlapTable[PxMeshMidPhase::eLAST] = + { + intersectCapsuleVsMesh_RTREE, + intersectCapsuleVsMesh_BV4, + }; + + static const MidphaseBoxCBOverlapFunction gMidphaseBoxCBOverlapTable[PxMeshMidPhase::eLAST] = + { + intersectOBB_RTREE, + intersectOBB_BV4, + }; + + static const MidphaseBoxSweepFunction gMidphaseBoxSweepTable[PxMeshMidPhase::eLAST] = + { + sweepBox_MeshGeom_RTREE, + sweepBox_MeshGeom_BV4, + }; + + static const MidphaseCapsuleSweepFunction gMidphaseCapsuleSweepTable[PxMeshMidPhase::eLAST] = + { + sweepCapsule_MeshGeom_RTREE, + sweepCapsule_MeshGeom_BV4, + }; + + static const MidphaseConvexSweepFunction gMidphaseConvexSweepTable[PxMeshMidPhase::eLAST] = + { + sweepConvex_MeshGeom_RTREE, + sweepConvex_MeshGeom_BV4, + }; + + static const MidphasePointMeshFunction gMidphasePointMeshTable[PxMeshMidPhase::eLAST] = + { + pointMeshDistance_RTREE, + pointMeshDistance_BV4, + }; + +namespace Midphase +{ + // \param[in] mesh triangle mesh to raycast against + // \param[in] meshGeom geometry object associated with the mesh + // \param[in] meshTransform pose/transform of geometry object + // \param[in] rayOrigin ray's origin + // \param[in] rayDir ray's unit dir + // \param[in] maxDist ray's length/max distance + // \param[in] hitFlags query behavior flags + // \param[in] maxHits max number of hits = size of 'hits' buffer + // \param[out] hits result buffer where to write raycast hits + // \return number of hits written to 'hits' result buffer + // \note there's no mechanism to report overflow. Returned number of hits is just clamped to maxHits. + PX_FORCE_INLINE PxU32 raycastTriangleMesh( const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshTransform, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseRaycastTable[index](mesh, meshGeom, meshTransform, rayOrigin, rayDir, maxDist, hitFlags, maxHits, hits, stride); + } + + // \param[in] sphere sphere + // \param[in] mesh triangle mesh + // \param[in] meshTransform pose/transform of triangle mesh + // \param[in] meshScale mesh scale + // \param[out] results results object if multiple hits are needed, NULL if a simple boolean answer is enough + // \return true if at least one overlap has been found + PX_FORCE_INLINE bool intersectSphereVsMesh(const Sphere& sphere, const TriangleMesh& mesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) + { + const PxU32 index = PxU32(mesh.getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseSphereOverlapTable[index](sphere, mesh, meshTransform, meshScale, results); + } + + + // \param[in] box box + // \param[in] mesh triangle mesh + // \param[in] meshTransform pose/transform of triangle mesh + // \param[in] meshScale mesh scale + // \param[out] results results object if multiple hits are needed, NULL if a simple boolean answer is enough + // \return true if at least one overlap has been found + PX_FORCE_INLINE bool intersectBoxVsMesh(const Box& box, const TriangleMesh& mesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) + { + const PxU32 index = PxU32(mesh.getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseBoxOverlapTable[index](box, mesh, meshTransform, meshScale, results); + } + + // \param[in] capsule capsule + // \param[in] mesh triangle mesh + // \param[in] meshTransform pose/transform of triangle mesh + // \param[in] meshScale mesh scale + // \param[out] results results object if multiple hits are needed, NULL if a simple boolean answer is enough + // \return true if at least one overlap has been found + PX_FORCE_INLINE bool intersectCapsuleVsMesh(const Capsule& capsule, const TriangleMesh& mesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) + { + const PxU32 index = PxU32(mesh.getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseCapsuleOverlapTable[index](capsule, mesh, meshTransform, meshScale, results); + } + + // \param[in] mesh triangle mesh + // \param[in] box box + // \param[in] callback callback object, called each time a hit is found + // \param[in] bothTriangleSidesCollide true for double-sided meshes + // \param[in] checkObbIsAligned true to use a dedicated codepath for axis-aligned boxes + PX_FORCE_INLINE void intersectOBB(const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned = true) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + gMidphaseBoxCBOverlapTable[index](mesh, obb, callback, bothTriangleSidesCollide, checkObbIsAligned); + } + + // \param[in] mesh tetrahedron mesh + // \param[in] box box + // \param[in] callback callback object, called each time a hit is found + PX_FORCE_INLINE void intersectOBB(const TetrahedronMesh* mesh, const Box& obb, TetMeshHitCallback& callback) + { + intersectOBB_BV4(mesh, obb, callback); + } + + // \param[in] mesh triangle mesh + // \param[in] meshGeom geometry object associated with the mesh + // \param[in] meshTransform pose/transform of geometry object + // \param[in] capsule swept capsule + // \param[in] unitDir sweep's unit dir + // \param[in] distance sweep's length/max distance + // \param[out] sweepHit hit result + // \param[in] hitFlags query behavior flags + // \param[in] inflation optional inflation value for swept shape + // \return true if a hit was found, false otherwise + PX_FORCE_INLINE bool sweepCapsuleVsMesh(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshTransform, + const Gu::Capsule& capsule, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseCapsuleSweepTable[index](mesh, meshGeom, meshTransform, capsule, unitDir, distance, sweepHit, hitFlags, inflation); + } + + // \param[in] mesh triangle mesh + // \param[in] meshGeom geometry object associated with the mesh + // \param[in] meshTransform pose/transform of geometry object + // \param[in] box swept box + // \param[in] unitDir sweep's unit dir + // \param[in] distance sweep's length/max distance + // \param[out] sweepHit hit result + // \param[in] hitFlags query behavior flags + // \param[in] inflation optional inflation value for swept shape + // \return true if a hit was found, false otherwise + PX_FORCE_INLINE bool sweepBoxVsMesh(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshTransform, + const Gu::Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + return gMidphaseBoxSweepTable[index](mesh, meshGeom, meshTransform, box, unitDir, distance, sweepHit, hitFlags, inflation); + } + + // \param[in] mesh triangle mesh + // \param[in] hullBox hull's bounding box + // \param[in] localDir sweep's unit dir, in local/mesh space + // \param[in] distance sweep's length/max distance + // \param[in] callback callback object, called each time a hit is found + // \param[in] anyHit true for PxHitFlag::eMESH_ANY queries + PX_FORCE_INLINE void sweepConvexVsMesh(const TriangleMesh* mesh, const Gu::Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool anyHit) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + gMidphaseConvexSweepTable[index](mesh, hullBox, localDir, distance, callback, anyHit); + } + + PX_FORCE_INLINE void pointMeshDistance(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, const PxVec3& point, float maxDist + , PxU32& closestIndex, float& dist, PxVec3& closestPt) + { + const PxU32 index = PxU32(mesh->getConcreteType() - PxConcreteType::eTRIANGLE_MESH_BVH33); + gMidphasePointMeshTable[index](mesh, meshGeom, pose, point, maxDist, closestIndex, dist, closestPt); + } +} +} +} +#endif // GU_MIDPHASE_INTERFACE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp new file mode 100644 index 0000000..4346741 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuMidphaseRTree.cpp @@ -0,0 +1,921 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "GuSweepMesh.h" +#include "GuIntersectionRayTriangle.h" +#include "GuIntersectionCapsuleTriangle.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionRayBoxSIMD.h" +#include "GuSphere.h" +#include "GuBoxConversion.h" +#include "GuConvexUtilsInternal.h" +#include "GuVecTriangle.h" +#include "GuIntersectionTriangleBox.h" +#include "GuRTree.h" +#include "GuTriangleMeshRTree.h" +#include "GuInternal.h" +#include "CmMatrix34.h" + +// This file contains code specific to the RTree midphase. + +using namespace physx; +using namespace Cm; +using namespace Gu; +using namespace physx::aos; + +struct MeshRayCollider +{ + template + PX_PHYSX_COMMON_API static void collide( + const PxVec3& orig, const PxVec3& dir, // dir is not normalized (full length), both in mesh space (unless meshWorld is non-zero) + PxReal maxT, // maxT is from [0,1], if maxT is 0.0f, AABB traversal will be used + bool bothTriangleSidesCollide, const RTreeTriangleMesh* mesh, MeshHitCallback& callback, + const PxVec3* inflate = NULL); + + PX_PHYSX_COMMON_API static void collideOBB( + const Box& obb, bool bothTriangleSidesCollide, const RTreeTriangleMesh* mesh, MeshHitCallback& callback, + bool checkObbIsAligned = true); // perf hint, pass false if obb is rarely axis aligned +}; + +class SimpleRayTriOverlap +{ +public: + PX_FORCE_INLINE SimpleRayTriOverlap(const PxVec3& origin, const PxVec3& dir, bool bothSides, PxReal geomEpsilon) + : mOrigin(origin), mDir(dir), mBothSides(bothSides), mGeomEpsilon(geomEpsilon) + { + } + + PX_FORCE_INLINE PxIntBool overlap(const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, PxGeomRaycastHit& hit) const + { + if(!intersectRayTriangle(mOrigin, mDir, vert0, vert1, vert2, hit.distance, hit.u, hit.v, !mBothSides, mGeomEpsilon)) + return false; + + if(hit.distance< 0.0f) // test if the ray intersection t is negative + return false; + + return true; + } + + PxVec3 mOrigin; + PxVec3 mDir; + bool mBothSides; + PxReal mGeomEpsilon; +}; + +using Gu::RTree; + +// This callback comes from RTree and decodes LeafTriangle indices stored in rtree into actual triangles +// This callback is needed because RTree doesn't know that it stores triangles since it's a general purpose spatial index + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +template +struct RayRTreeCallback : RTree::CallbackRaycast, RTree::Callback +{ + MeshHitCallback& outerCallback; + PxI32 has16BitIndices; + const void* mTris; + const PxVec3* mVerts; + const PxVec3* mInflate; + const SimpleRayTriOverlap rayCollider; + PxReal maxT; + PxGeomRaycastHit closestHit; // recorded closest hit over the whole traversal (only for callback mode eCLOSEST) + PxVec3 cv0, cv1, cv2; // PT: make sure these aren't last in the class, to safely V4Load them + PxU32 cis[3]; + bool hadClosestHit; + const bool closestMode; + Vec3V inflateV, rayOriginV, rayDirV; + + RayRTreeCallback( + PxReal geomEpsilon, MeshHitCallback& callback, + PxI32 has16BitIndices_, const void* tris, const PxVec3* verts, + const PxVec3& origin, const PxVec3& dir, PxReal maxT_, bool bothSides, const PxVec3* inflate) + : outerCallback(callback), has16BitIndices(has16BitIndices_), + mTris(tris), mVerts(verts), mInflate(inflate), rayCollider(origin, dir, bothSides, geomEpsilon), + maxT(maxT_), closestMode(callback.inClosestMode()) + { + PX_ASSERT(closestHit.distance == PX_MAX_REAL); + hadClosestHit = false; + if (tInflate) + inflateV = V3LoadU(*mInflate); + rayOriginV = V3LoadU(rayCollider.mOrigin); + rayDirV = V3LoadU(rayCollider.mDir); + } + + PX_FORCE_INLINE void getVertIndices(PxU32 triIndex, PxU32& i0, PxU32 &i1, PxU32 &i2) + { + if(has16BitIndices) + { + const PxU16* p = reinterpret_cast(mTris) + triIndex*3; + i0 = p[0]; i1 = p[1]; i2 = p[2]; + } + else + { + const PxU32* p = reinterpret_cast(mTris) + triIndex*3; + i0 = p[0]; i1 = p[1]; i2 = p[2]; + } + } + + virtual PX_FORCE_INLINE bool processResults(PxU32 NumTouched, PxU32* Touched, PxF32& newMaxT) + { + PX_ASSERT(NumTouched > 0); + // Loop through touched leaves + PxGeomRaycastHit tempHit; + for(PxU32 leaf = 0; leaf0 so we can use integers + if (closestMode) + { + if(tempHit.distance < closestHit.distance) + { + closestHit = tempHit; + newMaxT = PxMin(tempHit.distance, newMaxT); + cv0 = v0; cv1 = v1; cv2 = v2; + cis[0] = vinds[0]; cis[1] = vinds[1]; cis[2] = vinds[2]; + hadClosestHit = true; + } + } else + { + PxReal shrunkMaxT = newMaxT; + PxAgain again = outerCallback.processHit(tempHit, v0, v1, v2, shrunkMaxT, vinds); + if (!again) + return false; + if (shrunkMaxT < newMaxT) + { + newMaxT = shrunkMaxT; + maxT = shrunkMaxT; + } + } + + if (outerCallback.inAnyMode()) // early out if in ANY mode + return false; + } + + } // for(PxU32 leaf = 0; leaf& callback, + bool checkObbIsAligned) +{ + const PxU32 maxResults = RTREE_N; // maxResults=rtree page size for more efficient early out + PxU32 buf[maxResults]; + RayRTreeCallback rTreeCallback( + mi->getGeomEpsilon(), callback, mi->has16BitIndices(), mi->getTrianglesFast(), mi->getVerticesFast(), + PxVec3(0), PxVec3(0), 0.0f, bothTriangleSidesCollide, NULL); + if (checkObbIsAligned && PxAbs(PxQuat(obb.rot).w) > 0.9999f) + { + PxVec3 aabbExtents = obb.computeAABBExtent(); + mi->getRTree().traverseAABB(obb.center - aabbExtents, obb.center + aabbExtents, maxResults, buf, &rTreeCallback); + } else + mi->getRTree().traverseOBB(obb, maxResults, buf, &rTreeCallback); +} + +template +void MeshRayCollider::collide( + const PxVec3& orig, const PxVec3& dir, PxReal maxT, bool bothSides, + const RTreeTriangleMesh* mi, MeshHitCallback& callback, + const PxVec3* inflate) +{ + const PxU32 maxResults = RTREE_N; // maxResults=rtree page size for more efficient early out + PxU32 buf[maxResults]; + if (maxT == 0.0f) // AABB traversal path + { + RayRTreeCallback rTreeCallback( + mi->getGeomEpsilon(), callback, mi->has16BitIndices(), mi->getTrianglesFast(), mi->getVerticesFast(), + orig, dir, maxT, bothSides, inflate); + PxVec3 inflate1 = tInflate ? *inflate : PxVec3(0); // both maxT and inflate can be zero, so need to check tInflate + mi->getRTree().traverseAABB(orig-inflate1, orig+inflate1, maxResults, buf, &rTreeCallback); + } + else // ray traversal path + { + RayRTreeCallback rTreeCallback( + mi->getGeomEpsilon(), callback, mi->has16BitIndices(), mi->getTrianglesFast(), mi->getVerticesFast(), + orig, dir, maxT, bothSides, inflate); + mi->getRTree().traverseRay(orig, dir, maxResults, buf, &rTreeCallback, inflate, maxT); + } +} + + +#define TINST(a,b) \ +template void MeshRayCollider::collide( \ + const PxVec3& orig, const PxVec3& dir, PxReal maxT, bool bothSides, const RTreeTriangleMesh* mesh, \ + MeshHitCallback& callback, const PxVec3* inflate); + +TINST(0,0) +TINST(1,0) +TINST(0,1) +TINST(1,1) + +#undef TINST + +#include "GuRaycastTests.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "GuTriangleMesh.h" +#include "CmScaling.h" + +struct RayMeshColliderCallback : public MeshHitCallback +{ + PxU8* mDstBase; + PxU32 mHitNum; + const PxU32 mMaxHits; + const PxU32 mStride; + const PxMeshScale* mScale; + const PxTransform* mPose; + const PxMat34* mWorld2vertexSkew; + PxU32 mHitFlags; + const PxVec3& mRayDir; + bool mIsDoubleSided; + float mDistCoeff; + + RayMeshColliderCallback( + CallbackMode::Enum mode_, PxGeomRaycastHit* hits, PxU32 maxHits, PxU32 stride, const PxMeshScale* scale, const PxTransform* pose, + const PxMat34* world2vertexSkew, PxU32 hitFlags, const PxVec3& rayDir, bool isDoubleSided, float distCoeff) : + MeshHitCallback (mode_), + mDstBase (reinterpret_cast(hits)), + mHitNum (0), + mMaxHits (maxHits), + mStride (stride), + mScale (scale), + mPose (pose), + mWorld2vertexSkew (world2vertexSkew), + mHitFlags (hitFlags), + mRayDir (rayDir), + mIsDoubleSided (isDoubleSided), + mDistCoeff (distCoeff) + { + } + + // return false for early out + virtual bool processHit( + const PxGeomRaycastHit& lHit, const PxVec3& lp0, const PxVec3& lp1, const PxVec3& lp2, PxReal&, const PxU32*) + { + if(mHitNum == mMaxHits) + return false; + + const PxReal u = lHit.u, v = lHit.v; + const PxVec3 localImpact = (1.0f - u - v)*lp0 + u*lp1 + v*lp2; + + //not worth concatenating to do 1 transform: PxMat34Legacy vertex2worldSkew = scaling.getVertex2WorldSkew(absPose); + // PT: TODO: revisit this for N hits + PxGeomRaycastHit& hit = *reinterpret_cast(mDstBase); + hit = lHit; + + hit.position = mPose->transform(mScale->transform(localImpact)); + hit.flags = PxHitFlag::ePOSITION|PxHitFlag::eUV|PxHitFlag::eFACE_INDEX; + hit.normal = PxVec3(0.0f); + hit.distance *= mDistCoeff; + + // Compute additional information if needed + if(mHitFlags & PxHitFlag::eNORMAL) + { + // User requested impact normal + const PxVec3 localNormal = (lp1 - lp0).cross(lp2 - lp0); + + if(mWorld2vertexSkew) + { + hit.normal = mWorld2vertexSkew->rotateTranspose(localNormal); + if (mScale->hasNegativeDeterminant()) + PxSwap(hit.u, hit.v); // have to swap the UVs though since they were computed in mesh local space + } + else + hit.normal = mPose->rotate(localNormal); + hit.normal.normalize(); + + // PT: figure out correct normal orientation (DE7458) + // - if the mesh is single-sided the normal should be the regular triangle normal N, regardless of eMESH_BOTH_SIDES. + // - if the mesh is double-sided the correct normal can be either N or -N. We take the one opposed to ray direction. + if(mIsDoubleSided && hit.normal.dot(mRayDir) > 0.0f) + hit.normal = -hit.normal; + + hit.flags |= PxHitFlag::eNORMAL; + } + + mHitNum++; + mDstBase += mStride; + return true; + } + +private: + RayMeshColliderCallback& operator=(const RayMeshColliderCallback&); +}; + +PxU32 physx::Gu::raycast_triangleMesh_RTREE(const TriangleMesh* mesh, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, + PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit* PX_RESTRICT hits, PxU32 stride) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH33); + + const RTreeTriangleMesh* meshData = static_cast(mesh); + + //scaling: transform the ray to vertex space + + PxVec3 orig, dir; + PxMat34 world2vertexSkew; + PxMat34* world2vertexSkewP = NULL; + PxReal distCoeff = 1.0f; + if(meshGeom.scale.isIdentity()) + { + orig = pose.transformInv(rayOrigin); + dir = pose.rotateInv(rayDir); + } + else + { + world2vertexSkew = meshGeom.scale.getInverse() * pose.getInverse(); + world2vertexSkewP = &world2vertexSkew; + orig = world2vertexSkew.transform(rayOrigin); + dir = world2vertexSkew.rotate(rayDir); + { + distCoeff = dir.normalize(); + maxDist *= distCoeff; + maxDist += 1e-3f; + distCoeff = 1.0f / distCoeff; + } + } + + const bool isDoubleSided = meshGeom.meshFlags.isSet(PxMeshGeometryFlag::eDOUBLE_SIDED); + const bool bothSides = isDoubleSided || (hitFlags & PxHitFlag::eMESH_BOTH_SIDES); + + const bool multipleHits = hitFlags & PxHitFlag::eMESH_MULTIPLE; + + RayMeshColliderCallback callback( + multipleHits ? CallbackMode::eMULTIPLE : (hitFlags & PxHitFlag::eMESH_ANY ? CallbackMode::eANY : CallbackMode::eCLOSEST), + hits, maxHits, stride, &meshGeom.scale, &pose, world2vertexSkewP, hitFlags, rayDir, isDoubleSided, distCoeff); + + MeshRayCollider::collide<0, 1>(orig, dir, maxDist, bothSides, static_cast(meshData), callback, NULL); + return callback.mHitNum; +} + + +/** +\brief returns indices for the largest axis and 2 other axii +*/ +PX_FORCE_INLINE PxU32 largestAxis(const PxVec3& v, PxU32& other1, PxU32& other2) +{ + if (v.x >= PxMax(v.y, v.z)) + { + other1 = 1; + other2 = 2; + return 0; + } + else if (v.y >= v.z) + { + other1 = 0; + other2 = 2; + return 1; + } + else + { + other1 = 0; + other2 = 1; + return 2; + } +} + +static PX_INLINE void computeSweptAABBAroundOBB( + const Box& obb, PxVec3& sweepOrigin, PxVec3& sweepExtents, PxVec3& sweepDir, PxReal& sweepLen) +{ + PxU32 other1, other2; + // largest axis of the OBB is the sweep direction, sum of abs of two other is the swept AABB extents + PxU32 lai = largestAxis(obb.extents, other1, other2); + PxVec3 longestAxis = obb.rot[lai]*obb.extents[lai]; + PxVec3 absOther1 = obb.rot[other1].abs()*obb.extents[other1]; + PxVec3 absOther2 = obb.rot[other2].abs()*obb.extents[other2]; + sweepOrigin = obb.center - longestAxis; + sweepExtents = absOther1 + absOther2 + PxVec3(GU_MIN_AABB_EXTENT); // see comments for GU_MIN_AABB_EXTENT + sweepLen = 2.0f; // length is already included in longestAxis + sweepDir = longestAxis; +} + +enum { eSPHERE, eCAPSULE, eBOX }; // values for tSCB + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. + #pragma warning( disable : 4512 ) // assignment operator could not be generated +#endif + +namespace +{ +struct IntersectShapeVsMeshCallback : MeshHitCallback +{ + PX_NOCOPY(IntersectShapeVsMeshCallback) +public: + IntersectShapeVsMeshCallback(const PxMat33& vertexToShapeSkew, LimitedResults* results, bool flipNormal) + : MeshHitCallback(CallbackMode::eMULTIPLE), + mVertexToShapeSkew (vertexToShapeSkew), + mResults (results), + mAnyHits (false), + mFlipNormal (flipNormal) + { + } + virtual ~IntersectShapeVsMeshCallback(){} + + const PxMat33& mVertexToShapeSkew; // vertex to box without translation for boxes + LimitedResults* mResults; + bool mAnyHits; + bool mFlipNormal; + + PX_FORCE_INLINE bool recordHit(const PxGeomRaycastHit& aHit, PxIntBool hit) + { + if(hit) + { + mAnyHits = true; + if(mResults) + mResults->add(aHit.faceIndex); + else + return false; // abort traversal if we are only interested in firstContact (mResults is NULL) + } + return true; // if we are here, either no triangles were hit or multiple results are expected => continue traversal + } +}; + +template +struct IntersectSphereVsMeshCallback : IntersectShapeVsMeshCallback +{ + IntersectSphereVsMeshCallback(const PxMat33& m, LimitedResults* r, bool flipNormal) : IntersectShapeVsMeshCallback(m, r, flipNormal) {} + virtual ~IntersectSphereVsMeshCallback(){} + PxF32 mMinDist2; + PxVec3 mLocalCenter; // PT: sphere center in local/mesh space + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& aHit, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2, PxReal&, const PxU32*) + { + const Vec3V v0 = V3LoadU(tScaleIsIdentity ? av0 : mVertexToShapeSkew * av0); + const Vec3V v1 = V3LoadU(tScaleIsIdentity ? av1 : mVertexToShapeSkew * (mFlipNormal ? av2 : av1)); + const Vec3V v2 = V3LoadU(tScaleIsIdentity ? av2 : mVertexToShapeSkew * (mFlipNormal ? av1 : av2)); + + FloatV dummy1, dummy2; + Vec3V closestP; + PxReal dist2; + FStore(distancePointTriangleSquared(V3LoadU(mLocalCenter), v0, v1, v2, dummy1, dummy2, closestP), &dist2); + return recordHit(aHit, dist2 <= mMinDist2); + } +}; + +template +struct IntersectCapsuleVsMeshCallback : IntersectShapeVsMeshCallback +{ + IntersectCapsuleVsMeshCallback(const PxMat33& m, LimitedResults* r, bool flipNormal) : IntersectShapeVsMeshCallback(m, r, flipNormal) {} + virtual ~IntersectCapsuleVsMeshCallback(){} + + Capsule mLocalCapsule; // PT: capsule in mesh/local space + CapsuleTriangleOverlapData mParams; + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& aHit, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2, PxReal&, const PxU32*) + { + bool hit; + if(tScaleIsIdentity) + { + const PxVec3 normal = (av0 - av1).cross(av0 - av2); + hit = intersectCapsuleTriangle(normal, av0, av1, av2, mLocalCapsule, mParams); + } + else + { + const PxVec3 v0 = mVertexToShapeSkew * av0; + const PxVec3 v1 = mVertexToShapeSkew * (mFlipNormal ? av2 : av1); + const PxVec3 v2 = mVertexToShapeSkew * (mFlipNormal ? av1 : av2); + const PxVec3 normal = (v0 - v1).cross(v0 - v2); + hit = intersectCapsuleTriangle(normal, v0, v1, v2, mLocalCapsule, mParams); + } + return recordHit(aHit, hit); + } +}; + +template +struct IntersectBoxVsMeshCallback : IntersectShapeVsMeshCallback +{ + IntersectBoxVsMeshCallback(const PxMat33& m, LimitedResults* r, bool flipNormal) : IntersectShapeVsMeshCallback(m, r, flipNormal) {} + virtual ~IntersectBoxVsMeshCallback(){} + + PxMat34 mVertexToBox; + PxVec3p mBoxExtents, mBoxCenter; + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& aHit, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2, PxReal&, const PxU32*) + { + PxVec3p v0, v1, v2; + if(tScaleIsIdentity) + { + v0 = mVertexToShapeSkew * av0; // transform from skewed mesh vertex to box space, + v1 = mVertexToShapeSkew * av1; // this includes inverse skew, inverse mesh shape transform and inverse box basis + v2 = mVertexToShapeSkew * av2; + } + else + { + v0 = mVertexToBox.transform(av0); + v1 = mVertexToBox.transform(mFlipNormal ? av2 : av1); + v2 = mVertexToBox.transform(mFlipNormal ? av1 : av2); + } + + // PT: this one is safe because we're using PxVec3p for all parameters + const PxIntBool hit = intersectTriangleBox_Unsafe(mBoxCenter, mBoxExtents, v0, v1, v2); + return recordHit(aHit, hit); + } +}; +} + +#if PX_VC + #pragma warning(pop) +#endif + +template +static bool intersectAnyVsMeshT( + const Sphere* worldSphere, const Capsule* worldCapsule, const Box* worldOBB, + const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, + LimitedResults* results) +{ + const bool flipNormal = meshScale.hasNegativeDeterminant(); + PxMat33 shapeToVertexSkew, vertexToShapeSkew; + if (!idtMeshScale && tSCB != eBOX) + { + vertexToShapeSkew = toMat33(meshScale); + shapeToVertexSkew = vertexToShapeSkew.getInverse(); + } + + if (tSCB == eSPHERE) + { + IntersectSphereVsMeshCallback callback(vertexToShapeSkew, results, flipNormal); + // transform sphere center from world to mesh shape space + const PxVec3 center = meshTransform.transformInv(worldSphere->center); + + // callback will transform verts + callback.mLocalCenter = center; + callback.mMinDist2 = worldSphere->radius*worldSphere->radius; + + PxVec3 sweepOrigin, sweepDir, sweepExtents; + PxReal sweepLen; + if (!idtMeshScale) + { + // AP: compute a swept AABB around an OBB around a skewed sphere + // TODO: we could do better than an AABB around OBB actually because we can slice off the corners.. + const Box worldOBB_(worldSphere->center, PxVec3(worldSphere->radius), PxMat33(PxIdentity)); + Box vertexOBB; + computeVertexSpaceOBB(vertexOBB, worldOBB_, meshTransform, meshScale); + computeSweptAABBAroundOBB(vertexOBB, sweepOrigin, sweepExtents, sweepDir, sweepLen); + } else + { + sweepOrigin = center; + sweepDir = PxVec3(1.0f,0,0); + sweepLen = 0.0f; + sweepExtents = PxVec3(PxMax(worldSphere->radius, GU_MIN_AABB_EXTENT)); + } + + MeshRayCollider::collide<1, 1>(sweepOrigin, sweepDir, sweepLen, true, static_cast(&triMesh), callback, &sweepExtents); + + return callback.mAnyHits; + } + else if (tSCB == eCAPSULE) + { + IntersectCapsuleVsMeshCallback callback(vertexToShapeSkew, results, flipNormal); + const PxF32 radius = worldCapsule->radius; + + // transform world capsule to mesh shape space + callback.mLocalCapsule.p0 = meshTransform.transformInv(worldCapsule->p0); + callback.mLocalCapsule.p1 = meshTransform.transformInv(worldCapsule->p1); + callback.mLocalCapsule.radius = radius; + callback.mParams.init(callback.mLocalCapsule); + + if (idtMeshScale) + { + // traverse a sweptAABB around the capsule + const PxVec3 radius3(radius); + MeshRayCollider::collide<1, 0>(callback.mLocalCapsule.p0, callback.mLocalCapsule.p1-callback.mLocalCapsule.p0, 1.0f, true, static_cast(&triMesh), callback, &radius3); + } + else + { + // make vertex space OBB + Box vertexOBB; + Box worldOBB_; + worldOBB_.create(*worldCapsule); // AP: potential optimization (meshTransform.inverse is already in callback.mCapsule) + computeVertexSpaceOBB(vertexOBB, worldOBB_, meshTransform, meshScale); + + MeshRayCollider::collideOBB(vertexOBB, true, static_cast(&triMesh), callback); + } + return callback.mAnyHits; + } + else if (tSCB == eBOX) + { + Box vertexOBB; // query box in vertex space + if (idtMeshScale) + { + // mesh scale is identity - just inverse transform the box without optimization + vertexOBB = transformBoxOrthonormal(*worldOBB, meshTransform.getInverse()); + // mesh vertices will be transformed from skewed vertex space directly to box AABB space + // box inverse rotation is baked into the vertexToShapeSkew transform + // if meshScale is not identity, vertexOBB already effectively includes meshScale transform + PxVec3 boxCenter; + getInverse(vertexToShapeSkew, boxCenter, vertexOBB.rot, vertexOBB.center); + IntersectBoxVsMeshCallback callback(vertexToShapeSkew, results, flipNormal); + + callback.mBoxCenter = -boxCenter; + callback.mBoxExtents = worldOBB->extents; // extents do not change + + MeshRayCollider::collideOBB(vertexOBB, true, static_cast(&triMesh), callback); + + return callback.mAnyHits; + } else + { + computeVertexSpaceOBB(vertexOBB, *worldOBB, meshTransform, meshScale); + + // mesh scale needs to be included - inverse transform and optimize the box + const PxMat33 vertexToWorldSkew_Rot = PxMat33Padded(meshTransform.q) * toMat33(meshScale); + const PxVec3& vertexToWorldSkew_Trans = meshTransform.p; + + PxMat34 tmp; + buildMatrixFromBox(tmp, *worldOBB); + const PxMat34 inv = tmp.getInverseRT(); + const PxMat34 _vertexToWorldSkew(vertexToWorldSkew_Rot, vertexToWorldSkew_Trans); + + IntersectBoxVsMeshCallback callback(vertexToShapeSkew, results, flipNormal); + callback.mVertexToBox = inv * _vertexToWorldSkew; + callback.mBoxCenter = PxVec3(0.0f); + callback.mBoxExtents = worldOBB->extents; // extents do not change + + MeshRayCollider::collideOBB(vertexOBB, true, static_cast(&triMesh), callback); + + return callback.mAnyHits; + } + } + else + { + PX_ASSERT(0); + return false; + } +} + +template +static bool intersectAnyVsMesh( + const Sphere* worldSphere, const Capsule* worldCapsule, const Box* worldOBB, + const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, + LimitedResults* results) +{ + PX_ASSERT(triMesh.getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH33); + if (meshScale.isIdentity()) + return intersectAnyVsMeshT(worldSphere, worldCapsule, worldOBB, triMesh, meshTransform, meshScale, results); + else + return intersectAnyVsMeshT(worldSphere, worldCapsule, worldOBB, triMesh, meshTransform, meshScale, results); +} + +bool physx::Gu::intersectSphereVsMesh_RTREE(const Sphere& sphere, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + return intersectAnyVsMesh(&sphere, NULL, NULL, triMesh, meshTransform, meshScale, results); +} + +bool physx::Gu::intersectBoxVsMesh_RTREE(const Box& box, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + return intersectAnyVsMesh(NULL, NULL, &box, triMesh, meshTransform, meshScale, results); +} + +bool physx::Gu::intersectCapsuleVsMesh_RTREE(const Capsule& capsule, const TriangleMesh& triMesh, const PxTransform& meshTransform, const PxMeshScale& meshScale, LimitedResults* results) +{ + return intersectAnyVsMesh(NULL, &capsule, NULL, triMesh, meshTransform, meshScale, results); +} + +void physx::Gu::intersectOBB_RTREE(const TriangleMesh* mesh, const Box& obb, MeshHitCallback& callback, bool bothTriangleSidesCollide, bool checkObbIsAligned) +{ + MeshRayCollider::collideOBB(obb, bothTriangleSidesCollide, static_cast(mesh), callback, checkObbIsAligned); +} + +// PT: TODO: refactor/share bits of this +bool physx::Gu::sweepCapsule_MeshGeom_RTREE(const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Capsule& lss, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH33); + const RTreeTriangleMesh* meshData = static_cast(mesh); + + const Capsule inflatedCapsule(lss.p0, lss.p1, lss.radius + inflation); + + const bool isIdentity = triMeshGeom.scale.isIdentity(); + bool isDoubleSided = (triMeshGeom.meshFlags & PxMeshGeometryFlag::eDOUBLE_SIDED); + const PxU32 meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + + // compute sweptAABB + const PxVec3 localP0 = pose.transformInv(inflatedCapsule.p0); + const PxVec3 localP1 = pose.transformInv(inflatedCapsule.p1); + PxVec3 sweepOrigin = (localP0+localP1)*0.5f; + PxVec3 sweepDir = pose.rotateInv(unitDir); + PxVec3 sweepExtents = PxVec3(inflatedCapsule.radius) + (localP0-localP1).abs()*0.5f; + PxReal distance1 = distance; + PxReal distCoeff = 1.0f; + PxMat34 poseWithScale; + if(!isIdentity) + { + poseWithScale = pose * triMeshGeom.scale; + distance1 = computeSweepData(triMeshGeom, sweepOrigin, sweepExtents, sweepDir, distance); + distCoeff = distance1 / distance; + } else + poseWithScale = Matrix34FromTransform(pose); + + SweepCapsuleMeshHitCallback callback(sweepHit, poseWithScale, distance, isDoubleSided, inflatedCapsule, unitDir, hitFlags, triMeshGeom.scale.hasNegativeDeterminant(), distCoeff); + + MeshRayCollider::collide<1, 1>(sweepOrigin, sweepDir, distance1, true, meshData, callback, &sweepExtents); + + if(meshBothSides) + isDoubleSided = true; + + return callback.finalizeHit(sweepHit, inflatedCapsule, triMeshGeom, pose, isDoubleSided); +} + +#include "GuSweepSharedTests.h" + +// PT: TODO: refactor/share bits of this +bool physx::Gu::sweepBox_MeshGeom_RTREE(const TriangleMesh* mesh, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const Box& box, const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& sweepHit, PxHitFlags hitFlags, const PxReal inflation) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH33); + const RTreeTriangleMesh* meshData = static_cast(mesh); + + const bool isIdentity = triMeshGeom.scale.isIdentity(); + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool isDoubleSided = triMeshGeom.meshFlags & PxMeshGeometryFlag::eDOUBLE_SIDED; + + PxMat34 meshToWorldSkew; + PxVec3 sweptAABBMeshSpaceExtents, meshSpaceOrigin, meshSpaceDir; + + // Input sweep params: geom, pose, box, unitDir, distance + // We convert the origin from world space to mesh local space + // and convert the box+pose to mesh space AABB + if(isIdentity) + { + meshToWorldSkew = Matrix34FromTransform(pose); + const PxMat33Padded worldToMeshRot(pose.q.getConjugate()); // extract rotation matrix from pose.q + meshSpaceOrigin = worldToMeshRot.transform(box.center - pose.p); + meshSpaceDir = worldToMeshRot.transform(unitDir) * distance; + PxMat33 boxToMeshRot = worldToMeshRot * box.rot; + sweptAABBMeshSpaceExtents = boxToMeshRot.column0.abs() * box.extents.x + + boxToMeshRot.column1.abs() * box.extents.y + + boxToMeshRot.column2.abs() * box.extents.z; + } + else + { + meshToWorldSkew = pose * triMeshGeom.scale; + const PxMat33 meshToWorldSkew_Rot = PxMat33Padded(pose.q) * toMat33(triMeshGeom.scale); + const PxVec3& meshToWorldSkew_Trans = pose.p; + + PxMat33 worldToVertexSkew_Rot; + PxVec3 worldToVertexSkew_Trans; + getInverse(worldToVertexSkew_Rot, worldToVertexSkew_Trans, meshToWorldSkew_Rot, meshToWorldSkew_Trans); + + //make vertex space OBB + Box vertexSpaceBox1; + const PxMat34 worldToVertexSkew(worldToVertexSkew_Rot, worldToVertexSkew_Trans); + vertexSpaceBox1 = transform(worldToVertexSkew, box); + // compute swept aabb + sweptAABBMeshSpaceExtents = vertexSpaceBox1.computeAABBExtent(); + + meshSpaceOrigin = worldToVertexSkew.transform(box.center); + meshSpaceDir = worldToVertexSkew.rotate(unitDir*distance); // also applies scale to direction/length + } + + sweptAABBMeshSpaceExtents += PxVec3(inflation); // inflate the bounds with additive inflation + sweptAABBMeshSpaceExtents *= 1.01f; // fatten the bounds to account for numerical discrepancies + + PxReal dirLen = PxMax(meshSpaceDir.magnitude(), 1e-5f); + PxReal distCoeff = 1.0f; + if (!isIdentity) + distCoeff = dirLen / distance; + + // Move to AABB space + PxMat34 worldToBox; + computeWorldToBoxMatrix(worldToBox, box); + + const bool bothTriangleSidesCollide = isDoubleSided || meshBothSides; + + const PxMat34Padded meshToBox = worldToBox*meshToWorldSkew; + const PxTransform boxTransform = box.getTransform(); + + const PxVec3 localDir = worldToBox.rotate(unitDir); + const PxVec3 localDirDist = localDir*distance; + SweepBoxMeshHitCallback callback( // using eMULTIPLE with shrinkMaxT + CallbackMode::eMULTIPLE, meshToBox, distance, bothTriangleSidesCollide, box, localDirDist, localDir, unitDir, hitFlags, inflation, triMeshGeom.scale.hasNegativeDeterminant(), distCoeff); + + MeshRayCollider::collide<1, 1>(meshSpaceOrigin, meshSpaceDir/dirLen, dirLen, bothTriangleSidesCollide, meshData, callback, &sweptAABBMeshSpaceExtents); + + return callback.finalizeHit(sweepHit, triMeshGeom, pose, boxTransform, localDir, meshBothSides, isDoubleSided); +} + +#include "GuInternal.h" +void physx::Gu::sweepConvex_MeshGeom_RTREE(const TriangleMesh* mesh, const Box& hullBox, const PxVec3& localDir, const PxReal distance, SweepConvexMeshHitCallback& callback, bool) +{ + PX_ASSERT(mesh->getConcreteType()==PxConcreteType::eTRIANGLE_MESH_BVH33); + const RTreeTriangleMesh* meshData = static_cast(mesh); + + // create temporal bounds + Box querySweptBox; + computeSweptBox(querySweptBox, hullBox.extents, hullBox.center, hullBox.rot, localDir, distance); + + MeshRayCollider::collideOBB(querySweptBox, true, meshData, callback); +} + +void physx::Gu::pointMeshDistance_RTREE(const TriangleMesh*, const PxTriangleMeshGeometry&, const PxTransform&, const PxVec3&, float, PxU32&, float&, PxVec3&) +{ + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Point-mesh distance query not supported for BVH33. Please use a BVH34 mesh.\n"); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp new file mode 100644 index 0000000..3dd88d0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuOverlapTestsMesh.cpp @@ -0,0 +1,277 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxSphereGeometry.h" +#include "GuMidphaseInterface.h" +#include "CmScaling.h" +#include "GuSphere.h" +#include "GuInternal.h" +#include "GuConvexUtilsInternal.h" +#include "GuVecTriangle.h" +#include "GuVecConvexHull.h" +#include "GuConvexMesh.h" +#include "GuGJK.h" +#include "GuSweepSharedTests.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; +using namespace physx::aos; + +bool GeomOverlapCallback_SphereMesh(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eSPHERE); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + const Sphere worldSphere(pose0.p, sphereGeom.radius); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + return Midphase::intersectSphereVsMesh(worldSphere, *meshData, pose1, meshGeom.scale, NULL); +} + +bool GeomOverlapCallback_CapsuleMesh(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCAPSULE); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxCapsuleGeometry& capsuleGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + Capsule capsule; + getCapsule(capsule, capsuleGeom, pose0); + return Midphase::intersectCapsuleVsMesh(capsule, *meshData, pose1, meshGeom.scale, NULL); +} + +bool GeomOverlapCallback_BoxMesh(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eBOX); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxBoxGeometry& boxGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + Box box; + buildFrom(box, pose0.p, boxGeom.halfExtents, pose0.q); + return Midphase::intersectBoxVsMesh(box, *meshData, pose1, meshGeom.scale, NULL); +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ +struct ConvexVsMeshOverlapCallback : MeshHitCallback +{ + PxMatTransformV MeshToBoxV; + Vec3V boxExtents; + + ConvexVsMeshOverlapCallback( + const ConvexMesh& cm, const PxMeshScale& convexScale, const FastVertex2ShapeScaling& meshScale, + const PxTransform& tr0, const PxTransform& tr1, bool identityScale, const Box& meshSpaceOBB) + : + MeshHitCallback(CallbackMode::eMULTIPLE), + mAnyHit (false), + mIdentityScale (identityScale) + { + if (!identityScale) // not done in initializer list for performance + mMeshScale = aos::Mat33V( + V3LoadU(meshScale.getVertex2ShapeSkew().column0), + V3LoadU(meshScale.getVertex2ShapeSkew().column1), + V3LoadU(meshScale.getVertex2ShapeSkew().column2) ); + using namespace aos; + + const ConvexHullData* hullData = &cm.getHull(); + + const Vec3V vScale0 = V3LoadU_SafeReadW(convexScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat0 = QuatVLoadU(&convexScale.rotation.x); + + mConvex = ConvexHullV(hullData, V3Zero(), vScale0, vQuat0, convexScale.isIdentity()); + aToB = PxMatTransformV(tr0.transformInv(tr1)); + + { + // Move to AABB space + PxMat34 MeshToBox; + computeWorldToBoxMatrix(MeshToBox, meshSpaceOBB); + + const Vec3V base0 = V3LoadU(MeshToBox.m.column0); + const Vec3V base1 = V3LoadU(MeshToBox.m.column1); + const Vec3V base2 = V3LoadU(MeshToBox.m.column2); + const Mat33V matV(base0, base1, base2); + const Vec3V p = V3LoadU(MeshToBox.p); + MeshToBoxV = PxMatTransformV(p, matV); + boxExtents = V3LoadU(meshSpaceOBB.extents+PxVec3(0.001f)); + } + } + virtual ~ConvexVsMeshOverlapCallback() {} + + virtual PxAgain processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit&, const PxVec3& v0a, const PxVec3& v1a, const PxVec3& v2a, PxReal&, const PxU32*) + { + using namespace aos; + Vec3V v0 = V3LoadU(v0a); + Vec3V v1 = V3LoadU(v1a); + Vec3V v2 = V3LoadU(v2a); + + // test triangle AABB in box space vs box AABB in box local space + { + const Vec3V triV0 = MeshToBoxV.transform(v0); // AP: MeshToBoxV already includes mesh scale so we have to use unscaled verts here + const Vec3V triV1 = MeshToBoxV.transform(v1); + const Vec3V triV2 = MeshToBoxV.transform(v2); + const Vec3V triMn = V3Min(V3Min(triV0, triV1), triV2); + const Vec3V triMx = V3Max(V3Max(triV0, triV1), triV2); + const Vec3V negExtents = V3Neg(boxExtents); + const BoolV minSeparated = V3IsGrtr(triMn, boxExtents), maxSeparated = V3IsGrtr(negExtents, triMx); + const BoolV bSeparated = BAnyTrue3(BOr(minSeparated, maxSeparated)); + if(BAllEqTTTT(bSeparated)) + return true; // continue traversal + } + + if(!mIdentityScale) + { + v0 = M33MulV3(mMeshScale, v0); + v1 = M33MulV3(mMeshScale, v1); + v2 = M33MulV3(mMeshScale, v2); + } + + TriangleV triangle(v0, v1, v2); + Vec3V contactA, contactB, normal; + FloatV dist; + const RelativeConvex convexA(triangle, aToB); + const LocalConvex convexB(mConvex); + const GjkStatus status = gjk(convexA, convexB, aToB.p, FZero(), contactA, contactB, normal, dist); + if(status == GJK_CONTACT || status == GJK_CLOSE)// || FAllGrtrOrEq(mSqTolerance, sqDist)) + { + mAnyHit = true; + return false; // abort traversal + } + return true; // continue traversal + } + + ConvexHullV mConvex; + PxMatTransformV aToB; + aos::Mat33V mMeshScale; + bool mAnyHit; + const bool mIdentityScale; + +private: + ConvexVsMeshOverlapCallback& operator=(const ConvexVsMeshOverlapCallback&); +}; +} + +// PT: TODO: refactor bits of this with convex-vs-mesh code +bool GeomOverlapCallback_ConvexMesh(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eCONVEXMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom1); + + ConvexMesh* cm = static_cast(convexGeom.convexMesh); + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + const bool idtScaleMesh = meshGeom.scale.isIdentity(); + + FastVertex2ShapeScaling convexScaling; + if (!idtScaleConvex) + convexScaling.init(convexGeom.scale); + + FastVertex2ShapeScaling meshScaling; + if (!idtScaleMesh) + meshScaling.init(meshGeom.scale); + + PX_ASSERT(!cm->getLocalBoundsFast().isEmpty()); + const PxBounds3 hullAABB = cm->getLocalBoundsFast().transformFast(convexScaling.getVertex2ShapeSkew()); + + Box hullOBB; + { + const Matrix34FromTransform world0(pose0); + const Matrix34FromTransform world1(pose1); + computeHullOBB(hullOBB, hullAABB, 0.0f, world0, world1, meshScaling, idtScaleMesh); + } + + ConvexVsMeshOverlapCallback cb(*cm, convexGeom.scale, meshScaling, pose0, pose1, idtScaleMesh, hullOBB); + Midphase::intersectOBB(meshData, hullOBB, cb, true, false); + + return cb.mAnyHit; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool GeomOverlapCallback_MeshMesh(GU_OVERLAP_FUNC_PARAMS) +{ + PX_ASSERT(geom0.getType()==PxGeometryType::eTRIANGLEMESH); + PX_ASSERT(geom1.getType()==PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(cache); + PX_UNUSED(threadContext); + + const PxTriangleMeshGeometry& meshGeom0 = static_cast(geom0); + const PxTriangleMeshGeometry& meshGeom1 = static_cast(geom1); + + const TriangleMesh* tm0 = static_cast(meshGeom0.triangleMesh); + const TriangleMesh* tm1 = static_cast(meshGeom1.triangleMesh); + + // PT: only implemented for BV4 + if(!tm0 || !tm1 || tm0->getConcreteType()!=PxConcreteType::eTRIANGLE_MESH_BVH34 || tm1->getConcreteType()!=PxConcreteType::eTRIANGLE_MESH_BVH34) + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxGeometryQuery::overlap(): only available between two BVH34 triangles meshes."); + + class AnyHitReportCallback : public PxReportCallback + { + public: + AnyHitReportCallback() + { + mCapacity = 1; + } + + virtual bool flushResults(PxU32, const PxGeomIndexPair*) + { + return false; + } + }; + + AnyHitReportCallback callback; + + // PT: ...so we don't need a table like for the other ops, just go straight to BV4 + return intersectMeshVsMesh_BV4(callback, *tm0, *tm1, pose0, pose1, meshGeom0.scale, meshGeom1.scale, PxMeshMeshQueryFlag::eDEFAULT); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp new file mode 100644 index 0000000..97b9a7e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.cpp @@ -0,0 +1,407 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#define RTREE_TEXT_DUMP_ENABLE 0 +#if PX_P64_FAMILY +#define RTREE_PAGES_PER_POOL_SLAB 16384 // preallocate all pages in first batch to make sure we stay within 32 bits for relative pointers.. this is 2 megs +#else +#define RTREE_PAGES_PER_POOL_SLAB 128 +#endif + +#define INSERT_SCAN_LOOKAHEAD 1 // enable one level lookahead scan for determining which child page is best to insert a node into + +#define RTREE_INFLATION_EPSILON 5e-4f + +#include "GuRTree.h" +#include "foundation/PxSort.h" +#include "CmSerialize.h" +#include "CmUtils.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace aos; +using namespace Gu; +using namespace Cm; + +namespace physx +{ +namespace Gu { + +bool RTree::load(PxInputStream& stream, PxU32 meshVersion, bool mismatch_) // PT: 'meshVersion' is the PX_MESH_VERSION from cooked file +{ + PX_UNUSED(meshVersion); + + release(); + + PxI8 a, b, c, d; + readChunk(a, b, c, d, stream); + if(a!='R' || b!='T' || c!='R' || d!='E') + return false; + + bool mismatch; + PxU32 fileVersion; + if(!readBigEndianVersionNumber(stream, mismatch_, fileVersion, mismatch)) + return false; + + readFloatBuffer(&mBoundsMin.x, 4, mismatch, stream); + readFloatBuffer(&mBoundsMax.x, 4, mismatch, stream); + readFloatBuffer(&mInvDiagonal.x, 4, mismatch, stream); + readFloatBuffer(&mDiagonalScaler.x, 4, mismatch, stream); + mPageSize = readDword(mismatch, stream); + mNumRootPages = readDword(mismatch, stream); + mNumLevels = readDword(mismatch, stream); + mTotalNodes = readDword(mismatch, stream); + mTotalPages = readDword(mismatch, stream); + PxU32 unused = readDword(mismatch, stream); PX_UNUSED(unused); // backwards compatibility + mPages = static_cast(PxAlignedAllocator<128>().allocate(sizeof(RTreePage)*mTotalPages, PX_FL)); + PxMarkSerializedMemory(mPages, sizeof(RTreePage)*mTotalPages); + for(PxU32 j=0; jnodeCount(); + PX_ASSERT(nc > 0 && nc <= RTREE_N); + // old version pointer, up to PX_MESH_VERSION 8 + PxU32 ptr = (rightMostPage->ptrs[nc-1]) * multiplier; + PX_ASSERT(ptr % sizeof(RTreePage) == 0); + const RTreePage* rightMostPageNext = mPages + (ptr / sizeof(RTreePage)); + curCount = PxU32(rightMostPageNext - rightMostPage); + rightMostPage = rightMostPageNext; + } + + return mTotalPages - topCount; +} + +///////////////////////////////////////////////////////////////////////// +RTree::RTree(const PxEMPTY) +{ + mFlags |= USER_ALLOCATED; +} + + +// PX_SERIALIZATION +///////////////////////////////////////////////////////////////////////// +void RTree::exportExtraData(PxSerializationContext& stream) +{ + stream.alignData(128); + stream.writeData(mPages, mTotalPages*sizeof(RTreePage)); +} + +///////////////////////////////////////////////////////////////////////// +void RTree::importExtraData(PxDeserializationContext& context) +{ + context.alignExtraData(128); + mPages = context.readExtraData(mTotalPages); +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE PxU32 RTreePage::nodeCount() const +{ + for (int j = 0; j < RTREE_N; j ++) + if (minx[j] == MX) + return PxU32(j); + + return RTREE_N; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::clearNode(PxU32 nodeIndex) +{ + PX_ASSERT(nodeIndex < RTREE_N); + minx[nodeIndex] = miny[nodeIndex] = minz[nodeIndex] = MX; // initialize empty node with sentinels + maxx[nodeIndex] = maxy[nodeIndex] = maxz[nodeIndex] = MN; + ptrs[nodeIndex] = 0; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::getNode(const PxU32 nodeIndex, RTreeNodeQ& r) const +{ + PX_ASSERT(nodeIndex < RTREE_N); + r.minx = minx[nodeIndex]; + r.miny = miny[nodeIndex]; + r.minz = minz[nodeIndex]; + r.maxx = maxx[nodeIndex]; + r.maxy = maxy[nodeIndex]; + r.maxz = maxz[nodeIndex]; + r.ptr = ptrs[nodeIndex]; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::setEmpty(PxU32 startIndex) +{ + PX_ASSERT(startIndex < RTREE_N); + for (PxU32 j = startIndex; j < RTREE_N; j ++) + clearNode(j); +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::computeBounds(RTreeNodeQ& newBounds) +{ + RTreeValue _minx = MX, _miny = MX, _minz = MX, _maxx = MN, _maxy = MN, _maxz = MN; + for (PxU32 j = 0; j < RTREE_N; j++) + { + if (isEmpty(j)) + continue; + _minx = PxMin(_minx, minx[j]); + _miny = PxMin(_miny, miny[j]); + _minz = PxMin(_minz, minz[j]); + _maxx = PxMax(_maxx, maxx[j]); + _maxy = PxMax(_maxy, maxy[j]); + _maxz = PxMax(_maxz, maxz[j]); + } + newBounds.minx = _minx; + newBounds.miny = _miny; + newBounds.minz = _minz; + newBounds.maxx = _maxx; + newBounds.maxy = _maxy; + newBounds.maxz = _maxz; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::adjustChildBounds(PxU32 index, const RTreeNodeQ& adjChild) +{ + PX_ASSERT(index < RTREE_N); + minx[index] = adjChild.minx; + miny[index] = adjChild.miny; + minz[index] = adjChild.minz; + maxx[index] = adjChild.maxx; + maxy[index] = adjChild.maxy; + maxz[index] = adjChild.maxz; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::growChildBounds(PxU32 index, const RTreeNodeQ& child) +{ + PX_ASSERT(index < RTREE_N); + minx[index] = PxMin(minx[index], child.minx); + miny[index] = PxMin(miny[index], child.miny); + minz[index] = PxMin(minz[index], child.minz); + maxx[index] = PxMax(maxx[index], child.maxx); + maxy[index] = PxMax(maxy[index], child.maxy); + maxz[index] = PxMax(maxz[index], child.maxz); +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::copyNode(PxU32 targetIndex, const RTreePage& sourcePage, PxU32 sourceIndex) +{ + PX_ASSERT(targetIndex < RTREE_N); + PX_ASSERT(sourceIndex < RTREE_N); + minx[targetIndex] = sourcePage.minx[sourceIndex]; + miny[targetIndex] = sourcePage.miny[sourceIndex]; + minz[targetIndex] = sourcePage.minz[sourceIndex]; + maxx[targetIndex] = sourcePage.maxx[sourceIndex]; + maxy[targetIndex] = sourcePage.maxy[sourceIndex]; + maxz[targetIndex] = sourcePage.maxz[sourceIndex]; + ptrs[targetIndex] = sourcePage.ptrs[sourceIndex]; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreePage::setNode(PxU32 targetIndex, const RTreeNodeQ& sourceNode) +{ + PX_ASSERT(targetIndex < RTREE_N); + minx[targetIndex] = sourceNode.minx; + miny[targetIndex] = sourceNode.miny; + minz[targetIndex] = sourceNode.minz; + maxx[targetIndex] = sourceNode.maxx; + maxy[targetIndex] = sourceNode.maxy; + maxz[targetIndex] = sourceNode.maxz; + ptrs[targetIndex] = sourceNode.ptr; +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreeNodeQ::grow(const RTreePage& page, int nodeIndex) +{ + PX_ASSERT(nodeIndex < RTREE_N); + minx = PxMin(minx, page.minx[nodeIndex]); + miny = PxMin(miny, page.miny[nodeIndex]); + minz = PxMin(minz, page.minz[nodeIndex]); + maxx = PxMax(maxx, page.maxx[nodeIndex]); + maxy = PxMax(maxy, page.maxy[nodeIndex]); + maxz = PxMax(maxz, page.maxz[nodeIndex]); +} + +///////////////////////////////////////////////////////////////////////// +PX_FORCE_INLINE void RTreeNodeQ::grow(const RTreeNodeQ& node) +{ + minx = PxMin(minx, node.minx); miny = PxMin(miny, node.miny); minz = PxMin(minz, node.minz); + maxx = PxMax(maxx, node.maxx); maxy = PxMax(maxy, node.maxy); maxz = PxMax(maxz, node.maxz); +} + +///////////////////////////////////////////////////////////////////////// +void RTree::validateRecursive(PxU32 level, RTreeNodeQ parentBounds, RTreePage* page, CallbackRefit* cbLeaf) +{ + PX_UNUSED(parentBounds); + + static PxU32 validateCounter = 0; // this is to suppress a warning that recursive call has no side effects + validateCounter++; + + RTreeNodeQ n; + PxU32 pageNodeCount = page->nodeCount(); + for (PxU32 j = 0; j < pageNodeCount; j++) + { + page->getNode(j, n); + if (page->isEmpty(j)) + continue; + PX_ASSERT(n.minx >= parentBounds.minx); PX_ASSERT(n.miny >= parentBounds.miny); PX_ASSERT(n.minz >= parentBounds.minz); + PX_ASSERT(n.maxx <= parentBounds.maxx); PX_ASSERT(n.maxy <= parentBounds.maxy); PX_ASSERT(n.maxz <= parentBounds.maxz); + if (!n.isLeaf()) + { + PX_ASSERT((n.ptr&1) == 0); + RTreePage* childPage = reinterpret_cast(size_t(mPages) + n.ptr); + validateRecursive(level+1, n, childPage, cbLeaf); + } else if (cbLeaf) + { + Vec3V mnv, mxv; + cbLeaf->recomputeBounds(page->ptrs[j] & ~1, mnv, mxv); + PxVec3 mn3, mx3; V3StoreU(mnv, mn3); V3StoreU(mxv, mx3); + const PxBounds3 lb(mn3, mx3); + const PxVec3& mn = lb.minimum; const PxVec3& mx = lb.maximum; PX_UNUSED(mn); PX_UNUSED(mx); + PX_ASSERT(mn.x >= n.minx); PX_ASSERT(mn.y >= n.miny); PX_ASSERT(mn.z >= n.minz); + PX_ASSERT(mx.x <= n.maxx); PX_ASSERT(mx.y <= n.maxy); PX_ASSERT(mx.z <= n.maxz); + } + } + RTreeNodeQ recomputedBounds; + page->computeBounds(recomputedBounds); + PX_ASSERT((recomputedBounds.minx - parentBounds.minx)<=RTREE_INFLATION_EPSILON); + PX_ASSERT((recomputedBounds.miny - parentBounds.miny)<=RTREE_INFLATION_EPSILON); + PX_ASSERT((recomputedBounds.minz - parentBounds.minz)<=RTREE_INFLATION_EPSILON); + PX_ASSERT((recomputedBounds.maxx - parentBounds.maxx)<=RTREE_INFLATION_EPSILON); + PX_ASSERT((recomputedBounds.maxy - parentBounds.maxy)<=RTREE_INFLATION_EPSILON); + PX_ASSERT((recomputedBounds.maxz - parentBounds.maxz)<=RTREE_INFLATION_EPSILON); +} + +///////////////////////////////////////////////////////////////////////// +void RTree::validate(CallbackRefit* cbLeaf) +{ + for (PxU32 j = 0; j < mNumRootPages; j++) + { + RTreeNodeQ rootBounds; + mPages[j].computeBounds(rootBounds); + validateRecursive(0, rootBounds, mPages+j, cbLeaf); + } +} + +void RTree::refitAllStaticTree(CallbackRefit& cb, PxBounds3* retBounds) +{ + PxU8* treeNodes8 = reinterpret_cast(mPages); + + // since pages are ordered we can scan back to front and the hierarchy will be updated + for (PxI32 iPage = PxI32(mTotalPages)-1; iPage>=0; iPage--) + { + RTreePage& page = mPages[iPage]; + for (PxU32 j = 0; j < RTREE_N; j++) + { + if (page.isEmpty(j)) + continue; + if (page.isLeaf(j)) + { + Vec3V childMn, childMx; + cb.recomputeBounds(page.ptrs[j]-1, childMn, childMx); // compute the bound around triangles + PxVec3 mn3, mx3; + V3StoreU(childMn, mn3); + V3StoreU(childMx, mx3); + page.minx[j] = mn3.x; page.miny[j] = mn3.y; page.minz[j] = mn3.z; + page.maxx[j] = mx3.x; page.maxy[j] = mx3.y; page.maxz[j] = mx3.z; + } else + { + const RTreePage* child = reinterpret_cast(treeNodes8 + page.ptrs[j]); + PX_COMPILE_TIME_ASSERT(RTREE_N == 4); + bool first = true; + for (PxU32 k = 0; k < RTREE_N; k++) + { + if (child->isEmpty(k)) + continue; + if (first) + { + page.minx[j] = child->minx[k]; page.miny[j] = child->miny[k]; page.minz[j] = child->minz[k]; + page.maxx[j] = child->maxx[k]; page.maxy[j] = child->maxy[k]; page.maxz[j] = child->maxz[k]; + first = false; + } else + { + page.minx[j] = PxMin(page.minx[j], child->minx[k]); + page.miny[j] = PxMin(page.miny[j], child->miny[k]); + page.minz[j] = PxMin(page.minz[j], child->minz[k]); + page.maxx[j] = PxMax(page.maxx[j], child->maxx[k]); + page.maxy[j] = PxMax(page.maxy[j], child->maxy[k]); + page.maxz[j] = PxMax(page.maxz[j], child->maxz[k]); + } + } + } + } + } + + if (retBounds) + { + RTreeNodeQ bound1; + for (PxU32 ii = 0; iiminimum = PxVec3(bound1.minx, bound1.miny, bound1.minz); + retBounds->maximum = PxVec3(bound1.maxx, bound1.maxy, bound1.maxz); + } else + { + retBounds->minimum = retBounds->minimum.minimum(PxVec3(bound1.minx, bound1.miny, bound1.minz)); + retBounds->maximum = retBounds->maximum.maximum(PxVec3(bound1.maxx, bound1.maxy, bound1.maxz)); + } + } + } + +#if PX_CHECKED + validate(&cb); +#endif +} + +//~PX_SERIALIZATION +const RTreeValue RTreePage::MN = -PX_MAX_F32; +const RTreeValue RTreePage::MX = PX_MAX_F32; + +} // namespace Gu + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.h new file mode 100644 index 0000000..4f4f215 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTree.h @@ -0,0 +1,285 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_RTREE_H +#define GU_RTREE_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec4.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxAssert.h" +#include "common/PxSerialFramework.h" +#include "geometry/PxTriangleMesh.h" + +#include "foundation/PxUserAllocated.h" // for PxSerializationContext +#include "foundation/PxAlignedMalloc.h" + +#include "foundation/PxVecMath.h" + +#define RTREE_N 4 // changing this number will affect the mesh format +PX_COMPILE_TIME_ASSERT(RTREE_N == 4 || RTREE_N == 8); // using the low 5 bits for storage of index(childPtr) for dynamic rtree + +namespace physx +{ + + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +namespace Gu { + + class Box; + struct RTreePage; + + typedef PxF32 RTreeValue; + + ///////////////////////////////////////////////////////////////////////// + // quantized untransposed RTree node - used for offline build and dynamic insertion + struct RTreeNodeQ + { + RTreeValue minx, miny, minz, maxx, maxy, maxz; + PxU32 ptr; // lowest bit is leaf flag + + PX_FORCE_INLINE void setLeaf(bool set) { if (set) ptr |= 1; else ptr &= ~1; } + PX_FORCE_INLINE PxU32 isLeaf() const { return ptr & 1; } + PX_FORCE_INLINE void setEmpty(); + PX_FORCE_INLINE void grow(const RTreePage& page, int nodeIndex); + PX_FORCE_INLINE void grow(const RTreeNodeQ& node); + }; + + ///////////////////////////////////////////////////////////////////////// + // RTreePage data structure, holds RTREE_N transposed nodes + + // RTreePage data structure, holds 8 transposed nodes + PX_ALIGN_PREFIX(16) + struct RTreePage + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + static const RTreeValue MN, MX; + + RTreeValue minx[RTREE_N]; // [min=MX, max=MN] is used as a sentinel range for empty bounds + RTreeValue miny[RTREE_N]; + RTreeValue minz[RTREE_N]; + RTreeValue maxx[RTREE_N]; + RTreeValue maxy[RTREE_N]; + RTreeValue maxz[RTREE_N]; + PxU32 ptrs[RTREE_N]; // for static rtree this is an offset relative to the first page divided by 16, for dynamics it's an absolute pointer divided by 16 + + PX_FORCE_INLINE PxU32 nodeCount() const; // returns the number of occupied nodes in this page + PX_FORCE_INLINE void setEmpty(PxU32 startIndex = 0); + PX_FORCE_INLINE bool isEmpty(PxU32 index) const { return minx[index] > maxx[index]; } + PX_FORCE_INLINE void copyNode(PxU32 targetIndex, const RTreePage& sourcePage, PxU32 sourceIndex); + PX_FORCE_INLINE void setNode(PxU32 targetIndex, const RTreeNodeQ& node); + PX_FORCE_INLINE void clearNode(PxU32 nodeIndex); + PX_FORCE_INLINE void getNode(PxU32 nodeIndex, RTreeNodeQ& result) const; + PX_FORCE_INLINE void computeBounds(RTreeNodeQ& bounds); + PX_FORCE_INLINE void adjustChildBounds(PxU32 index, const RTreeNodeQ& adjustedChildBounds); + PX_FORCE_INLINE void growChildBounds(PxU32 index, const RTreeNodeQ& adjustedChildBounds); + PX_FORCE_INLINE PxU32 getNodeHandle(PxU32 index) const; + PX_FORCE_INLINE PxU32 isLeaf(PxU32 index) const { return ptrs[index] & 1; } + } PX_ALIGN_SUFFIX(16); + + ///////////////////////////////////////////////////////////////////////// + // RTree root data structure + PX_ALIGN_PREFIX(16) + struct RTree + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + // PX_SERIALIZATION + RTree(const PxEMPTY); + void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + PX_INLINE RTree(); // offline static rtree constructor used with cooking + + ~RTree() { release(); } + + PX_INLINE void release(); + bool load(PxInputStream& stream, PxU32 meshVersion, bool mismatch); + + //////////////////////////////////////////////////////////////////////////// + // QUERIES + struct Callback + { + // result buffer should have room for at least RTREE_N items + // should return true to continue traversal. If false is returned, traversal is aborted + virtual bool processResults(PxU32 count, PxU32* buf) = 0; + virtual void profile() {} + virtual ~Callback() {} + }; + + struct CallbackRaycast + { + // result buffer should have room for at least RTREE_N items + // should return true to continue traversal. If false is returned, traversal is aborted + // newMaxT serves as both input and output, as input it's the maxT so far + // set it to a new value (which should be smaller) and it will become the new far clip t + virtual bool processResults(PxU32 count, PxU32* buf, PxF32& newMaxT) = 0; + virtual ~CallbackRaycast() {} + }; + + // callback will be issued as soon as the buffer overflows maxResultsPerBlock-RTreePage:SIZE entries + // use maxResults = RTreePage:SIZE and return false from callback for "first hit" early out + void traverseAABB( + const PxVec3& boxMin, const PxVec3& boxMax, + const PxU32 maxResultsPerBlock, PxU32* resultsBlockBuf, Callback* processResultsBlockCallback) const; + void traverseOBB( + const Gu::Box& obb, + const PxU32 maxResultsPerBlock, PxU32* resultsBlockBuf, Callback* processResultsBlockCallback) const; + + template + void traverseRay( + const PxVec3& rayOrigin, const PxVec3& rayDir, // dir doesn't have to be normalized and is B-A for raySegment + const PxU32 maxResults, PxU32* resultsPtr, + Gu::RTree::CallbackRaycast* callback, + const PxVec3* inflateAABBs, // inflate tree's AABBs by this amount. This function turns into AABB sweep. + PxF32 maxT = PX_MAX_F32 // maximum ray t parameter, p(t)=origin+t*dir; use 1.0f for ray segment + ) const; + + struct CallbackRefit + { + // In this callback index is the number stored in the RTree, which is a LeafTriangles object for current PhysX mesh + virtual void recomputeBounds(PxU32 index, aos::Vec3V& mn, aos::Vec3V& mx) = 0; + virtual ~CallbackRefit() {} + }; + void refitAllStaticTree(CallbackRefit& cb, PxBounds3* resultMeshBounds); // faster version of refit for static RTree only + + + //////////////////////////////////////////////////////////////////////////// + // DEBUG HELPER FUNCTIONS + PX_PHYSX_COMMON_API void validate(CallbackRefit* cb = NULL); // verify that all children are indeed included in parent bounds + + void openTextDump(); + void closeTextDump(); + void textDump(const char* prefix); + void maxscriptExport(); + PxU32 computeBottomLevelCount(PxU32 storedToMemMultiplier) const; + + //////////////////////////////////////////////////////////////////////////// + // DATA + // remember to update save() and load() when adding or removing data + PxVec4 mBoundsMin, mBoundsMax, mInvDiagonal, mDiagonalScaler; // 16 + PxU32 mPageSize; + PxU32 mNumRootPages; + PxU32 mNumLevels; + PxU32 mTotalNodes; // 16 + PxU32 mTotalPages; + PxU32 mFlags; enum { USER_ALLOCATED = 0x1, IS_EDGE_SET = 0x2 }; + RTreePage* mPages; + + protected: + typedef PxU32 NodeHandle; + void validateRecursive(PxU32 level, RTreeNodeQ parentBounds, RTreePage* page, CallbackRefit* cb = NULL); + + friend struct RTreePage; + } PX_ALIGN_SUFFIX(16); + +#if PX_SUPPORT_EXTERN_TEMPLATE + //explicit template instantiation declaration + extern template + void RTree::traverseRay<0>(const PxVec3&, const PxVec3&, const PxU32, PxU32*, Gu::RTree::CallbackRaycast*, const PxVec3*, PxF32) const; + + extern template + void RTree::traverseRay<1>(const PxVec3&, const PxVec3&, const PxU32, PxU32*, Gu::RTree::CallbackRaycast*, const PxVec3*, PxF32) const; +#endif + +#if PX_VC +#pragma warning(pop) +#endif + + ///////////////////////////////////////////////////////////////////////// + PX_INLINE RTree::RTree() + { + mFlags = 0; + mPages = NULL; + mTotalNodes = 0; + mNumLevels = 0; + mPageSize = RTREE_N; + } + + ///////////////////////////////////////////////////////////////////////// + PX_INLINE void RTree::release() + { + if ((mFlags & USER_ALLOCATED) == 0 && mPages) + { + physx::PxAlignedAllocator<128>().deallocate(mPages); + mPages = NULL; + } + } + + ///////////////////////////////////////////////////////////////////////// + PX_FORCE_INLINE void RTreeNodeQ::setEmpty() + { + minx = miny = minz = RTreePage::MX; + maxx = maxy = maxz = RTreePage::MN; + } + + + // bit 1 is always expected to be set to differentiate between leaf and non-leaf node + PX_FORCE_INLINE PxU32 LeafGetNbTriangles(PxU32 Data) { return ((Data>>1) & 15)+1; } + PX_FORCE_INLINE PxU32 LeafGetTriangleIndex(PxU32 Data) { return Data>>5; } + PX_FORCE_INLINE PxU32 LeafSetData(PxU32 nb, PxU32 index) + { + PX_ASSERT(nb>0 && nb<=16); PX_ASSERT(index < (1<<27)); + return (index<<5)|(((nb-1)&15)<<1) | 1; + } + + struct LeafTriangles + { + PxU32 Data; + + // Gets number of triangles in the leaf, returns the number of triangles N, with 0 < N <= 16 + PX_FORCE_INLINE PxU32 GetNbTriangles() const { return LeafGetNbTriangles(Data); } + + // Gets triangle index for this leaf. Indexed model's array of indices retrieved with RTreeMidphase::GetIndices() + PX_FORCE_INLINE PxU32 GetTriangleIndex() const { return LeafGetTriangleIndex(Data); } + PX_FORCE_INLINE void SetData(PxU32 nb, PxU32 index) { Data = LeafSetData(nb, index); } + }; + + PX_COMPILE_TIME_ASSERT(sizeof(LeafTriangles)==4); // RTree has space for 4 bytes + +} // namespace Gu + +} + +#endif // #ifdef PX_COLLISION_RTREE diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp new file mode 100644 index 0000000..9788262 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuRTreeQueries.cpp @@ -0,0 +1,571 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +/* +General notes: + + rtree depth-first traversal looks like this: + push top level page onto stack + + pop page from stack + for each node in page + if node overlaps with testrect + push node's subpage + + we want to efficiently keep track of current stack level to know if the current page is a leaf or not + (since we don't store a flag with the page due to no space, we can't determine it just by looking at current page) + since we traverse depth first, the levels for nodes on the stack look like this: + l0 l0 l1 l2 l2 l3 l3 l3 l4 + + we can encode this as an array of 4 bits per level count into a 32-bit integer + to simplify the code->level computation we also keep track of current level by incrementing the level whenever any subpages + from current test page are pushed onto the stack + when we pop a page off the stack we use this encoding to determine if we should decrement the stack level +*/ + +#include "foundation/PxBounds3.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxBitUtils.h" +#include "GuRTree.h" +#include "GuBox.h" +#include "foundation/PxVecMath.h" +#include "PxQueryReport.h" // for PxAgain +#include "GuBVConstants.h" + +//#define VERIFY_RTREE +#ifdef VERIFY_RTREE +#include "GuIntersectionRayBox.h" +#include "GuIntersectionBoxBox.h" +#include "stdio.h" +#endif + +using namespace physx; +using namespace aos; + +namespace physx +{ +namespace Gu { + +using namespace aos; + +#define v_absm(a) V4Andc(a, signMask) +#define V4FromF32A(x) V4LoadA(x) +#define PxF32FV(x) FStore(x) +#define CAST_U8(a) reinterpret_cast(a) + +///////////////////////////////////////////////////////////////////////// +void RTree::traverseAABB(const PxVec3& boxMin, const PxVec3& boxMax, const PxU32 maxResults, PxU32* resultsPtr, Callback* callback) const +{ + PX_UNUSED(resultsPtr); + + PX_ASSERT(callback); + PX_ASSERT(maxResults >= mPageSize); + PX_UNUSED(maxResults); + + const PxU32 maxStack = 128; + PxU32 stack1[maxStack]; + PxU32* stack = stack1+1; + + PX_ASSERT(mPages); + PX_ASSERT((uintptr_t(mPages) & 127) == 0); + PX_ASSERT((uintptr_t(this) & 15) == 0); + + // conservatively quantize the input box + Vec4V nqMin = Vec4V_From_PxVec3_WUndefined(boxMin); + Vec4V nqMax = Vec4V_From_PxVec3_WUndefined(boxMax); + + Vec4V nqMinx4 = V4SplatElement<0>(nqMin); + Vec4V nqMiny4 = V4SplatElement<1>(nqMin); + Vec4V nqMinz4 = V4SplatElement<2>(nqMin); + Vec4V nqMaxx4 = V4SplatElement<0>(nqMax); + Vec4V nqMaxy4 = V4SplatElement<1>(nqMax); + Vec4V nqMaxz4 = V4SplatElement<2>(nqMax); + + // on 64-bit platforms the dynamic rtree pointer is also relative to mPages + PxU8* treeNodes8 = CAST_U8(mPages); + PxU32* stackPtr = stack; + + // AP potential perf optimization - fetch the top level right away + PX_ASSERT(RTREE_N == 4 || RTREE_N == 8); + PX_ASSERT(PxIsPowerOfTwo(mPageSize)); + + for (PxI32 j = PxI32(mNumRootPages-1); j >= 0; j --) + *stackPtr++ = j*sizeof(RTreePage); + + PxU32 cacheTopValid = true; + PxU32 cacheTop = 0; + + do { + stackPtr--; + PxU32 top; + if (cacheTopValid) // branch is faster than lhs + top = cacheTop; + else + top = stackPtr[0]; + PX_ASSERT(!cacheTopValid || stackPtr[0] == cacheTop); + RTreePage* PX_RESTRICT tn = reinterpret_cast(treeNodes8 + top); + const PxU32* ptrs = (reinterpret_cast(tn))->ptrs; + + Vec4V minx4 = V4LoadA(tn->minx); + Vec4V miny4 = V4LoadA(tn->miny); + Vec4V minz4 = V4LoadA(tn->minz); + Vec4V maxx4 = V4LoadA(tn->maxx); + Vec4V maxy4 = V4LoadA(tn->maxy); + Vec4V maxz4 = V4LoadA(tn->maxz); + + // AABB/AABB overlap test + BoolV res0 = V4IsGrtr(nqMinx4, maxx4); BoolV res1 = V4IsGrtr(nqMiny4, maxy4); BoolV res2 = V4IsGrtr(nqMinz4, maxz4); + BoolV res3 = V4IsGrtr(minx4, nqMaxx4); BoolV res4 = V4IsGrtr(miny4, nqMaxy4); BoolV res5 = V4IsGrtr(minz4, nqMaxz4); + BoolV resx = BOr(BOr(BOr(res0, res1), BOr(res2, res3)), BOr(res4, res5)); + PX_ALIGN_PREFIX(16) PxU32 resa[RTREE_N] PX_ALIGN_SUFFIX(16); + + VecU32V res4x = VecU32V_From_BoolV(resx); + U4StoreA(res4x, resa); + + cacheTopValid = false; + for (PxU32 i = 0; i < RTREE_N; i++) + { + PxU32 ptr = ptrs[i] & ~1; // clear the isLeaf bit + if (resa[i]) + continue; + if (tn->isLeaf(i)) + { + if (!callback->processResults(1, &ptr)) + return; + } + else + { + *(stackPtr++) = ptr; + cacheTop = ptr; + cacheTopValid = true; + } + } + } while (stackPtr > stack); +} + +///////////////////////////////////////////////////////////////////////// +template +void RTree::traverseRay( + const PxVec3& rayOrigin, const PxVec3& rayDir, + const PxU32 maxResults, PxU32* resultsPtr, Gu::RTree::CallbackRaycast* callback, + const PxVec3* fattenAABBs, PxF32 maxT) const +{ + // implements Kay-Kajiya 4-way SIMD test + PX_UNUSED(resultsPtr); + PX_UNUSED(maxResults); + + const PxU32 maxStack = 128; + PxU32 stack1[maxStack]; + PxU32* stack = stack1+1; + + PX_ASSERT(mPages); + PX_ASSERT((uintptr_t(mPages) & 127) == 0); + PX_ASSERT((uintptr_t(this) & 15) == 0); + + PxU8* treeNodes8 = CAST_U8(mPages); + + Vec4V fattenAABBsX, fattenAABBsY, fattenAABBsZ; + PX_UNUSED(fattenAABBsX); PX_UNUSED(fattenAABBsY); PX_UNUSED(fattenAABBsZ); + if (inflate) + { + Vec4V fattenAABBs4 = Vec4V_From_PxVec3_WUndefined(*fattenAABBs); + fattenAABBs4 = V4Add(fattenAABBs4, epsInflateFloat4); // US2385 - shapes are "closed" meaning exactly touching shapes should report overlap + fattenAABBsX = V4SplatElement<0>(fattenAABBs4); + fattenAABBsY = V4SplatElement<1>(fattenAABBs4); + fattenAABBsZ = V4SplatElement<2>(fattenAABBs4); + } + + Vec4V maxT4; + maxT4 = V4Load(maxT); + Vec4V rayP = Vec4V_From_PxVec3_WUndefined(rayOrigin); + Vec4V rayD = Vec4V_From_PxVec3_WUndefined(rayDir); + VecU32V raySign = V4U32and(VecU32V_ReinterpretFrom_Vec4V(rayD), signMask); + Vec4V rayDAbs = V4Abs(rayD); // abs value of rayD + Vec4V rayInvD = Vec4V_ReinterpretFrom_VecU32V(V4U32or(raySign, VecU32V_ReinterpretFrom_Vec4V(V4Max(rayDAbs, epsFloat4)))); // clamp near-zero components up to epsilon + rayD = rayInvD; + + //rayInvD = V4Recip(rayInvD); + // Newton-Raphson iteration for reciprocal (see wikipedia): + // X[n+1] = X[n]*(2-original*X[n]), X[0] = V4RecipFast estimate + //rayInvD = rayInvD*(twos-rayD*rayInvD); + rayInvD = V4RecipFast(rayInvD); // initial estimate, not accurate enough + rayInvD = V4Mul(rayInvD, V4NegMulSub(rayD, rayInvD, twos)); + + // P+tD=a; t=(a-P)/D + // t=(a - p.x)*1/d.x = a/d.x +(- p.x/d.x) + Vec4V rayPinvD = V4NegMulSub(rayInvD, rayP, zeroes); + Vec4V rayInvDsplatX = V4SplatElement<0>(rayInvD); + Vec4V rayInvDsplatY = V4SplatElement<1>(rayInvD); + Vec4V rayInvDsplatZ = V4SplatElement<2>(rayInvD); + Vec4V rayPinvDsplatX = V4SplatElement<0>(rayPinvD); + Vec4V rayPinvDsplatY = V4SplatElement<1>(rayPinvD); + Vec4V rayPinvDsplatZ = V4SplatElement<2>(rayPinvD); + + PX_ASSERT(RTREE_N == 4 || RTREE_N == 8); + PX_ASSERT(mNumRootPages > 0); + + PxU32 stackPtr = 0; + for (PxI32 j = PxI32(mNumRootPages-1); j >= 0; j --) + stack[stackPtr++] = j*sizeof(RTreePage); + + PX_ALIGN_PREFIX(16) PxU32 resa[4] PX_ALIGN_SUFFIX(16); + + while (stackPtr) + { + PxU32 top = stack[--stackPtr]; + if (top&1) // isLeaf test + { + top--; + PxF32 newMaxT = maxT; + if (!callback->processResults(1, &top, newMaxT)) + return; + /* shrink the ray if newMaxT is reduced compared to the original maxT */ + if (maxT != newMaxT) + { + PX_ASSERT(newMaxT < maxT); + maxT = newMaxT; + maxT4 = V4Load(newMaxT); + } + continue; + } + + RTreePage* PX_RESTRICT tn = reinterpret_cast(treeNodes8 + top); + + // 6i load + Vec4V minx4a = V4LoadA(tn->minx), miny4a = V4LoadA(tn->miny), minz4a = V4LoadA(tn->minz); + Vec4V maxx4a = V4LoadA(tn->maxx), maxy4a = V4LoadA(tn->maxy), maxz4a = V4LoadA(tn->maxz); + + // 1i disabled test + // AP scaffold - optimization opportunity - can save 2 instructions here + VecU32V ignore4a = V4IsGrtrV32u(minx4a, maxx4a); // 1 if degenerate box (empty slot in the page) + + if (inflate) + { + // 6i + maxx4a = V4Add(maxx4a, fattenAABBsX); maxy4a = V4Add(maxy4a, fattenAABBsY); maxz4a = V4Add(maxz4a, fattenAABBsZ); + minx4a = V4Sub(minx4a, fattenAABBsX); miny4a = V4Sub(miny4a, fattenAABBsY); minz4a = V4Sub(minz4a, fattenAABBsZ); + } + + // P+tD=a; t=(a-P)/D + // t=(a - p.x)*1/d.x = a/d.x +(- p.x/d.x) + // 6i + Vec4V tminxa0 = V4MulAdd(minx4a, rayInvDsplatX, rayPinvDsplatX); + Vec4V tminya0 = V4MulAdd(miny4a, rayInvDsplatY, rayPinvDsplatY); + Vec4V tminza0 = V4MulAdd(minz4a, rayInvDsplatZ, rayPinvDsplatZ); + Vec4V tmaxxa0 = V4MulAdd(maxx4a, rayInvDsplatX, rayPinvDsplatX); + Vec4V tmaxya0 = V4MulAdd(maxy4a, rayInvDsplatY, rayPinvDsplatY); + Vec4V tmaxza0 = V4MulAdd(maxz4a, rayInvDsplatZ, rayPinvDsplatZ); + + // test half-spaces + // P+tD=dN + // t = (d(N,D)-(P,D))/(D,D) , (D,D)=1 + + // compute 4x dot products (N,D) and (P,N) for each AABB in the page + + // 6i + // now compute tnear and tfar for each pair of planes for each box + Vec4V tminxa = V4Min(tminxa0, tmaxxa0); Vec4V tmaxxa = V4Max(tminxa0, tmaxxa0); + Vec4V tminya = V4Min(tminya0, tmaxya0); Vec4V tmaxya = V4Max(tminya0, tmaxya0); + Vec4V tminza = V4Min(tminza0, tmaxza0); Vec4V tmaxza = V4Max(tminza0, tmaxza0); + + // 8i + Vec4V maxOfNeasa = V4Max(V4Max(tminxa, tminya), tminza); + Vec4V minOfFarsa = V4Min(V4Min(tmaxxa, tmaxya), tmaxza); + ignore4a = V4U32or(ignore4a, V4IsGrtrV32u(epsFloat4, minOfFarsa)); // if tfar is negative, ignore since its a ray, not a line + // AP scaffold: update the build to eliminate 3 more instructions for ignore4a above + //VecU32V ignore4a = V4IsGrtrV32u(epsFloat4, minOfFarsa); // if tfar is negative, ignore since its a ray, not a line + ignore4a = V4U32or(ignore4a, V4IsGrtrV32u(maxOfNeasa, maxT4)); // if tnear is over maxT, ignore this result + + // 2i + VecU32V resa4 = V4IsGrtrV32u(maxOfNeasa, minOfFarsa); // if 1 => fail + resa4 = V4U32or(resa4, ignore4a); + + // 1i + V4U32StoreAligned(resa4, reinterpret_cast(resa)); + + PxU32* ptrs = (reinterpret_cast(tn))->ptrs; + + stack[stackPtr] = ptrs[0]; stackPtr += (1+resa[0]); // AP scaffold TODO: use VecU32add + stack[stackPtr] = ptrs[1]; stackPtr += (1+resa[1]); + stack[stackPtr] = ptrs[2]; stackPtr += (1+resa[2]); + stack[stackPtr] = ptrs[3]; stackPtr += (1+resa[3]); + } +} + +//explicit template instantiation +template void RTree::traverseRay<0>(const PxVec3&, const PxVec3&, const PxU32, PxU32*, Gu::RTree::CallbackRaycast*, const PxVec3*, PxF32) const; + +template void RTree::traverseRay<1>(const PxVec3&, const PxVec3&, const PxU32, PxU32*, Gu::RTree::CallbackRaycast*, const PxVec3*, PxF32) const; + +///////////////////////////////////////////////////////////////////////// +void RTree::traverseOBB( + const Gu::Box& obb, const PxU32 maxResults, PxU32* resultsPtr, Gu::RTree::Callback* callback) const +{ + PX_UNUSED(resultsPtr); + PX_UNUSED(maxResults); + + const PxU32 maxStack = 128; + PxU32 stack[maxStack]; + + PX_ASSERT(mPages); + PX_ASSERT((uintptr_t(mPages) & 127) == 0); + PX_ASSERT((uintptr_t(this) & 15) == 0); + + PxU8* treeNodes8 = CAST_U8(mPages); + PxU32* stackPtr = stack; + + Vec4V ones, halves, eps; + ones = V4Load(1.0f); + halves = V4Load(0.5f); + eps = V4Load(1e-6f); + + PX_UNUSED(ones); + + Vec4V obbO = Vec4V_From_PxVec3_WUndefined(obb.center); + Vec4V obbE = Vec4V_From_PxVec3_WUndefined(obb.extents); + // Gu::Box::rot matrix columns are the OBB axes + Vec4V obbX = Vec4V_From_PxVec3_WUndefined(obb.rot.column0); + Vec4V obbY = Vec4V_From_PxVec3_WUndefined(obb.rot.column1); + Vec4V obbZ = Vec4V_From_PxVec3_WUndefined(obb.rot.column2); + +#if PX_WINDOWS + // Visual Studio compiler hangs with #defines + // On VMX platforms we use #defines in the other branch of this #ifdef to avoid register spills (LHS) + Vec4V obbESplatX = V4SplatElement<0>(obbE); + Vec4V obbESplatY = V4SplatElement<1>(obbE); + Vec4V obbESplatZ = V4SplatElement<2>(obbE); + Vec4V obbESplatNegX = V4Sub(zeroes, obbESplatX); + Vec4V obbESplatNegY = V4Sub(zeroes, obbESplatY); + Vec4V obbESplatNegZ = V4Sub(zeroes, obbESplatZ); + Vec4V obbXE = V4MulAdd(obbX, obbESplatX, zeroes); // scale axii by E + Vec4V obbYE = V4MulAdd(obbY, obbESplatY, zeroes); // scale axii by E + Vec4V obbZE = V4MulAdd(obbZ, obbESplatZ, zeroes); // scale axii by E + Vec4V obbOSplatX = V4SplatElement<0>(obbO); + Vec4V obbOSplatY = V4SplatElement<1>(obbO); + Vec4V obbOSplatZ = V4SplatElement<2>(obbO); + Vec4V obbXSplatX = V4SplatElement<0>(obbX); + Vec4V obbXSplatY = V4SplatElement<1>(obbX); + Vec4V obbXSplatZ = V4SplatElement<2>(obbX); + Vec4V obbYSplatX = V4SplatElement<0>(obbY); + Vec4V obbYSplatY = V4SplatElement<1>(obbY); + Vec4V obbYSplatZ = V4SplatElement<2>(obbY); + Vec4V obbZSplatX = V4SplatElement<0>(obbZ); + Vec4V obbZSplatY = V4SplatElement<1>(obbZ); + Vec4V obbZSplatZ = V4SplatElement<2>(obbZ); + Vec4V obbXESplatX = V4SplatElement<0>(obbXE); + Vec4V obbXESplatY = V4SplatElement<1>(obbXE); + Vec4V obbXESplatZ = V4SplatElement<2>(obbXE); + Vec4V obbYESplatX = V4SplatElement<0>(obbYE); + Vec4V obbYESplatY = V4SplatElement<1>(obbYE); + Vec4V obbYESplatZ = V4SplatElement<2>(obbYE); + Vec4V obbZESplatX = V4SplatElement<0>(obbZE); + Vec4V obbZESplatY = V4SplatElement<1>(obbZE); + Vec4V obbZESplatZ = V4SplatElement<2>(obbZE); +#else + #define obbESplatX V4SplatElement<0>(obbE) + #define obbESplatY V4SplatElement<1>(obbE) + #define obbESplatZ V4SplatElement<2>(obbE) + #define obbESplatNegX V4Sub(zeroes, obbESplatX) + #define obbESplatNegY V4Sub(zeroes, obbESplatY) + #define obbESplatNegZ V4Sub(zeroes, obbESplatZ) + #define obbXE V4MulAdd(obbX, obbESplatX, zeroes) + #define obbYE V4MulAdd(obbY, obbESplatY, zeroes) + #define obbZE V4MulAdd(obbZ, obbESplatZ, zeroes) + #define obbOSplatX V4SplatElement<0>(obbO) + #define obbOSplatY V4SplatElement<1>(obbO) + #define obbOSplatZ V4SplatElement<2>(obbO) + #define obbXSplatX V4SplatElement<0>(obbX) + #define obbXSplatY V4SplatElement<1>(obbX) + #define obbXSplatZ V4SplatElement<2>(obbX) + #define obbYSplatX V4SplatElement<0>(obbY) + #define obbYSplatY V4SplatElement<1>(obbY) + #define obbYSplatZ V4SplatElement<2>(obbY) + #define obbZSplatX V4SplatElement<0>(obbZ) + #define obbZSplatY V4SplatElement<1>(obbZ) + #define obbZSplatZ V4SplatElement<2>(obbZ) + #define obbXESplatX V4SplatElement<0>(obbXE) + #define obbXESplatY V4SplatElement<1>(obbXE) + #define obbXESplatZ V4SplatElement<2>(obbXE) + #define obbYESplatX V4SplatElement<0>(obbYE) + #define obbYESplatY V4SplatElement<1>(obbYE) + #define obbYESplatZ V4SplatElement<2>(obbYE) + #define obbZESplatX V4SplatElement<0>(obbZE) + #define obbZESplatY V4SplatElement<1>(obbZE) + #define obbZESplatZ V4SplatElement<2>(obbZE) +#endif + + PX_ASSERT(mPageSize == 4 || mPageSize == 8); + PX_ASSERT(mNumRootPages > 0); + + for (PxI32 j = PxI32(mNumRootPages-1); j >= 0; j --) + *stackPtr++ = j*sizeof(RTreePage); + PxU32 cacheTopValid = true; + PxU32 cacheTop = 0; + + PX_ALIGN_PREFIX(16) PxU32 resa_[4] PX_ALIGN_SUFFIX(16); + + do { + stackPtr--; + + PxU32 top; + if (cacheTopValid) // branch is faster than lhs + top = cacheTop; + else + top = stackPtr[0]; + PX_ASSERT(!cacheTopValid || top == cacheTop); + RTreePage* PX_RESTRICT tn = reinterpret_cast(treeNodes8 + top); + + const PxU32 offs = 0; + PxU32* ptrs = (reinterpret_cast(tn))->ptrs; + + // 6i + Vec4V minx4a = V4LoadA(tn->minx+offs); + Vec4V miny4a = V4LoadA(tn->miny+offs); + Vec4V minz4a = V4LoadA(tn->minz+offs); + Vec4V maxx4a = V4LoadA(tn->maxx+offs); + Vec4V maxy4a = V4LoadA(tn->maxy+offs); + Vec4V maxz4a = V4LoadA(tn->maxz+offs); + + VecU32V noOverlapa; + VecU32V resa4u; + { + // PRECOMPUTE FOR A BLOCK + // 109 instr per 4 OBB/AABB + // ABB iteration 1, start with OBB origin as other point -- 6 + Vec4V p1ABBxa = V4Max(minx4a, V4Min(maxx4a, obbOSplatX)); + Vec4V p1ABBya = V4Max(miny4a, V4Min(maxy4a, obbOSplatY)); + Vec4V p1ABBza = V4Max(minz4a, V4Min(maxz4a, obbOSplatZ)); + + // OBB iteration 1, move to OBB space first -- 12 + Vec4V p1ABBOxa = V4Sub(p1ABBxa, obbOSplatX); + Vec4V p1ABBOya = V4Sub(p1ABBya, obbOSplatY); + Vec4V p1ABBOza = V4Sub(p1ABBza, obbOSplatZ); + Vec4V obbPrjXa = V4MulAdd(p1ABBOxa, obbXSplatX, V4MulAdd(p1ABBOya, obbXSplatY, V4MulAdd(p1ABBOza, obbXSplatZ, zeroes))); + Vec4V obbPrjYa = V4MulAdd(p1ABBOxa, obbYSplatX, V4MulAdd(p1ABBOya, obbYSplatY, V4MulAdd(p1ABBOza, obbYSplatZ, zeroes))); + Vec4V obbPrjZa = V4MulAdd(p1ABBOxa, obbZSplatX, V4MulAdd(p1ABBOya, obbZSplatY, V4MulAdd(p1ABBOza, obbZSplatZ, zeroes))); + // clamp AABB point in OBB space to OBB extents. Since we scaled the axii, the extents are [-1,1] -- 6 + Vec4V pOBBxa = V4Max(obbESplatNegX, V4Min(obbPrjXa, obbESplatX)); + Vec4V pOBBya = V4Max(obbESplatNegY, V4Min(obbPrjYa, obbESplatY)); + Vec4V pOBBza = V4Max(obbESplatNegZ, V4Min(obbPrjZa, obbESplatZ)); + // go back to AABB space. we have x,y,z in obb space, need to multiply by axii -- 9 + Vec4V p1OBBxa = V4MulAdd(pOBBxa, obbXSplatX, V4MulAdd(pOBBya, obbYSplatX, V4MulAdd(pOBBza, obbZSplatX, obbOSplatX))); + Vec4V p1OBBya = V4MulAdd(pOBBxa, obbXSplatY, V4MulAdd(pOBBya, obbYSplatY, V4MulAdd(pOBBza, obbZSplatY, obbOSplatY))); + Vec4V p1OBBza = V4MulAdd(pOBBxa, obbXSplatZ, V4MulAdd(pOBBya, obbYSplatZ, V4MulAdd(pOBBza, obbZSplatZ, obbOSplatZ))); + + // ABB iteration 2 -- 6 instructions + Vec4V p2ABBxa = V4Max(minx4a, V4Min(maxx4a, p1OBBxa)); + Vec4V p2ABBya = V4Max(miny4a, V4Min(maxy4a, p1OBBya)); + Vec4V p2ABBza = V4Max(minz4a, V4Min(maxz4a, p1OBBza)); + // above blocks add up to 12+12+15=39 instr + // END PRECOMPUTE FOR A BLOCK + + // for AABBs precompute extents and center -- 9i + Vec4V abbCxa = V4MulAdd(V4Add(maxx4a, minx4a), halves, zeroes); + Vec4V abbCya = V4MulAdd(V4Add(maxy4a, miny4a), halves, zeroes); + Vec4V abbCza = V4MulAdd(V4Add(maxz4a, minz4a), halves, zeroes); + Vec4V abbExa = V4Sub(maxx4a, abbCxa); + Vec4V abbEya = V4Sub(maxy4a, abbCya); + Vec4V abbEza = V4Sub(maxz4a, abbCza); + + // now test separating axes D1 = p1OBB-p1ABB and D2 = p1OBB-p2ABB -- 37 instructions per axis + // D1 first -- 3 instructions + Vec4V d1xa = V4Sub(p1OBBxa, p1ABBxa), d1ya = V4Sub(p1OBBya, p1ABBya), d1za = V4Sub(p1OBBza, p1ABBza); + + // for AABB compute projections of extents and center -- 6 + Vec4V abbExd1Prja = V4MulAdd(d1xa, abbExa, zeroes); + Vec4V abbEyd1Prja = V4MulAdd(d1ya, abbEya, zeroes); + Vec4V abbEzd1Prja = V4MulAdd(d1za, abbEza, zeroes); + Vec4V abbCd1Prja = V4MulAdd(d1xa, abbCxa, V4MulAdd(d1ya, abbCya, V4MulAdd(d1za, abbCza, zeroes))); + + // for obb project each halfaxis and origin and add abs values of half-axis projections -- 12 instructions + Vec4V obbXEd1Prja = V4MulAdd(d1xa, obbXESplatX, V4MulAdd(d1ya, obbXESplatY, V4MulAdd(d1za, obbXESplatZ, zeroes))); + Vec4V obbYEd1Prja = V4MulAdd(d1xa, obbYESplatX, V4MulAdd(d1ya, obbYESplatY, V4MulAdd(d1za, obbYESplatZ, zeroes))); + Vec4V obbZEd1Prja = V4MulAdd(d1xa, obbZESplatX, V4MulAdd(d1ya, obbZESplatY, V4MulAdd(d1za, obbZESplatZ, zeroes))); + Vec4V obbOd1Prja = V4MulAdd(d1xa, obbOSplatX, V4MulAdd(d1ya, obbOSplatY, V4MulAdd(d1za, obbOSplatZ, zeroes))); + + // compare lengths between projected centers with sum of projected radii -- 16i + Vec4V originDiffd1a = v_absm(V4Sub(abbCd1Prja, obbOd1Prja)); + Vec4V absABBRd1a = V4Add(V4Add(v_absm(abbExd1Prja), v_absm(abbEyd1Prja)), v_absm(abbEzd1Prja)); + Vec4V absOBBRd1a = V4Add(V4Add(v_absm(obbXEd1Prja), v_absm(obbYEd1Prja)), v_absm(obbZEd1Prja)); + VecU32V noOverlapd1a = V4IsGrtrV32u(V4Sub(originDiffd1a, eps), V4Add(absABBRd1a, absOBBRd1a)); + VecU32V epsNoOverlapd1a = V4IsGrtrV32u(originDiffd1a, eps); + + // D2 next (35 instr) + // 3i + Vec4V d2xa = V4Sub(p1OBBxa, p2ABBxa), d2ya = V4Sub(p1OBBya, p2ABBya), d2za = V4Sub(p1OBBza, p2ABBza); + // for AABB compute projections of extents and center -- 6 + Vec4V abbExd2Prja = V4MulAdd(d2xa, abbExa, zeroes); + Vec4V abbEyd2Prja = V4MulAdd(d2ya, abbEya, zeroes); + Vec4V abbEzd2Prja = V4MulAdd(d2za, abbEza, zeroes); + Vec4V abbCd2Prja = V4MulAdd(d2xa, abbCxa, V4MulAdd(d2ya, abbCya, V4MulAdd(d2za, abbCza, zeroes))); + // for obb project each halfaxis and origin and add abs values of half-axis projections -- 12i + Vec4V obbXEd2Prja = V4MulAdd(d2xa, obbXESplatX, V4MulAdd(d2ya, obbXESplatY, V4MulAdd(d2za, obbXESplatZ, zeroes))); + Vec4V obbYEd2Prja = V4MulAdd(d2xa, obbYESplatX, V4MulAdd(d2ya, obbYESplatY, V4MulAdd(d2za, obbYESplatZ, zeroes))); + Vec4V obbZEd2Prja = V4MulAdd(d2xa, obbZESplatX, V4MulAdd(d2ya, obbZESplatY, V4MulAdd(d2za, obbZESplatZ, zeroes))); + Vec4V obbOd2Prja = V4MulAdd(d2xa, obbOSplatX, V4MulAdd(d2ya, obbOSplatY, V4MulAdd(d2za, obbOSplatZ, zeroes))); + // compare lengths between projected centers with sum of projected radii -- 16i + Vec4V originDiffd2a = v_absm(V4Sub(abbCd2Prja, obbOd2Prja)); + Vec4V absABBRd2a = V4Add(V4Add(v_absm(abbExd2Prja), v_absm(abbEyd2Prja)), v_absm(abbEzd2Prja)); + Vec4V absOBBRd2a = V4Add(V4Add(v_absm(obbXEd2Prja), v_absm(obbYEd2Prja)), v_absm(obbZEd2Prja)); + VecU32V noOverlapd2a = V4IsGrtrV32u(V4Sub(originDiffd2a, eps), V4Add(absABBRd2a, absOBBRd2a)); + VecU32V epsNoOverlapd2a = V4IsGrtrV32u(originDiffd2a, eps); + + // 8i + noOverlapa = V4U32or(V4U32and(noOverlapd1a, epsNoOverlapd1a), V4U32and(noOverlapd2a, epsNoOverlapd2a)); + VecU32V ignore4a = V4IsGrtrV32u(minx4a, maxx4a); // 1 if degenerate box (empty slot) + noOverlapa = V4U32or(noOverlapa, ignore4a); + resa4u = V4U32Andc(U4Load(1), noOverlapa); // 1 & ~noOverlap + V4U32StoreAligned(resa4u, reinterpret_cast(resa_)); + ///// 8+16+12+6+3+16+12+6+3+9+6+9+6+12+6+6=136i from load to result + } + + cacheTopValid = false; + for (PxU32 i = 0; i < 4; i++) + { + PxU32 ptr = ptrs[i+offs] & ~1; // clear the isLeaf bit + if (resa_[i]) + { + if (tn->isLeaf(i)) + { + if (!callback->processResults(1, &ptr)) + return; + } + else + { + *(stackPtr++) = ptr; + cacheTop = ptr; + cacheTopValid = true; + } + } + } + } while (stackPtr > stack); +} + +} // namespace Gu + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepConvexTri.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepConvexTri.h new file mode 100644 index 0000000..f0c3889 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepConvexTri.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_CONVEX_TRI +#define GU_SWEEP_CONVEX_TRI + +#include "geometry/PxConvexMeshGeometry.h" +#include "GuVecTriangle.h" +#include "GuVecConvexHull.h" +#include "GuConvexMesh.h" +#include "GuGJKRaycast.h" + +// return true if hit, false if no hit +static PX_FORCE_INLINE bool sweepConvexVsTriangle( + const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, + ConvexHullV& convexHull, const aos::PxMatTransformV& meshToConvex, const aos::PxTransformV& convexTransfV, + const aos::Vec3VArg convexSpaceDir, const PxVec3& unitDir, const PxVec3& meshSpaceUnitDir, + const aos::FloatVArg fullDistance, PxReal shrunkDistance, + PxGeomSweepHit& hit, bool isDoubleSided, const PxReal inflation, bool& initialOverlap, PxU32 faceIndex) +{ + using namespace aos; + if(!isDoubleSided) + { + // Create triangle normal + const PxVec3 denormalizedNormal = (v1 - v0).cross(v2 - v1); + + // Backface culling + // PT: WARNING, the test is reversed compared to usual because we pass -unitDir to this function + const bool culled = denormalizedNormal.dot(meshSpaceUnitDir) <= 0.0f; + if(culled) + return false; + } + + const Vec3V zeroV = V3Zero(); + const FloatV zero = FZero(); + + const Vec3V p0 = V3LoadU(v0); // in mesh local space + const Vec3V p1 = V3LoadU(v1); + const Vec3V p2 = V3LoadU(v2); + + // transform triangle verts from mesh local to convex local space + TriangleV triangleV(meshToConvex.transform(p0), meshToConvex.transform(p1), meshToConvex.transform(p2)); + + FloatV toi; + Vec3V closestA,normal; + + const LocalConvex convexA(triangleV); + const LocalConvex convexB(convexHull); + const Vec3V initialSearchDir = V3Sub(triangleV.getCenter(), convexHull.getCenter()); + // run GJK raycast + // sweep triangle in convex local space vs convex, closestA will be the impact point in convex local space + const bool gjkHit = gjkRaycastPenetration, LocalConvex >( + convexA, convexB, initialSearchDir, zero, zeroV, convexSpaceDir, toi, normal, closestA, inflation, false); + if(!gjkHit) + return false; + + if(FAllGrtrOrEq(zero, toi)) + { + initialOverlap = true; // PT: TODO: redundant with hit distance, consider removing + return setInitialOverlapResults(hit, unitDir, faceIndex); + } + + const FloatV minDist = FLoad(shrunkDistance); + const FloatV dist = FMul(toi, fullDistance); // scale the toi to original full sweep distance + if(FAllGrtr(minDist, dist)) // is current dist < minDist? + { + hit.faceIndex = faceIndex; + hit.flags = PxHitFlag::ePOSITION | PxHitFlag::eNORMAL | PxHitFlag::eFACE_INDEX; + const Vec3V destWorldPointA = convexTransfV.transform(closestA); + const Vec3V destNormal = V3Normalize(convexTransfV.rotate(normal)); + V3StoreU(destWorldPointA, hit.position); + V3StoreU(destNormal, hit.normal); + FStore(dist, &hit.distance); + return true; // report a hit + } + return false; // report no hit +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepMesh.h new file mode 100644 index 0000000..15e5f63 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepMesh.h @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_MESH_H +#define GU_SWEEP_MESH_H + +#include "GuMidphaseInterface.h" +#include "GuVecConvexHull.h" + +namespace physx +{ + +namespace Gu +{ + // PT: intermediate class containing shared bits of code & members + struct SweepShapeMeshHitCallback : MeshHitCallback + { + SweepShapeMeshHitCallback(CallbackMode::Enum mode, const PxHitFlags& hitFlags, bool flipNormal, float distCoef); + + const PxHitFlags mHitFlags; + bool mStatus; // Default is false, set to true if a valid hit is found. Stays true once true. + bool mInitialOverlap; // Default is false, set to true if an initial overlap hit is found. Reset for each hit. + bool mFlipNormal; // If negative scale is used we need to flip normal + PxReal mDistCoeff; // dist coeff from unscaled to scaled distance + + void operator=(const SweepShapeMeshHitCallback&) {} + }; + + struct SweepCapsuleMeshHitCallback : SweepShapeMeshHitCallback + { + PxGeomSweepHit& mSweepHit; + const PxMat34& mVertexToWorldSkew; + const PxReal mTrueSweepDistance; // max sweep distance that can be used + PxReal mBestAlignmentValue; // best alignment value for triangle normal + PxReal mBestDist; // best distance, not the same as sweepHit.distance, can be shorter by epsilon + const Capsule& mCapsule; + const PxVec3& mUnitDir; + const bool mMeshDoubleSided; // PT: true if PxMeshGeometryFlag::eDOUBLE_SIDED + const bool mIsSphere; + + SweepCapsuleMeshHitCallback(PxGeomSweepHit& sweepHit, const PxMat34& worldMatrix, PxReal distance, bool meshDoubleSided, + const Capsule& capsule, const PxVec3& unitDir, const PxHitFlags& hitFlags, bool flipNormal, float distCoef); + + virtual PxAgain processHit(const PxGeomRaycastHit& aHit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal& shrunkMaxT, const PxU32*); + + // PT: TODO: unify these operators + void operator=(const SweepCapsuleMeshHitCallback&) {} + + bool finalizeHit( PxGeomSweepHit& sweepHit, const Capsule& lss, const PxTriangleMeshGeometry& triMeshGeom, + const PxTransform& pose, bool isDoubleSided) const; + }; + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + struct SweepBoxMeshHitCallback : SweepShapeMeshHitCallback + { + const PxMat34Padded& mMeshToBox; + PxReal mDist, mDist0; + physx::aos::FloatV mDistV; + const Box& mBox; + const PxVec3& mLocalDir; + const PxVec3& mWorldUnitDir; + PxReal mInflation; + PxTriangle mHitTriangle; + physx::aos::Vec3V mMinClosestA; + physx::aos::Vec3V mMinNormal; + physx::aos::Vec3V mLocalMotionV; + PxU32 mMinTriangleIndex; + PxVec3 mOneOverDir; + const bool mBothTriangleSidesCollide; // PT: true if PxMeshGeometryFlag::eDOUBLE_SIDED || PxHitFlag::eMESH_BOTH_SIDES + + SweepBoxMeshHitCallback(CallbackMode::Enum mode_, const PxMat34Padded& meshToBox, PxReal distance, bool bothTriangleSidesCollide, + const Box& box, const PxVec3& localMotion, const PxVec3& localDir, const PxVec3& unitDir, + const PxHitFlags& hitFlags, const PxReal inflation, bool flipNormal, float distCoef); + + virtual ~SweepBoxMeshHitCallback() {} + + virtual PxAgain processHit(const PxGeomRaycastHit& meshHit, const PxVec3& lp0, const PxVec3& lp1, const PxVec3& lp2, PxReal& shrinkMaxT, const PxU32*); + + bool finalizeHit( PxGeomSweepHit& sweepHit, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const PxTransform& boxTransform, const PxVec3& localDir, + bool meshBothSides, bool isDoubleSided) const; + + private: + SweepBoxMeshHitCallback& operator=(const SweepBoxMeshHitCallback&); + }; + + struct SweepConvexMeshHitCallback : SweepShapeMeshHitCallback + { + PxTriangle mHitTriangle; + ConvexHullV mConvexHull; + physx::aos::PxMatTransformV mMeshToConvex; + physx::aos::PxTransformV mConvexPoseV; + const Cm::FastVertex2ShapeScaling& mMeshScale; + PxGeomSweepHit mSweepHit; // stores either the closest or any hit depending on value of mAnyHit + physx::aos::FloatV mInitialDistance; + physx::aos::Vec3V mConvexSpaceDir; // convexPose.rotateInv(-unit*distance) + PxVec3 mUnitDir; + PxVec3 mMeshSpaceUnitDir; + PxReal mInflation; + const bool mAnyHit; + const bool mBothTriangleSidesCollide; // PT: true if PxMeshGeometryFlag::eDOUBLE_SIDED || PxHitFlag::eMESH_BOTH_SIDES + + SweepConvexMeshHitCallback( const ConvexHullData& hull, const PxMeshScale& convexScale, const Cm::FastVertex2ShapeScaling& meshScale, + const PxTransform& convexPose, const PxTransform& meshPose, + const PxVec3& unitDir, const PxReal distance, PxHitFlags hitFlags, const bool bothTriangleSidesCollide, const PxReal inflation, + const bool anyHit, float distCoef); + + virtual ~SweepConvexMeshHitCallback() {} + + virtual PxAgain processHit(const PxGeomRaycastHit& hit, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2, PxReal& shrunkMaxT, const PxU32*); + + bool finalizeHit(PxGeomSweepHit& sweepHit, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, + const PxVec3& unitDir, PxReal inflation, + bool isMtd, bool meshBothSides, bool isDoubleSided, bool bothTriangleSidesCollide); + + private: + SweepConvexMeshHitCallback& operator=(const SweepConvexMeshHitCallback&); + }; + +#if PX_VC + #pragma warning(pop) +#endif + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp new file mode 100644 index 0000000..1e30679 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuSweepsMesh.cpp @@ -0,0 +1,613 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepTests.h" +#include "GuSweepMesh.h" +#include "GuInternal.h" +#include "GuConvexUtilsInternal.h" +#include "CmScaling.h" +#include "GuSweepMTD.h" +#include "GuVecBox.h" +#include "GuVecCapsule.h" +#include "GuSweepBoxTriangle_SAT.h" +#include "GuSweepCapsuleTriangle.h" +#include "GuSweepSphereTriangle.h" +#include "GuDistancePointTriangle.h" +#include "GuCapsule.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +#include "GuSweepConvexTri.h" + +/////////////////////////////////////////////////////////////////////////////// + +static bool sweepSphereTriangle(const PxTriangle& tri, + const PxVec3& center, PxReal radius, + const PxVec3& unitDir, const PxReal distance, + PxGeomSweepHit& hit, PxVec3& triNormalOut, + PxHitFlags hitFlags, bool isDoubleSided) +{ + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + if(!(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + const bool doBackfaceCulling = !isDoubleSided && !meshBothSides; + + // PT: test if shapes initially overlap + // PT: add culling here for now, but could be made more efficiently... + + // Create triangle normal + PxVec3 denormalizedNormal; + tri.denormalizedNormal(denormalizedNormal); + + // Backface culling + if(doBackfaceCulling && (denormalizedNormal.dot(unitDir) > 0.0f)) + return false; + + float s_unused, t_unused; + const PxVec3 cp = closestPtPointTriangle(center, tri.verts[0], tri.verts[1], tri.verts[2], s_unused, t_unused); + const PxReal dist2 = (cp - center).magnitudeSquared(); + if(dist2<=radius*radius) + { + triNormalOut = denormalizedNormal.getNormalized(); + return setInitialOverlapResults(hit, unitDir, 0); + } + } + + return sweepSphereTriangles(1, &tri, + center, radius, + unitDir, distance, + NULL, + hit, triNormalOut, + isDoubleSided, meshBothSides, false, false); +} + +/////////////////////////////////////////////////////////////////////////////// + +SweepShapeMeshHitCallback::SweepShapeMeshHitCallback(CallbackMode::Enum inMode, const PxHitFlags& hitFlags, bool flipNormal, float distCoef) : + MeshHitCallback (inMode), + mHitFlags (hitFlags), + mStatus (false), + mInitialOverlap (false), + mFlipNormal (flipNormal), + mDistCoeff (distCoef) +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +SweepCapsuleMeshHitCallback::SweepCapsuleMeshHitCallback( + PxGeomSweepHit& sweepHit, const PxMat34& worldMatrix, PxReal distance, bool meshDoubleSided, + const Capsule& capsule, const PxVec3& unitDir, const PxHitFlags& hitFlags, bool flipNormal, float distCoef) : + SweepShapeMeshHitCallback (CallbackMode::eMULTIPLE, hitFlags, flipNormal, distCoef), + mSweepHit (sweepHit), + mVertexToWorldSkew (worldMatrix), + mTrueSweepDistance (distance), + mBestAlignmentValue (2.0f), + mBestDist (distance + GU_EPSILON_SAME_DISTANCE), + mCapsule (capsule), + mUnitDir (unitDir), + mMeshDoubleSided (meshDoubleSided), + mIsSphere (capsule.p0 == capsule.p1) +{ + mSweepHit.distance = mTrueSweepDistance; +} + +PxAgain SweepCapsuleMeshHitCallback::processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& aHit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal& shrunkMaxT, const PxU32*) +{ + const PxTriangle tmpt( mVertexToWorldSkew.transform(v0), + mVertexToWorldSkew.transform(mFlipNormal ? v2 : v1), + mVertexToWorldSkew.transform(mFlipNormal ? v1 : v2)); + + PxGeomSweepHit localHit; // PT: TODO: ctor! + PxVec3 triNormal; + // pick a farther hit within distEpsilon that is more opposing than the previous closest hit + // make it a relative epsilon to make sure it still works with large distances + const PxReal distEpsilon = GU_EPSILON_SAME_DISTANCE * PxMax(1.0f, mSweepHit.distance); + const float minD = mSweepHit.distance + distEpsilon; + if(mIsSphere) + { + if(!::sweepSphereTriangle( tmpt, + mCapsule.p0, mCapsule.radius, + mUnitDir, minD, + localHit, triNormal, + mHitFlags, mMeshDoubleSided)) + return true; + } + else + { + // PT: this one is safe because cullbox is NULL (no need to allocate one more triangle) + if(!sweepCapsuleTriangles_Precise( 1, &tmpt, + mCapsule, + mUnitDir, minD, + NULL, + localHit, triNormal, + mHitFlags, mMeshDoubleSided, + NULL)) + return true; + } + + const PxReal alignmentValue = computeAlignmentValue(triNormal, mUnitDir); + if(keepTriangle(localHit.distance, alignmentValue, mBestDist, mBestAlignmentValue, mTrueSweepDistance)) + { + mBestAlignmentValue = alignmentValue; + + // AP: need to shrink the sweep distance passed into sweepCapsuleTriangles for correctness so that next sweep is closer + shrunkMaxT = localHit.distance * mDistCoeff; // shrunkMaxT is scaled + + mBestDist = PxMin(mBestDist, localHit.distance); // exact lower bound + mSweepHit.flags = localHit.flags; + mSweepHit.distance = localHit.distance; + mSweepHit.normal = localHit.normal; + mSweepHit.position = localHit.position; + mSweepHit.faceIndex = aHit.faceIndex; + + mStatus = true; + //ML:this is the initial overlap condition + if(localHit.distance == 0.0f) + { + mInitialOverlap = true; + return false; + } + if(mHitFlags & PxHitFlag::eMESH_ANY) + return false; // abort traversal + } + /// + else if(keepTriangleBasic(localHit.distance, mBestDist, mTrueSweepDistance)) + { + mSweepHit.distance = localHit.distance; + mBestDist = PxMin(mBestDist, localHit.distance); // exact lower bound + } + /// + return true; +} + +bool SweepCapsuleMeshHitCallback::finalizeHit( PxGeomSweepHit& sweepHit, const Capsule& lss, const PxTriangleMeshGeometry& triMeshGeom, + const PxTransform& pose, bool isDoubleSided) const +{ + if(!mStatus) + return false; + + if(mInitialOverlap) + { + // PT: TODO: consider using 'setInitialOverlapResults' here + bool hasContacts = false; + if(mHitFlags & PxHitFlag::eMTD) + { + const Vec3V p0 = V3LoadU(mCapsule.p0); + const Vec3V p1 = V3LoadU(mCapsule.p1); + const FloatV radius = FLoad(lss.radius); + CapsuleV capsuleV; + capsuleV.initialize(p0, p1, radius); + + //we need to calculate the MTD + hasContacts = computeCapsule_TriangleMeshMTD(triMeshGeom, pose, capsuleV, mCapsule.radius, isDoubleSided, sweepHit); + } + setupSweepHitForMTD(sweepHit, hasContacts, mUnitDir); + } + else + { + mSweepHit.distance = mBestDist; + sweepHit.flags = PxHitFlag::eNORMAL | PxHitFlag::ePOSITION | PxHitFlag::eFACE_INDEX; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool sweepCapsule_MeshGeom(GU_CAPSULE_SWEEP_FUNC_PARAMS) +{ + PX_UNUSED(threadContext); + PX_UNUSED(capsuleGeom_); + PX_UNUSED(capsulePose_); + + PX_ASSERT(geom.getType() == PxGeometryType::eTRIANGLEMESH); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + return Midphase::sweepCapsuleVsMesh(meshData, meshGeom, pose, lss, unitDir, distance, sweepHit, hitFlags, inflation); +} + +/////////////////////////////////////////////////////////////////////////////// + + // same as 'mat.transform(p)' but using SIMD + static PX_FORCE_INLINE Vec4V transformV(const Vec4V p, const PxMat34Padded& mat) + { + Vec4V ResV = V4Scale(V4LoadU(&mat.m.column0.x), V4GetX(p)); + ResV = V4ScaleAdd(V4LoadU(&mat.m.column1.x), V4GetY(p), ResV); + ResV = V4ScaleAdd(V4LoadU(&mat.m.column2.x), V4GetZ(p), ResV); + ResV = V4Add(ResV, V4LoadU(&mat.p.x)); // PT: this load is safe thanks to padding + return ResV; + } + +/////////////////////////////////////////////////////////////////////////////// + +SweepBoxMeshHitCallback::SweepBoxMeshHitCallback( CallbackMode::Enum mode_, const PxMat34Padded& meshToBox, PxReal distance, bool bothTriangleSidesCollide, + const Box& box, const PxVec3& localMotion, const PxVec3& localDir, const PxVec3& unitDir, + const PxHitFlags& hitFlags, const PxReal inflation, bool flipNormal, float distCoef) : + SweepShapeMeshHitCallback (mode_, hitFlags, flipNormal,distCoef), + mMeshToBox (meshToBox), + mDist (distance), + mBox (box), + mLocalDir (localDir), + mWorldUnitDir (unitDir), + mInflation (inflation), + mBothTriangleSidesCollide (bothTriangleSidesCollide) +{ + mLocalMotionV = V3LoadU(localMotion); + mDistV = FLoad(distance); + mDist0 = distance; + mOneOverDir = PxVec3( + mLocalDir.x!=0.0f ? 1.0f/mLocalDir.x : 0.0f, + mLocalDir.y!=0.0f ? 1.0f/mLocalDir.y : 0.0f, + mLocalDir.z!=0.0f ? 1.0f/mLocalDir.z : 0.0f); +} + +PxAgain SweepBoxMeshHitCallback::processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& meshHit, const PxVec3& lp0, const PxVec3& lp1, const PxVec3& lp2, PxReal& shrinkMaxT, const PxU32*) +{ + if(mHitFlags & PxHitFlag::ePRECISE_SWEEP) + { + const PxTriangle currentTriangle( + mMeshToBox.transform(lp0), + mMeshToBox.transform(mFlipNormal ? lp2 : lp1), + mMeshToBox.transform(mFlipNormal ? lp1 : lp2)); + + PxF32 t = PX_MAX_REAL; // PT: could be better! + if(!triBoxSweepTestBoxSpace(currentTriangle, mBox.extents, mLocalDir, mOneOverDir, mDist, t, !mBothTriangleSidesCollide)) + return true; + + if(t <= mDist) + { + // PT: test if shapes initially overlap + mDist = t; + shrinkMaxT = t * mDistCoeff; // shrunkMaxT is scaled + mMinClosestA = V3LoadU(currentTriangle.verts[0]); // PT: this is arbitrary + mMinNormal = V3LoadU(-mWorldUnitDir); + mStatus = true; + mMinTriangleIndex = meshHit.faceIndex; + mHitTriangle = currentTriangle; + if(t == 0.0f) + { + mInitialOverlap = true; + return false; // abort traversal + } + } + } + else + { + const FloatV zero = FZero(); + + // PT: SIMD code similar to: + // const Vec3V triV0 = V3LoadU(mMeshToBox.transform(lp0)); + // const Vec3V triV1 = V3LoadU(mMeshToBox.transform(lp1)); + // const Vec3V triV2 = V3LoadU(mMeshToBox.transform(lp2)); + // + // SIMD version works but we need to ensure all loads are safe. + // For incoming vertices they should either come from the vertex array or from a binary deserialized file. + // For the vertex array we can just allocate one more vertex. For the binary file it should be ok as soon + // as vertices aren't the last thing serialized in the file. + // For the matrix only the last column is a problem, and we can easily solve that with some padding in the local class. + const Vec3V triV0 = Vec3V_From_Vec4V(transformV(V4LoadU(&lp0.x), mMeshToBox)); + const Vec3V triV1 = Vec3V_From_Vec4V(transformV(V4LoadU(mFlipNormal ? &lp2.x : &lp1.x), mMeshToBox)); + const Vec3V triV2 = Vec3V_From_Vec4V(transformV(V4LoadU(mFlipNormal ? &lp1.x : &lp2.x), mMeshToBox)); + + if(!mBothTriangleSidesCollide) + { + const Vec3V triNormal = V3Cross(V3Sub(triV2, triV1),V3Sub(triV0, triV1)); + if(FAllGrtrOrEq(V3Dot(triNormal, mLocalMotionV), zero)) + return true; + } + + const Vec3V zeroV = V3Zero(); + const Vec3V boxExtents = V3LoadU(mBox.extents); + const BoxV boxV(zeroV, boxExtents); + + const TriangleV triangleV(triV0, triV1, triV2); + + FloatV lambda; + Vec3V closestA, normal;//closestA and normal is in the local space of convex hull + const LocalConvex convexA(triangleV); + const LocalConvex convexB(boxV); + const Vec3V initialSearchDir = V3Sub(triangleV.getCenter(), boxV.getCenter()); + if(!gjkRaycastPenetration, LocalConvex >(convexA, convexB, initialSearchDir, zero, zeroV, mLocalMotionV, lambda, normal, closestA, mInflation, false)) + return true; + + mStatus = true; + mMinClosestA = closestA; + mMinTriangleIndex = meshHit.faceIndex; + if(FAllGrtrOrEq(zero, lambda)) // lambda < 0? => initial overlap + { + mInitialOverlap = true; + shrinkMaxT = 0.0f; + mDistV = zero; + mDist = 0.0f; + mMinNormal = V3LoadU(-mWorldUnitDir); + return false; + } + + PxF32 f; + FStore(lambda, &f); + mDist = f*mDist; // shrink dist + mLocalMotionV = V3Scale(mLocalMotionV, lambda); // shrink localMotion + mDistV = FMul(mDistV, lambda); // shrink distV + mMinNormal = normal; + if(mDist * mDistCoeff < shrinkMaxT) // shrink shrinkMaxT + shrinkMaxT = mDist * mDistCoeff; // shrunkMaxT is scaled + + //mHitTriangle = currentTriangle; + V3StoreU(triV0, mHitTriangle.verts[0]); + V3StoreU(triV1, mHitTriangle.verts[1]); + V3StoreU(triV2, mHitTriangle.verts[2]); + } + return true; +} + +bool SweepBoxMeshHitCallback::finalizeHit( PxGeomSweepHit& sweepHit, const PxTriangleMeshGeometry& triMeshGeom, const PxTransform& pose, + const PxTransform& boxTransform, const PxVec3& localDir, + bool meshBothSides, bool isDoubleSided) const +{ + if(!mStatus) + return false; + + Vec3V minClosestA = mMinClosestA; + Vec3V minNormal = mMinNormal; + sweepHit.faceIndex = mMinTriangleIndex; + + if(mInitialOverlap) + { + bool hasContacts = false; + if(mHitFlags & PxHitFlag::eMTD) + hasContacts = computeBox_TriangleMeshMTD(triMeshGeom, pose, mBox, boxTransform, mInflation, mBothTriangleSidesCollide, sweepHit); + + setupSweepHitForMTD(sweepHit, hasContacts, mWorldUnitDir); + } + else + { + sweepHit.distance = mDist; + sweepHit.flags = PxHitFlag::eFACE_INDEX; + + // PT: we need the "best triangle" normal in order to call 'shouldFlipNormal'. We stored the best + // triangle in both GJK & precise codepaths (in box space). We use a dedicated 'shouldFlipNormal' + // function that delays computing the triangle normal. + // TODO: would still be more efficient to store the best normal directly, it's already computed at least + // in the GJK codepath. + + const Vec3V p0 = V3LoadU(&boxTransform.p.x); + const QuatV q0 = QuatVLoadU(&boxTransform.q.x); + const PxTransformV boxPos(p0, q0); + + if(mHitFlags & PxHitFlag::ePRECISE_SWEEP) + { + computeBoxLocalImpact(sweepHit.position, sweepHit.normal, sweepHit.flags, mBox, localDir, mHitTriangle, mHitFlags, isDoubleSided, meshBothSides, mDist); + } + else + { + sweepHit.flags |= PxHitFlag::eNORMAL|PxHitFlag::ePOSITION; + + // PT: now for the GJK path, we must first always negate the returned normal. Similar to what happens in the precise path, + // we can't delay this anymore: our normal must be properly oriented in order to call 'shouldFlipNormal'. + minNormal = V3Neg(minNormal); + + // PT: this one is to ensure the normal respects the mesh-both-sides/double-sided convention + PxVec3 tmp; + V3StoreU(minNormal, tmp); + + if(shouldFlipNormal(tmp, meshBothSides, isDoubleSided, mHitTriangle, localDir, NULL)) + minNormal = V3Neg(minNormal); + + // PT: finally, this moves everything back to world space + V3StoreU(boxPos.rotate(minNormal), sweepHit.normal); + V3StoreU(boxPos.transform(minClosestA), sweepHit.position); + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool sweepBox_MeshGeom(GU_BOX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(threadContext); + PX_UNUSED(boxPose_); + PX_UNUSED(boxGeom_); + + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + return Midphase::sweepBoxVsMesh(meshData, meshGeom, pose, box, unitDir, distance, sweepHit, hitFlags, inflation); +} + +/////////////////////////////////////////////////////////////////////////////// + +SweepConvexMeshHitCallback::SweepConvexMeshHitCallback( const ConvexHullData& hull, const PxMeshScale& convexScale, const FastVertex2ShapeScaling& meshScale, + const PxTransform& convexPose, const PxTransform& meshPose, + const PxVec3& unitDir, const PxReal distance, PxHitFlags hitFlags, const bool bothTriangleSidesCollide, const PxReal inflation, + const bool anyHit, float distCoef) : + SweepShapeMeshHitCallback (CallbackMode::eMULTIPLE, hitFlags, meshScale.flipsNormal(), distCoef), + mMeshScale (meshScale), + mUnitDir (unitDir), + mInflation (inflation), + mAnyHit (anyHit), + mBothTriangleSidesCollide (bothTriangleSidesCollide) +{ + mSweepHit.distance = distance; // this will be shrinking progressively as we sweep and clip the sweep length + mSweepHit.faceIndex = 0xFFFFFFFF; + + mMeshSpaceUnitDir = meshPose.rotateInv(unitDir); + + const Vec3V worldDir = V3LoadU(unitDir); + const FloatV dist = FLoad(distance); + const QuatV q0 = QuatVLoadU(&meshPose.q.x); + const Vec3V p0 = V3LoadU(&meshPose.p.x); + + const QuatV q1 = QuatVLoadU(&convexPose.q.x); + const Vec3V p1 = V3LoadU(&convexPose.p.x); + + const PxTransformV meshPoseV(p0, q0); + const PxTransformV convexPoseV(p1, q1); + + mMeshToConvex = convexPoseV.transformInv(meshPoseV); + mConvexPoseV = convexPoseV; + mConvexSpaceDir = convexPoseV.rotateInv(V3Neg(V3Scale(worldDir, dist))); + mInitialDistance = dist; + + const Vec3V vScale = V3LoadU_SafeReadW(convexScale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const QuatV vQuat = QuatVLoadU(&convexScale.rotation.x); + mConvexHull.initialize(&hull, V3Zero(), vScale, vQuat, convexScale.isIdentity()); +} + +PxAgain SweepConvexMeshHitCallback::processHit( // all reported coords are in mesh local space including hit.position + const PxGeomRaycastHit& hit, const PxVec3& av0, const PxVec3& av1, const PxVec3& av2, PxReal& shrunkMaxT, const PxU32*) +{ + const PxVec3 v0 = mMeshScale * av0; + const PxVec3 v1 = mMeshScale * (mFlipNormal ? av2 : av1); + const PxVec3 v2 = mMeshScale * (mFlipNormal ? av1 : av2); + + // mSweepHit will be updated if sweep distance is < input mSweepHit.distance + const PxReal oldDist = mSweepHit.distance; + if(sweepConvexVsTriangle( + v0, v1, v2, mConvexHull, mMeshToConvex, mConvexPoseV, mConvexSpaceDir, + mUnitDir, mMeshSpaceUnitDir, mInitialDistance, oldDist, mSweepHit, mBothTriangleSidesCollide, + mInflation, mInitialOverlap, hit.faceIndex)) + { + mStatus = true; + shrunkMaxT = mSweepHit.distance * mDistCoeff; // shrunkMaxT is scaled + + // PT: added for 'shouldFlipNormal' + mHitTriangle.verts[0] = v0; + mHitTriangle.verts[1] = v1; + mHitTriangle.verts[2] = v2; + + if(mAnyHit) + return false; // abort traversal + + if(mSweepHit.distance == 0.0f) + return false; + } + return true; // continue traversal +} + +bool SweepConvexMeshHitCallback::finalizeHit( PxGeomSweepHit& sweepHit, const PxTriangleMeshGeometry& meshGeom, const PxTransform& pose, + const PxConvexMeshGeometry& convexGeom, const PxTransform& convexPose, + const PxVec3& unitDir, PxReal inflation, + bool isMtd, bool meshBothSides, bool isDoubleSided, bool bothTriangleSidesCollide) +{ + if(!mStatus) + return false; + + if(mInitialOverlap) + { + bool hasContacts = false; + if(isMtd) + hasContacts = computeConvex_TriangleMeshMTD(meshGeom, pose, convexGeom, convexPose, inflation, bothTriangleSidesCollide, sweepHit); + + setupSweepHitForMTD(sweepHit, hasContacts, unitDir); + + sweepHit.faceIndex = mSweepHit.faceIndex; + } + else + { + sweepHit = mSweepHit; + //sweepHit.position += unitDir * sweepHit.distance; + sweepHit.normal = -sweepHit.normal; + sweepHit.normal.normalize(); + + // PT: this one is to ensure the normal respects the mesh-both-sides/double-sided convention + // PT: beware, the best triangle is in mesh-space, but the impact data is in world-space already + if(shouldFlipNormal(sweepHit.normal, meshBothSides, isDoubleSided, mHitTriangle, unitDir, &pose)) + sweepHit.normal = -sweepHit.normal; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool sweepConvex_MeshGeom(GU_CONVEX_SWEEP_FUNC_PARAMS) +{ + PX_ASSERT(geom.getType() == PxGeometryType::eTRIANGLEMESH); + PX_UNUSED(threadContext); + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + + ConvexMesh* convexMesh = static_cast(convexGeom.convexMesh); + TriangleMesh* meshData = static_cast(meshGeom.triangleMesh); + + const bool idtScaleConvex = convexGeom.scale.isIdentity(); + const bool idtScaleMesh = meshGeom.scale.isIdentity(); + + FastVertex2ShapeScaling convexScaling; + if(!idtScaleConvex) + convexScaling.init(convexGeom.scale); + + FastVertex2ShapeScaling meshScaling; + if(!idtScaleMesh) + meshScaling.init(meshGeom.scale); + + PX_ASSERT(!convexMesh->getLocalBoundsFast().isEmpty()); + const PxBounds3 hullAABB = convexMesh->getLocalBoundsFast().transformFast(convexScaling.getVertex2ShapeSkew()); + + Box hullOBB; + computeHullOBB(hullOBB, hullAABB, 0.0f, Matrix34FromTransform(convexPose), Matrix34FromTransform(pose), meshScaling, idtScaleMesh); + + hullOBB.extents.x += inflation; + hullOBB.extents.y += inflation; + hullOBB.extents.z += inflation; + + const PxVec3 localDir = pose.rotateInv(unitDir); + + // inverse transform the sweep direction and distance to mesh space + PxVec3 meshSpaceSweepVector = meshScaling.getShape2VertexSkew().transform(localDir*distance); + const PxReal meshSpaceSweepDist = meshSpaceSweepVector.normalize(); + + PxReal distCoeff = 1.0f; + if (!idtScaleMesh) + distCoeff = meshSpaceSweepDist / distance; + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool isDoubleSided = meshGeom.meshFlags & PxMeshGeometryFlag::eDOUBLE_SIDED; + const bool bothTriangleSidesCollide = isDoubleSided || meshBothSides; + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + SweepConvexMeshHitCallback callback( + convexMesh->getHull(), convexGeom.scale, meshScaling, convexPose, pose, -unitDir, distance, hitFlags, + bothTriangleSidesCollide, inflation, anyHit, distCoeff); + + Midphase::sweepConvexVsMesh(meshData, hullOBB, meshSpaceSweepVector, meshSpaceSweepDist, callback, anyHit); + + const bool isMtd = hitFlags & PxHitFlag::eMTD; + return callback.finalizeHit(sweepHit, meshGeom, pose, convexGeom, convexPose, unitDir, inflation, isMtd, meshBothSides, isDoubleSided, bothTriangleSidesCollide); +} + +/////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedron.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedron.h new file mode 100644 index 0000000..28a3304 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedron.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TETRAHEDRON_H +#define GU_TETRAHEDRON_H + +#include "foundation/PxVec3.h" +#include "foundation/PxUtilities.h" +#include "GuTriangle.h" + +namespace physx +{ + namespace Gu + { + /** + \brief Structure used to store indices for a triangles points. T is either PxU32 or PxU16 + + */ + + template + struct TetrahedronT// : public PxUserAllocated + { + PX_INLINE TetrahedronT() {} + PX_INLINE TetrahedronT(T a, T b, T c, T d) { v[0] = a; v[1] = b; v[2] = c; v[3] = d; } + template + PX_INLINE TetrahedronT(const TetrahedronT& other) { v[0] = other[0]; v[1] = other[1]; v[2] = other[2]; } + PX_INLINE T& operator[](T i) { return v[i]; } + template//any type of TriangleT<>, possibly with different T + PX_INLINE TetrahedronT& operator=(const TetrahedronT& i) { v[0] = i[0]; v[1] = i[1]; v[2] = i[2]; v[3] = i[3]; return *this; } + PX_INLINE const T& operator[](T i) const { return v[i]; } + + PX_INLINE PxI32 indexOf(T i) const + { + if (v[0] == i) return 0; + if (v[1] == i) return 1; + if (v[2] == i) return 2; + if (v[3] == i) return 3; + return -1; + } + + PX_INLINE bool contains(T id) const + { + return v[0] == id || v[1] == id || v[2] == id || v[3] == id; + } + + PX_INLINE void replace(T oldId, T newId) + { + if (v[0] == oldId) v[0] = newId; + if (v[1] == oldId) v[1] = newId; + if (v[2] == oldId) v[2] = newId; + if (v[3] == oldId) v[3] = newId; + } + + PX_INLINE void sort() + { + if (v[0] > v[1]) PxSwap(v[0], v[1]); + if (v[2] > v[3]) PxSwap(v[2], v[3]); + if (v[0] > v[2]) PxSwap(v[0], v[2]); + if (v[1] > v[3]) PxSwap(v[1], v[3]); + if (v[1] > v[2]) PxSwap(v[1], v[2]); + } + + PX_INLINE bool containsFace(const Gu::IndexedTriangleT& triangle) const + { + return contains(triangle[0]) && contains(triangle[1]) && contains(triangle[2]); + } + + PX_INLINE static bool identical(Gu::TetrahedronT x, Gu::TetrahedronT y) + { + x.sort(); + y.sort(); + return x.v[0] == y.v[0] && x.v[1] == y.v[1] && x.v[2] == y.v[2] && x.v[3] == y.v[3]; + } + + T v[4]; //vertex indices + }; + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp new file mode 100644 index 0000000..28b939a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.cpp @@ -0,0 +1,324 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuMidphaseInterface.h" +#include "GuTetrahedronMesh.h" +#include "GuBox.h" + +using namespace physx; +using namespace Gu; + +void TetrahedronMesh::onRefCountZero() +{ + if (mMeshFactory) + { + ::onRefCountZero(this, mMeshFactory, false, "PxTetrahedronMesh::release: double deletion detected!"); + } +} + +void SoftBodyMesh::onRefCountZero() +{ + if (mMeshFactory) + { + ::onRefCountZero(this, mMeshFactory, false, "PxSoftBodyMesh::release: double deletion detected!"); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +SoftBodyAuxData::SoftBodyAuxData(SoftBodySimulationData& d, SoftBodyCollisionData& c, CollisionMeshMappingData& e) + : PxSoftBodyAuxData(PxType(PxConcreteType::eSOFT_BODY_STATE), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mGridModelInvMass(d.mGridModelInvMass) + , mGridModelTetraRestPoses(d.mGridModelTetraRestPoses) + , mGridModelOrderedTetrahedrons(d.mGridModelOrderedTetrahedrons) + , mGMNbPartitions(d.mGridModelNbPartitions) + , mGMMaxMaxTetsPerPartitions(d.mGridModelMaxTetsPerPartitions) + , mGMRemapOutputSize(d.mGMRemapOutputSize) + , mGMRemapOutputCP(d.mGMRemapOutputCP) + , mGMAccumulatedPartitionsCP(d.mGMAccumulatedPartitionsCP) + , mGMAccumulatedCopiesCP(d.mGMAccumulatedCopiesCP) + , mCollisionAccumulatedTetrahedronsRef(e.mCollisionAccumulatedTetrahedronsRef) + , mCollisionTetrahedronsReferences(e.mCollisionTetrahedronsReferences) + , mCollisionNbTetrahedronsReferences(e.mCollisionNbTetrahedronsReferences) + , mCollisionSurfaceVertsHint(e.mCollisionSurfaceVertsHint) + , mCollisionSurfaceVertToTetRemap(e.mCollisionSurfaceVertToTetRemap) + , mVertsBarycentricInGridModel(e.mVertsBarycentricInGridModel) + , mVertsRemapInGridModel(e.mVertsRemapInGridModel) + , mTetsRemapColToSim(e.mTetsRemapColToSim) + , mTetsRemapSize(e.mTetsRemapSize) + , mTetsAccumulatedRemapColToSim(e.mTetsAccumulatedRemapColToSim) + + , mGMPullIndices(d.mGMPullIndices) + , mTetraRestPoses(c.mTetraRestPoses) + , mNumTetsPerElement(d.mNumTetsPerElement) + +{ + // this constructor takes ownership of memory from the data object + d.mGridModelInvMass = 0; + d.mGridModelTetraRestPoses = 0; + d.mGridModelOrderedTetrahedrons = 0; + d.mGMRemapOutputCP = 0; + d.mGMAccumulatedPartitionsCP = 0; + d.mGMAccumulatedCopiesCP = 0; + e.mCollisionAccumulatedTetrahedronsRef = 0; + e.mCollisionTetrahedronsReferences = 0; + e.mCollisionSurfaceVertsHint = 0; + e.mCollisionSurfaceVertToTetRemap = 0; + d.mGMPullIndices = 0; + + e.mVertsBarycentricInGridModel = 0; + e.mVertsRemapInGridModel = 0; + e.mTetsRemapColToSim = 0; + e.mTetsAccumulatedRemapColToSim = 0; + + c.mTetraRestPoses = 0; +} + +SoftBodyAuxData::~SoftBodyAuxData() +{ + PX_FREE(mGridModelInvMass); + + PX_FREE(mGridModelTetraRestPoses); + PX_FREE(mGridModelOrderedTetrahedrons); + PX_FREE(mGMRemapOutputCP); + PX_FREE(mGMAccumulatedPartitionsCP); + PX_FREE(mGMAccumulatedCopiesCP); + PX_FREE(mCollisionAccumulatedTetrahedronsRef); + PX_FREE(mCollisionTetrahedronsReferences); + PX_FREE(mCollisionSurfaceVertsHint); + PX_FREE(mCollisionSurfaceVertToTetRemap); + + PX_FREE(mVertsBarycentricInGridModel); + PX_FREE(mVertsRemapInGridModel); + PX_FREE(mTetsRemapColToSim); + PX_FREE(mTetsAccumulatedRemapColToSim); + + PX_FREE(mGMPullIndices); + PX_FREE(mTetraRestPoses); +} + +TetrahedronMesh::TetrahedronMesh(PxU32 nbVertices, PxVec3* vertices, PxU32 nbTetrahedrons, void* tetrahedrons, PxU8 flags, PxBounds3 aabb, PxReal geomEpsilon) + : PxTetrahedronMesh(PxType(PxConcreteType::eTETRAHEDRON_MESH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mNbVertices(nbVertices) + , mVertices(vertices) + , mNbTetrahedrons(nbTetrahedrons) + , mTetrahedrons(tetrahedrons) + , mFlags(flags) + , mMaterialIndices(NULL) + , mAABB(aabb) + , mGeomEpsilon(geomEpsilon) +{ +} + +TetrahedronMesh::TetrahedronMesh(TetrahedronMeshData& mesh) + : PxTetrahedronMesh(PxType(PxConcreteType::eTETRAHEDRON_MESH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mNbVertices(mesh.mNbVertices) + , mVertices(mesh.mVertices) + , mNbTetrahedrons(mesh.mNbTetrahedrons) + , mTetrahedrons(mesh.mTetrahedrons) + , mFlags(mesh.mFlags) + , mMaterialIndices(mesh.mMaterialIndices) + , mAABB(mesh.mAABB) + , mGeomEpsilon(mesh.mGeomEpsilon) +{ + // this constructor takes ownership of memory from the data object + mesh.mVertices = 0; + mesh.mTetrahedrons = 0; + mesh.mMaterialIndices = 0; +} + +TetrahedronMesh::TetrahedronMesh(MeshFactory* meshFactory, TetrahedronMeshData& mesh) + : PxTetrahedronMesh(PxType(PxConcreteType::eTETRAHEDRON_MESH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mNbVertices(mesh.mNbVertices) + , mVertices(mesh.mVertices) + , mNbTetrahedrons(mesh.mNbTetrahedrons) + , mTetrahedrons(mesh.mTetrahedrons) + , mFlags(mesh.mFlags) + , mMaterialIndices(mesh.mMaterialIndices) + , mAABB(mesh.mAABB) + , mGeomEpsilon(mesh.mGeomEpsilon) + , mMeshFactory(meshFactory) +{ + // this constructor takes ownership of memory from the data object + mesh.mVertices = 0; + mesh.mTetrahedrons = 0; + mesh.mMaterialIndices = 0; +} + +TetrahedronMesh::~TetrahedronMesh() +{ + PX_FREE(mTetrahedrons); + PX_FREE(mVertices); + PX_FREE(mMaterialIndices); +} + +BVTetrahedronMesh::BVTetrahedronMesh(TetrahedronMeshData& mesh, SoftBodyCollisionData& d, MeshFactory* factory) : TetrahedronMesh(mesh) +, mFaceRemap(d.mFaceRemap) +, mGRB_tetraIndices(d.mGRB_primIndices) +, mGRB_tetraSurfaceHint(d.mGRB_tetraSurfaceHint) +, mGRB_faceRemap(d.mGRB_faceRemap) +, mGRB_faceRemapInverse(d.mGRB_faceRemapInverse) +, mGRB_BV32Tree(d.mGRB_BV32Tree) +{ + mMeshFactory = factory; + + bool has16BitIndices = (mesh.mFlags & PxMeshFlag::e16_BIT_INDICES) ? true : false; + + mMeshInterface4.mVerts = mVertices; // mesh.mVertices; + mMeshInterface4.mNbVerts = mesh.mNbVertices; + mMeshInterface4.mNbTetrahedrons = mesh.mNbTetrahedrons; + mMeshInterface4.mTetrahedrons16 = has16BitIndices ? reinterpret_cast(mTetrahedrons/*mesh.mTetrahedrons*/) : NULL; + mMeshInterface4.mTetrahedrons32 = has16BitIndices ? NULL : reinterpret_cast(mTetrahedrons/*mesh.mTetrahedrons*/); + + mBV4Tree = d.mBV4Tree; + mBV4Tree.mMeshInterface = &mMeshInterface4; + + if (mGRB_BV32Tree) + { + mMeshInterface32.mVerts = mVertices; // mesh.mVertices; + mMeshInterface32.mNbVerts = mesh.mNbVertices; + mMeshInterface32.mNbTetrahedrons = mesh.mNbTetrahedrons; + mMeshInterface32.mTetrahedrons16 = has16BitIndices ? reinterpret_cast(d.mGRB_primIndices) : NULL; + mMeshInterface32.mTetrahedrons32 = has16BitIndices ? NULL : reinterpret_cast(d.mGRB_primIndices); + + mGRB_BV32Tree->mMeshInterface = &mMeshInterface32; + } + + // this constructor takes ownership of memory from the data object + d.mGRB_tetraSurfaceHint = NULL; + d.mFaceRemap = NULL; + + d.mGRB_primIndices = NULL; + d.mGRB_faceRemap = NULL; + d.mGRB_faceRemapInverse = NULL; + d.mGRB_BV32Tree = NULL; + + mesh.mVertices = NULL; + mesh.mTetrahedrons = NULL; +} + +SoftBodyMesh::SoftBodyMesh(MeshFactory* factory, SoftBodyMeshData& d) + : PxSoftBodyMesh(PxType(PxConcreteType::eSOFTBODY_MESH), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mMeshFactory(factory) +{ + mSoftBodyAuxData = PX_NEW(SoftBodyAuxData)(d.mSimulationData, d.mCollisionData, d.mMappingData); + mCollisionMesh = PX_NEW(BVTetrahedronMesh)(d.mCollisionMesh, d.mCollisionData, factory); + mSimulationMesh = PX_NEW(TetrahedronMesh)(factory, d.mSimulationMesh); +} + +SoftBodyMesh::~SoftBodyMesh() +{ + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_DELETE(mSoftBodyAuxData); + PX_DELETE(mCollisionMesh); + PX_DELETE(mSimulationMesh); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// PT: used to be automatic but making it manual saves bytes in the internal mesh + +void SoftBodyMesh::exportExtraData(PxSerializationContext& stream) +{ + //PX_DEFINE_DYNAMIC_ARRAY(TriangleMesh, mVertices, PxField::eVEC3, mNbVertices, Ps::PxFieldFlag::eSERIALIZE), + if (getCollisionMeshFast()->mVertices) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(getCollisionMeshFast()->mVertices, getCollisionMeshFast()->mNbVertices * sizeof(PxVec3)); + } + + /*if (mSurfaceTriangles) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mSurfaceTriangles, mNbTriangles * 3 * sizeof(PxU32)); + }*/ + + if (getCollisionMeshFast()->mTetrahedrons) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(getCollisionMeshFast()->mTetrahedrons, getCollisionMeshFast()->mNbTetrahedrons * 4 * sizeof(PxU32)); + } + + /*if (mTetSurfaceHint) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mTetSurfaceHint, mNbTetrahedrons * sizeof(PxU8)); + }*/ + + if (getCollisionMeshFast()->mMaterialIndices) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(getCollisionMeshFast()->mMaterialIndices, getCollisionMeshFast()->mNbTetrahedrons * sizeof(PxU16)); + } + + if (getCollisionMeshFast()->mFaceRemap) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(getCollisionMeshFast()->mFaceRemap, getCollisionMeshFast()->mNbTetrahedrons * sizeof(PxU32)); + } +} + +void SoftBodyMesh::importExtraData(PxDeserializationContext& context) +{ + // PT: vertices are followed by indices, so it will be safe to V4Load vertices from a deserialized binary file + if (getCollisionMeshFast()->mVertices) + getCollisionMeshFast()->mVertices = context.readExtraData(getCollisionMeshFast()->mNbVertices); + + if (getCollisionMeshFast()->mTetrahedrons) + getCollisionMeshFast()->mTetrahedrons = context.readExtraData(4 * getCollisionMeshFast()->mNbTetrahedrons); + + if (getCollisionMeshFast()->mFaceRemap) + getCollisionMeshFast()->mFaceRemap = context.readExtraData(getCollisionMeshFast()->mNbTetrahedrons); + + getCollisionMeshFast()->mGRB_tetraIndices = NULL; + getCollisionMeshFast()->mGRB_tetraSurfaceHint = NULL; + getCollisionMeshFast()->mGRB_faceRemap = NULL; + getCollisionMeshFast()->mGRB_faceRemapInverse = NULL; + getCollisionMeshFast()->mGRB_BV32Tree = NULL; +} + +void SoftBodyMesh::release() +{ + Cm::RefCountable_decRefCount(*this); +} + +//PxVec3* TetrahedronMesh::getVerticesForModification() +//{ +// PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxSoftBodyMesh::getVerticesForModification() is not currently supported."); +// +// return NULL; +//} + +//PxBounds3 BVTetrahedronMesh::refitBVH() +//{ +// PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxSoftBodyMesh::refitBVH() is not currently supported."); +// +// return PxBounds3(mAABB.getMin(), mAABB.getMax()); +//} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.h new file mode 100644 index 0000000..3ce4377 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTetrahedronMesh.h @@ -0,0 +1,299 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TETRAHEDRONMESH_H +#define GU_TETRAHEDRONMESH_H + +#include "foundation/PxIO.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTetrahedron.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "CmRefCountable.h" +#include "common/PxRenderOutput.h" +#include "GuMeshData.h" +#include "GuCenterExtents.h" +#include "GuMeshFactory.h" + +namespace physx +{ + namespace Gu + { + class MeshFactory; +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + class SoftBodyAuxData : public PxSoftBodyAuxData, public PxUserAllocated + { + public: + SoftBodyAuxData(SoftBodySimulationData& d, SoftBodyCollisionData& c, CollisionMeshMappingData& e); + + virtual ~SoftBodyAuxData(); + + virtual const char* getConcreteTypeName() const { return "PxSoftBodyAuxData"; } + + virtual void acquireReference() { Cm::RefCountable_incRefCount(*this); } + virtual PxU32 getReferenceCount() const { return Cm::RefCountable_getRefCount(*this); } + virtual void release() { Cm::RefCountable_decRefCount(*this); } + virtual void onRefCountZero() { PX_DELETE_THIS; } + + PX_FORCE_INLINE PxU32 getNbTetRemapSizeFast() const { return mTetsRemapSize; } + PX_FORCE_INLINE PxReal* getGridModelInvMassFast() { return mGridModelInvMass; } + PX_FORCE_INLINE PxU32 getNbGMPartitionFast() const { return mGMNbPartitions; } + + PX_FORCE_INLINE PxU32 getGMRemapOutputSizeFast() const { return mGMRemapOutputSize; } + PX_FORCE_INLINE PxU32 getGMMaxTetsPerPartitionsFast() const { return mGMMaxMaxTetsPerPartitions; } + + + PX_FORCE_INLINE PxU32* getCollisionAccumulatedTetrahedronRefs() const { return mCollisionAccumulatedTetrahedronsRef; } + PX_FORCE_INLINE PxU32* getCollisionTetrahedronRefs() const { return mCollisionTetrahedronsReferences; } + PX_FORCE_INLINE PxU32 getCollisionNbTetrahedronRefs() const { return mCollisionNbTetrahedronsReferences; } + + PX_FORCE_INLINE PxU32* getCollisionSurfaceVertToTetRemap() const { return mCollisionSurfaceVertToTetRemap; } + PX_FORCE_INLINE PxMat33* getGridModelRestPosesFast() { return mGridModelTetraRestPoses; } + PX_FORCE_INLINE PxMat33* getRestPosesFast() { return mTetraRestPoses; } + + float* mGridModelInvMass; + + PxMat33* mGridModelTetraRestPoses; + PxU32* mGridModelOrderedTetrahedrons; + + + PxU32 mGMNbPartitions; + PxU32 mGMMaxMaxTetsPerPartitions; + PxU32 mGMRemapOutputSize; + PxU32* mGMRemapOutputCP; + + PxU32* mGMAccumulatedPartitionsCP; + PxU32* mGMAccumulatedCopiesCP; + + PxU32* mCollisionAccumulatedTetrahedronsRef; + PxU32* mCollisionTetrahedronsReferences; + PxU32 mCollisionNbTetrahedronsReferences; + + PxU8* mCollisionSurfaceVertsHint; + PxU32* mCollisionSurfaceVertToTetRemap; + + PxReal* mVertsBarycentricInGridModel; + PxU32* mVertsRemapInGridModel; + + + PxU32* mTetsRemapColToSim; + PxU32 mTetsRemapSize; + PxU32* mTetsAccumulatedRemapColToSim; + + PxU32* mGMPullIndices; + + PxMat33* mTetraRestPoses; + + PxU32 mNumTetsPerElement; + }; + + class TetrahedronMesh : public PxTetrahedronMesh, public PxUserAllocated + { + public: + TetrahedronMesh(PxU32 nbVertices, PxVec3* vertices, PxU32 nbTetrahedrons, void* tetrahedrons, PxU8 flags, PxBounds3 aabb, PxReal geomEpsilon); + TetrahedronMesh(TetrahedronMeshData& mesh); + TetrahedronMesh(MeshFactory* meshFactory, TetrahedronMeshData& mesh); + virtual ~TetrahedronMesh(); + + virtual const char* getConcreteTypeName() const { return "PxTetrahedronMesh"; } + + virtual void acquireReference() { Cm::RefCountable_incRefCount(*this); } + virtual PxU32 getReferenceCount() const { return Cm::RefCountable_getRefCount(*this); } + virtual void release() { Cm::RefCountable_decRefCount(*this); } + virtual void onRefCountZero(); + + virtual PxU32 getNbVertices() const { return mNbVertices; } + virtual const PxVec3* getVertices() const { return mVertices; } + virtual PxU32 getNbTetrahedrons() const { return mNbTetrahedrons; } + virtual const void* getTetrahedrons() const { return mTetrahedrons; } + virtual PxTetrahedronMeshFlags getTetrahedronMeshFlags() const { return PxTetrahedronMeshFlags(mFlags); } + virtual const PxU32* getTetrahedraRemap() const { return NULL; } + + PX_FORCE_INLINE PxU32 getNbVerticesFast() const { return mNbVertices; } + PX_FORCE_INLINE PxVec3* getVerticesFast() const { return mVertices; } + PX_FORCE_INLINE PxU32 getNbTetrahedronsFast() const { return mNbTetrahedrons; } + PX_FORCE_INLINE const void* getTetrahedronsFast() const { return mTetrahedrons; } + PX_FORCE_INLINE bool has16BitIndices() const { return (mFlags & PxMeshFlag::e16_BIT_INDICES) ? true : false; } + PX_FORCE_INLINE bool hasPerTriangleMaterials() const { return mMaterialIndices != NULL; } + PX_FORCE_INLINE const PxU16* getMaterials() const { return mMaterialIndices; } + + PX_FORCE_INLINE const CenterExtents& getLocalBoundsFast() const { return mAABB; } + + PX_FORCE_INLINE const CenterExtentsPadded& getPaddedBounds() const + { + // PT: see compile-time assert in cpp + return static_cast(mAABB); + } + + virtual PxBounds3 getLocalBounds() const + { + PX_ASSERT(mAABB.isValid()); + return PxBounds3::centerExtents(mAABB.mCenter, mAABB.mExtents); + } + + PxU32 mNbVertices; + PxVec3* mVertices; + PxU32 mNbTetrahedrons; + void* mTetrahedrons; + + PxU8 mFlags; //!< Flag whether indices are 16 or 32 bits wide + + PxU16* mMaterialIndices; //!< the size of the array is mNbTetrahedrons. + + // PT: WARNING: bounds must be followed by at least 32bits of data for safe SIMD loading + CenterExtents mAABB; + PxReal mGeomEpsilon; + + MeshFactory* mMeshFactory; // PT: changed to pointer for serialization + }; + + PX_FORCE_INLINE const Gu::TetrahedronMesh* _getTetraMeshData(const PxTetrahedronMeshGeometry& meshGeom) + { + return static_cast(meshGeom.tetrahedronMesh); + } + + class BVTetrahedronMesh : public TetrahedronMesh + { + public: + BVTetrahedronMesh(TetrahedronMeshData& mesh, SoftBodyCollisionData& d, MeshFactory* factory = NULL); + + virtual ~BVTetrahedronMesh() + { + PX_FREE(mGRB_tetraIndices); + PX_FREE(mGRB_tetraSurfaceHint); + PX_FREE(mGRB_faceRemap); + PX_FREE(mGRB_faceRemapInverse); + PX_DELETE(mGRB_BV32Tree); + PX_FREE(mFaceRemap); + } + + //virtual PxBounds3 refitBVH(); + + PX_FORCE_INLINE const Gu::BV4Tree& getBV4Tree() const { return mBV4Tree; } + + PX_FORCE_INLINE Gu::BV4Tree& getBV4Tree() { return mBV4Tree; } + + PX_FORCE_INLINE void* getGRBTetraFaceRemap() { return mGRB_faceRemap; } + + PX_FORCE_INLINE void* getGRBTetraFaceRemapInverse() { return mGRB_faceRemapInverse; } + + virtual const PxU32* getTetrahedraRemap() const { return mFaceRemap; } + + PX_FORCE_INLINE bool isTetMeshGPUCompatible() const + { + return mGRB_BV32Tree != NULL; + } + + PxU32* mFaceRemap; //!< new faces to old faces mapping (after cleaning, etc). Usage: old = faceRemap[new] + + // GRB data ------------------------- + void* mGRB_tetraIndices; //!< GRB: GPU-friendly tri indices [uint4] + PxU8* mGRB_tetraSurfaceHint; + PxU32* mGRB_faceRemap; + PxU32* mGRB_faceRemapInverse; + Gu::BV32Tree* mGRB_BV32Tree; //!< GRB: BV32 tree + + private: + Gu::TetrahedronSourceMesh mMeshInterface4; + Gu::BV4Tree mBV4Tree; + Gu::TetrahedronSourceMesh mMeshInterface32; + }; + + // Possible optimization: align the whole struct to cache line + class SoftBodyMesh : public PxSoftBodyMesh, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + + virtual const char* getConcreteTypeName() const { return "PxSoftBodyMesh"; } + + // PX_SERIALIZATION + virtual void exportExtraData(PxSerializationContext& ctx); + void importExtraData(PxDeserializationContext&); + //PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); + virtual void release(); + + void resolveReferences(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + + virtual void acquireReference() { Cm::RefCountable_incRefCount(*this); } + virtual PxU32 getReferenceCount() const { return Cm::RefCountable_getRefCount(*this); } + virtual void onRefCountZero(); + + //virtual PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH34; } + + SoftBodyMesh(MeshFactory* factory, SoftBodyMeshData& data); + + virtual ~SoftBodyMesh(); + + void setMeshFactory(MeshFactory* factory) { mMeshFactory = factory; } + + virtual const PxTetrahedronMesh* getCollisionMesh() const { return mCollisionMesh; } + virtual PxTetrahedronMesh* getCollisionMesh() { return mCollisionMesh; } + + PX_FORCE_INLINE const BVTetrahedronMesh* getCollisionMeshFast() const { return mCollisionMesh; } + PX_FORCE_INLINE BVTetrahedronMesh* getCollisionMeshFast() { return mCollisionMesh; } + + virtual const PxTetrahedronMesh* getSimulationMesh() const { return mSimulationMesh; } + virtual PxTetrahedronMesh* getSimulationMesh() { return mSimulationMesh; } + + PX_FORCE_INLINE const TetrahedronMesh* getSimulationMeshFast() const { return mSimulationMesh; } + PX_FORCE_INLINE TetrahedronMesh* getSimulationMeshFast() { return mSimulationMesh; } + + virtual const PxSoftBodyAuxData* getSoftBodyAuxData() const { return mSoftBodyAuxData; } + virtual PxSoftBodyAuxData* getSoftBodyAuxData() { return mSoftBodyAuxData; } + + PX_FORCE_INLINE const SoftBodyAuxData* getSoftBodyAuxDataFast() const { return mSoftBodyAuxData; } + PX_FORCE_INLINE SoftBodyAuxData* getSoftBodyAuxDataFast() { return mSoftBodyAuxData; } + + protected: + TetrahedronMesh* mSimulationMesh; + BVTetrahedronMesh* mCollisionMesh; + SoftBodyAuxData* mSoftBodyAuxData; + + MeshFactory* mMeshFactory; // PT: changed to pointer for serialization + }; + +#if PX_VC +#pragma warning(pop) +#endif + + } // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangle.h new file mode 100644 index 0000000..e2b6c31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangle.h @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TRIANGLE_H +#define GU_TRIANGLE_H + +#include "foundation/PxVec3.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Gu +{ + // PT: I'm taking back control of these files and re-introducing the "ICE" naming conventions: + // - "Triangle" is for actual triangles (like the PxTriangle class) + // - If it contains vertex indices, it's "IndexedTriangle". + // - "v" is too ambiguous (it could be either an actual vertex or a vertex reference) so use "ref" instead. + // Plus we sometimes reference edges, not vertices, so "v" is too restrictive. + + template + struct IndexedTriangleT : public PxUserAllocated + { + PX_INLINE IndexedTriangleT () {} + PX_INLINE IndexedTriangleT (T a, T b, T c) { mRef[0] = a; mRef[1] = b; mRef[2] = c; } + template + PX_INLINE IndexedTriangleT (const IndexedTriangleT & other) { mRef[0] = other[0]; mRef[1] = other[1]; mRef[2] = other[2]; } + + PX_INLINE T& operator[](T i) { return mRef[i]; } + PX_INLINE const T& operator[](T i) const { return mRef[i]; } + + template//any type of IndexedTriangleT <>, possibly with different T + PX_INLINE IndexedTriangleT & operator=(const IndexedTriangleT & i) { mRef[0]=i[0]; mRef[1]=i[1]; mRef[2]=i[2]; return *this; } + + void flip() + { + PxSwap(mRef[1], mRef[2]); + } + + PX_INLINE bool contains(T id) const + { + return mRef[0] == id || mRef[1] == id || mRef[2] == id; + } + + PX_INLINE void center(const PxVec3* verts, PxVec3& center) const + { + const PxVec3& p0 = verts[mRef[0]]; + const PxVec3& p1 = verts[mRef[1]]; + const PxVec3& p2 = verts[mRef[2]]; + center = (p0+p1+p2)*0.33333333333333333333f; + } + + float area(const PxVec3* verts) const + { + const PxVec3& p0 = verts[mRef[0]]; + const PxVec3& p1 = verts[mRef[1]]; + const PxVec3& p2 = verts[mRef[2]]; + return ((p0-p1).cross(p0-p2)).magnitude() * 0.5f; + } + + PxU8 findEdge(T vref0, T vref1) const + { + if(mRef[0]==vref0 && mRef[1]==vref1) return 0; + else if(mRef[0]==vref1 && mRef[1]==vref0) return 0; + else if(mRef[0]==vref0 && mRef[2]==vref1) return 1; + else if(mRef[0]==vref1 && mRef[2]==vref0) return 1; + else if(mRef[1]==vref0 && mRef[2]==vref1) return 2; + else if(mRef[1]==vref1 && mRef[2]==vref0) return 2; + return 0xff; + } + + // counter clock wise order + PxU8 findEdgeCCW(T vref0, T vref1) const + { + if(mRef[0]==vref0 && mRef[1]==vref1) return 0; + else if(mRef[0]==vref1 && mRef[1]==vref0) return 0; + else if(mRef[0]==vref0 && mRef[2]==vref1) return 2; + else if(mRef[0]==vref1 && mRef[2]==vref0) return 2; + else if(mRef[1]==vref0 && mRef[2]==vref1) return 1; + else if(mRef[1]==vref1 && mRef[2]==vref0) return 1; + return 0xff; + } + + bool replaceVertex(T oldref, T newref) + { + if(mRef[0]==oldref) { mRef[0] = newref; return true; } + else if(mRef[1]==oldref) { mRef[1] = newref; return true; } + else if(mRef[2]==oldref) { mRef[2] = newref; return true; } + return false; + } + + bool isDegenerate() const + { + if(mRef[0]==mRef[1]) return true; + if(mRef[1]==mRef[2]) return true; + if(mRef[2]==mRef[0]) return true; + return false; + } + + PX_INLINE void denormalizedNormal(const PxVec3* verts, PxVec3& normal) const + { + const PxVec3& p0 = verts[mRef[0]]; + const PxVec3& p1 = verts[mRef[1]]; + const PxVec3& p2 = verts[mRef[2]]; + normal = ((p2 - p1).cross(p0 - p1)); + } + + T mRef[3]; //vertex indices + }; + + typedef IndexedTriangleT IndexedTriangle32; + typedef IndexedTriangleT IndexedTriangle16; + + PX_COMPILE_TIME_ASSERT(sizeof(IndexedTriangle32)==12); + PX_COMPILE_TIME_ASSERT(sizeof(IndexedTriangle16)==6); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleCache.h new file mode 100644 index 0000000..a892ba9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleCache.h @@ -0,0 +1,239 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TRIANGLE_CACHE_H +#define GU_TRIANGLE_CACHE_H +#include "foundation/PxHash.h" +#include "foundation/PxUtilities.h" + +namespace physx +{ + namespace Gu + { + struct CachedEdge + { + protected: + PxU32 mId0, mId1; + public: + CachedEdge(PxU32 i0, PxU32 i1) + { + mId0 = PxMin(i0, i1); + mId1 = PxMax(i0, i1); + } + + CachedEdge() + { + } + + PxU32 getId0() const { return mId0; } + PxU32 getId1() const { return mId1; } + + bool operator == (const CachedEdge& other) const + { + return mId0 == other.mId0 && mId1 == other.mId1; + } + + PxU32 getHashCode() const + { + return PxComputeHash(mId0 << 16 | mId1); + } + }; + + struct CachedVertex + { + private: + PxU32 mId; + public: + CachedVertex(PxU32 id) + { + mId = id; + } + + CachedVertex() + { + } + + PxU32 getId() const { return mId; } + + PxU32 getHashCode() const + { + return mId; + } + + bool operator == (const CachedVertex& other) const + { + return mId == other.mId; + } + }; + + template + struct CacheMap + { + PX_COMPILE_TIME_ASSERT(MaxCount < 0xFF); + Elem mCache[MaxCount]; + PxU8 mNextInd[MaxCount]; + PxU8 mIndex[MaxCount]; + PxU32 mSize; + + CacheMap() : mSize(0) + { + for(PxU32 a = 0; a < MaxCount; ++a) + { + mIndex[a] = 0xFF; + } + } + + bool addData(const Elem& data) + { + if(mSize == MaxCount) + return false; + + const PxU8 hash = PxU8(data.getHashCode() % MaxCount); + + PxU8 index = hash; + PxU8 nextInd = mIndex[hash]; + while(nextInd != 0xFF) + { + index = nextInd; + if(mCache[index] == data) + return false; + nextInd = mNextInd[nextInd]; + } + + if(mIndex[hash] == 0xFF) + { + mIndex[hash] = PxTo8(mSize); + } + else + { + mNextInd[index] = PxTo8(mSize); + } + mNextInd[mSize] = 0xFF; + mCache[mSize++] = data; + return true; + } + + bool contains(const Elem& data) const + { + PxU32 hash = (data.getHashCode() % MaxCount); + PxU8 index = mIndex[hash]; + + while(index != 0xFF) + { + if(mCache[index] == data) + return true; + index = mNextInd[index]; + } + return false; + } + + const Elem* get(const Elem& data) const + { + PxU32 hash = (data.getHashCode() % MaxCount); + PxU8 index = mIndex[hash]; + + while(index != 0xFF) + { + if(mCache[index] == data) + return &mCache[index]; + index = mNextInd[index]; + } + return NULL; + } + }; + + template + struct TriangleCache + { + PxVec3 mVertices[3*MaxTriangles]; + PxU32 mIndices[3*MaxTriangles]; + PxU32 mTriangleIndex[MaxTriangles]; + PxU8 mEdgeFlags[MaxTriangles]; + PxU32 mNumTriangles; + + TriangleCache() : mNumTriangles(0) + { + } + + PX_FORCE_INLINE bool isEmpty() const { return mNumTriangles == 0; } + PX_FORCE_INLINE bool isFull() const { return mNumTriangles == MaxTriangles; } + PX_FORCE_INLINE void reset() { mNumTriangles = 0; } + + void addTriangle(const PxVec3* verts, const PxU32* indices, PxU32 triangleIndex, PxU8 edgeFlag) + { + PX_ASSERT(mNumTriangles < MaxTriangles); + PxU32 triInd = mNumTriangles++; + PxU32 triIndMul3 = triInd*3; + mVertices[triIndMul3] = verts[0]; + mVertices[triIndMul3+1] = verts[1]; + mVertices[triIndMul3+2] = verts[2]; + mIndices[triIndMul3] = indices[0]; + mIndices[triIndMul3+1] = indices[1]; + mIndices[triIndMul3+2] = indices[2]; + mTriangleIndex[triInd] = triangleIndex; + mEdgeFlags[triInd] = edgeFlag; + } + }; + + template + struct TetrahedronCache + { + PxVec3 mVertices[4 * MaxTetrahedrons]; + PxU32 mTetVertIndices[4 * MaxTetrahedrons]; + PxU32 mTetrahedronIndices[MaxTetrahedrons]; + PxU32 mNumTetrahedrons; + + TetrahedronCache() : mNumTetrahedrons(0) + { + } + + PX_FORCE_INLINE bool isEmpty() const { return mNumTetrahedrons == 0; } + PX_FORCE_INLINE bool isFull() const { return mNumTetrahedrons == MaxTetrahedrons; } + PX_FORCE_INLINE void reset() { mNumTetrahedrons = 0; } + + void addTetrahedrons(const PxVec3* verts, const PxU32* indices, PxU32 tetIndex) + { + PX_ASSERT(mNumTetrahedrons < MaxTetrahedrons); + PxU32 tetInd = mNumTetrahedrons++; + PxU32 tetIndMul4 = tetInd * 4; + mVertices[tetIndMul4] = verts[0]; + mVertices[tetIndMul4 + 1] = verts[1]; + mVertices[tetIndMul4 + 2] = verts[2]; + mVertices[tetIndMul4 + 3] = verts[3]; + mTetVertIndices[tetIndMul4] = indices[0]; + mTetVertIndices[tetIndMul4 + 1] = indices[1]; + mTetVertIndices[tetIndMul4 + 2] = indices[2]; + mTetVertIndices[tetIndMul4 + 3] = indices[3]; + mTetrahedronIndices[tetInd] = tetIndex; + } + }; + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp new file mode 100644 index 0000000..30ef518 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.cpp @@ -0,0 +1,311 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuMidphaseInterface.h" +#include "GuMeshFactory.h" +#include "GuConvexEdgeFlags.h" +#include "GuEdgeList.h" +#include "geometry/PxGeometryInternal.h" + +using namespace physx; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PxConcreteType::Enum gTable[] = { PxConcreteType::eTRIANGLE_MESH_BVH33, + PxConcreteType::eTRIANGLE_MESH_BVH34 + }; + +TriangleMesh::TriangleMesh(MeshFactory* factory, TriangleMeshData& d) : + PxTriangleMesh (PxType(gTable[d.mType]), PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mNbVertices (d.mNbVertices), + mNbTriangles (d.mNbTriangles), + mVertices (d.mVertices), + mTriangles (d.mTriangles), + mAABB (d.mAABB), + mExtraTrigData (d.mExtraTrigData), + mGeomEpsilon (d.mGeomEpsilon), + mFlags (d.mFlags), + mMaterialIndices (d.mMaterialIndices), + mFaceRemap (d.mFaceRemap), + mAdjacencies (d.mAdjacencies), + mMeshFactory (factory), + mEdgeList (NULL), + mMass (d.mMass), + mInertia (d.mInertia), + mLocalCenterOfMass (d.mLocalCenterOfMass), + mGRB_triIndices (d.mGRB_primIndices), + mGRB_triAdjacencies (d.mGRB_primAdjacencies), + mGRB_faceRemap (d.mGRB_faceRemap), + mGRB_faceRemapInverse (d.mGRB_faceRemapInverse), + mGRB_BV32Tree (d.mGRB_BV32Tree), + mSdfData (d.mSdfData), + mAccumulatedTrianglesRef (d.mAccumulatedTrianglesRef), + mTrianglesReferences (d.mTrianglesReferences), + mNbTrianglesReferences (d.mNbTrianglesReferences) +{ + // this constructor takes ownership of memory from the data object + d.mVertices = NULL; + d.mTriangles = NULL; + d.mExtraTrigData = NULL; + d.mFaceRemap = NULL; + d.mAdjacencies = NULL; + d.mMaterialIndices = NULL; + + d.mGRB_primIndices = NULL; + + d.mGRB_primAdjacencies = NULL; + d.mGRB_faceRemap = NULL; + d.mGRB_faceRemapInverse = NULL; + d.mGRB_BV32Tree = NULL; + + d.mSdfData.mSdf = NULL; + d.mSdfData.mSubgridStartSlots = NULL; + d.mSdfData.mSubgridSdf = NULL; + + d.mAccumulatedTrianglesRef = NULL; + d.mTrianglesReferences = NULL; + + // PT: 'getPaddedBounds()' is only safe if we make sure the bounds member is followed by at least 32bits of data + PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(TriangleMesh, mExtraTrigData)>=PX_OFFSET_OF(TriangleMesh, mAABB)+4); +} + +// PT: temporary for Kit +TriangleMesh::TriangleMesh(const PxTriangleMeshInternalData& data) : + PxTriangleMesh (PxConcreteType::eTRIANGLE_MESH_BVH34, PxBaseFlags(0)), + mNbVertices (data.mNbVertices), + mNbTriangles (data.mNbTriangles), + mVertices (data.mVertices), + mTriangles (data.mTriangles), + mExtraTrigData (NULL), + mGeomEpsilon (data.mGeomEpsilon), + mFlags (data.mFlags), + mMaterialIndices (NULL), + mFaceRemap (data.mFaceRemap), + mAdjacencies (NULL), + mMeshFactory (NULL), + mEdgeList (NULL), + mGRB_triIndices (NULL), + mGRB_triAdjacencies (NULL), + mGRB_faceRemap (NULL), + mGRB_faceRemapInverse (NULL), + mGRB_BV32Tree (NULL), + mAccumulatedTrianglesRef(NULL), + mTrianglesReferences (NULL), + mNbTrianglesReferences (0) +{ + mAABB.mCenter = data.mAABB_Center; + mAABB.mExtents = data.mAABB_Extents; +} +//~ PT: temporary for Kit + +TriangleMesh::~TriangleMesh() +{ + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_FREE(mExtraTrigData); + PX_FREE(mFaceRemap); + PX_FREE(mAdjacencies); + PX_FREE(mMaterialIndices); + PX_FREE(mTriangles); + PX_FREE(mVertices); + + PX_FREE(mGRB_triIndices); + + PX_FREE(mGRB_triAdjacencies); + PX_FREE(mGRB_faceRemap); + PX_FREE(mGRB_faceRemapInverse); + + PX_DELETE(mGRB_BV32Tree); + + PX_FREE(mAccumulatedTrianglesRef); + PX_FREE(mTrianglesReferences); + } + + PX_DELETE(mEdgeList); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// PT: used to be automatic but making it manual saves bytes in the internal mesh + +void TriangleMesh::exportExtraData(PxSerializationContext& stream) +{ + //PX_DEFINE_DYNAMIC_ARRAY(TriangleMesh, mVertices, PxField::eVEC3, mNbVertices, Ps::PxFieldFlag::eSERIALIZE), + if(mVertices) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mVertices, mNbVertices * sizeof(PxVec3)); + } + + if(mTriangles) + { + const PxU32 triangleSize = mFlags & PxTriangleMeshFlag::e16_BIT_INDICES ? sizeof(PxU16) : sizeof(PxU32); + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mTriangles, mNbTriangles * 3 * triangleSize); + } + + //PX_DEFINE_DYNAMIC_ARRAY(TriangleMesh, mExtraTrigData, PxField::eBYTE, mNbTriangles, Ps::PxFieldFlag::eSERIALIZE), + if(mExtraTrigData) + { + // PT: it might not be needed to 16-byte align this array of PxU8.... + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mExtraTrigData, mNbTriangles * sizeof(PxU8)); + } + + if(mMaterialIndices) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mMaterialIndices, mNbTriangles * sizeof(PxU16)); + } + + if(mFaceRemap) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mFaceRemap, mNbTriangles * sizeof(PxU32)); + } + + if(mAdjacencies) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mAdjacencies, mNbTriangles * sizeof(PxU32) * 3); + } + + if(mSdfData.mSdf) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mSdfData.mSdf, mSdfData.mNumSdfs * sizeof(PxReal)); + } + + if (mSdfData.mNumStartSlots) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mSdfData.mSubgridStartSlots, mSdfData.mNumStartSlots * sizeof(PxU32)); + } + + if (mSdfData.mSubgridSdf) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mSdfData.mSubgridSdf, mSdfData.mNumSubgridSdfs * sizeof(PxU8)); + } +} + +void TriangleMesh::importExtraData(PxDeserializationContext& context) +{ + // PT: vertices are followed by indices, so it will be safe to V4Load vertices from a deserialized binary file + if(mVertices) + mVertices = context.readExtraData(mNbVertices); + + if(mTriangles) + { + if(mFlags & PxTriangleMeshFlag::e16_BIT_INDICES) + mTriangles = context.readExtraData(3*mNbTriangles); + else + mTriangles = context.readExtraData(3*mNbTriangles); + } + + if(mExtraTrigData) + mExtraTrigData = context.readExtraData(mNbTriangles); + + if(mMaterialIndices) + mMaterialIndices = context.readExtraData(mNbTriangles); + + if(mFaceRemap) + mFaceRemap = context.readExtraData(mNbTriangles); + + if(mAdjacencies) + mAdjacencies = context.readExtraData(3*mNbTriangles); + + if(mSdfData.mSdf) + mSdfData.mSdf = context.readExtraData(mSdfData.mNumSdfs); + + if (mSdfData.mSubgridStartSlots) + mSdfData.mSubgridStartSlots = context.readExtraData(mSdfData.mNumStartSlots); + + if (mSdfData.mSubgridSdf) + mSdfData.mSubgridSdf = context.readExtraData(mSdfData.mNumSubgridSdfs); + + + mGRB_triIndices = NULL; + mGRB_triAdjacencies = NULL; + mGRB_faceRemap = NULL; + mGRB_faceRemapInverse = NULL; + mGRB_BV32Tree = NULL; +} + +void TriangleMesh::onRefCountZero() +{ + ::onRefCountZero(this, mMeshFactory, false, "PxTriangleMesh::release: double deletion detected!"); +} + +void TriangleMesh::release() +{ + Cm::RefCountable_decRefCount(*this); +} + +PxVec3* TriangleMesh::getVerticesForModification() +{ + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxTriangleMesh::getVerticesForModification() is not supported for this type of meshes."); + + return NULL; +} + +PxBounds3 TriangleMesh::refitBVH() +{ + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxTriangleMesh::refitBVH() is not supported for this type of meshes."); + + return PxBounds3(mAABB.getMin(), mAABB.getMax()); +} + +void TriangleMesh::setAllEdgesActive() +{ + if(mExtraTrigData) + { + const PxU32 nbTris = mNbTriangles; + for(PxU32 i=0; i(mTriangles); + else + create.DFaces = reinterpret_cast(mTriangles); + + mEdgeList = PX_NEW(EdgeList); + mEdgeList->init(create); + } + return mEdgeList; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.h new file mode 100644 index 0000000..a075db5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMesh.h @@ -0,0 +1,353 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TRIANGLEMESH_H +#define GU_TRIANGLEMESH_H + +#include "foundation/PxIO.h" +#include "geometry/PxTriangle.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "geometry/PxTriangleMesh.h" + +#include "GuMeshData.h" +#include "GuCenterExtents.h" +#include "CmScaling.h" +#include "CmRefCountable.h" +#include "common/PxRenderOutput.h" + +namespace physx +{ +class PxMeshScale; +struct PxTriangleMeshInternalData; + +namespace Gu +{ + PX_FORCE_INLINE void getVertexRefs(PxU32 triangleIndex, PxU32& vref0, PxU32& vref1, PxU32& vref2, const void* indices, bool has16BitIndices) + { + if(has16BitIndices) + { + const PxU16* inds = reinterpret_cast(indices) + triangleIndex*3; + vref0 = inds[0]; + vref1 = inds[1]; + vref2 = inds[2]; + } + else + { + const PxU32* inds = reinterpret_cast(indices) + triangleIndex*3; + vref0 = inds[0]; + vref1 = inds[1]; + vref2 = inds[2]; + } + } + +class MeshFactory; +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +class EdgeList; + +class TriangleMesh : public PxTriangleMesh, public PxUserAllocated +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + +// PX_SERIALIZATION + TriangleMesh(PxBaseFlags baseFlags) : PxTriangleMesh(baseFlags) {} + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); + virtual void release(); + virtual void requiresObjects(PxProcessPxBaseCallback&){} +//~PX_SERIALIZATION + TriangleMesh(MeshFactory* factory, TriangleMeshData& data); + TriangleMesh(const PxTriangleMeshInternalData& data); + virtual ~TriangleMesh(); + + // PxBase + virtual void onRefCountZero(); + //~PxBase + + // PxRefCounted + virtual void acquireReference() { Cm::RefCountable_incRefCount(*this); } + virtual PxU32 getReferenceCount() const { return Cm::RefCountable_getRefCount(*this); } + //~PxRefCounted + + // PxTriangleMesh + virtual PxU32 getNbVertices() const { return mNbVertices;} + virtual const PxVec3* getVertices() const { return mVertices; } + + virtual PxVec3* getVerticesForModification(); + virtual PxBounds3 refitBVH(); + virtual PxU32 getNbTriangles() const { return mNbTriangles; } + virtual const void* getTriangles() const { return mTriangles; } + virtual PxTriangleMeshFlags getTriangleMeshFlags() const { return PxTriangleMeshFlags(mFlags); } + virtual const PxU32* getTrianglesRemap() const { return mFaceRemap; } + virtual void setPreferSDFProjection(bool preferProjection) + { + if (preferProjection) + mFlags &= PxU8(~PxTriangleMeshFlag::ePREFER_NO_SDF_PROJ); + else + mFlags |= PxTriangleMeshFlag::ePREFER_NO_SDF_PROJ; + } + + virtual bool getPreferSDFProjection() const { return !(mFlags & PxTriangleMeshFlag::ePREFER_NO_SDF_PROJ); } + + virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const + { + return hasPerTriangleMaterials() ? getMaterials()[triangleIndex] : PxMaterialTableIndex(0xffff); + } + + virtual PxBounds3 getLocalBounds() const + { + PX_ASSERT(mAABB.isValid()); + return PxBounds3::centerExtents(mAABB.mCenter, mAABB.mExtents); + } + + virtual const PxReal* getSDF() const + { + return mSdfData.mSdf; + } + + virtual void getSDFDimensions(PxU32& numX, PxU32& numY, PxU32& numZ) const + { + if(mSdfData.mSdf) + { + numX = mSdfData.mDims.x; + numY = mSdfData.mDims.y; + numZ = mSdfData.mDims.z; + } + else + numX = numY = numZ = 0; + } + + virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const + { + mass = mMass; localInertia = mInertia; localCenterOfMass = mLocalCenterOfMass; + } + + //~PxTriangleMesh + + virtual bool getInternalData(PxTriangleMeshInternalData&, bool) const { return false; } + + // PT: this one is just to prevent instancing Gu::TriangleMesh. + // But you should use PxBase::getConcreteType() instead to avoid the virtual call. + virtual PxMeshMidPhase::Enum getMidphaseID() const = 0; + + PX_FORCE_INLINE const PxU32* getFaceRemap() const { return mFaceRemap; } + PX_FORCE_INLINE bool has16BitIndices() const { return (mFlags & PxMeshFlag::e16_BIT_INDICES) ? true : false; } + PX_FORCE_INLINE bool hasPerTriangleMaterials() const { return mMaterialIndices != NULL; } + PX_FORCE_INLINE PxU32 getNbVerticesFast() const { return mNbVertices; } + PX_FORCE_INLINE PxU32 getNbTrianglesFast() const { return mNbTriangles; } + PX_FORCE_INLINE const void* getTrianglesFast() const { return mTriangles; } + PX_FORCE_INLINE const PxVec3* getVerticesFast() const { return mVertices; } + PX_FORCE_INLINE const PxU32* getAdjacencies() const { return mAdjacencies; } + PX_FORCE_INLINE PxReal getGeomEpsilon() const { return mGeomEpsilon; } + PX_FORCE_INLINE const CenterExtents& getLocalBoundsFast() const { return mAABB; } + PX_FORCE_INLINE const PxU16* getMaterials() const { return mMaterialIndices; } + PX_FORCE_INLINE const PxU8* getExtraTrigData() const { return mExtraTrigData; } + + PX_FORCE_INLINE const PxU32* getAccumulatedTriangleRef() const { return mAccumulatedTrianglesRef; } + PX_FORCE_INLINE const PxU32* getTriangleReferences() const { return mTrianglesReferences; } + PX_FORCE_INLINE PxU32 getNbTriangleReferences() const { return mNbTrianglesReferences; } + + PX_FORCE_INLINE const CenterExtentsPadded& getPaddedBounds() const + { + // PT: see compile-time assert in cpp + return static_cast(mAABB); + } + + PX_FORCE_INLINE void computeWorldTriangle( + PxTriangle& worldTri, PxTriangleID triangleIndex, const PxMat34& worldMatrix, bool flipNormal = false, + PxU32* PX_RESTRICT vertexIndices=NULL, PxU32* PX_RESTRICT adjacencyIndices=NULL) const; + PX_FORCE_INLINE void getLocalTriangle(PxTriangle& localTri, PxTriangleID triangleIndex, bool flipNormal = false) const; + + void setMeshFactory(MeshFactory* factory) { mMeshFactory = factory; } + + // SDF methods + PX_FORCE_INLINE const SDF& getSdfDataFast() const { return mSdfData; } + //~SDF methods + + PX_FORCE_INLINE PxReal getMass() const { return mMass; } + + // PT: for debug viz + PX_PHYSX_COMMON_API const Gu::EdgeList* requestEdgeList() const; + +protected: + PxU32 mNbVertices; + PxU32 mNbTriangles; + PxVec3* mVertices; + void* mTriangles; //!< 16 (<= 0xffff #vertices) or 32 bit trig indices (mNbTriangles * 3) + // 16 bytes block + + // PT: WARNING: bounds must be followed by at least 32bits of data for safe SIMD loading + CenterExtents mAABB; + PxU8* mExtraTrigData; //one per trig + PxReal mGeomEpsilon; //!< see comments in cooking code referencing this variable + // 16 bytes block + /* + low 3 bits (mask: 7) are the edge flags: + b001 = 1 = ignore edge 0 = edge v0-->v1 + b010 = 2 = ignore edge 1 = edge v0-->v2 + b100 = 4 = ignore edge 2 = edge v1-->v2 + */ + PxU8 mFlags; //!< Flag whether indices are 16 or 32 bits wide + //!< Flag whether triangle adajacencies are build + PxU16* mMaterialIndices; //!< the size of the array is numTriangles. + PxU32* mFaceRemap; //!< new faces to old faces mapping (after cleaning, etc). Usage: old = faceRemap[new] + PxU32* mAdjacencies; //!< Adjacency information for each face - 3 adjacent faces + //!< Set to 0xFFFFffff if no adjacent face + + MeshFactory* mMeshFactory; // PT: changed to pointer for serialization + mutable Gu::EdgeList* mEdgeList; // PT: for debug viz + + + PxReal mMass; //this is mass assuming a unit density that can be scaled by instances! + PxMat33 mInertia; //in local space of mesh! + PxVec3 mLocalCenterOfMass; //local space com +public: + + // GRB data ------------------------- + void* mGRB_triIndices; //!< GRB: GPU-friendly tri indices + + // TODO avoroshilov: cooking - adjacency info - duplicated, remove it and use 'mAdjacencies' and 'mExtraTrigData' see GuTriangleMesh.cpp:325 + void* mGRB_triAdjacencies; //!< GRB: adjacency data, with BOUNDARY and NONCONVEX flags (flags replace adj indices where applicable) + + PxU32* mGRB_faceRemap; //!< GRB : gpu to cpu triangle indice remap + PxU32* mGRB_faceRemapInverse; + Gu::BV32Tree* mGRB_BV32Tree; //!< GRB: BV32 tree + // End of GRB data ------------------ + + // SDF data ------------------------- + SDF mSdfData; + // End of SDF data ------------------ + + void setAllEdgesActive(); + //Vertex mapping data + PxU32* mAccumulatedTrianglesRef;//runsum + PxU32* mTrianglesReferences; + PxU32 mNbTrianglesReferences; + //End of vertex mapping data +}; + +#if PX_VC +#pragma warning(pop) +#endif + +} // namespace Gu + +PX_FORCE_INLINE void Gu::TriangleMesh::computeWorldTriangle(PxTriangle& worldTri, PxTriangleID triangleIndex, const PxMat34& worldMatrix, bool flipNormal, + PxU32* PX_RESTRICT vertexIndices, PxU32* PX_RESTRICT adjacencyIndices) const +{ + PxU32 vref0, vref1, vref2; + getVertexRefs(triangleIndex, vref0, vref1, vref2, mTriangles, has16BitIndices()); + + if(flipNormal) + PxSwap(vref1, vref2); + + const PxVec3* PX_RESTRICT vertices = getVerticesFast(); + worldTri.verts[0] = worldMatrix.transform(vertices[vref0]); + worldTri.verts[1] = worldMatrix.transform(vertices[vref1]); + worldTri.verts[2] = worldMatrix.transform(vertices[vref2]); + + if(vertexIndices) + { + vertexIndices[0] = vref0; + vertexIndices[1] = vref1; + vertexIndices[2] = vref2; + } + + if(adjacencyIndices) + { + if(mAdjacencies) + { + // PT: TODO: is this correct? + adjacencyIndices[0] = flipNormal ? mAdjacencies[triangleIndex*3 + 2] : mAdjacencies[triangleIndex*3 + 0]; + adjacencyIndices[1] = mAdjacencies[triangleIndex*3 + 1]; + adjacencyIndices[2] = flipNormal ? mAdjacencies[triangleIndex*3 + 0] : mAdjacencies[triangleIndex*3 + 2]; + } + else + { + adjacencyIndices[0] = 0xffffffff; + adjacencyIndices[1] = 0xffffffff; + adjacencyIndices[2] = 0xffffffff; + } + } +} + +PX_FORCE_INLINE void Gu::TriangleMesh::getLocalTriangle(PxTriangle& localTri, PxTriangleID triangleIndex, bool flipNormal) const +{ + PxU32 vref0, vref1, vref2; + getVertexRefs(triangleIndex, vref0, vref1, vref2, mTriangles, has16BitIndices()); + + if(flipNormal) + PxSwap(vref1, vref2); + + const PxVec3* PX_RESTRICT vertices = getVerticesFast(); + localTri.verts[0] = vertices[vref0]; + localTri.verts[1] = vertices[vref1]; + localTri.verts[2] = vertices[vref2]; +} + +PX_INLINE float computeSweepData(const PxTriangleMeshGeometry& triMeshGeom, /*const Cm::FastVertex2ShapeScaling& scaling,*/ PxVec3& sweepOrigin, PxVec3& sweepExtents, PxVec3& sweepDir, float distance) +{ + PX_ASSERT(!Cm::isEmpty(sweepOrigin, sweepExtents)); + + const PxVec3 endPt = sweepOrigin + sweepDir*distance; + PX_ASSERT(!Cm::isEmpty(endPt, sweepExtents)); + + const Cm::FastVertex2ShapeScaling meshScaling(triMeshGeom.scale.getInverse()); // shape to vertex transform + + const PxMat33& vertex2ShapeSkew = meshScaling.getVertex2ShapeSkew(); + + const PxVec3 originBoundsCenter = vertex2ShapeSkew * sweepOrigin; + const PxVec3 originBoundsExtents = Cm::basisExtent(vertex2ShapeSkew.column0, vertex2ShapeSkew.column1, vertex2ShapeSkew.column2, sweepExtents); + + sweepOrigin = originBoundsCenter; + sweepExtents = originBoundsExtents; + sweepDir = (vertex2ShapeSkew * endPt) - originBoundsCenter; + return sweepDir.normalizeSafe(); +} + +PX_FORCE_INLINE const Gu::TriangleMesh* _getMeshData(const PxTriangleMeshGeometry& meshGeom) +{ + return static_cast(meshGeom.triangleMesh); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp new file mode 100644 index 0000000..f272c22 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.cpp @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuTriangleMesh.h" +#include "GuTriangleMeshBV4.h" +#include "geometry/PxGeometryInternal.h" + +using namespace physx; +using namespace Gu; + +namespace physx +{ + +// PT: temporary for Kit + +BV4TriangleMesh::BV4TriangleMesh(const PxTriangleMeshInternalData& data) : TriangleMesh(data) +{ + mMeshInterface.setNbTriangles(getNbTrianglesFast()); + if(has16BitIndices()) + mMeshInterface.setPointers(NULL, const_cast(reinterpret_cast(getTrianglesFast())), getVerticesFast()); + else + mMeshInterface.setPointers(const_cast(reinterpret_cast(getTrianglesFast())), NULL, getVerticesFast()); + mBV4Tree.mMeshInterface = &mMeshInterface; + + mBV4Tree.mLocalBounds.mCenter = data.mAABB_Center; + mBV4Tree.mLocalBounds.mExtentsMagnitude = data.mAABB_Extents.magnitude(); + + mBV4Tree.mNbNodes = data.mNbNodes; + mBV4Tree.mNodes = data.mNodes; + mBV4Tree.mInitData = data.mInitData; + mBV4Tree.mCenterOrMinCoeff = data.mCenterOrMinCoeff; + mBV4Tree.mExtentsOrMaxCoeff = data.mExtentsOrMaxCoeff; + mBV4Tree.mQuantized = data.mQuantized; + mBV4Tree.mUserAllocated = true; +} + +bool BV4TriangleMesh::getInternalData(PxTriangleMeshInternalData& data, bool takeOwnership) const +{ + data.mNbVertices = mNbVertices; + data.mNbTriangles = mNbTriangles; + data.mVertices = mVertices; + data.mTriangles = mTriangles; + data.mFaceRemap = mFaceRemap; + data.mAABB_Center = mAABB.mCenter; + data.mAABB_Extents = mAABB.mExtents; + data.mGeomEpsilon = mGeomEpsilon; + data.mFlags = mFlags; + + data.mNbNodes = mBV4Tree.mNbNodes; + data.mNodeSize = mBV4Tree.mQuantized ? sizeof(BVDataPackedQ) : sizeof(BVDataPackedNQ); + data.mNodes = mBV4Tree.mNodes; + data.mInitData = mBV4Tree.mInitData; + data.mCenterOrMinCoeff = mBV4Tree.mCenterOrMinCoeff; + data.mExtentsOrMaxCoeff = mBV4Tree.mExtentsOrMaxCoeff; + data.mQuantized = mBV4Tree.mQuantized; + + if(takeOwnership) + { + const_cast(this)->setBaseFlag(PxBaseFlag::eOWNS_MEMORY, false); + const_cast(this)->mBV4Tree.mUserAllocated = true; + } + + return true; +} + +bool PxGetTriangleMeshInternalData(PxTriangleMeshInternalData& data, const PxTriangleMesh& mesh, bool takeOwnership) +{ + return static_cast(mesh).getInternalData(data, takeOwnership); +} + +//~ PT: temporary for Kit + +BV4TriangleMesh::BV4TriangleMesh(MeshFactory* factory, TriangleMeshData& d) : TriangleMesh(factory, d) +{ + PX_ASSERT(d.mType==PxMeshMidPhase::eBVH34); + + BV4TriangleData& bv4Data = static_cast(d); + mMeshInterface = bv4Data.mMeshInterface; + mBV4Tree = bv4Data.mBV4Tree; + mBV4Tree.mMeshInterface = &mMeshInterface; +} + +TriangleMesh* BV4TriangleMesh::createObject(PxU8*& address, PxDeserializationContext& context) +{ + BV4TriangleMesh* obj = PX_PLACEMENT_NEW(address, BV4TriangleMesh(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(BV4TriangleMesh); + obj->importExtraData(context); + return obj; +} + +void BV4TriangleMesh::exportExtraData(PxSerializationContext& stream) +{ + mBV4Tree.exportExtraData(stream); + TriangleMesh::exportExtraData(stream); +} + +void BV4TriangleMesh::importExtraData(PxDeserializationContext& context) +{ + mBV4Tree.importExtraData(context); + TriangleMesh::importExtraData(context); + + if(has16BitIndices()) + mMeshInterface.setPointers(NULL, const_cast(reinterpret_cast(getTrianglesFast())), getVerticesFast()); + else + mMeshInterface.setPointers(const_cast(reinterpret_cast(getTrianglesFast())), NULL, getVerticesFast()); + mBV4Tree.mMeshInterface = &mMeshInterface; +} + +PxVec3 * BV4TriangleMesh::getVerticesForModification() +{ + return const_cast(getVertices()); +} + +PxBounds3 BV4TriangleMesh::refitBVH() +{ + PxBounds3 newBounds; + + const float gBoxEpsilon = 2e-4f; + if(mBV4Tree.refit(newBounds, gBoxEpsilon)) + { + mAABB.setMinMax(newBounds.minimum, newBounds.maximum); + } + else + { + newBounds = PxBounds3::centerExtents(mAABB.mCenter, mAABB.mExtents); + + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "BVH34 trees: refit operation only available on non-quantized trees.\n"); + } + + // PT: copied from RTreeTriangleMesh::refitBVH() + // reset edge flags and remember we did that using a mesh flag (optimization) + if(!mBV4Tree.mIsEdgeSet) + { + mBV4Tree.mIsEdgeSet = true; + setAllEdgesActive(); + } + + return newBounds; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.h new file mode 100644 index 0000000..ab8e5c9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshBV4.h @@ -0,0 +1,81 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TRIANGLEMESH_BV4_H +#define GU_TRIANGLEMESH_BV4_H + +#include "GuTriangleMesh.h" + +namespace physx +{ +namespace Gu +{ +class MeshFactory; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +class BV4TriangleMesh : public TriangleMesh +{ + public: + virtual const char* getConcreteTypeName() const { return "PxBVH34TriangleMesh"; } +// PX_SERIALIZATION + BV4TriangleMesh(PxBaseFlags baseFlags) : TriangleMesh(baseFlags), mMeshInterface(PxEmpty), mBV4Tree(PxEmpty) {} + PX_PHYSX_COMMON_API virtual void exportExtraData(PxSerializationContext& ctx); + void importExtraData(PxDeserializationContext&); + PX_PHYSX_COMMON_API static TriangleMesh* createObject(PxU8*& address, PxDeserializationContext& context); + PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + BV4TriangleMesh(MeshFactory* factory, TriangleMeshData& data); + virtual ~BV4TriangleMesh(){} + + virtual PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH34; } + + virtual PxVec3* getVerticesForModification(); + virtual PxBounds3 refitBVH(); + + PX_PHYSX_COMMON_API BV4TriangleMesh(const PxTriangleMeshInternalData& data); + virtual bool getInternalData(PxTriangleMeshInternalData&, bool) const; + + PX_FORCE_INLINE const Gu::BV4Tree& getBV4Tree() const { return mBV4Tree; } + private: + Gu::SourceMesh mMeshInterface; + Gu::BV4Tree mBV4Tree; +}; + +#if PX_VC +#pragma warning(pop) +#endif + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp new file mode 100644 index 0000000..e9600d0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.cpp @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuTriangleMesh.h" +#include "GuTriangleMeshRTree.h" + +using namespace physx; + +namespace physx +{ + +Gu::RTreeTriangleMesh::RTreeTriangleMesh(MeshFactory* factory, TriangleMeshData& d) : TriangleMesh(factory, d) +{ + PX_ASSERT(d.mType==PxMeshMidPhase::eBVH33); + + RTreeTriangleData& rtreeData = static_cast(d); + mRTree = rtreeData.mRTree; + rtreeData.mRTree.mPages = NULL; +} + +Gu::TriangleMesh* Gu::RTreeTriangleMesh::createObject(PxU8*& address, PxDeserializationContext& context) +{ + RTreeTriangleMesh* obj = PX_PLACEMENT_NEW(address, RTreeTriangleMesh(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(RTreeTriangleMesh); + obj->importExtraData(context); + return obj; +} + +void Gu::RTreeTriangleMesh::exportExtraData(PxSerializationContext& stream) +{ + mRTree.exportExtraData(stream); + TriangleMesh::exportExtraData(stream); +} + +void Gu::RTreeTriangleMesh::importExtraData(PxDeserializationContext& context) +{ + mRTree.importExtraData(context); + TriangleMesh::importExtraData(context); +} + +PxVec3 * Gu::RTreeTriangleMesh::getVerticesForModification() +{ + return const_cast(getVertices()); +} + +template +struct RefitCallback : Gu::RTree::CallbackRefit +{ + const PxVec3* newPositions; + const IndexType* indices; + + RefitCallback(const PxVec3* aNewPositions, const IndexType* aIndices) : newPositions(aNewPositions), indices(aIndices) {} + PX_FORCE_INLINE ~RefitCallback() {} + + virtual void recomputeBounds(PxU32 index, aos::Vec3V& aMn, aos::Vec3V& aMx) + { + using namespace aos; + + // Each leaf box has a set of triangles + Gu::LeafTriangles currentLeaf; currentLeaf.Data = index; + PxU32 nbTris = currentLeaf.GetNbTriangles(); + PxU32 baseTri = currentLeaf.GetTriangleIndex(); + PX_ASSERT(nbTris > 0); + const IndexType* vInds = indices + 3 * baseTri; + Vec3V vPos = V3LoadU(newPositions[vInds[0]]); + Vec3V mn = vPos, mx = vPos; + //PxBounds3 result(newPositions[vInds[0]], newPositions[vInds[0]]); + vPos = V3LoadU(newPositions[vInds[1]]); + mn = V3Min(mn, vPos); mx = V3Max(mx, vPos); + vPos = V3LoadU(newPositions[vInds[2]]); + mn = V3Min(mn, vPos); mx = V3Max(mx, vPos); + for (PxU32 i = 1; i < nbTris; i++) + { + const IndexType* vInds1 = indices + 3 * (baseTri + i); + vPos = V3LoadU(newPositions[vInds1[0]]); + mn = V3Min(mn, vPos); mx = V3Max(mx, vPos); + vPos = V3LoadU(newPositions[vInds1[1]]); + mn = V3Min(mn, vPos); mx = V3Max(mx, vPos); + vPos = V3LoadU(newPositions[vInds1[2]]); + mn = V3Min(mn, vPos); mx = V3Max(mx, vPos); + } + + aMn = mn; + aMx = mx; + } +}; + +PxBounds3 Gu::RTreeTriangleMesh::refitBVH() +{ + PxBounds3 meshBounds; + if (has16BitIndices()) + { + RefitCallback cb(mVertices, static_cast(mTriangles)); + mRTree.refitAllStaticTree(cb, &meshBounds); + } + else + { + RefitCallback cb(mVertices, static_cast(mTriangles)); + mRTree.refitAllStaticTree(cb, &meshBounds); + } + + // reset edge flags and remember we did that using a mesh flag (optimization) + if ((mRTree.mFlags & RTree::IS_EDGE_SET) == 0) + { + mRTree.mFlags |= RTree::IS_EDGE_SET; + setAllEdgesActive(); + } + + mAABB = meshBounds; + return meshBounds; +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.h new file mode 100644 index 0000000..6870a23 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/mesh/GuTriangleMeshRTree.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_TRIANGLEMESH_RTREE_H +#define GU_TRIANGLEMESH_RTREE_H + +#include "GuTriangleMesh.h" + +namespace physx +{ +namespace Gu +{ +class MeshFactory; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable: 4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +class RTreeTriangleMesh : public TriangleMesh +{ + public: + virtual const char* getConcreteTypeName() const { return "PxBVH33TriangleMesh"; } +// PX_SERIALIZATION + RTreeTriangleMesh(PxBaseFlags baseFlags) : TriangleMesh(baseFlags), mRTree(PxEmpty) {} + PX_PHYSX_COMMON_API virtual void exportExtraData(PxSerializationContext& ctx); + void importExtraData(PxDeserializationContext&); + PX_PHYSX_COMMON_API static TriangleMesh* createObject(PxU8*& address, PxDeserializationContext& context); + PX_PHYSX_COMMON_API static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + RTreeTriangleMesh(MeshFactory* factory, TriangleMeshData& data); + virtual ~RTreeTriangleMesh(){} + + virtual PxMeshMidPhase::Enum getMidphaseID() const { return PxMeshMidPhase::eBVH33; } + + virtual PxVec3* getVerticesForModification(); + virtual PxBounds3 refitBVH(); + + PX_FORCE_INLINE const Gu::RTree& getRTree() const { return mRTree; } + private: + Gu::RTree mRTree; +}; + +#if PX_VC +#pragma warning(pop) +#endif + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp new file mode 100644 index 0000000..9390ee5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxBox.cpp @@ -0,0 +1,989 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" +#include "GuVecBox.h" +#include "GuConvexHelper.h" +#include "GuPCMShapeConvex.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactGenUtil.h" + +using namespace physx; +using namespace Gu; + +static void getIncidentPolygon(aos::Vec3V* pts, aos::Vec3V& faceNormal, const aos::Vec3VArg axis, const aos::PxMatTransformV& transf1To0, + const aos::Vec3VArg extents) +{ + using namespace aos; + + const FloatV zero = FZero(); + + FloatV ex = V3GetX(extents); + FloatV ey = V3GetY(extents); + FloatV ez = V3GetZ(extents); + + const Vec3V u0 = transf1To0.getCol0(); + const Vec3V u1 = transf1To0.getCol1(); + const Vec3V u2 = transf1To0.getCol2(); + + //calcaulte the insident face for b + const FloatV d0 = V3Dot(u0, axis); + const FloatV d1 = V3Dot(u1, axis); + const FloatV d2 = V3Dot(u2, axis); + + const FloatV absd0 = FAbs(d0); + const FloatV absd1 = FAbs(d1); + const FloatV absd2 = FAbs(d2); + + Vec3V r0, r1, r2; + + if(FAllGrtrOrEq(absd0, absd1) && FAllGrtrOrEq(absd0, absd2)) + { + //the incident face is on u0 + const BoolV con = FIsGrtr(d0, zero); + faceNormal = V3Sel(con, V3Neg(u0), u0); + ex = FSel(con, FNeg(ex), ex); + r0 = V3Scale(u0, ex); + r1 = V3Scale(u1, ey); + r2 = V3Scale(u2, ez); + + const Vec3V temp0 = V3Add(transf1To0.p, r0); + const Vec3V temp1 = V3Add(r1, r2); + const Vec3V temp2 = V3Sub(r1, r2); + + pts[0] = V3Add(temp0, temp1); // (-x/x, y, z) + pts[1] = V3Add(temp0, temp2); // (-x/x, y, -z) + pts[2] = V3Sub(temp0, temp1); // (-x/x, -y, -z) + pts[3] = V3Sub(temp0, temp2); // (-x/x, -y, z) + + } + else if(FAllGrtrOrEq(absd1, absd2)) + { + //the incident face is on u1 + const BoolV con = FIsGrtr(d1, zero); + faceNormal = V3Sel(con, V3Neg(u1), u1); + ey = FSel(con, FNeg(ey), ey); + r0 = V3Scale(u0, ex); + r1 = V3Scale(u1, ey); + r2 = V3Scale(u2, ez); + + const Vec3V temp0 = V3Add(transf1To0.p, r1); + const Vec3V temp1 = V3Add(r0, r2); + const Vec3V temp2 = V3Sub(r0, r2); + + pts[0] = V3Add(temp0, temp1); // (x, -y/y, z) + pts[1] = V3Add(temp0, temp2); // (x, -y/y, -z) + pts[2] = V3Sub(temp0, temp1); // (-x, -y/y, -z) + pts[3] = V3Sub(temp0, temp2); // (-x, -y/y, z) + } + else + { + //the incident face is on u2 + const BoolV con = FIsGrtr(d2, zero); + faceNormal = V3Sel(con, V3Neg(u2), u2); + ez = FSel(con, FNeg(ez), ez); + r0 = V3Scale(u0, ex); + r1 = V3Scale(u1, ey); + r2 = V3Scale(u2, ez); + + const Vec3V temp0 = V3Add(transf1To0.p, r2); + const Vec3V temp1 = V3Add(r0, r1); + const Vec3V temp2 = V3Sub(r0, r1); + + pts[0] = V3Add(temp0, temp1); // ( x, y, z) + pts[1] = V3Add(temp0, temp2); // ( x, -y, z) + pts[2] = V3Sub(temp0, temp1); // (-x, -y, z) + pts[3] = V3Sub(temp0, temp2); // (-x, y, z) + } +} + +//p0 and p1 is in the local space of AABB +static bool intersectSegmentAABB(const aos::Vec3VArg p0, const aos::Vec3VArg d, const aos::Vec3VArg max, const aos::Vec3VArg min, aos::FloatV& tmin, aos::FloatV& tmax) +{ + using namespace aos; + + const Vec3V eps = V3Load(1e-6f); + const Vec3V absV = V3Abs(d); + const FloatV one = FOne(); + const Vec3V zero = V3Zero(); + const Vec3V fMax = Vec3V_From_FloatV(FMax()); + + FloatV tminf = FZero(); + FloatV tmaxf = one; + const BoolV isParallel = V3IsGrtr(eps, absV); + const BoolV isOutsideOfRange = BOr(V3IsGrtr(p0, max), V3IsGrtr(min, p0)); + //const BoolV isParallelAndOutOfRange = BAnd(isParallel, isOutsideOfRange); + + if(!BAllEqFFFF(BAnd(isParallel, isOutsideOfRange))) + return false; + + const Vec3V odd = V3RecipFast(d); + const Vec3V t1 = V3Sel(isParallel, zero, V3Mul(V3Sub(min, p0), odd)); + const Vec3V t2 = V3Sel(isParallel, fMax, V3Mul(V3Sub(max, p0), odd)); + + const Vec3V tt1 = V3Min(t1, t2); + const Vec3V tt2 = V3Max(t1, t2); + + const FloatV ft1 = V3ExtractMax(tt1); + const FloatV ft2 = V3ExtractMin(tt2); + + tminf = FMax(ft1, tminf); + tmaxf = FMin(tmaxf, ft2); + + tmin = tminf; + tmax = tmaxf; + + const BoolV con0 = FIsGrtr(tminf, tmaxf); + const BoolV con1 = FIsGrtr(tminf, one); + const BoolV isNotIntersect = BOr(con0, con1); + return BAllEqFFFF(isNotIntersect) == 1; +} + +//pts, faceNormal and contact normal are in the local space of new space +static void calculateContacts( const aos::FloatVArg extentX_, const aos::FloatVArg extentY_, aos::Vec3V* pts, const aos::Vec3VArg incidentFaceNormalInNew, const aos::Vec3VArg localNormal, Gu::PersistentContact* manifoldContacts, PxU32& numContacts, const aos::FloatVArg contactDist) +{ + using namespace aos; + + const FloatV zero = FZero(); + const FloatV max = FMax(); + const FloatV eps = FLoad(1.0001f); + + const FloatV extentX = FMul(extentX_, eps); + const FloatV extentY = FMul(extentY_, eps); + + const FloatV nExtentX = FNeg(extentX); + const FloatV nExtentY = FNeg(extentY); + + bool pPenetration[4]; + bool pArea[4]; + + Vec3V bmin = V3Splat(max); + Vec3V bmax = V3Neg(bmin); + + const Vec3V bound = V3Merge(extentX, extentY, max); + + //get the projection point of pts + for(PxU32 i=0; i< 4; ++i) + { + bmin = V3Min(bmin, pts[i]); + bmax = V3Max(bmax, pts[i]); + const FloatV z = FNeg(V3GetZ(pts[i])); + if(FAllGrtr(contactDist, z)) + { + pPenetration[i] = true; + + const Vec3V absPt= V3Abs(pts[i]); + const BoolV con = V3IsGrtrOrEq(bound, absPt); + if(BAllEqTTTT(con)) + { + pArea[i] = true; + + //Add the point to the manifold + manifoldContacts[numContacts].mLocalPointA = V3SetZ(pts[i], zero); //transformNewTo0.transform(localPointA); + manifoldContacts[numContacts].mLocalPointB = pts[i];//transform1ToNew.transformInv(pts[i]); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), z); + } + else + { + pArea[i] = false; + } + } + else + { + pPenetration[i] = false; + pArea[i] = false; + } + } + + if(numContacts == 4) + return; + + //if(pPenetration[0] && pPenetration[1] && pPenetration[2] && pPenetration[3]) + { + //if(!pArea[0] || !pArea[1] || !pArea[2] || !pArea[3]) + { + const FloatV denom = V3GetZ(incidentFaceNormalInNew); + { + const Vec3V q0 = V3Merge(extentX, extentY, zero); + + if(contains(pts, 4, q0, bmin, bmax)) + { + const FloatV nom = V3Dot(incidentFaceNormalInNew, V3Sub(pts[0], q0)); + const FloatV t = FDiv(nom, denom); + const FloatV pen = FNeg(t); + if(FAllGrtr(contactDist, pen)) + { + manifoldContacts[numContacts].mLocalPointA = q0; + manifoldContacts[numContacts].mLocalPointB = V3SetZ(q0, t); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + } + } + + { + const Vec3V q0 = V3Merge(extentX, nExtentY, zero); + if(contains(pts, 4, q0, bmin, bmax)) + { + const FloatV nom = V3Dot(incidentFaceNormalInNew, V3Sub(pts[0], q0)); + const FloatV t = FDiv(nom, denom); + const FloatV pen = FNeg(t); + if(FAllGrtr(contactDist, pen)) + { + manifoldContacts[numContacts].mLocalPointA = q0; + manifoldContacts[numContacts].mLocalPointB = V3SetZ(q0, t); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + } + } + + { + const Vec3V q0 = V3Merge( nExtentX, extentY, zero); + if(contains(pts, 4, q0, bmin, bmax)) + { + const FloatV nom = V3Dot(incidentFaceNormalInNew, V3Sub(pts[0], q0)); + const FloatV t = FDiv(nom, denom); + const FloatV pen = FNeg(t); + if(FAllGrtr(contactDist, pen)) + { + manifoldContacts[numContacts].mLocalPointA = q0; + manifoldContacts[numContacts].mLocalPointB = V3SetZ(q0, t); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + } + } + + { + const Vec3V q0 = V3Merge(nExtentX, nExtentY, zero); + + if(contains(pts, 4, q0, bmin, bmax)) + { + const FloatV nom = V3Dot(incidentFaceNormalInNew, V3Sub(pts[0], q0)); + const FloatV t = FDiv(nom, denom); + const FloatV pen = FNeg(t); + if(FAllGrtr(contactDist, pen)) + { + manifoldContacts[numContacts].mLocalPointA = q0; + manifoldContacts[numContacts].mLocalPointB = V3SetZ(q0, t); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + } + } + } + } + + const Vec3V ext = V3Merge(extentX, extentY, max); + const Vec3V negExt = V3Merge(nExtentX, nExtentY, FNeg(FAdd(contactDist, FEps()))); + + for (PxU32 rStart = 0, rEnd = 3; rStart < 4; rEnd = rStart++) + { + const Vec3V p0 = pts[rStart]; + const Vec3V p1 = pts[rEnd]; + + if(!pPenetration[rStart] && !pPenetration[rEnd]) + continue; + + const bool con0 = pPenetration[rStart] && pArea[rStart]; + const bool con1 = pPenetration[rEnd] && pArea[rEnd]; + if(con0 && con1) + continue; + + //intersect t value with x plane + const Vec3V p0p1 = V3Sub(p1, p0); + + FloatV tmin, tmax; + if(::intersectSegmentAABB(p0, p0p1, ext, negExt, tmin, tmax)) + { + if(!con0) + { + const Vec3V intersectP = V3ScaleAdd(p0p1, tmin, p0); + manifoldContacts[numContacts].mLocalPointA = V3SetZ(intersectP, zero); + manifoldContacts[numContacts].mLocalPointB = intersectP; + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), FNeg(V3GetZ(intersectP))); + } + if(!con1) + { + const Vec3V intersectP = V3ScaleAdd(p0p1, tmax, p0); + manifoldContacts[numContacts].mLocalPointA = V3SetZ(intersectP, zero); + manifoldContacts[numContacts].mLocalPointB = intersectP; + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), FNeg(V3GetZ(intersectP))); + } + } + } +} + +static PxU32 doBoxBoxGenerateContacts(const aos::Vec3VArg box0Extent, const aos::Vec3VArg box1Extent, const aos::PxMatTransformV& transform0, const aos::PxMatTransformV& transform1, const aos::FloatVArg contactDist, Gu::PersistentContact* manifoldContacts, PxU32& numContacts) +{ + using namespace aos; + + const FloatV ea0 = V3GetX(box0Extent); + const FloatV ea1 = V3GetY(box0Extent); + const FloatV ea2 = V3GetZ(box0Extent); + + const FloatV eb0 = V3GetX(box1Extent); + const FloatV eb1 = V3GetY(box1Extent); + const FloatV eb2 = V3GetZ(box1Extent); + + const PxMatTransformV transform1To0 = transform0.transformInv(transform1); + const Mat33V rot0To1 =M33Trnsps(transform1To0.rot); + + const Vec3V uEps = V3Load(1e-6f); + + const FloatV zero = FZero(); + + const FloatV tx = V3GetX(transform1To0.p); + const FloatV ty = V3GetY(transform1To0.p); + const FloatV tz = V3GetZ(transform1To0.p); + const Vec3V col0 = transform1To0.getCol0(); + const Vec3V col1 = transform1To0.getCol1(); + const Vec3V col2 = transform1To0.getCol2(); + + const Vec3V abs1To0Col0 = V3Add(V3Abs(col0), uEps); + const Vec3V abs1To0Col1 = V3Add(V3Abs(col1), uEps); + const Vec3V abs1To0Col2 = V3Add(V3Abs(col2), uEps); + + const Vec3V abs0To1Col0 = V3Add(V3Abs(rot0To1.col0), uEps); + const Vec3V abs0To1Col1 = V3Add(V3Abs(rot0To1.col1), uEps); + const Vec3V abs0To1Col2 = V3Add(V3Abs(rot0To1.col2), uEps); + + FloatV sign[6]; + FloatV overlap[6]; + + FloatV ra, rb, radiusSum; + //ua0 + { + sign[0] = tx; + + const Vec3V vtemp3 = V3Mul(abs0To1Col0, box1Extent); + rb = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ea0, rb); + overlap[0] = FAdd(FSub(radiusSum, FAbs(sign[0])), contactDist); + if(FAllGrtr(zero, overlap[0])) + return false; + } + + //ua1 + { + sign[1] = ty; + + const Vec3V vtemp3 = V3Mul(abs0To1Col1, box1Extent); + rb = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ea1, rb); + overlap[1] = FAdd(FSub(radiusSum, FAbs(sign[1])), contactDist); + if(FAllGrtr(zero, overlap[1])) + return false; + } + + //ua2 + { + sign[2] = tz; + ra = ea2; + + const Vec3V vtemp3 = V3Mul(abs0To1Col2, box1Extent); + rb = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ea2, rb); + overlap[2] = FAdd(FSub(radiusSum, FAbs(sign[2])), contactDist); + if(FAllGrtr(zero, overlap[2])) + return false; + } + + //ub0 + { + sign[3] = V3Dot(transform1To0.p, col0); + + const Vec3V vtemp3 = V3Mul(abs1To0Col0, box0Extent); + ra = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ra, eb0); + overlap[3] = FAdd(FSub(radiusSum, FAbs(sign[3])), contactDist); + if(FAllGrtr(zero, overlap[3])) + return false; + } + + //ub1 + { + sign[4] = V3Dot(transform1To0.p, col1); + + const Vec3V vtemp3 = V3Mul(abs1To0Col1, box0Extent); + ra = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ra, eb1); + overlap[4] = FAdd(FSub(radiusSum, FAbs(sign[4])), contactDist); + if(FAllGrtr(zero, overlap[4])) + return false; + } + + //ub2 + { + sign[5] = V3Dot(transform1To0.p, col2); + + const Vec3V vtemp3 = V3Mul(abs1To0Col2, box0Extent); + ra = FAdd(V3GetX(vtemp3), FAdd(V3GetY(vtemp3), V3GetZ(vtemp3))); + + radiusSum = FAdd(ra, eb2); + overlap[5] = FAdd(FSub(radiusSum, FAbs(sign[5])), contactDist); + if(FAllGrtr(zero, overlap[5])) + return false; + } + + //ua0 X ub0 + { + //B into A's space, ua0Xub0[0,-b3, b2] + const FloatV absSign = FAbs(FSub(FMul(V3GetY(col0), tz), FMul(V3GetZ(col0), ty))); + + //B into A's space, ua0Xub0[0,-b3, b2] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col0), ea1); + const FloatV vtemp1 = FMul(V3GetY(abs1To0Col0), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub0[0, a3, -a2] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col0), eb1); + const FloatV vtemp02 = FMul(V3GetY(abs0To1Col0), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum)) return false; + } + + //ua0 X ub1 + { + //B into A's space, ua0Xub0[0, -b3, b2] + const FloatV absSign = FAbs(FSub(FMul(V3GetY(col1), tz), FMul(V3GetZ(col1), ty))); + + //B into A's space, ua0Xub0[0, -b3, b2] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col1), ea1); + const FloatV vtemp1 = FMul(V3GetY(abs1To0Col1), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[-a3, 0, a1] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col0), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col0), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + + if(FAllGrtr(absSign, radiusSum)) return false; + } + + //ua0 X ub2 + { + //B into A's space, ua0Xub0[0, -b3, b2] + const FloatV absSign = FAbs(FSub(FMul(V3GetY(col2), tz), FMul(V3GetZ(col2), ty))); + + //B into A's space, ua0Xub0[0, -b3, b2] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col2), ea1); + const FloatV vtemp1 = FMul(V3GetY(abs1To0Col2), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[a2, -a1, 0] + const FloatV vtemp01 = FMul(V3GetY(abs0To1Col0), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col0), eb1); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum)) return false; + } + + //ua1 X ub0 + { + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV absSign = FAbs(FSub(FMul(V3GetZ(col0), tx), FMul(V3GetX(col0), tz))); + + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col0), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col0), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[0, a3, -a2] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col1), eb1); + const FloatV vtemp02 = FMul(V3GetY(abs0To1Col1), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + //ua1 X ub1 + { + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV absSign = FAbs(FSub(FMul(V3GetZ(col1), tx), FMul(V3GetX(col1), tz))); + + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col1), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col1), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[-a3, 0, -a1] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col1), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col1), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + //ua1 X ub2 + { + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV absSign=FAbs(FSub(FMul(V3GetZ(col2), tx), FMul(V3GetX(col2), tz))); + + //B into A's space, ua0Xub0[b3, 0, -b1] + const FloatV vtemp0 = FMul(V3GetZ(abs1To0Col2), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col2), ea2); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[a2, -a1, 0] + const FloatV vtemp01 = FMul(V3GetY(abs0To1Col1), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col1), eb1); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + //ua2 X ub0 + { + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV absSign = FAbs(FSub(FMul(V3GetX(col0), ty), FMul(V3GetY(col0), tx))); + + + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV vtemp0 = FMul(V3GetY(abs1To0Col0), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col0), ea1); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[0, a3, -a2] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col2), eb1); + const FloatV vtemp02 = FMul(V3GetY(abs0To1Col2), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + //ua2 X ub1 + { + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV absSign = FAbs(FSub(FMul(V3GetX(col1), ty), FMul(V3GetY(col1), tx))); + + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV vtemp0 = FMul(V3GetY(abs1To0Col1), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col1), ea1); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[-a3, 0, a1] + const FloatV vtemp01 = FMul(V3GetZ(abs0To1Col2), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col2), eb2); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + //ua2 X ub2 + { + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV absSign=FAbs(FSub(FMul(V3GetX(col2), ty), FMul(V3GetY(col2), tx))); + + //B into A's space, ua2Xub0[-b2, b1, 0] + const FloatV vtemp0 = FMul(V3GetY(abs1To0Col2), ea0); + const FloatV vtemp1 = FMul(V3GetX(abs1To0Col2), ea1); + ra = FAdd(vtemp0, vtemp1); + + //A into B's space, ua0Xub1[a2, -a1, 0] + const FloatV vtemp01 = FMul(V3GetY(abs0To1Col2), eb0); + const FloatV vtemp02 = FMul(V3GetX(abs0To1Col2), eb1); + rb = FAdd(vtemp01, vtemp02); + + radiusSum = FAdd(FAdd(ra, rb), contactDist); + if(FAllGrtr(absSign, radiusSum))return false; + } + + Vec3V mtd; + + PxU32 feature = 0; + FloatV minOverlap = overlap[0]; + + for(PxU32 i=1; i<6; ++i) + { + if(FAllGrtr(minOverlap, overlap[i])) + { + minOverlap = overlap[i]; + feature = i; + } + } + + PxMatTransformV newTransformV; + const Vec3V axis00 = transform0.getCol0(); + const Vec3V axis01 = transform0.getCol1(); + const Vec3V axis02 = transform0.getCol2(); + const Vec3V axis10 = transform1.getCol0(); + const Vec3V axis11 = transform1.getCol1(); + const Vec3V axis12 = transform1.getCol2(); + + Vec3V incidentFaceNormalInNew; + Vec3V pts[4]; + bool flip = false; + switch(feature) + { + case 0: //ua0 + { + if(FAllGrtrOrEq(zero, sign[0])) + { + mtd = axis00; + newTransformV.rot.col0 = V3Neg(axis02); + newTransformV.rot.col1 = axis01; + newTransformV.rot.col2 = axis00; + newTransformV.p = V3NegScaleSub(axis00, ea0, transform0.p); + } + else + { + const Vec3V nAxis00 = V3Neg(axis00); + mtd = nAxis00; + newTransformV.rot.col0 = axis02; + newTransformV.rot.col1 = axis01; + newTransformV.rot.col2 = nAxis00; + newTransformV.p = V3ScaleAdd(axis00, ea0, transform0.p); + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform1); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, V3Neg(localNormal), transform1ToNew, box1Extent); + + calculateContacts(ea2, ea1, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + + break; + }; + case 1: //ua1 + { + if(FAllGrtrOrEq(zero, sign[1])) + { + mtd = axis01; + newTransformV.rot.col0 = axis00; + newTransformV.rot.col1 = V3Neg(axis02); + newTransformV.rot.col2 = axis01; + newTransformV.p = V3NegScaleSub(axis01, ea1, transform0.p); + } + else + { + const Vec3V nAxis01 = V3Neg(axis01); + mtd = nAxis01; + newTransformV.rot.col0 = axis00; + newTransformV.rot.col1 = axis02; + newTransformV.rot.col2 = nAxis01; + newTransformV.p = V3ScaleAdd(axis01, ea1, transform0.p); + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform1); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, V3Neg(localNormal), transform1ToNew, box1Extent); + + calculateContacts(ea0, ea2, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + + break; + }; + case 2: //ua2 + { + if(FAllGrtrOrEq(zero, sign[2])) + { + mtd = axis02; + newTransformV.rot.col0 = axis00; + newTransformV.rot.col1 = axis01; + newTransformV.rot.col2 = axis02; + + newTransformV.p = V3NegScaleSub(axis02, ea2, transform0.p); + } + else + { + const Vec3V nAxis02 = V3Neg(axis02); + mtd = nAxis02; + newTransformV.rot.col0 = axis00; + newTransformV.rot.col1 = V3Neg(axis01); + newTransformV.rot.col2 = nAxis02; + newTransformV.p = V3ScaleAdd(axis02, ea2, transform0.p); + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform1); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, V3Neg(localNormal), transform1ToNew, box1Extent); + + calculateContacts(ea0, ea1, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + + break; + }; + case 3: //ub0 + { + flip = true; + if(FAllGrtrOrEq(zero, sign[3])) + { + mtd = axis10; + newTransformV.rot.col0 = axis12; + newTransformV.rot.col1 = axis11; + newTransformV.rot.col2 = V3Neg(axis10); + newTransformV.p = V3ScaleAdd(axis10, eb0, transform1.p); //transform0.p - extents0.x*axis00; + } + else + { + mtd = V3Neg(axis10); + newTransformV.rot.col0 = V3Neg(axis12); + newTransformV.rot.col1 = axis11; + newTransformV.rot.col2 = axis10; + newTransformV.p =V3NegScaleSub(axis10, eb0, transform1.p);//transform0.p + extents0.x*axis00; + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform0); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, localNormal, transform1ToNew, box0Extent); + + calculateContacts(eb2, eb1, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + + break; + }; + case 4: //ub1; + { + flip = true; + if(FAllGrtrOrEq(zero, sign[4])) + { + mtd = axis11; + newTransformV.rot.col0 = axis10; + newTransformV.rot.col1 = axis12; + newTransformV.rot.col2 = V3Neg(axis11); + + newTransformV.p = V3ScaleAdd(axis11, eb1, transform1.p); + } + else + { + mtd = V3Neg(axis11); + + newTransformV.rot.col0 = axis10; + newTransformV.rot.col1 = V3Neg(axis12); + newTransformV.rot.col2 = axis11; + newTransformV.p = V3NegScaleSub(axis11, eb1, transform1.p); //transform0.p + extents0.x*axis00; + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform0); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, localNormal, transform1ToNew, box0Extent); + calculateContacts(eb0, eb2, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + break; + } + case 5: //ub2; + { + + flip = true; + if(FAllGrtrOrEq(zero, sign[5])) + { + mtd = axis12; + newTransformV.rot.col0 = axis10; + newTransformV.rot.col1 = V3Neg(axis11); + newTransformV.rot.col2 = V3Neg(axis12); + newTransformV.p = V3ScaleAdd(axis12, eb2, transform1.p); + } + else + { + mtd = V3Neg(axis12); + + newTransformV.rot.col0 = axis10; + newTransformV.rot.col1 = axis11; + newTransformV.rot.col2 = axis12; + newTransformV.p = V3NegScaleSub(axis12, eb2, transform1.p); + } + + const aos::PxMatTransformV transform1ToNew = newTransformV.transformInv(transform0); + const Vec3V localNormal =newTransformV.rotateInv(mtd); + getIncidentPolygon(pts, incidentFaceNormalInNew, localNormal, transform1ToNew, box0Extent); + + calculateContacts(eb0, eb1, pts, incidentFaceNormalInNew, localNormal, manifoldContacts, numContacts, contactDist); + break; + }; + default: + return false; + } + + if(numContacts != 0) + { + if(flip) + { + for(PxU32 i=0; i(shape0); + const PxBoxGeometry& shapeBox1 = checkedCast(shape1); + + // Get actual shape data + Gu::PersistentContactManifold& manifold = cache.getManifold(); + PxPrefetchLine(&manifold, 256); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + + const FloatV contactDist = FLoad(params.mContactDistance); + const Vec3V boxExtents0 = V3LoadU(shapeBox0.halfExtents); + const Vec3V boxExtents1 = V3LoadU(shapeBox1.halfExtents); + + //Transfer A into the local space of B + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV boxMargin0 = Gu::CalculatePCMBoxMargin(boxExtents0, toleranceLength); + const FloatV boxMargin1 = Gu::CalculatePCMBoxMargin(boxExtents1, toleranceLength); + const FloatV minMargin = FMin(boxMargin0, boxMargin1); + + const PxU32 initialContacts = manifold.mNumContacts; + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.8f)); + + manifold.refreshContactPoints(aToB, projectBreakingThreshold, contactDist); + + const PxU32 newContacts = manifold.mNumContacts; + + const bool bLostContacts = (newContacts != initialContacts); + + PX_UNUSED(bLostContacts); + + const FloatV radiusA = V3Length(boxExtents0); + const FloatV radiusB = V3Length(boxExtents1); + if(bLostContacts || manifold.invalidate_BoxConvex(curRTrans, transf0.q, transf1.q, minMargin, radiusA, radiusB)) + { + manifold.setRelativeTransform(curRTrans, transf0.q, transf1.q); + + PxMatTransformV transfV0(transf0); + PxMatTransformV transfV1(transf1); + + transfV0.rot.col0 = V3Normalize(transfV0.rot.col0); + transfV0.rot.col1 = V3Normalize(transfV0.rot.col1); + transfV0.rot.col2 = V3Normalize(transfV0.rot.col2); + + transfV1.rot.col0 = V3Normalize(transfV1.rot.col0); + transfV1.rot.col1 = V3Normalize(transfV1.rot.col1); + transfV1.rot.col2 = V3Normalize(transfV1.rot.col2); + + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + PxU32 numContacts = 0; + + if(doBoxBoxGenerateContacts(boxExtents0, boxExtents1, transfV0, transfV1, contactDist, manifoldContacts, numContacts)) + { + if(numContacts > 0) + { + manifold.addBatchManifoldContacts(manifoldContacts, numContacts, toleranceLength); + const Vec3V worldNormal = V3Normalize(transfV1.rotate(Vec3V_From_Vec4V(manifold.mContactPoints[0].mLocalNormalPen))); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transfV1); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + else + { + const Vec3V zeroV = V3Zero(); + BoxV box0(zeroV, boxExtents0); + BoxV box1(zeroV, boxExtents1); + + manifold.mNumWarmStartPoints = 0; + const RelativeConvex convexA(box0, aToB); + const LocalConvex convexB(box1); + GjkOutput output; + + GjkStatus status = gjkPenetration, LocalConvex >(convexA, convexB, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + if(status == EPA_CONTACT) + { + const RelativeConvex convexA1(box0, aToB); + const LocalConvex convexB1(box1); + + status= epaPenetration(convexA1, convexB1, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + } + + if(status == GJK_CONTACT || status == EPA_CONTACT) + { + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + const Vec3V localPointA = aToB.transformInv(output.closestA);//curRTrans.transformInv(closestA); + const Vec3V localPointB = output.closestB; + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + numContacts += manifold.addManifoldPoint(localPointA, localPointB, localNormalPen, replaceBreakingThreshold); + + //transform the normal back to world space + const Vec3V worldNormal = V3Normalize(transf1.rotate(output.normal)); + + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + + } + } + } + else if(manifold.getNumContacts() > 0) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp new file mode 100644 index 0000000..3550ec4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactBoxConvex.cpp @@ -0,0 +1,259 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" + +#define PCM_BOX_HULL_DEBUG 0 + +using namespace physx; +using namespace Gu; +using namespace aos; + +static bool fullContactsGenerationBoxConvex(const GjkConvex* relativeConvex, const GjkConvex* localConvex, const PxTransformV& transf0, const PxTransformV& transf1, + PersistentContact* manifoldContacts, PxContactBuffer& contactBuffer, Gu::PersistentContactManifold& manifold, Vec3VArg normal, + const Vec3VArg closestA, const Vec3VArg closestB, const FloatVArg contactDist, const bool idtScale, const bool doOverlapTest, PxRenderOutput* renderOutput, + const PxReal toleranceLength) +{ + Gu::PolygonalData polyData0; + + const BoxV& box = relativeConvex->getConvex(); + const ConvexHullV& convexHull = localConvex->getConvex(); + + PxVec3 halfExtents; + V3StoreU(box.extents, halfExtents); + PCMPolygonalBox polyBox0(halfExtents); + polyBox0.getPolygonalData(&polyData0); + polyData0.mPolygonVertexRefs = gPCMBoxPolygonData; + + Gu::PolygonalData polyData1; + getPCMConvexData(convexHull, idtScale, polyData1); + + Mat33V identity = M33Identity(); + SupportLocalImpl map0(box, transf0, identity, identity, true); + + PxU8 buff1[sizeof(SupportLocalImpl)]; + + SupportLocal* map1 = (idtScale ? static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(static_cast(convexHull), transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale)) : + static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(convexHull, transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale))); + + PxU32 numContacts = 0; + if(generateFullContactManifold(polyData0, polyData1, &map0, map1, manifoldContacts, numContacts, contactDist, normal, closestA, closestB, box.getMarginF(), convexHull.getMarginF(), + doOverlapTest, renderOutput, toleranceLength)) + { + if (numContacts > 0) + { + //reduce contacts + manifold.addBatchManifoldContacts(manifoldContacts, numContacts, toleranceLength); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + } + else + { + //if doOverlapTest is true, which means GJK/EPA degenerate so we won't have any contact in the manifoldContacts array + if (!doOverlapTest) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + } + } + + return true; + } + return false; +} + +static bool generateOrProcessContactsBoxConvex(const GjkConvex* relativeConvex, const GjkConvex* localConvex, const PxTransformV& transf0, const PxTransformV& transf1, + const PxMatTransformV& aToB, GjkStatus status, GjkOutput& output, PersistentContactManifold& manifold, PxContactBuffer& contactBuffer, + const PxU32 initialContacts, const FloatV minMargin, const FloatV contactDist, + const bool idtScale, const PxReal toleranceLength, PxRenderOutput* renderOutput) +{ + if (status == GJK_NON_INTERSECT) + { + return false; + } + else + { + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + + const Vec3V localNor = manifold.mNumContacts ? manifold.getLocalNormal() : V3Zero(); + + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + //addGJKEPAContacts will increase the number of contacts in manifold. If status == EPA_CONTACT, we need to run epa algorithm and generate closest points, normal and + //pentration. If epa doesn't degenerate, we will store the contacts information in the manifold. Otherwise, we will return true to do the fallback test + const bool doOverlapTest = addGJKEPAContacts(relativeConvex, localConvex, aToB, status, manifoldContacts, replaceBreakingThreshold, FLoad(toleranceLength), output, manifold); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + //ML: after we refresh the contacts(newContacts) and generate a GJK/EPA contacts(we will store that in the manifold), if the number of contacts is still less than the original contacts, + //which means we lose too mang contacts and we should regenerate all the contacts in the current configuration + //Also, we need to look at the existing contacts, if the existing contacts has very different normal than the GJK/EPA contacts, + //which means we should throw away the existing contacts and do full contact gen + const bool fullContactGen = FAllGrtr(FLoad(0.707106781f), V3Dot(localNor, output.normal)) || (manifold.mNumContacts < initialContacts); + + if (fullContactGen || doOverlapTest) + { + return fullContactsGenerationBoxConvex(relativeConvex, localConvex, transf0, transf1, manifoldContacts, contactBuffer, + manifold, output.normal, output.closestA, output.closestB, contactDist, idtScale, doOverlapTest, renderOutput, toleranceLength); + } + else + { + const Vec3V newLocalNor = V3Add(localNor, output.normal); + const Vec3V worldNormal = V3Normalize(transf1.rotate(newLocalNor)); + //const Vec3V worldNormal = transf1.rotate(normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + return true; + } + } +} + +bool Gu::pcmContactBoxConvex(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + const PxBoxGeometry& shapeBox = checkedCast(shape0); + + Gu::PersistentContactManifold& manifold = cache.getManifold(); + const Gu::ConvexHullData* hullData = _getHullData(shapeConvex); + PxPrefetchLine(hullData); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const FloatV contactDist = FLoad(params.mContactDistance); + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV convexMargin = Gu::CalculatePCMConvexMargin(hullData, vScale, toleranceLength); + const FloatV boxMargin = Gu::CalculatePCMBoxMargin(boxExtents, toleranceLength); + +#if PCM_BOX_HULL_DEBUG + const PxVec3* verts = hullData->getHullVertices(); + + for (PxU32 i = 0; i < hullData->mNbPolygons; ++i) + { + const HullPolygonData& polygon = hullData->mPolygons[i]; + const PxU8* inds = hullData->getVertexData8() + polygon.mVRef8; + Vec3V* points = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*polygon.mNbVerts, 16)); + + for (PxU32 j = 0; j < polygon.mNbVerts; ++j) + { + points[j] = V3LoadU_SafeReadW(verts[inds[j]]); + } + + Gu::PersistentContactManifold::drawPolygon(*renderOutput, transf1, points, (PxU32)polygon.mNbVerts, 0x00ff0000); + } +#endif + + const FloatV minMargin = FMin(convexMargin, boxMargin);//FMin(boxMargin, convexMargin); + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.8f)); + const PxU32 initialContacts = manifold.mNumContacts; + + manifold.refreshContactPoints(aToB, projectBreakingThreshold, contactDist); + + const Vec3V extents = V3Mul(V3LoadU(hullData->mInternal.mExtents), vScale); + const FloatV radiusA = V3Length(boxExtents); + const FloatV radiusB = V3Length(extents); + + //After the refresh contact points, the numcontacts in the manifold will be changed + const bool bLostContacts = (manifold.mNumContacts != initialContacts); + + if(bLostContacts || manifold.invalidate_BoxConvex(curRTrans, transf0.q, transf1.q, minMargin, radiusA, radiusB)) + { + manifold.setRelativeTransform(curRTrans, transf0.q, transf1.q); + + GjkStatus status = manifold.mNumContacts > 0 ? GJK_UNDEFINED : GJK_NON_INTERSECT; + + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + const bool idtScale = shapeConvex.scale.isIdentity(); + const Gu::ConvexHullV convexHull(hullData, V3LoadU(hullData->mCenterOfMass), vScale, vQuat, idtScale); + const Gu::BoxV box(V3Zero(), boxExtents); + GjkOutput output; + + const RelativeConvex relativeConvex(box, aToB); + + if(idtScale) + { + const LocalConvex localConvex(static_cast(convexHull)); + + status = gjkPenetration, LocalConvex >(relativeConvex, localConvex, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + return generateOrProcessContactsBoxConvex(&relativeConvex, &localConvex, transf0, transf1, aToB, + status, output, manifold, contactBuffer, initialContacts, + minMargin, contactDist, idtScale, toleranceLength, renderOutput); + } + else + { + const LocalConvex localConvex(convexHull); + + status = gjkPenetration, LocalConvex >(relativeConvex, localConvex, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + return generateOrProcessContactsBoxConvex(&relativeConvex, &localConvex, transf0, transf1, aToB, + status, output, manifold, contactBuffer, initialContacts, + minMargin, contactDist, idtScale, toleranceLength, renderOutput); + } + } + else if(manifold.getNumContacts()>0) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp new file mode 100644 index 0000000..9e2c232 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleBox.cpp @@ -0,0 +1,210 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuVecCapsule.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +static bool fullContactsGenerationCapsuleBox(const CapsuleV& capsule, const BoxV& box, const PxVec3 halfExtents, const PxMatTransformV& aToB, const PxTransformV& transf0, const PxTransformV& transf1, + PersistentContact* manifoldContacts, PxU32& numContacts, PxContactBuffer& contactBuffer, PersistentContactManifold& manifold, Vec3V& normal, const Vec3VArg closest, + const PxReal boxMargin, const FloatVArg contactDist, const bool doOverlapTest, const PxReal toleranceScale, PxRenderOutput* renderOutput) +{ + + PolygonalData polyData; + PCMPolygonalBox polyBox(halfExtents); + polyBox.getPolygonalData(&polyData); + + Mat33V identity = M33Identity(); + SupportLocalImpl map(box, transf1, identity, identity); + + PxU32 origContacts = numContacts; + if (generateCapsuleBoxFullContactManifold(capsule, polyData, &map, aToB, manifoldContacts, numContacts, contactDist, normal, closest, boxMargin, doOverlapTest, toleranceScale, renderOutput)) + { + //EPA has contacts and we have new contacts, we discard the EPA contacts + if(origContacts != 0 && numContacts != origContacts) + { + numContacts--; + manifoldContacts++; + } + + manifold.addBatchManifoldContacts2(manifoldContacts, numContacts); + + normal = transf1.rotate(normal); + + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsule.radius, contactDist); + + return true; + } + + return false; +} + +bool Gu::pcmContactCapsuleBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + const PxBoxGeometry& shapeBox = checkedCast(shape1); + + PersistentContactManifold& manifold = cache.getManifold(); + PxPrefetchLine(&manifold, 256); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + + const PxTransformV curRTrans = transf1.transformInv(transf0); + const PxMatTransformV aToB_(curRTrans); + + const FloatV capsuleRadius = FLoad(shapeCapsule.radius); + const FloatV capsuleHalfHeight = FLoad(shapeCapsule.halfHeight); + + const PxU32 initialContacts = manifold.mNumContacts; + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV boxMargin = Gu::CalculatePCMBoxMargin(boxExtents, toleranceLength); + + const FloatV minMargin = FMin(boxMargin, capsuleRadius); + + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.8f)); + + const FloatV refreshDist = FAdd(contactDist, capsuleRadius); + //refreshContactPoints remove invalid contacts from the manifold and update the number correspondingly + manifold.refreshContactPoints(aToB_, projectBreakingThreshold, refreshDist); + + const bool bLostContacts = (manifold.mNumContacts != initialContacts); + + if(bLostContacts || manifold.invalidate_SphereCapsule(curRTrans, minMargin)) + { + GjkStatus status = manifold.mNumContacts > 0 ? GJK_UNDEFINED : GJK_NON_INTERSECT; + + manifold.setRelativeTransform(curRTrans); + const PxMatTransformV aToB(curRTrans); + + BoxV box(transf1.p, boxExtents); + //transform capsule into the local space of box + CapsuleV capsule(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + const LocalConvex convexA(capsule); + const LocalConvex convexB(box); + GjkOutput output; + + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), box.getCenter()); + status = gjkPenetration, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + PxU32 numContacts = 0; + bool doOverlapTest = false; + if(status == GJK_NON_INTERSECT) + { + return false; + } + else if(status == GJK_DEGENERATE) + { + return fullContactsGenerationCapsuleBox(capsule, box, shapeBox.halfExtents, aToB, transf0, transf1, manifoldContacts, numContacts, contactBuffer, + manifold, output.normal, output.closestB, box.getMarginF(), contactDist, true, params.mToleranceLength, renderOutput); + } + else + { + if(status == GJK_CONTACT) + { + const Vec3V localPointA = aToB.transformInv(output.closestA);//curRTrans.transformInv(closestA); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + //Add contact to contact stream + manifoldContacts[numContacts].mLocalPointA = localPointA; + manifoldContacts[numContacts].mLocalPointB = output.closestB; + manifoldContacts[numContacts++].mLocalNormalPen = localNormalPen; + } + else + { + PX_ASSERT(status == EPA_CONTACT); + + status= epaPenetration(convexA, convexB, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + if(status == EPA_CONTACT) + { + const Vec3V localPointA = aToB.transformInv(output.closestA);//curRTrans.transformInv(closestA); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + //Add contact to contact stream + manifoldContacts[numContacts].mLocalPointA = localPointA; + manifoldContacts[numContacts].mLocalPointB = output.closestB; + manifoldContacts[numContacts++].mLocalNormalPen = localNormalPen; + + } + else + { + doOverlapTest = true; + } + + } + + + if(initialContacts == 0 || bLostContacts || doOverlapTest) + { + return fullContactsGenerationCapsuleBox(capsule, box, shapeBox.halfExtents, aToB, transf0, transf1, manifoldContacts, numContacts, contactBuffer, manifold, output.normal, + output.closestB, box.getMarginF(), contactDist, doOverlapTest, params.mToleranceLength, renderOutput); + } + else + { + + //The contacts is either come from GJK or EPA + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.1f)); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + manifold.addManifoldPoint2(curRTrans.transformInv(output.closestA), output.closestB, localNormalPen, replaceBreakingThreshold); + + const Vec3V normal = transf1.rotate(output.normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsuleRadius, contactDist); + + return true; + } + } + } + else if(manifold.getNumContacts() > 0) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, worldNormal, transf0, capsuleRadius, contactDist); + return true; + } + + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp new file mode 100644 index 0000000..fcb0797 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleCapsule.cpp @@ -0,0 +1,281 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecCapsule.h" +#include "GuContactMethodImpl.h" +#include "GuDistanceSegmentSegmentSIMD.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +static Vec4V pcmDistancePointSegmentTValue22( const Vec3VArg a0, const Vec3VArg b0, + const Vec3VArg a1, const Vec3VArg b1, + const Vec3VArg p0, const Vec3VArg p1, + const Vec3VArg p2, const Vec3VArg p3) +{ + const Vec4V zero = V4Zero(); + const Vec3V ap00 = V3Sub(p0, a0); + const Vec3V ap10 = V3Sub(p1, a0); + const Vec3V ap01 = V3Sub(p2, a1); + const Vec3V ap11 = V3Sub(p3, a1); + + const Vec3V ab0 = V3Sub(b0, a0); + const Vec3V ab1 = V3Sub(b1, a1); + +/* const FloatV nom00 = V3Dot(ap00, ab0); + const FloatV nom10 = V3Dot(ap10, ab0); + const FloatV nom01 = V3Dot(ap01, ab1); + const FloatV nom11 = V3Dot(ap11, ab1);*/ + + const Vec4V combinedDot = V3Dot4(ap00, ab0, ap10, ab0, ap01, ab1, ap11, ab1); + const FloatV nom00 = V4GetX(combinedDot); + const FloatV nom10 = V4GetY(combinedDot); + const FloatV nom01 = V4GetZ(combinedDot); + const FloatV nom11 = V4GetW(combinedDot); + + const FloatV denom0 = V3Dot(ab0, ab0); + const FloatV denom1 = V3Dot(ab1, ab1); + + const Vec4V nom = V4Merge(nom00, nom10, nom01, nom11); + const Vec4V denom = V4Merge(denom0, denom0, denom1, denom1); + + const Vec4V tValue = V4Div(nom, denom); + return V4Sel(V4IsEq(denom, zero), zero, tValue); +} + +static void storeContact(const Vec3VArg contact, const Vec3VArg normal, const FloatVArg separation, PxContactBuffer& buffer) +{ + PxContactPoint& point = buffer.contacts[buffer.count++]; + + const Vec4V normalSep = aos::V4SetW(Vec4V_From_Vec3V(normal), separation); + + V4StoreA(normalSep, &point.normal.x); + V3StoreA(contact, point.point); + point.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; +} + +bool Gu::pcmContactCapsuleCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + // Get actual shape data + const PxCapsuleGeometry& shapeCapsule0 = checkedCast(shape0); + const PxCapsuleGeometry& shapeCapsule1 = checkedCast(shape1); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const Vec3V _p0 = V3LoadA(&transform0.p.x); + const QuatV q0 = QuatVLoadA(&transform0.q.x); + + const Vec3V _p1 = V3LoadA(&transform1.p.x); + const QuatV q1 = QuatVLoadA(&transform1.q.x); + + /*PsTransformV transf0(p0, q0); + PsTransformV transf1(p1, q1);*/ + + const FloatV r0 = FLoad(shapeCapsule0.radius); + const FloatV halfHeight0 = FLoad(shapeCapsule0.halfHeight); + + const FloatV r1 = FLoad(shapeCapsule1.radius); + const FloatV halfHeight1 = FLoad(shapeCapsule1.halfHeight); + + const FloatV cDist = FLoad(params.mContactDistance); + + const Vec3V positionOffset = V3Scale(V3Add(_p0, _p1), FHalf()); + const Vec3V p0 = V3Sub(_p0, positionOffset); + const Vec3V p1 = V3Sub(_p1, positionOffset); + + const FloatV zero = FZero(); + //const FloatV one = FOne(); + const Vec3V zeroV = V3Zero(); + + /*const Vec3V positionOffset = V3Scale(V3Add(transf0.p, transf1.p), FloatV_From_F32(0.5f)); + transf0.p = V3Sub(transf0.p, positionOffset); + transf1.p = V3Sub(transf1.p, positionOffset);*/ + + const Vec3V basisVector0 = QuatGetBasisVector0(q0); + const Vec3V tmp0 = V3Scale(basisVector0, halfHeight0); + const Vec3V s0 = V3Add(p0, tmp0); + const Vec3V e0 = V3Sub(p0, tmp0); + const Vec3V d0 = V3Sub(e0, s0); + + const Vec3V basisVector1 = QuatGetBasisVector0(q1); + const Vec3V tmp1 = V3Scale(basisVector1, halfHeight1); + const Vec3V s1 = V3Add(p1, tmp1); + const Vec3V e1 = V3Sub(p1, tmp1); + + const Vec3V d1 = V3Sub(e1, s1); + + const FloatV sumRadius = FAdd(r0, r1); + const FloatV inflatedSum = FAdd(sumRadius, cDist); + const FloatV inflatedSumSquared = FMul(inflatedSum, inflatedSum); + const FloatV a = V3Dot(d0, d0);//squared length of segment1 + const FloatV e = V3Dot(d1, d1);//squared length of segment2 + const FloatV eps = FLoad(1e-6f);//FEps(); + + FloatV t0, t1; + const FloatV sqDist0 = distanceSegmentSegmentSquared(s0, d0, s1, d1, t0, t1); + + if(FAllGrtrOrEq(inflatedSumSquared, sqDist0)) + { + const Vec4V zeroV4 = V4Zero(); + const Vec4V oneV4 = V4One(); + //check to see whether these two capsule are paralle + const FloatV parallelTolerance = FLoad(0.9998f); + + const BoolV con0 = FIsGrtr(eps, a); + const BoolV con1 = FIsGrtr(eps, e); + const Vec3V dir0 = V3Sel(con0, zeroV, V3ScaleInv(d0, FSqrt(a))); + const Vec3V dir1 = V3Sel(con1, zeroV, V3ScaleInv(d1, FSqrt(e))); + + const FloatV cos = FAbs(V3Dot(dir0, dir1)); + if(FAllGrtr(cos, parallelTolerance))//paralle + { + //project s, e into s1e1 + const Vec4V t= pcmDistancePointSegmentTValue22(s0, e0, s1, e1, + s1, e1, s0, e0); + + const BoolV con = BAnd(V4IsGrtrOrEq(t, zeroV4), V4IsGrtrOrEq(oneV4, t)); + const BoolV con00 = BGetX(con); + const BoolV con01 = BGetY(con); + const BoolV con10 = BGetZ(con); + const BoolV con11 = BGetW(con); + + /* PX_ALIGN(16, PxU32 conditions[4]); + F32Array_Aligned_From_Vec4V(con, (PxF32*)conditions);*/ + + PxU32 numContact=0; + + if(BAllEqTTTT(con00)) + { + const Vec3V projS1 = V3ScaleAdd(d0, V4GetX(t), s0); + const Vec3V v = V3Sub(projS1, s1); + const FloatV sqDist = V3Dot(v, v); + const BoolV bCon = BAnd(FIsGrtr(sqDist, eps), FIsGrtr(inflatedSumSquared, sqDist)); + + if(BAllEqTTTT(bCon)) + { + const FloatV dist = FSqrt(sqDist); + const FloatV pen = FSub(dist, sumRadius); + const Vec3V normal = V3ScaleInv(v, dist); + PX_ASSERT(isFiniteVec3V(normal)); + const Vec3V _p = V3NegScaleSub(normal, r0, projS1); + const Vec3V p = V3Add(_p, positionOffset); + + storeContact(p, normal, pen, contactBuffer); + numContact++; + } + } + if(BAllEqTTTT(con01)) + { + const Vec3V projE1 = V3ScaleAdd(d0, V4GetY(t), s0); + const Vec3V v = V3Sub(projE1, e1); + const FloatV sqDist = V3Dot(v, v); + const BoolV bCon = BAnd(FIsGrtr(sqDist, eps), FIsGrtr(inflatedSumSquared, sqDist)); + + if(BAllEqTTTT(bCon)) + { + const FloatV dist = FSqrt(sqDist); + const FloatV pen = FSub(dist, sumRadius); + const Vec3V normal = V3ScaleInv(v, dist); + PX_ASSERT(isFiniteVec3V(normal)); + const Vec3V _p = V3NegScaleSub(normal, r0, projE1); + const Vec3V p = V3Add(_p, positionOffset); + storeContact(p, normal, pen, contactBuffer); + numContact++; + } + } + + if(BAllEqTTTT(con10)) + { + const Vec3V projS0 = V3ScaleAdd(d1, V4GetZ(t), s1); + const Vec3V v = V3Sub(s0, projS0); + const FloatV sqDist = V3Dot(v, v); + const BoolV bCon = BAnd(FIsGrtr(sqDist, eps), FIsGrtr(inflatedSumSquared, sqDist)); + + if(BAllEqTTTT(bCon)) + { + const FloatV dist = FSqrt(sqDist); + const FloatV pen = FSub(dist, sumRadius); + const Vec3V normal = V3ScaleInv(v, dist); + PX_ASSERT(isFiniteVec3V(normal)); + const Vec3V _p = V3NegScaleSub(normal, r0, s0); + const Vec3V p = V3Add(_p, positionOffset); + //const Vec3V p = V3ScaleAdd(normal, r0, s0); + storeContact(p, normal, pen, contactBuffer); + numContact++; + } + } + + if(BAllEqTTTT(con11)) + { + const Vec3V projE0 = V3ScaleAdd(d1, V4GetW(t), s1); + const Vec3V v = V3Sub(e0, projE0); + const FloatV sqDist = V3Dot(v, v); + const BoolV bCon = BAnd(FIsGrtr(sqDist, eps), FIsGrtr(inflatedSumSquared, sqDist)); + + if(BAllEqTTTT(bCon)) + { + const FloatV dist = FSqrt(sqDist); + const FloatV pen = FSub(dist, sumRadius); + const Vec3V normal = V3ScaleInv(v, dist); + PX_ASSERT(isFiniteVec3V(normal)); + const Vec3V _p = V3NegScaleSub(normal, r0, e0); + const Vec3V p = V3Add(_p, positionOffset); + //const Vec3V p = V3ScaleAdd(normal, r0, e0); + storeContact(p, normal, pen, contactBuffer); + numContact++; + } + } + + if(numContact) + return true; + } + + const Vec3V closestA = V3ScaleAdd(d0, t0, s0); + const Vec3V closestB = V3ScaleAdd(d1, t1, s1); + + const BoolV con = FIsGrtr(eps, sqDist0); + //const Vec3V normal = V3Sel(FIsEq(dist, zero), V3Sel(FIsGrtr(a, eps), V3Normalise(d0), V3Scale(V3Sub(closestA, closestB), FRecip(dist))); + const Vec3V _normal = V3Sel(con, V3Sel(FIsGrtr(a, eps), d0, V3UnitX()), V3Sub(closestA, closestB)); + const Vec3V normal = V3Normalize(_normal); + PX_ASSERT(isFiniteVec3V(normal)); + const Vec3V _point = V3NegScaleSub(normal, r0, closestA); + const Vec3V p = V3Add(_point, positionOffset); + const FloatV dist = FSel(con, zero, FSqrt(sqDist0)); + const FloatV pen = FSub(dist, sumRadius); + //PX_ASSERT(FAllGrtrOrEq(zero, pen)); + storeContact(p, normal, pen, contactBuffer); + return true; + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp new file mode 100644 index 0000000..295d572 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleConvex.cpp @@ -0,0 +1,248 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" +#include "GuVecCapsule.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +static bool fullContactsGenerationCapsuleConvex(const CapsuleV& capsule, const ConvexHullV& convexHull, const PxMatTransformV& aToB, const PxTransformV& transf0,const PxTransformV& transf1, + PersistentContact* manifoldContacts, PxContactBuffer& contactBuffer, const bool idtScale, PersistentContactManifold& manifold, Vec3VArg normal, + const Vec3VArg closest, const PxReal tolerance, const FloatVArg contactDist, const bool doOverlapTest, PxRenderOutput* renderOutput, const PxReal toleranceLength) +{ + + PX_UNUSED(renderOutput); + Gu::PolygonalData polyData; + getPCMConvexData(convexHull,idtScale, polyData); + + PxU8 buff[sizeof(SupportLocalImpl)]; + SupportLocal* map = (idtScale ? static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(static_cast(convexHull), transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale)) : + static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(convexHull, transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale))); + + PxU32 numContacts = 0; + if (generateFullContactManifold(capsule, polyData, map, aToB, manifoldContacts, numContacts, contactDist, normal, closest, tolerance, doOverlapTest, toleranceLength)) + { + + if (numContacts > 0) + { + manifold.addBatchManifoldContacts2(manifoldContacts, numContacts); + //transform normal into the world space + normal = transf1.rotate(normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsule.radius, contactDist); + } + else + { + if (!doOverlapTest) + { + normal = transf1.rotate(normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsule.radius, contactDist); + } + } + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + + } + return false; +} + +bool Gu::pcmContactCapsuleConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + + PersistentContactManifold& manifold = cache.getManifold(); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + PxPrefetchLine(hullData); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + + const FloatV contactDist = FLoad(params.mContactDistance); + const FloatV capsuleHalfHeight = FLoad(shapeCapsule.halfHeight); + const FloatV capsuleRadius = FLoad(shapeCapsule.radius); + + //Transfer A into the local space of B + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV convexMargin = Gu::CalculatePCMConvexMargin(hullData, vScale, toleranceLength); + const FloatV capsuleMinMargin = Gu::CalculateCapsuleMinMargin(capsuleRadius); + const FloatV minMargin = FMin(convexMargin, capsuleMinMargin); + + const PxU32 initialContacts = manifold.mNumContacts; + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(1.25f)); + const FloatV refreshDist = FAdd(contactDist, capsuleRadius); + + manifold.refreshContactPoints(aToB, projectBreakingThreshold, refreshDist); + + //ML: after refreshContactPoints, we might lose some contacts + const bool bLostContacts = (manifold.mNumContacts != initialContacts); + + GjkStatus status = manifold.mNumContacts > 0 ? GJK_UNDEFINED : GJK_NON_INTERSECT; + + PX_UNUSED(bLostContacts); + if(bLostContacts || manifold.invalidate_SphereCapsule(curRTrans, minMargin)) + { + const bool idtScale = shapeConvex.scale.isIdentity(); + + manifold.setRelativeTransform(curRTrans); + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + const ConvexHullV convexHull(hullData, V3LoadU(hullData->mCenterOfMass), vScale, vQuat, idtScale); + + //transform capsule(a) into the local space of convexHull(b) + const CapsuleV capsule(aToB.p, aToB.rotate(V3Scale(V3UnitX(), capsuleHalfHeight)), capsuleRadius); + + GjkOutput output; + LocalConvex convexA(capsule); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); + if(idtScale) + { + const LocalConvex convexB(*PX_CONVEX_TO_NOSCALECONVEX(&convexHull)); + status = gjkPenetration, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + } + else + { + const LocalConvex convexB(convexHull); + status = gjkPenetration, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + } + + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + bool doOverlapTest = false; + if(status == GJK_NON_INTERSECT) + { + return false; + } + else if(status == GJK_DEGENERATE) + { + return fullContactsGenerationCapsuleConvex(capsule, convexHull, aToB, transf0, transf1, manifoldContacts, contactBuffer, idtScale, manifold, output.normal, + output.closestB, convexHull.getMarginF(), contactDist, true, renderOutput, toleranceLength); + } + else + { + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + if(status == GJK_CONTACT) + { + const Vec3V localPointA = aToB.transformInv(output.closestA);//curRTrans.transformInv(closestA); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + //Add contact to contact stream + manifoldContacts[0].mLocalPointA = localPointA; + manifoldContacts[0].mLocalPointB = output.closestB; + manifoldContacts[0].mLocalNormalPen = localNormalPen; + + //Add contact to manifold + manifold.addManifoldPoint2(localPointA, output.closestB, localNormalPen, replaceBreakingThreshold); + } + else + { + PX_ASSERT(status == EPA_CONTACT); + + if(idtScale) + { + const LocalConvex convexB(*PX_CONVEX_TO_NOSCALECONVEX(&convexHull)); + status= Gu::epaPenetration(convexA, convexB, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + } + else + { + const LocalConvex convexB(convexHull); + status= Gu::epaPenetration(convexA, convexB, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + } + + if(status == EPA_CONTACT) + { + const Vec3V localPointA = aToB.transformInv(output.closestA);//curRTrans.transformInv(closestA); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + //Add contact to contact stream + manifoldContacts[0].mLocalPointA = localPointA; + manifoldContacts[0].mLocalPointB = output.closestB; + manifoldContacts[0].mLocalNormalPen = localNormalPen; + + //Add contact to manifold + manifold.addManifoldPoint2(localPointA, output.closestB, localNormalPen, replaceBreakingThreshold); + + + } + else + { + doOverlapTest = true; + } + } + + + if(initialContacts == 0 || bLostContacts || doOverlapTest) + { + return fullContactsGenerationCapsuleConvex(capsule, convexHull, aToB, transf0, transf1, manifoldContacts, contactBuffer, idtScale, manifold, output.normal, + output.closestB, convexHull.getMarginF(), contactDist, doOverlapTest, renderOutput, toleranceLength); + } + else + { + //This contact is either come from GJK or EPA + const Vec3V normal = transf1.rotate(output.normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsuleRadius, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + } + } + else if (manifold.getNumContacts() > 0) + { + const Vec3V normal = manifold.getWorldNormal(transf1); + manifold.addManifoldContactsToContactBuffer(contactBuffer, normal, normal, transf0, capsuleRadius, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp new file mode 100644 index 0000000..2db16d3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleHeightField.cpp @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangleMesh.h" +#include "geomutils/PxContactBuffer.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxVecTransform.h" +#include "GuVecTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuHeightField.h" +#include "GuPCMContactConvexCommon.h" +#include "GuSegment.h" +#include "GuInternal.h" +#include "GuPCMContactMeshCallback.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +struct PCMCapsuleVsHeightfieldContactGenerationCallback : PCMHeightfieldContactGenerationCallback +{ + PCMCapsuleVsHeightfieldContactGenerationCallback& operator=(const PCMCapsuleVsHeightfieldContactGenerationCallback&); + +public: + PCMCapsuleVsMeshContactGeneration mGeneration; + + PCMCapsuleVsHeightfieldContactGenerationCallback( + const CapsuleV& capsule, + const aos::FloatVArg contactDistance, + const aos::FloatVArg replaceBreakingThreshold, + const PxTransformV& capsuleTransform, + const PxTransformV& heightfieldTransform, + const PxTransform& heightfieldTransform1, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + PxInlineArray* deferredContacts, + HeightFieldUtil& hfUtil + ) : + PCMHeightfieldContactGenerationCallback(hfUtil, heightfieldTransform1), + mGeneration(capsule, contactDistance, replaceBreakingThreshold, capsuleTransform, heightfieldTransform, multiManifold, + contactBuffer, deferredContacts) + { + } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; + +bool Gu::pcmContactCapsuleHeightField(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + const PxHeightFieldGeometry& shapeHeight = checkedCast(shape1); + + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const FloatV capsuleRadius = FLoad(shapeCapsule.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV capsuleTransform = loadTransformA(transform0);//capsule transform + const PxTransformV heightfieldTransform = loadTransformA(transform1);//height feild + + const PxTransformV curTransform = heightfieldTransform.transformInv(capsuleTransform); + + const FloatV replaceBreakingThreshold = FMul(capsuleRadius, FLoad(0.001f)); + + if(multiManifold.invalidate(curTransform, capsuleRadius, FLoad(0.02f))) + { + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + HeightFieldUtil hfUtil(shapeHeight); + + const PxVec3 tmp = getCapsuleHalfHeightVector(transform0, shapeCapsule); + + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; + + const PxVec3 capsuleCenterInMesh = transform1.transformInv(transform0.p); + const PxVec3 capsuleDirInMesh = transform1.rotateInv(tmp); + const CapsuleV capsule(V3LoadU(capsuleCenterInMesh), V3LoadU(capsuleDirInMesh), capsuleRadius); + + PCMCapsuleVsHeightfieldContactGenerationCallback callback( + capsule, + contactDist, + replaceBreakingThreshold, + capsuleTransform, + heightfieldTransform, + transform1, + multiManifold, + contactBuffer, + NULL, + hfUtil + ); + + // PT: TODO: improve these bounds - see computeCapsuleBounds + hfUtil.overlapAABBTriangles(transform0, transform1, getLocalCapsuleBounds(inflatedRadius, shapeCapsule.halfHeight), callback); + + callback.mGeneration.processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE, false); + } + else + { + const PxMatTransformV aToB(curTransform); + // We must be in local space to use the cache + const FloatV projectBreakingThreshold = FMul(capsuleRadius, FLoad(0.05f)); + const FloatV refereshDistance = FAdd(capsuleRadius, contactDist); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, refereshDistance); + } + + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, capsuleTransform, heightfieldTransform, capsuleRadius); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp new file mode 100644 index 0000000..db73172 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCapsuleMesh.cpp @@ -0,0 +1,843 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuVecTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactConvexCommon.h" +#include "GuInternal.h" +#include "GuPCMContactMeshCallback.h" +#include "GuBarycentricCoordinates.h" +#include "GuBox.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +namespace +{ +struct PCMCapsuleVsMeshContactGenerationCallback : PCMMeshContactGenerationCallback< PCMCapsuleVsMeshContactGenerationCallback > +{ + PCMCapsuleVsMeshContactGenerationCallback& operator=(const PCMCapsuleVsMeshContactGenerationCallback&); +public: + PCMCapsuleVsMeshContactGeneration mGeneration; + + PCMCapsuleVsMeshContactGenerationCallback( + const CapsuleV& capsule, + const aos::FloatVArg contactDist, + const aos::FloatVArg replaceBreakingThreshold, + const PxTransformV& sphereTransform, + const PxTransformV& meshTransform, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + const PxU8* extraTriData, + const Cm::FastVertex2ShapeScaling& meshScaling, + bool idtMeshScale, + PxInlineArray* deferredContacts, + PxRenderOutput* renderOutput = NULL + ) : + PCMMeshContactGenerationCallback(meshScaling, extraTriData, idtMeshScale), + mGeneration(capsule, contactDist, replaceBreakingThreshold, sphereTransform, meshTransform, multiManifold, contactBuffer, + deferredContacts, renderOutput) + { + } + + PX_FORCE_INLINE bool doTest(const PxVec3&, const PxVec3&, const PxVec3&) { return true; } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; +} + +bool physx::Gu::pcmContactCapsuleMesh(GU_CONTACT_METHOD_ARGS) +{ + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + //gRenderOutPut = cache.mRenderOutput; + const FloatV capsuleRadius = FLoad(shapeCapsule.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV capsuleTransform = loadTransformA(transform0);//capsule transform + const PxTransformV meshTransform = loadTransformA(transform1);//triangleMesh + + const PxTransformV curTransform = meshTransform.transformInv(capsuleTransform); + + // We must be in local space to use the cache + if(multiManifold.invalidate(curTransform, capsuleRadius, FLoad(0.02f))) + { + const FloatV replaceBreakingThreshold = FMul(capsuleRadius, FLoad(0.001f)); + //const FloatV capsuleHalfHeight = FloatV_From_F32(shapeCapsule.halfHeight); + Cm::FastVertex2ShapeScaling meshScaling; + const bool idtMeshScale = shapeMesh.scale.isIdentity(); + if(!idtMeshScale) + meshScaling.init(shapeMesh.scale); + + // Capsule data + const PxVec3 tmp = getCapsuleHalfHeightVector(transform0, shapeCapsule); + Segment worldCapsule; + worldCapsule.p0 = transform0.p + tmp; + worldCapsule.p1 = transform0.p - tmp; + + const Segment meshCapsule( // Capsule in mesh space + transform1.transformInv(worldCapsule.p0), + transform1.transformInv(worldCapsule.p1)); + + const PxReal inflatedRadius = shapeCapsule.radius + params.mContactDistance; + + const PxVec3 capsuleCenterInMesh = transform1.transformInv(transform0.p); + const PxVec3 capsuleDirInMesh = transform1.rotateInv(tmp); + const CapsuleV capsule(V3LoadU(capsuleCenterInMesh), V3LoadU(capsuleDirInMesh), capsuleRadius); + + // We must be in local space to use the cache + const Capsule queryCapsule(meshCapsule, inflatedRadius); + + const TriangleMesh* meshData = _getMeshData(shapeMesh); + + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + const PxU8* PX_RESTRICT extraData = meshData->getExtraTrigData(); + // mesh scale is not baked into cached verts + PCMCapsuleVsMeshContactGenerationCallback callback( + capsule, + contactDist, + replaceBreakingThreshold, + capsuleTransform, + meshTransform, + multiManifold, + contactBuffer, + extraData, + meshScaling, + idtMeshScale, + NULL, + renderOutput); + + //bound the capsule in shape space by an OBB: + Box queryBox; + queryBox.create(queryCapsule); + + //apply the skew transform to the box: + if(!idtMeshScale) + meshScaling.transformQueryBounds(queryBox.center, queryBox.extents, queryBox.rot); + + Midphase::intersectOBB(meshData, queryBox, callback, true); + + callback.flushCache(); + + callback.mGeneration.processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE, false); + } + else + { + const PxMatTransformV aToB(curTransform); + const FloatV projectBreakingThreshold = FMul(capsuleRadius, FLoad(0.05f)); + const FloatV refereshDistance = FAdd(capsuleRadius, contactDist); + //multiManifold.refreshManifold(aToB, projectBreakingThreshold, contactDist); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, refereshDistance); + } + + //multiManifold.drawManifold(*gRenderOutPut, capsuleTransform, meshTransform); + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, capsuleTransform, meshTransform, capsuleRadius); +} + +void Gu::PCMCapsuleVsMeshContactGeneration::generateEE(const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg sqInflatedRadius, + const aos::Vec3VArg normal, const PxU32 triangleIndex, const aos::Vec3VArg a, const aos::Vec3VArg b, + Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + const FloatV zero = FZero(); + const Vec3V ab = V3Sub(b, a); + const Vec3V n = V3Cross(ab, normal); + const FloatV d = V3Dot(n, a); + const FloatV np = V3Dot(n, p); + const FloatV nq = V3Dot(n,q); + const FloatV signP = FSub(np, d); + const FloatV signQ = FSub(nq, d); + const FloatV temp = FMul(signP, signQ); + if(FAllGrtr(temp, zero)) return;//If both points in the same side as the plane, no intersect points + + // if colliding edge (p3,p4) and plane are parallel return no collision + const Vec3V pq = V3Sub(q, p); + const FloatV npq= V3Dot(n, pq); + if(FAllEq(npq, zero)) return; + + const FloatV one = FOne(); + //calculate the intersect point in the segment pq + const FloatV segTValue = FDiv(FSub(d, np), npq); + const Vec3V localPointA = V3ScaleAdd(pq, segTValue, p); + + //calculate a normal perpendicular to ray localPointA + normal, 2D segment segment intersection + const Vec3V perNormal = V3Cross(normal, pq); + const Vec3V ap = V3Sub(localPointA, a); + const FloatV nom = V3Dot(perNormal, ap); + const FloatV denom = V3Dot(perNormal, ab); + + //const FloatV tValue = FClamp(FDiv(nom, denom), zero, FOne()); + const FloatV tValue = FDiv(nom, denom); + const BoolV con = BAnd(FIsGrtrOrEq(one, tValue), FIsGrtrOrEq(tValue, zero)); + if(BAllEqFFFF(con)) + return; + + //const Vec3V localPointB = V3ScaleAdd(ab, tValue, a); v = V3Sub(localPointA, localPointB); v = V3NegScaleSub(ab, tValue, tap) + const Vec3V v = V3NegScaleSub(ab, tValue, ap); + const FloatV sqDist = V3Dot(v, v); + + if(FAllGrtr(sqInflatedRadius, sqDist)) + { + const Vec3V localPointB = V3Sub(localPointA, v); + const FloatV signedDist = V3Dot(v, normal); + + manifoldContacts[numContacts].mLocalPointA = localPointA; + manifoldContacts[numContacts].mLocalPointB = localPointB; + manifoldContacts[numContacts].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), signedDist); + manifoldContacts[numContacts++].mFaceIndex = triangleIndex; + } +} + + + +void Gu::PCMCapsuleVsMeshContactGeneration::generateEEContacts(const aos::Vec3VArg a, const aos::Vec3VArg b, + const aos::Vec3VArg c, const aos::Vec3VArg normal, + const PxU32 triangleIndex, const aos::Vec3VArg p, + const aos::Vec3VArg q, const aos::FloatVArg sqInflatedRadius, + const PxU32 previousNumContacts, Gu::MeshPersistentContact* manifoldContacts, + PxU32& numContacts) +{ + if((numContacts - previousNumContacts) < 2) + generateEE(p, q, sqInflatedRadius, normal, triangleIndex, a, b, manifoldContacts, numContacts); + if((numContacts - previousNumContacts) < 2) + generateEE(p, q, sqInflatedRadius, normal, triangleIndex, b, c, manifoldContacts, numContacts); + if((numContacts - previousNumContacts) < 2) + generateEE(p, q, sqInflatedRadius, normal, triangleIndex, a, c, manifoldContacts, numContacts); +} + +void Gu::PCMCapsuleVsMeshContactGeneration::generateEEMTD(const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg inflatedRadius, + const aos::Vec3VArg normal, const PxU32 triangleIndex, const aos::Vec3VArg a, const aos::Vec3VArg b, + Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + const FloatV zero = FZero(); + const Vec3V ab = V3Sub(b, a); + const Vec3V n = V3Cross(ab, normal); + const FloatV d = V3Dot(n, a); + const FloatV np = V3Dot(n, p); + const FloatV nq = V3Dot(n,q); + const FloatV signP = FSub(np, d); + const FloatV signQ = FSub(nq, d); + const FloatV temp = FMul(signP, signQ); + if(FAllGrtr(temp, zero)) return;//If both points in the same side as the plane, no intersect points + + // if colliding edge (p3,p4) and plane are parallel return no collision + const Vec3V pq = V3Sub(q, p); + const FloatV npq= V3Dot(n, pq); + if(FAllEq(npq, zero)) return; + + //calculate the intersect point in the segment pq + const FloatV segTValue = FDiv(FSub(d, np), npq); + const Vec3V localPointA = V3ScaleAdd(pq, segTValue, p); + + //calculate a normal perpendicular to ray localPointA + normal, 2D segment segment intersection + const Vec3V perNormal = V3Cross(normal, pq); + const Vec3V ap = V3Sub(localPointA, a); + const FloatV nom = V3Dot(perNormal, ap); + const FloatV denom = V3Dot(perNormal, ab); + + const FloatV tValue = FClamp(FDiv(nom, denom), zero, FOne()); + + const Vec3V v = V3NegScaleSub(ab, tValue, ap); + const FloatV signedDist = V3Dot(v, normal); + + if(FAllGrtr(inflatedRadius, signedDist)) + { + const Vec3V localPointB = V3Sub(localPointA, v); + manifoldContacts[numContacts].mLocalPointA = localPointA; + manifoldContacts[numContacts].mLocalPointB = localPointB; + manifoldContacts[numContacts].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), signedDist); + manifoldContacts[numContacts++].mFaceIndex = triangleIndex; + } +} + + +void Gu::PCMCapsuleVsMeshContactGeneration::generateEEContactsMTD(const aos::Vec3VArg a, const aos::Vec3VArg b, + const aos::Vec3VArg c, const aos::Vec3VArg normal, + const PxU32 triangleIndex, const aos::Vec3VArg p, + const aos::Vec3VArg q, const aos::FloatVArg inflatedRadius, + Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + generateEEMTD(p, q, inflatedRadius, normal, triangleIndex, a, b, manifoldContacts, numContacts); + generateEEMTD(p, q, inflatedRadius, normal, triangleIndex, b, c, manifoldContacts, numContacts); + generateEEMTD(p, q, inflatedRadius, normal, triangleIndex, a, c, manifoldContacts, numContacts); +} + +void Gu::PCMCapsuleVsMeshContactGeneration::generateContacts(const aos::Vec3VArg a, const aos::Vec3VArg b, + const aos::Vec3VArg c, const aos::Vec3VArg planeNormal, + const aos::Vec3VArg normal, const PxU32 triangleIndex, + const aos::Vec3VArg p, const aos::Vec3VArg q, + const aos::FloatVArg inflatedRadius, + Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V ap = V3Sub(p, a); + const Vec3V aq = V3Sub(q, a); + + //This is used to calculate the barycentric coordinate + const FloatV d00 = V3Dot(ab, ab); + const FloatV d01 = V3Dot(ab, ac); + const FloatV d11 = V3Dot(ac, ac); + const FloatV bdenom = FRecip(FSub(FMul(d00,d11), FMul(d01, d01))); + + //compute the intersect point of p and triangle plane abc + const FloatV inomp = V3Dot(planeNormal, V3Neg(ap)); + const FloatV ideom = V3Dot(planeNormal, normal); + + const FloatV ipt = FSel(FIsGrtr(ideom, FZero()), FNeg(FDiv(inomp, ideom)), FLoad(1e+20f)); + + const Vec3V closestP31 = V3NegScaleSub(normal, ipt, p); + const Vec3V closestP30 = p; + + //Compute the barycentric coordinate for project point of q + const Vec3V pV20 = V3Sub(closestP31, a); + const FloatV pD20 = V3Dot(pV20, ab); + const FloatV pD21 = V3Dot(pV20, ac); + const FloatV v0 = FMul(FSub(FMul(d11, pD20), FMul(d01, pD21)), bdenom); + const FloatV w0 = FMul(FSub(FMul(d00, pD21), FMul(d01, pD20)), bdenom); + + //check closestP3 is inside the triangle + const BoolV con0 = isValidTriangleBarycentricCoord(v0, w0); + + const BoolV tempCon0 = BAnd(con0, FIsGrtr(inflatedRadius, ipt)); + if(BAllEqTTTT(tempCon0)) + { + manifoldContacts[numContacts].mLocalPointA = closestP30;//transform to B space, it will get convert to A space later + manifoldContacts[numContacts].mLocalPointB = closestP31; + manifoldContacts[numContacts].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), ipt); + manifoldContacts[numContacts++].mFaceIndex = triangleIndex; + } + + const FloatV inomq = V3Dot(planeNormal, V3Neg(aq)); + + const FloatV iqt = FSel(FIsGrtr(ideom, FZero()), FNeg(FDiv(inomq, ideom)), FLoad(1e+20f)); + + const Vec3V closestP41 = V3NegScaleSub(normal, iqt, q); + const Vec3V closestP40 = q; + + //Compute the barycentric coordinate for project point of q + const Vec3V qV20 = V3Sub(closestP41, a); + const FloatV qD20 = V3Dot(qV20, ab); + const FloatV qD21 = V3Dot(qV20, ac); + const FloatV v1 = FMul(FSub(FMul(d11, qD20), FMul(d01, qD21)), bdenom); + const FloatV w1 = FMul(FSub(FMul(d00, qD21), FMul(d01, qD20)), bdenom); + + const BoolV con1 = isValidTriangleBarycentricCoord(v1, w1); + + const BoolV tempCon1 = BAnd(con1, FIsGrtr(inflatedRadius, iqt)); + if(BAllEqTTTT(tempCon1)) + { + manifoldContacts[numContacts].mLocalPointA = closestP40; + manifoldContacts[numContacts].mLocalPointB = closestP41; + manifoldContacts[numContacts].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), iqt); + manifoldContacts[numContacts++].mFaceIndex = triangleIndex; + } +} + +static PX_FORCE_INLINE aos::Vec4V pcmDistanceSegmentSegmentSquared4(const aos::Vec3VArg p, const aos::Vec3VArg d0, + const aos::Vec3VArg p02, const aos::Vec3VArg d02, + const aos::Vec3VArg p12, const aos::Vec3VArg d12, + const aos::Vec3VArg p22, const aos::Vec3VArg d22, + const aos::Vec3VArg p32, const aos::Vec3VArg d32, + aos::Vec4V& s, aos::Vec4V& t) +{ + const Vec4V zero = V4Zero(); + const Vec4V one = V4One(); + const Vec4V eps = V4Eps(); + const Vec4V half = V4Splat(FHalf()); + + const Vec4V d0X = V4Splat(V3GetX(d0)); + const Vec4V d0Y = V4Splat(V3GetY(d0)); + const Vec4V d0Z = V4Splat(V3GetZ(d0)); + const Vec4V pX = V4Splat(V3GetX(p)); + const Vec4V pY = V4Splat(V3GetY(p)); + const Vec4V pZ = V4Splat(V3GetZ(p)); + + Vec4V d024 = Vec4V_From_Vec3V(d02); + Vec4V d124 = Vec4V_From_Vec3V(d12); + Vec4V d224 = Vec4V_From_Vec3V(d22); + Vec4V d324 = Vec4V_From_Vec3V(d32); + + Vec4V p024 = Vec4V_From_Vec3V(p02); + Vec4V p124 = Vec4V_From_Vec3V(p12); + Vec4V p224 = Vec4V_From_Vec3V(p22); + Vec4V p324 = Vec4V_From_Vec3V(p32); + + Vec4V d0123X, d0123Y, d0123Z; + Vec4V p0123X, p0123Y, p0123Z; + + PX_TRANSPOSE_44_34(d024, d124, d224, d324, d0123X, d0123Y, d0123Z); + PX_TRANSPOSE_44_34(p024, p124, p224, p324, p0123X, p0123Y, p0123Z); + + const Vec4V rX = V4Sub(pX, p0123X); + const Vec4V rY = V4Sub(pY, p0123Y); + const Vec4V rZ = V4Sub(pZ, p0123Z); + + //TODO - store this in a transposed state and avoid so many dot products? + + const FloatV dd = V3Dot(d0, d0); + + const Vec4V e = V4MulAdd(d0123Z, d0123Z, V4MulAdd(d0123X, d0123X, V4Mul(d0123Y, d0123Y))); + const Vec4V b = V4MulAdd(d0Z, d0123Z, V4MulAdd(d0X, d0123X, V4Mul(d0Y, d0123Y))); + const Vec4V c = V4MulAdd(d0Z, rZ, V4MulAdd(d0X, rX, V4Mul(d0Y, rY))); + const Vec4V f = V4MulAdd(d0123Z, rZ, V4MulAdd(d0123X, rX, V4Mul(d0123Y, rY))); + + const Vec4V a(V4Splat(dd)); + + const Vec4V aRecip(V4Recip(a)); + const Vec4V eRecip(V4Recip(e)); + + //if segments not parallell, compute closest point on two segments and clamp to segment1 + const Vec4V denom = V4Sub(V4Mul(a, e), V4Mul(b, b)); + const Vec4V temp = V4Sub(V4Mul(b, f), V4Mul(c, e)); + //const Vec4V s0 = V4Clamp(V4Div(temp, denom), zero, one); + //In PS3, 0(temp)/0(denom) will produce QNaN and V4Clamp can't clamp the value to zero and one. In PC, 0/0 will produce inf and V4Clamp clamp the value to be one. + //Therefore, we need to add the select code to protect against this case + const Vec4V value = V4Sel(V4IsEq(denom, zero), one, V4Div(temp, denom)); + const Vec4V s0 = V4Clamp(value, zero, one); + + //test whether segments are parallel + const BoolV con2 = V4IsGrtrOrEq(eps, denom); + const Vec4V sTmp = V4Sel(con2, half, s0); + + //compute point on segment2 closest to segment1 + //const Vec4V tTmp = V4Mul(V4Add(V4Mul(b, sTmp), f), eRecip); + const Vec4V tTmp = V4Sel(V4IsEq(e, zero), one, V4Mul(V4Add(V4Mul(b, sTmp), f), eRecip)); + + //if t is in [zero, one], done. otherwise clamp t + const Vec4V t2 = V4Clamp(tTmp, zero, one); + + //recompute s for the new value + //const Vec4V comp = V4Mul(V4Sub(V4Mul(b,t2), c), aRecip); + const Vec4V comp = V4Sel(V4IsEq(a, zero), one, V4Mul(V4Sub(V4Mul(b,t2), c), aRecip)); + const Vec4V s2 = V4Clamp(comp, zero, one); + + s = s2; + t = t2; + + const Vec4V closest1X = V4MulAdd(d0X, s2, pX); + const Vec4V closest1Y = V4MulAdd(d0Y, s2, pY); + const Vec4V closest1Z = V4MulAdd(d0Z, s2, pZ); + + const Vec4V closest2X = V4MulAdd(d0123X, t2, p0123X); + const Vec4V closest2Y = V4MulAdd(d0123Y, t2, p0123Y); + const Vec4V closest2Z = V4MulAdd(d0123Z, t2, p0123Z); + + const Vec4V vvX = V4Sub(closest1X, closest2X); + const Vec4V vvY = V4Sub(closest1Y, closest2Y); + const Vec4V vvZ = V4Sub(closest1Z, closest2Z); + + const Vec4V vd = V4MulAdd(vvX, vvX, V4MulAdd(vvY, vvY, V4Mul(vvZ, vvZ))); + + return vd; +} + +/* + t is the barycenteric coordinate of a segment + u is the barycenteric coordinate of a triangle + v is the barycenteric coordinate of a triangle +*/ +static aos::FloatV pcmDistanceSegmentTriangleSquared( const aos::Vec3VArg p, const aos::Vec3VArg q, + const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c, + aos::FloatV& t, aos::FloatV& u, aos::FloatV& v) +{ + const FloatV one = FOne(); + const FloatV zero = FZero(); + + const Vec3V pq = V3Sub(q, p); + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V bc = V3Sub(c, b); + const Vec3V ap = V3Sub(p, a); + const Vec3V aq = V3Sub(q, a); + + const Vec3V n =V3Normalize(V3Cross(ab, ac)); // normalize vector + + const Vec4V combinedDot = V3Dot4(ab, ab, ab, ac, ac, ac, ap, n); + const FloatV d00 = V4GetX(combinedDot); + const FloatV d01 = V4GetY(combinedDot); + const FloatV d11 = V4GetZ(combinedDot); + const FloatV dist3 = V4GetW(combinedDot); + + const FloatV bdenom = FRecip(FSub(FMul(d00,d11), FMul(d01, d01))); + + const FloatV sqDist3 = FMul(dist3, dist3); + + //compute the closest point of q and triangle plane abc + const FloatV dist4 = V3Dot(aq, n); + const FloatV sqDist4 = FMul(dist4, dist4); + const FloatV dMul = FMul(dist3, dist4); + const BoolV con = FIsGrtr(zero, dMul); + + if(BAllEqTTTT(con)) + { + //compute the intersect point + const FloatV nom = FNeg(V3Dot(n, ap)); + const FloatV denom = FRecip(V3Dot(n, pq)); + const FloatV t0 = FMul(nom, denom); + const Vec3V ip = V3ScaleAdd(pq, t0, p);//V3Add(p, V3Scale(pq, t)); + const Vec3V v2 = V3Sub(ip, a); + const FloatV d20 = V3Dot(v2, ab); + const FloatV d21 = V3Dot(v2, ac); + + const FloatV v0 = FMul(FNegScaleSub(d01, d21, FMul(d11, d20)), bdenom); + const FloatV w0 = FMul(FNegScaleSub(d01, d20, FMul(d00, d21)), bdenom); + + const BoolV con0 = isValidTriangleBarycentricCoord(v0, w0); + if(BAllEqTTTT(con0)) + { + t = t0; + u = v0; + v = w0; + return zero; + } + } + + const Vec3V closestP31 = V3NegScaleSub(n, dist3, p);//V3Sub(p, V3Scale(n, dist3)); + const Vec3V closestP41 = V3NegScaleSub(n, dist4, q);// V3Sub(q, V3Scale(n, dist4)); + + //Compute the barycentric coordinate for project point of q + const Vec3V pV20 = V3Sub(closestP31, a); + const Vec3V qV20 = V3Sub(closestP41, a); + + const Vec4V pD2 = V3Dot4(pV20, ab, pV20, ac, qV20, ab, qV20, ac); + + const Vec4V pD2Swizzle = V4PermYXWZ(pD2); + + const Vec4V d11d00 = V4UnpackXY(V4Splat(d11), V4Splat(d00)); + + const Vec4V v0w0v1w1 = V4Scale(V4NegMulSub(V4Splat(d01), pD2Swizzle, V4Mul(d11d00, pD2)), bdenom); + + const FloatV v0 = V4GetX(v0w0v1w1); + const FloatV w0 = V4GetY(v0w0v1w1); + const FloatV v1 = V4GetZ(v0w0v1w1); + const FloatV w1 = V4GetW(v0w0v1w1); + + const BoolV _con = isValidTriangleBarycentricCoord2(v0w0v1w1); + + const BoolV con0 = BGetX(_con); + const BoolV con1 = BGetY(_con); + + const BoolV cond2 = BAnd(con0, con1); + + if(BAllEqTTTT(cond2)) + { + /* + both p and q project points are interior point + */ + const BoolV d2 = FIsGrtr(sqDist4, sqDist3); + t = FSel(d2, zero, one); + u = FSel(d2, v0, v1); + v = FSel(d2, w0, w1); + return FSel(d2, sqDist3, sqDist4); + } + else + { + Vec4V t40, t41; + const Vec4V sqDist44 = pcmDistanceSegmentSegmentSquared4(p,pq,a,ab, b,bc, a,ac, a,ab, t40, t41); + + const FloatV t00 = V4GetX(t40); + const FloatV t10 = V4GetY(t40); + const FloatV t20 = V4GetZ(t40); + + const FloatV t01 = V4GetX(t41); + const FloatV t11 = V4GetY(t41); + const FloatV t21 = V4GetZ(t41); + + //edge ab + const FloatV u01 = t01; + const FloatV v01 = zero; + + //edge bc + const FloatV u11 = FSub(one, t11); + const FloatV v11 = t11; + + //edge ac + const FloatV u21 = zero; + const FloatV v21 = t21; + + const FloatV sqDist0(V4GetX(sqDist44)); + const FloatV sqDist1(V4GetY(sqDist44)); + const FloatV sqDist2(V4GetZ(sqDist44)); + + const BoolV con2 = BAnd(FIsGrtr(sqDist1, sqDist0), FIsGrtr(sqDist2, sqDist0)); + const BoolV con3 = FIsGrtr(sqDist2, sqDist1); + const FloatV sqDistPE = FSel(con2, sqDist0, FSel(con3, sqDist1, sqDist2)); + const FloatV uEdge = FSel(con2, u01, FSel(con3, u11, u21)); + const FloatV vEdge = FSel(con2, v01, FSel(con3, v11, v21)); + const FloatV tSeg = FSel(con2, t00, FSel(con3, t10, t20)); + + if(BAllEqTTTT(con0)) + { + //p's project point is an interior point + const BoolV d2 = FIsGrtr(sqDistPE, sqDist3); + t = FSel(d2, zero, tSeg); + u = FSel(d2, v0, uEdge); + v = FSel(d2, w0, vEdge); + return FSel(d2, sqDist3, sqDistPE); + } + else if(BAllEqTTTT(con1)) + { + //q's project point is an interior point + const BoolV d2 = FIsGrtr(sqDistPE, sqDist4); + t = FSel(d2, one, tSeg); + u = FSel(d2, v1, uEdge); + v = FSel(d2, w1, vEdge); + return FSel(d2, sqDist4, sqDistPE); + } + else + { + t = tSeg; + u = uEdge; + v = vEdge; + return sqDistPE; + } + } +} + +static bool selectNormal(const aos::FloatVArg u, aos::FloatVArg v, PxU8 data) +{ + const FloatV zero = FLoad(1e-6f); + const FloatV one = FLoad(0.999999f); + // Analysis + if(FAllGrtr(zero, u)) + { + if(FAllGrtr(zero, v)) + { + // Vertex 0 + if(!(data & (Gu::ETD_CONVEX_EDGE_01|Gu::ETD_CONVEX_EDGE_20))) + return true; + } + else if(FAllGrtr(v, one)) + { + // Vertex 2 + if(!(data & (Gu::ETD_CONVEX_EDGE_12|Gu::ETD_CONVEX_EDGE_20))) + return true; + } + else + { + // Edge 0-2 + if(!(data & Gu::ETD_CONVEX_EDGE_20)) + return true; + } + } + else if(FAllGrtr(u,one)) + { + if(FAllGrtr(zero, v)) + { + // Vertex 1 + if(!(data & (Gu::ETD_CONVEX_EDGE_01|Gu::ETD_CONVEX_EDGE_12))) + return true; + } + } + else + { + if(FAllGrtr(zero, v)) + { + // Edge 0-1 + if(!(data & Gu::ETD_CONVEX_EDGE_01)) + return true; + } + else + { + const FloatV threshold = FLoad(0.9999f); + const FloatV temp = FAdd(u, v); + if(FAllGrtrOrEq(temp, threshold)) + { + // Edge 1-2 + if(!(data & Gu::ETD_CONVEX_EDGE_12)) + return true; + } + else + { + // Face + return true; + } + } + } + return false; +} + +bool Gu::PCMCapsuleVsMeshContactGeneration::processTriangle(const PxVec3* verts, const PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds) +{ + PX_UNUSED(triangleIndex); + PX_UNUSED(vertInds); + + const FloatV zero = FZero(); + + const Vec3V p0 = V3LoadU(verts[0]); + const Vec3V p1 = V3LoadU(verts[1]); + const Vec3V p2 = V3LoadU(verts[2]); + + const Vec3V p10 = V3Sub(p1, p0); + const Vec3V p20 = V3Sub(p2, p0); + + const Vec3V n = V3Normalize(V3Cross(p10, p20));//(p1 - p0).cross(p2 - p0).getNormalized(); + const FloatV d = V3Dot(p0, n);//d = -p0.dot(n); + + const FloatV dist = FSub(V3Dot(mCapsule.getCenter(), n), d);//p.dot(n) + d; + + // Backface culling + if(FAllGrtr(zero, dist)) + return false; + + FloatV t, u, v; + const FloatV sqDist = pcmDistanceSegmentTriangleSquared(mCapsule.p0, mCapsule.p1, p0, p1, p2, t, u, v); + + if(FAllGrtr(mSqInflatedRadius, sqDist)) + { + Vec3V patchNormalInTriangle; + if(selectNormal(u, v, triFlags)) + { + patchNormalInTriangle = n; + } + else + { + if(FAllEq(sqDist, zero)) + { + //segment intersect with the triangle + patchNormalInTriangle = n; + } + else + { + const Vec3V pq = V3Sub(mCapsule.p1, mCapsule.p0); + const Vec3V pointOnSegment = V3ScaleAdd(pq, t, mCapsule.p0); + const FloatV w = FSub(FOne(), FAdd(u, v)); + const Vec3V pointOnTriangle = V3ScaleAdd(p0, w, V3ScaleAdd(p1, u, V3Scale(p2, v))); + patchNormalInTriangle = V3Normalize(V3Sub(pointOnSegment, pointOnTriangle)); + } + } + + const PxU32 previousNumContacts = mNumContacts; + + generateContacts(p0, p1, p2, n, patchNormalInTriangle, triangleIndex, mCapsule.p0, mCapsule.p1, mInflatedRadius, mManifoldContacts, mNumContacts); + + //ML: this need to use the sqInflatedRadius to avoid some bad contacts + generateEEContacts(p0, p1, p2, patchNormalInTriangle, triangleIndex, mCapsule.p0, mCapsule.p1, mSqInflatedRadius, previousNumContacts, mManifoldContacts, mNumContacts); + + PxU32 numContacts = mNumContacts - previousNumContacts; + + PX_ASSERT(numContacts <= 2); + + if(numContacts > 0) + { + FloatV maxPen = FMax(); + for(PxU32 i = previousNumContacts; i= 16) + { + PX_ASSERT(mNumContacts <= 64); + processContacts(GU_CAPSULE_MANIFOLD_CACHE_SIZE); + } + } + } + + return true; +} + +bool Gu::PCMCapsuleVsMeshContactGeneration::processTriangle(const TriangleV& triangleV, const PxU32 triangleIndex, const CapsuleV& capsule, const aos::FloatVArg inflatedRadius, const PxU8 trigFlag, + Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + const FloatV zero = FZero(); + + const Vec3V p0 = triangleV.verts[0]; + const Vec3V p1 = triangleV.verts[1]; + const Vec3V p2 = triangleV.verts[2]; + + const Vec3V n = triangleV.normal(); + + const FloatV sqInflatedRadius = FMul(inflatedRadius, inflatedRadius); + + FloatV t, u, v; + const FloatV sqDist = pcmDistanceSegmentTriangleSquared(capsule.p0, capsule.p1, p0, p1, p2, t, u, v); + + if(FAllGrtr(sqInflatedRadius, sqDist)) + { + Vec3V patchNormalInTriangle; + if(selectNormal(u, v, trigFlag)) + { + patchNormalInTriangle = n; + } + else + { + if(FAllEq(sqDist, zero)) + { + //segment intersect with the triangle + patchNormalInTriangle = n; + } + else + { + const Vec3V pq = V3Sub(capsule.p1, capsule.p0); + const Vec3V pointOnSegment = V3ScaleAdd(pq, t, capsule.p0); + const FloatV w = FSub(FOne(), FAdd(u, v)); + const Vec3V pointOnTriangle = V3ScaleAdd(p0, w, V3ScaleAdd(p1, u, V3Scale(p2, v))); + patchNormalInTriangle = V3Normalize(V3Sub(pointOnSegment, pointOnTriangle)); + } + } + + generateContacts(p0, p1, p2, n, patchNormalInTriangle, triangleIndex, capsule.p0, capsule.p1, inflatedRadius, manifoldContacts, numContacts); + + generateEEContactsMTD(p0, p1, p2, patchNormalInTriangle, triangleIndex, capsule.p0, capsule.p1, inflatedRadius, manifoldContacts, numContacts); + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp new file mode 100644 index 0000000..8aec8c9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.cpp @@ -0,0 +1,278 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuVecTriangle.h" +#include "GuPCMContactConvexCommon.h" +#include "GuConvexEdgeFlags.h" +#include "GuBarycentricCoordinates.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +/* + This function adds the newly created manifold contacts to a new patch or existing patches +*/ +void PCMConvexVsMeshContactGeneration::addContactsToPatch(const aos::Vec3VArg patchNormal, const PxU32 previousNumContacts) +{ + const Vec3V patchNormalInTriangle = mMeshToConvex.rotateInv(patchNormal); + + const PxU32 newContacts = mNumContacts - previousNumContacts; + + if(newContacts > GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE) + { + //if the current created manifold contacts are more than GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points, we will reduce the total numContacts + //to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE. However, after we add these points into a patch, the patch contacts will be variable. Then we will + //do contact reduction for that patch in the processContacts. After the contact reduction, there will be no more than GU_SINGLE_MANIFOLD_CACHE_SIZE(6) + //contacts inside a signlePersistentContactManifold + Gu::SinglePersistentContactManifold::reduceContacts(&mManifoldContacts[previousNumContacts], newContacts); + mNumContacts = previousNumContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + + //get rid of duplicate manifold contacts for the newly created contacts + for(PxU32 i = previousNumContacts; i= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + PX_ASSERT(mNumContacts <= PxContactBuffer::MAX_CONTACTS); + processContacts(GU_SINGLE_MANIFOLD_CACHE_SIZE); + } +} + +void PCMConvexVsMeshContactGeneration::generateLastContacts() +{ + // Process delayed contacts + PxU32 nbEntries = mDeferredContacts->size(); + + if(nbEntries) + { + nbEntries /= sizeof(PCMDeferredPolyData)/sizeof(PxU32); + + const PCMDeferredPolyData* PX_RESTRICT cd = reinterpret_cast(mDeferredContacts->begin()); + for(PxU32 i=0;ipreviousNumContacts; --j) + { + PxU32 ind = j-1; + //calculate the barycentric coordinate of the contacts in localTriangle, p = a + v(b-a) + w(c-a)., p=ua+vb+wc + barycentricCoordinates(mManifoldContacts[ind].mLocalPointB, localTriangle.verts[0], localTriangle.verts[1], localTriangle.verts[2], v, w); + //const FloatV u = FSub(one, FAdd(v, w)); + + bool keepContact = true; + if(FAllGrtr(v, upperBound))//v > upperBound + { + //vertex1 + keepContact = !mVertexCache.contains(Gu::CachedVertex(ref1)); + } + else if(FAllGrtr(w, upperBound))// w > upperBound + { + //vertex2 + keepContact = !mVertexCache.contains(Gu::CachedVertex(ref2)); + } + else if(FAllGrtrOrEq(lowerBound, FAdd(v, w))) // u(1-(v+w)) > upperBound + { + //vertex0 + keepContact = !mVertexCache.contains(Gu::CachedVertex(ref0)); + } + + if(!keepContact) + { + //ML: if feature code is any of the vertex in this triangle and we have generated contacts with any other triangles which contains this vertex, we should drop it + currentContacts--; + + for(PxU32 k = ind; k < currentContacts; ++k) + { + mManifoldContacts[k] = mManifoldContacts[k+1]; + } + } + } + + mNumContacts = currentContacts; + + if(currentContacts > previousNumContacts) + { + addContactsToPatch(patchNormal, previousNumContacts); + } + } + } + } +} + +bool PCMConvexVsMeshContactGeneration::processTriangle(const PxVec3* verts, PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds) +{ + const Mat33V identity = M33Identity(); + const FloatV zero = FZero(); + + const Vec3V v0 = V3LoadU(verts[0]); + const Vec3V v1 = V3LoadU(verts[1]); + const Vec3V v2 = V3LoadU(verts[2]); + + const Vec3V v10 = V3Sub(v1, v0); + const Vec3V v20 = V3Sub(v2, v0); + + const Vec3V n = V3Normalize(V3Cross(v10, v20));//(p1 - p0).cross(p2 - p0).getNormalized(); + const FloatV d = V3Dot(v0, n);//d = -p0.dot(n); + + const FloatV dist = FSub(V3Dot(mHullCenterMesh, n), d);//p.dot(n) + d; + + // Backface culling + if(FAllGrtr(zero, dist)) + return false; + + //tranform verts into the box local space + const Vec3V locV0 = mMeshToConvex.transform(v0); + const Vec3V locV1 = mMeshToConvex.transform(v1); + const Vec3V locV2 = mMeshToConvex.transform(v2); + + Gu::TriangleV localTriangle(locV0, locV1, locV2); + + { + SupportLocalImpl localTriMap(localTriangle, mConvexTransform, identity, identity, true); + + const PxU32 previousNumContacts = mNumContacts; + Vec3V patchNormal; + + generateTriangleFullContactManifold(localTriangle, triangleIndex, vertInds, triFlags, mPolyData, &localTriMap, mPolyMap, mManifoldContacts, mNumContacts, mContactDist, patchNormal); + + if(mNumContacts > previousNumContacts) + { +#if PCM_LOW_LEVEL_DEBUG + Gu::PersistentContactManifold::drawTriangle(*mRenderOutput, mMeshTransform.transform(v0), mMeshTransform.transform(v1), mMeshTransform.transform(v2), 0x00ff00); +#endif + const bool inActiveEdge0 = (triFlags & ETD_CONVEX_EDGE_01) == 0; + const bool inActiveEdge1 = (triFlags & ETD_CONVEX_EDGE_12) == 0; + const bool inActiveEdge2 = (triFlags & ETD_CONVEX_EDGE_20) == 0; + + if(inActiveEdge0) + mEdgeCache.addData(CachedEdge(vertInds[0], vertInds[1])); + if(inActiveEdge1) + mEdgeCache.addData(CachedEdge(vertInds[1], vertInds[2])); + if(inActiveEdge2) + mEdgeCache.addData(CachedEdge(vertInds[2], vertInds[0])); + + mVertexCache.addData(CachedVertex(vertInds[0])); + mVertexCache.addData(CachedVertex(vertInds[1])); + mVertexCache.addData(CachedVertex(vertInds[2])); + + addContactsToPatch(patchNormal, previousNumContacts); + } + } + return true; +} + +bool PCMConvexVsMeshContactGeneration::processTriangle(const Gu::PolygonalData& polyData, SupportLocal* polyMap, const PxVec3* verts, const PxU32 triangleIndex, PxU8 triFlags,const aos::FloatVArg inflation, const bool isDoubleSided, + const aos::PxTransformV& convexTransform, const aos::PxMatTransformV& meshToConvex, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts) +{ + const Mat33V identity = M33Identity(); + const FloatV zero = FZero(); + + const Vec3V v0 = V3LoadU(verts[0]); + const Vec3V v1 = V3LoadU(verts[1]); + const Vec3V v2 = V3LoadU(verts[2]); + + //tranform verts into the box local space + const Vec3V locV0 = meshToConvex.transform(v0); + const Vec3V locV1 = meshToConvex.transform(v1); + const Vec3V locV2 = meshToConvex.transform(v2); + + const Vec3V v10 = V3Sub(locV1, locV0); + const Vec3V v20 = V3Sub(locV2, locV0); + + const Vec3V n = V3Normalize(V3Cross(v10, v20));//(p1 - p0).cross(p2 - p0).getNormalized(); + const FloatV d = V3Dot(locV0, n);//d = -p0.dot(n); + + const FloatV dist = FSub(V3Dot(polyMap->shapeSpaceCenterOfMass, n), d);//p.dot(n) + d; + + // Backface culling + const bool culled = !isDoubleSided && (FAllGrtr(zero, dist)); + if(culled) + return false; + + Gu::TriangleV localTriangle(locV0, locV1, locV2); + + SupportLocalImpl localTriMap(localTriangle, convexTransform, identity, identity, true); + + Vec3V patchNormal; + + generateTriangleFullContactManifold(localTriangle, triangleIndex, triFlags, polyData, &localTriMap, polyMap, manifoldContacts, numContacts, inflation, patchNormal); + + return true; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.h new file mode 100644 index 0000000..09aadad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexCommon.h @@ -0,0 +1,438 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_CONTACT_CONVEX_COMMON_H +#define GU_PCM_CONTACT_CONVEX_COMMON_H + +#define PCM_MAX_CONTACTPATCH_SIZE 32 + +#include "geomutils/PxContactBuffer.h" +#include "GuVecCapsule.h" +#include "GuPCMTriangleContactGen.h" +#include "GuTriangleCache.h" +#include "foundation/PxInlineArray.h" + +namespace physx +{ + +namespace Gu +{ + +#define MAX_CACHE_SIZE 128 + +//sizeof(PCMDeferredPolyData)/sizeof(PxU32) = 15, 960/15 = 64 triangles in the local array +#define LOCAL_PCM_CONTACTS_SIZE 960 + +class PCMMeshContactGeneration +{ + PX_NOCOPY(PCMMeshContactGeneration) +public: + PCMContactPatch mContactPatch[PCM_MAX_CONTACTPATCH_SIZE]; + PCMContactPatch* mContactPatchPtr[PCM_MAX_CONTACTPATCH_SIZE]; + const aos::FloatV mContactDist; + const aos::FloatV mReplaceBreakingThreshold; + const aos::PxTransformV& mConvexTransform; + const aos::PxTransformV& mMeshTransform; + Gu::MultiplePersistentContactManifold& mMultiManifold; + PxContactBuffer& mContactBuffer; + + aos::FloatV mAcceptanceEpsilon; + aos::FloatV mSqReplaceBreakingThreshold; + aos::PxMatTransformV mMeshToConvex; + Gu::MeshPersistentContact* mManifoldContacts; + PxU32 mNumContacts; + PxU32 mNumContactPatch; + PxU32 mNumCalls; + Gu::CacheMap mEdgeCache; + Gu::CacheMap mVertexCache; + PxInlineArray* mDeferredContacts; + PxRenderOutput* mRenderOutput; + + PCMMeshContactGeneration( + const aos::FloatVArg contactDist, + const aos::FloatVArg replaceBreakingThreshold, + const aos::PxTransformV& convexTransform, + const aos::PxTransformV& meshTransform, + Gu::MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + PxInlineArray* deferredContacts, + PxRenderOutput* renderOutput + + ) : + mContactDist(contactDist), + mReplaceBreakingThreshold(replaceBreakingThreshold), + mConvexTransform(convexTransform), + mMeshTransform(meshTransform), + mMultiManifold(multiManifold), + mContactBuffer(contactBuffer), + mDeferredContacts(deferredContacts), + mRenderOutput(renderOutput) + + { + using namespace aos; + mNumContactPatch = 0; + mNumContacts = 0; + mNumCalls = 0; + + mMeshToConvex = mConvexTransform.transformInv(mMeshTransform); + + //Assign the PCMContactPatch to the PCMContactPathPtr + for(PxU32 i=0; i + bool processTriangleCache(Gu::TriangleCache& cache) + { + PxU32 count = cache.mNumTriangles; + PxVec3* verts = cache.mVertices; + PxU32* vertInds = cache.mIndices; + PxU32* triInds = cache.mTriangleIndex; + PxU8* edgeFlags = cache.mEdgeFlags; + while(count--) + { + (static_cast(this))->processTriangle(verts, *triInds, *edgeFlags, vertInds); + verts += 3; + vertInds += 3; + triInds++; + edgeFlags++; + } + return true; + } + void prioritizeContactPatches(); + void addManifoldPointToPatch(const aos::Vec3VArg currentPatchNormal, const aos::FloatVArg maxPen, const PxU32 previousNumContacts); + void processContacts(const PxU8 maxContactPerManifold, const bool isNotLastPatch = true); +}; + +/* + This function is based on the current patch normal to either create a new patch or merge the manifold contacts in this patch with the manifold contacts in the last existing + patch. This means there might be more than GU_SINGLE_MANIFOLD_CACHE_SIZE in a SinglePersistentContactManifold. +*/ +PX_FORCE_INLINE void PCMMeshContactGeneration::addManifoldPointToPatch(const aos::Vec3VArg currentPatchNormal, const aos::FloatVArg maxPen, const PxU32 previousNumContacts) +{ + using namespace aos; + + bool foundPatch = false; + //we have existing patch + if(mNumContactPatch > 0) + { + //if the direction between the last existing patch normal and the current patch normal are within acceptance epsilon, which means we will be + //able to merge the last patch's contacts with the current patch's contacts. This is just to avoid to create an extra patch. We have some logic + //later to refine the patch again + if(FAllGrtr(V3Dot(mContactPatch[mNumContactPatch-1].mPatchNormal, currentPatchNormal), mAcceptanceEpsilon)) + { + //get the last patch + PCMContactPatch& patch = mContactPatch[mNumContactPatch-1]; + + //remove duplicate contacts + for(PxU32 i = patch.mStartIndex; imPatchMaxPen, mContactPatchPtr[i]->mPatchMaxPen)) + { + //swap + PCMContactPatch* tmp = mContactPatchPtr[indexi]; + mContactPatchPtr[indexi] = mContactPatchPtr[i]; + mContactPatchPtr[i] = tmp; + + for(PxI32 j=PxI32(i-2); j>=0; j--) + { + const PxU32 indexj = PxU32(j+1); + if(FAllGrtrOrEq(mContactPatchPtr[indexj]->mPatchMaxPen, mContactPatchPtr[j]->mPatchMaxPen)) + break; + //swap + PCMContactPatch* temp = mContactPatchPtr[indexj]; + mContactPatchPtr[indexj] = mContactPatchPtr[j]; + mContactPatchPtr[j] = temp; + } + } + } +} + + +PX_FORCE_INLINE void PCMMeshContactGeneration::processContacts(const PxU8 maxContactPerManifold, bool isNotLastPatch) +{ + using namespace aos; + + if(mNumContacts != 0) + { + //reorder the contact patches based on the max penetration + prioritizeContactPatches(); + //connect the patches which's angle between patch normals are within 5 degree + mMultiManifold.refineContactPatchConnective(mContactPatchPtr, mNumContactPatch, mManifoldContacts, mAcceptanceEpsilon); + //get rid of duplicate manifold contacts in connected contact patches + mMultiManifold.reduceManifoldContactsInDifferentPatches(mContactPatchPtr, mNumContactPatch, mManifoldContacts, mNumContacts, mSqReplaceBreakingThreshold); + //add the manifold contact to the corresponding manifold + mMultiManifold.addManifoldContactPoints(mManifoldContacts, mNumContacts, mContactPatchPtr, mNumContactPatch, mSqReplaceBreakingThreshold, mAcceptanceEpsilon, maxContactPerManifold); + + mNumContacts = 0; + mNumContactPatch = 0; + + if(isNotLastPatch) + { + //remap the contact patch pointer to contact patch + for(PxU32 i=0; i* delayedContacts, + const Cm::FastVertex2ShapeScaling& convexScaling, + bool idtConvexScale, + bool silhouetteEdgesAreActive, + PxRenderOutput* renderOutput + + ) : PCMMeshContactGeneration(contactDistance, replaceBreakingThreshold, convexTransform, meshTransform, multiManifold, contactBuffer, + delayedContacts, renderOutput), + mPolyData(polyData), + mPolyMap(polyMap), + mConvexScaling(convexScaling), + mIdtConvexScale(idtConvexScale), + mSilhouetteEdgesAreActive(silhouetteEdgesAreActive) + { + using namespace aos; + + // Hull center in local space + const Vec3V hullCenterLocal = V3LoadU(mPolyData.mCenter); + // Hull center in mesh space + mHullCenterMesh = mMeshToConvex.transformInv(hullCenterLocal); + } + + bool generateTriangleFullContactManifold(Gu::TriangleV& localTriangle, const PxU32 triangleIndex, const PxU32* triIndices, const PxU8 triFlags, const Gu::PolygonalData& polyData, Gu::SupportLocalImpl* localTriMap, Gu::SupportLocal* polyMap, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& patchNormal); + + bool generatePolyDataContactManifold(Gu::TriangleV& localTriangle, const PxU32 featureIndex, const PxU32 triangleIndex, const PxU8 triFlags, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, const aos::FloatVArg contactDist, aos::Vec3V& patchNormal); + void generateLastContacts(); + void addContactsToPatch(const aos::Vec3VArg patchNormal, const PxU32 previousNumContacts); + + bool processTriangle(const PxVec3* verts, PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds); + + static bool generateTriangleFullContactManifold(Gu::TriangleV& localTriangle, const PxU32 triangleIndex, const PxU8 triFlags, const Gu::PolygonalData& polyData, Gu::SupportLocalImpl* localTriMap, Gu::SupportLocal* polyMap, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& patchNormal, PxRenderOutput* renderOutput = NULL); + + static bool processTriangle(const Gu::PolygonalData& polyData, SupportLocal* polyMap, const PxVec3* verts, const PxU32 triangleIndex, PxU8 triFlags, const aos::FloatVArg inflation, const bool isDoubleSided, + const aos::PxTransformV& convexTransform, const aos::PxMatTransformV& meshToConvex, Gu::MeshPersistentContact* manifoldContact, PxU32& numContacts); +}; + +#if PX_VC + #pragma warning(pop) +#endif + +struct SortedTriangle +{ + aos::FloatV mSquareDist; + PxU32 mIndex; + + PX_FORCE_INLINE bool operator < (const SortedTriangle& data) const + { + return aos::FAllGrtrOrEq(mSquareDist, data.mSquareDist) ==0; + } +}; + +class PCMSphereVsMeshContactGeneration : public PCMMeshContactGeneration +{ +public: + aos::Vec3V mSphereCenter; + aos::FloatV mSphereRadius; + aos::FloatV mSqInflatedSphereRadius; + PxInlineArray mSortedTriangle; + + PCMSphereVsMeshContactGeneration( + const aos::Vec3VArg sphereCenter, + const aos::FloatVArg sphereRadius, + const aos::FloatVArg contactDist, + const aos::FloatVArg replaceBreakingThreshold, + const aos::PxTransformV& sphereTransform, + const aos::PxTransformV& meshTransform, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + PxInlineArray* deferredContacts, + PxRenderOutput* renderOutput = NULL + + ) : PCMMeshContactGeneration(contactDist, replaceBreakingThreshold, sphereTransform, meshTransform, multiManifold, + contactBuffer, deferredContacts, renderOutput), + mSphereCenter(sphereCenter), + mSphereRadius(sphereRadius) + { + using namespace aos; + const FloatV inflatedSphereRadius = FAdd(sphereRadius, contactDist); + mSqInflatedSphereRadius = FMul(inflatedSphereRadius, inflatedSphereRadius); + } + + bool processTriangle(const PxVec3* verts, PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds); + void generateLastContacts(); + void addToPatch(const aos::Vec3VArg contactP, const aos::Vec3VArg patchNormal, + const aos::FloatV pen, const PxU32 triangleIndex); +}; + +class PCMCapsuleVsMeshContactGeneration : public PCMMeshContactGeneration +{ + PCMCapsuleVsMeshContactGeneration &operator=(PCMCapsuleVsMeshContactGeneration &); +public: + aos::FloatV mInflatedRadius; + aos::FloatV mSqInflatedRadius; + const CapsuleV& mCapsule; + + + PCMCapsuleVsMeshContactGeneration( + const CapsuleV& capsule, + const aos::FloatVArg contactDist, + const aos::FloatVArg replaceBreakingThreshold, + const aos::PxTransformV& sphereTransform, + const aos::PxTransformV& meshTransform, + Gu::MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + PxInlineArray* deferredContacts, + PxRenderOutput* renderOutput = NULL + + ) : PCMMeshContactGeneration(contactDist, replaceBreakingThreshold, sphereTransform, meshTransform, multiManifold, contactBuffer, + deferredContacts, renderOutput), + mCapsule(capsule) + { + using namespace aos; + mInflatedRadius = FAdd(capsule.radius, contactDist); + mSqInflatedRadius = FMul(mInflatedRadius, mInflatedRadius); + } + + void generateEEContacts(const aos::Vec3VArg a, const aos::Vec3VArg b,const aos::Vec3VArg c, const aos::Vec3VArg normal, const PxU32 triangleIndex, + const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg sqInflatedRadius, const PxU32 previousNumContacts, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); + + void generateEE(const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg sqInflatedRadius, const aos::Vec3VArg normal, const PxU32 triangleIndex, + const aos::Vec3VArg a, const aos::Vec3VArg b, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); + + static void generateContacts(const aos::Vec3VArg a, const aos::Vec3VArg b,const aos::Vec3VArg c, const aos::Vec3VArg planeNormal, const aos::Vec3VArg normal, + const PxU32 triangleIndex, const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg inflatedRadius, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); + + static void generateEEContactsMTD(const aos::Vec3VArg a, const aos::Vec3VArg b,const aos::Vec3VArg c, const aos::Vec3VArg normal, const PxU32 triangleIndex, + const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg inflatedRadius, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); + + static void generateEEMTD(const aos::Vec3VArg p, const aos::Vec3VArg q, const aos::FloatVArg inflatedRadius, const aos::Vec3VArg normal, const PxU32 trianlgeIndex, + const aos::Vec3VArg a, const aos::Vec3VArg b, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); + + bool processTriangle(const PxVec3* verts, const PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds); + + static bool processTriangle(const TriangleV& triangle, const PxU32 triangleIndex, const CapsuleV& capsule, const aos::FloatVArg inflatedRadius, const PxU8 triFlag, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts); +}; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp new file mode 100644 index 0000000..46f90bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp @@ -0,0 +1,277 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuContactMethodImpl.h" +#include "GuPCMShapeConvex.h" +#include "GuPCMContactGen.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +static bool fullContactsGenerationConvexConvex(const GjkConvex* relativeConvex, const GjkConvex* localConvex, const PxTransformV& transf0, const PxTransformV& transf1, + const bool idtScale0, const bool idtScale1, PersistentContact* manifoldContacts, PxContactBuffer& contactBuffer, + PersistentContactManifold& manifold, Vec3VArg normal, const Vec3VArg closestA, const Vec3VArg closestB, + const FloatVArg contactDist, const bool doOverlapTest, PxRenderOutput* renderOutput, const PxReal toleranceLength) +{ + Gu::PolygonalData polyData0, polyData1; + const ConvexHullV& convexHull0 = relativeConvex->getConvex(); + const ConvexHullV& convexHull1 = localConvex->getConvex(); + getPCMConvexData(convexHull0, idtScale0, polyData0); + getPCMConvexData(convexHull1, idtScale1, polyData1); + + PxU8 buff0[sizeof(SupportLocalImpl)]; + PxU8 buff1[sizeof(SupportLocalImpl)]; + + SupportLocal* map0 = (idtScale0 ? static_cast(PX_PLACEMENT_NEW(buff0, SupportLocalImpl)(static_cast(convexHull0), transf0, convexHull0.vertex2Shape, convexHull0.shape2Vertex, idtScale0)) : + static_cast(PX_PLACEMENT_NEW(buff0, SupportLocalImpl)(convexHull0, transf0, convexHull0.vertex2Shape, convexHull0.shape2Vertex, idtScale0))); + + SupportLocal* map1 = (idtScale1 ? static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(static_cast(convexHull1), transf1, convexHull1.vertex2Shape, convexHull1.shape2Vertex, idtScale1)) : + static_cast(PX_PLACEMENT_NEW(buff1, SupportLocalImpl)(convexHull1, transf1, convexHull1.vertex2Shape, convexHull1.shape2Vertex, idtScale1))); + + PxU32 numContacts = 0; + + if(generateFullContactManifold(polyData0, polyData1, map0, map1, manifoldContacts, numContacts, contactDist, normal, closestA, closestB, convexHull0.getMarginF(), + convexHull1.getMarginF(), doOverlapTest, renderOutput, toleranceLength)) + { + + if (numContacts > 0) + { + //reduce contacts + manifold.addBatchManifoldContacts(manifoldContacts, numContacts, toleranceLength); + + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + + //add the manifold contacts; + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + } + else + { + //if doOverlapTest is true, which means GJK/EPA degenerate so we won't have any contact in the manifoldContacts array + if (!doOverlapTest) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + } + } + return true; + } + return false; +} + +static bool generateOrProcessContactsConvexConvex(const GjkConvex* relativeConvex, const GjkConvex* localConvex, const PxTransformV& transf0, const PxTransformV& transf1, + const PxMatTransformV& aToB, GjkStatus status, GjkOutput& output, PersistentContactManifold& manifold, PxContactBuffer& contactBuffer, + const PxU32 initialContacts, const FloatV minMargin, const FloatV contactDist, + const bool idtScale0, const bool idtScale1, const PxReal toleranceLength, PxRenderOutput* renderOutput) +{ + if (status == GJK_NON_INTERSECT) + { + return false; + } + else + { + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + + const Vec3V localNor = manifold.mNumContacts ? manifold.getLocalNormal() : V3Zero(); + + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + //addGJKEPAContacts will increase the number of contacts in manifold. If status == EPA_CONTACT, we need to run epa algorithm and generate closest points, normal and + //pentration. If epa doesn't degenerate, we will store the contacts information in the manifold. Otherwise, we will return true to do the fallback test + const bool doOverlapTest = addGJKEPAContacts(relativeConvex, localConvex, aToB, status, manifoldContacts, replaceBreakingThreshold, FLoad(toleranceLength), output, manifold); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + //ML: after we refresh the contacts(newContacts) and generate a GJK/EPA contacts(we will store that in the manifold), if the number of contacts is still less than the original contacts, + //which means we lose too mang contacts and we should regenerate all the contacts in the current configuration + //Also, we need to look at the existing contacts, if the existing contacts has very different normal than the GJK/EPA contacts, + //which means we should throw away the existing contacts and do full contact gen + const bool fullContactGen = FAllGrtr(FLoad(0.707106781f), V3Dot(localNor, output.normal)) || (manifold.mNumContacts < initialContacts); + + if (fullContactGen || doOverlapTest) + { + return fullContactsGenerationConvexConvex(relativeConvex, localConvex, transf0, transf1, idtScale0, idtScale1, manifoldContacts, contactBuffer, + manifold, output.normal, output.closestA, output.closestB, contactDist, doOverlapTest, renderOutput, toleranceLength); + } + else + { + const Vec3V newLocalNor = V3Add(localNor, output.normal); + const Vec3V worldNormal = V3Normalize(transf1.rotate(newLocalNor)); + //const Vec3V worldNormal = transf1.rotate(normal); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); + return true; + } + } +} + +static bool convexHullNoScale0(const ConvexHullV& convexHull0, const ConvexHullV& convexHull1, const PxTransformV& transf0, const PxTransformV& transf1, + const PxMatTransformV& aToB, GjkOutput& output, PersistentContactManifold& manifold, PxContactBuffer& contactBuffer, + const PxU32 initialContacts, const FloatV minMargin, const FloatV contactDist, + const bool idtScale1, const PxReal toleranceLength, PxRenderOutput* renderOutput) +{ + const RelativeConvex convexA(static_cast(convexHull0), aToB); + if(idtScale1) + { + const LocalConvex convexB(static_cast(convexHull1)); + GjkStatus status = gjkPenetration, LocalConvex >(convexA, convexB, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + return generateOrProcessContactsConvexConvex(&convexA, &convexB, transf0, transf1, aToB, status, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, true, true, toleranceLength, renderOutput); + } + else + { + const LocalConvex convexB(convexHull1); + GjkStatus status = gjkPenetration, LocalConvex >(convexA, convexB, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + return generateOrProcessContactsConvexConvex(&convexA, &convexB, transf0, transf1, aToB, status, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, true, false, toleranceLength, renderOutput); + } +} + +static bool convexHullHasScale0(const ConvexHullV& convexHull0, const ConvexHullV& convexHull1, const PxTransformV& transf0, const PxTransformV& transf1, + const PxMatTransformV& aToB, GjkOutput& output, PersistentContactManifold& manifold, PxContactBuffer& contactBuffer, + const PxU32 initialContacts, const FloatV minMargin, const FloatV contactDist, + const bool idtScale1, const PxReal toleranceLength, PxRenderOutput* renderOutput) +{ + RelativeConvex convexA(convexHull0, aToB); + if(idtScale1) + { + const LocalConvex convexB(static_cast(convexHull1)); + GjkStatus status = gjkPenetration, LocalConvex >(convexA, convexB, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints,output); + + return generateOrProcessContactsConvexConvex(&convexA, &convexB, transf0, transf1, aToB, status, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, false, true, toleranceLength, renderOutput); + } + else + { + const LocalConvex convexB(convexHull1); + GjkStatus status = gjkPenetration, LocalConvex >(convexA, convexB, aToB.p, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + + return generateOrProcessContactsConvexConvex(&convexA, &convexB, transf0, transf1, aToB, status, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, false, false, toleranceLength, renderOutput); + } +} + +bool Gu::pcmContactConvexConvex(GU_CONTACT_METHOD_ARGS) +{ + const PxConvexMeshGeometry& shapeConvex0 = checkedCast(shape0); + const PxConvexMeshGeometry& shapeConvex1 = checkedCast(shape1); + + PersistentContactManifold& manifold = cache.getManifold(); + + const Gu::ConvexHullData* hullData0 = _getHullData(shapeConvex0); + const Gu::ConvexHullData* hullData1 = _getHullData(shapeConvex1); + PxPrefetchLine(hullData0); + PxPrefetchLine(hullData1); + + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const Vec3V vScale0 = V3LoadU_SafeReadW(shapeConvex0.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const Vec3V vScale1 = V3LoadU_SafeReadW(shapeConvex1.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const FloatV contactDist = FLoad(params.mContactDistance); + + //Transfer A into the local space of B + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV convexMargin0 = Gu::CalculatePCMConvexMargin(hullData0, vScale0, toleranceLength); + const FloatV convexMargin1 = Gu::CalculatePCMConvexMargin(hullData1, vScale1, toleranceLength); + + const PxU32 initialContacts = manifold.mNumContacts; + + const FloatV minMargin = FMin(convexMargin0, convexMargin1); + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.8f)); + + manifold.refreshContactPoints(aToB, projectBreakingThreshold, contactDist); + + //ML: after refreshContactPoints, we might lose some contacts + const bool bLostContacts = (manifold.mNumContacts != initialContacts); + + const Vec3V extent0 = V3Mul(V3LoadU(hullData0->mInternal.mExtents), vScale0); + const Vec3V extent1 = V3Mul(V3LoadU(hullData0->mInternal.mExtents), vScale1); + + const FloatV radiusA = V3Length(extent0); + const FloatV radiusB = V3Length(extent1); + + if(bLostContacts || manifold.invalidate_BoxConvex(curRTrans, transf0.q, transf1.q, minMargin, radiusA, radiusB)) + { + manifold.setRelativeTransform(curRTrans, transf0.q, transf1.q); + + const bool idtScale0 = shapeConvex0.scale.isIdentity(); + const bool idtScale1 = shapeConvex1.scale.isIdentity(); + const QuatV vQuat0 = QuatVLoadU(&shapeConvex0.scale.rotation.x); + const QuatV vQuat1 = QuatVLoadU(&shapeConvex1.scale.rotation.x); + + const Gu::ConvexHullV convexHull0(hullData0, V3LoadU(hullData0->mCenterOfMass), vScale0, vQuat0, idtScale0); + const Gu::ConvexHullV convexHull1(hullData1, V3LoadU(hullData1->mCenterOfMass), vScale1, vQuat1, idtScale1); + + GjkOutput output; + + if(idtScale0) + { + return convexHullNoScale0(convexHull0, convexHull1, transf0, transf1, aToB, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, idtScale1, toleranceLength, renderOutput); + } + else + { + return convexHullHasScale0(convexHull0, convexHull1, transf0, transf1, aToB, output, manifold, + contactBuffer, initialContacts, minMargin, contactDist, idtScale1, toleranceLength, renderOutput); + } + + } + else if(manifold.getNumContacts()> 0) + { + const Vec3V worldNormal = manifold.getWorldNormal(transf1); + manifold.addManifoldContactsToContactBuffer(contactBuffer, worldNormal, transf1, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return true; + } + + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp new file mode 100644 index 0000000..559b6ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexHeightField.cpp @@ -0,0 +1,253 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangleMesh.h" +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuVecTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuPCMShapeConvex.h" +#include "GuHeightField.h" +#include "GuHeightFieldUtil.h" +#include "GuPCMContactConvexCommon.h" +#include "GuPCMContactMeshCallback.h" +#include "foundation/PxVecMath.h" + +using namespace physx; +using namespace Gu; +using namespace physx::aos; + +namespace physx +{ + +struct PCMConvexVsHeightfieldContactGenerationCallback + : PCMHeightfieldContactGenerationCallback< PCMConvexVsHeightfieldContactGenerationCallback > +{ + PCMConvexVsHeightfieldContactGenerationCallback& operator=(const PCMConvexVsHeightfieldContactGenerationCallback&); +public: + PCMConvexVsMeshContactGeneration mGeneration; + + PCMConvexVsHeightfieldContactGenerationCallback( + const aos::FloatVArg contactDistance, + const aos::FloatVArg replaceBreakingThreshold, + const PolygonalData& polyData, + SupportLocal* polyMap, + const Cm::FastVertex2ShapeScaling& convexScaling, + bool idtConvexScale, + const PxTransformV& convexTransform, + const PxTransformV& heightfieldTransform, + const PxTransform& heightfieldTransform1, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + HeightFieldUtil& hfUtil, + PxInlineArray* delayedContacts, + bool silhouetteEdgesAreActive, + PxRenderOutput* renderOutput = NULL + ) : + PCMHeightfieldContactGenerationCallback< PCMConvexVsHeightfieldContactGenerationCallback >(hfUtil, heightfieldTransform1), + mGeneration(contactDistance, replaceBreakingThreshold, convexTransform, heightfieldTransform, multiManifold, + contactBuffer, polyData, polyMap, delayedContacts, convexScaling, idtConvexScale, silhouetteEdgesAreActive, renderOutput) + { + } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; + +bool Gu::PCMContactConvexHeightfield( + const PolygonalData& polyData, SupportLocal* polyMap, const aos::FloatVArg minMargin, + const PxBounds3& hullAABB, const PxHeightFieldGeometry& shapeHeightfield, + const PxTransform& transform0, const PxTransform& transform1, + PxReal contactDistance, PxContactBuffer& contactBuffer, + const Cm::FastVertex2ShapeScaling& convexScaling, bool idtConvexScale, + MultiplePersistentContactManifold& multiManifold, PxRenderOutput* renderOutput) +{ + using namespace aos; + using namespace Gu; + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV contactDist = FLoad(contactDistance); + //Transfer A into the local space of B + const PxTransformV convexTransform(p0, q0);//box + const PxTransformV heightfieldTransform(p1, q1);//heightfield + const PxTransformV curTransform = heightfieldTransform.transformInv(convexTransform); + + if(multiManifold.invalidate(curTransform, minMargin)) + { + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + //////////////////// + + HeightFieldUtil hfUtil(shapeHeightfield); + const HeightField& hf = hfUtil.getHeightField(); + + //////////////////// + + /*const Cm::Matrix34 world0(transform0); + const Cm::Matrix34 world1(transform1); + + const PxU8* PX_RESTRICT extraData = meshData->mExtraTrigData;*/ + + PxInlineArray delayedContacts; + + PCMConvexVsHeightfieldContactGenerationCallback blockCallback( + contactDist, + replaceBreakingThreshold, + polyData, + polyMap, + convexScaling, + idtConvexScale, + convexTransform, + heightfieldTransform, + transform1, + multiManifold, + contactBuffer, + hfUtil, + &delayedContacts, + !(hf.getFlags() & PxHeightFieldFlag::eNO_BOUNDARY_EDGES), + renderOutput + ); + + hfUtil.overlapAABBTriangles(transform0, transform1, hullAABB, blockCallback); + + PX_ASSERT(multiManifold.mNumManifolds <= GU_MAX_MANIFOLD_SIZE); + blockCallback.mGeneration.generateLastContacts(); + blockCallback.mGeneration.processContacts(GU_SINGLE_MANIFOLD_CACHE_SIZE, false); + } + else + { + const PxMatTransformV aToB(curTransform); + + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.6f)); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, contactDist); + } + +#if PCM_LOW_LEVEL_DEBUG + multiManifold.drawManifold(*renderOutput, convexTransform, heightfieldTransform); +#endif + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, heightfieldTransform); +} + +bool Gu::pcmContactConvexHeightField(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape0); + const PxHeightFieldGeometry& shapeHeightField = checkedCast(shape1); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const PxTransformV convexTransform(p0, q0); + + //const bool idtScaleMesh = shapeMesh.scale.isIdentity(); + + //Cm::FastVertex2ShapeScaling meshScaling; + //if(!idtScaleMesh) + // meshScaling.init(shapeMesh.scale); + + Cm::FastVertex2ShapeScaling convexScaling; + PxBounds3 hullAABB; + PolygonalData polyData; + const bool idtScaleConvex = getPCMConvexData(shapeConvex, convexScaling, hullAABB, polyData); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV minMargin = CalculatePCMConvexMargin(hullData, vScale, toleranceLength, GU_PCM_MESH_MANIFOLD_EPSILON); + + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + const ConvexHullV convexHull(hullData, V3Zero(), vScale, vQuat, shapeConvex.scale.isIdentity()); + + if(idtScaleConvex) + { + SupportLocalImpl convexMap(static_cast(convexHull), convexTransform, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex); + return PCMContactConvexHeightfield(polyData, &convexMap, minMargin, hullAABB, shapeHeightField, transform0, transform1, params.mContactDistance, contactBuffer, convexScaling, + idtScaleConvex, multiManifold, renderOutput); + } + else + { + SupportLocalImpl convexMap(convexHull, convexTransform, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScaleConvex); + return PCMContactConvexHeightfield(polyData, &convexMap, minMargin, hullAABB, shapeHeightField, transform0, transform1, params.mContactDistance, contactBuffer, convexScaling, + idtScaleConvex, multiManifold, renderOutput); + } +} + +bool Gu::pcmContactBoxHeightField(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const PxBoxGeometry& shapeBox = checkedCast(shape0); + const PxHeightFieldGeometry& shapeHeightField = checkedCast(shape1); + + const PxVec3 ext = shapeBox.halfExtents + PxVec3(params.mContactDistance); + const PxBounds3 hullAABB(-ext, ext); + + const Cm::FastVertex2ShapeScaling idtScaling; + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + + const PxReal toranceLength = params.mToleranceLength; + const FloatV minMargin = CalculatePCMBoxMargin(boxExtents, toranceLength, GU_PCM_MESH_MANIFOLD_EPSILON); + + const BoxV boxV(V3Zero(), boxExtents); + + const PxTransformV boxTransform(p0, q0);//box + + PolygonalData polyData; + PCMPolygonalBox polyBox(shapeBox.halfExtents); + polyBox.getPolygonalData(&polyData); + + const Mat33V identity = M33Identity(); + //SupportLocalImpl boxMap(boxV, boxTransform, identity, identity); + SupportLocalImpl boxMap(boxV, boxTransform, identity, identity, true); + + return PCMContactConvexHeightfield(polyData, &boxMap, minMargin, hullAABB, shapeHeightField, transform0, transform1, params.mContactDistance, contactBuffer, + idtScaling, true, multiManifold, renderOutput); +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp new file mode 100644 index 0000000..0e11572 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactConvexMesh.cpp @@ -0,0 +1,254 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangleMesh.h" +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuVecTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuPCMShapeConvex.h" +#include "GuConvexUtilsInternal.h" +#include "GuPCMContactConvexCommon.h" +#include "GuPCMContactMeshCallback.h" +#include "GuIntersectionTriangleBox.h" +#include "GuBox.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace physx::aos; + +namespace physx +{ + +struct PCMConvexVsMeshContactGenerationCallback : PCMMeshContactGenerationCallback +{ + PCMConvexVsMeshContactGenerationCallback& operator=(const PCMConvexVsMeshContactGenerationCallback&); +public: + PCMConvexVsMeshContactGeneration mGeneration; + const BoxPadded& mBox; + + PCMConvexVsMeshContactGenerationCallback( + const aos::FloatVArg contactDistance, + const aos::FloatVArg replaceBreakingThreshold, + const PxTransformV& convexTransform, + const PxTransformV& meshTransform, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + const PolygonalData& polyData, + SupportLocal* polyMap, + PxInlineArray* delayedContacts, + const FastVertex2ShapeScaling& convexScaling, + bool idtConvexScale, + const FastVertex2ShapeScaling& meshScaling, + const PxU8* extraTriData, + bool idtMeshScale, + bool silhouetteEdgesAreActive, + const BoxPadded& box, + PxRenderOutput* renderOutput = NULL + ) : + PCMMeshContactGenerationCallback(meshScaling, extraTriData, idtMeshScale), + mGeneration(contactDistance, replaceBreakingThreshold, convexTransform, meshTransform, multiManifold, contactBuffer, polyData, + polyMap, delayedContacts, convexScaling, idtConvexScale, silhouetteEdgesAreActive, renderOutput), + mBox(box) + { + } + + PX_FORCE_INLINE PxIntBool doTest(const PxVec3& v0, const PxVec3& v1, const PxVec3& v2) + { + // PT: this one is safe because midphase vertices are directly passed to the function + return intersectTriangleBox(mBox, v0, v1, v2); + } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; + +bool Gu::PCMContactConvexMesh(const PolygonalData& polyData, SupportLocal* polyMap, const aos::FloatVArg minMargin, const PxBounds3& hullAABB, const PxTriangleMeshGeometry& shapeMesh, + const PxTransform& transform0, const PxTransform& transform1, + PxReal contactDistance, PxContactBuffer& contactBuffer, + const FastVertex2ShapeScaling& convexScaling, const FastVertex2ShapeScaling& meshScaling, + bool idtConvexScale, bool idtMeshScale, Gu::MultiplePersistentContactManifold& multiManifold, + PxRenderOutput* renderOutput) + +{ + using namespace aos; + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV contactDist = FLoad(contactDistance); + //Transfer A into the local space of B + const PxTransformV convexTransform(p0, q0);//box + const PxTransformV meshTransform(p1, q1);//triangleMesh + const PxTransformV curTransform = meshTransform.transformInv(convexTransform); + + + if(multiManifold.invalidate(curTransform, minMargin)) + { + const FloatV replaceBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + + //////////////////// + const TriangleMesh* PX_RESTRICT meshData = _getMeshData(shapeMesh); + + const Matrix34FromTransform world0(transform0); + const Matrix34FromTransform world1(transform1); + BoxPadded hullOBB; + computeHullOBB(hullOBB, hullAABB, contactDistance, world0, world1, meshScaling, idtMeshScale); + + // Setup the collider + + PxInlineArray delayedContacts; + + const PxU8* PX_RESTRICT extraData = meshData->getExtraTrigData(); + PCMConvexVsMeshContactGenerationCallback blockCallback( + contactDist, replaceBreakingThreshold, convexTransform, meshTransform, multiManifold, contactBuffer, + polyData, polyMap, &delayedContacts, convexScaling, idtConvexScale, meshScaling, extraData, idtMeshScale, true, + hullOBB, renderOutput); + + Midphase::intersectOBB(meshData, hullOBB, blockCallback, true); + + PX_ASSERT(multiManifold.mNumManifolds <= GU_MAX_MANIFOLD_SIZE); + + blockCallback.flushCache(); + //This is very important + blockCallback.mGeneration.generateLastContacts(); + blockCallback.mGeneration.processContacts(GU_SINGLE_MANIFOLD_CACHE_SIZE, false); + +#if PCM_LOW_LEVEL_DEBUG + multiManifold.drawManifold(*renderOutput, transform0, transform1); +#endif + } + else + { + const PxMatTransformV aToB(curTransform); + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.8f)); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, contactDist); + } + + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, meshTransform); +} + +bool Gu::pcmContactConvexMesh(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + PX_UNUSED(renderOutput); + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const PxTransformV convexTransform = loadTransformA(transform0); + + const bool idtScaleMesh = shapeMesh.scale.isIdentity(); + + FastVertex2ShapeScaling meshScaling; + if(!idtScaleMesh) + meshScaling.init(shapeMesh.scale); + + FastVertex2ShapeScaling convexScaling; + PxBounds3 hullAABB; + PolygonalData polyData; + const bool idtScaleConvex = getPCMConvexData(shapeConvex, convexScaling, hullAABB, polyData); + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + + const PxReal toleranceScale = params.mToleranceLength; + const FloatV minMargin = CalculatePCMConvexMargin(hullData, vScale, toleranceScale, GU_PCM_MESH_MANIFOLD_EPSILON); + + const ConvexHullV convexHull(hullData, V3Zero(), vScale, vQuat, idtScaleConvex); + + if(idtScaleConvex) + { + SupportLocalImpl convexMap(static_cast(convexHull), convexTransform, convexHull.vertex2Shape, convexHull.shape2Vertex, true); + return Gu::PCMContactConvexMesh(polyData, &convexMap, minMargin, hullAABB, shapeMesh,transform0,transform1, params.mContactDistance, contactBuffer, convexScaling, + meshScaling, idtScaleConvex, idtScaleMesh, multiManifold, renderOutput); + } + else + { + SupportLocalImpl convexMap(convexHull, convexTransform, convexHull.vertex2Shape, convexHull.shape2Vertex, false); + return Gu::PCMContactConvexMesh(polyData, &convexMap, minMargin, hullAABB, shapeMesh,transform0,transform1, params.mContactDistance, contactBuffer, convexScaling, + meshScaling, idtScaleConvex, idtScaleMesh, multiManifold, renderOutput); + } +} + +bool Gu::pcmContactBoxMesh(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + PX_UNUSED(renderOutput); + + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const PxBoxGeometry& shapeBox = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + const PxBounds3 hullAABB(-shapeBox.halfExtents, shapeBox.halfExtents); + + const bool idtMeshScale = shapeMesh.scale.isIdentity(); + + FastVertex2ShapeScaling meshScaling; + if(!idtMeshScale) + meshScaling.init(shapeMesh.scale); + + FastVertex2ShapeScaling idtScaling; + + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + const PxReal toleranceLength = params.mToleranceLength; + const FloatV minMargin = Gu::CalculatePCMBoxMargin(boxExtents, toleranceLength, GU_PCM_MESH_MANIFOLD_EPSILON); + + BoxV boxV(V3Zero(), boxExtents); + + const PxTransformV boxTransform = loadTransformA(transform0);//box + + PolygonalData polyData; + PCMPolygonalBox polyBox(shapeBox.halfExtents); + polyBox.getPolygonalData(&polyData); + + Mat33V identity = M33Identity(); + SupportLocalImpl boxMap(boxV, boxTransform, identity, identity, true); + + return Gu::PCMContactConvexMesh(polyData, &boxMap, minMargin, hullAABB, shapeMesh, transform0, transform1, params.mContactDistance, contactBuffer, idtScaling, meshScaling, + true, idtMeshScale, multiManifold, renderOutput); +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp new file mode 100644 index 0000000..8cc80ae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactCustomGeometry.cpp @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuBounds.h" +#include "GuContactMethodImpl.h" +#include "GuPCMShapeConvex.h" +#include "GuPCMContactGen.h" + +using namespace physx; +using namespace aos; + +static bool pcmContactCustomGeometryGeometry(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxCustomGeometry& customGeom = checkedCast(shape0); + const PxGeometry& otherGeom = shape1; + + float breakingThreshold = 0.01f * params.mToleranceLength; + bool usePCM = customGeom.callbacks->usePersistentContactManifold(customGeom, breakingThreshold); + if (otherGeom.getType() == PxGeometryType::eCUSTOM) + { + float breakingThreshold1 = breakingThreshold; + if (checkedCast(shape1).callbacks->usePersistentContactManifold(otherGeom, breakingThreshold1)) + { + breakingThreshold = PxMin(breakingThreshold, breakingThreshold1); + usePCM = true; + } + } + else if (otherGeom.getType() > PxGeometryType::eCONVEXMESH) + { + usePCM = true; + } + + if (usePCM) + { + Gu::MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const PxTransformV transf0 = loadTransformA(transform0), transf1 = loadTransformA(transform1); + const PxTransformV curRTrans = transf1.transformInv(transf0); + const FloatV cos5 = FLoad(0.9962f); // Cos of 5 degrees + if (multiManifold.invalidate(curRTrans, FLoad(breakingThreshold))) + { + customGeom.callbacks->generateContacts(customGeom, otherGeom, transform0, transform1, + params.mContactDistance, params.mMeshContactMargin, params.mToleranceLength, + contactBuffer); + + multiManifold.initialize(); + multiManifold.setRelativeTransform(curRTrans); + + for (PxU32 ci = 0; ci < contactBuffer.count; ++ci) + { + const PxContactPoint& c = contactBuffer.contacts[ci]; + const Vec3V cP = V3LoadU(c.point); + const Vec3V cN = V3LoadU(c.normal); + const FloatV cD = FLoad(c.separation); + + Gu::SinglePersistentContactManifold* manifold = NULL; + for (PxU8 mi = 0; mi < multiManifold.mNumManifolds; ++mi) + { + const Vec3V mN = multiManifold.mManifolds[mi].getWorldNormal(transf1); + const BoolV cmp = FIsGrtr(V3Dot(cN, mN), cos5); + if (BAllEqTTTT(cmp)) + { + manifold = &multiManifold.mManifolds[mi]; + break; + } + } + + if (!manifold) + { + manifold = multiManifold.getEmptyManifold(); + if (manifold) multiManifold.mNumManifolds++; + } + + if (manifold) + { + Gu::SinglePersistentContactManifold& m = *manifold; + Gu::MeshPersistentContact pc; + pc.mLocalPointA = transf0.transformInv(cP); + pc.mLocalPointB = transf1.transformInv(cP); + pc.mLocalNormalPen = V4SetW(transf1.rotateInv(cN), cD); + pc.mFaceIndex = c.internalFaceIndex1; + m.mContactPoints[m.mNumContacts++] = pc; + m.mNumContacts = Gu::SinglePersistentContactManifold::reduceContacts(m.mContactPoints, m.mNumContacts); + } + } + + contactBuffer.count = 0; + } + +#if PCM_LOW_LEVEL_DEBUG + multiManifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, transf1); + } + + return customGeom.callbacks->generateContacts(customGeom, otherGeom, transform0, transform1, + params.mContactDistance, params.mMeshContactMargin, params.mToleranceLength, + contactBuffer); +} + +bool Gu::pcmContactGeometryCustomGeometry(GU_CONTACT_METHOD_ARGS) +{ + bool res = pcmContactCustomGeometryGeometry(shape1, shape0, transform1, transform0, params, cache, contactBuffer, renderOutput); + + for (PxU32 i = 0; i < contactBuffer.count; ++i) + contactBuffer.contacts[i].normal = -contactBuffer.contacts[i].normal; + + return res; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGen.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGen.h new file mode 100644 index 0000000..fb8ebc6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGen.h @@ -0,0 +1,81 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_CONTACT_GEN_H +#define GU_PCM_CONTACT_GEN_H + + +#include "GuConvexSupportTable.h" +#include "GuPersistentContactManifold.h" +#include "GuShapeConvex.h" +#include "GuSeparatingAxes.h" +#include "GuGJKType.h" +#include "GuGJKUtil.h" + +namespace physx +{ + +namespace Gu +{ + + + //full contact gen code for box/convexhull vs convexhull + bool generateFullContactManifold(Gu::PolygonalData& polyData0, Gu::PolygonalData& polyData1, Gu::SupportLocal* map0, Gu::SupportLocal* map1, Gu::PersistentContact* manifoldContacts, + PxU32& numContacts, const aos::FloatVArg contactDist, const aos::Vec3VArg normal, const aos::Vec3VArg closestA, const aos::Vec3VArg closestB, + const PxReal toleranceA, const PxReal toleranceB, bool doOverlapTest, PxRenderOutput* renderOutput, const PxReal toleranceLength); + + //full contact gen code for capsule vs convexhulll + bool generateFullContactManifold(const Gu::CapsuleV& capsule, Gu::PolygonalData& polyData, Gu::SupportLocal* map, const aos::PxMatTransformV& aToB, Gu::PersistentContact* manifoldContacts, + PxU32& numContacts, const aos::FloatVArg contactDist, aos::Vec3V& normal, const aos::Vec3VArg closest, const PxReal tolerance, bool doOverlapTest, const PxReal toleranceScale); + + //full contact gen code for capsule vs box + bool generateCapsuleBoxFullContactManifold(const Gu::CapsuleV& capsule, Gu::PolygonalData& polyData, Gu::SupportLocal* map, const aos::PxMatTransformV& aToB, Gu::PersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& normal, const aos::Vec3VArg closest, const PxReal boxMargin, const bool doOverlapTest, const PxReal toeranceScale, PxRenderOutput* renderOutput); + + //based on the gjk status to decide whether we should do full contact gen with GJK/EPA normal. Also, this method store + //GJK/EPA point to the manifold in case full contact gen doesn't generate any contact + bool addGJKEPAContacts(const Gu::GjkConvex* relativeConvex, const Gu::GjkConvex* localConvex, const aos::PxMatTransformV& aToB, Gu::GjkStatus status, + Gu::PersistentContact* manifoldContacts, const aos::FloatV replaceBreakingThreshold, const aos::FloatV toleranceLength, GjkOutput& output, + Gu::PersistentContactManifold& manifold); + + //MTD code for box/convexhull vs box/convexhull + bool computeMTD(Gu::PolygonalData& polyData0, Gu::PolygonalData& polyData1, SupportLocal* map0, SupportLocal* map1, aos::FloatV& penDepth, aos::Vec3V& normal); + + //MTD code for capsule vs box/convexhull + bool computeMTD(const Gu::CapsuleV& capsule, Gu::PolygonalData& polyData, Gu::SupportLocal* map, aos::FloatV& penDepth, aos::Vec3V& normal); + + void buildPartialHull(const Gu::PolygonalData& polyData, SupportLocal* map, Gu::SeparatingAxes& validAxes, const aos::Vec3VArg v, const aos::Vec3VArg _dir); + + //full contact gen code for sphere vs convexhull + bool generateSphereFullContactManifold(const Gu::CapsuleV& capsule, Gu::PolygonalData& polyData, Gu::SupportLocal* map, Gu::PersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& normal, const bool doOverlapTest); + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp new file mode 100644 index 0000000..eca4442 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenBoxConvex.cpp @@ -0,0 +1,820 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" +#include "GuPCMContactGenUtil.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxAlloca.h" +#include "GuVecCapsule.h" +#include "GuVecBox.h" +#include "GuEPA.h" +#include "geomutils/PxContactBuffer.h" +#include "common/PxRenderOutput.h" + +#define PCM_USE_INTERNAL_OBJECT 1 + +using namespace physx; +using namespace Gu; +using namespace aos; + + //Precompute the convex data + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + +namespace physx +{ + +namespace Gu +{ + + static bool testFaceNormal(const PolygonalData& polyData0, const PolygonalData& polyData1, SupportLocal* map0, SupportLocal* map1, const PxMatTransformV& transform0To1, const PxMatTransformV& transform1To0, const FloatVArg contactDist, + FloatV& minOverlap, PxU32& feature, Vec3V& faceNormal, const FeatureStatus faceStatus, FeatureStatus& status) + { + PX_UNUSED(polyData1); + + FloatV _minOverlap = FMax();//minOverlap; + PxU32 _feature = 0; + Vec3V _faceNormal = faceNormal; + FloatV min0, max0; + FloatV min1, max1; + + const Vec3V center1To0 = transform1To0.p; + +#if PCM_USE_INTERNAL_OBJECT + const Vec3V zeroV = V3Zero(); + const Vec3V shapeSpaceCenter1 = V3LoadU(polyData1.mCenter); + const Vec3V internalCenter1In0 = transform1To0.transform(shapeSpaceCenter1); + const FloatV internalRadius1 = FLoad(polyData1.mInternal.mRadius); + const Vec3V internalExtents1 = V3LoadU(polyData1.mInternal.mExtents); + const Vec3V negInternalExtents1 = V3Neg(internalExtents1); + +#endif + + //in the local space of polyData0 + for(PxU32 i=0; ishape2Vertex, vertexSpacePlaneNormal); + + const FloatV magnitude = FRecip(V3Length(shapeSpacePlaneNormal)); + //ML::use this to avoid LHS + min0 = FMul(V3Dot(vertexSpacePlaneNormal, minVert), magnitude); + max0 = FMul(FNeg(planeDist), magnitude); + + //normalize shape space normal + const Vec3V n0 = V3Scale(shapeSpacePlaneNormal, magnitude); + + //calculate polyData1 projection + //rotate polygon's normal into the local space of polyData1 + const Vec3V n1 = transform0To1.rotate(n0); + + +#if PCM_USE_INTERNAL_OBJECT + + //test internal object + //ML: we don't need to transform the normal into the vertex space. If polyData1 don't have scale, + //the vertex2Shape matrix will be identity, shape space normal will be the same as vertex space's normal. + //If polyData0 have scale, internalExtens1 will be 0. + const Vec3V proj = V3Sel(V3IsGrtr(n1, zeroV), internalExtents1, negInternalExtents1); + const FloatV radius = FMax(V3Dot(n1, proj), internalRadius1); + const FloatV internalTrans = V3Dot(internalCenter1In0, n0); + + const FloatV _min1 = FSub(internalTrans, radius); + const FloatV _max1 = FAdd(internalTrans, radius); + + const FloatV _min = FMax(min0, _min1); + const FloatV _max = FMin(max0, _max1); + + const FloatV _tempOverlap = FSub(_max, _min); + //const FloatV _tempOverlap = FSub(max0, _min1); + + //Internal object overlaps more than current min, so can skip it + //because (a) it isn't a separating axis and (b) it isn't the smallest axis + if(FAllGrtr(_tempOverlap, _minOverlap)) + { + continue; + } + +#endif + + const FloatV translate = V3Dot(center1To0, n0); + map1->doSupport(n1, min1, max1); + + min1 = FAdd(translate, min1); + max1 = FAdd(translate, max1); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if(FAllGrtr(_minOverlap, tempOverlap)) + { + _minOverlap = tempOverlap; + _feature = i; + _faceNormal = n0; + } + } + + if(FAllGrtr(minOverlap, _minOverlap)) + { + faceNormal = _faceNormal; + minOverlap = _minOverlap; + status = faceStatus; + } + + + + feature = _feature; + + return true; + + } + + + //plane is in the shape space of polyData + void buildPartialHull(const PolygonalData& polyData, SupportLocal* map, SeparatingAxes& validAxes, const Vec3VArg planeP, const Vec3VArg planeDir) + { + const FloatV zero = FZero(); + const Vec3V dir = V3Normalize(planeDir); + for(PxU32 i=0; ivertex2Shape, V3LoadU_SafeReadW(polyData.mVerts[inds[polygon.mNbVerts - 1]])); // PT: safe because of the way vertex memory is allocated in ConvexHullData + + FloatV dist0 = V3Dot(dir, V3Sub(v0, planeP)); + + for (PxU32 iStart = 0; iStart < polygon.mNbVerts; iStart++) + { + const Vec3V v1 = M33MulV3(map->vertex2Shape, V3LoadU_SafeReadW(polyData.mVerts[inds[iStart]])); // PT: safe because of the way vertex memory is allocated in ConvexHullData + + const FloatV dist1 = V3Dot(dir, V3Sub(v1, planeP)); + + const BoolV con = BOr(FIsGrtr(dist0, zero), FIsGrtr(dist1, zero)); + + //cull edge if either of the vertex will on the positive size of the plane + if(BAllEqTTTT(con)) + { + const Vec3V tempV = V3Sub(v0, v1); + PxVec3 temp; + V3StoreU(tempV, temp); + validAxes.addAxis(temp.getNormalized()); + } + + v0 = v1; + dist0 = dist1; + } + } + } + + + static bool testEdgeNormal(const PolygonalData& polyData0, const PolygonalData& polyData1, SupportLocal* map0, SupportLocal* map1, const PxMatTransformV& transform0To1, const PxMatTransformV& transform1To0, const FloatVArg contactDist, + FloatV& minOverlap, Vec3V& edgeNormalIn0, const FeatureStatus edgeStatus, FeatureStatus& status) + { + + FloatV overlap = minOverlap; + FloatV min0, max0; + FloatV min1, max1; + const FloatV eps = FEps(); + + const Vec3V shapeSpaceCenter0 = V3LoadU(polyData0.mCenter); + const Vec3V shapeSpaceCenter1 = V3LoadU(polyData1.mCenter); + +#if PCM_USE_INTERNAL_OBJECT + const Vec3V zeroV = V3Zero(); + const Vec3V internalCenter1In0 = V3Sub(transform1To0.transform(shapeSpaceCenter1), shapeSpaceCenter0); + const FloatV internalRadius1 = FLoad(polyData1.mInternal.mRadius); + const Vec3V internalExtents1 = V3LoadU(polyData1.mInternal.mExtents); + const Vec3V negInternalExtents1 = V3Neg(internalExtents1); + + const FloatV internalRadius0 = FLoad(polyData0.mInternal.mRadius); + const Vec3V internalExtents0 = V3LoadU(polyData0.mInternal.mExtents); + const Vec3V negInternalExtents0 = V3Neg(internalExtents0); +#endif + + const Vec3V center1To0 = transform1To0.p; + + //in polyData0 shape space + const Vec3V dir0 = V3Sub(transform1To0.transform(shapeSpaceCenter1), shapeSpaceCenter0); + const Vec3V support0 = map0->doSupport(dir0); + + //in polyData1 shape space + const Vec3V dir1 = transform0To1.rotate(V3Neg(dir0)); + const Vec3V support1 = map1->doSupport(dir1); + + const Vec3V support0In1 = transform0To1.transform(support0); + const Vec3V support1In0 = transform1To0.transform(support1); + + SeparatingAxes mSA0; + SeparatingAxes mSA1; + mSA0.reset(); + mSA1.reset(); + + buildPartialHull(polyData0, map0, mSA0, support1In0, dir0); + buildPartialHull(polyData1, map1, mSA1, support0In1, dir1); + + const PxVec3* axe0 = mSA0.getAxes(); + const PxVec3* axe1 = mSA1.getAxes(); + const PxU32 numAxe0 = mSA0.getNumAxes(); + const PxU32 numAxe1 = mSA1.getNumAxes(); + for(PxU32 i=0; i < numAxe0; ++i) + { + //axe0[i] is in the shape space of polyData0 + const Vec3V v0 = V3LoadU(axe0[i]); + + for(PxU32 j=0; j< numAxe1; ++j) + { + //axe1[j] is in the shape space of polyData1 + const Vec3V v1 = V3LoadU(axe1[j]); + + const Vec3V dir = V3Cross(v0, transform1To0.rotate(v1)); + const FloatV lenSq = V3Dot(dir, dir); + if(FAllGrtr(eps, lenSq)) + continue; + + //n0 is in polyData0's local space + const Vec3V n0 = V3Scale(dir, FRsqrt(lenSq)); + + //n1 is in polyData1's local space + const Vec3V n1 = transform0To1.rotate(n0); + +#if PCM_USE_INTERNAL_OBJECT + + //ML: we don't need to transform the normal into the vertex space. If polyData1 don't have scale, + //the vertex2Shape matrix will be identity, shape space normal will be the same as vertex space's normal. + //If polyData0 have scale, internalExtens1 will be 0. + //vertex space n1 + const Vec3V proj = V3Sel(V3IsGrtr(n1, zeroV), internalExtents1, negInternalExtents1); + const FloatV radius = FMax(V3Dot(n1, proj), internalRadius1); + + const FloatV internalTrans = V3Dot(internalCenter1In0, n0); + + const FloatV _min1 = FSub(internalTrans, radius); + const FloatV _max1 = FAdd(internalTrans, radius); + + const Vec3V proj0 = V3Sel(V3IsGrtr(n0, zeroV), internalExtents0, negInternalExtents0); + const FloatV radius0 = FMax(V3Dot(n0, proj0), internalRadius0); + + const FloatV _max0 = radius0; + const FloatV _min0 = FNeg(radius0); + + PX_ASSERT(FAllGrtrOrEq(_max0, _min0)); + PX_ASSERT(FAllGrtrOrEq(_max1, _min1)); + + + const FloatV _min = FMax(_min0, _min1); + const FloatV _max = FMin(_max0, _max1); + + const FloatV _tempOverlap = FSub(_max, _min); + + //Internal object overlaps more than current min, so can skip it + //because (a) it isn't a separating axis and (b) it isn't the smallest axis + if(FAllGrtr(_tempOverlap, overlap)) + { + continue; + } + +#endif + //get polyData0's projection + map0->doSupport(n0, min0, max0); + + const FloatV translate = V3Dot(center1To0, n0); + + //get polyData1's projection + map1->doSupport(n1, min1, max1); + + min1 = FAdd(translate, min1); + max1 = FAdd(translate, max1); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + +#if PCM_USE_INTERNAL_OBJECT + PX_ASSERT(FAllGrtrOrEq(tempOverlap, _tempOverlap)); +#endif + + if(FAllGrtr(overlap, tempOverlap)) + { + overlap = tempOverlap; + edgeNormalIn0 = n0; + status = edgeStatus; + } + } + } + + minOverlap = overlap; + + return true; + + } + + + //contactNormal is in the space of polyData0 + void generatedContacts(PolygonalData& polyData0, PolygonalData& polyData1, const HullPolygonData& referencePolygon, const HullPolygonData& incidentPolygon, + SupportLocal* map0, SupportLocal* map1, const PxMatTransformV& transform0To1, PersistentContact* manifoldContacts, + PxU32& numContacts, const FloatVArg contactDist, PxRenderOutput* renderOutput) + { + + PX_UNUSED(renderOutput); + const FloatV zero = FZero(); + + const PxU8* inds0 = polyData0.mPolygonVertexRefs + referencePolygon.mVRef8; + + //transform the plane normal to shape space + const Vec3V contactNormal = V3Normalize(M33TrnspsMulV3(map0->shape2Vertex, V3LoadU(referencePolygon.mPlane.n))); + + //this is the matrix transform all points to the 2d plane + const Mat33V rot = findRotationMatrixFromZAxis(contactNormal); + + const PxU8* inds1 = polyData1.mPolygonVertexRefs + incidentPolygon.mVRef8; + + + Vec3V* points0In0 = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*referencePolygon.mNbVerts, 16)); + Vec3V* points1In0 = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*incidentPolygon.mNbVerts, 16)); + bool* points1In0Penetration = reinterpret_cast(PxAlloca(sizeof(bool)*incidentPolygon.mNbVerts)); + FloatV* points1In0TValue = reinterpret_cast(PxAllocaAligned(sizeof(FloatV)*incidentPolygon.mNbVerts, 16)); + + //Transform all the verts from vertex space to shape space + map0->populateVerts(inds0, referencePolygon.mNbVerts, polyData0.mVerts, points0In0); + map1->populateVerts(inds1, incidentPolygon.mNbVerts, polyData1.mVerts, points1In0); + +#if PCM_LOW_LEVEL_DEBUG + Gu::PersistentContactManifold::drawPolygon(*renderOutput, map0->transform, points0In0, (PxU32)referencePolygon.mNbVerts, 0x00ff0000); + Gu::PersistentContactManifold::drawPolygon(*renderOutput, map1->transform, points1In0, (PxU32)incidentPolygon.mNbVerts, 0x0000ff00); +#endif + + //This is used to calculate the project point when the 2D reference face points is inside the 2D incident face point + const Vec3V sPoint = points1In0[0]; + + PX_ASSERT(incidentPolygon.mNbVerts <= 64); + + Vec3V eps = Vec3V_From_FloatV(FEps()); + Vec3V max = Vec3V_From_FloatV(FMax()); + Vec3V nmax = V3Neg(max); + + //transform reference polygon to 2d, calculate min and max + Vec3V rPolygonMin= max; + Vec3V rPolygonMax = nmax; + for(PxU32 i=0; ishape2Vertex, V3LoadU(incidentPolygon.mPlane.n))); + + const Vec3V contactNormalIn1 = transform0To1.rotate(contactNormal); + + for(PxU32 i=0; itransform.transformInv(map1->transform); + const PxMatTransformV transform0To1V = map1->transform.transformInv(map0->transform); + + + if(doOverlapTest) + { + //if gjk fail, SAT based yes/no test + FeatureStatus status = POLYDATA0; + FloatV minOverlap = FMax(); + Vec3V minNormal = V3Zero(); + + PxU32 feature0; + //in the local space of polyData0, minNormal is in polyData0 space + if(!testFaceNormal(polyData0, polyData1, map0, map1, transform0To1V, transform1To0V, contactDist, minOverlap, feature0, minNormal, POLYDATA0, status)) + return false; + + PxU32 feature1; + //in the local space of polyData1, if minOverlap is overwrite inside this function, minNormal will be in polyData1 space + if(!testFaceNormal(polyData1, polyData0, map1, map0, transform1To0V, transform0To1V, contactDist, minOverlap, feature1, minNormal, POLYDATA1, status)) + return false; + + + bool doEdgeTest = false; + +EdgeTest: + if(doEdgeTest) + { + + if(!testEdgeNormal(polyData0, polyData1, map0, map1, transform0To1V, transform1To0V, contactDist, minOverlap, minNormal, EDGE, status)) + return false; + + if(status != EDGE) + return true; + } + + + if(status == POLYDATA0) + { + //minNormal is in the local space of polydata0 + + const HullPolygonData& referencePolygon = polyData0.mPolygons[feature0]; + const Vec3V n = transform0To1V.rotate(minNormal); + const HullPolygonData& incidentPolygon = polyData1.mPolygons[getPolygonIndex(polyData1, map1, n)]; + + generatedContacts(polyData0, polyData1, referencePolygon, incidentPolygon, map0, map1, transform0To1V, manifoldContacts, numContacts, contactDist, renderOutput); + + if (numContacts > 0) + { + const Vec3V nn = V3Neg(n); + //flip the contacts + for(PxU32 i=0; ishape2Vertex, V3LoadU(referencePolygon.mPlane.n))); + const Vec3V incidentNormal = V3Normalize(M33TrnspsMulV3(map0->shape2Vertex, V3LoadU(incidentPolygon.mPlane.n))); + + const FloatV referenceProject = FAbs(V3Dot(referenceNormal, negNormal)); + const FloatV incidentProject = FAbs(V3Dot(incidentNormal, normalIn0)); + + if (FAllGrtrOrEq(referenceProject, incidentProject)) + { + generatedContacts(polyData1, polyData0, referencePolygon, incidentPolygon, map1, map0, transform1To0V, manifoldContacts, numContacts, contactDist, renderOutput); + } + else + { + generatedContacts(polyData0, polyData1, incidentPolygon, referencePolygon, map0, map1, transform0To1V, manifoldContacts, numContacts, contactDist, renderOutput); + + if (numContacts > 0) + { + const Vec3V n = transform0To1V.rotate(incidentNormal); + + const Vec3V nn = V3Neg(n); + //flip the contacts + for (PxU32 i = 0; igetCenter(); + const Vec3V centreB = localConvex->getCenter(); + + const Vec3V dir = V3Normalize(V3Sub(centreA, centreB)); + const FloatV theta = V3Dot(dir, normal); + + if (FAllGrtr(theta, FLoad(0.707f))) + { + addManifoldPoint(manifoldContacts, manifold, output, aToB, replaceBreakingThreshold); + } + else + { + doOverlapTest = true; + } + } + else + { + doOverlapTest = true; + } + } + else if (status == GJK_CONTACT) + { + addManifoldPoint(manifoldContacts, manifold, output, aToB, replaceBreakingThreshold); + } + else + { + PX_ASSERT(status == EPA_CONTACT); + + status = epaPenetration(*relativeConvex, *localConvex, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, tolerenceLength, output); + if (status == EPA_CONTACT) + { + addManifoldPoint(manifoldContacts, manifold, output, aToB, replaceBreakingThreshold); + } + else + { + doOverlapTest = true; + } + } + + return doOverlapTest; + } + + + bool computeMTD(Gu::PolygonalData& polyData0, Gu::PolygonalData& polyData1, SupportLocal* map0, SupportLocal* map1, aos::FloatV& penDepth, aos::Vec3V& normal) + { + + using namespace aos; + + const PxMatTransformV transform1To0V = map0->transform.transformInv(map1->transform); + const PxMatTransformV transform0To1V = map1->transform.transformInv(map0->transform); + + FeatureStatus status = POLYDATA0; + FloatV minOverlap = FMax(); + Vec3V minNormal = V3Zero(); + const FloatV contactDist = FZero(); + + PxU32 feature0; + //in the local space of polyData0, minNormal is in polyData0 space + if(!testFaceNormal(polyData0, polyData1, map0, map1, transform0To1V, transform1To0V, contactDist, minOverlap, feature0, minNormal, POLYDATA0, status)) + return false; + + PxU32 feature1; + //in the local space of polyData1, if minOverlap is overwrite inside this function, minNormal will be in polyData1 space + if(!testFaceNormal(polyData1, polyData0, map1, map0, transform1To0V, transform0To1V, contactDist, minOverlap, feature1, minNormal, POLYDATA1, status)) + return false; + + if(!testEdgeNormal(polyData0, polyData1, map0, map1, transform0To1V, transform1To0V, contactDist, minOverlap, minNormal, EDGE, status)) + return false; + + penDepth = minOverlap; + if(status == POLYDATA1) + { + //minNormal is in the local space of polydata1 + normal = map1->transform.rotate(minNormal); + } + else + { + PX_ASSERT(status == POLYDATA0 || status == EDGE); + //ML: status == POLYDATA0 or status == EDGE, minNormal is in the local space of polydata0 + normal = V3Neg(map0->transform.rotate(minNormal)); + } + + return true; + } + +}//Gu +}//physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp new file mode 100644 index 0000000..6d84b65 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenSphereCapsule.cpp @@ -0,0 +1,518 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" +#include "common/PxRenderOutput.h" +#include "GuPCMContactGenUtil.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxAlloca.h" +#include "GuVecCapsule.h" +#include "GuVecBox.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +//ML: this function is shared by the sphere/capsule vs convex hulls full contact gen, capsule in the local space of polyData +static bool testPolyDataAxis(const Gu::CapsuleV& capsule, const Gu::PolygonalData& polyData, SupportLocal* map, const aos::FloatVArg contactDist, aos::FloatV& minOverlap, aos::Vec3V& separatingAxis) +{ + FloatV _minOverlap = FMax();//minOverlap; + FloatV min0, max0; + FloatV min1, max1; + Vec3V tempAxis = V3UnitY(); + + //capsule in the local space of polyData + for(PxU32 i=0; ishape2Vertex, vertexSpacePlaneNormal); + + const FloatV magnitude = FRecip(V3Length(shapeSpacePlaneNormal)); + //normalize shape space normal + const Vec3V planeN = V3Scale(shapeSpacePlaneNormal, magnitude); + //ML::use this to avoid LHS + min0 = FMul(V3Dot(vertexSpacePlaneNormal, minVert), magnitude); + max0 = FMul(FNeg(planeDist), magnitude); + + const FloatV tempMin = V3Dot(capsule.p0, planeN); + const FloatV tempMax = V3Dot(capsule.p1, planeN); + min1 = FMin(tempMin, tempMax); + max1 = FMax(tempMin, tempMax); + + min1 = FSub(min1, capsule.radius); + max1 = FAdd(max1, capsule.radius); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if(FAllGrtr(_minOverlap, tempOverlap)) + { + _minOverlap = tempOverlap; + tempAxis = planeN; + } + } + + separatingAxis = tempAxis; + minOverlap = _minOverlap; + + return true; +} + +//ML: this function is shared by sphere/capsule. Point a and direction d need to be in the local space of polyData +static bool intersectRayPolyhedron(const aos::Vec3VArg a, const aos::Vec3VArg dir, const PolygonalData& polyData, aos::FloatV& tEnter, aos::FloatV& tExit) +{ + const FloatV zero = FZero(); + const FloatV eps = FLoad(1e-7f); + FloatV tFirst = zero; + FloatV tLast= FMax(); + + for(PxU32 k=0; k 0 means the ray is exiting halfspace + const BoolV con = FIsGrtr(zero, denominator); + const BoolV con0= FIsGrtr(tTemp, tFirst); + const BoolV con1 = FIsGrtr(tLast, tTemp); + + tFirst = FSel(BAnd(con, con0), tTemp, tFirst); + tLast = FSel(BAndNot(con1, con), tTemp, tLast); + } + + if(FAllGrtr(tFirst, tLast)) + return false; + } + + //calculate the intersect p in the local space + tEnter = tFirst; + tExit = tLast; + + return true; +} + +//Precompute the convex data +// 7+------+6 0 = --- +// /| /| 1 = +-- +// / | / | 2 = ++- +// / 4+---/--+5 3 = -+- +// 3+------+2 / y z 4 = --+ +// | / | / | / 5 = +-+ +// |/ |/ |/ 6 = +++ +// 0+------+1 *---x 7 = -++ + +static bool testSATCapsulePoly(const CapsuleV& capsule, const PolygonalData& polyData, SupportLocal* map, const FloatVArg contactDist, FloatV& minOverlap, Vec3V& separatingAxis) +{ + using namespace aos; + FloatV _minOverlap = FMax();//minOverlap; + FloatV min0, max0; + FloatV min1, max1; + Vec3V tempAxis = V3UnitY(); + const FloatV eps = FEps(); + + //ML: project capsule to polydata axis + if(!testPolyDataAxis(capsule, polyData, map, contactDist, _minOverlap, tempAxis)) + return false; + + const Vec3V capsuleAxis = V3Sub(capsule.p1, capsule.p0); + + for(PxU32 i=0;ishape2Vertex, vertexSpaceV); + + const Vec3V dir = V3Cross(capsuleAxis, shapeSpaceV); + const FloatV lenSq = V3Dot(dir, dir); + if(FAllGrtr(eps, lenSq)) + continue; + const Vec3V normal = V3ScaleInv(dir, FSqrt(lenSq)); + + map->doSupport(normal, min0, max0); + + const FloatV tempMin = V3Dot(capsule.p0, normal); + const FloatV tempMax = V3Dot(capsule.p1, normal); + min1 = FMin(tempMin, tempMax); + max1 = FMax(tempMin, tempMax); + + min1 = FSub(min1, capsule.radius); + max1 = FAdd(max1, capsule.radius); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if(FAllGrtr(_minOverlap, tempOverlap)) + { + _minOverlap = tempOverlap; + tempAxis = normal; + } + } + } + + separatingAxis = tempAxis; + minOverlap = _minOverlap; + + return true; +} + +static void generatedCapsuleBoxFaceContacts(const CapsuleV& capsule, PolygonalData& polyData, const HullPolygonData& referencePolygon, SupportLocal* map, const PxMatTransformV& aToB, PersistentContact* manifoldContacts, PxU32& numContacts, + const FloatVArg contactDist, const Vec3VArg normal) +{ + + const FloatV radius = FAdd(capsule.radius, contactDist); + + //calculate the intersect point of ray to plane + const Vec3V planeNormal = V3Normalize(M33TrnspsMulV3(map->shape2Vertex, V3LoadU(referencePolygon.mPlane.n))); + const PxU8* inds = polyData.mPolygonVertexRefs + referencePolygon.mVRef8; + const Vec3V a = M33MulV3(map->vertex2Shape, V3LoadU_SafeReadW(polyData.mVerts[inds[0]])); // PT: safe because of the way vertex memory is allocated in ConvexHullData + + const FloatV denom0 = V3Dot(planeNormal, V3Sub(capsule.p0, a)); + const FloatV denom1 = V3Dot(planeNormal, V3Sub(capsule.p1, a)); + const FloatV projPlaneN = V3Dot(planeNormal, normal); + const FloatV numer = FSel(FIsGrtr(projPlaneN, FZero()), FRecip(projPlaneN), FZero()); + const FloatV t0 = FMul(denom0, numer); + const FloatV t1 = FMul(denom1, numer); + + const BoolV con0 = FIsGrtrOrEq(radius, t0); + const BoolV con1 = FIsGrtrOrEq(radius, t1); + if(BAllEqTTTT(BOr(con0, con1))) + { + const Mat33V rot = findRotationMatrixFromZAxis(planeNormal); + Vec3V* points0In0 = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*referencePolygon.mNbVerts, 16)); + map->populateVerts(inds, referencePolygon.mNbVerts, polyData.mVerts, points0In0); + + Vec3V rPolygonMin = V3Splat(FMax()); + Vec3V rPolygonMax = V3Neg(rPolygonMin); + for(PxU32 i=0; ishape2Vertex, dir); + const Vec3V p0 = M33MulV3(map->shape2Vertex, capsule.p0); + + if(intersectRayPolyhedron(p0, vertexSpaceDir, polyData, tEnter, tExit) && FAllGrtrOrEq(inflatedRadius, tEnter)) + { + manifoldContacts[numContacts].mLocalPointA = aToB.transformInv(capsule.p0); + manifoldContacts[numContacts].mLocalPointB = V3ScaleAdd(dir, tEnter, capsule.p0); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), tEnter); + } + + const Vec3V p1 = M33MulV3(map->shape2Vertex, capsule.p1); + if(intersectRayPolyhedron(p1, vertexSpaceDir, polyData, tEnter, tExit) && FAllGrtrOrEq(inflatedRadius, tEnter)) + { + manifoldContacts[numContacts].mLocalPointA = aToB.transformInv(capsule.p1); + manifoldContacts[numContacts].mLocalPointB = V3ScaleAdd(dir, tEnter, capsule.p1); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), tEnter); + } +} + +static void generateEE(const Vec3VArg p, const Vec3VArg q, const Vec3VArg normal, const Vec3VArg a, const Vec3VArg b, const PxMatTransformV& aToB, + PersistentContact* manifoldContacts, PxU32& numContacts, const FloatVArg inflatedRadius) +{ + const FloatV zero = FZero(); + const FloatV expandedRatio = FLoad(0.005f); + const Vec3V ab = V3Sub(b, a); + const Vec3V n = V3Cross(ab, normal); + const FloatV d = V3Dot(n, a); + const FloatV np = V3Dot(n, p); + const FloatV nq = V3Dot(n,q); + const FloatV signP = FSub(np, d); + const FloatV signQ = FSub(nq, d); + const FloatV temp = FMul(signP, signQ); + if(FAllGrtr(temp, zero)) return;//If both points in the same side as the plane, no intersect points + + // if colliding edge (p3,p4) and plane are parallel return no collision + const Vec3V pq = V3Sub(q, p); + const FloatV npq= V3Dot(n, pq); + if(FAllEq(npq, zero)) return; + + //calculate the intersect point in the segment pq with plane n(x - a). + const FloatV segTValue = FDiv(FSub(d, np), npq); + const Vec3V localPointA = V3ScaleAdd(pq, segTValue, p); + + //ML: ab, localPointA and normal is in the same plane, so that we can do 2D segment segment intersection + //calculate a normal perpendicular to ray localPointA + normal*t, then do 2D segment segment intersection + const Vec3V perNormal = V3Cross(normal, pq); + const Vec3V ap = V3Sub(localPointA, a); + const FloatV nom = V3Dot(perNormal, ap); + const FloatV denom = V3Dot(perNormal, ab); + + const FloatV tValue = FDiv(nom, denom); + + const FloatV max = FAdd(FOne(), expandedRatio); + const FloatV min = FSub(zero, expandedRatio); + if(FAllGrtr(tValue, max) || FAllGrtr(min, tValue)) + return; + + const Vec3V v = V3NegScaleSub(ab, tValue, ap); + const FloatV signedDist = V3Dot(v, normal); + if(FAllGrtrOrEq(inflatedRadius, signedDist)) + { + const Vec3V localPointB = V3Sub(localPointA, v); + manifoldContacts[numContacts].mLocalPointA = aToB.transformInv(localPointA); + manifoldContacts[numContacts].mLocalPointB = localPointB; + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), signedDist); + } +} + +static void generatedContactsEEContacts(const CapsuleV& capsule, PolygonalData& polyData, const HullPolygonData& referencePolygon, SupportLocal* map, const PxMatTransformV& aToB, + PersistentContact* manifoldContacts, PxU32& numContacts, const FloatVArg contactDist, const Vec3VArg contactNormal) +{ + + const PxU8* inds = polyData.mPolygonVertexRefs + referencePolygon.mVRef8; + + Vec3V* points0In0 = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*referencePolygon.mNbVerts, 16)); + + //Transform all the verts from vertex space to shape space + map->populateVerts(inds, referencePolygon.mNbVerts, polyData.mVerts, points0In0); + + const FloatV inflatedRadius = FAdd(capsule.radius, contactDist); + + for (PxU32 rStart = 0, rEnd = PxU32(referencePolygon.mNbVerts - 1); rStart < referencePolygon.mNbVerts; rEnd = rStart++) + { + generateEE(capsule.p0, capsule.p1, contactNormal,points0In0[rStart], points0In0[rEnd], aToB, manifoldContacts, numContacts, inflatedRadius); + } +} + +bool physx::Gu::generateCapsuleBoxFullContactManifold(const CapsuleV& capsule, PolygonalData& polyData, SupportLocal* map, const PxMatTransformV& aToB, PersistentContact* manifoldContacts, PxU32& numContacts, + const FloatVArg contactDist, Vec3V& normal, const Vec3VArg closest, const PxReal margin, const bool doOverlapTest, const PxReal toleranceScale, PxRenderOutput* renderOutput) +{ + PX_UNUSED(renderOutput); + const PxU32 originalContacts = numContacts; + + const Gu::HullPolygonData* referencePolygon = NULL; + + if(doOverlapTest) + { + aos::FloatV minOverlap; + //overwrite the normal + if(!testSATCapsulePoly(capsule, polyData, map, contactDist, minOverlap, normal)) + return false; + + referencePolygon = &polyData.mPolygons[getPolygonIndex(polyData, map, V3Neg(normal))]; + } + else + { + const PxReal lowerEps = toleranceScale * PCM_WITNESS_POINT_LOWER_EPS; + const PxReal upperEps = toleranceScale * PCM_WITNESS_POINT_UPPER_EPS; + const PxReal tolerance = PxClamp(margin, lowerEps, upperEps); + + const PxU32 featureIndex = getWitnessPolygonIndex(polyData, map, V3Neg(normal), closest, tolerance); + referencePolygon = &polyData.mPolygons[featureIndex]; + } + +#if PCM_LOW_LEVEL_DEBUG + const PxU8* inds = polyData.mPolygonVertexRefs + referencePolygon->mVRef8; + Vec3V* pointsInRef = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*referencePolygon->mNbVerts, 16)); + map->populateVerts(inds, referencePolygon->mNbVerts, polyData.mVerts, pointsInRef); + Gu::PersistentContactManifold::drawPolygon(*renderOutput, map->transform, pointsInRef, referencePolygon->mNbVerts, 0x00ff0000); +#endif + generatedCapsuleBoxFaceContacts(capsule, polyData, *referencePolygon, map, aToB, manifoldContacts, numContacts, contactDist, normal); + const PxU32 faceContacts = numContacts - originalContacts; + if(faceContacts < 2) + { + generatedContactsEEContacts(capsule, polyData, *referencePolygon, map, aToB, manifoldContacts, numContacts, contactDist, normal); + } + + return true; +} + + //capsule is in the local space of polyData +bool physx::Gu::generateFullContactManifold(const CapsuleV& capsule, PolygonalData& polyData, SupportLocal* map, const PxMatTransformV& aToB, PersistentContact* manifoldContacts, PxU32& numContacts, + const FloatVArg contactDist, Vec3V& normal, const Vec3VArg closest, const PxReal margin, const bool doOverlapTest, const PxReal toleranceLength) +{ + const PxU32 originalContacts = numContacts; + + Vec3V tNormal = normal; + + if(doOverlapTest) + { + FloatV minOverlap; + + //overwrite the normal with the sperating axis + if(!testSATCapsulePoly(capsule, polyData, map, contactDist, minOverlap, tNormal)) + return false; + + generatedFaceContacts(capsule, polyData, map, aToB, manifoldContacts, numContacts, contactDist, tNormal); + + const PxU32 faceContacts = numContacts - originalContacts; + if(faceContacts < 2) + { + const Gu::HullPolygonData& referencePolygon = polyData.mPolygons[getPolygonIndex(polyData, map, V3Neg(tNormal))]; + generatedContactsEEContacts(capsule, polyData,referencePolygon, map, aToB, manifoldContacts, numContacts, contactDist, tNormal); + } + } + else + { + generatedFaceContacts(capsule, polyData, map, aToB, manifoldContacts, numContacts, contactDist, tNormal); + + const PxU32 faceContacts = numContacts - originalContacts; + if(faceContacts < 2) + { + + const PxReal lowerEps = toleranceLength * PCM_WITNESS_POINT_LOWER_EPS; + const PxReal upperEps = toleranceLength * PCM_WITNESS_POINT_UPPER_EPS; + const PxReal tolerance = PxClamp(margin, lowerEps, upperEps); + + const PxU32 featureIndex = getWitnessPolygonIndex(polyData, map, V3Neg(tNormal), closest, tolerance); + const Gu::HullPolygonData& referencePolygon = polyData.mPolygons[featureIndex]; + generatedContactsEEContacts(capsule, polyData,referencePolygon, map, aToB, manifoldContacts, numContacts, contactDist, tNormal); + } + } + + normal = tNormal; + + return true; +} + +//sphere is in the local space of polyData, we treate sphere as capsule +bool physx::Gu::generateSphereFullContactManifold(const CapsuleV& capsule, PolygonalData& polyData, SupportLocal* map, PersistentContact* manifoldContacts, PxU32& numContacts, + const FloatVArg contactDist, Vec3V& normal, const bool doOverlapTest) +{ + if(doOverlapTest) + { + FloatV minOverlap; + //overwrite the normal with the sperating axis + if(!testPolyDataAxis(capsule, polyData, map, contactDist, minOverlap, normal)) + return false; + } + + const FloatV zero = FZero(); + FloatV tEnter=zero, tExit=zero; + const FloatV inflatedRadius = FAdd(capsule.radius, contactDist); + const Vec3V dir = V3Neg(normal); + const Vec3V vertexSpaceDir = M33MulV3(map->shape2Vertex, dir); + const Vec3V p0 = M33MulV3(map->shape2Vertex, capsule.p0); + if(intersectRayPolyhedron(p0, vertexSpaceDir, polyData, tEnter, tExit) && FAllGrtrOrEq(inflatedRadius, tEnter)) + { + //ML: for sphere, the contact point A is always zeroV in its local space + manifoldContacts[numContacts].mLocalPointA = V3Zero(); + manifoldContacts[numContacts].mLocalPointB = V3ScaleAdd(dir, tEnter, capsule.p0); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(normal), tEnter); + } + + return true; +} + +//capsule is in the shape space of polyData +bool physx::Gu::computeMTD(const CapsuleV& capsule, PolygonalData& polyData, SupportLocal* map, FloatV& penDepth, Vec3V& normal) +{ + const FloatV contactDist = FZero(); + Vec3V separatingAxis; + FloatV minOverlap; + if(!testSATCapsulePoly(capsule, polyData, map, contactDist, minOverlap, separatingAxis)) + return false; + + //transform normal in to the worl space + normal = map->transform.rotate(separatingAxis); + penDepth = minOverlap; + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp new file mode 100644 index 0000000..a0d05a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp @@ -0,0 +1,304 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPCMContactGenUtil.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +bool physx::Gu::contains(aos::Vec3V* verts, const PxU32 numVerts, const aos::Vec3VArg p, const aos::Vec3VArg min, const aos::Vec3VArg max) +{ + const BoolV tempCon = BOr(V3IsGrtr(min, p), V3IsGrtr(p, max)); + const BoolV con = BOr(BGetX(tempCon), BGetY(tempCon)); + + if (BAllEqTTTT(con)) + return false; + + const FloatV tx = V3GetX(p); + const FloatV ty = V3GetY(p); + + const FloatV eps = FEps(); + const FloatV zero = FZero(); + PxU32 intersectionPoints = 0; + + PxU32 i = 0, j = numVerts - 1; + + for (; i < numVerts; j = i++) + { + const FloatV jy = V3GetY(verts[j]); + const FloatV iy = V3GetY(verts[i]); + + const FloatV jx = V3GetX(verts[j]); + const FloatV ix = V3GetX(verts[i]); + + //if p is one of the end point, we will return intersect + const BoolV con0 = BAnd(FIsEq(tx, jx), FIsEq(ty, jy)); + const BoolV con1 = BAnd(FIsEq(tx, ix), FIsEq(ty, iy)); + + if (BAllEqTTTT(BOr(con0, con1))) + return true; + + //(verts[i].y > test.y) != (points[j].y > test.y) + const PxU32 yflag0 = FAllGrtr(jy, ty); + const PxU32 yflag1 = FAllGrtr(iy, ty); + + //ML: the only case the ray will intersect this segment is when the p's y is in between two segments y + if (yflag0 != yflag1) + { + //ML: choose ray, which start at p and every points in the ray will have the same y component + //t1 = (yp - yj)/(yi - yj) + //qx = xj + t1*(xi-xj) + //t = qx - xp > 0 for the ray and segment intersection happen + const FloatV jix = FSub(ix, jx); + const FloatV jiy = FSub(iy, jy); + //const FloatV jtx = FSub(tx, jy); + const FloatV jty = FSub(ty, jy); + const FloatV part1 = FMul(jty, jix); + //const FloatV part2 = FMul(jx, jiy); + //const FloatV part3 = FMul(V3Sub(tx, eps), jiy); + const FloatV part2 = FMul(FAdd(jx, eps), jiy); + const FloatV part3 = FMul(tx, jiy); + + const BoolV comp = FIsGrtr(jiy, zero); + const FloatV tmp = FAdd(part1, part2); + const FloatV comp1 = FSel(comp, tmp, part3); + const FloatV comp2 = FSel(comp, part3, tmp); + + if (FAllGrtrOrEq(comp1, comp2)) + { + if (intersectionPoints == 1) + return false; + + intersectionPoints++; + } + } + } + return intersectionPoints> 0; +} + +PxI32 physx::Gu::getPolygonIndex(const Gu::PolygonalData& polyData, SupportLocal* map, const aos::Vec3VArg normal, PxI32& polyIndex2) +{ + //normal is in shape space, need to transform the vertex space + const Vec3V n = M33TrnspsMulV3(map->vertex2Shape, normal); + const Vec3V nnormal = V3Neg(n); + const Vec3V planeN_ = V3LoadU_SafeReadW(polyData.mPolygons[0].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + FloatV minProj = V3Dot(n, planeN_); + + const FloatV zero = FZero(); + PxI32 closestFaceIndex = 0; + + polyIndex2 = -1; + + for (PxU32 i = 1; i < polyData.mNbPolygons; ++i) + { + const Vec3V planeN = V3LoadU_SafeReadW(polyData.mPolygons[i].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const FloatV proj = V3Dot(n, planeN); + if (FAllGrtr(minProj, proj)) + { + minProj = proj; + closestFaceIndex = PxI32(i); + } + } + + const PxU32 numEdges = polyData.mNbEdges; + const PxU8* const edgeToFace = polyData.mFacesByEdges; + + //Loop through edges + PxU32 closestEdge = 0xffffffff; + FloatV maxDpSq = FMul(minProj, minProj); + + for (PxU32 i = 0; i < numEdges; ++i)//, inc = VecI32V_Add(inc, vOne)) + { + const PxU32 index = i * 2; + const PxU8 f0 = edgeToFace[index]; + const PxU8 f1 = edgeToFace[index + 1]; + + const Vec3V planeNormal0 = V3LoadU_SafeReadW(polyData.mPolygons[f0].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const Vec3V planeNormal1 = V3LoadU_SafeReadW(polyData.mPolygons[f1].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + + // unnormalized edge normal + const Vec3V edgeNormal = V3Add(planeNormal0, planeNormal1);//polys[f0].mPlane.n + polys[f1].mPlane.n; + const FloatV enMagSq = V3Dot(edgeNormal, edgeNormal);//edgeNormal.magnitudeSquared(); + //Test normal of current edge - squared test is valid if dp and maxDp both >= 0 + const FloatV dp = V3Dot(edgeNormal, nnormal);//edgeNormal.dot(normal); + const FloatV sqDp = FMul(dp, dp); + + const BoolV con0 = FIsGrtrOrEq(dp, zero); + const BoolV con1 = FIsGrtr(sqDp, FMul(maxDpSq, enMagSq)); + const BoolV con = BAnd(con0, con1); + if (BAllEqTTTT(con)) + { + maxDpSq = FDiv(sqDp, enMagSq); + closestEdge = i; + } + } + + if (closestEdge != 0xffffffff) + { + const PxU8* FBE = edgeToFace; + + const PxU32 index = closestEdge * 2; + const PxU32 f0 = FBE[index]; + const PxU32 f1 = FBE[index + 1]; + + const Vec3V planeNormal0 = V3LoadU_SafeReadW(polyData.mPolygons[f0].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const Vec3V planeNormal1 = V3LoadU_SafeReadW(polyData.mPolygons[f1].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + + const FloatV dp0 = V3Dot(planeNormal0, nnormal); + const FloatV dp1 = V3Dot(planeNormal1, nnormal); + if (FAllGrtr(dp0, dp1)) + { + closestFaceIndex = PxI32(f0); + polyIndex2 = PxI32(f1); + } + else + { + closestFaceIndex = PxI32(f1); + polyIndex2 = PxI32(f0); + } + } + + return closestFaceIndex; +} + +PxU32 physx::Gu::getWitnessPolygonIndex(const Gu::PolygonalData& polyData, SupportLocal* map, const aos::Vec3VArg normal, + const aos::Vec3VArg closest, const PxReal tolerance) +{ + PxReal pd[256]; + //first pass : calculate the smallest distance from the closest point to the polygon face + + //transform the closest p to vertex space + const Vec3V p = M33MulV3(map->shape2Vertex, closest); + PxU32 closestFaceIndex = 0; + + PxVec3 closestP; + V3StoreU(p, closestP); + + const PxReal eps = -tolerance; + + PxPlane plane = polyData.mPolygons[0].mPlane; + PxReal dist = plane.distance(closestP); + PxReal minDist = dist >= eps ? PxAbs(dist) : PX_MAX_F32; + pd[0] = minDist; + PxReal maxDist = dist; + PxU32 maxFaceIndex = 0; + + for (PxU32 i = 1; i < polyData.mNbPolygons; ++i) + { + plane = polyData.mPolygons[i].mPlane; + dist = plane.distance(closestP); + pd[i] = dist >= eps ? PxAbs(dist) : PX_MAX_F32; + if (minDist > pd[i]) + { + minDist = pd[i]; + closestFaceIndex = i; + } + if (dist > maxDist) + { + maxDist = dist; + maxFaceIndex = i; + } + } + + if (minDist == PX_MAX_F32) + return maxFaceIndex; + + //second pass : select the face which has the normal most close to the gjk/epa normal + Vec4V plane4 = V4LoadU(&polyData.mPolygons[closestFaceIndex].mPlane.n.x); + Vec3V n = Vec3V_From_Vec4V(plane4); + n = V3Normalize(M33TrnspsMulV3(map->shape2Vertex, n)); + FloatV bestProj = V3Dot(n, normal); + + const PxU32 firstPassIndex = closestFaceIndex; + + for (PxU32 i = 0; i< polyData.mNbPolygons; ++i) + { + //if the difference between the minimum distance and the distance of p to plane i is within tolerance, we use the normal to chose the best plane + if ((tolerance >(pd[i] - minDist)) && (firstPassIndex != i)) + { + plane4 = V4LoadU(&polyData.mPolygons[i].mPlane.n.x); + n = Vec3V_From_Vec4V(plane4); + //rotate the plane normal to shape space. We can roate normal into the vertex space. The reason for + //that is because it will lose some numerical precision if the object has large scale and this algorithm + //will choose different face + n = V3Normalize(M33TrnspsMulV3(map->shape2Vertex, n)); + FloatV proj = V3Dot(n, normal); + + if (FAllGrtr(bestProj, proj)) + { + closestFaceIndex = i; + bestProj = proj; + } + } + } + + return closestFaceIndex; +} + +/* PX_FORCE_INLINE bool boxContainsInXY(const aos::FloatVArg x, const aos::FloatVArg y, const aos::Vec3VArg p, const aos::Vec3V* verts, const aos::Vec3VArg min, const aos::Vec3VArg max) + { + using namespace aos; + + const BoolV tempCon = BOr(V3IsGrtr(min, p), V3IsGrtr(p, max)); + const BoolV con = BOr(BGetX(tempCon), BGetY(tempCon)); + + if(BAllEqTTTT(con)) + return false; + + const FloatV zero = FZero(); + FloatV PreviousX = V3GetX(verts[3]); + FloatV PreviousY = V3GetY(verts[3]); + + // Loop through quad vertices + for(PxI32 i=0; i<4; i++) + { + const FloatV CurrentX = V3GetX(verts[i]); + const FloatV CurrentY = V3GetY(verts[i]); + + // |CurrentX - PreviousX x - PreviousX| + // |CurrentY - PreviousY y - PreviousY| + // => similar to backface culling, check each one of the 4 triangles are consistent, in which case + // the point is within the parallelogram. + const FloatV v00 = FSub(CurrentX, PreviousX); + const FloatV v01 = FSub(y, PreviousY); + const FloatV v10 = FSub(CurrentY, PreviousY); + const FloatV v11 = FSub(x, PreviousX); + const FloatV temp0 = FMul(v00, v01); + const FloatV temp1 = FMul(v10, v11); + if(FAllGrtrOrEq(FSub(temp0, temp1), zero)) + return false; + + PreviousX = CurrentX; + PreviousY = CurrentY; + } + + return true; + } +*/ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.h new file mode 100644 index 0000000..3d2ab62 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_CONTACT_GEN_UTIL_H +#define GU_PCM_CONTACT_GEN_UTIL_H + +#include "foundation/PxVecMath.h" +#include "GuShapeConvex.h" +#include "GuVecCapsule.h" +#include "GuConvexSupportTable.h" + +//The smallest epsilon we will permit (scaled by PxTolerancesScale.length) +#define PCM_WITNESS_POINT_LOWER_EPS 1e-2f +//The largest epsilon we will permit (scaled by PxTolerancesScale.length) +#define PCM_WITNESS_POINT_UPPER_EPS 5e-2f + +namespace physx +{ +namespace Gu +{ + enum FeatureStatus + { + POLYDATA0, + POLYDATA1, + EDGE + }; + + bool contains(aos::Vec3V* verts, const PxU32 numVerts, const aos::Vec3VArg p, const aos::Vec3VArg min, const aos::Vec3VArg max); + + PX_FORCE_INLINE aos::FloatV signed2DTriArea(const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg c) + { + using namespace aos; + const Vec3V ca = V3Sub(a, c); + const Vec3V cb = V3Sub(b, c); + + const FloatV t0 = FMul(V3GetX(ca), V3GetY(cb)); + const FloatV t1 = FMul(V3GetY(ca), V3GetX(cb)); + + return FSub(t0, t1); + } + + PxI32 getPolygonIndex(const Gu::PolygonalData& polyData, SupportLocal* map, const aos::Vec3VArg normal, PxI32& polyIndex2); + + PX_FORCE_INLINE PxI32 getPolygonIndex(const Gu::PolygonalData& polyData, SupportLocal* map, const aos::Vec3VArg normal) + { + using namespace aos; + + PxI32 index2; + return getPolygonIndex(polyData, map, normal, index2); + } + + PxU32 getWitnessPolygonIndex( const Gu::PolygonalData& polyData, SupportLocal* map, const aos::Vec3VArg normal, + const aos::Vec3VArg closest, const PxReal tolerance); + +}//Gu +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactMeshCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactMeshCallback.h new file mode 100644 index 0000000..8fb3162 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactMeshCallback.h @@ -0,0 +1,260 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_CONTACT_MESH_CALLBACK_H +#define GU_PCM_CONTACT_MESH_CALLBACK_H + +#include "GuMidphaseInterface.h" +#include "GuEntityReport.h" +#include "GuHeightFieldUtil.h" +#include "GuTriangleCache.h" +#include "GuConvexEdgeFlags.h" + +namespace physx +{ +namespace Gu +{ + +template +struct PCMMeshContactGenerationCallback : MeshHitCallback +{ +public: + const Cm::FastVertex2ShapeScaling& mMeshScaling; + const PxU8* PX_RESTRICT mExtraTrigData; + bool mIdtMeshScale; + static const PxU32 CacheSize = 16; + Gu::TriangleCache mCache; + + PCMMeshContactGenerationCallback(const Cm::FastVertex2ShapeScaling& meshScaling, const PxU8* extraTrigData, bool idtMeshScale) + : MeshHitCallback(CallbackMode::eMULTIPLE), + mMeshScaling(meshScaling), mExtraTrigData(extraTrigData), mIdtMeshScale(idtMeshScale) + { + } + + void flushCache() + { + if (!mCache.isEmpty()) + { + (static_cast(this))->template processTriangleCache< CacheSize >(mCache); + mCache.reset(); + } + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxReal&, const PxU32* vinds) + { + if (!(static_cast(this))->doTest(v0, v1, v2)) + return true; + + const PxU32 triangleIndex = hit.faceIndex; + PxU8 extraData = getConvexEdgeFlags(mExtraTrigData, triangleIndex); + + const PxU32* vertexIndices = vinds; + PxVec3 v[3]; + PxU32 localStorage[3]; + if(mIdtMeshScale) + { + v[0] = v0; + v[1] = v1; + v[2] = v2; + } + else + { + const PxI32 winding = mMeshScaling.flipsNormal() ? 1 : 0; + v[0] = mMeshScaling * v0; + v[1 + winding] = mMeshScaling * v1; + v[2 - winding] = mMeshScaling * v2; + + if(winding) + { + flipConvexEdgeFlags(extraData); + localStorage[0] = vinds[0]; + localStorage[1] = vinds[2]; + localStorage[2] = vinds[1]; + vertexIndices = localStorage; + } + } + + if (mCache.isFull()) + { + (static_cast(this))->template processTriangleCache< CacheSize >(mCache); + mCache.reset(); + } + mCache.addTriangle(v, vertexIndices, triangleIndex, extraData); + + return true; + } + +protected: + PCMMeshContactGenerationCallback& operator=(const PCMMeshContactGenerationCallback&); +}; + +template +struct PCMHeightfieldContactGenerationCallback : Gu::OverlapReport +{ +public: + const Gu::HeightFieldUtil& mHfUtil; + const PxTransform& mHeightfieldTransform; + bool mBoundaryCollisions; + + PCMHeightfieldContactGenerationCallback(const Gu::HeightFieldUtil& hfUtil, const PxTransform& heightfieldTransform) : + mHfUtil(hfUtil), mHeightfieldTransform(heightfieldTransform) + { + mBoundaryCollisions = !(hfUtil.getHeightField().getFlags() & PxHeightFieldFlag::eNO_BOUNDARY_EDGES); + } + + // PT: TODO: refactor/unify with similar code in other places + virtual bool reportTouchedTris(PxU32 nb, const PxU32* indices) + { + const PxU32 CacheSize = 16; + Gu::TriangleCache cache; + + const PxU32 nbPasses = (nb+(CacheSize-1))/CacheSize; + PxU32 nbTrigs = nb; + const PxU32* inds0 = indices; + + const PxU8 nextInd[] = {2,0,1}; + + for(PxU32 i = 0; i < nbPasses; ++i) + { + cache.mNumTriangles = 0; + PxU32 trigCount = PxMin(nbTrigs, CacheSize); + nbTrigs -= trigCount; + while(trigCount--) + { + PxU32 triangleIndex = *(inds0++); + PxU32 vertIndices[3]; + + PxTriangle currentTriangle; // in world space + + PxU32 adjInds[3]; + mHfUtil.getTriangle(mHeightfieldTransform, currentTriangle, vertIndices, adjInds, triangleIndex, false, false); + + PxVec3 normal; + currentTriangle.normal(normal); + + PxU8 triFlags = 0; //KS - temporary until we can calculate triFlags for HF + + for(PxU32 a = 0; a < 3; ++a) + { + if (adjInds[a] != 0xFFFFFFFF) + { + PxTriangle adjTri; + PxU32 inds[3]; + mHfUtil.getTriangle(mHeightfieldTransform, adjTri, inds, NULL, adjInds[a], false, false); + //We now compare the triangles to see if this edge is active + + PX_ASSERT(inds[0] == vertIndices[a] || inds[1] == vertIndices[a] || inds[2] == vertIndices[a]); + PX_ASSERT(inds[0] == vertIndices[(a + 1) % 3] || inds[1] == vertIndices[(a + 1) % 3] || inds[2] == vertIndices[(a + 1) % 3]); + + PxVec3 adjNormal; + adjTri.denormalizedNormal(adjNormal); + PxU32 otherIndex = nextInd[a]; + PxF32 projD = adjNormal.dot(currentTriangle.verts[otherIndex] - adjTri.verts[0]); + + if (projD < 0.f) + { + adjNormal.normalize(); + + PxF32 proj = adjNormal.dot(normal); + + if (proj < 0.997f) + { + triFlags |= (1 << (a + 3)); + } + } + } + else if (mBoundaryCollisions) + { + triFlags |= (1 << (a + 3)); //Mark boundary edge active + } + else + triFlags |= (1 << a); //Mark as silhouette edge + } + + cache.addTriangle(currentTriangle.verts, vertIndices, triangleIndex, triFlags); + } + PX_ASSERT(cache.mNumTriangles <= 16); + + (static_cast(this))->template processTriangleCache< CacheSize >(cache); + } + return true; + } +protected: + PCMHeightfieldContactGenerationCallback& operator=(const PCMHeightfieldContactGenerationCallback&); +}; + +template +struct PCMTetMeshContactGenerationCallback : TetMeshHitCallback +{ +public: + + static const PxU32 CacheSize = 16; + Gu::TetrahedronCache mCache; + + PCMTetMeshContactGenerationCallback(): TetMeshHitCallback(CallbackMode::eMULTIPLE) + { + } + + void flushCache() + { + if (!mCache.isEmpty()) + { + (static_cast(this))->template processTetrahedronCache< CacheSize >(mCache); + mCache.reset(); + } + } + + virtual PxAgain processHit( + const PxGeomRaycastHit& hit, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, const PxVec3& v3, PxReal&, const PxU32* vinds) + { + if (!(static_cast(this))->doTest(v0, v1, v2, v3)) + return true; + + PxVec3 v[4] = { v0, v1, v2, v3 }; + + const PxU32 tetIndex = hit.faceIndex; + + if (mCache.isFull()) + { + (static_cast(this))->template processTetrahedronCache< CacheSize >(mCache); + mCache.reset(); + } + mCache.addTetrahedrons(v, vinds, tetIndex); + + return true; + } + +protected: + PCMTetMeshContactGenerationCallback& operator=(const PCMTetMeshContactGenerationCallback&); +}; + +}//Gu +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp new file mode 100644 index 0000000..600bab3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneBox.cpp @@ -0,0 +1,210 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuContactMethodImpl.h" +#include "GuPersistentContactManifold.h" + +using namespace physx; + +bool Gu::pcmContactPlaneBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(shape0); + PX_UNUSED(renderOutput); + + using namespace aos; + + Gu::PersistentContactManifold& manifold = cache.getManifold(); + PxPrefetchLine(&manifold, 256); + + // Get actual shape data + const PxBoxGeometry& shapeBox = checkedCast(shape1); + + const PxTransformV transf0 = loadTransformA(transform1);//box transform + const PxTransformV transf1 = loadTransformA(transform0);//plane transform + + //box to plane + const PxTransformV curTransf(transf1.transformInv(transf0)); + + //in world space + const Vec3V negPlaneNormal = V3Normalize(V3Neg(QuatGetBasisVector0(transf1.q))); + + const FloatV contactDist = FLoad(params.mContactDistance); + + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV boxMargin = CalculatePCMBoxMargin(boxExtents, toleranceLength); + const FloatV projectBreakingThreshold = FMul(boxMargin, FLoad(0.2f)); + const PxU32 initialContacts = manifold.mNumContacts; + + manifold.refreshContactPoints(curTransf, projectBreakingThreshold, contactDist); + + const PxU32 newContacts = manifold.mNumContacts; + const bool bLostContacts = (newContacts != initialContacts);//((initialContacts == 0) || (newContacts != initialContacts)); + + if(bLostContacts || manifold.invalidate_PrimitivesPlane(curTransf, boxMargin, FLoad(0.2f))) + { + //ML:localNormal is the local space of plane normal, however, because shape1 is box and shape0 is plane, we need to use the reverse of contact normal(which will be the plane normal) to make the refreshContactPoints + //work out the correct pentration for points + const Vec3V localNormal = V3UnitX(); + + manifold.mNumContacts = 0; + manifold.setRelativeTransform(curTransf); + + const PxMatTransformV aToB(curTransf); + const FloatV bx = V3GetX(boxExtents); + const FloatV by = V3GetY(boxExtents); + const FloatV bz = V3GetZ(boxExtents); + + const FloatV nbx = FNeg(bx); + const FloatV nby = FNeg(by); + const FloatV nbz = FNeg(bz); + + const Vec3V temp0 = V3Scale(aToB.getCol0(), bx); + const Vec3V temp1 = V3Scale(aToB.getCol1(), by); + const Vec3V temp2 = V3Scale(aToB.getCol2(), bz); + + const Vec3V ntemp2 = V3Neg(temp2); + + const FloatV px = V3GetX(aToB.p); + + //box's points in the local space of plane + const Vec3V temp01 = V3Add(temp0, temp1);//(x, y) + const Vec3V temp02 = V3Sub(temp0, temp1);//(x, -y) + + const FloatV s0 = V3GetX(V3Add(temp2, temp01));//(x, y, z) + const FloatV s1 = V3GetX(V3Add(ntemp2, temp01));//(x, y, -z) + const FloatV s2 = V3GetX(V3Add(temp2, temp02));//(x, -y, z) + const FloatV s3 = V3GetX(V3Add(ntemp2, temp02));//(x, -y, -z) + const FloatV s4 = V3GetX(V3Sub(temp2, temp02));//(-x, y, z) + const FloatV s5 = V3GetX(V3Sub(ntemp2, temp02));//(-x, y, -z) + const FloatV s6 = V3GetX(V3Sub(temp2, temp01));//(-x, -y, z) + const FloatV s7 = V3GetX(V3Sub(ntemp2, temp01));//(-x, -y, -z) + + const FloatV acceptanceDist = FSub(contactDist, px); + + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + PxU32 numContacts = 0; + + if(FAllGrtr(acceptanceDist, s0)) + { + const FloatV pen = FAdd(s0, px); + //(x, y, z) + manifoldContacts[numContacts].mLocalPointA = boxExtents;//aToB.transformInv(p); + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(boxExtents)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s1)) + { + const FloatV pen = FAdd(s1, px); + //(x, y, -z) + const Vec3V p = V3Merge(bx, by, nbz); + //add to contact stream + manifoldContacts[numContacts].mLocalPointA = p;//aToB.transformInv(p); + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s2)) + { + const FloatV pen = FAdd(s2, px); + //(x, -y, z) + const Vec3V p = V3Merge(bx, nby, bz); + manifoldContacts[numContacts].mLocalPointA = p;//aToB.transformInv(p); + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s3)) + { + const FloatV pen = FAdd(s3, px); + //(x, -y, -z) + const Vec3V p = V3Merge(bx, nby, nbz); + manifoldContacts[numContacts].mLocalPointA = p; + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s4)) + { + const FloatV pen = FAdd(s4, px); + //(-x, y, z) + const Vec3V p =V3Merge(nbx, by, bz); + manifoldContacts[numContacts].mLocalPointA = p; + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s5)) + { + const FloatV pen = FAdd(s5, px); + //(-x, y, -z) + const Vec3V p = V3Merge(nbx, by, nbz); + manifoldContacts[numContacts].mLocalPointA = p;//aToB.transformInv(p); + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + + if(FAllGrtr(acceptanceDist, s6)) + { + const FloatV pen = FAdd(s6, px); + //(-x, -y, z) + const Vec3V p = V3Merge(nbx, nby, bz); + manifoldContacts[numContacts].mLocalPointA = p;//aToB.transformInv(p); + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + if(FAllGrtr(acceptanceDist, s7)) + { + const FloatV pen = FAdd(s7, px); + //(-x, -y, -z) + const Vec3V p = V3Merge(nbx, nby, nbz); + manifoldContacts[numContacts].mLocalPointA = p; + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, pen, aToB.transform(p)); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), pen); + } + + //reduce contacts + manifold.addBatchManifoldContactsCluster(manifoldContacts, numContacts); + manifold.addManifoldContactsToContactBuffer(contactBuffer, negPlaneNormal, transf1, contactDist); + + return manifold.getNumContacts() > 0; + } + else + { + manifold.addManifoldContactsToContactBuffer(contactBuffer, negPlaneNormal, transf1, contactDist); + + //manifold.drawManifold(*gRenderOutPut, transf0, transf1); + return manifold.getNumContacts() > 0; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp new file mode 100644 index 0000000..07418b3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneCapsule.cpp @@ -0,0 +1,124 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecCapsule.h" +#include "GuContactMethodImpl.h" +#include "GuPersistentContactManifold.h" + +using namespace physx; + +bool Gu::pcmContactPlaneCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(shape0); + PX_UNUSED(renderOutput); + + using namespace aos; + + Gu::PersistentContactManifold& manifold = cache.getManifold(); + PxPrefetchLine(&manifold, 256); + + // Get actual shape data + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape1); + + const PxTransformV transf0 = loadTransformA(transform1);//capsule transform + const PxTransformV transf1 = loadTransformA(transform0);//plane transform + //capsule to plane + const PxTransformV aToB(transf1.transformInv(transf0)); + + //in world space + const Vec3V planeNormal = V3Normalize(QuatGetBasisVector0(transf1.q)); + const Vec3V contactNormal = V3Neg(planeNormal); + + //ML:localNormal is the local space of plane normal, however, because shape1 is capulse and shape0 is plane, we need to use the reverse of contact normal(which will be the plane normal) to make the refreshContactPoints + //work out the correct pentration for points + const Vec3V localNormal = V3UnitX(); + + const FloatV contactDist = FLoad(params.mContactDistance); + + const FloatV radius = FLoad(shapeCapsule.radius); + const FloatV halfHeight = FLoad(shapeCapsule.halfHeight); + + //capsule is in the local space of plane(n = (1.f, 0.f, 0.f), d=0.f) + const Vec3V basisVector = QuatGetBasisVector0(aToB.q); + const Vec3V tmp = V3Scale(basisVector, halfHeight); + const Vec3V s = V3Add(aToB.p, tmp); + const Vec3V e = V3Sub(aToB.p, tmp); + + const FloatV inflatedRadius = FAdd(radius, contactDist); + const FloatV replaceBreakingThreshold = FMul(radius, FLoad(0.001f)); + const FloatV projectBreakingThreshold = FMul(radius, FLoad(0.05f)); + const PxU32 initialContacts = manifold.mNumContacts; + + //manifold.refreshContactPoints(curRTrans, projectBreakingThreshold, contactDist); + const FloatV refreshDist = FAdd(contactDist, radius); + manifold.refreshContactPoints(aToB, projectBreakingThreshold, refreshDist); + + const PxU32 newContacts = manifold.mNumContacts; + const bool bLostContacts = (newContacts != initialContacts);//((initialContacts == 0) || (newContacts != initialContacts)); + + if(bLostContacts || manifold.invalidate_PrimitivesPlane(aToB, radius, FLoad(0.02f))) + { + manifold.mNumContacts = 0; + manifold.setRelativeTransform(aToB); + //calculate the distance from s to the plane + const FloatV signDist0 = V3GetX(s);//V3Dot(localNormal, s); + if(FAllGrtr(inflatedRadius, signDist0)) + { + const Vec3V localPointA = aToB.transformInv(s); + const Vec3V localPointB = V3NegScaleSub(localNormal, signDist0, s); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), signDist0); + //add to manifold + manifold.addManifoldPoint2(localPointA, localPointB, localNormalPen, replaceBreakingThreshold); + } + + const FloatV signDist1 = V3GetX(e);//V3Dot(localNormal, e); + if(FAllGrtr(inflatedRadius, signDist1)) + { + const Vec3V localPointA = aToB.transformInv(e); + + const Vec3V localPointB = V3NegScaleSub(localNormal, signDist1, e); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), signDist1); + //add to manifold + manifold.addManifoldPoint2(localPointA, localPointB, localNormalPen, replaceBreakingThreshold); + } + + manifold.addManifoldContactsToContactBuffer(contactBuffer, contactNormal, planeNormal, transf0, radius, contactDist); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + + return manifold.getNumContacts() > 0; + } + else + { + manifold.addManifoldContactsToContactBuffer(contactBuffer, contactNormal, planeNormal, transf0, radius, contactDist); + return manifold.getNumContacts() > 0; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp new file mode 100644 index 0000000..92f23d0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactPlaneConvex.cpp @@ -0,0 +1,229 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecConvexHull.h" +#include "GuContactMethodImpl.h" +#include "GuPersistentContactManifold.h" + +using namespace physx; + +bool Gu::pcmContactPlaneConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(shape0); + PX_UNUSED(renderOutput); + + using namespace aos; + + Gu::PersistentContactManifold& manifold = cache.getManifold(); + PxPrefetchLine(&manifold, 256); + + // Get actual shape data + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + + const PxTransformV transf0 = loadTransformA(transform1);//convex transform + const PxTransformV transf1 = loadTransformA(transform0);//plane transform + //convex to plane + const PxTransformV curTransf(transf1.transformInv(transf0)); + + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const Gu::ConvexHullData* hullData = _getHullData(shapeConvex); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV convexMargin = Gu::CalculatePCMConvexMargin(hullData, vScale, toleranceLength); + + //in world space + const Vec3V planeNormal = V3Normalize(QuatGetBasisVector0(transf1.q)); + const Vec3V negPlaneNormal = V3Neg(planeNormal); + + const FloatV contactDist = FLoad(params.mContactDistance); + + //const FloatV replaceBreakingThreshold = FMul(convexMargin, FLoad(0.001f)); + const FloatV projectBreakingThreshold = FMul(convexMargin, FLoad(0.2f)); + const PxU32 initialContacts = manifold.mNumContacts; + + manifold.refreshContactPoints(curTransf, projectBreakingThreshold, contactDist); + + const PxU32 newContacts = manifold.mNumContacts; + const bool bLostContacts = (newContacts != initialContacts);//((initialContacts == 0) || (newContacts != initialContacts)); + + + if(bLostContacts || manifold.invalidate_PrimitivesPlane(curTransf, convexMargin, FLoad(0.2f))) + { + const PxMatTransformV aToB(curTransf); + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + + const Mat33V vertex2Shape = ConstructVertex2ShapeMatrix(vScale, vQuat); + + //ML:localNormal is the local space of plane normal, however, because shape1 is box and shape0 is plane, we need to use the reverse of contact normal(which will be the plane normal) to make the refreshContactPoints + //work out the correct pentration for points + const Vec3V localNormal = V3UnitX(); + + manifold.mNumContacts = 0; + manifold.setRelativeTransform(curTransf); + const PxVec3* PX_RESTRICT verts = hullData->getHullVertices(); + + const PxU32 nbPolygons = hullData->mNbPolygons; + + const Vec3V n = V3Normalize(M33MulV3(vertex2Shape, aToB.rotateInv(localNormal))); + const Vec3V nnormal = V3Neg(n); + const FloatV zero = FZero(); + + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + PxU32 numContacts = 0; + + const PxMatTransformV aToBVertexSpace(aToB.p, M33MulM33(aToB.rot, vertex2Shape)); + + FloatV minProj = FMax(); + PxU32 closestFaceIndex = 0; + PxU32 polyIndex2 = 0xFFFFFFFF; + + for (PxU32 i = 0; i < nbPolygons; ++i) + { + const Gu::HullPolygonData& polyData = hullData->mPolygons[i]; + const Vec3V planeN = V3LoadU_SafeReadW(polyData.mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const FloatV proj = V3Dot(n, planeN); + if (FAllGrtr(minProj, proj)) + { + minProj = proj; + closestFaceIndex = PxI32(i); + } + } + + const PxU32 numEdges = hullData->mNbEdges; + const PxU8* const edgeToFace = hullData->getFacesByEdges8(); + + //Loop through edges + PxU32 closestEdge = 0xffffffff; + //We subtract a small bias to increase the chances of selecting an edge below + minProj = FSub(minProj, FLoad(5e-4f)); + FloatV maxDpSq = FMul(minProj, minProj); + + for (PxU32 i = 0; i < numEdges; ++i)//, inc = VecI32V_Add(inc, vOne)) + { + const PxU32 index = i * 2; + const PxU8 f0 = edgeToFace[index]; + const PxU8 f1 = edgeToFace[index + 1]; + + const Vec3V planeNormal0 = V3LoadU_SafeReadW(hullData->mPolygons[f0].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const Vec3V planeNormal1 = V3LoadU_SafeReadW(hullData->mPolygons[f1].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + + // unnormalized edge normal + const Vec3V edgeNormal = V3Add(planeNormal0, planeNormal1);//polys[f0].mPlane.n + polys[f1].mPlane.n; + const FloatV enMagSq = V3Dot(edgeNormal, edgeNormal);//edgeNormal.magnitudeSquared(); + //Test normal of current edge - squared test is valid if dp and maxDp both >= 0 + const FloatV dp = V3Dot(edgeNormal, nnormal);//edgeNormal.dot(normal); + const FloatV sqDp = FMul(dp, dp); + + const BoolV con0 = FIsGrtrOrEq(dp, zero); + const BoolV con1 = FIsGrtr(sqDp, FMul(maxDpSq, enMagSq)); + const BoolV con = BAnd(con0, con1); + if (BAllEqTTTT(con)) + { + maxDpSq = FDiv(sqDp, enMagSq); + closestEdge = i; + } + } + + if (closestEdge != 0xffffffff) + { + const PxU8* FBE = edgeToFace; + + const PxU32 index = closestEdge * 2; + const PxU32 f0 = FBE[index]; + const PxU32 f1 = FBE[index + 1]; + + const Vec3V planeNormal0 = V3LoadU_SafeReadW(hullData->mPolygons[f0].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + const Vec3V planeNormal1 = V3LoadU_SafeReadW(hullData->mPolygons[f1].mPlane.n); // PT: safe because 'd' follows 'n' in the plane class + + const FloatV dp0 = V3Dot(planeNormal0, nnormal); + const FloatV dp1 = V3Dot(planeNormal1, nnormal); + if (FAllGrtr(dp0, dp1)) + { + closestFaceIndex = PxI32(f0); + polyIndex2 = PxI32(f1); + } + else + { + closestFaceIndex = PxI32(f1); + polyIndex2 = PxI32(f0); + } + } + + for (PxU32 index = closestFaceIndex; index != 0xFFFFFFFF; index = polyIndex2, polyIndex2 = 0xFFFFFFFF) + { + const Gu::HullPolygonData& face = hullData->mPolygons[closestFaceIndex]; + const PxU32 nbFaceVerts = face.mNbVerts; + + const PxU8* vertInds = hullData->getVertexData8() + face.mVRef8; + + for (PxU32 i = 0; i < nbFaceVerts; ++i) + { + const Vec3V pInVertexSpace = V3LoadU(verts[vertInds[i]]); + + //transform p into plane space + const Vec3V pInPlaneSpace = aToBVertexSpace.transform(pInVertexSpace);//V3Add(aToB.p, M33MulV3(temp1, pInVertexSpace)); + + const FloatV signDist = V3GetX(pInPlaneSpace); + + if (FAllGrtr(contactDist, signDist)) + { + //transform p into shape space + const Vec3V pInShapeSpace = M33MulV3(vertex2Shape, pInVertexSpace); + //add to manifold + + manifoldContacts[numContacts].mLocalPointA = pInShapeSpace; + manifoldContacts[numContacts].mLocalPointB = V3NegScaleSub(localNormal, signDist, pInPlaneSpace); + manifoldContacts[numContacts++].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), signDist); + + if (numContacts == 64) + { + manifold.reduceBatchContactsCluster(manifoldContacts, numContacts); + numContacts = GU_MANIFOLD_CACHE_SIZE; + + for (PxU32 c = 0; c < GU_MANIFOLD_CACHE_SIZE; ++c) + manifoldContacts[c] = manifold.mContactPoints[c]; + } + + } + } + } + + //reduce contacts + //manifold.addBatchManifoldContactsCluster(manifoldContacts, numContacts); + + manifold.addBatchManifoldContacts(manifoldContacts, numContacts, toleranceLength); + } + + manifold.addManifoldContactsToContactBuffer(contactBuffer, negPlaneNormal, transf1, contactDist); +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1); +#endif + return manifold.getNumContacts() > 0; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp new file mode 100644 index 0000000..2ecfcb5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereBox.cpp @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuVecSphere.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +bool Gu::pcmContactSphereBox(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + + using namespace aos; + // Get actual shape data + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxBoxGeometry& shapeBox = checkedCast(shape1); + // + + //const PsTransformV transf0(transform0); + const Vec3V sphereOrigin = V3LoadA(&transform0.p.x); + //const PsTransformV transf1(transform1); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV radius = FLoad(shapeSphere.radius); + + const PxTransformV transf1(p1, q1); + + const FloatV cDist = FLoad(params.mContactDistance); + + const Vec3V boxExtents = V3LoadU(shapeBox.halfExtents); + + //translate sphere center into the box space + const Vec3V sphereCenter = transf1.transformInv(sphereOrigin); + + const Vec3V nBoxExtents = V3Neg(boxExtents); + + //const FloatV radSq = FMul(radius, radius); + + const FloatV inflatedSum = FAdd(radius, cDist); + const FloatV sqInflatedSum = FMul(inflatedSum, inflatedSum); + + const Vec3V p = V3Clamp(sphereCenter, nBoxExtents, boxExtents); + const Vec3V v = V3Sub(sphereCenter, p); + const FloatV lengthSq = V3Dot(v, v); + + PX_ASSERT(contactBuffer.count < PxContactBuffer::MAX_CONTACTS); + + if(FAllGrtr(sqInflatedSum, lengthSq))//intersect + { + //check whether the spherCenter is inside the box + const BoolV bInsideBox = V3IsGrtrOrEq(boxExtents, V3Abs(sphereCenter)); + // PT: TODO: ??? revisit this, why do we have both BAllEqTTTT and BAllTrue3? + if(BAllEqTTTT(BAllTrue3(bInsideBox)))//sphere center inside the box + { + //Pick directions and sign + const Vec3V absP = V3Abs(p); + const Vec3V distToSurface = V3Sub(boxExtents, absP);//dist from embedded center to box surface along 3 dimensions. + + const FloatV x = V3GetX(distToSurface); + const FloatV y = V3GetY(distToSurface); + const FloatV z = V3GetZ(distToSurface); + + const Vec3V xV = V3Splat(x); + const Vec3V zV = V3Splat(z); + + //find smallest element of distToSurface + const BoolV con0 = BAllTrue3(V3IsGrtrOrEq(distToSurface, zV)); + const BoolV con1 = BAllTrue3(V3IsGrtrOrEq(distToSurface, xV)); + const Vec3V sign = V3Sign(p); + + const Vec3V tmpX = V3Mul(V3UnitX(), sign); + const Vec3V tmpY = V3Mul(V3UnitY(), sign); + const Vec3V tmpZ = V3Mul(V3UnitZ(), sign); + + const Vec3V locNorm= V3Sel(con0, tmpZ, V3Sel(con1, tmpX, tmpY));////local coords contact normal + const FloatV dist = FNeg(FSel(con0, z, FSel(con1, x, y))); + + //separation so far is just the embedding of the center point; we still have to push out all of the radius. + const Vec3V normal = transf1.rotate(locNorm); + const FloatV penetration = FSub(dist, radius); + const Vec3V point = V3Sub(sphereOrigin , V3Scale(normal, dist)); + + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x); + V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x); + FStore(penetration, &contact.separation); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + //context.mContactBuffer.contact(point, normal, penetration); + } + else + { + //get the closest point from the center to the box surface + const FloatV recipLength = FRsqrt(lengthSq); + const FloatV length = FRecip(recipLength); + const Vec3V locNorm = V3Scale(v, recipLength); + const FloatV penetration = FSub(length, radius); + const Vec3V normal = transf1.rotate(locNorm); + const Vec3V point = transf1.transform(p); + + PX_ASSERT(contactBuffer.count < PxContactBuffer::MAX_CONTACTS); + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x); + V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x); + FStore(penetration, &contact.separation); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + + //context.mContactBuffer.contact(point, normal, penetration); + } + return true; + } + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp new file mode 100644 index 0000000..de7cc1a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereCapsule.cpp @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuVecSphere.h" +#include "GuVecCapsule.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +static PX_FORCE_INLINE aos::FloatV PxcDistancePointSegmentSquared(const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg p, aos::FloatV& param) +{ + using namespace aos; + const FloatV zero = FZero(); + const FloatV one = FOne(); + + const Vec3V ap = V3Sub(p, a); + const Vec3V ab = V3Sub(b, a); + const FloatV nom = V3Dot(ap, ab); + + const FloatV denom = V3Dot(ab, ab); + const FloatV tValue = FClamp(FDiv(nom, denom), zero, one); + + const FloatV t = FSel(FIsEq(denom, zero), zero, tValue); + const Vec3V v = V3NegScaleSub(ab, t, ap); + param = t; + return V3Dot(v, v); +} + +bool Gu::pcmContactSphereCapsule(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + using namespace aos; + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxCapsuleGeometry& shapeCapsule = checkedCast(shape1); + + //Sphere in world space + const Vec3V sphereCenter = V3LoadA(&transform0.p.x); + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV sphereRadius = FLoad(shapeSphere.radius); + const FloatV capsuleRadius = FLoad(shapeCapsule.radius); + const FloatV cDist = FLoad(params.mContactDistance); + + //const FloatV r0 = FloatV_From_F32(shapeCapsule.radius); + const FloatV halfHeight0 = FLoad(shapeCapsule.halfHeight); + const Vec3V basisVector0 = QuatGetBasisVector0(q1); + const Vec3V tmp0 = V3Scale(basisVector0, halfHeight0); + const Vec3V s = V3Add(p1, tmp0); + const Vec3V e = V3Sub(p1, tmp0); + + const FloatV radiusSum = FAdd(sphereRadius, capsuleRadius); + const FloatV inflatedSum = FAdd(radiusSum, cDist); + + // Collision detection + FloatV t; + const FloatV squareDist = PxcDistancePointSegmentSquared(s, e, sphereCenter, t); + const FloatV sqInflatedSum = FMul(inflatedSum, inflatedSum); + + if(FAllGrtr(sqInflatedSum, squareDist))//BAllEq(con, bTrue)) + { + const Vec3V p = V3ScaleAdd(V3Sub(e, s), t, s); + const Vec3V dir = V3Sub(sphereCenter, p); + const Vec3V normal = V3NormalizeSafe(dir, V3UnitX()); + const Vec3V point = V3NegScaleSub(normal, sphereRadius, sphereCenter);//transform back to the world space + + const FloatV dist = FSub(FSqrt(squareDist), radiusSum); + //context.mContactBuffer.contact(point, normal, FSub(FSqrt(squareDist), radiusSum)); + PX_ASSERT(contactBuffer.count < PxContactBuffer::MAX_CONTACTS); + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + + V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x); + V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x); + FStore(dist, &contact.separation); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + + return true; + } + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp new file mode 100644 index 0000000..ce26d9e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereConvex.cpp @@ -0,0 +1,257 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuGJKPenetration.h" +#include "GuEPA.h" +#include "GuVecCapsule.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactGen.h" +#include "GuPCMShapeConvex.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +static void addToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg worldNormal, const aos::Vec3VArg worldPoint, const aos::FloatVArg penDep) +{ + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + V4StoreA(Vec4V_From_Vec3V(worldNormal), reinterpret_cast(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldPoint), reinterpret_cast(&contact.point.x)); + FStore(penDep, &contact.separation); + + PX_ASSERT(contact.point.isFinite()); + PX_ASSERT(contact.normal.isFinite()); + PX_ASSERT(PxIsFinite(contact.separation)); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; +} + +static bool fullContactsGenerationSphereConvex(const Gu::CapsuleV& capsule, const Gu::ConvexHullV& convexHull, const aos::PxTransformV& transf0,const aos::PxTransformV& transf1, + Gu::PersistentContact* manifoldContacts, PxContactBuffer& contactBuffer, const bool idtScale, Gu::PersistentContactManifold& manifold, + aos::Vec3VArg normal, const aos::FloatVArg contactDist, bool doOverlapTest, PxRenderOutput* renderOutput) +{ + PX_UNUSED(renderOutput); + + Gu::PolygonalData polyData; + getPCMConvexData(convexHull,idtScale, polyData); + + PxU8 buff[sizeof(SupportLocalImpl)]; + SupportLocal* map = (idtScale ? static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(static_cast(convexHull), transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale)) : + static_cast(PX_PLACEMENT_NEW(buff, SupportLocalImpl)(convexHull, transf1, convexHull.vertex2Shape, convexHull.shape2Vertex, idtScale))); + + PxU32 numContacts = 0; + if(generateSphereFullContactManifold(capsule, polyData, map, manifoldContacts, numContacts, contactDist, normal, doOverlapTest)) + { + if(numContacts > 0) + { + Gu::PersistentContact& p = manifold.getContactPoint(0); + + p.mLocalPointA = manifoldContacts[0].mLocalPointA; + p.mLocalPointB = manifoldContacts[0].mLocalPointB; + p.mLocalNormalPen = manifoldContacts[0].mLocalNormalPen; + manifold.mNumContacts =1; + + //transform normal to world space + const Vec3V worldNormal = transf1.rotate(normal); + const Vec3V worldP = V3NegScaleSub(worldNormal, capsule.radius, transf0.p); + const FloatV penDep = FSub(V4GetW(manifoldContacts[0].mLocalNormalPen), capsule.radius); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1, capsule.radius); +#endif + + addToContactBuffer(contactBuffer, worldNormal, worldP, penDep); + + return true; + } + } + + return false; +} + +bool Gu::pcmContactSphereConvex(GU_CONTACT_METHOD_ARGS) +{ + PX_ASSERT(transform1.q.isSane()); + PX_ASSERT(transform0.q.isSane()); + + const PxConvexMeshGeometry& shapeConvex = checkedCast(shape1); + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + + Gu::PersistentContactManifold& manifold = cache.getManifold(); + + const Vec3V zeroV = V3Zero(); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + PxPrefetchLine(hullData); + const Vec3V vScale = V3LoadU_SafeReadW(shapeConvex.scale.scale); // PT: safe because 'rotation' follows 'scale' in PxMeshScale + const FloatV sphereRadius = FLoad(shapeSphere.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + //Transfer A into the local space of B + const PxTransformV transf0 = loadTransformA(transform0); + const PxTransformV transf1 = loadTransformA(transform1); + const PxTransformV curRTrans(transf1.transformInv(transf0)); + const PxMatTransformV aToB(curRTrans); + + const PxReal toleranceLength = params.mToleranceLength; + const FloatV convexMargin = Gu::CalculatePCMConvexMargin(hullData, vScale, toleranceLength); + + const PxU32 initialContacts = manifold.mNumContacts; + const FloatV minMargin = FMin(convexMargin, sphereRadius); + const FloatV projectBreakingThreshold = FMul(minMargin, FLoad(0.05f)); + + const FloatV refreshDistance = FAdd(sphereRadius, contactDist); + manifold.refreshContactPoints(aToB, projectBreakingThreshold, refreshDistance); + //ML: after refreshContactPoints, we might lose some contacts + const bool bLostContacts = (manifold.mNumContacts != initialContacts); + + if(bLostContacts || manifold.invalidate_SphereCapsule(curRTrans, minMargin)) + { + GjkStatus status = manifold.mNumContacts > 0 ? GJK_UNDEFINED : GJK_NON_INTERSECT; + + manifold.setRelativeTransform(curRTrans); + + const QuatV vQuat = QuatVLoadU(&shapeConvex.scale.rotation.x); + + const bool idtScale = shapeConvex.scale.isIdentity(); + //use the original shape + const ConvexHullV convexHull(hullData, V3LoadU(hullData->mCenterOfMass), vScale, vQuat, idtScale); + //transform capsule into the local space of convexHull + const CapsuleV capsule(aToB.p, sphereRadius); + + GjkOutput output; + LocalConvex convexA(capsule); + const Vec3V initialSearchDir = V3Sub(capsule.getCenter(), convexHull.getCenter()); + if(idtScale) + { + const LocalConvex convexB(*PX_CONVEX_TO_NOSCALECONVEX(&convexHull)); + status = gjkPenetration, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + } + else + { + const LocalConvex convexB(convexHull); + status = gjkPenetration, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, true, + manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, output); + } + + if(status == GJK_NON_INTERSECT) + { + return false; + } + else if(status == GJK_CONTACT) + { + Gu::PersistentContact& p = manifold.getContactPoint(0); + p.mLocalPointA = zeroV;//sphere center + p.mLocalPointB = output.closestB; + p.mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + manifold.mNumContacts =1; + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1, capsule.radius); +#endif + + //transform normal to world space + const Vec3V worldNormal = transf1.rotate(output.normal); + const Vec3V worldP = V3NegScaleSub(worldNormal, sphereRadius, transf0.p); + const FloatV penDep = FSub(output.penDep, sphereRadius); + addToContactBuffer(contactBuffer, worldNormal, worldP, penDep); + return true; + } + else if(status == GJK_DEGENERATE) + { + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + + return fullContactsGenerationSphereConvex(capsule, convexHull, transf0, transf1, manifoldContacts, contactBuffer, idtScale, + manifold, output.normal, contactDist, true, renderOutput); + } + else if (status == EPA_CONTACT) + { + if (idtScale) + { + const LocalConvex convexB(*PX_CONVEX_TO_NOSCALECONVEX(&convexHull)); + status= Gu::epaPenetration(convexA, convexB, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + } + else + { + const LocalConvex convexB(convexHull); + status= Gu::epaPenetration(convexA, convexB, manifold.mAIndice, manifold.mBIndice, manifold.mNumWarmStartPoints, + true, FLoad(toleranceLength), output); + } + + if (status == EPA_CONTACT) + { + Gu::PersistentContact& p = manifold.getContactPoint(0); + p.mLocalPointA = zeroV;//sphere center + p.mLocalPointB = output.closestB; + p.mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + manifold.mNumContacts = 1; + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1, capsule.radius); +#endif + + //transform normal to world space + const Vec3V worldNormal = transf1.rotate(output.normal); + const Vec3V worldP = V3NegScaleSub(worldNormal, sphereRadius, transf0.p); + const FloatV penDep = FSub(output.penDep, sphereRadius); + + addToContactBuffer(contactBuffer, worldNormal, worldP, penDep); + return true; + } + else + { + Gu::PersistentContact* manifoldContacts = PX_CP_TO_PCP(contactBuffer.contacts); + return fullContactsGenerationSphereConvex(capsule, convexHull, transf0, transf1, manifoldContacts, contactBuffer, idtScale, + manifold, output.normal, contactDist, true, renderOutput); + } + } + } + else if(manifold.mNumContacts > 0) + { + //ML:: the manifold originally has contacts + Gu::PersistentContact& p = manifold.getContactPoint(0); + const Vec3V worldNormal = transf1.rotate(Vec3V_From_Vec4V(p.mLocalNormalPen)); + const Vec3V worldP = V3NegScaleSub(worldNormal, sphereRadius, transf0.p); + const FloatV penDep = FSub(V4GetW(p.mLocalNormalPen), sphereRadius); + +#if PCM_LOW_LEVEL_DEBUG + manifold.drawManifold(*renderOutput, transf0, transf1, sphereRadius); +#endif + + addToContactBuffer(contactBuffer, worldNormal, worldP, penDep); + return true; + } + + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp new file mode 100644 index 0000000..2221cee --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereHeightField.cpp @@ -0,0 +1,146 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangleMesh.h" +#include "geomutils/PxContactBuffer.h" +#include "GuVecBox.h" +#include "GuVecConvexHull.h" +#include "GuVecConvexHullNoScale.h" +#include "GuVecTriangle.h" +#include "GuContactMethodImpl.h" +#include "GuHeightField.h" +#include "GuPCMContactConvexCommon.h" +#include "GuPCMContactMeshCallback.h" + +using namespace physx; +using namespace Gu; +using namespace physx::aos; + +namespace physx +{ + +struct PCMSphereVsHeightfieldContactGenerationCallback : PCMHeightfieldContactGenerationCallback +{ +public: + PCMSphereVsMeshContactGeneration mGeneration; + + PCMSphereVsHeightfieldContactGenerationCallback( + const aos::Vec3VArg sphereCenter, + const aos::FloatVArg sphereRadius, + const aos::FloatVArg contactDistance, + const aos::FloatVArg replaceBreakingThreshold, + const PxTransformV& sphereTransform, + const PxTransformV& heightfieldTransform, + const PxTransform& heightfieldTransform1, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + PxInlineArray* deferredContacts, + HeightFieldUtil& hfUtil + ) : + PCMHeightfieldContactGenerationCallback(hfUtil, heightfieldTransform1), + mGeneration(sphereCenter, sphereRadius, contactDistance, replaceBreakingThreshold, sphereTransform, + heightfieldTransform, multiManifold, contactBuffer, deferredContacts) + { + } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; + +bool Gu::pcmContactSphereHeightField(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxHeightFieldGeometry& shapeHeight = checkedCast(shape1); + + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV sphereRadius = FLoad(shapeSphere.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV sphereTransform(p0, q0);//sphere transform + const PxTransformV heightfieldTransform(p1, q1);//height feild + const PxTransformV curTransform = heightfieldTransform.transformInv(sphereTransform); + + // We must be in local space to use the cache + + if(multiManifold.invalidate(curTransform, sphereRadius, FLoad(0.02f))) + { + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + const FloatV replaceBreakingThreshold = FMul(sphereRadius, FLoad(0.001f)); + HeightFieldUtil hfUtil(shapeHeight); + + PxBounds3 localBounds; + const PxVec3 localSphereCenter = getLocalSphereData(localBounds, transform0, transform1, shapeSphere.radius + params.mContactDistance); + + const Vec3V sphereCenter = V3LoadU(localSphereCenter); + + PxInlineArray delayedContacts; + + PCMSphereVsHeightfieldContactGenerationCallback blockCallback( + sphereCenter, + sphereRadius, + contactDist, + replaceBreakingThreshold, + sphereTransform, + heightfieldTransform, + transform1, + multiManifold, + contactBuffer, + &delayedContacts, + hfUtil); + + hfUtil.overlapAABBTriangles(localBounds, blockCallback); + + blockCallback.mGeneration.generateLastContacts(); + blockCallback.mGeneration.processContacts(GU_SPHERE_MANIFOLD_CACHE_SIZE, false); + } + else + { + const PxMatTransformV aToB(curTransform); + const FloatV projectBreakingThreshold = FMul(sphereRadius, FLoad(0.05f)); + const FloatV refereshDistance = FAdd(sphereRadius, contactDist); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, refereshDistance); + } + + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, sphereTransform, heightfieldTransform, sphereRadius); +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp new file mode 100644 index 0000000..10057b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereMesh.cpp @@ -0,0 +1,504 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxSort.h" +#include "GuContactMethodImpl.h" +#include "GuPCMContactConvexCommon.h" +#include "GuPCMContactMeshCallback.h" +#include "GuFeatureCode.h" +#include "GuBox.h" + +using namespace physx; +using namespace Gu; +using namespace aos; + +namespace +{ +struct PCMSphereVsMeshContactGenerationCallback : PCMMeshContactGenerationCallback< PCMSphereVsMeshContactGenerationCallback > +{ + +public: + PCMSphereVsMeshContactGeneration mGeneration; + + PCMSphereVsMeshContactGenerationCallback( + const aos::Vec3VArg sphereCenter, + const aos::FloatVArg sphereRadius, + const aos::FloatVArg contactDist, + const aos::FloatVArg replaceBreakingThreshold, + const PxTransformV& sphereTransform, + const PxTransformV& meshTransform, + MultiplePersistentContactManifold& multiManifold, + PxContactBuffer& contactBuffer, + const PxU8* extraTriData, + const Cm::FastVertex2ShapeScaling& meshScaling, + bool idtMeshScale, + PxInlineArray* deferredContacts, + PxRenderOutput* renderOutput = NULL + ) : + PCMMeshContactGenerationCallback(meshScaling, extraTriData, idtMeshScale), + mGeneration(sphereCenter, sphereRadius, contactDist, replaceBreakingThreshold, sphereTransform, meshTransform, multiManifold, contactBuffer, deferredContacts, renderOutput) + { + } + + PX_FORCE_INLINE bool doTest(const PxVec3&, const PxVec3&, const PxVec3&) { return true; } + + template + void processTriangleCache(TriangleCache& cache) + { + mGeneration.processTriangleCache(cache); + } +}; +} + +bool physx::Gu::pcmContactSphereMesh(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(renderOutput); + + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + const PxTriangleMeshGeometry& shapeMesh = checkedCast(shape1); + + MultiplePersistentContactManifold& multiManifold = cache.getMultipleManifold(); + + const QuatV q0 = QuatVLoadA(&transform0.q.x); + const Vec3V p0 = V3LoadA(&transform0.p.x); + + const QuatV q1 = QuatVLoadA(&transform1.q.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV sphereRadius = FLoad(shapeSphere.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV sphereTransform(p0, q0);//sphere transform + const PxTransformV meshTransform(p1, q1);//triangleMesh + const PxTransformV curTransform = meshTransform.transformInv(sphereTransform); + + // We must be in local space to use the cache + if(multiManifold.invalidate(curTransform, sphereRadius, FLoad(0.02f))) + { + const FloatV replaceBreakingThreshold = FMul(sphereRadius, FLoad(0.001f)); + const PxVec3 sphereCenterShape1Space = transform1.transformInv(transform0.p); + PxReal inflatedRadius = shapeSphere.radius + params.mContactDistance; + + const Vec3V sphereCenter = V3LoadU(sphereCenterShape1Space); + + const TriangleMesh* meshData = _getMeshData(shapeMesh); + + Cm::FastVertex2ShapeScaling meshScaling; // PT: TODO: get rid of default ctor :( + const bool idtMeshScale = shapeMesh.scale.isIdentity(); + if(!idtMeshScale) + meshScaling.init(shapeMesh.scale); + + multiManifold.mNumManifolds = 0; + multiManifold.setRelativeTransform(curTransform); + + PxInlineArray delayedContacts; + + const PxU8* PX_RESTRICT extraData = meshData->getExtraTrigData(); + // mesh scale is not baked into cached verts + PCMSphereVsMeshContactGenerationCallback callback( + sphereCenter, + sphereRadius, + contactDist, + replaceBreakingThreshold, + sphereTransform, + meshTransform, + multiManifold, + contactBuffer, + extraData, + meshScaling, + idtMeshScale, + &delayedContacts, + renderOutput); + + PxVec3 obbCenter = sphereCenterShape1Space; + PxVec3 obbExtents = PxVec3(inflatedRadius); + PxMat33 obbRot(PxIdentity); + if(!idtMeshScale) + meshScaling.transformQueryBounds(obbCenter, obbExtents, obbRot); + const Box obb(obbCenter, obbExtents, obbRot); + + Midphase::intersectOBB(meshData, obb, callback, true); + + callback.flushCache(); + + callback.mGeneration.generateLastContacts(); + callback.mGeneration.processContacts(GU_SPHERE_MANIFOLD_CACHE_SIZE, false); + } + else + { + const PxMatTransformV aToB(curTransform); + const FloatV projectBreakingThreshold = FMul(sphereRadius, FLoad(0.05f)); + const FloatV refereshDistance = FAdd(sphereRadius, contactDist); + multiManifold.refreshManifold(aToB, projectBreakingThreshold, refereshDistance); + } + + //multiManifold.drawManifold(*gRenderOutPut, sphereTransform, meshTransform); + return multiManifold.addManifoldContactsToContactBuffer(contactBuffer, sphereTransform, meshTransform, sphereRadius); +} + +static aos::FloatV pcmDistancePointTriangleSquared( const aos::Vec3VArg p, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + const aos::Vec3VArg c, + aos::Vec3V& closestP, + FeatureCode& fc) +{ + const FloatV zero = FZero(); + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V bc = V3Sub(c, b); + const Vec3V ap = V3Sub(p, a); + const Vec3V bp = V3Sub(p, b); + const Vec3V cp = V3Sub(p, c); + + const FloatV d1 = V3Dot(ab, ap); // snom + const FloatV d2 = V3Dot(ac, ap); // tnom + const FloatV d3 = V3Dot(ab, bp); // -sdenom + const FloatV d4 = V3Dot(ac, bp); // unom = d4 - d3 + const FloatV d5 = V3Dot(ab, cp); // udenom = d5 - d6 + const FloatV d6 = V3Dot(ac, cp); // -tdenom + const FloatV unom = FSub(d4, d3); + const FloatV udenom = FSub(d5, d6); + + const Vec3V n = V3Cross(ab, ac); + const VecCrossV crossA = V3PrepareCross(ap); + const VecCrossV crossB = V3PrepareCross(bp); + const VecCrossV crossC = V3PrepareCross(cp); + const Vec3V bCrossC = V3Cross(crossB, crossC); + const Vec3V cCrossA = V3Cross(crossC, crossA); + const Vec3V aCrossB = V3Cross(crossA, crossB); + + //const FloatV va = V3Dot(n, bCrossC);//edge region of BC, signed area rbc, u = S(rbc)/S(abc) for a + //const FloatV vb = V3Dot(n, cCrossA);//edge region of AC, signed area rac, v = S(rca)/S(abc) for b + //const FloatV vc = V3Dot(n, aCrossB);//edge region of AB, signed area rab, w = S(rab)/S(abc) for c + + //check if p in vertex region outside a + const BoolV con00 = FIsGrtr(zero, d1); // snom <= 0 + const BoolV con01 = FIsGrtr(zero, d2); // tnom <= 0 + const BoolV con0 = BAnd(con00, con01); // vertex region a + + if(BAllEqTTTT(con0)) + { + //Vertex 0 + fc = FC_VERTEX0; + closestP = a; + return V3Dot(ap, ap); + } + + //check if p in vertex region outside b + const BoolV con10 = FIsGrtrOrEq(d3, zero); + const BoolV con11 = FIsGrtrOrEq(d3, d4); + const BoolV con1 = BAnd(con10, con11); // vertex region b + if(BAllEqTTTT(con1)) + { + //Vertex 1 + fc = FC_VERTEX1; + closestP = b; + return V3Dot(bp, bp); + } + + //check if p in vertex region outside c + const BoolV con20 = FIsGrtrOrEq(d6, zero); + const BoolV con21 = FIsGrtrOrEq(d6, d5); + const BoolV con2 = BAnd(con20, con21); // vertex region c + if(BAllEqTTTT(con2)) + { + //Vertex 2 + fc = FC_VERTEX2; + closestP = c; + return V3Dot(cp, cp); + } + + //check if p in edge region of AB + //const FloatV vc = FSub(FMul(d1, d4), FMul(d3, d2)); + const FloatV vc = V3Dot(n, aCrossB);//edge region of AB, signed area rab, w = S(rab)/S(abc) for c + const BoolV con30 = FIsGrtr(zero, vc); + const BoolV con31 = FIsGrtrOrEq(d1, zero); + const BoolV con32 = FIsGrtr(zero, d3); + const BoolV con3 = BAnd(con30, BAnd(con31, con32)); + if(BAllEqTTTT(con3)) + { + // Edge 01 + fc = FC_EDGE01; + const FloatV sScale = FDiv(d1, FSub(d1, d3)); + const Vec3V closest3 = V3ScaleAdd(ab, sScale, a);//V3Add(a, V3Scale(ab, sScale)); + const Vec3V vv = V3Sub(p, closest3); + closestP = closest3; + return V3Dot(vv, vv); + } + + //check if p in edge region of BC + //const FloatV va = FSub(FMul(d3, d6),FMul(d5, d4)); + const FloatV va = V3Dot(n, bCrossC);//edge region of BC, signed area rbc, u = S(rbc)/S(abc) for a + + const BoolV con40 = FIsGrtr(zero, va); + const BoolV con41 = FIsGrtrOrEq(d4, d3); + const BoolV con42 = FIsGrtrOrEq(d5, d6); + const BoolV con4 = BAnd(con40, BAnd(con41, con42)); + if(BAllEqTTTT(con4)) + { + // Edge 12 + fc = FC_EDGE12; + const FloatV uScale = FDiv(unom, FAdd(unom, udenom)); + const Vec3V closest4 = V3ScaleAdd(bc, uScale, b);//V3Add(b, V3Scale(bc, uScale)); + const Vec3V vv = V3Sub(p, closest4); + closestP = closest4; + return V3Dot(vv, vv); + } + + //check if p in edge region of AC + //const FloatV vb = FSub(FMul(d5, d2), FMul(d1, d6)); + const FloatV vb = V3Dot(n, cCrossA);//edge region of AC, signed area rac, v = S(rca)/S(abc) for b + const BoolV con50 = FIsGrtr(zero, vb); + const BoolV con51 = FIsGrtrOrEq(d2, zero); + const BoolV con52 = FIsGrtr(zero, d6); + const BoolV con5 = BAnd(con50, BAnd(con51, con52)); + if(BAllEqTTTT(con5)) + { + //Edge 20 + fc = FC_EDGE20; + const FloatV tScale = FDiv(d2, FSub(d2, d6)); + const Vec3V closest5 = V3ScaleAdd(ac, tScale, a);//V3Add(a, V3Scale(ac, tScale)); + const Vec3V vv = V3Sub(p, closest5); + closestP = closest5; + return V3Dot(vv, vv); + } + + fc = FC_FACE; + + //P must project inside face region. Compute Q using Barycentric coordinates + const FloatV nn = V3Dot(n, n); + const FloatV t = FDiv(V3Dot(n, V3Sub(a, p)), nn); + const Vec3V vv = V3Scale(n, t); + closestP = V3Add(p, vv); + return V3Dot(vv, vv); +} + +bool Gu::PCMSphereVsMeshContactGeneration::processTriangle(const PxVec3* verts, PxU32 triangleIndex, PxU8 triFlags, const PxU32* vertInds) +{ + const FloatV zero = FZero(); + + const Vec3V v0 = V3LoadU(verts[0]); + const Vec3V v1 = V3LoadU(verts[1]); + const Vec3V v2 = V3LoadU(verts[2]); + + const Vec3V v10 = V3Sub(v1, v0); + const Vec3V v20 = V3Sub(v2, v0); + + const Vec3V n = V3Normalize(V3Cross(v10, v20));//(p1 - p0).cross(p2 - p0).getNormalized(); + const FloatV d = V3Dot(v0, n);//d = -p0.dot(n); + + const FloatV dist0 = FSub(V3Dot(mSphereCenter, n), d);//p.dot(n) + d; + + // Backface culling + if(FAllGrtr(zero, dist0)) + return false; + + Vec3V closestP; + //mSphereCenter will be in the local space of the triangle mesh + FeatureCode fc; + FloatV sqDist = pcmDistancePointTriangleSquared(mSphereCenter, v0, v1, v2, closestP, fc); + + //sphere overlap with triangles + if (FAllGrtr(mSqInflatedSphereRadius, sqDist)) + { + //sphere center is on the triangle surface, we take triangle normal as the patchNormal. Otherwise, we need to calculate the patchNormal + if(fc==FC_FACE) + { + const Vec3V patchNormal = n; + + const FloatV dist = FSqrt(sqDist); + + mEdgeCache.addData(CachedEdge(vertInds[0], vertInds[1])); + mEdgeCache.addData(CachedEdge(vertInds[1], vertInds[2])); + mEdgeCache.addData(CachedEdge(vertInds[2], vertInds[0])); + + mVertexCache.addData(CachedVertex(vertInds[0])); + mVertexCache.addData(CachedVertex(vertInds[1])); + mVertexCache.addData(CachedVertex(vertInds[2])); + + addToPatch(closestP, patchNormal, dist, triangleIndex); + } + else + { + const Vec3V patchNormal = V3Normalize(V3Sub(mSphereCenter, closestP)); + + //ML : defer the contacts generation + const PxU32 nb = sizeof(PCMDeferredPolyData) / sizeof(PxU32); + PxU32 newSize = nb + mDeferredContacts->size(); + if(mDeferredContacts->capacity() < newSize) + mDeferredContacts->reserve(2*(newSize+1)); + PCMDeferredPolyData* PX_RESTRICT data = reinterpret_cast(mDeferredContacts->end()); + mDeferredContacts->forceSize_Unsafe(newSize); + + SortedTriangle sortedTriangle; + sortedTriangle.mSquareDist = sqDist; + sortedTriangle.mIndex = mSortedTriangle.size(); + mSortedTriangle.pushBack(sortedTriangle); + + data->mTriangleIndex = triangleIndex; + data->mFeatureIndex = fc; + data->triFlags32 = PxU32(triFlags); + data->mInds[0] = vertInds[0]; + data->mInds[1] = vertInds[1]; + data->mInds[2] = vertInds[2]; + V3StoreU(closestP, data->mVerts[0]); + V3StoreU(patchNormal, data->mVerts[1]); + V3StoreU(V3Splat(sqDist), data->mVerts[2]); + } + } + return true; +} + +void Gu::PCMSphereVsMeshContactGeneration::addToPatch(const aos::Vec3VArg contactP, const aos::Vec3VArg patchNormal, const aos::FloatV dist, + const PxU32 triangleIndex) +{ + PX_ASSERT(mNumContactPatch < PCM_MAX_CONTACTPATCH_SIZE); + + const Vec3V sphereCenter = V3Zero(); // in sphere local space + + bool foundPatch = false; + if (mNumContactPatch > 0) + { + if (FAllGrtr(V3Dot(mContactPatch[mNumContactPatch - 1].mPatchNormal, patchNormal), mAcceptanceEpsilon)) + { + PCMContactPatch& patch = mContactPatch[mNumContactPatch - 1]; + + PX_ASSERT((patch.mEndIndex - patch.mStartIndex) == 1); + + if (FAllGrtr(patch.mPatchMaxPen, dist)) + { + //overwrite the old contact + mManifoldContacts[patch.mStartIndex].mLocalPointA = sphereCenter;//in sphere's space + mManifoldContacts[patch.mStartIndex].mLocalPointB = contactP; + mManifoldContacts[patch.mStartIndex].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(patchNormal), dist); + mManifoldContacts[patch.mStartIndex].mFaceIndex = triangleIndex; + patch.mPatchMaxPen = dist; + } + + foundPatch = true; + } + } + if (!foundPatch) + { + mManifoldContacts[mNumContacts].mLocalPointA = sphereCenter;//in sphere's space + mManifoldContacts[mNumContacts].mLocalPointB = contactP; + mManifoldContacts[mNumContacts].mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(patchNormal), dist); + mManifoldContacts[mNumContacts++].mFaceIndex = triangleIndex; + + mContactPatch[mNumContactPatch].mStartIndex = mNumContacts - 1; + mContactPatch[mNumContactPatch].mEndIndex = mNumContacts; + mContactPatch[mNumContactPatch].mPatchMaxPen = dist; + mContactPatch[mNumContactPatch++].mPatchNormal = patchNormal; + } + + PX_ASSERT(mNumContactPatch < PCM_MAX_CONTACTPATCH_SIZE); + + if (mNumContacts >= 16) + { + PX_ASSERT(mNumContacts <= 64); + processContacts(GU_SPHERE_MANIFOLD_CACHE_SIZE); + } +} + +void Gu::PCMSphereVsMeshContactGeneration::generateLastContacts() +{ + // Process delayed contacts + PxU32 nbSortedTriangle = mSortedTriangle.size(); + + if (nbSortedTriangle) + { + PxSort(mSortedTriangle.begin(), mSortedTriangle.size(), PxLess()); + + const PCMDeferredPolyData* PX_RESTRICT cd = reinterpret_cast(mDeferredContacts->begin()); + + for (PxU32 i = 0; i < nbSortedTriangle; ++i) + { + const PCMDeferredPolyData& currentContact = cd[mSortedTriangle[i].mIndex]; + const PxU32 ref0 = currentContact.mInds[0]; + const PxU32 ref1 = currentContact.mInds[1]; + const PxU32 ref2 = currentContact.mInds[2]; + + //if addData sucessful, which means mEdgeCache doesn't have the edge + const bool noEdge01 = mEdgeCache.addData(CachedEdge(ref0, ref1)); + const bool noEdge12 = mEdgeCache.addData(CachedEdge(ref1, ref2)); + const bool noEdge20 = mEdgeCache.addData(CachedEdge(ref2, ref0)); + + const bool noVertex0 = mVertexCache.addData(CachedVertex(ref0)); + const bool noVertex1 = mVertexCache.addData(CachedVertex(ref1)); + const bool noVertex2 = mVertexCache.addData(CachedVertex(ref2)); + + bool needsProcessing = false; + { + switch(currentContact.mFeatureIndex) + { + case FC_VERTEX0: + needsProcessing = noVertex0; + break; + + case FC_VERTEX1: + needsProcessing = noVertex1; + break; + + case FC_VERTEX2: + needsProcessing = noVertex2; + break; + + case FC_EDGE01: + needsProcessing = noEdge01; + break; + + case FC_EDGE12: + needsProcessing = noEdge12; + break; + + case FC_EDGE20: + needsProcessing = noEdge20; + break; + + case FC_FACE: + case FC_UNDEFINED: + PX_ASSERT(0); // PT: should not be possible + break; + }; + } + + if (needsProcessing) + { + //we store the contact, patch normal and sq distance in the vertex memory in PCMDeferredPolyData + const Vec3V contactP = V3LoadU(currentContact.mVerts[0]); + const Vec3V patchNormal = V3LoadU(currentContact.mVerts[1]); + const FloatV sqDist = FLoad(currentContact.mVerts[2].x); + const FloatV dist = FSqrt(sqDist); + addToPatch(contactP, patchNormal, dist, currentContact.mTriangleIndex); + } + } + } +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp new file mode 100644 index 0000000..092e7fa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSpherePlane.cpp @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "foundation/PxVecTransform.h" +#include "GuContactMethodImpl.h" + +using namespace physx; + +bool Gu::pcmContactSpherePlane(GU_CONTACT_METHOD_ARGS) +{ + using namespace aos; + PX_UNUSED(renderOutput); + PX_UNUSED(cache); + PX_UNUSED(shape1); + + // Get actual shape data + const PxSphereGeometry& shapeSphere = checkedCast(shape0); + + //sphere transform + const Vec3V p0 = V3LoadU_SafeReadW(transform0.p); // PT: safe because 'mRefCount' follows 'mTransform' in PxsTransform + + //plane transform + const Vec3V p1 = V3LoadU_SafeReadW(transform1.p); // PT: safe because 'mRefCount' follows 'mTransform' in PxsTransform + const QuatV q1 = QuatVLoadU(&transform1.q.x); + + const FloatV radius = FLoad(shapeSphere.radius); + const FloatV contactDist = FLoad(params.mContactDistance); + + const PxTransformV transf1(p1, q1); + //Sphere in plane space + const Vec3V sphereCenterInPlaneSpace = transf1.transformInv(p0); + + //Separation + const FloatV separation = FSub(V3GetX(sphereCenterInPlaneSpace), radius); + + if(FAllGrtrOrEq(contactDist, separation)) + { + //get the plane normal + const Vec3V worldNormal = QuatGetBasisVector0(q1); + const Vec3V worldPoint = V3NegScaleSub(worldNormal, radius, p0); + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + //Fast allign store + V4StoreA(Vec4V_From_Vec3V(worldNormal), &contact.normal.x); + V4StoreA(Vec4V_From_Vec3V(worldPoint), &contact.point.x); + FStore(separation, &contact.separation); + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + + return true; + } + return false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp new file mode 100644 index 0000000..d250c83 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMContactSphereSphere.cpp @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geomutils/PxContactBuffer.h" +#include "GuContactMethodImpl.h" +#include "foundation/PxVecTransform.h" + +using namespace physx; + +bool Gu::pcmContactSphereSphere(GU_CONTACT_METHOD_ARGS) +{ + PX_UNUSED(cache); + PX_UNUSED(renderOutput); + + using namespace aos; + const PxSphereGeometry& shapeSphere0 = checkedCast(shape0); + const PxSphereGeometry& shapeSphere1 = checkedCast(shape1); + + const FloatV cDist = FLoad(params.mContactDistance); + const Vec3V p0 = V3LoadA(&transform0.p.x); + const Vec3V p1 = V3LoadA(&transform1.p.x); + + const FloatV r0 = FLoad(shapeSphere0.radius); + const FloatV r1 = FLoad(shapeSphere1.radius); + + const Vec3V _delta = V3Sub(p0, p1); + const FloatV distanceSq = V3Dot(_delta, _delta); + const FloatV radiusSum = FAdd(r0, r1); + const FloatV inflatedSum = FAdd(radiusSum, cDist); + + if(FAllGrtr(FMul(inflatedSum, inflatedSum), distanceSq)) + { + const FloatV eps = FLoad(0.00001f); + const FloatV dist = FSqrt(distanceSq); + const BoolV bCon = FIsGrtrOrEq(eps, dist); + const Vec3V normal = V3Sel(bCon, V3UnitX(), V3ScaleInv(_delta, dist)); + const Vec3V point = V3ScaleAdd(normal, r1, p1); + const FloatV pen = FSub(dist, radiusSum); + + PX_ASSERT(contactBuffer.count < PxContactBuffer::MAX_CONTACTS); + PxContactPoint& contact = contactBuffer.contacts[contactBuffer.count++]; + V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x); + V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x); + FStore(pen, &contact.separation); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + + return true; + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp new file mode 100644 index 0000000..33002c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.cpp @@ -0,0 +1,213 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPCMShapeConvex.h" +#include "GuVecConvexHull.h" +#include "GuPCMContactGen.h" +#include "common/PxRenderOutput.h" + +using namespace physx; +using namespace Gu; + +namespace physx +{ +namespace Gu +{ + const PxU8 gPCMBoxPolygonData[24] = + { + 0, 3, 2, 1, + 1, 2, 6, 5, + 5, 6, 7, 4, + 4, 7, 3, 0, + 3, 7, 6, 2, + 4, 0, 1, 5, + }; + + Gu::PCMPolygonalBox::PCMPolygonalBox(const PxVec3& halfSide) : mHalfSide(halfSide) + { + //Precompute the convex data + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + PxVec3 minimum = -mHalfSide; + PxVec3 maximum = mHalfSide; + // Generate 8 corners of the bbox + mVertices[0] = PxVec3(minimum.x, minimum.y, minimum.z); + mVertices[1] = PxVec3(maximum.x, minimum.y, minimum.z); + mVertices[2] = PxVec3(maximum.x, maximum.y, minimum.z); + mVertices[3] = PxVec3(minimum.x, maximum.y, minimum.z); + mVertices[4] = PxVec3(minimum.x, minimum.y, maximum.z); + mVertices[5] = PxVec3(maximum.x, minimum.y, maximum.z); + mVertices[6] = PxVec3(maximum.x, maximum.y, maximum.z); + mVertices[7] = PxVec3(minimum.x, maximum.y, maximum.z); + + //Setup the polygons + for(PxU8 i=0; i < 6; i++) + { + mPolygons[i].mNbVerts = 4; + mPolygons[i].mVRef8 = PxU16(i*4); + } + + // ### planes needs *very* careful checks + // X axis + mPolygons[1].mPlane.n = PxVec3(1.0f, 0.0f, 0.0f); + mPolygons[1].mPlane.d = -mHalfSide.x; + mPolygons[3].mPlane.n = PxVec3(-1.0f, 0.0f, 0.0f); + mPolygons[3].mPlane.d = -mHalfSide.x; + + mPolygons[1].mMinIndex = 0; + mPolygons[3].mMinIndex = 1; + + PX_ASSERT(mPolygons[1].getMin(mVertices) == -mHalfSide.x); + PX_ASSERT(mPolygons[3].getMin(mVertices) == -mHalfSide.x); + + + // Y axis + mPolygons[4].mPlane.n = PxVec3(0.f, 1.0f, 0.0f); + mPolygons[4].mPlane.d = -mHalfSide.y; + mPolygons[5].mPlane.n = PxVec3(0.0f, -1.0f, 0.0f); + mPolygons[5].mPlane.d = -mHalfSide.y; + + mPolygons[4].mMinIndex = 0; + mPolygons[5].mMinIndex = 2; + + + PX_ASSERT(mPolygons[4].getMin(mVertices) == -mHalfSide.y); + PX_ASSERT(mPolygons[5].getMin(mVertices) == -mHalfSide.y); + + // Z axis + mPolygons[2].mPlane.n = PxVec3(0.f, 0.0f, 1.0f); + mPolygons[2].mPlane.d = -mHalfSide.z; + mPolygons[0].mPlane.n = PxVec3(0.0f, 0.0f, -1.0f); + mPolygons[0].mPlane.d = -mHalfSide.z; + + mPolygons[2].mMinIndex = 0; + mPolygons[0].mMinIndex = 4; + PX_ASSERT(mPolygons[2].getMin(mVertices) == -mHalfSide.z); + PX_ASSERT(mPolygons[0].getMin(mVertices) == -mHalfSide.z); + } + + void Gu::PCMPolygonalBox::getPolygonalData(Gu::PolygonalData* PX_RESTRICT dst) const + { + dst->mCenter = PxVec3(0.0f, 0.0f, 0.0f); + dst->mNbVerts = 8; + dst->mNbPolygons = 6; + dst->mPolygons = mPolygons; + dst->mNbEdges = 0; + dst->mVerts = mVertices; + dst->mPolygonVertexRefs = gPCMBoxPolygonData; + dst->mFacesByEdges = NULL; + dst->mVerticesByEdges = NULL; + + dst->mBigData = NULL; + + dst->mInternal.mRadius = 0.0f; + dst->mInternal.mExtents[0] = mHalfSide.x; + dst->mInternal.mExtents[1] = mHalfSide.y; + dst->mInternal.mExtents[2] = mHalfSide.z; + + dst->mScale = PxMeshScale(); + } + + static void getPCMPolygonalData_Convex(Gu::PolygonalData* PX_RESTRICT dst, const Gu::ConvexHullData* PX_RESTRICT src, + const aos::Mat33V& vertexToShape) + { + using namespace aos; + const Vec3V vertexSpaceCenterOfMass = V3LoadU(src->mCenterOfMass); + const Vec3V shapeSpaceCenterOfMass = M33MulV3(vertexToShape, vertexSpaceCenterOfMass); + V3StoreU(shapeSpaceCenterOfMass, dst->mCenter); + dst->mNbVerts = src->mNbHullVertices; + dst->mNbPolygons = src->mNbPolygons; + dst->mNbEdges = src->mNbEdges; + dst->mPolygons = src->mPolygons; + dst->mVerts = src->getHullVertices(); + dst->mPolygonVertexRefs = src->getVertexData8(); + dst->mFacesByEdges = src->getFacesByEdges8(); + dst->mVerticesByEdges = src->getVerticesByEdges16(); + + dst->mBigData = src->mBigConvexRawData; + + dst->mInternal = src->mInternal; + + dst->mScale = PxMeshScale(); + } + + static void getPCMPolygonalData_Convex(Gu::PolygonalData* PX_RESTRICT dst, const Gu::ConvexHullData* PX_RESTRICT src, + const Cm::FastVertex2ShapeScaling& scaling, const PxMeshScale& convexScale) + { + dst->mCenter = scaling * src->mCenterOfMass; + dst->mNbVerts = src->mNbHullVertices; + dst->mNbPolygons = src->mNbPolygons; + dst->mNbEdges = src->mNbEdges; + dst->mPolygons = src->mPolygons; + dst->mVerts = src->getHullVertices(); + dst->mPolygonVertexRefs = src->getVertexData8(); + dst->mFacesByEdges = src->getFacesByEdges8(); + dst->mVerticesByEdges = src->getVerticesByEdges16(); + + dst->mBigData = src->mBigConvexRawData; + dst->mInternal = src->mInternal; + dst->mScale = convexScale; + } + + void getPCMConvexData(const Gu::ConvexHullV& convexHull, const bool idtScale, PolygonalData& polyData) + { + + PX_ASSERT(!convexHull.hullData->mAABB.isEmpty()); + + //this is used to calculate the convex hull's center of mass + getPCMPolygonalData_Convex(&polyData, convexHull.hullData, convexHull.vertex2Shape); + + if(!idtScale) + polyData.mInternal.reset(); + } + + bool getPCMConvexData(const PxConvexMeshGeometry& shapeConvex, Cm::FastVertex2ShapeScaling& scaling, PxBounds3& bounds, PolygonalData& polyData) + { + const bool idtScale = shapeConvex.scale.isIdentity(); + if(!idtScale) + scaling.init(shapeConvex.scale); + + const ConvexHullData* hullData = _getHullData(shapeConvex); + PX_ASSERT(!hullData->mAABB.isEmpty()); + bounds = hullData->mAABB.transformFast(scaling.getVertex2ShapeSkew()); + + getPCMPolygonalData_Convex(&polyData, hullData, scaling, shapeConvex.scale); + + return idtScale; + } + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.h new file mode 100644 index 0000000..630ea48 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMShapeConvex.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_SHAPE_CONVEX_H +#define GU_PCM_SHAPE_CONVEX_H + +#include "GuConvexSupportTable.h" +#include "GuPersistentContactManifold.h" +#include "GuShapeConvex.h" + +namespace physx +{ + class PxConvexMeshGeometry; + +namespace Gu +{ + extern const PxU8 gPCMBoxPolygonData[24]; + + class PCMPolygonalBox + { + public: + PCMPolygonalBox(const PxVec3& halfSide); + + void getPolygonalData(Gu::PolygonalData* PX_RESTRICT dst) const; + + const PxVec3& mHalfSide; + PxVec3 mVertices[8]; + Gu::HullPolygonData mPolygons[6]; + private: + PCMPolygonalBox& operator=(const PCMPolygonalBox&); + }; + + void getPCMConvexData(const Gu::ConvexHullV& convexHull, const bool idtScale, Gu::PolygonalData& polyData); + bool getPCMConvexData(const PxConvexMeshGeometry& shapeConvex, Cm::FastVertex2ShapeScaling& scaling, PxBounds3& bounds, Gu::PolygonalData& polyData); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp new file mode 100644 index 0000000..6347872 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.cpp @@ -0,0 +1,1269 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPCMTriangleContactGen.h" +#include "GuPCMContactConvexCommon.h" +#include "GuVecTriangle.h" +#include "GuBarycentricCoordinates.h" +#include "GuConvexEdgeFlags.h" +#include "foundation/PxAlloca.h" + +#if PCM_LOW_LEVEL_DEBUG +#include "common/PxRenderBuffer.h" +#endif + +#define EDGE_EDGE_GAUSS_MAP 0 +#define BRUTE_FORCE_EDGE_EDGE 0 + +using namespace physx; +using namespace Gu; +using namespace aos; + +namespace physx +{ + static bool testPolyFaceNormal(const Gu::TriangleV& triangle, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, PxU32& feature, Vec3V& faceNormal, const FeatureStatus faceStatus, FeatureStatus& status) + { + PX_UNUSED(triangle); + + FloatV _minOverlap = FMax(); + PxU32 _feature = 0; + Vec3V _faceNormal = faceNormal; + FloatV min0, max0; + FloatV min1, max1; + const FloatV eps = FEps(); + + if(polyMap->isIdentityScale) + { + //in the local space of polyData0 + for(PxU32 i=0; idoSupport(planeNormal, min1, max1); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if(FAllGrtr(_minOverlap, tempOverlap)) + { + _minOverlap = tempOverlap; + _feature = i; + _faceNormal = planeNormal; + } + } + } + else + { + + //in the local space of polyData0 + for(PxU32 i=0; ishape2Vertex, vertexSpacePlaneNormal); + + const FloatV magnitude = FRsqrtFast(V3LengthSq(shapeSpacePlaneNormal)); //FRecip(V3Length(shapeSpacePlaneNormal)); + + //ML::avoid lHS, don't use the exiting function + min0 = FMul(V3Dot(vertexSpacePlaneNormal, minVert), magnitude); + max0 = FMul(FNeg(planeDist), magnitude); + + //normalize the shapeSpacePlaneNormal + const Vec3V planeN = V3Scale(shapeSpacePlaneNormal, magnitude); + + triMap->doSupport(planeN, min1, max1); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if(FAllGrtr(_minOverlap, tempOverlap)) + { + _minOverlap = tempOverlap; + _feature = i; + _faceNormal = planeN; + } + } + } + + if(FAllGrtr(minOverlap, FAdd(_minOverlap, eps))) + { + faceNormal = _faceNormal; + minOverlap = _minOverlap; + status = faceStatus; + } + + feature = _feature; + + return true; + + } + + + + //triangle is in the local space of polyData + static bool testTriangleFaceNormal(const TriangleV& triangle, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, PxU32& feature, Vec3V& faceNormal, const FeatureStatus faceStatus, FeatureStatus& status) + { + PX_UNUSED(triMap); + PX_UNUSED(polyData); + + FloatV min1, max1; + const FloatV eps = FEps(); + + const Vec3V triangleLocNormal = triangle.normal(); + + const FloatV min0 = V3Dot(triangleLocNormal, triangle.verts[0]); + const FloatV max0 = min0; + + //triangle normal is in the vertex space + polyMap->doSupport(triangleLocNormal, min1, max1); + + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + + if(BAllEqTTTT(con)) + return false; + + minOverlap = FSub(FSub(max0, min1), eps); + status = faceStatus; + feature = 0; + faceNormal=triangleLocNormal; + + return true; + + } + + static bool testPolyEdgeNormal(const TriangleV& triangle, const PxU8 triFlags, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, Vec3V& minNormal, const FeatureStatus edgeStatus, FeatureStatus& status) + { + PX_UNUSED(triFlags); + FloatV overlap = minOverlap; + FloatV min0, max0; + FloatV min1, max1; + const FloatV zero = FZero(); + const Vec3V eps2 = V3Splat(FLoad(1e-6f)); + + const Vec3V v0 = M33MulV3(polyMap->shape2Vertex, triangle.verts[0]); + const Vec3V v1 = M33MulV3(polyMap->shape2Vertex, triangle.verts[1]); + const Vec3V v2 = M33MulV3(polyMap->shape2Vertex, triangle.verts[2]); + + TriangleV vertexSpaceTriangle(v0, v1, v2); + + PxU32 nbTriangleAxes = 0; + Vec3V triangleAxes[3]; + for(PxI8 kStart = 0, kEnd =2; kStart<3; kEnd = kStart++) + { + bool active = (triFlags & (1 << (kEnd+3))) != 0; + + if(active) + { + const Vec3V p00 = vertexSpaceTriangle.verts[kStart]; + const Vec3V p01 = vertexSpaceTriangle.verts[kEnd]; + triangleAxes[nbTriangleAxes++] = V3Sub(p01, p00); + } + } + + if(nbTriangleAxes == 0) + return true; + + //create localTriPlane in the vertex space + const Vec3V vertexSpaceTriangleNormal = vertexSpaceTriangle.normal(); + + for(PxU32 i =0; ishape2Vertex, v); + const Vec3V n0 = V3Normalize(shapeSpaceV); + triMap->doSupport(n0, min0, max0); + polyMap->doSupport(n0, min1, max1); + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + if (BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap0 = FSub(max0, min1); + const FloatV tempOverlap1 = FSub(max1, min0); + + if (FAllGrtr(overlap, tempOverlap0)) + { + overlap = tempOverlap0; + minNormal = n0; + status = edgeStatus; + } + + if (FAllGrtr(overlap, tempOverlap1)) + { + overlap = tempOverlap1; + minNormal = V3Neg(n0); + status = edgeStatus; + } + + } + } + + } + } + minOverlap = overlap; + + return true; + + } + +#if BRUTE_FORCE_EDGE_EDGE + + + bool testPolyEdgeNormalBruteForce(const TriangleV& triangle, const PxU8 triFlags, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, Vec3V& minNormal, const FeatureStatus edgeStatus, FeatureStatus& status) + { + PX_UNUSED(triFlags); + FloatV min0, max0; + FloatV min1, max1; + + FloatV bestDist = FLoad(PX_MAX_F32); + Vec3V bestAxis = V3Zero(); + + const Vec3V eps2 = V3Splat(FLoad(1e-6)); + + PxU32 bestPolyIndex = 0; + PxU32 bestStart = 0; + PxU32 bestEnd = 0; + PxI8 bestTriStart = 0; + PxI8 bestTriEnd = 0; + + for(PxU32 i =0; ivertex2Shape, p10); + const Vec3V vertex11 = M33MulV3(polyMap->vertex2Shape, p11); + + const Vec3V convexEdge = V3Sub(vertex11, vertex10); + + for (PxI8 kEnd = 0, kStart = 2; kEnd<3; kStart = kEnd++) + { + + const Vec3V triVert0 = triangle.verts[kStart]; + const Vec3V triVert1 = triangle.verts[kEnd]; + + const Vec3V triangleEdge = V3Sub(triVert1, triVert0); + const Vec3V v = V3Cross(convexEdge, triangleEdge); + + if (!V3AllGrtr(eps2, V3Abs(v))) + { + //transform the v back to the shape space + const Vec3V n0 = V3Normalize(v); + triMap->doSupport(n0, min0, max0); + polyMap->doSupport(n0, min1, max1); + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + if(BAllEqTTTT(con)) + return false; + + const FloatV tempOverlap = FSub(max0, min1); + + if (FAllGrtr(bestDist, tempOverlap)) + { + bestDist = tempOverlap; + bestAxis = n0; + bestPolyIndex = i; + bestStart = lStart; + bestEnd = lEnd; + bestTriStart = kStart; + bestTriEnd = kEnd; + } + + } + } + } + } + + if (FAllGrtr(minOverlap, bestDist)) + { + minOverlap = bestDist; + minNormal = bestAxis; + status = edgeStatus; + } + + return true; + + } + + bool testPolyEdgeNormalBruteForceVertsByEdges(const TriangleV& triangle, const PxU8 triFlags, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, Vec3V& minNormal, const FeatureStatus edgeStatus, FeatureStatus& status, PxU32& bestEdgeIndex, PxI8& bestTriStart, PxI8& bestTriEnd) + { + + PX_UNUSED(triFlags); + + const PxU32 numConvexEdges = polyData.mNbEdges; + const PxU16* verticesByEdges16 = polyData.mVerticesByEdges; + const PxVec3* vertices = polyData.mVerts; + + FloatV bestDist = FLoad(PX_MAX_F32); + Vec3V bestAxis = V3Zero(); + const Vec3V eps2 = V3Splat(FLoad(1e-6)); + + for (PxU32 convexEdgeIdx = 0; convexEdgeIdx < numConvexEdges; ++convexEdgeIdx) + { + const PxU16 v0idx1 = verticesByEdges16[convexEdgeIdx * 2]; + const PxU32 v1idx1 = verticesByEdges16[convexEdgeIdx * 2 + 1]; + + //shape sapce + const Vec3V vertex10 = M33MulV3(polyMap->vertex2Shape, V3LoadU(vertices[v0idx1])); + const Vec3V vertex11 = M33MulV3(polyMap->vertex2Shape, V3LoadU(vertices[v1idx1])); + + Vec3V convexEdge = V3Sub(vertex11, vertex10); + + + for (PxI8 kEnd = 0, kStart = 2; kEnd<3; kStart = kEnd++) + { + const Vec3V triVert0 = triangle.verts[kStart]; + const Vec3V triVert1 = triangle.verts[kEnd]; + const Vec3V triEdge = V3Sub(triVert1, triVert0); + + // compute the separation along this axis in vertex space + Vec3V axis = V3Cross(convexEdge, triEdge); + + if (!V3AllGrtr(eps2, V3Abs(axis))) + { + axis = V3Normalize(axis); + + FloatV min0, max0; + FloatV min1, max1; + triMap->doSupport(axis, min0, max0); + polyMap->doSupport(axis, min1, max1); + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + if (BAllEqTTTT(con)) + return false; + + const FloatV dist0 = FSub(max0, min1); + const FloatV dist1 = FSub(max1, min0); + + if (FAllGrtr(dist0, dist1)) + axis = V3Neg(axis); + + const FloatV dist = FMin(dist0, dist1); + + if (FAllGrtr(bestDist, dist)) + { + bestDist = dist; + bestAxis = axis; + + bestEdgeIndex = convexEdgeIdx; + bestTriStart = kStart; + bestTriEnd = kEnd; + } + } + } + + } + + if (FAllGrtr(minOverlap, bestDist)) + { + minOverlap = bestDist; + minNormal = bestAxis; + status = edgeStatus; + + } + return true; + + } + + +#endif + +#if EDGE_EDGE_GAUSS_MAP + + + + bool isMinkowskiFace(const Vec3V& A, const Vec3V& B, const Vec3V& B_x_A, const Vec3V& C, const Vec3V& D, const Vec3V& D_x_C) + { + + const FloatV zero = FZero(); + // Two edges build a face on the Minkowski sum if the associated arcs AB and CD intersect on the Gauss map. + // The associated arcs are defined by the adjacent face normals of each edge. + const FloatV CBA = V3Dot(C, B_x_A); + const FloatV DBA = V3Dot(D, B_x_A); + const FloatV ADC = V3Dot(A, D_x_C); + const FloatV BDC = V3Dot(B, D_x_C); + + const BoolV con0 = FIsGrtrOrEq(zero, FMul(CBA, DBA)); + const BoolV con1 = FIsGrtrOrEq(zero, FMul(ADC, BDC)); + const BoolV con2 = FIsGrtr(FMul(CBA, BDC), zero); + + const BoolV con = BAnd(con2, BAnd(con0, con1)); + + return (BAllEqTTTT(con) != 0); + + //return CBA * DBA < 0.0f && ADC * BDC < 0.0f && CBA * BDC > 0.0f; + } + +#define SAT_VARIFY 0 + + bool testPolyEdgeNormalGaussMap(const TriangleV& triangle, const PxU8 triFlags, const PolygonalData& polyData, SupportLocalImpl* triMap, SupportLocal* polyMap, const FloatVArg contactDist, + FloatV& minOverlap, Vec3V& minNormal, const FeatureStatus edgeStatus, FeatureStatus& status, PxU32& gaussMapBestEdgeIndex, PxI8& gaussMapBestTriStart, PxI8& gaussMapBestTriEnd) + { + + PX_UNUSED(triFlags); + const FloatV zero = FZero(); + + const Vec3V triNormal = triangle.normal(); + + const PxU32 numConvexEdges = polyData.mNbEdges; + const PxU16* verticesByEdges16 = polyData.mVerticesByEdges; + const PxU8* facesByEdges8 = polyData.mFacesByEdges; + const PxVec3* vertices = polyData.mVerts; + + FloatV bestDist = FLoad(-PX_MAX_F32); + Vec3V axis = V3Zero(); + Vec3V bestAxis = V3Zero(); + const Vec3V eps2 = V3Splat(FLoad(1e-6)); + + + //Center is in shape space + const Vec3V shapeSpaceCOM =V3LoadU(polyData.mCenter); + const Vec3V vertexSpaceCOM = M33MulV3(polyMap->shape2Vertex, shapeSpaceCOM); + + PxVec3 vertexCOM; + V3StoreU(vertexSpaceCOM, vertexCOM); + + for (PxU32 convexEdgeIdx = 0; convexEdgeIdx < numConvexEdges; ++convexEdgeIdx) + { + + const PxU16 v0idx1 = verticesByEdges16[convexEdgeIdx*2]; + const PxU32 v1idx1 = verticesByEdges16[convexEdgeIdx * 2 + 1]; + + const PxU8 f10 = facesByEdges8[convexEdgeIdx * 2]; + const PxU8 f11 = facesByEdges8[convexEdgeIdx * 2 + 1]; + + //shape sapce + const Vec3V vertex10 = M33MulV3(polyMap->vertex2Shape, V3LoadU(vertices[v0idx1])); + const Vec3V vertex11 = M33MulV3(polyMap->vertex2Shape, V3LoadU(vertices[v1idx1])); + + Vec3V convexEdge = V3Sub(vertex11, vertex10); + + const Gu::HullPolygonData& face0 = polyData.mPolygons[f10]; + const Gu::HullPolygonData& face1 = polyData.mPolygons[f11]; + + const Vec3V convexNormal0 = M33TrnspsMulV3(polyMap->shape2Vertex, V3LoadU(face0.mPlane.n)); + const Vec3V convexNormal1 = M33TrnspsMulV3(polyMap->shape2Vertex, V3LoadU(face1.mPlane.n)); + + float signDist0 = face0.mPlane.distance(vertexCOM); + float signDist1 = face1.mPlane.distance(vertexCOM); + + PX_ASSERT(signDist0 < 0.f); + PX_ASSERT(signDist1 < 0.f); + + for (PxI8 kEnd = 0, kStart = 2; kEnd<3; kStart = kEnd++) + { + + const Vec3V triVert0 = triangle.verts[kStart]; + const Vec3V triVert1 = triangle.verts[kEnd]; + const Vec3V triEdge = V3Sub(triVert1, triVert0); + + //if (isMinkowskiFace(convexNormal0, convexNormal1, V3Neg(convexEdge), V3Neg(triNormal), triNormal, V3Neg(triEdge))) + if (isMinkowskiFace(convexNormal0, convexNormal1, convexEdge, V3Neg(triNormal), triNormal, triEdge)) + { + + // compute the separation along this axis in vertex space + axis = V3Cross(convexEdge, triEdge); + + if (!V3AllGrtr(eps2, V3Abs(axis))) + { + axis = V3Normalize(axis); + + const Vec3V v = V3Sub(vertex10, shapeSpaceCOM); + + // ensure the axis is outward pointing on the edge on the minkowski sum. Assure normal points from convex hull to triangle + const FloatV temp = V3Dot(axis, v); + if (FAllGrtr(zero, temp)) + axis = V3Neg(axis); + + //compute the distance from any of the verts in the triangle to plane(axis, vertex10)(n.dot(p-a)) + const Vec3V ap = V3Sub(triVert0, vertex10); + + const FloatV dist = V3Dot(axis, ap); + + if (FAllGrtr(dist, contactDist)) + return false; + +#if SAT_VARIFY + FloatV min0, max0; + FloatV min1, max1; + triMap->doSupport(V3Neg(axis), min0, max0); + polyMap->doSupport(V3Neg(axis), min1, max1); + const BoolV con = BOr(FIsGrtr(min1, FAdd(max0, contactDist)), FIsGrtr(min0, FAdd(max1, contactDist))); + if (BAllEqTTTT(con)) + return false; + + /*const FloatV dist = FSub(max0, min1); + + if (FAllGrtr(bestDist, dist)) + { + bestDist = dist; + bestAxis = axis; + }*/ + const FloatV tempDist = FSub(max0, min1); + + const FloatV dif = FAbs(FAdd(tempDist, dist)); + PX_UNUSED(dif); + PX_ASSERT(FAllGrtr(FLoad(1e-4f), dif)); + +#endif + + if (FAllGrtr(dist, bestDist)) + { + bestDist = dist; + bestAxis = axis; + + gaussMapBestEdgeIndex = convexEdgeIdx; + gaussMapBestTriStart = kStart; + gaussMapBestTriEnd = kEnd; + } + } + } + } + + } + + if (FAllGrtr(minOverlap, bestDist)) + { + minOverlap = bestDist; + minNormal = bestAxis; + status = edgeStatus; + } + return true; + + } + +#endif + + static PX_FORCE_INLINE PxU32 addMeshContacts(MeshPersistentContact* manifoldContacts, const Vec3V& pA, const Vec3V& pB, const Vec4V& normalPen, const PxU32 triangleIndex, const PxU32 numContacts) + { + manifoldContacts[numContacts].mLocalPointA = pA; + manifoldContacts[numContacts].mLocalPointB = pB; + manifoldContacts[numContacts].mLocalNormalPen = normalPen; + manifoldContacts[numContacts].mFaceIndex = triangleIndex; + return numContacts+1; + } + + + static void generatedTriangleContacts(const Gu::TriangleV& triangle, const PxU32 triangleIndex, const PxU8/* _triFlags*/, const Gu::PolygonalData& polyData1, const Gu::HullPolygonData& incidentPolygon, Gu::SupportLocal* map1, Gu::MeshPersistentContact* manifoldContacts, PxU32& numManifoldContacts, + const aos::FloatVArg contactDist, const aos::Vec3VArg contactNormal, PxRenderOutput* renderOutput) + { + + PX_UNUSED(renderOutput); + using namespace aos; + + //PxU8 triFlags = _triFlags; + const PxU32 previousContacts = numManifoldContacts; + + const FloatV zero = FZero(); + + const Mat33V rot = findRotationMatrixFromZAxis(contactNormal); + + const PxU8* inds1 = polyData1.mPolygonVertexRefs + incidentPolygon.mVRef8; + + Vec3V points0In0[3]; + Vec3V* points1In0 = reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*incidentPolygon.mNbVerts, 16)); + FloatV* points1In0TValue = reinterpret_cast(PxAllocaAligned(sizeof(FloatV)*incidentPolygon.mNbVerts, 16)); + bool* points1In0Penetration = reinterpret_cast(PxAlloca(sizeof(bool)*incidentPolygon.mNbVerts)); + + + points0In0[0] = triangle.verts[0]; + points0In0[1] = triangle.verts[1]; + points0In0[2] = triangle.verts[2]; + + + + //Transform all the verts from vertex space to shape space + map1->populateVerts(inds1, incidentPolygon.mNbVerts, polyData1.mVerts, points1In0); + +#if PCM_LOW_LEVEL_DEBUG + Gu::PersistentContactManifold::drawPolygon(*renderOutput, map1->transform, points1In0, incidentPolygon.mNbVerts, (PxU32)PxDebugColor::eARGB_RED); + //Gu::PersistentContactManifold::drawTriangle(*renderOutput, map1->transform.transform(points1In0[0]), map1->transform.transform(points0In0[1]), map1->transform.transform(points0In0[2]), (PxU32)PxDebugColor::eARGB_BLUE); +#endif + + Vec3V eps = Vec3V_From_FloatV(FEps()); + Vec3V max = Vec3V_From_FloatV(FMax()); + Vec3V nmax = V3Neg(max); + + //transform reference polygon to 2d, calculate min and max + Vec3V rPolygonMin= max; + Vec3V rPolygonMax = nmax; + for(PxU32 i=0; i<3; ++i) + { + points0In0[i] = M33MulV3(rot, points0In0[i]); + rPolygonMin = V3Min(rPolygonMin, points0In0[i]); + rPolygonMax = V3Max(rPolygonMax, points0In0[i]); + } + + + rPolygonMin = V3Sub(rPolygonMin, eps); + rPolygonMax = V3Add(rPolygonMax, eps); + + const FloatV d = V3GetZ(points0In0[0]); + const FloatV rd = FAdd(d, contactDist); + + Vec3V iPolygonMin= max; + Vec3V iPolygonMax = nmax; + + + PxU32 inside = 0; + for(PxU32 i=0; i= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(6) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + } + + points1In0Penetration[i] = penetrated; + } + + + + if(inside == incidentPolygon.mNbVerts) + { + return; + } + + inside = 0; + iPolygonMin = V3Sub(iPolygonMin, eps); + iPolygonMax = V3Add(iPolygonMax, eps); + + const Vec3V incidentNormal = V3Normalize(M33TrnspsMulV3(map1->shape2Vertex, V3LoadU(incidentPolygon.mPlane.n))); + const FloatV iPlaneD = V3Dot(incidentNormal, M33MulV3(map1->vertex2Shape, V3LoadU(polyData1.mVerts[inds1[0]]))); + + for(PxU32 i=0; i<3; ++i) + { + if(contains(points1In0, incidentPolygon.mNbVerts, points0In0[i], iPolygonMin, iPolygonMax)) + { + + inside++; + + const Vec3V vert0 = M33TrnspsMulV3(rot, points0In0[i]); + const FloatV t = FSub(V3Dot(incidentNormal, vert0), iPlaneD); + + if(FAllGrtr(t, contactDist)) + continue; + + + const Vec3V projPoint = V3NegScaleSub(incidentNormal, t, vert0); + + const Vec3V v = V3Sub(projPoint, vert0); + const FloatV t3 = V3Dot(v, contactNormal); + + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(contactNormal), t3); + numManifoldContacts = addMeshContacts(manifoldContacts, projPoint, vert0, localNormalPen, triangleIndex, numManifoldContacts); + + //if the numContacts are more than GU_MESH_CONTACT_REDUCTION_THRESHOLD, we need to do contact reduction + const PxU32 numContacts = numManifoldContacts - previousContacts; + if(numContacts >= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + + } + + + if(inside == 3) + return; + + //(2) segment intesection + for (PxU32 rStart = 0, rEnd = 2; rStart < 3; rEnd = rStart++) + { + + + const Vec3V rpA = points0In0[rStart]; + const Vec3V rpB = points0In0[rEnd]; + + const Vec3V rMin = V3Min(rpA, rpB); + const Vec3V rMax = V3Max(rpA, rpB); + + for (PxU32 iStart = 0, iEnd = PxU32(incidentPolygon.mNbVerts - 1); iStart < incidentPolygon.mNbVerts; iEnd = iStart++) + { + if ((!points1In0Penetration[iStart] && !points1In0Penetration[iEnd]))//|| (points1In0[i].status == POINT_OUTSIDE && points1In0[incidentIndex].status == POINT_OUTSIDE)) + continue; + + const Vec3V ipA = points1In0[iStart]; + const Vec3V ipB = points1In0[iEnd]; + + const Vec3V iMin = V3Min(ipA, ipB); + const Vec3V iMax = V3Max(ipA, ipB); + + const BoolV tempCon = BOr(V3IsGrtr(iMin, rMax), V3IsGrtr(rMin, iMax)); + const BoolV con = BOr(BGetX(tempCon), BGetY(tempCon)); + + if (BAllEqTTTT(con)) + continue; + + FloatV a1 = signed2DTriArea(rpA, rpB, ipA); + FloatV a2 = signed2DTriArea(rpA, rpB, ipB); + + if (FAllGrtr(zero, FMul(a1, a2))) + { + FloatV a3 = signed2DTriArea(ipA, ipB, rpA); + FloatV a4 = signed2DTriArea(ipA, ipB, rpB); + + if (FAllGrtr(zero, FMul(a3, a4))) + { + + //these two segment intersect in 2d + const FloatV t = FMul(a1, FRecip(FSub(a2, a1))); + + const Vec3V ipAOri = V3SetZ(points1In0[iStart], FAdd(points1In0TValue[iStart], d)); + const Vec3V ipBOri = V3SetZ(points1In0[iEnd], FAdd(points1In0TValue[iEnd], d)); + + const Vec3V pBB = V3NegScaleSub(V3Sub(ipBOri, ipAOri), t, ipAOri); + const Vec3V pAA = V3SetZ(pBB, d); + const Vec3V pA = M33TrnspsMulV3(rot, pAA); + const Vec3V pB = M33TrnspsMulV3(rot, pBB); + const FloatV pen = FSub(V3GetZ(pBB), V3GetZ(pAA)); + + if (FAllGrtr(pen, contactDist)) + continue; + + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(contactNormal), pen); + numManifoldContacts = addMeshContacts(manifoldContacts, pB, pA, localNormalPen, triangleIndex, numManifoldContacts); + + //if the numContacts are more than GU_MESH_CONTACT_REDUCTION_THRESHOLD, we need to do contact reduction + const PxU32 numContacts = numManifoldContacts - previousContacts; + if (numContacts >= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + } + } + + } + + } + + + static void generatedPolyContacts(const Gu::PolygonalData& polyData0, const Gu::HullPolygonData& referencePolygon, const Gu::TriangleV& triangle, const PxU32 triangleIndex, const PxU8 triFlags, + Gu::SupportLocal* map0, Gu::MeshPersistentContact* manifoldContacts, PxU32& numManifoldContacts, const aos::FloatVArg contactDist, const aos::Vec3VArg contactNormal, + PxRenderOutput* renderOutput) + { + PX_UNUSED(triFlags); + PX_UNUSED(renderOutput); + + using namespace aos; + + const FloatV zero = FZero(); + + const PxU32 previousContacts = numManifoldContacts; + + const PxU8* inds0 = polyData0.mPolygonVertexRefs + referencePolygon.mVRef8; + + const Vec3V nContactNormal = V3Neg(contactNormal); + + //this is the matrix transform all points to the 2d plane + const Mat33V rot = findRotationMatrixFromZAxis(contactNormal); + + Vec3V* points0In0=reinterpret_cast(PxAllocaAligned(sizeof(Vec3V)*referencePolygon.mNbVerts, 16)); + Vec3V points1In0[3]; + FloatV points1In0TValue[3]; + + bool points1In0Penetration[3]; + + //Transform all the verts from vertex space to shape space + map0->populateVerts(inds0, referencePolygon.mNbVerts, polyData0.mVerts, points0In0); + + points1In0[0] = triangle.verts[0]; + points1In0[1] = triangle.verts[1]; + points1In0[2] = triangle.verts[2]; + + +#if PCM_LOW_LEVEL_DEBUG + Gu::PersistentContactManifold::drawPolygon(*renderOutput, map0->transform, points0In0, referencePolygon.mNbVerts, (PxU32)PxDebugColor::eARGB_GREEN); + //Gu::PersistentContactManifold::drawTriangle(*gRenderOutPut, map0->transform.transform(points1In0[0]), map0->transform.transform(points1In0[1]), map0->transform.transform(points1In0[2]), (PxU32)PxDebugColor::eARGB_BLUE); +#endif + + //the first point in the reference plane + const Vec3V referencePoint = points0In0[0]; + + Vec3V eps = Vec3V_From_FloatV(FEps()); + Vec3V max = Vec3V_From_FloatV(FMax()); + Vec3V nmax = V3Neg(max); + + //transform reference polygon to 2d, calculate min and max + Vec3V rPolygonMin= max; + Vec3V rPolygonMax = nmax; + for(PxU32 i=0; i= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + } + + } + + + if(inside == 3) + { + return; + } + + inside = 0; + iPolygonMin = V3Sub(iPolygonMin, eps); + iPolygonMax = V3Add(iPolygonMax, eps); + + const Vec3V incidentNormal = triangle.normal(); + const FloatV iPlaneD = V3Dot(incidentNormal, triangle.verts[0]); + const FloatV one = FOne(); + for(PxU32 i=0; i= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + + } + + } + + if(inside == referencePolygon.mNbVerts) + return; + + + + //Always generate segment contacts + //(2) segment intesection + for (PxU32 iStart = 0, iEnd = 2; iStart < 3; iEnd = iStart++) + { + if((!points1In0Penetration[iStart] && !points1In0Penetration[iEnd] ) ) + continue; + + const Vec3V ipA = points1In0[iStart]; + const Vec3V ipB = points1In0[iEnd]; + + const Vec3V iMin = V3Min(ipA, ipB); + const Vec3V iMax = V3Max(ipA, ipB); + + for (PxU32 rStart = 0, rEnd = PxU32(referencePolygon.mNbVerts - 1); rStart < referencePolygon.mNbVerts; rEnd = rStart++) + { + + const Vec3V rpA = points0In0[rStart]; + const Vec3V rpB = points0In0[rEnd]; + + const Vec3V rMin = V3Min(rpA, rpB); + const Vec3V rMax = V3Max(rpA, rpB); + + const BoolV tempCon =BOr(V3IsGrtr(iMin, rMax), V3IsGrtr(rMin, iMax)); + const BoolV con = BOr(BGetX(tempCon), BGetY(tempCon)); + + if(BAllEqTTTT(con)) + continue; + + + FloatV a1 = signed2DTriArea(rpA, rpB, ipA); + FloatV a2 = signed2DTriArea(rpA, rpB, ipB); + + + if(FAllGrtr(zero, FMul(a1, a2))) + { + FloatV a3 = signed2DTriArea(ipA, ipB, rpA); + FloatV a4 = signed2DTriArea(ipA, ipB, rpB); + + if(FAllGrtr(zero, FMul(a3, a4))) + { + + //these two segment intersect + const FloatV t = FMul(a1, FRecip(FSub(a2, a1))); + + const Vec3V ipAOri = V3SetZ(points1In0[iStart], FAdd(points1In0TValue[iStart], d)); + const Vec3V ipBOri = V3SetZ(points1In0[iEnd], FAdd(points1In0TValue[iEnd], d)); + + const Vec3V pBB = V3NegScaleSub(V3Sub(ipBOri, ipAOri), t, ipAOri); + const Vec3V pAA = V3SetZ(pBB, d); + const Vec3V pA = M33TrnspsMulV3(rot, pAA); + const Vec3V pB = M33TrnspsMulV3(rot, pBB); + const FloatV pen = FSub(V3GetZ(pBB), V3GetZ(pAA)); + + if(FAllGrtr(pen, contactDist)) + continue; + + + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(nContactNormal), pen); + numManifoldContacts = addMeshContacts(manifoldContacts, pA, pB, localNormalPen, triangleIndex, numManifoldContacts); + + //if the numContacts are more than GU_MESH_CONTACT_REDUCTION_THRESHOLD, we need to do contact reduction + const PxU32 numContacts = numManifoldContacts - previousContacts; + if(numContacts >= GU_MESH_CONTACT_REDUCTION_THRESHOLD) + { + //a polygon has more than GU_MESH_CONTACT_REDUCTION_THRESHOLD(16) contacts with this triangle, we will reduce + //the contacts to GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE(4) points + Gu::SinglePersistentContactManifold::reduceContacts(&manifoldContacts[previousContacts], numContacts); + numManifoldContacts = previousContacts + GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE; + } + } + } + } + } + + } + + + bool Gu::PCMConvexVsMeshContactGeneration::generateTriangleFullContactManifold(Gu::TriangleV& localTriangle, const PxU32 triangleIndex, const PxU32* triIndices, const PxU8 triFlags, const Gu::PolygonalData& polyData, Gu::SupportLocalImpl* localTriMap, Gu::SupportLocal* polyMap, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& patchNormal) + { + + using namespace aos; + + { + + FeatureStatus status = POLYDATA0; + FloatV minOverlap = FMax(); + //minNormal will be in the local space of polyData + Vec3V minNormal = V3Zero(); + + + PxU32 feature0; + if(!testTriangleFaceNormal(localTriangle, polyData, localTriMap, polyMap, contactDist, minOverlap, feature0, minNormal, POLYDATA0, status)) + return false; + + PxU32 feature1; + if(!testPolyFaceNormal(localTriangle, polyData, localTriMap, polyMap, contactDist, minOverlap, feature1, minNormal, POLYDATA1, status)) + return false; + + + if (!testPolyEdgeNormal(localTriangle, triFlags, polyData, localTriMap, polyMap, contactDist, minOverlap, minNormal, EDGE, status)) + return false; + + const Vec3V triNormal = localTriangle.normal(); + + if(status == POLYDATA0) + { + //minNormal is the triangle normal and it is in the local space of polydata0 + + PxI32 index2; + PxI32 polyIndex = getPolygonIndex(polyData, polyMap, minNormal, index2); + const Gu::HullPolygonData& referencePolygon = polyData.mPolygons[polyIndex]; + + patchNormal = triNormal; + generatedTriangleContacts(localTriangle, triangleIndex, triFlags, polyData, referencePolygon, polyMap, manifoldContacts, numContacts, contactDist, triNormal, mRenderOutput); + + if (index2 != -1) + { + generatedTriangleContacts(localTriangle, triangleIndex, triFlags, polyData, polyData.mPolygons[index2], polyMap, manifoldContacts, numContacts, contactDist, triNormal, mRenderOutput); + } + + } + else + { + + if(status == POLYDATA1) + { + const Gu::HullPolygonData* referencePolygon = &polyData.mPolygons[feature1]; + + const FloatV cosTheta = V3Dot(V3Neg(minNormal), triNormal); + + const FloatV threshold = FLoad(0.707106781f);//about 45 degree0 + + if(FAllGrtr(cosTheta, threshold)) + { + patchNormal = triNormal; + generatedTriangleContacts(localTriangle, triangleIndex, triFlags, polyData, *referencePolygon, polyMap, manifoldContacts, numContacts, contactDist, triNormal, mRenderOutput); + } + else + { + //ML : defer the contacts generation + + if (mSilhouetteEdgesAreActive || + !(triFlags & (ETD_SILHOUETTE_EDGE_01 | ETD_SILHOUETTE_EDGE_12 | ETD_SILHOUETTE_EDGE_20))) + { + const PxU32 nb = sizeof(PCMDeferredPolyData) / sizeof(PxU32); + PxU32 newSize = nb + mDeferredContacts->size(); + if(mDeferredContacts->capacity() < newSize) + mDeferredContacts->reserve((newSize+1)*2); + PCMDeferredPolyData* PX_RESTRICT data = reinterpret_cast(mDeferredContacts->end()); + mDeferredContacts->forceSize_Unsafe(newSize); + + data->mTriangleIndex = triangleIndex; + data->mFeatureIndex = feature1; + data->triFlags32 = PxU32(triFlags); + data->mInds[0] = triIndices[0]; + data->mInds[1] = triIndices[1]; + data->mInds[2] = triIndices[2]; + V3StoreU(localTriangle.verts[0], data->mVerts[0]); + V3StoreU(localTriangle.verts[1], data->mVerts[1]); + V3StoreU(localTriangle.verts[2], data->mVerts[2]); + } + return true; + } + } + else + { + PxI32 index2; + feature1 = PxU32(getPolygonIndex(polyData, polyMap, minNormal, index2)); + const Gu::HullPolygonData* referencePolygon = &polyData.mPolygons[feature1]; + + const Vec3V contactNormal = V3Normalize(M33TrnspsMulV3(polyMap->shape2Vertex, V3LoadU(referencePolygon->mPlane.n))); + const Vec3V nContactNormal = V3Neg(contactNormal); + + //if the minimum sperating axis is edge case, we don't defer it because it is an activeEdge + patchNormal = nContactNormal; + generatedPolyContacts(polyData, *referencePolygon, localTriangle, triangleIndex, triFlags, polyMap, manifoldContacts, numContacts, contactDist, contactNormal, mRenderOutput); + } + } + } + + return true; + } + + + bool Gu::PCMConvexVsMeshContactGeneration::generateTriangleFullContactManifold(Gu::TriangleV& localTriangle, const PxU32 triangleIndex, const PxU8 triFlags, const Gu::PolygonalData& polyData, Gu::SupportLocalImpl* localTriMap, Gu::SupportLocal* polyMap, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, + const aos::FloatVArg contactDist, aos::Vec3V& patchNormal, PxRenderOutput* renderOutput) + { + + using namespace aos; + + const FloatV threshold = FLoad(0.7071f);//about 45 degree + PX_UNUSED(threshold); + { + + FeatureStatus status = POLYDATA0; + FloatV minOverlap = FMax(); + //minNormal will be in the local space of polyData + Vec3V minNormal = V3Zero(); + + PxU32 feature0; + if(!testTriangleFaceNormal(localTriangle, polyData, localTriMap, polyMap, contactDist, minOverlap, feature0, minNormal, POLYDATA0, status)) + return false; + + PxU32 feature1; + if(!testPolyFaceNormal(localTriangle, polyData, localTriMap, polyMap, contactDist, minOverlap, feature1, minNormal, POLYDATA1, status)) + return false; + + if(!testPolyEdgeNormal(localTriangle, triFlags, polyData, localTriMap, polyMap, contactDist, minOverlap, minNormal, EDGE, status)) + return false; + + const Vec3V triNormal = localTriangle.normal(); + patchNormal = triNormal; + + const Gu::HullPolygonData* referencePolygon = &polyData.mPolygons[getPolygonIndex(polyData, polyMap, triNormal)]; + generatedTriangleContacts(localTriangle, triangleIndex, triFlags, polyData, *referencePolygon, polyMap, manifoldContacts, numContacts, contactDist, triNormal, renderOutput); + + } + + return true; + } + + bool Gu::PCMConvexVsMeshContactGeneration::generatePolyDataContactManifold(Gu::TriangleV& localTriangle, const PxU32 featureIndex, const PxU32 triangleIndex, const PxU8 triFlags, Gu::MeshPersistentContact* manifoldContacts, PxU32& numContacts, const aos::FloatVArg contactDist, aos::Vec3V& patchNormal) + { + + using namespace aos; + + const Gu::HullPolygonData* referencePolygon = &mPolyData.mPolygons[featureIndex]; + + const Vec3V contactNormal = V3Normalize(M33TrnspsMulV3(mPolyMap->shape2Vertex, V3LoadU(referencePolygon->mPlane.n))); + const Vec3V nContactNormal = V3Neg(contactNormal); + + patchNormal = nContactNormal; + generatedPolyContacts(mPolyData, *referencePolygon, localTriangle, triangleIndex, triFlags, mPolyMap, manifoldContacts, numContacts, contactDist, contactNormal, mRenderOutput); + + return true; + } + + +}//physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.h new file mode 100644 index 0000000..996ba57 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPCMTriangleContactGen.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_PCM_TRIANGLE_CONTACT_GEN_H +#define GU_PCM_TRIANGLE_CONTACT_GEN_H + +#include "GuPCMContactGenUtil.h" +#include "GuPersistentContactManifold.h" + +namespace physx +{ + class PxTriangleMeshGeometry; + class PxHeightFieldGeometry; + +namespace Gu +{ + bool PCMContactConvexMesh(const Gu::PolygonalData& polyData0, + Gu::SupportLocal* polyMap, + const aos::FloatVArg minMargin, + const PxBounds3& hullAABB, + const PxTriangleMeshGeometry& shapeMesh, + const PxTransform& transform0, const PxTransform& transform1, + PxReal contactDistance, PxContactBuffer& contactBuffer, + const Cm::FastVertex2ShapeScaling& convexScaling, const Cm::FastVertex2ShapeScaling& meshScaling, + bool idtConvexScale, bool idtMeshScale, Gu::MultiplePersistentContactManifold& multiManifold, + PxRenderOutput* renderOutput); + + bool PCMContactConvexHeightfield(const Gu::PolygonalData& polyData0, + Gu::SupportLocal* polyMap, + const aos::FloatVArg minMargin, + const PxBounds3& hullAABB, + const PxHeightFieldGeometry& shapeHeightfield, + const PxTransform& transform0, const PxTransform& transform1, + PxReal contactDistance, PxContactBuffer& contactBuffer, + const Cm::FastVertex2ShapeScaling& convexScaling, bool idtConvexScale, Gu::MultiplePersistentContactManifold& multiManifold, + PxRenderOutput* renderOutput); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp new file mode 100644 index 0000000..499ef47 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.cpp @@ -0,0 +1,2476 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "geomutils/PxContactBuffer.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxVecTransform.h" +#include "foundation/PxUtilities.h" +#include "GuPersistentContactManifold.h" +#include "GuGJKUtil.h" + +using namespace physx; + +namespace physx +{ +namespace Gu +{ + +/* + This local function is to avoid DLL call +*/ +static aos::FloatV distancePointSegmentSquaredLocal(const aos::Vec3VArg a, const aos::Vec3VArg b, const aos::Vec3VArg p) +{ + using namespace aos; + const FloatV zero = FZero(); + const FloatV one = FOne(); + + const Vec3V ap = V3Sub(p, a); + const Vec3V ab = V3Sub(b, a); + const FloatV nom = V3Dot(ap, ab); + + const FloatV denom = V3Dot(ab, ab); + const FloatV tValue = FClamp(FDiv(nom, denom), zero, one); + + const FloatV t = FSel(FIsEq(denom, zero), zero, tValue); + const Vec3V v = V3NegScaleSub(ab, t, ap); + return V3Dot(v, v); +} + +/* + This local function is to avoid DLL call +*/ +static aos::FloatV distancePointTriangleSquaredLocal( const aos::Vec3VArg p, + const aos::Vec3VArg a, + const aos::Vec3VArg b, + const aos::Vec3VArg c) +{ + using namespace aos; + + const FloatV zero = FZero(); + //const Vec3V zero = V3Zero(); + const Vec3V ab = V3Sub(b, a); + const Vec3V ac = V3Sub(c, a); + const Vec3V bc = V3Sub(c, b); + const Vec3V ap = V3Sub(p, a); + const Vec3V bp = V3Sub(p, b); + const Vec3V cp = V3Sub(p, c); + + const FloatV d1 = V3Dot(ab, ap); // snom + const FloatV d2 = V3Dot(ac, ap); // tnom + const FloatV d3 = V3Dot(ab, bp); // -sdenom + const FloatV d4 = V3Dot(ac, bp); // unom = d4 - d3 + const FloatV d5 = V3Dot(ab, cp); // udenom = d5 - d6 + const FloatV d6 = V3Dot(ac, cp); // -tdenom + const FloatV unom = FSub(d4, d3); + const FloatV udenom = FSub(d5, d6); + + //check if p in vertex region outside a + const BoolV con00 = FIsGrtr(zero, d1); // snom <= 0 + const BoolV con01 = FIsGrtr(zero, d2); // tnom <= 0 + const BoolV con0 = BAnd(con00, con01); // vertex region a + + if(BAllEqTTTT(con0)) + { + const Vec3V vv = V3Sub(p, a); + return V3Dot(vv, vv); + } + + //check if p in vertex region outside b + const BoolV con10 = FIsGrtrOrEq(d3, zero); + const BoolV con11 = FIsGrtrOrEq(d3, d4); + const BoolV con1 = BAnd(con10, con11); // vertex region b + if(BAllEqTTTT(con1)) + { + const Vec3V vv = V3Sub(p, b); + return V3Dot(vv, vv); + } + + //check if p in vertex region outside c + const BoolV con20 = FIsGrtrOrEq(d6, zero); + const BoolV con21 = FIsGrtrOrEq(d6, d5); + const BoolV con2 = BAnd(con20, con21); // vertex region c + if(BAllEqTTTT(con2)) + { + const Vec3V vv = V3Sub(p, c); + return V3Dot(vv, vv); + } + + //check if p in edge region of AB + const FloatV vc = FSub(FMul(d1, d4), FMul(d3, d2)); + + const BoolV con30 = FIsGrtr(zero, vc); + const BoolV con31 = FIsGrtrOrEq(d1, zero); + const BoolV con32 = FIsGrtr(zero, d3); + const BoolV con3 = BAnd(con30, BAnd(con31, con32)); + if(BAllEqTTTT(con3)) + { + const FloatV sScale = FDiv(d1, FSub(d1, d3)); + const Vec3V closest3 = V3ScaleAdd(ab, sScale, a);//V3Add(a, V3Scale(ab, sScale)); + const Vec3V vv = V3Sub(p, closest3); + return V3Dot(vv, vv); + } + + //check if p in edge region of BC + const FloatV va = FSub(FMul(d3, d6),FMul(d5, d4)); + const BoolV con40 = FIsGrtr(zero, va); + const BoolV con41 = FIsGrtrOrEq(d4, d3); + const BoolV con42 = FIsGrtrOrEq(d5, d6); + const BoolV con4 = BAnd(con40, BAnd(con41, con42)); + if(BAllEqTTTT(con4)) + { + const FloatV uScale = FDiv(unom, FAdd(unom, udenom)); + const Vec3V closest4 = V3ScaleAdd(bc, uScale, b);//V3Add(b, V3Scale(bc, uScale)); + const Vec3V vv = V3Sub(p, closest4); + return V3Dot(vv, vv); + } + + //check if p in edge region of AC + const FloatV vb = FSub(FMul(d5, d2), FMul(d1, d6)); + const BoolV con50 = FIsGrtr(zero, vb); + const BoolV con51 = FIsGrtrOrEq(d2, zero); + const BoolV con52 = FIsGrtr(zero, d6); + const BoolV con5 = BAnd(con50, BAnd(con51, con52)); + if(BAllEqTTTT(con5)) + { + const FloatV tScale = FDiv(d2, FSub(d2, d6)); + const Vec3V closest5 = V3ScaleAdd(ac, tScale, a);//V3Add(a, V3Scale(ac, tScale)); + const Vec3V vv = V3Sub(p, closest5); + return V3Dot(vv, vv); + } + + //P must project inside face region. Compute Q using Barycentric coordinates + const Vec3V n = V3Cross(ab, ac); + const FloatV nn = V3Dot(n,n); + const FloatV t = FSel(FIsGrtr(nn, zero),FDiv(V3Dot(n, V3Sub(a, p)), nn), zero); + const Vec3V closest6 = V3Add(p, V3Scale(n, t)); + + const Vec3V vv = V3Sub(p, closest6); + + return V3Dot(vv, vv); +} + + + + +//This is the translational threshold used in invalidate_BoxConvexHull. 0.5 is 50% of the object margin. we use different threshold between +//0 and 4 points. This threashold is a scale that is multiplied by the objects' margins. +const PxF32 invalidateThresholds[5] = { 0.5f, 0.125f, 0.25f, 0.375f, 0.375f }; + +//This is the translational threshold used in invalidate_SphereCapsule. 0.5 is 50% of the object margin, we use different threshold between +//0 and 2 points. This threshold is a scale that is multiplied by the objects' margin + +const PxF32 invalidateThresholds2[3] = { 0.5f, 0.1f, 0.75f }; + +//This is the rotational threshold used in invalidate_BoxConvexHull. 0.9998 is a threshold for quat difference +//between previous and current frame +const PxF32 invalidateQuatThresholds[5] = { 0.9998f, 0.9999f, 0.9999f, 0.9999f, 0.9999f }; + + +//This is the rotational threshold used in invalidate_SphereCapsule. 0.9995f is a threshold for quat difference +//between previous and current frame +const PxF32 invalidateQuatThresholds2[3] = { 0.9995f, 0.9999f, 0.9997f }; + +} +} + + +#if VISUALIZE_PERSISTENT_CONTACT +#include "common/PxRenderOutput.h" + +static void drawManifoldPoint(const Gu::PersistentContact& manifold, const aos::PxTransformV& trA, const aos::PxTransformV& trB, PxRenderOutput& out, PxU32 color=0xffffff) +{ + PX_UNUSED(color); + + using namespace aos; + const Vec3V worldA = trA.transform(manifold.mLocalPointA); + const Vec3V worldB = trB.transform(manifold.mLocalPointB); + const Vec3V localNormal = Vec3V_From_Vec4V(manifold.mLocalNormalPen); + const FloatV pen = V4GetW(manifold.mLocalNormalPen); + + const Vec3V worldNormal = trB.rotate(localNormal); + PxVec3 a, b, v; + V3StoreU(worldA, a); + V3StoreU(worldB, b); + V3StoreU(worldNormal, v); + PxF32 dist; + FStore(pen, &dist); + PxVec3 e = a - v*dist; + + PxF32 size = 0.05f; + const PxVec3 up(0.f, size, 0.f); + const PxVec3 right(size, 0.f, 0.f); + const PxVec3 forwards(0.f, 0.f, size); + + PxF32 size2 = 0.1f; + const PxVec3 up2(0.f, size2, 0.f); + const PxVec3 right2(size2, 0.f, 0.f); + const PxVec3 forwards2(0.f, 0.f, size2); + + const PxMat44 m = PxMat44(PxIdentity); + + out << m << PxRenderOutput::LINES; + + out << 0xffff00ff << a << e; + out << 0xff00ffff << a + up << a - up; + out << 0xff00ffff << a + right << a - right; + out << 0xff00ffff << a + forwards << a - forwards; + + out << 0xffff0000 << b + up2 << b - up2; + out << 0xffff0000 << b + right2 << b - right2; + out << 0xffff0000 << b + forwards2 << b - forwards2; + + out << 0xffff0000 << a << b; + + const PxVec3 c = a - v*10.f; + out << 0xffff00ff << a << c; + +} + +static void drawManifoldPoint(const Gu::PersistentContact& manifold, const aos::PxTransformV& trA, const aos::PxTransformV& trB, const aos::FloatVArg radius, PxRenderOutput& out, PxU32 color=0xffffff) +{ + PX_UNUSED(color); + + using namespace aos; + + const Vec3V localNormal = Vec3V_From_Vec4V(manifold.mLocalNormalPen); + const Vec3V worldNormal = trB.rotate(localNormal); + const Vec3V worldA = V3NegScaleSub(worldNormal, radius, trA.transform(manifold.mLocalPointA)); + const Vec3V worldB = trB.transform(manifold.mLocalPointB); + const FloatV pen = FSub(V4GetW(manifold.mLocalNormalPen), radius); + + PxVec3 a, b, v; + V3StoreU(worldA, a); + V3StoreU(worldB, b); + V3StoreU(worldNormal, v); + PxF32 dist; + FStore(pen, &dist); + PxVec3 e = a - v*dist; + + PxF32 size = 0.05f; + const PxVec3 up(0.f, size, 0.f); + const PxVec3 right(size, 0.f, 0.f); + const PxVec3 forwards(0.f, 0.f, size); + + PxF32 size2 = 0.1f; + const PxVec3 up2(0.f, size2, 0.f); + const PxVec3 right2(size2, 0.f, 0.f); + const PxVec3 forwards2(0.f, 0.f, size2); + + PxMat44 m = PxMat44(PxIdentity); + + out << 0xffff00ff << m << PxRenderOutput::LINES << a << e; + out << 0xff00ffff << m << PxRenderOutput::LINES << a + up << a - up; + out << 0xff00ffff << m << PxRenderOutput::LINES << a + right << a - right; + out << 0xff00ffff << m << PxRenderOutput::LINES << a + forwards << a - forwards; + + out << 0xffff0000 << m << PxRenderOutput::LINES << b + up2 << b - up2; + out << 0xffff0000 << m << PxRenderOutput::LINES << b + right2 << b - right2; + out << 0xffff0000 << m << PxRenderOutput::LINES << b + forwards2 << b - forwards2; + + out << 0xffff0000 << m << PxRenderOutput::LINES << a << b; + +} + + +static PxU32 gColors[8] = { 0xff0000ff, 0xff00ff00, 0xffff0000, + 0xff00ffff, 0xffff00ff, 0xffffff00, + 0xff000080, 0xff008000}; + +#endif + +/* + SIMD version +*/ +aos::Mat33V Gu::findRotationMatrixFromZAxis(const aos::Vec3VArg to) +{ + using namespace aos; + + const FloatV one = FOne(); + const FloatV threshold = FLoad(0.9999f); + + const FloatV e = V3GetZ(to); + const FloatV f = FAbs(e); + + if(FAllGrtr(threshold, f)) + { + const FloatV vx = FNeg(V3GetY(to)); + const FloatV vy = V3GetX(to); + const FloatV h = FRecip(FAdd(one, e)); + const FloatV hvx = FMul(h,vx); + const FloatV hvxy = FMul(hvx, vy); + + const Vec3V col0 = V3Merge(FScaleAdd(hvx, vx, e), hvxy, vy); + const Vec3V col1 = V3Merge(hvxy, FScaleAdd(h, FMul(vy, vy), e), FNeg(vx)); + const Vec3V col2 = V3Merge(FNeg(vy), vx, e); + + return Mat33V(col0, col1, col2); + + } + else + { + + const FloatV two = FLoad(2.f); + const Vec3V from = V3UnitZ(); + const Vec3V absFrom = V3UnitY(); + + const Vec3V u = V3Sub(absFrom, from); + const Vec3V v = V3Sub(absFrom, to); + + const FloatV dotU = V3Dot(u, u); + const FloatV dotV = V3Dot(v, v); + const FloatV dotUV = V3Dot(u, v); + + const FloatV c1 = FNeg(FDiv(two, dotU)); + const FloatV c2 = FNeg(FDiv(two, dotV)); + const FloatV c3 = FMul(c1, FMul(c2, dotUV)); + + const Vec3V c1u = V3Scale(u, c1); + const Vec3V c2v = V3Scale(v, c2); + const Vec3V c3v = V3Scale(v, c3); + + + FloatV temp0 = V3GetX(c1u); + FloatV temp1 = V3GetX(c2v); + FloatV temp2 = V3GetX(c3v); + + Vec3V col0 = V3ScaleAdd(u, temp0, V3ScaleAdd(v, temp1, V3Scale(u, temp2))); + col0 = V3SetX(col0, FAdd(V3GetX(col0), one)); + + temp0 = V3GetY(c1u); + temp1 = V3GetY(c2v); + temp2 = V3GetY(c3v); + + Vec3V col1 = V3ScaleAdd(u, temp0, V3ScaleAdd(v, temp1, V3Scale(u, temp2))); + col1 = V3SetY(col1, FAdd(V3GetY(col1), one)); + + temp0 = V3GetZ(c1u); + temp1 = V3GetZ(c2v); + temp2 = V3GetZ(c3v); + + Vec3V col2 = V3ScaleAdd(u, temp0, V3ScaleAdd(v, temp1, V3Scale(u, temp2))); + col2 = V3SetZ(col2, FAdd(V3GetZ(col2), one)); + + return Mat33V(col0, col1, col2); + + } +} + + +void Gu::PersistentContactManifold::drawManifold( PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + + PxVec3 a, b; + V3StoreU(trA.p, a); + V3StoreU(trB.p, b); + + for(PxU32 i = 0; i< mNumContacts; ++i) + { + Gu::PersistentContact& m = mContactPoints[i]; + drawManifoldPoint(m, trA, trB, out, gColors[i]); + } +#else + PX_UNUSED(out); + PX_UNUSED(trA); + PX_UNUSED(trB); +#endif +} + +void Gu::PersistentContactManifold::drawManifold( PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB, const aos::FloatVArg radius) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + + PxVec3 a, b; + V3StoreU(trA.p, a); + V3StoreU(trB.p, b); + + for(PxU32 i = 0; i< mNumContacts; ++i) + { + Gu::PersistentContact& m = mContactPoints[i]; + drawManifoldPoint(m, trA, trB, radius, out, gColors[i]); + } +#else + PX_UNUSED(out); + PX_UNUSED(trA); + PX_UNUSED(trB); + PX_UNUSED(radius); +#endif +} + +void Gu::PersistentContactManifold::drawManifold(const Gu::PersistentContact& m, PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB) +{ +#if VISUALIZE_PERSISTENT_CONTACT + drawManifoldPoint(m, trA, trB, out, gColors[0]); +#else + PX_UNUSED(out); + PX_UNUSED(trA); + PX_UNUSED(trB); + PX_UNUSED(m); +#endif +} + +void Gu::PersistentContactManifold::drawPoint(PxRenderOutput& out, const aos::Vec3VArg p, const PxF32 size, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + const PxVec3 up(0.f, size, 0.f); + const PxVec3 right(size, 0.f, 0.f); + const PxVec3 forwards(0.f, 0.f, size); + + PxVec3 a; + V3StoreU(p, a); + + PxMat44 m = PxMat44(PxIdentity); + + out << color << m << PxRenderOutput::LINES << a + up << a - up; + out << color << m << PxRenderOutput::LINES << a + right << a - right; + out << color << m << PxRenderOutput::LINES << a + forwards << a - forwards; +#else + PX_UNUSED(out); + PX_UNUSED(p); + PX_UNUSED(size); + PX_UNUSED(color); +#endif +} + +void Gu::PersistentContactManifold::drawLine(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + PxVec3 a, b; + V3StoreU(p0, a); + V3StoreU(p1, b); + + PxMat44 m = PxMat44(PxIdentity); + out << color << m << PxRenderOutput::LINES << a << b; +#else + PX_UNUSED(out); + PX_UNUSED(p0); + PX_UNUSED(p1); + PX_UNUSED(color); +#endif +} + +void Gu::PersistentContactManifold::drawTriangle(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + PxVec3 a, b, c; + V3StoreU(p0, a); + V3StoreU(p1, b); + V3StoreU(p2, c); + + PxMat44 m = PxMat44(PxIdentity); + out << color << m << PxRenderOutput::TRIANGLES << a << b << c; +#else + PX_UNUSED(out); + PX_UNUSED(p0); + PX_UNUSED(p1); + PX_UNUSED(p2); + PX_UNUSED(color); +#endif +} + +void Gu::PersistentContactManifold::drawTetrahedron(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2, + const aos::Vec3VArg p3, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + PxVec3 a, b, c, d; + V3StoreU(p0, a); + V3StoreU(p1, b); + V3StoreU(p2, c); + V3StoreU(p3, d); + + PxMat44 m = PxMat44(PxIdentity); + out << color << m << PxRenderOutput::LINES << a << b; + out << color << m << PxRenderOutput::LINES << a << c; + out << color << m << PxRenderOutput::LINES << a << d; + out << color << m << PxRenderOutput::LINES << b << c; + out << color << m << PxRenderOutput::LINES << b << d; + out << color << m << PxRenderOutput::LINES << c << d; + +#else + PX_UNUSED(out); + PX_UNUSED(p0); + PX_UNUSED(p1); + PX_UNUSED(p2); + PX_UNUSED(color); +#endif +} + +void Gu::PersistentContactManifold::drawPolygon( PxRenderOutput& out, const aos::PxTransformV& transform, aos::Vec3V* points, const PxU32 numVerts, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + for(PxU32 i=0; i(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldP), reinterpret_cast(&contact.point.x)); + FStore(dist, &contact.separation); + + PX_ASSERT(contact.point.isFinite()); + PX_ASSERT(contact.normal.isFinite()); + PX_ASSERT(PxIsFinite(contact.separation)); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + } + + } + + contactBuffer.count = contactCount; +} + +/* + This function is for direct implementation for box vs box. We don't need to discard the contacts based on whether the contact offset is larger than penetration/dist because + the direct implementation will guarantee the penetration/dist won't be larger than the contact offset. Also, we won't have points from the cache if the direct implementation + of box vs box is called. +*/ +void Gu::PersistentContactManifold::addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg normal, const aos::PxMatTransformV& transf1) +{ + using namespace aos; + + //add the manifold contacts; + PxU32 contactCount = 0;//contactBuffer.count; + for(PxU32 i=0; (i< mNumContacts) & (contactCount < PxContactBuffer::MAX_CONTACTS); ++i) + { + + PersistentContact& p = getContactPoint(i); + + const Vec3V worldP =transf1.transform(p.mLocalPointB); + const FloatV dist = V4GetW(p.mLocalNormalPen); + + PxContactPoint& contact = contactBuffer.contacts[contactCount++]; + //Fast allign store + V4StoreA(Vec4V_From_Vec3V(normal), reinterpret_cast(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldP), reinterpret_cast(&contact.point.x)); + FStore(dist, &contact.separation); + PX_ASSERT(PxIsFinite(contact.point.x)); + PX_ASSERT(PxIsFinite(contact.point.y)); + PX_ASSERT(PxIsFinite(contact.point.z)); + + //PX_ASSERT(contact.separation > -0.2f); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + } + + contactBuffer.count = contactCount; +} + +/* + This function is for sphere/capsule vs other primitives. We treat sphere as a point and capsule as a segment in the contact gen and store the sphere center or a point in the segment for capsule + in the manifold. +*/ +void Gu::PersistentContactManifold::addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg normal, const aos::Vec3VArg projectionNormal, + const aos::PxTransformV& transf0, const aos::FloatVArg radius, const aos::FloatVArg contactOffset) +{ + using namespace aos; + + //add the manifold contacts; + PxU32 contactCount = 0;//contactBuffer.count; + for(PxU32 i=0; (i< mNumContacts) & (contactCount < PxContactBuffer::MAX_CONTACTS); ++i) + { + + PersistentContact& p = getContactPoint(i); + const FloatV dist = FSub(V4GetW(p.mLocalNormalPen), radius); + + //The newly created points should have a dist < contactOffset. However, points might come from the PCM contact cache so we might still have points which are + //larger than contactOffset. The reason why we don't want to discard the contacts in the contact cache whose dist > contactOffset is because the contacts may + //only temporarily become separated. The points still project onto roughly the same spot but so, if the bodies move together again, the contacts may be valid again. + //This is important when simulating at large time-steps because GJK can only generate 1 point of contact and missing contacts for just a single frame with large time-steps + //may introduce noticeable instability. + if(FAllGrtrOrEq(contactOffset, dist)) + { + const Vec3V worldP =V3NegScaleSub(projectionNormal, radius, transf0.transform(p.mLocalPointA)); + + PxContactPoint& contact = contactBuffer.contacts[contactCount++]; + //Fast allign store + V4StoreA(Vec4V_From_Vec3V(normal), reinterpret_cast(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldP), reinterpret_cast(&contact.point.x)); + FStore(dist, &contact.separation); + //PX_ASSERT(PxAbs(contact.separation) < 2.f); + + contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + } + } + + contactBuffer.count = contactCount; +} + + +/* + This function is used in the box/convexhull full manifold contact genenation. We will pass in a list of manifold contacts. If the number of contacts are more than + GU_MANIFOLD_CACHE_SIZE, we will need to do contact reduction while we are storing the chosen manifold contacts from the manifold contact list to the manifold contact + buffer. +*/ +void Gu::PersistentContactManifold::addBatchManifoldContacts(const PersistentContact* manifoldContacts, + const PxU32 numPoints, const PxReal toleranceLength) +{ + + if(numPoints <= GU_MANIFOLD_CACHE_SIZE) + { + for(PxU32 i=0; i 4, we will reduce the contact points to 4 +*/ +void Gu::PersistentContactManifold::reduceBatchContacts(const PersistentContact* manifoldPoints, + const PxU32 numPoints, const PxReal tolereanceLength) +{ + using namespace aos; + + PxU8 chosenIndices[4]; + PxU8 candidates[64]; + + const FloatV zero = FZero(); + const FloatV max = FMax(); + const FloatV nmax = FNeg(max); + FloatV maxPen = V4GetW(manifoldPoints[0].mLocalNormalPen); + FloatV minPen = maxPen; + PxU32 index = 0; + candidates[0] = 0; + PxU32 candidateIndex = 0; + + PxU32 nbCandiates = numPoints; + //keep the deepest point, candidateIndex will be the same as index + for (PxU32 i = 1; i 2, we will reduce the contact points to 2 +*/ +void Gu::PersistentContactManifold::reduceBatchContacts2(const PersistentContact* manifoldPoints, const PxU32 numPoints) +{ + using namespace aos; + + PX_ASSERT(numPoints < 64); + bool chosen[64]; + physx::PxMemZero(chosen, sizeof(bool)*numPoints); + FloatV maxDis = V4GetW(manifoldPoints[0].mLocalNormalPen); + PxI32 index = 0; + //keep the deepest point + for(PxU32 i=1; imStartIndex; jmEndIndex; ++j) + { + mContactPoints[tempNumContacts++] = manifoldContact[j]; + } + currentPatch = currentPatch->mNextPatch; + } + mNumContacts = tempNumContacts; + return patch.mPatchMaxPen; + } + else + { + //contact reduction + const FloatV maxPen = reduceBatchContactsConvex(manifoldContact, numContactExt, patch); + mNumContacts = GU_SINGLE_MANIFOLD_CACHE_SIZE; + return maxPen; + } +} + +aos::FloatV Gu::SinglePersistentContactManifold::addBatchManifoldContactsSphere(const MeshPersistentContact* manifoldContact, const PxU32 numContactExt, PCMContactPatch& patch, const aos::FloatVArg replaceBreakingThreshold) +{ + PX_UNUSED(replaceBreakingThreshold); + + using namespace aos; + + const FloatV maxPen = reduceBatchContactsSphere(manifoldContact, numContactExt, patch); + mNumContacts = 1; + return maxPen; +} + +aos::FloatV Gu::SinglePersistentContactManifold::addBatchManifoldContactsCapsule(const MeshPersistentContact* manifoldContact, const PxU32 numContactExt, PCMContactPatch& patch, const aos::FloatVArg replaceBreakingThreshold) +{ + PX_UNUSED(replaceBreakingThreshold); + + using namespace aos; + + if(patch.mTotalSize <=GU_CAPSULE_MANIFOLD_CACHE_SIZE) + { + PCMContactPatch* currentPatch = &patch; + + //this is because we already add the manifold contacts into manifoldContact array + PxU32 tempNumContacts = 0; + while(currentPatch) + { + for(PxU32 j=currentPatch->mStartIndex; jmEndIndex; ++j) + { + mContactPoints[tempNumContacts++] = manifoldContact[j]; + } + currentPatch = currentPatch->mNextPatch; + } + mNumContacts = tempNumContacts; + return patch.mPatchMaxPen; + } + else + { + + const FloatV maxPen = reduceBatchContactsCapsule(manifoldContact, numContactExt, patch); + mNumContacts = GU_CAPSULE_MANIFOLD_CACHE_SIZE; + return maxPen; + } + +} + + +aos::FloatV Gu::SinglePersistentContactManifold::reduceBatchContactsSphere(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch) +{ + PX_UNUSED(numContacts); + + using namespace aos; + FloatV max = FMax(); + FloatV maxDist = max; + PxI32 index = -1; + + + PCMContactPatch* currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + const FloatV pen = V4GetW(manifoldContactExt[i].mLocalNormalPen); + if(FAllGrtr(maxDist, pen)) + { + maxDist = pen; + index = PxI32(i); + } + } + currentPatch = currentPatch->mNextPatch; + } + + PX_ASSERT(index!=-1); + mContactPoints[0] = manifoldContactExt[index]; + + return maxDist; + +} + +aos::FloatV Gu::SinglePersistentContactManifold::reduceBatchContactsCapsule(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch) +{ + using namespace aos; + + bool* chosen = reinterpret_cast(PxAlloca(sizeof(bool)*numContacts)); + physx::PxMemZero(chosen, sizeof(bool)*numContacts); + const FloatV max = FMax(); + FloatV maxDis = max; + PxI32 index = -1; + + FloatV maxPen = max; + + + PCMContactPatch* currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + const FloatV pen = V4GetW(manifoldContactExt[i].mLocalNormalPen); + if(FAllGrtr(maxDis, pen)) + { + maxDis = pen; + index = PxI32(i); + } + } + currentPatch = currentPatch->mNextPatch; + } + + chosen[index] = true; + mContactPoints[0] = manifoldContactExt[index]; + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index].mLocalNormalPen)); + + + //calculate the furthest away points + Vec3V v = V3Sub(manifoldContactExt[patch.mStartIndex].mLocalPointB, mContactPoints[0].mLocalPointB); + maxDis = V3Dot(v, v); + index = PxI32(patch.mStartIndex); + + currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + v = V3Sub(manifoldContactExt[i].mLocalPointB, mContactPoints[0].mLocalPointB); + const FloatV d = V3Dot(v, v); + if(FAllGrtr(d, maxDis)) + { + maxDis = d; + index = PxI32(i); + } + } + currentPatch = currentPatch->mNextPatch; + } + + //PX_ASSERT(chosen[index] == false); + chosen[index] = true; + mContactPoints[1] = manifoldContactExt[index]; + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index].mLocalNormalPen)); + + //keep the second deepest point + maxDis = max; + currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + if(!chosen[i]) + { + const FloatV pen = V4GetW(manifoldContactExt[i].mLocalNormalPen); + //const FloatV v = V3Dot(manifoldContactExt[i].mLocalPointB, manifoldContactExt[i].mLocalPointB); + if(FAllGrtr(maxDis, pen)) + { + maxDis = pen; + index = PxI32(i); + } + } + } + currentPatch = currentPatch->mNextPatch; + } + //PX_ASSERT(chosen[index] == false); + chosen[index] = true; + mContactPoints[2] = manifoldContactExt[index]; + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index].mLocalNormalPen)); + + return maxPen; +} + +aos::FloatV Gu::SinglePersistentContactManifold::reduceBatchContactsConvex(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch) +{ + using namespace aos; + + bool* chosen = reinterpret_cast(PxAlloca(sizeof(bool)*numContacts)); + physx::PxMemZero(chosen, sizeof(bool)*numContacts); + const FloatV max = FMax(); + const FloatV nmax = FNeg(max); + FloatV maxDis = nmax; + PxU32 index = GU_MANIFOLD_INVALID_INDEX; + + PCMContactPatch* currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + //const FloatV pen = V4GetW(manifoldContactExt[i].localNormalPen); + const FloatV v = V3Dot(manifoldContactExt[i].mLocalPointB, manifoldContactExt[i].mLocalPointB); + if(FAllGrtr(v, maxDis)) + { + maxDis = v; + index = i; + } + } + currentPatch = currentPatch->mNextPatch; + } + + chosen[index] = true; + + const Vec3V contact0 = manifoldContactExt[index].mLocalPointB; + mContactPoints[0] = manifoldContactExt[index]; + + FloatV maxPen = V4GetW(manifoldContactExt[index].mLocalNormalPen); + + //calculate the furthest away points + Vec3V v = V3Sub(manifoldContactExt[patch.mStartIndex].mLocalPointB, contact0); + maxDis = V3Dot(v, v); + index = patch.mStartIndex; + + currentPatch = &patch; + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + v = V3Sub(manifoldContactExt[i].mLocalPointB, contact0); + const FloatV d = V3Dot(v, v); + if(FAllGrtr(d, maxDis)) + { + maxDis = d; + index = i; + } + } + currentPatch = currentPatch->mNextPatch; + } + + //PX_ASSERT(chosen[index] == false); + chosen[index] = true; + const Vec3V contact1 = manifoldContactExt[index].mLocalPointB; + mContactPoints[1] = manifoldContactExt[index]; + + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index].mLocalNormalPen)); + + maxDis = nmax; + index = GU_MANIFOLD_INVALID_INDEX; + v = V3Sub(contact1, contact0); + const Vec3V cn0 = Vec3V_From_Vec4V(mContactPoints[0].mLocalNormalPen); + Vec3V norm = V3Cross(v, cn0); + const FloatV sqLen = V3Dot(norm, norm); + norm = V3Sel(FIsGrtr(sqLen, FZero()), V3ScaleInv(norm, FSqrt(sqLen)), cn0); + FloatV minDis = max; + PxU32 index1 = GU_MANIFOLD_INVALID_INDEX; + + + //calculate the point furthest way to the segment + currentPatch = &patch; + + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + if(!chosen[i]) + { + v = V3Sub(manifoldContactExt[i].mLocalPointB, contact0); + const FloatV d = V3Dot(v, norm); + if(FAllGrtr(d, maxDis)) + { + maxDis = d; + index = i; + } + + if(FAllGrtr(minDis, d)) + { + minDis = d; + index1 = i; + } + } + } + currentPatch = currentPatch->mNextPatch; + } + + //PX_ASSERT(chosen[index] == false); + + chosen[index] = true; + mContactPoints[2] = manifoldContactExt[index]; + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index].mLocalNormalPen)); + + //if min and max in the same side, choose again + const FloatV temp = FMul(minDis, maxDis); + if(FAllGrtr(temp, FZero())) + { + //choose again + maxDis = nmax; + //calculate the point furthest way to the segment + currentPatch = &patch; + + while(currentPatch) + { + for(PxU32 i=currentPatch->mStartIndex; imEndIndex; ++i) + { + if(!chosen[i]) + { + v = V3Sub(manifoldContactExt[i].mLocalPointB, contact0); + const FloatV d = V3Dot(v, norm); + if(FAllGrtr(d, maxDis)) + { + maxDis = d; + index1 = i; + } + } + } + currentPatch = currentPatch->mNextPatch; + } + } + + //PX_ASSERT(chosen[index1] == false); + + chosen[index1] = true; + mContactPoints[3] = manifoldContactExt[index1]; + maxPen = FMin(maxPen, V4GetW(manifoldContactExt[index1].mLocalNormalPen)); + + const PxU32 NB_TO_ADD = GU_SINGLE_MANIFOLD_CACHE_SIZE - 4; + + FloatV pens[NB_TO_ADD]; + PxU32 inds[NB_TO_ADD]; + for (PxU32 a = 0; a < NB_TO_ADD; ++a) + { + pens[a] = FMax(); + inds[a] = 0; + } + { + currentPatch = &patch; + + while (currentPatch) + { + for (PxU32 i = currentPatch->mStartIndex; i < currentPatch->mEndIndex; ++i) + { + if (!chosen[i]) + { + const FloatV pen = V4GetW(manifoldContactExt[i].mLocalNormalPen); + for (PxU32 a = 0; a < NB_TO_ADD; ++a) + { + if (FAllGrtr(pens[a], pen)) + { + for (PxU32 b = a + 1; b < NB_TO_ADD; ++b) + { + pens[b] = pens[b - 1]; + inds[b] = inds[b - 1]; + } + pens[a] = pen; + inds[a] = i; + break; + } + } + } + } + currentPatch = currentPatch->mNextPatch; + } + for (PxU32 i = 0; i < NB_TO_ADD; ++i) + { + mContactPoints[i + 4] = manifoldContactExt[inds[i]]; + maxPen = FMin(maxPen, pens[i]); + } + } + return maxPen; +} + +PxU32 Gu::SinglePersistentContactManifold::reduceContacts(MeshPersistentContact* manifoldPoints, PxU32 numPoints) +{ + using namespace aos; + + PxU8 chosenIndices[GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE]; + PxU8* candidates = reinterpret_cast(PxAlloca(sizeof(PxU8) * numPoints)); + + //(1) Remove duplicates... + for (PxU32 i = 0; i < numPoints; ++i) + { + Vec3V localPointB = manifoldPoints[i].mLocalPointB; + for (PxU32 j = i+1; j < numPoints; ++j) + { + if (V3AllGrtr(V3Eps(), V3Abs(V3Sub(localPointB, manifoldPoints[j].mLocalPointB)))) + { + manifoldPoints[j] = manifoldPoints[numPoints - 1]; + j--; + numPoints--; + } + } + } + + if (numPoints <= GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE) + return numPoints; + + + const FloatV max = FMax(); + const FloatV nmax = FNeg(max); + FloatV maxPen = V4GetW(manifoldPoints[0].mLocalNormalPen); + PxU32 index = 0; + candidates[0] = 0; + PxU32 candidateIndex = 0; + PxU32 nbCandiates = numPoints; + + MeshPersistentContact newManifold[GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE]; + + //keep the deepest point + for (PxU32 i = 1; i 0; --i) + { + MeshPersistentContact& manifoldPoint = mContactPoints[i-1]; + const Vec3V localAInB = aToB.transform( manifoldPoint.mLocalPointA ); // from a to b + const Vec3V localBInB = manifoldPoint.mLocalPointB; + const Vec3V v = V3Sub(localAInB, localBInB); + + const Vec3V localNormal = Vec3V_From_Vec4V(manifoldPoint.mLocalNormalPen); // normal in b space + const FloatV dist= V3Dot(v, localNormal); + + const Vec3V projectedPoint = V3NegScaleSub(localNormal, dist, localAInB);//manifoldPoint.worldPointA - manifoldPoint.worldPointB * manifoldPoint.m_distance1; + const Vec3V projectedDifference = V3Sub(localBInB, projectedPoint); + + const FloatV distance2d = V3Dot(projectedDifference, projectedDifference); + //const BoolV con = BOr(FIsGrtr(dist, contactOffset), FIsGrtr(distance2d, sqProjectBreakingThreshold)); + const BoolV con = FIsGrtr(distance2d, sqProjectBreakingThreshold); + if(BAllEqTTTT(con)) + { + removeContactPoint(i-1); + } + else + { + manifoldPoint.mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), dist); + maxPen = FMin(maxPen, dist); + } + } + + return maxPen; +} + + +void Gu::SinglePersistentContactManifold::drawManifold( PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + + PxVec3 a, b; + V3StoreU(trA.p, a); + V3StoreU(trB.p, b); + + for(PxU32 i = 0; i< mNumContacts; ++i) + { + Gu::MeshPersistentContact& m = mContactPoints[i]; + drawManifoldPoint(m, trA, trB, out, gColors[i]); + } +#else + PX_UNUSED(out); + PX_UNUSED(trA); + PX_UNUSED(trB); +#endif +} + +void Gu::MultiplePersistentContactManifold::drawManifold( PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB) +{ + for(PxU32 i=0; idrawManifold(out, trA, trB); + } +} + +void Gu::MultiplePersistentContactManifold::drawLine(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + PxVec3 a, b; + V3StoreU(p0, a); + V3StoreU(p1, b); + + PxMat44 m = PxMat44(PxIdentity); + out << color << m << PxRenderOutput::LINES << a << b; +#else + PX_UNUSED(out); + PX_UNUSED(p0); + PX_UNUSED(p1); + PX_UNUSED(color); + +#endif +} + +void Gu::MultiplePersistentContactManifold::drawLine(PxRenderOutput& out, const PxVec3 p0, const PxVec3 p1, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + + PxMat44 m = PxMat44(PxIdentity); + out << color << m << PxRenderOutput::LINES << p0 << p1; +#else + PX_UNUSED(out); + PX_UNUSED(p0); + PX_UNUSED(p1); + PX_UNUSED(color); +#endif +} + +void Gu::MultiplePersistentContactManifold::drawPoint(PxRenderOutput& out, const aos::Vec3VArg p, const PxF32 size, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + const PxVec3 up(0.f, size, 0.f); + const PxVec3 right(size, 0.f, 0.f); + const PxVec3 forwards(0.f, 0.f, size); + + PxVec3 a; + V3StoreU(p, a); + + PxMat44 m = PxMat44(PxIdentity); + + out << color << m << PxRenderOutput::LINES << a + up << a - up; + out << color << m << PxRenderOutput::LINES << a + right << a - right; + out << color << m << PxRenderOutput::LINES << a + forwards << a - forwards; +#else + PX_UNUSED(out); + PX_UNUSED(p); + PX_UNUSED(size); + PX_UNUSED(color); +#endif +} + + +void Gu::MultiplePersistentContactManifold::drawPolygon( PxRenderOutput& out, const aos::PxTransformV& transform, aos::Vec3V* points, const PxU32 numVerts, const PxU32 color) +{ + using namespace aos; +#if VISUALIZE_PERSISTENT_CONTACT + for(PxU32 i=0; iaddBatchManifoldContactsSphere(manifoldContact, numManifoldContacts, *patch, sqReplaceBreakingThreshold); + case GU_CAPSULE_MANIFOLD_CACHE_SIZE://capsule, need to implement keep two deepest + return manifold->addBatchManifoldContactsCapsule(manifoldContact, numManifoldContacts, *patch, sqReplaceBreakingThreshold); + default://cache size GU_SINGLE_MANIFOLD_CACHE_SIZE + return manifold->addBatchManifoldContactsConvex(manifoldContact, numManifoldContacts, *patch, sqReplaceBreakingThreshold); + }; +} + +/* + This function adds the manifold contacts with different patches into the corresponding single persistent contact manifold +*/ +void Gu::MultiplePersistentContactManifold::addManifoldContactPoints(MeshPersistentContact* manifoldContact, PxU32 numManifoldContacts, PCMContactPatch** contactPatch, const PxU32 numPatch, const aos::FloatVArg sqReplaceBreakingThreshold, const aos::FloatVArg acceptanceEpsilon, PxU8 maxContactsPerManifold) +{ + using namespace aos; + + if(mNumManifolds == 0) + { + for(PxU32 i=0; imRoot == patch) + { + + SinglePersistentContactManifold* manifold = getEmptyManifold(); + if(manifold) + { + const FloatV _maxPen = addBatchManifoldContactsToSingleManifold(manifold, manifoldContact, numManifoldContacts, patch, sqReplaceBreakingThreshold, maxContactsPerManifold); + FStore(_maxPen, &mMaxPen[mManifoldIndices[mNumManifolds]]); + mNumManifolds++; + } + else + { + //We already pre-sorted the patches so we know we can return here + return; + } + + } + } + + + } + else + { + //we do processContacts() when the number of contacts are more than 16, such that, we might call processContacts() multiple times when we have very detailed mesh + //or very large contact offset/objects. In this case, the mNumManifolds will be large than 0. + PCMContactPatch tempPatch; + for(PxU32 i=0; imRoot == patch) + { + PX_ASSERT(mNumManifolds <= GU_MAX_MANIFOLD_SIZE); + for(PxU32 j=0; jmPatchNormal, pNor); + + if(FAllGrtrOrEq(d, acceptanceEpsilon)) + { + //appending the existing contacts to the manifold contact stream + for(PxU32 k=0; k< manifold.mNumContacts; ++k) + { + PxU32 index = k + numManifoldContacts; + //not duplicate point + PX_ASSERT(index < 64); + manifoldContact[index] = manifold.mContactPoints[k]; + } + + //create a new patch for the exiting manifold + tempPatch.mStartIndex = numManifoldContacts; + tempPatch.mEndIndex = numManifoldContacts + manifold.mNumContacts; + tempPatch.mPatchNormal = pNor;//manifold.getLocalNormal(); + tempPatch.mRoot = patch; + tempPatch.mNextPatch = NULL; + + patch->mEndPatch->mNextPatch = &tempPatch; + + //numManifoldContacts += manifold.numContacts; + patch->mTotalSize += manifold.mNumContacts; + patch->mPatchMaxPen = FMin(patch->mPatchMaxPen, FLoad(mMaxPen[mManifoldIndices[j]])); + + //manifold.numContacts = 0; + + PX_ASSERT((numManifoldContacts+manifold.mNumContacts) <= 64); + const FloatV _maxPen = addBatchManifoldContactsToSingleManifold(&manifold, manifoldContact, numManifoldContacts+manifold.mNumContacts, patch, sqReplaceBreakingThreshold, maxContactsPerManifold); + FStore(_maxPen, &mMaxPen[mManifoldIndices[j]]); + found = true; + break; + } + } + + if(!found)// && numManifolds < 4) + { + SinglePersistentContactManifold* manifold = getEmptyManifold(); + //we still have slot to create a new manifold + if(manifold) + { + const FloatV _maxPen = addBatchManifoldContactsToSingleManifold(manifold, manifoldContact, numManifoldContacts, patch, sqReplaceBreakingThreshold, maxContactsPerManifold); + FStore(_maxPen, &mMaxPen[mManifoldIndices[mNumManifolds]]); + mNumManifolds++; + } + else + { + //we can't allocate a new manifold and no existing manifold has the same normal as this patch, we need to find the shallowest penetration manifold. If this manifold is shallower than + //the current patch, replace the manifold with the current patch + PxU32 index = 0; + for(PxU32 j=1; j mMaxPen[mManifoldIndices[index]]) + { + index = j; + } + } + + if(FAllGrtr(FLoad(mMaxPen[mManifoldIndices[index]]), patch->mPatchMaxPen)) + { + manifold = getManifold(index); + manifold->mNumContacts = 0; + const FloatV _maxPen = addBatchManifoldContactsToSingleManifold(manifold, manifoldContact, numManifoldContacts, patch, sqReplaceBreakingThreshold, maxContactsPerManifold); + FStore(_maxPen, &mMaxPen[mManifoldIndices[index]]); + + } + return; + } + } + } + } + } +} + +//This function adds the multi manifold contacts to the contact buffer for box/convexhull +bool Gu::MultiplePersistentContactManifold::addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::PxTransformV& meshTransform) +{ + using namespace aos; + PxU32 contactCount = 0;//contactBuffer.count; + PxU32 numContacts = 0; + mNumTotalContacts = 0; + //drawManifold(*gRenderOutPut, convexTransform, meshTransform); + for(PxU32 i=0; i < mNumManifolds; ++i) + { + Gu::SinglePersistentContactManifold& manifold = *getManifold(i); + numContacts = manifold.getNumContacts(); + PX_ASSERT(mNumTotalContacts + numContacts <= 0xFF); + mNumTotalContacts += PxTo8(numContacts); + const Vec3V normal = manifold.getWorldNormal(meshTransform); + + for(PxU32 j=0; (j< numContacts) & (contactCount < PxContactBuffer::MAX_CONTACTS); ++j) + { + Gu::MeshPersistentContact& p = manifold.getContactPoint(j); + + const Vec3V worldP =meshTransform.transform(p.mLocalPointB); + const FloatV dist = V4GetW(p.mLocalNormalPen); + + PxContactPoint& contact = contactBuffer.contacts[contactCount++]; + //Fast allign store + V4StoreA(Vec4V_From_Vec3V(normal), reinterpret_cast(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldP), reinterpret_cast(&contact.point.x)); + FStore(dist, &contact.separation); + + contact.internalFaceIndex1 = p.mFaceIndex; + + } + } + + PX_ASSERT(contactCount <= 64); + contactBuffer.count = contactCount; + return contactCount > 0; +} + +//This function adds the multi manifold contacts to the contact buffer for sphere and capsule, radius is corresponding to the sphere radius/capsule radius +bool Gu::MultiplePersistentContactManifold::addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::PxTransformV& trA, const aos::PxTransformV& trB, const aos::FloatVArg radius) +{ + using namespace aos; + PxU32 contactCount = 0; + PxU32 numContacts = 0; + mNumTotalContacts = 0; + + for(PxU32 i=0; i < mNumManifolds; ++i) + { + //get a single manifold + Gu::SinglePersistentContactManifold& manifold = *getManifold(i); + numContacts = manifold.getNumContacts(); + PX_ASSERT(mNumTotalContacts + numContacts <= 0xFF); + mNumTotalContacts += PxTo8(numContacts); + const Vec3V normal = manifold.getWorldNormal(trB); + + //iterate all the contacts in this single manifold and add contacts to the contact buffer + //each manifold contact point store two points which are in each other's local space. In this + //case, mLocalPointA is stored as the center of sphere/a point in the segment for capsule + for(PxU32 j=0; (j< numContacts) & (contactCount < PxContactBuffer::MAX_CONTACTS); ++j) + { + Gu::MeshPersistentContact& p = manifold.getContactPoint(j); + + const Vec3V worldP =V3NegScaleSub(normal, radius, trA.transform(p.mLocalPointA)); + const FloatV dist = FSub(V4GetW(p.mLocalNormalPen), radius); + + PxContactPoint& contact = contactBuffer.contacts[contactCount++]; + //Fast allign store + V4StoreA(Vec4V_From_Vec3V(normal), reinterpret_cast(&contact.normal.x)); + V4StoreA(Vec4V_From_Vec3V(worldP), reinterpret_cast(&contact.point.x)); + FStore(dist, &contact.separation); + + contact.internalFaceIndex1 = p.mFaceIndex; + + } + } + + PX_ASSERT(contactCount <= 64); + contactBuffer.count = contactCount; + return contactCount > 0; +} + + +/* + This function copies the mesh persistent contact from compress buffer(NpCacheStreamPair in the PxcNpThreadContext) to the multiple manifold +*/ +// PT: function moved to cpp to go around a compiler bug on PS4 +void physx::Gu::MultiplePersistentContactManifold::fromBuffer(PxU8* PX_RESTRICT buffer) +{ + using namespace aos; + PxU32 numManifolds = 0; + if (buffer != NULL) + { + PX_ASSERT(((uintptr_t(buffer)) & 0xF) == 0); + PxU8* PX_RESTRICT buff = buffer; + MultiPersistentManifoldHeader* PX_RESTRICT header = reinterpret_cast(buff); + buff += sizeof(MultiPersistentManifoldHeader); + + numManifolds = header->mNumManifolds; + + PX_ASSERT(numManifolds <= GU_MAX_MANIFOLD_SIZE); + mRelativeTransform = header->mRelativeTransform; + + for (PxU32 a = 0; a < numManifolds; ++a) + { + mManifoldIndices[a] = PxU8(a); + SingleManifoldHeader* PX_RESTRICT manHeader = reinterpret_cast(buff); + buff += sizeof(SingleManifoldHeader); + PxU32 numContacts = manHeader->mNumContacts; + PX_ASSERT(numContacts <= GU_SINGLE_MANIFOLD_CACHE_SIZE); + SinglePersistentContactManifold& manifold = mManifolds[a]; + manifold.mNumContacts = numContacts; + PX_ASSERT((uintptr_t(buff) & 0xf) == 0); + CachedMeshPersistentContact* contacts = reinterpret_cast(buff); + for (PxU32 b = 0; b < manifold.mNumContacts; ++b) + { + manifold.mContactPoints[b].mLocalPointA = Vec3V_From_Vec4V(V4LoadA(&contacts[b].mLocalPointA.x)); + manifold.mContactPoints[b].mLocalPointB = Vec3V_From_Vec4V(V4LoadA(&contacts[b].mLocalPointB.x)); + manifold.mContactPoints[b].mLocalNormalPen = V4LoadA(&contacts[b].mLocalNormal.x); + manifold.mContactPoints[b].mFaceIndex = contacts[b].mFaceIndex; + } + buff += sizeof(Gu::CachedMeshPersistentContact) * numContacts; + } + } + else + { + mRelativeTransform.Invalidate(); + } + mNumManifolds = PxU8(numManifolds); + for (PxU32 a = numManifolds; a < GU_MAX_MANIFOLD_SIZE; ++a) + { + mManifoldIndices[a] = PxU8(a); + } +} + +void Gu::addManifoldPoint(Gu::PersistentContact* manifoldContacts, Gu::PersistentContactManifold& manifold, GjkOutput& output, + const aos::PxMatTransformV& aToB, const aos::FloatV replaceBreakingThreshold) +{ + using namespace aos; + + const Vec3V localPointA = aToB.transformInv(output.closestA); + const Vec4V localNormalPen = V4SetW(Vec4V_From_Vec3V(output.normal), output.penDep); + + //Add contact to contact stream + manifoldContacts[0].mLocalPointA = localPointA; + manifoldContacts[0].mLocalPointB = output.closestB; + manifoldContacts[0].mLocalNormalPen = localNormalPen; + + //Add contact to manifold + manifold.addManifoldPoint(localPointA, output.closestB, localNormalPen, replaceBreakingThreshold); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.h new file mode 100644 index 0000000..86f33a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/pcm/GuPersistentContactManifold.h @@ -0,0 +1,882 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef Gu_PERSISTENTCONTACTMANIFOLD_H +#define Gu_PERSISTENTCONTACTMANIFOLD_H + +#include "common/PxPhysXCommonConfig.h" +#include "foundation/PxUnionCast.h" +#include "foundation/PxMemory.h" +#include "foundation/PxVecTransform.h" + +#define PCM_LOW_LEVEL_DEBUG 0 + +namespace physx +{ + +#define VISUALIZE_PERSISTENT_CONTACT 1 +//This is for pritimives vs primitives +#define GU_MANIFOLD_CACHE_SIZE 4 +//These are for pritimives vs mesh +#define GU_SINGLE_MANIFOLD_SINGLE_POLYGONE_CACHE_SIZE 5 +#define GU_SINGLE_MANIFOLD_CACHE_SIZE 6 +#define GU_SPHERE_MANIFOLD_CACHE_SIZE 1 +#define GU_CAPSULE_MANIFOLD_CACHE_SIZE 3 +#define GU_MAX_MANIFOLD_SIZE 6 +#define GU_MESH_CONTACT_REDUCTION_THRESHOLD 16 + +#define GU_MANIFOLD_INVALID_INDEX 0xffffffff + + +//ML: this is used to compared with the shape's margin to decide the final tolerance used in the manifold to validate the existing contacts. +//In the case of big shape and relatively speaking small triangles in the mesh, we need to take a smaller margin. This helps because the PCM +//recycling thresholds are proportionate to margin so it makes it less likely to discard previous contacts due to separation +#define GU_PCM_MESH_MANIFOLD_EPSILON 0.05f + +class PxRenderOutput; +class PxContactBuffer; + +namespace Gu +{ + struct GjkOutput; + +extern const PxF32 invalidateThresholds[5]; +extern const PxF32 invalidateQuatThresholds[5]; +extern const PxF32 invalidateThresholds2[3]; +extern const PxF32 invalidateQuatThresholds2[3]; + + +aos::Mat33V findRotationMatrixFromZAxis(const aos::Vec3VArg to); + +//This contact is used in the primitives vs primitives contact gen +class PersistentContact +{ +public: + PersistentContact() + { + } + + PersistentContact(aos::Vec3V _localPointA, aos::Vec3V _localPointB, aos::Vec4V _localNormalPen) : + mLocalPointA(_localPointA), mLocalPointB(_localPointB), mLocalNormalPen(_localNormalPen) + { + + } + + aos::Vec3V mLocalPointA; + aos::Vec3V mLocalPointB; + aos::Vec4V mLocalNormalPen; // the (x, y, z) is the local normal, and the w is the penetration depth +}; + +//This contact is used in the mesh contact gen to store an extra variable +class MeshPersistentContact : public PersistentContact +{ +public: + PxU32 mFaceIndex; +}; + +//This contact is used in the compress stream buffer(NpCacheStreamPair in the PxcNpThreadContext) to store the data we need +PX_ALIGN_PREFIX(16) +class CachedMeshPersistentContact +{ +public: + PxVec3 mLocalPointA; //16 byte aligned + PxU32 mFaceIndex; //face index + PxVec3 mLocalPointB; //16 byte aligned + PxU32 mPad; //pad + PxVec3 mLocalNormal; //16 byte aligned + PxReal mPen; //penetration +}PX_ALIGN_SUFFIX(16); + + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + +//This class is used to store the start and end index of the mesh persistent contacts in an array. +struct PCMContactPatch +{ +public: + PCMContactPatch() + { + mNextPatch = NULL; + mEndPatch = NULL; + mRoot = this; + mPatchMaxPen = aos::FMax(); + } + aos::Vec3V mPatchNormal; + PCMContactPatch* mNextPatch;//store the next patch pointer in the patch list + PCMContactPatch* mEndPatch;//store the last patch pointer in the patch list + PCMContactPatch* mRoot;//if this is the start of the patch list which has very similar patch normal, the root will be itself + aos::FloatV mPatchMaxPen;//store the deepest penetration of the whole patch + PxU32 mStartIndex;//store the start index of the manifold contacts in the manifold contacts stream + PxU32 mEndIndex;//store the end index of the manifold contacts in the manifold contacts stream + PxU32 mTotalSize;//if this is the root, the total size will store the total number of manifold contacts in the whole patch list +}; + +#if PX_VC + #pragma warning(pop) +#endif + +//ML: this is needed because it seems NEON doesn't force the alignment on SIMD type, which cause some of the PCM unit tests fail +PX_ALIGN_PREFIX(16) +class PersistentContactManifold +{ +public: + + PersistentContactManifold(PersistentContact* contactPointsBuff, PxU8 capacity): mNumContacts(0), mCapacity(capacity), mNumWarmStartPoints(0), mContactPoints(contactPointsBuff) + { + using namespace physx::aos; + mRelativeTransform.Invalidate(); + mQuatA = QuatIdentity(); + mQuatB = QuatIdentity(); + } + + PX_FORCE_INLINE PxU32 getNumContacts() const { return mNumContacts;} + + PX_FORCE_INLINE bool isEmpty() { return mNumContacts==0; } + + PX_FORCE_INLINE PersistentContact& getContactPoint(const PxU32 index) + { + PX_ASSERT(index < GU_MANIFOLD_CACHE_SIZE); + return mContactPoints[index]; + } + + PX_FORCE_INLINE aos::FloatV maxTransformdelta(const aos::PxTransformV& curTransform) + { + using namespace aos; + const Vec4V p0 = Vec4V_From_Vec3V(mRelativeTransform.p); + const Vec4V q0 = mRelativeTransform.q; + const Vec4V p1 = Vec4V_From_Vec3V(curTransform.p); + const Vec4V q1 = curTransform.q; + + const Vec4V dp = V4Abs(V4Sub(p1, p0)); + const Vec4V dq = V4Abs(V4Sub(q1, q0)); + + const Vec4V max0 = V4Max(dp, dq); + + //need to work out max from a single vector... + return V4ExtractMax(max0); + } + + PX_FORCE_INLINE aos::Vec4V maxTransformdelta2(const aos::PxTransformV& curTransform) + { + using namespace aos; + const Vec4V p0 = Vec4V_From_Vec3V(mRelativeTransform.p); + const Vec4V q0 = mRelativeTransform.q; + const Vec4V p1 = Vec4V_From_Vec3V(curTransform.p); + const Vec4V q1 = curTransform.q; + + const Vec4V dp = V4Abs(V4Sub(p1, p0)); + const Vec4V dq = V4Abs(V4Sub(q1, q0)); + + const Vec4V max0 = V4Max(dp, dq); + + //need to work out max from a single vector... + return max0; + } + + PX_FORCE_INLINE aos::FloatV maxTransformPositionDelta(const aos::Vec3V& curP) + { + using namespace aos; + + const Vec3V deltaP = V3Sub(curP, mRelativeTransform.p); + const Vec4V delta = Vec4V_From_Vec3V(V3Abs(deltaP)); + //need to work out max from a single vector... + return V4ExtractMax(delta); + } + + PX_FORCE_INLINE aos::FloatV maxTransformQuatDelta(const aos::QuatV& curQ) + { + using namespace aos; + + const Vec4V deltaQ = V4Sub(curQ, mRelativeTransform.q); + const Vec4V delta = V4Abs(deltaQ); + //need to work out max from a single vector... + return V4ExtractMax(delta); + } + + PX_FORCE_INLINE void setRelativeTransform(const aos::PxTransformV& transform) + { + mRelativeTransform = transform; + } + + PX_FORCE_INLINE void setRelativeTransform(const aos::PxTransformV& transform, const aos::QuatV quatA, const aos::QuatV quatB) + { + mRelativeTransform = transform; + mQuatA = quatA; + mQuatB = quatB; + } + + //This is used for the box/convexhull vs box/convexhull contact gen to decide whether the relative movement of a pair of objects are + //small enough. In this case, we can skip the collision detection all together + PX_FORCE_INLINE PxU32 invalidate_BoxConvex(const aos::PxTransformV& curRTrans, const aos::QuatV& quatA, const aos::QuatV& quatB, + const aos::FloatVArg minMargin, const aos::FloatVArg radiusA, const aos::FloatVArg radiusB) + { + using namespace aos; + PX_ASSERT(mNumContacts <= GU_MANIFOLD_CACHE_SIZE); + const FloatV ratio = FLoad(invalidateThresholds[mNumContacts]); + const FloatV thresholdP = FMul(minMargin, ratio); + const FloatV deltaP = maxTransformPositionDelta(curRTrans.p); + + const FloatV thresholdQ = FLoad(invalidateQuatThresholds[mNumContacts]); + const FloatV deltaQA = QuatDot(quatA, mQuatA); + const FloatV deltaQB = QuatDot(quatB, mQuatB); + + const BoolV con0 = BOr(FIsGrtr(deltaP, thresholdP), BOr(FIsGrtr(thresholdQ, deltaQA), FIsGrtr(thresholdQ, deltaQB))); + PxU32 generateContacts = BAllEqTTTT(con0); + if (!generateContacts) + { + + PxReal dqA, dqB; + FStore(deltaQA, &dqA); + FStore(deltaQB, &dqB); + + const PxReal aRadian = dqA < 1.0f ? PxAcos(dqA) : 0.f; + const FloatV travelDistA = FMul(FLoad(aRadian), radiusA); + + const PxReal bRadian = dqB < 1.0f ? PxAcos(dqB) : 0.f; + const FloatV travelDistB = FMul(FLoad(bRadian), radiusB); + + + const BoolV con = BOr(FIsGrtr(travelDistA, thresholdP), FIsGrtr(travelDistB, thresholdP)); + + generateContacts = BAllEqTTTT(con); + } + + return generateContacts; + } + + //This is used for the sphere/capsule vs other primitives contact gen to decide whether the relative movement of a pair of objects are + //small enough. In this case, we can skip the collision detection all together + PX_FORCE_INLINE PxU32 invalidate_SphereCapsule(const aos::PxTransformV& curRTrans, const aos::FloatVArg minMargin) + { + using namespace aos; + PX_ASSERT(mNumContacts <= 2); + const FloatV ratio = FLoad(invalidateThresholds2[mNumContacts]); + + const FloatV thresholdP = FMul(minMargin, ratio); + const FloatV deltaP = maxTransformPositionDelta(curRTrans.p); + + const FloatV thresholdQ = FLoad(invalidateQuatThresholds2[mNumContacts]); + const FloatV deltaQ = QuatDot(curRTrans.q, mRelativeTransform.q); + const BoolV con = BOr(FIsGrtr(deltaP, thresholdP), FIsGrtr(thresholdQ, deltaQ)); + + return BAllEqTTTT(con); + } + + //This is used for plane contact gen to decide whether the relative movement of a pair of objects are small enough. In this case, + //we can skip the collision detection all together + PX_FORCE_INLINE PxU32 invalidate_PrimitivesPlane(const aos::PxTransformV& curRTrans, const aos::FloatVArg minMargin, const aos::FloatVArg ratio) + { + using namespace aos; + const FloatV thresholdP = FMul(minMargin, ratio); + const FloatV deltaP = maxTransformPositionDelta(curRTrans.p); + + const FloatV thresholdQ = FLoad(0.99996f);//about 0.5 degree + const FloatV deltaQ = QuatDot(curRTrans.q, mRelativeTransform.q); + const BoolV con = BOr(FIsGrtr(deltaP, thresholdP), FIsGrtr(thresholdQ, deltaQ)); + + return BAllEqTTTT(con); + } + + PX_FORCE_INLINE void removeContactPoint (PxU32 index) + { + mNumContacts--; + mContactPoints[index] = mContactPoints[mNumContacts]; + } + + bool validContactDistance(const PersistentContact& pt, const aos::FloatVArg breakingThreshold) const + { + using namespace aos; + const FloatV dist = V4GetW(pt.mLocalNormalPen); + return FAllGrtr(breakingThreshold, dist) != 0; + } + + PX_FORCE_INLINE void clearManifold() + { + mNumWarmStartPoints = 0; + mNumContacts = 0; + mRelativeTransform.Invalidate(); + } + + PX_FORCE_INLINE void initialize() + { + clearManifold(); + } + + //This function is used to replace the existing contact with the newly created contact if their distance are within some threshold + bool replaceManifoldPoint(const aos::Vec3VArg localPointA, const aos::Vec3VArg localPointB, const aos::Vec4VArg localNormalPen, const aos::FloatVArg replaceBreakingThreshold); + + //This function is to add a point(in box/convexhull contact gen) to the exising manifold. If the number of manifold is more than 4, we need to do contact reduction + PxU32 addManifoldPoint( const aos::Vec3VArg localPointA, const aos::Vec3VArg localPointB, const aos::Vec4VArg localNormalAPen, const aos::FloatVArg replaceBreakingThreshold); + //This function is to add a point(in capsule contact gen) to the exising manifold. If the number of manifold is more than 4, we need to do contact reduction + PxU32 addManifoldPoint2( const aos::Vec3VArg localPointA, const aos::Vec3VArg localPointB, const aos::Vec4VArg localNormalAPen, const aos::FloatVArg replaceBreakingThreshold);//max two points of contacts + //This function is used in box-plane contact gen to add the plane contacts to the manifold + void addBatchManifoldContactsCluster( const PersistentContact* manifoldPoints, const PxU32 numPoints); + + //This function is used in the capsule full manifold contact genenation(maximum 2 points). + void addBatchManifoldContacts2( const PersistentContact* manifoldPoints, const PxU32 numPoints);//max two points of contacts + + //This function is used in the box/convexhull full manifold contact generation(maximum 4 points). + void addBatchManifoldContacts(const PersistentContact* manifoldPoints, const PxU32 numPoints, const PxReal toleranceLength); + //This function is using the cluster algorithm to reduce contacts + void reduceBatchContactsCluster(const PersistentContact* manifoldPoints, const PxU32 numPoints); + //This function is called by addBatchManifoldContacts2 to reduce the manifold contacts to 2 points; + void reduceBatchContacts2(const PersistentContact* manifoldPoints, const PxU32 numPoints); + //This function is called by addBatchManifoldContacts to reduce the manifold contacts to 4 points + void reduceBatchContacts(const PersistentContact* manifoldPoints, const PxU32 numPoints, const PxReal toleranceLength); + + + //This function is used for incremental manifold contact reduction for box/convexhull + PxU32 reduceContactsForPCM(const aos::Vec3VArg localPointA, const aos::Vec3VArg localPointB, const aos::Vec4VArg localNormalPen); + //This function is used for incremental manifold contact reduction for capsule + PxU32 reduceContactSegment(const aos::Vec3VArg localPointA, const aos::Vec3VArg localPointB, const aos::Vec4VArg localNormalPen); + + + /* + This function recalculate the contacts in the manifold based on the current relative transform between a pair of objects. If the recalculated contacts are within some threshold, + we will keep the contacts; Otherwise, we will remove the contacts. + */ + void refreshContactPoints(const aos::PxMatTransformV& relTra, const aos::FloatVArg projectBreakingThreshold, const aos::FloatVArg contactOffset); + //This function is just used in boxbox contact gen for fast transform + void addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg normal, const aos::PxMatTransformV& transf1); + //This function is for adding box/convexhull manifold contacts to the contact buffer + void addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg normal, const aos::PxTransformV& transf1, const aos::FloatVArg contactOffset); + //This function is for adding sphere/capsule manifold contacts to the contact buffer + void addManifoldContactsToContactBuffer(PxContactBuffer& contactBuffer, const aos::Vec3VArg normal, const aos::Vec3VArg projectionNormal, const aos::PxTransformV& transf0, const aos::FloatVArg radius, const aos::FloatVArg contactOffset); + + //get the average normal in the manifold in world space + aos::Vec3V getWorldNormal(const aos::PxTransformV& trB); + //get the average normal in the manifold in local B object space + aos::Vec3V getLocalNormal(); + + void recordWarmStart(PxU8* aIndices, PxU8* bIndices, PxU8& nbWarmStartPoints); + void setWarmStart(const PxU8* aIndices, const PxU8* bIndices, const PxU8 nbWarmStartPoints); + void drawManifold(PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB); + void drawManifold(PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB, const aos::FloatVArg radius); + void drawManifold(const PersistentContact& m, PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB); + static void drawPoint(PxRenderOutput& out, const aos::Vec3VArg p, const PxF32 size, const PxU32 color = 0x0000ff00); + static void drawLine(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const PxU32 color = 0xff00ffff); + static void drawTriangle(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2, const PxU32 color = 0xffff0000); + static void drawTetrahedron(PxRenderOutput& out, const aos::Vec3VArg p0, const aos::Vec3VArg p1, const aos::Vec3VArg p2, const aos::Vec3VArg p3, const PxU32 color = 0xffff0000); + static void drawPolygon( PxRenderOutput& out, const aos::PxTransformV& transform, aos::Vec3V* points, const PxU32 numVerts, const PxU32 color = 0xff00ffff); + static void drawPolygon( PxRenderOutput& out, const aos::PxMatTransformV& transform, aos::Vec3V* points, const PxU32 numVerts, const PxU32 color = 0xff00ffff); + + aos::PxTransformV mRelativeTransform;//aToB + aos::QuatV mQuatA; + aos::QuatV mQuatB; + PxU8 mNumContacts; + PxU8 mCapacity; + PxU8 mNumWarmStartPoints; + PxU8 mAIndice[4]; + PxU8 mBIndice[4]; + PersistentContact* mContactPoints; +} PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +class LargePersistentContactManifold : public PersistentContactManifold +{ +public: + LargePersistentContactManifold() : PersistentContactManifold(mContactPointsBuff, GU_MANIFOLD_CACHE_SIZE) + { + } + + PersistentContact mContactPointsBuff[GU_MANIFOLD_CACHE_SIZE]; +}PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +class SpherePersistentContactManifold : public PersistentContactManifold +{ +public: + SpherePersistentContactManifold() : PersistentContactManifold(mContactPointsBuff, GU_SPHERE_MANIFOLD_CACHE_SIZE) + { + } + + PersistentContact mContactPointsBuff[GU_SPHERE_MANIFOLD_CACHE_SIZE]; +}PX_ALIGN_SUFFIX(16); + +PX_ALIGN_PREFIX(16) +class SinglePersistentContactManifold +{ +public: + + SinglePersistentContactManifold(): mNumContacts(0) + { + } + + PX_FORCE_INLINE PxU32 getNumContacts() const { return mNumContacts;} + + PX_FORCE_INLINE bool isEmpty() { return mNumContacts==0; } + + PX_FORCE_INLINE MeshPersistentContact& getContactPoint(const PxU32 index) + { + PX_ASSERT(index < GU_SINGLE_MANIFOLD_CACHE_SIZE); + return mContactPoints[index]; + } + + PX_FORCE_INLINE void removeContactPoint (PxU32 index) + { + mNumContacts--; + mContactPoints[index] = mContactPoints[mNumContacts]; + } + + PX_FORCE_INLINE void clearManifold() + { + mNumContacts = 0; + } + + PX_FORCE_INLINE void initialize() + { + clearManifold(); + } + + + PX_FORCE_INLINE aos::Vec3V getWorldNormal(const aos::PxTransformV& trB) + { + using namespace aos; + Vec4V nPen = mContactPoints[0].mLocalNormalPen; + for(PxU32 i =1; i < mNumContacts; ++i) + { + nPen = V4Add(nPen, mContactPoints[i].mLocalNormalPen); + } + + const Vec3V n = Vec3V_From_Vec4V(nPen); + return V3Normalize(trB.rotate(n)); + } + + PX_FORCE_INLINE aos::Vec3V getLocalNormal() + { + using namespace aos; + Vec4V nPen = mContactPoints[0].mLocalNormalPen; + for(PxU32 i =1; i < mNumContacts; ++i) + { + nPen = V4Add(nPen, mContactPoints[i].mLocalNormalPen); + } + return V3Normalize(Vec3V_From_Vec4V(nPen)); + } + + //This function reduces the manifold contact list in a patch for box/convexhull vs mesh + aos::FloatV reduceBatchContactsConvex(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch); + //This function reduces the manifold contact list in a patch for sphere vs mesh + aos::FloatV reduceBatchContactsSphere(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch); + //This function reduces the manifold contact list in a pathc for capsuel vs mesh + aos::FloatV reduceBatchContactsCapsule(const MeshPersistentContact* manifoldContactExt, const PxU32 numContacts, PCMContactPatch& patch); + + //This function adds the manifold contact list in a patch for box/convexhull vs mesh + aos::FloatV addBatchManifoldContactsConvex(const MeshPersistentContact* manifoldContact, const PxU32 numContacts, PCMContactPatch& patch, const aos::FloatVArg replaceBreakingThreshold); + //This function adds the manifold contact list in a patch for sphere vs mesh + aos::FloatV addBatchManifoldContactsSphere(const MeshPersistentContact* manifoldContact, const PxU32 numContacts, PCMContactPatch& patch, const aos::FloatVArg replaceBreakingThreshold); + //This function adds the manifold contact list in a patch for capsule vs mesh + aos::FloatV addBatchManifoldContactsCapsule(const MeshPersistentContact* manifoldContact, const PxU32 numContacts, PCMContactPatch& patch, const aos::FloatVArg replaceBreakingThreshold); + + //This is used for in the addContactsToPatch for convex mesh contact gen. + static PxU32 reduceContacts(MeshPersistentContact* manifoldContactExt, PxU32 numContacts); + + //This function is to recalculate the contacts based on the relative transform between a pair of objects + aos::FloatV refreshContactPoints(const aos::PxMatTransformV& relTra, const aos::FloatVArg projectBreakingThreshold, const aos::FloatVArg contactOffset); + + void drawManifold(PxRenderOutput& out, const aos::PxTransformV& trA, const aos::PxTransformV& trB); + + MeshPersistentContact mContactPoints[GU_SINGLE_MANIFOLD_CACHE_SIZE];//384 bytes + PxU32 mNumContacts;//400 bytes + +} PX_ALIGN_SUFFIX(16); + +//This is a structure used to cache a multi-persistent-manifold in the cache stream +struct MultiPersistentManifoldHeader +{ + aos::PxTransformV mRelativeTransform;//aToB + PxU32 mNumManifolds; + PxU32 pad[3]; +}; + +struct SingleManifoldHeader +{ + PxU32 mNumContacts; + PxU32 pad[3]; +}; + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4251 ) // class needs to have dll-interface to be used by clients of class +#endif + +PX_ALIGN_PREFIX(16) +class PX_PHYSX_COMMON_API MultiplePersistentContactManifold +{ +public: + MultiplePersistentContactManifold():mNumManifolds(0), mNumTotalContacts(0) + { + mRelativeTransform.Invalidate(); + } + + PX_FORCE_INLINE void setRelativeTransform(const aos::PxTransformV& transform) + { + mRelativeTransform = transform; + } + + PX_FORCE_INLINE aos::FloatV maxTransformPositionDelta(const aos::Vec3V& curP) + { + using namespace aos; + + const Vec3V deltaP = V3Sub(curP, mRelativeTransform.p); + const Vec4V delta = Vec4V_From_Vec3V(V3Abs(deltaP)); + //need to work out max from a single vector... + return V4ExtractMax(delta); + } + + PX_FORCE_INLINE aos::FloatV maxTransformQuatDelta(const aos::QuatV& curQ) + { + using namespace aos; + + const Vec4V deltaQ = V4Sub(curQ, mRelativeTransform.q); + const Vec4V delta = V4Abs(deltaQ); + //need to work out max from a single vector... + return V4ExtractMax(delta); + } + + PX_FORCE_INLINE PxU32 invalidate(const aos::PxTransformV& curRTrans, const aos::FloatVArg minMargin, const aos::FloatVArg ratio) + { + using namespace aos; + + const FloatV thresholdP = FMul(minMargin, ratio); + const FloatV deltaP = maxTransformPositionDelta(curRTrans.p); + const FloatV thresholdQ = FLoad(0.9998f);//about 1 degree + const FloatV deltaQ = QuatDot(curRTrans.q, mRelativeTransform.q); + const BoolV con = BOr(FIsGrtr(deltaP, thresholdP), FIsGrtr(thresholdQ, deltaQ)); + + return BAllEqTTTT(con); + } + + PX_FORCE_INLINE PxU32 invalidate(const aos::PxTransformV& curRTrans, const aos::FloatVArg minMargin) + { + using namespace aos; + return invalidate(curRTrans, minMargin, FLoad(0.2f)); + } + + /* + This function work out the contact patch connectivity. If two patches's normal are within 5 degree, we would link these two patches together and reset the total size. + */ + PX_FORCE_INLINE void refineContactPatchConnective(PCMContactPatch** contactPatch, PxU32 numContactPatch, MeshPersistentContact* manifoldContacts, const aos::FloatVArg acceptanceEpsilon) + { + PX_UNUSED(manifoldContacts); + + using namespace aos; + + //work out the contact patch connectivity, the patchNormal should be in the local space of mesh + for(PxU32 i=0; imRoot = patch; + patch->mEndPatch = patch; + patch->mTotalSize = patch->mEndIndex - patch->mStartIndex; + patch->mNextPatch = NULL; + + for(PxU32 j=i; j>0; --j) + { + PCMContactPatch* other = contactPatch[j-1]; + const FloatV d = V3Dot(patch->mPatchNormal, other->mRoot->mPatchNormal); + if(FAllGrtrOrEq(d, acceptanceEpsilon))//less than 5 degree + { + + other->mNextPatch = patch; + other->mRoot->mEndPatch = patch; + patch->mRoot = other->mRoot; + other->mRoot->mTotalSize += patch->mEndIndex - patch->mStartIndex; + break; + } + } + } + } + + + /* + This function uses to reduce the manifold contacts which are in different connected patchs but are within replace breaking threshold + */ + PX_FORCE_INLINE PxU32 reduceManifoldContactsInDifferentPatches(PCMContactPatch** contactPatch, PxU32 numContactPatch, MeshPersistentContact* manifoldContacts, PxU32 numContacts, const aos::FloatVArg sqReplaceBreaking) + { + using namespace aos; + + for(PxU32 i=0; imRoot == currentPatch) + { + while(currentPatch) + { + PCMContactPatch* nextPatch = currentPatch->mNextPatch; + if(nextPatch) + { + for(PxU32 k = currentPatch->mStartIndex; kmEndIndex; ++k) + { + for(PxU32 l = nextPatch->mStartIndex; l < nextPatch->mEndIndex; ++l) + { + Vec3V dif = V3Sub(manifoldContacts[l].mLocalPointB, manifoldContacts[k].mLocalPointB); + FloatV d = V3Dot(dif, dif); + if(FAllGrtr(sqReplaceBreaking, d)) + { + //if two manifold contacts are within threshold, we will get rid of the manifold contacts in the other contact patch + manifoldContacts[l] = manifoldContacts[nextPatch->mEndIndex-1]; + nextPatch->mEndIndex--; + numContacts--; + l--; + } + } + } + } + currentPatch = nextPatch; + } + } + } + + return numContacts; + } + + + /* + This function is for the multiple manifold loop through each individual single manifold to recalculate the contacts based on the relative transform between a pair of objects + */ + PX_FORCE_INLINE void refreshManifold(const aos::PxMatTransformV& relTra, const aos::FloatVArg projectBreakingThreshold, const aos::FloatVArg contactDist) + { + using namespace aos; + + //refresh manifold contacts + for(PxU32 i=0; i < mNumManifolds; ++i) + { + PxU8 ind = mManifoldIndices[i]; + PX_ASSERT(mManifoldIndices[i] < GU_MAX_MANIFOLD_SIZE); + PxU32 nextInd = PxMin(i, mNumManifolds-2u)+1; + PxPrefetchLine(&mManifolds[mManifoldIndices[nextInd]]); + PxPrefetchLine(&mManifolds[mManifoldIndices[nextInd]],128); + PxPrefetchLine(&mManifolds[mManifoldIndices[nextInd]],256); + FloatV _maxPen = mManifolds[ind].refreshContactPoints(relTra, projectBreakingThreshold, contactDist); + if(mManifolds[ind].isEmpty()) + { + //swap the index with the next manifolds + PxU8 index = mManifoldIndices[--mNumManifolds]; + mManifoldIndices[mNumManifolds] = ind; + mManifoldIndices[i] = index; + i--; + } + else + { + FStore(_maxPen, &mMaxPen[ind]); + } + } + } + + + PX_FORCE_INLINE void initialize() + { + mNumManifolds = 0; + mNumTotalContacts = 0; + mRelativeTransform.Invalidate(); + for(PxU8 i=0; i 0; --i) + { + PersistentContact& manifoldPoint = mContactPoints[i-1]; + const Vec3V localAInB = aToB.transform( manifoldPoint.mLocalPointA ); // from a to b + const Vec3V localBInB = manifoldPoint.mLocalPointB; + const Vec3V v = V3Sub(localAInB, localBInB); + + const Vec3V localNormal = Vec3V_From_Vec4V(manifoldPoint.mLocalNormalPen); // normal in b space + const FloatV dist= V3Dot(v, localNormal); + + const Vec3V projectedPoint = V3NegScaleSub(localNormal, dist, localAInB);//manifoldPoint.worldPointA - manifoldPoint.worldPointB * manifoldPoint.m_distance1; + const Vec3V projectedDifference = V3Sub(localBInB, projectedPoint); + + const FloatV distance2d = V3Dot(projectedDifference, projectedDifference); + //const BoolV con = BOr(FIsGrtr(dist, contactOffset), FIsGrtr(distance2d, sqProjectBreakingThreshold)); + const BoolV con = FIsGrtr(distance2d, sqProjectBreakingThreshold); + if(BAllEqTTTT(con)) + { + removeContactPoint(i-1); + } + else + { + manifoldPoint.mLocalNormalPen = V4SetW(Vec4V_From_Vec3V(localNormal), dist); + } + } +} + +/* + This function copies the mesh persistent contact from the multiple manifold to compress buffer(NpCacheStreamPair in the PxcNpThreadContext) +*/ +PX_INLINE void MultiplePersistentContactManifold::toBuffer(PxU8* PX_RESTRICT buffer) +{ + using namespace aos; + PxU8* buff = buffer; + + PX_ASSERT(((uintptr_t(buff)) & 0xF) == 0); + MultiPersistentManifoldHeader* PX_RESTRICT header = reinterpret_cast(buff); + buff += sizeof(MultiPersistentManifoldHeader); + + PX_ASSERT(mNumManifolds <= GU_MAX_MANIFOLD_SIZE); + header->mNumManifolds = mNumManifolds; + header->mRelativeTransform = mRelativeTransform; + + for(PxU32 a = 0; a < mNumManifolds; ++a) + { + SingleManifoldHeader* manHeader = reinterpret_cast(buff); + buff += sizeof(SingleManifoldHeader); + SinglePersistentContactManifold& manifold = *getManifold(a); + manHeader->mNumContacts = manifold.mNumContacts; + PX_ASSERT((uintptr_t(buff) & 0xf) == 0); + CachedMeshPersistentContact* contacts = reinterpret_cast(buff); + //convert the mesh persistent contact to cached mesh persistent contact to save 16 byte memory per contact + for(PxU32 b = 0; b(contactPoint)) //this is used in the normal pcm contact gen +#define PX_CP_TO_MPCP(contactPoint) (reinterpret_cast(contactPoint))//this is used in the mesh pcm contact gen + +void addManifoldPoint(PersistentContact* manifoldContacts, PersistentContactManifold& manifold, GjkOutput& output, + const aos::PxMatTransformV& aToB, const aos::FloatV replaceBreakingThreshold); + +}//Gu +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp new file mode 100644 index 0000000..d9e0fd6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.cpp @@ -0,0 +1,270 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepBoxBox.h" +#include "GuBox.h" +#include "GuIntersectionBoxBox.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionEdgeEdge.h" +#include "GuSweepSharedTests.h" +#include "foundation/PxMat34.h" +#include "GuSweepTriangleUtils.h" +#include "GuInternal.h" + +using namespace physx; +using namespace Gu; + +namespace +{ +// PT: TODO: get rid of this copy +static const PxReal gFatBoxEdgeCoeff = 0.01f; + +// PT: TODO: get rid of this copy +static const PxVec3 gNearPlaneNormal[] = +{ + PxVec3(1.0f, 0.0f, 0.0f), + PxVec3(0.0f, 1.0f, 0.0f), + PxVec3(0.0f, 0.0f, 1.0f), + PxVec3(-1.0f, 0.0f, 0.0f), + PxVec3(0.0f, -1.0f, 0.0f), + PxVec3(0.0f, 0.0f, -1.0f) +}; + +#define INVSQRT2 0.707106781188f //!< 1 / sqrt(2) + +static PxVec3 EdgeNormals[] = +{ + PxVec3(0, -INVSQRT2, -INVSQRT2), // 0-1 + PxVec3(INVSQRT2, 0, -INVSQRT2), // 1-2 + PxVec3(0, INVSQRT2, -INVSQRT2), // 2-3 + PxVec3(-INVSQRT2, 0, -INVSQRT2), // 3-0 + + PxVec3(0, INVSQRT2, INVSQRT2), // 7-6 + PxVec3(INVSQRT2, 0, INVSQRT2), // 6-5 + PxVec3(0, -INVSQRT2, INVSQRT2), // 5-4 + PxVec3(-INVSQRT2, 0, INVSQRT2), // 4-7 + + PxVec3(INVSQRT2, -INVSQRT2, 0), // 1-5 + PxVec3(INVSQRT2, INVSQRT2, 0), // 6-2 + PxVec3(-INVSQRT2, INVSQRT2, 0), // 3-7 + PxVec3(-INVSQRT2, -INVSQRT2, 0) // 4-0 +}; + +// PT: TODO: get rid of this copy +static const PxVec3* getBoxLocalEdgeNormals() +{ + return EdgeNormals; +} + +/** +Returns world edge normal +\param edgeIndex [in] 0 <= edge index < 12 +\param worldNormal [out] edge normal in world space +*/ +static void computeBoxWorldEdgeNormal(const Box& box, PxU32 edgeIndex, PxVec3& worldNormal) +{ + PX_ASSERT(edgeIndex<12); + worldNormal = box.rotate(getBoxLocalEdgeNormals()[edgeIndex]); +} + +} + +// ### optimize! and refactor. And optimize for aabbs +bool Gu::sweepBoxBox(const Box& box0, const Box& box1, const PxVec3& dir, PxReal length, PxHitFlags hitFlags, PxGeomSweepHit& sweepHit) +{ + if(!(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + // PT: test if shapes initially overlap + if(intersectOBBOBB(box0.extents, box0.center, box0.rot, box1.extents, box1.center, box1.rot, true)) + { + sweepHit.flags = PxHitFlag::eNORMAL; + sweepHit.distance = 0.0f; + sweepHit.normal = -dir; + return true; + } + } + + PxVec3 boxVertices0[8]; box0.computeBoxPoints(boxVertices0); + PxVec3 boxVertices1[8]; box1.computeBoxPoints(boxVertices1); + + // float MinDist = PX_MAX_F32; + PxReal MinDist = length; + int col = -1; + + // In following VF tests: + // - the direction is FW/BK since we project one box onto the other *and vice versa* + // - the normal reaction is FW/BK for the same reason + + // Vertices1 against Box0 + { + // We need: + + // - Box0 in local space + const PxVec3 Min0 = -box0.extents; + const PxVec3 Max0 = box0.extents; + + // - Vertices1 in Box0 space + PxMat34 worldToBox0; + computeWorldToBoxMatrix(worldToBox0, box0); + + // - the dir in Box0 space + const PxVec3 localDir0 = worldToBox0.rotate(dir); + + const PxVec3* boxNormals0 = gNearPlaneNormal; + + for(PxU32 i=0; i<8; i++) + { + PxReal tnear, tfar; + const int plane = intersectRayAABB(Min0, Max0, worldToBox0.transform(boxVertices1[i]), -localDir0, tnear, tfar); + + if(plane==-1 || tnear<0.0f) + continue; + + if(tnear <= MinDist) + { + MinDist = tnear; + sweepHit.normal = box0.rotate(boxNormals0[plane]); + sweepHit.position = boxVertices1[i]; + col = 0; + } + } + } + + // Vertices0 against Box1 + { + // We need: + + // - Box1 in local space + const PxVec3 Min1 = -box1.extents; + const PxVec3 Max1 = box1.extents; + + // - Vertices0 in Box1 space + PxMat34 worldToBox1; + computeWorldToBoxMatrix(worldToBox1, box1); + + // - the dir in Box1 space + const PxVec3 localDir1 = worldToBox1.rotate(dir); + + const PxVec3* boxNormals1 = gNearPlaneNormal; + + for(PxU32 i=0; i<8; i++) + { + PxReal tnear, tfar; + const int plane = intersectRayAABB(Min1, Max1, worldToBox1.transform(boxVertices0[i]), localDir1, tnear, tfar); + + if(plane==-1 || tnear<0.0f) + continue; + + if(tnear <= MinDist) + { + MinDist = tnear; + sweepHit.normal = box1.rotate(-boxNormals1[plane]); + sweepHit.position = boxVertices0[i] + tnear * dir; + col = 1; + } + } + } + + PxVec3 p1s, p2s, p3s, p4s; + { + const PxU8* PX_RESTRICT edges0 = getBoxEdges(); + const PxU8* PX_RESTRICT edges1 = getBoxEdges(); + + PxVec3 edgeNormals0[12]; + PxVec3 edgeNormals1[12]; + for(PxU32 i=0; i<12; i++) + computeBoxWorldEdgeNormal(box0, i, edgeNormals0[i]); + for(PxU32 i=0; i<12; i++) + computeBoxWorldEdgeNormal(box1, i, edgeNormals1[i]); + + // Loop through box edges + for(PxU32 i=0; i<12; i++) // 12 edges + { + if(!(edgeNormals0[i].dot(dir) >= 0.0f)) + continue; + + // Catch current box edge // ### one vertex already known using line-strips + + // Make it fat ### + PxVec3 p1 = boxVertices0[edges0[i*2+0]]; + PxVec3 p2 = boxVertices0[edges0[i*2+1]]; + makeFatEdge(p1, p2, gFatBoxEdgeCoeff); + + // Loop through box edges + for(PxU32 j=0;j<12;j++) + { + if(edgeNormals1[j].dot(dir) >= 0.0f) + continue; + + // Orientation culling + // PT: this was commented for some reason, but it fixes the "stuck" bug reported by Ubi. + // So I put it back. We'll have to see whether it produces Bad Things in particular cases. + if(edgeNormals0[i].dot(edgeNormals1[j]) >= 0.0f) + continue; + + // Catch current box edge + + // Make it fat ### + PxVec3 p3 = boxVertices1[edges1[j*2+0]]; + PxVec3 p4 = boxVertices1[edges1[j*2+1]]; + makeFatEdge(p3, p4, gFatBoxEdgeCoeff); + + PxReal Dist; + PxVec3 ip; + if(intersectEdgeEdge(p1, p2, dir, p3, p4, Dist, ip)) + { + if(Dist<=MinDist) + { + p1s = p1; + p2s = p2; + p3s = p3; + p4s = p4; + + sweepHit.position = ip + Dist * dir; + + col = 2; + MinDist = Dist; + } + } + } + } + } + + if(col==-1) + return false; + + if(col==2) + { + computeEdgeEdgeNormal(sweepHit.normal, p1s, p2s-p1s, p3s, p4s-p3s, dir, MinDist); + sweepHit.normal.normalize(); + } + + sweepHit.flags = PxHitFlag::eNORMAL|PxHitFlag::ePOSITION; + sweepHit.distance = MinDist; + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.h new file mode 100644 index 0000000..9857866 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxBox.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_BOX_BOX_H +#define GU_SWEEP_BOX_BOX_H + +#include "foundation/PxVec3.h" +#include "PxQueryReport.h" + +namespace physx +{ +namespace Gu +{ + class Box; + + bool sweepBoxBox(const Box& box0, const Box& box1, const PxVec3& dir, PxReal length, PxHitFlags hitFlags, PxGeomSweepHit& sweepHit); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp new file mode 100644 index 0000000..5c7e732 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.cpp @@ -0,0 +1,156 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepBoxSphere.h" +#include "GuOverlapTests.h" +#include "GuSphere.h" +#include "GuBoxConversion.h" +#include "GuCapsule.h" +#include "GuIntersectionRayCapsule.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionSphereBox.h" +#include "GuDistancePointSegment.h" +#include "GuInternal.h" + +using namespace physx; +using namespace Gu; + +namespace +{ +// PT: TODO: get rid of this copy +static const PxVec3 gNearPlaneNormal[] = +{ + PxVec3(1.0f, 0.0f, 0.0f), + PxVec3(0.0f, 1.0f, 0.0f), + PxVec3(0.0f, 0.0f, 1.0f), + PxVec3(-1.0f, 0.0f, 0.0f), + PxVec3(0.0f, -1.0f, 0.0f), + PxVec3(0.0f, 0.0f, -1.0f) +}; + +} + +bool Gu::sweepBoxSphere(const Box& box, PxReal sphereRadius, const PxVec3& spherePos, const PxVec3& dir, PxReal length, PxReal& min_dist, PxVec3& normal, PxHitFlags hitFlags) +{ + if(!(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + // PT: test if shapes initially overlap + if(intersectSphereBox(Sphere(spherePos, sphereRadius), box)) + { + // Overlap + min_dist = 0.0f; + normal = -dir; + return true; + } + } + + PxVec3 boxPts[8]; + box.computeBoxPoints(boxPts); + const PxU8* PX_RESTRICT edges = getBoxEdges(); + PxReal MinDist = length; + bool Status = false; + for(PxU32 i=0; i<12; i++) + { + const PxU8 e0 = *edges++; + const PxU8 e1 = *edges++; + const Capsule capsule(boxPts[e0], boxPts[e1], sphereRadius); + + PxReal t; + if(intersectRayCapsule(spherePos, dir, capsule, t)) + { + if(t>=0.0f && t<=MinDist) + { + MinDist = t; + + const PxVec3 ip = spherePos + t*dir; + distancePointSegmentSquared(capsule, ip, &t); + + PxVec3 ip2; + capsule.computePoint(ip2, t); + + normal = (ip2 - ip); + normal.normalize(); + Status = true; + } + } + } + + PxVec3 localPt; + { + PxMat34 M2; + buildMatrixFromBox(M2, box); + + localPt = M2.rotateTranspose(spherePos - M2.p); + } + + const PxVec3* boxNormals = gNearPlaneNormal; + + const PxVec3 localDir = box.rotateInv(dir); + + // PT: when the box exactly touches the sphere, the test for initial overlap can fail on some platforms. + // In this case we reach the sweep code below, which may return a slightly negative time of impact (it should be 0.0 + // but it ends up a bit negative because of limited FPU accuracy). The epsilon ensures that we correctly detect a hit + // in this case. + const PxReal epsilon = -1e-5f; + + PxReal tnear, tfar; + + PxVec3 extents = box.extents; + extents.x += sphereRadius; + int plane = intersectRayAABB(-extents, extents, localPt, localDir, tnear, tfar); + if(plane!=-1 && tnear>=epsilon && tnear <= MinDist) + { + MinDist = PxMax(tnear, 0.0f); + normal = box.rotate(boxNormals[plane]); + Status = true; + } + + extents = box.extents; + extents.y += sphereRadius; + plane = intersectRayAABB(-extents, extents, localPt, localDir, tnear, tfar); + if(plane!=-1 && tnear>=epsilon && tnear <= MinDist) + { + MinDist = PxMax(tnear, 0.0f); + normal = box.rotate(boxNormals[plane]); + Status = true; + } + + extents = box.extents; + extents.z += sphereRadius; + plane = intersectRayAABB(-extents, extents, localPt, localDir, tnear, tfar); + if(plane!=-1 && tnear>=epsilon && tnear <= MinDist) + { + MinDist = PxMax(tnear, 0.0f); + normal = box.rotate(boxNormals[plane]); + Status = true; + } + + min_dist = MinDist; + + return Status; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.h new file mode 100644 index 0000000..1ea3640 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxSphere.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_BOX_SPHERE_H +#define GU_SWEEP_BOX_SPHERE_H + +#include "foundation/PxVec3.h" +#include "PxQueryReport.h" + +namespace physx +{ +namespace Gu +{ + class Box; + + bool sweepBoxSphere(const Box& box, PxReal sphereRadius, const PxVec3& spherePos, const PxVec3& dir, PxReal length, PxReal& min_dist, PxVec3& normal, PxHitFlags hitFlags); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp new file mode 100644 index 0000000..c2ebe90 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.cpp @@ -0,0 +1,622 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "geometry/PxTriangle.h" + +#include "GuSweepBoxTriangle_FeatureBased.h" +#include "GuIntersectionRayBox.h" +#include "GuSweepTriangleUtils.h" +#include "GuInternal.h" + +using namespace physx; +using namespace Gu; + +#define LOCAL_EPSILON 0.00001f // PT: this value makes the 'basicAngleTest' pass. Fails because of a ray almost parallel to a triangle + +namespace +{ +static const PxReal gFatTriangleCoeff = 0.02f; + +static const PxVec3 gNearPlaneNormal[] = +{ + PxVec3(1.0f, 0.0f, 0.0f), + PxVec3(0.0f, 1.0f, 0.0f), + PxVec3(0.0f, 0.0f, 1.0f), + PxVec3(-1.0f, 0.0f, 0.0f), + PxVec3(0.0f, -1.0f, 0.0f), + PxVec3(0.0f, 0.0f, -1.0f) +}; +} + +#define INVSQRT3 0.577350269189f //!< 1 / sqrt(3) + +/** +Returns vertex normals. +\return 24 floats (8 normals) +*/ +static const PxF32* getBoxVertexNormals() +{ + // 7+------+6 0 = --- + // /| /| 1 = +-- + // / | / | 2 = ++- + // / 4+---/--+5 3 = -+- + // 3+------+2 / y z 4 = --+ + // | / | / | / 5 = +-+ + // |/ |/ |/ 6 = +++ + // 0+------+1 *---x 7 = -++ + + static PxF32 VertexNormals[] = + { + -INVSQRT3, -INVSQRT3, -INVSQRT3, + INVSQRT3, -INVSQRT3, -INVSQRT3, + INVSQRT3, INVSQRT3, -INVSQRT3, + -INVSQRT3, INVSQRT3, -INVSQRT3, + -INVSQRT3, -INVSQRT3, INVSQRT3, + INVSQRT3, -INVSQRT3, INVSQRT3, + INVSQRT3, INVSQRT3, INVSQRT3, + -INVSQRT3, INVSQRT3, INVSQRT3 + }; + + return VertexNormals; +} + +static PxTriangle inflateTriangle(const PxTriangle& triangle, PxReal fat_coeff) +{ + PxTriangle fatTri = triangle; + + // Compute triangle center + const PxVec3& p0 = triangle.verts[0]; + const PxVec3& p1 = triangle.verts[1]; + const PxVec3& p2 = triangle.verts[2]; + const PxVec3 center = (p0 + p1 + p2)*0.333333333f; + + // Don't normalize? + // Normalize => add a constant border, regardless of triangle size + // Don't => add more to big triangles + for(PxU32 i=0;i<3;i++) + { + const PxVec3 v = fatTri.verts[i] - center; + fatTri.verts[i] += v * fat_coeff; + } + return fatTri; +} + +// PT: special version to fire N parallel rays against the same tri +static PX_FORCE_INLINE PxIntBool rayTriPrecaCull( const PxVec3& orig, const PxVec3& dir, + const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, const PxVec3& pvec, + PxReal det, PxReal oneOverDet, PxReal& t) +{ + // Calculate distance from vert0 to ray origin + const PxVec3 tvec = orig - vert0; + + // Calculate U parameter and test bounds + PxReal u = tvec.dot(pvec); + if((u < 0.0f) || u>det) + return 0; + + // Prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + PxReal v = dir.dot(qvec); + if((v < 0.0f) || u+v>det) + return 0; + + // Calculate t, scale parameters, ray intersects triangle + t = edge2.dot(qvec); + t *= oneOverDet; + return 1; +} + +static PX_FORCE_INLINE PxIntBool rayTriPrecaNoCull( const PxVec3& orig, const PxVec3& dir, + const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, const PxVec3& pvec, + PxReal /*det*/, PxReal oneOverDet, PxReal& t) +{ + // Calculate distance from vert0 to ray origin + const PxVec3 tvec = orig - vert0; + + // Calculate U parameter and test bounds + PxReal u = (tvec.dot(pvec)) * oneOverDet; + if((u < 0.0f) || u>1.0f) + return 0; + + // prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + PxReal v = (dir.dot(qvec)) * oneOverDet; + if((v < 0.0f) || u+v>1.0f) + return 0; + + // Calculate t, ray intersects triangle + t = (edge2.dot(qvec)) * oneOverDet; + return 1; +} + +// PT: specialized version where oneOverDir is available +// PT: why did we change the initial epsilon value? +#define LOCAL_EPSILON_RAY_BOX PX_EPS_F32 +//#define LOCAL_EPSILON_RAY_BOX 0.0001f +static PX_FORCE_INLINE int intersectRayAABB2(const PxVec3& minimum, const PxVec3& maximum, + const PxVec3& ro, const PxVec3& /*rd*/, const PxVec3& oneOverDir, + float& tnear, float& tfar, + bool fbx, bool fby, bool fbz) +{ + // PT: this unrolled loop is a lot faster on Xbox + + if(fbx) + if(ro.xmaximum.x) + { +// tnear = FLT_MAX; + return -1; + } + if(fby) + if(ro.ymaximum.y) + { +// tnear = FLT_MAX; + return -1; + } + if(fbz) + if(ro.zmaximum.z) + { +// tnear = FLT_MAX; + return -1; + } + + PxReal t1x = (minimum.x - ro.x) * oneOverDir.x; + PxReal t2x = (maximum.x - ro.x) * oneOverDir.x; + PxReal t1y = (minimum.y - ro.y) * oneOverDir.y; + PxReal t2y = (maximum.y - ro.y) * oneOverDir.y; + PxReal t1z = (minimum.z - ro.z) * oneOverDir.z; + PxReal t2z = (maximum.z - ro.z) * oneOverDir.z; + + int bx; + int by; + int bz; + + if(t1x>t2x) + { + PxReal t=t1x; t1x=t2x; t2x=t; + bx = 3; + } + else + { + bx = 0; + } + + if(t1y>t2y) + { + PxReal t=t1y; t1y=t2y; t2y=t; + by = 4; + } + else + { + by = 1; + } + + if(t1z>t2z) + { + PxReal t=t1z; t1z=t2z; t2z=t; + bz = 5; + } + else + { + bz = 2; + } + + int ret; + if(!fbx) + { +// if(t1x>tnear) // PT: no need to test for the first value + { + tnear = t1x; + ret = bx; + } +// tfar = Px::intrinsics::selectMin(tfar, t2x); + tfar = t2x; // PT: no need to test for the first value + } + else + { + ret=-1; + tnear = -PX_MAX_F32; + tfar = PX_MAX_F32; + } + + if(!fby) + { + if(t1y>tnear) + { + tnear = t1y; + ret = by; + } + tfar = physx::intrinsics::selectMin(tfar, t2y); + } + + if(!fbz) + { + if(t1z>tnear) + { + tnear = t1z; + ret = bz; + } + tfar = physx::intrinsics::selectMin(tfar, t2z); + } + + if(tnear>tfar || tfar no collision + // We test both sides at the same time by only testing Sign(d3 * d4). + // ### put that in the Plane class + // ### also check that code in the triangle class that might be similar + const PxReal d3 = plane.distance(p3); + + const PxReal temp = d3 * plane.distance(p4); + if(temp>0.0f) return false; + + // if colliding edge (p3,p4) and plane are parallel return no collision + const PxVec3 v2 = p4 - p3; + + const PxReal temp2 = plane.n.dot(v2); + if(temp2==0.0f) return false; // ### epsilon would be better + + // compute intersection point of plane and colliding edge (p3,p4) + ip = p3-v2*(d3/temp2); + + // compute distance of intersection from line (ip, -dir) to line (p1,p2) + dist = (v1[i]*(ip[j]-p1[j])-v1[j]*(ip[i]-p1[i])) * coeff; + if(dist<0.0f) return false; + + // compute intersection point on edge (p1,p2) line + ip -= dist*dir; + + // check if intersection point (ip) is between edge (p1,p2) vertices + const PxReal temp3 = (p1.x-ip.x)*(p2.x-ip.x)+(p1.y-ip.y)*(p2.y-ip.y)+(p1.z-ip.z)*(p2.z-ip.z); + return temp3<0.0f; +} + +namespace +{ +static const PxReal gFatBoxEdgeCoeff = 0.01f; +#define INVSQRT2 0.707106781188f //!< 1 / sqrt(2) + +static const PxVec3 EdgeNormals[] = +{ + PxVec3(0, -INVSQRT2, -INVSQRT2), // 0-1 + PxVec3(INVSQRT2, 0, -INVSQRT2), // 1-2 + PxVec3(0, INVSQRT2, -INVSQRT2), // 2-3 + PxVec3(-INVSQRT2, 0, -INVSQRT2), // 3-0 + + PxVec3(0, INVSQRT2, INVSQRT2), // 7-6 + PxVec3(INVSQRT2, 0, INVSQRT2), // 6-5 + PxVec3(0, -INVSQRT2, INVSQRT2), // 5-4 + PxVec3(-INVSQRT2, 0, INVSQRT2), // 4-7 + + PxVec3(INVSQRT2, -INVSQRT2, 0), // 1-5 + PxVec3(INVSQRT2, INVSQRT2, 0), // 6-2 + PxVec3(-INVSQRT2, INVSQRT2, 0), // 3-7 + PxVec3(-INVSQRT2, -INVSQRT2, 0) // 4-0 +}; + +static const PxVec3* getBoxLocalEdgeNormals() +{ + return EdgeNormals; +} +} + +static PX_FORCE_INLINE void closestAxis2(const PxVec3& v, PxU32& j, PxU32& k) +{ + // find largest 2D plane projection + const PxF32 absPx = physx::intrinsics::abs(v.x); + const PxF32 absPy = physx::intrinsics::abs(v.y); + const PxF32 absPz = physx::intrinsics::abs(v.z); + //PxU32 m = 0; //x biggest axis + j = 1; + k = 2; + if( absPy > absPx && absPy > absPz) + { + //y biggest + j = 2; + k = 0; + //m = 1; + } + else if(absPz > absPx) + { + //z biggest + j = 0; + k = 1; + //m = 2; + } +// return m; +} + +bool Gu::sweepBoxTriangle( const PxTriangle& tri, const PxBounds3& box, + const PxVec3& motion, const PxVec3& oneOverMotion, + PxVec3& hit, PxVec3& normal, PxReal& d, bool isDoubleSided) +{ + // Create triangle normal + PxVec3 denormalizedTriNormal; + tri.denormalizedNormal(denormalizedTriNormal); + + // Backface culling + const bool doBackfaceCulling = !isDoubleSided; + if(doBackfaceCulling && (denormalizedTriNormal.dot(motion)) >= 0.0f) // ">=" is important ! + return false; + + ///////////////////////// + + PxVec3 boxVertices[8]; + computeBoxPoints(box, boxVertices); + + ///////////////////////// + + // Make fat triangle + const PxTriangle fatTri = inflateTriangle(tri, gFatTriangleCoeff); + + PxReal minDist = d; // Initialize with current best distance + int col = -1; + + // Box vertices VS triangle + { + // ### cull using box-plane distance ? + const PxVec3 edge1 = fatTri.verts[1] - fatTri.verts[0]; + const PxVec3 edge2 = fatTri.verts[2] - fatTri.verts[0]; + const PxVec3 PVec = motion.cross(edge2); + const PxReal Det = edge1.dot(PVec); + + // We can't use stamps here since we can still find a better TOI for a given vertex, + // even if that vertex has already been tested successfully against another triangle. + const PxVec3* VN = reinterpret_cast(getBoxVertexNormals()); + + const PxReal oneOverDet = Det!=0.0f ? 1.0f / Det : 0.0f; + + PxU32 hitIndex=0; + if(doBackfaceCulling) + { + if(Det>=LOCAL_EPSILON) + { + for(PxU32 i=0;i<8;i++) + { + // Orientation culling + if((VN[i].dot(denormalizedTriNormal) >= 0.0f)) // Can't rely on triangle normal for double-sided faces + continue; + + // ### test this + // ### ok, this causes the bug in level3's v-shaped desk. Not really a real "bug", it just happens + // that this VF test fixes this case, so it's a bad idea to cull it. Oh, well. + // If we use a penetration-depth code to fixup bad cases, we can enable this culling again. (also + // if we find a better way to handle that desk) + // Discard back vertices +// if(VN[i].dot(motion)<0.0f) +// continue; + + // Shoot a ray from vertex against triangle, in direction "motion" + PxReal t; + if(!rayTriPrecaCull(boxVertices[i], motion, fatTri.verts[0], edge1, edge2, PVec, Det, oneOverDet, t)) + continue; + + //if(t<=OffsetLength) t=0.0f; + // Only consider positive distances, closer than current best + // ### we could test that first on tri vertices & discard complete tri if it's further than current best (or equal!) + if(t < 0.0f || t > minDist) + continue; + + minDist = t; + col = 0; +// hit = boxVertices[i] + t * motion; + hitIndex = i; + } + } + } + else + { + if(Det<=-LOCAL_EPSILON || Det>=LOCAL_EPSILON) + { + for(PxU32 i=0;i<8;i++) + { + // ### test this + // ### ok, this causes the bug in level3's v-shaped desk. Not really a real "bug", it just happens + // that this VF test fixes this case, so it's a bad idea to cull it. Oh, well. + // If we use a penetration-depth code to fixup bad cases, we can enable this culling again. (also + // if we find a better way to handle that desk) + // Discard back vertices + // if(!VN[i].SameDirection(motion)) + // continue; + + // Shoot a ray from vertex against triangle, in direction "motion" + PxReal t; + if(!rayTriPrecaNoCull(boxVertices[i], motion, fatTri.verts[0], edge1, edge2, PVec, Det, oneOverDet, t)) + continue; + + //if(t<=OffsetLength) t=0.0f; + // Only consider positive distances, closer than current best + // ### we could test that first on tri vertices & discard complete tri if it's further than current best (or equal!) + if(t < 0.0f || t > minDist) + continue; + + minDist = t; + col = 0; +// hit = boxVertices[i] + t * motion; + hitIndex = i; + } + } + } + + // Only copy this once, if needed + if(col==0) + { + // PT: hit point on triangle + hit = boxVertices[hitIndex] + minDist * motion; + normal = denormalizedTriNormal; + } + } + + // Triangle vertices VS box + { + const PxVec3 negMotion = -motion; + const PxVec3 negInvMotion = -oneOverMotion; + + // PT: precompute fabs-test for ray-box + // - doing this outside of the ray-box function gets rid of 3 fabs/fcmp per call + // - doing this with integer code removes the 3 remaining fabs/fcmps totally + // - doing this outside reduces the LHS + const bool b0 = physx::intrinsics::abs(negMotion.x) flips normals + normal = boxNormals[plane]; + col = 1; + + // PT: hit point on triangle + hit = tri.verts[i]; + } + } + } + + PxU32 saved_j = PX_INVALID_U32; + PxU32 saved_k = PX_INVALID_U32; + PxVec3 p1s; + PxVec3 v1s; + + // Edge-vs-edge + { + // Loop through box edges + const PxU8* PX_RESTRICT edges = getBoxEdges(); + const PxVec3* PX_RESTRICT edgeNormals = getBoxLocalEdgeNormals(); + for(PxU32 i=0;i<12;i++) // 12 edges + { + // PT: TODO: skip this if edge is culled + PxVec3 p1 = boxVertices[*edges++]; + PxVec3 p2 = boxVertices[*edges++]; + makeFatEdge(p1, p2, gFatBoxEdgeCoeff); + + if(edgeNormals[i].dot(motion) < 0.0f) + continue; + + // While we're at it, precompute some more data for EE tests + const PxVec3 v1 = p2 - p1; + + // Build plane P based on edge (p1, p2) and direction (dir) + const PxVec3 planeNormal = v1.cross(motion); + const PxPlane plane(planeNormal, -(planeNormal.dot(p1))); + + // find largest 2D plane projection + PxU32 closest_i, closest_j; + // closestAxis(plane.normal, ii, jj); + closestAxis2(planeNormal, closest_i, closest_j); + + const PxReal coeff = 1.0f / (v1[closest_i]*motion[closest_j] - v1[closest_j]*motion[closest_i]); + + // Loop through triangle edges + for(PxU32 j=0; j<3; j++) + { + // Catch current triangle edge + // j=0 => 0-1 + // j=1 => 1-2 + // j=2 => 2-0 + // => this is compatible with EdgeList + const PxU32 k = PxGetNextIndex3(j); + + PxReal dist; + PxVec3 ip; + if(intersectEdgeEdge3(plane, p1, p2, motion, v1, tri.verts[j], tri.verts[k], dist, ip, closest_i, closest_j, coeff)) + { + if(dist<=minDist) + { + p1s = p1; + v1s = v1; + saved_j = j; + saved_k = k; + + col = 2; + minDist = dist; + + // PT: hit point on triangle + hit = ip + motion*dist; + } + } + } + } + } + + if(col==-1) + return false; + + if(col==2) + { + PX_ASSERT(saved_j != PX_INVALID_U32); + PX_ASSERT(saved_k != PX_INVALID_U32); + const PxVec3& p3 = tri.verts[saved_j]; + const PxVec3& p4 = tri.verts[saved_k]; + computeEdgeEdgeNormal(normal, p1s, v1s, p3, p4-p3, motion, minDist); + } + + d = minDist; + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.h new file mode 100644 index 0000000..9ac343c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_FeatureBased.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_BOX_TRIANGLE_FEATURE_BASED_H +#define GU_SWEEP_BOX_TRIANGLE_FEATURE_BASED_H + +#include "foundation/PxVec3.h" +#include "foundation/PxPlane.h" + +namespace physx +{ + class PxTriangle; + + namespace Gu + { + /** + Sweeps a box against a triangle, using a 'feature-based' approach. + + This is currently only used for computing the box-sweep impact data, in a second pass, + after the best triangle has been identified using faster approaches (SAT/GJK). + + \warning Returned impact normal is not normalized + + \param tri [in] the triangle + \param box [in] the box + \param motion [in] (box) motion vector + \param oneOverMotion [in] precomputed inverse of motion vector + \param hit [out] impact point + \param normal [out] impact normal (warning: not normalized) + \param d [in/out] impact distance (please initialize with best current distance) + \param isDoubleSided [in] whether triangle is double-sided or not + \return true if an impact has been found + */ + bool sweepBoxTriangle( const PxTriangle& tri, const PxBounds3& box, + const PxVec3& motion, const PxVec3& oneOverMotion, + PxVec3& hit, PxVec3& normal, PxReal& d, bool isDoubleSided=false); + } // namespace Gu +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp new file mode 100644 index 0000000..196e17e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.cpp @@ -0,0 +1,38 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepBoxTriangle_SAT.h" + +using namespace physx; +using namespace Gu; + +// PT: SAT-based version, in box space +int Gu::triBoxSweepTestBoxSpace(const PxTriangle& tri, const PxVec3& extents, const PxVec3& dir, const PxVec3& oneOverDir, float tmax, float& toi, bool doBackfaceCulling) +{ + return triBoxSweepTestBoxSpace_inlined(tri, extents, dir, oneOverDir, tmax, toi, PxU32(doBackfaceCulling)); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.h new file mode 100644 index 0000000..30aa568 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepBoxTriangle_SAT.h @@ -0,0 +1,236 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_BOX_TRIANGLE_SAT_H +#define GU_SWEEP_BOX_TRIANGLE_SAT_H + +#include "geometry/PxTriangle.h" + +#include "GuSweepSharedTests.h" +#include "GuInternal.h" + + #define RetType int + #define MTDType bool + +namespace physx +{ +namespace Gu +{ + +// We have separation if one of those conditions is true: +// -BoxExt > TriMax (box strictly to the right of the triangle) +// BoxExt < TriMin (box strictly to the left of the triangle +// <=> d0 = -BoxExt - TriMax > 0 +// d1 = BoxExt - TriMin < 0 +// Hence we have overlap if d0 <= 0 and d1 >= 0 +// overlap = (d0<=0.0f && d1>=0.0f) +#define TEST_OVERLAP \ + const float d0 = -BoxExt - TriMax; \ + const float d1 = BoxExt - TriMin; \ + const bool bIntersect = (d0<=0.0f && d1>=0.0f); \ + bValidMTD &= bIntersect; + + // PT: inlining this one is important. Returning floats looks bad but is faster on Xbox. + static PX_FORCE_INLINE RetType testAxis(const PxTriangle& tri, const PxVec3& extents, const PxVec3& dir, const PxVec3& axis, MTDType& bValidMTD, float& tfirst, float& tlast) + { + const float d0t = tri.verts[0].dot(axis); + const float d1t = tri.verts[1].dot(axis); + const float d2t = tri.verts[2].dot(axis); + + float TriMin = PxMin(d0t, d1t); + float TriMax = PxMax(d0t, d1t); + TriMin = PxMin(TriMin, d2t); + TriMax = PxMax(TriMax, d2t); + + //////// + + const float BoxExt = PxAbs(axis.x)*extents.x + PxAbs(axis.y)*extents.y + PxAbs(axis.z)*extents.z; + TEST_OVERLAP + + const float v = dir.dot(axis); + if(PxAbs(v) < 1.0E-6f) + return bIntersect; + const float oneOverV = -1.0f / v; + + // float t0 = d0 * oneOverV; + // float t1 = d1 * oneOverV; + // if(t0 > t1) TSwap(t0, t1); + const float t0_ = d0 * oneOverV; + const float t1_ = d1 * oneOverV; + float t0 = PxMin(t0_, t1_); + float t1 = PxMax(t0_, t1_); + + if(t0 > tlast) return false; + if(t1 < tfirst) return false; + + // if(t1 < tlast) tlast = t1; + tlast = PxMin(t1, tlast); + + // if(t0 > tfirst) tfirst = t0; + tfirst = PxMax(t0, tfirst); + + return true; + } + + template + static PX_FORCE_INLINE RetType testAxisXYZ(const PxTriangle& tri, const PxVec3& extents, const PxVec3& dir, float oneOverDir, MTDType& bValidMTD, float& tfirst, float& tlast) + { + const float d0t = tri.verts[0][XYZ]; + const float d1t = tri.verts[1][XYZ]; + const float d2t = tri.verts[2][XYZ]; + + float TriMin = PxMin(d0t, d1t); + float TriMax = PxMax(d0t, d1t); + TriMin = PxMin(TriMin, d2t); + TriMax = PxMax(TriMax, d2t); + + //////// + + const float BoxExt = extents[XYZ]; + TEST_OVERLAP + + const float v = dir[XYZ]; + if(PxAbs(v) < 1.0E-6f) + return bIntersect; + + const float oneOverV = -oneOverDir; + + // float t0 = d0 * oneOverV; + // float t1 = d1 * oneOverV; + // if(t0 > t1) TSwap(t0, t1); + const float t0_ = d0 * oneOverV; + const float t1_ = d1 * oneOverV; + float t0 = PxMin(t0_, t1_); + float t1 = PxMax(t0_, t1_); + + if(t0 > tlast) return false; + if(t1 < tfirst) return false; + + // if(t1 < tlast) tlast = t1; + tlast = PxMin(t1, tlast); + + // if(t0 > tfirst) tfirst = t0; + tfirst = PxMax(t0, tfirst); + + return true; + } + + PX_FORCE_INLINE int testSeparationAxes( const PxTriangle& tri, const PxVec3& extents, + const PxVec3& normal, const PxVec3& dir, const PxVec3& oneOverDir, float tmax, float& tcoll) + { + bool bValidMTD = true; + float tfirst = -FLT_MAX; + float tlast = FLT_MAX; + + // Triangle normal + if(!testAxis(tri, extents, dir, normal, bValidMTD, tfirst, tlast)) + return 0; + + // Box normals + if(!testAxisXYZ<0>(tri, extents, dir, oneOverDir.x, bValidMTD, tfirst, tlast)) + return 0; + if(!testAxisXYZ<1>(tri, extents, dir, oneOverDir.y, bValidMTD, tfirst, tlast)) + return 0; + if(!testAxisXYZ<2>(tri, extents, dir, oneOverDir.z, bValidMTD, tfirst, tlast)) + return 0; + + // Edges + for(PxU32 i=0; i<3; i++) + { + int ip1 = int(i+1); + if(i>=2) ip1 = 0; + const PxVec3 TriEdge = tri.verts[ip1] - tri.verts[i]; + + { + const PxVec3 Sep = cross100(TriEdge); + if((Sep.dot(Sep))>=1.0E-6f && !testAxis(tri, extents, dir, Sep, bValidMTD, tfirst, tlast)) + return 0; + } + { + const PxVec3 Sep = cross010(TriEdge); + if((Sep.dot(Sep))>=1.0E-6f && !testAxis(tri, extents, dir, Sep, bValidMTD, tfirst, tlast)) + return 0; + } + { + const PxVec3 Sep = cross001(TriEdge); + if((Sep.dot(Sep))>=1.0E-6f && !testAxis(tri, extents, dir, Sep, bValidMTD, tfirst, tlast)) + return 0; + } + } + + if(tfirst > tmax || tlast < 0.0f) + return 0; + + if(tfirst <= 0.0f) + { + if(!bValidMTD) + return 0; + tcoll = 0.0f; + } + else tcoll = tfirst; + + return 1; + } + + //! Inlined version of triBoxSweepTestBoxSpace. See that other function for comments. + PX_FORCE_INLINE int triBoxSweepTestBoxSpace_inlined(const PxTriangle& tri, const PxVec3& extents, const PxVec3& dir, const PxVec3& oneOverDir, float tmax, float& toi, PxU32 doBackfaceCulling) + { + // Create triangle normal + PxVec3 triNormal; + tri.denormalizedNormal(triNormal); + + // Backface culling + if(doBackfaceCulling && (triNormal.dot(dir)) >= 0.0f) // ">=" is important ! + return 0; + + // The SAT test will properly detect initial overlaps, no need for extra tests + return testSeparationAxes(tri, extents, triNormal, dir, oneOverDir, tmax, toi); + } + + /** + Sweeps a box against a triangle, using a 'SAT' approach (Separating Axis Theorem). + + The test is performed in box-space, i.e. the box is axis-aligned and its center is (0,0,0). In other words it is + defined by its extents alone. The triangle must have been transformed to this "box-space" before calling the function. + + \param tri [in] triangle in box-space + \param extents [in] box extents + \param dir [in] sweep direction. Does not need to be normalized. + \param oneOverDir [in] precomputed inverse of sweep direction + \param tmax [in] sweep length + \param toi [out] time of impact/impact distance. Does not need to be initialized before calling the function. + \param doBackfaceCulling [in] true to enable backface culling, false for double-sided triangles + \return non-zero value if an impact has been found (in which case returned 'toi' value is valid) + */ + int triBoxSweepTestBoxSpace(const PxTriangle& tri, const PxVec3& extents, const PxVec3& dir, const PxVec3& oneOverDir, float tmax, float& toi, bool doBackfaceCulling); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp new file mode 100644 index 0000000..f7daac9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.cpp @@ -0,0 +1,215 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxSIMDHelpers.h" +#include "geometry/PxTriangle.h" + +#include "GuSweepCapsuleBox.h" +#include "GuSweepSphereTriangle.h" +#include "GuCapsule.h" +#include "GuDistanceSegmentBox.h" +#include "GuInternal.h" +#include "foundation/PxAlloca.h" + +using namespace physx; +using namespace Gu; + +namespace +{ +/** +* Returns triangles. +* \return 36 indices (12 triangles) indexing the list returned by ComputePoints() +*/ +static const PxU8* getBoxTriangles() +{ + static PxU8 Indices[] = { + 0,2,1, 0,3,2, + 1,6,5, 1,2,6, + 5,7,4, 5,6,7, + 4,3,0, 4,7,3, + 3,6,2, 3,7,6, + 5,0,1, 5,4,0 + }; + return Indices; +} +} + +#define OUTPUT_TRI(t, p0, p1, p2){ \ +t->verts[0] = p0; \ +t->verts[1] = p1; \ +t->verts[2] = p2; \ +t++;} + +#define OUTPUT_TRI2(t, p0, p1, p2, d){ \ +t->verts[0] = p0; \ +t->verts[1] = p1; \ +t->verts[2] = p2; \ +t->denormalizedNormal(denormalizedNormal); \ +if((denormalizedNormal.dot(d))>0.0f) { \ +PxVec3 Tmp = t->verts[1]; \ +t->verts[1] = t->verts[2]; \ +t->verts[2] = Tmp; \ +} \ +t++; *ids++ = i; } + +static PxU32 extrudeMesh( PxU32 nbTris, const PxTriangle* triangles, + const PxVec3& extrusionDir, PxTriangle* tris, PxU32* ids, const PxVec3& dir) +{ + const PxU32* base = ids; + + for(PxU32 i=0; i 0.0f; + if(culled) continue; + + PxVec3 p0 = currentTriangle.verts[0]; + PxVec3 p1 = currentTriangle.verts[1]; + PxVec3 p2 = currentTriangle.verts[2]; + + PxVec3 p0b = p0 + extrusionDir; + PxVec3 p1b = p1 + extrusionDir; + PxVec3 p2b = p2 + extrusionDir; + + p0 -= extrusionDir; + p1 -= extrusionDir; + p2 -= extrusionDir; + + if(denormalizedNormal.dot(extrusionDir) >= 0.0f) OUTPUT_TRI(tris, p0b, p1b, p2b) + else OUTPUT_TRI(tris, p0, p1, p2) + *ids++ = i; + + // ### it's probably useless to extrude all the shared edges !!!!! + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE12) + { + OUTPUT_TRI2(tris, p1, p1b, p2b, dir) + OUTPUT_TRI2(tris, p1, p2b, p2, dir) + } + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE20) + { + OUTPUT_TRI2(tris, p0, p2, p2b, dir) + OUTPUT_TRI2(tris, p0, p2b, p0b, dir) + } + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE01) + { + OUTPUT_TRI2(tris, p0b, p1b, p1, dir) + OUTPUT_TRI2(tris, p0b, p1, p0, dir) + } + } + return PxU32(ids-base); +} + +static PxU32 extrudeBox(const PxBounds3& localBox, const PxTransform* world, const PxVec3& extrusionDir, PxTriangle* tris, const PxVec3& dir) +{ + // Handle the box as a mesh + + PxTriangle boxTris[12]; + + PxVec3 p[8]; + computeBoxPoints(localBox, p); + + const PxU8* PX_RESTRICT indices = getBoxTriangles(); + + for(PxU32 i=0; i<12; i++) + { + const PxU8 VRef0 = indices[i*3+0]; + const PxU8 VRef1 = indices[i*3+1]; + const PxU8 VRef2 = indices[i*3+2]; + + PxVec3 p0 = p[VRef0]; + PxVec3 p1 = p[VRef1]; + PxVec3 p2 = p[VRef2]; + if(world) + { + p0 = world->transform(p0); + p1 = world->transform(p1); + p2 = world->transform(p2); + } + + boxTris[i].verts[0] = p0; + boxTris[i].verts[1] = p1; + boxTris[i].verts[2] = p2; + } + PxU32 fakeIDs[12*7]; + return extrudeMesh(12, boxTris, extrusionDir, tris, fakeIDs, dir); +} + +// +// The problem of testing a swept capsule against a box is transformed into sweeping a sphere (lying at the center +// of the capsule) against the extruded triangles of the box. The box triangles are extruded along the +// capsule segment axis. +// +bool Gu::sweepCapsuleBox(const Capsule& capsule, const PxTransform& boxWorldPose, const PxVec3& boxDim, const PxVec3& dir, PxReal length, PxVec3& hit, PxReal& min_dist, PxVec3& normal, PxHitFlags hitFlags) +{ + if(!(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + // PT: test if shapes initially overlap + if(distanceSegmentBoxSquared(capsule.p0, capsule.p1, boxWorldPose.p, boxDim, PxMat33Padded(boxWorldPose.q)) < capsule.radius*capsule.radius) + { + min_dist = 0.0f; + normal = -dir; + return true; + } + } + + // Extrusion dir = capsule segment + const PxVec3 extrusionDir = (capsule.p1 - capsule.p0)*0.5f; + + // Extrude box + PxReal MinDist = length; + bool Status = false; + { + const PxBounds3 aabb(-boxDim, boxDim); + + PX_ALLOCA(triangles, PxTriangle, 12*7); + const PxU32 nbTris = extrudeBox(aabb, &boxWorldPose, extrusionDir, triangles, dir); + PX_ASSERT(nbTris<=12*7); + + // Sweep sphere vs extruded box + PxGeomSweepHit h; // PT: TODO: ctor! + PxVec3 bestNormal; + if(sweepSphereTriangles(nbTris, triangles, capsule.computeCenter(), capsule.radius, dir, length, NULL, h, bestNormal, false, false, false, false)) + { + hit = h.position; + MinDist = h.distance; + normal = h.normal; + Status = true; + } + } + + min_dist = MinDist; + return Status; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.h new file mode 100644 index 0000000..cdfffdc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleBox.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_CAPSULE_BOX_H +#define GU_SWEEP_CAPSULE_BOX_H + +#include "foundation/PxVec3.h" +#include "PxQueryReport.h" + +namespace physx +{ +namespace Gu +{ + class Capsule; + + bool sweepCapsuleBox(const Capsule& capsule, const PxTransform& boxWorldPose, const PxVec3& boxDim, const PxVec3& dir, PxReal length, PxVec3& hit, PxReal& min_dist, PxVec3& normal, PxHitFlags hitFlags); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp new file mode 100644 index 0000000..da50dba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleCapsule.cpp @@ -0,0 +1,344 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxTriangle.h" +#include "PxQueryReport.h" + +#include "GuSweepCapsuleCapsule.h" +#include "GuCapsule.h" +#include "GuDistancePointSegment.h" +#include "GuDistanceSegmentSegment.h" +#include "GuIntersectionRayCapsule.h" + +using namespace physx; +using namespace Gu; + +#define LOCAL_EPSILON 0.00001f // PT: this value makes the 'basicAngleTest' pass. Fails because of a ray almost parallel to a triangle + +static void edgeEdgeDist(PxVec3& x, PxVec3& y, // closest points + const PxVec3& p, const PxVec3& a, // seg 1 origin, vector + const PxVec3& q, const PxVec3& b) // seg 2 origin, vector +{ + const PxVec3 T = q - p; + const PxReal ADotA = a.dot(a); + const PxReal BDotB = b.dot(b); + const PxReal ADotB = a.dot(b); + const PxReal ADotT = a.dot(T); + const PxReal BDotT = b.dot(T); + + // t parameterizes ray (p, a) + // u parameterizes ray (q, b) + + // Compute t for the closest point on ray (p, a) to ray (q, b) + const PxReal Denom = ADotA*BDotB - ADotB*ADotB; + + PxReal t; + if(Denom!=0.0f) + { + t = (ADotT*BDotB - BDotT*ADotB) / Denom; + + // Clamp result so t is on the segment (p, a) + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else + { + t = 0.0f; + } + + // find u for point on ray (q, b) closest to point at t + PxReal u; + if(BDotB!=0.0f) + { + u = (t*ADotB - BDotT) / BDotB; + + // if u is on segment (q, b), t and u correspond to closest points, otherwise, clamp u, recompute and clamp t + if(u<0.0f) + { + u = 0.0f; + if(ADotA!=0.0f) + { + t = ADotT / ADotA; + + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else + { + t = 0.0f; + } + } + else if(u > 1.0f) + { + u = 1.0f; + if(ADotA!=0.0f) + { + t = (ADotB + ADotT) / ADotA; + + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else + { + t = 0.0f; + } + } + } + else + { + u = 0.0f; + + if(ADotA!=0.0f) + { + t = ADotT / ADotA; + + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else + { + t = 0.0f; + } + } + + x = p + a * t; + y = q + b * u; +} + +static bool rayQuad(const PxVec3& orig, const PxVec3& dir, const PxVec3& vert0, const PxVec3& vert1, const PxVec3& vert2, PxReal& t, PxReal& u, PxReal& v, bool cull) +{ + // Find vectors for two edges sharing vert0 + const PxVec3 edge1 = vert1 - vert0; + const PxVec3 edge2 = vert2 - vert0; + + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const PxReal det = edge1.dot(pvec); + + if(cull) + { + if(detdet) + return false; + + // Prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + v = dir.dot(qvec); + if(v<0.0f || v>det) + return false; + + // Calculate t, scale parameters, ray intersects triangle + t = edge2.dot(qvec); + const PxReal oneOverDet = 1.0f / det; + t *= oneOverDet; + u *= oneOverDet; + v *= oneOverDet; + } + else + { + // the non-culling branch + if(det>-LOCAL_EPSILON && det1.0f) + return false; + + // prepare to test V parameter + const PxVec3 qvec = tvec.cross(edge1); + + // Calculate V parameter and test bounds + v = (dir.dot(qvec)) * oneOverDet; + if(v<0.0f || v>1.0f) + return false; + + // Calculate t, ray intersects triangle + t = (edge2.dot(qvec)) * oneOverDet; + } + return true; +} + +bool Gu::sweepCapsuleCapsule(const Capsule& capsule0, const Capsule& capsule1, const PxVec3& dir, PxReal length, PxReal& min_dist, PxVec3& ip, PxVec3& normal, PxU32 inHitFlags, PxU16& outHitFlags) +{ + const PxReal radiusSum = capsule0.radius + capsule1.radius; + + if(!(inHitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + // PT: test if shapes initially overlap + + // PT: It would be better not to use the same code path for spheres and capsules. The segment-segment distance + // function doesn't work for degenerate capsules so we need to test all combinations here anyway. + bool initialOverlapStatus; + if(capsule0.p0==capsule0.p1) + initialOverlapStatus = distancePointSegmentSquared(capsule1, capsule0.p0)= 0) // Same direction + { + Normal *= radiusSum; + pc = p0 - Normal; + pa = p1 - Normal; + pb = p1b - Normal; + } + else + { + Normal *= radiusSum; + pb = p0 + Normal; + pa = p1 + Normal; + pc = p1b + Normal; + } + PxReal t, u, v; + const PxVec3 center = capsule1.computeCenter(); + if(rayQuad(center, dir, pa, pb, pc, t, u, v, true) && t>=0.0f && t=0.0f && w<= MinDist) + { + MinDist = w; + Status = true; + } + } + } + } + + if(Status) + { + outHitFlags = PxHitFlags(0); + if(inHitFlags & PxU32(PxHitFlag::ePOSITION|PxHitFlag::eNORMAL)) + { + const PxVec3 p00 = capsule0.p0 - MinDist * dir; + const PxVec3 p01 = capsule0.p1 - MinDist * dir; +// const PxVec3 p10 = capsule1.p0;// - MinDist * dir; +// const PxVec3 p11 = capsule1.p1;// - MinDist * dir; + + const PxVec3 edge0 = p01 - p00; + const PxVec3 edge1 = capsuleExtent1; + + PxVec3 x, y; + edgeEdgeDist(x, y, p00, edge0, capsule1.p0, edge1); + + if(inHitFlags & PxHitFlag::eNORMAL) + { + normal = (x - y); + const float epsilon = 0.001f; + if(normal.normalize()0.0f) { \ + PxVec3 tmp = tri.verts[1]; \ + tri.verts[1] = tri.verts[2]; \ + tri.verts[2] = tmp; \ + nrm = -nrm; \ + } \ + extrudedTrisNormals[nbExtrudedTris] = nrm; \ + nbExtrudedTris++; } + + +//#define NEW_VERSION + +bool Gu::sweepCapsuleTriangles_Precise( PxU32 nbTris, const PxTriangle* PX_RESTRICT triangles, // Triangle data + const Capsule& capsule, // Capsule data + const PxVec3& unitDir, const PxReal distance, // Ray data + const PxU32* PX_RESTRICT cachedIndex, // Cache data + PxGeomSweepHit& hit, PxVec3& triNormalOut, // Results + PxHitFlags hitFlags, bool isDoubleSided, // Query modifiers + const BoxPadded* cullBox) // Cull data +{ + if(!nbTris) + return false; + + const bool meshBothSides = hitFlags & PxHitFlag::eMESH_BOTH_SIDES; + const bool doBackfaceCulling = !isDoubleSided && !meshBothSides; + const bool anyHit = hitFlags & PxHitFlag::eMESH_ANY; + const bool testInitialOverlap = !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP); + + // PT: we can fallback to sphere sweep: + // - if the capsule is degenerate (i.e. it's a sphere) + // - if the sweep direction is the same as the capsule axis, in which case we can just sweep the top or bottom sphere + + const PxVec3 extrusionDir = (capsule.p0 - capsule.p1)*0.5f; // Extrusion dir = capsule segment + const PxReal halfHeight = extrusionDir.magnitude(); + bool mustExtrude = halfHeight!=0.0f; + if(!mustExtrude) + { + // PT: capsule is a sphere. Switch to sphere path (intersectCapsuleTriangle doesn't work for degenerate capsules) + return sweepSphereTriangles(nbTris, triangles, capsule.p0, capsule.radius, unitDir, distance, cachedIndex, hit, triNormalOut, isDoubleSided, meshBothSides, anyHit, testInitialOverlap); + } + else + { + const PxVec3 capsuleAxis = extrusionDir/halfHeight; + const PxReal colinearity = PxAbs(capsuleAxis.dot(unitDir)); + mustExtrude = (colinearity < (1.0f - COLINEARITY_EPSILON)); + } + + const PxVec3 capsuleCenter = capsule.computeCenter(); + + if(!mustExtrude) + { + CapsuleTriangleOverlapData params; + params.init(capsule); + // PT: unfortunately we need to do IO test with the *capsule*, even though we're in the sphere codepath. So we + // can't directly reuse the sphere function. + const PxVec3 sphereCenter = capsuleCenter + unitDir * halfHeight; + // PT: this is a copy of 'sweepSphereTriangles' but with a capsule IO test. Saves double backface culling.... + { + PxU32 index = PX_INVALID_U32; + const PxU32 initIndex = getInitIndex(cachedIndex, nbTris); + + PxReal curT = distance; + const PxReal dpc0 = sphereCenter.dot(unitDir); + + PxReal bestAlignmentValue = 2.0f; + + PxVec3 bestTriNormal(0.0f); + + for(PxU32 ii=0; ii 0.0f)) + continue; + + if(testInitialOverlap && intersectCapsuleTriangle(triNormal, currentTri.verts[0], currentTri.verts[1], currentTri.verts[2], capsule, params)) + { + triNormalOut = -unitDir; + return setInitialOverlapResults(hit, unitDir, i); + } + + const PxReal magnitude = triNormal.magnitude(); + if(magnitude==0.0f) + continue; + + triNormal /= magnitude; + + PxReal currentDistance; + bool unused; + if(!sweepSphereVSTri(currentTri.verts, triNormal, sphereCenter, capsule.radius, unitDir, currentDistance, unused, false)) + continue; + + const PxReal hitDot = computeAlignmentValue(triNormal, unitDir); + if(keepTriangle(currentDistance, hitDot, curT, bestAlignmentValue, distance)) + { + curT = PxMin(curT, currentDistance); // exact lower bound + + index = i; + bestAlignmentValue = hitDot; + bestTriNormal = triNormal; + if(anyHit) + break; + } + // + else if(keepTriangleBasic(currentDistance, curT, distance)) + { + curT = PxMin(curT, currentDistance); // exact lower bound + } + // + } + return computeSphereTriangleImpactData(hit, triNormalOut, index, curT, sphereCenter, unitDir, bestTriNormal, triangles, isDoubleSided, meshBothSides); + } + } + + // PT: extrude mesh on the fly. This is a modified copy of sweepSphereTriangles, unfortunately + PxTriangle extrudedTris[7]; + PxVec3 extrudedTrisNormals[7]; // Not normalized + + hit.faceIndex = PX_INVALID_U32; + const PxU32 initIndex = getInitIndex(cachedIndex, nbTris); + + const PxReal radius = capsule.radius; + PxReal curT = distance; + const PxReal dpc0 = capsuleCenter.dot(unitDir); + + // PT: we will copy the best triangle here. Using indices alone doesn't work + // since we extrude on-the-fly (and we don't want to re-extrude later) + PxTriangle bestTri; + PxVec3 bestTriNormal(0.0f); + PxReal mostOpposingHitDot = 2.0f; + + CapsuleTriangleOverlapData params; + params.init(capsule); + + for(PxU32 ii=0; ii 0.0f)) + continue; + + if(cullBox) + { + if(!intersectTriangleBox(*cullBox, currentSrcTri.verts[0], currentSrcTri.verts[1], currentSrcTri.verts[2])) + continue; + } + + if(testInitialOverlap && intersectCapsuleTriangle(denormalizedNormal, currentSrcTri.verts[0], currentSrcTri.verts[1], currentSrcTri.verts[2], capsule, params)) + { + triNormalOut = -unitDir; + return setInitialOverlapResults(hit, unitDir, i); + } + + // Extrude mesh on the fly + PxU32 nbExtrudedTris=0; + + const PxVec3 p0 = currentSrcTri.verts[0] - extrusionDir; + const PxVec3 p1 = currentSrcTri.verts[1] - extrusionDir; + const PxVec3 p2 = currentSrcTri.verts[2] - extrusionDir; + + const PxVec3 p0b = currentSrcTri.verts[0] + extrusionDir; + const PxVec3 p1b = currentSrcTri.verts[1] + extrusionDir; + const PxVec3 p2b = currentSrcTri.verts[2] + extrusionDir; + + if(denormalizedNormal.dot(extrusionDir) >= 0.0f) OUTPUT_TRI(p0b, p1b, p2b) + else OUTPUT_TRI(p0, p1, p2) + + // ### it's probably useless to extrude all the shared edges !!!!! + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE12) + { + OUTPUT_TRI2(p1, p1b, p2b, unitDir) + OUTPUT_TRI2(p1, p2b, p2, unitDir) + } + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE20) + { + OUTPUT_TRI2(p0, p2, p2b, unitDir) + OUTPUT_TRI2(p0, p2b, p0b, unitDir) + } + //if(CurrentFlags & TriangleCollisionFlag::eACTIVE_EDGE01) + { + OUTPUT_TRI2(p0b, p1b, p1, unitDir) + OUTPUT_TRI2(p0b, p1, p0, unitDir) + } +///////////// + + // PT: TODO: this one is new, to fix the tweak issue. However this wasn't + // here before so the perf hit should be analyzed. + denormalizedNormal.normalize(); + const PxReal hitDot1 = computeAlignmentValue(denormalizedNormal, unitDir); + +#ifdef NEW_VERSION + float localDistance = FLT_MAX; + PxU32 localIndex = 0xffffffff; +#endif + for(PxU32 j=0;j 0.0f) + continue; + + // PT: beware, culling is only ok on the sphere I think + if(rejectTriangle(capsuleCenter, unitDir, curT, radius, currentTri.verts, dpc0)) + continue; + + const PxReal magnitude = triNormal.magnitude(); + if(magnitude==0.0f) + continue; + + triNormal /= magnitude; + + PxReal currentDistance; + bool unused; + if(!sweepSphereVSTri(currentTri.verts, triNormal, capsuleCenter, radius, unitDir, currentDistance, unused, false)) + continue; + +#ifndef NEW_VERSION + if(keepTriangle(currentDistance, hitDot1, curT, mostOpposingHitDot, distance)) + { + curT = PxMin(curT, currentDistance); // exact lower bound + + hit.faceIndex = i; + mostOpposingHitDot = hitDot1; // arbitrary bias. works for hitDot1=-1, prevHitDot=0 + bestTri = currentTri; + + bestTriNormal = denormalizedNormal; + if(anyHit) + goto Exit; // PT: using goto to have one test per hit, not test per triangle ('break' doesn't work here) + } + // + else if(keepTriangleBasic(currentDistance, curT, distance)) + { + curT = PxMin(curT, currentDistance); // exact lower bound + } + // +#endif + +#ifdef NEW_VERSION + if(keepTriangleBasic(currentDistance, localDistance, distance)) + { + localDistance = currentDistance; + localIndex = j; + } +#endif + } + +#ifdef NEW_VERSION + if(localIndex!=0xffffffff) + { + if(keepTriangle(localDistance, hitDot1, curT, mostOpposingHitDot, distance)) + { + curT = PxMin(curT, localDistance); // exact lower bound + + hit.faceIndex = i; + mostOpposingHitDot = hitDot1; // arbitrary bias. works for hitDot1=-1, prevHitDot=0 + bestTri = currentSrcTri; + bestTriNormal = denormalizedNormal; + if(anyHit) + goto Exit; // PT: using goto to have one test per hit, not test per triangle ('break' doesn't work here) + } + // + else if(keepTriangleBasic(localDistance, curT, distance)) + { + curT = PxMin(curT, localDistance); // exact lower bound + } + } +#endif + + } +Exit: + if(hit.faceIndex==PX_INVALID_U32) + return false; // We didn't touch any triangle + + hit.distance = curT; + + triNormalOut = bestTriNormal; + + // Compute impact data only once, using best triangle + computeSphereTriImpactData(hit.position, hit.normal, capsuleCenter, unitDir, hit.distance, bestTri); + + // PT: by design, returned normal is opposed to the sweep direction. + if(shouldFlipNormal(hit.normal, meshBothSides, isDoubleSided, bestTriNormal, unitDir)) + hit.normal = -hit.normal; + + // PT: revisit this + if(hit.faceIndex!=PX_INVALID_U32) + { + // PT: we need to recompute a hit here because the hit between the *capsule* and the source mesh can be very + // different from the hit between the *sphere* and the extruded mesh. + + // Touched tri + const PxVec3& p0 = triangles[hit.faceIndex].verts[0]; + const PxVec3& p1 = triangles[hit.faceIndex].verts[1]; + const PxVec3& p2 = triangles[hit.faceIndex].verts[2]; + + // AP: measured to be a bit faster than the scalar version + const PxVec3 delta = unitDir*hit.distance; + Vec3V pointOnSeg, pointOnTri; + distanceSegmentTriangleSquared( + V3LoadU(capsule.p0 + delta), V3LoadU(capsule.p1 + delta), + V3LoadU(p0), V3LoadU(p1), V3LoadU(p2), + pointOnSeg, pointOnTri); + V3StoreU(pointOnTri, hit.position); + + hit.flags = PxHitFlag::eNORMAL|PxHitFlag::ePOSITION; + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.h new file mode 100644 index 0000000..61b2476 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepCapsuleTriangle.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_CAPSULE_TRIANGLE_H +#define GU_SWEEP_CAPSULE_TRIANGLE_H + +#include "foundation/PxVec3.h" +#include "PxQueryReport.h" + +namespace physx +{ + class PxTriangle; + +namespace Gu +{ + class BoxPadded; + class Capsule; + + /** + Sweeps a capsule against a set of triangles. + + \param nbTris [in] number of triangles in input array + \param triangles [in] array of input triangles + \param capsule [in] the capsule + \param unitDir [in] sweep's unit direcion + \param distance [in] sweep's length + \param cachedIndex [in] cached triangle index, or NULL. Cached triangle will be tested first. + \param hit [out] results + \param triNormalOut [out] triangle normal + \param hitFlags [in] query modifiers + \param isDoubleSided [in] true if input triangles are double-sided + \param cullBox [in] additional/optional culling box. Triangles not intersecting the box are quickly discarded. + \warning if using a cullbox, make sure all triangles can be safely V4Loaded (i.e. allocate 4 more bytes after last triangle) + \return true if an impact has been found + */ + bool sweepCapsuleTriangles_Precise( PxU32 nbTris, const PxTriangle* PX_RESTRICT triangles, // Triangle data + const Capsule& capsule, // Capsule data + const PxVec3& unitDir, const PxReal distance, // Ray data + const PxU32* PX_RESTRICT cachedIndex, // Cache data + PxGeomSweepHit& hit, PxVec3& triNormalOut, // Results + PxHitFlags hitFlags, bool isDoubleSided, // Query modifiers + const BoxPadded* cullBox=NULL); // Cull data + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp new file mode 100644 index 0000000..a0e9f49 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.cpp @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepSphereCapsule.h" +#include "GuSphere.h" +#include "GuCapsule.h" +#include "GuDistancePointSegment.h" +#include "GuSweepSphereSphere.h" +#include "GuIntersectionRayCapsule.h" + +using namespace physx; +using namespace Gu; + +bool Gu::sweepSphereCapsule(const Sphere& sphere, const Capsule& lss, const PxVec3& dir, PxReal length, PxReal& d, PxVec3& ip, PxVec3& nrm, PxHitFlags hitFlags) +{ + const PxReal radiusSum = lss.radius + sphere.radius; + + if(!(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) + { + // PT: test if shapes initially overlap + if(distancePointSegmentSquared(lss.p0, lss.p1, sphere.center)=0.0f && t<=length) + { + d = t; + +// PT: TODO: +// const PxIntBool needsImpactPoint = hitFlags & PxHitFlag::ePOSITION; +// if(needsImpactPoint || hitFlags & PxHitFlag::eNORMAL) + { + // Move capsule against sphere + const PxVec3 tdir = t*dir; + Inflated.p0 -= tdir; + Inflated.p1 -= tdir; + + // Compute closest point between moved capsule & sphere + distancePointSegmentSquared(Inflated, sphere.center, &t); + Inflated.computePoint(ip, t); + + // Normal + nrm = (ip - sphere.center); + nrm.normalize(); + +// if(needsImpactPoint) // PT: TODO + ip -= nrm * lss.radius; + } + return true; + } + } + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.h new file mode 100644 index 0000000..ff84248 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereCapsule.h @@ -0,0 +1,48 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_SPHERE_CAPSULE_H +#define GU_SWEEP_SPHERE_CAPSULE_H + +#include "foundation/PxVec3.h" +#include "PxQueryReport.h" + +namespace physx +{ +namespace Gu +{ + class Sphere; + class Capsule; + + bool sweepSphereCapsule(const Sphere& sphere, const Capsule& lss, const PxVec3& dir, PxReal length, PxReal& d, PxVec3& ip, PxVec3& nrm, PxHitFlags hitFlags); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp new file mode 100644 index 0000000..ab4cd90 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.cpp @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepSphereSphere.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Gu; + +// Adapted from Gamasutra (Gomez article) +// Return true if r1 and r2 are real +static PX_FORCE_INLINE bool quadraticFormula(const PxReal a, const PxReal b, const PxReal c, PxReal& r1, PxReal& r2) +{ + const PxReal q = b*b - 4*a*c; + if(q>=0.0f) + { + PX_ASSERT(a!=0.0f); + const PxReal sq = PxSqrt(q); + const PxReal d = 1.0f / (2.0f*a); + r1 = (-b + sq) * d; + r2 = (-b - sq) * d; + return true;//real roots + } + else + { + return false;//complex roots + } +} + +static bool sphereSphereSweep( const PxReal ra, //radius of sphere A + const PxVec3& A0, //previous position of sphere A + const PxVec3& A1, //current position of sphere A + const PxReal rb, //radius of sphere B + const PxVec3& B0, //previous position of sphere B + const PxVec3& B1, //current position of sphere B + PxReal& u0, //normalized time of first collision + PxReal& u1 //normalized time of second collision + ) +{ + const PxVec3 va = A1 - A0; + const PxVec3 vb = B1 - B0; + const PxVec3 AB = B0 - A0; + const PxVec3 vab = vb - va; // relative velocity (in normalized time) + const PxReal rab = ra + rb; + + const PxReal a = vab.dot(vab); //u*u coefficient + const PxReal b = 2.0f*(vab.dot(AB)); //u coefficient + + const PxReal c = (AB.dot(AB)) - rab*rab; //constant term + + //check if they're currently overlapping + if(c<=0.0f || a==0.0f) + { + u0 = 0.0f; + u1 = 0.0f; + return true; + } + + //check if they hit each other during the frame + if(quadraticFormula(a, b, c, u0, u1)) + { + if(u0>u1) + PxSwap(u0, u1); + + // u01.0f) return false; + if(u1<0.0f || u0>1.0f) return false; + + return true; + } + return false; +} + +bool Gu::sweepSphereSphere(const PxVec3& center0, PxReal radius0, const PxVec3& center1, PxReal radius1, const PxVec3& motion, PxReal& d, PxVec3& nrm) +{ + const PxVec3 movedCenter = center1 + motion; + + PxReal tmp; + if(!sphereSphereSweep(radius0, center0, center0, radius1, center1, movedCenter, d, tmp)) + return false; + + // Compute normal + // PT: if spheres initially overlap, the convention is that returned normal = -sweep direction + if(d==0.0f) + nrm = -motion; + else + nrm = (center1 + d * motion) - center0; + nrm.normalize(); + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.h new file mode 100644 index 0000000..360d9fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereSphere.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_SPHERE_SPHERE_H +#define GU_SWEEP_SPHERE_SPHERE_H + +#include "foundation/PxVec3.h" + +namespace physx +{ +namespace Gu +{ + bool sweepSphereSphere(const PxVec3& center0, PxReal radius0, const PxVec3& center1, PxReal radius1, const PxVec3& motion, PxReal& d, PxVec3& nrm); + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp new file mode 100644 index 0000000..e137a6e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.cpp @@ -0,0 +1,902 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuSweepSphereTriangle.h" +#include "GuIntersectionRaySphere.h" +#include "GuIntersectionRayCapsule.h" +#include "GuIntersectionRayTriangle.h" +#include "GuCapsule.h" +#include "GuInternal.h" +#include "foundation/PxUtilities.h" +#include "GuDistancePointTriangle.h" + +//#define PX_2413_FIX // Works in VT, but UT fails + +#ifdef PX_2413_FIX + #define FIXUP_UVS u += du; v += dv; +#else + #define FIXUP_UVS +#endif + +static const bool gSanityCheck = false; +//static const float gEpsilon = 0.1f; +#define gEpsilon 0.1f // PT: because otherwise compiler complains that this is unused + +// PT: alternative version that checks 2 capsules max and avoids the questionable heuristic and the whole du/dv fix +static const bool gUseAlternativeImplementation = true; + +using namespace physx; +using namespace Gu; + +// PT: using GU_CULLING_EPSILON_RAY_TRIANGLE fails here, in capsule-vs-mesh's triangle extrusion, when +// the sweep dir is almost the same as the capsule's dir (i.e. when we usually fallback to the sphere codepath). +// I suspect det becomes so small that we lose all accuracy when dividing by det and using the result in computing +// impact distance. +#define LOCAL_EPSILON 0.00001f + +// PT: special version computing (u,v) even when the ray misses the tri. Version working on precomputed edges. +static PX_FORCE_INLINE PxU32 rayTriSpecial(const PxVec3& orig, const PxVec3& dir, const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, PxReal& t, PxReal& u, PxReal& v) +{ + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const PxReal det = edge1.dot(pvec); + + // the non-culling branch +// if(det>-GU_CULLING_EPSILON_RAY_TRIANGLE && det-LOCAL_EPSILON && det1.0f) + return 1; + if(v<0.0f || u+v>1.0f) + return 1; + + // Calculate t, ray intersects triangle + t = (edge2.dot(qvec)) * oneOverDet; + + return 2; +} + +#ifdef PX_2413_FIX +static PX_FORCE_INLINE PxU32 rayTriSpecial3(const PxVec3& orig, const PxVec3& offset, const PxVec3& dir, const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, PxReal& t, PxReal& u, PxReal& v, PxReal& du, PxReal& dv) +{ + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const PxReal det = edge1.dot(pvec); + + // the non-culling branch +// if(det>-GU_CULLING_EPSILON_RAY_TRIANGLE && det-LOCAL_EPSILON && det1.0f || v<0.0f || u+v>1.0f) + { + du = (offset.dot(pvec)) * oneOverDet; + + const PxVec3 qvec = offset.cross(edge1); + + dv = (dir.dot(qvec)) * oneOverDet; + return 1; + } + + // Calculate t, ray intersects triangle + t = (edge2.dot(qvec)) * oneOverDet; + + return 2; +} +#endif + +// Returns true if sphere can be tested against triangle vertex, false if edge test should be performed +// +// Uses a conservative approach to work for "sliver triangles" (long & thin) as well. +static PX_FORCE_INLINE bool edgeOrVertexTest(const PxVec3& planeIntersectPoint, const PxVec3* PX_RESTRICT tri, PxU32 vertIntersectCandidate, PxU32 vert0, PxU32 vert1, PxU32& secondEdgeVert) +{ + { + const PxVec3 edge0 = tri[vertIntersectCandidate] - tri[vert0]; + const PxReal edge0LengthSqr = edge0.dot(edge0); + + const PxVec3 diff = planeIntersectPoint - tri[vert0]; + + if (edge0.dot(diff) < edge0LengthSqr) // If the squared edge length is used for comparison, the edge vector does not need to be normalized + { + secondEdgeVert = vert0; + return false; + } + } + + { + const PxVec3 edge1 = tri[vertIntersectCandidate] - tri[vert1]; + const PxReal edge1LengthSqr = edge1.dot(edge1); + + const PxVec3 diff = planeIntersectPoint - tri[vert1]; + + if (edge1.dot(diff) < edge1LengthSqr) + { + secondEdgeVert = vert1; + return false; + } + } + return true; +} + +static PX_FORCE_INLINE bool testRayVsSphereOrCapsule(PxReal& impactDistance, bool testSphere, const PxVec3& center, PxReal radius, const PxVec3& dir, const PxVec3* PX_RESTRICT verts, PxU32 e0, PxU32 e1) +{ + if(testSphere) + { + PxReal t; + if(intersectRaySphere(center, dir, PX_MAX_F32, verts[e0], radius, t)) + { + impactDistance = t; + return true; + } + } + else + { + PxReal t; + if(intersectRayCapsule(center, dir, verts[e0], verts[e1], radius, t)) + { + if(t>=0.0f/* && t= 0.0f) + R = -R; + + // The first point of the sphere to hit the triangle plane is the point of the sphere nearest to + // the triangle plane. Hence, we use center - (normal*radius) below. + + // PT: casting against the extruded triangle in direction R is the same as casting from a ray moved by -R + PxReal t; +#ifdef PX_2413_FIX + const PxU32 r = rayTriSpecial3(center-R, R, dir, triVerts[0], edge10, edge20, t, u, v, du, dv); +#else + const PxU32 r = rayTriSpecial(center-R, dir, triVerts[0], edge10, edge20, t, u, v); +#endif + if(!r) + return false; + if(r==2) + { + if(t<0.0f) + return false; + impactDistance = t; + directHit = true; + return true; + } + } + + float referenceMinDist = PX_MAX_F32; + bool referenceHit = false; + if(gSanityCheck) + { + PxReal t; + if(intersectRayCapsule(center, dir, triVerts[0], triVerts[1], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(intersectRayCapsule(center, dir, triVerts[1], triVerts[2], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(intersectRayCapsule(center, dir, triVerts[2], triVerts[0], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(!gUseAlternativeImplementation) + { + if(referenceHit) + impactDistance = referenceMinDist; + return referenceHit; + } + } + + // + // Let's do some art! + // + // The triangle gets divided into the following areas (based on the barycentric coordinates (u,v)): + // + // \ A0 / + // \ / + // \ / + // \/ 0 + // A02 * A01 + // u / / \ \ v + // * / \ * + // / \ . + // 2 / \ 1 + // ------*--------------*------- + // / \ . + // A2 / A12 \ A1 + // + // + // Based on the area where the computed triangle plane intersection point lies in, a different sweep test will be applied. + // + // A) A01, A02, A12 : Test sphere against the corresponding edge + // B) A0, A1, A2 : Test sphere against the corresponding vertex + // + // Unfortunately, B) does not work for long, thin triangles. Hence there is some extra code which does a conservative check and + // switches to edge tests if necessary. + // + + if(gUseAlternativeImplementation) + { + bool testTwoEdges = false; + PxU32 e0,e1,e2=0; + if(u<0.0f) + { + if(v<0.0f) + { + // 0 or 0-1 or 0-2 + testTwoEdges = true; + e0 = 0; + e1 = 1; + e2 = 2; + } + else if(u+v>1.0f) + { + // 2 or 2-0 or 2-1 + testTwoEdges = true; + e0 = 2; + e1 = 0; + e2 = 1; + } + else + { + // 0-2 + e0 = 0; + e1 = 2; + } + } + else + { + if(v<0.0f) + { + if(u+v>1.0f) + { + // 1 or 1-0 or 1-2 + testTwoEdges = true; + e0 = 1; + e1 = 0; + e2 = 2; + } + else + { + // 0-1 + e0 = 0; + e1 = 1; + } + } + else + { + PX_ASSERT(u+v>=1.0f); // Else hit triangle + // 1-2 + e0 = 1; + e1 = 2; + } + } + + bool hit = false; + PxReal t; + if(intersectRayCapsule(center, dir, triVerts[e0], triVerts[e1], radius, t) && t>=0.0f) + { + impactDistance = t; + hit = true; + } + if(testTwoEdges && intersectRayCapsule(center, dir, triVerts[e0], triVerts[e2], radius, t) && t>=0.0f) + { + if(!hit || t1.0f) + { + // 2 or 2-0 or 2-1 + e0 = 2; + FIXUP_UVS + const PxVec3 intersectPoint = INTERSECT_POINT; + TestSphere = edgeOrVertexTest(intersectPoint, triVerts, 2, 0, 1, e1); + } + else + { + // 0-2 + TestSphere = false; + e0 = 0; + e1 = 2; + } + } + else + { + if(v<0.0f) + { + if(u+v>1.0f) + { + // 1 or 1-0 or 1-2 + e0 = 1; + FIXUP_UVS + const PxVec3 intersectPoint = INTERSECT_POINT; + TestSphere = edgeOrVertexTest(intersectPoint, triVerts, 1, 0, 2, e1); + } + else + { + // 0-1 + TestSphere = false; + e0 = 0; + e1 = 1; + } + } + else + { + PX_ASSERT(u+v>=1.0f); // Else hit triangle + // 1-2 + TestSphere = false; + e0 = 1; + e1 = 2; + } + } + + return testRayVsSphereOrCapsule(impactDistance, TestSphere, center, radius, dir, triVerts, e0, e1); + } +} + +bool Gu::sweepSphereTriangles( PxU32 nbTris, const PxTriangle* PX_RESTRICT triangles, // Triangle data + const PxVec3& center, const PxReal radius, // Sphere data + const PxVec3& unitDir, PxReal distance, // Ray data + const PxU32* PX_RESTRICT cachedIndex, // Cache data + PxGeomSweepHit& h, PxVec3& triNormalOut, // Results + bool isDoubleSided, bool meshBothSides, bool anyHit, bool testInitialOverlap) // Query modifiers +{ + if(!nbTris) + return false; + + const bool doBackfaceCulling = !isDoubleSided && !meshBothSides; + + PxU32 index = PX_INVALID_U32; + const PxU32 initIndex = getInitIndex(cachedIndex, nbTris); + + PxReal curT = distance; + const PxReal dpc0 = center.dot(unitDir); + + PxReal bestAlignmentValue = 2.0f; + + PxVec3 bestTriNormal(0.0f); + + for(PxU32 ii=0; ii 0.0f)) + continue; + + const PxReal magnitude = triNormal.magnitude(); + if(magnitude==0.0f) + continue; + + triNormal /= magnitude; + + PxReal currentDistance; + bool unused; + if(!sweepSphereVSTri(currentTri.verts, triNormal, center, radius, unitDir, currentDistance, unused, testInitialOverlap)) + continue; + + const PxReal hitDot = computeAlignmentValue(triNormal, unitDir); + if(keepTriangle(currentDistance, hitDot, curT, bestAlignmentValue, distance)) + { + if(currentDistance==0.0f) + { + triNormalOut = -unitDir; + return setInitialOverlapResults(h, unitDir, i); + } + + curT = PxMin(curT, currentDistance); // exact lower bound + + index = i; + bestAlignmentValue = hitDot; + bestTriNormal = triNormal; + if(anyHit) + break; + } + // + else if(keepTriangleBasic(currentDistance, curT, distance)) + { + curT = PxMin(curT, currentDistance); // exact lower bound + } + // + } + return computeSphereTriangleImpactData(h, triNormalOut, index, curT, center, unitDir, bestTriNormal, triangles, isDoubleSided, meshBothSides); +} + +static PX_FORCE_INLINE PxU32 rayQuadSpecial2(const PxVec3& orig, const PxVec3& dir, const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, float& t, float& u, float& v) +{ + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const float det = edge1.dot(pvec); + + // the non-culling branch + if(det>-LOCAL_EPSILON && det1.0f) + return 1; + if(v<0.0f || v>1.0f) + return 1; + + // Calculate t, ray intersects triangle + t = edge2.dot(qvec) * oneOverDet; + + return 2; +} + +#ifdef PX_2413_FIX +static PX_FORCE_INLINE PxU32 rayQuadSpecial3(const PxVec3& orig, const PxVec3& offset, const PxVec3& dir, const PxVec3& vert0, const PxVec3& edge1, const PxVec3& edge2, float& t, float& u, float& v, float& du, float& dv) +{ + // Begin calculating determinant - also used to calculate U parameter + const PxVec3 pvec = dir.cross(edge2); + + // If determinant is near zero, ray lies in plane of triangle + const float det = edge1.dot(pvec); + + // the non-culling branch + if(det>-LOCAL_EPSILON && det1.0f || v<0.0f || v>1.0f) + { + du = (offset.dot(pvec)) * oneOverDet; + + const PxVec3 qvec = offset.cross(edge1); + + dv = (dir.dot(qvec)) * oneOverDet; + + return 1; + } + + // Calculate t, ray intersects triangle + t = edge2.dot(qvec) * oneOverDet; + + return 2; +} +#endif + +bool Gu::sweepSphereVSQuad(const PxVec3* PX_RESTRICT quadVerts, const PxVec3& normal, const PxVec3& center, float radius, const PxVec3& dir, float& impactDistance) +{ + // Quad formed by 2 tris: + // p0 p1 p2 + // p2 p1 p3 = p3 p2 p1 + // + // p0___p2 + // | /| + // | / | + // | / | + // |/ | + // p1---p3 + // + // Edge10 = p1 - p0 + // Edge20 = p2 - p0 + // Impact point = Edge10*u + Edge20*v + p0 + // => u is along Y, between 0.0 (p0;p2) and 1.0 (p1;p3) + // => v is along X, between 0.0 (p0;p1) and 1.0 (p2;p3) + // + // For the second triangle, + // Edge10b = p2 - p3 = -Edge10 + // Edge20b = p1 - p3 = -Edge20 + + const PxVec3 Edge10 = quadVerts[1] - quadVerts[0]; + const PxVec3 Edge20 = quadVerts[2] - quadVerts[0]; + + if(1) // ### brute force version that always works, but we can probably do better + { + const float r2 = radius*radius; + { + const PxVec3 Cp = closestPtPointTriangle2(center, quadVerts[0], quadVerts[1], quadVerts[2], Edge10, Edge20); + if((Cp - center).magnitudeSquared() <= r2) + { + impactDistance = 0.0f; + return true; + } + } + { + const PxVec3 Cp = closestPtPointTriangle2(center, quadVerts[3], quadVerts[2], quadVerts[1], -Edge10, -Edge20); + if((Cp - center).magnitudeSquared() <= r2) + { + impactDistance = 0.0f; + return true; + } + } + } + + float u,v; +#ifdef PX_2413_FIX + float du, dv; +#endif + if(1) + { + PxVec3 R = normal * radius; + if(dir.dot(R) >= 0.0f) + R = -R; + + // The first point of the sphere to hit the quad plane is the point of the sphere nearest to + // the quad plane. Hence, we use center - (normal*radius) below. + + // PT: casting against the extruded quad in direction R is the same as casting from a ray moved by -R + float t; +#ifdef PX_2413_FIX + const PxU32 r = rayQuadSpecial3(center-R, R, dir, quadVerts[0], Edge10, Edge20, t, u, v, du, dv); +#else + PxU32 r = rayQuadSpecial2(center-R, dir, quadVerts[0], Edge10, Edge20, t, u, v); +#endif + if(!r) + return false; + if(r==2) + { + if(t<0.0f) + return false; + impactDistance = t; + return true; + } + } + + bool referenceHit = false; + float referenceMinDist = PX_MAX_F32; + if(gSanityCheck) + { + PxReal t; + if(intersectRayCapsule(center, dir, quadVerts[0], quadVerts[1], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(intersectRayCapsule(center, dir, quadVerts[1], quadVerts[3], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(intersectRayCapsule(center, dir, quadVerts[3], quadVerts[2], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(intersectRayCapsule(center, dir, quadVerts[2], quadVerts[0], radius, t) && t>=0.0f) + { + referenceHit = true; + referenceMinDist = PxMin(referenceMinDist, t); + } + if(!gUseAlternativeImplementation) + { + if(referenceHit) + impactDistance = referenceMinDist; + return referenceHit; + } + } + + PxSwap(u, v); + + if(gUseAlternativeImplementation) + { + bool testTwoEdges = false; + PxU32 e0,e1,e2=0; + + if(u<0.0f) + { + if(v<0.0f) + { + // 0 or 0-1 or 0-2 + testTwoEdges = true; + e0 = 0; + e1 = 1; + e2 = 2; + } + else if(v>1.0f) + { + // 1 or 1-0 or 1-3 + testTwoEdges = true; + e0 = 1; + e1 = 0; + e2 = 3; + } + else + { + // 0-1 + e0 = 0; + e1 = 1; + } + } + else if(u>1.0f) + { + if(v<0.0f) + { + // 2 or 2-0 or 2-3 + testTwoEdges = true; + e0 = 2; + e1 = 0; + e2 = 3; + } + else if(v>1.0f) + { + // 3 or 3-1 or 3-2 + testTwoEdges = true; + e0 = 3; + e1 = 1; + e2 = 2; + } + else + { + // 2-3 + e0 = 2; + e1 = 3; + } + } + else + { + if(v<0.0f) + { + // 0-2 + e0 = 0; + e1 = 2; + } + else + { + PX_ASSERT(v>=1.0f); // Else hit quad + // 1-3 + e0 = 1; + e1 = 3; + } + } + + bool hit = false; + PxReal t; + if(intersectRayCapsule(center, dir, quadVerts[e0], quadVerts[e1], radius, t) && t>=0.0f) + { + impactDistance = t; + hit = true; + } + if(testTwoEdges && intersectRayCapsule(center, dir, quadVerts[e0], quadVerts[e2], radius, t) && t>=0.0f) + { + if(!hit || t1.0f) + { + // 1 or 1-0 or 1-3 + e0 = 1; + FIXUP_UVS + const PxVec3 intersectPoint = INTERSECT_POINT_Q; + TestSphere = edgeOrVertexTest(intersectPoint, quadVerts, 1, 0, 3, e1); + } + else + { + // 0-1 + TestSphere = false; + e0 = 0; + e1 = 1; + } + } + else if(u>1.0f) + { + if(v<0.0f) + { + // 2 or 2-0 or 2-3 + e0 = 2; + FIXUP_UVS + const PxVec3 intersectPoint = INTERSECT_POINT_Q; + TestSphere = edgeOrVertexTest(intersectPoint, quadVerts, 2, 0, 3, e1); + } + else if(v>1.0f) + { + // 3 or 3-1 or 3-2 + e0 = 3; + FIXUP_UVS + const PxVec3 intersectPoint = INTERSECT_POINT_Q; + TestSphere = edgeOrVertexTest(intersectPoint, quadVerts, 3, 1, 2, e1); + } + else + { + // 2-3 + TestSphere = false; + e0 = 2; + e1 = 3; + } + } + else + { + if(v<0.0f) + { + // 0-2 + TestSphere = false; + e0 = 0; + e1 = 2; + } + else + { + PX_ASSERT(v>=1.0f); // Else hit quad + // 1-3 + TestSphere = false; + e0 = 1; + e1 = 3; + } + } + + return testRayVsSphereOrCapsule(impactDistance, TestSphere, center, radius, dir, quadVerts, e0, e1); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.h new file mode 100644 index 0000000..4a24118 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepSphereTriangle.h @@ -0,0 +1,155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_SPHERE_TRIANGLE_H +#define GU_SWEEP_SPHERE_TRIANGLE_H + +#include "GuSweepTriangleUtils.h" + +namespace physx +{ + +namespace Gu +{ + /** + Sweeps a sphere against a triangle. + + All input parameters (sphere, triangle, sweep direction) must be in the same space. Sweep length is assumed to be infinite. + + By default, 'testInitialOverlap' must be set to true to properly handle the case where the sphere already overlaps the triangle + at the start of the sweep. In such a case, returned impact distance is exactly 0.0f. If it is known ahead of time that the sphere + cannot overlap the triangle at t=0.0, then 'testInitialOverlap' can be set to false to skip the initial overlap test and make the + function run faster. + + If the ray defined by the sphere's center and the unit direction directly intersects the triangle-related part of the TSS (*) (i.e. + the prism from the Minkowski sum of the inflated triangle) then 'directHit' is set to true. Otherwise it is set to false. + + (*) For Triangle Swept Sphere, see http://gamma.cs.unc.edu/SSV/ssv.pdf for the origin of these names. + + \param triVerts [in] triangle vertices + \param triUnitNormal [in] triangle's normalized normal + \param sphereCenter [in] sphere's center + \param sphereRadius [in] sphere's radius + \param unitDir [in] normalized sweep direction. + \param impactDistance [out] impact distance, if a hit has been found. Does not need to be initialized before calling the function. + \param directHit [out] true if a direct hit has been found, see comments above. + \param testInitialOverlap [in] true if an initial sphere-vs-triangle overlap test must be performed, see comments above. + + \return true if an impact has been found (in which case returned result values are valid) + */ + bool sweepSphereVSTri( const PxVec3* PX_RESTRICT triVerts, const PxVec3& triUnitNormal,// Triangle data + const PxVec3& sphereCenter, PxReal sphereRadius, // Sphere data + const PxVec3& unitDir, // Ray data + PxReal& impactDistance, bool& directHit, // Results + bool testInitialOverlap); // Query modifier + + /** + Sweeps a sphere against a quad. + + All input parameters (sphere, quad, sweep direction) must be in the same space. Sweep length is assumed to be infinite. + + Quad must be formed by 2 tris like this: + + p0___p2 + | /| + | / | + | / | + |/ | + p1---p3 + + \param quadVerts [in] quad vertices + \param quadUnitNormal [in] quad's normalized normal + \param sphereCenter [in] sphere's center + \param sphereRadius [in] sphere's radius + \param unitDir [in] normalized sweep direction. + \param impactDistance [out] impact distance, if a hit has been found. Does not need to be initialized before calling the function. + + \return true if an impact has been found (in which case returned result values are valid) + */ + bool sweepSphereVSQuad( const PxVec3* PX_RESTRICT quadVerts, const PxVec3& quadUnitNormal, // Quad data + const PxVec3& sphereCenter, float sphereRadius, // Sphere data + const PxVec3& unitDir, // Ray data + float& impactDistance); // Results + + + // PT: computes proper impact data for sphere-sweep-vs-tri, after the closest tri has been found + PX_FORCE_INLINE bool computeSphereTriangleImpactData(PxGeomSweepHit& h, PxVec3& triNormalOut, PxU32 index, PxReal curT, + const PxVec3& center, const PxVec3& unitDir, const PxVec3& bestTriNormal, + const PxTriangle* PX_RESTRICT triangles, + bool isDoubleSided, bool meshBothSides) + { + if(index==PX_INVALID_U32) + return false; // We didn't touch any triangle + + // Compute impact data only once, using best triangle + PxVec3 hitPos, normal; + computeSphereTriImpactData(hitPos, normal, center, unitDir, curT, triangles[index]); + + // PT: by design, returned normal is opposed to the sweep direction. + if(shouldFlipNormal(normal, meshBothSides, isDoubleSided, bestTriNormal, unitDir)) + normal = -normal; + + h.position = hitPos; + h.normal = normal; + h.distance = curT; + h.faceIndex = index; + h.flags = PxHitFlag::eNORMAL|PxHitFlag::ePOSITION; + triNormalOut = bestTriNormal; + return true; + } + + /** + Sweeps a sphere against a set of triangles. + + \param nbTris [in] number of triangles in input array + \param triangles [in] array of input triangles + \param center [in] sphere's center + \param radius [in] sphere's radius + \param unitDir [in] sweep's unit direcion + \param distance [in] sweep's length + \param cachedIndex [in] cached triangle index, or NULL. Cached triangle will be tested first. + \param hit [out] results + \param triNormalOut [out] triangle normal + \param isDoubleSided [in] true if input triangles are double-sided + \param meshBothSides [in] true if PxHitFlag::eMESH_BOTH_SIDES is used + \param anyHit [in] true if PxHitFlag::eMESH_ANY is used + \param testInitialOverlap [in] true if PxHitFlag::eASSUME_NO_INITIAL_OVERLAP is not used + \return true if an impact has been found + */ + bool sweepSphereTriangles( PxU32 nbTris, const PxTriangle* PX_RESTRICT triangles, // Triangle data + const PxVec3& center, const PxReal radius, // Sphere data + const PxVec3& unitDir, PxReal distance, // Ray data + const PxU32* PX_RESTRICT cachedIndex, // Cache data + PxGeomSweepHit& hit, PxVec3& triNormalOut, // Results + bool isDoubleSided, bool meshBothSides, bool anyHit, bool testInitialOverlap); // Query modifiers + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp new file mode 100644 index 0000000..8939c1d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.cpp @@ -0,0 +1,222 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxBounds3.h" +#include "GuSweepTriangleUtils.h" +#include "GuDistancePointTriangle.h" +#include "GuVecTriangle.h" +#include "GuVecBox.h" +#include "GuSweepBoxTriangle_FeatureBased.h" +#include "GuInternal.h" +#include "GuGJK.h" + +using namespace physx; +using namespace Gu; +using namespace physx::aos; + +#define GU_SAFE_DISTANCE_FOR_NORMAL_COMPUTATION 0.1f + +void Gu::computeSphereTriImpactData(PxVec3& hit, PxVec3& normal, const PxVec3& center, const PxVec3& dir, float t, const PxTriangle& tri) +{ + const PxVec3 newSphereCenter = center + dir*t; + + // We need the impact point, not computed by the new code + PxReal u_unused, v_unused; + const PxVec3 localHit = closestPtPointTriangle(newSphereCenter, tri.verts[0], tri.verts[1], tri.verts[2], u_unused, v_unused); + PX_UNUSED(u_unused); + PX_UNUSED(v_unused); + + // This is responsible for the cap-vs-box stuck while jumping. However it's needed to slide on box corners! + // PT: this one is also dubious since the sphere/capsule center can be far away from the hit point when the radius is big! + PxVec3 localNormal = newSphereCenter - localHit; + const PxReal m = localNormal.normalize(); + if(m<1e-3f) + tri.normal(localNormal); + + hit = localHit; + normal = localNormal; +} + +// PT: not inlining this rarely-run function makes the benchmark ~500.000 cycles faster... +// PT: using this version all the time makes the benchmark ~300.000 cycles slower. So we just use it as a backup. +static bool runBackupProcedure(PxVec3& hit, PxVec3& normal, const PxVec3& localMotion, const PxVec3& boxExtents, const PxTriangle& triInBoxSpace) +{ + const Vec3V v0 = V3LoadU(triInBoxSpace.verts[0]); + const Vec3V v1 = V3LoadU(triInBoxSpace.verts[1]); + const Vec3V v2 = V3LoadU(triInBoxSpace.verts[2]); + + const TriangleV triangleV(v0, v1, v2); + + // PT: the box is in the triangle's space already + //BoxV boxV(V3LoadU(PxVec3(0.0f)), V3LoadU(boxExtents), + // V3LoadU(PxVec3(1.0f, 0.0f, 0.0f)), V3LoadU(PxVec3(0.0f, 1.0f, 0.0f)), V3LoadU(PxVec3(0.0f, 0.0f, 1.0f))); + + const BoxV boxV(V3Zero(), V3LoadU(boxExtents)); + + Vec3V closestA; + Vec3V closestB; + Vec3V normalV; + FloatV distV; + const LocalConvex convexA(triangleV); + const LocalConvex convexB(boxV); + const Vec3V initialSearchDir = V3Sub(triangleV.getCenter(), boxV.getCenter()); + const FloatV contactDist = FMax(); + GjkStatus status_ = gjk, LocalConvex >(convexA, convexB, initialSearchDir, contactDist, closestA, closestB, normalV, distV); + + if(status_==GJK_CONTACT) + return false; + + PxVec3 ml_closestB; + PxVec3 ml_normal; + V3StoreU(closestB, ml_closestB); + V3StoreU(normalV, ml_normal); + + hit = ml_closestB + localMotion; +// normal = -ml_normal; + if((ml_normal.dot(localMotion))>0.0f) + ml_normal = -ml_normal; + normal = ml_normal; + return true; +} + +void Gu::computeBoxTriImpactData(PxVec3& hit, PxVec3& normal, const PxVec3& boxExtents, const PxVec3& localDir, const PxTriangle& triInBoxSpace, PxReal impactDist) +{ + // PT: the triangle is in "box space", i.e. the box can be seen as an AABB centered around the origin. + + // PT: compute impact point/normal in a second pass. Here we simply re-sweep the box against the best triangle, + // using the feature-based code (which computes impact point and normal). This is not great because: + // - we know there's an impact so why do all tests again? + // - the SAT test & the feature-based tests could return different results because of FPU accuracy. + // The backup procedure makes sure we compute a proper answer even when the SAT and feature-based versions differ. + const PxBounds3 aabb(-boxExtents, boxExtents); + + const PxVec3 oneOverDir( + localDir.x!=0.0f ? 1.0f/localDir.x : 0.0f, + localDir.y!=0.0f ? 1.0f/localDir.y : 0.0f, + localDir.z!=0.0f ? 1.0f/localDir.z : 0.0f); + + // PT: TODO: this is the only place left using sweepBoxTriangle() + // Backface culling could be removed here since we know we want a hit no matter what. Plus, it's sometimes + // incorrectly culled and we hit the backup procedure for no reason. On Win32Modern for unknown reasons + // returned normal is sometimes (0,0,0). In these cases we also switch to the backup procedure. + float t = PX_MAX_F32; // PT: no need to initialize with best dist here since we want a hit no matter what + if(!sweepBoxTriangle(triInBoxSpace, aabb, localDir, oneOverDir, hit, normal, t) || normal.isZero()) + { + // PT: move triangle close to box + const PxVec3 localMotion = localDir*impactDist; + + const PxVec3 delta = localMotion - localDir*GU_SAFE_DISTANCE_FOR_NORMAL_COMPUTATION; + const PxTriangle movedTriangle( + triInBoxSpace.verts[0] - delta, + triInBoxSpace.verts[1] - delta, + triInBoxSpace.verts[2] - delta); + + if(!runBackupProcedure(hit, normal, localMotion, boxExtents, movedTriangle)) + { + // PT: if the backup procedure fails, we give up + hit = PxVec3(0.0f); + normal = -localDir; + } + } +} + +// PT: copy where we know that input vectors are not zero +static PX_FORCE_INLINE void edgeEdgeDistNoZeroVector( PxVec3& x, PxVec3& y, // closest points + const PxVec3& p, const PxVec3& a, // seg 1 origin, vector + const PxVec3& q, const PxVec3& b) // seg 2 origin, vector +{ + const PxVec3 T = q - p; + const PxReal ADotA = a.dot(a); + const PxReal BDotB = b.dot(b); + PX_ASSERT(ADotA!=0.0f); + PX_ASSERT(BDotB!=0.0f); + const PxReal ADotB = a.dot(b); + const PxReal ADotT = a.dot(T); + const PxReal BDotT = b.dot(T); + + // t parameterizes ray (p, a) + // u parameterizes ray (q, b) + + // Compute t for the closest point on ray (p, a) to ray (q, b) + const PxReal Denom = ADotA*BDotB - ADotB*ADotB; + + PxReal t; + if(Denom!=0.0f) + { + t = (ADotT*BDotB - BDotT*ADotB) / Denom; + + // Clamp result so t is on the segment (p, a) + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else + { + t = 0.0f; + } + + // find u for point on ray (q, b) closest to point at t + PxReal u; + { + u = (t*ADotB - BDotT) / BDotB; + + // if u is on segment (q, b), t and u correspond to closest points, otherwise, clamp u, recompute and clamp t + if(u<0.0f) + { + u = 0.0f; + t = ADotT / ADotA; + + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + else if(u > 1.0f) + { + u = 1.0f; + t = (ADotB + ADotT) / ADotA; + + if(t<0.0f) t = 0.0f; + else if(t>1.0f) t = 1.0f; + } + } + + x = p + a * t; + y = q + b * u; +} + +void Gu::computeEdgeEdgeNormal(PxVec3& normal, const PxVec3& p1, const PxVec3& p2_p1, const PxVec3& p3, const PxVec3& p4_p3, const PxVec3& dir, float d) +{ + // PT: cross-product doesn't produce nice normals so we use an edge-edge distance function itself + + // PT: move the edges "0.1" units from each other before the computation. If the edges are too far + // away, computed normal tend to align itself with the swept direction. If the edges are too close, + // closest points x and y become identical and we can't compute a proper normal. + const PxVec3 p1s = p1 + dir*(d-GU_SAFE_DISTANCE_FOR_NORMAL_COMPUTATION); + + PxVec3 x, y; + edgeEdgeDistNoZeroVector(x, y, p1s, p2_p1, p3, p4_p3); + normal = x - y; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.h new file mode 100644 index 0000000..d5eb5c9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/geomutils/src/sweep/GuSweepTriangleUtils.h @@ -0,0 +1,337 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef GU_SWEEP_TRIANGLE_UTILS_H +#define GU_SWEEP_TRIANGLE_UTILS_H + +#include "geometry/PxTriangle.h" +#include "PxQueryReport.h" + +#include "GuSweepSharedTests.h" +#include "GuInternal.h" + +namespace physx +{ + +namespace Gu +{ + // PT: computes proper impact data for sphere-sweep-vs-tri, after the closest tri has been found. + void computeSphereTriImpactData(PxVec3& hit, PxVec3& normal, const PxVec3& center, const PxVec3& dir, float t, const PxTriangle& tri); + + // PT: computes proper impact data for box-sweep-vs-tri, after the closest tri has been found. + void computeBoxTriImpactData(PxVec3& hit, PxVec3& normal, const PxVec3& boxExtents, const PxVec3& localDir, const PxTriangle& triInBoxSpace, PxReal impactDist); + + // PT: computes impact normal between two edges. Produces better normals than just the EE cross product. + // This version properly computes the closest points between two colliding edges and makes a normal from these. + void computeEdgeEdgeNormal(PxVec3& normal, const PxVec3& p1, const PxVec3& p2_p1, const PxVec3& p3, const PxVec3& p4_p3, const PxVec3& dir, float d); + + // PT: small function just to avoid duplicating the code. + // Returns index of first triangle we should process (when processing arrays of input triangles) + PX_FORCE_INLINE PxU32 getInitIndex(const PxU32* PX_RESTRICT cachedIndex, PxU32 nbTris) + { + PxU32 initIndex = 0; // PT: by default the first triangle to process is just the first one in the array + if(cachedIndex) // PT: but if we cached the last closest triangle from a previous call... + { + PX_ASSERT(*cachedIndex < nbTris); + PX_UNUSED(nbTris); + initIndex = *cachedIndex; // PT: ...then we should start with that one, to potentially shrink the ray as early as possible + } + return initIndex; + } + + // PT: quick triangle rejection for sphere-based sweeps. + // Please refer to %SDKRoot%\InternalDocumentation\GU\cullTriangle.png for details & diagram. + PX_FORCE_INLINE bool cullTriangle(const PxVec3* PX_RESTRICT triVerts, const PxVec3& dir, PxReal radius, PxReal t, const PxReal dpc0) + { + // PT: project triangle on axis + const PxReal dp0 = triVerts[0].dot(dir); + const PxReal dp1 = triVerts[1].dot(dir); + const PxReal dp2 = triVerts[2].dot(dir); + + // PT: keep min value = earliest possible impact distance + PxReal dp = dp0; + dp = physx::intrinsics::selectMin(dp, dp1); + dp = physx::intrinsics::selectMin(dp, dp2); + + // PT: make sure we keep triangles that are about as close as best current distance + radius += 0.001f + GU_EPSILON_SAME_DISTANCE; + + // PT: if earliest possible impact distance for this triangle is already larger than + // sphere's current best known impact distance, we can skip the triangle + if(dp>dpc0 + t + radius) + { + //PX_ASSERT(resx == 0.0f); + return false; + } + + // PT: if triangle is fully located before the sphere's initial position, skip it too + const PxReal dpc1 = dpc0 - radius; + if(dp0dpc0 + t + radius) + return false; + + // PT: if quad is fully located before the sphere's initial position, skip it too + const float dpc1 = dpc0 - radius; + if(dp0 + // t (t<=fT) t (t>fT) + // return (A)^2 return (B)^2 + // + // |<-------------->| + // fT + // + PX_FORCE_INLINE PxReal squareDistance(const PxVec3& p0, const PxVec3& dir, PxReal t, const PxVec3& point) + { + PxVec3 diff = point - p0; + PxReal fT = diff.dot(dir); + fT = physx::intrinsics::selectMax(fT, 0.0f); + fT = physx::intrinsics::selectMin(fT, t); + diff -= fT*dir; + return diff.magnitudeSquared(); + } + + // PT: quick triangle culling for sphere-based sweeps + // Please refer to %SDKRoot%\InternalDocumentation\GU\coarseCulling.png for details & diagram. + PX_FORCE_INLINE bool coarseCullingTri(const PxVec3& center, const PxVec3& dir, PxReal t, PxReal radius, const PxVec3* PX_RESTRICT triVerts) + { + // PT: compute center of triangle ### could be precomputed? + const PxVec3 triCenter = (triVerts[0] + triVerts[1] + triVerts[2]) * (1.0f/3.0f); + + // PT: distance between the triangle center and the swept path (an LSS) + // Same as: distancePointSegmentSquared(center, center+dir*t, TriCenter); + PxReal d = PxSqrt(squareDistance(center, dir, t, triCenter)) - radius - 0.0001f; + + if (d < 0.0f) // The triangle center lies inside the swept sphere + return true; + + d*=d; + + // PT: coarse capsule-vs-triangle overlap test ### distances could be precomputed? + if(1) + { + if(d <= (triCenter-triVerts[0]).magnitudeSquared()) + return true; + if(d <= (triCenter-triVerts[1]).magnitudeSquared()) + return true; + if(d <= (triCenter-triVerts[2]).magnitudeSquared()) + return true; + } + else + { + const float d0 = (triCenter-triVerts[0]).magnitudeSquared(); + const float d1 = (triCenter-triVerts[1]).magnitudeSquared(); + const float d2 = (triCenter-triVerts[2]).magnitudeSquared(); + float triRadius = physx::intrinsics::selectMax(d0, d1); + triRadius = physx::intrinsics::selectMax(triRadius, d2); + if(d <= triRadius) + return true; + } + return false; + } + + // PT: quick quad culling for sphere-based sweeps. Same as for triangle, adapted for one more vertex. + PX_FORCE_INLINE bool coarseCullingQuad(const PxVec3& center, const PxVec3& dir, PxReal t, PxReal radius, const PxVec3* PX_RESTRICT quadVerts) + { + // PT: compute center of quad ### could be precomputed? + const PxVec3 quadCenter = (quadVerts[0] + quadVerts[1] + quadVerts[2] + quadVerts[3]) * (1.0f/4.0f); + + // PT: distance between the quad center and the swept path (an LSS) + PxReal d = PxSqrt(squareDistance(center, dir, t, quadCenter)) - radius - 0.0001f; + + if (d < 0.0f) // The quad center lies inside the swept sphere + return true; + + d*=d; + + // PT: coarse capsule-vs-quad overlap test ### distances could be precomputed? + if(1) + { + if(d <= (quadCenter-quadVerts[0]).magnitudeSquared()) + return true; + if(d <= (quadCenter-quadVerts[1]).magnitudeSquared()) + return true; + if(d <= (quadCenter-quadVerts[2]).magnitudeSquared()) + return true; + if(d <= (quadCenter-quadVerts[3]).magnitudeSquared()) + return true; + } + return false; + } + + // PT: combined triangle culling for sphere-based sweeps + PX_FORCE_INLINE bool rejectTriangle(const PxVec3& center, const PxVec3& unitDir, PxReal curT, PxReal radius, const PxVec3* PX_RESTRICT triVerts, const PxReal dpc0) + { + if(!coarseCullingTri(center, unitDir, curT, radius, triVerts)) + return true; + if(!cullTriangle(triVerts, unitDir, radius, curT, dpc0)) + return true; + return false; + } + + // PT: combined quad culling for sphere-based sweeps + PX_FORCE_INLINE bool rejectQuad(const PxVec3& center, const PxVec3& unitDir, PxReal curT, PxReal radius, const PxVec3* PX_RESTRICT quadVerts, const PxReal dpc0) + { + if(!coarseCullingQuad(center, unitDir, curT, radius, quadVerts)) + return true; + if(!cullQuad(quadVerts, unitDir, radius, curT, dpc0)) + return true; + return false; + } + + PX_FORCE_INLINE bool shouldFlipNormal(const PxVec3& normal, bool meshBothSides, bool isDoubleSided, const PxVec3& triangleNormal, const PxVec3& dir) + { + // PT: this function assumes that input normal is opposed to the ray/sweep direction. This is always + // what we want except when we hit a single-sided back face with 'meshBothSides' enabled. + + if(!meshBothSides || isDoubleSided) + return false; + + PX_ASSERT(normal.dot(dir) <= 0.0f); // PT: if this fails, the logic below cannot be applied + PX_UNUSED(normal); + return triangleNormal.dot(dir) > 0.0f; // PT: true for back-facing hits + } + + PX_FORCE_INLINE bool shouldFlipNormal(const PxVec3& normal, bool meshBothSides, bool isDoubleSided, const PxTriangle& triangle, const PxVec3& dir, const PxTransform* pose) + { + // PT: this function assumes that input normal is opposed to the ray/sweep direction. This is always + // what we want except when we hit a single-sided back face with 'meshBothSides' enabled. + + if(!meshBothSides || isDoubleSided) + return false; + + PX_ASSERT(normal.dot(dir) <= 0.0f); // PT: if this fails, the logic below cannot be applied + PX_UNUSED(normal); + + PxVec3 triangleNormal; + triangle.denormalizedNormal(triangleNormal); + + if(pose) + triangleNormal = pose->rotate(triangleNormal); + + return triangleNormal.dot(dir) > 0.0f; // PT: true for back-facing hits + } + + // PT: implements the spec for IO sweeps in a single place (to ensure consistency) + PX_FORCE_INLINE bool setInitialOverlapResults(PxGeomSweepHit& hit, const PxVec3& unitDir, PxU32 faceIndex) + { + // PT: please write these fields in the order they are listed in the struct. + hit.faceIndex = faceIndex; + hit.flags = PxHitFlag::eNORMAL|PxHitFlag::eFACE_INDEX; + hit.normal = -unitDir; + hit.distance = 0.0f; + return true; // PT: true indicates a hit, saves some lines in calling code + } + + PX_FORCE_INLINE void computeBoxLocalImpact( PxVec3& pos, PxVec3& normal, PxHitFlags& outFlags, + const Box& box, const PxVec3& localDir, const PxTriangle& triInBoxSpace, + const PxHitFlags inFlags, bool isDoubleSided, bool meshBothSides, PxReal impactDist) + { + if(inFlags & (PxHitFlag::eNORMAL|PxHitFlag::ePOSITION)) + { + PxVec3 localPos, localNormal; + computeBoxTriImpactData(localPos, localNormal, box.extents, localDir, triInBoxSpace, impactDist); + + if(inFlags & PxHitFlag::eNORMAL) + { + localNormal.normalize(); + + // PT: doing this after the 'rotate' minimizes errors when normal and dir are close to perpendicular + // ....but we must do it before the rotate now, because triangleNormal is in box space (and thus we + // need the normal with the proper orientation, in box space. We can't fix it after it's been rotated + // to box space. + // Technically this one is only here because of the EE cross product in the feature-based sweep. + // PT: TODO: revisit corresponding code in computeImpactData, get rid of ambiguity + // PT: TODO: this may not be needed anymore + if((localNormal.dot(localDir))>0.0f) + localNormal = -localNormal; + + // PT: this one is to ensure the normal respects the mesh-both-sides/double-sided convention + if(shouldFlipNormal(localNormal, meshBothSides, isDoubleSided, triInBoxSpace, localDir, NULL)) + localNormal = -localNormal; + + normal = box.rotate(localNormal); + outFlags |= PxHitFlag::eNORMAL; + } + + if(inFlags & PxHitFlag::ePOSITION) + { + pos = box.transform(localPos); + outFlags |= PxHitFlag::ePOSITION; + } + } + } + +} // namespace Gu + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp new file mode 100644 index 0000000..e3ab9e2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/immediatemode/src/NpImmediateMode.cpp @@ -0,0 +1,2908 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxImmediateMode.h" +#include "PxBroadPhase.h" +#include "../../lowleveldynamics/src/DyBodyCoreIntegrator.h" +#include "../../lowleveldynamics/src/DyContactPrep.h" +#include "../../lowleveldynamics/src/DyCorrelationBuffer.h" +#include "../../lowleveldynamics/src/DyConstraintPrep.h" +#include "../../lowleveldynamics/src/DySolverControl.h" +#include "../../lowleveldynamics/src/DySolverContext.h" +#include "../../lowlevel/common/include/collision/PxcContactMethodImpl.h" +#include "../../lowleveldynamics/src/DyTGSContactPrep.h" +#include "GuPersistentContactManifold.h" +#include "NpConstraint.h" +#include "common/PxProfileZone.h" + +// PT: just for Dy::DY_ARTICULATION_MAX_SIZE +#include "../../lowleveldynamics/include/DyFeatherstoneArticulation.h" + +#include "../../lowlevel/common/include/utils/PxcScratchAllocator.h" + +using namespace physx; +using namespace Dy; +using namespace immediate; + +void immediate::PxConstructSolverBodies(const PxRigidBodyData* inRigidData, PxSolverBodyData* outSolverBodyData, PxU32 nbBodies, const PxVec3& gravity, PxReal dt, bool gyroscopicForces) +{ + PX_ASSERT((size_t(inRigidData) & 0xf) == 0); + PX_ASSERT((size_t(outSolverBodyData) & 0xf) == 0); + + for(PxU32 a=0; a mLinks; + PxArray mBodyCores; + PxArray mArticulationJointCores; + PxArticulationFlags mFlags; // PT: PX-1399. Stored in Dy::ArticulationCore for retained mode. + + // PT: quick and dirty version, to improve later + struct immArticulationLinkDataRC : PxArticulationLinkDataRC + { + PxArticulationLinkCookie parent; + PxU32 userID; + }; + PxArray mTemp; + PxArray mTempDeltaV; + PxArray mTempZ; + + bool mImmDirty; + bool mJCalcDirty; + private: + void initJointCore(Dy::ArticulationJointCore& core, const PxArticulationJointDataRC& inboundJoint); + }; + +#define MAX_NUM_PARTITIONS 32u + + class RigidBodyClassification + { + PX_NOCOPY(RigidBodyClassification) + private: + PxU8* PX_RESTRICT mBodies; + const PxU32 mBodySize; + const PxU32 mBodyStride; + const PxU32 mBodyCount; + + public: + RigidBodyClassification(PxU8* PX_RESTRICT bodies, PxU32 bodyCount, PxU32 bodyStride) : mBodies(bodies), mBodySize(bodyCount*bodyStride), mBodyStride(bodyStride), mBodyCount(bodyCount) + { + } + + //Returns true if it is a dynamic-dynamic constraint; false if it is a dynamic-static or dynamic-kinematic constraint + PX_FORCE_INLINE bool classifyConstraint(const PxSolverConstraintDesc& desc, uintptr_t& indexA, uintptr_t& indexB, + bool& activeA, bool& activeB, PxU32& bodyAProgress, PxU32& bodyBProgress) const + { + indexA = uintptr_t(reinterpret_cast(desc.bodyA) - mBodies) / mBodyStride; + indexB = uintptr_t(reinterpret_cast(desc.bodyB) - mBodies) / mBodyStride; + activeA = indexA < mBodyCount; + activeB = indexB < mBodyCount; + bodyAProgress = desc.bodyA->solverProgress; + bodyBProgress = desc.bodyB->solverProgress; + return activeA && activeB; + } + + PX_FORCE_INLINE void reserveSpaceForStaticConstraints(PxU32* numConstraintsPerPartition) + { + for (PxU32 a = 0; a < mBodySize; a += mBodyStride) + { + PxSolverBody& body = *reinterpret_cast(mBodies + a); + body.solverProgress = 0; + + for (PxU32 b = 0; b < body.maxSolverFrictionProgress; ++b) + { + PxU32 partId = PxMin(PxU32(body.maxSolverNormalProgress + b), MAX_NUM_PARTITIONS); + numConstraintsPerPartition[partId]++; + } + } + } + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, PxU32 bodyAProgress, PxU32 bodyBProgress, PxU16 availablePartition) + { + desc.bodyA->solverProgress = bodyAProgress; + desc.bodyA->maxSolverNormalProgress = PxMax(desc.bodyA->maxSolverNormalProgress, availablePartition); + desc.bodyB->solverProgress = bodyBProgress; + desc.bodyB->maxSolverNormalProgress = PxMax(desc.bodyB->maxSolverNormalProgress, availablePartition); + } + + PX_FORCE_INLINE PxU32 getStaticContactWriteIndex(const PxSolverConstraintDesc& desc, bool activeA, bool activeB) + { + if (activeA) + return PxU32(desc.bodyA->maxSolverNormalProgress + desc.bodyA->maxSolverFrictionProgress++); + else if (activeB) + return PxU32(desc.bodyB->maxSolverNormalProgress + desc.bodyB->maxSolverFrictionProgress++); + + return 0xffffffff; + } + + PX_FORCE_INLINE void recordStaticConstraint(const PxSolverConstraintDesc& desc, bool& activeA, bool& activeB) const + { + if(activeA) + desc.bodyA->maxSolverFrictionProgress++; + + if(activeB) + desc.bodyB->maxSolverFrictionProgress++; + } + + PX_FORCE_INLINE void zeroBodies() + { + for(PxU32 a=0; a(mBodies + a); + body.solverProgress = 0; + body.maxSolverFrictionProgress = 0; + body.maxSolverNormalProgress = 0; + } + } + + PX_FORCE_INLINE void afterClassification() + { + for(PxU32 a=0; a(mBodies + a); + body.solverProgress = 0; + //Keep the dynamic constraint count but bump the static constraint count back to 0. + //This allows us to place the static constraints in the appropriate place when we see them + //because we know the maximum index for the dynamic constraints... + body.maxSolverFrictionProgress = 0; + } + } + }; + + class ExtendedRigidBodyClassification + { + PX_NOCOPY(ExtendedRigidBodyClassification) + private: + + PxU8* PX_RESTRICT mBodies; + const PxU32 mBodyCount; + const PxU32 mBodySize; + const PxU32 mStride; + Dy::FeatherstoneArticulation** PX_RESTRICT mArticulations; + const PxU32 mNumArticulations; + + public: + + ExtendedRigidBodyClassification(PxU8* PX_RESTRICT bodies, PxU32 numBodies, PxU32 stride, Dy::FeatherstoneArticulation** articulations, PxU32 numArticulations) + : mBodies(bodies), mBodyCount(numBodies), mBodySize(numBodies*stride), mStride(stride), mArticulations(articulations), mNumArticulations(numArticulations) + { + } + + //Returns true if it is a dynamic-dynamic constraint; false if it is a dynamic-static or dynamic-kinematic constraint + PX_FORCE_INLINE bool classifyConstraint(const PxSolverConstraintDesc& desc, uintptr_t& indexA, uintptr_t& indexB, + bool& activeA, bool& activeB, PxU32& bodyAProgress, PxU32& bodyBProgress) const + { + bool hasStatic = false; + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexA) + { + indexA = uintptr_t(reinterpret_cast(desc.bodyA) - mBodies) / mStride; + activeA = indexA < mBodyCount; + hasStatic = !activeA;//desc.bodyADataIndex == 0; + bodyAProgress = activeA ? desc.bodyA->solverProgress : 0; + } + else + { + Dy::FeatherstoneArticulation* articulationA = getArticulationA(desc); + indexA = mBodyCount; + //bodyAProgress = articulationA->getFsDataPtr()->solverProgress; + bodyAProgress = articulationA->solverProgress; + activeA = true; + } + + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexB) + { + indexB = uintptr_t(reinterpret_cast(desc.bodyB) - mBodies) / mStride; + activeB = indexB < mBodyCount; + hasStatic = hasStatic || !activeB; + bodyBProgress = activeB ? desc.bodyB->solverProgress : 0; + } + else + { + Dy::FeatherstoneArticulation* articulationB = getArticulationB(desc); + indexB = mBodyCount; + activeB = true; + bodyBProgress = articulationB->solverProgress; + } + return !hasStatic; + } + + PX_FORCE_INLINE void recordStaticConstraint(const PxSolverConstraintDesc& desc, bool& activeA, bool& activeB) + { + if (activeA) + { + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexA) + desc.bodyA->maxSolverFrictionProgress++; + else + { + Dy::FeatherstoneArticulation* articulationA = getArticulationA(desc); + articulationA->maxSolverFrictionProgress++; + } + } + + if (activeB) + { + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexB) + desc.bodyB->maxSolverFrictionProgress++; + else + { + Dy::FeatherstoneArticulation* articulationB = getArticulationB(desc); + articulationB->maxSolverFrictionProgress++; + } + } + } + + PX_FORCE_INLINE PxU32 getStaticContactWriteIndex(const PxSolverConstraintDesc& desc, bool activeA, bool activeB) + { + if (activeA) + { + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexA) + { + return PxU32(desc.bodyA->maxSolverNormalProgress + desc.bodyA->maxSolverFrictionProgress++); + } + else + { + Dy::FeatherstoneArticulation* articulationA = getArticulationA(desc); + return PxU32(articulationA->maxSolverNormalProgress + articulationA->maxSolverFrictionProgress++); + } + } + else if (activeB) + { + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexB) + { + return PxU32(desc.bodyB->maxSolverNormalProgress + desc.bodyB->maxSolverFrictionProgress++); + } + else + { + Dy::FeatherstoneArticulation* articulationB = getArticulationB(desc); + return PxU32(articulationB->maxSolverNormalProgress + articulationB->maxSolverFrictionProgress++); + } + } + + return 0xffffffff; + } + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, PxU32 bodyAProgress, PxU32 bodyBProgress, PxU16 availablePartition) + { + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexA) + { + desc.bodyA->solverProgress = bodyAProgress; + desc.bodyA->maxSolverNormalProgress = PxMax(desc.bodyA->maxSolverNormalProgress, availablePartition); + } + else + { + Dy::FeatherstoneArticulation* articulationA = getArticulationA(desc); + articulationA->solverProgress = bodyAProgress; + articulationA->maxSolverNormalProgress = PxMax(articulationA->maxSolverNormalProgress, availablePartition); + } + + if (PxSolverConstraintDesc::RIGID_BODY == desc.linkIndexB) + { + desc.bodyB->solverProgress = bodyBProgress; + desc.bodyB->maxSolverNormalProgress = PxMax(desc.bodyB->maxSolverNormalProgress, availablePartition); + } + else + { + Dy::FeatherstoneArticulation* articulationB = getArticulationB(desc); + articulationB->solverProgress = bodyBProgress; + articulationB->maxSolverNormalProgress = PxMax(articulationB->maxSolverNormalProgress, availablePartition); + } + } + + PX_FORCE_INLINE void reserveSpaceForStaticConstraints(PxU32* numConstraintsPerPartition) + { + for (PxU32 a = 0; a < mBodySize; a += mStride) + { + PxSolverBody& body = *reinterpret_cast(mBodies + a); + body.solverProgress = 0; + + for (PxU32 b = 0; b < body.maxSolverFrictionProgress; ++b) + { + PxU32 partId = PxMin(PxU32(body.maxSolverNormalProgress + b), MAX_NUM_PARTITIONS); + numConstraintsPerPartition[partId]++; + } + } + + for (PxU32 a = 0; a < mNumArticulations; ++a) + { + Dy::FeatherstoneArticulation* articulation = mArticulations[a]; + articulation->solverProgress = 0; + + for (PxU32 b = 0; b < articulation->maxSolverFrictionProgress; ++b) + { + PxU32 partId = PxMin(PxU32(articulation->maxSolverNormalProgress + b), MAX_NUM_PARTITIONS); + numConstraintsPerPartition[partId]++; + } + } + } + + PX_FORCE_INLINE void zeroBodies() + { + for(PxU32 a=0; a(mBodies + a); + body.solverProgress = 0; + body.maxSolverFrictionProgress = 0; + body.maxSolverNormalProgress = 0; + } + + for(PxU32 a=0; asolverProgress = 0; + articulation->maxSolverFrictionProgress = 0; + articulation->maxSolverNormalProgress = 0; + } + } + + PX_FORCE_INLINE void afterClassification() + { + for(PxU32 a=0; a(mBodies + a); + body.solverProgress = 0; + //Keep the dynamic constraint count but bump the static constraint count back to 0. + //This allows us to place the static constraints in the appropriate place when we see them + //because we know the maximum index for the dynamic constraints... + body.maxSolverFrictionProgress = 0; + } + + for(PxU32 a=0; asolverProgress = 0; + articulation->maxSolverFrictionProgress = 0; + } + } + }; + + template + void classifyConstraintDesc(const PxSolverConstraintDesc* PX_RESTRICT descs, PxU32 numConstraints, Classification& classification, + PxU32* numConstraintsPerPartition) + { + const PxSolverConstraintDesc* _desc = descs; + const PxU32 numConstraintsMin1 = numConstraints - 1; + + PxMemZero(numConstraintsPerPartition, sizeof(PxU32) * (MAX_NUM_PARTITIONS+1)); + + for(PxU32 i=0; i + void writeConstraintDesc(const PxSolverConstraintDesc* PX_RESTRICT descs, PxU32 numConstraints, Classification& classification, + PxU32* accumulatedConstraintsPerPartition, PxSolverConstraintDesc* PX_RESTRICT eaOrderedConstraintDesc) + { + const PxSolverConstraintDesc* _desc = descs; + const PxU32 numConstraintsMin1 = numConstraints - 1; + for(PxU32 i=0; i + PxU32 BatchConstraints(const PxSolverConstraintDesc* solverConstraintDescs, PxU32 nbConstraints, PxConstraintBatchHeader* outBatchHeaders, + PxSolverConstraintDesc* outOrderedConstraintDescs, Classification& classification) + { + PxU32 constraintsPerPartition[MAX_NUM_PARTITIONS + 1]; + + classification.zeroBodies(); + + classifyConstraintDesc(solverConstraintDescs, nbConstraints, classification, constraintsPerPartition); + + PxU32 accumulation = 0; + for (PxU32 a = 0; a < MAX_NUM_PARTITIONS + 1; ++a) + { + PxU32 count = constraintsPerPartition[a]; + constraintsPerPartition[a] = accumulation; + accumulation += count; + } + + classification.afterClassification(); + + writeConstraintDesc(solverConstraintDescs, nbConstraints, classification, constraintsPerPartition, outOrderedConstraintDescs); + + PxU32 numHeaders = 0; + PxU32 currentPartition = 0; + PxU32 maxJ = nbConstraints == 0 ? 0 : constraintsPerPartition[0]; + + const PxU32 maxBatchPartition = MAX_NUM_PARTITIONS; + for (PxU32 a = 0; a < nbConstraints;) + { + PxConstraintBatchHeader& header = outBatchHeaders[numHeaders++]; + header.startIndex = a; + + PxU32 loopMax = PxMin(maxJ - a, 4u); + PxU16 j = 0; + if (loopMax > 0) + { + j = 1; + PxSolverConstraintDesc& desc = outOrderedConstraintDescs[a]; + + if(isArticulationConstraint(desc)) + loopMax = 1; + + if (currentPartition < maxBatchPartition) + { + for (; j < loopMax && desc.constraintLengthOver16 == outOrderedConstraintDescs[a + j].constraintLengthOver16 + && !isArticulationConstraint(outOrderedConstraintDescs[a + j]); ++j); + } + header.stride = j; + header.constraintType = desc.constraintLengthOver16; + } + if (maxJ == (a + j) && maxJ != nbConstraints) + { + currentPartition++; + maxJ = constraintsPerPartition[currentPartition]; + } + a += j; + } + return numHeaders; + } +} + +PxU32 immediate::PxBatchConstraints(const PxSolverConstraintDesc* solverConstraintDescs, PxU32 nbConstraints, PxSolverBody* solverBodies, PxU32 nbBodies, + PxConstraintBatchHeader* outBatchHeaders, PxSolverConstraintDesc* outOrderedConstraintDescs, + PxArticulationHandle* articulations, PxU32 nbArticulations) +{ + PX_ASSERT((size_t(solverBodies) & 0xf) == 0); + + if(!nbArticulations) + { + RigidBodyClassification classification(reinterpret_cast(solverBodies), nbBodies, sizeof(PxSolverBody)); + return BatchConstraints(solverConstraintDescs, nbConstraints, outBatchHeaders, outOrderedConstraintDescs, classification); + } + else + { + ExtendedRigidBodyClassification classification(reinterpret_cast(solverBodies), nbBodies, sizeof(PxSolverBody), reinterpret_cast(articulations), nbArticulations); + return BatchConstraints(solverConstraintDescs, nbConstraints, outBatchHeaders, outOrderedConstraintDescs, classification); + } +} + +bool immediate::PxCreateContactConstraints(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxSolverContactDesc* contactDescs, + PxConstraintAllocator& allocator, PxReal invDt, PxReal bounceThreshold, PxReal frictionOffsetThreshold, + PxReal correlationDistance, PxSpatialVector* ZV) +{ + PX_ASSERT(invDt > 0.f && PxIsFinite(invDt)); + PX_ASSERT(bounceThreshold < 0.f); + PX_ASSERT(frictionOffsetThreshold > 0.f); + PX_ASSERT(correlationDistance > 0.f); + + Dy::CorrelationBuffer cb; + + PxU32 currentContactDescIdx = 0; + + const PxReal dt = 1.0f / invDt; + + for(PxU32 i=0; i(ZV); + for(PxU32 a=0; aconstraint) + { + PxU8 type = *contactDescs[currentContactDescIdx].desc->constraint; + + if(type == DY_SC_TYPE_STATIC_CONTACT) + { + //Check if any block of constraints is classified as type static (single) contact constraint. + //If they are, iterate over all constraints grouped with it and switch to "dynamic" contact constraint + //type if there's a dynamic contact constraint in the group. + for(PxU32 c=1; cconstraint == DY_SC_TYPE_RB_CONTACT) + { + type = DY_SC_TYPE_RB_CONTACT; + break; + } + } + } + + batchHeader.constraintType = type; + } + + currentContactDescIdx += batchHeader.stride; + } + return true; +} + +bool immediate::PxCreateJointConstraints(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, PxSpatialVector* ZV, PxReal dt, PxReal invDt) +{ + PX_ASSERT(dt > 0.f); + PX_ASSERT(invDt > 0.f && PxIsFinite(invDt)); + + + PxU32 currentDescIdx = 0; + for(PxU32 i=0; i(ZV); + for(PxU32 a=0; a +static bool PxCreateJointConstraintsWithShadersT(PxConstraintBatchHeader* batchHeaders, const PxU32 nbHeaders, ParamsT* params, PxSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, PxSpatialVector* Z, PxReal dt, PxReal invDt) +{ + Px1DConstraint allRows[Dy::MAX_CONSTRAINT_ROWS * 4]; + + //Runs shaders to fill in rows... + + PxU32 currentDescIdx = 0; + + for(PxU32 i=0; i(constraints[i]); + const Sc::ConstraintCore& core = npConstraint->getCore(); + + if (npConstraint->isDirty()) + { + core.getPxConnector()->prepareData(); + npConstraint->markClean(); + } + + *prep = core.getPxConnector()->getPrep(); + *constantBlock = core.getPxConnector()->getConstantBlock(); + return core.getFlags() & PxConstraintFlag::eENABLE_EXTENDED_LIMITS; + } + }; +} + +bool immediate::PxCreateJointConstraintsWithShaders(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxConstraint** constraints, PxSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, PxReal dt, PxReal invDt, PxSpatialVector* Z) +{ + return PxCreateJointConstraintsWithShadersT(batchHeaders, nbHeaders, constraints, jointDescs, allocator, Z, dt, invDt); +} + +bool immediate::PxCreateJointConstraintsWithImmediateShaders(PxConstraintBatchHeader* batchHeaders, PxU32 nbHeaders, PxImmediateConstraint* constraints, PxSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, PxReal dt, PxReal invDt, PxSpatialVector* Z) +{ + class immConstraintAdapter + { + public: + static PX_FORCE_INLINE bool getData(PxImmediateConstraint* constraints, PxU32 i, PxConstraintSolverPrep* prep, const void** constantBlock) + { + const PxImmediateConstraint& ic = constraints[i]; + *prep = ic.prep; + *constantBlock = ic.constantBlock; + return false; + } + }; + + return PxCreateJointConstraintsWithShadersT(batchHeaders, nbHeaders, constraints, jointDescs, allocator, Z, dt, invDt); +} + +/*static*/ PX_FORCE_INLINE bool PxIsZero(const PxSolverBody* bodies, PxU32 nbBodies) +{ + for(PxU32 i=0; i 0); + PX_ASSERT(nbVelocityIterations > 0); + PX_ASSERT(PxIsZero(solverBodies, nbSolverBodies)); //Ensure that solver body velocities have been zeroed before solving + PX_ASSERT((size_t(solverBodies) & 0xf) == 0); + + //Stage 1: solve the position iterations... + Dy::SolveBlockMethod* solveTable = Dy::getSolveBlockTable(); + + Dy::SolveBlockMethod* solveConcludeTable = Dy::getSolverConcludeBlockTable(); + + Dy::SolveWriteBackBlockMethod* solveWritebackTable = Dy::getSolveWritebackBlockTable(); + + Dy::SolverContext cache; + cache.mThresholdStreamIndex = 0; + cache.mThresholdStreamLength = 0xFFFFFFF; + + PX_ASSERT(nbPositionIterations > 0); + PX_ASSERT(nbVelocityIterations > 0); + + Cm::SpatialVectorF* Z = reinterpret_cast(pxZ); + Cm::SpatialVectorF* deltaV = reinterpret_cast(pxDeltaV); + + cache.Z = Z; + cache.deltaV = deltaV; + + struct Articulations + { + static PX_FORCE_INLINE void solveInternalConstraints(float dt, float invDt, PxU32 nbSolverArticulations, Dy::FeatherstoneArticulation** solverArticulations, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV, bool velIter) + { + for(PxU32 a=0;a(solverArticulations[a]); + immArt->immSolveInternalConstraints(dt, invDt, Z, deltaV, 0.f, velIter, false); + } + } + }; + + for(PxU32 i=nbPositionIterations; i>1; --i) + { + cache.doFriction = i <= 3; + for(PxU32 a=0; a(solverArticulations), Z, deltaV, false); + } + + cache.doFriction = true; + for(PxU32 a=0; a(solverArticulations), Z, deltaV, false); + + //Save motion velocities... + + for(PxU32 a=0; a(solverArticulations[a]); + FeatherstoneArticulation::saveVelocity(unusedDesc, deltaV); + } + + for(PxU32 i=nbVelocityIterations; i>1; --i) + { + for(PxU32 a=0; a(solverArticulations), Z, deltaV, true); + } + + for(PxU32 a=0; a(solverArticulations), Z, deltaV, true); +} + +static void createCache(Gu::Cache& cache, PxGeometryType::Enum geomType0, PxGeometryType::Enum geomType1, PxCacheAllocator& allocator) +{ + if(gEnablePCMCaching[geomType0][geomType1]) + { + if(geomType0 <= PxGeometryType::eCONVEXMESH && geomType1 <= PxGeometryType::eCONVEXMESH) + { + if(geomType0 == PxGeometryType::eSPHERE || geomType1 == PxGeometryType::eSPHERE) + { + Gu::PersistentContactManifold* manifold = PX_PLACEMENT_NEW(allocator.allocateCacheData(sizeof(Gu::SpherePersistentContactManifold)), Gu::SpherePersistentContactManifold)(); + cache.setManifold(manifold); + } + else + { + Gu::PersistentContactManifold* manifold = PX_PLACEMENT_NEW(allocator.allocateCacheData(sizeof(Gu::LargePersistentContactManifold)), Gu::LargePersistentContactManifold)(); + cache.setManifold(manifold); + } + cache.getManifold().clearManifold(); + } + else + { + //ML: raised 1 to indicate the manifold is multiManifold which is for contact gen in mesh/height field + //cache.manifold = 1; + cache.setMultiManifold(NULL); + } + } + else + { + //cache.manifold = 0; + cache.mCachedData = NULL; + cache.mManifoldFlags = 0; + } +} + +bool immediate::PxGenerateContacts(const PxGeometry* const * geom0, const PxGeometry* const * geom1, const PxTransform* pose0, const PxTransform* pose1, PxCache* contactCache, PxU32 nbPairs, PxContactRecorder& contactRecorder, + PxReal contactDistance, PxReal meshContactMargin, PxReal toleranceLength, PxCacheAllocator& allocator) +{ + PX_ASSERT(meshContactMargin > 0.f); + PX_ASSERT(toleranceLength > 0.f); + PX_ASSERT(contactDistance > 0.f); + PxContactBuffer contactBuffer; + + for (PxU32 i = 0; i < nbPairs; ++i) + { + contactBuffer.count = 0; + PxGeometryType::Enum type0 = geom0[i]->getType(); + PxGeometryType::Enum type1 = geom1[i]->getType(); + + const PxGeometry* tempGeom0 = geom0[i]; + const PxGeometry* tempGeom1 = geom1[i]; + + PX_ALIGN(16, PxTransform) transform0 = pose0[i]; + PX_ALIGN(16, PxTransform) transform1 = pose1[i]; + + const bool bSwap = type0 > type1; + if (bSwap) + { + const PxGeometry* temp = tempGeom0; + tempGeom0 = geom1[i]; + tempGeom1 = temp; + PxGeometryType::Enum tempType = type0; + type0 = type1; + type1 = tempType; + transform1 = pose0[i]; + transform0 = pose1[i]; + } + + //Now work out which type of PCM we need... + + Gu::Cache& cache = static_cast(contactCache[i]); + + bool needsMultiManifold = type1 > PxGeometryType::eCONVEXMESH; + + Gu::NarrowPhaseParams params(contactDistance, meshContactMargin, toleranceLength); + + if (needsMultiManifold) + { + Gu::MultiplePersistentContactManifold multiManifold; + + if (cache.isMultiManifold()) + { + multiManifold.fromBuffer(reinterpret_cast(&cache.getMultipleManifold())); + } + else + { + multiManifold.initialize(); + } + cache.setMultiManifold(&multiManifold); + + //Do collision detection, then write manifold out... + g_PCMContactMethodTable[type0][type1](*tempGeom0, *tempGeom1, transform0, transform1, params, cache, contactBuffer, NULL); + + const PxU32 size = (sizeof(Gu::MultiPersistentManifoldHeader) + + multiManifold.mNumManifolds * sizeof(Gu::SingleManifoldHeader) + + multiManifold.mNumTotalContacts * sizeof(Gu::CachedMeshPersistentContact)); + + PxU8* buffer = allocator.allocateCacheData(size); + + multiManifold.toBuffer(buffer); + + cache.setMultiManifold(buffer); + } + else + { + //Allocate the type of manifold we need again... + Gu::PersistentContactManifold* oldManifold = NULL; + + if (cache.isManifold()) + oldManifold = &cache.getManifold(); + + //Allocates and creates the PCM... + createCache(cache, type0, type1, allocator); + + //Copy PCM from old to new manifold... + if (oldManifold) + { + Gu::PersistentContactManifold& manifold = cache.getManifold(); + manifold.mRelativeTransform = oldManifold->mRelativeTransform; + manifold.mNumContacts = oldManifold->mNumContacts; + manifold.mNumWarmStartPoints = oldManifold->mNumWarmStartPoints; + manifold.mAIndice[0] = oldManifold->mAIndice[0]; manifold.mAIndice[1] = oldManifold->mAIndice[1]; + manifold.mAIndice[2] = oldManifold->mAIndice[2]; manifold.mAIndice[3] = oldManifold->mAIndice[3]; + manifold.mBIndice[0] = oldManifold->mBIndice[0]; manifold.mBIndice[1] = oldManifold->mBIndice[1]; + manifold.mBIndice[2] = oldManifold->mBIndice[2]; manifold.mBIndice[3] = oldManifold->mBIndice[3]; + PxMemCopy(manifold.mContactPoints, oldManifold->mContactPoints, sizeof(Gu::PersistentContact)*manifold.mNumContacts); + } + + g_PCMContactMethodTable[type0][type1](*tempGeom0, *tempGeom1, transform0, transform1, params, cache, contactBuffer, NULL); + } + + if (bSwap) + { + for (PxU32 a = 0; a < contactBuffer.count; ++a) + { + contactBuffer.contacts[a].normal = -contactBuffer.contacts[a].normal; + } + } + + if (contactBuffer.count != 0) + { + //Record this contact pair... + contactRecorder.recordContacts(contactBuffer.contacts, contactBuffer.count, i); + } + } + return true; +} + +immArticulation::immArticulation(const PxArticulationDataRC& data) : + FeatherstoneArticulation(this), + mFlags (data.flags), + mImmDirty (true), + mJCalcDirty (true) +{ + // PT: TODO: we only need the flags here, maybe drop the solver desc? + getSolverDesc().initData(NULL, &mFlags); +} + +immArticulation::~immArticulation() +{ +} + +void immArticulation::initJointCore(Dy::ArticulationJointCore& core, const PxArticulationJointDataRC& inboundJoint) +{ + core.init(inboundJoint.parentPose, inboundJoint.childPose); + + core.jointDirtyFlag |= Dy::ArticulationJointCoreDirtyFlag::eMOTION | Dy::ArticulationJointCoreDirtyFlag::eFRAME; + + const PxU32* binP = reinterpret_cast(inboundJoint.targetPos); + const PxU32* binV = reinterpret_cast(inboundJoint.targetVel); + + for(PxU32 i=0; iinit( bodyPose, data.inverseInertia, data.inverseMass, 0.0f, 0.0f, + data.linearDamping, data.angularDamping, + data.maxLinearVelocitySq, data.maxAngularVelocitySq, PxActorType::eARTICULATION_LINK); + + // PT: TODO: consider exposing all used data to immediate mode API (PX-1398) +// bodyCore->maxPenBias = -1e32f; // <= this one is related to setMaxDepenetrationVelocity +// bodyCore->linearVelocity = PxVec3(0.0f); +// bodyCore->angularVelocity = PxVec3(0.0f); +// bodyCore->linearVelocity = PxVec3(0.0f, 10.0f, 0.0f); +// bodyCore->angularVelocity = PxVec3(0.0f, 10.0f, 0.0f); + bodyCore->cfmScale = data.cfmScale; + } + +/* PX_ASSERT((((index==0) && (joint == 0)) && (parent == 0)) || + (((index!=0) && joint) && (parent && (parent->getArticulation() == this))));*/ + + // PT: TODO: add ctors everywhere + ArticulationLink& link = mLinks.insert(); + + // void BodySim::postActorFlagChange(PxU32 oldFlags, PxU32 newFlags) + bodyCore->disableGravity = data.disableGravity; + link.bodyCore = bodyCore; + link.children = 0; + link.mPathToRootStartIndex = 0; + link.mPathToRootCount = 0; + link.mChildrenStartIndex = 0xffffffff; + link.mNumChildren = 0; + + const bool isRoot = parentIndex==0xffffffff; + if(!isRoot) + { + link.parent = parentIndex; + //link.pathToRoot = mLinks[parentIndex].pathToRoot | ArticulationBitField(1)<(mLinks.begin())); + jcalc(mArticulationData); + initPathToRoot(); + + mTempDeltaV.resize(linkSize); + mTempZ.resize(linkSize); +} + +static bool gRegistration = false; +void immediate::PxRegisterImmediateArticulations() +{ + Dy::PxvRegisterArticulationsReducedCoordinate(); + gRegistration = true; +} + +PxArticulationCookie immediate::PxBeginCreateArticulationRC(const PxArticulationDataRC& data) +{ + // PT: we create the same class as before under the hood, we just don't tell users yet. Returning a void pointer/cookie + // means we can prevent them from using the articulation before it's fully completed. We do this because we're going to + // delay the link creation, so we don't want them to call PxAddArticulationLink and expect the link to be here already. + PX_ASSERT(gRegistration && "Please call PxRegisterImmediateArticulations() before creating immediate articulations."); + void* memory = PxAlignedAllocator<64>().allocate(sizeof(immArticulation), PX_FL); + PX_PLACEMENT_NEW(memory, immArticulation(data)); + return memory; +} + +PxArticulationLinkCookie immediate::PxAddArticulationLink(PxArticulationCookie articulation, const PxArticulationLinkCookie* parent, const PxArticulationLinkDataRC& data) +{ + if(!articulation) + return PxCreateArticulationLinkCookie(); + + immArticulation* immArt = reinterpret_cast(articulation); + + const PxU32 id = immArt->mTemp.size(); + + // PT: TODO: this is the quick-and-dirty version, we could try something smarter where we don't just batch everything like barbarians + immArticulation::immArticulationLinkDataRC tmp; + static_cast(tmp) = data; + tmp.userID = id; + tmp.parent = parent ? *parent : PxCreateArticulationLinkCookie(); + immArt->mTemp.pushBack(tmp); + + // WARNING: cannot be null, snippet uses null for regular rigid bodies (non articulation links) + return PxCreateArticulationLinkCookie(articulation, id); +} + +PxArticulationHandle immediate::PxEndCreateArticulationRC(PxArticulationCookie articulation, PxArticulationLinkHandle* handles, PxU32 bufferSize) +{ + if(!articulation) + return NULL; + + immArticulation* immArt = reinterpret_cast(articulation); + + PxU32 nbLinks = immArt->mTemp.size(); + if(nbLinks!=bufferSize) + return NULL; + + immArticulation::immArticulationLinkDataRC* linkData = immArt->mTemp.begin(); + + { + struct _{ bool operator()(const immArticulation::immArticulationLinkDataRC& data1, const immArticulation::immArticulationLinkDataRC& data2) const + { + if(!data1.parent.articulation) + return true; + if(!data2.parent.articulation) + return false; + + return data1.parent.linkId < data2.parent.linkId; + }}; + PxSort(linkData, nbLinks, _()); + } + + PxMemSet(handles, 0, sizeof(PxArticulationLinkHandle)*nbLinks); + + immArt->allocate(nbLinks); + + while(nbLinks--) + { + const PxU32 userID = linkData->userID; + PxU32 parentID = linkData->parent.linkId; + + if(parentID != 0xffffffff) + parentID = handles[parentID].linkId; + const PxU32 realID = immArt->addLink(parentID, *linkData); + + handles[userID] = PxArticulationLinkHandle(immArt, realID); + + linkData++; + } + + immArt->complete(); + return immArt; +} + +void immediate::PxReleaseArticulation(PxArticulationHandle articulation) +{ + if(!articulation) + return; + + immArticulation* immArt = static_cast(articulation); + immArt->~immArticulation(); + PxAlignedAllocator<64>().deallocate(articulation); +} + +PxArticulationCache* immediate::PxCreateArticulationCache(PxArticulationHandle articulation) +{ + immArticulation* immArt = static_cast(articulation); + immArt->complete(); + + const PxU32 totalDofs = immArt->getDofs(); + const PxU32 linkCount = immArt->getBodyCount(); + const PxU32 jointCount = linkCount - 1; + + const PxU32 totalSize = + sizeof(PxArticulationCache) + + sizeof(PxSpatialForce) * linkCount //external force + + sizeof(PxReal) * (6 + totalDofs) * ((1 + jointCount) * 6) //offset to end of dense jacobian (assuming free floating base) + + sizeof(PxReal) * totalDofs * totalDofs //mass matrix + + sizeof(PxReal) * totalDofs * 4 //jointVelocity, jointAcceleration, jointPosition, joint force + + sizeof(PxSpatialVelocity) * linkCount * 2 //link velocity, link acceleration + + sizeof(PxArticulationRootLinkData); + + PxU8* tCache = reinterpret_cast(PX_ALLOC(totalSize, "Articulation cache")); + PxMemZero(tCache, totalSize); + + PxArticulationCache* cache = reinterpret_cast(tCache); + + PxU32 offset = sizeof(PxArticulationCache); + cache->externalForces = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialForce) * linkCount; + + cache->denseJacobian = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * (6 + totalDofs) * ((1 + jointCount) * 6); //size of dense jacobian assuming free floating base link. + + cache->massMatrix = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs * totalDofs; + + cache->jointVelocity = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointAcceleration = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointPosition = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointForce = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->linkVelocity = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialVelocity) * linkCount; + + cache->linkAcceleration = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialVelocity) * linkCount; + + cache->rootLinkData = reinterpret_cast(tCache + offset); + + cache->coefficientMatrix = NULL; + cache->lambda = NULL; + + const PxU32 scratchMemorySize = sizeof(Cm::SpatialVectorF) * linkCount * 5 //motionVelocity, motionAccelerations, coriolisVectors, spatialZAVectors, externalAccels; + + sizeof(Dy::SpatialMatrix) * linkCount //compositeSpatialInertias; + + sizeof(PxReal) * totalDofs * 5; //jointVelocity, jointAcceleration, jointForces, jointPositions, jointFrictionForces + + void* scratchMemory = PX_ALLOC(scratchMemorySize, "Cache scratch memory"); + cache->scratchMemory = scratchMemory; + + cache->scratchAllocator = PX_NEW(PxcScratchAllocator); + + reinterpret_cast(cache->scratchAllocator)->setBlock(scratchMemory, scratchMemorySize); + + return cache; +} + +void immediate::PxCopyInternalStateToArticulationCache(PxArticulationHandle articulation, PxArticulationCache& cache, PxArticulationCacheFlags flag) +{ + immArticulation* immArt = static_cast(articulation); + immArt->copyInternalStateToCache(cache, flag); +} + +void immediate::PxApplyArticulationCache(PxArticulationHandle articulation, PxArticulationCache& cache, PxArticulationCacheFlags flag) +{ + bool shouldWake = false; + immArticulation* immArt = static_cast(articulation); + immArt->applyCache(cache, flag, shouldWake); +} + +void immediate::PxReleaseArticulationCache(PxArticulationCache& cache) +{ + PxcScratchAllocator* scratchAlloc = reinterpret_cast(cache.scratchAllocator); + PX_DELETE(scratchAlloc); + cache.scratchAllocator = NULL; + + PX_FREE(cache.scratchMemory); + + PxArticulationCache* ptr = &cache; + PX_FREE(ptr); +} + +void immediate::PxComputeUnconstrainedVelocities(PxArticulationHandle articulation, const PxVec3& gravity, const PxReal dt, const PxReal invLengthScale) +{ + if(!articulation) + return; + + immArticulation* immArt = static_cast(articulation); + immArt->complete(); + if(immArt->mJCalcDirty) + { + immArt->mJCalcDirty = false; + immArt->jcalc(immArt->mArticulationData); + } + immArt->immComputeUnconstrainedVelocities(dt, gravity, invLengthScale); +} + +void immediate::PxUpdateArticulationBodies(PxArticulationHandle articulation, const PxReal dt) +{ + if(!articulation) + return; + + immArticulation* immArt = static_cast(articulation); + + FeatherstoneArticulation::updateBodies(immArt, immArt->mTempDeltaV.begin(), dt, true); +} + +void immediate::PxComputeUnconstrainedVelocitiesTGS(PxArticulationHandle articulation, const PxVec3& gravity, const PxReal dt, + const PxReal totalDt, const PxReal invDt, const PxReal invTotalDt, const PxReal invLengthScale) +{ + if (!articulation) + return; + + immArticulation* immArt = static_cast(articulation); + immArt->complete(); + if(immArt->mJCalcDirty) + { + immArt->mJCalcDirty = false; + immArt->jcalc(immArt->mArticulationData); + } + immArt->immComputeUnconstrainedVelocitiesTGS(dt, totalDt, invDt, invTotalDt, gravity, invLengthScale); +} + +void immediate::PxUpdateArticulationBodiesTGS(PxArticulationHandle articulation, const PxReal dt) +{ + if (!articulation) + return; + + immArticulation* immArt = static_cast(articulation); + + FeatherstoneArticulation::updateBodies(immArt, immArt->mTempDeltaV.begin(), dt, false); +} + +static void copyLinkData(PxArticulationLinkDerivedDataRC& data, const immArticulation* immArt, PxU32 index) +{ + data.pose = immArt->mBodyCores[index].body2World; +// data.linearVelocity = immArt->mBodyCores[index].linearVelocity; +// data.angularVelocity = immArt->mBodyCores[index].angularVelocity; + const Cm::SpatialVectorF& velocity = immArt->getArticulationData().getMotionVelocity(index); + data.linearVelocity = velocity.bottom; + data.angularVelocity = velocity.top; +} + +static PX_FORCE_INLINE const immArticulation* getFromLink(const PxArticulationLinkHandle& link, PxU32& index) +{ + if(!link.articulation) + return NULL; + + const immArticulation* immArt = static_cast(link.articulation); + index = link.linkId; + + if(index>=immArt->mLinks.size()) + return NULL; + + return immArt; +} + +bool immediate::PxGetLinkData(const PxArticulationLinkHandle& link, PxArticulationLinkDerivedDataRC& data) +{ + PxU32 index; + const immArticulation* immArt = getFromLink(link, index); + if(!immArt) + return false; + + copyLinkData(data, immArt, index); + + return true; +} + +PxU32 immediate::PxGetAllLinkData(const PxArticulationHandle articulation, PxArticulationLinkDerivedDataRC* data) +{ + if(!articulation) + return 0; + + const immArticulation* immArt = static_cast(articulation); + + const PxU32 nb = immArt->mLinks.size(); + if(data) + { + for(PxU32 i=0;imBodyCores[index].inverseInertia; + data.inverseMass = immArt->mBodyCores[index].inverseMass; + data.linearDamping = immArt->mBodyCores[index].linearDamping; + data.angularDamping = immArt->mBodyCores[index].angularDamping; + data.maxLinearVelocitySq = immArt->mBodyCores[index].maxLinearVelocitySq; + data.maxAngularVelocitySq = immArt->mBodyCores[index].maxAngularVelocitySq; + data.cfmScale = immArt->mBodyCores[index].cfmScale; + data.disableGravity = immArt->mBodyCores[index].disableGravity!=0; + + return true; +} + +bool immediate::PxSetMutableLinkData(const PxArticulationLinkHandle& link , const PxArticulationLinkMutableDataRC& data) +{ + PxU32 index; + immArticulation* immArt = const_cast(getFromLink(link, index)); + if(!immArt) + return false; + + immArt->mBodyCores[index].inverseInertia = data.inverseInertia; // See Sc::BodyCore::setInverseInertia + immArt->mBodyCores[index].inverseMass = data.inverseMass; // See Sc::BodyCore::setInverseMass + immArt->mBodyCores[index].linearDamping = data.linearDamping; // See Sc::BodyCore::setLinearDamping + immArt->mBodyCores[index].angularDamping = data.angularDamping; // See Sc::BodyCore::setAngularDamping + immArt->mBodyCores[index].maxLinearVelocitySq = data.maxLinearVelocitySq; // See Sc::BodyCore::setMaxLinVelSq + immArt->mBodyCores[index].maxAngularVelocitySq = data.maxAngularVelocitySq; // See Sc::BodyCore::setMaxAngVelSq + immArt->mBodyCores[index].cfmScale = data.cfmScale; // See Sc::BodyCore::setCfmScale + immArt->mBodyCores[index].disableGravity = data.disableGravity; // See BodySim::postActorFlagChange + + return true; +} + +bool immediate::PxGetJointData(const PxArticulationLinkHandle& link, PxArticulationJointDataRC& data) +{ + PxU32 index; + const immArticulation* immArt = getFromLink(link, index); + if(!immArt) + return false; + + const Dy::ArticulationJointCore& core = immArt->mArticulationJointCores[index]; + + data.parentPose = core.parentPose; + data.childPose = core.childPose; + data.frictionCoefficient = core.frictionCoefficient; + data.maxJointVelocity = core.maxJointVelocity; + data.type = PxArticulationJointType::Enum(core.jointType); + for(PxU32 i=0;i(getFromLink(link, index)); + if(!immArt) + return false; + + Dy::ArticulationJointCore& core = immArt->mArticulationJointCores[index]; + + // PT: poses read by jcalc in ArticulationJointCore::setJointFrame. We need to set ArticulationJointCoreDirtyFlag::eFRAME for this. + { + if(!samePoses(core.parentPose, data.parentPose)) + { + core.setParentPose(data.parentPose); // PT: also sets ArticulationJointCoreDirtyFlag::eFRAME + immArt->mJCalcDirty = true; + } + + if(!samePoses(core.childPose, data.childPose)) + { + core.setChildPose(data.childPose); // PT: also sets ArticulationJointCoreDirtyFlag::eFRAME + immArt->mJCalcDirty = true; + } + } + + // PT: joint type read by jcalc in computeMotionMatrix, called from ArticulationJointCore::setJointFrame + if(core.jointType!=PxU8(data.type)) + { + core.initJointType(data.type); + immArt->mJCalcDirty = true; + } + + // PT: TODO: do we need to recompute jcalc for these? + core.frictionCoefficient = data.frictionCoefficient; + core.maxJointVelocity = data.maxJointVelocity; + + for(PxU32 i=0;imJCalcDirty = true; + } + + // PT: targetP read by jcalc in setJointPoseDrive. We need to set ArticulationJointCoreDirtyFlag::eTARGETPOSE for this. + if(core.targetP[i] != data.targetPos[i]) + { + core.setTargetP(PxArticulationAxis::Enum(i), data.targetPos[i]); // PT: also sets ArticulationJointCoreDirtyFlag::eTARGETPOSE + immArt->mJCalcDirty = true; + } + + // PT: targetV read by jcalc in setJointVelocityDrive. We need to set ArticulationJointCoreDirtyFlag::eTARGETVELOCITY for this. + if(core.targetV[i] != data.targetVel[i]) + { + core.setTargetV(PxArticulationAxis::Enum(i), data.targetVel[i]); // PT: also sets ArticulationJointCoreDirtyFlag::eTARGETVELOCITY + immArt->mJCalcDirty = true; + } + + // PT: armature read by jcalc in setArmature. We need to set ArticulationJointCoreDirtyFlag::eARMATURE for this. + if(core.armature[i] != data.armature[i]) + { + core.setArmature(PxArticulationAxis::Enum(i), data.armature[i]); // PT: also sets ArticulationJointCoreDirtyFlag::eARMATURE + immArt->mJCalcDirty = true; + } + } + + return true; +} + +namespace physx +{ +namespace Dy +{ + void copyToSolverBodyDataStep(const PxVec3& linearVelocity, const PxVec3& angularVelocity, const PxReal invMass, const PxVec3& invInertia, const PxTransform& globalPose, + const PxReal maxDepenetrationVelocity, const PxReal maxContactImpulse, const PxU32 nodeIndex, const PxReal reportThreshold, + const PxReal maxAngVelSq, PxU32 lockFlags, bool isKinematic, + PxTGSSolverBodyVel& solverVel, PxTGSSolverBodyTxInertia& solverBodyTxInertia, PxTGSSolverBodyData& solverBodyData, + const PxReal dt, const bool gyroscopicForces); + + void integrateCoreStep(PxTGSSolverBodyVel& vel, PxTGSSolverBodyTxInertia& txInertia, const PxF32 dt); +} +} + +void immediate::PxConstructSolverBodiesTGS(const PxRigidBodyData* inRigidData, PxTGSSolverBodyVel* outSolverBodyVel, + PxTGSSolverBodyTxInertia* outSolverBodyTxInertia, PxTGSSolverBodyData* outSolverBodyData, const PxU32 nbBodies, const PxVec3& gravity, + const PxReal dt, const bool gyroscopicForces) +{ + for (PxU32 a = 0; a(solverBodies), nbBodies, sizeof(PxTGSSolverBodyVel)); + return BatchConstraints(solverConstraintDescs, nbConstraints, outBatchHeaders, outOrderedConstraintDescs, classification); + } + else + { + ExtendedRigidBodyClassification classification(reinterpret_cast(solverBodies), nbBodies, sizeof(PxTGSSolverBodyVel), reinterpret_cast(articulations), nbArticulations); + return BatchConstraints(solverConstraintDescs, nbConstraints, outBatchHeaders, outOrderedConstraintDescs, classification); + } +} + +bool immediate::PxCreateContactConstraintsTGS(PxConstraintBatchHeader* batchHeaders, const PxU32 nbHeaders, PxTGSSolverContactDesc* contactDescs, + PxConstraintAllocator& allocator, const PxReal invDt, const PxReal invTotalDt, const PxReal bounceThreshold, const PxReal frictionOffsetThreshold, const PxReal correlationDistance) +{ + PX_ASSERT(invDt > 0.f && PxIsFinite(invDt)); + PX_ASSERT(bounceThreshold < 0.f); + PX_ASSERT(frictionOffsetThreshold > 0.f); + PX_ASSERT(correlationDistance > 0.f); + + Dy::CorrelationBuffer cb; + + PxU32 currentContactDescIdx = 0; + + const PxReal biasCoefficient = 2.f*PxSqrt(invTotalDt/invDt); + const PxReal totalDt = 1.f/invTotalDt; + const PxReal dt = 1.f / invDt; + + for (PxU32 i = 0; i < nbHeaders; ++i) + { + Dy::SolverConstraintPrepState::Enum state = Dy::SolverConstraintPrepState::eUNBATCHABLE; + + PxConstraintBatchHeader& batchHeader = batchHeaders[i]; + if (batchHeader.stride == 4) + { + PxU32 totalContacts = contactDescs[currentContactDescIdx].numContacts + contactDescs[currentContactDescIdx + 1].numContacts + + contactDescs[currentContactDescIdx + 2].numContacts + contactDescs[currentContactDescIdx + 3].numContacts; + + if (totalContacts <= 64) + { + state = Dy::createFinalizeSolverContacts4Step(cb, + contactDescs + currentContactDescIdx, + invDt, + totalDt, + invTotalDt, + dt, + bounceThreshold, + frictionOffsetThreshold, + correlationDistance, + biasCoefficient, + allocator); + } + } + + if (state == Dy::SolverConstraintPrepState::eUNBATCHABLE) + { + for (PxU32 a = 0; a < batchHeader.stride; ++a) + { + Dy::createFinalizeSolverContactsStep(contactDescs[currentContactDescIdx + a], cb, invDt, invTotalDt, totalDt, dt, bounceThreshold, + frictionOffsetThreshold, correlationDistance, biasCoefficient, allocator); + } + } + + if(contactDescs[currentContactDescIdx].desc->constraint) + { + PxU8 type = *contactDescs[currentContactDescIdx].desc->constraint; + + if (type == DY_SC_TYPE_STATIC_CONTACT) + { + //Check if any block of constraints is classified as type static (single) contact constraint. + //If they are, iterate over all constraints grouped with it and switch to "dynamic" contact constraint + //type if there's a dynamic contact constraint in the group. + for (PxU32 c = 1; c < batchHeader.stride; ++c) + { + if (*contactDescs[currentContactDescIdx + c].desc->constraint == DY_SC_TYPE_RB_CONTACT) + { + type = DY_SC_TYPE_RB_CONTACT; + break; + } + } + } + + batchHeader.constraintType = type; + } + + currentContactDescIdx += batchHeader.stride; + } + return true; +} + +bool immediate::PxCreateJointConstraintsTGS(PxConstraintBatchHeader* batchHeaders, const PxU32 nbHeaders, + PxTGSSolverConstraintPrepDesc* jointDescs, PxConstraintAllocator& allocator, const PxReal dt, const PxReal totalDt, const PxReal invDt, + const PxReal invTotalDt, const PxReal lengthScale) +{ + PX_ASSERT(dt > 0.f); + PX_ASSERT(invDt > 0.f && PxIsFinite(invDt)); + + const PxReal biasCoefficient = 2.f*PxSqrt(dt/totalDt); + + PxU32 currentDescIdx = 0; + for (PxU32 i = 0; i < nbHeaders; ++i) + { + Dy::SolverConstraintPrepState::Enum state = Dy::SolverConstraintPrepState::eUNBATCHABLE; + + PxConstraintBatchHeader& batchHeader = batchHeaders[i]; + + PxU8 type = DY_SC_TYPE_BLOCK_1D; + if (batchHeader.stride == 4) + { + PxU32 totalRows = 0; + PxU32 maxRows = 0; + bool batchable = true; + for (PxU32 a = 0; a < batchHeader.stride; ++a) + { + if (jointDescs[currentDescIdx + a].numRows == 0) + { + batchable = false; + break; + } + totalRows += jointDescs[currentDescIdx + a].numRows; + maxRows = PxMax(maxRows, jointDescs[currentDescIdx + a].numRows); + } + + if (batchable) + { + state = Dy::setupSolverConstraintStep4 + (jointDescs + currentDescIdx, + dt, totalDt, invDt, invTotalDt, totalRows, + allocator, maxRows, lengthScale, biasCoefficient); + } + } + + if (state == Dy::SolverConstraintPrepState::eUNBATCHABLE) + { + type = DY_SC_TYPE_RB_1D; + for (PxU32 a = 0; a < batchHeader.stride; ++a) + { + // PT: TODO: And "isExtended" is already computed in Dy::ConstraintHelper::setupSolverConstraint + PxSolverConstraintDesc& desc = *jointDescs[currentDescIdx + a].desc; + const bool isExtended = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY || desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY; + if (isExtended) + type = DY_SC_TYPE_EXT_1D; + + Dy::setupSolverConstraintStep(jointDescs[currentDescIdx + a], allocator, dt, totalDt, invDt, invTotalDt, lengthScale, biasCoefficient); + } + } + + batchHeader.constraintType = type; + currentDescIdx += batchHeader.stride; + } + + return true; +} + + +template +static bool PxCreateJointConstraintsWithShadersTGS_T(PxConstraintBatchHeader* batchHeaders, const PxU32 nbHeaders, ParamsT* params, PxTGSSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, const PxReal dt, const PxReal totalDt, const PxReal invDt, const PxReal invTotalDt, const PxReal lengthScale) +{ + Px1DConstraint allRows[Dy::MAX_CONSTRAINT_ROWS * 4]; + + //Runs shaders to fill in rows... + + PxU32 currentDescIdx = 0; + + for (PxU32 i = 0; i(batchHeaders, nbBatchHeaders, constraints, jointDescs, allocator, dt, totalDt, invDt, invTotalDt, lengthScale); +} + +bool immediate::PxCreateJointConstraintsWithImmediateShadersTGS(PxConstraintBatchHeader* batchHeaders, const PxU32 nbHeaders, PxImmediateConstraint* constraints, PxTGSSolverConstraintPrepDesc* jointDescs, + PxConstraintAllocator& allocator, const PxReal dt, const PxReal totalDt, const PxReal invDt, const PxReal invTotalDt, const PxReal lengthScale) +{ + class immConstraintAdapter + { + public: + static PX_FORCE_INLINE bool getData(PxImmediateConstraint* constraints, PxU32 i, PxConstraintSolverPrep* prep, const void** constantBlock) + { + const PxImmediateConstraint& ic = constraints[i]; + *prep = ic.prep; + *constantBlock = ic.constantBlock; + return false; + } + }; + + return PxCreateJointConstraintsWithShadersTGS_T(batchHeaders, nbHeaders, constraints, jointDescs, allocator, dt, totalDt, invDt, invTotalDt, lengthScale); +} + +void immediate::PxSolveConstraintsTGS(const PxConstraintBatchHeader* batchHeaders, const PxU32 nbBatchHeaders, const PxSolverConstraintDesc* solverConstraintDescs, + PxTGSSolverBodyVel* solverBodies, PxTGSSolverBodyTxInertia* txInertias, const PxU32 nbSolverBodies, const PxU32 nbPositionIterations, const PxU32 nbVelocityIterations, + const float dt, const float invDt, const PxU32 nbSolverArticulations, PxArticulationHandle* solverArticulations, PxSpatialVector* pxZ, PxSpatialVector* pxDeltaV) +{ + PX_UNUSED(solverBodies); + PX_UNUSED(nbSolverBodies); + PX_ASSERT(nbPositionIterations > 0); + PX_ASSERT(nbVelocityIterations > 0); + + //Stage 1: solve the position iterations... + Dy::TGSSolveBlockMethod* solveTable = Dy::g_SolveTGSMethods; + + Dy::TGSSolveConcludeMethod* solveConcludeTable = Dy::g_SolveConcludeTGSMethods; + + Dy::TGSWriteBackMethod* writebackTable = Dy::g_WritebackTGSMethods; + + Dy::SolverContext cache; + cache.mThresholdStreamIndex = 0; + cache.mThresholdStreamLength = 0xFFFFFFF; + + Cm::SpatialVectorF* Z = reinterpret_cast(pxZ); + Cm::SpatialVectorF* deltaV = reinterpret_cast(pxDeltaV); + + cache.Z = Z; + cache.deltaV = deltaV; + + struct Articulations + { + static PX_FORCE_INLINE void solveInternalConstraints(const float dt, const float invDt, const PxU32 nbSolverArticulations, Dy::FeatherstoneArticulation** solverArticulations, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV, + const PxReal elapsedTime, bool velIter) + { + for(PxU32 a = 0; a(solverArticulations[a]); + immArt->immSolveInternalConstraints(dt, invDt, Z, deltaV, elapsedTime, velIter, true); + } + } + + static PX_FORCE_INLINE void stepArticulations(const float dt, const PxReal totalInvDt, const PxU32 nbSolverArticulations, Dy::FeatherstoneArticulation** solverArticulations, Cm::SpatialVectorF* deltaV) + { + for(PxU32 a = 0; a(solverArticulations[a]); + immArt->recordDeltaMotion(immArt->getSolverDesc(), dt, deltaV, totalInvDt); + } + } + + static PX_FORCE_INLINE void saveVelocities(const PxReal totalInvDt, const PxU32 nbSolverArticulations, Dy::FeatherstoneArticulation** solverArticulations) + { + for (PxU32 a = 0; a < nbSolverArticulations; a++) + { + immArticulation* immArt = static_cast(solverArticulations[a]); + immArt->saveVelocityTGS(immArt->getSolverDesc(), totalInvDt); + } + } + }; + + const PxReal invTotalDt = 1.0f/(dt*nbPositionIterations); + + PxReal elapsedTime = 0.0f; + for(PxU32 i = nbPositionIterations; i>1; --i) + { + Articulations::solveInternalConstraints(dt, invDt, nbSolverArticulations, reinterpret_cast(solverArticulations), Z, deltaV, elapsedTime, false); + + cache.doFriction = true; + for(PxU32 a = 0; a(solverArticulations), deltaV); + elapsedTime += dt; + } + + cache.doFriction = true; + + Articulations::solveInternalConstraints(dt, invDt, nbSolverArticulations, reinterpret_cast(solverArticulations), Z, deltaV, elapsedTime, false); + + for(PxU32 a = 0; a(solverArticulations), deltaV); + elapsedTime += dt; + + Articulations::saveVelocities(invTotalDt, nbSolverArticulations, reinterpret_cast(solverArticulations)); + + for(PxU32 i = nbVelocityIterations; i>1; --i) + { + Articulations::solveInternalConstraints(dt, invDt, nbSolverArticulations, reinterpret_cast(solverArticulations), Z, deltaV, elapsedTime, true); + for(PxU32 a = 0; a(solverArticulations), Z, deltaV, elapsedTime, true); + + for(PxU32 a = 0; a mCreatedPairs; + PxArray mDeletedPairs; + + const PxU64 mContextID; + void* mAABBManager; + + void releaseBP(); + }; +} + +/////////////////////////////////////////////////////////////////////////////// + +ImmCPUBP::ImmCPUBP(const PxBroadPhaseDesc& desc) : + mBroadPhase (NULL), + mFilters (desc.mDiscardKinematicVsKinematic, desc.mDiscardStaticVsKinematic), + mContextID (desc.mContextID), + mAABBManager(NULL) +{ +} + +ImmCPUBP::~ImmCPUBP() +{ + releaseBP(); +} + +void ImmCPUBP::releaseBP() +{ + PX_RELEASE(mBroadPhase); +} + +bool ImmCPUBP::init(const PxBroadPhaseDesc& desc) +{ + if(!desc.isValid()) + return outputError(__LINE__, "PxCreateBroadPhase: invalid broadphase descriptor"); + + const PxU32 maxNbRegions = 0; + const PxU32 maxNbBroadPhaseOverlaps = 0; + const PxU32 maxNbStaticShapes = 0; + const PxU32 maxNbDynamicShapes = 0; + + // PT: TODO: unify creation of CPU and GPU BPs (PX-2542) + mBroadPhase = Bp::BroadPhase::create(desc.mType, maxNbRegions, maxNbBroadPhaseOverlaps, maxNbStaticShapes, maxNbDynamicShapes, desc.mContextID); + return mBroadPhase!=NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +void ImmCPUBP::release() +{ + if(mAABBManager) + { + outputError(__LINE__, "ImmCPUBP::release: AABB manager is still present, release the AABB manager first"); + return; + } + + PX_DELETE_THIS; +} + +PxBroadPhaseType::Enum ImmCPUBP::getType() const +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getType(); +} + +void ImmCPUBP::getCaps(PxBroadPhaseCaps& caps) const +{ + PX_ASSERT(mBroadPhase); + mBroadPhase->getCaps(caps); +} + +PxBroadPhaseRegions* ImmCPUBP::getRegions() +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getType() == PxBroadPhaseType::eMBP ? this : NULL; +} + +PxAllocatorCallback* ImmCPUBP::getAllocator() +{ + return PxGetAllocatorCallback(); +} + +PxU64 ImmCPUBP::getContextID() const +{ + return mContextID; +} + +void ImmCPUBP::setScratchBlock(void* scratchBlock, PxU32 size) +{ + if(scratchBlock && size) + mScratchAllocator.setBlock(scratchBlock, size); +} + +void ImmCPUBP::update(const PxBroadPhaseUpdateData& updateData, PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("ImmCPUBP::update", mContextID); + + PX_ASSERT(mBroadPhase); + + // PT: convert PxBroadPhaseUpdateData to Bp::BroadPhaseUpdateData. Main differences is the two undocumented bools + // added for the GPU version. For now we just set them to true, which may not be the fastest but it should always + // be correct. + // TODO: revisit this / get rid of the bools in the low-level API (PX-2835) + + const Bp::BroadPhaseUpdateData defaultUpdateData( + updateData.mCreated, updateData.mNbCreated, + updateData.mUpdated, updateData.mNbUpdated, + updateData.mRemoved, updateData.mNbRemoved, + updateData.mBounds, + reinterpret_cast(updateData.mGroups), + updateData.mDistances, updateData.mCapacity, + mFilters, + true, true); + + // PT: preBroadPhase & fetchBroadPhaseResults are only needed for the GPU BP. + // The PxBroadPhase API hides this from users and gives them an easier API that + // deals with these differences under the hood. + + mBroadPhase->preBroadPhase(defaultUpdateData); // ### could be skipped for CPU BPs + + // PT: BP UPDATE CALL + mBroadPhase->update(&mScratchAllocator, defaultUpdateData, continuation); + + mBroadPhase->fetchBroadPhaseResults(); // ### could be skipped for CPU BPs +} + +void ImmCPUBP::fetchResults(PxBroadPhaseResults& results) +{ + PX_PROFILE_ZONE("ImmCPUBP::fetchResults", mContextID); + PX_ASSERT(mBroadPhase); + + // PT: TODO: flags to skip the copies (PX-2929) + if(0) + { + results.mCreatedPairs = reinterpret_cast(mBroadPhase->getCreatedPairs(results.mNbCreatedPairs)); + results.mDeletedPairs = reinterpret_cast(mBroadPhase->getDeletedPairs(results.mNbDeletedPairs)); + } + else + { + struct Local + { + static void copyPairs(PxArray& pairs, PxU32 nbPairs, const Bp::BroadPhasePair* bpPairs) + { + pairs.resetOrClear(); + const PxBroadPhasePair* src = reinterpret_cast(bpPairs); + PxBroadPhasePair* dst = Cm::reserveContainerMemory(pairs, nbPairs); + PxMemCopy(dst, src, sizeof(PxBroadPhasePair)*nbPairs); + } + }; + + { + PX_PROFILE_ZONE("copyPairs", mContextID); + { + PxU32 nbCreatedPairs; + const Bp::BroadPhasePair* createdPairs = mBroadPhase->getCreatedPairs(nbCreatedPairs); + Local::copyPairs(mCreatedPairs, nbCreatedPairs, createdPairs); + } + { + PxU32 nbDeletedPairs; + const Bp::BroadPhasePair* deletedPairs = mBroadPhase->getDeletedPairs(nbDeletedPairs); + Local::copyPairs(mDeletedPairs, nbDeletedPairs, deletedPairs); + } + } + + results.mNbCreatedPairs = mCreatedPairs.size(); + results.mNbDeletedPairs = mDeletedPairs.size(); + results.mCreatedPairs = mCreatedPairs.begin(); + results.mDeletedPairs = mDeletedPairs.begin(); + } + + // PT: TODO: this function got introduced in the "GRB merge" (CL 20888255) for the SAP but wasn't necessary before, + // and isn't necessary for the other BPs (even the GPU one). That makes no sense and should probably be removed. + //mBroadPhase->deletePairs(); + + // PT: similarly this is only needed for the SAP. This is also called at the exact same time as "deletePairs" so + // I'm not sure why we used 2 separate functions. It just bloats the API for no reason. + mBroadPhase->freeBuffers(); +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: the following calls are just re-routed to the LL functions. This should only be available/needed for MBP. + +PxU32 ImmCPUBP::getNbRegions() const +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getNbRegions(); +} + +PxU32 ImmCPUBP::getRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getRegions(userBuffer, bufferSize, startIndex); +} + +PxU32 ImmCPUBP::addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const float* contactDistance) +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->addRegion(region, populateRegion, boundsArray, contactDistance); +} + +bool ImmCPUBP::removeRegion(PxU32 handle) +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->removeRegion(handle); +} + +PxU32 ImmCPUBP::getNbOutOfBoundsObjects() const +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getNbOutOfBoundsObjects(); +} + +const PxU32* ImmCPUBP::getOutOfBoundsObjects() const +{ + PX_ASSERT(mBroadPhase); + return mBroadPhase->getOutOfBoundsObjects(); +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX +namespace +{ + class ImmGPUBP : public ImmCPUBP, public PxAllocatorCallback + { + public: + ImmGPUBP(const PxBroadPhaseDesc& desc); + virtual ~ImmGPUBP(); + + // PxAllocatorCallback + virtual void* allocate(size_t size, const char* /*typeName*/, const char* filename, int line) PX_OVERRIDE; + virtual void deallocate(void* ptr) PX_OVERRIDE; + //~PxAllocatorCallback + + // PxBroadPhase + virtual PxAllocatorCallback* getAllocator() PX_OVERRIDE; + //~PxBroadPhase + + // ImmCPUBP + virtual bool init(const PxBroadPhaseDesc& desc) PX_OVERRIDE; + //~ImmCPUBP + + PxPhysXGpu* mPxGpu; + PxsMemoryManager* mMemoryManager; + PxsKernelWranglerManager* mGpuWranglerManagers; + PxsHeapMemoryAllocatorManager* mHeapMemoryAllocationManager; + }; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX + +#include "PxPhysXGpu.h" + +ImmGPUBP::ImmGPUBP(const PxBroadPhaseDesc& desc) : + ImmCPUBP (desc), + mPxGpu (NULL), + mMemoryManager (NULL), + mGpuWranglerManagers (NULL), + mHeapMemoryAllocationManager(NULL) +{ +} + +ImmGPUBP::~ImmGPUBP() +{ + releaseBP(); // PT: must release the BP first, before the base dtor is called + PX_DELETE(mHeapMemoryAllocationManager); + PX_DELETE(mGpuWranglerManagers); + PX_DELETE(mMemoryManager); + //PX_RELEASE(mPxGpu); + PxvReleasePhysXGpu(mPxGpu); + mPxGpu = NULL; +} + +void* ImmGPUBP::allocate(size_t size, const char* /*typeName*/, const char* filename, int line) +{ + PX_ASSERT(mMemoryManager); + PxVirtualAllocatorCallback* cb = mMemoryManager->getHostMemoryAllocator(); + return cb->allocate(size, 0, filename, line); +} + +void ImmGPUBP::deallocate(void* ptr) +{ + PX_ASSERT(mMemoryManager); + PxVirtualAllocatorCallback* cb = mMemoryManager->getHostMemoryAllocator(); + cb->deallocate(ptr); +} + +PxAllocatorCallback* ImmGPUBP::getAllocator() +{ + return this; +} + +bool ImmGPUBP::init(const PxBroadPhaseDesc& desc) +{ + PX_ASSERT(desc.mType==PxBroadPhaseType::eGPU); + + if(!desc.isValid()) + return outputError(__LINE__, "PxCreateBroadPhase: invalid broadphase descriptor"); + + PxCudaContextManager* contextManager = desc.mContextManager; + + // PT: one issue with PxvGetPhysXGpu is that it creates the whole PxPhysXGpu object, not just the BP. Questionable coupling there. + + //mPxGpu = PxCreatePhysXGpu(); + + mPxGpu = PxvGetPhysXGpu(true); + if(!mPxGpu) + return false; + + const PxU32 gpuComputeVersion = 0; + + // PT: what's the difference between the "GPU memory manager" and the "GPU heap memory allocator manager" ? + mMemoryManager = mPxGpu->createGpuMemoryManager(contextManager); + if(!mMemoryManager) + return false; + + mGpuWranglerManagers = mPxGpu->createGpuKernelWranglerManager(contextManager, *PxGetErrorCallback(), gpuComputeVersion); + if(!mGpuWranglerManagers) + return false; + + PxgDynamicsMemoryConfig gpuDynamicsConfig; + gpuDynamicsConfig.foundLostPairsCapacity = desc.mFoundLostPairsCapacity; + + mHeapMemoryAllocationManager = mPxGpu->createGpuHeapMemoryAllocatorManager(gpuDynamicsConfig.heapCapacity, mMemoryManager, gpuComputeVersion); + if(!mHeapMemoryAllocationManager) + return false; + + mBroadPhase = mPxGpu->createGpuBroadPhase(mGpuWranglerManagers, contextManager, gpuComputeVersion, gpuDynamicsConfig, mHeapMemoryAllocationManager, desc.mContextID); + return mBroadPhase!=NULL; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +// PT: TODO: why don't we even have a PxBroadPhaseDesc in the main Px API by now? (PX-2933) +// The BP parameters are scattered in PxSceneDesc/PxSceneLimits/etc +// The various BP-related APIs are particularly messy. +PxBroadPhase* physx::PxCreateBroadPhase(const PxBroadPhaseDesc& desc) +{ + ImmCPUBP* immBP; + if(desc.mType == PxBroadPhaseType::eGPU) +#if PX_SUPPORT_GPU_PHYSX + immBP = PX_NEW(ImmGPUBP)(desc); +#else + return NULL; +#endif + else + immBP = PX_NEW(ImmCPUBP)(desc); + + if(!immBP->init(desc)) + { + PX_DELETE(immBP); + return NULL; + } + return immBP; +} + + + + +namespace +{ + // TODO: user-data? (PX-2934) + // TODO: aggregates? (PX-2935) + // TODO: do we really need the bitmaps in this wrapper anyway? + + class HighLevelBroadPhaseAPI : public PxAABBManager, public PxUserAllocated + { + public: + HighLevelBroadPhaseAPI(PxBroadPhase& broadphase); + virtual ~HighLevelBroadPhaseAPI(); + + // PxAABBManager + virtual void release() PX_OVERRIDE { PX_DELETE_THIS; } + + virtual void addObject(PxU32 index, const PxBounds3& bounds, PxBpFilterGroup group, float distance) PX_OVERRIDE; + virtual void removeObject(PxU32 index) PX_OVERRIDE; + virtual void updateObject(PxU32 index, const PxBounds3* bounds, const float* distance) PX_OVERRIDE; + virtual void update(PxBaseTask* continuation) PX_OVERRIDE; + virtual void fetchResults(PxBroadPhaseResults& results) PX_OVERRIDE; + + virtual PxBroadPhase& getBroadPhase() PX_OVERRIDE { return mBroadPhase; } + virtual const PxBounds3* getBounds() const PX_OVERRIDE { return mBounds; } + virtual const float* getDistances() const PX_OVERRIDE { return mDistances; } + virtual const PxBpFilterGroup* getGroups() const PX_OVERRIDE { return mGroups; } + virtual PxU32 getCapacity() const PX_OVERRIDE { return mCapacity; } + //~PxAABBManager + + void reserveSpace(PxU32 nbTotalBounds); + + PxBroadPhase& mBroadPhase; + PxBounds3* mBounds; + float* mDistances; + PxBpFilterGroup* mGroups; + PxU32 mCapacity; // PT: same capacity for all the above buffers + + // PT: TODO: pinned? (PX-2936) + PxBitMap mAddedHandleMap; // PT: indexed by BoundsIndex + PxBitMap mRemovedHandleMap; // PT: indexed by BoundsIndex + PxBitMap mUpdatedHandleMap; // PT: indexed by BoundsIndex + + // PT: TODO: pinned? (PX-2936) + PxArray mAddedHandles; + PxArray mUpdatedHandles; + PxArray mRemovedHandles; + + const PxU64 mContextID; + }; +} + +HighLevelBroadPhaseAPI::HighLevelBroadPhaseAPI(PxBroadPhase& broadphase) : + mBroadPhase (broadphase), + mBounds (NULL), + mDistances (NULL), + mGroups (NULL), + mCapacity (0), + mContextID (broadphase.getContextID()) +{ + ImmCPUBP& baseBP = static_cast(broadphase); + PX_ASSERT(!baseBP.mAABBManager); + baseBP.mAABBManager = this; +} + +HighLevelBroadPhaseAPI::~HighLevelBroadPhaseAPI() +{ + PxAllocatorCallback* allocator = mBroadPhase.getAllocator(); + if(mDistances) + { + allocator->deallocate(mDistances); + mDistances = NULL; + } + if(mGroups) + { + allocator->deallocate(mGroups); + mGroups = NULL; + } + if(mBounds) + { + allocator->deallocate(mBounds); + mBounds = NULL; + } + + ImmCPUBP& baseBP = static_cast(mBroadPhase); + baseBP.mAABBManager = NULL; +} + +void HighLevelBroadPhaseAPI::reserveSpace(PxU32 nbEntriesNeeded) +{ + PX_PROFILE_ZONE("HighLevelBroadPhaseAPI::reserveSpace", mContextID); + PX_ASSERT(mCapacity(allocator->allocate(sizeof(PxBounds3)*(nbEntriesNeeded+1), "HighLevelBroadPhaseAPI::mBounds", PX_FL)); + if(mCapacity && mBounds) + PxMemCopy(newBounds, mBounds, sizeof(PxBounds3)*mCapacity); + for(PxU32 i=mCapacity;ideallocate(mBounds); + mBounds = newBounds; + } + + { + PxBpFilterGroup* newGroups = reinterpret_cast(allocator->allocate(sizeof(PxBpFilterGroup)*nbEntriesNeeded, "HighLevelBroadPhaseAPI::mGroups", PX_FL)); + if(mCapacity && mGroups) + PxMemCopy(newGroups, mGroups, sizeof(PxBpFilterGroup)*mCapacity); + for(PxU32 i=mCapacity;ideallocate(mGroups); + mGroups = newGroups; + } + + { + float* newDistances = reinterpret_cast(allocator->allocate(sizeof(float)*nbEntriesNeeded, "HighLevelBroadPhaseAPI::mDistances", PX_FL)); + if(mCapacity && mDistances) + PxMemCopy(newDistances, mDistances, sizeof(float)*mCapacity); + for(PxU32 i=mCapacity;ideallocate(mDistances); + mDistances = newDistances; + } + + mAddedHandleMap.resize(nbEntriesNeeded); + mRemovedHandleMap.resize(nbEntriesNeeded); + + mCapacity = nbEntriesNeeded; +} + +// PT: TODO: version with internal index management? (PX-2942) + +// PT: TODO: batched version? +void HighLevelBroadPhaseAPI::addObject(PxBpIndex index, const PxBounds3& bounds, PxBpFilterGroup group, float distance) +{ + PX_ASSERT(group != PX_INVALID_BP_FILTER_GROUP); // PT: we use group == PX_INVALID_BP_FILTER_GROUP to mark removed/invalid entries + + const PxU32 nbEntriesNeeded = index + 1; + if(mCapacity +static void iterateBitmap(const PxBitMap& bitmap, ParamsT& params) +{ + const PxU32* bits = bitmap.getWords(); + if(bits) + { + const PxU32 lastSetBit = bitmap.findLast(); + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) + { + for(PxU32 b = bits[w]; b; b &= b-1) + { + const PxU32 index = PxU32(w<<5|PxLowestSetBit(b)); + + FunctionT::processEntry(params, index); + } + } + } +} + +/*static void shuffle(PxArray& handles) +{ + PxU32 nb = handles.size(); + PxU32* data = handles.begin(); + for(PxU32 i=0;i(mAddedHandleMap, *this); + } + { + PX_PROFILE_ZONE("iterateBitmap updated", mContextID); + iterateBitmap(mUpdatedHandleMap, *this); + } + { + PX_PROFILE_ZONE("iterateBitmap removed", mContextID); + iterateBitmap(mRemovedHandleMap, *this); + } + } + + // PT: call the low-level BP API + { + PX_PROFILE_ZONE("BP update", mContextID); +/* if(1) // Suffle test + { + shuffle(mAddedHandles); + shuffle(mUpdatedHandles); + shuffle(mRemovedHandles); + }*/ + + const PxBroadPhaseUpdateData updateData( + mAddedHandles.begin(), mAddedHandles.size(), + mUpdatedHandles.begin(), mUpdatedHandles.size(), + mRemovedHandles.begin(), mRemovedHandles.size(), + mBounds, mGroups, mDistances, + mCapacity); + + mBroadPhase.update(updateData, continuation); + } + + { + PX_PROFILE_ZONE("clear bitmaps", mContextID); + mAddedHandleMap.clear(); + mRemovedHandleMap.clear(); + mUpdatedHandleMap.clear(); + } +} + +void HighLevelBroadPhaseAPI::fetchResults(PxBroadPhaseResults& results) +{ + PX_PROFILE_ZONE("HighLevelBroadPhaseAPI::fetchResults", mContextID); + mBroadPhase.fetchResults(results); +} + +PxAABBManager* physx::PxCreateAABBManager(PxBroadPhase& bp) +{ + // PT: make sure we cannot link a bp to multiple managers + ImmCPUBP& baseBP = static_cast(bp); + if(baseBP.mAABBManager) + return NULL; + + return PX_NEW(HighLevelBroadPhaseAPI)(bp); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMClothMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMClothMaterialCore.h new file mode 100644 index 0000000..81c8332 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMClothMaterialCore.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_FEM_CLOTH_MATERIAL_CORE_H +#define PXS_FEM_CLOTH_MATERIAL_CORE_H + +#include "PxFEMClothMaterial.h" +#include "PxsMaterialShared.h" + +namespace physx +{ + PX_ALIGN_PREFIX(16) struct PxsFEMClothMaterialAuxData + { + // derived quantities (computed internally) + float lambda; //4 + float mu; //8 + float padding[2]; //16 + }PX_ALIGN_SUFFIX(16); + + PX_ALIGN_PREFIX(16) struct PxsFEMClothMaterialData + { + PxReal youngs; //4 + PxReal poissons; //8 + PxReal dynamicFriction; //12 + PxReal thickness; //16 + PxReal elasticityDamping; //20 + PxReal bendingDamping; //24 + PxReal padding[2]; //32 + + PX_CUDA_CALLABLE PxsFEMClothMaterialData() : + youngs (1.e+6f), + poissons (0.45f), + dynamicFriction (0.0f), + thickness (0.0f), + elasticityDamping (0.0f), + bendingDamping (0.0f) + {} + + PxsFEMClothMaterialData(const PxEMPTY) {} + + }PX_ALIGN_SUFFIX(16); + + typedef MaterialCoreT PxsFEMClothMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMSoftBodyMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMSoftBodyMaterialCore.h new file mode 100644 index 0000000..0908a30 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFEMSoftBodyMaterialCore.h @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_FEM_MATERIAL_CORE_H +#define PXS_FEM_MATERIAL_CORE_H + +#include "PxFEMSoftBodyMaterial.h" +#include "PxsMaterialShared.h" + +namespace physx +{ + PX_ALIGN_PREFIX(16) struct PxsFEMSoftBodyMaterialAuxData + { + // derived for co-rotational (computed internally) + float rows[6][6]; //144 + + // derived quantities (computed internally) + float lambda; //148 + float mu; //152 + float alpha; //156 + float volumeLambda; //160 + }PX_ALIGN_SUFFIX(16); + + PX_ALIGN_PREFIX(16) struct PxsFEMSoftBodyMaterialData + { + PxReal youngs; //4 + PxReal poissons; //8 + PxReal dynamicFriction; //12 + PxReal damping; //16 + PxReal dampingScale; //20 + PxReal deformThreshold; //24 + PxReal deformLowLimitRatio; //28 + PxReal deformHighLimitRatio; //32 + + PX_CUDA_CALLABLE PxsFEMSoftBodyMaterialData() : + youngs (1.e+6f), + poissons (0.45f), + dynamicFriction (0.0f), + damping (0.0f), + deformThreshold (PX_MAX_F32), + deformLowLimitRatio (1.0f), + deformHighLimitRatio(1.0f) + {} + + PxsFEMSoftBodyMaterialData(const PxEMPTY) {} + + }PX_ALIGN_SUFFIX(16); + + typedef MaterialCoreT PxsFEMSoftBodyMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFLIPMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFLIPMaterialCore.h new file mode 100644 index 0000000..c4d2555 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsFLIPMaterialCore.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_FLIP_MATERIAL_CORE_H +#define PXS_FLIP_MATERIAL_CORE_H + +#include "PxParticleGpu.h" +#include "PxsMaterialShared.h" + +namespace physx +{ + struct PxsFLIPMaterialData : public PxsParticleMaterialData + { + PxsFLIPMaterialData() {} // PT: TODO: ctor leaves things uninitialized, is that by design? + PxsFLIPMaterialData(const PxEMPTY) {} + + PxReal viscosity; //24 + PxReal surfaceTension; //28 + }; + + typedef MaterialCoreT PxsFLIPMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMPMMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMPMMaterialCore.h new file mode 100644 index 0000000..3a65b1c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMPMMaterialCore.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MPM_MATERIAL_CORE_H +#define PXS_MPM_MATERIAL_CORE_H + +#include "PxParticleGpu.h" +#include "PxsMaterialShared.h" +#include "PxMPMMaterial.h" + +namespace physx +{ + struct PxsMPMMaterialData : public PxsParticleMaterialData + { + PxsMPMMaterialData() {} // PT: TODO: ctor leaves things uninitialized, is that by design? + PxsMPMMaterialData(const PxEMPTY) {} + + + PxIntBool isPlastic; //24 + PxReal youngsModulus; //28 + PxReal poissonsRatio; //32 + + PxReal hardening; //snow //36 + PxReal criticalCompression; //snow //40 + PxReal criticalStretch; //snow //44 + + //Only used when damage tracking is activated in the cutting flags + PxReal tensileDamageSensitivity; //48 + PxReal compressiveDamageSensitivity; //52 + PxReal attractiveForceResidual; //56 + + PxReal sandFrictionAngle; //sand //60 + PxReal yieldStress; //von Mises //64 + + PxMPMMaterialModel::Enum materialModel; //68 + PxMPMCuttingFlags cuttingFlags; //72 + PxReal density; //76; + + PxReal stretchAndShearDamping; //80; + PxReal rotationalDamping; //84; + }; + + typedef MaterialCoreT PxsMPMMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialCore.h new file mode 100644 index 0000000..007bf43 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialCore.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MATERIAL_CORE_H +#define PXS_MATERIAL_CORE_H + +#include "PxMaterial.h" +#include "foundation/PxUtilities.h" +#include "PxsMaterialShared.h" + +namespace physx +{ + struct PxsMaterialData + { + PxReal dynamicFriction; //4 + PxReal staticFriction; //8 + PxReal restitution; //12 + PxReal damping; //16 + PxMaterialFlags flags; //18 + PxU8 fricCombineMode; //19 + PxU8 restCombineMode; //20 + + PxsMaterialData() : + dynamicFriction (0.0f), + staticFriction (0.0f), + restitution (0.0f), + damping (0.0f), + flags (PxMaterialFlag::eIMPROVED_PATCH_FRICTION), + fricCombineMode (PxCombineMode::eAVERAGE), + restCombineMode (PxCombineMode::eAVERAGE) + {} + + PxsMaterialData(const PxEMPTY) {} + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getFrictionCombineMode() const { return PxCombineMode::Enum(fricCombineMode); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxCombineMode::Enum getRestitutionCombineMode() const { return PxCombineMode::Enum(restCombineMode); } + PX_FORCE_INLINE void setFrictionCombineMode(PxCombineMode::Enum combineMode) { fricCombineMode = PxTo8(combineMode); } + PX_FORCE_INLINE void setRestitutionCombineMode(PxCombineMode::Enum combineMode) { restCombineMode = PxTo8(combineMode); } + + }; + + typedef MaterialCoreT PxsMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialManager.h new file mode 100644 index 0000000..4c5f652 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialManager.h @@ -0,0 +1,183 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MATERIAL_MANAGER_H +#define PXS_MATERIAL_MANAGER_H + +#include "PxsMaterialCore.h" +#include "PxsFEMSoftBodyMaterialCore.h" +#include "PxsFEMClothMaterialCore.h" +#include "PxsPBDMaterialCore.h" +#include "PxsFLIPMaterialCore.h" +#include "PxsMPMMaterialCore.h" +#include "foundation/PxAlignedMalloc.h" + +namespace physx +{ + struct PxsMaterialInfo + { + PxU16 mMaterialIndex0; + PxU16 mMaterialIndex1; + }; + + template + class PxsMaterialManagerT + { + public: + PxsMaterialManagerT() + { + const PxU32 matCount = 128; + materials = reinterpret_cast(physx::PxAlignedAllocator<16>().allocate(sizeof(MaterialCore)*matCount, __FILE__, __LINE__)); + maxMaterials = matCount; + for(PxU32 i=0; i().deallocate(materials); + } + + void setMaterial(MaterialCore* mat) + { + const PxU16 materialIndex = mat->mMaterialIndex; + resize(PxU32(materialIndex) + 1); + materials[materialIndex] = *mat; + } + + void updateMaterial(MaterialCore* mat) + { + materials[mat->mMaterialIndex] =*mat; + } + + void removeMaterial(MaterialCore* mat) + { + mat->mMaterialIndex = MATERIAL_INVALID_HANDLE; + } + + PX_FORCE_INLINE MaterialCore* getMaterial(const PxU32 index)const + { + PX_ASSERT(index < maxMaterials); + return &materials[index]; + } + + PxU32 getMaxSize()const + { + return maxMaterials; + } + + void resize(PxU32 minValueForMax) + { + if(maxMaterials>=minValueForMax) + return; + + const PxU32 numMaterials = maxMaterials; + + maxMaterials = (minValueForMax+31)&~31; + MaterialCore* mat = reinterpret_cast(physx::PxAlignedAllocator<16>().allocate(sizeof(MaterialCore)*maxMaterials, __FILE__, __LINE__)); + for(PxU32 i=0; i().deallocate(materials); + + materials = mat; + } + + MaterialCore* materials;//make sure materials's start address is 16 bytes align + PxU32 maxMaterials; + PxU32 mPad; +#if !PX_P64_FAMILY + PxU32 mPad2; +#endif + }; + + //This class is used for forward declaration + class PxsMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsFEMMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsFEMClothMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsPBDMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsFLIPMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsMPMMaterialManager : public PxsMaterialManagerT + { + }; + + class PxsCustomMaterialManager : public PxsMaterialManagerT + { + }; + + template + class PxsMaterialManagerIterator + { + + public: + PxsMaterialManagerIterator(PxsMaterialManagerT& manager) : mManager(manager), mIndex(0) + { + } + + bool getNextMaterial(MaterialCore*& materialCore) + { + const PxU32 maxSize = mManager.getMaxSize(); + PxU32 index = mIndex; + while(index < maxSize && mManager.getMaterial(index)->mMaterialIndex == MATERIAL_INVALID_HANDLE) + index++; + materialCore = NULL; + if(index < maxSize) + materialCore = mManager.getMaterial(index++); + mIndex = index; + return materialCore!=NULL; + } + + private: + PxsMaterialManagerIterator& operator=(const PxsMaterialManagerIterator&); + PxsMaterialManagerT& mManager; + PxU32 mIndex; + }; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialShared.h new file mode 100644 index 0000000..dec932e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsMaterialShared.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MATERIAL_SHARED_H +#define PXS_MATERIAL_SHARED_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ + #define MATERIAL_INVALID_HANDLE 0xffff + + class PxOutputStream; + + template + class MaterialCoreT : public MaterialDataT + { + public: + MaterialCoreT(const MaterialDataT& desc) : MaterialDataT(desc), mMaterial(NULL), mMaterialIndex(MATERIAL_INVALID_HANDLE) {} + MaterialCoreT() : mMaterial(NULL), mMaterialIndex(MATERIAL_INVALID_HANDLE) {} + + MaterialCoreT(const PxEMPTY) : MaterialDataT(PxEmpty) {} + ~MaterialCoreT() {} + + PxMaterialT* mMaterial; // PT: TODO: eventually this could just be a base PxBaseMaterial class instead of a templated param + PxU16 mMaterialIndex; //handle assign by the handle manager + + static void getBinaryMetaData(PxOutputStream& stream); + }; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsPBDMaterialCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsPBDMaterialCore.h new file mode 100644 index 0000000..e4881eb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxsPBDMaterialCore.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_PBD_MATERIAL_CORE_H +#define PXS_PBD_MATERIAL_CORE_H + +#include "PxParticleGpu.h" +#include "PxsMaterialShared.h" + +namespace physx +{ + //Technically, this doesn't need the PxsParticleMaterialData types, but this allows us + //to have a common base and opens the scope for rigid-particle interactions. + struct PxsCustomMaterialData : public PxsParticleMaterialData + { + PxsCustomMaterialData() {} // PT: TODO: ctor leaves things uninitialized, is that by design? + PxsCustomMaterialData(const PxEMPTY) {} + + void* userData; //24 + }; + + struct PxsPBDMaterialData : public PxsParticleMaterialData + { + PxsPBDMaterialData() {} // PT: TODO: ctor leaves things uninitialized, is that by design? + PxsPBDMaterialData(const PxEMPTY) {} + + PxU32 flags; //24 + PxReal viscosity; //28 + PxReal vorticityConfinement; //32 + PxReal surfaceTension; //36 + PxReal cohesion; //40 + PxReal lift; //44 + PxReal drag; //48 + PxReal cflCoefficient; //52 + PxReal particleFrictionScale; //56 + PxReal particleAdhesionScale; //60 + }; + + typedef MaterialCoreT PxsPBDMaterialCore; + typedef MaterialCoreT PxsCustomMaterialCore; + +} //namespace phyxs + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvConfig.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvConfig.h new file mode 100644 index 0000000..227373c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvConfig.h @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_CONFIG_H +#define PXV_CONFIG_H + +/*! \file internal top level include file for lowlevel. */ + +#include "PxPhysXConfig.h" + +/************************************************************************/ +/* Compiler workarounds */ +/************************************************************************/ +#if PX_VC +#pragma warning(disable: 4355 ) // "this" used in base member initializer list +#pragma warning(disable: 4146 ) // unary minus operator applied to unsigned type. +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvDynamics.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvDynamics.h new file mode 100644 index 0000000..866075e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvDynamics.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_DYNAMICS_H +#define PXV_DYNAMICS_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxIntrinsics.h" +#include "PxRigidDynamic.h" + +namespace physx +{ + +/*! +\file +Dynamics interface. +*/ + +struct PxsRigidCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxsRigidCore() : mFlags(0), solverIterationCounts(0) {} + PxsRigidCore(const PxEMPTY) : mFlags(PxEmpty) {} + + PX_ALIGN_PREFIX(16) + PxTransform body2World PX_ALIGN_SUFFIX(16); + PxRigidBodyFlags mFlags; // API body flags + PxU16 solverIterationCounts; // vel iters are in low word and pos iters in high word. + + PX_FORCE_INLINE PxU32 isKinematic() const { return mFlags & PxRigidBodyFlag::eKINEMATIC; } + PX_FORCE_INLINE PxU32 hasCCD() const { return mFlags & PxRigidBodyFlag::eENABLE_CCD; } + PX_FORCE_INLINE PxU32 hasCCDFriction() const { return mFlags & PxRigidBodyFlag::eENABLE_CCD_FRICTION; } + PX_FORCE_INLINE PxU32 hasIdtBody2Actor() const { return mFlags & PxRigidBodyFlag::eRESERVED; } +}; +PX_COMPILE_TIME_ASSERT(sizeof(PxsRigidCore) == 32); + +#define PXV_CONTACT_REPORT_DISABLED PX_MAX_F32 + +struct PxsBodyCore : public PxsRigidCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + + PxsBodyCore() : PxsRigidCore() { kinematicLink = PxU8(0); } + PxsBodyCore(const PxEMPTY) : PxsRigidCore(PxEmpty) {} + + PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return body2Actor; } + PX_FORCE_INLINE void setBody2Actor(const PxTransform& t) + { + if(t.p.isZero() && t.q.isIdentity()) + mFlags.raise(PxRigidBodyFlag::eRESERVED); + else + mFlags.clear(PxRigidBodyFlag::eRESERVED); + + body2Actor = t; + } + protected: + PxTransform body2Actor; + public: + PxReal ccdAdvanceCoefficient; //64 + + PxVec3 linearVelocity; + PxReal maxPenBias; + + PxVec3 angularVelocity; + PxReal contactReportThreshold; //96 + + PxReal maxAngularVelocitySq; + PxReal maxLinearVelocitySq; + PxReal linearDamping; + PxReal angularDamping; //112 + + PxVec3 inverseInertia; + PxReal inverseMass; //128 + + PxReal maxContactImpulse; + PxReal sleepThreshold; + union + { + PxReal freezeThreshold; + PxReal cfmScale; + }; + + PxReal wakeCounter; //144 this is authoritative wakeCounter + + PxReal solverWakeCounter; //this is calculated by the solver when it performs sleepCheck. It is committed to wakeCounter in ScAfterIntegrationTask if the body is still awake. + PxU32 numCountedInteractions; + PxReal offsetSlop; //Slop value used to snap contact line of action back in-line with the COM + PxU8 isFastMoving; //This could be a single bit but it's a u8 at the moment for simplicity's sake + PxU8 disableGravity; //This could be a single bit but it's a u8 at the moment for simplicity's sake + PxRigidDynamicLockFlags lockFlags; //This is u8. + PxU8 kinematicLink; //160 This indicates whether the articulation link is kinematic link. All fits into 16 byte alignment + + // PT: moved from Sc::BodyCore ctor - we don't want to duplicate all this in immediate mode + PX_FORCE_INLINE void init( const PxTransform& bodyPose, + const PxVec3& inverseInertia_, PxReal inverseMass_, + PxReal wakeCounter_, PxReal scaleSpeed, + PxReal linearDamping_, PxReal angularDamping_, + PxReal maxLinearVelocitySq_, PxReal maxAngularVelocitySq_, + PxActorType::Enum type) + { + PX_ASSERT(bodyPose.p.isFinite()); + PX_ASSERT(bodyPose.q.isFinite()); + + // PT: TODO: unify naming convention + + // From PxsRigidCore + body2World = bodyPose; + mFlags = PxRigidBodyFlags(); + solverIterationCounts = (1 << 8) | 4; + + setBody2Actor(PxTransform(PxIdentity)); + + ccdAdvanceCoefficient = 0.15f; + linearVelocity = PxVec3(0.0f); + maxPenBias = -1e32f;//-PX_MAX_F32; + angularVelocity = PxVec3(0.0f); + contactReportThreshold = PXV_CONTACT_REPORT_DISABLED; + maxAngularVelocitySq = maxAngularVelocitySq_; + maxLinearVelocitySq = maxLinearVelocitySq_; + linearDamping = linearDamping_; + angularDamping = angularDamping_; + inverseInertia = inverseInertia_; + inverseMass = inverseMass_; + maxContactImpulse = 1e32f;// PX_MAX_F32; + sleepThreshold = 5e-5f * scaleSpeed * scaleSpeed; + if(type == PxActorType::eARTICULATION_LINK) + cfmScale = 0.025f; + else + freezeThreshold = 2.5e-5f * scaleSpeed * scaleSpeed; + wakeCounter = wakeCounter_; + offsetSlop = 0.f; + // PT: this one is not initialized? + //solverWakeCounter + // PT: these are initialized in BodySim ctor + //numCountedInteractions; + //numBodyInteractions; + isFastMoving = false; + disableGravity = false; + lockFlags = PxRigidDynamicLockFlags(0); + } +}; + +PX_COMPILE_TIME_ASSERT(sizeof(PxsBodyCore) == 160); + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGeometry.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGeometry.h new file mode 100644 index 0000000..8d3e9f9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGeometry.h @@ -0,0 +1,285 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_GEOMETRY_H +#define PXV_GEOMETRY_H + +#include "foundation/PxTransform.h" +#include "PxvConfig.h" + +/*! +\file +Geometry interface +*/ + +/************************************************************************/ +/* Shapes */ +/************************************************************************/ + +#include "GuGeometryChecks.h" +#include "CmUtils.h" + +namespace physx +{ + +// +// Summary of our material approach: +// +// On the API level, materials are accessed via pointer. Internally we store indices into the material table. +// The material table is stored in the SDK and the materials are shared among scenes. To make this threadsafe, +// we have the following approach: +// +// - Every scene has a copy of the SDK master material table +// - At the beginning of a simulation step, the scene material table gets synced to the master material table. +// - While the simulation is running, the scene table does not get touched. +// - Each shape stores the indices of its material(s). When the simulation is not running and a user requests the +// materials of the shape, the indices are used to fetch the material from the master material table. When the +// the simulation is running then the same indices are used internally to fetch the materials from the scene +// material table. +// - This whole scheme only works as long as the position of a material in the material table does not change +// when other materials get deleted/inserted. The data structure of the material table makes sure that is the case. +// + +struct MaterialIndicesStruct +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +// PX_SERIALIZATION + MaterialIndicesStruct(const PxEMPTY) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + MaterialIndicesStruct() + : indices(NULL) + , numIndices(0) + , pad(PX_PADDING_16) + { + } + + ~MaterialIndicesStruct() + { + } + + void allocate(PxU16 size) + { + indices = PX_ALLOCATE(PxU16, size, "MaterialIndicesStruct::allocate"); + numIndices = size; + } + + void deallocate() + { + PX_FREE(indices); + numIndices = 0; + } + PxU16* indices; // the remap table for material index + PxU16 numIndices; // the size of the remap table + PxU16 pad; // pad for serialization + PxU32 gpuRemapId; // PT: using padding bytes on x64 +}; + +struct PxConvexMeshGeometryLL: public PxConvexMeshGeometry +{ + bool gpuCompatible; // PT: TODO: remove? +}; + +struct PxTriangleMeshGeometryLL: public PxTriangleMeshGeometry +{ + MaterialIndicesStruct materialsLL; +}; + +struct PxParticleSystemGeometryLL : public PxParticleSystemGeometry +{ + MaterialIndicesStruct materialsLL; +}; + +struct PxTetrahedronMeshGeometryLL : public PxTetrahedronMeshGeometry +{ + MaterialIndicesStruct materialsLL; +}; + +struct PxHeightFieldGeometryLL : public PxHeightFieldGeometry +{ + MaterialIndicesStruct materialsLL; +}; + +struct PxHairSystemGeometryLL : public PxHairSystemGeometry +{ + PxU32 gpuRemapId; +}; + +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::ePARTICLESYSTEM}; }; +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eCONVEXMESH }; }; +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eTRIANGLEMESH }; }; +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eTETRAHEDRONMESH }; }; +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eHEIGHTFIELD }; }; +template <> struct PxcGeometryTraits { enum { TypeID = PxGeometryType::eHAIRSYSTEM }; }; + +class InvalidGeometry : public PxGeometry +{ +public: + PX_CUDA_CALLABLE PX_FORCE_INLINE InvalidGeometry() : PxGeometry(PxGeometryType::eINVALID) {} +}; + +class GeometryUnion +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + GeometryUnion(const PxEMPTY) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + PX_CUDA_CALLABLE PX_FORCE_INLINE GeometryUnion() { reinterpret_cast(mGeometry) = InvalidGeometry(); } + PX_CUDA_CALLABLE PX_FORCE_INLINE GeometryUnion(const PxGeometry& g) { set(g); } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxGeometry& getGeometry() const { return reinterpret_cast(mGeometry); } + PX_CUDA_CALLABLE PX_FORCE_INLINE PxGeometryType::Enum getType() const { return reinterpret_cast(mGeometry).getType(); } + + PX_CUDA_CALLABLE void set(const PxGeometry& g); + + template PX_CUDA_CALLABLE PX_FORCE_INLINE Geom& get() + { + checkType(getGeometry()); + return reinterpret_cast(mGeometry); + } + + template PX_CUDA_CALLABLE PX_FORCE_INLINE const Geom& get() const + { + checkType(getGeometry()); + return reinterpret_cast(mGeometry); + } + +private: + + union { + void* alignment; // PT: Makes sure the class is at least aligned to pointer size. See DE6803. + PxU8 box[sizeof(PxBoxGeometry)]; + PxU8 sphere[sizeof(PxSphereGeometry)]; + PxU8 capsule[sizeof(PxCapsuleGeometry)]; + PxU8 plane[sizeof(PxPlaneGeometry)]; + PxU8 convex[sizeof(PxConvexMeshGeometryLL)]; + PxU8 particleSystem[sizeof(PxParticleSystemGeometryLL)]; + PxU8 mesh[sizeof(PxTriangleMeshGeometryLL)]; + PxU8 tetMesh[sizeof(PxTetrahedronMeshGeometryLL)]; + PxU8 heightfield[sizeof(PxHeightFieldGeometryLL)]; + PxU8 hairsystem[sizeof(PxHairSystemGeometryLL)]; + PxU8 custom[sizeof(PxCustomGeometry)]; + PxU8 invalid[sizeof(InvalidGeometry)]; + } mGeometry; +}; + + struct PxShapeCoreFlag + { + enum Enum + { + eOWNS_MATERIAL_IDX_MEMORY = (1<<0), // PT: for de-serialization to avoid deallocating material index list. Moved there from Sc::ShapeCore (since one byte was free). + eIS_EXCLUSIVE = (1<<1), // PT: shape's exclusive flag + eIDT_TRANSFORM = (1<<2), // PT: true if PxsShapeCore::transform is identity + eSOFT_BODY_SHAPE = (1<<3), // True if this shape is a soft body shape + eCLOTH_SHAPE = (1<<4) // True if this shape is a cloth shape + }; + }; + + typedef PxFlags PxShapeCoreFlags; + PX_FLAGS_OPERATORS(PxShapeCoreFlag::Enum,PxU8) + +struct PxsShapeCore +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + +// PX_SERIALIZATION + PxsShapeCore() + { + setDensityForFluid(800.0f); + } + PxsShapeCore(const PxEMPTY) : mGeometry(PxEmpty) {} +//~PX_SERIALIZATION + +#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux + protected: +#endif + PX_ALIGN_PREFIX(16) + PxTransform mTransform PX_ALIGN_SUFFIX(16); // PT: Offset 0 +#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux + public: +#endif + PX_FORCE_INLINE const PxTransform& getTransform() const + { + return mTransform; + } + + PX_FORCE_INLINE void setTransform(const PxTransform& t) + { + mTransform = t; + if(t.p.isZero() && t.q.isIdentity()) + mShapeCoreFlags.raise(PxShapeCoreFlag::eIDT_TRANSFORM); + else + mShapeCoreFlags.clear(PxShapeCoreFlag::eIDT_TRANSFORM); + } + + PxReal mContactOffset; // PT: Offset 28 + PxU8 mShapeFlags; // PT: Offset 32 !< API shape flags // PT: TODO: use PxShapeFlags here. Needs to move flags to separate file. + PxShapeCoreFlags mShapeCoreFlags; // PT: Offset 33 + PxU16 mMaterialIndex; // PT: Offset 34 + PxReal mRestOffset; // PT: Offset 36 - same as the API property of the same name - PT: moved from Sc::ShapeCore to fill padding bytes + GeometryUnion mGeometry; // PT: Offset 40 + PxReal mTorsionalRadius; // PT: Offset 104 - PT: moved from Sc::ShapeCore to fill padding bytes + PxReal mMinTorsionalPatchRadius; // PT: Offset 108 - PT: moved from Sc::ShapeCore to fill padding bytes + + PX_FORCE_INLINE float getDensityForFluid() const + { + return mGeometry.getGeometry().mTypePadding; + } + + PX_FORCE_INLINE void setDensityForFluid(float density) + { + const_cast(mGeometry.getGeometry()).mTypePadding = density; + } +}; + +PX_COMPILE_TIME_ASSERT( sizeof(GeometryUnion) <= 64); // PT: if you break this one I will not be happy + +PX_COMPILE_TIME_ASSERT( (sizeof(PxsShapeCore)&0xf) == 0); + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGlobals.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGlobals.h new file mode 100644 index 0000000..d3f32f4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvGlobals.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_GLOBALS_H +#define PXV_GLOBALS_H + +#include "PxvConfig.h" +#include "foundation/PxBasicTemplates.h" + +namespace physx +{ + +/*! +\file +PhysX Low-level, Memory management +*/ + +/************************************************************************/ +/* Error Handling */ +/************************************************************************/ + + +enum PxvErrorCode +{ + PXD_ERROR_NO_ERROR = 0, + PXD_ERROR_INVALID_PARAMETER, + PXD_ERROR_INVALID_PARAMETER_SIZE, + PXD_ERROR_INTERNAL_ERROR, + PXD_ERROR_NOT_IMPLEMENTED, + PXD_ERROR_NO_CONTEXT, + PXD_ERROR_NO_TASK_MANAGER, + PXD_ERROR_WARNING +}; + +class PxShape; +class PxRigidActor; +struct PxsShapeCore; +struct PxsRigidCore; + +struct PxvOffsetTable +{ + PX_FORCE_INLINE PxvOffsetTable() {} + + PX_FORCE_INLINE const PxShape* convertPxsShape2Px(const PxsShapeCore* pxs) const + { + return PxPointerOffset(pxs, pxsShapeCore2PxShape); + } + + PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidBody(const PxsRigidCore* pxs) const + { + return PxPointerOffset(pxs, pxsRigidCore2PxRigidBody); + } + + PX_FORCE_INLINE const PxRigidActor* convertPxsRigidCore2PxRigidStatic(const PxsRigidCore* pxs) const + { + return PxPointerOffset(pxs, pxsRigidCore2PxRigidStatic); + } + + ptrdiff_t pxsShapeCore2PxShape; + ptrdiff_t pxsRigidCore2PxRigidBody; + ptrdiff_t pxsRigidCore2PxRigidStatic; +}; +extern PxvOffsetTable gPxvOffsetTable; + +/*! +Initialize low-level implementation. +*/ + +void PxvInit(const PxvOffsetTable& offsetTable); + + +/*! +Shut down low-level implementation. +*/ +void PxvTerm(); + +/*! +Initialize low-level implementation. +*/ + +void PxvRegisterHeightFields(); + +#if PX_SUPPORT_GPU_PHYSX +class PxPhysXGpu* PxvGetPhysXGpu(bool createIfNeeded); +void PxvReleasePhysXGpu(PxPhysXGpu*); +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvManager.h new file mode 100644 index 0000000..4c0ef49 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvManager.h @@ -0,0 +1,214 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_MANAGER_H +#define PXV_MANAGER_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMemory.h" +#include "PxvConfig.h" +#include "PxvGeometry.h" + +namespace physx +{ + +/*! +\file +Manager interface +*/ + +/************************************************************************/ +/* Managers */ +/************************************************************************/ + +class PxsContactManager; + +struct PxsRigidCore; +struct PxsShapeCore; +class PxsRigidBody; + +/*! +Type of PXD_MANAGER_CCD_MODE property +*/ +enum PxvContactManagerCCDMode +{ + PXD_MANAGER_CCD_NONE, + PXD_MANAGER_CCD_LINEAR +}; + +/*! +Manager descriptor +*/ +struct PxvManagerDescRigidRigid +{ + /*! + Manager user data + + \sa PXD_MANAGER_USER_DATA + */ + //void* userData; + + /*! + Dominance setting for one way interactions. + A dominance of 0 means the corresp. body will + not be pushable by the other body in the constraint. + \sa PXD_MANAGER_DOMINANCE0 + */ + PxU8 dominance0; + + /*! + Dominance setting for one way interactions. + A dominance of 0 means the corresp. body will + not be pushable by the other body in the constraint. + \sa PXD_MANAGER_DOMINANCE1 + */ + PxU8 dominance1; + + /*! + PxsRigidBodies + */ + PxsRigidBody* rigidBody0; + PxsRigidBody* rigidBody1; + + /*! + Shape Core structures + */ + const PxsShapeCore* shapeCore0; + const PxsShapeCore* shapeCore1; + + /*! + Body Core structures + */ + PxsRigidCore* rigidCore0; + PxsRigidCore* rigidCore1; + + /*! + Enable contact information reporting. + */ + int reportContactInfo; + + /*! + Enable contact impulse threshold reporting. + */ + int hasForceThreshold; + + /*! + Enable generated contacts to be changeable + */ + int contactChangeable; + + /*! + Disable strong friction + */ + //int disableStrongFriction; + + /*! + Contact resolution rest distance. + */ + PxReal restDistance; + + /*! + Disable contact response + */ + int disableResponse; + + /*! + Disable discrete contact generation + */ + int disableDiscreteContact; + + /*! + Disable CCD contact generation + */ + int disableCCDContact; + + /*! + Is connected to an articulation (1 - first body, 2 - second body) + */ + int hasArticulations; + + /*! + is connected to a dynamic (1 - first body, 2 - second body) + */ + int hasDynamics; + + /*! + Is the pair touching? Use when re-creating the manager with prior knowledge about touch status. + + positive: pair is touching + 0: touch state unknown (this is a new pair) + negative: pair is not touching + + Default is 0 + */ + int hasTouch; + + /*! + Identifies whether body 1 is kinematic. We can treat kinematics as statics and embed velocity into constraint + because kinematic bodies' velocities will not change + */ + bool body1Kinematic; + + /* + Index entries into the transform cache for shape 0 + */ + PxU32 transformCache0; + + /* + Index entries into the transform cache for shape 1 + */ + PxU32 transformCache1; + + PxvManagerDescRigidRigid() + { + PxMemSet(this, 0, sizeof(PxvManagerDescRigidRigid)); + + dominance0 = 1u; + dominance1 = 1u; + } +}; + + +/*! +Report struct for contact manager touch reports +*/ +struct PxvContactManagerTouchEvent +{ + void* userData; + + // PT: only useful to search for places where we get/set this specific user data + PX_FORCE_INLINE void setCMTouchEventUserData(void* ud) { userData = ud; } + PX_FORCE_INLINE void* getCMTouchEventUserData() const { return userData; } +}; + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvSimStats.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvSimStats.h new file mode 100644 index 0000000..2d5e492 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/include/PxvSimStats.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_SIM_STATS_H +#define PXV_SIM_STATS_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "geometry/PxGeometry.h" + +namespace physx +{ + +/*! +\file +Context handling +*/ + +/************************************************************************/ +/* Context handling, types */ +/************************************************************************/ + +/*! +Description: contains statistics for the simulation. +*/ +struct PxvSimStats +{ + PxvSimStats() { clearAll(); } + void clearAll() { PxMemZero(this, sizeof(PxvSimStats)); } // set counters to zero + + PX_FORCE_INLINE void incCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) + { + PX_ASSERT(g0 <= g1); // That's how they should be sorted + mNbCCDPairs[g0][g1]++; + } + + PX_FORCE_INLINE void decCCDPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) + { + PX_ASSERT(g0 <= g1); // That's how they should be sorted + PX_ASSERT(mNbCCDPairs[g0][g1]); + mNbCCDPairs[g0][g1]--; + } + + PX_FORCE_INLINE void incModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) + { + PX_ASSERT(g0 <= g1); // That's how they should be sorted + mNbModifiedContactPairs[g0][g1]++; + } + + PX_FORCE_INLINE void decModifiedContactPairs(PxGeometryType::Enum g0, PxGeometryType::Enum g1) + { + PX_ASSERT(g0 <= g1); // That's how they should be sorted + PX_ASSERT(mNbModifiedContactPairs[g0][g1]); + mNbModifiedContactPairs[g0][g1]--; + } + + // PT: those guys are now persistent and shouldn't be cleared each frame + PxU32 mNbDiscreteContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 mNbCCDPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + + PxU32 mNbModifiedContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + + PxU32 mNbDiscreteContactPairsTotal; // PT: sum of mNbDiscreteContactPairs, i.e. number of pairs reaching narrow phase + PxU32 mNbDiscreteContactPairsWithCacheHits; + PxU32 mNbDiscreteContactPairsWithContacts; + PxU32 mNbActiveConstraints; + PxU32 mNbActiveDynamicBodies; + PxU32 mNbActiveKinematicBodies; + + PxU32 mNbAxisSolverConstraints; + PxU32 mTotalCompressedContactSize; + PxU32 mTotalConstraintSize; + PxU32 mPeakConstraintBlockAllocations; + + PxU32 mNbNewPairs; + PxU32 mNbLostPairs; + + PxU32 mNbNewTouches; + PxU32 mNbLostTouches; + + PxU32 mNbPartitions; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp new file mode 100644 index 0000000..2c6904c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/api/src/px_globals.cpp @@ -0,0 +1,254 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxvGlobals.h" +#include "PxsContext.h" +#include "PxcContactMethodImpl.h" +#include "GuContactMethodImpl.h" + +#if PX_SUPPORT_GPU_PHYSX + #include "PxPhysXGpu.h" + static physx::PxPhysXGpu* gPxPhysXGpu = NULL; +#endif + +namespace physx +{ + +PxvOffsetTable gPxvOffsetTable; + +void PxvInit(const PxvOffsetTable& offsetTable) +{ +#if PX_SUPPORT_GPU_PHYSX + gPxPhysXGpu = NULL; +#endif + gPxvOffsetTable = offsetTable; +} + +void PxvTerm() +{ +#if PX_SUPPORT_GPU_PHYSX + PX_RELEASE(gPxPhysXGpu); +#endif +} + +} + +#if PX_SUPPORT_GPU_PHYSX +namespace physx +{ + //forward declare stuff from PxPhysXGpuModuleLoader.cpp + void PxLoadPhysxGPUModule(const char* appGUID); + typedef physx::PxPhysXGpu* (PxCreatePhysXGpu_FUNC)(); + extern PxCreatePhysXGpu_FUNC* g_PxCreatePhysXGpu_Func; + + PxPhysXGpu* PxvGetPhysXGpu(bool createIfNeeded) + { + if (!gPxPhysXGpu && createIfNeeded) + { +#ifdef PX_PHYSX_GPU_STATIC + gPxPhysXGpu = PxCreatePhysXGpu(); +#else + PxLoadPhysxGPUModule(NULL); + if (g_PxCreatePhysXGpu_Func) + { + gPxPhysXGpu = g_PxCreatePhysXGpu_Func(); + } +#endif + } + + return gPxPhysXGpu; + } + + // PT: added for the standalone GPU BP but we may want to revisit this + void PxvReleasePhysXGpu(PxPhysXGpu* gpu) + { + PX_ASSERT(gpu==gPxPhysXGpu); + PX_RELEASE(gpu); + gPxPhysXGpu = NULL; + } +} +#endif + +#include "common/PxMetaData.h" +#include "PxsFEMClothMaterialCore.h" +#include "PxsFEMSoftBodyMaterialCore.h" +#include "PxsFLIPMaterialCore.h" +#include "PxsMPMMaterialCore.h" +#include "PxsPBDMaterialCore.h" +#include "PxsMaterialCore.h" + +namespace physx +{ + +template<> void PxsMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxCombineMode::Enum, PxU32) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxMaterialFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, PxsMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxReal, dynamicFriction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxReal, staticFriction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxReal, restitution, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxReal, damping, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxMaterialFlags, flags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxU8, fricCombineMode, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxU8, restCombineMode, 0) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsFEMSoftBodyMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsFEMSoftBodyMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, youngs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, poissons, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, dynamicFriction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, dampingScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, deformThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, deformLowLimitRatio, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxReal, deformHighLimitRatio, 0) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxFEMSoftBodyMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMSoftBodyMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsFEMClothMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsFEMClothMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, youngs, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, poissons, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, dynamicFriction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, thickness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, elasticityDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxReal, bendingDamping, 0) + PX_DEF_BIN_METADATA_ITEMS(stream, PxsFEMClothMaterialCore, PxReal, padding, PxMetaDataFlag::ePADDING, 2) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxFEMClothMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFEMClothMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsPBDMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsPBDMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, friction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, adhesion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, gravityScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, adhesionRadiusScale, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxU32, flags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, viscosity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, vorticityConfinement, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, surfaceTension, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, cohesion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, lift, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, drag, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, cflCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, particleFrictionScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxReal, particleAdhesionScale, 0) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxPBDMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsPBDMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsCustomMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsCustomMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsCustomMaterialCore, void, userData, PxMetaDataFlag::ePTR) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsCustomMaterialCore, PxPBDMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsCustomMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsFLIPMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsFLIPMaterialCore) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, friction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, adhesion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, gravityScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, adhesionRadiusScale, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, viscosity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxReal, surfaceTension, 0) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxFLIPMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsFLIPMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +template<> void PxsMPMMaterialCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsMPMMaterialCore) + + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxIntBool, PxU32) + + // MaterialData + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, friction, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, adhesion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, gravityScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, adhesionRadiusScale, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxIntBool, isPlastic, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, youngsModulus, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, poissonsRatio, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, hardening, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, criticalCompression, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, criticalStretch, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, tensileDamageSensitivity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, compressiveDamageSensitivity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxReal, attractiveForceResidual, 0) + + // MaterialCore + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxMPMMaterial, mMaterial, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxsMPMMaterialCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/collision/PxcContactMethodImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/collision/PxcContactMethodImpl.h new file mode 100644 index 0000000..f82a4a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/collision/PxcContactMethodImpl.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_CONTACT_METHOD_IMPL_H +#define PXC_CONTACT_METHOD_IMPL_H + +#include "GuContactMethodImpl.h" + +namespace physx +{ + +/*! +Method prototype for contact generation routines +*/ +typedef bool (*PxcContactMethod) (GU_CONTACT_METHOD_ARGS); + +// Matrix of types +extern PxcContactMethod g_ContactMethodTable[][PxGeometryType::eGEOMETRY_COUNT]; +extern const bool g_CanUseContactCache[][PxGeometryType::eGEOMETRY_COUNT]; +extern PxcContactMethod g_PCMContactMethodTable[][PxGeometryType::eGEOMETRY_COUNT]; + +extern bool gEnablePCMCaching[][PxGeometryType::eGEOMETRY_COUNT]; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcConstraintBlockStream.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcConstraintBlockStream.h new file mode 100644 index 0000000..0fa2507 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcConstraintBlockStream.h @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_CONSTRAINT_BLOCK_POOL_H +#define PXC_CONSTRAINT_BLOCK_POOL_H + +#include "PxvConfig.h" +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" +#include "PxcNpMemBlockPool.h" + +namespace physx +{ +class PxsConstraintBlockManager +{ +public: + PxsConstraintBlockManager(PxcNpMemBlockPool & blockPool): + mBlockPool(blockPool) + { + } + + PX_FORCE_INLINE void reset() + { + mBlockPool.releaseConstraintBlocks(mTrackingArray); + } + + PxcNpMemBlockArray mTrackingArray; + PxcNpMemBlockPool& mBlockPool; + +private: + PxsConstraintBlockManager& operator=(const PxsConstraintBlockManager&); +}; + +class PxcConstraintBlockStream +{ + PX_NOCOPY(PxcConstraintBlockStream) +public: + PxcConstraintBlockStream(PxcNpMemBlockPool & blockPool) : + mBlockPool (blockPool), + mBlock (NULL), + mUsed (0) + { + } + + PX_FORCE_INLINE PxU8* reserve(PxU32 size, PxsConstraintBlockManager& manager) + { + size = (size+15)&~15; + if(size>PxcNpMemBlock::SIZE) + return mBlockPool.acquireExceptionalConstraintMemory(size); + + if(mBlock == NULL || size+mUsed>PxcNpMemBlock::SIZE) + { + mBlock = mBlockPool.acquireConstraintBlock(manager.mTrackingArray); + PX_ASSERT(0==mBlock || mBlock->data == reinterpret_cast(mBlock)); + mUsed = size; + return reinterpret_cast(mBlock); + } + PX_ASSERT(mBlock && mBlock->data == reinterpret_cast(mBlock)); + PxU8* PX_RESTRICT result = mBlock->data+mUsed; + mUsed += size; + return result; + } + + PX_FORCE_INLINE void reset() + { + mBlock = NULL; + mUsed = 0; + } + + PX_FORCE_INLINE PxcNpMemBlockPool& getMemBlockPool() { return mBlockPool; } + +private: + PxcNpMemBlockPool& mBlockPool; + PxcNpMemBlock* mBlock; // current constraint block + PxU32 mUsed; // number of bytes used in constraint block + //Tracking peak allocations + PxU32 mPeakUsed; +}; + +class PxcContactBlockStream +{ + PX_NOCOPY(PxcContactBlockStream) +public: + PxcContactBlockStream(PxcNpMemBlockPool & blockPool): + mBlockPool(blockPool), + mBlock(NULL), + mUsed(0) + { + } + + PX_FORCE_INLINE PxU8* reserve(PxU32 size) + { + size = (size+15)&~15; + + if(size>PxcNpMemBlock::SIZE) + return mBlockPool.acquireExceptionalConstraintMemory(size); + + PX_ASSERT(size <= PxcNpMemBlock::SIZE); + + if(mBlock == NULL || size+mUsed>PxcNpMemBlock::SIZE) + { + mBlock = mBlockPool.acquireContactBlock(); + PX_ASSERT(0==mBlock || mBlock->data == reinterpret_cast(mBlock)); + mUsed = size; + return reinterpret_cast(mBlock); + } + PX_ASSERT(mBlock && mBlock->data == reinterpret_cast(mBlock)); + PxU8* PX_RESTRICT result = mBlock->data+mUsed; + mUsed += size; + return result; + } + + PX_FORCE_INLINE void reset() + { + mBlock = NULL; + mUsed = 0; + } + + PX_FORCE_INLINE PxcNpMemBlockPool& getMemBlockPool() { return mBlockPool; } + +private: + PxcNpMemBlockPool& mBlockPool; + PxcNpMemBlock* mBlock; // current constraint block + PxU32 mUsed; // number of bytes used in constraint block +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcContactCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcContactCache.h new file mode 100644 index 0000000..26b3c04 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcContactCache.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_CONTACT_CACHE_H +#define PXC_CONTACT_CACHE_H + +#include "foundation/PxTransform.h" +#include "PxvConfig.h" +#include "PxcContactMethodImpl.h" + +namespace physx +{ + class PxcNpThreadContext; + + bool PxcCacheLocalContacts( PxcNpThreadContext& context, Gu::Cache& pairContactCache, + const PxTransform& tm0, const PxTransform& tm1, + const PxcContactMethod conMethod, + const PxGeometry& shape0, const PxGeometry& shape1); + + struct PxcLocalContactsCache + { + PxTransform mTransform0; + PxTransform mTransform1; + PxU16 mNbCachedContacts; + bool mUseFaceIndices; + bool mSameNormal; + + PX_FORCE_INLINE void operator = (const PxcLocalContactsCache& other) + { + mTransform0 = other.mTransform0; + mTransform1 = other.mTransform1; + mNbCachedContacts = other.mNbCachedContacts; + mUseFaceIndices = other.mUseFaceIndices; + mSameNormal = other.mSameNormal; + } + }; + +} + +#endif // PXC_CONTACT_CACHE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcMaterialMethodImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcMaterialMethodImpl.h new file mode 100644 index 0000000..08b6b8a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcMaterialMethodImpl.h @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_MATERIAL_METHOD_H +#define PXC_MATERIAL_METHOD_H + +#include "geometry/PxGeometry.h" + +namespace physx +{ + +struct PxsShapeCore; +struct PxsMaterialInfo; +class PxcNpThreadContext; + +#define MATERIAL_METHOD_ARGS \ + const PxsShapeCore* shape0, \ + const PxsShapeCore* shape1, \ + PxcNpThreadContext& pairContext, \ + PxsMaterialInfo* materialInfo + + +#define SINGLE_MATERIAL_METHOD_ARGS \ + const PxsShapeCore* shape, \ + const PxU32 index, \ + PxcNpThreadContext& pairContext, \ + PxsMaterialInfo* materialInfo + +/*! +Method prototype for fetch material routines +*/ +typedef void (*PxcGetMaterialMethod) (MATERIAL_METHOD_ARGS); + +typedef void (*PxcGetSingleMaterialMethod) (SINGLE_MATERIAL_METHOD_ARGS); + +extern PxcGetMaterialMethod g_GetMaterialMethodTable[][PxGeometryType::eGEOMETRY_COUNT]; + +extern PxcGetSingleMaterialMethod g_GetSingleMaterialMethodTable[PxGeometryType::eGEOMETRY_COUNT]; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpBatch.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpBatch.h new file mode 100644 index 0000000..8b35f08 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpBatch.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_BATCH_H +#define PXC_NP_BATCH_H + +#include "PxvConfig.h" + +namespace physx +{ + struct PxcNpWorkUnit; + class PxcNpThreadContext; + struct PxsContactManagerOutput; + + namespace Gu + { + struct Cache; + } + + void PxcDiscreteNarrowPhase(PxcNpThreadContext& context, const PxcNpWorkUnit& cmInput, Gu::Cache& cache, PxsContactManagerOutput& output, PxU64 contextID); + void PxcDiscreteNarrowPhasePCM(PxcNpThreadContext& context, const PxcNpWorkUnit& cmInput, Gu::Cache& cache, PxsContactManagerOutput& output, PxU64 contextID); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCache.h new file mode 100644 index 0000000..5cd0d9d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCache.h @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_CACHE_H +#define PXC_NP_CACHE_H + +#include "foundation/PxMemory.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxPool.h" +#include "foundation/PxUtilities.h" + +#include "PxcNpCacheStreamPair.h" + +#include "GuContactMethodImpl.h" + +namespace physx +{ + +template +void PxcNpCacheWrite(PxcNpCacheStreamPair& streams, + Gu::Cache& cache, + const T& payload, + PxU32 bytes, + const PxU8* data) +{ + const PxU32 payloadSize = (sizeof(payload)+3)&~3; + cache.mCachedSize = PxTo16((payloadSize + 4 + bytes + 0xF)&~0xF); + + PxU8* ls = streams.reserve(cache.mCachedSize); + cache.mCachedData = ls; + if(ls==NULL || (reinterpret_cast(-1))==ls) + { + if(ls==NULL) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for narrow phase. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + return; + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in narrowphase. " + "Either accept dropped contacts or simplify collision geometry."); + cache.mCachedData = NULL; + ls = NULL; + return; + } + } + + *reinterpret_cast(ls) = payload; + *reinterpret_cast(ls+payloadSize) = bytes; + if(data) + PxMemCopy(ls+payloadSize+sizeof(PxU32), data, bytes); +} + + +template +PxU8* PxcNpCacheWriteInitiate(PxcNpCacheStreamPair& streams, Gu::Cache& cache, const T& payload, PxU32 bytes) +{ + PX_UNUSED(payload); + + const PxU32 payloadSize = (sizeof(payload)+3)&~3; + cache.mCachedSize = PxTo16((payloadSize + 4 + bytes + 0xF)&~0xF); + + PxU8* ls = streams.reserve(cache.mCachedSize); + cache.mCachedData = ls; + if(NULL==ls || reinterpret_cast(-1)==ls) + { + if(NULL==ls) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for narrow phase. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in narrowphase. " + "Either accept dropped contacts or simplify collision geometry."); + cache.mCachedData = NULL; + ls = NULL; + } + } + return ls; +} + +template +PX_FORCE_INLINE void PxcNpCacheWriteFinalize(PxU8* ls, const T& payload, PxU32 bytes, const PxU8* data) +{ + const PxU32 payloadSize = (sizeof(payload)+3)&~3; + *reinterpret_cast(ls) = payload; + *reinterpret_cast(ls+payloadSize) = bytes; + if(data) + PxMemCopy(ls+payloadSize+sizeof(PxU32), data, bytes); +} + + +template +PX_FORCE_INLINE PxU8* PxcNpCacheRead(Gu::Cache& cache, T*& payload) +{ + PxU8* ls = cache.mCachedData; + payload = reinterpret_cast(ls); + const PxU32 payloadSize = (sizeof(T)+3)&~3; + return reinterpret_cast(ls+payloadSize+sizeof(PxU32)); +} + +template +const PxU8* PxcNpCacheRead2(Gu::Cache& cache, T& payload, PxU32& bytes) +{ + const PxU8* ls = cache.mCachedData; + if(ls==NULL) + { + bytes = 0; + return NULL; + } + + const PxU32 payloadSize = (sizeof(payload)+3)&~3; + payload = *reinterpret_cast(ls); + bytes = *reinterpret_cast(ls+payloadSize); + PX_ASSERT(cache.mCachedSize == ((payloadSize + 4 + bytes+0xF)&~0xF)); + return reinterpret_cast(ls+payloadSize+sizeof(PxU32)); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCacheStreamPair.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCacheStreamPair.h new file mode 100644 index 0000000..a40a2ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpCacheStreamPair.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_CACHE_STREAM_PAIR_H +#define PXC_NP_CACHE_STREAM_PAIR_H + +#include "foundation/PxSimpleTypes.h" +#include "PxvConfig.h" +#include "PxcNpMemBlockPool.h" + +namespace physx +{ + +static const PxU32 PXC_NPCACHE_BLOCK_SIZE = 16384; + + +struct PxcNpCacheStreamPair +{ +public: + PxcNpCacheStreamPair(PxcNpMemBlockPool& blockPool); + + // reserve can fail and return null. + PxU8* reserve(PxU32 byteCount); + void reset(); +private: + PxcNpMemBlockPool& mBlockPool; + PxcNpMemBlock* mBlock; + PxU32 mUsed; +private: + PxcNpCacheStreamPair& operator=(const PxcNpCacheStreamPair&); +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpContactPrepShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpContactPrepShared.h new file mode 100644 index 0000000..09fc9b3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpContactPrepShared.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_CONTACT_PREP_SHARED_H +#define PXC_NP_CONTACT_PREP_SHARED_H + +namespace physx +{ +class PxcNpThreadContext; +struct PxsMaterialInfo; +class PxsMaterialManager; +class PxsConstraintBlockManager; +class PxcConstraintBlockStream; +struct PxsContactManagerOutput; + +namespace Gu +{ + struct ContactPoint; +} + +static const PxReal PXC_SAME_NORMAL = 0.999f; //Around 6 degrees + +PxU32 writeCompressedContact(const PxContactPoint* const PX_RESTRICT contactPoints, const PxU32 numContactPoints, PxcNpThreadContext* threadContext, + PxU16& writtenContactCount, PxU8*& outContactPatches, PxU8*& outContactPoints, PxU16& compressedContactSize, PxReal*& contactForces, PxU32 contactForceByteSize, + const PxsMaterialManager* materialManager, bool hasModifiableContacts, bool forceNoResponse, PxsMaterialInfo* PX_RESTRICT pMaterial, PxU8& numPatches, + PxU32 additionalHeaderSize = 0, PxsConstraintBlockManager* manager = NULL, PxcConstraintBlockStream* blockStream = NULL, bool insertAveragePoint = false, + PxcDataStreamPool* pool = NULL, PxcDataStreamPool* patchStreamPool = NULL, PxcDataStreamPool* forcePool = NULL, const bool isMeshType = false); + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpMemBlockPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpMemBlockPool.h new file mode 100644 index 0000000..869e760 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpMemBlockPool.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_MEM_BLOCK_POOL_H +#define PXC_NP_MEM_BLOCK_POOL_H + +#include "PxvConfig.h" +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" + +namespace physx +{ +class PxcScratchAllocator; + +struct PxcNpMemBlock +{ + enum + { + SIZE = 16384 + }; + PxU8 data[SIZE]; +}; + +typedef PxArray PxcNpMemBlockArray; + +class PxcNpMemBlockPool +{ + PX_NOCOPY(PxcNpMemBlockPool) +public: + PxcNpMemBlockPool(PxcScratchAllocator& allocator); + ~PxcNpMemBlockPool(); + + void init(PxU32 initial16KDataBlocks, PxU32 maxBlocks); + void flush(); + void setBlockCount(PxU32 count); + PxU32 getUsedBlockCount() const; + PxU32 getMaxUsedBlockCount() const; + PxU32 getPeakConstraintBlockCount() const; + void releaseUnusedBlocks(); + + PxcNpMemBlock* acquireConstraintBlock(); + PxcNpMemBlock* acquireConstraintBlock(PxcNpMemBlockArray& memBlocks); + PxcNpMemBlock* acquireContactBlock(); + PxcNpMemBlock* acquireFrictionBlock(); + PxcNpMemBlock* acquireNpCacheBlock(); + + PxU8* acquireExceptionalConstraintMemory(PxU32 size); + + void acquireConstraintMemory(); + void releaseConstraintMemory(); + void releaseConstraintBlocks(PxcNpMemBlockArray& memBlocks); + void releaseContacts(); + void swapFrictionStreams(); + void swapNpCacheStreams(); + + void flushUnused(); + +private: + + PxMutex mLock; + PxcNpMemBlockArray mConstraints; + PxcNpMemBlockArray mContacts[2]; + PxcNpMemBlockArray mFriction[2]; + PxcNpMemBlockArray mNpCache[2]; + PxcNpMemBlockArray mScratchBlocks; + PxArray mExceptionalConstraints; + + PxcNpMemBlockArray mUnused; + + PxU32 mNpCacheActiveStream; + PxU32 mFrictionActiveStream; + PxU32 mCCDCacheActiveStream; + PxU32 mContactIndex; + PxU32 mAllocatedBlocks; + PxU32 mMaxBlocks; + PxU32 mInitialBlocks; + PxU32 mUsedBlocks; + PxU32 mMaxUsedBlocks; + PxcNpMemBlock* mScratchBlockAddr; + PxU32 mNbScratchBlocks; + PxcScratchAllocator& mScratchAllocator; + + PxU32 mPeakConstraintAllocations; + PxU32 mConstraintAllocations; + + PxcNpMemBlock* acquire(PxcNpMemBlockArray& trackingArray, PxU32* allocationCount = NULL, PxU32* peakAllocationCount = NULL, bool isScratchAllocation = false); + void release(PxcNpMemBlockArray& deadArray, PxU32* allocationCount = NULL); +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpThreadContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpThreadContext.h new file mode 100644 index 0000000..c0d8104 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpThreadContext.h @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_THREAD_CONTEXT_H +#define PXC_NP_THREAD_CONTEXT_H + +#include "geometry/PxGeometry.h" +#include "geomutils/PxContactBuffer.h" +#include "common/PxRenderOutput.h" + +#include "CmRenderBuffer.h" + +#include "PxvConfig.h" +#include "CmScaling.h" +#include "PxcNpCacheStreamPair.h" +#include "PxcConstraintBlockStream.h" +#include "PxcThreadCoherentCache.h" +#include "PxcScratchAllocator.h" +#include "foundation/PxBitMap.h" +#include "../pcm/GuPersistentContactManifold.h" +#include "../contact/GuContactMethodImpl.h" + +namespace physx +{ + +class PxsTransformCache; +class PxsMaterialManager; + +namespace Sc +{ + class BodySim; +} + +/*! +Per-thread context used by contact generation routines. +*/ + +struct PxcDataStreamPool +{ + PxU8* mDataStream; + PxI32 mSharedDataIndex; + PxU32 mDataStreamSize; + PxU32 mSharedDataIndexGPU; + + bool isOverflown() const + { + //FD: my expectaton is that reading those variables is atomic, shared indices are non-decreasing, + //so we can only get a false overflow alert because of concurrency issues, which is not a big deal as it means + //it did overflow a bit later + return (mSharedDataIndex + mSharedDataIndexGPU) > mDataStreamSize; + } +}; + +struct PxcNpContext +{ + private: + PX_NOCOPY(PxcNpContext) + public: + + PxcNpContext() : + mNpMemBlockPool (mScratchAllocator), + mMeshContactMargin (0.0f), + mToleranceLength (0.0f), + mContactStreamPool (NULL), + mPatchStreamPool (NULL), + mForceAndIndiceStreamPool(NULL), + mMaterialManager (NULL) + { + } + + PxcScratchAllocator mScratchAllocator; + PxcNpMemBlockPool mNpMemBlockPool; + PxReal mMeshContactMargin; + PxReal mToleranceLength; + Cm::RenderBuffer mRenderBuffer; + PxcDataStreamPool* mContactStreamPool; + PxcDataStreamPool* mPatchStreamPool; + PxcDataStreamPool* mForceAndIndiceStreamPool; + PxcDataStreamPool* mConstraintWriteBackStreamPool; + PxsMaterialManager* mMaterialManager; + + PX_FORCE_INLINE PxReal getToleranceLength() const { return mToleranceLength; } + PX_FORCE_INLINE void setToleranceLength(PxReal x) { mToleranceLength = x; } + PX_FORCE_INLINE PxReal getMeshContactMargin() const { return mMeshContactMargin; } + PX_FORCE_INLINE void setMeshContactMargin(PxReal x) { mMeshContactMargin = x; } + + PX_FORCE_INLINE PxcNpMemBlockPool& getNpMemBlockPool() { return mNpMemBlockPool; } + PX_FORCE_INLINE const PxcNpMemBlockPool& getNpMemBlockPool() const { return mNpMemBlockPool; } + PX_FORCE_INLINE void setMaterialManager(PxsMaterialManager* m){ mMaterialManager = m; } + PX_FORCE_INLINE PxsMaterialManager* getMaterialManager() const { return mMaterialManager; } +}; + +class PxcNpThreadContext : public PxcThreadCoherentCache::EntryBase +{ + PX_NOCOPY(PxcNpThreadContext) +public: + PxcNpThreadContext(PxcNpContext* params); + ~PxcNpThreadContext(); + +#if PX_ENABLE_SIM_STATS + void clearStats(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + PX_FORCE_INLINE void addLocalNewTouchCount(PxU32 newTouchCMCount) { mLocalNewTouchCount += newTouchCMCount; } + PX_FORCE_INLINE void addLocalLostTouchCount(PxU32 lostTouchCMCount) { mLocalLostTouchCount += lostTouchCMCount; } + PX_FORCE_INLINE PxU32 getLocalNewTouchCount() const { return mLocalNewTouchCount; } + PX_FORCE_INLINE PxU32 getLocalLostTouchCount() const { return mLocalLostTouchCount; } + + + PX_FORCE_INLINE PxBitMap& getLocalChangeTouch() { return mLocalChangeTouch; } + + void reset(PxU32 cmCount); + // debugging + PxRenderOutput mRenderOutput; + + // dsequeira: Need to think about this block pool allocation a bit more. Ideally we'd be + // taking blocks from a single pool, except that we want to be able to selectively reclaim + // blocks if the user needs to defragment, depending on which artifacts they're willing + // to tolerate, such that the blocks we don't reclaim are contiguous. +#if PX_ENABLE_SIM_STATS + PxU32 mDiscreteContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 mModifiedContactPairs [PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + PxcContactBlockStream mContactBlockStream; // constraint block pool + PxcNpCacheStreamPair mNpCacheStreamPair; // narrow phase pairwise data cache + + // Everything below here is scratch state. Most of it can even overlap. + + // temporary contact buffer + PxContactBuffer mContactBuffer; + + PX_ALIGN(16, Gu::MultiplePersistentContactManifold mTempManifold); + + Gu::NarrowPhaseParams mNarrowPhaseParams; + + // DS: this stuff got moved here from the PxcNpPairContext. As Pierre says: + ////////// PT: those members shouldn't be there in the end, it's not necessary + PxArray mBodySimPool; + PxsTransformCache* mTransformCache; + const PxReal* mContactDistances; + bool mPCM; + bool mContactCache; + bool mCreateAveragePoint; // flag to enforce whether we create average points +#if PX_ENABLE_SIM_STATS + PxU32 mCompressedCacheSize; + PxU32 mNbDiscreteContactPairsWithCacheHits; + PxU32 mNbDiscreteContactPairsWithContacts; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + PxReal mDt; // AP: still needed for ccd + PxU32 mCCDPass; + PxU32 mCCDFaceIndex; + + PxU32 mMaxPatches; + //PxU32 mTotalContactCount; + PxU32 mTotalCompressedCacheSize; + //PxU32 mTotalPatchCount; + + PxcDataStreamPool* mContactStreamPool; + PxcDataStreamPool* mPatchStreamPool; + PxcDataStreamPool* mForceAndIndiceStreamPool; //this stream is used to store the force buffer and triangle index if we are performing mesh/heightfield contact gen + PxcDataStreamPool* mConstraintWriteBackStreamPool; + PxsMaterialManager* mMaterialManager; +private: + // change touch handling. + PxBitMap mLocalChangeTouch; + PxU32 mLocalNewTouchCount; + PxU32 mLocalLostTouchCount; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpWorkUnit.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpWorkUnit.h new file mode 100644 index 0000000..fdefc24 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/pipeline/PxcNpWorkUnit.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_NP_WORK_UNIT_H +#define PXC_NP_WORK_UNIT_H + +#include "PxcNpThreadContext.h" +#include "PxcMaterialMethodImpl.h" +#include "PxcNpCache.h" + +namespace physx +{ +struct PxsRigidCore; +struct PxsShapeCore; + +struct PxcNpWorkUnitFlag +{ + enum Enum + { + eOUTPUT_CONTACTS = 1 << 0, + eOUTPUT_CONSTRAINTS = 1 << 1, + eDISABLE_STRONG_FRICTION = 1 << 2, + eARTICULATION_BODY0 = 1 << 3, + eARTICULATION_BODY1 = 1 << 4, + eDYNAMIC_BODY0 = 1 << 5, + eDYNAMIC_BODY1 = 1 << 6, + eSOFT_BODY = 1 << 7, + eMODIFIABLE_CONTACT = 1 << 8, + eFORCE_THRESHOLD = 1 << 9, + eDETECT_DISCRETE_CONTACT = 1 << 10, + eHAS_KINEMATIC_ACTOR = 1 << 11, + eDISABLE_RESPONSE = 1 << 12, + eDETECT_CCD_CONTACTS = 1 << 13, + }; +}; + +struct PxcNpWorkUnitStatusFlag +{ + enum Enum + { + eHAS_NO_TOUCH = (1 << 0), + eHAS_TOUCH = (1 << 1), + //eHAS_SOLVER_CONSTRAINTS = (1 << 2), + eREQUEST_CONSTRAINTS = (1 << 3), + eHAS_CCD_RETOUCH = (1 << 4), // Marks pairs that are touching at a CCD pass and were touching at discrete collision or at a previous CCD pass already + // but we can not tell whether they lost contact in a pass before. We send them as pure eNOTIFY_TOUCH_CCD events to the + // contact report callback if requested. + eDIRTY_MANAGER = (1 << 5), + eREFRESHED_WITH_TOUCH = (1 << 6), + eTOUCH_KNOWN = eHAS_NO_TOUCH | eHAS_TOUCH // The touch status is known (if narrowphase never ran for a pair then no flag will be set) + }; +}; + +// PT: TODO: fix the inconsistent namings (mXXX) in this class +struct PxcNpWorkUnit +{ + const PxsRigidCore* rigidCore0; // INPUT //4 //8 + const PxsRigidCore* rigidCore1; // INPUT //8 //16 + + const PxsShapeCore* shapeCore0; // INPUT //12 //24 + const PxsShapeCore* shapeCore1; // INPUT //16 //32 + + PxU8* ccdContacts; // OUTPUT //20 //40 + + PxU8* frictionDataPtr; // INOUT //24 //48 + + PxU16 flags; // INPUT //26 //50 + PxU8 frictionPatchCount; // INOUT //27 //51 + PxU8 statusFlags; // OUTPUT (see PxcNpWorkUnitStatusFlag) //28 //52 + + PxU8 dominance0; // INPUT //29 //53 + PxU8 dominance1; // INPUT //30 //54 + PxU8 geomType0; // INPUT //31 //55 + PxU8 geomType1; // INPUT //32 //56 + + PxU32 index; // INPUT //36 //60 + + PxReal restDistance; // INPUT //40 //64 + + PxU32 mTransformCache0; // //44 //68 + PxU32 mTransformCache1; // //48 //72 + + PxU32 mEdgeIndex; //inout the island gen edge index //52 //76 + PxU32 mNpIndex; //INPUT //56 //80 + + PxReal mTorsionalPatchRadius; //60 //84 + PxReal mMinTorsionalPatchRadius; //64 //88 + PxReal mOffsetSlop; //68 //92 + + PX_FORCE_INLINE void clearCachedState() + { + frictionDataPtr = NULL; + frictionPatchCount = 0; + ccdContacts = NULL; + } +}; + +//#if !defined(PX_P64) +//PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxcNpWorkUnit) & 0x0f)); +//#endif + +#if !defined(PX_P64) +//PX_COMPILE_TIME_ASSERT(sizeof(PxcNpWorkUnit)==128); +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcScratchAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcScratchAllocator.h new file mode 100644 index 0000000..968c3e6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcScratchAllocator.h @@ -0,0 +1,137 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_SCRATCH_ALLOCATOR_H +#define PXC_SCRATCH_ALLOCATOR_H + +#include "foundation/PxAssert.h" +#include "PxvConfig.h" +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +class PxcScratchAllocator : public PxUserAllocated +{ + PX_NOCOPY(PxcScratchAllocator) +public: + PxcScratchAllocator() : mStack("PxcScratchAllocator"), mStart(NULL), mSize(0) + { + mStack.reserve(64); + mStack.pushBack(0); + } + + void setBlock(void* addr, PxU32 size) + { + PX_ASSERT(!(size&15)); + + // if the stack is not empty then some scratch memory was not freed on the previous frame. That's + // likely indicative of a problem, because when the scratch block is too small the memory will have + // come from the heap + + PX_ASSERT(mStack.size()==1); + mStack.popBack(); + + mStart = reinterpret_cast(addr); + mSize = size; + mStack.pushBack(mStart + size); + } + + void* allocAll(PxU32& size) + { + PxMutex::ScopedLock lock(mLock); + PX_ASSERT(mStack.size()>0); + size = PxU32(mStack.back()-mStart); + + if(size==0) + return NULL; + + mStack.pushBack(mStart); + return mStart; + } + + void* alloc(PxU32 requestedSize, bool fallBackToHeap = false) + { + requestedSize = (requestedSize+15)&~15; + + PxMutex::ScopedLock lock(mLock); + PX_ASSERT(mStack.size()>=1); + + PxU8* top = mStack.back(); + + if(top - mStart >= ptrdiff_t(requestedSize)) + { + PxU8* addr = top - requestedSize; + mStack.pushBack(addr); + return addr; + } + + if(!fallBackToHeap) + return NULL; + + return PX_ALLOC(requestedSize, "Scratch Block Fallback"); + } + + void free(void* addr) + { + PX_ASSERT(addr!=NULL); + if(!isScratchAddr(addr)) + { + PX_FREE(addr); + return; + } + + PxMutex::ScopedLock lock(mLock); + PX_ASSERT(mStack.size()>1); + + PxU32 i=mStack.size()-1; + while(mStack[i](addr); + return a>= mStart && a mStack; + PxU8* mStart; + PxU32 mSize; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcThreadCoherentCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcThreadCoherentCache.h new file mode 100644 index 0000000..16a354f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/include/utils/PxcThreadCoherentCache.h @@ -0,0 +1,148 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXC_THREAD_COHERENT_CACHE_H +#define PXC_THREAD_COHERENT_CACHE_H + +#include "foundation/PxMutex.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxSList.h" + +namespace physx +{ + +class PxsContext; +/*! +Controls a pool of large objects which must be thread safe. +Tries to return the object most recently used by the thread(for better cache coherancy). +Assumes the object has a default contructor. + +(Note the semantics are different to a pool because we dont want to construct/destroy each time +an object is requested, which may be expensive). + +TODO: add thread coherancy. +*/ +template +class PxcThreadCoherentCache : public PxAlignedAllocator<16, PxReflectionAllocator > +{ + typedef PxAlignedAllocator<16, PxReflectionAllocator > Allocator; + PX_NOCOPY(PxcThreadCoherentCache) +public: + + typedef PxSListEntry EntryBase; + + PX_INLINE PxcThreadCoherentCache(Params* params, const Allocator& alloc = Allocator()) : Allocator(alloc), mParams(params) + { + } + + PX_INLINE ~PxcThreadCoherentCache() + { + T* np = static_cast(root.pop()); + + while(np!=NULL) + { + np->~T(); + Allocator::deallocate(np); + np = static_cast(root.pop()); + } + } + + PX_INLINE T* get() + { + T* rv = static_cast(root.pop()); + if(rv==NULL) + { + rv = reinterpret_cast(Allocator::allocate(sizeof(T), __FILE__, __LINE__)); + PX_PLACEMENT_NEW(rv, T(mParams)); + } + + return rv; + } + + PX_INLINE void put(T* item) + { + root.push(*item); + } + + +private: + PxSList root; + Params* mParams; + + template + friend class PxcThreadCoherentCacheIterator; +}; + +/*! +Used to iterate over all objects controlled by the cache. + +Note: The iterator flushes the cache(extracts all items on construction and adds them back on +destruction so we can iterate the list in a safe manner). +*/ +template +class PxcThreadCoherentCacheIterator +{ +public: + PxcThreadCoherentCacheIterator(PxcThreadCoherentCache& cache) : mCache(cache) + { + mNext = cache.root.flush(); + mFirst = mNext; + } + ~PxcThreadCoherentCacheIterator() + { + PxSListEntry* np = mFirst; + while(np != NULL) + { + PxSListEntry* npNext = np->next(); + mCache.root.push(*np); + np = npNext; + } + } + + PX_INLINE T* getNext() + { + if(mNext == NULL) + return NULL; + + T* rv = static_cast(mNext); + mNext = mNext->next(); + + return rv; + } +private: + + PxcThreadCoherentCacheIterator& operator=(const PxcThreadCoherentCacheIterator&); + PxcThreadCoherentCache &mCache; + PxSListEntry* mNext; + PxSListEntry* mFirst; + +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp new file mode 100644 index 0000000..68921df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcContactCache.cpp @@ -0,0 +1,483 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxcContactCache.h" +#include "PxsContactManager.h" +#include "foundation/PxUtilities.h" +#include "PxcNpCache.h" +#include "CmMatrix34.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; + +//#define ENABLE_CONTACT_CACHE_STATS + +#ifdef ENABLE_CONTACT_CACHE_STATS + static PxU32 gNbCalls; + static PxU32 gNbHits; +#endif + +void PxcClearContactCacheStats() +{ +#ifdef ENABLE_CONTACT_CACHE_STATS + gNbCalls = 0; + gNbHits = 0; +#endif +} + +void PxcDisplayContactCacheStats() +{ +#ifdef ENABLE_CONTACT_CACHE_STATS + pxPrintf("%d|%d (%f)\n", gNbHits, gNbCalls, gNbCalls ? float(gNbHits)/float(gNbCalls) : 0.0f); +#endif +} + +namespace physx +{ + const bool g_CanUseContactCache[][PxGeometryType::eGEOMETRY_COUNT] = + { + //PxGeometryType::eSPHERE + { + false, //PxcContactSphereSphere + false, //PxcContactSpherePlane + true, //PxcContactSphereCapsule + false, //PxcContactSphereBox + true, //PxcContactSphereConvex + false, //ParticleSystem + true, //SoftBody + true, //PxcContactSphereMesh + true, //PxcContactSphereHeightField + false, //PxcInvalidContactPair (hair) + false, //PxcContactGeometryCustomGeometry + }, + + //PxGeometryType::ePLANE + { + false, //- + false, //PxcInvalidContactPair + true, //PxcContactPlaneCapsule + true, //PxcContactPlaneBox + true, //PxcContactPlaneConvex + false, //ParticleSystem + true, //SoftBody + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair (hair) + false, //PxcContactGeometryCustomGeometry + }, + + //PxGeometryType::eCAPSULE + { + false, //- + false, //- + true, //PxcContactCapsuleCapsule + true, //PxcContactCapsuleBox + true, //PxcContactCapsuleConvex + false, //ParticleSystem + true, //SoftBody + true, //PxcContactCapsuleMesh + true, //PxcContactCapsuleHeightField + false, //PxcInvalidContactPair (hair) + false, //PxcContactGeometryCustomGeometry + }, + + //PxGeometryType::eBOX + { + false, //- + false, //- + false, //- + true, //PxcContactBoxBox + true, //PxcContactBoxConvex + false, //ParticleSystem + true, //SoftBody + true, //PxcContactBoxMesh + true, //PxcContactBoxHeightField + false, //PxcInvalidContactPair (hair) + false, //PxcContactGeometryCustomGeometry + }, + + //PxGeometryType::eCONVEXMESH + { + false, //- + false, //- + false, //- + false, //- + true, //PxcContactConvexConvex + false, //- + true, //- + true, //PxcContactConvexMesh2 + true, //PxcContactConvexHeightField + false, //PxcInvalidContactPair (hair) + false, //PxcContactGeometryCustomGeometry + }, + + //PxGeometryType::ePARTICLESYSTEM + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair (hair) + false, //PxcInvalidContactPair + }, + + //PxGeometryType::eTETRAHEDRONMESH + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair (hair) + false, //PxcInvalidContactPair + }, + + //PxGeometryType::eTRIANGLEMESH + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + true, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair (hair) + false, //PxcInvalidContactPair + }, + + //PxGeometryType::eHEIGHTFIELD + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + true, //- + false, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair (hair) + false, //PxcInvalidContactPair + }, + + //PxGeometryType::eHAIRSYSTEM + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + true, //- + false, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + }, + + //PxGeometryType::eCUSTOM + { + false, //- + false, //- + false, //- + false, //- + false, //- + false, //- + true, //- + false, //- + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + false, //PxcInvalidContactPair + }, + }; + PX_COMPILE_TIME_ASSERT(sizeof(g_CanUseContactCache) / sizeof(g_CanUseContactCache[0]) == PxGeometryType::eGEOMETRY_COUNT); +} + +static PX_FORCE_INLINE void updateContact( PxContactPoint& dst, const PxcLocalContactsCache& contactsData, + const PxMat34& world0, const PxMat34& world1, + const PxVec3& point, const PxVec3& normal, float separation) +{ + const PxVec3 tmp0 = contactsData.mTransform0.transformInv(point); + const PxVec3 worldpt0 = world0.transform(tmp0); + + const PxVec3 tmp1 = contactsData.mTransform1.transformInv(point); + const PxVec3 worldpt1 = world1.transform(tmp1); + + const PxVec3 motion = worldpt0 - worldpt1; + dst.normal = normal; + dst.point = (worldpt0 + worldpt1)*0.5f; + //dst.point = point; + dst.separation = separation + motion.dot(normal); +} + +static PX_FORCE_INLINE void prefetchData128(PxU8* PX_RESTRICT ptr, PxU32 size) +{ + // PT: always prefetch the cache line containing our address (which unfortunately won't be aligned to 128 most of the time) + PxPrefetchLine(ptr, 0); + // PT: compute start offset of our data within its cache line + const PxU32 startOffset = PxU32(size_t(ptr)&127); + // PT: prefetch next cache line if needed + if(startOffset+size>128) + PxPrefetchLine(ptr+128, 0); +} + +static PX_FORCE_INLINE PxU8* outputToCache(PxU8* PX_RESTRICT bytes, const PxVec3& v) +{ + *reinterpret_cast(bytes) = v; + return bytes + sizeof(PxVec3); +} + +static PX_FORCE_INLINE PxU8* outputToCache(PxU8* PX_RESTRICT bytes, PxReal v) +{ + *reinterpret_cast(bytes) = v; + return bytes + sizeof(PxReal); +} + +static PX_FORCE_INLINE PxU8* outputToCache(PxU8* PX_RESTRICT bytes, PxU32 v) +{ + *reinterpret_cast(bytes) = v; + return bytes + sizeof(PxU32); +} + +//PxU32 gContactCache_NbCalls = 0; +//PxU32 gContactCache_NbHits = 0; + +static PX_FORCE_INLINE PxReal maxComponentDeltaPos(const PxTransform& t0, const PxTransform& t1) +{ + PxReal delta = PxAbs(t0.p.x - t1.p.x); + delta = PxMax(delta, PxAbs(t0.p.y - t1.p.y)); + delta = PxMax(delta, PxAbs(t0.p.z - t1.p.z)); + return delta; +} + +static PX_FORCE_INLINE PxReal maxComponentDeltaRot(const PxTransform& t0, const PxTransform& t1) +{ + PxReal delta = PxAbs(t0.q.x - t1.q.x); + delta = PxMax(delta, PxAbs(t0.q.y - t1.q.y)); + delta = PxMax(delta, PxAbs(t0.q.z - t1.q.z)); + delta = PxMax(delta, PxAbs(t0.q.w - t1.q.w)); + return delta; +} + +bool physx::PxcCacheLocalContacts( PxcNpThreadContext& context, Cache& pairContactCache, + const PxTransform& tm0, const PxTransform& tm1, + const PxcContactMethod conMethod, + const PxGeometry& shape0, const PxGeometry& shape1) +{ + const NarrowPhaseParams& params = context.mNarrowPhaseParams; + +// gContactCache_NbCalls++; + + if(pairContactCache.mCachedData) + prefetchData128(pairContactCache.mCachedData, pairContactCache.mCachedSize); + + PxContactBuffer& contactBuffer = context.mContactBuffer; + contactBuffer.reset(); + + PxcLocalContactsCache contactsData; + PxU32 nbCachedBytes; + const PxU8* cachedBytes = PxcNpCacheRead2(pairContactCache, contactsData, nbCachedBytes); + + pairContactCache.mCachedData = NULL; + pairContactCache.mCachedSize = 0; + +#ifdef ENABLE_CONTACT_CACHE_STATS + gNbCalls++; +#endif + + const PxU32 payloadSize = (sizeof(PxcLocalContactsCache)+3)&~3; + + if(cachedBytes) + { + // PT: we used to store the relative TM but it's better to save memory and recompute it + const PxTransform t0to1 = tm1.transformInv(tm0); + const PxTransform relTM = contactsData.mTransform1.transformInv(contactsData.mTransform0); + + const PxReal epsilon = 0.01f; + if( maxComponentDeltaPos(t0to1, relTM)(cachedBytes); + const PxVec3* normal0 = NULL; + for(PxU32 i=0;i(contacts); contacts += sizeof(PxVec3); + normal0 = cachedNormal; + } + else + { + cachedNormal = normal0; + } + + const PxVec3* cachedPoint = reinterpret_cast(contacts); contacts += sizeof(PxVec3); + const PxReal* cachedPD = reinterpret_cast(contacts); contacts += sizeof(PxReal); + + updateContact(*dst, contactsData, world0, world1, *cachedPoint, *cachedNormal, *cachedPD); + + if(contactsData.mUseFaceIndices) + { + const PxU32* cachedIndex1 = reinterpret_cast(contacts); contacts += sizeof(PxU32); + + dst->internalFaceIndex1 = *cachedIndex1; + } + else + { + dst->internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX; + } + dst++; + } + } + if(ls) + PxcNpCacheWriteFinalize(ls, contactsData, nbCachedBytes, cachedBytes); +#ifdef ENABLE_CONTACT_CACHE_STATS + gNbHits++; +#endif + return true; + } + else + { + // PT: if we reach this point we cached the contacts but we couldn't use them next frame + // => waste of time and memory + } + } + + conMethod(shape0, shape1, tm0, tm1, params, pairContactCache, context.mContactBuffer, &context.mRenderOutput); + + //if(contactBuffer.count) + { + contactsData.mTransform0 = tm0; + contactsData.mTransform1 = tm1; + + PxU32 nbBytes = 0; + const PxU8* bytes = NULL; + const PxU32 count = contactBuffer.count; + if(count) + { + const bool useFaceIndices = contactBuffer.contacts[0].internalFaceIndex1!=PXC_CONTACT_NO_FACE_INDEX; + contactsData.mNbCachedContacts = PxTo16(count); + contactsData.mUseFaceIndices = useFaceIndices; + + const PxContactPoint* PX_RESTRICT srcContacts = contactBuffer.contacts; + // PT: this loop should not be here. We should output the contacts directly compressed, as we used to. + bool sameNormal = true; + { + const PxVec3 normal0 = srcContacts->normal; + for(PxU32 i=1;i(ls) = contactsData; + *reinterpret_cast(ls+payloadSize) = nbBytes; + bytes = ls+payloadSize+sizeof(PxU32); + PxU8* dest = const_cast(bytes); + for(PxU32 i=0;imMaterialIndex; + const PxU32 count = context.mContactBuffer.count; + PX_ASSERT(index==0 || index==1); + for(PxU32 i=0; imMaterialIndex; + const PxU16 materialIndex1 = shape1->mMaterialIndex; + const PxU32 count = context.mContactBuffer.count; + for(PxU32 i=0; i(meshGeom.triangleMesh)->getMaterials(); +} + +static void PxcGetMaterialMesh(const PxsShapeCore* shape, const PxU32 index, PxcNpThreadContext& context, PxsMaterialInfo* materialInfo) +{ + PX_ASSERT(index == 1); + PX_UNUSED(index); + const PxTriangleMeshGeometryLL& shapeMesh = shape->mGeometry.get(); + if(shapeMesh.materialsLL.numIndices <= 1) + { + PxcGetMaterialShape(shape, index, context, materialInfo); + } + else + { + PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* eaMaterialIndices = getMaterialIndicesLL(shapeMesh); + const PxU16* indices = shapeMesh.materialsLL.indices; + for(PxU32 i=0; igetTriangleMaterialIndex(contact.featureIndex1); + (&materialInfo[i].mMaterialIndex0)[index] = indices[localMaterialIndex]; + } + } +} + +static void PxcGetMaterialShapeMesh(const PxsShapeCore* shape0, const PxsShapeCore* shape1, PxcNpThreadContext& context, PxsMaterialInfo* materialInfo) +{ + const PxTriangleMeshGeometryLL& shapeMesh = shape1->mGeometry.get(); + if(shapeMesh.materialsLL.numIndices <= 1) + { + PxcGetMaterialShapeShape(shape0, shape1, context, materialInfo); + } + else + { + PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* eaMaterialIndices = getMaterialIndicesLL(shapeMesh); + const PxU16* indices = shapeMesh.materialsLL.indices; + const PxU16 materialIndex0 = shape0->mMaterialIndex; + for(PxU32 i=0; igetTriangleMaterialIndex(contact.featureIndex1); + materialInfo[i].mMaterialIndex1 = indices[localMaterialIndex]; + } + } +} + +static void PxcGetMaterialSoftBodyMesh(const PxsShapeCore* shape0, const PxsShapeCore* shape1, PxcNpThreadContext& context, PxsMaterialInfo* materialInfo) +{ + // PT: TODO: check this, it reads shape0 and labels it shapeMesh1? It's otherwise the same code as PxcGetMaterialShapeMesh ? + const PxTriangleMeshGeometryLL& shapeMesh1 = shape0->mGeometry.get(); + if (shapeMesh1.materialsLL.numIndices <= 1) + { + PxcGetMaterialShapeShape(shape0, shape1, context, materialInfo); + } + else + { + PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* eaMaterialIndices = getMaterialIndicesLL(shapeMesh1); + const PxU16* indices = shapeMesh1.materialsLL.indices; + const PxU16 materialIndex0 = shape0->mMaterialIndex; + for (PxU32 i = 0; igetTriangleMaterialIndex(contact.featureIndex1); + //contact.featureIndex1 = shapeMesh.materials.indices[localMaterialIndex]; + materialInfo[i].mMaterialIndex1 = indices[localMaterialIndex]; + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxU32 GetMaterialIndex(const Gu::HeightFieldData* hfData, PxU32 triangleIndex) +{ + const PxU32 sampleIndex = triangleIndex >> 1; + const bool isFirstTriangle = (triangleIndex & 0x1) == 0; + + //get sample + const PxHeightFieldSample* hf = &hfData->samples[sampleIndex]; + return isFirstTriangle ? hf->materialIndex0 : hf->materialIndex1; +} + +static void PxcGetMaterialHeightField(const PxsShapeCore* shape, const PxU32 index, PxcNpThreadContext& context, PxsMaterialInfo* materialInfo) +{ + PX_ASSERT(index == 1); + PX_UNUSED(index); + const PxHeightFieldGeometryLL& hfGeom = shape->mGeometry.get(); + if(hfGeom.materialsLL.numIndices <= 1) + { + PxcGetMaterialShape(shape, index, context, materialInfo); + } + else + { + const PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* materialIndices = hfGeom.materialsLL.indices; + + const Gu::HeightFieldData* hf = &static_cast(hfGeom.heightField)->getData(); + + for(PxU32 i=0; imGeometry.get(); + if(hfGeom.materialsLL.numIndices <= 1) + { + PxcGetMaterialShapeShape(shape0, shape1, context, materialInfo); + } + else + { + const PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* materialIndices = hfGeom.materialsLL.indices; + + const Gu::HeightFieldData* hf = &static_cast(hfGeom.heightField)->getData(); + + for(PxU32 i=0; imMaterialIndex; + //contact.featureIndex0 = shape0->materialIndex; + const PxU32 localMaterialIndex = GetMaterialIndex(hf, contact.internalFaceIndex1); + //contact.featureIndex1 = materialIndices[localMaterialIndex]; + PX_ASSERT(localMaterialIndexmGeometry.get(); + if (hfGeom.materialsLL.numIndices <= 1) + { + PxcGetMaterialShapeShape(shape0, shape1, context, materialInfo); + } + else + { + const PxContactBuffer& contactBuffer = context.mContactBuffer; + const PxU32 count = contactBuffer.count; + const PxU16* materialIndices = hfGeom.materialsLL.indices; + + const Gu::HeightFieldData* hf = &static_cast(hfGeom.heightField)->getData(); + + for(PxU32 i=0; imMaterialIndex; + //contact.featureIndex0 = shape0->materialIndex; + const PxU32 localMaterialIndex = GetMaterialIndex(hf, contact.internalFaceIndex1); + //contact.featureIndex1 = materialIndices[localMaterialIndex]; + PX_ASSERT(localMaterialIndexmSharedDataIndex, PxI32(contactSize))); + + if(context.mContactStreamPool->isOverflown()) + { + PX_WARN_ONCE("Contact buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + contactPoints = context.mContactStreamPool->mDataStream + context.mContactStreamPool->mDataStreamSize - index; + + const PxU32 patchIndex = PxU32(PxAtomicAdd(&context.mPatchStreamPool->mSharedDataIndex, PxI32(patchSize))); + + if(context.mPatchStreamPool->isOverflown()) + { + PX_WARN_ONCE("Patch buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + contactPatches = context.mPatchStreamPool->mDataStream + context.mPatchStreamPool->mDataStreamSize - patchIndex; + + if(forceSize) + { + index = PxU32(PxAtomicAdd(&context.mForceAndIndiceStreamPool->mSharedDataIndex, PxI32(forceSize))); + + if(context.mForceAndIndiceStreamPool->isOverflown()) + { + PX_WARN_ONCE("Force buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + forceBuffer = reinterpret_cast(context.mForceAndIndiceStreamPool->mDataStream + context.mForceAndIndiceStreamPool->mDataStreamSize - index); + } + + if(isOverflown) + { + contactPatches = NULL; + contactPoints = NULL; + forceBuffer = NULL; + cmOutput.nbContacts = cmOutput.nbPatches = 0; + } + else + { + PxMemCopy(contactPatches, oldPatches, patchSize); + PxMemCopy(contactPoints, oldContacts, contactSize); + if(isMeshType) + PxMemCopy(forceBuffer + cmOutput.nbContacts, oldForces + cmOutput.nbContacts, sizeof(PxU32) * cmOutput.nbContacts); + } + } + else + { + const PxU32 alignedOldSize = (oldSize + 0xf) & 0xfffffff0; + + PxU8* data = context.mContactBlockStream.reserve(alignedOldSize + forceSize); + if(forceSize) + forceBuffer = reinterpret_cast(data + alignedOldSize); + + contactPatches = data; + contactPoints = data + cmOutput.nbPatches * sizeof(PxContactPatch); + + PxMemCopy(data, oldPatches, oldSize); + if(isMeshType) + PxMemCopy(forceBuffer + cmOutput.nbContacts, oldForces + cmOutput.nbContacts, sizeof(PxU32) * cmOutput.nbContacts); + } + + if(forceSize) + PxMemZero(forceBuffer, forceSize); + + cmOutput.contactPatches= contactPatches; + cmOutput.contactPoints = contactPoints; + cmOutput.contactForces = forceBuffer; + } + + if(cache.mCachedSize) + { + if(cache.isMultiManifold()) + { + PX_ASSERT((cache.mCachedSize & 0xF) == 0); + PxU8* newData = context.mNpCacheStreamPair.reserve(cache.mCachedSize); + PX_ASSERT((reinterpret_cast(newData)& 0xF) == 0); + PxMemCopy(newData, & cache.getMultipleManifold(), cache.mCachedSize); + cache.setMultiManifold(newData); + } + else if(useContactCache) + { + //Copy cache information as well... + const PxU8* cachedData = cache.mCachedData; + PxU8* newData = context.mNpCacheStreamPair.reserve(PxU32(cache.mCachedSize + 0xf) & 0xfff0); + PxMemCopy(newData, cachedData, cache.mCachedSize); + cache.mCachedData = newData; + } + } + return ret; +} + +//ML: isMeshType is used in the GPU codepath. If the collision pair is mesh/heightfield vs primitives, we need to allocate enough memory for the mForceAndIndiceStreamPool in the threadContext. +static bool finishContacts(const PxcNpWorkUnit& input, PxsContactManagerOutput& npOutput, PxcNpThreadContext& threadContext, PxsMaterialInfo* PX_RESTRICT pMaterials, const bool isMeshType, PxU64 contextID) +{ + PX_UNUSED(contextID); + LOCAL_PROFILE_ZONE("finishContacts", contextID); + + PxContactBuffer& buffer = threadContext.mContactBuffer; + + PX_ASSERT((npOutput.statusFlag & PxsContactManagerStatusFlag::eTOUCH_KNOWN) != PxsContactManagerStatusFlag::eTOUCH_KNOWN); + PxU8 statusFlags = PxU16(npOutput.statusFlag & (~PxsContactManagerStatusFlag::eTOUCH_KNOWN)); + if(buffer.count) + statusFlags |= PxsContactManagerStatusFlag::eHAS_TOUCH; + else + statusFlags |= PxsContactManagerStatusFlag::eHAS_NO_TOUCH; + + npOutput.nbContacts = PxTo16(buffer.count); + + if(!buffer.count) + { + npOutput.statusFlag = statusFlags; + npOutput.nbContacts = 0; + npOutput.nbPatches = 0; + return true; + } + PX_ASSERT(buffer.count); + +#if PX_ENABLE_SIM_STATS + threadContext.mNbDiscreteContactPairsWithContacts++; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + npOutput.statusFlag = statusFlags; + + PxU32 contactForceByteSize = buffer.count * sizeof(PxReal); + + //Regardless of the flags, we need to now record the compressed contact stream + + PxU16 compressedContactSize; + + const bool createReports = + input.flags & PxcNpWorkUnitFlag::eOUTPUT_CONTACTS + || (input.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD); + + if((!isMeshType && !createReports)) + contactForceByteSize = 0; + + bool res = (writeCompressedContact(buffer.contacts, buffer.count, &threadContext, npOutput.nbContacts, npOutput.contactPatches, npOutput.contactPoints, compressedContactSize, + reinterpret_cast(npOutput.contactForces), contactForceByteSize, threadContext.mMaterialManager, ((input.flags & PxcNpWorkUnitFlag::eMODIFIABLE_CONTACT) != 0), + false, pMaterials, npOutput.nbPatches, 0, NULL, NULL, threadContext.mCreateAveragePoint, threadContext.mContactStreamPool, + threadContext.mPatchStreamPool, threadContext.mForceAndIndiceStreamPool, isMeshType) != 0); + + //handle buffer overflow + if(!npOutput.nbContacts) + { + PxU8 thisStatusFlags = PxU16(npOutput.statusFlag & (~PxsContactManagerStatusFlag::eTOUCH_KNOWN)); + thisStatusFlags |= PxsContactManagerStatusFlag::eHAS_NO_TOUCH; + + npOutput.statusFlag = thisStatusFlags; + npOutput.nbContacts = 0; + npOutput.nbPatches = 0; +#if PX_ENABLE_SIM_STATS + threadContext.mNbDiscreteContactPairsWithContacts--; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + } + return res; +} + +template +static PX_FORCE_INLINE bool checkContactsMustBeGenerated(PxcNpThreadContext& context, const PxcNpWorkUnit& input, Gu::Cache& cache, PxsContactManagerOutput& output, + const PxsCachedTransform* cachedTransform0, const PxsCachedTransform* cachedTransform1, + const bool flip, PxGeometryType::Enum type0, PxGeometryType::Enum type1) +{ + PX_ASSERT(cachedTransform0->transform.isSane() && cachedTransform1->transform.isSane()); + + //ML : if user doesn't raise the eDETECT_DISCRETE_CONTACT, we should not generate contacts + if(!(input.flags & PxcNpWorkUnitFlag::eDETECT_DISCRETE_CONTACT)) + return false; + + if(!(output.statusFlag & PxcNpWorkUnitStatusFlag::eDIRTY_MANAGER) && !(input.flags & PxcNpWorkUnitFlag::eMODIFIABLE_CONTACT)) + { + const PxU32 body0Dynamic = PxU32(input.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY0 | PxcNpWorkUnitFlag::eARTICULATION_BODY0 | PxcNpWorkUnitFlag::eSOFT_BODY)); + const PxU32 body1Dynamic = PxU32(input.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY1 | PxcNpWorkUnitFlag::eARTICULATION_BODY1 | PxcNpWorkUnitFlag::eSOFT_BODY)); + + const PxU32 active0 = PxU32(body0Dynamic && !cachedTransform0->isFrozen()); + const PxU32 active1 = PxU32(body1Dynamic && !cachedTransform1->isFrozen()); + + if(!(active0 || active1)) + { + if(flip) + PxSwap(type0, type1); + + const bool useContactCache = useContactCacheT ? context.mContactCache && g_CanUseContactCache[type0][type1] : false; + +#if PX_ENABLE_SIM_STATS + if(output.nbContacts) + context.mNbDiscreteContactPairsWithContacts++; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + const bool isMeshType = type1 > PxGeometryType::eCONVEXMESH; + copyBuffers(output, cache, context, useContactCache, isMeshType); + return false; + } + } + + output.statusFlag &= (~PxcNpWorkUnitStatusFlag::eDIRTY_MANAGER); + + const PxReal contactDist0 = context.mContactDistances[input.mTransformCache0]; + const PxReal contactDist1 = context.mContactDistances[input.mTransformCache1]; + //context.mNarrowPhaseParams.mContactDistance = shape0->contactOffset + shape1->contactOffset; + context.mNarrowPhaseParams.mContactDistance = contactDist0 + contactDist1; + + return true; +} + +template +static PX_FORCE_INLINE void discreteNarrowPhase(PxcNpThreadContext& context, const PxcNpWorkUnit& input, Gu::Cache& cache, PxsContactManagerOutput& output, PxU64 contextID) +{ + PxGeometryType::Enum type0 = static_cast(input.geomType0); + PxGeometryType::Enum type1 = static_cast(input.geomType1); + + const bool flip = (type1getTransformCache(input.mTransformCache0); + const PxsCachedTransform* cachedTransform1 = &context.mTransformCache->getTransformCache(input.mTransformCache1); + + if(!checkContactsMustBeGenerated(context, input, cache, output, cachedTransform0, cachedTransform1, flip, type0, type1)) + return; + + PxsShapeCore* shape0 = const_cast(input.shapeCore0); + PxsShapeCore* shape1 = const_cast(input.shapeCore1); + + if(flip) + { + PxSwap(type0, type1); + PxSwap(shape0, shape1); + PxSwap(cachedTransform0, cachedTransform1); + } + + PxsMaterialInfo materialInfo[PxContactBuffer::MAX_CONTACTS]; + + Gu::MultiplePersistentContactManifold& manifold = context.mTempManifold; + bool isMultiManifold = false; + + if(!useLegacyCodepath) + { + if(cache.isMultiManifold()) + { + //We are using a multi-manifold. This is cached in a reduced npCache... + isMultiManifold = true; + uintptr_t address = uintptr_t(&cache.getMultipleManifold()); + manifold.fromBuffer(reinterpret_cast(address)); + cache.setMultiManifold(&manifold); + } + else if(cache.isManifold()) + { + void* address = reinterpret_cast(&cache.getManifold()); + PxPrefetch(address); + PxPrefetch(address, 128); + PxPrefetch(address, 256); + } + } + + updateDiscreteContactStats(context, type0, type1); + + startContacts(output, context); + + const PxTransform* tm0 = &cachedTransform0->transform; + const PxTransform* tm1 = &cachedTransform1->transform; + PX_ASSERT(tm0->isSane() && tm1->isSane()); + + const PxGeometry& contactShape0 = shape0->mGeometry.getGeometry(); + const PxGeometry& contactShape1 = shape1->mGeometry.getGeometry(); + + if(useLegacyCodepath) + { + // PT: many cache misses here... + + PxPrefetchLine(shape1, 0); // PT: at least get rid of L2s for shape1 + + const PxcContactMethod conMethod = g_ContactMethodTable[type0][type1]; + PX_ASSERT(conMethod); + + const bool useContactCache = context.mContactCache && g_CanUseContactCache[type0][type1]; + if(useContactCache) + { + const bool status = PxcCacheLocalContacts(context, cache, *tm0, *tm1, conMethod, contactShape0, contactShape1); +#if PX_ENABLE_SIM_STATS + if(status) + context.mNbDiscreteContactPairsWithCacheHits++; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + PX_UNUSED(status); +#endif + } + else + { + LOCAL_PROFILE_ZONE("conMethod", contextID); + conMethod(contactShape0, contactShape1, *tm0, *tm1, context.mNarrowPhaseParams, cache, context.mContactBuffer, &context.mRenderOutput); + } + } + else + { + LOCAL_PROFILE_ZONE("conMethod", contextID); + const PxcContactMethod conMethod = g_PCMContactMethodTable[type0][type1]; + PX_ASSERT(conMethod); + + conMethod(contactShape0, contactShape1, *tm0, *tm1, context.mNarrowPhaseParams, cache, context.mContactBuffer, &context.mRenderOutput); + } + + const PxcGetMaterialMethod materialMethod = g_GetMaterialMethodTable[type0][type1]; + if(materialMethod) + { + LOCAL_PROFILE_ZONE("materialMethod", contextID); + materialMethod(shape0, shape1, context, materialInfo); + } + + if(flip) + { + LOCAL_PROFILE_ZONE("flipContacts", contextID); + flipContacts(context, materialInfo); + } + + if(!useLegacyCodepath) + { + if(isMultiManifold) + { + //Store the manifold back... + const PxU32 size = (sizeof(MultiPersistentManifoldHeader) + + manifold.mNumManifolds * sizeof(SingleManifoldHeader) + + manifold.mNumTotalContacts * sizeof(Gu::CachedMeshPersistentContact)); + + PxU8* buffer = context.mNpCacheStreamPair.reserve(size); + + PX_ASSERT((reinterpret_cast(buffer)& 0xf) == 0); + manifold.toBuffer(buffer); + cache.setMultiManifold(buffer); + cache.mCachedSize = PxTo16(size); + } + } + + const bool isMeshType = type1 > PxGeometryType::eCONVEXMESH; + finishContacts(input, output, context, materialInfo, isMeshType, contextID); +} + +void physx::PxcDiscreteNarrowPhase(PxcNpThreadContext& context, const PxcNpWorkUnit& input, Gu::Cache& cache, PxsContactManagerOutput& output, PxU64 contextID) +{ + LOCAL_PROFILE_ZONE("PxcDiscreteNarrowPhase", contextID); + discreteNarrowPhase(context, input, cache, output, contextID); +} + +void physx::PxcDiscreteNarrowPhasePCM(PxcNpThreadContext& context, const PxcNpWorkUnit& input, Gu::Cache& cache, PxsContactManagerOutput& output, PxU64 contextID) +{ + LOCAL_PROFILE_ZONE("PxcDiscreteNarrowPhasePCM", contextID); + discreteNarrowPhase(context, input, cache, output, contextID); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp new file mode 100644 index 0000000..7f8c876 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpCacheStreamPair.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxcNpCacheStreamPair.h" +#include "foundation/PxUserAllocated.h" +#include "PxcNpMemBlockPool.h" + +using namespace physx; + +void PxcNpCacheStreamPair::reset() +{ + mBlock = NULL; + mUsed = 0; +} + +PxcNpCacheStreamPair::PxcNpCacheStreamPair(PxcNpMemBlockPool& blockPool): + mBlockPool(blockPool), mBlock(NULL), mUsed(0) +{ +} + +// reserve can fail and return null. Read should never fail +PxU8* PxcNpCacheStreamPair::reserve(PxU32 size) +{ + size = (size+15)&~15; + + if(size>PxcNpMemBlock::SIZE) + { + return reinterpret_cast(-1); + } + + if(mBlock == NULL || mUsed + size > PxcNpMemBlock::SIZE) + { + mBlock = mBlockPool.acquireNpCacheBlock(); + mUsed = 0; + } + + PxU8* ptr; + if(mBlock == NULL) + ptr = 0; + else + { + ptr = mBlock->data+mUsed; + mUsed += size; + } + + return ptr; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp new file mode 100644 index 0000000..8b50d7a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpContactPrepShared.cpp @@ -0,0 +1,546 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxPreprocessor.h" +#include "PxcNpWorkUnit.h" +#include "PxvDynamics.h" + +using namespace physx; +using namespace Gu; + +#include "PxsMaterialManager.h" +#include "PxsMaterialCombiner.h" + +#include "PxcNpContactPrepShared.h" +#include "foundation/PxAtomic.h" +#include "PxsContactManagerState.h" + +#include "foundation/PxVecMath.h" +#include "foundation/PxErrors.h" +using namespace physx; +using namespace aos; + +static PX_FORCE_INLINE void copyContactPoint(PxContact* PX_RESTRICT point, const PxContactPoint* PX_RESTRICT cp) +{ + // PT: TODO: consider moving "separation" right after "point" in both structures, to copy both at the same time. +// point->contact = cp->point; + const Vec4V contactV = V4LoadA(&cp->point.x); // PT: V4LoadA safe because 'point' is aligned. + V4StoreU(contactV, &point->contact.x); + + point->separation = cp->separation; +} + +static void combineMaterials(const PxsMaterialManager* materialManager, PxU16 origMatIndex0, PxU16 origMatIndex1, PxReal& staticFriction, PxReal& dynamicFriction, PxReal& combinedRestitution, PxU32& materialFlags, + PxReal& combinedDamping) +{ + const PxsMaterialData& data0 = *materialManager->getMaterial(origMatIndex0); + const PxsMaterialData& data1 = *materialManager->getMaterial(origMatIndex1); + + combinedRestitution = PxsCombineRestitution(data0, data1); + + combinedDamping = PxMax(data0.damping, data1.damping); + + PxsCombineIsotropicFriction(data0, data1, dynamicFriction, staticFriction, materialFlags); +} + +struct StridePatch +{ + PxU8 startIndex; + PxU8 endIndex; + PxU8 nextIndex; + PxU8 totalCount; + bool isRoot; +}; + +PxU32 physx::writeCompressedContact(const PxContactPoint* const PX_RESTRICT contactPoints, const PxU32 numContactPoints, PxcNpThreadContext* threadContext, + PxU16& writtenContactCount, PxU8*& outContactPatches, PxU8*& outContactPoints, PxU16& compressedContactSize, PxReal*& outContactForces, PxU32 contactForceByteSize, + const PxsMaterialManager* materialManager, bool hasModifiableContacts, bool forceNoResponse, PxsMaterialInfo* PX_RESTRICT pMaterial, PxU8& numPatches, + PxU32 additionalHeaderSize, PxsConstraintBlockManager* manager, PxcConstraintBlockStream* blockStream, bool insertAveragePoint, + PxcDataStreamPool* contactStreamPool, PxcDataStreamPool* patchStreamPool, PxcDataStreamPool* forceStreamPool, const bool isMeshType) +{ + if(numContactPoints == 0) + { + writtenContactCount = 0; + outContactPatches = NULL; + outContactPoints = NULL; + outContactForces = NULL; + compressedContactSize = 0; + numPatches = 0; + return 0; + } + + //Calculate the size of the contact buffer... + PX_ALLOCA(strPatches, StridePatch, numContactPoints); + + StridePatch* stridePatches = &strPatches[0]; + + PxU32 numStrideHeaders = 1; + + /*const bool hasInternalFaceIndex = contactPoints[0].internalFaceIndex0 != PXC_CONTACT_NO_FACE_INDEX || + contactPoints[0].internalFaceIndex1 != PXC_CONTACT_NO_FACE_INDEX;*/ + const bool isModifiable = !forceNoResponse && hasModifiableContacts; + + PxU32 totalUniquePatches = 1; + + PxU32 totalContactPoints = numContactPoints; + + PxU32 strideStart = 0; + bool root = true; + StridePatch* parentRootPatch = NULL; + { + const PxReal closeNormalThresh = PXC_SAME_NORMAL; + //Go through and tag how many patches we have... + PxVec3 normal = contactPoints[0].normal; + PxU16 mat0 = pMaterial[0].mMaterialIndex0; + PxU16 mat1 = pMaterial[0].mMaterialIndex1; + + for(PxU32 a = 1; a < numContactPoints; ++a) + { + if(normal.dot(contactPoints[a].normal) < closeNormalThresh || + pMaterial[a].mMaterialIndex0 != mat0 || pMaterial[a].mMaterialIndex1 != mat1) + { + StridePatch& patch = stridePatches[numStrideHeaders-1]; + + patch.startIndex = PxU8(strideStart); + patch.endIndex = PxU8(a); + patch.nextIndex = 0xFF; + patch.totalCount = PxU8(a - strideStart); + patch.isRoot = root; + if(parentRootPatch) + parentRootPatch->totalCount += PxU8(a - strideStart); + + root = true; + parentRootPatch = NULL; + for(PxU32 b = 1; b < numStrideHeaders; ++b) + { + StridePatch& thisPatch = stridePatches[b-1]; + if(thisPatch.isRoot) + { + PxU32 ind = thisPatch.startIndex; + PxReal dp2 = contactPoints[a].normal.dot(contactPoints[ind].normal); + if(dp2 >= closeNormalThresh && pMaterial[a].mMaterialIndex0 == pMaterial[ind].mMaterialIndex0 && + pMaterial[a].mMaterialIndex1 == pMaterial[ind].mMaterialIndex1) + { + PxU32 nextInd = b-1; + while(stridePatches[nextInd].nextIndex != 0xFF) + nextInd = stridePatches[nextInd].nextIndex; + stridePatches[nextInd].nextIndex = PxU8(numStrideHeaders); + root = false; + parentRootPatch = &stridePatches[b-1]; + break; + } + } + } + + normal = contactPoints[a].normal; + + mat0 = pMaterial[a].mMaterialIndex0; + mat1 = pMaterial[a].mMaterialIndex1; + totalContactPoints = insertAveragePoint && (a - strideStart) > 1 ? totalContactPoints + 1 : totalContactPoints; + strideStart = a; + numStrideHeaders++; + if(root) + totalUniquePatches++; + } + } + totalContactPoints = insertAveragePoint &&(numContactPoints - strideStart) > 1 ? totalContactPoints + 1 : totalContactPoints; + contactForceByteSize = insertAveragePoint && contactForceByteSize != 0 ? contactForceByteSize + sizeof(PxF32) * (totalContactPoints - numContactPoints) : contactForceByteSize; + } + { + StridePatch& patch = stridePatches[numStrideHeaders-1]; + patch.startIndex = PxU8(strideStart); + patch.endIndex = PxU8(numContactPoints); + patch.nextIndex = 0xFF; + patch.totalCount = PxU8(numContactPoints - strideStart); + patch.isRoot = root; + if(parentRootPatch) + parentRootPatch->totalCount += PxU8(numContactPoints - strideStart); + } + + numPatches = PxU8(totalUniquePatches); + + //Calculate the number of patches/points required + + const PxU32 patchHeaderSize = sizeof(PxContactPatch) * (isModifiable ? totalContactPoints : totalUniquePatches) + additionalHeaderSize; + const PxU32 pointSize = totalContactPoints * (isModifiable ? sizeof(PxModifiableContact) : sizeof(PxContact)); + + PxU32 requiredContactSize = pointSize; + PxU32 requiredPatchSize = patchHeaderSize; + PxU32 totalRequiredSize; + + PxU8* PX_RESTRICT contactData = NULL; + PxU8* PX_RESTRICT patchData = NULL; + PxReal* PX_RESTRICT forceData = NULL; + PxU32* PX_RESTRICT triangleIndice = NULL; + + if(contactStreamPool && !isModifiable && additionalHeaderSize == 0) //If the contacts are modifiable, we **DON'T** allocate them in GPU pinned memory. This will be handled later when they're modified + { + bool isOverflown = false; + + PxU32 contactIndex = PxU32(PxAtomicAdd(&contactStreamPool->mSharedDataIndex, PxI32(requiredContactSize))); + + if (contactStreamPool->isOverflown()) + { + PX_WARN_ONCE("Contact buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + + contactData = contactStreamPool->mDataStream + contactStreamPool->mDataStreamSize - contactIndex; + + PxU32 patchIndex = PxU32(PxAtomicAdd(&patchStreamPool->mSharedDataIndex, PxI32(requiredPatchSize))); + + if (patchStreamPool->isOverflown()) + { + PX_WARN_ONCE("Patch buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + + patchData = patchStreamPool->mDataStream + patchStreamPool->mDataStreamSize - patchIndex; + + if(contactForceByteSize) + { + contactForceByteSize = isMeshType ? contactForceByteSize * 2 : contactForceByteSize; + contactIndex = PxU32(PxAtomicAdd(&forceStreamPool->mSharedDataIndex, PxI32(contactForceByteSize))); + + if (forceStreamPool->isOverflown()) + { + PX_WARN_ONCE("Force buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + forceData = reinterpret_cast(forceStreamPool->mDataStream + forceStreamPool->mDataStreamSize - contactIndex); + if (isMeshType) + triangleIndice = reinterpret_cast(forceData + numContactPoints); + } + + totalRequiredSize = requiredContactSize + requiredPatchSize; + + if (isOverflown) + { + patchData = NULL; + contactData = NULL; + forceData = NULL; + triangleIndice = NULL; + } + } + else + { + PxU32 alignedRequiredSize = (requiredContactSize + requiredPatchSize + 0xf) & 0xfffffff0; + contactForceByteSize = (isMeshType ? contactForceByteSize * 2 : contactForceByteSize); + PxU32 totalSize = alignedRequiredSize + contactForceByteSize; + PxU8* data = manager ? blockStream->reserve(totalSize, *manager) : threadContext->mContactBlockStream.reserve(totalSize); + + patchData = data; + contactData = patchData + requiredPatchSize; + + if(contactForceByteSize) + { + forceData = reinterpret_cast((data + alignedRequiredSize)); + + if (isMeshType) + triangleIndice = reinterpret_cast(forceData + numContactPoints); + + if(data) + { + PxMemZero(forceData, contactForceByteSize); + } + } + + totalRequiredSize = alignedRequiredSize; + + } + + PxPrefetchLine(patchData); + PxPrefetchLine(contactData); + + if(patchData == NULL) + { + writtenContactCount = 0; + outContactPatches = NULL; + outContactPoints = NULL; + outContactForces = NULL; + compressedContactSize = 0; + numPatches = 0; + return 0; + } + +#if PX_ENABLE_SIM_STATS + if(threadContext) + { + threadContext->mCompressedCacheSize += totalRequiredSize; + threadContext->mTotalCompressedCacheSize += totalRequiredSize; + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + compressedContactSize = PxTo16(totalRequiredSize); + + + + //PxU32 startIndex = 0; + + //Extract first material + PxU16 origMatIndex0 = pMaterial[0].mMaterialIndex0; + PxU16 origMatIndex1 = pMaterial[0].mMaterialIndex1; + + PxReal staticFriction, dynamicFriction, combinedRestitution, combinedDamping; + PxU32 materialFlags; + combineMaterials(materialManager, origMatIndex0, origMatIndex1, staticFriction, dynamicFriction, combinedRestitution, materialFlags, combinedDamping); + + PxU8* PX_RESTRICT dataPlusOffset = patchData + additionalHeaderSize; + PxContactPatch* PX_RESTRICT patches = reinterpret_cast(dataPlusOffset); + PxU32* PX_RESTRICT faceIndice = triangleIndice; + + outContactPatches = patchData; + outContactPoints = contactData; + outContactForces = forceData; + + if(isModifiable) + { + + PxU32 flags = PxU32(isModifiable ? PxContactPatch::eMODIFIABLE : 0) | + (forceNoResponse ? PxContactPatch::eFORCE_NO_RESPONSE : 0) | + (isMeshType ? PxContactPatch::eHAS_FACE_INDICES : 0); + + PxU32 currentIndex = 0; + + PxModifiableContact* PX_RESTRICT point = reinterpret_cast(contactData); + + for(PxU32 a = 0; a < numStrideHeaders; ++a) + { + StridePatch& rootPatch = stridePatches[a]; + if(rootPatch.isRoot) + { + PxContactPatch* PX_RESTRICT patch = patches++; + + PxU32 startIndex = rootPatch.startIndex; + + const PxU16 matIndex0 = pMaterial[startIndex].mMaterialIndex0; + const PxU16 matIndex1 = pMaterial[startIndex].mMaterialIndex1; + if(matIndex0 != origMatIndex0 || matIndex1 != origMatIndex1) + { + combineMaterials(materialManager, matIndex0, matIndex1, staticFriction, dynamicFriction, combinedRestitution, materialFlags, combinedDamping); + + origMatIndex0 = matIndex0; + origMatIndex1 = matIndex1; + } + + patch->nbContacts = rootPatch.totalCount; + + patch->startContactIndex = PxTo8(currentIndex); + patch->materialFlags = PxU8(materialFlags); + patch->staticFriction = staticFriction; + patch->dynamicFriction = dynamicFriction; + patch->restitution = combinedRestitution; + patch->damping = combinedDamping; + patch->materialIndex0 = matIndex0; + patch->materialIndex1 = matIndex1; + patch->normal = contactPoints[0].normal; + patch->mMassModification.mInvMassScale0 = 1.0f; + patch->mMassModification.mInvMassScale1 = 1.0f; + patch->mMassModification.mInvInertiaScale0 = 1.0f; + patch->mMassModification.mInvInertiaScale1 = 1.0f; + patch->internalFlags = PxU8(flags); + + //const PxU32 endIndex = strideHeader[a]; + const PxU32 totalCountThisPatch = rootPatch.totalCount; + if(insertAveragePoint && totalCountThisPatch > 1) + { + PxVec3 avgPt(0.0f); + PxF32 avgPen(0.0f); + PxF32 recipCount = 1.0f/(PxF32(rootPatch.totalCount)); + + PxU32 index = a; + while(index != 0xFF) + { + StridePatch& p = stridePatches[index]; + for(PxU32 b = p.startIndex; b < p.endIndex; ++b) + { + avgPt += contactPoints[b].point; + avgPen += contactPoints[b].separation; + } + index = p.nextIndex; + } + + if (faceIndice) + { + StridePatch& p = stridePatches[index]; + *faceIndice = contactPoints[p.startIndex].internalFaceIndex1; + faceIndice++; + } + + patch->nbContacts++; + point->contact = avgPt * recipCount; + point->separation = avgPen * recipCount; + point->normal = contactPoints[0].normal; + point->maxImpulse = PX_MAX_REAL; + point->targetVelocity = PxVec3(0.0f); + point->staticFriction = staticFriction; + point->dynamicFriction = dynamicFriction; + point->restitution = combinedRestitution; + point->materialFlags = materialFlags; + point->materialIndex0 = matIndex0; + point->materialIndex1 = matIndex1; + point++; + currentIndex++; + PxPrefetchLine(point, 128); + } + + PxU32 index = a; + while(index != 0xFF) + { + StridePatch& p = stridePatches[index]; + + for(PxU32 b = p.startIndex; b < p.endIndex; ++b) + { + copyContactPoint(point, &contactPoints[b]); + point->normal = contactPoints[b].normal; + point->maxImpulse = PX_MAX_REAL; + point->targetVelocity = PxVec3(0.0f); + point->staticFriction = staticFriction; + point->dynamicFriction = dynamicFriction; + point->restitution = combinedRestitution; + point->materialFlags = materialFlags; + point->materialIndex0 = matIndex0; + point->materialIndex1 = matIndex1; + if (faceIndice) + { + *faceIndice = contactPoints[b].internalFaceIndex1; + faceIndice++; + } + point++; + currentIndex++; + PxPrefetchLine(point, 128); + } + index = p.nextIndex; + } + } + } + } + else + { + PxU32 flags = PxU32(isMeshType ? PxContactPatch::eHAS_FACE_INDICES : 0); + + PxContact* PX_RESTRICT point = reinterpret_cast(contactData); + + PxU32 currentIndex = 0; + { + for(PxU32 a = 0; a < numStrideHeaders; ++a) + { + StridePatch& rootPatch = stridePatches[a]; + + if(rootPatch.isRoot) + { + const PxU16 matIndex0 = pMaterial[rootPatch.startIndex].mMaterialIndex0; + const PxU16 matIndex1 = pMaterial[rootPatch.startIndex].mMaterialIndex1; + if(matIndex0 != origMatIndex0 || matIndex1 != origMatIndex1) + { + combineMaterials(materialManager, matIndex0, matIndex1, staticFriction, dynamicFriction, combinedRestitution, materialFlags, combinedDamping); + + origMatIndex0 = matIndex0; + origMatIndex1 = matIndex1; + } + + PxContactPatch* PX_RESTRICT patch = patches++; + patch->normal = contactPoints[rootPatch.startIndex].normal; + PX_ASSERT(PxAbs(patch->normal.magnitude() - 1) < 1e-3f); + patch->nbContacts = rootPatch.totalCount; + patch->startContactIndex = PxTo8(currentIndex); + //KS - we could probably compress this further into the header but the complexity might not be worth it + patch->staticFriction = staticFriction; + patch->dynamicFriction = dynamicFriction; + patch->restitution = combinedRestitution; + patch->damping = combinedDamping; + patch->materialIndex0 = matIndex0; + patch->materialIndex1 = matIndex1; + patch->materialFlags = PxU8(materialFlags); + patch->internalFlags = PxU8(flags); + patch->mMassModification.mInvMassScale0 = 1.0f; + patch->mMassModification.mInvMassScale1 = 1.0f; + patch->mMassModification.mInvInertiaScale0 = 1.0f; + patch->mMassModification.mInvInertiaScale1 = 1.0f; + if(insertAveragePoint && (rootPatch.totalCount) > 1) + { + patch->nbContacts++; + PxVec3 avgPt(0.0f); + PxF32 avgPen(0.0f); + PxF32 recipCount = 1.0f/(PxF32(rootPatch.totalCount)); + PxU32 index = a; + + while(index != 0xFF) + { + StridePatch& p = stridePatches[index]; + for(PxU32 b = p.startIndex; b < p.endIndex; ++b) + { + avgPt += contactPoints[b].point; + avgPen += contactPoints[b].separation; + } + index = stridePatches[index].nextIndex; + } + + if (faceIndice) + { + StridePatch& p = stridePatches[index]; + *faceIndice = contactPoints[p.startIndex].internalFaceIndex1; + faceIndice++; + } + point->contact = avgPt * recipCount; + point->separation = avgPen * recipCount; + + point++; + currentIndex++; + PxPrefetchLine(point, 128); + } + + PxU32 index = a; + while(index != 0xFF) + { + StridePatch& p = stridePatches[index]; + for(PxU32 b = p.startIndex; b < p.endIndex; ++b) + { + copyContactPoint(point, &contactPoints[b]); + if (faceIndice) + { + *faceIndice = contactPoints[b].internalFaceIndex1; + faceIndice++; + } + point++; + currentIndex++; + PxPrefetchLine(point, 128); + } + index = stridePatches[index].nextIndex; + } + } + } + } + } + + writtenContactCount = PxTo16(totalContactPoints); + + return totalRequiredSize; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp new file mode 100644 index 0000000..a43dab3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpMemBlockPool.cpp @@ -0,0 +1,346 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxMath.h" +#include "PxcNpMemBlockPool.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxInlineArray.h" +#include "PxcScratchAllocator.h" + +using namespace physx; + +PxcNpMemBlockPool::PxcNpMemBlockPool(PxcScratchAllocator& allocator): + mConstraints("PxcNpMemBlockPool::mConstraints"), + mExceptionalConstraints("PxcNpMemBlockPool::mExceptionalConstraints"), + mNpCacheActiveStream(0), + mFrictionActiveStream(0), + mCCDCacheActiveStream(0), + mContactIndex(0), + mAllocatedBlocks(0), + mMaxBlocks(0), + mUsedBlocks(0), + mMaxUsedBlocks(0), + mScratchBlockAddr(0), + mNbScratchBlocks(0), + mScratchAllocator(allocator), + mPeakConstraintAllocations(0), + mConstraintAllocations(0) +{ +} + +void PxcNpMemBlockPool::init(PxU32 initialBlockCount, PxU32 maxBlocks) +{ + mMaxBlocks = maxBlocks; + mInitialBlocks = initialBlockCount; + + PxU32 reserve = PxMax(initialBlockCount, 64); + + mConstraints.reserve(reserve); + mExceptionalConstraints.reserve(16); + + mFriction[0].reserve(reserve); + mFriction[1].reserve(reserve); + mNpCache[0].reserve(reserve); + mNpCache[1].reserve(reserve); + mUnused.reserve(reserve); + + setBlockCount(initialBlockCount); +} + +PxU32 PxcNpMemBlockPool::getUsedBlockCount() const +{ + return mUsedBlocks; +} + +PxU32 PxcNpMemBlockPool::getMaxUsedBlockCount() const +{ + return mMaxUsedBlocks; +} + +PxU32 PxcNpMemBlockPool::getPeakConstraintBlockCount() const +{ + return mPeakConstraintAllocations; +} + +void PxcNpMemBlockPool::setBlockCount(PxU32 blockCount) +{ + PxMutex::ScopedLock lock(mLock); + PxU32 current = getUsedBlockCount(); + for(PxU32 i=current;i(PX_ALLOC(PxcNpMemBlock::SIZE, "PxcNpMemBlock"))); + mAllocatedBlocks++; + } +} + +void PxcNpMemBlockPool::releaseUnusedBlocks() +{ + PxMutex::ScopedLock lock(mLock); + while(mUnused.size()) + { + PxcNpMemBlock* ptr = mUnused.popBack(); + PX_FREE(ptr); + mAllocatedBlocks--; + } +} + +PxcNpMemBlockPool::~PxcNpMemBlockPool() +{ + // swapping twice guarantees all blocks are released from the stream pairs + swapFrictionStreams(); + swapFrictionStreams(); + + swapNpCacheStreams(); + swapNpCacheStreams(); + + releaseConstraintMemory(); + releaseContacts(); + releaseContacts(); + + PX_ASSERT(mUsedBlocks == 0); + + flushUnused(); +} + +void PxcNpMemBlockPool::acquireConstraintMemory() +{ + PxU32 size; + void* addr = mScratchAllocator.allocAll(size); + size = size&~(PxcNpMemBlock::SIZE-1); + + PX_ASSERT(mScratchBlocks.size()==0); + mScratchBlockAddr = reinterpret_cast(addr); + mNbScratchBlocks = size/PxcNpMemBlock::SIZE; + + mScratchBlocks.resize(mNbScratchBlocks); + for(PxU32 i=0;i0); + mUsedBlocks--; + } + } + + for(PxU32 i=0;i0) + { + PxcNpMemBlock* block = mScratchBlocks.popBack(); + trackingArray.pushBack(block); + return block; + } + + if(mUnused.size()) + { + PxcNpMemBlock* block = mUnused.popBack(); + trackingArray.pushBack(block); + mMaxUsedBlocks = PxMax(mUsedBlocks+1, mMaxUsedBlocks); + mUsedBlocks++; + return block; + } + + if(mAllocatedBlocks == mMaxBlocks) + { +#if PX_CHECKED + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Reached maximum number of allocated blocks so 16k block allocation will fail!"); +#endif + return NULL; + } + +#if PX_CHECKED + if(mInitialBlocks) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Number of required 16k memory blocks has exceeded the initial number of blocks. Allocator is being called. Consider increasing the number of pre-allocated 16k blocks."); + } +#endif + + // increment here so that if we hit the limit in separate threads we won't overallocated + mAllocatedBlocks++; + + PxcNpMemBlock* block = reinterpret_cast(PX_ALLOC(sizeof(PxcNpMemBlock), "PxcNpMemBlock")); + + if(block) + { + trackingArray.pushBack(block); + mMaxUsedBlocks = PxMax(mUsedBlocks+1, mMaxUsedBlocks); + mUsedBlocks++; + } + else + mAllocatedBlocks--; + + return block; +} + +PxU8* PxcNpMemBlockPool::acquireExceptionalConstraintMemory(PxU32 size) +{ + PxU8* memory = reinterpret_cast(PX_ALLOC(size, "PxcNpExceptionalMemory")); + if(memory) + { + PxMutex::ScopedLock lock(mLock); + mExceptionalConstraints.pushBack(memory); + } + return memory; +} + +void PxcNpMemBlockPool::release(PxcNpMemBlockArray& deadArray, PxU32* allocationCount) +{ + PxMutex::ScopedLock lock(mLock); + PX_ASSERT(mUsedBlocks >= deadArray.size()); + mUsedBlocks -= deadArray.size(); + if(allocationCount) + { + *allocationCount -= deadArray.size(); + } + while(deadArray.size()) + { + PxcNpMemBlock* block = deadArray.popBack(); + for(PxU32 a = 0; a < mUnused.size(); ++a) + { + PX_ASSERT(mUnused[a] != block); + } + mUnused.pushBack(block); + } +} + +void PxcNpMemBlockPool::flushUnused() +{ + while(mUnused.size()) + { + PxcNpMemBlock* ptr = mUnused.popBack(); + PX_FREE(ptr); + } +} + +PxcNpMemBlock* PxcNpMemBlockPool::acquireConstraintBlock() +{ + // we track the scratch blocks in the constraint block array, because the code in acquireMultipleConstraintBlocks + // assumes that acquired blocks are listed there. + + return acquire(mConstraints); +} + +PxcNpMemBlock* PxcNpMemBlockPool::acquireConstraintBlock(PxcNpMemBlockArray& memBlocks) +{ + return acquire(memBlocks, &mConstraintAllocations, &mPeakConstraintAllocations, true); +} + +PxcNpMemBlock* PxcNpMemBlockPool::acquireContactBlock() +{ + return acquire(mContacts[mContactIndex], NULL, NULL, true); +} + +void PxcNpMemBlockPool::releaseConstraintBlocks(PxcNpMemBlockArray& memBlocks) +{ + PxMutex::ScopedLock lock(mLock); + + while(memBlocks.size()) + { + PxcNpMemBlock* block = memBlocks.popBack(); + if(mScratchAllocator.isScratchAddr(block)) + mScratchBlocks.pushBack(block); + else + { + mUnused.pushBack(block); + PX_ASSERT(mUsedBlocks>0); + mUsedBlocks--; + } + } +} + +void PxcNpMemBlockPool::releaseContacts() +{ + //releaseConstraintBlocks(mContacts); + release(mContacts[1-mContactIndex]); + mContactIndex = 1-mContactIndex; +} + +PxcNpMemBlock* PxcNpMemBlockPool::acquireFrictionBlock() +{ + return acquire(mFriction[mFrictionActiveStream]); +} + +void PxcNpMemBlockPool::swapFrictionStreams() +{ + release(mFriction[1-mFrictionActiveStream]); + mFrictionActiveStream = 1-mFrictionActiveStream; +} + +PxcNpMemBlock* PxcNpMemBlockPool::acquireNpCacheBlock() +{ + return acquire(mNpCache[mNpCacheActiveStream]); +} + +void PxcNpMemBlockPool::swapNpCacheStreams() +{ + release(mNpCache[1-mNpCacheActiveStream]); + mNpCacheActiveStream = 1-mNpCacheActiveStream; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp new file mode 100644 index 0000000..4420262 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/common/src/pipeline/PxcNpThreadContext.cpp @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxcConstraintBlockStream.h" +#include "PxcNpThreadContext.h" + +using namespace physx; + +PxcNpThreadContext::PxcNpThreadContext(PxcNpContext* params) : + mRenderOutput (params->mRenderBuffer), + mContactBlockStream (params->mNpMemBlockPool), + mNpCacheStreamPair (params->mNpMemBlockPool), + mNarrowPhaseParams (0.0f, params->mMeshContactMargin, params->mToleranceLength), + mBodySimPool ("BodySimPool"), + mPCM (false), + mContactCache (false), + mCreateAveragePoint (false), +#if PX_ENABLE_SIM_STATS + mCompressedCacheSize (0), + mNbDiscreteContactPairsWithCacheHits(0), + mNbDiscreteContactPairsWithContacts (0), +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + mMaxPatches (0), + mTotalCompressedCacheSize (0), + mContactStreamPool (params->mContactStreamPool), + mPatchStreamPool (params->mPatchStreamPool), + mForceAndIndiceStreamPool (params->mForceAndIndiceStreamPool), + mMaterialManager (params->mMaterialManager), + mLocalNewTouchCount (0), + mLocalLostTouchCount (0) +{ +#if PX_ENABLE_SIM_STATS + clearStats(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + +PxcNpThreadContext::~PxcNpThreadContext() +{ +} + +#if PX_ENABLE_SIM_STATS +void PxcNpThreadContext::clearStats() +{ + PxMemSet(mDiscreteContactPairs, 0, sizeof(mDiscreteContactPairs)); + PxMemSet(mModifiedContactPairs, 0, sizeof(mModifiedContactPairs)); + mCompressedCacheSize = 0; + mNbDiscreteContactPairsWithCacheHits = 0; + mNbDiscreteContactPairsWithContacts = 0; +} +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + +void PxcNpThreadContext::reset(PxU32 cmCount) +{ + mContactBlockStream.reset(); + mNpCacheStreamPair.reset(); + + mLocalChangeTouch.clear(); + mLocalChangeTouch.resize(cmCount); + mLocalNewTouchCount = 0; + mLocalLostTouchCount = 0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsCCD.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsCCD.h new file mode 100644 index 0000000..5b750de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsCCD.h @@ -0,0 +1,604 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxGeometry.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "GuCCDSweepConvexMesh.h" +#include "PxsIslandSim.h" + +#ifndef PXS_CCD_H +#define PXS_CCD_H + +#define CCD_DEBUG_PRINTS 0 +#define CCD_POST_DEPENETRATE_DIST 0.001f +#define CCD_ROTATION_LOCKING 0 +#define CCD_MIN_TIME_LEFT 0.01f + +#define DEBUG_RENDER_CCD 0 + +#if CCD_DEBUG_PRINTS +namespace physx { + extern void printCCDDebug(const char* msg, const PxsRigidBody* atom0, PxGeometryType::Enum g0, bool printPtr = true); + extern void printShape(PxsRigidBody* atom0, PxGeometryType::Enum g0, const char* annotation, PxReal dt, PxU32 pass, bool printPtr = true); +} +#define PRINTCCDSHAPE(x) printShape x +#define PRINTCCDDEBUG(x) printCCDDebug x +#else +#define PRINTCCDSHAPE(x) +#define PRINTCCDDEBUG(x) +#endif + +namespace physx +{ + float computeCCDThreshold(const PxGeometry& geometry); + +// ------------------------------------------------------------------------------------------------------------ +// a fraction of objects will be CCD active so this is dynamic, not a member of PsxRigidBody +// CCD code builds a temporary array of PxsCCDPair objects (allocated in blocks) +// this is done to gather scattered data from memory and also to reduce PxsRidigBody permanent memory footprint +// we have to do it every pass since new CMs can become fast moving after each pass (and sometimes cease to be) +// +struct PxsCCDBody; +class PxsRigidBody; +struct PxsShapeCore; +struct PxsRigidCore; +class PxsContactManager; +class PxsContext; +class PxCCDContactModifyCallback; +class PxcNpThreadContext; + +class PxvNphaseImplementationContext; + +namespace Dy +{ + class ThresholdStream; +} + +/** +\brief structure to represent interactions between a given body and another body. +*/ +struct PxsCCDOverlap +{ + //The body the interaction relates to + PxsCCDBody* mBody; + //The next interaction in the list + PxsCCDOverlap* mNext; +}; + +/** +\brief Temporary CCD representation for a shape. + +Stores data about a shape that may be frequently used in CCD. It also stores update counters per-shape that can be compared with the body's update +counter to determine if the shape needs its transforms re-calculated. This avoids us needing to store a list of shapes in a CCD body. +*/ +struct PxsCCDShape : public Gu::CCDShape +{ +public: + const PxsShapeCore* mShapeCore; //Shape core (can be shared) + const PxsRigidCore* mRigidCore; //Rigid body core + PxNodeIndex mNodeIndex; + + /** + \brief Returns the world-space pose for this shape + \param[in] atom The rigid body that this CCD shape is associated with + */ + PxTransform getAbsPose(const PxsRigidBody* atom) const; + /** + \brief Returns the world-space previous pose for this shape + \param[in] atom The rigid body that this CCD shape is associated with + */ + PxTransform getLastCCDAbsPose(const PxsRigidBody* atom) const; +}; + +/** +\brief Structure to represent a body in the CCD system. +*/ +struct PxsCCDBody +{ + Cm::SpatialVector mPreSolverVelocity; + PxU16 mIndex; //The CCD body's index + bool mPassDone; //Whether it has been processed in the current CCD pass + bool mHasAnyPassDone; //Whether this body was influenced by any passes + PxReal mTimeLeft; //CCD time left to elapse (normalized in range 0-1) + PxsRigidBody* mBody; //The rigid body + PxsCCDOverlap* mOverlappingObjects; //A list of overlapping bodies for island update + PxU32 mUpdateCount; //How many times this body has eben updated in the CCD. This is correlated with CCD shapes' update counts. + PxU32 mNbInteractionsThisPass; //How many interactions this pass + + /** + \brief Returns the CCD body's index. + \return The CCD body's index. + */ + PX_FORCE_INLINE PxU32 getIndex() const { return mIndex; } + + /** + \brief Tests whether this body has already registered an overlap with a given body. + \param[in] body The body to test against. + \return Whether this body has already registered an overlap with a given body. + */ + bool overlaps(PxsCCDBody* body) const + { + PxsCCDOverlap* overlaps = mOverlappingObjects; + + while(overlaps) + { + if(overlaps->mBody == body) + return true; + overlaps = overlaps->mNext; + } + return false; + } + + /** + \brief Registers an overlap with a given body + \param[in] overlap The CCD overlap to register. + */ + void addOverlap(PxsCCDOverlap* overlap) + { + overlap->mNext = mOverlappingObjects; + mOverlappingObjects = overlap; + } + +}; + +/** +\brief a container class used in the CCD that minimizes frequency of hitting the allocator. + +This class stores a set of blocks of memory. It is effectively an array that resizes more efficiently because it doesn't need to +reallocate an entire buffer and copy data. +*/ +template +struct PxsCCDBlockArray +{ + /** + \brief A block of data + */ + struct Block : PxUserAllocated { T items[BLOCK_SIZE]; }; + /** + \brief A header for a block of data. + */ + struct BlockInfo + { + Block* block; + PxU32 count; // number of elements in this block + BlockInfo(Block* aBlock, PxU32 aCount) : block(aBlock), count(aCount) {} + }; + /* + \brief An array of block headers + */ + PxArray blocks; + /** + \brief The current block. + */ + PxU32 currentBlock; + + /** + \brief Constructor + */ + PxsCCDBlockArray() : currentBlock(0) + { + blocks.pushBack(BlockInfo(PX_NEW(Block), 0)); + } + + /** + \brief Destructor + */ + ~PxsCCDBlockArray() + { + for (PxU32 i = 0; i < blocks.size(); i++) + { + PX_DELETE(blocks[i].block); + } + currentBlock = 0; + } + + /** + \brief Clears this block array. + \note This clear function also deletes all additional blocks + */ + void clear() + { + for (PxU32 i = 0; i < blocks.size(); i++) + { + PX_DELETE(blocks[i].block); + } + blocks.clear(); + blocks.pushBack(BlockInfo(PX_NEW(Block), 0)); // at least one block is expected to always be present in the array + currentBlock = 0; + } + + /** + \brief Clears this block array but does not release the memory. + */ + void clear_NoDelete() + { + currentBlock = 0; + blocks[0].count = 0; + } + + /** + \brief Push a new element onto the back of the block array + \return The new element + */ + T& pushBack() + { + PxU32 numBlocks = blocks.size(); + if (blocks[currentBlock].count == BLOCK_SIZE) + { + if((currentBlock + 1) == numBlocks) + { + blocks.pushBack(BlockInfo(PX_NEW(Block), 0)); + numBlocks ++; + } + currentBlock++; + blocks[currentBlock].count = 0; + } + const PxU32 count = blocks[currentBlock].count ++; + + return blocks[currentBlock].block->items[count]; + } + + /** + \brief Pushes a new element onto the back of this array, intitializing it to match the data + \param data The data to initialize the new element to + \return The new element + */ + T& pushBack(T& data) + { + PxU32 numBlocks = blocks.size(); + if (blocks[currentBlock].count == BLOCK_SIZE) + { + if((currentBlock + 1) == numBlocks) + { + blocks.pushBack(BlockInfo(PX_NEW(Block), 0)); + numBlocks ++; + } + currentBlock++; + blocks[currentBlock].count = 0; + } + const PxU32 count = blocks[currentBlock].count ++; + blocks[currentBlock].block->items[count] = data; + return blocks[currentBlock].block->items[count]; + } + + /** + \brief Pops the last element from the list. + */ + void popBack() + { + PX_ASSERT(blocks[currentBlock].count > 0); + if (blocks[currentBlock].count > 1) + blocks[currentBlock].count --; + else + { + PX_DELETE(blocks[currentBlock].block); + blocks.popBack(); + currentBlock--; + } + } + + /** + \brief Returns the current size of the array. + \return The current size of the array. + */ + PxU32 size() const + { + return (currentBlock)*BLOCK_SIZE + blocks[currentBlock].count; + } + + /** + \brief Returns the element at a given index in the array + \param[in] index The index of the element in the array + \return The element at a given index in the array. + */ + T& operator[] (PxU32 index) const + { + PX_ASSERT(index/BLOCK_SIZE < blocks.size()); + PX_ASSERT(index%BLOCK_SIZE < blocks[index/BLOCK_SIZE].count); + return blocks[index/BLOCK_SIZE].block->items[index%BLOCK_SIZE]; + } +}; + +/** +\brief A structure to represent a potential CCD interaction between a pair of shapes +*/ +struct PxsCCDPair +{ + /** + \brief Defines whether this is an estimated TOI or an accurate TOI. + + We store pairs in a priority queue based on the TOIs. We use cheap estimates to cull away work and lazily evaluate TOIs. This means that an element in the + priority queue may either be an estimate or a precise result. + */ + enum E_TOIType + { + eEstimate, + ePrecise + }; + PxsRigidBody* mBa0; // Body A. Can be NULL for statics + PxsRigidBody* mBa1; // Body B. Can be NULL for statics + PxsCCDShape* mCCDShape0; // Shape A + PxsCCDShape* mCCDShape1; // Shape B + PxVec3 mMinToiNormal; // The contact normal. Only valid for precise results. On the surface of body/shape A + PxReal mMinToi; // Min TOI. Valid for both precise and estimated results but estimates may be too early (i.e. conservative). + PxReal mPenetrationPostStep; // Valid only for precise sweeps. Only used for initial intersections (i.e. at TOI = 0). + PxVec3 mMinToiPoint; // The contact point. Only valid for precise sweep results. + PxReal mPenetration; // The penetration. Only valid for precise sweep results. + PxsContactManager* mCm; // The contact manager. + PxU32 mIslandId; // The index of the island this pair is in + PxGeometryType::Enum mG0, mG1; // The geometry types for shapes 0 and 1 + bool mIsEarliestToiHit; // Indicates this was the earliest hit for one of the bodies in the pair + bool mIsModifiable; // Indicates whether this contact is modifiable + PxU32 mFaceIndex; // The face index. Only valid for precise sweeps involving meshes or heightfields. + PxU16 mMaterialIndex0; // The material index for shape 0 + PxU16 mMaterialIndex1; // The material index for shape 1 + PxReal mDynamicFriction; // The dynamic friction coefficient + PxReal mStaticFriction; // The static friction coefficient + PxReal mRestitution; // The restitution coefficient + PxU32 mEstimatePass; // The current estimation pass. Used after a sweep hit was found to determine if the pair needs re-estimating. + PxReal mAppliedForce; // The applied force for this pair. Only valid if the pair has been responded to. + PxReal mMaxImpulse; // The maximum impulse to be applied + + E_TOIType mToiType; // The TOI type (estimate, precise). + bool mHasFriction; // Whether we want to simulate CCD friction for this pair + + /** + \brief Perform a precise sweep for this pair + \param[in] threadContext The per-thread context + \param[in] dt The time-step + \param[in] pass The current CCD pass + \return The normalized TOI. <=1.0 indicates a hit. Otherwise PX_MAX_REAL. + */ + PxReal sweepFindToi(PxcNpThreadContext& threadContext, PxReal dt, PxU32 pass, PxReal ccdThreshold); + /** + \brief Performs a sweep estimation for this pair + \return The normalized TOI. <= 1.0 indicates a potential hit, otherwise PX_MAX_REAL. + */ + PxReal sweepEstimateToi(PxReal ccdThreshold); + /** + \brief Advances this pair to the TOI + \param[in] dt The time-step + \param[in] clipTrajectoryToToi Indicates whether we clip the body's trajectory to the end pose. Only done in the final pass + \return Whether the advance was successful. An advance will be unsuccessful if body bodies were already updated. + */ + bool sweepAdvanceToToi(PxReal dt, bool clipTrajectoryToToi); + /** + \brief Updates the transforms of the shapes involved in this pair. + */ + void updateShapes(); +}; + +/** +\brief Block array of CCD bodies +*/ +typedef PxsCCDBlockArray PxsCCDBodyArray; +/** +\brief Block array of CCD pairs +*/ +typedef PxsCCDBlockArray PxsCCDPairArray; +/** +\brief Block array of CCD overlaps +*/ +typedef PxsCCDBlockArray PxsCCDOverlapArray; +/** +\brief Block array of CCD shapes +*/ +typedef PxsCCDBlockArray PxsCCDShapeArray; + +/** +\brief Pair structure to be able to look-up a rigid body-shape pair in a map +*/ +typedef PxPair PxsRigidShapePair; + +/** +\brief CCD context object. +*/ +class PxsCCDContext : public PxUserAllocated +{ +public: + /** + \brief Constructor for PxsCCDContext + \param[in] context The PxsContext that is associated with this PxsCCDContext. + */ + PxsCCDContext(PxsContext* context, Dy::ThresholdStream& thresholdStream, PxvNphaseImplementationContext& nPhaseContext, PxReal ccdThreshold); + /** + \brief Destructor for PxsCCDContext + */ + ~PxsCCDContext(); + + /** + \brief Returns the CCD contact modification callback + \return The CCD contact modification callback + */ + PX_FORCE_INLINE PxCCDContactModifyCallback* getCCDContactModifyCallback() const { return mCCDContactModifyCallback; } + /** + \brief Sets the CCD contact modification callback + \param[in] c The CCD contact modification callback + */ + PX_FORCE_INLINE void setCCDContactModifyCallback(PxCCDContactModifyCallback* c) { mCCDContactModifyCallback = c; } + /** + \brief Returns the maximum number of CCD passes + \return The maximum number of CCD passes + */ + PX_FORCE_INLINE PxU32 getCCDMaxPasses() const { return mCCDMaxPasses; } + /** + \brief Sets the maximum number of CCD passes + \param[in] ccdMaxPasses The maximum number of CCD passes + */ + PX_FORCE_INLINE void setCCDMaxPasses(PxU32 ccdMaxPasses) { mCCDMaxPasses = ccdMaxPasses; } + /** + \brief Returns the current CCD pass + \return The current CCD pass + */ + PX_FORCE_INLINE PxU32 getCurrentCCDPass() const { return miCCDPass; } + /** + \brief Returns The number of swept hits reported + \return The number of swept hits reported + */ + PX_FORCE_INLINE PxI32 getNumSweepHits() const { return mSweepTotalHits; } + /** + \brief Returns The number of updated bodies + \return The number of updated bodies in this CCD pass + */ + PX_FORCE_INLINE PxU32 getNumUpdatedBodies() const { return mUpdatedCCDBodies.size(); } + /** + \brief Returns The update bodies array + \return The updated bodies array from this CCD pass + */ + PX_FORCE_INLINE PxsRigidBody*const* getUpdatedBodies() const { return mUpdatedCCDBodies.begin(); } + + /** + \brief Returns Clears the updated bodies array + */ + PX_FORCE_INLINE void clearUpdatedBodies() { mUpdatedCCDBodies.forceSize_Unsafe(0); } + + PX_FORCE_INLINE PxReal getCCDThreshold() const { return mCCDThreshold; } + PX_FORCE_INLINE void setCCDThreshold(PxReal t) { mCCDThreshold = t; } + + /** + \brief Runs the CCD contact modification. + \param[in] contacts The list of modifiable contacts + \param[in] contactCount The number of contacts + \param[in] shapeCore0 The first shape core + \param[in] shapeCore1 The second shape core + \param[in] rigidCore0 The first rigid core + \param[in] rigidCore1 The second rigid core + \param[in] rigid0 The first rigid body + \param[in] rigid1 The second rigid body + */ + void runCCDModifiableContact(PxModifiableContact* PX_RESTRICT contacts, PxU32 contactCount, const PxsShapeCore* PX_RESTRICT shapeCore0, + const PxsShapeCore* PX_RESTRICT shapeCore1, const PxsRigidCore* PX_RESTRICT rigidCore0, const PxsRigidCore* PX_RESTRICT rigidCore1, + const PxsRigidBody* PX_RESTRICT rigid0, const PxsRigidBody* PX_RESTRICT rigid1); + + /** + \brief Performs a single CCD update + This occurs after broad phase and is responsible for creating islands, finding the TOI of collisions, filtering contacts, issuing modification callbacks and responding to + collisions. At the end of this phase all bodies will have stepper to their first TOI if they were involved in a CCD collision this frame. + \param[in] dt The timestep to simulate + \param[in] continuation The continuation task + \param[in] islandSim The island manager + \param[in] disableResweep If this is true, we perform a reduced-fidelity CCD approach + */ + void updateCCD(PxReal dt, PxBaseTask* continuation, IG::IslandSim& islandSim, bool disableResweep, PxI32 numFastMovingShapes); + + /** + \brief Signals the beginning of a CCD multi-pass update + */ + void updateCCDBegin(); + + /** + \brief Resets the CCD contact state in any contact managers that previously had a reported CCD touch. This must be called if CCD update is bypassed for a frame + */ + void resetContactManagers(); + +private: + + /** + \brief Verifies the consistency of the CCD context at the beginning + */ + void verifyCCDBegin(); + + /** + \brief Cleans up after the CCD update has completed + */ + void updateCCDEnd(); + + /** + \brief Spawns the update island tasks after the initial sweep estimates have been performed + \param[in] continuation The continuation task + */ + void postCCDSweep(PxBaseTask* continuation); + /** + \brief Creates contact buffers for CCD contacts. These will be sent to the user in the contact notification. + \param[in] continuation The continuation task + */ + void postCCDAdvance(PxBaseTask* continuation); + /** + \brief The final phase of the CCD task chain. Cleans up after the parallel update/postCCDAdvance stages. + \param[in] continuation The continuation task + */ + void postCCDDepenetrate(PxBaseTask* continuation); + + typedef Cm::DelegateTask PostCCDSweepTask; + typedef Cm::DelegateTask PostCCDAdvanceTask; + typedef Cm::DelegateTask PostCCDDepenetrateTask; + + PostCCDSweepTask mPostCCDSweepTask; + PostCCDAdvanceTask mPostCCDAdvanceTask; + PostCCDDepenetrateTask mPostCCDDepenetrateTask; + + PxCCDContactModifyCallback* mCCDContactModifyCallback; + + // CCD global data + bool mDisableCCDResweep; + PxU32 miCCDPass; + PxI32 mSweepTotalHits; + + // a fraction of objects will be CCD active so PxsCCDBody is dynamic, not a member of PxsRigidBody + PxsCCDBodyArray mCCDBodies; + PxsCCDOverlapArray mCCDOverlaps; + PxsCCDShapeArray mCCDShapes; + PxArray mIslandBodies; + PxArray mIslandSizes; + PxArray mUpdatedCCDBodies; + PxHashMap mMap; + + // temporary array updated during CCD update + //Array mCCDPairs; + PxsCCDPairArray mCCDPairs; + PxArray mCCDPtrPairs; + // number of pairs per island + PxArray mCCDIslandHistogram; + // thread context valid during CCD update + PxcNpThreadContext* mCCDThreadContext; + // number of pairs to process per thread + PxU32 mCCDPairsPerBatch; + PxU32 mCCDMaxPasses; + + PxsContext* mContext; + Dy::ThresholdStream& mThresholdStream; + + PxvNphaseImplementationContext& mNphaseContext; + + PxMutex mMutex; + + PxReal mCCDThreshold; + +private: + + PX_NOCOPY(PxsCCDContext) +}; + + +} + + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManager.h new file mode 100644 index 0000000..070f295 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManager.h @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_CONTACT_MANAGER_H +#define PXS_CONTACT_MANAGER_H + +#include "PxvConfig.h" +#include "PxcNpWorkUnit.h" + +namespace physx +{ +class PxsContext; +class PxsRigidBody; + +namespace Dy +{ + class DynamicsContext; +} + +namespace Sc +{ + class ShapeInteraction; +} + +/** +\brief Additional header structure for CCD contact data stream. +*/ +struct PxsCCDContactHeader +{ + /** + \brief Stream for next collision. The same pair can collide multiple times during multiple CCD passes. + */ + PxsCCDContactHeader* nextStream; //4 //8 + /** + \brief Size (in bytes) of the CCD contact stream (not including force buffer) + */ + PxU16 contactStreamSize; //6 //10 + /** + \brief Defines whether the stream is from a previous pass. + + It could happen that the stream can not get allocated because we run out of memory. In that case the current event should not use the stream + from an event of the previous pass. + */ + PxU16 isFromPreviousPass; //8 //12 + + PxU8 pad[12 - sizeof(PxsCCDContactHeader*)]; //16 +}; + +PX_COMPILE_TIME_ASSERT((sizeof(PxsCCDContactHeader) & 0xF) == 0); + +class PxsContactManager +{ +public: + PxsContactManager(PxsContext* context, PxU32 index); + ~PxsContactManager(); + + PX_FORCE_INLINE void setDisableStrongFriction(PxU32 d) { (!d) ? mNpUnit.flags &= ~PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION + : mNpUnit.flags |= PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION; } + + PX_FORCE_INLINE PxReal getRestDistance() const { return mNpUnit.restDistance; } + PX_FORCE_INLINE void setRestDistance(PxReal v) { mNpUnit.restDistance = v; } + + PX_FORCE_INLINE PxU8 getDominance0() const { return mNpUnit.dominance0; } + PX_FORCE_INLINE void setDominance0(PxU8 v) { mNpUnit.dominance0 = v; } + + PX_FORCE_INLINE PxU8 getDominance1() const { return mNpUnit.dominance1; } + PX_FORCE_INLINE void setDominance1(PxU8 v) { mNpUnit.dominance1 = v; } + + PX_FORCE_INLINE PxU16 getTouchStatus() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_TOUCH); } + PX_FORCE_INLINE PxU16 touchStatusKnown() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eTOUCH_KNOWN); } + PX_FORCE_INLINE PxI32 getTouchIdx() const { return (mNpUnit.statusFlags& PxcNpWorkUnitStatusFlag::eHAS_TOUCH) ? 1 : (mNpUnit.statusFlags& PxcNpWorkUnitStatusFlag::eHAS_NO_TOUCH ? -1 : 0); } + + PX_FORCE_INLINE PxU32 getIndex() const { return mNpUnit.index; } + + PX_FORCE_INLINE PxU16 getHasCCDRetouch() const { return PxU16(mNpUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH); } + PX_FORCE_INLINE void clearCCDRetouch() { mNpUnit.statusFlags &= ~PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH; } + PX_FORCE_INLINE void raiseCCDRetouch() { mNpUnit.statusFlags |= PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH; } + + // flags stuff - needs to be refactored + + PX_FORCE_INLINE PxIntBool isChangeable() const { return PxIntBool(mFlags & PXS_CM_CHANGEABLE); } + PX_FORCE_INLINE PxIntBool getCCD() const { return PxIntBool((mFlags & PXS_CM_CCD_LINEAR) && (mNpUnit.flags & PxcNpWorkUnitFlag::eDETECT_CCD_CONTACTS)); } + PX_FORCE_INLINE PxIntBool getHadCCDContact() const { return PxIntBool(mFlags & PXS_CM_CCD_CONTACT); } + PX_FORCE_INLINE void setHadCCDContact() { mFlags |= PXS_CM_CCD_CONTACT; } + void setCCD(bool enable); + PX_FORCE_INLINE void clearCCDContactInfo() { mFlags &= ~PXS_CM_CCD_CONTACT; mNpUnit.ccdContacts = NULL; } + + PX_FORCE_INLINE PxcNpWorkUnit& getWorkUnit() { return mNpUnit; } + PX_FORCE_INLINE const PxcNpWorkUnit& getWorkUnit() const { return mNpUnit; } + + PX_FORCE_INLINE Sc::ShapeInteraction* getShapeInteraction() const { return mShapeInteraction; } + + // Setup solver-constraints + PX_FORCE_INLINE void resetCachedState() + { + // happens when the body transform or shape relative transform changes. + mNpUnit.clearCachedState(); + } +private: + //KS - moving this up - we want to get at flags + + PxsRigidBody* mRigidBody0; //4 //8 + PxsRigidBody* mRigidBody1; //8 //16 + PxU32 mFlags; //20 //36 + Sc::ShapeInteraction* mShapeInteraction; //16 //32 + + friend class PxsContext; + // everything required for narrow phase to run + PxcNpWorkUnit mNpUnit; + enum + { + PXS_CM_CHANGEABLE = (1<<0), + PXS_CM_CCD_LINEAR = (1<<1), + PXS_CM_CCD_CONTACT = (1 << 2) + }; + + friend class Dy::DynamicsContext; + friend struct PxsCCDPair; + friend class PxsIslandManager; + friend class PxsCCDContext; + friend class Sc::ShapeInteraction; + //friend class Sc::SoftBodyShapeInteraction; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManagerState.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManagerState.h new file mode 100644 index 0000000..5bbad06 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContactManagerState.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_CONTACT_MANAGER_STATE_H +#define PXS_CONTACT_MANAGER_STATE_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ + + struct PxsShapeCore; + + /** + There is an implicit 1:1 mapping between PxgContactManagerInput and PxsContactManagerOutput. The structures are split because PxgNpContactManagerInput contains constant + data that is produced by the CPU code and PxgNpContactManagerOutput contains per-frame contact information produced by the NP. + + There is also a 1:1 mapping between the PxgNpContactManager and PxsContactManager. This mapping is handled within the PxgNPhaseCore. + + The previous contact states are implicitly cached in PxsContactManager and will be propagated to the solver. Friction correlation is also done implicitly using cached + information in PxsContactManager. + The NP will produce a list of pairs that found/lost patches for the solver along with updating the PxgNpContactManagerOutput for all pairs. + */ + + struct PxsContactManagerStatusFlag + { + enum Enum + { + eHAS_NO_TOUCH = (1 << 0), + eHAS_TOUCH = (1 << 1), + //eHAS_SOLVER_CONSTRAINTS = (1 << 2), + eREQUEST_CONSTRAINTS = (1 << 3), + eHAS_CCD_RETOUCH = (1 << 4), // Marks pairs that are touching at a CCD pass and were touching at discrete collision or at a previous CCD pass already + // but we can not tell whether they lost contact in a pass before. We send them as pure eNOTIFY_TOUCH_CCD events to the + // contact report callback if requested. + eDIRTY_MANAGER = (1 << 5), + eTOUCH_KNOWN = eHAS_NO_TOUCH | eHAS_TOUCH, // The touch status is known (if narrowphase never ran for a pair then no flag will be set) + eSTATIC_OR_KINEMATIC = (1 << 6) + }; + }; + + + struct PX_ALIGN_PREFIX(16) PxsContactManagerOutput + { + PxU8* contactPatches; //Start index/ptr for contact patches + PxU8* contactPoints; //Start index/ptr for contact points + PxReal* contactForces; //Start index/ptr for contact forces + PxU8 allflagsStart; //padding for compatibility with existing code + PxU8 nbPatches; //Num patches + PxU8 statusFlag; //Status flag (has touch etc.) + PxU8 prevPatches; //Previous number of patches + PxU16 nbContacts; //Num contacts + PxU16 flags; //Not really part of outputs, but we have 4 bytes of padding, so why not? +#if PX_X86 + PxU32 pad[3]; +#endif + + PX_FORCE_INLINE PxU32* getInternalFaceIndice() + { + return reinterpret_cast(contactForces + nbContacts); + } + } + PX_ALIGN_SUFFIX(16); + + struct PX_ALIGN_PREFIX(4) PxsContactManagerOutputCounts + { + PxU8 nbPatches; //Num patches + PxU8 prevPatches; //Previous number of patches + PxU8 statusFlag; //Status flag; + PxU8 unused; //Unused + } PX_ALIGN_SUFFIX(4); + + struct PX_ALIGN_PREFIX(4) PxsContactManagerPersistency + { + PxU8 mPrevPatches; + PxU8 mNbFrictionPatches; + PxU8 mNbPrevFrictionPatches; + PxU8 pad; + } PX_ALIGN_SUFFIX(4); + + struct PX_ALIGN_PREFIX(8) PxsTorsionalFrictionData + { + PxReal mTorsionalPatchRadius; + PxReal mMinTorsionalRadius; + + PxsTorsionalFrictionData() {} + PxsTorsionalFrictionData(const PxReal patchRadius, const PxReal minPatchRadius) : + mTorsionalPatchRadius(patchRadius), mMinTorsionalRadius(minPatchRadius) {} + } PX_ALIGN_SUFFIX(8); + +} + +#endif //PXG_CONTACT_MANAGER_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContext.h new file mode 100644 index 0000000..ea33e7b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsContext.h @@ -0,0 +1,319 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_CONTEXT_H +#define PXS_CONTEXT_H + +#include "foundation/PxPinnedArray.h" +#include "PxVisualizationParameter.h" +#include "PxSceneDesc.h" + +#include "common/PxRenderOutput.h" + +#include "CmPool.h" + +#include "PxvNphaseImplementationContext.h" +#include "PxvSimStats.h" +#include "PxsContactManager.h" +#include "PxcNpBatch.h" +#include "PxcConstraintBlockStream.h" +#include "PxcNpCacheStreamPair.h" +#include "PxcNpMemBlockPool.h" +#include "CmUtils.h" +#include "CmTask.h" + +#include "PxContactModifyCallback.h" + +#include "PxsTransformCache.h" +#include "GuPersistentContactManifold.h" + +#if PX_SUPPORT_GPU_PHYSX +namespace physx +{ + class PxCudaContextManager; +} +#endif + +namespace physx +{ +class PxsRigidBody; +struct PxcConstraintBlock; +class PxsMaterialManager; +class PxsCCDContext; +struct PxsContactManagerOutput; +struct PxvContactManagerTouchEvent; + +namespace Cm +{ + class FlushPool; +} + +namespace IG +{ + class SimpleIslandManager; + typedef PxU32 EdgeIndex; +} + +enum PxsTouchEventCount +{ + PXS_LOST_TOUCH_COUNT, + PXS_NEW_TOUCH_COUNT, + PXS_CCD_RETOUCH_COUNT, // pairs that are touching at a CCD pass and were touching at discrete collision or at a previous CCD pass already + // (but they could have lost touch in between) + PXS_TOUCH_EVENT_COUNT +}; + +class PxsContext : public PxUserAllocated, public PxcNpContext +{ + PX_NOCOPY(PxsContext) +public: + PxsContext( const PxSceneDesc& desc, PxTaskManager*, Cm::FlushPool&, + PxCudaContextManager*, const PxU32 poolSlabSize, PxU64 contextID); + ~PxsContext(); + + void createTransformCache(PxVirtualAllocatorCallback& allocatorCallback); + + PxsContactManager* createContactManager(PxsContactManager* contactManager, const bool useCCD); + void createCache(Gu::Cache& cache, PxGeometryType::Enum geomType0, PxGeometryType::Enum geomType1); + void destroyCache(Gu::Cache& cache); + void destroyContactManager(PxsContactManager* cm); + + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + + // Collision properties + PX_FORCE_INLINE PxContactModifyCallback* getContactModifyCallback() const { return mContactModifyCallback; } + PX_FORCE_INLINE void setContactModifyCallback(PxContactModifyCallback* c) { mContactModifyCallback = c; mNpImplementationContext->setContactModifyCallback(c);} + + + // resource-related + void setScratchBlock(void* addr, PxU32 size); + + PX_FORCE_INLINE void setContactDistance(const PxFloatArrayPinned* contactDistances) { mContactDistances = contactDistances; } + + // Task-related + void updateContactManager(PxReal dt, bool hasBoundsArrayChanged, bool hasContactDistanceChanged, PxBaseTask* continuation, + PxBaseTask* firstPassContinuation, Cm::FanoutTask* updateBoundAndShapeTask); + void secondPassUpdateContactManager(PxReal dt, PxBaseTask* continuation); + void fetchUpdateContactManager(); + void swapStreams(); + + void resetThreadContexts(); + + // Manager status change + bool getManagerTouchEventCount(int* newTouch, int* lostTouch, int* ccdTouch) const; + bool fillManagerTouchEvents( + PxvContactManagerTouchEvent* newTouch, PxI32& newTouchCount, + PxvContactManagerTouchEvent* lostTouch, PxI32& lostTouchCount, + PxvContactManagerTouchEvent* ccdTouch, PxI32& ccdTouchCount); + + bool fillManagerTouchEvents2( + PxvContactManagerTouchEvent* newTouch, PxI32& newTouchCount, + PxvContactManagerTouchEvent* lostTouch, PxI32& lostTouchCount, + PxvContactManagerTouchEvent* ccdTouch, PxI32& ccdTouchCount); + + void beginUpdate(); + + // PX_ENABLE_SIM_STATS + PX_FORCE_INLINE PxvSimStats& getSimStats() { return mSimStats; } + PX_FORCE_INLINE const PxvSimStats& getSimStats() const { return mSimStats; } + + PX_FORCE_INLINE Cm::FlushPool& getTaskPool() const { return mTaskPool; } + PX_FORCE_INLINE PxRenderBuffer& getRenderBuffer() { return mRenderBuffer; } + + PX_FORCE_INLINE PxReal getRenderScale() const { return mVisualizationParams[PxVisualizationParameter::eSCALE]; } + PX_FORCE_INLINE PxReal getVisualizationParameter(PxVisualizationParameter::Enum param) const + { + PX_ASSERT(param < PxVisualizationParameter::eNUM_VALUES); + + return mVisualizationParams[param]; + } + + PX_FORCE_INLINE void setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) + { + PX_ASSERT(param < PxVisualizationParameter::eNUM_VALUES); + PX_ASSERT(value >= 0.0f); + + mVisualizationParams[param] = value; + } + + PX_FORCE_INLINE void setVisualizationCullingBox(const PxBounds3& box) { mVisualizationCullingBox = box; } + PX_FORCE_INLINE const PxBounds3& getVisualizationCullingBox() const { return mVisualizationCullingBox; } + + PX_FORCE_INLINE bool getPCM() const { return mPCM; } + PX_FORCE_INLINE bool getContactCacheFlag() const { return mContactCache; } + PX_FORCE_INLINE bool getCreateAveragePoint() const { return mCreateAveragePoint; } + + // general stuff + void shiftOrigin(const PxVec3& shift); + + PX_FORCE_INLINE void setPCM(bool enabled) { mPCM = enabled; } + PX_FORCE_INLINE void setContactCache(bool enabled) { mContactCache = enabled; } + + PX_FORCE_INLINE PxcScratchAllocator& getScratchAllocator() { return mScratchAllocator; } + PX_FORCE_INLINE PxsTransformCache& getTransformCache() { return *mTransformCache; } + PX_FORCE_INLINE const PxReal* getContactDistances() const { return mContactDistances->begin(); } + + PX_FORCE_INLINE PxvNphaseImplementationContext* getNphaseImplementationContext() const { return mNpImplementationContext; } + PX_FORCE_INLINE void setNphaseImplementationContext(PxvNphaseImplementationContext* ctx) { mNpImplementationContext = ctx; } + + PX_FORCE_INLINE PxvNphaseImplementationContext* getNphaseFallbackImplementationContext() const { return mNpFallbackImplementationContext; } + PX_FORCE_INLINE void setNphaseFallbackImplementationContext(PxvNphaseImplementationContext* ctx) { mNpFallbackImplementationContext = ctx; } + + PxU32 getTotalCompressedContactSize() const { return mTotalCompressedCacheSize; } + PxU32 getMaxPatchCount() const { return mMaxPatches; } + + PX_FORCE_INLINE PxcThreadCoherentCache& getNpThreadContextPool() { return mNpThreadContextPool; } + + PX_FORCE_INLINE PxcNpThreadContext* getNpThreadContext() + { + // We may want to conditional compile to exclude this on single threaded implementations + // if it is determined to be a performance hit. + return mNpThreadContextPool.get(); + } + + PX_FORCE_INLINE void putNpThreadContext(PxcNpThreadContext* threadContext) + { mNpThreadContextPool.put(threadContext); } + PX_FORCE_INLINE PxMutex& getLock() { return mLock; } + + PX_FORCE_INLINE PxTaskManager& getTaskManager() + { + PX_ASSERT(mTaskManager); + return *mTaskManager; + } + + PX_FORCE_INLINE PxCudaContextManager* getCudaContextManager() + { + return mCudaContextManager; + } + + PX_FORCE_INLINE void clearManagerTouchEvents(); + + PX_FORCE_INLINE Cm::PoolList& getContactManagerPool() + { + return this->mContactManagerPool; + } + + PX_FORCE_INLINE void setActiveContactManager(const PxsContactManager* manager, PxIntBool useCCD) + { + /*const PxU32 index = manager->getIndex(); + if(index >= mActiveContactManager.size()) + { + const PxU32 newSize = (2 * index + 256)&~255; + mActiveContactManager.resize(newSize); + } + mActiveContactManager.set(index);*/ + + //Record any pairs that have CCD enabled! + if(useCCD) + { + const PxU32 index = manager->getIndex(); + if(index >= mActiveContactManagersWithCCD.size()) + { + const PxU32 newSize = (2 * index + 256)&~255; + mActiveContactManagersWithCCD.resize(newSize); + } + mActiveContactManagersWithCCD.set(index); + } + } + +private: + void mergeCMDiscreteUpdateResults(PxBaseTask* continuation); + + PxU32 mIndex; + + // Threading + PxcThreadCoherentCache + mNpThreadContextPool; + + // Contact managers + Cm::PoolList mContactManagerPool; + PxPool mManifoldPool; + PxPool mSphereManifoldPool; + +// PxBitMap mActiveContactManager; + PxBitMap mActiveContactManagersWithCCD; //KS - adding to filter any pairs that had a touch + PxBitMap mContactManagersWithCCDTouch; //KS - adding to filter any pairs that had a touch + PxBitMap mContactManagerTouchEvent; + //Cm::BitMap mContactManagerPatchChangeEvent; + + PxU32 mCMTouchEventCount[PXS_TOUCH_EVENT_COUNT]; + + PxMutex mLock; + + PxContactModifyCallback* mContactModifyCallback; + + // narrowphase platform-dependent implementations support + PxvNphaseImplementationContext* mNpImplementationContext; + PxvNphaseImplementationContext* mNpFallbackImplementationContext; + + // debug rendering (CS TODO: MS would like to have these wrapped into a class) + PxReal mVisualizationParams[PxVisualizationParameter::eNUM_VALUES]; + + PxBounds3 mVisualizationCullingBox; + + PxTaskManager* mTaskManager; + Cm::FlushPool& mTaskPool; + + PxCudaContextManager* mCudaContextManager; + + // PxU32 mTouchesLost; + // PxU32 mTouchesFound; + + // PX_ENABLE_SIM_STATS + PxvSimStats mSimStats; + bool mPCM; + bool mContactCache; + bool mCreateAveragePoint; + + PxsTransformCache* mTransformCache; + const PxFloatArrayPinned* mContactDistances; + + PxU32 mMaxPatches; + PxU32 mTotalCompressedCacheSize; + + PxU64 mContextID; + + friend class PxsCCDContext; + friend class PxsNphaseImplementationContext; + friend class PxgNphaseImplementationContext; //FDTODO ideally it shouldn't be here.. +}; + + +PX_FORCE_INLINE void PxsContext::clearManagerTouchEvents() +{ + mContactManagerTouchEvent.clear(); + for(PxU32 i = 0; i < PXS_TOUCH_EVENT_COUNT; ++i) + { + mCMTouchEventCount[i] = 0; + } +} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsDefaultMemoryManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsDefaultMemoryManager.h new file mode 100644 index 0000000..6655ad8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsDefaultMemoryManager.h @@ -0,0 +1,32 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_DEFAULT_MEMORY_MANAGER_H +#define PXS_DEFAULT_MEMORY_MANAGER_H + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsHeapMemoryAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsHeapMemoryAllocator.h new file mode 100644 index 0000000..7306dfe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsHeapMemoryAllocator.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_HEAP_MEMORY_ALLOCATOR_H +#define PXS_HEAP_MEMORY_ALLOCATOR_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + struct PxsHeapStats + { + enum Enum + { + eOTHER = 0, + eBROADPHASE, + eNARROWPHASE, + eSOLVER, + eARTICULATION, + eSIMULATION, + eSIMULATION_ARTICULATION, + eSIMULATION_PARTICLES, + eSIMULATION_SOFTBODY, + eSIMULATION_FEMCLOTH, + eSIMULATION_HAIRSYSTEM, + eSHARED_PARTICLES, + eSHARED_SOFTBODY, + eSHARED_FEMCLOTH, + eSHARED_HAIRSYSTEM, + eHEAPSTATS_COUNT + }; + + PxU64 stats[eHEAPSTATS_COUNT]; + + PxsHeapStats() + { + for (PxU32 i = 0; i < eHEAPSTATS_COUNT; i++) + { + stats[i] = 0; + } + } + }; + + // PT: TODO: consider dropping this class + class PxsHeapMemoryAllocator : public PxVirtualAllocatorCallback, public PxUserAllocated + { + public: + virtual ~PxsHeapMemoryAllocator(){} + + // PxVirtualAllocatorCallback + //virtual void* allocate(const size_t size, const int group, const char* file, const int line) = 0; + //virtual void deallocate(void* ptr) = 0; + //~PxVirtualAllocatorCallback + }; + + class PxsHeapMemoryAllocatorManager : public PxUserAllocated + { + public: + virtual ~PxsHeapMemoryAllocatorManager() {} + + virtual PxU64 getDeviceMemorySize() const = 0; + virtual PxsHeapStats getDeviceHeapStats() const = 0; + + PxsHeapMemoryAllocator* mMappedMemoryAllocators; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIncrementalConstraintPartitioning.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIncrementalConstraintPartitioning.h new file mode 100644 index 0000000..66fd3f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIncrementalConstraintPartitioning.h @@ -0,0 +1,39 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_INCREMENTAL_CONSTRAINT_PARTITIONING_H +#define PXS_INCREMENTAL_CONSTRAINT_PARTITIONING_H + +#include "PxsSimpleIslandManager.h" + +namespace physx +{ + +} + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandManagerTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandManagerTypes.h new file mode 100644 index 0000000..812b12e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandManagerTypes.h @@ -0,0 +1,236 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_ISLAND_MANAGER_TYPES_H +#define PXS_ISLAND_MANAGER_TYPES_H + +namespace physx +{ + +class PxsContactManager; +class PxsRigidBody; +namespace Dy +{ + struct Constraint; + class Articulation; +} + +typedef PxU32 NodeType; +typedef PxU32 EdgeType; +typedef PxU32 IslandType; +#define INVALID_NODE 0xffffffff +#define INVALID_EDGE 0xffffffff +#define INVALID_ISLAND 0xffffffff + +//----------------------------------------------------------------------------// + +template class PxsIslandManagerHook +{ + friend class PxsIslandManager; + T index; + +public: + + static const T INVALID = INVLD; + + PX_FORCE_INLINE PxsIslandManagerHook(): index(INVLD) {} + PX_FORCE_INLINE PxsIslandManagerHook(const T id): index(id) {} + PX_FORCE_INLINE PxsIslandManagerHook(const PxsIslandManagerHook& src) : index(src.index) {} + PX_FORCE_INLINE ~PxsIslandManagerHook(){} + + PX_FORCE_INLINE bool isManaged() const { return index!=INVLD; } + +private: +}; + +typedef PxsIslandManagerHook PxsIslandManagerNodeHook; +typedef PxsIslandManagerHook PxsIslandManagerEdgeHook; +typedef PxsIslandManagerHook PxsIslandManagerIslandHook; + +//----------------------------------------------------------------------------// + +class PxsIslandIndices +{ +public: + + PxsIslandIndices() {} + ~PxsIslandIndices() {} + + NodeType bodies; + NodeType articulations; + EdgeType contactManagers; + EdgeType constraints; +}; + +//----------------------------------------------------------------------------// + +typedef PxU64 PxsNodeType; + + +/** +\brief Each contact manager or constraint references two separate bodies, where +a body can be a dynamic rigid body, a kinematic rigid body, an articulation or a static. +The struct PxsIndexedInteraction describes the bodies that make up the pair. +*/ +struct PxsIndexedInteraction +{ + /** + \brief An enumerated list of all possible body types. + A body type is stored for each body in the pair. + */ + enum Enum + { + eBODY = 0, + eKINEMATIC = 1, + eARTICULATION = 2, + eWORLD = 3 + }; + + /** + \brief An index describing how to access body0 + + \note If body0 is a dynamic (eBODY) rigid body then solverBody0 is an index into PxsIslandObjects::bodies. + \note If body0 is a kinematic (eKINEMATIC) rigid body then solverBody0 is an index into PxsIslandManager::getActiveKinematics. + + \note If body0 is a static (eWORLD) then solverBody0 is PX_MAX_U32 or PX_MAX_U64, depending on the platform being 32- or 64-bit. + + \note If body0 is an articulation then the articulation is found directly from Dy::getArticulation(articulation0) + + \note If body0 is an soft body then the soft body is found directly from Dy::getSoftBody(softBody0) + */ + union + { + PxsNodeType solverBody0; + PxsNodeType articulation0; + }; + + /** + \brief An index describing how to access body1 + + \note If body1 is a dynamic (eBODY) rigid body then solverBody1 is an index into PxsIslandObjects::bodies. + \note If body1 is a kinematic (eKINEMATIC) rigid body then solverBody1 is an index into PxsIslandManager::getActiveKinematics. + + \note If body1 is a static (eWORLD) then solverBody1 is PX_MAX_U32 or PX_MAX_U64, depending on the platform being 32- or 64-bit. + + \note If body1 is an articulation then the articulation is found directly from Dy::getArticulation(articulation1) + + \note If body0 is an soft body then the soft body is found directly from Dy::getSoftBody(softBody1) + */ + union + { + PxsNodeType solverBody1; + PxsNodeType articulation1; + }; + + /** + \brief The type (eBODY, eKINEMATIC etc) of body0 + */ + PxU8 indexType0; + + /** + \brief The type (eBODY, eKINEMATIC etc) of body1 + */ + PxU8 indexType1; + + PxU8 pad[2]; +}; + +/** +@see PxsIslandObjects, PxsIndexedInteraction +*/ +struct PxsIndexedContactManager : public PxsIndexedInteraction +{ + /** + \brief The contact manager corresponds to the value set in PxsIslandManager::setEdgeRigidCM + */ + PxsContactManager* contactManager; + + PxsIndexedContactManager(PxsContactManager* cm) : contactManager(cm) {} +}; +#if !PX_X64 +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxsIndexedContactManager) & 0x0f)); +#endif + +/** +@see PxsIslandObjects, PxsIndexedInteraction +*/ +struct PxsIndexedConstraint : public PxsIndexedInteraction +{ + /** + \brief The constraint corresponds to the value set in PxsIslandManager::setEdgeConstraint + */ + Dy::Constraint* constraint; + + PxsIndexedConstraint(Dy::Constraint* c) : constraint(c) {} +}; +#if !PX_P64_FAMILY +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxsIndexedConstraint) & 0x0f)); +#endif + +//----------------------------------------------------------------------------// + +/** +\brief Any sleeping contact pair that finds itself in an awake island after 1st pass island gen +must participate in 2nd pass narrowphase so that contacts can be generated. + +\note Contact managers in sleeping pairs are NULL until PxsIslandManager::setWokenPairContactManagers is complete. + +@see PxsIslandManager::getNarrowPhaseSecondPassContactManagers, PxsIslandManager::getNumNarrowPhaseSecondPassContactManagers, +PxsIslandManager::setWokenPairContactManagers +*/ +struct PxsNarrowPhaseSecondPassContactManager +{ + /** + \brief The contact manager that is to participate in 2nd pass narrowphase. + + \note This pointer is NULL after 1st pass island gen and remains NULL until PxsIslandManager::setWokenPairContactManagers + completes. + */ + PxsContactManager* mCM; + + /** + \brief The corresponding entry in PxsIslandObjects::contactManagers. + + \note All sleeping pairs have a null contact manager during 1st pass island gen. After 1st pass island gen completes, + the bodies to be woken are externally processed. Waking up bodies generates contact managers and passes the pointer to the + corresponding edge. So that the contact manager can be efficiently passed to PxsIslandObjects we store mEdgeId and mSolverCMId. + The contact manager pointers are set in PxsIslandManager::setWokenPairContactManagers + */ + EdgeType mSolverCMId; //Keeps a track of which entries in the solver islands temporarily have a null contact manager + + /** + \brief The internal id of the corresponding edge. + */ + EdgeType mEdgeId; +}; + + +} //namespace physx + + +#endif //PXS_ISLAND_MANAGER_TYPES_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandSim.h new file mode 100644 index 0000000..d722e1c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsIslandSim.h @@ -0,0 +1,1016 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_ISLAND_SIM_H +#define PXS_ISLAND_SIM_H + +#include "foundation/PxAssert.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxArray.h" +#include "CmPriorityQueue.h" +#include "CmBlockArray.h" +#include "PxNodeIndex.h" + +namespace physx +{ + +namespace Dy +{ + struct Constraint; + class FeatherstoneArticulation; +#if PX_SUPPORT_GPU_PHYSX + class SoftBody; + class FEMCloth; + class ParticleSystem; + class HairSystem; +#endif +} + +namespace Sc +{ + class ArticulationSim; +} + +class PxsContactManager; +class PxsRigidBody; + +struct PartitionEdge; + +namespace IG +{ + +//This index is +#define IG_INVALID_ISLAND 0xFFFFFFFFu +#define IG_INVALID_EDGE 0xFFFFFFFFu +#define IG_INVALID_LINK 0xFFu + + +typedef PxU32 IslandId; +typedef PxU32 EdgeIndex; +typedef PxU32 EdgeInstanceIndex; + +class IslandSim; + +struct Edge +{ + //Edge instances can be implicitly calculated based on this edge index, which is an offset into the array of edges. + //From that, the child edge index is simply the + //The constraint or contact referenced by this edge + + enum EdgeType + { + eCONTACT_MANAGER, + eCONSTRAINT, + eSOFT_BODY_CONTACT, + eFEM_CLOTH_CONTACT, + ePARTICLE_SYSTEM_CONTACT, + eHAIR_SYSTEM_CONTACT, + eEDGE_TYPE_COUNT + }; + + + enum EdgeState + { + eINSERTED =1<<0, + ePENDING_DESTROYED =1<<1, + eACTIVE =1<<2, + eIN_DIRTY_LIST =1<<3, + eDESTROYED =1<<4, + eREPORT_ONLY_DESTROY=1<<5, + eACTIVATING =1<<6 + }; + + + //NodeIndex mNode1, mNode2; + EdgeType mEdgeType; + PxU16 mEdgeState; + + EdgeIndex mNextIslandEdge, mPrevIslandEdge; + + + + PX_FORCE_INLINE void setInserted() { mEdgeState |= (eINSERTED); } + + PX_FORCE_INLINE void clearInserted() { mEdgeState &= (~eINSERTED); } + + PX_FORCE_INLINE void clearDestroyed() { mEdgeState &=(~eDESTROYED);} + PX_FORCE_INLINE void setPendingDestroyed() { mEdgeState |= ePENDING_DESTROYED; } + PX_FORCE_INLINE void clearPendingDestroyed() { mEdgeState &= (~ePENDING_DESTROYED); } + PX_FORCE_INLINE void activateEdge() { mEdgeState |= eACTIVE; } + PX_FORCE_INLINE void deactivateEdge() { mEdgeState &= (~eACTIVE); } + PX_FORCE_INLINE void markInDirtyList() { mEdgeState |= (eIN_DIRTY_LIST); } + PX_FORCE_INLINE void clearInDirtyList() { mEdgeState &= (~eIN_DIRTY_LIST); } + PX_FORCE_INLINE void setReportOnlyDestroy() { mEdgeState |= (eREPORT_ONLY_DESTROY); } + PX_FORCE_INLINE void clearReportOnlyDestroy() { mEdgeState &= (~eREPORT_ONLY_DESTROY); } +public: + Edge() : mEdgeType(Edge::eCONTACT_MANAGER), mEdgeState(eDESTROYED), + mNextIslandEdge(IG_INVALID_EDGE), mPrevIslandEdge(IG_INVALID_EDGE) + { + } + PX_FORCE_INLINE bool isInserted() const { return !!(mEdgeState & eINSERTED);} + PX_FORCE_INLINE bool isDestroyed() const { return !!(mEdgeState & eDESTROYED); } + PX_FORCE_INLINE bool isPendingDestroyed() const { return !!(mEdgeState & ePENDING_DESTROYED); } + PX_FORCE_INLINE bool isActive() const { return !!(mEdgeState & eACTIVE); } + PX_FORCE_INLINE bool isInDirtyList() const { return !!(mEdgeState & eIN_DIRTY_LIST); } + PX_FORCE_INLINE EdgeType getEdgeType() const { return mEdgeType; } + //PX_FORCE_INLINE const NodeIndex getIndex1() const { return mNode1; } + //PX_FORCE_INLINE const NodeIndex getIndex2() const { return mNode2; } + PX_FORCE_INLINE bool isReportOnlyDestroy() { return !!(mEdgeState & eREPORT_ONLY_DESTROY); } +}; + +struct EdgeInstance +{ + EdgeInstanceIndex mNextEdge, mPrevEdge; //The next edge instance in this node's list of edge instances + + EdgeInstance() : mNextEdge(IG_INVALID_EDGE), mPrevEdge(IG_INVALID_EDGE) + { + } +}; + +template +class HandleManager +{ + PxArray mFreeHandles; + Handle mCurrentHandle; + +public: + + HandleManager() : mFreeHandles("FreeHandles"), mCurrentHandle(0) + { + } + + ~HandleManager(){} + + Handle getHandle() + { + if(mFreeHandles.size()) + { + Handle handle = mFreeHandles.popBack(); + PX_ASSERT(isValidHandle(handle)); + return handle; + } + return mCurrentHandle++; + } + + bool isNotFreeHandle(Handle handle) + { + for(PxU32 a = 0; a < mFreeHandles.size(); ++a) + { + if(mFreeHandles[a] == handle) + return false; + } + return true; + } + + void freeHandle(Handle handle) + { + PX_ASSERT(isValidHandle(handle)); + PX_ASSERT(isNotFreeHandle(handle)); + if(handle == mCurrentHandle) + mCurrentHandle--; + else + mFreeHandles.pushBack(handle); + } + + bool isValidHandle(Handle handle) + { + return handle < mCurrentHandle; + } + + PX_FORCE_INLINE PxU32 getTotalHandles() const { return mCurrentHandle; } +}; + +class Node +{ + +public: + enum NodeType + { + eRIGID_BODY_TYPE, + eARTICULATION_TYPE, + eSOFTBODY_TYPE, + eFEMCLOTH_TYPE, + ePARTICLESYSTEM_TYPE, + eHAIRSYSTEM_TYPE, + eTYPE_COUNT + }; + enum State + { + eREADY_FOR_SLEEPING = 1u << 0, //! Ready to go to sleep + eACTIVE = 1u << 1, //! Active + eKINEMATIC = 1u << 2, //! Kinematic + eDELETED = 1u << 3, //! Is pending deletion + eDIRTY = 1u << 4, //! Is dirty (i.e. lost a connection) + eACTIVATING = 1u << 5, //! Is in the activating list + eDEACTIVATING = 1u << 6 //! It is being forced to deactivate this frame + }; + EdgeInstanceIndex mFirstEdgeIndex; + + PxU8 mFlags; + PxU8 mType; + PxU16 mStaticTouchCount; + //PxU32 mActiveNodeIndex; //! Look-up for this node in the active nodes list, activating list or deactivating list... + + PxNodeIndex mNextNode, mPrevNode; + + //A counter for the number of active references to this body. Whenever an edge is activated, this is incremented. + //Whenver an edge is deactivated, this is decremented. This is used for kinematic bodies to determine if they need + //to be in the active kinematics list + PxU32 mActiveRefCount; + + + //A node can correspond with either a rigid body or an articulation or softBody + union + { + PxsRigidBody* mRigidBody; + Dy::FeatherstoneArticulation* mLLArticulation; +#if PX_SUPPORT_GPU_PHYSX + Dy::SoftBody* mLLSoftBody; + Dy::FEMCloth* mLLFEMCloth; + Dy::ParticleSystem* mLLParticleSystem; + Dy::HairSystem* mLLHairSystem; +#endif + }; + + + + PX_FORCE_INLINE Node() : mFirstEdgeIndex(IG_INVALID_EDGE), mFlags(eDELETED), mType(eRIGID_BODY_TYPE), + mStaticTouchCount(0), mActiveRefCount(0), mRigidBody(NULL) + { + } + + PX_FORCE_INLINE ~Node() {} + + PX_FORCE_INLINE void reset() + { + mFirstEdgeIndex = IG_INVALID_EDGE; + mFlags = eDELETED; + mRigidBody = NULL; + mActiveRefCount = 0; + mStaticTouchCount = 0; + } + + PX_FORCE_INLINE void setRigidBody(PxsRigidBody* body) { mRigidBody = body; } + + PX_FORCE_INLINE PxsRigidBody* getRigidBody() const { return mRigidBody; } + + PX_FORCE_INLINE Dy::FeatherstoneArticulation* getArticulation() const { return mLLArticulation; } + +#if PX_SUPPORT_GPU_PHYSX + PX_FORCE_INLINE Dy::SoftBody* getSoftBody() const { return mLLSoftBody; } + PX_FORCE_INLINE Dy::FEMCloth* getFEMCloth() const { return mLLFEMCloth; } + PX_FORCE_INLINE Dy::HairSystem* getHairSystem() const { return mLLHairSystem; } +#endif + + PX_FORCE_INLINE void setActive() { mFlags |= eACTIVE; } + PX_FORCE_INLINE void clearActive() { mFlags &= ~eACTIVE; } + + PX_FORCE_INLINE void setActivating() { mFlags |= eACTIVATING; } + PX_FORCE_INLINE void clearActivating() { mFlags &= ~eACTIVATING; } + + PX_FORCE_INLINE void setDeactivating() { mFlags |= eDEACTIVATING; } + PX_FORCE_INLINE void clearDeactivating() { mFlags &= (~eDEACTIVATING); } + + + //Activates a body/node. + PX_FORCE_INLINE void setIsReadyForSleeping() { mFlags |= eREADY_FOR_SLEEPING; } + + PX_FORCE_INLINE void clearIsReadyForSleeping(){ mFlags &= (~eREADY_FOR_SLEEPING);} + + PX_FORCE_INLINE void setIsDeleted(){mFlags |= eDELETED; } + + PX_FORCE_INLINE void setKinematicFlag() {PX_ASSERT(!isKinematic()); mFlags |= eKINEMATIC;} + + PX_FORCE_INLINE void clearKinematicFlag(){ PX_ASSERT(isKinematic()); mFlags &= (~eKINEMATIC);} + + PX_FORCE_INLINE void markDirty(){mFlags |= eDIRTY;} + + PX_FORCE_INLINE void clearDirty(){mFlags &= (~eDIRTY);} + +public: + + PX_FORCE_INLINE bool isActive() const { return !!(mFlags & eACTIVE); } + + PX_FORCE_INLINE bool isActiveOrActivating() const { return !!(mFlags & (eACTIVE | eACTIVATING)); } + + PX_FORCE_INLINE bool isActivating() const { return !!(mFlags & eACTIVATING); } + + PX_FORCE_INLINE bool isDeactivating() const { return !!(mFlags & eDEACTIVATING); } + + PX_FORCE_INLINE bool isKinematic() const { return !!(mFlags & eKINEMATIC); } + + PX_FORCE_INLINE bool isDeleted() const { return !!(mFlags & eDELETED); } + + PX_FORCE_INLINE bool isDirty() const { return !!(mFlags & eDIRTY); } + + PX_FORCE_INLINE bool isReadyForSleeping() const { return !!(mFlags & eREADY_FOR_SLEEPING); } + + PX_FORCE_INLINE NodeType getNodeType() const { return NodeType(mType); } + + friend class SimpleIslandManager; + +}; + +struct Island +{ + PxNodeIndex mRootNode; + PxNodeIndex mLastNode; + PxU32 mSize[Node::eTYPE_COUNT]; + PxU32 mActiveIndex; + + EdgeIndex mFirstEdge[Edge::eEDGE_TYPE_COUNT], mLastEdge[Edge::eEDGE_TYPE_COUNT]; + PxU32 mEdgeCount[Edge::eEDGE_TYPE_COUNT]; + + Island() : mActiveIndex(IG_INVALID_ISLAND) + { + for(PxU32 a = 0; a < Edge::eEDGE_TYPE_COUNT; ++a) + { + mFirstEdge[a] = IG_INVALID_EDGE; + mLastEdge[a] = IG_INVALID_EDGE; + mEdgeCount[a] = 0; + } + + for(PxU32 a = 0; a < Node::eTYPE_COUNT; ++a) + { + mSize[a] = 0; + } + } +}; + +struct TraversalState +{ + PxNodeIndex mNodeIndex; + PxU32 mCurrentIndex; + PxU32 mPrevIndex; + PxU32 mDepth; + + TraversalState() + { + } + + TraversalState(PxNodeIndex nodeIndex, PxU32 currentIndex, PxU32 prevIndex, PxU32 depth) : + mNodeIndex(nodeIndex), mCurrentIndex(currentIndex), mPrevIndex(prevIndex), mDepth(depth) + { + } +}; + +struct QueueElement +{ + TraversalState* mState; + PxU32 mHopCount; + + QueueElement() + { + } + + QueueElement(TraversalState* state, PxU32 hopCount) : mState(state), mHopCount(hopCount) + { + } +}; + +struct NodeComparator +{ + NodeComparator() + { + } + + bool operator() (const QueueElement& node0, const QueueElement& node1) const + { + return node0.mHopCount < node1.mHopCount; + } +private: + NodeComparator& operator = (const NodeComparator&); +}; + + +class IslandSim +{ + HandleManager mIslandHandles; //! Handle manager for islands + + PxArray mNodes; //! The nodes used in the constraint graph + PxArray mActiveNodeIndex; //! The active node index for each node + Cm::BlockArray mEdges; + Cm::BlockArray mEdgeInstances; //! Edges used to connect nodes in the constraint graph + PxArray mIslands; //! The array of islands + PxArray mIslandStaticTouchCount; //! Array of static touch counts per-island + + + PxArray mActiveNodes[Node::eTYPE_COUNT]; //! An array of active nodes + PxArray mActiveKinematicNodes; //! An array of active or referenced kinematic nodes + PxArray mActivatedEdges[Edge::eEDGE_TYPE_COUNT]; //! An array of active edges + + PxU32 mActiveEdgeCount[Edge::eEDGE_TYPE_COUNT]; + + PxArray mHopCounts; //! The observed number of "hops" from a given node to its root node. May be inaccurate but used to accelerate searches. + PxArray mFastRoute; //! The observed last route from a given node to the root node. We try the fast route (unless its broken) before trying others. + + PxArray mIslandIds; //! The array of per-node island ids + + PxBitMap mIslandAwake; //! Indicates whether an island is awake or not + + PxBitMap mActiveContactEdges; + + //An array of active islands + PxArray mActiveIslands; + + PxU32 mInitialActiveNodeCount[Edge::eEDGE_TYPE_COUNT]; + + PxArray mNodesToPutToSleep[Node::eTYPE_COUNT]; + + //Input to this frame's island management (changed nodes/edges) + + //Input list of changes observed this frame. If there no changes, no work to be done. + PxArray mDirtyEdges[Edge::eEDGE_TYPE_COUNT]; + //Dirty nodes. These nodes lost at least one connection so we need to recompute islands from these nodes + //PxArray mDirtyNodes; + PxBitMap mDirtyMap; + PxU32 mLastMapIndex; + + //An array of nodes to activate + PxArray mActivatingNodes; + PxArray mDestroyedEdges; + PxArray mTempIslandIds; + + + //Temporary, transient data used for traversals. TODO - move to PxsSimpleIslandManager. Or if we keep it here, we can + //process multiple island simulations in parallel + Cm::PriorityQueue + mPriorityQueue; //! Priority queue used for graph traversal + PxArray mVisitedNodes; //! The list of nodes visited in the current traversal + PxBitMap mVisitedState; //! Indicates whether a node has been visited + PxArray mIslandSplitEdges[Edge::eEDGE_TYPE_COUNT]; + + PxArray mDeactivatingEdges[Edge::eEDGE_TYPE_COUNT]; + + PxArray* mFirstPartitionEdges; + Cm::BlockArray& mEdgeNodeIndices; + PxArray* mDestroyedPartitionEdges; + + PxU32* mNpIndexPtr; + + PxU64 mContextId; + +public: + + IslandSim(PxArray* firstPartitionEdges, Cm::BlockArray& edgeNodeIndices, PxArray* destroyedPartitionEdges, PxU64 contextID); + ~IslandSim() {} + + void resize(const PxU32 nbNodes, const PxU32 nbContactManagers, const PxU32 nbConstraints); + + void addRigidBody(PxsRigidBody* body, bool isKinematic, bool isActive, PxNodeIndex nodeIndex); + + void addArticulation(Sc::ArticulationSim* articulation, Dy::FeatherstoneArticulation* llArtic, bool isActive, PxNodeIndex nodeIndex); + +#if PX_SUPPORT_GPU_PHYSX + void addSoftBody(Dy::SoftBody* llArtic, bool isActive, PxNodeIndex nodeIndex); + + void addFEMCloth(Dy::FEMCloth* llArtic, bool isActive, PxNodeIndex nodeIndex); + + void addParticleSystem(Dy::ParticleSystem* llArtic, bool isActive, PxNodeIndex nodeIndex); + + void addHairSystem(Dy::HairSystem* llHairSystem, bool isActive, PxNodeIndex nodeIndex); +#endif + + void addContactManager(PxsContactManager* manager, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, EdgeIndex handle); + + void addConstraint(Dy::Constraint* constraint, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, EdgeIndex handle); + + void activateNode(PxNodeIndex index); + void deactivateNode(PxNodeIndex index); + void putNodeToSleep(PxNodeIndex index); + + void removeConnection(EdgeIndex edgeIndex); + + PX_FORCE_INLINE PxU32 getNbNodes() const { return mNodes.size(); } + + PX_FORCE_INLINE PxU32 getNbActiveNodes(Node::NodeType type) const { return mActiveNodes[type].size(); } + + PX_FORCE_INLINE const PxNodeIndex* getActiveNodes(Node::NodeType type) const { return mActiveNodes[type].begin(); } + + PX_FORCE_INLINE PxU32 getNbActiveKinematics() const { return mActiveKinematicNodes.size(); } + + PX_FORCE_INLINE const PxNodeIndex* getActiveKinematics() const { return mActiveKinematicNodes.begin(); } + + PX_FORCE_INLINE PxU32 getNbNodesToActivate(Node::NodeType type) const { return mActiveNodes[type].size() - mInitialActiveNodeCount[type]; } + + PX_FORCE_INLINE const PxNodeIndex* getNodesToActivate(Node::NodeType type) const { return mActiveNodes[type].begin() + mInitialActiveNodeCount[type]; } + + PX_FORCE_INLINE PxU32 getNbNodesToDeactivate(Node::NodeType type) const { return mNodesToPutToSleep[type].size(); } + + PX_FORCE_INLINE const PxNodeIndex* getNodesToDeactivate(Node::NodeType type) const { return mNodesToPutToSleep[type].begin(); } + + PX_FORCE_INLINE PxU32 getNbActivatedEdges(Edge::EdgeType type) const { return mActivatedEdges[type].size(); } + + PX_FORCE_INLINE const EdgeIndex* getActivatedEdges(Edge::EdgeType type) const { return mActivatedEdges[type].begin(); } + + PX_FORCE_INLINE PxU32 getNbActiveEdges(Edge::EdgeType type) const { return mActiveEdgeCount[type]; } + + PX_FORCE_INLINE PartitionEdge* getFirstPartitionEdge(IG::EdgeIndex edgeIndex) const { return (*mFirstPartitionEdges)[edgeIndex]; } + PX_FORCE_INLINE void setFirstPartitionEdge(IG::EdgeIndex edgeIndex, PartitionEdge* partitionEdge) { (*mFirstPartitionEdges)[edgeIndex] = partitionEdge; } + + //PX_FORCE_INLINE const EdgeIndex* getActiveEdges(Edge::EdgeType type) const { return mActiveEdges[type].begin(); } + + PX_FORCE_INLINE PxsRigidBody* getRigidBody(PxNodeIndex nodeIndex) const + { + const Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.mType == Node::eRIGID_BODY_TYPE); + return node.mRigidBody; + } + + PX_FORCE_INLINE Dy::FeatherstoneArticulation* getLLArticulation(PxNodeIndex nodeIndex) const + { + const Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.mType == Node::eARTICULATION_TYPE); + return node.mLLArticulation; + } + + Sc::ArticulationSim* getArticulationSim(PxNodeIndex nodeIndex) const; + +#if PX_SUPPORT_GPU_PHYSX + PX_FORCE_INLINE Dy::SoftBody* getLLSoftBody(PxNodeIndex nodeIndex) const + { + const Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.mType == Node::eSOFTBODY_TYPE); + return node.mLLSoftBody; + } + + PX_FORCE_INLINE Dy::FEMCloth* getLLFEMCloth(PxNodeIndex nodeIndex) const + { + const Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.mType == Node::eFEMCLOTH_TYPE); + return node.mLLFEMCloth; + } + + PX_FORCE_INLINE Dy::HairSystem* getLLHairSystem(PxNodeIndex nodeIndex) const + { + const Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.mType == Node::eHAIRSYSTEM_TYPE); + return node.mLLHairSystem; + } +#endif + + PX_FORCE_INLINE void clearDeactivations() + { + for (PxU32 i = 0; i < Node::eTYPE_COUNT; ++i) + { + mNodesToPutToSleep[i].forceSize_Unsafe(0); + mDeactivatingEdges[i].forceSize_Unsafe(0); + } + } + + PX_FORCE_INLINE const Island& getIsland(IG::IslandId islandIndex) const { return mIslands[islandIndex]; } + + PX_FORCE_INLINE PxU32 getNbActiveIslands() const { return mActiveIslands.size(); } + PX_FORCE_INLINE const IslandId* getActiveIslands() const { return mActiveIslands.begin(); } + + PX_FORCE_INLINE PxU32 getNbDeactivatingEdges(const IG::Edge::EdgeType edgeType) const { return mDeactivatingEdges[edgeType].size(); } + PX_FORCE_INLINE const EdgeIndex* getDeactivatingEdges(const IG::Edge::EdgeType edgeType) const { return mDeactivatingEdges[edgeType].begin(); } + + PX_FORCE_INLINE PxU32 getNbDestroyedEdges() const { return mDestroyedEdges.size(); } + PX_FORCE_INLINE const EdgeIndex* getDestroyedEdges() const { return mDestroyedEdges.begin(); } + + PX_FORCE_INLINE PxU32 getNbDestroyedPartitionEdges() const { return mDestroyedPartitionEdges->size(); } + PX_FORCE_INLINE const PartitionEdge*const * getDestroyedPartitionEdges() const { return mDestroyedPartitionEdges->begin(); } + PX_FORCE_INLINE PartitionEdge** getDestroyedPartitionEdges() { return mDestroyedPartitionEdges->begin(); } + + PX_FORCE_INLINE PxU32 getNbDirtyEdges(IG::Edge::EdgeType type) const { return mDirtyEdges[type].size(); } + PX_FORCE_INLINE const EdgeIndex* getDirtyEdges(IG::Edge::EdgeType type) const { return mDirtyEdges[type].begin(); } + + PX_FORCE_INLINE const Edge& getEdge(const EdgeIndex edgeIndex) const { return mEdges[edgeIndex]; } + + PX_FORCE_INLINE Edge& getEdge(const EdgeIndex edgeIndex) { return mEdges[edgeIndex]; } + + PX_FORCE_INLINE const Node& getNode(const PxNodeIndex& nodeIndex) const { return mNodes[nodeIndex.index()]; } + + PX_FORCE_INLINE const Island& getIsland(const PxNodeIndex& nodeIndex) const { PX_ASSERT(mIslandIds[nodeIndex.index()] != IG_INVALID_ISLAND); return mIslands[mIslandIds[nodeIndex.index()]]; } + + PX_FORCE_INLINE PxU32 getIslandStaticTouchCount(const PxNodeIndex& nodeIndex) const { PX_ASSERT(mIslandIds[nodeIndex.index()] != IG_INVALID_ISLAND); return mIslandStaticTouchCount[mIslandIds[nodeIndex.index()]]; } + + PX_FORCE_INLINE const PxBitMap& getActiveContactManagerBitmap() const { return mActiveContactEdges; } + + PX_FORCE_INLINE PxU32 getActiveNodeIndex(const PxNodeIndex& nodeIndex) const { PxU32 activeNodeIndex = mActiveNodeIndex[nodeIndex.index()]; return activeNodeIndex;} + + PX_FORCE_INLINE const PxU32* getActiveNodeIndex() const { return mActiveNodeIndex.begin(); } + + PX_FORCE_INLINE PxU32 getNbActiveNodeIndex() const { return mActiveNodeIndex.size(); } + + void setKinematic(PxNodeIndex nodeIndex); + + void setDynamic(PxNodeIndex nodeIndex); + + PX_FORCE_INLINE void setEdgeNodeIndexPtr(PxU32* ptr) { mNpIndexPtr = ptr; } + + PX_FORCE_INLINE PxNodeIndex getNodeIndex1(IG::EdgeIndex index) const { return mEdgeNodeIndices[2 * index]; } + PX_FORCE_INLINE PxNodeIndex getNodeIndex2(IG::EdgeIndex index) const { return mEdgeNodeIndices[2 * index + 1]; } + + PX_FORCE_INLINE PxU32* getEdgeNodeIndexPtr() const { return mNpIndexPtr; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextId; } + + PxU32 getNbIslands() const { return mIslandStaticTouchCount.size(); } + + const PxU32* getIslandStaticTouchCount() const { return mIslandStaticTouchCount.begin(); } + + const PxU32* getIslandIds() const { return mIslandIds.begin(); } + + bool checkInternalConsistency(); + + + PX_INLINE void activateNode_ForGPUSolver(PxNodeIndex index) + { + IG::Node& node = mNodes[index.index()]; + node.clearIsReadyForSleeping(); //Clear the "isReadyForSleeping" flag. Just in case it was set + node.clearDeactivating(); + } + PX_INLINE void deactivateNode_ForGPUSolver(PxNodeIndex index) + { + IG::Node& node = mNodes[index.index()]; + node.setIsReadyForSleeping(); + } + +private: + + void insertNewEdges(); + void removeDestroyedEdges(); + void wakeIslands(); + void wakeIslands2(); + void processNewEdges(); + void processLostEdges(PxArray& destroyedNodes, bool allowDeactivation, bool permitKinematicDeactivation, PxU32 dirtyNodeLimit); + + void removeConnectionInternal(EdgeIndex edgeIndex); + + void addConnection(PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Edge::EdgeType edgeType, EdgeIndex handle); + + void addConnectionToGraph(EdgeIndex index); + void removeConnectionFromGraph(EdgeIndex edgeIndex); + void connectEdge(EdgeInstance& instance, EdgeInstanceIndex edgeIndex, Node& source, PxNodeIndex destination); + void disconnectEdge(EdgeInstance& instance, EdgeInstanceIndex edgeIndex, Node& node); + + //Merges 2 islands together. The returned id is the id of the merged island + IslandId mergeIslands(IslandId island0, IslandId island1, PxNodeIndex node0, PxNodeIndex node1); + + void mergeIslandsInternal(Island& island0, Island& island1, IslandId islandId0, IslandId islandId1, PxNodeIndex node0, PxNodeIndex node1); + + + IslandSim& operator = (const IslandSim&); + IslandSim(const IslandSim&); + + void unwindRoute(PxU32 traversalIndex, PxNodeIndex lastNode, PxU32 hopCount, IslandId id); + + void activateIsland(IslandId island); + + void deactivateIsland(IslandId island); + + bool canFindRoot(PxNodeIndex startNode, PxNodeIndex targetNode, PxArray* visitedNodes); + + bool tryFastPath(PxNodeIndex startNode, PxNodeIndex targetNode, IslandId islandId); + + bool findRoute(PxNodeIndex startNode, PxNodeIndex targetNode, IslandId islandId); + + bool isPathTo(PxNodeIndex startNode, PxNodeIndex targetNode); + + void addNode(bool isActive, bool isKinematic, Node::NodeType type, PxNodeIndex nodeIndex); + + void activateNodeInternal(PxNodeIndex index); + void deactivateNodeInternal(PxNodeIndex index); + + PX_FORCE_INLINE void notifyReadyForSleeping(const PxNodeIndex nodeIndex) + { + Node& node = mNodes[nodeIndex.index()]; + //PX_ASSERT(node.isActive()); + node.setIsReadyForSleeping(); + } + + PX_FORCE_INLINE void notifyNotReadyForSleeping(const PxNodeIndex nodeIndex) + { + Node& node = mNodes[nodeIndex.index()]; + PX_ASSERT(node.isActive() || node.isActivating()); + node.clearIsReadyForSleeping(); + } + + PX_FORCE_INLINE void markIslandActive(IslandId islandId) + { + Island& island = mIslands[islandId]; + PX_ASSERT(!mIslandAwake.test(islandId)); + PX_ASSERT(island.mActiveIndex == IG_INVALID_ISLAND); + + mIslandAwake.set(islandId); + island.mActiveIndex = mActiveIslands.size(); + mActiveIslands.pushBack(islandId); + } + + PX_FORCE_INLINE void markIslandInactive(IslandId islandId) + { + Island& island = mIslands[islandId]; + PX_ASSERT(mIslandAwake.test(islandId)); + PX_ASSERT(island.mActiveIndex != IG_INVALID_ISLAND); + PX_ASSERT(mActiveIslands[island.mActiveIndex] == islandId); + IslandId replaceId = mActiveIslands[mActiveIslands.size()-1]; + PX_ASSERT(mIslandAwake.test(replaceId)); + Island& replaceIsland = mIslands[replaceId]; + replaceIsland.mActiveIndex = island.mActiveIndex; + mActiveIslands[island.mActiveIndex] = replaceId; + mActiveIslands.forceSize_Unsafe(mActiveIslands.size()-1); + island.mActiveIndex = IG_INVALID_ISLAND; + mIslandAwake.reset(islandId); + } + + PX_FORCE_INLINE void markKinematicActive(PxNodeIndex index) + { + Node& node = mNodes[index.index()]; + PX_ASSERT(node.isKinematic()); + if(node.mActiveRefCount == 0 && mActiveNodeIndex[index.index()] == PX_INVALID_NODE) + { + //PX_ASSERT(mActiveNodeIndex[index.index()] == PX_INVALID_NODE); + //node.mActiveNodeIndex = mActiveKinematicNodes.size(); + mActiveNodeIndex[index.index()] = mActiveKinematicNodes.size(); + PxNodeIndex nodeIndex; + nodeIndex = index; + mActiveKinematicNodes.pushBack(nodeIndex); + } + } + + PX_FORCE_INLINE void markKinematicInactive(PxNodeIndex index) + { + Node& node = mNodes[index.index()]; + PX_ASSERT(node.isKinematic()); + PX_ASSERT(mActiveNodeIndex[index.index()] != PX_INVALID_NODE); + PX_ASSERT(mActiveKinematicNodes[mActiveNodeIndex[index.index()]].index() == index.index()); + + if(node.mActiveRefCount == 0) + { + //Only remove from active kinematic list if it has no active contacts referencing it *and* it is asleep + if(mActiveNodeIndex[index.index()] != PX_INVALID_NODE) + { + //Need to verify active node index because there is an edge case where a node could be woken, then put to + //sleep in the same frame. This would mean that it would not have an active index at this stage. + PxNodeIndex replaceIndex = mActiveKinematicNodes.back(); + PX_ASSERT(mActiveNodeIndex[replaceIndex.index()] == mActiveKinematicNodes.size()-1); + mActiveNodeIndex[replaceIndex.index()] = mActiveNodeIndex[index.index()]; + mActiveKinematicNodes[mActiveNodeIndex[index.index()]] = replaceIndex; + mActiveKinematicNodes.forceSize_Unsafe(mActiveKinematicNodes.size()-1); + mActiveNodeIndex[index.index()] = PX_INVALID_NODE; + } + } + } + + PX_FORCE_INLINE void markActive(PxNodeIndex index) + { + Node& node = mNodes[index.index()]; + PX_ASSERT(!node.isKinematic()); + PX_ASSERT(mActiveNodeIndex[index.index()] == PX_INVALID_NODE); + mActiveNodeIndex[index.index()] = mActiveNodes[node.mType].size(); + PxNodeIndex nodeIndex; + nodeIndex = index; + mActiveNodes[node.mType].pushBack(nodeIndex); + } + + PX_FORCE_INLINE void markInactive(PxNodeIndex index) + { + Node& node = mNodes[index.index()]; + + PX_ASSERT(!node.isKinematic()); + PX_ASSERT(mActiveNodeIndex[index.index()] != PX_INVALID_NODE); + + PxArray& activeNodes = mActiveNodes[node.mType]; + + PX_ASSERT(activeNodes[mActiveNodeIndex[index.index()]].index() == index.index()); + const PxU32 initialActiveNodeCount = mInitialActiveNodeCount[node.mType]; + + if(mActiveNodeIndex[index.index()] < initialActiveNodeCount) + { + //It's in the initial active node set. We retain a list of active nodes, where the existing active nodes + //are at the beginning of the array and the newly activated nodes are at the end of the array... + //The solution is to move the node to the end of the initial active node list in this case + PxU32 activeNodeIndex = mActiveNodeIndex[index.index()]; + PxNodeIndex replaceIndex = activeNodes[initialActiveNodeCount-1]; + PX_ASSERT(mActiveNodeIndex[replaceIndex.index()] == initialActiveNodeCount-1); + mActiveNodeIndex[index.index()] = mActiveNodeIndex[replaceIndex.index()]; + mActiveNodeIndex[replaceIndex.index()] = activeNodeIndex; + activeNodes[activeNodeIndex] = replaceIndex; + activeNodes[mActiveNodeIndex[index.index()]] = index; + mInitialActiveNodeCount[node.mType]--; + } + + PX_ASSERT(!node.isKinematic()); + PX_ASSERT(mActiveNodeIndex[index.index()] != PX_INVALID_NODE); + PX_ASSERT(activeNodes[mActiveNodeIndex[index.index()]].index() == index.index()); + + PxNodeIndex replaceIndex = activeNodes.back(); + PX_ASSERT(mActiveNodeIndex[replaceIndex.index()] == activeNodes.size()-1); + mActiveNodeIndex[replaceIndex.index()] = mActiveNodeIndex[index.index()]; + activeNodes[mActiveNodeIndex[index.index()]] = replaceIndex; + activeNodes.forceSize_Unsafe(activeNodes.size()-1); + mActiveNodeIndex[index.index()] = PX_INVALID_NODE; + } + + PX_FORCE_INLINE void markEdgeActive(EdgeIndex index) + { + Edge& edge = mEdges[index]; + + PX_ASSERT((edge.mEdgeState & Edge::eACTIVATING) == 0); + + edge.mEdgeState |= Edge::eACTIVATING; + + mActivatedEdges[edge.mEdgeType].pushBack(index); + + mActiveEdgeCount[edge.mEdgeType]++; + + //Set the active bit... + if(edge.mEdgeType == Edge::eCONTACT_MANAGER) + mActiveContactEdges.set(index); + + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[2 * index]; + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[2 * index + 1]; + + if (nodeIndex1.index() != PX_INVALID_NODE && nodeIndex2.index() != PX_INVALID_NODE) + { + PX_ASSERT((!mNodes[nodeIndex1.index()].isKinematic()) || (!mNodes[nodeIndex2.index()].isKinematic()) || edge.getEdgeType() == IG::Edge::eCONTACT_MANAGER); + { + Node& node = mNodes[nodeIndex1.index()]; + + if(node.mActiveRefCount == 0 && node.isKinematic() && !(node.isActive() || node.isActivating())) + { + //Add to active kinematic list + markKinematicActive(nodeIndex1); + } + node.mActiveRefCount++; + } + + { + Node& node = mNodes[nodeIndex2.index()]; + if(node.mActiveRefCount == 0 && node.isKinematic() && !(node.isActive() || node.isActivating())) + { + //Add to active kinematic list + markKinematicActive(nodeIndex2); + } + node.mActiveRefCount++; + } + } + + } + + void removeEdgeFromActivatingList(EdgeIndex index); + + PX_FORCE_INLINE void removeEdgeFromIsland(Island& island, EdgeIndex edgeIndex) + { + Edge& edge = mEdges[edgeIndex]; + if(edge.mNextIslandEdge != IG_INVALID_EDGE) + { + PX_ASSERT(mEdges[edge.mNextIslandEdge].mPrevIslandEdge == edgeIndex); + mEdges[edge.mNextIslandEdge].mPrevIslandEdge = edge.mPrevIslandEdge; + } + else + { + PX_ASSERT(island.mLastEdge[edge.mEdgeType] == edgeIndex); + island.mLastEdge[edge.mEdgeType] = edge.mPrevIslandEdge; + } + + if(edge.mPrevIslandEdge != IG_INVALID_EDGE) + { + PX_ASSERT(mEdges[edge.mPrevIslandEdge].mNextIslandEdge == edgeIndex); + mEdges[edge.mPrevIslandEdge].mNextIslandEdge = edge.mNextIslandEdge; + } + else + { + PX_ASSERT(island.mFirstEdge[edge.mEdgeType] == edgeIndex); + island.mFirstEdge[edge.mEdgeType] = edge.mNextIslandEdge; + } + + island.mEdgeCount[edge.mEdgeType]--; + edge.mNextIslandEdge = edge.mPrevIslandEdge = IG_INVALID_EDGE; + } + + PX_FORCE_INLINE void addEdgeToIsland(Island& island, EdgeIndex edgeIndex) + { + Edge& edge = mEdges[edgeIndex]; + PX_ASSERT(edge.mNextIslandEdge == IG_INVALID_EDGE && edge.mPrevIslandEdge == IG_INVALID_EDGE); + + if(island.mLastEdge[edge.mEdgeType] != IG_INVALID_EDGE) + { + PX_ASSERT(mEdges[island.mLastEdge[edge.mEdgeType]].mNextIslandEdge == IG_INVALID_EDGE); + mEdges[island.mLastEdge[edge.mEdgeType]].mNextIslandEdge = edgeIndex; + } + else + { + PX_ASSERT(island.mFirstEdge[edge.mEdgeType] == IG_INVALID_EDGE); + island.mFirstEdge[edge.mEdgeType] = edgeIndex; + } + + edge.mPrevIslandEdge = island.mLastEdge[edge.mEdgeType]; + island.mLastEdge[edge.mEdgeType] = edgeIndex; + island.mEdgeCount[edge.mEdgeType]++; + } + + PX_FORCE_INLINE void removeNodeFromIsland(Island& island, PxNodeIndex nodeIndex) + { + Node& node = mNodes[nodeIndex.index()]; + if(node.mNextNode.isValid()) + { + PX_ASSERT(mNodes[node.mNextNode.index()].mPrevNode.index() == nodeIndex.index()); + mNodes[node.mNextNode.index()].mPrevNode = node.mPrevNode; + } + else + { + PX_ASSERT(island.mLastNode.index() == nodeIndex.index()); + island.mLastNode = node.mPrevNode; + } + + if(node.mPrevNode.isValid()) + { + PX_ASSERT(mNodes[node.mPrevNode.index()].mNextNode.index() == nodeIndex.index()); + mNodes[node.mPrevNode.index()].mNextNode = node.mNextNode; + } + else + { + PX_ASSERT(island.mRootNode.index() == nodeIndex.index()); + island.mRootNode = node.mNextNode; + } + + island.mSize[node.mType]--; + + node.mNextNode = PxNodeIndex(); node.mPrevNode = PxNodeIndex(); + } + + //void setEdgeConnectedInternal(EdgeIndex edgeIndex); + + //void setEdgeDisconnectedInternal(EdgeIndex edgeIndex); + + friend class SimpleIslandManager; + friend class ThirdPassTask; + +}; + + +} + + +struct PartitionIndexData +{ + PxU16 mPartitionIndex; //! The current partition this edge is in. Used to find the edge efficiently. PxU8 is probably too small (256 partitions max) but PxU16 should be more than enough + PxU8 mPatchIndex; //! The patch index for this partition edge. There may be multiple entries for a given edge if there are multiple patches. + PxU8 mCType; //! The type of constraint this is + PxU32 mPartitionEntryIndex; //! index of partition edges for this partition +}; + +struct PartitionNodeData +{ + PxNodeIndex mNodeIndex0; + PxNodeIndex mNodeIndex1; + PxU32 mNextIndex0; + PxU32 mNextIndex1; +}; + + +#define INVALID_PARTITION_INDEX 0xFFFF + +struct PartitionEdge +{ + IG::EdgeIndex mEdgeIndex; //! The edge index into the island manager. Used to identify the contact manager/constraint + PxNodeIndex mNode0; //! The node index for node 0. Can be obtained from the edge index alternatively + PxNodeIndex mNode1; //! The node idnex for node 1. Can be obtained from the edge index alternatively + bool mInfiniteMass0; //! Whether body 0 is kinematic + bool mArticulation0; //! Whether body 0 is an articulation link + bool mInfiniteMass1; //! Whether body 1 is kinematic + bool mArticulation1; //! Whether body 1 is an articulation link + + PartitionEdge* mNextPatch; //! for the contact manager has more than 1 patch, we have next patch's edge and previous patch's edge to connect to this edge + + PxU32 mUniqueIndex; //! a unique ID for this edge + + + //KS - This constructor explicitly does not set mUniqueIndex. It is filled in by the pool allocator and this constructor + //is called afterwards. We do not want to stomp the uniqueIndex value + PartitionEdge() : mEdgeIndex(IG_INVALID_EDGE), mInfiniteMass0(false), mArticulation0(false), + mInfiniteMass1(false), mArticulation1(false), mNextPatch(NULL)//, mUniqueIndex(IG_INVALID_EDGE) + { + } +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsKernelWrangler.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsKernelWrangler.h new file mode 100644 index 0000000..5927788 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsKernelWrangler.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_KERNEL_WRANGLER_H +#define PXS_KERNEL_WRANGLER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + class KernelWrangler; + class PxErrorCallback; + + class PxsKernelWranglerManager : public PxUserAllocated + { + public: + virtual ~PxsKernelWranglerManager(){} + virtual KernelWrangler* getKernelWrangler() = 0; + }; +} +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMaterialCombiner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMaterialCombiner.h new file mode 100644 index 0000000..f7b12ef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMaterialCombiner.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MATERIAL_COMBINER_H +#define PXS_MATERIAL_COMBINER_H + +#include "PxsMaterialCore.h" + +namespace physx +{ + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal combineScalars(PxReal a, PxReal b, PxI32 combineMode) + { + switch (combineMode) + { + case PxCombineMode::eAVERAGE: + return 0.5f * (a + b); + case PxCombineMode::eMIN: + return PxMin(a,b); + case PxCombineMode::eMULTIPLY: + return a * b; + case PxCombineMode::eMAX: + return PxMax(a,b); + default: + return PxReal(0); + } + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal PxsCombineRestitution(const PxsMaterialData& mat0, const PxsMaterialData& mat1) + { + return combineScalars(mat0.restitution, mat1.restitution, ((mat0.flags | mat1.flags) & PxMaterialFlag::eCOMPLIANT_CONTACT) ? + PxCombineMode::eMIN : PxMax(mat0.getRestitutionCombineMode(), mat1.getRestitutionCombineMode())); + } + + //ML:: move this function to header file to avoid LHS in Xbox + //PT: also called by CUDA code now + PX_CUDA_CALLABLE PX_FORCE_INLINE void PxsCombineIsotropicFriction(const PxsMaterialData& mat0, const PxsMaterialData& mat1, PxReal& dynamicFriction, PxReal& staticFriction, PxU32& flags) + { + const PxU32 combineFlags = (mat0.flags | mat1.flags); //& (PxMaterialFlag::eDISABLE_STRONG_FRICTION|PxMaterialFlag::eDISABLE_FRICTION); //eventually set DisStrongFric flag, lower all others. + + if (!(combineFlags & PxMaterialFlag::eDISABLE_FRICTION)) + { + const PxI32 fictionCombineMode = PxMax(mat0.getFrictionCombineMode(), mat1.getFrictionCombineMode()); + PxReal dynFriction = 0.0f; + PxReal staFriction = 0.0f; + + switch (fictionCombineMode) + { + case PxCombineMode::eAVERAGE: + dynFriction = 0.5f * (mat0.dynamicFriction + mat1.dynamicFriction); + staFriction = 0.5f * (mat0.staticFriction + mat1.staticFriction); + break; + case PxCombineMode::eMIN: + dynFriction = PxMin(mat0.dynamicFriction, mat1.dynamicFriction); + staFriction = PxMin(mat0.staticFriction, mat1.staticFriction); + break; + case PxCombineMode::eMULTIPLY: + dynFriction = (mat0.dynamicFriction * mat1.dynamicFriction); + staFriction = (mat0.staticFriction * mat1.staticFriction); + break; + case PxCombineMode::eMAX: + dynFriction = PxMax(mat0.dynamicFriction, mat1.dynamicFriction); + staFriction = PxMax(mat0.staticFriction, mat1.staticFriction); + break; + } + + //isotropic case + const PxReal fDynFriction = PxMax(dynFriction, 0.0f); + + // PT: TODO: the two branches aren't actually doing the same thing: + // - one is ">", the other is ">=" + // - one uses a clamped dynFriction, the other not +#ifdef __CUDACC__ + const PxReal fStaFriction = (staFriction - fDynFriction) > 0 ? staFriction : dynFriction; +#else + const PxReal fStaFriction = physx::intrinsics::fsel(staFriction - fDynFriction, staFriction, fDynFriction); +#endif + dynamicFriction = fDynFriction; + staticFriction = fStaFriction; + flags = combineFlags; + } + else + { + flags = combineFlags | PxMaterialFlag::eDISABLE_STRONG_FRICTION; + dynamicFriction = 0.0f; + staticFriction = 0.0f; + } + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMemoryManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMemoryManager.h new file mode 100644 index 0000000..ce37126 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsMemoryManager.h @@ -0,0 +1,51 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_MEMORY_MANAGER_H +#define PXS_MEMORY_MANAGER_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + class PxVirtualAllocatorCallback; + + class PxsMemoryManager : public PxUserAllocated + { + public: + virtual ~PxsMemoryManager(){} + virtual PxVirtualAllocatorCallback* getHostMemoryAllocator() = 0; + virtual PxVirtualAllocatorCallback* getDeviceMemoryAllocator() = 0; + }; + + // PT: this is for CPU, see createPxgMemoryManager for GPU + PxsMemoryManager* createDefaultMemoryManager(); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseCommon.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseCommon.h new file mode 100644 index 0000000..1893a82 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseCommon.h @@ -0,0 +1,61 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_NPHASE_COMMON_H +#define PXS_NPHASE_COMMON_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxAssert.h" + +namespace physx +{ + + struct PxsContactManagerBase + { + static const PxU32 NEW_CONTACT_MANAGER_MASK = 0x80000000; + static const PxU32 MaxBucketBits = 6; + static const PxU32 GPU_NP_OFFSET = 32;// GPU_BUCKET_ID::eCount; + + const PxU32 mBucketId; + + PxsContactManagerBase(const PxU32 bucketId) : mBucketId(bucketId) + { + PX_ASSERT(bucketId < (1 << MaxBucketBits)); + } + + + PX_FORCE_INLINE PxU32 computeId(const PxU32 index) const { PX_ASSERT(index < PxU32(1 << (32 - (MaxBucketBits - 1)))); return (index << MaxBucketBits) | (mBucketId); } + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 computeIndexFromId(const PxU32 id) { return id >> MaxBucketBits; } + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 computeBucketIndexFromId(const PxU32 id) { return id & ((1 << MaxBucketBits) - 1); } + + private: + PX_NOCOPY(PxsContactManagerBase) + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseImplementationContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseImplementationContext.h new file mode 100644 index 0000000..8f4673a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsNphaseImplementationContext.h @@ -0,0 +1,204 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_NPHASE_IMPLEMENTATION_CONTEXT_H +#define PXS_NPHASE_IMPLEMENTATION_CONTEXT_H + +#include "PxvNphaseImplementationContext.h" +#include "PxsContactManagerState.h" +#include "PxcNpCache.h" +#include "foundation/PxPinnedArray.h" + +class PxsCMDiscreteUpdateTask; + +namespace physx +{ + +struct PxsContactManagers : PxsContactManagerBase +{ + PxArray mOutputContactManagers; + PxArray mContactManagerMapping; + PxArray mCaches; + PxPinnedArray mShapeInteractions; + PxFloatArrayPinned mRestDistances; + PxPinnedArray mTorsionalProperties; + + PxsContactManagers(const PxU32 bucketId, PxVirtualAllocatorCallback* callback) : PxsContactManagerBase(bucketId), + mOutputContactManagers ("mOutputContactManagers"), + mContactManagerMapping ("mContactManagerMapping"), + mCaches ("mCaches"), + mShapeInteractions (PxVirtualAllocator(callback)), + mRestDistances (callback), + mTorsionalProperties (callback) + { + } + + void clear() + { + mOutputContactManagers.forceSize_Unsafe(0); + mContactManagerMapping.forceSize_Unsafe(0); + mCaches.forceSize_Unsafe(0); + mShapeInteractions.forceSize_Unsafe(0); + mRestDistances.forceSize_Unsafe(0); + mTorsionalProperties.forceSize_Unsafe(0); + + } +private: + PX_NOCOPY(PxsContactManagers) +}; + +class PxsNphaseImplementationContext: public PxvNphaseImplementationContextUsableAsFallback +{ +public: + static PxsNphaseImplementationContext* create(PxsContext& context, IG::IslandSim* islandSim, PxVirtualAllocatorCallback* allocator); + + PxsNphaseImplementationContext(PxsContext& context, IG::IslandSim* islandSim, PxVirtualAllocatorCallback* callback, PxU32 index = 0) : + PxvNphaseImplementationContextUsableAsFallback (context), + mNarrowPhasePairs (index, callback), + mNewNarrowPhasePairs (index, callback), + mModifyCallback (NULL), + mIslandSim(islandSim) {} + + virtual void destroy(); + virtual void updateContactManager(PxReal dt, bool hasBoundsArrayChanged, bool hasContactDistanceChanged, PxBaseTask* continuation, + PxBaseTask* firstPassContinuation, Cm::FanoutTask* updateBoundAndShape); + virtual void postBroadPhaseUpdateContactManager(PxBaseTask*) {} + virtual void secondPassUpdateContactManager(PxReal dt, PxBaseTask* continuation); + + virtual void registerContactManager(PxsContactManager* cm, Sc::ShapeInteraction* shapeInteraction, PxI32 touching, PxU32 numPatches); +// virtual void registerContactManagers(PxsContactManager** cm, Sc::ShapeInteraction** shapeInteractions, PxU32 nbContactManagers, PxU32 maxContactManagerId); + virtual void unregisterContactManager(PxsContactManager* cm); + virtual void unregisterContactManagerFallback(PxsContactManager* cm, PxsContactManagerOutput* cmOutputs); + + virtual void refreshContactManager(PxsContactManager* cm); + virtual void refreshContactManagerFallback(PxsContactManager* cm, PxsContactManagerOutput* cmOutputs); + + virtual void registerShape(const PxNodeIndex& /*nodeIndex*/, const PxsShapeCore& /*shapeCore*/, const PxU32 /*transformCacheID*/, PxActor* /*actor*/, const bool /*isFemCloth*/) {} + virtual void unregisterShape(const PxsShapeCore& /*shapeCore*/, const PxU32 /*transformCacheID*/, const bool /*isFemCloth*/) {} + + virtual void registerAggregate(const PxU32 /*transformCacheID*/) {} + + virtual void updateShapeMaterial(const PxsShapeCore&) {} + virtual void updateShapeContactOffset(const PxsShapeCore&) {} + + virtual void registerMaterial(const PxsMaterialCore&) {} + virtual void updateMaterial(const PxsMaterialCore&) {} + virtual void unregisterMaterial(const PxsMaterialCore&) {} + + virtual void registerMaterial(const PxsFEMSoftBodyMaterialCore&) {} + virtual void updateMaterial(const PxsFEMSoftBodyMaterialCore&) {} + virtual void unregisterMaterial(const PxsFEMSoftBodyMaterialCore&) {} + + virtual void registerMaterial(const PxsFEMClothMaterialCore&) {} + virtual void updateMaterial(const PxsFEMClothMaterialCore&) {} + virtual void unregisterMaterial(const PxsFEMClothMaterialCore&) {} + + virtual void registerMaterial(const PxsPBDMaterialCore&) {} + virtual void updateMaterial(const PxsPBDMaterialCore&) {} + virtual void unregisterMaterial(const PxsPBDMaterialCore&) {} + + virtual void registerMaterial(const PxsFLIPMaterialCore&) {} + virtual void updateMaterial(const PxsFLIPMaterialCore&) {} + virtual void unregisterMaterial(const PxsFLIPMaterialCore&) {} + + virtual void registerMaterial(const PxsMPMMaterialCore&) {} + virtual void updateMaterial(const PxsMPMMaterialCore&) {} + virtual void unregisterMaterial(const PxsMPMMaterialCore&) {} + + virtual void registerMaterial(const PxsCustomMaterialCore&) {} + virtual void updateMaterial(const PxsCustomMaterialCore&) {} + virtual void unregisterMaterial(const PxsCustomMaterialCore&) {} + + virtual void appendContactManagers(); + virtual void appendContactManagersFallback(PxsContactManagerOutput* cmOutputs); + + virtual void removeContactManagersFallback(PxsContactManagerOutput* cmOutputs); + + virtual void setContactModifyCallback(PxContactModifyCallback* callback) { mModifyCallback = callback; } + + virtual PxsContactManagerOutputIterator getContactManagerOutputs(); + + virtual PxsContactManagerOutput& getNewContactManagerOutput(PxU32 npIndex); + + virtual void acquireContext(){} + virtual void releaseContext(){} + virtual void preallocateNewBuffers(PxU32 /*nbNewPairs*/, PxU32 /*maxIndex*/) { /*TODO - implement if it's useful to do so*/} + + virtual PxsContactManagerOutputCounts* getFoundPatchOutputCounts() { return mCmFoundLostOutputCounts.begin(); } + virtual PxsContactManager** getFoundPatchManagers() { return mCmFoundLost.begin(); } + virtual PxU32 getNbFoundPatchManagers() { return mCmFoundLost.size(); } + + void processContactManager(PxReal dt, PxsContactManagerOutput* cmOutputs, PxBaseTask* continuation); + void processContactManagerSecondPass(PxReal dt, PxBaseTask* continuation); + void fetchUpdateContactManager() {} + + void appendNewLostPairs(); + + void startNarrowPhaseTasks() {} + + virtual void lock() { mContactManagerMutex.lock(); } + virtual void unlock() { mContactManagerMutex.unlock(); } + + virtual Sc::ShapeInteraction** getShapeInteractions() { return mNarrowPhasePairs.mShapeInteractions.begin(); } + virtual PxReal* getRestDistances() { return mNarrowPhasePairs.mRestDistances.begin(); } + virtual PxsTorsionalFrictionData* getTorsionalData() { return mNarrowPhasePairs.mTorsionalProperties.begin(); } + + virtual PxsContactManagerOutput* getGPUContactManagerOutputBase() { return NULL; } + virtual PxReal* getGPURestDistances() { return NULL; } + virtual Sc::ShapeInteraction** getGPUShapeInteractions() { return NULL; } + virtual PxsTorsionalFrictionData* getGPUTorsionalData() { return NULL; } + + PxArray mRemovedContactManagers; + PxsContactManagers mNarrowPhasePairs; + PxsContactManagers mNewNarrowPhasePairs; + + PxContactModifyCallback* mModifyCallback; + + IG::IslandSim* mIslandSim; + + PxMutex mContactManagerMutex; + + PxArray mCmTasks; + + PxArray mCmFoundLostOutputCounts; + PxArray mCmFoundLost; +private: + void unregisterContactManagerInternal(PxU32 npIndex, PxsContactManagers& managers, PxsContactManagerOutput* cmOutputs); + + PX_FORCE_INLINE void unregisterAndForceSize(PxsContactManagers& cms, PxU32 index) + { + unregisterContactManagerInternal(index, cms, cms.mOutputContactManagers.begin()); + cms.mOutputContactManagers.forceSize_Unsafe(cms.mOutputContactManagers.size()-1); + } + + PX_NOCOPY(PxsNphaseImplementationContext) +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsRigidBody.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsRigidBody.h new file mode 100644 index 0000000..78b20da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsRigidBody.h @@ -0,0 +1,183 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_RIGID_BODY_H +#define PXS_RIGID_BODY_H + +#include "PxvDynamics.h" +#include "CmSpatialVector.h" + +namespace physx +{ +struct PxsCCDBody; + +#define PX_INTERNAL_LOCK_FLAG_START 8 + +PX_ALIGN_PREFIX(16) +class PxsRigidBody +{ + public: + + enum PxsRigidBodyFlag + { + eFROZEN = 1 << 0, //This flag indicates that the stabilization is enabled and the body is + //"frozen". By "frozen", we mean that the body's transform is unchanged + //from the previous frame. This permits various optimizations. + eFREEZE_THIS_FRAME = 1 << 1, + eUNFREEZE_THIS_FRAME = 1 << 2, + eACTIVATE_THIS_FRAME = 1 << 3, + eDEACTIVATE_THIS_FRAME = 1 << 4, + // PT: this flag is now only used on the GPU. For the CPU the data is now stored directly in PxsBodyCore. + eDISABLE_GRAVITY_GPU = 1 << 5, + eSPECULATIVE_CCD = 1 << 6, + eENABLE_GYROSCROPIC = 1 << 7, + //KS - copied here for GPU simulation to avoid needing to pass another set of flags around. + eLOCK_LINEAR_X = 1 << (PX_INTERNAL_LOCK_FLAG_START), + eLOCK_LINEAR_Y = 1 << (PX_INTERNAL_LOCK_FLAG_START + 1), + eLOCK_LINEAR_Z = 1 << (PX_INTERNAL_LOCK_FLAG_START + 2), + eLOCK_ANGULAR_X = 1 << (PX_INTERNAL_LOCK_FLAG_START + 3), + eLOCK_ANGULAR_Y = 1 << (PX_INTERNAL_LOCK_FLAG_START + 4), + eLOCK_ANGULAR_Z = 1 << (PX_INTERNAL_LOCK_FLAG_START + 5), + eRETAIN_ACCELERATION = 1 << 14, + eFIRST_BODY_COPY_GPU = 1 << 15 // Flag to raise to indicate that the body is DMA'd to the GPU for the first time + }; + + PX_FORCE_INLINE PxsRigidBody(PxsBodyCore* core, PxReal freeze_count) : + // PT: TODO: unify naming conventions + mLastTransform (core->body2World), + mInternalFlags (0), + solverIterationCounts (core->solverIterationCounts), + mCCD (NULL), + mCore (core), + sleepLinVelAcc (PxVec3(0.0f)), + freezeCount (freeze_count), + sleepAngVelAcc (PxVec3(0.0f)), + accelScale (1.0f) + {} + + PX_FORCE_INLINE ~PxsRigidBody() {} + + PX_FORCE_INLINE const PxTransform& getPose() const { PX_ASSERT(mCore->body2World.isSane()); return mCore->body2World; } + + PX_FORCE_INLINE const PxVec3& getLinearVelocity() const { PX_ASSERT(mCore->linearVelocity.isFinite()); return mCore->linearVelocity; } + PX_FORCE_INLINE const PxVec3& getAngularVelocity() const { PX_ASSERT(mCore->angularVelocity.isFinite()); return mCore->angularVelocity; } + + PX_FORCE_INLINE void setVelocity(const PxVec3& linear, + const PxVec3& angular) { PX_ASSERT(linear.isFinite()); PX_ASSERT(angular.isFinite()); + mCore->linearVelocity = linear; + mCore->angularVelocity = angular; } + PX_FORCE_INLINE void setLinearVelocity(const PxVec3& linear) { PX_ASSERT(linear.isFinite()); mCore->linearVelocity = linear; } + PX_FORCE_INLINE void setAngularVelocity(const PxVec3& angular) { PX_ASSERT(angular.isFinite()); mCore->angularVelocity = angular; } + + PX_FORCE_INLINE void constrainLinearVelocity(); + PX_FORCE_INLINE void constrainAngularVelocity(); + + PX_FORCE_INLINE PxU32 getIterationCounts() { return mCore->solverIterationCounts; } + PX_FORCE_INLINE PxReal getReportThreshold() const { return mCore->contactReportThreshold; } + + PX_FORCE_INLINE const PxTransform& getLastCCDTransform() const { return mLastTransform; } + PX_FORCE_INLINE void saveLastCCDTransform() { mLastTransform = mCore->body2World; } + + PX_FORCE_INLINE bool isKinematic() const { return mCore->inverseMass == 0.0f; } + + PX_FORCE_INLINE void setPose(const PxTransform& pose) { mCore->body2World = pose; } + PX_FORCE_INLINE void setPosition(const PxVec3& position) { mCore->body2World.p = position; } + PX_FORCE_INLINE PxReal getInvMass() const { return mCore->inverseMass; } + PX_FORCE_INLINE PxVec3 getInvInertia() const { return mCore->inverseInertia; } + PX_FORCE_INLINE PxReal getMass() const { return 1.0f/mCore->inverseMass; } + PX_FORCE_INLINE PxVec3 getInertia() const { return PxVec3(1.0f/mCore->inverseInertia.x, + 1.0f/mCore->inverseInertia.y, + 1.0f/mCore->inverseInertia.z); } + PX_FORCE_INLINE PxsBodyCore& getCore() { return *mCore; } + PX_FORCE_INLINE const PxsBodyCore& getCore() const { return *mCore; } + + PX_FORCE_INLINE PxU32 isActivateThisFrame() const { return PxU32(mInternalFlags & eACTIVATE_THIS_FRAME); } + PX_FORCE_INLINE PxU32 isDeactivateThisFrame() const { return PxU32(mInternalFlags & eDEACTIVATE_THIS_FRAME); } + PX_FORCE_INLINE PxU32 isFreezeThisFrame() const { return PxU32(mInternalFlags & eFREEZE_THIS_FRAME); } + PX_FORCE_INLINE PxU32 isUnfreezeThisFrame() const { return PxU32(mInternalFlags & eUNFREEZE_THIS_FRAME); } + PX_FORCE_INLINE void clearFreezeFlag() { mInternalFlags &= ~eFREEZE_THIS_FRAME; } + PX_FORCE_INLINE void clearUnfreezeFlag() { mInternalFlags &= ~eUNFREEZE_THIS_FRAME; } + PX_FORCE_INLINE void clearAllFrameFlags() { mInternalFlags &= ~(eFREEZE_THIS_FRAME | eUNFREEZE_THIS_FRAME | eACTIVATE_THIS_FRAME | eDEACTIVATE_THIS_FRAME); } + + // PT: implemented in PxsCCD.cpp: + void advanceToToi(PxReal toi, PxReal dt, bool clip); + void advancePrevPoseToToi(PxReal toi); +// PxTransform getAdvancedTransform(PxReal toi) const; + Cm::SpatialVector getPreSolverVelocities() const; + + PxTransform mLastTransform; //28 (28) + + PxU16 mInternalFlags; //30 (30) + PxU16 solverIterationCounts; //32 (32) + + PxsCCDBody* mCCD; //36 (40) // only valid during CCD + + PxsBodyCore* mCore; //40 (48) +#if !PX_P64_FAMILY + PxU32 alignmentPad[2]; //48 (48) +#endif + PxVec3 sleepLinVelAcc; //60 (60) + PxReal freezeCount; //64 (64) + + PxVec3 sleepAngVelAcc; //76 (76) + PxReal accelScale; //80 (80) +} +PX_ALIGN_SUFFIX(16); +PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxsRigidBody) & 0x0f)); + +void PxsRigidBody::constrainLinearVelocity() +{ + const PxU32 lockFlags = mCore->lockFlags; + if(lockFlags) + { + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + mCore->linearVelocity.x = 0.0f; + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + mCore->linearVelocity.y = 0.0f; + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + mCore->linearVelocity.z = 0.0f; + } +} + +void PxsRigidBody::constrainAngularVelocity() +{ + const PxU32 lockFlags = mCore->lockFlags; + if(lockFlags) + { + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + mCore->angularVelocity.x = 0.0f; + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + mCore->angularVelocity.y = 0.0f; + if(lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + mCore->angularVelocity.z = 0.0f; + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsShapeSim.h new file mode 100644 index 0000000..8ac5600 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsShapeSim.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_SHAPE_SIM_H +#define PXS_SHAPE_SIM_H + +#include "PxsRigidBody.h" +#include "PxNodeIndex.h" + +namespace physx +{ +struct PxsShapeCore; + +struct PxsShapeSim +{ + + PxsShapeSim() : mShapeCore(NULL), mElementIndex_GPU(PX_INVALID_U32) + { + } + + PxsShapeCore* mShapeCore; // 4 or 8 + + // NodeIndex used to look up BodySim in island manager + PxNodeIndex mBodySimIndex_GPU; // 8 or 12 unique identified for body + + // ElementID - copy of ElementSim's getElementID() + PxU32 mElementIndex_GPU; // 12 or 16 transform cache and bound index +}; + +}//physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimpleIslandManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimpleIslandManager.h new file mode 100644 index 0000000..4bb65f9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimpleIslandManager.h @@ -0,0 +1,216 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_SIMPLE_ISLAND_GEN_H +#define PXS_SIMPLE_ISLAND_GEN_H + +#include "foundation/PxUserAllocated.h" +#include "PxsIslandSim.h" +#include "CmTask.h" + +namespace physx +{ + +namespace Sc +{ + class Interaction; +} +namespace IG +{ + + class SimpleIslandManager; + +class ThirdPassTask : public Cm::Task +{ + SimpleIslandManager& mIslandManager; + IslandSim& mIslandSim; + +public: + + ThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager, IslandSim& islandSim); + + virtual void runInternal(); + + virtual const char* getName() const + { + return "ThirdPassIslandGenTask"; + } + +private: + PX_NOCOPY(ThirdPassTask) +}; + +class PostThirdPassTask : public Cm::Task +{ + SimpleIslandManager& mIslandManager; + +public: + + PostThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager); + + virtual void runInternal(); + + virtual const char* getName() const + { + return "PostThirdPassTask"; + } +private: + PX_NOCOPY(PostThirdPassTask) +}; + +class SimpleIslandManager : public PxUserAllocated +{ + HandleManager mNodeHandles; //! Handle manager for nodes + HandleManager mEdgeHandles; //! Handle manager for edges + + //An array of destroyed nodes + PxArray mDestroyedNodes; + Cm::BlockArray mInteractions; + + + //Edges destroyed this frame + PxArray mDestroyedEdges; + PxArray mFirstPartitionEdges; + PxArray mDestroyedPartitionEdges; + //KS - stores node indices for a given edge. Node index 0 is at 2* edgeId and NodeIndex1 is at 2*edgeId + 1 + //can also be used for edgeInstance indexing so there's no need to figure out outboundNode ID either! + Cm::BlockArray mEdgeNodeIndices; + Cm::BlockArray mConstraintOrCm; //! Pointers to either the constraint or Cm for this pair + + PxBitMap mConnectedMap; + + IslandSim mIslandManager; + IslandSim mSpeculativeIslandManager; + + ThirdPassTask mSpeculativeThirdPassTask; + ThirdPassTask mAccurateThirdPassTask; + + PostThirdPassTask mPostThirdPassTask; + PxU32 mMaxDirtyNodesPerFrame; + + PxU64 mContextID; +public: + + SimpleIslandManager(bool useEnhancedDeterminism, PxU64 contextID); + + ~SimpleIslandManager(); + + PxNodeIndex addRigidBody(PxsRigidBody* body, bool isKinematic, bool isActive); + + void removeNode(const PxNodeIndex index); + + PxNodeIndex addArticulation(Sc::ArticulationSim* articulation, Dy::FeatherstoneArticulation* llArtic, bool isActive); + +#if PX_SUPPORT_GPU_PHYSX + PxNodeIndex addSoftBody(Dy::SoftBody* llSoftBody, bool isActive); + + PxNodeIndex addFEMCloth(Dy::FEMCloth* llFEMCloth, bool isActive); + + PxNodeIndex addParticleSystem(Dy::ParticleSystem* llParticleSystem, bool isActive); + + PxNodeIndex addHairSystem(Dy::HairSystem* llHairSystem, bool isActive); +#endif + + EdgeIndex addContactManager(PxsContactManager* manager, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Sc::Interaction* interaction, + Edge::EdgeType edgeType); + + EdgeIndex addConstraint(Dy::Constraint* constraint, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Sc::Interaction* interaction); + + bool isConnected(EdgeIndex edgeIndex) const { return !!mConnectedMap.test(edgeIndex); } + + PX_FORCE_INLINE PxNodeIndex getEdgeIndex(EdgeInstanceIndex edgeIndex) const { return mEdgeNodeIndices[edgeIndex]; } + + void activateNode(PxNodeIndex index); + void deactivateNode(PxNodeIndex index); + void putNodeToSleep(PxNodeIndex index); + + void removeConnection(EdgeIndex edgeIndex); + + void firstPassIslandGen(); + void additionalSpeculativeActivation(); + void secondPassIslandGen(); + void thirdPassIslandGen(PxBaseTask* continuation); + + PX_INLINE void clearDestroyedEdges() + { + mDestroyedPartitionEdges.forceSize_Unsafe(0); + } + + void setEdgeConnected(EdgeIndex edgeIndex, Edge::EdgeType edgeType); + void setEdgeDisconnected(EdgeIndex edgeIndex); + + bool getIsEdgeConnected(EdgeIndex edgeIndex); + + void setEdgeRigidCM(const EdgeIndex edgeIndex, PxsContactManager* cm); + + void clearEdgeRigidCM(const EdgeIndex edgeIndex); + + void setKinematic(PxNodeIndex nodeIndex); + + void setDynamic(PxNodeIndex nodeIndex); + + const IslandSim& getSpeculativeIslandSim() const { return mSpeculativeIslandManager; } + const IslandSim& getAccurateIslandSim() const { return mIslandManager; } + + IslandSim& getAccurateIslandSim() { return mIslandManager; } + IslandSim& getSpeculativeIslandSim() { return mSpeculativeIslandManager; } + + PX_FORCE_INLINE PxU32 getNbEdgeHandles() const { return mEdgeHandles.getTotalHandles(); } + + PX_FORCE_INLINE PxU32 getNbNodeHandles() const { return mNodeHandles.getTotalHandles(); } + + void deactivateEdge(const EdgeIndex edge); + + PX_FORCE_INLINE PxsContactManager* getContactManager(IG::EdgeIndex edgeId) const { return reinterpret_cast(mConstraintOrCm[edgeId]); } + PX_FORCE_INLINE PxsContactManager* getContactManagerUnsafe(IG::EdgeIndex edgeId) const { return reinterpret_cast(mConstraintOrCm[edgeId]); } + PX_FORCE_INLINE Dy::Constraint* getConstraint(IG::EdgeIndex edgeId) const { return reinterpret_cast(mConstraintOrCm[edgeId]); } + PX_FORCE_INLINE Dy::Constraint* getConstraintUnsafe(IG::EdgeIndex edgeId) const { return reinterpret_cast(mConstraintOrCm[edgeId]); } + + PX_FORCE_INLINE Sc::Interaction* getInteraction(IG::EdgeIndex edgeId) const { return mInteractions[edgeId]; } + + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + + bool checkInternalConsistency(); + + +private: + + friend class ThirdPassTask; + friend class PostThirdPassTask; + + bool validateDeactivations() const; + + PX_NOCOPY(SimpleIslandManager) +}; + + + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimulationController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimulationController.h new file mode 100644 index 0000000..670e7a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsSimulationController.h @@ -0,0 +1,356 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_SIMULATION_CONTROLLER_H +#define PXS_SIMULATION_CONTROLLER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxPreprocessor.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxPinnedArray.h" +#include "foundation/PxUserAllocated.h" +#include "PxScene.h" +#include "PxParticleSystem.h" + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + #include "PxFLIPParticleSystem.h" + #include "PxMPMParticleSystem.h" + + // if these assert fail adjust the type here and in the forward declaration of the #else section just below + PX_COMPILE_TIME_ASSERT(sizeof(physx::PxMPMParticleDataFlag::Enum) == sizeof(physx::PxU32)); + PX_COMPILE_TIME_ASSERT(sizeof(physx::PxSparseGridDataFlag::Enum) == sizeof(physx::PxU32)); +#else + namespace PxMPMParticleDataFlag { enum Enum : physx::PxU32; } + namespace PxSparseGridDataFlag { enum Enum : physx::PxU32; } +#endif + +#include "PxParticleSolverType.h" + +namespace physx +{ + namespace Dy + { + class Context; + struct Constraint; + class FeatherstoneArticulation; + struct ArticulationJointCore; + class ParticleSystemCore; + class ParticleSystem; + +#if PX_SUPPORT_GPU_PHYSX + class SoftBody; + class FEMCloth; + class HairSystem; +#endif + } + + namespace Cm + { + class EventProfiler; + } + + namespace Bp + { + class BoundsArray; + class BroadPhase; + class AABBManagerBase; + } + + namespace IG + { + class SimpleIslandManager; + class IslandSim; + } + + namespace Sc + { + class BodySim; + } + + class PxNodeIndex; + class PxsTransformCache; + class PxvNphaseImplementationContext; + class PxBaseTask; + class PxsContext; + + struct PxsShapeSim; + class PxsRigidBody; + class PxsKernelWranglerManager; + class PxsHeapMemoryAllocatorManager; + class PxgParticleSystemCore; + struct PxConeLimitedConstraint; + + class PxPhysXGpu; + + struct PxgSolverConstraintManagerConstants; + + class PxsSimulationControllerCallback : public PxUserAllocated + { + public: + virtual void updateScBodyAndShapeSim(PxBaseTask* continuation) = 0; + virtual PxU32 getNbCcdBodies() = 0; + + virtual ~PxsSimulationControllerCallback() {} + }; + + + class PxsSimulationController : public PxUserAllocated + { + public: + PxsSimulationController(PxsSimulationControllerCallback* callback): mCallback(callback){} + virtual ~PxsSimulationController(){} + + virtual void addJoint(const PxU32 edgeIndex, Dy::Constraint* constraint, IG::IslandSim& islandSim, PxArray& jointIndices, + PxPinnedArray& managerIter, PxU32 uniqueId) = 0; + virtual void removeJoint(const PxU32 edgeIndex, Dy::Constraint* constraint, PxArray& jointIndices, IG::IslandSim& islandSim) = 0; + virtual void addShape(PxsShapeSim* shapeSim, const PxU32 index) = 0; + virtual void reinsertShape(PxsShapeSim* shapeSim, const PxU32 index) = 0; + virtual void updateShape(PxsShapeSim& /*shapeSim*/, const PxNodeIndex& /*index*/) {} + virtual void removeShape(const PxU32 index) = 0; + + virtual void addDynamic(PxsRigidBody* rigidBody, const PxNodeIndex& nodeIndex) = 0; + virtual void addDynamics(PxsRigidBody** rigidBody, const PxU32* nodeIndex, PxU32 nbToProcess) = 0; + virtual void addArticulation(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void releaseArticulation(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void releaseDeferredArticulationIds() = 0; + +#if PX_SUPPORT_GPU_PHYSX + virtual void addSoftBody(Dy::SoftBody* softBody, const PxNodeIndex& nodeIndex) = 0; + virtual void releaseSoftBody(Dy::SoftBody* softBody) = 0; + virtual void releaseDeferredSoftBodyIds() = 0; + virtual void activateSoftbody(Dy::SoftBody*) = 0; + virtual void deactivateSoftbody(Dy::SoftBody*) = 0; + virtual void activateSoftbodySelfCollision(Dy::SoftBody*) = 0; + virtual void deactivateSoftbodySelfCollision(Dy::SoftBody*) = 0; + virtual void setSoftBodyWakeCounter(Dy::SoftBody*) = 0; + + virtual void addParticleFilter(Dy::SoftBody*softBodySystem, Dy::ParticleSystem* particleSystem, + PxU32 particleId, PxU32 userBufferId, PxU32 tetId) = 0; + virtual void removeParticleFilter(Dy::SoftBody* softBodySystem, + const Dy::ParticleSystem* particleSystem, PxU32 particleId, PxU32 userBufferId, PxU32 tetId) = 0; + + virtual PxU32 addParticleAttachment(Dy::SoftBody*softBodySystem, const Dy::ParticleSystem* particleSystem, + PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentrics, const bool isActive) = 0; + virtual void removeParticleAttachment(Dy::SoftBody* softBody, PxU32 handle) = 0; + + virtual void addRigidFilter(Dy::SoftBody*softBodySystem, const PxNodeIndex& softBodyNodeIndex, + const PxNodeIndex& rigidNodeIndex, PxU32 vertIndex) = 0; + virtual void removeRigidFilter(Dy::SoftBody* softBodySystem, + const PxNodeIndex& rigidNodeIndex, PxU32 vertIndex) = 0; + + virtual PxU32 addRigidAttachment(Dy::SoftBody*softBodySystem, const PxNodeIndex& softBodyNodeIndex, + PxsRigidBody* rigidBody, const PxNodeIndex& rigidNodeIndex, PxU32 vertIndex, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint, const bool isActive) = 0; + virtual void removeRigidAttachment(Dy::SoftBody* softBody, PxU32 handle) = 0; + + virtual void addTetRigidFilter(Dy::SoftBody* softBodySystem, + const PxNodeIndex& rigidNodeIndex, PxU32 tetId) = 0; + + virtual PxU32 addTetRigidAttachment(Dy::SoftBody* softBodySystem, + PxsRigidBody* rigidBody, const PxNodeIndex& rigidNodeIndex, PxU32 tetIdx, + const PxVec4& barycentrics, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint, + const bool isActive) = 0; + + virtual void removeTetRigidFilter(Dy::SoftBody* softBody, + const PxNodeIndex& rigidNodeIndex, PxU32 tetId) = 0; + + virtual void addSoftBodyFilter(Dy::SoftBody* softBody0, Dy::SoftBody* softBody1, PxU32 tetIdx0, + PxU32 tetIdx1) = 0; + virtual void removeSoftBodyFilter(Dy::SoftBody* softBody0, Dy::SoftBody* softBody1, PxU32 tetIdx0, + PxU32 tetId1) = 0; + virtual void addSoftBodyFilters(Dy::SoftBody* softBody0, Dy::SoftBody* softBody1, PxU32* tetIndices0, PxU32* tetIndices1, + PxU32 tetIndicesSize) = 0; + virtual void removeSoftBodyFilters(Dy::SoftBody* softBody0, Dy::SoftBody* softBody1, PxU32* tetIndices0, PxU32* tetIndices1, + PxU32 tetIndicesSize) = 0; + + virtual PxU32 addSoftBodyAttachment(Dy::SoftBody* softBody0, Dy::SoftBody* softBody1, PxU32 tetIdx0, PxU32 tetIdx1, + const PxVec4& tetBarycentric0, const PxVec4& tetBarycentric1, PxConeLimitedConstraint* constraint, const bool isActive) = 0; + virtual void removeSoftBodyAttachment(Dy::SoftBody* softBody0, PxU32 handle) = 0; + + virtual void addClothFilter(Dy::SoftBody* softBody, Dy::FEMCloth* cloth, PxU32 triIdx, + PxU32 tetIdx) = 0; + virtual void removeClothFilter(Dy::SoftBody* softBody, Dy::FEMCloth*, PxU32 triId, + PxU32 tetId) = 0; + + virtual PxU32 addClothAttachment(Dy::SoftBody* softBody, Dy::FEMCloth* cloth, PxU32 triIdx, + const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint, + const bool isActive) = 0; + virtual void removeClothAttachment(Dy::SoftBody* softBody,PxU32 handle) = 0; + + virtual void addFEMCloth(Dy::FEMCloth* femCloth, const PxNodeIndex& nodeIndex) = 0; + virtual void releaseFEMCloth(Dy::FEMCloth* femCloth) = 0; + virtual void releaseDeferredFEMClothIds() = 0; + virtual void activateCloth(Dy::FEMCloth* femCloth) = 0; + virtual void deactivateCloth(Dy::FEMCloth* femCloth) = 0; + virtual void setClothWakeCounter(Dy::FEMCloth*) = 0; + + virtual void addRigidFilter(Dy::FEMCloth* cloth, + const PxNodeIndex& rigidNodeIndex, PxU32 vertId) = 0; + + virtual void removeRigidFilter(Dy::FEMCloth* cloth, + const PxNodeIndex& rigidNodeIndex, PxU32 vertId) = 0; + + virtual PxU32 addRigidAttachment(Dy::FEMCloth* cloth, const PxNodeIndex& clothNodeIndex, + PxsRigidBody* rigidBody, const PxNodeIndex& rigidNodeIndex, PxU32 vertIndex, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint, const bool isActive) = 0; + virtual void removeRigidAttachment(Dy::FEMCloth* cloth, PxU32 handle) = 0; + + virtual void addTriRigidFilter(Dy::FEMCloth* cloth, + const PxNodeIndex& rigidNodeIndex, PxU32 triIdx) = 0; + + virtual void removeTriRigidFilter(Dy::FEMCloth* cloth, + const PxNodeIndex& rigidNodeIndex, PxU32 triIdx) = 0; + + virtual PxU32 addTriRigidAttachment(Dy::FEMCloth* cloth, + PxsRigidBody* rigidBody, const PxNodeIndex& rigidNodeIndex, PxU32 triIdx, const PxVec4& barycentrics, + const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint, + const bool isActive) = 0; + + virtual void removeTriRigidAttachment(Dy::FEMCloth* cloth, PxU32 handle) = 0; + + virtual void addClothFilter(Dy::FEMCloth* cloth0, Dy::FEMCloth* cloth1, PxU32 triIdx0, PxU32 triIdx1) = 0; + virtual void removeClothFilter(Dy::FEMCloth* cloth0, Dy::FEMCloth* cloth1, PxU32 triIdx0, PxU32 triId1) = 0; + + virtual PxU32 addTriClothAttachment(Dy::FEMCloth* cloth0, Dy::FEMCloth* cloth1, PxU32 triIdx0, PxU32 triIdx1, + const PxVec4& triBarycentric0, const PxVec4& triBarycentric1, const bool addToActive) = 0; + + virtual void removeTriClothAttachment(Dy::FEMCloth* cloth0, PxU32 handle) = 0; + + + virtual void addParticleSystem(Dy::ParticleSystem* particleSystem, const PxNodeIndex& nodeIndex, PxParticleSolverType::Enum type) = 0; + virtual void releaseParticleSystem(Dy::ParticleSystem* particleSystem, PxParticleSolverType::Enum type) = 0; + virtual void releaseDeferredParticleSystemIds() = 0; + + virtual void addHairSystem(Dy::HairSystem* hairSystem, const PxNodeIndex& nodeIndex) = 0; + virtual void releaseHairSystem(Dy::HairSystem* hairSystem) = 0; + virtual void releaseDeferredHairSystemIds() = 0; + virtual void activateHairSystem(Dy::HairSystem*) = 0; + virtual void deactivateHairSystem(Dy::HairSystem*) = 0; + virtual void setHairSystemWakeCounter(Dy::HairSystem*) = 0; +#endif + + virtual void flush() = 0; + + virtual void updateDynamic(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void updateJoint(const PxU32 edgeIndex, Dy::Constraint* constraint) = 0; + virtual void updateBodies(PxsRigidBody** rigidBodies, PxU32* nodeIndices, const PxU32 nbBodies) = 0; + virtual void updateBodies(PxBaseTask* continuation) = 0; + virtual void updateShapes(PxBaseTask* continuation) = 0; + virtual void preIntegrateAndUpdateBound(PxBaseTask* continuation, const PxVec3 gravity, const PxReal dt) = 0; + virtual void updateParticleSystemsAndSoftBodies() = 0; + virtual void sortContacts() = 0; + virtual void update(PxBitMapPinned& changedHandleMap) = 0; + virtual void updateArticulation(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void updateArticulationJoint(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void updateArticulationExtAccel(Dy::FeatherstoneArticulation* articulation, const PxNodeIndex& nodeIndex) = 0; + virtual void updateArticulationAfterIntegration(PxsContext* llContext, Bp::AABBManagerBase* aabbManager, PxArray& ccdBodies, + PxBaseTask* continuation, IG::IslandSim& islandSim, const float dt) = 0; + + virtual void mergeChangedAABBMgHandle(const PxU32 maxAABBMgHandles, const bool suppressedReadback) = 0; + virtual void gpuDmabackData(PxsTransformCache& cache, Bp::BoundsArray& boundArray, PxBitMapPinned& changedAABBMgrHandles, bool suppressReadback) = 0; + virtual void updateScBodyAndShapeSim(PxsTransformCache& cache, Bp::BoundsArray& boundArray, PxBaseTask* continuation) = 0; + virtual PxU32* getActiveBodies() = 0; + virtual PxU32* getDeactiveBodies() = 0; + virtual void** getRigidBodies() = 0; + virtual PxU32 getNbBodies() = 0; + + virtual PxU32* getUnfrozenShapes() = 0; + virtual PxU32* getFrozenShapes() = 0; + virtual PxsShapeSim** getShapeSims() = 0; + virtual PxU32 getNbFrozenShapes() = 0; + virtual PxU32 getNbUnfrozenShapes() = 0; + virtual PxU32 getNbShapes() = 0; + + virtual void clear() = 0; + virtual void setBounds(Bp::BoundsArray* boundArray) = 0; + virtual void reserve(const PxU32 nbBodies) = 0; + + virtual PxU32 getArticulationRemapIndex(const PxU32 nodeIndex) = 0; + //virtual void setParticleSystemManager(PxgParticleSystemCore* psCore) = 0; + + virtual void copyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbCopyArticulations, void* copyEvent) = 0; + virtual void applyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbUpdatedArticulations, + void* waitEvent, void* signalEvent) = 0; + + //KS - the methods below here should probably be wrapped in if PX_SUPPORT_GPU_PHYSX + + virtual void copySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbCopySoftBodies, const PxU32 maxSize, void* copyEvent) = 0; + virtual void applySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbUpdatedSoftBodies, const PxU32 maxSize, void* applyEvent) = 0; + virtual void copyContactData(Dy::Context* dyContext, void* data, const PxU32 maxContactPairs, void* numContactPairs, void* copyEvent) = 0; + virtual void copyBodyData(PxGpuBodyData* data, PxGpuActorPair* index, const PxU32 nbUpdatedActors, void* copyEvent) = 0; + virtual void applyActorData(void* data, PxGpuActorPair* index, PxActorCacheFlag::Enum flag, const PxU32 nbUpdatedActors, void* waitEvent, void* signalEvent) = 0; + + virtual void syncParticleData() = 0; + + virtual void updateBoundsAndShapes(Bp::AABBManagerBase& aabbManager, const bool useGpuBp, const bool useDirectApi) = 0; + + virtual void computeDenseJacobians(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + virtual void computeGeneralizedMassMatrices(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + virtual void computeGeneralizedGravityForces(const PxIndexDataPair* indices, PxU32 nbIndices, const PxVec3& gravity, void* computeEvent) = 0; + virtual void computeCoriolisAndCentrifugalForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) = 0; + virtual void applyParticleBufferData(const PxU32* indices, const PxGpuParticleBufferIndexPair* indexPairs, const PxParticleBufferFlags* flags, PxU32 nbUpdatedBuffers, void* waitEvent, void* signalEvent) = 0; + + virtual void flushInsertions() = 0; + +#if PX_SUPPORT_GPU_PHYSX + virtual PxU32 getNbDeactivatedFEMCloth() const = 0; + virtual PxU32 getNbActivatedFEMCloth() const = 0; + + virtual Dy::FEMCloth** getDeactivatedFEMCloths() const = 0; + virtual Dy::FEMCloth** getActivatedFEMCloths() const = 0; + + + virtual PxU32 getNbDeactivatedSoftbodies() const = 0; + virtual PxU32 getNbActivatedSoftbodies() const = 0; + + virtual const PxReal* getSoftBodyWakeCounters() const = 0; + + virtual Dy::SoftBody** getDeactivatedSoftbodies() const = 0; + virtual Dy::SoftBody** getActivatedSoftbodies() const = 0; + + virtual bool hasFEMCloth() const = 0; + virtual bool hasSoftBodies() const = 0; + + virtual PxU32 getNbDeactivatedHairSystems() const = 0; + virtual PxU32 getNbActivatedHairSystems() const = 0; + virtual Dy::HairSystem** getDeactivatedHairSystems() const = 0; + virtual Dy::HairSystem** getActivatedHairSystems() const = 0; + virtual bool hasHairSystems() const = 0; + +#endif + + virtual void* getMPMDataPointer(const Dy::ParticleSystem& psLL, PxMPMParticleDataFlag::Enum flags) = 0; + virtual void* getSparseGridDataPointer(const Dy::ParticleSystem& psLL, PxSparseGridDataFlag::Enum flags, PxParticleSolverType::Enum type) = 0; + + protected: + PxsSimulationControllerCallback* mCallback; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsTransformCache.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsTransformCache.h new file mode 100644 index 0000000..5af57ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxsTransformCache.h @@ -0,0 +1,140 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXS_TRANSFORM_CACHE_H +#define PXS_TRANSFORM_CACHE_H + +#include "CmIDPool.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxTransform.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxPinnedArray.h" + +#define PX_DEFAULT_CACHE_SIZE 512 + +namespace physx +{ + struct PxsTransformFlag + { + enum Flags + { + eFROZEN = (1 << 0) + }; + }; + + struct PX_ALIGN_PREFIX(16) PxsCachedTransform + { + PxTransform transform; + PxU32 flags; + + PX_FORCE_INLINE PxU32 isFrozen() const { return flags & PxsTransformFlag::eFROZEN; } + } + PX_ALIGN_SUFFIX(16); + + class PxsTransformCache : public PxUserAllocated + { + typedef PxU32 RefCountType; + + public: + PxsTransformCache(PxVirtualAllocatorCallback& allocatorCallback) : mTransformCache(PxVirtualAllocator(&allocatorCallback)), mHasAnythingChanged(true) + { + /*mTransformCache.reserve(PX_DEFAULT_CACHE_SIZE); + mTransformCache.forceSize_Unsafe(PX_DEFAULT_CACHE_SIZE);*/ + mUsedSize = 0; + } + + void initEntry(PxU32 index) + { + PxU32 oldCapacity = mTransformCache.capacity(); + if (index >= oldCapacity) + { + PxU32 newCapacity = PxNextPowerOfTwo(index); + mTransformCache.reserve(newCapacity); + mTransformCache.forceSize_Unsafe(newCapacity); + } + mUsedSize = PxMax(mUsedSize, index + 1u); + } + + PX_FORCE_INLINE void setTransformCache(const PxTransform& transform, const PxU32 flags, const PxU32 index) + { + mTransformCache[index].transform = transform; + mTransformCache[index].flags = flags; + mHasAnythingChanged = true; + } + + PX_FORCE_INLINE const PxsCachedTransform& getTransformCache(const PxU32 index) const + { + return mTransformCache[index]; + } + + PX_FORCE_INLINE PxsCachedTransform& getTransformCache(const PxU32 index) + { + return mTransformCache[index]; + } + + PX_FORCE_INLINE void shiftTransforms(const PxVec3& shift) + { + for (PxU32 i = 0; i < mTransformCache.capacity(); i++) + { + mTransformCache[i].transform.p += shift; + } + mHasAnythingChanged = true; + } + + PX_FORCE_INLINE PxU32 getTotalSize() const + { + return mUsedSize; + } + + PX_FORCE_INLINE const PxsCachedTransform* getTransforms() const + { + return mTransformCache.begin(); + } + + PX_FORCE_INLINE PxsCachedTransform* getTransforms() + { + return mTransformCache.begin(); + } + + PX_FORCE_INLINE PxPinnedArray* getCachedTransformArray() + { + return &mTransformCache; + } + + PX_FORCE_INLINE void resetChangedState() { mHasAnythingChanged = false; } + PX_FORCE_INLINE void setChangedState() { mHasAnythingChanged = true; } + PX_FORCE_INLINE bool hasChanged() const { return mHasAnythingChanged; } + + private: + PxPinnedArray mTransformCache; + PxU32 mUsedSize; + bool mHasAnythingChanged; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxvNphaseImplementationContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxvNphaseImplementationContext.h new file mode 100644 index 0000000..dc5402a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/include/PxvNphaseImplementationContext.h @@ -0,0 +1,261 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXV_NPHASE_IMPLEMENTATION_CONTEXT_H +#define PXV_NPHASE_IMPLEMENTATION_CONTEXT_H + +#include "PxSceneDesc.h" +#include "PxsContactManagerState.h" +#include "foundation/PxArray.h" +#include "PxsNphaseCommon.h" + +// PT: TODO: forward decl don't work easily with templates, to revisit +#include "PxsMaterialCore.h" +#include "PxsFEMClothMaterialCore.h" +#include "PxsFEMSoftBodyMaterialCore.h" +#include "PxsFLIPMaterialCore.h" +#include "PxsMPMMaterialCore.h" +#include "PxsPBDMaterialCore.h" + +namespace physx +{ + +namespace IG +{ + class SimpleIslandManager; + class IslandSim; + typedef PxU32 EdgeIndex; +} + +namespace Dy +{ + class Context; +} + +namespace Cm +{ + class FanoutTask; +} + +namespace Sc +{ + class ShapeInteraction; +} + +class PxNodeIndex; +class PxBaseTask; +class PxsContext; +struct PxsShapeCore; + +class PxsContactManager; +struct PxsContactManagerOutput; +struct PxsTorsionalFrictionData; + + +class PxsContactManagerOutputIterator +{ + PxU32 mOffsets[1<getPose(); + if (pair.mBa1) + pair.mBa1->getPose(); +#endif +} + +#if CCD_DEBUG_PRINTS + +// PT: this is copied from PxsRigidBody.h and will need to be adapted if we ever need it again + +// AP newccd todo: merge into get both velocities, compute inverse transform once, precompute mLastTransform.getInverse() +PX_FORCE_INLINE PxVec3 getLinearMotionVelocity(PxReal invDt) const +{ + // delta(t0(x))=t1(x) + // delta(t0(t0`(x)))=t1(t0`(x)) + // delta(x)=t1(t0`(x)) + const PxVec3 deltaP = mCore->body2World.p - getLastCCDTransform().p; + return deltaP * invDt; +} + +PX_FORCE_INLINE PxVec3 getAngularMotionVelocity(PxReal invDt) const +{ + const PxQuat deltaQ = mCore->body2World.q * getLastCCDTransform().q.getConjugate(); + PxVec3 axis; + PxReal angle; + deltaQ.toRadiansAndUnitAxis(angle, axis); + return axis * angle * invDt; +} + +PX_FORCE_INLINE PxVec3 getLinearMotionVelocity(PxReal dt, const PxsBodyCore* PX_RESTRICT bodyCore) const +{ + // delta(t0(x))=t1(x) + // delta(t0(t0`(x)))=t1(t0`(x)) + // delta(x)=t1(t0`(x)) + const PxVec3 deltaP = bodyCore->body2World.p - getLastCCDTransform().p; + return deltaP * 1.0f / dt; +} + +PX_FORCE_INLINE PxVec3 getAngularMotionVelocity(PxReal dt, const PxsBodyCore* PX_RESTRICT bodyCore) const +{ + const PxQuat deltaQ = bodyCore->body2World.q * getLastCCDTransform().q.getConjugate(); + PxVec3 axis; + PxReal angle; + deltaQ.toRadiansAndUnitAxis(angle, axis); + return axis * angle * 1.0f/dt; +} + +#include +#pragma warning(disable: 4313) +namespace physx { + +static const char* gGeomTypes[PxGeometryType::eGEOMETRY_COUNT+1] = { + "sphere", "plane", "capsule", "box", "convex", "trimesh", "heightfield", "*" +}; + +FILE* gCCDLog = NULL; + +static inline void openCCDLog() +{ + if (gCCDLog) + { + fclose(gCCDLog); + gCCDLog = NULL; + } + gCCDLog = fopen("c:\\ccd.txt", "wt"); + fprintf(gCCDLog, ">>>>>>>>>>>>>>>>>>>>>>>>>>> CCD START FRAME <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"); +} + +static inline void printSeparator( + const char* prefix, PxU32 pass, PxsRigidBody* atom0, PxGeometryType::Enum g0, PxsRigidBody* atom1, PxGeometryType::Enum g1) +{ + fprintf(gCCDLog, "------- %s pass %d (%s %x) vs (%s %x)\n", prefix, pass, gGeomTypes[g0], atom0, gGeomTypes[g1], atom1); + fflush(gCCDLog); +} + +static inline void printCCDToi( + const char* header, PxF32 t, const PxVec3& v, + PxsRigidBody* atom0, PxGeometryType::Enum g0, PxsRigidBody* atom1, PxGeometryType::Enum g1 +) +{ + fprintf(gCCDLog, "%s (%s %x vs %s %x): %.5f, (%.2f, %.2f, %.2f)\n", header, gGeomTypes[g0], atom0, gGeomTypes[g1], atom1, t, v.x, v.y, v.z); + fflush(gCCDLog); +} + +static inline void printCCDPair(const char* header, PxsCCDPair& pair) +{ + printCCDToi(header, pair.mMinToi, pair.mMinToiNormal, pair.mBa0, pair.mG0, pair.mBa1, pair.mG1); +} + +// also used in PxcSweepConvexMesh.cpp +void printCCDDebug(const char* msg, const PxsRigidBody* atom0, PxGeometryType::Enum g0, bool printPtr) +{ + fprintf(gCCDLog, " %s (%s %x)\n", msg, gGeomTypes[g0], printPtr ? atom0 : 0); + fflush(gCCDLog); +} + +// also used in PxcSweepConvexMesh.cpp +void printShape( + PxsRigidBody* atom0, PxGeometryType::Enum g0, const char* annotation, PxReal dt, PxU32 pass, bool printPtr) +{ + PX_UNUSED(pass); + + // PT: I'm leaving this here but I doubt it works. The code passes "dt" to a function that wants "invDt".... + + fprintf(gCCDLog, "%s (%s %x) atom=(%.2f, %.2f, %.2f)>(%.2f, %.2f, %.2f) v=(%.1f, %.1f, %.1f), mv=(%.1f, %.1f, %.1f)\n", + annotation, gGeomTypes[g0], printPtr ? atom0 : 0, + atom0->getLastCCDTransform().p.x, atom0->getLastCCDTransform().p.y, atom0->getLastCCDTransform().p.z, + atom0->getPose().p.x, atom0->getPose().p.y, atom0->getPose().p.z, + atom0->getLinearVelocity().x, atom0->getLinearVelocity().y, atom0->getLinearVelocity().z, + atom0->getLinearMotionVelocity(dt).x, atom0->getLinearMotionVelocity(dt).y, atom0->getLinearMotionVelocity(dt).z ); + fflush(gCCDLog); + #if DEBUG_RENDER_CCD && DEBUG_RENDER_CCD_ATOM_PTR + if (!DEBUG_RENDER_CCD_FIRST_PASS_ONLY || pass == 0) + { + PxScene *s; PxGetPhysics()->getScenes(&s, 1, 0); + PxRenderOutput((PxRenderBufferImpl&)s->getRenderBuffer()) + << DebugText(atom0->getPose().p, 0.05f, "%x", atom0); + } + #endif +} + +static inline void flushCCDLog() +{ + fflush(gCCDLog); +} + +} // namespace physx + +#else + +namespace physx +{ + +void printShape(PxsRigidBody* /*atom0*/, PxGeometryType::Enum /*g0*/, const char* /*annotation*/, PxReal /*dt*/, PxU32 /*pass*/, bool printPtr = true) +{PX_UNUSED(printPtr);} + +static inline void openCCDLog() {} + +static inline void flushCCDLog() {} + +void printCCDDebug(const char* /*msg*/, const PxsRigidBody* /*atom0*/, PxGeometryType::Enum /*g0*/, bool printPtr = true) {PX_UNUSED(printPtr);} + +static inline void printSeparator( + const char* /*prefix*/, PxU32 /*pass*/, PxsRigidBody* /*atom0*/, PxGeometryType::Enum /*g0*/, + PxsRigidBody* /*atom1*/, PxGeometryType::Enum /*g1*/) {} +} // namespace physx +#endif + +float physx::computeCCDThreshold(const PxGeometry& geometry) +{ + // Box, Convex, Mesh and HeightField will compute local bounds and pose to world space. + // Sphere, Capsule & Plane will compute world space bounds directly. + + const PxReal inSphereRatio = 0.75f; + + //The CCD thresholds are as follows: + //(1) sphere = inSphereRatio * radius + //(2) plane = inf (we never need CCD against this shape) + //(3) capsule = inSphereRatio * radius + //(4) box = inSphereRatio * (box minimum extent axis) + //(5) convex = inSphereRatio * convex in-sphere * min scale + //(6) triangle mesh = 0.0f (polygons have 0 thickness) + //(7) heightfields = 0.0f (polygons have 0 thickness) + + //The decision to enter CCD depends on the sum of the shapes' CCD thresholds. One of the 2 shapes must be a + //sphere/capsule/box/convex so the sum of the CCD thresholds will be non-zero. + + switch (geometry.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& shape = static_cast(geometry); + return shape.radius*inSphereRatio; + } + case PxGeometryType::ePLANE: + { + return PX_MAX_REAL; + } + case PxGeometryType::eCAPSULE: + { + const PxCapsuleGeometry& shape = static_cast(geometry); + return shape.radius * inSphereRatio; + } + + case PxGeometryType::eBOX: + { + const PxBoxGeometry& shape = static_cast(geometry); + return PxMin(PxMin(shape.halfExtents.x, shape.halfExtents.y), shape.halfExtents.z)*inSphereRatio; + } + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& shape = static_cast(geometry); + const Gu::ConvexHullData& hullData = static_cast(shape.convexMesh)->getHull(); + return PxMin(shape.scale.scale.z, PxMin(shape.scale.scale.x, shape.scale.scale.y)) * hullData.mInternal.mRadius * inSphereRatio; + } + + case PxGeometryType::eTRIANGLEMESH: { return 0.0f; } + case PxGeometryType::eHEIGHTFIELD: { return 0.0f; } + case PxGeometryType::eTETRAHEDRONMESH: { return 0.0f; } + case PxGeometryType::ePARTICLESYSTEM: { return 0.0f; } + case PxGeometryType::eHAIRSYSTEM: { return 0.0f; } + case PxGeometryType::eCUSTOM: { return 0.0f; } + + default: + { + PX_ASSERT(0); + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Gu::computeBoundsWithCCDThreshold::computeBounds: Unknown shape type."); + } + } + return PX_MAX_REAL; +} + +static float computeBoundsWithCCDThreshold(PxVec3p& origin, PxVec3p& extent, const PxGeometry& geometry, const PxTransform& transform) //AABB in world space. +{ + const PxBounds3 bounds = computeBounds(geometry, transform); + + origin = bounds.getCenter(); + extent = bounds.getExtents(); + + return computeCCDThreshold(geometry); +} + +// PT: TODO: refactor with ShapeSim version (SIMD), simplify code when shape local pose = idt +static PX_INLINE PxTransform getShapeAbsPose(const PxsShapeCore* shapeCore, const PxsRigidCore* rigidCore, PxU32 isDynamic) +{ + if(isDynamic) + { + const PxsBodyCore* PX_RESTRICT bodyCore = static_cast(rigidCore); + return bodyCore->body2World * bodyCore->getBody2Actor().getInverse() *shapeCore->getTransform(); + } + else + { + return rigidCore->body2World * shapeCore->getTransform(); + } +} + +PxsCCDContext::PxsCCDContext(PxsContext* context, Dy::ThresholdStream& thresholdStream, PxvNphaseImplementationContext& nPhaseContext, PxReal ccdThreshold) : + mPostCCDSweepTask (context->getContextId(), this, "PxsContext.postCCDSweep"), + mPostCCDAdvanceTask (context->getContextId(), this, "PxsContext.postCCDAdvance"), + mPostCCDDepenetrateTask (context->getContextId(), this, "PxsContext.postCCDDepenetrate"), + mDisableCCDResweep (false), + miCCDPass (0), + mSweepTotalHits (0), + mCCDThreadContext (NULL), + mCCDPairsPerBatch (0), + mCCDMaxPasses (1), + mContext (context), + mThresholdStream (thresholdStream), + mNphaseContext (nPhaseContext), + mCCDThreshold (ccdThreshold) +{ +} + +PxsCCDContext::~PxsCCDContext() +{ +} + +PxTransform PxsCCDShape::getAbsPose(const PxsRigidBody* atom) const +{ + // PT: TODO: refactor with ShapeSim version (SIMD) - or with redundant getShapeAbsPose() above in this same file! + // PT: TODO: simplify code when shape local pose = idt + if(atom) + return atom->getPose() * atom->getCore().getBody2Actor().getInverse() * mShapeCore->getTransform(); + else + return mRigidCore->body2World * mShapeCore->getTransform(); +} + +PxTransform PxsCCDShape::getLastCCDAbsPose(const PxsRigidBody* atom) const +{ + // PT: TODO: refactor with ShapeSim version (SIMD) + // PT: TODO: simplify code when shape local pose = idt + return atom->getLastCCDTransform() * atom->getCore().getBody2Actor().getInverse() * mShapeCore->getTransform(); +} + +PxReal PxsCCDPair::sweepFindToi(PxcNpThreadContext& context, PxReal dt, PxU32 pass, PxReal ccdThreshold) +{ + printSeparator("findToi", pass, mBa0, mG0, NULL, PxGeometryType::eGEOMETRY_COUNT); + //Update shape transforms if necessary + updateShapes(); + + //Extract the bodies + PxsRigidBody* atom0 = mBa0; + PxsRigidBody* atom1 = mBa1; + PxsCCDShape* ccdShape0 = mCCDShape0; + PxsCCDShape* ccdShape1 = mCCDShape1; + PxGeometryType::Enum g0 = mG0, g1 = mG1; + + //If necessary, flip the bodies to make sure that g0 <= g1 + if(mG1 < mG0) + { + g0 = mG1; + g1 = mG0; + ccdShape0 = mCCDShape1; + ccdShape1 = mCCDShape0; + atom0 = mBa1; + atom1 = mBa0; + } + + PX_ALIGN(16, PxTransform tm0); + PX_ALIGN(16, PxTransform tm1); + PX_ALIGN(16, PxTransform lastTm0); + PX_ALIGN(16, PxTransform lastTm1); + + tm0 = ccdShape0->mCurrentTransform; + lastTm0 = ccdShape0->mPrevTransform; + + tm1 = ccdShape1->mCurrentTransform; + lastTm1 = ccdShape1->mPrevTransform; + + const PxVec3 trA = tm0.p - lastTm0.p; + const PxVec3 trB = tm1.p - lastTm1.p; + const PxVec3 relTr = trA - trB; + + // Do the sweep + PxVec3 sweepNormal(0.0f); + PxVec3 sweepPoint(0.0f); + + context.mDt = dt; + context.mCCDFaceIndex = PXC_CONTACT_NO_FACE_INDEX; + + //Cull the sweep hit based on the relative velocity along the normal + const PxReal fastMovingThresh0 = ccdShape0->mFastMovingThreshold; + const PxReal fastMovingThresh1 = ccdShape1->mFastMovingThreshold; + + const PxReal sumFastMovingThresh = PxMin(fastMovingThresh0 + fastMovingThresh1, ccdThreshold); + + PxReal toi = PX_MAX_REAL; + if(gUseGeometryQuery) + { + // PT: TODO: support restDistance & sumFastMovingThresh here + + PxVec3 unitDir = relTr; + const PxReal length = unitDir.normalize(); + + PxGeomSweepHit sweepHit; + if(PxGeometryQuery::sweep(unitDir, length, *ccdShape0->mGeometry, lastTm0, *ccdShape1->mGeometry, lastTm1, sweepHit, PxHitFlag::eDEFAULT|PxHitFlag::ePRECISE_SWEEP, 0.0f, PxGeometryQueryFlag::Enum(0), NULL)) + { + sweepNormal = sweepHit.normal; + sweepPoint = sweepHit.position; + context.mCCDFaceIndex = sweepHit.faceIndex; + + toi = sweepHit.distance/length; + } + } + else + { + const PxReal restDistance = PxMax(mCm->getWorkUnit().restDistance, 0.0f); + toi = Gu::SweepShapeShape(*ccdShape0, *ccdShape1, tm0, tm1, lastTm0, lastTm1, restDistance, sweepNormal, sweepPoint, mMinToi, context.mCCDFaceIndex, sumFastMovingThresh); + } + + //If toi is after the end of TOI, return no hit + if (toi >= 1.0f) + { + mToiType = PxsCCDPair::ePrecise; + mPenetration = 0.0f; + mPenetrationPostStep = 0.0f; + mMinToi = PX_MAX_REAL; // needs to be reset in case of resweep + return toi; + } + + PX_ASSERT(PxIsFinite(toi)); + PX_ASSERT(sweepNormal.isFinite()); + mFaceIndex = context.mCCDFaceIndex; + + //Work out linear motion (used to cull the sweep hit) + const PxReal linearMotion = relTr.dot(-sweepNormal); + + //If we swapped the shapes, swap them back + if(mG1 >= mG0) + sweepNormal = -sweepNormal; + + mToiType = PxsCCDPair::ePrecise; + + PxReal penetration = 0.0f; + PxReal penetrationPostStep = 0.0f; + + //If linear motion along normal < the CCD threshold, set toi to no-hit. + if((linearMotion) < sumFastMovingThresh) + { + mMinToi = PX_MAX_REAL; // needs to be reset in case of resweep + return PX_MAX_REAL; + } + else if(toi <= 0.0f) + { + //If the toi <= 0.0f, this implies an initial overlap. If the value < 0.0f, it implies penetration + PxReal stepRatio0 = atom0 ? atom0->mCCD->mTimeLeft : 1.0f; + PxReal stepRatio1 = atom1 ? atom1->mCCD->mTimeLeft : 1.0f; + + PxReal stepRatio = PxMin(stepRatio0, stepRatio1); + penetration = -toi; + + toi = 0.0f; + + if(stepRatio == 1.0f) + { + //If stepRatio == 1.f (i.e. neither body has stepped forwards any time at all) + //we extract the advance coefficients from the bodies and permit the bodies to step forwards a small amount + //to ensure that they won't remain jammed because TOI = 0.0 + const PxReal advance0 = atom0 ? atom0->mCore->ccdAdvanceCoefficient : 1.0f; + const PxReal advance1 = atom1 ? atom1->mCore->ccdAdvanceCoefficient : 1.0f; + const PxReal advance = PxMin(advance0, advance1); + + PxReal fastMoving = PxMin(fastMovingThresh0, atom1 ? fastMovingThresh1 : PX_MAX_REAL); + PxReal advanceCoeff = advance * fastMoving; + penetrationPostStep = advanceCoeff/linearMotion; + } + PX_ASSERT(PxIsFinite(toi)); + } + + //Store TOI, penetration and post-step (how much to step forward in initial overlap conditions) + mMinToi = toi; + mPenetration = penetration; + mPenetrationPostStep = penetrationPostStep; + + mMinToiPoint = sweepPoint; + + mMinToiNormal = sweepNormal; + + //Work out the materials for the contact (restitution, friction etc.) + context.mContactBuffer.count = 0; + context.mContactBuffer.contact(mMinToiPoint, mMinToiNormal, 0.0f, g1 == PxGeometryType::eTRIANGLEMESH || g1 == PxGeometryType::eHEIGHTFIELD? mFaceIndex : PXC_CONTACT_NO_FACE_INDEX); + + PxsMaterialInfo materialInfo; + + g_GetSingleMaterialMethodTable[g0](ccdShape0->mShapeCore, 0, context, &materialInfo); + g_GetSingleMaterialMethodTable[g1](ccdShape1->mShapeCore, 1, context, &materialInfo); + + const PxsMaterialData& data0 = *context.mMaterialManager->getMaterial(materialInfo.mMaterialIndex0); + const PxsMaterialData& data1 = *context.mMaterialManager->getMaterial(materialInfo.mMaterialIndex1); + + mRestitution = PxsCombineRestitution(data0, data1); + + PxU32 unused; + PxsCombineIsotropicFriction(data0, data1, mDynamicFriction, mStaticFriction, unused); + + mMaterialIndex0 = materialInfo.mMaterialIndex0; + mMaterialIndex1 = materialInfo.mMaterialIndex1; + + return toi; +} + +void PxsCCDPair::updateShapes() +{ + if(mBa0) + { + //If the CCD shape's update count doesn't match the body's update count, this shape needs its transforms and bounds re-calculated + if(mBa0->mCCD->mUpdateCount != mCCDShape0->mUpdateCount) + { + const PxTransform tm0 = mCCDShape0->getAbsPose(mBa0); + const PxTransform lastTm0 = mCCDShape0->getLastCCDAbsPose(mBa0); + + const PxVec3 trA = tm0.p - lastTm0.p; + + PxVec3p origin, extents; + computeBoundsWithCCDThreshold(origin, extents, mCCDShape0->mShapeCore->mGeometry.getGeometry(), tm0); + + mCCDShape0->mCenter = origin - trA; + mCCDShape0->mExtents = extents; + mCCDShape0->mPrevTransform = lastTm0; + mCCDShape0->mCurrentTransform = tm0; + mCCDShape0->mUpdateCount = mBa0->mCCD->mUpdateCount; + } + } + + if(mBa1) + { + //If the CCD shape's update count doesn't match the body's update count, this shape needs its transforms and bounds re-calculated + if(mBa1->mCCD->mUpdateCount != mCCDShape1->mUpdateCount) + { + const PxTransform tm1 = mCCDShape1->getAbsPose(mBa1); + const PxTransform lastTm1 = mCCDShape1->getLastCCDAbsPose(mBa1); + + const PxVec3 trB = tm1.p - lastTm1.p; + + PxVec3p origin, extents; + computeBoundsWithCCDThreshold(origin, extents, mCCDShape1->mShapeCore->mGeometry.getGeometry(), tm1); + + mCCDShape1->mCenter = origin - trB; + mCCDShape1->mExtents = extents; + mCCDShape1->mPrevTransform = lastTm1; + mCCDShape1->mCurrentTransform = tm1; + mCCDShape1->mUpdateCount = mBa1->mCCD->mUpdateCount; + } + } +} + +PxReal PxsCCDPair::sweepEstimateToi(PxReal ccdThreshold) +{ + //Update shape transforms if necessary + updateShapes(); + + //PxsRigidBody* atom1 = mBa1; + //PxsRigidBody* atom0 = mBa0; + PxsCCDShape* ccdShape0 = mCCDShape0; + PxsCCDShape* ccdShape1 = mCCDShape1; + PxGeometryType::Enum g0 = mG0, g1 = mG1; + PX_UNUSED(g0); + + //Flip shapes if necessary + if(mG1 < mG0) + { + g0 = mG1; + g1 = mG0; + /*atom0 = mBa1; + atom1 = mBa0;*/ + ccdShape0 = mCCDShape1; + ccdShape1 = mCCDShape0; + } + + //Extract previous/current transforms, translations etc. + const PxVec3 trA = ccdShape0->mCurrentTransform.p - ccdShape0->mPrevTransform.p; + const PxVec3 trB = ccdShape1->mCurrentTransform.p - ccdShape1->mPrevTransform.p; + const PxReal restDistance = PxMax(mCm->getWorkUnit().restDistance, 0.0f); + const PxVec3 relTr = trA - trB; + + //Work out the sum of the fast moving thresholds scaled by the step ratio + const PxReal fastMovingThresh0 = ccdShape0->mFastMovingThreshold; + const PxReal fastMovingThresh1 = ccdShape1->mFastMovingThreshold; + const PxReal sumFastMovingThresh = PxMin(fastMovingThresh0 + fastMovingThresh1, ccdThreshold); + + mToiType = eEstimate; + + //If the objects are not moving fast-enough relative to each-other to warrant CCD, set estimated time as PX_MAX_REAL + if((relTr.magnitudeSquared()) <= (sumFastMovingThresh * sumFastMovingThresh)) + { + mToiType = eEstimate; + mMinToi = PX_MAX_REAL; + return PX_MAX_REAL; + } + + //Otherwise, the objects *are* moving fast-enough so perform estimation pass + if(g1 == PxGeometryType::eTRIANGLEMESH) + { + //Special-case estimation code for meshes + const PxF32 toi = Gu::SweepEstimateAnyShapeMesh(*ccdShape0, *ccdShape1, restDistance, sumFastMovingThresh); + + mMinToi = toi; + return toi; + } + else if (g1 == PxGeometryType::eHEIGHTFIELD) + { + //Special-case estimation code for heightfields + const PxF32 toi = Gu::SweepEstimateAnyShapeHeightfield(*ccdShape0, *ccdShape1, restDistance, sumFastMovingThresh); + + mMinToi = toi; + return toi; + } + + //Generic estimation code for prim-prim sweeps + const PxVec3& centreA = ccdShape0->mCenter; + const PxVec3 extentsA = ccdShape0->mExtents + PxVec3(restDistance); + + const PxVec3& centreB = ccdShape1->mCenter; + const PxVec3& extentsB = ccdShape1->mExtents; + + const PxF32 toi = Gu::sweepAABBAABB(centreA, extentsA * 1.1f, centreB, extentsB * 1.1f, trA, trB); + mMinToi = toi; + return toi; +} + +bool PxsCCDPair::sweepAdvanceToToi(PxReal dt, bool clipTrajectoryToToi) +{ + PxsCCDShape* ccds0 = mCCDShape0; + PxsRigidBody* atom0 = mBa0; + PxsCCDShape* ccds1 = mCCDShape1; + PxsRigidBody* atom1 = mBa1; + + const PxsCCDPair* thisPair = this; + + //Both already had a pass so don't do anything + if ((atom0 == NULL || atom0->mCCD->mPassDone) && (atom1 == NULL || atom1->mCCD->mPassDone)) + return false; + + //Test to validate that they're both infinite mass objects. If so, there can be no response so terminate on a notification-only + if((atom0 == NULL || atom0->mCore->inverseMass == 0.0f) && (atom1 == NULL || atom1->mCore->inverseMass == 0.0f)) + return false; + + //If the TOI < 1.f. If not, this hit happens after this frame or at the very end of the frame. Either way, next frame can handle it + if (thisPair->mMinToi < 1.0f) + { + if(thisPair->mCm->getWorkUnit().flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE || thisPair->mMaxImpulse == 0.0f) + { + //Don't mark pass as done on either body + return true; + } + + const PxReal minToi = thisPair->mMinToi; + + const PxF32 penetration = -mPenetration * 10.0f; + + const PxVec3 minToiNormal = thisPair->mMinToiNormal; + + if (!minToiNormal.isNormalized()) + { + // somehow we got zero normal. This can happen for instance if two identical objects spawn exactly on top of one another + // abort ccd and clip to current toi + if (atom0 && !atom0->mCCD->mPassDone) + { + atom0->advancePrevPoseToToi(minToi); + atom0->advanceToToi(minToi, dt, true); + atom0->mCCD->mUpdateCount++; + } + return true; + } + + //Get the material indices... + const PxReal restitution = mRestitution; + const PxReal sFriction = mStaticFriction; + const PxReal dFriction = mDynamicFriction; + + PxVec3 v0(0.0f), v1(0.0f); + + PxReal invMass0(0.0f), invMass1(0.0f); +#if CCD_ANGULAR_IMPULSE + PxMat33 invInertia0(PxVec3(0.0f), PxVec3(0.0f), PxVec3(0.0f)), invInertia1(PxVec3(0.0f), PxVec3(0.0f), PxVec3(0.0f)); + PxVec3 localPoint0(0.0f), localPoint1(0.0f); +#endif + + const PxReal dom0 = mCm->getDominance0(); + const PxReal dom1 = mCm->getDominance1(); + + //Work out velocity and invMass for body 0 + if(atom0) + { + //Put contact point in local space, then find how much point is moving using point velocity... +#if CCD_ANGULAR_IMPULSE + localPoint0 = mMinToiPoint - trA.p; + v0 = atom0->mCore->linearVelocity + atom0->mCore->angularVelocity.cross(localPoint0); + + physx::Cm::transformInertiaTensor(atom0->mCore->inverseInertia, PxMat33(trA.q),invInertia0); + invInertia0 *= dom0; +#else + v0 = atom0->mCore->linearVelocity + atom0->mCore->angularVelocity.cross(ccds0->mCurrentTransform.p - atom0->mCore->body2World.p); +#endif + invMass0 = atom0->getInvMass() * dom0; + } + + //Work out velocity and invMass for body 1 + if(atom1) + { + //Put contact point in local space, then find how much point is moving using point velocity... +#if CCD_ANGULAR_IMPULSE + localPoint1 = mMinToiPoint - trB.p; + v1 = atom1->mCore->linearVelocity + atom1->mCore->angularVelocity.cross(localPoint1); + physx::Cm::transformInertiaTensor(atom1->mCore->inverseInertia, PxMat33(trB.q),invInertia1); + invInertia1 *= dom1; +#else + v1 = atom1->mCore->linearVelocity + atom1->mCore->angularVelocity.cross(ccds1->mCurrentTransform.p - atom1->mCore->body2World.p); +#endif + invMass1 = atom1->getInvMass() * dom1; + } + + PX_ASSERT(v0.isFinite() && v1.isFinite()); + + //Work out relative velocity + const PxVec3 vRel = v1 - v0; + + //Project relative velocity onto contact normal and bias with penetration + const PxReal relNorVel = vRel.dot(minToiNormal); + const PxReal relNorVelPlusPen = relNorVel + penetration; + +#if CCD_ANGULAR_IMPULSE + if(relNorVelPlusPen >= -1e-6f) + { + //we fall back on linear only parts... + localPoint0 = PxVec3(0.0f); + localPoint1 = PxVec3(0.0f); + v0 = atom0 ? atom0->getLinearVelocity() : PxVec3(0.0f); + v1 = atom1 ? atom1->getLinearVelocity() : PxVec3(0.0f); + vRel = v1 - v0; + relNorVel = vRel.dot(minToiNormal); + relNorVelPlusPen = relNorVel + penetration; + } +#endif + + //If the relative motion is moving towards each-other, respond + if(relNorVelPlusPen < -1e-6f) + { + PxReal sumRecipMass = invMass0 + invMass1; + + const PxReal jLin = relNorVelPlusPen; + const PxReal normalResponse = (1.0f + restitution) * jLin; + +#if CCD_ANGULAR_IMPULSE + const PxVec3 angularMom0 = invInertia0 * (localPoint0.cross(mMinToiNormal)); + const PxVec3 angularMom1 = invInertia1 * (localPoint1.cross(mMinToiNormal)); + + const PxReal jAng = minToiNormal.dot(angularMom0.cross(localPoint0) + angularMom1.cross(localPoint1)); + const PxReal impulseDivisor = sumRecipMass + jAng; +#else + const PxReal impulseDivisor = sumRecipMass; +#endif + const PxReal jImp = PxMax(-mMaxImpulse, normalResponse/impulseDivisor); + + PxVec3 j(0.0f); + + //If the user requested CCD friction, calculate friction forces. + //Note, CCD is *linear* so friction is also linear. The net result is that CCD friction can stop bodies' lateral motion so its better to have it disabled + //unless there's a real need for it. + if(mHasFriction) + { + const PxVec3 vPerp = vRel - relNorVel * minToiNormal; + PxVec3 tDir = vPerp; + const PxReal length = tDir.normalize(); + const PxReal vPerpImp = length/impulseDivisor; + PxF32 fricResponse = 0.0f; + const PxF32 staticResponse = (jImp*sFriction); + const PxF32 dynamicResponse = (jImp*dFriction); + + if (PxAbs(staticResponse) >= vPerpImp) + fricResponse = vPerpImp; + else + { + fricResponse = -dynamicResponse /* times m0 */; + } + + //const PxVec3 fricJ = -vPerp.getNormalized() * (fricResponse/impulseDivisor); + const PxVec3 fricJ = tDir * (fricResponse); + j = jImp * mMinToiNormal + fricJ; + } + else + { + j = jImp * mMinToiNormal; + } + + verifyCCDPair(*this); + //If we have a negative impulse value, then we need to apply it. If not, the bodies are separating (no impulse to apply). + if(jImp < 0.0f) + { + mAppliedForce = -jImp; + + //Adjust velocities + if((atom0 != NULL && atom0->mCCD->mPassDone) || + (atom1 != NULL && atom1->mCCD->mPassDone)) + { + mPenetrationPostStep = 0.0f; + } + else + { + if (atom0) + { + //atom0->mAcceleration.linear = atom0->getLinearVelocity(); // to provide pre-"solver" velocity in contact reports + + atom0->setLinearVelocity(atom0->getLinearVelocity() + j * invMass0); + atom0->constrainLinearVelocity(); + #if CCD_ANGULAR_IMPULSE + atom0->mAcceleration.angular = atom0->getAngularVelocity(); // to provide pre-"solver" velocity in contact reports + atom0->setAngularVelocity(atom0->getAngularVelocity() + invInertia0 * localPoint0.cross(j)); + atom0->constrainAngularVelocity(); + #endif + } + if (atom1) + { + //atom1->mAcceleration.linear = atom1->getLinearVelocity(); // to provide pre-"solver" velocity in contact reports + atom1->setLinearVelocity(atom1->getLinearVelocity() - j * invMass1); + atom1->constrainLinearVelocity(); + #if CCD_ANGULAR_IMPULSE + atom1->mAcceleration.angular = atom1->getAngularVelocity(); // to provide pre-"solver" velocity in contact reports + atom1->setAngularVelocity(atom1->getAngularVelocity() - invInertia1 * localPoint1.cross(j)); + atom1->constrainAngularVelocity(); + #endif + } + } + } + } + + //Update poses + if (atom0 && !atom0->mCCD->mPassDone) + { + atom0->advancePrevPoseToToi(minToi); + atom0->advanceToToi(minToi, dt, clipTrajectoryToToi && mPenetrationPostStep == 0.0f); + atom0->mCCD->mUpdateCount++; + } + if (atom1 && !atom1->mCCD->mPassDone) + { + atom1->advancePrevPoseToToi(minToi); + atom1->advanceToToi(minToi, dt, clipTrajectoryToToi && mPenetrationPostStep == 0.0f); + atom1->mCCD->mUpdateCount++; + } + + //If we had a penetration post-step (i.e. an initial overlap), step forwards slightly after collision response + if(mPenetrationPostStep > 0.0f) + { + if (atom0 && !atom0->mCCD->mPassDone) + { + atom0->advancePrevPoseToToi(mPenetrationPostStep); + if(clipTrajectoryToToi) + atom0->advanceToToi(mPenetrationPostStep, dt, clipTrajectoryToToi); + } + if (atom1 && !atom1->mCCD->mPassDone) + { + atom1->advancePrevPoseToToi(mPenetrationPostStep); + if(clipTrajectoryToToi) + atom1->advanceToToi(mPenetrationPostStep, dt, clipTrajectoryToToi); + } + } + //Mark passes as done + if (atom0) + { + atom0->mCCD->mPassDone = true; + atom0->mCCD->mHasAnyPassDone = true; + } + if (atom1) + { + atom1->mCCD->mPassDone = true; + atom1->mCCD->mHasAnyPassDone = true; + } + + return true; + //return false; + } + else + { + printCCDDebug("advToi: clean sweep", atom0, mG0); + } + + return false; +} + +namespace +{ + +struct IslandCompare +{ + bool operator()(PxsCCDPair& a, PxsCCDPair& b) const { return a.mIslandId < b.mIslandId; } +}; + +struct IslandPtrCompare +{ + bool operator()(PxsCCDPair*& a, PxsCCDPair*& b) const { return a->mIslandId < b->mIslandId; } +}; + +struct ToiCompare +{ + bool operator()(PxsCCDPair& a, PxsCCDPair& b) const + { + return (a.mMinToi < b.mMinToi) || + ((a.mMinToi == b.mMinToi) && (a.mBa1 != NULL && b.mBa1 == NULL)); + } +}; + +struct ToiPtrCompare +{ + bool operator()(PxsCCDPair*& a, PxsCCDPair*& b) const + { + return (a->mMinToi < b->mMinToi) || + ((a->mMinToi == b->mMinToi) && (a->mBa1 != NULL && b->mBa1 == NULL)); + } +}; + +// -------------------------------------------------------------- +/** +\brief Class to perform a set of sweep estimate tasks +*/ +class PxsCCDSweepTask : public Cm::Task +{ + PxsCCDPair** mPairs; + PxU32 mNumPairs; + PxReal mCCDThreshold; +public: + PxsCCDSweepTask(PxU64 contextID, PxsCCDPair** pairs, PxU32 nPairs, PxReal ccdThreshold) : + Cm::Task(contextID), mPairs(pairs), mNumPairs(nPairs), mCCDThreshold(ccdThreshold) + { + } + + virtual void runInternal() + { + for (PxU32 j = 0; j < mNumPairs; j++) + { + PxsCCDPair& pair = *mPairs[j]; + pair.sweepEstimateToi(mCCDThreshold); + pair.mEstimatePass = 0; + } + } + + virtual const char *getName() const + { + return "PxsContext.CCDSweep"; + } + +private: + PxsCCDSweepTask& operator=(const PxsCCDSweepTask&); +}; + +#define ENABLE_RESWEEP 1 + +// -------------------------------------------------------------- +/** +\brief Class to advance a set of islands +*/ +class PxsCCDAdvanceTask : public Cm::Task +{ + PxsCCDPair** mCCDPairs; + PxU32 mNumPairs; + PxsContext* mContext; + PxsCCDContext* mCCDContext; + PxReal mDt; + PxU32 mCCDPass; + const PxsCCDBodyArray& mCCDBodies; + + PxU32 mFirstThreadIsland; + PxU32 mIslandsPerThread; + PxU32 mTotalIslandCount; + PxU32 mFirstIslandPair; // pairs are sorted by island + PxsCCDBody** mIslandBodies; + PxU16* mNumIslandBodies; + PxI32* mSweepTotalHits; + bool mClipTrajectory; + bool mDisableResweep; + + PxsCCDAdvanceTask& operator=(const PxsCCDAdvanceTask&); +public: + PxsCCDAdvanceTask(PxsCCDPair** pairs, PxU32 nPairs, const PxsCCDBodyArray& ccdBodies, + PxsContext* context, PxsCCDContext* ccdContext, PxReal dt, PxU32 ccdPass, + PxU32 firstIslandPair, PxU32 firstThreadIsland, PxU32 islandsPerThread, PxU32 totalIslands, + PxsCCDBody** islandBodies, PxU16* numIslandBodies, bool clipTrajectory, bool disableResweep, + PxI32* sweepTotalHits) + : Cm::Task(context->getContextId()), mCCDPairs(pairs), mNumPairs(nPairs), mContext(context), mCCDContext(ccdContext), mDt(dt), + mCCDPass(ccdPass), mCCDBodies(ccdBodies), mFirstThreadIsland(firstThreadIsland), + mIslandsPerThread(islandsPerThread), mTotalIslandCount(totalIslands), mFirstIslandPair(firstIslandPair), + mIslandBodies(islandBodies), mNumIslandBodies(numIslandBodies), mSweepTotalHits(sweepTotalHits), + mClipTrajectory(clipTrajectory), mDisableResweep(disableResweep) + + { + PX_ASSERT(mFirstIslandPair < mNumPairs); + } + + virtual void runInternal() + { + PxI32 sweepTotalHits = 0; + + PxcNpThreadContext* threadContext = mContext->getNpThreadContext(); + + PxReal ccdThreshold = mCCDContext->getCCDThreshold(); + + // -------------------------------------------------------------------------------------- + // loop over island labels assigned to this thread + PxU32 islandStart = mFirstIslandPair; + PxU32 lastIsland = PxMin(mFirstThreadIsland + mIslandsPerThread, mTotalIslandCount); + for (PxU32 iIsland = mFirstThreadIsland; iIsland < lastIsland; iIsland++) + { + if (islandStart >= mNumPairs) + // this is possible when for instance there are two islands with 0 pairs in the second + // since islands are initially segmented using bodies, not pairs, it can happen + break; + + // -------------------------------------------------------------------------------------- + // sort all pairs within current island by toi + PxU32 islandEnd = islandStart+1; + PX_ASSERT(mCCDPairs[islandStart]->mIslandId == iIsland); + while (islandEnd < mNumPairs && mCCDPairs[islandEnd]->mIslandId == iIsland) // find first index past the current island id + islandEnd++; + + if (islandEnd > islandStart+1) + PxSort(mCCDPairs+islandStart, islandEnd-islandStart, ToiPtrCompare()); + + PX_ASSERT(islandEnd <= mNumPairs); + + // -------------------------------------------------------------------------------------- + // advance all affected pairs within each island to min toi + // for each pair (A,B) in toi order, find any later-toi pairs that collide against A or B + // and resweep against changed trajectories of either A or B (excluding statics and kinematics) + PxReal islandMinToi = PX_MAX_REAL; + PxU32 estimatePass = 1; + + PxReal dt = mDt; + + for (PxU32 iFront = islandStart; iFront < islandEnd; iFront++) + { + PxsCCDPair& pair = *mCCDPairs[iFront]; + + verifyCCDPair(pair); + + //If we have reached a pair with a TOI after 1.0, we can terminate this island + if(pair.mMinToi > 1.0f) + break; + + bool needSweep0 = (pair.mBa0 && pair.mBa0->mCCD->mPassDone == false); + bool needSweep1 = (pair.mBa1 && pair.mBa1->mCCD->mPassDone == false); + + //If both bodies have been updated (or one has been updated and the other is static), we can skip to the next pair + if(!(needSweep0 || needSweep1)) + continue; + + { + //If the pair was an estimate, we must perform an accurate sweep now + if(pair.mToiType == PxsCCDPair::eEstimate) + { + pair.sweepFindToi(*threadContext, dt, mCCDPass, ccdThreshold); + + //Test to see if the pair is still the earliest pair. + if((iFront + 1) < islandEnd && mCCDPairs[iFront+1]->mMinToi < pair.mMinToi) + { + //If there is an earlier pair, we push this pair into its correct place in the list and return to the start + //of this update loop + PxsCCDPair* tmp = &pair; + PxU32 index = iFront; + while((index + 1) < islandEnd && mCCDPairs[index+1]->mMinToi < pair.mMinToi) + { + mCCDPairs[index] = mCCDPairs[index+1]; + ++index; + } + + mCCDPairs[index] = tmp; + + --iFront; + continue; + } + } + + if (pair.mMinToi > 1.0f) + break; + + //We now have the earliest contact pair for this island and one/both of the bodies have not been updated. We now perform + //contact modification to find out if the user still wants to respond to the collision + if(pair.mMinToi <= islandMinToi && + pair.mIsModifiable && + mCCDContext->getCCDContactModifyCallback()) + { + + PX_ALIGN(16, PxU8 dataBuffer[sizeof(PxModifiableContact) + sizeof(PxContactPatch)]); + + PxContactPatch* patch = reinterpret_cast(dataBuffer); + PxModifiableContact* point = reinterpret_cast(patch + 1); + + patch->mMassModification.mInvInertiaScale0 = 1.f; + patch->mMassModification.mInvInertiaScale1 = 1.f; + patch->mMassModification.mInvMassScale0 = 1.f; + patch->mMassModification.mInvMassScale1 = 1.f; + + patch->normal = pair.mMinToiNormal; + + patch->dynamicFriction = pair.mDynamicFriction; + patch->staticFriction = pair.mStaticFriction; + patch->materialIndex0 = pair.mMaterialIndex0; + patch->materialIndex1 = pair.mMaterialIndex1; + + patch->startContactIndex = 0; + patch->nbContacts = 1; + + patch->materialFlags = 0; + patch->internalFlags = 0; //44 //Can be a U16 + + point->contact = pair.mMinToiPoint; + point->normal = pair.mMinToiNormal; + + //KS - todo - reintroduce face indices!!!! + //point.internalFaceIndex0 = PXC_CONTACT_NO_FACE_INDEX; + //point.internalFaceIndex1 = pair.mFaceIndex; + point->materialIndex0 = pair.mMaterialIndex0; + point->materialIndex1 = pair.mMaterialIndex1; + point->dynamicFriction = pair.mDynamicFriction; + point->staticFriction = pair.mStaticFriction; + point->restitution = pair.mRestitution; + point->separation = 0.0f; + point->maxImpulse = PX_MAX_REAL; + point->materialFlags = 0; + point->targetVelocity = PxVec3(0.0f); + + mCCDContext->runCCDModifiableContact(point, 1, pair.mCCDShape0->mShapeCore, pair.mCCDShape1->mShapeCore, + pair.mCCDShape0->mRigidCore, pair.mCCDShape1->mRigidCore, pair.mBa0, pair.mBa1); + + if ((patch->internalFlags & PxContactPatch::eHAS_MAX_IMPULSE)) + pair.mMaxImpulse = point->maxImpulse; + + pair.mDynamicFriction = point->dynamicFriction; + pair.mStaticFriction = point->staticFriction; + pair.mRestitution = point->restitution; + pair.mMinToiPoint = point->contact; + pair.mMinToiNormal = point->normal; + } + } + + // pair.mIsEarliestToiHit is used for contact notification. + // only mark as such if this is the first impact for both atoms of this pair (the impacts are sorted) + // and there was an actual impact for this pair + bool atom0FirstSweep = (pair.mBa0 && pair.mBa0->mCCD->mPassDone == false) || pair.mBa0 == NULL; + bool atom1FirstSweep = (pair.mBa1 && pair.mBa1->mCCD->mPassDone == false) || pair.mBa1 == NULL; + if (pair.mMinToi <= 1.0f && atom0FirstSweep && atom1FirstSweep) + pair.mIsEarliestToiHit = true; + + // sweepAdvanceToToi sets mCCD->mPassDone flags on both atoms, doesn't advance atoms with flag already set + // can advance one atom if the other already has the flag set + bool advanced = pair.sweepAdvanceToToi( dt, mClipTrajectory); + if(pair.mMinToi < 0.0f) + pair.mMinToi = 0.0f; + verifyCCDPair(pair); + + if (advanced && pair.mMinToi <= 1.0f) + { + sweepTotalHits++; + PxU32 islandStartIndex = iIsland == 0 ? 0 : PxU32(mNumIslandBodies[iIsland - 1]); + PxU32 islandEndIndex = mNumIslandBodies[iIsland]; + + if(pair.mMinToi > 0.0f) + { + for(PxU32 a = islandStartIndex; a < islandEndIndex; ++a) + { + if(!mIslandBodies[a]->mPassDone) + { + //If the body has not updated, we advance it to the current time-step that the island has reached. + PxsRigidBody* atom = mIslandBodies[a]->mBody; + atom->advancePrevPoseToToi(pair.mMinToi); + atom->mCCD->mTimeLeft = PxMax(atom->mCCD->mTimeLeft * (1.0f - pair.mMinToi), CCD_MIN_TIME_LEFT); + atom->mCCD->mUpdateCount++; + } + } + + //Adjust remaining dt for the island + dt -= dt * pair.mMinToi; + + const PxReal recipOneMinusToi = 1.f/(1.f - pair.mMinToi); + for(PxU32 k = iFront+1; k < islandEnd; ++k) + { + PxsCCDPair& pair1 = *mCCDPairs[k]; + pair1.mMinToi = (pair1.mMinToi - pair.mMinToi)*recipOneMinusToi; + } + } + + //If we disabled response, we don't need to resweep at all + if(!mDisableResweep && !(pair.mCm->getWorkUnit().flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE) && pair.mMaxImpulse != 0.0f) + { + void* a0 = pair.mBa0 == NULL ? NULL : reinterpret_cast(pair.mBa0); + void* a1 = pair.mBa1 == NULL ? NULL : reinterpret_cast(pair.mBa1); + + for(PxU32 k = iFront+1; k < islandEnd; ++k) + { + PxsCCDPair& pair1 = *mCCDPairs[k]; + + void* b0 = pair1.mBa0 == NULL ? reinterpret_cast(pair1.mCCDShape0) : reinterpret_cast(pair1.mBa0); + void* b1 = pair1.mBa1 == NULL ? reinterpret_cast(pair1.mCCDShape1) : reinterpret_cast(pair1.mBa1); + + bool containsStatic = pair1.mBa0 == NULL || pair1.mBa1 == NULL; + + PX_ASSERT(b0 != NULL && b1 != NULL); + + if ((!containsStatic) && + ((b0 == a0 && b1 != a1) || (b1 == a0 && b0 != a1) || + (b0 == a1 && b1 != a0) || (b1 == a1 && b0 != a0)) + ) + { + if(estimatePass != pair1.mEstimatePass) + { + pair1.mEstimatePass = estimatePass; + // resweep pair1 since either b0 or b1 trajectory has changed + PxReal oldToi = pair1.mMinToi; + verifyCCDPair(pair1); + PxReal toi1 = pair1.sweepEstimateToi(ccdThreshold); + PX_ASSERT(pair1.mBa0); // this is because mMinToiNormal is the impact point here + if (toi1 < oldToi) + { + // if toi decreased, resort the array backwards + PxU32 kk = k; + PX_ASSERT(kk > 0); + + while (kk-1 > iFront && mCCDPairs[kk-1]->mMinToi > toi1) + { + PxsCCDPair* temp = mCCDPairs[kk-1]; + mCCDPairs[kk-1] = mCCDPairs[kk]; + mCCDPairs[kk] = temp; + kk--; + } + } + else if (toi1 > oldToi) + { + // if toi increased, resort the array forwards + PxU32 kk = k; + PX_ASSERT(kk > 0); + PxU32 stepped = 0; + while (kk+1 < islandEnd && mCCDPairs[kk+1]->mMinToi < toi1) + { + stepped = 1; + PxsCCDPair* temp = mCCDPairs[kk+1]; + mCCDPairs[kk+1] = mCCDPairs[kk]; + mCCDPairs[kk] = temp; + kk++; + } + k -= stepped; + } + } + } + } + } + estimatePass++; + } // if pair.minToi <= 1.0f + } // for iFront + + islandStart = islandEnd; + } // for (PxU32 iIsland = mFirstThreadIsland; iIsland < lastIsland; iIsland++) + + PxAtomicAdd(mSweepTotalHits, sweepTotalHits); + mContext->putNpThreadContext(threadContext); + } + + virtual const char *getName() const + { + return "PxsContext.CCDAdvance"; + } +}; +} + +// -------------------------------------------------------------- +// CCD main function +// Overall structure: +/* +for nPasses (passes are now handled in void Sc::Scene::updateCCDMultiPass) + + update CCD broadphase, generate a list of CMs + + foreach CM + create CCDPairs, CCDBodies from CM + add shapes, overlappingShapes to CCDBodies + + foreach CCDBody + assign island labels per body + uses overlappingShapes + + foreach CCDPair + assign island label to pair + + sort all pairs by islandId + + foreach CCDPair + sweep/find toi + compute normal: + + foreach island + sort within island by toi + foreach pair within island + advanceToToi + from curPairInIsland to lastPairInIsland + resweep if needed + +*/ +// -------------------------------------------------------------- +void PxsCCDContext::updateCCDBegin() +{ + openCCDLog(); + + miCCDPass = 0; + mSweepTotalHits = 0; +} + +// -------------------------------------------------------------- +void PxsCCDContext::updateCCDEnd() +{ + if (miCCDPass == mCCDMaxPasses - 1 || mSweepTotalHits == 0) + { + // -------------------------------------------------------------------------------------- + // At last CCD pass we need to reset mBody pointers back to NULL + // so that the next frame we know which ones need to be newly paired with PxsCCDBody objects + // also free the CCDBody memory blocks + + mMutex.lock(); + for (PxU32 j = 0, n = mCCDBodies.size(); j < n; j++) + { + if (mCCDBodies[j].mBody->mCCD && mCCDBodies[j].mBody->mCCD->mHasAnyPassDone) + { + //Record this body in the list of bodies that were updated + mUpdatedCCDBodies.pushBack(mCCDBodies[j].mBody); + } + mCCDBodies[j].mBody->mCCD = NULL; + mCCDBodies[j].mBody->getCore().isFastMoving = false; //Clear the "isFastMoving" bool + } + mMutex.unlock(); + + mCCDBodies.clear_NoDelete(); + } + + mCCDShapes.clear_NoDelete(); + + mMap.clear(); + + miCCDPass++; +} + +// -------------------------------------------------------------- +void PxsCCDContext::verifyCCDBegin() +{ + #if 0 + // validate that all bodies have a NULL mCCD pointer + if (miCCDPass == 0) + { + PxBitMap::Iterator it(mActiveContactManager); + for (PxU32 index = it.getNext(); index != PxBitMap::Iterator::DONE; index = it.getNext()) + { + PxsContactManager* cm = mContactManagerPool.findByIndexFast(index); + PxsRigidBody* b0 = cm->mBodyShape0->getBodyAtom(), *b1 = cm->mBodyShape1->getBodyAtom(); + PX_ASSERT(b0 == NULL || b0->mCCD == NULL); + PX_ASSERT(b1 == NULL || b1->mCCD == NULL); + } + } + #endif +} + +void PxsCCDContext::resetContactManagers() +{ + PxBitMap::Iterator it(mContext->mContactManagersWithCCDTouch); + + for (PxU32 index = it.getNext(); index != PxBitMap::Iterator::DONE; index = it.getNext()) + { + PxsContactManager* cm = mContext->mContactManagerPool.findByIndexFast(index); + cm->clearCCDContactInfo(); + } + + mContext->mContactManagersWithCCDTouch.clear(); +} + +// -------------------------------------------------------------- + +// PT: version that early exits & doesn't read all the data +static PX_FORCE_INLINE bool pairNeedsCCD(const PxsContactManager* cm) +{ + // skip disabled pairs + if(!cm->getCCD()) + return false; + + const PxcNpWorkUnit& workUnit = cm->getWorkUnit(); + + // skip articulation vs articulation ccd + //Actually. This is fundamentally wrong also :(. We only want to skip links in the same articulation - not all articulations!!! + { + const bool isJoint0 = (workUnit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) == PxcNpWorkUnitFlag::eARTICULATION_BODY0; + if(isJoint0) + { + const bool isJoint1 = (workUnit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) == PxcNpWorkUnitFlag::eARTICULATION_BODY1; + if(isJoint1) + return false; + } + } + + { + const bool isFastMoving0 = static_cast(workUnit.rigidCore0)->isFastMoving != 0; + if(isFastMoving0) + return true; + + const bool isFastMoving1 = (workUnit.flags & (PxcNpWorkUnitFlag::eARTICULATION_BODY1 | PxcNpWorkUnitFlag::eDYNAMIC_BODY1)) ? static_cast(workUnit.rigidCore1)->isFastMoving != 0: false; + return isFastMoving1; + } +} + +void PxsCCDContext::updateCCD(PxReal dt, PxBaseTask* continuation, IG::IslandSim& islandSim, bool disableResweep, PxI32 numFastMovingShapes) +{ + //Flag to run a slightly less-accurate version of CCD that will ensure that objects don't tunnel through the static world but is not as reliable for dynamic-dynamic collisions + mDisableCCDResweep = disableResweep; + mThresholdStream.clear(); // clear force threshold report stream + + mContext->clearManagerTouchEvents(); + + if (miCCDPass == 0) + { + resetContactManagers(); + } + + // If we're not in the first pass and the previous pass had no sweeps or the BP didn't generate any fast-moving shapes, we can skip CCD entirely + if ((miCCDPass > 0 && mSweepTotalHits == 0) || (numFastMovingShapes == 0)) + { + mSweepTotalHits = 0; + updateCCDEnd(); + return; + } + mSweepTotalHits = 0; + + PX_ASSERT(continuation); + PX_ASSERT(continuation->getReference() > 0); + + //printf("CCD 1\n"); + + mCCDThreadContext = mContext->getNpThreadContext(); + mCCDThreadContext->mDt = dt; // doesn't get set anywhere else since it's only used for CCD now + + verifyCCDBegin(); + + // -------------------------------------------------------------------------------------- + // From a list of active CMs, build a temporary array of PxsCCDPair objects (allocated in blocks) + // this is done to gather scattered data from memory and also to reduce PxsRidigBody permanent memory footprint + // we have to do it every pass since new CMs can become fast moving after each pass (and sometimes cease to be) + mCCDPairs.clear_NoDelete(); + mCCDPtrPairs.forceSize_Unsafe(0); + + mUpdatedCCDBodies.forceSize_Unsafe(0); + + mCCDOverlaps.clear_NoDelete(); + + PxU32 nbKinematicStaticCollisions = 0; + + bool needsSweep = false; + + { + PX_PROFILE_ZONE("Sim.ccdPair", mContext->mContextID); + + PxBitMap::Iterator it(mContext->mActiveContactManagersWithCCD); + for (PxU32 index = it.getNext(); index != PxBitMap::Iterator::DONE; index = it.getNext()) + { + PxsContactManager* cm = mContext->mContactManagerPool.findByIndexFast(index); + + if(!pairNeedsCCD(cm)) + continue; + + const PxcNpWorkUnit& unit = cm->getWorkUnit(); + const PxsRigidCore* rc0 = unit.rigidCore0; + const PxsRigidCore* rc1 = unit.rigidCore1; + + { + const PxsShapeCore* sc0 = unit.shapeCore0; + const PxsShapeCore* sc1 = unit.shapeCore1; + + PxsRigidBody* ba0 = cm->mRigidBody0; + PxsRigidBody* ba1 = cm->mRigidBody1; + + //Look up the body/shape pair in our CCDShape map + const PxPair* ccdShapePair0 = mMap.find(PxsRigidShapePair(rc0, sc0)); + const PxPair* ccdShapePair1 = mMap.find(PxsRigidShapePair(rc1, sc1)); + + //If the CCD shapes exist, extract them from the map + PxsCCDShape* ccdShape0 = ccdShapePair0 ? ccdShapePair0->second : NULL; + PxsCCDShape* ccdShape1 = ccdShapePair1 ? ccdShapePair1->second : NULL; + + PxReal threshold0 = 0.0f; + PxReal threshold1 = 0.0f; + + PxVec3 trA(0.0f); + PxVec3 trB(0.0f); + + if(ccdShape0 == NULL) + { + //If we hadn't already created ccdShape, create one + ccdShape0 = &mCCDShapes.pushBack(); + mMap.insert(PxsRigidShapePair(rc0, sc0), ccdShape0); + + ccdShape0->mRigidCore = rc0; + ccdShape0->mShapeCore = sc0; + ccdShape0->mGeometry = &sc0->mGeometry.getGeometry(); + + const PxTransform tm0 = ccdShape0->getAbsPose(ba0); + const PxTransform oldTm0 = ba0 ? ccdShape0->getLastCCDAbsPose(ba0) : tm0; + + trA = tm0.p - oldTm0.p; + + PxVec3p origin, extents; + //Compute the shape's bounds and CCD threshold + threshold0 = computeBoundsWithCCDThreshold(origin, extents, sc0->mGeometry.getGeometry(), tm0); + + //Set up the CCD shape + ccdShape0->mCenter = origin - trA; + ccdShape0->mExtents = extents; + ccdShape0->mFastMovingThreshold = threshold0; + ccdShape0->mPrevTransform = oldTm0; + ccdShape0->mCurrentTransform = tm0; + ccdShape0->mUpdateCount = 0; + ccdShape0->mNodeIndex = islandSim.getNodeIndex1(cm->getWorkUnit().mEdgeIndex); + } + else + { + //We had already created the shape, so extract the threshold and translation components + threshold0 = ccdShape0->mFastMovingThreshold; + trA = ccdShape0->mCurrentTransform.p - ccdShape0->mPrevTransform.p; + } + + if(ccdShape1 == NULL) + { + //If the CCD shape was not already constructed, create it + ccdShape1 = &mCCDShapes.pushBack(); + ccdShape1->mRigidCore = rc1; + ccdShape1->mShapeCore = sc1; + ccdShape1->mGeometry = &sc1->mGeometry.getGeometry(); + + mMap.insert(PxsRigidShapePair(rc1, sc1), ccdShape1); + + const PxTransform tm1 = ccdShape1->getAbsPose(ba1); + const PxTransform oldTm1 = ba1 ? ccdShape1->getLastCCDAbsPose(ba1) : tm1; + + trB = tm1.p - oldTm1.p; + + PxVec3p origin, extents; + //Compute the shape's bounds and CCD threshold + threshold1 = computeBoundsWithCCDThreshold(origin, extents, sc1->mGeometry.getGeometry(), tm1); + + //Set up the CCD shape + ccdShape1->mCenter = origin - trB; + ccdShape1->mExtents = extents; + ccdShape1->mFastMovingThreshold = threshold1; + ccdShape1->mPrevTransform = oldTm1; + ccdShape1->mCurrentTransform = tm1; + ccdShape1->mUpdateCount = 0; + ccdShape1->mNodeIndex = islandSim.getNodeIndex2(cm->getWorkUnit().mEdgeIndex); + } + else + { + //CCD shape already constructed so just extract thresholds and trB components + threshold1 = ccdShape1->mFastMovingThreshold; + trB = ccdShape1->mCurrentTransform.p - ccdShape1->mPrevTransform.p; + } + + { + //Initialize the CCD bodies + PxsRigidBody* atoms[2] = {ba0, ba1}; + for (int k = 0; k < 2; k++) + { + PxsRigidBody* b = atoms[k]; + //If there isn't a body (i.e. it's a static), no need to create a CCD body + if (!b) + continue; + if (b->mCCD == NULL) + { + // this rigid body has no CCD body created for it yet. Create and initialize one. + PxsCCDBody& newB = mCCDBodies.pushBack(); + b->mCCD = &newB; + b->mCCD->mIndex = PxTo16(mCCDBodies.size()-1); + b->mCCD->mBody = b; + b->mCCD->mTimeLeft = 1.0f; + b->mCCD->mOverlappingObjects = NULL; + b->mCCD->mUpdateCount = 0; + b->mCCD->mHasAnyPassDone = false; + b->mCCD->mNbInteractionsThisPass = 0; + } + b->mCCD->mPassDone = 0; + b->mCCD->mNbInteractionsThisPass++; + } + if(ba0 && ba1) + { + //If both bodies exist (i.e. this is dynamic-dynamic collision), we create an + //overlap between the 2 bodies used for island detection. + if(!(ba0->isKinematic() || ba1->isKinematic())) + { + if(!ba0->mCCD->overlaps(ba1->mCCD)) + { + PxsCCDOverlap* overlapA = &mCCDOverlaps.pushBack(); + PxsCCDOverlap* overlapB = &mCCDOverlaps.pushBack(); + + overlapA->mBody = ba1->mCCD; + overlapB->mBody = ba0->mCCD; + + ba0->mCCD->addOverlap(overlapA); + ba1->mCCD->addOverlap(overlapB); + } + } + } + } + + //We now create the CCD pair. These are used in the CCD sweep and update phases + if (ba0->isKinematic() && (ba1 == NULL || ba1->isKinematic())) + nbKinematicStaticCollisions++; + { + PxsCCDPair& p = mCCDPairs.pushBack(); + p.mBa0 = ba0; + p.mBa1 = ba1; + p.mCCDShape0 = ccdShape0; + p.mCCDShape1 = ccdShape1; + p.mHasFriction = rc0->hasCCDFriction() || rc1->hasCCDFriction(); + p.mMinToi = PX_MAX_REAL; + p.mG0 = cm->mNpUnit.shapeCore0->mGeometry.getType(); + p.mG1 = cm->mNpUnit.shapeCore1->mGeometry.getType(); + p.mCm = cm; + p.mIslandId = 0xFFFFffff; + p.mIsEarliestToiHit = false; + p.mFaceIndex = PXC_CONTACT_NO_FACE_INDEX; + p.mIsModifiable = cm->isChangeable() != 0; + p.mAppliedForce = 0.0f; + p.mMaxImpulse = PxMin((ba0->mCore->mFlags & PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE) ? ba0->mCore->maxContactImpulse : PX_MAX_F32, + (ba1 && ba1->mCore->mFlags & PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE) ? ba1->mCore->maxContactImpulse : PX_MAX_F32); + +#if PX_ENABLE_SIM_STATS + mContext->mSimStats.mNbCCDPairs[PxMin(p.mG0, p.mG1)][PxMax(p.mG0, p.mG1)] ++; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + //Calculate the sum of the thresholds and work out if we need to perform a sweep. + + const PxReal thresh = PxMin(threshold0 + threshold1, mCCDThreshold); + //If no shape pairs in the entire scene are fast-moving, we can bypass the entire of the CCD. + needsSweep = needsSweep || (trA - trB).magnitudeSquared() >= (thresh * thresh); + } + + } + } + //There are no fast-moving pairs in this scene, so we can terminate right now without proceeding any further + if(!needsSweep) + { + updateCCDEnd(); + mContext->putNpThreadContext(mCCDThreadContext); + return; + } + } + + //Create the pair pointer buffer. This is a flattened array of pointers to pairs. It is used to sort the pairs + //into islands and is also used to prioritize the pairs into their TOIs + { + const PxU32 size = mCCDPairs.size(); + mCCDPtrPairs.reserve(size); + for(PxU32 a = 0; a < size; ++a) + { + mCCDPtrPairs.pushBack(&mCCDPairs[a]); + } + + mThresholdStream.reserve(PxNextPowerOfTwo(size)); + + for (PxU32 a = 0; a < mCCDBodies.size(); ++a) + { + mCCDBodies[a].mPreSolverVelocity.linear = mCCDBodies[a].mBody->getLinearVelocity(); + mCCDBodies[a].mPreSolverVelocity.angular = mCCDBodies[a].mBody->getAngularVelocity(); + } + } + + PxU32 ccdBodyCount = mCCDBodies.size(); + + // -------------------------------------------------------------------------------------- + // assign island labels + const PxU16 noLabelYet = 0xFFFF; + + //Temporary array allocations. Ideally, we should use the scratch pad for there + PxArray islandLabels; + islandLabels.resize(ccdBodyCount); + PxArray stack; + stack.reserve(ccdBodyCount); + stack.forceSize_Unsafe(ccdBodyCount); + + //Initialize all islands labels (for each body) to be unitialized + mIslandSizes.forceSize_Unsafe(0); + mIslandSizes.reserve(ccdBodyCount + 1); + mIslandSizes.forceSize_Unsafe(ccdBodyCount + 1); + for (PxU32 j = 0; j < ccdBodyCount; j++) + islandLabels[j] = noLabelYet; + + PxU32 islandCount = 0; + PxU32 stackSize = 0; + const PxsCCDBody* top = NULL; + + for (PxU32 j = 0; j < ccdBodyCount; j++) + { + //If the body has already been labelled or if it is kinematic, continue + //Also, if the body has no interactions this pass, continue. In single-pass CCD, only bodies with interactions would be part of the CCD. However, + //with multi-pass CCD, we keep all bodies that interacted in previous passes. If the body now has no interactions, we skip it to ensure that island grouping doesn't fail in + //later stages by assigning an island ID to a body with no interactions + if (islandLabels[j] != noLabelYet || mCCDBodies[j].mBody->isKinematic() || mCCDBodies[j].mNbInteractionsThisPass == 0) + continue; + + top = &mCCDBodies[j]; + //Otherwise push it back into the queue and proceed + islandLabels[j] = islandCount; + + stack[stackSize++] = top; + // assign new label to unlabeled atom + // assign the same label to all connected nodes using stack traversal + PxU16 islandSize = 0; + while (stackSize > 0) + { + --stackSize; + const PxsCCDBody* ccdb = top; + top = stack[PxMax(1u, stackSize)-1]; + + PxsCCDOverlap* overlaps = ccdb->mOverlappingObjects; + while(overlaps) + { + if (islandLabels[overlaps->mBody->mIndex] == noLabelYet) // non-static & unlabeled? + { + islandLabels[overlaps->mBody->mIndex] = islandCount; + stack[stackSize++] = overlaps->mBody; // push adjacent node to the top of the stack + top = overlaps->mBody; + islandSize++; + } + overlaps = overlaps->mNext; + } + } + //Record island size + mIslandSizes[islandCount] = PxU16(islandSize + 1); + islandCount++; + } + + PxU32 kinematicIslandId = islandCount; + + islandCount += nbKinematicStaticCollisions; + + for (PxU32 i = kinematicIslandId; i < islandCount; ++i) + mIslandSizes[i] = 1; + + // -------------------------------------------------------------------------------------- + // label pairs with island ids + // (need an extra loop since we don't maintain a mapping from atom to all of it's pairs) + mCCDIslandHistogram.clear(); // number of pairs per island + mCCDIslandHistogram.resize(islandCount); + + PxU32 totalActivePairs = 0; + for (PxU32 j = 0, n = mCCDPtrPairs.size(); j < n; j++) + { + const PxU32 staticLabel = 0xFFFFffff; + PxsCCDPair& p = *mCCDPtrPairs[j]; + PxU32 id0 = p.mBa0 && !p.mBa0->isKinematic()? islandLabels[p.mBa0->mCCD->getIndex()] : staticLabel; + PxU32 id1 = p.mBa1 && !p.mBa1->isKinematic()? islandLabels[p.mBa1->mCCD->getIndex()] : staticLabel; + + PxU32 islandId = PxMin(id0, id1); + if (islandId == staticLabel) + islandId = kinematicIslandId++; + + p.mIslandId = islandId; + mCCDIslandHistogram[p.mIslandId] ++; + PX_ASSERT(p.mIslandId != staticLabel); + totalActivePairs++; + } + + PxU16 count = 0; + for(PxU16 a = 0; a < islandCount+1; ++a) + { + PxU16 islandSize = mIslandSizes[a]; + mIslandSizes[a] = count; + count += islandSize; + } + + mIslandBodies.forceSize_Unsafe(0); + mIslandBodies.reserve(ccdBodyCount); + mIslandBodies.forceSize_Unsafe(ccdBodyCount); + for(PxU32 a = 0; a < mCCDBodies.size(); ++a) + { + const PxU32 island = islandLabels[mCCDBodies[a].mIndex]; + if (island != 0xFFFF) + { + PxU16 writeIndex = mIslandSizes[island]; + mIslandSizes[island] = PxU16(writeIndex + 1); + mIslandBodies[writeIndex] = &mCCDBodies[a]; + } + } + + // -------------------------------------------------------------------------------------- + // setup tasks + mPostCCDDepenetrateTask.setContinuation(continuation); + mPostCCDAdvanceTask.setContinuation(&mPostCCDDepenetrateTask); + mPostCCDSweepTask.setContinuation(&mPostCCDAdvanceTask); + + // -------------------------------------------------------------------------------------- + // sort all pairs by islands + PxSort(mCCDPtrPairs.begin(), mCCDPtrPairs.size(), IslandPtrCompare()); + + // -------------------------------------------------------------------------------------- + // sweep all CCD pairs + const PxU32 nPairs = mCCDPtrPairs.size(); + const PxU32 numThreads = PxMax(1u, mContext->mTaskManager->getCpuDispatcher()->getWorkerCount()); PX_ASSERT(numThreads > 0); + mCCDPairsPerBatch = PxMax((nPairs)/numThreads, 1); + + for (PxU32 batchBegin = 0; batchBegin < nPairs; batchBegin += mCCDPairsPerBatch) + { + void* ptr = mContext->mTaskPool.allocate(sizeof(PxsCCDSweepTask)); + PX_ASSERT_WITH_MESSAGE(ptr, "Failed to allocate PxsCCDSweepTask"); + const PxU32 batchEnd = PxMin(nPairs, batchBegin + mCCDPairsPerBatch); + PX_ASSERT(batchEnd >= batchBegin); + PxsCCDSweepTask* task = PX_PLACEMENT_NEW(ptr, PxsCCDSweepTask)(mContext->getContextId(), mCCDPtrPairs.begin() + batchBegin, batchEnd - batchBegin, + mCCDThreshold); + task->setContinuation(*mContext->mTaskManager, &mPostCCDSweepTask); + task->removeReference(); + } + + mPostCCDSweepTask.removeReference(); + mPostCCDAdvanceTask.removeReference(); + mPostCCDDepenetrateTask.removeReference(); +} + +void PxsCCDContext::postCCDSweep(PxBaseTask* continuation) +{ + // -------------------------------------------------------------------------------------- + // batch up the islands and send them over to worker threads + PxU32 firstIslandPair = 0; + PxU32 islandCount = mCCDIslandHistogram.size(); + for (PxU32 firstIslandInBatch = 0; firstIslandInBatch < islandCount;) + { + PxU32 pairSum = 0; + PxU32 lastIslandInBatch = firstIslandInBatch+1; + PxU32 j; + // add up the numbers in the histogram until we reach target pairsPerBatch + for (j = firstIslandInBatch; j < islandCount; j++) + { + pairSum += mCCDIslandHistogram[j]; + if (pairSum > mCCDPairsPerBatch) + { + lastIslandInBatch = j+1; + break; + } + } + if (j == islandCount) // j is islandCount if not enough pairs were left to fill up to pairsPerBatch + { + if (pairSum == 0) + break; // we are done and there are no islands in this batch + lastIslandInBatch = islandCount; + } + + void* ptr = mContext->mTaskPool.allocate(sizeof(PxsCCDAdvanceTask)); + PX_ASSERT_WITH_MESSAGE(ptr , "Failed to allocate PxsCCDSweepTask"); + bool clipTrajectory = (miCCDPass == mCCDMaxPasses-1); + PxsCCDAdvanceTask* task = PX_PLACEMENT_NEW(ptr, PxsCCDAdvanceTask) ( + mCCDPtrPairs.begin(), mCCDPtrPairs.size(), mCCDBodies, mContext, this, mCCDThreadContext->mDt, miCCDPass, + firstIslandPair, firstIslandInBatch, lastIslandInBatch-firstIslandInBatch, islandCount, + mIslandBodies.begin(), mIslandSizes.begin(), clipTrajectory, mDisableCCDResweep, + &mSweepTotalHits); + firstIslandInBatch = lastIslandInBatch; + firstIslandPair += pairSum; + task->setContinuation(*mContext->mTaskManager, continuation); + task->removeReference(); + } // for iIsland +} + +static PX_FORCE_INLINE bool shouldCreateContactReports(const PxsRigidCore* rigidCore) +{ + return static_cast(rigidCore)->contactReportThreshold != PXV_CONTACT_REPORT_DISABLED; +} + +void PxsCCDContext::postCCDAdvance(PxBaseTask* /*continuation*/) +{ + // -------------------------------------------------------------------------------------- + // contact notifications: update touch status (multi-threading this section would probably slow it down but might be worth a try) + PxU32 countLost = 0, countFound = 0, countRetouch = 0; + + PxU32 islandCount = mCCDIslandHistogram.size(); + PxU32 index = 0; + + for (PxU32 island = 0; island < islandCount; ++island) + { + PxU32 islandEnd = mCCDIslandHistogram[island] + index; + for(PxU32 j = index; j < islandEnd; ++j) + { + PxsCCDPair& p = *mCCDPtrPairs[j]; + //The CCD pairs are ordered by TOI. If we reach a TOI > 1, we can terminate + if(p.mMinToi > 1.f) + break; + + //If this was the earliest touch for the pair of bodies, we can notify the user about it. If not, it's a future collision that we haven't stepped to yet + if (p.mIsEarliestToiHit) + { + //Flag that we had a CCD contact + p.mCm->setHadCCDContact(); + + //Test/set the changed touch map + PxU16 oldTouch = p.mCm->getTouchStatus(); + if (!oldTouch) + { + mContext->mContactManagerTouchEvent.growAndSet(p.mCm->getIndex()); + p.mCm->mNpUnit.statusFlags = PxU16((p.mCm->mNpUnit.statusFlags & (~PxcNpWorkUnitStatusFlag::eHAS_NO_TOUCH)) | PxcNpWorkUnitStatusFlag::eHAS_TOUCH); + //Also need to write it in the CmOutput structure!!!!! + + ////The achieve this, we need to unregister the CM from the Nphase, then re-register it with the status set. This is the only way to force a push to the GPU + Sc::ShapeInteraction* interaction = p.mCm->getShapeInteraction(); + mNphaseContext.unregisterContactManager(p.mCm); + mNphaseContext.registerContactManager(p.mCm, interaction, 1, 0); + countFound++; + } + else + { + mContext->mContactManagerTouchEvent.growAndSet(p.mCm->getIndex()); + p.mCm->raiseCCDRetouch(); + countRetouch++; + } + + //Do we want to create reports? + const bool createReports = + p.mCm->mNpUnit.flags & PxcNpWorkUnitFlag::eOUTPUT_CONTACTS + || (p.mCm->mNpUnit.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD + && ((p.mCm->mNpUnit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY0 | PxcNpWorkUnitFlag::eARTICULATION_BODY0) && shouldCreateContactReports(p.mCm->mNpUnit.rigidCore0)) + || (p.mCm->mNpUnit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY1 | PxcNpWorkUnitFlag::eARTICULATION_BODY1) && shouldCreateContactReports(p.mCm->mNpUnit.rigidCore1)))); + + if(createReports) + { + mContext->mContactManagersWithCCDTouch.growAndSet(p.mCm->getIndex()); + + const PxU32 numContacts = 1; + PxsMaterialInfo matInfo; + PxContactBuffer& buffer = mCCDThreadContext->mContactBuffer; + + PxContactPoint& cp = buffer.contacts[0]; + cp.point = p.mMinToiPoint; + cp.normal = -p.mMinToiNormal; //KS - discrete contact gen produces contacts pointing in the opposite direction to CCD sweeps + cp.internalFaceIndex1 = p.mFaceIndex; + cp.separation = 0.0f; + cp.restitution = p.mRestitution; + cp.dynamicFriction = p.mDynamicFriction; + cp.staticFriction = p.mStaticFriction; + cp.targetVel = PxVec3(0.0f); + cp.maxImpulse = PX_MAX_REAL; + + matInfo.mMaterialIndex0 = p.mMaterialIndex0; + matInfo.mMaterialIndex1 = p.mMaterialIndex1; + + //Write contact stream for the contact. This will allocate memory for the contacts and forces + PxReal* contactForces; + //PxU8* contactStream; + PxU8* contactPatches; + PxU8* contactPoints; + PxU16 contactStreamSize; + PxU16 contactCount; + PxU8 nbPatches; + PxsCCDContactHeader* ccdHeader = reinterpret_cast(p.mCm->mNpUnit.ccdContacts); + if (writeCompressedContact(buffer.contacts, numContacts, mCCDThreadContext, contactCount, contactPatches, + contactPoints, contactStreamSize, contactForces, numContacts*sizeof(PxReal), mCCDThreadContext->mMaterialManager, + ((p.mCm->mNpUnit.flags & PxcNpWorkUnitFlag::eMODIFIABLE_CONTACT) != 0), true, &matInfo, nbPatches, sizeof(PxsCCDContactHeader),NULL, NULL, + false, NULL, NULL, NULL, p.mFaceIndex != PXC_CONTACT_NO_FACE_INDEX)) + { + PxsCCDContactHeader* newCCDHeader = reinterpret_cast(contactPatches); + newCCDHeader->contactStreamSize = PxTo16(contactStreamSize); + newCCDHeader->isFromPreviousPass = 0; + + p.mCm->mNpUnit.ccdContacts = contactPatches; // put the latest stream at the head of the linked list since it needs to get accessed every CCD pass + // to prepare the reports + + if (!ccdHeader) + newCCDHeader->nextStream = NULL; + else + { + newCCDHeader->nextStream = ccdHeader; + ccdHeader->isFromPreviousPass = 1; + } + + //And write the force and contact count + PX_ASSERT(contactForces != NULL); + contactForces[0] = p.mAppliedForce; + } + else if (!ccdHeader) + { + p.mCm->mNpUnit.ccdContacts = NULL; + // we do not set the status flag on failure because the pair might have written + // a contact stream sucessfully during discrete collision this frame. + } + else + ccdHeader->isFromPreviousPass = 1; + + //If the touch event already existed, the solver would have already configured the threshold stream + if((p.mCm->mNpUnit.flags & (PxcNpWorkUnitFlag::eARTICULATION_BODY0 | PxcNpWorkUnitFlag::eARTICULATION_BODY1)) == 0 && p.mAppliedForce) + { +#if 1 + ThresholdStreamElement elt; + elt.normalForce = p.mAppliedForce; + elt.accumulatedForce = 0.0f; + elt.threshold = PxMin(p.mBa0 == NULL ? PX_MAX_REAL : p.mBa0->mCore->contactReportThreshold, p.mBa1 == NULL ? PX_MAX_REAL : + p.mBa1->mCore->contactReportThreshold); + elt.nodeIndexA = p.mCCDShape0->mNodeIndex; + elt.nodeIndexB =p.mCCDShape1->mNodeIndex; + PxOrder(elt.nodeIndexA,elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA.index() < elt.nodeIndexB.index()); + mThresholdStream.pushBack(elt); +#endif + } + } + } + } + index = islandEnd; + } + + mContext->mCMTouchEventCount[PXS_LOST_TOUCH_COUNT] += countLost; + mContext->mCMTouchEventCount[PXS_NEW_TOUCH_COUNT] += countFound; + mContext->mCMTouchEventCount[PXS_CCD_RETOUCH_COUNT] += countRetouch; +} + +void PxsCCDContext::postCCDDepenetrate(PxBaseTask* /*continuation*/) +{ + // -------------------------------------------------------------------------------------- + // reset mOverlappingShapes array for all bodies + // we do it each pass because this set can change due to movement as well as new objects + // becoming fast moving due to intra-frame impacts + + for (PxU32 j = 0; j < mCCDBodies.size(); j ++) + { + mCCDBodies[j].mOverlappingObjects = NULL; + mCCDBodies[j].mNbInteractionsThisPass = 0; + } + + mCCDOverlaps.clear_NoDelete(); + + updateCCDEnd(); + + mContext->putNpThreadContext(mCCDThreadContext); + + flushCCDLog(); +} + +Cm::SpatialVector PxsRigidBody::getPreSolverVelocities() const +{ + if (mCCD) + return mCCD->mPreSolverVelocity; + return Cm::SpatialVector(PxVec3(0.0f), PxVec3(0.0f)); +} + +/*PxTransform PxsRigidBody::getAdvancedTransform(PxReal toi) const +{ + //If it is kinematic, just return identity. We don't fully support kinematics yet + if (isKinematic()) + return PxTransform(PxIdentity); + + //Otherwise we interpolate the pose between the current and previous pose and return that pose + PxVec3 newLastP = mLastTransform.p*(1.0f-toi) + mCore->body2World.p*toi; // advance mLastTransform position to toi + PxQuat newLastQ = slerp(toi, getLastCCDTransform().q, mCore->body2World.q); // advance mLastTransform rotation to toi + return PxTransform(newLastP, newLastQ); +}*/ + +void PxsRigidBody::advancePrevPoseToToi(PxReal toi) +{ + //If this is kinematic, just return + if (isKinematic()) + return; + + //update latest pose + const PxVec3 newLastP = mLastTransform.p*(1.0f-toi) + mCore->body2World.p*toi; // advance mLastTransform position to toi + mLastTransform.p = newLastP; +#if CCD_ROTATION_LOCKING + mCore->body2World.q = getLastCCDTransform().q; +#else + // slerp from last transform to current transform with ratio of toi + const PxQuat newLastQ = PxSlerp(toi, getLastCCDTransform().q, mCore->body2World.q); // advance mLastTransform rotation to toi + mLastTransform.q = newLastQ; +#endif +} + +void PxsRigidBody::advanceToToi(PxReal toi, PxReal dt, bool clip) +{ + if (isKinematic()) + return; + + if (clip) + { + //If clip is true, we set the previous and current pose to be the same. This basically makes the object appear stationary in the CCD + mCore->body2World.p = getLastCCDTransform().p; +#if !CCD_ROTATION_LOCKING + mCore->body2World.q = getLastCCDTransform().q; +#endif + } + else + { + // advance new CCD target after impact to remaining toi using post-impact velocities + mCore->body2World.p = getLastCCDTransform().p + getLinearVelocity() * dt * (1.0f - toi); +#if !CCD_ROTATION_LOCKING + const PxVec3 angularDelta = getAngularVelocity() * dt * (1.0f - toi); + const PxReal deltaMag = angularDelta.magnitude(); + const PxVec3 deltaAng = deltaMag > 1e-20f ? angularDelta / deltaMag : PxVec3(1.0f, 0.0f, 0.0f); + const PxQuat angularQuat(deltaMag, deltaAng); + mCore->body2World.q = getLastCCDTransform().q * angularQuat; +#endif + PX_ASSERT(mCore->body2World.isSane()); + } + + // rescale total time left to elapse this frame + mCCD->mTimeLeft = PxMax(mCCD->mTimeLeft * (1.0f - toi), CCD_MIN_TIME_LEFT); +} + +void PxsCCDContext::runCCDModifiableContact(PxModifiableContact* PX_RESTRICT contacts, PxU32 contactCount, const PxsShapeCore* PX_RESTRICT shapeCore0, + const PxsShapeCore* PX_RESTRICT shapeCore1, const PxsRigidCore* PX_RESTRICT rigidCore0, const PxsRigidCore* PX_RESTRICT rigidCore1, + const PxsRigidBody* PX_RESTRICT rigid0, const PxsRigidBody* PX_RESTRICT rigid1) +{ + if(!mCCDContactModifyCallback) + return; + + class PxcContactSet: public PxContactSet + { + public: + PxcContactSet(PxU32 count, PxModifiableContact* contacts_) + { + mContacts = contacts_; + mCount = count; + } + }; + { + PxContactModifyPair p; + + p.shape[0] = gPxvOffsetTable.convertPxsShape2Px(shapeCore0); + p.shape[1] = gPxvOffsetTable.convertPxsShape2Px(shapeCore1); + + p.actor[0] = rigid0 != NULL ? gPxvOffsetTable.convertPxsRigidCore2PxRigidBody(rigidCore0) + : gPxvOffsetTable.convertPxsRigidCore2PxRigidStatic(rigidCore0); + + p.actor[1] = rigid1 != NULL ? gPxvOffsetTable.convertPxsRigidCore2PxRigidBody(rigidCore1) + : gPxvOffsetTable.convertPxsRigidCore2PxRigidStatic(rigidCore1); + + p.transform[0] = getShapeAbsPose(shapeCore0, rigidCore0, PxU32(rigid0 != NULL)); + p.transform[1] = getShapeAbsPose(shapeCore1, rigidCore1, PxU32(rigid1 != NULL)); + + static_cast(p.contacts) = + PxcContactSet(contactCount, contacts); + + mCCDContactModifyCallback->onCCDContactModify(&p, 1); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp new file mode 100644 index 0000000..9321a2f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContactManager.cpp @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxsContactManager.h" +#include "PxsRigidBody.h" +#include "PxcContactMethodImpl.h" +#include "PxvManager.h" +#include "PxsIslandSim.h" + +using namespace physx; + +PxsContactManager::PxsContactManager(PxsContext*, PxU32 index) /*: + mUserData (NULL)*/ +{ + mFlags = 0; + + // PT: TODO: any reason why we don't initialize all members here, e.g. shapeCore pointers? + mNpUnit.index = index; + mNpUnit.rigidCore0 = NULL; + mNpUnit.rigidCore1 = NULL; + mNpUnit.restDistance = 0; + mNpUnit.dominance0 = 1u; + mNpUnit.dominance1 = 1u; + mNpUnit.frictionDataPtr = NULL; + mNpUnit.frictionPatchCount = 0; +} + +PxsContactManager::~PxsContactManager() +{ +} + +void PxsContactManager::setCCD(bool enable) +{ + PxU32 flags = mFlags & (~PXS_CM_CCD_CONTACT); + if (enable) + flags |= PXS_CM_CCD_LINEAR; + else + flags &= ~PXS_CM_CCD_LINEAR; + + mFlags = flags; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp new file mode 100644 index 0000000..c081bc3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsContext.cpp @@ -0,0 +1,646 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "PxvConfig.h" +#include "PxcContactCache.h" +#include "PxsRigidBody.h" +#include "PxsContactManager.h" +#include "PxsContext.h" +#include "PxPhysXConfig.h" + +#include "foundation/PxBitMap.h" +#include "CmFlushPool.h" + +#include "PxsMaterialManager.h" +#include "PxSceneDesc.h" +#include "PxsCCD.h" +#include "PxvGeometry.h" +#include "PxvManager.h" +#include "PxsSimpleIslandManager.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "PxPhysXGpu.h" +#endif + +#include "PxcNpContactPrepShared.h" +#include "PxcNpCache.h" + +using namespace physx; + +PxsContext::PxsContext(const PxSceneDesc& desc, PxTaskManager* taskManager, Cm::FlushPool& taskPool, PxCudaContextManager* cudaContextManager, + const PxU32 poolSlabSize, PxU64 contextID) : + mNpThreadContextPool (this), + mContactManagerPool ("mContactManagerPool", this, poolSlabSize), + mManifoldPool ("mManifoldPool", poolSlabSize), + mSphereManifoldPool ("mSphereManifoldPool", poolSlabSize), + mContactModifyCallback (NULL), + mNpImplementationContext (NULL), + mNpFallbackImplementationContext(NULL), + mTaskManager (taskManager), + mTaskPool (taskPool), + mCudaContextManager (cudaContextManager), + mPCM (desc.flags & PxSceneFlag::eENABLE_PCM), + mContactCache (false), + mCreateAveragePoint (desc.flags & PxSceneFlag::eENABLE_AVERAGE_POINT), + mContextID (contextID) +{ + clearManagerTouchEvents(); + mVisualizationCullingBox.setEmpty(); + + PxMemZero(mVisualizationParams, sizeof(PxReal) * PxVisualizationParameter::eNUM_VALUES); + + mNpMemBlockPool.init(desc.nbContactDataBlocks, desc.maxNbContactDataBlocks); +} + +PxsContext::~PxsContext() +{ + PX_DELETE(mTransformCache); + mContactManagerPool.destroy(); //manually destroy the contact manager pool, otherwise pool deletion order is random and we can get into trouble with references into other pools needed during destruction. +} + +// =========================== Create methods +namespace physx +{ + bool gEnablePCMCaching[][PxGeometryType::eGEOMETRY_COUNT] = + { + //eSPHERE, + { + false, //eSPHERE + false, //ePLANE + false, //eCAPSULE + false, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + true, //eTRIANGLEMESH + true, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //ePLANE + { + false, //eSPHERE + false, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //eCAPSULE, + { + false, //eSPHERE + true, //ePLANE + false, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + true, //eTRIANGLEMESH + true, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //eBOX, + { + false, //eSPHERE + true, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + true, //eTRIANGLEMESH + true, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //eCONVEXMESH, + { + true, //eSPHERE + true, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + true, //eTRIANGLEMESH + true, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //ePARTICLESYSTEM + { + false, //eSPHERE + false, //ePLANE + false, //eCAPSULE + false, //eBOX + false, //eCONVEXMESH + false, //ePARTICLESYSTEM + false, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + false, //eCUSTOM + }, + + //eSOFTBODY + { + false, //eSPHERE + false, //ePLANE + false, //eCAPSULE + false, //eBOX + false, //eCONVEXMESH + false, //ePARTICLESYSTEM + false, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + false, //eCUSTOM + }, + + //eTRIANGLEMESH, + { + true, //eSPHERE + false, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //eHEIGHTFIELD, + { + true, //eSPHERE + false, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + true, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + }, + + //eHAIRSYSTEM + { + false, //eSPHERE + false, //ePLANE + false, //eCAPSULE + false, //eBOX + false, //eCONVEXMESH + false, //ePARTICLESYSTEM + false, //eSOFTBODY, + false, //eTRIANGLEMESH + false, //eHEIGHTFIELD + false, //eHAIRSYSTEM + false, //eCUSTOM + }, + + //eCUSTOM, + { + true, //eSPHERE + true, //ePLANE + true, //eCAPSULE + true, //eBOX + true, //eCONVEXMESH + false, //ePARTICLESYSTEM + false, //eSOFTBODY, + true, //eTRIANGLEMESH + true, //eHEIGHTFIELD + false, //eHAIRSYSTEM + true, //eCUSTOM + } + }; + PX_COMPILE_TIME_ASSERT(sizeof(gEnablePCMCaching) / sizeof(gEnablePCMCaching[0]) == PxGeometryType::eGEOMETRY_COUNT); +} + +void PxsContext::createTransformCache(PxVirtualAllocatorCallback& allocatorCallback) +{ + mTransformCache = PX_NEW(PxsTransformCache)(allocatorCallback); +} + +PxsContactManager* PxsContext::createContactManager(PxsContactManager* contactManager, const bool useCCD) +{ + PxsContactManager* cm = contactManager? contactManager : mContactManagerPool.get(); + if(cm) + { + cm->getWorkUnit().clearCachedState(); + + if(!contactManager) + setActiveContactManager(cm, useCCD); + } + else + { + PX_WARN_ONCE("Reached limit of contact pairs."); + } + + return cm; +} + +void PxsContext::createCache(Gu::Cache& cache, PxGeometryType::Enum geomType0, PxGeometryType::Enum geomType1) +{ + if(mPCM) + { + if(gEnablePCMCaching[geomType0][geomType1]) + { + if(geomType0 <= PxGeometryType::eCONVEXMESH && geomType1 <= PxGeometryType::eCONVEXMESH) + { + if(geomType0 == PxGeometryType::eSPHERE || geomType1 == PxGeometryType::eSPHERE) + { + Gu::PersistentContactManifold* manifold = mSphereManifoldPool.allocate(); + PX_PLACEMENT_NEW(manifold, Gu::SpherePersistentContactManifold()); + cache.setManifold(manifold); + } + else + { + Gu::PersistentContactManifold* manifold = mManifoldPool.allocate(); + PX_PLACEMENT_NEW(manifold, Gu::LargePersistentContactManifold()); + cache.setManifold(manifold); + + } + cache.getManifold().clearManifold(); + } + else + { + //ML: raised 1 to indicate the manifold is multiManifold which is for contact gen in mesh/height field + //cache.manifold = 1; + cache.setMultiManifold(NULL); + } + } + else + { + //cache.manifold = 0; + cache.mCachedData = NULL; + cache.mManifoldFlags = 0; + } + } +} + +void PxsContext::destroyContactManager(PxsContactManager* cm) +{ + const PxU32 idx = cm->getIndex(); + if(cm->getCCD()) + mActiveContactManagersWithCCD.growAndReset(idx); + //mActiveContactManager.growAndReset(idx); + mContactManagerTouchEvent.growAndReset(idx); + mContactManagerPool.put(cm); +} + +void PxsContext::destroyCache(Gu::Cache& cache) +{ + if(cache.isManifold()) + { + if(!cache.isMultiManifold()) + { + Gu::PersistentContactManifold& manifold = cache.getManifold(); + if(manifold.mCapacity == GU_SPHERE_MANIFOLD_CACHE_SIZE) + mSphereManifoldPool.deallocate(static_cast(&manifold)); + else + mManifoldPool.deallocate(static_cast(&manifold)); + } + cache.mCachedData = NULL; + cache.mManifoldFlags = 0; + } +} + +void PxsContext::setScratchBlock(void* addr, PxU32 size) +{ + mScratchAllocator.setBlock(addr, size); +} + +void PxsContext::shiftOrigin(const PxVec3& shift) +{ + // transform cache + mTransformCache->shiftTransforms(-shift); + +#if 0 + if (getContactCacheFlag()) + { + //Iterate all active contact managers + PxBitMap::Iterator it(mActiveContactManager); + PxU32 index = it.getNext(); + while(index != PxBitMap::Iterator::DONE) + { + PxsContactManager* cm = mContactManagerPool.findByIndexFast(index); + + PxcNpWorkUnit& npwUnit = cm->getWorkUnit(); + + // contact cache + if(!npwUnit.pairCache.isManifold()) + { + PxU8* contactCachePtr = npwUnit.pairCache.mCachedData; + if (contactCachePtr) + { + PxcLocalContactsCache* lcc; + PxU8* contacts = PxcNpCacheRead(npwUnit.pairCache, lcc); +#ifdef _DEBUG + PxcLocalContactsCache testCache; + PxU32 testBytes; + const PxU8* testPtr = PxcNpCacheRead2(npwUnit.pairCache, testCache, testBytes); +#endif + lcc->mTransform0.p -= shift; + lcc->mTransform1.p -= shift; + + const PxU32 nbContacts = lcc->mNbCachedContacts; + const bool sameNormal = lcc->mSameNormal; + const bool useFaceIndices = lcc->mUseFaceIndices; + + for(PxU32 i=0; i < nbContacts; i++) + { + if (i != nbContacts-1) + PxPrefetchLine(contacts, 128); + + if(!i || !sameNormal) + contacts += sizeof(PxVec3); + + PxVec3* cachedPoint = reinterpret_cast(contacts); + *cachedPoint -= shift; + contacts += sizeof(PxVec3); + contacts += sizeof(PxReal); + + if(useFaceIndices) + contacts += 2 * sizeof(PxU32); + } +#ifdef _DEBUG + PX_ASSERT(contacts == (testPtr + testBytes)); +#endif + } + } + + index = it.getNext(); + } + + } +#endif + + // adjust visualization culling box + if(!mVisualizationCullingBox.isEmpty()) + { + mVisualizationCullingBox.minimum -= shift; + mVisualizationCullingBox.maximum -= shift; + } +} + +void PxsContext::swapStreams() +{ + mNpMemBlockPool.swapNpCacheStreams(); +} + +void PxsContext::mergeCMDiscreteUpdateResults(PxBaseTask* /*continuation*/) +{ + PX_PROFILE_ZONE("Sim.narrowPhaseMerge", mContextID); + + this->mNpImplementationContext->appendContactManagers(); + + //Note: the iterator extracts all the items and returns them to the cache on destruction(for thread safety). + PxcThreadCoherentCacheIterator threadContextIt(mNpThreadContextPool); + + for(PxcNpThreadContext* threadContext = threadContextIt.getNext(); threadContext; threadContext = threadContextIt.getNext()) + { + mCMTouchEventCount[PXS_LOST_TOUCH_COUNT] += threadContext->getLocalLostTouchCount(); + mCMTouchEventCount[PXS_NEW_TOUCH_COUNT] += threadContext->getLocalNewTouchCount(); + +#if PX_ENABLE_SIM_STATS + for(PxU32 i=0;imDiscreteContactPairs[i][j]); + #endif + for(PxU32 j=i; jmDiscreteContactPairs[i][j]; + const PxU32 nbModified = threadContext->mModifiedContactPairs[i][j]; + mSimStats.mNbDiscreteContactPairs[i][j] += nb; + mSimStats.mNbModifiedContactPairs[i][j] += nbModified; + mSimStats.mNbDiscreteContactPairsTotal += nb; + } + } + + mSimStats.mNbDiscreteContactPairsWithCacheHits += threadContext->mNbDiscreteContactPairsWithCacheHits; + mSimStats.mNbDiscreteContactPairsWithContacts += threadContext->mNbDiscreteContactPairsWithContacts; + + mSimStats.mTotalCompressedContactSize += threadContext->mCompressedCacheSize; + //KS - this data is not available yet + //mSimStats.mTotalConstraintSize += threadContext->mConstraintSize; + threadContext->clearStats(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + mContactManagerTouchEvent.combineInPlace(threadContext->getLocalChangeTouch()); + //mContactManagerPatchChangeEvent.combineInPlace(threadContext->getLocalPatchChangeMap()); + mTotalCompressedCacheSize += threadContext->mTotalCompressedCacheSize; + mMaxPatches = PxMax(mMaxPatches, threadContext->mMaxPatches); + + threadContext->mTotalCompressedCacheSize = threadContext->mMaxPatches = 0; + } +} + +void PxsContext::updateContactManager(PxReal dt, bool hasBoundsArrayChanged, bool hasContactDistanceChanged, PxBaseTask* continuation, PxBaseTask* firstPassContinuation, + Cm::FanoutTask* updateBoundAndShapeTask) +{ + PX_ASSERT(mNpImplementationContext); + return mNpImplementationContext->updateContactManager(dt, hasBoundsArrayChanged, hasContactDistanceChanged, continuation, + firstPassContinuation, updateBoundAndShapeTask); +} + +void PxsContext::secondPassUpdateContactManager(PxReal dt, PxBaseTask* continuation) +{ + PX_ASSERT(mNpImplementationContext); + mNpImplementationContext->secondPassUpdateContactManager(dt, continuation); +} + +void PxsContext::fetchUpdateContactManager() +{ + PX_ASSERT(mNpImplementationContext); + mNpImplementationContext->fetchUpdateContactManager(); + mergeCMDiscreteUpdateResults(NULL); +} + +void PxsContext::resetThreadContexts() +{ + //Note: the iterator extracts all the items and returns them to the cache on destruction(for thread safety). + PxcThreadCoherentCacheIterator threadContextIt(mNpThreadContextPool); + PxcNpThreadContext* threadContext = threadContextIt.getNext(); + + while(threadContext != NULL) + { + threadContext->reset(mContactManagerTouchEvent.size()); + threadContext = threadContextIt.getNext(); + } +} + +bool PxsContext::getManagerTouchEventCount(int* newTouch, int* lostTouch, int* ccdTouch) const +{ + if(newTouch) + *newTouch = int(mCMTouchEventCount[PXS_NEW_TOUCH_COUNT]); + + if(lostTouch) + *lostTouch = int(mCMTouchEventCount[PXS_LOST_TOUCH_COUNT]); + + if(ccdTouch) + *ccdTouch = int(mCMTouchEventCount[PXS_CCD_RETOUCH_COUNT]); + + return true; +} + +bool PxsContext::fillManagerTouchEvents(PxvContactManagerTouchEvent* newTouch, PxI32& newTouchCount, PxvContactManagerTouchEvent* lostTouch, PxI32& lostTouchCount, + PxvContactManagerTouchEvent* ccdTouch, PxI32& ccdTouchCount) +{ + const PxvContactManagerTouchEvent* newTouchStart = newTouch; + const PxvContactManagerTouchEvent* lostTouchStart = lostTouch; + const PxvContactManagerTouchEvent* ccdTouchStart = ccdTouch; + + const PxvContactManagerTouchEvent* newTouchEnd = newTouch + newTouchCount; + const PxvContactManagerTouchEvent* lostTouchEnd = lostTouch + lostTouchCount; + const PxvContactManagerTouchEvent* ccdTouchEnd = ccdTouch + ccdTouchCount; + + PX_UNUSED(newTouchEnd); + PX_UNUSED(lostTouchEnd); + PX_UNUSED(ccdTouchEnd); + + PxU32 index; + PxBitMap::Iterator it(mContactManagerTouchEvent); + + while((index = it.getNext()) != PxBitMap::Iterator::DONE) + { + PxsContactManager* cm = mContactManagerPool.findByIndexFast(index); + + if(cm->getTouchStatus()) + { + if(!cm->getHasCCDRetouch()) + { + PX_ASSERT(newTouch < newTouchEnd); + newTouch->setCMTouchEventUserData(cm->getShapeInteraction()); + newTouch++; + } + else + { + PX_ASSERT(ccdTouch); + PX_ASSERT(ccdTouch < ccdTouchEnd); + ccdTouch->setCMTouchEventUserData(cm->getShapeInteraction()); + cm->clearCCDRetouch(); + ccdTouch++; + } + } + else + { + PX_ASSERT(lostTouch < lostTouchEnd); + lostTouch->setCMTouchEventUserData(cm->getShapeInteraction()); + lostTouch++; + } + } + + newTouchCount = PxI32(newTouch - newTouchStart); + lostTouchCount = PxI32(lostTouch - lostTouchStart); + ccdTouchCount = PxI32(ccdTouch - ccdTouchStart); + return true; +} + +bool PxsContext::fillManagerTouchEvents2(PxvContactManagerTouchEvent* newTouch, PxI32& newTouchCount, PxvContactManagerTouchEvent* lostTouch, PxI32& lostTouchCount, + PxvContactManagerTouchEvent* ccdTouch, PxI32& ccdTouchCount) +{ + const PxvContactManagerTouchEvent* newTouchStart = newTouch; + const PxvContactManagerTouchEvent* lostTouchStart = lostTouch; + const PxvContactManagerTouchEvent* ccdTouchStart = ccdTouch; + + const PxvContactManagerTouchEvent* newTouchEnd = newTouch + newTouchCount; + const PxvContactManagerTouchEvent* lostTouchEnd = lostTouch + lostTouchCount; + const PxvContactManagerTouchEvent* ccdTouchEnd = ccdTouch + ccdTouchCount; + + PX_UNUSED(newTouchEnd); + PX_UNUSED(lostTouchEnd); + PX_UNUSED(ccdTouchEnd); + + PxsContactManagerOutputCounts* counts = getNphaseImplementationContext()->getFoundPatchOutputCounts(); + PxsContactManager** managers = getNphaseImplementationContext()->getFoundPatchManagers(); + PxU32 nbFoundLost = getNphaseImplementationContext()->getNbFoundPatchManagers(); + + for (PxU32 i = 0; i < nbFoundLost; ++i) + { + //PxsContactManager* cm = managers[i]; + //if (cm->getTouchStatus()) + if (counts[i].statusFlag & PxcNpWorkUnitStatusFlag::eHAS_TOUCH) + { + //if (!cm->getHasCCDRetouch()) + if (!(counts[i].statusFlag & PxcNpWorkUnitStatusFlag::eHAS_CCD_RETOUCH)) + { + PX_ASSERT(newTouch < newTouchEnd); + newTouch->setCMTouchEventUserData(managers[i]->getShapeInteraction()); + newTouch++; + } + else + { + PX_ASSERT(ccdTouch); + PX_ASSERT(ccdTouch < ccdTouchEnd); + ccdTouch->setCMTouchEventUserData(managers[i]->getShapeInteraction()); + managers[i]->clearCCDRetouch(); + ccdTouch++; + } + } + else + { + PX_ASSERT(lostTouch < lostTouchEnd); + lostTouch->setCMTouchEventUserData(managers[i]->getShapeInteraction()); + lostTouch++; + } + } + + newTouchCount = PxI32(newTouch - newTouchStart); + lostTouchCount = PxI32(lostTouch - lostTouchStart); + ccdTouchCount = PxI32(ccdTouch - ccdTouchStart); + return true; +} + +void PxsContext::beginUpdate() +{ +#if PX_ENABLE_SIM_STATS + mSimStats.clearAll(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp new file mode 100644 index 0000000..cef1409 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsDefaultMemoryManager.cpp @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxsDefaultMemoryManager.h" // PT: TODO: remove this empty file? +#include "PxsMemoryManager.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxArray.h" + +using namespace physx; + +namespace +{ + class PxsDefaultMemoryAllocator : public PxVirtualAllocatorCallback + { + public: + virtual void* allocate(const size_t size, const int, const char*, const int) { return PX_ALLOC(size, "unused"); } + virtual void deallocate(void* ptr) { PX_FREE(ptr); } + }; + + class PxsDefaultMemoryManager : public PxsMemoryManager + { + public: + // PxsMemoryManager + virtual PxVirtualAllocatorCallback* getHostMemoryAllocator() PX_OVERRIDE { return &mDefaultMemoryAllocator; } + virtual PxVirtualAllocatorCallback* getDeviceMemoryAllocator() PX_OVERRIDE { return NULL; } + //~PxsMemoryManager + PxsDefaultMemoryAllocator mDefaultMemoryAllocator; + }; +} + +PxsMemoryManager* physx::createDefaultMemoryManager() +{ + return PX_NEW(PxsDefaultMemoryManager); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp new file mode 100644 index 0000000..25e738b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsIslandSim.cpp @@ -0,0 +1,2392 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxsIslandSim.h" +#include "foundation/PxSort.h" +#include "foundation/PxUtilities.h" +#include "common/PxProfileZone.h" +#include "DyFeatherstoneArticulation.h" + +#define IG_SANITY_CHECKS 0 + +namespace physx +{ +namespace IG +{ + + IslandSim::IslandSim(PxArray* firstPartitionEdges, Cm::BlockArray& edgeNodeIndices, + PxArray* destroyedPartitionEdges, PxU64 contextID) : + mNodes("IslandSim::mNodes"), + mActiveNodeIndex("IslandSim::mActiveNodeIndex"), + mIslands("IslandSim::mIslands"), + mIslandStaticTouchCount("IslandSim.activeStaticTouchCount"), + mActiveKinematicNodes("IslandSim::mActiveKinematicNodes"), + mHopCounts("IslandSim::mHopCounts"), + mFastRoute("IslandSim::,FastRoute"), + mIslandIds("IslandSim::mIslandIds"), + mActiveIslands("IslandSim::mActiveIslands"), + mLastMapIndex(0), + mActivatingNodes("IslandSim::mActivatingNodes"), + mDestroyedEdges("IslandSim::mDestroyedEdges"), + mTempIslandIds("IslandSim::mTempIslandIds"), + mVisitedNodes("IslandSim::mVisitedNodes"), + mFirstPartitionEdges(firstPartitionEdges), + mEdgeNodeIndices(edgeNodeIndices), + mDestroyedPartitionEdges(destroyedPartitionEdges), + mContextId(contextID) + { + mNpIndexPtr = NULL; + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + mInitialActiveNodeCount[i] = 0; + mActiveEdgeCount[i] = 0; + } + } + +#if PX_ENABLE_ASSERTS +template +static bool contains(PxArray& arr, const Thing& thing) +{ + for(PxU32 a = 0; a < arr.size(); ++a) + { + if(thing == arr[a]) + return true; + } + return false; +} +#endif + +void IslandSim::resize(const PxU32 nbNodes, const PxU32 nbContactManagers, const PxU32 nbConstraints) +{ + PxU32 totalEdges = nbContactManagers + nbConstraints; + mNodes.reserve(nbNodes); + mIslandIds.reserve(nbNodes); + mEdges.reserve(totalEdges); + mActiveContactEdges.resize(totalEdges); + mEdgeInstances.reserve(totalEdges*2); +} + +void IslandSim::addNode(bool isActive, bool isKinematic, Node::NodeType type, PxNodeIndex nodeIndex) +{ + PxU32 handle = nodeIndex.index(); + if(handle == mNodes.capacity()) + { + const PxU32 newCapacity = PxMax(2*mNodes.capacity(), 256u); + mNodes.reserve(newCapacity); + mIslandIds.reserve(newCapacity); + mFastRoute.reserve(newCapacity); + mHopCounts.reserve(newCapacity); + mActiveNodeIndex.reserve(newCapacity); + } + + const PxU32 newSize = PxMax(handle+1, mNodes.size()); + mNodes.resize(newSize); + mIslandIds.resize(newSize); + mFastRoute.resize(newSize); + mHopCounts.resize(newSize); + mActiveNodeIndex.resize(newSize); + + mActiveNodeIndex[handle] = PX_INVALID_NODE; + + + Node& node = mNodes[handle]; + node.mType = PxTo8(type); + //Ensure that the node is not currently being used. + PX_ASSERT(node.isDeleted()); + + PxU8 flags = PxU16(isActive ? 0 : Node::eREADY_FOR_SLEEPING); + if(isKinematic) + flags |= Node::eKINEMATIC; + node.mFlags = flags; + mIslandIds[handle] = IG_INVALID_ISLAND; + mFastRoute[handle].setIndices(PX_INVALID_NODE); + mHopCounts[handle] = 0; + + if(!isKinematic) + { + IslandId islandHandle = mIslandHandles.getHandle(); + + if(islandHandle == mIslands.capacity()) + { + const PxU32 newCapacity = PxMax(2*mIslands.capacity(), 256u); + mIslands.reserve(newCapacity); + mIslandAwake.resize(newCapacity); + mIslandStaticTouchCount.reserve(newCapacity); + } + mIslands.resize(PxMax(islandHandle+1, mIslands.size())); + mIslandStaticTouchCount.resize(PxMax(islandHandle+1, mIslands.size())); + mIslandAwake.growAndReset(PxMax(islandHandle+1, mIslands.size())); + Island& island = mIslands[islandHandle]; + island.mLastNode = island.mRootNode = nodeIndex; + island.mSize[type] = 1; + mIslandIds[handle] = islandHandle; + mIslandStaticTouchCount[islandHandle] = 0; + } + + if(isActive) + { + activateNode(nodeIndex); + } +} + +void IslandSim::addRigidBody(PxsRigidBody* body, bool isKinematic, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, isKinematic, Node::eRIGID_BODY_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mRigidBody = body; +} + +void IslandSim::addArticulation(Sc::ArticulationSim* /*articulation*/, Dy::FeatherstoneArticulation* llArtic, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, false, Node::eARTICULATION_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mLLArticulation = llArtic; +} + +Sc::ArticulationSim* IslandSim::getArticulationSim(PxNodeIndex nodeIndex) const +{ + void* userData = getLLArticulation(nodeIndex)->getUserData(); + return reinterpret_cast(userData); +} + +#if PX_SUPPORT_GPU_PHYSX +void IslandSim::addSoftBody(Dy::SoftBody* llSoftBody, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, false, Node::eSOFTBODY_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mLLSoftBody = llSoftBody; +} + +void IslandSim::addFEMCloth(Dy::FEMCloth* llFEMCloth, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, false, Node::eFEMCLOTH_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mLLFEMCloth = llFEMCloth; +} + +void IslandSim::addParticleSystem(Dy::ParticleSystem* llParticleSystem, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, false, Node::ePARTICLESYSTEM_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mLLParticleSystem = llParticleSystem; +} + +void IslandSim::addHairSystem(Dy::HairSystem* llHairSystem, bool isActive, PxNodeIndex nodeIndex) +{ + addNode(isActive, false, Node::eHAIRSYSTEM_TYPE, nodeIndex); + Node& node = mNodes[nodeIndex.index()]; + node.mLLHairSystem = llHairSystem; +} +#endif + +void IslandSim::connectEdge(EdgeInstance& instance, EdgeInstanceIndex edgeIndex, Node& source, PxNodeIndex /*destination*/) +{ + PX_ASSERT(instance.mNextEdge == IG_INVALID_EDGE); + PX_ASSERT(instance.mPrevEdge == IG_INVALID_EDGE); + + instance.mNextEdge = source.mFirstEdgeIndex; + if(source.mFirstEdgeIndex != IG_INVALID_EDGE) + { + EdgeInstance& firstEdge = mEdgeInstances[source.mFirstEdgeIndex]; + firstEdge.mPrevEdge = edgeIndex; + } + + source.mFirstEdgeIndex = edgeIndex; + instance.mPrevEdge = IG_INVALID_EDGE; +} + +void IslandSim::addConnection(PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Edge::EdgeType edgeType, EdgeIndex handle) +{ + PX_UNUSED(nodeHandle1); + PX_UNUSED(nodeHandle2); + if(handle >= mEdges.capacity()) + { + PX_PROFILE_ZONE("ReserveIslandEdges", getContextId()); + const PxU32 newSize = handle + 2048; + mEdges.reserve(newSize); + mActiveContactEdges.resize(mEdges.capacity()); + } + mEdges.resize(PxMax(mEdges.size(), handle+1)); + mActiveContactEdges.reset(handle); + + Edge& edge = mEdges[handle]; + + if(edge.isPendingDestroyed()) + { + //If it's in this state, then the edge has been tagged for destruction but actually is now not needed to be destroyed + edge.clearPendingDestroyed(); + return; + } + + if(edge.isInDirtyList()) + { + PX_ASSERT(mEdgeNodeIndices[handle * 2].index() == nodeHandle1.index()); + PX_ASSERT(mEdgeNodeIndices[handle * 2 + 1].index() == nodeHandle2.index()); + PX_ASSERT(edge.mEdgeType == edgeType); + return; + } + + PX_ASSERT(!edge.isInserted()); + + PX_ASSERT(edge.isDestroyed()); + edge.clearDestroyed(); + + PX_ASSERT(edge.mNextIslandEdge == IG_INVALID_ISLAND); + PX_ASSERT(edge.mPrevIslandEdge == IG_INVALID_ISLAND); + + PX_ASSERT(mEdgeInstances.size() <= 2*handle || mEdgeInstances[2*handle].mNextEdge == IG_INVALID_EDGE); + PX_ASSERT(mEdgeInstances.size() <= 2*handle || mEdgeInstances[2*handle+1].mNextEdge == IG_INVALID_EDGE); + PX_ASSERT(mEdgeInstances.size() <= 2*handle || mEdgeInstances[2*handle].mPrevEdge == IG_INVALID_EDGE); + PX_ASSERT(mEdgeInstances.size() <= 2*handle || mEdgeInstances[2*handle+1].mPrevEdge == IG_INVALID_EDGE); + + edge.mEdgeType = edgeType; + + PX_ASSERT(handle*2 >= mEdgeInstances.size() || mEdgeInstances[handle*2].mNextEdge == IG_INVALID_EDGE); + PX_ASSERT(handle*2+1 >= mEdgeInstances.size() || mEdgeInstances[handle*2+1].mNextEdge == IG_INVALID_EDGE); + PX_ASSERT(handle*2 >= mEdgeInstances.size() || mEdgeInstances[handle*2].mPrevEdge == IG_INVALID_EDGE); + PX_ASSERT(handle*2+1 >= mEdgeInstances.size() || mEdgeInstances[handle*2+1].mPrevEdge == IG_INVALID_EDGE); + + //Add the new handle + if(!edge.isInDirtyList()) + { + PX_ASSERT(!contains(mDirtyEdges[edgeType], handle)); + mDirtyEdges[edgeType].pushBack(handle); + edge.markInDirtyList(); + } + edge.mEdgeState &= ~(Edge::eACTIVATING); +} + +void IslandSim::addConnectionToGraph(EdgeIndex handle) +{ + EdgeInstanceIndex instanceHandle = 2*handle; + PX_ASSERT(instanceHandle < mEdgeInstances.capacity()); + /*if(instanceHandle == mEdgeInstances.capacity()) + { + mEdgeInstances.reserve(2*mEdgeInstances.capacity() + 2); + }*/ + mEdgeInstances.resize(PxMax(instanceHandle+2, mEdgeInstances.size())); + + Edge& edge = mEdges[handle]; + + bool activeEdge = false; + bool kinematicKinematicEdge = true; + + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[instanceHandle]; + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[instanceHandle+1]; + + if(nodeIndex1.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex1.index()]; + connectEdge(mEdgeInstances[instanceHandle], instanceHandle, node, nodeIndex2); + activeEdge = node.isActive() || node.isActivating(); + kinematicKinematicEdge = node.isKinematic(); + } + + if (nodeIndex1.index() != nodeIndex2.index() && nodeIndex2.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex2.index()]; + connectEdge(mEdgeInstances[instanceHandle + 1], instanceHandle + 1, node, nodeIndex1); + activeEdge = activeEdge || node.isActive() || node.isActivating(); + kinematicKinematicEdge = kinematicKinematicEdge && node.isKinematic(); + } + + if(activeEdge && (!kinematicKinematicEdge || edge.getEdgeType() == IG::Edge::eCONTACT_MANAGER)) + { + markEdgeActive(handle); + edge.activateEdge(); + } +} + +void IslandSim::removeConnectionFromGraph(EdgeIndex edgeIndex) +{ + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[2 * edgeIndex]; + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[2 * edgeIndex+1]; + if (nodeIndex1.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex1.index()]; + if (nodeIndex2.index() == mFastRoute[nodeIndex1.index()].index()) + mFastRoute[nodeIndex1.index()].setIndices(PX_INVALID_NODE); + if(!node.isDirty()) + { + //mDirtyNodes.pushBack(nodeIndex1); + mDirtyMap.growAndSet(nodeIndex1.index()); + node.markDirty(); + } + } + + if (nodeIndex2.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex2.index()]; + if (nodeIndex1.index() == mFastRoute[nodeIndex2.index()].index()) + mFastRoute[nodeIndex2.index()].setIndices(PX_INVALID_NODE); + if(!node.isDirty()) + { + mDirtyMap.growAndSet(nodeIndex2.index()); + node.markDirty(); + } + } +} + +void IslandSim::disconnectEdge(EdgeInstance& instance, EdgeInstanceIndex edgeIndex, Node& node) +{ + + PX_ASSERT(instance.mNextEdge == IG_INVALID_EDGE || mEdgeInstances[instance.mNextEdge].mPrevEdge == edgeIndex); + PX_ASSERT(instance.mPrevEdge == IG_INVALID_EDGE || mEdgeInstances[instance.mPrevEdge].mNextEdge == edgeIndex); + + if(node.mFirstEdgeIndex == edgeIndex) + { + PX_ASSERT(instance.mPrevEdge == IG_INVALID_EDGE); + node.mFirstEdgeIndex = instance.mNextEdge; + } + else + { + EdgeInstance& prev = mEdgeInstances[instance.mPrevEdge]; + PX_ASSERT(prev.mNextEdge == edgeIndex); + prev.mNextEdge = instance.mNextEdge; + } + + if(instance.mNextEdge != IG_INVALID_EDGE) + { + EdgeInstance& next = mEdgeInstances[instance.mNextEdge]; + PX_ASSERT(next.mPrevEdge == edgeIndex); + next.mPrevEdge = instance.mPrevEdge; + } + + PX_ASSERT(instance.mNextEdge == IG_INVALID_EDGE || mEdgeInstances[instance.mNextEdge].mPrevEdge == instance.mPrevEdge); + PX_ASSERT(instance.mPrevEdge == IG_INVALID_EDGE || mEdgeInstances[instance.mPrevEdge].mNextEdge == instance.mNextEdge); + + instance.mNextEdge = IG_INVALID_EDGE; + instance.mPrevEdge = IG_INVALID_EDGE; +} + +void IslandSim::removeConnection(EdgeIndex edgeIndex) +{ + Edge& edge = mEdges[edgeIndex]; + if(!edge.isPendingDestroyed())// && edge.isInserted()) + { + mDestroyedEdges.pushBack(edgeIndex); + /*if(!edge.isInserted()) + edge.setReportOnlyDestroy();*/ + } + edge.setPendingDestroyed(); +} + +void IslandSim::removeConnectionInternal(EdgeIndex edgeIndex) +{ + PX_ASSERT(edgeIndex != IG_INVALID_EDGE); + EdgeInstanceIndex edgeInstanceBase = edgeIndex*2; + + + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[edgeIndex * 2]; + + if (nodeIndex1.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex1.index()]; + disconnectEdge(mEdgeInstances[edgeInstanceBase], edgeInstanceBase, node); + } + + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[edgeIndex * 2 + 1]; + + if (nodeIndex2.index() != PX_INVALID_NODE && nodeIndex1.index() != nodeIndex2.index()) + { + Node& node = mNodes[nodeIndex2.index()]; + disconnectEdge(mEdgeInstances[edgeInstanceBase+1], edgeInstanceBase+1, node); + } +} + + +void IslandSim::addContactManager(PxsContactManager* /*manager*/, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, EdgeIndex handle) +{ + addConnection(nodeHandle1, nodeHandle2, Edge::eCONTACT_MANAGER, handle); +} + +void IslandSim::addConstraint(Dy::Constraint* /*constraint*/, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, EdgeIndex handle) +{ + addConnection(nodeHandle1, nodeHandle2, Edge::eCONSTRAINT, handle); +} + +void IslandSim::activateNode(PxNodeIndex nodeIndex) +{ + if(nodeIndex.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex.index()]; + + if(!(node.isActive() || + node.isActivating())) + { + + //If the node is kinematic and already in the active node list, then we need to remove it + //from the active kinematic node list, then re-add it after the wake-up. It's a bit stupid + //but it means that we don't need another index + + if(node.isKinematic() && mActiveNodeIndex[nodeIndex.index()] != PX_INVALID_NODE) + { + //node.setActive(); + //node.clearIsReadyForSleeping(); //Clear the "isReadyForSleeping" flag. Just in case it was set + //return; + + PxU32 activeRefCount = node.mActiveRefCount; + node.mActiveRefCount = 0; + node.clearActive(); + markKinematicInactive(nodeIndex); + node.mActiveRefCount = activeRefCount; + } + + node.setActivating(); //Tag it as activating + PX_ASSERT(mActiveNodeIndex[nodeIndex.index()] == PX_INVALID_NODE); + mActiveNodeIndex[nodeIndex.index()] = mActivatingNodes.size(); + //Add to waking list + mActivatingNodes.pushBack(nodeIndex); + } + node.clearIsReadyForSleeping(); //Clear the "isReadyForSleeping" flag. Just in case it was set + node.clearDeactivating(); + } +} + +void IslandSim::deactivateNode(PxNodeIndex nodeIndex) +{ + if(nodeIndex.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeIndex.index()]; + + //If the node is activating, clear its activating state and remove it from the activating list. + //If it wasn't already activating, then it's probably already in the active list + + bool wasActivating = node.isActivating(); + + if(wasActivating) + { + //Already activating, so remove it from the activating list + node.clearActivating(); + PX_ASSERT(mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]].index() == nodeIndex.index()); + PxNodeIndex replaceIndex = mActivatingNodes[mActivatingNodes.size()-1]; + mActiveNodeIndex[replaceIndex.index()] = mActiveNodeIndex[nodeIndex.index()]; + mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]] = replaceIndex; + mActivatingNodes.forceSize_Unsafe(mActivatingNodes.size()-1); + mActiveNodeIndex[nodeIndex.index()] = PX_INVALID_NODE; + + if(node.isKinematic()) + { + //If we were temporarily removed from the active kinematic list to be put in the waking kinematic list + //then add the node back in before deactivating the node. This is a bit counter-intuitive but the active + //kinematic list contains all active kinematics and all kinematics that are referenced by an active constraint + PX_ASSERT(mActiveNodeIndex[nodeIndex.index()] == PX_INVALID_NODE); + mActiveNodeIndex[nodeIndex.index()] = mActiveKinematicNodes.size(); + mActiveKinematicNodes.pushBack(nodeIndex); + } + } + + //Raise the "ready for sleeping" flag so that island gen can put this node to sleep + node.setIsReadyForSleeping(); + } +} + +void IslandSim::putNodeToSleep(PxNodeIndex nodeIndex) +{ + if(nodeIndex.index() != PX_INVALID_NODE) + { + deactivateNode(nodeIndex); + } +} + + +void IslandSim::activateNodeInternal(PxNodeIndex nodeIndex) +{ + //This method should activate the node, then activate all the connections involving this node + Node& node = mNodes[nodeIndex.index()]; + + if(!node.isActive()) + { + PX_ASSERT(mActiveNodeIndex[nodeIndex.index()] == PX_INVALID_NODE); + + //Activate all the edges + nodes... + + EdgeInstanceIndex index = node.mFirstEdgeIndex; + + while(index != IG_INVALID_EDGE) + { + EdgeIndex idx = index/2; + Edge& edge = mEdges[idx]; //InstanceIndex/2 = edgeIndex + if(!edge.isActive()) + { + //Make the edge active... + PX_ASSERT(mEdgeNodeIndices[idx * 2].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2].index()].isKinematic()); + PX_ASSERT(mEdgeNodeIndices[idx * 2 + 1].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isKinematic()); + + markEdgeActive(idx); + edge.activateEdge(); + + } + index = mEdgeInstances[index].mNextEdge; + } + + if(node.isKinematic()) + { + markKinematicActive(nodeIndex); + } + else + { + markActive(nodeIndex); + } + node.setActive(); + } + +} + +void IslandSim::deactivateNodeInternal(PxNodeIndex nodeIndex) +{ + //We deactivate a node, we need to loop through all the edges and deactivate them *if* both bodies are asleep + + Node& node = mNodes[nodeIndex.index()]; + + if(node.isActive()) + { + if(node.isKinematic()) + { + markKinematicInactive(nodeIndex); + } + else + { + markInactive(nodeIndex); + } + + //Clear the active status flag + node.clearActive(); + node.clearActivating(); + + EdgeInstanceIndex index = node.mFirstEdgeIndex; + + while(index != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[index]; + + + PxNodeIndex outboundNode = mEdgeNodeIndices[index ^ 1]; + if(outboundNode.index() == PX_INVALID_NODE || + !mNodes[outboundNode.index()].isActive()) + { + EdgeIndex idx = index/2; + Edge& edge = mEdges[idx]; //InstanceIndex/2 = edgeIndex + //PX_ASSERT(edge.isActive()); //The edge must currently be inactive because the node was active + //Deactivate the edge if both nodes connected are inactive OR if one node is static/kinematic and the other is inactive... + PX_ASSERT(mEdgeNodeIndices[index & (~1)].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[index & (~1)].index()].isActive()); + PX_ASSERT(mEdgeNodeIndices[index | 1].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[index | 1].index()].isActive()); + if(edge.isActive()) + { + edge.deactivateEdge(); + mActiveEdgeCount[edge.mEdgeType]--; + removeEdgeFromActivatingList(idx); + mDeactivatingEdges[edge.mEdgeType].pushBack(idx); + } + } + index = instance.mNextEdge; + } + } + +} + +bool IslandSim::canFindRoot(PxNodeIndex startNode, PxNodeIndex targetNode, PxArray* visitedNodes) +{ + if(visitedNodes) + visitedNodes->pushBack(startNode); + if(startNode.index() == targetNode.index()) + return true; + PxBitMap visitedState; + visitedState.resizeAndClear(mNodes.size()); + + PxArray stack; + + stack.pushBack(startNode); + + visitedState.set(startNode.index()); + + do + { + PxNodeIndex currentIndex = stack.popBack(); + Node& currentNode = mNodes[currentIndex.index()]; + + EdgeInstanceIndex currentEdge = currentNode.mFirstEdgeIndex; + + while(currentEdge != IG_INVALID_EDGE) + { + EdgeInstance& edge = mEdgeInstances[currentEdge]; + PxNodeIndex outboundNode = mEdgeNodeIndices[currentEdge ^ 1]; + if(outboundNode.index() != PX_INVALID_NODE && !mNodes[outboundNode.index()].isKinematic() && !visitedState.test(outboundNode.index())) + { + if(outboundNode.index() == targetNode.index()) + { + return true; + } + + visitedState.set(outboundNode.index()); + stack.pushBack(outboundNode); + if(visitedNodes) + visitedNodes->pushBack(outboundNode); + } + + currentEdge = edge.mNextEdge; + } + + } + while(stack.size()); + + return false; + +} + + + +void IslandSim::unwindRoute(PxU32 traversalIndex, PxNodeIndex lastNode, PxU32 hopCount, IslandId id) +{ + //We have found either a witness *or* the root node with this traversal. In the event of finding the root node, hopCount will be 0. In the event of finding + //a witness, hopCount will be the hopCount that witness reported as being the distance to the root. + + PxU32 currIndex = traversalIndex; + PxU32 hc = hopCount+1; //Add on 1 for the hop to the witness/root node. + do + { + TraversalState& state = mVisitedNodes[currIndex]; + mHopCounts[state.mNodeIndex.index()] = hc++; + mIslandIds[state.mNodeIndex.index()] = id; + mFastRoute[state.mNodeIndex.index()] = lastNode; + currIndex = state.mPrevIndex; + lastNode = state.mNodeIndex; + } + while(currIndex != PX_INVALID_NODE); +} + +void IslandSim::activateIsland(IslandId islandId) +{ + Island& island = mIslands[islandId]; + PX_ASSERT(!mIslandAwake.test(islandId)); + PX_ASSERT(island.mActiveIndex == IG_INVALID_ISLAND); + + PxNodeIndex currentNode = island.mRootNode; + while(currentNode.index() != PX_INVALID_NODE) + { + activateNodeInternal(currentNode); + currentNode = mNodes[currentNode.index()].mNextNode; + } + markIslandActive(islandId); +} + +void IslandSim::deactivateIsland(IslandId islandId) +{ + PX_ASSERT(mIslandAwake.test(islandId)); + Island& island = mIslands[islandId]; + + PxNodeIndex currentNode = island.mRootNode; + while(currentNode.index() != PX_INVALID_NODE) + { + Node& node = mNodes[currentNode.index()]; + + //if(mActiveNodeIndex[currentNode.index()] < mInitialActiveNodeCount[node.mType]) + mNodesToPutToSleep[node.mType].pushBack(currentNode); //If this node was previously active, then push it to the list of nodes to deactivate + deactivateNodeInternal(currentNode); + currentNode = node.mNextNode; + } + markIslandInactive(islandId); +} + + +void IslandSim::wakeIslands() +{ + PX_PROFILE_ZONE("Basic.wakeIslands", getContextId()); + + //(1) Iterate over activating nodes and activate them + + + PxU32 originalActiveIslands = mActiveIslands.size(); + + for (PxU32 a = 0; a < Edge::eEDGE_TYPE_COUNT; ++a) + { + for (PxU32 i = 0, count = mActivatedEdges[a].size(); i < count; ++i) + { + IG::Edge& edge = mEdges[mActivatedEdges[a][i]]; + edge.mEdgeState &= (~Edge::eACTIVATING); + } + + mActivatedEdges[a].forceSize_Unsafe(0); + } + + /*mInitialActiveEdgeCount[0] = mActiveEdges[0].size(); + mInitialActiveEdgeCount[1] = mActiveEdges[1].size();*/ + + for (PxU32 a = 0; a < Edge::eEDGE_TYPE_COUNT; ++a) + { + mInitialActiveNodeCount[a] = mActiveNodes[a].size(); + } + + for(PxU32 a = 0; a < mActivatingNodes.size(); ++a) + { + PxNodeIndex wakeNode = mActivatingNodes[a]; + + IslandId islandId = mIslandIds[wakeNode.index()]; + + Node& node = mNodes[wakeNode.index()]; + node.clearActivating(); + if(islandId != IG_INVALID_ISLAND) + { + if(!mIslandAwake.test(islandId)) + { + markIslandActive(islandId); + } + mActiveNodeIndex[wakeNode.index()] = PX_INVALID_NODE; //Mark active node as invalid. + activateNodeInternal(wakeNode); + } + else + { + PX_ASSERT(node.isKinematic()); + node.setActive(); + PX_ASSERT(mActiveNodeIndex[wakeNode.index()] == a); + mActiveNodeIndex[wakeNode.index()] = mActiveKinematicNodes.size(); + mActiveKinematicNodes.pushBack(wakeNode); + + //Wake up the islands connected to this waking kinematic! + EdgeInstanceIndex index = node.mFirstEdgeIndex; + while(index != IG_INVALID_EDGE) + { + EdgeInstance& edgeInstance = mEdgeInstances[index]; + + PxNodeIndex outboundNode = mEdgeNodeIndices[index ^ 1]; + //Edge& edge = mEdges[index/2]; + //if(edge.isConnected()) //Only wake up if the edge is not connected... + PxNodeIndex nodeIndex = outboundNode; + + if (nodeIndex.isStaticBody() || mIslandIds[nodeIndex.index()] == IG_INVALID_ISLAND) + { + //If the edge connects to a static body *or* it connects to a node which is not part of an island (i.e. a kinematic), then activate the edge + EdgeIndex idx = index / 2; + Edge& edge = mEdges[idx]; + if (!edge.isActive() && edge.getEdgeType() != IG::Edge::eCONSTRAINT) + { + //Make the edge active... + PX_ASSERT(mEdgeNodeIndices[idx * 2].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2].index()].isKinematic()); + PX_ASSERT(mEdgeNodeIndices[idx * 2 + 1].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isKinematic()); + + markEdgeActive(idx); + edge.activateEdge(); + + } + } + else + { + IslandId connectedIslandId = mIslandIds[nodeIndex.index()]; + if(!mIslandAwake.test(connectedIslandId)) + { + //Wake up that island + markIslandActive(connectedIslandId); + } + } + + index = edgeInstance.mNextEdge; + } + } + } + + + + mActivatingNodes.forceSize_Unsafe(0); + + for(PxU32 a = originalActiveIslands; a < mActiveIslands.size(); ++a) + { + Island& island = mIslands[mActiveIslands[a]]; + + PxNodeIndex currentNode = island.mRootNode; + while(currentNode.index() != PX_INVALID_NODE) + { + activateNodeInternal(currentNode); + currentNode = mNodes[currentNode.index()].mNextNode; + } + } +} + +void IslandSim::wakeIslands2() +{ + PxU32 originalActiveIslands = mActiveIslands.size(); + + for (PxU32 a = 0; a < mActivatingNodes.size(); ++a) + { + PxNodeIndex wakeNode = mActivatingNodes[a]; + + IslandId islandId = mIslandIds[wakeNode.index()]; + + Node& node = mNodes[wakeNode.index()]; + node.clearActivating(); + if (islandId != IG_INVALID_ISLAND) + { + if (!mIslandAwake.test(islandId)) + { + markIslandActive(islandId); + } + mActiveNodeIndex[wakeNode.index()] = PX_INVALID_NODE; //Mark active node as invalid. + activateNodeInternal(wakeNode); + } + else + { + PX_ASSERT(node.isKinematic()); + node.setActive(); + PX_ASSERT(mActiveNodeIndex[wakeNode.index()] == a); + mActiveNodeIndex[wakeNode.index()] = mActiveKinematicNodes.size(); + mActiveKinematicNodes.pushBack(wakeNode); + + //Wake up the islands connected to this waking kinematic! + EdgeInstanceIndex index = node.mFirstEdgeIndex; + while (index != IG_INVALID_EDGE) + { + EdgeInstance& edgeInstance = mEdgeInstances[index]; + + PxNodeIndex outboundNode = mEdgeNodeIndices[index ^ 1]; + //Edge& edge = mEdges[index/2]; + //if(edge.isConnected()) //Only wake up if the edge is not connected... + PxNodeIndex nodeIndex = outboundNode; + + if (nodeIndex.isStaticBody() || mIslandIds[nodeIndex.index()] == IG_INVALID_ISLAND) + { + //If the edge connects to a static body *or* it connects to a node which is not part of an island (i.e. a kinematic), then activate the edge + EdgeIndex idx = index / 2; + Edge& edge = mEdges[idx]; + if (!edge.isActive() && edge.getEdgeType() != IG::Edge::eCONSTRAINT) + { + //Make the edge active... + PX_ASSERT(mEdgeNodeIndices[idx * 2].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2].index()].isKinematic()); + PX_ASSERT(mEdgeNodeIndices[idx * 2 + 1].index() == PX_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isKinematic()); + + markEdgeActive(idx); + edge.activateEdge(); + + } + } + else + { + IslandId connectedIslandId = mIslandIds[nodeIndex.index()]; + if (!mIslandAwake.test(connectedIslandId)) + { + //Wake up that island + markIslandActive(connectedIslandId); + } + } + + index = edgeInstance.mNextEdge; + } + } + } + + mActivatingNodes.forceSize_Unsafe(0); + + for (PxU32 a = originalActiveIslands; a < mActiveIslands.size(); ++a) + { + Island& island = mIslands[mActiveIslands[a]]; + + PxNodeIndex currentNode = island.mRootNode; + while (currentNode.index() != PX_INVALID_NODE) + { + activateNodeInternal(currentNode); + currentNode = mNodes[currentNode.index()].mNextNode; + } + } +} + +void IslandSim::insertNewEdges() +{ + PX_PROFILE_ZONE("Basic.insertNewEdges", getContextId()); + + mEdgeInstances.reserve(mEdges.capacity()*2); + + for(PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + for(PxU32 a = 0; a < mDirtyEdges[i].size(); ++a) + { + EdgeIndex edgeIndex = mDirtyEdges[i][a]; + + Edge& edge = mEdges[edgeIndex]; + + if(!edge.isPendingDestroyed()) + { + //PX_ASSERT(!edge.isInserted()); + if(!edge.isInserted()) + { + addConnectionToGraph(edgeIndex); + edge.setInserted(); + } + } + } + } +} + +void IslandSim::removeDestroyedEdges() +{ + PX_PROFILE_ZONE("Basic.removeDestroyedEdges", getContextId()); + + for(PxU32 a = 0; a < mDestroyedEdges.size(); ++a) + { + EdgeIndex edgeIndex = mDestroyedEdges[a]; + + Edge& edge = mEdges[edgeIndex]; + + if(edge.isPendingDestroyed()) + { + if(!edge.isInDirtyList() && edge.isInserted()) + { + PX_ASSERT(edge.isInserted()); + removeConnectionInternal(edgeIndex); + removeConnectionFromGraph(edgeIndex); + //edge.clearInserted(); + } + //edge.clearDestroyed(); + } + } +} + +void IslandSim::processNewEdges() +{ + PX_PROFILE_ZONE("Basic.processNewEdges", getContextId()); + //Stage 1: we process the list of new pairs. To do this, we need to first sort them based on a predicate... + + insertNewEdges(); + + mHopCounts.resize(mNodes.size()); //Make sure we have enough space for hop counts for all nodes + mFastRoute.resize(mNodes.size()); + + + for(PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + for(PxU32 a = 0; a < mDirtyEdges[i].size(); ++a) + { + EdgeIndex edgeIndex = mDirtyEdges[i][a]; + Edge& edge = mEdges[edgeIndex]; + + /*PX_ASSERT(edge.mState != Edge::eDESTROYED || ((edge.mNode1.index() == PX_INVALID_NODE || mNodes[edge.mNode1.index()].isKinematic() || mNodes[edge.mNode1.index()].isActive() == false) && + (edge.mNode2.index() == PX_INVALID_NODE || mNodes[edge.mNode2.index()].isKinematic() || mNodes[edge.mNode2.index()].isActive() == false)));*/ + + //edge.clearInDirtyList(); + + + //We do not process either destroyed or disconnected edges + if(/*edge.isConnected() && */!edge.isPendingDestroyed()) + { + //Conditions: + //(1) Neither body is in an island (static/kinematics are never in islands) so we need to create a new island containing these bodies + // or just 1 body if the other is kinematic/static + //(2) Both bodies are already in the same island. Update root node hop count estimates for the bodies if a route through the new connection + // is shorter for either body + //(3) One body is already in an island and the other isn't, so we just add the new body to the existing island. + //(4) Both bodies are in different islands. In that case, we merge the islands + + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[2 * edgeIndex]; + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[2 * edgeIndex+1]; + + IslandId islandId1 = nodeIndex1.index() == PX_INVALID_NODE ? IG_INVALID_ISLAND : mIslandIds[nodeIndex1.index()]; + IslandId islandId2 = nodeIndex2.index() == PX_INVALID_NODE ? IG_INVALID_ISLAND : mIslandIds[nodeIndex2.index()]; + + //TODO - wake ups!!!! + //If one of the nodes is awake and the other is asleep, we need to wake 'em up + + //When a node is activated, the island must also be activated... + + bool active1 = nodeIndex1.index() != PX_INVALID_NODE && mNodes[nodeIndex1.index()].isActive(); + bool active2 = nodeIndex2.index() != PX_INVALID_NODE && mNodes[nodeIndex2.index()].isActive(); + + IslandId islandId = IG_INVALID_ISLAND; + + if(islandId1 == IG_INVALID_ISLAND && islandId2 == IG_INVALID_ISLAND) + { + //All nodes should be introduced in an island now unless they are static or kinematic. Therefore, if we get here, we have an edge + //between 2 kinematic nodes or a kinematic and static node. These should not influence island management so we should just ignore + //these edges. + } + else if(islandId1 == islandId2) + { + islandId = islandId1; + if(active1 || active2) + { + PX_ASSERT(mIslandAwake.test(islandId1)); //If we got here, where the 2 were already in an island, if 1 node is awake, the whole island must be awake + } + //Both bodies in the same island. Nothing major to do already but we should see if this creates a shorter path to root for either node + PxU32 hopCount1 = mHopCounts[nodeIndex1.index()]; + PxU32 hopCount2 = mHopCounts[nodeIndex2.index()]; + if((hopCount1+1) < hopCount2) + { + //It would be faster for node 2 to go through node 1 + mHopCounts[nodeIndex2.index()] = hopCount1 + 1; + mFastRoute[nodeIndex2.index()] = nodeIndex1; + } + else if((hopCount2+1) < hopCount1) + { + //It would be faster for node 1 to go through node 2 + mHopCounts[nodeIndex1.index()] = hopCount2 + 1; + mFastRoute[nodeIndex1.index()] = nodeIndex2; + } + + //No need to activate/deactivate the island. Its state won't have changed + + } + else if(islandId1 == IG_INVALID_ISLAND) + { + islandId = islandId2; + if (nodeIndex1.index() != PX_INVALID_NODE) + { + if (!mNodes[nodeIndex1.index()].isKinematic()) + { + PX_ASSERT(islandId2 != IG_INVALID_ISLAND); + //We need to add node 1 to island2 + PX_ASSERT(mNodes[nodeIndex1.index()].mNextNode.index() == PX_INVALID_NODE); //Ensure that this node is not in any other island + PX_ASSERT(mNodes[nodeIndex1.index()].mPrevNode.index() == PX_INVALID_NODE); //Ensure that this node is not in any other island + + Island& island = mIslands[islandId2]; + + Node& lastNode = mNodes[island.mLastNode.index()]; + + PX_ASSERT(lastNode.mNextNode.index() == PX_INVALID_NODE); + + Node& node = mNodes[nodeIndex1.index()]; + lastNode.mNextNode = nodeIndex1; + node.mPrevNode = island.mLastNode; + island.mLastNode = nodeIndex1; + island.mSize[node.mType]++; + mIslandIds[nodeIndex1.index()] = islandId2; + mHopCounts[nodeIndex1.index()] = mHopCounts[nodeIndex2.index()] + 1; + mFastRoute[nodeIndex1.index()] = nodeIndex2; + + if(active1 || active2) + { + if(!mIslandAwake.test(islandId2)) + { + //This island wasn't already awake, so need to wake the whole island up + activateIsland(islandId2); + } + if(!active1) + { + //Wake up this node... + activateNodeInternal(nodeIndex1); + } + } + } + else if(active1 && !active2) + { + //Active kinematic object -> wake island! + activateIsland(islandId2); + } + } + else + { + //A new touch with a static body... + Node& node = mNodes[nodeIndex2.index()]; + node.mStaticTouchCount++; //Increment static touch counter on the body + //Island& island = mIslands[islandId2]; + //island.mStaticTouchCount++; //Increment static touch counter on the island + mIslandStaticTouchCount[islandId2]++; + + } + } + else if (islandId2 == IG_INVALID_ISLAND) + { + islandId = islandId1; + if (nodeIndex2.index() != PX_INVALID_NODE) + { + if (!mNodes[nodeIndex2.index()].isKinematic()) + { + PX_ASSERT(islandId1 != PX_INVALID_NODE); + //We need to add node 1 to island2 + PX_ASSERT(mNodes[nodeIndex2.index()].mNextNode.index() == PX_INVALID_NODE); //Ensure that this node is not in any other island + PX_ASSERT(mNodes[nodeIndex2.index()].mPrevNode.index() == PX_INVALID_NODE); //Ensure that this node is not in any other island + + Island& island = mIslands[islandId1]; + + Node& lastNode = mNodes[island.mLastNode.index()]; + PX_ASSERT(lastNode.mNextNode.index() == PX_INVALID_NODE); + Node& node = mNodes[nodeIndex2.index()]; + lastNode.mNextNode = nodeIndex2; + node.mPrevNode = island.mLastNode; + island.mLastNode = nodeIndex2; + island.mSize[node.mType]++; + mIslandIds[nodeIndex2.index()] = islandId1; + mHopCounts[nodeIndex2.index()] = mHopCounts[nodeIndex1.index()] + 1; + mFastRoute[nodeIndex2.index()] = nodeIndex1; + + if(active1 || active2) + { + if(!mIslandAwake.test(islandId1)) + { + //This island wasn't already awake, so need to wake the whole island up + activateIsland(islandId1); + } + if(!active1) + { + //Wake up this node... + activateNodeInternal(nodeIndex2); + } + } + } + else if(active2 && !active1) + { + //Active kinematic object -> wake island! + activateIsland(islandId1); + } + } + else + { + //New static touch + //A new touch with a static body... + Node& node = mNodes[nodeIndex1.index()]; + node.mStaticTouchCount++; //Increment static touch counter on the body + //Island& island = mIslands[islandId1]; + mIslandStaticTouchCount[islandId1]++; + //island.mStaticTouchCount++; //Increment static touch counter on the island + } + + } + else + { + PX_ASSERT(islandId1 != islandId2); + PX_ASSERT(islandId1 != IG_INVALID_ISLAND && islandId2 != IG_INVALID_ISLAND); + + if(active1 || active2) + { + //One of the 2 islands was awake, so need to wake the other one! We do this now, before we merge the islands, to ensure that all + //the bodies are activated + if(!mIslandAwake.test(islandId1)) + { + //This island wasn't already awake, so need to wake the whole island up + activateIsland(islandId1); + } + if(!mIslandAwake.test(islandId2)) + { + //This island wasn't already awake, so need to wake the whole island up + activateIsland(islandId2); + } + } + + //OK. We need to merge these islands together... + islandId = mergeIslands(islandId1, islandId2, nodeIndex1, nodeIndex2); + } + + if(islandId != IG_INVALID_ISLAND) + { + //Add new edge to existing island + Island& island = mIslands[islandId]; + addEdgeToIsland(island, edgeIndex); + } + } + } + + } + +} + +bool IslandSim::isPathTo(PxNodeIndex startNode, PxNodeIndex targetNode) +{ + Node& node = mNodes[startNode.index()]; + + EdgeInstanceIndex index = node.mFirstEdgeIndex; + while(index != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[index]; + if(/*mEdges[index/2].isConnected() &&*/ mEdgeNodeIndices[index^1].index() == targetNode.index()) + return true; + index = instance.mNextEdge; + } + return false; +} + +bool IslandSim::tryFastPath(PxNodeIndex startNode, PxNodeIndex targetNode, IslandId islandId) +{ + PX_UNUSED(startNode); + PX_UNUSED(targetNode); + + PxNodeIndex currentNode = startNode; + + PxU32 currentVisitedNodes = mVisitedNodes.size(); + + PxU32 depth = 0; + + bool found = false; + do + { + //Get the fast path from this node... + + if(mVisitedState.test(currentNode.index())) + { + found = mIslandIds[currentNode.index()] != IG_INVALID_ISLAND; //Already visited and not tagged with invalid island == a witness! + break; + } + if( currentNode.index() == targetNode.index()) + { + found = true; + break; + } + + mVisitedNodes.pushBack(TraversalState(currentNode, mVisitedNodes.size(), mVisitedNodes.size()-1, depth++)); + + PX_ASSERT(mFastRoute[currentNode.index()].index() == PX_INVALID_NODE || isPathTo(currentNode, mFastRoute[currentNode.index()])); + + mIslandIds[currentNode.index()] = IG_INVALID_ISLAND; + mVisitedState.set(currentNode.index()); + + currentNode = mFastRoute[currentNode.index()]; + } + while(currentNode.index() != PX_INVALID_NODE); + + for(PxU32 a = currentVisitedNodes; a < mVisitedNodes.size(); ++a) + { + TraversalState& state = mVisitedNodes[a]; + mIslandIds[state.mNodeIndex.index()] = islandId; + } + + if(!found) + { + for(PxU32 a = currentVisitedNodes; a < mVisitedNodes.size(); ++a) + { + TraversalState& state = mVisitedNodes[a]; + mVisitedState.reset(state.mNodeIndex.index()); + } + + mVisitedNodes.forceSize_Unsafe(currentVisitedNodes); + } + return found; + +} + +bool IslandSim::findRoute(PxNodeIndex startNode, PxNodeIndex targetNode, IslandId islandId) +{ + + //Firstly, traverse the fast path and tag up witnesses. TryFastPath can fail. In that case, no witnesses are left but this node is permitted to report + //that it is still part of the island. Whichever node lost its fast path will be tagged as dirty and will be responsible for recovering the fast path + //and tagging up the visited nodes + if(mFastRoute[startNode.index()].index() != PX_INVALID_NODE) + { + if(tryFastPath(startNode, targetNode, islandId)) + return true; + + //Try fast path can either be successful or not. If it was successful, then we had a valid fast path cached and all nodes on that fast path were tagged + //as witness nodes (visited and with a valid island ID). If the fast path was not successful, then no nodes were tagged as witnesses. + //Technically, we need to find a route to the root node but, as an optimization, we can simply return true from here with no witnesses added. + //Whichever node actually broke the "fast path" will also be on the list of dirty nodes and will be processed later. + //If that broken edge triggered an island separation, this node will be re-visited and added to that island, otherwise + //the path to the root node will be re-established. The end result is the same - the island state is computed - this just saves us some work. + //return true; + } + + { + //If we got here, there was no fast path. Therefore, we need to fall back on searching for the root node. This is optimized by using "hop counts". + //These are per-node counts that indicate the expected number of hops from this node to the root node. These are lazily evaluated and updated + //as new edges are formed or when traversals occur to re-establish islands. As a result, they may be inaccurate but they still serve the purpose + //of guiding our search to minimize the chances of us doing an exhaustive search to find the root node. + mIslandIds[startNode.index()] = IG_INVALID_ISLAND; + TraversalState* startTraversal = &mVisitedNodes.pushBack(TraversalState(startNode, mVisitedNodes.size(), PX_INVALID_NODE, 0)); + mVisitedState.set(startNode.index()); + QueueElement element(startTraversal, mHopCounts[startNode.index()]); + mPriorityQueue.push(element); + + do + { + QueueElement currentQE = mPriorityQueue.pop(); + + TraversalState& currentState = *currentQE.mState; + + Node& currentNode = mNodes[currentState.mNodeIndex.index()]; + + EdgeInstanceIndex edge = currentNode.mFirstEdgeIndex; + + while(edge != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[edge]; + { + PxNodeIndex nextIndex = mEdgeNodeIndices[edge ^ 1]; + + //Static or kinematic nodes don't connect islands. + if(nextIndex.index() != PX_INVALID_NODE && !mNodes[nextIndex.index()].isKinematic()) + { + if(nextIndex.index() == targetNode.index()) + { + unwindRoute(currentState.mCurrentIndex, nextIndex, 0, islandId); + return true; + } + + if(mVisitedState.test(nextIndex.index())) + { + //We already visited this node. This means that it's either in the priority queue already or we + //visited in on a previous pass. If it was visited on a previous pass, then it already knows what island it's in. + //We now need to test the island id to find out if this node knows the root. + //If it has a valid root id, that id *is* our new root. We can guesstimate our hop count based on the node's properties + + IslandId visitedIslandId = mIslandIds[nextIndex.index()]; + if(visitedIslandId != IG_INVALID_ISLAND) + { + //If we get here, we must have found a node that knows a route to our root node. It must not be a different island + //because that would caused me to have been visited already because totally separate islands trigger a full traversal on + //the orphaned side. + PX_ASSERT(visitedIslandId == islandId); + unwindRoute(currentState.mCurrentIndex, nextIndex, mHopCounts[nextIndex.index()], islandId); + return true; + } + } + else + { + //This node has not been visited yet, so we need to push it into the stack and continue traversing + TraversalState* state = &mVisitedNodes.pushBack(TraversalState(nextIndex, mVisitedNodes.size(), currentState.mCurrentIndex, currentState.mDepth+1)); + QueueElement qe(state, mHopCounts[nextIndex.index()]); + mPriorityQueue.push(qe); + mVisitedState.set(nextIndex.index()); + PX_ASSERT(mIslandIds[nextIndex.index()] == islandId); + mIslandIds[nextIndex.index()] = IG_INVALID_ISLAND; //Flag as invalid island until we know whether we can find root or an island id. + } + } + } + + edge = instance.mNextEdge; + } + } + while(mPriorityQueue.size()); + + return false; + } +} + +#define IG_LIMIT_DIRTY_NODES 0 + + +void IslandSim::processLostEdges(PxArray& destroyedNodes, bool allowDeactivation, bool permitKinematicDeactivation, + PxU32 dirtyNodeLimit) +{ + PX_UNUSED(dirtyNodeLimit); + PX_PROFILE_ZONE("Basic.processLostEdges", getContextId()); + //At this point, all nodes and edges are activated. + + //Bit map for visited + mVisitedState.resizeAndClear(mNodes.size()); + + //Reserve space on priority queue for at least 1024 nodes. It will resize if more memory is required during traversal. + mPriorityQueue.reserve(1024); + + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + mIslandSplitEdges[i].reserve(1024); + } + + mVisitedNodes.reserve(mNodes.size()); //Make sure we have enough space for all nodes! + + const PxU32 nbDestroyedEdges = mDestroyedEdges.size(); + PX_UNUSED(nbDestroyedEdges); + { + PX_PROFILE_ZONE("Basic.removeEdgesFromIslands", getContextId()); + for (PxU32 a = 0; a < mDestroyedEdges.size(); ++a) + { + EdgeIndex lostIndex = mDestroyedEdges[a]; + Edge& lostEdge = mEdges[lostIndex]; + + if (lostEdge.isPendingDestroyed() && !lostEdge.isInDirtyList()) + { + //Process this edge... + if (!lostEdge.isReportOnlyDestroy() && lostEdge.isInserted()) + { + PxU32 index1 = mEdgeNodeIndices[mDestroyedEdges[a] * 2].index(); + PxU32 index2 = mEdgeNodeIndices[mDestroyedEdges[a] * 2 + 1].index(); + + IslandId islandId = IG_INVALID_ISLAND; + if (index1 != PX_INVALID_NODE && index2 != PX_INVALID_NODE) + { + PX_ASSERT(mIslandIds[index1] == IG_INVALID_ISLAND || mIslandIds[index2] == IG_INVALID_ISLAND || + mIslandIds[index1] == mIslandIds[index2]); + islandId = mIslandIds[index1] != IG_INVALID_ISLAND ? mIslandIds[index1] : mIslandIds[index2]; + } + else if (index1 != PX_INVALID_NODE) + { + PX_ASSERT(index2 == PX_INVALID_NODE); + Node& node = mNodes[index1]; + if (!node.isKinematic()) + { + islandId = mIslandIds[index1]; + node.mStaticTouchCount--; + //Island& island = mIslands[islandId]; + mIslandStaticTouchCount[islandId]--; + //island.mStaticTouchCount--; + } + } + else if (index2 != PX_INVALID_NODE) + { + PX_ASSERT(index1 == PX_INVALID_NODE); + Node& node = mNodes[index2]; + if (!node.isKinematic()) + { + islandId = mIslandIds[index2]; + node.mStaticTouchCount--; + //Island& island = mIslands[islandId]; + mIslandStaticTouchCount[islandId]--; + //island.mStaticTouchCount--; + } + } + + if (islandId != IG_INVALID_ISLAND) + { + //We need to remove this edge from the island + Island& island = mIslands[islandId]; + removeEdgeFromIsland(island, lostIndex); + } + } + + lostEdge.clearInserted(); + + } + } + } + + if (allowDeactivation) + { + PX_PROFILE_ZONE("Basic.findPathsAndBreakIslands", getContextId()); + + + //KS - process only this many dirty nodes, deferring future dirty nodes to subsequent frames. + //This means that it may take several frames for broken edges to trigger islands to completely break but this is better + //than triggering large performance spikes. +#if IG_LIMIT_DIRTY_NODES + PxBitMap::PxCircularIterator iter(mDirtyMap, mLastMapIndex); + const PxU32 MaxCount = dirtyNodeLimit;// +10000000; + PxU32 lastMapIndex = mLastMapIndex; + PxU32 count = 0; +#else + PxBitMap::Iterator iter(mDirtyMap); +#endif + + + PxU32 dirtyIdx; + +#if IG_LIMIT_DIRTY_NODES + while ((dirtyIdx = iter.getNext()) != PxBitMap::PxCircularIterator::DONE + && (count++ < MaxCount) +#else + while ((dirtyIdx = iter.getNext()) != PxBitMap::Iterator::DONE +#endif + ) + { +#if IG_LIMIT_DIRTY_NODES + lastMapIndex = dirtyIdx + 1; +#endif + //Process dirty nodes. Figure out if we can make our way from the dirty node to the root. + + mPriorityQueue.clear(); //Clear the queue used for traversal + mVisitedNodes.forceSize_Unsafe(0); //Clear the list of nodes in this island + PxNodeIndex dirtyNodeIndex(dirtyIdx); + Node& dirtyNode = mNodes[dirtyNodeIndex.index()]; + + //Check whether this node has already been touched. If it has been touched this frame, then its island state is reliable + //and we can just unclear the dirty flag on the body. If we were already visited, then the state should have already been confirmed in a + //previous pass. + if (!dirtyNode.isKinematic() && !dirtyNode.isDeleted() && !mVisitedState.test(dirtyNodeIndex.index())) + { + //We haven't visited this node in our island repair passes yet, so we still need to process until we've hit a visited node or found + //our root node. Note that, as soon as we hit a visited node that has already been processed in a previous pass, we know that we can rely + //on its island information although the hop counts may not be optimal. It also indicates that this island was not broken immediately because + //otherwise, the entire new sub-island would already have been visited and this node would have already had its new island state assigned. + + //Indicate that I've been visited + + IslandId islandId = mIslandIds[dirtyNodeIndex.index()]; + Island& findIsland = mIslands[islandId]; + + PxNodeIndex searchNode = findIsland.mRootNode;//The node that we're searching for! + + if (searchNode.index() != dirtyNodeIndex.index()) //If we are the root node, we don't need to do anything! + { + if (findRoute(dirtyNodeIndex, searchNode, islandId)) + { + //We found the root node so let's let every visited node know that we found its root + //and we can also update our hop counts because we recorded how many hops it took to reach this + //node + + //We already filled in the path to the root/witness with accurate hop counts. Now we just need to fill in the estimates + //for the remaining nodes and re-define their islandIds. We approximate their path to the root by just routing them through + //the route we already found. + + //This loop works because mVisitedNodes are recorded in the order they were visited and we already filled in the critical path + //so the remainder of the paths will just fork from that path. + + //Verify state (that we can see the root from this node)... + +#if IG_SANITY_CHECKS + PX_ASSERT(canFindRoot(dirtyNode, searchNode, NULL)); //Verify that we found the connection +#endif + + for (PxU32 b = 0; b < mVisitedNodes.size(); ++b) + { + TraversalState& state = mVisitedNodes[b]; + if (mIslandIds[state.mNodeIndex.index()] == IG_INVALID_ISLAND) + { + mHopCounts[state.mNodeIndex.index()] = mHopCounts[mVisitedNodes[state.mPrevIndex].mNodeIndex.index()] + 1; + mFastRoute[state.mNodeIndex.index()] = mVisitedNodes[state.mPrevIndex].mNodeIndex; + mIslandIds[state.mNodeIndex.index()] = islandId; + } + } + } + else + { + //If I traversed and could not find the root node, then I have established a new island. In this island, I am the root node + //and I will point all my nodes towards me. Furthermore, I have established how many steps it took to reach all nodes in my island + + //OK. We need to separate the islands. We have a list of nodes that are part of the new island (mVisitedNodes) and we know that the + //first node in that list is the root node. + + + //OK, we need to remove all these actors from their current island, then add them to the new island... + + Island& oldIsland = mIslands[islandId]; + //We can just unpick these nodes from the island because they do not contain the root node (if they did, then we wouldn't be + //removing this node from the island at all). The only challenge is if we need to remove the last node. In that case + //we need to re-establish the new last node in the island but perhaps the simplest way to do that would be to traverse + //the island to establish the last node again + +#if IG_SANITY_CHECKS + PX_ASSERT(!canFindRoot(dirtyNode, searchNode, NULL)); +#endif + + PxU32 totalStaticTouchCount = 0; + PxU32 size[Edge::eEDGE_TYPE_COUNT]; + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + mIslandSplitEdges[i].forceSize_Unsafe(0); + size[i] = 0; + } + + //NodeIndex lastIndex = oldIsland.mLastNode; + + //size[node.mType] = 1; + + for (PxU32 a = 0; a < mVisitedNodes.size(); ++a) + { + PxNodeIndex index = mVisitedNodes[a].mNodeIndex; + Node& node = mNodes[index.index()]; + + if (node.mNextNode.index() != PX_INVALID_NODE) + mNodes[node.mNextNode.index()].mPrevNode = node.mPrevNode; + else + oldIsland.mLastNode = node.mPrevNode; + if (node.mPrevNode.index() != PX_INVALID_NODE) + mNodes[node.mPrevNode.index()].mNextNode = node.mNextNode; + + size[node.mType]++; + + node.mNextNode.setIndices(PX_INVALID_NODE); + node.mPrevNode.setIndices(PX_INVALID_NODE); + + PX_ASSERT(mNodes[oldIsland.mLastNode.index()].mNextNode.index() == PX_INVALID_NODE); + + totalStaticTouchCount += node.mStaticTouchCount; + + EdgeInstanceIndex idx = node.mFirstEdgeIndex; + + while (idx != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[idx]; + const EdgeIndex edgeIndex = idx / 2; + Edge& edge = mEdges[edgeIndex]; + + //Only split the island if we're processing the first node or if the first node is infinte-mass + if (!(idx & 1) || (mEdgeNodeIndices[idx & (~1)].index() == PX_INVALID_NODE || mNodes[mEdgeNodeIndices[idx & (~1)].index()].isKinematic())) + { + //We will remove this edge from the island... + mIslandSplitEdges[edge.mEdgeType].pushBack(edgeIndex); + + removeEdgeFromIsland(oldIsland, edgeIndex); + + } + idx = instance.mNextEdge; + } + + } + + //oldIsland.mStaticTouchCount -= totalStaticTouchCount; + mIslandStaticTouchCount[islandId] -= totalStaticTouchCount; + + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + oldIsland.mSize[i] -= size[i]; + } + + //Now add all these nodes to the new island + + //(1) Create the new island... + IslandId newIslandHandle = mIslandHandles.getHandle(); + /*if(newIslandHandle == mIslands.capacity()) + { + mIslands.reserve(2*mIslands.capacity() + 1); + }*/ + mIslands.resize(PxMax(newIslandHandle + 1, mIslands.size())); + mIslandStaticTouchCount.resize(PxMax(newIslandHandle + 1, mIslandStaticTouchCount.size())); + Island& newIsland = mIslands[newIslandHandle]; + + if (mIslandAwake.test(islandId)) + { + newIsland.mActiveIndex = mActiveIslands.size(); + mActiveIslands.pushBack(newIslandHandle); + mIslandAwake.growAndSet(newIslandHandle); //Separated island, so it should be awake + } + else + { + mIslandAwake.growAndReset(newIslandHandle); + } + + newIsland.mRootNode = dirtyNodeIndex; + mHopCounts[dirtyNodeIndex.index()] = 0; + mIslandIds[dirtyNodeIndex.index()] = newIslandHandle; + //newIsland.mTotalSize = mVisitedNodes.size(); + + mNodes[dirtyNodeIndex.index()].mPrevNode.setIndices(PX_INVALID_NODE); //First node so doesn't have a preceding node + mFastRoute[dirtyNodeIndex.index()].setIndices(PX_INVALID_NODE); + + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + size[i] = 0; + + size[dirtyNode.mType] = 1; + + for (PxU32 a = 1; a < mVisitedNodes.size(); ++a) + { + PxNodeIndex index = mVisitedNodes[a].mNodeIndex; + Node& thisNode = mNodes[index.index()]; + PxNodeIndex prevNodeIndex = mVisitedNodes[a - 1].mNodeIndex; + thisNode.mPrevNode = prevNodeIndex; + mNodes[prevNodeIndex.index()].mNextNode = index; + size[thisNode.mType]++; + mIslandIds[index.index()] = newIslandHandle; + mHopCounts[index.index()] = mVisitedNodes[a].mDepth; //How many hops to root + mFastRoute[index.index()] = mVisitedNodes[mVisitedNodes[a].mPrevIndex].mNodeIndex; + } + + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + newIsland.mSize[i] = size[i]; + + //Last node in the island + PxNodeIndex lastIndex = mVisitedNodes[mVisitedNodes.size() - 1].mNodeIndex; + mNodes[lastIndex.index()].mNextNode.setIndices(PX_INVALID_NODE); + newIsland.mLastNode = lastIndex; + //newIsland.mStaticTouchCount = totalStaticTouchCount; + mIslandStaticTouchCount[newIslandHandle] = totalStaticTouchCount; + + PX_ASSERT(mNodes[newIsland.mLastNode.index()].mNextNode.index() == PX_INVALID_NODE); + + for (PxU32 j = 0; j < IG::Edge::eEDGE_TYPE_COUNT; ++j) + { + PxArray& splitEdges = mIslandSplitEdges[j]; + const PxU32 splitEdgeSize = splitEdges.size(); + if (splitEdgeSize) + { + splitEdges.pushBack(IG_INVALID_EDGE); //Push in a dummy invalid edge to complete the connectivity + mEdges[splitEdges[0]].mNextIslandEdge = splitEdges[1]; + for (PxU32 a = 1; a < splitEdgeSize; ++a) + { + EdgeIndex edgeIndex = splitEdges[a]; + Edge& edge = mEdges[edgeIndex]; + edge.mNextIslandEdge = splitEdges[a + 1]; + edge.mPrevIslandEdge = splitEdges[a - 1]; + } + + newIsland.mFirstEdge[j] = splitEdges[0]; + newIsland.mLastEdge[j] = splitEdges[splitEdgeSize - 1]; + newIsland.mEdgeCount[j] = splitEdgeSize; + } + } + + } + } + + } + dirtyNode.clearDirty(); +#if IG_LIMIT_DIRTY_NODES + mDirtyMap.reset(dirtyIdx); +#endif + } + + + +#if IG_LIMIT_DIRTY_NODES + mLastMapIndex = lastMapIndex; + if (count < MaxCount) + mLastMapIndex = 0; +#else + mDirtyMap.clear(); +#endif + + //mDirtyNodes.forceSize_Unsafe(0); + } + + + { + PX_PROFILE_ZONE("Basic.clearDestroyedEdges", getContextId()); + //Now process the lost edges... + for (PxU32 a = 0; a < mDestroyedEdges.size(); ++a) + { + //Process these destroyed edges. Recompute island information. Update the islands and hop counters accordingly + EdgeIndex index = mDestroyedEdges[a]; + + Edge& edge = mEdges[index]; + if (edge.isPendingDestroyed()) + { + //if(edge.mFirstPartitionEdge) + PartitionEdge* pEdge = mFirstPartitionEdges ? (*mFirstPartitionEdges)[index] : NULL; + if (pEdge) + { + mDestroyedPartitionEdges->pushBack(pEdge); + (*mFirstPartitionEdges)[index] = NULL; //Force first partition edge to NULL to ensure we don't have a clash + } + if (edge.isActive()) + { + removeEdgeFromActivatingList(index); //TODO - can we remove this call? Can we handle this elsewhere, e.g. when destroying the nodes... + mActiveEdgeCount[edge.mEdgeType]--; + } + + edge = Edge(); //Reset edge + mActiveContactEdges.growAndReset(index); + } + } + + mDestroyedEdges.forceSize_Unsafe(0); + } + + { + PX_PROFILE_ZONE("Basic.clearDestroyedNodes", getContextId()); + + for (PxU32 a = 0; a < destroyedNodes.size(); ++a) + { + PxNodeIndex nodeIndex = destroyedNodes[a]; + IslandId islandId = mIslandIds[nodeIndex.index()]; + Node& node = mNodes[nodeIndex.index()]; + if (islandId != IG_INVALID_ISLAND) + { + Island& island = mIslands[islandId]; + + removeNodeFromIsland(island, nodeIndex); + + mIslandIds[nodeIndex.index()] = IG_INVALID_ISLAND; + + if ((island.mSize[0] + island.mSize[1] + island.mSize[2] + island.mSize[3]) == 0) + { + mIslandHandles.freeHandle(islandId); + if (island.mActiveIndex != IG_INVALID_ISLAND) + { + IslandId replaceId = mActiveIslands[mActiveIslands.size() - 1]; + Island& replaceIsland = mIslands[replaceId]; + replaceIsland.mActiveIndex = island.mActiveIndex; + mActiveIslands[island.mActiveIndex] = replaceId; + mActiveIslands.forceSize_Unsafe(mActiveIslands.size() - 1); + island.mActiveIndex = IG_INVALID_ISLAND; + //island.mStaticTouchCount -= node.mStaticTouchCount; //Remove the static touch count from the island + mIslandStaticTouchCount[islandId] -= node.mStaticTouchCount; + } + mIslandAwake.reset(islandId); + island.mLastNode.setIndices(PX_INVALID_NODE); + island.mRootNode.setIndices(PX_INVALID_NODE); + island.mActiveIndex = IG_INVALID_ISLAND; + } + } + + if (node.isKinematic()) + { + if (mActiveNodeIndex[nodeIndex.index()] != PX_INVALID_NODE) + { + //Remove from the active kinematics list... + markKinematicInactive(nodeIndex); + } + } + else + { + if (mActiveNodeIndex[nodeIndex.index()] != PX_INVALID_NODE) + { + markInactive(nodeIndex); + } + } + + //node.reset(); + node.mFlags |= Node::eDELETED; + } + } + //Now we need to produce the list of active edges and nodes!!! + + //If we get here, we have a list of active islands. From this, we need to iterate over all active islands and establish if that island + //can, in fact, go to sleep. In order to become deactivated, all nodes in the island must be ready for sleeping... + + if (allowDeactivation) + { + PX_PROFILE_ZONE("Basic.deactivation", getContextId()); + for (PxU32 a = 0; a < mActiveIslands.size(); a++) + { + IslandId islandId = mActiveIslands[a]; + + mIslandAwake.reset(islandId); + } + + //Loop over the active kinematic nodes and tag all islands touched by active kinematics as awake + for (PxU32 a = mActiveKinematicNodes.size(); a > 0; --a) + { + PxNodeIndex kinematicIndex = mActiveKinematicNodes[a - 1]; + + Node& kinematicNode = mNodes[kinematicIndex.index()]; + + if (kinematicNode.isReadyForSleeping()) + { + if (permitKinematicDeactivation) + { + kinematicNode.clearActive(); + markKinematicInactive(kinematicIndex); + } + } + else //if(!kinematicNode.isReadyForSleeping()) + { + //KS - if kinematic is active, then wake up all islands the kinematic is touching + EdgeInstanceIndex edgeId = kinematicNode.mFirstEdgeIndex; + while (edgeId != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[edgeId]; + //Edge& edge = mEdges[edgeId/2]; + //Only wake up islands if a connection was present + //if(edge.isConnected()) + { + PxNodeIndex outNode = mEdgeNodeIndices[edgeId ^ 1]; + if (outNode.index() != PX_INVALID_NODE) + { + IslandId islandId = mIslandIds[outNode.index()]; + if (islandId != IG_INVALID_ISLAND) + { + mIslandAwake.set(islandId); + PX_ASSERT(mIslands[islandId].mActiveIndex != IG_INVALID_ISLAND); + } + } + } + edgeId = instance.mNextEdge; + } + } + } + + for (PxU32 a = mActiveIslands.size(); a > 0; --a) + { + IslandId islandId = mActiveIslands[a - 1]; + + Island& island = mIslands[islandId]; + + bool canDeactivate = !mIslandAwake.test(islandId); + mIslandAwake.set(islandId); + + //If it was touched by an active kinematic in the above loop, we can't deactivate it. + //Therefore, no point in testing the nodes in the island. They must remain awake + if (canDeactivate) + { + PxNodeIndex nodeId = island.mRootNode; + while (nodeId.index() != PX_INVALID_NODE) + { + Node& node = mNodes[nodeId.index()]; + if (!node.isReadyForSleeping()) + { + canDeactivate = false; + break; + } + nodeId = node.mNextNode; + } + if (canDeactivate) + { + //If all nodes in this island are ready for sleeping and there were no active + //kinematics interacting with the any bodies in the island, we can deactivate the island. + deactivateIsland(islandId); + } + } + } + } + + { + PX_PROFILE_ZONE("Basic.resetDirtyEdges", getContextId()); + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + for (PxU32 a = 0; a < mDirtyEdges[i].size(); ++a) + { + Edge& edge = mEdges[mDirtyEdges[i][a]]; + edge.clearInDirtyList(); + } + mDirtyEdges[i].clear(); //All new edges processed + } + } + +} + +IslandId IslandSim::mergeIslands(IslandId island0, IslandId island1, PxNodeIndex node0, PxNodeIndex node1) +{ + Island& is0 = mIslands[island0]; + Island& is1 = mIslands[island1]; + + //We defer this process and do it later instead. That way, if we have some pathalogical + //case where multiple islands get merged repeatedly, we don't end up repeatedly remapping all the nodes in those islands + //to their new island. Instead, we just choose the largest island and remap the smaller island to that. + + PxU32 totalSize0 = 0; + PxU32 totalSize1 = 0; + + for (PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + { + totalSize0 += is0.mSize[i]; + totalSize1 += is1.mSize[i]; + } + if(totalSize0 > totalSize1) + { + mergeIslandsInternal(is0, is1, island0, island1, node0, node1); + mIslandAwake.reset(island1); + mIslandHandles.freeHandle(island1); + mFastRoute[node1.index()] = node0; + return island0; + } + else + { + mergeIslandsInternal(is1, is0, island1, island0, node1, node0); + mIslandAwake.reset(island0); + mIslandHandles.freeHandle(island0); + mFastRoute[node0.index()] = node1; + return island1; + } +} + +bool IslandSim::checkInternalConsistency() +{ + //Loop over islands, confirming that the island data is consistent... + //Really expensive. Turn off unless investigating some random issue... +#if 0 + for (PxU32 a = 0; a < mIslands.size(); ++a) + { + Island& island = mIslands[a]; + + PxU32 expectedSize = island.mSize[0] + island.mSize[1]; + bool metLastNode = expectedSize == 0; + + NodeIndex nodeId = island.mRootNode; + + while (nodeId.index() != PX_INVALID_NODE) + { + + PX_ASSERT(mIslandIds[nodeId.index()] == a); + + if (nodeId.index() == island.mLastNode.index()) + { + metLastNode = true; + PX_ASSERT(mNodes[nodeId.index()].mNextNode.index() == PX_INVALID_NODE); + } + + --expectedSize; + + nodeId = mNodes[nodeId.index()].mNextNode; + } + + PX_ASSERT(expectedSize == 0); + PX_ASSERT(metLastNode); + } +#endif + + return true; + +} + +void IslandSim::mergeIslandsInternal(Island& island0, Island& island1, IslandId islandId0, IslandId islandId1, PxNodeIndex nodeIndex0, PxNodeIndex nodeIndex1) +{ +#if PX_ENABLE_ASSERTS + PxU32 island0Size = 0; + PxU32 island1Size = 0; + for(PxU32 nodeType = 0; nodeType < Node::eTYPE_COUNT; ++nodeType) + { + island0Size += island0.mSize[nodeType]; + island1Size += island1.mSize[nodeType]; + } +#endif + PX_ASSERT(island0Size >= island1Size); //We only ever merge the smaller island to the larger island + //Stage 1 - we need to move all the nodes across to the new island ID (i.e. write all their new island indices, move them to the + //island and then also update their estimated hop counts to the root. As we don't want to do a full traversal at this point, + //instead, we estimate based on the route from the node to their previous root and then from that root to the new connection + //between the 2 islands. This is probably a very indirect route but it will be refined later. + + //In this case, island1 is subsumed by island0 + + //It takes mHopCounts[nodeIndex1] to get from node1 to its old root. It takes mHopCounts[nodeIndex0] to get from nodeIndex0 to the new root + //and it takes 1 extra hop to go from node1 to node0. Therefore, a sub-optimal route can be planned going via the old root node that should take + //mHopCounts[nodeIndex0] + mHopCounts[nodeIndex1] + 1 + mHopCounts[nodeIndex] to travel from any arbitrary node (nodeIndex) in island1 to the root + //of island2. + + + PxU32 extraPath = mHopCounts[nodeIndex0.index()] + mHopCounts[nodeIndex1.index()] + 1; + + PxNodeIndex islandNode = island1.mRootNode; + while(islandNode.index() != PX_INVALID_NODE) + { + mHopCounts[islandNode.index()] += extraPath; + mIslandIds[islandNode.index()] = islandId0; + + //mFastRoute[islandNode] = PX_INVALID_NODE; + + Node& node = mNodes[islandNode.index()]; + islandNode = node.mNextNode; + } + + //Now fill in the hop count for node1, which is directly connected to node0. + mHopCounts[nodeIndex1.index()] = mHopCounts[nodeIndex0.index()] + 1; + Node& lastNode = mNodes[island0.mLastNode.index()]; + Node& firstNode = mNodes[island1.mRootNode.index()]; + PX_ASSERT(lastNode.mNextNode.index() == PX_INVALID_NODE); + PX_ASSERT(firstNode.mPrevNode.index() == PX_INVALID_NODE); + PX_ASSERT(island1.mRootNode.index() != island0.mLastNode.index()); + + PX_ASSERT(mNodes[island0.mLastNode.index()].mNextNode.index() == PX_INVALID_NODE); + PX_ASSERT(mNodes[island1.mLastNode.index()].mNextNode.index() == PX_INVALID_NODE); + + PX_ASSERT(mIslandIds[island0.mLastNode.index()] == islandId0); + + + + lastNode.mNextNode = island1.mRootNode; + firstNode.mPrevNode = island0.mLastNode; + + + + island0.mLastNode = island1.mLastNode; + //island0.mStaticTouchCount += island1.mStaticTouchCount; + mIslandStaticTouchCount[islandId0] += mIslandStaticTouchCount[islandId1]; + + //Merge the edge list for the islands... + for(PxU32 a = 0; a < IG::Edge::eEDGE_TYPE_COUNT; ++a) + { + island0.mSize[a] += island1.mSize[a]; + if(island0.mLastEdge[a] != IG_INVALID_EDGE) + { + PX_ASSERT(mEdges[island0.mLastEdge[a]].mNextIslandEdge == IG_INVALID_EDGE); + mEdges[island0.mLastEdge[a]].mNextIslandEdge = island1.mFirstEdge[a]; + } + else + { + PX_ASSERT(island0.mFirstEdge[a] == IG_INVALID_EDGE); + island0.mFirstEdge[a] = island1.mFirstEdge[a]; + } + if(island1.mFirstEdge[a] != IG_INVALID_EDGE) + { + PX_ASSERT(mEdges[island1.mFirstEdge[a]].mPrevIslandEdge == IG_INVALID_EDGE); + mEdges[island1.mFirstEdge[a]].mPrevIslandEdge = island0.mLastEdge[a]; + island0.mLastEdge[a] = island1.mLastEdge[a]; + } + + island0.mEdgeCount[a] += island1.mEdgeCount[a]; + island1.mFirstEdge[a] = IG_INVALID_EDGE; + island1.mLastEdge[a] = IG_INVALID_EDGE; + island1.mEdgeCount[a] = 0; + island1.mSize[a] = 0; + } + + + island1.mLastNode.setIndices(PX_INVALID_NODE); + island1.mRootNode.setIndices(PX_INVALID_NODE); + + mIslandStaticTouchCount[islandId1] = 0; + //island1.mStaticTouchCount = 0; + + //Remove from active island list + if(island1.mActiveIndex != IG_INVALID_ISLAND) + { + markIslandInactive(islandId1); + } + +} + +void IslandSim::removeEdgeFromActivatingList(EdgeIndex index) +{ + Edge& edge = mEdges[index]; + + if (edge.mEdgeState & Edge::eACTIVATING) + { + for (PxU32 a = 0, count = mActivatedEdges[edge.mEdgeType].size(); a < count; a++) + { + if (mActivatedEdges[edge.mEdgeType][a] == index) + { + mActivatedEdges[edge.mEdgeType].replaceWithLast(a); + break; + } + } + + edge.mEdgeState &= (~Edge::eACTIVATING); + } + + + PxNodeIndex nodeIndex1 = mEdgeNodeIndices[index * 2]; + PxNodeIndex nodeIndex2 = mEdgeNodeIndices[index * 2 + 1]; + + if (nodeIndex1.isValid() && nodeIndex2.isValid()) + { + { + Node& node = mNodes[nodeIndex1.index()]; + node.mActiveRefCount--; + } + { + Node& node = mNodes[nodeIndex2.index()]; + node.mActiveRefCount--; + } + } + + if(edge.mEdgeType == Edge::eCONTACT_MANAGER) + mActiveContactEdges.reset(index); + +} + +void IslandSim::setKinematic(PxNodeIndex nodeIndex) +{ + + Node& node = mNodes[nodeIndex.index()]; + + if(!node.isKinematic()) + { + + //Transition from dynamic to kinematic: + //(1) Remove this node from the island + //(2) Remove this node from the active node list + //(3) If active or referenced, add it to the active kinematic list + //(4) Tag the node as kinematic + //External code will re-filter interactions and lost touches will be reported + + IslandId islandId = mIslandIds[nodeIndex.index()]; + PX_ASSERT(islandId != IG_INVALID_ISLAND); + + Island& island = mIslands[islandId]; + + mIslandIds[nodeIndex.index()] = IG_INVALID_ISLAND; + + removeNodeFromIsland(island, nodeIndex); + + bool isActive = node.isActive(); + + if (isActive) + { + //Remove from active list... + markInactive(nodeIndex); + } + else if (node.isActivating()) + { + //Remove from activating list... + node.clearActivating(); + PX_ASSERT(mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]].index() == nodeIndex.index()); + + PxNodeIndex replaceIndex = mActivatingNodes[mActivatingNodes.size() - 1]; + mActiveNodeIndex[replaceIndex.index()] = mActiveNodeIndex[nodeIndex.index()]; + mActivatingNodes[mActiveNodeIndex[nodeIndex.index()]] = replaceIndex; + mActivatingNodes.forceSize_Unsafe(mActivatingNodes.size() - 1); + mActiveNodeIndex[nodeIndex.index()] = PX_INVALID_NODE; + } + + node.setKinematicFlag(); + + node.clearActive(); + + if (/*isActive || */node.mActiveRefCount != 0) + { + //Add to active kinematic list... + PX_ASSERT(mActiveNodeIndex[nodeIndex.index()] == PX_INVALID_NODE); + + mActiveNodeIndex[nodeIndex.index()] = mActivatingNodes.size(); + mActivatingNodes.pushBack(nodeIndex); + node.setActivating(); + } + + { + //This node was potentially in an island with other bodies. We need to force an island recomputation in case the + //islands became broken due to losing this connection. Same rules as losing a contact, we just + //tag the nodes directly connected to the lost edge as "dirty" and force an island recomputation if + //it resulted in lost connections + EdgeInstanceIndex edgeId = node.mFirstEdgeIndex; + while(edgeId != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[edgeId]; + EdgeInstanceIndex nextId = instance.mNextEdge; + + PxU32 idx = edgeId/2; + IG::Edge& edge = mEdges[edgeId/2]; + + removeEdgeFromIsland(island, idx); + + removeConnectionInternal(idx); + removeConnectionFromGraph(idx); + + edge.clearInserted(); + + if (edge.isActive()) + { + removeEdgeFromActivatingList(idx); + edge.deactivateEdge(); + mActiveEdgeCount[edge.mEdgeType]--; + mDeactivatingEdges[edge.mEdgeType].pushBack(idx); + } + + if(!edge.isPendingDestroyed()) + { + if(!edge.isInDirtyList()) + { + PX_ASSERT(!contains(mDirtyEdges[edge.mEdgeType], idx)); + mDirtyEdges[edge.mEdgeType].pushBack(idx); + edge.markInDirtyList(); + } + } + else + { + edge.setReportOnlyDestroy(); + } + + edgeId = nextId; + } + } + + PxU32 newSize = 0; + for(PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) + newSize += island.mSize[i]; + + if(newSize == 0) + { + // If this island is empty after having removed the edges of the node we've just set to kinematic + // we invalidate all edges and set the island to inactive + for(PxU32 a = 0; a < Edge::eEDGE_TYPE_COUNT; ++a) + { + island.mFirstEdge[a] = island.mLastEdge[a] = IG_INVALID_EDGE; + island.mEdgeCount[a] = 0; + mIslandStaticTouchCount[islandId] = 0; + //island.mStaticTouchCount = 0; + } + + if(island.mActiveIndex != IG_INVALID_ISLAND) + { + markIslandInactive(islandId); + } + + mIslandAwake.reset(islandId); + mIslandHandles.freeHandle(islandId); + } + } +} + +void IslandSim::setDynamic(PxNodeIndex nodeIndex) +{ + //(1) Remove all edges involving this node from all islands they may be in + //(2) Mark all edges as "new" edges - let island gen re-process them! + //(3) Remove this node from the active kinematic list + //(4) Add this node to the active dynamic list (if it is active) + //(5) Mark node as dynamic + + + Node& node = mNodes[nodeIndex.index()]; + + if(node.isKinematic()) + { + //EdgeInstanceIndex edgeIndex = node.mFirstEdgeIndex; + + EdgeInstanceIndex edgeId = node.mFirstEdgeIndex; + while(edgeId != IG_INVALID_EDGE) + { + EdgeInstance& instance = mEdgeInstances[edgeId]; + EdgeInstanceIndex nextId = instance.mNextEdge; + + PxNodeIndex otherNode = mEdgeNodeIndices[edgeId^1]; + + PxU32 idx = edgeId/2; + IG::Edge& edge = mEdges[edgeId/2]; + + if(!otherNode.isStaticBody()) + { + IslandId islandId = mIslandIds[otherNode.index()]; + if(islandId != IG_INVALID_ISLAND) + removeEdgeFromIsland(mIslands[islandId], idx); + } + + removeConnectionInternal(idx); + removeConnectionFromGraph(idx); + + edge.clearInserted(); + if (edge.isActive()) + { + edge.deactivateEdge(); + removeEdgeFromActivatingList(idx); + mActiveEdgeCount[edge.mEdgeType]--; + } + + if(!edge.isPendingDestroyed()) + { + if(!edge.isInDirtyList()) + { + PX_ASSERT(!contains(mDirtyEdges[edge.mEdgeType], idx)); + mDirtyEdges[edge.mEdgeType].pushBack(idx); + edge.markInDirtyList(); + } + } + else + { + edge.setReportOnlyDestroy(); + } + + edgeId = nextId; + } + + + if(!node.isActivating() && mActiveNodeIndex[nodeIndex.index()] != PX_INVALID_NODE) + { + //Remove from active kinematic list, add to active dynamic list + PxU32 oldRefCount = node.mActiveRefCount; + node.mActiveRefCount = 0; + markKinematicInactive(nodeIndex); + node.mActiveRefCount = oldRefCount; + } + + node.clearKinematicFlag(); + + + + //Create an island for this node. If there are any edges affecting this node, they will have been marked as + //"new" and will be processed next island update. + { + IslandId islandHandle = mIslandHandles.getHandle(); + + if(islandHandle == mIslands.capacity()) + { + const PxU32 newCapacity = 2*mIslands.capacity()+1; + mIslands.reserve(newCapacity); + mIslandAwake.resize(newCapacity); + mIslandStaticTouchCount.resize(newCapacity); + } + mIslandAwake.reset(islandHandle); + mIslands.resize(PxMax(islandHandle+1, mIslands.size())); + mIslandStaticTouchCount.resize(PxMax(islandHandle + 1, mIslands.size())); + Island& island = mIslands[islandHandle]; + island.mLastNode = island.mRootNode = nodeIndex; + PX_ASSERT(mNodes[nodeIndex.index()].mNextNode.index() == PX_INVALID_NODE); + island.mSize[node.mType] = 1; + mIslandIds[nodeIndex.index()] = islandHandle; + mIslandStaticTouchCount[islandHandle] = 0; + + + if(node.isActive()) + { + node.clearActive(); + + activateNode(nodeIndex); + } + } + } +} + +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp new file mode 100644 index 0000000..adfdd58 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsNphaseImplementationContext.cpp @@ -0,0 +1,1025 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxsContext.h" +#include "CmFlushPool.h" +#include "PxsSimpleIslandManager.h" +#include "common/PxProfileZone.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "PxPhysXGpu.h" +#endif + +#include "PxsContactManagerState.h" + +#include "PxsNphaseImplementationContext.h" +#include "PxvGeometry.h" +#include "PxvDynamics.h" +#include "PxvGlobals.h" + +#include "PxcNpContactPrepShared.h" + +using namespace physx; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable : 4324) +#endif +class PxsCMUpdateTask : public Cm::Task +{ +public: + + static const PxU32 BATCH_SIZE = 128; + //static const PxU32 BATCH_SIZE = 32; + + PxsCMUpdateTask(PxsContext* context, PxReal dt, PxsContactManager** cmArray, PxsContactManagerOutput* cmOutputs, Gu::Cache* caches, PxU32 cmCount, PxContactModifyCallback* callback) : + Cm::Task (context->getContextId()), + mCmArray (cmArray), + mCmOutputs (cmOutputs), + mCaches (caches), + mContext (context), + mCallback (callback), + mCmCount (cmCount), + mDt (dt), + mNbPatchChanged(0) + { + } + + virtual void release(); + + /*PX_FORCE_INLINE void insert(PxsContactManager* cm) + { + PX_ASSERT(mCmCount < BATCH_SIZE); + mCmArray[mCmCount++]=cm; + }*/ + +public: + //PxsContactManager* mCmArray[BATCH_SIZE]; + PxsContactManager** mCmArray; + PxsContactManagerOutput* mCmOutputs; + Gu::Cache* mCaches; + PxsContext* mContext; + PxContactModifyCallback* mCallback; + PxU32 mCmCount; + PxReal mDt; //we could probably retrieve from context to save space? + PxU32 mNbPatchChanged; + + PxsContactManagerOutputCounts mPatchChangedOutputCounts[BATCH_SIZE]; + PxsContactManager* mPatchChangedCms[BATCH_SIZE]; +}; +#if PX_VC +#pragma warning(pop) +#endif + +void PxsCMUpdateTask::release() +{ + // We used to do Task::release(); here before fixing DE1106 (xbox pure virtual crash) + // Release in turn causes the dependent tasks to start running + // The problem was that between the time release was called and by the time we got to the destructor + // The task chain would get all the way to scene finalization code which would reset the allocation pool + // And a new task would get allocated at the same address, then we would invoke the destructor on that freshly created task + // This could potentially cause any number of other problems, it is suprising that it only manifested itself + // as a pure virtual crash + PxBaseTask* saveContinuation = mCont; + this->~PxsCMUpdateTask(); + if (saveContinuation) + saveContinuation->removeReference(); +} + +static const bool gUseNewTaskAllocationScheme = false; + +class PxsCMDiscreteUpdateTask : public PxsCMUpdateTask +{ +public: + PxsCMDiscreteUpdateTask(PxsContext* context, PxReal dt, PxsContactManager** cms, PxsContactManagerOutput* cmOutputs, Gu::Cache* caches, PxU32 nbCms, + PxContactModifyCallback* callback): + PxsCMUpdateTask(context, dt, cms, cmOutputs, caches, nbCms, callback) + {} + + virtual ~PxsCMDiscreteUpdateTask() + {} + + void runModifiableContactManagers(PxU32* modifiableIndices, PxU32 nbModifiableManagers, PxcNpThreadContext& threadContext, PxU32& maxPatches_) + { + PX_ASSERT(nbModifiableManagers != 0); + + PxU32 maxPatches = maxPatches_; + + class PxcContactSet: public PxContactSet + { + public: + PxcContactSet(PxU32 count, PxModifiableContact *contacts) + { + mContacts = contacts; + mCount = count; + } + PxModifiableContact* getContacts() { return mContacts; } + PxU32 getCount() { return mCount; } + }; + + if(mCallback) + { + PX_ALLOCA(mModifiablePairArray, PxContactModifyPair, nbModifiableManagers); + + PxsTransformCache& transformCache = mContext->getTransformCache(); + + for(PxU32 i = 0; i < nbModifiableManagers; ++i) + { + PxU32 index = modifiableIndices[i]; + PxsContactManager& cm = *mCmArray[index]; + + PxsContactManagerOutput& output = mCmOutputs[index]; + + PxU32 count = output.nbContacts; + + if(count) + { + PxContactModifyPair& p = mModifiablePairArray[i]; + PxcNpWorkUnit &unit = cm.getWorkUnit(); + + p.shape[0] = gPxvOffsetTable.convertPxsShape2Px(unit.shapeCore0); + p.shape[1] = gPxvOffsetTable.convertPxsShape2Px(unit.shapeCore1); + + p.actor[0] = unit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY0 | PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? gPxvOffsetTable.convertPxsRigidCore2PxRigidBody(unit.rigidCore0) + : gPxvOffsetTable.convertPxsRigidCore2PxRigidStatic(unit.rigidCore0); + + p.actor[1] = unit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY1 | PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? gPxvOffsetTable.convertPxsRigidCore2PxRigidBody(unit.rigidCore1) + : gPxvOffsetTable.convertPxsRigidCore2PxRigidStatic(unit.rigidCore1); + + p.transform[0] = transformCache.getTransformCache(unit.mTransformCache0).transform; + p.transform[1] = transformCache.getTransformCache(unit.mTransformCache1).transform; + + PxModifiableContact* contacts = reinterpret_cast(output.contactPoints); + static_cast(p.contacts) = PxcContactSet(count, contacts); + + PxReal mi0 = unit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY0 | PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? static_cast(unit.rigidCore0)->maxContactImpulse : PX_MAX_F32; + PxReal mi1 = unit.flags & (PxcNpWorkUnitFlag::eDYNAMIC_BODY1 | PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? static_cast(unit.rigidCore1)->maxContactImpulse : PX_MAX_F32; + PxReal maxImpulse = PxMin(mi0, mi1); + for (PxU32 j = 0; j < count; j++) + contacts[j].maxImpulse = maxImpulse; + + #if PX_ENABLE_SIM_STATS + PxU8 gt0 = PxTo8(unit.geomType0), gt1 = PxTo8(unit.geomType1); + threadContext.mModifiedContactPairs[PxMin(gt0, gt1)][PxMax(gt0, gt1)]++; + #else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + #endif + } + } + + mCallback->onContactModify(mModifiablePairArray, nbModifiableManagers); + } + + for(PxU32 i = 0; i < nbModifiableManagers; ++i) + { + PxU32 index = modifiableIndices[i]; + PxsContactManager& cm = *mCmArray[index]; + + //Loop through the contacts in the contact stream and update contact count! + + PxU32 numContacts = 0; + PxcNpWorkUnit& unit = cm.getWorkUnit(); + PxsContactManagerOutput& output = mCmOutputs[index]; + + PxU32 numPatches = output.nbPatches; + + if (output.nbContacts) + { + //PxU8* compressedContacts = cm.getWorkUnit().compressedContacts; + //PxModifyContactHeader* header = reinterpret_cast(compressedContacts); + PxContactPatch* patches = reinterpret_cast(output.contactPatches); + PxModifiableContact* points = reinterpret_cast(output.contactPoints); + + if (patches->internalFlags & PxContactPatch::eREGENERATE_PATCHES) + { + //Some data was modified that must trigger patch re-generation... + for (PxU8 k = 0; k < numPatches; ++k) + { + PxU32 startIndex = patches[k].startContactIndex; + + patches[k].normal = points[startIndex].normal; + patches[k].dynamicFriction = points[startIndex].dynamicFriction; + patches[k].staticFriction = points[startIndex].staticFriction; + patches[k].restitution = points[startIndex].restitution; + + for (PxU32 j = 1; j < patches[k].nbContacts; ++j) + { + if (points[startIndex].normal.dot(points[j + startIndex].normal) < PXC_SAME_NORMAL + && points[j + startIndex].maxImpulse > 0.f) //TODO - this needs extending for material indices but we don't support modifying those yet + { + //The points are now in a separate friction patch... + // Shift all patches above index k up by one to make space + for (PxU32 c = numPatches - 1; c > k; --c) + { + patches[c + 1] = patches[c]; + } + numPatches++; + patches[k + 1].materialFlags = patches[k].materialFlags; + patches[k + 1].internalFlags = patches[k].internalFlags; + patches[k + 1].startContactIndex = PxTo8(j + startIndex); + patches[k + 1].nbContacts = PxTo8(patches[k].nbContacts - j); + //Fill in patch information now that final patches are available + patches[k].nbContacts = PxU8(j); + break; // we're done with all contacts in patch k because the remaining were just transferrred to patch k+1 + } + } + } + } + + maxPatches = PxMax(maxPatches, PxU32(numPatches)); + + output.nbPatches = PxU8(numPatches); + + for (PxU32 a = 0; a < output.nbContacts; ++a) + { + numContacts += points[a].maxImpulse != 0.f; + } + } + + if (!numContacts) + { + output.nbPatches = 0; + output.nbContacts = 0; + } + + if(output.nbPatches != output.prevPatches) + { + mPatchChangedCms[mNbPatchChanged] = &cm; + PxsContactManagerOutputCounts& counts = mPatchChangedOutputCounts[mNbPatchChanged++]; + counts.nbPatches = PxU8(numPatches); + counts.prevPatches = output.prevPatches; + counts.statusFlag = output.statusFlag; + //counts.nbContacts = output.nbContacts16; + } + + if(!numContacts) + { + //KS - we still need to retain the patch count from the previous frame to detect found/lost events... + unit.clearCachedState(); + continue; + } + + if(threadContext.mContactStreamPool) + { + //We need to allocate a new structure inside the contact stream pool + + PxU32 patchSize = output.nbPatches * sizeof(PxContactPatch); + PxU32 contactSize = output.nbContacts * sizeof(PxExtendedContact); + + /*PxI32 increment = (PxI32)(patchSize + contactSize); + PxI32 index = PxAtomicAdd(&mContactStreamPool->mSharedContactIndex, increment) - increment; + PxU8* address = mContactStreamPool->mContactStream + index;*/ + bool isOverflown = false; + + PxI32 contactIncrement = PxI32(contactSize); + PxI32 contactIndex = PxAtomicAdd(&threadContext.mContactStreamPool->mSharedDataIndex, contactIncrement); + + if (threadContext.mContactStreamPool->isOverflown()) + { + PX_WARN_ONCE("Contact buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + + PxU8* contactAddress = threadContext.mContactStreamPool->mDataStream + threadContext.mContactStreamPool->mDataStreamSize - contactIndex; + + PxI32 patchIncrement = PxI32(patchSize); + PxI32 patchIndex = PxAtomicAdd(&threadContext.mPatchStreamPool->mSharedDataIndex, patchIncrement); + + if (threadContext.mPatchStreamPool->isOverflown()) + { + PX_WARN_ONCE("Patch buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + + PxU8* patchAddress = threadContext.mPatchStreamPool->mDataStream + threadContext.mPatchStreamPool->mDataStreamSize - patchIndex; + + PxU32 internalFlags = reinterpret_cast(output.contactPatches)->internalFlags; + + PxI32 increment2 = PxI32(output.nbContacts * sizeof(PxReal)); + PxI32 index2 = PxAtomicAdd(&threadContext.mForceAndIndiceStreamPool->mSharedDataIndex, increment2); + + if (threadContext.mForceAndIndiceStreamPool->isOverflown()) + { + PX_WARN_ONCE("Force buffer overflow detected, please increase its size in the scene desc!\n"); + isOverflown = true; + } + + if (isOverflown) + { + output.contactPoints = NULL; + output.contactPatches = NULL; + output.contactForces = NULL; + + output.nbContacts = output.nbPatches = 0; + } + else + { + output.contactForces = reinterpret_cast(threadContext.mForceAndIndiceStreamPool->mDataStream + threadContext.mForceAndIndiceStreamPool->mDataStreamSize - index2); + + PxMemZero(output.contactForces, sizeof(PxReal) * output.nbContacts); + + PxExtendedContact* contacts = reinterpret_cast(contactAddress); + PxMemCopy(patchAddress, output.contactPatches, sizeof(PxContactPatch) * output.nbPatches); + + PxContactPatch* newPatches = reinterpret_cast(patchAddress); + + internalFlags |= PxContactPatch::eCOMPRESSED_MODIFIED_CONTACT; + + for(PxU32 a = 0; a < output.nbPatches; ++a) + { + newPatches[a].internalFlags = PxU8(internalFlags); + } + + //KS - only the first patch will have mass modification properties set. For the GPU solver, this must be propagated to the remaining patches + for(PxU32 a = 1; a < output.nbPatches; ++a) + { + newPatches[a].mMassModification = newPatches->mMassModification; + } + + PxModifiableContact* sourceContacts = reinterpret_cast(output.contactPoints); + + for(PxU32 a = 0; a < output.nbContacts; ++a) + { + PxExtendedContact& contact = contacts[a]; + PxModifiableContact& srcContact = sourceContacts[a]; + contact.contact = srcContact.contact; + contact.separation = srcContact.separation; + contact.targetVelocity = srcContact.targetVelocity; + contact.maxImpulse = srcContact.maxImpulse; + } + + output.contactPatches = patchAddress; + output.contactPoints = reinterpret_cast(contacts); + } + } + } + maxPatches_ = maxPatches; + } + + template < void (*NarrowPhase)(PxcNpThreadContext&, const PxcNpWorkUnit&, Gu::Cache&, PxsContactManagerOutput&, PxU64)> + void processCms(PxcNpThreadContext* threadContext) + { + const PxU64 contextID = mContext->getContextId(); + //PX_PROFILE_ZONE("processCms", mContext->getContextId()); + + // PT: use local variables to avoid reading class members N times, if possible + const PxU32 nb = mCmCount; + PxsContactManager** PX_RESTRICT cmArray = mCmArray; + + PxU32 maxPatches = threadContext->mMaxPatches; + + PxU32 newTouchCMCount = 0, lostTouchCMCount = 0; + PxBitMap& localChangeTouchCM = threadContext->getLocalChangeTouch(); + + PX_ALLOCA(modifiableIndices, PxU32, nb); + PxU32 modifiableCount = 0; + + for(PxU32 i=0;igetWorkUnit().shapeCore0); + PxPrefetchLine(cmArray[prefetch1]->getWorkUnit().shapeCore1); + PxPrefetchLine(&threadContext->mTransformCache->getTransformCache(cmArray[prefetch1]->getWorkUnit().mTransformCache0)); + PxPrefetchLine(&threadContext->mTransformCache->getTransformCache(cmArray[prefetch1]->getWorkUnit().mTransformCache1)); + + PxsContactManager* const cm = cmArray[i]; + + if(cm) + { + PxsContactManagerOutput& output = mCmOutputs[i]; + PxcNpWorkUnit& unit = cm->getWorkUnit(); + + output.prevPatches = output.nbPatches; + + PxU8 oldStatusFlag = output.statusFlag; + + PxU8 oldTouch = PxTo8(oldStatusFlag & PxsContactManagerStatusFlag::eHAS_TOUCH); + + Gu::Cache& cache = mCaches[i]; + + NarrowPhase(*threadContext, unit, cache, output, contextID); + + PxU16 newTouch = PxTo8(output.statusFlag & PxsContactManagerStatusFlag::eHAS_TOUCH); + + bool modifiable = output.nbPatches != 0 && unit.flags & PxcNpWorkUnitFlag::eMODIFIABLE_CONTACT; + + if(modifiable) + { + modifiableIndices[modifiableCount++] = i; + } + else + { + maxPatches = PxMax(maxPatches, PxTo32(output.nbPatches)); + + if(output.prevPatches != output.nbPatches) + { + mPatchChangedCms[mNbPatchChanged] = cm; + PxsContactManagerOutputCounts& counts = mPatchChangedOutputCounts[mNbPatchChanged++]; + counts.nbPatches = output.nbPatches; + counts.prevPatches = output.prevPatches; + counts.statusFlag = output.statusFlag; + //counts.nbContacts = output.nbContacts; + } + } + + if (newTouch ^ oldTouch) + { + unit.statusFlags = PxU8(output.statusFlag | (unit.statusFlags & PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH)); //KS - todo - remove the need to access the work unit at all! + localChangeTouchCM.growAndSet(cmArray[i]->getIndex()); + if(newTouch) + newTouchCMCount++; + else + lostTouchCMCount++; + } + else if (!(oldStatusFlag&PxsContactManagerStatusFlag::eTOUCH_KNOWN)) + { + unit.statusFlags = PxU8(output.statusFlag | (unit.statusFlags & PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH)); //KS - todo - remove the need to access the work unit at all! + } + } + } + + if(modifiableCount) + runModifiableContactManagers(modifiableIndices, modifiableCount, *threadContext, maxPatches); + + threadContext->addLocalNewTouchCount(newTouchCMCount); + threadContext->addLocalLostTouchCount(lostTouchCMCount); + + threadContext->mMaxPatches = maxPatches; + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("Sim.narrowPhase", mContext->getContextId()); + + PxcNpThreadContext* PX_RESTRICT threadContext = mContext->getNpThreadContext(); + + threadContext->mDt = mDt; + + const bool pcm = mContext->getPCM(); + threadContext->mPCM = pcm; + threadContext->mCreateAveragePoint = mContext->getCreateAveragePoint(); + threadContext->mContactCache = mContext->getContactCacheFlag(); + threadContext->mTransformCache = &mContext->getTransformCache(); + threadContext->mContactDistances = mContext->getContactDistances(); + + if(pcm) + processCms(threadContext); + else + processCms(threadContext); + + mContext->putNpThreadContext(threadContext); + } + + virtual const char* getName() const + { + return "PxsContext.contactManagerDiscreteUpdate"; + } +}; + +static void processContactManagers(PxsContext& context, PxsContactManagers& narrowPhasePairs, PxArray& tasks, PxReal dt, PxsContactManagerOutput* cmOutputs, PxBaseTask* continuation, PxContactModifyCallback* modifyCallback) +{ + Cm::FlushPool& taskPool = context.getTaskPool(); + + //Iterate all active contact managers + taskPool.lock(); + /*const*/ PxU32 nbCmsToProcess = narrowPhasePairs.mContactManagerMapping.size(); + + if(!gUseNewTaskAllocationScheme) + { + for(PxU32 a=0; asetContinuation(continuation); + task->removeReference(); + + tasks.pushBack(task); + } + } + else + { + // PT: + const PxU32 numCpuTasks = continuation->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + PxU32 nbPerTask; + if(numCpuTasks) + nbPerTask = nbCmsToProcess > numCpuTasks ? nbCmsToProcess / numCpuTasks : nbCmsToProcess; + else + nbPerTask = nbCmsToProcess; + + // PT: we need to respect that limit even with a single thread, because of hardcoded buffer limits in ScAfterIntegrationTask. + if(nbPerTask>PxsCMUpdateTask::BATCH_SIZE) + nbPerTask = PxsCMUpdateTask::BATCH_SIZE; + + PxU32 start = 0; + while(nbCmsToProcess) + { + const PxU32 nb = nbCmsToProcess < nbPerTask ? nbCmsToProcess : nbPerTask; + + void* ptr = taskPool.allocateNotThreadSafe(sizeof(PxsCMDiscreteUpdateTask)); + PxsCMDiscreteUpdateTask* task = PX_PLACEMENT_NEW(ptr, PxsCMDiscreteUpdateTask)(&context, dt, narrowPhasePairs.mContactManagerMapping.begin() + start, + cmOutputs + start, narrowPhasePairs.mCaches.begin() + start, nb, modifyCallback); + + task->setContinuation(continuation); + task->removeReference(); + + tasks.pushBack(task); + + start += nb; + nbCmsToProcess -= nb; + } + } + taskPool.unlock(); +} + +void PxsNphaseImplementationContext::processContactManager(PxReal dt, PxsContactManagerOutput* cmOutputs, PxBaseTask* continuation) +{ + processContactManagers(mContext, mNarrowPhasePairs, mCmTasks, dt, cmOutputs, continuation, mModifyCallback); +} + +void PxsNphaseImplementationContext::processContactManagerSecondPass(PxReal dt, PxBaseTask* continuation) +{ + processContactManagers(mContext, mNewNarrowPhasePairs, mCmTasks, dt, mNewNarrowPhasePairs.mOutputContactManagers.begin(), continuation, mModifyCallback); +} + +void PxsNphaseImplementationContext::updateContactManager(PxReal dt, bool /*hasBoundsArrayChanged*/, bool /*hasContactDistanceChanged*/, PxBaseTask* continuation, + PxBaseTask* firstPassNpContinuation, Cm::FanoutTask* /*updateBoundAndShapeTask*/) +{ + PX_PROFILE_ZONE("Sim.queueNarrowPhase", mContext.mContextID); + + firstPassNpContinuation->removeReference(); + + mContext.clearManagerTouchEvents(); + +#if PX_ENABLE_SIM_STATS + mContext.mSimStats.mNbDiscreteContactPairsTotal = 0; + mContext.mSimStats.mNbDiscreteContactPairsWithCacheHits = 0; + mContext.mSimStats.mNbDiscreteContactPairsWithContacts = 0; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + //KS - temporarily put this here. TODO - move somewhere better + mContext.mTotalCompressedCacheSize = 0; + mContext.mMaxPatches = 0; + + processContactManager(dt, mNarrowPhasePairs.mOutputContactManagers.begin(), continuation); +} + +void PxsNphaseImplementationContext::secondPassUpdateContactManager(PxReal dt, PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.queueNarrowPhase", mContext.mContextID); + + processContactManagerSecondPass(dt, continuation); +} + +PxsNphaseImplementationContext* PxsNphaseImplementationContext::create(PxsContext& context, IG::IslandSim* islandSim, PxVirtualAllocatorCallback* allocator) +{ + PxsNphaseImplementationContext* npImplContext = reinterpret_cast( + PX_ALLOC(sizeof(PxsNphaseImplementationContext), "PxsNphaseImplementationContext")); + + if (npImplContext) + { + //new(npImplContext) PxsNphaseImplementationContext(context, islandSim, allocator); + + npImplContext = PX_PLACEMENT_NEW(npImplContext, PxsNphaseImplementationContext)(context, islandSim, allocator); + } + + return npImplContext; +} + +void PxsNphaseImplementationContext::destroy() +{ + this->~PxsNphaseImplementationContext(); + PX_FREE_THIS; +} + +/*void PxsNphaseImplementationContext::registerContactManagers(PxsContactManager** cms, Sc::ShapeInteraction** shapeInteractions, PxU32 nbContactManagers, PxU32 maxContactManagerId) +{ + PX_UNUSED(maxContactManagerId); + for (PxU32 a = 0; a < nbContactManagers; ++a) + { + registerContactManager(cms[a], shapeInteractions[a], 0, 0); + } +}*/ + +void PxsNphaseImplementationContext::registerContactManager(PxsContactManager* cm, Sc::ShapeInteraction* shapeInteraction, PxI32 touching, PxU32 patchCount) +{ + PX_ASSERT(cm); + + PxcNpWorkUnit& workUnit = cm->getWorkUnit(); + PxsContactManagerOutput output; + + PX_ASSERT(workUnit.geomType0 0) + output.statusFlag |= PxsContactManagerStatusFlag::eHAS_TOUCH; + else if (touching < 0) + output.statusFlag |= PxsContactManagerStatusFlag::eHAS_NO_TOUCH; + + output.statusFlag |= PxsContactManagerStatusFlag::eDIRTY_MANAGER; + + if (workUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_TOUCH) + workUnit.statusFlags |= PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH; + + output.flags = workUnit.flags; + + mNewNarrowPhasePairs.mOutputContactManagers.pushBack(output); + mNewNarrowPhasePairs.mCaches.pushBack(cache); + mNewNarrowPhasePairs.mContactManagerMapping.pushBack(cm); + mNewNarrowPhasePairs.mShapeInteractions.pushBack(shapeInteraction); + mNewNarrowPhasePairs.mRestDistances.pushBack(cm->getRestDistance()); + mNewNarrowPhasePairs.mTorsionalProperties.pushBack(PxsTorsionalFrictionData(workUnit.mTorsionalPatchRadius, workUnit.mMinTorsionalPatchRadius)); + PxU32 newSz = mNewNarrowPhasePairs.mOutputContactManagers.size(); + workUnit.mNpIndex = mNewNarrowPhasePairs.computeId(newSz - 1) | PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK; +} + +void PxsNphaseImplementationContext::removeContactManagersFallback(PxsContactManagerOutput* cmOutputs) +{ + if (mRemovedContactManagers.size()) + { + lock(); + PxSort(mRemovedContactManagers.begin(), mRemovedContactManagers.size(), PxGreater()); + + for (PxU32 a = 0; a < mRemovedContactManagers.size(); ++a) + { +#if PX_DEBUG + if (a > 0) + PX_ASSERT(mRemovedContactManagers[a] < mRemovedContactManagers[a - 1]); +#endif + unregisterContactManagerInternal(mRemovedContactManagers[a], mNarrowPhasePairs, cmOutputs); + } + + mRemovedContactManagers.forceSize_Unsafe(0); + unlock(); + } +} + +void PxsNphaseImplementationContext::unregisterContactManager(PxsContactManager* cm) +{ + PxcNpWorkUnit& unit = cm->getWorkUnit(); + + PxU32 index = unit.mNpIndex; + PX_ASSERT(index != 0xFFffFFff); + + if (!(index & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK)) + { + unregisterAndForceSize(mNarrowPhasePairs, index); + } + else + { + //KS - the index in the "new" list will be the index + unregisterAndForceSize(mNewNarrowPhasePairs, index); + } +} + +void PxsNphaseImplementationContext::refreshContactManager(PxsContactManager* cm) +{ + PxcNpWorkUnit& unit = cm->getWorkUnit(); + PxU32 index = unit.mNpIndex; + PX_ASSERT(index != 0xFFffFFff); + PxsContactManagerOutput output; + Sc::ShapeInteraction* interaction; + if (!(index & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK)) + { + output = mNarrowPhasePairs.mOutputContactManagers[PxsContactManagerBase::computeIndexFromId(index)]; + interaction = mNarrowPhasePairs.mShapeInteractions[PxsContactManagerBase::computeIndexFromId(index)]; + unregisterAndForceSize(mNarrowPhasePairs, index); + } + else + { + output = mNewNarrowPhasePairs.mOutputContactManagers[PxsContactManagerBase::computeIndexFromId(index & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; + interaction = mNewNarrowPhasePairs.mShapeInteractions[PxsContactManagerBase::computeIndexFromId(index & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; + //KS - the index in the "new" list will be the index + unregisterAndForceSize(mNewNarrowPhasePairs, index); + } + PxI32 touching = 0; + if(output.statusFlag & PxsContactManagerStatusFlag::eHAS_TOUCH) + touching = 1; + else if (output.statusFlag & PxsContactManagerStatusFlag::eHAS_NO_TOUCH) + touching = -1; + registerContactManager(cm, interaction, touching, output.nbPatches); +} + +void PxsNphaseImplementationContext::unregisterContactManagerFallback(PxsContactManager* cm, PxsContactManagerOutput* /*cmOutputs*/) +{ + PxcNpWorkUnit& unit = cm->getWorkUnit(); + PxU32 index = unit.mNpIndex; + PX_ASSERT(index != 0xFFffFFff); + + if (!(index & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK)) + { + mRemovedContactManagers.pushBack(index); + } + else + { + //KS - the index in the "new" list will be the index + unregisterAndForceSize(mNewNarrowPhasePairs, index); + } +} + +void PxsNphaseImplementationContext::refreshContactManagerFallback(PxsContactManager* cm, PxsContactManagerOutput* cmOutputs) +{ + PxcNpWorkUnit& unit = cm->getWorkUnit(); + PxU32 index = unit.mNpIndex; + PX_ASSERT(index != 0xFFffFFff); + + PxsContactManagerOutput output; + Sc::ShapeInteraction* interaction; + if (!(index & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK)) + { + output = cmOutputs[PxsContactManagerBase::computeIndexFromId(index)]; + interaction = mNarrowPhasePairs.mShapeInteractions[PxsContactManagerBase::computeIndexFromId(index & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; + //unregisterContactManagerInternal(index, mNarrowPhasePairs, cmOutputs); + unregisterContactManagerFallback(cm, cmOutputs); + } + else + { + //KS - the index in the "new" list will be the index + output = mNewNarrowPhasePairs.mOutputContactManagers[PxsContactManagerBase::computeIndexFromId(index & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; + interaction = mNewNarrowPhasePairs.mShapeInteractions[PxsContactManagerBase::computeIndexFromId(index & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; + unregisterAndForceSize(mNewNarrowPhasePairs, index); + } + + PxI32 touching = 0; + if(output.statusFlag & PxsContactManagerStatusFlag::eHAS_TOUCH) + { + touching = 1; + unit.statusFlags |= PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH; + } + else if (output.statusFlag & PxsContactManagerStatusFlag::eHAS_NO_TOUCH) + touching = -1; + registerContactManager(cm, interaction, touching, output.nbPatches); +} + +void PxsNphaseImplementationContext::appendContactManagers() +{ + //Copy new pairs to end of old pairs. Clear new flag, update npIndex on CM and clear the new pair buffer + const PxU32 existingSize = mNarrowPhasePairs.mContactManagerMapping.size(); + const PxU32 nbToAdd = mNewNarrowPhasePairs.mContactManagerMapping.size(); + const PxU32 newSize =existingSize + nbToAdd; + + if(newSize > mNarrowPhasePairs.mContactManagerMapping.capacity()) + { + PxU32 newSz = PxMax(256u, PxMax(mNarrowPhasePairs.mContactManagerMapping.capacity()*2, newSize)); + + mNarrowPhasePairs.mContactManagerMapping.reserve(newSz); + mNarrowPhasePairs.mOutputContactManagers.reserve(newSz); + mNarrowPhasePairs.mCaches.reserve(newSz); + mNarrowPhasePairs.mShapeInteractions.reserve(newSz); + mNarrowPhasePairs.mRestDistances.reserve(newSz); + mNarrowPhasePairs.mTorsionalProperties.reserve(newSz); + } + + mNarrowPhasePairs.mContactManagerMapping.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mOutputContactManagers.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mCaches.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mShapeInteractions.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mRestDistances.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mTorsionalProperties.forceSize_Unsafe(newSize); + + PxMemCopy(mNarrowPhasePairs.mContactManagerMapping.begin() + existingSize, mNewNarrowPhasePairs.mContactManagerMapping.begin(), sizeof(PxsContactManager*)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mOutputContactManagers.begin() + existingSize, mNewNarrowPhasePairs.mOutputContactManagers.begin(), sizeof(PxsContactManagerOutput)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mCaches.begin() + existingSize, mNewNarrowPhasePairs.mCaches.begin(), sizeof(Gu::Cache)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mShapeInteractions.begin() + existingSize, mNewNarrowPhasePairs.mShapeInteractions.begin(), sizeof(Sc::ShapeInteraction*)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mRestDistances.begin() + existingSize, mNewNarrowPhasePairs.mRestDistances.begin(), sizeof(PxReal)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mTorsionalProperties.begin() + existingSize, mNewNarrowPhasePairs.mTorsionalProperties.begin(), sizeof(PxsTorsionalFrictionData)*nbToAdd); + + PxU32* edgeNodeIndices = mIslandSim->getEdgeNodeIndexPtr(); + + for(PxU32 a = 0; a < mNewNarrowPhasePairs.mContactManagerMapping.size(); ++a) + { + PxsContactManager* cm = mNewNarrowPhasePairs.mContactManagerMapping[a]; + PxcNpWorkUnit& unit = cm->getWorkUnit(); + unit.mNpIndex = mNarrowPhasePairs.computeId(existingSize + a); + + if(unit.statusFlags & PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH) + { + unit.statusFlags &= (~PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH); + if(!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE)) + { + PartitionEdge* partitionEdge = mIslandSim->getFirstPartitionEdge(unit.mEdgeIndex); + + while(partitionEdge) + { + edgeNodeIndices[partitionEdge->mUniqueIndex] = unit.mNpIndex; + partitionEdge = partitionEdge->mNextPatch; + } + } + } + } + + mNewNarrowPhasePairs.clear(); + + appendNewLostPairs(); +} + +void PxsNphaseImplementationContext::appendContactManagersFallback(PxsContactManagerOutput* cmOutputs) +{ + PX_PROFILE_ZONE("PxsNphaseImplementationContext.appendContactManagersFallback", mContext.mContextID); + + //Copy new pairs to end of old pairs. Clear new flag, update npIndex on CM and clear the new pair buffer + const PxU32 existingSize = mNarrowPhasePairs.mContactManagerMapping.size(); + const PxU32 nbToAdd = mNewNarrowPhasePairs.mContactManagerMapping.size(); + const PxU32 newSize =existingSize + nbToAdd; + + if(newSize > mNarrowPhasePairs.mContactManagerMapping.capacity()) + { + PxU32 newSz = PxMax(mNarrowPhasePairs.mContactManagerMapping.capacity()*2, newSize); + + mNarrowPhasePairs.mContactManagerMapping.reserve(newSz); + mNarrowPhasePairs.mCaches.reserve(newSz); + mNarrowPhasePairs.mShapeInteractions.reserve(newSz); + mNarrowPhasePairs.mRestDistances.reserve(newSz); + mNarrowPhasePairs.mTorsionalProperties.reserve(newSz); + } + + mNarrowPhasePairs.mContactManagerMapping.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mCaches.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mShapeInteractions.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mRestDistances.forceSize_Unsafe(newSize); + mNarrowPhasePairs.mTorsionalProperties.forceSize_Unsafe(newSize); + + PxMemCopy(mNarrowPhasePairs.mContactManagerMapping.begin() + existingSize, mNewNarrowPhasePairs.mContactManagerMapping.begin(), sizeof(PxsContactManager*)*nbToAdd); + PxMemCopy(cmOutputs + existingSize, mNewNarrowPhasePairs.mOutputContactManagers.begin(), sizeof(PxsContactManagerOutput)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mCaches.begin() + existingSize, mNewNarrowPhasePairs.mCaches.begin(), sizeof(Gu::Cache)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mShapeInteractions.begin() + existingSize, mNewNarrowPhasePairs.mShapeInteractions.begin(), sizeof(Sc::ShapeInteraction*)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mRestDistances.begin() + existingSize, mNewNarrowPhasePairs.mRestDistances.begin(), sizeof(PxReal)*nbToAdd); + PxMemCopy(mNarrowPhasePairs.mTorsionalProperties.begin() + existingSize, mNewNarrowPhasePairs.mTorsionalProperties.begin(), sizeof(PxsTorsionalFrictionData)*nbToAdd); + + PxU32* edgeNodeIndices = mIslandSim->getEdgeNodeIndexPtr(); + + for(PxU32 a = 0; a < mNewNarrowPhasePairs.mContactManagerMapping.size(); ++a) + { + PxsContactManager* cm = mNewNarrowPhasePairs.mContactManagerMapping[a]; + PxcNpWorkUnit& unit = cm->getWorkUnit(); + unit.mNpIndex = mNarrowPhasePairs.computeId(existingSize + a); + + if(unit.statusFlags & PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH) + { + unit.statusFlags &= (~PxcNpWorkUnitStatusFlag::eREFRESHED_WITH_TOUCH); + if(!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE)) + { + PartitionEdge* partitionEdge = mIslandSim->getFirstPartitionEdge(unit.mEdgeIndex); + + while(partitionEdge) + { + edgeNodeIndices[partitionEdge->mUniqueIndex] = unit.mNpIndex; + partitionEdge = partitionEdge->mNextPatch; + } + } + } + } + + mNewNarrowPhasePairs.clear(); + + appendNewLostPairs(); +} + +void PxsNphaseImplementationContext::appendNewLostPairs() +{ + mCmFoundLostOutputCounts.forceSize_Unsafe(0); + mCmFoundLost.forceSize_Unsafe(0); + PxU32 count = 0; + for (PxU32 i = 0, taskSize = mCmTasks.size(); i < taskSize; ++i) + { + PxsCMDiscreteUpdateTask* task = mCmTasks[i]; + + const PxU32 patchCount = task->mNbPatchChanged; + + if (patchCount) + { + const PxU32 newSize = mCmFoundLostOutputCounts.size() + patchCount; + + //KS - TODO - consider switching to 2x loops to avoid frequent allocations. However, we'll probably only grow this rarely, + //so may not be worth the effort! + if (mCmFoundLostOutputCounts.capacity() < newSize) + { + //Allocate more memory!!! + const PxU32 newCapacity = PxMax(mCmFoundLostOutputCounts.capacity() * 2, newSize); + mCmFoundLostOutputCounts.reserve(newCapacity); + mCmFoundLost.reserve(newCapacity); + } + + mCmFoundLostOutputCounts.forceSize_Unsafe(newSize); + mCmFoundLost.forceSize_Unsafe(newSize); + + PxMemCopy(&mCmFoundLost[count], task->mPatchChangedCms, sizeof(PxsContactManager*)*patchCount); + PxMemCopy(&mCmFoundLostOutputCounts[count], task->mPatchChangedOutputCounts, sizeof(PxsContactManagerOutputCounts)*patchCount); + count += patchCount; + } + } + + mCmTasks.forceSize_Unsafe(0); +} + +void PxsNphaseImplementationContext::unregisterContactManagerInternal(PxU32 npIndex, PxsContactManagers& managers, PxsContactManagerOutput* cmOutputs) +{ +// PX_PROFILE_ZONE("unregisterContactManagerInternal", 0); + + //TODO - remove this element from the list. + const PxU32 index = PxsContactManagerBase::computeIndexFromId((npIndex & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))); + + //Now we replace-with-last and remove the elements... + + const PxU32 replaceIndex = managers.mContactManagerMapping.size()-1; + + PxsContactManager* replaceManager = managers.mContactManagerMapping[replaceIndex]; + + mContext.destroyCache(managers.mCaches[index]); + + managers.mContactManagerMapping[index] = replaceManager; + managers.mCaches[index] = managers.mCaches[replaceIndex]; + cmOutputs[index] = cmOutputs[replaceIndex]; + managers.mShapeInteractions[index] = managers.mShapeInteractions[replaceIndex]; + managers.mRestDistances[index] = managers.mRestDistances[replaceIndex]; + managers.mTorsionalProperties[index] = managers.mTorsionalProperties[replaceIndex]; + managers.mCaches[replaceIndex].reset(); + + PxcNpWorkUnit& replaceUnit = replaceManager->getWorkUnit(); + replaceUnit.mNpIndex = npIndex; + if(replaceUnit.statusFlags & PxcNpWorkUnitStatusFlag::eHAS_TOUCH) + { + if(!(replaceUnit.flags & PxcNpWorkUnitFlag::eDISABLE_RESPONSE)) + { + PxU32* edgeNodeIndices = mIslandSim->getEdgeNodeIndexPtr(); + + PartitionEdge* partitionEdge = mIslandSim->getFirstPartitionEdge(replaceUnit.mEdgeIndex); + while(partitionEdge) + { + edgeNodeIndices[partitionEdge->mUniqueIndex] = replaceUnit.mNpIndex; + partitionEdge = partitionEdge->mNextPatch; + } + } + } + + managers.mContactManagerMapping.forceSize_Unsafe(replaceIndex); + managers.mCaches.forceSize_Unsafe(replaceIndex); + managers.mShapeInteractions.forceSize_Unsafe(replaceIndex); + managers.mRestDistances.forceSize_Unsafe(replaceIndex); + managers.mTorsionalProperties.forceSize_Unsafe(replaceIndex); +} + +PxsContactManagerOutput& PxsNphaseImplementationContext::getNewContactManagerOutput(PxU32 npId) +{ + PX_ASSERT(npId & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK); + return mNewNarrowPhasePairs.mOutputContactManagers[PxsContactManagerBase::computeIndexFromId(npId & (~PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK))]; +} + +PxsContactManagerOutputIterator PxsNphaseImplementationContext::getContactManagerOutputs() +{ + PxU32 offsets[1] = {0}; + return PxsContactManagerOutputIterator(offsets, 1, mNarrowPhasePairs.mOutputContactManagers.begin()); +} + +PxvNphaseImplementationContextUsableAsFallback* physx::createNphaseImplementationContext(PxsContext& context, IG::IslandSim* islandSim, PxVirtualAllocatorCallback* allocator) +{ + return PxsNphaseImplementationContext::create(context, islandSim, allocator); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp new file mode 100644 index 0000000..6beaa60 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevel/software/src/PxsSimpleIslandManager.cpp @@ -0,0 +1,412 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "PxsSimpleIslandManager.h" +#include "foundation/PxSort.h" +#include "PxsContactManager.h" +#include "CmTask.h" +#include "DyVArticulation.h" + + +#define IG_SANITY_CHECKS 0 + +namespace physx +{ +namespace IG +{ + ThirdPassTask::ThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager, IslandSim& islandSim) : Cm::Task(contextID), mIslandManager(islandManager), mIslandSim(islandSim) + { + } + + PostThirdPassTask::PostThirdPassTask(PxU64 contextID, SimpleIslandManager& islandManager) : Cm::Task(contextID), mIslandManager(islandManager) + { + } + + SimpleIslandManager::SimpleIslandManager(bool useEnhancedDeterminism, PxU64 contextID) : + mDestroyedNodes ("mDestroyedNodes"), + mDestroyedEdges ("mDestroyedEdges"), + mFirstPartitionEdges ("mFirstPartitionEdges"), + mDestroyedPartitionEdges ("IslandSim::mDestroyedPartitionEdges"), + mIslandManager (&mFirstPartitionEdges, mEdgeNodeIndices, &mDestroyedPartitionEdges, contextID), + mSpeculativeIslandManager (NULL, mEdgeNodeIndices, NULL, contextID), + mSpeculativeThirdPassTask (contextID, *this, mSpeculativeIslandManager), + mAccurateThirdPassTask (contextID, *this, mIslandManager), + mPostThirdPassTask (contextID, *this), + mContextID (contextID) +{ + mFirstPartitionEdges.resize(1024); + mMaxDirtyNodesPerFrame = useEnhancedDeterminism ? 0xFFFFFFFF : 1000u; +} + +SimpleIslandManager::~SimpleIslandManager() +{ +} + +PxNodeIndex SimpleIslandManager::addRigidBody(PxsRigidBody* body, bool isKinematic, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addRigidBody(body, isKinematic, isActive, nodeIndex); + mSpeculativeIslandManager.addRigidBody(body, isKinematic, isActive, nodeIndex); + return nodeIndex; +} + +void SimpleIslandManager::removeNode(const PxNodeIndex index) +{ + PX_ASSERT(mNodeHandles.isValidHandle(index.index())); + mDestroyedNodes.pushBack(index); +} + +PxNodeIndex SimpleIslandManager::addArticulation(Sc::ArticulationSim* articulation, Dy::FeatherstoneArticulation* llArtic, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addArticulation(articulation, llArtic, isActive, nodeIndex); + mSpeculativeIslandManager.addArticulation(articulation, llArtic, isActive, nodeIndex); + return nodeIndex; +} + +#if PX_SUPPORT_GPU_PHYSX +PxNodeIndex SimpleIslandManager::addSoftBody(Dy::SoftBody* llSoftBody, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addSoftBody(llSoftBody, isActive, nodeIndex); + mSpeculativeIslandManager.addSoftBody(llSoftBody, isActive, nodeIndex); + return nodeIndex; +} + +PxNodeIndex SimpleIslandManager::addFEMCloth(Dy::FEMCloth* llFEMCloth, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addFEMCloth(llFEMCloth, isActive, nodeIndex); + mSpeculativeIslandManager.addFEMCloth(llFEMCloth, isActive, nodeIndex); + return nodeIndex; +} + +PxNodeIndex SimpleIslandManager::addParticleSystem(Dy::ParticleSystem* llParticleSystem, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addParticleSystem(llParticleSystem, isActive, nodeIndex); + mSpeculativeIslandManager.addParticleSystem(llParticleSystem, isActive, nodeIndex); + return nodeIndex; +} + +PxNodeIndex SimpleIslandManager::addHairSystem(Dy::HairSystem* llHairSystem, bool isActive) +{ + PxU32 handle = mNodeHandles.getHandle(); + PxNodeIndex nodeIndex(handle); + mIslandManager.addHairSystem(llHairSystem, isActive, nodeIndex); + mSpeculativeIslandManager.addHairSystem(llHairSystem, isActive, nodeIndex); + return nodeIndex; +} +#endif //PX_SUPPORT_GPU_PHYSX + +EdgeIndex SimpleIslandManager::addContactManager(PxsContactManager* manager, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Sc::Interaction* interaction, + Edge::EdgeType edgeType) +{ + EdgeIndex handle = mEdgeHandles.getHandle(); + + PxU32 nodeIds = 2 * handle; + if (mEdgeNodeIndices.size() == nodeIds) + { + PX_PROFILE_ZONE("ReserveEdges", getContextId()); + const PxU32 newSize = nodeIds + 2048; + mEdgeNodeIndices.resize(newSize); + mConstraintOrCm.resize(newSize); + mInteractions.resize(newSize); + } + + mEdgeNodeIndices[nodeIds] = nodeHandle1; + mEdgeNodeIndices[nodeIds+1] = nodeHandle2; + mConstraintOrCm[handle] = manager; + mInteractions[handle] = interaction; + + mSpeculativeIslandManager.addConnection(nodeHandle1, nodeHandle2, edgeType, handle); + + if (manager) + manager->getWorkUnit().mEdgeIndex = handle; + + if (mConnectedMap.size() == handle) + { + mConnectedMap.resize(2 * (handle + 1)); + } + if (mFirstPartitionEdges.capacity() == handle) + { + mFirstPartitionEdges.resize(2 * (handle + 1)); + } + + mConnectedMap.reset(handle); + return handle; +} + +EdgeIndex SimpleIslandManager::addConstraint(Dy::Constraint* constraint, PxNodeIndex nodeHandle1, PxNodeIndex nodeHandle2, Sc::Interaction* interaction) +{ + EdgeIndex handle = mEdgeHandles.getHandle(); + + PxU32 nodeIds = 2 * handle; + if (mEdgeNodeIndices.size() == nodeIds) + { + const PxU32 newSize = nodeIds + 2048; + mEdgeNodeIndices.resize(newSize); + mConstraintOrCm.resize(newSize); + mInteractions.resize(newSize); + } + + mEdgeNodeIndices[nodeIds] = nodeHandle1; + mEdgeNodeIndices[nodeIds + 1] = nodeHandle2; + + mConstraintOrCm[handle] = constraint; + + mInteractions[handle] = interaction; + + mIslandManager.addConstraint(constraint, nodeHandle1, nodeHandle2, handle); + mSpeculativeIslandManager.addConstraint(constraint, nodeHandle1, nodeHandle2, handle); + if(mConnectedMap.size() == handle) + { + mConnectedMap.resize(2*(mConnectedMap.size()+1)); + } + + if (mFirstPartitionEdges.capacity() == handle) + { + mFirstPartitionEdges.resize(2 * (mFirstPartitionEdges.capacity() + 1)); + } + mConnectedMap.set(handle); + return handle; +} + +void SimpleIslandManager::activateNode(PxNodeIndex index) +{ + mIslandManager.activateNode(index); + mSpeculativeIslandManager.activateNode(index); +} + +void SimpleIslandManager::deactivateNode(PxNodeIndex index) +{ + mIslandManager.deactivateNode(index); + mSpeculativeIslandManager.deactivateNode(index); +} + +void SimpleIslandManager::putNodeToSleep(PxNodeIndex index) +{ + mIslandManager.putNodeToSleep(index); + mSpeculativeIslandManager.putNodeToSleep(index); +} + +void SimpleIslandManager::removeConnection(EdgeIndex edgeIndex) +{ + if(edgeIndex == IG_INVALID_EDGE) + return; + mDestroyedEdges.pushBack(edgeIndex); + mSpeculativeIslandManager.removeConnection(edgeIndex); + if(mConnectedMap.test(edgeIndex)) + { + mIslandManager.removeConnection(edgeIndex); + mConnectedMap.reset(edgeIndex); + } + + mConstraintOrCm[edgeIndex] = NULL; + mInteractions[edgeIndex] = NULL; +} + +void SimpleIslandManager::firstPassIslandGen() +{ + PX_PROFILE_ZONE("Basic.firstPassIslandGen", getContextId()); + mSpeculativeIslandManager.clearDeactivations(); + mSpeculativeIslandManager.wakeIslands(); + mSpeculativeIslandManager.processNewEdges(); + mSpeculativeIslandManager.removeDestroyedEdges(); + mSpeculativeIslandManager.processLostEdges(mDestroyedNodes, false, false, mMaxDirtyNodesPerFrame); +} + +void SimpleIslandManager::additionalSpeculativeActivation() +{ + mSpeculativeIslandManager.wakeIslands2(); +} + +void SimpleIslandManager::secondPassIslandGen() +{ + PX_PROFILE_ZONE("Basic.secondPassIslandGen", getContextId()); + + mIslandManager.wakeIslands(); + mIslandManager.processNewEdges(); + + mIslandManager.removeDestroyedEdges(); + mIslandManager.processLostEdges(mDestroyedNodes, false, false, mMaxDirtyNodesPerFrame); + + for(PxU32 a = 0; a < mDestroyedNodes.size(); ++a) + { + mNodeHandles.freeHandle(mDestroyedNodes[a].index()); + } + mDestroyedNodes.clear(); + //mDestroyedEdges.clear(); +} + +bool SimpleIslandManager::validateDeactivations() const +{ + //This method sanity checks the deactivations produced by third-pass island gen. Specifically, it ensures that any bodies that + //the speculative IG wants to deactivate are also candidates for deactivation in the accurate island gen. In practice, both should be the case. If this fails, something went wrong... + + const PxNodeIndex* const nodeIndices = mSpeculativeIslandManager.getNodesToDeactivate(Node::eRIGID_BODY_TYPE); + const PxU32 nbNodesToDeactivate = mSpeculativeIslandManager.getNbNodesToDeactivate(Node::eRIGID_BODY_TYPE); + + for(PxU32 i = 0; i < nbNodesToDeactivate; ++i) + { + //Node is active in accurate sim => mismatch between accurate and inaccurate sim! + const Node& node = mIslandManager.getNode(nodeIndices[i]); + const Node& speculativeNode = mSpeculativeIslandManager.getNode(nodeIndices[i]); + //KS - we need to verify that the bodies in the "deactivating" list are still candidates for deactivation. There are cases where they may not no longer be candidates, e.g. if the application + //put bodies to sleep and activated them + if(node.isActive() && !speculativeNode.isActive()) + return false; + } + return true; +} + +void ThirdPassTask::runInternal() +{ + PX_PROFILE_ZONE("Basic.thirdPassIslandGen", mIslandSim.getContextId()); + mIslandSim.removeDestroyedEdges(); + mIslandSim.processLostEdges(mIslandManager.mDestroyedNodes, true, true, mIslandManager.mMaxDirtyNodesPerFrame); +} + +void PostThirdPassTask::runInternal() +{ + for (PxU32 a = 0; a < mIslandManager.mDestroyedNodes.size(); ++a) + { + mIslandManager.mNodeHandles.freeHandle(mIslandManager.mDestroyedNodes[a].index()); + } + mIslandManager.mDestroyedNodes.clear(); + + for (PxU32 a = 0; a < mIslandManager.mDestroyedEdges.size(); ++a) + { + mIslandManager.mEdgeHandles.freeHandle(mIslandManager.mDestroyedEdges[a]); + } + mIslandManager.mDestroyedEdges.clear(); + + PX_ASSERT(mIslandManager.validateDeactivations()); +} + +void SimpleIslandManager::thirdPassIslandGen(PxBaseTask* continuation) +{ + + mIslandManager.clearDeactivations(); + + mPostThirdPassTask.setContinuation(continuation); + + mSpeculativeThirdPassTask.setContinuation(&mPostThirdPassTask); + mAccurateThirdPassTask.setContinuation(&mPostThirdPassTask); + + mSpeculativeThirdPassTask.removeReference(); + mAccurateThirdPassTask.removeReference(); + + mPostThirdPassTask.removeReference(); + + //PX_PROFILE_ZONE("Basic.thirdPassIslandGen", getContextId()); + //mSpeculativeIslandManager.removeDestroyedEdges(); + //mSpeculativeIslandManager.processLostEdges(mDestroyedNodes, true, true); + + //mIslandManager.removeDestroyedEdges(); + //mIslandManager.processLostEdges(mDestroyedNodes, true, true); + + +} + +bool SimpleIslandManager::checkInternalConsistency() +{ + return mIslandManager.checkInternalConsistency() && mSpeculativeIslandManager.checkInternalConsistency(); +} + +void SimpleIslandManager::setEdgeConnected(EdgeIndex edgeIndex, Edge::EdgeType edgeType) +{ + if(!mConnectedMap.test(edgeIndex)) + { + mIslandManager.addConnection(mEdgeNodeIndices[edgeIndex * 2], mEdgeNodeIndices[edgeIndex * 2 + 1], edgeType, edgeIndex); + mConnectedMap.set(edgeIndex); + } +} + +bool SimpleIslandManager::getIsEdgeConnected(EdgeIndex edgeIndex) +{ + return !!mConnectedMap.test(edgeIndex); +} + +void SimpleIslandManager::deactivateEdge(const EdgeIndex edgeIndex) +{ + if (mFirstPartitionEdges[edgeIndex]) + { + mDestroyedPartitionEdges.pushBack(mFirstPartitionEdges[edgeIndex]); + mFirstPartitionEdges[edgeIndex] = NULL; + } +} + +void SimpleIslandManager::setEdgeDisconnected(EdgeIndex edgeIndex) +{ + if(mConnectedMap.test(edgeIndex)) + { + //PX_ASSERT(!mIslandManager.getEdge(edgeIndex).isInDirtyList()); + mIslandManager.removeConnection(edgeIndex); + mConnectedMap.reset(edgeIndex); + } +} + +void SimpleIslandManager::setEdgeRigidCM(const EdgeIndex edgeIndex, PxsContactManager* cm) +{ + mConstraintOrCm[edgeIndex] = cm; + cm->getWorkUnit().mEdgeIndex = edgeIndex; +} + +void SimpleIslandManager::clearEdgeRigidCM(const EdgeIndex edgeIndex) +{ + mConstraintOrCm[edgeIndex] = NULL; + if (mFirstPartitionEdges[edgeIndex]) + { + //this is the partition edges created/updated by the gpu solver + mDestroyedPartitionEdges.pushBack(mFirstPartitionEdges[edgeIndex]); + mFirstPartitionEdges[edgeIndex] = NULL; + } +} + +void SimpleIslandManager::setKinematic(PxNodeIndex nodeIndex) +{ + mIslandManager.setKinematic(nodeIndex); + mSpeculativeIslandManager.setKinematic(nodeIndex); +} + +void SimpleIslandManager::setDynamic(PxNodeIndex nodeIndex) +{ + mIslandManager.setDynamic(nodeIndex); + mSpeculativeIslandManager.setDynamic(nodeIndex); +} + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManager.h new file mode 100644 index 0000000..18e4a1a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManager.h @@ -0,0 +1,209 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_AABBMANAGER_H +#define BP_AABBMANAGER_H + +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "BpAABBManagerTasks.h" +#include "BpAABBManagerBase.h" + +namespace physx +{ +namespace Cm +{ + class FlushPool; +} + +namespace Bp +{ + struct BroadPhasePair; + + // PT: TODO: revisit this..... + class Aggregate; + class PersistentPairs; + class PersistentActorAggregatePair; + class PersistentAggregateAggregatePair; + class PersistentSelfCollisionPairs; + + struct AggPair + { + PX_FORCE_INLINE AggPair() {} + PX_FORCE_INLINE AggPair(ShapeHandle index0, ShapeHandle index1) : mIndex0(index0), mIndex1(index1) {} + ShapeHandle mIndex0; + ShapeHandle mIndex1; + + PX_FORCE_INLINE bool operator==(const AggPair& p) const + { + return (p.mIndex0 == mIndex0) && (p.mIndex1 == mIndex1); + } + }; + typedef PxCoalescedHashMap AggPairMap; + + // PT: TODO: isn't there a generic pair structure somewhere? refactor with AggPair anyway + struct Pair + { + PX_FORCE_INLINE Pair(PxU32 id0, PxU32 id1) : mID0(id0), mID1(id1) {} + PX_FORCE_INLINE Pair(){} + + PX_FORCE_INLINE bool operator<(const Pair& p) const + { + const PxU64 value0 = *reinterpret_cast(this); + const PxU64 value1 = *reinterpret_cast(&p); + return value0 < value1; + } + + PX_FORCE_INLINE bool operator==(const Pair& p) const + { + return (p.mID0 == mID0) && (p.mID1 == mID1); + } + + PX_FORCE_INLINE bool operator!=(const Pair& p) const + { + return (p.mID0 != mID0) || (p.mID1 != mID1); + } + + PxU32 mID0; + PxU32 mID1; + }; + + class AABBManager; + + class PostBroadPhaseStage2Task : public Cm::Task + { + Cm::FlushPool* mFlushPool; + AABBManager& mManager; + + PX_NOCOPY(PostBroadPhaseStage2Task) + public: + + PostBroadPhaseStage2Task(PxU64 contextID, AABBManager& manager) : Cm::Task(contextID), mFlushPool(NULL), mManager(manager) + { + } + + virtual const char* getName() const { return "PostBroadPhaseStage2Task"; } + + void setFlushPool(Cm::FlushPool* pool) { mFlushPool = pool; } + + virtual void runInternal(); + }; + + class ProcessAggPairsBase; + + /** + \brief A structure responsible for: + * storing an aabb representation for each active shape in the related scene + * managing the creation/removal of aabb representations when their related shapes are created/removed + * updating all aabbs that require an update due to modification of shape geometry or transform + * updating the aabb of all aggregates from the union of the aabbs of all shapes that make up each aggregate + * computing and reporting the incremental changes to the set of overlapping aabb pairs + */ + class AABBManager : public AABBManagerBase + { + PX_NOCOPY(AABBManager) + public: + AABBManager(BroadPhase& bp, BoundsArray& boundsArray, PxFloatArrayPinned& contactDistance, + PxU32 maxNbAggregates, PxU32 maxNbShapes, PxVirtualAllocator& allocator, PxU64 contextID, + PxPairFilteringMode::Enum kineKineFilteringMode, PxPairFilteringMode::Enum staticKineFilteringMode); + + virtual ~AABBManager() {} + + // AABBManagerBase + virtual void destroy() PX_OVERRIDE; + virtual AggregateHandle createAggregate(BoundsIndex index, Bp::FilterGroup::Enum group, void* userData, PxU32 maxNumShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE; + virtual bool destroyAggregate(BoundsIndex& index, Bp::FilterGroup::Enum& group, AggregateHandle aggregateHandle) PX_OVERRIDE; + virtual bool addBounds(BoundsIndex index, PxReal contactDistance, Bp::FilterGroup::Enum group, void* userdata, AggregateHandle aggregateHandle, ElementType::Enum volumeType) PX_OVERRIDE; + virtual bool removeBounds(BoundsIndex index) PX_OVERRIDE; + virtual void updateBPFirstPass(PxU32 numCpuTasks, Cm::FlushPool& flushPool, bool hasContactDistanceUpdated, PxBaseTask* continuation) PX_OVERRIDE; + virtual void updateBPSecondPass(PxU32 numCpuTasks, PxcScratchAllocator* scratchAllocator, PxBaseTask* continuation) PX_OVERRIDE; + virtual void postBroadPhase(PxBaseTask*, Cm::FlushPool& flushPool) PX_OVERRIDE; + virtual void reallocateChangedAABBMgActorHandleMap(const PxU32 size) PX_OVERRIDE; + virtual void visualize(PxRenderOutput& out) PX_OVERRIDE; + virtual void releaseDeferredAggregateIds() PX_OVERRIDE{} + //~AABBManagerBase + + void preBpUpdate_CPU(PxU32 numCpuTasks); + + // PT: TODO: what is that BpCacheData for? + BpCacheData* getBpCacheData(); + void putBpCacheData(BpCacheData*); + void resetBpCacheData(); + + PxMutex mMapLock; + private: + //void reserveShapeSpace(PxU32 nbShapes); + + void postBpStage2(PxBaseTask*, Cm::FlushPool&); + void postBpStage3(PxBaseTask*); + + PostBroadPhaseStage2Task mPostBroadPhase2; + Cm::DelegateTask mPostBroadPhase3; + + PreBpUpdateTask mPreBpUpdateTask; + + PxU32 mTimestamp; + PxU32 mFirstFreeAggregate; + PxArray mAggregates; // PT: indexed by AggregateHandle + PxArray mDirtyAggregates; + + AggPairMap mActorAggregatePairs; + AggPairMap mAggregateAggregatePairs; + + PxArray mAggPairTasks; + + PxHashSet mCreatedPairs; + + PxSList mBpThreadContextPool; + + PX_FORCE_INLINE Aggregate* getAggregateFromHandle(AggregateHandle handle) + { + PX_ASSERT(handle mCreatedPairs[2]; + PxArray mDeletedPairs[2]; + + void reset() + { + mCreatedPairs[0].resizeUninitialized(0); + mCreatedPairs[1].resizeUninitialized(0); + mDeletedPairs[0].resizeUninitialized(0); + mDeletedPairs[1].resizeUninitialized(0); + } + }; + + typedef PxPinnedArray GroupsArrayPinned; + typedef PxPinnedArray VolumeDataArrayPinned; + typedef PxPinnedArray ShapeHandleArrayPinned; + + class BoundsArray : public PxUserAllocated + { + PX_NOCOPY(BoundsArray) + public: + BoundsArray(PxVirtualAllocator& allocator) : mBounds(allocator) {} + + PX_FORCE_INLINE void initEntry(PxU32 index) + { + index++; // PT: always pretend we need one more entry, to make sure reading the last used entry will be SIMD-safe. + const PxU32 oldCapacity = mBounds.capacity(); + if (index >= oldCapacity) + { + const PxU32 newCapacity = PxNextPowerOfTwo(index); + mBounds.reserve(newCapacity); + mBounds.forceSize_Unsafe(newCapacity); + } + } + + PX_FORCE_INLINE void updateBounds(const PxTransform& transform, const PxGeometry& geom, PxU32 index) + { + Gu::computeBounds(mBounds[index], geom, transform, 0.0f, 1.0f); + mHasAnythingChanged = true; + } + + PX_FORCE_INLINE void setBounds(const PxBounds3& bounds, PxU32 index) + { + // PX_CHECK_AND_RETURN(bounds.isValid() && !bounds.isEmpty(), "BoundsArray::setBounds - illegal bounds\n"); + mBounds[index] = bounds; + mHasAnythingChanged = true; + } + + PX_FORCE_INLINE const PxBounds3* begin() const { return mBounds.begin(); } + PX_FORCE_INLINE PxBounds3* begin() { return mBounds.begin(); } + PX_FORCE_INLINE PxBoundsArrayPinned& getBounds() { return mBounds; } + PX_FORCE_INLINE const PxBounds3& getBounds(PxU32 index) const { return mBounds[index]; } + PX_FORCE_INLINE PxU32 getCapacity() const { return mBounds.size(); } + PX_FORCE_INLINE bool hasChanged() const { return mHasAnythingChanged; } + PX_FORCE_INLINE void resetChangedState() { mHasAnythingChanged = false; } + PX_FORCE_INLINE void setChangedState() { mHasAnythingChanged = true; } + + void shiftOrigin(const PxVec3& shift) + { + // we shift some potential NaNs here because we don't know what's active, but should be harmless + const PxU32 nbBounds = mBounds.size(); + for(PxU32 i=0; i= mVolumeData.size()) + reserveShapeSpace(index + 1); + + // PT: TODO: why is this needed at all? Why aren't size() and capacity() enough? + mUsedSize = PxMax(index + 1, mUsedSize); + + PX_ASSERT(group != Bp::FilterGroup::eINVALID); // PT: we use group == Bp::FilterGroup::eINVALID to mark removed/invalid entries + mGroups[index] = group; + mContactDistance.begin()[index] = contactDistance; + mVolumeData[index].setUserData(userData); + } + + PX_FORCE_INLINE void resetEntry(BoundsIndex index) + { + mGroups[index] = Bp::FilterGroup::eINVALID; + mContactDistance.begin()[index] = 0.0f; + mVolumeData[index].reset(); + } + + // PT: TODO: remove confusion between BoundsIndex and ShapeHandle here! + ShapeHandleArrayPinned mAddedHandles; + ShapeHandleArrayPinned mUpdatedHandles; // PT: TODO: only on CPU + ShapeHandleArrayPinned mRemovedHandles; + + BroadPhase& mBroadPhase; + BoundsArray& mBoundsArray; + + PxArray mOutOfBoundsObjects; // PT: TODO: only on CPU + PxArray mOutOfBoundsAggregates; // PT: TODO: only on CPU + PxArray mCreatedOverlaps[ElementType::eCOUNT]; + PxArray mDestroyedOverlaps[ElementType::eCOUNT]; + + PxU32 mUsedSize; // highest used value + 1 + PxU32 mNbAggregates; + +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + // PT: TODO: even in the 3.4 trunk this stuff is a clumsy mess: groups are "BpHandle" suddenly passed + // to BroadPhaseUpdateData as "ShapeHandle". + //Free aggregate group ids. + PxU32 mAggregateGroupTide; + PxArray mFreeAggregateGroups; // PT: TODO: remove this useless array +#endif + PxU64 mContextID; + bool mOriginShifted; + +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + PX_FORCE_INLINE void releaseAggregateGroup(const Bp::FilterGroup::Enum group) + { + PX_ASSERT(group != Bp::FilterGroup::eINVALID); + mFreeAggregateGroups.pushBack(group); + } + + PX_FORCE_INLINE Bp::FilterGroup::Enum getAggregateGroup() + { + PxU32 id; + if (mFreeAggregateGroups.size()) + id = mFreeAggregateGroups.popBack(); + else + { + id = mAggregateGroupTide--; + id <<= BP_FILTERING_TYPE_SHIFT_BIT; + id |= FilterType::AGGREGATE; + } + const Bp::FilterGroup::Enum group = Bp::FilterGroup::Enum(id); + PX_ASSERT(group != Bp::FilterGroup::eINVALID); + return group; + } +#endif + }; + +} //namespace Bp +} //namespace physx + +#endif //BP_AABBMANAGER_BASE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManagerTasks.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManagerTasks.h new file mode 100644 index 0000000..9f6888d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpAABBManagerTasks.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_AABB_MANAGER_TASKS_H +#define BP_AABB_MANAGER_TASKS_H + +#include "foundation/PxUserAllocated.h" +#include "CmTask.h" + +namespace physx +{ + class PxcScratchAllocator; +namespace Bp +{ + class AABBManager; + class Aggregate; + + class AggregateBoundsComputationTask : public Cm::Task, public PxUserAllocated + { + public: + AggregateBoundsComputationTask(PxU64 contextId) : + Cm::Task (contextId), + mManager (NULL), + mStart (0), + mNbToGo (0), + mAggregates (NULL) + {} + ~AggregateBoundsComputationTask() {} + + virtual const char* getName() const { return "AggregateBoundsComputationTask"; } + virtual void runInternal(); + + void Init(AABBManager* manager, PxU32 start, PxU32 nb, Aggregate** aggregates) + { + mManager = manager; + mStart = start; + mNbToGo = nb; + mAggregates = aggregates; + } + private: + AABBManager* mManager; + PxU32 mStart; + PxU32 mNbToGo; + Aggregate** mAggregates; + + AggregateBoundsComputationTask& operator=(const AggregateBoundsComputationTask&); + }; + + class PreBpUpdateTask : public Cm::Task, public PxUserAllocated + { + public: + PreBpUpdateTask(PxU64 contextId) : + Cm::Task(contextId), + mManager(NULL), + mNumCpuTasks(0) + {} + ~PreBpUpdateTask() {} + + virtual const char* getName() const { return "PreBpUpdateTask"; } + virtual void runInternal(); + + void Init(AABBManager* manager, PxU32 numCpuTasks) + { + mManager = manager; + mNumCpuTasks = numCpuTasks; + } + private: + AABBManager * mManager; + PxU32 mNumCpuTasks; + + PreBpUpdateTask& operator=(const PreBpUpdateTask&); + }; + +} +} //namespace physx + +#endif // BP_AABB_MANAGER_TASKS_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhase.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhase.h new file mode 100644 index 0000000..35478aa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhase.h @@ -0,0 +1,214 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_H +#define BP_BROADPHASE_H + +#include "foundation/PxUserAllocated.h" +#include "PxBroadPhase.h" +#include "BpBroadPhaseUpdate.h" + +namespace physx +{ + class PxcScratchAllocator; + class PxBaseTask; + +namespace Bp +{ + +class BroadPhaseUpdateData; + +/** +\brief Base broad phase class. Functions only relevant to MBP. +*/ +class BroadPhaseBase : public PxBroadPhaseRegions, public PxUserAllocated +{ + public: + BroadPhaseBase() {} + virtual ~BroadPhaseBase() {} + + /** + \brief Gets broad-phase caps. + + \param caps [out] Broad-phase caps + */ + virtual void getCaps(PxBroadPhaseCaps& caps) const + { + caps.mMaxNbRegions = 0; + } + + // PxBroadPhaseRegions + virtual PxU32 getNbRegions() const PX_OVERRIDE { return 0; } + virtual PxU32 getRegions(PxBroadPhaseRegionInfo*, PxU32, PxU32) const PX_OVERRIDE { return 0; } + virtual PxU32 addRegion(const PxBroadPhaseRegion&, bool, const PxBounds3*, const PxReal*) PX_OVERRIDE { return 0xffffffff;} + virtual bool removeRegion(PxU32) PX_OVERRIDE { return false; } + virtual PxU32 getNbOutOfBoundsObjects() const PX_OVERRIDE { return 0; } + virtual const PxU32* getOutOfBoundsObjects() const PX_OVERRIDE { return NULL; } + //~PxBroadPhaseRegions +}; + +/* +\brief Structure used to report created and deleted broadphase pairs +\note The indices mVolA and mVolB correspond to the bounds indices +BroadPhaseUpdateData::mCreated used by BroadPhase::update +@see BroadPhase::getCreatedPairs, BroadPhase::getDeletedPairs +*/ +struct BroadPhasePair +{ + BroadPhasePair(ShapeHandle volA, ShapeHandle volB) : + mVolA (PxMin(volA, volB)), + mVolB (PxMax(volA, volB)) + { + } + BroadPhasePair() : + mVolA (BP_INVALID_BP_HANDLE), + mVolB (BP_INVALID_BP_HANDLE) + { + } + + ShapeHandle mVolA; // NB: mVolA < mVolB + ShapeHandle mVolB; +}; + +class BroadPhase : public BroadPhaseBase +{ +public: + + /** + \brief Instantiate a BroadPhase instance. + \param[in] bpType - the bp type (either mbp or sap). This is typically specified in PxSceneDesc. + \param[in] maxNbRegions is the expected maximum number of broad-phase regions. + \param[in] maxNbBroadPhaseOverlaps is the expected maximum number of broad-phase overlaps. + \param[in] maxNbStaticShapes is the expected maximum number of static shapes. + \param[in] maxNbDynamicShapes is the expected maximum number of dynamic shapes. + \param[in] contextID is the context ID parameter sent to the profiler + \return The instantiated BroadPhase. + \note maxNbRegions is only used if mbp is the chosen broadphase (PxBroadPhaseType::eMBP) + \note maxNbRegions, maxNbBroadPhaseOverlaps, maxNbStaticShapes and maxNbDynamicShapes are typically specified in PxSceneLimits + */ + static BroadPhase* create( + const PxBroadPhaseType::Enum bpType, + const PxU32 maxNbRegions, + const PxU32 maxNbBroadPhaseOverlaps, + const PxU32 maxNbStaticShapes, + const PxU32 maxNbDynamicShapes, + PxU64 contextID); + + virtual PxBroadPhaseType::Enum getType() const = 0; + + /** + \brief Shutdown of the broadphase. + */ + virtual void release() = 0; + + /** + \brief Updates the broadphase and computes the lists of created/deleted pairs. + + \param[in] scratchAllocator - a PxcScratchAllocator instance used for temporary memory allocations. + This must be non-null. + + \param[in] updateData a description of changes to the collection of aabbs since the last broadphase update. + The changes detail the indices of the bounds that have been added/updated/removed as well as an array of all + bound coordinates and an array of group ids used to filter pairs with the same id. + @see BroadPhaseUpdateData + + \param[in] continuation the task that is in the queue to be executed immediately after the broadphase has completed its update. NULL is not supported. + + \note In PX_CHECKED and PX_DEBUG build configurations illegal input data (that does not conform to the BroadPhaseUpdateData specifications) triggers + a special code-path that entirely bypasses the broadphase and issues a warning message to the error stream. No guarantees can be made about the + correctness/consistency of broadphase behavior with illegal input data in PX_RELEASE and PX_PROFILE configs because validity checks are not active + in these builds. + */ + virtual void update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, physx::PxBaseTask* continuation) = 0; + + /** + \brief prepare broad phase data. + */ + virtual void preBroadPhase(const Bp::BroadPhaseUpdateData& updateData) = 0; + + /** + \brief Fetch the results of any asynchronous broad phase work. + */ + virtual void fetchBroadPhaseResults() = 0; + + /* + \brief Get created pairs. + + Note that each overlap pair is reported only on the frame when the overlap first occurs. The overlap persists + until the pair appears in the list of deleted pairs or either of the bounds in the pair is removed from the broadphase. + A created overlap must involve at least one of the bounds of the overlap pair appearing in either the created or updated list. + It is impossible for the same pair to appear simultaneously in the list of created and deleted overlap pairs. + An overlap is defined as a pair of bounds that overlap on all three axes; that is when maxA > minB and maxB > minA for all three axes. + + \param nbCreatedPairs [out] The number of created aabb overlap pairs computed in the execution of update() that has just completed. + \return The array of created aabb overlap pairs computed in the execution of update() that has just completed. + */ + virtual const BroadPhasePair* getCreatedPairs(PxU32& nbCreatedPairs) const = 0; + + /** + \brief Get deleted pairs. + + Note that a deleted pair can only be reported if that pair has already appeared in the list of created pairs in an earlier update. + A lost overlap occurs when a pair of bounds previously overlapped on all three axes but have now separated on at least one axis. + A lost overlap must involve at least one of the bounds of the lost overlap pair appearing in the updated list. + Lost overlaps arising from removal of bounds from the broadphase do not appear in the list of deleted pairs. + It is impossible for the same pair to appear simultaneously in the list of created and deleted pairs. + + \param nbDeletedPairs [out] The number of deleted overlap pairs computed in the execution of update() that has just completed. + \return The array of deleted overlap pairs computed in the execution of update() that has just completed. + */ + virtual const BroadPhasePair* getDeletedPairs(PxU32& nbDeletedPairs) const = 0; + + /** + \brief After the broadphase has completed its update() function and the created/deleted pairs have been queried + with getCreatedPairs/getDeletedPairs it is desirable to free any memory that was temporarily acquired for the update but is + is no longer required post-update. This can be achieved with the function freeBuffers(). + */ + virtual void freeBuffers() = 0; + + /** + \brief Adjust internal structures after all bounds have been adjusted due to a scene origin shift. + */ + virtual void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances) = 0; + +#if PX_CHECKED + /** + \brief Test that the created/updated/removed lists obey the rules that + 1. object ids can only feature in the created list if they have never been previously added or if they were previously removed. + 2. object ids can only be added to the updated list if they have been previously added without being removed. + 3. objects ids can only be added to the removed list if they have been previously added without being removed. + */ + virtual bool isValid(const BroadPhaseUpdateData& updateData) const = 0; +#endif +}; + +} //namespace Bp + +} //namespace physx + +#endif //BP_BROADPHASE_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhaseUpdate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhaseUpdate.h new file mode 100644 index 0000000..9406e68 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpBroadPhaseUpdate.h @@ -0,0 +1,184 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_UPDATE_H +#define BP_BROADPHASE_UPDATE_H + +#include "BpFiltering.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxUnionCast.h" + +namespace physx +{ +namespace Bp +{ +typedef PxU32 ShapeHandle; +typedef PxU32 BpHandle; +#define BP_INVALID_BP_HANDLE 0x3fffffff + +class BroadPhase; + +class BroadPhaseUpdateData +{ +public: + + /** + \brief A structure detailing the changes to the collection of aabbs, whose overlaps are computed in the broadphase. + The structure consists of per-object arrays of object bounds and object groups, and three arrays that index + into the per-object arrays, denoting the bounds which are to be created, updated and removed in the broad phase. + + * each entry in the object arrays represents the same shape or aggregate from frame to frame. + * each entry in an index array must be less than the capacity of the per-object arrays. + * no index value may appear in more than one index array, and may not occur more than once in that array. + + An index value is said to be "in use" if it has appeared in a created list in a previous update, and has not + since occurred in a removed list. + + \param[in] created an array of indices describing the bounds that must be inserted into the broadphase. + Each index in the array must not be in use. + + \param[in] updated an array of indices (referencing the boxBounds and boxGroups arrays) describing the bounds + that have moved since the last broadphase update. Each index in the array must be in use, and each object + whose index is in use and whose AABB has changed must appear in the update list. + + \param[in] removed an array of indices describing the bounds that must be removed from the broad phase. Each index in + the array must be in use. + + \param[in] boxBounds an array of bounds coordinates for the AABBs to be processed by the broadphase. + + An entry is valid if its values are integer bitwise representations of floating point numbers that satisfy max>min in each dimension, + along with a further rule that minima(maxima) must have even(odd) values. + + Each entry whose index is either in use or appears in the created array must be valid. An entry whose index is either not in use or + appears in the removed array need not be valid. + + \param[in] boxGroups an array of group ids, one for each bound, used for pair filtering. Bounds with the same group id will not be + reported as overlap pairs by the broad phase. Zero is reserved for static bounds. + + Entries in this array are immutable: the only way to change the group of an object is to remove it from the broad phase and reinsert + it at a different index (recall that each index must appear at most once in the created/updated/removed lists). + + \param[in] boxesCapacity the length of the boxBounds and boxGroups arrays. + + @see BroadPhase::update + */ + BroadPhaseUpdateData( + const ShapeHandle* created, PxU32 createdSize, + const ShapeHandle* updated, PxU32 updatedSize, + const ShapeHandle* removed, PxU32 removedSize, + const PxBounds3* boxBounds, const Bp::FilterGroup::Enum* boxGroups, const PxReal* boxContactDistances, PxU32 boxesCapacity, + const BpFilter& filter, + bool stateChanged, + bool gpuStateChanged + ) : + mCreated (created), + mCreatedSize (createdSize), + mUpdated (updated), + mUpdatedSize (updatedSize), + mRemoved (removed), + mRemovedSize (removedSize), + mBoxBounds (boxBounds), + mBoxGroups (boxGroups), + mBoxDistances (boxContactDistances), + mBoxesCapacity (boxesCapacity), + mFilter (filter), + mStateChanged (stateChanged), + mGpuStateChanged(gpuStateChanged) + { + } + + BroadPhaseUpdateData(const BroadPhaseUpdateData& other) : + mCreated (other.mCreated), + mCreatedSize (other.mCreatedSize), + mUpdated (other.mUpdated), + mUpdatedSize (other.mUpdatedSize), + mRemoved (other.mRemoved), + mRemovedSize (other.mRemovedSize), + mBoxBounds (other.mBoxBounds), + mBoxGroups (other.mBoxGroups), + mBoxDistances (other.mBoxDistances), + mBoxesCapacity (other.mBoxesCapacity), + mFilter (other.mFilter), + mStateChanged (other.mStateChanged), + mGpuStateChanged(other.mGpuStateChanged) + { + } + + BroadPhaseUpdateData& operator=(const BroadPhaseUpdateData& other); + + PX_FORCE_INLINE const ShapeHandle* getCreatedHandles() const { return mCreated; } + PX_FORCE_INLINE PxU32 getNumCreatedHandles() const { return mCreatedSize; } + + PX_FORCE_INLINE const ShapeHandle* getUpdatedHandles() const { return mUpdated; } + PX_FORCE_INLINE PxU32 getNumUpdatedHandles() const { return mUpdatedSize; } + + PX_FORCE_INLINE const ShapeHandle* getRemovedHandles() const { return mRemoved; } + PX_FORCE_INLINE PxU32 getNumRemovedHandles() const { return mRemovedSize; } + + PX_FORCE_INLINE const PxBounds3* getAABBs() const { return mBoxBounds; } + PX_FORCE_INLINE const Bp::FilterGroup::Enum* getGroups() const { return mBoxGroups; } + PX_FORCE_INLINE const PxReal* getContactDistance() const { return mBoxDistances; } + PX_FORCE_INLINE PxU32 getCapacity() const { return mBoxesCapacity; } + + PX_FORCE_INLINE const BpFilter& getFilter() const { return mFilter; } + + PX_FORCE_INLINE bool getStateChanged() const { return mStateChanged; } + PX_FORCE_INLINE bool getGpuStateChanged() const { return mGpuStateChanged; } + +#if PX_CHECKED + static bool isValid(const BroadPhaseUpdateData& updateData, const BroadPhase& bp, const bool skipBoundValidation, PxU64 contextID); + bool isValid(const bool skipBoundValidation) const; +#endif + +private: + + const ShapeHandle* mCreated; + const PxU32 mCreatedSize; + + const ShapeHandle* mUpdated; + const PxU32 mUpdatedSize; + + const ShapeHandle* mRemoved; + const PxU32 mRemovedSize; + + const PxBounds3* mBoxBounds; + const Bp::FilterGroup::Enum* mBoxGroups; + const PxReal* mBoxDistances; + const PxU32 mBoxesCapacity; + + const BpFilter& mFilter; + + const bool mStateChanged; + const bool mGpuStateChanged; +}; + +} //namespace Bp + +} //namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpFiltering.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpFiltering.h new file mode 100644 index 0000000..33dd33e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpFiltering.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_FILTERING_H +#define BP_FILTERING_H + +#include "PxvConfig.h" +#include "foundation/PxAssert.h" + +namespace physx +{ + namespace Bp + { + +#define BP_USE_AGGREGATE_GROUP_TAIL +#define BP_FILTERING_TYPE_SHIFT_BIT 3 +#define BP_FILTERING_TYPE_MASK 7 + + /* + \brief AABBManager volumes with the same filter group value are guaranteed never to generate an overlap pair. + \note To ensure that static pairs never overlap, add static shapes with eSTATICS. + The value eDYNAMICS_BASE provides a minimum recommended group value for dynamic shapes. + If dynamics shapes are assigned group values greater than or equal to eDYNAMICS_BASE then + they are allowed to generate broadphase overlaps with statics, and other dynamic shapes provided + they have different group values. + @see AABBManager::createVolume + */ + struct FilterGroup + { + enum Enum + { + eSTATICS = 0, + ePARTICLES = 1, + eDYNAMICS_BASE = 2, +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + eAGGREGATE_BASE = 0xfffffffe, +#endif + eINVALID = 0xffffffff + }; + }; + + struct FilterType + { + enum Enum + { + STATIC = 0, + KINEMATIC = 1, + DYNAMIC = 2, + AGGREGATE = 3, + SOFTBODY = 4, + PARTICLESYSTEM = 5, + FEMCLOTH = 6, + HAIRSYSTEM = 7, + + COUNT = 8 + }; + }; + + PX_FORCE_INLINE Bp::FilterGroup::Enum getFilterGroup_Statics() + { + return Bp::FilterGroup::eSTATICS; + } + + PX_FORCE_INLINE Bp::FilterGroup::Enum getFilterGroup_Dynamics(PxU32 rigidId, bool isKinematic) + { + const PxU32 group = rigidId + Bp::FilterGroup::eDYNAMICS_BASE; + const PxU32 type = isKinematic ? FilterType::KINEMATIC : FilterType::DYNAMIC; + return Bp::FilterGroup::Enum((group<< BP_FILTERING_TYPE_SHIFT_BIT)|type); + } + + PX_FORCE_INLINE Bp::FilterGroup::Enum getFilterGroup(bool isStatic, PxU32 rigidId, bool isKinematic) + { + return isStatic ? getFilterGroup_Statics() : getFilterGroup_Dynamics(rigidId, isKinematic); + } + + PX_FORCE_INLINE bool groupFiltering(const Bp::FilterGroup::Enum group0, const Bp::FilterGroup::Enum group1, const bool* PX_RESTRICT lut) + { +/* const int g0 = group0 & ~3; + const int g1 = group1 & ~3; + if(g0==g1) + return false;*/ + if(group0==group1) + { + PX_ASSERT((group0 & ~BP_FILTERING_TYPE_MASK)==(group1 & ~BP_FILTERING_TYPE_MASK)); + return false; + } + + const int type0 = group0 & BP_FILTERING_TYPE_MASK; + const int type1 = group1 & BP_FILTERING_TYPE_MASK; + return lut[type0*Bp::FilterType::COUNT+type1]; + } + + class BpFilter + { + public: + BpFilter(bool discardKineKine, bool discardStaticKine); + ~BpFilter(); + + PX_FORCE_INLINE const bool* getLUT() const { return &mLUT[0][0]; } + + bool mLUT[Bp::FilterType::COUNT][Bp::FilterType::COUNT]; + }; + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpVolumeData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpVolumeData.h new file mode 100644 index 0000000..34ada33 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/include/BpVolumeData.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_VOLUME_DATA_H +#define BP_VOLUME_DATA_H + +#include "PxvConfig.h" +#include "foundation/PxAssert.h" + +namespace physx +{ + namespace Bp + { + typedef PxU32 AggregateHandle; // PT: currently an index in mAggregates array + + struct ElementType + { + enum Enum + { + eSHAPE = 0, + eTRIGGER, + + eCOUNT + }; + }; + PX_COMPILE_TIME_ASSERT(ElementType::eCOUNT <= 4); // 2 bits reserved for type + + #define PX_CUDA_INLINE PX_CUDA_CALLABLE PX_FORCE_INLINE + + struct VolumeData + { + PX_CUDA_INLINE void reset() + { + mAggregate = PX_INVALID_U32; + mUserData = NULL; + } + + PX_CUDA_INLINE void setSingleActor() { mAggregate = PX_INVALID_U32; } + PX_CUDA_INLINE bool isSingleActor() const { return mAggregate == PX_INVALID_U32; } + + PX_CUDA_INLINE void setUserData(void* userData) + { +// PX_ASSERT(!(size_t(userData) & 3)); + mUserData = userData; + } + + PX_CUDA_INLINE void* getUserData() const + { + return reinterpret_cast(size_t(mUserData)& (~size_t(3))); + } + + PX_CUDA_INLINE void setVolumeType(ElementType::Enum volumeType) + { + PX_ASSERT(volumeType < 2); + mUserData = reinterpret_cast(size_t(getUserData()) | size_t(volumeType)); + } + + PX_CUDA_INLINE ElementType::Enum getVolumeType() const + { + return ElementType::Enum(size_t(mUserData) & 3); + } + + PX_CUDA_INLINE void setAggregate(AggregateHandle handle) + { + PX_ASSERT(handle != PX_INVALID_U32); + mAggregate = (handle << 1) | 1; + } + + PX_CUDA_INLINE bool isAggregate() const { return !isSingleActor() && ((mAggregate & 1) != 0); } + + PX_CUDA_INLINE void setAggregated(AggregateHandle handle) + { + PX_ASSERT(handle != PX_INVALID_U32); + mAggregate = (handle << 1) | 0; + } + + PX_CUDA_INLINE bool isAggregated() const + { + return !isSingleActor() && ((mAggregate & 1) == 0); + } + + PX_CUDA_INLINE AggregateHandle getAggregateOwner() const { return mAggregate >> 1; } + PX_CUDA_INLINE AggregateHandle getAggregate() const { return mAggregate >> 1; } + + private: + void* mUserData; + // PT: TODO: consider moving this to a separate array, which wouldn't be allocated at all for people not using aggregates. + // PT: current encoding: + // aggregate == PX_INVALID_U32 => single actor + // aggregate != PX_INVALID_U32 => aggregate index<<1|LSB. LSB==1 for aggregates, LSB==0 for aggregated actors. + AggregateHandle mAggregate; + }; + + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp new file mode 100644 index 0000000..38dc571 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManager.cpp @@ -0,0 +1,2402 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpAABBManager.h" + +#define NB_SENTINELS 6 + +#include "foundation/PxHashSet.h" +#include "CmUtils.h" +#include "CmFlushPool.h" +#include "CmVisualization.h" +#include "CmRadixSort.h" +#include "BpBroadPhaseMBPCommon.h" +#include "BpBroadPhase.h" +#include "BpBroadPhaseShared.h" +#include "foundation/PxSort.h" +#include "foundation/PxVecMath.h" +#include "GuInternal.h" +#include "common/PxProfileZone.h" +//#include + +using namespace physx; +using namespace Bp; +using namespace Cm; +using namespace aos; + +static const bool gSingleThreaded = false; +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) + #define ABP_SIMD_OVERLAP +#endif +#ifdef ABP_SIMD_OVERLAP + typedef AABB_YZn AABB_YZ; +#else + typedef AABB_YZr AABB_YZ; +#endif + +#ifdef ABP_SIMD_OVERLAP + static const bool gUseRegularBPKernel = false; // false to use "version 13" in box pruning series + static const bool gUnrollLoop = true; // true to use "version 14" in box pruning series +#else + // PT: tested on Switch, for some reason the regular version is fastest there + static const bool gUseRegularBPKernel = true; // false to use "version 13" in box pruning series + static const bool gUnrollLoop = false; // true to use "version 14" in box pruning series +#endif + +namespace physx +{ +namespace Bp +{ +static PX_FORCE_INLINE uint32_t PxComputeHash(const Pair& p) +{ + return PxU32(physx::PxComputeHash( (p.mID0&0xffff)|(p.mID1<<16)) ); +} + +static PX_FORCE_INLINE uint32_t PxComputeHash(const AggPair& p) +{ + return PxU32(physx::PxComputeHash( (p.mIndex0&0xffff)|(p.mIndex1<<16)) ); +} + +static PX_FORCE_INLINE bool shouldPairBeDeleted(const PxPinnedArray& groups, ShapeHandle h0, ShapeHandle h1) +{ + PX_ASSERT(h0 mAggregated; // PT: TODO: replace with linked list? + public: + PersistentSelfCollisionPairs* mSelfCollisionPairs; + PxU32 mDirtyIndex; // PT: index in mDirtyAggregates + private: + AABB_Xi* mInflatedBoundsX; + AABB_YZ* mInflatedBoundsYZ; + PxU32 mAllocatedSize; + public: + PX_FORCE_INLINE PxU32 getNbAggregated() const { return mAggregated.size(); } + PX_FORCE_INLINE BoundsIndex getAggregated(PxU32 i) const { return mAggregated[i]; } + PX_FORCE_INLINE const BoundsIndex* getIndices() const { return mAggregated.begin(); } + PX_FORCE_INLINE void addAggregated(BoundsIndex i) { mAggregated.pushBack(i); } + PX_FORCE_INLINE bool removeAggregated(BoundsIndex i) { return mAggregated.findAndReplaceWithLast(i); } // PT: TODO: optimize? + PX_FORCE_INLINE const PxBounds3& getMergedBounds() const { return mBounds; } + + PX_FORCE_INLINE void resetDirtyState() { mDirtyIndex = PX_INVALID_U32; } + PX_FORCE_INLINE bool isDirty() const { return mDirtyIndex != PX_INVALID_U32; } + PX_FORCE_INLINE void markAsDirty(PxArray& dirtyAggregates) + { + if(!isDirty()) + { + mDirtyIndex = dirtyAggregates.size(); + dirtyAggregates.pushBack(this); + } + } + + void allocateBounds(); + void computeBounds(const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances) /*PX_RESTRICT*/; + + PX_FORCE_INLINE const AABB_Xi* getBoundsX() const { return mInflatedBoundsX; } + PX_FORCE_INLINE const AABB_YZ* getBoundsYZ() const { return mInflatedBoundsYZ; } + PX_FORCE_INLINE void getSortedMinBounds() + { + if(mDirtySort) + sortBounds(); + } + PX_FORCE_INLINE PxAggregateFilterHint getFilterHint() const { return mFilterHint; } + private: + PxBounds3 mBounds; + PxAggregateFilterHint mFilterHint; + bool mDirtySort; + + void sortBounds(); + PX_NOCOPY(Aggregate) + }; + +/// + +namespace +{ +#define MBP_ALLOC(x) PX_ALLOC(x, "MBP") +#define MBP_ALLOC_TMP(x) PX_ALLOC(x, "MBP_TMP") +#define MBP_FREE(x) PX_FREE(x) + + struct MBPEntry; + struct RegionHandle; + struct MBP_Object; + + class MBP_PairManager : public PairManagerData + { + public: + MBP_PairManager() {} + ~MBP_PairManager() {} + + PX_FORCE_INLINE InternalPair* addPair(PxU32 id0, PxU32 id1); + }; + +/////////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE InternalPair* MBP_PairManager::addPair(PxU32 id0, PxU32 id1) +{ + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + return addPairInternal(id0, id1); +} + +/////////////////////////////////////////////////////////////////////////////// + +} + + typedef MBP_PairManager PairArray; + +/// + +class PersistentPairs : public PxUserAllocated +{ + public: + PersistentPairs() : mTimestamp(PX_INVALID_U32), mShouldBeDeleted(false) {} + virtual ~PersistentPairs() {} + + virtual bool update(AABBManager& /*manager*/, BpCacheData* /*data*/ = NULL) { return false; } + + + PX_FORCE_INLINE void updatePairs(PxU32 timestamp, const PxBounds3* bounds, const float* contactDistances, const Bp::FilterGroup::Enum* groups, + const bool* lut, VolumeData* volumeData, PxArray* createdOverlaps, PxArray* destroyedOverlaps); + void outputDeletedOverlaps(PxArray* overlaps, const VolumeData* volumeData); + private: + virtual void findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) = 0; + protected: + PxU32 mTimestamp; + MBP_PairManager mPM; + public: + bool mShouldBeDeleted; +}; + +///// + #define PosXType2 PxU32 + +#if PX_INTEL_FAMILY + #define SIMD_OVERLAP_TEST_14a(box) _mm_movemask_ps(_mm_cmpngt_ps(b, _mm_load_ps(box)))==15 + + #define SIMD_OVERLAP_INIT_9c(box) \ + __m128 b = _mm_shuffle_ps(_mm_load_ps(&box.mMinY), _mm_load_ps(&box.mMinY), 78);\ + const float Coeff = -1.0f;\ + b = _mm_mul_ps(b, _mm_load1_ps(&Coeff)); + + #define SIMD_OVERLAP_TEST_9c(box) \ + const __m128 a = _mm_load_ps(&box.mMinY); \ + const __m128 d = _mm_cmpge_ps(a, b); \ + if(_mm_movemask_ps(d)==15) +#else + #define SIMD_OVERLAP_TEST_14a(box) BAllEqFFFF(V4IsGrtr(b, V4LoadA(box))) + + #define SIMD_OVERLAP_INIT_9c(box) \ + Vec4V b = V4PermZWXY(V4LoadA(&box.mMinY)); \ + b = V4Mul(b, V4Load(-1.0f)); + + #define SIMD_OVERLAP_TEST_9c(box) \ + const Vec4V a = V4LoadA(&box.mMinY); \ + const Vec4V d = V4IsGrtrOrEq(a, b); \ + if(BAllEqTTTT(d)) +#endif + + #define CODEALIGN16 //_asm align 16 +#ifdef ABP_SIMD_OVERLAP + #define SIMD_OVERLAP_PRELOAD_BOX0 SIMD_OVERLAP_INIT_9c(box0) + #define SIMD_OVERLAP_TEST(x) SIMD_OVERLAP_TEST_9c(x) +#else + #define SIMD_OVERLAP_PRELOAD_BOX0 +#endif + +#ifndef ABP_SIMD_OVERLAP +static PX_FORCE_INLINE int intersect2D(const AABB_YZ& a, const AABB_YZ& b) +{ + const bool b0 = b.mMaxY < a.mMinY; + const bool b1 = a.mMaxY < b.mMinY; + const bool b2 = b.mMaxZ < a.mMinZ; + const bool b3 = a.mMaxZ < b.mMinZ; +// const bool b4 = b0 || b1 || b2 || b3; + const bool b4 = b0 | b1 | b2 | b3; + return !b4; +} +#endif + +#ifdef ABP_SIMD_OVERLAP + #define ABP_OVERLAP_TEST(x) SIMD_OVERLAP_TEST(x) +#else + #define ABP_OVERLAP_TEST(x) if(intersect2D(box0, x)) +#endif + +//#define BIP_VERSION_1 + + struct outputPair_Bipartite + { +#ifdef BIP_VERSION_1 + outputPair_Bipartite(PairArray* pairManager, Aggregate* aggregate0, Aggregate* aggregate1, const Bp::FilterGroup::Enum* groups, const bool* lut) : +#else + outputPair_Bipartite(PairArray* pairManager, const BoundsIndex* remap0, const BoundsIndex* remap1, const Bp::FilterGroup::Enum* groups, const bool* lut) : +#endif + mPairManager (pairManager), +#ifdef BIP_VERSION_1 + mAggregate0 (aggregate0), + mAggregate1 (aggregate1), +#else + mRemap0 (remap0), + mRemap1 (remap1), +#endif + mGroups (groups), + mLUT (lut) + { + } + + PX_FORCE_INLINE void outputPair(PxU32 index0, PxU32 index1) + { +#ifdef BIP_VERSION_1 + const PxU32 aggIndex0 = mAggregate0->getAggregated(index0); + const PxU32 aggIndex1 = mAggregate1->getAggregated(index1); +#else + const PxU32 aggIndex0 = mRemap0[index0]; + const PxU32 aggIndex1 = mRemap1[index1]; +#endif + if(groupFiltering(mGroups[aggIndex0], mGroups[aggIndex1], mLUT)) + mPairManager->addPair(aggIndex0, aggIndex1); + } + + PairArray* mPairManager; +#ifdef BIP_VERSION_1 + Aggregate* mAggregate0; + Aggregate* mAggregate1; +#else + const BoundsIndex* mRemap0; + const BoundsIndex* mRemap1; +#endif + const Bp::FilterGroup::Enum* mGroups; + const bool* mLUT; + }; + +template +static void boxPruningKernel( PairArray* PX_RESTRICT pairManager, const bool* PX_RESTRICT lut, +#ifdef BIP_VERSION_1 + Aggregate* PX_RESTRICT aggregate0, Aggregate* PX_RESTRICT aggregate1, +#else + PxU32 nb0, const BoundsIndex* PX_RESTRICT remap0, const AABB_Xi* PX_RESTRICT boxes0_X, const AABB_YZ* PX_RESTRICT boxes0_YZ, + PxU32 nb1, const BoundsIndex* PX_RESTRICT remap1, const AABB_Xi* PX_RESTRICT boxes1_X, const AABB_YZ* PX_RESTRICT boxes1_YZ, +#endif + const Bp::FilterGroup::Enum* PX_RESTRICT groups) +{ +#ifdef BIP_VERSION_1 + outputPair_Bipartite pm(pairManager, aggregate0, aggregate1, groups, lut); + + const PxU32 nb0 = aggregate0->getNbAggregated(); + const PxU32 nb1 = aggregate1->getNbAggregated(); + const AABB_Xi* PX_RESTRICT boxes0_X = aggregate0->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes0_YZ = aggregate0->getBoundsYZ(); + const AABB_Xi* PX_RESTRICT boxes1_X = aggregate1->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes1_YZ = aggregate1->getBoundsYZ(); +#else +// outputPair_Bipartite pm(pairManager, aggregate0->getIndices(), aggregate1->getIndices(), groups, lut); + outputPair_Bipartite pm(pairManager, remap0, remap1, groups, lut); +#endif + + PxU32 index0 = 0; + PxU32 runningIndex1 = 0; + + while(runningIndex1(&boxes1_YZ[runningIndex1]); + const char* const CurrentBoxListX = reinterpret_cast(&boxes1_X[runningIndex1]); + + if(!gUnrollLoop) + { + while(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) + { + const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2); +#ifdef ABP_SIMD_OVERLAP + if(SIMD_OVERLAP_TEST_14a(box)) +#else + if(intersect2D(box0, *reinterpret_cast(box))) +#endif + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes1_X))>>3; + pm.outputPair(index0, Index1); + } + Offset += 8; + } + } + else + { + +#define BIP_VERSION4 +#ifdef BIP_VERSION4 +#ifdef ABP_SIMD_OVERLAP + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(SIMD_OVERLAP_TEST_14a(box)) \ + goto label; } +#else + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(intersect2D(box0, *reinterpret_cast(box))) \ + goto label; } +#endif + goto StartLoop4; + CODEALIGN16 +FoundOverlap3: + Offset += 8; + CODEALIGN16 +FoundOverlap2: + Offset += 8; + CODEALIGN16 +FoundOverlap1: + Offset += 8; + CODEALIGN16 +FoundOverlap0: + Offset += 8; + CODEALIGN16 +FoundOverlap: + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - 8 - reinterpret_cast(boxes1_X))>>3; + pm.outputPair(index0, Index1); + } + CODEALIGN16 +StartLoop4: + while(*reinterpret_cast(CurrentBoxListX + Offset + 8*5)<=maxLimit) + { + BLOCK4(0, FoundOverlap0) + BLOCK4(8, FoundOverlap1) + BLOCK4(16, FoundOverlap2) + BLOCK4(24, FoundOverlap3) + Offset += 40; + BLOCK4(-8, FoundOverlap) + } +#undef BLOCK4 +#endif + +#ifdef ABP_SIMD_OVERLAP + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(SIMD_OVERLAP_TEST_14a(reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto OverlapFound; \ + Offset += 8; +#else + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(intersect2D(box0, *reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto OverlapFound; \ + Offset += 8; +#endif + + goto LoopStart; + CODEALIGN16 +OverlapFound: + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes1_X))>>3; + pm.outputPair(index0, Index1); + } + Offset += 8; + CODEALIGN16 +LoopStart: + BLOCK + BLOCK + BLOCK + } + } + goto LoopStart; + } +#undef BLOCK + } + } + + index0++; + } +} + +static PX_FORCE_INLINE void doBipartiteBoxPruning_Leaf( + PairArray* PX_RESTRICT pairManager, const bool* PX_RESTRICT lut, + Aggregate* PX_RESTRICT aggregate0, Aggregate* PX_RESTRICT aggregate1, const Bp::FilterGroup::Enum* PX_RESTRICT groups) +{ +#ifdef BIP_VERSION_1 + boxPruningKernel<0>(pairManager, lut, aggregate0, aggregate1, groups); + boxPruningKernel<1>(pairManager, lut, aggregate1, aggregate0, groups); +#else + const PxU32 nb0 = aggregate0->getNbAggregated(); + const PxU32 nb1 = aggregate1->getNbAggregated(); + const BoundsIndex* PX_RESTRICT remap0 = aggregate0->getIndices(); + const BoundsIndex* PX_RESTRICT remap1 = aggregate1->getIndices(); + const AABB_Xi* PX_RESTRICT boxes0_X = aggregate0->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes0_YZ = aggregate0->getBoundsYZ(); + const AABB_Xi* PX_RESTRICT boxes1_X = aggregate1->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes1_YZ = aggregate1->getBoundsYZ(); + boxPruningKernel<0>(pairManager, lut, nb0, remap0, boxes0_X, boxes0_YZ, nb1, remap1, boxes1_X, boxes1_YZ, groups); + boxPruningKernel<1>(pairManager, lut, nb1, remap1, boxes1_X, boxes1_YZ, nb0, remap0, boxes0_X, boxes0_YZ, groups); +#endif +} + + struct outputPair_Complete + { + outputPair_Complete(PairArray* pairManager, Aggregate* aggregate, const Bp::FilterGroup::Enum* groups, const bool* lut) : + mPairManager (pairManager), + mAggregate (aggregate), + mGroups (groups), + mLUT (lut) + { + } + + PX_FORCE_INLINE void outputPair(PxU32 index0, PxU32 index1) + { + const PxU32 aggIndex0 = mAggregate->getAggregated(index0); + const PxU32 aggIndex1 = mAggregate->getAggregated(index1); + + if(groupFiltering(mGroups[aggIndex0], mGroups[aggIndex1], mLUT)) + mPairManager->addPair(aggIndex0, aggIndex1); + } + + PairArray* mPairManager; + Aggregate* mAggregate; + const Bp::FilterGroup::Enum* mGroups; + const bool* mLUT; + }; + +static void doCompleteBoxPruning_Leaf( PairArray* PX_RESTRICT pairManager, const bool* PX_RESTRICT lut, + Aggregate* PX_RESTRICT aggregate, const Bp::FilterGroup::Enum* PX_RESTRICT groups) +{ + outputPair_Complete pm(pairManager, aggregate, groups, lut); + const PxU32 nb = aggregate->getNbAggregated(); + const AABB_Xi* PX_RESTRICT boxes_X = aggregate->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes_YZ = aggregate->getBoundsYZ(); + + PxU32 index0 = 0; + PxU32 runningIndex = 0; + while(runningIndex(&boxes_YZ[runningIndex]); + const char* const CurrentBoxListX = reinterpret_cast(&boxes_X[runningIndex]); + + if(!gUnrollLoop) + { + while(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) + { + const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2); +#ifdef ABP_SIMD_OVERLAP + if(SIMD_OVERLAP_TEST_14a(box)) +#else + if(intersect2D(box0, *reinterpret_cast(box))) +#endif + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes_X))>>3; + pm.outputPair(index0, Index); + } + Offset += 8; + } + } + else + { + +#define VERSION4c +#ifdef VERSION4c +#define VERSION3 // Enable this as our safe loop +#ifdef ABP_SIMD_OVERLAP + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(SIMD_OVERLAP_TEST_14a(box)) \ + goto label; } +#else + #define BLOCK4(x, label) {const AABB_YZ* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(intersect2D(box0, *box)) \ + goto label; } +#endif + goto StartLoop4; + CODEALIGN16 +FoundOverlap3: + Offset += 8; + CODEALIGN16 +FoundOverlap2: + Offset += 8; + CODEALIGN16 +FoundOverlap1: + Offset += 8; + CODEALIGN16 +FoundOverlap0: + Offset += 8; + CODEALIGN16 +FoundOverlap: + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - 8 - reinterpret_cast(boxes_X))>>3; + pm.outputPair(index0, Index); + } + CODEALIGN16 +StartLoop4: + while(*reinterpret_cast(CurrentBoxListX + Offset + 8*5)<=maxLimit) + { + BLOCK4(0, FoundOverlap0) + BLOCK4(8, FoundOverlap1) + BLOCK4(16, FoundOverlap2) + BLOCK4(24, FoundOverlap3) + Offset += 40; + BLOCK4(-8, FoundOverlap) + } +#endif + +#define VERSION3 +#ifdef VERSION3 +#ifdef ABP_SIMD_OVERLAP + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(SIMD_OVERLAP_TEST_14a(reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto BeforeLoop; \ + Offset += 8; +#else + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(intersect2D(box0, *reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto BeforeLoop; \ + Offset += 8; +#endif + + goto StartLoop; + CODEALIGN16 +BeforeLoop: + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes_X))>>3; + pm.outputPair(index0, Index); + Offset += 8; + } + CODEALIGN16 +StartLoop: + BLOCK + BLOCK + BLOCK + BLOCK + BLOCK + } + } + } + } + goto StartLoop; + } +#endif + } + } + + index0++; + } +} + +///// + +class PersistentActorAggregatePair : public PersistentPairs +{ + public: + PersistentActorAggregatePair(Aggregate* aggregate, ShapeHandle actorHandle); + virtual ~PersistentActorAggregatePair() {} + + virtual void findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut); + virtual bool update(AABBManager& manager, BpCacheData* data); + + ShapeHandle mAggregateHandle; + ShapeHandle mActorHandle; + Aggregate* mAggregate; +}; + +PersistentActorAggregatePair::PersistentActorAggregatePair(Aggregate* aggregate, ShapeHandle actorHandle) : + mAggregateHandle (aggregate->mIndex), + mActorHandle (actorHandle), + mAggregate (aggregate) +{ +} + +void PersistentActorAggregatePair::findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) +{ + if(0) + { + Aggregate singleActor(INVALID_ID, false); + singleActor.addAggregated(mActorHandle); + singleActor.allocateBounds(); + singleActor.computeBounds(bounds, contactDistances); + singleActor.getSortedMinBounds(); + mAggregate->getSortedMinBounds(); + doBipartiteBoxPruning_Leaf(&pairs, lut, &singleActor, mAggregate, groups); + } + else + { + + mAggregate->getSortedMinBounds(); + const PxU32 nb0 = mAggregate->getNbAggregated(); + const BoundsIndex* PX_RESTRICT remap0 = mAggregate->getIndices(); + const AABB_Xi* PX_RESTRICT boxes0_X = mAggregate->getBoundsX(); + const AABB_YZ* PX_RESTRICT boxes0_YZ = mAggregate->getBoundsYZ(); + + PX_ALIGN(16, AABB_Xi inflatedBoundsX[1+NB_SENTINELS]); + PX_ALIGN(16, AABB_YZ inflatedBoundsYZ); + + // Compute bounds + { + PX_ALIGN(16, PxVec4) boxMin; + PX_ALIGN(16, PxVec4) boxMax; + const BoundsIndex actorHandle = mActorHandle; + const PxBounds3& b = bounds[actorHandle]; + const Vec4V offsetV = V4Load(contactDistances[actorHandle]); + const Vec4V minimumV = V4Sub(V4LoadU(&b.minimum.x), offsetV); + const Vec4V maximumV = V4Add(V4LoadU(&b.maximum.x), offsetV); + V4StoreA(minimumV, &boxMin.x); + V4StoreA(maximumV, &boxMax.x); + inflatedBoundsX[0].initFromPxVec4(boxMin, boxMax); + inflatedBoundsYZ.initFromPxVec4(boxMin, boxMax); + + for(PxU32 i=0;i(&pairs, lut, nb0, remap0, boxes0_X, boxes0_YZ, nb1, remap1, boxes1_X, boxes1_YZ, groups); + boxPruningKernel<1>(&pairs, lut, nb1, remap1, boxes1_X, boxes1_YZ, nb0, remap0, boxes0_X, boxes0_YZ, groups); + + } +} + +bool PersistentActorAggregatePair::update(AABBManager& manager, BpCacheData* data) +{ + if(mShouldBeDeleted || shouldPairBeDeleted(manager.mGroups, mAggregateHandle, mActorHandle)) + return true; + + if(!mAggregate->getNbAggregated()) // PT: needed with lazy empty actors + return true; + + if(mAggregate->isDirty() || manager.mChangedHandleMap.boundedTest(mActorHandle)) + manager.updatePairs(*this, data); + + return false; +} + +///// + +class PersistentAggregateAggregatePair : public PersistentPairs +{ + public: + PersistentAggregateAggregatePair(Aggregate* aggregate0, Aggregate* aggregate1); + virtual ~PersistentAggregateAggregatePair() {} + + virtual void findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut); + virtual bool update(AABBManager& manager, BpCacheData*); + + ShapeHandle mAggregateHandle0; + ShapeHandle mAggregateHandle1; + Aggregate* mAggregate0; + Aggregate* mAggregate1; +}; + +PersistentAggregateAggregatePair::PersistentAggregateAggregatePair(Aggregate* aggregate0, Aggregate* aggregate1) : + mAggregateHandle0 (aggregate0->mIndex), + mAggregateHandle1 (aggregate1->mIndex), + mAggregate0 (aggregate0), + mAggregate1 (aggregate1) +{ +} + +void PersistentAggregateAggregatePair::findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT /*bounds*/, const float* PX_RESTRICT /*contactDistances*/, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) +{ + mAggregate0->getSortedMinBounds(); + mAggregate1->getSortedMinBounds(); + doBipartiteBoxPruning_Leaf(&pairs, lut, mAggregate0, mAggregate1, groups); +} + +bool PersistentAggregateAggregatePair::update(AABBManager& manager, BpCacheData* data) +{ + if(mShouldBeDeleted || shouldPairBeDeleted(manager.mGroups, mAggregateHandle0, mAggregateHandle1)) + return true; + + if(!mAggregate0->getNbAggregated() || !mAggregate1->getNbAggregated()) // PT: needed with lazy empty actors + return true; + + if(mAggregate0->isDirty() || mAggregate1->isDirty()) + manager.updatePairs(*this, data); + + return false; +} + +///// + +class PersistentSelfCollisionPairs : public PersistentPairs +{ + public: + PersistentSelfCollisionPairs(Aggregate* aggregate); + virtual ~PersistentSelfCollisionPairs() {} + + virtual void findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT bounds, const float* PX_RESTRICT contactDistances, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut); + + Aggregate* mAggregate; +}; + +PersistentSelfCollisionPairs::PersistentSelfCollisionPairs(Aggregate* aggregate) : + mAggregate (aggregate) +{ +} + +void PersistentSelfCollisionPairs::findOverlaps(PairArray& pairs, const PxBounds3* PX_RESTRICT/*bounds*/, const float* PX_RESTRICT/*contactDistances*/, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) +{ + mAggregate->getSortedMinBounds(); + doCompleteBoxPruning_Leaf(&pairs, lut, mAggregate, groups); +} + +///// + +Aggregate::Aggregate(BoundsIndex index, PxAggregateFilterHint filterHint) : + mIndex (index), + mInflatedBoundsX (NULL), + mInflatedBoundsYZ (NULL), + mAllocatedSize (0), + mFilterHint (filterHint), + mDirtySort (false) +{ + resetDirtyState(); + const PxU32 selfCollisions = PxGetAggregateSelfCollisionBit(filterHint); + mSelfCollisionPairs = selfCollisions ? PX_NEW(PersistentSelfCollisionPairs)(this) : NULL; +} + +Aggregate::~Aggregate() +{ + PX_FREE(mInflatedBoundsYZ); + PX_FREE(mInflatedBoundsX); + + PX_DELETE(mSelfCollisionPairs); +} + +void Aggregate::sortBounds() +{ + mDirtySort = false; + const PxU32 nbObjects = getNbAggregated(); + if(nbObjects<2) + return; + + { + PX_ALLOCA(minPosBounds, InflatedType, nbObjects+1); + bool alreadySorted = true; + InflatedType previousB = mInflatedBoundsX[0].mMinX; + minPosBounds[0] = previousB; + for(PxU32 i=1;i copy = mAggregated; + AABB_Xi* boundsXCopy = PX_ALLOCATE(AABB_Xi, nbObjects, "mInflatedBounds"); + AABB_YZ* boundsYZCopy = PX_ALLOCATE(AABB_YZ, nbObjects, "mInflatedBounds"); + PxMemCopy(boundsXCopy, mInflatedBoundsX, nbObjects*sizeof(AABB_Xi)); + PxMemCopy(boundsYZCopy, mInflatedBoundsYZ, nbObjects*sizeof(AABB_YZ)); + const PxU32* Sorted = mRS.GetRanks(); + for(PxU32 i=0;i copy = mAggregated; // PT: TODO: revisit this, avoid the copy like we do for the other buffers + AABB_Xi* sortedBoundsX = PX_ALLOCATE(AABB_Xi, (nbObjects+NB_SENTINELS), "mInflatedBounds"); + AABB_YZ* sortedBoundsYZ = PX_ALLOCATE(AABB_YZ, (nbObjects), "mInflatedBounds"); + + const PxU32* Sorted = mRS.GetRanks(); + for(PxU32 i=0;i& aggregates) +{ + const PxU32 N = aggregates.size(); + + bitmap.resizeAndClear(N); + + while(currentFree!=PX_INVALID_U32) + { + bitmap.set(currentFree); + currentFree = PxU32(size_t(aggregates[currentFree])); + } +} + +#if PX_VC +#pragma warning(disable: 4355 ) // "this" used in base member initializer list +#endif + +AABBManager::AABBManager( BroadPhase& bp, BoundsArray& boundsArray, PxFloatArrayPinned& contactDistance, + PxU32 maxNbAggregates, PxU32 maxNbShapes, PxVirtualAllocator& allocator, PxU64 contextID, + PxPairFilteringMode::Enum kineKineFilteringMode, PxPairFilteringMode::Enum staticKineFilteringMode) : + AABBManagerBase (bp, boundsArray, contactDistance, maxNbAggregates, maxNbShapes, allocator, contextID, kineKineFilteringMode, staticKineFilteringMode), + mPostBroadPhase2 (contextID, *this), + mPostBroadPhase3 (contextID, this, "AABBManager::postBroadPhaseStage3"), + mPreBpUpdateTask (contextID), + mTimestamp (0), + mFirstFreeAggregate (PX_INVALID_U32) +{ +} + +static void releasePairs(AggPairMap& map) +{ + for(AggPairMap::Iterator iter = map.getIterator(); !iter.done(); ++iter) + PX_DELETE(iter->second); +} + +void AABBManager::destroy() +{ + releasePairs(mActorAggregatePairs); + releasePairs(mAggregateAggregatePairs); + + { + PxBitMap bitmap; + buildFreeBitmap(bitmap, mFirstFreeAggregate, mAggregates); + + const PxU32 nb = mAggregates.size(); + for(PxU32 i=0;i(mBpThreadContextPool.pop()); + while (entry) + { + entry->~BpCacheData(); + PX_FREE(entry); + entry = static_cast(mBpThreadContextPool.pop()); + } + + PX_DELETE_THIS; +} + +static void removeAggregateFromDirtyArray(Aggregate* aggregate, PxArray& dirtyAggregates) +{ + // PT: TODO: do this lazily like for interactions? + if(aggregate->isDirty()) + { + const PxU32 dirtyIndex = aggregate->mDirtyIndex; + PX_ASSERT(dirtyAggregates[dirtyIndex]==aggregate); + dirtyAggregates.replaceWithLast(dirtyIndex); + if(dirtyIndexmDirtyIndex = dirtyIndex; + aggregate->resetDirtyState(); + } + else + { + PX_ASSERT(!dirtyAggregates.findAndReplaceWithLast(aggregate)); + } +} + +// PT: TODO: what is the "userData" here? +bool AABBManager::addBounds(BoundsIndex index, PxReal contactDistance, Bp::FilterGroup::Enum group, void* userData, AggregateHandle aggregateHandle, ElementType::Enum volumeType) +{ +// PX_ASSERT(checkID(index)); + + initEntry(index, contactDistance, group, userData); + mVolumeData[index].setVolumeType(volumeType); + + if(aggregateHandle==PX_INVALID_U32) + { + mVolumeData[index].setSingleActor(); + + addBPEntry(index); + } + else + { +#if PX_CHECKED + if(aggregateHandle>=mAggregates.size()) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "AABBManager::addBounds - aggregateId out of bounds\n"); + +/* { + PxU32 firstFreeAggregate = mFirstFreeAggregate; + while(firstFreeAggregate!=PX_INVALID_U32) + { + if(firstFreeAggregate==aggregateHandle) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "AABBManager::destroyAggregate - aggregate has already been removed\n"); + return BP_INVALID_BP_HANDLE; + } + firstFreeAggregate = PxU32(size_t(mAggregates[firstFreeAggregate])); + } + }*/ +#endif + mVolumeData[index].setAggregated(aggregateHandle); + + Aggregate* aggregate = getAggregateFromHandle(aggregateHandle); + + { + // PT: schedule the aggregate for BP insertion here, if we just added its first shape + if(!aggregate->getNbAggregated()) + addBPEntry(aggregate->mIndex); + + aggregate->addAggregated(index); + + // PT: new actor added to aggregate => mark dirty to recompute bounds later + aggregate->markAsDirty(mDirtyAggregates); + } + } + + // PT: TODO: remove or use this return value. Currently useless since always true. Gives birth to unreachable code in callers. + return true; +} + +bool AABBManager::removeBounds(BoundsIndex index) +{ + // PT: TODO: shouldn't it be compared to mUsedSize? + PX_ASSERT(index < mVolumeData.size()); + bool res = false; + if(mVolumeData[index].isSingleActor()) + { + res = removeBPEntry(index); + } + else + { + PX_ASSERT(mVolumeData[index].isAggregated()); + + const AggregateHandle aggregateHandle = mVolumeData[index].getAggregateOwner(); + Aggregate* aggregate = getAggregateFromHandle(aggregateHandle); + bool status = aggregate->removeAggregated(index); + (void)status; +// PX_ASSERT(status); // PT: can be false when >128 shapes + + // PT: remove empty aggregates, otherwise the BP will crash with empty bounds + if(!aggregate->getNbAggregated()) + { + removeBPEntry(aggregate->mIndex); + removeAggregateFromDirtyArray(aggregate, mDirtyAggregates); + } + else + aggregate->markAsDirty(mDirtyAggregates); // PT: actor removed from aggregate => mark dirty to recompute bounds later + } + + resetEntry(index); + return res; +} + +// PT: TODO: the userData is actually a PxAggregate pointer. Maybe we could expose/use that. +AggregateHandle AABBManager::createAggregate(BoundsIndex index, Bp::FilterGroup::Enum group, void* userData, PxU32 maxNumShapes, PxAggregateFilterHint filterHint) +{ +// PX_ASSERT(checkID(index)); + PX_UNUSED(maxNumShapes); + + Aggregate* aggregate = PX_NEW(Aggregate)(index, filterHint); + + AggregateHandle handle; + if(mFirstFreeAggregate==PX_INVALID_U32) + { + handle = mAggregates.size(); + mAggregates.pushBack(aggregate); + } + else + { + handle = mFirstFreeAggregate; + mFirstFreeAggregate = PxU32(size_t(mAggregates[mFirstFreeAggregate])); + mAggregates[handle] = aggregate; + } + +#ifdef BP_USE_AGGREGATE_GROUP_TAIL +/* PxU32 id = index; + id<<=2; + id|=FilterType::AGGREGATE; + initEntry(index, 0.0f, Bp::FilterGroup::Enum(id), userData); +*/ + initEntry(index, 0.0f, getAggregateGroup(), userData); + PX_UNUSED(group); +#else + initEntry(index, 0.0f, group, userData); +#endif + + mVolumeData[index].setAggregate(handle); + + mBoundsArray.setBounds(PxBounds3::empty(), index); + + mNbAggregates++; + + // PT: we don't add empty aggregates to mAddedHandleMap yet, since they make the BP crash. + return handle; +} + +bool AABBManager::destroyAggregate(BoundsIndex& index_, Bp::FilterGroup::Enum& group_, AggregateHandle aggregateHandle) +{ +#if PX_CHECKED + if(aggregateHandle>=mAggregates.size()) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "AABBManager::destroyAggregate - aggregateId out of bounds\n"); + + { + PxU32 firstFreeAggregate = mFirstFreeAggregate; + while(firstFreeAggregate!=PX_INVALID_U32) + { + if(firstFreeAggregate==aggregateHandle) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "AABBManager::destroyAggregate - aggregate has already been removed\n"); + + firstFreeAggregate = PxU32(size_t(mAggregates[firstFreeAggregate])); + } + } +#endif + + Aggregate* aggregate = getAggregateFromHandle(aggregateHandle); + +#if PX_CHECKED + if(aggregate->getNbAggregated()) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "AABBManager::destroyAggregate - aggregate still has bounds that needs removed\n"); +#endif + + const BoundsIndex index = aggregate->mIndex; + removeAggregateFromDirtyArray(aggregate, mDirtyAggregates); + + if(mAddedHandleMap.test(index)) // PT: if object had been added this frame... + mAddedHandleMap.reset(index); // PT: ...then simply revert the previous operation locally (it hasn't been passed to the BP yet). + else if(aggregate->getNbAggregated()) // PT: else we need to remove it from the BP if it has been added there. If there's no aggregated + mRemovedHandleMap.set(index); // PT: shapes then the aggregate has never been added, or already removed. + + PX_DELETE(aggregate); + mAggregates[aggregateHandle] = reinterpret_cast(size_t(mFirstFreeAggregate)); + mFirstFreeAggregate = aggregateHandle; + + // PT: TODO: shouldn't it be compared to mUsedSize? + PX_ASSERT(index < mVolumeData.size()); + + index_ = index; + group_ = mGroups[index]; + +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + releaseAggregateGroup(mGroups[index]); +#endif + resetEntry(index); + + PX_ASSERT(mNbAggregates); + mNbAggregates--; + + return true; +} + +void AABBManager::handleOriginShift() +{ + mOriginShifted = false; + + // PT: TODO: isn't the following loop potentially updating removed objects? + // PT: TODO: check that aggregates code is correct here + for(PxU32 i=0; igetNbAggregated()) + { + aggregate->markAsDirty(mDirtyAggregates); + aggregate->allocateBounds(); + aggregate->computeBounds(mBoundsArray.begin(), mContactDistance.begin()); + mBoundsArray.begin()[aggregate->mIndex] = aggregate->getMergedBounds(); + if(!mAddedHandleMap.test(i)) + mUpdatedHandles.pushBack(i); // PT: TODO: BoundsIndex-to-ShapeHandle confusion here + } + } + } + } +} + +void AggregateBoundsComputationTask::runInternal() +{ + const BoundsArray& boundArray = mManager->getBoundsArray(); + const float* contactDistances = mManager->getContactDistances(); + + PxU32 size = mNbToGo; + Aggregate** currentAggregate = mAggregates + mStart; + while(size--) + { + if(size) + { + Aggregate* nextAggregate = *(currentAggregate+1); + PxPrefetchLine(nextAggregate, 0); + PxPrefetchLine(nextAggregate, 64); + } + + (*currentAggregate)->computeBounds(boundArray.begin(), contactDistances); + currentAggregate++; + } +} + +void PreBpUpdateTask::runInternal() +{ + mManager->preBpUpdate_CPU(mNumCpuTasks); +} + +void AABBManager::startAggregateBoundsComputationTasks(PxU32 nbToGo, PxU32 numCpuTasks, Cm::FlushPool& flushPool) +{ + const PxU32 nbAggregatesPerTask = nbToGo > numCpuTasks ? nbToGo / numCpuTasks : nbToGo; + + // PT: TODO: better load balancing + + PxU32 start = 0; + while(nbToGo) + { + AggregateBoundsComputationTask* T = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(AggregateBoundsComputationTask)), AggregateBoundsComputationTask(mContextID)); + + const PxU32 nb = nbToGo < nbAggregatesPerTask ? nbToGo : nbAggregatesPerTask; + T->Init(this, start, nb, mDirtyAggregates.begin()); + start += nb; + nbToGo -= nb; + + T->setContinuation(&mPreBpUpdateTask); + T->removeReference(); + } +} + +void AABBManager::updateBPFirstPass(PxU32 numCpuTasks, Cm::FlushPool& flushPool, bool /*hasContactDistanceUpdated*/, PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass", mContextID); + + const bool singleThreaded = gSingleThreaded || numCpuTasks<2; + if(!singleThreaded) + { + PX_ASSERT(numCpuTasks); + mPreBpUpdateTask.Init(this, numCpuTasks); + mPreBpUpdateTask.setContinuation(continuation); + } + + // Add + { + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass - add", mContextID); + + mAddedHandles.resetOrClear(); + + const PxU32* bits = mAddedHandleMap.getWords(); + if(bits) + { + // PT: ### bitmap iterator pattern + const PxU32 lastSetBit = mAddedHandleMap.findLast(); + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) + { + for(PxU32 b = bits[w]; b; b &= b-1) + { + const BoundsIndex handle = PxU32(w<<5|PxLowestSetBit(b)); + PX_ASSERT(!mVolumeData[handle].isAggregated()); + mAddedHandles.pushBack(handle); // PT: TODO: BoundsIndex-to-ShapeHandle confusion here + } + } + } + } + + // Update + { + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass - update", mContextID); + + mUpdatedHandles.resetOrClear(); + if(!mOriginShifted) + { + // PT: TODO: + // - intercept calls marking aggregateD shapes dirty, in order to mark their aggregates dirty at the same time. That way we don't discover + // them while parsing the map, i.e. the map is already fully complete when the parsing begins (no need to parse twice etc). + // - once this is done, aggregateD shapes can be ignored during parsing (since we only needed them to go to their aggregates) + // - we can then handle aggregates while parsing the map, i.e. there's no need for sorting anymore. + // - there will be some thoughts to do about the dirty aggregates coming from the added map parsing: we still need to compute their bounds, + // but we don't want to add these to mUpdatedHandles (since they're already in mAddedHandles) + // - we still need the set of dirty aggregates post broadphase, but we don't want to re-parse the full map for self-collisions. So we may still + // need to put dirty aggregates in an array, but that might be simplified now + // - the 'isDirty' checks to updatePairs can use the update map though - but the boundedTest is probably more expensive than the current test + + // PT: TODO: another idea: just output all aggregate handles by default then have a pass on mUpdatedHandles to remove them if that wasn't actually necessary + // ...or just drop the artificial requirement for aggregates... + + { + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass - update - bitmap iteration", mContextID); + + const PxU32* bits = mChangedHandleMap.getWords(); + if(bits) + { + // PT: ### bitmap iterator pattern + const PxU32 lastSetBit = mChangedHandleMap.findLast(); + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) + { + for(PxU32 b = bits[w]; b; b &= b-1) + { + const BoundsIndex handle = PxU32(w<<5|PxLowestSetBit(b)); + PX_ASSERT(!mRemovedHandleMap.test(handle)); // a handle may only be updated and deleted if it was just added. + PX_ASSERT(!mVolumeData[handle].isAggregate()); // PT: make sure changedShapes doesn't contain aggregates + + if(mAddedHandleMap.test(handle)) // just-inserted handles may also be marked updated, so skip them + continue; + + if(mVolumeData[handle].isSingleActor()) + { + PX_ASSERT(mGroups[handle] != Bp::FilterGroup::eINVALID); + mUpdatedHandles.pushBack(handle); // PT: TODO: BoundsIndex-to-ShapeHandle confusion here + } + else + { + PX_ASSERT(mVolumeData[handle].isAggregated()); + const AggregateHandle aggregateHandle = mVolumeData[handle].getAggregateOwner(); + Aggregate* aggregate = getAggregateFromHandle(aggregateHandle); + // PT: an actor from the aggregate has been updated => mark dirty to recompute bounds later + // PT: we don't recompute the bounds right away since multiple actors from the same aggregate may have changed. + aggregate->markAsDirty(mDirtyAggregates); + } + } + } + } + } + + const PxU32 size = mDirtyAggregates.size(); + if(size) + { + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass - update - dirty iteration", mContextID); + for(PxU32 i=0;iallocateBounds(); + if(singleThreaded) + { + aggregate->computeBounds(mBoundsArray.begin(), mContactDistance.begin()); + mBoundsArray.begin()[aggregate->mIndex] = aggregate->getMergedBounds(); + } + + // PT: Can happen when an aggregate has been created and then its actors have been changed (with e.g. setLocalPose) + // before a BP call. + if(!mAddedHandleMap.test(aggregate->mIndex)) + mUpdatedHandles.pushBack(aggregate->mIndex); // PT: TODO: BoundsIndex-to-ShapeHandle confusion here + } + + if(!singleThreaded) + startAggregateBoundsComputationTasks(size, numCpuTasks, flushPool); + + // PT: we're already sorted if no dirty-aggregates are involved + { + PX_PROFILE_ZONE("AABBManager::updateAABBsAndBP - update - sort", mContextID); + + // PT: TODO: remove this + PxSort(mUpdatedHandles.begin(), mUpdatedHandles.size()); + } + } + } + else + { + handleOriginShift(); + } + } + + // Remove + { + PX_PROFILE_ZONE("AABBManager::updateBPFirstPass - remove", mContextID); + + mRemovedHandles.resetOrClear(); + + const PxU32* bits = mRemovedHandleMap.getWords(); + if(bits) + { + // PT: ### bitmap iterator pattern + const PxU32 lastSetBit = mRemovedHandleMap.findLast(); + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) + { + for(PxU32 b = bits[w]; b; b &= b-1) + { + const BoundsIndex handle = PxU32(w<<5|PxLowestSetBit(b)); + PX_ASSERT(!mVolumeData[handle].isAggregated()); + mRemovedHandles.pushBack(handle); // PT: TODO: BoundsIndex-to-ShapeHandle confusion here + } + } + } + } + + ///// + + // PT: TODO: do we need to run these threads when we origin-shifted everything before? + if(singleThreaded) + preBpUpdate_CPU(numCpuTasks); + else + mPreBpUpdateTask.removeReference(); +} + +// PT: previously known as AABBManager::updateAABBsAndBP +void AABBManager::updateBPSecondPass(PxU32 /*numCpuTasks*/, PxcScratchAllocator* scratchAllocator, PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("AABBManager::updateBPSecondPass", mContextID); + + // PT: TODO: do we need to run these threads when we origin-shifted everything before? + //finalizeUpdate(numCpuTasks, scratchAllocator, continuation); + // PT: code below used to be "finalizeUpdate" + + // PT: TODO: move to base? + const BroadPhaseUpdateData updateData(mAddedHandles.begin(), mAddedHandles.size(), + mUpdatedHandles.begin(), mUpdatedHandles.size(), + mRemovedHandles.begin(), mRemovedHandles.size(), + mBoundsArray.begin(), mGroups.begin(), mContactDistance.begin(), mBoundsArray.getCapacity(), + mFilters, + // PT: TODO: this could also be removed now. The key to understanding the refactorings is that none of the two bools below are actualy used by the CPU versions. + mBoundsArray.hasChanged(), + false); + + PX_ASSERT(updateData.isValid(false)); + + const bool b = updateData.getNumCreatedHandles() || updateData.getNumRemovedHandles(); + + //KS - skip broad phase if there are no updated shapes. + // PT: BP UPDATE CALL + if(b || updateData.getNumUpdatedHandles()) + mBroadPhase.update(scratchAllocator, updateData, continuation); +} + +void AABBManager::preBpUpdate_CPU(PxU32 numCpuTasks) +{ + PX_PROFILE_ZONE("AABBManager::preBpUpdate", mContextID); + + const bool singleThreaded = gSingleThreaded || numCpuTasks<2; + if (!singleThreaded) + { + const PxU32 size = mDirtyAggregates.size(); + for (PxU32 i = 0; imIndex] = aggregate->getMergedBounds(); + } + } +} + +static PX_FORCE_INLINE void createOverlap(PxArray* overlaps, const VolumeData* volumeData, PxU32 id0, PxU32 id1) +{ +// overlaps.pushBack(AABBOverlap(volumeData[id0].userData, volumeData[id1].userData, handle)); + const ElementType::Enum volumeType = PxMax(volumeData[id0].getVolumeType(), volumeData[id1].getVolumeType()); + //overlaps[volumeType].pushBack(AABBOverlap(reinterpret_cast(size_t(id0)), reinterpret_cast(size_t(id1)))); + + AABBOverlap* newPair = Cm::reserveContainerMemory(overlaps[volumeType], 1); + newPair->mUserData0 = reinterpret_cast(size_t(id0)); + newPair->mUserData1 = reinterpret_cast(size_t(id1)); +} + +static PX_FORCE_INLINE void deleteOverlap(PxArray* overlaps, const VolumeData* volumeData, PxU32 id0, PxU32 id1) +{ +// PX_ASSERT(volumeData[id0].userData); +// PX_ASSERT(volumeData[id1].userData); + if (volumeData[id0].getUserData() && volumeData[id1].getUserData()) // PT: TODO: no idea if this is the right thing to do or if it's normal to get null ptrs here + { + const ElementType::Enum volumeType = PxMax(volumeData[id0].getVolumeType(), volumeData[id1].getVolumeType()); +// overlaps.pushBack(AABBOverlap(volumeData[id0].userData, volumeData[id1].userData, handle)); +// overlaps[volumeType].pushBack(AABBOverlap(reinterpret_cast(size_t(id0)), reinterpret_cast(size_t(id1)))); + + AABBOverlap* deletedPair = Cm::reserveContainerMemory(overlaps[volumeType], 1); + deletedPair->mUserData0 = reinterpret_cast(size_t(id0)); + deletedPair->mUserData1 = reinterpret_cast(size_t(id1)); + } +} + +void PersistentPairs::outputDeletedOverlaps(PxArray* overlaps, const VolumeData* volumeData) +{ + const PxU32 nbActivePairs = mPM.mNbActivePairs; + for(PxU32 i=0;i* createdOverlaps, PxArray* destroyedOverlaps) +{ + if(mTimestamp==timestamp) + return; + + mTimestamp = timestamp; + + findOverlaps(mPM, bounds, contactDistances, groups, lut); + + PxU32 i=0; + PxU32 nbActivePairs = mPM.mNbActivePairs; + while(imCreatedPairs, data->mDeletedPairs); + else + p.updatePairs(mTimestamp, mBoundsArray.begin(), mContactDistance.begin(), mGroups.begin(), mFilters.getLUT(), mVolumeData.begin(), mCreatedOverlaps, mDestroyedOverlaps); +} + +static PX_FORCE_INLINE Bp::FilterType::Enum convertFilterType(PxAggregateType::Enum agType) +{ + if(agType==PxAggregateType::eGENERIC) + return Bp::FilterType::DYNAMIC; + else if(agType==PxAggregateType::eSTATIC) + return Bp::FilterType::STATIC; + PX_ASSERT(agType==PxAggregateType::eKINEMATIC); + return Bp::FilterType::KINEMATIC; +} + +PersistentActorAggregatePair* AABBManager::createPersistentActorAggregatePair(ShapeHandle volA, ShapeHandle volB) +{ + ShapeHandle actorHandle; + ShapeHandle aggregateHandle; + if(mVolumeData[volA].isAggregate()) + { + aggregateHandle = volA; + actorHandle = volB; + } + else + { + PX_ASSERT(mVolumeData[volB].isAggregate()); + aggregateHandle = volB; + actorHandle = volA; + } + const AggregateHandle h = mVolumeData[aggregateHandle].getAggregate(); + Aggregate* aggregate = getAggregateFromHandle(h); + PX_ASSERT(aggregate->mIndex==aggregateHandle); + + // Single-aggregate filtering + { + const PxAggregateType::Enum agType = PxGetAggregateType(aggregate->getFilterHint()); + const int t0 = convertFilterType(agType); + + const int t1 = mGroups[actorHandle] & BP_FILTERING_TYPE_MASK; // PT: from "groupFiltering" function + + if(!mFilters.mLUT[t0][t1]) + return NULL; + } + + return PX_NEW(PersistentActorAggregatePair)(aggregate, actorHandle); // PT: TODO: use a pool or something +} + +PersistentAggregateAggregatePair* AABBManager::createPersistentAggregateAggregatePair(ShapeHandle volA, ShapeHandle volB) +{ + PX_ASSERT(mVolumeData[volA].isAggregate() && mVolumeData[volB].isAggregate()); + const AggregateHandle h0 = mVolumeData[volA].getAggregate(); + const AggregateHandle h1 = mVolumeData[volB].getAggregate(); + Aggregate* aggregate0 = getAggregateFromHandle(h0); + Aggregate* aggregate1 = getAggregateFromHandle(h1); + PX_ASSERT(aggregate0->mIndex==volA); + PX_ASSERT(aggregate1->mIndex==volB); + + // Aggregate-aggregate filtering + { + const PxAggregateType::Enum agType0 = PxGetAggregateType(aggregate0->getFilterHint()); + const PxAggregateType::Enum agType1 = PxGetAggregateType(aggregate1->getFilterHint()); + const Bp::FilterType::Enum t0 = convertFilterType(agType0); + const Bp::FilterType::Enum t1 = convertFilterType(agType1); + if(!mFilters.mLUT[t0][t1]) + return NULL; + } + + return PX_NEW(PersistentAggregateAggregatePair)(aggregate0, aggregate1); // PT: TODO: use a pool or something +} + +void AABBManager::processBPCreatedPair(const BroadPhasePair& pair) +{ + PX_ASSERT(!mVolumeData[pair.mVolA].isAggregated()); + PX_ASSERT(!mVolumeData[pair.mVolB].isAggregated()); + const bool isSingleActorA = mVolumeData[pair.mVolA].isSingleActor(); + const bool isSingleActorB = mVolumeData[pair.mVolB].isSingleActor(); + + if(isSingleActorA && isSingleActorB) + { + createOverlap(mCreatedOverlaps, mVolumeData.begin(), pair.mVolA, pair.mVolB); // PT: regular actor-actor pair + return; + } + + // PT: TODO: check if this is needed + ShapeHandle volA = pair.mVolA; + ShapeHandle volB = pair.mVolB; + if(volBinsert(AggPair(volA, volB), newPair); + PX_UNUSED(status); + PX_ASSERT(status); + updatePairs(*newPair); + } +} + +void AABBManager::processBPDeletedPair(const BroadPhasePair& pair) +{ + PX_ASSERT(!mVolumeData[pair.mVolA].isAggregated()); + PX_ASSERT(!mVolumeData[pair.mVolB].isAggregated()); + const bool isSingleActorA = mVolumeData[pair.mVolA].isSingleActor(); + const bool isSingleActorB = mVolumeData[pair.mVolB].isSingleActor(); + + if(isSingleActorA && isSingleActorB) + { + deleteOverlap(mDestroyedOverlaps, mVolumeData.begin(), pair.mVolA, pair.mVolB); // PT: regular actor-actor pair + return; + } + + // PT: TODO: check if this is needed + ShapeHandle volA = pair.mVolA; + ShapeHandle volB = pair.mVolB; + if(volBfind(AggPair(volA, volB)); + PX_ASSERT(e); + p = e->second; + } + + p->outputDeletedOverlaps(mDestroyedOverlaps, mVolumeData.begin()); + p->mShouldBeDeleted = true; +} + +struct CreatedPairHandler +{ + static PX_FORCE_INLINE void processPair(AABBManager& manager, const BroadPhasePair& pair) { manager.processBPCreatedPair(pair); } +}; + +struct DeletedPairHandler +{ + static PX_FORCE_INLINE void processPair(AABBManager& manager, const BroadPhasePair& pair) { manager.processBPDeletedPair(pair); } +}; + +template +static void processBPPairs(PxU32 nbPairs, const BroadPhasePair* pairs, AABBManager& manager) +{ + // PT: TODO: figure out this ShapeHandle/BpHandle thing. Is it ok to use "BP_INVALID_BP_HANDLE" for a "ShapeHandle"? + ShapeHandle previousA = BP_INVALID_BP_HANDLE; + ShapeHandle previousB = BP_INVALID_BP_HANDLE; + + while(nbPairs--) + { + PX_ASSERT(pairs->mVolA!=BP_INVALID_BP_HANDLE); + PX_ASSERT(pairs->mVolB!=BP_INVALID_BP_HANDLE); + // PT: TODO: why is that test needed now? GPU broadphase? + if(pairs->mVolA != previousA || pairs->mVolB != previousB) + { + previousA = pairs->mVolA; + previousB = pairs->mVolB; + FunctionT::processPair(manager, *pairs); + } + pairs++; + } +} + +static void processAggregatePairs(AggPairMap& map, AABBManager& manager) +{ + // PT: TODO: hmmm we have a list of dirty aggregates but we don't have a list of dirty pairs. + // PT: not sure how the 3.4 trunk solves this but let's just iterate all pairs for now + // PT: atm we reuse this loop to delete removed interactions + // PT: TODO: in fact we could handle all the "lost pairs" stuff right there with extra aabb-abb tests + + // PT: TODO: replace with decent hash map - or remove the hashmap entirely and use a linear array + PxArray removedEntries; + for(AggPairMap::Iterator iter = map.getIterator(); !iter.done(); ++iter) + { + PersistentPairs* p = iter->second; + if(p->update(manager)) + { + removedEntries.pushBack(iter->first); + PX_DELETE(p); + } + } + for(PxU32 i=0;i* mArray; + PxU32 mStartIdx; + PxU32 mCount; + + PairData() : mArray(NULL), mStartIdx(0), mCount(0) + { + } +}; + +class ProcessAggPairsBase : public Cm::Task +{ +public: + static const PxU32 MaxPairs = 16; + + PairData mCreatedPairs[2]; + PairData mDestroyedPairs[2]; + + ProcessAggPairsBase(PxU64 contextID) : Cm::Task(contextID) + { + } + + void setCache(BpCacheData& data) + { + for (PxU32 i = 0; i < 2; ++i) + { + mCreatedPairs[i].mArray = &data.mCreatedPairs[i]; + mCreatedPairs[i].mStartIdx = data.mCreatedPairs[i].size(); + mDestroyedPairs[i].mArray = &data.mDeletedPairs[i]; + mDestroyedPairs[i].mStartIdx = data.mDeletedPairs[i].size(); + } + } + + void updateCounters() + { + for (PxU32 i = 0; i < 2; ++i) + { + mCreatedPairs[i].mCount = mCreatedPairs[i].mArray->size() - mCreatedPairs[i].mStartIdx; + mDestroyedPairs[i].mCount = mDestroyedPairs[i].mArray->size() - mDestroyedPairs[i].mStartIdx; + } + } +}; + +class ProcessAggPairsParallelTask : public ProcessAggPairsBase +{ +public: + PersistentPairs* mPersistentPairs[MaxPairs]; + Bp::AggPair mAggPairs[MaxPairs]; + PxU32 mNbPairs; + AABBManager* mManager; + AggPairMap* mMap; + PxMutex* mMutex; + const char* mName; + + ProcessAggPairsParallelTask(PxU64 contextID, PxMutex* mutex, AABBManager* manager, AggPairMap* map, const char* name) : ProcessAggPairsBase(contextID), + mNbPairs(0), mManager(manager), mMap(map), mMutex(mutex), mName(name) + { + } + + void runInternal() + { + BpCacheData* data = mManager->getBpCacheData(); + + setCache(*data); + + PxInlineArray removedEntries; + for (PxU32 i = 0; i < mNbPairs; ++i) + { + if(mPersistentPairs[i]->update(*mManager, data)) + { + removedEntries.pushBack(mAggPairs[i]); + PX_DELETE(mPersistentPairs[i]); + } + } + + updateCounters(); + + mManager->putBpCacheData(data); + + if (removedEntries.size()) + { + PxMutex::ScopedLock lock(*mMutex); + for (PxU32 i = 0; i < removedEntries.size(); i++) + { + bool status = mMap->erase(removedEntries[i]); + PX_ASSERT(status); + PX_UNUSED(status); + } + } + } + + virtual const char* getName() const { return mName; } +}; + +class SortAggregateBoundsParallel : public Cm::Task +{ +public: + static const PxU32 MaxPairs = 16; + Aggregate** mAggregates; + PxU32 mNbAggs; + + SortAggregateBoundsParallel(PxU64 contextID, Aggregate** aggs, PxU32 nbAggs) : Cm::Task(contextID), + mAggregates(aggs), mNbAggs(nbAggs) + { + } + + void runInternal() + { + PX_PROFILE_ZONE("SortBounds", mContextID); + for (PxU32 i = 0; i < mNbAggs; i++) + { + Aggregate* aggregate = mAggregates[i]; + + aggregate->getSortedMinBounds(); + } + } + + virtual const char* getName() const { return "SortAggregateBoundsParallel"; } +}; + +class ProcessSelfCollisionPairsParallel : public ProcessAggPairsBase +{ +public: + Aggregate** mAggregates; + PxU32 mNbAggs; + AABBManager* mManager; + + ProcessSelfCollisionPairsParallel(PxU64 contextID, Aggregate** aggs, PxU32 nbAggs, AABBManager* manager) : ProcessAggPairsBase(contextID), + mAggregates(aggs), mNbAggs(nbAggs), mManager(manager) + { + } + + void runInternal() + { + BpCacheData* data = mManager->getBpCacheData(); + setCache(*data); + PX_PROFILE_ZONE("ProcessSelfCollisionPairs", mContextID); + for (PxU32 i = 0; i < mNbAggs; i++) + { + Aggregate* aggregate = mAggregates[i]; + + // PT: TODO: don't add filtered ones to this class at all! + if(aggregate->mSelfCollisionPairs && PxGetAggregateType(aggregate->getFilterHint())!=PxAggregateType::eSTATIC) + mManager->updatePairs(*aggregate->mSelfCollisionPairs, data); + } + updateCounters(); + mManager->putBpCacheData(data); + } + + virtual const char* getName() const { return "ProcessSelfCollisionPairsParallel"; } +}; + +static void processAggregatePairsParallel(AggPairMap& map, AABBManager& manager, Cm::FlushPool& flushPool, + PxBaseTask* continuation, const char* taskName, PxArray& pairTasks) +{ + // PT: TODO: hmmm we have a list of dirty aggregates but we don't have a list of dirty pairs. + // PT: not sure how the 3.4 trunk solves this but let's just iterate all pairs for now + // PT: atm we reuse this loop to delete removed interactions + // PT: TODO: in fact we could handle all the "lost pairs" stuff right there with extra aabb-abb tests + + // PT: TODO: replace with decent hash map - or remove the hashmap entirely and use a linear array + + manager.mMapLock.lock(); + + ProcessAggPairsParallelTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ProcessAggPairsParallelTask)), ProcessAggPairsParallelTask)(0, &manager.mMapLock, &manager, &map, taskName); + + PxU32 startIdx = pairTasks.size(); + + for (AggPairMap::Iterator iter = map.getIterator(); !iter.done(); ++iter) + { + task->mAggPairs[task->mNbPairs] = iter->first; + task->mPersistentPairs[task->mNbPairs++] = iter->second; + if (task->mNbPairs == ProcessAggPairsParallelTask::MaxPairs) + { + pairTasks.pushBack(task); + task->setContinuation(continuation); + task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ProcessAggPairsParallelTask)), ProcessAggPairsParallelTask)(0, &manager.mMapLock, &manager, &map, taskName); + } + } + + manager.mMapLock.unlock(); + + for (PxU32 i = startIdx; i < pairTasks.size(); ++i) + { + pairTasks[i]->removeReference(); + } + + if (task->mNbPairs) + { + pairTasks.pushBack(task); + task->setContinuation(continuation); + task->removeReference(); + //task->runInternal(); + } +} + +void AABBManager::postBroadPhase(PxBaseTask* continuation, Cm::FlushPool& flushPool) +{ + PX_PROFILE_ZONE("AABBManager::postBroadPhase", mContextID); + + //KS - There is a continuation task for discrete broad phase, but not for CCD broad phase. PostBroadPhase for CCD broad phase runs in-line. + //This probably should be revisited but it means that we can't use the parallel codepath within CCD. + if (continuation) + { + mPostBroadPhase3.setContinuation(continuation); + mPostBroadPhase2.setContinuation(&mPostBroadPhase3); + } + + mTimestamp++; + + // PT: TODO: consider merging mCreatedOverlaps & mDestroyedOverlaps + // PT: TODO: revisit memory management of mCreatedOverlaps & mDestroyedOverlaps + + // PT: this is now only used for CPU BPs so I think the fetchBroadPhaseResults call is useless here +#ifdef REMOVED + //KS - if we ran broad phase, fetch the results now + if (mAddedHandles.size() != 0 || mUpdatedHandles.size() != 0 || mRemovedHandles.size() != 0) + { + PX_PROFILE_ZONE("AABBManager::postBroadPhase - fetchResults", mContextID); + mBroadPhase.fetchBroadPhaseResults(); + } +#endif + + for(PxU32 i=0; i(nbDeletedPairs, deletedPairs, *this); + } + + { + //If there is a continuation task, then this is not part of CCD, so we can trigger bounds to be recomputed in parallel before pair generation runs during + //stage 2. + if (continuation) + { + const PxU32 size = mDirtyAggregates.size(); + for (PxU32 i = 0; i < size; i += SortAggregateBoundsParallel::MaxPairs) + { + const PxU32 nbToProcess = PxMin(size - i, SortAggregateBoundsParallel::MaxPairs); + + SortAggregateBoundsParallel* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(SortAggregateBoundsParallel)), SortAggregateBoundsParallel) + (mContextID, &mDirtyAggregates[i], nbToProcess); + + task->setContinuation(&mPostBroadPhase2); + task->removeReference(); + } + } + } + + if (continuation) + { + mPostBroadPhase2.setFlushPool(&flushPool); + mPostBroadPhase3.removeReference(); + mPostBroadPhase2.removeReference(); + } + else + { + postBpStage2(NULL, flushPool); + postBpStage3(NULL); + } +} + +void AABBManager::reallocateChangedAABBMgActorHandleMap(const PxU32 size) +{ + mChangedHandleMap.resizeAndClear(size); +} + +void PostBroadPhaseStage2Task::runInternal() +{ + mManager.postBpStage2(mCont, *mFlushPool); +} + +void AABBManager::postBpStage2(PxBaseTask* continuation, Cm::FlushPool& flushPool) +{ + { + const PxU32 size = mDirtyAggregates.size(); + for (PxU32 i = 0; i < size; i += ProcessSelfCollisionPairsParallel::MaxPairs) + { + const PxU32 nbToProcess = PxMin(size - i, ProcessSelfCollisionPairsParallel::MaxPairs); + + ProcessSelfCollisionPairsParallel* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ProcessSelfCollisionPairsParallel)), ProcessSelfCollisionPairsParallel) + (mContextID, &mDirtyAggregates[i], nbToProcess, this); + if (continuation) + { + task->setContinuation(continuation); + task->removeReference(); + } + else + task->runInternal(); + mAggPairTasks.pushBack(task); + } + } + + { + if (continuation) + processAggregatePairsParallel(mAggregateAggregatePairs, *this, flushPool, continuation, "AggAggPairs", mAggPairTasks); + else + processAggregatePairs(mAggregateAggregatePairs, *this); + } + + { + if (continuation) + processAggregatePairsParallel(mActorAggregatePairs, *this, flushPool, continuation, "AggActorPairs", mAggPairTasks); + else + processAggregatePairs(mActorAggregatePairs, *this); + } +} + +void AABBManager::postBpStage3(PxBaseTask*) +{ + { + { + PX_PROFILE_ZONE("SimpleAABBManager::postBroadPhase - aggregate self-collisions", mContextID); + const PxU32 size = mDirtyAggregates.size(); + for (PxU32 i = 0; i < size; i++) + { + Aggregate* aggregate = mDirtyAggregates[i]; + aggregate->resetDirtyState(); + + } + mDirtyAggregates.resetOrClear(); + } + + { + PX_PROFILE_ZONE("SimpleAABBManager::postBroadPhase - append pairs", mContextID); + + for (PxU32 a = 0; a < mAggPairTasks.size(); ++a) + { + ProcessAggPairsBase* task = mAggPairTasks[a]; + for (PxU32 t = 0; t < 2; t++) + { + for (PxU32 i = 0, startIdx = task->mCreatedPairs[t].mStartIdx; i < task->mCreatedPairs[t].mCount; ++i) + { + mCreatedOverlaps[t].pushBack((*task->mCreatedPairs[t].mArray)[i + startIdx]); + } + for (PxU32 i = 0, startIdx = task->mDestroyedPairs[t].mStartIdx; i < task->mDestroyedPairs[t].mCount; ++i) + { + mDestroyedOverlaps[t].pushBack((*task->mDestroyedPairs[t].mArray)[i + startIdx]); + } + } + } + + mAggPairTasks.forceSize_Unsafe(0); + + resetBpCacheData(); + } + } + + { + PX_PROFILE_ZONE("AABBManager::postBroadPhase - process created pairs", mContextID); + + PxU32 nbCreatedPairs; + const BroadPhasePair* createdPairs = mBroadPhase.getCreatedPairs(nbCreatedPairs); + processBPPairs(nbCreatedPairs, createdPairs, *this); + } + + // PT: TODO: revisit this + // Filter out pairs in mDestroyedOverlaps that already exist in mCreatedOverlaps. This should be done better using bitmaps + // and some imposed ordering on previous operations. Later. + // We could also have a dedicated function "reinsertBroadPhase()", which would preserve the existing interactions at Sc-level. + if(1) + { + PX_PROFILE_ZONE("AABBManager::postBroadPhase - post-process", mContextID); + + PxU32 totalCreatedOverlaps = 0; + for (PxU32 idx=0; idx(mBpThreadContextPool.pop()); + if (rv == NULL) + { + rv = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(BpCacheData), "BpCacheData"), BpCacheData)(); + } + return rv; +} + +void AABBManager::putBpCacheData(BpCacheData* data) +{ + mBpThreadContextPool.push(*data); +} + +void AABBManager::resetBpCacheData() +{ + PxInlineArray bpCache; + BpCacheData* entry = static_cast(mBpThreadContextPool.pop()); + while (entry) + { + entry->reset(); + bpCache.pushBack(entry); + entry = static_cast(mBpThreadContextPool.pop()); + } + + //Now reinsert back into queue... + for (PxU32 i = 0; i < bpCache.size(); ++i) + { + mBpThreadContextPool.push(*bpCache[i]); + } +} + +// PT: disabled this by default, since it bypasses all per-shape/per-actor visualization flags +//static const bool gVisualizeAggregateElems = false; +void AABBManager::visualize(PxRenderOutput& out) +{ + const PxTransform idt = PxTransform(PxIdentity); + out << idt; + + PxBitMap bitmap; + buildFreeBitmap(bitmap, mFirstFreeAggregate, mAggregates); + + const PxU32 N = mAggregates.size(); + for(PxU32 i=0;igetNbAggregated()) + { + out << PxU32(PxDebugColor::eARGB_GREEN); + const PxBounds3& b = mBoundsArray.getBounds(aggregate->mIndex); + renderOutputDebugBox(out, b); + } + } + +/* const PxU32 N = mAggregateManager.getAggregatesCapacity(); + for(PxU32 i=0;inbElems) + { + if(!mAggregatesUpdated.isInList(BpHandle(i))) + out << PxU32(PxDebugColor::eARGB_GREEN); + else + out << PxU32(PxDebugColor::eARGB_RED); + + PxBounds3 decoded; + const IntegerAABB& iaabb = mBPElems.getAABB(aggregate->bpElemId); + iaabb.decode(decoded); + + out << DebugBox(decoded, true); + + if(gVisualizeAggregateElems) + { + PxU32 elem = aggregate->elemHeadID; + while(BP_INVALID_BP_HANDLE!=elem) + { + out << PxU32(PxDebugColor::eARGB_CYAN); + const IntegerAABB elemBounds = mAggregateElems.getAABB(elem); + elemBounds.decode(decoded); + out << DebugBox(decoded, true); + elem = mAggregateElems.getNextId(elem); + } + } + } + }*/ +} + +} //namespace Bp + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp new file mode 100644 index 0000000..cd899bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpAABBManagerBase.cpp @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpAABBManagerBase.h" +#include "BpBroadPhase.h" + +using namespace physx; +using namespace Bp; + +AABBManagerBase::AABBManagerBase( BroadPhase& bp, BoundsArray& boundsArray, PxFloatArrayPinned& contactDistance, + PxU32 maxNbAggregates, PxU32 maxNbShapes, PxVirtualAllocator& allocator, PxU64 contextID, + PxPairFilteringMode::Enum kineKineFilteringMode, PxPairFilteringMode::Enum staticKineFilteringMode) : + mAddedHandleMap (allocator), + mRemovedHandleMap (allocator), + mChangedHandleMap (allocator), + mGroups (allocator), + mContactDistance (contactDistance), + mVolumeData (allocator), + mFilters (kineKineFilteringMode == PxPairFilteringMode::eKILL, staticKineFilteringMode == PxPairFilteringMode::eKILL), + mAddedHandles (allocator), + mUpdatedHandles (allocator), + mRemovedHandles (allocator), + mBroadPhase (bp), + mBoundsArray (boundsArray), + mOutOfBoundsObjects ("AABBManager::mOutOfBoundsObjects"), + mOutOfBoundsAggregates ("AABBManager::mOutOfBoundsAggregates"), + mUsedSize (0), + mNbAggregates (0), +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + mAggregateGroupTide (PxU32(Bp::FilterGroup::eAGGREGATE_BASE)), +#endif + mContextID (contextID), + mOriginShifted (false) +{ + PX_UNUSED(maxNbAggregates); // PT: TODO: use it or remove it + reserveShapeSpace(PxMax(maxNbShapes, 1u)); + + // mCreatedOverlaps.reserve(16000); +} + +void AABBManagerBase::reserveShapeSpace(PxU32 nbTotalBounds) +{ + nbTotalBounds = PxNextPowerOfTwo(nbTotalBounds); + mGroups.resize(nbTotalBounds, Bp::FilterGroup::eINVALID); + mVolumeData.resize(nbTotalBounds); //KS - must be initialized so that userData is NULL for SQ-only shapes + mContactDistance.resizeUninitialized(nbTotalBounds); + mAddedHandleMap.resize(nbTotalBounds); + mRemovedHandleMap.resize(nbTotalBounds); +} + +void AABBManagerBase::reserveSpaceForBounds(BoundsIndex index) +{ + if ((index + 1) >= mVolumeData.size()) + reserveShapeSpace(index + 1); + + resetEntry(index); //KS - make sure this entry is flagged as invalid +} + +void AABBManagerBase::freeBuffers() +{ + // PT: TODO: investigate if we need more stuff here + mBroadPhase.freeBuffers(); +} + +void AABBManagerBase::shiftOrigin(const PxVec3& shift) +{ + mBroadPhase.shiftOrigin(shift, mBoundsArray.begin(), mContactDistance.begin()); + mOriginShifted = true; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp new file mode 100644 index 0000000..7c905ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhase.cpp @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpBroadPhase.h" +#include "BpBroadPhaseSap.h" +#include "BpBroadPhaseMBP.h" +#include "BpBroadPhaseABP.h" + +using namespace physx; +using namespace Bp; + +BroadPhase* BroadPhase::create( + const PxBroadPhaseType::Enum bpType, + const PxU32 maxNbRegions, + const PxU32 maxNbBroadPhaseOverlaps, + const PxU32 maxNbStaticShapes, + const PxU32 maxNbDynamicShapes, + PxU64 contextID) +{ + if(bpType==PxBroadPhaseType::eABP) + return PX_NEW(BroadPhaseABP)(maxNbBroadPhaseOverlaps, maxNbStaticShapes, maxNbDynamicShapes, contextID, false); + else if(bpType==PxBroadPhaseType::ePABP) + return PX_NEW(BroadPhaseABP)(maxNbBroadPhaseOverlaps, maxNbStaticShapes, maxNbDynamicShapes, contextID, true); + else if(bpType==PxBroadPhaseType::eMBP) + return PX_NEW(BroadPhaseMBP)(maxNbRegions, maxNbBroadPhaseOverlaps, maxNbStaticShapes, maxNbDynamicShapes, contextID); + else if(bpType==PxBroadPhaseType::eSAP) + return PX_NEW(BroadPhaseSap)(maxNbBroadPhaseOverlaps, maxNbStaticShapes, maxNbDynamicShapes, contextID); + else + { + PX_ASSERT(0); + return NULL; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp new file mode 100644 index 0000000..f0a697b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp @@ -0,0 +1,4327 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxProfiler.h" +#include "foundation/PxMemory.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxFPU.h" +#include "BpBroadPhaseABP.h" +#include "BpBroadPhaseShared.h" +#include "foundation/PxVecMath.h" +#include "PxcScratchAllocator.h" +#include "common/PxProfileZone.h" +#include "CmRadixSort.h" +#include "CmUtils.h" +#include "GuBounds.h" + +#include "foundation/PxThread.h" +#include "foundation/PxSync.h" +#include "task/PxTask.h" + +using namespace physx::aos; +using namespace physx; +using namespace Bp; +using namespace Cm; + +/* +PT: to try: +- prepare data: sort & compute bounds in parallel? or just MT the last loop? +- switch post update & add delayed pairs? +- MT computeCreatedDeletedPairs + +- why do we set the update flag for added/removed objects? +- use timestamps instead of bits? +*/ + +#define ABP_MT + +#define CHECKPOINT(x) +//#include +//#define CHECKPOINT(x) printf(x); + +//#pragma warning (disable : 4702) +#define CODEALIGN16 //_asm align 16 +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) + #define ABP_SIMD_OVERLAP +#endif + +//#define ABP_BATCHING 128 +#define ABP_BATCHING 256 + +//#define USE_ABP_BUCKETS 5000 // PT: don't use buckets below that number... +#define USE_ABP_BUCKETS 512 // PT: don't use buckets below that number... +//#define USE_ABP_BUCKETS 64 // PT: don't use buckets below that number... +#ifdef USE_ABP_BUCKETS + #define NB_BUCKETS 5 + // Regular version: 5 buckets a la bucket pruner (4 + cross bucket) + // Alternative version: 4 buckets + dup objects a la MBP regions +// #define USE_ALTERNATIVE_VERSION + #define ABP_USE_INTEGER_XS2 // Works but questionable speedups +#else + #define ABP_USE_INTEGER_XS +#endif +#define NB_SENTINELS 6 + +//#define RECURSE_LIMIT 20000 + + typedef PxU32 ABP_Index; + + static const bool gPrepareOverlapsFlag = true; +#ifdef ABP_SIMD_OVERLAP + static const bool gUseRegularBPKernel = false; // false to use "version 13" in box pruning series + static const bool gUnrollLoop = true; // true to use "version 14" in box pruning series +#else + // PT: tested on Switch, for some reason the regular version is fastest there + static const bool gUseRegularBPKernel = true; // false to use "version 13" in box pruning series + static const bool gUnrollLoop = false; // true to use "version 14" in box pruning series + + //ABP_SIMD_OVERLAP + //MBP.Add64KObjects 13982 ( +0.0%) 4757795 ( +0.0%) FAIL + //MBP.AddBroadPhaseRegion 0 ( +0.0%) 3213795 ( +0.0%) FAIL + //MBP.FinalizeOverlaps64KObjects 507 ( +0.0%) 5650723 ( +0.0%) FAIL + //MBP.FindOverlaps64KMixedObjects 59258 ( +0.0%) 5170179 ( +0.0%) FAIL + //MBP.FindOverlaps64KObjects 31351 ( +0.0%) 7122019 ( +0.0%) FAIL + //MBP.Remove64KObjects 4993 ( +0.0%) 5281683 ( +0.0%) FAIL + //MBP.Update64KObjects 13711 ( +0.0%) 5521699 ( +0.0%) FAIL + + //gUseRegularBPKernel: + //MBP.Add64KObjects 14406 ( +0.0%) 4757795 ( +0.0%) FAIL + //MBP.AddBroadPhaseRegion 0 ( +0.0%) 3213795 ( +0.0%) FAIL + //MBP.FinalizeOverlaps64KObjects 504 ( +0.0%) 5650723 ( +0.0%) FAIL + //MBP.FindOverlaps64KMixedObjects 48929 ( +0.0%) 5170179 ( +0.0%) FAIL + //MBP.FindOverlaps64KObjects 25636 ( +0.0%) 7122019 ( +0.0%) FAIL + //MBP.Remove64KObjects 4878 ( +0.0%) 5281683 ( +0.0%) FAIL + //MBP.Update64KObjects 13932 ( +0.0%) 5521699 ( +0.0%) FAIL + + // false/true + //MBP.Add64KObjects 14278 ( +0.0%) 4757795 ( +0.0%) FAIL + //MBP.AddBroadPhaseRegion 0 ( +0.0%) 3213795 ( +0.0%) FAIL + //MBP.FinalizeOverlaps64KObjects 504 ( +0.0%) 5650723 ( +0.0%) FAIL + //MBP.FindOverlaps64KMixedObjects 60331 ( +0.0%) 5170179 ( +0.0%) FAIL + //MBP.FindOverlaps64KObjects 32064 ( +0.0%) 7122019 ( +0.0%) FAIL + //MBP.Remove64KObjects 4930 ( +0.0%) 5281683 ( +0.0%) FAIL + //MBP.Update64KObjects 13673 ( +0.0%) 5521699 ( +0.0%) FAIL + + // false/false + //MBP.Add64KObjects 13960 ( +0.0%) 4757795 ( +0.0%) FAIL + //MBP.AddBroadPhaseRegion 0 ( +0.0%) 3213795 ( +0.0%) FAIL + //MBP.FinalizeOverlaps64KObjects 503 ( +0.0%) 5650723 ( +0.0%) FAIL + //MBP.FindOverlaps64KMixedObjects 48549 ( +0.0%) 5170179 ( +0.0%) FAIL + //MBP.FindOverlaps64KObjects 25598 ( +0.0%) 7122019 ( +0.0%) FAIL + //MBP.Remove64KObjects 4883 ( +0.0%) 5281683 ( +0.0%) FAIL + //MBP.Update64KObjects 13667 ( +0.0%) 5521699 ( +0.0%) FAIL +#endif + +#ifdef ABP_USE_INTEGER_XS + typedef PxU32 PosXType; + #define SentinelValue 0xffffffff +#else + typedef float PosXType; + #define SentinelValue FLT_MAX +#endif + +#ifdef ABP_USE_INTEGER_XS2 + typedef PxU32 PosXType2; + #define SentinelValue2 0xffffffff +#else + #ifdef ABP_USE_INTEGER_XS + typedef PxU32 PosXType2; + #define SentinelValue2 0xffffffff + #else + typedef float PosXType2; + #define SentinelValue2 FLT_MAX + #endif +#endif + +namespace internalABP +{ + struct SIMD_AABB4 : public PxUserAllocated + { + PX_FORCE_INLINE void initFrom2(const PxBounds3& box) + { +#ifdef ABP_USE_INTEGER_XS + mMinX = encodeFloat(PX_IR(box.minimum.x)); + mMaxX = encodeFloat(PX_IR(box.maximum.x)); + mMinY = box.minimum.y; + mMinZ = box.minimum.z; + mMaxY = box.maximum.y; + mMaxZ = box.maximum.z; +#else + mMinX = box.minimum.x; + mMinY = box.minimum.y; + mMinZ = box.minimum.z; + mMaxX = box.maximum.x; + mMaxY = box.maximum.y; + mMaxZ = box.maximum.z; +#endif + } + + PX_FORCE_INLINE void operator = (const SIMD_AABB4& box) + { + mMinX = box.mMinX; + mMinY = box.mMinY; + mMinZ = box.mMinZ; + mMaxX = box.mMaxX; + mMaxY = box.mMaxY; + mMaxZ = box.mMaxZ; + } + + PX_FORCE_INLINE void initSentinel() + { + mMinX = SentinelValue; + } + + PX_FORCE_INLINE bool isSentinel() const + { + return mMinX == SentinelValue; + } + +#ifdef USE_ABP_BUCKETS + // PT: to be able to compute bounds easily + PosXType mMinX; + float mMinY; + float mMinZ; + PosXType mMaxX; + float mMaxY; + float mMaxZ; +#else + PosXType mMinX; + PosXType mMaxX; + float mMinY; + float mMinZ; + float mMaxY; + float mMaxZ; +#endif + }; + +#define USE_SHARED_CLASSES +#ifdef USE_SHARED_CLASSES + struct SIMD_AABB_X4 : public AABB_Xi + { + PX_FORCE_INLINE void initFrom(const SIMD_AABB4& box) + { + #ifdef ABP_USE_INTEGER_XS2 + initFromFloats(&box.mMinX, &box.mMaxX); + #else + mMinX = box.mMinX; + mMaxX = box.mMaxX; + #endif + } + }; + + PX_ALIGN_PREFIX(16) + #ifdef ABP_SIMD_OVERLAP + struct SIMD_AABB_YZ4 : AABB_YZn + { + PX_FORCE_INLINE void initFrom(const SIMD_AABB4& box) + { + #ifdef ABP_SIMD_OVERLAP + mMinY = -box.mMinY; + mMinZ = -box.mMinZ; + #else + mMinY = box.mMinY; + mMinZ = box.mMinZ; + #endif + mMaxY = box.mMaxY; + mMaxZ = box.mMaxZ; + } + } + #else + struct SIMD_AABB_YZ4 : AABB_YZr + { + PX_FORCE_INLINE void initFrom(const SIMD_AABB4& box) + { + mMinY = box.mMinY; + mMinZ = box.mMinZ; + mMaxY = box.mMaxY; + mMaxZ = box.mMaxZ; + } + } + #endif + PX_ALIGN_SUFFIX(16); +#else + struct SIMD_AABB_X4 : public PxUserAllocated + { + PX_FORCE_INLINE void initFromFloats(const void* PX_RESTRICT minX, const void* PX_RESTRICT maxX) + { + mMinX = encodeFloat(*reinterpret_cast(minX)); + mMaxX = encodeFloat(*reinterpret_cast(maxX)); + } + + PX_FORCE_INLINE void initFrom(const SIMD_AABB4& box) + { + #ifdef ABP_USE_INTEGER_XS2 + initFromFloats(&box.mMinX, &box.mMaxX); + #else + mMinX = box.mMinX; + mMaxX = box.mMaxX; + #endif + } + + PX_FORCE_INLINE void initFromPxVec4(const PxVec4& min, const PxVec4& max) + { + #ifdef ABP_USE_INTEGER_XS2 + initFromFloats(&min.x, &max.x); + #else + #ifdef ABP_USE_INTEGER_XS + initFromFloats(&min.x, &max.x); + #else + mMinX = min.x; + mMaxX = max.x; + #endif + #endif + } + + PX_FORCE_INLINE void operator = (const SIMD_AABB_X4& box) + { + mMinX = box.mMinX; + mMaxX = box.mMaxX; + } + + PX_FORCE_INLINE void initSentinel() + { + mMinX = SentinelValue2; + } + + PX_FORCE_INLINE bool isSentinel() const + { + return mMinX == SentinelValue2; + } + + PosXType2 mMinX; + PosXType2 mMaxX; + }; + + struct SIMD_AABB_YZ4 : public PxUserAllocated + { + PX_FORCE_INLINE void initFrom(const SIMD_AABB4& box) + { + #ifdef ABP_SIMD_OVERLAP + mMinY = -box.mMinY; + mMinZ = -box.mMinZ; + #else + mMinY = box.mMinY; + mMinZ = box.mMinZ; + #endif + mMaxY = box.mMaxY; + mMaxZ = box.mMaxZ; + } + + PX_FORCE_INLINE void initFromPxVec4(const PxVec4& min, const PxVec4& max) + { + #ifdef ABP_SIMD_OVERLAP + mMinY = -min.y; + mMinZ = -min.z; + #else + mMinY = min.y; + mMinZ = min.z; + #endif + mMaxY = max.y; + mMaxZ = max.z; + } + + PX_FORCE_INLINE void operator = (const SIMD_AABB_YZ4& box) + { + V4StoreA(V4LoadA(&box.mMinY), &mMinY); + } + + float mMinY; + float mMinZ; + float mMaxY; + float mMaxZ; + }; +#endif + +#define MBP_ALLOC(x) PX_ALLOC(x, "MBP") +#define MBP_ALLOC_TMP(x) PX_ALLOC(x, "MBP_TMP") +#define MBP_FREE(x) PX_FREE(x) + +#define INVALID_ID 0xffffffff + +/////////////////////////////////////////////////////////////////////////////// + +#define DEFAULT_NB_ENTRIES 128 + + class ABP_MM + { + public: + ABP_MM() : mScratchAllocator(NULL) {} + ~ABP_MM() {} + + void* frameAlloc(PxU32 size); + void frameFree(void* address); + + PxcScratchAllocator* mScratchAllocator; + }; + +void* ABP_MM::frameAlloc(PxU32 size) +{ + if(mScratchAllocator) + return mScratchAllocator->alloc(size, true); + return PX_ALLOC(size, "frameAlloc"); +} + +void ABP_MM::frameFree(void* address) +{ + if(mScratchAllocator) + mScratchAllocator->free(address); + else + PX_FREE(address); +} + +template +static T* resizeBoxesT(PxU32 oldNbBoxes, PxU32 newNbBoxes, T* boxes) +{ + T* newBoxes = reinterpret_cast(MBP_ALLOC(sizeof(T)*newNbBoxes)); + if(oldNbBoxes) + PxMemCopy(newBoxes, boxes, oldNbBoxes*sizeof(T)); + MBP_FREE(boxes); + return newBoxes; +} + + class Boxes + { + public: + Boxes(); + ~Boxes(); + + PX_FORCE_INLINE void init(const Boxes& boxes){ mSize = boxes.mSize; mCapacity = boxes.mCapacity; } + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + PX_FORCE_INLINE PxU32 getCapacity() const { return mCapacity; } + PX_FORCE_INLINE bool isFull() const { return mSize==mCapacity; } + PX_FORCE_INLINE void reset() { mSize = mCapacity = 0; } + PX_FORCE_INLINE PxU32 popBack() { return --mSize; } + +// protected: + PxU32 mSize; + PxU32 mCapacity; + }; + +Boxes::Boxes() : + mSize (0), + mCapacity (0) +{ +} + +Boxes::~Boxes() +{ + reset(); +} + + class StraightBoxes : public Boxes + { + public: + StraightBoxes(); + ~StraightBoxes(); + + void init(PxU32 size, PxU32 capacity, SIMD_AABB4* boxes); + void reset(); + PxU32 resize(); + PxU32 resize(PxU32 incoming); + bool allocate(PxU32 nb); + + PX_FORCE_INLINE const SIMD_AABB4* getBoxes() const { return mBoxes; } + PX_FORCE_INLINE SIMD_AABB4* getBoxes() { return mBoxes; } + + PX_FORCE_INLINE void setBounds(PxU32 index, const SIMD_AABB4& box) + { + PX_ASSERT(index(boxes.getBoxes_X()); + mBoxes_YZ = const_cast(boxes.getBoxes_YZ()); +} + +PxU32 SplitBoxes::resize() +{ + const PxU32 capacity = mCapacity; + const PxU32 size = mSize; + +// const PxU32 newCapacity = capacity ? capacity + DEFAULT_NB_ENTRIES : DEFAULT_NB_ENTRIES; +// const PxU32 newCapacity = capacity ? capacity*2 : DEFAULT_NB_ENTRIES; + const PxU32 newCapacity = capacity ? capacity*2 : DEFAULT_NB_ENTRIES; + mBoxes_X = resizeBoxesT(size, newCapacity, mBoxes_X); + mBoxes_YZ = resizeBoxesT(size, newCapacity, mBoxes_YZ); + mCapacity = newCapacity; + return newCapacity; +} + +PxU32 SplitBoxes::resize(PxU32 incoming) +{ + const PxU32 capacity = mCapacity; + const PxU32 size = mSize; + const PxU32 minCapacity = size + incoming; + if(minCapacity(MBP_ALLOC(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS))); + mBoxes_YZ = reinterpret_cast(MBP_ALLOC(sizeof(SIMD_AABB_YZ4)*nb)); + PX_ASSERT(!(size_t(mBoxes_YZ) & 15)); + mSize = mCapacity = nb; + return true; +} + + typedef SplitBoxes StaticBoxes; + typedef SplitBoxes DynamicBoxes; + +/////////////////////////////////////////////////////////////////////////////// + + struct ABP_Object : public PxUserAllocated + { + PX_FORCE_INLINE ABP_Object() : mIndex(INVALID_ID) + { +#if PX_DEBUG + mUpdated = false; +#endif + } + + private: + PxU32 mIndex; // Out-to-in, maps user handle to internal array. mIndex indexes either the static or dynamic array. + // PT: the type won't be available for removed objects so we have to store it there. That uses 2 bits. + // Then the "data" will need one more bit for marking sleeping objects so that leaves 28bits for the actual index. + PX_FORCE_INLINE void setData(PxU32 index, FilterType::Enum type) + { +// mIndex = index; + index <<= 2; + index |= type; + mIndex = index; + } + public: + // PT: TODO: rename "index" to data everywhere + PX_FORCE_INLINE void setActiveIndex(PxU32 index, FilterType::Enum type) + { + const PxU32 boxData = (index+index); + setData(boxData, type); + } + + PX_FORCE_INLINE void setSleepingIndex(PxU32 index, FilterType::Enum type) + { + const PxU32 boxData = (index+index)|1; + PX_ASSERT(getType()==type); + setData(boxData, type); + } + + PX_FORCE_INLINE FilterType::Enum getType() const + { + return FilterType::Enum(mIndex&3); + } + + PX_FORCE_INLINE PxU32 getData() const + { + return mIndex>>2; + } + + PX_FORCE_INLINE void invalidateIndex() + { + mIndex = INVALID_ID; + } + PX_FORCE_INLINE bool isValid() const + { + return mIndex != INVALID_ID; + } + +#if PX_DEBUG + bool mUpdated; +#endif + }; + + typedef ABP_Object ABPEntry; + +/////////////////////////////////////////////////////////////////////////////// + +//#define BIT_ARRAY_STACK 512 + + static PX_FORCE_INLINE PxU32 bitsToDwords(PxU32 nbBits) + { + return (nbBits>>5) + ((nbBits&31) ? 1 : 0); + } + + // Use that one instead of an array of bools. Takes less ram, nearly as fast [no bounds checkings and so on]. + class BitArray + { + public: + BitArray(); + BitArray(PxU32 nbBits); + ~BitArray(); + + bool init(PxU32 nbBits); + void empty(); + void resize(PxU32 nbBits); + + PX_FORCE_INLINE void checkResize(PxU32 bitNumber) + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + resize(bitNumber); + } + + PX_FORCE_INLINE void setBitChecked(PxU32 bitNumber) + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + resize(bitNumber); + mBits[index] |= 1<<(bitNumber&31); + } + + PX_FORCE_INLINE void clearBitChecked(PxU32 bitNumber) + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + resize(bitNumber); + mBits[index] &= ~(1<<(bitNumber&31)); + } + // Data management + PX_FORCE_INLINE void setBit(PxU32 bitNumber) { mBits[bitNumber>>5] |= 1<<(bitNumber&31); } + PX_FORCE_INLINE void clearBit(PxU32 bitNumber) { mBits[bitNumber>>5] &= ~(1<<(bitNumber&31)); } + PX_FORCE_INLINE void toggleBit(PxU32 bitNumber) { mBits[bitNumber>>5] ^= 1<<(bitNumber&31); } + + PX_FORCE_INLINE void clearAll() { PxMemZero(mBits, mSize*4); } + PX_FORCE_INLINE void setAll() { PxMemSet(mBits, 0xff, mSize*4); } + + // Data access + PX_FORCE_INLINE PxIntBool isSet(PxU32 bitNumber) const { return PxIntBool(mBits[bitNumber>>5] & (1<<(bitNumber&31))); } + PX_FORCE_INLINE PxIntBool isSetChecked(PxU32 bitNumber) const + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + return 0; + return PxIntBool(mBits[index] & (1<<(bitNumber&31))); + } + + PX_FORCE_INLINE const PxU32* getBits() const { return mBits; } + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + + protected: + PxU32* mBits; //!< Array of bits + PxU32 mSize; //!< Size of the array in dwords +#ifdef BIT_ARRAY_STACK + PxU32 mStack[BIT_ARRAY_STACK]; +#endif + }; + +/////////////////////////////////////////////////////////////////////////////// + +BitArray::BitArray() : mBits(NULL), mSize(0) +{ +} + +BitArray::BitArray(PxU32 nbBits) : mBits(NULL), mSize(0) +{ + init(nbBits); +} + +BitArray::~BitArray() +{ + empty(); +} + +void BitArray::empty() +{ +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); + mBits = NULL; + mSize = 0; +} + +bool BitArray::init(PxU32 nbBits) +{ + mSize = bitsToDwords(nbBits); + // Get ram for n bits +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); +#ifdef BIT_ARRAY_STACK + if(mSize>BIT_ARRAY_STACK) +#endif + mBits = reinterpret_cast(MBP_ALLOC(sizeof(PxU32)*mSize)); +#ifdef BIT_ARRAY_STACK + else + mBits = mStack; +#endif + + // Set all bits to 0 + clearAll(); + return true; +} + +void BitArray::resize(PxU32 nbBits) +{ + const PxU32 newSize = bitsToDwords(nbBits+128); + PxU32* newBits = NULL; +#ifdef BIT_ARRAY_STACK + if(newSize>BIT_ARRAY_STACK) +#endif + { + // Old buffer was stack or allocated, new buffer is allocated + newBits = reinterpret_cast(MBP_ALLOC(sizeof(PxU32)*newSize)); + if(mSize) + PxMemCopy(newBits, mBits, sizeof(PxU32)*mSize); + } +#ifdef BIT_ARRAY_STACK + else + { + newBits = mStack; + if(mSize>BIT_ARRAY_STACK) + { + // Old buffer was allocated, new buffer is stack => copy to stack, shrink + CopyMemory(newBits, mBits, sizeof(PxU32)*BIT_ARRAY_STACK); + } + else + { + // Old buffer was stack, new buffer is stack => keep working on the same stack buffer, nothing to do + } + } +#endif + const PxU32 remain = newSize - mSize; + if(remain) + PxMemZero(newBits + mSize, remain*sizeof(PxU32)); + +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); + mBits = newBits; + mSize = newSize; +} + +/////////////////////////////////////////////////////////////////////////////// + +static ABP_Index* resizeMapping(PxU32 oldNbBoxes, PxU32 newNbBoxes, ABP_Index* mapping) +{ + ABP_Index* newMapping = reinterpret_cast(MBP_ALLOC(sizeof(ABP_Index)*newNbBoxes)); + if(oldNbBoxes) + PxMemCopy(newMapping, mapping, oldNbBoxes*sizeof(ABP_Index)); + MBP_FREE(mapping); + return newMapping; +} + + struct ABP_Object; + +#ifdef ABP_MT + struct DelayedPair + { + PxU32 mID0; + PxU32 mID1; + PxU32 mHash; + }; +#endif + + class ABP_PairManager : public PairManagerData + { + public: + ABP_PairManager(); + ~ABP_PairManager(); + + InternalPair* addPair (PxU32 id0, PxU32 id1); + void computeCreatedDeletedPairs (PxArray& createdPairs, PxArray& deletedPairs, const BitArray& updated, const BitArray& removed); +#ifdef ABP_MT + void addDelayedPair (PxArray& delayedPairs, const ABP_Index* mInToOut0, const ABP_Index* mInToOut1, PxU32 index0, PxU32 index1) const; + void addDelayedPairs (const PxArray& delayedPairs); + void addDelayedPairs2(PxArray& createdPairs, const PxArray& delayedPairs); + void resizeForNewPairs(PxU32 nbDelayedPairs); +#endif + const Bp::FilterGroup::Enum* mGroups; + const ABP_Index* mInToOut0; + const ABP_Index* mInToOut1; + const bool* mLUT; + }; + + /////////////////////////////////////////////////////////////////////////// + + struct ABP_SharedData + { + PX_FORCE_INLINE ABP_SharedData() : + mABP_Objects (NULL), + mABP_Objects_Capacity (0) + { + } + + void resize(BpHandle userID); + + PX_FORCE_INLINE void checkResize(PxU32 maxID) + { + if(mABP_Objects_CapacitycurrentCapacity) + { + const PxU32 minCapacity = PxMax(newSize, 1024u); + const PxU32 newCapacity = PxMax(minCapacity, currentCapacity*2); + PX_ASSERT(newCapacity>=newSize); + mMaxNbUpdated = newCapacity; + remap = resizeMapping(currentSize, newCapacity, mInToOut_Updated); + } + else + { + remap = mInToOut_Updated; + } + mInToOut_Updated = remap; + mNbUpdated = newSize; + + // PT: we only copy the new handles for now. The bounds will be computed later in "prepareData". + // PT: TODO: do we even need to copy them? Can't we just reuse the source ptr directly? + { + PX_ASSERT(currentSize+nb<=mMaxNbUpdated); + remap += currentSize; + PxU32 nbToGo = nb; + while(nbToGo--) + { + const BpHandle userID = *userIDs++; + + PX_ASSERT(!isNewOrUpdated(userID)); + *remap++ = markAsNewOrUpdated(userID); + + if(sharedData) + sharedData->mUpdatedObjects.setBit(userID); + } + } +} + +// PT: TODO: inline this again +void BoxManager::removeObject(ABPEntry& object, BpHandle userID) +{ + PX_UNUSED(userID); + const PxU32 boxData = object.getData(); + const PxU32 boxIndex = boxData>>1; + if(boxData&1) + { + // Sleeping object. + PX_ASSERT(boxIndex>1; + if(boxData&1) + { + // PT: benchmark for this codepath: MBP.UpdateSleeping + + // Sleeping object. We must reactivate it, i.e: + // - remove it from the array of sleeping objects + // - add it to the array of active/updated objects + + // First we remove: + { + PX_ASSERT(boxIndex also tweaking the sleeping boxes might break the "merge sleeping" array code + PX_ASSERT(mNbRemovedSleeping<=mNbSleeping); + + if(mNbRemovedSleeping==mNbSleeping) + { + // PT: remove everything + mSleepingBoxes.reset(); + PX_FREE(mInToOut_Sleeping); + mNbSleeping = mNbRemovedSleeping = 0; + return; + } + + const PxU32 expectedTotal = mNbSleeping - mNbRemovedSleeping; + PxU32 nbRemovedFound = 0; + PxU32 nbSleepingLeft = 0; + const PxU32 sleepCapacity = mSleepingBoxes.getCapacity(); + if(expectedTotal>=sleepCapacity/2) + { + // PT: remove holes, keep same data buffers + SIMD_AABB_X4* boxesX = mSleepingBoxes.getBoxes_X(); + SIMD_AABB_YZ4* boxesYZ = mSleepingBoxes.getBoxes_YZ(); + ABP_Index* remap = mInToOut_Sleeping; + + for(PxU32 i=0;i(MBP_ALLOC(sizeof(SIMD_AABB_X4)*(expectedTotal+NB_SENTINELS))); + SIMD_AABB_YZ4* dstBoxesYZ = reinterpret_cast(MBP_ALLOC(sizeof(SIMD_AABB_YZ4)*(expectedTotal+NB_SENTINELS))); + initSentinels(dstBoxesX, expectedTotal); + BpHandle* PX_RESTRICT dstRemap = reinterpret_cast(PX_ALLOC(expectedTotal*sizeof(BpHandle), "tmp")); + + const SIMD_AABB_X4* PX_RESTRICT srcDataX = mSleepingBoxes.getBoxes_X(); + const SIMD_AABB_YZ4* PX_RESTRICT srcDataYZ = mSleepingBoxes.getBoxes_YZ(); + const ABP_Index* PX_RESTRICT srcRemap = mInToOut_Sleeping; + + for(PxU32 i=0;i(memoryManager.frameAlloc(size*sizeof(PxU32))); + newOrUpdatedIDs = tempBuffer; + sleepingIndices = tempBuffer; + } + + if(isNewOrUpdated(index)) + { + // PT: new or updated object + if(!keys) + keys = reinterpret_cast(PX_ALLOC(size*sizeof(float), "tmp")); + + // PT: in this version we compute the key on-the-fly, i.e. it will be computed twice overall. We could make this + // faster by merging bounds and distances inside the AABB manager. + const BpHandle userID = removeNewOrUpdatedMark(index); + + keys[nbUpdated] = bounds[userID].minimum.x - distances[userID]; + + newOrUpdatedIDs[size - 1 - nbUpdated] = userID; +#if PX_DEBUG + SIMD_AABB4 aabb; + computeMBPBounds_Check(aabb, bounds, distances, userID); + PX_ASSERT(aabb.mMinX==keys[nbUpdated]); +#endif + nbUpdated++; + } + else + { + // PT: sleeping object + sleepingIndices[nbSleeping++] = i; + } + } + } + PX_ASSERT(nbRemoved + nbUpdated + nbSleeping == size); + + // PT: we must process the sleeping objects first, because the bounds of new sleeping objects are located in the existing updated buffers. + // PT: TODO: *HOWEVER* we could sort things right now and then reuse the "keys" buffer? + + if(nbSleeping) + { + // PT: must merge these guys to current sleeping array + // They should already be in sorted order and we should already have the boxes. +#if PX_DEBUG + const SIMD_AABB_YZ4* boxesYZ = mUpdatedBoxes.getBoxes_YZ(); + float prevKey = -FLT_MAX; + for(PxU32 ii=0;ii=prevKey); + prevKey = key; + + SIMD_AABB4 aabb; + computeMBPBounds_Check(aabb, bounds, distances, userID); + PX_ASSERT(aabb.mMinX==key); + + #ifdef ABP_SIMD_OVERLAP + PX_ASSERT(boxesYZ[i].mMinY==-aabb.mMinY); + PX_ASSERT(boxesYZ[i].mMinZ==-aabb.mMinZ); + #else + PX_ASSERT(boxesYZ[i].mMinY==aabb.mMinY); + PX_ASSERT(boxesYZ[i].mMinZ==aabb.mMinZ); + #endif + PX_ASSERT(boxesYZ[i].mMaxY==aabb.mMaxY); + PX_ASSERT(boxesYZ[i].mMaxZ==aabb.mMaxZ); + } +#endif + + if(mNbSleeping) + { + // PT: benchmark for this codepath: MBP.MergeSleeping + CHECKPOINT("Merging sleeping objects\n"); + + // PT: here, we need to merge two arrays of sleeping objects together: + // - the ones already contained inside mSleepingBoxes + // - the new sleeping objects currently contained in mUpdatedBoxes + // Both of them should already be sorted. + // PT: TODO: super subtle stuff going on there, to revisit + + // PT: TODO: revisit names + PxU32 offsetSorted = 0; + const PxU32 nbSorted = nbSleeping; + const SIMD_AABB_X4* PX_RESTRICT sortedDataX = mUpdatedBoxes.getBoxes_X(); + const SIMD_AABB_YZ4* PX_RESTRICT sortedDataYZ = mUpdatedBoxes.getBoxes_YZ(); + const ABP_Index* PX_RESTRICT sortedRemap = mInToOut_Updated; + + PxU32 offsetNonSorted = 0; + const PxU32 nbToSort = mNbSleeping; + const SIMD_AABB_X4* PX_RESTRICT toSortDataX = mSleepingBoxes.getBoxes_X(); + const SIMD_AABB_YZ4* PX_RESTRICT toSortDataYZ = mSleepingBoxes.getBoxes_YZ(); + const ABP_Index* PX_RESTRICT toSortRemap = mInToOut_Sleeping; + + PX_ASSERT(mNbRemovedSleeping<=mNbSleeping); +#if PX_DEBUG + { + PxU32 nbRemovedFound=0; + for(PxU32 i=0;i(MBP_ALLOC(sizeof(SIMD_AABB_X4)*(nbTotal+NB_SENTINELS))); + SIMD_AABB_YZ4* dstBoxesYZ = reinterpret_cast(MBP_ALLOC(sizeof(SIMD_AABB_YZ4)*(nbTotal+NB_SENTINELS))); + + initSentinels(dstBoxesX, nbTotal); + BpHandle* PX_RESTRICT dstRemap = reinterpret_cast(PX_ALLOC(nbTotal*sizeof(BpHandle), "tmp")); + + PxU32 i=0; + PxU32 nbRemovedFound=0; + PxU32 nbToGo = nbSorted + nbToSort; + while(nbToGo--) + { + PxU32 boxIndex; + { + if(nextCandidateNonSorted(PX_ALLOC(nbSleeping*sizeof(BpHandle), "tmp")); + PX_FREE(mInToOut_Sleeping); + mInToOut_Sleeping = inToOut_Sleeping; + } + else + { + inToOut_Sleeping = mInToOut_Sleeping; + } + + const SIMD_AABB_X4* srcBoxesX = mUpdatedBoxes.getBoxes_X(); + const SIMD_AABB_YZ4* srcBoxesYZ = mUpdatedBoxes.getBoxes_YZ(); + SIMD_AABB_X4* dstBoxesX = mSleepingBoxes.getBoxes_X(); + SIMD_AABB_YZ4* dstBoxesYZ = mSleepingBoxes.getBoxes_YZ(); + initSentinels(dstBoxesX, nbSleeping); + for(PxU32 ii=0;ii(memoryManager.frameAlloc(sizeof(PxU32)*nbUpdated)); + PxU32* ranks1 = reinterpret_cast(memoryManager.frameAlloc(sizeof(PxU32)*nbUpdated)); + + StackRadixSort(rs, ranks0, ranks1); + const PxU32* sorted; + { + PX_PROFILE_ZONE("Sort", contextID); + sorted = rs.Sort(keys, nbUpdated).GetRanks(); + } + + // PT: + // - shuffle the remap table, store it in sorted order (we can probably use the "recyclable" array here again) + // - compute bounds on-the-fly, store them in sorted order + + // PT: TODO: the "keys" array can be much bigger than stricly necessary here + BpHandle* inToOut_Updated_Sorted; + if(mUpdatedBoxes.allocate(nbUpdated)) + { + inToOut_Updated_Sorted = reinterpret_cast(keys); + + PX_FREE(mInToOut_Updated); + mInToOut_Updated = inToOut_Updated_Sorted; + } + else + { + PX_FREE(keys); + + inToOut_Updated_Sorted = mInToOut_Updated; + } + SIMD_AABB_X4* PX_RESTRICT dstBoxesX = mUpdatedBoxes.getBoxes_X(); + initSentinels(dstBoxesX, nbUpdated); + +#ifdef USE_ABP_BUCKETS + Vec4V minV = V4Load(FLT_MAX); + Vec4V maxV = V4Load(-FLT_MAX); +#endif + // PT: TODO: parallel? Everything indexed by i should be fine, things indexed by userID might have some false sharing + for(PxU32 i=0;i mDelayedPairs; + + const ABP_Index* mInToOut0; + const ABP_Index* mInToOut1; + + //char mBuffer[256]; + }; +} + +static PX_FORCE_INLINE void outputPair(PairManagerMT& pairManager, PxU32 index0, PxU32 index1) +{ + pairManager.mSharedPM->addDelayedPair(pairManager.mDelayedPairs, pairManager.mInToOut0, pairManager.mInToOut1, index0, index1); +} +#endif + +#ifdef ABP_MT2 + #define NB_BIP_TASKS 15 + enum ABP_TaskID + { + ABP_TASK_0, + ABP_TASK_1, + }; + + class ABP_InternalTask : public PxLightCpuTask + { + public: + ABP_InternalTask(ABP_TaskID id) : mBP(NULL), mID(id) {} + virtual const char* getName() const PX_OVERRIDE + { + return "ABP_InternalTask"; + } + + virtual void run() PX_OVERRIDE; + + BroadPhaseABP* mBP; + ABP_TaskID mID; + }; + + class ABP_CompleteBoxPruningStartTask; + + class ABP_CompleteBoxPruningTask : public PxLightCpuTask + { + public: + ABP_CompleteBoxPruningTask() : + mStartTask(NULL), + mType(0), + mID(0) + { + } + + virtual const char* getName() const PX_OVERRIDE + { + return "ABP_CompleteBoxPruningTask"; + } + + virtual void run() PX_OVERRIDE; + + ABP_CompleteBoxPruningStartTask* mStartTask; + + PxU16 mType; + PxU16 mID; + + PxU32 mCounter; + const SIMD_AABB_X4* mBoxListX; + const SIMD_AABB_YZ4* mBoxListYZ; + const PxU32* mRemap; + + PxU32 mCounter4; + const SIMD_AABB_X4* mBoxListX4; + const SIMD_AABB_YZ4* mBoxListYZ4; + const PxU32* mRemap4; + + PairManagerMT mPairs; + + PX_FORCE_INLINE bool isThereWorkToDo() const + { + if(!mCounter) + return false; + + if(mType) + return mCounter4!=0; + + return true; + } + }; + + class ABP_CompleteBoxPruningEndTask : public PxLightCpuTask + { + public: + ABP_CompleteBoxPruningEndTask() : mStartTask(NULL) {} + + virtual const char* getName() const PX_OVERRIDE + { + return "ABP_CompleteBoxPruningEndTask"; + } + + virtual void run() PX_OVERRIDE; + + ABP_CompleteBoxPruningStartTask* mStartTask; + }; + + class ABP_CompleteBoxPruningStartTask : public PxLightCpuTask + { + public: + ABP_CompleteBoxPruningStartTask(); + + virtual const char* getName() const PX_OVERRIDE + { + return "ABP_CompleteBoxPruningStartTask"; + } + + void setup( + //ABP_MM& memoryManager, + const PxBounds3& updatedBounds, + ABP_PairManager* PX_RESTRICT pairManager, + PxU32 nb, + const SIMD_AABB_X4* PX_RESTRICT listX, + const SIMD_AABB_YZ4* PX_RESTRICT listYZ, + const ABP_Index* PX_RESTRICT inputRemap, + PxU64 contextID); + + void addDelayedPairs(); + void addDelayedPairs2(PxArray& createdPairs); + + virtual void run() PX_OVERRIDE; + + const SIMD_AABB_X4* mListX; + const SIMD_AABB_YZ4* mListYZ; + const ABP_Index* mInputRemap; + ABP_PairManager* mPairManager; + + PxU32* mRemap; + SIMD_AABB_X4* mBoxListXBuffer; + SIMD_AABB_YZ4* mBoxListYZBuffer; + PxU32 mCounters[NB_BUCKETS]; + SIMD_AABB_X4* mBoxListX[NB_BUCKETS]; + SIMD_AABB_YZ4* mBoxListYZ[NB_BUCKETS]; + PxU32* mRemapBase[NB_BUCKETS]; + PxBounds3 mBounds; + PxU32 mNb; + + ABP_CompleteBoxPruningTask mTasks[9]; + ABP_CompleteBoxPruningEndTask mEndTask; + }; +#endif + + typedef BoxManager DynamicManager; + typedef BoxManager StaticManager; + + class ABP : public PxUserAllocated + { + PX_NOCOPY(ABP) + public: + ABP(PxU64 contextID); + ~ABP(); + + void preallocate(PxU32 nbObjects, PxU32 maxNbOverlaps); + void reset(); + void freeBuffers(); + + void addStaticObjects(const BpHandle* userIDs, PxU32 nb, PxU32 maxID); + void addDynamicObjects(const BpHandle* userIDs, PxU32 nb, PxU32 maxID); + void addKinematicObjects(const BpHandle* userIDs, PxU32 nb, PxU32 maxID); + void removeObject(BpHandle userID); + void updateObject(BpHandle userID); + void findOverlaps(PxBaseTask* continuation, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut); + PxU32 finalize(PxArray& createdPairs, PxArray& deletedPairs); + void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances); + + void setTransientData(const PxBounds3* bounds, const PxReal* contactDistance); + + void Region_prepareOverlaps(); + + ABP_MM mMM; + BoxManager mSBM; + DynamicManager mDBM; + RadixSortBuffered mRS; + DynamicManager mKBM; + ABP_SharedData mShared; + ABP_PairManager mPairManager; + const PxU64 mContextID; +#ifdef ABP_MT2 + ABP_InternalTask mTask0; + ABP_InternalTask mTask1; + ABP_CompleteBoxPruningStartTask mCompleteBoxPruningTask0; + ABP_CompleteBoxPruningStartTask mCompleteBoxPruningTask1; + ABP_CompleteBoxPruningTask mBipTasks[NB_BIP_TASKS]; + + void addDelayedPairs(); + void addDelayedPairs2(PxArray& createdPairs); +#endif + }; + +#ifdef ABP_SIMD_OVERLAP + #define ABP_OVERLAP_TEST(x) SIMD_OVERLAP_TEST(x) +#else + #define ABP_OVERLAP_TEST(x) if(intersect2D(box0, x)) +#endif + +/////////////////////////////////////////////////////////////////////////////// + +ABP_PairManager::ABP_PairManager() : + mGroups (NULL), + mInToOut0 (NULL), + mInToOut1 (NULL), + mLUT (NULL) +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +ABP_PairManager::~ABP_PairManager() +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +InternalPair* ABP_PairManager::addPair(PxU32 index0, PxU32 index1) +{ + const PxU32 id0 = mInToOut0[index0]; + const PxU32 id1 = mInToOut1[index1]; + PX_ASSERT(id0!=id1); + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + PX_ASSERT(mGroups); + + { + if(!groupFiltering(mGroups[id0], mGroups[id1], mLUT)) + return NULL; + } + + return addPairInternal(id0, id1); +} + +#ifdef ABP_MT +void ABP_PairManager::addDelayedPair(PxArray& delayedPairs, const ABP_Index* inToOut0, const ABP_Index* inToOut1, PxU32 index0, PxU32 index1) const +{ + /*const*/ PxU32 id0 = inToOut0[index0]; + /*const*/ PxU32 id1 = inToOut1[index1]; + PX_ASSERT(id0!=id1); + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + PX_ASSERT(mGroups); + + { + if(!groupFiltering(mGroups[id0], mGroups[id1], mLUT)) + return; + } + + if(1) + { + // Order the ids + sort(id0, id1); + + const PxU32 fullHashValue = hash(id0, id1); + PxU32 hashValue = fullHashValue & mMask; + + { + InternalPair* /*PX_RESTRICT*/ p = findPair(id0, id1, hashValue); + if(p) + { + p->setUpdated(); // ### PT: potential false sharing here + //return p; // Persistent pair + return; // Persistent pair + } + } + + { + /*// This is a new pair + if(mNbActivePairs >= mHashSize) + hashValue = growPairs(fullHashValue); + + const PxU32 pairIndex = mNbActivePairs++; + + InternalPair* PX_RESTRICT p = &mActivePairs[pairIndex]; + p->setNewPair(id0, id1); + mNext[pairIndex] = mHashTable[hashValue]; + mHashTable[hashValue] = pairIndex; + return p;*/ + + DelayedPair* newPair = Cm::reserveContainerMemory(delayedPairs, 1); + newPair->mID0 = id0; + newPair->mID1 = id1; + newPair->mHash = fullHashValue; + } + } +} + +void ABP_PairManager::resizeForNewPairs(PxU32 nbDelayedPairs) +{ + PxU32 currentNbPairs = mNbActivePairs; + + const PxU32 newNbPairs = currentNbPairs + nbDelayedPairs; + + // Get more entries + mHashSize = PxNextPowerOfTwo(newNbPairs+1); + mMask = mHashSize-1; + + //reallocPairs(); + { + MBP_FREE(mHashTable); + mHashTable = reinterpret_cast(MBP_ALLOC(mHashSize*sizeof(PxU32))); + //storeDwords(mHashTable, mHashSize, INVALID_ID); + if(0) + { + PxU32 nb = mHashSize; + PxU32* dest = mHashTable; + while(nb--) + *dest++ = INVALID_ID; + } + else + PxMemSet(mHashTable, 0xff, mHashSize*sizeof(PxU32)); + + // Get some bytes for new entries + InternalPair* newPairs = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(InternalPair))); PX_ASSERT(newPairs); + PxU32* newNext = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(PxU32))); PX_ASSERT(newNext); + + // Copy old data if needed + if(currentNbPairs) + PxMemCopy(newPairs, mActivePairs, currentNbPairs*sizeof(InternalPair)); + // ### check it's actually needed... probably only for pairs whose hash value was cut by the and + // yeah, since hash(id0, id1) is a constant + // However it might not be needed to recompute them => only less efficient but still ok + for(PxU32 i=0;i& delayedPairs) +{ + if(0) + { + PxU32 nbDelayedPairs = delayedPairs.size(); + const DelayedPair* pairs = delayedPairs.begin(); + while(nbDelayedPairs--) + { + const DelayedPair& dp = *pairs++; + + const PxU32 fullHashValue = dp.mHash; + PxU32 hashValue = fullHashValue & mMask; + + if(mNbActivePairs >= mHashSize) + hashValue = growPairs(fullHashValue); + + const PxU32 pairIndex = mNbActivePairs++; + + InternalPair* PX_RESTRICT p = &mActivePairs[pairIndex]; + p->setNewPair(dp.mID0, dp.mID1); + mNext[pairIndex] = mHashTable[hashValue]; + mHashTable[hashValue] = pairIndex; + } + } + else + { + PxU32 nbDelayedPairs = delayedPairs.size(); + PxU32 currentNbPairs = mNbActivePairs; + //resizeForNewPairs(nbDelayedPairs); + + { + const PxU32 mask = mMask; + PxU32* PX_RESTRICT hashTable = mHashTable; + PxU32* PX_RESTRICT next = mNext; + InternalPair* PX_RESTRICT internalPairs = mActivePairs; + const DelayedPair* PX_RESTRICT pairs = delayedPairs.begin(); + while(nbDelayedPairs--) + { + const DelayedPair& dp = *pairs++; + + const PxU32 fullHashValue = dp.mHash; + const PxU32 hashValue = fullHashValue & mask; + + PX_ASSERT(currentNbPairs < mHashSize); + + const PxU32 pairIndex = currentNbPairs++; + + internalPairs[pairIndex].setNewPair(dp.mID0, dp.mID1); + next[pairIndex] = hashTable[hashValue]; + hashTable[hashValue] = pairIndex; + } + mNbActivePairs = currentNbPairs; + } + } +} + +void ABP_PairManager::addDelayedPairs2(PxArray& createdPairs, const PxArray& delayedPairs) +{ + PxU32 nbDelayedPairs = delayedPairs.size(); + PxU32 currentNbPairs = mNbActivePairs; + //resizeForNewPairs(nbDelayedPairs); + + BroadPhasePair* newPair = Cm::reserveContainerMemory(createdPairs, nbDelayedPairs); + + { + const PxU32 mask = mMask; + PxU32* PX_RESTRICT hashTable = mHashTable; + PxU32* PX_RESTRICT next = mNext; + InternalPair* PX_RESTRICT internalPairs = mActivePairs; + const DelayedPair* PX_RESTRICT pairs = delayedPairs.begin(); + while(nbDelayedPairs--) + { + const DelayedPair& dp = *pairs++; + + const PxU32 fullHashValue = dp.mHash; + const PxU32 hashValue = fullHashValue & mask; + + PX_ASSERT(currentNbPairs < mHashSize); + + const PxU32 pairIndex = currentNbPairs++; + + internalPairs[pairIndex].setNewPair2(dp.mID0, dp.mID1); + { + newPair->mVolA = dp.mID0; + newPair->mVolB = dp.mID1; + newPair++; + } + + next[pairIndex] = hashTable[hashValue]; + hashTable[hashValue] = pairIndex; + } + mNbActivePairs = currentNbPairs; + } +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_INTEL_FAMILY + #define SIMD_OVERLAP_TEST_14a(box) _mm_movemask_ps(_mm_cmpngt_ps(b, _mm_load_ps(box)))==15 + + #define SIMD_OVERLAP_INIT_9c(box) \ + __m128 b = _mm_shuffle_ps(_mm_load_ps(&box.mMinY), _mm_load_ps(&box.mMinY), 78);\ + const float Coeff = -1.0f;\ + b = _mm_mul_ps(b, _mm_load1_ps(&Coeff)); + + #define SIMD_OVERLAP_TEST_9c(box) \ + const __m128 a = _mm_load_ps(&box.mMinY); \ + const __m128 d = _mm_cmpge_ps(a, b); \ + if(_mm_movemask_ps(d)==15) +#else + #define SIMD_OVERLAP_TEST_14a(box) BAllEqFFFF(V4IsGrtr(b, V4LoadA(box))) + + #define SIMD_OVERLAP_INIT_9c(box) \ + Vec4V b = V4PermZWXY(V4LoadA(&box.mMinY)); \ + b = V4Mul(b, V4Load(-1.0f)); + + #define SIMD_OVERLAP_TEST_9c(box) \ + const Vec4V a = V4LoadA(&box.mMinY); \ + const Vec4V d = V4IsGrtrOrEq(a, b); \ + if(BAllEqTTTT(d)) +#endif + +#ifdef ABP_SIMD_OVERLAP + #define SIMD_OVERLAP_PRELOAD_BOX0 SIMD_OVERLAP_INIT_9c(box0) + #define SIMD_OVERLAP_TEST(x) SIMD_OVERLAP_TEST_9c(x) +#else + #define SIMD_OVERLAP_PRELOAD_BOX0 +#endif + +#ifndef ABP_SIMD_OVERLAP +static PX_FORCE_INLINE int intersect2D(const SIMD_AABB_YZ4& a, const SIMD_AABB_YZ4& b) +{ +/* if( + b.mMaxY < a.mMinY || a.mMaxY < b.mMinY + || + b.mMaxZ < a.mMinZ || a.mMaxZ < b.mMinZ + ) + return 0; + return 1;*/ + + const bool b0 = b.mMaxY < a.mMinY; + const bool b1 = a.mMaxY < b.mMinY; + const bool b2 = b.mMaxZ < a.mMinZ; + const bool b3 = a.mMaxZ < b.mMinZ; +// const bool b4 = b0 || b1 || b2 || b3; + const bool b4 = b0 | b1 | b2 | b3; + return !b4; +} +#endif + +static PX_FORCE_INLINE void outputPair(ABP_PairManager& pairManager, PxU32 index0, PxU32 index1) +{ + pairManager.addPair(index0, index1); +} + +template +static void boxPruningKernel( PxU32 nb0, PxU32 nb1, + const SIMD_AABB_X4* PX_RESTRICT boxes0_X, const SIMD_AABB_X4* PX_RESTRICT boxes1_X, + const SIMD_AABB_YZ4* PX_RESTRICT boxes0_YZ, const SIMD_AABB_YZ4* PX_RESTRICT boxes1_YZ, + const ABP_Index* PX_RESTRICT inToOut0, const ABP_Index* PX_RESTRICT inToOut1, + ABP_PairManagerT* PX_RESTRICT pairManager) +{ + pairManager->mInToOut0 = inToOut0; + pairManager->mInToOut1 = inToOut1; + + PxU32 index0 = 0; + PxU32 runningIndex1 = 0; + + while(runningIndex1(&boxes1_YZ[runningIndex1]); + const char* const CurrentBoxListX = reinterpret_cast(&boxes1_X[runningIndex1]); + + if(!gUnrollLoop) + { + while(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) + { + const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2); +#ifdef ABP_SIMD_OVERLAP + if(SIMD_OVERLAP_TEST_14a(box)) +#else + if(intersect2D(box0, *reinterpret_cast(box))) +#endif + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes1_X))>>3; + outputPair(*pairManager, index0, Index1); + } + Offset += 8; + } + } + else + { +#define BIP_VERSION4 +#ifdef BIP_VERSION4 +#ifdef ABP_SIMD_OVERLAP + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(SIMD_OVERLAP_TEST_14a(box)) \ + goto label; } +#else + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(intersect2D(box0, *reinterpret_cast(box))) \ + goto label; } +#endif + goto StartLoop4; + CODEALIGN16 +FoundOverlap3: + Offset += 8; + CODEALIGN16 +FoundOverlap2: + Offset += 8; + CODEALIGN16 +FoundOverlap1: + Offset += 8; + CODEALIGN16 +FoundOverlap0: + Offset += 8; + CODEALIGN16 +FoundOverlap: + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - 8 - reinterpret_cast(boxes1_X))>>3; + outputPair(*pairManager, index0, Index1); + } + CODEALIGN16 +StartLoop4: + while(*reinterpret_cast(CurrentBoxListX + Offset + 8*5)<=maxLimit) + { + BLOCK4(0, FoundOverlap0) + BLOCK4(8, FoundOverlap1) + BLOCK4(16, FoundOverlap2) + BLOCK4(24, FoundOverlap3) + Offset += 40; + BLOCK4(-8, FoundOverlap) + } +#undef BLOCK4 +#endif + +#ifdef ABP_SIMD_OVERLAP + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(SIMD_OVERLAP_TEST_14a(reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto OverlapFound; \ + Offset += 8; +#else + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(intersect2D(box0, *reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto OverlapFound; \ + Offset += 8; +#endif + + goto LoopStart; + CODEALIGN16 +OverlapFound: + { + const PxU32 Index1 = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes1_X))>>3; + outputPair(*pairManager, index0, Index1); + } + Offset += 8; + CODEALIGN16 +LoopStart: + BLOCK + BLOCK + BLOCK + } + } + goto LoopStart; + } +#undef BLOCK + } + } + + index0++; + } +} + +template +static /*PX_FORCE_INLINE*/ void doBipartiteBoxPruning_Leaf( + ABP_PairManagerT* PX_RESTRICT pairManager, + PxU32 nb0, + PxU32 nb1, + const SIMD_AABB_X4* PX_RESTRICT boxes0_X, + const SIMD_AABB_X4* PX_RESTRICT boxes1_X, + const SIMD_AABB_YZ4* PX_RESTRICT boxes0_YZ, + const SIMD_AABB_YZ4* PX_RESTRICT boxes1_YZ, + const ABP_Index* PX_RESTRICT remap0, + const ABP_Index* PX_RESTRICT remap1 + ) +{ + PX_ASSERT(boxes0_X[nb0].isSentinel()); + PX_ASSERT(boxes1_X[nb1].isSentinel()); + boxPruningKernel<0>(nb0, nb1, boxes0_X, boxes1_X, boxes0_YZ, boxes1_YZ, remap0, remap1, pairManager); + boxPruningKernel<1>(nb1, nb0, boxes1_X, boxes0_X, boxes1_YZ, boxes0_YZ, remap1, remap0, pairManager); +} + +template +static PX_FORCE_INLINE void doBipartiteBoxPruning_Leaf(ABP_PairManagerT* PX_RESTRICT pairManager, + PxU32 nb0, PxU32 nb1, const SplitBoxes& boxes0, const SplitBoxes& boxes1, const ABP_Index* PX_RESTRICT remap0, const ABP_Index* PX_RESTRICT remap1) +{ + doBipartiteBoxPruning_Leaf(pairManager, nb0, nb1, boxes0.getBoxes_X(), boxes1.getBoxes_X(), boxes0.getBoxes_YZ(), boxes1.getBoxes_YZ(), remap0, remap1); +} + +template +static void doCompleteBoxPruning_Leaf( ABP_PairManagerT* PX_RESTRICT pairManager, PxU32 nb, + const SIMD_AABB_X4* PX_RESTRICT boxes_X, + const SIMD_AABB_YZ4* PX_RESTRICT boxes_YZ, + const ABP_Index* PX_RESTRICT remap) +{ + pairManager->mInToOut0 = remap; + pairManager->mInToOut1 = remap; + + PxU32 index0 = 0; + PxU32 runningIndex = 0; + while(runningIndex(&boxes_YZ[runningIndex]); + const char* const CurrentBoxListX = reinterpret_cast(&boxes_X[runningIndex]); + + if(!gUnrollLoop) + { + while(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) + { + const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2); +#ifdef ABP_SIMD_OVERLAP + if(SIMD_OVERLAP_TEST_14a(box)) +#else + if(intersect2D(box0, *reinterpret_cast(box))) +#endif + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes_X))>>3; + outputPair(*pairManager, index0, Index); + } + Offset += 8; + } + } + else + { +#define VERSION4c +#ifdef VERSION4c +#define VERSION3 // Enable this as our safe loop +#ifdef ABP_SIMD_OVERLAP + #define BLOCK4(x, label) {const float* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(SIMD_OVERLAP_TEST_14a(box)) \ + goto label; } +#else + #define BLOCK4(x, label) {const SIMD_AABB_YZ4* box = reinterpret_cast(CurrentBoxListYZ + Offset*2 + x*2); \ + if(intersect2D(box0, *box)) \ + goto label; } +#endif + goto StartLoop4; + CODEALIGN16 +FoundOverlap3: + Offset += 8; + CODEALIGN16 +FoundOverlap2: + Offset += 8; + CODEALIGN16 +FoundOverlap1: + Offset += 8; + CODEALIGN16 +FoundOverlap0: + Offset += 8; + CODEALIGN16 +FoundOverlap: + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - 8 - reinterpret_cast(boxes_X))>>3; + outputPair(*pairManager, index0, Index); + } + CODEALIGN16 +StartLoop4: + while(*reinterpret_cast(CurrentBoxListX + Offset + 8*5)<=maxLimit) + { + BLOCK4(0, FoundOverlap0) + BLOCK4(8, FoundOverlap1) + BLOCK4(16, FoundOverlap2) + BLOCK4(24, FoundOverlap3) + Offset += 40; + BLOCK4(-8, FoundOverlap) + } +#endif + +#define VERSION3 +#ifdef VERSION3 +#ifdef ABP_SIMD_OVERLAP + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(SIMD_OVERLAP_TEST_14a(reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto BeforeLoop; \ + Offset += 8; +#else + #define BLOCK if(*reinterpret_cast(CurrentBoxListX + Offset)<=maxLimit) \ + {if(intersect2D(box0, *reinterpret_cast(CurrentBoxListYZ + Offset*2))) \ + goto BeforeLoop; \ + Offset += 8; +#endif + + goto StartLoop; + CODEALIGN16 +BeforeLoop: + { + const PxU32 Index = PxU32(CurrentBoxListX + Offset - reinterpret_cast(boxes_X))>>3; + outputPair(*pairManager, index0, Index); + Offset += 8; + } + CODEALIGN16 +StartLoop: + BLOCK + BLOCK + BLOCK + BLOCK + BLOCK + } + } + } + } + goto StartLoop; + } +#endif + } + } + + index0++; + } +} + +#ifdef USE_ABP_BUCKETS +static const PxU8 gCodes[] = { 4, 4, 4, 255, 4, 3, 2, 255, + 4, 1, 0, 255, 255, 255, 255, 255 }; + +static PX_FORCE_INLINE PxU8 classifyBoxNew(const SIMD_AABB_YZ4& boxYZ, const float limitY, const float limitZ) +{ +#ifdef ABP_SIMD_OVERLAP + // PT: mins have been negated for SIMD tests + const bool upperPart = (-boxYZ.mMinZ) > limitZ; + const bool rightPart = (-boxYZ.mMinY) > limitY; +#else + const bool upperPart = boxYZ.mMinZ > limitZ; + const bool rightPart = boxYZ.mMinY > limitY; +#endif + const bool lowerPart = boxYZ.mMaxZ < limitZ; + const bool leftPart = boxYZ.mMaxY < limitY; + + // Table-based box classification avoids many branches + const PxU32 Code = PxU32(rightPart)|(PxU32(leftPart)<<1)|(PxU32(upperPart)<<2)|(PxU32(lowerPart)<<3); + PX_ASSERT(gCodes[Code]!=255); + return gCodes[Code]; +} + +#ifdef RECURSE_LIMIT +static void CompleteBoxPruning_Recursive( + ABP_MM& memoryManager, + ABP_PairManager* PX_RESTRICT pairManager, + PxU32 nb, + const SIMD_AABB_X4* PX_RESTRICT listX, + const SIMD_AABB_YZ4* PX_RESTRICT listYZ, + const ABP_Index* PX_RESTRICT remap, + const ABPEntry* PX_RESTRICT objects) +{ +// printf("CompleteBoxPruning_Recursive %d\n", nb); + if(!nb) + return; + + /*__declspec(align(16))*/ float mergedMin[4]; + /*__declspec(align(16))*/ float mergedMax[4]; + { +//#ifdef SAFE_VERSION + Vec4V maxV = V4LoadA(&listYZ[0].mMinY); + for(PxU32 i=1;i(memoryManager.frameAlloc(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS*NB_BUCKETS))); + SIMD_AABB_YZ4* BoxListYZBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_YZ4)*nb)); + + PxU32 Counters[NB_BUCKETS]; + for(PxU32 i=0;i(memoryManager.frameAlloc(sizeof(PxU32)*nb)); + PxU8* Indices = reinterpret_cast(memoryManager.frameAlloc(sizeof(PxU8)*nb)); + for(PxU32 i=0;imRemap); + PX_FREE(mStartTask->mBoxListYZBuffer); + PX_FREE(mStartTask->mBoxListXBuffer); +} + +ABP_CompleteBoxPruningStartTask::ABP_CompleteBoxPruningStartTask() : + mListX (NULL), + mListYZ (NULL), + mInputRemap (NULL), + mPairManager (NULL), + mRemap (NULL), + mBoxListXBuffer (NULL), + mBoxListYZBuffer(NULL), + mNb (0) +{ +} + +void ABP_CompleteBoxPruningStartTask::setup( + //ABP_MM& memoryManager, + const PxBounds3& updatedBounds, + ABP_PairManager* PX_RESTRICT pairManager, + PxU32 nb, + const SIMD_AABB_X4* PX_RESTRICT listX, + const SIMD_AABB_YZ4* PX_RESTRICT listYZ, + const ABP_Index* PX_RESTRICT inputRemap, + PxU64 contextID) +{ + mListX = listX; + mListYZ = listYZ; + mInputRemap = inputRemap; + mPairManager = pairManager; + + mBounds = updatedBounds; + mContextID = contextID; + mNb = nb; + + // PT: TODO: revisit allocs + //mBoxListXBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS*NB_BUCKETS))); + //mBoxListYZBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_YZ4)*nb)); + mBoxListXBuffer = reinterpret_cast(PX_ALLOC(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS*NB_BUCKETS), "mBoxListXBuffer")); + mBoxListYZBuffer = reinterpret_cast(PX_ALLOC(sizeof(SIMD_AABB_YZ4)*nb, "mBoxListYZBuffer")); + + //mRemap = reinterpret_cast(memoryManager.frameAlloc(sizeof(PxU32)*nb)); + mRemap = reinterpret_cast(PX_ALLOC(sizeof(PxU32)*nb, "mRemap")); + + mEndTask.mStartTask = this; + for(PxU32 i=0;i<9;i++) + mTasks[i].mStartTask = this; +} + +void ABP_CompleteBoxPruningStartTask::run() +{ +// printf("Running ABP_CompleteBoxPruningStartTask\n"); + + const SIMD_AABB_X4* PX_RESTRICT listX = mListX; + const SIMD_AABB_YZ4* PX_RESTRICT listYZ = mListYZ; + const ABP_Index* PX_RESTRICT remap = mInputRemap; + + const PxU32 nb = mNb; + PxU32* PX_RESTRICT Remap = mRemap; + SIMD_AABB_X4* PX_RESTRICT BoxListXBuffer = mBoxListXBuffer; + SIMD_AABB_YZ4* PX_RESTRICT BoxListYZBuffer = mBoxListYZBuffer; + PxU32* PX_RESTRICT Counters = mCounters; + + SIMD_AABB_X4** PX_RESTRICT BoxListX = mBoxListX; + SIMD_AABB_YZ4** PX_RESTRICT BoxListYZ = mBoxListYZ; + PxU32** PX_RESTRICT RemapBase = mRemapBase; + { + PX_PROFILE_ZONE("ABP_CompleteBoxPruningStartTask - Run", mContextID); + + // PT: TODO: revisit allocs + //BoxListXBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS*NB_BUCKETS))); + //BoxListYZBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_YZ4)*nb)); + + const PxVec3& mergedMin = mBounds.minimum; + const PxVec3& mergedMax = mBounds.maximum; + const float limitY = (mergedMax[1] + mergedMin[1]) * 0.5f; + const float limitZ = (mergedMax[2] + mergedMin[2]) * 0.5f; + + for(PxU32 i=0;i(memoryManager.frameAlloc(sizeof(PxU32)*nb)); + // PT: TODO: revisit allocs + //PxU8* Indices = reinterpret_cast(memoryManager.frameAlloc(sizeof(PxU8)*nb)); + PxU8* Indices = reinterpret_cast(PX_ALLOC(sizeof(PxU8)*nb, "Indices")); + { + PX_PROFILE_ZONE("BoxPruning - ClassifyBoxes", mContextID); + for(PxU32 i=0;iresizeForNewPairs(nbDelayedPairs); + } + + for(PxU32 k=0; k<9; k++) + mPairManager->addDelayedPairs(mTasks[k].mPairs.mDelayedPairs); + } +} + +void ABP_CompleteBoxPruningStartTask::addDelayedPairs2(PxArray& createdPairs) +{ + PX_PROFILE_ZONE("ABP_CompleteBoxPruningStartTask - add delayed pairs", mContextID); + + PxU32 nbDelayedPairs = 0; + for(PxU32 k=0; k<9; k++) + nbDelayedPairs += mTasks[k].mPairs.mDelayedPairs.size(); + + if(nbDelayedPairs) + { + { + PX_PROFILE_ZONE("BroadPhaseABP - resizeForNewPairs", mContextID); + mPairManager->resizeForNewPairs(nbDelayedPairs); + } + + for(PxU32 k=0; k<9; k++) + mPairManager->addDelayedPairs2(createdPairs, mTasks[k].mPairs.mDelayedPairs); + } +} +#endif + +#ifndef USE_ALTERNATIVE_VERSION +static void CompleteBoxPruning_Version16( +#ifdef ABP_MT2 + ABP_CompleteBoxPruningStartTask& completeBoxPruningTask, +#endif + ABP_MM& memoryManager, + const PxBounds3& updatedBounds, + ABP_PairManager* PX_RESTRICT pairManager, + PxU32 nb, + const SIMD_AABB_X4* PX_RESTRICT listX, + const SIMD_AABB_YZ4* PX_RESTRICT listYZ, + const ABP_Index* PX_RESTRICT remap, + PxBaseTask* continuation, PxU64 contextID) +{ + PX_UNUSED(contextID); + PX_UNUSED(continuation); + + if(!nb) + return; + +#ifdef ABP_MT2 + if(continuation) + { + completeBoxPruningTask.setup(updatedBounds, pairManager, nb, listX, listYZ, remap, contextID); + + completeBoxPruningTask.mEndTask.setContinuation(continuation); + completeBoxPruningTask.setContinuation(&completeBoxPruningTask.mEndTask); + + completeBoxPruningTask.mEndTask.removeReference(); + completeBoxPruningTask.removeReference(); + return; + } +#endif + + PxU32* Remap; + SIMD_AABB_X4* BoxListXBuffer; + SIMD_AABB_YZ4* BoxListYZBuffer; + PxU32 Counters[NB_BUCKETS]; + SIMD_AABB_X4* BoxListX[NB_BUCKETS]; + SIMD_AABB_YZ4* BoxListYZ[NB_BUCKETS]; + PxU32* RemapBase[NB_BUCKETS]; + { + PX_PROFILE_ZONE("BoxPruning - PrepareData", contextID); + + // PT: TODO: revisit allocs + BoxListXBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_X4)*(nb+NB_SENTINELS*NB_BUCKETS))); + BoxListYZBuffer = reinterpret_cast(memoryManager.frameAlloc(sizeof(SIMD_AABB_YZ4)*nb)); + + const PxVec3& mergedMin = updatedBounds.minimum; + const PxVec3& mergedMax = updatedBounds.maximum; + const float limitY = (mergedMax[1] + mergedMin[1]) * 0.5f; + const float limitZ = (mergedMax[2] + mergedMin[2]) * 0.5f; + + for(PxU32 i=0;i(memoryManager.frameAlloc(sizeof(PxU32)*nb)); + PxU8* Indices = reinterpret_cast(memoryManager.frameAlloc(sizeof(PxU8)*nb)); + { + PX_PROFILE_ZONE("BoxPruning - ClassifyBoxes", contextID); + for(PxU32 i=0;iUSE_ABP_BUCKETS) + CompleteBoxPruning_Version16( + #ifdef ABP_MT2 + completeBoxPruningTask, + #endif + memoryManager, mDBM.getUpdatedBounds(), pairManager, nbUpdated, + updatedDynamicBoxes_X, updatedDynamicBoxes_YZ, + mDBM.getRemap_Updated(), continuation, contextID); + else +#endif + { +#ifdef ABP_MT2 + if(continuation) + { + bipTask1.mCounter = nbUpdated; + bipTask1.mBoxListX = updatedDynamicBoxes_X; + bipTask1.mBoxListYZ = updatedDynamicBoxes_YZ; + bipTask1.mRemap = mDBM.getRemap_Updated(); + bipTask1.mType = 0; + + bipTask1.mPairs.mSharedPM = pairManager; + //bipTask1.mPairs.mDelayedPairs.reserve(10000); + + if(bipTask1.isThereWorkToDo()) + { + bipTask1.mID = 0; + bipTask1.setContinuation(continuation); + bipTask1.removeReference(); + } + } + else +#endif + doCompleteBoxPruning_Leaf( pairManager, nbUpdated, + updatedDynamicBoxes_X, updatedDynamicBoxes_YZ, + mDBM.getRemap_Updated()); + } + } +} + +void ABP::Region_prepareOverlaps() +{ + PX_PROFILE_ZONE("ABP - Region_prepareOverlaps", mContextID); + + if( !mDBM.isThereWorkToDo() + && !mKBM.isThereWorkToDo() + && !mSBM.isThereWorkToDo() + ) + return; + + if(mSBM.isThereWorkToDo()) + mSBM.prepareData(mRS, mShared.mABP_Objects, mShared.mABP_Objects_Capacity, mMM, mContextID); + + mDBM.prepareData(mRS, mShared.mABP_Objects, mShared.mABP_Objects_Capacity, mMM, mContextID); + mKBM.prepareData(mRS, mShared.mABP_Objects, mShared.mABP_Objects_Capacity, mMM, mContextID); + + mRS.reset(); +} + +// Finds static-vs-dynamic and dynamic-vs-dynamic overlaps +static void findAllOverlaps( +#ifdef ABP_MT2 + ABP_CompleteBoxPruningStartTask& completeBoxPruningTask, + ABP_CompleteBoxPruningTask& bipTask0, + ABP_CompleteBoxPruningTask& bipTask1, + ABP_CompleteBoxPruningTask& bipTask2, + ABP_CompleteBoxPruningTask& bipTask3, + ABP_CompleteBoxPruningTask& bipTask4, +#endif + ABP_MM& memoryManager, ABP_PairManager& pairManager, const StaticManager& mSBM, const DynamicManager& mDBM, bool doComplete, bool doBipartite, PxBaseTask* continuation, PxU64 contextID) +{ + const PxU32 nbUpdatedBoxesDynamic = mDBM.getNbUpdatedBoxes(); + + // PT: find dynamics-vs-dynamics overlaps + if(doComplete) + doCompleteBoxPruning_( +#ifdef ABP_MT2 + completeBoxPruningTask, + bipTask3, + bipTask4, +#endif + memoryManager, &pairManager, mDBM, continuation, contextID); + + // PT: find dynamics-vs-statics overlaps + if(doBipartite) + { + const PxU32 nbUpdatedBoxesStatic = mSBM.getNbUpdatedBoxes(); + const PxU32 nbNonUpdatedBoxesStatic = mSBM.getNbNonUpdatedBoxes(); + const PxU32 nbNonUpdatedBoxesDynamic = mDBM.getNbNonUpdatedBoxes(); + + // PT: in previous versions we did active-dynamics-vs-all-statics here. + if(nbUpdatedBoxesDynamic) + { + if(nbUpdatedBoxesStatic) + { + // PT: active static vs active dynamic +#ifdef ABP_MT2 + if(continuation) + { + bipTask0.mCounter = nbUpdatedBoxesDynamic; + bipTask0.mBoxListX = mDBM.getUpdatedBoxes().getBoxes_X(); + bipTask0.mBoxListYZ = mDBM.getUpdatedBoxes().getBoxes_YZ(); + bipTask0.mRemap = mDBM.getRemap_Updated(); + bipTask0.mType = 1; + + bipTask0.mCounter4 = nbUpdatedBoxesStatic; + bipTask0.mBoxListX4 = mSBM.getUpdatedBoxes().getBoxes_X(); + bipTask0.mBoxListYZ4 = mSBM.getUpdatedBoxes().getBoxes_YZ(); + bipTask0.mRemap4 = mSBM.getRemap_Updated(); + + bipTask0.mPairs.mSharedPM = &pairManager; + //bipTask0.mPairs.mDelayedPairs.reserve(10000); + + if(bipTask0.isThereWorkToDo()) + { + bipTask0.mID = 0; + bipTask0.setContinuation(continuation); + bipTask0.removeReference(); + } + } + else +#endif + doBipartiteBoxPruning_Leaf( &pairManager, + nbUpdatedBoxesDynamic, nbUpdatedBoxesStatic, + mDBM.getUpdatedBoxes(), mSBM.getUpdatedBoxes(), + mDBM.getRemap_Updated(), mSBM.getRemap_Updated()); + } + + if(nbNonUpdatedBoxesStatic) + { + // PT: sleeping static vs active dynamic +#ifdef ABP_MT2 + if(continuation) + { + bipTask1.mCounter = nbUpdatedBoxesDynamic; + bipTask1.mBoxListX = mDBM.getUpdatedBoxes().getBoxes_X(); + bipTask1.mBoxListYZ = mDBM.getUpdatedBoxes().getBoxes_YZ(); + bipTask1.mRemap = mDBM.getRemap_Updated(); + bipTask1.mType = 1; + + bipTask1.mCounter4 = nbNonUpdatedBoxesStatic; + bipTask1.mBoxListX4 = mSBM.getSleepingBoxes().getBoxes_X(); + bipTask1.mBoxListYZ4 = mSBM.getSleepingBoxes().getBoxes_YZ(); + bipTask1.mRemap4 = mSBM.getRemap_Sleeping(); + + bipTask1.mPairs.mSharedPM = &pairManager; + //bipTask1.mPairs.mDelayedPairs.reserve(10000); + + if(bipTask1.isThereWorkToDo()) + { + bipTask1.mID = 0; + bipTask1.setContinuation(continuation); + bipTask1.removeReference(); + } + } + else +#endif + doBipartiteBoxPruning_Leaf( &pairManager, + nbUpdatedBoxesDynamic, nbNonUpdatedBoxesStatic, + mDBM.getUpdatedBoxes(), mSBM.getSleepingBoxes(), + mDBM.getRemap_Updated(), mSBM.getRemap_Sleeping()); + } + } + + if(nbUpdatedBoxesStatic && nbNonUpdatedBoxesDynamic) + { + // PT: active static vs sleeping dynamic +#ifdef ABP_MT2 + if(continuation) + { + bipTask2.mCounter = nbNonUpdatedBoxesDynamic; + bipTask2.mBoxListX = mDBM.getSleepingBoxes().getBoxes_X(); + bipTask2.mBoxListYZ = mDBM.getSleepingBoxes().getBoxes_YZ(); + bipTask2.mRemap = mDBM.getRemap_Sleeping(); + bipTask2.mType = 1; + + bipTask2.mCounter4 = nbUpdatedBoxesStatic; + bipTask2.mBoxListX4 = mSBM.getUpdatedBoxes().getBoxes_X(); + bipTask2.mBoxListYZ4 = mSBM.getUpdatedBoxes().getBoxes_YZ(); + bipTask2.mRemap4 = mSBM.getRemap_Updated(); + + bipTask2.mPairs.mSharedPM = &pairManager; + //bipTask2.mPairs.mDelayedPairs.reserve(10000); + + if(bipTask2.isThereWorkToDo()) + { + bipTask2.mID = 0; + bipTask2.setContinuation(continuation); + bipTask2.removeReference(); + } + } + else +#endif + doBipartiteBoxPruning_Leaf( &pairManager, + nbNonUpdatedBoxesDynamic, nbUpdatedBoxesStatic, + mDBM.getSleepingBoxes(), mSBM.getUpdatedBoxes(), + mDBM.getRemap_Sleeping(), mSBM.getRemap_Updated()); + } + } +} + +/////////////////////////////////////////////////////////////////////////// + +ABP::ABP(PxU64 contextID) : + mSBM (FilterType::STATIC), + mDBM (FilterType::DYNAMIC), + mKBM (FilterType::KINEMATIC), + mContextID (contextID) +#ifdef ABP_MT2 + ,mTask0 (ABP_TASK_0) + ,mTask1 (ABP_TASK_1) +#endif +{ +#ifdef ABP_MT2 + mTask0.setContextId(mContextID); + mTask1.setContextId(mContextID); + mCompleteBoxPruningTask0.setContextId(mContextID); + mCompleteBoxPruningTask1.setContextId(mContextID); + for(PxU32 k=0; k<9; k++) + { + mCompleteBoxPruningTask0.mTasks[k].setContextId(mContextID); + mCompleteBoxPruningTask1.mTasks[k].setContextId(mContextID); + } + + for(PxU32 k=0; kremoveObject(object, userID); + + object.invalidateIndex(); +#if PX_DEBUG + object.mUpdated = false; +#endif +} + +void ABP::updateObject(BpHandle userID) +{ + mShared.mUpdatedObjects.setBitChecked(userID); + + PX_ASSERT(userIDupdateObject(object, userID); +} + +// PT: TODO: replace bits with timestamps? +void ABP_PairManager::computeCreatedDeletedPairs(PxArray& createdPairs, PxArray& deletedPairs, const BitArray& updated, const BitArray& removed) +{ + // PT: parse all currently active pairs. The goal here is to generate the found/lost pairs, compared to previous frame. + // PT: TODO: MT? + PxU32 i=0; + PxU32 nbActivePairs = mNbActivePairs; + while(imVolA = id0; + newPair->mVolB = id1; + // PT: TODO: replace this with bitmaps? + p.clearNew(); + p.clearUpdated(); + i++; + } + else if(p.isUpdated()) + { + // Persistent pair + + // PT: this pair already existed in the structure, and has been found again this frame. Since + // MBP reports "all pairs" each frame (as opposed to SAP), this happens quite often, for each + // active persistent pair. + p.clearUpdated(); + i++; + } + else + { + // Lost pair + + // PT: if the pair is not new and not 'updated', it might be a lost (separated) pair. But this + // is not always the case since we now handle "sleeping" objects directly within MBP. A pair + // of sleeping objects does not generate an 'addPair' call, so it ends up in this codepath. + // Nonetheless the sleeping pair should not be deleted. We can only delete pairs involving + // objects that have been actually moved during the frame. This is the only case in which + // a pair can indeed become 'lost'. + const PxU32 id0 = p.getId0(); + const PxU32 id1 = p.getId1(); + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + + // PT: if none of the involved objects have been updated, the pair is just sleeping: keep it and skip it. + if(updated.isSetChecked(id0) || updated.isSetChecked(id1)) + { + // PT: by design (for better or worse) we do not report pairs to the client when + // one of the involved objects has been deleted. The pair must still be deleted + // from the MBP structure though. + if(!removed.isSetChecked(id0) && !removed.isSetChecked(id1)) + { + // PT: doing the group-based filtering here is useless. The pair should not have + // been added in the first place. + //deletedPairs.pushBack(BroadPhasePair(id0, id1)); + BroadPhasePair* lostPair = Cm::reserveContainerMemory(deletedPairs, 1); + lostPair->mVolA = id0; + lostPair->mVolB = id1; + } + + const PxU32 hashValue = hash(id0, id1) & mMask; + removePair(id0, id1, hashValue, i); + nbActivePairs--; + } + else i++; + } + } + + shrinkMemory(); +} + +void ABP::findOverlaps(PxBaseTask* continuation, const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) +{ + PX_PROFILE_ZONE("ABP - findOverlaps", mContextID); + + mPairManager.mGroups = groups; + mPairManager.mLUT = lut; + + if(!gPrepareOverlapsFlag) + Region_prepareOverlaps(); + + bool doKineKine = true; + bool doStaticKine = true; + { + doStaticKine = lut[Bp::FilterType::KINEMATIC*Bp::FilterType::COUNT + Bp::FilterType::STATIC]; + doKineKine = lut[Bp::FilterType::KINEMATIC*Bp::FilterType::COUNT + Bp::FilterType::KINEMATIC]; + } + + // Static-vs-dynamic (bipartite) and dynamic-vs-dynamic (complete) + findAllOverlaps( +#ifdef ABP_MT2 + mCompleteBoxPruningTask0, + mBipTasks[0], + mBipTasks[1], + mBipTasks[2], + mBipTasks[3], + mBipTasks[4], +#endif + mMM, mPairManager, mSBM, mDBM, true, true, continuation, mContextID); + + // Static-vs-kinematics (bipartite) and kinematics-vs-kinematics (complete) + findAllOverlaps( +#ifdef ABP_MT2 + mCompleteBoxPruningTask1, + mBipTasks[5], + mBipTasks[6], + mBipTasks[7], + mBipTasks[8], + mBipTasks[9], +#endif + mMM, mPairManager, mSBM, mKBM, doKineKine, doStaticKine, continuation, mContextID); + + if(1) + { + findAllOverlaps( + #ifdef ABP_MT2 + mCompleteBoxPruningTask1, + mBipTasks[10], + mBipTasks[11], + mBipTasks[12], + mBipTasks[13], + mBipTasks[14], + #endif + mMM, mPairManager, mKBM, mDBM, false, true, continuation, mContextID); + } + else + { + const PxU32 nbUpdatedDynamics = mDBM.getNbUpdatedBoxes(); + const PxU32 nbNonUpdatedDynamics = mDBM.getNbNonUpdatedBoxes(); + const PxU32 nbUpdatedKinematics = mKBM.getNbUpdatedBoxes(); + const PxU32 nbNonUpdatedKinematics = mKBM.getNbNonUpdatedBoxes(); + + if(nbUpdatedDynamics) + { + // Active dynamics vs active kinematics + if(nbUpdatedKinematics) + { + doBipartiteBoxPruning_Leaf( &mPairManager, + nbUpdatedDynamics, nbUpdatedKinematics, + mDBM.getUpdatedBoxes(), mKBM.getUpdatedBoxes(), + mDBM.getRemap_Updated(), mKBM.getRemap_Updated()); + } + // Active dynamics vs inactive kinematics + if(nbNonUpdatedKinematics) + { + doBipartiteBoxPruning_Leaf( &mPairManager, + nbUpdatedDynamics, nbNonUpdatedKinematics, + mDBM.getUpdatedBoxes(), mKBM.getSleepingBoxes(), + mDBM.getRemap_Updated(), mKBM.getRemap_Sleeping()); + } + } + + if(nbUpdatedKinematics && nbNonUpdatedDynamics) + { + // Inactive dynamics vs active kinematics + doBipartiteBoxPruning_Leaf( &mPairManager, + nbNonUpdatedDynamics, nbUpdatedKinematics, + mDBM.getSleepingBoxes(), mKBM.getUpdatedBoxes(), + mDBM.getRemap_Sleeping(), mKBM.getRemap_Updated()); + } + } +} + +PxU32 ABP::finalize(PxArray& createdPairs, PxArray& deletedPairs) +{ + PX_PROFILE_ZONE("ABP - finalize", mContextID); + + { + PX_PROFILE_ZONE("computeCreatedDeletedPairs", mContextID); + + mPairManager.computeCreatedDeletedPairs(createdPairs, deletedPairs, mShared.mUpdatedObjects, mShared.mRemovedObjects); + } + + mShared.mUpdatedObjects.clearAll(); + + return mPairManager.mNbActivePairs; +} + +#ifdef ABP_MT2 +void ABP::addDelayedPairs() +{ + PX_PROFILE_ZONE("ABP - addDelayedPairs", mContextID); + + mCompleteBoxPruningTask0.addDelayedPairs(); + mCompleteBoxPruningTask1.addDelayedPairs(); + + PxU32 nbDelayedPairs = 0; + for(PxU32 k=0; k& createdPairs) +{ + PX_PROFILE_ZONE("ABP - addDelayedPairs", mContextID); + + mCompleteBoxPruningTask0.addDelayedPairs2(createdPairs); + mCompleteBoxPruningTask1.addDelayedPairs2(createdPairs); + + PxU32 nbDelayedPairs = 0; + for(PxU32 k=0; kpreallocate(nbObjects, maxNbBroadPhaseOverlaps); + + mCreated.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); + mDeleted.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); +} + +BroadPhaseABP::~BroadPhaseABP() +{ + PX_DELETE(mABP); +} + +void BroadPhaseABP::update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("BroadPhaseABP - update", mContextID); + PX_CHECK_AND_RETURN(scratchAllocator, "BroadPhaseABP::update - scratchAllocator must be non-NULL \n"); + + { + PX_PROFILE_ZONE("BroadPhaseABP - setup", mContextID); + + mABP->mMM.mScratchAllocator = scratchAllocator; + mABP->setTransientData(updateData.getAABBs(), updateData.getContactDistance()); + + const PxU32 newCapacity = updateData.getCapacity(); + mABP->mShared.checkResize(newCapacity); + +#if PX_CHECKED + // PT: WARNING: this must be done after the allocateMappingArray call + if(!BroadPhaseUpdateData::isValid(updateData, *this, false, mContextID)) + { + PX_CHECK_MSG(false, "Illegal BroadPhaseUpdateData \n"); + return; + } +#endif + + mGroups = updateData.getGroups(); + mFilter = &updateData.getFilter(); + mNbAdded = updateData.getNumCreatedHandles(); + mNbUpdated = updateData.getNumUpdatedHandles(); + mNbRemoved = updateData.getNumRemovedHandles(); + mCreatedHandles = updateData.getCreatedHandles(); + mUpdatedHandles = updateData.getUpdatedHandles(); + mRemovedHandles = updateData.getRemovedHandles(); + } + + // PT: run single-threaded if forced to do so + if(!mEnableMT) + continuation = NULL; + +#ifdef ABP_MT2 + if(continuation) + { + mABP->mTask1.mBP = this; + mABP->mTask1.setContinuation(continuation); + + mABP->mTask0.mBP = this; + mABP->mTask0.setContinuation(&mABP->mTask1); + + mABP->mTask1.removeReference(); + mABP->mTask0.removeReference(); + } + else +#endif + { + { + PX_PROFILE_ZONE("BroadPhaseABP - setUpdateData", mContextID); + + removeObjects(); + addObjects(); + updateObjects(); + + PX_ASSERT(!mCreated.size()); + PX_ASSERT(!mDeleted.size()); + + if(gPrepareOverlapsFlag) + mABP->Region_prepareOverlaps(); + } + + { + PX_PROFILE_ZONE("BroadPhaseABP - update", mContextID); + mABP->findOverlaps(continuation, mGroups, mFilter->getLUT()); + } + + { + PX_PROFILE_ZONE("BroadPhaseABP - postUpdate", mContextID); + mABP->finalize(mCreated, mDeleted); + } + } +} + +#ifdef ABP_MT2 +void ABP_InternalTask::run() +{ + PX_SIMD_GUARD + + internalABP::ABP* abp = mBP->mABP; + + if(mID==ABP_TASK_0) + { + { + PX_PROFILE_ZONE("ABP_InternalTask - setUpdateData", mContextID); + + mBP->removeObjects(); + mBP->addObjects(); + mBP->updateObjects(); + + PX_ASSERT(!mBP->mCreated.size()); + PX_ASSERT(!mBP->mDeleted.size()); + + if(gPrepareOverlapsFlag) + abp->Region_prepareOverlaps(); + } + + { + PX_PROFILE_ZONE("ABP_InternalTask - update", mContextID); + + for(PxU32 k=0;k<9;k++) + { + abp->mCompleteBoxPruningTask0.mTasks[k].mPairs.mDelayedPairs.resetOrClear(); + abp->mCompleteBoxPruningTask1.mTasks[k].mPairs.mDelayedPairs.resetOrClear(); + } + + for(PxU32 k=0;kmBipTasks[k].mPairs.mDelayedPairs.resetOrClear(); + + abp->findOverlaps(getContinuation(), mBP->mGroups, mBP->mFilter->getLUT()); + } + } + else if(mID==ABP_TASK_1) + { + //abp->addDelayedPairs(); + //abp->finalize(mBP->mCreated, mBP->mDeleted); + abp->finalize(mBP->mCreated, mBP->mDeleted); + abp->addDelayedPairs2(mBP->mCreated); + } +} +#endif + +void BroadPhaseABP::removeObjects() +{ + PX_PROFILE_ZONE("BroadPhaseABP - removeObjects", mContextID); + + PxU32 nbRemoved = mNbRemoved; + const BpHandle* removed = mRemovedHandles; + + if(!nbRemoved || !removed) + return; + + while(nbRemoved--) + { + const BpHandle index = *removed++; + PX_ASSERT(index+1mShared.mABP_Objects_Capacity); // PT: we allocated one more box on purpose + mABP->removeObject(index); + } +} + +void BroadPhaseABP::updateObjects() +{ + PX_PROFILE_ZONE("BroadPhaseABP - updateObjects", mContextID); + + PxU32 nbUpdated = mNbUpdated; + const BpHandle* updated = mUpdatedHandles; + + if(!nbUpdated || !updated) + return; + + while(nbUpdated--) + { + const BpHandle index = *updated++; + PX_ASSERT(index+1mShared.mABP_Objects_Capacity); // PT: we allocated one more box on purpose + mABP->updateObject(index); + } +} + +void BroadPhaseABP::addObjects() +{ + PX_PROFILE_ZONE("BroadPhaseABP - addObjects", mContextID); + + PxU32 nbAdded = mNbAdded; + const BpHandle* created = mCreatedHandles; + + if(!nbAdded || !created) + return; + + const Bp::FilterGroup::Enum* PX_RESTRICT groups = mGroups; + + struct Batch + { + PX_FORCE_INLINE Batch() : mNb(0), mMaxIndex(0) {} + + PxU32 mNb; + PxU32 mMaxIndex; + BpHandle mIndices[ABP_BATCHING]; + + PX_FORCE_INLINE void add(const BpHandle index, internalABP::ABP* PX_RESTRICT abp, FilterType::Enum type) + { + PxU32 nb = mNb; + mMaxIndex = PxMax(mMaxIndex, index); + mIndices[nb++] = index; + if(nb==ABP_BATCHING) + { + mNb = 0; + // PT: TODO: we could use a function ptr here + if(type==FilterType::STATIC) + abp->addStaticObjects(mIndices, ABP_BATCHING, mMaxIndex); + else if(type==FilterType::KINEMATIC) + abp->addKinematicObjects(mIndices, ABP_BATCHING, mMaxIndex); + else + { + PX_ASSERT(type==FilterType::DYNAMIC || type==FilterType::AGGREGATE); + abp->addDynamicObjects(mIndices, ABP_BATCHING, mMaxIndex); + } + + mMaxIndex = 0; + } + else + mNb = nb; + } + }; + Batch statics; + Batch dynamics; + Batch kinematics; + + Batch* batches[FilterType::COUNT] = {NULL}; + batches[FilterType::STATIC] = &statics; + batches[FilterType::DYNAMIC] = &dynamics; + batches[FilterType::AGGREGATE] = &dynamics; + batches[FilterType::KINEMATIC] = &kinematics; + + while(nbAdded--) + { + const BpHandle index = *created++; + PX_ASSERT(index+1mShared.mABP_Objects_Capacity); // PT: we allocated one more box on purpose + FilterType::Enum type = FilterType::Enum(groups[index] & BP_FILTERING_TYPE_MASK); + if(!batches[type]) + type = FilterType::DYNAMIC; + batches[type]->add(index, mABP, type); + } + + if(statics.mNb) + mABP->addStaticObjects(statics.mIndices, statics.mNb, statics.mMaxIndex); + if(kinematics.mNb) + mABP->addKinematicObjects(kinematics.mIndices, kinematics.mNb, kinematics.mMaxIndex); + if(dynamics.mNb) + mABP->addDynamicObjects(dynamics.mIndices, dynamics.mNb, dynamics.mMaxIndex); +} + +const BroadPhasePair* BroadPhaseABP::getCreatedPairs(PxU32& nbCreatedPairs) const +{ + nbCreatedPairs = mCreated.size(); + return mCreated.begin(); +} + +const BroadPhasePair* BroadPhaseABP::getDeletedPairs(PxU32& nbDeletedPairs) const +{ + nbDeletedPairs = mDeleted.size(); + return mDeleted.begin(); +} + +static void freeBuffer(PxArray& buffer) +{ + const PxU32 size = buffer.size(); + if(size>DEFAULT_CREATED_DELETED_PAIRS_CAPACITY) + { + buffer.reset(); + buffer.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); + } + else + { + buffer.clear(); + } +} + +void BroadPhaseABP::freeBuffers() +{ + PX_PROFILE_ZONE("BroadPhaseABP - freeBuffers", mContextID); + + mABP->freeBuffers(); + freeBuffer(mCreated); + freeBuffer(mDeleted); +} + +#if PX_CHECKED +bool BroadPhaseABP::isValid(const BroadPhaseUpdateData& updateData) const +{ + const PxU32 nbObjects = mABP->mShared.mABP_Objects_Capacity; + PX_UNUSED(nbObjects); + const ABP_Object* PX_RESTRICT objects = mABP->mShared.mABP_Objects; + const BpHandle* created = updateData.getCreatedHandles(); + if(created) + { + PxU32 nbToGo = updateData.getNumCreatedHandles(); + while(nbToGo--) + { + const BpHandle index = *created++; + PX_ASSERT(indexshiftOrigin(shift, boundsArray, contactDistances); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.h new file mode 100644 index 0000000..5a77b9f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseABP.h @@ -0,0 +1,98 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_ABP_H +#define BP_BROADPHASE_ABP_H + +#include "foundation/PxArray.h" +#include "BpBroadPhase.h" +#include "PxPhysXConfig.h" +#include "BpBroadPhaseUpdate.h" + +#define ABP_MT2 + +namespace internalABP{ + class ABP; +} + +namespace physx +{ +namespace Bp +{ + class BroadPhaseABP : public BroadPhase + { + PX_NOCOPY(BroadPhaseABP) + public: + BroadPhaseABP( PxU32 maxNbBroadPhaseOverlaps, + PxU32 maxNbStaticShapes, + PxU32 maxNbDynamicShapes, + PxU64 contextID, + bool enableMT); + virtual ~BroadPhaseABP(); + + // BroadPhase + virtual PxBroadPhaseType::Enum getType() const PX_OVERRIDE { return mEnableMT ? PxBroadPhaseType::ePABP : PxBroadPhaseType::eABP; } + virtual void release() PX_OVERRIDE { PX_DELETE_THIS; } + virtual void update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, physx::PxBaseTask* continuation) PX_OVERRIDE; + virtual void preBroadPhase(const Bp::BroadPhaseUpdateData&) PX_OVERRIDE {} + virtual void fetchBroadPhaseResults() PX_OVERRIDE {} + virtual const BroadPhasePair* getCreatedPairs(PxU32&) const PX_OVERRIDE; + virtual const BroadPhasePair* getDeletedPairs(PxU32&) const PX_OVERRIDE; + virtual void freeBuffers() PX_OVERRIDE; + virtual void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances) PX_OVERRIDE; +#if PX_CHECKED + virtual bool isValid(const BroadPhaseUpdateData& updateData) const PX_OVERRIDE; +#endif + //~BroadPhase + + internalABP::ABP* mABP; // PT: TODO: aggregate + PxU32 mNbAdded; + PxU32 mNbUpdated; + PxU32 mNbRemoved; + const BpHandle* mCreatedHandles; + const BpHandle* mUpdatedHandles; + const BpHandle* mRemovedHandles; + PxArray mCreated; + PxArray mDeleted; + + const Bp::FilterGroup::Enum*mGroups; + const BpFilter* mFilter; + + const PxU64 mContextID; + const bool mEnableMT; + + void addObjects(); + void removeObjects(); + void updateObjects(); + }; + +} //namespace Bp + +} //namespace physx + +#endif // BP_BROADPHASE_ABP_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseIntegerAABB.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseIntegerAABB.h new file mode 100644 index 0000000..ad65597 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseIntegerAABB.h @@ -0,0 +1,310 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_INTEGER_AABB_H +#define BP_BROADPHASE_INTEGER_AABB_H + +#include "BpFiltering.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxUnionCast.h" + +namespace physx +{ +namespace Bp +{ + + /* + \brief Encode a single float value with lossless encoding to integer + */ + PX_FORCE_INLINE PxU32 encodeFloat(PxU32 ir) + { + //we may need to check on -0 and 0 + //But it should make no practical difference. + if(ir & PX_SIGN_BITMASK) //negative? + return ~ir;//reverse sequence of negative numbers + else + return ir | PX_SIGN_BITMASK; // flip sign + } + + /* + \brief Encode a single float value with lossless encoding to integer + */ + PX_FORCE_INLINE PxU32 decodeFloat(PxU32 ir) + { + if(ir & PX_SIGN_BITMASK) //positive? + return ir & ~PX_SIGN_BITMASK; //flip sign + else + return ~ir; //undo reversal + } + + +/** +\brief Integer representation of PxBounds3 used by BroadPhase +@see BroadPhaseUpdateData +*/ + +typedef PxU32 ValType; + +class IntegerAABB +{ +public: + + enum + { + MIN_X = 0, + MIN_Y, + MIN_Z, + MAX_X, + MAX_Y, + MAX_Z + }; + + IntegerAABB(const PxBounds3& b, PxReal contactDistance) + { + const PxVec3 dist(contactDistance); + encode(PxBounds3(b.minimum - dist, b.maximum + dist)); + } + + /* + \brief Return the minimum along a specified axis + \param[in] i is the axis + */ + PX_FORCE_INLINE ValType getMin(PxU32 i) const { return (mMinMax)[MIN_X+i]; } + + /* + \brief Return the maximum along a specified axis + \param[in] i is the axis + */ + PX_FORCE_INLINE ValType getMax(PxU32 i) const { return (mMinMax)[MAX_X+i]; } + + /* + \brief Return one of the six min/max values of the bound + \param[in] isMax determines whether a min or max value is returned + \param[in] index is the axis + */ + PX_FORCE_INLINE ValType getExtent(PxU32 isMax, PxU32 index) const + { + PX_ASSERT(isMax<=1); + return (mMinMax)[3*isMax+index]; + } + + /* + \brief Return the minimum on the x axis + */ + PX_FORCE_INLINE ValType getMinX() const { return mMinMax[MIN_X]; } + + /* + \brief Return the minimum on the y axis + */ + PX_FORCE_INLINE ValType getMinY() const { return mMinMax[MIN_Y]; } + + /* + \brief Return the minimum on the z axis + */ + PX_FORCE_INLINE ValType getMinZ() const { return mMinMax[MIN_Z]; } + + /* + \brief Return the maximum on the x axis + */ + PX_FORCE_INLINE ValType getMaxX() const { return mMinMax[MAX_X]; } + + /* + \brief Return the maximum on the y axis + */ + PX_FORCE_INLINE ValType getMaxY() const { return mMinMax[MAX_Y]; } + + /* + \brief Return the maximum on the z axis + */ + PX_FORCE_INLINE ValType getMaxZ() const { return mMinMax[MAX_Z]; } + + /* + \brief Encode float bounds so they are stored as integer bounds + \param[in] bounds is the bounds to be encoded + \note The integer values of minima are always even, while the integer values of maxima are always odd + \note The encoding process masks off the last four bits for minima and masks on the last four bits for maxima. + This keeps the bounds constant when its shape is subjected to small global pose perturbations. In turn, this helps + reduce computational effort in the broadphase update by reducing the amount of sorting required on near-stationary + bodies that are aligned along one or more axis. + @see decode + */ + PX_FORCE_INLINE void encode(const PxBounds3& bounds) + { + const PxU32* PX_RESTRICT min = PxUnionCast(&bounds.minimum.x); + const PxU32* PX_RESTRICT max = PxUnionCast(&bounds.maximum.x); + //Avoid min=max by enforcing the rule that mins are even and maxs are odd. + mMinMax[MIN_X] = encodeFloatMin(min[0]); + mMinMax[MIN_Y] = encodeFloatMin(min[1]); + mMinMax[MIN_Z] = encodeFloatMin(min[2]); + mMinMax[MAX_X] = encodeFloatMax(max[0]) | (1<<2); + mMinMax[MAX_Y] = encodeFloatMax(max[1]) | (1<<2); + mMinMax[MAX_Z] = encodeFloatMax(max[2]) | (1<<2); + } + + /* + \brief Decode from integer bounds to float bounds + \param[out] bounds is the decoded float bounds + \note Encode followed by decode will produce a float bound larger than the original + due to the masking in encode. + @see encode + */ + PX_FORCE_INLINE void decode(PxBounds3& bounds) const + { + PxU32* PX_RESTRICT min = PxUnionCast(&bounds.minimum.x); + PxU32* PX_RESTRICT max = PxUnionCast(&bounds.maximum.x); + min[0] = decodeFloat(mMinMax[MIN_X]); + min[1] = decodeFloat(mMinMax[MIN_Y]); + min[2] = decodeFloat(mMinMax[MIN_Z]); + max[0] = decodeFloat(mMinMax[MAX_X]); + max[1] = decodeFloat(mMinMax[MAX_Y]); + max[2] = decodeFloat(mMinMax[MAX_Z]); + } + + /* + \brief Encode a single minimum value from integer bounds to float bounds + \note The encoding process masks off the last four bits for minima + @see encode + */ + static PX_FORCE_INLINE ValType encodeFloatMin(PxU32 source) + { + return ((encodeFloat(source) >> eGRID_SNAP_VAL) - 1) << eGRID_SNAP_VAL; + } + + /* + \brief Encode a single maximum value from integer bounds to float bounds + \note The encoding process masks on the last four bits for maxima + @see encode + */ + static PX_FORCE_INLINE ValType encodeFloatMax(PxU32 source) + { + return ((encodeFloat(source) >> eGRID_SNAP_VAL) + 1) << eGRID_SNAP_VAL; + } + + /* + \brief Shift the encoded bounds by a specified vector + \param[in] shift is the vector used to shift the bounds + */ + PX_FORCE_INLINE void shift(const PxVec3& shift) + { + ::physx::PxBounds3 elemBounds; + decode(elemBounds); + elemBounds.minimum -= shift; + elemBounds.maximum -= shift; + encode(elemBounds); + } + + /* + \brief Test if this aabb lies entirely inside another aabb + \param[in] box is the other box + \return True if this aabb lies entirely inside box + */ + PX_INLINE bool isInside(const IntegerAABB& box) const + { + if(box.mMinMax[MIN_X]>mMinMax[MIN_X]) return false; + if(box.mMinMax[MIN_Y]>mMinMax[MIN_Y]) return false; + if(box.mMinMax[MIN_Z]>mMinMax[MIN_Z]) return false; + if(box.mMinMax[MAX_X] mMinMax[MAX_X] || mMinMax[MIN_X] > b.mMinMax[MAX_X] || + b.mMinMax[MIN_Y] > mMinMax[MAX_Y] || mMinMax[MIN_Y] > b.mMinMax[MAX_Y] || + b.mMinMax[MIN_Z] > mMinMax[MAX_Z] || mMinMax[MIN_Z] > b.mMinMax[MAX_Z]); + } + + PX_FORCE_INLINE bool intersects1D(const IntegerAABB& b, const PxU32 axis) const + { + const PxU32 maxAxis = axis + 3; + return !(b.mMinMax[axis] > mMinMax[maxAxis] || mMinMax[axis] > b.mMinMax[maxAxis]); + } + + + /* + \brief Expand bounds to include another + \note This is used to compute the aggregate bounds of multiple shape bounds + \param[in] b is the bounds to be included + */ + PX_FORCE_INLINE void include(const IntegerAABB& b) + { + mMinMax[MIN_X] = PxMin(mMinMax[MIN_X], b.mMinMax[MIN_X]); + mMinMax[MIN_Y] = PxMin(mMinMax[MIN_Y], b.mMinMax[MIN_Y]); + mMinMax[MIN_Z] = PxMin(mMinMax[MIN_Z], b.mMinMax[MIN_Z]); + mMinMax[MAX_X] = PxMax(mMinMax[MAX_X], b.mMinMax[MAX_X]); + mMinMax[MAX_Y] = PxMax(mMinMax[MAX_Y], b.mMinMax[MAX_Y]); + mMinMax[MAX_Z] = PxMax(mMinMax[MAX_Z], b.mMinMax[MAX_Z]); + } + + /* + \brief Set the bounds to (max, max, max), (min, min, min) + */ + PX_INLINE void setEmpty() + { + mMinMax[MIN_X] = mMinMax[MIN_Y] = mMinMax[MIN_Z] = 0xff7fffff; //PX_IR(PX_MAX_F32); + mMinMax[MAX_X] = mMinMax[MAX_Y] = mMinMax[MAX_Z] = 0x00800000; ///PX_IR(0.0f); + } + + ValType mMinMax[6]; + +private: + + enum + { + eGRID_SNAP_VAL = 4 + }; +}; + +PX_FORCE_INLINE ValType encodeMin(const PxBounds3& bounds, PxU32 axis, PxReal contactDistance) +{ + const PxReal val = bounds.minimum[axis] - contactDistance; + const PxU32 min = PxUnionCast(val); + const PxU32 m = IntegerAABB::encodeFloatMin(min); + return m; +} + +PX_FORCE_INLINE ValType encodeMax(const PxBounds3& bounds, PxU32 axis, PxReal contactDistance) +{ + const PxReal val = bounds.maximum[axis] + contactDistance; + const PxU32 max = PxUnionCast(val); + const PxU32 m = IntegerAABB::encodeFloatMax(max) | (1<<2); + return m; +} + +} //namespace Bp + +} //namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp new file mode 100644 index 0000000..d80ead6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.cpp @@ -0,0 +1,3349 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpBroadPhaseMBP.h" +#include "BpBroadPhaseShared.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxMemory.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxHashSet.h" +#include "common/PxProfileZone.h" +#include "CmRadixSort.h" +#include "CmUtils.h" + +using namespace physx::aos; + +//#define CHECK_NB_OVERLAPS +#define USE_FULLY_INSIDE_FLAG +//#define MBP_USE_NO_CMP_OVERLAP_3D // Seems slower + +//HWSCAN: reverse bits in fully-inside-flag bitmaps because the code gives us indices for which bits are set (and we want the opposite) +#define HWSCAN + +using namespace physx; +using namespace Bp; +using namespace Cm; + + static PX_FORCE_INLINE MBP_Handle encodeHandle(MBP_ObjectIndex objectIndex, PxU32 flipFlop, bool isStatic) + { + /* objectIndex += objectIndex; + objectIndex |= flipFlop; + return objectIndex;*/ + return (objectIndex<<2)|(flipFlop<<1)|PxU32(isStatic); + } + + static PX_FORCE_INLINE MBP_ObjectIndex decodeHandle_Index(MBP_Handle handle) + { + // return handle>>1; + return handle>>2; + } + + static PX_FORCE_INLINE PxU32 decodeHandle_IsStatic(MBP_Handle handle) + { + return handle&1; + } + +#define MBP_ALLOC(x) PX_ALLOC(x, "MBP") +#define MBP_ALLOC_TMP(x) PX_ALLOC(x, "MBP_TMP") +#define MBP_FREE(x) PX_FREE(x) + +#define INVALID_ID 0xffffffff + + typedef MBP_Index* MBP_Mapping; + +/* PX_FORCE_INLINE PxU32 encodeFloat(const float val) + { + // We may need to check on -0 and 0 + // But it should make no practical difference. + PxU32 ir = IR(val); + + if(ir & 0x80000000) //negative? + ir = ~ir;//reverse sequence of negative numbers + else + ir |= 0x80000000; // flip sign + + return ir; + }*/ + +namespace internalMBP +{ + +struct RegionHandle : public PxUserAllocated +{ + PxU16 mHandle; // Handle from region + PxU16 mInternalBPHandle; // Index of region data within mRegions +}; + +enum MBPFlags +{ + MBP_FLIP_FLOP = (1<<1), + MBP_REMOVED = (1<<2) // ### added for TA24714, not needed otherwise +}; + +// We have one of those for each of the "200K" objects so we should optimize this size as much as possible +struct MBP_Object : public PxUserAllocated +{ + BpHandle mUserID; // Handle sent to us by the AABB manager + PxU16 mNbHandles; // Number of regions the object is part of + PxU16 mFlags; // MBPFlags ### only 1 bit used in the end + + PX_FORCE_INLINE bool getFlipFlop() const { return (mFlags & MBP_FLIP_FLOP)==0; } + + union + { + RegionHandle mHandle; + PxU32 mHandlesIndex; + }; +}; + +// This one is used in each Region +struct MBPEntry : public PxUserAllocated +{ + PX_FORCE_INLINE MBPEntry() + { + mMBPHandle = INVALID_ID; + } + + // ### mIndex could be PxU16 but beware, we store mFirstFree there + PxU32 mIndex; // Out-to-in, maps user handle to internal array. mIndex indexes either the static or dynamic array. + MBP_Handle mMBPHandle; // MBP-level handle (the one returned to users) +#if PX_DEBUG + bool mUpdated; +#endif + + PX_FORCE_INLINE PxU32 isStatic() const + { + return decodeHandle_IsStatic(mMBPHandle); + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +//#define BIT_ARRAY_STACK 512 + + static PX_FORCE_INLINE PxU32 bitsToDwords(PxU32 nbBits) + { + return (nbBits>>5) + ((nbBits&31) ? 1 : 0); + } + + // Use that one instead of an array of bools. Takes less ram, nearly as fast [no bounds checkings and so on]. + class BitArray + { + public: + BitArray(); + BitArray(PxU32 nbBits); + ~BitArray(); + + bool init(PxU32 nbBits); + void empty(); + void resize(PxU32 nbBits); + + PX_FORCE_INLINE void setBitChecked(PxU32 bitNumber) + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + resize(bitNumber); + mBits[index] |= 1<<(bitNumber&31); + } + + PX_FORCE_INLINE void clearBitChecked(PxU32 bitNumber) + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + resize(bitNumber); + mBits[index] &= ~(1<<(bitNumber&31)); + } + // Data management + PX_FORCE_INLINE void setBit(PxU32 bitNumber) { mBits[bitNumber>>5] |= 1<<(bitNumber&31); } + PX_FORCE_INLINE void clearBit(PxU32 bitNumber) { mBits[bitNumber>>5] &= ~(1<<(bitNumber&31)); } + PX_FORCE_INLINE void toggleBit(PxU32 bitNumber) { mBits[bitNumber>>5] ^= 1<<(bitNumber&31); } + + PX_FORCE_INLINE void clearAll() { PxMemZero(mBits, mSize*4); } + PX_FORCE_INLINE void setAll() { PxMemSet(mBits, 0xff, mSize*4); } + + // Data access + PX_FORCE_INLINE PxIntBool isSet(PxU32 bitNumber) const { return PxIntBool(mBits[bitNumber>>5] & (1<<(bitNumber&31))); } + PX_FORCE_INLINE PxIntBool isSetChecked(PxU32 bitNumber) const + { + const PxU32 index = bitNumber>>5; + if(index>=mSize) + return 0; + return PxIntBool(mBits[index] & (1<<(bitNumber&31))); + } + + PX_FORCE_INLINE const PxU32* getBits() const { return mBits; } + PX_FORCE_INLINE PxU32 getSize() const { return mSize; } + + // PT: replicate PxBitMap stuff for temp testing + PxU32 findLast() const + { + for(PxU32 i = mSize; i-- > 0;) + { + if(mBits[i]) + return (i<<5)+PxHighestSetBit(mBits[i]); + } + return PxU32(0); + } + protected: + PxU32* mBits; //!< Array of bits + PxU32 mSize; //!< Size of the array in dwords +#ifdef BIT_ARRAY_STACK + PxU32 mStack[BIT_ARRAY_STACK]; +#endif + }; + +/////////////////////////////////////////////////////////////////////////////// + +BitArray::BitArray() : mBits(NULL), mSize(0) +{ +} + +BitArray::BitArray(PxU32 nbBits) : mBits(NULL), mSize(0) +{ + init(nbBits); +} + +BitArray::~BitArray() +{ + empty(); +} + +void BitArray::empty() +{ +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); + mBits = NULL; + mSize = 0; +} + +bool BitArray::init(PxU32 nbBits) +{ + mSize = bitsToDwords(nbBits); + // Get ram for n bits +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); +#ifdef BIT_ARRAY_STACK + if(mSize>BIT_ARRAY_STACK) +#endif + mBits = reinterpret_cast(MBP_ALLOC(sizeof(PxU32)*mSize)); +#ifdef BIT_ARRAY_STACK + else + mBits = mStack; +#endif + + // Set all bits to 0 + clearAll(); + return true; +} + +void BitArray::resize(PxU32 nbBits) +{ + const PxU32 newSize = bitsToDwords(nbBits+128); + PxU32* newBits = NULL; +#ifdef BIT_ARRAY_STACK + if(newSize>BIT_ARRAY_STACK) +#endif + { + // Old buffer was stack or allocated, new buffer is allocated + newBits = reinterpret_cast(MBP_ALLOC(sizeof(PxU32)*newSize)); + if(mSize) + PxMemCopy(newBits, mBits, sizeof(PxU32)*mSize); + } +#ifdef BIT_ARRAY_STACK + else + { + newBits = mStack; + if(mSize>BIT_ARRAY_STACK) + { + // Old buffer was allocated, new buffer is stack => copy to stack, shrink + CopyMemory(newBits, mBits, sizeof(PxU32)*BIT_ARRAY_STACK); + } + else + { + // Old buffer was stack, new buffer is stack => keep working on the same stack buffer, nothing to do + } + } +#endif + const PxU32 remain = newSize - mSize; + if(remain) + PxMemZero(newBits + mSize, remain*sizeof(PxU32)); + +#ifdef BIT_ARRAY_STACK + if(mBits!=mStack) +#endif + MBP_FREE(mBits); + mBits = newBits; + mSize = newSize; +} + +#ifdef USE_FULLY_INSIDE_FLAG +static PX_FORCE_INLINE void setBit(BitArray& bitmap, MBP_ObjectIndex objectIndex) +{ + #ifdef HWSCAN + bitmap.clearBitChecked(objectIndex); //HWSCAN + #else + bitmap.setBitChecked(objectIndex); + #endif +} + +static PX_FORCE_INLINE void clearBit(BitArray& bitmap, MBP_ObjectIndex objectIndex) +{ + #ifdef HWSCAN + bitmap.setBitChecked(objectIndex); // HWSCAN + #else + bitmap.clearBitChecked(objectIndex); + #endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef MBP_SIMD_OVERLAP + typedef SIMD_AABB MBP_AABB; +#else + typedef IAABB MBP_AABB; +#endif + + struct MBPEntry; + struct RegionHandle; + struct MBP_Object; + + class MBP_PairManager : public PairManagerData + { + public: + MBP_PairManager(); + ~MBP_PairManager(); + + InternalPair* addPair (PxU32 id0, PxU32 id1); +// bool removePair (PxU32 id0, PxU32 id1); + bool computeCreatedDeletedPairs (const MBP_Object* objects, BroadPhaseMBP* mbp, const BitArray& updated, const BitArray& removed); + + const Bp::FilterGroup::Enum* mGroups; + const MBP_Object* mObjects; + const bool* mLUT; + }; + + /////////////////////////////////////////////////////////////////////////// + + #define STACK_BUFFER_SIZE 256 + struct MBPOS_TmpBuffers + { + MBPOS_TmpBuffers(); + ~MBPOS_TmpBuffers(); + + void allocateSleeping(PxU32 nbSleeping, PxU32 nbSentinels); + void allocateUpdated(PxU32 nbUpdated, PxU32 nbSentinels); + + // PT: wtf, why doesn't the 128 version compile? +// MBP_AABB PX_ALIGN(128, mSleepingDynamicBoxes_Stack[STACK_BUFFER_SIZE]); +// MBP_AABB PX_ALIGN(128, mUpdatedDynamicBoxes_Stack[STACK_BUFFER_SIZE]); + MBP_AABB PX_ALIGN(16, mSleepingDynamicBoxes_Stack[STACK_BUFFER_SIZE]); + MBP_AABB PX_ALIGN(16, mUpdatedDynamicBoxes_Stack[STACK_BUFFER_SIZE]); + MBP_Index mInToOut_Dynamic_Sleeping_Stack[STACK_BUFFER_SIZE]; + + PxU32 mNbSleeping; + PxU32 mNbUpdated; + MBP_Index* mInToOut_Dynamic_Sleeping; + MBP_AABB* mSleepingDynamicBoxes; + MBP_AABB* mUpdatedDynamicBoxes; + }; + + struct BIP_Input + { + BIP_Input() : + mObjects (NULL), + mNbUpdatedBoxes (0), + mNbStaticBoxes (0), + mDynamicBoxes (NULL), + mStaticBoxes (NULL), + mInToOut_Static (NULL), + mInToOut_Dynamic(NULL), + mNeeded (false) + { + } + + const MBPEntry* mObjects; + PxU32 mNbUpdatedBoxes; + PxU32 mNbStaticBoxes; + const MBP_AABB* mDynamicBoxes; + const MBP_AABB* mStaticBoxes; + const MBP_Index* mInToOut_Static; + const MBP_Index* mInToOut_Dynamic; + bool mNeeded; + }; + + struct BoxPruning_Input + { + BoxPruning_Input() : + mObjects (NULL), + mUpdatedDynamicBoxes (NULL), + mSleepingDynamicBoxes (NULL), + mInToOut_Dynamic (NULL), + mInToOut_Dynamic_Sleeping (NULL), + mNbUpdated (0), + mNbNonUpdated (0), + mNeeded (false) + { + } + + const MBPEntry* mObjects; + const MBP_AABB* mUpdatedDynamicBoxes; + const MBP_AABB* mSleepingDynamicBoxes; + const MBP_Index* mInToOut_Dynamic; + const MBP_Index* mInToOut_Dynamic_Sleeping; + PxU32 mNbUpdated; + PxU32 mNbNonUpdated; + bool mNeeded; + + BIP_Input mBIPInput; + }; + + class Region : public PxUserAllocated + { + PX_NOCOPY(Region) + public: + Region(); + ~Region(); + + void updateObject(const MBP_AABB& bounds, MBP_Index handle); + MBP_Index addObject(const MBP_AABB& bounds, MBP_Handle mbpHandle, bool isStatic); + void removeObject(MBP_Index handle); + MBP_Handle retrieveBounds(MBP_AABB& bounds, MBP_Index handle) const; + void setBounds(MBP_Index handle, const MBP_AABB& bounds); + void prepareOverlaps(); + void findOverlaps(MBP_PairManager& pairManager); + +// private: + BoxPruning_Input PX_ALIGN(16, mInput); + PxU32 mNbObjects; + PxU32 mMaxNbObjects; + PxU32 mFirstFree; + MBPEntry* mObjects; // All objects, indexed by user handle + PxU32 mMaxNbStaticBoxes; + PxU32 mNbStaticBoxes; + PxU32 mMaxNbDynamicBoxes; + PxU32 mNbDynamicBoxes; + MBP_AABB* mStaticBoxes; + MBP_AABB* mDynamicBoxes; + MBP_Mapping mInToOut_Static; // Maps static boxes to mObjects + MBP_Mapping mInToOut_Dynamic; // Maps dynamic boxes to mObjects + PxU32* mPosList; + PxU32 mNbUpdatedBoxes; + PxU32 mPrevNbUpdatedBoxes; + BitArray mStaticBits; + RadixSortBuffered mRS; + bool mNeedsSorting; + bool mNeedsSortingSleeping; + + MBPOS_TmpBuffers mTmpBuffers; + + void optimizeMemory(); + void resizeObjects(); + void staticSort(); + void preparePruning(MBPOS_TmpBuffers& buffers); + void prepareBIPPruning(const MBPOS_TmpBuffers& buffers); + }; + + /////////////////////////////////////////////////////////////////////////// + +// We have one of those for each Region within the MBP +struct RegionData : public PxUserAllocated +{ + MBP_AABB mBox; // Volume of space controlled by this Region + Region* mBP; // Pointer to Region itself + PxIntBool mOverlap; // True if overlaps other regions + void* mUserData; // Region identifier, reused to contain "first free ID" +}; + + #define MAX_NB_MBP 256 +// #define MAX_NB_MBP 16 + + class MBP : public PxUserAllocated + { + public: + MBP(); + ~MBP(); + + void preallocate(PxU32 nbRegions, PxU32 nbObjects, PxU32 maxNbOverlaps); + void reset(); + void freeBuffers(); + + PxU32 addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const PxReal* contactDistance); + bool removeRegion(PxU32 handle); + const Region* getRegion(PxU32 i) const; + PX_FORCE_INLINE PxU32 getNbRegions() const { return mNbRegions; } + + MBP_Handle addObject(const MBP_AABB& box, BpHandle userID, bool isStatic); + bool removeObject(MBP_Handle handle); + bool updateObject(MBP_Handle handle, const MBP_AABB& box); + bool updateObjectAfterRegionRemoval(MBP_Handle handle, Region* removedRegion); + bool updateObjectAfterNewRegionAdded(MBP_Handle handle, const MBP_AABB& box, Region* addedRegion, PxU32 regionIndex); + void prepareOverlaps(); + void findOverlaps(const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut); + PxU32 finalize(BroadPhaseMBP* mbp); + void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances); + +// private: + PxU32 mNbRegions; + MBP_ObjectIndex mFirstFreeIndex; // First free recycled index for mMBP_Objects + PxU32 mFirstFreeIndexBP; // First free recycled index for mRegions + PxArray mRegions; + PxArray mMBP_Objects; + MBP_PairManager mPairManager; + + BitArray mUpdatedObjects; // Indexed by MBP_ObjectIndex + BitArray mRemoved; // Indexed by MBP_ObjectIndex + PxArray mHandles[MAX_NB_MBP+1]; + PxU32 mFirstFree[MAX_NB_MBP+1]; + PX_FORCE_INLINE RegionHandle* getHandles(MBP_Object& currentObject, PxU32 nbHandles); + void purgeHandles(MBP_Object* PX_RESTRICT object, PxU32 nbHandles); + void storeHandles(MBP_Object* PX_RESTRICT object, PxU32 nbHandles, const RegionHandle* PX_RESTRICT handles); + + PxArray mOutOfBoundsObjects; // These are BpHandle but the BP interface expects PxU32s + void addToOutOfBoundsArray(BpHandle id); + +#ifdef USE_FULLY_INSIDE_FLAG + BitArray mFullyInsideBitmap; // Indexed by MBP_ObjectIndex +#endif + void populateNewRegion(const MBP_AABB& box, Region* addedRegion, PxU32 regionIndex, const PxBounds3* boundsArray, const PxReal* contactDistance); + +#ifdef MBP_REGION_BOX_PRUNING + void buildRegionData(); + MBP_AABB mSortedRegionBoxes[MAX_NB_MBP]; + PxU32 mSortedRegionIndices[MAX_NB_MBP]; + PxU32 mNbActiveRegions; + bool mDirtyRegions; +#endif + }; + +#ifdef MBP_SIMD_OVERLAP + #define MBP_OVERLAP_TEST(x) SIMD_OVERLAP_TEST(x) +#else + #define MBP_OVERLAP_TEST(x) if(intersect2D(box0, x)) +#endif + +#define DEFAULT_NB_ENTRIES 128 + +#ifdef MBP_SIMD_OVERLAP + static PX_FORCE_INLINE void initSentinel(SIMD_AABB& box) + { + // box.mMinX = encodeFloat(FLT_MAX)>>1; + box.mMinX = 0xffffffff; + } + #if PX_DEBUG + static PX_FORCE_INLINE bool isSentinel(const SIMD_AABB& box) + { + return box.mMinX == 0xffffffff; + } + #endif +#else + static PX_FORCE_INLINE void initSentinel(MBP_AABB& box) + { + // box.mMinX = encodeFloat(FLT_MAX)>>1; + box.mMinX = 0xffffffff; + } + #if PX_DEBUG + static PX_FORCE_INLINE bool isSentinel(const MBP_AABB& box) + { + return box.mMinX == 0xffffffff; + } + #endif +#endif + +} + +using namespace internalMBP; + +/////////////////////////////////////////////////////////////////////////////// + +MBP_PairManager::MBP_PairManager() : + mGroups (NULL), + mObjects (NULL), + mLUT (NULL) +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +MBP_PairManager::~MBP_PairManager() +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +InternalPair* MBP_PairManager::addPair(PxU32 id0, PxU32 id1) +{ + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + PX_ASSERT(mGroups); + PX_ASSERT(mObjects); + + { + const MBP_ObjectIndex index0 = decodeHandle_Index(id0); + const MBP_ObjectIndex index1 = decodeHandle_Index(id1); + + const BpHandle object0 = mObjects[index0].mUserID; + const BpHandle object1 = mObjects[index1].mUserID; + + if(!groupFiltering(mGroups[object0], mGroups[object1], mLUT)) + return NULL; + } + + return addPairInternal(id0, id1); +} + +/////////////////////////////////////////////////////////////////////////////// + +/*bool MBP_PairManager::removePair(PxU32 id0, PxU32 id1) +{ + // Order the ids + sort(id0, id1); + + const PxU32 hashValue = hash(id0, id1) & mMask; + const InternalPair* p = findPair(id0, id1, hashValue); + if(!p) + return false; + PX_ASSERT(p->getId0()==id0); + PX_ASSERT(p->getId1()==id1); + + PairManagerData::removePair(id0, id1, hashValue, getPairIndex(p)); + + shrinkMemory(); + return true; +}*/ + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef MBP_SIMD_OVERLAP + #define SIMD_OVERLAP_PRELOAD_BOX0 \ + __m128i b = _mm_loadu_si128(reinterpret_cast(&box0.mMinY)); \ + b = _mm_shuffle_epi32(b, 78); + + // PT: technically we don't need the 16 bits from _mm_movemask_epi8, we only + // need the 4 bits from _mm_movemask_ps. Would it be faster? In any case this + // works thanks to the _mm_cmpgt_epi32 which puts the same values in each byte + // of each separate 32bits components. + #define SIMD_OVERLAP_TEST(x) \ + const __m128i a = _mm_loadu_si128(reinterpret_cast(&x.mMinY)); \ + const __m128i d = _mm_cmpgt_epi32(a, b); \ + const int mask = _mm_movemask_epi8(d); \ + if(mask==0x0000ff00) + +#else + #define SIMD_OVERLAP_PRELOAD_BOX0 +#endif + +#ifdef MBP_USE_NO_CMP_OVERLAP +/*static PX_FORCE_INLINE void initBox(IAABB& box, const PxBounds3& src) +{ + box.initFrom2(src); +}*/ +#else +static PX_FORCE_INLINE void initBox(IAABB& box, const PxBounds3& src) +{ + box.initFrom(src); +} +#endif + +Region::Region() : + mNbObjects (0), + mMaxNbObjects (0), + mFirstFree (INVALID_ID), + mObjects (NULL), + mMaxNbStaticBoxes (0), + mNbStaticBoxes (0), + mMaxNbDynamicBoxes (0), + mNbDynamicBoxes (0), + mStaticBoxes (NULL), + mDynamicBoxes (NULL), + mInToOut_Static (NULL), + mInToOut_Dynamic (NULL), + mPosList (NULL), + mNbUpdatedBoxes (0), + mPrevNbUpdatedBoxes (0), + mNeedsSorting (false), + mNeedsSortingSleeping (true) +{ +} + +Region::~Region() +{ + PX_DELETE_ARRAY(mObjects); + MBP_FREE(mPosList); + MBP_FREE(mInToOut_Dynamic); + MBP_FREE(mInToOut_Static); + PX_DELETE_ARRAY(mDynamicBoxes); + PX_DELETE_ARRAY(mStaticBoxes); +} + +// Pre-sort static boxes +#define STACK_BUFFER_SIZE_STATIC_SORT 8192 + #define DEFAULT_NUM_DYNAMIC_BOXES 1024 + +void Region::staticSort() +{ + // For now this version is only compatible with: + // MBP_USE_WORDS + // MBP_USE_SENTINELS + + mNeedsSorting = false; + + const PxU32 nbStaticBoxes = mNbStaticBoxes; + if(!nbStaticBoxes) + { + mStaticBits.empty(); + return; + } + +// PxU32 Time; +// StartProfile(Time); + + // Roadmap: + // - gather updated/modified static boxes + // - sort those, and those only + // - merge sorted set with previously existing (and previously sorted set) + + // Separate things-to-sort and things-already-sorted + const PxU32 totalSize = sizeof(PxU32)*nbStaticBoxes*4; + PxU8 stackBuffer[STACK_BUFFER_SIZE_STATIC_SORT]; + PxU8* tempMemory = totalSize<=STACK_BUFFER_SIZE_STATIC_SORT ? stackBuffer : reinterpret_cast(MBP_ALLOC_TMP(totalSize)); + PxU32* minPosList_ToSort = reinterpret_cast(tempMemory); + PxU32* minPosList_Sorted = reinterpret_cast(tempMemory + sizeof(PxU32)*nbStaticBoxes); + PxU32* boxIndices_ToSort = reinterpret_cast(tempMemory + sizeof(PxU32)*nbStaticBoxes*2); + PxU32* boxIndices_Sorted = reinterpret_cast(tempMemory + sizeof(PxU32)*nbStaticBoxes*3); + PxU32 nbToSort = 0; + PxU32 nbSorted = 0; + for(PxU32 i=0;i(MBP_ALLOC(sizeof(MBP_Index)*mMaxNbStaticBoxes)); + const PxU32 nbStaticSentinels = 2; + MBP_AABB* sortedBoxes = PX_NEW(MBP_AABB)[mMaxNbStaticBoxes+nbStaticSentinels]; + initSentinel(sortedBoxes[nbStaticBoxes]); + initSentinel(sortedBoxes[nbStaticBoxes+1]); + +// EndProfile(Time); +// printf("Part2b: %d\n", Time); + +// StartProfile(Time); + + // Merge streams to final buffers + PxU32 offsetSorted = 0; + PxU32 offsetNonSorted = 0; + + PxU32 nextCandidateNonSorted = offsetNonSorted(MBP_ALLOC(sizeof(MBP_Index)*newNbBoxes)); + if(oldNbBoxes) + PxMemCopy(newMapping, mapping, oldNbBoxes*sizeof(MBP_Index)); + MBP_FREE(mapping); + return newMapping; +} + +static PX_FORCE_INLINE void MTF(MBP_AABB* PX_RESTRICT dynamicBoxes, MBP_Index* PX_RESTRICT inToOut_Dynamic, MBPEntry* PX_RESTRICT objects, const MBP_AABB& bounds, PxU32 frontIndex, MBPEntry& updatedObject) +{ + const PxU32 updatedIndex = updatedObject.mIndex; + if(frontIndex!=updatedIndex) + { + const MBP_AABB box0 = dynamicBoxes[frontIndex]; + dynamicBoxes[frontIndex] = bounds; + dynamicBoxes[updatedIndex] = box0; + + const MBP_Index index0 = inToOut_Dynamic[frontIndex]; + inToOut_Dynamic[frontIndex] = inToOut_Dynamic[updatedIndex]; + inToOut_Dynamic[updatedIndex] = index0; + + objects[index0].mIndex = updatedIndex; + updatedObject.mIndex = frontIndex; + } + else + { + dynamicBoxes[frontIndex] = bounds; + } +} + +MBP_Index Region::addObject(const MBP_AABB& bounds, MBP_Handle mbpHandle, bool isStatic) +{ +#ifdef MBP_USE_WORDS + PX_ASSERT(mNbObjects<0xffff); +#endif + PX_ASSERT((decodeHandle_IsStatic(mbpHandle) && isStatic) || (!decodeHandle_IsStatic(mbpHandle) && !isStatic)); + + MBP_Index handle; + if(mFirstFree!=INVALID_ID) + { + handle = MBP_Index(mFirstFree); + mFirstFree = mObjects[handle].mIndex; + } + else + { + if(mMaxNbObjects==mNbObjects) + resizeObjects(); + + handle = MBP_Index(mNbObjects); + } + mNbObjects++; + /// + + PxU32 boxIndex; + if(isStatic) + { + if(mMaxNbStaticBoxes==mNbStaticBoxes) + { + const PxU32 newMaxNbBoxes = mMaxNbStaticBoxes ? mMaxNbStaticBoxes + DEFAULT_NB_ENTRIES : DEFAULT_NB_ENTRIES; +// const PxU32 newMaxNbBoxes = mMaxNbStaticBoxes ? mMaxNbStaticBoxes*2 : DEFAULT_NB_ENTRIES; + mStaticBoxes = resizeBoxes(mNbStaticBoxes, newMaxNbBoxes, mStaticBoxes); + mInToOut_Static = resizeMapping(mNbStaticBoxes, newMaxNbBoxes, mInToOut_Static); + mMaxNbStaticBoxes = newMaxNbBoxes; + } + + boxIndex = mNbStaticBoxes++; + mStaticBoxes[boxIndex] = bounds; + mInToOut_Static[boxIndex] = handle; + mNeedsSorting = true; + mStaticBits.setBitChecked(boxIndex); + } + else + { + if(mMaxNbDynamicBoxes==mNbDynamicBoxes) + { + const PxU32 newMaxNbBoxes = mMaxNbDynamicBoxes ? mMaxNbDynamicBoxes + DEFAULT_NB_ENTRIES : DEFAULT_NB_ENTRIES; +// const PxU32 newMaxNbBoxes = mMaxNbDynamicBoxes ? mMaxNbDynamicBoxes*2 : DEFAULT_NB_ENTRIES; + mDynamicBoxes = resizeBoxes(mNbDynamicBoxes, newMaxNbBoxes, mDynamicBoxes); + mInToOut_Dynamic = resizeMapping(mNbDynamicBoxes, newMaxNbBoxes, mInToOut_Dynamic); + mMaxNbDynamicBoxes = newMaxNbBoxes; + + MBP_FREE(mPosList); + mPosList = reinterpret_cast(MBP_ALLOC((newMaxNbBoxes+1)*sizeof(PxU32))); + } + + boxIndex = mNbDynamicBoxes++; + mDynamicBoxes[boxIndex] = bounds; + mInToOut_Dynamic[boxIndex] = handle; + } + + mObjects[handle].mIndex = boxIndex; + mObjects[handle].mMBPHandle = mbpHandle; +#if PX_DEBUG + mObjects[handle].mUpdated = !isStatic; +#endif + + if(!isStatic) + { + MTF(mDynamicBoxes, mInToOut_Dynamic, mObjects, bounds, mNbUpdatedBoxes, mObjects[handle]); + mNbUpdatedBoxes++; + mPrevNbUpdatedBoxes = 0; + mNeedsSortingSleeping = true; + PX_ASSERT(mNbUpdatedBoxes<=mNbDynamicBoxes); + } + return handle; +} + +// Moves box 'lastIndex' to location 'removedBoxIndex' +static PX_FORCE_INLINE void remove(MBPEntry* PX_RESTRICT objects, MBP_Index* PX_RESTRICT mapping, MBP_AABB* PX_RESTRICT boxes, PxU32 removedBoxIndex, PxU32 lastIndex) +{ + const PxU32 movedBoxHandle = mapping[lastIndex]; + boxes[removedBoxIndex] = boxes[lastIndex]; // Relocate box data + mapping[removedBoxIndex] = MBP_Index(movedBoxHandle); // Relocate mapping data + MBPEntry& movedObject = objects[movedBoxHandle]; + PX_ASSERT(movedObject.mIndex==lastIndex); // Checks index of moved box was indeed its old location + movedObject.mIndex = removedBoxIndex; // Adjust index of moved box to reflect its new location +} + +void Region::removeObject(MBP_Index handle) +{ + PX_ASSERT(handle>1)|(bits2>>2)|(bits3>>3); + return !mask; + + /* const PxU32 d0 = (b.mMaxY<<16)|a.mMaxY; + const PxU32 d0b = (b.mMaxZ<<16)|a.mMaxZ; + const PxU32 d1 = (a.mMinY<<16)|b.mMinY; + const PxU32 d1b = (a.mMinZ<<16)|b.mMinZ; + const PxU32 mask = (d0 - d1) | (d0b - d1b); + return !(mask & 0x80008000);*/ +#else + if(//mMaxX < a.mMinX || a.mMaxX < mMinX +// || + b.mMaxY < a.mMinY || a.mMaxY < b.mMinY + || + b.mMaxZ < a.mMinZ || a.mMaxZ < b.mMinZ + ) + return FALSE; + return TRUE; +#endif +} +#endif + +#ifdef MBP_USE_NO_CMP_OVERLAP_3D +static PX_FORCE_INLINE bool intersect3D(const MBP_AABB& a, const MBP_AABB& b) +{ + // PT: warning, only valid with the special encoding in InitFrom2 + const PxU32 bits0 = (b.mMaxY - a.mMinY)&0x80000000; + const PxU32 bits1 = (b.mMaxZ - a.mMinZ)&0x80000000; + const PxU32 bits2 = (a.mMaxY - b.mMinY)&0x80000000; + const PxU32 bits3 = (a.mMaxZ - b.mMinZ)&0x80000000; + const PxU32 bits4 = (b.mMaxX - a.mMinX)&0x80000000; + const PxU32 bits5 = (a.mMaxX - b.mMinX)&0x80000000; + const PxU32 mask = bits0|(bits1>>1)|(bits2>>2)|(bits3>>3)|(bits4>>4)|(bits5>>5); + return !mask; +} +#endif + +#ifdef CHECK_NB_OVERLAPS +static PxU32 gNbOverlaps = 0; +#endif + +static PX_FORCE_INLINE void outputPair( MBP_PairManager& pairManager, + PxU32 index0, PxU32 index1, + const MBP_Index* PX_RESTRICT inToOut0, const MBP_Index* PX_RESTRICT inToOut1, + const MBPEntry* PX_RESTRICT objects) +{ +#ifdef CHECK_NB_OVERLAPS + gNbOverlaps++; +#endif + const MBP_Index objectIndex0 = inToOut0[index0]; + const MBP_Index objectIndex1 = inToOut1[index1]; + PX_ASSERT(objectIndex0!=objectIndex1); + const MBP_Handle id0 = objects[objectIndex0].mMBPHandle; + const MBP_Handle id1 = objects[objectIndex1].mMBPHandle; +// printf("2: %d %d\n", index0, index1); +// printf("3: %d %d\n", objectIndex0, objectIndex1); + pairManager.addPair(id0, id1); +} + +MBPOS_TmpBuffers::MBPOS_TmpBuffers() : + mNbSleeping (0), + mNbUpdated (0), + mInToOut_Dynamic_Sleeping (NULL), + mSleepingDynamicBoxes (NULL), + mUpdatedDynamicBoxes (NULL) +{ +} + +MBPOS_TmpBuffers::~MBPOS_TmpBuffers() +{ +// printf("mNbSleeping: %d\n", mNbSleeping); + if(mInToOut_Dynamic_Sleeping!=mInToOut_Dynamic_Sleeping_Stack) + MBP_FREE(mInToOut_Dynamic_Sleeping); + + if(mSleepingDynamicBoxes!=mSleepingDynamicBoxes_Stack) + PX_DELETE_ARRAY(mSleepingDynamicBoxes); + + if(mUpdatedDynamicBoxes!=mUpdatedDynamicBoxes_Stack) + PX_DELETE_ARRAY(mUpdatedDynamicBoxes); + + mNbSleeping = 0; + mNbUpdated = 0; +} + +void MBPOS_TmpBuffers::allocateSleeping(PxU32 nbSleeping, PxU32 nbSentinels) +{ + if(nbSleeping>mNbSleeping) + { + if(mInToOut_Dynamic_Sleeping!=mInToOut_Dynamic_Sleeping_Stack) + MBP_FREE(mInToOut_Dynamic_Sleeping); + if(mSleepingDynamicBoxes!=mSleepingDynamicBoxes_Stack) + PX_DELETE_ARRAY(mSleepingDynamicBoxes); + + if(nbSleeping+nbSentinels<=STACK_BUFFER_SIZE) + { + mSleepingDynamicBoxes = mSleepingDynamicBoxes_Stack; + mInToOut_Dynamic_Sleeping = mInToOut_Dynamic_Sleeping_Stack; + } + else + { + mSleepingDynamicBoxes = PX_NEW(MBP_AABB)[nbSleeping+nbSentinels]; + mInToOut_Dynamic_Sleeping = reinterpret_cast(MBP_ALLOC(sizeof(MBP_Index)*nbSleeping)); + } + mNbSleeping = nbSleeping; + } +} + +void MBPOS_TmpBuffers::allocateUpdated(PxU32 nbUpdated, PxU32 nbSentinels) +{ + if(nbUpdated>mNbUpdated) + { + if(mUpdatedDynamicBoxes!=mUpdatedDynamicBoxes_Stack) + PX_DELETE_ARRAY(mUpdatedDynamicBoxes); + + if(nbUpdated+nbSentinels<=STACK_BUFFER_SIZE) + mUpdatedDynamicBoxes = mUpdatedDynamicBoxes_Stack; + else + mUpdatedDynamicBoxes = PX_NEW(MBP_AABB)[nbUpdated+nbSentinels]; + + mNbUpdated = nbUpdated; + } +} + +void Region::preparePruning(MBPOS_TmpBuffers& buffers) +{ +PxU32 _saved = mNbUpdatedBoxes; +mNbUpdatedBoxes = 0; + + if(mPrevNbUpdatedBoxes!=_saved) + mNeedsSortingSleeping = true; + + PxU32 nb = mNbDynamicBoxes; + if(!nb) + { + mInput.mNeeded = false; + mPrevNbUpdatedBoxes = 0; + mNeedsSortingSleeping = true; + return; + } + const MBP_AABB* PX_RESTRICT dynamicBoxes = mDynamicBoxes; + PxU32* PX_RESTRICT posList = mPosList; + +#if PX_DEBUG + PxU32 verifyNbUpdated = 0; + for(PxU32 i=0;i(mRS.GetRecyclable()); + for(PxU32 i=0;i buffers.mUpdatedDynamicBoxes; + mInput.mSleepingDynamicBoxes = sleepingDynamicBoxes; + mInput.mInToOut_Dynamic = inToOut_Dynamic; // Can be shared (3) => (MBP_Index*)mRS.GetRecyclable(); + mInput.mInToOut_Dynamic_Sleeping = inToOut_Dynamic_Sleeping; + mInput.mNbUpdated = nbUpdated; // Can be shared (4) + mInput.mNbNonUpdated = nbNonUpdated; + mInput.mNeeded = true; +} + +void Region::prepareBIPPruning(const MBPOS_TmpBuffers& buffers) +{ + if(!mNbUpdatedBoxes || !mNbStaticBoxes) + { + mInput.mBIPInput.mNeeded = false; + return; + } + + mInput.mBIPInput.mObjects = mObjects; // Can be shared (1) + mInput.mBIPInput.mNbUpdatedBoxes = mNbUpdatedBoxes; // Can be shared (4) + mInput.mBIPInput.mNbStaticBoxes = mNbStaticBoxes; +// mInput.mBIPInput.mDynamicBoxes = mDynamicBoxes; + mInput.mBIPInput.mDynamicBoxes = buffers.mUpdatedDynamicBoxes; // Can be shared (2) + mInput.mBIPInput.mStaticBoxes = mStaticBoxes; + mInput.mBIPInput.mInToOut_Static = mInToOut_Static; + mInput.mBIPInput.mInToOut_Dynamic = reinterpret_cast(mRS.GetRecyclable()); // Can be shared (3) + mInput.mBIPInput.mNeeded = true; +} + +static void doCompleteBoxPruning(MBP_PairManager* PX_RESTRICT pairManager, const BoxPruning_Input& input) +{ + const MBPEntry* PX_RESTRICT objects = input.mObjects; + const MBP_AABB* PX_RESTRICT updatedDynamicBoxes = input.mUpdatedDynamicBoxes; + const MBP_AABB* PX_RESTRICT sleepingDynamicBoxes = input.mSleepingDynamicBoxes; + const MBP_Index* PX_RESTRICT inToOut_Dynamic = input.mInToOut_Dynamic; + const MBP_Index* PX_RESTRICT inToOut_Dynamic_Sleeping = input.mInToOut_Dynamic_Sleeping; + const PxU32 nbUpdated = input.mNbUpdated; + const PxU32 nbNonUpdated = input.mNbNonUpdated; + + // + + // PT: find sleeping-dynamics-vs-active-dynamics overlaps + if(nbNonUpdated) + { + const PxU32 nb0 = nbUpdated; + const PxU32 nb1 = nbNonUpdated; + + // + PxU32 index0 = 0; + PxU32 runningIndex1 = 0; + + while(runningIndex1 +#endif + +// PT: TODO: +// - We could try to keep bounds around all objects (for each region), and then test the new region's bounds against these instead of +// testing all objects one by one. These new bounds (around all objects of a given region) would be delicate to maintain though. +// - Just store these "fully inside flags" (i.e. objects) in a separate list? Or can we do MTF on objects? (probably not, else we +// wouldn't have holes in the array due to removed objects) + +// PT: automatically populate new region with overlapping objects. +// Brute-force version checking all existing objects, potentially optimized using "fully inside" flags. +//#define FIRST_VERSION +#ifdef FIRST_VERSION +void MBP::populateNewRegion(const MBP_AABB& box, Region* addedRegion, PxU32 regionIndex) +{ + const RegionData* PX_RESTRICT regions = mRegions.begin(); + const PxU32 nbObjects = mMBP_Objects.size(); + MBP_Object* PX_RESTRICT objects = mMBP_Objects.begin(); + +#ifdef PRINT_STATS + PxU32 nbObjectsFound = 0; + PxU32 nbObjectsTested = 0; +#endif + +#ifdef USE_FULLY_INSIDE_FLAG + const PxU32* fullyInsideFlags = mFullyInsideBitmap.getBits(); +#endif + + PxU32 j=0; + while(j>5]; + #ifdef HWSCAN + if(blockFlags==0) //HWSCAN + #else + if(blockFlags==0xffffffff) + #endif + { + j+=32; + continue; + } + PxU32 nbToGo = PxMin(nbObjects - j, PxU32(32)); + PxU32 mask = 1; + while(nbToGo--) + { + + MBP_Object& currentObject = objects[j]; + // PT: if an object A is fully contained inside all the regions S it overlaps, we don't need to test it against the new region R. + // The rationale is that even if R does overlap A, any new object B must touch S to overlap with A. So B would be added to S and + // the (A,B) overlap would be detected in S, even if it's not detected in R. + const PxU32 res = blockFlags & mask; + PX_ASSERT((mFullyInsideBitmap.isSet(j) && res) || (!mFullyInsideBitmap.isSet(j) && !res)); + mask+=mask; + j++; + #ifdef HWSCAN + if(!res) //HWSCAN + #else + if(res) + #endif + continue; + PX_ASSERT(!(currentObject.mFlags & MBP_REMOVED)); +#else + MBP_Object& currentObject = objects[j++]; + if(currentObject.mFlags & MBP_REMOVED) + continue; // PT: object is in the free list +#endif + +#ifdef PRINT_STATS + nbObjectsTested++; +#endif + + MBP_AABB bounds; + MBP_Handle mbpHandle; + + const PxU32 nbHandles = currentObject.mNbHandles; + if(nbHandles) + { + RegionHandle* PX_RESTRICT handles = getHandles(currentObject, nbHandles); + // PT: no need to test all regions since they should contain the same info. Just retrieve bounds from the first one. + PxU32 i=0; // for(PxU32 i=0;iretrieveBounds(bounds, h.mHandle); + } + } + else + { + PX_ASSERT(mManager); + + // PT: if the object is out-of-bounds, we're out-of-luck. We don't have the object bounds, so we need to retrieve them + // from the AABB manager - and then re-encode them. This is not very elegant or efficient, but it should rarely happen + // so this is good enough for now. + const PxBounds3 decodedBounds = mManager->getBPBounds(currentObject.mUserID); + + bounds.initFrom2(decodedBounds); + + mbpHandle = currentObject.mHandlesIndex; + } + + if(bounds.intersect(box)) + { +// updateObject(mbpHandle, bounds); + updateObjectAfterNewRegionAdded(mbpHandle, bounds, addedRegion, regionIndex); +#ifdef PRINT_STATS + nbObjectsFound++; +#endif + } + +#ifdef USE_FULLY_INSIDE_FLAG + } +#endif + } +#ifdef PRINT_STATS + printf("Populating new region with %d objects (tested %d/%d object)\n", nbObjectsFound, nbObjectsTested, nbObjects); +#endif +} +#endif + +// PT: version using lowestSetBit +#define SECOND_VERSION +#ifdef SECOND_VERSION + +/* PX_FORCE_INLINE PxU32 lowestSetBitUnsafe64(PxU64 v) + { + unsigned long retval; + _BitScanForward64(&retval, v); + return retval; + }*/ + +void MBP::populateNewRegion(const MBP_AABB& box, Region* addedRegion, PxU32 regionIndex, const PxBounds3* boundsArray, const PxReal* contactDistance) +{ + const RegionData* PX_RESTRICT regions = mRegions.begin(); + const PxU32 nbObjects = mMBP_Objects.size(); + PX_UNUSED(nbObjects); + MBP_Object* PX_RESTRICT objects = mMBP_Objects.begin(); + const PxU32* fullyInsideFlags = mFullyInsideBitmap.getBits(); +// const PxU64* fullyInsideFlags = (const PxU64*)mFullyInsideBitmap.getBits(); + if(!fullyInsideFlags) + return; + + const PxU32 lastSetBit = mFullyInsideBitmap.findLast(); +// const PxU64 lastSetBit = mFullyInsideBitmap.findLast(); + +#ifdef PRINT_STATS + PxU32 nbObjectsFound = 0; + PxU32 nbObjectsTested = 0; +#endif + + // PT: ### bitmap iterator pattern + for(PxU32 w = 0; w <= lastSetBit >> 5; ++w) +// for(PxU64 w = 0; w <= lastSetBit >> 6; ++w) + { + for(PxU32 b = fullyInsideFlags[w]; b; b &= b-1) +// for(PxU64 b = fullyInsideFlags[w]; b; b &= b-1) + { + const PxU32 index = PxU32(w<<5|PxLowestSetBit(b)); +// const PxU64 index = (PxU64)(w<<6|::lowestSetBitUnsafe64(b)); + PX_ASSERT(indexretrieveBounds(bounds, h.mHandle); + } + } + else + { + // PT: if the object is out-of-bounds, we're out-of-luck. We don't have the object bounds, so we need to retrieve them + // from the AABB manager - and then re-encode them. This is not very elegant or efficient, but it should rarely happen + // so this is good enough for now. + const PxBounds3 rawBounds = boundsArray[currentObject.mUserID]; + PxVec3 c(contactDistance[currentObject.mUserID]); + const PxBounds3 decodedBounds(rawBounds.minimum - c, rawBounds.maximum + c); + bounds.initFrom2(decodedBounds); + + mbpHandle = currentObject.mHandlesIndex; + } + + if(bounds.intersects(box)) + { +// updateObject(mbpHandle, bounds); + updateObjectAfterNewRegionAdded(mbpHandle, bounds, addedRegion, regionIndex); +#ifdef PRINT_STATS + nbObjectsFound++; +#endif + } + } + } +#ifdef PRINT_STATS + printf("Populating new region with %d objects (tested %d/%d object)\n", nbObjectsFound, nbObjectsTested, nbObjects); +#endif +} +#endif + +//#define THIRD_VERSION +#ifdef THIRD_VERSION +void MBP::populateNewRegion(const MBP_AABB& box, Region* addedRegion, PxU32 regionIndex) +{ + const RegionData* PX_RESTRICT regions = mRegions.begin(); + const PxU32 nbObjects = mMBP_Objects.size(); + PX_UNUSED(nbObjects); + MBP_Object* PX_RESTRICT objects = mMBP_Objects.begin(); + + const PxU32* fullyInsideFlags = mFullyInsideBitmap.getBits(); + if(!fullyInsideFlags) + return; + +#ifdef PRINT_STATS + PxU32 nbObjectsFound = 0; + PxU32 nbObjectsTested = 0; +#endif + + PxBitMap bm; + bm.importData(mFullyInsideBitmap.getSize(), (PxU32*)fullyInsideFlags); + + PxBitMap::Iterator it(bm); + PxU32 index = it.getNext(); + while(index != PxBitMap::Iterator::DONE) + { + PX_ASSERT(indexretrieveBounds(bounds, h.mHandle); + } + } + else + { + PX_ASSERT(mManager); + + // PT: if the object is out-of-bounds, we're out-of-luck. We don't have the object bounds, so we need to retrieve them + // from the AABB manager - and then re-encode them. This is not very elegant or efficient, but it should rarely happen + // so this is good enough for now. + const PxBounds3 decodedBounds = mManager->getBPBounds(currentObject.mUserID); + + bounds.initFrom2(decodedBounds); + + mbpHandle = currentObject.mHandlesIndex; + } + + if(bounds.intersect(box)) + { +// updateObject(mbpHandle, bounds); + updateObjectAfterNewRegionAdded(mbpHandle, bounds, addedRegion, regionIndex); +#ifdef PRINT_STATS + nbObjectsFound++; +#endif + } + index = it.getNext(); + } +#ifdef PRINT_STATS + printf("Populating new region with %d objects (tested %d/%d object)\n", nbObjectsFound, nbObjectsTested, nbObjects); +#endif +} +#endif + +PxU32 MBP::addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const PxReal* contactDistance) +{ + PxU32 regionHandle; + RegionData* PX_RESTRICT buffer; + + if(mFirstFreeIndexBP!=INVALID_ID) + { + regionHandle = mFirstFreeIndexBP; + + buffer = mRegions.begin(); + buffer += regionHandle; + + mFirstFreeIndexBP = PxU32(size_t(buffer->mUserData)); // PT: this is safe, we previously stored a PxU32 in there + } + else + { + if(mNbRegions>=MAX_NB_MBP) + { + PxGetFoundation().error(PxErrorCode::eOUT_OF_MEMORY, PX_FL, "MBP::addRegion: max number of regions reached."); + return INVALID_ID; + } + + regionHandle = mNbRegions++; + buffer = reserveContainerMemory(mRegions, 1); + } + + Region* newRegion = PX_NEW(Region); + buffer->mBox.initFrom2(region.mBounds); + buffer->mBP = newRegion; + buffer->mUserData = region.mUserData; + + setupOverlapFlags(mNbRegions, mRegions.begin()); + + // PT: automatically populate new region with overlapping objects + if(populateRegion) + populateNewRegion(buffer->mBox, newRegion, regionHandle, boundsArray, contactDistance); + +#ifdef MBP_REGION_BOX_PRUNING + mDirtyRegions = true; +#endif + + return regionHandle; +} + +// ### TODO: recycle regions, make sure objects are properly deleted/transferred, etc +// ### TODO: what happens if we delete a zone then immediately add it back? Do objects get deleted? +// ### TODO: in fact if we remove a zone but we keep the objects, what happens to their current overlaps? Are they kept or discarded? +bool MBP::removeRegion(PxU32 handle) +{ + if(handle>=mNbRegions) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "MBP::removeRegion: invalid handle."); + return false; + } + + RegionData* PX_RESTRICT region = mRegions.begin(); + region += handle; + + Region* bp = region->mBP; + if(!bp) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "MBP::removeRegion: invalid handle."); + return false; + } + + PxBounds3 empty; + empty.setEmpty(); + region->mBox.initFrom2(empty); + + { + // We are going to remove the region but it can still contain objects. We need to update + // those objects so that their handles and out-of-bounds status are modified. + // + // Unfortunately there is no way to iterate over active objects in a region, so we need + // to iterate over the max amount of objects. ### TODO: optimize this + const PxU32 maxNbObjects = bp->mMaxNbObjects; + MBPEntry* PX_RESTRICT objects = bp->mObjects; + for(PxU32 j=0;jmBP = NULL; + region->mUserData = reinterpret_cast(size_t(mFirstFreeIndexBP)); + mFirstFreeIndexBP = handle; + +#ifdef MBP_REGION_BOX_PRUNING + mDirtyRegions = true; +#endif + + // A region has been removed so we need to update the overlap flags for all remaining regions + // ### TODO: optimize this + setupOverlapFlags(mNbRegions, mRegions.begin()); + return true; +} + +const Region* MBP::getRegion(PxU32 i) const +{ + if(i>=mNbRegions) + return NULL; + + const RegionData* PX_RESTRICT regions = mRegions.begin(); + return regions[i].mBP; +} + +#ifdef MBP_REGION_BOX_PRUNING +void MBP::buildRegionData() +{ + const PxU32 size = mNbRegions; + PxU32 nbValidRegions = 0; + if(size) + { + const RegionData* PX_RESTRICT regions = mRegions.begin(); + + // Gather valid regions + PxU32 minPosList[MAX_NB_MBP]; + for(PxU32 i=0;i& c = mHandles[nbHandles]; + handles = reinterpret_cast(c.begin()+handlesIndex); + } + return handles; +} + +void MBP::purgeHandles(MBP_Object* PX_RESTRICT object, PxU32 nbHandles) +{ + if(nbHandles>1) + { + const PxU32 handlesIndex = object->mHandlesIndex; + PxArray& c = mHandles[nbHandles]; + PxU32* recycled = c.begin() + handlesIndex; + *recycled = mFirstFree[nbHandles]; + mFirstFree[nbHandles] = handlesIndex; + } +} + +void MBP::storeHandles(MBP_Object* PX_RESTRICT object, PxU32 nbHandles, const RegionHandle* PX_RESTRICT handles) +{ + if(nbHandles==1) + { + object->mHandle = handles[0]; + } + else if(nbHandles) + { + PxArray& c = mHandles[nbHandles]; + const PxU32 firstFree = mFirstFree[nbHandles]; + PxU32* handlesMemory; + if(firstFree!=INVALID_ID) + { + object->mHandlesIndex = firstFree; + handlesMemory = c.begin() + firstFree; + mFirstFree[nbHandles] = *handlesMemory; + } + else + { + const PxU32 handlesIndex = c.size(); + object->mHandlesIndex = handlesIndex; + handlesMemory = reserveContainerMemory(c, sizeof(RegionHandle)*nbHandles/sizeof(PxU32)); + } + PxMemCopy(handlesMemory, handles, sizeof(RegionHandle)*nbHandles); + } +} + +MBP_Handle MBP::addObject(const MBP_AABB& box, BpHandle userID, bool isStatic) +{ + MBP_ObjectIndex objectIndex; + MBP_Object* objectMemory; + PxU32 flipFlop; + if(1) + { + if(mFirstFreeIndex!=INVALID_ID) + { + objectIndex = mFirstFreeIndex; + MBP_Object* objects = mMBP_Objects.begin(); + objectMemory = &objects[objectIndex]; + PX_ASSERT(!objectMemory->mNbHandles); + mFirstFreeIndex = objectMemory->mHandlesIndex; + flipFlop = PxU32(objectMemory->getFlipFlop()); + } + else + { + objectIndex = mMBP_Objects.size(); + objectMemory = reserveContainerMemory(mMBP_Objects, 1); + flipFlop = 0; + } + } + else + { + // PT: must be possible to use the AABB-manager's ID directly. Something like this: + objectIndex = userID; + if(mMBP_Objects.capacity()mNbObjects==0xffff) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "MBP::addObject: 64K objects in single region reached. Some collisions might be lost."); + else +#endif + { + RegionHandle& h = tmpHandles[nbHandles++]; + h.mHandle = regions[i].mBP->addObject(box, MBPObjectHandle, isStatic); + h.mInternalBPHandle = PxTo16(i); + } + } + } + storeHandles(objectMemory, nbHandles, tmpHandles); + + objectMemory->mNbHandles = PxTo16(nbHandles); + PxU16 flags = 0; + if(flipFlop) + flags |= MBP_FLIP_FLOP; +#ifdef USE_FULLY_INSIDE_FLAG + if(nbHandles && newObjectIsFullyInsideRegions) + setBit(mFullyInsideBitmap, objectIndex); + else + clearBit(mFullyInsideBitmap, objectIndex); +#endif + if(!nbHandles) + { + objectMemory->mHandlesIndex = MBPObjectHandle; + addToOutOfBoundsArray(userID); + } + + if(!isStatic) + mUpdatedObjects.setBitChecked(objectIndex); + +// objectMemory->mUpdated = !isStatic; + objectMemory->mFlags = flags; + objectMemory->mUserID = userID; + + return MBPObjectHandle; +} + +bool MBP::removeObject(MBP_Handle handle) +{ + const MBP_ObjectIndex objectIndex = decodeHandle_Index(handle); + + MBP_Object* PX_RESTRICT objects = mMBP_Objects.begin(); + MBP_Object& currentObject = objects[objectIndex]; + const RegionData* PX_RESTRICT regions = mRegions.begin(); + // Parse previously overlapping regions. If still overlapping, update object. Else remove from region. + const PxU32 nbHandles = currentObject.mNbHandles; + if(nbHandles) + { + RegionHandle* handles = getHandles(currentObject, nbHandles); + for(PxU32 i=0;iremoveObject(h.mHandle); + } + + purgeHandles(¤tObject, nbHandles); + } + + currentObject.mNbHandles = 0; + currentObject.mFlags |= MBP_REMOVED; + currentObject.mHandlesIndex = mFirstFreeIndex; +// if(!decodeHandle_IsStatic(handle)) +// if(!currentObject.IsStatic()) + mUpdatedObjects.setBitChecked(objectIndex); + + mFirstFreeIndex = objectIndex; + + mRemoved.setBitChecked(objectIndex); // PT: this is cleared each frame so it's not a replacement for the MBP_REMOVED flag + +#ifdef USE_FULLY_INSIDE_FLAG + // PT: when removing an object we mark it as "fully inside" so that it is automatically + // discarded in the "populateNewRegion" function, without the need for MBP_REMOVED. + setBit(mFullyInsideBitmap, objectIndex); +#endif + return true; +} + +static PX_FORCE_INLINE bool stillIntersects(PxU32 handle, PxU32& _nb, PxU32* PX_RESTRICT currentOverlaps) +{ + const PxU32 nb = _nb; + for(PxU32 i=0;i nbHandles changes from 2 to 1 while MBP_FULLY_INSIDE is not set + setBit(mFullyInsideBitmap, objectIndex); +#endif + currentRegion.mBP->updateObject(box, h.mHandle); + return true; + } + } + + // Find regions overlapping object's new position +#ifdef USE_FULLY_INSIDE_FLAG + bool objectIsFullyInsideRegions = true; +#endif + PxU32 nbCurrentOverlaps = 0; + PxU32 currentOverlaps[MAX_NB_MBP+1]; + // PT: here, we may still parse regions which have been removed. But their boxes have been set to empty, + // so nothing will happen. + for(PxU32 i=0;iUpdateObject(box, h.mHandle); + if(stillIntersects(h.mInternalBPHandle, nbCurrentOverlaps, currentOverlaps)) + { + currentRegion.mBP->updateObject(box, h.mHandle); + // Still collides => keep handle for this frame + newHandles[nbNewHandles++] = h; + } + else + { + PX_ASSERT(!currentRegion.mBox.intersects(box)); +// if(currentRegion.mBP) + PX_ASSERT(currentRegion.mBP); + currentRegion.mBP->removeObject(h.mHandle); + } + } + + // Add to new regions if needed + for(PxU32 i=0;iaddObject(box, handle, isStatic!=0); + newHandles[nbNewHandles].mHandle = PxTo16(BPHandle); + newHandles[nbNewHandles].mInternalBPHandle = PxTo16(regionIndex); + nbNewHandles++; + } + + if(nbHandles==nbNewHandles) + { + for(PxU32 i=0;iaddObject(box, handle, isStatic!=0); + newHandles[nbNewHandles].mHandle = PxTo16(BPHandle); + newHandles[nbNewHandles].mInternalBPHandle = PxTo16(regionIndex); + nbNewHandles++; + } + + // PT: we know that we have one more handle than before, no need to test + purgeHandles(¤tObject, nbHandles); + storeHandles(¤tObject, nbNewHandles, newHandles); + + currentObject.mNbHandles = PxTo16(nbNewHandles); + + // PT: we know that we have at least one handle (from the newly added region), so we can't be "out of bounds" here. + PX_ASSERT(nbNewHandles); + +#ifdef USE_FULLY_INSIDE_FLAG + // PT: we know that the object was not "fully inside" before, so even if it is fully inside the new region, it + // will not be fully inside all of them => no need to change its fully inside flag + // TODO: an exception to this would be the case where the object was out-of-bounds, and it's now fully inside the new region + // => we could set the flag in that case. +#endif + return true; +} + +bool MBP_PairManager::computeCreatedDeletedPairs(const MBP_Object* objects, BroadPhaseMBP* mbp, const BitArray& updated, const BitArray& removed) +{ + // PT: parse all currently active pairs. The goal here is to generate the found/lost pairs, compared to previous frame. + PxU32 i=0; + PxU32 nbActivePairs = mNbActivePairs; + while(imCreated.pushBack(BroadPhasePair(object0, object1)); + + p.clearNew(); + p.clearUpdated(); + i++; + } + else if(p.isUpdated()) + { + // Persistent pair + + // PT: this pair already existed in the structure, and has been found again this frame. Since + // MBP reports "all pairs" each frame (as opposed to SAP), this happens quite often, for each + // active persistent pair. + p.clearUpdated(); + i++; + } + else + { + // Lost pair + + // PT: if the pair is not new and not 'updated', it might be a lost (separated) pair. But this + // is not always the case since we now handle "sleeping" objects directly within MBP. A pair + // of sleeping objects does not generate an 'addPair' call, so it ends up in this codepath. + // Nonetheless the sleeping pair should not be deleted. We can only delete pairs involving + // objects that have been actually moved during the frame. This is the only case in which + // a pair can indeed become 'lost'. + const PxU32 id0 = p.getId0(); + const PxU32 id1 = p.getId1(); + PX_ASSERT(id0!=INVALID_ID); + PX_ASSERT(id1!=INVALID_ID); + + const MBP_ObjectIndex index0 = decodeHandle_Index(id0); + const MBP_ObjectIndex index1 = decodeHandle_Index(id1); + // PT: if none of the involved objects have been updated, the pair is just sleeping: keep it and skip it. + if(updated.isSetChecked(index0) || updated.isSetChecked(index1)) + { + // PT: by design (for better or worse) we do not report pairs to the client when + // one of the involved objects has been deleted. The pair must still be deleted + // from the MBP structure though. + if(!removed.isSetChecked(index0) && !removed.isSetChecked(index1)) + { + // PT: doing the group-based filtering here is useless. The pair should not have + // been added in the first place. + const BpHandle object0 = objects[index0].mUserID; + const BpHandle object1 = objects[index1].mUserID; + mbp->mDeleted.pushBack(BroadPhasePair(object0, object1)); + } + + const PxU32 hashValue = hash(id0, id1) & mMask; + PairManagerData::removePair(id0, id1, hashValue, i); + nbActivePairs--; + } + else i++; + } + } + + shrinkMemory(); + return true; +} + +void MBP::prepareOverlaps() +{ + const PxU32 nb = mNbRegions; + const RegionData* PX_RESTRICT regions = mRegions.begin(); + for(PxU32 i=0;iprepareOverlaps(); + } +} + +void MBP::findOverlaps(const Bp::FilterGroup::Enum* PX_RESTRICT groups, const bool* PX_RESTRICT lut) +{ + PxU32 nb = mNbRegions; + const RegionData* PX_RESTRICT regions = mRegions.begin(); + const MBP_Object* objects = mMBP_Objects.begin(); + + mPairManager.mObjects = objects; + mPairManager.mGroups = groups; + mPairManager.mLUT = lut; + + for(PxU32 i=0;ifindOverlaps(mPairManager); + } +} + +PxU32 MBP::finalize(BroadPhaseMBP* mbp) +{ + const MBP_Object* objects = mMBP_Objects.begin(); + mPairManager.computeCreatedDeletedPairs(objects, mbp, mUpdatedObjects, mRemoved); + + mUpdatedObjects.clearAll(); + + return mPairManager.mNbActivePairs; +} + +void MBP::reset() +{ + PxU32 nb = mNbRegions; + RegionData* PX_RESTRICT regions = mRegions.begin(); + while(nb--) + { +// printf("%d objects in region\n", regions->mBP->mNbObjects); + PX_DELETE(regions->mBP); + regions++; + } + + mNbRegions = 0; + mFirstFreeIndex = INVALID_ID; + mFirstFreeIndexBP = INVALID_ID; + for(PxU32 i=0;isetBounds(h.mHandle, bounds); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +// Below is the PhysX wrapper = link between AABBManager and MBP + +#define DEFAULT_CREATED_DELETED_PAIRS_CAPACITY 1024 + +BroadPhaseMBP::BroadPhaseMBP( PxU32 maxNbRegions, + PxU32 maxNbBroadPhaseOverlaps, + PxU32 maxNbStaticShapes, + PxU32 maxNbDynamicShapes, + PxU64 contextID) : + mMapping (NULL), + mCapacity (0), + mGroups (NULL), + mFilter (NULL), + mContextID (contextID) +{ + mMBP = PX_NEW(MBP); + + const PxU32 nbObjects = maxNbStaticShapes + maxNbDynamicShapes; + mMBP->preallocate(maxNbRegions, nbObjects, maxNbBroadPhaseOverlaps); + + if(nbObjects) + allocateMappingArray(nbObjects); + + mCreated.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); + mDeleted.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); +} + +BroadPhaseMBP::~BroadPhaseMBP() +{ + PX_DELETE(mMBP); + PX_FREE(mMapping); +} + +void BroadPhaseMBP::allocateMappingArray(PxU32 newCapacity) +{ + PX_ASSERT(newCapacity>mCapacity); + MBP_Handle* newMapping = reinterpret_cast(PX_ALLOC(sizeof(MBP_Handle)*newCapacity, "MBP")); + if(mCapacity) + PxMemCopy(newMapping, mMapping, mCapacity*sizeof(MBP_Handle)); + for(PxU32 i=mCapacity;imNbRegions; +/* const RegionData* PX_RESTRICT regions = (const RegionData*)mMBP->mRegions.GetEntries(); + PxU32 nbActiveRegions = 0; + for(PxU32 i=0;imNbRegions; + const RegionData* PX_RESTRICT regions = mMBP->mRegions.begin(); + regions += startIndex; + + const PxU32 writeCount = PxMin(size, bufferSize); + for(PxU32 i=0;imNbStaticBoxes; + userBuffer[i].mNbDynamicObjects = regions[i].mBP->mNbDynamicBoxes; + } + else + { + userBuffer[i].mRegion.mBounds.setEmpty(); + userBuffer[i].mRegion.mUserData = NULL; + userBuffer[i].mActive = false; + userBuffer[i].mOverlap = false; + userBuffer[i].mNbStaticObjects = 0; + userBuffer[i].mNbDynamicObjects = 0; + } + } + return writeCount; +} + +PxU32 BroadPhaseMBP::addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const PxReal* contactDistance) +{ + return mMBP->addRegion(region, populateRegion, boundsArray, contactDistance); +} + +bool BroadPhaseMBP::removeRegion(PxU32 handle) +{ + return mMBP->removeRegion(handle); +} + +void BroadPhaseMBP::update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, physx::PxBaseTask* /*continuation*/) +{ + PX_CHECK_AND_RETURN(scratchAllocator, "BroadPhaseMBP::update - scratchAllocator must be non-NULL \n"); + PX_UNUSED(scratchAllocator); + + setUpdateData(updateData); + + update(); + postUpdate(); +} + +static PX_FORCE_INLINE void computeMBPBounds(MBP_AABB& aabb, const PxBounds3* PX_RESTRICT boundsXYZ, const PxReal* PX_RESTRICT contactDistances, const BpHandle index) +{ + const PxBounds3& b = boundsXYZ[index]; + const Vec4V contactDistanceV = V4Load(contactDistances[index]); + const Vec4V inflatedMinV = V4Sub(V4LoadU(&b.minimum.x), contactDistanceV); + const Vec4V inflatedMaxV = V4Add(V4LoadU(&b.maximum.x), contactDistanceV); // PT: this one is safe because we allocated one more box in the array (in BoundsArray::initEntry) + + PX_ALIGN(16, PxVec4) boxMin; + PX_ALIGN(16, PxVec4) boxMax; + V4StoreA(inflatedMinV, &boxMin.x); + V4StoreA(inflatedMaxV, &boxMax.x); + + const PxU32* PX_RESTRICT min = PxUnionCast(&boxMin.x); + const PxU32* PX_RESTRICT max = PxUnionCast(&boxMax.x); + //Avoid min=max by enforcing the rule that mins are even and maxs are odd. + aabb.mMinX = IntegerAABB::encodeFloatMin(min[0])>>1; + aabb.mMinY = IntegerAABB::encodeFloatMin(min[1])>>1; + aabb.mMinZ = IntegerAABB::encodeFloatMin(min[2])>>1; + aabb.mMaxX = (IntegerAABB::encodeFloatMax(max[0]) | (1<<2))>>1; + aabb.mMaxY = (IntegerAABB::encodeFloatMax(max[1]) | (1<<2))>>1; + aabb.mMaxZ = (IntegerAABB::encodeFloatMax(max[2]) | (1<<2))>>1; + +/* const IntegerAABB bounds(boundsXYZ[index], contactDistances[index]); + + aabb.mMinX = bounds.mMinMax[IntegerAABB::MIN_X]>>1; + aabb.mMinY = bounds.mMinMax[IntegerAABB::MIN_Y]>>1; + aabb.mMinZ = bounds.mMinMax[IntegerAABB::MIN_Z]>>1; + aabb.mMaxX = bounds.mMinMax[IntegerAABB::MAX_X]>>1; + aabb.mMaxY = bounds.mMinMax[IntegerAABB::MAX_Y]>>1; + aabb.mMaxZ = bounds.mMinMax[IntegerAABB::MAX_Z]>>1;*/ + +/* + aabb.mMinX &= ~1; + aabb.mMinY &= ~1; + aabb.mMinZ &= ~1; + aabb.mMaxX |= 1; + aabb.mMaxY |= 1; + aabb.mMaxZ |= 1; +*/ + +/*#if PX_DEBUG + PxBounds3 decodedBox; + PxU32* bin = reinterpret_cast(&decodedBox.minimum.x); + bin[0] = decodeFloat(bounds.mMinMax[IntegerAABB::MIN_X]); + bin[1] = decodeFloat(bounds.mMinMax[IntegerAABB::MIN_Y]); + bin[2] = decodeFloat(bounds.mMinMax[IntegerAABB::MIN_Z]); + bin[3] = decodeFloat(bounds.mMinMax[IntegerAABB::MAX_X]); + bin[4] = decodeFloat(bounds.mMinMax[IntegerAABB::MAX_Y]); + bin[5] = decodeFloat(bounds.mMinMax[IntegerAABB::MAX_Z]); + + MBP_AABB PrunerBox; + PrunerBox.initFrom2(decodedBox); + PX_ASSERT(PrunerBox.mMinX==aabb.mMinX); + PX_ASSERT(PrunerBox.mMinY==aabb.mMinY); + PX_ASSERT(PrunerBox.mMinZ==aabb.mMinZ); + PX_ASSERT(PrunerBox.mMaxX==aabb.mMaxX); + PX_ASSERT(PrunerBox.mMaxY==aabb.mMaxY); + PX_ASSERT(PrunerBox.mMaxZ==aabb.mMaxZ); +#endif*/ +} + +void BroadPhaseMBP::removeObjects(const BroadPhaseUpdateData& updateData) +{ + const BpHandle* PX_RESTRICT removed = updateData.getRemovedHandles(); + if(removed) + { + PxU32 nbToGo = updateData.getNumRemovedHandles(); + while(nbToGo--) + { + const BpHandle index = *removed++; + PX_ASSERT(index+1removeObject(mMapping[index]); + PX_ASSERT(status); + PX_UNUSED(status); + + mMapping[index] = PX_INVALID_U32; + } + } +} + +void BroadPhaseMBP::updateObjects(const BroadPhaseUpdateData& updateData) +{ + const BpHandle* PX_RESTRICT updated = updateData.getUpdatedHandles(); + if(updated) + { + const PxBounds3* PX_RESTRICT boundsXYZ = updateData.getAABBs(); + PxU32 nbToGo = updateData.getNumUpdatedHandles(); + while(nbToGo--) + { + const BpHandle index = *updated++; + PX_ASSERT(index+1updateObject(mMapping[index], aabb); + PX_ASSERT(status); + PX_UNUSED(status); + } + } +} + +void BroadPhaseMBP::addObjects(const BroadPhaseUpdateData& updateData) +{ + const BpHandle* PX_RESTRICT created = updateData.getCreatedHandles(); + if(created) + { + const PxBounds3* PX_RESTRICT boundsXYZ = updateData.getAABBs(); + const Bp::FilterGroup::Enum* PX_RESTRICT groups = updateData.getGroups(); + + PxU32 nbToGo = updateData.getNumCreatedHandles(); + while(nbToGo--) + { + const BpHandle index = *created++; + PX_ASSERT(index+1addObject(aabb, index, isStatic); + } + } +} + +void BroadPhaseMBP::setUpdateData(const BroadPhaseUpdateData& updateData) +{ + PX_PROFILE_ZONE("BroadPhaseMBP::setUpdateData", mContextID); + +// mMBP->setTransientBounds(updateData.getAABBs(), updateData.getContactDistance()); + + const PxU32 newCapacity = updateData.getCapacity(); + if(newCapacity>mCapacity) + allocateMappingArray(newCapacity); + +#if PX_CHECKED + // PT: WARNING: this must be done after the allocateMappingArray call + if(!BroadPhaseUpdateData::isValid(updateData, *this, false, mContextID)) + { + PX_CHECK_MSG(false, "Illegal BroadPhaseUpdateData \n"); + return; + } +#endif + + mGroups = updateData.getGroups(); + mFilter = &updateData.getFilter(); + + // ### TODO: handle groups inside MBP + // ### TODO: get rid of AABB conversions + + removeObjects(updateData); + addObjects(updateData); + updateObjects(updateData); + + PX_ASSERT(!mCreated.size()); + PX_ASSERT(!mDeleted.size()); + + mMBP->prepareOverlaps(); +} + +void BroadPhaseMBP::update() +{ +#ifdef CHECK_NB_OVERLAPS + gNbOverlaps = 0; +#endif + mMBP->findOverlaps(mGroups, mFilter->getLUT()); +#ifdef CHECK_NB_OVERLAPS + printf("PPU: %d overlaps\n", gNbOverlaps); +#endif +} + +void BroadPhaseMBP::postUpdate() +{ + { + PxU32 Nb = mMBP->mNbRegions; + const RegionData* PX_RESTRICT regions = mMBP->mRegions.begin(); + for(PxU32 i=0;imNbUpdatedBoxes = 0; + } + } + + mMBP->finalize(this); +} + +const BroadPhasePair* BroadPhaseMBP::getCreatedPairs(PxU32& nbCreatedPairs) const +{ + nbCreatedPairs = mCreated.size(); + return mCreated.begin(); +} + +const BroadPhasePair* BroadPhaseMBP::getDeletedPairs(PxU32& nbDeletedPairs) const +{ + nbDeletedPairs = mDeleted.size(); + return mDeleted.begin(); +} + +PxU32 BroadPhaseMBP::getNbOutOfBoundsObjects() const +{ + return mMBP->mOutOfBoundsObjects.size(); +} + +const PxU32* BroadPhaseMBP::getOutOfBoundsObjects() const +{ + return mMBP->mOutOfBoundsObjects.begin(); +} + +static void freeBuffer(PxArray& buffer) +{ + const PxU32 size = buffer.size(); + if(size>DEFAULT_CREATED_DELETED_PAIRS_CAPACITY) + { + buffer.reset(); + buffer.reserve(DEFAULT_CREATED_DELETED_PAIRS_CAPACITY); + } + else + { + buffer.clear(); + } +} + +void BroadPhaseMBP::freeBuffers() +{ + mMBP->freeBuffers(); + freeBuffer(mCreated); + freeBuffer(mDeleted); +} + +#if PX_CHECKED +bool BroadPhaseMBP::isValid(const BroadPhaseUpdateData& updateData) const +{ + const BpHandle* created = updateData.getCreatedHandles(); + if(created) + { + PxHashSet set; + PxU32 nbObjects = mMBP->mMBP_Objects.size(); + const MBP_Object* PX_RESTRICT objects = mMBP->mMBP_Objects.begin(); + while(nbObjects--) + { + if(!(objects->mFlags & MBP_REMOVED)) + set.insert(objects->mUserID); + objects++; + } + + PxU32 nbToGo = updateData.getNumCreatedHandles(); + while(nbToGo--) + { + const BpHandle index = *created++; + PX_ASSERT(indexshiftOrigin(shift, boundsArray, contactDistances); +} + +PxU32 BroadPhaseMBP::getCurrentNbPairs() const +{ + return mMBP->mPairManager.mNbActivePairs; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.h new file mode 100644 index 0000000..65e6a37 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBP.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_MBP_H +#define BP_BROADPHASE_MBP_H + +#include "BpBroadPhase.h" +#include "BpBroadPhaseMBPCommon.h" +#include "foundation/PxArray.h" + +namespace internalMBP +{ + class MBP; +} + +namespace physx +{ +namespace Bp +{ + class BroadPhaseMBP : public BroadPhase + { + PX_NOCOPY(BroadPhaseMBP) + public: + BroadPhaseMBP( PxU32 maxNbRegions, + PxU32 maxNbBroadPhaseOverlaps, + PxU32 maxNbStaticShapes, + PxU32 maxNbDynamicShapes, + PxU64 contextID); + virtual ~BroadPhaseMBP(); + + // BroadPhaseBase + virtual void getCaps(PxBroadPhaseCaps& caps) const; + virtual PxU32 getNbRegions() const; + virtual PxU32 getRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + virtual PxU32 addRegion(const PxBroadPhaseRegion& region, bool populateRegion, const PxBounds3* boundsArray, const PxReal* contactDistance); + virtual bool removeRegion(PxU32 handle); + virtual PxU32 getNbOutOfBoundsObjects() const; + virtual const PxU32* getOutOfBoundsObjects() const; + //~BroadPhaseBase + + // BroadPhase + virtual PxBroadPhaseType::Enum getType() const PX_OVERRIDE { return PxBroadPhaseType::eMBP; } + virtual void release() PX_OVERRIDE { PX_DELETE_THIS; } + virtual void update(PxcScratchAllocator* scratchAllocator, const BroadPhaseUpdateData& updateData, physx::PxBaseTask* continuation) PX_OVERRIDE; + virtual void preBroadPhase(const Bp::BroadPhaseUpdateData&) PX_OVERRIDE {} + virtual void fetchBroadPhaseResults() PX_OVERRIDE {} + virtual const BroadPhasePair* getCreatedPairs(PxU32&) const PX_OVERRIDE; + virtual const BroadPhasePair* getDeletedPairs(PxU32&) const PX_OVERRIDE; + virtual void freeBuffers() PX_OVERRIDE; + virtual void shiftOrigin(const PxVec3& shift, const PxBounds3* boundsArray, const PxReal* contactDistances) PX_OVERRIDE; +#if PX_CHECKED + virtual bool isValid(const BroadPhaseUpdateData& updateData) const PX_OVERRIDE; +#endif + //~BroadPhase + + internalMBP::MBP* mMBP; // PT: TODO: aggregate + + MBP_Handle* mMapping; + PxU32 mCapacity; + PxArray mCreated; + PxArray mDeleted; + + const Bp::FilterGroup::Enum*mGroups; + const BpFilter* mFilter; + + const PxU64 mContextID; + + void setUpdateData(const BroadPhaseUpdateData& updateData); + void addObjects(const BroadPhaseUpdateData& updateData); + void removeObjects(const BroadPhaseUpdateData& updateData); + void updateObjects(const BroadPhaseUpdateData& updateData); + + void update(); + void postUpdate(); + void allocateMappingArray(PxU32 newCapacity); + + PxU32 getCurrentNbPairs() const; + }; + +} //namespace Bp + +} //namespace physx + +#endif // BP_BROADPHASE_MBP_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBPCommon.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBPCommon.h new file mode 100644 index 0000000..c7ad4c4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseMBPCommon.h @@ -0,0 +1,198 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_MBP_COMMON_H +#define BP_BROADPHASE_MBP_COMMON_H + +#include "PxPhysXConfig.h" +#include "BpBroadPhaseIntegerAABB.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Bp +{ + +#define MBP_USE_WORDS +#define MBP_USE_NO_CMP_OVERLAP +#if PX_INTEL_FAMILY && !defined(PX_SIMD_DISABLED) + #define MBP_SIMD_OVERLAP +#endif + +#ifdef MBP_USE_WORDS + typedef PxU16 MBP_Index; +#else + typedef PxU32 MBP_Index; +#endif + typedef PxU32 MBP_ObjectIndex; // PT: index in mMBP_Objects + typedef PxU32 MBP_Handle; // PT: returned to MBP users, combination of index/flip-flop/static-bit + + struct IAABB : public PxUserAllocated + { + PX_FORCE_INLINE bool isInside(const IAABB& box) const + { + if(box.mMinX>mMinX) return false; + if(box.mMinY>mMinY) return false; + if(box.mMinZ>mMinZ) return false; + if(box.mMaxX(&box.minimum.x); + mMinX = encodeFloat(binary[0])>>1; + mMinY = encodeFloat(binary[1])>>1; + mMinZ = encodeFloat(binary[2])>>1; + mMaxX = encodeFloat(binary[3])>>1; + mMaxY = encodeFloat(binary[4])>>1; + mMaxZ = encodeFloat(binary[5])>>1; + } + + PX_FORCE_INLINE void decode(PxBounds3& box) const + { + PxU32* PX_RESTRICT binary = reinterpret_cast(&box.minimum.x); + binary[0] = decodeFloat(mMinX<<1); + binary[1] = decodeFloat(mMinY<<1); + binary[2] = decodeFloat(mMinZ<<1); + binary[3] = decodeFloat(mMaxX<<1); + binary[4] = decodeFloat(mMaxY<<1); + binary[5] = decodeFloat(mMaxZ<<1); + } + + PX_FORCE_INLINE PxU32 getMin(PxU32 i) const { return (&mMinX)[i]; } + PX_FORCE_INLINE PxU32 getMax(PxU32 i) const { return (&mMaxX)[i]; } + + PxU32 mMinX; + PxU32 mMinY; + PxU32 mMinZ; + PxU32 mMaxX; + PxU32 mMaxY; + PxU32 mMaxZ; + }; + + struct SIMD_AABB : public PxUserAllocated + { + PX_FORCE_INLINE void initFrom(const PxBounds3& box) + { + const PxU32* PX_RESTRICT binary = reinterpret_cast(&box.minimum.x); + mMinX = encodeFloat(binary[0]); + mMinY = encodeFloat(binary[1]); + mMinZ = encodeFloat(binary[2]); + mMaxX = encodeFloat(binary[3]); + mMaxY = encodeFloat(binary[4]); + mMaxZ = encodeFloat(binary[5]); + } + + PX_FORCE_INLINE void initFrom2(const PxBounds3& box) + { + const PxU32* PX_RESTRICT binary = reinterpret_cast(&box.minimum.x); + mMinX = encodeFloat(binary[0])>>1; + mMinY = encodeFloat(binary[1])>>1; + mMinZ = encodeFloat(binary[2])>>1; + mMaxX = encodeFloat(binary[3])>>1; + mMaxY = encodeFloat(binary[4])>>1; + mMaxZ = encodeFloat(binary[5])>>1; + } + + PX_FORCE_INLINE void decode(PxBounds3& box) const + { + PxU32* PX_RESTRICT binary = reinterpret_cast(&box.minimum.x); + binary[0] = decodeFloat(mMinX<<1); + binary[1] = decodeFloat(mMinY<<1); + binary[2] = decodeFloat(mMinZ<<1); + binary[3] = decodeFloat(mMaxX<<1); + binary[4] = decodeFloat(mMaxY<<1); + binary[5] = decodeFloat(mMaxZ<<1); + } + + PX_FORCE_INLINE bool isInside(const SIMD_AABB& box) const + { + if(box.mMinX>mMinX) return false; + if(box.mMinY>mMinY) return false; + if(box.mMinZ>mMinZ) return false; + if(box.mMaxX + +// PT: reactivated this. Ran UTs with SAP as default BP and nothing broke. +#define TEST_DELETED_PAIRS + +namespace physx +{ +namespace Bp +{ +#define DEFAULT_DATA_ARRAY_CAPACITY 1024 +#define DEFAULT_CREATEDDELETED_PAIR_ARRAY_CAPACITY 64 +#define DEFAULT_CREATEDDELETED1AXIS_CAPACITY 8192 + + template + class TmpMem + { + public: + PX_FORCE_INLINE TmpMem(PxU32 size): + mPtr(size<=stackLimit?mStackBuf : PX_ALLOCATE(T, size, "char")) + { + } + + PX_FORCE_INLINE ~TmpMem() + { + if(mPtr!=mStackBuf) + PX_FREE(mPtr); + } + + PX_FORCE_INLINE T& operator*() const + { + return *mPtr; + } + + PX_FORCE_INLINE T* operator->() const + { + return mPtr; + } + + PX_FORCE_INLINE T& operator[](PxU32 index) + { + return mPtr[index]; + } + + T* getBase() + { + return mPtr; + } + + private: + T mStackBuf[stackLimit]; + T* mPtr; + }; + +BroadPhaseSap::BroadPhaseSap( + const PxU32 maxNbBroadPhaseOverlaps, + const PxU32 maxNbStaticShapes, + const PxU32 maxNbDynamicShapes, + PxU64 contextID) : + mScratchAllocator (NULL), + mContextID (contextID) +{ + for(PxU32 i=0;i<3;i++) + mBatchUpdateTasks[i].setContextId(contextID); + + //Boxes + mBoxesSize=0; + mBoxesSizePrev=0; + mBoxesCapacity = (((maxNbStaticShapes + maxNbDynamicShapes) + 31) & ~31); + mBoxEndPts[0] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*mBoxesCapacity)), "SapBox1D")); + mBoxEndPts[1] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*mBoxesCapacity)), "SapBox1D")); + mBoxEndPts[2] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*mBoxesCapacity)), "SapBox1D")); + for(PxU32 i=0; i(PX_ALLOC(ALIGN_SIZE_16((sizeof(PxU8)*mBoxesCapacity)), "BoxesUpdated")); + mSortedUpdateElements = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*mEndPointsCapacity)), "SortedUpdateElements")); + mActivityPockets = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BroadPhaseActivityPocket)*mEndPointsCapacity)), "BroadPhaseActivityPocket")); + + mEndPointValues[0] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(mEndPointsCapacity))), "ValType")); + mEndPointValues[1] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(mEndPointsCapacity))), "ValType")); + mEndPointValues[2] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(mEndPointsCapacity))), "ValType")); + mEndPointDatas[0] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(mEndPointsCapacity))), "BpHandle")); + mEndPointDatas[1] = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(mEndPointsCapacity))), "BpHandle")); + mEndPointDatas[2]= reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(mEndPointsCapacity))), "BpHandle")); + + // Initialize sentinels + setMinSentinel(mEndPointValues[0][0],mEndPointDatas[0][0]); + setMaxSentinel(mEndPointValues[0][1],mEndPointDatas[0][1]); + setMinSentinel(mEndPointValues[1][0],mEndPointDatas[1][0]); + setMaxSentinel(mEndPointValues[1][1],mEndPointDatas[1][1]); + setMinSentinel(mEndPointValues[2][0],mEndPointDatas[2][0]); + setMaxSentinel(mEndPointValues[2][1],mEndPointDatas[2][1]); + + mListNext = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*mEndPointsCapacity)), "NextList")); + mListPrev = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*mEndPointsCapacity)), "PrevList")); + + for(PxU32 a = 1; a < mEndPointsCapacity; ++a) + { + mListNext[a-1] = BpHandle(a); + mListPrev[a] = BpHandle(a-1); + } + mListNext[mEndPointsCapacity-1] = BpHandle(mEndPointsCapacity-1); + mListPrev[0] = 0; + + mDefaultPairsCapacity = PxMax(maxNbBroadPhaseOverlaps, PxU32(DEFAULT_CREATEDDELETED_PAIR_ARRAY_CAPACITY)); + + mPairs.init(mDefaultPairsCapacity); + + mBatchUpdateTasks[2].set(this,2); + mBatchUpdateTasks[1].set(this,1); + mBatchUpdateTasks[0].set(this,0); + mBatchUpdateTasks[2].setPairs(NULL, 0); + mBatchUpdateTasks[1].setPairs(NULL, 0); + mBatchUpdateTasks[0].setPairs(NULL, 0); + + //Initialise data array. + mData = NULL; + mDataSize = 0; + mDataCapacity = 0; + + //Initialise pairs arrays. + mCreatedPairsArray = NULL; + mCreatedPairsCapacity = 0; + mCreatedPairsSize = 0; + mDeletedPairsArray = NULL; + mDeletedPairsCapacity = 0; + mDeletedPairsSize = 0; + mActualDeletedPairSize = 0; + + mFilter = NULL; +} + +BroadPhaseSap::~BroadPhaseSap() +{ + PX_FREE(mBoxEndPts[0]); + PX_FREE(mBoxEndPts[1]); + PX_FREE(mBoxEndPts[2]); + + PX_FREE(mEndPointValues[0]); + PX_FREE(mEndPointValues[1]); + PX_FREE(mEndPointValues[2]); + PX_FREE(mEndPointDatas[0]); + PX_FREE(mEndPointDatas[1]); + PX_FREE(mEndPointDatas[2]); + + PX_FREE(mListNext); + PX_FREE(mListPrev); + + PX_FREE(mSortedUpdateElements); + PX_FREE(mActivityPockets); + PX_FREE(mBoxesUpdated); + + mPairs.release(); + + mBatchUpdateTasks[0].setPairs(NULL, 0); + mBatchUpdateTasks[1].setPairs(NULL, 0); + mBatchUpdateTasks[2].setPairs(NULL, 0); + + mData = NULL; + + mCreatedPairsArray = NULL; + mDeletedPairsArray = NULL; +} + +void BroadPhaseSap::release() +{ + this->~BroadPhaseSap(); + PX_FREE_THIS; +} + +void BroadPhaseSap::resizeBuffers() +{ + const PxU32 defaultPairsCapacity = mDefaultPairsCapacity; + + mCreatedPairsArray = reinterpret_cast(mScratchAllocator->alloc(sizeof(BroadPhasePair)*defaultPairsCapacity, true)); + mCreatedPairsCapacity = defaultPairsCapacity; + mCreatedPairsSize = 0; + + mDeletedPairsArray = reinterpret_cast(mScratchAllocator->alloc(sizeof(BroadPhasePair)*defaultPairsCapacity, true)); + mDeletedPairsCapacity = defaultPairsCapacity; + mDeletedPairsSize = 0; + + mData = reinterpret_cast(mScratchAllocator->alloc(sizeof(BpHandle)*defaultPairsCapacity, true)); + mDataCapacity = defaultPairsCapacity; + mDataSize = 0; + + mBatchUpdateTasks[0].setPairs(reinterpret_cast(mScratchAllocator->alloc(sizeof(BroadPhasePair)*defaultPairsCapacity, true)), defaultPairsCapacity); + mBatchUpdateTasks[0].setNumPairs(0); + mBatchUpdateTasks[1].setPairs(reinterpret_cast(mScratchAllocator->alloc(sizeof(BroadPhasePair)*defaultPairsCapacity, true)), defaultPairsCapacity); + mBatchUpdateTasks[1].setNumPairs(0); + mBatchUpdateTasks[2].setPairs(reinterpret_cast(mScratchAllocator->alloc(sizeof(BroadPhasePair)*defaultPairsCapacity, true)), defaultPairsCapacity); + mBatchUpdateTasks[2].setNumPairs(0); +} + +static void DeletePairsLists(const PxU32 numActualDeletedPairs, const BroadPhasePair* deletedPairsList, SapPairManager& pairManager) +{ + // #### try batch removal here + for(PxU32 i=0;ifree(mCreatedPairsArray); + mCreatedPairsArray = NULL; + mCreatedPairsSize = 0; + mCreatedPairsCapacity = 0; + + if(mDeletedPairsArray) mScratchAllocator->free(mDeletedPairsArray); + mDeletedPairsArray = NULL; + mDeletedPairsSize = 0; + mDeletedPairsCapacity = 0; + mActualDeletedPairSize = 0; + + if(mData) mScratchAllocator->free(mData); + mData = NULL; + mDataSize = 0; + mDataCapacity = 0; + + if(mBatchUpdateTasks[0].getPairs()) mScratchAllocator->free(mBatchUpdateTasks[0].getPairs()); + mBatchUpdateTasks[0].setPairs(NULL, 0); + mBatchUpdateTasks[0].setNumPairs(0); + if(mBatchUpdateTasks[1].getPairs()) mScratchAllocator->free(mBatchUpdateTasks[1].getPairs()); + mBatchUpdateTasks[1].setPairs(NULL, 0); + mBatchUpdateTasks[1].setNumPairs(0); + if(mBatchUpdateTasks[2].getPairs()) mScratchAllocator->free(mBatchUpdateTasks[2].getPairs()); + mBatchUpdateTasks[2].setPairs(NULL, 0); + mBatchUpdateTasks[2].setNumPairs(0); + + //Shrink pair manager buffers it they are larger than needed but only let them shrink to a minimum size. + mPairs.shrinkMemory(); +} + +PX_FORCE_INLINE static void shiftCoord3(const ValType val0, const BpHandle handle0, + const ValType val1, const BpHandle handle1, + const ValType val2, const BpHandle handle2, + const PxF32* shift, ValType& oVal0, ValType& oVal1, ValType& oVal2) +{ + PX_ASSERT(!isSentinel(handle0)); + PX_ASSERT(!isSentinel(handle1)); + PX_ASSERT(!isSentinel(handle2)); + + PxF32 fl0, fl1, fl2; + ValType* PX_RESTRICT bpVal0 = PxUnionCast(&fl0); + ValType* PX_RESTRICT bpVal1 = PxUnionCast(&fl1); + ValType* PX_RESTRICT bpVal2 = PxUnionCast(&fl2); + *bpVal0 = decodeFloat(val0); + *bpVal1 = decodeFloat(val1); + *bpVal2 = decodeFloat(val2); + fl0 -= shift[0]; + fl1 -= shift[1]; + fl2 -= shift[2]; + oVal0 = (isMax(handle0)) ? (IntegerAABB::encodeFloatMax(*bpVal0) | 1) : ((IntegerAABB::encodeFloatMin(*bpVal0) + 1) & ~1); + oVal1 = (isMax(handle1)) ? (IntegerAABB::encodeFloatMax(*bpVal1) | 1) : ((IntegerAABB::encodeFloatMin(*bpVal1) + 1) & ~1); + oVal2 = (isMax(handle2)) ? (IntegerAABB::encodeFloatMax(*bpVal2) | 1) : ((IntegerAABB::encodeFloatMin(*bpVal2) + 1) & ~1); +} + +PX_FORCE_INLINE static void testPostShiftOrder(const ValType prevVal, ValType& currVal, const BpHandle prevIsMax, const BpHandle currIsMax) +{ + if(currVal < prevVal) + { + //The order has been broken by the lossy shift. + //Correct currVal so that it is greater than prevVal. + //If currVal is a box max then ensure that the box is of finite extent. + const ValType shiftCorrection = (prevIsMax==currIsMax) ? ValType(0) : ValType(1); + currVal = prevVal + shiftCorrection; + } +} + +void BroadPhaseSap::shiftOrigin(const PxVec3& shift, const PxBounds3* /*boundsArray*/, const PxReal* /*contactDistances*/) +{ + // + // Note: shifting the bounds does not necessarily preserve the order of the broadphase interval endpoints. The encoding of the float bounds is a lossy + // operation, thus it is not possible to get the original float values back and shift them. The only goal of this method is to shift the endpoints + // such that the order is preserved. The new intervals might no reflect the correct bounds! Since all bounds have been marked dirty, they will get + // recomputed in the next frame anyway. This method makes sure that the next frame update can start from a valid configuration that is close to + // the correct one and does not require too many swaps. + // + + if(0==mBoxesSize) + { + return; + } + + // + // Note: processing all the axis at once improved performance on XBox 360 and PS3 because it allows to compensate for stalls + // + + const PxF32 shiftAxis[3] = { shift.x, shift.y, shift.z }; + const BpHandle* PX_RESTRICT epData0 = mEndPointDatas[0]; + ValType* PX_RESTRICT epValues0 = mEndPointValues[0]; + const BpHandle* PX_RESTRICT epData1 = mEndPointDatas[1]; + ValType* PX_RESTRICT epValues1 = mEndPointValues[1]; + const BpHandle* PX_RESTRICT epData2 = mEndPointDatas[2]; + ValType* PX_RESTRICT epValues2 = mEndPointValues[2]; + + //Shift the first value in the array of sorted values. + { + //Shifted min (first element must be a min by definition). + shiftCoord3(epValues0[1], epData0[1], epValues1[1], epData1[1], epValues2[1], epData2[1], shiftAxis, epValues0[1], epValues1[1], epValues2[1]); + PX_ASSERT(!isMax(epData0[1])); + PX_ASSERT(!isMax(epData1[1])); + PX_ASSERT(!isMax(epData2[1])); + } + + //Shift the remainder. + ValType prevVal0 = epValues0[1]; + BpHandle prevIsMax0 = isMax(epData0[1]); + ValType prevVal1 = epValues1[1]; + BpHandle prevIsMax1 = isMax(epData1[1]); + ValType prevVal2 = epValues2[1]; + BpHandle prevIsMax2 = isMax(epData2[1]); + for(PxU32 i=2; i <= mBoxesSize*2; i++) + { + const BpHandle handle0 = epData0[i]; + const BpHandle handle1 = epData1[i]; + const BpHandle handle2 = epData2[i]; + PX_ASSERT(!isSentinel(handle0)); + PX_ASSERT(!isSentinel(handle1)); + PX_ASSERT(!isSentinel(handle2)); + + //Get the relevant prev and curr values after the shift. + const BpHandle currIsMax0 = isMax(epData0[i]); + const BpHandle currIsMax1 = isMax(epData1[i]); + const BpHandle currIsMax2 = isMax(epData2[i]); + ValType currVal0, currVal1, currVal2; + shiftCoord3(epValues0[i], handle0, epValues1[i], handle1, epValues2[i], handle2, shiftAxis, currVal0, currVal1, currVal2); + + //Test if the order has been preserved by the lossy shift. + testPostShiftOrder(prevVal0, currVal0, prevIsMax0, currIsMax0); + testPostShiftOrder(prevVal1, currVal1, prevIsMax1, currIsMax1); + testPostShiftOrder(prevVal2, currVal2, prevIsMax2, currIsMax2); + + prevIsMax0 = currIsMax0; + prevVal0 = currVal0; + prevIsMax1 = currIsMax1; + prevVal1 = currVal1; + prevIsMax2 = currIsMax2; + prevVal2 = currVal2; + + epValues0[i] = currVal0; + epValues1[i] = currVal1; + epValues2[i] = currVal2; + } + + PX_ASSERT(isSelfOrdered()); +} + +#if PX_CHECKED +bool BroadPhaseSap::isValid(const BroadPhaseUpdateData& updateData) const +{ + //Test that the created bounds haven't been added already (without first being removed). + const BpHandle* created=updateData.getCreatedHandles(); + const PxU32 numCreated=updateData.getNumCreatedHandles(); + for(PxU32 i=0;i=mBoxesCapacity then we need to resize to add this id, meaning that the id must be new. + if(id= mBoxesCapacity) + return false; + } + + //Test that the updated bounds have been been added without being removed. + for(PxU32 i=0;i= mBoxesCapacity) + return false; + } + + //Test that the removed bounds have already been added and haven't been removed. + for(PxU32 i=0;i mBoxesCapacity) + { + const PxU32 oldBoxesCapacity=mBoxesCapacity; + const PxU32 newBoxesCapacity=updateData.getCapacity(); + SapBox1D* newBoxEndPts0 = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D")); + SapBox1D* newBoxEndPts1 = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D")); + SapBox1D* newBoxEndPts2 = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(SapBox1D)*newBoxesCapacity)), "SapBox1D")); + + PxMemCopy(newBoxEndPts0, mBoxEndPts[0], sizeof(SapBox1D)*oldBoxesCapacity); + PxMemCopy(newBoxEndPts1, mBoxEndPts[1], sizeof(SapBox1D)*oldBoxesCapacity); + PxMemCopy(newBoxEndPts2, mBoxEndPts[2], sizeof(SapBox1D)*oldBoxesCapacity); + for(PxU32 i=oldBoxesCapacity;i(PX_ALLOC(ALIGN_SIZE_16((sizeof(PxU8))*newBoxesCapacity), "Updated Boxes")); + } + + //Do we need more memory for the array of sorted boxes? + if(2*(mBoxesSize + mCreatedSize) + NUM_SENTINELS > mEndPointsCapacity) + { + const PxU32 newEndPointsCapacity = 2*(mBoxesSize + mCreatedSize) + NUM_SENTINELS; + + ValType* newEndPointValuesX = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(newEndPointsCapacity))), "BPValType")); + ValType* newEndPointValuesY = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(newEndPointsCapacity))), "BPValType")); + ValType* newEndPointValuesZ = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(ValType)*(newEndPointsCapacity))), "BPValType")); + BpHandle* newEndPointDatasX = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(newEndPointsCapacity))), "BpHandle")); + BpHandle* newEndPointDatasY = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(newEndPointsCapacity))), "BpHandle")); + BpHandle* newEndPointDatasZ = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*(newEndPointsCapacity))), "BpHandle")); + + PX_FREE(mListNext); + PX_FREE(mListPrev); + + mListNext = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*newEndPointsCapacity)), "NextList")); + mListPrev = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*newEndPointsCapacity)), "Prev")); + + for(PxU32 a = 1; a < newEndPointsCapacity; ++a) + { + mListNext[a-1] = BpHandle(a); + mListPrev[a] = BpHandle(a-1); + } + mListNext[newEndPointsCapacity-1] = BpHandle(newEndPointsCapacity-1); + mListPrev[0] = 0; + + PxMemCopy(newEndPointValuesX, mEndPointValues[0], sizeof(ValType)*(mBoxesSize*2+NUM_SENTINELS)); + PxMemCopy(newEndPointValuesY, mEndPointValues[1], sizeof(ValType)*(mBoxesSize*2+NUM_SENTINELS)); + PxMemCopy(newEndPointValuesZ, mEndPointValues[2], sizeof(ValType)*(mBoxesSize*2+NUM_SENTINELS)); + PxMemCopy(newEndPointDatasX, mEndPointDatas[0], sizeof(BpHandle)*(mBoxesSize*2+NUM_SENTINELS)); + PxMemCopy(newEndPointDatasY, mEndPointDatas[1], sizeof(BpHandle)*(mBoxesSize*2+NUM_SENTINELS)); + PxMemCopy(newEndPointDatasZ, mEndPointDatas[2], sizeof(BpHandle)*(mBoxesSize*2+NUM_SENTINELS)); + PX_FREE(mEndPointValues[0]); + PX_FREE(mEndPointValues[1]); + PX_FREE(mEndPointValues[2]); + PX_FREE(mEndPointDatas[0]); + PX_FREE(mEndPointDatas[1]); + PX_FREE(mEndPointDatas[2]); + mEndPointValues[0] = newEndPointValuesX; + mEndPointValues[1] = newEndPointValuesY; + mEndPointValues[2] = newEndPointValuesZ; + mEndPointDatas[0] = newEndPointDatasX; + mEndPointDatas[1] = newEndPointDatasY; + mEndPointDatas[2] = newEndPointDatasZ; + mEndPointsCapacity = newEndPointsCapacity; + + PX_FREE(mSortedUpdateElements); + PX_FREE(mActivityPockets); + mSortedUpdateElements = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BpHandle)*newEndPointsCapacity)), "SortedUpdateElements")); + mActivityPockets = reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16((sizeof(BroadPhaseActivityPocket)*newEndPointsCapacity)), "BroadPhaseActivityPocket")); + } + + PxMemZero(mBoxesUpdated, sizeof(PxU8) * (mBoxesCapacity)); + + for(PxU32 a=0;a volB) + addPair(volA, volB, mScratchAllocator, mPairs, da); + else + removePair(volA, volB, mScratchAllocator, mPairs, da); + } + } + + mData = da.mData; + mDataSize = da.mSize; + mDataCapacity = da.mCapacity; + + batchCreate(); + + //Compute the lists of created and deleted overlap pairs. + + ComputeCreatedDeletedPairsLists( + mBoxGroups, + mData,mDataSize, + mScratchAllocator, + mCreatedPairsArray,mCreatedPairsSize,mCreatedPairsCapacity, + mDeletedPairsArray,mDeletedPairsSize,mDeletedPairsCapacity, + mActualDeletedPairSize, + mPairs); + +#ifdef TEST_DELETED_PAIRS + // PT: TODO: why did we move this to another place? + DeletePairsLists(mActualDeletedPairSize, mDeletedPairsArray, mPairs); +#endif + + PX_ASSERT(isSelfConsistent()); + mBoxesSizePrev=mBoxesSize; +} + +void BroadPhaseBatchUpdateWorkTask::runInternal() +{ + mPairsSize=0; + mSap->batchUpdate(mAxis, mPairs, mPairsSize, mPairsCapacity); +} + +void BroadPhaseSap::update() +{ + PX_PROFILE_ZONE("BroadPhase.SapUpdate", mContextID); + + batchRemove(); + + //Check that the overlap pairs per axis have been reset. + PX_ASSERT(0==mBatchUpdateTasks[0].getPairsSize()); + PX_ASSERT(0==mBatchUpdateTasks[1].getPairsSize()); + PX_ASSERT(0==mBatchUpdateTasks[2].getPairsSize()); + + mBatchUpdateTasks[0].runInternal(); + mBatchUpdateTasks[1].runInternal(); + mBatchUpdateTasks[2].runInternal(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE void InsertEndPoints(const ValType* PX_RESTRICT newEndPointValues, const BpHandle* PX_RESTRICT newEndPointDatas, PxU32 numNewEndPoints, + ValType* PX_RESTRICT endPointValues, BpHandle* PX_RESTRICT endPointDatas, const PxU32 numEndPoints, SapBox1D* PX_RESTRICT boxes) +{ + ValType* const BaseEPValue = endPointValues; + BpHandle* const BaseEPData = endPointDatas; + + const PxU32 OldSize = numEndPoints-NUM_SENTINELS; + const PxU32 NewSize = numEndPoints-NUM_SENTINELS+numNewEndPoints; + + BaseEPValue[NewSize + 1] = BaseEPValue[OldSize + 1]; + BaseEPData[NewSize + 1] = BaseEPData[OldSize + 1]; + + PxI32 WriteIdx = PxI32(NewSize); + PxU32 CurrInsIdx = 0; + + //const SapValType* FirstValue = &BaseEPValue[0]; + const BpHandle* FirstData = &BaseEPData[0]; + const ValType* CurrentValue = &BaseEPValue[OldSize]; + const BpHandle* CurrentData = &BaseEPData[OldSize]; + while(CurrentData>=FirstData) + { + const ValType& SrcValue = *CurrentValue; + const BpHandle& SrcData = *CurrentData; + const ValType& InsValue = newEndPointValues[CurrInsIdx]; + const BpHandle& InsData = newEndPointDatas[CurrInsIdx]; + + // We need to make sure we insert maxs before mins to handle exactly equal endpoints correctly + const bool ShouldInsert = isMax(InsData) ? (SrcValue <= InsValue) : (SrcValue < InsValue); + + const ValType& MovedValue = ShouldInsert ? InsValue : SrcValue; + const BpHandle& MovedData = ShouldInsert ? InsData : SrcData; + BaseEPValue[WriteIdx] = MovedValue; + BaseEPData[WriteIdx] = MovedData; + boxes[getOwner(MovedData)].mMinMax[isMax(MovedData)] = BpHandle(WriteIdx--); + + if(ShouldInsert) + { + CurrInsIdx++; + if(CurrInsIdx >= numNewEndPoints) + break;//we just inserted the last endpoint + } + else + { + CurrentValue--; + CurrentData--; + } + } +} + +static PX_FORCE_INLINE bool Intersect3D(const ValType bDir1Min, const ValType bDir1Max, const ValType bDir2Min, const ValType bDir2Max, const ValType bDir3Min, const ValType bDir3Max, + const ValType cDir1Min, const ValType cDir1Max, const ValType cDir2Min, const ValType cDir2Max, const ValType cDir3Min, const ValType cDir3Max) +{ + return (bDir1Max >= cDir1Min && cDir1Max >= bDir1Min && + bDir2Max >= cDir2Min && cDir2Max >= bDir2Min && + bDir3Max >= cDir3Min && cDir3Max >= bDir3Min); +} + +void BroadPhaseSap::ComputeSortedLists( //const PxVec4& globalMin, const PxVec4& /*globalMax*/, + BpHandle* PX_RESTRICT newBoxIndicesSorted, PxU32& newBoxIndicesCount, BpHandle* PX_RESTRICT oldBoxIndicesSorted, PxU32& oldBoxIndicesCount, + bool& allNewBoxesStatics, bool& allOldBoxesStatics) +{ + //To help us gather the two lists of sorted boxes we are going to use a bitmap and our knowledge of the indices of the new boxes + const PxU32 bitmapWordCount = ((mBoxesCapacity*2 + 31) & ~31)/32; + TmpMem bitMapMem(bitmapWordCount); + PxU32* bitMapWords = bitMapMem.getBase(); + PxMemSet(bitMapWords, 0, sizeof(PxU32)*bitmapWordCount); + PxBitMap bitmap; + bitmap.setWords(bitMapWords, bitmapWordCount); + + const PxU32 axis0 = 0; + const PxU32 axis1 = 2; + const PxU32 axis2 = 1; + + const PxU32 insertAABBStart = 0; + const PxU32 insertAABBEnd = mCreatedSize; + const BpHandle* PX_RESTRICT createdAABBs = mCreated; + SapBox1D** PX_RESTRICT asapBoxes = mBoxEndPts; + const Bp::FilterGroup::Enum* PX_RESTRICT asapBoxGroupIds = mBoxGroups; + BpHandle* PX_RESTRICT asapEndPointDatas = mEndPointDatas[axis0]; + const PxU32 numSortedEndPoints = mBoxesSize*2 + NUM_SENTINELS; + + //Set the bitmap for new box ids and compute the aabb (of the sorted handles/indices and not of the values) that bounds all new boxes. + + PxU32 globalAABBMinX = PX_MAX_U32; + PxU32 globalAABBMinY = PX_MAX_U32; + PxU32 globalAABBMinZ = PX_MAX_U32; + PxU32 globalAABBMaxX = 0; + PxU32 globalAABBMaxY = 0; + PxU32 globalAABBMaxZ = 0; + + // PT: TODO: compute the global bounds from the initial data, more cache/SIMD-friendly + // => maybe doesn't work, we're dealing with indices here not actual float values IIRC + for(PxU32 i=insertAABBStart;i(globalMin.x)); + PxU32 _globalAABBMinY = IntegerAABB::encodeFloatMin(PxUnionCast(globalMin.y)); + PxU32 _globalAABBMinZ = IntegerAABB::encodeFloatMin(PxUnionCast(globalMin.z)); + PxU32 _globalAABBMaxX = IntegerAABB::encodeFloatMin(PxUnionCast(globalMax.x)); + PxU32 _globalAABBMaxY = IntegerAABB::encodeFloatMin(PxUnionCast(globalMax.y)); + PxU32 _globalAABBMaxZ = IntegerAABB::encodeFloatMin(PxUnionCast(globalMax.z)); + (void)_globalAABBMinX;*/ + + PxU32 oldStaticCount=0; + PxU32 newStaticCount=0; + + //Assign the sorted end pts to the appropriate arrays. + // PT: TODO: we could just do this loop before inserting the new endpts, i.e. no need for a bitmap etc + // => but we need to insert the pts first to have valid mMinMax data in the above loop. + // => but why do we iterate over endpoints and then skip the mins? Why not iterate directly over boxes? ====> probably to get sorted results + // => we could then just use the regular bounds data etc + for(PxU32 i=1;i nepsv(numEndPoints), bv(numEndPoints); + ValType* newEPSortedValues = nepsv.getBase(); + ValType* bufferValues = bv.getBase(); + + // PT: TODO: use the scratch allocator + Cm::RadixSortBuffered RS; + + for(PxU32 Axis=0;Axis<3;Axis++) + { + for(PxU32 i=0;i>1]); + bufferDatas[i] = setData(boxIndex, (sortedIndex&1)!=0); + } + } + + InsertEndPoints(bufferValues, bufferDatas, numEndPoints, mEndPointValues[Axis], mEndPointDatas[Axis], 2*(mBoxesSize-mCreatedSize)+NUM_SENTINELS, mBoxEndPts[Axis]); + } + } + + //Some debug tests. +#if PX_DEBUG + { + for(PxU32 i=0;i oldBoxesIndicesSortedMem(numOldBoxes); + TmpMem newBoxesIndicesSortedMem(numNewBoxes); + BpHandle* oldBoxesIndicesSorted = oldBoxesIndicesSortedMem.getBase(); + BpHandle* newBoxesIndicesSorted = newBoxesIndicesSortedMem.getBase(); + PxU32 oldBoxCount = 0; + PxU32 newBoxCount = 0; + + bool allNewBoxesStatics = false; + bool allOldBoxesStatics = false; + // PT: TODO: separate static/dynamic to speed things up, compute "minPosList" etc at the same time + // PT: TODO: isn't "newBoxesIndicesSorted" the same as what we already computed in batchCreate() ? + //Ready to gather the two lists now. + ComputeSortedLists(/*globalMin, globalMax,*/ newBoxesIndicesSorted, newBoxCount, oldBoxesIndicesSorted, oldBoxCount, allNewBoxesStatics, allOldBoxesStatics); + + //Intersect new boxes with new boxes and new boxes with existing boxes. + if(!allNewBoxesStatics || !allOldBoxesStatics) + { + const AuxData data0(newBoxCount, mBoxEndPts, newBoxesIndicesSorted, mBoxGroups); + + if(!allNewBoxesStatics) + performBoxPruningNewNew(&data0, mScratchAllocator, mFilter->getLUT(), mPairs, mData, mDataSize, mDataCapacity); + + // the old boxes are not the first ones in the array + if(numOldBoxes) + { + if(oldBoxCount) + { + const AuxData data1(oldBoxCount, mBoxEndPts, oldBoxesIndicesSorted, mBoxGroups); + + performBoxPruningNewOld(&data0, &data1, mScratchAllocator, mFilter->getLUT(), mPairs, mData, mDataSize, mDataCapacity); + } + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void BroadPhaseSap::batchRemove() +{ + if(!mRemovedSize) return; // Early-exit if no object has been removed + + //The box count is incremented when boxes are added to the create list but these boxes + //haven't yet been added to the pair manager or the sorted axis lists. We need to + //pretend that the box count is the value it was when the bp was last updated. + //Then, at the end, we need to set the box count to the number that includes the boxes + //in the create list and subtract off the boxes that have been removed. + PxU32 currBoxesSize=mBoxesSize; + mBoxesSize=mBoxesSizePrev; + + for(PxU32 Axis=0;Axis<3;Axis++) + { + ValType* const BaseEPValue = mEndPointValues[Axis]; + BpHandle* const BaseEPData = mEndPointDatas[Axis]; + PxU32 MinMinIndex = PX_MAX_U32; + for(PxU32 i=0;i>5); + TmpMem bitmapWords(bitmapWordCount); + PxMemZero(bitmapWords.getBase(),sizeof(PxU32)*bitmapWordCount); + PxBitMap bitmap; + bitmap.setWords(bitmapWords.getBase(),bitmapWordCount); + for(PxU32 i=0;i oldMaxNb); + PX_ASSERT(newMaxNb > 0); + PX_ASSERT(0==((newMaxNb*sizeof(BroadPhasePair)) & 15)); + BroadPhasePair* newElements = reinterpret_cast(scratchAllocator->alloc(sizeof(BroadPhasePair)*newMaxNb, true)); + PX_ASSERT(0==(uintptr_t(newElements) & 0x0f)); + PxMemCopy(newElements, elements, oldMaxNb*sizeof(BroadPhasePair)); + scratchAllocator->free(elements); + return newElements; +} + +#define PERFORM_COMPARISONS 1 + +void BroadPhaseSap::batchUpdate +(const PxU32 Axis, BroadPhasePair*& pairs, PxU32& pairsSize, PxU32& pairsCapacity) +{ + //Nothin updated so don't do anything + if(mUpdatedSize == 0) + return; + + //If number updated is sufficiently fewer than number of boxes (say less than 20%) + if((mUpdatedSize*5) < mBoxesSize) + { + batchUpdateFewUpdates(Axis, pairs, pairsSize, pairsCapacity); + return; + } + + PxU32 numPairs=0; + PxU32 maxNumPairs=pairsCapacity; + + const PxBounds3* PX_RESTRICT boxMinMax3D = mBoxBoundsMinMax; + SapBox1D* boxMinMax2D[6]={mBoxEndPts[1],mBoxEndPts[2],mBoxEndPts[2],mBoxEndPts[0],mBoxEndPts[0],mBoxEndPts[1]}; + + const SapBox1D* PX_RESTRICT boxMinMax0=boxMinMax2D[2*Axis+0]; + const SapBox1D* PX_RESTRICT boxMinMax1=boxMinMax2D[2*Axis+1]; + +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + const Bp::FilterGroup::Enum* PX_RESTRICT asapBoxGroupIds=mBoxGroups; +#endif + + SapBox1D* PX_RESTRICT asapBoxes=mBoxEndPts[Axis]; + + ValType* PX_RESTRICT asapEndPointValues=mEndPointValues[Axis]; + BpHandle* PX_RESTRICT asapEndPointDatas=mEndPointDatas[Axis]; + + ValType* const PX_RESTRICT BaseEPValues = asapEndPointValues; + BpHandle* const PX_RESTRICT BaseEPDatas = asapEndPointDatas; + + PxU8* PX_RESTRICT updated = mBoxesUpdated; + + //KS - can we lazy create these inside the loop? Might benefit us + + //There are no extents, jus the sentinels, so exit early. + if(isSentinel(BaseEPDatas[1])) + return; + + //We are going to skip the 1st element in the array (the sublist will be sorted) + //but we must first update its value if it has moved + //const PxU32 startIsMax = isMax(BaseEPDatas[1]); + PX_ASSERT(!isMax(BaseEPDatas[1])); + const BpHandle startHandle = getOwner(BaseEPDatas[1]); + + //KS - in theory, we should just be able to grab the min element but there's some issue where a body's max < min (i.e. an invalid extents) that + //appears in a unit test + // ValType ThisValue_ = boxMinMax3D[startHandle].getMin(Axis); + ValType ThisValue_ = encodeMin(boxMinMax3D[startHandle], Axis, mContactDistance[startHandle]); + + BaseEPValues[1] = ThisValue_; + + PxU32 updateCounter = mUpdatedSize*2; + + updateCounter -= updated[startHandle]; + + //We'll never overlap with this sentinel but it just ensures that we don't need to branch to see if + //there's a pocket that we need to test against + + BroadPhaseActivityPocket* PX_RESTRICT currentPocket = mActivityPockets; + + currentPocket->mEndIndex = 0; + currentPocket->mStartIndex = 0; + + BpHandle ind = 2; + PxU8 wasUpdated = updated[startHandle]; + for(; !isSentinel(BaseEPDatas[ind]); ++ind) + { + BpHandle ThisData = BaseEPDatas[ind]; + + const BpHandle handle = getOwner(ThisData); + + if(updated[handle] || wasUpdated) + { + wasUpdated = updated[handle]; + updateCounter -= wasUpdated; + + BpHandle ThisIndex = ind; + + const BpHandle startIsMax = isMax(ThisData); + + //Access and write back the updated values. TODO - can we avoid this when we're walking through inactive nodes? + //BPValType ThisValue = boxMinMax1D[Axis][twoHandle+startIsMax]; + //BPValType ThisValue = startIsMax ? boxMinMax3D[handle].getMax(Axis) : boxMinMax3D[handle].getMin(Axis); + //ValType ThisValue = boxMinMax3D[handle].getExtent(startIsMax, Axis); + + ValType ThisValue = startIsMax ? encodeMax(boxMinMax3D[handle], Axis, mContactDistance[handle]) + : encodeMin(boxMinMax3D[handle], Axis, mContactDistance[handle]); + + BaseEPValues[ThisIndex] = ThisValue; + + PX_ASSERT(handle!=BP_INVALID_BP_HANDLE); + + //We always iterate back through the list... + + BpHandle CurrentIndex = mListPrev[ThisIndex]; + ValType CurrentValue = BaseEPValues[CurrentIndex]; + //PxBpHandle CurrentData = BaseEPDatas[CurrentIndex]; + + if(CurrentValue > ThisValue) + { + wasUpdated = 1; + //Get the bounds of the curr aabb. + //Get the box1d of the curr aabb. + /*const SapBox1D* PX_RESTRICT Object=&asapBoxes[handle]; + PX_ASSERT(Object->mMinMax[0]!=BP_INVALID_BP_HANDLE); + PX_ASSERT(Object->mMinMax[1]!=BP_INVALID_BP_HANDLE);*/ + + // const ValType boxMax=boxMinMax3D[handle].getMax(Axis); + + const ValType boxMax=encodeMax(boxMinMax3D[handle], Axis, mContactDistance[handle]); + + PxU32 endIndex = ind; + PxU32 startIndex = ind; + +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + const Bp::FilterGroup::Enum group = asapBoxGroupIds[handle]; +#endif + if(!isMax(ThisData)) + { + do + { + BpHandle CurrentData = BaseEPDatas[CurrentIndex]; + const BpHandle IsMax = isMax(CurrentData); + + #if PERFORM_COMPARISONS + if(IsMax) + { + const BpHandle ownerId=getOwner(CurrentData); + SapBox1D* PX_RESTRICT id1 = asapBoxes + ownerId; + // Our min passed a max => start overlap + + if( + BaseEPValues[id1->mMinMax[0]] < boxMax && + //2D intersection test using up-to-date values + Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1], + boxMinMax0[ownerId].mMinMax[0],boxMinMax0[ownerId].mMinMax[1],boxMinMax1[ownerId].mMinMax[0],boxMinMax1[ownerId].mMinMax[1]) + + #if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + && groupFiltering(group, asapBoxGroupIds[ownerId], mFilter->getLUT()) + #else + && handle!=ownerId + #endif + ) + { + if(numPairs==maxNumPairs) + { + const PxU32 newMaxNumPairs=maxNumPairs*2; + pairs = reinterpret_cast(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs)); + maxNumPairs=newMaxNumPairs; + } + PX_ASSERT(numPairs stop overlap + const BpHandle ownerId=getOwner(CurrentData); + +#if 1 + if( +#if BP_SAP_USE_OVERLAP_TEST_ON_REMOVES + Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1], + boxMinMax0[ownerId].mMinMax[0],boxMinMax0[ownerId].mMinMax[1],boxMinMax1[ownerId].mMinMax[0],boxMinMax1[ownerId].mMinMax[1]) +#endif +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + && groupFiltering(group, asapBoxGroupIds[ownerId], mFilter->getLUT()) +#else + && handle!=ownerId +#endif + ) +#endif + { + if(numPairs==maxNumPairs) + { + const PxU32 newMaxNumPairs=maxNumPairs*2; + pairs = reinterpret_cast(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs)); + maxNumPairs=newMaxNumPairs; + } + PX_ASSERT(numPairsmStartIndex) + { + currentPocket--; + } + //If our start index > currentPocket->mEndIndex, then we don't overlap so create a new pocket + if(currentPocket == mActivityPockets || startIndex > (currentPocket->mEndIndex+1)) + { + currentPocket++; + currentPocket->mStartIndex = startIndex; + } + currentPocket->mEndIndex = endIndex; + }// update max + //ind++; + } + else if (updateCounter == 0) //We've updated all the bodies and neither this nor the previous body was updated, so we're done + break; + + }// updated aabbs + + pairsSize=numPairs; + pairsCapacity=maxNumPairs; + + BroadPhaseActivityPocket* pocket = mActivityPockets+1; + + while(pocket <= currentPocket) + { + for(PxU32 a = pocket->mStartIndex; a <= pocket->mEndIndex; ++a) + { + mListPrev[a] = BpHandle(a); + } + + //Now copy all the data to the array, updating the remap table + + PxU32 CurrIndex = pocket->mStartIndex-1; + for(PxU32 a = pocket->mStartIndex; a <= pocket->mEndIndex; ++a) + { + CurrIndex = mListNext[CurrIndex]; + PxU32 origIndex = CurrIndex; + BpHandle remappedIndex = mListPrev[origIndex]; + + if(origIndex != a) + { + const BpHandle ownerId=getOwner(BaseEPDatas[remappedIndex]); + const BpHandle IsMax = isMax(BaseEPDatas[remappedIndex]); + ValType tmp = BaseEPValues[a]; + BpHandle tmpHandle = BaseEPDatas[a]; + + BaseEPValues[a] = BaseEPValues[remappedIndex]; + BaseEPDatas[a] = BaseEPDatas[remappedIndex]; + + BaseEPValues[remappedIndex] = tmp; + BaseEPDatas[remappedIndex] = tmpHandle; + + mListPrev[remappedIndex] = mListPrev[a]; + //Write back remap index (should be an immediate jump to original index) + mListPrev[mListPrev[a]] = remappedIndex; + asapBoxes[ownerId].mMinMax[IsMax] = BpHandle(a); + } + } + + ////Reset next and prev ptrs back + for(PxU32 a = pocket->mStartIndex-1; a <= pocket->mEndIndex; ++a) + { + mListPrev[a+1] = BpHandle(a); + mListNext[a] = BpHandle(a+1); + } + + pocket++; + } + mListPrev[0] = 0; +} + +void BroadPhaseSap::batchUpdateFewUpdates(const PxU32 Axis, BroadPhasePair*& pairs, PxU32& pairsSize, PxU32& pairsCapacity) +{ + PxU32 numPairs=0; + PxU32 maxNumPairs=pairsCapacity; + + const PxBounds3* PX_RESTRICT boxMinMax3D = mBoxBoundsMinMax; + SapBox1D* boxMinMax2D[6]={mBoxEndPts[1],mBoxEndPts[2],mBoxEndPts[2],mBoxEndPts[0],mBoxEndPts[0],mBoxEndPts[1]}; + +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + const Bp::FilterGroup::Enum* PX_RESTRICT asapBoxGroupIds=mBoxGroups; +#endif + + SapBox1D* PX_RESTRICT asapBoxes=mBoxEndPts[Axis]; + + /*const BPValType* PX_RESTRICT boxMinMax0=boxMinMax2D[2*Axis]; + const BPValType* PX_RESTRICT boxMinMax1=boxMinMax2D[2*Axis+1];*/ + + ValType* PX_RESTRICT asapEndPointValues=mEndPointValues[Axis]; + BpHandle* PX_RESTRICT asapEndPointDatas=mEndPointDatas[Axis]; + + ValType* const PX_RESTRICT BaseEPValues = asapEndPointValues; + BpHandle* const PX_RESTRICT BaseEPDatas = asapEndPointDatas; + + const SapBox1D* PX_RESTRICT boxMinMax0=boxMinMax2D[2*Axis+0]; + const SapBox1D* PX_RESTRICT boxMinMax1=boxMinMax2D[2*Axis+1]; + + PxU8* PX_RESTRICT updated = mBoxesUpdated; + + const PxU32 endPointSize = mBoxesSize*2 + 1; + + //There are no extents, just the sentinels, so exit early. + if(isSentinel(BaseEPDatas[1])) + return; + + PxU32 ind_ = 0; + + PxU32 index = 1; + + if(mUpdatedSize < 512) + { + //The array of updated elements is small, so use qsort to sort them + for(PxU32 a = 0; a < mUpdatedSize; ++a) + { + const PxU32 handle=mUpdated[a]; + + const SapBox1D* Object=&asapBoxes[handle]; + + PX_ASSERT(Object->mMinMax[0]!=BP_INVALID_BP_HANDLE); + PX_ASSERT(Object->mMinMax[1]!=BP_INVALID_BP_HANDLE); + + //Get the bounds of the curr aabb. + +// const ValType boxMin=boxMinMax3D[handle].getMin(Axis); +// const ValType boxMax=boxMinMax3D[handle].getMax(Axis); + + const ValType boxMin = encodeMin(boxMinMax3D[handle], Axis, mContactDistance[handle]); + const ValType boxMax = encodeMax(boxMinMax3D[handle], Axis, mContactDistance[handle]); + + BaseEPValues[Object->mMinMax[0]] = boxMin; + BaseEPValues[Object->mMinMax[1]] = boxMax; + + mSortedUpdateElements[ind_++] = Object->mMinMax[0]; + mSortedUpdateElements[ind_++] = Object->mMinMax[1]; + } + PxSort(mSortedUpdateElements, ind_); + } + else + { + //The array of updated elements is large so use a bucket sort to sort them + for(; index < endPointSize; ++index) + { + if(isSentinel( BaseEPDatas[index] )) + break; + BpHandle ThisData = BaseEPDatas[index]; + BpHandle owner = BpHandle(getOwner(ThisData)); + if(updated[owner]) + { + //BPValType ThisValue = isMax(ThisData) ? boxMinMax3D[owner].getMax(Axis) : boxMinMax3D[owner].getMin(Axis); + ValType ThisValue = isMax(ThisData) ? encodeMax(boxMinMax3D[owner], Axis, mContactDistance[owner]) + : encodeMin(boxMinMax3D[owner], Axis, mContactDistance[owner]); + BaseEPValues[index] = ThisValue; + mSortedUpdateElements[ind_++] = BpHandle(index); + } + } + } + + const PxU32 updateCounter = ind_; + + //We'll never overlap with this sentinel but it just ensures that we don't need to branch to see if + //there's a pocket that we need to test against + BroadPhaseActivityPocket* PX_RESTRICT currentPocket = mActivityPockets; + currentPocket->mEndIndex = 0; + currentPocket->mStartIndex = 0; + + for(PxU32 a = 0; a < updateCounter; ++a) + { + BpHandle ind = mSortedUpdateElements[a]; + + BpHandle NextData; + BpHandle PrevData; + do + { + BpHandle ThisData = BaseEPDatas[ind]; + + const BpHandle handle = getOwner(ThisData); + + BpHandle ThisIndex = ind; + ValType ThisValue = BaseEPValues[ThisIndex]; + + //Get the box1d of the curr aabb. + const SapBox1D* PX_RESTRICT Object=&asapBoxes[handle]; + + PX_ASSERT(handle!=BP_INVALID_BP_HANDLE); + + PX_ASSERT(Object->mMinMax[0]!=BP_INVALID_BP_HANDLE); + PX_ASSERT(Object->mMinMax[1]!=BP_INVALID_BP_HANDLE); + PX_UNUSED(Object); + + //Get the bounds of the curr aabb. + //const PxU32 twoHandle = 2*handle; + + const ValType boxMax=encodeMax(boxMinMax3D[handle], Axis, mContactDistance[handle]); + + //We always iterate back through the list... + BpHandle CurrentIndex = mListPrev[ThisIndex]; + ValType CurrentValue = BaseEPValues[CurrentIndex]; + + if(CurrentValue > ThisValue) + { + //We're performing some swaps so we need an activity pocket here. This structure allows us to keep track of the range of + //modifications in the sorted lists. Doesn't help when everything's moving but makes a really big difference to reconstituting the + //list when only a small number of things are moving + + PxU32 endIndex = ind; + PxU32 startIndex = ind; + + //const BPValType* PX_RESTRICT box0MinMax0 = &boxMinMax0[twoHandle]; + //const BPValType* PX_RESTRICT box0MinMax1 = &boxMinMax1[twoHandle]; +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + const Bp::FilterGroup::Enum group = asapBoxGroupIds[handle]; +#endif + if(!isMax(ThisData)) + { + do + { + BpHandle CurrentData = BaseEPDatas[CurrentIndex]; + const BpHandle IsMax = isMax(CurrentData); + + #if PERFORM_COMPARISONS + if(IsMax) + { + const BpHandle ownerId=getOwner(CurrentData); + SapBox1D* PX_RESTRICT id1 = asapBoxes + ownerId; + // Our min passed a max => start overlap + + if( + BaseEPValues[id1->mMinMax[0]] < boxMax && + //2D intersection test using up-to-date values + Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1], + boxMinMax0[ownerId].mMinMax[0],boxMinMax0[ownerId].mMinMax[1],boxMinMax1[ownerId].mMinMax[0],boxMinMax1[ownerId].mMinMax[1]) + #if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + && groupFiltering(group, asapBoxGroupIds[ownerId], mFilter->getLUT()) + #else + && Object!=id1 + #endif + ) + { + if(numPairs==maxNumPairs) + { + const PxU32 newMaxNumPairs=maxNumPairs*2; + pairs = reinterpret_cast(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs)); + maxNumPairs=newMaxNumPairs; + } + PX_ASSERT(numPairs stop overlap + const BpHandle ownerId=getOwner(CurrentData); + +#if 1 + if( +#if BP_SAP_USE_OVERLAP_TEST_ON_REMOVES + Intersect2D_Handle(boxMinMax0[handle].mMinMax[0], boxMinMax0[handle].mMinMax[1], boxMinMax1[handle].mMinMax[0], boxMinMax1[handle].mMinMax[1], + boxMinMax0[ownerId].mMinMax[0],boxMinMax0[ownerId].mMinMax[1],boxMinMax1[ownerId].mMinMax[0],boxMinMax1[ownerId].mMinMax[1]) +#endif +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + && groupFiltering(group, asapBoxGroupIds[ownerId], mFilter->getLUT()) +#else + && Object!=id1 +#endif + ) +#endif + { + if(numPairs==maxNumPairs) + { + const PxU32 newMaxNumPairs=maxNumPairs*2; + pairs = reinterpret_cast(resizeBroadPhasePairArray(maxNumPairs, newMaxNumPairs, mScratchAllocator, pairs)); + maxNumPairs=newMaxNumPairs; + } + PX_ASSERT(numPairsmStartIndex) + { + currentPocket--; + } + //If our start index > currentPocket->mEndIndex, then we don't overlap so create a new pocket + if(currentPocket == mActivityPockets || startIndex > (currentPocket->mEndIndex+1)) + { + currentPocket++; + currentPocket->mStartIndex = startIndex; + } + currentPocket->mEndIndex = endIndex; + }// update max + //Get prev and next ptr... + + NextData = BaseEPDatas[++ind]; + PrevData = BaseEPDatas[mListPrev[ind]]; + + }while(!isSentinel(NextData) && !updated[getOwner(NextData)] && updated[getOwner(PrevData)]); + + }// updated aabbs + + pairsSize=numPairs; + pairsCapacity=maxNumPairs; + + BroadPhaseActivityPocket* pocket = mActivityPockets+1; + + while(pocket <= currentPocket) + { + //PxU32 CurrIndex = mListPrev[pocket->mStartIndex]; + for(PxU32 a = pocket->mStartIndex; a <= pocket->mEndIndex; ++a) + { + mListPrev[a] = BpHandle(a); + } + + //Now copy all the data to the array, updating the remap table + PxU32 CurrIndex = pocket->mStartIndex-1; + for(PxU32 a = pocket->mStartIndex; a <= pocket->mEndIndex; ++a) + { + CurrIndex = mListNext[CurrIndex]; + PxU32 origIndex = CurrIndex; + BpHandle remappedIndex = mListPrev[origIndex]; + + if(origIndex != a) + { + const BpHandle ownerId=getOwner(BaseEPDatas[remappedIndex]); + const BpHandle IsMax = isMax(BaseEPDatas[remappedIndex]); + ValType tmp = BaseEPValues[a]; + BpHandle tmpHandle = BaseEPDatas[a]; + + BaseEPValues[a] = BaseEPValues[remappedIndex]; + BaseEPDatas[a] = BaseEPDatas[remappedIndex]; + + BaseEPValues[remappedIndex] = tmp; + BaseEPDatas[remappedIndex] = tmpHandle; + + mListPrev[remappedIndex] = mListPrev[a]; + //Write back remap index (should be an immediate jump to original index) + mListPrev[mListPrev[a]] = remappedIndex; + asapBoxes[ownerId].mMinMax[IsMax] = BpHandle(a); + } + + } + + for(PxU32 a = pocket->mStartIndex-1; a <= pocket->mEndIndex; ++a) + { + mListPrev[a+1] = BpHandle(a); + mListNext[a] = BpHandle(a+1); + } + pocket++; + } +} + +#if PX_DEBUG + +bool BroadPhaseSap::isSelfOrdered() const +{ + if(0==mBoxesSize) + return true; + + for(PxU32 Axis=0;Axis<3;Axis++) + { + PxU32 it=1; + PX_ASSERT(mEndPointDatas[Axis]); + while(!isSentinel(mEndPointDatas[Axis][it])) + { + //Test the array is sorted. + const ValType prevVal=mEndPointValues[Axis][it-1]; + const ValType currVal=mEndPointValues[Axis][it]; + if(currValid1) PxBpHandleSwap(id0, id1); +} + +PX_FORCE_INLINE bool DifferentPair(const BroadPhasePair& p, BpHandle id0, BpHandle id1) +{ + return (id0!=p.mVolA) || (id1!=p.mVolB); +} + +PX_FORCE_INLINE int Hash32Bits_1(int key) +{ + key += ~(key << 15); + key ^= (key >> 10); + key += (key << 3); + key ^= (key >> 6); + key += ~(key << 11); + key ^= (key >> 16); + return key; +} + +PX_FORCE_INLINE PxU32 Hash(BpHandle id0, BpHandle id1) +{ + return PxU32(Hash32Bits_1( int(PxU32(id0)|(PxU32(id1)<<16)) )); +} + +/////////////////////////////////////////////////////////////////////////////// + +SapPairManager::SapPairManager() : + mHashTable (NULL), + mNext (NULL), + mHashSize (0), + mHashCapacity (0), + mMinAllowedHashCapacity (0), + mActivePairs (NULL), + mActivePairStates (NULL), + mNbActivePairs (0), + mActivePairsCapacity (0), + mMask (0) +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +SapPairManager::~SapPairManager() +{ + PX_ASSERT(NULL==mHashTable); + PX_ASSERT(NULL==mNext); + PX_ASSERT(NULL==mActivePairs); + PX_ASSERT(NULL==mActivePairStates); +} + +/////////////////////////////////////////////////////////////////////////////// + + +void SapPairManager::init(const PxU32 size) +{ + mHashTable=reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16(sizeof(BpHandle)*size), "BpHandle")); + mNext=reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16(sizeof(BpHandle)*size), "BpHandle")); + mActivePairs=reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16(sizeof(BroadPhasePair)*size), "BroadPhasePair")); + mActivePairStates=reinterpret_cast(PX_ALLOC(ALIGN_SIZE_16(sizeof(PxU8)*size), "BroadPhaseContextSap ActivePairStates")); + mHashCapacity=size; + mMinAllowedHashCapacity = size; + mActivePairsCapacity=size; +} + +/////////////////////////////////////////////////////////////////////////////// + +void SapPairManager::release() +{ + PX_FREE(mHashTable); + PX_FREE(mNext); + PX_FREE(mActivePairs); + PX_FREE(mActivePairStates); + mHashSize = 0; + mHashCapacity = 0; + mMinAllowedHashCapacity = 0; + mNbActivePairs = 0; + mActivePairsCapacity = 0; + mMask = 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +const BroadPhasePair* SapPairManager::FindPair(BpHandle id0, BpHandle id1) const +{ + if(0==mHashSize) return NULL; // Nothing has been allocated yet + + // Order the ids + Sort(id0, id1); + + // Compute hash value for this pair + PxU32 HashValue = Hash(id0, id1) & mMask; + PX_ASSERT(HashValue the pair is persistent + PX_ASSERT(Offset the pair is persistent + PX_ASSERT(Offset= mHashSize) + { + // Get more entries + mHashSize = PxNextPowerOfTwo(mNbActivePairs+1); + mMask = mHashSize-1; + + reallocPairs(mHashSize>mHashCapacity); + + // Recompute hash value with new hash size + HashValue = Hash(id0, id1) & mMask; + } + + PX_ASSERT(mNbActivePairsmVolA = id0; // ### CMOVs would be nice here + p->mVolB = id1; + mActivePairStates[mNbActivePairs]=state; + + PX_ASSERT(mNbActivePairsmVolA, Last->mVolB) & mMask; + + // Walk the hash table to fix mNext + PX_ASSERT(LastHashValuemVolA==id0); + PX_ASSERT(P->mVolB==id1); + + RemovePair(id0, id1, HashValue, GetPairIndex(P)); + + shrinkMemory(); + + return true; +} + +bool SapPairManager::RemovePairs(const PxBitMap& removedAABBs) +{ + PxU32 i=0; + while(i mMinAllowedHashCapacity) || (mHashSize <= (mHashCapacity >> 2)) || (mHashSize <= (mActivePairsCapacity >> 2))); +} + +void SapPairManager::reallocPairs(const bool allocRequired) +{ + if(allocRequired) + { + PX_FREE(mHashTable); + mHashCapacity=mHashSize; + mActivePairsCapacity=mHashSize; + mHashTable = reinterpret_cast(PX_ALLOC(mHashSize*sizeof(BpHandle), "BpHandle")); + + for(PxU32 i=0;i(PX_ALLOC(mHashSize * sizeof(BroadPhasePair), "BroadPhasePair")); PX_ASSERT(NewPairs); + BpHandle* NewNext = reinterpret_cast(PX_ALLOC(mHashSize * sizeof(BpHandle), "BpHandle")); PX_ASSERT(NewNext); + PxU8* NewPairStates = reinterpret_cast(PX_ALLOC(mHashSize * sizeof(PxU8), "SapPairStates")); PX_ASSERT(NewPairStates); + + // Copy old data if needed + if(mNbActivePairs) + { + PxMemCopy(NewPairs, mActivePairs, mNbActivePairs*sizeof(BroadPhasePair)); + PxMemCopy(NewPairStates, mActivePairStates, mNbActivePairs*sizeof(PxU8)); + } + + // ### check it's actually needed... probably only for pairs whose hash value was cut by the and + // yeah, since Hash(id0, id1) is a constant + // However it might not be needed to recompute them => only less efficient but still ok + for(PxU32 i=0;i only less efficient but still ok + for(PxU32 i=0;i0); + const PxU32 newMaxNumPairs=2*maxNumPairs; + BroadPhasePair* newPairs=reinterpret_cast(PX_ALLOC(sizeof(BroadPhasePair)*newMaxNumPairs, "BroadPhasePair")); + PxMemCopy(newPairs, pairs, sizeof(BroadPhasePair)*maxNumPairs); + PX_FREE(pairs); + pairs=newPairs; + maxNumPairs=newMaxNumPairs; +} + +void ComputeCreatedDeletedPairsLists +(const Bp::FilterGroup::Enum* PX_RESTRICT boxGroups, + const BpHandle* PX_RESTRICT dataArray, const PxU32 dataArraySize, + PxcScratchAllocator* scratchAllocator, + BroadPhasePair*& createdPairsList, PxU32& numCreatedPairs, PxU32& maxNumCreatedPairs, + BroadPhasePair*& deletedPairsList, PxU32& numDeletedPairs, PxU32& maxNumDeletedPairs, + PxU32& numActualDeletedPairs, + SapPairManager& pairManager) +{ +#if BP_SAP_TEST_GROUP_ID_CREATEUPDATE + PX_UNUSED(boxGroups); +#endif + + for(PxU32 i=0;i(scratchAllocator->alloc(sizeof(BroadPhasePair)*2*maxNumDeletedPairs, true)); + PxMemCopy(newDeletedPairsList, deletedPairsList, sizeof(BroadPhasePair)*maxNumDeletedPairs); + scratchAllocator->free(deletedPairsList); + deletedPairsList = newDeletedPairsList; + maxNumDeletedPairs = 2*maxNumDeletedPairs; + } + + PX_ASSERT(numDeletedPairsmUserData != 0xcdcdcdcd); + deletedPairsList[numDeletedPairs++] = BroadPhasePair(UP->mVolA,UP->mVolB/*, ID*/); + } + } + else + { + pairManager.ClearInArray(UP); + // Add => already there... Might want to create user data, though + if(pairManager.IsNew(UP)) + { +#if !BP_SAP_TEST_GROUP_ID_CREATEUPDATE + if(groupFiltering(boxGroups[UP->mVolA], boxGroups[UP->mVolB])) +#endif + { + if(numCreatedPairs==maxNumCreatedPairs) + { + BroadPhasePair* newCreatedPairsList = reinterpret_cast(scratchAllocator->alloc(sizeof(BroadPhasePair)*2*maxNumCreatedPairs, true)); + PxMemCopy(newCreatedPairsList, createdPairsList, sizeof(BroadPhasePair)*maxNumCreatedPairs); + scratchAllocator->free(createdPairsList); + createdPairsList = newCreatedPairsList; + maxNumCreatedPairs = 2*maxNumCreatedPairs; + } + + PX_ASSERT(numCreatedPairsmVolA,UP->mVolB/*, ID*/); + } + pairManager.ClearNew(UP); + } + } + } + + //Record pairs that are to be deleted because they were simultaneously created and removed + //from different axis sorts. + numActualDeletedPairs=numDeletedPairs; + for(PxU32 i=0;i(scratchAllocator->alloc(sizeof(BroadPhasePair)*2*maxNumDeletedPairs, true)); + PxMemCopy(newDeletedPairsList, deletedPairsList, sizeof(BroadPhasePair)*maxNumDeletedPairs); + scratchAllocator->free(deletedPairsList); + deletedPairsList = newDeletedPairsList; + maxNumDeletedPairs = 2*maxNumDeletedPairs; + } + + PX_ASSERT(numActualDeletedPairs<=maxNumDeletedPairs); + deletedPairsList[numActualDeletedPairs++] = BroadPhasePair(UP->mVolA,UP->mVolB/*, ID*/); //KS - should we even get here???? + } + } + +// // #### try batch removal here +// for(PxU32 i=0;i i && boxGroups[deletedPairsList[numDeletedPairs-1].mVolA] == boxGroups[deletedPairsList[numDeletedPairs-1].mVolB]) + { + numDeletedPairs--; + } + deletedPairsList[i]=deletedPairsList[numDeletedPairs-1]; + numDeletedPairs--; + } + } +#endif +} + +//#define PRINT_STATS +#ifdef PRINT_STATS + #include + static PxU32 gNbIter = 0; + static PxU32 gNbTests = 0; + static PxU32 gNbPairs = 0; + #define START_STATS gNbIter = gNbTests = gNbPairs = 0; + #define INCREASE_STATS_NB_ITER gNbIter++; + #define INCREASE_STATS_NB_TESTS gNbTests++; + #define INCREASE_STATS_NB_PAIRS gNbPairs++; + #define DUMP_STATS printf("%d %d %d\n", gNbIter, gNbTests, gNbPairs); +#else + #define START_STATS + #define INCREASE_STATS_NB_ITER + #define INCREASE_STATS_NB_TESTS + #define INCREASE_STATS_NB_PAIRS + #define DUMP_STATS +#endif + +void DataArray::Resize(PxcScratchAllocator* scratchAllocator) +{ + BpHandle* newDataArray = reinterpret_cast(scratchAllocator->alloc(sizeof(BpHandle)*mCapacity*2, true)); + PxMemCopy(newDataArray, mData, mCapacity*sizeof(BpHandle)); + scratchAllocator->free(mData); + mData = newDataArray; + mCapacity *= 2; +} + +static PX_FORCE_INLINE int intersect2D(const BoxYZ& a, const BoxYZ& b) +{ + const bool b0 = b.mMaxY < a.mMinY; + const bool b1 = a.mMaxY < b.mMinY; + const bool b2 = b.mMaxZ < a.mMinZ; + const bool b3 = a.mMaxZ < b.mMinZ; +// const bool b4 = b0 || b1 || b2 || b3; + const bool b4 = b0 | b1 | b2 | b3; + return !b4; +} + +void addPair(const BpHandle id0, const BpHandle id1, PxcScratchAllocator* scratchAllocator, SapPairManager& pairManager, DataArray& dataArray) +{ + const BroadPhasePair* UP = reinterpret_cast(pairManager.AddPair(id0, id1, SapPairManager::PAIR_UNKNOWN)); + + //If the hash table has reached its limit then we're unable to add a new pair. + if(NULL==UP) + return; + + PX_ASSERT(UP); + if(pairManager.IsUnknown(UP)) + { + pairManager.ClearState(UP); + pairManager.SetInArray(UP); + dataArray.AddData(pairManager.GetPairIndex(UP), scratchAllocator); + pairManager.SetNew(UP); + } + pairManager.ClearRemoved(UP); +} + +void removePair(BpHandle id0, BpHandle id1, PxcScratchAllocator* scratchAllocator, SapPairManager& pairManager, DataArray& dataArray) +{ + const BroadPhasePair* UP = reinterpret_cast(pairManager.FindPair(id0, id1)); + if(UP) + { + if(!pairManager.IsInArray(UP)) + { + pairManager.SetInArray(UP); + dataArray.AddData(pairManager.GetPairIndex(UP), scratchAllocator); + } + pairManager.SetRemoved(UP); + } +} + +struct AddPairParams +{ + AddPairParams(const PxU32* remap0, const PxU32* remap1, PxcScratchAllocator* alloc, SapPairManager* pm, DataArray* da) : + mRemap0 (remap0), + mRemap1 (remap1), + mScratchAllocator (alloc), + mPairManager (pm), + mDataArray (da) + { + } + + const PxU32* mRemap0; + const PxU32* mRemap1; + PxcScratchAllocator* mScratchAllocator; + SapPairManager* mPairManager; + DataArray* mDataArray; +}; + +static void addPair(const AddPairParams* PX_RESTRICT params, const BpHandle id0_, const BpHandle id1_) +{ + SapPairManager& pairManager = *params->mPairManager; + + const BroadPhasePair* UP = reinterpret_cast(pairManager.AddPair(params->mRemap0[id0_], params->mRemap1[id1_], SapPairManager::PAIR_UNKNOWN)); + + //If the hash table has reached its limit then we're unable to add a new pair. + if(NULL==UP) + return; + + PX_ASSERT(UP); + if(pairManager.IsUnknown(UP)) + { + pairManager.ClearState(UP); + pairManager.SetInArray(UP); + params->mDataArray->AddData(pairManager.GetPairIndex(UP), params->mScratchAllocator); + pairManager.SetNew(UP); + } + pairManager.ClearRemoved(UP); +} + +// PT: TODO: use SIMD + +AuxData::AuxData(PxU32 nb, const SapBox1D*const* PX_RESTRICT boxes, const BpHandle* PX_RESTRICT indicesSorted, const Bp::FilterGroup::Enum* PX_RESTRICT groupIds) +{ + // PT: TODO: use scratch allocator / etc + BoxX* PX_RESTRICT boxX = reinterpret_cast(PX_ALLOC(sizeof(BoxX)*(nb+1), "mBoxX")); + BoxYZ* PX_RESTRICT boxYZ = reinterpret_cast(PX_ALLOC(sizeof(BoxYZ)*nb, "mBoxYZ")); + Bp::FilterGroup::Enum* PX_RESTRICT groups = reinterpret_cast(PX_ALLOC(sizeof(Bp::FilterGroup::Enum)*nb, "mGroups")); + PxU32* PX_RESTRICT remap = reinterpret_cast(PX_ALLOC(sizeof(PxU32)*nb, "mRemap")); + + mBoxX = boxX; + mBoxYZ = boxYZ; + mGroups = groups; + mRemap = remap; + mNb = nb; + + const PxU32 axis0 = 0; + const PxU32 axis1 = 2; + const PxU32 axis2 = 1; + + const SapBox1D* PX_RESTRICT boxes0 = boxes[axis0]; + const SapBox1D* PX_RESTRICT boxes1 = boxes[axis1]; + const SapBox1D* PX_RESTRICT boxes2 = boxes[axis2]; + + for(PxU32 i=0;imNb; + if(!nb) + return; + + DataArray da(dataArray, dataArraySize, dataArrayCapacity); + + START_STATS + { + BoxX* boxX = auxData->mBoxX; + BoxYZ* boxYZ = auxData->mBoxYZ; + Bp::FilterGroup::Enum* groups = auxData->mGroups; + PxU32* remap = auxData->mRemap; + + AddPairParams params(remap, remap, scratchAllocator, &pairManager, &da); + + PxU32 runningIndex = 0; + PxU32 index0 = 0; + + while(runningIndex(&boxYZ[index0].mMinY)); + b = _mm_shuffle_epi32(b, 78); + const __m128i a = _mm_loadu_si128(reinterpret_cast(&boxYZ[index1].mMinY)); + const __m128i d = _mm_cmpgt_epi32(a, b); + const int mask = _mm_movemask_epi8(d); + if(mask==0x0000ff00)*/ + { + INCREASE_STATS_NB_PAIRS + addPair(¶ms, index0, index1); + } + } + index1++; + } + index0++; + } + } + DUMP_STATS + + dataArray = da.mData; + dataArraySize = da.mSize; + dataArrayCapacity = da.mCapacity; +} + +template +static void bipartitePruning( + const PxU32 nb0, const BoxX* PX_RESTRICT boxX0, const BoxYZ* PX_RESTRICT boxYZ0, const PxU32* PX_RESTRICT remap0, const Bp::FilterGroup::Enum* PX_RESTRICT groups0, + const PxU32 nb1, const BoxX* PX_RESTRICT boxX1, const BoxYZ* PX_RESTRICT boxYZ1, const PxU32* PX_RESTRICT remap1, const Bp::FilterGroup::Enum* PX_RESTRICT groups1, + const bool* lut, PxcScratchAllocator* scratchAllocator, SapPairManager& pairManager, DataArray& dataArray) +{ + AddPairParams params(remap0, remap1, scratchAllocator, &pairManager, &dataArray); + + PxU32 runningIndex = 0; + PxU32 index0 = 0; + + while(runningIndexmNb; + const PxU32 nb1 = auxData1->mNb; + + if(!nb0 || !nb1) + return; + + DataArray da(dataArray, dataArraySize, dataArrayCapacity); + + START_STATS + { + const BoxX* boxX0 = auxData0->mBoxX; + const BoxYZ* boxYZ0 = auxData0->mBoxYZ; + const Bp::FilterGroup::Enum* groups0 = auxData0->mGroups; + const PxU32* remap0 = auxData0->mRemap; + + const BoxX* boxX1 = auxData1->mBoxX; + const BoxYZ* boxYZ1 = auxData1->mBoxYZ; + const Bp::FilterGroup::Enum* groups1 = auxData1->mGroups; + const PxU32* remap1 = auxData1->mRemap; + bipartitePruning<0>(nb0, boxX0, boxYZ0, remap0, groups0, nb1, boxX1, boxYZ1, remap1, groups1, lut, scratchAllocator, pairManager, da); + bipartitePruning<1>(nb1, boxX1, boxYZ1, remap1, groups1, nb0, boxX0, boxYZ0, remap0, groups0, lut, scratchAllocator, pairManager, da); + } + DUMP_STATS + + dataArray = da.mData; + dataArraySize = da.mSize; + dataArrayCapacity = da.mCapacity; +} + +} //namespace Bp + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.h new file mode 100644 index 0000000..4ebce48 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseSapAux.h @@ -0,0 +1,275 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_SAP_AUX_H +#define BP_BROADPHASE_SAP_AUX_H + +#include "foundation/PxAssert.h" +#include "foundation/PxIntrinsics.h" +#include "foundation/PxUserAllocated.h" +#include "BpBroadPhase.h" +#include "BpBroadPhaseIntegerAABB.h" +#include "foundation/PxBitMap.h" + +namespace physx +{ +class PxcScratchAllocator; +namespace Bp +{ +#define ALIGN_SIZE_16(size) ((unsigned(size)+15)&(unsigned(~15))) + +#define NUM_SENTINELS 2 + +#define BP_SAP_USE_PREFETCH 1//prefetch in batchUpdate + +#define BP_SAP_USE_OVERLAP_TEST_ON_REMOVES 1// "Useless" but faster overall because seriously reduces number of calls (from ~10000 to ~3 sometimes!) + +//Set 1 to test for group ids in batchCreate/batchUpdate so we can avoid group id test in ComputeCreatedDeletedPairsLists +//Set 0 to neglect group id test in batchCreate/batchUpdate and delay test until ComputeCreatedDeletedPairsLists +#define BP_SAP_TEST_GROUP_ID_CREATEUPDATE 1 + +#define MAX_BP_HANDLE 0x3fffffff +#define PX_REMOVED_BP_HANDLE 0x3ffffffd + +PX_FORCE_INLINE void setMinSentinel(ValType& v, BpHandle& d) +{ + v = 0x00000000;//0x00800000; //0x00800000 is -FLT_MAX but setting it to 0 means we don't crash when we get a value outside the float range. + d = (BP_INVALID_BP_HANDLE & ~1); +} + +PX_FORCE_INLINE void setMaxSentinel(ValType& v, BpHandle& d) +{ + v = 0xffffffff;//0xff7fffff; //0xff7fffff is +FLT_MAX but setting it to 0xffffffff means we don't crash when we get a value outside the float range. + d = BP_INVALID_BP_HANDLE; +} + +PX_FORCE_INLINE BpHandle setData(PxU32 owner_box_id, const bool is_max) +{ + BpHandle d = BpHandle(owner_box_id<<1); + if(is_max) d |= 1; + return d; +} + +PX_FORCE_INLINE bool isSentinel(const BpHandle& d) +{ + return (d&~1)==(BP_INVALID_BP_HANDLE & ~1); +} + +PX_FORCE_INLINE BpHandle isMax(const BpHandle& d) +{ + return BpHandle(d & 1); +} + +PX_FORCE_INLINE BpHandle getOwner(const BpHandle& d) +{ + return BpHandle(d>>1); +} + +class SapBox1D +{ +public: + + PX_FORCE_INLINE SapBox1D() {} + PX_FORCE_INLINE ~SapBox1D() {} + + BpHandle mMinMax[2];//mMinMax[0]=min, mMinMax[1]=max +}; + +class SapPairManager +{ +public: + SapPairManager(); + ~SapPairManager(); + + void init(const PxU32 size); + void release(); + + void shrinkMemory(); + + const BroadPhasePair* AddPair (BpHandle id0, BpHandle id1, const PxU8 state); + bool RemovePair (BpHandle id0, BpHandle id1); + bool RemovePairs (const PxBitMap& removedAABBs); + const BroadPhasePair* FindPair (BpHandle id0, BpHandle id1) const; + + PX_FORCE_INLINE PxU32 GetPairIndex(const BroadPhasePair* PX_RESTRICT pair) const + { + return (PxU32((size_t(pair) - size_t(mActivePairs)))/sizeof(BroadPhasePair)); + } + + BpHandle* mHashTable; + BpHandle* mNext; + PxU32 mHashSize; + PxU32 mHashCapacity; + PxU32 mMinAllowedHashCapacity; + BroadPhasePair* mActivePairs; + PxU8* mActivePairStates; + PxU32 mNbActivePairs; + PxU32 mActivePairsCapacity; + PxU32 mMask; + + BroadPhasePair* FindPair (BpHandle id0, BpHandle id1, PxU32 hash_value) const; + void RemovePair (BpHandle id0, BpHandle id1, PxU32 hash_value, PxU32 pair_index); + void reallocPairs(const bool allocRequired); + + enum + { + PAIR_INARRAY=1, + PAIR_REMOVED=2, + PAIR_NEW=4, + PAIR_UNKNOWN=8 + }; + + PX_FORCE_INLINE bool IsInArray(const BroadPhasePair* PX_RESTRICT pair) const + { + const PxU8 state=mActivePairStates[pair-mActivePairs]; + return state & PAIR_INARRAY ? true : false; + } + PX_FORCE_INLINE bool IsRemoved(const BroadPhasePair* PX_RESTRICT pair) const + { + const PxU8 state=mActivePairStates[pair-mActivePairs]; + return state & PAIR_REMOVED ? true : false; + } + PX_FORCE_INLINE bool IsNew(const BroadPhasePair* PX_RESTRICT pair) const + { + const PxU8 state=mActivePairStates[pair-mActivePairs]; + return state & PAIR_NEW ? true : false; + } + PX_FORCE_INLINE bool IsUnknown(const BroadPhasePair* PX_RESTRICT pair) const + { + const PxU8 state=mActivePairStates[pair-mActivePairs]; + return state & PAIR_UNKNOWN ? true : false; + } + + PX_FORCE_INLINE void ClearState(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs]=0; + } + + PX_FORCE_INLINE void SetInArray(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] |= PAIR_INARRAY; + } + PX_FORCE_INLINE void SetRemoved(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] |= PAIR_REMOVED; + } + PX_FORCE_INLINE void SetNew(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] |= PAIR_NEW; + } + PX_FORCE_INLINE void ClearInArray(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] &= ~PAIR_INARRAY; + } + PX_FORCE_INLINE void ClearRemoved(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] &= ~PAIR_REMOVED; + } + PX_FORCE_INLINE void ClearNew(const BroadPhasePair* PX_RESTRICT pair) + { + mActivePairStates[pair-mActivePairs] &= ~PAIR_NEW; + } +}; + +struct DataArray +{ + DataArray(BpHandle* data, PxU32 size, PxU32 capacity) : mData(data), mSize(size), mCapacity(capacity) {} + + BpHandle* mData; + PxU32 mSize; + PxU32 mCapacity; + + PX_NOINLINE void Resize(PxcScratchAllocator* scratchAllocator); + + PX_FORCE_INLINE void AddData(const PxU32 data, PxcScratchAllocator* scratchAllocator) + { + if(mSize==mCapacity) + Resize(scratchAllocator); + + PX_ASSERT(mSize cDir1Min && cDir1Max > bDir1Min && + bDir2Max > cDir2Min && cDir2Max > bDir2Min); +} + +} //namespace Bp + +} //namespace physx + +#endif //BP_BROADPHASE_SAP_AUX_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp new file mode 100644 index 0000000..6aba7bf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.cpp @@ -0,0 +1,245 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpBroadPhaseShared.h" +#include "foundation/PxMemory.h" +#include "foundation/PxBitUtils.h" + +using namespace physx; +using namespace Bp; + +#define MBP_ALLOC(x) PX_ALLOC(x, "MBP") +#define MBP_FREE(x) PX_FREE(x) + +static PX_FORCE_INLINE void storeDwords(PxU32* dest, PxU32 nb, PxU32 value) +{ + while(nb--) + *dest++ = value; +} + +/////////////////////////////////////////////////////////////////////////////// + +PairManagerData::PairManagerData() : + mHashSize (0), + mMask (0), + mNbActivePairs (0), + mHashTable (NULL), + mNext (NULL), + mActivePairs (NULL), + mReservedMemory (0) +{ +} + +/////////////////////////////////////////////////////////////////////////////// + +PairManagerData::~PairManagerData() +{ + purge(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PairManagerData::purge() +{ + MBP_FREE(mNext); + MBP_FREE(mActivePairs); + MBP_FREE(mHashTable); + mHashSize = 0; + mMask = 0; + mNbActivePairs = 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +void PairManagerData::reallocPairs() +{ + MBP_FREE(mHashTable); + mHashTable = reinterpret_cast(MBP_ALLOC(mHashSize*sizeof(PxU32))); + storeDwords(mHashTable, mHashSize, INVALID_ID); + + // Get some bytes for new entries + InternalPair* newPairs = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(InternalPair))); PX_ASSERT(newPairs); + PxU32* newNext = reinterpret_cast(MBP_ALLOC(mHashSize * sizeof(PxU32))); PX_ASSERT(newNext); + + // Copy old data if needed + if(mNbActivePairs) + PxMemCopy(newPairs, mActivePairs, mNbActivePairs*sizeof(InternalPair)); + // ### check it's actually needed... probably only for pairs whose hash value was cut by the and + // yeah, since hash(id0, id1) is a constant + // However it might not be needed to recompute them => only less efficient but still ok + for(PxU32 i=0;igetId0(), last->getId1()) & mMask; + + // Walk the hash table to fix mNext + PxU32 offset = mHashTable[lastHashValue]; + PX_ASSERT(offset!=INVALID_ID); + + PxU32 previous=INVALID_ID; + while(offset!=lastPairIndex) + { + previous = offset; + offset = mNext[offset]; + } + + // Let us go/jump us + if(previous!=INVALID_ID) + { + PX_ASSERT(mNext[previous]==lastPairIndex); + mNext[previous] = mNext[lastPairIndex]; + } + // else we were the first + else mHashTable[lastHashValue] = mNext[lastPairIndex]; + // we're now free to reuse mNext[lastPairIndex] without breaking the list + +#if PX_DEBUG + mNext[lastPairIndex]=INVALID_ID; +#endif + + // Don't invalidate entry since we're going to shrink the array + + // 2) Re-insert in free slot + mActivePairs[pairIndex] = mActivePairs[lastPairIndex]; +#if PX_DEBUG + PX_ASSERT(mNext[pairIndex]==INVALID_ID); +#endif + mNext[pairIndex] = mHashTable[lastHashValue]; + mHashTable[lastHashValue] = pairIndex; + + mNbActivePairs--; + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.h new file mode 100644 index 0000000..7c21444 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseShared.h @@ -0,0 +1,252 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef BP_BROADPHASE_SHARED_H +#define BP_BROADPHASE_SHARED_H + +#include "BpBroadPhaseIntegerAABB.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHash.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Bp +{ + #define INVALID_ID 0xffffffff + #define INVALID_USER_ID 0xffffffff + + struct InternalPair : public PxUserAllocated + { + PX_FORCE_INLINE PxU32 getId0() const { return id0_isNew & ~PX_SIGN_BITMASK; } + PX_FORCE_INLINE PxU32 getId1() const { return id1_isUpdated & ~PX_SIGN_BITMASK; } + + PX_FORCE_INLINE PxU32 isNew() const { return id0_isNew & PX_SIGN_BITMASK; } + PX_FORCE_INLINE PxU32 isUpdated() const { return id1_isUpdated & PX_SIGN_BITMASK; } + + PX_FORCE_INLINE void setNewPair(PxU32 id0, PxU32 id1) + { + PX_ASSERT(!(id0 & PX_SIGN_BITMASK)); + PX_ASSERT(!(id1 & PX_SIGN_BITMASK)); + id0_isNew = id0 | PX_SIGN_BITMASK; + id1_isUpdated = id1; + } + + PX_FORCE_INLINE void setNewPair2(PxU32 id0, PxU32 id1) + { + PX_ASSERT(!(id0 & PX_SIGN_BITMASK)); + PX_ASSERT(!(id1 & PX_SIGN_BITMASK)); + id0_isNew = id0; + id1_isUpdated = id1; + } + + PX_FORCE_INLINE void setUpdated() { id1_isUpdated |= PX_SIGN_BITMASK; } + PX_FORCE_INLINE void clearUpdated() { id1_isUpdated &= ~PX_SIGN_BITMASK; } + PX_FORCE_INLINE void clearNew() { id0_isNew &= ~PX_SIGN_BITMASK; } + + protected: + PxU32 id0_isNew; + PxU32 id1_isUpdated; + }; + + PX_FORCE_INLINE bool differentPair(const InternalPair& p, PxU32 id0, PxU32 id1) { return (id0!=p.getId0()) || (id1!=p.getId1()); } + PX_FORCE_INLINE PxU32 hash(PxU32 id0, PxU32 id1) { return PxComputeHash( (id0&0xffff)|(id1<<16)); } + //PX_FORCE_INLINE PxU32 hash(PxU32 id0, PxU32 id1) { return PxComputeHash(PxU64(id0)|(PxU64(id1)<<32)) ; } + PX_FORCE_INLINE void sort(PxU32& id0, PxU32& id1) { if(id0>id1) PxSwap(id0, id1); } + + class PairManagerData + { + public: + PairManagerData(); + ~PairManagerData(); + + PX_FORCE_INLINE PxU32 getPairIndex(const InternalPair* pair) const + { + return (PxU32((size_t(pair) - size_t(mActivePairs)))/sizeof(InternalPair)); + } + + // Internal version saving hash computation + PX_FORCE_INLINE InternalPair* findPair(PxU32 id0, PxU32 id1, PxU32 hashValue) const + { + if(!mHashTable) + return NULL; // Nothing has been allocated yet + + InternalPair* PX_RESTRICT activePairs = mActivePairs; + const PxU32* PX_RESTRICT next = mNext; + + // Look for it in the table + PxU32 offset = mHashTable[hashValue]; + while(offset!=INVALID_ID && differentPair(activePairs[offset], id0, id1)) + { + PX_ASSERT(activePairs[offset].getId0()!=INVALID_USER_ID); + offset = next[offset]; // Better to have a separate array for this + } + if(offset==INVALID_ID) + return NULL; + PX_ASSERT(offset the pair is persistent + + return &activePairs[offset]; + } + + PX_FORCE_INLINE InternalPair* addPairInternal(PxU32 id0, PxU32 id1) + { + // Order the ids + sort(id0, id1); + + const PxU32 fullHashValue = hash(id0, id1); + PxU32 hashValue = fullHashValue & mMask; + + { + InternalPair* PX_RESTRICT p = findPair(id0, id1, hashValue); + if(p) + { + p->setUpdated(); + return p; // Persistent pair + } + } + + // This is a new pair + if(mNbActivePairs >= mHashSize) + hashValue = growPairs(fullHashValue); + + const PxU32 pairIndex = mNbActivePairs++; + + InternalPair* PX_RESTRICT p = &mActivePairs[pairIndex]; + p->setNewPair(id0, id1); + mNext[pairIndex] = mHashTable[hashValue]; + mHashTable[hashValue] = pairIndex; + return p; + } + + PxU32 mHashSize; + PxU32 mMask; + PxU32 mNbActivePairs; + PxU32* mHashTable; + PxU32* mNext; + InternalPair* mActivePairs; + PxU32 mReservedMemory; + + void purge(); + void reallocPairs(); + void shrinkMemory(); + void reserveMemory(PxU32 memSize); + PX_NOINLINE PxU32 growPairs(PxU32 fullHashValue); + void removePair(PxU32 id0, PxU32 id1, PxU32 hashValue, PxU32 pairIndex); + }; + + struct AABB_Xi + { + PX_FORCE_INLINE AABB_Xi() {} + PX_FORCE_INLINE ~AABB_Xi() {} + + PX_FORCE_INLINE void initFromFloats(const void* PX_RESTRICT minX, const void* PX_RESTRICT maxX) + { + mMinX = encodeFloat(*reinterpret_cast(minX)); + mMaxX = encodeFloat(*reinterpret_cast(maxX)); + } + + PX_FORCE_INLINE void initFromPxVec4(const PxVec4& min, const PxVec4& max) + { + initFromFloats(&min.x, &max.x); + } + + PX_FORCE_INLINE void operator = (const AABB_Xi& box) + { + mMinX = box.mMinX; + mMaxX = box.mMaxX; + } + + PX_FORCE_INLINE void initSentinel() + { + mMinX = 0xffffffff; + } + + PX_FORCE_INLINE bool isSentinel() const + { + return mMinX == 0xffffffff; + } + + PxU32 mMinX; + PxU32 mMaxX; + }; + + struct AABB_YZn + { + PX_FORCE_INLINE AABB_YZn() {} + PX_FORCE_INLINE ~AABB_YZn() {} + + PX_FORCE_INLINE void initFromPxVec4(const PxVec4& min, const PxVec4& max) + { + mMinY = -min.y; + mMinZ = -min.z; + mMaxY = max.y; + mMaxZ = max.z; + } + + PX_FORCE_INLINE void operator = (const AABB_YZn& box) + { + using namespace physx::aos; + V4StoreA(V4LoadA(&box.mMinY), &mMinY); + } + + float mMinY; + float mMinZ; + float mMaxY; + float mMaxZ; + }; + + struct AABB_YZr + { + PX_FORCE_INLINE AABB_YZr() {} + PX_FORCE_INLINE ~AABB_YZr() {} + + PX_FORCE_INLINE void initFromPxVec4(const PxVec4& min, const PxVec4& max) + { + mMinY = min.y; + mMinZ = min.z; + mMaxY = max.y; + mMaxZ = max.z; + } + + PX_FORCE_INLINE void operator = (const AABB_YZr& box) + { + using namespace physx::aos; + V4StoreA(V4LoadA(&box.mMinY), &mMinY); + } + + float mMinY; + float mMinZ; + float mMaxY; + float mMaxZ; + }; + +} //namespace Bp +} //namespace physx + +#endif // BP_BROADPHASE_SHARED_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp new file mode 100644 index 0000000..7e1f04a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpBroadPhaseUpdate.cpp @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpBroadPhase.h" +#include "common/PxProfileZone.h" +#include "foundation/PxBitMap.h" + +using namespace physx; +using namespace Bp; + +#if PX_CHECKED +bool BroadPhaseUpdateData::isValid(const BroadPhaseUpdateData& updateData, const BroadPhase& bp, const bool skipBoundValidation, PxU64 contextID) +{ + PX_PROFILE_ZONE("BroadPhaseUpdateData::isValid", contextID); + + return (updateData.isValid(skipBoundValidation) && bp.isValid(updateData)); +} + +static bool testHandles(PxU32 size, const BpHandle* handles, const PxU32 capacity, const Bp::FilterGroup::Enum* groups, const PxBounds3* bounds, PxBitMap& bitmap) +{ + if(!handles && size) + return false; + +/* ValType minVal=0; + ValType maxVal=0xffffffff;*/ + + for(PxU32 i=0;i=capacity) + return false; + + // Array in ascending order of id. + if(i>0 && (h < handles[i-1])) + return false; + + if(groups && groups[h]==FilterGroup::eINVALID) + return false; + + bitmap.set(h); + + if(bounds) + { + if(!bounds[h].isFinite()) + return false; + + for(PxU32 j=0;j<3;j++) + { + //Max must be greater than min. + if(bounds[h].minimum[j]>bounds[h].maximum[j]) + return false; +#if 0 + //Bounds have an upper limit. + if(bounds[created[i]].getMax(j)>=maxVal) + return false; + + //Bounds have a lower limit. + if(bounds[created[i]].getMin(j)<=minVal) + return false; + + //Max must be odd. + if(4 != (bounds[created[i]].getMax(j) & 4)) + return false; + + //Min must be even. + if(0 != (bounds[created[i]].getMin(j) & 4)) + return false; +#endif + } + } + } + return true; +} + +static bool testBitmap(const PxBitMap& bitmap, PxU32 size, const BpHandle* handles) +{ + while(size--) + { + const BpHandle h = *handles++; + if(bitmap.test(h)) + return false; + } + return true; +} + +bool BroadPhaseUpdateData::isValid(const bool skipBoundValidation) const +{ + const PxBounds3* bounds = skipBoundValidation ? NULL : getAABBs(); + const PxU32 boxesCapacity = getCapacity(); + const Bp::FilterGroup::Enum* groups = getGroups(); + + PxBitMap createdBitmap; createdBitmap.resizeAndClear(boxesCapacity); + PxBitMap updatedBitmap; updatedBitmap.resizeAndClear(boxesCapacity); + PxBitMap removedBitmap; removedBitmap.resizeAndClear(boxesCapacity); + + if(!testHandles(getNumCreatedHandles(), getCreatedHandles(), boxesCapacity, groups, bounds, createdBitmap)) + return false; + if(!testHandles(getNumUpdatedHandles(), getUpdatedHandles(), boxesCapacity, groups, bounds, updatedBitmap)) + return false; + if(!testHandles(getNumRemovedHandles(), getRemovedHandles(), boxesCapacity, NULL, NULL, removedBitmap)) + return false; + + if(1) + { + // Created/updated + if(!testBitmap(createdBitmap, getNumUpdatedHandles(), getUpdatedHandles())) + return false; + // Created/removed + if(!testBitmap(createdBitmap, getNumRemovedHandles(), getRemovedHandles())) + return false; + // Updated/removed + if(!testBitmap(updatedBitmap, getNumRemovedHandles(), getRemovedHandles())) + return false; + } + return true; +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp new file mode 100644 index 0000000..f978267 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowlevelaabb/src/BpFiltering.cpp @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "BpFiltering.h" + +using namespace physx; +using namespace Bp; + +BpFilter::BpFilter(bool discardKineKine, bool discardStaticKine) +{ + for(int j = 0; j < Bp::FilterType::COUNT; j++) + for(int i = 0; i < Bp::FilterType::COUNT; i++) + mLUT[j][i] = false; + + mLUT[Bp::FilterType::STATIC][Bp::FilterType::DYNAMIC] = mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::STATIC] = true; + mLUT[Bp::FilterType::STATIC][Bp::FilterType::KINEMATIC] = mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::STATIC] = !discardStaticKine; + mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::KINEMATIC] = mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::DYNAMIC] = true; + + mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::DYNAMIC] = true; + mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::KINEMATIC] = !discardKineKine; + + mLUT[Bp::FilterType::STATIC][Bp::FilterType::AGGREGATE] = mLUT[Bp::FilterType::AGGREGATE][Bp::FilterType::STATIC] = true; + mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::AGGREGATE] = mLUT[Bp::FilterType::AGGREGATE][Bp::FilterType::KINEMATIC] = true; + mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::AGGREGATE] = mLUT[Bp::FilterType::AGGREGATE][Bp::FilterType::DYNAMIC] = true; + mLUT[Bp::FilterType::AGGREGATE][Bp::FilterType::AGGREGATE] = true; + + //Enable soft body interactions + mLUT[Bp::FilterType::SOFTBODY][Bp::FilterType::DYNAMIC] = mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::SOFTBODY] = true; + mLUT[Bp::FilterType::SOFTBODY][Bp::FilterType::STATIC] = mLUT[Bp::FilterType::STATIC][Bp::FilterType::SOFTBODY] = true; + mLUT[Bp::FilterType::SOFTBODY][Bp::FilterType::KINEMATIC] = mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::SOFTBODY] = true; + mLUT[Bp::FilterType::SOFTBODY][Bp::FilterType::SOFTBODY] = true; + + //Enable particle system interactions + mLUT[Bp::FilterType::PARTICLESYSTEM][Bp::FilterType::DYNAMIC] = mLUT[Bp::FilterType::DYNAMIC][Bp::FilterType::PARTICLESYSTEM] = true; + mLUT[Bp::FilterType::PARTICLESYSTEM][Bp::FilterType::STATIC] = mLUT[Bp::FilterType::STATIC][Bp::FilterType::PARTICLESYSTEM] = true; + mLUT[Bp::FilterType::PARTICLESYSTEM][Bp::FilterType::KINEMATIC] = mLUT[Bp::FilterType::KINEMATIC][Bp::FilterType::PARTICLESYSTEM] = true; + mLUT[Bp::FilterType::PARTICLESYSTEM][Bp::FilterType::PARTICLESYSTEM] = true; +} + +BpFilter::~BpFilter() +{ +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationCore.h new file mode 100644 index 0000000..6385fc2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationCore.h @@ -0,0 +1,85 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_ARTICULATION_CORE_H +#define DY_ARTICULATION_CORE_H + +#include "PxArticulationReducedCoordinate.h" + +namespace physx +{ + namespace Dy + { + struct ArticulationCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== +// PX_SERIALIZATION + ArticulationCore(const PxEMPTY) : flags(PxEmpty) {} + ArticulationCore() {} +//~PX_SERIALIZATION + + PxU16 solverIterationCounts; //KS - made a U16 so that it matches PxsRigidCore + PxArticulationFlags flags; + PxReal sleepThreshold; + PxReal freezeThreshold; + PxReal wakeCounter; + PxU32 gpuRemapIndex; + PxReal maxLinearVelocity; + PxReal maxAngularVelocity; + }; + + struct ArticulationJointCoreDirtyFlag + { + enum Enum + { + eNONE = 0, + eMOTION = 1 << 0, + eFRAME = 1 << 1, + eTARGETPOSE = 1 << 2, + eTARGETVELOCITY = 1 << 3, + eARMATURE = 1 << 4, + eLIMIT = 1 << 5, + eDRIVE = 1 << 6, + eJOINT_POS = 1 << 7, + eJOINT_VEL = 1 << 8, + eALL = eMOTION | eFRAME | eTARGETPOSE | eTARGETVELOCITY | eARMATURE | eLIMIT | eDRIVE | eJOINT_POS | eJOINT_VEL + }; + }; + + typedef PxFlags ArticulationJointCoreDirtyFlags; + PX_FLAGS_OPERATORS(ArticulationJointCoreDirtyFlag::Enum, PxU8) + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationJointCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationJointCore.h new file mode 100644 index 0000000..bd92246 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyArticulationJointCore.h @@ -0,0 +1,191 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DV_ARTICULATION_JOINT_CORE_H +#define DV_ARTICULATION_JOINT_CORE_H + +#include "DyArticulationCore.h" +#include "solver/PxSolverDefs.h" +#include "PxArticulationJointReducedCoordinate.h" + +namespace physx +{ + namespace Dy + { + class ArticulationJointCoreData; + + PX_ALIGN_PREFIX(16) + struct ArticulationJointCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + + // PX_SERIALIZATION + ArticulationJointCore(const PxEMPTY&) : jointDirtyFlag(PxEmpty) + { + PX_COMPILE_TIME_ASSERT(sizeof(PxArticulationMotions) == sizeof(PxU8)); + } + //~PX_SERIALIZATION + + ArticulationJointCore(const PxTransform& parentFrame, const PxTransform& childFrame) + { + //PxMarkSerializedMemory(this, sizeof(ArticulationJointCore)); + init(parentFrame, childFrame); + } + + // PT: these ones don't update the dirty flags + PX_FORCE_INLINE void initLimit(PxArticulationAxis::Enum axis, const PxArticulationLimit& limit) { limits[axis] = limit; } + PX_FORCE_INLINE void initDrive(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive) { drives[axis] = drive; } + PX_FORCE_INLINE void initJointType(PxArticulationJointType::Enum type) { jointType = PxU8(type); } + PX_FORCE_INLINE void initMaxJointVelocity(const PxReal maxJointV) { maxJointVelocity = maxJointV; } + PX_FORCE_INLINE void initFrictionCoefficient(const PxReal coefficient) { frictionCoefficient = coefficient; } + + void init(const PxTransform& parentFrame, const PxTransform& childFrame) + { + PX_ASSERT(parentFrame.isValid()); + PX_ASSERT(childFrame.isValid()); + + parentPose = parentFrame; + childPose = childFrame; + jointOffset = 0; + // PT: TODO: don't we need ArticulationJointCoreDirtyFlag::eFRAME here? + jointDirtyFlag = ArticulationJointCoreDirtyFlag::eMOTION; + + initFrictionCoefficient(0.05f); + initMaxJointVelocity(100.0f); + initJointType(PxArticulationJointType::eUNDEFINED); + + for(PxU32 i=0; i mAttachments; + Cm::IDPool mIDPool; + PxU32 mIndex; + }; + + class ArticulationTendonJoint + { + public: + PxU16 axis; + PxU16 startJointOffset; + PxReal coefficient; + PxReal recipCoefficient; + PxU32 mConstraintInd; + PxU32 parent; //parent index + PxU16 linkInd; + PxU16 childCount; + ArticulationAttachmentBitField children; + }; + + class ArticulationFixedTendon : public ArticulationTendon + { + public: + + ArticulationFixedTendon() :mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f) + { + mTendonJoints.reserve(64); + mTendonJoints.forceSize_Unsafe(64); + + } + + + PX_FORCE_INLINE ArticulationTendonJoint* getTendonJoints() { return mTendonJoints.begin(); } + + PX_FORCE_INLINE ArticulationTendonJoint& getTendonJoint(const PxU32 index) { return mTendonJoints[index]; } + + PX_FORCE_INLINE PxU32 getNumJoints() { return mIDPool.getNumUsedID(); } + + PX_FORCE_INLINE PxU32 getNewID() + { + const PxU32 index = mIDPool.getNewID(); + if (mTendonJoints.capacity() <= index) + { + mTendonJoints.resize(index * 2 + 1); + } + return index; + } + + PX_FORCE_INLINE void freeID(const PxU32 index) + { + mIDPool.freeID(index); + } + + PX_FORCE_INLINE PxU32 getTendonIndex() { return mIndex; } + + PX_FORCE_INLINE void setTendonIndex(const PxU32 index) { mIndex = index; } + + PxReal mLowLimit; + PxReal mHighLimit; + PxReal mRestLength; + + PxReal mError; + + private: + PxArray mTendonJoints; + + Cm::IDPool mIDPool; + PxU32 mIndex; + }; + + +}//namespace Dy +}//namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraint.h new file mode 100644 index 0000000..7a8a4ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraint.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONSTRAINT_H +#define DY_CONSTRAINT_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "PxvConfig.h" +#include "PxvDynamics.h" +#include "PxConstraint.h" +#include "DyConstraintWriteBack.h" + +namespace physx +{ + +class PxsRigidBody; + +namespace Dy +{ + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif +PX_ALIGN_PREFIX(16) +struct Constraint +{ +public: + + PxReal linBreakForce; //0 + PxReal angBreakForce; //4 + PxU16 constantBlockSize; //6 + PxU16 flags; //8 + + PxConstraintSolverPrep solverPrep; //12 + PxConstraintProject project; //16 + void* constantBlock; //20 + + PxsRigidBody* body0; //24 + PxsRigidBody* body1; //28 + + PxsBodyCore* bodyCore0; //32 + PxsBodyCore* bodyCore1; //36 + PxU32 index; //40 //this is also a constraint write back index + PxReal minResponseThreshold; //44 +} +PX_ALIGN_SUFFIX(16); +#if PX_VC + #pragma warning(pop) +#endif + +#if !PX_P64_FAMILY +PX_COMPILE_TIME_ASSERT(48==sizeof(Constraint)); +#endif + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraintWriteBack.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraintWriteBack.h new file mode 100644 index 0000000..75f6b9e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyConstraintWriteBack.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONSTRAINT_WRITE_BACK_H +#define DY_CONSTRAINT_WRITE_BACK_H + +#include "foundation/PxVec3.h" +#include "PxvConfig.h" +#include "PxvDynamics.h" + +namespace physx +{ + namespace Dy + { + + PX_ALIGN_PREFIX(16) + struct ConstraintWriteback + { + public: + + void initialize() + { + linearImpulse = PxVec3(0); + angularImpulse = PxVec3(0); + broken = false; + } + + PxVec3 linearImpulse; + PxU32 broken; + PxVec3 angularImpulse; + PxU32 pad; + } + PX_ALIGN_SUFFIX(16); + + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyContext.h new file mode 100644 index 0000000..78c2672 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyContext.h @@ -0,0 +1,412 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONTEXT_H +#define DY_CONTEXT_H + +#include "PxSceneDesc.h" +#include "DyThresholdTable.h" +#include "PxcNpThreadContext.h" +#include "PxsSimulationController.h" +#include "DyConstraintWriteBack.h" +#include "foundation/PxAllocator.h" + +#define DY_MAX_VELOCITY_COUNT 4 + +namespace physx +{ + +class PxsIslandManager; +class PxcNpMemBlockPool; + +namespace Cm +{ + class EventProfiler; + class FlushPool; +} + +namespace IG +{ + class SimpleIslandManager; + class IslandSim; +} + +template class PxcThreadCoherentCache; +class PxcScratchAllocator; +struct PxvSimStats; +class PxTaskManager; +class PxsContactManagerOutputIterator; +struct PxsContactManagerOutput; +class PxsContactManager; +struct PxsContactManagerOutputCounts; + +class PxvNphaseImplementationContext; + + +namespace Dy +{ + + +class Context +{ + PX_NOCOPY(Context) +public: + + // PT: TODO: consider making all of these public at this point + PX_FORCE_INLINE PxReal getMaxBiasCoefficient() const { return mMaxBiasCoefficient; } + PX_FORCE_INLINE void setMaxBiasCoefficient(PxReal coeff) { mMaxBiasCoefficient = coeff; } + + /** + \brief Returns the bounce threshold + \return The bounce threshold. + */ + PX_FORCE_INLINE PxReal getBounceThreshold() const { return mBounceThreshold; } + /** + \brief Returns the friction offset threshold + \return The friction offset threshold. + */ + PX_FORCE_INLINE PxReal getFrictionOffsetThreshold() const { return mFrictionOffsetThreshold; } + /** + \brief Returns the correlation distance + \return The correlation distance. + */ + PX_FORCE_INLINE PxReal getCorrelationDistance() const { return mCorrelationDistance; } + + /** + \brief Returns the CCD separation threshold + \return The CCD separation threshold. + */ + PX_FORCE_INLINE PxReal getCCDSeparationThreshold() const { return mCCDSeparationThreshold; } + + /** + \brief Returns the length scale + \return The length scale. + */ + PX_FORCE_INLINE PxReal getLengthScale() const { return mLengthScale; } + + /** + \brief Sets the bounce threshold + \param[in] f The bounce threshold + */ + PX_FORCE_INLINE void setBounceThreshold(PxReal f) { mBounceThreshold = f; } + /** + \brief Sets the correlation distance + \param[in] f The correlation distance + */ + PX_FORCE_INLINE void setCorrelationDistance(PxReal f) { mCorrelationDistance = f; } + /** + \brief Sets the friction offset threshold + \param[in] offset The friction offset threshold + */ + PX_FORCE_INLINE void setFrictionOffsetThreshold(PxReal offset) { mFrictionOffsetThreshold = offset; } + + /** + \brief Sets the friction offset threshold + \param[in] offset The friction offset threshold + */ + PX_FORCE_INLINE void setCCDSeparationThreshold(PxReal offset) { mCCDSeparationThreshold = offset; } + + /** + \brief Returns the solver batch size + \return The solver batch size. + */ + PX_FORCE_INLINE PxU32 getSolverBatchSize() const { return mSolverBatchSize; } + /** + \brief Sets the solver batch size + \param[in] f The solver batch size + */ + PX_FORCE_INLINE void setSolverBatchSize(PxU32 f) { mSolverBatchSize = f; } + + /** + \brief Returns the solver batch size + \return The solver batch size. + */ + PX_FORCE_INLINE PxU32 getSolverArticBatchSize() const { return mSolverArticBatchSize; } + /** + \brief Sets the solver batch size + \param[in] f The solver batch size + */ + PX_FORCE_INLINE void setSolverArticBatchSize(PxU32 f) { mSolverArticBatchSize = f; } + + /** + \brief Returns the maximum solver constraint size + \return The maximum solver constraint size in this island in bytes. + */ + PX_FORCE_INLINE PxU32 getMaxSolverConstraintSize() const { return mMaxSolverConstraintSize; } + + /** + \brief Returns the friction model being used. + \return The friction model being used. + */ + PX_FORCE_INLINE PxFrictionType::Enum getFrictionType() const { return mFrictionType; } + + /** + \brief Returns the threshold stream + \return The threshold stream + */ + PX_FORCE_INLINE ThresholdStream& getThresholdStream() { return *mThresholdStream; } + + PX_FORCE_INLINE ThresholdStream& getForceChangedThresholdStream() { return *mForceChangedThresholdStream; } + + /** + \brief Returns the threshold table + \return The threshold table + */ + PX_FORCE_INLINE ThresholdTable& getThresholdTable() { return mThresholdTable; } + + /** + \brief Sets the friction model to be used. + \param[in] f The friction model to be used. + */ + PX_FORCE_INLINE void setFrictionType(PxFrictionType::Enum f) { mFrictionType = f; } + + /** + \brief Destroys this dynamics context + */ + virtual void destroy() = 0; + + PX_FORCE_INLINE PxcDataStreamPool& getContactStreamPool() { return mContactStreamPool; } + + PX_FORCE_INLINE PxcDataStreamPool& getPatchStreamPool() { return mPatchStreamPool; } + + PX_FORCE_INLINE PxcDataStreamPool& getForceStreamPool() { return mForceStreamPool; } + + PX_FORCE_INLINE PxPinnedArray& getConstraintWriteBackPool() { return mConstraintWriteBackPool; } + + /** + \brief Returns the current frame's timestep + \return The current frame's timestep. + */ + PX_FORCE_INLINE PxReal getDt() const { return mDt; } + /** + \brief Returns 1/(current frame's timestep) + \return 1/(current frame's timestep). + */ + PX_FORCE_INLINE PxReal getInvDt() const { return mInvDt; } + + PX_FORCE_INLINE PxVec3 getGravity() const { return mGravity; } + + /** + \brief The entry point for the constraint solver. + \param[in] dt The simulation time-step + \param[in] continuation The continuation task for the solver + \param[in] processLostTouchTask The task that processes lost touches + + This method is called after the island generation has completed. Its main responsibilities are: + (1) Reserving the solver body pools + (2) Initializing the static and kinematic solver bodies, which are shared resources between islands. + (3) Construct the solver task chains for each island + + Each island is solved as an independent solver task chain. In addition, large islands may be solved using multiple parallel tasks. + Island solving is asynchronous. Once all islands have been solved, the continuation task will be called. + + */ + virtual void update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* processLostTouchTask, + PxvNphaseImplementationContext* nPhaseContext, const PxU32 maxPatchesPerCM, const PxU32 maxArticulationLinks, const PxReal dt, const PxVec3& gravity, PxBitMapPinned& changedHandleMap) = 0; + + virtual void processLostPatches(IG::SimpleIslandManager& simpleIslandManager, PxsContactManager** lostPatchManagers, PxU32 nbLostPatchManagers, PxsContactManagerOutputCounts* outCounts) = 0; + virtual void processFoundPatches(IG::SimpleIslandManager& simpleIslandManager, PxsContactManager** foundPatchManagers, PxU32 nbFoundPatchManagers, PxsContactManagerOutputCounts* outCounts) = 0; + + + /** + \brief This method copy gpu solver body data to cpu body core + */ + virtual void updateBodyCore(PxBaseTask* continuation) = 0; + + /** + \brief Called after update's task chain has completed. This collects the results of the solver together + */ + virtual void mergeResults() = 0; + + virtual void setSimulationController(PxsSimulationController* simulationController) = 0; + + virtual void getDataStreamBase(void*& contactStreamBase, void*& patchStreamBase, void*& forceAndIndiceStreamBase) = 0; + + virtual PxSolverType::Enum getSolverType() const = 0; + + void createThresholdStream(PxVirtualAllocatorCallback& callback) { PX_ASSERT(!mThresholdStream); mThresholdStream = PX_NEW(ThresholdStream)(callback); } + + void createForceChangeThresholdStream(PxVirtualAllocatorCallback& callback) { PX_ASSERT(!mForceChangedThresholdStream); mForceChangedThresholdStream = PX_NEW(ThresholdStream)(callback); } + + //Forces any cached body state to be updated! + void setStateDirty(bool dirty) { mBodyStateDirty = dirty; } + + bool isStateDirty() { return mBodyStateDirty;} + + void setSuppressReadback(bool suppressReadback) { mSuppressReadback = suppressReadback; } + + bool getSuppressReadback() { return mSuppressReadback; } + + void setDt(const PxReal dt) { mDt = dt; } + +protected: + + Context(IG::SimpleIslandManager* islandManager, PxVirtualAllocatorCallback* allocatorCallback, + PxvSimStats& simStats, bool enableStabilization, bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, const PxReal lengthScale) : + mThresholdStream (NULL), + mForceChangedThresholdStream(NULL), + mIslandManager (islandManager), + mDt (1.0f), + mInvDt (1.0f), + mMaxBiasCoefficient (maxBiasCoefficient), + mEnableStabilization (enableStabilization), + mUseEnhancedDeterminism (useEnhancedDeterminism), + mBounceThreshold (-2.0f), + mLengthScale (lengthScale), + mSolverBatchSize (32), + mConstraintWriteBackPool (PxVirtualAllocator(allocatorCallback)), + mSimStats (simStats), + mBodyStateDirty (false), + mSuppressReadback (false) + { + } + + virtual ~Context() + { + PX_DELETE(mThresholdStream); + PX_DELETE(mForceChangedThresholdStream); + } + + ThresholdStream* mThresholdStream; + ThresholdStream* mForceChangedThresholdStream; + ThresholdTable mThresholdTable; + + IG::SimpleIslandManager* mIslandManager; + PxsSimulationController* mSimulationController; + /** + \brief Time-step. + */ + PxReal mDt; + /** + \brief 1/time-step. + */ + PxReal mInvDt; + + PxReal mMaxBiasCoefficient; + + const bool mEnableStabilization; + + const bool mUseEnhancedDeterminism; + + PxVec3 mGravity; + /** + \brief max solver constraint size + */ + PxU32 mMaxSolverConstraintSize; + + /** + \brief Threshold controlling the relative velocity at which the solver transitions between restitution and bias for solving normal contact constraint. + */ + PxReal mBounceThreshold; + /** + \brief Threshold controlling whether friction anchors are constructed or not. If the separation is above mFrictionOffsetThreshold, the contact will not be considered to become a friction anchor + */ + PxReal mFrictionOffsetThreshold; + + /** + \brief Threshold controlling whether distant contacts are processed using bias, restitution or a combination of the two. This only has effect on pairs involving bodies that have enabled speculative CCD simulation mode. + */ + PxReal mCCDSeparationThreshold; + + /** + \brief Threshold for controlling friction correlation + */ + PxReal mCorrelationDistance; + + + /** + \brief The length scale from PxTolerancesScale::length. + */ + PxReal mLengthScale; + + /** + \brief The minimum size of an island to generate a solver task chain. + */ + PxU32 mSolverBatchSize; + + /** + \brief The minimum number of articulations required to generate a solver task chain. + */ + PxU32 mSolverArticBatchSize; + + + /** + \brief The current friction model being used + */ + PxFrictionType::Enum mFrictionType; + + /** + \brief Structure to encapsulate contact stream allocations. Used by GPU solver to reference pre-allocated pinned host memory + */ + PxcDataStreamPool mContactStreamPool; + + /** + \brief Struct to encapsulate the contact patch stream allocations. Used by GPU solver to reference pre-allocated pinned host memory + */ + + PxcDataStreamPool mPatchStreamPool; + + /** + \brief Structure to encapsulate force stream allocations. Used by GPU solver to reference pre-allocated pinned host memory for force reports. + */ + PxcDataStreamPool mForceStreamPool; + + /** + \brief Structure to encapsulate constraint write back allocations. Used by GPU/CPU solver to reference pre-allocated pinned host memory for breakable joint reports. + */ + PxPinnedArray mConstraintWriteBackPool; + + PxvSimStats& mSimStats; + + bool mBodyStateDirty; + bool mSuppressReadback; +}; + +Context* createDynamicsContext( PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, Cm::FlushPool& taskPool, + PxvSimStats& simStats, PxTaskManager* taskManager, PxVirtualAllocatorCallback* allocatorCallback, PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, PxU64 contextID, + const bool enableStabilization, const bool useEnhancedDeterminism, const PxReal maxBiasCoefficient, + const bool frictionEveryIteration, const PxReal lengthScale + ); + +Context* createTGSDynamicsContext(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, Cm::FlushPool& taskPool, + PxvSimStats& simStats, PxTaskManager* taskManager, PxVirtualAllocatorCallback* allocatorCallback, PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, PxU64 contextID, + const bool enableStabilization, const bool useEnhancedDeterminism, const PxReal lengthScale +); + + +} + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMCloth.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMCloth.h new file mode 100644 index 0000000..ce07f42 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMCloth.h @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef PXD_FEMCLOTH_H +#define PXD_FEMCLOTH_H + +#include "foundation/PxSimpleTypes.h" +#include "DyFEMClothCore.h" +#include "PxvGeometry.h" + +namespace physx +{ + namespace Sc + { + class FEMClothSim; + } + + namespace Dy + { + + typedef size_t FEMClothHandle; + + struct FEMClothCore; + + class FEMCloth + { + PX_NOCOPY(FEMCloth) + + public: + FEMCloth(Sc::FEMClothSim* sim, Dy::FEMClothCore& core) : + mSim(sim), mCore(core), mElementId(0xffffffff), mGpuRemapId(0xffffffff) + {} + + ~FEMCloth() {} + + //PX_FORCE_INLINE PxReal getMaxPenetrationBias() const { return mCore.maxPenBias; } + + PX_FORCE_INLINE Sc::FEMClothSim* getFEMClothSim() const { return mSim; } + + PX_FORCE_INLINE void setGpuRemapId(const PxU32 remapId) + { + mGpuRemapId = remapId; + PxTriangleMeshGeometryLL& geom = mShapeCore->mGeometry.get(); + geom.materialsLL.gpuRemapId = remapId; + } + + PX_FORCE_INLINE PxTriangleMesh* getTriangleMesh() + { + PxTriangleMeshGeometryLL& geom = mShapeCore->mGeometry.get(); + return geom.triangleMesh; + } + + PX_FORCE_INLINE PxU32 getGpuRemapId() { return mGpuRemapId; } + + PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; } + PX_FORCE_INLINE PxU32 getElementId() { return mElementId; } + + PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; } + PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore) { mShapeCore = shapeCore; } + + + PX_FORCE_INLINE const FEMClothCore& getCore() const { return mCore; } + PX_FORCE_INLINE FEMClothCore& getCore() { return mCore; } + + PX_FORCE_INLINE PxU16 getIterationCounts() const { return mCore.solverIterationCounts; } + + void addAttachmentHandle(PxU32 handle); + void removeAttachmentHandle(PxU32 handle); + + //These variables are used in the constraint partition + PxU16 maxSolverFrictionProgress; + PxU16 maxSolverNormalProgress; + PxU32 solverProgress; + PxU8 numTotalConstraints; + + PxArray mAttachmentHandles; + PxArray mClothClothAttachments; + private: + + Sc::FEMClothSim* mSim; + FEMClothCore& mCore; + PxsShapeCore* mShapeCore; + PxU32 mElementId; //this is used for the bound array, contactDist + PxU32 mGpuRemapId; + }; + + struct FEMClothSolverDesc + { + FEMCloth* femCloth; + }; + + PX_FORCE_INLINE FEMCloth* getFEMCloth(FEMClothHandle handle) + { + return reinterpret_cast(handle); + } + + PX_FORCE_INLINE void FEMCloth::addAttachmentHandle(PxU32 handle) + { + mAttachmentHandles.pushBack(handle); + } + PX_FORCE_INLINE void FEMCloth::removeAttachmentHandle(PxU32 handle) + { + for (PxU32 i = 0; i < mAttachmentHandles.size(); ++i) + { + if (mAttachmentHandles[i] == handle) + { + mAttachmentHandles.replaceWithLast(i); + } + } + } + } +} + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMClothCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMClothCore.h new file mode 100644 index 0000000..1caf713 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFEMClothCore.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PXDV_FEMCLOTH_CORE_H +#define PXDV_FEMCLOTH_CORE_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxArray.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFEMCloth.h" +#endif +#include "PxFEMParameter.h" +#include "PxFEMClothFlags.h" +#include "PxsFEMClothMaterialCore.h" + +namespace physx +{ + class PxBuffer; + + namespace Dy + { + struct FEMClothCore + { + public: + + PxFEMParameters parameters; + PxU16 solverIterationCounts; + bool dirty; + PxReal wakeCounter; + PxFEMClothFlags mFlags; + + // Ratio between target volume and rest volume in inflatable simulation. + PxReal mRestVolumeScale; + + PxArray mMaterialHandles; + PxBuffer* mClothPositionInvMass; + PxBuffer* mClothVelocity; + PxBuffer* mClothRestPosition; + + // multimaterial bending effects + PxArray mBendingScales; + + // wind + PxReal drag; + PxReal lift; + PxVec3 wind; + PxReal airDensity; + + PxReal maxVelocity; + + // negative values mean no activation angle: apply bending force toward rest bending angle + PxReal mBendingActivationAngle; + + // number of collision pair updates per timestep. Collision pair is updated at least once per timestep and increasing the frequency provides better collision pairs. + PxU32 NbCollisionPairUpdatesPerTimestep; + + // number of collision substeps in each sub-timestep. Collision constraints can be applied multiple times in each sub-timestep. + PxU32 nbCollisionSubsteps; + + + FEMClothCore() + { + drag = 0.f; + lift = 0.f; + wind = PxVec3(0.f); + airDensity = 1.225f; // default: 1.225 kg/m^3 + maxVelocity = 0.f; + mBendingActivationAngle = -1.f; + mRestVolumeScale = 0.0f; // No inflatable simulation by default. + + NbCollisionPairUpdatesPerTimestep = 1; + nbCollisionSubsteps = 1; + } + + void setMaterial(const PxU16 materialHandle) + { + mMaterialHandles.pushBack(materialHandle); + } + + void clearMaterials() { mMaterialHandles.clear(); } + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulation.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulation.h new file mode 100644 index 0000000..97f3f8b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulation.h @@ -0,0 +1,1298 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FEATHERSTONE_ARTICULATION_H +#define DY_FEATHERSTONE_ARTICULATION_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxVecMath.h" +#include "CmUtils.h" +#include "DyVArticulation.h" +#include "DyFeatherstoneArticulationUtils.h" +#include "DyFeatherstoneArticulationJointData.h" +#include "solver/PxSolverDefs.h" +#include "DyArticulationTendon.h" +#include "CmSpatialVector.h" + +#ifndef FEATHERSTONE_DEBUG +#define FEATHERSTONE_DEBUG 0 +#endif + +#define DY_STATIC_CONTACTS_IN_INTERNAL_SOLVER true + +namespace physx +{ + +class PxContactJoint; +class PxcConstraintBlockStream; +class PxcScratchAllocator; +class PxsConstraintBlockManager; +struct SolverConstraint1DExtStep; +struct PxSolverConstraintPrepDesc; +struct PxSolverBody; +struct PxSolverBodyData; +class PxConstraintAllocator; +class PxsContactManagerOutputIterator; + +struct PxSolverConstraintDesc; + +namespace Dy +{ +//#if PX_VC +//#pragma warning(push) +//#pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +//#endif + + + class ArticulationLinkData; + struct SpatialSubspaceMatrix; + struct SolverConstraint1DExt; + struct SolverConstraint1DStep; + + class FeatherstoneArticulation; + struct SpatialMatrix; + struct SpatialTransform; + struct Constraint; + class ThreadContext; + + + struct ArticulationInternalTendonConstraint + { + Cm::UnAlignedSpatialVector row0; //24 24 + Cm::UnAlignedSpatialVector row1; //24 48 + + Cm::UnAlignedSpatialVector deltaVB; //24 72 + + PxU32 linkID0; //4 74 + PxU32 linkID1; //4 78 + PxReal accumulatedLength; //4 82 //accumulate distance for spatial tendon, accumualate joint pose for fixed tendon + PxReal biasCoefficient; //4 94 + PxReal velMultiplier; //4 98 + PxReal impulseMultiplier; //4 102 + PxReal appliedForce; //4 106 + PxReal recipResponse; //4 110 + PxReal deltaVA; //4 114 + PxReal limitBiasCoefficient; + PxReal limitImpulseMultiplier; + PxReal limitAppliedForce; + PxReal restDistance; + PxReal lowLimit; + PxReal highLimit; + PxReal velImpulseMultiplier; + PxReal limitVelImpulseMultiplier; + }; + + struct ArticulationInternalConstraintBase + { + //Common/shared directional info between, frictions and drives + Cm::UnAlignedSpatialVector row0; //24 24 + Cm::UnAlignedSpatialVector row1; //24 48 + Cm::UnAlignedSpatialVector deltaVA; //24 72 + Cm::UnAlignedSpatialVector deltaVB; //24 96 + + //Response information + PxReal recipResponse; //4 100 + PxReal response; //4 104 + }; + + struct ArticulationInternalLimit + { + //Initial error + PxReal errorLow; //4 4 + PxReal errorHigh; //4 8 + PxReal lowImpulse; //4 12 changed + PxReal highImpulse; //4 16 changed + }; + + + struct ArticulationInternalConstraint : public ArticulationInternalConstraintBase + { + //Joint spring drive info + PxReal driveTargetVel; //4 128 + PxReal driveInitialBias; //4 132 + PxReal driveBiasCoefficient; //4 132 + PxReal driveVelMultiplier; //4 140 + PxReal driveImpulseMultiplier; //4 148 + PxReal maxDriveForce; //4 152 + PxReal driveForce; //4 156 + + PxReal maxFrictionForce; //4 160 + PxReal frictionForce; //4 164 + PxReal frictionForceCoefficient; //4 168 + + bool isLinearConstraint; //1 169 + PxU8 padding[7]; //11 176 + }; + + //linkID can be PxU32. However, each thread is going to read 16 bytes so we just keep ArticulationSensor 16 byte align. + //if not, newArticulationsLaunch kernel will fail to read the sensor data correctly + struct ArticulationSensor + { + PxTransform mRelativePose; //28 28 + PxU16 mLinkID; //02 30 + PxU16 mFlags; //02 32 + }; + + struct PX_ALIGN_PREFIX(16) JointSpaceSpatialZ + { + PxReal mVals [6][4]; + + PxReal dot(Cm::SpatialVectorF& v, PxU32 id) + { + return v.top.x * mVals[0][id] + v.top.y * mVals[1][id] + v.top.z * mVals[2][id] + + v.bottom.x * mVals[3][id] + v.bottom.y * mVals[4][id] + v.bottom.z * mVals[5][id]; + } + } + PX_ALIGN_SUFFIX(16); + + class ArticulationData + { + public: + + ArticulationData() : + mPathToRootElements(NULL), mNumPathToRootElements(0), mLinksData(NULL), mJointData(NULL), mJointTranData(NULL), + mSpatialTendons(NULL), mNumSpatialTendons(0), mNumTotalAttachments(0), + mFixedTendons(NULL), mNumFixedTendons(0), mSensors(NULL), mSensorForces(NULL), + mNbSensors(0), mDt(0.f), mDofs(0xffffffff), + mDataDirty(true) + { + mRootPreMotionVelocity = Cm::SpatialVectorF::Zero(); + } + + ~ArticulationData(); + + PX_FORCE_INLINE void init(); + void resizeLinkData(const PxU32 linkCount); + void resizeJointData(const PxU32 dofs); + + PX_FORCE_INLINE PxReal* getJointAccelerations() { return mJointAcceleration.begin(); } + PX_FORCE_INLINE const PxReal* getJointAccelerations() const { return mJointAcceleration.begin(); } + PX_FORCE_INLINE PxReal* getJointVelocities() { return mJointVelocity.begin(); } + PX_FORCE_INLINE const PxReal* getJointVelocities() const { return mJointVelocity.begin(); } + PX_FORCE_INLINE PxReal* getJointNewVelocities() { return mJointNewVelocity.begin(); } + PX_FORCE_INLINE const PxReal* getJointNewVelocities() const { return mJointNewVelocity.begin(); } + PX_FORCE_INLINE PxReal* getJointPositions() { return mJointPosition.begin(); } + PX_FORCE_INLINE const PxReal* getJointPositions() const { return mJointPosition.begin(); } + PX_FORCE_INLINE PxReal* getJointForces() { return mJointForce.begin(); } + PX_FORCE_INLINE const PxReal* getJointForces() const { return mJointForce.begin(); } + PX_FORCE_INLINE PxReal* getJointConstraintForces() { return mJointConstraintForces.begin(); } + PX_FORCE_INLINE const PxReal* getJointConstraintForces() const { return mJointConstraintForces.begin(); } + //PX_FORCE_INLINE PxReal* getJointFrictionForces() { return mJointFrictionForce.begin(); } + + PX_FORCE_INLINE ArticulationInternalConstraint& getInternalConstraint(const PxU32 dofId) { return mInternalConstraints[dofId]; } + PX_FORCE_INLINE const ArticulationInternalConstraint& getInternalConstraint(const PxU32 dofId) const { return mInternalConstraints[dofId]; } + + PX_FORCE_INLINE Cm::SpatialVectorF* getMotionVelocities() { return mMotionVelocities.begin(); } + PX_FORCE_INLINE Cm::SpatialVectorF* getMotionAccelerations() { return mMotionAccelerations.begin(); } + PX_FORCE_INLINE const Cm::SpatialVectorF* getMotionAccelerations() const { return mMotionAccelerations.begin(); } + PX_FORCE_INLINE Cm::SpatialVectorF* getCorioliseVectors() { return mCorioliseVectors.begin(); } + PX_FORCE_INLINE Cm::SpatialVectorF* getSpatialZAVectors() { return mZAForces.begin(); } + PX_FORCE_INLINE Cm::SpatialVectorF* getTransmittedForces() { return mJointTransmittedForce.begin(); } + + PX_FORCE_INLINE Cm::SpatialVectorF* getPosIterMotionVelocities() { return mPosIterMotionVelocities.begin(); } + PX_FORCE_INLINE const Cm::SpatialVectorF* getPosIterMotionVelocities() const { return mPosIterMotionVelocities.begin(); } + PX_FORCE_INLINE PxReal* getPosIterJointVelocities() { return mPosIterJointVelocities.begin(); } + + PX_FORCE_INLINE Cm::SpatialVectorF& getPosIterMotionVelocity(const PxU32 index) { return mPosIterMotionVelocities[index]; } + PX_FORCE_INLINE const Cm::SpatialVectorF& getMotionVelocity(const PxU32 index) const { return mMotionVelocities[index]; } + PX_FORCE_INLINE const Cm::SpatialVectorF& getMotionAcceleration(const PxU32 index) const { return mMotionAccelerations[index]; } + PX_FORCE_INLINE const Cm::SpatialVectorF& getCorioliseVector(const PxU32 index) const { return mCorioliseVectors[index]; } + PX_FORCE_INLINE const Cm::SpatialVectorF& getSpatialZAVector(const PxU32 index) const { return mZAForces[index]; } + PX_FORCE_INLINE const Cm::SpatialVectorF& getTransmittedForce(const PxU32 index) const { return mJointTransmittedForce[index]; } + + PX_FORCE_INLINE Cm::SpatialVectorF& getMotionVelocity(const PxU32 index) { return mMotionVelocities[index]; } + PX_FORCE_INLINE Cm::SpatialVectorF& getMotionAcceleration(const PxU32 index) { return mMotionAccelerations[index]; } + PX_FORCE_INLINE Cm::SpatialVectorF& getCorioliseVector(const PxU32 index) { return mCorioliseVectors[index]; } + PX_FORCE_INLINE Cm::SpatialVectorF& getSpatialZAVector(const PxU32 index) { return mZAForces[index]; } + PX_FORCE_INLINE Cm::SpatialVectorF& getTransmittedForce(const PxU32 index) { return mJointTransmittedForce[index]; } + + //PX_FORCE_INLINE Dy::SpatialMatrix* getTempSpatialMatrix() { mTempSpatialMatrix.begin(); } + + PX_FORCE_INLINE PxTransform& getPreTransform(const PxU32 index) { return mPreTransform[index]; } + PX_FORCE_INLINE const PxTransform& getPreTransform(const PxU32 index) const { return mPreTransform[index]; } +// PX_FORCE_INLINE void setPreTransform(const PxU32 index, const PxTransform& t){ mPreTransform[index] = t; } + PX_FORCE_INLINE PxTransform* getPreTransform() { return mPreTransform.begin(); } + + PX_FORCE_INLINE const Cm::SpatialVectorF& getDeltaMotionVector(const PxU32 index) const { return mDeltaMotionVector[index]; } + PX_FORCE_INLINE void setDeltaMotionVector(const PxU32 index, const Cm::SpatialVectorF& vec) { mDeltaMotionVector[index] = vec; } + PX_FORCE_INLINE Cm::SpatialVectorF* getDeltaMotionVector() { return mDeltaMotionVector.begin(); } + + PX_FORCE_INLINE ArticulationLink* getLinks() const { return mLinks; } + PX_FORCE_INLINE PxU32 getLinkCount() const { return mLinkCount; } + PX_FORCE_INLINE ArticulationLink& getLink(PxU32 index) const { return mLinks[index]; } + + PX_FORCE_INLINE ArticulationSpatialTendon** getSpatialTendons() const { return mSpatialTendons; } + PX_FORCE_INLINE PxU32 getSpatialTendonCount() const { return mNumSpatialTendons; } + PX_FORCE_INLINE ArticulationSpatialTendon* getSpatialTendon(PxU32 index) const { return mSpatialTendons[index]; } + + PX_FORCE_INLINE ArticulationFixedTendon** getFixedTendons() const { return mFixedTendons; } + PX_FORCE_INLINE PxU32 getFixedTendonCount() const { return mNumFixedTendons; } + PX_FORCE_INLINE ArticulationFixedTendon* getFixedTendon(PxU32 index) const { return mFixedTendons[index]; } + + PX_FORCE_INLINE ArticulationSensor** getSensors() const { return mSensors; } + PX_FORCE_INLINE PxU32 getSensorCount() const { return mNbSensors; } + + + PX_FORCE_INLINE ArticulationLinkData* getLinkData() const { return mLinksData; } + ArticulationLinkData& getLinkData(PxU32 index) const; + + PX_FORCE_INLINE ArticulationJointCoreData* getJointData() const { return mJointData; } + PX_FORCE_INLINE ArticulationJointCoreData& getJointData(PxU32 index) const { return mJointData[index]; } + + PX_FORCE_INLINE ArticulationJointTargetData* getJointTranData() const { return mJointTranData; } + PX_FORCE_INLINE ArticulationJointTargetData& getJointTranData(PxU32 index) const { return mJointTranData[index]; } + // PT: PX-1399 + PX_FORCE_INLINE PxArticulationFlags getArticulationFlags() const { return *mFlags; } + + PX_FORCE_INLINE Cm::SpatialVector* getExternalAccelerations() { return mExternalAcceleration; } + + PX_FORCE_INLINE Cm::SpatialVector& getExternalAcceleration(const PxU32 linkID) { return mExternalAcceleration[linkID]; } + PX_FORCE_INLINE const Cm::SpatialVector& getExternalAcceleration(const PxU32 linkID) const { return mExternalAcceleration[linkID]; } + + PX_FORCE_INLINE PxReal getDt() const { return mDt; } + PX_FORCE_INLINE void setDt(const PxReal dt) { mDt = dt; } + + PX_FORCE_INLINE bool getDataDirty() const { return mDataDirty; } + PX_FORCE_INLINE void setDataDirty(const bool dirty) { mDataDirty = dirty; } + + PX_FORCE_INLINE PxU32 getDofs() const { return mDofs; } + PX_FORCE_INLINE void setDofs(const PxU32 dof) { mDofs = dof; } + + PX_FORCE_INLINE FeatherstoneArticulation* getArticulation() { return mArticulation; } + PX_FORCE_INLINE void setArticulation(FeatherstoneArticulation* articulation) { mArticulation = articulation; } + + PX_FORCE_INLINE const SpatialMatrix& getBaseInvSpatialArticulatedInertiaW() const { return mBaseInvSpatialArticulatedInertiaW; } + + PX_FORCE_INLINE PxTransform* getAccumulatedPoses() { return mAccumulatedPoses.begin(); } + PX_FORCE_INLINE const PxTransform* getAccumulatedPoses() const { return mAccumulatedPoses.begin(); } + + PX_FORCE_INLINE Cm::SpatialVectorF* getJointSpaceJacobians() { return mJointSpaceJacobians.begin(); } + PX_FORCE_INLINE const Cm::SpatialVectorF* getJointSpaceJacobians() const { return mJointSpaceJacobians.begin(); } + + PX_FORCE_INLINE JointSpaceSpatialZ* getJointSpaceDeltaV() { return mJointSpaceDeltaVMatrix.begin(); } + PX_FORCE_INLINE const JointSpaceSpatialZ* getJointSpaceDeltaV() const { return mJointSpaceDeltaVMatrix.begin(); } + + PX_FORCE_INLINE Cm::SpatialVectorF* getJointSpaceResponse() { return mJointSpaceResponseMatrix.begin(); } + PX_FORCE_INLINE const Cm::SpatialVectorF* getJointSpaceResponse() const { return mJointSpaceResponseMatrix.begin(); } + + PX_FORCE_INLINE SpatialImpulseResponseMatrix* getRootResponseMatrix() { return mRootResponseMatrix.begin(); } + PX_FORCE_INLINE const SpatialImpulseResponseMatrix* getRootResponseMatrix() const { return mRootResponseMatrix.begin(); } + + PX_FORCE_INLINE const Cm::SpatialVectorF& getRootDeferredZ() const { return mRootDeferredZ; } + PX_FORCE_INLINE Cm::SpatialVectorF& getRootDeferredZ() { return mRootDeferredZ; } + + + + PX_FORCE_INLINE SpatialImpulseResponseMatrix* getImpulseResponseMatrixWorld() { return mResponseMatrixW.begin(); } + + PX_FORCE_INLINE const SpatialImpulseResponseMatrix* getImpulseResponseMatrixWorld() const { return mResponseMatrixW.begin(); } + + PX_FORCE_INLINE const SpatialMatrix& getWorldSpatialArticulatedInertia(const PxU32 linkID) const { return mWorldSpatialArticulatedInertia[linkID]; } + + + PX_FORCE_INLINE const InvStIs& getInvStIs(const PxU32 linkID) const { return mInvStIs[linkID]; } + + PX_FORCE_INLINE const Cm::UnAlignedSpatialVector& getMotionMatrix(const PxU32 dofId) const { return mMotionMatrix[dofId]; } + PX_FORCE_INLINE const Cm::UnAlignedSpatialVector& getWorldMotionMatrix(const PxU32 dofId) const { return mWorldMotionMatrix[dofId]; } + + PX_FORCE_INLINE Cm::UnAlignedSpatialVector& getJointAxis(const PxU32 dofId) { return mJointAxis[dofId]; } + PX_FORCE_INLINE const Cm::UnAlignedSpatialVector& getJointAxis(const PxU32 dofId) const { return mJointAxis[dofId]; } + + PX_FORCE_INLINE const PxVec3& getRw(const PxU32 linkID) const { return mRw[linkID]; } + + PX_FORCE_INLINE const Cm::SpatialVectorF& getIsW(const PxU32 dofId) const { return mIsW[dofId]; } + + PX_FORCE_INLINE const Cm::SpatialVectorF& getWorldIsInvD(const PxU32 dofId) const { return mIsInvDW[dofId]; } + PX_FORCE_INLINE PxReal* getDeferredQstZ() { return mDeferredQstZ.begin(); } + + PX_FORCE_INLINE PxReal* getQstZic() { return qstZIc.begin(); } + + PX_FORCE_INLINE Cm::SpatialVectorF& getSolverSpatialForce(const PxU32 linkID) { return mSolverSpatialForces[linkID]; } + PX_FORCE_INLINE PxSpatialForce* getSensorForces() { return mSensorForces; } + PX_FORCE_INLINE void setRootPreMotionVelocity(const Cm::UnAlignedSpatialVector& vel) { mRootPreMotionVelocity.top = vel.top; mRootPreMotionVelocity.bottom = vel.bottom; } + + PX_FORCE_INLINE PxU32* getPathToRootElements() const { return mPathToRootElements; } + PX_FORCE_INLINE PxU32 getPathToRootElementCount() const { return mNumPathToRootElements; } + + private: + Cm::SpatialVectorF mRootPreMotionVelocity; + Cm::SpatialVectorF mRootDeferredZ; + PxArray mJointAcceleration; // joint acceleration + PxArray mJointInternalAcceleration; //joint internal force acceleration + PxArray mJointVelocity; // joint velocity + PxArray mJointNewVelocity; // joint velocity due to contacts + PxArray mJointPosition; // joint position + PxArray mJointForce; // joint force + //Ps::Array mJointFrictionForce; // joint friction force + + PxArray mPosIterJointVelocities; //joint delta velocity after postion iternation before velocity iteration + PxArray mPosIterMotionVelocities; //link motion velocites after position iteration before velocity iteration + PxArray mMotionVelocities; //link motion velocites + PxArray mSolverSpatialForces; + PxArray mMotionAccelerations; //link motion accelerations + PxArray mMotionAccelerationsInternal; //link motion accelerations + PxArray mCorioliseVectors; //link coriolise vector + PxArray mZAInternalForces; //link internal spatial forces + PxArray mZAForces; //link spatial zero acceleration force/ spatial articulated force + PxArray mJointTransmittedForce; + PxArray mInternalConstraints; + PxArray mInternalLimits; + PxArray mInternalSpatialTendonConstraints; + PxArray mInternalFixedTendonConstraints; + + + PxArray mDeferredQstZ; + + PxArray mJointConstraintForces; + + PxArray mDeltaMotionVector; //this is for TGS solver + PxArray mPreTransform; //this is the previous transform list for links + PxArray mResponseMatrixW; + PxArray mJointSpaceJacobians; + PxArray mJointSpaceDeltaVMatrix; + PxArray mJointSpaceResponseMatrix; + PxArray mPropagationAccelerator; + PxArray mRootResponseMatrix; + PxArray mWorldSpatialArticulatedInertia; + PxArray mWorldIsolatedSpatialArticulatedInertia; + PxArray mMasses; + PxArray mInvStIs; + PxArray mIsW; + PxArray qstZIc;//jointForce - stZIc + PxArray qstZIntIc; + PxArray mJointAxis; + PxArray mMotionMatrix; + PxArray mWorldMotionMatrix; + PxArray mIsInvDW; + PxArray mRw; + + PxArray mNbStatic1DConstraints; + PxArray mNbStaticContactConstraints; + + PxArray mStatic1DConstraintStartIndex; + PxArray mStaticContactConstraintStartIndex; + + PxArray mRelativeQuat; + + ArticulationLink* mLinks; + PxU32 mLinkCount; + PxU32* mPathToRootElements; + PxU32 mNumPathToRootElements; + ArticulationLinkData* mLinksData; + ArticulationJointCoreData* mJointData; + ArticulationJointTargetData* mJointTranData; + ArticulationSpatialTendon** mSpatialTendons; + PxU32 mNumSpatialTendons; + PxU32 mNumTotalAttachments; + ArticulationFixedTendon** mFixedTendons; + PxU32 mNumFixedTendons; + ArticulationSensor** mSensors; + PxSpatialForce* mSensorForces; + PxU32 mNbSensors; + PxReal mDt; + PxU32 mDofs; + const PxArticulationFlags* mFlags; // PT: PX-1399 + Cm::SpatialVector* mExternalAcceleration; + bool mDataDirty; //this means we need to call commonInit() + bool mJointDirty; //this means joint delta velocity has been changed by contacts so we need to update joint velocity/joint acceleration + FeatherstoneArticulation* mArticulation; + + PxArray mAccumulatedPoses; + PxArray mDeltaQ; + + SpatialMatrix mBaseInvSpatialArticulatedInertiaW; + + PxReal mInvSumMass; + PxVec3 mCOM; + + friend class FeatherstoneArticulation; + }; + + + void ArticulationData::init() + { + //zero delta motion vector for TGS solver + PxMemZero(getDeltaMotionVector(), sizeof(Cm::SpatialVectorF) * mLinkCount); + PxMemZero(getPosIterMotionVelocities(), sizeof(Cm::SpatialVectorF) * mLinkCount); + mJointDirty = false; + } + + struct ScratchData + { + public: + ScratchData() + { + motionVelocities = NULL; + motionAccelerations = NULL; + coriolisVectors = NULL; + spatialZAVectors = NULL; + externalAccels = NULL; + compositeSpatialInertias = NULL; + + jointVelocities = NULL; + jointAccelerations = NULL; + jointForces = NULL; + jointPositions = NULL; + jointFrictionForces = NULL; + } + + Cm::SpatialVectorF* motionVelocities; + Cm::SpatialVectorF* motionAccelerations; + Cm::SpatialVectorF* coriolisVectors; + Cm::SpatialVectorF* spatialZAVectors; + Cm::SpatialVector* externalAccels; + Dy::SpatialMatrix* compositeSpatialInertias; + + PxReal* jointVelocities; + PxReal* jointAccelerations; + PxReal* jointForces; + PxReal* jointPositions; + PxReal* jointFrictionForces; + }; + + struct InternalConstraintSolverData + { + const PxReal dt; + const PxReal invDt; + const PxReal elapsedTime; + const PxReal erp; + Cm::SpatialVectorF* impulses; + Cm::SpatialVectorF* deltaV; + const bool velocityIteration; + const bool isTGS; + PxU32 dofId; + PxU32 complexId; + PxU32 limitId; + PxU32 articId; + + InternalConstraintSolverData(const PxReal dt_, const PxReal invDt_, const PxReal elapsedTime_, + const PxReal erp_, Cm::SpatialVectorF* impulses_, Cm::SpatialVectorF* deltaV_, + bool velocityIteration_, bool isTGS_) : dt(dt_), invDt(invDt_), elapsedTime(elapsedTime_), + erp(erp_), impulses(impulses_), deltaV(deltaV_), velocityIteration(velocityIteration_), + isTGS(isTGS_), dofId(0), complexId(0), limitId(0) + { + } + + PX_NOCOPY(InternalConstraintSolverData) + }; + + struct FixedTendonSolveData + { + ArticulationLink* links; + ArticulationTendonJoint* tendonJoints; + PxReal rootVel; + PxReal rootImp; + PxReal erp; + PxReal error; + PxReal limitError; + }; + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + //Articulation dirty flag - used to tag which properties of the articulation are dirty. Used only to transfer selected data to the GPU... + struct ArticulationDirtyFlag + { + enum Enum + { + eDIRTY_JOINTS = 1 << 0, + eDIRTY_POSITIONS = 1 << 1, + eDIRTY_VELOCITIES = 1 << 2, + eDIRTY_ACCELERATIONS = 1 << 3, + eDIRTY_FORCES = 1 << 4, + eDIRTY_ROOT_TRANSFORM = 1 << 5, + eDIRTY_ROOT_VELOCITIES = 1 << 6, + eDIRTY_LINKS = 1 << 7, + eIN_DIRTY_LIST = 1 << 8, + eDIRTY_WAKECOUNTER = 1 << 9, + eDIRTY_EXT_ACCEL = 1 << 10, + eDIRTY_LINK_FORCE = 1 << 11, + eDIRTY_LINK_TORQUE = 1 << 12, + eDIRTY_JOINT_TARGET_VEL = 1 << 13, + eDIRTY_JOINT_TARGET_POS = 1 << 14, + ePENDING_INSERTION = 1 << 15, + eDIRTY_SPATIAL_TENDON = 1 << 16, + eDIRTY_SPATIAL_TENDON_ATTACHMENT = 1 << 17, + eDIRTY_FIXED_TENDON = 1 << 18, + eDIRTY_FIXED_TENDON_JOINT = 1 << 19, + eDIRTY_SENSOR = 1 << 20, + eDIRTY_VELOCITY_LIMITS = 1 << 21, + eDIRTY_DOFS = (eDIRTY_POSITIONS | eDIRTY_VELOCITIES | eDIRTY_ACCELERATIONS | eDIRTY_FORCES), + eALL = (1<<21)-1 + }; + }; + + PX_INLINE PX_CUDA_CALLABLE void computeArticJacobianAxes(PxVec3 row[3], const PxQuat& qa, const PxQuat& qb) + { + // Compute jacobian matrix for (qa* qb) [[* means conjugate in this expr]] + // d/dt (qa* qb) = 1/2 L(qa*) R(qb) (omega_b - omega_a) + // result is L(qa*) R(qb), where L(q) and R(q) are left/right q multiply matrix + + const PxReal wa = qa.w, wb = qb.w; + const PxVec3 va(qa.x, qa.y, qa.z), vb(qb.x, qb.y, qb.z); + + const PxVec3 c = vb*wa + va*wb; + const PxReal d0 = wa*wb; + const PxReal d1 = va.dot(vb); + const PxReal d = d0 - d1; + + row[0] = (va * vb.x + vb * va.x + PxVec3(d, c.z, -c.y)) * 0.5f; + row[1] = (va * vb.y + vb * va.y + PxVec3(-c.z, d, c.x)) * 0.5f; + row[2] = (va * vb.z + vb * va.z + PxVec3(c.y, -c.x, d)) * 0.5f; + + if ((d0 + d1) != 0.0f) // check if relative rotation is 180 degrees which can lead to singular matrix + return; + else + { + row[0].x += PX_EPS_F32; + row[1].y += PX_EPS_F32; + row[2].z += PX_EPS_F32; + } + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE float compAng(PxReal swingYZ, PxReal swingW) + { + return 4.0f * PxAtan2(swingYZ, 1.0f + swingW); // tan (t/2) = sin(t)/(1+cos t), so this is the quarter angle + } + + + PX_ALIGN_PREFIX(64) + class FeatherstoneArticulation + { + PX_NOCOPY(FeatherstoneArticulation) + public: + // public interface + + explicit FeatherstoneArticulation(void*); + ~FeatherstoneArticulation(); + + // get data sizes for allocation at higher levels + void getDataSizes(PxU32 linkCount, PxU32& solverDataSize, PxU32& totalSize, PxU32& scratchSize); + + bool resize(const PxU32 linkCount); + + void assignTendons(const PxU32 /*nbTendons*/, Dy::ArticulationSpatialTendon** /*tendons*/); + + void assignTendons(const PxU32 /*nbTendons*/, Dy::ArticulationFixedTendon** /*tendons*/); + + void assignSensors(const PxU32 nbSensors, Dy::ArticulationSensor** sensors, PxSpatialForce* sensorForces); + + PxU32 getDofs(); + + PxU32 getDof(const PxU32 linkID); + + bool applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag, bool& shouldWake); + + void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag); + + void packJointData(const PxReal* maximum, PxReal* reduced); + + void unpackJointData(const PxReal* reduced, PxReal* maximum); + + void initializeCommonData(); + + //gravity as input, joint force as output + void getGeneralizedGravityForce(const PxVec3& gravity, PxArticulationCache& cache); + + //joint velocity as input, generalised force(coriolis and centrigugal force) as output + void getCoriolisAndCentrifugalForce(PxArticulationCache& cache); + + //external force as input, joint force as output + void getGeneralizedExternalForce(PxArticulationCache& /*cache*/); + + //joint force as input, joint acceleration as output + void getJointAcceleration(const PxVec3& gravity, PxArticulationCache& cache); + + //joint acceleration as input, joint force as out + void getJointForce(PxArticulationCache& cache); + + void getDenseJacobian(PxArticulationCache& cache, PxU32 & nRows, PxU32 & nCols); + + //These two functions are for closed loop system + void getKMatrix(ArticulationJointCore* loopJoint, const PxU32 parentIndex, const PxU32 childIndex, PxArticulationCache& cache); + + void getCoefficientMatrix(const PxReal dt, const PxU32 linkID, const PxContactJoint* contactJoints, const PxU32 nbContacts, PxArticulationCache& cache); + + void getCoefficientMatrixWithLoopJoints(ArticulationLoopConstraint* lConstraints, const PxU32 nbJoints, PxArticulationCache& cache); + + bool getLambda(ArticulationLoopConstraint* lConstraints, const PxU32 nbJoints, PxArticulationCache& cache, PxArticulationCache& rollBackCache, + const PxReal* jointTorque, const PxVec3& gravity, const PxU32 maxIter, const PxReal invLengthScale); + + void getGeneralizedMassMatrix(PxArticulationCache& cache); + + void getGeneralizedMassMatrixCRB(PxArticulationCache& cache); + + bool storeStaticConstraint(const PxSolverConstraintDesc& desc); + + bool willStoreStaticConstraint() { return DY_STATIC_CONTACTS_IN_INTERNAL_SOLVER; } + + void setRootLinearVelocity(const PxVec3& velocity); + void setRootAngularVelocity(const PxVec3& velocity); + void teleportRootLink(); + + void getImpulseResponse( + PxU32 linkID, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse, + Cm::SpatialVector& deltaV) const; + + void getImpulseResponse( + PxU32 linkID, + Cm::SpatialVectorV* /*Z*/, + const Cm::SpatialVectorV& impulse, + Cm::SpatialVectorV& deltaV) const; + + void getImpulseSelfResponse( + PxU32 linkID0, + PxU32 linkID1, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse0, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV0, + Cm::SpatialVector& deltaV1) const; + + Cm::SpatialVectorV getLinkVelocity(const PxU32 linkID) const; + + Cm::SpatialVector getLinkScalarVelocity(const PxU32 linkID) const; + + Cm::SpatialVectorV getLinkMotionVector(const PxU32 linkID) const; + + //this is called by island gen to determine whether the articulation should be awake or sleep + Cm::SpatialVector getMotionVelocity(const PxU32 linkID) const; + + Cm::SpatialVector getMotionAcceleration(const PxU32 linkID) const; + + void fillIndexType(const PxU32 linkId, PxU8& indexType); + + PxReal getLinkMaxPenBias(const PxU32 linkID) const; + + PxReal getCfm(const PxU32 linkID) const; + + static PxU32 computeUnconstrainedVelocities( + const ArticulationSolverDesc& desc, + PxReal dt, + PxU32& acCount, + const PxVec3& gravity, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV, const PxReal invLengthScale); + + static void computeUnconstrainedVelocitiesTGS( + const ArticulationSolverDesc& desc, + PxReal dt, const PxVec3& gravity, + PxU64 contextID, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV, + const PxReal invLengthScale); + + static PxU32 setupSolverConstraintsTGS(const ArticulationSolverDesc& articDesc, + PxReal dt, + PxReal invDt, + PxReal totalDt, + const PxReal biasCoefficient, + PxU32& acCount, + Cm::SpatialVectorF* Z); + + static void saveVelocity(const ArticulationSolverDesc& d, Cm::SpatialVectorF* deltaV); + + static void saveVelocityTGS(const ArticulationSolverDesc& d, PxReal invDtF32); + + static void updateBodies(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, PxReal dt); + + static void updateBodiesTGS(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, PxReal dt); + + static void updateBodies(FeatherstoneArticulation* articulation, Cm::SpatialVectorF* tempDeltaV, PxReal dt, bool integrateJointPosition); + + static void recordDeltaMotion(const ArticulationSolverDesc& desc, const PxReal dt, Cm::SpatialVectorF* deltaV, const PxReal totalInvDt); + + static void deltaMotionToMotionVelocity(const ArticulationSolverDesc& desc, PxReal invDt); + + void pxcFsApplyImpulse(PxU32 linkID, aos::Vec3V linear, + aos::Vec3V angular, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV); + + void pxcFsApplyImpulses(PxU32 linkID, const aos::Vec3V& linear, + const aos::Vec3V& angular, PxU32 linkID2, const aos::Vec3V& linear2, + const aos::Vec3V& angular2, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV); + + void pxcFsApplyImpulses(Cm::SpatialVectorF* Z); + + Cm::SpatialVectorV pxcFsGetVelocity(PxU32 linkID); + + void pxcFsGetVelocities(PxU32 linkID, PxU32 linkID1, Cm::SpatialVectorV& v0, Cm::SpatialVectorV& v1); + + Cm::SpatialVectorV pxcFsGetVelocityTGS(PxU32 linkID); + + const PxTransform& getCurrentTransform(PxU32 linkID) const; + + const PxQuat& getDeltaQ(PxU32 linkID) const; + + //Applies a set of N impulses, all in local space and updates the links' motion and joint velocities + void applyImpulses(Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV); + void getDeltaV(Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV); + + //This method calculate the velocity change due to collision/constraint impulse, record joint velocity and acceleration + static Cm::SpatialVectorF propagateVelocityW(const PxVec3& c2p, const Dy::SpatialMatrix& spatialInertia, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, + PxReal* jointVelocity, const Cm::SpatialVectorF& hDeltaV, const PxU32 dofCount); + + static Cm::SpatialVectorF propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + PxReal* jointVelocity, const Cm::SpatialVectorF& pAcceleration, const PxU32 dofCount, const Cm::SpatialVectorF* IsW, PxReal* qstZIc); + + static void propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, PxReal* jointVelocity, const Cm::SpatialVectorF& pAcceleration, + const PxU32 dofCount, const Cm::SpatialVectorF* IsW); + + static Cm::SpatialVectorF propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + const Cm::SpatialVectorF& pAcceleration, const PxU32 dofCount, const Cm::SpatialVectorF* IsW, PxReal* qstZIc); + + static Cm::SpatialVectorF propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + PxReal* jointVelocity, const Cm::SpatialVectorF& pAcceleration, Cm::SpatialVectorF& Z, const PxU32 dofCount, const Cm::SpatialVectorF* IsW); + + //This method calculate the velocity change due to collision/constraint impulse + static Cm::SpatialVectorF propagateVelocityTestImpulseW(const PxVec3& c2p, const Dy::SpatialMatrix& spatialInertia, const InvStIs& invStIs, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const Cm::SpatialVectorF& hDeltaV, + const PxU32 dofCount); + + + ////This method calculate zero acceration impulse due to test/actual impluse + //static Cm::SpatialVectorF propagateImpulse(const IsInvD& isInvD, const SpatialTransform& childToParent, + // const SpatialSubspaceMatrix& motionMatrix, const Cm::SpatialVectorF& Z); + + static Cm::SpatialVectorF propagateImpulseW(const Cm::SpatialVectorF* isInvD, const PxVec3& childToParent, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const PxU32 dofCount); + + static Cm::SpatialVectorF propagateImpulseW(const Cm::SpatialVectorF* isInvD, const PxVec3& childToParent, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const PxU32 dofCount, PxReal* qstZ); + + bool applyCacheToDest(ArticulationData& data, PxArticulationCache& cache, + PxReal* jVelocities, PxReal* jAcceleration, PxReal* jPosition, PxReal* jointForce, + const PxArticulationCacheFlags flag, bool& shouldWake); + + PX_FORCE_INLINE ArticulationData& getArticulationData() { return mArticulationData; } + PX_FORCE_INLINE const ArticulationData& getArticulationData() const { return mArticulationData; } + + PX_FORCE_INLINE void setGpuDirtyFlag(ArticulationDirtyFlag::Enum flag) + { + mGPUDirtyFlags |= flag; + } + //void setGpuRemapId(const PxU32 id) { mGpuRemapId = id; } + //PxU32 getGpuRemapId() { return mGpuRemapId; } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF translateSpatialVector(const PxVec3& offset, const Cm::SpatialVectorF& vec) + { + return Cm::SpatialVectorF(vec.top, vec.bottom + offset.cross(vec.top)); + } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector translateSpatialVector(const PxVec3& offset, const Cm::UnAlignedSpatialVector& vec) + { + return Cm::UnAlignedSpatialVector(vec.top, vec.bottom + offset.cross(vec.top)); + } + + static PX_FORCE_INLINE PxMat33 constructSkewSymmetricMatrix(const PxVec3 r) + { + return PxMat33(PxVec3(0.0f, r.z, -r.y), + PxVec3(-r.z, 0.0f, r.x), + PxVec3(r.y, -r.x, 0.0f)); + } + + bool raiseGPUDirtyFlag(ArticulationDirtyFlag::Enum flag) + { + bool nothingRaised = !(mGPUDirtyFlags); + mGPUDirtyFlags |= flag; + return nothingRaised; + } + + void clearGPUDirtyFlags() + { + mGPUDirtyFlags = 0; + } + + public: + void constraintPrep(ArticulationLoopConstraint* lConstraints, const PxU32 nbJoints, + Cm::SpatialVectorF* Z, PxSolverConstraintPrepDesc& prepDesc, PxSolverBody& sBody, + PxSolverBodyData& sBodyData, PxSolverConstraintDesc* desc, PxConstraintAllocator& allocator); + + void updateArticulation(ScratchData& scratchData, + const PxVec3& gravity, + Cm::SpatialVectorF* Z, + Cm::SpatialVectorF* DeltaV, + const PxReal invLengthScale); + + void computeUnconstrainedVelocitiesInternal( + const PxVec3& gravity, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, const PxReal invLengthScale); + + //copy joint data from fromJointData to toJointData + void copyJointData(ArticulationData& data, PxReal* toJointData, const PxReal* fromJointData); + + PxU32 computeDofs(); + //this function calculates motion subspace matrix(s) for all tree joint + void jcalc(ArticulationData& data, bool forceUpdate = false); + + //this function calculates loop joint constraint subspace matrix(s) and active force + //subspace matrix + void jcalcLoopJointSubspace(ArticulationJointCore* joint, ArticulationJointCoreData& jointDatum, SpatialSubspaceMatrix& T, + const Cm::UnAlignedSpatialVector* jointAxis); + + void computeSpatialInertia(ArticulationData& data); + + //compute zero acceleration force + void computeZ(const ArticulationData& data, const PxVec3& gravity, ScratchData& scratchData); + void computeZD(const ArticulationData& data, const PxVec3& gravity, ScratchData& scratchData); + + void solveInternalConstraints(const PxReal dt, const PxReal invDt, Cm::SpatialVectorF* impulses, Cm::SpatialVectorF* DeltaV, + bool velocityIteration, bool isTGS, const PxReal elapsedTime, const PxReal biasCoefficient); + + + void solveInternalJointConstraints(const PxReal dt, const PxReal invDt, Cm::SpatialVectorF* impulses, Cm::SpatialVectorF* DeltaV, + bool velocityIteration, bool isTGS, const PxReal elapsedTime, const PxReal biasCoefficient); + + Cm::SpatialVectorF solveInternalJointConstraintRecursive(InternalConstraintSolverData& data, const PxU32 linkID, + const Cm::SpatialVectorF& parentDeltaV); + + void solveInternalSpatialTendonConstraints(bool isTGS); + + void solveInternalFixedTendonConstraints(bool isTGS); + + void writebackInternalConstraints(bool isTGS); + + void concludeInternalConstraints(bool isTGS); + + //compute coriolis force + void computeC(ArticulationData& data, ScratchData& scratchData); + + //compute relative transform child to parent + void computeRelativeTransformC2P(ArticulationData& data); + //compute relative transform child to base + void computeRelativeTransformC2B(ArticulationData& data); + + void computeLinkVelocities(ArticulationData& data, ScratchData& scratchData); + + + /** + /brief Prepare links for the next timestep. + \param[in] dt is the timestep of the current simulation step that will advance sim from t to t+dt. + \param[in] invLengthScale is the reciprocal of the lengthscale used by the simulation. + \param[in] gravity is the gravitational acceleration to apply to all links. + \param[in] fixBase determines whether the root link is to be fixed to the world (true) or will move freely (false). + \param[in] linkCount is the total number of links in the articulation + \param[in] accumulatedPoses is the pose of each link, specified in the world frame. + \param[in] externalAccels is the external acceleration to apply to each link, specified in the world frame. + \param[in] rws is the vector from each parent link to each child link, specified in the world frame. + \param[in] worldMotionMatrices is the motion matrix of each link, specified in the world frame. + \param[in] jointCoreData is the ArticulationJointCoreData instance of each link in the articulation. + \param[in,out] linkData is the ArticulationLinkData instance of each link in the articulation. + \param[in,out] links is the ArticulationLink instance of each link in the articulation. + \param[in,out] motionAccelerations is the acceleration of each link, specified in the world frame. + \param[out] motionVelocities is velocity of each link computed from the parent link velocity and joint velocity of the inbound joint. Specified in the world frame. + \param[out] spatialZAForces is the computed spatial zero acceleration force of each link, accounting for only external forces applied to the links. Specified in the world frame. + \param[out] spatialZAInternal is the computed spatial zero acceleration force of each link, accounting for only internal forces applied to the links. Specified in the world frame. + \param[out] coriolisVectors is the computed coriolis vector of each link. Specified in the world frame. + \param[out] worldIsolatedSpatialArticulatedInertias is the inertia tensor (I) for the trivial sub-chain of each link. Specified in the world frame. + \param[out] linkMasses is the mass of each link. + \param[out] worldSpatialArticulatedInertias is the spatial matrix containing the inertia tensor I and the mass matrix M for the trivial sub-chain of each link. Specified in the world frame. + \param[out] jointDofCount is the number of degrees of freedom for the entire articulation. + \param[in,out] jointVelocities is the velocity of each degree of freedom. + \param[out] rootPreMotionVelocity is assigned the spatial velocity of the root link. + \param[out] com is the centre of mass of the assembly of links, specified in the world frame. + \param[out] invSumMass is the reciprocal of the total mass of all links. + \note invLengthScale should have value 1/100 for centimetres scale and 1/1 for metres scale. + \note If fixBase is true, the root link is assigned zero velocity. If false, the root link inherits the velocity of the associated body core. + \note If fixBase is true, the root link is assigned zero acceleration. If false, the acceleration is propagated from the previous simulation step. The acceleration + of all other links is left unchanged. + \note If fix base is true, the root link is assigned a zero coriolis vector. + \note ArticulationLinkData::maxPenBias of each link inherits the value of the associated PxsBodyCore::maxPenBias. + \note ArticulationLink::cfm of each link is assigned the value PxsBodyCore::cfmScale*invLengthScale, except for the root link. The root link is + assigned a value of 0 if it is fixed to the world ie fixBase == true. + \note The spatial zero acceleration force accounts for the external acceleration; the damping force arising from the velocity and from the velocity + that will accumulate from the external acceleration; the scaling force that will bring velocity back to the maximum allowed velocity if velocity exceeds the maximum allowed. + \note If the velocity of any degree of freedom exceeds the maximum velocity of the associated joint, the velocity of each degree of freedom will be scaled so that none exceeds the maximum. + */ + static void computeLinkStates( + const PxF32 dt, const PxReal invLengthScale, const PxVec3& gravity, + const bool fixBase, + const PxU32 linkCount, + const PxTransform* accumulatedPoses, const Cm::SpatialVector* externalAccels, const PxVec3* rws, const Cm::UnAlignedSpatialVector* worldMotionMatrices, + const Dy::ArticulationJointCoreData* jointCoreData, + Dy::ArticulationLinkData *linkData, Dy::ArticulationLink* links, Cm::SpatialVectorF* motionAccelerations, + Cm::SpatialVectorF* motionVelocities, Cm::SpatialVectorF* spatialZAForces, Cm::SpatialVectorF* spatialZAInternal, Cm::SpatialVectorF* coriolisVectors, + PxMat33* worldIsolatedSpatialArticulatedInertias, PxF32* linkMasses, Dy::SpatialMatrix* worldSpatialArticulatedInertias, + const PxU32 jointDofCount, + PxReal* jointVelocities, + Cm::SpatialVectorF& rootPreMotionVelocity, PxVec3& com, PxF32& invSumMass); + + void initLinks(ArticulationData& data, const PxVec3& gravity, + ScratchData& scratchData, Cm::SpatialVectorF* tZ, Cm::SpatialVectorF* tDeltaV); + + void computeIs(ArticulationJointCoreData& jointDatum, ArticulationJointTargetData& jointTarget, const PxU32 linkID); + static SpatialMatrix computePropagateSpatialInertia_ZA_ZIc(const PxU8 jointType, const ArticulationJointTargetData& jointTarget, const ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxReal* jF, const Cm::SpatialVectorF& Z, const Cm::SpatialVectorF& ZIntIc, Cm::SpatialVectorF& ZA, Cm::SpatialVectorF& ZInt, PxReal* qstZ, + PxReal* qstZIntIc); + + static SpatialMatrix computePropagateSpatialInertia_ZA_ZIc_NonSeparated(const PxU8 jointType, const ArticulationJointTargetData& jointTarget, const ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxReal* jF, const Cm::SpatialVectorF& Z, Cm::SpatialVectorF& ZA, PxReal* qstZIc); + + static SpatialMatrix computePropagateSpatialInertia(const PxU8 jointType, ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, + const Cm::UnAlignedSpatialVector* motionMatrix); + + static void transformInertia(const SpatialTransform& sTod, SpatialMatrix& inertia); + + static void translateInertia(const PxMat33& offset, SpatialMatrix& inertia); + + static PxMat33 translateInertia(const PxMat33& inertia, const PxReal mass, const PxVec3& t); + + void computeArticulatedSpatialInertiaAndZ(ArticulationData& data, ScratchData& scratchData); + void computeArticulatedSpatialInertiaAndZ_NonSeparated(ArticulationData& data, ScratchData& scratchData); + + void computeArticulatedSpatialInertia(ArticulationData& data); + + void computeArticulatedResponseMatrix(ArticulationData& data); + + void computeJointSpaceJacobians(ArticulationData& data); + + void computeArticulatedSpatialZ(ArticulationData& data, ScratchData& scratchData); + + /*void computeJointAcceleration(ArticulationLinkData& linkDatum, ArticulationJointCoreData& jointDatum, + const Cm::SpatialVectorF& pMotionAcceleration, PxReal* jointAcceleration, const PxU32 linkID);*/ + + void computeJointAccelerationW(ArticulationJointCoreData& jointDatum, + const Cm::SpatialVectorF& pMotionAcceleration, PxReal* jointAcceleration, const Cm::SpatialVectorF* IsW, const PxU32 linkID, + const PxReal* qstZIc); + + //compute joint acceleration, joint velocity and link acceleration, velocity based + //on spatial force and spatial articulated inertia tensor + void computeLinkAcceleration(ArticulationData& data, ScratchData& scratchData, bool doIC); + + void computeLinkInternalAcceleration(ArticulationData& data, ScratchData& scratchData); + + //void computeTempLinkAcceleration(ArticulationData& data, ScratchData& scratchData); + void computeJointTransmittedFrictionForce(ArticulationData& data, ScratchData& scratchData, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV); + + static Cm::SpatialVectorF getDeltaVWithDeltaJV(const bool fixBase, const PxU32 linkID, + const ArticulationData& data, Cm::SpatialVectorF* Z, + PxReal* jointVelocities); + + static Cm::SpatialVectorF getDeltaV(const bool fixBase, const PxU32 linkID, + const ArticulationData& data, Cm::SpatialVectorF* Z); + + //impulse need to be in the linkID space + static void getZ(const PxU32 linkID, const ArticulationData& data, + Cm::SpatialVectorF* Z, const Cm::SpatialVectorF& impulse); + + //This method use in impulse self response. The input impulse is in the link space + static Cm::SpatialVectorF getImpulseResponseW( + const PxU32 linkID, + const ArticulationData& data, + const Cm::SpatialVectorF& impulse); + + //This method use in impulse self response. The input impulse is in the link space + static Cm::SpatialVectorF getImpulseResponseWithJ( + const PxU32 linkID, + const bool fixBase, + const ArticulationData& data, + Cm::SpatialVectorF* Z, + const Cm::SpatialVectorF& impulse, + PxReal* jointVelocities); + + void getImpulseSelfResponseInv(const bool fixBase, + PxU32 linkID0, + PxU32 linkID1, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse0, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV0, + Cm::SpatialVector& deltaV1, + PxReal* jointVelocities); + + void getImpulseResponseSlowInv(Dy::ArticulationLink* links, + const ArticulationData& data, + PxU32 linkID0_, + const Cm::SpatialVector& impulse0, + Cm::SpatialVector& deltaV0, + PxU32 linkID1_, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV1, + PxReal* jointVelocities, + Cm::SpatialVectorF* Z); + + Cm::SpatialVectorF getImpulseResponseInv(const bool fixBase, + const PxU32 linkID, Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse, + PxReal* jointVelocites); + + void inverseDynamic(ArticulationData& data, const PxVec3& gravity, + ScratchData& scratchData, bool computeCoriolis); + + void inverseDynamicFloatingBase(ArticulationData& data, const PxVec3& gravity, + ScratchData& scratchData, bool computeCoriolis); + + //compute link body force with motion velocity and acceleration + void computeZAForceInv(ArticulationData& data, ScratchData& scratchData); + void initCompositeSpatialInertia(ArticulationData& data, Dy::SpatialMatrix* compositeSpatialInertia); + void computeCompositeSpatialInertiaAndZAForceInv(ArticulationData& data, ScratchData& scratchData); + + void computeRelativeGeneralizedForceInv(ArticulationData& data, ScratchData& scratchData); + + //provided joint velocity and joint acceleartion, compute link acceleration + void computeLinkAccelerationInv(ArticulationData& data, ScratchData& scratchData); + + void computeGeneralizedForceInv(ArticulationData& data, ScratchData& scratchData); + + void calculateMassMatrixColInv(ScratchData& scratchData); + + void calculateHFixBase(PxArticulationCache& cache); + + void calculateHFloatingBase(PxArticulationCache& cache); + + //joint limits + void enforcePrismaticLimits(PxReal& jPosition, ArticulationJointCore* joint); + + + public: + + PX_FORCE_INLINE void addBody() + { + mAcceleration.pushBack(Cm::SpatialVector(PxVec3(0.f), PxVec3(0.f))); + mUpdateSolverData = true; + } + + PX_FORCE_INLINE void removeBody() + { + mUpdateSolverData = true; + } + + PX_FORCE_INLINE bool updateSolverData() { return mUpdateSolverData; } + + PX_FORCE_INLINE PxU32 getMaxDepth() const { return mMaxDepth; } + PX_FORCE_INLINE void setMaxDepth(const PxU32 depth) { mMaxDepth = depth; } + + // solver methods + PX_FORCE_INLINE PxU32 getBodyCount() const { return mSolverDesc.linkCount; } + PX_FORCE_INLINE void getSolverDesc(ArticulationSolverDesc& d) const { d = mSolverDesc; } + PX_FORCE_INLINE ArticulationSolverDesc& getSolverDesc() { return mSolverDesc; } + + PX_FORCE_INLINE ArticulationCore* getCore() { return mSolverDesc.core; } + PX_FORCE_INLINE PxU16 getIterationCounts() const { return mSolverDesc.core->solverIterationCounts; } + + PX_FORCE_INLINE void* getUserData() const { return mUserData; } + + PX_FORCE_INLINE void setDyContext(Dy::Context* context) { mContext = context; } + + void setupLinks(PxU32 nbLinks, Dy::ArticulationLink* links); + void allocatePathToRootElements(const PxU32 totalPathToRootElements); + void initPathToRoot(); + + static void getImpulseSelfResponse(ArticulationLink* links, + Cm::SpatialVectorF* Z, + ArticulationData& data, + PxU32 linkID0, + const Cm::SpatialVectorV& impulse0, + Cm::SpatialVectorV& deltaV0, + PxU32 linkID1, + const Cm::SpatialVectorV& impulse1, + Cm::SpatialVectorV& deltaV1); + + static void getImpulseResponseSlow(Dy::ArticulationLink* links, + ArticulationData& data, + PxU32 linkID0_, + const Cm::SpatialVector& impulse0, + Cm::SpatialVector& deltaV0, + PxU32 linkID1_, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV1, + Cm::SpatialVectorF* Z); + + PxU32 setupSolverConstraints( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + PxU32& acCount); + + void setupInternalConstraints( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + PxReal stepDt, + PxReal dt, + PxReal invDt, + PxReal erp, + bool isTGSSolver); + + void setupInternalConstraintsRecursive( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const PxReal dt, + const PxReal invDt, + const PxReal erp, + const bool isTGSSolver, + const PxU32 linkID, + const PxReal maxForceScale); + + void setupInternalSpatialTendonConstraintsRecursive( + ArticulationLink* links, + ArticulationAttachment* attachments, + const PxU32 attachmentCount, + const PxVec3& parentAttachmentPoint, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const bool isTGSSolver, + const PxU32 attachmentID, + const PxReal stiffness, + const PxReal damping, + const PxReal limitStiffness, + const PxReal err, + const PxU32 startLink, + const PxVec3& startAxis, + const PxVec3& startRaXn); + + + void setupInternalFixedTendonConstraintsRecursive( + ArticulationLink* links, + ArticulationTendonJoint* tendonJoints, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const bool isTGSSolver, + const PxU32 tendonJointID, + const PxReal stiffness, + const PxReal damping, + const PxReal limitStiffness, + const PxU32 startLink, + const PxVec3& startAxis, + const PxVec3& startRaXn); + + + void updateSpatialTendonConstraintsRecursive(ArticulationAttachment* attachments, ArticulationData& data, const PxU32 attachmentID, const PxReal accumErr, + const PxVec3& parentAttachmentPoint); + + //void updateFixedTendonConstraintsRecursive(ArticulationLink* links, ArticulationTendonJoint* tendonJoint, ArticulationData& data, const PxU32 tendonJointID, const PxReal accumErr); + + PxVec3 calculateFixedTendonVelocityAndPositionRecursive(FixedTendonSolveData& solveData, + const Cm::SpatialVectorF& parentV, const Cm::SpatialVectorF& parentDeltaV, const PxU32 tendonJointID); + + Cm::SpatialVectorF solveFixedTendonConstraintsRecursive(FixedTendonSolveData& solveData, + const PxU32 tendonJointID); + + void prepareStaticConstraints(const PxReal dt, const PxReal invDt, PxsContactManagerOutputIterator& outputs, + Dy::ThreadContext& threadContext, PxReal correlationDist, PxReal bounceThreshold, PxReal frictionOffsetThreshold, + PxReal ccdMaxSeparation, PxSolverBodyData* solverBodyData, PxsConstraintBlockManager& blockManager, + Dy::ConstraintWriteback* constraintWritebackPool); + + void prepareStaticConstraintsTGS(const PxReal stepDt, const PxReal totalDt, const PxReal invStepDt, const PxReal invTotalDt, + PxsContactManagerOutputIterator& outputs, Dy::ThreadContext& threadContext, PxReal correlationDist, PxReal bounceThreshold, + PxReal frictionOffsetThreshold, PxTGSSolverBodyData* solverBodyData, + PxTGSSolverBodyTxInertia* txInertia, PxsConstraintBlockManager& blockManager, Dy::ConstraintWriteback* constraintWritebackPool, + const PxReal biasCoefficient, const PxReal lengthScale); + + + //integration + void propagateLinksDown(ArticulationData& data, PxReal* jointVelocities, PxReal* jointPositions, + Cm::SpatialVectorF* motionVelocities); + + void updateJointProperties( + PxReal* jointNewVelocities, + PxReal* jointVelocities, + PxReal* jointAccelerations); + + void recomputeAccelerations(const PxReal dt); + Cm::SpatialVector recomputeAcceleration(const PxU32 linkID, const PxReal dt) const; + + void computeAndEnforceJointPositions(ArticulationData& data); + + //update link position based on joint position provided by the cache + void teleportLinks(ArticulationData& data); + + void computeLinkVelocities(ArticulationData& data); + + PxU8* allocateScratchSpatialData(PxcScratchAllocator* allocator, + const PxU32 linkCount, ScratchData& scratchData, bool fallBackToHeap = false); + + //This method calculate the velocity change from parent to child using parent current motion velocity + PxTransform propagateTransform(const PxU32 linkID, ArticulationLink* links, ArticulationJointCoreData& jointDatum, + Cm::SpatialVectorF* motionVelocities, const PxReal dt, const PxTransform& pBody2World, const PxTransform& currentTransform, + PxReal* jointVelocity, PxReal* jointPosition, const Cm::UnAlignedSpatialVector* motionMatrix, + const Cm::UnAlignedSpatialVector* worldMotionMatrix); + + static void updateRootBody(const Cm::SpatialVectorF& motionVelocity, + const PxTransform& preTransform, ArticulationData& data, const PxReal dt); + + //These variables are used in the constraint partition + PxU16 maxSolverFrictionProgress; + PxU16 maxSolverNormalProgress; + PxU32 solverProgress; + PxU16 mArticulationIndex; + PxU8 numTotalConstraints; + + void* mUserData; + Dy::Context* mContext; + ArticulationSolverDesc mSolverDesc; + + PxArray mAcceleration; // supplied by Sc-layer to feed into articulations + + bool mUpdateSolverData; + PxU32 mMaxDepth; + + ArticulationData mArticulationData; + + PxArray mStaticContactConstraints; + PxArray mStatic1DConstraints; + PxU32 mGPUDirtyFlags; + + + } PX_ALIGN_SUFFIX(64); + +#if PX_VC +#pragma warning(pop) +#endif + + void PxvRegisterArticulationsReducedCoordinate(); + + +} //namespace Dy + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationJointData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationJointData.h new file mode 100644 index 0000000..6d83e5a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationJointData.h @@ -0,0 +1,259 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FEATHERSTONE_ARTICULATION_JOINT_DATA_H +#define DY_FEATHERSTONE_ARTICULATION_JOINT_DATA_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxVecMath.h" +#include "CmUtils.h" +#include "CmSpatialVector.h" +#include "DyVArticulation.h" +#include "DyFeatherstoneArticulationUtils.h" +#include "DyArticulationJointCore.h" +#include + +namespace physx +{ + namespace Dy + { + + + class ArticulationJointCoreData + { + public: + + ArticulationJointCoreData() : jointOffset(0xffffffff), dofInternalConstraintMask(0) + { + } + + + PX_CUDA_CALLABLE PX_FORCE_INLINE void computeMotionMatrix(ArticulationJointCore* joint, + Cm::UnAlignedSpatialVector* motionMatrix, const Cm::UnAlignedSpatialVector* jointAxis) + { + const PxVec3 childOffset = -joint->childPose.p; + + //transpose(Tc)*S = 0 + //transpose(Ta)*S = 1 + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + const Cm::UnAlignedSpatialVector& jJointAxis = jointAxis[0]; + const PxVec3 u = (joint->childPose.rotate(jJointAxis.bottom)).getNormalized(); + + motionMatrix[0] = Cm::UnAlignedSpatialVector(PxVec3(0.f), u); + + PX_ASSERT(dof == 1); + + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const Cm::UnAlignedSpatialVector& jJointAxis = jointAxis[0]; + const PxVec3 u = (joint->childPose.rotate(jJointAxis.top)).getNormalized(); + const PxVec3 uXd = u.cross(childOffset); + + motionMatrix[0] = Cm::UnAlignedSpatialVector(u, uXd); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + + for (PxU32 ind = 0; ind childPose.rotate(jJointAxis.top)).getNormalized(); + + const PxVec3 uXd = u.cross(childOffset); + motionMatrix[ind] = Cm::UnAlignedSpatialVector(u, uXd); + } + + break; + } + case PxArticulationJointType::eFIX: + { + PX_ASSERT(dof == 0); + break; + } + default: + break; + } + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 computeJointDofs(ArticulationJointCore* joint) const + { + PxU8 tDof = 0; + + for (PxU32 i = 0; i < DY_MAX_DOF; ++i) + { + if (joint->motion[i] != PxArticulationMotion::eLOCKED) + { + tDof++; + } + } + + return tDof; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void computeJointAxis(const ArticulationJointCore* joint, Cm::UnAlignedSpatialVector* jointAxis) + { + for (PxU32 i = 0; i < dof; ++i) + { + PxU32 ind = joint->dofIds[i]; + + Cm::UnAlignedSpatialVector axis = Cm::UnAlignedSpatialVector::Zero(); + //axis is in the local space of joint + axis[ind] = 1.f; + + jointAxis[i] = axis; + } + } + + PX_FORCE_INLINE PxU32 computeJointDof(ArticulationJointCore* joint, const bool forceRecompute, + Cm::UnAlignedSpatialVector* jointAxis) + { + if (joint->jointDirtyFlag & ArticulationJointCoreDirtyFlag::eMOTION || forceRecompute) + { + + dof = 0; + limitMask = 0; + + //KS - no need to zero memory here. + //PxMemZero(jointAxis, sizeof(jointAxis)); + + for (PxU8 i = 0; i < DY_MAX_DOF; ++i) + { + if (joint->motion[i] != PxArticulationMotion::eLOCKED) + { + Cm::UnAlignedSpatialVector axis = Cm::UnAlignedSpatialVector::Zero(); + //axis is in the local space of joint + axis[i] = 1.f; + + jointAxis[dof] = axis; + + joint->invDofIds[i] = dof; + joint->dofIds[dof] = i; + + if (joint->motion[i] == PxArticulationMotion::eLIMITED) + limitMask |= 1 << dof; + + dof++; + } + } + } + + return dof; + + } + + PxU32 jointOffset; //4 + //degree of freedom + PxU8 dof; //1 + PxU8 dofInternalConstraintMask; //1 + PxU8 limitMask; //1 + + }; + + + + struct ArticulationJointTargetData + { + PxReal targetJointVelocity[3]; //12 + PxReal targetJointPosition[3]; //24 + PxReal armature[3]; //36 + + + ArticulationJointTargetData() + { + for (PxU32 i = 0; i < 3; ++i) + { + targetJointPosition[i] = 0.f; + targetJointVelocity[i] = 0.f; + armature[i] = 0.f; + } + } + + + + PX_CUDA_CALLABLE PX_FORCE_INLINE void setJointVelocityDrive(ArticulationJointCore* joint, const PxU32 dof) + { + if (joint->jointDirtyFlag & ArticulationJointCoreDirtyFlag::eTARGETVELOCITY) + { + for (PxU32 i = 0; i < dof; ++i) + { + PxU32 ind = joint->dofIds[i]; + + targetJointVelocity[i] = joint->targetV[ind]; + } + + joint->jointDirtyFlag &= ~ArticulationJointCoreDirtyFlag::eTARGETVELOCITY; + } + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void setJointPoseDrive(ArticulationJointCore* joint, const PxU32 dof) + { + if (joint->jointDirtyFlag & ArticulationJointCoreDirtyFlag::eTARGETPOSE) + { + for (PxU32 i = 0; i < dof; ++i) + { + PxU32 ind = joint->dofIds[i]; + + targetJointPosition[i] = joint->targetP[ind]; + } + + joint->jointDirtyFlag &= ~ArticulationJointCoreDirtyFlag::eTARGETPOSE; + } + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void setArmature(ArticulationJointCore* joint, const PxU32 dof) + { + if (joint->jointDirtyFlag & ArticulationJointCoreDirtyFlag::eARMATURE) + { + + for (PxU32 i = 0; i < dof; ++i) + { + PxU32 ind = joint->dofIds[i]; + + armature[i] = joint->armature[ind]; + } + + joint->jointDirtyFlag &= ~ArticulationJointCoreDirtyFlag::eARMATURE; + } + } + + }; + + }//namespace Dy +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationUtils.h new file mode 100644 index 0000000..9ede67c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyFeatherstoneArticulationUtils.h @@ -0,0 +1,1019 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FEATHERSTONE_ARTICULATION_UTIL_H +#define DY_FEATHERSTONE_ARTICULATION_UTIL_H + +#include "foundation/PxVecMath.h" +#include "CmSpatialVector.h" +#include "foundation/PxBitUtils.h" +#include "foundation/PxMemory.h" + +namespace physx +{ + +namespace Dy +{ + static const size_t DY_MAX_DOF = 6; + + struct SpatialSubspaceMatrix + { + static const PxU32 MaxColumns = 3; + public: + +#ifndef __CUDACC__ + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialSubspaceMatrix() :numColumns(0) + { + //PxMemZero(columns, sizeof(Cm::SpatialVectorF) * 6); + PxMemSet(columns, 0, sizeof(Cm::UnAlignedSpatialVector) * MaxColumns); + } +#endif + + PX_CUDA_CALLABLE PX_FORCE_INLINE void setNumColumns(const PxU32 nc) + { + numColumns = nc; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 getNumColumns() const + { + return numColumns; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF transposeMultiply(Cm::SpatialVectorF& v) const + { + PxReal result[6]; + for (PxU32 i = 0; i < numColumns; ++i) + { + const Cm::UnAlignedSpatialVector& row = columns[i]; + result[i] = row.dot(v); + } + + Cm::SpatialVectorF res; + res.top.x = result[0]; res.top.y = result[1]; res.top.z = result[2]; + res.bottom.x = result[3]; res.bottom.y = result[4]; res.bottom.z = result[5]; + + return res; + + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void setColumn(const PxU32 index, const PxVec3& top, const PxVec3& bottom) + { + PX_ASSERT(index < MaxColumns); + columns[index] = Cm::SpatialVectorF(top, bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector& operator[](unsigned int num) + { + PX_ASSERT(num < MaxColumns); + return columns[num]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const Cm::UnAlignedSpatialVector& operator[](unsigned int num) const + { + PX_ASSERT(num < MaxColumns); + return columns[num]; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE const Cm::UnAlignedSpatialVector* getColumns() const + { + return columns; + } + + + //private: + Cm::UnAlignedSpatialVector columns[MaxColumns]; //3x24 = 72 + PxU32 numColumns; //76 + PxU32 padding; //80 + + }; + + //this should be 6x6 matrix + //|R, 0| + //|-R*rX, R| + struct SpatialTransform + { + PxMat33 R; + PxQuat q; + PxMat33 T; + + public: + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialTransform() : R(PxZero), T(PxZero) + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialTransform(const PxMat33& R_, const PxMat33& T_) : R(R_), T(T_) + { + q = PxQuat(R_); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialTransform(const PxQuat& q_, const PxMat33& T_) : q(q_), T(T_) + { + R = PxMat33(q_); + } + + //This assume angular is the top vector and linear is the bottom vector + /*PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVector operator *(const Cm::SpatialVector& s) const + { + const PxVec3 angular = R * s.angular; + const PxVec3 linear = T * s.angular + R * s.linear; + return Cm::SpatialVector(linear, angular); + }*/ + + + ////This assume angular is the top vector and linear is the bottom vector + //PX_FORCE_INLINE Cm::SpatialVectorF operator *(Cm::SpatialVectorF& s) const + //{ + // const PxVec3 top = R * s.top; + // const PxVec3 bottom = T * s.top + R * s.bottom; + + // const PxVec3 top1 = q.rotate(s.top); + // const PxVec3 bottom1 = T * s.top + q.rotate(s.bottom); + + ///* const PxVec3 tDif = (top - top1).abs(); + // const PxVec3 bDif = (bottom - bottom1).abs(); + // const PxReal eps = 0.001f; + // PX_ASSERT(tDif.x < eps && tDif.y < eps && tDif.z < eps); + // PX_ASSERT(bDif.x < eps && bDif.y < eps && bDif.z < eps);*/ + // return Cm::SpatialVectorF(top1, bottom1); + //} + + //This assume angular is the top vector and linear is the bottom vector + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF operator *(const Cm::SpatialVectorF& s) const + { + //const PxVec3 top = R * s.top; + //const PxVec3 bottom = T * s.top + R * s.bottom; + + const PxVec3 top1 = q.rotate(s.top); + const PxVec3 bottom1 = T * s.top + q.rotate(s.bottom); + + return Cm::SpatialVectorF(top1, bottom1); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector operator *(const Cm::UnAlignedSpatialVector& s) const + { + //const PxVec3 top = R * s.top; + //const PxVec3 bottom = T * s.top + R * s.bottom; + + const PxVec3 top1 = q.rotate(s.top); + const PxVec3 bottom1 = T * s.top + q.rotate(s.bottom); + + return Cm::UnAlignedSpatialVector(top1, bottom1); + } + + //transpose is the same as inverse, R(inverse) = R(transpose) + //|R(t), 0 | + //|rXR(t), R(t)| + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialTransform getTranspose() const + { + SpatialTransform ret; + ret.q = q.getConjugate(); + ret.R = R.getTranspose(); + ret.T = T.getTranspose(); + return ret; + + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF transposeTransform(const Cm::SpatialVectorF& s) const + { + const PxVec3 top1 = q.rotateInv(s.top); + const PxVec3 bottom1 = T.transformTranspose(s.top) + q.rotateInv(s.bottom); + + return Cm::SpatialVectorF(top1, bottom1); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector transposeTransform(const Cm::UnAlignedSpatialVector& s) const + { + const PxVec3 top1 = q.rotateInv(s.top); + const PxVec3 bottom1 = T.transformTranspose(s.top) + q.rotateInv(s.bottom); + + return Cm::UnAlignedSpatialVector(top1, bottom1); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator =(SpatialTransform& other) + { + R = other.R; + q = other.q; + T = other.T; + } + + }; + + struct InvStIs + { + PxReal invStIs[3][3]; + }; + + //this should be 6x6 matrix and initialize to + //|0, M| + //|I, 0| + //this should be 6x6 matrix but bottomRight is the transpose of topLeft + //so we can get rid of bottomRight + struct SpatialMatrix + { + PxMat33 topLeft; // intialize to 0 + PxMat33 topRight; // initialize to mass matrix + PxMat33 bottomLeft; // initialize to inertia + PxU32 padding; //4 112 + + public: + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix() + { + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix(PxZERO r) : topLeft(PxZero), topRight(PxZero), + bottomLeft(PxZero) + { + PX_UNUSED(r); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix(const PxMat33& topLeft_, const PxMat33& topRight_, const PxMat33& bottomLeft_) + { + topLeft = topLeft_; + topRight = topRight_; + bottomLeft = bottomLeft_; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 getBottomRight() const + { + return topLeft.getTranspose(); + } + + PX_FORCE_INLINE PX_CUDA_CALLABLE void setZero() + { + topLeft = PxMat33(0.f); + topRight = PxMat33(0.f); + bottomLeft = PxMat33(0.f); + } + + + //This assume angular is the top vector and linear is the bottom vector + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVector operator *(const Cm::SpatialVector& s) const + { + const PxVec3 angular = topLeft * s.angular + topRight * s.linear; + const PxVec3 linear = bottomLeft * s.angular + topLeft.transformTranspose(s.linear); + return Cm::SpatialVector(linear, angular); + } + + //This assume angular is the top vector and linear is the bottom vector + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF operator *(const Cm::SpatialVectorF& s) const + { + const PxVec3 top = topLeft * s.top + topRight * s.bottom; + const PxVec3 bottom = bottomLeft * s.top + topLeft.transformTranspose(s.bottom); + + return Cm::SpatialVectorF(top, bottom); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::UnAlignedSpatialVector operator *(const Cm::UnAlignedSpatialVector& s) const + { + const PxVec3 top = topLeft * s.top + topRight * s.bottom; + const PxVec3 bottom = bottomLeft * s.top + topLeft.transformTranspose(s.bottom); + + return Cm::UnAlignedSpatialVector(top, bottom); + } + + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix operator *(const PxReal& s) const + { + const PxMat33 newTopLeft = topLeft * s; + const PxMat33 newTopRight = topRight * s; + const PxMat33 newBottomLeft = bottomLeft * s; + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix operator -(const SpatialMatrix& s) const + { + const PxMat33 newTopLeft = topLeft - s.topLeft; + const PxMat33 newTopRight = topRight - s.topRight; + const PxMat33 newBottomLeft = bottomLeft - s.bottomLeft; + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix operator +(const SpatialMatrix& s) const + { + const PxMat33 newTopLeft = topLeft + s.topLeft; + const PxMat33 newTopRight = topRight + s.topRight; + const PxMat33 newBottomLeft = bottomLeft + s.bottomLeft; + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix operator-() + { + const PxMat33 newTopLeft = -topLeft; + const PxMat33 newTopRight = -topRight; + const PxMat33 newBottomLeft = -bottomLeft; + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void operator +=(const SpatialMatrix& s) + { + topLeft += s.topLeft; + topRight += s.topRight; + bottomLeft += s.bottomLeft; + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix operator *(const SpatialMatrix& s) + { + const PxMat33 sBottomRight = s.topLeft.getTranspose(); + const PxMat33 bottomRight = topLeft.getTranspose(); + + const PxMat33 newTopLeft = topLeft * s.topLeft + topRight * s.bottomLeft; + const PxMat33 newTopRight = topLeft * s.topRight + topRight * sBottomRight; + const PxMat33 newBottomLeft = bottomLeft * s.topLeft + bottomRight * s.bottomLeft; + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + static SpatialMatrix constructSpatialMatrix(const Cm::SpatialVector& Is, const Cm::SpatialVector& stI) + { + //construct top left + const PxVec3 tLeftC0 = Is.angular * stI.angular.x; + const PxVec3 tLeftC1 = Is.angular * stI.angular.y; + const PxVec3 tLeftC2 = Is.angular * stI.angular.z; + + const PxMat33 topLeft(tLeftC0, tLeftC1, tLeftC2); + + //construct top right + const PxVec3 tRightC0 = Is.angular * stI.linear.x; + const PxVec3 tRightC1 = Is.angular * stI.linear.y; + const PxVec3 tRightC2 = Is.angular * stI.linear.z; + const PxMat33 topRight(tRightC0, tRightC1, tRightC2); + + //construct bottom left + const PxVec3 bLeftC0 = Is.linear * stI.angular.x; + const PxVec3 bLeftC1 = Is.linear * stI.angular.y; + const PxVec3 bLeftC2 = Is.linear * stI.angular.z; + const PxMat33 bottomLeft(bLeftC0, bLeftC1, bLeftC2); + + return SpatialMatrix(topLeft, topRight, bottomLeft); + } + + static PX_CUDA_CALLABLE SpatialMatrix constructSpatialMatrix(const Cm::SpatialVectorF& Is, const Cm::SpatialVectorF& stI) + { + //construct top left + const PxVec3 tLeftC0 = Is.top * stI.top.x; + const PxVec3 tLeftC1 = Is.top * stI.top.y; + const PxVec3 tLeftC2 = Is.top * stI.top.z; + + const PxMat33 topLeft(tLeftC0, tLeftC1, tLeftC2); + + //construct top right + const PxVec3 tRightC0 = Is.top * stI.bottom.x; + const PxVec3 tRightC1 = Is.top * stI.bottom.y; + const PxVec3 tRightC2 = Is.top * stI.bottom.z; + const PxMat33 topRight(tRightC0, tRightC1, tRightC2); + + //construct bottom left + const PxVec3 bLeftC0 = Is.bottom * stI.top.x; + const PxVec3 bLeftC1 = Is.bottom * stI.top.y; + const PxVec3 bLeftC2 = Is.bottom * stI.top.z; + const PxMat33 bottomLeft(bLeftC0, bLeftC1, bLeftC2); + + return SpatialMatrix(topLeft, topRight, bottomLeft); + } + + template + static PX_CUDA_CALLABLE SpatialMatrix constructSpatialMatrix(const SpatialVector* columns) + { + const PxMat33 topLeft(columns[0].top, columns[1].top, columns[2].top); + const PxMat33 bottomLeft(columns[0].bottom, columns[1].bottom, columns[2].bottom); + const PxMat33 topRight(columns[3].top, columns[4].top, columns[5].top); + + return SpatialMatrix(topLeft, topRight, bottomLeft); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix getTranspose() + { + const PxMat33 newTopLeft = topLeft.getTranspose(); + const PxMat33 newTopRight = bottomLeft.getTranspose(); + const PxMat33 newBottomLeft = topRight.getTranspose(); + //const PxMat33 newBottomRight = bottomRight.getTranspose(); + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft);// , newBottomRight); + } + + //static bool isTranspose(const PxMat33& a, const PxMat33& b) + //{ + // PxReal eps = 0.01f; + // //test bottomRight is the transpose of topLeft + // for (PxU32 i = 0; i <3; ++i) + // { + // for (PxU32 j = 0; j <3; ++j) + // { + // if (PxAbs(a[i][j] - b[j][i]) > eps) + // return false; + // } + // } + + // return true; + //} + + PX_FORCE_INLINE bool isIdentity(const PxMat33& matrix) + { + const PxReal eps = 0.00001f; + const float x = PxAbs(1.f - matrix.column0.x); + const float y = PxAbs(1.f - matrix.column1.y); + const float z = PxAbs(1.f - matrix.column2.z); + const bool identity = ((x < eps) && PxAbs(matrix.column0.y - 0.f) < eps && PxAbs(matrix.column0.z - 0.f) < eps) && + (PxAbs(matrix.column1.x - 0.f) < eps && (y < eps) && PxAbs(matrix.column1.z - 0.f) < eps) && + (PxAbs(matrix.column2.x - 0.f) < eps && PxAbs(matrix.column2.y - 0.f) < eps && (z < eps)); + + return identity; + } + + PX_FORCE_INLINE bool isZero(const PxMat33& matrix) + { + const PxReal eps = 0.0001f; + for (PxU32 i = 0; i < 3; ++i) + { + for (PxU32 j = 0; j < 3; ++j) + { + if (PxAbs(matrix[i][j]) > eps) + return false; + } + } + + return true; + } + + PX_FORCE_INLINE bool isIdentity() + { + const bool topLeftIsIdentity = isIdentity(topLeft); + + const bool topRightIsZero = isZero(topRight); + + const bool bottomLeftIsZero = isZero(bottomLeft); + + return topLeftIsIdentity && topRightIsZero && bottomLeftIsZero; + } + + static bool isEqual(const PxMat33& s0, const PxMat33& s1) + { + const PxReal eps = 0.00001f; + for (PxU32 i = 0; i < 3; ++i) + { + for (PxU32 j = 0; j < 3; ++j) + { + const PxReal t = s0[i][j] - s1[i][j]; + if (PxAbs(t) > eps) + return false; + } + } + + return true; + } + + PX_FORCE_INLINE bool isEqual(const SpatialMatrix& s) + { + const bool topLeftEqual = isEqual(topLeft, s.topLeft); + const bool topRightEqual = isEqual(topRight, s.topRight); + const bool bottomLeftEqual = isEqual(bottomLeft, s.bottomLeft); + + return topLeftEqual && topRightEqual && bottomLeftEqual; + } + + static PX_CUDA_CALLABLE PX_FORCE_INLINE PxMat33 invertSym33(const PxMat33& in) + { + const PxVec3 v0 = in[1].cross(in[2]); + const PxVec3 v1 = in[2].cross(in[0]); + const PxVec3 v2 = in[0].cross(in[1]); + + const PxReal det = v0.dot(in[0]); + + if (det != 0) + { + const PxReal recipDet = 1.0f / det; + + return PxMat33(v0 * recipDet, + PxVec3(v0.y, v1.y, v1.z) * recipDet, + PxVec3(v0.z, v1.z, v2.z) * recipDet); + } + else + { + return PxMat33(PxIdentity); + } + } + + static PX_FORCE_INLINE aos::Mat33V invertSym33(const aos::Mat33V& in) + { + using namespace aos; + const Vec3V v0 = V3Cross(in.col1, in.col2); + const Vec3V v1 = V3Cross(in.col2, in.col0); + const Vec3V v2 = V3Cross(in.col0, in.col1); + + const FloatV det = V3Dot(v0, in.col0); + + const FloatV recipDet = FRecip(det); + + if (!FAllEq(det, FZero())) + { + return Mat33V(V3Scale(v0, recipDet), + V3Scale(V3Merge(V3GetY(v0), V3GetY(v1), V3GetZ(v1)), recipDet), + V3Scale(V3Merge(V3GetZ(v0), V3GetZ(v1), V3GetZ(v2)), recipDet)); + } + else + { + return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); + } + + //return M33Inverse(in); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE SpatialMatrix invertInertia() + { + PxMat33 aa = bottomLeft, ll = topRight, la = topLeft; + + aa = (aa + aa.getTranspose())*0.5f; + ll = (ll + ll.getTranspose())*0.5f; + + const PxMat33 AAInv = invertSym33(aa); + + const PxMat33 z = -la * AAInv; + const PxMat33 S = ll + z * la.getTranspose(); // Schur complement of mAA + + const PxMat33 LL = invertSym33(S); + + const PxMat33 LA = LL * z; + const PxMat33 AA = AAInv + z.getTranspose() * LA; + + const SpatialMatrix result(LA.getTranspose(), AA, LL);// , LA); + + return result; + } + + PX_FORCE_INLINE void M33Store(const aos::Mat33V& src, PxMat33& dest) + { + aos::V3StoreU(src.col0, dest.column0); + aos::V3StoreU(src.col1, dest.column1); + aos::V3StoreU(src.col2, dest.column2); + } + + PX_FORCE_INLINE void invertInertiaV(SpatialMatrix& result) + { + using namespace aos; + Mat33V aa = M33Load(bottomLeft), ll = M33Load(topRight), la = M33Load(topLeft); + + aa = M33Scale(M33Add(aa, M33Trnsps(aa)), FHalf()); + ll = M33Scale(M33Add(ll, M33Trnsps(ll)), FHalf()); + + const Mat33V AAInv = invertSym33(aa); + + const Mat33V z = M33MulM33(M33Neg(la), AAInv); + const Mat33V S = M33Add(ll, M33MulM33(z, M33Trnsps(la))); // Schur complement of mAA + + const Mat33V LL = invertSym33(S); + + const Mat33V LA = M33MulM33(LL, z); + const Mat33V AA = M33Add(AAInv, M33MulM33(M33Trnsps(z), LA)); + + M33Store(M33Trnsps(LA), result.topLeft); + M33Store(AA, result.topRight); + M33Store(LL, result.bottomLeft); + } + + SpatialMatrix getInverse() + { + const PxMat33 bottomRight = topLeft.getTranspose(); + + const PxMat33 blInverse = bottomLeft.getInverse(); + const PxMat33 lComp0 = blInverse * (-bottomRight); + const PxMat33 lComp1 = topLeft * lComp0 + topRight; + + //This can be simplified + const PxMat33 newBottomLeft = lComp1.getInverse(); + const PxMat33 newTopLeft = lComp0 * newBottomLeft; + + const PxMat33 trInverse = topRight.getInverse(); + const PxMat33 rComp0 = trInverse * (-topLeft); + const PxMat33 rComp1 = bottomLeft + bottomRight * rComp0; + + const PxMat33 newTopRight = rComp1.getInverse(); + + return SpatialMatrix(newTopLeft, newTopRight, newBottomLeft); + } + + void zero() + { + topLeft = PxMat33(PxZero); + topRight = PxMat33(PxZero); + bottomLeft = PxMat33(PxZero); + } + + }; + + struct SpatialImpulseResponseMatrix + { + Cm::SpatialVectorF rows[6]; + + Cm::SpatialVectorF getResponse(const Cm::SpatialVectorF& impulse) const + { + /*return rows[0] * impulse.top.x + rows[1] * impulse.top.y + rows[2] * impulse.top.z + + rows[3] * impulse.bottom.x + rows[4] * impulse.bottom.y + rows[5] * impulse.bottom.z;*/ + + using namespace aos; + const Cm::SpatialVectorV row0(V3LoadA(&rows[0].top.x), V3LoadA(&rows[0].bottom.x)); + const Cm::SpatialVectorV row1(V3LoadA(&rows[1].top.x), V3LoadA(&rows[1].bottom.x)); + const Cm::SpatialVectorV row2(V3LoadA(&rows[2].top.x), V3LoadA(&rows[2].bottom.x)); + const Cm::SpatialVectorV row3(V3LoadA(&rows[3].top.x), V3LoadA(&rows[3].bottom.x)); + const Cm::SpatialVectorV row4(V3LoadA(&rows[4].top.x), V3LoadA(&rows[4].bottom.x)); + const Cm::SpatialVectorV row5(V3LoadA(&rows[5].top.x), V3LoadA(&rows[5].bottom.x)); + + const Vec4V top = V4LoadA(&impulse.top.x); + const Vec4V bottom = V4LoadA(&impulse.bottom.x); + + const FloatV ix = V4GetX(top); + const FloatV iy = V4GetY(top); + const FloatV iz = V4GetZ(top); + const FloatV ia = V4GetX(bottom); + const FloatV ib = V4GetY(bottom); + const FloatV ic = V4GetZ(bottom); + + Cm::SpatialVectorV res = row0 * ix + row1 * iy + row2 * iz + row3 * ia + row4 * ib + row5 * ic; + + Cm::SpatialVectorF returnVal; + V4StoreA(Vec4V_From_Vec3V(res.linear), &returnVal.top.x); + V4StoreA(Vec4V_From_Vec3V(res.angular), &returnVal.bottom.x); + + return returnVal; + + } + + Cm::SpatialVectorV getResponse(const Cm::SpatialVectorV& impulse) const + { + using namespace aos; + const Cm::SpatialVectorV row0(V3LoadA(&rows[0].top.x), V3LoadA(&rows[0].bottom.x)); + const Cm::SpatialVectorV row1(V3LoadA(&rows[1].top.x), V3LoadA(&rows[1].bottom.x)); + const Cm::SpatialVectorV row2(V3LoadA(&rows[2].top.x), V3LoadA(&rows[2].bottom.x)); + const Cm::SpatialVectorV row3(V3LoadA(&rows[3].top.x), V3LoadA(&rows[3].bottom.x)); + const Cm::SpatialVectorV row4(V3LoadA(&rows[4].top.x), V3LoadA(&rows[4].bottom.x)); + const Cm::SpatialVectorV row5(V3LoadA(&rows[5].top.x), V3LoadA(&rows[5].bottom.x)); + + const Vec3V top = impulse.linear; + const Vec3V bottom = impulse.angular; + + const FloatV ix = V3GetX(top); + const FloatV iy = V3GetY(top); + const FloatV iz = V3GetZ(top); + const FloatV ia = V3GetX(bottom); + const FloatV ib = V3GetY(bottom); + const FloatV ic = V3GetZ(bottom); + + Cm::SpatialVectorV res = row0 * ix + row1 * iy + row2 * iz + row3 * ia + row4 * ib + row5 * ic; + return res; + } + }; + + struct Temp6x6Matrix; + + struct Temp6x3Matrix + { + PxReal column[3][6]; + public: + + Temp6x3Matrix() + { + + } + + Temp6x3Matrix(const Cm::SpatialVectorF* spatialAxis) + { + constructColumn(column[0], spatialAxis[0]); + constructColumn(column[1], spatialAxis[1]); + constructColumn(column[2], spatialAxis[2]); + } + + void constructColumn(PxReal* dest, const Cm::SpatialVectorF& v) + { + dest[0] = v.top.x; + dest[1] = v.top.y; + dest[2] = v.top.z; + + dest[3] = v.bottom.x; + dest[4] = v.bottom.y; + dest[5] = v.bottom.z; + } + + Temp6x6Matrix operator * (PxReal s[6][3]); + + ////s is 3x6 matrix + //PX_FORCE_INLINE Temp6x6Matrix operator * (PxReal s[6][3]) + //{ + // Temp6x6Matrix temp; + + // for (PxU32 i = 0; i < 6; ++i) + // { + // PxReal* tc = temp.column[i]; + + // for (PxU32 j = 0; j < 6; ++j) + // { + // tc[j] = 0.f; + // for (PxU32 k = 0; k < 3; ++k) + // { + // tc[j] += column[k][j] * s[i][k]; + // } + // } + // } + + // return temp; + //} + + PX_FORCE_INLINE Temp6x3Matrix operator * (const PxMat33& s) + { + Temp6x3Matrix temp; + + for (PxU32 i = 0; i < 3; ++i) + { + PxReal* tc = temp.column[i]; + const PxVec3 sc = s[i]; + + for (PxU32 j = 0; j < 6; ++j) + { + tc[j] = 0.f; + for (PxU32 k = 0; k < 3; ++k) + { + tc[j] += column[k][j] * sc[k]; + } + } + } + + return temp; + } + + PX_FORCE_INLINE bool isColumnEqual(const PxU32 ind, const Cm::SpatialVectorF& col) + { + PxReal temp[6]; + constructColumn(temp, col); + const PxReal eps = 0.00001f; + for (PxU32 i = 0; i < 6; ++i) + { + const PxReal dif = column[ind][i] - temp[i]; + if (PxAbs(dif) > eps) + return false; + } + return true; + } + + }; + + + struct Temp6x6Matrix + { + PxReal column[6][6]; + public: + Temp6x6Matrix() + { + + } + + Temp6x6Matrix(const SpatialMatrix& spatialMatrix) + { + constructColumn(column[0], spatialMatrix.topLeft.column0, spatialMatrix.bottomLeft.column0); + constructColumn(column[1], spatialMatrix.topLeft.column1, spatialMatrix.bottomLeft.column1); + constructColumn(column[2], spatialMatrix.topLeft.column2, spatialMatrix.bottomLeft.column2); + + const PxMat33 bottomRight = spatialMatrix.getBottomRight(); + constructColumn(column[3], spatialMatrix.topRight.column0, bottomRight.column0); + constructColumn(column[4], spatialMatrix.topRight.column1, bottomRight.column1); + constructColumn(column[5], spatialMatrix.topRight.column2, bottomRight.column2); + } + + void constructColumn(const PxU32 ind, const PxReal* const values) + { + for (PxU32 i = 0; i < 6; ++i) + { + column[ind][i] = values[i]; + } + } + + void constructColumn(PxReal* dest, const PxVec3& top, const PxVec3& bottom) + { + dest[0] = top.x; + dest[1] = top.y; + dest[2] = top.z; + + dest[3] = bottom.x; + dest[4] = bottom.y; + dest[5] = bottom.z; + } + + Temp6x6Matrix getTranspose() const + { + Temp6x6Matrix temp; + for (PxU32 i = 0; i < 6; ++i) + { + for (PxU32 j = 0; j < 6; ++j) + { + temp.column[i][j] = column[j][i]; + } + } + return temp; + } + + PX_FORCE_INLINE Cm::SpatialVector operator * (const Cm::SpatialVector& s) const + { + Temp6x6Matrix tempMatrix = getTranspose(); + PxReal st[6]; + st[0] = s.angular.x; st[1] = s.angular.y; st[2] = s.angular.z; + st[3] = s.linear.x; st[4] = s.linear.y; st[5] = s.linear.z; + + PxReal result[6]; + for (PxU32 i = 0; i < 6; i++) + { + result[i] = 0; + for (PxU32 j = 0; j < 6; ++j) + { + result[i] += tempMatrix.column[i][j] * st[j]; + } + } + + + Cm::SpatialVector temp; + temp.angular.x = result[0]; temp.angular.y = result[1]; temp.angular.z = result[2]; + temp.linear.x = result[3]; temp.linear.y = result[4]; temp.linear.z = result[5]; + return temp; + } + + + PX_FORCE_INLINE Cm::SpatialVectorF operator * (const Cm::SpatialVectorF& s) const + { + PxReal st[6]; + st[0] = s.top.x; st[1] = s.top.y; st[2] = s.top.z; + st[3] = s.bottom.x; st[4] = s.bottom.y; st[5] = s.bottom.z; + + PxReal result[6]; + for (PxU32 i = 0; i < 6; ++i) + { + result[i] = 0.f; + for (PxU32 j = 0; j < 6; ++j) + { + result[i] += column[j][i] * st[j]; + } + } + + Cm::SpatialVectorF temp; + temp.top.x = result[0]; temp.top.y = result[1]; temp.top.z = result[2]; + temp.bottom.x = result[3]; temp.bottom.y = result[4]; temp.bottom.z = result[5]; + return temp; + } + + PX_FORCE_INLINE Temp6x3Matrix operator * (const Temp6x3Matrix& s) const + { + Temp6x3Matrix temp; + for (PxU32 i = 0; i < 3; ++i) + { + PxReal* result = temp.column[i]; + + const PxReal* input = s.column[i]; + + for (PxU32 j = 0; j < 6; ++j) + { + result[j] = 0.f; + for (PxU32 k = 0; k < 6; ++k) + { + result[j] += column[k][j] * input[k]; + } + } + } + + return temp; + + } + + PX_FORCE_INLINE Cm::SpatialVector spatialVectorMul(const Cm::SpatialVector& s) + { + PxReal st[6]; + st[0] = s.angular.x; st[1] = s.angular.y; st[2] = s.angular.z; + st[3] = s.linear.x; st[4] = s.linear.y; st[5] = s.linear.z; + + PxReal result[6]; + for (PxU32 i = 0; i < 6; ++i) + { + result[i] = 0.f; + for (PxU32 j = 0; j < 6; j++) + { + result[i] += column[i][j] * st[j]; + } + } + + Cm::SpatialVector temp; + temp.angular.x = result[0]; temp.angular.y = result[1]; temp.angular.z = result[2]; + temp.linear.x = result[3]; temp.linear.y = result[4]; temp.linear.z = result[5]; + return temp; + } + + PX_FORCE_INLINE bool isEqual(const Cm::SpatialVectorF* m) + { + PxReal temp[6]; + const PxReal eps = 0.00001f; + for (PxU32 i = 0; i < 6; ++i) + { + temp[0] = m[i].top.x; temp[1] = m[i].top.y; temp[2] = m[i].top.z; + temp[3] = m[i].bottom.x; temp[4] = m[i].bottom.y; temp[5] = m[i].bottom.z; + + for (PxU32 j = 0; j < 6; ++j) + { + const PxReal dif = column[i][j] - temp[j]; + if (PxAbs(dif) > eps) + return false; + } + } + + return true; + } + }; + + //s is 3x6 matrix + PX_FORCE_INLINE Temp6x6Matrix Temp6x3Matrix::operator * (PxReal s[6][3]) + { + Temp6x6Matrix temp; + + for (PxU32 i = 0; i < 6; ++i) + { + PxReal* tc = temp.column[i]; + + for (PxU32 j = 0; j < 6; ++j) + { + tc[j] = 0.f; + for (PxU32 k = 0; k < 3; ++k) + { + tc[j] += column[k][j] * s[i][k]; + } + } + } + + return temp; + } + + PX_FORCE_INLINE void calculateNewVelocity(const PxTransform& newTransform, const PxTransform& oldTransform, + const PxReal dt, PxVec3& linear, PxVec3& angular) + { + //calculate the new velocity + linear = (newTransform.p - oldTransform.p) / dt; + PxQuat quat = newTransform.q * oldTransform.q.getConjugate(); + + if (quat.w < 0) //shortest angle. + quat = -quat; + + PxReal angle; + PxVec3 axis; + quat.toRadiansAndUnitAxis(angle, axis); + angular = (axis * angle) / dt; + } + + + // generates a pair of quaternions (swing, twist) such that in = swing * twist, with + // swing.x = 0 + // twist.y = twist.z = 0, and twist is a unit quat + PX_CUDA_CALLABLE PX_FORCE_INLINE void separateSwingTwist(const PxQuat& q, PxQuat& twist, PxQuat& swing1, PxQuat& swing2) + { + twist = q.x != 0.0f ? PxQuat(q.x, 0, 0, q.w).getNormalized() : PxQuat(PxIdentity); + PxQuat swing = q * twist.getConjugate(); + swing1 = swing.y != 0.f ? PxQuat(0.f, swing.y, 0.f, swing.w).getNormalized() : PxQuat(PxIdentity); + swing = swing * swing1.getConjugate(); + swing2 = swing.z != 0.f ? PxQuat(0.f, 0.f, swing.z, swing.w).getNormalized() : PxQuat(PxIdentity); + } + + PX_CUDA_CALLABLE PX_FORCE_INLINE void separateSwingTwist2(const PxQuat& q, PxQuat& twist, PxQuat& swing1, PxQuat& swing2) + { + swing2 = q.z != 0.0f ? PxQuat(0.f, 0.f, q.z, q.w).getNormalized() : PxQuat(PxIdentity); + PxQuat swing = q * swing2.getConjugate(); + swing1 = swing.y != 0.f ? PxQuat(0.f, swing.y, 0.f, swing.w).getNormalized() : PxQuat(PxIdentity); + swing = swing * swing1.getConjugate(); + twist = swing.x != 0.f ? PxQuat(swing.x, 0.f, 0.f, swing.w).getNormalized() : PxQuat(PxIdentity); + } + + +} //namespace Dy + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystem.h new file mode 100644 index 0000000..601c6af --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystem.h @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_HAIR_SYSTEM_H +#define DY_HAIR_SYSTEM_H + +#include "DyHairSystemCore.h" +#include "PxvGeometry.h" + +namespace physx +{ + namespace Sc + { + class HairSystemSim; + } + + namespace Dy + { + typedef size_t HairSystemHandle; + + // forward-declarations + class Context; + class HairSystem; + + struct HairSystemDirtyFlag + { + enum Enum + { + // Changes are processed from highest (most fundamental) to lowest to ensure correct dependencies + eNONE = 0, //!> default, everything up-to-date + ePARAMETERS = 1 << 0, //!> Parameters were changed + eGRID_SIZE = 1 << 1 | ePARAMETERS, //!> Grid size was changed. sets ePARAMETERS because settings are stored there + eATTACHMENT = 1 << 2, //!> Attachment was changed + ePOSITIONS_VELOCITIES_MASS = 1 << 3, //!> Positions, velocities or masses changed + eREST_POSITION_TRANSFORM = 1 << 4, //!> Transform of the rest positions changed + eLOD_SWITCH = 1 << 5, //!> Level of detail was changed, update lodX pos/vel from lod0 + eLOD_DATA = 1 << 6 | eLOD_SWITCH, //!> Definition of detail levels changed . Must come after setting any kind of rest positions. Triggers one-off initialization of levels + eBENDING_REST_ANGLES = 1 << 7 | eLOD_DATA, //!> Bending rest angles were changed + eTWISTING_REST_POSITIONS = 1 << 8 | eLOD_DATA, //!> Twisting rest positions were changed + eREST_POSITIONS = 1 << 9 | eLOD_DATA, //!> Rest (=skinned) positions changed + eSHAPE_MATCHING_SIZES = 1 << 10 | ePARAMETERS | eLOD_DATA, //!> Shape matching group size or overlap changed. sets ePARAMETERS because settings are stored there + eSTRAND_LENGTHS = 1 << 11 | eLOD_DATA | eSHAPE_MATCHING_SIZES | eBENDING_REST_ANGLES | eTWISTING_REST_POSITIONS, //!> Topology of vertex arrangement was changed + eNUM_STRANDS_OR_VERTS = 1 << 12 | eSHAPE_MATCHING_SIZES + | ePOSITIONS_VELOCITIES_MASS | eBENDING_REST_ANGLES | eTWISTING_REST_POSITIONS + | eREST_POSITIONS | eLOD_DATA | eSTRAND_LENGTHS, //!> Number of strands or vertices changed + + eALL = (1 << 13) - 1 //!> everything needs updating + }; + }; + + + struct HairSystemSolverDesc + { + HairSystem* hairSystem; + }; + + class HairSystem + { + PX_NOCOPY(HairSystem) + public: + HairSystem(Sc::HairSystemSim* sim, Dy::HairSystemCore& core) : + mSim(sim) + , mCore(core) + , mShapeCore(NULL) + , mElementId(0xffFFffFF) + , mGpuRemapId(0xffFFffFF) + + { + mCore.mDirtyFlags = HairSystemDirtyFlag::eALL; + } + + ~HairSystem() {} + + PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore) + { + mShapeCore = shapeCore; + } + + PX_FORCE_INLINE PxU32 getGpuRemapId() const { return mGpuRemapId; } + PX_FORCE_INLINE void setGpuRemapId(PxU32 remapId) + { + mGpuRemapId = remapId; + PxHairSystemGeometryLL& geom = mShapeCore->mGeometry.get(); + geom.gpuRemapId = remapId; + } + + PX_FORCE_INLINE PxU32 getElementId() const { return mElementId; } + PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; } + + + PX_FORCE_INLINE Sc::HairSystemSim* getHairSystemSim() const { return mSim; } + + PX_FORCE_INLINE const HairSystemCore& getCore() const { return mCore; } + PX_FORCE_INLINE HairSystemCore& getCore() { return mCore; } + PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; } + + PX_FORCE_INLINE PxU16 getIterationCounts() { return mCore.mSolverIterationCounts; } + + private: // variables + Sc::HairSystemSim* mSim; + HairSystemCore& mCore; + PxsShapeCore* mShapeCore; + PxU32 mElementId; //this is used for the bound array + PxU32 mGpuRemapId; + }; + + + PX_FORCE_INLINE HairSystem* getHairSystem(HairSystemHandle handle) + { + return reinterpret_cast(handle); + } + + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystemCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystemCore.h new file mode 100644 index 0000000..a2cea2d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyHairSystemCore.h @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_HAIR_SYSTEM_CORE_H +#define DY_HAIR_SYSTEM_CORE_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxArray.h" +#include "foundation/PxVec4.h" +#include "foundation/PxVec2.h" +#include "PxHairSystemFlag.h" +#include "PxAttachment.h" + +namespace physx +{ + struct PxsBodyCore; + + namespace Dy + { + // These parameters are needed on GPU for simulation and are grouped in a struct + // to reduce the number of assignments in update user data. + struct HairSystemSimParameters + { + PX_CUDA_CALLABLE PX_FORCE_INLINE PxReal getCellSize() const { return mSegmentLength + 2.0f * mSegmentRadius; } + PX_CUDA_CALLABLE PX_FORCE_INLINE int getGridSize() const { return mGridSize[0] * mGridSize[1] * mGridSize[2]; } + PxHairSystemFlags::InternalType mFlags; + PxReal mSegmentLength; + PxReal mSegmentRadius; + PxReal mInterHairRepulsion; // strength of the repulsion field + PxReal mInterHairVelocityDamping; // friction based on interpolated vel field + PxReal mFrictionCoeff; // coulomb friction coefficient for collisions (internal and external) + PxReal mBendingCompliance; + PxReal mTwistingCompliance; + int mGridSize[3]; // number of cells in x,y,z directions + PxVec2 mShapeCompliance; // compliance for shape matching + PxReal mSelfCollisionContactDist; // contact distance for self collisions expressed as a multiple of the segment radius + PxReal mSelfCollisionRelaxation; + PxReal mLraRelaxation; + PxReal mShapeMatchingCompliance; + PxReal mShapeMatchingBeta; // balance between rigid rotation and linear stretching + PxU16 mShapeMatchingNumVertsPerGroup; + PxU16 mShapeMatchingNumVertsOverlap; + }; + + // The struct's defaults are defined in the Sc::HairSystemShapeCore constructor + struct HairSystemCore + { + public: + PxU32 mDirtyFlags; + PxHairSystemDataFlags mReadRequests; + + PxU32 mNumVertices; + PxU32 mNumStrands; + + // Parameters + HairSystemSimParameters mParams; + PxReal mSleepThreshold; + PxReal mWakeCounter; + PxU16 mSolverIterationCounts; + PxVec4 mWind; + + // Topology data + const PxU32* mStrandPastEndIndices; + const PxReal* mBendingRestAngles; + + PxArray mMaterialhandles; + + // Buffers for simulation (device or pinned host mirrors) + PxVec4* mPositionInvMass; + PxVec4* mVelocity; + + // pointers to PxgHairSystemCore buffers that are exposed to the user + PxU32* mStrandPastEndIndicesGpuSim; + PxVec4* mPositionInvMassGpuSim; + PxReal* mTwistingRestPositionsGpuSim; + + // rest positions + PxVec4* mRestPositions; // Gpu buffer + PxTransform* mRestPositionsTransform; + PxU64 mRestPositionBodyNodeIdx; + + // Attachments + PxParticleRigidAttachment* mRigidAttachments; // Gpu buffer + PxU32 mNumRigidAttachments; + + // LOD data + PxU32 mLodLevel; // the selected level, zero by default meaning full detail + PxU32 mLodNumLevels; // number of levels excluding level zero + const PxReal* mLodProportionOfStrands; + const PxReal* mLodProportionOfVertices; + + + void setMaterial(PxU16 materialhandle) + { + mMaterialhandles.pushBack(materialhandle); + } + + void clearMaterials() { mMaterialhandles.clear(); } + }; + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystem.h new file mode 100644 index 0000000..2747281 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystem.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef PXD_PARTICLESYSTEM_H +#define PXD_PARTICLESYSTEM_H + +#include "foundation/PxSimpleTypes.h" +#include "DyParticleSystemCore.h" +#include "PxvGeometry.h" + +#define MAX_SPARSEGRID_DIM 1024 +#define MIN_SPARSEGRID_ID -512 +#define MAX_SPARSEGRID_ID 511 + +namespace physx +{ + namespace Sc + { + class ParticleSystemSim; + } + + + namespace Dy + { + typedef size_t ParticleSystemHandle; + + class ParticleSystemCore; + + struct ParticleSystemFlag + { + enum Enum + { + eUPDATE_PARAMS = 1 << 1, + eUPDATE_MATERIAL = 1 << 2, + eUPDATE_PHASE = 1 << 3, + eUPDATE_ACTIVE_PARTICLECOUNT = 1 << 4 + }; + }; + + + class ParticleSystem + { + PX_NOCOPY(ParticleSystem) + public: + + ParticleSystem(Dy::ParticleSystemCore& core) : mCore(core), mShapeCore(NULL), + mElementId(0xffffffff), mGpuRemapId(0xffffffff) + { + mFlag = 0; + } + + ~ParticleSystem() {} + + PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore) + { + mShapeCore = shapeCore; + } + + PX_FORCE_INLINE void setGpuRemapId(const PxU32 remapId) + { + mGpuRemapId = remapId; + PxParticleSystemGeometryLL& geom = mShapeCore->mGeometry.get(); + geom.materialsLL.gpuRemapId = remapId; + } + + PX_FORCE_INLINE PxU32 getGpuRemapId() const { return mGpuRemapId; } + + PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; } + PX_FORCE_INLINE PxU32 getElementId() { return mElementId; } + + PX_FORCE_INLINE ParticleSystemCore& getCore() const { return mCore; } + PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; } + + PX_FORCE_INLINE PxU16 getIterationCounts() { return mCore.solverIterationCounts; } + + PxU32 mFlag; + + private: + ParticleSystemCore& mCore; + PxsShapeCore* mShapeCore; + PxU32 mElementId; //this is used for the bound array + PxU32 mGpuRemapId; + + }; + + struct ParticleSystemSolverDesc + { + ParticleSystem* particleSystem; + }; + + PX_FORCE_INLINE ParticleSystem* getParticleSystem(ParticleSystemHandle handle) + { + return reinterpret_cast(handle); + } + + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystemCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystemCore.h new file mode 100644 index 0000000..c9a00b3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyParticleSystemCore.h @@ -0,0 +1,278 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_PARTICLESYSTEM_CORE_H +#define DY_PARTICLESYSTEM_CORE_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" +#include "foundation/PxArray.h" +#include "foundation/PxMemory.h" +#include "PxParticleSystem.h" +#include "PxParticleBuffer.h" +#include "CmIDPool.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFLIPParticleSystem.h" +#include "PxMPMParticleSystem.h" +#endif +#include "PxParticleSolverType.h" +#include "PxCustomParticleSystemSolverCallback.h" +#include "PxSparseGridParams.h" + +namespace physx +{ +namespace Dy +{ + +class ParticleSystemCore +{ +public: + + PxReal sleepThreshold; + PxReal freezeThreshold; + PxReal wakeCounter; + + PxU32 gridSizeX; + PxU32 gridSizeY; + PxU32 gridSizeZ; + + PxParticleSolverType::Enum solverType; + + bool enableCCD; + + PxU16 solverIterationCounts; + + PxSparseGridParams sparseGridParams; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxFLIPParams flipParams; + PxMPMParams mpmParams; +#endif + + PxReal restOffset; + PxReal particleContactOffset; + PxReal particleContactOffset_prev; + PxReal solidRestOffset; + PxReal fluidRestOffset; + PxReal fluidRestOffset_prev; + + PxReal fluidBoundaryDensityScale; + + PxReal maxDepenetrationVelocity; + PxReal maxVelocity; + + PxVec3 periodicBoundary; + + PxParticleFlags mFlags; + + PxVec3 mWind; + + PxU32 mMaxNeighborhood; + + PxArray mPhaseGroupToMaterialHandle; + + void addParticleBuffer(PxParticleBuffer* particleBuffer) + { + if (particleBuffer->bufferIndex == 0xffffffff) + { + switch (particleBuffer->getConcreteType()) + { + case (PxConcreteType::ePARTICLE_BUFFER): + { + particleBuffer->bufferIndex = mParticleBuffers.size(); + mParticleBuffers.pushBack(particleBuffer); + mParticleBufferUpdate = true; + particleBuffer->setInternalData(this); + return; + } + + case (PxConcreteType::ePARTICLE_DIFFUSE_BUFFER): + { + particleBuffer->bufferIndex = mParticleAndDiffuseBuffers.size(); + mParticleAndDiffuseBuffers.pushBack(reinterpret_cast(particleBuffer)); + mParticleAndDiffuseBufferUpdate = true; + particleBuffer->setInternalData(this); + return; + } + + case (PxConcreteType::ePARTICLE_CLOTH_BUFFER): + { + particleBuffer->bufferIndex = mClothBuffers.size(); + mClothBuffers.pushBack(reinterpret_cast(particleBuffer)); + mClothBufferUpdate = true; + particleBuffer->setInternalData(this); + return; + } + + case (PxConcreteType::ePARTICLE_RIGID_BUFFER): + { + particleBuffer->bufferIndex = mRigidBuffers.size(); + mRigidBuffers.pushBack(reinterpret_cast(particleBuffer)); + mRigidBufferUpdate = true; + particleBuffer->setInternalData(this); + return; + } + + default: + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "addParticleBuffer : Error, this buffer does not have a valid type!"); + return; + } + + } + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "addParticleBuffer : Error, this buffer cannot be added to multiple particle systems!"); + } + } + + void removeParticleBuffer(PxParticleBuffer* particleBuffer) + { + const PxU32 index = particleBuffer->bufferIndex; + + switch (particleBuffer->getConcreteType()) + { + case (PxConcreteType::ePARTICLE_BUFFER): + { + if (index < mParticleBuffers.size()) + { + mParticleBuffers.replaceWithLast(particleBuffer->bufferIndex); + if (mParticleBuffers.size() > index) + mParticleBuffers[index]->bufferIndex = index; + mParticleBufferUpdate = true; + particleBuffer->bufferIndex = 0xffffffff; + particleBuffer->onParticleSystemDestroy(); + } + return; + } + + case (PxConcreteType::ePARTICLE_DIFFUSE_BUFFER): + { + if (index < mParticleAndDiffuseBuffers.size()) + { + mParticleAndDiffuseBuffers.replaceWithLast(particleBuffer->bufferIndex); + if (mParticleAndDiffuseBuffers.size() > index) + mParticleAndDiffuseBuffers[index]->bufferIndex = index; + + mParticleAndDiffuseBufferUpdate = true; + particleBuffer->bufferIndex = 0xffffffff; + particleBuffer->onParticleSystemDestroy(); + } + return; + } + + case (PxConcreteType::ePARTICLE_CLOTH_BUFFER): + { + if (index < mClothBuffers.size()) + { + mClothBuffers.replaceWithLast(particleBuffer->bufferIndex); + if (mClothBuffers.size() > index) + mClothBuffers[index]->bufferIndex = index; + mClothBufferUpdate = true; + particleBuffer->bufferIndex = 0xffffffff; + particleBuffer->onParticleSystemDestroy(); + } + return; + } + + case (PxConcreteType::ePARTICLE_RIGID_BUFFER): + { + if (index < mParticleBuffers.size()) + { + mRigidBuffers.replaceWithLast(particleBuffer->bufferIndex); + if (mRigidBuffers.size() > index) + mRigidBuffers[index]->bufferIndex = index; + + mRigidBufferUpdate = true; + particleBuffer->bufferIndex = 0xffffffff; + particleBuffer->onParticleSystemDestroy(); + } + return; + } + + default: + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "removeParticleBuffer : Error, this buffer does not have a valid type!"); + return; + } + + } + } + + PxU32 getNumUserBuffers() const { return mParticleBuffers.size() + mClothBuffers.size() + mRigidBuffers.size() + mParticleAndDiffuseBuffers.size(); } + //device + PxArray mParticleBuffers; + PxArray mClothBuffers; + PxArray mRigidBuffers; + PxArray mParticleAndDiffuseBuffers; + + bool mParticleBufferUpdate; + bool mClothBufferUpdate; + bool mRigidBufferUpdate; + bool mParticleAndDiffuseBufferUpdate; + + PxParticleSystemCallback* mCallback; + PxCustomParticleSystemSolverCallback* mSolverCallback; + + ParticleSystemCore() + { + PxMemSet(this, 0, sizeof(*this)); + mParticleBufferUpdate = false; + mClothBufferUpdate = false; + mRigidBufferUpdate = false; + mParticleAndDiffuseBufferUpdate = false; + } + + ~ParticleSystemCore() + { + for(PxU32 i = 0; i < mParticleBuffers.size(); ++i) + { + mParticleBuffers[i]->onParticleSystemDestroy(); + } + + for (PxU32 i = 0; i < mClothBuffers.size(); ++i) + { + mClothBuffers[i]->onParticleSystemDestroy(); + } + + for (PxU32 i = 0; i < mRigidBuffers.size(); ++i) + { + mRigidBuffers[i]->onParticleSystemDestroy(); + } + + for (PxU32 i = 0; i < mParticleAndDiffuseBuffers.size(); ++i) + { + mParticleAndDiffuseBuffers[i]->onParticleSystemDestroy(); + } + } +}; + +} // namespace Dy +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySleepingConfigulation.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySleepingConfigulation.h new file mode 100644 index 0000000..9b136a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySleepingConfigulation.h @@ -0,0 +1,40 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SLEEPING_CONFIGURATION_H +#define DY_SLEEPING_CONFIGURATION_H + +#define PXD_FREEZE_INTERVAL 1.5f +#define PXD_FREE_EXIT_THRESHOLD 4.f +#define PXD_FREEZE_TOLERANCE 0.25f + +#define PXD_SLEEP_DAMPING 0.5f +#define PXD_ACCEL_LOSS 0.9f +#define PXD_FREEZE_SCALE 0.1f + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBody.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBody.h new file mode 100644 index 0000000..63ed917 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBody.h @@ -0,0 +1,166 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_SOFTBODY_H +#define DY_SOFTBODY_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxPinnedArray.h" +#include "DySoftBodyCore.h" +#include "PxvGeometry.h" + +namespace physx +{ + namespace Sc + { + class SoftBodySim; + } + + namespace Dy + { + + typedef size_t SoftBodyHandle; + + struct SoftBodyCore; + + typedef PxPinnedArray SoftBodyFilterArray; + + class SoftBody + { + PX_NOCOPY(SoftBody) + public: + SoftBody(Sc::SoftBodySim* sim, Dy::SoftBodyCore& core) : + mSoftBodySoftBodyFilterPairs(NULL), mSim(sim), mCore(core), mElementId(0xffffffff), mGpuRemapId(0xffffffff) + { + mFilterDirty = false; + mFilterInDirtyList = false; + mDirtySoftBodyForFilterPairs = NULL; + mSoftBodySoftBodyFilterPairs = NULL; + } + + ~SoftBody() + { + if (mDirtySoftBodyForFilterPairs) + { + Dy::SoftBody** dirtySoftBodies = mDirtySoftBodyForFilterPairs->begin(); + + const PxU32 size = mDirtySoftBodyForFilterPairs->size(); + + for (PxU32 i = 0; i < size; ++i) + { + if (dirtySoftBodies[i] == this) + { + dirtySoftBodies[i] = NULL; + } + } + + if (mSoftBodySoftBodyFilterPairs) + PX_FREE(mSoftBodySoftBodyFilterPairs); + } + } + + PX_FORCE_INLINE PxReal getMaxPenetrationBias() const { return mCore.maxPenBias; } + + PX_FORCE_INLINE Sc::SoftBodySim* getSoftBodySim() const { return mSim; } + + PX_FORCE_INLINE void setGpuRemapId(const PxU32 remapId) + { + mGpuRemapId = remapId; + PxTetrahedronMeshGeometryLL& geom = mShapeCore->mGeometry.get(); + geom.materialsLL.gpuRemapId = remapId; + } + + PX_FORCE_INLINE PxU32 getGpuRemapId() { return mGpuRemapId; } + + PX_FORCE_INLINE void setElementId(const PxU32 elementId) { mElementId = elementId; } + PX_FORCE_INLINE PxU32 getElementId() { return mElementId; } + + PX_FORCE_INLINE PxsShapeCore& getShapeCore() { return *mShapeCore; } + PX_FORCE_INLINE void setShapeCore(PxsShapeCore* shapeCore) { mShapeCore = shapeCore; } + + PX_FORCE_INLINE void setSimShapeCore(PxTetrahedronMesh* simulationMesh, PxSoftBodyAuxData* simulationState) + { + mSimulationMesh = simulationMesh; + mSoftBodyAuxData = simulationState; + } + + PX_FORCE_INLINE const PxTetrahedronMesh* getCollisionMesh() const { return mShapeCore->mGeometry.get().tetrahedronMesh; } + PX_FORCE_INLINE PxTetrahedronMesh* getCollisionMesh() { return mShapeCore->mGeometry.get().tetrahedronMesh; } + + PX_FORCE_INLINE const PxTetrahedronMesh* getSimulationMesh() const { return mSimulationMesh; } + PX_FORCE_INLINE PxTetrahedronMesh* getSimulationMesh() { return mSimulationMesh; } + + PX_FORCE_INLINE const PxSoftBodyAuxData* getSoftBodyAuxData() const { return mSoftBodyAuxData; } + PX_FORCE_INLINE PxSoftBodyAuxData* getSoftBodyAuxData() { return mSoftBodyAuxData; } + + + PX_FORCE_INLINE const SoftBodyCore& getCore() const { return mCore; } + PX_FORCE_INLINE SoftBodyCore& getCore() { return mCore; } + + PX_FORCE_INLINE PxU16 getIterationCounts() { return mCore.solverIterationCounts; } + + PX_FORCE_INLINE PxU32 getGpuSoftBodyIndex() { return mGpuRemapId; } + + //These variables are used in the constraint partition + PxU16 maxSolverFrictionProgress; + PxU16 maxSolverNormalProgress; + PxU32 solverProgress; + PxU8 numTotalConstraints; + + PxArray mParticleSoftBodyAttachments; + PxArray mRigidSoftBodyAttachments; + PxArray mClothSoftBodyAttachments; + PxArray mSoftSoftBodyAttachments; + + SoftBodyFilterArray* mSoftBodySoftBodyFilterPairs; + PxArray * mDirtySoftBodyForFilterPairs; //pointer to the array of mDirtySoftBodyForFilterPairs in PxgSimulationController.cpp + + PxArray mSoftBodyClothAttachmentIdReferences; + bool mFilterDirty; + bool mFilterInDirtyList; + + + private: + Sc::SoftBodySim* mSim; + SoftBodyCore& mCore; + PxsShapeCore* mShapeCore; + + PxTetrahedronMesh* mSimulationMesh; + PxSoftBodyAuxData* mSoftBodyAuxData; + + PxU32 mElementId; //this is used for the bound array, contactDist + PxU32 mGpuRemapId; + }; + + PX_FORCE_INLINE SoftBody* getSoftBody(SoftBodyHandle handle) + { + return reinterpret_cast(handle); + } + + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBodyCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBodyCore.h new file mode 100644 index 0000000..be4dbe0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DySoftBodyCore.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_SOFTBODY_CORE_H +#define DY_SOFTBODY_CORE_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxTransform.h" +#include "PxSoftBody.h" +#include "PxsFEMSoftBodyMaterialCore.h" +#include "foundation/PxArray.h" + +namespace physx +{ + namespace Dy + { + struct SoftBodyCore + { + public: + PxQuat initialRotation; + + PxFEMParameters parameters; + PxReal sleepThreshold; + PxReal freezeThreshold; + PxReal wakeCounter; + PxReal maxPenBias; + PxU16 solverIterationCounts; //vel iters are in low word and pos iters in high word. + bool dirty; + PxSoftBodyFlags mFlags; + + + void setMaterial(const PxU16 materialHandle) + { + mMaterialHandles.pushBack(materialHandle); + } + + void clearMaterials() { mMaterialHandles.clear(); } + + PxArray mMaterialHandles; + + //device + PxBuffer* mPositionInvMass; + + //host + PxBuffer* mPositionInvMassCPU; + PxBuffer* mRestPositionInvMassCPU; + + //device + PxBuffer* mSimPositionInvMass; + PxBuffer* mSimVelocityInvMass; + PxBuffer* mKinematicTarget; + + //host + PxBuffer* mSimPositionInvMassCPU; + PxBuffer* mSimVelocityInvMassCPU; + PxBuffer* mKinematicTargetCPU; + }; + + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyThresholdTable.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyThresholdTable.h new file mode 100644 index 0000000..d64e55e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyThresholdTable.h @@ -0,0 +1,282 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_THRESHOLD_TABLE_H +#define DY_THRESHOLD_TABLE_H + +#include "foundation/PxPinnedArray.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHash.h" +#include "foundation/PxMemory.h" +#include "PxNodeIndex.h" + +namespace physx +{ + +class PxsRigidBody; + +namespace Sc +{ + class ShapeInteraction; +} + +namespace Dy +{ + +struct ThresholdStreamElement +{ + Sc::ShapeInteraction* shapeInteraction; //4/8 4/8 + PxReal normalForce; //4 8/12 + PxReal threshold; //4 12/16 + PxNodeIndex nodeIndexA; //8 24 This is the unique node index in island gen which corresonding to that body and it is persistent 16 20 + PxNodeIndex nodeIndexB; //8 32 This is the unique node index in island gen which corresonding to that body and it is persistent 20 24 + PxReal accumulatedForce; //4 36 + PxU32 pad; //4 40 + + PX_CUDA_CALLABLE bool operator <= (const ThresholdStreamElement& otherPair) const + { + return ((nodeIndexA < otherPair.nodeIndexA) ||(nodeIndexA == otherPair.nodeIndexA && nodeIndexB <= otherPair.nodeIndexB)); + } + + PX_CUDA_CALLABLE bool operator < (const ThresholdStreamElement& otherPair) const + { + return ((nodeIndexA < otherPair.nodeIndexA) || (nodeIndexA == otherPair.nodeIndexA && nodeIndexB < otherPair.nodeIndexB)); + } + + PX_CUDA_CALLABLE bool operator == (const ThresholdStreamElement& otherPair) const + { + return ((nodeIndexA == otherPair.nodeIndexA && nodeIndexB == otherPair.nodeIndexB)); + } + +}; + +typedef PxPinnedArray ThresholdArray; + +class ThresholdStream : public ThresholdArray, public PxUserAllocated +{ +public: + ThresholdStream(PxVirtualAllocatorCallback& allocatorCallback) : ThresholdArray(PxVirtualAllocator(&allocatorCallback)) + { + } + +}; + +class ThresholdTable +{ +public: + + ThresholdTable() + : mBuffer(NULL), + mHash(NULL), + mHashSize(0), + mHashCapactiy(0), + mPairs(NULL), + mNexts(NULL), + mPairsSize(0), + mPairsCapacity(0) + { + } + + ~ThresholdTable() + { + PX_FREE(mBuffer); + } + + void build(const ThresholdStream& stream); + + bool check(const ThresholdStream& stream, const PxU32 nodexIndexA, const PxU32 nodexIndexB, PxReal dt); + + bool check(const ThresholdStream& stream, const ThresholdStreamElement& elem, PxU32& thresholdIndex); + +//private: + + static const PxU32 NO_INDEX = 0xffffffff; + + struct Pair + { + PxU32 thresholdStreamIndex; + PxReal accumulatedForce; + //PxU32 next; // hash key & next ptr + }; + + PxU8* mBuffer; + + PxU32* mHash; + PxU32 mHashSize; + PxU32 mHashCapactiy; + + Pair* mPairs; + PxU32* mNexts; + PxU32 mPairsSize; + PxU32 mPairsCapacity; +}; + +namespace +{ + static PX_FORCE_INLINE PxU32 computeHashKey(const PxU32 nodeIndexA, const PxU32 nodeIndexB, const PxU32 hashCapacity) + { + return (PxComputeHash(PxU64(nodeIndexA)<<32 | PxU64(nodeIndexB)) % hashCapacity); + } +} + +inline bool ThresholdTable::check(const ThresholdStream& stream, const ThresholdStreamElement& elem, PxU32& thresholdIndex) +{ + PxU32* PX_RESTRICT hashes = mHash; + PxU32* PX_RESTRICT nextIndices = mNexts; + Pair* PX_RESTRICT pairs = mPairs; + + PX_ASSERT(elem.nodeIndexA < elem.nodeIndexB); + PxU32 hashKey = computeHashKey(elem.nodeIndexA.index(), elem.nodeIndexB.index(), mHashSize); + + PxU32 pairIndex = hashes[hashKey]; + + while(NO_INDEX != pairIndex) + { + Pair& pair = pairs[pairIndex]; + const PxU32 thresholdStreamIndex = pair.thresholdStreamIndex; + PX_ASSERT(thresholdStreamIndex < stream.size()); + const ThresholdStreamElement& otherElement = stream[thresholdStreamIndex]; + if(otherElement.nodeIndexA==elem.nodeIndexA && otherElement.nodeIndexB==elem.nodeIndexB && otherElement.shapeInteraction == elem.shapeInteraction) + { + thresholdIndex = thresholdStreamIndex; + return true; + } + pairIndex = nextIndices[pairIndex]; + } + + thresholdIndex = NO_INDEX; + return false; +} + + +inline void ThresholdTable::build(const ThresholdStream& stream) +{ + //Handle the case of an empty stream. + if(0==stream.size()) + { + mPairsSize=0; + mPairsCapacity=0; + mHashSize=0; + mHashCapactiy=0; + PX_FREE(mBuffer); + return; + } + + //Realloc/resize if necessary. + const PxU32 pairsCapacity = stream.size(); + const PxU32 hashCapacity = pairsCapacity*2+1; + if((pairsCapacity > mPairsCapacity) || (pairsCapacity < (mPairsCapacity >> 2))) + { + PX_FREE(mBuffer); + const PxU32 pairsByteSize = sizeof(Pair)*pairsCapacity; + const PxU32 nextsByteSize = sizeof(PxU32)*pairsCapacity; + const PxU32 hashByteSize = sizeof(PxU32)*hashCapacity; + const PxU32 totalByteSize = pairsByteSize + nextsByteSize + hashByteSize; + mBuffer = reinterpret_cast(PX_ALLOC(totalByteSize, "PxThresholdStream")); + + PxU32 offset = 0; + mPairs = reinterpret_cast(mBuffer + offset); + offset += pairsByteSize; + mNexts = reinterpret_cast(mBuffer + offset); + offset += nextsByteSize; + mHash = reinterpret_cast(mBuffer + offset); + offset += hashByteSize; + PX_ASSERT(totalByteSize == offset); + + mPairsCapacity = pairsCapacity; + mHashCapactiy = hashCapacity; + } + + + //Set each entry of the hash table to 0xffffffff + PxMemSet(mHash, 0xff, sizeof(PxU32)*hashCapacity); + + //Init the sizes of the pairs array and hash array. + mPairsSize = 0; + mHashSize = hashCapacity; + + PxU32* PX_RESTRICT hashes = mHash; + PxU32* PX_RESTRICT nextIndices = mNexts; + Pair* PX_RESTRICT pairs = mPairs; + + //Add all the pairs from the stream. + PxU32 pairsSize = 0; + for(PxU32 i = 0; i < pairsCapacity; i++) + { + const ThresholdStreamElement& element = stream[i]; + const PxNodeIndex nodeIndexA = element.nodeIndexA; + const PxNodeIndex nodeIndexB = element.nodeIndexB; + + const PxF32 force = element.normalForce; + + PX_ASSERT(nodeIndexA < nodeIndexB); + + const PxU32 hashKey = computeHashKey(nodeIndexA.index(), nodeIndexB.index(), hashCapacity); + + //Get the index of the first pair found that resulted in a hash that matched hashKey. + PxU32 prevPairIndex = hashKey; + PxU32 pairIndex = hashes[hashKey]; + + //Search through all pairs found that resulted in a hash that matched hashKey. + //Search until the exact same body pair is found. + //Increment the accumulated force if the exact same body pair is found. + while(NO_INDEX != pairIndex) + { + Pair& pair = pairs[pairIndex]; + const PxU32 thresholdStreamIndex = pair.thresholdStreamIndex; + PX_ASSERT(thresholdStreamIndex < stream.size()); + const ThresholdStreamElement& otherElement = stream[thresholdStreamIndex]; + if(nodeIndexA == otherElement.nodeIndexA && nodeIndexB==otherElement.nodeIndexB) + { + pair.accumulatedForce += force; + prevPairIndex = NO_INDEX; + pairIndex = NO_INDEX; + break; + } + prevPairIndex = pairIndex; + pairIndex = nextIndices[pairIndex]; + } + + if(NO_INDEX != prevPairIndex) + { + nextIndices[pairsSize] = hashes[hashKey]; + hashes[hashKey] = pairsSize; + Pair& newPair = pairs[pairsSize]; + newPair.thresholdStreamIndex = i; + newPair.accumulatedForce = force; + pairsSize++; + } + } + mPairsSize = pairsSize; +} + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyVArticulation.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyVArticulation.h new file mode 100644 index 0000000..7d4891e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/include/DyVArticulation.h @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_V_ARTICULATION_H +#define DY_V_ARTICULATION_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxUtilities.h" +#include "CmUtils.h" +#include "CmSpatialVector.h" +#include "foundation/PxMemory.h" +#include "DyArticulationCore.h" +#include "DyArticulationJointCore.h" + +namespace physx +{ + struct PxsBodyCore; + class PxsConstraintBlockManager; + class PxsContactManagerOutputIterator; + struct PxSolverConstraintDesc; + struct PxSolverBodyData; + class PxContactJoint; + struct PxTGSSolverBodyData; + struct PxTGSSolverBodyTxInertia; + struct PxSolverConstraintDesc; + + namespace Dy + { + + struct SpatialSubspaceMatrix; + + struct ConstraintWriteback; + class ThreadContext; + + static const size_t DY_ARTICULATION_TENDON_MAX_SIZE = 64; + + struct Constraint; + class Context; + class ArticulationSpatialTendon; + class ArticulationFixedTendon; + class ArticulationTendonJoint; + struct ArticulationSensor; + + + struct ArticulationLoopConstraint + { + public: + PxU32 linkIndex0; + PxU32 linkIndex1; + Dy::Constraint* constraint; + }; + +#define DY_ARTICULATION_LINK_NONE 0xffffffff + + typedef PxU64 ArticulationBitField; + + struct ArticulationLink + { + ArticulationBitField children; // child bitmap + ArticulationBitField pathToRoot; // path to root, including link and root + PxU32 mPathToRootStartIndex; + PxU32 mChildrenStartIndex; + PxU16 mPathToRootCount; + PxU16 mNumChildren; + PxsBodyCore* bodyCore; + ArticulationJointCore* inboundJoint; + PxU32 parent; + PxReal cfm; + }; + + class FeatherstoneArticulation; + + struct ArticulationSolverDesc + { + void initData(ArticulationCore* core_, const PxArticulationFlags* flags_) + { + articulation = NULL; + links = NULL; + motionVelocity = NULL; + acceleration = NULL; + poses = NULL; + deltaQ = NULL; + + core = core_; + flags = flags_; + linkCount = 0; + numInternalConstraints = 0; + + } + + FeatherstoneArticulation* articulation; + ArticulationLink* links; + Cm::SpatialVectorV* motionVelocity; + Cm::SpatialVector* acceleration; + PxTransform* poses; + PxQuat* deltaQ; + + ArticulationCore* core; + const PxArticulationFlags* flags; // PT: PX-1399 + + PxU8 linkCount; + PxU8 numInternalConstraints; + + }; + + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp new file mode 100644 index 0000000..bb90bd2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.cpp @@ -0,0 +1,575 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "DyCorrelationBuffer.h" +#include "DySolverConstraintExtShared.h" +#include "DyConstraintPrep.h" +#include "DyFeatherstoneArticulation.h" + +using namespace physx::Gu; + +namespace physx +{ + +namespace Dy +{ + +// constraint-gen only, since these use getVelocity methods +// which aren't valid during the solver phase + +//PX_INLINE void computeFrictionTangents(const aos::Vec3V& vrel,const aos::Vec3V& unitNormal, aos::Vec3V& t0, aos::Vec3V& t1) +//{ +// using namespace aos; +// //PX_ASSERT(PxAbs(unitNormal.magnitude()-1)<1e-3f); +// +// t0 = V3Sub(vrel, V3Scale(unitNormal, V3Dot(unitNormal, vrel))); +// const FloatV ll = V3Dot(t0, t0); +// +// if (FAllGrtr(ll, FLoad(1e10f))) //can set as low as 0. +// { +// t0 = V3Scale(t0, FRsqrt(ll)); +// t1 = V3Cross(unitNormal, t0); +// } +// else +// PxNormalToTangents(unitNormal, t0, t1); //fallback +//} + +PxReal SolverExtBody::projectVelocity(const PxVec3& linear, const PxVec3& angular) const +{ + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + return mBodyData->projectVelocity(linear, angular); + } + else + { + const Cm::SpatialVectorV velocity = mArticulation->getLinkVelocity(mLinkIndex); + + const FloatV fv = velocity.dot(Cm::SpatialVector(linear, angular)); + + PxF32 f; + FStore(fv, &f); + return f; + /*PxF32 f; + FStore(getVelocity(*mFsData)[mLinkIndex].dot(Cm::SpatialVector(linear, angular)), &f); + return f;*/ + } +} + +PxReal SolverExtBody::getCFM() const +{ + return (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) ? 0.f : + mArticulation->getCfm(mLinkIndex); +} + +aos::FloatV SolverExtBody::projectVelocity(const aos::Vec3V& linear, const aos::Vec3V& angular) const +{ + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + return V3SumElems(V3Add(V3Mul(V3LoadA(mBodyData->linearVelocity), linear), V3Mul(V3LoadA(mBodyData->angularVelocity), angular))); + } + else + { + const Cm::SpatialVectorV velocity = mArticulation->getLinkVelocity(mLinkIndex); + + return velocity.dot(Cm::SpatialVectorV(linear, angular)); + } +} + + +PxVec3 SolverExtBody::getLinVel() const +{ + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return mBodyData->linearVelocity; + else + { + const Vec3V linear = mArticulation->getLinkVelocity(mLinkIndex).linear; + + PxVec3 result; + V3StoreU(linear, result); + /*PxVec3 result; + V3StoreU(getVelocity(*mFsData)[mLinkIndex].linear, result);*/ + return result; + } +} + +PxVec3 SolverExtBody::getAngVel() const +{ + if(mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return mBodyData->angularVelocity; + else + { + const Vec3V angular = mArticulation->getLinkVelocity(mLinkIndex).angular; + + PxVec3 result; + V3StoreU(angular, result); + /*PxVec3 result; + V3StoreU(getVelocity(*mFsData)[mLinkIndex].angular, result);*/ + return result; + } +} + +aos::Vec3V SolverExtBody::getLinVelV() const +{ + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return V3LoadA(mBodyData->linearVelocity); + else + { + return mArticulation->getLinkVelocity(mLinkIndex).linear; + } +} + + +Vec3V SolverExtBody::getAngVelV() const +{ + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return V3LoadA(mBodyData->angularVelocity); + else + { + + return mArticulation->getLinkVelocity(mLinkIndex).angular; + } +} + +Cm::SpatialVectorV SolverExtBody::getVelocity() const +{ + if(mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return Cm::SpatialVectorV(V3LoadA(mBodyData->linearVelocity), V3LoadA(mBodyData->angularVelocity)); + else + return mArticulation->getLinkVelocity(mLinkIndex); +} + +Cm::SpatialVector createImpulseResponseVector(const PxVec3& linear, const PxVec3& angular, const SolverExtBody& body) +{ + if (body.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + return Cm::SpatialVector(linear, body.mBodyData->sqrtInvInertia * angular); + } + return Cm::SpatialVector(linear, angular); +} + +Cm::SpatialVectorV createImpulseResponseVector(const aos::Vec3V& linear, const aos::Vec3V& angular, const SolverExtBody& body) +{ + if (body.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + return Cm::SpatialVectorV(linear, M33MulV3(M33Load(body.mBodyData->sqrtInvInertia), angular)); + } + return Cm::SpatialVectorV(linear, angular); +} + +PxReal getImpulseResponse(const SolverExtBody& b0, const Cm::SpatialVector& impulse0, Cm::SpatialVector& deltaV0, PxReal dom0, PxReal angDom0, + const SolverExtBody& b1, const Cm::SpatialVector& impulse1, Cm::SpatialVector& deltaV1, PxReal dom1, PxReal angDom1, + Cm::SpatialVectorF* Z, bool allowSelfCollision) +{ + PxReal response; + allowSelfCollision = false; + // right now self-collision with contacts crashes the solver + + //KS - knocked this out to save some space on SPU + if(allowSelfCollision && b0.mLinkIndex!=PxSolverConstraintDesc::RIGID_BODY && b0.mArticulation == b1.mArticulation && 0) + { + /*ArticulationHelper::getImpulseSelfResponse(*b0.mFsData,b0.mLinkIndex, impulse0, deltaV0, + b1.mLinkIndex, impulse1, deltaV1);*/ + + b0.mArticulation->getImpulseSelfResponse(b0.mLinkIndex, b1.mLinkIndex, Z, impulse0.scale(dom0, angDom0), impulse1.scale(dom1, angDom1), + deltaV0, deltaV1); + + response = impulse0.dot(deltaV0) + impulse1.dot(deltaV1); + } + else + { + if(b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV0.linear = impulse0.linear * b0.mBodyData->invMass * dom0; + deltaV0.angular = impulse0.angular * angDom0; + } + else + { + b0.mArticulation->getImpulseResponse(b0.mLinkIndex, Z, impulse0.scale(dom0, angDom0), deltaV0); + } + + response = impulse0.dot(deltaV0); + if(b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV1.linear = impulse1.linear * b1.mBodyData->invMass * dom1; + deltaV1.angular = impulse1.angular * angDom1; + } + else + { + b1.mArticulation->getImpulseResponse( b1.mLinkIndex, Z, impulse1.scale(dom1, angDom1), deltaV1); + } + response += impulse1.dot(deltaV1); + } + + return response; +} + +FloatV getImpulseResponse(const SolverExtBody& b0, const Cm::SpatialVectorV& impulse0, Cm::SpatialVectorV& deltaV0, const FloatV& dom0, const FloatV& angDom0, + const SolverExtBody& b1, const Cm::SpatialVectorV& impulse1, Cm::SpatialVectorV& deltaV1, const FloatV& dom1, const FloatV& angDom1, + Cm::SpatialVectorV* Z, bool /*allowSelfCollision*/) +{ + Vec3V response; + { + + if (b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV0.linear = V3Scale(impulse0.linear, FMul(FLoad(b0.mBodyData->invMass), dom0)); + deltaV0.angular = V3Scale(impulse0.angular, angDom0); + } + else + { + b0.mArticulation->getImpulseResponse(b0.mLinkIndex, Z, impulse0.scale(dom0, angDom0), deltaV0); + } + + response = V3Add(V3Mul(impulse0.linear, deltaV0.linear), V3Mul(impulse0.angular, deltaV0.angular)); + if (b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV1.linear = V3Scale(impulse1.linear, FMul(FLoad(b1.mBodyData->invMass), dom1)); + deltaV1.angular = V3Scale(impulse1.angular, angDom1); + } + else + { + b1.mArticulation->getImpulseResponse(b1.mLinkIndex, Z, impulse1.scale(dom1, angDom1), deltaV1); + } + response = V3Add(response, V3Add(V3Mul(impulse1.linear, deltaV1.linear), V3Mul(impulse1.angular, deltaV1.angular))); + } + + return V3SumElems(response); +} + + + +void setupFinalizeExtSolverContacts( + const PxContactPoint* buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const SolverExtBody& b0, + const SolverExtBody& b1, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + const PxReal restDist, + PxU8* frictionDataPtr, + PxReal ccdMaxContactDist, + Cm::SpatialVectorF* Z, + const PxReal offsetSlop) +{ + // NOTE II: the friction patches are sparse (some of them have no contact patches, and + // therefore did not get written back to the cache) but the patch addresses are dense, + // corresponding to valid patches + + /*const bool haveFriction = PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0;*/ + + const FloatV ccdMaxSeparation = FLoad(ccdMaxContactDist); + + const Vec3VArg solverOffsetSlop = V3Load(offsetSlop); + + PxU8* PX_RESTRICT ptr = workspace; + + const FloatV zero = FZero(); + + //KS - TODO - this should all be done in SIMD to avoid LHS + //const PxF32 maxPenBias0 = b0.mLinkIndex == PxSolverConstraintDesc::NO_LINK ? b0.mBodyData->penBiasClamp : getMaxPenBias(*b0.mFsData)[b0.mLinkIndex]; + //const PxF32 maxPenBias1 = b1.mLinkIndex == PxSolverConstraintDesc::NO_LINK ? b1.mBodyData->penBiasClamp : getMaxPenBias(*b1.mFsData)[b1.mLinkIndex]; + + PxF32 maxPenBias0; + PxF32 maxPenBias1; + + if (b0.mLinkIndex != PxSolverConstraintDesc::RIGID_BODY) + { + maxPenBias0 = b0.mArticulation->getLinkMaxPenBias(b0.mLinkIndex); + } + else + maxPenBias0 = b0.mBodyData->penBiasClamp; + + if (b1.mLinkIndex != PxSolverConstraintDesc::RIGID_BODY) + { + maxPenBias1 = b1.mArticulation->getLinkMaxPenBias(b1.mLinkIndex); + } + else + maxPenBias1 = b1.mBodyData->penBiasClamp; + + const FloatV maxPenBias = FLoad(PxMax(maxPenBias0, maxPenBias1)); + + const Vec3V frame0p = V3LoadU(bodyFrame0.p); + const Vec3V frame1p = V3LoadU(bodyFrame1.p); + + const Cm::SpatialVectorV vel0 = b0.getVelocity(); + const Cm::SpatialVectorV vel1 = b1.getVelocity(); + + const FloatV quarter = FLoad(0.25f); + + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + + const FloatV cfm = FLoad(PxMax(b0.getCFM(), b1.getCFM())); + + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + Vec4V staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4Zero(); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetZ(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, d0); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetW(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, d1); + + const FloatV restDistance = FLoad(restDist); + + PxU32 frictionPatchWritebackAddrIndex = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + const FloatV invDt = FLoad(invDtF32); + const FloatV p8 = FLoad(0.8f); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + + const FloatV invDtp8 = FMul(invDt, p8); + const FloatV dt = FLoad(dtF32); + + PxU8 flags = 0; + + for(PxU32 i=0;imaterialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && frictionPatch.anchorCount == 2) ? 0.5f : 1.f; + + const PxReal staticFriction = contactBase0->staticFriction * coefficient; + const PxReal dynamicFriction = contactBase0->dynamicFriction * coefficient; + const bool disableStrongFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetX(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(staticFriction)); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetY(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(dynamicFriction)); + + SolverContactHeader* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactHeader); + + PxPrefetchLine(ptr + 128); + PxPrefetchLine(ptr + 256); + PxPrefetchLine(ptr + 384); + + const bool haveFriction = (disableStrongFriction == 0) ;//PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0; + header->numNormalConstr = PxTo8(contactCount); + header->numFrictionConstr = PxTo8(haveFriction ? frictionPatch.anchorCount*2 : 0); + + header->type = PxTo8(DY_SC_TYPE_EXT_CONTACT); + + header->flags = flags; + + const FloatV restitution = FLoad(contactBase0->restitution); + const FloatV damping = FLoad(contactBase0->damping); + + header->staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W; + + header->angDom0 = invInertiaScale0; + header->angDom1 = invInertiaScale1; + + const PxU32 pointStride = sizeof(SolverContactPointExt); + const PxU32 frictionStride = sizeof(SolverContactFrictionExt); + + const Vec3V normal = V3LoadU(buffer[c.contactPatches[c.correlationListHeads[i]].start].normal); + + FloatV accumImpulse = FZero(); + + const FloatV norVel0 = V3Dot(normal, vel0.linear); + const FloatV norVel1 = V3Dot(normal, vel1.linear); + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer + c.contactPatches[patch].start; + + PxU8* p = ptr; + + for(PxU32 j=0;j(p); + p += pointStride; + + accumImpulse = FAdd(accumImpulse, setupExtSolverContact(b0, b1, d0, d1, angD0, angD1, frame0p, frame1p, normal, invDt, invDtp8, dt, restDistance, maxPenBias, restitution, + bounceThreshold, contact, *solverContact, ccdMaxSeparation, Z, vel0, vel1, cfm, solverOffsetSlop, norVel0, norVel1, damping)); + + } + + ptr = p; + } + + accumImpulse = FMul(FDiv(accumImpulse, FLoad(PxF32(contactCount))), quarter); + + header->normal_minAppliedImpulseForFrictionW = V4SetW(Vec4V_From_Vec3V(normal), accumImpulse); + + PxF32* forceBuffer = reinterpret_cast(ptr); + PxMemZero(forceBuffer, sizeof(PxF32) * contactCount); + ptr += sizeof(PxF32) * ((contactCount + 3) & (~3)); + + header->broken = 0; + + if(haveFriction) + { + //const Vec3V normal = Vec3V_From_PxVec3(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + //Vec3V normalS = V3LoadA(buffer[c.contactPatches[c.correlationListHeads[i]].start].normal); + + + const Vec3V linVrel = V3Sub(vel0.linear, vel1.linear); + //const Vec3V normal = Vec3V_From_PxVec3_Aligned(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + + const FloatV orthoThreshold = FLoad(0.70710678f); + const FloatV p1 = FLoad(0.0001f); + // fallback: normal.cross((1,0,0)) or normal.cross((0,0,1)) + const FloatV normalX = V3GetX(normal); + const FloatV normalY = V3GetY(normal); + const FloatV normalZ = V3GetZ(normal); + + Vec3V t0Fallback1 = V3Merge(zero, FNeg(normalZ), normalY); + Vec3V t0Fallback2 = V3Merge(FNeg(normalY), normalX, zero); + Vec3V t0Fallback = V3Sel(FIsGrtr(orthoThreshold, FAbs(normalX)), t0Fallback1, t0Fallback2); + + Vec3V t0 = V3Sub(linVrel, V3Scale(normal, V3Dot(normal, linVrel))); + t0 = V3Sel(FIsGrtr(V3LengthSq(t0), p1), t0, t0Fallback); + t0 = V3Normalize(t0); + + const VecCrossV t0Cross = V3PrepareCross(t0); + + const Vec3V t1 = V3Cross(normal, t0Cross); + const VecCrossV t1Cross = V3PrepareCross(t1); + + //We want to set the writeBack ptr to point to the broken flag of the friction patch. + //On spu we have a slight problem here because the friction patch array is + //in local store rather than in main memory. The good news is that the address of the friction + //patch array in main memory is stored in the work unit. These two addresses will be equal + //except on spu where one is local store memory and the other is the effective address in main memory. + //Using the value stored in the work unit guarantees that the main memory address is used on all platforms. + PxU8* PX_RESTRICT writeback = frictionDataPtr + frictionPatchWritebackAddrIndex*sizeof(FrictionPatch); + + header->frictionBrokenWritebackByte = writeback; + + for(PxU32 j = 0; j < frictionPatch.anchorCount; j++) + { + SolverContactFrictionExt* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionStride; + SolverContactFrictionExt* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionStride; + + Vec3V ra = V3LoadU(bodyFrame0.q.rotate(frictionPatch.body0Anchors[j])); + Vec3V rb = V3LoadU(bodyFrame1.q.rotate(frictionPatch.body1Anchors[j])); + Vec3V error = V3Sub(V3Add(ra, frame0p), V3Add(rb, frame1p)); + + { + Vec3V raXn = V3Cross(ra, t0Cross); + Vec3V rbXn = V3Cross(rb, t0Cross); + raXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + Cm::SpatialVectorV deltaV0, deltaV1; + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(t0, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(t0), V3Neg(rbXn), b1); + FloatV resp = FAdd(cfm, getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, reinterpret_cast(Z))); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, FLoad(DY_ARTICULATION_MIN_RESPONSE)), FDiv(p8, resp), zero); + + const PxU32 index = c.contactPatches[c.correlationListHeads[i]].start; + FloatV targetVel = V3Dot(V3LoadA(buffer[index].targetVel), t0); + + if(b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVel = FSub(targetVel, b0.projectVelocity(t0, raXn)); + else if(b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVel = FAdd(targetVel, b1.projectVelocity(t0, rbXn)); + + f0->normalXYZ_appliedForceW = V4SetW(t0, zero); + f0->raXnXYZ_velMultiplierW = V4SetW(Vec4V_From_Vec3V(resp0.angular), velMultiplier); + f0->rbXnXYZ_biasW = V4SetW(V4Neg(Vec4V_From_Vec3V(resp1.angular)), FMul(V3Dot(t0, error), invDt)); + f0->linDeltaVA = deltaV0.linear; + f0->angDeltaVA = deltaV0.angular; + f0->linDeltaVB = deltaV1.linear; + f0->angDeltaVB = deltaV1.angular; + FStore(targetVel, &f0->targetVel); + } + + { + Vec3V raXn = V3Cross(ra, t1Cross); + Vec3V rbXn = V3Cross(rb, t1Cross); + raXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + Cm::SpatialVectorV deltaV0, deltaV1; + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(t1, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(t1), V3Neg(rbXn), b1); + + FloatV resp = FAdd(cfm, getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, reinterpret_cast(Z))); + + //const FloatV velMultiplier = FSel(FIsGrtr(resp, FLoad(DY_ARTICULATION_MIN_RESPONSE)), FMul(p8, FRecip(resp)), zero); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, FLoad(DY_ARTICULATION_MIN_RESPONSE)), FDiv(p8, resp), zero); + + const PxU32 index = c.contactPatches[c.correlationListHeads[i]].start; + FloatV targetVel = V3Dot(V3LoadA(buffer[index].targetVel), t1); + + if(b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVel = FSub(targetVel, b0.projectVelocity(t1, raXn)); + else if(b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVel = FAdd(targetVel, b1.projectVelocity(t1, rbXn)); + + f1->normalXYZ_appliedForceW = V4SetW(t1, zero); + f1->raXnXYZ_velMultiplierW = V4SetW(Vec4V_From_Vec3V(resp0.angular), velMultiplier); + f1->rbXnXYZ_biasW = V4SetW(V4Neg(Vec4V_From_Vec3V(resp1.angular)), FMul(V3Dot(t1, error), invDt)); + f1->linDeltaVA = deltaV0.linear; + f1->angDeltaVA = deltaV0.angular; + f1->linDeltaVB = deltaV1.linear; + f1->angDeltaVB = deltaV1.angular; + FStore(targetVel, &f1->targetVel); + } + } + } + + frictionPatchWritebackAddrIndex++; + } +} + +} + + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.h new file mode 100644 index 0000000..3324896 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrep.h @@ -0,0 +1,100 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_ARTICULATION_CONTACT_PREP_H +#define DY_ARTICULATION_CONTACT_PREP_H + +#include "DySolverExt.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +struct PxcNpWorkUnit; +class PxContactBuffer; +struct PxContactPoint; + +namespace Dy +{ + + struct CorrelationBuffer; + + PxReal getImpulseResponse(const SolverExtBody& b0, const Cm::SpatialVector& impulse0, Cm::SpatialVector& deltaV0, PxReal dom0, PxReal angDom0, + const SolverExtBody& b1, const Cm::SpatialVector& impulse1, Cm::SpatialVector& deltaV1, PxReal dom1, PxReal angDom1, + Cm::SpatialVectorF* Z, bool allowSelfCollision = false); + + aos::FloatV getImpulseResponse(const SolverExtBody& b0, const Cm::SpatialVectorV& impulse0, Cm::SpatialVectorV& deltaV0, const aos::FloatV& dom0, const aos::FloatV& angDom0, + const SolverExtBody& b1, const Cm::SpatialVectorV& impulse1, Cm::SpatialVectorV& deltaV1, const aos::FloatV& dom1, const aos::FloatV& angDom1, + Cm::SpatialVectorV* Z, bool allowSelfCollision = false); + + Cm::SpatialVector createImpulseResponseVector(const PxVec3& linear, const PxVec3& angular, const SolverExtBody& body); + Cm::SpatialVectorV createImpulseResponseVector(const aos::Vec3V& linear, const aos::Vec3V& angular, const SolverExtBody& body); + + void setupFinalizeExtSolverContacts( + const PxContactPoint* buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const SolverExtBody& b0, + const SolverExtBody& b1, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + PxReal restDistance, PxU8* frictionDataPtr, + PxReal ccdMaxContactDist, + Cm::SpatialVectorF* Z, + const PxReal offsetSlop); + + + bool setupFinalizeExtSolverContactsCoulomb( + const PxContactBuffer& buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + PxReal invDt, + PxReal dtF32, + PxReal bounceThreshold, + const SolverExtBody& b0, + const SolverExtBody& b1, + PxU32 frictionCountPerPoint, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + PxReal restDist, + PxReal ccdMaxContactDist, + Cm::SpatialVectorF* Z, + const PxReal solverOffsetSlop); + +} //namespace Dy + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp new file mode 100644 index 0000000..d640a2e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationContactPrepPF.cpp @@ -0,0 +1,318 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "DyCorrelationBuffer.h" +#include "DySolverConstraintExtShared.h" +#include "DyFeatherstoneArticulation.h" + +using namespace physx; +using namespace Gu; + +// constraint-gen only, since these use getVelocityFast methods +// which aren't valid during the solver phase + +namespace physx +{ + +namespace Dy +{ + + +bool setupFinalizeExtSolverContactsCoulomb( + const PxContactBuffer& buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + PxReal invDt, + PxReal dtF32, + PxReal bounceThresholdF32, + const SolverExtBody& b0, + const SolverExtBody& b1, + PxU32 frictionCountPerPoint, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + PxReal restDist, + PxReal ccdMaxDistance, + Cm::SpatialVectorF* Z, + const PxReal solverOffsetSlop) +{ + // NOTE II: the friction patches are sparse (some of them have no contact patches, and + // therefore did not get written back to the cache) but the patch addresses are dense, + // corresponding to valid patches + + const FloatV ccdMaxSeparation = FLoad(ccdMaxDistance); + const Vec3V offsetSlop = V3Load(solverOffsetSlop); + + PxU8* PX_RESTRICT ptr = workspace; + + //KS - TODO - this should all be done in SIMD to avoid LHS + PxF32 maxPenBias0 = b0.mBodyData->penBiasClamp; + PxF32 maxPenBias1 = b1.mBodyData->penBiasClamp; + + if (b0.mLinkIndex != PxSolverConstraintDesc::RIGID_BODY) + { + maxPenBias0 = b0.mArticulation->getLinkMaxPenBias(b0.mLinkIndex); + } + + if (b1.mLinkIndex != PxSolverConstraintDesc::RIGID_BODY) + { + maxPenBias1 = b1.mArticulation->getLinkMaxPenBias(b1.mLinkIndex); + } + + const FloatV maxPenBias = FLoad(PxMax(maxPenBias0, maxPenBias1)/invDt); + + const FloatV restDistance = FLoad(restDist); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + + const Cm::SpatialVectorV vel0 = b0.getVelocity(); + const Cm::SpatialVectorV vel1 = b1.getVelocity(); + + const FloatV invDtV = FLoad(invDt); + const FloatV pt8 = FLoad(0.8f); + + const FloatV invDtp8 = FMul(invDtV, pt8); + const FloatV dt = FLoad(dtF32); + + const Vec3V bodyFrame0p = V3LoadU(bodyFrame0.p); + const Vec3V bodyFrame1p = V3LoadU(bodyFrame1.p); + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + const PxU32 frictionPatchCount = c.frictionPatchCount; + + const PxU32 pointStride = sizeof(SolverContactPointExt); + const PxU32 frictionStride = sizeof(SolverContactFrictionExt); + const PxU8 pointHeaderType = DY_SC_TYPE_EXT_CONTACT; + const PxU8 frictionHeaderType = DY_SC_TYPE_EXT_FRICTION; + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + PxU8 flags = 0; + + const FloatV cfm = FLoad(PxMax(b0.getCFM(), b1.getCFM())); + + for(PxU32 i=0;i< frictionPatchCount;i++) + { + const PxU32 contactCount = c.frictionPatchContactCounts[i]; + if(contactCount == 0) + continue; + + const PxContactPoint* contactBase0 = buffer.contacts + c.contactPatches[c.correlationListHeads[i]].start; + + const Vec3V normalV = aos::V3LoadA(contactBase0->normal); + const Vec3V normal = V3LoadA(contactBase0->normal); + + const PxReal combinedRestitution = contactBase0->restitution; + + + SolverContactCoulombHeader* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactCoulombHeader); + + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + + const FloatV restitution = FLoad(combinedRestitution); + const FloatV damping = FLoad(contactBase0->damping); + + + header->numNormalConstr = PxU8(contactCount); + header->type = pointHeaderType; + //header->setRestitution(combinedRestitution); + + header->setDominance0(d0); + header->setDominance1(d1); + header->angDom0 = invInertiaScale0; + header->angDom1 = invInertiaScale1; + header->flags = flags; + + header->setNormal(normalV); + + const FloatV norVel0 = V3Dot(normalV, vel0.linear); + const FloatV norVel1 = V3Dot(normalV, vel1.linear); + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer.contacts + c.contactPatches[patch].start; + + PxU8* p = ptr; + for(PxU32 j=0;j(p); + p += pointStride; + + setupExtSolverContact(b0, b1, d0, d1, angD0, angD1, bodyFrame0p, bodyFrame1p, normal, invDtV, invDtp8, dt, restDistance, maxPenBias, restitution, + bounceThreshold, contact, *solverContact, ccdMaxSeparation, Z, vel0, vel1, cfm, offsetSlop, + norVel0, norVel1, damping); + } + ptr = p; + } + } + + //construct all the frictions + + PxU8* PX_RESTRICT ptr2 = workspace; + + const PxF32 orthoThreshold = 0.70710678f; + const PxF32 eps = 0.00001f; + bool hasFriction = false; + + for(PxU32 i=0;i< frictionPatchCount;i++) + { + const PxU32 contactCount = c.frictionPatchContactCounts[i]; + if(contactCount == 0) + continue; + + SolverContactCoulombHeader* header = reinterpret_cast(ptr2); + header->frictionOffset = PxU16(ptr - ptr2); + ptr2 += sizeof(SolverContactCoulombHeader) + header->numNormalConstr * pointStride; + + const PxContactPoint* contactBase0 = buffer.contacts + c.contactPatches[c.correlationListHeads[i]].start; + + PxVec3 normal = contactBase0->normal; + + const PxReal staticFriction = contactBase0->staticFriction; + const bool disableStrongFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + const bool haveFriction = (disableStrongFriction == 0); + + SolverFrictionHeader* frictionHeader = reinterpret_cast(ptr); + frictionHeader->numNormalConstr = PxTo8(c.frictionPatchContactCounts[i]); + frictionHeader->numFrictionConstr = PxTo8(haveFriction ? c.frictionPatchContactCounts[i] * frictionCountPerPoint : 0); + frictionHeader->flags = flags; + ptr += sizeof(SolverFrictionHeader); + PxF32* forceBuffer = reinterpret_cast(ptr); + ptr += frictionHeader->getAppliedForcePaddingSize(c.frictionPatchContactCounts[i]); + PxMemZero(forceBuffer, sizeof(PxF32) * c.frictionPatchContactCounts[i]); + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + + + const PxVec3 t0Fallback1(0.f, -normal.z, normal.y); + const PxVec3 t0Fallback2(-normal.y, normal.x, 0.f); + const PxVec3 tFallback1 = orthoThreshold > PxAbs(normal.x) ? t0Fallback1 : t0Fallback2; + const PxVec3 vrel = b0.getLinVel() - b1.getLinVel(); + const PxVec3 t0_ = vrel - normal * (normal.dot(vrel)); + const PxReal sqDist = t0_.dot(t0_); + const PxVec3 tDir0 = (sqDist > eps ? t0_: tFallback1).getNormalized(); + const PxVec3 tDir1 = tDir0.cross(normal); + PxVec3 tFallback[2] = {tDir0, tDir1}; + + PxU32 ind = 0; + + if(haveFriction) + { + hasFriction = true; + frictionHeader->setStaticFriction(staticFriction); + frictionHeader->invMass0D0 = invMassScale0; + frictionHeader->invMass1D1 = invMassScale1; + frictionHeader->angDom0 = invInertiaScale0; + frictionHeader->angDom1 = invInertiaScale1; + frictionHeader->type = frictionHeaderType; + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxU32 start = c.contactPatches[patch].start; + const PxContactPoint* contactBase = buffer.contacts + start; + + PxU8* p = ptr; + + for(PxU32 j =0; j < count; j++) + { + const PxContactPoint& contact = contactBase[j]; + const Vec3V ra = V3Sub(V3LoadA(contact.point), bodyFrame0p); + const Vec3V rb = V3Sub(V3LoadA(contact.point), bodyFrame1p); + + const Vec3V targetVel = V3LoadA(contact.targetVel); + const Vec3V pVRa = V3Add(vel0.linear, V3Cross(vel0.angular, ra)); + const Vec3V pVRb = V3Add(vel1.linear, V3Cross(vel1.angular, rb)); + //const PxVec3 vrel = pVRa - pVRb; + + for(PxU32 k = 0; k < frictionCountPerPoint; ++k) + { + SolverContactFrictionExt* PX_RESTRICT f0 = reinterpret_cast(p); + p += frictionStride; + + Vec3V t0 = V3LoadU(tFallback[ind]); + ind = 1 - ind; + const Vec3V raXn = V3Cross(ra, t0); + const Vec3V rbXn = V3Cross(rb, t0); + Cm::SpatialVectorV deltaV0, deltaV1; + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(t0, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(t0), V3Neg(rbXn), b1); + + FloatV unitResponse = getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, reinterpret_cast(Z)); + + FloatV tv = V3Dot(targetVel, t0); + if(b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + tv = FAdd(tv, V3Dot(pVRa, t0)); + else if(b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + tv = FSub(tv, V3Dot(pVRb, t0)); + + const FloatV recipResponse = FSel(FIsGrtr(unitResponse, FZero()), FRecip(unitResponse), FZero()); + + f0->raXnXYZ_velMultiplierW = V4SetW(Vec4V_From_Vec3V(resp0.angular), recipResponse); + f0->rbXnXYZ_biasW = V4SetW(V4Neg(Vec4V_From_Vec3V(resp1.angular)), FZero()); + f0->normalXYZ_appliedForceW = V4SetW(Vec4V_From_Vec3V(t0), FZero()); + FStore(tv, &f0->targetVel); + f0->linDeltaVA = deltaV0.linear; + f0->angDeltaVA = deltaV0.angular; + f0->linDeltaVB = deltaV1.linear; + f0->angDeltaVB = deltaV1.angular; + } + } + + ptr = p; + } + } + } + //PX_ASSERT(ptr - workspace == n.solverConstraintSize); + return hasFriction; +} + + +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationPImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationPImpl.h new file mode 100644 index 0000000..4213f56 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationPImpl.h @@ -0,0 +1,179 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_ARTICULATION_INTERFACE_H +#define DY_ARTICULATION_INTERFACE_H + +#include "DyArticulationUtils.h" + +namespace physx +{ +namespace Dy +{ + struct ArticulationSolverDesc; + +class ArticulationPImpl +{ +public: + + typedef PxU32 (*ComputeUnconstrainedVelocitiesFn)(const ArticulationSolverDesc& desc, + PxReal dt, + PxU32& acCount, + const PxVec3& gravity, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, + const PxReal invLengthScale); + + typedef void (*UpdateBodiesFn)(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* deltaV, PxReal dt); + + typedef void (*SaveVelocityFn)(const ArticulationSolverDesc &m, Cm::SpatialVectorF* deltaV); + + typedef void(*SaveVelocityTGSFn)(const ArticulationSolverDesc& m, PxReal invDtF32); + + typedef PxU32(*SetupInternalConstraintsTGSFn)(const ArticulationSolverDesc& desc, + PxReal dt, + PxReal invDt, + PxReal totalDt, + const PxReal biasCoefficient, + PxU32& acCount, + Cm::SpatialVectorF* Z); + + typedef void(*ComputeUnconstrainedVelocitiesTGSFn)(const ArticulationSolverDesc& desc, + PxReal dt, + const PxVec3& gravity, PxU64 contextID, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, + const PxReal invLengthScale); + + typedef void(*UpdateDeltaMotionFn)(const ArticulationSolverDesc &m, const PxReal dt, Cm::SpatialVectorF* DeltaV, const PxReal totalInvDt); + + typedef void(*DeltaMotionToMotionVelFn)(const ArticulationSolverDesc &m, const PxReal dt); + + static ComputeUnconstrainedVelocitiesFn sComputeUnconstrainedVelocities; + static UpdateBodiesFn sUpdateBodies; + static UpdateBodiesFn sUpdateBodiesTGS; + static SaveVelocityFn sSaveVelocity; + static SaveVelocityTGSFn sSaveVelocityTGS; + + static UpdateDeltaMotionFn sUpdateDeltaMotion; + static DeltaMotionToMotionVelFn sDeltaMotionToMotionVel; + static ComputeUnconstrainedVelocitiesTGSFn sComputeUnconstrainedVelocitiesTGS; + static SetupInternalConstraintsTGSFn sSetupInternalConstraintsTGS; + + static PxU32 computeUnconstrainedVelocities(const ArticulationSolverDesc& desc, + PxReal dt, + PxU32& acCount, + const PxVec3& gravity, + Cm::SpatialVectorF* Z, + Cm::SpatialVectorF* deltaV, + const PxReal invLengthScale) + { + PX_ASSERT(sComputeUnconstrainedVelocities); + if (sComputeUnconstrainedVelocities) + return (sComputeUnconstrainedVelocities)(desc, dt, acCount, + gravity, Z, deltaV, invLengthScale); + else + return 0; + } + + static void updateBodies(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, + PxReal dt) + { + PX_ASSERT(sUpdateBodies); + if (sUpdateBodies) + (*sUpdateBodies)(desc, tempDeltaV, dt); + } + + static void updateBodiesTGS(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, + PxReal dt) + { + PX_ASSERT(sUpdateBodiesTGS); + if (sUpdateBodiesTGS) + (*sUpdateBodiesTGS)(desc, tempDeltaV, dt); + } + + static void saveVelocity(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV) + { + PX_ASSERT(sSaveVelocity); + if (sSaveVelocity) + (*sSaveVelocity)(desc, tempDeltaV); + } + + + static void saveVelocityTGS(const ArticulationSolverDesc& desc, PxReal invDtF32) + { + PX_UNUSED(desc); + PX_UNUSED(invDtF32); + PX_ASSERT(sSaveVelocityTGS); + if (sSaveVelocityTGS) + (*sSaveVelocityTGS)(desc, invDtF32); + } + + static void computeUnconstrainedVelocitiesTGS(const ArticulationSolverDesc& desc, + PxReal dt, + const PxVec3& gravity, PxU64 contextID, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, + const PxReal invLengthScale) + { + PX_ASSERT(sComputeUnconstrainedVelocitiesTGS); + if (sComputeUnconstrainedVelocitiesTGS) + (sComputeUnconstrainedVelocitiesTGS)(desc, dt, gravity, contextID, Z, DeltaV, invLengthScale); + } + + static void updateDeltaMotion(const ArticulationSolverDesc& desc, const PxReal dt, Cm::SpatialVectorF* DeltaV, const PxReal totalInvDt) + { + PX_ASSERT(sUpdateDeltaMotion); + if (sUpdateDeltaMotion) + (*sUpdateDeltaMotion)(desc, dt, DeltaV, totalInvDt); + } + + static void deltaMotionToMotionVel(const ArticulationSolverDesc& desc, const PxReal invDt) + { + PX_ASSERT(sDeltaMotionToMotionVel); + if (sDeltaMotionToMotionVel) + (*sDeltaMotionToMotionVel)(desc, invDt); + } + + static PxU32 setupSolverInternalConstraintsTGS(const ArticulationSolverDesc& desc, + PxReal dt, + PxReal invDt, + PxReal totalDt, + const PxReal biasCoefficient, + PxU32& acCount, + Cm::SpatialVectorF* Z) + { + PX_ASSERT(sSetupInternalConstraintsTGS); + if (sSetupInternalConstraintsTGS) + return sSetupInternalConstraintsTGS(desc, dt, invDt, + totalDt, biasCoefficient, acCount, Z); + return 0; + + } +}; + + +} +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationUtils.h new file mode 100644 index 0000000..66db78f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyArticulationUtils.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_ARTICULATION_UTILS_H +#define DY_ARTICULATION_UTILS_H + +#include "foundation/PxBitUtils.h" +#include "foundation/PxVecMath.h" +#include "CmSpatialVector.h" +#include "DySpatial.h" +#include "DyVArticulation.h" + +namespace physx +{ + +namespace Dy +{ + struct ArticulationCore; + struct ArticulationLink; + +#define DY_ARTICULATION_DEBUG_VERIFY 0 + +PX_FORCE_INLINE PxU32 ArticulationLowestSetBit(ArticulationBitField val) +{ + PxU32 low = PxU32(val&0xffffffff), high = PxU32(val>>32); + PxU32 mask = PxU32((!low)-1); + PxU32 result = (mask&PxLowestSetBitUnsafe(low)) | ((~mask)&(PxLowestSetBitUnsafe(high)+32)); + PX_ASSERT(val & (PxU64(1)<> 32); + PxU32 mask = PxU32((!high) - 1); + PxU32 result = ((~mask)&PxHighestSetBitUnsafe(low)) | ((mask)&(PxHighestSetBitUnsafe(high) + 32)); + PX_ASSERT(val & (PxU64(1) << result)); + return result; +} + +using namespace aos; + +PX_FORCE_INLINE Cm::SpatialVector& unsimdRef(Cm::SpatialVectorV& v) { return reinterpret_cast(v); } +PX_FORCE_INLINE const Cm::SpatialVector& unsimdRef(const Cm::SpatialVectorV& v) { return reinterpret_cast(v); } + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyBodyCoreIntegrator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyBodyCoreIntegrator.h new file mode 100644 index 0000000..a128a79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyBodyCoreIntegrator.h @@ -0,0 +1,390 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_BODYCORE_INTEGRATOR_H +#define DY_BODYCORE_INTEGRATOR_H + +#include "PxvDynamics.h" +#include "PxsRigidBody.h" +#include "DySolverBody.h" +#include "DySleepingConfigulation.h" +#include "PxsIslandSim.h" + +namespace physx +{ + +namespace Dy +{ + +PX_FORCE_INLINE void bodyCoreComputeUnconstrainedVelocity +(const PxVec3& gravity, const PxReal dt, const PxReal linearDamping, const PxReal angularDamping, const PxReal accelScale, +const PxReal maxLinearVelocitySq, const PxReal maxAngularVelocitySq, PxVec3& inOutLinearVelocity, PxVec3& inOutAngularVelocity, +bool disableGravity) +{ + + //Multiply everything that needs multiplied by dt to improve code generation. + + PxVec3 linearVelocity = inOutLinearVelocity; + PxVec3 angularVelocity = inOutAngularVelocity; + + const PxReal linearDampingTimesDT=linearDamping*dt; + const PxReal angularDampingTimesDT=angularDamping*dt; + const PxReal oneMinusLinearDampingTimesDT=1.0f-linearDampingTimesDT; + const PxReal oneMinusAngularDampingTimesDT=1.0f-angularDampingTimesDT; + + //TODO context-global gravity + if (!disableGravity) + { + const PxVec3 linearAccelTimesDT = gravity*dt *accelScale; + linearVelocity += linearAccelTimesDT; + } + + //Apply damping. + const PxReal linVelMultiplier = physx::intrinsics::fsel(oneMinusLinearDampingTimesDT, oneMinusLinearDampingTimesDT, 0.0f); + const PxReal angVelMultiplier = physx::intrinsics::fsel(oneMinusAngularDampingTimesDT, oneMinusAngularDampingTimesDT, 0.0f); + linearVelocity*=linVelMultiplier; + angularVelocity*=angVelMultiplier; + + // Clamp velocity + const PxReal linVelSq = linearVelocity.magnitudeSquared(); + if(linVelSq > maxLinearVelocitySq) + { + linearVelocity *= PxSqrt(maxLinearVelocitySq / linVelSq); + } + const PxReal angVelSq = angularVelocity.magnitudeSquared(); + if(angVelSq > maxAngularVelocitySq) + { + angularVelocity *= PxSqrt(maxAngularVelocitySq / angVelSq); + } + + inOutLinearVelocity = linearVelocity; + inOutAngularVelocity = angularVelocity; +} + + +PX_FORCE_INLINE void integrateCore(PxVec3& motionLinearVelocity, PxVec3& motionAngularVelocity, + PxSolverBody& solverBody, PxSolverBodyData& solverBodyData, const PxF32 dt, const PxU32 lockFlags) +{ + if (lockFlags) + { + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + { + motionLinearVelocity.x = 0.f; + solverBody.linearVelocity.x = 0.f; + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + { + motionLinearVelocity.y = 0.f; + solverBody.linearVelocity.y = 0.f; + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + { + motionLinearVelocity.z = 0.f; + solverBody.linearVelocity.z = 0.f; + } + + //The angular velocity should be 0 because it is now impossible to make it rotate around that axis! + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + { + motionAngularVelocity.x = 0.f; + solverBody.angularState.x = 0.f; + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + { + motionAngularVelocity.y = 0.f; + solverBody.angularState.y = 0.f; + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + { + motionAngularVelocity.z = 0.f; + solverBody.angularState.z = 0.f; + } + } + + // Integrate linear part + PxVec3 linearMotionVel = solverBodyData.linearVelocity + motionLinearVelocity; + PxVec3 delta = linearMotionVel * dt; + PxVec3 angularMotionVel = solverBodyData.angularVelocity + solverBodyData.sqrtInvInertia * motionAngularVelocity; + PxReal w = angularMotionVel.magnitudeSquared(); + solverBodyData.body2World.p += delta; + PX_ASSERT(solverBodyData.body2World.p.isFinite()); + + //Store back the linear and angular velocities + //core.linearVelocity += solverBody.linearVelocity * solverBodyData.sqrtInvMass; + solverBodyData.linearVelocity += solverBody.linearVelocity; + solverBodyData.angularVelocity += solverBodyData.sqrtInvInertia * solverBody.angularState; + + // Integrate the rotation using closed form quaternion integrator + if (w != 0.0f) + { + w = PxSqrt(w); + // Perform a post-solver clamping + // TODO(dsequeira): ignore this for the moment + //just clamp motionVel to half float-range + const PxReal maxW = 1e+7f; //Should be about sqrt(PX_MAX_REAL/2) or smaller + if (w > maxW) + { + angularMotionVel = angularMotionVel.getNormalized() * maxW; + w = maxW; + } + const PxReal v = dt * w * 0.5f; + PxReal s, q; + PxSinCos(v, s, q); + s /= w; + + const PxVec3 pqr = angularMotionVel * s; + const PxQuat quatVel(pqr.x, pqr.y, pqr.z, 0); + PxQuat result = quatVel * solverBodyData.body2World.q; + + result += solverBodyData.body2World.q * q; + + solverBodyData.body2World.q = result.getNormalized(); + PX_ASSERT(solverBodyData.body2World.q.isSane()); + PX_ASSERT(solverBodyData.body2World.q.isFinite()); + } + + motionLinearVelocity = linearMotionVel; + motionAngularVelocity = angularMotionVel; +} + + +// PT: TODO: why do we force-inline this? +PX_FORCE_INLINE PxReal _updateWakeCounter(PxsRigidBody* originalBody, PxReal dt, PxReal /*invDt*/, const bool enableStabilization, const Cm::SpatialVector& motionVelocity, + bool hasStaticTouch) +{ + PxsBodyCore& bodyCore = originalBody->getCore(); + + // update the body's sleep state and + PxReal wakeCounterResetTime = 20.0f*0.02f; + + PxReal wc = bodyCore.wakeCounter; + + { + if (enableStabilization) + { + bool freeze = false; + const PxTransform& body2World = bodyCore.body2World; + + // calculate normalized energy: kinetic energy divided by mass + + const PxVec3& t = bodyCore.inverseInertia; + const PxVec3 inertia(t.x > 0.f ? 1.0f / t.x : 1.f, t.y > 0.f ? 1.0f / t.y : 1.f, t.z > 0.f ? 1.0f / t.z : 1.f); + + const PxVec3& sleepLinVelAcc = motionVelocity.linear; + const PxVec3 sleepAngVelAcc = body2World.q.rotateInv(motionVelocity.angular); + + // scale threshold by cluster factor (more contacts => higher sleep threshold) + //const PxReal clusterFactor = PxReal(1u + getNumUniqueInteractions()); + + PxReal invMass = bodyCore.inverseMass; + if (invMass == 0.f) + invMass = 1.f; + + const PxReal angular = sleepAngVelAcc.multiply(sleepAngVelAcc).dot(inertia) * invMass; + const PxReal linear = sleepLinVelAcc.magnitudeSquared(); + const PxReal frameNormalizedEnergy = 0.5f * (angular + linear); + + const PxReal cf = hasStaticTouch ? PxReal(PxMin(10u, bodyCore.numCountedInteractions)) : 0.f; + const PxReal freezeThresh = cf*bodyCore.freezeThreshold; + + originalBody->freezeCount = PxMax(originalBody->freezeCount - dt, 0.0f); + bool settled = true; + + PxReal accelScale = PxMin(1.f, originalBody->accelScale + dt); + + if (frameNormalizedEnergy >= freezeThresh) + { + settled = false; + originalBody->freezeCount = PXD_FREEZE_INTERVAL; + } + + if (!hasStaticTouch) + { + accelScale = 1.f; + settled = false; + } + + + if (settled) + { + //Dampen bodies that are just about to go to sleep + if (cf > 1.f) + { + const PxReal sleepDamping = PXD_SLEEP_DAMPING; + const PxReal sleepDampingTimesDT = sleepDamping*dt; + const PxReal d = 1.0f - sleepDampingTimesDT; + bodyCore.linearVelocity = bodyCore.linearVelocity * d; + bodyCore.angularVelocity = bodyCore.angularVelocity * d; + accelScale = accelScale * 0.75f + 0.25f*PXD_FREEZE_SCALE; + } + freeze = originalBody->freezeCount == 0.f && frameNormalizedEnergy < (bodyCore.freezeThreshold * PXD_FREEZE_TOLERANCE); + } + + originalBody->accelScale = accelScale; + + const PxU32 wasFrozen = originalBody->mInternalFlags & PxsRigidBody::eFROZEN; + PxU16 flags; + if(freeze) + { + //current flag isn't frozen but freeze flag raise so we need to raise the frozen flag in this frame + flags = PxU16(PxsRigidBody::eFROZEN); + if(!wasFrozen) + flags |= PxsRigidBody::eFREEZE_THIS_FRAME; + bodyCore.body2World = originalBody->getLastCCDTransform(); + } + else + { + flags = 0; + if(wasFrozen) + flags |= PxsRigidBody::eUNFREEZE_THIS_FRAME; + } + originalBody->mInternalFlags = flags; + + /*KS: New algorithm for sleeping when using stabilization: + * Energy *this frame* must be higher than sleep threshold and accumulated energy over previous frames + * must be higher than clusterFactor*energyThreshold. + */ + if (wc < wakeCounterResetTime * 0.5f || wc < dt) + { + //Accumulate energy + originalBody->sleepLinVelAcc += sleepLinVelAcc; + originalBody->sleepAngVelAcc += sleepAngVelAcc; + + //If energy this frame is high + if (frameNormalizedEnergy >= bodyCore.sleepThreshold) + { + //Compute energy over sleep preparation time + const PxReal sleepAngular = originalBody->sleepAngVelAcc.multiply(originalBody->sleepAngVelAcc).dot(inertia) * invMass; + const PxReal sleepLinear = originalBody->sleepLinVelAcc.magnitudeSquared(); + const PxReal normalizedEnergy = 0.5f * (sleepAngular + sleepLinear); + const PxReal sleepClusterFactor = PxReal(1u + bodyCore.numCountedInteractions); + // scale threshold by cluster factor (more contacts => higher sleep threshold) + const PxReal threshold = sleepClusterFactor*bodyCore.sleepThreshold; + + //If energy over sleep preparation time is high + if (normalizedEnergy >= threshold) + { + //Wake up + //PX_ASSERT(isActive()); + originalBody->sleepAngVelAcc = PxVec3(0); + originalBody->sleepLinVelAcc = PxVec3(0); + + const float factor = bodyCore.sleepThreshold == 0.f ? 2.0f : PxMin(normalizedEnergy / threshold, 2.0f); + PxReal oldWc = wc; + wc = factor * 0.5f * wakeCounterResetTime + dt * (sleepClusterFactor - 1.0f); + bodyCore.solverWakeCounter = wc; + //if (oldWc == 0.0f) // for the case where a sleeping body got activated by the system (not the user) AND got processed by the solver as well + // notifyNotReadyForSleeping(bodyCore.nodeIndex); + + if (oldWc == 0.0f) + originalBody->mInternalFlags |= PxsRigidBody::eACTIVATE_THIS_FRAME; + + return wc; + } + } + } + + } + else + { + if (wc < wakeCounterResetTime * 0.5f || wc < dt) + { + const PxTransform& body2World = bodyCore.body2World; + + // calculate normalized energy: kinetic energy divided by mass + const PxVec3& t = bodyCore.inverseInertia; + const PxVec3 inertia(t.x > 0.f ? 1.0f / t.x : 1.f, t.y > 0.f ? 1.0f / t.y : 1.f, t.z > 0.f ? 1.0f / t.z : 1.f); + + const PxVec3& sleepLinVelAcc = motionVelocity.linear; + const PxVec3 sleepAngVelAcc = body2World.q.rotateInv(motionVelocity.angular); + + originalBody->sleepLinVelAcc += sleepLinVelAcc; + originalBody->sleepAngVelAcc += sleepAngVelAcc; + + PxReal invMass = bodyCore.inverseMass; + if (invMass == 0.f) + invMass = 1.f; + + const PxReal angular = originalBody->sleepAngVelAcc.multiply(originalBody->sleepAngVelAcc).dot(inertia) * invMass; + const PxReal linear = originalBody->sleepLinVelAcc.magnitudeSquared(); + const PxReal normalizedEnergy = 0.5f * (angular + linear); + + // scale threshold by cluster factor (more contacts => higher sleep threshold) + const PxReal clusterFactor = PxReal(1 + bodyCore.numCountedInteractions); + const PxReal threshold = clusterFactor*bodyCore.sleepThreshold; + + if (normalizedEnergy >= threshold) + { + //PX_ASSERT(isActive()); + originalBody->sleepLinVelAcc = PxVec3(0); + originalBody->sleepAngVelAcc = PxVec3(0); + const float factor = threshold == 0.f ? 2.0f : PxMin(normalizedEnergy / threshold, 2.0f); + PxReal oldWc = wc; + wc = factor * 0.5f * wakeCounterResetTime + dt * (clusterFactor - 1.0f); + bodyCore.solverWakeCounter = wc; + PxU16 flags = 0; + if (oldWc == 0.0f) // for the case where a sleeping body got activated by the system (not the user) AND got processed by the solver as well + { + flags |= PxsRigidBody::eACTIVATE_THIS_FRAME; + //notifyNotReadyForSleeping(bodyCore.nodeIndex); + } + + originalBody->mInternalFlags = flags; + + return wc; + } + } + } + } + + wc = PxMax(wc - dt, 0.0f); + bodyCore.solverWakeCounter = wc; + return wc; +} + +PX_FORCE_INLINE void sleepCheck(PxsRigidBody* originalBody, const PxReal dt, const PxReal intDt, const bool enableStabilization, const Cm::SpatialVector& motionVelocity, + bool hasStaticTouch) +{ + const PxReal wc = _updateWakeCounter(originalBody, dt, intDt, enableStabilization, motionVelocity, hasStaticTouch); + const bool wakeCounterZero = (wc == 0.0f); + + if (wakeCounterZero) + { + //PxsBodyCore& bodyCore = originalBody->getCore(); + originalBody->mInternalFlags |= PxsRigidBody::eDEACTIVATE_THIS_FRAME; + // notifyReadyForSleeping(bodyCore.nodeIndex); + originalBody->sleepLinVelAcc = PxVec3(0); + originalBody->sleepAngVelAcc = PxVec3(0); + } +} + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp new file mode 100644 index 0000000..ed77fdc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.cpp @@ -0,0 +1,1063 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "DyConstraintPartition.h" +#include "DyArticulationUtils.h" +#include "DySoftBody.h" +#include "foundation/PxHashMap.h" +#include "DyFeatherstoneArticulation.h" + +#define INTERLEAVE_SELF_CONSTRAINTS 1 + +namespace physx +{ +namespace Dy +{ + +namespace +{ + +#define MAX_NUM_PARTITIONS 32 + + +class RigidBodyClassification +{ + PxU8* PX_RESTRICT mBodies; + PxU32 mBodySize; + PxU32 mBodyStride; + PxU32 mBodyCount; + +public: + RigidBodyClassification(PxU8* PX_RESTRICT bodies, PxU32 bodyCount, PxU32 bodyStride) : mBodies(bodies), mBodySize(bodyCount*bodyStride), mBodyStride(bodyStride), + mBodyCount(bodyCount) + { + } + + //Returns true if it is a dynamic-dynamic constraint; false if it is a dynamic-static or dynamic-kinematic constraint + PX_FORCE_INLINE bool classifyConstraint(const PxSolverConstraintDesc& desc, uintptr_t& indexA, uintptr_t& indexB, + bool& activeA, bool& activeB, PxU32& bodyAProgress, PxU32& bodyBProgress) const + { + indexA=uintptr_t(reinterpret_cast(desc.bodyA) - mBodies)/mBodyStride; + indexB=uintptr_t(reinterpret_cast(desc.bodyB) - mBodies)/mBodyStride; + activeA = indexA < mBodyCount; + activeB = indexB < mBodyCount; + bodyAProgress = desc.bodyA->solverProgress; + bodyBProgress = desc.bodyB->solverProgress; + return activeA && activeB; + } + + PX_FORCE_INLINE void getProgress(const PxSolverConstraintDesc& desc, + PxU32& bodyAProgress, PxU32& bodyBProgress) + { + bodyAProgress = desc.bodyA->solverProgress; + bodyBProgress = desc.bodyB->solverProgress; + } + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, const PxU32 bodyAProgress, const PxU32 bodyBProgress, + const PxU16 availablePartition) + { + desc.bodyA->solverProgress = bodyAProgress; + desc.bodyA->maxSolverNormalProgress = PxMax(desc.bodyA->maxSolverNormalProgress, availablePartition); + desc.bodyB->solverProgress = bodyBProgress; + desc.bodyB->maxSolverNormalProgress = PxMax(desc.bodyB->maxSolverNormalProgress, availablePartition); + } + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, const PxU32 bodyAProgress, const PxU32 bodyBProgress) + { + desc.bodyA->solverProgress = bodyAProgress; + desc.bodyB->solverProgress = bodyBProgress; + } + + PX_FORCE_INLINE PxU32 getStaticContactWriteIndex(const PxSolverConstraintDesc& desc, + bool activeA, bool activeB) + { + if (activeA) + return PxU32(desc.bodyA->maxSolverNormalProgress + desc.bodyA->maxSolverFrictionProgress++); + else if (activeB) + return PxU32(desc.bodyB->maxSolverNormalProgress + desc.bodyB->maxSolverFrictionProgress++); + + return 0xffffffff; + + } + + PX_FORCE_INLINE void recordStaticConstraint(const PxSolverConstraintDesc& desc, bool activeA, bool activeB) const + { + if (activeA) + { + desc.bodyA->maxSolverFrictionProgress++; + } + + if (activeB) + { + desc.bodyB->maxSolverFrictionProgress++; + } + } + + PX_FORCE_INLINE void getProgressRequirements(const PxSolverConstraintDesc& desc, PxU32& progressA, PxU32& progressB) const + { + uintptr_t indexA = uintptr_t(reinterpret_cast(desc.bodyA) - mBodies) / mBodyStride; + uintptr_t indexB = uintptr_t(reinterpret_cast(desc.bodyB) - mBodies) / mBodyStride; + bool activeA = indexA < mBodyCount; + bool activeB = indexB < mBodyCount; + + if (activeA) + progressA = desc.bodyA->maxSolverFrictionProgress++; + else + progressA = 0; + if (activeB) + progressB = desc.bodyB->maxSolverFrictionProgress++; + else + progressB = 0; + } + + PX_FORCE_INLINE void clearState() + { + for(PxU32 a = 0; a < mBodySize; a+= mBodyStride) + reinterpret_cast(mBodies+a)->solverProgress = 0; + } + + PX_FORCE_INLINE void reserveSpaceForStaticConstraints(PxArray& numConstraintsPerPartition) + { + for(PxU32 a = 0; a < mBodySize; a += mBodyStride) + { + PxSolverBody& body = *reinterpret_cast(mBodies+a); + body.solverProgress = 0; + + PxU32 requiredSize = PxU32(body.maxSolverNormalProgress + body.maxSolverFrictionProgress); + if(requiredSize > numConstraintsPerPartition.size()) + { + numConstraintsPerPartition.resize(requiredSize); + } + + for(PxU32 b = 0; b < body.maxSolverFrictionProgress; ++b) + { + numConstraintsPerPartition[body.maxSolverNormalProgress + b]++; + } + } + } +}; + +class ExtendedRigidBodyClassification +{ + PxU8* PX_RESTRICT mBodies; + PxU32 mBodyCount; + PxU32 mBodySize; + PxU32 mStride; + Dy::FeatherstoneArticulation** PX_RESTRICT mArticulations; + PxU32 mNumArticulations; + bool mForceStaticCollisionsToSolver; + +public: + + ExtendedRigidBodyClassification(PxU8* PX_RESTRICT bodies, PxU32 numBodies, PxU32 stride, Dy::FeatherstoneArticulation** articulations, PxU32 numArticulations, + bool forceStaticCollisionsToSolver) + : mBodies(bodies), mBodyCount(numBodies), mBodySize(numBodies*stride), mStride(stride), mArticulations(articulations), mNumArticulations(numArticulations), + mForceStaticCollisionsToSolver(forceStaticCollisionsToSolver) + { + for (PxU32 i = 0; i < mNumArticulations; ++i) + { + mArticulations[i]->mArticulationIndex = PxTo16(i); + } + } + + //Returns true if it is a dynamic-dynamic constraint; false if it is a dynamic-static or dynamic-kinematic constraint + PX_FORCE_INLINE bool classifyConstraint(const PxSolverConstraintDesc& desc, uintptr_t& indexA, uintptr_t& indexB, + bool& activeA, bool& activeB, PxU32& bodyAProgress, PxU32& bodyBProgress) const + { + bool hasStatic = false; + if(desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + indexA=uintptr_t(reinterpret_cast(desc.bodyA) - mBodies)/mStride; + activeA = indexA < mBodyCount; + hasStatic = !activeA;//desc.bodyADataIndex == 0; + bodyAProgress = activeA ? desc.bodyA->solverProgress: 0; + } + else + { + + FeatherstoneArticulation* articulationA = getArticulationA(desc); + indexA=mBodyCount+ articulationA->mArticulationIndex; + //bodyAProgress = articulationA->getFsDataPtr()->solverProgress; + bodyAProgress = articulationA->solverProgress; + activeA = true; + } + + if(desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + indexB=uintptr_t(reinterpret_cast(desc.bodyB) - mBodies)/mStride; + activeB = indexB < mBodyCount; + hasStatic = hasStatic || !activeB; + bodyBProgress = activeB ? desc.bodyB->solverProgress : 0; + } + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + indexB=mBodyCount+ articulationB->mArticulationIndex; + activeB = true; + bodyBProgress = articulationB->solverProgress; + } + return !hasStatic; + } + + PX_FORCE_INLINE void getProgress(const PxSolverConstraintDesc& desc, + PxU32& bodyAProgress, PxU32& bodyBProgress) const + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + bodyAProgress = desc.bodyA->solverProgress; + } + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + bodyAProgress = articulationA->solverProgress; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + bodyBProgress = desc.bodyB->solverProgress; + } + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + bodyBProgress = articulationB->solverProgress; + } + } + + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, const PxU32 bodyAProgress, const PxU32 bodyBProgress, + const PxU16 availablePartition) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + desc.bodyA->solverProgress = bodyAProgress; + desc.bodyA->maxSolverNormalProgress = PxMax(desc.bodyA->maxSolverNormalProgress, availablePartition); + } + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + articulationA->solverProgress = bodyAProgress; + articulationA->maxSolverNormalProgress = PxMax(articulationA->maxSolverNormalProgress, availablePartition); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + desc.bodyB->solverProgress = bodyBProgress; + desc.bodyB->maxSolverNormalProgress = PxMax(desc.bodyB->maxSolverNormalProgress, availablePartition); + } + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + articulationB->solverProgress = bodyBProgress; + articulationB->maxSolverNormalProgress = PxMax(articulationB->maxSolverNormalProgress, availablePartition); + } + } + + PX_FORCE_INLINE void storeProgress(const PxSolverConstraintDesc& desc, const PxU32 bodyAProgress, + const PxU32 bodyBProgress) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + desc.bodyA->solverProgress = bodyAProgress; + } + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + articulationA->solverProgress = bodyAProgress; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + desc.bodyB->solverProgress = bodyBProgress; + } + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + articulationB->solverProgress = bodyBProgress; + } + } + + PX_FORCE_INLINE void recordStaticConstraint(const PxSolverConstraintDesc& desc, bool& activeA, bool& activeB) + { + if (activeA) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + desc.bodyA->maxSolverFrictionProgress++; + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + if(!articulationA->willStoreStaticConstraint() || mForceStaticCollisionsToSolver) + articulationA->maxSolverFrictionProgress++; + } + } + + if (activeB) + { + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + desc.bodyB->maxSolverFrictionProgress++; + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + if (!articulationB->willStoreStaticConstraint() || mForceStaticCollisionsToSolver) + articulationB->maxSolverFrictionProgress++; + } + } + } + + PX_FORCE_INLINE void getProgressRequirements(const PxSolverConstraintDesc& desc, PxU32& progressA, PxU32& progressB) const + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + uintptr_t indexA = uintptr_t(reinterpret_cast(desc.bodyA) - mBodies) / mStride; + if(indexA < mBodyCount) + progressA = desc.bodyA->maxSolverFrictionProgress++; + else + progressA = 0; + } + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + progressA = articulationA->maxSolverFrictionProgress++; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + uintptr_t indexB = uintptr_t(reinterpret_cast(desc.bodyB) - mBodies) / mStride; + if(indexB < mBodyCount) + progressB = desc.bodyB->maxSolverFrictionProgress++; + else + progressB = 0; + } + else + { + if (desc.articulationA != desc.articulationB) + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + progressB = articulationB->maxSolverFrictionProgress++; + } + else + progressB = progressA; + } + } + + PX_FORCE_INLINE PxU32 getStaticContactWriteIndex(const PxSolverConstraintDesc& desc, + bool activeA, bool activeB) + { + if (activeA) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + return PxU32(desc.bodyA->maxSolverNormalProgress + desc.bodyA->maxSolverFrictionProgress++); + } + else + { + FeatherstoneArticulation* articulationA = getArticulationA(desc); + //Attempt to store static constraints on the articulation (only supported with the reduced coordinate articulations). + //This acts as an optimization + if(!mForceStaticCollisionsToSolver && articulationA->storeStaticConstraint(desc)) + return 0xffffffff; + return PxU32(articulationA->maxSolverNormalProgress + articulationA->maxSolverFrictionProgress++); + } + } + else if (activeB) + { + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + return PxU32(desc.bodyB->maxSolverNormalProgress + desc.bodyB->maxSolverFrictionProgress++); + } + else + { + FeatherstoneArticulation* articulationB = getArticulationB(desc); + //Attempt to store static constraints on the articulation (only supported with the reduced coordinate articulations). + //This acts as an optimization + if (!mForceStaticCollisionsToSolver && articulationB->storeStaticConstraint(desc)) + return 0xffffffff; + return PxU32(articulationB->maxSolverNormalProgress + articulationB->maxSolverFrictionProgress++); + } + } + + return 0xffffffff; + } + + PX_FORCE_INLINE void clearState() + { + for(PxU32 a = 0; a < mBodySize; a+= mStride) + reinterpret_cast(mBodies+a)->solverProgress = 0; + + for(PxU32 a = 0; a < mNumArticulations; ++a) + (reinterpret_cast(mArticulations[a]))->solverProgress = 0; + } + + PX_FORCE_INLINE void reserveSpaceForStaticConstraints(PxArray& numConstraintsPerPartition) + { + for(PxU32 a = 0; a < mBodySize; a+= mStride) + { + PxSolverBody& body = *reinterpret_cast(mBodies+a); + body.solverProgress = 0; + + PxU32 requiredSize = PxU32(body.maxSolverNormalProgress + body.maxSolverFrictionProgress); + if(requiredSize > numConstraintsPerPartition.size()) + { + numConstraintsPerPartition.resize(requiredSize); + } + + for(PxU32 b = 0; b < body.maxSolverFrictionProgress; ++b) + { + numConstraintsPerPartition[body.maxSolverNormalProgress + b]++; + } + } + + for(PxU32 a = 0; a < mNumArticulations; ++a) + { + FeatherstoneArticulation* articulation = reinterpret_cast(mArticulations[a]); + articulation->solverProgress = 0; + + PxU32 requiredSize = PxU32(articulation->maxSolverNormalProgress + articulation->maxSolverFrictionProgress); + if(requiredSize > numConstraintsPerPartition.size()) + { + numConstraintsPerPartition.resize(requiredSize); + } + + for(PxU32 b = 0; b < articulation->maxSolverFrictionProgress; ++b) + { + numConstraintsPerPartition[articulation->maxSolverNormalProgress + b]++; + } + } + } + +}; + +template +PxU32 classifyConstraintDesc(const PxSolverConstraintDesc* PX_RESTRICT descs, const PxU32 numConstraints, Classification& classification, + PxArray& numConstraintsPerPartition, PxSolverConstraintDesc* PX_RESTRICT eaTempConstraintDescriptors, + const PxU32 maxPartitions) +{ + const PxSolverConstraintDesc* _desc = descs; + const PxU32 numConstraintsMin1 = numConstraints - 1; + + PxU32 numUnpartitionedConstraints = 0; + + numConstraintsPerPartition.forceSize_Unsafe(32); + + PxMemZero(numConstraintsPerPartition.begin(), sizeof(PxU32) * 32); + + for(PxU32 i = 0; i < numConstraints; ++i, _desc++) + { + const PxU32 prefetchOffset = PxMin(numConstraintsMin1 - i, 4u); + PxPrefetchLine(_desc[prefetchOffset].constraint); + PxPrefetchLine(_desc[prefetchOffset].bodyA); + PxPrefetchLine(_desc[prefetchOffset].bodyB); + PxPrefetchLine(_desc + 8); + + uintptr_t indexA, indexB; + bool activeA, activeB; + + PxU32 partitionsA, partitionsB; + const bool notContainsStatic = classification.classifyConstraint(*_desc, indexA, indexB, activeA, activeB, + partitionsA, partitionsB); + + if(notContainsStatic) + { + PxU32 availablePartition; + { + const PxU32 combinedMask = (~partitionsA & ~partitionsB); + availablePartition = combinedMask == 0 ? MAX_NUM_PARTITIONS : PxLowestSetBit(combinedMask); + if(availablePartition == MAX_NUM_PARTITIONS) + { + eaTempConstraintDescriptors[numUnpartitionedConstraints++] = *_desc; + continue; + } + + const PxU32 partitionBit = (1u << availablePartition); + if (activeA) + partitionsA |= partitionBit; + if(activeB) + partitionsB |= partitionBit; + } + + numConstraintsPerPartition[availablePartition]++; + availablePartition++; + + classification.storeProgress(*_desc, partitionsA, partitionsB, PxU16(availablePartition)); + } + else + { + classification.recordStaticConstraint(*_desc, activeA, activeB); + } + } + + PxU32 partitionStartIndex = 0; + + while (numUnpartitionedConstraints > 0) + { + classification.clearState(); + + partitionStartIndex += 32; + + if(maxPartitions <= partitionStartIndex) + break; + + //Keep partitioning the un-partitioned constraints and blat the whole thing to 0! + numConstraintsPerPartition.resize(32 + numConstraintsPerPartition.size()); + PxMemZero(numConstraintsPerPartition.begin() + partitionStartIndex, sizeof(PxU32) * 32); + + PxU32 newNumUnpartitionedConstraints = 0; + PxU32 partitionsA, partitionsB; + bool activeA, activeB; + uintptr_t indexA, indexB; + for (PxU32 i = 0; i < numUnpartitionedConstraints; ++i) + { + const PxSolverConstraintDesc& desc = eaTempConstraintDescriptors[i]; + + classification.classifyConstraint(desc, indexA, indexB, activeA, activeB, + partitionsA, partitionsB); + + PxU32 availablePartition; + { + const PxU32 combinedMask = (~partitionsA & ~partitionsB); + availablePartition = combinedMask == 0 ? MAX_NUM_PARTITIONS : PxLowestSetBit(combinedMask); + if (availablePartition == MAX_NUM_PARTITIONS) + { + //Need to shuffle around unpartitioned constraints... + eaTempConstraintDescriptors[newNumUnpartitionedConstraints++] = desc; + continue; + } + + const PxU32 partitionBit = (1u << availablePartition); + if (activeA) + partitionsA |= partitionBit; + if (activeB) + partitionsB |= partitionBit; + } + + + /*desc.bodyA->solverProgress = partitionsA; + desc.bodyB->solverProgress = partitionsB;*/ + availablePartition += partitionStartIndex; + numConstraintsPerPartition[availablePartition]++; + availablePartition++; + + classification.storeProgress(desc, partitionsA, partitionsB, PxU16(availablePartition)); + + /* desc.bodyA->maxSolverNormalProgress = PxMax(desc.bodyA->maxSolverNormalProgress, PxU16(availablePartition)); + desc.bodyB->maxSolverNormalProgress = PxMax(desc.bodyB->maxSolverNormalProgress, PxU16(availablePartition));*/ + } + + numUnpartitionedConstraints = newNumUnpartitionedConstraints; + } + + classification.reserveSpaceForStaticConstraints(numConstraintsPerPartition); + + return numUnpartitionedConstraints; +} + +template +PxU32 writeConstraintDesc(const PxSolverConstraintDesc* PX_RESTRICT descs, const PxU32 numConstraints, Classification& classification, + PxArray& accumulatedConstraintsPerPartition, PxSolverConstraintDesc* eaTempConstraintDescriptors, + PxSolverConstraintDesc* PX_RESTRICT eaOrderedConstraintDesc, PxU32 maxPartitions, const PxU32 numOverflows) +{ + PX_UNUSED(eaTempConstraintDescriptors); + const PxSolverConstraintDesc* _desc = descs; + const PxU32 numConstraintsMin1 = numConstraints - 1; + + PxU32 numUnpartitionedConstraints = 0; + PxU32 numStaticConstraints = 0; + + for(PxU32 i = 0; i < numConstraints; ++i, _desc++) + { + const PxU32 prefetchOffset = PxMin(numConstraintsMin1 - i, 4u); + PxPrefetchLine(_desc[prefetchOffset].constraint); + PxPrefetchLine(_desc[prefetchOffset].bodyA); + PxPrefetchLine(_desc[prefetchOffset].bodyB); + PxPrefetchLine(_desc + 8); + + uintptr_t indexA, indexB; + bool activeA, activeB; + PxU32 partitionsA, partitionsB; + const bool notContainsStatic = classification.classifyConstraint(*_desc, indexA, indexB, activeA, activeB, partitionsA, partitionsB); + + if(notContainsStatic) + { + PxU32 availablePartition; + { + const PxU32 combinedMask = (~partitionsA & ~partitionsB); + availablePartition = combinedMask == 0 ? MAX_NUM_PARTITIONS : PxLowestSetBit(combinedMask); + if(availablePartition == MAX_NUM_PARTITIONS) + { + eaTempConstraintDescriptors[numUnpartitionedConstraints++] = *_desc; + continue; + } + + const PxU32 partitionBit = (1u << availablePartition); + if(activeA) + partitionsA |= partitionBit; + if(activeB) + partitionsB |= partitionBit; + } + + classification.storeProgress(*_desc, partitionsA, partitionsB, PxU16(availablePartition + 1)); + + eaOrderedConstraintDesc[numOverflows + accumulatedConstraintsPerPartition[availablePartition]++] = *_desc; + } + else + { + //Just count the number of static constraints and store in maxSolverFrictionProgress... + PxU32 index = classification.getStaticContactWriteIndex(*_desc, activeA, activeB); + if (index != 0xffffffff) + { + eaOrderedConstraintDesc[numOverflows + accumulatedConstraintsPerPartition[index]++] = *_desc; + } + else + numStaticConstraints++; + } + } + + PxU32 partitionStartIndex = 0; + + while (numUnpartitionedConstraints > 0) + { + classification.clearState(); + + partitionStartIndex += 32; + + if(partitionStartIndex >= maxPartitions) + break; + + PxU32 newNumUnpartitionedConstraints = 0; + + PxU32 partitionsA, partitionsB; + bool activeA, activeB; + uintptr_t indexA, indexB; + for (PxU32 i = 0; i < numUnpartitionedConstraints; ++i) + { + const PxSolverConstraintDesc& desc = eaTempConstraintDescriptors[i]; + + /* PxU32 partitionsA=desc.bodyA->solverProgress; + PxU32 partitionsB=desc.bodyB->solverProgress;*/ + + classification.classifyConstraint(desc, indexA, indexB, + activeA, activeB, partitionsA, partitionsB); + + PxU32 availablePartition; + { + const PxU32 combinedMask = (~partitionsA & ~partitionsB); + availablePartition = combinedMask == 0 ? MAX_NUM_PARTITIONS : PxLowestSetBit(combinedMask); + if (availablePartition == MAX_NUM_PARTITIONS) + { + //Need to shuffle around unpartitioned constraints... + eaTempConstraintDescriptors[newNumUnpartitionedConstraints++] = desc; + continue; + } + + const PxU32 partitionBit = (1u << availablePartition); + + if (activeA) + partitionsA |= partitionBit; + if (activeB) + partitionsB |= partitionBit; + } + + /*desc.bodyA->solverProgress = partitionsA; + desc.bodyB->solverProgress = partitionsB; +*/ + classification.storeProgress(desc, partitionsA, partitionsB); + availablePartition += partitionStartIndex; + eaOrderedConstraintDesc[numOverflows + accumulatedConstraintsPerPartition[availablePartition]++] = desc; + } + + numUnpartitionedConstraints = newNumUnpartitionedConstraints; + } + + return numStaticConstraints; +} + + +void outputOverflowConstraints( + PxArray& accumulatedConstraintsPerPartition, PxSolverConstraintDesc* overflowConstraints, const PxU32 nbOverflowConstraints, + PxSolverConstraintDesc* PX_RESTRICT eaOrderedConstraintDesc) +{ + //Firstly, we resize and shuffle accumulatedConstraintsPerPartition + + + accumulatedConstraintsPerPartition.resize(accumulatedConstraintsPerPartition.size()+1); + PxU32 partitionCount = accumulatedConstraintsPerPartition.size(); + + while(partitionCount-- > 1) + { + accumulatedConstraintsPerPartition[partitionCount] = accumulatedConstraintsPerPartition[partitionCount -1] + nbOverflowConstraints; + } + accumulatedConstraintsPerPartition[0] = nbOverflowConstraints; + + //Now fill in the constraints and work out the iter + + for (PxU32 i = 0; i < nbOverflowConstraints; ++i) + { + eaOrderedConstraintDesc[i] = overflowConstraints[i]; + } +} + +} + +#define PX_NORMALIZE_PARTITIONS 1 + +#if PX_NORMALIZE_PARTITIONS + +template +PxU32 normalizePartitions(PxArray& accumulatedConstraintsPerPartition, PxSolverConstraintDesc* PX_RESTRICT eaOrderedConstraintDescriptors, + const PxU32 numConstraintDescriptors, PxArray& bitField, const Classification& classification, const PxU32 numBodies, const PxU32 numArticulations) +{ + PxU32 numPartitions = 0; + + PxU32 prevAccumulation = 0; + for(; numPartitions < accumulatedConstraintsPerPartition.size() && accumulatedConstraintsPerPartition[numPartitions] > prevAccumulation; + prevAccumulation = accumulatedConstraintsPerPartition[numPartitions++]); + + PxU32 targetSize = (numPartitions == 0 ? 0 : (numConstraintDescriptors)/numPartitions); + + bitField.reserve((numBodies + numArticulations + 31)/32); + bitField.forceSize_Unsafe((numBodies + numArticulations + 31)/32); + + for(PxU32 i = numPartitions; i > 0; i--) + { + PxU32 partitionIndex = i-1; + + //Build the partition mask... + + PxU32 startIndex = partitionIndex == 0 ? 0 : accumulatedConstraintsPerPartition[partitionIndex-1]; + PxU32 endIndex = accumulatedConstraintsPerPartition[partitionIndex]; + + //If its greater than target size, there's nothing that will be pulled into it from earlier partitions + if((endIndex - startIndex) >= targetSize) + continue; + + + PxMemZero(bitField.begin(), sizeof(PxU32)*bitField.size()); + + for(PxU32 a = startIndex; a < endIndex; ++a) + { + PxSolverConstraintDesc& desc = eaOrderedConstraintDescriptors[a]; + + uintptr_t indexA, indexB; + bool activeA, activeB; + PxU32 partitionsA, partitionsB; + + classification.classifyConstraint(desc, indexA, indexB, activeA, activeB, partitionsA, partitionsB); + + if (activeA) + bitField[PxU32(indexA) / 32] |= (1u << (indexA & 31)); + if(activeB) + bitField[PxU32(indexB)/32] |= (1u << (indexB & 31)); + } + + bool bTerm = false; + for(PxU32 a = partitionIndex; a > 0 && !bTerm; --a) + { + PxU32 pInd = a-1; + + PxU32 si = pInd == 0 ? 0 : accumulatedConstraintsPerPartition[pInd-1]; + PxU32 ei = accumulatedConstraintsPerPartition[pInd]; + + for(PxU32 b = ei; b > si && !bTerm; --b) + { + PxU32 ind = b-1; + PxSolverConstraintDesc& desc = eaOrderedConstraintDescriptors[ind]; + + uintptr_t indexA, indexB; + bool activeA, activeB; + PxU32 partitionsA, partitionsB; + + classification.classifyConstraint(desc, indexA, indexB, activeA, activeB, partitionsA, partitionsB); + + bool canAdd = true; + + if(activeA && (bitField[PxU32(indexA)/32] & (1u << (indexA & 31)))) + canAdd = false; + if(activeB && (bitField[PxU32(indexB)/32] & (1u << (indexB & 31)))) + canAdd = false; + + if(canAdd) + { + PxSolverConstraintDesc tmp = eaOrderedConstraintDescriptors[ind]; + + if(activeA) + bitField[PxU32(indexA)/32] |= (1u << (indexA & 31)); + if(activeB) + bitField[PxU32(indexB)/32] |= (1u << (indexB & 31)); + + PxU32 index = ind; + for(PxU32 c = pInd; c < partitionIndex; ++c) + { + PxU32 newIndex = --accumulatedConstraintsPerPartition[c]; + if(index != newIndex) + eaOrderedConstraintDescriptors[index] = eaOrderedConstraintDescriptors[newIndex]; + index = newIndex; + } + + if(index != ind) + eaOrderedConstraintDescriptors[index] = tmp; + + if((accumulatedConstraintsPerPartition[partitionIndex] - accumulatedConstraintsPerPartition[partitionIndex-1]) >= targetSize) + { + bTerm = true; + break; + } + } + } + } + } + + PxU32 partitionCount = 0; + PxU32 lastPartitionCount = 0; + for (PxU32 a = 0; a < numPartitions; ++a) + { + const PxU32 constraintCount = accumulatedConstraintsPerPartition[a]; + accumulatedConstraintsPerPartition[partitionCount] = constraintCount; + if (constraintCount != lastPartitionCount) + { + lastPartitionCount = constraintCount; + partitionCount++; + } + } + + accumulatedConstraintsPerPartition.forceSize_Unsafe(partitionCount); + + return partitionCount; +} + +#endif + +PxU32 partitionContactConstraints(ConstraintPartitionArgs& args) +{ + PxU32 maxPartition = 0; + //Unpack the input data. + const PxU32 numBodies=args.mNumBodies; + const PxU32 numArticulations=args.mNumArticulationPtrs; + + const PxU32 numConstraintDescriptors=args.mNumContactConstraintDescriptors; + + PxSolverConstraintDesc* PX_RESTRICT eaConstraintDescriptors=args.mContactConstraintDescriptors; + PxSolverConstraintDesc* PX_RESTRICT eaOrderedConstraintDescriptors=args.mOrderedContactConstraintDescriptors; + PxSolverConstraintDesc* PX_RESTRICT eaOverflowConstraintDescriptors=args.mOverflowConstraintDescriptors; + + PxArray& constraintsPerPartition = *args.mConstraintsPerPartition; + constraintsPerPartition.forceSize_Unsafe(0); + + const PxU32 stride = args.mStride; + + for(PxU32 a = 0, offset = 0; a < numBodies; ++a, offset += stride) + { + PxSolverBody& body = *reinterpret_cast(args.mBodies + offset); + body.solverProgress = 0; + //We re-use maxSolverFrictionProgress and maxSolverNormalProgress to record the + //maximum partition used by dynamic constraints and the number of static constraints affecting + //a body. We use this to make partitioning much cheaper and be able to support an arbitrary number of dynamic partitions. + body.maxSolverFrictionProgress = 0; + body.maxSolverNormalProgress = 0; + } + + PxU32 numOrderedConstraints=0; + PxU32 numStaticConstraints = 0; + PxU32 numOverflows = 0; + + if(numArticulations == 0) + { + RigidBodyClassification classification(args.mBodies, numBodies, stride); + numOverflows = classifyConstraintDesc(eaConstraintDescriptors, numConstraintDescriptors, classification, constraintsPerPartition, + eaOverflowConstraintDescriptors, args.maxPartitions); + + PxU32 accumulation = 0; + for(PxU32 a = 0; a < constraintsPerPartition.size(); ++a) + { + PxU32 count = constraintsPerPartition[a]; + constraintsPerPartition[a] = accumulation; + accumulation += count; + } + + for(PxU32 a = 0, offset = 0; a < numBodies; ++a, offset += stride) + { + PxSolverBody& body = *reinterpret_cast(args.mBodies + offset); + PxPrefetchLine(&args.mBodies[a], 256); + body.solverProgress = 0; + //Keep the dynamic constraint count but bump the static constraint count back to 0. + //This allows us to place the static constraints in the appropriate place when we see them + //because we know the maximum index for the dynamic constraints... + body.maxSolverFrictionProgress = 0; + } + + writeConstraintDesc(eaConstraintDescriptors, numConstraintDescriptors, classification, constraintsPerPartition, + eaOverflowConstraintDescriptors, eaOrderedConstraintDescriptors, args.maxPartitions, numOverflows); + + numOrderedConstraints = numConstraintDescriptors; + + //Next step, let's slot the overflow partitions into the first slot and work out targets for them... + if (numOverflows) + { + outputOverflowConstraints(constraintsPerPartition, + eaOverflowConstraintDescriptors, numOverflows, eaOrderedConstraintDescriptors); + } + + } + else + { + + const ArticulationSolverDesc* articulationDescs=args.mArticulationPtrs; + PX_ALLOCA(_eaArticulations, Dy::FeatherstoneArticulation*, numArticulations); + Dy::FeatherstoneArticulation** eaArticulations = _eaArticulations; + for(PxU32 i=0;isolverProgress = 0; + articulation->maxSolverFrictionProgress = 0; + articulation->maxSolverNormalProgress = 0; + } + ExtendedRigidBodyClassification classification(args.mBodies, numBodies, stride, eaArticulations, numArticulations, + args.forceStaticConstraintsToSolver); + + numOverflows = classifyConstraintDesc(eaConstraintDescriptors, numConstraintDescriptors, classification, + constraintsPerPartition, eaOverflowConstraintDescriptors, args.maxPartitions); + + PxU32 accumulation = 0; + for(PxU32 a = 0; a < constraintsPerPartition.size(); ++a) + { + PxU32 count = constraintsPerPartition[a]; + constraintsPerPartition[a] = accumulation; + accumulation += count; + } + + for(PxU32 a = 0, offset = 0; a < numBodies; ++a, offset += stride) + { + PxSolverBody& body = *reinterpret_cast(args.mBodies+offset); + body.solverProgress = 0; + //Keep the dynamic constraint count but bump the static constraint count back to 0. + //This allows us to place the static constraints in the appropriate place when we see them + //because we know the maximum index for the dynamic constraints... + body.maxSolverFrictionProgress = 0; + } + + for(PxU32 a = 0; a < numArticulations; ++a) + { + FeatherstoneArticulation* articulation = eaArticulations[a]; + articulation->solverProgress = 0; + articulation->maxSolverFrictionProgress = 0; + } + + numStaticConstraints = writeConstraintDesc(eaConstraintDescriptors, numConstraintDescriptors, classification, constraintsPerPartition, + eaOverflowConstraintDescriptors, eaOrderedConstraintDescriptors, args.maxPartitions, numOverflows); + + numOrderedConstraints = numConstraintDescriptors - numStaticConstraints; + + if (numOverflows) + { + outputOverflowConstraints(constraintsPerPartition, + eaOverflowConstraintDescriptors, numOverflows, eaOrderedConstraintDescriptors); + } + + } + + const PxU32 numConstraintsDifferentBodies=numOrderedConstraints; + + //PX_ASSERT(numConstraintsDifferentBodies == numConstraintDescriptors); + + //Now handle the articulated self-constraints. + PxU32 totalConstraintCount = numConstraintsDifferentBodies; + + args.mNumDifferentBodyConstraints=numConstraintsDifferentBodies; + args.mNumSelfConstraints=totalConstraintCount-numConstraintsDifferentBodies; + + args.mNumStaticConstraints = numStaticConstraints; + args.mNumOverflowConstraints = numOverflows; + + //if (args.enhancedDeterminism) + { + PxU32 prevPartitionSize = 0; + maxPartition = 0; + for (PxU32 a = 0; a < constraintsPerPartition.size(); ++a, maxPartition++) + { + if (constraintsPerPartition[a] == prevPartitionSize) + break; + prevPartitionSize = constraintsPerPartition[a]; + } + } + + return maxPartition; +} + +void processOverflowConstraints(PxU8* bodies, PxU32 bodyStride, PxU32 numBodies, Dy::ArticulationSolverDesc* articulationDescs, PxU32 numArticulations, + PxSolverConstraintDesc* constraints, const PxU32 numConstraints) +{ + for (PxU32 a = 0, offset = 0; a < numBodies; ++a, offset += bodyStride) + { + PxSolverBody& body = *reinterpret_cast(bodies + offset); + body.solverProgress = 0; + //Keep the dynamic constraint count but bump the static constraint count back to 0. + //This allows us to place the static constraints in the appropriate place when we see them + //because we know the maximum index for the dynamic constraints... + body.maxSolverFrictionProgress = 0; + } + + if (numConstraints == 0) + return; + + if (numArticulations == 0) + { + RigidBodyClassification classification(bodies, numBodies, bodyStride); + for (PxU32 i = 0; i < numConstraints; ++i) + { + PxU32 progressA, progressB; + classification.getProgressRequirements(constraints[i], progressA, progressB); + constraints[i].progressA = PxTo16(progressA); + constraints[i].progressB = PxTo16(progressB); + } + } + else + { + PX_ALLOCA(_eaArticulations, Dy::FeatherstoneArticulation*, numArticulations); + Dy::FeatherstoneArticulation** eaArticulations = _eaArticulations; + for (PxU32 i = 0; isolverProgress = 0; + articulation->maxSolverFrictionProgress = 0; + //articulation->maxSolverNormalProgress = 0; + } + + ExtendedRigidBodyClassification classification(bodies, numBodies, bodyStride, eaArticulations, numArticulations, + false); + + for (PxU32 i = 0; i < numConstraints; ++i) + { + PxU32 progressA, progressB; + classification.getProgressRequirements(constraints[i], progressA, progressB); + constraints[i].progressA = PxTo16(progressA); + constraints[i].progressB = PxTo16(progressB); + } + } +} + +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.h new file mode 100644 index 0000000..12f2188 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPartition.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONSTRAINT_PARTITION_H +#define DY_CONSTRAINT_PARTITION_H + +#include "DyDynamics.h" + + +namespace physx +{ + +namespace Dy +{ +struct ConstraintPartitionArgs +{ + + //Input + PxU8* mBodies; + PxU32 mNumBodies; + PxU32 mStride; + ArticulationSolverDesc* mArticulationPtrs; + PxU32 mNumArticulationPtrs; + PxSolverConstraintDesc* mContactConstraintDescriptors; + PxU32 mNumContactConstraintDescriptors; + //output + PxSolverConstraintDesc* mOrderedContactConstraintDescriptors; + PxSolverConstraintDesc* mOverflowConstraintDescriptors; + PxU32 mNumDifferentBodyConstraints; + PxU32 mNumSelfConstraints; + PxU32 mNumStaticConstraints; + PxU32 mNumOverflowConstraints; + PxArray* mConstraintsPerPartition; + PxArray* mBitField; + + PxU32 maxPartitions; + + bool enhancedDeterminism; + bool forceStaticConstraintsToSolver; + +}; + +PxU32 partitionContactConstraints(ConstraintPartitionArgs& args); + +void processOverflowConstraints(PxU8* bodies, PxU32 bodyStride, PxU32 numBodies, ArticulationSolverDesc* articulations, PxU32 numArticulations, + PxSolverConstraintDesc* constraints, const PxU32 numConstraints); + +} // namespace physx + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPrep.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPrep.h new file mode 100644 index 0000000..5c6498c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintPrep.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONSTRAINT_PREP_H +#define DY_CONSTRAINT_PREP_H + +#include "DyConstraint.h" + +#include "DySolverConstraintDesc.h" +#include "foundation/PxArray.h" +#include "PxConstraint.h" + +#define DY_ARTICULATION_MIN_RESPONSE 1e-5f +#define DY_ARTICULATION_CFM 2e-4f + +#define DY_ARTICULATION_BAD_RESPONSE 0.02f + +namespace physx +{ + +class PxcConstraintBlockStream; +class PxsConstraintBlockManager; +struct PxSolverBody; +struct PxSolverBodyData; +struct PxSolverConstraintDesc; + +namespace Cm +{ + struct SpatialVectorF; +} + +namespace Dy +{ + + static const PxU32 MAX_CONSTRAINT_ROWS = 20; + + struct SolverConstraintShaderPrepDesc + { + const Constraint* constraint; + PxConstraintSolverPrep solverPrep; + const void* constantBlock; + PxU32 constantBlockByteSize; + }; + + SolverConstraintPrepState::Enum setupSolverConstraint4 + (SolverConstraintShaderPrepDesc* PX_RESTRICT constraintShaderDescs, + PxSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal recipdt, PxU32& totalRows, + PxConstraintAllocator& allocator); + + SolverConstraintPrepState::Enum setupSolverConstraint4 + (PxSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal recipdt, PxU32& totalRows, + PxConstraintAllocator& allocator, PxU32 maxRows); + + PxU32 SetupSolverConstraint(SolverConstraintShaderPrepDesc& shaderDesc, + PxSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + PxReal dt, PxReal invdt, Cm::SpatialVectorF* Z); + + + class ConstraintHelper + { + public: + + static PxU32 setupSolverConstraint( + PxSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + PxReal dt, PxReal invdt, Cm::SpatialVectorF* Z); + }; + + template + PX_FORCE_INLINE void setupConstraintFlags(PrepDescT& prepDesc, PxU16 flags) + { + prepDesc.disablePreprocessing = (flags & PxConstraintFlag::eDISABLE_PREPROCESSING)!=0; + prepDesc.improvedSlerp = (flags & PxConstraintFlag::eIMPROVED_SLERP)!=0; + prepDesc.driveLimitsAreForces = (flags & PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES)!=0; + prepDesc.extendedLimits = (flags & PxConstraintFlag::eENABLE_EXTENDED_LIMITS)!=0; + prepDesc.disableConstraint = (flags & PxConstraintFlag::eDISABLE_CONSTRAINT)!=0; + } + + void preprocessRows(Px1DConstraint** sorted, + Px1DConstraint* rows, + PxVec4* angSqrtInvInertia0, + PxVec4* angSqrtInvInertia1, + PxU32 rowCount, + const PxMat33& sqrtInvInertia0F32, + const PxMat33& sqrtInvInertia1F32, + const PxReal invMass0, + const PxReal invMass1, + const PxConstraintInvMassScale& ims, + bool disablePreprocessing, + bool diagonalizeDrive); + + PX_FORCE_INLINE void setupConstraintRows(Px1DConstraint* PX_RESTRICT rows, PxU32 size) + { + // This is necessary so that there will be sensible defaults and shaders will + // continue to work (albeit with a recompile) if the row format changes. + // It's a bit inefficient because it fills in all constraint rows even if there + // is only going to be one generated. A way around this would be for the shader to + // specify the maximum number of rows it needs, or it could call a subroutine to + // prep the row before it starts filling it it. + + PxMemZero(rows, sizeof(Px1DConstraint)*size); + + for(PxU32 i=0; i(&q)[axis] = s; + return q; +} + +PxQuat diagonalize(const PxMat33& m) // jacobi rotation using quaternions +{ + const PxU32 MAX_ITERS = 5; + + PxQuat q(PxIdentity); + + PxMat33 d; + for(PxU32 i=0; i < MAX_ITERS;i++) + { + const PxMat33 axes(q); + d = axes.getTranspose() * m * axes; + + const PxReal d0 = PxAbs(d[1][2]), d1 = PxAbs(d[0][2]), d2 = PxAbs(d[0][1]); + const PxU32 a = PxU32(d0 > d1 && d0 > d2 ? 0 : d1 > d2 ? 1 : 2); // rotation axis index, from largest off-diagonal element + + const PxU32 a1 = PxGetNextIndex3(a), a2 = PxGetNextIndex3(a1); + if(d[a1][a2] == 0.0f || PxAbs(d[a1][a1]-d[a2][a2]) > 2e6f*PxAbs(2.0f*d[a1][a2])) + break; + + const PxReal w = (d[a1][a1]-d[a2][a2]) / (2.0f*d[a1][a2]); // cot(2 * phi), where phi is the rotation angle + const PxReal absw = PxAbs(w); + + PxQuat r; + if(absw>1000) + r = indexedRotation(a, 1.0f/(4.0f*w), 1.f); // h will be very close to 1, so use small angle approx instead + else + { + const PxReal t = 1 / (absw + PxSqrt(w*w+1)); // absolute value of tan phi + const PxReal h = 1 / PxSqrt(t*t+1); // absolute value of cos phi + + PX_ASSERT(h!=1); // |w|<1000 guarantees this with typical IEEE754 machine eps (approx 6e-8) + r = indexedRotation(a, PxSqrt((1-h)/2) * PxSign(w), PxSqrt((1+h)/2)); + } + + q = (q*r).getNormalized(); + } + + return q; +} + +PX_FORCE_INLINE void rescale(const Mat33V& m, PxVec3& a0, PxVec3& a1, PxVec3& a2) +{ + const Vec3V va0 = V3LoadU(a0); + const Vec3V va1 = V3LoadU(a1); + const Vec3V va2 = V3LoadU(a2); + + const Vec3V b0 = V3ScaleAdd(va0, V3GetX(m.col0), V3ScaleAdd(va1, V3GetY(m.col0), V3Scale(va2, V3GetZ(m.col0)))); + const Vec3V b1 = V3ScaleAdd(va0, V3GetX(m.col1), V3ScaleAdd(va1, V3GetY(m.col1), V3Scale(va2, V3GetZ(m.col1)))); + const Vec3V b2 = V3ScaleAdd(va0, V3GetX(m.col2), V3ScaleAdd(va1, V3GetY(m.col2), V3Scale(va2, V3GetZ(m.col2)))); + + V3StoreU(b0, a0); + V3StoreU(b1, a1); + V3StoreU(b2, a2); +} + +PX_FORCE_INLINE void rescale4(const Mat33V& m, PxReal* a0, PxReal* a1, PxReal* a2) +{ + const Vec4V va0 = V4LoadA(a0); + const Vec4V va1 = V4LoadA(a1); + const Vec4V va2 = V4LoadA(a2); + + const Vec4V b0 = V4ScaleAdd(va0, V3GetX(m.col0), V4ScaleAdd(va1, V3GetY(m.col0), V4Scale(va2, V3GetZ(m.col0)))); + const Vec4V b1 = V4ScaleAdd(va0, V3GetX(m.col1), V4ScaleAdd(va1, V3GetY(m.col1), V4Scale(va2, V3GetZ(m.col1)))); + const Vec4V b2 = V4ScaleAdd(va0, V3GetX(m.col2), V4ScaleAdd(va1, V3GetY(m.col2), V4Scale(va2, V3GetZ(m.col2)))); + + V4StoreA(b0, a0); + V4StoreA(b1, a1); + V4StoreA(b2, a2); +} + +void diagonalize(Px1DConstraint** row, + PxVec4* angSqrtInvInertia0, + PxVec4* angSqrtInvInertia1, + const MassProps &m) +{ + const PxReal a00 = innerProduct(*row[0], *row[0], angSqrtInvInertia0[0], angSqrtInvInertia1[0], angSqrtInvInertia0[0], angSqrtInvInertia1[0], m); + const PxReal a01 = innerProduct(*row[0], *row[1], angSqrtInvInertia0[0], angSqrtInvInertia1[0], angSqrtInvInertia0[1], angSqrtInvInertia1[1], m); + const PxReal a02 = innerProduct(*row[0], *row[2], angSqrtInvInertia0[0], angSqrtInvInertia1[0], angSqrtInvInertia0[2], angSqrtInvInertia1[2], m); + const PxReal a11 = innerProduct(*row[1], *row[1], angSqrtInvInertia0[1], angSqrtInvInertia1[1], angSqrtInvInertia0[1], angSqrtInvInertia1[1], m); + const PxReal a12 = innerProduct(*row[1], *row[2], angSqrtInvInertia0[1], angSqrtInvInertia1[1], angSqrtInvInertia0[2], angSqrtInvInertia1[2], m); + const PxReal a22 = innerProduct(*row[2], *row[2], angSqrtInvInertia0[2], angSqrtInvInertia1[2], angSqrtInvInertia0[2], angSqrtInvInertia1[2], m); + + const PxMat33 a(PxVec3(a00, a01, a02), + PxVec3(a01, a11, a12), + PxVec3(a02, a12, a22)); + + const PxQuat q = diagonalize(a); + + const PxMat33 n(-q); + + const Mat33V mn(V3LoadU(n.column0), V3LoadU(n.column1), V3LoadU(n.column2)); + + //KS - We treat as a Vec4V so that we get geometricError rescaled for free along with linear0 + rescale4(mn, &row[0]->linear0.x, &row[1]->linear0.x, &row[2]->linear0.x); + rescale(mn, row[0]->linear1, row[1]->linear1, row[2]->linear1); + //KS - We treat as a PxVec4 so that we get velocityTarget rescaled for free + rescale4(mn, &row[0]->angular0.x, &row[1]->angular0.x, &row[2]->angular0.x); + rescale(mn, row[0]->angular1, row[1]->angular1, row[2]->angular1); + rescale4(mn, &angSqrtInvInertia0[0].x, &angSqrtInvInertia0[1].x, &angSqrtInvInertia0[2].x); + rescale4(mn, &angSqrtInvInertia1[0].x, &angSqrtInvInertia1[1].x, &angSqrtInvInertia1[2].x); +} + +void orthogonalize(Px1DConstraint** row, + PxVec4* angSqrtInvInertia0, + PxVec4* angSqrtInvInertia1, + PxU32 rowCount, + PxU32 eqRowCount, + const MassProps &m) +{ + PX_ASSERT(eqRowCount<=6); + + const FloatV zero = FZero(); + + Vec3V lin1m[6], ang1m[6], lin1[6], ang1[6]; + Vec4V lin0m[6], ang0m[6]; // must have 0 in the W-field + Vec4V lin0AndG[6], ang0AndT[6]; + + for(PxU32 i=0;ilinear0.x); // linear0 and geometric error + Vec4V a0AndT = V4LoadA(&row[i]->angular0.x); // angular0 and velocity target + + Vec3V l1 = V3FromV4(V4LoadA(&row[i]->linear1.x)); + Vec3V a1 = V3FromV4(V4LoadA(&row[i]->angular1.x)); + + Vec4V angSqrtL0 = V4LoadA(&angSqrtInvInertia0[i].x); + Vec4V angSqrtL1 = V4LoadA(&angSqrtInvInertia1[i].x); + + const PxU32 eliminationRows = PxMin(i, eqRowCount); + for(PxU32 j=0;jlinear0.x); + V4StoreA(a0AndT, &row[i]->angular0.x); + V3StoreA(l1, row[i]->linear1); + V3StoreA(a1, row[i]->angular1); + V4StoreA(angSqrtL0, &angSqrtInvInertia0[i].x); + V4StoreA(angSqrtL1, &angSqrtInvInertia1[i].x); + + if(i= (sizeof(PxMat33) + sizeof(PxU32))); + +// PT: make sure that there's at least a PxU32 after angular0/angular1 in the Px1DConstraint structure (for safe SIMD reads) +// Note that the code was V4LoadAding these before anyway so it must be safe already. +// PT: removed for now because some compilers didn't like it +//PX_COMPILE_TIME_ASSERT((sizeof(Px1DConstraint) - PX_OFFSET_OF_RT(Px1DConstraint, angular0)) >= (sizeof(PxVec3) + sizeof(PxU32))); +//PX_COMPILE_TIME_ASSERT((sizeof(Px1DConstraint) - PX_OFFSET_OF_RT(Px1DConstraint, angular1)) >= (sizeof(PxVec3) + sizeof(PxU32))); + +// PT: TODO: move somewhere else +PX_FORCE_INLINE Vec3V M33MulV4(const Mat33V& a, const Vec4V b) +{ + const FloatV x = V4GetX(b); + const FloatV y = V4GetY(b); + const FloatV z = V4GetZ(b); + const Vec3V v0 = V3Scale(a.col0, x); + const Vec3V v1 = V3Scale(a.col1, y); + const Vec3V v2 = V3Scale(a.col2, z); + const Vec3V v0PlusV1 = V3Add(v0, v1); + return V3Add(v0PlusV1, v2); +} + +void preprocessRows(Px1DConstraint** sorted, + Px1DConstraint* rows, + PxVec4* angSqrtInvInertia0, + PxVec4* angSqrtInvInertia1, + PxU32 rowCount, + const PxMat33& sqrtInvInertia0F32, + const PxMat33& sqrtInvInertia1F32, + const PxReal invMass0, + const PxReal invMass1, + const PxConstraintInvMassScale& ims, + bool disablePreprocessing, + bool diagonalizeDrive) +{ + // j is maxed at 12, typically around 7, so insertion sort is fine + for(PxU32 i=0; i0 && r->solveHint < sorted[j-1]->solveHint; j--) + sorted[j] = sorted[j-1]; + + sorted[j] = r; + } + + for(PxU32 i=0;isolveHint <= sorted[i+1]->solveHint); + + for (PxU32 i = 0; iangular0)); + //const Vec3V angDelta1_ = M33MulV3(sqrtInvInertia1, V3LoadU(sorted[i]->angular1)); + const Vec3V angDelta0 = M33MulV4(sqrtInvInertia0, V4LoadA(&sorted[i]->angular0.x)); + const Vec3V angDelta1 = M33MulV4(sqrtInvInertia1, V4LoadA(&sorted[i]->angular1.x)); + V4StoreA(Vec4V_From_Vec3V(angDelta0), &angSqrtInvInertia0[i].x); + V4StoreA(Vec4V_From_Vec3V(angDelta1), &angSqrtInvInertia1[i].x); + } + + if(disablePreprocessing) + return; + + MassProps m(invMass0, invMass1, ims); + for(PxU32 i=0;isolveHint>>8), start = i++; + while(isolveHint>>8) == groupMajorId) + i++; + + if(groupMajorId == 4 || (groupMajorId == 8)) + { + PxU32 bCount = start; // count of bilateral constraints + for(; bCountsolveHint&255)==0; bCount++) + ; + orthogonalize(sorted+start, angSqrtInvInertia0+start, angSqrtInvInertia1+start, i-start, bCount-start, m); + } + + if(groupMajorId == 1 && diagonalizeDrive) + { + PxU32 slerp = start; // count of bilateral constraints + for(; slerpsolveHint&255)!=2; slerp++) + ; + if(slerp+3 == i) + diagonalize(sorted+slerp, angSqrtInvInertia0+slerp, angSqrtInvInertia1+slerp, m); + + PX_ASSERT(i-start==3); + diagonalize(sorted+start, angSqrtInvInertia0+start, angSqrtInvInertia1+start, m); + } + } +} + +PxU32 ConstraintHelper::setupSolverConstraint( +PxSolverConstraintPrepDesc& prepDesc, +PxConstraintAllocator& allocator, +PxReal dt, PxReal invdt, +Cm::SpatialVectorF* Z) +{ + if (prepDesc.numRows == 0) + { + prepDesc.desc->constraint = NULL; + prepDesc.desc->writeBack = NULL; + prepDesc.desc->constraintLengthOver16 = 0; + return 0; + } + + PxSolverConstraintDesc& desc = *prepDesc.desc; + + const bool isExtended = (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY) + || (desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY); + + const PxU32 stride = isExtended ? sizeof(SolverConstraint1DExt) : sizeof(SolverConstraint1D); + const PxU32 constraintLength = sizeof(SolverConstraint1DHeader) + stride * prepDesc.numRows; + + //KS - +16 is for the constraint progress counter, which needs to be the last element in the constraint (so that we + //know SPU DMAs have completed) + PxU8* ptr = allocator.reserveConstraintData(constraintLength + 16u); + if(NULL == ptr || (reinterpret_cast(-1))==ptr) + { + if(NULL==ptr) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept joints detaching/exploding or increase buffer size allocated for constraint prep by increasing PxSceneDesc::maxNbContactDataBlocks."); + return 0; + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of constraint data. " + "Either accept joints detaching/exploding or simplify constraints."); + ptr=NULL; + return 0; + } + } + desc.constraint = ptr; + + setConstraintLength(desc,constraintLength); + + desc.writeBack = prepDesc.writeback; + + PxMemSet(desc.constraint, 0, constraintLength); + + SolverConstraint1DHeader* header = reinterpret_cast(desc.constraint); + PxU8* constraints = desc.constraint + sizeof(SolverConstraint1DHeader); + init(*header, PxTo8(prepDesc.numRows), isExtended, prepDesc.invMassScales); + header->body0WorldOffset = prepDesc.body0WorldOffset; + header->linBreakImpulse = prepDesc.linBreakForce * dt; + header->angBreakImpulse = prepDesc.angBreakForce * dt; + header->breakable = PxU8((prepDesc.linBreakForce != PX_MAX_F32) || (prepDesc.angBreakForce != PX_MAX_F32)); + header->invMass0D0 = prepDesc.data0->invMass * prepDesc.invMassScales.linear0; + header->invMass1D1 = prepDesc.data1->invMass * prepDesc.invMassScales.linear1; + + PX_ALIGN(16, PxVec4) angSqrtInvInertia0[MAX_CONSTRAINT_ROWS]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia1[MAX_CONSTRAINT_ROWS]; + + Px1DConstraint* sorted[MAX_CONSTRAINT_ROWS]; + + preprocessRows(sorted, prepDesc.rows, angSqrtInvInertia0, angSqrtInvInertia1, prepDesc.numRows, + prepDesc.data0->sqrtInvInertia, prepDesc.data1->sqrtInvInertia, prepDesc.data0->invMass, prepDesc.data1->invMass, + prepDesc.invMassScales, isExtended || prepDesc.disablePreprocessing, prepDesc.improvedSlerp); + + PxReal erp = 1.0f; + + PxU32 outCount = 0; + + const SolverExtBody eb0(reinterpret_cast(prepDesc.body0), prepDesc.data0, desc.linkIndexA); + const SolverExtBody eb1(reinterpret_cast(prepDesc.body1), prepDesc.data1, desc.linkIndexB); + + PxReal cfm = 0.f; + if (isExtended) + { + cfm = PxMax(eb0.getCFM(), eb1.getCFM()); + erp = 0.8f; + } + + for (PxU32 i = 0; i(constraints); + Px1DConstraint& c = *sorted[i]; + + const PxReal driveScale = c.flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && prepDesc.driveLimitsAreForces ? PxMin(dt, 1.0f) : 1.0f; + + PxReal unitResponse; + PxReal normalVel = 0.0f; + PxReal initVel = 0.f; + + PxReal minResponseThreshold = prepDesc.minResponseThreshold; + + if(!isExtended) + { + init(s, c.linear0, c.linear1, PxVec3(angSqrtInvInertia0[i].x, angSqrtInvInertia0[i].y, angSqrtInvInertia0[i].z), + PxVec3(angSqrtInvInertia1[i].x, angSqrtInvInertia1[i].y, angSqrtInvInertia1[i].z), c.minImpulse * driveScale, c.maxImpulse * driveScale); + s.ang0Writeback = c.angular0; + const PxReal resp0 = s.lin0.magnitudeSquared() * prepDesc.data0->invMass * prepDesc.invMassScales.linear0 + s.ang0.magnitudeSquared() * prepDesc.invMassScales.angular0; + const PxReal resp1 = s.lin1.magnitudeSquared() * prepDesc.data1->invMass * prepDesc.invMassScales.linear1 + s.ang1.magnitudeSquared() * prepDesc.invMassScales.angular1; + unitResponse = resp0 + resp1; + initVel = normalVel = prepDesc.data0->projectVelocity(c.linear0, c.angular0) - prepDesc.data1->projectVelocity(c.linear1, c.angular1); + } + else + { + //this is articulation/soft body + init(s, c.linear0, c.linear1, c.angular0, c.angular1, c.minImpulse * driveScale, c.maxImpulse * driveScale); + SolverConstraint1DExt& e = static_cast(s); + + const Cm::SpatialVector resp0 = createImpulseResponseVector(e.lin0, e.ang0, eb0); + const Cm::SpatialVector resp1 = createImpulseResponseVector(-e.lin1, -e.ang1, eb1); + unitResponse = getImpulseResponse(eb0, resp0, unsimdRef(e.deltaVA), prepDesc.invMassScales.linear0, prepDesc.invMassScales.angular0, + eb1, resp1, unsimdRef(e.deltaVB), prepDesc.invMassScales.linear1, prepDesc.invMassScales.angular1, Z, false); + + //Add CFM term! + + if(unitResponse <= DY_ARTICULATION_MIN_RESPONSE) + continue; + unitResponse += cfm; + + s.ang0Writeback = c.angular0; + s.lin0 = resp0.linear; + s.ang0 = resp0.angular; + s.lin1 = -resp1.linear; + s.ang1 = -resp1.angular; + PxReal vel0, vel1; + if(needsNormalVel(c) || eb0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY || eb1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + vel0 = eb0.projectVelocity(c.linear0, c.angular0); + vel1 = eb1.projectVelocity(c.linear1, c.angular1); + + normalVel = vel0 - vel1; + + //normalVel = eb0.projectVelocity(s.lin0, s.ang0) - eb1.projectVelocity(s.lin1, s.ang1); + if(eb0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + initVel = vel0; + else if(eb1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + initVel = -vel1; + } + + //minResponseThreshold = PxMax(minResponseThreshold, DY_ARTICULATION_MIN_RESPONSE); + } + + setSolverConstants(s.constant, s.unbiasedConstant, s.velMultiplier, s.impulseMultiplier, + c, normalVel, unitResponse, minResponseThreshold, erp, dt, invdt); + + //s.targetVelocity = initVel; + const PxReal velBias = initVel * s.velMultiplier; + s.constant += velBias; + s.unbiasedConstant += velBias; + + if(c.flags & Px1DConstraintFlag::eOUTPUT_FORCE) + s.flags |= DY_SC_FLAG_OUTPUT_FORCE; + + outCount++; + + constraints += stride; + } + + //Reassign count to the header because we may have skipped some rows if they were degenerate + header->count = PxU8(outCount); + return prepDesc.numRows; +} + +PxU32 SetupSolverConstraint(SolverConstraintShaderPrepDesc& shaderDesc, + PxSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + PxReal dt, PxReal invdt, Cm::SpatialVectorF* Z) +{ + // LL shouldn't see broken constraints + + PX_ASSERT(!(reinterpret_cast(prepDesc.writeback)->broken)); + + setConstraintLength(*prepDesc.desc, 0); + + if (!shaderDesc.solverPrep) + return 0; + + //PxU32 numAxisConstraints = 0; + + Px1DConstraint rows[MAX_CONSTRAINT_ROWS]; + setupConstraintRows(rows, MAX_CONSTRAINT_ROWS); + + prepDesc.invMassScales.linear0 = prepDesc.invMassScales.linear1 = prepDesc.invMassScales.angular0 = prepDesc.invMassScales.angular1 = 1.0f; + prepDesc.body0WorldOffset = PxVec3(0.0f); + + PxVec3p unused_ra, unused_rb; + + //TAG::solverprepcall + prepDesc.numRows = prepDesc.disableConstraint ? 0 : (*shaderDesc.solverPrep)(rows, + prepDesc.body0WorldOffset, + MAX_CONSTRAINT_ROWS, + prepDesc.invMassScales, + shaderDesc.constantBlock, + prepDesc.bodyFrame0, prepDesc.bodyFrame1, prepDesc.extendedLimits, unused_ra, unused_rb); + + prepDesc.rows = rows; + + return ConstraintHelper::setupSolverConstraint(prepDesc, allocator, dt, invdt, Z); +} + +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp new file mode 100644 index 0000000..b01d9bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyConstraintSetupBlock.cpp @@ -0,0 +1,514 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "DyConstraintPrep.h" +#include "PxsRigidBody.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraint1D4.h" +#include "foundation/PxSort.h" +#include "PxcConstraintBlockStream.h" +#include "DyArticulationContactPrep.h" +namespace physx +{ + +namespace Dy +{ + +namespace +{ +void setConstants(PxReal& constant, PxReal& unbiasedConstant, PxReal& velMultiplier, PxReal& impulseMultiplier, + const Px1DConstraint& c, PxReal unitResponse, PxReal minRowResponse, PxReal erp, PxReal dt, PxReal recipdt, + const PxSolverBodyData& b0, const PxSolverBodyData& b1, const bool finished) +{ + if(finished) + { + constant = 0.f; + unbiasedConstant = 0.f; + velMultiplier = 0.f; + impulseMultiplier = 0.f; + return; + } + PxReal nv = needsNormalVel(c) ? b0.projectVelocity(c.linear0, c.angular0) - b1.projectVelocity(c.linear1, c.angular1) + : 0; + + setSolverConstants(constant, unbiasedConstant, velMultiplier, impulseMultiplier, + c, nv, unitResponse, minRowResponse, erp, dt, recipdt); +} +} + +SolverConstraintPrepState::Enum setupSolverConstraint4 + (PxSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal recipdt, PxU32& totalRows, + PxConstraintAllocator& allocator, PxU32 maxRows); + +SolverConstraintPrepState::Enum setupSolverConstraint4 +(SolverConstraintShaderPrepDesc* PX_RESTRICT constraintShaderDescs, +PxSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, +const PxReal dt, const PxReal recipdt, PxU32& totalRows, +PxConstraintAllocator& allocator) + +{ + //KS - we will never get here with constraints involving articulations so we don't need to stress about those in here + + totalRows = 0; + + Px1DConstraint allRows[MAX_CONSTRAINT_ROWS * 4]; + Px1DConstraint* rows = allRows; + Px1DConstraint* rows2 = allRows; + + PxU32 maxRows = 0; + PxU32 nbToPrep = MAX_CONSTRAINT_ROWS; + + for (PxU32 a = 0; a < 4; ++a) + { + SolverConstraintShaderPrepDesc& shaderDesc = constraintShaderDescs[a]; + PxSolverConstraintPrepDesc& desc = constraintDescs[a]; + + if (!shaderDesc.solverPrep) + return SolverConstraintPrepState::eUNBATCHABLE; + + PX_ASSERT(rows2 + nbToPrep <= allRows + MAX_CONSTRAINT_ROWS*4); + setupConstraintRows(rows2, nbToPrep); + rows2 += nbToPrep; + + desc.invMassScales.linear0 = desc.invMassScales.linear1 = desc.invMassScales.angular0 = desc.invMassScales.angular1 = 1.0f; + desc.body0WorldOffset = PxVec3(0.0f); + + PxVec3p unused_ra, unused_rb; + + //TAG:solverprepcall + const PxU32 constraintCount = desc.disableConstraint ? 0 : (*shaderDesc.solverPrep)(rows, + desc.body0WorldOffset, + MAX_CONSTRAINT_ROWS, + desc.invMassScales, + shaderDesc.constantBlock, + desc.bodyFrame0, desc.bodyFrame1, desc.extendedLimits, unused_ra, unused_rb); + + nbToPrep = constraintCount; + maxRows = PxMax(constraintCount, maxRows); + + if (constraintCount == 0) + return SolverConstraintPrepState::eUNBATCHABLE; + + desc.rows = rows; + desc.numRows = constraintCount; + rows += constraintCount; + } + + return setupSolverConstraint4(constraintDescs, dt, recipdt, totalRows, allocator, maxRows); +} + +SolverConstraintPrepState::Enum setupSolverConstraint4 +(PxSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, +const PxReal dt, const PxReal recipdt, PxU32& totalRows, +PxConstraintAllocator& allocator, PxU32 maxRows) +{ + const Vec4V zero = V4Zero(); + Px1DConstraint* allSorted[MAX_CONSTRAINT_ROWS * 4]; + PxU32 startIndex[4]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia0[MAX_CONSTRAINT_ROWS * 4]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia1[MAX_CONSTRAINT_ROWS * 4]; + + PxU32 numRows = 0; + + for (PxU32 a = 0; a < 4; ++a) + { + startIndex[a] = numRows; + PxSolverConstraintPrepDesc& desc = constraintDescs[a]; + Px1DConstraint** sorted = allSorted + numRows; + + preprocessRows(sorted, desc.rows, angSqrtInvInertia0 + numRows, angSqrtInvInertia1 + numRows, desc.numRows, + desc.data0->sqrtInvInertia, desc.data1->sqrtInvInertia, desc.data0->invMass, desc.data1->invMass, + desc.invMassScales, desc.disablePreprocessing, desc.improvedSlerp); + + numRows += desc.numRows; + } + + const PxU32 stride = sizeof(SolverConstraint1DDynamic4); + + const PxU32 constraintLength = sizeof(SolverConstraint1DHeader4) + stride * maxRows; + + //KS - +16 is for the constraint progress counter, which needs to be the last element in the constraint (so that we + //know SPU DMAs have completed) + PxU8* ptr = allocator.reserveConstraintData(constraintLength + 16u); + if(NULL == ptr || (reinterpret_cast(-1))==ptr) + { + for(PxU32 a = 0; a < 4; ++a) + { + PxSolverConstraintPrepDesc& desc = constraintDescs[a]; + desc.desc->constraint = NULL; + setConstraintLength(*desc.desc, 0); + desc.desc->writeBack = desc.writeback; + } + + if(NULL==ptr) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept joints detaching/exploding or increase buffer size allocated for constraint prep by increasing PxSceneDesc::maxNbContactDataBlocks."); + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of constraint data. " + "Either accept joints detaching/exploding or simplify constraints."); + ptr=NULL; + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + } + //desc.constraint = ptr; + + totalRows = numRows; + + for(PxU32 a = 0; a < 4; ++a) + { + PxSolverConstraintPrepDesc& desc = constraintDescs[a]; + desc.desc->constraint = ptr; + setConstraintLength(*desc.desc, constraintLength); + desc.desc->writeBack = desc.writeback; + } + + const PxReal erp[4] = { 1.0f, 1.0f, 1.0f, 1.0f}; + //OK, now we build all 4 constraints into a single set of rows + + { + PxU8* currPtr = ptr; + SolverConstraint1DHeader4* header = reinterpret_cast(currPtr); + currPtr += sizeof(SolverConstraint1DHeader4); + + const PxSolverBodyData& bd00 = *constraintDescs[0].data0; + const PxSolverBodyData& bd01 = *constraintDescs[1].data0; + const PxSolverBodyData& bd02 = *constraintDescs[2].data0; + const PxSolverBodyData& bd03 = *constraintDescs[3].data0; + + const PxSolverBodyData& bd10 = *constraintDescs[0].data1; + const PxSolverBodyData& bd11 = *constraintDescs[1].data1; + const PxSolverBodyData& bd12 = *constraintDescs[2].data1; + const PxSolverBodyData& bd13 = *constraintDescs[3].data1; + + //Load up masses, invInertia, velocity etc. + + const Vec4V invMassScale0 = V4LoadXYZW(constraintDescs[0].invMassScales.linear0, constraintDescs[1].invMassScales.linear0, + constraintDescs[2].invMassScales.linear0, constraintDescs[3].invMassScales.linear0); + const Vec4V invMassScale1 = V4LoadXYZW(constraintDescs[0].invMassScales.linear1, constraintDescs[1].invMassScales.linear1, + constraintDescs[2].invMassScales.linear1, constraintDescs[3].invMassScales.linear1); + + + const Vec4V iMass0 = V4LoadXYZW(bd00.invMass, bd01.invMass, bd02.invMass, bd03.invMass); + + const Vec4V iMass1 = V4LoadXYZW(bd10.invMass, bd11.invMass, bd12.invMass, bd13.invMass); + + const Vec4V invMass0 = V4Mul(iMass0, invMassScale0); + const Vec4V invMass1 = V4Mul(iMass1, invMassScale1); + + + const Vec4V invInertiaScale0 = V4LoadXYZW(constraintDescs[0].invMassScales.angular0, constraintDescs[1].invMassScales.angular0, + constraintDescs[2].invMassScales.angular0, constraintDescs[3].invMassScales.angular0); + const Vec4V invInertiaScale1 = V4LoadXYZW(constraintDescs[0].invMassScales.angular1, constraintDescs[1].invMassScales.angular1, + constraintDescs[2].invMassScales.angular1, constraintDescs[3].invMassScales.angular1); + + //Velocities + Vec4V linVel00 = V4LoadA(&bd00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&bd10.linearVelocity.x); + Vec4V angVel00 = V4LoadA(&bd00.angularVelocity.x); + Vec4V angVel01 = V4LoadA(&bd10.angularVelocity.x); + + Vec4V linVel10 = V4LoadA(&bd01.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&bd11.linearVelocity.x); + Vec4V angVel10 = V4LoadA(&bd01.angularVelocity.x); + Vec4V angVel11 = V4LoadA(&bd11.angularVelocity.x); + + Vec4V linVel20 = V4LoadA(&bd02.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&bd12.linearVelocity.x); + Vec4V angVel20 = V4LoadA(&bd02.angularVelocity.x); + Vec4V angVel21 = V4LoadA(&bd12.angularVelocity.x); + + Vec4V linVel30 = V4LoadA(&bd03.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&bd13.linearVelocity.x); + Vec4V angVel30 = V4LoadA(&bd03.angularVelocity.x); + Vec4V angVel31 = V4LoadA(&bd13.angularVelocity.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2; + Vec4V linVel1T0, linVel1T1, linVel1T2; + Vec4V angVel0T0, angVel0T1, angVel0T2; + Vec4V angVel1T0, angVel1T1, angVel1T2; + + + PX_TRANSPOSE_44_34(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2); + PX_TRANSPOSE_44_34(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2); + PX_TRANSPOSE_44_34(angVel00, angVel10, angVel20, angVel30, angVel0T0, angVel0T1, angVel0T2); + PX_TRANSPOSE_44_34(angVel01, angVel11, angVel21, angVel31, angVel1T0, angVel1T1, angVel1T2); + + + + //body world offsets + Vec4V workOffset0 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[0].body0WorldOffset)); + Vec4V workOffset1 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[1].body0WorldOffset)); + Vec4V workOffset2 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[2].body0WorldOffset)); + Vec4V workOffset3 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[3].body0WorldOffset)); + + Vec4V workOffsetX, workOffsetY, workOffsetZ; + + PX_TRANSPOSE_44_34(workOffset0, workOffset1, workOffset2, workOffset3, workOffsetX, workOffsetY, workOffsetZ); + + const FloatV dtV = FLoad(dt); + Vec4V linBreakForce = V4LoadXYZW(constraintDescs[0].linBreakForce, constraintDescs[1].linBreakForce, + constraintDescs[2].linBreakForce, constraintDescs[3].linBreakForce); + Vec4V angBreakForce = V4LoadXYZW(constraintDescs[0].angBreakForce, constraintDescs[1].angBreakForce, + constraintDescs[2].angBreakForce, constraintDescs[3].angBreakForce); + + + header->break0 = PxU8((constraintDescs[0].linBreakForce != PX_MAX_F32) || (constraintDescs[0].angBreakForce != PX_MAX_F32)); + header->break1 = PxU8((constraintDescs[1].linBreakForce != PX_MAX_F32) || (constraintDescs[1].angBreakForce != PX_MAX_F32)); + header->break2 = PxU8((constraintDescs[2].linBreakForce != PX_MAX_F32) || (constraintDescs[2].angBreakForce != PX_MAX_F32)); + header->break3 = PxU8((constraintDescs[3].linBreakForce != PX_MAX_F32) || (constraintDescs[3].angBreakForce != PX_MAX_F32)); + + + //OK, I think that's everything loaded in + + header->invMass0D0 = invMass0; + header->invMass1D1 = invMass1; + header->angD0 = invInertiaScale0; + header->angD1 = invInertiaScale1; + header->body0WorkOffsetX = workOffsetX; + header->body0WorkOffsetY = workOffsetY; + header->body0WorkOffsetZ = workOffsetZ; + + header->count = maxRows; + header->type = DY_SC_TYPE_BLOCK_1D; + header->linBreakImpulse = V4Scale(linBreakForce, dtV); + header->angBreakImpulse = V4Scale(angBreakForce, dtV); + header->count0 = PxTo8(constraintDescs[0].numRows); + header->count1 = PxTo8(constraintDescs[1].numRows); + header->count2 = PxTo8(constraintDescs[2].numRows); + header->count3 = PxTo8(constraintDescs[3].numRows); + + //Now we loop over the constraints and build the results... + + PxU32 index0 = 0; + PxU32 endIndex0 = constraintDescs[0].numRows - 1; + PxU32 index1 = startIndex[1]; + PxU32 endIndex1 = index1 + constraintDescs[1].numRows - 1; + PxU32 index2 = startIndex[2]; + PxU32 endIndex2 = index2 + constraintDescs[2].numRows - 1; + PxU32 index3 = startIndex[3]; + PxU32 endIndex3 = index3 + constraintDescs[3].numRows - 1; + + const FloatV one = FOne(); + + for(PxU32 a = 0; a < maxRows; ++a) + { + SolverConstraint1DDynamic4* c = reinterpret_cast(currPtr); + currPtr += stride; + + Px1DConstraint* con0 = allSorted[index0]; + Px1DConstraint* con1 = allSorted[index1]; + Px1DConstraint* con2 = allSorted[index2]; + Px1DConstraint* con3 = allSorted[index3]; + + Vec4V cangDelta00 = V4LoadA(&angSqrtInvInertia0[index0].x); + Vec4V cangDelta01 = V4LoadA(&angSqrtInvInertia0[index1].x); + Vec4V cangDelta02 = V4LoadA(&angSqrtInvInertia0[index2].x); + Vec4V cangDelta03 = V4LoadA(&angSqrtInvInertia0[index3].x); + + Vec4V cangDelta10 = V4LoadA(&angSqrtInvInertia1[index0].x); + Vec4V cangDelta11 = V4LoadA(&angSqrtInvInertia1[index1].x); + Vec4V cangDelta12 = V4LoadA(&angSqrtInvInertia1[index2].x); + Vec4V cangDelta13 = V4LoadA(&angSqrtInvInertia1[index3].x); + + index0 = index0 == endIndex0 ? index0 : index0 + 1; + index1 = index1 == endIndex1 ? index1 : index1 + 1; + index2 = index2 == endIndex2 ? index2 : index2 + 1; + index3 = index3 == endIndex3 ? index3 : index3 + 1; + + Vec4V driveScale = V4Splat(one); + if (con0->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[0].driveLimitsAreForces) + driveScale = V4SetX(driveScale, FMin(one, dtV)); + if (con1->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[1].driveLimitsAreForces) + driveScale = V4SetY(driveScale, FMin(one, dtV)); + if (con2->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[2].driveLimitsAreForces) + driveScale = V4SetZ(driveScale, FMin(one, dtV)); + if (con3->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[3].driveLimitsAreForces) + driveScale = V4SetW(driveScale, FMin(one, dtV)); + + + Vec4V clin00 = V4LoadA(&con0->linear0.x); + Vec4V clin01 = V4LoadA(&con1->linear0.x); + Vec4V clin02 = V4LoadA(&con2->linear0.x); + Vec4V clin03 = V4LoadA(&con3->linear0.x); + + Vec4V cang00 = V4LoadA(&con0->angular0.x); + Vec4V cang01 = V4LoadA(&con1->angular0.x); + Vec4V cang02 = V4LoadA(&con2->angular0.x); + Vec4V cang03 = V4LoadA(&con3->angular0.x); + + Vec4V clin0X, clin0Y, clin0Z; + Vec4V cang0X, cang0Y, cang0Z; + + PX_TRANSPOSE_44_34(clin00, clin01, clin02, clin03, clin0X, clin0Y, clin0Z); + PX_TRANSPOSE_44_34(cang00, cang01, cang02, cang03, cang0X, cang0Y, cang0Z); + + const Vec4V maxImpulse = V4LoadXYZW(con0->maxImpulse, con1->maxImpulse, con2->maxImpulse, con3->maxImpulse); + const Vec4V minImpulse = V4LoadXYZW(con0->minImpulse, con1->minImpulse, con2->minImpulse, con3->minImpulse); + + Vec4V angDelta0X, angDelta0Y, angDelta0Z; + + PX_TRANSPOSE_44_34(cangDelta00, cangDelta01, cangDelta02, cangDelta03, angDelta0X, angDelta0Y, angDelta0Z); + + c->flags[0] = 0; + c->flags[1] = 0; + c->flags[2] = 0; + c->flags[3] = 0; + + c->lin0X = clin0X; + c->lin0Y = clin0Y; + c->lin0Z = clin0Z; + c->ang0X = angDelta0X; + c->ang0Y = angDelta0Y; + c->ang0Z = angDelta0Z; + c->ang0WritebackX = cang0X; + c->ang0WritebackY = cang0Y; + c->ang0WritebackZ = cang0Z; + + c->minImpulse = V4Mul(minImpulse, driveScale); + c->maxImpulse = V4Mul(maxImpulse, driveScale); + c->appliedForce = zero; + + const Vec4V lin0MagSq = V4MulAdd(clin0Z, clin0Z, V4MulAdd(clin0Y, clin0Y, V4Mul(clin0X, clin0X))); + const Vec4V cang0DotAngDelta = V4MulAdd(angDelta0Z, angDelta0Z, V4MulAdd(angDelta0Y, angDelta0Y, V4Mul(angDelta0X, angDelta0X))); + c->flags[0] = 0; + c->flags[1] = 0; + c->flags[2] = 0; + c->flags[3] = 0; + + Vec4V unitResponse = V4MulAdd(lin0MagSq, invMass0, V4Mul(cang0DotAngDelta, invInertiaScale0)); + + Vec4V clin10 = V4LoadA(&con0->linear1.x); + Vec4V clin11 = V4LoadA(&con1->linear1.x); + Vec4V clin12 = V4LoadA(&con2->linear1.x); + Vec4V clin13 = V4LoadA(&con3->linear1.x); + + Vec4V cang10 = V4LoadA(&con0->angular1.x); + Vec4V cang11 = V4LoadA(&con1->angular1.x); + Vec4V cang12 = V4LoadA(&con2->angular1.x); + Vec4V cang13 = V4LoadA(&con3->angular1.x); + + Vec4V clin1X, clin1Y, clin1Z; + Vec4V cang1X, cang1Y, cang1Z; + PX_TRANSPOSE_44_34(clin10, clin11, clin12, clin13, clin1X, clin1Y, clin1Z); + PX_TRANSPOSE_44_34(cang10, cang11, cang12, cang13, cang1X, cang1Y, cang1Z); + + Vec4V angDelta1X, angDelta1Y, angDelta1Z; + + PX_TRANSPOSE_44_34(cangDelta10, cangDelta11, cangDelta12, cangDelta13, angDelta1X, angDelta1Y, angDelta1Z); + + const Vec4V lin1MagSq = V4MulAdd(clin1Z, clin1Z, V4MulAdd(clin1Y, clin1Y, V4Mul(clin1X, clin1X))); + const Vec4V cang1DotAngDelta = V4MulAdd(angDelta1Z, angDelta1Z, V4MulAdd(angDelta1Y, angDelta1Y, V4Mul(angDelta1X, angDelta1X))); + + c->lin1X = clin1X; + c->lin1Y = clin1Y; + c->lin1Z = clin1Z; + + c->ang1X = angDelta1X; + c->ang1Y = angDelta1Y; + c->ang1Z = angDelta1Z; + + unitResponse = V4Add(unitResponse, V4MulAdd(lin1MagSq, invMass1, V4Mul(cang1DotAngDelta, invInertiaScale1))); + + Vec4V linProj0(V4Mul(clin0X, linVel0T0)); + Vec4V linProj1(V4Mul(clin1X, linVel1T0)); + Vec4V angProj0(V4Mul(cang0X, angVel0T0)); + Vec4V angProj1(V4Mul(cang1X, angVel1T0)); + + linProj0 = V4MulAdd(clin0Y, linVel0T1, linProj0); + linProj1 = V4MulAdd(clin1Y, linVel1T1, linProj1); + angProj0 = V4MulAdd(cang0Y, angVel0T1, angProj0); + angProj1 = V4MulAdd(cang1Y, angVel1T1, angProj1); + + linProj0 = V4MulAdd(clin0Z, linVel0T2, linProj0); + linProj1 = V4MulAdd(clin1Z, linVel1T2, linProj1); + angProj0 = V4MulAdd(cang0Z, angVel0T2, angProj0); + angProj1 = V4MulAdd(cang1Z, angVel1T2, angProj1); + + const Vec4V projectVel0 = V4Add(linProj0, angProj0); + const Vec4V projectVel1 = V4Add(linProj1, angProj1); + + const Vec4V normalVel = V4Sub(projectVel0, projectVel1); + + + { + const PxVec4& ur = reinterpret_cast(unitResponse); + PxVec4& cConstant = reinterpret_cast(c->constant); + PxVec4& cUnbiasedConstant = reinterpret_cast(c->unbiasedConstant); + PxVec4& cVelMultiplier = reinterpret_cast(c->velMultiplier); + PxVec4& cImpulseMultiplier = reinterpret_cast(c->impulseMultiplier); + + setConstants(cConstant.x, cUnbiasedConstant.x, cVelMultiplier.x, cImpulseMultiplier.x, + *con0, ur.x, constraintDescs[0].minResponseThreshold, erp[0], dt, recipdt, + *constraintDescs[0].data0, *constraintDescs[0].data1, a >= constraintDescs[0].numRows); + + setConstants(cConstant.y, cUnbiasedConstant.y, cVelMultiplier.y, cImpulseMultiplier.y, + *con1, ur.y, constraintDescs[1].minResponseThreshold, erp[1], dt, recipdt, + *constraintDescs[1].data0, *constraintDescs[1].data1, a >= constraintDescs[1].numRows); + + setConstants(cConstant.z, cUnbiasedConstant.z, cVelMultiplier.z, cImpulseMultiplier.z, + *con2, ur.z, constraintDescs[2].minResponseThreshold, erp[2], dt, recipdt, + *constraintDescs[2].data0, *constraintDescs[2].data1, a >= constraintDescs[2].numRows); + + setConstants(cConstant.w, cUnbiasedConstant.w, cVelMultiplier.w, cImpulseMultiplier.w, + *con3, ur.w, constraintDescs[3].minResponseThreshold, erp[3], dt, recipdt, + *constraintDescs[3].data0, *constraintDescs[3].data1, a >= constraintDescs[3].numRows); + } + + const Vec4V velBias = V4Mul(c->velMultiplier, normalVel); + c->constant = V4Add(c->constant, velBias); + c->unbiasedConstant = V4Add(c->unbiasedConstant, velBias); + + if(con0->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[0] |= DY_SC_FLAG_OUTPUT_FORCE; + if(con1->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[1] |= DY_SC_FLAG_OUTPUT_FORCE; + if(con2->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[2] |= DY_SC_FLAG_OUTPUT_FORCE; + if(con3->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[3] |= DY_SC_FLAG_OUTPUT_FORCE; + } + *(reinterpret_cast(currPtr)) = 0; + *(reinterpret_cast(currPtr + 4)) = 0; + } + + //OK, we're ready to allocate and solve prep these constraints now :-) + return SolverConstraintPrepState::eSUCCESS; +} + +} + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp new file mode 100644 index 0000000..eff20bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.cpp @@ -0,0 +1,839 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "PxcNpWorkUnit.h" +#include "DyThreadContext.h" +#include "PxcNpContactPrepShared.h" +#include "DyConstraintPrep.h" + +using namespace physx; +using namespace Gu; + +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" + +using namespace aos; + +namespace physx +{ +namespace Dy +{ + +PxcCreateFinalizeSolverContactMethod createFinalizeMethods[3] = +{ + createFinalizeSolverContacts, + createFinalizeSolverContactsCoulomb1D, + createFinalizeSolverContactsCoulomb2D +}; + + + +static void setupFinalizeSolverConstraints(Sc::ShapeInteraction* shapeInteraction, + const PxContactPoint* buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const PxSolverBodyData& data0, + const PxSolverBodyData& data1, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + bool hasForceThreshold, bool staticOrKinematicBody, + const PxReal restDist, PxU8* frictionDataPtr, + const PxReal maxCCDSeparation, + const PxReal solverOffsetSlopF32) +{ + // NOTE II: the friction patches are sparse (some of them have no contact patches, and + // therefore did not get written back to the cache) but the patch addresses are dense, + // corresponding to valid patches + + const Vec3V solverOffsetSlop = V3Load(solverOffsetSlopF32); + + const FloatV ccdMaxSeparation = FLoad(maxCCDSeparation); + + PxU8 flags = PxU8(hasForceThreshold ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0); + + PxU8* PX_RESTRICT ptr = workspace; + + PxU8 type = PxTo8(staticOrKinematicBody ? DY_SC_TYPE_STATIC_CONTACT + : DY_SC_TYPE_RB_CONTACT); + + const FloatV zero=FZero(); + const Vec3V v3Zero = V3Zero(); + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + const FloatV nDom1fV = FNeg(d1); + + const FloatV invMass0 = FLoad(data0.invMass); + const FloatV invMass1 = FLoad(data1.invMass); + + const FloatV invMass0_dom0fV = FMul(d0, invMass0); + const FloatV invMass1_dom1fV = FMul(nDom1fV, invMass1); + + + Vec4V staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4Zero(); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetZ(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, invMass0_dom0fV); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetW(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, invMass1_dom1fV); + + const FloatV restDistance = FLoad(restDist); + + const FloatV maxPenBias = FMax(FLoad(data0.penBiasClamp), FLoad(data1.penBiasClamp)); + + const QuatV bodyFrame0q = QuatVLoadU(&bodyFrame0.q.x); + const Vec3V bodyFrame0p = V3LoadU(bodyFrame0.p); + + const QuatV bodyFrame1q = QuatVLoadU(&bodyFrame1.q.x); + const Vec3V bodyFrame1p = V3LoadU(bodyFrame1.p); + + PxU32 frictionPatchWritebackAddrIndex = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + const Vec3V linVel0 = V3LoadU_SafeReadW(data0.linearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + const Vec3V linVel1 = V3LoadU_SafeReadW(data1.linearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + const Vec3V angVel0 = V3LoadU_SafeReadW(data0.angularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + const Vec3V angVel1 = V3LoadU_SafeReadW(data1.angularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + + PX_ALIGN(16, const Mat33V invSqrtInertia0) + ( + V3LoadU_SafeReadW(data0.sqrtInvInertia.column0), // PT: safe because 'column1' follows 'column0' in PxMat33 + V3LoadU_SafeReadW(data0.sqrtInvInertia.column1), // PT: safe because 'column2' follows 'column1' in PxMat33 + V3LoadU(data0.sqrtInvInertia.column2) + ); + + PX_ALIGN(16, const Mat33V invSqrtInertia1) + ( + V3LoadU_SafeReadW(data1.sqrtInvInertia.column0), // PT: safe because 'column1' follows 'column0' in PxMat33 + V3LoadU_SafeReadW(data1.sqrtInvInertia.column1), // PT: safe because 'column2' follows 'column1' in PxMat33 + V3LoadU(data1.sqrtInvInertia.column2) + ); + + const FloatV invDt = FLoad(invDtF32); + const FloatV p8 = FLoad(0.8f); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + + const FloatV invDtp8 = FMul(invDt, p8); + const FloatV dt = FLoad(dtF32); + + + for(PxU32 i=0;i(ptr); + ptr += sizeof(SolverContactHeader); + + + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + + header->shapeInteraction = shapeInteraction; + header->flags = flags; + FStore(invMass0_dom0fV, &header->invMass0); + FStore(FNeg(invMass1_dom1fV), &header->invMass1); + const FloatV restitution = FLoad(contactBase0->restitution); + + const FloatV damping = FLoad(contactBase0->damping); + PxU32 pointStride = sizeof(SolverContactPoint); + PxU32 frictionStride = sizeof(SolverContactFriction); + + const Vec3V normal = V3LoadA(buffer[c.contactPatches[c.correlationListHeads[i]].start].normal); + const FloatV normalLenSq = V3LengthSq(normal); + const VecCrossV norCross = V3PrepareCross(normal); + const FloatV norVel = V3SumElems(V3NegMulSub(normal, linVel1, V3Mul(normal, linVel0))); + + const FloatV invMassNorLenSq0 = FMul(invMass0_dom0fV, normalLenSq); + const FloatV invMassNorLenSq1 = FMul(invMass1_dom1fV, normalLenSq); + + header->normal_minAppliedImpulseForFrictionW = Vec4V_From_Vec3V(normal); + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer + c.contactPatches[patch].start; + + PxU8* p = ptr; + + for(PxU32 j=0;j(p); + p += pointStride; + + constructContactConstraint(invSqrtInertia0, invSqrtInertia1, invMassNorLenSq0, + invMassNorLenSq1, angD0, angD1, bodyFrame0p, bodyFrame1p, + normal, norVel, norCross, angVel0, angVel1, + invDt, invDtp8, dt, restDistance, maxPenBias, restitution, + bounceThreshold, contact, *solverContact, + ccdMaxSeparation, solverOffsetSlop, damping); + } + + ptr = p; + } + + PxF32* forceBuffers = reinterpret_cast(ptr); + PxMemZero(forceBuffers, sizeof(PxF32) * contactCount); + ptr += ((contactCount + 3) & (~3)) * sizeof(PxF32); // jump to next 16-byte boundary + + const PxReal frictionCoefficient = (contactBase0->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && frictionPatch.anchorCount == 2) ? 0.5f : 1.f; + + const PxReal staticFriction = contactBase0->staticFriction * frictionCoefficient; + const PxReal dynamicFriction = contactBase0->dynamicFriction* frictionCoefficient; + + const bool disableStrongFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetX(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(staticFriction)); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W=V4SetY(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(dynamicFriction)); + + const bool haveFriction = (disableStrongFriction == 0 && frictionPatch.anchorCount != 0);//PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0; + header->numNormalConstr = PxTo8(contactCount); + header->numFrictionConstr = PxTo8(haveFriction ? frictionPatch.anchorCount*2 : 0); + + header->type = type; + + header->staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W; + FStore(angD0, &header->angDom0); + FStore(angD1, &header->angDom1); + + header->broken = 0; + + if(haveFriction) + { + const Vec3V linVrel = V3Sub(linVel0, linVel1); + //const Vec3V normal = Vec3V_From_PxVec3_Aligned(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + + const FloatV orthoThreshold = FLoad(0.70710678f); + const FloatV p1 = FLoad(0.0001f); + // fallback: normal.cross((1,0,0)) or normal.cross((0,0,1)) + const FloatV normalX = V3GetX(normal); + const FloatV normalY = V3GetY(normal); + const FloatV normalZ = V3GetZ(normal); + + Vec3V t0Fallback1 = V3Merge(zero, FNeg(normalZ), normalY); + Vec3V t0Fallback2 = V3Merge(FNeg(normalY), normalX, zero); + Vec3V t0Fallback = V3Sel(FIsGrtr(orthoThreshold, FAbs(normalX)), t0Fallback1, t0Fallback2); + + Vec3V t0 = V3Sub(linVrel, V3Scale(normal, V3Dot(normal, linVrel))); + t0 = V3Sel(FIsGrtr(V3LengthSq(t0), p1), t0, t0Fallback); + t0 = V3Normalize(t0); + + const VecCrossV t0Cross = V3PrepareCross(t0); + + const Vec3V t1 = V3Cross(norCross, t0Cross); + const VecCrossV t1Cross = V3PrepareCross(t1); + + + // since we don't even have the body velocities we can't compute the tangent dirs, so + // the only thing we can do right now is to write the geometric information (which is the + // same for both axis constraints of an anchor) We put ra in the raXn field, rb in the rbXn + // field, and the error in the normal field. See corresponding comments in + // completeContactFriction() + + //We want to set the writeBack ptr to point to the broken flag of the friction patch. + //On spu we have a slight problem here because the friction patch array is + //in local store rather than in main memory. The good news is that the address of the friction + //patch array in main memory is stored in the work unit. These two addresses will be equal + //except on spu where one is local store memory and the other is the effective address in main memory. + //Using the value stored in the work unit guarantees that the main memory address is used on all platforms. + PxU8* PX_RESTRICT writeback = frictionDataPtr + frictionPatchWritebackAddrIndex*sizeof(FrictionPatch); + + header->frictionBrokenWritebackByte = writeback; + + for(PxU32 j = 0; j < frictionPatch.anchorCount; j++) + { + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + SolverContactFriction* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionStride; + SolverContactFriction* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionStride; + + Vec3V body0Anchor = V3LoadU(frictionPatch.body0Anchors[j]); + Vec3V body1Anchor = V3LoadU(frictionPatch.body1Anchors[j]); + + const Vec3V ra = QuatRotate(bodyFrame0q, body0Anchor); + const Vec3V rb = QuatRotate(bodyFrame1q, body1Anchor); + + /*ra = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(ra)), v3Zero, ra); + rb = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rb)), v3Zero, rb);*/ + + PxU32 index = c.contactID[i][j]; + Vec3V error = V3Sub(V3Add(ra, bodyFrame0p), V3Add(rb, bodyFrame1p)); + error = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(error)), v3Zero, error); + + index = index == 0xFFFF ? c.contactPatches[c.correlationListHeads[i]].start : index; + + const Vec3V tvel = V3LoadA(buffer[index].targetVel); + + { + Vec3V raXn = V3Cross(ra, t0Cross); + Vec3V rbXn = V3Cross(rb, t0Cross); + + raXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + const Vec3V raXnSqrtInertia = M33MulV3(invSqrtInertia0, raXn); + const Vec3V rbXnSqrtInertia = M33MulV3(invSqrtInertia1, rbXn); + + + const FloatV resp0 = FAdd(invMass0_dom0fV, FMul(angD0, V3Dot(raXnSqrtInertia, raXnSqrtInertia))); + const FloatV resp1 = FSub(FMul(angD1, V3Dot(rbXnSqrtInertia, rbXnSqrtInertia)), invMass1_dom1fV); + const FloatV resp = FAdd(resp0, resp1); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, zero), FDiv(p8, resp), zero); + + FloatV targetVel = V3Dot(tvel, t0); + + const FloatV vrel1 = FAdd(V3Dot(t0, linVel0), V3Dot(raXn, angVel0)); + const FloatV vrel2 = FAdd(V3Dot(t0, linVel1), V3Dot(rbXn, angVel1)); + const FloatV vrel = FSub(vrel1, vrel2); + + targetVel = FSub(targetVel, vrel); + + f0->normalXYZ_appliedForceW = V4SetW(t0, zero); + f0->raXnXYZ_velMultiplierW = V4SetW(raXnSqrtInertia, velMultiplier); + f0->rbXnXYZ_biasW = V4SetW(rbXnSqrtInertia, FMul(V3Dot(t0, error), invDt)); + FStore(targetVel, &f0->targetVel); + } + + { + + Vec3V raXn = V3Cross(ra, t1Cross); + Vec3V rbXn = V3Cross(rb, t1Cross); + + raXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + const Vec3V raXnSqrtInertia = M33MulV3(invSqrtInertia0, raXn); + const Vec3V rbXnSqrtInertia = M33MulV3(invSqrtInertia1, rbXn); + + const FloatV resp0 = FAdd(invMass0_dom0fV, FMul(angD0, V3Dot(raXnSqrtInertia, raXnSqrtInertia))); + const FloatV resp1 = FSub(FMul(angD1, V3Dot(rbXnSqrtInertia, rbXnSqrtInertia)), invMass1_dom1fV); + const FloatV resp = FAdd(resp0, resp1); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, zero), FDiv(p8, resp), zero); + + FloatV targetVel = V3Dot(tvel, t1); + + const FloatV vrel1 = FAdd(V3Dot(t1, linVel0), V3Dot(raXn, angVel0)); + const FloatV vrel2 = FAdd(V3Dot(t1, linVel1), V3Dot(rbXn, angVel1)); + const FloatV vrel = FSub(vrel1, vrel2); + + targetVel = FSub(targetVel, vrel); + + f1->normalXYZ_appliedForceW = V4SetW(t1, zero); + f1->raXnXYZ_velMultiplierW = V4SetW(raXnSqrtInertia, velMultiplier); + f1->rbXnXYZ_biasW = V4SetW(rbXnSqrtInertia, FMul(V3Dot(t1, error), invDt)); + FStore(targetVel, &f1->targetVel); + } + } + } + + frictionPatchWritebackAddrIndex++; + } +} + + +PX_FORCE_INLINE void computeBlockStreamByteSizes(const bool useExtContacts, const CorrelationBuffer& c, + PxU32& _solverConstraintByteSize, PxU32& _frictionPatchByteSize, PxU32& _numFrictionPatches, + PxU32& _axisConstraintCount) +{ + PX_ASSERT(0 == _solverConstraintByteSize); + PX_ASSERT(0 == _frictionPatchByteSize); + PX_ASSERT(0 == _numFrictionPatches); + PX_ASSERT(0 == _axisConstraintCount); + + // PT: use local vars to remove LHS + PxU32 solverConstraintByteSize = 0; + PxU32 numFrictionPatches = 0; + PxU32 axisConstraintCount = 0; + + + for(PxU32 i = 0; i < c.frictionPatchCount; i++) + { + //Friction patches. + if(c.correlationListHeads[i] != CorrelationBuffer::LIST_END) + numFrictionPatches++; + + const FrictionPatch& frictionPatch = c.frictionPatches[i]; + + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0; + + //Solver constraint data. + if(c.frictionPatchContactCounts[i]!=0) + { + solverConstraintByteSize += sizeof(SolverContactHeader); + solverConstraintByteSize += useExtContacts ? c.frictionPatchContactCounts[i] * sizeof(SolverContactPointExt) + : c.frictionPatchContactCounts[i] * sizeof(SolverContactPoint); + solverConstraintByteSize += sizeof(PxF32) * ((c.frictionPatchContactCounts[i] + 3)&(~3)); //Add on space for applied impulses + + axisConstraintCount += c.frictionPatchContactCounts[i]; + + if(haveFriction) + { + solverConstraintByteSize += useExtContacts ? c.frictionPatches[i].anchorCount * 2 * sizeof(SolverContactFrictionExt) + : c.frictionPatches[i].anchorCount * 2 * sizeof(SolverContactFriction); + axisConstraintCount += c.frictionPatches[i].anchorCount * 2; + + } + } + } + PxU32 frictionPatchByteSize = numFrictionPatches*sizeof(FrictionPatch); + + _numFrictionPatches = numFrictionPatches; + _axisConstraintCount = axisConstraintCount; + + //16-byte alignment. + _frictionPatchByteSize = ((frictionPatchByteSize + 0x0f) & ~0x0f); + _solverConstraintByteSize = ((solverConstraintByteSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); + PX_ASSERT(0 == (_frictionPatchByteSize & 0x0f)); +} + +static bool reserveBlockStreams(const bool useExtContacts, Dy::CorrelationBuffer& cBuffer, + PxU8*& solverConstraint, + FrictionPatch*& _frictionPatches, + PxU32& numFrictionPatches, PxU32& solverConstraintByteSize, + PxU32& axisConstraintCount, PxConstraintAllocator& constraintAllocator) +{ + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(NULL == _frictionPatches); + PX_ASSERT(0 == numFrictionPatches); + PX_ASSERT(0 == solverConstraintByteSize); + PX_ASSERT(0 == axisConstraintCount); + + //From frictionPatchStream we just need to reserve a single buffer. + PxU32 frictionPatchByteSize = 0; + //Compute the sizes of all the buffers. + computeBlockStreamByteSizes( + useExtContacts, cBuffer, + solverConstraintByteSize, frictionPatchByteSize, numFrictionPatches, + axisConstraintCount); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if(constraintBlockByteSize > 0) + { + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if(0==constraintBlock || (reinterpret_cast(-1))==constraintBlock) + { + if(0==constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock=NULL; + } + } + PX_ASSERT((size_t(constraintBlock) & 0xF) == 0); + } + + FrictionPatch* frictionPatches = NULL; + //If the constraint block reservation didn't fail then reserve the friction buffer too. + if(frictionPatchByteSize >0 && (0==constraintBlockByteSize || constraintBlock)) + { + frictionPatches = reinterpret_cast(constraintAllocator.reserveFrictionData(frictionPatchByteSize)); + + if(0==frictionPatches || (reinterpret_cast(-1))==frictionPatches) + { + if(0==frictionPatches) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of friction data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + frictionPatches=NULL; + } + } + } + + _frictionPatches = frictionPatches; + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if(0==constraintBlockByteSize || constraintBlock) + { + if(solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0==(uintptr_t(solverConstraint) & 0x0f)); + } + } + + //Return true if neither of the two block reservations failed. + return ((0==constraintBlockByteSize || constraintBlock) && (0==frictionPatchByteSize || frictionPatches)); +} + + +bool createFinalizeSolverContacts( + PxSolverContactDesc& contactDesc, + CorrelationBuffer& c, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z) +{ + PxPrefetchLine(contactDesc.body0); + PxPrefetchLine(contactDesc.body1); + PxPrefetchLine(contactDesc.data0); + PxPrefetchLine(contactDesc.data1); + + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + const bool hasForceThreshold = contactDesc.hasForceThresholds; + const bool staticOrKinematicBody = contactDesc.bodyState1 == PxSolverContactDesc::eKINEMATIC_BODY || contactDesc.bodyState1 == PxSolverContactDesc::eSTATIC_BODY; + + const bool disableStrongFriction = contactDesc.disableStrongFriction; + + PxSolverConstraintDesc& desc = *contactDesc.desc; + + const bool useExtContacts = (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY || desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY); + + desc.constraintLengthOver16 = 0; + + + if (contactDesc.numContacts == 0) + { + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; + desc.constraint = NULL; + return true; + } + + if (!disableStrongFriction) + { + getFrictionPatches(c, contactDesc.frictionPtr, contactDesc.frictionCount, contactDesc.bodyFrame0, contactDesc.bodyFrame1, correlationDistance); + } + + bool overflow = !createContactPatches(c, contactDesc.contacts, contactDesc.numContacts, PXC_SAME_NORMAL); + overflow = correlatePatches(c, contactDesc.contacts, contactDesc.bodyFrame0, contactDesc.bodyFrame1, PXC_SAME_NORMAL, 0, 0) || overflow; + PX_UNUSED(overflow); + +#if PX_CHECKED + if (overflow) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Dropping contacts in solver because we exceeded limit of 32 friction patches."); + } +#endif + + growPatches(c, contactDesc.contacts, contactDesc.bodyFrame0, contactDesc.bodyFrame1, 0, frictionOffsetThreshold + contactDesc.restDistance); + + //PX_ASSERT(patchCount == c.frictionPatchCount); + + FrictionPatch* frictionPatches = NULL; + PxU8* solverConstraint = NULL; + PxU32 numFrictionPatches = 0; + PxU32 solverConstraintByteSize = 0; + PxU32 axisConstraintCount = 0; + + const bool successfulReserve = reserveBlockStreams( + useExtContacts, c, + solverConstraint, frictionPatches, + numFrictionPatches, + solverConstraintByteSize, + axisConstraintCount, + constraintAllocator); + // initialise the work unit's ptrs to the various buffers. + + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; + desc.constraint = NULL; + desc.constraintLengthOver16 = 0; + // patch up the work unit with the reserved buffers and set the reserved buffer data as appropriate. + + if (successfulReserve) + { + PxU8* frictionDataPtr = reinterpret_cast(frictionPatches); + contactDesc.frictionPtr = frictionDataPtr; + desc.constraint = solverConstraint; + //output.nbContacts = PxTo8(numContacts); + contactDesc.frictionCount = PxTo8(numFrictionPatches); + desc.constraintLengthOver16 = PxTo16(solverConstraintByteSize / 16); + desc.writeBack = contactDesc.contactForces; + + //Initialise friction buffer. + if (frictionPatches) + { + // PT: TODO: revisit this... not very satisfying + //const PxU32 maxSize = numFrictionPatches*sizeof(FrictionPatch); + PxPrefetchLine(frictionPatches); + PxPrefetchLine(frictionPatches, 128); + PxPrefetchLine(frictionPatches, 256); + + for (PxU32 i = 0; i(contactDesc.body0), reinterpret_cast(&data0), desc.linkIndexA); + const SolverExtBody b1(reinterpret_cast(contactDesc.body1), reinterpret_cast(&data1), desc.linkIndexB); + + setupFinalizeExtSolverContacts(contactDesc.contacts, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + b0, b1, invDtF32, dtF32, bounceThresholdF32, + contactDesc.invMassScales.linear0, contactDesc.invMassScales.angular0, contactDesc.invMassScales.linear1, contactDesc.invMassScales.angular1, + contactDesc.restDistance, frictionDataPtr, contactDesc.maxCCDSeparation, Z, contactDesc.offsetSlop); + } + else + { + setupFinalizeSolverConstraints(getInteraction(contactDesc), contactDesc.contacts, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + data0, data1, invDtF32, dtF32, bounceThresholdF32, + contactDesc.invMassScales.linear0, contactDesc.invMassScales.angular0, contactDesc.invMassScales.linear1, contactDesc.invMassScales.angular1, + hasForceThreshold, staticOrKinematicBody, contactDesc.restDistance, frictionDataPtr, contactDesc.maxCCDSeparation, contactDesc.offsetSlop); + } + //KS - set to 0 so we have a counter for the number of times we solved the constraint + //only going to be used on SPU but might as well set on all platforms because this code is shared + *(reinterpret_cast(solverConstraint + solverConstraintByteSize)) = 0; + } + } + + return successfulReserve; +} + +FloatV setupExtSolverContact(const SolverExtBody& b0, const SolverExtBody& b1, + const FloatV& d0, const FloatV& d1, const FloatV& angD0, const FloatV& angD1, const Vec3V& bodyFrame0p, const Vec3V& bodyFrame1p, + const Vec3VArg normal, const FloatVArg invDt, const FloatVArg invDtp8, const FloatVArg dt, const FloatVArg restDistance, + const FloatVArg maxPenBias, const FloatVArg restitution,const FloatVArg bounceThreshold, const PxContactPoint& contact, SolverContactPointExt& solverContact, const FloatVArg ccdMaxSeparation, Cm::SpatialVectorF* zVector, + const Cm::SpatialVectorV& v0, const Cm::SpatialVectorV& v1, const FloatV& cfm, const Vec3VArg solverOffsetSlop, + const FloatVArg norVel0, const FloatVArg norVel1, const FloatVArg damping ) +{ + const FloatV zero = FZero(); + const FloatV separation = FLoad(contact.separation); + + const FloatV penetration = FSub(separation, restDistance); + + const Vec3V point = V3LoadA(contact.point); + + const Vec3V ra = V3Sub(point, bodyFrame0p); + const Vec3V rb = V3Sub(point, bodyFrame1p); + + Vec3V raXn = V3Cross(ra, normal); + Vec3V rbXn = V3Cross(rb, normal); + + FloatV aVel0 = V3Dot(v0.angular, raXn); + FloatV aVel1 = V3Dot(v1.angular, raXn); + + FloatV relLinVel = FSub(norVel0, norVel1); + FloatV relAngVel = FSub(aVel0, aVel1); + + const Vec3V slop = V3Scale(solverOffsetSlop, FMax(FSel(FIsEq(relLinVel, zero), FMax(), FDiv(relAngVel, relLinVel)), FOne())); + + raXn = V3Sel(V3IsGrtr(slop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(slop, V3Abs(rbXn)), V3Zero(), rbXn); + + aVel0 = V3Dot(raXn, v0.angular); + aVel1 = V3Dot(rbXn, v1.angular); + + relAngVel = FSub(aVel0, aVel1); + + Cm::SpatialVectorV deltaV0, deltaV1; + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(normal, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(normal), V3Neg(rbXn), b1); + + const FloatV unitResponse = getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, reinterpret_cast(zVector)); + + const FloatV vrel = FAdd(relLinVel, relAngVel); + + const FloatV penetrationInvDt = FMul(penetration, invDt); + + const BoolV isGreater2 = BAnd(BAnd(FIsGrtr(restitution, zero), FIsGrtr(bounceThreshold, vrel)), FIsGrtr(FNeg(vrel), penetrationInvDt)); + + + + FloatV velMultiplier, scaledBias, impulseMultiplier; + FloatV biasedErr, unbiasedErr; + + const FloatV tVel = FSel(isGreater2, FMul(FNeg(vrel), restitution), zero); + FloatV targetVelocity = tVel; + //Get the rigid body's current velocity and embed into the constraint target velocities + if (b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVelocity = FSub(targetVelocity, FAdd(norVel0, aVel0)); + else if (b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + targetVelocity = FAdd(targetVelocity, FAdd(norVel1, aVel1)); + + targetVelocity = FAdd(targetVelocity, V3Dot(V3LoadA(contact.targetVel), normal)); + + if (FAllGrtr(zero, restitution)) // negative restitution -> interpret as spring stiffness for compliant contact + { + const FloatV nrdt = FMul(dt, restitution); + + const FloatV a = FMul(dt, FSub(damping, nrdt)); + const FloatV b = FMul(dt, FNeg(FMul(restitution, penetration))); + + const FloatV x = FRecip(FScaleAdd(a, unitResponse, FOne())); + + velMultiplier = FMul(x, a); + //scaledBias = FSel(isSeparated, FNeg(invStepDt), FDiv(FMul(nrdt, FMul(x, unitResponse)), velMultiplier)); + scaledBias = FMul(x, b); + impulseMultiplier = FSub(FOne(), x); + + unbiasedErr = biasedErr = FScaleAdd(targetVelocity, velMultiplier, FNeg(scaledBias)); + } + else + { + const BoolV ccdSeparationCondition = FIsGrtrOrEq(ccdMaxSeparation, penetration); + velMultiplier = FSel(FIsGrtr(FLoad(DY_ARTICULATION_MIN_RESPONSE), unitResponse), zero, FRecip(FAdd(unitResponse, cfm))); + scaledBias = FMul(velMultiplier, FMax(maxPenBias, FMul(penetration, invDtp8))); + scaledBias = FSel(BAnd(ccdSeparationCondition, isGreater2), zero, scaledBias); + + biasedErr = FScaleAdd(targetVelocity, velMultiplier, FNeg(scaledBias)); + unbiasedErr = FScaleAdd(targetVelocity, velMultiplier, FSel(isGreater2, zero, FNeg(FMax(scaledBias, zero)))); + impulseMultiplier = FOne(); + + } + + const FloatV deltaF = FMax(FMul(FSub(tVel, FAdd(vrel, FMax(penetrationInvDt, zero))), velMultiplier), zero); + + + FStore(biasedErr, &solverContact.biasedErr); + FStore(unbiasedErr, &solverContact.unbiasedErr); + + solverContact.raXn_velMultiplierW = V4SetW(Vec4V_From_Vec3V(resp0.angular), velMultiplier); + solverContact.rbXn_maxImpulseW = V4SetW(Vec4V_From_Vec3V(V3Neg(resp1.angular)), FLoad(contact.maxImpulse));; + solverContact.linDeltaVA = deltaV0.linear; + solverContact.angDeltaVA = deltaV0.angular; + solverContact.linDeltaVB = deltaV1.linear; + solverContact.angDeltaVB = deltaV1.angular; + FStore(impulseMultiplier, &solverContact.impulseMultiplier); + + return deltaF; +} + + +bool createFinalizeSolverContacts(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z) +{ + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + // We pull the friction patches out of the cache to remove the dependency on how + // the cache is organized. Remember original addrs so we can write them back + // efficiently. + + PxU32 numContacts = 0; + { + PxReal invMassScale0 = 1.f; + PxReal invMassScale1 = 1.f; + PxReal invInertiaScale0 = 1.f; + PxReal invInertiaScale1 = 1.f; + + bool hasMaxImpulse = false, hasTargetVelocity = false; + + numContacts = extractContacts(buffer, output, hasMaxImpulse, hasTargetVelocity, invMassScale0, invMassScale1, + invInertiaScale0, invInertiaScale1, PxMin(contactDesc.data0->maxContactImpulse, contactDesc.data1->maxContactImpulse)); + + contactDesc.contacts = buffer.contacts; + contactDesc.numContacts = numContacts; + contactDesc.disableStrongFriction = contactDesc.disableStrongFriction || hasTargetVelocity; + contactDesc.hasMaxImpulse = hasMaxImpulse; + contactDesc.invMassScales.linear0 *= invMassScale0; + contactDesc.invMassScales.linear1 *= invMassScale1; + contactDesc.invMassScales.angular0 *= invInertiaScale0; + contactDesc.invMassScales.angular1 *= invInertiaScale1; + } + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + + return createFinalizeSolverContacts(contactDesc, c, invDtF32, dtF32, bounceThresholdF32, frictionOffsetThreshold, + correlationDistance, constraintAllocator, Z); +} + +PxU32 getContactManagerConstraintDesc(const PxsContactManagerOutput& cmOutput, const PxsContactManager& /*cm*/, PxSolverConstraintDesc& desc) +{ + desc.writeBack = cmOutput.contactForces; + return cmOutput.nbContacts;// cm.getWorkUnit().axisConstraintCount; +} + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.h new file mode 100644 index 0000000..c9a3e79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep.h @@ -0,0 +1,211 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONTACT_PREP_H +#define DY_CONTACT_PREP_H + +#include "DySolverConstraintDesc.h" +#include "PxSceneDesc.h" +#include "DySolverContact4.h" + +namespace physx +{ + +struct PxcNpWorkUnit; +class PxsConstraintBlockManager; +class PxcConstraintBlockStream; +struct PxsContactManagerOutput; +class FrictionPatchStreamPair; +struct PxSolverBody; +struct PxSolverBodyData; +struct PxSolverConstraintDesc; +class PxsContactManager; + +namespace Dy +{ + class ThreadContext; + struct CorrelationBuffer; + +#define CREATE_FINALIZE_SOLVER_CONTACT_METHOD_ARGS \ + PxSolverContactDesc& contactDesc, \ + PxsContactManagerOutput& output, \ + ThreadContext& threadContext, \ + const PxReal invDtF32, \ + const PxReal dtF32, \ + PxReal bounceThresholdF32, \ + PxReal frictionOffsetThreshold, \ + PxReal correlationDistance, \ + PxConstraintAllocator& constraintAllocator, \ + Cm::SpatialVectorF* Z + +#define CREATE_FINALIZE_SOVLER_CONTACT_METHOD_ARGS_4 \ + PxsContactManagerOutput** outputs, \ + ThreadContext& threadContext, \ + PxSolverContactDesc* blockDescs, \ + const PxReal invDtF32, \ + const PxReal dtF32, \ + PxReal bounceThresholdF32, \ + PxReal frictionThresholdF32, \ + PxReal correlationDistanceF32, \ + PxConstraintAllocator& constraintAllocator + + +/*! +Method prototype for create finalize solver contact +*/ + +typedef bool (*PxcCreateFinalizeSolverContactMethod)(CREATE_FINALIZE_SOLVER_CONTACT_METHOD_ARGS); + +extern PxcCreateFinalizeSolverContactMethod createFinalizeMethods[3]; + +typedef SolverConstraintPrepState::Enum (*PxcCreateFinalizeSolverContactMethod4)(CREATE_FINALIZE_SOVLER_CONTACT_METHOD_ARGS_4); + +extern PxcCreateFinalizeSolverContactMethod4 createFinalizeMethods4[3]; + + +bool createFinalizeSolverContacts( PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z); + +bool createFinalizeSolverContacts( PxSolverContactDesc& contactDesc, + CorrelationBuffer& c, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z); + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4( PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator); + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4( Dy::CorrelationBuffer& c, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator); + + + +bool createFinalizeSolverContactsCoulomb1D(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z); + +bool createFinalizeSolverContactsCoulomb2D(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z); + + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb1D( PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator); + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb2D(PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator); + + +PxU32 getContactManagerConstraintDesc(const PxsContactManagerOutput& cmOutput, const PxsContactManager& cm, PxSolverConstraintDesc& desc); + +class BlockAllocator : public PxConstraintAllocator +{ + PxsConstraintBlockManager& mConstraintBlockManager; + PxcConstraintBlockStream& mConstraintBlockStream; + FrictionPatchStreamPair& mFrictionPatchStreamPair; + PxU32& mTotalConstraintByteSize; +public: + + BlockAllocator(PxsConstraintBlockManager& constraintBlockManager, PxcConstraintBlockStream& constraintBlockStream, FrictionPatchStreamPair& frictionPatchStreamPair, + PxU32& totalConstraintByteSize) : + mConstraintBlockManager(constraintBlockManager), mConstraintBlockStream(constraintBlockStream), mFrictionPatchStreamPair(frictionPatchStreamPair), + mTotalConstraintByteSize(totalConstraintByteSize) + { + } + + virtual PxU8* reserveConstraintData(const PxU32 size); + + virtual PxU8* reserveFrictionData(const PxU32 size); + + virtual PxU8* findInputPatches(PxU8* frictionCookie) + { + return frictionCookie; + } + + PX_NOCOPY(BlockAllocator) + +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp new file mode 100644 index 0000000..acddb72 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4.cpp @@ -0,0 +1,1544 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "PxcNpWorkUnit.h" +#include "DyThreadContext.h" +#include "PxcNpContactPrepShared.h" + +using namespace physx; +using namespace Gu; + +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" + +using namespace aos; + +namespace physx +{ +namespace Dy +{ + +PxcCreateFinalizeSolverContactMethod4 createFinalizeMethods4[3] = +{ + createFinalizeSolverContacts4, + createFinalizeSolverContacts4Coulomb1D, + createFinalizeSolverContacts4Coulomb2D +}; + +inline bool ValidateVec4(const Vec4V v) +{ + PX_ALIGN(16, PxVec4 vF); + aos::V4StoreA(v, &vF.x); + return vF.isFinite(); +} + +static void setupFinalizeSolverConstraints4(PxSolverContactDesc* PX_RESTRICT descs, CorrelationBuffer& c, PxU8* PX_RESTRICT workspace, + const PxReal invDtF32, const PxReal dtF32, PxReal bounceThresholdF32, + const aos::Vec4VArg invMassScale0, const aos::Vec4VArg invInertiaScale0, + const aos::Vec4VArg invMassScale1, const aos::Vec4VArg invInertiaScale1) +{ + + //OK, we have a workspace of pre-allocated space to store all 4 descs in. We now need to create the constraints in it + + const Vec4V ccdMaxSeparation = aos::V4LoadXYZW(descs[0].maxCCDSeparation, descs[1].maxCCDSeparation, descs[2].maxCCDSeparation, descs[3].maxCCDSeparation); + const Vec4V solverOffsetSlop = aos::V4LoadXYZW(descs[0].offsetSlop, descs[1].offsetSlop, descs[2].offsetSlop, descs[3].offsetSlop); + + const Vec4V zero = V4Zero(); + const BoolV bFalse = BFFFF(); + const FloatV fZero = FZero(); + + PxU8 flags[4] = { PxU8(descs[0].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[1].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[2].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[3].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0) }; + + bool hasMaxImpulse = descs[0].hasMaxImpulse || descs[1].hasMaxImpulse || descs[2].hasMaxImpulse || descs[3].hasMaxImpulse; + + //The block is dynamic if **any** of the constraints have a non-static body B. This allows us to batch static and non-static constraints but we only get a memory/perf + //saving if all 4 are static. This simplifies the constraint partitioning such that it only needs to care about separating contacts and 1D constraints (which it already does) + bool isDynamic = false; + bool hasKinematic = false; + for(PxU32 a = 0; a < 4; ++a) + { + isDynamic = isDynamic || (descs[a].bodyState1 == PxSolverContactDesc::eDYNAMIC_BODY); + hasKinematic = hasKinematic || descs[a].bodyState1 == PxSolverContactDesc::eKINEMATIC_BODY; + } + + const PxU32 constraintSize = isDynamic ? sizeof(SolverContactBatchPointDynamic4) : sizeof(SolverContactBatchPointBase4); + const PxU32 frictionSize = isDynamic ? sizeof(SolverContactFrictionDynamic4) : sizeof(SolverContactFrictionBase4); + + PxU8* PX_RESTRICT ptr = workspace; + + const Vec4V dom0 = invMassScale0; + const Vec4V dom1 = invMassScale1; + const Vec4V angDom0 = invInertiaScale0; + const Vec4V angDom1 = invInertiaScale1; + + const Vec4V maxPenBias = V4Max(V4LoadXYZW(descs[0].data0->penBiasClamp, descs[1].data0->penBiasClamp, + descs[2].data0->penBiasClamp, descs[3].data0->penBiasClamp), + V4LoadXYZW(descs[0].data1->penBiasClamp, descs[1].data1->penBiasClamp, + descs[2].data1->penBiasClamp, descs[3].data1->penBiasClamp)); + + const Vec4V restDistance = V4LoadXYZW(descs[0].restDistance, descs[1].restDistance, descs[2].restDistance, + descs[3].restDistance); + + + //load up velocities + Vec4V linVel00 = V4LoadA(&descs[0].data0->linearVelocity.x); + Vec4V linVel10 = V4LoadA(&descs[1].data0->linearVelocity.x); + Vec4V linVel20 = V4LoadA(&descs[2].data0->linearVelocity.x); + Vec4V linVel30 = V4LoadA(&descs[3].data0->linearVelocity.x); + + Vec4V linVel01 = V4LoadA(&descs[0].data1->linearVelocity.x); + Vec4V linVel11 = V4LoadA(&descs[1].data1->linearVelocity.x); + Vec4V linVel21 = V4LoadA(&descs[2].data1->linearVelocity.x); + Vec4V linVel31 = V4LoadA(&descs[3].data1->linearVelocity.x); + + Vec4V angVel00 = V4LoadA(&descs[0].data0->angularVelocity.x); + Vec4V angVel10 = V4LoadA(&descs[1].data0->angularVelocity.x); + Vec4V angVel20 = V4LoadA(&descs[2].data0->angularVelocity.x); + Vec4V angVel30 = V4LoadA(&descs[3].data0->angularVelocity.x); + + Vec4V angVel01 = V4LoadA(&descs[0].data1->angularVelocity.x); + Vec4V angVel11 = V4LoadA(&descs[1].data1->angularVelocity.x); + Vec4V angVel21 = V4LoadA(&descs[2].data1->angularVelocity.x); + Vec4V angVel31 = V4LoadA(&descs[3].data1->angularVelocity.x); + + Vec4V linVelT00, linVelT10, linVelT20; + Vec4V linVelT01, linVelT11, linVelT21; + Vec4V angVelT00, angVelT10, angVelT20; + Vec4V angVelT01, angVelT11, angVelT21; + + PX_TRANSPOSE_44_34(linVel00, linVel10, linVel20, linVel30, linVelT00, linVelT10, linVelT20); + PX_TRANSPOSE_44_34(linVel01, linVel11, linVel21, linVel31, linVelT01, linVelT11, linVelT21); + PX_TRANSPOSE_44_34(angVel00, angVel10, angVel20, angVel30, angVelT00, angVelT10, angVelT20); + PX_TRANSPOSE_44_34(angVel01, angVel11, angVel21, angVel31, angVelT01, angVelT11, angVelT21); + + const Vec4V vrelX = V4Sub(linVelT00, linVelT01); + const Vec4V vrelY = V4Sub(linVelT10, linVelT11); + const Vec4V vrelZ = V4Sub(linVelT20, linVelT21); + + //Load up masses and invInertia + + /*const Vec4V sqrtInvMass0 = V4Merge(FLoad(descs[0].data0->sqrtInvMass), FLoad(descs[1].data0->sqrtInvMass), FLoad(descs[2].data0->sqrtInvMass), + FLoad(descs[3].data0->sqrtInvMass)); + + const Vec4V sqrtInvMass1 = V4Merge(FLoad(descs[0].data1->sqrtInvMass), FLoad(descs[1].data1->sqrtInvMass), FLoad(descs[2].data1->sqrtInvMass), + FLoad(descs[3].data1->sqrtInvMass));*/ + + const Vec4V invMass0 = V4LoadXYZW(descs[0].data0->invMass, descs[1].data0->invMass, descs[2].data0->invMass, descs[3].data0->invMass); + const Vec4V invMass1 = V4LoadXYZW(descs[0].data1->invMass, descs[1].data1->invMass, descs[2].data1->invMass, descs[3].data1->invMass); + + const Vec4V invMass0D0 = V4Mul(dom0, invMass0); + const Vec4V invMass1D1 = V4Mul(dom1, invMass1); + + Vec4V invInertia00X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].data0->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia00Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].data0->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia00Z = Vec4V_From_Vec3V(V3LoadU(descs[0].data0->sqrtInvInertia.column2)); + + Vec4V invInertia10X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].data0->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia10Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].data0->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia10Z = Vec4V_From_Vec3V(V3LoadU(descs[1].data0->sqrtInvInertia.column2)); + + Vec4V invInertia20X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].data0->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia20Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].data0->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia20Z = Vec4V_From_Vec3V(V3LoadU(descs[2].data0->sqrtInvInertia.column2)); + + Vec4V invInertia30X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].data0->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia30Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].data0->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia30Z = Vec4V_From_Vec3V(V3LoadU(descs[3].data0->sqrtInvInertia.column2)); + + Vec4V invInertia01X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].data1->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia01Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].data1->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia01Z = Vec4V_From_Vec3V(V3LoadU(descs[0].data1->sqrtInvInertia.column2)); + + Vec4V invInertia11X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].data1->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia11Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].data1->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia11Z = Vec4V_From_Vec3V(V3LoadU(descs[1].data1->sqrtInvInertia.column2)); + + Vec4V invInertia21X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].data1->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia21Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].data1->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia21Z = Vec4V_From_Vec3V(V3LoadU(descs[2].data1->sqrtInvInertia.column2)); + + Vec4V invInertia31X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].data1->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia31Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].data1->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia31Z = Vec4V_From_Vec3V(V3LoadU(descs[3].data1->sqrtInvInertia.column2)); + + Vec4V invInertia0X0, invInertia0X1, invInertia0X2; + Vec4V invInertia0Y0, invInertia0Y1, invInertia0Y2; + Vec4V invInertia0Z0, invInertia0Z1, invInertia0Z2; + + Vec4V invInertia1X0, invInertia1X1, invInertia1X2; + Vec4V invInertia1Y0, invInertia1Y1, invInertia1Y2; + Vec4V invInertia1Z0, invInertia1Z1, invInertia1Z2; + + PX_TRANSPOSE_44_34(invInertia00X, invInertia10X, invInertia20X, invInertia30X, invInertia0X0, invInertia0Y0, invInertia0Z0); + PX_TRANSPOSE_44_34(invInertia00Y, invInertia10Y, invInertia20Y, invInertia30Y, invInertia0X1, invInertia0Y1, invInertia0Z1); + PX_TRANSPOSE_44_34(invInertia00Z, invInertia10Z, invInertia20Z, invInertia30Z, invInertia0X2, invInertia0Y2, invInertia0Z2); + + PX_TRANSPOSE_44_34(invInertia01X, invInertia11X, invInertia21X, invInertia31X, invInertia1X0, invInertia1Y0, invInertia1Z0); + PX_TRANSPOSE_44_34(invInertia01Y, invInertia11Y, invInertia21Y, invInertia31Y, invInertia1X1, invInertia1Y1, invInertia1Z1); + PX_TRANSPOSE_44_34(invInertia01Z, invInertia11Z, invInertia21Z, invInertia31Z, invInertia1X2, invInertia1Y2, invInertia1Z2); + + + const FloatV invDt = FLoad(invDtF32); + const FloatV dt = FLoad(dtF32); + const FloatV p8 = FLoad(0.8f); + const Vec4V p84 = V4Splat(p8); + const Vec4V bounceThreshold = V4Splat(FLoad(bounceThresholdF32)); + + const FloatV invDtp8 = FMul(invDt, p8); + + const Vec3V bodyFrame00p = V3LoadU(descs[0].bodyFrame0.p); + const Vec3V bodyFrame01p = V3LoadU(descs[1].bodyFrame0.p); + const Vec3V bodyFrame02p = V3LoadU(descs[2].bodyFrame0.p); + const Vec3V bodyFrame03p = V3LoadU(descs[3].bodyFrame0.p); + + Vec4V bodyFrame00p4 = Vec4V_From_Vec3V(bodyFrame00p); + Vec4V bodyFrame01p4 = Vec4V_From_Vec3V(bodyFrame01p); + Vec4V bodyFrame02p4 = Vec4V_From_Vec3V(bodyFrame02p); + Vec4V bodyFrame03p4 = Vec4V_From_Vec3V(bodyFrame03p); + + Vec4V bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ; + PX_TRANSPOSE_44_34(bodyFrame00p4, bodyFrame01p4, bodyFrame02p4, bodyFrame03p4, bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ); + + + const Vec3V bodyFrame10p = V3LoadU(descs[0].bodyFrame1.p); + const Vec3V bodyFrame11p = V3LoadU(descs[1].bodyFrame1.p); + const Vec3V bodyFrame12p = V3LoadU(descs[2].bodyFrame1.p); + const Vec3V bodyFrame13p = V3LoadU(descs[3].bodyFrame1.p); + + Vec4V bodyFrame10p4 = Vec4V_From_Vec3V(bodyFrame10p); + Vec4V bodyFrame11p4 = Vec4V_From_Vec3V(bodyFrame11p); + Vec4V bodyFrame12p4 = Vec4V_From_Vec3V(bodyFrame12p); + Vec4V bodyFrame13p4 = Vec4V_From_Vec3V(bodyFrame13p); + + Vec4V bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ; + PX_TRANSPOSE_44_34(bodyFrame10p4, bodyFrame11p4, bodyFrame12p4, bodyFrame13p4, bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ); + + + const QuatV bodyFrame00q = QuatVLoadU(&descs[0].bodyFrame0.q.x); + const QuatV bodyFrame01q = QuatVLoadU(&descs[1].bodyFrame0.q.x); + const QuatV bodyFrame02q = QuatVLoadU(&descs[2].bodyFrame0.q.x); + const QuatV bodyFrame03q = QuatVLoadU(&descs[3].bodyFrame0.q.x); + + const QuatV bodyFrame10q = QuatVLoadU(&descs[0].bodyFrame1.q.x); + const QuatV bodyFrame11q = QuatVLoadU(&descs[1].bodyFrame1.q.x); + const QuatV bodyFrame12q = QuatVLoadU(&descs[2].bodyFrame1.q.x); + const QuatV bodyFrame13q = QuatVLoadU(&descs[3].bodyFrame1.q.x); + + PxU32 frictionPatchWritebackAddrIndex0 = 0; + PxU32 frictionPatchWritebackAddrIndex1 = 0; + PxU32 frictionPatchWritebackAddrIndex2 = 0; + PxU32 frictionPatchWritebackAddrIndex3 = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + PxU32 frictionIndex0 = 0, frictionIndex1 = 0, frictionIndex2 = 0, frictionIndex3 = 0; + //PxU32 contactIndex0 = 0, contactIndex1 = 0, contactIndex2 = 0, contactIndex3 = 0; + + + //OK, we iterate through all friction patch counts in the constraint patch, building up the constraint list etc. + + PxU32 maxPatches = PxMax(descs[0].numFrictionPatches, PxMax(descs[1].numFrictionPatches, PxMax(descs[2].numFrictionPatches, descs[3].numFrictionPatches))); + + const Vec4V p1 = V4Splat(FLoad(0.0001f)); + const Vec4V orthoThreshold = V4Splat(FLoad(0.70710678f)); + + + PxU32 contact0 = 0, contact1 = 0, contact2 = 0, contact3 = 0; + PxU32 patch0 = 0, patch1 = 0, patch2 = 0, patch3 = 0; + + PxU8 flag = 0; + if(hasMaxImpulse) + flag |= SolverContactHeader4::eHAS_MAX_IMPULSE; + + bool hasFinished[4]; + + for(PxU32 i=0;i= descs[0].numFrictionPatches; + hasFinished[1] = i >= descs[1].numFrictionPatches; + hasFinished[2] = i >= descs[2].numFrictionPatches; + hasFinished[3] = i >= descs[3].numFrictionPatches; + + + frictionIndex0 = hasFinished[0] ? frictionIndex0 : descs[0].startFrictionPatchIndex + i; + frictionIndex1 = hasFinished[1] ? frictionIndex1 : descs[1].startFrictionPatchIndex + i; + frictionIndex2 = hasFinished[2] ? frictionIndex2 : descs[2].startFrictionPatchIndex + i; + frictionIndex3 = hasFinished[3] ? frictionIndex3 : descs[3].startFrictionPatchIndex + i; + + PxU32 clampedContacts0 = hasFinished[0] ? 0 : c.frictionPatchContactCounts[frictionIndex0]; + PxU32 clampedContacts1 = hasFinished[1] ? 0 : c.frictionPatchContactCounts[frictionIndex1]; + PxU32 clampedContacts2 = hasFinished[2] ? 0 : c.frictionPatchContactCounts[frictionIndex2]; + PxU32 clampedContacts3 = hasFinished[3] ? 0 : c.frictionPatchContactCounts[frictionIndex3]; + + PxU32 firstPatch0 = c.correlationListHeads[frictionIndex0]; + PxU32 firstPatch1 = c.correlationListHeads[frictionIndex1]; + PxU32 firstPatch2 = c.correlationListHeads[frictionIndex2]; + PxU32 firstPatch3 = c.correlationListHeads[frictionIndex3]; + + const PxContactPoint* contactBase0 = descs[0].contacts + c.contactPatches[firstPatch0].start; + const PxContactPoint* contactBase1 = descs[1].contacts + c.contactPatches[firstPatch1].start; + const PxContactPoint* contactBase2 = descs[2].contacts + c.contactPatches[firstPatch2].start; + const PxContactPoint* contactBase3 = descs[3].contacts + c.contactPatches[firstPatch3].start; + + const Vec4V restitution = V4Neg(V4LoadXYZW(contactBase0->restitution, contactBase1->restitution, contactBase2->restitution, + contactBase3->restitution)); + const Vec4V damping = V4LoadXYZW(contactBase0->damping, contactBase1->damping, contactBase2->damping, contactBase3->damping); + + SolverContactHeader4* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactHeader4); + + + header->flags[0] = flags[0]; + header->flags[1] = flags[1]; + header->flags[2] = flags[2]; + header->flags[3] = flags[3]; + + header->flag = flag; + + PxU32 totalContacts = PxMax(clampedContacts0, PxMax(clampedContacts1, PxMax(clampedContacts2, clampedContacts3))); + + Vec4V* PX_RESTRICT appliedNormalForces = reinterpret_cast(ptr); + ptr += sizeof(Vec4V)*totalContacts; + + PxMemZero(appliedNormalForces, sizeof(Vec4V) * totalContacts); + + header->numNormalConstr = PxTo8(totalContacts); + header->numNormalConstr0 = PxTo8(clampedContacts0); + header->numNormalConstr1 = PxTo8(clampedContacts1); + header->numNormalConstr2 = PxTo8(clampedContacts2); + header->numNormalConstr3 = PxTo8(clampedContacts3); + //header->sqrtInvMassA = sqrtInvMass0; + //header->sqrtInvMassB = sqrtInvMass1; + header->invMass0D0 = invMass0D0; + header->invMass1D1 = invMass1D1; + header->angDom0 = angDom0; + header->angDom1 = angDom1; + header->shapeInteraction[0] = getInteraction(descs[0]); header->shapeInteraction[1] = getInteraction(descs[1]); + header->shapeInteraction[2] = getInteraction(descs[2]); header->shapeInteraction[3] = getInteraction(descs[3]); + + Vec4V* maxImpulse = reinterpret_cast(ptr + constraintSize * totalContacts); + + header->restitution = restitution; + + Vec4V normal0 = V4LoadA(&contactBase0->normal.x); + Vec4V normal1 = V4LoadA(&contactBase1->normal.x); + Vec4V normal2 = V4LoadA(&contactBase2->normal.x); + Vec4V normal3 = V4LoadA(&contactBase3->normal.x); + + Vec4V normalX, normalY, normalZ; + PX_TRANSPOSE_44_34(normal0, normal1, normal2, normal3, normalX, normalY, normalZ); + + PX_ASSERT(ValidateVec4(normalX)); + PX_ASSERT(ValidateVec4(normalY)); + PX_ASSERT(ValidateVec4(normalZ)); + + header->normalX = normalX; + header->normalY = normalY; + header->normalZ = normalZ; + + const Vec4V norVel0 = V4MulAdd(normalZ, linVelT20, V4MulAdd(normalY, linVelT10, V4Mul(normalX, linVelT00))); + const Vec4V norVel1 = V4MulAdd(normalZ, linVelT21, V4MulAdd(normalY, linVelT11, V4Mul(normalX, linVelT01))); + const Vec4V relNorVel = V4Sub(norVel0, norVel1); + + //For all correlation heads - need to pull this out I think + + //OK, we have a counter for all our patches... + PxU32 finished = (PxU32(hasFinished[0])) | + ((PxU32(hasFinished[1])) << 1) | + ((PxU32(hasFinished[2])) << 2) | + ((PxU32(hasFinished[3])) << 3); + + CorrelationListIterator iter0(c, firstPatch0); + CorrelationListIterator iter1(c, firstPatch1); + CorrelationListIterator iter2(c, firstPatch2); + CorrelationListIterator iter3(c, firstPatch3); + + //PxU32 contact0, contact1, contact2, contact3; + //PxU32 patch0, patch1, patch2, patch3; + + if(!hasFinished[0]) + iter0.nextContact(patch0, contact0); + if(!hasFinished[1]) + iter1.nextContact(patch1, contact1); + if(!hasFinished[2]) + iter2.nextContact(patch2, contact2); + if(!hasFinished[3]) + iter3.nextContact(patch3, contact3); + + PxU8* p = ptr; + + PxU32 contactCount = 0; + PxU32 newFinished = + ( PxU32(hasFinished[0] || !iter0.hasNextContact())) | + ((PxU32(hasFinished[1] || !iter1.hasNextContact())) << 1) | + ((PxU32(hasFinished[2] || !iter2.hasNextContact())) << 2) | + ((PxU32(hasFinished[3] || !iter3.hasNextContact())) << 3); + + BoolV bFinished = BLoad(hasFinished); + + while(finished != 0xf) + { + finished = newFinished; + ++contactCount; + PxPrefetchLine(p, 384); + PxPrefetchLine(p, 512); + PxPrefetchLine(p, 640); + + SolverContactBatchPointBase4* PX_RESTRICT solverContact = reinterpret_cast(p); + p += constraintSize; + + const PxContactPoint& con0 = descs[0].contacts[c.contactPatches[patch0].start + contact0]; + const PxContactPoint& con1 = descs[1].contacts[c.contactPatches[patch1].start + contact1]; + const PxContactPoint& con2 = descs[2].contacts[c.contactPatches[patch2].start + contact2]; + const PxContactPoint& con3 = descs[3].contacts[c.contactPatches[patch3].start + contact3]; + + //Now we need to splice these 4 contacts into a single structure + + { + Vec4V point0 = V4LoadA(&con0.point.x); + Vec4V point1 = V4LoadA(&con1.point.x); + Vec4V point2 = V4LoadA(&con2.point.x); + Vec4V point3 = V4LoadA(&con3.point.x); + + Vec4V pointX, pointY, pointZ; + PX_TRANSPOSE_44_34(point0, point1, point2, point3, pointX, pointY, pointZ); + + PX_ASSERT(ValidateVec4(pointX)); + PX_ASSERT(ValidateVec4(pointY)); + PX_ASSERT(ValidateVec4(pointZ)); + + Vec4V cTargetVel0 = V4LoadA(&con0.targetVel.x); + Vec4V cTargetVel1 = V4LoadA(&con1.targetVel.x); + Vec4V cTargetVel2 = V4LoadA(&con2.targetVel.x); + Vec4V cTargetVel3 = V4LoadA(&con3.targetVel.x); + + Vec4V cTargetVelX, cTargetVelY, cTargetVelZ; + PX_TRANSPOSE_44_34(cTargetVel0, cTargetVel1, cTargetVel2, cTargetVel3, cTargetVelX, cTargetVelY, cTargetVelZ); + + const Vec4V separation = V4LoadXYZW(con0.separation, con1.separation, con2.separation, con3.separation); + + const Vec4V cTargetNorVel = V4MulAdd(cTargetVelX, normalX, V4MulAdd(cTargetVelY, normalY, V4Mul(cTargetVelZ, normalZ))); + + const Vec4V raX = V4Sub(pointX, bodyFrame0pX); + const Vec4V raY = V4Sub(pointY, bodyFrame0pY); + const Vec4V raZ = V4Sub(pointZ, bodyFrame0pZ); + + const Vec4V rbX = V4Sub(pointX, bodyFrame1pX); + const Vec4V rbY = V4Sub(pointY, bodyFrame1pY); + const Vec4V rbZ = V4Sub(pointZ, bodyFrame1pZ); + + /*raX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raX)), zero, raX); + raY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raY)), zero, raY); + raZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raZ)), zero, raZ); + + rbX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbX)), zero, rbX); + rbY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbY)), zero, rbY); + rbZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbZ)), zero, rbZ);*/ + + PX_ASSERT(ValidateVec4(raX)); + PX_ASSERT(ValidateVec4(raY)); + PX_ASSERT(ValidateVec4(raZ)); + + PX_ASSERT(ValidateVec4(rbX)); + PX_ASSERT(ValidateVec4(rbY)); + PX_ASSERT(ValidateVec4(rbZ)); + + + //raXn = cross(ra, normal) which = Vec3V( a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); + + Vec4V raXnX = V4NegMulSub(raZ, normalY, V4Mul(raY, normalZ)); + Vec4V raXnY = V4NegMulSub(raX, normalZ, V4Mul(raZ, normalX)); + Vec4V raXnZ = V4NegMulSub(raY, normalX, V4Mul(raX, normalY)); + + Vec4V rbXnX = V4NegMulSub(rbZ, normalY, V4Mul(rbY, normalZ)); + Vec4V rbXnY = V4NegMulSub(rbX, normalZ, V4Mul(rbZ, normalX)); + Vec4V rbXnZ = V4NegMulSub(rbY, normalX, V4Mul(rbX, normalY)); + + Vec4V dotRaXnAngVel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4Mul(raXnX, angVelT00))); + Vec4V dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4Mul(rbXnX, angVelT01))); + + Vec4V relAng = V4Sub(dotRaXnAngVel0, dotRbXnAngVel1); + + const Vec4V slop = V4Mul(solverOffsetSlop, V4Max(V4Sel(V4IsEq(relNorVel, zero), V4Splat(FMax()), V4Div(relAng, relNorVel)), V4One())); + + raXnX = V4Sel(V4IsGrtr(slop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(slop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(slop, V4Abs(raXnZ)), zero, raXnZ); + + rbXnX = V4Sel(V4IsGrtr(slop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(slop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(slop, V4Abs(rbXnZ)), zero, rbXnZ); + + //Re-do this because we need an accurate and updated angular velocity + dotRaXnAngVel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4Mul(raXnX, angVelT00))); + dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4Mul(rbXnX, angVelT01))); + + relAng = V4Sub(dotRaXnAngVel0, dotRbXnAngVel1); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + + PX_ASSERT(ValidateVec4(delAngVel0X)); + PX_ASSERT(ValidateVec4(delAngVel0Y)); + PX_ASSERT(ValidateVec4(delAngVel0Z)); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0X, delAngVel0X, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0Z, delAngVel0Z))); + + + Vec4V unitResponse = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + Vec4V vrel = V4Add(relNorVel, relAng); + + //The dynamic-only parts - need to if-statement these up. A branch here shouldn't cost us too much + if(isDynamic) + { + SolverContactBatchPointDynamic4* PX_RESTRICT dynamicContact = static_cast(solverContact); + + Vec4V delAngVel1X = V4Mul(invInertia1X0, rbXnX); + Vec4V delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + Vec4V delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + PX_ASSERT(ValidateVec4(delAngVel1X)); + PX_ASSERT(ValidateVec4(delAngVel1Y)); + PX_ASSERT(ValidateVec4(delAngVel1Z)); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1X, delAngVel1X, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1Z, delAngVel1Z))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + unitResponse = V4Add(unitResponse, resp1); + + //These are for dynamic-only contacts. + dynamicContact->rbXnX = delAngVel1X; + dynamicContact->rbXnY = delAngVel1Y; + dynamicContact->rbXnZ = delAngVel1Z; + + } + + const Vec4V penetration = V4Sub(separation, restDistance); + const Vec4V penInvDtPt8 = V4Max(maxPenBias, V4Scale(penetration, invDtp8)); + + //..././.... + const BoolV isCompliant = V4IsGrtr(restitution, zero); + const Vec4V rdt = V4Scale(restitution, dt); + const Vec4V a = V4Scale(V4Add(damping, rdt), dt); + const Vec4V b = V4Scale(V4Mul(restitution, penetration), dt); + const Vec4V x = V4Recip(V4MulAdd(a, unitResponse, V4One())); + const Vec4V velMultiplier = V4Sel(isCompliant, V4Mul(x, a), V4Sel(V4IsGrtr(unitResponse, zero), V4Recip(unitResponse), zero)); + const Vec4V impulseMultiplier = V4Sub(V4One(), V4Sel(isCompliant, x, zero)); + + + Vec4V scaledBias = V4Mul(penInvDtPt8, velMultiplier); + + const Vec4V penetrationInvDt = V4Scale(penetration, invDt); + + const BoolV isGreater2 = BAnd(BAnd(V4IsGrtr(zero, restitution), V4IsGrtr(bounceThreshold, vrel)), + V4IsGrtr(V4Neg(vrel), penetrationInvDt)); + + const BoolV ccdSeparationCondition = V4IsGrtrOrEq(ccdMaxSeparation, penetration); + + scaledBias = V4Neg(V4Sel(isCompliant, V4Mul(x, b), V4Sel(BAnd(ccdSeparationCondition, isGreater2), zero, scaledBias))); + + const Vec4V targetVelocity = V4Mul(V4Add(V4Sub(cTargetNorVel, vrel), V4Sel(isGreater2, V4Mul(vrel, restitution), zero)), velMultiplier); + + Vec4V biasedErr = V4Add(targetVelocity, scaledBias); + + //These values are present for static and dynamic contacts + solverContact->raXnX = delAngVel0X; + solverContact->raXnY = delAngVel0Y; + solverContact->raXnZ = delAngVel0Z; + solverContact->velMultiplier =V4Sel(bFinished, zero, velMultiplier); + solverContact->biasedErr = V4Sel(bFinished, zero, biasedErr); + solverContact->impulseMultiplier = impulseMultiplier; + + //solverContact->scaledBias = V4Max(zero, scaledBias); + solverContact->scaledBias = V4Sel(BOr(bFinished, isCompliant), zero, V4Sel(isGreater2, scaledBias, V4Max(zero, scaledBias))); + + if(hasMaxImpulse) + { + maxImpulse[contactCount-1] = V4Merge(FLoad(con0.maxImpulse), FLoad(con1.maxImpulse), FLoad(con2.maxImpulse), + FLoad(con3.maxImpulse)); + } + } + if (!(finished & 0x1)) + { + iter0.nextContact(patch0, contact0); + newFinished |= PxU32(!iter0.hasNextContact()); + } + else + bFinished = BSetX(bFinished, bFalse); + + if(!(finished & 0x2)) + { + iter1.nextContact(patch1, contact1); + newFinished |= (PxU32(!iter1.hasNextContact()) << 1); + } + else + bFinished = BSetY(bFinished, bFalse); + + if(!(finished & 0x4)) + { + iter2.nextContact(patch2, contact2); + newFinished |= (PxU32(!iter2.hasNextContact()) << 2); + } + else + bFinished = BSetZ(bFinished, bFalse); + + if(!(finished & 0x8)) + { + iter3.nextContact(patch3, contact3); + newFinished |= (PxU32(!iter3.hasNextContact()) << 3); + } + else + bFinished = BSetW(bFinished, bFalse); + } + ptr = p; + if(hasMaxImpulse) + { + ptr += sizeof(Vec4V) * totalContacts; + } + + //OK...friction time :-) + + Vec4V maxImpulseScale = V4One(); + { + + const FrictionPatch& frictionPatch0 = c.frictionPatches[frictionIndex0]; + const FrictionPatch& frictionPatch1 = c.frictionPatches[frictionIndex1]; + const FrictionPatch& frictionPatch2 = c.frictionPatches[frictionIndex2]; + const FrictionPatch& frictionPatch3 = c.frictionPatches[frictionIndex3]; + + PxU32 anchorCount0 = frictionPatch0.anchorCount; + PxU32 anchorCount1 = frictionPatch1.anchorCount; + PxU32 anchorCount2 = frictionPatch2.anchorCount; + PxU32 anchorCount3 = frictionPatch3.anchorCount; + + PxU32 clampedAnchorCount0 = hasFinished[0] || (contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount0; + PxU32 clampedAnchorCount1 = hasFinished[1] || (contactBase1->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount1; + PxU32 clampedAnchorCount2 = hasFinished[2] || (contactBase2->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount2; + PxU32 clampedAnchorCount3 = hasFinished[3] || (contactBase3->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount3; + + const PxU32 maxAnchorCount = PxMax(clampedAnchorCount0, PxMax(clampedAnchorCount1, PxMax(clampedAnchorCount2, clampedAnchorCount3))); + + PxReal coefficient0 = (contactBase0->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && anchorCount0 == 2) ? 0.5f : 1.f; + PxReal coefficient1 = (contactBase1->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && anchorCount1 == 2) ? 0.5f : 1.f; + PxReal coefficient2 = (contactBase2->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && anchorCount2 == 2) ? 0.5f : 1.f; + PxReal coefficient3 = (contactBase3->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && anchorCount3 == 2) ? 0.5f : 1.f; + + const Vec4V staticFriction = V4LoadXYZW(contactBase0->staticFriction*coefficient0, contactBase1->staticFriction*coefficient1, + contactBase2->staticFriction*coefficient2, contactBase3->staticFriction*coefficient3); + + const Vec4V dynamicFriction = V4LoadXYZW(contactBase0->dynamicFriction*coefficient0, contactBase1->dynamicFriction*coefficient1, + contactBase2->dynamicFriction*coefficient2, contactBase3->dynamicFriction*coefficient3); + + PX_ASSERT(totalContacts == contactCount); + header->dynamicFriction = dynamicFriction; + header->staticFriction = staticFriction; + + + + //if(clampedAnchorCount0 != clampedAnchorCount1 || clampedAnchorCount0 != clampedAnchorCount2 || clampedAnchorCount0 != clampedAnchorCount3) + // PxDebugBreak(); + + + //const bool haveFriction = maxAnchorCount != 0; + header->numFrictionConstr = PxTo8(maxAnchorCount*2); + header->numFrictionConstr0 = PxTo8(clampedAnchorCount0*2); + header->numFrictionConstr1 = PxTo8(clampedAnchorCount1*2); + header->numFrictionConstr2 = PxTo8(clampedAnchorCount2*2); + header->numFrictionConstr3 = PxTo8(clampedAnchorCount3*2); + + //KS - TODO - extend this if needed + header->type = PxTo8(isDynamic ? DY_SC_TYPE_BLOCK_RB_CONTACT : DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT); + + if(maxAnchorCount) + { + + //Allocate the shared friction data... + + SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(ptr); + ptr += sizeof(SolverFrictionSharedData4); + PX_UNUSED(fd); + + const BoolV cond =V4IsGrtr(orthoThreshold, V4Abs(normalX)); + + const Vec4V t0FallbackX = V4Sel(cond, zero, V4Neg(normalY)); + const Vec4V t0FallbackY = V4Sel(cond, V4Neg(normalZ), normalX); + const Vec4V t0FallbackZ = V4Sel(cond, normalY, zero); + + //const Vec4V dotNormalVrel = V4MulAdd(normalZ, vrelZ, V4MulAdd(normalY, vrelY, V4Mul(normalX, vrelX))); + const Vec4V vrelSubNorVelX = V4NegMulSub(normalX, relNorVel, vrelX); + const Vec4V vrelSubNorVelY = V4NegMulSub(normalY, relNorVel, vrelY); + const Vec4V vrelSubNorVelZ = V4NegMulSub(normalZ, relNorVel, vrelZ); + + const Vec4V lenSqvrelSubNorVelZ = V4MulAdd(vrelSubNorVelX, vrelSubNorVelX, V4MulAdd(vrelSubNorVelY, vrelSubNorVelY, V4Mul(vrelSubNorVelZ, vrelSubNorVelZ))); + + const BoolV bcon2 = V4IsGrtr(lenSqvrelSubNorVelZ, p1); + + Vec4V t0X = V4Sel(bcon2, vrelSubNorVelX, t0FallbackX); + Vec4V t0Y = V4Sel(bcon2, vrelSubNorVelY, t0FallbackY); + Vec4V t0Z = V4Sel(bcon2, vrelSubNorVelZ, t0FallbackZ); + + + //Now normalize this... + const Vec4V recipLen = V4Rsqrt(V4MulAdd(t0Z, t0Z, V4MulAdd(t0Y, t0Y, V4Mul(t0X, t0X)))); + + t0X = V4Mul(t0X, recipLen); + t0Y = V4Mul(t0Y, recipLen); + t0Z = V4Mul(t0Z, recipLen); + + Vec4V t1X = V4NegMulSub(normalZ, t0Y, V4Mul(normalY, t0Z)); + Vec4V t1Y = V4NegMulSub(normalX, t0Z, V4Mul(normalZ, t0X)); + Vec4V t1Z = V4NegMulSub(normalY, t0X, V4Mul(normalX, t0Y)); + + PX_ASSERT((uintptr_t(descs[0].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[1].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[2].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[3].frictionPtr) & 0xF) == 0); + + + PxU8* PX_RESTRICT writeback0 = descs[0].frictionPtr + frictionPatchWritebackAddrIndex0*sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback1 = descs[1].frictionPtr + frictionPatchWritebackAddrIndex1*sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback2 = descs[2].frictionPtr + frictionPatchWritebackAddrIndex2*sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback3 = descs[3].frictionPtr + frictionPatchWritebackAddrIndex3*sizeof(FrictionPatch); + + PxU32 index0 = 0, index1 = 0, index2 = 0, index3 = 0; + + fd->broken = bFalse; + fd->frictionBrokenWritebackByte[0] = writeback0; + fd->frictionBrokenWritebackByte[1] = writeback1; + fd->frictionBrokenWritebackByte[2] = writeback2; + fd->frictionBrokenWritebackByte[3] = writeback3; + + + fd->normalX[0] = t0X; + fd->normalY[0] = t0Y; + fd->normalZ[0] = t0Z; + + fd->normalX[1] = t1X; + fd->normalY[1] = t1Y; + fd->normalZ[1] = t1Z; + + Vec4V* PX_RESTRICT appliedForces = reinterpret_cast(ptr); + ptr += sizeof(Vec4V)*header->numFrictionConstr; + + PxMemZero(appliedForces, sizeof(Vec4V) * header->numFrictionConstr); + + for(PxU32 j = 0; j < maxAnchorCount; j++) + { + PxPrefetchLine(ptr, 384); + PxPrefetchLine(ptr, 512); + PxPrefetchLine(ptr, 640); + SolverContactFrictionBase4* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionSize; + SolverContactFrictionBase4* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionSize; + + index0 = j < clampedAnchorCount0 ? j : index0; + index1 = j < clampedAnchorCount1 ? j : index1; + index2 = j < clampedAnchorCount2 ? j : index2; + index3 = j < clampedAnchorCount3 ? j : index3; + + if(j >= clampedAnchorCount0) + maxImpulseScale = V4SetX(maxImpulseScale, fZero); + if(j >= clampedAnchorCount1) + maxImpulseScale = V4SetY(maxImpulseScale, fZero); + if(j >= clampedAnchorCount2) + maxImpulseScale = V4SetZ(maxImpulseScale, fZero); + if(j >= clampedAnchorCount3) + maxImpulseScale = V4SetW(maxImpulseScale, fZero); + + t0X = V4Mul(maxImpulseScale, t0X); + t0Y = V4Mul(maxImpulseScale, t0Y); + t0Z = V4Mul(maxImpulseScale, t0Z); + + t1X = V4Mul(maxImpulseScale, t1X); + t1Y = V4Mul(maxImpulseScale, t1Y); + t1Z = V4Mul(maxImpulseScale, t1Z); + + + Vec3V body0Anchor0 = V3LoadU(frictionPatch0.body0Anchors[index0]); + Vec3V body0Anchor1 = V3LoadU(frictionPatch1.body0Anchors[index1]); + Vec3V body0Anchor2 = V3LoadU(frictionPatch2.body0Anchors[index2]); + Vec3V body0Anchor3 = V3LoadU(frictionPatch3.body0Anchors[index3]); + + Vec4V ra0 = Vec4V_From_Vec3V(QuatRotate(bodyFrame00q, body0Anchor0)); + Vec4V ra1 = Vec4V_From_Vec3V(QuatRotate(bodyFrame01q, body0Anchor1)); + Vec4V ra2 = Vec4V_From_Vec3V(QuatRotate(bodyFrame02q, body0Anchor2)); + Vec4V ra3 = Vec4V_From_Vec3V(QuatRotate(bodyFrame03q, body0Anchor3)); + + Vec4V raX, raY, raZ; + PX_TRANSPOSE_44_34(ra0, ra1, ra2, ra3, raX, raY, raZ); + + /*raX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raX)), zero, raX); + raY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raY)), zero, raY); + raZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raZ)), zero, raZ);*/ + + const Vec4V raWorldX = V4Add(raX, bodyFrame0pX); + const Vec4V raWorldY = V4Add(raY, bodyFrame0pY); + const Vec4V raWorldZ = V4Add(raZ, bodyFrame0pZ); + + Vec3V body1Anchor0 = V3LoadU(frictionPatch0.body1Anchors[index0]); + Vec3V body1Anchor1 = V3LoadU(frictionPatch1.body1Anchors[index1]); + Vec3V body1Anchor2 = V3LoadU(frictionPatch2.body1Anchors[index2]); + Vec3V body1Anchor3 = V3LoadU(frictionPatch3.body1Anchors[index3]); + + Vec4V rb0 = Vec4V_From_Vec3V(QuatRotate(bodyFrame10q, body1Anchor0)); + Vec4V rb1 = Vec4V_From_Vec3V(QuatRotate(bodyFrame11q, body1Anchor1)); + Vec4V rb2 = Vec4V_From_Vec3V(QuatRotate(bodyFrame12q, body1Anchor2)); + Vec4V rb3 = Vec4V_From_Vec3V(QuatRotate(bodyFrame13q, body1Anchor3)); + + Vec4V rbX, rbY, rbZ; + PX_TRANSPOSE_44_34(rb0, rb1, rb2, rb3, rbX, rbY, rbZ); + + /*rbX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbX)), zero, rbX); + rbY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbY)), zero, rbY); + rbZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbZ)), zero, rbZ);*/ + + const Vec4V rbWorldX = V4Add(rbX, bodyFrame1pX); + const Vec4V rbWorldY = V4Add(rbY, bodyFrame1pY); + const Vec4V rbWorldZ = V4Add(rbZ, bodyFrame1pZ); + + Vec4V errorX = V4Sub(raWorldX, rbWorldX); + Vec4V errorY = V4Sub(raWorldY, rbWorldY); + Vec4V errorZ = V4Sub(raWorldZ, rbWorldZ); + + /*errorX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorX)), zero, errorX); + errorY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorY)), zero, errorY); + errorZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorZ)), zero, errorZ);*/ + + //KS - todo - get this working with per-point friction + PxU32 contactIndex0 = c.contactID[frictionIndex0][index0]; + PxU32 contactIndex1 = c.contactID[frictionIndex1][index1]; + PxU32 contactIndex2 = c.contactID[frictionIndex2][index2]; + PxU32 contactIndex3 = c.contactID[frictionIndex3][index3]; + + //Ensure that the ocntact indices are valid + PX_ASSERT(contactIndex0 == 0xffff || contactIndex0 < descs[0].numContacts); + PX_ASSERT(contactIndex1 == 0xffff || contactIndex1 < descs[1].numContacts); + PX_ASSERT(contactIndex2 == 0xffff || contactIndex2 < descs[2].numContacts); + PX_ASSERT(contactIndex3 == 0xffff || contactIndex3 < descs[3].numContacts); + + Vec4V targetVel0 = V4LoadA(contactIndex0 == 0xFFFF ? &contactBase0->targetVel.x : &descs[0].contacts[contactIndex0].targetVel.x); + Vec4V targetVel1 = V4LoadA(contactIndex1 == 0xFFFF ? &contactBase0->targetVel.x : &descs[1].contacts[contactIndex1].targetVel.x); + Vec4V targetVel2 = V4LoadA(contactIndex2 == 0xFFFF ? &contactBase0->targetVel.x : &descs[2].contacts[contactIndex2].targetVel.x); + Vec4V targetVel3 = V4LoadA(contactIndex3 == 0xFFFF ? &contactBase0->targetVel.x : &descs[3].contacts[contactIndex3].targetVel.x); + + Vec4V targetVelX, targetVelY, targetVelZ; + PX_TRANSPOSE_44_34(targetVel0, targetVel1, targetVel2, targetVel3, targetVelX, targetVelY, targetVelZ); + + + { + Vec4V raXnX = V4NegMulSub(raZ, t0Y, V4Mul(raY, t0Z)); + Vec4V raXnY = V4NegMulSub(raX, t0Z, V4Mul(raZ, t0X)); + Vec4V raXnZ = V4NegMulSub(raY, t0X, V4Mul(raX, t0Y)); + + raXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnZ)), zero, raXnZ); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + + Vec4V resp = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + + const Vec4V tVel0 = V4MulAdd(t0Z, linVelT20, V4MulAdd(t0Y, linVelT10, V4Mul(t0X, linVelT00))); + Vec4V vrel = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4MulAdd(raXnX, angVelT00, tVel0))); + + if(isDynamic) + { + SolverContactFrictionDynamic4* PX_RESTRICT dynamicF0 = static_cast(f0); + + Vec4V rbXnX = V4NegMulSub(rbZ, t0Y, V4Mul(rbY, t0Z)); + Vec4V rbXnY = V4NegMulSub(rbX, t0Z, V4Mul(rbZ, t0X)); + Vec4V rbXnZ = V4NegMulSub(rbY, t0X, V4Mul(rbX, t0Y)); + + rbXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnZ)), zero, rbXnZ); + + Vec4V delAngVel1X = V4Mul(invInertia1X0, rbXnX); + Vec4V delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + Vec4V delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + resp = V4Add(resp, resp1); + + dynamicF0->rbXnX = delAngVel1X; + dynamicF0->rbXnY = delAngVel1Y; + dynamicF0->rbXnZ = delAngVel1Z; + + const Vec4V tVel1 = V4MulAdd(t0Z, linVelT21, V4MulAdd(t0Y, linVelT11, V4Mul(t0X, linVelT01))); + const Vec4V vel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + + vrel = V4Sub(vrel, vel1); + } + else if(hasKinematic) + { + const Vec4V rbXnX = V4NegMulSub(rbZ, t0Y, V4Mul(rbY, t0Z)); + const Vec4V rbXnY = V4NegMulSub(rbX, t0Z, V4Mul(rbZ, t0X)); + const Vec4V rbXnZ = V4NegMulSub(rbY, t0X, V4Mul(rbX, t0Y)); + + const Vec4V tVel1 = V4MulAdd(t0Z, linVelT21, V4MulAdd(t0Y, linVelT11, V4Mul(t0X, linVelT01))); + const Vec4V dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + + vrel = V4Sub(vrel, dotRbXnAngVel1); + } + + + const Vec4V velMultiplier = V4Mul(maxImpulseScale, V4Sel(V4IsGrtr(resp, zero), V4Div(p84, resp), zero)); + + Vec4V bias = V4Scale(V4MulAdd(t0Z, errorZ, V4MulAdd(t0Y, errorY, V4Mul(t0X, errorX))), invDt); + + Vec4V targetVel = V4MulAdd(t0Z, targetVelZ,V4MulAdd(t0Y, targetVelY, V4Mul(t0X, targetVelX))); + targetVel = V4Sub(targetVel, vrel); + f0->targetVelocity = V4Neg(V4Mul(targetVel, velMultiplier)); + bias = V4Sub(bias, targetVel); + + f0->raXnX = delAngVel0X; + f0->raXnY = delAngVel0Y; + f0->raXnZ = delAngVel0Z; + f0->scaledBias = V4Mul(bias, velMultiplier); + f0->velMultiplier = velMultiplier; + } + + { + Vec4V raXnX = V4NegMulSub(raZ, t1Y, V4Mul(raY, t1Z)); + Vec4V raXnY = V4NegMulSub(raX, t1Z, V4Mul(raZ, t1X)); + Vec4V raXnZ = V4NegMulSub(raY, t1X, V4Mul(raX, t1Y)); + + raXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnZ)), zero, raXnZ); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + + Vec4V resp = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + + const Vec4V tVel0 = V4MulAdd(t1Z, linVelT20, V4MulAdd(t1Y, linVelT10, V4Mul(t1X, linVelT00))); + Vec4V vrel = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4MulAdd(raXnX, angVelT00, tVel0))); + + if(isDynamic) + { + SolverContactFrictionDynamic4* PX_RESTRICT dynamicF1 = static_cast(f1); + + Vec4V rbXnX = V4NegMulSub(rbZ, t1Y, V4Mul(rbY, t1Z)); + Vec4V rbXnY = V4NegMulSub(rbX, t1Z, V4Mul(rbZ, t1X)); + Vec4V rbXnZ = V4NegMulSub(rbY, t1X, V4Mul(rbX, t1Y)); + + rbXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnZ)), zero, rbXnZ); + + Vec4V delAngVel1X = V4Mul(invInertia1X0, rbXnX); + Vec4V delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + Vec4V delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + resp = V4Add(resp, resp1); + + dynamicF1->rbXnX = delAngVel1X; + dynamicF1->rbXnY = delAngVel1Y; + dynamicF1->rbXnZ = delAngVel1Z; + + const Vec4V tVel1 = V4MulAdd(t1Z, linVelT21, V4MulAdd(t1Y, linVelT11, V4Mul(t1X, linVelT01))); + const Vec4V vel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + + vrel = V4Sub(vrel, vel1); + + } + else if(hasKinematic) + { + const Vec4V rbXnX = V4NegMulSub(rbZ, t1Y, V4Mul(rbY, t1Z)); + const Vec4V rbXnY = V4NegMulSub(rbX, t1Z, V4Mul(rbZ, t1X)); + const Vec4V rbXnZ = V4NegMulSub(rbY, t1X, V4Mul(rbX, t1Y)); + + const Vec4V tVel1 = V4MulAdd(t1Z, linVelT21, V4MulAdd(t1Y, linVelT11, V4Mul(t1X, linVelT01))); + const Vec4V dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + + vrel = V4Sub(vrel, dotRbXnAngVel1); + } + + + const Vec4V velMultiplier = V4Mul(maxImpulseScale, V4Sel(V4IsGrtr(resp, zero), V4Div(p84, resp), zero)); + + Vec4V bias = V4Scale(V4MulAdd(t1Z, errorZ, V4MulAdd(t1Y, errorY, V4Mul(t1X, errorX))), invDt); + + Vec4V targetVel = V4MulAdd(t1Z, targetVelZ,V4MulAdd(t1Y, targetVelY, V4Mul(t1X, targetVelX))); + targetVel = V4Sub(targetVel, vrel); + f1->targetVelocity = V4Neg(V4Mul(targetVel, velMultiplier)); + bias = V4Sub(bias, targetVel); + f1->raXnX = delAngVel0X; + f1->raXnY = delAngVel0Y; + f1->raXnZ = delAngVel0Z; + f1->scaledBias = V4Mul(bias, velMultiplier); + f1->velMultiplier = velMultiplier; + } + } + + frictionPatchWritebackAddrIndex0++; + frictionPatchWritebackAddrIndex1++; + frictionPatchWritebackAddrIndex2++; + frictionPatchWritebackAddrIndex3++; + } + } + } +} + + + +PX_FORCE_INLINE void computeBlockStreamFrictionByteSizes(const CorrelationBuffer& c, + PxU32& _frictionPatchByteSize, PxU32& _numFrictionPatches, + PxU32 frictionPatchStartIndex, PxU32 frictionPatchEndIndex) +{ + // PT: use local vars to remove LHS + PxU32 numFrictionPatches = 0; + + for(PxU32 i = frictionPatchStartIndex; i < frictionPatchEndIndex; i++) + { + //Friction patches. + if(c.correlationListHeads[i] != CorrelationBuffer::LIST_END) + numFrictionPatches++; + } + PxU32 frictionPatchByteSize = numFrictionPatches*sizeof(FrictionPatch); + + _numFrictionPatches = numFrictionPatches; + + //16-byte alignment. + _frictionPatchByteSize = ((frictionPatchByteSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_frictionPatchByteSize & 0x0f)); +} + +static bool reserveFrictionBlockStreams(const CorrelationBuffer& c, PxConstraintAllocator& constraintAllocator, PxU32 frictionPatchStartIndex, PxU32 frictionPatchEndIndex, + FrictionPatch*& _frictionPatches, + PxU32& numFrictionPatches) +{ + + //From frictionPatchStream we just need to reserve a single buffer. + PxU32 frictionPatchByteSize = 0; + //Compute the sizes of all the buffers. + + computeBlockStreamFrictionByteSizes(c, frictionPatchByteSize, numFrictionPatches, frictionPatchStartIndex, frictionPatchEndIndex); + + FrictionPatch* frictionPatches = NULL; + //If the constraint block reservation didn't fail then reserve the friction buffer too. + if(frictionPatchByteSize > 0) + { + frictionPatches = reinterpret_cast(constraintAllocator.reserveFrictionData(frictionPatchByteSize)); + + if(0==frictionPatches || (reinterpret_cast(-1))==frictionPatches) + { + if(0==frictionPatches) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of friction data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + frictionPatches=NULL; + } + } + } + + _frictionPatches = frictionPatches; + + //Return true if neither of the two block reservations failed. + return (0==frictionPatchByteSize || frictionPatches); +} + +//The persistent friction patch correlation/allocation will already have happenned as this is per-pair. +//This function just computes the size of the combined solve data. +void computeBlockStreamByteSizes4(PxSolverContactDesc* descs, + PxU32& _solverConstraintByteSize, PxU32* _axisConstraintCount, + const CorrelationBuffer& c) +{ + PX_ASSERT(0 == _solverConstraintByteSize); + + PxU32 maxPatches = 0; + PxU32 maxFrictionPatches = 0; + PxU32 maxContactCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxU32 maxFrictionCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxMemZero(maxContactCount, sizeof(maxContactCount)); + PxMemZero(maxFrictionCount, sizeof(maxFrictionCount)); + bool hasMaxImpulse = false; + + for(PxU32 a = 0; a < 4; ++a) + { + PxU32 axisConstraintCount = 0; + hasMaxImpulse = hasMaxImpulse || descs[a].hasMaxImpulse; + for(PxU32 i = 0; i < descs[a].numFrictionPatches; i++) + { + PxU32 ind = i + descs[a].startFrictionPatchIndex; + + const FrictionPatch& frictionPatch = c.frictionPatches[ind]; + + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0 + && frictionPatch.anchorCount != 0; + //Solver constraint data. + if(c.frictionPatchContactCounts[ind]!=0) + { + maxContactCount[i] = PxMax(c.frictionPatchContactCounts[ind], maxContactCount[i]); + axisConstraintCount += c.frictionPatchContactCounts[ind]; + + if(haveFriction) + { + const PxU32 fricCount = PxU32(c.frictionPatches[ind].anchorCount) * 2; + maxFrictionCount[i] = PxMax(fricCount, maxFrictionCount[i]); + axisConstraintCount += fricCount; + } + } + } + maxPatches = PxMax(descs[a].numFrictionPatches, maxPatches); + _axisConstraintCount[a] = axisConstraintCount; + } + + for(PxU32 a = 0; a < maxPatches; ++a) + { + if(maxFrictionCount[a] > 0) + maxFrictionPatches++; + } + + + PxU32 totalContacts = 0, totalFriction = 0; + for(PxU32 a = 0; a < maxPatches; ++a) + { + totalContacts += maxContactCount[a]; + totalFriction += maxFrictionCount[a]; + } + + //OK, we have a given number of friction patches, contact points and friction constraints so we can calculate how much memory we need + + //Body 2 is considered static if it is either *not dynamic* or *kinematic* + + bool hasDynamicBody = false; + for(PxU32 a = 0; a < 4; ++a) + { + hasDynamicBody = hasDynamicBody || ((descs[a].bodyState1 == PxSolverContactDesc::eDYNAMIC_BODY)); + } + + + const bool isStatic = !hasDynamicBody; + + const PxU32 headerSize = sizeof(SolverContactHeader4) * maxPatches + sizeof(SolverFrictionSharedData4) * maxFrictionPatches; + PxU32 constraintSize = isStatic ? (sizeof(SolverContactBatchPointBase4) * totalContacts) + ( sizeof(SolverContactFrictionBase4) * totalFriction) : + (sizeof(SolverContactBatchPointDynamic4) * totalContacts) + (sizeof(SolverContactFrictionDynamic4) * totalFriction); + + //Space for the appliedForce buffer + constraintSize += sizeof(Vec4V)*(totalContacts+totalFriction); + + //If we have max impulse, reserve a buffer for it + if(hasMaxImpulse) + constraintSize += sizeof(aos::Vec4V) * totalContacts; + + _solverConstraintByteSize = ((constraintSize + headerSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); +} + +static SolverConstraintPrepState::Enum reserveBlockStreams4(PxSolverContactDesc* descs, Dy::CorrelationBuffer& c, + PxU8*& solverConstraint, PxU32* axisConstraintCount, + PxU32& solverConstraintByteSize, + PxConstraintAllocator& constraintAllocator) +{ + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(0 == solverConstraintByteSize); + + //Compute the sizes of all the buffers. + computeBlockStreamByteSizes4(descs, + solverConstraintByteSize, axisConstraintCount, + c); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if(constraintBlockByteSize > 0) + { + if((constraintBlockByteSize + 16u) > 16384) + return SolverConstraintPrepState::eUNBATCHABLE; + + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if(0==constraintBlock || (reinterpret_cast(-1))==constraintBlock) + { + if(0==constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock=NULL; + } + } + } + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if(0==constraintBlockByteSize || constraintBlock) + { + if(solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0==(uintptr_t(solverConstraint) & 0x0f)); + } + } + + return ((0==constraintBlockByteSize || constraintBlock)) ? SolverConstraintPrepState::eSUCCESS : SolverConstraintPrepState::eOUT_OF_MEMORY; +} + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4( + Dy::CorrelationBuffer& c, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator) +{ + PX_ALIGN(16, PxReal invMassScale0[4]); + PX_ALIGN(16, PxReal invMassScale1[4]); + PX_ALIGN(16, PxReal invInertiaScale0[4]); + PX_ALIGN(16, PxReal invInertiaScale1[4]); + + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + for (PxU32 a = 0; a < 4; ++a) + { + PxSolverContactDesc& blockDesc = blockDescs[a]; + + invMassScale0[a] = blockDesc.invMassScales.linear0; + invMassScale1[a] = blockDesc.invMassScales.linear1; + invInertiaScale0[a] = blockDesc.invMassScales.angular0; + invInertiaScale1[a] = blockDesc.invMassScales.angular1; + + blockDesc.startFrictionPatchIndex = c.frictionPatchCount; + if (!(blockDesc.disableStrongFriction)) + { + bool valid = getFrictionPatches(c, blockDesc.frictionPtr, blockDesc.frictionCount, + blockDesc.bodyFrame0, blockDesc.bodyFrame1, correlationDistance); + if (!valid) + return SolverConstraintPrepState::eUNBATCHABLE; + } + //Create the contact patches + blockDesc.startContactPatchIndex = c.contactPatchCount; + if (!createContactPatches(c, blockDesc.contacts, blockDesc.numContacts, PXC_SAME_NORMAL)) + return SolverConstraintPrepState::eUNBATCHABLE; + blockDesc.numContactPatches = PxU16(c.contactPatchCount - blockDesc.startContactPatchIndex); + + bool overflow = correlatePatches(c, blockDesc.contacts, blockDesc.bodyFrame0, blockDesc.bodyFrame1, PXC_SAME_NORMAL, + blockDesc.startContactPatchIndex, blockDesc.startFrictionPatchIndex); + + if (overflow) + return SolverConstraintPrepState::eUNBATCHABLE; + + growPatches(c, blockDesc.contacts, blockDesc.bodyFrame0, blockDesc.bodyFrame1, blockDesc.startFrictionPatchIndex, + frictionOffsetThreshold + blockDescs[a].restDistance); + + //Remove the empty friction patches - do we actually need to do this? + for (PxU32 p = c.frictionPatchCount; p > blockDesc.startFrictionPatchIndex; --p) + { + if (c.correlationListHeads[p - 1] == 0xffff) + { + //We have an empty patch...need to bin this one... + for (PxU32 p2 = p; p2 < c.frictionPatchCount; ++p2) + { + c.correlationListHeads[p2 - 1] = c.correlationListHeads[p2]; + c.frictionPatchContactCounts[p2 - 1] = c.frictionPatchContactCounts[p2]; + } + c.frictionPatchCount--; + } + } + + PxU32 numFricPatches = c.frictionPatchCount - blockDesc.startFrictionPatchIndex; + blockDesc.numFrictionPatches = numFricPatches; + } + + FrictionPatch* frictionPatchArray[4]; + PxU32 frictionPatchCounts[4]; + + for (PxU32 a = 0; a < 4; ++a) + { + PxSolverContactDesc& blockDesc = blockDescs[a]; + + const bool successfulReserve = reserveFrictionBlockStreams(c, constraintAllocator, blockDesc.startFrictionPatchIndex, blockDesc.numFrictionPatches + blockDesc.startFrictionPatchIndex, + frictionPatchArray[a], + frictionPatchCounts[a]); + + //KS - TODO - how can we recover if we failed to allocate this memory? + if (!successfulReserve) + { + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + } + //At this point, all the friction data has been calculated, the correlation has been done. Provided this was all successful, + //we are ready to create the batched constraints + + PxU8* solverConstraint = NULL; + PxU32 solverConstraintByteSize = 0; + + + + { + PxU32 axisConstraintCount[4]; + SolverConstraintPrepState::Enum state = reserveBlockStreams4(blockDescs, c, + solverConstraint, axisConstraintCount, + solverConstraintByteSize, + constraintAllocator); + + if (state != SolverConstraintPrepState::eSUCCESS) + return state; + + + for (PxU32 a = 0; a < 4; ++a) + { + + FrictionPatch* frictionPatches = frictionPatchArray[a]; + + PxSolverContactDesc& blockDesc = blockDescs[a]; + PxSolverConstraintDesc& desc = *blockDesc.desc; + blockDesc.frictionPtr = reinterpret_cast(frictionPatches); + blockDesc.frictionCount = PxTo8(frictionPatchCounts[a]); + + //Initialise friction buffer. + if (frictionPatches) + { + // PT: TODO: revisit this... not very satisfying + //const PxU32 maxSize = numFrictionPatches*sizeof(FrictionPatch); + PxPrefetchLine(frictionPatches); + PxPrefetchLine(frictionPatches, 128); + PxPrefetchLine(frictionPatches, 256); + + for (PxU32 i = 0; i(solverConstraint + solverConstraintByteSize)) = 0; + } + return SolverConstraintPrepState::eSUCCESS; +} + + +//This returns 1 of 3 states: success, unbatchable or out-of-memory. If the constraint is unbatchable, we must fall back on 4 separate constraint +//prep calls +SolverConstraintPrepState::Enum createFinalizeSolverContacts4( + PxsContactManagerOutput** cmOutputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator) +{ + + for (PxU32 a = 0; a < 4; ++a) + { + blockDescs[a].desc->constraintLengthOver16 = 0; + } + + PX_ASSERT(cmOutputs[0]->nbContacts && cmOutputs[1]->nbContacts && cmOutputs[2]->nbContacts && cmOutputs[3]->nbContacts); + + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + //PxTransform idt = PxTransform(PxIdentity); + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + + for (PxU32 a = 0; a < 4; ++a) + { + PxSolverContactDesc& blockDesc = blockDescs[a]; + PxSolverConstraintDesc& desc = *blockDesc.desc; + + //blockDesc.startContactIndex = buffer.count; + blockDesc.contacts = buffer.contacts + buffer.count; + + PxPrefetchLine(desc.bodyA); + PxPrefetchLine(desc.bodyB); + + + if ((buffer.count + cmOutputs[a]->nbContacts) > 64) + { + return SolverConstraintPrepState::eUNBATCHABLE; + } + + bool hasMaxImpulse = false; + bool hasTargetVelocity = false; + + //OK...do the correlation here as well... + PxPrefetchLine(blockDescs[a].frictionPtr); + PxPrefetchLine(blockDescs[a].frictionPtr, 64); + PxPrefetchLine(blockDescs[a].frictionPtr, 128); + + if (a < 3) + { + PxPrefetchLine(cmOutputs[a]->contactPatches); + PxPrefetchLine(cmOutputs[a]->contactPoints); + } + + PxReal invMassScale0, invMassScale1, invInertiaScale0, invInertiaScale1; + + const PxReal defaultMaxImpulse = PxMin(blockDesc.data0->maxContactImpulse, blockDesc.data1->maxContactImpulse); + + PxU32 contactCount = extractContacts(buffer, *cmOutputs[a], hasMaxImpulse, hasTargetVelocity, invMassScale0, invMassScale1, + invInertiaScale0, invInertiaScale1, defaultMaxImpulse); + + if (contactCount == 0) + return SolverConstraintPrepState::eUNBATCHABLE; + + blockDesc.numContacts = contactCount; + blockDesc.hasMaxImpulse = hasMaxImpulse; + blockDesc.disableStrongFriction = blockDesc.disableStrongFriction || hasTargetVelocity; + + blockDesc.invMassScales.linear0 *= invMassScale0; + blockDesc.invMassScales.linear1 *= invMassScale1; + blockDesc.invMassScales.angular0 *= invInertiaScale0; + blockDesc.invMassScales.angular1 *= invInertiaScale1; + + //blockDesc.frictionPtr = &blockDescs[a].frictionPtr; + //blockDesc.frictionCount = blockDescs[a].frictionCount; + + } + return createFinalizeSolverContacts4(c, blockDescs, + invDtF32, dtF32, bounceThresholdF32, frictionOffsetThreshold, + correlationDistance, constraintAllocator); +} + + + + +} + +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp new file mode 100644 index 0000000..55bcbb0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrep4PF.cpp @@ -0,0 +1,1009 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "PxcNpWorkUnit.h" +#include "DyThreadContext.h" +#include "PxcNpContactPrepShared.h" +#include "DySolverContactPF4.h" + +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" + +using namespace physx::Gu; +using namespace physx::aos; + +namespace physx +{ +namespace Dy +{ + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb( + PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + PxFrictionType::Enum frictionType); + +static bool setupFinalizeSolverConstraintsCoulomb4(PxSolverContactDesc* PX_RESTRICT descs, PxU8* PX_RESTRICT workspace, + const PxReal invDtF32, PxReal bounceThresholdF32, CorrelationBuffer& c, const PxU32 numFrictionPerPoint, + const PxU32 numContactPoints4, const PxU32 /*solverConstraintByteSize*/, + const aos::Vec4VArg invMassScale0, const aos::Vec4VArg invInertiaScale0, + const aos::Vec4VArg invMassScale1, const aos::Vec4VArg invInertiaScale1) +{ + //KS - final step. Create the constraints in the place we pre-allocated... + + const Vec4V ccdMaxSeparation = aos::V4LoadXYZW(descs[0].maxCCDSeparation, descs[1].maxCCDSeparation, descs[2].maxCCDSeparation, descs[3].maxCCDSeparation); + const Vec4V solverOffsetSlop = aos::V4LoadXYZW(descs[0].offsetSlop, descs[1].offsetSlop, descs[2].offsetSlop, descs[3].offsetSlop); + + const Vec4V zero = V4Zero(); + + PxU8 flags[4] = { PxU8(descs[0].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[1].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[2].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[3].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0) }; + + + //The block is dynamic if **any** of the constraints have a non-static body B. This allows us to batch static and non-static constraints but we only get a memory/perf + //saving if all 4 are static. This simplifies the constraint partitioning such that it only needs to care about separating contacts and 1D constraints (which it already does) + const bool isDynamic = ((descs[0].bodyState1 | descs[1].bodyState1 | descs[2].bodyState1 | descs[3].bodyState1) & PxSolverContactDesc::eDYNAMIC_BODY) != 0; + + const PxU32 constraintSize = isDynamic ? sizeof(SolverContact4Dynamic) : sizeof(SolverContact4Base); + const PxU32 frictionSize = isDynamic ? sizeof(SolverFriction4Dynamic) : sizeof(SolverFriction4Base); + + PxU8* PX_RESTRICT ptr = workspace; + + const Vec4V dom0 = invMassScale0; + const Vec4V dom1 = invMassScale1; + const Vec4V angDom0 = invInertiaScale0; + const Vec4V angDom1 = invInertiaScale1; + + const Vec4V maxPenBias = V4Max(V4Merge(FLoad(descs[0].data0->penBiasClamp), FLoad(descs[1].data0->penBiasClamp), + FLoad(descs[2].data0->penBiasClamp), FLoad(descs[3].data0->penBiasClamp)), + V4Merge(FLoad(descs[0].data1->penBiasClamp), FLoad(descs[1].data1->penBiasClamp), + FLoad(descs[2].data1->penBiasClamp), FLoad(descs[3].data1->penBiasClamp))); + + const Vec4V restDistance = V4Merge(FLoad(descs[0].restDistance), FLoad(descs[1].restDistance), FLoad(descs[2].restDistance), + FLoad(descs[3].restDistance)); + + //load up velocities + Vec4V linVel00 = V4LoadA(&descs[0].data0->linearVelocity.x); + Vec4V linVel10 = V4LoadA(&descs[1].data0->linearVelocity.x); + Vec4V linVel20 = V4LoadA(&descs[2].data0->linearVelocity.x); + Vec4V linVel30 = V4LoadA(&descs[3].data0->linearVelocity.x); + + Vec4V linVel01 = V4LoadA(&descs[0].data1->linearVelocity.x); + Vec4V linVel11 = V4LoadA(&descs[1].data1->linearVelocity.x); + Vec4V linVel21 = V4LoadA(&descs[2].data1->linearVelocity.x); + Vec4V linVel31 = V4LoadA(&descs[3].data1->linearVelocity.x); + + Vec4V angVel00 = V4LoadA(&descs[0].data0->angularVelocity.x); + Vec4V angVel10 = V4LoadA(&descs[1].data0->angularVelocity.x); + Vec4V angVel20 = V4LoadA(&descs[2].data0->angularVelocity.x); + Vec4V angVel30 = V4LoadA(&descs[3].data0->angularVelocity.x); + + Vec4V angVel01 = V4LoadA(&descs[0].data1->angularVelocity.x); + Vec4V angVel11 = V4LoadA(&descs[1].data1->angularVelocity.x); + Vec4V angVel21 = V4LoadA(&descs[2].data1->angularVelocity.x); + Vec4V angVel31 = V4LoadA(&descs[3].data1->angularVelocity.x); + + Vec4V linVelT00, linVelT10, linVelT20; + Vec4V linVelT01, linVelT11, linVelT21; + Vec4V angVelT00, angVelT10, angVelT20; + Vec4V angVelT01, angVelT11, angVelT21; + + PX_TRANSPOSE_44_34(linVel00, linVel10, linVel20, linVel30, linVelT00, linVelT10, linVelT20); + PX_TRANSPOSE_44_34(linVel01, linVel11, linVel21, linVel31, linVelT01, linVelT11, linVelT21); + PX_TRANSPOSE_44_34(angVel00, angVel10, angVel20, angVel30, angVelT00, angVelT10, angVelT20); + PX_TRANSPOSE_44_34(angVel01, angVel11, angVel21, angVel31, angVelT01, angVelT11, angVelT21); + + const Vec4V vrelX = V4Sub(linVelT00, linVelT01); + const Vec4V vrelY = V4Sub(linVelT10, linVelT11); + const Vec4V vrelZ = V4Sub(linVelT20, linVelT21); + + + + //Load up masses and invInertia + + const Vec4V invMass0 = V4Merge(FLoad(descs[0].data0->invMass), FLoad(descs[1].data0->invMass), FLoad(descs[2].data0->invMass), + FLoad(descs[3].data0->invMass)); + + const Vec4V invMass1 = V4Merge(FLoad(descs[0].data1->invMass), FLoad(descs[1].data1->invMass), FLoad(descs[2].data1->invMass), + FLoad(descs[3].data1->invMass)); + + const Vec4V invMass0_dom0fV = V4Mul(dom0, invMass0); + const Vec4V invMass1_dom1fV = V4Mul(dom1, invMass1); + + Vec4V invInertia00X = Vec4V_From_Vec3V(V3LoadU(descs[0].data0->sqrtInvInertia.column0)); + Vec4V invInertia00Y = Vec4V_From_Vec3V(V3LoadU(descs[0].data0->sqrtInvInertia.column1)); + Vec4V invInertia00Z = Vec4V_From_Vec3V(V3LoadU(descs[0].data0->sqrtInvInertia.column2)); + + Vec4V invInertia10X = Vec4V_From_Vec3V(V3LoadU(descs[1].data0->sqrtInvInertia.column0)); + Vec4V invInertia10Y = Vec4V_From_Vec3V(V3LoadU(descs[1].data0->sqrtInvInertia.column1)); + Vec4V invInertia10Z = Vec4V_From_Vec3V(V3LoadU(descs[1].data0->sqrtInvInertia.column2)); + + Vec4V invInertia20X = Vec4V_From_Vec3V(V3LoadU(descs[2].data0->sqrtInvInertia.column0)); + Vec4V invInertia20Y = Vec4V_From_Vec3V(V3LoadU(descs[2].data0->sqrtInvInertia.column1)); + Vec4V invInertia20Z = Vec4V_From_Vec3V(V3LoadU(descs[2].data0->sqrtInvInertia.column2)); + + Vec4V invInertia30X = Vec4V_From_Vec3V(V3LoadU(descs[3].data0->sqrtInvInertia.column0)); + Vec4V invInertia30Y = Vec4V_From_Vec3V(V3LoadU(descs[3].data0->sqrtInvInertia.column1)); + Vec4V invInertia30Z = Vec4V_From_Vec3V(V3LoadU(descs[3].data0->sqrtInvInertia.column2)); + + Vec4V invInertia01X = Vec4V_From_Vec3V(V3LoadU(descs[0].data1->sqrtInvInertia.column0)); + Vec4V invInertia01Y = Vec4V_From_Vec3V(V3LoadU(descs[0].data1->sqrtInvInertia.column1)); + Vec4V invInertia01Z = Vec4V_From_Vec3V(V3LoadU(descs[0].data1->sqrtInvInertia.column2)); + + Vec4V invInertia11X = Vec4V_From_Vec3V(V3LoadU(descs[1].data1->sqrtInvInertia.column0)); + Vec4V invInertia11Y = Vec4V_From_Vec3V(V3LoadU(descs[1].data1->sqrtInvInertia.column1)); + Vec4V invInertia11Z = Vec4V_From_Vec3V(V3LoadU(descs[1].data1->sqrtInvInertia.column2)); + + Vec4V invInertia21X = Vec4V_From_Vec3V(V3LoadU(descs[2].data1->sqrtInvInertia.column0)); + Vec4V invInertia21Y = Vec4V_From_Vec3V(V3LoadU(descs[2].data1->sqrtInvInertia.column1)); + Vec4V invInertia21Z = Vec4V_From_Vec3V(V3LoadU(descs[2].data1->sqrtInvInertia.column2)); + + Vec4V invInertia31X = Vec4V_From_Vec3V(V3LoadU(descs[3].data1->sqrtInvInertia.column0)); + Vec4V invInertia31Y = Vec4V_From_Vec3V(V3LoadU(descs[3].data1->sqrtInvInertia.column1)); + Vec4V invInertia31Z = Vec4V_From_Vec3V(V3LoadU(descs[3].data1->sqrtInvInertia.column2)); + + Vec4V invInertia0X0, invInertia0X1, invInertia0X2; + Vec4V invInertia0Y0, invInertia0Y1, invInertia0Y2; + Vec4V invInertia0Z0, invInertia0Z1, invInertia0Z2; + + Vec4V invInertia1X0, invInertia1X1, invInertia1X2; + Vec4V invInertia1Y0, invInertia1Y1, invInertia1Y2; + Vec4V invInertia1Z0, invInertia1Z1, invInertia1Z2; + + PX_TRANSPOSE_44_34(invInertia00X, invInertia10X, invInertia20X, invInertia30X, invInertia0X0, invInertia0Y0, invInertia0Z0); + PX_TRANSPOSE_44_34(invInertia00Y, invInertia10Y, invInertia20Y, invInertia30Y, invInertia0X1, invInertia0Y1, invInertia0Z1); + PX_TRANSPOSE_44_34(invInertia00Z, invInertia10Z, invInertia20Z, invInertia30Z, invInertia0X2, invInertia0Y2, invInertia0Z2); + + PX_TRANSPOSE_44_34(invInertia01X, invInertia11X, invInertia21X, invInertia31X, invInertia1X0, invInertia1Y0, invInertia1Z0); + PX_TRANSPOSE_44_34(invInertia01Y, invInertia11Y, invInertia21Y, invInertia31Y, invInertia1X1, invInertia1Y1, invInertia1Z1); + PX_TRANSPOSE_44_34(invInertia01Z, invInertia11Z, invInertia21Z, invInertia31Z, invInertia1X2, invInertia1Y2, invInertia1Z2); + + const FloatV invDt = FLoad(invDtF32); + const FloatV p8 = FLoad(0.8f); + //const Vec4V p84 = V4Splat(p8); + const Vec4V p1 = V4Splat(FLoad(0.1f)); + const Vec4V bounceThreshold = V4Splat(FLoad(bounceThresholdF32)); + const Vec4V orthoThreshold = V4Splat(FLoad(0.70710678f)); + + const FloatV invDtp8 = FMul(invDt, p8); + + const Vec3V bodyFrame00p = V3LoadU(descs[0].bodyFrame0.p); + const Vec3V bodyFrame01p = V3LoadU(descs[1].bodyFrame0.p); + const Vec3V bodyFrame02p = V3LoadU(descs[2].bodyFrame0.p); + const Vec3V bodyFrame03p = V3LoadU(descs[3].bodyFrame0.p); + + Vec4V bodyFrame00p4 = Vec4V_From_Vec3V(bodyFrame00p); + Vec4V bodyFrame01p4 = Vec4V_From_Vec3V(bodyFrame01p); + Vec4V bodyFrame02p4 = Vec4V_From_Vec3V(bodyFrame02p); + Vec4V bodyFrame03p4 = Vec4V_From_Vec3V(bodyFrame03p); + + Vec4V bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ; + PX_TRANSPOSE_44_34(bodyFrame00p4, bodyFrame01p4, bodyFrame02p4, bodyFrame03p4, bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ); + + + const Vec3V bodyFrame10p = V3LoadU(descs[0].bodyFrame1.p); + const Vec3V bodyFrame11p = V3LoadU(descs[1].bodyFrame1.p); + const Vec3V bodyFrame12p = V3LoadU(descs[2].bodyFrame1.p); + const Vec3V bodyFrame13p = V3LoadU(descs[3].bodyFrame1.p); + + Vec4V bodyFrame10p4 = Vec4V_From_Vec3V(bodyFrame10p); + Vec4V bodyFrame11p4 = Vec4V_From_Vec3V(bodyFrame11p); + Vec4V bodyFrame12p4 = Vec4V_From_Vec3V(bodyFrame12p); + Vec4V bodyFrame13p4 = Vec4V_From_Vec3V(bodyFrame13p); + + Vec4V bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ; + PX_TRANSPOSE_44_34(bodyFrame10p4, bodyFrame11p4, bodyFrame12p4, bodyFrame13p4, bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ); + + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + PxU32 frictionIndex0 = 0, frictionIndex1 = 0, frictionIndex2 = 0, frictionIndex3 = 0; + + + PxU32 maxPatches = PxMax(descs[0].numFrictionPatches, PxMax(descs[1].numFrictionPatches, PxMax(descs[2].numFrictionPatches, descs[3].numFrictionPatches))); + PxU32 maxContacts = numContactPoints4; + + //This is the address at which the first friction patch exists + PxU8* ptr2 = ptr + ((sizeof(SolverContactCoulombHeader4) * maxPatches) + constraintSize * maxContacts); + + //PxU32 contactId = 0; + + for(PxU32 i=0;i= descs[0].numFrictionPatches; + const bool hasFinished1 = i >= descs[1].numFrictionPatches; + const bool hasFinished2 = i >= descs[2].numFrictionPatches; + const bool hasFinished3 = i >= descs[3].numFrictionPatches; + + + frictionIndex0 = hasFinished0 ? frictionIndex0 : descs[0].startFrictionPatchIndex + i; + frictionIndex1 = hasFinished1 ? frictionIndex1 : descs[1].startFrictionPatchIndex + i; + frictionIndex2 = hasFinished2 ? frictionIndex2 : descs[2].startFrictionPatchIndex + i; + frictionIndex3 = hasFinished3 ? frictionIndex3 : descs[3].startFrictionPatchIndex + i; + + PxU32 clampedContacts0 = hasFinished0 ? 0 : c.frictionPatchContactCounts[frictionIndex0]; + PxU32 clampedContacts1 = hasFinished1 ? 0 : c.frictionPatchContactCounts[frictionIndex1]; + PxU32 clampedContacts2 = hasFinished2 ? 0 : c.frictionPatchContactCounts[frictionIndex2]; + PxU32 clampedContacts3 = hasFinished3 ? 0 : c.frictionPatchContactCounts[frictionIndex3]; + + PxU32 clampedFric0 = clampedContacts0 * numFrictionPerPoint; + PxU32 clampedFric1 = clampedContacts1 * numFrictionPerPoint; + PxU32 clampedFric2 = clampedContacts2 * numFrictionPerPoint; + PxU32 clampedFric3 = clampedContacts3 * numFrictionPerPoint; + + + const PxU32 numContacts = PxMax(clampedContacts0, PxMax(clampedContacts1, PxMax(clampedContacts2, clampedContacts3))); + const PxU32 numFrictions = PxMax(clampedFric0, PxMax(clampedFric1, PxMax(clampedFric2, clampedFric3))); + + PxU32 firstPatch0 = c.correlationListHeads[frictionIndex0]; + PxU32 firstPatch1 = c.correlationListHeads[frictionIndex1]; + PxU32 firstPatch2 = c.correlationListHeads[frictionIndex2]; + PxU32 firstPatch3 = c.correlationListHeads[frictionIndex3]; + + const PxContactPoint* contactBase0 = descs[0].contacts + c.contactPatches[firstPatch0].start; + const PxContactPoint* contactBase1 = descs[1].contacts + c.contactPatches[firstPatch1].start; + const PxContactPoint* contactBase2 = descs[2].contacts + c.contactPatches[firstPatch2].start; + const PxContactPoint* contactBase3 = descs[3].contacts + c.contactPatches[firstPatch3].start; + + const Vec4V restitution = V4Merge(FLoad(contactBase0->restitution), FLoad(contactBase1->restitution), FLoad(contactBase2->restitution), + FLoad(contactBase3->restitution)); + + const Vec4V staticFriction = V4Merge(FLoad(contactBase0->staticFriction), FLoad(contactBase1->staticFriction), FLoad(contactBase2->staticFriction), + FLoad(contactBase3->staticFriction)); + + SolverContactCoulombHeader4* PX_RESTRICT header = reinterpret_cast(ptr); + + header->frictionOffset = PxU16(ptr2 - ptr); + + ptr += sizeof(SolverContactCoulombHeader4); + + SolverFrictionHeader4* PX_RESTRICT fricHeader = reinterpret_cast(ptr2); + ptr2 += sizeof(SolverFrictionHeader4) + sizeof(Vec4V) * numContacts; + + + header->numNormalConstr0 = PxTo8(clampedContacts0); + header->numNormalConstr1 = PxTo8(clampedContacts1); + header->numNormalConstr2 = PxTo8(clampedContacts2); + header->numNormalConstr3 = PxTo8(clampedContacts3); + header->numNormalConstr = PxTo8(numContacts); + header->invMassADom = invMass0_dom0fV; + header->invMassBDom = invMass1_dom1fV; + header->angD0 = angDom0; + header->angD1 = angDom1; + header->restitution = restitution; + + header->flags[0] = flags[0]; header->flags[1] = flags[1]; header->flags[2] = flags[2]; header->flags[3] = flags[3]; + + header->type = PxTo8(isDynamic ? DY_SC_TYPE_BLOCK_RB_CONTACT : DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT); + header->shapeInteraction[0] = getInteraction(descs[0]); header->shapeInteraction[1] = getInteraction(descs[1]); + header->shapeInteraction[2] = getInteraction(descs[2]); header->shapeInteraction[3] = getInteraction(descs[3]); + + fricHeader->invMassADom = invMass0_dom0fV; + fricHeader->invMassBDom = invMass1_dom1fV; + fricHeader->angD0 = angDom0; + fricHeader->angD1 = angDom1; + fricHeader->numFrictionConstr0 = PxTo8(clampedFric0); + fricHeader->numFrictionConstr1 = PxTo8(clampedFric1); + fricHeader->numFrictionConstr2 = PxTo8(clampedFric2); + fricHeader->numFrictionConstr3 = PxTo8(clampedFric3); + fricHeader->numNormalConstr = PxTo8(numContacts); + fricHeader->numNormalConstr0 = PxTo8(clampedContacts0); + fricHeader->numNormalConstr1 = PxTo8(clampedContacts1); + fricHeader->numNormalConstr2 = PxTo8(clampedContacts2); + fricHeader->numNormalConstr3 = PxTo8(clampedContacts3); + fricHeader->type = PxTo8(isDynamic ? DY_SC_TYPE_BLOCK_FRICTION : DY_SC_TYPE_BLOCK_STATIC_FRICTION); + fricHeader->staticFriction = staticFriction; + fricHeader->frictionPerContact = PxU32(numFrictionPerPoint == 2 ? 1 : 0); + + fricHeader->numFrictionConstr = PxTo8(numFrictions); + + Vec4V normal0 = V4LoadA(&contactBase0->normal.x); + Vec4V normal1 = V4LoadA(&contactBase1->normal.x); + Vec4V normal2 = V4LoadA(&contactBase2->normal.x); + Vec4V normal3 = V4LoadA(&contactBase3->normal.x); + + Vec4V normalX, normalY, normalZ; + PX_TRANSPOSE_44_34(normal0, normal1, normal2, normal3, normalX, normalY, normalZ); + header->normalX = normalX; + header->normalY = normalY; + header->normalZ = normalZ; + + const Vec4V normalLenSq = V4MulAdd(normalZ, normalZ, V4MulAdd(normalY, normalY, V4Mul(normalX, normalX))); + + const Vec4V linNorVel0 = V4MulAdd(normalZ, linVelT20, V4MulAdd(normalY, linVelT10, V4Mul(normalX, linVelT00))); + const Vec4V linNorVel1 = V4MulAdd(normalZ, linVelT21, V4MulAdd(normalY, linVelT11, V4Mul(normalX, linVelT01))); + + const Vec4V invMassNorLenSq0 = V4Mul(invMass0_dom0fV, normalLenSq); + const Vec4V invMassNorLenSq1 = V4Mul(invMass1_dom1fV, normalLenSq); + + + //Calculate friction directions + const BoolV cond =V4IsGrtr(orthoThreshold, V4Abs(normalX)); + + const Vec4V t0FallbackX = V4Sel(cond, zero, V4Neg(normalY)); + const Vec4V t0FallbackY = V4Sel(cond, V4Neg(normalZ), normalX); + const Vec4V t0FallbackZ = V4Sel(cond, normalY, zero); + + const Vec4V dotNormalVrel = V4MulAdd(normalZ, vrelZ, V4MulAdd(normalY, vrelY, V4Mul(normalX, vrelX))); + const Vec4V vrelSubNorVelX = V4NegMulSub(normalX, dotNormalVrel, vrelX); + const Vec4V vrelSubNorVelY = V4NegMulSub(normalY, dotNormalVrel, vrelY); + const Vec4V vrelSubNorVelZ = V4NegMulSub(normalZ, dotNormalVrel, vrelZ); + + const Vec4V lenSqvrelSubNorVelZ = V4MulAdd(vrelSubNorVelX, vrelSubNorVelX, V4MulAdd(vrelSubNorVelY, vrelSubNorVelY, V4Mul(vrelSubNorVelZ, vrelSubNorVelZ))); + + const BoolV bcon2 = V4IsGrtr(lenSqvrelSubNorVelZ, p1); + + Vec4V t0X = V4Sel(bcon2, vrelSubNorVelX, t0FallbackX); + Vec4V t0Y = V4Sel(bcon2, vrelSubNorVelY, t0FallbackY); + Vec4V t0Z = V4Sel(bcon2, vrelSubNorVelZ, t0FallbackZ); + + //Now normalize this... + const Vec4V recipLen = V4Rsqrt(V4MulAdd(t0X, t0X, V4MulAdd(t0Y, t0Y, V4Mul(t0Z, t0Z)))); + + t0X = V4Mul(t0X, recipLen); + t0Y = V4Mul(t0Y, recipLen); + t0Z = V4Mul(t0Z, recipLen); + + const Vec4V t1X = V4NegMulSub(normalZ, t0Y, V4Mul(normalY, t0Z)); + const Vec4V t1Y = V4NegMulSub(normalX, t0Z, V4Mul(normalZ, t0X)); + const Vec4V t1Z = V4NegMulSub(normalY, t0X, V4Mul(normalX, t0Y)); + + const Vec4V tFallbackX[2] = {t0X, t1X}; + const Vec4V tFallbackY[2] = {t0Y, t1Y}; + const Vec4V tFallbackZ[2] = {t0Z, t1Z}; + + + //For all correlation heads - need to pull this out I think + + //OK, we have a counter for all our patches... + PxU32 finished = (PxU32(hasFinished0)) | + ((PxU32(hasFinished1)) << 1) | + ((PxU32(hasFinished2)) << 2) | + ((PxU32(hasFinished3)) << 3); + + CorrelationListIterator iter0(c, firstPatch0); + CorrelationListIterator iter1(c, firstPatch1); + CorrelationListIterator iter2(c, firstPatch2); + CorrelationListIterator iter3(c, firstPatch3); + + PxU32 contact0, contact1, contact2, contact3; + PxU32 patch0, patch1, patch2, patch3; + + iter0.nextContact(patch0, contact0); + iter1.nextContact(patch1, contact1); + iter2.nextContact(patch2, contact2); + iter3.nextContact(patch3, contact3); + + PxU8* p = ptr; + + PxU32 contactCount = 0; + PxU32 newFinished = + (PxU32(hasFinished0 || !iter0.hasNextContact())) | + ((PxU32(hasFinished1 || !iter1.hasNextContact())) << 1) | + ((PxU32(hasFinished2 || !iter2.hasNextContact())) << 2) | + ((PxU32(hasFinished3 || !iter3.hasNextContact())) << 3); + + PxU32 fricIndex = 0; + + while(finished != 0xf) + { + finished = newFinished; + ++contactCount; + PxPrefetchLine(p, 384); + PxPrefetchLine(p, 512); + PxPrefetchLine(p, 640); + + SolverContact4Base* PX_RESTRICT solverContact = reinterpret_cast(p); + p += constraintSize; + + const PxContactPoint& con0 = descs[0].contacts[c.contactPatches[patch0].start + contact0]; + const PxContactPoint& con1 = descs[1].contacts[c.contactPatches[patch1].start + contact1]; + const PxContactPoint& con2 = descs[2].contacts[c.contactPatches[patch2].start + contact2]; + const PxContactPoint& con3 = descs[3].contacts[c.contactPatches[patch3].start + contact3]; + + //Now we need to splice these 4 contacts into a single structure + + { + Vec4V point0 = V4LoadA(&con0.point.x); + Vec4V point1 = V4LoadA(&con1.point.x); + Vec4V point2 = V4LoadA(&con2.point.x); + Vec4V point3 = V4LoadA(&con3.point.x); + + Vec4V pointX, pointY, pointZ; + PX_TRANSPOSE_44_34(point0, point1, point2, point3, pointX, pointY, pointZ); + + Vec4V targetVel0 = V4LoadA(&con0.targetVel.x); + Vec4V targetVel1 = V4LoadA(&con1.targetVel.x); + Vec4V targetVel2 = V4LoadA(&con2.targetVel.x); + Vec4V targetVel3 = V4LoadA(&con3.targetVel.x); + + Vec4V targetVelX, targetVelY, targetVelZ; + PX_TRANSPOSE_44_34(targetVel0, targetVel1, targetVel2, targetVel3, targetVelX, targetVelY, targetVelZ); + + Vec4V raX = V4Sub(pointX, bodyFrame0pX); + Vec4V raY = V4Sub(pointY, bodyFrame0pY); + Vec4V raZ = V4Sub(pointZ, bodyFrame0pZ); + + Vec4V rbX = V4Sub(pointX, bodyFrame1pX); + Vec4V rbY = V4Sub(pointY, bodyFrame1pY); + Vec4V rbZ = V4Sub(pointZ, bodyFrame1pZ); + + raX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raX)), zero, raX); + raY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raY)), zero, raY); + raZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raZ)), zero, raZ); + + rbX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbX)), zero, rbX); + rbY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbY)), zero, rbY); + rbZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbZ)), zero, rbZ); + + { + const Vec4V separation = V4Merge(FLoad(con0.separation), FLoad(con1.separation), FLoad(con2.separation), + FLoad(con3.separation)); + const Vec4V maxImpulse = V4Merge(FLoad(con0.maxImpulse), FLoad(con1.maxImpulse), FLoad(con2.maxImpulse), + FLoad(con3.maxImpulse)); + + const Vec4V cTargetVel = V4MulAdd(normalX, targetVelX, V4MulAdd(normalY, targetVelY, V4Mul(normalZ, targetVelZ))); + + //raXn = cross(ra, normal) which = Vec3V( a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); + const Vec4V raXnX = V4NegMulSub(raZ, normalY, V4Mul(raY, normalZ)); + const Vec4V raXnY = V4NegMulSub(raX, normalZ, V4Mul(raZ, normalX)); + const Vec4V raXnZ = V4NegMulSub(raY, normalX, V4Mul(raX, normalY)); + + const Vec4V v0a0 = V4Mul(invInertia0X0, raXnX); + const Vec4V v0a1 = V4Mul(invInertia0X1, raXnX); + const Vec4V v0a2 = V4Mul(invInertia0X2, raXnX); + + const Vec4V v0PlusV1a0 = V4MulAdd(invInertia0Y0, raXnY, v0a0); + const Vec4V v0PlusV1a1 = V4MulAdd(invInertia0Y1, raXnY, v0a1); + const Vec4V v0PlusV1a2 = V4MulAdd(invInertia0Y2, raXnY, v0a2); + + const Vec4V delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, v0PlusV1a0); + const Vec4V delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, v0PlusV1a1); + const Vec4V delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, v0PlusV1a2); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + const Vec4V dotRaXnAngVel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4Mul(raXnX, angVelT00))); + + Vec4V unitResponse = V4Add(invMassNorLenSq0, dotDelAngVel0); + Vec4V vrel = V4Add(linNorVel0, dotRaXnAngVel0); + + + //The dynamic-only parts - need to if-statement these up. A branch here shouldn't cost us too much + if(isDynamic) + { + SolverContact4Dynamic* PX_RESTRICT dynamicContact = static_cast(solverContact); + const Vec4V rbXnX = V4NegMulSub(rbZ, normalY, V4Mul(rbY, normalZ)); + const Vec4V rbXnY = V4NegMulSub(rbX, normalZ, V4Mul(rbZ, normalX)); + const Vec4V rbXnZ = V4NegMulSub(rbY, normalX, V4Mul(rbX, normalY)); + + const Vec4V v0b0 = V4Mul(invInertia1X0, rbXnX); + const Vec4V v0b1 = V4Mul(invInertia1X1, rbXnX); + const Vec4V v0b2 = V4Mul(invInertia1X2, rbXnX); + + const Vec4V v0PlusV1b0 = V4MulAdd(invInertia1Y0, rbXnY, v0b0); + const Vec4V v0PlusV1b1 = V4MulAdd(invInertia1Y1, rbXnY, v0b1); + const Vec4V v0PlusV1b2 = V4MulAdd(invInertia1Y2, rbXnY, v0b2); + + const Vec4V delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, v0PlusV1b0); + const Vec4V delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, v0PlusV1b1); + const Vec4V delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, v0PlusV1b2); + + + //V3Dot(raXn, delAngVel0) + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4Mul(rbXnX, angVelT01))); + + const Vec4V resp1 = V4Add(dotDelAngVel1, invMassNorLenSq1); + + unitResponse = V4Add(unitResponse, resp1); + + const Vec4V vrel2 = V4Add(linNorVel1, dotRbXnAngVel1); + vrel = V4Sub(vrel, vrel2); + + //These are for dynamic-only contacts. + dynamicContact->rbXnX = delAngVel1X; + dynamicContact->rbXnY = delAngVel1Y; + dynamicContact->rbXnZ = delAngVel1Z; + + } + + const Vec4V velMultiplier = V4Sel(V4IsGrtr(unitResponse, zero), V4Recip(unitResponse), zero); + + const Vec4V penetration = V4Sub(separation, restDistance); + + const Vec4V penInvDtp8 = V4Max(maxPenBias, V4Scale(penetration, invDtp8)); + + Vec4V scaledBias = V4Mul(velMultiplier, penInvDtp8); + + const Vec4V penetrationInvDt = V4Scale(penetration, invDt); + + const BoolV isGreater2 = BAnd(BAnd(V4IsGrtr(restitution, zero), V4IsGrtr(bounceThreshold, vrel)), + V4IsGrtr(V4Neg(vrel), penetrationInvDt)); + + const BoolV ccdSeparationCondition = V4IsGrtrOrEq(ccdMaxSeparation, penetration); + + scaledBias = V4Sel(BAnd(ccdSeparationCondition, isGreater2), zero, scaledBias); + + const Vec4V sumVRel(vrel); + + const Vec4V targetVelocity = V4Sub(V4Add(V4Sel(isGreater2, V4Mul(V4Neg(sumVRel), restitution), zero), cTargetVel), vrel); + + //These values are present for static and dynamic contacts + solverContact->raXnX = delAngVel0X; + solverContact->raXnY = delAngVel0Y; + solverContact->raXnZ = delAngVel0Z; + solverContact->velMultiplier = velMultiplier; + solverContact->appliedForce = zero; + solverContact->scaledBias = scaledBias; + solverContact->targetVelocity = targetVelocity; + solverContact->maxImpulse = maxImpulse; + } + + //PxU32 conId = contactId++; + + /*Vec4V targetVel0 = V4LoadA(&con0.targetVel.x); + Vec4V targetVel1 = V4LoadA(&con1.targetVel.x); + Vec4V targetVel2 = V4LoadA(&con2.targetVel.x); + Vec4V targetVel3 = V4LoadA(&con3.targetVel.x); + + Vec4V targetVelX, targetVelY, targetVelZ; + PX_TRANSPOSE_44_34(targetVel0, targetVel1, targetVel2, targetVel3, targetVelX, targetVelY, targetVelZ);*/ + + for(PxU32 a = 0; a < numFrictionPerPoint; ++a) + { + SolverFriction4Base* PX_RESTRICT friction = reinterpret_cast(ptr2); + + ptr2 += frictionSize; + + const Vec4V tX = tFallbackX[fricIndex]; + const Vec4V tY = tFallbackY[fricIndex]; + const Vec4V tZ = tFallbackZ[fricIndex]; + + fricIndex = 1 - fricIndex; + + const Vec4V raXnX = V4NegMulSub(raZ, tY, V4Mul(raY, tZ)); + const Vec4V raXnY = V4NegMulSub(raX, tZ, V4Mul(raZ, tX)); + const Vec4V raXnZ = V4NegMulSub(raY, tX, V4Mul(raX, tY)); + + const Vec4V v0a0 = V4Mul(invInertia0X0, raXnX); + const Vec4V v0a1 = V4Mul(invInertia0X1, raXnX); + const Vec4V v0a2 = V4Mul(invInertia0X2, raXnX); + + const Vec4V v0PlusV1a0 = V4MulAdd(invInertia0Y0, raXnY, v0a0); + const Vec4V v0PlusV1a1 = V4MulAdd(invInertia0Y1, raXnY, v0a1); + const Vec4V v0PlusV1a2 = V4MulAdd(invInertia0Y2, raXnY, v0a2); + + const Vec4V delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, v0PlusV1a0); + const Vec4V delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, v0PlusV1a1); + const Vec4V delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, v0PlusV1a2); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + + const Vec4V norVel0 = V4MulAdd(tX, linVelT00, V4MulAdd(tY, linVelT10, V4Mul(tZ, linVelT20))); + const Vec4V dotRaXnAngVel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4Mul(raXnX, angVelT00))); + Vec4V vrel = V4Add(norVel0, dotRaXnAngVel0); + + Vec4V unitResponse = V4Add(invMass0_dom0fV, dotDelAngVel0); + + if(isDynamic) + { + SolverFriction4Dynamic* PX_RESTRICT dFric = static_cast(friction); + + const Vec4V rbXnX = V4NegMulSub(rbZ, tY, V4Mul(rbY, tZ)); + const Vec4V rbXnY = V4NegMulSub(rbX, tZ, V4Mul(rbZ, tX)); + const Vec4V rbXnZ = V4NegMulSub(rbY, tX, V4Mul(rbX, tY)); + + const Vec4V v0b0 = V4Mul(invInertia1X0, rbXnX); + const Vec4V v0b1 = V4Mul(invInertia1X1, rbXnX); + const Vec4V v0b2 = V4Mul(invInertia1X2, rbXnX); + + const Vec4V v0PlusV1b0 = V4MulAdd(invInertia1Y0, rbXnY, v0b0); + const Vec4V v0PlusV1b1 = V4MulAdd(invInertia1Y1, rbXnY, v0b1); + const Vec4V v0PlusV1b2 = V4MulAdd(invInertia1Y2, rbXnY, v0b2); + + const Vec4V delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, v0PlusV1b0); + const Vec4V delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, v0PlusV1b1); + const Vec4V delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, v0PlusV1b2); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V norVel1 = V4MulAdd(tX, linVelT01, V4MulAdd(tY, linVelT11, V4Mul(tZ, linVelT21))); + const Vec4V dotRbXnAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4Mul(rbXnX, angVelT01))); + vrel = V4Sub(vrel, V4Add(norVel1, dotRbXnAngVel1)); + + const Vec4V resp1 = V4Add(dotDelAngVel1, invMassNorLenSq1); + + unitResponse = V4Add(unitResponse, resp1); + + dFric->rbXnX = delAngVel1X; + dFric->rbXnY = delAngVel1Y; + dFric->rbXnZ = delAngVel1Z; + } + + const Vec4V velMultiplier = V4Neg(V4Sel(V4IsGrtr(unitResponse, zero), V4Recip(unitResponse), zero)); + + friction->appliedForce = zero; + friction->raXnX = delAngVel0X; + friction->raXnY = delAngVel0Y; + friction->raXnZ = delAngVel0Z; + friction->velMultiplier = velMultiplier; + friction->targetVelocity = V4Sub(V4MulAdd(targetVelZ, tZ, V4MulAdd(targetVelY, tY, V4Mul(targetVelX, tX))), vrel); + friction->normalX = tX; + friction->normalY = tY; + friction->normalZ = tZ; + } + } + if(!(finished & 0x1)) + { + iter0.nextContact(patch0, contact0); + newFinished |= PxU32(!iter0.hasNextContact()); + } + + if(!(finished & 0x2)) + { + iter1.nextContact(patch1, contact1); + newFinished |= (PxU32(!iter1.hasNextContact()) << 1); + } + + if(!(finished & 0x4)) + { + iter2.nextContact(patch2, contact2); + newFinished |= (PxU32(!iter2.hasNextContact()) << 2); + } + + if(!(finished & 0x8)) + { + iter3.nextContact(patch3, contact3); + newFinished |= (PxU32(!iter3.hasNextContact()) << 3); + } + } + ptr = p; + } + return true; +} + + + +//The persistent friction patch correlation/allocation will already have happenned as this is per-pair. +//This function just computes the size of the combined solve data. +void computeBlockStreamByteSizesCoulomb4(PxSolverContactDesc* descs, + ThreadContext& threadContext, const CorrelationBuffer& c, + const PxU32 numFrictionPerPoint, + PxU32& _solverConstraintByteSize, PxU32* _axisConstraintCount, PxU32& _numContactPoints4) +{ + PX_ASSERT(0 == _solverConstraintByteSize); + PX_UNUSED(threadContext); + + PxU32 maxPatches = 0; + PxU32 maxContactCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxU32 maxFrictionCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxMemZero(maxContactCount, sizeof(maxContactCount)); + PxMemZero(maxFrictionCount, sizeof(maxFrictionCount)); + for(PxU32 a = 0; a < 4; ++a) + { + PxU32 axisConstraintCount = 0; + + for(PxU32 i = 0; i < descs[a].numFrictionPatches; i++) + { + PxU32 ind = i + descs[a].startFrictionPatchIndex; + + const FrictionPatch& frictionPatch = c.frictionPatches[ind]; + + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0; + //Solver constraint data. + if(c.frictionPatchContactCounts[ind]!=0) + { + maxContactCount[i] = PxMax(c.frictionPatchContactCounts[ind], maxContactCount[i]); + axisConstraintCount += c.frictionPatchContactCounts[ind]; + + if(haveFriction) + { + //const PxU32 fricCount = c.frictionPatches[ind].numConstraints; + const PxU32 fricCount = c.frictionPatchContactCounts[ind] * numFrictionPerPoint; + maxFrictionCount[i] = PxMax(fricCount, maxFrictionCount[i]); + axisConstraintCount += fricCount; + } + } + } + maxPatches = PxMax(descs[a].numFrictionPatches, maxPatches); + _axisConstraintCount[a] = axisConstraintCount; + } + + PxU32 totalContacts = 0, totalFriction = 0; + for(PxU32 a = 0; a < maxPatches; ++a) + { + totalContacts += maxContactCount[a]; + totalFriction += maxFrictionCount[a]; + } + + _numContactPoints4 = totalContacts; + + + //OK, we have a given number of friction patches, contact points and friction constraints so we can calculate how much memory we need + + const bool isStatic = (((descs[0].bodyState1 | descs[1].bodyState1 | descs[2].bodyState1 | descs[3].bodyState1) & PxSolverContactDesc::eDYNAMIC_BODY) == 0); + + const PxU32 headerSize = (sizeof(SolverContactCoulombHeader4) + sizeof(SolverFrictionHeader4)) * maxPatches; + //Add on 1 Vec4V per contact for the applied force buffer + const PxU32 constraintSize = isStatic ? ((sizeof(SolverContact4Base) + sizeof(Vec4V)) * totalContacts) + ( sizeof(SolverFriction4Base) * totalFriction) : + ((sizeof(SolverContact4Dynamic) + sizeof(Vec4V)) * totalContacts) + (sizeof(SolverFriction4Dynamic) * totalFriction); + + _solverConstraintByteSize = ((constraintSize + headerSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); +} + + +static SolverConstraintPrepState::Enum reserveBlockStreamsCoulomb4(PxSolverContactDesc* descs, ThreadContext& threadContext, const CorrelationBuffer& c, + PxU8*& solverConstraint, const PxU32 numFrictionPerContactPoint, + PxU32& solverConstraintByteSize, + PxU32* axisConstraintCount, PxU32& numContactPoints4, PxConstraintAllocator& constraintAllocator) +{ + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(0 == solverConstraintByteSize); + + //From constraintBlockStream we need to reserve contact points, contact forces, and a char buffer for the solver constraint data (already have a variable for this). + //From frictionPatchStream we just need to reserve a single buffer. + + //Compute the sizes of all the buffers. + computeBlockStreamByteSizesCoulomb4( + descs, threadContext, c, numFrictionPerContactPoint, solverConstraintByteSize, + axisConstraintCount, numContactPoints4); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if(constraintBlockByteSize > 0) + { + if((constraintBlockByteSize + 16u) > 16384) + return SolverConstraintPrepState::eUNBATCHABLE; + + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if(0==constraintBlock || (reinterpret_cast(-1))==constraintBlock) + { + if(0==constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock=NULL; + } + } + } + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if(0==constraintBlockByteSize || constraintBlock) + { + if(solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0==(uintptr_t(solverConstraint) & 0x0f)); + } + } + + //Return true if neither of the two block reservations failed. + return ((0==constraintBlockByteSize || constraintBlock)) ? SolverConstraintPrepState::eSUCCESS : SolverConstraintPrepState::eOUT_OF_MEMORY; +} + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb1D( + PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator) +{ + return createFinalizeSolverContacts4Coulomb(outputs, threadContext, blockDescs, invDtF32, dtF32, bounceThresholdF32, + frictionOffsetThreshold, correlationDistance, constraintAllocator, PxFrictionType::eONE_DIRECTIONAL); +} + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb2D( + PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator) +{ + return createFinalizeSolverContacts4Coulomb(outputs, threadContext, blockDescs, invDtF32, dtF32, bounceThresholdF32, + frictionOffsetThreshold, correlationDistance, constraintAllocator, PxFrictionType::eTWO_DIRECTIONAL); +} + + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Coulomb( + PxsContactManagerOutput** outputs, + ThreadContext& threadContext, + PxSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + PxFrictionType::Enum frictionType) +{ + PX_UNUSED(frictionOffsetThreshold); + PX_UNUSED(correlationDistance); + PX_UNUSED(dtF32); + + for(PxU32 i = 0; i < 4; ++i) + { + blockDescs[i].desc->constraintLengthOver16 = 0; + } + + PX_ASSERT(outputs[0]->nbContacts && outputs[1]->nbContacts && outputs[2]->nbContacts && outputs[3]->nbContacts); + + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + PxU32 numContacts = 0; + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + PxU32 numFrictionPerPoint = PxU32(frictionType == PxFrictionType::eONE_DIRECTIONAL ? 1 : 2); + + PX_ALIGN(16, PxReal invMassScale0[4]); + PX_ALIGN(16, PxReal invMassScale1[4]); + PX_ALIGN(16, PxReal invInertiaScale0[4]); + PX_ALIGN(16, PxReal invInertiaScale1[4]); + + for(PxU32 a = 0; a < 4; ++a) + { + PxSolverContactDesc& blockDesc = blockDescs[a]; + PxSolverConstraintDesc& desc = *blockDesc.desc; + + //blockDesc.startContactIndex = numContacts; + blockDesc.contacts = &buffer.contacts[numContacts]; + + PxPrefetchLine(desc.bodyA); + PxPrefetchLine(desc.bodyB); + + if((numContacts + outputs[a]->nbContacts) > 64) + { + return SolverConstraintPrepState::eUNBATCHABLE; + } + bool hasMaxImpulse, hasTargetVelocity; + + const PxReal defaultMaxImpulse = PxMin(blockDesc.data0->maxContactImpulse, blockDesc.data1->maxContactImpulse); + + PxU32 contactCount = extractContacts(buffer, *outputs[a], hasMaxImpulse, hasTargetVelocity, invMassScale0[a], invMassScale1[a], + invInertiaScale0[a], invInertiaScale1[a], defaultMaxImpulse); + + if(contactCount == 0) + return SolverConstraintPrepState::eUNBATCHABLE; + + numContacts+=contactCount; + + blockDesc.numContacts = contactCount; + blockDesc.hasMaxImpulse = hasMaxImpulse; + + blockDesc.startFrictionPatchIndex = c.frictionPatchCount; + blockDesc.startContactPatchIndex = c.contactPatchCount; + + createContactPatches(c, blockDesc.contacts, contactCount, PXC_SAME_NORMAL); + + bool overflow = correlatePatches(c, blockDesc.contacts, blockDesc.bodyFrame0, blockDesc.bodyFrame1, PXC_SAME_NORMAL, blockDesc.startContactPatchIndex, + blockDesc.startFrictionPatchIndex); + if(overflow) + return SolverConstraintPrepState::eUNBATCHABLE; + + blockDesc.numContactPatches = PxU16(c.contactPatchCount - blockDesc.startContactPatchIndex); + blockDesc.numFrictionPatches = c.frictionPatchCount - blockDesc.startFrictionPatchIndex; + + invMassScale0[a] *= blockDesc.invMassScales.linear0; + invMassScale1[a] *= blockDesc.invMassScales.linear1; + invInertiaScale0[a] *= blockDesc.invMassScales.angular0; + invInertiaScale1[a] *= blockDesc.invMassScales.angular1; + + } + + //OK, now we need to work out how much memory to allocate, allocate it and then block-create the constraints... + + PxU8* solverConstraint = NULL; + PxU32 solverConstraintByteSize = 0; + PxU32 axisConstraintCount[4]; + PxU32 numContactPoints4 = 0; + + SolverConstraintPrepState::Enum state = reserveBlockStreamsCoulomb4(blockDescs, threadContext, c, + solverConstraint, numFrictionPerPoint, + solverConstraintByteSize, + axisConstraintCount, numContactPoints4, constraintAllocator); + + if(state != SolverConstraintPrepState::eSUCCESS) + return state; + + //OK, we allocated the memory, now let's create the constraints + + for(PxU32 a = 0; a < 4; ++a) + { + PxSolverConstraintDesc& desc = *blockDescs[a].desc; + //n[a]->solverConstraintPointer = solverConstraint; + desc.constraint = solverConstraint; + + //KS - TODO - add back in counters for axisConstraintCount somewhere... + blockDescs[a].axisConstraintCount += PxTo16(axisConstraintCount[a]); + + desc.constraintLengthOver16 = PxTo16(solverConstraintByteSize/16); + + void* writeBack = outputs[a]->contactForces; + desc.writeBack = writeBack; + } + + const Vec4V iMassScale0 = V4LoadA(invMassScale0); + const Vec4V iInertiaScale0 = V4LoadA(invInertiaScale0); + const Vec4V iMassScale1 = V4LoadA(invMassScale1); + const Vec4V iInertiaScale1 = V4LoadA(invInertiaScale1); + + + bool hasFriction = setupFinalizeSolverConstraintsCoulomb4(blockDescs, solverConstraint, + invDtF32, bounceThresholdF32, c, numFrictionPerPoint, numContactPoints4, solverConstraintByteSize, + iMassScale0, iInertiaScale0, iMassScale1, iInertiaScale1); + + *(reinterpret_cast(solverConstraint + solverConstraintByteSize)) = 0; + *(reinterpret_cast(solverConstraint + solverConstraintByteSize + 4)) = hasFriction ? 0xFFFFFFFF : 0; + + + return SolverConstraintPrepState::eSUCCESS; +} + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp new file mode 100644 index 0000000..1f1c984 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepPF.cpp @@ -0,0 +1,639 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "DySolverContact.h" +#include "DySolverContactPF.h" +#include "PxcNpWorkUnit.h" +#include "DyThreadContext.h" +#include "PxcNpContactPrepShared.h" +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" + +using namespace physx::Gu; +using namespace physx::aos; + +namespace physx +{ +namespace Dy +{ + +bool createFinalizeSolverContactsCoulomb(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + PxFrictionType::Enum frictionType, + Cm::SpatialVectorF* Z); + +static bool setupFinalizeSolverConstraintsCoulomb( + Sc::ShapeInteraction* shapeInteraction, + const PxContactBuffer& buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const PxSolverBodyData& data0, + const PxSolverBodyData& data1, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxU32 frictionPerPointCount, + const bool hasForceThresholds, + const bool staticBody, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + PxReal restDist, + const PxReal maxCCDSeparation, + const PxReal solverOffsetSlopF32) +{ + const FloatV ccdMaxSeparation = FLoad(maxCCDSeparation); + const Vec3V solverOffsetSlop = V3Load(solverOffsetSlopF32); + PxU8* PX_RESTRICT ptr = workspace; + const FloatV zero=FZero(); + + PxU8 flags = PxU8(hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0); + + const FloatV restDistance = FLoad(restDist); + + const Vec3V bodyFrame0p = V3LoadU(bodyFrame0.p); + const Vec3V bodyFrame1p = V3LoadU(bodyFrame1.p); + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + const PxU32 frictionPatchCount = c.frictionPatchCount; + + const PxU32 pointStride = sizeof(SolverContactPoint); + const PxU32 frictionStride = sizeof(SolverContactFriction); + const PxU8 pointHeaderType = PxTo8(staticBody ? DY_SC_TYPE_STATIC_CONTACT : DY_SC_TYPE_RB_CONTACT); + const PxU8 frictionHeaderType = PxTo8(staticBody ? DY_SC_TYPE_STATIC_FRICTION : DY_SC_TYPE_FRICTION); + + + const Vec3V linVel0 = V3LoadU(data0.linearVelocity); + const Vec3V linVel1 = V3LoadU(data1.linearVelocity); + const Vec3V angVel0 = V3LoadU(data0.angularVelocity); + const Vec3V angVel1 = V3LoadU(data1.angularVelocity); + + + const FloatV invMass0 = FLoad(data0.invMass); + const FloatV invMass1 = FLoad(data1.invMass); + + const FloatV maxPenBias = FMax(FLoad(data0.penBiasClamp), FLoad(data1.penBiasClamp)); + + // PT: the matrix is symmetric so we can read it as a PxMat33! Gets rid of 25000+ LHS. + const PxMat33& invIn0 = reinterpret_cast(data0.sqrtInvInertia); + PX_ALIGN(16, const Mat33V invSqrtInertia0) + ( + V3LoadU(invIn0.column0), + V3LoadU(invIn0.column1), + V3LoadU(invIn0.column2) + ); + const PxMat33& invIn1 = reinterpret_cast(data1.sqrtInvInertia); + PX_ALIGN(16, const Mat33V invSqrtInertia1) + ( + V3LoadU(invIn1.column0), + V3LoadU(invIn1.column1), + V3LoadU(invIn1.column2) + ); + + const FloatV invDt = FLoad(invDtF32); + const FloatV dt = FLoad(dtF32); + const FloatV p8 = FLoad(0.8f); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + const FloatV orthoThreshold = FLoad(0.70710678f); + const FloatV eps = FLoad(0.00001f); + + const FloatV invDtp8 = FMul(invDt, p8); + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + const FloatV nDom1fV = FNeg(d1); + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + const FloatV invMass0_dom0fV = FMul(d0, invMass0); + const FloatV invMass1_dom1fV = FMul(nDom1fV, invMass1); + + + for(PxU32 i=0;i< frictionPatchCount;i++) + { + const PxU32 contactCount = c.frictionPatchContactCounts[i]; + if(contactCount == 0) + continue; + + const PxContactPoint* contactBase0 = buffer.contacts + c.contactPatches[c.correlationListHeads[i]].start; + + const Vec3V normal = aos::V3LoadA(contactBase0->normal); + + const FloatV normalLenSq = V3LengthSq(normal); + const VecCrossV norCross = V3PrepareCross(normal); + + const FloatV restitution = FLoad(contactBase0->restitution); + const FloatV damping = FLoad(contactBase0->damping); + + const FloatV norVel = V3SumElems(V3NegMulSub(normal, linVel1, V3Mul(normal, linVel0))); + /*const FloatV norVel0 = V3Dot(normal, linVel0); + const FloatV norVel1 = V3Dot(normal, linVel1); + const FloatV norVel = FSub(norVel0, norVel1);*/ + + const FloatV invMassNorLenSq0 = FMul(invMass0_dom0fV, normalLenSq); + const FloatV invMassNorLenSq1 = FMul(invMass1_dom1fV, normalLenSq); + + + SolverContactCoulombHeader* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactCoulombHeader); + + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + + + header->numNormalConstr = PxU8(contactCount); + header->type = pointHeaderType; + //header->setRestitution(n.restitution); + //header->setRestitution(contactBase0->restitution); + + header->setDominance0(invMass0_dom0fV); + header->setDominance1(FNeg(invMass1_dom1fV)); + FStore(angD0, &header->angDom0); + FStore(angD1, &header->angDom1); + header->setNormal(normal); + header->flags = flags; + header->shapeInteraction = shapeInteraction; + + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer.contacts + c.contactPatches[patch].start; + + + PxU8* p = ptr; + for(PxU32 j=0;j(p); + p += pointStride; + + constructContactConstraint(invSqrtInertia0, invSqrtInertia1, invMassNorLenSq0, + invMassNorLenSq1, angD0, angD1, bodyFrame0p, bodyFrame1p, + normal, norVel, norCross, angVel0, angVel1, + invDt, invDtp8, dt, restDistance, maxPenBias, restitution, + bounceThreshold, contact, *solverContact, ccdMaxSeparation, solverOffsetSlop, damping); + } + ptr = p; + } + } + + //construct all the frictions + + PxU8* PX_RESTRICT ptr2 = workspace; + + bool hasFriction = false; + for(PxU32 i=0;i< frictionPatchCount;i++) + { + const PxU32 contactCount = c.frictionPatchContactCounts[i]; + if(contactCount == 0) + continue; + + const PxContactPoint* contactBase0 = buffer.contacts + c.contactPatches[c.correlationListHeads[i]].start; + + SolverContactCoulombHeader* header = reinterpret_cast(ptr2); + header->frictionOffset = PxU16(ptr - ptr2);// + sizeof(SolverFrictionHeader); + ptr2 += sizeof(SolverContactCoulombHeader) + header->numNormalConstr * pointStride; + + const PxReal staticFriction = contactBase0->staticFriction; + const bool disableStrongFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + const bool haveFriction = (disableStrongFriction == 0); + + SolverFrictionHeader* frictionHeader = reinterpret_cast(ptr); + frictionHeader->numNormalConstr = PxTo8(c.frictionPatchContactCounts[i]); + frictionHeader->numFrictionConstr = PxTo8(haveFriction ? c.frictionPatchContactCounts[i] * frictionPerPointCount : 0); + ptr += sizeof(SolverFrictionHeader); + PxF32* appliedForceBuffer = reinterpret_cast(ptr); + ptr += frictionHeader->getAppliedForcePaddingSize(c.frictionPatchContactCounts[i]); + PxMemZero(appliedForceBuffer, sizeof(PxF32)*contactCount*frictionPerPointCount); + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + + const Vec3V normal = V3LoadU(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + + const FloatV normalX = V3GetX(normal); + const FloatV normalY = V3GetY(normal); + const FloatV normalZ = V3GetZ(normal); + + const Vec3V t0Fallback1 = V3Merge(zero, FNeg(normalZ), normalY); + const Vec3V t0Fallback2 = V3Merge(FNeg(normalY), normalX, zero); + + const BoolV con = FIsGrtr(orthoThreshold, FAbs(normalX)); + const Vec3V tFallback1 = V3Sel(con, t0Fallback1, t0Fallback2); + + const Vec3V linVrel = V3Sub(linVel0, linVel1); + const Vec3V t0_ = V3Sub(linVrel, V3Scale(normal, V3Dot(normal, linVrel))); + const FloatV sqDist = V3Dot(t0_,t0_); + const BoolV con1 = FIsGrtr(sqDist, eps); + const Vec3V tDir0 =V3Normalize(V3Sel(con1, t0_, tFallback1)); + const Vec3V tDir1 = V3Cross(tDir0, normal); + + Vec3V tFallback = tDir0; + Vec3V tFallbackAlt = tDir1; + + if(haveFriction) + { + //frictionHeader->setStaticFriction(n.staticFriction); + frictionHeader->setStaticFriction(staticFriction); + FStore(invMass0_dom0fV, &frictionHeader->invMass0D0); + FStore(FNeg(invMass1_dom1fV), &frictionHeader->invMass1D1); + FStore(angD0, &frictionHeader->angDom0); + FStore(angD1, &frictionHeader->angDom1); + frictionHeader->type = frictionHeaderType; + + for(PxU32 patch=c.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxU32 start = c.contactPatches[patch].start; + const PxContactPoint* contactBase = buffer.contacts + start; + + PxU8* p = ptr; + for(PxU32 j =0; j < count; j++) + { + hasFriction = true; + const PxContactPoint& contact = contactBase[j]; + const Vec3V point = V3LoadU(contact.point); + Vec3V ra = V3Sub(point, bodyFrame0p); + Vec3V rb = V3Sub(point, bodyFrame1p); + ra = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(ra)), V3Zero(), ra); + rb = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rb)), V3Zero(), rb); + const Vec3V targetVel = V3LoadU(contact.targetVel); + + for(PxU32 k = 0; k < frictionPerPointCount; ++k) + { + const Vec3V t0 = tFallback; + tFallback = tFallbackAlt; + tFallbackAlt = t0; + + SolverContactFriction* PX_RESTRICT f0 = reinterpret_cast(p); + p += frictionStride; + //f0->brokenOrContactIndex = contactId; + + const Vec3V raXn = V3Cross(ra, t0); + const Vec3V rbXn = V3Cross(rb, t0); + + const Vec3V delAngVel0 = M33MulV3(invSqrtInertia0, raXn); + const Vec3V delAngVel1 = M33MulV3(invSqrtInertia1, rbXn); + + const FloatV resp0 = FAdd(invMass0_dom0fV, FMul(angD0, V3Dot(delAngVel0, delAngVel0))); + const FloatV resp1 = FSub(FMul(angD1, V3Dot(delAngVel1, delAngVel1)), invMass1_dom1fV); + const FloatV resp = FAdd(resp0, resp1); + + const FloatV velMultiplier = FNeg(FSel(FIsGrtr(resp, zero), FRecip(resp), zero)); + + const FloatV vrel1 = FAdd(V3Dot(t0, linVel0), V3Dot(raXn, angVel0)); + const FloatV vrel2 = FAdd(V3Dot(t0, linVel1), V3Dot(rbXn, angVel1)); + const FloatV vrel = FSub(vrel1, vrel2); + + + f0->normalXYZ_appliedForceW = V4SetW(Vec4V_From_Vec3V(t0), zero); + f0->raXnXYZ_velMultiplierW = V4SetW(Vec4V_From_Vec3V(delAngVel0), velMultiplier); + //f0->rbXnXYZ_targetVelocityW = V4SetW(Vec4V_From_Vec3V(delAngVel1), FSub(V3Dot(targetVel, t0), vrel)); + f0->rbXnXYZ_biasW = Vec4V_From_Vec3V(delAngVel1); + FStore(FSub(V3Dot(targetVel, t0), vrel), &f0->targetVel); + } + } + + ptr = p; + } + } + } + *ptr = 0; + return hasFriction; +} + + + +static void computeBlockStreamByteSizesCoulomb(const CorrelationBuffer& c, + const PxU32 frictionCountPerPoint, PxU32& _solverConstraintByteSize, + PxU32& _axisConstraintCount, + bool useExtContacts) +{ + PX_ASSERT(0 == _solverConstraintByteSize); + PX_ASSERT(0 == _axisConstraintCount); + + // PT: use local vars to remove LHS + PxU32 solverConstraintByteSize = 0; + PxU32 numFrictionPatches = 0; + PxU32 axisConstraintCount = 0; + + for(PxU32 i = 0; i < c.frictionPatchCount; i++) + { + //Friction patches. + if(c.correlationListHeads[i] != CorrelationBuffer::LIST_END) + numFrictionPatches++; + + + const FrictionPatch& frictionPatch = c.frictionPatches[i]; + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0; + + //Solver constraint data. + if(c.frictionPatchContactCounts[i]!=0) + { + solverConstraintByteSize += sizeof(SolverContactCoulombHeader); + + solverConstraintByteSize += useExtContacts ? c.frictionPatchContactCounts[i] * sizeof(SolverContactPointExt) + : c.frictionPatchContactCounts[i] * sizeof(SolverContactPoint); + + axisConstraintCount += c.frictionPatchContactCounts[i]; + + //We always need the friction headers to write the accumulated + if(haveFriction) + { + //4 bytes + solverConstraintByteSize += sizeof(SolverFrictionHeader); + //buffer to store applied forces in + solverConstraintByteSize += SolverFrictionHeader::getAppliedForcePaddingSize(c.frictionPatchContactCounts[i]); + + const PxU32 nbFrictionConstraints = c.frictionPatchContactCounts[i] * frictionCountPerPoint; + + solverConstraintByteSize += useExtContacts ? nbFrictionConstraints * sizeof(SolverContactFrictionExt) + : nbFrictionConstraints * sizeof(SolverContactFriction); + axisConstraintCount += c.frictionPatchContactCounts[i]; + } + else + { + //reserve buffers for storing accumulated impulses + solverConstraintByteSize += sizeof(SolverFrictionHeader); + solverConstraintByteSize += SolverFrictionHeader::getAppliedForcePaddingSize(c.frictionPatchContactCounts[i]); + } + } + } + _axisConstraintCount = axisConstraintCount; + + //16-byte alignment. + _solverConstraintByteSize = ((solverConstraintByteSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); +} + +static bool reserveBlockStreamsCoulomb(const CorrelationBuffer& c, + PxU8*& solverConstraint, PxU32 frictionCountPerPoint, + PxU32& solverConstraintByteSize, + PxU32& axisConstraintCount, PxConstraintAllocator& constraintAllocator, + bool useExtContacts) +{ + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(0 == solverConstraintByteSize); + PX_ASSERT(0 == axisConstraintCount); + + + //From constraintBlockStream we need to reserve contact points, contact forces, and a char buffer for the solver constraint data (already have a variable for this). + //From frictionPatchStream we just need to reserve a single buffer. + + //Compute the sizes of all the buffers. + computeBlockStreamByteSizesCoulomb( + c, + frictionCountPerPoint, solverConstraintByteSize, + axisConstraintCount, useExtContacts); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if(constraintBlockByteSize > 0) + { + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if(0==constraintBlock || (reinterpret_cast(-1))==constraintBlock) + { + if(0==constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock=NULL; + } + } + } + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if(0==constraintBlockByteSize || constraintBlock) + { + if(solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0==(uintptr_t(solverConstraint) & 0x0f)); + } + } + + //Return true if neither of the two block reservations failed. + return ((0==constraintBlockByteSize || constraintBlock)); +} + +bool createFinalizeSolverContactsCoulomb1D(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z) +{ + return createFinalizeSolverContactsCoulomb(contactDesc, output, threadContext, invDtF32, dtF32, bounceThresholdF32, frictionOffsetThreshold, correlationDistance, + constraintAllocator, PxFrictionType::eONE_DIRECTIONAL, Z); +} + +bool createFinalizeSolverContactsCoulomb2D(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + Cm::SpatialVectorF* Z) + +{ + return createFinalizeSolverContactsCoulomb(contactDesc, output, threadContext, invDtF32, dtF32, bounceThresholdF32, frictionOffsetThreshold, correlationDistance, + constraintAllocator, PxFrictionType::eTWO_DIRECTIONAL, Z); +} + +bool createFinalizeSolverContactsCoulomb(PxSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal frictionOffsetThreshold, + PxReal correlationDistance, + PxConstraintAllocator& constraintAllocator, + PxFrictionType::Enum frictionType, + Cm::SpatialVectorF* Z) +{ + PX_UNUSED(frictionOffsetThreshold); + PX_UNUSED(correlationDistance); + + PxSolverConstraintDesc& desc = *contactDesc.desc; + + desc.constraintLengthOver16 = 0; + + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + // We pull the friction patches out of the cache to remove the dependency on how + // the cache is organized. Remember original addrs so we can write them back + // efficiently. + + PxPrefetchLine(contactDesc.frictionPtr); + + PxReal invMassScale0 = 1.f; + PxReal invMassScale1 = 1.f; + PxReal invInertiaScale0 = 1.f; + PxReal invInertiaScale1 = 1.f; + + bool hasMaxImpulse = false, hasTargetVelocity = false; + + PxU32 numContacts = extractContacts(buffer, output, hasMaxImpulse, hasTargetVelocity, invMassScale0, invMassScale1, + invInertiaScale0, invInertiaScale1, PxMin(contactDesc.data0->maxContactImpulse, contactDesc.data1->maxContactImpulse)); + + if(numContacts == 0) + { + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; + return true; + } + + PxPrefetchLine(contactDesc.body0); + PxPrefetchLine(contactDesc.body1); + PxPrefetchLine(contactDesc.data0); + PxPrefetchLine(contactDesc.data1); + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + createContactPatches(c, buffer.contacts, buffer.count, PXC_SAME_NORMAL); + + PxU32 numFrictionPerPatch = PxU32(frictionType == PxFrictionType::eONE_DIRECTIONAL ? 1 : 2); + + bool overflow = correlatePatches(c, buffer.contacts, contactDesc.bodyFrame0, contactDesc.bodyFrame1, PXC_SAME_NORMAL, 0, 0); + PX_UNUSED(overflow); +#if PX_CHECKED + if(overflow) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Dropping contacts in solver because we exceeded limit of 32 friction patches."); + } +#endif + + + //PX_ASSERT(patchCount == c.frictionPatchCount); + + PxU8* solverConstraint = NULL; + PxU32 solverConstraintByteSize = 0; + PxU32 axisConstraintCount = 0; + + const bool useExtContacts = !!((contactDesc.bodyState0 | contactDesc.bodyState1) & PxSolverContactDesc::eARTICULATION); + + const bool successfulReserve = reserveBlockStreamsCoulomb( + c, + solverConstraint, numFrictionPerPatch, + solverConstraintByteSize, + axisConstraintCount, + constraintAllocator, + useExtContacts); + + // initialise the work unit's ptrs to the various buffers. + + contactDesc.frictionPtr = NULL; + desc.constraint = NULL; + desc.constraintLengthOver16 = 0; + contactDesc.frictionCount = 0; + + // patch up the work unit with the reserved buffers and set the reserved buffer data as appropriate. + + if(successfulReserve) + { + desc.constraint = solverConstraint; + output.nbContacts = PxTo16(numContacts); + desc.constraintLengthOver16 = PxTo16(solverConstraintByteSize/16); + + //Initialise solverConstraint buffer. + if(solverConstraint) + { + bool hasFriction = false; + const PxSolverBodyData& data0 = *contactDesc.data0; + const PxSolverBodyData& data1 = *contactDesc.data1; + if(useExtContacts) + { + const SolverExtBody b0(reinterpret_cast(contactDesc.body0), reinterpret_cast(&data0), desc.linkIndexA); + const SolverExtBody b1(reinterpret_cast(contactDesc.body1), reinterpret_cast(&data1), desc.linkIndexB); + + hasFriction = setupFinalizeExtSolverContactsCoulomb(buffer, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + invDtF32, dtF32, bounceThresholdF32, b0, b1, numFrictionPerPatch, + invMassScale0, invInertiaScale0, invMassScale1, invInertiaScale1, contactDesc.restDistance, contactDesc.maxCCDSeparation, Z, + contactDesc.offsetSlop); + } + else + { + hasFriction = setupFinalizeSolverConstraintsCoulomb(getInteraction(contactDesc), buffer, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + data0, data1, invDtF32, dtF32, bounceThresholdF32, numFrictionPerPatch, contactDesc.hasForceThresholds, contactDesc.bodyState1 == PxSolverContactDesc::eSTATIC_BODY, + invMassScale0, invInertiaScale0, invMassScale1, invInertiaScale1, contactDesc.restDistance, contactDesc.maxCCDSeparation, contactDesc.offsetSlop); + } + *(reinterpret_cast(solverConstraint + solverConstraintByteSize)) = 0; + *(reinterpret_cast(solverConstraint + solverConstraintByteSize + 4)) = hasFriction ? 0xFFFFFFFF : 0; + } + } + + return successfulReserve; +} + +} +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepShared.h new file mode 100644 index 0000000..570a6f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactPrepShared.h @@ -0,0 +1,346 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONTACT_PREP_SHARED_H +#define DY_CONTACT_PREP_SHARED_H + +#include "foundation/PxPreprocessor.h" +#include "PxSceneDesc.h" +#include "foundation/PxVecMath.h" +#include "DyContactPrep.h" +#include "DyCorrelationBuffer.h" +#include "DyArticulationContactPrep.h" +#include "PxsContactManager.h" +#include "PxsContactManagerState.h" + +namespace physx +{ +namespace Dy +{ +template +PX_FORCE_INLINE Sc::ShapeInteraction* getInteraction(const PxSolverContactDescT& desc) +{ + return reinterpret_cast(desc.shapeInteraction); +} + +PX_FORCE_INLINE bool pointsAreClose(const PxTransform& body1ToBody0, + const PxVec3& localAnchor0, const PxVec3& localAnchor1, + const PxVec3& axis, float correlDist) +{ + const PxVec3 body0PatchPoint1 = body1ToBody0.transform(localAnchor1); + + return PxAbs((localAnchor0 - body0PatchPoint1).dot(axis))(frictionCookie); + + //Try working out relative transforms! TODO - can we compute this lazily for the first friction patch + bool evaluated = false; + PxTransform body1ToBody0; + + while(frictionPatchCount--) + { + PxPrefetchLine(patches,128); + const FrictionPatch& patch = *patches++; + PX_ASSERT (patch.broken == 0 || patch.broken == 1); + if(!patch.broken) + { + // if the eDISABLE_STRONG_FRICTION flag is there we need to blow away the previous frame's friction correlation, so + // that we can associate each friction anchor with a target velocity. So we lose strong friction. + if(patch.anchorCount != 0 && !(patch.materialFlags & PxMaterialFlag::eDISABLE_STRONG_FRICTION)) + { + PX_ASSERT(patch.anchorCount <= 2); + + + if(!evaluated) + { + body1ToBody0 = bodyFrame0.transformInv(bodyFrame1); + evaluated = true; + } + + + if(patch.body0Normal.dot(body1ToBody0.rotate(patch.body1Normal)) > PXC_SAME_NORMAL) + { + if(!isSeparated(patch, body1ToBody0, correlationDistance)) + { + if(c.frictionPatchCount == CorrelationBuffer::MAX_FRICTION_PATCHES) + return false; + { + c.contactID[c.frictionPatchCount][0] = 0xffff; + c.contactID[c.frictionPatchCount][1] = 0xffff; + //Rotate the contact normal into world space + c.frictionPatchWorldNormal[c.frictionPatchCount] = bodyFrame0.rotate(patch.body0Normal); + c.frictionPatchContactCounts[c.frictionPatchCount] = 0; + c.patchBounds[c.frictionPatchCount].setEmpty(); + c.correlationListHeads[c.frictionPatchCount] = CorrelationBuffer::LIST_END; + PxMemCopy(&c.frictionPatches[c.frictionPatchCount++], &patch, sizeof(FrictionPatch)); + } + } + } + } + } + } + return true; +} + +PX_FORCE_INLINE PxU32 extractContacts(PxContactBuffer& buffer, PxsContactManagerOutput& npOutput, bool& hasMaxImpulse, bool& hasTargetVelocity, + PxReal& invMassScale0, PxReal& invMassScale1, PxReal& invInertiaScale0, PxReal& invInertiaScale1, PxReal defaultMaxImpulse) +{ + PxContactStreamIterator iter(npOutput.contactPatches, npOutput.contactPoints, npOutput.getInternalFaceIndice(), npOutput.nbPatches, npOutput.nbContacts); + + PxU32 numContacts = buffer.count, origContactCount = buffer.count; + if(!iter.forceNoResponse) + { + invMassScale0 = iter.getInvMassScale0(); + invMassScale1 = iter.getInvMassScale1(); + invInertiaScale0 = iter.getInvInertiaScale0(); + invInertiaScale1 = iter.getInvInertiaScale1(); + hasMaxImpulse = (iter.patch->internalFlags & PxContactPatch::eHAS_MAX_IMPULSE) != 0; + hasTargetVelocity = (iter.patch->internalFlags & PxContactPatch::eHAS_TARGET_VELOCITY) != 0; + + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + iter.nextContact(); + PxPrefetchLine(iter.contact, 128); + PxPrefetchLine(&buffer.contacts[numContacts], 128); + PxReal maxImpulse = hasMaxImpulse ? iter.getMaxImpulse() : defaultMaxImpulse; + if(maxImpulse != 0.f) + { + PX_ASSERT(numContacts < PxContactBuffer::MAX_CONTACTS); + buffer.contacts[numContacts].normal = iter.getContactNormal(); + PX_ASSERT(PxAbs(buffer.contacts[numContacts].normal.magnitude() - 1) < 1e-3f); + buffer.contacts[numContacts].point = iter.getContactPoint(); + buffer.contacts[numContacts].separation = iter.getSeparation(); + //KS - we use the face indices to cache the material indices and flags - avoids bloating the PxContact structure + buffer.contacts[numContacts].materialFlags = PxU8(iter.getMaterialFlags()); + buffer.contacts[numContacts].maxImpulse = maxImpulse; + buffer.contacts[numContacts].staticFriction = iter.getStaticFriction(); + buffer.contacts[numContacts].dynamicFriction = iter.getDynamicFriction(); + buffer.contacts[numContacts].restitution = iter.getRestitution(); + buffer.contacts[numContacts].damping = iter.getDamping(); + const PxVec3& targetVel = iter.getTargetVel(); + buffer.contacts[numContacts].targetVel = targetVel; + ++numContacts; + } + } + } + } + const PxU32 contactCount = numContacts - origContactCount; + buffer.count = numContacts; + return contactCount; +} + +struct CorrelationListIterator +{ + CorrelationBuffer& buffer; + PxU32 currPatch; + PxU32 currContact; + + CorrelationListIterator(CorrelationBuffer& correlationBuffer, PxU32 startPatch) : buffer(correlationBuffer) + { + //We need to force us to advance the correlation buffer to the first available contact (if one exists) + PxU32 newPatch = startPatch, newContact = 0; + + while(newPatch != CorrelationBuffer::LIST_END && newContact == buffer.contactPatches[newPatch].count) + { + newPatch = buffer.contactPatches[newPatch].next; + newContact = 0; + } + + currPatch = newPatch; + currContact = newContact; + } + + //Returns true if it has another contact pre-loaded. Returns false otherwise + PX_FORCE_INLINE bool hasNextContact() + { + return (currPatch != CorrelationBuffer::LIST_END && currContact < buffer.contactPatches[currPatch].count); + } + + inline void nextContact(PxU32& patch, PxU32& contact) + { + PX_ASSERT(currPatch != CorrelationBuffer::LIST_END); + PX_ASSERT(currContact < buffer.contactPatches[currPatch].count); + + patch = currPatch; + contact = currContact; + PxU32 newPatch = currPatch, newContact = currContact + 1; + + while(newPatch != CorrelationBuffer::LIST_END && newContact == buffer.contactPatches[newPatch].count) + { + newPatch = buffer.contactPatches[newPatch].next; + newContact = 0; + } + + currPatch = newPatch; + currContact = newContact; + } + +private: + CorrelationListIterator& operator=(const CorrelationListIterator&); + +}; + + + PX_FORCE_INLINE void constructContactConstraint(const Mat33V& invSqrtInertia0, const Mat33V& invSqrtInertia1, const FloatVArg invMassNorLenSq0, + const FloatVArg invMassNorLenSq1, const FloatVArg angD0, const FloatVArg angD1, const Vec3VArg bodyFrame0p, const Vec3VArg bodyFrame1p, + const Vec3VArg normal, const FloatVArg norVel, const VecCrossV& norCross, const Vec3VArg angVel0, const Vec3VArg angVel1, + const FloatVArg invDt, const FloatVArg invDtp8, const FloatVArg dt, const FloatVArg restDistance, const FloatVArg maxPenBias, const FloatVArg restitution, + const FloatVArg bounceThreshold, const PxContactPoint& contact, SolverContactPoint& solverContact, + const FloatVArg ccdMaxSeparation, const Vec3VArg solverOffsetSlop, const FloatVArg damping) + { + const FloatV zero = FZero(); + const Vec3V point = V3LoadA(contact.point); + const FloatV separation = FLoad(contact.separation); + + const FloatV cTargetVel = V3Dot(normal, V3LoadA(contact.targetVel)); + + const Vec3V ra = V3Sub(point, bodyFrame0p); + const Vec3V rb = V3Sub(point, bodyFrame1p); + + /*ra = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(ra)), V3Zero(), ra); + rb = V3Sel(V3IsGrtr(solverOffsetSlop, V3Abs(rb)), V3Zero(), rb);*/ + + Vec3V raXn = V3Cross(ra, norCross); + Vec3V rbXn = V3Cross(rb, norCross); + + FloatV vRelAng = FSub(V3Dot(raXn, angVel0), V3Dot(rbXn, angVel1)); + + const Vec3V slop = V3Scale(solverOffsetSlop, FMax(FSel(FIsEq(norVel, zero), FMax(), FDiv(vRelAng, norVel)), FOne())); + + raXn = V3Sel(V3IsGrtr(slop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(slop, V3Abs(rbXn)), V3Zero(), rbXn); + + vRelAng = FSub(V3Dot(raXn, angVel0), V3Dot(rbXn, angVel1)); + + const FloatV vrel = FAdd(norVel, vRelAng); + + + const Vec3V raXnSqrtInertia = M33MulV3(invSqrtInertia0, raXn); + const Vec3V rbXnSqrtInertia = M33MulV3(invSqrtInertia1, rbXn); + + const FloatV resp0 = FAdd(invMassNorLenSq0, FMul(V3Dot(raXnSqrtInertia, raXnSqrtInertia), angD0)); + const FloatV resp1 = FSub(FMul(V3Dot(rbXnSqrtInertia, rbXnSqrtInertia), angD1), invMassNorLenSq1); + + const FloatV unitResponse = FAdd(resp0, resp1); + + const FloatV penetration = FSub(separation, restDistance); + const FloatV penetrationInvDt = FMul(penetration, invDt); + + FloatV velMultiplier, scaledBias, impulseMultiplier; + const FloatV sumVRel(vrel); + + const BoolV isGreater2 = BAnd(BAnd(FIsGrtr(restitution, zero), FIsGrtr(bounceThreshold, vrel)), FIsGrtr(FNeg(vrel), penetrationInvDt)); + + + FloatV targetVelocity = FAdd(cTargetVel, FSel(isGreater2, FMul(FNeg(sumVRel), restitution), zero)); + + //Note - we add on the initial target velocity + targetVelocity = FSub(targetVelocity, vrel); + + FloatV biasedErr, unbiasedErr; + + if (FAllGrtr(zero, restitution)) + { + const FloatV nrdt = FMul(dt, restitution); + + const FloatV a = FMul(dt, FSub(damping, nrdt)); + const FloatV b = FMul(dt, FNeg(FMul(restitution, penetration))); + + const FloatV x = FRecip(FScaleAdd(a, unitResponse, FOne())); + + velMultiplier = FMul(x, a); + //scaledBias = FSel(isSeparated, FNeg(invStepDt), FDiv(FMul(nrdt, FMul(x, unitResponse)), velMultiplier)); + scaledBias = FMul(x, b); + impulseMultiplier = FSub(FOne(), x); + + unbiasedErr = biasedErr = FScaleAdd(targetVelocity, velMultiplier, FNeg(scaledBias)); + } + else + { + velMultiplier = FSel(FIsGrtr(unitResponse, zero), FRecip(unitResponse), zero); + + const FloatV penetrationInvDtPt8 = FMax(maxPenBias, FMul(penetration, invDtp8)); + + scaledBias = FMul(velMultiplier, penetrationInvDtPt8); + + const BoolV ccdSeparationCondition = FIsGrtrOrEq(ccdMaxSeparation, penetration); + + scaledBias = FSel(BAnd(ccdSeparationCondition, isGreater2), zero, scaledBias); + + impulseMultiplier = FLoad(1.f); + + biasedErr = FScaleAdd(targetVelocity, velMultiplier, FNeg(scaledBias)); + unbiasedErr = FScaleAdd(targetVelocity, velMultiplier, FSel(isGreater2, zero, FNeg(FMax(scaledBias, zero)))); + + } + + + + + + //const FloatV unbiasedErr = FScaleAdd(targetVelocity, velMultiplier, FNeg(FMax(scaledBias, zero))); + + FStore(biasedErr, &solverContact.biasedErr); + FStore(unbiasedErr, &solverContact.unbiasedErr); + FStore(impulseMultiplier, &solverContact.impulseMultiplier); + + solverContact.raXn_velMultiplierW = V4SetW(Vec4V_From_Vec3V(raXnSqrtInertia), velMultiplier); + solverContact.rbXn_maxImpulseW = V4SetW(Vec4V_From_Vec3V(rbXnSqrtInertia), FLoad(contact.maxImpulse)); + } +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactReduction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactReduction.h new file mode 100644 index 0000000..e162f8f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyContactReduction.h @@ -0,0 +1,408 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CONTACT_REDUCTION_H +#define DY_CONTACT_REDUCTION_H + +#include "geomutils/PxContactPoint.h" +#include "PxsMaterialManager.h" + +namespace physx +{ + + +namespace Dy +{ + +//KS - might be OK with 4 but 5 guarantees the deepest + 4 contacts that contribute to largest surface area +#define CONTACT_REDUCTION_MAX_CONTACTS 6 +#define CONTACT_REDUCTION_MAX_PATCHES 32 +#define PXS_NORMAL_TOLERANCE 0.995f +#define PXS_SEPARATION_TOLERANCE 0.001f + + + //A patch contains a normal, pair of material indices and a list of indices. These indices are + //used to index into the PxContact array that's passed by the user + struct ReducedContactPatch + { + PxU32 numContactPoints; + PxU32 contactPoints[CONTACT_REDUCTION_MAX_CONTACTS]; + }; + + struct ContactPatch + { + PxVec3 rootNormal; + ContactPatch* mNextPatch; + PxReal maxPenetration; + PxU16 startIndex; + PxU16 stride; + PxU16 rootIndex; + PxU16 index; + }; + + struct SortBoundsPredicateManifold + { + bool operator()(const ContactPatch* idx1, const ContactPatch* idx2) const + { + return idx1->maxPenetration < idx2->maxPenetration; + } + }; + + + + template + class ContactReduction + { + public: + ReducedContactPatch mPatches[MaxPatches]; + PxU32 mNumPatches; + ContactPatch mIntermediatePatches[CONTACT_REDUCTION_MAX_PATCHES]; + ContactPatch* mIntermediatePatchesPtrs[CONTACT_REDUCTION_MAX_PATCHES]; + PxU32 mNumIntermediatePatches; + PxContactPoint* PX_RESTRICT mOriginalContacts; + PxsMaterialInfo* PX_RESTRICT mMaterialInfo; + PxU32 mNumOriginalContacts; + + ContactReduction(PxContactPoint* PX_RESTRICT originalContacts, PxsMaterialInfo* PX_RESTRICT materialInfo, PxU32 numContacts) : + mNumPatches(0), mNumIntermediatePatches(0), mOriginalContacts(originalContacts), mMaterialInfo(materialInfo), mNumOriginalContacts(numContacts) + { + } + + void reduceContacts() + { + //First pass, break up into contact patches, storing the start and stride of the patches + //We will need to have contact patches and then coallesce them + mIntermediatePatches[0].rootNormal = mOriginalContacts[0].normal; + mIntermediatePatches[0].mNextPatch = NULL; + mIntermediatePatches[0].startIndex = 0; + mIntermediatePatches[0].rootIndex = 0; + mIntermediatePatches[0].maxPenetration = mOriginalContacts[0].separation; + mIntermediatePatches[0].index = 0; + PxU16 numPatches = 1; + //PxU32 startIndex = 0; + PxU32 numUniquePatches = 1; + PxU16 m = 1; + for(; m < mNumOriginalContacts; ++m) + { + PxI32 index = -1; + for(PxU32 b = numPatches; b > 0; --b) + { + ContactPatch& patch = mIntermediatePatches[b-1]; + if(mMaterialInfo[patch.startIndex].mMaterialIndex0 == mMaterialInfo[m].mMaterialIndex0 && mMaterialInfo[patch.startIndex].mMaterialIndex1 == mMaterialInfo[m].mMaterialIndex1 && + patch.rootNormal.dot(mOriginalContacts[m].normal) >= PXS_NORMAL_TOLERANCE) + { + index = PxI32(b-1); + break; + } + } + + if(index != numPatches - 1) + { + mIntermediatePatches[numPatches-1].stride = PxU16(m - mIntermediatePatches[numPatches - 1].startIndex); + //Create a new patch... + if(numPatches == CONTACT_REDUCTION_MAX_PATCHES) + { + break; + } + mIntermediatePatches[numPatches].startIndex = m; + mIntermediatePatches[numPatches].mNextPatch = NULL; + if(index == -1) + { + mIntermediatePatches[numPatches].rootIndex = numPatches; + mIntermediatePatches[numPatches].rootNormal = mOriginalContacts[m].normal; + mIntermediatePatches[numPatches].maxPenetration = mOriginalContacts[m].separation; + mIntermediatePatches[numPatches].index = numPatches; + ++numUniquePatches; + } + else + { + //Find last element in the link + PxU16 rootIndex = mIntermediatePatches[index].rootIndex; + mIntermediatePatches[index].mNextPatch = &mIntermediatePatches[numPatches]; + mIntermediatePatches[numPatches].rootNormal = mIntermediatePatches[index].rootNormal; + mIntermediatePatches[rootIndex].maxPenetration = mIntermediatePatches[numPatches].maxPenetration = PxMin(mIntermediatePatches[rootIndex].maxPenetration, mOriginalContacts[m].separation); + mIntermediatePatches[numPatches].rootIndex = rootIndex; + mIntermediatePatches[numPatches].index = numPatches; + } + ++numPatches; + } + } + mIntermediatePatches[numPatches-1].stride = PxU16(m - mIntermediatePatches[numPatches-1].startIndex); + + //OK, we have a list of contact patches so that we can start contact reduction per-patch + + //OK, now we can go and reduce the contacts on a per-patch basis... + + for(PxU32 a = 0; a < numPatches; ++a) + { + mIntermediatePatchesPtrs[a] = &mIntermediatePatches[a]; + } + + + SortBoundsPredicateManifold predicate; + PxSort(mIntermediatePatchesPtrs, numPatches, predicate); + + PxU32 numReducedPatches = 0; + for(PxU32 a = 0; a < numPatches; ++a) + { + if(mIntermediatePatchesPtrs[a]->rootIndex == mIntermediatePatchesPtrs[a]->index) + { + //Reduce this patch... + if(numReducedPatches == MaxPatches) + break; + + ReducedContactPatch& reducedPatch = mPatches[numReducedPatches++]; + //OK, now we need to work out if we have to reduce patches... + PxU32 contactCount = 0; + { + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + + while(tmpPatch) + { + contactCount += tmpPatch->stride; + tmpPatch = tmpPatch->mNextPatch; + } + } + + if(contactCount <= CONTACT_REDUCTION_MAX_CONTACTS) + { + //Just add the contacts... + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + + PxU32 ind = 0; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + reducedPatch.contactPoints[ind++] = tmpPatch->startIndex + b; + } + tmpPatch = tmpPatch->mNextPatch; + } + reducedPatch.numContactPoints = contactCount; + } + else + { + //Iterate through and find the most extreme point + + + PxU32 ind = 0; + + { + PxReal dist = 0.f; + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + PxReal magSq = mOriginalContacts[tmpPatch->startIndex + b].point.magnitudeSquared(); + if(dist < magSq) + { + ind = tmpPatch->startIndex + b; + dist = magSq; + } + } + tmpPatch = tmpPatch->mNextPatch; + } + } + reducedPatch.contactPoints[0] = ind; + const PxVec3 p0 = mOriginalContacts[ind].point; + + //Now find the point farthest from this point... + { + PxReal maxDist = 0.f; + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + PxReal magSq = (p0 - mOriginalContacts[tmpPatch->startIndex + b].point).magnitudeSquared(); + if(magSq > maxDist) + { + ind = tmpPatch->startIndex + b; + maxDist = magSq; + } + } + tmpPatch = tmpPatch->mNextPatch; + } + } + reducedPatch.contactPoints[1] = ind; + const PxVec3 p1 = mOriginalContacts[ind].point; + + //Now find the point farthest from the segment + + PxVec3 n = (p0 - p1).cross(mIntermediatePatchesPtrs[a]->rootNormal); + + //PxReal tVal = 0.f; + { + PxReal maxDist = 0.f; + //PxReal tmpTVal; + + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + + //PxReal magSq = tmpDistancePointSegmentSquared(p0, p1, mOriginalContacts[tmpPatch->startIndex + b].point, tmpTVal); + PxReal magSq = (mOriginalContacts[tmpPatch->startIndex + b].point - p0).dot(n); + if(magSq > maxDist) + { + ind = tmpPatch->startIndex + b; + //tVal = tmpTVal; + maxDist = magSq; + } + } + tmpPatch = tmpPatch->mNextPatch; + } + } + reducedPatch.contactPoints[2] = ind; + + //const PxVec3 closest = (p0 + (p1 - p0) * tVal); + + const PxVec3 dir = -n;//closest - p3; + + { + PxReal maxDist = 0.f; + //PxReal tVal = 0.f; + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + PxReal magSq = (mOriginalContacts[tmpPatch->startIndex + b].point - p0).dot(dir); + if(magSq > maxDist) + { + ind = tmpPatch->startIndex + b; + maxDist = magSq; + } + } + tmpPatch = tmpPatch->mNextPatch; + } + } + reducedPatch.contactPoints[3] = ind; + + //Now, we iterate through all the points, and cluster the points. From this, we establish the deepest point that's within a + //tolerance of this point and keep that point + + PxReal separation[CONTACT_REDUCTION_MAX_CONTACTS]; + PxU32 deepestInd[CONTACT_REDUCTION_MAX_CONTACTS]; + for(PxU32 i = 0; i < 4; ++i) + { + PxU32 index = reducedPatch.contactPoints[i]; + separation[i] = mOriginalContacts[index].separation - PXS_SEPARATION_TOLERANCE; + deepestInd[i] = index; + } + + ContactPatch* tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + PxContactPoint& point = mOriginalContacts[tmpPatch->startIndex + b]; + + PxReal distance = PX_MAX_REAL; + PxU32 index = 0; + for(PxU32 c = 0; c < 4; ++c) + { + PxVec3 dif = mOriginalContacts[reducedPatch.contactPoints[c]].point - point.point; + PxReal d = dif.magnitudeSquared(); + if(distance > d) + { + distance = d; + index = c; + } + } + if(separation[index] > point.separation) + { + deepestInd[index] = tmpPatch->startIndex+b; + separation[index] = point.separation; + } + + } + tmpPatch = tmpPatch->mNextPatch; + } + + bool chosen[64]; + PxMemZero(chosen, sizeof(chosen)); + for(PxU32 i = 0; i < 4; ++i) + { + reducedPatch.contactPoints[i] = deepestInd[i]; + chosen[deepestInd[i]] = true; + } + + for(PxU32 i = 4; i < CONTACT_REDUCTION_MAX_CONTACTS; ++i) + { + separation[i] = PX_MAX_REAL; + deepestInd[i] = 0; + } + tmpPatch = mIntermediatePatchesPtrs[a]; + while(tmpPatch) + { + for(PxU32 b = 0; b < tmpPatch->stride; ++b) + { + if(!chosen[tmpPatch->startIndex+b]) + { + PxContactPoint& point = mOriginalContacts[tmpPatch->startIndex + b]; + for(PxU32 j = 4; j < CONTACT_REDUCTION_MAX_CONTACTS; ++j) + { + if(point.separation < separation[j]) + { + for(PxU32 k = CONTACT_REDUCTION_MAX_CONTACTS-1; k > j; --k) + { + separation[k] = separation[k-1]; + deepestInd[k] = deepestInd[k-1]; + } + separation[j] = point.separation; + deepestInd[j] = tmpPatch->startIndex+b; + break; + } + } + } + } + tmpPatch = tmpPatch->mNextPatch; + } + + for(PxU32 i = 4; i < CONTACT_REDUCTION_MAX_CONTACTS; ++i) + { + reducedPatch.contactPoints[i] = deepestInd[i]; + } + + reducedPatch.numContactPoints = CONTACT_REDUCTION_MAX_CONTACTS; + } + } + } + mNumPatches = numReducedPatches; + } + + }; +} + +} + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyCorrelationBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyCorrelationBuffer.h new file mode 100644 index 0000000..8b61ceb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyCorrelationBuffer.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_CORRELATION_BUFFER_H +#define DY_CORRELATION_BUFFER_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "geomutils/PxContactBuffer.h" + +#include "PxvConfig.h" +#include "DyFrictionPatch.h" + +namespace physx +{ + +struct PxcNpWorkUnit; +struct PxsMaterialInfo; + +namespace Dy +{ + +struct CorrelationBuffer +{ + static const PxU32 MAX_FRICTION_PATCHES = 32; + static const PxU16 LIST_END = 0xffff; + + struct ContactPatchData + { + PxU16 start; + PxU16 next; + PxU8 flags; + PxU8 count; + PxReal staticFriction, dynamicFriction, restitution; + PxBounds3 patchBounds; + }; + + // we can have as many contact patches as contacts, unfortunately + ContactPatchData contactPatches[PxContactBuffer::MAX_CONTACTS]; + + FrictionPatch PX_ALIGN(16, frictionPatches[MAX_FRICTION_PATCHES]); + PxVec3 PX_ALIGN(16, frictionPatchWorldNormal[MAX_FRICTION_PATCHES]); + PxBounds3 patchBounds[MAX_FRICTION_PATCHES]; + + PxU32 frictionPatchContactCounts[MAX_FRICTION_PATCHES]; + PxU32 correlationListHeads[MAX_FRICTION_PATCHES+1]; + + // contact IDs are only used to identify auxiliary contact data when velocity + // targets have been set. + PxU16 contactID[MAX_FRICTION_PATCHES][2]; + + PxU32 contactPatchCount, frictionPatchCount; + +}; + +bool createContactPatches(CorrelationBuffer& fb, const PxContactPoint* cb, PxU32 contactCount, PxReal normalTolerance); + +bool correlatePatches(CorrelationBuffer& fb, + const PxContactPoint* cb, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxReal normalTolerance, + PxU32 startContactPatchIndex, + PxU32 startFrictionPatchIndex); + +void growPatches(CorrelationBuffer& fb, + const PxContactPoint* buffer, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU32 frictionPatchStartIndex, + PxReal frictionOffsetThreshold); + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp new file mode 100644 index 0000000..34515c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.cpp @@ -0,0 +1,3102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxTime.h" +#include "foundation/PxAtomic.h" +#include "PxvDynamics.h" + +#include "common/PxProfileZone.h" +#include "PxsRigidBody.h" +#include "PxsContactManager.h" +#include "DyDynamics.h" +#include "DyBodyCoreIntegrator.h" +#include "DySolverCore.h" +#include "DySolverControl.h" +#include "DySolverContact.h" +#include "DySolverContactPF.h" +#include "DyArticulationContactPrep.h" +#include "DySolverBody.h" + +#include "DyConstraintPrep.h" +#include "DyConstraintPartition.h" +#include "DySoftBody.h" + +#include "CmFlushPool.h" +#include "DyArticulationPImpl.h" +#include "DyFeatherstoneArticulation.h" +#include "PxsMaterialManager.h" +#include "DySolverContactPF4.h" +#include "DyContactReduction.h" +#include "PxcNpContactPrepShared.h" +#include "DyContactPrep.h" +#include "DySolverControlPF.h" +#include "PxSceneDesc.h" +#include "PxsSimpleIslandManager.h" +#include "PxvNphaseImplementationContext.h" +#include "PxvSimStats.h" +#include "PxsContactManagerState.h" +#include "DyContactPrepShared.h" + +//KS - used to turn on/off batched SIMD constraints. +#define DY_BATCH_CONSTRAINTS 1 +//KS - used to specifically turn on/off batches 1D SIMD constraints. +#define DY_BATCH_1D 1 + +namespace physx +{ +namespace Dy +{ + +struct SolverIslandObjects +{ + PxsRigidBody** bodies; + FeatherstoneArticulation** articulations; + PxsIndexedContactManager* contactManagers; + //PxsIndexedConstraint* constraints; + + const IG::IslandId* islandIds; + PxU32 numIslands; + PxU32* bodyRemapTable; + PxU32* nodeIndexArray; + + PxSolverConstraintDesc* constraintDescs; + PxSolverConstraintDesc* orderedConstraintDescs; + PxSolverConstraintDesc* tempConstraintDescs; + PxConstraintBatchHeader* constraintBatchHeaders; + Cm::SpatialVector* motionVelocities; + PxsBodyCore** bodyCoreArray; + + SolverIslandObjects() : bodies(NULL), articulations(NULL), + contactManagers(NULL), islandIds(NULL), numIslands(0), nodeIndexArray(NULL), constraintDescs(NULL), orderedConstraintDescs(NULL), + tempConstraintDescs(NULL), constraintBatchHeaders(NULL), motionVelocities(NULL), bodyCoreArray(NULL) + { + } +}; + +Context* createDynamicsContext( PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, Cm::FlushPool& taskPool, + PxvSimStats& simStats, PxTaskManager* taskManager, PxVirtualAllocatorCallback* allocatorCallback, + PxsMaterialManager* materialManager, IG::SimpleIslandManager* islandManager, PxU64 contextID, + const bool enableStabilization, const bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, const bool frictionEveryIteration, const PxReal lengthScale + ) +{ + return DynamicsContext::create(memBlockPool, scratchAllocator, taskPool, simStats, taskManager, allocatorCallback, materialManager, islandManager, + contextID, enableStabilization, useEnhancedDeterminism, maxBiasCoefficient, frictionEveryIteration, lengthScale); +} + +// PT: TODO: consider removing this function. We already have "createDynamicsContext". +DynamicsContext* DynamicsContext::create( PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocatorCallback, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, + const bool frictionEveryIteration, + const PxReal lengthScale + ) +{ + // PT: TODO: inherit from UserAllocated, remove placement new + DynamicsContext* dc = reinterpret_cast(PX_ALLOC(sizeof(DynamicsContext), "DynamicsContext")); + if(dc) + { + PX_PLACEMENT_NEW(dc, DynamicsContext(memBlockPool, scratchAllocator, taskPool, simStats, taskManager, allocatorCallback, materialManager, islandManager, contextID, + enableStabilization, useEnhancedDeterminism, maxBiasCoefficient, frictionEveryIteration, lengthScale)); + } + return dc; +} + +void DynamicsContext::destroy() +{ + this->~DynamicsContext(); + PX_FREE_THIS; +} + +void DynamicsContext::resetThreadContexts() +{ + PxcThreadCoherentCacheIterator threadContextIt(mThreadContextPool); + ThreadContext* threadContext = threadContextIt.getNext(); + + while(threadContext != NULL) + { + threadContext->reset(); + threadContext = threadContextIt.getNext(); + } +} + + +// =========================== Basic methods + + +DynamicsContext::DynamicsContext( PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocatorCallback, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, + const bool frictionEveryIteration, + const PxReal lengthScale + ) : + Dy::Context (islandManager, allocatorCallback, simStats, enableStabilization, useEnhancedDeterminism, maxBiasCoefficient, lengthScale), + mThreadContextPool (memBlockPool), + mMaterialManager (materialManager), + mScratchAllocator (scratchAllocator), + mTaskPool (taskPool), + mTaskManager (taskManager), + mContextID (contextID) +{ + createThresholdStream(*allocatorCallback); + createForceChangeThresholdStream(*allocatorCallback); + mExceededForceThresholdStream[0] = PX_NEW(ThresholdStream)(*allocatorCallback); + mExceededForceThresholdStream[1] = PX_NEW(ThresholdStream)(*allocatorCallback); + mThresholdStreamOut = 0; + mCurrentIndex = 0; + mWorldSolverBody.linearVelocity = PxVec3(0); + mWorldSolverBody.angularState = PxVec3(0); + mWorldSolverBodyData.invMass = 0; + mWorldSolverBodyData.sqrtInvInertia = PxMat33(PxZero); + mWorldSolverBodyData.nodeIndex = PX_INVALID_NODE; + mWorldSolverBodyData.reportThreshold = PX_MAX_REAL; + mWorldSolverBodyData.penBiasClamp = -PX_MAX_REAL; + mWorldSolverBodyData.maxContactImpulse = PX_MAX_REAL; + mWorldSolverBody.solverProgress=MAX_PERMITTED_SOLVER_PROGRESS; + mWorldSolverBody.maxSolverNormalProgress=MAX_PERMITTED_SOLVER_PROGRESS; + mWorldSolverBody.maxSolverFrictionProgress=MAX_PERMITTED_SOLVER_PROGRESS; + mWorldSolverBodyData.linearVelocity = mWorldSolverBodyData.angularVelocity = PxVec3(0.f); + mWorldSolverBodyData.body2World = PxTransform(PxIdentity); + mSolverCore[PxFrictionType::ePATCH] = SolverCoreGeneral::create(frictionEveryIteration); + mSolverCore[PxFrictionType::eONE_DIRECTIONAL] = SolverCoreGeneralPF::create(); + mSolverCore[PxFrictionType::eTWO_DIRECTIONAL] = SolverCoreGeneralPF::create(); +} + +DynamicsContext::~DynamicsContext() +{ + for(PxU32 i = 0; i < PxFrictionType::eFRICTION_COUNT; ++i) + { + mSolverCore[i]->destroyV(); + } + + PX_DELETE(mExceededForceThresholdStream[1]); + PX_DELETE(mExceededForceThresholdStream[0]); +} + +#if PX_ENABLE_SIM_STATS +void DynamicsContext::addThreadStats(const ThreadContext::ThreadSimStats& stats) +{ + mSimStats.mNbActiveConstraints += stats.numActiveConstraints; + mSimStats.mNbActiveDynamicBodies += stats.numActiveDynamicBodies; + mSimStats.mNbActiveKinematicBodies += stats.numActiveKinematicBodies; + mSimStats.mNbAxisSolverConstraints += stats.numAxisSolverConstraints; +} +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + +// =========================== Solve methods! + +void DynamicsContext::setDescFromIndices(PxSolverConstraintDesc& desc, const IG::IslandSim& islandSim, const PxsIndexedInteraction& constraint, const PxU32 solverBodyOffset) +{ + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eBODY == 0); + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eKINEMATIC == 1); + const PxU32 offsetMap[] = {solverBodyOffset, 0}; + //const PxU32 offsetMap[] = {mKinematicCount, 0}; + + if(constraint.indexType0 == PxsIndexedInteraction::eARTICULATION) + { + const PxNodeIndex& nodeIndex0 = reinterpret_cast(constraint.articulation0); + const IG::Node& node0 = islandSim.getNode(nodeIndex0); + desc.articulationA = node0.getArticulation(); + desc.linkIndexA = nodeIndex0.articulationLinkId(); + } + else + { + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + //desc.articulationALength = 0; //this is unioned with bodyADataIndex + /*desc.bodyA = constraint.indexType0 == PxsIndexedInteraction::eWORLD ? &mWorldSolverBody + : &mSolverBodyPool[(PxU32)constraint.solverBody0 + offsetMap[constraint.indexType0]]; + desc.bodyADataIndex = PxU16(constraint.indexType0 == PxsIndexedInteraction::eWORLD ? 0 + : (PxU16)constraint.solverBody0 + 1 + offsetMap[constraint.indexType0]);*/ + + desc.bodyA = constraint.indexType0 == PxsIndexedInteraction::eWORLD ? &mWorldSolverBody + : &mSolverBodyPool[PxU32(constraint.solverBody0) + offsetMap[constraint.indexType0]]; + desc.bodyADataIndex = constraint.indexType0 == PxsIndexedInteraction::eWORLD ? 0 + : PxU32(constraint.solverBody0) + 1 + offsetMap[constraint.indexType0]; + } + + if(constraint.indexType1 == PxsIndexedInteraction::eARTICULATION) + { + const PxNodeIndex& nodeIndex1 = reinterpret_cast(constraint.articulation1); + const IG::Node& node1 = islandSim.getNode(nodeIndex1); + desc.articulationB = node1.getArticulation(); + desc.linkIndexB = nodeIndex1.articulationLinkId();// PxTo8(getLinkIndex(constraint.articulation1)); + } + else + { + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + //desc.articulationBLength = 0; //this is unioned with bodyBDataIndex + desc.bodyB = constraint.indexType1 == PxsIndexedInteraction::eWORLD ? &mWorldSolverBody + : &mSolverBodyPool[PxU32(constraint.solverBody1) + offsetMap[constraint.indexType1]]; + desc.bodyBDataIndex = constraint.indexType1 == PxsIndexedInteraction::eWORLD ? 0 + : PxU32(constraint.solverBody1) + 1 + offsetMap[constraint.indexType1]; + } +} + +void DynamicsContext::setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeIndex edgeIndex, const IG::SimpleIslandManager& islandManager, + PxU32* bodyRemap, const PxU32 solverBodyOffset) +{ + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eBODY == 0); + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eKINEMATIC == 1); + + const IG::IslandSim& islandSim = islandManager.getAccurateIslandSim(); + + PxNodeIndex node1 = islandSim.getNodeIndex1(edgeIndex); + if (node1.isStaticBody()) + { + desc.bodyA = &mWorldSolverBody; + desc.bodyADataIndex = 0; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + else + { + const IG::Node& node = islandSim.getNode(node1); + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + Dy::FeatherstoneArticulation* a = islandSim.getLLArticulation(node1); + + PxU8 type; + + a->fillIndexType(node1.articulationLinkId(), type); + + if (type == PxsIndexedInteraction::eARTICULATION) + { + desc.articulationA = a; + desc.linkIndexA =node1.articulationLinkId(); + } + else + { + desc.bodyA = &mWorldSolverBody; + desc.bodyADataIndex = 0; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + } + else + { + PxU32 activeIndex = islandSim.getActiveNodeIndex(node1); + PxU32 index = node.isKinematic() ? activeIndex : bodyRemap[activeIndex] + solverBodyOffset; + desc.bodyA = &mSolverBodyPool[index]; + desc.bodyADataIndex = index + 1; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + } + + PxNodeIndex node2 = islandSim.getNodeIndex2(edgeIndex); + if (node2.isStaticBody()) + { + desc.bodyB = &mWorldSolverBody; + desc.bodyBDataIndex = 0; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + else + { + const IG::Node& node = islandSim.getNode(node2); + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + Dy::FeatherstoneArticulation* b = islandSim.getLLArticulation(node2); + PxU8 type; + + b->fillIndexType(node2.articulationLinkId(), type); + + if (type == PxsIndexedInteraction::eARTICULATION) + { + desc.articulationB = b; + desc.linkIndexB = node2.articulationLinkId(); + } + else + { + desc.bodyB = &mWorldSolverBody; + desc.bodyBDataIndex = 0; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + } + else + { + PxU32 activeIndex = islandSim.getActiveNodeIndex(node2); + PxU32 index = node.isKinematic() ? activeIndex : bodyRemap[activeIndex] + solverBodyOffset; + desc.bodyB = &mSolverBodyPool[index]; + desc.bodyBDataIndex = index + 1; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + } +} + +class PxsPreIntegrateTask : public Cm::Task +{ + PxsPreIntegrateTask& operator=(const PxsPreIntegrateTask&); +public: + PxsPreIntegrateTask( DynamicsContext& context, + PxsBodyCore*const* bodyArray, + PxsRigidBody*const* originalBodyArray, + PxU32 const* nodeIndexArray, + PxSolverBody* solverBodies, + PxSolverBodyData* solverBodyDataPool, + PxF32 dt, + PxU32 numBodies, + volatile PxU32* maxSolverPositionIterations, + volatile PxU32* maxSolverVelocityIterations, + const PxU32 startIndex, + const PxU32 numToIntegrate, + const PxVec3& gravity) : + Cm::Task (context.getContextId()), + mContext (context), + mBodyArray (bodyArray), + mOriginalBodyArray (originalBodyArray), + mNodeIndexArray (nodeIndexArray), + mSolverBodies (solverBodies), + mSolverBodyDataPool (solverBodyDataPool), + mDt (dt), + mNumBodies (numBodies), + mMaxSolverPositionIterations(maxSolverPositionIterations), + mMaxSolverVelocityIterations(maxSolverVelocityIterations), + mStartIndex (startIndex), + mNumToIntegrate (numToIntegrate), + mGravity (gravity) + {} + + virtual void runInternal(); + + virtual const char* getName() const + { + return "PxsDynamics.preIntegrate"; + } + +public: + DynamicsContext& mContext; + PxsBodyCore*const* mBodyArray; + PxsRigidBody*const* mOriginalBodyArray; + PxU32 const* mNodeIndexArray; + PxSolverBody* mSolverBodies; + PxSolverBodyData* mSolverBodyDataPool; + PxF32 mDt; + PxU32 mNumBodies; + volatile PxU32* mMaxSolverPositionIterations; + volatile PxU32* mMaxSolverVelocityIterations; + PxU32 mStartIndex; + PxU32 mNumToIntegrate; + PxVec3 mGravity; +}; + + + +class PxsParallelSolverTask : public Cm::Task +{ + PxsParallelSolverTask& operator=(PxsParallelSolverTask&); +public: + + PxsParallelSolverTask(SolverIslandParams& params, DynamicsContext& context, PxFrictionType::Enum frictionType, IG::IslandSim& islandSim) + : Cm::Task(context.getContextId()), mParams(params), mContext(context), mFrictionType(frictionType), mIslandSim(islandSim) + { + } + + virtual void runInternal() + { + solveParallel(mContext, mParams, mIslandSim); + } + + virtual const char* getName() const + { + return "PxsDynamics.parallelSolver"; + } + + SolverIslandParams& mParams; + DynamicsContext& mContext; + PxFrictionType::Enum mFrictionType; + IG::IslandSim& mIslandSim; +}; + +#define PX_CONTACT_REDUCTION 1 + +class PxsSolverConstraintPostProcessTask : public Cm::Task +{ + PxsSolverConstraintPostProcessTask& operator=(const PxsSolverConstraintPostProcessTask&); +public: + + PxsSolverConstraintPostProcessTask(DynamicsContext& context, + ThreadContext& threadContext, + const SolverIslandObjects& objects, + const PxU32 solverBodyOffset, + PxU32 startIndex, + PxU32 stride, + PxsMaterialManager* materialManager, + PxsContactManagerOutputIterator& iterator) : + Cm::Task (context.getContextId()), + mContext (context), + mThreadContext (threadContext), + mObjects (objects), + mSolverBodyOffset (solverBodyOffset), + mStartIndex (startIndex), + mStride (stride), + mMaterialManager (materialManager), + mOutputs (iterator) + {} + + void mergeContacts(CompoundContactManager& header, ThreadContext& threadContext) + { + PxContactBuffer& buffer = threadContext.mContactBuffer; + PxsMaterialInfo materialInfo[PxContactBuffer::MAX_CONTACTS]; + PxU32 size = 0; + + for(PxU32 a = 0; a < header.mStride; ++a) + { + PxsContactManager* manager = mThreadContext.orderedContactList[a+header.mStartIndex]->contactManager; + PxcNpWorkUnit& unit = manager->getWorkUnit(); + PxsContactManagerOutput& output = mOutputs.getContactManager(unit.mNpIndex); + PxContactStreamIterator iter(output.contactPatches, output.contactPoints, output.getInternalFaceIndice(), output.nbPatches, output.nbContacts); + + PxU32 origSize = size; + PX_UNUSED(origSize); + if(!iter.forceNoResponse) + { + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + PX_ASSERT(size < PxContactBuffer::MAX_CONTACTS); + iter.nextContact(); + PxsMaterialInfo& info = materialInfo[size]; + PxContactPoint& point = buffer.contacts[size++]; + point.dynamicFriction = iter.getDynamicFriction(); + point.staticFriction = iter.getStaticFriction(); + point.restitution = iter.getRestitution(); + point.internalFaceIndex1 = iter.getFaceIndex1(); + point.materialFlags = PxU8(iter.getMaterialFlags()); + point.maxImpulse = iter.getMaxImpulse(); + point.targetVel = iter.getTargetVel(); + point.normal = iter.getContactNormal(); + point.point = iter.getContactPoint(); + point.separation = iter.getSeparation(); + info.mMaterialIndex0 = iter.getMaterialIndex0(); + info.mMaterialIndex1 = iter.getMaterialIndex1(); + } + } + PX_ASSERT(output.nbContacts == (size - origSize)); + } + } + + PxU32 origSize = size; +#if PX_CONTACT_REDUCTION + ContactReduction<6> reduction(buffer.contacts, materialInfo, size); + reduction.reduceContacts(); + //OK, now we write back the contacts... + + PxU8 histo[PxContactBuffer::MAX_CONTACTS]; + PxMemZero(histo, sizeof(histo)); + + size = 0; + for(PxU32 a = 0; a < reduction.mNumPatches; ++a) + { + ReducedContactPatch& patch = reduction.mPatches[a]; + for(PxU32 b = 0; b < patch.numContactPoints; ++b) + { + histo[patch.contactPoints[b]] = 1; + ++size; + } + } +#endif + + PxU16* PX_RESTRICT data = reinterpret_cast(threadContext.mConstraintBlockStream.reserve(size * sizeof(PxU16), mThreadContext.mConstraintBlockManager)); + header.forceBufferList = data; + +#if PX_CONTACT_REDUCTION + const PxU32 reservedSize = size; + PX_UNUSED(reservedSize); + size = 0; + for(PxU32 a = 0; a < origSize; ++a) + { + if(histo[a]) + { + if(size != a) + { + buffer.contacts[size] = buffer.contacts[a]; + materialInfo[size] = materialInfo[a]; + } + data[size] = PxTo16(a); + size++; + } + } + PX_ASSERT(reservedSize >= size); +#else + for(PxU32 a = 0; a < size; ++a) + data[a] = a; +#endif + + PxU32 contactForceByteSize = size * sizeof(PxReal); + + PxsContactManagerOutput& output = mOutputs.getContactManager(header.unit->mNpIndex); + + PxU16 compressedContactSize; + + physx::writeCompressedContact(buffer.contacts, size, NULL, output.nbContacts, output.contactPatches, output.contactPoints, compressedContactSize, + reinterpret_cast(output.contactForces), contactForceByteSize, mMaterialManager, false, + false, materialInfo, output.nbPatches, 0, &mThreadContext.mConstraintBlockManager, &threadContext.mConstraintBlockStream, false); + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("ConstraintPostProcess", mContext.getContextId()); + PxU32 endIndex = mStartIndex + mStride; + + ThreadContext* threadContext = mContext.getThreadContext(); + //TODO - we need to do this somewhere else + //threadContext->mContactBlockStream.reset(); + threadContext->mConstraintBlockStream.reset(); + + for(PxU32 a = mStartIndex; a < endIndex; ++a) + { + mergeContacts(mThreadContext.compoundConstraints[a], *threadContext); + } + mContext.putThreadContext(threadContext); + } + + virtual const char* getName() const { return "PxsDynamics.solverConstraintPostProcess"; } + + DynamicsContext& mContext; + ThreadContext& mThreadContext; + const SolverIslandObjects mObjects; + PxU32 mSolverBodyOffset; + PxU32 mStartIndex; + PxU32 mStride; + PxsMaterialManager* mMaterialManager; + PxsContactManagerOutputIterator& mOutputs; +}; + +class PxsForceThresholdTask : public Cm::Task +{ + DynamicsContext& mDynamicsContext; + + PxsForceThresholdTask& operator=(const PxsForceThresholdTask&); +public: + + PxsForceThresholdTask(DynamicsContext& context): Cm::Task(context.getContextId()), mDynamicsContext(context) + { + } + + void createForceChangeThresholdStream() + { + ThresholdStream& thresholdStream = mDynamicsContext.getThresholdStream(); + //bool haveThresholding = thresholdStream.size()!=0; + + ThresholdTable& thresholdTable = mDynamicsContext.getThresholdTable(); + thresholdTable.build(thresholdStream); + + //generate current force exceeded threshold stream + ThresholdStream& curExceededForceThresholdStream = *mDynamicsContext.mExceededForceThresholdStream[mDynamicsContext.mCurrentIndex]; + ThresholdStream& preExceededForceThresholdStream = *mDynamicsContext.mExceededForceThresholdStream[1 - mDynamicsContext.mCurrentIndex]; + curExceededForceThresholdStream.forceSize_Unsafe(0); + + //fill in the currrent exceeded force threshold stream + for(PxU32 i=0; i elem.threshold * mDynamicsContext.mDt) + { + elem.accumulatedForce = pair.accumulatedForce; + curExceededForceThresholdStream.pushBack(elem); + } + } + + ThresholdStream& forceChangeThresholdStream = mDynamicsContext.getForceChangedThresholdStream(); + forceChangeThresholdStream.forceSize_Unsafe(0); + PxArray& forceChangeMask = mDynamicsContext.mExceededForceThresholdStreamMask; + + const PxU32 nbPreExceededForce = preExceededForceThresholdStream.size(); + const PxU32 nbCurExceededForce = curExceededForceThresholdStream.size(); + + //generate force change thresholdStream + if(nbPreExceededForce) + { + thresholdTable.build(preExceededForceThresholdStream); + + //set force change mask + const PxU32 nbTotalExceededForce = nbPreExceededForce + nbCurExceededForce; + forceChangeMask.reserve(nbTotalExceededForce); + forceChangeMask.forceSize_Unsafe(nbTotalExceededForce); + + //initialize the forceChangeMask + for (PxU32 i = 0; i < nbTotalExceededForce; ++i) + forceChangeMask[i] = 1; + + for(PxU32 i=0; i< nbCurExceededForce; ++i) + { + ThresholdStreamElement& curElem = curExceededForceThresholdStream[i]; + + PxU32 pos; + if(thresholdTable.check(preExceededForceThresholdStream, curElem, pos)) + { + forceChangeMask[pos] = 0; + forceChangeMask[i + nbPreExceededForce] = 0; + } + } + + //create force change threshold stream + for(PxU32 i=0; i(left.constraint)->index > reinterpret_cast(right.constraint)->index; + } +}; + +struct ArticulationSortPredicate +{ + bool operator()(const PxsIndexedContactManager*& left, const PxsIndexedContactManager*& right) const + { + return left->contactManager->getWorkUnit().index < right->contactManager->getWorkUnit().index; + } +}; + +class SolverArticulationUpdateTask : public Cm::Task +{ + ThreadContext& mIslandThreadContext; + + FeatherstoneArticulation** mArticulations; + ArticulationSolverDesc* mArticulationDescArray; + PxU32 mNbToProcess; + + Dy::DynamicsContext& mContext; + + +public: + + static const PxU32 NbArticulationsPerTask = 32; + + SolverArticulationUpdateTask(ThreadContext& islandThreadContext, FeatherstoneArticulation** articulations, ArticulationSolverDesc* articulationDescArray, PxU32 nbToProcess, Dy::DynamicsContext& context) : + Cm::Task(context.getContextId()), mIslandThreadContext(islandThreadContext), mArticulations(articulations), mArticulationDescArray(articulationDescArray), mNbToProcess(nbToProcess), mContext(context) + { + } + + virtual const char* getName() const { return "SolverArticulationUpdateTask"; } + + virtual void runInternal() + { + ThreadContext& threadContext = *mContext.getThreadContext(); + + threadContext.mConstraintBlockStream.reset(); //Clear in case there's some left-over memory in this context, for which the block has already been freed + PxU32 maxVelIters = 0; + PxU32 maxPosIters = 0; + PxU32 maxLinks = 0; + + for (PxU32 i = 0; i < mNbToProcess; i++) + { + FeatherstoneArticulation& a = *(mArticulations[i]); + a.getSolverDesc(mArticulationDescArray[i]); + + maxLinks = PxMax(maxLinks, PxU32(mArticulationDescArray[i].linkCount)); + } + + threadContext.mZVector.forceSize_Unsafe(0); + threadContext.mZVector.reserve(maxLinks); + threadContext.mZVector.forceSize_Unsafe(maxLinks); + + threadContext.mDeltaV.forceSize_Unsafe(0); + threadContext.mDeltaV.reserve(maxLinks); + threadContext.mDeltaV.forceSize_Unsafe(maxLinks); + + BlockAllocator blockAllocator(mIslandThreadContext.mConstraintBlockManager, threadContext.mConstraintBlockStream, threadContext.mFrictionPatchStreamPair, threadContext.mConstraintSize); + + const PxReal invLengthScale = 1.f/mContext.getLengthScale(); + + for(PxU32 i=0;i(PxU32(iterWord >> 8), maxVelIters); + maxPosIters = PxMax(PxU32(iterWord & 0xff), maxPosIters); + } + + PxAtomicMax(reinterpret_cast(&mIslandThreadContext.mMaxSolverPositionIterations), PxI32(maxPosIters)); + PxAtomicMax(reinterpret_cast(&mIslandThreadContext.mMaxSolverVelocityIterations), PxI32(maxVelIters)); + PxAtomicMax(reinterpret_cast(&mIslandThreadContext.mMaxArticulationLinks), PxI32(maxLinks)); + + mContext.putThreadContext(&threadContext); + } + +private: + PX_NOCOPY(SolverArticulationUpdateTask) +}; + +struct EnhancedSortPredicate +{ + bool operator()(const PxsIndexedContactManager& left, const PxsIndexedContactManager& right) const + { + PxcNpWorkUnit& unit0 = left.contactManager->getWorkUnit(); + PxcNpWorkUnit& unit1 = right.contactManager->getWorkUnit(); + return (unit0.mTransformCache0 < unit1.mTransformCache0) || + ((unit0.mTransformCache0 == unit1.mTransformCache0) && (unit0.mTransformCache1 < unit1.mTransformCache1)); + } +}; + +class PxsSolverStartTask : public Cm::Task +{ + PxsSolverStartTask& operator=(const PxsSolverStartTask&); +public: + + PxsSolverStartTask(DynamicsContext& context, + IslandContext& islandContext, + const SolverIslandObjects& objects, + const PxU32 solverBodyOffset, + const PxU32 kinematicCount, + IG::SimpleIslandManager& islandManager, + PxU32* bodyRemapTable, + PxsMaterialManager* materialManager, + PxsContactManagerOutputIterator& iterator, + bool enhancedDeterminism + ) : + Cm::Task (context.getContextId()), + mContext (context), + mIslandContext (islandContext), + mObjects (objects), + mSolverBodyOffset (solverBodyOffset), + mKinematicCount (kinematicCount), + mIslandManager (islandManager), + mBodyRemapTable (bodyRemapTable), + mMaterialManager (materialManager), + mOutputs (iterator), + mEnhancedDeterminism (enhancedDeterminism) + {} + + void startTasks() + { + PX_PROFILE_ZONE("Dynamics.solveGroup", mContext.getContextId()); + { + ThreadContext& mThreadContext = *mContext.getThreadContext(); + + mIslandContext.mThreadContext = &mThreadContext; + + mThreadContext.mMaxSolverPositionIterations = 0; + mThreadContext.mMaxSolverVelocityIterations = 0; + mThreadContext.mAxisConstraintCount = 0; + mThreadContext.mContactDescPtr = mThreadContext.contactConstraintDescArray; + mThreadContext.mFrictionDescPtr = mThreadContext.frictionConstraintDescArray.begin(); + mThreadContext.mNumDifferentBodyConstraints = 0; + mThreadContext.mNumStaticConstraints = 0; + mThreadContext.mNumSelfConstraints = 0; + mThreadContext.mNumDifferentBodyFrictionConstraints = 0; + mThreadContext.mNumSelfConstraintFrictionBlocks = 0; + mThreadContext.mNumSelfFrictionConstraints = 0; + mThreadContext.numContactConstraintBatches = 0; + mThreadContext.contactDescArraySize = 0; + mThreadContext.mMaxArticulationLinks = 0; + + mThreadContext.contactConstraintDescArray = mObjects.constraintDescs; + mThreadContext.orderedContactConstraints = mObjects.orderedConstraintDescs; + mThreadContext.mContactDescPtr = mObjects.constraintDescs; + mThreadContext.tempConstraintDescArray = mObjects.tempConstraintDescs; + mThreadContext.contactConstraintBatchHeaders = mObjects.constraintBatchHeaders; + mThreadContext.motionVelocityArray = mObjects.motionVelocities; + mThreadContext.mBodyCoreArray = mObjects.bodyCoreArray; + mThreadContext.mRigidBodyArray = mObjects.bodies; + mThreadContext.mArticulationArray = mObjects.articulations; + mThreadContext.bodyRemapTable = mObjects.bodyRemapTable; + mThreadContext.mNodeIndexArray = mObjects.nodeIndexArray; + + const PxU32 frictionConstraintCount = mContext.getFrictionType() == PxFrictionType::ePATCH ? 0 : PxU32(mIslandContext.mCounts.contactManagers); + mThreadContext.resizeArrays(frictionConstraintCount, mIslandContext.mCounts.articulations); + + PxsBodyCore** PX_RESTRICT bodyArrayPtr = mThreadContext.mBodyCoreArray; + PxsRigidBody** PX_RESTRICT rigidBodyPtr = mThreadContext.mRigidBodyArray; + FeatherstoneArticulation** PX_RESTRICT articulationPtr = mThreadContext.mArticulationArray; + + PxU32* PX_RESTRICT bodyRemapTable = mThreadContext.bodyRemapTable; + PxU32* PX_RESTRICT nodeIndexArray = mThreadContext.mNodeIndexArray; + + PxU32 nbIslands = mObjects.numIslands; + const IG::IslandId* const islandIds = mObjects.islandIds; + + const IG::IslandSim& islandSim = mIslandManager.getAccurateIslandSim(); + + PxU32 bodyIndex = 0, articIndex = 0; + + for (PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + PxNodeIndex currentIndex = island.mRootNode; + + while (currentIndex.isValid()) + { + + const IG::Node& node = islandSim.getNode(currentIndex); + + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + articulationPtr[articIndex++] = node.getArticulation(); + } + else + { + PX_ASSERT(bodyIndex < (mIslandContext.mCounts.bodies + mContext.mKinematicCount + 1)); + nodeIndexArray[bodyIndex++] = currentIndex.index(); + } + + currentIndex = node.mNextNode; + } + } + + //Bodies can come in a slightly jumbled order from islandGen. It's deterministic if the scene is + //identical but can vary if there are additional bodies in the scene in a different island. + if (mEnhancedDeterminism) + { + PxSort(nodeIndexArray, bodyIndex); + } + + for (PxU32 a = 0; a < bodyIndex; ++a) + { + PxNodeIndex currentIndex(nodeIndexArray[a]); + const IG::Node& node = islandSim.getNode(currentIndex); + PxsRigidBody* rigid = node.getRigidBody(); + rigidBodyPtr[a] = rigid; + bodyArrayPtr[a] = &rigid->getCore(); + bodyRemapTable[islandSim.getActiveNodeIndex(currentIndex)] = a; + } + + PxsIndexedContactManager* indexedManagers = mObjects.contactManagers; + + PxU32 currentContactIndex = 0; + for(PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + IG::EdgeIndex contactEdgeIndex = island.mFirstEdge[IG::Edge::eCONTACT_MANAGER]; + + while(contactEdgeIndex != IG_INVALID_EDGE) + { + const IG::Edge& edge = islandSim.getEdge(contactEdgeIndex); + + PxsContactManager* contactManager = mIslandManager.getContactManager(contactEdgeIndex); + + if(contactManager) + { + const PxNodeIndex nodeIndex1 = islandSim.getNodeIndex1(contactEdgeIndex); + const PxNodeIndex nodeIndex2 = islandSim.getNodeIndex2(contactEdgeIndex); + + PxsIndexedContactManager& indexedManager = indexedManagers[currentContactIndex++]; + indexedManager.contactManager = contactManager; + + PX_ASSERT(!nodeIndex1.isStaticBody()); + { + + const IG::Node& node1 = islandSim.getNode(nodeIndex1); + + //Is it an articulation or not??? + if(node1.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + indexedManager.articulation0 = nodeIndex1.getInd(); + const PxU32 linkId = nodeIndex1.articulationLinkId(); + node1.getArticulation()->fillIndexType(linkId, indexedManager.indexType0); + } + else + { + if(node1.isKinematic()) + { + indexedManager.indexType0 = PxsIndexedInteraction::eKINEMATIC; + indexedManager.solverBody0 = islandSim.getActiveNodeIndex(nodeIndex1); + } + else + { + indexedManager.indexType0 = PxsIndexedInteraction::eBODY; + indexedManager.solverBody0 = bodyRemapTable[islandSim.getActiveNodeIndex(nodeIndex1)]; + } + PX_ASSERT(indexedManager.solverBody0 < (mIslandContext.mCounts.bodies + mContext.mKinematicCount + 1)); + } + + } + + if(nodeIndex2.isStaticBody()) + { + indexedManager.indexType1 = PxsIndexedInteraction::eWORLD; + } + else + { + const IG::Node& node2 = islandSim.getNode(nodeIndex2); + + //Is it an articulation or not??? + if(node2.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + indexedManager.articulation1 = nodeIndex2.getInd(); + const PxU32 linkId = nodeIndex2.articulationLinkId(); + node2.getArticulation()->fillIndexType(linkId, indexedManager.indexType1); + } + else + { + if(node2.isKinematic()) + { + indexedManager.indexType1 = PxsIndexedInteraction::eKINEMATIC; + indexedManager.solverBody1 = islandSim.getActiveNodeIndex(nodeIndex2); + } + else + { + indexedManager.indexType1 = PxsIndexedInteraction::eBODY; + indexedManager.solverBody1 = bodyRemapTable[islandSim.getActiveNodeIndex(nodeIndex2)]; + } + PX_ASSERT(indexedManager.solverBody1 < (mIslandContext.mCounts.bodies + mContext.mKinematicCount + 1)); + } + } + + } + contactEdgeIndex = edge.mNextIslandEdge; + } + } + + if (mEnhancedDeterminism) + { + PxSort(indexedManagers, currentContactIndex, EnhancedSortPredicate()); + } + + mIslandContext.mCounts.contactManagers = currentContactIndex; + } + } + + void integrate() + { + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + PxSolverBody* solverBodies = mContext.mSolverBodyPool.begin() + mSolverBodyOffset; + PxSolverBodyData* solverBodyData = mContext.mSolverBodyDataPool.begin() + mSolverBodyOffset; + + { + PX_PROFILE_ZONE("Dynamics.updateVelocities", mContext.getContextId()); + + mContext.preIntegrationParallel( + mContext.mDt, + mThreadContext.mBodyCoreArray, + mObjects.bodies, + mThreadContext.mNodeIndexArray, + mIslandContext.mCounts.bodies, + solverBodies, + solverBodyData, + mThreadContext.motionVelocityArray, + mThreadContext.mMaxSolverPositionIterations, + mThreadContext.mMaxSolverVelocityIterations, + *mCont + ); + } + } + + void articulationTask() + { + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + ArticulationSolverDesc* articulationDescArray = mThreadContext.getArticulations().begin(); + + for(PxU32 i=0;isetContinuation(mCont); + task->removeReference(); + } + } + + void setupDescTask() + { + PX_PROFILE_ZONE("SetupDescs", mContext.getContextId()); + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + PxSolverConstraintDesc* contactDescPtr = mThreadContext.mContactDescPtr; + + //PxU32 constraintCount = mCounts.constraints + mCounts.contactManagers; + + PxU32 nbIslands = mObjects.numIslands; + const IG::IslandId* const islandIds = mObjects.islandIds; + + const IG::IslandSim& islandSim = mIslandManager.getAccurateIslandSim(); + + for(PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + IG::EdgeIndex edgeId = island.mFirstEdge[IG::Edge::eCONSTRAINT]; + + while(edgeId != IG_INVALID_EDGE) + { + PxSolverConstraintDesc& desc = *contactDescPtr; + + const IG::Edge& edge = islandSim.getEdge(edgeId); + Dy::Constraint* constraint = mIslandManager.getConstraint(edgeId); + mContext.setDescFromIndices(desc, edgeId, mIslandManager, mBodyRemapTable, mSolverBodyOffset); + desc.constraint = reinterpret_cast(constraint); + desc.constraintLengthOver16 = DY_SC_TYPE_RB_1D; + contactDescPtr++; + edgeId = edge.mNextIslandEdge; + } + + } + +#if 1 + PxSort(mThreadContext.mContactDescPtr, PxU32(contactDescPtr - mThreadContext.mContactDescPtr), ConstraintLess()); +#endif + + mThreadContext.orderedContactList.forceSize_Unsafe(0); + mThreadContext.orderedContactList.reserve(mIslandContext.mCounts.contactManagers); + mThreadContext.orderedContactList.forceSize_Unsafe(mIslandContext.mCounts.contactManagers); + mThreadContext.tempContactList.forceSize_Unsafe(0); + mThreadContext.tempContactList.reserve(mIslandContext.mCounts.contactManagers); + mThreadContext.tempContactList.forceSize_Unsafe(mIslandContext.mCounts.contactManagers); + + const PxsIndexedContactManager** constraints = mThreadContext.orderedContactList.begin(); + + //OK, we sort the orderedContactList + + mThreadContext.compoundConstraints.forceSize_Unsafe(0); + if(mIslandContext.mCounts.contactManagers) + { + { + mThreadContext.sortIndexArray.forceSize_Unsafe(0); + + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eBODY == 0); + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eKINEMATIC == 1); + + const PxI32 offsetMap[] = {PxI32(mContext.mKinematicCount), 0}; + + const PxU32 totalBodies = mContext.mKinematicCount + mIslandContext.mCounts.bodies+1; + + mThreadContext.sortIndexArray.reserve(totalBodies); + mThreadContext.sortIndexArray.forceSize_Unsafe(totalBodies); + PxMemZero(mThreadContext.sortIndexArray.begin(), totalBodies * 4); + + //Iterate over the array based on solverBodyDatapool, creating a list of sorted constraints (in order of body pair) + //We only do this with contacts. It's important that this is done this way because we don't want to break our rules that all joints + //appear before all contacts in the constraint list otherwise we will lose all guarantees about sorting joints. + + for(PxU32 a = 0; a < mIslandContext.mCounts.contactManagers; ++a) + { + PX_ASSERT(mObjects.contactManagers[a].indexType0 != PxsIndexedInteraction::eWORLD); + //Index first body... + PxU8 indexType = mObjects.contactManagers[a].indexType0; + if(indexType != PxsIndexedInteraction::eARTICULATION && mObjects.contactManagers[a].indexType1 != PxsIndexedInteraction::eARTICULATION) + { + PX_ASSERT((indexType == PxsIndexedInteraction::eBODY) || (indexType == PxsIndexedInteraction::eKINEMATIC)); + + PxI32 index = PxI32(mObjects.contactManagers[a].solverBody0 + offsetMap[indexType]); + PX_ASSERT(index >= 0); + mThreadContext.sortIndexArray[PxU32(index)]++; + } + } + + PxU32 accumulatedCount = 0; + + for(PxU32 a = mThreadContext.sortIndexArray.size(); a > 0; --a) + { + PxU32 ind = a - 1; + PxU32 val = mThreadContext.sortIndexArray[ind]; + mThreadContext.sortIndexArray[ind] = accumulatedCount; + accumulatedCount += val; + } + + //OK, now copy across data to orderedConstraintDescs, pushing articulations to the end... + for(PxU32 a = 0; a < mIslandContext.mCounts.contactManagers; ++a) + { + //Index first body... + PxU8 indexType = mObjects.contactManagers[a].indexType0; + if(indexType != PxsIndexedInteraction::eARTICULATION && mObjects.contactManagers[a].indexType1 != PxsIndexedInteraction::eARTICULATION) + { + PX_ASSERT((indexType == PxsIndexedInteraction::eBODY) || (indexType == PxsIndexedInteraction::eKINEMATIC)); + + PxI32 index = PxI32(mObjects.contactManagers[a].solverBody0 + offsetMap[indexType]); + PX_ASSERT(index >= 0); + mThreadContext.tempContactList[mThreadContext.sortIndexArray[PxU32(index)]++] = &mObjects.contactManagers[a]; + } + else + { + mThreadContext.tempContactList[accumulatedCount++] = &mObjects.contactManagers[a]; + } + } + + //Now do the same again with bodyB, being careful not to overwrite the joints + PxMemZero(mThreadContext.sortIndexArray.begin(), totalBodies * 4); + + for(PxU32 a = 0; a < mIslandContext.mCounts.contactManagers; ++a) + { + //Index first body... + PxU8 indexType = mThreadContext.tempContactList[a]->indexType1; + if(indexType != PxsIndexedInteraction::eARTICULATION && mObjects.contactManagers[a].indexType0 != PxsIndexedInteraction::eARTICULATION) + { + PX_ASSERT((indexType == PxsIndexedInteraction::eBODY) || (indexType == PxsIndexedInteraction::eKINEMATIC) || (indexType == PxsIndexedInteraction::eWORLD)); + + PxI32 index = (indexType == PxsIndexedInteraction::eWORLD) ? 0 : PxI32(mThreadContext.tempContactList[a]->solverBody1 + offsetMap[indexType]); + PX_ASSERT(index >= 0); + mThreadContext.sortIndexArray[PxU32(index)]++; + } + } + + accumulatedCount = 0; + for(PxU32 a = mThreadContext.sortIndexArray.size(); a > 0; --a) + { + PxU32 ind = a - 1; + PxU32 val = mThreadContext.sortIndexArray[ind]; + mThreadContext.sortIndexArray[ind] = accumulatedCount; + accumulatedCount += val; + } + + PxU32 articulationStartIndex = accumulatedCount; + + //OK, now copy across data to orderedConstraintDescs, pushing articulations to the end... + for(PxU32 a = 0; a < mIslandContext.mCounts.contactManagers; ++a) + { + //Index first body... + PxU8 indexType = mThreadContext.tempContactList[a]->indexType1; + if(indexType != PxsIndexedInteraction::eARTICULATION && mObjects.contactManagers[a].indexType0 != PxsIndexedInteraction::eARTICULATION) + { + PX_ASSERT((indexType == PxsIndexedInteraction::eBODY) || (indexType == PxsIndexedInteraction::eKINEMATIC) || (indexType == PxsIndexedInteraction::eWORLD)); + + PxI32 index = (indexType == PxsIndexedInteraction::eWORLD) ? 0 : PxI32(mThreadContext.tempContactList[a]->solverBody1 + offsetMap[indexType]); + PX_ASSERT(index >= 0); + constraints[mThreadContext.sortIndexArray[PxU32(index)]++] = mThreadContext.tempContactList[a]; + } + else + { + constraints[accumulatedCount++] = mThreadContext.tempContactList[a]; + } + } + +#if 1 + PxSort(constraints + articulationStartIndex, accumulatedCount - articulationStartIndex, ArticulationSortPredicate()); +#endif + } + + mThreadContext.mStartContactDescPtr = contactDescPtr; + + mThreadContext.compoundConstraints.reserve(1024); + mThreadContext.compoundConstraints.forceSize_Unsafe(0); + //mThreadContext.compoundConstraints.forceSize_Unsafe(mCounts.contactManagers); + + PxSolverConstraintDesc* startDesc = contactDescPtr; + mContext.setDescFromIndices(*startDesc, islandSim, *constraints[0], mSolverBodyOffset); + startDesc->constraint = reinterpret_cast(constraints[0]->contactManager); + startDesc->constraintLengthOver16 = DY_SC_TYPE_RB_CONTACT; + + PxsContactManagerOutput* startManagerOutput = &mOutputs.getContactManager(constraints[0]->contactManager->getWorkUnit().mNpIndex); + PxU32 contactCount = startManagerOutput->nbContacts; + PxU32 startIndex = 0; + PxU32 numHeaders = 0; + + const bool gDisableConstraintWelding = false; + + for(PxU32 a = 1; a < mIslandContext.mCounts.contactManagers; ++a) + { + PxSolverConstraintDesc& desc = *(contactDescPtr+1); + mContext.setDescFromIndices(desc, islandSim, *constraints[a], mSolverBodyOffset); + + PxsContactManager* manager = constraints[a]->contactManager; + PxsContactManagerOutput& output = mOutputs.getContactManager(manager->getWorkUnit().mNpIndex); + + desc.constraint = reinterpret_cast(constraints[a]->contactManager); + desc.constraintLengthOver16 = DY_SC_TYPE_RB_CONTACT; + + if (contactCount == 0) + { + //This is the first object in the pair + *startDesc = *(contactDescPtr + 1); + startIndex = a; + startManagerOutput = &output; + } + + if(startDesc->bodyA != desc.bodyA || startDesc->bodyB != desc.bodyB + || startDesc->linkIndexA != PxSolverConstraintDesc::RIGID_BODY || startDesc->linkIndexB != PxSolverConstraintDesc::RIGID_BODY + || contactCount + output.nbContacts > PxContactBuffer::MAX_CONTACTS + || manager->isChangeable() + || gDisableConstraintWelding + ) //If this is the first thing and no contacts...then we skip + { + PxU32 stride = a - startIndex; + if(contactCount > 0) + { + if(stride > 1) + { + ++numHeaders; + CompoundContactManager& header = mThreadContext.compoundConstraints.insert(); + header.mStartIndex = startIndex; + header.mStride = PxTo16(stride); + header.mReducedContactCount = PxTo16(contactCount); + PxsContactManager* manager1 = constraints[startIndex]->contactManager; + PxcNpWorkUnit& unit = manager1->getWorkUnit(); + + PX_ASSERT(startManagerOutput == &mOutputs.getContactManager(unit.mNpIndex)); + + header.unit = &unit; + header.cmOutput = startManagerOutput; + header.originalContactPatches = startManagerOutput->contactPatches; + header.originalContactPoints = startManagerOutput->contactPoints; + header.originalContactCount = startManagerOutput->nbContacts; + header.originalPatchCount = startManagerOutput->nbPatches; + header.originalForceBuffer = reinterpret_cast(startManagerOutput->contactForces); + header.originalStatusFlags = startManagerOutput->statusFlag; + } + startDesc = ++contactDescPtr; + } + else + { + //Copy back next contactDescPtr + *startDesc = *(contactDescPtr+1); + } + contactCount = 0; + startIndex = a; + startManagerOutput = &output; + } + contactCount += output.nbContacts; + } + + PxU32 stride = mIslandContext.mCounts.contactManagers - startIndex; + if(contactCount > 0) + { + if(stride > 1) + { + ++numHeaders; + CompoundContactManager& header = mThreadContext.compoundConstraints.insert(); + header.mStartIndex = startIndex; + header.mStride = PxTo16(stride); + header.mReducedContactCount = PxTo16(contactCount); + PxsContactManager* manager = constraints[startIndex]->contactManager; + PxcNpWorkUnit& unit = manager->getWorkUnit(); + header.unit = &unit; + header.cmOutput = startManagerOutput; + header.originalContactPatches = startManagerOutput->contactPatches; + header.originalContactPoints = startManagerOutput->contactPoints; + header.originalContactCount = startManagerOutput->nbContacts; + header.originalPatchCount = startManagerOutput->nbPatches; + header.originalForceBuffer = reinterpret_cast(startManagerOutput->contactForces); + header.originalStatusFlags = startManagerOutput->statusFlag; + } + contactDescPtr++; + } + + if(numHeaders) + { + const PxU32 unrollSize = 8; + for(PxU32 a = 0; a < numHeaders; a+= unrollSize) + { + PxsSolverConstraintPostProcessTask* postProcessTask = PX_PLACEMENT_NEW( mContext.getTaskPool().allocate(sizeof(PxsSolverConstraintPostProcessTask)), + PxsSolverConstraintPostProcessTask)(mContext, mThreadContext, mObjects, mSolverBodyOffset, a, PxMin(unrollSize, numHeaders - a), mMaterialManager, + mOutputs); + postProcessTask->setContinuation(mCont); + postProcessTask->removeReference(); + } + } + } + mThreadContext.contactDescArraySize = PxU32(contactDescPtr - mThreadContext.contactConstraintDescArray); + mThreadContext.mContactDescPtr = contactDescPtr; + } + + virtual void runInternal() + { + startTasks(); + integrate(); + setupDescTask(); + articulationTask(); + } + + virtual const char* getName() const + { + return "PxsDynamics.solverStart"; + } + +private: + DynamicsContext& mContext; + IslandContext& mIslandContext; + const SolverIslandObjects mObjects; + const PxU32 mSolverBodyOffset; + const PxU32 mKinematicCount; + IG::SimpleIslandManager& mIslandManager; + PxU32* mBodyRemapTable; + PxsMaterialManager* mMaterialManager; + PxsContactManagerOutputIterator& mOutputs; + bool mEnhancedDeterminism; +}; + +class PxsSolverConstraintPartitionTask : public Cm::Task +{ + PxsSolverConstraintPartitionTask& operator=(const PxsSolverConstraintPartitionTask&); +public: + + PxsSolverConstraintPartitionTask(DynamicsContext& context, + IslandContext& islandContext, + const SolverIslandObjects& objects, + const PxU32 solverBodyOffset, bool enhancedDeterminism) : + Cm::Task(context.getContextId()), + mContext(context), + mIslandContext(islandContext), + mObjects(objects), + mSolverBodyOffset(solverBodyOffset), + mEnhancedDeterminism(enhancedDeterminism) + {} + + virtual void runInternal() + { + PX_PROFILE_ZONE("PartitionConstraints", mContext.getContextId()); + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + + //Compact articulation pairs... + ArticulationSolverDesc* artics = mThreadContext.getArticulations().begin(); + + PxSolverConstraintDesc* descBegin = mThreadContext.contactConstraintDescArray; + PxU32 descCount = mThreadContext.contactDescArraySize; + + PxSolverBody* solverBodies = mContext.mSolverBodyPool.begin() + mSolverBodyOffset; + + mThreadContext.mNumDifferentBodyConstraints = descCount; + + { + mThreadContext.mNumDifferentBodyConstraints = 0; + mThreadContext.mNumSelfConstraints = 0; + mThreadContext.mNumStaticConstraints = 0; + mThreadContext.mNumDifferentBodyFrictionConstraints = 0; + mThreadContext.mNumSelfConstraintFrictionBlocks = 0; + mThreadContext.mNumSelfFrictionConstraints = 0; + + if(descCount > 0) + { + ConstraintPartitionArgs args; + args.mBodies = reinterpret_cast(solverBodies); + args.mStride = sizeof(PxSolverBody); + args.mArticulationPtrs = artics; + args.mContactConstraintDescriptors = descBegin; + args.mNumArticulationPtrs = mThreadContext.getArticulations().size(); + args.mNumBodies = mIslandContext.mCounts.bodies; + args.mNumContactConstraintDescriptors = descCount; + args.mOrderedContactConstraintDescriptors = mThreadContext.orderedContactConstraints; + args.mOverflowConstraintDescriptors = mThreadContext.tempConstraintDescArray; + args.mNumDifferentBodyConstraints = args.mNumSelfConstraints = args.mNumStaticConstraints = 0; + args.mConstraintsPerPartition = &mThreadContext.mConstraintsPerPartition; + args.mNumOverflowConstraints = 0; + args.mBitField = &mThreadContext.mPartitionNormalizationBitmap; + args.enhancedDeterminism = mEnhancedDeterminism; + args.forceStaticConstraintsToSolver = mContext.getFrictionType() != PxFrictionType::ePATCH; + args.maxPartitions = PX_MAX_U32; + + mThreadContext.mMaxPartitions = partitionContactConstraints(args); + mThreadContext.mNumDifferentBodyConstraints = args.mNumDifferentBodyConstraints; + mThreadContext.mNumSelfConstraints = args.mNumSelfConstraints; + mThreadContext.mNumStaticConstraints = args.mNumStaticConstraints; + } + else + { + PxMemZero(mThreadContext.mConstraintsPerPartition.begin(), sizeof(PxU32)*mThreadContext.mConstraintsPerPartition.capacity()); + } + + PX_ASSERT((mThreadContext.mNumDifferentBodyConstraints + mThreadContext.mNumSelfConstraints + mThreadContext.mNumStaticConstraints) == descCount); + } + } + + virtual const char* getName() const { return "PxsDynamics.solverConstraintPartition"; } + + DynamicsContext& mContext; + IslandContext& mIslandContext; + const SolverIslandObjects mObjects; + PxU32 mSolverBodyOffset; + bool mEnhancedDeterminism; +}; + +class PxsSolverSetupSolveTask : public Cm::Task +{ + PxsSolverSetupSolveTask& operator=(const PxsSolverSetupSolveTask&); +public: + + PxsSolverSetupSolveTask( + DynamicsContext& context, + IslandContext& islandContext, + const SolverIslandObjects& objects, + const PxU32 solverBodyOffset, + IG::IslandSim& islandSim) : + Cm::Task(context.getContextId()), + mContext(context), + mIslandContext(islandContext), + mObjects(objects), + mSolverBodyOffset(solverBodyOffset), + mIslandSim(islandSim) + {} + + virtual void runInternal() + { + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + + PxSolverConstraintDesc* contactDescBegin = mThreadContext.orderedContactConstraints; + PxSolverConstraintDesc* contactDescPtr = mThreadContext.orderedContactConstraints; + + PxSolverBody* solverBodies = mContext.mSolverBodyPool.begin() + mSolverBodyOffset; + PxSolverBodyData* solverBodyDatas = mContext.mSolverBodyDataPool.begin(); + + PxU32 frictionDescCount = mThreadContext.mNumDifferentBodyFrictionConstraints; + + PxU32 j = 0, i = 0; + + //On PS3, self-constraints will be bumped to the end of the constraint list + //and processed separately. On PC/360, they will be mixed in the array and + //classed as "different body" constraints regardless of the fact that they're self-constraints. + //PxU32 numBatches = mThreadContext.numDifferentBodyBatchHeaders; + // TODO: maybe replace with non-null joints from end of the array + + PxU32 numBatches = 0; + + PxU32 currIndex = 0; + for(PxU32 a = 0; a < mThreadContext.mConstraintsPerPartition.size(); ++a) + { + PxU32 endIndex = currIndex + mThreadContext.mConstraintsPerPartition[a]; + + PxU32 numBatchesInPartition = 0; + for(PxU32 b = currIndex; b < endIndex; ++b) + { + PxConstraintBatchHeader& _header = mThreadContext.contactConstraintBatchHeaders[b]; + PxU16 stride = _header.stride, newStride = _header.stride; + PxU32 startIndex = j; + for(PxU16 c = 0; c < stride; ++c) + { + if(getConstraintLength(contactDescBegin[i]) == 0) + { + newStride--; + i++; + } + else + { + if(i!=j) + contactDescBegin[j] = contactDescBegin[i]; + i++; + j++; + contactDescPtr++; + } + } + + if(newStride != 0) + { + mThreadContext.contactConstraintBatchHeaders[numBatches].startIndex = startIndex; + mThreadContext.contactConstraintBatchHeaders[numBatches].stride = newStride; + PxU8 type = *contactDescBegin[startIndex].constraint; + if(type == DY_SC_TYPE_STATIC_CONTACT) + { + //Check if any block of constraints is classified as type static (single) contact constraint. + //If they are, iterate over all constraints grouped with it and switch to "dynamic" contact constraint + //type if there's a dynamic contact constraint in the group. + for(PxU32 c = 1; c < newStride; ++c) + { + if(*contactDescBegin[startIndex+c].constraint == DY_SC_TYPE_RB_CONTACT) + { + type = DY_SC_TYPE_RB_CONTACT; + } + } + } + + mThreadContext.contactConstraintBatchHeaders[numBatches].constraintType = type; + numBatches++; + numBatchesInPartition++; + } + } + PxU32 numHeaders = numBatchesInPartition; + currIndex += mThreadContext.mConstraintsPerPartition[a]; + mThreadContext.mConstraintsPerPartition[a] = numHeaders; + } + + PxU32 contactDescCount = PxU32(contactDescPtr - contactDescBegin); + + mThreadContext.mNumDifferentBodyConstraints = contactDescCount; + + mThreadContext.numContactConstraintBatches = numBatches; + mThreadContext.mNumSelfConstraints = j - contactDescCount; //self constraint count + contactDescCount = j; + mThreadContext.mOrderedContactDescCount = j; + + //Now do the friction constraints if we're not using the sticky model + if(mContext.getFrictionType() != PxFrictionType::ePATCH) + { + PxSolverConstraintDesc* frictionDescBegin = mThreadContext.frictionConstraintDescArray.begin(); + PxSolverConstraintDesc* frictionDescPtr = frictionDescBegin; + + PxArray& frictionHeaderArray = mThreadContext.frictionConstraintBatchHeaders; + frictionHeaderArray.forceSize_Unsafe(0); + frictionHeaderArray.reserve(mThreadContext.numContactConstraintBatches); + PxConstraintBatchHeader* headers = frictionHeaderArray.begin(); + + PxArray& constraintsPerPartition = mThreadContext.mConstraintsPerPartition; + PxArray& frictionConstraintsPerPartition = mThreadContext.mFrictionConstraintsPerPartition; + frictionConstraintsPerPartition.forceSize_Unsafe(0); + frictionConstraintsPerPartition.reserve(constraintsPerPartition.capacity()); + + PxU32 fricI = 0; + PxU32 startIndex = 0; + PxU32 fricHeaders = 0; + for(PxU32 k = 0; k < constraintsPerPartition.size(); ++k) + { + PxU32 numBatchesInK = constraintsPerPartition[k]; + PxU32 endIndex = startIndex + numBatchesInK; + + PxU32 startFricH = fricHeaders; + + for(PxU32 a = startIndex; a < endIndex; ++a) + { + PxConstraintBatchHeader& _header = mThreadContext.contactConstraintBatchHeaders[a]; + PxU16 stride = _header.stride; + if(_header.constraintType == DY_SC_TYPE_RB_CONTACT || _header.constraintType == DY_SC_TYPE_EXT_CONTACT || + _header.constraintType == DY_SC_TYPE_STATIC_CONTACT) + { + PxU8 type = 0; + //Extract friction from this constraint + for(PxU16 b = 0; b < stride; ++b) + { + //create the headers... + PxSolverConstraintDesc& desc = contactDescBegin[_header.startIndex + b]; + PX_ASSERT(desc.constraint); + SolverContactCoulombHeader* header = reinterpret_cast(desc.constraint); + PxU32 frictionOffset = header->frictionOffset; + PxU8* PX_RESTRICT constraint = reinterpret_cast(header) + frictionOffset; + const PxU32 origLength = getConstraintLength(desc); + const PxU32 length = (origLength - frictionOffset); + + setConstraintLength(*frictionDescPtr, length); + frictionDescPtr->constraint = constraint; + frictionDescPtr->bodyA = desc.bodyA; + frictionDescPtr->bodyB = desc.bodyB; + frictionDescPtr->bodyADataIndex = desc.bodyADataIndex; + frictionDescPtr->bodyBDataIndex = desc.bodyBDataIndex; + frictionDescPtr->linkIndexA = desc.linkIndexA; + frictionDescPtr->linkIndexB = desc.linkIndexB; + frictionDescPtr->writeBack = NULL; + type = *constraint; + frictionDescPtr++; + } + headers->startIndex = fricI; + headers->stride = stride; + headers->constraintType = type; + headers++; + fricHeaders++; + fricI += stride; + } + else if(_header.constraintType == DY_SC_TYPE_BLOCK_RB_CONTACT || _header.constraintType == DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT) + { + //KS - TODO - Extract block of 4 contacts from this constraint. This isn't implemented yet for coulomb friction model + PX_ASSERT(contactDescBegin[_header.startIndex].constraint); + SolverContactCoulombHeader4* head = reinterpret_cast(contactDescBegin[_header.startIndex].constraint); + PxU32 frictionOffset = head->frictionOffset; + PxU8* PX_RESTRICT constraint = reinterpret_cast(head) + frictionOffset; + const PxU32 origLength = getConstraintLength(contactDescBegin[_header.startIndex]); + const PxU32 length = (origLength - frictionOffset); + PxU8 type = *constraint; + PX_ASSERT(type == DY_SC_TYPE_BLOCK_FRICTION || type == DY_SC_TYPE_BLOCK_STATIC_FRICTION); + for(PxU32 b = 0; b < 4; ++b) + { + PxSolverConstraintDesc& desc = contactDescBegin[_header.startIndex+b]; + setConstraintLength(*frictionDescPtr, length); + frictionDescPtr->constraint = constraint; + frictionDescPtr->bodyA = desc.bodyA; + frictionDescPtr->bodyB = desc.bodyB; + frictionDescPtr->bodyADataIndex = desc.bodyADataIndex; + frictionDescPtr->bodyBDataIndex = desc.bodyBDataIndex; + frictionDescPtr->linkIndexA = desc.linkIndexA; + frictionDescPtr->linkIndexB = desc.linkIndexB; + frictionDescPtr->writeBack = NULL; + frictionDescPtr++; + } + headers->startIndex = fricI; + headers->stride = stride; + headers->constraintType = type; + headers++; + fricHeaders++; + fricI += stride; + } + } + startIndex += numBatchesInK; + if(startFricH < fricHeaders) + { + frictionConstraintsPerPartition.pushBack(fricHeaders - startFricH); + } + } + + frictionDescCount = PxU32(frictionDescPtr - frictionDescBegin); + + mThreadContext.mNumDifferentBodyFrictionConstraints = frictionDescCount; + + frictionHeaderArray.forceSize_Unsafe(PxU32(headers - frictionHeaderArray.begin())); + + mThreadContext.mNumSelfFrictionConstraints = fricI - frictionDescCount; //self constraint count + mThreadContext.mNumDifferentBodyFrictionConstraints = frictionDescCount; + frictionDescCount = fricI; + mThreadContext.mOrderedFrictionDescCount = frictionDescCount; + } + + { + { + PX_PROFILE_ZONE("Dynamics.solver", mContext.getContextId()); + + PxSolverConstraintDesc* contactDescs = mThreadContext.orderedContactConstraints; + PxSolverConstraintDesc* frictionDescs = mThreadContext.frictionConstraintDescArray.begin(); + + PxI32* thresholdPairsOut = &mContext.mThresholdStreamOut; + + SolverIslandParams& params = *reinterpret_cast(mContext.getTaskPool().allocate(sizeof(SolverIslandParams))); + params.positionIterations = mThreadContext.mMaxSolverPositionIterations; + params.velocityIterations = mThreadContext.mMaxSolverVelocityIterations; + params.bodyListStart = solverBodies; + params.bodyDataList = solverBodyDatas; + params.solverBodyOffset = mSolverBodyOffset; + params.bodyListSize = mIslandContext.mCounts.bodies; + params.articulationListStart = mThreadContext.getArticulations().begin(); + params.articulationListSize = mThreadContext.getArticulations().size(); + params.constraintList = contactDescs; + params.constraintIndex = 0; + params.constraintIndex2 = 0; + params.bodyListIndex = 0; + params.bodyListIndex2 = 0; + params.articSolveIndex = 0; + params.articSolveIndex2 = 0; + params.bodyIntegrationListIndex = 0; + params.thresholdStream = mContext.getThresholdStream().begin(); + params.thresholdStreamLength = mContext.getThresholdStream().size(); + params.outThresholdPairs = thresholdPairsOut; + params.motionVelocityArray = mThreadContext.motionVelocityArray; + params.bodyArray = mThreadContext.mBodyCoreArray; + params.numObjectsIntegrated = 0; + params.constraintBatchHeaders = mThreadContext.contactConstraintBatchHeaders; + params.numConstraintHeaders = mThreadContext.numContactConstraintBatches; + params.headersPerPartition = mThreadContext.mConstraintsPerPartition.begin(); + params.nbPartitions = mThreadContext.mConstraintsPerPartition.size(); + params.rigidBodies = const_cast(mObjects.bodies); + params.frictionHeadersPerPartition = mThreadContext.mFrictionConstraintsPerPartition.begin(); + params.nbFrictionPartitions = mThreadContext.mFrictionConstraintsPerPartition.size(); + params.frictionConstraintBatches = mThreadContext.frictionConstraintBatchHeaders.begin(); + params.numFrictionConstraintHeaders = mThreadContext.frictionConstraintBatchHeaders.size(); + params.frictionConstraintIndex = 0; + params.frictionConstraintList = frictionDescs; + params.mMaxArticulationLinks = mThreadContext.mMaxArticulationLinks; + params.dt = mContext.mDt; + params.invDt = mContext.mInvDt; + + const PxU32 unrollSize = 8; + const PxU32 denom = PxMax(1u, (mThreadContext.mMaxPartitions*unrollSize)); + const PxU32 MaxTasks = getTaskManager()->getCpuDispatcher()->getWorkerCount(); + const PxU32 idealThreads = (mThreadContext.numContactConstraintBatches+denom-1)/denom; + const PxU32 numTasks = PxMax(1u, PxMin(idealThreads, MaxTasks)); + + if(numTasks > 1) + { + const PxU32 idealBatchSize = PxMax(unrollSize, idealThreads*unrollSize/(numTasks*2)); + + params.batchSize = idealBatchSize; //assigning ideal batch size for the solver to grab work at. Only needed by the multi-threaded island solver. + + for(PxU32 a = 1; a < numTasks; ++a) + { + void* tsk = mContext.getTaskPool().allocate(sizeof(PxsParallelSolverTask)); + PxsParallelSolverTask* pTask = PX_PLACEMENT_NEW(tsk, PxsParallelSolverTask)( + params, mContext, mContext.getFrictionType(), mIslandSim); + + //Force to complete before merge task! + pTask->setContinuation(mCont); + + pTask->removeReference(); + } + + //Avoid kicking off one parallel task when we can do the work inline in this function + { + PX_PROFILE_ZONE("Dynamics.parallelSolve", mContext.getContextId()); + + solveParallel(mContext, params, mIslandSim); + } + const PxI32 numBodiesPlusArtics = PxI32( mIslandContext.mCounts.bodies + mIslandContext.mCounts.articulations ); + + PxI32* numObjectsIntegrated = ¶ms.numObjectsIntegrated; + + WAIT_FOR_PROGRESS_NO_TIMER(numObjectsIntegrated, numBodiesPlusArtics); + } + else + { + mThreadContext.mZVector.forceSize_Unsafe(0); + mThreadContext.mZVector.reserve(mThreadContext.mMaxArticulationLinks); + mThreadContext.mZVector.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks); + + mThreadContext.mDeltaV.forceSize_Unsafe(0); + mThreadContext.mDeltaV.reserve(mThreadContext.mMaxArticulationLinks); + mThreadContext.mDeltaV.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks); + + params.Z = mThreadContext.mZVector.begin(); + params.deltaV = mThreadContext.mDeltaV.begin(); + + //Only one task - a small island so do a sequential solve (avoid the atomic overheads) + solveVBlock(mContext.mSolverCore[mContext.getFrictionType()], params); + + const PxU32 bodyCountMin1 = mIslandContext.mCounts.bodies - 1u; + PxSolverBodyData* solverBodyData2 = solverBodyDatas + mSolverBodyOffset + 1; + for(PxU32 k=0; k < mIslandContext.mCounts.bodies; k++) + { + const PxU32 prefetchAddress = PxMin(k+4, bodyCountMin1); + PxPrefetchLine(mThreadContext.mBodyCoreArray[prefetchAddress]); + PxPrefetchLine(&mThreadContext.motionVelocityArray[k], 128); + PxPrefetchLine(&mThreadContext.mBodyCoreArray[prefetchAddress], 128); + PxPrefetchLine(&mObjects.bodies[prefetchAddress]); + + PxSolverBodyData& solverBodyData = solverBodyData2[k]; + + PxsRigidBody& rBody = *mObjects.bodies[k]; + PxsBodyCore& core = rBody.getCore(); + + integrateCore(mThreadContext.motionVelocityArray[k].linear, mThreadContext.motionVelocityArray[k].angular, + solverBodies[k], solverBodyData, mContext.mDt, core.lockFlags); + + + rBody.mLastTransform = core.body2World; + core.body2World = solverBodyData.body2World; + core.linearVelocity = solverBodyData.linearVelocity; + core.angularVelocity = solverBodyData.angularVelocity; + + bool hasStaticTouch = mIslandSim.getIslandStaticTouchCount(PxNodeIndex(solverBodyData.nodeIndex)) != 0; + sleepCheck(const_cast(mObjects.bodies[k]), mContext.mDt, mContext.mInvDt, mContext.mEnableStabilization, mThreadContext.motionVelocityArray[k], + hasStaticTouch); + } + + for(PxU32 cnt=0;cnt(cmOutput->contactForces); + PxU32 contactCount = cmOutput->nbContacts; + + cmOutput->contactPatches = manager.originalContactPatches; + cmOutput->contactPoints = manager.originalContactPoints; + cmOutput->nbContacts = manager.originalContactCount; + cmOutput->nbPatches = manager.originalPatchCount; + cmOutput->statusFlag = manager.originalStatusFlags; + cmOutput->contactForces = manager.originalForceBuffer; + + for(PxU32 a = 1; a < manager.mStride; ++a) + { + PxsContactManager* pManager = mThreadContext.orderedContactList[manager.mStartIndex + a]->contactManager; + pManager->getWorkUnit().frictionDataPtr = manager.unit->frictionDataPtr; + pManager->getWorkUnit().frictionPatchCount = manager.unit->frictionPatchCount; + //pManager->getWorkUnit().prevFrictionPatchCount = manager.unit->prevFrictionPatchCount; + } + + //This is a stride-based contact force writer. The assumption is that we may have skipped certain unimportant contacts reported by the + //discrete narrow phase + if(contactForces) + { + PxU32 currentContactIndex = 0; + PxU32 currentManagerIndex = manager.mStartIndex; + PxU32 currentManagerContactIndex = 0; + + for(PxU32 a = 0; a < contactCount; ++a) + { + PxU32 index = manager.forceBufferList[a]; + PxsContactManager* pManager = mThreadContext.orderedContactList[currentManagerIndex]->contactManager; + PxsContactManagerOutput* output = &mOutputs.getContactManager(pManager->getWorkUnit().mNpIndex); + while(currentContactIndex < index || output->nbContacts == 0) + { + //Step forwards...first in this manager... + + PxU32 numToStep = PxMin(index - currentContactIndex, PxU32(output->nbContacts) - currentManagerContactIndex); + currentContactIndex += numToStep; + currentManagerContactIndex += numToStep; + if(currentManagerContactIndex == output->nbContacts) + { + currentManagerIndex++; + currentManagerContactIndex = 0; + pManager = mThreadContext.orderedContactList[currentManagerIndex]->contactManager; + output = &mOutputs.getContactManager(pManager->getWorkUnit().mNpIndex); + } + } + if(output->nbContacts > 0 && output->contactForces) + output->contactForces[currentManagerContactIndex] = contactForces[a]; + } + } + } + + mThreadContext.compoundConstraints.forceSize_Unsafe(0); + + mThreadContext.mConstraintBlockManager.reset(); + + mContext.putThreadContext(&mThreadContext); + } + + virtual const char* getName() const + { + return "PxsDynamics.solverEnd"; + } + + DynamicsContext& mContext; + IslandContext& mIslandContext; + const SolverIslandObjects mObjects; + const PxU32 mSolverBodyOffset; + PxsContactManagerOutputIterator& mOutputs; +}; + +class PxsSolverCreateFinalizeConstraintsTask : public Cm::Task +{ + PxsSolverCreateFinalizeConstraintsTask& operator=(const PxsSolverCreateFinalizeConstraintsTask&); +public: + + PxsSolverCreateFinalizeConstraintsTask( + DynamicsContext& context, + IslandContext& islandContext, + PxU32 solverDataOffset, + PxsContactManagerOutputIterator& outputs, + bool enhancedDeterminism) : + Cm::Task (context.getContextId()), + mContext (context), + mIslandContext (islandContext), + mSolverDataOffset (solverDataOffset), + mOutputs (outputs), + mEnhancedDeterminism (enhancedDeterminism) + { + } + + virtual void runInternal(); + + virtual const char* getName() const { return "PxsDynamics.solverCreateFinalizeConstraints"; } + + DynamicsContext& mContext; + IslandContext& mIslandContext; + PxU32 mSolverDataOffset; + PxsContactManagerOutputIterator& mOutputs; + bool mEnhancedDeterminism; +}; + +// helper function to join two tasks together and ensure ref counts are correct +void chainTasks(PxLightCpuTask* first, PxLightCpuTask* next) +{ + first->setContinuation(next); + next->removeReference(); +} + +PxBaseTask* createSolverTaskChain(DynamicsContext& dynamicContext, + const SolverIslandObjects& objects, + const PxsIslandIndices& counts, + const PxU32 solverBodyOffset, + IG::SimpleIslandManager& islandManager, + PxU32* bodyRemapTable, PxsMaterialManager* materialManager, PxBaseTask* continuation, + PxsContactManagerOutputIterator& iterator, bool useEnhancedDeterminism) +{ + Cm::FlushPool& taskPool = dynamicContext.getTaskPool(); + + taskPool.lock(); + + IslandContext* islandContext = reinterpret_cast(taskPool.allocate(sizeof(IslandContext))); + islandContext->mThreadContext = NULL; + islandContext->mCounts = counts; + + // create lead task + PxsSolverStartTask* startTask = PX_PLACEMENT_NEW(taskPool.allocateNotThreadSafe(sizeof(PxsSolverStartTask)), PxsSolverStartTask)(dynamicContext, *islandContext, objects, solverBodyOffset, dynamicContext.getKinematicCount(), + islandManager, bodyRemapTable, materialManager, iterator, useEnhancedDeterminism); + PxsSolverEndTask* endTask = PX_PLACEMENT_NEW(taskPool.allocateNotThreadSafe(sizeof(PxsSolverEndTask)), PxsSolverEndTask)(dynamicContext, *islandContext, objects, solverBodyOffset, iterator); + + PxsSolverCreateFinalizeConstraintsTask* createFinalizeConstraintsTask = PX_PLACEMENT_NEW(taskPool.allocateNotThreadSafe(sizeof(PxsSolverCreateFinalizeConstraintsTask)), PxsSolverCreateFinalizeConstraintsTask)(dynamicContext, *islandContext, solverBodyOffset, iterator, useEnhancedDeterminism); + PxsSolverSetupSolveTask* setupSolveTask = PX_PLACEMENT_NEW(taskPool.allocateNotThreadSafe(sizeof(PxsSolverSetupSolveTask)), PxsSolverSetupSolveTask)(dynamicContext, *islandContext, objects, solverBodyOffset, islandManager.getAccurateIslandSim()); + + PxsSolverConstraintPartitionTask* partitionConstraintsTask = PX_PLACEMENT_NEW(taskPool.allocateNotThreadSafe(sizeof(PxsSolverConstraintPartitionTask)), PxsSolverConstraintPartitionTask)(dynamicContext, *islandContext, objects, solverBodyOffset, useEnhancedDeterminism); + + endTask->setContinuation(continuation); + + // set up task chain in reverse order + chainTasks(setupSolveTask, endTask); + chainTasks(createFinalizeConstraintsTask, setupSolveTask); + chainTasks(partitionConstraintsTask, createFinalizeConstraintsTask); + chainTasks(startTask, partitionConstraintsTask); + + taskPool.unlock(); + + return startTask; +} + +class UpdateContinuationTask : public Cm::Task +{ + DynamicsContext& mContext; + IG::SimpleIslandManager& mSimpleIslandManager; + PxBaseTask* mLostTouchTask; + PxU32 mMaxArticulationLinks; + + PX_NOCOPY(UpdateContinuationTask) +public: + + UpdateContinuationTask(DynamicsContext& context, + IG::SimpleIslandManager& simpleIslandManager, + PxBaseTask* lostTouchTask, + PxU64 contextID, const PxU32 maxLinks) : Cm::Task(contextID), mContext(context), mSimpleIslandManager(simpleIslandManager), + mLostTouchTask(lostTouchTask), mMaxArticulationLinks(maxLinks) + { + } + + virtual const char* getName() const { return "UpdateContinuationTask"; } + + virtual void runInternal() + { + mContext.updatePostKinematic(mSimpleIslandManager, mCont, mLostTouchTask, mMaxArticulationLinks); + //Allow lost touch task to run once all tasks have be scheduled + mLostTouchTask->removeReference(); + } +}; + +class KinematicCopyTask : public Cm::Task +{ + const PxNodeIndex* const mKinematicIndices; + const PxU32 mNbKinematics; + const IG::IslandSim& mIslandSim; + PxSolverBodyData* mBodyData; + + PX_NOCOPY(KinematicCopyTask) + +public: + + static const PxU32 NbKinematicsPerTask = 1024; + + KinematicCopyTask(const PxNodeIndex* const kinematicIndices, + const PxU32 nbKinematics, const IG::IslandSim& islandSim, + PxSolverBodyData* datas, PxU64 contextID) : Cm::Task(contextID), + mKinematicIndices(kinematicIndices), mNbKinematics(nbKinematics), + mIslandSim(islandSim), mBodyData(datas) + { + } + + virtual const char* getName() const { return "KinematicCopyTask"; } + + virtual void runInternal() + { + for (PxU32 i = 0; igetCore(); + copyToSolverBodyData(core.linearVelocity, core.angularVelocity, core.inverseMass, core.inverseInertia, core.body2World, core.maxPenBias, + core.maxContactImpulse, mKinematicIndices[i].index(), core.contactReportThreshold, mBodyData[i + 1], core.lockFlags, 0.f, + core.mFlags & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES); + rigidBody->saveLastCCDTransform(); + } + } +}; + +void DynamicsContext::update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask, + PxvNphaseImplementationContext* nphase, const PxU32 /*maxPatches*/, const PxU32 maxArticulationLinks, + const PxReal dt, const PxVec3& gravity, PxBitMapPinned& /*changedHandleMap*/) +{ + PX_PROFILE_ZONE("Dynamics.solverQueueTasks", mContextID); + + PX_UNUSED(simpleIslandManager); + + mOutputIterator = nphase->getContactManagerOutputs(); + + mDt = dt; + mInvDt = dt == 0.0f ? 0.0f : 1.0f / dt; + mGravity = gravity; + + const IG::IslandSim& islandSim = simpleIslandManager.getAccurateIslandSim(); + + const PxU32 islandCount = islandSim.getNbActiveIslands(); + + const PxU32 activatedContactCount = islandSim.getNbActivatedEdges(IG::Edge::eCONTACT_MANAGER); + const IG::EdgeIndex* const activatingEdges = islandSim.getActivatedEdges(IG::Edge::eCONTACT_MANAGER); + + for (PxU32 a = 0; a < activatedContactCount; ++a) + { + PxsContactManager* cm = simpleIslandManager.getContactManager(activatingEdges[a]); + if (cm) + { + cm->getWorkUnit().frictionPatchCount = 0; //KS - zero the friction patch count on any activating edges + } + } + +#if PX_ENABLE_SIM_STATS + if (islandCount > 0) + { + mSimStats.mNbActiveKinematicBodies = islandSim.getNbActiveKinematics(); + mSimStats.mNbActiveDynamicBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + mSimStats.mNbActiveConstraints = islandSim.getNbActiveEdges(IG::Edge::eCONSTRAINT); + } + else + { + mSimStats.mNbActiveKinematicBodies = islandSim.getNbActiveKinematics(); + mSimStats.mNbActiveDynamicBodies = 0; + mSimStats.mNbActiveConstraints = 0; + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + mThresholdStreamOut = 0; + + resetThreadContexts(); + + //If there is no work to do then we can do nothing at all. + if (0 == islandCount) + { + return; + } + + //Block to make sure it doesn't run before stage2 of update! + lostTouchTask->addReference(); + + UpdateContinuationTask* task = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(UpdateContinuationTask)), UpdateContinuationTask) + (*this, simpleIslandManager, lostTouchTask, mContextID, maxArticulationLinks); + + task->setContinuation(continuation); + + //KS - test that world solver body's velocities are finite and 0, then set it to 0. + //Technically, the velocity should always be 0 but can be stomped if a NAN creeps into the simulation. + PX_ASSERT(mWorldSolverBody.linearVelocity == PxVec3(0.f)); + PX_ASSERT(mWorldSolverBody.angularState == PxVec3(0.f)); + PX_ASSERT(mWorldSolverBody.linearVelocity.isFinite()); + PX_ASSERT(mWorldSolverBody.angularState.isFinite()); + + mWorldSolverBody.linearVelocity = mWorldSolverBody.angularState = PxVec3(0.f); + + const PxU32 kinematicCount = islandSim.getNbActiveKinematics(); + const PxNodeIndex* const kinematicIndices = islandSim.getActiveKinematics(); + mKinematicCount = kinematicCount; + + const PxU32 bodyCount = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + const PxU32 numArtics = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE); + + + { + if (kinematicCount + bodyCount > mSolverBodyPool.capacity()) + { + mSolverBodyPool.reserve((kinematicCount + bodyCount + 31) & ~31); // pad out to 32 * 128 = 4k to prevent alloc churn + mSolverBodyDataPool.reserve((kinematicCount + bodyCount + 31 + 1) & ~31); // pad out to 32 * 128 = 4k to prevent alloc churn + mSolverBodyRemapTable.reserve((kinematicCount + bodyCount + 31 + 1) & ~31); + } + + { + PxSolverBody emptySolverBody; + PxMemZero(&emptySolverBody, sizeof(PxSolverBody)); + mSolverBodyPool.resize(kinematicCount + bodyCount, emptySolverBody); + PxSolverBodyData emptySolverBodyData; + PxMemZero(&emptySolverBodyData, sizeof(PxSolverBodyData)); + mSolverBodyDataPool.resize(kinematicCount + bodyCount + 1, emptySolverBodyData); + mSolverBodyRemapTable.resize(bodyCount); + } + + // integrate and copy all the kinematics - overkill, since not all kinematics + // need solver bodies + + mSolverBodyDataPool[0] = mWorldSolverBodyData; + + { + PX_PROFILE_ZONE("Dynamics.updateKinematics", mContextID); + PxMemZero(mSolverBodyPool.begin(), kinematicCount * sizeof(PxSolverBody)); + for (PxU32 i = 0; i < kinematicCount; i+= KinematicCopyTask::NbKinematicsPerTask) + { + const PxU32 nbToProcess = PxMin(KinematicCopyTask::NbKinematicsPerTask, kinematicCount - i); + + KinematicCopyTask* copyTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(KinematicCopyTask)), KinematicCopyTask) + (&kinematicIndices[i], nbToProcess, islandSim, &mSolverBodyDataPool[i], mContextID); + + copyTask->setContinuation(task); + + copyTask->removeReference(); + } + } + } + + //Resize arrays of solver constraints... + + PxU32 numArticulationConstraints = numArtics* maxArticulationLinks; //Just allocate enough memory to fit worst-case maximum size articulations... + + const PxU32 nbActiveContactManagers = islandSim.getNbActiveEdges(IG::Edge::eCONTACT_MANAGER); + const PxU32 nbActiveConstraints = islandSim.getNbActiveEdges(IG::Edge::eCONSTRAINT); + + PxU32 totalConstraintCount = nbActiveConstraints + nbActiveContactManagers + numArticulationConstraints; + + mSolverConstraintDescPool.forceSize_Unsafe(0); + mSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mOrderedSolverConstraintDescPool.forceSize_Unsafe(0); + mOrderedSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mOrderedSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mTempSolverConstraintDescPool.forceSize_Unsafe(0); + mTempSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mTempSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mContactConstraintBatchHeaders.forceSize_Unsafe(0); + mContactConstraintBatchHeaders.reserve((totalConstraintCount + 63) & (~63)); + mContactConstraintBatchHeaders.forceSize_Unsafe(totalConstraintCount); + + mContactList.forceSize_Unsafe(0); + mContactList.reserve((nbActiveContactManagers + 63u) & (~63u)); + mContactList.forceSize_Unsafe(nbActiveContactManagers); + + mMotionVelocityArray.forceSize_Unsafe(0); + mMotionVelocityArray.reserve((bodyCount + 63u) & (~63u)); + mMotionVelocityArray.forceSize_Unsafe(bodyCount); + + mBodyCoreArray.forceSize_Unsafe(0); + mBodyCoreArray.reserve((bodyCount + 63u) & (~63u)); + mBodyCoreArray.forceSize_Unsafe(bodyCount); + + mRigidBodyArray.forceSize_Unsafe(0); + mRigidBodyArray.reserve((bodyCount + 63u) & (~63u)); + mRigidBodyArray.forceSize_Unsafe(bodyCount); + + mArticulationArray.forceSize_Unsafe(0); + mArticulationArray.reserve((numArtics + 63u) & (~63u)); + mArticulationArray.forceSize_Unsafe(numArtics); + + mNodeIndexArray.forceSize_Unsafe(0); + mNodeIndexArray.reserve((bodyCount + 63u) & (~63u)); + mNodeIndexArray.forceSize_Unsafe(bodyCount); + + ThresholdStream& stream = getThresholdStream(); + stream.forceSize_Unsafe(0); + stream.reserve(PxNextPowerOfTwo(nbActiveContactManagers != 0 ? nbActiveContactManagers - 1 : nbActiveContactManagers)); + + //flip exceeded force threshold buffer + mCurrentIndex = 1 - mCurrentIndex; + + task->removeReference(); +} + +void DynamicsContext::updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* /*continuation*/, PxBaseTask* lostTouchTask, const PxU32 maxLinks) +{ + const IG::IslandSim& islandSim = simpleIslandManager.getAccurateIslandSim(); + + const PxU32 islandCount = islandSim.getNbActiveIslands(); + + PxU32 constraintIndex = 0; + + PxU32 solverBatchMax = mSolverBatchSize; + PxU32 articulationBatchMax = mSolverArticBatchSize; + PxU32 minimumConstraintCount = 1; + + //create force threshold tasks to produce force change events + PxsForceThresholdTask* forceThresholdTask = PX_PLACEMENT_NEW(getTaskPool().allocate(sizeof(PxsForceThresholdTask)), PxsForceThresholdTask)(*this); + forceThresholdTask->setContinuation(lostTouchTask); + + const IG::IslandId*const islandIds = islandSim.getActiveIslands(); + + PxU32 currentIsland = 0; + PxU32 currentBodyIndex = 0; + PxU32 currentArticulation = 0; + PxU32 currentContact = 0; + //while(start 0) + { + PxBaseTask* task = createSolverTaskChain(*this, objectStarts, counts, + mKinematicCount + currentBodyIndex, simpleIslandManager, mSolverBodyRemapTable.begin(), mMaterialManager, forceThresholdTask, mOutputIterator, mUseEnhancedDeterminism); + task->removeReference(); + } + + currentBodyIndex += nbBodies; + currentArticulation += nbArticulations; + currentContact += nbContactManagers; + + constraintIndex += constraintCount; + } + + //kick off forceThresholdTask + forceThresholdTask->removeReference(); +} + +void DynamicsContext::updateBodyCore(PxBaseTask* continuation) +{ + PX_UNUSED(continuation); +} + +void DynamicsContext::mergeResults() +{ + PX_PROFILE_ZONE("Dynamics.solverMergeResults", mContextID); + //OK. Sum up sim stats here... + +#if PX_ENABLE_SIM_STATS + PxcThreadCoherentCacheIterator threadContextIt(mThreadContextPool); + ThreadContext* threadContext = threadContextIt.getNext(); + + while(threadContext != NULL) + { + ThreadContext::ThreadSimStats& threadStats = threadContext->getSimStats(); + addThreadStats(threadStats); + threadStats.clear(); + threadContext = threadContextIt.getNext(); + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + +static void preIntegrationParallel( + const PxF32 dt, + PxsBodyCore*const* bodyArray, // INOUT: core body attributes + PxsRigidBody*const* originalBodyArray, // IN: original bodies (LEGACY - DON'T deref the ptrs!!) + PxU32 const* nodeIndexArray, // IN: island node index + PxU32 bodyCount, // IN: body count + PxSolverBody* solverBodyPool, // IN: solver body pool (space preallocated) + PxSolverBodyData* solverBodyDataPool, // IN: solver body data pool (space preallocated) + volatile PxU32* maxSolverPositionIterations, + volatile PxU32* maxSolverVelocityIterations, + const PxVec3& gravity) +{ + PxU32 localMaxPosIter = 0; + PxU32 localMaxVelIter = 0; + + for(PxU32 a = 1; a < bodyCount; ++a) + { + PxU32 i = a-1; + PxPrefetchLine(bodyArray[a]); + PxPrefetchLine(bodyArray[a],128); + PxPrefetchLine(&solverBodyDataPool[a]); + PxPrefetchLine(&solverBodyDataPool[a],128); + + PxsBodyCore& core = *bodyArray[i]; + const PxsRigidBody& rBody = *originalBodyArray[i]; + + PxU16 iterWord = core.solverIterationCounts; + localMaxPosIter = PxMax(PxU32(iterWord & 0xff), localMaxPosIter); + localMaxVelIter = PxMax(PxU32(iterWord >> 8), localMaxVelIter); + + //const Cm::SpatialVector& accel = originalBodyArray[i]->getAccelerationV(); + bodyCoreComputeUnconstrainedVelocity(gravity, dt, core.linearDamping, core.angularDamping, rBody.accelScale, core.maxLinearVelocitySq, core.maxAngularVelocitySq, + core.linearVelocity, core.angularVelocity, core.disableGravity!=0); + + copyToSolverBodyData(core.linearVelocity, core.angularVelocity, core.inverseMass, core.inverseInertia, core.body2World, core.maxPenBias, core.maxContactImpulse, nodeIndexArray[i], + core.contactReportThreshold, solverBodyDataPool[i + 1], core.lockFlags, dt, core.mFlags & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES); + solverBodyPool[i].solverProgress = 0; + solverBodyPool[i].maxSolverNormalProgress = 0; + solverBodyPool[i].maxSolverFrictionProgress = 0; + } + const PxU32 i = bodyCount - 1; + PxsBodyCore& core = *bodyArray[i]; + const PxsRigidBody& rBody = *originalBodyArray[i]; + + PxU16 iterWord = core.solverIterationCounts; + localMaxPosIter = PxMax(PxU32(iterWord & 0xff), localMaxPosIter); + localMaxVelIter = PxMax(PxU32(iterWord >> 8), localMaxVelIter); + + bodyCoreComputeUnconstrainedVelocity(gravity, dt, core.linearDamping, core.angularDamping, rBody.accelScale, core.maxLinearVelocitySq, core.maxAngularVelocitySq, + core.linearVelocity, core.angularVelocity, core.disableGravity!=0); + + copyToSolverBodyData(core.linearVelocity, core.angularVelocity, core.inverseMass, core.inverseInertia, core.body2World, core.maxPenBias, core.maxContactImpulse, nodeIndexArray[i], + core.contactReportThreshold, solverBodyDataPool[i + 1], core.lockFlags, dt, core.mFlags & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES); + solverBodyPool[i].solverProgress = 0; + solverBodyPool[i].maxSolverNormalProgress = 0; + solverBodyPool[i].maxSolverFrictionProgress = 0; + + physx::PxAtomicMax(reinterpret_cast(maxSolverPositionIterations), PxI32(localMaxPosIter)); + physx::PxAtomicMax(reinterpret_cast(maxSolverVelocityIterations), PxI32(localMaxVelIter)); +} + +void PxsPreIntegrateTask::runInternal() +{ + { + PX_PROFILE_ZONE("PreIntegration", mContext.getContextId()); + preIntegrationParallel(mDt, mBodyArray + mStartIndex, mOriginalBodyArray + mStartIndex, mNodeIndexArray + mStartIndex, mNumToIntegrate, + mSolverBodies + mStartIndex, mSolverBodyDataPool + mStartIndex, + mMaxSolverPositionIterations, mMaxSolverVelocityIterations, mGravity); + } +} + +void DynamicsContext::preIntegrationParallel( + const PxF32 dt, + PxsBodyCore*const* bodyArray, // INOUT: core body attributes + PxsRigidBody*const* originalBodyArray, // IN: original bodies (LEGACY - DON'T deref the ptrs!!) + PxU32 const* nodeIndexArray, // IN: island node index + PxU32 bodyCount, // IN: body count + PxSolverBody* solverBodyPool, // IN: solver body pool (space preallocated) + PxSolverBodyData* solverBodyDataPool, // IN: solver body data pool (space preallocated) + Cm::SpatialVector* /*motionVelocityArray*/, // OUT: motion velocities + PxU32& maxSolverPositionIterations, + PxU32& maxSolverVelocityIterations, + PxBaseTask& task + ) +{ + //TODO - make this based on some variables so we can try different configurations + const PxU32 IntegrationPerThread = 256; + + const PxU32 numTasks = ((bodyCount + IntegrationPerThread-1)/IntegrationPerThread); + const PxU32 taskBatchSize = 64; + + for(PxU32 i = 0; i < numTasks; i+=taskBatchSize) + { + const PxU32 nbTasks = PxMin(numTasks - i, taskBatchSize); + PxsPreIntegrateTask* tasks = reinterpret_cast(getTaskPool().allocate(sizeof(PxsPreIntegrateTask)*nbTasks)); + for(PxU32 a = 0; a < nbTasks; ++a) + { + PxU32 startIndex = (i+a)*IntegrationPerThread; + PxU32 nbToIntegrate = PxMin((bodyCount-startIndex), IntegrationPerThread); + PxsPreIntegrateTask* pTask = PX_PLACEMENT_NEW(&tasks[a], PxsPreIntegrateTask)(*this, bodyArray, + originalBodyArray, nodeIndexArray, solverBodyPool, solverBodyDataPool, dt, bodyCount, + &maxSolverPositionIterations, &maxSolverVelocityIterations, startIndex, + nbToIntegrate, mGravity); + + pTask->setContinuation(&task); + pTask->removeReference(); + } + } + + PxMemZero(solverBodyPool, bodyCount * sizeof(PxSolverBody)); +} + +inline void WaitBodyRequiredState(volatile PxU32* state, PxU32 requiredState) +{ + while(requiredState != *state ); +} + +void solveParallel(SOLVER_PARALLEL_METHOD_ARGS) +{ + Dy::ThreadContext& threadContext = *context.getThreadContext(); + threadContext.mZVector.forceSize_Unsafe(0); + threadContext.mZVector.reserve(params.mMaxArticulationLinks); + threadContext.mZVector.forceSize_Unsafe(params.mMaxArticulationLinks); + + threadContext.mDeltaV.forceSize_Unsafe(0); + threadContext.mDeltaV.reserve(params.mMaxArticulationLinks); + threadContext.mDeltaV.forceSize_Unsafe(params.mMaxArticulationLinks); + + context.solveParallel(params, islandSim, threadContext.mZVector.begin(), threadContext.mDeltaV.begin()); + + context.putThreadContext(&threadContext); +} + +void DynamicsContext::solveParallel(SolverIslandParams& params, IG::IslandSim& islandSim, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) +{ + PxI32 targetCount = mSolverCore[mFrictionType]->solveVParallelAndWriteBack(params, Z, deltaV); + + PxI32* solveCount = ¶ms.constraintIndex2; + + //PxI32 targetCount = (PxI32)(params.numConstraintHeaders * (params.velocityIterations + params.positionIterations)); + + WAIT_FOR_PROGRESS_NO_TIMER(solveCount, targetCount); + + integrateCoreParallel(params, deltaV, islandSim); +} + +void DynamicsContext::integrateCoreParallel(SolverIslandParams& params, Cm::SpatialVectorF* deltaV, IG::IslandSim& islandSim) +{ + const PxI32 unrollCount = 128; + + PxI32* bodyIntegrationListIndex = ¶ms.bodyIntegrationListIndex; + + PxI32 index = physx::PxAtomicAdd(bodyIntegrationListIndex, unrollCount) - unrollCount; + + const PxI32 numBodies = PxI32(params.bodyListSize); + const PxI32 numArtics = PxI32(params.articulationListSize); + + Cm::SpatialVector* PX_RESTRICT motionVelocityArray = params.motionVelocityArray; + PxsBodyCore*const* bodyArray = params.bodyArray; + PxsRigidBody** PX_RESTRICT rigidBodies = params.rigidBodies; + ArticulationSolverDesc* PX_RESTRICT articulationListStart = params.articulationListStart; + + PxI32 numIntegrated = 0; + + PxI32 bodyRemainder = unrollCount; + + while(index < numArtics) + { + const PxI32 remainder = PxMin(numArtics - index, unrollCount); + bodyRemainder -= remainder; + + for(PxI32 a = 0; a < remainder; ++a, index++) + { + const PxI32 i = index; + { + //PX_PROFILE_ZONE("Articulations.integrate", mContextID); + + ArticulationPImpl::updateBodies(articulationListStart[i], deltaV, mDt); + } + + ++numIntegrated; + } + if(bodyRemainder == 0) + { + index = physx::PxAtomicAdd(bodyIntegrationListIndex, unrollCount) - unrollCount; + bodyRemainder = unrollCount; + } + } + + index -= numArtics; + + const PxI32 unrollPlusArtics = unrollCount + numArtics; + + PxSolverBody* PX_RESTRICT solverBodies = params.bodyListStart; + PxSolverBodyData* PX_RESTRICT solverBodyData = params.bodyDataList + params.solverBodyOffset+1; + + while(index < numBodies) + { + const PxI32 remainder = PxMin(numBodies - index, bodyRemainder); + bodyRemainder -= remainder; + for(PxI32 a = 0; a < remainder; ++a, index++) + { + const PxI32 prefetch = PxMin(index+4, numBodies - 1); + PxPrefetchLine(bodyArray[prefetch]); + PxPrefetchLine(bodyArray[prefetch],128); + PxPrefetchLine(&solverBodies[index],128); + PxPrefetchLine(&motionVelocityArray[index],128); + PxPrefetchLine(&bodyArray[index+32]); + PxPrefetchLine(&rigidBodies[prefetch]); + + PxSolverBodyData& data = solverBodyData[index]; + PxsRigidBody& rBody = *rigidBodies[index]; + PxsBodyCore& core = rBody.getCore(); + + + + integrateCore(motionVelocityArray[index].linear, motionVelocityArray[index].angular, + solverBodies[index], data, mDt, core.lockFlags); + + + rBody.mLastTransform = core.body2World; + core.body2World = data.body2World; + core.linearVelocity = data.linearVelocity; + core.angularVelocity = data.angularVelocity; + + bool hasStaticTouch = islandSim.getIslandStaticTouchCount(PxNodeIndex(data.nodeIndex)) != 0; + sleepCheck(rigidBodies[index], mDt, mInvDt, mEnableStabilization, motionVelocityArray[index], hasStaticTouch); + + ++numIntegrated; + } + + { + index = physx::PxAtomicAdd(bodyIntegrationListIndex, unrollCount) - unrollPlusArtics; + bodyRemainder = unrollCount; + } + } + + PxMemoryBarrier(); + physx::PxAtomicAdd(¶ms.numObjectsIntegrated, numIntegrated); +} + +static PxU32 createFinalizeContacts_Parallel(PxSolverBodyData* solverBodyData, ThreadContext& mThreadContext, DynamicsContext& context, + PxU32 startIndex, PxU32 endIndex, PxsContactManagerOutputIterator& outputs) +{ + PX_PROFILE_ZONE("createFinalizeContacts_Parallel", context.getContextId()); + const PxFrictionType::Enum frictionType = context.getFrictionType(); + const PxReal correlationDist = context.getCorrelationDistance(); + const PxReal bounceThreshold = context.getBounceThreshold(); + const PxReal frictionOffsetThreshold = context.getFrictionOffsetThreshold(); + const PxReal dt = context.getDt(); + const PxReal invDt = PxMin(context.getMaxBiasCoefficient(), context.getInvDt()); + + PxSolverConstraintDesc* contactDescPtr = mThreadContext.orderedContactConstraints; + + PxConstraintBatchHeader* headers = mThreadContext.contactConstraintBatchHeaders; + + PxI32 axisConstraintCount = 0; + ThreadContext* threadContext = context.getThreadContext(); + threadContext->mConstraintBlockStream.reset(); //ensure there's no left-over memory that belonged to another island + + threadContext->mZVector.forceSize_Unsafe(0); + threadContext->mZVector.reserve(mThreadContext.mMaxArticulationLinks); + threadContext->mZVector.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks); + + //threadContext->mDeltaV.forceSize_Unsafe(0); + //threadContext->mDeltaV.reserve(mThreadContext.mMaxArticulationLinks); + //threadContext->mDeltaV.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks); + + Cm::SpatialVectorF* Z = threadContext->mZVector.begin(); + + PxTransform idt(PxIdentity); + + BlockAllocator blockAllocator(mThreadContext.mConstraintBlockManager, threadContext->mConstraintBlockStream, threadContext->mFrictionPatchStreamPair, threadContext->mConstraintSize); + + const PxReal ccdMaxSeparation = context.getCCDSeparationThreshold(); + + for(PxU32 a = startIndex; a < endIndex; ++a) + { + PxConstraintBatchHeader& header = headers[a]; + + if(contactDescPtr[header.startIndex].constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT) + { + PxSolverContactDesc blockDescs[4]; + PxsContactManagerOutput* cmOutputs[4]; + PxsContactManager* cms[4]; + for (PxU32 i = 0; i < header.stride; ++i) + { + PxSolverConstraintDesc& desc = contactDescPtr[header.startIndex + i]; + PxSolverContactDesc& blockDesc = blockDescs[i]; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + + cms[i] = cm; + + PxcNpWorkUnit& unit = cm->getWorkUnit(); + + cmOutputs[i] = &outputs.getContactManager(unit.mNpIndex); + + PxSolverBodyData& data0 = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyADataIndex]; + PxSolverBodyData& data1 = desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyBDataIndex]; + + blockDesc.data0 = &data0; + blockDesc.data1 = &data1; + + PxU8 flags = unit.rigidCore0->mFlags; + if (unit.rigidCore1) + flags |= PxU8(unit.rigidCore1->mFlags); + + blockDesc.bodyFrame0 = unit.rigidCore0->body2World; + blockDesc.bodyFrame1 = unit.rigidCore1 ? unit.rigidCore1->body2World : idt; + blockDesc.shapeInteraction = cm->getShapeInteraction(); + blockDesc.contactForces = cmOutputs[i]->contactForces; + blockDesc.desc = &desc; + blockDesc.body0 = desc.bodyA; + blockDesc.body1 = desc.bodyB; + blockDesc.hasForceThresholds = !!(unit.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD); + blockDesc.disableStrongFriction = !!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION); + blockDesc.bodyState0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? PxSolverContactDesc::eARTICULATION : PxSolverContactDesc::eDYNAMIC_BODY; + //second body is articulation + if (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) + { + //kinematic link + if (desc.linkIndexB == 0xff) + { + blockDesc.bodyState1 = PxSolverContactDesc::eSTATIC_BODY; + } + else + { + blockDesc.bodyState1 = PxSolverContactDesc::eARTICULATION; + } + } + else + { + blockDesc.bodyState1 = (unit.flags & PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR) ? PxSolverContactDesc::eKINEMATIC_BODY : + ((unit.flags & PxcNpWorkUnitFlag::eDYNAMIC_BODY1) ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eSTATIC_BODY); + } + //blockDesc.flags = unit.flags; + + PxReal dominance0 = unit.dominance0 ? 1.f : 0.f; + PxReal dominance1 = unit.dominance1 ? 1.f : 0.f; + + blockDesc.invMassScales.linear0 = blockDesc.invMassScales.angular0 = dominance0; + blockDesc.invMassScales.linear1 = blockDesc.invMassScales.angular1 = dominance1; + blockDesc.restDistance = unit.restDistance; + blockDesc.frictionPtr = unit.frictionDataPtr; + blockDesc.frictionCount = unit.frictionPatchCount; + blockDesc.maxCCDSeparation = (flags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) ? ccdMaxSeparation : PX_MAX_F32; + blockDesc.offsetSlop = unit.mOffsetSlop; + } + +#if DY_BATCH_CONSTRAINTS + SolverConstraintPrepState::Enum state = SolverConstraintPrepState::eUNBATCHABLE; + if(header.stride == 4) + { + //KS - todo - plumb in axisConstraintCount into this method to keep track of the number of axes + state = createFinalizeMethods4[frictionType](cmOutputs, *threadContext, + blockDescs, + invDt, + dt, + bounceThreshold, + frictionOffsetThreshold, + correlationDist, + blockAllocator); + + } + if(SolverConstraintPrepState::eSUCCESS != state) +#endif + { + for(PxU32 i = 0; i < header.stride; ++i) + { + PxSolverConstraintDesc& desc = contactDescPtr[header.startIndex+i]; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + PxcNpWorkUnit& n = cm->getWorkUnit(); + + PxsContactManagerOutput& output = outputs.getContactManager(n.mNpIndex); + + createFinalizeMethods[frictionType](blockDescs[i], output, *threadContext, + invDt, dt, bounceThreshold, frictionOffsetThreshold, correlationDist, + blockAllocator, Z); + + getContactManagerConstraintDesc(output,*cm,desc); + } + } + + for (PxU32 i = 0; i < header.stride; ++i) + { + PxsContactManager* cm = cms[i]; + + PxcNpWorkUnit& unit = cm->getWorkUnit(); + unit.frictionDataPtr = blockDescs[i].frictionPtr; + unit.frictionPatchCount = blockDescs[i].frictionCount; + axisConstraintCount += blockDescs[i].axisConstraintCount; + + } + } + else if(contactDescPtr[header.startIndex].constraintLengthOver16 == DY_SC_TYPE_RB_1D) + { + SolverConstraintShaderPrepDesc shaderDescs[4]; + PxSolverConstraintPrepDesc descs[4]; + + const PxTransform id(PxIdentity); + + for (PxU32 i = 0; i < header.stride; ++i) + { + PxSolverConstraintDesc& desc = contactDescPtr[header.startIndex + i]; + const Constraint* constraint = reinterpret_cast(desc.constraint); + + SolverConstraintShaderPrepDesc& shaderPrepDesc = shaderDescs[i]; + PxSolverConstraintPrepDesc& prepDesc = descs[i]; + + const PxConstraintSolverPrep solverPrep = constraint->solverPrep; + const void* constantBlock = constraint->constantBlock; + const PxU32 constantBlockByteSize = constraint->constantBlockSize; + const PxTransform& pose0 = (constraint->body0 ? constraint->body0->getPose() : id); + const PxTransform& pose1 = (constraint->body1 ? constraint->body1->getPose() : id); + const PxSolverBody* sbody0 = desc.bodyA; + const PxSolverBody* sbody1 = desc.bodyB; + PxSolverBodyData* sbodyData0 = &solverBodyData[desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY ? desc.bodyADataIndex : 0]; + PxSolverBodyData* sbodyData1 = &solverBodyData[desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY ? desc.bodyBDataIndex : 0]; + + shaderPrepDesc.constantBlock = constantBlock; + shaderPrepDesc.constantBlockByteSize = constantBlockByteSize; + shaderPrepDesc.constraint = constraint; + shaderPrepDesc.solverPrep = solverPrep; + + prepDesc.desc = &desc; + prepDesc.bodyFrame0 = pose0; + prepDesc.bodyFrame1 = pose1; + prepDesc.data0 = sbodyData0; + prepDesc.data1 = sbodyData1; + prepDesc.body0 = sbody0; + prepDesc.body1 = sbody1; + prepDesc.linBreakForce = constraint->linBreakForce; + prepDesc.angBreakForce = constraint->angBreakForce; + prepDesc.writeback = &context.getConstraintWriteBackPool()[constraint->index]; + setupConstraintFlags(prepDesc, constraint->flags); + prepDesc.minResponseThreshold = constraint->minResponseThreshold; + } + +#if DY_BATCH_CONSTRAINTS && DY_BATCH_1D + SolverConstraintPrepState::Enum state = SolverConstraintPrepState::eUNBATCHABLE; + if(header.stride == 4) + { + PxU32 totalRows; + state = setupSolverConstraint4 + (shaderDescs, descs, dt, invDt, totalRows, + blockAllocator); + + axisConstraintCount += totalRows; + } + if(state != SolverConstraintPrepState::eSUCCESS) +#endif + { + for(PxU32 i = 0; i < header.stride; ++i) + { + axisConstraintCount += SetupSolverConstraint(shaderDescs[i], descs[i], blockAllocator, dt, invDt, Z); + } + } + } + } + +#if PX_ENABLE_SIM_STATS + threadContext->getSimStats().numAxisSolverConstraints += axisConstraintCount; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + context.putThreadContext(threadContext); + return PxU32(axisConstraintCount); //Can't write to mThreadContext as it's shared!!!! +} + +class PxsCreateFinalizeContactsTask : public Cm::Task +{ + PxsCreateFinalizeContactsTask& operator=(const PxsCreateFinalizeContactsTask&); +public: + PxsCreateFinalizeContactsTask( const PxU32 numConstraints, PxSolverConstraintDesc* descArray, PxSolverBodyData* solverBodyData, + ThreadContext& threadContext, DynamicsContext& context, PxU32 startIndex, PxU32 endIndex, PxsContactManagerOutputIterator& outputs) : + Cm::Task(context.getContextId()), + mNumConstraints(numConstraints), mDescArray(descArray), mSolverBodyData(solverBodyData), + mThreadContext(threadContext), mDynamicsContext(context), + mOutputs(outputs), + mStartIndex(startIndex), mEndIndex(endIndex) + {} + + virtual void runInternal() + { + createFinalizeContacts_Parallel(mSolverBodyData, mThreadContext, mDynamicsContext, mStartIndex, mEndIndex, mOutputs); + } + + virtual const char* getName() const + { + return "PxsDynamics.createFinalizeContacts"; + } + +public: + const PxU32 mNumConstraints; + PxSolverConstraintDesc* mDescArray; + PxSolverBodyData* mSolverBodyData; + ThreadContext& mThreadContext; + DynamicsContext& mDynamicsContext; + PxsContactManagerOutputIterator& mOutputs; + PxU32 mStartIndex; + PxU32 mEndIndex; +}; + +PxU8* BlockAllocator::reserveConstraintData(const PxU32 size) +{ + mTotalConstraintByteSize += size; + return mConstraintBlockStream.reserve(size, mConstraintBlockManager); +} + +PxU8* BlockAllocator::reserveFrictionData(const PxU32 size) +{ + return mFrictionPatchStreamPair.reserve(size); +} + +class PxsCreateArticConstraintsTask : public Cm::Task +{ + PxsCreateArticConstraintsTask& operator=(const PxsCreateArticConstraintsTask&); + +public: + + static const PxU32 NbArticsPerTask = 32; + + PxsCreateArticConstraintsTask(Dy::FeatherstoneArticulation** articulations, const PxU32 nbArticulations, PxSolverBodyData* solverBodyData, ThreadContext& threadContext, DynamicsContext& context, + PxsContactManagerOutputIterator& outputs) : + Cm::Task(context.getContextId()), + mArticulations(articulations), + mNbArticulations(nbArticulations), + mSolverBodyData(solverBodyData), + mThreadContext(threadContext), mDynamicsContext(context), + mOutputs(outputs) + {} + + virtual void runInternal() + { + const PxReal correlationDist = mDynamicsContext.getCorrelationDistance(); + const PxReal bounceThreshold = mDynamicsContext.getBounceThreshold(); + const PxReal frictionOffsetThreshold = mDynamicsContext.getFrictionOffsetThreshold(); + const PxReal dt = mDynamicsContext.getDt(); + const PxReal invDt = PxMin(mDynamicsContext.getMaxBiasCoefficient(), mDynamicsContext.getInvDt()); + const PxReal ccdMaxSeparation = mDynamicsContext.getCCDSeparationThreshold(); + + ThreadContext* threadContext = mDynamicsContext.getThreadContext(); + threadContext->mConstraintBlockStream.reset(); //ensure there's no left-over memory that belonged to another island + + threadContext->mZVector.forceSize_Unsafe(0); + threadContext->mZVector.reserve(mThreadContext.mMaxArticulationLinks); + threadContext->mZVector.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks); + + for (PxU32 i = 0; i < mNbArticulations; ++i) + { + mArticulations[i]->prepareStaticConstraints(dt, invDt, mOutputs, *threadContext, correlationDist, bounceThreshold, frictionOffsetThreshold, + ccdMaxSeparation, mSolverBodyData, mThreadContext.mConstraintBlockManager, mDynamicsContext.getConstraintWriteBackPool().begin()); + } + + mDynamicsContext.putThreadContext(threadContext); + } + + virtual const char* getName() const + { + return "PxsDynamics.createFinalizeContacts"; + } + +public: + + Dy::FeatherstoneArticulation** mArticulations; + PxU32 mNbArticulations; + PxSolverBodyData* mSolverBodyData; + ThreadContext& mThreadContext; + DynamicsContext& mDynamicsContext; + PxsContactManagerOutputIterator& mOutputs; +}; + +void PxsSolverCreateFinalizeConstraintsTask::runInternal() +{ + PX_PROFILE_ZONE("CreateConstraints", mContext.getContextId()); + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + PxU32 descCount = mThreadContext.mNumDifferentBodyConstraints; + PxU32 selfConstraintDescCount = mThreadContext.contactDescArraySize - (mThreadContext.mNumDifferentBodyConstraints + mThreadContext.mNumStaticConstraints); + + PxArray& accumulatedConstraintsPerPartition = mThreadContext.mConstraintsPerPartition; + + PxU32 numHeaders = 0; + PxU32 currentPartition = 0; + PxU32 maxJ = descCount == 0 ? 0 : accumulatedConstraintsPerPartition[0]; + + const PxU32 maxBatchPartition = 0xFFFFFFFF; + + const PxU32 maxBatchSize = mEnhancedDeterminism ? 1u : 4u; + + PxU32 headersPerPartition = 0; + for(PxU32 a = 0; a < descCount;) + { + PxU32 loopMax = PxMin(maxJ - a, maxBatchSize); + PxU16 j = 0; + if(loopMax > 0) + { + PxConstraintBatchHeader& header = mThreadContext.contactConstraintBatchHeaders[numHeaders++]; + + j=1; + PxSolverConstraintDesc& desc = mThreadContext.orderedContactConstraints[a]; + if(!isArticulationConstraint(desc) && (desc.constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT || + desc.constraintLengthOver16 == DY_SC_TYPE_RB_1D) && currentPartition < maxBatchPartition) + { + for(; j < loopMax && desc.constraintLengthOver16 == mThreadContext.orderedContactConstraints[a+j].constraintLengthOver16 && + !isArticulationConstraint(mThreadContext.orderedContactConstraints[a+j]); ++j); + } + header.startIndex = a; + header.stride = j; + headersPerPartition++; + } + if(maxJ == (a + j) && maxJ != descCount) + { + //Go to next partition! + accumulatedConstraintsPerPartition[currentPartition] = headersPerPartition; + headersPerPartition = 0; + currentPartition++; + maxJ = accumulatedConstraintsPerPartition[currentPartition]; + } + a+= j; + } + if(descCount) + accumulatedConstraintsPerPartition[currentPartition] = headersPerPartition; + + accumulatedConstraintsPerPartition.forceSize_Unsafe(mThreadContext.mMaxPartitions); + + PxU32 numDifferentBodyBatchHeaders = numHeaders; + + for(PxU32 a = 0; a < selfConstraintDescCount; ++a) + { + PxConstraintBatchHeader& header = mThreadContext.contactConstraintBatchHeaders[numHeaders++]; + header.startIndex = a + descCount; + header.stride = 1; + } + + PxU32 numSelfConstraintBatchHeaders = numHeaders - numDifferentBodyBatchHeaders; + + mThreadContext.numDifferentBodyBatchHeaders = numDifferentBodyBatchHeaders; + mThreadContext.numSelfConstraintBatchHeaders = numSelfConstraintBatchHeaders; + mThreadContext.numContactConstraintBatches = numHeaders; + + { + PxSolverConstraintDesc* descBegin = mThreadContext.orderedContactConstraints; + + const PxU32 numThreads = getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + //Choose an appropriate number of constraint prep tasks. This must be proportionate to the number of constraints to prep and the number + //of worker threads available. + const PxU32 TaskBlockSize = 16; + const PxU32 TaskBlockLargeSize = 64; + const PxU32 BlockAllocationSize = 64; + + PxU32 numTasks = (numHeaders+TaskBlockLargeSize-1)/TaskBlockLargeSize; + + if(numTasks) + { + if(numTasks < numThreads) + numTasks = PxMax(1u, (numHeaders+TaskBlockSize-1)/TaskBlockSize); + + const PxU32 constraintsPerTask = (numHeaders + numTasks-1)/numTasks; + + for(PxU32 i = 0; i < numTasks; i+=BlockAllocationSize) + { + PxU32 blockSize = PxMin(numTasks - i, BlockAllocationSize); + + PxsCreateFinalizeContactsTask* tasks = reinterpret_cast(mContext.getTaskPool().allocate(sizeof(PxsCreateFinalizeContactsTask)*blockSize)); + + for(PxU32 a = 0; a < blockSize; ++a) + { + PxU32 startIndex = (a + i) * constraintsPerTask; + PxU32 endIndex = PxMin(startIndex + constraintsPerTask, numHeaders); + PxsCreateFinalizeContactsTask* pTask = PX_PLACEMENT_NEW(&tasks[a], PxsCreateFinalizeContactsTask( descCount, descBegin, mContext.mSolverBodyDataPool.begin(), mThreadContext, mContext, startIndex, endIndex, mOutputs)); + + pTask->setContinuation(mCont); + pTask->removeReference(); + } + } + } + } + + const PxU32 articCount = mIslandContext.mCounts.articulations; + + for (PxU32 i = 0; i < articCount; i += PxsCreateArticConstraintsTask::NbArticsPerTask) + { + const PxU32 nbToProcess = PxMin(articCount - i, PxsCreateArticConstraintsTask::NbArticsPerTask); + + PxsCreateArticConstraintsTask* task = PX_PLACEMENT_NEW(mContext.getTaskPool().allocate(sizeof(PxsCreateArticConstraintsTask)), PxsCreateArticConstraintsTask) + (mThreadContext.mArticulationArray + i, nbToProcess, mContext.mSolverBodyDataPool.begin(), mThreadContext, mContext, mOutputs); + + task->setContinuation(mCont); + task->removeReference(); + } +} + +} +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.h new file mode 100644 index 0000000..6bde025 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyDynamics.h @@ -0,0 +1,483 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_DYNAMICS_H +#define DY_DYNAMICS_H + +#include "PxvConfig.h" +#include "CmSpatialVector.h" +#include "CmTask.h" +#include "CmPool.h" +#include "PxcThreadCoherentCache.h" +#include "DyThreadContext.h" +#include "PxcConstraintBlockStream.h" +#include "DySolverBody.h" +#include "DyContext.h" +#include "PxsIslandManagerTypes.h" +#include "PxvNphaseImplementationContext.h" +#include "solver/PxSolverDefs.h" + +namespace physx +{ + +namespace Cm +{ + class FlushPool; +} + +namespace IG +{ + class SimpleIslandManager; + struct Edge; +} + +class PxsRigidBody; + +struct PxsBodyCore; +class PxsIslandIndices; +struct PxsIndexedInteraction; +struct PxsIndexedContactManager; +struct PxSolverConstraintDesc; + +namespace Cm +{ + class SpatialVector; +} + +namespace Dy +{ + class SolverCore; + struct SolverIslandParams; + struct ArticulationSolverDesc; + class Articulation; + class DynamicsContext; + + + + +#define SOLVER_PARALLEL_METHOD_ARGS \ + DynamicsContext& context, \ + SolverIslandParams& params, \ + IG::IslandSim& islandSim + +//typedef void (*PxsSolveParallelMethod)(SOLVER_PARALLEL_METHOD_ARGS); +//extern PxsSolveParallelMethod solveParallel[3]; + +void solveParallel(SOLVER_PARALLEL_METHOD_ARGS); +void solveParallelCouloumFriction(SOLVER_PARALLEL_METHOD_ARGS); + + +struct SolverIslandObjects; + +/** +\brief Solver body pool (array) that enforces 128-byte alignment for base address of array. +\note This reduces cache misses on platforms with 128-byte-size cache lines by aligning the start of the array to the beginning of a cache line. +*/ +class SolverBodyPool : public PxArray > > +{ + PX_NOCOPY(SolverBodyPool) +public: + SolverBodyPool() {} +}; + +/** +\brief Solver body data pool (array) that enforces 128-byte alignment for base address of array. +\note This reduces cache misses on platforms with 128-byte-size cache lines by aligning the start of the array to the beginning of a cache line. +*/ +class SolverBodyDataPool : public PxArray > > +{ + PX_NOCOPY(SolverBodyDataPool) +public: + SolverBodyDataPool() {} +}; + +class SolverConstraintDescPool : public PxArray > > +{ + PX_NOCOPY(SolverConstraintDescPool) +public: + SolverConstraintDescPool() { } +}; + +/** +\brief Encapsulates an island's context +*/ + +struct IslandContext +{ + //The thread context for this island (set in in the island start task, released in the island end task) + ThreadContext* mThreadContext; + PxsIslandIndices mCounts; +}; + + +/** +\brief Encapsules the data used by the constraint solver. +*/ + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + +class DynamicsContext : public Context +{ + PX_NOCOPY(DynamicsContext) +public: + + /** + \brief Creates a DynamicsContext associated with a PxsContext + \return A pointer to the newly-created DynamicsContext. + */ + static DynamicsContext* create( PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocator, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, + const bool frictionEveryIteration, + const PxReal lengthScale + ); + + /** + \brief Destroys this DynamicsContext + */ + void destroy(); + + /** + \brief Returns the static world solver body + \return The static world solver body. + */ + PX_FORCE_INLINE PxSolverBody& getWorldSolverBody() { return mWorldSolverBody; } + + PX_FORCE_INLINE Cm::FlushPool& getTaskPool() { return mTaskPool; } + + PX_FORCE_INLINE ThresholdStream& getThresholdStream() { return *mThresholdStream; } + + PX_FORCE_INLINE PxvSimStats& getSimStats() { return mSimStats; } + +#if PX_ENABLE_SIM_STATS + void addThreadStats(const ThreadContext::ThreadSimStats& stats); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + /** + \brief The entry point for the constraint solver. + \param[in] dt The simulation time-step + \param[in] continuation The continuation task for the solver + + This method is called after the island generation has completed. Its main responsibilities are: + (1) Reserving the solver body pools + (2) Initializing the static and kinematic solver bodies, which are shared resources between islands. + (3) Construct the solver task chains for each island + + Each island is solved as an independent solver task chain in parallel. + + */ + + virtual void update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask, + PxvNphaseImplementationContext* nPhase, const PxU32 maxPatchesPerCM, const PxU32 maxArticulationLinks, const PxReal dt, const PxVec3& gravity, PxBitMapPinned& changedHandleMap); + + + void updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask, const PxU32 maxLinks); + + virtual void processLostPatches(IG::SimpleIslandManager& /*simpleIslandManager*/, PxsContactManager** /*lostPatchManagers*/, PxU32 /*nbLostPatchManagers*/, PxsContactManagerOutputCounts* /*outCounts*/){} + virtual void processFoundPatches(IG::SimpleIslandManager& /*simpleIslandManager*/, PxsContactManager** /*foundPatchManagers*/, PxU32 /*nbFoundPatchManagers*/, PxsContactManagerOutputCounts* /*outCounts*/) {} + + virtual void updateBodyCore(PxBaseTask* continuation); + + virtual void setSimulationController(PxsSimulationController* simulationController ){ mSimulationController = simulationController; } + /** + \brief This method combines the results of several islands, e.g. constructing scene-level simulation statistics and merging together threshold streams for contact notification. + */ + virtual void mergeResults(); + + virtual void getDataStreamBase(void*& /*contactStreamBase*/, void*& /*patchStreamBase*/, void*& /*forceAndIndicesStreamBase*/){} + + virtual PxSolverType::Enum getSolverType() const { return PxSolverType::ePGS; } + + /** + \brief Allocates and returns a thread context object. + \return A thread context. + */ + PX_FORCE_INLINE ThreadContext* getThreadContext() + { + return mThreadContextPool.get(); + } + + /** + \brief Returns a thread context to the thread context pool. + \param[in] context The thread context to return to the thread context pool. + */ + void putThreadContext(ThreadContext* context) + { + mThreadContextPool.put(context); + } + + + PX_FORCE_INLINE PxU32 getKinematicCount() const { return mKinematicCount; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + +protected: + + /** + \brief Constructor for DynamicsContext + */ + DynamicsContext(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocator, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal maxBiasCoefficient, + const bool frictionEveryIteration, + const PxReal lengthScale + ); + /** + \brief Destructor for DynamicsContext + */ + virtual ~DynamicsContext(); + + + // Solver helper-methods + /** + \brief Computes the unconstrained velocity for a given PxsRigidBody + \param[in] atom The PxsRigidBody + */ + void computeUnconstrainedVelocity(PxsRigidBody* atom) const; + + /** + \brief fills in a PxSolverConstraintDesc from an indexed interaction + \param[in,out] desc The PxSolverConstraintDesc + \param[in] constraint The PxsIndexedInteraction + */ + void setDescFromIndices(PxSolverConstraintDesc& desc, const IG::IslandSim& islandSim, + const PxsIndexedInteraction& constraint, const PxU32 solverBodyOffset); + + + void setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeIndex edgeIndex, + const IG::SimpleIslandManager& islandManager, PxU32* bodyRemapTable, const PxU32 solverBodyOffset); + + /** + \brief Compute the unconstrained velocity for set of bodies in parallel. This function may spawn additional tasks. + \param[in] dt The timestep + \param[in] bodyArray The array of body cores + \param[in] originalBodyArray The array of PxsRigidBody + \param[in] nodeIndexArray The array of island node index + \param[in] bodyCount The number of bodies + \param[out] solverBodyPool The pool of solver bodies. These are synced with the corresponding body in bodyArray. + \param[out] solverBodyDataPool The pool of solver body data. These are synced with the corresponding body in bodyArray + \param[out] motionVelocityArray The motion velocities for the bodies + \param[out] maxSolverPositionIterations The maximum number of position iterations requested by any body in the island + \param[out] maxSolverVelocityIterations The maximum number of velocity iterations requested by any body in the island + \param[out] integrateTask The continuation task for any tasks spawned by this function. + */ + void preIntegrationParallel( + const PxF32 dt, + PxsBodyCore*const* bodyArray, // INOUT: core body attributes + PxsRigidBody*const* originalBodyArray, // IN: original body atom names (LEGACY - DON'T deref the ptrs!!) + PxU32 const* nodeIndexArray, // IN: island node index + PxU32 bodyCount, // IN: body count + PxSolverBody* solverBodyPool, // IN: solver atom pool (space preallocated) + PxSolverBodyData* solverBodyDataPool, + Cm::SpatialVector* motionVelocityArray, // OUT: motion velocities + PxU32& maxSolverPositionIterations, + PxU32& maxSolverVelocityIterations, + PxBaseTask& integrateTask + ); + + /** + \brief Solves an island in parallel. + + \param[in] params Solver parameter structure + */ + + void solveParallel(SolverIslandParams& params, IG::IslandSim& islandSim, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV); + + + + void integrateCoreParallel(SolverIslandParams& params, Cm::SpatialVectorF* deltaV, IG::IslandSim& islandSim); + + + + + /** + \brief Resets the thread contexts + */ + void resetThreadContexts(); + + /** + \brief Returns the scratch memory allocator. + \return The scratch memory allocator. + */ + PX_FORCE_INLINE PxcScratchAllocator& getScratchAllocator() { return mScratchAllocator; } + + //Data + + /** + \brief Body to represent the world static body. + */ + PX_ALIGN(16, PxSolverBody mWorldSolverBody); + /** + \brief Body data to represent the world static body. + */ + PX_ALIGN(16, PxSolverBodyData mWorldSolverBodyData); + + /** + \brief A thread context pool + */ + PxcThreadCoherentCache mThreadContextPool; + + /** + \brief Solver constraint desc array + */ + SolverConstraintDescPool mSolverConstraintDescPool; + + /** + \brief Ordered sover constraint desc array (after partitioning) + */ + SolverConstraintDescPool mOrderedSolverConstraintDescPool; + + /** + \brief A temporary array of constraint descs used for partitioning + */ + SolverConstraintDescPool mTempSolverConstraintDescPool; + + /** + \brief An array of contact constraint batch headers + */ + PxArray mContactConstraintBatchHeaders; + + /** + \brief Array of motion velocities for all bodies in the scene. + */ + PxArray mMotionVelocityArray; + + /** + \brief Array of body core pointers for all bodies in the scene. + */ + PxArray mBodyCoreArray; + + /** + \brief Array of rigid body pointers for all bodies in the scene. + */ + PxArray mRigidBodyArray; + + /** + \brief Array of articulation pointers for all articulations in the scene. + */ + PxArray mArticulationArray; + + /** + \brief Global pool for solver bodies. Kinematic bodies are at the start, and then dynamic bodies + */ + SolverBodyPool mSolverBodyPool; + /** + \brief Global pool for solver body data. Kinematic bodies are at the start, and then dynamic bodies + */ + SolverBodyDataPool mSolverBodyDataPool; + + + ThresholdStream* mExceededForceThresholdStream[2]; //this store previous and current exceeded force thresholdStream + + PxArray mExceededForceThresholdStreamMask; + + /** + \brief Interface to the solver core. + \note We currently only support PxsSolverCoreSIMD. Other cores may be added in future releases. + */ + SolverCore* mSolverCore[PxFrictionType::eFRICTION_COUNT]; + + PxArray mSolverBodyRemapTable; //Remaps from the "active island" index to the index within a solver island + + PxArray mNodeIndexArray; //island node index + + PxArray mContactList; + + /** + \brief The total number of kinematic bodies in the scene + */ + PxU32 mKinematicCount; + + /** + \brief Atomic counter for the number of threshold stream elements. + */ + PxI32 mThresholdStreamOut; + + + + PxsMaterialManager* mMaterialManager; + + PxsContactManagerOutputIterator mOutputIterator; + +private: + //private: + PxcScratchAllocator& mScratchAllocator; + Cm::FlushPool& mTaskPool; + PxTaskManager* mTaskManager; + PxU32 mCurrentIndex; // this is the index point to the current exceeded force threshold stream + + PxU64 mContextID; + + protected: + + friend class PxsSolverStartTask; + friend class PxsSolverAticulationsTask; + friend class PxsSolverSetupConstraintsTask; + friend class PxsSolverCreateFinalizeConstraintsTask; + friend class PxsSolverConstraintPartitionTask; + friend class PxsSolverSetupSolveTask; + friend class PxsSolverIntegrateTask; + friend class PxsSolverEndTask; + friend class PxsSolverConstraintPostProcessTask; + friend class PxsForceThresholdTask; + friend class SolverArticulationUpdateTask; + + friend void solveParallel(SOLVER_PARALLEL_METHOD_ARGS); +}; + +#if PX_VC + #pragma warning(pop) +#endif + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp new file mode 100644 index 0000000..0e376a0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulation.cpp @@ -0,0 +1,5620 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMathUtils.h" +#include "CmConeLimitHelper.h" +#include "DySolverConstraint1D.h" +#include "DyFeatherstoneArticulation.h" +#include "PxsRigidBody.h" +#include "PxcConstraintBlockStream.h" +#include "DyArticulationContactPrep.h" +#include "DyDynamics.h" +#include "DyArticulationPImpl.h" +#include "DyFeatherstoneArticulationLink.h" +#include "DyFeatherstoneArticulationJointData.h" +#include "DySolverConstraint1DStep.h" +#include "DyTGSDynamics.h" +#include "DyConstraintPrep.h" +#include "common/PxProfileZone.h" +#include "PxsContactManager.h" +#include "DyContactPrep.h" +#include "DySolverContext.h" +#include "DyTGSContactPrep.h" + +#ifndef FEATURESTONE_DEBUG +#define FEATURESTONE_DEBUG 0 +#endif + + +// we encode articulation link handles in the lower bits of the pointer, so the +// articulation has to be aligned, which in an aligned pool means we need to size it +// appropriately + +namespace physx +{ + +namespace Dy +{ + + extern PxcCreateFinalizeSolverContactMethod createFinalizeMethods[3]; + + void SolverCoreRegisterArticulationFns(); + + void SolverCoreRegisterArticulationFnsCoulomb(); + + ArticulationPImpl::ComputeUnconstrainedVelocitiesFn ArticulationPImpl::sComputeUnconstrainedVelocities = NULL; + ArticulationPImpl::UpdateBodiesFn ArticulationPImpl::sUpdateBodies = NULL; + ArticulationPImpl::UpdateBodiesFn ArticulationPImpl::sUpdateBodiesTGS = NULL; + ArticulationPImpl::SaveVelocityFn ArticulationPImpl::sSaveVelocity = NULL; + ArticulationPImpl::SaveVelocityTGSFn ArticulationPImpl::sSaveVelocityTGS = NULL; + + ArticulationPImpl::UpdateDeltaMotionFn ArticulationPImpl::sUpdateDeltaMotion = NULL; + ArticulationPImpl::DeltaMotionToMotionVelFn ArticulationPImpl::sDeltaMotionToMotionVel = NULL; + ArticulationPImpl::ComputeUnconstrainedVelocitiesTGSFn ArticulationPImpl::sComputeUnconstrainedVelocitiesTGS = NULL; + + ArticulationPImpl::SetupInternalConstraintsTGSFn ArticulationPImpl::sSetupInternalConstraintsTGS = NULL; + + void PxvRegisterArticulationsReducedCoordinate() + { + ArticulationPImpl::sComputeUnconstrainedVelocities = &FeatherstoneArticulation::computeUnconstrainedVelocities; + ArticulationPImpl::sUpdateBodies = &FeatherstoneArticulation::updateBodies; + ArticulationPImpl::sUpdateBodiesTGS = &FeatherstoneArticulation::updateBodiesTGS; + ArticulationPImpl::sSaveVelocity = &FeatherstoneArticulation::saveVelocity; + ArticulationPImpl::sSaveVelocityTGS = &FeatherstoneArticulation::saveVelocityTGS; + + ArticulationPImpl::sUpdateDeltaMotion = &FeatherstoneArticulation::recordDeltaMotion; + ArticulationPImpl::sDeltaMotionToMotionVel = &FeatherstoneArticulation::deltaMotionToMotionVelocity; + ArticulationPImpl::sComputeUnconstrainedVelocitiesTGS = &FeatherstoneArticulation::computeUnconstrainedVelocitiesTGS; + ArticulationPImpl::sSetupInternalConstraintsTGS = &FeatherstoneArticulation::setupSolverConstraintsTGS; + + SolverCoreRegisterArticulationFns(); + SolverCoreRegisterArticulationFnsCoulomb(); + } + + ArticulationData::~ArticulationData() + { + PX_FREE(mLinksData); + PX_FREE(mJointData); + PX_FREE(mJointTranData); + PX_FREE(mPathToRootElements); + } + + void ArticulationData::resizeLinkData(const PxU32 linkCount) + { + const PxU32 oldSize = mMotionVelocities.size(); + mMotionVelocities.reserve(linkCount); + mMotionVelocities.forceSize_Unsafe(linkCount); + + mSolverSpatialForces.reserve(linkCount); + mSolverSpatialForces.forceSize_Unsafe(linkCount); + + mMotionAccelerations.reserve(linkCount); + mMotionAccelerations.forceSize_Unsafe(linkCount); + + mMotionAccelerationsInternal.reserve(linkCount); + mMotionAccelerationsInternal.forceSize_Unsafe(linkCount); + + mCorioliseVectors.reserve(linkCount); + mCorioliseVectors.forceSize_Unsafe(linkCount); + + mZAForces.reserve(linkCount); + mZAForces.forceSize_Unsafe(linkCount); + + mZAInternalForces.reserve(linkCount); + mZAInternalForces.forceSize_Unsafe(linkCount); + + mNbStatic1DConstraints.reserve(linkCount); + mNbStatic1DConstraints.forceSize_Unsafe(linkCount); + + mStatic1DConstraintStartIndex.reserve(linkCount); + mStatic1DConstraintStartIndex.forceSize_Unsafe(linkCount); + + mNbStaticContactConstraints.reserve(linkCount); + mNbStaticContactConstraints.forceSize_Unsafe(linkCount); + + mStaticContactConstraintStartIndex.reserve(linkCount); + mStaticContactConstraintStartIndex.forceSize_Unsafe(linkCount); + + mDeltaMotionVector.reserve(linkCount); + mDeltaMotionVector.forceSize_Unsafe(linkCount); + + mPreTransform.reserve(linkCount); + mPreTransform.forceSize_Unsafe(linkCount); + + mResponseMatrixW.reserve(linkCount); + mResponseMatrixW.forceSize_Unsafe(linkCount); + + mWorldSpatialArticulatedInertia.reserve(linkCount); + mWorldSpatialArticulatedInertia.forceSize_Unsafe(linkCount); + + mWorldIsolatedSpatialArticulatedInertia.reserve(linkCount); + mWorldIsolatedSpatialArticulatedInertia.forceSize_Unsafe(linkCount); + + mMasses.reserve(linkCount); + mMasses.forceSize_Unsafe(linkCount); + + mInvStIs.reserve(linkCount); + mInvStIs.forceSize_Unsafe(linkCount); + + /*mMotionMatrix.resize(linkCount); + + mWorldMotionMatrix.reserve(linkCount); + mWorldMotionMatrix.forceSize_Unsafe(linkCount);*/ + + mAccumulatedPoses.reserve(linkCount); + mAccumulatedPoses.forceSize_Unsafe(linkCount); + + mDeltaQ.reserve(linkCount); + mDeltaQ.forceSize_Unsafe(linkCount); + + mPosIterMotionVelocities.reserve(linkCount); + mPosIterMotionVelocities.forceSize_Unsafe(linkCount); + + mJointTransmittedForce.reserve(linkCount); + mJointTransmittedForce.forceSize_Unsafe(linkCount); + + mRw.reserve(linkCount); + mRw.forceSize_Unsafe(linkCount); + + //This stores how much an impulse on a given link influences the root link. + //We combine this with the back-propagation of joint forces to compute the + //change in velocity of a given impulse! + mRootResponseMatrix.reserve(linkCount); + mRootResponseMatrix.forceSize_Unsafe(linkCount); + + mRelativeQuat.resize(linkCount); + + if (oldSize < linkCount) + { + + ArticulationLinkData* oldLinks = mLinksData; + ArticulationJointCoreData* oldJoints = mJointData; + ArticulationJointTargetData* oldJointTran = mJointTranData; + + mLinksData = PX_ALLOCATE(ArticulationLinkData, linkCount, "ArticulationLinkData"); + mJointData = PX_ALLOCATE(ArticulationJointCoreData, linkCount, "ArticulationJointCoreData"); + mJointTranData = PX_ALLOCATE(ArticulationJointTargetData, linkCount, "ArticulationJointTargetData"); + + PxMemCopy(mLinksData, oldLinks, sizeof(ArticulationLinkData)*oldSize); + PxMemCopy(mJointData, oldJoints, sizeof(ArticulationJointCoreData)*oldSize); + PxMemCopy(mJointTranData, oldJointTran, sizeof(ArticulationJointTargetData)*oldSize); + + PX_FREE(oldLinks); + PX_FREE(oldJoints); + PX_FREE(oldJointTran); + + const PxU32 newElems = (linkCount - oldSize); + + PxMemZero(mLinksData + oldSize, sizeof(ArticulationLinkData) * newElems); + PxMemZero(mJointData + oldSize, sizeof(ArticulationJointCoreData) * newElems); + + for (PxU32 linkID = oldSize; linkID < linkCount; ++linkID) + { + PX_PLACEMENT_NEW(mLinksData + linkID, ArticulationLinkData)(); + PX_PLACEMENT_NEW(mJointData + linkID, ArticulationJointCoreData)(); + PX_PLACEMENT_NEW(mJointTranData + linkID, ArticulationJointTargetData)(); + } + } + } + + void ArticulationData::resizeJointData(const PxU32 dofs) + { + mJointAcceleration.reserve(dofs); + mJointAcceleration.forceSize_Unsafe(dofs); + + mJointInternalAcceleration.reserve(dofs); + mJointInternalAcceleration.forceSize_Unsafe(dofs); + + mJointVelocity.reserve(dofs); + mJointVelocity.forceSize_Unsafe(dofs); + + mJointNewVelocity.reserve(dofs+3); + mJointNewVelocity.forceSize_Unsafe(dofs+3); + + mJointPosition.reserve(dofs); + mJointPosition.forceSize_Unsafe(dofs); + + mJointForce.reserve(dofs); + mJointForce.forceSize_Unsafe(dofs); + + mMotionMatrix.resize(dofs); + + mJointSpaceJacobians.resize(dofs*mLinkCount); + mJointSpaceDeltaVMatrix.resize(((dofs + 3) / 4)*mLinkCount); + mJointSpaceResponseMatrix.resize(dofs); //This is only an entry per-dof + + mPropagationAccelerator.resize(dofs); + + mWorldMotionMatrix.reserve(dofs); + mWorldMotionMatrix.forceSize_Unsafe(dofs); + + mJointAxis.reserve(dofs); + mJointAxis.forceSize_Unsafe(dofs); + + mIsW.reserve(dofs); + mIsW.forceSize_Unsafe(dofs); + + mDeferredQstZ.reserve(dofs); + mDeferredQstZ.forceSize_Unsafe(dofs); + + mJointConstraintForces.resizeUninitialized(dofs); + + qstZIc.reserve(dofs); + qstZIc.forceSize_Unsafe(dofs); + + qstZIntIc.reserve(dofs); + qstZIntIc.forceSize_Unsafe(dofs); + + mIsInvDW.reserve(dofs); + mIsInvDW.forceSize_Unsafe(dofs); + + mPosIterJointVelocities.reserve(dofs); + mPosIterJointVelocities.forceSize_Unsafe(dofs); + + PxMemZero(mJointAcceleration.begin(), sizeof(PxReal) * dofs); + PxMemZero(mJointVelocity.begin(), sizeof(PxReal) * dofs); + PxMemZero(mJointPosition.begin(), sizeof(PxReal) * dofs); + PxMemZero(mJointForce.begin(), sizeof(PxReal) * dofs); + } + + ArticulationLinkData& ArticulationData::getLinkData(PxU32 index) const + { + PX_ASSERT(index < mLinkCount); + return mLinksData[index]; + } + + void ArticulationJointCore::setJointFrame(ArticulationJointCoreData& jointDatum, Cm::UnAlignedSpatialVector* motionMatrix, + const Cm::UnAlignedSpatialVector* jointAxis, bool forceUpdate, PxQuat& relativeQuat) + { + if (jointDirtyFlag & ArticulationJointCoreDirtyFlag::eFRAME || forceUpdate) + { + relativeQuat = (childPose.q * (parentPose.q.getConjugate())).getNormalized(); + + jointDatum.computeMotionMatrix(this, motionMatrix, jointAxis); + + jointDirtyFlag &= ~ArticulationJointCoreDirtyFlag::eFRAME; + } + } + + FeatherstoneArticulation::FeatherstoneArticulation(void* userData) + : mUserData(userData), mContext(NULL), mUpdateSolverData(true), + mMaxDepth(0) + { + mGPUDirtyFlags = 0; + } + + FeatherstoneArticulation::~FeatherstoneArticulation() + { + } + + void FeatherstoneArticulation::copyJointData(ArticulationData& data, PxReal* toJointData, const PxReal* fromJointData) + { + const PxU32 dofCount = data.getDofs(); + + PxMemCopy(toJointData, fromJointData, sizeof(PxReal)*dofCount); + } + + PxU32 FeatherstoneArticulation::computeDofs() + { + const PxU32 linkCount = mArticulationData.getLinkCount(); + PxU32 totalDofs = 0; + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = mArticulationData.getLink(linkID); + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + const PxU8 dof = jointDatum.computeJointDofs(link.inboundJoint); + totalDofs += dof; + } + + return totalDofs; + } + + bool FeatherstoneArticulation::resize(const PxU32 linkCount) + { + if (mUpdateSolverData) + { + if (linkCount != mSolverDesc.linkCount) + { + mSolverDesc.acceleration = mAcceleration.begin(); + mSolverDesc.articulation = this; + } + + mUpdateSolverData = false; + + if (linkCount != mSolverDesc.linkCount) + { + + mArticulationData.resizeLinkData(linkCount); + + } + return true; + + } + return false; + } + + void FeatherstoneArticulation::getDataSizes(PxU32 /*linkCount*/, PxU32& solverDataSize, PxU32& totalSize, PxU32& scratchSize) + { + solverDataSize = 0; + totalSize = 0; + scratchSize = 0; + } + + void FeatherstoneArticulation::setupLinks(PxU32 nbLinks, Dy::ArticulationLink* links) + { + //if this is needed, we need to re-allocated the link data + resize(nbLinks); + + mSolverDesc.links = links; + mSolverDesc.linkCount = PxTo8(nbLinks); + + mArticulationData.mLinks = links; + mArticulationData.mLinkCount = PxTo8(nbLinks); + mArticulationData.mFlags = mSolverDesc.core ? &mSolverDesc.core->flags : mSolverDesc.flags; // PT: PX-1399 + mArticulationData.mExternalAcceleration = mSolverDesc.acceleration; + mArticulationData.mArticulation = this; + + + //allocate memory for articulation data + PxU32 totalDofs = computeDofs(); + + const PxU32 existedTotalDofs = mArticulationData.getDofs(); + + if (totalDofs != existedTotalDofs) + { + mArticulationData.resizeJointData(totalDofs + 1); + mArticulationData.setDofs(totalDofs); + } + } + + void FeatherstoneArticulation::allocatePathToRootElements(const PxU32 totalPathToRootElements) + { + if (mArticulationData.mNumPathToRootElements < totalPathToRootElements) + { + mArticulationData.mPathToRootElements = PX_ALLOCATE(PxU32, totalPathToRootElements, "PxU32"); + mArticulationData.mNumPathToRootElements = totalPathToRootElements; + } + } + + void FeatherstoneArticulation::initPathToRoot() + { + + Dy::ArticulationLink* links = mArticulationData.getLinks(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + + links[0].mPathToRootCount = 0; + links[0].mPathToRootStartIndex = 0; + + PxU32 totalPathToRootCount = 1; //add on root + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + Dy::ArticulationLink& link = links[linkID]; + + PxU32 parent = link.parent; + PxU32 pathToRootCount = 1; // add myself to the path + while (parent != 0) // don't add the root + { + parent = links[parent].parent; + pathToRootCount++; + } + + link.mPathToRootStartIndex = totalPathToRootCount; + link.mPathToRootCount = PxU16(pathToRootCount); + totalPathToRootCount += pathToRootCount; + } + + allocatePathToRootElements(totalPathToRootCount); + + PxU32* pathToRootElements = mArticulationData.getPathToRootElements(); + + pathToRootElements[0] = 0; //add on root index + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + Dy::ArticulationLink& link = links[linkID]; + PxU32* pathToRoot = &pathToRootElements[link.mPathToRootStartIndex]; + PxU32 numElements = link.mPathToRootCount; + + pathToRoot[--numElements] = linkID; + PxU32 parent = links[linkID].parent; + while (parent != 0) + { + pathToRoot[--numElements] = parent; + parent = links[parent].parent; + } + } + } + + void FeatherstoneArticulation::assignTendons(const PxU32 nbTendons, Dy::ArticulationSpatialTendon** tendons) + { + mArticulationData.mSpatialTendons = tendons; + mArticulationData.mNumSpatialTendons = nbTendons; + } + + void FeatherstoneArticulation::assignTendons(const PxU32 nbTendons, Dy::ArticulationFixedTendon** tendons) + { + + mArticulationData.mFixedTendons = tendons; + mArticulationData.mNumFixedTendons = nbTendons; + } + + void FeatherstoneArticulation::assignSensors(const PxU32 nbSensors, Dy::ArticulationSensor** sensors, PxSpatialForce* sensorForces) + { + mArticulationData.mSensors = sensors; + mArticulationData.mNbSensors = nbSensors; + mArticulationData.mSensorForces = sensorForces; + } + + PxU32 FeatherstoneArticulation::getDofs() + { + return mArticulationData.getDofs(); + + } + + PxU32 FeatherstoneArticulation::getDof(const PxU32 linkID) + { + const ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + return jointDatum.dof; + } + + + bool FeatherstoneArticulation::applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag, bool& shouldWake) + { + return applyCacheToDest(mArticulationData, cache, mArticulationData.getJointVelocities(), mArticulationData.getJointAccelerations(), + mArticulationData.getJointPositions(), mArticulationData.getJointForces(), flag, shouldWake); + } + + void FeatherstoneArticulation::copyInternalStateToCache(PxArticulationCache& cache, + const PxArticulationCacheFlags flag) + { + if (flag & PxArticulationCacheFlag::eVELOCITY) + { + copyJointData(mArticulationData, cache.jointVelocity, mArticulationData.getJointVelocities()); + } + + if (flag & PxArticulationCacheFlag::eACCELERATION) + { + copyJointData(mArticulationData, cache.jointAcceleration, mArticulationData.getJointAccelerations()); + } + + if (flag & PxArticulationCacheFlag::ePOSITION) + { + copyJointData(mArticulationData, cache.jointPosition, mArticulationData.getJointPositions()); + } + + if (flag & PxArticulationCacheFlag::eFORCE) + { + copyJointData(mArticulationData, cache.jointForce, mArticulationData.getJointForces()); + } + + if (flag & PxArticulationCacheFlag::eJOINT_SOLVER_FORCES) + { + copyJointData(mArticulationData, cache.jointSolverForces, mArticulationData.getJointConstraintForces()); + } + + if (flag & PxArticulationCacheFlag::eLINK_VELOCITY) + { + const Cm::SpatialVectorF* vels = mArticulationData.getMotionVelocities(); + const PxU32 numLinks = mArticulationData.getLinkCount(); + for (PxU32 i = 0; i < numLinks; ++i) + { + const Cm::SpatialVectorF& vel = vels[i]; + cache.linkVelocity[i].linear = vel.bottom; + cache.linkVelocity[i].angular = vel.top; + } + } + + if (flag & PxArticulationCacheFlag::eLINK_ACCELERATION) + { + const PxU32 numLinks = mArticulationData.getLinkCount(); + + if (mArticulationData.getDt() > 0.f) + recomputeAccelerations(mArticulationData.getDt()); + + const Cm::SpatialVectorF* accels = mArticulationData.getMotionAccelerations(); + + for (PxU32 i = 0; i < numLinks; ++i) + { + const Cm::SpatialVectorF& accel = accels[i]; + cache.linkAcceleration[i].linear = accel.bottom; + cache.linkAcceleration[i].angular = accel.top; + } + } + + if (flag & PxArticulationCacheFlag::eROOT_TRANSFORM) + { + const ArticulationLink& rLink = mArticulationData.getLink(0); + const PxsBodyCore& rBodyCore = *rLink.bodyCore; + const PxTransform& body2World = rBodyCore.body2World; + cache.rootLinkData->transform = body2World * rBodyCore.getBody2Actor().getInverse(); + } + + if (flag & PxArticulationCacheFlag::eROOT_VELOCITIES) + { + const Cm::SpatialVectorF& vel = mArticulationData.getMotionVelocity(0); + cache.rootLinkData->worldLinVel = vel.bottom; + cache.rootLinkData->worldAngVel = vel.top; + + const Cm::SpatialVectorF& accel = mArticulationData.getMotionAcceleration(0); + cache.rootLinkData->worldLinAccel = accel.bottom; + cache.rootLinkData->worldAngAccel = accel.top; + } + + if (flag & PxArticulationCacheFlag::eSENSOR_FORCES) + { + const PxU32 nbSensors = mArticulationData.mNbSensors; + PxMemCopy(cache.sensorForces, mArticulationData.mSensorForces, sizeof(PxSpatialForce)*nbSensors); + } + } + + static PX_FORCE_INLINE Mat33V loadPxMat33(const PxMat33& m) + { + return Mat33V(Vec3V_From_Vec4V(V4LoadU(&m.column0.x)), + Vec3V_From_Vec4V(V4LoadU(&m.column1.x)), V3LoadU(&m.column2.x)); + } + + static PX_FORCE_INLINE void storePxMat33(const Mat33V& src, PxMat33& dst) + { + V3StoreU(src.col0, dst.column0); + V3StoreU(src.col1, dst.column1); + V3StoreU(src.col2, dst.column2); + } + + void FeatherstoneArticulation::transformInertia(const SpatialTransform& sTod, SpatialMatrix& spatialInertia) + { +#if 1 + const SpatialTransform dTos = sTod.getTranspose(); + + Mat33V tL = loadPxMat33(spatialInertia.topLeft); + Mat33V tR = loadPxMat33(spatialInertia.topRight); + Mat33V bL = loadPxMat33(spatialInertia.bottomLeft); + + Mat33V R = loadPxMat33(sTod.R); + Mat33V T = loadPxMat33(sTod.T); + + Mat33V tl = M33MulM33(R, tL); + Mat33V tr = M33MulM33(R, tR); + Mat33V bl = M33Add(M33MulM33(T, tL), M33MulM33(R, bL)); + Mat33V br = M33Add(M33MulM33(T, tR), M33MulM33(R, M33Trnsps(tL))); + + Mat33V dR = loadPxMat33(dTos.R); + Mat33V dT = loadPxMat33(dTos.T); + + tL = M33Add(M33MulM33(tl, dR), M33MulM33(tr, dT)); + tR = M33MulM33(tr, dR); + bL = M33Add(M33MulM33(bl, dR), M33MulM33(br, dT)); + + bL = M33Scale(M33Add(bL, M33Trnsps(bL)), FHalf()); + + storePxMat33(tL, spatialInertia.topLeft); + storePxMat33(tR, spatialInertia.topRight); + storePxMat33(bL, spatialInertia.bottomLeft); +#else + const SpatialTransform dTos = sTod.getTranspose(); + + PxMat33 tl = sTod.R * spatialInertia.topLeft; + PxMat33 tr = sTod.R * spatialInertia.topRight; + PxMat33 bl = sTod.T * spatialInertia.topLeft + sTod.R * spatialInertia.bottomLeft; + PxMat33 br = sTod.T * spatialInertia.topRight + sTod.R * spatialInertia.getBottomRight(); + + spatialInertia.topLeft = tl * dTos.R + tr * dTos.T; + spatialInertia.topRight = tr * dTos.R; + spatialInertia.bottomLeft = bl * dTos.R + br * dTos.T; + + //aligned inertia + spatialInertia.bottomLeft = (spatialInertia.bottomLeft + spatialInertia.bottomLeft.getTranspose()) * 0.5f; +#endif + } + + PxMat33 FeatherstoneArticulation::translateInertia(const PxMat33& inertia, const PxReal mass, const PxVec3& t) + { + PxMat33 s(PxVec3(0, t.z, -t.y), + PxVec3(-t.z, 0, t.x), + PxVec3(t.y, -t.x, 0)); + + PxMat33 translatedIT = s.getTranspose() * s * mass + inertia; + return translatedIT; + } + + void FeatherstoneArticulation::translateInertia(const PxMat33& sTod, SpatialMatrix& inertia) + { +#if 1 + Mat33V sTodV = loadPxMat33(sTod); + Mat33V dTos = M33Trnsps(sTodV); + + const Mat33V tL = loadPxMat33(inertia.topLeft); + const Mat33V tR = loadPxMat33(inertia.topRight); + const Mat33V bL = loadPxMat33(inertia.bottomLeft); + + const Mat33V bl = M33Add(M33MulM33(sTodV, tL), bL); + const Mat33V br = M33Add(M33MulM33(sTodV, tR), M33Trnsps(tL)); + const Mat33V bottomLeft = M33Add(bl, M33MulM33(br, dTos)); + + storePxMat33(M33Add(tL, M33MulM33(tR, dTos)), inertia.topLeft); + storePxMat33(M33Scale(M33Add(bottomLeft, M33Trnsps(bottomLeft)), FHalf()), inertia.bottomLeft); +#else + const PxMat33 dTos = sTod.getTranspose(); + + PxMat33 bl = sTod * inertia.topLeft + inertia.bottomLeft; + PxMat33 br = sTod * inertia.topRight + inertia.getBottomRight(); + + inertia.topLeft = inertia.topLeft + inertia.topRight * dTos; + inertia.bottomLeft = bl + br * dTos; + + //aligned inertia - make it symmetrical! OPTIONAL!!!! + inertia.bottomLeft = (inertia.bottomLeft + inertia.bottomLeft.getTranspose()) * 0.5f; +#endif + } + + void FeatherstoneArticulation::getImpulseResponse( + PxU32 linkID, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse, + Cm::SpatialVector& deltaVV) const + { + PX_UNUSED(Z); + PX_ASSERT(impulse.pad0 == 0.f && impulse.pad1 == 0.f); + + //impulse lin is contact normal, and ang is raxn. R is body2World, R(t) is world2Body + //| R(t), 0 | + //| R(t)*r, R(t)| + //r is the vector from center of mass to contact point + //p(impluse) = |n| + // |0| + +#if 0 + const PxTransform& body2World = mArticulationData.getPreTransform(linkID); + + //transform p(impulse) from world space to the local space of linkId + const Cm::SpatialVectorF impl(body2World.rotateInv(impulse.linear), body2World.rotateInv(impulse.angular)); + + getZ(linkID, mArticulationData, Z, impl); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + const Cm::SpatialVectorF deltaV = getDeltaV(fixBase, linkID, mArticulationData, Z); + PX_ASSERT(deltaV.pad0 == 0.f && deltaV.pad1 == 0.f); + + ////Cm::SpatialVectorF resp = mArticulationData.getImpulseResponseMatrix()[linkID].getResponse(Cm::SpatialVectorF(impulse.linear, impulse.angular)); + //Cm::SpatialVectorF resp = mArticulationData.getImpulseResponseMatrix()[linkID].getResponse(impl); + + //Cm::SpatialVectorF test = resp - deltaV; + + //PX_ASSERT(test.magnitude() < 1e-5f); + + //this is in world space + deltaVV.linear = body2World.rotate(deltaV.bottom); + deltaVV.angular = body2World.rotate(deltaV.top); + +#else + Cm::SpatialVectorF deltaV = mArticulationData.getImpulseResponseMatrixWorld()[linkID].getResponse(reinterpret_cast(impulse)); + + deltaVV.linear = deltaV.bottom; + deltaVV.angular = deltaV.top; +#endif + + + } + + void FeatherstoneArticulation::getImpulseResponse( + PxU32 linkID, + Cm::SpatialVectorV* /*Z*/, + const Cm::SpatialVectorV& impulse, + Cm::SpatialVectorV& deltaVV) const + { +#if 0 + const PxTransform& body2World = mArticulationData.getPreTransform(linkID); + + QuatV rot = QuatVLoadU(&body2World.q.x); + + Cm::SpatialVectorV impl(QuatRotateInv(rot, impulse.linear), QuatRotateInv(rot, impulse.angular)); + + //transform p(impluse) from world space to the local space of linkId + + //Cm::SpatialVectorF impl(impulse.linear, impulse.angular); + Cm::SpatialVectorV deltaV = mArticulationData.getImpulseResponseMatrix()[linkID].getResponse(impl); + deltaVV.linear = QuatRotate(rot, deltaV.angular); + deltaVV.angular = QuatRotate(rot, deltaV.linear); +#else + Cm::SpatialVectorV deltaV = mArticulationData.getImpulseResponseMatrixWorld()[linkID].getResponse(impulse); + deltaVV.linear = deltaV.angular; + deltaVV.angular = deltaV.linear; +#endif + } + + //This will return world space SpatialVectorV + Cm::SpatialVectorV FeatherstoneArticulation::getLinkVelocity(const PxU32 linkID) const + { + //This is in the world space + const Cm::SpatialVectorF& motionVelocity = mArticulationData.getMotionVelocity(linkID); + + Cm::SpatialVectorV velocity; + velocity.linear = V3LoadA(motionVelocity.bottom); + velocity.angular = V3LoadA(motionVelocity.top); + + return velocity; + } + + Cm::SpatialVector FeatherstoneArticulation::getLinkScalarVelocity(const PxU32 linkID) const + { + //This is in the world space + const Cm::SpatialVectorF& motionVelocity = mArticulationData.getMotionVelocity(linkID); + + return Cm::SpatialVector(motionVelocity.bottom, motionVelocity.top); + } + + + Cm::SpatialVectorV FeatherstoneArticulation::getLinkMotionVector(const PxU32 linkID) const + { + const Cm::SpatialVectorF& motionVector = mArticulationData.getDeltaMotionVector(linkID); + + Cm::SpatialVectorV velocity; + velocity.linear = V3LoadU(motionVector.bottom); + velocity.angular = V3LoadU(motionVector.top); + + return velocity; + } + + //this is called by island gen to determine whether the articulation should be awake or sleep + Cm::SpatialVector FeatherstoneArticulation::getMotionVelocity(const PxU32 linkID) const + { + //This is in the world space + const Cm::SpatialVectorF& motionVelocity = mArticulationData.getPosIterMotionVelocities()[linkID]; + return Cm::SpatialVector(motionVelocity.bottom, motionVelocity.top); + } + + Cm::SpatialVector FeatherstoneArticulation::getMotionAcceleration(const PxU32 linkID) const + { + const PxReal dt = mArticulationData.getDt(); + if(0.0f == dt) + return Cm::SpatialVector(PxVec3(0.f), PxVec3(0.f)); + return recomputeAcceleration(linkID, dt); + } + + + void FeatherstoneArticulation::fillIndexType(const PxU32 linkId, PxU8& indexType) + { + ArticulationLink& link = mArticulationData.getLink(linkId); + + //turn the kinematic link to static for the solver + if (link.bodyCore->kinematicLink) + { + indexType = PxsIndexedInteraction::eWORLD; + } + else + { + indexType = PxsIndexedInteraction::eARTICULATION; + } + } + + PxReal FeatherstoneArticulation::getLinkMaxPenBias(const PxU32 linkID) const + { + return mArticulationData.getLinkData(linkID).maxPenBias; + } + + PxReal FeatherstoneArticulation::getCfm(const PxU32 linkID) const + { + return mArticulationData.getLink(linkID).cfm; + } + + void PxcFsFlushVelocity(FeatherstoneArticulation& articulation, Cm::SpatialVectorF* deltaV, bool computeForces) + { + PX_ASSERT(deltaV); + + ArticulationData& data = articulation.mArticulationData; + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + Cm::SpatialVectorF* motionVelocities = data.getMotionVelocities(); + //Cm::SpatialVectorF* deferredZ = data.getSpatialZAVectors(); + ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + + //PxTransform* poses = data.getAccumulatedPoses(); + //const PxTransform* poses = data.getPreTransform(); + + //This will be zero at the begining of the frame + PxReal* jointNewVelocities = data.getJointNewVelocities(); + + data.getSolverSpatialForce(0) -= data.getRootDeferredZ(); + + if (fixBase) + { + deltaV[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + } + else + { + //ArticulationLink& link = links[0]; + + deltaV[0] = data.getBaseInvSpatialArticulatedInertiaW() * -data.getRootDeferredZ(); + + motionVelocities[0] += deltaV[0]; + + PX_ASSERT(motionVelocities[0].isFinite()); + } + + const PxU32 linkCount = data.getLinkCount(); + + for (PxU32 i = 1; i < linkCount; i++) + { + const ArticulationLink& tLink = links[i]; + const ArticulationJointCoreData& tJointDatum = jointData[i]; + + const Cm::SpatialVectorF dV = FeatherstoneArticulation::propagateAccelerationW(data.getRw(i), data.getInvStIs(i), + &data.getWorldMotionMatrix(tJointDatum.jointOffset), &jointNewVelocities[tJointDatum.jointOffset], deltaV[tLink.parent], tJointDatum.dof, + &data.getIsW(tJointDatum.jointOffset), &data.getDeferredQstZ()[tJointDatum.jointOffset]); + + deltaV[i] = dV; + motionVelocities[i] += dV; + + //Cm::SpatialVectorF& v = motionVelocities[i]; + //printf("linkID %i motionV(%f, %f, %f, %f, %f, %f)\n", i, v.top.x, v.top.y, v.top.z, v.bottom.x, v.bottom.y, v.bottom.z); + + /*if(computeForces) + data.getSolverSpatialForce(i) += data.getWorldSpatialArticulatedInertia(i) * dV;*/ + if (computeForces) + data.getSolverSpatialForce(i) += dV; + + PX_ASSERT(motionVelocities[i].isFinite()); + + } + + //PxMemZero(deferredZ, sizeof(Cm::SpatialVectorF)*linkCount); + PxMemZero(data.getDeferredQstZ(), sizeof(PxReal) * data.getDofs()); + + data.getRootDeferredZ() = Cm::SpatialVectorF::Zero(); + } + + void FeatherstoneArticulation::recordDeltaMotion(const ArticulationSolverDesc& desc, + const PxReal dt, Cm::SpatialVectorF* deltaV, const PxReal /*totalInvDt*/) + { + PX_ASSERT(deltaV); + + FeatherstoneArticulation* articulation = static_cast(desc.articulation); + ArticulationData& data = articulation->mArticulationData; + const PxU32 linkCount = data.getLinkCount(); + + const PxU32 flags = data.getArticulationFlags(); + + if (data.mJointDirty) + { + bool doForces = (flags & PxArticulationFlag::eCOMPUTE_JOINT_FORCES) || data.getSensorCount(); + PxcFsFlushVelocity(*articulation, deltaV, doForces); + } + + Cm::SpatialVectorF* deltaMotion = data.getDeltaMotionVector(); + Cm::SpatialVectorF* posMotionVelocities = data.getPosIterMotionVelocities(); + Cm::SpatialVectorF* motionVelocities = data.getMotionVelocities(); + + PxReal* jointPosition = data.getJointPositions(); + PxReal* jointNewVelocities = data.getJointNewVelocities(); + + //data.mAccumulatedDt += dt; + data.setDt(dt); + + const bool fixBase = flags & PxArticulationFlag::eFIX_BASE; + + if (!fixBase) + { + Cm::SpatialVectorF& motionVelocity = motionVelocities[0]; + PX_ASSERT(motionVelocity.top.isFinite()); + PX_ASSERT(motionVelocity.bottom.isFinite()); + + const PxTransform preTrans = data.mAccumulatedPoses[0]; + + const PxVec3 lin = motionVelocity.bottom; + const PxVec3 ang = motionVelocity.top; + + const PxVec3 newP = preTrans.p + lin * dt; + + const PxTransform newPose = PxTransform(newP, PxExp(ang*dt) * preTrans.q); + + //PxVec3 lin, ang; + /*calculateNewVelocity(newPose, data.mPreTransform[0], + 1.f, lin, ang); */ + + data.mAccumulatedPoses[0] = newPose; + + PxQuat dq = newPose.q * data.mPreTransform[0].q.getConjugate(); + + if (dq.w < 0.f) + dq = -dq; + + data.mDeltaQ[0] = dq; + + Cm::SpatialVectorF delta = motionVelocity * dt; + + deltaMotion[0] += delta; + posMotionVelocities[0] += delta; + } + + for (PxU32 linkID = 1; linkID < linkCount; linkID++) + { + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + + const PxTransform newPose = articulation->propagateTransform(linkID, data.getLinks(), jointDatum, data.getMotionVelocities(), + dt, data.mAccumulatedPoses[data.getLink(linkID).parent], data.mAccumulatedPoses[linkID], + jointNewVelocities, jointPosition, &data.getMotionMatrix(jointDatum.jointOffset), &data.getWorldMotionMatrix(jointDatum.jointOffset)); + + //data.mDeltaQ[linkID] = data.mPreTransform[linkID].q.getConjugate() * newPose.q; + PxQuat dq = newPose.q * data.mPreTransform[linkID].q.getConjugate(); + + if(dq.w < 0.f) + dq = -dq; + + data.mDeltaQ[linkID] = dq; + + + + /*PxVec3 lin, ang; + calculateNewVelocity(newPose, data.mPreTransform[linkID], + 1.f, lin, ang);*/ + + PxVec3 lin = (newPose.p - data.mPreTransform[linkID].p); + + Cm::SpatialVectorF delta = motionVelocities[linkID] * dt; + + //deltaMotion[linkID].top = ang;// motionVeloties[linkID].top * dt; + deltaMotion[linkID].top += delta.top; + deltaMotion[linkID].bottom = lin;// motionVeloties[linkID].top * dt; + posMotionVelocities[linkID] += delta; + + + //Record the new current pose + data.mAccumulatedPoses[linkID] = newPose; + } + } + + void FeatherstoneArticulation::deltaMotionToMotionVelocity(const ArticulationSolverDesc& desc, PxReal invDt) + { + FeatherstoneArticulation* articulation = static_cast(desc.articulation); + ArticulationData& data = articulation->mArticulationData; + const PxU32 linkCount = data.getLinkCount(); + const Cm::SpatialVectorF* deltaMotion = data.getDeltaMotionVector(); + + for (PxU32 linkID = 0; linkID(delta); + } + } + + //This is used in the solveExt1D, solveExtContact + Cm::SpatialVectorV FeatherstoneArticulation::pxcFsGetVelocity(PxU32 linkID) + { + //Cm::SpatialVectorF* deferredZ = mArticulationData.getSpatialZAVectors(); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + ArticulationLink* links = mArticulationData.getLinks(); + + Cm::SpatialVectorF deltaV(PxVec3(0.f), PxVec3(0.f)); + + if (!fixBase) + { + //deltaV = mArticulationData.mBaseInvSpatialArticulatedInertia * (-deferredZ[0]); + //DeferredZ now in world space! + deltaV = mArticulationData.mBaseInvSpatialArticulatedInertiaW * -mArticulationData.getRootDeferredZ(); + } + + + const PxU32 startIndex = links[linkID].mPathToRootStartIndex; + const PxU32 elementCount = links[linkID].mPathToRootCount; + + const PxU32* pathToRootElements = &mArticulationData.mPathToRootElements[startIndex]; + + for (PxU32 i = 0; i < elementCount; ++i) + { + const PxU32 index = pathToRootElements[i]; + PX_ASSERT(links[index].parent < index); + + const PxU32 jointOffset = mArticulationData.getJointData(index).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(index).dof; + + deltaV = propagateAccelerationW(mArticulationData.getRw(index), mArticulationData.mInvStIs[index], + &mArticulationData.mWorldMotionMatrix[jointOffset], deltaV, dofCount, &mArticulationData.mIsW[jointOffset], + &mArticulationData.mDeferredQstZ[jointOffset]); + } + + Cm::SpatialVectorF vel = mArticulationData.getMotionVelocity(linkID) + deltaV; + + return Cm::SpatialVector(vel.bottom, vel.top); + } + + void FeatherstoneArticulation::pxcFsGetVelocities(PxU32 linkID, PxU32 linkID1, Cm::SpatialVectorV& v0, Cm::SpatialVectorV& v1) + { + { + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + ArticulationLink* links = mArticulationData.getLinks(); + + Cm::SpatialVectorF deltaV(PxVec3(0.f), PxVec3(0.f)); + + if (!fixBase) + { + //deltaV = mArticulationData.mBaseInvSpatialArticulatedInertia * (-deferredZ[0]); + deltaV = mArticulationData.mBaseInvSpatialArticulatedInertiaW * (-mArticulationData.mRootDeferredZ); + } + + + const PxU32* pathToRootElements = mArticulationData.mPathToRootElements; + + Dy::ArticulationLink& link0 = links[linkID]; + Dy::ArticulationLink& link1 = links[linkID1]; + + const PxU32* pathToRoot0 = &pathToRootElements[link0.mPathToRootStartIndex]; + const PxU32* pathToRoot1 = &pathToRootElements[link1.mPathToRootStartIndex]; + + const PxU32 numElems0 = link0.mPathToRootCount; + const PxU32 numElems1 = link1.mPathToRootCount; + + PxU32 offset = 0; + while (pathToRoot0[offset] == pathToRoot1[offset]) + { + const PxU32 index = pathToRoot0[offset++]; + PX_ASSERT(links[index].parent < index); + if (offset >= numElems0 || offset >= numElems1) + break; + + const PxU32 jointOffset = mArticulationData.getJointData(index).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(index).dof; + + deltaV = propagateAccelerationW(mArticulationData.getRw(index), mArticulationData.mInvStIs[index], + &mArticulationData.mWorldMotionMatrix[jointOffset], deltaV, dofCount, &mArticulationData.mIsW[jointOffset], &mArticulationData.mDeferredQstZ[jointOffset]); + } + + Cm::SpatialVectorF deltaV1 = deltaV; + + for (PxU32 idx = offset; idx < numElems0; ++idx) + { + const PxU32 index = pathToRoot0[idx]; + PX_ASSERT(links[index].parent < index); + + const PxU32 jointOffset = mArticulationData.getJointData(index).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(index).dof; + + deltaV = propagateAccelerationW(mArticulationData.getRw(index), mArticulationData.mInvStIs[index], + &mArticulationData.mWorldMotionMatrix[jointOffset], deltaV, dofCount, &mArticulationData.mIsW[jointOffset], &mArticulationData.mDeferredQstZ[jointOffset]); + + } + + for (PxU32 idx = offset; idx < numElems1; ++idx) + { + const PxU32 index = pathToRoot1[idx]; + PX_ASSERT(links[index].parent < index); + + const PxU32 jointOffset = mArticulationData.getJointData(index).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(index).dof; + + deltaV1 = propagateAccelerationW(mArticulationData.getRw(index), mArticulationData.mInvStIs[index], + &mArticulationData.mWorldMotionMatrix[jointOffset], deltaV1, dofCount, &mArticulationData.mIsW[jointOffset], &mArticulationData.mDeferredQstZ[jointOffset]); + + } + + + + Cm::SpatialVectorF vel = mArticulationData.getMotionVelocity(linkID) + deltaV; + + v0 = Cm::SpatialVector(vel.bottom, vel.top); + + Cm::SpatialVectorF vel1 = mArticulationData.getMotionVelocity(linkID1) + deltaV1; + + v1 = Cm::SpatialVector(vel1.bottom, vel1.top); + } + } + + /*Cm::SpatialVectorV FeatherstoneArticulation::pxcFsGetVelocity(PxU32 linkID) + { + + Cm::SpatialVectorF& vel = mArticulationData.getMotionVelocity(linkID); + + return Cm::SpatialVector(vel.bottom, vel.top); + }*/ + + Cm::SpatialVectorV FeatherstoneArticulation::pxcFsGetVelocityTGS(PxU32 linkID) + { + return getLinkVelocity(linkID); + } + + //This is used in the solveExt1D, solveExtContact + void FeatherstoneArticulation::pxcFsApplyImpulse(PxU32 linkID, + aos::Vec3V linear, aos::Vec3V angular, + Cm::SpatialVectorF* /*Z*/, Cm::SpatialVectorF* /*deltaV*/) + { + const ArticulationSolverDesc* desc = &mSolverDesc; + + ArticulationLink* links = static_cast(desc->links); + + //initialize all zero acceration impulse to be zero + ArticulationData& data = mArticulationData; + + data.mJointDirty = true; + + //impulse is in world space + Cm::SpatialVector impulse; + V4StoreA(Vec4V_From_Vec3V(angular), &impulse.angular.x); + V4StoreA(Vec4V_From_Vec3V(linear), &impulse.linear.x); + Cm::SpatialVectorF Z0(-impulse.linear, -impulse.angular); + + + + for (PxU32 i = linkID; i; i = links[i].parent) + { + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + + Z0 = propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(i), &data.mWorldMotionMatrix[jointOffset], Z0, dofCount, &mArticulationData.mDeferredQstZ[jointOffset]); + } + + data.mRootDeferredZ += Z0; + } + + void FeatherstoneArticulation::pxcFsApplyImpulses(Cm::SpatialVectorF* Z) + { + ArticulationLink* links = mArticulationData.getLinks(); + + //initialize all zero acceration impulse to be zero + ArticulationData& data = mArticulationData; + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + const PxU32 startIndex = PxU32(linkCount - 1); + + data.mJointDirty = true; + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& tLink = links[linkID]; + const PxU32 jointOffset = mArticulationData.getJointData(linkID).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(linkID).dof; + + Cm::SpatialVectorF ZA = Z[linkID]; + + Z[tLink.parent] += propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(linkID), &data.mWorldMotionMatrix[jointOffset], ZA, + dofCount, &mArticulationData.mDeferredQstZ[jointOffset]); + + } + data.mRootDeferredZ += Z[0]; + } + + void FeatherstoneArticulation::pxcFsApplyImpulses(PxU32 linkID, const aos::Vec3V& linear, + const aos::Vec3V& angular, PxU32 linkID2, const aos::Vec3V& linear2, + const aos::Vec3V& angular2, Cm::SpatialVectorF* /*Z*/, Cm::SpatialVectorF* /*deltaV*/) + { + if (0) + { + pxcFsApplyImpulse(linkID, linear, angular, NULL, NULL); + pxcFsApplyImpulse(linkID2, linear2, angular2, NULL, NULL); + } + else + { + const ArticulationSolverDesc* desc = &mSolverDesc; + ArticulationData& data = mArticulationData; + data.mJointDirty = true; + ArticulationLink* links = static_cast(desc->links); + + //impulse is in world space + Cm::SpatialVector impulse0; + V3StoreU(angular, impulse0.angular); + V3StoreU(linear, impulse0.linear); + + Cm::SpatialVector impulse1; + V3StoreU(angular2, impulse1.angular); + V3StoreU(linear2, impulse1.linear); + + Cm::SpatialVectorF Z1(-impulse0.linear, -impulse0.angular); + Cm::SpatialVectorF Z2(-impulse1.linear, -impulse1.angular); + + ArticulationLink& link0 = links[linkID]; + ArticulationLink& link1 = links[linkID2]; + + const PxU32* pathToRoot0 = &mArticulationData.mPathToRootElements[link0.mPathToRootStartIndex]; + const PxU32* pathToRoot1 = &mArticulationData.mPathToRootElements[link1.mPathToRootStartIndex]; + + const PxU32 numElems0 = link0.mPathToRootCount; + const PxU32 numElems1 = link1.mPathToRootCount; + + //find the common link, work from one to that common, then the other to that common, then go from there upwards... + PxU32 offset = 0; + PxU32 commonLink = 0; + while (pathToRoot0[offset] == pathToRoot1[offset]) + { + commonLink = pathToRoot0[offset++]; + PX_ASSERT(links[commonLink].parent < commonLink); + if (offset >= numElems0 || offset >= numElems1) + break; + } + + //The common link will either be linkID2, or its ancestors. + //The common link cannot be an index before either linkID2 or linkID + for (PxU32 i = linkID2; i != commonLink; i = links[i].parent) + { + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + Z2 = propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(i), &data.mWorldMotionMatrix[jointOffset], Z2, dofCount, &data.mDeferredQstZ[jointOffset]); + } + + for (PxU32 i = linkID; i != commonLink; i = links[i].parent) + { + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + Z1 = propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(i), &data.mWorldMotionMatrix[jointOffset], Z1, dofCount, + &data.mDeferredQstZ[jointOffset]); + } + + Cm::SpatialVectorF ZCommon = Z1 + Z2; + + for (PxU32 i = commonLink; i; i = links[i].parent) + { + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + ZCommon = propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(i), &data.mWorldMotionMatrix[jointOffset], ZCommon, dofCount, + &data.mDeferredQstZ[jointOffset]); + } + + data.mRootDeferredZ += ZCommon; + } + } + + //Z is the link space(drag force) + void FeatherstoneArticulation::applyImpulses(Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) + { + ArticulationLink* links = mArticulationData.getLinks(); + + //initialize all zero acceration impulse to be zero + ArticulationData& data = mArticulationData; + + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + const PxU32 startIndex = PxU32(linkCount - 1); + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& tLink = links[linkID]; + const PxU32 jointOffset = mArticulationData.getJointData(linkID).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(linkID).dof; + + Z[tLink.parent] += propagateImpulseW(&data.mIsInvDW[jointOffset], mArticulationData.getRw(linkID), &data.mWorldMotionMatrix[jointOffset], Z[linkID], dofCount); + } + + getDeltaV(Z, deltaV); + } + + void FeatherstoneArticulation::getDeltaV(Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) + { + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + Cm::SpatialVectorF* motionVelocities = mArticulationData.getMotionVelocities(); + ArticulationLink* links = mArticulationData.getLinks(); + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + + //This will be zero at the begining of the frame + PxReal* jointDeltaVelocities = mArticulationData.getJointNewVelocities(); + + if (fixBase) + { + deltaV[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + } + else + { + + deltaV[0] = mArticulationData.mBaseInvSpatialArticulatedInertiaW * (-Z[0]); + motionVelocities[0] += deltaV[0]; + + PX_ASSERT(motionVelocities[0].isFinite()); + } + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + for (PxU32 i = 1; i < linkCount; i++) + { + ArticulationLink& tLink = links[i]; + ArticulationJointCoreData& tJointDatum = jointData[i]; + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + Cm::SpatialVectorF dV = propagateVelocityW(mArticulationData.getRw(i), mArticulationData.mWorldSpatialArticulatedInertia[i], + mArticulationData.mInvStIs[i], &mArticulationData.mWorldMotionMatrix[jointOffset], Z[i], &jointDeltaVelocities[tJointDatum.jointOffset], deltaV[tLink.parent], dofCount); + + deltaV[i] = dV; + + motionVelocities[i] += dV; + + PX_ASSERT(motionVelocities[i].isFinite()); + } + } + + //This version uses in updateBodies + PxQuat computeSphericalJointPositions(const PxQuat& relativeQuat, + const PxQuat& newRot, const PxQuat& pBody2WorldRot, + PxReal* jPositions, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxU32 dofs); + + PxQuat computeSphericalJointPositions(const PxQuat& relativeQuat, + const PxQuat& newRot, const PxQuat& pBody2WorldRot); + + PxTransform FeatherstoneArticulation::propagateTransform(const PxU32 linkID, ArticulationLink* links, + ArticulationJointCoreData& jointDatum, Cm::SpatialVectorF* motionVelocities, const PxReal dt, const PxTransform& pBody2World, + const PxTransform& currentTransform, PxReal* jointVelocities, PxReal* jointPositions, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::UnAlignedSpatialVector* worldMotionMatrix) + { + ArticulationLink& link = links[linkID]; + + const PxQuat relativeQuat = mArticulationData.mRelativeQuat[linkID]; + + ArticulationJointCore* joint = link.inboundJoint; + + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + PxQuat newParentToChild; + PxQuat newWorldQ; + PxVec3 r; + + const PxVec3 childOffset = -joint->childPose.p; + const PxVec3 parentOffset = joint->parentPose.p; + + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + PxReal tJointPosition = jPosition[0] + (jVelocity[0]) * dt; + + const PxU32 dofId = link.inboundJoint->dofIds[0]; + + if (link.inboundJoint->motion[dofId] == PxArticulationMotion::eLIMITED) + { + if (tJointPosition < (link.inboundJoint->limits[dofId].low)) + tJointPosition = link.inboundJoint->limits[dofId].low; + if (tJointPosition >(link.inboundJoint->limits[dofId].high)) + tJointPosition = link.inboundJoint->limits[dofId].high; + } + + jPosition[0] = tJointPosition; + + newParentToChild = relativeQuat; + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + r = e + d + motionMatrix[0].bottom * tJointPosition; + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + PxReal tJointPosition = jPosition[0] + (jVelocity[0]) * dt; + + /*PxU8 dofId = link.inboundJoint->dofIds[0]; + if (link.inboundJoint->motion[dofId] == PxArticulationMotion::eLIMITED) + { + if (tJointPosition < (link.inboundJoint->limits[dofId].low)) + tJointPosition = link.inboundJoint->limits[dofId].low; + if (tJointPosition >(link.inboundJoint->limits[dofId].high)) + tJointPosition = link.inboundJoint->limits[dofId].high; + }*/ + + jPosition[0] = tJointPosition; + + const PxVec3& u = motionMatrix[0].top; + + PxQuat jointRotation = PxQuat(-tJointPosition, u); + if (jointRotation.w < 0) //shortest angle. + jointRotation = -jointRotation; + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + if (1)//jointDatum.dof < 3) + { + Cm::SpatialVectorF worldVel = motionVelocities[linkID]; + + const PxTransform oldTransform = currentTransform; + + + PxVec3 worldAngVel = worldVel.top; + //PxVec3 worldAngVel = motionVelocities[linkID].top; + + PxReal dist = worldAngVel.normalize() * dt; + + if (dist > 1e-6f) + newWorldQ = PxQuat(dist, worldAngVel) * oldTransform.q; + else + newWorldQ = oldTransform.q; + + //newWorldQ = Ps::exp(worldAngVel*dt) * oldTransform.q; + + //PxVec3 axis; + + newParentToChild = computeSphericalJointPositions(mArticulationData.mRelativeQuat[linkID], newWorldQ, + pBody2World.q); + + PxQuat jointRotation = newParentToChild * relativeQuat.getConjugate(); + + /*PxVec3 axis = jointRotation.getImaginaryPart(); + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + PxVec3 sa = mArticulationData.getMotionMatrix(jointDatum.jointOffset + i).top; + PxReal angle = -compAng(sa.dot(axis), jointRotation.w); + jPosition[i] = angle; + }*/ + + PxVec3 axis; PxReal angle; + jointRotation.toRadiansAndUnitAxis(angle, axis); + axis *= angle; + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + PxVec3 sa = mArticulationData.getMotionMatrix(jointDatum.jointOffset + i).top; + PxReal ang = -sa.dot(axis); + jPosition[i] = ang; + } + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + } + else + { + PxVec3 worldAngVel = motionVelocities[linkID].top; + + newWorldQ = PxExp(worldAngVel*dt) * currentTransform.q; + + newParentToChild = computeSphericalJointPositions(mArticulationData.mRelativeQuat[linkID], newWorldQ, + pBody2World.q, jPosition, motionMatrix, jointDatum.dof); + + /*PxQuat newQ = (pBody2World.q * newParentToChild.getConjugate()).getNormalized(); + + const PxQuat cB2w = newQ * joint->childPose.q; + + const PxMat33 cB2w_m(cB2w); + + const PxVec3* axis = &cB2w_m.column0; + + PxU32 dofIdx = 0;*/ + PxVec3 relAngVel = worldAngVel - motionVelocities[link.parent].top; + + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + jVelocity[i] = worldMotionMatrix[i].top.dot(relAngVel); + } + } + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + break; + } + case PxArticulationJointType::eFIX: + { + //this is fix joint so joint don't have velocity + newParentToChild = relativeQuat; + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + r = e + d; + break; + } + default: + break; + } + + PxTransform cBody2World; + cBody2World.q = (pBody2World.q * newParentToChild.getConjugate()).getNormalized(); + cBody2World.p = pBody2World.p + cBody2World.q.rotate(r); + + PX_ASSERT(cBody2World.isSane()); + + return cBody2World; + } + + const PxTransform& FeatherstoneArticulation::getCurrentTransform(PxU32 linkID) const + { + return mArticulationData.mAccumulatedPoses[linkID]; + } + + const PxQuat& FeatherstoneArticulation::getDeltaQ(PxU32 linkID) const + { + return mArticulationData.mDeltaQ[linkID]; + } + + ////Z is the spatial acceleration impulse of links[linkID] + //Cm::SpatialVectorF FeatherstoneArticulation::propagateVelocity(const Dy::SpatialTransform& c2p, const Dy::SpatialMatrix& spatialInertia, + // const InvStIs& invStIs, const SpatialSubspaceMatrix& motionMatrix, const Cm::SpatialVectorF& Z, PxReal* jointVelocity, const Cm::SpatialVectorF& hDeltaV) + //{ + // const PxU32 dofCount = motionMatrix.getNumColumns(); + // Cm::SpatialVectorF pDeltaV = c2p.transposeTransform(hDeltaV); //parent velocity change + + // Cm::SpatialVectorF temp = spatialInertia * pDeltaV + Z; + + // PxReal tJointDelta[6]; + // for (PxU32 ind = 0; ind < dofCount; ++ind) + // { + // const Cm::SpatialVectorF& sa = motionMatrix[ind]; + // tJointDelta[ind] = -sa.innerProduct(temp); + // } + + // Cm::SpatialVectorF jointSpatialDeltaV(PxVec3(0.f), PxVec3(0.f)); + + // for (PxU32 ind = 0; ind < dofCount; ++ind) + // { + // PxReal jDelta = 0.f; + // for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + // { + // jDelta += invStIs.invStIs[ind2][ind] * tJointDelta[ind2]; + // } + + // jointVelocity[ind] += jDelta; + + // const Cm::SpatialVectorF& sa = motionMatrix[ind]; + // jointSpatialDeltaV += sa * jDelta; + // } + + // return pDeltaV + jointSpatialDeltaV; + //} + + ////This method calculate the velocity change due to collision/constraint impulse + //Cm::SpatialVectorF FeatherstoneArticulation::propagateVelocityTestImpulse(const Dy::SpatialTransform& c2p, const Dy::SpatialMatrix& spatialInertia, + // const InvStIs& invStIs, const SpatialSubspaceMatrix& motionMatrix, const Cm::SpatialVectorF& Z, + // const Cm::SpatialVectorF& hDeltaV) + //{ + // const PxU32 dofCount = motionMatrix.getNumColumns(); + // Cm::SpatialVectorF pDeltaV = c2p.transposeTransform(hDeltaV); //parent velocity change + + // Cm::SpatialVectorF temp = spatialInertia * pDeltaV + Z; + + // PxReal tJointDelta[6]; + // for (PxU32 ind = 0; ind < dofCount; ++ind) + // { + // const Cm::SpatialVectorF& sa = motionMatrix[ind]; + // tJointDelta[ind] = -sa.innerProduct(temp); + // } + + // Cm::SpatialVectorF jointSpatialDeltaV(PxVec3(0.f), PxVec3(0.f)); + + // for (PxU32 ind = 0; ind < dofCount; ++ind) + // { + // PxReal jDelta = 0.f; + // for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + // { + // jDelta += invStIs.invStIs[ind2][ind] * tJointDelta[ind2]; + // } + + // const Cm::SpatialVectorF& sa = motionMatrix[ind]; + // jointSpatialDeltaV += sa * jDelta; + // } + + // return pDeltaV + jointSpatialDeltaV; + //} + + PX_CUDA_CALLABLE PX_FORCE_INLINE Cm::SpatialVectorF translateImpulse(const Cm::SpatialVectorF& s, const PxVec3& offset) + { + return Cm::SpatialVectorF(s.top, offset.cross(s.top) + s.bottom); + } + + //This method calculate the velocity change due to collision/constraint impulse, record joint velocity and acceleration + Cm::SpatialVectorF FeatherstoneArticulation::propagateVelocityW(const PxVec3& c2p, const Dy::SpatialMatrix& spatialInertia, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, + PxReal* jointVelocity, const Cm::SpatialVectorF& hDeltaV, const PxU32 dofCount) + { + Cm::SpatialVectorF pDeltaV = translateImpulse(hDeltaV, -c2p); //parent velocity change + + Cm::SpatialVectorF temp = spatialInertia * pDeltaV + Z; + + PxReal tJointDelta[6]; + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + tJointDelta[ind] = -sa.innerProduct(temp); + } + + Cm::SpatialVectorF jointSpatialDeltaV(PxVec3(0.f), PxVec3(0.f)); + + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + PxReal jDelta = 0.f; + for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + { + jDelta += invStIs.invStIs[ind2][ind] * tJointDelta[ind2]; + } + + jointVelocity[ind] += jDelta; + + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + jointSpatialDeltaV.top += sa.top * jDelta; + jointSpatialDeltaV.bottom += sa.bottom * jDelta; + } + + return pDeltaV + jointSpatialDeltaV; + } + + Cm::SpatialVectorF FeatherstoneArticulation::propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + PxReal* jointVelocity, const Cm::SpatialVectorF& pAcceleration, const PxU32 dofCount, const Cm::SpatialVectorF* IsW, PxReal* qstZIc) + { + Cm::SpatialVectorF motionAcceleration = translateImpulse(pAcceleration, -c2p); //parent velocity change + + PxReal tJAccel[3]; + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + //stI * pAcceleration + const PxReal temp = IsW[ind].innerProduct(motionAcceleration); + + tJAccel[ind] = (qstZIc[ind] - temp); + } + + //calculate jointAcceleration + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + PxReal jVel = 0.f; + //for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + { + jVel += invStIs.invStIs[ind2][ind] * tJAccel[ind2]; + } + //PX_ASSERT(PxAbs(jointAcceleration[ind]) < 5000); + + motionAcceleration.top += motionMatrix[ind].top * jVel; + motionAcceleration.bottom += motionMatrix[ind].bottom * jVel; + + jointVelocity[ind] += jVel; + } + + return motionAcceleration; + } + + Cm::SpatialVectorF FeatherstoneArticulation::propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + const Cm::SpatialVectorF& pAcceleration, const PxU32 dofCount, const Cm::SpatialVectorF* IsW, PxReal* qstZ) + { + Cm::SpatialVectorF motionAcceleration = translateImpulse(pAcceleration, -c2p); //parent velocity change + + PxReal tJAccel[3]; + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + //stI * pAcceleration + const PxReal temp = IsW[ind].innerProduct(motionAcceleration); + + tJAccel[ind] = (qstZ[ind] - temp); + } + + //calculate jointAcceleration + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + PxReal jVel = 0.f; + for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + { + jVel += invStIs.invStIs[ind2][ind] * tJAccel[ind2]; + } + //PX_ASSERT(PxAbs(jointAcceleration[ind]) < 5000); + + motionAcceleration.top += motionMatrix[ind].top * jVel; + motionAcceleration.bottom += motionMatrix[ind].bottom * jVel; + } + + return motionAcceleration; + } + + + Cm::SpatialVectorF FeatherstoneArticulation::propagateAccelerationW(const PxVec3& c2p, + const InvStIs& invStIs, const Cm::UnAlignedSpatialVector* motionMatrix, + PxReal* jointVelocity, const Cm::SpatialVectorF& pAcceleration, Cm::SpatialVectorF& Z, const PxU32 dofCount, const Cm::SpatialVectorF* IsW) + { + Cm::SpatialVectorF motionAcceleration = translateImpulse(pAcceleration, -c2p); //parent velocity change + + PxReal tJAccel[3]; + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + //stI * pAcceleration + const PxReal temp = IsW[ind].innerProduct(motionAcceleration); + PxReal qstZ = -motionMatrix[ind].innerProduct(Z); + tJAccel[ind] = (qstZ - temp); + } + + //calculate jointAcceleration + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + PxReal jVel = 0.f; + for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + { + jVel += invStIs.invStIs[ind2][ind] * tJAccel[ind2]; + } + //PX_ASSERT(PxAbs(jointAcceleration[ind]) < 5000); + + motionAcceleration.top += motionMatrix[ind].top * jVel; + motionAcceleration.bottom += motionMatrix[ind].bottom * jVel; + + jointVelocity[ind] += jVel; + } + + return motionAcceleration; + } + + + //This method calculate the velocity change due to collision/constraint impulse + Cm::SpatialVectorF FeatherstoneArticulation::propagateVelocityTestImpulseW(const PxVec3& c2p, const Dy::SpatialMatrix& spatialInertia, const InvStIs& invStIs, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const Cm::SpatialVectorF& hDeltaV, const PxU32 dofCount) + { + Cm::SpatialVectorF pDeltaV = translateImpulse(hDeltaV, -c2p); //parent velocity change + + //Convert parent velocity change into an impulse + Cm::SpatialVectorF temp = spatialInertia * pDeltaV + Z; + + PxReal tJointDelta[3]; + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + tJointDelta[ind] = -sa.innerProduct(temp); + } + + Cm::SpatialVectorF jointSpatialDeltaV(PxVec3(0.f), PxVec3(0.f)); + + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + PxReal jDelta = 0.f; + for (PxU32 ind2 = 0; ind2 < dofCount; ++ind2) + { + jDelta += invStIs.invStIs[ind2][ind] * tJointDelta[ind2]; + } + + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + jointSpatialDeltaV.top += sa.top * jDelta; + jointSpatialDeltaV.bottom += sa.bottom * jDelta; + } + + return pDeltaV + jointSpatialDeltaV; + } + + + //Cm::SpatialVectorF FeatherstoneArticulation::propagateImpulse(const IsInvD& isInvD, + // const SpatialTransform& childToParent, const SpatialSubspaceMatrix& motionMatrix, const Cm::SpatialVectorF& Z) + //{ + // const PxU32 dofCount = motionMatrix.getNumColumns(); + // Cm::SpatialVectorF temp(PxVec3(0.f), PxVec3(0.f)); + + // for (PxU32 ind = 0; ind < dofCount; ++ind) + // { + // const Cm::SpatialVectorF& sa = motionMatrix[ind]; + // const PxReal stZ = sa.innerProduct(Z); + // temp += isInvD.isInvD[ind] * stZ; + // } + + // //parent space's spatial zero acceleration impulse + // return childToParent * (Z - temp); + //} + + Cm::SpatialVectorF FeatherstoneArticulation::propagateImpulseW(const Cm::SpatialVectorF* isInvD, const PxVec3& childToParent, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const PxU32 dofCount) + { + Cm::SpatialVectorF temp(PxVec3(0.f), PxVec3(0.f)); + + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + const PxReal stZ = sa.innerProduct(Z); + temp += isInvD[ind] * stZ; + } + + //parent space's spatial zero acceleration impulse + + return FeatherstoneArticulation::translateSpatialVector(childToParent, (Z-temp)); + /*Cm::SpatialVectorF temp2 = (Z - temp); + temp2.bottom += childToParent.cross(temp2.top); + return temp2;*/ + } + + Cm::SpatialVectorF FeatherstoneArticulation::propagateImpulseW(const Cm::SpatialVectorF* isInvD, const PxVec3& childToParent, + const Cm::UnAlignedSpatialVector* motionMatrix, const Cm::SpatialVectorF& Z, const PxU32 dofCount, PxReal* qsztZ) + { + Cm::SpatialVectorF temp = Z; + + for (PxU32 ind = 0; ind < dofCount; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + const PxReal stZ = -sa.innerProduct(Z); + PX_ASSERT(PxIsFinite(stZ)); + qsztZ[ind] += stZ; + PX_ASSERT(PxIsFinite(qsztZ[ind])); + temp += isInvD[ind] * stZ; + } + + //parent space's spatial zero acceleration impulse + return FeatherstoneArticulation::translateSpatialVector(childToParent, temp); + } + + Cm::SpatialVectorF FeatherstoneArticulation::getDeltaVWithDeltaJV(const bool fixBase, const PxU32 linkID, + const ArticulationData& data, Cm::SpatialVectorF* Z, + PxReal* jointVelocities) + { + Cm::SpatialVectorF deltaV = Cm::SpatialVectorF::Zero(); + if (!fixBase) + { + //velocity change + //SpatialMatrix inverseArticulatedInertia = hLinkDatum.spatialArticulatedInertia.getInverse(); + const SpatialMatrix& inverseArticulatedInertia = data.mBaseInvSpatialArticulatedInertiaW; + deltaV = inverseArticulatedInertia * (-Z[0]); + } + + ArticulationLink* links = data.getLinks(); + const ArticulationLink& link = links[linkID]; + const PxU32* pathToRoot = &data.mPathToRootElements[link.mPathToRootStartIndex]; + const PxU32 numElems = link.mPathToRootCount; + + for (PxU32 i = 0; i < numElems; ++i) + { + const PxU32 index = pathToRoot[i]; + PX_ASSERT(links[index].parent < index); + ArticulationJointCoreData& tJointDatum = data.getJointData(index); + PxReal* jVelocity = &jointVelocities[tJointDatum.jointOffset]; + deltaV = FeatherstoneArticulation::propagateVelocityW(data.getRw(index), data.mWorldSpatialArticulatedInertia[index], + data.mInvStIs[index], &data.mWorldMotionMatrix[tJointDatum.jointOffset], Z[index], jVelocity, deltaV, tJointDatum.dof); + } + + return deltaV; + } + + Cm::SpatialVectorF FeatherstoneArticulation::getDeltaV(const bool fixBase, const PxU32 linkID, + const ArticulationData& data, Cm::SpatialVectorF* Z) + { + Cm::SpatialVectorF deltaV = Cm::SpatialVectorF::Zero(); + if (!fixBase) + { + //velocity change + //SpatialMatrix inverseArticulatedInertia = hLinkDatum.spatialArticulatedInertia.getInverse(); + const SpatialMatrix& inverseArticulatedInertia = data.mBaseInvSpatialArticulatedInertiaW; + deltaV = inverseArticulatedInertia * (-Z[0]); + } + + ArticulationLink* links = data.getLinks(); + ArticulationLink& link = links[linkID]; + const PxU32* pathToRoot = &data.mPathToRootElements[link.mPathToRootStartIndex]; + const PxU32 numElems = link.mPathToRootCount; + + for (PxU32 i = 0; i < numElems; ++i) + { + const PxU32 index = pathToRoot[i]; + PX_ASSERT(links[index].parent < index); + + const PxU32 jointOffset = data.getJointData(index).jointOffset; + const PxU32 dofCount = data.getJointData(index).dof; + + PxReal jDeltaV[3]; + deltaV = propagateAccelerationW(data.getRw(index), data.mInvStIs[index], + &data.mWorldMotionMatrix[jointOffset], jDeltaV, deltaV, Z[index], dofCount, &data.mIsW[jointOffset]); + } + + return deltaV; + } + + void FeatherstoneArticulation::getZ(const PxU32 linkID, + const ArticulationData& data, Cm::SpatialVectorF* Z, + const Cm::SpatialVectorF& impulse) + { + ArticulationLink* links = data.getLinks(); + + //impulse need to be in linkID space!!! + Z[linkID] = -impulse; + + for (PxU32 i = linkID; i; i = links[i].parent) + { + ArticulationLink& tLink = links[i]; + const PxU32 jointOffset = data.getJointData(i).jointOffset; + const PxU32 dofCount = data.getJointData(i).dof; + Z[tLink.parent] = FeatherstoneArticulation::propagateImpulseW(&data.mIsInvDW[jointOffset], data.getRw(i), + &data.mWorldMotionMatrix[jointOffset], Z[i], dofCount); + } + } + + Cm::SpatialVectorF FeatherstoneArticulation::getImpulseResponseW( + const PxU32 linkID, + const ArticulationData& data, + const Cm::SpatialVectorF& impulse) + { + return data.getImpulseResponseMatrixWorld()[linkID].getResponse(impulse); + } + + //This method use in impulse self response. The input impulse is in the link space + Cm::SpatialVectorF FeatherstoneArticulation::getImpulseResponseWithJ( + const PxU32 linkID, + const bool fixBase, + const ArticulationData& data, + Cm::SpatialVectorF* Z, + const Cm::SpatialVectorF& impulse, + PxReal* jointVelocites) + { + getZ(linkID, data, Z, impulse); + + return getDeltaVWithDeltaJV(fixBase, linkID, data, Z, jointVelocites); + } + + void FeatherstoneArticulation::saveVelocity(const ArticulationSolverDesc& d, Cm::SpatialVectorF* deltaV) + { + FeatherstoneArticulation* arti = static_cast(d.articulation); + ArticulationData& data = arti->mArticulationData; + + //update all links' motion velocity, joint delta velocity if there are contacts/constraints + if (data.mJointDirty) + { + bool doForces = (data.getArticulationFlags() & PxArticulationFlag::eCOMPUTE_JOINT_FORCES) || data.getSensorCount(); + PxcFsFlushVelocity(*arti, deltaV, doForces); + } + + const PxU32 linkCount = data.getLinkCount(); + //copy motion velocites + Cm::SpatialVectorF* vels = data.getMotionVelocities(); + Cm::SpatialVectorF* posVels = data.getPosIterMotionVelocities(); + PxMemCopy(posVels, vels, sizeof(Cm::SpatialVectorF) * linkCount); + + //copy joint velocities + const PxU32 dofs = data.getDofs(); + + PxReal* jPosVels = data.getPosIterJointVelocities(); + + const PxReal* jNewVels = data.getJointNewVelocities(); + + PxMemCopy(jPosVels, jNewVels, sizeof(PxReal) * dofs); + + static_cast(d.articulation)->concludeInternalConstraints(false); + + /* for (PxU32 i = 0; i < dofs; ++i) + { + PX_ASSERT(PxAbs(jPosDeltaVels[i]) < 30.f); + }*/ + } + + void FeatherstoneArticulation::saveVelocityTGS(const ArticulationSolverDesc& d, PxReal invDtF32) + { + FeatherstoneArticulation* arti = static_cast(d.articulation); + ArticulationData& data = arti->mArticulationData; + + //KS - we should not need to flush velocity because we will have already stepped the articulation with TGS + + const PxU32 linkCount = data.getLinkCount(); + Cm::SpatialVectorF* posVels = data.getPosIterMotionVelocities(); + for (PxU32 i = 0; i < linkCount; ++i) + { + posVels[i] = posVels[i] * invDtF32; + } + } + + void FeatherstoneArticulation::getImpulseSelfResponse( + PxU32 linkID0, + PxU32 linkID1, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse0, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV0, + Cm::SpatialVector& deltaV1) const + { + FeatherstoneArticulation::getImpulseSelfResponse(mArticulationData.getLinks(), + Z, const_cast(mArticulationData), linkID0, reinterpret_cast(impulse0), + reinterpret_cast(deltaV0), linkID1, reinterpret_cast(impulse1), + reinterpret_cast(deltaV1)); + } + + void FeatherstoneArticulation::getImpulseResponseSlow(Dy::ArticulationLink* links, + ArticulationData& data, + PxU32 linkID0_, + const Cm::SpatialVector& impulse0, + Cm::SpatialVector& deltaV0, + PxU32 linkID1_, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV1, + Cm::SpatialVectorF* /*Z*/) + { + const PxU32 linkCount = data.getLinkCount(); + + PX_ALLOCA(_stack, PxU32, linkCount); + PxU32* stack = _stack; + + PxU32 i0, i1;//, ic; + + PxU32 linkID0 = linkID0_; + PxU32 linkID1 = linkID1_; + + for (i0 = linkID0, i1 = linkID1; i0 != i1;) // find common path + { + if (i0 i0;) + { + //Dy::ArticulationLinkData& tLinkDatum = data.getLinkData(stack[index]); + const PxU32 id = stack[index]; + const PxU32 jointOffset = data.getJointData(id).jointOffset; + const PxU32 dofCount = data.getJointData(id).dof; + dv1 = propagateAccelerationW(data.getRw(id), data.mInvStIs[id], + &data.mWorldMotionMatrix[jointOffset], dv1, dofCount, &data.mIsW[jointOffset], &qstZ[jointOffset]); + } + + Cm::SpatialVectorF dv0= v; + for (PxU32 index = i0; (index--) > 0;) + { + const PxU32 id = stack[index]; + const PxU32 jointOffset = data.getJointData(id).jointOffset; + const PxU32 dofCount = data.getJointData(id).dof; + dv0 = propagateAccelerationW(data.getRw(id), data.mInvStIs[id], + &data.mWorldMotionMatrix[jointOffset], dv0, dofCount, &data.mIsW[jointOffset], &qstZ[jointOffset]); + } + + deltaV0.linear = dv0.bottom; + deltaV0.angular = dv0.top; + + deltaV1.linear = dv1.bottom; + deltaV1.angular = dv1.top; + } + + void FeatherstoneArticulation::getImpulseSelfResponse(ArticulationLink* links, + Cm::SpatialVectorF* Z, + ArticulationData& data, + PxU32 linkID0, + const Cm::SpatialVectorV& impulse0, + Cm::SpatialVectorV& deltaV0, + PxU32 linkID1, + const Cm::SpatialVectorV& impulse1, + Cm::SpatialVectorV& deltaV1) + { + + ArticulationLink& link = links[linkID1]; + + if (link.parent == linkID0) + { + PX_ASSERT(linkID0 == link.parent); + PX_ASSERT(linkID0 < linkID1); + + //impulse is in world space + Cm::SpatialVectorF imp1; + V4StoreA(Vec4V_From_Vec3V(impulse1.angular), &imp1.bottom.x); + V4StoreA(Vec4V_From_Vec3V(impulse1.linear), &imp1.top.x); + + Cm::SpatialVectorF imp0; + V4StoreA(Vec4V_From_Vec3V(impulse0.angular), &imp0.bottom.x); + V4StoreA(Vec4V_From_Vec3V(impulse0.linear), &imp0.top.x); + + Cm::SpatialVectorF Z1W(-imp1.top, -imp1.bottom); + + const PxU32 jointOffset1 = data.getJointData(linkID1).jointOffset; + const PxU32 dofCount1 = data.getJointData(linkID1).dof; + + PxReal qstZ[3] = { 0.f, 0.f, 0.f }; + Cm::SpatialVectorF Z0W = FeatherstoneArticulation::propagateImpulseW(&data.mIsInvDW[jointOffset1], data.getRw(linkID1), + &data.mWorldMotionMatrix[jointOffset1], Z1W, dofCount1, qstZ); + + //in parent space + const Cm::SpatialVectorF impulseDifW = imp0 - Z0W; + + //calculate velocity change start from the parent link to the root + const Cm::SpatialVectorF delV0W = FeatherstoneArticulation::getImpulseResponseW(linkID0, data, impulseDifW); + + //calculate velocity change for child link + /*const Cm::SpatialVectorF delV1W = FeatherstoneArticulation::propagateVelocityTestImpulseW(data.getLinkData(linkID1).rw, + data.mWorldSpatialArticulatedInertia[linkID1], data.mInvStIs[linkID1], &data.mWorldMotionMatrix[jointOffset1], Z1W, delV0W, dofCount1);*/ + + const Cm::SpatialVectorF delV1W = propagateAccelerationW(data.getRw(linkID1), data.mInvStIs[linkID1], + &data.mWorldMotionMatrix[jointOffset1], delV0W, dofCount1, &data.mIsW[jointOffset1], qstZ); + + deltaV0.linear = Vec3V_From_Vec4V(V4LoadA(&delV0W.bottom.x)); + deltaV0.angular = Vec3V_From_Vec4V(V4LoadA(&delV0W.top.x)); + deltaV1.linear = Vec3V_From_Vec4V(V4LoadA(&delV1W.bottom.x)); + deltaV1.angular = Vec3V_From_Vec4V(V4LoadA(&delV1W.top.x)); + + } + else + { + getImpulseResponseSlow(links, data, linkID0, reinterpret_cast(impulse0), + reinterpret_cast(deltaV0), linkID1, + reinterpret_cast(impulse1), reinterpret_cast(deltaV1), + Z); + } + } + + + struct ArticulationStaticConstraintSortPredicate + { + bool operator()(const PxSolverConstraintDesc& left, const PxSolverConstraintDesc& right) const + { + PxU32 linkIndexA = left.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? left.linkIndexA : left.linkIndexB; + PxU32 linkIndexB = right.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? right.linkIndexA : right.linkIndexB; + + return linkIndexA < linkIndexB; + } + }; + + bool createFinalizeSolverContactsStep(PxTGSSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal invTotalDt, + const PxReal totalDt, + const PxReal stepDt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator); + + void FeatherstoneArticulation::prepareStaticConstraintsTGS(const PxReal stepDt, const PxReal totalDt, const PxReal invStepDt, const PxReal invTotalDt, + PxsContactManagerOutputIterator& outputs, Dy::ThreadContext& threadContext, PxReal correlationDist, PxReal bounceThreshold, PxReal frictionOffsetThreshold, + PxTGSSolverBodyData* solverBodyData, PxTGSSolverBodyTxInertia* txInertia, PxsConstraintBlockManager& blockManager, + Dy::ConstraintWriteback* constraintWritebackPool, const PxReal biasCoefficient, const PxReal lengthScale) + { + BlockAllocator blockAllocator(blockManager, threadContext.mConstraintBlockStream, threadContext.mFrictionPatchStreamPair, threadContext.mConstraintSize); + + const PxTransform id(PxIdentity); + + PxSort(mStatic1DConstraints.begin(), mStatic1DConstraints.size(), ArticulationStaticConstraintSortPredicate()); + PxSort(mStaticContactConstraints.begin(), mStaticContactConstraints.size(), ArticulationStaticConstraintSortPredicate()); + + for (PxU32 i = 0; i < mStatic1DConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[i]; + + PxU32 linkIndex = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? desc.linkIndexA : desc.linkIndexB; + + PX_ASSERT(desc.constraintLengthOver16 == DY_SC_TYPE_RB_1D); + const Constraint* constraint = reinterpret_cast(desc.constraint); + + SolverConstraintShaderPrepDesc shaderPrepDesc; + PxTGSSolverConstraintPrepDesc prepDesc; + + const PxConstraintSolverPrep solverPrep = constraint->solverPrep; + const void* constantBlock = constraint->constantBlock; + const PxU32 constantBlockByteSize = constraint->constantBlockSize; + const PxTransform& pose0 = (constraint->body0 ? constraint->body0->getPose() : id); + const PxTransform& pose1 = (constraint->body1 ? constraint->body1->getPose() : id); + const PxTGSSolverBodyVel* sbody0 = desc.tgsBodyA; + const PxTGSSolverBodyVel* sbody1 = desc.tgsBodyB; + PxTGSSolverBodyData* sbodyData0 = &solverBodyData[desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc.bodyADataIndex]; + PxTGSSolverBodyData* sbodyData1 = &solverBodyData[desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc.bodyBDataIndex]; + PxTGSSolverBodyTxInertia& txI0 = txInertia[desc.bodyADataIndex]; + PxTGSSolverBodyTxInertia& txI1 = txInertia[desc.bodyBDataIndex]; + + shaderPrepDesc.constantBlock = constantBlock; + shaderPrepDesc.constantBlockByteSize = constantBlockByteSize; + shaderPrepDesc.constraint = constraint; + shaderPrepDesc.solverPrep = solverPrep; + + prepDesc.desc = static_cast(&desc); + prepDesc.bodyFrame0 = pose0; + prepDesc.bodyFrame1 = pose1; + prepDesc.body0 = sbody0; + prepDesc.body1 = sbody1; + prepDesc.body0TxI = &txI0; + prepDesc.body1TxI = &txI1; + prepDesc.bodyData0 = sbodyData0; + prepDesc.bodyData1 = sbodyData1; + prepDesc.linBreakForce = constraint->linBreakForce; + prepDesc.angBreakForce = constraint->angBreakForce; + prepDesc.writeback = &constraintWritebackPool[constraint->index]; + setupConstraintFlags(prepDesc, constraint->flags); + prepDesc.minResponseThreshold = constraint->minResponseThreshold; + + prepDesc.bodyState0 = desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eARTICULATION; + prepDesc.bodyState1 = desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eARTICULATION; + + SetupSolverConstraintStep(shaderPrepDesc, prepDesc, blockAllocator, stepDt, totalDt, invStepDt, invTotalDt, lengthScale, biasCoefficient); + + if (desc.constraint) + { + if (mArticulationData.mNbStatic1DConstraints[linkIndex] == 0) + mArticulationData.mStatic1DConstraintStartIndex[linkIndex] = i; + mArticulationData.mNbStatic1DConstraints[linkIndex]++; + } + else + { + //Shuffle down + mStatic1DConstraints.remove(i); + i--; + } + + + } + + for (PxU32 i = 0; i < mStaticContactConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[i]; + + PxU32 linkIndex = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? desc.linkIndexA : desc.linkIndexB; + + PX_ASSERT(desc.constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT); + + PxTGSSolverContactDesc blockDesc; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + PxcNpWorkUnit& unit = cm->getWorkUnit(); + PxsContactManagerOutput* cmOutput = &outputs.getContactManager(unit.mNpIndex); + + PxTGSSolverBodyVel& b0 = *desc.tgsBodyA; + PxTGSSolverBodyVel& b1 = *desc.tgsBodyB; + + PxTGSSolverBodyData& data0 = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyADataIndex]; + PxTGSSolverBodyData& data1 = desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyBDataIndex]; + + PxTGSSolverBodyTxInertia& txI0 = txInertia[desc.bodyADataIndex]; + PxTGSSolverBodyTxInertia& txI1 = txInertia[desc.bodyBDataIndex]; + + blockDesc.bodyFrame0 = unit.rigidCore0->body2World; + blockDesc.bodyFrame1 = unit.rigidCore1->body2World; + blockDesc.shapeInteraction = cm->getShapeInteraction(); + blockDesc.contactForces = cmOutput->contactForces; + blockDesc.desc = static_cast(&desc); + blockDesc.body0 = &b0; + blockDesc.body1 = &b1; + blockDesc.body0TxI = &txI0; + blockDesc.body1TxI = &txI1; + blockDesc.bodyData0 = &data0; + blockDesc.bodyData1 = &data1; + blockDesc.hasForceThresholds = !!(unit.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD); + blockDesc.disableStrongFriction = !!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION); + blockDesc.bodyState0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? PxSolverContactDesc::eARTICULATION : PxSolverContactDesc::eDYNAMIC_BODY; + blockDesc.bodyState1 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? PxSolverContactDesc::eARTICULATION : (unit.flags & PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR) ? PxSolverContactDesc::eKINEMATIC_BODY : + ((unit.flags & PxcNpWorkUnitFlag::eDYNAMIC_BODY1) ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eSTATIC_BODY); + //blockDesc.flags = unit.flags; + + PxReal maxImpulse0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? static_cast(unit.rigidCore0)->maxContactImpulse : data0.maxContactImpulse; + PxReal maxImpulse1 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? static_cast(unit.rigidCore1)->maxContactImpulse : data1.maxContactImpulse; + + PxReal dominance0 = unit.dominance0 ? 1.f : 0.f; + PxReal dominance1 = unit.dominance1 ? 1.f : 0.f; + + blockDesc.invMassScales.linear0 = blockDesc.invMassScales.angular0 = dominance0; + blockDesc.invMassScales.linear1 = blockDesc.invMassScales.angular1 = dominance1; + blockDesc.restDistance = unit.restDistance; + blockDesc.frictionPtr = unit.frictionDataPtr; + blockDesc.frictionCount = unit.frictionPatchCount; + blockDesc.maxCCDSeparation = PX_MAX_F32; + blockDesc.maxImpulse = PxMin(maxImpulse0, maxImpulse1); + blockDesc.torsionalPatchRadius = unit.mTorsionalPatchRadius; + blockDesc.minTorsionalPatchRadius = unit.mMinTorsionalPatchRadius; + blockDesc.offsetSlop = unit.mOffsetSlop; + + createFinalizeSolverContactsStep(blockDesc, *cmOutput, threadContext, + invStepDt, invTotalDt, totalDt, stepDt, bounceThreshold, frictionOffsetThreshold, + correlationDist, biasCoefficient, blockAllocator); + + getContactManagerConstraintDesc(*cmOutput, *cm, desc); + + unit.frictionDataPtr = blockDesc.frictionPtr; + unit.frictionPatchCount = blockDesc.frictionCount; + //KS - Don't track this for now! + //axisConstraintCount += blockDesc.axisConstraintCount; + + if (desc.constraint) + { + if (mArticulationData.mNbStaticContactConstraints[linkIndex] == 0) + mArticulationData.mStaticContactConstraintStartIndex[linkIndex] = i; + mArticulationData.mNbStaticContactConstraints[linkIndex]++; + } + else + { + //Shuffle down + mStaticContactConstraints.remove(i); + i--; + } + + + } + } + + + void FeatherstoneArticulation::prepareStaticConstraints(const PxReal dt, const PxReal invDt, PxsContactManagerOutputIterator& outputs, + Dy::ThreadContext& threadContext, PxReal correlationDist, PxReal bounceThreshold, PxReal frictionOffsetThreshold, + PxReal ccdMaxSeparation, PxSolverBodyData* solverBodyData, PxsConstraintBlockManager& blockManager, + Dy::ConstraintWriteback* constraintWritebackPool) + { + BlockAllocator blockAllocator(blockManager, threadContext.mConstraintBlockStream, threadContext.mFrictionPatchStreamPair, threadContext.mConstraintSize); + + const PxTransform id(PxIdentity); + + Cm::SpatialVectorF* Z = threadContext.mZVector.begin(); + + PxSort(mStatic1DConstraints.begin(), mStatic1DConstraints.size(), ArticulationStaticConstraintSortPredicate()); + PxSort(mStaticContactConstraints.begin(), mStaticContactConstraints.size(), ArticulationStaticConstraintSortPredicate()); + + for (PxU32 i = 0; i < mStatic1DConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[i]; + + PxU32 linkIndex = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? desc.linkIndexA : desc.linkIndexB; + + PX_ASSERT(desc.constraintLengthOver16 == DY_SC_TYPE_RB_1D); + const Constraint* constraint = reinterpret_cast(desc.constraint); + + SolverConstraintShaderPrepDesc shaderPrepDesc; + PxSolverConstraintPrepDesc prepDesc; + + const PxConstraintSolverPrep solverPrep = constraint->solverPrep; + const void* constantBlock = constraint->constantBlock; + const PxU32 constantBlockByteSize = constraint->constantBlockSize; + const PxTransform& pose0 = (constraint->body0 ? constraint->body0->getPose() : id); + const PxTransform& pose1 = (constraint->body1 ? constraint->body1->getPose() : id); + const PxSolverBody* sbody0 = desc.bodyA; + const PxSolverBody* sbody1 = desc.bodyB; + PxSolverBodyData* sbodyData0 = &solverBodyData[desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc.bodyADataIndex]; + PxSolverBodyData* sbodyData1 = &solverBodyData[desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc.bodyBDataIndex]; + + shaderPrepDesc.constantBlock = constantBlock; + shaderPrepDesc.constantBlockByteSize = constantBlockByteSize; + shaderPrepDesc.constraint = constraint; + shaderPrepDesc.solverPrep = solverPrep; + + prepDesc.desc = &desc; + prepDesc.bodyFrame0 = pose0; + prepDesc.bodyFrame1 = pose1; + prepDesc.data0 = sbodyData0; + prepDesc.data1 = sbodyData1; + prepDesc.body0 = sbody0; + prepDesc.body1 = sbody1; + prepDesc.linBreakForce = constraint->linBreakForce; + prepDesc.angBreakForce = constraint->angBreakForce; + prepDesc.writeback = &constraintWritebackPool[constraint->index]; + setupConstraintFlags(prepDesc, constraint->flags); + prepDesc.minResponseThreshold = constraint->minResponseThreshold; + + SetupSolverConstraint(shaderPrepDesc, prepDesc, blockAllocator, dt, invDt, Z); + + if (desc.constraint) + { + if (mArticulationData.mNbStatic1DConstraints[linkIndex] == 0) + mArticulationData.mStatic1DConstraintStartIndex[linkIndex] = i; + mArticulationData.mNbStatic1DConstraints[linkIndex]++; + } + else + { + //Shuffle down + mStatic1DConstraints.remove(i); + i--; + } + + } + + for (PxU32 i = 0; i < mStaticContactConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[i]; + + PxU32 linkIndex = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? desc.linkIndexA : desc.linkIndexB; + + PX_ASSERT(desc.constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT); + + PxSolverContactDesc blockDesc; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + PxcNpWorkUnit& unit = cm->getWorkUnit(); + PxsContactManagerOutput* cmOutput = &outputs.getContactManager(unit.mNpIndex); + + PxSolverBodyData& data0 = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyADataIndex]; + PxSolverBodyData& data1 = desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? solverBodyData[0] : solverBodyData[desc.bodyBDataIndex]; + + blockDesc.data0 = &data0; + blockDesc.data1 = &data1; + + PxU8 flags = unit.rigidCore0->mFlags; + if (unit.rigidCore1) + flags |= PxU8(unit.rigidCore1->mFlags); + + blockDesc.bodyFrame0 = unit.rigidCore0->body2World; + blockDesc.bodyFrame1 = unit.rigidCore1 ? unit.rigidCore1->body2World : id; + blockDesc.shapeInteraction = cm->getShapeInteraction(); + blockDesc.contactForces = cmOutput->contactForces; + blockDesc.desc = &desc; + blockDesc.body0 = desc.bodyA; + blockDesc.body1 = desc.bodyB; + blockDesc.hasForceThresholds = !!(unit.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD); + blockDesc.disableStrongFriction = !!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION); + blockDesc.bodyState0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? PxSolverContactDesc::eARTICULATION : PxSolverContactDesc::eDYNAMIC_BODY; + blockDesc.bodyState1 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? PxSolverContactDesc::eARTICULATION : (unit.flags & PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR) ? PxSolverContactDesc::eKINEMATIC_BODY : + ((unit.flags & PxcNpWorkUnitFlag::eDYNAMIC_BODY1) ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eSTATIC_BODY); + //blockDesc.flags = unit.flags; + + PxReal dominance0 = unit.dominance0 ? 1.f : 0.f; + PxReal dominance1 = unit.dominance1 ? 1.f : 0.f; + + blockDesc.invMassScales.linear0 = blockDesc.invMassScales.angular0 = dominance0; + blockDesc.invMassScales.linear1 = blockDesc.invMassScales.angular1 = dominance1; + blockDesc.restDistance = unit.restDistance; + blockDesc.frictionPtr = unit.frictionDataPtr; + blockDesc.frictionCount = unit.frictionPatchCount; + blockDesc.maxCCDSeparation = (flags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) ? ccdMaxSeparation : PX_MAX_F32; + blockDesc.offsetSlop = unit.mOffsetSlop; + + createFinalizeSolverContacts(blockDesc, *cmOutput, threadContext, invDt, dt, bounceThreshold, frictionOffsetThreshold, + correlationDist, blockAllocator, Z); + + getContactManagerConstraintDesc(*cmOutput, *cm, desc); + + unit.frictionDataPtr = blockDesc.frictionPtr; + unit.frictionPatchCount = blockDesc.frictionCount; + //KS - Don't track this for now! + //axisConstraintCount += blockDesc.axisConstraintCount; + + if (desc.constraint) + { + if (mArticulationData.mNbStaticContactConstraints[linkIndex] == 0) + mArticulationData.mStaticContactConstraintStartIndex[linkIndex] = i; + mArticulationData.mNbStaticContactConstraints[linkIndex]++; + } + else + { + mStaticContactConstraints.remove(i); + i--; + } + } + } + + + static void setupDrive(ArticulationInternalConstraint* constraints, + bool hasDrive, PxArticulationDriveType::Enum driveType, PxReal stiffness, PxReal damping, const PxReal dt, + const PxReal unitResponse, const PxReal recipResponse, const PxReal error, const PxReal targetVelocity, const bool isTGS, + const PxReal maxForce) + { + if (hasDrive) + { + PxReal x = 0.f; + + + if (driveType == PxArticulationDriveType::eTARGET) + { + stiffness = 1e+25f; + damping = 0.f; + driveType = PxArticulationDriveType::eFORCE; + } + else if (driveType == PxArticulationDriveType::eVELOCITY) + { + damping = 1e+25f; + stiffness = 0.f; + driveType = PxArticulationDriveType::eFORCE; + } + + const PxReal a = dt * (dt*stiffness + damping); + const PxReal b = dt * (damping * targetVelocity);// + stiffness * (targetPos - jointPos)); + const PxReal aDamp = dt * dt * (damping + stiffness);// + stiffness * (targetPos - jointPos)); + + PxReal driveBiasCoefficient = 0.f; + + switch (driveType) + { + case PxArticulationDriveType::eFORCE: + { + + x = unitResponse > 0.f ? 1.0f / (1.0f + a*unitResponse) : 0.f; + PxReal xDamp = unitResponse > 0.f ? 1.0f / (1.0f + aDamp*unitResponse) : 0.f; + constraints->driveTargetVel = x * b; + constraints->driveVelMultiplier = -x * a; + driveBiasCoefficient = stiffness * x * dt; + constraints->driveBiasCoefficient = driveBiasCoefficient + xDamp * damping * dt; + break; + } + + case PxArticulationDriveType::eACCELERATION: + { + x = 1.0f / (1.0f + a); + PxReal xDamp = 1.0f / (1.0f + aDamp); + constraints->driveTargetVel = x * b*recipResponse; + constraints->driveVelMultiplier = -x * a*recipResponse; + driveBiasCoefficient = stiffness * x * recipResponse * dt; + constraints->driveBiasCoefficient = driveBiasCoefficient + xDamp * damping * dt * recipResponse; + break; + } + //KS - this is required to avoid a warning on Linux + case PxArticulationDriveType::eTARGET: + case PxArticulationDriveType::eVELOCITY: + case PxArticulationDriveType::eNONE: + break; + + } + + const PxReal im = 1.0f - x; + constraints->driveInitialBias = error * driveBiasCoefficient; + constraints->driveImpulseMultiplier = isTGS ? 1.f : im; + constraints->maxDriveForce = maxForce; + constraints->driveForce = 0.f; + } + else + { + constraints->driveTargetVel = 0.f; + constraints->driveInitialBias = 0.f; + constraints->driveBiasCoefficient = 0.f; + constraints->driveVelMultiplier = 0.f; + constraints->driveImpulseMultiplier = 0.f; + constraints->maxDriveForce = 0.f; + constraints->driveForce = 0.f; + } + } + + void setupComplexLimit(ArticulationLink* links, Cm::SpatialVectorF* Z, ArticulationData& data, const PxU32 linkID, + const PxReal angle, const PxReal lowLimit, const PxReal highLimit, const PxVec3& axis, const PxReal cfm, ArticulationInternalConstraint& complexConstraint, + ArticulationInternalLimit& limit) + { + Cm::SpatialVectorV deltaVA, deltaVB; + FeatherstoneArticulation::getImpulseSelfResponse(links, Z, data, + links[linkID].parent, Cm::SpatialVector(PxVec3(0), axis), deltaVA, + linkID, Cm::SpatialVector(PxVec3(0), -axis), deltaVB); + + const Cm::SpatialVector& deltaV0 = unsimdRef(deltaVA); + const Cm::SpatialVector& deltaV1 = unsimdRef(deltaVB); + + const PxReal r0 = deltaV0.angular.dot(axis); + const PxReal r1 = deltaV1.angular.dot(axis); + + const PxReal unitResponse = r0 - r1; + + const PxReal recipResponse = unitResponse > DY_ARTICULATION_MIN_RESPONSE ? 1.0f / (cfm + unitResponse) : 0.0f; + + complexConstraint.row0 = Cm::UnAlignedSpatialVector(PxVec3(0), axis); + complexConstraint.row1 = Cm::UnAlignedSpatialVector(PxVec3(0), axis); + complexConstraint.deltaVA.top = unsimdRef(deltaVA).angular; + complexConstraint.deltaVA.bottom = unsimdRef(deltaVA).linear; + complexConstraint.deltaVB.top = unsimdRef(deltaVB).angular; + complexConstraint.deltaVB.bottom = unsimdRef(deltaVB).linear; + complexConstraint.recipResponse = recipResponse; + complexConstraint.response = unitResponse; + complexConstraint.isLinearConstraint = true; + limit.errorLow = angle - lowLimit; + limit.errorHigh = highLimit - angle; + limit.lowImpulse = 0.f; + limit.highImpulse = 0.f; + } + + + void FeatherstoneArticulation::setupInternalConstraintsRecursive( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const PxReal dt, + const PxReal invDt, + const PxReal erp, + const bool isTGSSolver, + const PxU32 linkID, + const PxReal maxForceScale) + { + const ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + ArticulationJointTargetData& jointTranDatum = data.getJointTranData(linkID); + const PxReal* jPosition = &data.getJointPositions()[jointDatum.jointOffset]; + PX_UNUSED(jPosition); + + const ArticulationLink& pLink = links[link.parent]; + + const ArticulationJointCore& j = *link.inboundJoint; + + //const bool jointDrive = (j.driveType != PxArticulationJointDriveType::eNONE); + + bool hasFriction = j.frictionCoefficient > 0.f; + + const PxReal fCoefficient = j.frictionCoefficient * stepDt; + + + const PxU32 limitedRows = jointDatum.limitMask; + + PxU8 driveRows = 0; + + for (PxU32 i = 0; i < PxArticulationAxis::eCOUNT; ++i) + { + if (j.drives[i].maxForce > 0.f && (j.drives[i].stiffness > 0.f || j.drives[i].damping > 0.f)) + driveRows++; + } + + const PxU8 frictionRows = hasFriction ? jointDatum.dof : PxU8(0); + + const PxU8 constraintCount = PxU8(driveRows + frictionRows + limitedRows); + if (!constraintCount) + { + //Skip these constraints... + //constraints += jointDatum.dof; + jointDatum.dofInternalConstraintMask = 0; + } + else + { + const PxReal transmissionForce = data.getTransmittedForce(linkID).magnitude() * fCoefficient; + + const PxTransform cA2w = pLink.bodyCore->body2World.transform(j.parentPose); + const PxTransform cB2w = link.bodyCore->body2World.transform(j.childPose); + + const PxU32 parent = link.parent; + + const PxReal cfm = PxMax(link.cfm, pLink.cfm); + + + //Linear, then angular... + + PxVec3 driveError(0.f); + PxVec3 angles(0.f); + PxVec3 row[3]; + if (j.jointType == PxArticulationJointType::eSPHERICAL && jointDatum.dof > 1) + { + //It's a spherical joint. We can't directly work on joint positions with spherical joints, so we instead need to compute the quaternion + //and from that compute the joint error projected onto the DOFs. This will yield a rotation that is singularity-free, where the joint + //angles match the target joint angles provided provided the angles are within +/- Pi around each axis. Spherical joints do not support + //quaternion double cover cases/wide angles. + + PxVec3 driveAxis(0.f); + + bool hasAngularDrives = false; + + PxU32 tmpDofId = 0; + + for (PxU32 i = 0; i < PxArticulationAxis::eX; ++i) + { + if (j.motion[i] != PxArticulationMotion::eLOCKED) + { + const bool hasDrive = (j.motion[i] != PxArticulationMotion::eLOCKED && j.drives[i].driveType != PxArticulationDriveType::eNONE); + + if (hasDrive) + { + const PxVec3 axis = data.mMotionMatrix[jointDatum.jointOffset + tmpDofId].top; + PxReal target = jointTranDatum.targetJointPosition[tmpDofId]; + + driveAxis += axis * target; + hasAngularDrives = true; + + } + + tmpDofId++; + } + } + + + { + + PxQuat qB2qA = cA2w.q.getConjugate() * cB2w.q; + + { + //Spherical joint drive calculation using 3x child-space Euler angles + if (hasAngularDrives) + { + PxReal angle = driveAxis.normalize(); + + if (angle < 1e-12f) + { + driveAxis = PxVec3(1.f, 0.f, 0.f); + angle = 0.f; + } + + PxQuat targetQ = PxQuat(angle, driveAxis); + + if (targetQ.dot(qB2qA) < 0.f) + targetQ = -targetQ; + + driveError = -2.f * (targetQ.getConjugate() * qB2qA).getImaginaryPart(); + } + + for (PxU32 i = 0, tmpDof = 0; i < PxArticulationAxis::eX; ++i) + { + if (j.motion[i] != PxArticulationMotion::eLOCKED) + { + angles[i] = data.mJointPosition[j.jointOffset + tmpDof]; + row[i] = data.mWorldMotionMatrix[jointDatum.jointOffset + tmpDof].top; + tmpDof++; + } + } + } + } + } + else + { + for (PxU32 i = 0; i < PxArticulationAxis::eX; ++i) + { + if (j.motion[i] != PxArticulationMotion::eLOCKED) + { + driveError[i] = jointTranDatum.targetJointPosition[0] - data.mJointPosition[j.jointOffset]; + angles[i] = data.mJointPosition[j.jointOffset]; + row[i] = data.mWorldMotionMatrix[jointDatum.jointOffset].top; + } + } + } + + PxU32 dofId = 0; + + PxU8 dofMask = 0; + for (PxU32 i = 0; i < PxArticulationAxis::eX; ++i) + { + if (j.motion[i] != PxArticulationMotion::eLOCKED) + { + const bool hasDrive = (j.motion[i] != PxArticulationMotion::eLOCKED && j.drives[i].driveType != PxArticulationDriveType::eNONE); + + + if (j.motion[i] == PxArticulationMotion::eLIMITED || hasDrive || frictionRows) + { + dofMask |= (1 << dofId); + //Impulse response vector and axes are common for all constraints on this axis besides locked axis!!! + const PxVec3 axis = row[i]; + + + Cm::SpatialVectorV deltaVA, deltaVB; + FeatherstoneArticulation::getImpulseSelfResponse(links, Z, data, + parent, Cm::SpatialVector(PxVec3(0), axis), deltaVA, + linkID, Cm::SpatialVector(PxVec3(0), -axis), deltaVB); + + + const Cm::SpatialVector& deltaV0 = unsimdRef(deltaVA); + const Cm::SpatialVector& deltaV1 = unsimdRef(deltaVB); + + const PxReal r0 = deltaV0.angular.dot(axis); + const PxReal r1 = deltaV1.angular.dot(axis); + + const PxReal unitResponse = r0 - r1; + + const PxReal recipResponse = unitResponse <= 0.f ? 0.f : 1.0f / (unitResponse+cfm); + + const PxU32 count = data.mInternalConstraints.size(); + data.mInternalConstraints.forceSize_Unsafe(count + 1); + ArticulationInternalConstraint* constraints = &data.mInternalConstraints[count]; + + + + constraints->recipResponse = recipResponse; + constraints->response = unitResponse; + constraints->row0 = Cm::SpatialVectorF(PxVec3(0), axis); + constraints->row1 = Cm::SpatialVectorF(PxVec3(0), axis); + constraints->deltaVA.top = unsimdRef(deltaVA).angular; + constraints->deltaVA.bottom = unsimdRef(deltaVA).linear; + constraints->deltaVB.top = unsimdRef(deltaVB).angular; + constraints->deltaVB.bottom = unsimdRef(deltaVB).linear; + constraints->isLinearConstraint = false; + + constraints->frictionForce = 0.f; + constraints->maxFrictionForce = hasFriction ? transmissionForce : 0.f; + constraints->frictionForceCoefficient = isTGSSolver ? 0.f : 1.f; + + setupDrive(constraints, hasDrive, j.drives[i].driveType, + j.drives[i].stiffness, j.drives[i].damping, stepDt, unitResponse, recipResponse, driveError[i], jointTranDatum.targetJointVelocity[dofId], isTGSSolver, + j.drives[i].maxForce * maxForceScale); + + if (j.motion[i] == PxArticulationMotion::eLIMITED) + { + const PxU32 limitCount = data.mInternalLimits.size(); + data.mInternalLimits.forceSize_Unsafe(limitCount + 1); + ArticulationInternalLimit* limits = &data.mInternalLimits[limitCount]; + + const PxReal jPos = angles[i]; + limits->errorHigh = j.limits[i].high - jPos; + limits->errorLow = jPos - j.limits[i].low; + limits->lowImpulse = 0.f; + limits->highImpulse = 0.f; + } + + } + + dofId++; + } + } + + for (PxU32 i = PxArticulationAxis::eX; i < PxArticulationAxis::eCOUNT; ++i) + { + if (j.motion[i] != PxArticulationMotion::eLOCKED) + { + const bool hasDrive = (j.motion[i] != PxArticulationMotion::eLOCKED && j.drives[i].maxForce > 0.f && (j.drives[i].stiffness > 0.f || j.drives[i].damping > 0.f)); + + if (j.motion[i] == PxArticulationMotion::eLIMITED || hasDrive || frictionRows) + { + + dofMask |= (1 << dofId); + //Impulse response vector and axes are common for all constraints on this axis besides locked axis!!! + const PxVec3 axis = data.mWorldMotionMatrix[jointDatum.jointOffset + dofId].bottom; + const PxVec3 ang0 = (cA2w.p - pLink.bodyCore->body2World.p).cross(axis); + const PxVec3 ang1 = (cB2w.p - link.bodyCore->body2World.p).cross(axis); + + Cm::SpatialVectorV deltaVA, deltaVB; + FeatherstoneArticulation::getImpulseSelfResponse(links, Z, data, + links[linkID].parent, Cm::SpatialVector(axis, ang0), deltaVA, + linkID, Cm::SpatialVector(-axis, -ang1), deltaVB); + + //Now add in friction rows, then limit rows, then drives... + + const Cm::SpatialVector& deltaV0 = unsimdRef(deltaVA); + const Cm::SpatialVector& deltaV1 = unsimdRef(deltaVB); + + const PxReal r0 = deltaV0.linear.dot(axis) + deltaV0.angular.dot(ang0); + const PxReal r1 = deltaV1.linear.dot(axis) + deltaV1.angular.dot(ang1); + + const PxReal unitResponse = r0 - r1; + + //const PxReal recipResponse = unitResponse > DY_ARTICULATION_MIN_RESPONSE ? 1.0f / (unitResponse+cfm) : 0.0f; + const PxReal recipResponse = 1.0f / (unitResponse + cfm); + + const PxU32 count = data.mInternalConstraints.size(); + data.mInternalConstraints.forceSize_Unsafe(count + 1); + ArticulationInternalConstraint* constraints = &data.mInternalConstraints[count]; + + constraints->response = unitResponse; + constraints->recipResponse = recipResponse; + constraints->row0 = Cm::SpatialVectorF(axis, ang0); + constraints->row1 = Cm::SpatialVectorF(axis, ang1); + constraints->deltaVA.top = unsimdRef(deltaVA).angular; + constraints->deltaVA.bottom = unsimdRef(deltaVA).linear; + constraints->deltaVB.top = unsimdRef(deltaVB).angular; + constraints->deltaVB.bottom = unsimdRef(deltaVB).linear; + constraints->isLinearConstraint = true; + + constraints->frictionForce = 0.f; + constraints->maxFrictionForce = hasFriction ? transmissionForce : 0.f; + + constraints->frictionForceCoefficient = isTGSSolver ? 0.f : 1.f; + + setupDrive(constraints, hasDrive, j.drives[i].driveType, + j.drives[i].stiffness, j.drives[i].damping, stepDt, unitResponse, recipResponse, + jointTranDatum.targetJointPosition[dofId] - data.mJointPosition[j.jointOffset + dofId], + jointTranDatum.targetJointVelocity[dofId], isTGSSolver, j.drives[i].maxForce * maxForceScale); + + if (j.motion[i] == PxArticulationMotion::eLIMITED) + { + const PxU32 limitCount = data.mInternalLimits.size(); + data.mInternalLimits.forceSize_Unsafe(limitCount + 1); + ArticulationInternalLimit* limits = &data.mInternalLimits[limitCount]; + const PxReal jPos = data.mJointPosition[j.jointOffset + dofId]; + limits->errorHigh = j.limits[i].high - jPos; + limits->errorLow = jPos - j.limits[i].low; + limits->lowImpulse = 0.f; + limits->highImpulse = 0.f; + } + + + } + dofId++; + } + } + + if (jointDatum.limitMask) + { + for (PxU32 dof = 0; dof < jointDatum.dof; ++dof) + { + PxU32 i = j.dofIds[dof]; + if (j.motion[i] == PxArticulationMotion::eLOCKED) + { + + const PxU32 count = data.mInternalConstraints.size(); + data.mInternalConstraints.forceSize_Unsafe(count + 1); + ArticulationInternalConstraint* constraints = &data.mInternalConstraints[count]; + + const PxU32 limitCount = data.mInternalLimits.size(); + data.mInternalLimits.forceSize_Unsafe(limitCount + 1); + ArticulationInternalLimit* limits = &data.mInternalLimits[limitCount]; + + const PxVec3 axis = row[i]; + + PxReal angle = angles[i]; + + //A locked axis is equivalent to a limit of 0 + PxReal low = 0.f; + PxReal high = 0.f; + + setupComplexLimit(links, Z, data, linkID, angle, + low, high, axis, cfm, *constraints, *limits++); + } + } + } + jointDatum.dofInternalConstraintMask = dofMask; + + } + + const PxU32 numChildren = link.mNumChildren; + const PxU32 offset = link.mChildrenStartIndex; + for (PxU32 i = 0; i < numChildren; ++i) + { + const PxU32 child = offset + i; + setupInternalConstraintsRecursive(links, linkCount, fixBase, data, Z, stepDt, dt, invDt, erp, isTGSSolver, child, maxForceScale); + } + + } + + void FeatherstoneArticulation::setupInternalSpatialTendonConstraintsRecursive( + ArticulationLink* links, + ArticulationAttachment* attachments, + const PxU32 attachmentCount, + const PxVec3& pAttachPoint, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const bool isTGSSolver, + const PxU32 attachmentID, + const PxReal stiffness, + const PxReal damping, + const PxReal limitStiffness, + const PxReal accumLength, + const PxU32 startLink, + const PxVec3& startAxis, + const PxVec3& startRaXn) + { + ArticulationAttachment& attachment = attachments[attachmentID]; + + ArticulationLink& cLink = links[attachment.linkInd]; + + const PxTransform cBody2World = cLink.bodyCore->body2World; + + const PxVec3 rb = cBody2World.q.rotate(attachment.relativeOffset); + + const PxVec3 cAttachPoint = cBody2World.p + rb; + + + const PxVec3 dif = pAttachPoint - cAttachPoint; + const PxReal distanceSq = dif.magnitudeSquared(); + const PxReal distance = PxSqrt(distanceSq); + + const PxReal u = distance * attachment.coefficient + accumLength; + + + const PxU32 childCount = attachment.childCount; + if (childCount) + { + + for (ArticulationBitField children = attachment.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + setupInternalSpatialTendonConstraintsRecursive(links, attachments, attachmentCount, cAttachPoint, fixBase, data, Z, stepDt, + isTGSSolver, child, stiffness, damping, limitStiffness, u, startLink, + startAxis, startRaXn); + } + } + else + { + const PxVec3 axis = distance > 0.001f ? dif / distance : PxVec3(0.f); + + const PxVec3 rbXn = rb.cross(axis); + + Cm::SpatialVectorV deltaVA, deltaVB; + FeatherstoneArticulation::getImpulseSelfResponse(links, Z, data, + startLink, Cm::SpatialVector(startAxis, startRaXn), deltaVA, + attachment.linkInd, Cm::SpatialVector(-axis, -rbXn), deltaVB); + + const Cm::SpatialVector& deltaV0 = unsimdRef(deltaVA); + const Cm::SpatialVector& deltaV1 = unsimdRef(deltaVB); + + const PxReal r0 = deltaV0.linear.dot(startAxis) + deltaV0.angular.dot(startRaXn); + const PxReal r1 = deltaV1.linear.dot(axis) + deltaV1.angular.dot(rbXn); + + const PxReal unitResponse = (r0 - r1); + + //const PxReal recipResponse = unitResponse > DY_ARTICULATION_MIN_RESPONSE ? 1.0f / (unitResponse + cfm) : 0.0f; + //const PxReal recipResponse = unitResponse > DY_ARTICULATION_MIN_RESPONSE ? 1.0f / (unitResponse) : 0.0f; + const PxReal recipResponse = 1.0f / (unitResponse + cLink.cfm); + + const PxU32 count = data.mInternalSpatialTendonConstraints.size(); + data.mInternalSpatialTendonConstraints.forceSize_Unsafe(count + 1); + + ArticulationInternalTendonConstraint* constraint = &data.mInternalSpatialTendonConstraints[count]; + attachment.mConstraintInd = PxU16(count); + + + constraint->row0 = Cm::SpatialVectorF(startAxis, startRaXn); + constraint->row1 = Cm::SpatialVectorF(axis, rbXn); + constraint->linkID0 = startLink; + constraint->linkID1 = attachment.linkInd; + constraint->recipResponse = recipResponse; + + const PxReal a = stepDt * (stepDt*stiffness + damping); + const PxReal a2 = stepDt * (stepDt*limitStiffness + damping); + + PxReal x = unitResponse > 0.f ? 1.0f / (1.0f + a * unitResponse) : 0.f; + PxReal x2 = unitResponse > 0.f ? 1.0f / (1.0f + a2 * unitResponse) : 0.f; + + + constraint->velMultiplier = -x * a;// * unitResponse; + //constraint->velMultiplier = -x * damping*stepDt; + + constraint->impulseMultiplier = isTGSSolver ? 1.f : 1.f - x; + constraint->biasCoefficient = (-stiffness * x * stepDt);//*unitResponse; + constraint->appliedForce = 0.f; + + constraint->accumulatedLength = u;// + u*0.2f; + constraint->restDistance = attachment.restLength; + constraint->lowLimit = attachment.lowLimit; + constraint->highLimit = attachment.highLimit; + + constraint->limitBiasCoefficient = (-limitStiffness * x2 * stepDt);//*unitResponse; + constraint->limitImpulseMultiplier = isTGSSolver ? 1.f : 1.f - x2; + constraint->limitAppliedForce = 0.f; + } + } + + + void FeatherstoneArticulation::updateSpatialTendonConstraintsRecursive(ArticulationAttachment* attachments, ArticulationData& data, const PxU32 attachmentID, PxReal accumLength, + const PxVec3& pAttachPoint) + { + ArticulationAttachment& attachment = attachments[attachmentID]; + + //const PxReal restDist = attachment.restDistance; + + const PxTransform& cBody2World = data.getAccumulatedPoses()[attachment.linkInd]; + + const PxVec3 rb = cBody2World.q.rotate(attachment.relativeOffset); + + const PxVec3 cAttachPoint = cBody2World.p + rb; + + + const PxVec3 dif = pAttachPoint - cAttachPoint; + const PxReal distanceSq = dif.magnitudeSquared(); + const PxReal distance = PxSqrt(distanceSq); + + const PxReal u = distance * attachment.coefficient + accumLength; + + const PxU32 childCount = attachment.childCount; + if (childCount) + { + for (ArticulationBitField children = attachment.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + updateSpatialTendonConstraintsRecursive(attachments, data, child, u, cAttachPoint); + } + } + else + { + PxU32 index = attachment.mConstraintInd; + ArticulationInternalTendonConstraint& constraint = data.mInternalSpatialTendonConstraints[index]; + + constraint.accumulatedLength = u; + } + } + + void FeatherstoneArticulation::setupInternalFixedTendonConstraintsRecursive( + ArticulationLink* links, + ArticulationTendonJoint* tendonJoints, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + const PxReal stepDt, + const bool isTGSSolver, + const PxU32 tendonJointID, + const PxReal stiffness, + const PxReal damping, + const PxReal limitStiffness, + const PxU32 startLink, + const PxVec3& startAxis, + const PxVec3& startRaXn) + { + ArticulationTendonJoint& tendonJoint = tendonJoints[tendonJointID]; + + ArticulationLink& cLink = links[tendonJoint.linkInd]; + + const PxTransform& cBody2World = cLink.bodyCore->body2World; + + const PxReal cfm = PxMax(cLink.cfm, links[startLink].cfm); + + ArticulationJointCoreData& jointDatum = data.getJointData(tendonJoint.linkInd); + ArticulationJointCore& joint = *cLink.inboundJoint; + + PxU16 tendonJointAxis = tendonJoint.axis; + + PX_ASSERT(joint.motion[tendonJointAxis] != PxArticulationMotion::eLOCKED); + + //Cm::SpatialVector cImpulse; + PxU32 dofIndex = joint.invDofIds[tendonJointAxis]; + + tendonJoint.startJointOffset = PxTo16(jointDatum.jointOffset + dofIndex); + + ///*PxReal jointPose = jointPositions[jointDatum.jointOffset + dofIndex] * tendonJoint.coefficient; + + //jointPose += accumulatedJointPose;*/ + + + { + PxVec3 axis, rbXn; + if (tendonJointAxis < PxArticulationAxis::eX) + { + const PxVec3 tAxis = data.mWorldMotionMatrix[jointDatum.jointOffset + dofIndex].top; + axis = PxVec3(0.f); + rbXn = tAxis; + } + else + { + const PxTransform cB2w = cBody2World.transform(joint.childPose); + const PxVec3 tAxis = data.mWorldMotionMatrix[jointDatum.jointOffset + dofIndex].bottom; + axis = tAxis; + rbXn = (cB2w.p - cBody2World.p).cross(axis); + } + + + Cm::SpatialVectorV deltaVA, deltaVB; + FeatherstoneArticulation::getImpulseSelfResponse(links, Z, data, + startLink, Cm::SpatialVector(startAxis, startRaXn), deltaVA, + tendonJoint.linkInd, Cm::SpatialVector(-axis, -rbXn), deltaVB); + + + + const Cm::SpatialVector& deltaV0 = unsimdRef(deltaVA); + const Cm::SpatialVector& deltaV1 = unsimdRef(deltaVB); + + /*const PxU32 pLinkInd = cLink.parent; + printf("(%i, %i) deltaV1(%f, %f, %f, %f, %f, %f)\n", + pLinkInd, tendonJoint.linkInd, deltaV1.linear.x, deltaV1.linear.y, deltaV1.linear.z, deltaV1.angular.x, + deltaV1.angular.y, deltaV1.angular.z);*/ + + const PxReal r0 = deltaV0.linear.dot(startAxis) + deltaV0.angular.dot(startRaXn); + const PxReal r1 = deltaV1.linear.dot(axis) + deltaV1.angular.dot(rbXn); + + + const PxReal unitResponse = r0 - r1; + + const PxReal recipResponse = 1.0f / (unitResponse + cfm); + + const PxU32 count = data.mInternalFixedTendonConstraints.size(); + data.mInternalFixedTendonConstraints.forceSize_Unsafe(count + 1); + + ArticulationInternalTendonConstraint* constraint = &data.mInternalFixedTendonConstraints[count]; + tendonJoint.mConstraintInd = PxU16(count); + + + constraint->row0 = Cm::UnAlignedSpatialVector(startAxis, startRaXn); + constraint->row1 = Cm::UnAlignedSpatialVector(axis, rbXn); + constraint->deltaVA = r0; //We only need to record the change in velocity projected onto the dof for this! + constraint->deltaVB = Cm::UnAlignedSpatialVector(deltaV1.angular, deltaV1.linear); + constraint->linkID0 = startLink; + constraint->linkID1 = tendonJoint.linkInd; + constraint->recipResponse = recipResponse; + + const PxReal a = stepDt * (stepDt*stiffness + damping); + + const PxReal a2 = stepDt * (stepDt*limitStiffness + damping); + + PxReal x = unitResponse > 0.f ? 1.0f / (1.0f + a * unitResponse) : 0.f; + + PxReal x2 = unitResponse > 0.f ? 1.0f / (1.0f + a2* unitResponse) : 0.f; + + + constraint->velMultiplier = -x * a;// * unitResponse; + + constraint->impulseMultiplier = isTGSSolver ? 1.f : 1.f - x; + constraint->biasCoefficient = (-stiffness * x * stepDt);//*unitResponse; + constraint->appliedForce = 0.f; + //constraint->accumulatedLength = jointPose; + + constraint->limitImpulseMultiplier = isTGSSolver ? 1.f : 1.f - x2; + constraint->limitBiasCoefficient = (-limitStiffness * x2 * stepDt);//*unitResponse; + constraint->limitAppliedForce = 0.f; + + /*printf("(%i, %i) r0 %f, r1 %f cmf %f unitResponse %f recipResponse %f a %f x %f\n", + pLinkInd, tendonJoint.linkInd, r0, r1, cLink.cfm, unitResponse, recipResponse, a, x);*/ + } + + const PxU32 childCount = tendonJoint.childCount; + + if (childCount) + { + + for (ArticulationBitField children = tendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + setupInternalFixedTendonConstraintsRecursive(links, tendonJoints, fixBase, data, Z, stepDt, + isTGSSolver, child, stiffness, damping, limitStiffness, startLink, startAxis, startRaXn); + } + } + } + + + void FeatherstoneArticulation::setupInternalConstraints( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + PxReal stepDt, + PxReal dt, + PxReal invDt, + PxReal erp, + bool isTGSSolver) + { + PX_UNUSED(linkCount); + + data.mInternalConstraints.forceSize_Unsafe(0); + data.mInternalConstraints.reserve(data.getDofs()); + + data.mInternalLimits.forceSize_Unsafe(0); + data.mInternalLimits.reserve(data.getDofs()); + + + const PxReal maxForceScale = data.getArticulationFlags() & PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES ? dt : 1.f; + + const PxU32 numChildren = links[0].mNumChildren; + const PxU32 offset = links[0].mChildrenStartIndex; + for (PxU32 i = 0; i < numChildren; ++i) + { + const PxU32 child = offset + i; + + setupInternalConstraintsRecursive(links, linkCount, fixBase, data, Z, stepDt, dt, invDt, erp, isTGSSolver, child, maxForceScale); + + } + + PxU32 totalNumAttachments = 0; + for (PxU32 i = 0; i < data.mNumSpatialTendons; ++i) + { + Dy::ArticulationSpatialTendon* tendon = data.mSpatialTendons[i]; + totalNumAttachments += tendon->getNumAttachments(); + } + + data.mInternalSpatialTendonConstraints.forceSize_Unsafe(0); + data.mInternalSpatialTendonConstraints.reserve(totalNumAttachments); + + + for (PxU32 i = 0; i < data.mNumSpatialTendons; ++i) + { + Dy::ArticulationSpatialTendon* tendon = data.mSpatialTendons[i]; + + Dy::ArticulationAttachment* attachments = tendon->getAttachments(); + + ArticulationAttachment& pAttachment = attachments[0]; + + //const PxU32 childCount = pAttachment.childCount; + + //PxReal scale = 1.f/PxReal(childCount); + + const PxReal coefficient = pAttachment.coefficient; + + const PxU32 startLink = pAttachment.linkInd; + ArticulationLink& pLink = links[startLink]; + const PxTransform pBody2World = pLink.bodyCore->body2World; + const PxVec3 ra = pBody2World.q.rotate(pAttachment.relativeOffset); + const PxVec3 pAttachPoint = pBody2World.p + ra; + + + for (ArticulationAttachmentBitField children = pAttachment.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + ArticulationAttachment& attachment = attachments[child]; + ArticulationLink& cLink = links[attachment.linkInd]; + const PxTransform cBody2World = cLink.bodyCore->body2World; + const PxVec3 rb = cBody2World.q.rotate(attachment.relativeOffset); + const PxVec3 cAttachPoint = cBody2World.p + rb; + + const PxVec3 axis = (pAttachPoint - cAttachPoint).getNormalized(); + const PxVec3 raXn = ra.cross(axis); + + setupInternalSpatialTendonConstraintsRecursive(links, attachments, tendon->getNumAttachments(), pAttachPoint, fixBase, data, Z, stepDt, isTGSSolver, + child, tendon->mStiffness, tendon->mDamping, tendon->mLimitStiffness, tendon->mOffset*coefficient, startLink, + axis, raXn); + } + } + + + PxU32 totalNumTendonJoints = 0; + for (PxU32 i = 0; i < data.mNumFixedTendons; ++i) + { + Dy::ArticulationFixedTendon* tendon = data.mFixedTendons[i]; + totalNumTendonJoints += tendon->getNumJoints(); + } + + data.mInternalFixedTendonConstraints.forceSize_Unsafe(0); + data.mInternalFixedTendonConstraints.reserve(totalNumTendonJoints); + + + for (PxU32 i = 0; i < data.mNumFixedTendons; ++i) + { + ArticulationFixedTendon* tendon = data.mFixedTendons[i]; + + ArticulationTendonJoint* tendonJoints = tendon->getTendonJoints(); + + ArticulationTendonJoint& pTendonJoint = tendonJoints[0]; + + const PxU32 startLinkInd = pTendonJoint.linkInd; + ArticulationLink& pLink = links[startLinkInd]; + const PxTransform& pBody2World = pLink.bodyCore->body2World; + + + for (ArticulationAttachmentBitField children = pTendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + ArticulationTendonJoint& cTendonJoint = tendonJoints[child]; + + ArticulationLink& cLink = links[cTendonJoint.linkInd]; + + ArticulationJointCore* joint = cLink.inboundJoint; + + PX_ASSERT(joint != NULL); + + ArticulationJointCoreData* jointDatum = &data.getJointData(cTendonJoint.linkInd); + + PxU16 tendonJointAxis = cTendonJoint.axis; + + PX_ASSERT(joint->motion[tendonJointAxis] != PxArticulationMotion::eLOCKED); + + PxVec3 startAxis, raXn; + PxU32 dofIndex = joint->invDofIds[tendonJointAxis]; + + if (tendonJointAxis < PxArticulationAxis::eX) + { + const PxVec3 axis = data.mWorldMotionMatrix[jointDatum->jointOffset + dofIndex].top; + startAxis = PxVec3(0.f); + raXn = axis; + } + else + { + const PxTransform cA2w = pBody2World.transform(joint->parentPose); + const PxVec3 axis = data.mWorldMotionMatrix[jointDatum->jointOffset + dofIndex].bottom; + const PxVec3 ang0 = (cA2w.p - pBody2World.p).cross(axis); + startAxis = axis; + raXn = ang0; + } + + + setupInternalFixedTendonConstraintsRecursive(links, tendonJoints, fixBase, data, Z, stepDt, isTGSSolver, + child, tendon->mStiffness, tendon->mDamping, tendon->mLimitStiffness, startLinkInd, startAxis, raXn); + } + } + + } + + + PxU32 FeatherstoneArticulation::setupSolverConstraints( + ArticulationLink* links, + const PxU32 linkCount, + const bool fixBase, + ArticulationData& data, + Cm::SpatialVectorF* Z, + PxU32& acCount) + { + acCount = 0; + + setupInternalConstraints(links, linkCount, fixBase, data, Z, data.getDt(), data.getDt(), 1.f / data.getDt(), 1.f, false); + + return 0; + } + + + PxU32 FeatherstoneArticulation::setupSolverConstraintsTGS(const ArticulationSolverDesc& articDesc, + PxReal dt, + PxReal invDt, + PxReal totalDt, + const PxReal biasCoefficient, + PxU32& acCount, + Cm::SpatialVectorF* Z) + { + PX_UNUSED(dt); + PX_UNUSED(totalDt); + acCount = 0; + + FeatherstoneArticulation* thisArtic = static_cast(articDesc.articulation); + + ArticulationLink* links = thisArtic->mArticulationData.getLinks(); + const PxU32 linkCount = thisArtic->mArticulationData.getLinkCount(); + const bool fixBase = thisArtic->mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + const PxReal erp = PxMin(0.7f, biasCoefficient); + + thisArtic->setupInternalConstraints(links, linkCount, fixBase, thisArtic->mArticulationData, Z, dt, totalDt, invDt, erp, true); + + return 0; + } + + void FeatherstoneArticulation::teleportLinks(ArticulationData& data) + { + + ArticulationLink* links = mArticulationData.getLinks(); + + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + + const PxReal* jointPositions = data.getJointPositions(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + + const ArticulationJointCoreData& jointDatum = jointData[linkID]; + + const ArticulationLink& pLink = links[link.parent]; + const PxTransform pBody2World = pLink.bodyCore->body2World; + + const ArticulationJointCore* joint = link.inboundJoint; + + const PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + PxQuat newParentToChild; + PxQuat newWorldQ; + PxVec3 r; + + const PxVec3 childOffset = -joint->childPose.p; + const PxVec3 parentOffset = joint->parentPose.p; + + const PxQuat relativeQuat = mArticulationData.mRelativeQuat[linkID]; + + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + newParentToChild = relativeQuat; + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + const PxVec3& u = data.mMotionMatrix[jointDatum.jointOffset].bottom; + + r = e + d + u * jPosition[0]; + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const PxVec3& u = data.mMotionMatrix[jointDatum.jointOffset].top; + + PxQuat jointRotation = PxQuat(-jPosition[0], u); + if (jointRotation.w < 0) //shortest angle. + jointRotation = -jointRotation; + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + PxQuat jointRotation(PxIdentity); + + { + PxVec3 axis(0.f); + for (PxU32 d = 0; d < jointDatum.dof; ++d) + { + axis += data.mMotionMatrix[jointDatum.jointOffset + d].top * -jPosition[d]; + } + PxReal angle = axis.normalize(); + jointRotation = angle < 1e-10f ? PxQuat(PxIdentity) : PxQuat(angle, axis); + if(jointRotation.w < 0.f) + jointRotation = -jointRotation; + } + + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + break; + } + case PxArticulationJointType::eFIX: + { + //this is fix joint so joint don't have velocity + newParentToChild = relativeQuat; + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + r = e + d; + break; + } + default: + break; + } + + PxTransform& body2World = link.bodyCore->body2World; + body2World.q = (pBody2World.q * newParentToChild.getConjugate()).getNormalized(); + body2World.p = pBody2World.p + body2World.q.rotate(r); + + PX_ASSERT(body2World.isSane()); + } + } + + void FeatherstoneArticulation::computeLinkVelocities(ArticulationData& data) + { + + ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + + Cm::SpatialVectorF* motionVelocities = data.getMotionVelocities(); + const PxReal* jointVelocities = data.mJointVelocity.begin(); + + // sync root motion vel: + const PxsBodyCore& rootBodyCore = *links[0].bodyCore; + motionVelocities[0].top = rootBodyCore.angularVelocity; + motionVelocities[0].bottom = rootBodyCore.linearVelocity; + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + + PxsBodyCore& bodyCore = *link.bodyCore; + + PxTransform body2World = bodyCore.body2World; + + ArticulationLink& plink = links[link.parent]; + const PxsBodyCore& pbodyCore = *plink.bodyCore; + + Cm::SpatialVectorF parentVel(pbodyCore.angularVelocity, pbodyCore.linearVelocity); + + PxTransform pBody2World = pbodyCore.body2World; + + const PxVec3 rw = body2World.p - pBody2World.p; + + Cm::SpatialVectorF vel = FeatherstoneArticulation::translateSpatialVector(-rw,parentVel); + + if (jointVelocities) + { + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + const PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + + Cm::UnAlignedSpatialVector deltaV = Cm::UnAlignedSpatialVector::Zero(); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + deltaV += data.mMotionMatrix[jointDatum.jointOffset + ind] * jVelocity[ind]; + } + + vel.top += body2World.q.rotate(deltaV.top); + vel.bottom += body2World.q.rotate(deltaV.bottom); + } + + bodyCore.linearVelocity = vel.bottom; + bodyCore.angularVelocity = vel.top; + motionVelocities[linkID] = vel; + } + } + + void FeatherstoneArticulation::jcalc(ArticulationData& data, bool forceUpdate) + { + const ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + ArticulationJointTargetData* jointTranData = data.getJointTranData(); + const PxU32 linkCount = data.getLinkCount(); + + PxU32 totalDof = 0; + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + ArticulationJointCore* joint = link.inboundJoint; + ArticulationJointCoreData& jointDatum = jointData[linkID]; + ArticulationJointTargetData& jointTranDatum = jointTranData[linkID]; + + PX_CHECK_AND_RETURN(joint->jointType != PxArticulationJointType::eUNDEFINED, "FeatherstoneArticulation::jcalc application need to define valid joint type and motion"); + + //compute joint dof + jointDatum.computeJointDof(joint, forceUpdate, data.mJointAxis.begin() + totalDof); + joint->setJointFrame(jointDatum, &data.mMotionMatrix[totalDof], &data.mJointAxis[totalDof], forceUpdate, mArticulationData.mRelativeQuat[linkID]); + const PxU8 dof = jointDatum.dof; + + jointTranDatum.setJointVelocityDrive(joint, dof); + jointTranDatum.setJointPoseDrive(joint, dof); + jointTranDatum.setArmature(joint, dof); + + jointDatum.jointOffset = totalDof; + joint->jointOffset = totalDof; + totalDof += dof; + } + + if (totalDof != mArticulationData.getDofs()) + { + mArticulationData.resizeJointData(totalDof); + } + mArticulationData.setDofs(totalDof); + } + + //compute link's spatial inertia tensor + void FeatherstoneArticulation::computeSpatialInertia(ArticulationData& data) + { + for (PxU32 linkID = 0; linkID < data.getLinkCount(); ++linkID) + { + const ArticulationLink& link = data.getLink(linkID); + //ArticulationLinkData& linkDatum = data.getLinkData(linkID); + + const PxsBodyCore& core = *link.bodyCore; + + const PxVec3& ii = core.inverseInertia; + + const PxReal m = core.inverseMass == 0.f ? 0.f : 1.0f / core.inverseMass; + + SpatialMatrix& worldArticulatedInertia = data.mWorldSpatialArticulatedInertia[linkID]; + + //construct inertia matrix + const PxVec3 inertiaTensor = PxVec3(ii.x == 0.f ? 0.f : (1.f / ii.x), ii.y == 0.f ? 0.f : (1.f / ii.y), ii.z == 0.f ? 0.f : (1.f / ii.z)); + + PxMat33 rot(data.getLink(linkID).bodyCore->body2World.q); + + worldArticulatedInertia.topLeft = PxMat33(PxZero); + worldArticulatedInertia.topRight = PxMat33::createDiagonal(PxVec3(m)); + Cm::transformInertiaTensor(inertiaTensor, rot, worldArticulatedInertia.bottomLeft); + + data.mWorldIsolatedSpatialArticulatedInertia[linkID] = worldArticulatedInertia.bottomLeft; + data.mMasses[linkID] = m; + } + } + + void FeatherstoneArticulation::computeZ(const ArticulationData& data, + const PxVec3& gravity, ScratchData& scratchData) + { + const Cm::SpatialVectorF* motionVelocities = scratchData.motionVelocities; + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + const Cm::SpatialVector* externalAccels = scratchData.externalAccels; + + for (PxU32 linkID = 0; linkID < data.getLinkCount(); ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + const PxsBodyCore& core = *link.bodyCore; + //const PxTransform& body2World = core.body2World; + + const PxMat33& I = data.mWorldSpatialArticulatedInertia[linkID].bottomLeft; + + //construct spatial zero acceleration + Cm::SpatialVectorF& z = spatialZAForces[linkID]; + + //Cm::SpatialVectorF v; + //v.top = motionVelocities[linkID].top; + //v.bottom = motionVelocities[linkID].bottom; + + //KS - limit the magnitude of the angular velocity that contributes to the geometric term. This is a + //v^2 term and can become unstable if it is too large! + + Cm::SpatialVectorF v = motionVelocities[linkID]; + + PxVec3 vA = v.top; + + PxVec3 gravLinAccel(0.f); + if(!core.disableGravity) + gravLinAccel = -gravity; + + PX_ASSERT(core.inverseMass != 0.f); + + const PxReal m = 1.0f / core.inverseMass; + + Cm::SpatialVectorF zTmp; + + zTmp.top = (gravLinAccel * m); + zTmp.bottom = vA.cross(I * vA); + + PX_ASSERT(zTmp.top.isFinite()); + PX_ASSERT(zTmp.bottom.isFinite()); + + if (externalAccels) + { + const Cm::SpatialVector& externalAccel = externalAccels[linkID]; + + const PxVec3 exLinAccel = -externalAccel.linear; + const PxVec3 exAngAccel = -externalAccel.angular; + + zTmp.top += (exLinAccel * m); + zTmp.bottom += I * exAngAccel; + } + + z = zTmp; + + } + } + + void FeatherstoneArticulation::computeZD(const ArticulationData& data, + const PxVec3& gravity, ScratchData& scratchData) + { + const Cm::SpatialVectorF* motionVelocities = scratchData.motionVelocities; + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + const Cm::SpatialVector* externalAccels = scratchData.externalAccels; + + const PxReal dt = data.getDt(); + const PxReal invDt = dt < 1e-6f ? PX_MAX_F32 : 1.f / data.mDt; + + for (PxU32 linkID = 0; linkID < data.getLinkCount(); ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + const PxsBodyCore& core = *link.bodyCore; + //const PxTransform& body2World = core.body2World; + + const PxMat33& I = data.mWorldSpatialArticulatedInertia[linkID].bottomLeft; + + //construct spatial zero acceleration + Cm::SpatialVectorF& z = spatialZAForces[linkID]; + + //Cm::SpatialVectorF v; + //v.top = motionVelocities[linkID].top; + //v.bottom = motionVelocities[linkID].bottom; + + //KS - limit the magnitude of the angular velocity that contributes to the geometric term. This is a + //v^2 term and can become unstable if it is too large! + + Cm::SpatialVectorF v = motionVelocities[linkID]; + + PxVec3 vA = v.top; + + PxVec3 gravLinAccel(0.f); + if (!core.disableGravity) + gravLinAccel = -gravity; + + PX_ASSERT(core.inverseMass != 0.f); + + const PxReal m = 1.0f / core.inverseMass; + + Cm::SpatialVectorF zTmp; + + zTmp.top = (gravLinAccel * m); + zTmp.bottom = vA.cross(I * vA); + + PX_ASSERT(zTmp.top.isFinite()); + PX_ASSERT(zTmp.bottom.isFinite()); + + if (externalAccels) + { + const Cm::SpatialVector& externalAccel = externalAccels[linkID]; + + const PxVec3 exLinAccel = -externalAccel.linear; + const PxVec3 exAngAccel = -externalAccel.angular; + + zTmp.top += (exLinAccel * m); + zTmp.bottom += I * exAngAccel; + } + + if (core.linearDamping > 0.f || core.angularDamping > 0.f) + { + const PxReal linDamp = PxMin(core.linearDamping, invDt); + const PxReal angDamp = PxMin(core.angularDamping, invDt); + + + zTmp.top += (v.bottom * linDamp*m) - zTmp.top * linDamp*dt; + zTmp.bottom += I * (v.top* angDamp) - zTmp.bottom * angDamp*dt; + } + + const PxReal maxAng = core.maxAngularVelocitySq; + const PxReal maxLin = core.maxLinearVelocitySq; + + const PxReal angMag = v.top.magnitudeSquared(); + const PxReal linMag = v.bottom.magnitudeSquared(); + + if (angMag > maxAng || linMag > maxLin) + { + if (angMag > maxAng) + { + const PxReal scale = 1.f - PxSqrt(maxAng) / PxSqrt(angMag); + const PxVec3 tmpaccelerationAng = (I * v.top)*scale; + zTmp.bottom += tmpaccelerationAng*invDt; + } + + if (linMag > maxLin) + { + const PxReal scale = 1.f - (PxSqrt(maxLin) / PxSqrt(linMag)); + const PxVec3 tmpaccelerationLin = (v.bottom*m*scale); + PX_UNUSED(tmpaccelerationLin); + zTmp.top += tmpaccelerationLin*invDt; + } + } + + z = zTmp; + } + } + + //compute coriolis and centrifugal term + void FeatherstoneArticulation::computeC(ArticulationData& data, ScratchData& scratchData) + { + const PxReal* jointVelocities = scratchData.jointVelocities; + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + + const PxU32 linkCount = data.getLinkCount(); + + coriolisVectors[0] = Cm::SpatialVectorF::Zero(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = data.getLink(linkID); + const ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + + const PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + Cm::SpatialVectorF& coriolis = coriolisVectors[linkID]; + + + //const PxTransform& body2World = link.bodyCore->body2World; + //transform parent link's angular velocity into current link's body space + const PxVec3 pAngular = scratchData.motionVelocities[link.parent].top; + + PxVec3 torque = pAngular.cross(pAngular.cross(data.getRw(linkID))); + + //PX_ASSERT(parentAngular.magnitude() < 100.f); + + PxVec3 force(0.f); + if (jointDatum.dof > 0) + { + Cm::SpatialVectorF relVel(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + //Clamp joint velocity used in coriolis terms to reduce chances of unstable feed-back loops + const PxReal jV = jVelocity[ind]; + relVel.top += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * jV; + relVel.bottom += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * jV; + } + const PxVec3 aVec = relVel.top; + force = pAngular.cross(aVec); + + //compute linear part + const PxVec3 lVel = relVel.bottom; + + const PxVec3 temp1 = 2.f * pAngular.cross(lVel); + const PxVec3 temp2 = aVec.cross(lVel); + torque += temp1 + temp2; + } + + PX_ASSERT(force.isFinite()); + PX_ASSERT(torque.isFinite()); + + coriolis = Cm::SpatialVectorF(force, torque);//.rotateInv(body2World); + } + } + + + + void FeatherstoneArticulation::computeRelativeTransformC2P(ArticulationData& data) + { + const ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + + PxTransform* accumulatedPose = data.getAccumulatedPoses(); + + accumulatedPose[0] = links[0].bodyCore->body2World; + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + const PxsBodyCore& bodyCore = *link.bodyCore; + const PxU32 jointOffset = data.getJointData(linkID).jointOffset; + const PxU32 dofCount = data.getJointData(linkID).dof; + + const PxTransform& body2World = bodyCore.body2World; + + const ArticulationLink& pLink = links[link.parent]; + const PxsBodyCore& pBodyCore = *pLink.bodyCore; + const PxTransform& pBody2World = pBodyCore.body2World; + + //const PxTransform tC2P = pBody2World.transformInv(body2World).getNormalized(); + + data.mRw[linkID] =body2World.p - pBody2World.p; + + const Cm::UnAlignedSpatialVector* motionMatrix = &data.mMotionMatrix[jointOffset]; + Cm::UnAlignedSpatialVector* worldMotionMatrix = &data.mWorldMotionMatrix[jointOffset]; + + for (PxU32 i = 0; i < dofCount; ++i) + { + const Cm::UnAlignedSpatialVector worldRow = motionMatrix[i].rotate(body2World); + + worldMotionMatrix[i] = worldRow; + } + + accumulatedPose[linkID] = body2World; + +#if FEATURESTONE_DEBUG + { + //debug + PxMat33 pToC = c2p.getTranspose(); + //parentToChild -rR + PxMat33 T2 = skewMatrixPR * pToC; + + PX_ASSERT(SpatialMatrix::isTranspose(linkDatum.childToParent.T, T2)); + } +#endif + } + } + + void FeatherstoneArticulation::computeRelativeTransformC2B(ArticulationData& data) + { + ArticulationLink* links = data.getLinks(); + ArticulationLinkData* linkData = data.getLinkData(); + const PxU32 linkCount = data.getLinkCount(); + + const ArticulationLink& bLink = links[0]; + const PxTransform& bBody2World = bLink.bodyCore->body2World; + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + ArticulationLinkData& linkDatum = linkData[linkID]; + const PxsBodyCore& bodyCore = *link.bodyCore; + + const PxTransform& body2World = bodyCore.body2World; + + const PxVec3 rw = body2World.p - bBody2World.p;//body space of link i + + //rotation matrix cToP's inverse is rotation matrix pToC + linkDatum.childToBase = rw; + } + } + + + void FeatherstoneArticulation::getDenseJacobian(PxArticulationCache& cache, PxU32 & nRows, PxU32 & nCols) + { + //make sure motionMatrix has been set + //jcalc(mArticulationData); + initializeCommonData(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + ArticulationLink* links = mArticulationData.getLinks(); + +#if 0 //Enable this if you want to compare results of this function with results of computeLinkVelocities(). + + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Articulation::getDenseJacobian(): commonInit need to be called first to initialize data!"); + return; + } + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = mArticulationData.getJointVelocities(); + + + computeLinkVelocities(mArticulationData, scratchData); + const ArticulationLink& baseLink = links[0]; + PxsBodyCore& core0 = *baseLink.bodyCore; +#endif + + ArticulationLinkData* linkData = mArticulationData.getLinkData(); + + const PxU32 totalDofs = getDofs(); + const PxU32 jointCount = mArticulationData.getLinkCount() - 1; + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //matrix dims is + nCols = (fixBase ? 0 : 6) + totalDofs; + nRows = (fixBase ? 0 : 6) + jointCount * 6; + +// auto jacobian = [&](PxU32 row, PxU32 col) -> PxReal & { return cache.denseJacobian[nCols * row + col]; } ; + #define jacobian(row, col) cache.denseJacobian[nCols * (row) + (col)] + + PxU32 destRow = 0; + PxU32 destCol = 0; + + if (!fixBase) + { + jacobian(0, 0) = 1.0f; + jacobian(0, 1) = 0.0f; + jacobian(0, 2) = 0.0f; + jacobian(0, 3) = 0.0f; + jacobian(0, 4) = 0.0f; + jacobian(0, 5) = 0.0f; + + jacobian(1, 0) = 0.0f; + jacobian(1, 1) = 1.0f; + jacobian(1, 2) = 0.0f; + jacobian(1, 3) = 0.0f; + jacobian(1, 4) = 0.0f; + jacobian(1, 5) = 0.0f; + + jacobian(2, 0) = 0.0f; + jacobian(2, 1) = 0.0f; + jacobian(2, 2) = 1.0f; + jacobian(2, 3) = 0.0f; + jacobian(2, 4) = 0.0f; + jacobian(2, 5) = 0.0f; + + jacobian(3, 0) = 0.0f; + jacobian(3, 1) = 0.0f; + jacobian(3, 2) = 0.0f; + jacobian(3, 3) = 1.0f; + jacobian(3, 4) = 0.0f; + jacobian(3, 5) = 0.0f; + + jacobian(4, 0) = 0.0f; + jacobian(4, 1) = 0.0f; + jacobian(4, 2) = 0.0f; + jacobian(4, 3) = 0.0f; + jacobian(4, 4) = 1.0f; + jacobian(4, 5) = 0.0f; + + jacobian(5, 0) = 0.0f; + jacobian(5, 1) = 0.0f; + jacobian(5, 2) = 0.0f; + jacobian(5, 3) = 0.0f; + jacobian(5, 4) = 0.0f; + jacobian(5, 5) = 1.0f; + + destRow += 6; + destCol += 6; + } + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID)//each iteration of this writes 6 rows in the matrix + { + const ArticulationLink& link = links[linkID]; + ArticulationLinkData& linkDatum = linkData[linkID]; + const PxsBodyCore& bodyCore = *link.bodyCore; + + linkDatum.maxPenBias = bodyCore.maxPenBias; + + const PxTransform& body2World = bodyCore.body2World; + + const ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + const PxU32 parentLinkID = link.parent; + + if (parentLinkID || !fixBase) + { + // VR: mArticulationData.getJointData(0) isn't initialized. parentLinkID can be 0 if fixBase is false. + //const ArticulationJointCoreData& parentJointDatum = mArticulationData.getJointData(parentLinkID); + //const PxU32 parentsFirstDestCol = parentJointDatum.jointOffset + (fixBase ? 0 : 6); + //const PxU32 parentsLastDestCol = parentsFirstDestCol + parentJointDatum.dof; + const PxU32 parentsLastDestCol = parentLinkID ? + mArticulationData.getJointData(parentLinkID).jointOffset + (fixBase ? 0 : 6) + mArticulationData.getJointData(parentLinkID).dof : + 6; + + // VR: With parentLinkID == 0 this experssion has two unsigned integer overflows, but the result is still correct. + const PxU32 parentsDestRow = (fixBase ? 0 : 6) + (parentLinkID - 1) * 6; + + for (PxU32 col = 0; col < parentsLastDestCol; col++) + { + //copy downward the 6 cols from parent + const PxVec3 parentAng( + jacobian(parentsDestRow + 3, col), + jacobian(parentsDestRow + 4, col), + jacobian(parentsDestRow + 5, col) + ); + + const PxVec3 parentAngxRw = parentAng.cross(mArticulationData.getRw(linkID)); + + jacobian(destRow + 0, col) = jacobian(parentsDestRow + 0, col) + parentAngxRw.x; + jacobian(destRow + 1, col) = jacobian(parentsDestRow + 1, col) + parentAngxRw.y; + jacobian(destRow + 2, col) = jacobian(parentsDestRow + 2, col) + parentAngxRw.z; + + jacobian(destRow + 3, col) = parentAng.x; + jacobian(destRow + 4, col) = parentAng.y; + jacobian(destRow + 5, col) = parentAng.z; + } + + for (PxU32 col = parentsLastDestCol; col < destCol; col++) + { + //fill with zeros. + jacobian(destRow + 0, col) = 0.0f; + jacobian(destRow + 1, col) = 0.0f; + jacobian(destRow + 2, col) = 0.0f; + + jacobian(destRow + 3, col) = 0.0f; + jacobian(destRow + 4, col) = 0.0f; + jacobian(destRow + 5, col) = 0.0f; + } + } + + //diagonal block: + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + const Cm::UnAlignedSpatialVector& v = mArticulationData.mMotionMatrix[jointDatum.jointOffset + ind]; + + const PxVec3 ang = body2World.rotate(v.top); + const PxVec3 lin = body2World.rotate(v.bottom); + + jacobian(destRow + 0, destCol) = lin.x; + jacobian(destRow + 1, destCol) = lin.y; + jacobian(destRow + 2, destCol) = lin.z; + + jacobian(destRow + 3, destCol) = ang.x; + jacobian(destRow + 4, destCol) = ang.y; + jacobian(destRow + 5, destCol) = ang.z; + + destCol++; + } + + //above diagonal block: always zero + for (PxU32 col = destCol; col < nCols; col++) + { + jacobian(destRow + 0, col) = 0.0f; + jacobian(destRow + 1, col) = 0.0f; + jacobian(destRow + 2, col) = 0.0f; + + jacobian(destRow + 3, col) = 0.0f; + jacobian(destRow + 4, col) = 0.0f; + jacobian(destRow + 5, col) = 0.0f; + } + + destRow += 6; + } + #undef jacobian + +#if 0 //Enable this if you want to compare results of this function with results of computeLinkVelocities(). + + PxReal * jointVels = mArticulationData.getJointVelocities();//size is totalDofs + + PxReal * jointSpaceVelsVector = new PxReal[nCols]; + PxReal * worldSpaceVelsVector = new PxReal[nRows]; + + PxU32 offset = 0; + + //stack input: + + if (!fixBase) + { + jointSpaceVelsVector[0] = core0.linearVelocity[0]; + jointSpaceVelsVector[1] = core0.linearVelocity[1]; + jointSpaceVelsVector[2] = core0.linearVelocity[2]; + + jointSpaceVelsVector[3] = core0.angularVelocity[0]; + jointSpaceVelsVector[4] = core0.angularVelocity[1]; + jointSpaceVelsVector[5] = core0.angularVelocity[2]; + + offset = 6; + } + + for (PxU32 i = 0; i < totalDofs; i++) + jointSpaceVelsVector[i + offset] = jointVels[i]; + + //multiply: + + for (PxU32 row = 0; row < nRows; row++) + { + worldSpaceVelsVector[row] = 0.0f; + for (PxU32 col = 0; col < nCols; col++) + { + worldSpaceVelsVector[row] += jacobian(row, col)*jointSpaceVelsVector[col]; + } + } + + //worldSpaceVelsVector should now contain the same result as scratchData.motionVelocities (except for swapped linear/angular vec3 order). + + delete[] jointSpaceVelsVector; + delete[] worldSpaceVelsVector; + + allocator->free(tempMemory); +#endif + } + + void FeatherstoneArticulation::computeLinkStates( + const PxF32 dt, const PxReal invLengthScale, const PxVec3& gravity, + const bool fixBase, + const PxU32 linkCount, + const PxTransform* accumulatedPoses, const Cm::SpatialVector* externalAccels, const PxVec3* rws, const Cm::UnAlignedSpatialVector* worldMotionMatrices, + const Dy::ArticulationJointCoreData* jointCoreData, + Dy::ArticulationLinkData *linkData, Dy::ArticulationLink* links, Cm::SpatialVectorF* motionAccelerations, + Cm::SpatialVectorF* motionVelocities, + Cm::SpatialVectorF* spatialZAForces, Cm::SpatialVectorF* spatialZAInternal, Cm::SpatialVectorF* coriolisVectors, + PxMat33* worldIsolatedSpatialArticulatedInertias, PxF32* linkMasses, Dy::SpatialMatrix* worldSpatialArticulatedInertias, + const PxU32 jointDofCount, + PxReal* jointVelocities, + Cm::SpatialVectorF& rootPreMotionVelocity, PxVec3& com, PxF32& invSumMass) + { + PX_UNUSED(jointDofCount); + + const PxReal invDt = dt < 1e-6f ? PX_MAX_F32 : 1.f / dt; + + //Initialise motion velocity, motion acceleration and coriolis vector of root link. + Cm::SpatialVectorF rootLinkVel; + { + const Dy::ArticulationLink& baseLink = links[0]; + const PxsBodyCore& core0 = *baseLink.bodyCore; + rootLinkVel = fixBase ? Cm::SpatialVectorF::Zero() : Cm::SpatialVectorF(core0.angularVelocity, core0.linearVelocity); + motionVelocities[0] = rootLinkVel; + motionAccelerations[0] = fixBase ? Cm::SpatialVectorF::Zero() : motionAccelerations[0]; + coriolisVectors[0] = Cm::SpatialVectorF::Zero(); + rootPreMotionVelocity = rootLinkVel; + } + + PxReal ratio = 1.f; + if (jointVelocities) + { + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + const ArticulationJointCoreData& jointDatum = jointCoreData[linkID]; + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + const PxReal maxJVelocity = link.inboundJoint->maxJointVelocity; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + PxReal jVel = jVelocity[ind]; + ratio = (jVel != 0.0f) ? PxMin(ratio, maxJVelocity / PxAbs(jVel)) : ratio; + } + } + } + + PxReal sumMass = 0.f; + PxVec3 COM(0.f); + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + ArticulationLinkData& linkDatum = linkData[linkID]; + const PxsBodyCore& bodyCore = *link.bodyCore; + + //Set the maxPemBias and cfm values from bodyCore + linkDatum.maxPenBias = bodyCore.maxPenBias; + link.cfm = (fixBase && linkID == 0) ? 0.f : bodyCore.cfmScale * invLengthScale; + + //Read the inertia and mass from bodyCore + const PxVec3& ii = bodyCore.inverseInertia; + const PxVec3 inertiaTensor = PxVec3(ii.x == 0.f ? 0.f : (1.f / ii.x), ii.y == 0.f ? 0.f : (1.f / ii.y), ii.z == 0.f ? 0.f : (1.f / ii.z)); + const PxReal invMass = bodyCore.inverseMass; + const PxReal m = invMass == 0.f ? 0.f : 1.0f / invMass; + + //Compute the inertia matrix Iw = R * I * Rtranspose + //Compute the articulated inertia. + PxMat33 Iw; //R * I * Rtranspose + SpatialMatrix worldArticulatedInertia; + { + PxMat33 rot(accumulatedPoses[linkID].q); + Cm::transformInertiaTensor(inertiaTensor, rot, Iw); + worldArticulatedInertia.topLeft = PxMat33(PxZero); + worldArticulatedInertia.topRight = PxMat33::createDiagonal(PxVec3(m)); + worldArticulatedInertia.bottomLeft = Iw; + } + + //Set the articulated inertia, inertia and mass of the link. + worldSpatialArticulatedInertias[linkID] = worldArticulatedInertia; + worldIsolatedSpatialArticulatedInertias[linkID] = Iw; + linkMasses[linkID] = m; + + //Accumulate the centre of mass. + sumMass += m; + COM += accumulatedPoses[linkID].p * m; + + Cm::SpatialVectorF vel; + if (linkID != 0) + { + //Propagate spatial vector of link parent to link's spatial vector. + const Cm::SpatialVectorF pVel = motionVelocities[link.parent]; + vel = FeatherstoneArticulation::translateSpatialVector(-rws[linkID], pVel); + + //Propagate joint dof velocities to the link's spatial velocity vector. + //Accumulate spatial forces that the joint applies to the link. + if (jointVelocities) + { + //The coriolis vector depends on the type of joint and the joint motion matrix. + //However, some terms in the coriolis vector are common to all joint types. + //Write down the term that is independent of the joint. + Cm::SpatialVectorF coriolisVector(PxVec3(PxZero), pVel.top.cross(pVel.top.cross(rws[linkID]))); + const ArticulationJointCoreData& jointDatum = jointCoreData[linkID]; + if (jointDatum.dof) + { + //Compute the effect of the joint velocities on the link. + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + Cm::UnAlignedSpatialVector deltaV = Cm::UnAlignedSpatialVector::Zero(); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + PxReal jVel = jVelocity[ind] * ratio; + deltaV += worldMotionMatrices[jointDatum.jointOffset + ind] * jVel; + jVelocity[ind] = jVel; + } + + //Add the effect of the joint velocities to the link. + vel.top += deltaV.top; + vel.bottom += deltaV.bottom; + + //Compute the coriolis vector. + //mu(i) is the velocity arising from the joint motion: mu(i) = motionMatrix*qdot + //where qdot is the joint velocity. + //mu(i) is already computed and cached in deltaV. + //For the revolute joint we have: + //deltaV = {mu(i), mu(i) X d(i)} + //coriolis vector += {omega(i-1) X mu(i), 2*omega(i-1) X (mu(i) X d(i)) + mu(i) X (mu(i) X d(i))} + //For the prismatic joint we have: + //deltaV = {0, mu(i)} + //coriolis vector += {0, 2*omega(i-1) X mu(i)} + coriolisVector += Cm::SpatialVectorF(pVel.top.cross(deltaV.top), 2.0f*pVel.top.cross(deltaV.bottom) + deltaV.top.cross(deltaV.bottom)); + } + //TODOGY - if jointVelocities is null we do not appear to set coriolisVectors[linkId] but we do set coriolisVectors[0] + coriolisVectors[linkID] = coriolisVector; + } + + //PX_ASSERT(vel.top.isFinite() && PxAbs(vel.top.x) < 10000.f && PxAbs(vel.top.y) < 10000.f && PxAbs(vel.top.z) < 10000.f); + //PX_ASSERT(vel.bottom.isFinite() && PxAbs(vel.bottom.x) < 10000.f && PxAbs(vel.bottom.y) < 10000.f && PxAbs(vel.bottom.z) < 10000.f); + motionVelocities[linkID] = vel; + } + else + { + vel = rootLinkVel; + //Note: we have already set motionVelocities[0] and coriolisVectors[0] so no need to set them again. + } + + //Account for force arising from external accelerations + //Account for damping force arising from the velocity and from the velocity that will accumulate from the acceleration terms. + //Account for scaling force that will bring velocity back to the maximum allowed velocity if velocity exceed the maximum allowed. + //Example for the linear term: + //acceleration force = m*(g + extLinAccel) + //linVelNew = linVel + (g + extLinAccel)*dt + //damping force = -m*linVelNew*linDamp = -m*linVel*linDamp - m*(g + extLinAccel)*linDamp*dt + //scaling force = -m*linVel*linScale/dt with linScale = (1.0f - maxLinVel/linVel) + //Put it all together + // m*(g + extLinAccel)*(1 - linDamp*dt) - m*linVel*(linDamp + linScale/dt) + //Bit more reordering: + //m*[g + extLinAccel)*(1 - linDamp*dt) - linVel*(linDamp + linScale/dt)] + //Zero acceleration means we need to work against change: + //-m*[g + extLinAccel)*(1 - linDamp*dt) - linVel*(linDamp + linScale/dt)] + Cm::SpatialVectorF zTmp; + { + const PxVec3 g = bodyCore.disableGravity ? PxVec3(PxZero) : gravity; + const PxVec3 exLinAccel = externalAccels ? externalAccels[linkID].linear : PxVec3(PxZero); + const PxF32 lindamp = bodyCore.linearDamping > 0.f ? PxMin(bodyCore.linearDamping, invDt) : 0.0f; + const PxF32 linscale = (vel.bottom.magnitudeSquared() > bodyCore.maxLinearVelocitySq) ? (1.0f - (PxSqrt(bodyCore.maxLinearVelocitySq)/PxSqrt(vel.bottom.magnitudeSquared()))): 0.0f; + zTmp.top = -(m*((g + exLinAccel)*(1.0f - lindamp*dt) - vel.bottom*(lindamp + linscale*invDt))); + } + { + const PxVec3 exAngAccel = externalAccels ? externalAccels[linkID].angular : PxVec3(PxZero); + const PxF32 angdamp = bodyCore.angularDamping > 0.f ? PxMin(bodyCore.angularDamping, invDt) : 0.0f; + const PxF32 angscale = (vel.top.magnitudeSquared() > bodyCore.maxAngularVelocitySq) ? (1.0f - (PxSqrt(bodyCore.maxAngularVelocitySq)/PxSqrt(vel.top.magnitudeSquared()))) : 0.0f; + zTmp.bottom = -(Iw*(exAngAccel*(1.0f - angdamp*dt) - vel.top*(angdamp + angscale*invDt))); + } + spatialZAForces[linkID] = zTmp; + + //Account for forces arising from internal accelerations. + //Note: Mirtich thesis introduces a single spatial zero acceleration force that contains an external [mass*gravity] term and the internal [omega X (Iw *omega)] term. + //We split the spatial zero acceleration force into external (above) and internal (below). + const Cm::SpatialVectorF zInternal(PxVec3(0.f), vel.top.cross(Iw*vel.top)); + spatialZAInternal[linkID] = zInternal; + } + + PxReal invMass = 1.f / sumMass; + com = COM * invMass; + invSumMass = invMass; + } + + + //compute all links velocities + void FeatherstoneArticulation::computeLinkVelocities(ArticulationData& data, + ScratchData& scratchData) + { + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + ArticulationLink* links = data.getLinks(); + ArticulationLinkData* linkData = data.getLinkData(); + const PxU32 linkCount = data.getLinkCount(); + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + //motion velocities has to be in world space to avoid numerical errors caused by space + Cm::SpatialVectorF* motionVelocities = scratchData.motionVelocities; + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + + PxReal* jointVelocities = scratchData.jointVelocities; + + const ArticulationLink& baseLink = links[0]; + ArticulationLinkData& baseLinkDatum = linkData[0]; + + PxsBodyCore& core0 = *baseLink.bodyCore; + + baseLinkDatum.maxPenBias = core0.maxPenBias; + + if (fixBase) + { + motionVelocities[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + motionAccelerations[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + + } + else + { + motionVelocities[0] = Cm::SpatialVectorF(core0.angularVelocity, core0.linearVelocity); + + //PX_ASSERT(core0.angularVelocity.isFinite() && PxAbs(core0.angularVelocity.x) < 10000.f && PxAbs(core0.angularVelocity.y) < 10000.f && PxAbs(core0.angularVelocity.z) < 10000.f); + //PX_ASSERT(core0.linearVelocity.isFinite() && PxAbs(core0.linearVelocity.x) < 10000.f && PxAbs(core0.linearVelocity.y) < 10000.f && PxAbs(core0.linearVelocity.z) < 10000.f); + } + + coriolisVectors[0] = Cm::SpatialVectorF::Zero(); + + data.mRootPreMotionVelocity = motionVelocities[0]; + + //const PxU32 dofCount = data.mDofs; + PxReal ratio = 1.f; + if (jointVelocities) + { + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + const PxReal maxJVelocity = link.inboundJoint->maxJointVelocity; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + PxReal absJvel = PxAbs(jVelocity[ind]); + ratio = ratio * absJvel > maxJVelocity ? (maxJVelocity / absJvel) : ratio; + } + } + } + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationLink& link = links[linkID]; + ArticulationLinkData& linkDatum = linkData[linkID]; + const PxsBodyCore& bodyCore = *link.bodyCore; + + linkDatum.maxPenBias = bodyCore.maxPenBias; + const Cm::SpatialVectorF pVel = motionVelocities[link.parent]; + Cm::SpatialVectorF vel = FeatherstoneArticulation::translateSpatialVector(-mArticulationData.getRw(linkID), pVel); + const PxTransform& body2World = bodyCore.body2World; + + if (jointVelocities) + { + PxVec3 torque = pVel.top.cross(pVel.top.cross(data.getRw(linkID))); + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + + PxVec3 force(0.f); + if (jointDatum.dof) + { + + Cm::UnAlignedSpatialVector deltaV = Cm::UnAlignedSpatialVector::Zero(); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + PxReal jVel = jVelocity[ind] * ratio; + //deltaV += data.mWorldMotionMatrix[jointDatum.jointOffset + ind] * jVel; + deltaV += data.mMotionMatrix[jointDatum.jointOffset+ind].rotate(body2World) * jVel; + jVelocity[ind] = jVel; + } + + vel.top += deltaV.top; + vel.bottom += deltaV.bottom; + + const PxVec3 aVec = deltaV.top; + force = pVel.top.cross(aVec); + + //compute linear part + const PxVec3 lVel = deltaV.bottom; + + const PxVec3 temp1 = 2.f * pVel.top.cross(lVel); + const PxVec3 temp2 = aVec.cross(lVel); + torque += temp1 + temp2; + + } + coriolisVectors[linkID] = Cm::SpatialVectorF(force, torque); + } + + //PX_ASSERT(vel.top.isFinite() && PxAbs(vel.top.x) < 10000.f && PxAbs(vel.top.y) < 10000.f && PxAbs(vel.top.z) < 10000.f); + //PX_ASSERT(vel.bottom.isFinite() && PxAbs(vel.bottom.x) < 10000.f && PxAbs(vel.bottom.y) < 10000.f && PxAbs(vel.bottom.z) < 10000.f); + + motionVelocities[linkID] = vel; + } + } + + void solveExtContact(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + Vec3V& linImpulse0, Vec3V& linImpulse1, Vec3V& angImpulse0, Vec3V& angImpulse1, bool doFriction); + + void solveExt1D(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + Vec3V& li0, Vec3V& li1, Vec3V& ai0, Vec3V& ai1); + + void solveExt1D(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + const Vec3V& linMotion0, const Vec3V& linMotion1, const Vec3V& angMotion0, const Vec3V& angMotion1, + const QuatV& rotA, const QuatV& rotB, const PxReal elapsedTimeF32, Vec3V& linImpulse0, Vec3V& linImpulse1, Vec3V& angImpulse0, + Vec3V& angImpulse1); + + void solveExtContactStep(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + Vec3V& linDelta0, Vec3V& linDelta1, Vec3V& angDelta0, Vec3V& angDelta1, Vec3V& linImpulse0, Vec3V& linImpulse1, Vec3V& angImpulse0, Vec3V& angImpulse1, + bool doFriction, const PxReal minPenetration, const PxReal elapsedTimeF32); + + + + + void solveStaticConstraint(const PxSolverConstraintDesc& desc, Cm::SpatialVectorF& linkV, + Cm::SpatialVectorF& impulse, Cm::SpatialVectorF& deltaV, const Cm::SpatialVectorF& motion, + const PxQuat& rot, bool isTGS, PxReal elapsedTime, const PxReal minPenetration) + { + PX_UNUSED(isTGS); + PX_UNUSED(elapsedTime); + PX_UNUSED(minPenetration); + Vec3V linVel = V3LoadA(linkV.bottom); + Vec3V angVel = V3LoadA(linkV.top); + + Vec3V linVel0, linVel1, angVel0, angVel1; + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + if (isTGS) + { + PxQuat idt(PxIdentity); + Vec3V linMotion0, angMotion0, linMotion1, angMotion1; + QuatV rotA, rotB; + if (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = linVel; + angVel0 = angVel; + linMotion0 = V3LoadA(motion.bottom); + angMotion0 = V3LoadA(motion.top); + rotA = QuatVLoadU(&rot.x); + rotB = QuatVLoadU(&idt.x); + linVel1 = angVel1 = linMotion1 = angMotion1 = V3Zero(); + } + else + { + linVel1 = linVel; + angVel1 = angVel; + linMotion1 = V3LoadA(motion.bottom); + angMotion1 = V3LoadA(motion.top); + rotB = QuatVLoadU(&rot.x); + rotA = QuatVLoadU(&idt.x); + linVel0 = angVel0 = linMotion0 = angMotion0 = V3Zero(); + } + + if (*desc.constraint == DY_SC_TYPE_EXT_CONTACT) + { + Dy::solveExtContactStep(desc, linVel0, linVel1, angVel0, angVel1, linMotion0, linMotion1, angMotion0, angMotion1, + li0, li1, ai0, ai1, true, minPenetration, elapsedTime); + } + else + { + Dy::solveExt1D(desc, linVel0, linVel1, angVel0, angVel1, linMotion0, linMotion1, angMotion0, angMotion1, + rotA, rotB, elapsedTime, li0, li1, ai0, ai1); + } + } + else + { + if (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = linVel; + angVel0 = angVel; + linVel1 = angVel1 = V3Zero(); + } + else + { + linVel1 = linVel; + angVel1 = angVel; + linVel0 = angVel0 = V3Zero(); + } + + if (*desc.constraint == DY_SC_TYPE_EXT_CONTACT) + { + Dy::solveExtContact(desc, linVel0, linVel1, angVel0, angVel1, li0, li1, ai0, ai1, true); + } + else + { + Dy::solveExt1D(desc, linVel0, linVel1, angVel0, angVel1, li0, li1, ai0, ai1); + } + } + + Cm::SpatialVectorF newVel, newImp; + + if (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY) + { + V4StoreA(Vec4V_From_Vec3V(linVel0), &newVel.bottom.x); + V4StoreA(Vec4V_From_Vec3V(angVel0), &newVel.top.x); + + V4StoreA(Vec4V_From_Vec3V(li0), &newImp.top.x); + V4StoreA(Vec4V_From_Vec3V(ai0), &newImp.bottom.x); + } + else + { + V4StoreA(Vec4V_From_Vec3V(linVel1), &newVel.bottom.x); + V4StoreA(Vec4V_From_Vec3V(angVel1), &newVel.top.x); + + V4StoreA(Vec4V_From_Vec3V(li1), &newImp.top.x); + V4StoreA(Vec4V_From_Vec3V(ai1), &newImp.bottom.x); + } + + deltaV.top += (newVel.top - linkV.top); + deltaV.bottom += (newVel.bottom - linkV.bottom); + linkV.top = newVel.top; + linkV.bottom = newVel.bottom; + impulse -= newImp; + } + + void writeBackContact(const PxSolverConstraintDesc& desc, SolverContext& cache, + PxSolverBodyData& bd0, PxSolverBodyData& bd1); + + void writeBack1D(const PxSolverConstraintDesc& desc, SolverContext&, + PxSolverBodyData&, PxSolverBodyData&); + + void writeBackContact(const PxSolverConstraintDesc& desc, SolverContext* cache); + void writeBack1D(const PxSolverConstraintDesc& desc); + + void FeatherstoneArticulation::writebackInternalConstraints(bool isTGS) + { + SolverContext context; + PxSolverBodyData data; + + + for (PxU32 i = 0; i < mStatic1DConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[i]; + + PX_ASSERT(*desc.constraint == DY_SC_TYPE_EXT_1D); + + if (isTGS) + { + writeBack1D(static_cast(desc)); + } + else + { + writeBack1D(desc, context, data, data); + } + } + + for (PxU32 i = 0; i < mStaticContactConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[i]; + + PX_ASSERT(*desc.constraint == DY_SC_TYPE_EXT_CONTACT); + if (isTGS) + { + writeBackContact(static_cast(desc), NULL); + + } + else + { + writeBackContact(desc, context, data, data); + } + } + } + + void concludeContact(const PxSolverConstraintDesc& desc, SolverContext& cache); + + void conclude1D(const PxSolverConstraintDesc& desc, SolverContext& cache); + + void concludeContact(const PxSolverConstraintDesc& desc); + + void conclude1DStep(const PxSolverConstraintDesc& desc); + + + void FeatherstoneArticulation::concludeInternalConstraints(bool isTGS) + { + SolverContext context; + + for (PxU32 i = 0; i < mStatic1DConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[i]; + + PX_ASSERT(*desc.constraint == DY_SC_TYPE_EXT_1D); + if (isTGS) + { + conclude1DStep(desc); + } + else + { + conclude1D(desc, context); + } + } + + for (PxU32 i = 0; i < mStaticContactConstraints.size(); ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[i]; + PX_ASSERT(*desc.constraint == DY_SC_TYPE_EXT_CONTACT); + + if (isTGS) + { + concludeContact(desc); + } + else + { + concludeContact(desc, context); + } + } + } + + //Takes jointV, returns deltaF + static PxReal solveLimit(ArticulationInternalLimit& limit, PxReal& jointV, const PxReal jointPDelta, + const PxReal response, const PxReal recipResponse, const InternalConstraintSolverData& data) + { + PxReal futureDeltaJointP = jointPDelta + jointV * data.dt; + + bool limited = false; + + const PxReal tolerance = 0.f; + + PxReal deltaF = 0.f; + if ((limit.errorLow + jointPDelta) < tolerance || (limit.errorLow + futureDeltaJointP) < tolerance) + { + PxReal newJointV = jointV; + limited = true; + if ((limit.errorLow + jointPDelta) < tolerance) + { + if (!data.velocityIteration) + newJointV = -(limit.errorLow + jointPDelta) * data.invDt*data.erp; + } + else + newJointV = -(limit.errorLow + jointPDelta) * data.invDt; + + PxReal deltaV = newJointV - jointV; + const PxReal lowImpulse = limit.lowImpulse; + deltaF = PxMax(lowImpulse + deltaV * recipResponse, 0.f) - lowImpulse; + + limit.lowImpulse = lowImpulse + deltaF; + } + else if ((limit.errorHigh - jointPDelta) < tolerance || (limit.errorHigh - futureDeltaJointP) < tolerance) + { + PxReal newJointV = jointV; + limited = true; + if ((limit.errorHigh - jointPDelta) < tolerance) + { + if (!data.velocityIteration) + newJointV = (limit.errorHigh - jointPDelta) * data.invDt*data.erp; + } + else + newJointV = (limit.errorHigh - jointPDelta) * data.invDt; + + PxReal deltaV = newJointV - jointV; + const PxReal highImpulse = limit.highImpulse; + deltaF = PxMin(highImpulse + deltaV * recipResponse, 0.f) - highImpulse; + limit.highImpulse = highImpulse + deltaF; + } + + + if (!limited) + { + const PxReal forceLimit = -jointV*recipResponse; + if (jointV > 0.f) + { + deltaF = PxMax(forceLimit, -limit.lowImpulse); + limit.lowImpulse += deltaF; + + } + else + { + deltaF = PxMin(forceLimit, -limit.highImpulse); + limit.highImpulse += deltaF; + } + } + + jointV += deltaF * response; + return deltaF; + } + + + Cm::SpatialVectorF FeatherstoneArticulation::solveInternalJointConstraintRecursive(InternalConstraintSolverData& data, const PxU32 linkID, const Cm::SpatialVectorF& parentDeltaV) + { + //PxU32 linkID = stack[stackSize]; + const ArticulationLink* links = mArticulationData.mLinks; + const ArticulationLink& link = links[linkID]; + //const ArticulationLink& plink = links[link.parent]; + ArticulationLinkData& linkDatum = mArticulationData.getLinkData(linkID); + + //PxTransform* transforms = mArticulationData.mPreTransform.begin(); + + PX_UNUSED(linkDatum); + + const ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + // const ArticulationJointTargetData& jointTranDatum = mArticulationData.getJointTranData(linkID); + + Cm::SpatialVectorF i1(PxVec3(0.f), PxVec3(0.f)); + + //We know the absolute parentDeltaV from the call to this function so no need to modify it. + Cm::SpatialVectorF parentV = parentDeltaV + mArticulationData.mMotionVelocities[link.parent]; + + Cm::SpatialVectorF parentVelContrib = propagateAccelerationW(mArticulationData.getRw(linkID), mArticulationData.mInvStIs[linkID], + &mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset], parentDeltaV, jointDatum.dof, + &mArticulationData.mIsW[jointDatum.jointOffset], &mArticulationData.mDeferredQstZ[jointDatum.jointOffset]); + + Cm::SpatialVectorF childV = mArticulationData.mMotionVelocities[linkID] + parentVelContrib; + + Cm::UnAlignedSpatialVector i0(PxVec3(0.f), PxVec3(0.f)); + + Cm::SpatialVectorF dv1 = parentVelContrib; + + const PxReal maxJointVel = link.inboundJoint->maxJointVelocity; + + //If we have any internal constraints to process (parent/child limits/locks/drives) + if (jointDatum.dofInternalConstraintMask) + { + for (PxU32 dof = 0; dof < jointDatum.dof; ++dof) + { + PxReal deltaF = 0.f; + PxReal clampedForce = 0.f; + + PxU32 internalConstraint = jointDatum.dofInternalConstraintMask & (1 << dof); + + if (internalConstraint) + { + ArticulationInternalConstraint& constraint = mArticulationData.mInternalConstraints[data.dofId++]; + const PxReal jointPDelta = constraint.row1.innerProduct(mArticulationData.mDeltaMotionVector[linkID]) - constraint.row0.innerProduct(mArticulationData.mDeltaMotionVector[link.parent]); + + //PxReal driveError = constraint.driveError - jointPDelta; + + PxReal errorDelta = (constraint.driveTargetVel*constraint.response*data.elapsedTime) - jointPDelta; + + PxReal jointV = constraint.row1.innerProduct(childV) - constraint.row0.innerProduct(parentV); + + const PxReal appliedFriction = constraint.frictionForce*constraint.frictionForceCoefficient; + + PxReal frictionForce = PxClamp(-jointV *constraint.recipResponse + appliedFriction, + -constraint.maxFrictionForce, constraint.maxFrictionForce); + + PxReal frictionDeltaF = frictionForce - appliedFriction; + + constraint.frictionForce += frictionDeltaF; + + jointV += frictionDeltaF * constraint.response; + + + + PxReal unclampedForce = constraint.driveImpulseMultiplier * constraint.driveForce + + jointV * constraint.driveVelMultiplier + constraint.driveTargetVel + constraint.driveInitialBias + errorDelta * constraint.driveBiasCoefficient; + + clampedForce = PxClamp(unclampedForce, -constraint.maxDriveForce, constraint.maxDriveForce); + PxReal driveDeltaF = (clampedForce - constraint.driveForce); + + //Where we will be next frame - we use this to compute error bias terms to correct limits and drives... + + jointV += driveDeltaF * constraint.response; + + driveDeltaF += frictionDeltaF; + + //printf("LinkID %i driveDeltaV = %f, jointV = %f\n", linkID, driveDeltaF, jointV); + + if (jointDatum.limitMask & (1 << dof)) + { + ArticulationInternalLimit& limit = mArticulationData.mInternalLimits[data.limitId++]; + deltaF = solveLimit(limit, jointV, jointPDelta, constraint.response, constraint.recipResponse, data); + } + + if (PxAbs(jointV) > maxJointVel) + { + PxReal newJointV = PxClamp(jointV, -maxJointVel, maxJointVel); + deltaF += (newJointV - jointV) * constraint.recipResponse*data.erp; + jointV = newJointV; + } + + deltaF += driveDeltaF; + + if (deltaF != 0.f) + { + //impulse = true; + constraint.driveForce = clampedForce; + + i0 += constraint.row0 * deltaF; + i1.top -= constraint.row1.top * deltaF; + i1.bottom -= constraint.row1.bottom * deltaF; + + const Cm::UnAlignedSpatialVector deltaVP = constraint.deltaVA * (-deltaF); + const Cm::UnAlignedSpatialVector deltaVC = constraint.deltaVB * (-deltaF); + + parentV += Cm::SpatialVectorF(deltaVP.top, deltaVP.bottom); + childV += Cm::SpatialVectorF(deltaVC.top, deltaVC.bottom); + + dv1.top += deltaVC.top; + dv1.bottom += deltaVC.bottom; + } + } + } + } + + + + + + const Cm::SpatialVectorF& deltaMotion = mArticulationData.getDeltaMotionVector(linkID); + const PxQuat& deltaQ = getDeltaQ(linkID); + + const PxU32 nbStatic1DConstraints = mArticulationData.mNbStatic1DConstraints[linkID]; + PxU32 start1DIdx = mArticulationData.mStatic1DConstraintStartIndex[linkID]; + for (PxU32 i = 0; i < nbStatic1DConstraints; ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[start1DIdx++]; + solveStaticConstraint(desc, childV, i1, dv1, deltaMotion, deltaQ, data.isTGS, data.elapsedTime, data.velocityIteration ? 0.f : -PX_MAX_F32); + } + + const PxU32 nbStaticContactConstraints = mArticulationData.mNbStaticContactConstraints[linkID]; + PxU32 startContactIdx = mArticulationData.mStaticContactConstraintStartIndex[linkID]; + for (PxU32 i = 0; i < nbStaticContactConstraints; ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[startContactIdx++]; + solveStaticConstraint(desc, childV, i1, dv1, deltaMotion, deltaQ, data.isTGS, data.elapsedTime, data.velocityIteration ? 0.f : -PX_MAX_F32); + } + + PxU32 numChildren = link.mNumChildren; + PxU32 offset = link.mChildrenStartIndex; + + for(PxU32 i = 0; i < numChildren; ++i) + { + const PxU32 child = offset+i; + + Cm::SpatialVectorF childImp = solveInternalJointConstraintRecursive(data, child, dv1); + i1 += childImp; + + if ((numChildren-i) > 1) + { + //Propagate the childImp to my dv1 so that the next constraint gets to see an updated velocity state based + //on the propagation of the child velocities + Cm::SpatialVectorF deltaV = mArticulationData.mResponseMatrixW[linkID].getResponse(-childImp); + dv1 += deltaV; + childV += deltaV; + + } + } + + + Cm::SpatialVectorF propagatedImpulse = propagateImpulseW(&mArticulationData.mIsInvDW[jointDatum.jointOffset], mArticulationData.getRw(linkID), &mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset], i1, jointDatum.dof, &mArticulationData.mDeferredQstZ[jointDatum.jointOffset]); + return Cm::SpatialVectorF(i0.top, i0.bottom) + propagatedImpulse; + } + + + void FeatherstoneArticulation::solveInternalJointConstraints(const PxReal dt, const PxReal invDt, + Cm::SpatialVectorF* impulses, Cm::SpatialVectorF* DeltaV, bool velocityIteration, bool isTGS, + const PxReal elapsedTime, const PxReal biasCoefficient) + { + //const PxU32 count = mArticulationData.getLinkCount(); + + if (mArticulationData.mInternalConstraints.size() == 0 + && mStatic1DConstraints.size() == 0 && mStaticContactConstraints.size() == 0) + return; + + //const PxReal erp = isTGS ? 0.5f*biasCoefficient : biasCoefficient; + const PxReal erp = biasCoefficient; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + PxU32* static1DConstraintCounts = mArticulationData.mNbStatic1DConstraints.begin(); + PxU32* static1DConstraintStarts = mArticulationData.mStatic1DConstraintStartIndex.begin(); + + PxU32* staticContactConstraintCounts = mArticulationData.mNbStaticContactConstraints.begin(); + PxU32* staticContactConstraintStarts = mArticulationData.mStaticContactConstraintStartIndex.begin(); + + ArticulationLink* links = mArticulationData.getLinks(); + Cm::SpatialVectorF* baseVelocities = mArticulationData.getMotionVelocities(); + //PxTransform* transforms = mArticulationData.mPreTransform.begin(); + + //Cm::SpatialVectorF* deferredZ = mArticulationData.getSpatialZAVectors(); + + const PxReal minPenetration = velocityIteration ? 0.f : -PX_MAX_F32; + + Cm::SpatialVectorF rootLinkV; + { + Cm::SpatialVectorF rootLinkDeltaV(PxVec3(0.f), PxVec3(0.f)); + + if (!fixBase) + { + //Cm::SpatialVectorF temp = mArticulationData.getBaseInvSpatialArticulatedInertia() * (-deferredZ[0]); + //const PxTransform& body2World0 = transforms[0]; + //rootLinkDeltaV = temp.rotate(body2World0); + //temp is now in world space! + rootLinkDeltaV = mArticulationData.getBaseInvSpatialArticulatedInertiaW() * -mArticulationData.mRootDeferredZ; + } + + rootLinkV = rootLinkDeltaV + baseVelocities[0]; + + Cm::SpatialVectorF im0 = Cm::SpatialVectorF::Zero(); + { + const PxU32 nbStatic1DConstraints = static1DConstraintCounts[0]; + + if (nbStatic1DConstraints) + { + const Cm::SpatialVectorF& deltaMotion = mArticulationData.getDeltaMotionVector(0); + const PxQuat& deltaQ = getDeltaQ(0); + + PxU32 startIdx = static1DConstraintStarts[0]; + for (PxU32 i = 0; i < nbStatic1DConstraints; ++i) + { + PxSolverConstraintDesc& desc = mStatic1DConstraints[startIdx++]; + + solveStaticConstraint(desc, rootLinkV, im0, rootLinkDeltaV, deltaMotion, deltaQ, isTGS, elapsedTime, minPenetration); + } + + //Impulses and deferredZ are now in world space, not link space! + /*im0.top = transforms[0].rotateInv(im0.top); + im0.bottom = transforms[0].rotateInv(im0.bottom);*/ + } + + const PxU32 nbStaticContactConstraints = staticContactConstraintCounts[0]; + + if (nbStaticContactConstraints) + { + const Cm::SpatialVectorF& deltaMotion = mArticulationData.getDeltaMotionVector(0); + const PxQuat& deltaQ = getDeltaQ(0); + + PxU32 startIdx = staticContactConstraintStarts[0]; + for (PxU32 i = 0; i < nbStaticContactConstraints; ++i) + { + PxSolverConstraintDesc& desc = mStaticContactConstraints[startIdx++]; + + solveStaticConstraint(desc, rootLinkV, im0, rootLinkDeltaV, deltaMotion, deltaQ, isTGS, elapsedTime, minPenetration); + } + + //Impulses and deferredZ are now in world space, not link space! + /*im0.top = transforms[0].rotateInv(im0.top); + im0.bottom = transforms[0].rotateInv(im0.bottom);*/ + } + + } + + InternalConstraintSolverData data(dt, invDt, elapsedTime, + erp, impulses, DeltaV, + velocityIteration, isTGS); + + data.articId = mArticulationIndex; + + const PxU32 numChildren = links[0].mNumChildren; + const PxU32 offset = links[0].mChildrenStartIndex; + + for (PxU32 i = 0; i < numChildren; ++i) + { + const PxU32 child = offset + i; + + Cm::SpatialVectorF imp = solveInternalJointConstraintRecursive(data, child, rootLinkDeltaV); + + im0 += imp; + + //There's an impulse, we have to work out how it impacts our velocity (only if required (we have more children to traverse))! + if (!fixBase && (numChildren - 1) != 0) + { + //Impulses and deltaVs are all now in world space + rootLinkDeltaV += mArticulationData.getBaseInvSpatialArticulatedInertiaW() * (-imp); + } + + } + + mArticulationData.mRootDeferredZ += im0; + mArticulationData.mJointDirty = true; + + } + } + + + + void FeatherstoneArticulation::solveInternalSpatialTendonConstraints(bool isTGS) + { + + if (mArticulationData.mInternalSpatialTendonConstraints.size() == 0) + return; + + + if (isTGS) + { + + //Update the error terms in the tendons recursively... + const PxU32 nbTendons = mArticulationData.mNumSpatialTendons; + + for (PxU32 i = 0; i < nbTendons; ++i) + { + Dy::ArticulationSpatialTendon* tendon = mArticulationData.mSpatialTendons[i]; + + Dy::ArticulationAttachment& attachment = tendon->getAttachment(0); + + //const PxU32 childCount = attachment.childCount; + + + //PxReal scale = 1.f / PxReal(childCount); + + PxReal coefficient = attachment.coefficient; + + const PxU32 startLink = tendon->getAttachment(0).linkInd; + const PxTransform pBody2World = mArticulationData.getAccumulatedPoses()[startLink]; + const PxVec3 pAttachPoint = pBody2World.transform(tendon->getAttachment(0).relativeOffset); + + Dy::ArticulationAttachment* attachments = tendon->getAttachments(); + for (ArticulationAttachmentBitField children = attachments[0].children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + updateSpatialTendonConstraintsRecursive(attachments, mArticulationData, child, tendon->mOffset*coefficient, pAttachPoint); + } + + } + } + + for (PxU32 i = 0; i < mArticulationData.mInternalSpatialTendonConstraints.size(); ++i) + { + ArticulationInternalTendonConstraint& constraint = mArticulationData.mInternalSpatialTendonConstraints[i]; + + const PxU32 parentID = constraint.linkID0; + const PxU32 linkID = constraint.linkID1; + + //Cm::SpatialVectorF childDeltaP = mArticulationData.mDeltaMotionVector[linkID]; + //Cm::SpatialVectorF parentDeltaP = mArticulationData.mDeltaMotionVector[parentID]; + + //PxReal deltaP = constraint.row1.innerProduct(childDeltaP) - constraint.row0.innerProduct(parentDeltaP);// + deltaErr; + + Cm::SpatialVectorV childVel = pxcFsGetVelocity(linkID); + Cm::SpatialVectorV parentVel = pxcFsGetVelocity(parentID); + + + Cm::UnAlignedSpatialVector childV; + V3StoreU(childVel.angular, childV.top); + V3StoreU(childVel.linear, childV.bottom); + + Cm::UnAlignedSpatialVector parentV; + V3StoreU(parentVel.angular, parentV.top); + V3StoreU(parentVel.linear, parentV.bottom); + + PxReal error = constraint.restDistance - constraint.accumulatedLength;// + deltaP; + + PxReal error2 = 0.f; + if (constraint.accumulatedLength > constraint.highLimit) + error2 = constraint.highLimit - constraint.accumulatedLength; + if (constraint.accumulatedLength < constraint.lowLimit) + error2 = constraint.lowLimit - constraint.accumulatedLength; + + PxReal jointV = constraint.row1.innerProduct(childV) - constraint.row0.innerProduct(parentV); + + PX_ASSERT(PxIsFinite(jointV)); + + PxReal unclampedForce = (jointV * constraint.velMultiplier + error * constraint.biasCoefficient) /** constraint.recipResponse*/ + + constraint.appliedForce * constraint.impulseMultiplier; + + PxReal unclampedForce2 = (error2 * constraint.limitBiasCoefficient) + constraint.limitAppliedForce * constraint.limitImpulseMultiplier; + + const PxReal deltaF = (unclampedForce - constraint.appliedForce) + (unclampedForce2 - constraint.limitAppliedForce); + + constraint.appliedForce = unclampedForce; + constraint.limitAppliedForce = unclampedForce2; + + if (deltaF != 0.f) + { + Cm::UnAlignedSpatialVector i0 = constraint.row0 * -deltaF; + Cm::UnAlignedSpatialVector i1 = constraint.row1 * deltaF; + pxcFsApplyImpulses(parentID, V3LoadU(i0.top), V3LoadU(i0.bottom), + linkID, V3LoadU(i1.top), V3LoadU(i1.bottom), NULL, NULL); + } + } + } + + PxVec3 FeatherstoneArticulation::calculateFixedTendonVelocityAndPositionRecursive(FixedTendonSolveData& solveData, + const Cm::SpatialVectorF& parentV, const Cm::SpatialVectorF& parentDeltaV, const PxU32 tendonJointID) + { + ArticulationTendonJoint& tendonJoint = solveData.tendonJoints[tendonJointID]; + + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(tendonJoint.linkInd); + + Cm::SpatialVectorF deltaV = propagateAccelerationW(mArticulationData.getRw(tendonJoint.linkInd), mArticulationData.mInvStIs[tendonJoint.linkInd], + &mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset], parentDeltaV, jointDatum.dof, + &mArticulationData.mIsW[jointDatum.jointOffset], &mArticulationData.mDeferredQstZ[jointDatum.jointOffset]); + + Cm::SpatialVectorF childV = mArticulationData.mMotionVelocities[tendonJoint.linkInd] + deltaV; + + + PxU32 index = tendonJoint.mConstraintInd; + ArticulationInternalTendonConstraint& constraint = mArticulationData.mInternalFixedTendonConstraints[index]; + + const PxU32 childCount = tendonJoint.childCount; + + PxVec3 jointVError; + + const PxReal jointV = constraint.row1.innerProduct(childV) - constraint.row0.innerProduct(parentV); + const PxReal jointP = mArticulationData.mJointPosition[tendonJoint.startJointOffset]; + + jointVError.x = jointV * tendonJoint.coefficient; + + jointVError.y = jointP * tendonJoint.coefficient; + + //printf("%i: jointPose = %f, jointV = %f, coefficient = %f\n", tendonJoint.linkInd, jointP, jointV, tendonJoint.coefficient); + + jointVError.z = 1.f; + + if (childCount) + { + for (ArticulationBitField children = tendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + jointVError += calculateFixedTendonVelocityAndPositionRecursive(solveData, childV, deltaV, child); + } + } + + return jointVError; + } + + + Cm::SpatialVectorF FeatherstoneArticulation::solveFixedTendonConstraintsRecursive(FixedTendonSolveData& solveData, + const PxU32 tendonJointID) + { + ArticulationTendonJoint& tendonJoint = solveData.tendonJoints[tendonJointID]; + + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(tendonJoint.linkInd); + + PxU32 index = tendonJoint.mConstraintInd; + ArticulationInternalTendonConstraint& constraint = mArticulationData.mInternalFixedTendonConstraints[index]; + + const PxU32 childCount = tendonJoint.childCount; + + PxReal jointV = solveData.rootVel; + + // calculate current accumulated tendon length from parent accumulated length + + const PxReal lengthError = solveData.error; + PxReal limitError = solveData.limitError; + + // the constraint bias coefficients need to flip signs together with the tendon joint's coefficient + // in order for the constraint force to point into the correct direction: + const PxReal coefficientSign = tendonJoint.recipCoefficient;// PxSign(tendonJoint.coefficient); + const PxReal biasCoefficient = constraint.biasCoefficient; + const PxReal limitBiasCoefficient = constraint.limitBiasCoefficient; + + PxReal unclampedForce = ((jointV * constraint.velMultiplier + lengthError * biasCoefficient)*coefficientSign) + + constraint.appliedForce * constraint.impulseMultiplier; + + PxReal unclampedForce2 = (limitError * limitBiasCoefficient * coefficientSign) + + constraint.limitAppliedForce * constraint.limitImpulseMultiplier; + + const PxReal deltaF = ((unclampedForce - constraint.appliedForce) + (unclampedForce2 - constraint.limitAppliedForce)); + + constraint.appliedForce = unclampedForce; + constraint.limitAppliedForce = unclampedForce2; + + solveData.rootImp += deltaF; + + + Cm::SpatialVectorF impulse(constraint.row1.top * -deltaF, constraint.row1.bottom * -deltaF); + + if (childCount) + { + for (ArticulationBitField children = tendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + Cm::SpatialVectorF propagatedImpulse = solveFixedTendonConstraintsRecursive(solveData, child); + + + impulse.top += propagatedImpulse.top; + impulse.bottom += propagatedImpulse.bottom; + } + } + + return propagateImpulseW(&mArticulationData.mIsInvDW[jointDatum.jointOffset], mArticulationData.mRw[tendonJoint.linkInd], + &mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset], impulse, jointDatum.dof, &mArticulationData.mDeferredQstZ[jointDatum.jointOffset]); + } + + + void FeatherstoneArticulation::solveInternalFixedTendonConstraints(bool isTGS) + { + PX_UNUSED(isTGS); + if (mArticulationData.mInternalFixedTendonConstraints.size() == 0) + return; + + { + + //Update the error terms in the tendons recursively... + const PxU32 nbTendons = mArticulationData.mNumFixedTendons; + + ArticulationLink* links = mArticulationData.getLinks(); + + for (PxU32 i = 0; i < nbTendons; ++i) + { + Dy::ArticulationFixedTendon* tendon = mArticulationData.mFixedTendons[i]; + + ArticulationTendonJoint* tendonJoints = tendon->getTendonJoints(); + + Dy::ArticulationTendonJoint& pTendonJoint = tendonJoints[0]; + + //const PxU32 childCount = pTendonJoint.childCount; + + const PxU32 startLink = pTendonJoint.linkInd; + + Cm::SpatialVectorV parentVel = pxcFsGetVelocity(startLink); + Cm::SpatialVectorF parentV; + V3StoreU(parentVel.angular, parentV.top); + V3StoreU(parentVel.linear, parentV.bottom); + + Cm::SpatialVectorF Z(PxVec3(0.f), PxVec3(0.f)); + + Cm::SpatialVectorF parentDeltaV = parentV - mArticulationData.mMotionVelocities[startLink]; + + + PxVec3 velError(0.f); + + for (ArticulationAttachmentBitField children = pTendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + + FixedTendonSolveData solveData; + solveData.links = links; + solveData.erp = 1.f; + solveData.rootImp = 0.f; + solveData.error = tendon->mError; + solveData.tendonJoints = tendonJoints; + + + velError += calculateFixedTendonVelocityAndPositionRecursive(solveData, parentV, parentDeltaV, child); + } + + const PxReal recipScale = velError.z == 0.f ? 0.f : 1.f / velError.z; + + for (ArticulationAttachmentBitField children = pTendonJoint.children; children != 0; children &= (children - 1)) + { + //index of child of link h on path to link linkID + const PxU32 child = ArticulationLowestSetBit(children); + ArticulationTendonJoint& tendonJoint = tendonJoints[child]; + + ArticulationInternalTendonConstraint& constraint = mArticulationData.mInternalFixedTendonConstraints[tendonJoint.mConstraintInd]; + + const PxReal length = (velError.y + tendon->mOffset); + + FixedTendonSolveData solveData; + solveData.links = links; + solveData.erp = 1.f; + solveData.rootImp = 0.f; + solveData.error = (length - tendon->mRestLength) * recipScale; + solveData.rootVel = velError.x*recipScale; + + PxReal limitError = 0.f; + if (length < tendon->mLowLimit) + limitError = length - tendon->mLowLimit; + else if (length > tendon->mHighLimit) + limitError = length - tendon->mHighLimit; + solveData.limitError = limitError * recipScale; + solveData.tendonJoints = tendonJoints; + + //KS - TODO - hook up offsets + Cm::SpatialVectorF propagatedImpulse = solveFixedTendonConstraintsRecursive(solveData, child); + + propagatedImpulse.top += constraint.row0.top * solveData.rootImp; + propagatedImpulse.bottom += constraint.row0.bottom * solveData.rootImp; + + Z += propagatedImpulse; + } + + for (PxU32 linkID = pTendonJoint.linkInd; linkID; linkID = links[linkID].parent) + { + const PxU32 jointOffset = mArticulationData.getJointData(linkID).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(linkID).dof; + + Z = propagateImpulseW(&mArticulationData.mIsInvDW[jointOffset], mArticulationData.getRw(linkID), + &mArticulationData.mWorldMotionMatrix[jointOffset], Z, dofCount, &mArticulationData.mDeferredQstZ[jointOffset]); + } + + mArticulationData.mRootDeferredZ += Z; + mArticulationData.mJointDirty = true; + + } + } + + } + + + void FeatherstoneArticulation::solveInternalConstraints(const PxReal dt, const PxReal invDt, + Cm::SpatialVectorF* impulses, Cm::SpatialVectorF* DeltaV, bool velocityIteration, bool isTGS, + const PxReal elapsedTime, const PxReal biasCoefficient) + { + solveInternalSpatialTendonConstraints(isTGS); + solveInternalFixedTendonConstraints(isTGS); + solveInternalJointConstraints(dt, invDt, impulses, DeltaV, velocityIteration, isTGS, elapsedTime, biasCoefficient); + } + + bool FeatherstoneArticulation::storeStaticConstraint(const PxSolverConstraintDesc& desc) + { + if (DY_STATIC_CONTACTS_IN_INTERNAL_SOLVER) + { + if (desc.constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT) + mStaticContactConstraints.pushBack(desc); + else + mStatic1DConstraints.pushBack(desc); + } + return DY_STATIC_CONTACTS_IN_INTERNAL_SOLVER; + } + + void FeatherstoneArticulation::setRootLinearVelocity(const PxVec3& velocity) + { + ArticulationLink& rLink = mArticulationData.getLink(0); + rLink.bodyCore->linearVelocity = velocity; + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_ROOT_VELOCITIES; + computeLinkVelocities(mArticulationData); + } + + void FeatherstoneArticulation::setRootAngularVelocity(const PxVec3& velocity) + { + ArticulationLink& rLink = mArticulationData.getLink(0); + rLink.bodyCore->angularVelocity = velocity; + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_ROOT_VELOCITIES; + computeLinkVelocities(mArticulationData); + } + + //This method is for user update the root link transform so we need to + //fix up other link's position. In this case, we should assume all joint + //velocity/pose is to be zero + void FeatherstoneArticulation::teleportRootLink() + { + //make sure motionMatrix has been set + //jcalc(mArticulationData); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + ArticulationLink* links = mArticulationData.getLinks(); + PxReal* jointPositions = mArticulationData.getJointPositions(); + Cm::SpatialVectorF* motionVelocities = mArticulationData.getMotionVelocities(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + const PxTransform oldTransform = link.bodyCore->body2World; + + ArticulationLink& pLink = links[link.parent]; + const PxTransform pBody2World = pLink.bodyCore->body2World; + + ArticulationJointCore* joint = link.inboundJoint; + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + + PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + PxQuat newParentToChild; + PxQuat newWorldQ; + PxVec3 r; + + const PxVec3 childOffset = -joint->childPose.p; + const PxVec3 parentOffset = joint->parentPose.p; + + const PxQuat relativeQuat = mArticulationData.mRelativeQuat[linkID]; + + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + newParentToChild = relativeQuat; + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + const PxVec3& u = mArticulationData.mMotionMatrix[jointDatum.jointOffset].bottom; + + r = e + d + u * jPosition[0]; + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const PxVec3& u = mArticulationData.mMotionMatrix[jointDatum.jointOffset].top; + + PxQuat jointRotation = PxQuat(-jPosition[0], u); + if (jointRotation.w < 0) //shortest angle. + jointRotation = -jointRotation; + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + /*PxVec3 worldAngVel = oldTransform.rotate(link.motionVelocity.top); + + newWorldQ = PxExp(worldAngVel*dt) * oldTransform.q; + + PxQuat newParentToChild2 = (newWorldQ.getConjugate() * joint->relativeQuat * pBody2World.q).getNormalized(); + + const PxVec3 e2 = newParentToChild2.rotate(parentOffset); + const PxVec3 d2 = childOffset; + r = e2 + d2;*/ + + PX_ASSERT(r.isFinite()); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + + //PxVec3 angVel(joint->jointVelocity[0], joint->jointVelocity[1], joint->jointVelocity[2]); + //PxVec3 worldAngVel = pLink.bodyCore->angularVelocity + oldTransform.rotate(angVel); + + PxVec3 worldAngVel = motionVelocities[linkID].top; + + /*const PxReal eps = 0.001f; + const PxVec3 dif = worldAngVel - worldAngVel2; + PX_ASSERT(PxAbs(dif.x) < eps && PxAbs(dif.y) < eps && PxAbs(dif.z) < eps);*/ + + newWorldQ = PxExp(worldAngVel) * oldTransform.q; + + newParentToChild = (newWorldQ.getConjugate() * relativeQuat * pBody2World.q).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + break; + } + case PxArticulationJointType::eFIX: + { + //this is fix joint so joint don't have velocity + newParentToChild = relativeQuat; + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + r = e + d; + break; + } + default: + break; + } + + PxTransform& body2World = link.bodyCore->body2World; + body2World.q = (pBody2World.q * newParentToChild.getConjugate()).getNormalized(); + body2World.p = pBody2World.p + body2World.q.rotate(r); + + PX_ASSERT(body2World.isSane()); + } + } + + + PxU8* FeatherstoneArticulation::allocateScratchSpatialData(PxcScratchAllocator* allocator, + const PxU32 linkCount, ScratchData& scratchData, bool fallBackToHeap) + { + const PxU32 size = sizeof(Cm::SpatialVectorF) * linkCount; + const PxU32 totalSize = size * 4 + sizeof(Dy::SpatialMatrix) * linkCount; + + PxU8* tempMemory = reinterpret_cast(allocator->alloc(totalSize, fallBackToHeap)); + + scratchData.motionVelocities = reinterpret_cast(tempMemory); + PxU32 offset = size; + scratchData.motionAccelerations = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.coriolisVectors = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.spatialZAVectors = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.compositeSpatialInertias = reinterpret_cast(tempMemory + offset); + + return tempMemory; + } + +/* void FeatherstoneArticulation::allocateScratchSpatialData(DyScratchAllocator& allocator, + const PxU32 linkCount, ScratchData& scratchData) + { + const PxU32 size = sizeof(Cm::SpatialVectorF) * linkCount; + const PxU32 totalSize = size * 5 + sizeof(Dy::SpatialMatrix) * linkCount; + + PxU8* tempMemory = allocator.alloc(totalSize); + + scratchData.motionVelocities = reinterpret_cast(tempMemory); + PxU32 offset = size; + scratchData.motionAccelerations = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.coriolisVectors = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.spatialZAVectors = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.externalAccels = reinterpret_cast(tempMemory + offset); + offset += size; + scratchData.compositeSpatialInertias = reinterpret_cast(tempMemory + offset); + + }*/ + + +}//namespace Dy +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulationLink.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulationLink.h new file mode 100644 index 0000000..157a68e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneArticulationLink.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FEATHERSTONE_ARTICULATION_LINK_H +#define DY_FEATHERSTONE_ARTICULATION_LINK_H + +#include "foundation/PxVec3.h" +#include "foundation/PxQuat.h" +#include "foundation/PxTransform.h" +#include "foundation/PxVecMath.h" +#include "CmUtils.h" +#include "CmSpatialVector.h" +#include "DyVArticulation.h" +#include "DyFeatherstoneArticulationUtils.h" + +namespace physx +{ + namespace Dy + { + + class ArticulationLinkData + { + const static PxU32 MaxJointRows = 3; + public: + ArticulationLinkData() + { + maxPenBias = 0.f; + } + + PxVec3 childToBase; + PxReal maxPenBias; + + }; + + }//namespace Dy +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp new file mode 100644 index 0000000..47424dc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneForwardDynamic.cpp @@ -0,0 +1,2604 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxMathUtils.h" +#include "CmConeLimitHelper.h" +#include "DySolverConstraint1D.h" +#include "DyFeatherstoneArticulation.h" +#include "PxsRigidBody.h" +#include "PxcConstraintBlockStream.h" +#include "DyArticulationContactPrep.h" +#include "DyDynamics.h" +#include "DyArticulationPImpl.h" +#include "DyFeatherstoneArticulationLink.h" +#include "DyFeatherstoneArticulationJointData.h" +#include "PxsIslandSim.h" +#include "common/PxProfileZone.h" +#include + + +#ifdef _MSC_VER +#pragma warning(disable:4505) +#endif + +namespace physx +{ +namespace Dy +{ + void PxcFsFlushVelocity(FeatherstoneArticulation& articulation, Cm::SpatialVectorF* deltaV, bool computeSpatialForces); + + //initialize spatial articualted matrix and coriolis spatial force + void FeatherstoneArticulation::initLinks(ArticulationData& data, + const PxVec3& /*gravity*/, ScratchData& scratchData, Cm::SpatialVectorF* Z, + Cm::SpatialVectorF* DeltaV) + { + PX_UNUSED(Z); + PX_UNUSED(DeltaV); + //compute individual link's spatial inertia tensor + //[0, M] + //[I, 0] + //computeSpatialInertia(data); + + //compute individual zero acceleration force + //computeZD(data, gravity, scratchData); + //compute corolis and centrifugal force + //computeC(data, scratchData); + + if (data.mLinkCount > 1) + { + Cm::SpatialVectorF* za = mArticulationData.getTransmittedForces(); + //copy individual zero acceleration force to mTempData zaForce buffer + //PxMemCopy(za, mArticulationData.getSpatialZAVectors(), sizeof(Cm::SpatialVectorF) * mArticulationData.getLinkCount()); + for (PxU32 linkID = 0; linkID < mArticulationData.getLinkCount(); ++linkID) + { + za[linkID] = mArticulationData.mZAForces[linkID] + mArticulationData.mZAInternalForces[linkID]; + } + } + + computeArticulatedSpatialInertiaAndZ(data, scratchData); + //computeArticulatedSpatialInertia(data); + //computeArticulatedSpatialZ(data, scratchData); + + computeArticulatedResponseMatrix(data); + + /*computeJointSpaceJacobians(data); + + computeJointSpaceDeltaV2(data);*/ + } + +#if (FEATHERSTONE_DEBUG && (PX_DEBUG || PX_CHECKED)) + static bool isSpatialVectorEqual(Cm::SpatialVectorF& t0, Cm::SpatialVectorF& t1) + { + float eps = 0.0001f; + bool e0 = PxAbs(t0.top.x - t1.top.x) < eps && + PxAbs(t0.top.y - t1.top.y) < eps && + PxAbs(t0.top.z - t1.top.z) < eps; + + bool e1 = PxAbs(t0.bottom.x - t1.bottom.x) < eps && + PxAbs(t0.bottom.y - t1.bottom.y) < eps && + PxAbs(t0.bottom.z - t1.bottom.z) < eps; + + return e0 && e1; + } + + static bool isSpatialVectorZero(Cm::SpatialVectorF& t0) + { + float eps = 0.000001f; + + const bool c0 = PxAbs(t0.top.x) < eps && PxAbs(t0.top.y) < eps && PxAbs(t0.top.z) < eps; + const bool c1 = PxAbs(t0.bottom.x) < eps && PxAbs(t0.bottom.y) < eps && PxAbs(t0.bottom.z) < eps; + + return c0 && c1; + } +#endif + + //calculate Is + void FeatherstoneArticulation::computeIs(ArticulationJointCoreData& jointDatum, ArticulationJointTargetData& /*jointTarget*/, + const PxU32 linkID) + { + Cm::SpatialVectorF* IsW = &mArticulationData.mIsW[jointDatum.jointOffset]; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + //const Cm::UnAlignedSpatialVector spatialArmature = mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind] * (1.f + jointTarget.armature[ind]); + //const Cm::UnAlignedSpatialVector tmp = mArticulationData.mWorldSpatialArticulatedInertia[linkID] * spatialArmature; + + const Cm::UnAlignedSpatialVector tmp = mArticulationData.mWorldSpatialArticulatedInertia[linkID] * mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind]; + //const Cm::UnAlignedSpatialVector arm = mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind] * jointTarget.armature[ind]; + IsW[ind].top = tmp.top;// +arm.bottom; + IsW[ind].bottom = tmp.bottom;// +arm.top; + } + } + +#if FEATHERSTONE_DEBUG + static inline PxMat33 Outer(const PxVec3& a, const PxVec3& b) + { + return PxMat33(a * b.x, a * b.y, a * b.z); + } +#endif + + SpatialMatrix FeatherstoneArticulation::computePropagateSpatialInertia_ZA_ZIc(const PxU8 jointType, const ArticulationJointTargetData& jointTarget, const ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxReal* jF, const Cm::SpatialVectorF& Z, const Cm::SpatialVectorF& ZIntIc, Cm::SpatialVectorF& ZA, Cm::SpatialVectorF& ZAInt, PxReal* qstZ, + PxReal* qstZIntIc) + { + SpatialMatrix spatialInertia; + + switch (jointType) + { + case PxArticulationJointType::ePRISMATIC: + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[0]; + +#if FEATHERSTONE_DEBUG + PxVec3 u = (jointType == PxArticulationJointType::ePRISMATIC) ? sa.bottom : sa.top; + + PxMat33 armatureV = Outer(u, u) * jointTarget.armature[0]; + + const PxReal armature = u.dot(armatureV * u); +#endif + + const Cm::SpatialVectorF& Is = linkIs[0]; + + const PxReal stIs = (sa.innerProduct(Is) + jointTarget.armature[0]); + + const PxReal iStIs = ((stIs > 0.f) ? (1.f / stIs) : 0.f); + + invStIs.invStIs[0][0] = iStIs; + + Cm::SpatialVectorF isID = Is * iStIs; + + isInvD[0] = isID; + + //(6x1)Is = [v0, v1]; (1x6)stI = [v1, v0] + //Cm::SpatialVector stI1(Is1.angular, Is1.linear); + Cm::SpatialVectorF stI(Is.bottom, Is.top); + + spatialInertia = SpatialMatrix::constructSpatialMatrix(isID, stI); + + const PxReal stZ = sa.innerProduct(Z); + const PxReal stZInt = sa.innerProduct(ZIntIc); + + //link.qstZIc[ind] = jF[ind] - stZ; + const PxReal qstZF32 = -stZ; + qstZ[0] = qstZF32; + + //Joint forces should be momentum preserving, so we add them to the biased system to maintain overall system momentum + const PxReal qstZF32Int = jF[0] - stZInt; + qstZIntIc[0] = qstZF32Int; + + ZA += isID * qstZF32; + + ZAInt += isID * qstZF32Int; + + break; + } + case PxArticulationJointType::eSPHERICAL: + { +#if FEATHERSTONE_DEBUG + //This is for debugging + Temp6x6Matrix bigInertia(articulatedInertia); + Temp6x3Matrix bigS(motionMatrix.getColumns()); + + Temp6x3Matrix bigIs = bigInertia * bigS; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF tempIs = bigInertia * motionMatrix[ind]; + + PX_ASSERT(isSpatialVectorEqual(tempIs, linkIs[ind])); + + PX_ASSERT(bigIs.isColumnEqual(ind, tempIs)); + + } +#endif + PxMat33 D(PxIdentity); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + +#if FEATHERSTONE_DEBUG + const Cm::UnAlignedSpatialVector& sa0 = motionMatrix[ind]; + const PxVec3 u = sa0.top; + PxMat33 armatureV = Outer(u, u) * jointTarget.armature[ind]; + PxVec3 armatureU = armatureV * u; +#endif + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind2]; + +#if FEATHERSTONE_DEBUG + const PxVec3 u1 = sa.top; + + const PxReal armature = u1.dot(armatureU); +#endif + + D[ind][ind2] = sa.innerProduct(linkIs[ind]); + } + D[ind][ind] += jointTarget.armature[ind]; + + } + + //PxMat33 invD = SpatialMatrix::invertSym33(D); + PxMat33 invD = D.getInverse(); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + invStIs.invStIs[ind][ind2] = invD[ind][ind2]; + } + } + +#if FEATHERSTONE_DEBUG + //debugging + Temp6x3Matrix bigIsInvD = bigIs * invD; +#endif + + Cm::SpatialVectorF columns[6]; + columns[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[1] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[2] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[3] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[4] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[5] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF isID(PxVec3(0.f), PxVec3(0.f)); + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + + const PxReal stZ = sa.innerProduct(Z); + const PxReal stZInt = sa.innerProduct(ZIntIc); + + //link.qstZIc[ind] = jF[ind] - stZ; + const PxReal localQstZ = - stZ; + const PxReal localQstZInt = jF[ind] -stZInt; + qstZ[ind] = localQstZ; + qstZIntIc[ind] = localQstZInt; + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::SpatialVectorF& Is = linkIs[ind2]; + isID += Is * invD[ind][ind2]; + } + columns[0] += isID * linkIs[ind].bottom.x; + columns[1] += isID * linkIs[ind].bottom.y; + columns[2] += isID * linkIs[ind].bottom.z; + columns[3] += isID * linkIs[ind].top.x; + columns[4] += isID * linkIs[ind].top.y; + columns[5] += isID * linkIs[ind].top.z; + isInvD[ind] = isID; + + ZA += isID * localQstZ; + ZAInt += isID * localQstZInt; + +#if FEATHERSTONE_DEBUG + const bool equal = bigIsInvD.isColumnEqual(ind, isInvD.isInvD[ind]); + PX_ASSERT(equal); +#endif + } + +#if FEATHERSTONE_DEBUG + Temp6x6Matrix transpose6x6 = bigInertia.getTranspose(); +#endif + + spatialInertia = SpatialMatrix::constructSpatialMatrix(columns); +#if FEATHERSTONE_DEBUG + Temp6x6Matrix result = bigIsInvD * stI; + PX_ASSERT(result.isEqual(columns)); +#endif + break; + } + default: + return articulatedInertia; + } + + //(I - Is*Inv(sIs)*sI) + spatialInertia = articulatedInertia - spatialInertia; + + return spatialInertia; + } + + + SpatialMatrix FeatherstoneArticulation::computePropagateSpatialInertia_ZA_ZIc_NonSeparated(const PxU8 jointType, const ArticulationJointTargetData& jointTarget, const ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxReal* jF, const Cm::SpatialVectorF& Z, Cm::SpatialVectorF& ZA, PxReal* qstZIc) + { + SpatialMatrix spatialInertia; + + switch (jointType) + { + case PxArticulationJointType::ePRISMATIC: + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[0]; + +#if FEATHERSTONE_DEBUG + PxVec3 u = (jointType == PxArticulationJointType::ePRISMATIC) ? sa.bottom : sa.top; + + PxMat33 armatureV = Outer(u, u) * jointTarget.armature[0]; + + const PxReal armature = u.dot(armatureV * u); +#endif + + const Cm::SpatialVectorF& Is = linkIs[0]; + + const PxReal stIs = (sa.innerProduct(Is) + jointTarget.armature[0]); + + const PxReal iStIs = (stIs > 1e-10f) ? (1.f / stIs) : 0.f; + + invStIs.invStIs[0][0] = iStIs; + + Cm::SpatialVectorF isID = Is * iStIs; + + isInvD[0] = isID; + + //(6x1)Is = [v0, v1]; (1x6)stI = [v1, v0] + //Cm::SpatialVector stI1(Is1.angular, Is1.linear); + Cm::SpatialVectorF stI(Is.bottom, Is.top); + + spatialInertia = SpatialMatrix::constructSpatialMatrix(isID, stI); + + const PxReal stZ = sa.innerProduct(Z); + + //link.qstZIc[ind] = jF[ind] - stZ; + const PxReal qstZIcF32 = jF[0] - stZ; + qstZIc[0] = qstZIcF32; + + ZA += isID * qstZIcF32; + + break; + } + case PxArticulationJointType::eSPHERICAL: + { +#if FEATHERSTONE_DEBUG + //This is for debugging + Temp6x6Matrix bigInertia(articulatedInertia); + Temp6x3Matrix bigS(motionMatrix.getColumns()); + + Temp6x3Matrix bigIs = bigInertia * bigS; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF tempIs = bigInertia * motionMatrix[ind]; + + PX_ASSERT(isSpatialVectorEqual(tempIs, linkIs[ind])); + + PX_ASSERT(bigIs.isColumnEqual(ind, tempIs)); + + } +#endif + PxMat33 D(PxIdentity); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + +#if FEATHERSTONE_DEBUG + const Cm::UnAlignedSpatialVector& sa0 = motionMatrix[ind]; + const PxVec3 u = sa0.top; + PxMat33 armatureV = Outer(u, u) * jointTarget.armature[ind]; + PxVec3 armatureU = armatureV * u; +#endif + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind2]; + +#if FEATHERSTONE_DEBUG + const PxVec3 u1 = sa.top; + + const PxReal armature = u1.dot(armatureU); +#endif + + D[ind][ind2] = sa.innerProduct(linkIs[ind]); + } + D[ind][ind] += jointTarget.armature[ind]; + //D[ind][ind] *= 10.f; + } + + PxMat33 invD = SpatialMatrix::invertSym33(D); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + invStIs.invStIs[ind][ind2] = invD[ind][ind2]; + + } + } + +#if FEATHERSTONE_DEBUG + //debugging + Temp6x3Matrix bigIsInvD = bigIs * invD; +#endif + + Cm::SpatialVectorF columns[6]; + columns[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[1] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[2] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[3] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[4] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[5] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF isID(PxVec3(0.f), PxVec3(0.f)); + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind]; + + const PxReal stZ = sa.innerProduct(Z); + + //link.qstZIc[ind] = jF[ind] - stZ; + const PxReal localQstZ = jF[ind] - stZ; + qstZIc[ind] = localQstZ; + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::SpatialVectorF& Is = linkIs[ind2]; + isID += Is * invD[ind][ind2]; + } + columns[0] += isID * linkIs[ind].bottom.x; + columns[1] += isID * linkIs[ind].bottom.y; + columns[2] += isID * linkIs[ind].bottom.z; + columns[3] += isID * linkIs[ind].top.x; + columns[4] += isID * linkIs[ind].top.y; + columns[5] += isID * linkIs[ind].top.z; + isInvD[ind] = isID; + + ZA += isID * localQstZ; + +#if FEATHERSTONE_DEBUG + const bool equal = bigIsInvD.isColumnEqual(ind, isInvD.isInvD[ind]); + PX_ASSERT(equal); +#endif + } + +#if FEATHERSTONE_DEBUG + Temp6x6Matrix transpose6x6 = bigInertia.getTranspose(); +#endif + + spatialInertia = SpatialMatrix::constructSpatialMatrix(columns); +#if FEATHERSTONE_DEBUG + Temp6x6Matrix result = bigIsInvD * stI; + PX_ASSERT(result.isEqual(columns)); +#endif + break; + } + default: + spatialInertia.setZero(); + break; + } + + //(I - Is*Inv(sIs)*sI) + spatialInertia = articulatedInertia - spatialInertia; + + return spatialInertia; + } + + + SpatialMatrix FeatherstoneArticulation::computePropagateSpatialInertia(const PxU8 jointType, ArticulationJointCoreData& jointDatum, + const SpatialMatrix& articulatedInertia, const Cm::SpatialVectorF* linkIs, InvStIs& invStIs, Cm::SpatialVectorF* isInvD, const Cm::UnAlignedSpatialVector* motionMatrix) + { + SpatialMatrix spatialInertia; + + switch (jointType) + { + case PxArticulationJointType::ePRISMATIC: + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[0]; + + const Cm::SpatialVectorF& Is = linkIs[0]; + + const PxReal stIs = sa.innerProduct(Is); + + const PxReal iStIs = (stIs > 1e-10f) ? (1.f / stIs) : 0.f; + + invStIs.invStIs[0][0] = iStIs; + + Cm::SpatialVectorF isID = Is * iStIs; + + isInvD[0] = isID; + + //(6x1)Is = [v0, v1]; (1x6)stI = [v1, v0] + //Cm::SpatialVector stI1(Is1.angular, Is1.linear); + Cm::SpatialVectorF stI(Is.bottom, Is.top); + + spatialInertia = SpatialMatrix::constructSpatialMatrix(isID, stI); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { +#if FEATHERSTONE_DEBUG + //This is for debugging + Temp6x6Matrix bigInertia(articulatedInertia); + Temp6x3Matrix bigS(motionMatrix.getColumns()); + + Temp6x3Matrix bigIs = bigInertia * bigS; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF tempIs = bigInertia * motionMatrix[ind]; + + PX_ASSERT(isSpatialVectorEqual(tempIs, linkIs[ind])); + + PX_ASSERT(bigIs.isColumnEqual(ind, tempIs)); + + } +#endif + PxMat33 D(PxIdentity); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::UnAlignedSpatialVector& sa = motionMatrix[ind2]; + D[ind][ind2] = sa.innerProduct(linkIs[ind]); + } + } + + PxMat33 invD = SpatialMatrix::invertSym33(D); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + invStIs.invStIs[ind][ind2] = invD[ind][ind2]; + + } + } + +#if FEATHERSTONE_DEBUG + //debugging + Temp6x3Matrix bigIsInvD = bigIs * invD; +#endif + + Cm::SpatialVectorF columns[6]; + columns[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[1] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[2] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[3] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[4] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + columns[5] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::SpatialVectorF isID(PxVec3(0.f), PxVec3(0.f)); + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const Cm::SpatialVectorF& Is = linkIs[ind2]; + isID += Is * invD[ind][ind2]; + } + columns[0] += isID * linkIs[ind].bottom.x; + columns[1] += isID * linkIs[ind].bottom.y; + columns[2] += isID * linkIs[ind].bottom.z; + columns[3] += isID * linkIs[ind].top.x; + columns[4] += isID * linkIs[ind].top.y; + columns[5] += isID * linkIs[ind].top.z; + isInvD[ind] = isID; + +#if FEATHERSTONE_DEBUG + const bool equal = bigIsInvD.isColumnEqual(ind, isInvD.isInvD[ind]); + PX_ASSERT(equal); +#endif + } + +#if FEATHERSTONE_DEBUG + Temp6x6Matrix transpose6x6 = bigInertia.getTranspose(); +#endif + + spatialInertia = SpatialMatrix::constructSpatialMatrix(columns); +#if FEATHERSTONE_DEBUG + Temp6x6Matrix result = bigIsInvD * stI; + PX_ASSERT(result.isEqual(columns)); +#endif + break; + } + default: + spatialInertia.setZero(); + break; + } + + //(I - Is*Inv(sIs)*sI) + spatialInertia = articulatedInertia - spatialInertia; + + return spatialInertia; + } + + void FeatherstoneArticulation::computeArticulatedSpatialInertiaAndZ(ArticulationData& data, ScratchData& scratchData) + { + ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + ArticulationJointTargetData* jointTargetData = data.getJointTranData(); + const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = PxU32(linkCount - 1); + + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + Cm::SpatialVectorF* articulatedZA = scratchData.spatialZAVectors; + Cm::SpatialVectorF* articulatedZAInt = data.mZAInternalForces.begin(); + + PxReal* jointForces = scratchData.jointForces; + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = jointData[linkID]; + ArticulationJointTargetData& jointTarget = jointTargetData[linkID]; + computeIs(jointDatum, jointTarget, linkID); + + //calculate spatial zero acceleration force, this can move out of the loop + Cm::SpatialVectorF Ic = data.mWorldSpatialArticulatedInertia[linkID] * coriolisVectors[linkID]; + Cm::SpatialVectorF Z = articulatedZA[linkID];// + Ic; + Cm::SpatialVectorF ZIntIc = articulatedZAInt[linkID] + Ic; + + const PxReal* jF = &jointForces[jointDatum.jointOffset]; + + Cm::SpatialVectorF ZA = Z; + Cm::SpatialVectorF ZAIntIc = ZIntIc; + + //(I - Is*Inv(sIs)*sI) + //KS - we also bury Articulated ZA force and ZIc force computation in here because that saves + //us some round-trips to memory! + SpatialMatrix spatialInertiaW = computePropagateSpatialInertia_ZA_ZIc(link.inboundJoint->jointType, jointTarget, + jointDatum, data.mWorldSpatialArticulatedInertia[linkID], &data.mIsW[jointDatum.jointOffset], data.mInvStIs[linkID], &data.mIsInvDW[jointDatum.jointOffset], + &data.mWorldMotionMatrix[jointDatum.jointOffset], jF, Z, ZIntIc, ZA, ZAIntIc, &data.qstZIc[jointDatum.jointOffset], &data.qstZIntIc[jointDatum.jointOffset]); + + //transform spatial inertia into parent space + FeatherstoneArticulation::translateInertia(constructSkewSymmetricMatrix(data.getRw(linkID)), spatialInertiaW); + + const PxReal minPropagatedInertia = 0.f; + + // Make sure we do not propagate up negative inertias around the principal inertial axes + // due to numerical rounding errors + spatialInertiaW.bottomLeft.column0.x = PxMax(minPropagatedInertia, spatialInertiaW.bottomLeft.column0.x); + spatialInertiaW.bottomLeft.column1.y = PxMax(minPropagatedInertia, spatialInertiaW.bottomLeft.column1.y); + spatialInertiaW.bottomLeft.column2.z = PxMax(minPropagatedInertia, spatialInertiaW.bottomLeft.column2.z); + + data.mWorldSpatialArticulatedInertia[link.parent] += spatialInertiaW; + + Cm::SpatialVectorF translatedZA = FeatherstoneArticulation::translateSpatialVector(data.getRw(linkID), ZA); + Cm::SpatialVectorF translatedZAInt = FeatherstoneArticulation::translateSpatialVector(data.getRw(linkID), ZAIntIc); + articulatedZA[link.parent] += translatedZA; + articulatedZAInt[link.parent] += translatedZAInt; + } + + //cache base link inverse spatial inertia + data.mWorldSpatialArticulatedInertia[0].invertInertiaV(data.mBaseInvSpatialArticulatedInertiaW); + } + + void FeatherstoneArticulation::computeArticulatedSpatialInertiaAndZ_NonSeparated(ArticulationData& data, ScratchData& scratchData) + { + ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + ArticulationJointTargetData* jointTargetData = data.getJointTranData(); + const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = PxU32(linkCount - 1); + + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + Cm::SpatialVectorF* articulatedZA = scratchData.spatialZAVectors; + + PxReal* jointForces = scratchData.jointForces; + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = jointData[linkID]; + ArticulationJointTargetData& jointTarget = jointTargetData[linkID]; + computeIs(jointDatum, jointTarget, linkID); + + //calculate spatial zero acceleration force, this can move out of the loop + Cm::SpatialVectorF Ic = data.mWorldSpatialArticulatedInertia[linkID] * coriolisVectors[linkID]; + Cm::SpatialVectorF Z = articulatedZA[linkID] + Ic; + + const PxReal* jF = &jointForces[jointDatum.jointOffset]; + + Cm::SpatialVectorF ZA = Z; + + //(I - Is*Inv(sIs)*sI) + //KS - we also bury Articulated ZA force and ZIc force computation in here because that saves + //us some round-trips to memory! + SpatialMatrix spatialInertiaW = computePropagateSpatialInertia_ZA_ZIc_NonSeparated(link.inboundJoint->jointType, jointTarget, + jointDatum, data.mWorldSpatialArticulatedInertia[linkID], &data.mIsW[jointDatum.jointOffset], data.mInvStIs[linkID], &data.mIsInvDW[jointDatum.jointOffset], + &data.mWorldMotionMatrix[jointDatum.jointOffset], jF, Z, ZA, &data.qstZIc[jointDatum.jointOffset]); + + //transform spatial inertia into parent space + FeatherstoneArticulation::translateInertia(constructSkewSymmetricMatrix(data.getRw(linkID)), spatialInertiaW); + + data.mWorldSpatialArticulatedInertia[link.parent] += spatialInertiaW; + + Cm::SpatialVectorF translatedZA = FeatherstoneArticulation::translateSpatialVector(data.getRw(linkID), ZA); + articulatedZA[link.parent] += translatedZA; + } + + //cache base link inverse spatial inertia + data.mWorldSpatialArticulatedInertia[0].invertInertiaV(data.mBaseInvSpatialArticulatedInertiaW); + } + + + void FeatherstoneArticulation::computeArticulatedSpatialInertia(ArticulationData& data) + { + ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + ArticulationJointTargetData* jointTargetData = data.getJointTranData(); + const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = PxU32(linkCount - 1); + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = jointData[linkID]; + ArticulationJointTargetData& jointTarget = jointTargetData[linkID]; + computeIs(jointDatum, jointTarget, linkID); + + //(I - Is*Inv(sIs)*sI) + //KS - we also bury Articulated ZA force and ZIc force computation in here because that saves + //us some round-trips to memory! + SpatialMatrix spatialInertiaW = computePropagateSpatialInertia(link.inboundJoint->jointType, + jointDatum, data.mWorldSpatialArticulatedInertia[linkID], &data.mIsW[jointDatum.jointOffset], data.mInvStIs[linkID], &data.mIsInvDW[jointDatum.jointOffset], + &data.mWorldMotionMatrix[jointDatum.jointOffset]); + + //transform spatial inertia into parent space + FeatherstoneArticulation::translateInertia(constructSkewSymmetricMatrix(data.getRw(linkID)), spatialInertiaW); + + data.mWorldSpatialArticulatedInertia[link.parent] += spatialInertiaW; + } + + //cache base link inverse spatial inertia + data.mWorldSpatialArticulatedInertia[0].invertInertiaV(data.mBaseInvSpatialArticulatedInertiaW); + } + + void FeatherstoneArticulation::computeArticulatedResponseMatrix(ArticulationData& data) + { + //PX_PROFILE_ZONE("ComputeResponseMatrix", 0); + + //We can work out impulse response vectors by propagating an impulse to the root link, then back down to the child link using existing data. + //Alternatively, we can compute an impulse response matrix, which is a vector of 6x6 matrices, which can be multiplied by the impulse vector to + //compute the response. This can be stored in world space, saving transforms. It can also be computed incrementally, meaning it should not be + //dramatically more expensive than propagating the impulse for a single constraint. Furthermore, this will allow us to rapidly compute the + //impulse response with the TGS solver allowing us to improve quality of equality positional constraints by properly reflecting non-linear motion + //of the articulation rather than approximating it with linear projections. + + //The input expected is a local-space impulse and the output is a local-space impulse response vector + + ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + //(1) impulse response vector for root link + SpatialImpulseResponseMatrix* responsesW = data.getImpulseResponseMatrixWorld(); + + if (fixBase) + { + //Fixed base, so response is zero + PxMemZero(responsesW, sizeof(SpatialImpulseResponseMatrix)); + } + else + { + //Compute impulse response matrix. Compute the impulse response of unit responses on all 6 axes... + const SpatialMatrix& inverseArticulatedInertiaW = data.mBaseInvSpatialArticulatedInertiaW; + + PxMat33 bottomRight = inverseArticulatedInertiaW.getBottomRight(); + + + responsesW[0].rows[0] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topLeft.column0, inverseArticulatedInertiaW.bottomLeft.column0); + responsesW[0].rows[1] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topLeft.column1, inverseArticulatedInertiaW.bottomLeft.column1); + responsesW[0].rows[2] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topLeft.column2, inverseArticulatedInertiaW.bottomLeft.column2); + responsesW[0].rows[3] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topRight.column0, bottomRight.column0); + responsesW[0].rows[4] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topRight.column1, bottomRight.column1); + responsesW[0].rows[5] = Cm::SpatialVectorF(inverseArticulatedInertiaW.topRight.column2, bottomRight.column2); + + links[0].cfm *= PxMax(responsesW[0].rows[0].bottom.x, PxMax(responsesW[0].rows[1].bottom.y, responsesW[0].rows[2].bottom.z)); + } + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + PxVec3 offset = data.getRw(linkID); + const PxU32 jointOffset = data.getJointData(linkID).jointOffset; + const PxU32 dofCount = data.getJointData(linkID).dof; + + for (PxU32 i = 0; i < 6; ++i) + { + //Impulse has to be negated! + Cm::SpatialVectorF vec = Cm::SpatialVectorF::Zero(); + vec[i] = 1.f; + + Cm::SpatialVectorF temp = -vec; + + ArticulationLink& tLink = links[linkID]; + //(1) Propagate impulse to parent + PxReal qstZ[3] = { 0.f, 0.f, 0.f }; + Cm::SpatialVectorF Zp = FeatherstoneArticulation::propagateImpulseW(&data.mIsInvDW[jointOffset], offset, + &data.mWorldMotionMatrix[jointOffset], temp, dofCount, qstZ); //(2) Get deltaV response for parent + Cm::SpatialVectorF zR = -responsesW[tLink.parent].getResponse(Zp); + + const Cm::SpatialVectorF deltaV = propagateAccelerationW(offset, data.mInvStIs[linkID], + &data.mWorldMotionMatrix[jointOffset], zR, dofCount, &data.mIsW[jointOffset], qstZ); + + //Store in local space (required for propagation + responsesW[linkID].rows[i] = deltaV; + } + + links[linkID].cfm *= PxMax(responsesW[linkID].rows[0].bottom.x, PxMax(responsesW[linkID].rows[1].bottom.y, responsesW[linkID].rows[2].bottom.z)); + } + } + + void FeatherstoneArticulation::computeArticulatedSpatialZ(ArticulationData& data, ScratchData& scratchData) + { + ArticulationLink* links = data.getLinks(); + ArticulationJointCoreData* jointData = data.getJointData(); + + const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = PxU32(linkCount - 1); + + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + Cm::SpatialVectorF* articulatedZA = scratchData.spatialZAVectors; + + PxReal* jointForces = scratchData.jointForces; + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = jointData[linkID]; + + //calculate spatial zero acceleration force, this can move out of the loop + Cm::SpatialVectorF Ic = data.mWorldSpatialArticulatedInertia[linkID] * coriolisVectors[linkID]; + Cm::SpatialVectorF ZIc = articulatedZA[linkID] + Ic; + + const PxReal* jF = &jointForces[jointDatum.jointOffset]; + + Cm::SpatialVectorF ZA = ZIc; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = data.mWorldMotionMatrix[jointDatum.jointOffset + ind]; + const PxReal stZ = sa.innerProduct(ZIc); + + //link.qstZIc[ind] = jF[ind] - stZ; + const PxReal qstZic = jF[ind] - stZ; + data.qstZIc[jointDatum.jointOffset + ind] = qstZic; + PX_ASSERT(PxIsFinite(qstZic)); + + ZA += data.mIsInvDW[jointDatum.jointOffset + ind] * qstZic; + } + //accumulate childen's articulated zero acceleration force to parent's articulated zero acceleration + articulatedZA[link.parent] += FeatherstoneArticulation::translateSpatialVector(data.getRw(linkID), ZA); + } + } + + void FeatherstoneArticulation::computeJointSpaceJacobians(ArticulationData& data) + { + //PX_PROFILE_ZONE("computeJointSpaceJacobians", 0); + const PxU32 linkCount = data.getLinkCount(); + const PxU32 dofCount = data.getDofs(); + + PxTransform* trans = data.getAccumulatedPoses(); + + Cm::SpatialVectorF* jointSpaceJacobians = data.getJointSpaceJacobians(); + Dy::ArticulationLink* links = data.mLinks; + Dy::ArticulationJointCoreData* jointData = data.mJointData; + Cm::UnAlignedSpatialVector* worldMotionMatrix = data.mWorldMotionMatrix.begin(); + + for (PxU32 linkID = 1; linkID < linkCount; linkID++) + { + const PxTransform pose = trans[linkID]; + Cm::SpatialVectorF* myJacobian = &jointSpaceJacobians[linkID*dofCount]; + + const PxU32 lastDof = jointData[linkID].jointOffset + jointData[linkID].dof; + + PxMemZero(myJacobian, sizeof(Cm::SpatialVectorF)*lastDof); + + PxU32 link = linkID; + + while (link != 0) + { + PxU32 parent = links[link].parent; + const Dy::ArticulationJointCoreData& jData = jointData[link]; + const PxTransform parentPose = trans[link]; + + PxVec3 rw = parentPose.p - pose.p; + + const PxU32 jointOffset = jData.jointOffset; + const PxU32 dofs = jData.dof; + + Cm::UnAlignedSpatialVector* motionMatrix = &worldMotionMatrix[jointOffset]; + + for (PxU32 i = 0; i < dofs; ++i) + { + myJacobian[jointOffset + i].top = motionMatrix[i].top; + myJacobian[jointOffset + i].bottom = motionMatrix[i].bottom + rw.cross(motionMatrix[i].top); + } + + link = parent; + } + +#if 0 + //Verify the jacobian... + + Cm::SpatialVectorF velocity = FeatherstoneArticulation::translateSpatialVector((trans[0].p - trans[linkID].p), data.mMotionVelocities[0]); + PxReal* jointVelocity = data.getJointVelocities(); + + //KS - a bunch of these dofs can be skipped, we just need to follow path-to-root. However, that may be more expensive than + //just doing the full multiplication. Let's see how expensive it is now... + for (PxU32 i = 0; i < lastDof; ++i) + { + velocity += myJacobian[i] * jointVelocity[i]; + } + + int bob = 0; + PX_UNUSED(bob); +#endif + } + + } + + void FeatherstoneArticulation::computeJointAccelerationW(ArticulationJointCoreData& jointDatum, + const Cm::SpatialVectorF& pMotionAcceleration, PxReal* jointAcceleration, const Cm::SpatialVectorF* IsW, const PxU32 linkID, + const PxReal* qstZIc) + { + PxReal tJAccel[6]; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + //stI * pAcceleration + const PxReal temp = IsW[ind].innerProduct(pMotionAcceleration); + + tJAccel[ind] = (qstZIc[ind] - temp); + } + + //calculate jointAcceleration + + const InvStIs& invStIs = mArticulationData.mInvStIs[linkID]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + jointAcceleration[ind] = 0.f; + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + jointAcceleration[ind] += invStIs.invStIs[ind2][ind] * tJAccel[ind2]; + } + //PX_ASSERT(PxAbs(jointAcceleration[ind]) < 5000); + } + } + + void FeatherstoneArticulation::computeLinkAcceleration(ArticulationData& data, ScratchData& scratchData, bool doIC) + { + const PxU32 linkCount = data.getLinkCount(); + const PxReal dt = data.getDt(); + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //we have initialized motionVelocity and motionAcceleration to be zero in the root link if + //fix based flag is raised + Cm::SpatialVectorF* motionVelocities = scratchData.motionVelocities; + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + Cm::SpatialVectorF* coriolis = scratchData.coriolisVectors; + + PxMemZero(data.mSolverSpatialForces.begin(), data.mSolverSpatialForces.size() * sizeof(Cm::SpatialVectorF)); + + if (!fixBase) + { + //ArticulationLinkData& baseLinkDatum = data.getLinkData(0); + SpatialMatrix invInertia = data.mBaseInvSpatialArticulatedInertiaW;//baseLinkDatum.spatialArticulatedInertia.invertInertia(); + +#if FEATHERSTONE_DEBUG + SpatialMatrix result = invInertia * baseLinkDatum.spatialArticulatedInertia; + + bool isIdentity = result.isIdentity(); + + PX_ASSERT(isIdentity); + PX_UNUSED(isIdentity); +#endif + //ArticulationLink& baseLink = data.getLink(0); + //const PxTransform& body2World = baseLink.bodyCore->body2World; + Cm::SpatialVectorF accel = -(invInertia * spatialZAForces[0]); + motionAccelerations[0] = accel; + Cm::SpatialVectorF deltaV = accel * dt; + motionVelocities[0] += deltaV; + } +#if FEATHERSTONE_DEBUG + else + { + PX_ASSERT(isSpatialVectorZero(motionAccelerations[0])); + PX_ASSERT(isSpatialVectorZero(motionVelocities[0])); + } +#endif + + /*PxReal* jointAccelerations = data.getJointAccelerations(); + PxReal* jointVelocities = data.getJointVelocities(); + PxReal* jointPositions = data.getJointPositions();*/ + + PxReal* jointAccelerations = scratchData.jointAccelerations; + PxReal* jointVelocities = scratchData.jointVelocities; + PxReal* jointNewVelocities = mArticulationData.mJointNewVelocity.begin(); + + //printf("===========================\n"); + + //calculate acceleration + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + ArticulationJointCore& joint = *link.inboundJoint; + PX_UNUSED(joint); + + Cm::SpatialVectorF pMotionAcceleration = FeatherstoneArticulation::translateSpatialVector(-data.getRw(linkID), motionAccelerations[link.parent]); + + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + + //calculate jointAcceleration + PxReal* jA = &jointAccelerations[jointDatum.jointOffset]; + computeJointAccelerationW(jointDatum, pMotionAcceleration, jA, &data.mIsW[jointDatum.jointOffset], linkID, + &data.qstZIc[jointDatum.jointOffset]); + //printf("jA %f\n", jA[0]); + + Cm::SpatialVectorF motionAcceleration = pMotionAcceleration; + if (doIC) + motionAcceleration += coriolis[linkID]; + PxReal* jointVelocity = &jointVelocities[jointDatum.jointOffset]; + PxReal* jointNewVelocity = &jointNewVelocities[jointDatum.jointOffset]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + const PxReal accel = jA[ind]; + PxReal jVel = jointVelocity[ind] + accel * dt; + jointVelocity[ind] = jVel; + jointNewVelocity[ind] = jVel; + motionAcceleration.top += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * accel; + motionAcceleration.bottom += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * accel; + } + + //KS - can we just work out velocities by projecting out the joint velocities instead of accumulating all this? + motionAccelerations[linkID] = motionAcceleration; + PX_ASSERT(motionAccelerations[linkID].isFinite()); + motionVelocities[linkID] += motionAcceleration * dt; + + /*Cm::SpatialVectorF spatialForce = mArticulationData.mWorldSpatialArticulatedInertia[linkID] * motionAcceleration; + + Cm::SpatialVectorF zaForce = -spatialZAForces[linkID]; + + int bob = 0; + PX_UNUSED(bob);*/ + } + } + + + void FeatherstoneArticulation::computeLinkInternalAcceleration(ArticulationData& data, ScratchData& scratchData) + { + + const PxU32 linkCount = data.getLinkCount(); + const PxReal dt = data.getDt(); + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //we have initialized motionVelocity and motionAcceleration to be zero in the root link if + //fix based flag is raised + Cm::SpatialVectorF* motionVelocities = scratchData.motionVelocities; + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + Cm::SpatialVectorF* spatialZAInternalForces = data.mZAInternalForces.begin(); + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + + Cm::SpatialVectorF* motionAccelerationInt = data.mMotionAccelerationsInternal.begin(); + + Cm::SpatialVectorF momentum0(PxVec3(0.f), PxVec3(0.f)); + + PxVec3 COM = data.mCOM; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const Cm::SpatialVectorF& vel = motionVelocities[linkID]; + PxReal mass = data.mMasses[linkID]; + momentum0.top += vel.bottom*mass; + } + + PxVec3 rootVel = momentum0.top * data.mInvSumMass; + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + const Cm::SpatialVectorF& vel = motionVelocities[linkID]; + const PxVec3 offsetMass = (data.getAccumulatedPoses()[linkID].p - COM)*mass; + + const PxVec3 angMom = data.mWorldIsolatedSpatialArticulatedInertia[linkID] * vel.top + offsetMass.cross(motionVelocities[linkID].bottom - rootVel); + momentum0.bottom += angMom; + } + + PxReal sumInvMass = data.mInvSumMass; + + if (!fixBase) + { + //ArticulationLinkData& baseLinkDatum = data.getLinkData(0); + SpatialMatrix invInertia = data.mBaseInvSpatialArticulatedInertiaW;//baseLinkDatum.spatialArticulatedInertia.invertInertia(); + +#if FEATHERSTONE_DEBUG + SpatialMatrix result = invInertia * baseLinkDatum.spatialArticulatedInertia; + + bool isIdentity = result.isIdentity(); + + PX_ASSERT(isIdentity); + PX_UNUSED(isIdentity); +#endif + //ArticulationLink& baseLink = data.getLink(0); + //const PxTransform& body2World = baseLink.bodyCore->body2World; + Cm::SpatialVectorF accel = -(invInertia * spatialZAInternalForces[0]); + motionAccelerationInt[0] = accel; + motionAccelerations[0] += accel; + Cm::SpatialVectorF deltaV = accel * dt; + + motionVelocities[0] += deltaV; + } + else + { + motionAccelerationInt[0] = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + } + + PxReal* jointAccelerations = scratchData.jointAccelerations; + PxReal* jointInternalAccelerations = mArticulationData.mJointInternalAcceleration.begin(); + PxReal* jointVelocities = scratchData.jointVelocities; + PxReal* jointNewVelocities = mArticulationData.mJointNewVelocity.begin(); + + //printf("===========================\n"); + + //calculate acceleration + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + ArticulationJointCore& joint = *link.inboundJoint; + PX_UNUSED(joint); + + Cm::SpatialVectorF pMotionAcceleration = FeatherstoneArticulation::translateSpatialVector(-data.getRw(linkID), motionAccelerationInt[link.parent]); + + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + + //calculate jointAcceleration + PxReal* jA = &jointAccelerations[jointDatum.jointOffset]; + PxReal* jIntAccel = &jointInternalAccelerations[jointDatum.jointOffset]; + computeJointAccelerationW(jointDatum, pMotionAcceleration, jIntAccel, &data.mIsW[jointDatum.jointOffset], linkID, + &data.qstZIntIc[jointDatum.jointOffset]); + //printf("jA %f\n", jA[0]); + + //KS - TODO - separate integration of coriolis vectors! + Cm::SpatialVectorF motionAcceleration = pMotionAcceleration + coriolisVectors[linkID]; + PxReal* jointVelocity = &jointVelocities[jointDatum.jointOffset]; + PxReal* jointNewVelocity = &jointNewVelocities[jointDatum.jointOffset]; + + Cm::SpatialVectorF mVel = FeatherstoneArticulation::translateSpatialVector(-data.getRw(linkID), motionVelocities[link.parent]); + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + const PxReal accel = jIntAccel[ind]; + PxReal jVel = jointVelocity[ind] + accel * dt; + jointVelocity[ind] = jVel; + jointNewVelocity[ind] = jVel; + motionAcceleration.top += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * accel; + motionAcceleration.bottom += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * accel; + + mVel.top += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * jVel; + mVel.bottom += data.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * jVel; + + jA[ind] += accel; + } + + //KS - can we just work out velocities by projecting out the joint velocities instead of accumulating all this? + motionAccelerationInt[linkID] = motionAcceleration; + motionAccelerations[linkID] += motionAcceleration; + PX_ASSERT(motionAccelerations[linkID].isFinite()); + Cm::SpatialVectorF velDelta = (motionAcceleration)* dt; + motionVelocities[linkID] += velDelta; + } + + + + if (!fixBase) + { + + PxVec3 angMomentum1(0.f); + PxMat33 inertia(PxZero); + + PxVec3 sumLinMomentum(0.f); + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + sumLinMomentum += motionVelocities[linkID].bottom * mass; + } + + rootVel = sumLinMomentum * sumInvMass; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + const PxVec3 offset = data.getAccumulatedPoses()[linkID].p - COM; + inertia += translateInertia(data.mWorldIsolatedSpatialArticulatedInertia[linkID], mass, offset); + + angMomentum1 += data.mWorldIsolatedSpatialArticulatedInertia[linkID] * motionVelocities[linkID].top + + offset.cross(motionVelocities[linkID].bottom - rootVel) * mass; + } + + PxMat33 invCompoundInertia = inertia.getInverse(); + + PxReal denom0 = angMomentum1.magnitude(); + PxReal num = momentum0.bottom.magnitude(); + PxReal angRatio = denom0 == 0.f ? 1.f : num / denom0; + + PxVec3 deltaAngMom = angMomentum1 * (angRatio - 1.f); + + PxVec3 deltaAng = invCompoundInertia * deltaAngMom; + + if (mSolverDesc.core) + { + const PxReal maxAng = mSolverDesc.core->maxAngularVelocity; + const PxReal maxAngSq = maxAng * maxAng; + PxVec3 ang = (invCompoundInertia * angMomentum1) + deltaAng; + if (ang.magnitudeSquared() > maxAngSq) + { + PxReal ratio = maxAng / ang.magnitude(); + deltaAng += (ratio - 1.f)*ang; + } + } + + +#if 1 + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const PxVec3 offset = (data.getAccumulatedPoses()[linkID].p - COM); + Cm::SpatialVectorF velChange(deltaAng, -offset.cross(deltaAng)); + motionVelocities[linkID] += velChange; + PxReal mass = data.mMasses[linkID]; + sumLinMomentum += velChange.bottom * mass; + } +#else + motionVelocities[0].top += deltaAng; + motionAccelerations[0] = Cm::SpatialVectorF(deltaAng, PxVec3(0.f)); + //sumLinMomentum = motionVelocities[0].bottom * data.mMasses[0]; + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + Cm::SpatialVectorF velChange = Dy::FeatherstoneArticulation::translateSpatialVector(-data.getRw(linkID), motionAccelerations[data.getLink(linkID).parent]); + motionVelocities[linkID] += velChange; + motionAccelerations[linkID] = velChange; + + PxReal mass = data.mMasses[linkID]; + //sumLinMomentum += motionVelocities[linkID].bottom * mass; + sumLinMomentum += velChange.bottom * mass; + } +#endif + +#if 0 + PxReal denom1 = sumLinMomentum.magnitude(); + PxReal linRatio = PxMin(10.f, denom1 == 0.f ? 1.f : momentum0.top.magnitude() / denom1); + + PxVec3 deltaLinMom = sumLinMomentum * (linRatio - 1.f); + + +#else + PxVec3 deltaLinMom = momentum0.top - sumLinMomentum; +#endif + PxVec3 deltaLin = deltaLinMom * sumInvMass; + + if (mSolverDesc.core) + { + const PxReal maxLin = mSolverDesc.core->maxLinearVelocity; + const PxReal maxLinSq = maxLin * maxLin; + PxVec3 lin = (sumLinMomentum * sumInvMass) + deltaLin; + if (lin.magnitudeSquared() > maxLinSq) + { + PxReal ratio = maxLin / lin.magnitude(); + deltaLin += (ratio - 1.f)*lin; + } + } + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + motionVelocities[linkID].bottom += deltaLin; + } + +#if PX_DEBUG && 0 + + const bool validateMomentum = false; + if (validateMomentum) + { + + Cm::SpatialVectorF momentum2(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const PxReal mass = data.mMasses[linkID]; + momentum2.top += motionVelocities[linkID].bottom * mass; + } + rootVel = momentum2.top * sumInvMass; + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const PxReal mass = data.mMasses[linkID]; + const PxVec3 angMom = data.mWorldIsolatedSpatialArticulatedInertia[linkID] * motionVelocities[linkID].top + + (data.getAccumulatedPoses()[linkID].p - COM).cross(motionVelocities[linkID].bottom - rootVel) * mass; + momentum2.bottom += angMom; + } + + static PxU32 count = 0; + count++; + + printf("LinMom0 = %f, LinMom1 = %f, LinMom2 = %f\n", momentum0.top.magnitude(), sumLinMomentum.magnitude(), momentum2.top.magnitude()); + printf("AngMom0 = %f, AngMom1 = %f, AngMom2 = %f\n", momentum0.bottom.magnitude(), angMomentum1.magnitude(), momentum2.bottom.magnitude()); + + printf("%i: Angular Momentum0 (%f, %f, %f), angularMomentum1 (%f, %f, %f), angularMomFinal (%f, %f, %f)\n", + count, momentum0.bottom.x, momentum0.bottom.y, momentum0.bottom.z, angMomentum1.x, angMomentum1.y, angMomentum1.z, + momentum2.bottom.x, momentum2.bottom.y, momentum2.bottom.z); + } + +#endif + } + + } + + void FeatherstoneArticulation::computeJointTransmittedFrictionForce( + ArticulationData& data, ScratchData& scratchData, Cm::SpatialVectorF* /*Z*/, Cm::SpatialVectorF* /*DeltaV*/) + { + //const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = data.getLinkCount() - 1; + + //const PxReal frictionCoefficient =30.5f; + Cm::SpatialVectorF* transmittedForce = scratchData.spatialZAVectors; + + for (PxU32 linkID = startIndex; linkID > 1; --linkID) + { + const ArticulationLink& link = data.getLink(linkID); + + //joint force transmitted from parent to child + //transmittedForce[link.parent] += data.mChildToParent[linkID] * transmittedForce[linkID]; + transmittedForce[link.parent] += FeatherstoneArticulation::translateSpatialVector(data.getRw(linkID), transmittedForce[linkID]); + } + + transmittedForce[0] = Cm::SpatialVectorF::Zero(); + + //const PxReal dt = data.getDt(); + //for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + //{ + // //ArticulationLink& link = data.getLink(linkID); + // //ArticulationLinkData& linkDatum = data.getLinkData(linkID); + // transmittedForce[linkID] = transmittedForce[linkID] * (frictionCoefficient) * dt; + // //transmittedForce[link.parent] -= linkDatum.childToParent * transmittedForce[linkID]; + //} + + // + + //applyImpulses(transmittedForce, Z, DeltaV); + + //PxReal* deltaV = data.getJointDeltaVelocities(); + //PxReal* jointV = data.getJointVelocities(); + + //for (PxU32 linkID = 1; linkID < data.getLinkCount(); ++linkID) + //{ + // ArticulationJointCoreData& tJointDatum = data.getJointData()[linkID]; + // for (PxU32 i = 0; i < tJointDatum.dof; ++i) + // { + // jointV[i + tJointDatum.jointOffset] += deltaV[i + tJointDatum.jointOffset]; + // deltaV[i + tJointDatum.jointOffset] = 0.f; + // } + //} + } + + //void FeatherstoneArticulation::computeJointFriction(ArticulationData& data, + // ScratchData& scratchData) + //{ + // PX_UNUSED(scratchData); + // const PxU32 linkCount = data.getLinkCount(); + // PxReal* jointForces = scratchData.jointForces; + // PxReal* jointFrictionForces = data.getJointFrictionForces(); + // PxReal* jointVelocities = data.getJointVelocities(); + + // const PxReal coefficient = 0.5f; + + // for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + // { + // ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + // //compute generalized force + // PxReal* jFs = &jointForces[jointDatum.jointOffset]; + // PxReal* jVs = &jointVelocities[jointDatum.jointOffset]; + // PxReal* jFFs = &jointFrictionForces[jointDatum.jointOffset]; + + // for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + // { + // PxReal sign = jVs[ind] > 0 ? -1.f : 1.f; + // jFFs[ind] = coefficient * PxAbs(jFs[ind]) *sign; + + // //jFFs[ind] = coefficient * jVs[ind]; + // } + // } + //} + + PxU32 FeatherstoneArticulation::computeUnconstrainedVelocities( + const ArticulationSolverDesc& desc, + PxReal dt, + PxU32& acCount, + const PxVec3& gravity, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV, + const PxReal invLengthScale) + { + + FeatherstoneArticulation* articulation = static_cast(desc.articulation); + ArticulationData& data = articulation->mArticulationData; + data.setDt(dt); + + articulation->computeUnconstrainedVelocitiesInternal(gravity, Z, deltaV, invLengthScale); + + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + return articulation->setupSolverConstraints(data.getLinks(), data.getLinkCount(), fixBase, data, Z, acCount); + } + + void FeatherstoneArticulation::computeUnconstrainedVelocitiesTGS( + const ArticulationSolverDesc& desc, + PxReal dt, const PxVec3& gravity, + PxU64 contextID, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, + const PxReal invLengthScale) + { + PX_UNUSED(contextID); + + FeatherstoneArticulation* articulation = static_cast(desc.articulation); + ArticulationData& data = articulation->mArticulationData; + data.setDt(dt); + + articulation->computeUnconstrainedVelocitiesInternal(gravity, Z, DeltaV, invLengthScale); + } + + //void FeatherstoneArticulation::computeCounteractJointForce(const ArticulationSolverDesc& desc, ScratchData& /*scratchData*/, const PxVec3& gravity) + //{ + // const bool fixBase = mArticulationData.getCore()->flags & PxArticulationFlag::eFIX_BASE; + + // const PxU32 linkCount = mArticulationData.getLinkCount(); + // const PxU32 totalDofs = mArticulationData.getDofs(); + // //common data + // computeRelativeTransform(mArticulationData); + + // jcalc(mArticulationData); + + // computeSpatialInertia(mArticulationData); + + // DyScratchAllocator allocator(desc.scratchMemory, desc.scratchMemorySize); + + // ScratchData tempScratchData; + // allocateScratchSpatialData(allocator, linkCount, tempScratchData); + + // //PxReal* gravityJointForce = allocator.alloc(totalDofs); + // //{ + // // PxMemZero(gravityJointForce, sizeof(PxReal) * totalDofs); + + // // //compute joint force due to gravity + // // tempScratchData.jointVelocities = NULL; + // // tempScratchData.jointAccelerations = NULL; + // // tempScratchData.jointForces = gravityJointForce; + // // tempScratchData.externalAccels = NULL; + + // // if (fixBase) + // // inverseDynamic(mArticulationData, gravity,tempScratchData); + // // else + // // inverseDynamicFloatingLink(mArticulationData, gravity, tempScratchData); + // //} + + // ////PxReal* jointForce = mArticulationData.getJointForces(); + // //PxReal* tempJointForce = mArticulationData.getTempJointForces(); + // //{ + // // PxMemZero(tempJointForce, sizeof(PxReal) * totalDofs); + + // // //compute joint force due to coriolis force + // // tempScratchData.jointVelocities = mArticulationData.getJointVelocities(); + // // tempScratchData.jointAccelerations = NULL; + // // tempScratchData.jointForces = tempJointForce; + // // tempScratchData.externalAccels = NULL; + + // // if (fixBase) + // // inverseDynamic(mArticulationData, PxVec3(0.f), tempScratchData); + // // else + // // inverseDynamicFloatingLink(mArticulationData, PxVec3(0.f), tempScratchData); + // //} + + // //PxReal* jointForce = mArticulationData.getJointForces(); + // //for (PxU32 i = 0; i < mArticulationData.getDofs(); ++i) + // //{ + // // jointForce[i] = tempJointForce[i] - gravityJointForce[i]; + // //} + + // //PxReal* jointForce = mArticulationData.getJointForces(); + // PxReal* tempJointForce = mArticulationData.getTempJointForces(); + // { + // PxMemZero(tempJointForce, sizeof(PxReal) * totalDofs); + + // //compute joint force due to coriolis force + // tempScratchData.jointVelocities = mArticulationData.getJointVelocities(); + // tempScratchData.jointAccelerations = NULL; + // tempScratchData.jointForces = tempJointForce; + // tempScratchData.externalAccels = mArticulationData.getExternalAccelerations(); + + // if (fixBase) + // inverseDynamic(mArticulationData, gravity, tempScratchData); + // else + // inverseDynamicFloatingLink(mArticulationData, gravity, tempScratchData); + // } + + // PxReal* jointForce = mArticulationData.getJointForces(); + // for (PxU32 i = 0; i < mArticulationData.getDofs(); ++i) + // { + // jointForce[i] = tempJointForce[i]; + // } + //} + + void FeatherstoneArticulation::updateArticulation(ScratchData& scratchData, + const PxVec3& gravity, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, const PxReal invLengthScale) + { + computeRelativeTransformC2P(mArticulationData); + + //computeLinkVelocities(mArticulationData, scratchData); + + + //articulation constants + const PxReal dt = mArticulationData.mDt; + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //articulation links + const PxU32 nbLinks = mArticulationData.mLinkCount; + const PxTransform* accumulatedPoses = mArticulationData.mAccumulatedPoses.begin(); + const Cm::SpatialVector* externalAccels = mArticulationData.mExternalAcceleration; + const PxVec3* rws = mArticulationData.mRw.begin(); + Cm::UnAlignedSpatialVector* worldMotionMatrices = mArticulationData.mWorldMotionMatrix.begin(); + ArticulationLinkData* linkData = mArticulationData.mLinksData; + ArticulationLink* links = mArticulationData.mLinks; + ArticulationJointCoreData* jointCoreData = mArticulationData.mJointData; + Cm::SpatialVectorF* motionVelocities = mArticulationData.mMotionVelocities.begin(); + Cm::SpatialVectorF* motionAccelerations = mArticulationData.mMotionAccelerations.begin(); + Cm::SpatialVectorF* coriolisVectors = mArticulationData.mCorioliseVectors.begin(); + Cm::SpatialVectorF* spatialZAForces = mArticulationData.mZAForces.begin(); + Cm::SpatialVectorF* spatialZAInternal = mArticulationData.mZAInternalForces.begin(); + Dy::SpatialMatrix* worldSpatialArticulatedInertias = mArticulationData.mWorldSpatialArticulatedInertia.begin(); + PxMat33* worldIsolatedSpatialArticulatedInertias = mArticulationData.mWorldIsolatedSpatialArticulatedInertia.begin(); + PxReal* linkMasses = mArticulationData.mMasses.begin(); + //articulation joint dofs + const PxU32 nbJointDofs = mArticulationData.mJointVelocity.size(); + PxReal* jointVelocities = mArticulationData.mJointVelocity.begin(); + //articulation state + Cm::SpatialVectorF& rootPreMotionVelocity = mArticulationData.mRootPreMotionVelocity; + PxVec3& com = mArticulationData.mCOM; + PxReal& invMass = mArticulationData.mInvSumMass; + computeLinkStates( + dt, invLengthScale, gravity, fixBase, + nbLinks, + accumulatedPoses, externalAccels, rws, worldMotionMatrices, jointCoreData, + linkData, links, motionAccelerations, + motionVelocities, spatialZAForces, spatialZAInternal, coriolisVectors, + worldIsolatedSpatialArticulatedInertias, linkMasses, worldSpatialArticulatedInertias, + nbJointDofs, + jointVelocities, + rootPreMotionVelocity, com, invMass); + + initLinks(mArticulationData, gravity, scratchData, Z, DeltaV); + computeLinkAcceleration(mArticulationData, scratchData, false); + computeLinkInternalAcceleration(mArticulationData, scratchData); + } + + void FeatherstoneArticulation::computeUnconstrainedVelocitiesInternal( + const PxVec3& gravity, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* DeltaV, const PxReal invLengthScale) + { + //PX_PROFILE_ZONE("Articulations:computeUnconstrainedVelocities", 0); + + //mStaticConstraints.forceSize_Unsafe(0); + mStatic1DConstraints.forceSize_Unsafe(0); + mStaticContactConstraints.forceSize_Unsafe(0); + + PxMemZero(mArticulationData.mNbStatic1DConstraints.begin(), mArticulationData.mNbStatic1DConstraints.size()*sizeof(PxU32)); + PxMemZero(mArticulationData.mNbStaticContactConstraints.begin(), mArticulationData.mNbStaticContactConstraints.size() * sizeof(PxU32)); + //const PxU32 linkCount = mArticulationData.getLinkCount(); + + mArticulationData.init(); + + ScratchData scratchData; + scratchData.motionVelocities = mArticulationData.getMotionVelocities(); + scratchData.motionAccelerations = mArticulationData.getMotionAccelerations(); + scratchData.coriolisVectors = mArticulationData.getCorioliseVectors(); + scratchData.spatialZAVectors = mArticulationData.getSpatialZAVectors(); + scratchData.jointAccelerations = mArticulationData.getJointAccelerations(); + scratchData.jointVelocities = mArticulationData.getJointVelocities(); + scratchData.jointPositions = mArticulationData.getJointPositions(); + scratchData.jointForces = mArticulationData.getJointForces(); + scratchData.externalAccels = mArticulationData.getExternalAccelerations(); + + updateArticulation(scratchData, gravity, Z, DeltaV, invLengthScale); + + + if (mArticulationData.mLinkCount > 1) + { + //use individual zero acceleration force(we copy the initial Z value to the transmitted force buffers in initLink()) + scratchData.spatialZAVectors = mArticulationData.getTransmittedForces(); + computeZAForceInv(mArticulationData, scratchData); + computeJointTransmittedFrictionForce(mArticulationData, scratchData, Z, DeltaV); + } + + //the dirty flag is used in inverse dynamic + mArticulationData.setDataDirty(true); + + //zero zero acceleration vector in the articulation data so that we can use this buffer to accumulated + //impulse for the contacts/constraints in the PGS/TGS solvers + //PxMemZero(mArticulationData.getSpatialZAVectors(), sizeof(Cm::SpatialVectorF) * linkCount); + + //Reset deferredQstZ and root deferredZ! + PxMemZero(mArticulationData.mDeferredQstZ.begin(), sizeof(PxReal)*mArticulationData.getDofs()); + PxMemZero(mArticulationData.mJointConstraintForces.begin(), sizeof(PxReal)*mArticulationData.getDofs()); + mArticulationData.mRootDeferredZ = Cm::SpatialVectorF::Zero(); + + // solver progress counters + maxSolverNormalProgress = 0; + maxSolverFrictionProgress = 0; + solverProgress = 0; + numTotalConstraints = 0; + + for (PxU32 a = 0; a < mArticulationData.getLinkCount(); ++a) + { + mArticulationData.mAccumulatedPoses[a] = mArticulationData.getLink(a).bodyCore->body2World; + mArticulationData.mPreTransform[a] = mArticulationData.getLink(a).bodyCore->body2World; + mArticulationData.mDeltaQ[a] = PxQuat(PxIdentity); + } + } + + void FeatherstoneArticulation::enforcePrismaticLimits(PxReal& jPosition, ArticulationJointCore* joint) + { + const PxU32 dofId = joint->dofIds[0]; + if (joint->motion[dofId] == PxArticulationMotion::eLIMITED) + { + if (jPosition < (joint->limits[dofId].low)) + jPosition = joint->limits[dofId].low; + + if (jPosition > (joint->limits[dofId].high)) + jPosition = joint->limits[dofId].high; + } + } + + PxQuat computeSphericalJointPositions(const PxQuat& relativeQuat, + const PxQuat& newRot, const PxQuat& pBody2WorldRot, + PxReal* jPositions, const Cm::UnAlignedSpatialVector* motionMatrix, + const PxU32 dofs) + { + PxQuat newParentToChild = (newRot.getConjugate() * pBody2WorldRot).getNormalized(); + if(newParentToChild.w < 0.f) + newParentToChild = -newParentToChild; + //PxQuat newParentToChild = (newRot * pBody2WorldRot.getConjugate()).getNormalized(); + + PxQuat jointRotation = newParentToChild * relativeQuat.getConjugate(); + + PxReal radians; + PxVec3 axis; + jointRotation.toRadiansAndUnitAxis(radians, axis); + + axis *= radians; + + for (PxU32 d = 0; d < dofs; ++d) + { + jPositions[d] = -motionMatrix[d].top.dot(axis); + } + + return newParentToChild; + } + + PxQuat computeSphericalJointPositions(const PxQuat& /*relativeQuat*/, + const PxQuat& newRot, const PxQuat& pBody2WorldRot) + { + PxQuat newParentToChild = (newRot.getConjugate() * pBody2WorldRot).getNormalized(); + if (newParentToChild.w < 0.f) + newParentToChild = -newParentToChild; + + /*PxQuat jointRotation = newParentToChild * relativeQuat.getConjugate(); + + PxReal radians; + jointRotation.toRadiansAndUnitAxis(radians, axis); + + axis *= radians;*/ + + return newParentToChild; + } + + void FeatherstoneArticulation::computeAndEnforceJointPositions(ArticulationData& data) + { + ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + + ArticulationJointCoreData* jointData = data.getJointData(); + + PxReal* jointPositions = data.getJointPositions(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + ArticulationJointCore* joint = link.inboundJoint; + ArticulationJointCoreData& jointDatum = jointData[linkID]; + PxReal* jPositions = &jointPositions[jointDatum.jointOffset]; + + if (joint->jointType == PxArticulationJointType::eSPHERICAL) + { + ArticulationLink& pLink = links[link.parent]; + //const PxTransform pBody2World = pLink.bodyCore->body2World; + + const PxU32 dof = jointDatum.dof; + + computeSphericalJointPositions(data.mRelativeQuat[linkID], link.bodyCore->body2World.q, + pLink.bodyCore->body2World.q, jPositions, &data.getMotionMatrix(jointDatum.jointOffset), dof); + } + else if (joint->jointType == PxArticulationJointType::eREVOLUTE) + { + PxReal jPos = jPositions[0]; + + if (jPos > PxTwoPi) + jPos -= PxTwoPi*2.f; + else if (jPos < -PxTwoPi) + jPos += PxTwoPi*2.f; + + jPos = PxClamp(jPos, -PxTwoPi*2.f, PxTwoPi*2.f); + + jPositions[0] = jPos; + + } + else if(joint->jointType == PxArticulationJointType::ePRISMATIC) + { + enforcePrismaticLimits(jPositions[0], joint); + } + } + } + + void FeatherstoneArticulation::updateJointProperties(PxReal* jointNewVelocities, PxReal* jointVelocities, PxReal* jointAccelerations) + { + using namespace Dy; + + const PxU32 dofs = mArticulationData.getDofs(); + const PxReal invDt = 1.f / mArticulationData.getDt(); + + for (PxU32 i = 0; i < dofs; ++i) + { + const PxReal jNewVel = jointNewVelocities[i]; + PxReal delta = jNewVel - jointVelocities[i]; + jointVelocities[i] = jNewVel; + jointAccelerations[i] += delta * invDt; + } + } + + void FeatherstoneArticulation::recomputeAccelerations(const PxReal dt) + { + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + + ArticulationLink* links = mArticulationData.getLinks(); + const PxU32 linkCount = mArticulationData.getLinkCount(); + + Cm::SpatialVectorF* motionAccels = mArticulationData.getMotionAccelerations(); + + PxReal* jAccelerations = mArticulationData.getJointAccelerations(); + + const PxReal invDt = 1.f / dt; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + //compute root link accelerations + if (fixBase) + { + motionAccels[0] = Cm::SpatialVectorF::Zero(); + } + else + { + Cm::SpatialVectorF tAccel = (mArticulationData.getMotionVelocity(0) - mArticulationData.mRootPreMotionVelocity) * invDt; + motionAccels[0].top = tAccel.top; + motionAccels[0].bottom = tAccel.bottom; + + } + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const ArticulationJointCoreData& jointDatum = jointData[linkID]; + + PxReal* jAccel = &jAccelerations[jointDatum.jointOffset]; + + ArticulationLink& link = links[linkID]; + + const PxTransform& body2World = link.bodyCore->body2World; + + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + const PxReal accel = jAccel[i]; + const PxVec3 localAngAccel = mArticulationData.mMotionMatrix[jointDatum.jointOffset + i].top * accel; + const PxVec3 localLinAccel = mArticulationData.mMotionMatrix[jointDatum.jointOffset + i].bottom * accel; + + motionAccels[linkID].top = body2World.rotate(localAngAccel); + motionAccels[linkID].bottom = body2World.rotate(localLinAccel); + } + } + } + + Cm::SpatialVector FeatherstoneArticulation::recomputeAcceleration(const PxU32 linkId, const PxReal dt) const + { + ArticulationLink* links = mArticulationData.getLinks(); + Cm::SpatialVectorF tMotionAccel; + const PxReal invDt = 1.f / dt; + if (linkId == 0) + { + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + { + tMotionAccel = Cm::SpatialVectorF::Zero(); + } + else + { + Cm::SpatialVectorF tAccel = (mArticulationData.getMotionVelocity(0) - mArticulationData.mRootPreMotionVelocity) * invDt; + tMotionAccel.top = tAccel.top; + tMotionAccel.bottom = tAccel.bottom; + } + } + else + { + + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + + const PxReal* jAccelerations = mArticulationData.getJointAccelerations(); + + ArticulationLink& link = links[linkId]; + + const PxTransform& body2World = link.bodyCore->body2World; + + const ArticulationJointCoreData& jointDatum = jointData[linkId]; + + const PxReal* jAccel = &jAccelerations[jointDatum.jointOffset]; + + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + const PxReal accel = jAccel[i]; + + tMotionAccel.top = mArticulationData.mMotionMatrix[jointDatum.jointOffset + i].top * accel; + tMotionAccel.bottom = mArticulationData.mMotionMatrix[jointDatum.jointOffset + i].bottom * accel; + + tMotionAccel.top = body2World.rotate(tMotionAccel.top); + tMotionAccel.bottom = body2World.rotate(tMotionAccel.bottom); + } + } + + return Cm::SpatialVector(tMotionAccel.bottom, tMotionAccel.top); + + } + + + void FeatherstoneArticulation::propagateLinksDown(ArticulationData& data, PxReal* jointVelocities, PxReal* jointPositions, + Cm::SpatialVectorF* motionVelocities) + { + ArticulationLink* links = mArticulationData.getLinks(); + + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + + const PxQuat* const PX_RESTRICT relativeQuats = mArticulationData.mRelativeQuat.begin(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + const PxReal dt = data.getDt(); + + + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + + ArticulationJointCoreData& jointDatum = jointData[linkID]; + //ArticulationLinkData& linkDatum = mArticulationData.getLinkData(linkID); + //const PxTransform oldTransform = preTransforms[linkID]; + + ArticulationLink& pLink = links[link.parent]; + const PxTransform pBody2World = pLink.bodyCore->body2World; + + ArticulationJointCore* joint = link.inboundJoint; + + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + PxQuat newParentToChild; + PxQuat newWorldQ; + PxVec3 r; + + const PxVec3 childOffset = -joint->childPose.p; + const PxVec3 parentOffset = joint->parentPose.p; + + PxTransform& body2World = link.bodyCore->body2World; + + const PxQuat relativeQuat = relativeQuats[linkID]; + + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + const PxReal delta = (jVelocity[0]) * dt; + + PxReal jPos = jPosition[0] + delta; + + enforcePrismaticLimits(jPos, joint); + + jPosition[0] = jPos; + + newParentToChild = relativeQuat; + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + const PxVec3& u = data.mMotionMatrix[jointDatum.jointOffset].bottom; + + r = e + d + u * jPos; + break; + } + case PxArticulationJointType::eREVOLUTE: + { + //use positional iteration JointVelociy to integrate + const PxReal delta = (jVelocity[0]) * dt; + + PxReal jPos = jPosition[0] + delta; + + if (jPos > PxTwoPi) + jPos -= PxTwoPi*2.f; + else if (jPos < -PxTwoPi) + jPos += PxTwoPi*2.f; + + jPos = PxClamp(jPos, -PxTwoPi*2.f, PxTwoPi*2.f); + jPosition[0] = jPos; + + const PxVec3& u = data.mMotionMatrix[jointDatum.jointOffset].top; + + PxQuat jointRotation = PxQuat(-jPos, u); + if (jointRotation.w < 0) //shortest angle. + jointRotation = -jointRotation; + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + + break; + } + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + const PxReal delta = (jVelocity[0]) * dt; + + PxReal jPos = jPosition[0] + delta; + + jPosition[0] = jPos; + + const PxVec3& u = data.mMotionMatrix[jointDatum.jointOffset].top; + + PxQuat jointRotation = PxQuat(-jPos, u); + if (jointRotation.w < 0) //shortest angle. + jointRotation = -jointRotation; + + newParentToChild = (jointRotation * relativeQuat).getNormalized(); + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + + PX_ASSERT(r.isFinite()); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + if (1) + { + const PxTransform oldTransform = data.mAccumulatedPoses[linkID]; +#if 0 + Cm::SpatialVectorF worldVel = FeatherstoneArticulation::translateSpatialVector(-mArticulationData.mRw[linkID], motionVelocities[link.parent]); + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + const PxReal delta = (jVelocity[i]) * dt; + const PxReal jPos = jPosition[i] + delta; + jPosition[i] = jPos; + worldVel.top += data.mWorldMotionMatrix[jointDatum.jointOffset + i].top * jVelocity[i]; + worldVel.bottom += data.mWorldMotionMatrix[jointDatum.jointOffset + i].bottom * jVelocity[i]; + } + + motionVelocities[linkID] = worldVel; + + +#else + Cm::SpatialVectorF worldVel = motionVelocities[linkID]; + //Cm::SpatialVectorF parentVel = motionVelocities[link.parent]; + //PxVec3 relVel = oldTransform.rotateInv(worldVel.top - parentVel.top); + //for (PxU32 i = 0; i < jointDatum.dof; ++i) + //{ + // const PxReal jVel = mArticulationData.mMotionMatrix[jointDatum.jointOffset + i].top.dot(relVel); + // jVelocity[i] = jVel; + // /*const PxReal delta = jVel * dt; + // jPosition[i] += delta;*/ + //} +#endif + + //Gc and Gc are centre of mass poses of parent(p) and child(c) in the world frame. + //Introduce Q(v, dt) = PxExp(worldAngVel*dt); + //Lp and Lc are joint frames of parent(p) and child(c) in the parent and child body frames. + + //The rotational part of Gc will be updated as follows: + //GcNew.q = Q(v, dt) * Gc.q + //We could use GcNew for the new child pose but it isn't in quite the right form + //to use in a generic way with all the other joint types supported here. + //Here's what we do. + //Step 1) add Identity to the rhs. + //GcNew.q = Gp.q * Gp.q^-1 * Q(v, dt) * Gc.q + //Step 2) Remember that (A * B^-1) = (B * A ^-1)^-1. + //Gp.q^-1 * Q(v, dt) * Gc.q = (Q(v, dt) * Gc.q)^-1 * Gp.q + //GcNew.q = Gp.q * (Q(v, dt) * Gc.q)^-1 * Gp.q + //Write this out using the variable names used here. + //The final form is: + //body2World.q = pBody2World.q * newParent2Child + + //The translational part of GcNew will be updated as follows: + //GcNew.p = Gp.p + Gp.q.rotate(Lp.p) - GcNew.q.rotate(Lc.p) + // = Gp.p + GcNew.q * (GcNew.q^-1 * Gp.q).rotate(Lp.p) - GcNew.q.rotate(Lc.p) + // = Gp.p + GcNew.q.rotate((GcNew.q^-1 * Gp.q).rotate(Lp.p) - GcNew.q.rotate(Lc.p) + // = Gp.p + GcNew.q.rotate((GcNew.q^-1 * Gp.q).rotate(Lp.p) - Lc.p) + //Write this out using the variable names used here. + //body2World.p = pBody2World.p + body2World.q.rotate(newParent2Child.rotate(parentOffset) + childOffset) + //Put r = newParent2Child.rotate(parentOffset) + childOffset + //and we have the final form used here: + //body2World.p = pBody2World.p + body2World.q.rotate(r) + + //Now let's think about the rotation angles. + //Imagine that the joint frames are aligned in the world frame. + //The pose(Gc0) of the child body in the world frame will satisfy: + //Gp * Lp = Gc0 * Lc + //We can solve for Gc0: + //Gc0 = Gp * Lp * Lc^-1 + //Gc0 = Gp * (Lc * Lp^-1)^-1 + //Now compute the rotation J that rotates from Gc0 to GcNew. + //We seek a rotation J in the child body frame (in the aligned state so at Gc0) that satisfies: + //Gc0 * J = GcNew + //Let's actually solve for J^-1 (because that's what we do here). + //J^-1 = GcNew^-1 * Gp * (Lc * Lp^-1)^-1 + //From J^-1 we can retrieve three rotation angles in the child body frame. + //We actually want the angles for J. We observe that + //toAngles(J^-1) = -toAngles(J) + //Our rotation angles r_b commensurate with J are then: + //r_b = -toAngles(J^-1) + //From r_b we can compute the angles r_j in the child joint frame. + // r_j = Lc.rotateInv(r_b) + //Remember that we began our calculation with aligned frames. + //We can equally apply r_j to the parent joint frame and achieve the same outcome. + + //GcNew = Q(v, dt) * Gc.q + PxVec3 worldAngVel = worldVel.top; + newWorldQ = PxExp(worldAngVel*dt) * oldTransform.q; + + //GcNew^-1 * Gp + newParentToChild = computeSphericalJointPositions(relativeQuat, newWorldQ, + pBody2World.q); + + //J^-1 = GcNew^-1 * Gp * (Lc * Lp^-1)^-1 + PxQuat jointRotation = newParentToChild * relativeQuat.getConjugate(); + if(jointRotation.w < 0.0f) + jointRotation = -jointRotation; + + //PxVec3 axis = toRotationVector(jointRotation); + /*PxVec3 axis = jointRotation.getImaginaryPart(); + + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + PxVec3 sa = data.getMotionMatrix(jointDatum.jointOffset + i).top; + PxReal angle = -compAng(PxVec3(sa.x, sa.y, sa.z).dot(axis), jointRotation.w); + jPosition[i] = angle; + }*/ + + //r_j = -Lc.rotateInv(r_b) + PxVec3 axis; PxReal angle; + jointRotation.toRadiansAndUnitAxis(angle, axis); + axis *= angle; + for (PxU32 i = 0; i < jointDatum.dof; ++i) + { + PxVec3 sa = mArticulationData.getMotionMatrix(jointDatum.jointOffset + i).top; + PxReal ang = -sa.dot(axis); + jPosition[i] = ang; + } + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + r = e + d; + } + break; + } + case PxArticulationJointType::eFIX: + { + //this is fix joint so joint don't have velocity + newParentToChild = relativeQuat; + + const PxVec3 e = newParentToChild.rotate(parentOffset); + const PxVec3 d = childOffset; + + r = e + d; + break; + } + default: + break; + } + + body2World.q = (pBody2World.q * newParentToChild.getConjugate()).getNormalized(); + body2World.p = pBody2World.p + body2World.q.rotate(r); + + PX_ASSERT(body2World.isSane()); + PX_ASSERT(body2World.isValid()); + } + } + + void FeatherstoneArticulation::updateBodies(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, PxReal dt) + { + updateBodies(static_cast(desc.articulation), tempDeltaV, dt, true); + } + + void FeatherstoneArticulation::updateBodiesTGS(const ArticulationSolverDesc& desc, Cm::SpatialVectorF* tempDeltaV, PxReal dt) + { + updateBodies(static_cast(desc.articulation), tempDeltaV, dt, false); + } + + void FeatherstoneArticulation::updateBodies(FeatherstoneArticulation* articulation, Cm::SpatialVectorF* tempDeltaV, PxReal dt, bool integrateJointPositions) + { + ArticulationData& data = articulation->mArticulationData; + ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + + Cm::SpatialVectorF* motionVelocities = data.getMotionVelocities(); + Cm::SpatialVectorF* posMotionVelocities = data.getPosIterMotionVelocities(); + + Cm::SpatialVector* externalAccels = data.getExternalAccelerations(); + Cm::SpatialVector zero = Cm::SpatialVector::zero(); + + data.setDt(dt); + + const PxU32 nbSensors = data.mNbSensors; + + bool doForces = data.getArticulationFlags() & PxArticulationFlag::eCOMPUTE_JOINT_FORCES + || nbSensors; + + //update joint velocities/accelerations due to contacts/constraints. + if (data.mJointDirty) + { + //update delta joint velocity and motion velocity due to velocity iteration changes + + //update motionVelocities + PxcFsFlushVelocity(*articulation, tempDeltaV, doForces); + } + + Cm::SpatialVectorF momentum0 = Cm::SpatialVectorF::Zero(); + PxVec3 posMomentum(0.f); + + const bool fixBase = data.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //PGS + if (!fixBase) + { + const PxVec3 COM = data.mCOM; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + momentum0.top += motionVelocities[linkID].bottom * mass; + posMomentum += posMotionVelocities[linkID].bottom * mass; + } + + PxVec3 rootVel = momentum0.top * data.mInvSumMass; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + PxVec3 offsetMass = (data.mPreTransform[linkID].p - COM)*mass; + PxVec3 angMom = (data.mWorldIsolatedSpatialArticulatedInertia[linkID] * motionVelocities[linkID].top) + + offsetMass.cross(motionVelocities[linkID].bottom - rootVel); + momentum0.bottom += angMom; + } + } + + + if (!integrateJointPositions) + { + //TGS + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + links[linkID].bodyCore->body2World = data.mAccumulatedPoses[linkID].getNormalized(); + } + + articulation->computeAndEnforceJointPositions(data); + } + else + { + + if (!fixBase) + { + const PxTransform& preTrans = data.mAccumulatedPoses[0]; + + const Cm::SpatialVectorF& posVel = data.getPosIterMotionVelocity(0); + + updateRootBody(posVel, preTrans, data, dt); + } + //using the original joint velocities and delta velocities changed in the positional iter to update joint position/body transform + articulation->propagateLinksDown(data, data.getPosIterJointVelocities(), data.getJointPositions(), data.getPosIterMotionVelocities()); + + } + //Fix up momentum based on changes in pos. Only currently possible with non-fixed base + + + + if (!fixBase) + { + PxVec3 COM = data.mLinks[0].bodyCore->body2World.p * data.mMasses[0]; + data.mAccumulatedPoses[0] = data.mLinks[0].bodyCore->body2World; + + PxVec3 sumLinMom = data.mMotionVelocities[0].bottom * data.mMasses[0]; + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + PxU32 parent = data.mLinks[linkID].parent; + + const PxTransform childPose = data.mLinks[linkID].bodyCore->body2World; + + data.mAccumulatedPoses[linkID] = childPose; + + PxVec3 rw = childPose.p - data.mAccumulatedPoses[parent].p; + + data.mRw[linkID] = rw; + + ArticulationJointCoreData& jointDatum = data.mJointData[linkID]; + + const PxReal* jVelocity = &data.mJointNewVelocity[jointDatum.jointOffset]; + + Cm::SpatialVectorF vel = FeatherstoneArticulation::translateSpatialVector(-rw, data.mMotionVelocities[parent]); + Cm::UnAlignedSpatialVector deltaV = Cm::UnAlignedSpatialVector::Zero(); + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + PxReal jVel = jVelocity[ind]; + //deltaV += data.mWorldMotionMatrix[jointDatum.jointOffset + ind] * jVel; + deltaV += data.mMotionMatrix[jointDatum.jointOffset + ind] * jVel; + } + + vel.top += childPose.rotate(deltaV.top); + vel.bottom += childPose.rotate(deltaV.bottom); + + data.mMotionVelocities[linkID] = vel; + + PxReal mass = data.mMasses[linkID]; + COM += childPose.p * mass; + sumLinMom += vel.bottom * mass; + } + + COM *= data.mInvSumMass; + + PxMat33 sumInertia(PxZero); + + PxVec3 sumAngMom(0.f); + + PxVec3 rootLinVel = sumLinMom * data.mInvSumMass; + + + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + PxReal mass = data.mMasses[linkID]; + + const PxVec3 offset = data.mAccumulatedPoses[linkID].p - COM; + PxMat33 inertia; + PxMat33 R(data.mAccumulatedPoses[linkID].q); + const PxVec3 invInertiaDiag = data.getLink(linkID).bodyCore->inverseInertia; + PxVec3 inertiaDiag(1.f / invInertiaDiag.x, 1.f / invInertiaDiag.y, 1.f / invInertiaDiag.z); + + const PxVec3 offsetMass = offset * mass; + + Cm::transformInertiaTensor(inertiaDiag, R, inertia); + //Only needed for debug validation +#if PX_DEBUG + data.mWorldIsolatedSpatialArticulatedInertia[linkID] = inertia; +#endif + sumInertia += translateInertia(inertia, mass, offset); + sumAngMom += inertia * motionVelocities[linkID].top; + sumAngMom += offsetMass.cross(motionVelocities[linkID].bottom - rootLinVel); + } + + PxMat33 invSumInertia = sumInertia.getInverse(); + + PxReal aDenom = sumAngMom.magnitude(); + PxReal angRatio = aDenom == 0.f ? 0.f : momentum0.bottom.magnitude() / aDenom; + PxVec3 angMomDelta = sumAngMom * (angRatio - 1.f); + + PxVec3 angDelta = invSumInertia * angMomDelta; + +#if 0 + motionVelocities[0].top += angDelta; + + Cm::SpatialVectorF* motionAccelerations = data.getMotionAccelerations(); + + motionAccelerations[0] = Cm::SpatialVectorF(angDelta, PxVec3(0.f)); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + Cm::SpatialVectorF deltaV = Dy::FeatherstoneArticulation::translateSpatialVector(-data.getRw(linkID), motionAccelerations[data.getLink(linkID).parent]); + motionVelocities[linkID] += deltaV; + motionAccelerations[linkID] = deltaV; + + sumLinMom += deltaV.bottom*data.mMasses[linkID]; + } +#else + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const PxVec3 offset = (data.getAccumulatedPoses()[linkID].p - COM); + Cm::SpatialVectorF velChange(angDelta, -offset.cross(angDelta)); + motionVelocities[linkID] += velChange; + PxReal mass = data.mMasses[linkID]; + sumLinMom += velChange.bottom * mass; + } +#endif + + PxVec3 linDelta = (momentum0.top - sumLinMom)*data.mInvSumMass; + + + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + motionVelocities[linkID].bottom += linDelta; + } + + //if (integrateJointPositions) + { + PxVec3 predictedCOM = data.mCOM + posMomentum * (data.mInvSumMass * dt); + PxVec3 posCorrection = predictedCOM - COM; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + link.bodyCore->body2World.p += posCorrection; + } + + COM += posCorrection; + } + +#if PX_DEBUG && 0 + const bool validateMomentum = false; + if (validateMomentum) + { + + PxVec3 rootVel = sumLinMom * data.mInvSumMass + linDelta; + + Cm::SpatialVectorF momentum2(PxVec3(0.f), PxVec3(0.f)); + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + const PxReal mass = data.mMasses[linkID]; + PxVec3 offsetMass = (data.getLink(linkID).bodyCore->body2World.p - COM) * mass; + const PxVec3 angMom = data.mWorldIsolatedSpatialArticulatedInertia[linkID] * motionVelocities[linkID].top + + offsetMass.cross(motionVelocities[linkID].bottom - rootVel); + momentum2.bottom += angMom; + momentum2.top += motionVelocities[linkID].bottom * mass; + } + + + printf("COM = (%f, %f, %f)\n", COM.x, COM.y, COM.z); + printf("%i: linMom0 %f, linMom1 %f, angMom0 %f, angMom1 %f\n\n\n", + count, momentum0.top.magnitude(), momentum2.top.magnitude(), + momentum0.bottom.magnitude(), momentum2.bottom.magnitude()); + } +#endif + } + + + + { + //update joint velocity/accelerations + PxReal* jointVelocities = data.getJointVelocities(); + PxReal* jointAccelerations = data.getJointAccelerations(); + PxReal* jointNewVelocities = data.getJointNewVelocities(); + + articulation->updateJointProperties(jointNewVelocities, jointVelocities, jointAccelerations); + } + + const PxReal invDt = 1.f/dt; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + PxsBodyCore* bodyCore = link.bodyCore; + + bodyCore->linearVelocity = motionVelocities[linkID].bottom; + bodyCore->angularVelocity = motionVelocities[linkID].top; + //zero external accelerations + if(!(link.bodyCore->mFlags & PxRigidBodyFlag::eRETAIN_ACCELERATIONS)) + externalAccels[linkID] = zero; + } + + if (doForces) + { + data.mSolverSpatialForces[0] *= invDt; + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + data.mSolverSpatialForces[linkID] = (data.mWorldSpatialArticulatedInertia[linkID] * data.mSolverSpatialForces[linkID]) * invDt; + } + + + if (data.getArticulationFlags() & PxArticulationFlag::eCOMPUTE_JOINT_FORCES) + { + //const PxU32 dofCount = data.getDofs(); + PxReal* constraintForces = data.getJointConstraintForces(); + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + const Cm::SpatialVectorF spatialForce = data.mSolverSpatialForces[linkID] - (data.mZAForces[linkID] + data.mZAInternalForces[linkID]); + + ArticulationJointCoreData& jointDatum = data.mJointData[linkID]; + const PxU32 offset = jointDatum.jointOffset; + const PxU32 dofCount = jointDatum.dof; + + for (PxU32 i = 0; i < dofCount; ++i) + { + const PxReal jointForce = data.mWorldMotionMatrix[offset + i].innerProduct(spatialForce); + constraintForces[offset + i] = jointForce; + } + } + } + + + for (PxU32 s = 0; s < nbSensors; ++s) + { + ArticulationSensor* sensor = data.mSensors[s]; + const PxU32 linkID = sensor->mLinkID; + const PxTransform& transform = data.mPreTransform[linkID]; + const PxTransform& relTrans = sensor->mRelativePose; + + //Offset to translate the impulse by + const PxVec3 offset = transform.rotate(relTrans.p); + + Cm::SpatialVectorF spatialForce(PxVec3(0.f), PxVec3(0.f)); + + if (sensor->mFlags & PxArticulationSensorFlag::eCONSTRAINT_SOLVER_FORCES) + spatialForce += data.mSolverSpatialForces[linkID]; + if (sensor->mFlags & PxArticulationSensorFlag::eFORWARD_DYNAMICS_FORCES) + spatialForce -= (data.mZAForces[linkID] + data.mZAInternalForces[linkID]); + + // translate from body to sensor frame (offset is body->sensor) + spatialForce = translateSpatialVector(-offset, spatialForce); + + if (sensor->mFlags & PxArticulationSensorFlag::eWORLD_FRAME) + { + data.mSensorForces[s].force = spatialForce.top; + data.mSensorForces[s].torque = spatialForce.bottom; + } + else + { + //Now we need to rotate into the sensor's frame. Forces are currently reported in world frame + const PxQuat rotate = transform.q * relTrans.q; + data.mSensorForces[s].force = rotate.rotateInv(spatialForce.top); + data.mSensorForces[s].torque = rotate.rotateInv(spatialForce.bottom); + } + } + } + } + + void FeatherstoneArticulation::updateRootBody(const Cm::SpatialVectorF& motionVelocity, + const PxTransform& preTransform, ArticulationData& data, const PxReal dt) + { + ArticulationLink* links = data.getLinks(); + //body2World store new body transform integrated from solver linear/angular velocity + + PX_ASSERT(motionVelocity.top.isFinite()); + PX_ASSERT(motionVelocity.bottom.isFinite()); + + ArticulationLink& baseLink = links[0]; + + PxsBodyCore* baseBodyCore = baseLink.bodyCore; + + //(1) project the current body's velocity (based on its pre-pose) to the geometric COM that we're integrating around... + + PxVec3 comLinVel = motionVelocity.bottom; + + //using the position iteration motion velocity to compute the body2World + PxVec3 newP = (preTransform.p) + comLinVel * dt; + + PxQuat deltaQ = PxExp(motionVelocity.top*dt); + + baseBodyCore->body2World = PxTransform(newP, (deltaQ* preTransform.q).getNormalized()); + + PX_ASSERT(baseBodyCore->body2World.isFinite() && baseBodyCore->body2World.isValid()); + } + + + void FeatherstoneArticulation::getJointAcceleration(const PxVec3& gravity, PxArticulationCache& cache) + { + PX_SIMD_GUARD + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Articulation::getJointAcceleration() commonInit need to be called first to initialize data!"); + return; + } + + const PxU32 linkCount = mArticulationData.getLinkCount(); + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = cache.jointVelocity; + scratchData.jointForces = cache.jointForce; + + //compute individual link's spatial inertia tensor + //[0, M] + //[I, 0] + computeSpatialInertia(mArticulationData); + + computeLinkVelocities(mArticulationData, scratchData); + + //compute individual zero acceleration force + computeZ(mArticulationData, gravity, scratchData); + //compute corolis and centrifugal force + computeC(mArticulationData, scratchData); + + computeArticulatedSpatialInertiaAndZ_NonSeparated(mArticulationData, scratchData); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + //we have initialized motionVelocity and motionAcceleration to be zero in the root link if + //fix based flag is raised + //ArticulationLinkData& baseLinkDatum = mArticulationData.getLinkData(0); + + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + + if (!fixBase) + { + SpatialMatrix inverseArticulatedInertia = mArticulationData.mWorldSpatialArticulatedInertia[0].getInverse(); + motionAccelerations[0] = -(inverseArticulatedInertia * spatialZAForces[0]); + } +#if FEATHERSTONE_DEBUG + else + { + PX_ASSERT(isSpatialVectorZero(motionAccelerations[0])); + } +#endif + + PxReal* jointAccelerations = cache.jointAcceleration; + //calculate acceleration + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = mArticulationData.getLink(linkID); + + //SpatialTransform p2C = linkDatum.childToParent.getTranspose(); + //Cm::SpatialVectorF pMotionAcceleration = mArticulationData.mChildToParent[linkID].transposeTransform(motionAccelerations[link.parent]); + + Cm::SpatialVectorF pMotionAcceleration = FeatherstoneArticulation::translateSpatialVector(-mArticulationData.getRw(linkID), motionAccelerations[link.parent]); + + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + //calculate jointAcceleration + PxReal* jA = &jointAccelerations[jointDatum.jointOffset]; + computeJointAccelerationW(jointDatum, pMotionAcceleration, jA, &mArticulationData.mIsW[jointDatum.jointOffset], linkID, + &mArticulationData.qstZIc[jointDatum.jointOffset]); + + Cm::SpatialVectorF motionAcceleration(PxVec3(0.f), PxVec3(0.f)); + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + motionAcceleration.top += mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * jA[ind]; + motionAcceleration.bottom += mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * jA[ind]; + } + + motionAccelerations[linkID] = pMotionAcceleration + coriolisVectors[linkID] + motionAcceleration; + PX_ASSERT(motionAccelerations[linkID].isFinite()); + } + + allocator->free(tempMemory); + } + +}//namespace Dy +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp new file mode 100644 index 0000000..3351516 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFeatherstoneInverseDynamic.cpp @@ -0,0 +1,2116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "CmConeLimitHelper.h" +#include "DySolverConstraint1D.h" +#include "DyFeatherstoneArticulation.h" +#include "PxsRigidBody.h" +#include "PxcConstraintBlockStream.h" +#include "DyArticulationContactPrep.h" +#include "DyDynamics.h" +#include "DyArticulationPImpl.h" +#include "foundation/PxProfiler.h" +#include "extensions/PxContactJoint.h" +#include "DyFeatherstoneArticulationLink.h" +#include "DyFeatherstoneArticulationJointData.h" +#include "DyConstraint.h" +#include "DyConstraintPrep.h" +#include "DySolverContext.h" + +namespace physx +{ + +namespace Dy +{ + void PxcFsFlushVelocity(FeatherstoneArticulation& articulation, Cm::SpatialVectorF* deltaV, bool doConstraintForce); + + void FeatherstoneArticulation::computeLinkAccelerationInv(ArticulationData& data, ScratchData& scratchData) + { + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + + Cm::SpatialVectorF* coriolisVectors = scratchData.coriolisVectors; + + PxReal* jointAccelerations = scratchData.jointAccelerations; + + motionAccelerations[0] = Cm::SpatialVectorF::Zero(); + + for (PxU32 linkID = 1; linkID < data.getLinkCount(); ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + Cm::SpatialVectorF pMotionAcceleration = translateSpatialVector(-data.getRw(linkID), motionAccelerations[link.parent]); + + Cm::SpatialVectorF motionAcceleration(PxVec3(0.f), PxVec3(0.f)); + + if (jointAccelerations) + { + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + const PxU32 jointOffset = jointDatum.jointOffset; + const PxReal* jAcceleration = &jointAccelerations[jointOffset]; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + motionAcceleration.top += data.mWorldMotionMatrix[jointOffset + ind].top * jAcceleration[ind]; + motionAcceleration.bottom += data.mWorldMotionMatrix[jointOffset + ind].bottom * jAcceleration[ind]; + } + } + + motionAccelerations[linkID] = pMotionAcceleration + coriolisVectors[linkID] + motionAcceleration; + } + } + + //generalized force + void FeatherstoneArticulation::computeGeneralizedForceInv(ArticulationData& data, ScratchData& scratchData) + { + const PxU32 linkCount = data.getLinkCount(); + + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + PxReal* jointForces = scratchData.jointForces; + + for (PxU32 linkID = (linkCount - 1); linkID > 0; --linkID) + { + ArticulationLink& link = data.getLink(linkID); + + //joint force + + spatialZAForces[link.parent] += translateSpatialVector(data.getRw(linkID), spatialZAForces[linkID]); + + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + //compute generalized force + const PxU32 jointOffset = jointDatum.jointOffset; + PxReal* force = &jointForces[jointOffset]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + force[ind] = data.mWorldMotionMatrix[jointOffset + ind].innerProduct(spatialZAForces[linkID]); + } + } + } + + void FeatherstoneArticulation::computeZAForceInv(ArticulationData& data, ScratchData& scratchData) + { + const PxU32 linkCount = data.getLinkCount(); + + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + + Cm::SpatialVectorF* biasForce = scratchData.spatialZAVectors; + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + ArticulationLink& link = data.getLink(linkID); + + PxsBodyCore& core = *link.bodyCore; + + const PxVec3& ii = core.inverseInertia; + + const PxReal m = core.inverseMass == 0.f ? 0.f : 1.0f / core.inverseMass; + const PxVec3 inertiaTensor = PxVec3(ii.x == 0.f ? 0.f : (1.f / ii.x), ii.y == 0.f ? 0.f : (1.f / ii.y), ii.z == 0.f ? 0.f : (1.f / ii.z)); + + + Cm::SpatialVectorF Ia; + Ia.bottom = core.body2World.rotate(core.body2World.rotateInv(motionAccelerations[linkID].top).multiply(inertiaTensor)); + Ia.top = motionAccelerations[linkID].bottom * m; + + biasForce[linkID] +=Ia; + } + } + + void FeatherstoneArticulation::initCompositeSpatialInertia(ArticulationData& data, Dy::SpatialMatrix* compositeSpatialInertia) + { + const PxU32 linkCount = data.getLinkCount(); + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + SpatialMatrix& spatialInertia = compositeSpatialInertia[linkID]; + + ArticulationLink& link = data.getLink(linkID); + + PxsBodyCore& core = *link.bodyCore; + + const PxVec3& ii = core.inverseInertia; + + const PxReal m = core.inverseMass == 0.f ? 0.f : 1.0f / core.inverseMass; + + //construct mass matric + spatialInertia.topLeft = PxMat33(PxZero); + spatialInertia.topRight = PxMat33::createDiagonal(PxVec3(m)); + + //construct inertia matrix + PxMat33 rot(data.getLink(linkID).bodyCore->body2World.q); + PxMat33& I = spatialInertia.bottomLeft; + const PxVec3 inertiaTensor = PxVec3(ii.x == 0.f ? 0.f : (1.f / ii.x), ii.y == 0.f ? 0.f : (1.f / ii.y), ii.z == 0.f ? 0.f : (1.f / ii.z)); + Cm::transformInertiaTensor(inertiaTensor, rot, I); + } + } + + void FeatherstoneArticulation::computeCompositeSpatialInertiaAndZAForceInv(ArticulationData& data, ScratchData& scratchData) + { + ArticulationLink* links = data.getLinks(); + const PxU32 linkCount = data.getLinkCount(); + const PxU32 startIndex = PxU32(linkCount - 1); + + Dy::SpatialMatrix* compositeSpatialInertia = scratchData.compositeSpatialInertias; + Cm::SpatialVectorF* zaForce = scratchData.spatialZAVectors; + + initCompositeSpatialInertia(data, compositeSpatialInertia); + + for (PxU32 linkID = startIndex; linkID > 0; --linkID) + { + ArticulationLink& link = links[linkID]; + + Dy::SpatialMatrix cSpatialInertia = compositeSpatialInertia[linkID]; + translateInertia(FeatherstoneArticulation::constructSkewSymmetricMatrix(data.getRw(linkID)), cSpatialInertia); + + //compute parent's composite spatial inertia + compositeSpatialInertia[link.parent] += cSpatialInertia; + + //compute zero acceleration force. This is the force that would be required to support the + //motion of all the bodies in childen set if root node acceleration happened to be zero + zaForce[link.parent] += translateSpatialVector(data.getRw(linkID), zaForce[linkID]); + } + } + + void FeatherstoneArticulation::computeRelativeGeneralizedForceInv(ArticulationData& data, ScratchData& scratchData) + { + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + Dy::SpatialMatrix* compositeSpatialInertia = scratchData.compositeSpatialInertias; + Cm::SpatialVectorF* zaForce = scratchData.spatialZAVectors; + PxReal* jointForces = scratchData.jointForces; + + Dy::SpatialMatrix invInertia = compositeSpatialInertia[0].invertInertia(); + motionAccelerations[0] = -(invInertia * zaForce[0]); + + const PxU32 linkCount = data.getLinkCount(); + ArticulationLink* links = data.getLinks(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = links[linkID]; + + //const SpatialTransform p2c = data.mChildToParent[linkID].getTranspose(); + + motionAccelerations[linkID] = translateSpatialVector(-data.getRw(linkID), motionAccelerations[link.parent]); + + + zaForce[linkID] = compositeSpatialInertia[linkID] * motionAccelerations[linkID] + zaForce[linkID]; + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + //compute generalized force + const PxU32 jointOffset = jointDatum.jointOffset; + PxReal* jForce = &jointForces[jointOffset]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + jForce[ind] = data.mWorldMotionMatrix[jointOffset+ind].innerProduct(zaForce[linkID]); + } + } + } + + void FeatherstoneArticulation::inverseDynamic(ArticulationData& data, const PxVec3& gravity, + ScratchData& scratchData, bool computeCoriolis) + { + //pass 1 + computeLinkVelocities(data, scratchData); + + if(computeCoriolis) + computeC(data, scratchData); + else + PxMemZero(scratchData.coriolisVectors, sizeof(Cm::SpatialVectorF)*data.getLinkCount()); + + computeZ(data, gravity, scratchData); + + computeLinkAccelerationInv(data, scratchData); + + computeZAForceInv(data, scratchData); + + //pass 2 + computeGeneralizedForceInv(data, scratchData); + } + + void FeatherstoneArticulation::inverseDynamicFloatingBase(ArticulationData& data, const PxVec3& gravity, + ScratchData& scratchData, bool computeCoriolis) + { + //pass 1 + computeLinkVelocities(data, scratchData); + + if(computeCoriolis) + computeC(data, scratchData); + else + PxMemZero(scratchData.coriolisVectors, sizeof(Cm::SpatialVectorF)*data.getLinkCount()); + + computeZ(data, gravity, scratchData); + //no gravity, no external accelerations because we have turned those in force in + //computeZ + computeLinkAccelerationInv(data, scratchData); + + computeZAForceInv(data, scratchData); + + //pass 2 + computeCompositeSpatialInertiaAndZAForceInv(data, scratchData); + + //pass 3 + computeRelativeGeneralizedForceInv(data, scratchData); + } + + + bool FeatherstoneArticulation::applyCacheToDest(ArticulationData& data, PxArticulationCache& cache, + PxReal* jVelocities, PxReal* jAccelerations, PxReal* jPositions, PxReal* jointForces, + const PxArticulationCacheFlags flag, bool& shouldWake) + { + bool needsScheduling = !mGPUDirtyFlags; + + bool localShouldWake = false; + if (flag & PxArticulationCacheFlag::eVELOCITY) + { + const PxU32 dofCount = data.getDofs(); + for (PxU32 i = 0; i < dofCount; ++i) + { + const PxReal jv = cache.jointVelocity[i]; + localShouldWake = localShouldWake || jv != 0.f; + jVelocities[i] = jv; + } + + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_VELOCITIES; + } + + if (flag & PxArticulationCacheFlag::eACCELERATION) + { + copyJointData(data, jAccelerations, cache.jointAcceleration); + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_ACCELERATIONS; + } + + if (flag & PxArticulationCacheFlag::eROOT_TRANSFORM) + { + ArticulationLink& rLink = mArticulationData.getLink(0); + rLink.bodyCore->body2World = cache.rootLinkData->transform * rLink.bodyCore->getBody2Actor(); + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_ROOT_TRANSFORM; + + } + + if(flag & PxArticulationCacheFlag::eROOT_VELOCITIES) + { + ArticulationLink& rLink = mArticulationData.getLink(0); + rLink.bodyCore->linearVelocity = cache.rootLinkData->worldLinVel; + rLink.bodyCore->angularVelocity = cache.rootLinkData->worldAngVel; + localShouldWake = localShouldWake || (!cache.rootLinkData->worldLinVel.isZero()) || (!cache.rootLinkData->worldAngVel.isZero()); + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_ROOT_VELOCITIES; + } + + + if (flag & PxArticulationCacheFlag::ePOSITION) + { + copyJointData(data, jPositions, cache.jointPosition); + //When we update the joint positions, we also have to update the link state, so need to make links + //dirty! + mGPUDirtyFlags |= (ArticulationDirtyFlag::eDIRTY_POSITIONS); + } + + if (flag & PxArticulationCacheFlag::eFORCE) + { + const PxU32 dofCount = data.getDofs(); + for (PxU32 i = 0; i < dofCount; ++i) + { + const PxReal jf = cache.jointForce[i]; + localShouldWake = localShouldWake || jf != 0.f; + jointForces[i] = jf; + } + mGPUDirtyFlags |= ArticulationDirtyFlag::eDIRTY_FORCES; + } + + if (flag & (PxArticulationCacheFlag::ePOSITION | PxArticulationCacheFlag::eROOT_TRANSFORM)) + { + //update link's position based on the joint position + teleportLinks(data); + } + + if (flag & (PxArticulationCacheFlag::eVELOCITY | PxArticulationCacheFlag::ePOSITION | PxArticulationCacheFlag::eROOT_VELOCITIES | PxArticulationCacheFlag::eROOT_TRANSFORM)) + { + computeLinkVelocities(data); + } + shouldWake = localShouldWake; + return needsScheduling; + } + + void FeatherstoneArticulation::packJointData(const PxReal* maximum, PxReal* reduced) + { + const PxU32 linkCount = mArticulationData.getLinkCount(); + + for (PxU32 linkID = 1; linkID < linkCount; linkID++) + { + + ArticulationLink& linkDatum = mArticulationData.getLink(linkID); + ArticulationJointCore* joint = linkDatum.inboundJoint; + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + + const PxReal* maxJointData = &maximum[(linkID - 1) * DY_MAX_DOF]; + PxReal* reducedJointData = &reduced[jointDatum.jointOffset]; + + PxU32 count = 0; + for (PxU32 j = 0; j < DY_MAX_DOF; ++j) + { + PxArticulationMotions motion = PxArticulationMotions(joint->motion[j]); + if (motion != PxArticulationMotion::eLOCKED) + { + reducedJointData[count] = maxJointData[j]; + count++; + } + } + + PX_ASSERT(count == jointDatum.dof); + } + + } + + void FeatherstoneArticulation::unpackJointData(const PxReal* reduced, PxReal* maximum) + { + const PxU32 linkCount = mArticulationData.getLinkCount(); + + for (PxU32 linkID = 1; linkID < linkCount; linkID++) + { + ArticulationLink& linkDatum = mArticulationData.getLink(linkID); + ArticulationJointCore* joint = linkDatum.inboundJoint; + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + + PxReal* maxJointData = &maximum[(linkID - 1) * DY_MAX_DOF]; + const PxReal* reducedJointData = &reduced[jointDatum.jointOffset]; + + PxU32 count = 0; + for (PxU32 j = 0; j < DY_MAX_DOF; ++j) + { + PxArticulationMotions motion = PxArticulationMotions(joint->motion[j]); + if (motion != PxArticulationMotion::eLOCKED) + { + maxJointData[j] = reducedJointData[count]; + count++; + } + else + { + maxJointData[j] = 0.f; + } + } + + PX_ASSERT(count == jointDatum.dof); + } + } + + void FeatherstoneArticulation::initializeCommonData() + { + jcalc(mArticulationData); + computeRelativeTransformC2P(mArticulationData); + + computeRelativeTransformC2B(mArticulationData); + + computeSpatialInertia(mArticulationData); + + mArticulationData.setDataDirty(false); + } + + void FeatherstoneArticulation::getGeneralizedGravityForce(const PxVec3& gravity, PxArticulationCache& cache) + { + + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Articulation::getGeneralisedGravityForce() commonInit need to be called first to initialize data!"); + return; + } + +#if FEATHERSTONE_DEBUG + PxReal* jointForce = reinterpret_cast(PX_ALLOC(sizeof(PxReal) * mArticulationData.getDofs(), "jointForce")); + { + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = NULL; + scratchData.jointAccelerations = NULL; + scratchData.jointForces = jointForce; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + inverseDynamic(mArticulationData, gravity, scratchData, false); + else + inverseDynamicFloatingBase(mArticulationData, gravity, scratchData, false); + + allocator->free(tempMemory); + } +#endif + + const PxVec3 tGravity = -gravity; + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + const PxU32 linkCount = mArticulationData.getLinkCount(); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + { + Cm::SpatialVectorF* spatialZAForces = reinterpret_cast(allocator->alloc(sizeof(Cm::SpatialVectorF) * linkCount)); + + for (PxU32 linkID = 0; linkID < linkCount; ++linkID) + { + ArticulationLink& link = mArticulationData.getLink(linkID); + + PxsBodyCore& core = *link.bodyCore; + + const PxReal m = 1.0f / core.inverseMass; + + const PxVec3 linkGravity = tGravity; + + spatialZAForces[linkID].top = m*linkGravity; + spatialZAForces[linkID].bottom = PxVec3(0.f); + } + + ScratchData scratchData; + scratchData.spatialZAVectors = spatialZAForces; + scratchData.jointForces = cache.jointForce; + + computeGeneralizedForceInv(mArticulationData, scratchData); + + //release spatialZA vectors + allocator->free(spatialZAForces); + } + else + { + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = NULL; + scratchData.jointAccelerations = NULL; + scratchData.jointForces = cache.jointForce; + scratchData.externalAccels = NULL; + + inverseDynamicFloatingBase(mArticulationData, tGravity, scratchData, false); + + allocator->free(tempMemory); + } + +#if FEATHERSTONE_DEBUG + //compare joint force + const PxU32 totalDofs = mArticulationData.getDofs(); + for (PxU32 i = 0; i < totalDofs; ++i) + { + const PxReal dif = jointForce[i] - cache.jointForce[i]; + PX_ASSERT(PxAbs(dif) < 5e-3f); + } + + PX_FREE(jointForce); +#endif + + } + + //gravity, acceleration and external force(external acceleration) are zero + void FeatherstoneArticulation::getCoriolisAndCentrifugalForce(PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Articulation::getCoriolisAndCentrifugalForce() commonInit need to be called first to initialize data!"); + return; + } + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = cache.jointVelocity; + scratchData.jointAccelerations = NULL; + scratchData.jointForces = cache.jointForce; + scratchData.externalAccels = NULL; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + inverseDynamic(mArticulationData, PxVec3(0.f), scratchData, true); + else + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, true); + + allocator->free(tempMemory); + } + + //gravity, joint acceleration and joint velocity are zero + void FeatherstoneArticulation::getGeneralizedExternalForce(PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Articulation::getCoriolisAndCentrifugalForce() commonInit need to be called first to initialize data!"); + return; + } + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + scratchData.jointVelocities = NULL; + scratchData.jointAccelerations = NULL; + scratchData.jointForces = cache.jointForce; + + Cm::SpatialVector* accels = reinterpret_cast(allocator->alloc(sizeof(Cm::SpatialVector) * linkCount)); + + //turn external forces to external accels + for (PxU32 i = 0; i < linkCount; ++i) + { + ArticulationLink& link = mArticulationData.getLink(i); + PxsBodyCore& core = *link.bodyCore; + + const PxSpatialForce& force = cache.externalForces[i]; + Cm::SpatialVector& accel = accels[i]; + + accel.linear = force.force * core.inverseMass; + + PxMat33 inverseInertiaWorldSpace; + Cm::transformInertiaTensor(core.inverseInertia, PxMat33(core.body2World.q), inverseInertiaWorldSpace); + + accel.angular = inverseInertiaWorldSpace * force.torque; + } + + scratchData.externalAccels = accels; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + inverseDynamic(mArticulationData, PxVec3(0.f), scratchData, false); + else + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, false); + + allocator->free(tempMemory); + allocator->free(accels); + } + + //provided joint acceleration, calculate joint force + void FeatherstoneArticulation::getJointForce(PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "ArticulationHelper::getJointForce() commonInit need to be called first to initialize data!"); + return; + } + + //const PxU32 size = sizeof(PxReal) * mArticulationData.getDofs(); + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + //PxReal* jointVelocities = reinterpret_cast(allocator->alloc(size)); + + ScratchData scratchData; + scratchData.jointVelocities = NULL;//jont velocity will be zero + scratchData.jointAccelerations = cache.jointAcceleration; //input + scratchData.jointForces = cache.jointForce; //output + scratchData.externalAccels = NULL; + + PxU8* tempMemory = allocateScratchSpatialData(allocator, mArticulationData.getLinkCount(), scratchData); + + //make sure joint velocity be zero + //PxMemZero(jointVelocities, sizeof(PxReal) * mArticulationData.getDofs()); + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + if (fixBase) + inverseDynamic(mArticulationData, PxVec3(0.f), scratchData, false); + else + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, false); + + //allocator->free(jointVelocities); + allocator->free(tempMemory); + } + + void FeatherstoneArticulation::jcalcLoopJointSubspace(ArticulationJointCore* joint, + ArticulationJointCoreData& jointDatum, SpatialSubspaceMatrix& T, + const Cm::UnAlignedSpatialVector* jointAxis) + { + PX_UNUSED(jointDatum); + const PxVec3 childOffset = -joint->childPose.p; + const PxVec3 zero(0.f); + + //if the column is free, we put zero for it, this is for computing K(coefficient matrix) + T.setNumColumns(6); + + //transpose(Tc)*S = 0 + //transpose(Ta)*S = 1 + switch (joint->jointType) + { + case PxArticulationJointType::ePRISMATIC: + { + PX_ASSERT(jointDatum.dof == 1); + + const PxVec3 rx = (joint->childPose.rotate(PxVec3(1.f, 0.f, 0.f))).getNormalized(); + const PxVec3 ry = (joint->childPose.rotate(PxVec3(0.f, 1.f, 0.f))).getNormalized(); + const PxVec3 rz = (joint->childPose.rotate(PxVec3(0.f, 0.f, 1.f))).getNormalized(); + + //joint->activeForceSubspace.setNumColumns(1); + + if (jointAxis[0][3] == 1.f) + { + //x is the free translation axis + T.setColumn(0, rx, zero); + T.setColumn(1, ry, zero); + T.setColumn(2, rz, zero); + T.setColumn(3, zero, zero); + T.setColumn(4, zero, ry); + T.setColumn(5, zero, rz); + + //joint->activeForceSubspace.setColumn(0, PxVec3(0.f), rx); + } + else if (jointAxis[0][4] == 1.f) + { + //y is the free translation axis + T.setColumn(0, rx, zero); + T.setColumn(1, ry, zero); + T.setColumn(2, rz, zero); + T.setColumn(3, zero, rx); + T.setColumn(4, zero, zero); + T.setColumn(5, zero, rz); + + //joint->activeForceSubspace.setColumn(0, PxVec3(0.f), ry); + } + else if (jointAxis[0][5] == 1.f) + { + //z is the free translation axis + T.setColumn(0, rx, zero); + T.setColumn(1, ry, zero); + T.setColumn(2, rx, zero); + T.setColumn(3, zero, rx); + T.setColumn(4, zero, ry); + T.setColumn(5, zero, zero); + + //joint->activeForceSubspace.setColumn(0, PxVec3(0.f), rz); + } + + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + //joint->activeForceSubspace.setNumColumns(1); + + const PxVec3 rx = (joint->childPose.rotate(PxVec3(1.f, 0.f, 0.f))).getNormalized(); + const PxVec3 ry = (joint->childPose.rotate(PxVec3(0.f, 1.f, 0.f))).getNormalized(); + const PxVec3 rz = (joint->childPose.rotate(PxVec3(0.f, 0.f, 1.f))).getNormalized(); + + const PxVec3 rxXd = rx.cross(childOffset); + const PxVec3 ryXd = ry.cross(childOffset); + const PxVec3 rzXd = rz.cross(childOffset); + + if (jointAxis[0][0] == 1.f) + { + //x is the free rotation axis + + T.setColumn(0, zero, zero); + T.setColumn(1, ry, zero); + T.setColumn(2, rz, zero); + + //joint->activeForceSubspace.setColumn(0, rx, PxVec3(0.f)); + + } + else if (jointAxis[0][1] == 1.f) + { + //y is the free rotation axis + T.setColumn(0, rx, zero); + T.setColumn(1, zero, zero); + T.setColumn(2, rz, zero); + + //joint->activeForceSubspace.setColumn(0, ry, PxVec3(0.f)); + } + else if (jointAxis[0][2] == 1.f) + { + //z is the rotation axis + T.setColumn(0, rx, zero); + T.setColumn(1, ry, zero); + T.setColumn(2, zero, zero); + + //joint->activeForceSubspace.setColumn(0, rz, PxVec3(0.f)); + } + + T.setColumn(3, rxXd, rx); + T.setColumn(4, ryXd, ry); + T.setColumn(5, rzXd, rz); + + break; + } + case PxArticulationJointType::eSPHERICAL: + { + //joint->activeForceSubspace.setNumColumns(3); + + const PxVec3 rx = (joint->childPose.rotate(PxVec3(1.f, 0.f, 0.f))).getNormalized(); + const PxVec3 ry = (joint->childPose.rotate(PxVec3(0.f, 1.f, 0.f))).getNormalized(); + const PxVec3 rz = (joint->childPose.rotate(PxVec3(0.f, 0.f, 1.f))).getNormalized(); + + const PxVec3 rxXd = rx.cross(childOffset); + const PxVec3 ryXd = ry.cross(childOffset); + const PxVec3 rzXd = rz.cross(childOffset); + + T.setColumn(0, zero, zero); + T.setColumn(1, zero, zero); + T.setColumn(2, zero, zero); + + T.setColumn(3, rxXd, rx); + T.setColumn(4, ryXd, ry); + T.setColumn(5, rzXd, rz); + + //need to implement constraint force subspace matrix and active force subspace matrix + + break; + } + case PxArticulationJointType::eFIX: + { + //joint->activeForceSubspace.setNumColumns(0); + //T.setNumColumns(6); + + /* const PxVec3 rx = (joint->childPose.rotate(PxVec3(1.f, 0.f, 0.f))).getNormalized(); + const PxVec3 ry = (joint->childPose.rotate(PxVec3(0.f, 1.f, 0.f))).getNormalized(); + const PxVec3 rz = (joint->childPose.rotate(PxVec3(0.f, 0.f, 1.f))).getNormalized(); + + T.setColumn(0, rx, PxVec3(0.f)); + T.setColumn(1, ry, PxVec3(0.f)); + T.setColumn(2, rz, PxVec3(0.f)); + T.setColumn(3, PxVec3(0.f), rx); + T.setColumn(4, PxVec3(0.f), ry); + T.setColumn(5, PxVec3(0.f), rz); + */ + + T.setColumn(0, PxVec3(1.f, 0.f, 0.f), zero); + T.setColumn(1, PxVec3(0.f, 1.f, 0.f), zero); + T.setColumn(2, PxVec3(0.f, 0.f, 1.f), zero); + T.setColumn(3, zero, PxVec3(1.f, 0.f, 0.f)); + T.setColumn(4, zero, PxVec3(0.f, 1.f, 0.f)); + T.setColumn(5, zero, PxVec3(0.f, 0.f, 1.f)); + + PX_ASSERT(jointDatum.dof == 0); + break; + } + default: + break; + + } + } + + //This method supports just one loopJoint + void FeatherstoneArticulation::getKMatrix(ArticulationJointCore* loopJoint, const PxU32 parentIndex, const PxU32 childIndex, PxArticulationCache& cache) + { + PX_UNUSED(loopJoint); + PX_UNUSED(parentIndex); + PX_UNUSED(childIndex); + PX_UNUSED(cache); + + ////initialize all tree links motion subspace matrix + //jcalc(mArticulationData); + + ////linkID is the parent link, ground is the child link so child link is the fix base + //ArticulationLinkData& pLinkDatum = mArticulationData.getLinkData(parentIndex); + + //ArticulationLink& cLink = mArticulationData.getLink(childIndex); + //ArticulationLinkData& cLinkDatum = mArticulationData.getLinkData(childIndex); + // + //ArticulationJointCoreData loopJointDatum; + //loopJointDatum.computeJointDof(loopJoint); + + ////this is constraintForceSubspace in child body space(T) + //SpatialSubspaceMatrix T; + + ////loop joint constraint subspace matrix(T) + //jcalcLoopJointSubspace(loopJoint, loopJointDatum, T); + + //const PxU32 linkCount = mArticulationData.getLinkCount(); + ////set Jacobian matrix to be zero + //PxMemZero(cache.jacobian, sizeof(PxKinematicJacobian) * linkCount); + + ////transform T to world space + //PxTransform& body2World = cLink.bodyCore->body2World; + + //for (PxU32 ind = 0; ind < T.getNumColumns(); ++ind) + //{ + // Cm::SpatialVectorF& column = T[ind]; + // T.setColumn(ind, body2World.rotate(column.top), body2World.rotate(column.bottom)); + //} + + //const Cm::SpatialVectorF& pAccel = pLinkDatum.motionAcceleration; + //const Cm::SpatialVectorF& cAccel = cLinkDatum.motionAcceleration; + + //const Cm::SpatialVectorF& pVel = pLinkDatum.motionVelocity; + //const Cm::SpatialVectorF& cVel = cLinkDatum.motionVelocity; + + //Cm::SpatialVectorF k = (pAccel - cAccel) + pVel.cross(cVel); + //k = T.transposeMultiply(k); + //k = -k; + + //PxU32 i = childIndex; + //PxU32 j = parentIndex; + + //PxU32* index = NULL; + + //while (i != j) + //{ + // if (i > j) + // index = &i; + // else + // index = &j; + + // const PxU32 linkIndex = *index; + + // PxKinematicJacobian* K = cache.jacobian + linkIndex; + + // ArticulationLink& link = mArticulationData.getLink(linkIndex); + + // ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkIndex); + + // SpatialSubspaceMatrix& S = jointDatum.motionMatrix; + + // PxTransform& tBody2World = link.bodyCore->body2World; + + // Cm::SpatialVectorF res; + // for (PxU32 ind = 0; ind < S.getNumColumns(); ++ind) + // { + // Cm::SpatialVectorF& sCol = S[ind]; + + // //transform spatial axis into world space + // sCol.top = tBody2World.rotate(sCol.top); + // sCol.bottom = tBody2World.rotate(sCol.bottom); + + // res = T.transposeMultiply(sCol); + // res = -res; + + // PxReal* kSubMatrix = K->j[ind]; + + // kSubMatrix[0] = res.top.x; kSubMatrix[1] = res.top.y; kSubMatrix[2] = res.top.z; + // kSubMatrix[3] = res.bottom.x; kSubMatrix[4] = res.bottom.y; kSubMatrix[5] = res.bottom.z; + // } + + // //overwrite either i or j to its parent index + // *index = link.parent; + //} + } + + + void FeatherstoneArticulation::getCoefficientMatrix(const PxReal dt, const PxU32 linkID, const PxContactJoint* contactJoints, const PxU32 nbContacts, PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "ArticulationHelper::getCoefficientMatrix() commonInit need to be called first to initialize data!"); + return; + } + + computeArticulatedSpatialInertia(mArticulationData); + + ArticulationLink* links = mArticulationData.getLinks(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxReal* coefficientMatrix = cache.coefficientMatrix; + + const PxU32 elementCount = mArticulationData.getDofs(); + + //zero coefficient matrix + PxMemZero(coefficientMatrix, sizeof(PxReal) * elementCount * nbContacts); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + for (PxU32 a = 0; a < nbContacts; ++a) + { + PxJacobianRow row; + contactJoints[a].computeJacobians(&row); + + //impulse lin is contact normal, and ang is raxn. R is body2World, R(t) is world2Body + //| R(t), 0 | + //| R(t)*r, R(t)| + //r is the vector from center of mass to contact point + //p(impluse) = |n| + // |0| + + //transform p(impluse) from work space to the local space of link + ArticulationLink& link = links[linkID]; + PxTransform& body2World = link.bodyCore->body2World; + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + Cm::SpatialVectorF* Z = scratchData.spatialZAVectors; + + //make sure all links' spatial zero acceleration impulse are zero + PxMemZero(Z, sizeof(Cm::SpatialVectorF) * linkCount); + + const Cm::SpatialVectorF impl(body2World.rotateInv(row.linear0), body2World.rotateInv(row.angular0)); + + getZ(linkID, mArticulationData, Z, impl); + + const PxU32 totalDofs = mArticulationData.getDofs(); + + const PxU32 size = sizeof(PxReal) * totalDofs; + + PxU8* tData = reinterpret_cast(allocator->alloc(size * 2)); + + PxReal* jointVelocities = reinterpret_cast(tData); + PxReal* jointAccelerations = reinterpret_cast(tData + size); + //zero joint Velocites + PxMemZero(jointVelocities, size); + + getDeltaVWithDeltaJV(fixBase, linkID, mArticulationData, Z, jointVelocities); + + const PxReal invDt = 1.f / dt; + //calculate joint acceleration due to velocity change + for (PxU32 i = 0; i < totalDofs; ++i) + { + jointAccelerations[i] = jointVelocities[i] * invDt; + } + + //compute individual link's spatial inertia tensor. This is very important + computeSpatialInertia(mArticulationData); + + PxReal* coeCol = &coefficientMatrix[elementCount * a]; + + //this means the joint force calculated by the inverse dynamic + //will be just influenced by joint acceleration change + scratchData.jointVelocities = NULL; + scratchData.externalAccels = NULL; + + //Input + scratchData.jointAccelerations = jointAccelerations; + + //a column of the coefficient matrix is the joint force + scratchData.jointForces = coeCol; + + if (fixBase) + { + inverseDynamic(mArticulationData, PxVec3(0.f), scratchData, false); + } + else + { + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, false); + } + + allocator->free(tData); + allocator->free(tempMemory); + } + } + + void FeatherstoneArticulation::getImpulseResponseSlowInv(Dy::ArticulationLink* links, + const ArticulationData& data, + PxU32 linkID0_, + const Cm::SpatialVector& impulse0, + Cm::SpatialVector& deltaV0, + PxU32 linkID1_, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV1, + PxReal* jointVelocities, + Cm::SpatialVectorF* Z) + { + PX_UNUSED(jointVelocities); + + const PxU32 numLinks = data.getLinkCount(); + + PX_ALLOCA(_stack, PxU32, numLinks); + PxU32* stack = _stack; + + PxU32 i0, i1, ic; + + PxU32 linkID0 = linkID0_; + PxU32 linkID1 = linkID1_; + + + for (i0 = linkID0, i1 = linkID1; i0 != i1;) // find common path + { + if (i0 i1;) + { + const PxU32 id = stack[index]; + const PxU32 jointOffset = mArticulationData.getJointData(id).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(id).dof; + v = FeatherstoneArticulation::propagateVelocityW(data.getRw(id), data.mWorldSpatialArticulatedInertia[id], + data.mInvStIs[id], &data.getWorldMotionMatrix(jointOffset), Z[id], jointVelocities, v, dofCount); + } + + //Replace everything to here with the impulse response matrix multiply + + Cm::SpatialVectorF dv1 = v; + for (PxU32 index = i1; (index--) > i0;) + { + const PxU32 id = stack[index]; + const PxU32 jointOffset = mArticulationData.getJointData(id).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(id).dof; + dv1 = FeatherstoneArticulation::propagateVelocityW(data.getRw(id), data.mWorldSpatialArticulatedInertia[id], + data.mInvStIs[id], &data.getWorldMotionMatrix(jointOffset), Z[id], jointVelocities, v, dofCount); + } + + Cm::SpatialVectorF dv0 = v; + for (PxU32 index = i0; (index--) > 0;) + { + const PxU32 id = stack[index]; + const PxU32 jointOffset = mArticulationData.getJointData(id).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(id).dof; + dv0 = FeatherstoneArticulation::propagateVelocityW(data.getRw(id), data.mWorldSpatialArticulatedInertia[id], + data.mInvStIs[id], &data.getWorldMotionMatrix(jointOffset), Z[id], jointVelocities, v, dofCount); + } + + deltaV0.linear = dv0.bottom; + deltaV0.angular = dv0.top; + + deltaV1.linear = dv1.bottom; + deltaV1.angular = dv1.top; + } + + void FeatherstoneArticulation::getImpulseSelfResponseInv(const bool fixBase, + PxU32 linkID0, + PxU32 linkID1, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse0, + const Cm::SpatialVector& impulse1, + Cm::SpatialVector& deltaV0, + Cm::SpatialVector& deltaV1, + PxReal* jointVelocities) + { + ArticulationLink* links = mArticulationData.getLinks(); + + //transform p(impluse) from work space to the local space of link + ArticulationLink& link = links[linkID1]; + //ArticulationLinkData& linkDatum = mArticulationData.getLinkData(linkID1); + + if (link.parent == linkID0) + { + PX_ASSERT(linkID0 == link.parent); + PX_ASSERT(linkID0 < linkID1); + + //impulse is in world space + const Cm::SpatialVector& imp1 = impulse1; + const Cm::SpatialVector& imp0 = impulse0; + + + Cm::SpatialVectorF pImpulse(imp0.linear, imp0.angular); + + PX_ASSERT(linkID0 == link.parent); + + const PxU32 jointOffset = mArticulationData.getJointData(linkID1).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(linkID1).dof; + + //initialize child link spatial zero acceleration impulse + Cm::SpatialVectorF Z1(-imp1.linear, -imp1.angular); + //this calculate parent link spatial zero acceleration impulse + Cm::SpatialVectorF Z0 = FeatherstoneArticulation::propagateImpulseW(&mArticulationData.mIsInvDW[jointOffset], mArticulationData.getRw(linkID1), &mArticulationData.mWorldMotionMatrix[jointOffset], Z1, dofCount); + + //in parent space + const Cm::SpatialVectorF impulseDif = pImpulse - Z0; + + Cm::SpatialVectorF delV0(PxVec3(0.f), PxVec3(0.f)); + Cm::SpatialVectorF delV1(PxVec3(0.f), PxVec3(0.f)); + + //calculate velocity change start from the parent link to the root + delV0 = FeatherstoneArticulation::getImpulseResponseWithJ(linkID0, fixBase, mArticulationData, Z, impulseDif, jointVelocities); + + //calculate velocity change for child link + delV1 = FeatherstoneArticulation::propagateVelocityW(mArticulationData.getRw(linkID1), + mArticulationData.mWorldSpatialArticulatedInertia[linkID1], mArticulationData.mInvStIs[linkID1], + &mArticulationData.mWorldMotionMatrix[jointOffset], Z1, jointVelocities, delV0, dofCount); + + //translate delV0 and delV1 into world space again + deltaV0.linear = delV0.bottom; + deltaV0.angular = delV0.top; + deltaV1.linear = delV1.bottom; + deltaV1.angular = delV1.top; + } + else + { + getImpulseResponseSlowInv(links, mArticulationData, linkID0, impulse0, deltaV0, linkID1,impulse1, deltaV1, jointVelocities, Z); + } + } + + Cm::SpatialVectorF FeatherstoneArticulation::getImpulseResponseInv( + const bool fixBase, const PxU32 linkID, + Cm::SpatialVectorF* Z, + const Cm::SpatialVector& impulse, + PxReal* jointVelocities) + { + //impulse lin is contact normal, and ang is raxn. R is body2World, R(t) is world2Body + //| R(t), 0 | + //| R(t)*r, R(t)| + //r is the vector from center of mass to contact point + //p(impluse) = |n| + // |0| + + ArticulationLink* links = mArticulationData.getLinks(); + //ArticulationLinkData* linkData = mArticulationData.getLinkData(); + ArticulationJointCoreData* jointData = mArticulationData.getJointData(); + const PxU32 linkCount = mArticulationData.getLinkCount(); + + //make sure all links' spatial zero acceleration impulse are zero + PxMemZero(Z, sizeof(Cm::SpatialVectorF) * linkCount); + + Z[linkID] = Cm::SpatialVectorF(-impulse.linear, -impulse.angular); + + for (PxU32 i = linkID; i; i = links[i].parent) + { + ArticulationLink& tLink = links[i]; + const PxU32 jointOffset = mArticulationData.getJointData(i).jointOffset; + const PxU32 dofCount = mArticulationData.getJointData(i).dof; + //ArticulationLinkData& tLinkDatum = linkData[i]; + Z[tLink.parent] = propagateImpulseW(&mArticulationData.mIsInvDW[jointOffset], mArticulationData.getRw(i), + &mArticulationData.mWorldMotionMatrix[jointOffset], Z[i], dofCount); + } + + //set velocity change of the root link to be zero + Cm::SpatialVectorF deltaV = Cm::SpatialVectorF(PxVec3(0.f), PxVec3(0.f)); + if (!fixBase) + deltaV = mArticulationData.mBaseInvSpatialArticulatedInertiaW * (-Z[0]); + + const PxU32 startIndex = links[linkID].mPathToRootStartIndex; + const PxU32 numElems = links[linkID].mPathToRootCount; + + const PxU32* pathToRoot = &mArticulationData.mPathToRootElements[startIndex]; + + for(PxU32 i = 0; i < numElems; ++i) + { + const PxU32 index = pathToRoot[i]; + PX_ASSERT(links[index].parent < index); + + ArticulationJointCoreData& tJointDatum = jointData[index]; + + PxReal* jVelocity = &jointVelocities[tJointDatum.jointOffset]; + deltaV = propagateVelocityW(mArticulationData.getRw(index), mArticulationData.mWorldSpatialArticulatedInertia[index], + mArticulationData.mInvStIs[index], &mArticulationData.mWorldMotionMatrix[tJointDatum.jointOffset], Z[index], jVelocity, deltaV, tJointDatum.dof); + } + + + return deltaV; + + } + + + void FeatherstoneArticulation::getCoefficientMatrixWithLoopJoints(ArticulationLoopConstraint* lConstraints, const PxU32 nbConstraints, PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "ArticulationHelper::getCoefficientMatrix() commonInit need to be called first to initialize data!"); + return; + } + + computeArticulatedSpatialInertia(mArticulationData); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxReal* coefficientMatrix = cache.coefficientMatrix; + + const PxU32 elementCount = mArticulationData.getDofs(); + + //zero coefficient matrix + PxMemZero(coefficientMatrix, sizeof(PxReal) * elementCount * nbConstraints); + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + Cm::SpatialVectorF* Z = scratchData.spatialZAVectors; + const PxU32 totalDofs = mArticulationData.getDofs(); + + const PxU32 size = sizeof(PxReal) * totalDofs; + + PxU8* tData = reinterpret_cast(allocator->alloc(size * 2)); + + const PxReal invDt = 1.f / mArticulationData.getDt(); + PxReal* jointVelocities = reinterpret_cast(tData); + PxReal* jointAccelerations = reinterpret_cast(tData + size); + + for (PxU32 a = 0; a < nbConstraints; ++a) + { + ArticulationLoopConstraint& lConstraint = lConstraints[a]; + Constraint* aConstraint = lConstraint.constraint; + + Px1DConstraint rows[MAX_CONSTRAINT_ROWS]; + setupConstraintRows(rows, MAX_CONSTRAINT_ROWS); + + const PxTransform idt(PxIdentity); + const PxTransform& body2World0 = aConstraint->body0 ? aConstraint->bodyCore0->body2World : idt; + const PxTransform& body2World1 = aConstraint->body1 ? aConstraint->bodyCore1->body2World : idt; + + PxVec3p unused_body0WorldOffset(0.0f); + PxVec3p unused_ra, unused_rb; + PxConstraintInvMassScale unused_invMassScales; + //TAG:solverprepcall + PxU32 constraintCount = (*aConstraint->solverPrep)(rows, + unused_body0WorldOffset, + MAX_CONSTRAINT_ROWS, + unused_invMassScales, + aConstraint->constantBlock, + body2World0, body2World1, !!(aConstraint->flags & PxConstraintFlag::eENABLE_EXTENDED_LIMITS), unused_ra, unused_rb); + + const PxU32 linkIndex0 = lConstraint.linkIndex0; + const PxU32 linkIndex1 = lConstraint.linkIndex1; + + //zero joint Velocites + PxMemZero(jointVelocities, size); + + for (PxU32 j = 0; j < constraintCount; ++j) + { + Px1DConstraint& row = rows[j]; + + if (linkIndex0 != 0x80000000 && linkIndex1 != 0x80000000) + { + const bool flip = linkIndex0 > linkIndex1; + + Cm::SpatialVector impulse0(row.linear0, row.angular0); + Cm::SpatialVector impulse1(row.linear1, row.angular1); + + Cm::SpatialVector deltaV0, deltaV1; + + if (flip) + { + getImpulseSelfResponseInv(fixBase, linkIndex1, linkIndex0, Z, impulse1, impulse0, + deltaV1, deltaV0, jointVelocities); + } + else + { + getImpulseSelfResponseInv(fixBase, linkIndex0, linkIndex1, Z, impulse0, impulse1, + deltaV0, deltaV1, jointVelocities); + } + } + else + { + if (linkIndex0 == 0x80000000) + { + Cm::SpatialVector impulse1(row.linear1, row.angular1); + getImpulseResponseInv(fixBase, linkIndex1, Z, impulse1, jointVelocities); + } + else + { + Cm::SpatialVector impulse0(row.linear0, row.angular0); + getImpulseResponseInv(fixBase, linkIndex0, Z, impulse0, jointVelocities); + } + } + } + + //calculate joint acceleration due to velocity change + for (PxU32 i = 0; i < totalDofs; ++i) + { + jointAccelerations[i] = jointVelocities[i] * invDt; + } + + //reset spatial inertia + computeSpatialInertia(mArticulationData); + + PxReal* coeCol = &coefficientMatrix[elementCount * a]; + + //this means the joint force calculated by the inverse dynamic + //will be just influenced by joint acceleration change + scratchData.jointVelocities = NULL; + scratchData.externalAccels = NULL; + + //Input + scratchData.jointAccelerations = jointAccelerations; + + //a column of the coefficient matrix is the joint force + scratchData.jointForces = coeCol; + + if (fixBase) + { + inverseDynamic(mArticulationData, PxVec3(0.f), scratchData, false); + } + else + { + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, false); + } + + allocator->free(tData); + allocator->free(tempMemory); + } + } + + void FeatherstoneArticulation::constraintPrep(ArticulationLoopConstraint* lConstraints, + const PxU32 nbJoints, Cm::SpatialVectorF* Z, PxSolverConstraintPrepDesc& prepDesc, + PxSolverBody& sBody, PxSolverBodyData& sBodyData, PxSolverConstraintDesc* descs, + PxConstraintAllocator& allocator) + { + const PxReal dt = mArticulationData.getDt(); + const PxReal invDt = 1.f / dt; + //constraint prep + for (PxU32 a = 0; a < nbJoints; ++a) + { + ArticulationLoopConstraint& lConstraint = lConstraints[a]; + Constraint* aConstraint = lConstraint.constraint; + + PxSolverConstraintDesc& desc = descs[a]; + prepDesc.desc = &desc; + prepDesc.linBreakForce = aConstraint->linBreakForce; + prepDesc.angBreakForce = aConstraint->angBreakForce; + prepDesc.writeback = &mContext->getConstraintWriteBackPool()[aConstraint->index]; + setupConstraintFlags(prepDesc, aConstraint->flags); + prepDesc.minResponseThreshold = aConstraint->minResponseThreshold; + + Px1DConstraint rows[MAX_CONSTRAINT_ROWS]; + setupConstraintRows(rows, MAX_CONSTRAINT_ROWS); + + prepDesc.invMassScales.linear0 = prepDesc.invMassScales.linear1 = prepDesc.invMassScales.angular0 = prepDesc.invMassScales.angular1 = 1.0f; + prepDesc.body0WorldOffset = PxVec3(0.0f); + + const PxTransform idt(PxIdentity); + const PxTransform& body2World0 = aConstraint->body0 ? aConstraint->bodyCore0->body2World : idt; + const PxTransform& body2World1 = aConstraint->body1 ? aConstraint->bodyCore1->body2World : idt; + + PxVec3p unused_ra, unused_rb; + PxConstraintInvMassScale unused_invMassScales; + + //TAG:solverprepcall + prepDesc.numRows = (*aConstraint->solverPrep)(rows, + prepDesc.body0WorldOffset, + MAX_CONSTRAINT_ROWS, + unused_invMassScales, + aConstraint->constantBlock, + body2World0, body2World1, !!(aConstraint->flags & PxConstraintFlag::eENABLE_EXTENDED_LIMITS), + unused_ra, unused_rb); + + prepDesc.bodyFrame0 = body2World0; + prepDesc.bodyFrame1 = body2World1; + prepDesc.rows = rows; + + const PxU32 linkIndex0 = lConstraint.linkIndex0; + const PxU32 linkIndex1 = lConstraint.linkIndex1; + + if (linkIndex0 != 0x80000000 && linkIndex1 != 0x80000000) + { + desc.articulationA = this; + desc.articulationB = this; + desc.linkIndexA = PxTo8(linkIndex0); + desc.linkIndexB = PxTo8(linkIndex1); + + desc.bodyA = reinterpret_cast(this); + desc.bodyB = reinterpret_cast(this); + + prepDesc.bodyState0 = PxSolverConstraintPrepDescBase::eARTICULATION; + prepDesc.bodyState1 = PxSolverConstraintPrepDescBase::eARTICULATION; + + } + else if (linkIndex0 == 0x80000000) + { + desc.articulationA = NULL; + desc.articulationB = this; + + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + desc.linkIndexB = PxTo8(linkIndex1); + + desc.bodyA = &sBody; + desc.bodyB = reinterpret_cast(this); + + prepDesc.bodyState0 = PxSolverConstraintPrepDescBase::eSTATIC_BODY; + prepDesc.bodyState1 = PxSolverConstraintPrepDescBase::eARTICULATION; + } + else if (linkIndex1 == 0x80000000) + { + desc.articulationA = this; + desc.articulationB = NULL; + + desc.linkIndexA = PxTo8(linkIndex0); + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + + desc.bodyA = reinterpret_cast(this); + desc.bodyB = &sBody; + + prepDesc.bodyState0 = PxSolverConstraintPrepDescBase::eARTICULATION; + prepDesc.bodyState1 = PxSolverConstraintPrepDescBase::eSTATIC_BODY; + + } + + prepDesc.body0 = desc.bodyA; + prepDesc.body1 = desc.bodyB; + prepDesc.data0 = &sBodyData; + prepDesc.data1 = &sBodyData; + + ConstraintHelper::setupSolverConstraint(prepDesc, allocator, dt, invDt, Z); + } + + } + + class BlockBasedAllocator + { + struct AllocationPage + { + static const PxU32 PageSize = 32 * 1024; + PxU8 mPage[PageSize]; + + PxU32 currentIndex; + + AllocationPage() : currentIndex(0) {} + + PxU8* allocate(const PxU32 size) + { + PxU32 alignedSize = (size + 15)&(~15); + if ((currentIndex + alignedSize) < PageSize) + { + PxU8* ret = &mPage[currentIndex]; + currentIndex += alignedSize; + return ret; + } + return NULL; + } + }; + + AllocationPage* currentPage; + + physx::PxArray mAllocatedBlocks; + PxU32 mCurrentIndex; + + public: + BlockBasedAllocator() : currentPage(NULL), mCurrentIndex(0) + { + } + + virtual PxU8* allocate(const PxU32 byteSize) + { + if (currentPage) + { + PxU8* data = currentPage->allocate(byteSize); + if (data) + return data; + } + + if (mCurrentIndex < mAllocatedBlocks.size()) + { + currentPage = mAllocatedBlocks[mCurrentIndex++]; + currentPage->currentIndex = 0; + return currentPage->allocate(byteSize); + } + currentPage = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(AllocationPage), "AllocationPage"), AllocationPage)(); + mAllocatedBlocks.pushBack(currentPage); + mCurrentIndex = mAllocatedBlocks.size(); + + return currentPage->allocate(byteSize); + } + + void release() { for (PxU32 a = 0; a < mAllocatedBlocks.size(); ++a) PX_FREE(mAllocatedBlocks[a]); mAllocatedBlocks.clear(); currentPage = NULL; mCurrentIndex = 0; } + + void reset() { currentPage = NULL; mCurrentIndex = 0; } + + virtual ~BlockBasedAllocator() + { + release(); + } + }; + + class ArticulationBlockAllocator : public PxConstraintAllocator + { + BlockBasedAllocator mConstraintAllocator; + BlockBasedAllocator mFrictionAllocator[2]; + + PxU32 currIdx; + + public: + + ArticulationBlockAllocator() : currIdx(0) + { + } + + virtual ~ArticulationBlockAllocator() {} + + virtual PxU8* reserveConstraintData(const PxU32 size) + { + return reinterpret_cast(mConstraintAllocator.allocate(size)); + } + + virtual PxU8* reserveFrictionData(const PxU32 byteSize) + { + return reinterpret_cast(mFrictionAllocator[currIdx].allocate(byteSize)); + } + + void release() { currIdx = 1 - currIdx; mConstraintAllocator.release(); mFrictionAllocator[currIdx].release(); } + + PX_NOCOPY(ArticulationBlockAllocator) + + }; + + void solveExt1D(const PxSolverConstraintDesc& desc, SolverContext& cache); + void writeBack1D(const PxSolverConstraintDesc& desc, SolverContext&, PxSolverBodyData&, PxSolverBodyData&); + void conclude1D(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/); + void clearExt1D(const PxSolverConstraintDesc& desc, SolverContext& cache); + + bool FeatherstoneArticulation::getLambda(ArticulationLoopConstraint* lConstraints, const PxU32 nbJoints, + PxArticulationCache& cache, PxArticulationCache& initialState, + const PxReal* jointTorque, const PxVec3& gravity, const PxU32 maxIter, const PxReal invLengthScale) + { + const PxReal dt = mArticulationData.getDt(); + const PxReal invDt = 1.f / dt; + const PxU32 totalDofs = mArticulationData.getDofs(); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + ArticulationBlockAllocator bAlloc; + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + Cm::SpatialVectorF* Z = reinterpret_cast(allocator->alloc(sizeof(Cm::SpatialVectorF) * linkCount, true)); + Cm::SpatialVectorF* deltaV = reinterpret_cast(allocator->alloc(sizeof(Cm::SpatialVectorF) * linkCount, true)); + + PxReal* prevoiusLambdas =reinterpret_cast(allocator->alloc(sizeof(PxReal)*nbJoints * 2, true)); + PxReal* lambdas = cache.lambda; + + //this is the joint force changed caused by contact force based on impulse strength is 1 + PxReal* J = cache.coefficientMatrix; + + PxSolverBody staticSolverBody; + PxMemZero(&staticSolverBody, sizeof(PxSolverBody)); + PxSolverBodyData staticSolverBodyData; + PxMemZero(&staticSolverBodyData, sizeof(PxSolverBodyData)); + staticSolverBodyData.maxContactImpulse = PX_MAX_F32; + staticSolverBodyData.penBiasClamp = -PX_MAX_F32; + staticSolverBodyData.body2World = PxTransform(PxIdentity); + + Dy::SolverContext context; + context.Z = Z; + context.deltaV = deltaV; + context.doFriction = false; + + + PxSolverConstraintDesc* desc = reinterpret_cast(allocator->alloc(sizeof(PxSolverConstraintDesc) * nbJoints, true)); + ArticulationSolverDesc artiDesc; + + PxSolverConstraintDesc* constraintDescs = reinterpret_cast(allocator->alloc(sizeof(PxSolverConstraintDesc) * mArticulationData.getLinkCount()-1, true)); + + //run forward dynamic to calculate the lamba + + artiDesc.articulation = this; + PxU32 acCount = 0; + computeUnconstrainedVelocities(artiDesc, dt, acCount, + gravity, Z, deltaV, invLengthScale); + + ScratchData scratchData; + scratchData.motionVelocities = mArticulationData.getMotionVelocities(); + scratchData.motionAccelerations = mArticulationData.getMotionAccelerations(); + scratchData.coriolisVectors = mArticulationData.getCorioliseVectors(); + scratchData.spatialZAVectors = mArticulationData.getSpatialZAVectors(); + scratchData.jointAccelerations = mArticulationData.getJointAccelerations(); + scratchData.jointVelocities = mArticulationData.getJointVelocities(); + scratchData.jointPositions = mArticulationData.getJointPositions(); + scratchData.jointForces = mArticulationData.getJointForces(); + scratchData.externalAccels = mArticulationData.getExternalAccelerations(); + + //prepare constraint data + PxSolverConstraintPrepDesc prepDesc; + constraintPrep(lConstraints, nbJoints, Z, prepDesc, staticSolverBody, + staticSolverBodyData, desc, bAlloc); + + for (PxU32 i = 0; i < nbJoints; ++i) + { + prevoiusLambdas[i] = PX_MAX_F32; + } + + bool found = true; + + for (PxU32 iter = 0; iter < maxIter; ++iter) + { + found = true; + for (PxU32 i = 0; i < nbJoints; ++i) + { + clearExt1D(desc[i], context); + } + + //solve + for (PxU32 itr = 0; itr < 4; itr++) + { + for (PxU32 i = 0; i < nbJoints; ++i) + { + solveExt1D(desc[i], context); + } + } + for (PxU32 i = 0; i < nbJoints; ++i) + { + conclude1D(desc[i], context); + } + + PxcFsFlushVelocity(*this, deltaV, false); + + for (PxU32 i = 0; i < nbJoints; ++i) + { + solveExt1D(desc[i], context); + writeBack1D(desc[i], context, staticSolverBodyData, staticSolverBodyData); + } + + PxReal eps = 1e-5f; + for (PxU32 i = 0; i < nbJoints; ++i) + { + Dy::Constraint* constraint = lConstraints->constraint; + + Dy::ConstraintWriteback& solverOutput = mContext->getConstraintWriteBackPool()[constraint->index]; + PxVec3 linearForce = solverOutput.linearImpulse * invDt; + + //linear force is normalize so lambda is the magnitude of linear force + lambdas[i] = linearForce.magnitude() * dt; + + const PxReal dif = PxAbs(prevoiusLambdas[i] - lambdas[i]); + if (dif > eps) + found = false; + + prevoiusLambdas[i] = lambdas[i]; + } + + if (found) + break; + + //joint force + PxReal* jf3 = cache.jointForce; + + //zero the joint force buffer + PxMemZero(jf3, sizeof(PxReal)*totalDofs); + + for (PxU32 colInd = 0; colInd < nbJoints; ++colInd) + { + PxReal* col = &J[colInd * totalDofs]; + + for (PxU32 j = 0; j < totalDofs; ++j) + { + jf3[j] += col[j] * lambdas[colInd]; + } + } + + //jointTorque is M(q)*qddot + C(q,qdot)t - g(q) + //jointTorque - J*lambda. + for (PxU32 j = 0; j < totalDofs; ++j) + { + jf3[j] = jointTorque[j] - jf3[j]; + } + + bool shouldWake = false; + //reset all joint velocities/ + applyCache(initialState, PxArticulationCacheFlag::eALL, shouldWake); + + //copy constraint torque to internal data + applyCache(cache, PxArticulationCacheFlag::eFORCE, shouldWake); + + mArticulationData.init(); + + computeLinkVelocities(mArticulationData, scratchData); + computeZ(mArticulationData, gravity, scratchData); + computeArticulatedSpatialZ(mArticulationData, scratchData); + computeLinkAcceleration(mArticulationData, scratchData, true); + + //zero zero acceleration vector in the articulation data so that we can use this buffer to accumulated + //impulse for the contacts/constraints in the PGS/TGS solvers + PxMemZero(mArticulationData.getSpatialZAVectors(), sizeof(Cm::SpatialVectorF) * linkCount); + } + + allocator->free(constraintDescs); + allocator->free(prevoiusLambdas); + allocator->free(Z); + allocator->free(deltaV); + allocator->free(desc); + bAlloc.release(); + + bool shouldWake = false; + //roll back to the current stage + applyCache(initialState, PxArticulationCacheFlag::eALL, shouldWake); + + return found; + + } + + //i is the current link ID, we need to compute the row/column related to the joint i with all the other joints + PxU32 computeHi(ArticulationData& data, const PxU32 linkID, PxReal* massMatrix, Cm::SpatialVectorF* f) + { + ArticulationLink* links = data.getLinks(); + + ArticulationJointCoreData& jointDatum = data.getJointData(linkID); + + const PxU32 totalDofs = data.getDofs(); + + //Hii + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + const PxU32 row = (jointDatum.jointOffset + ind)* totalDofs; + const Cm::SpatialVectorF& tf = f[ind]; + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const PxU32 col = jointDatum.jointOffset + ind2; + const Cm::UnAlignedSpatialVector& sa = data.getWorldMotionMatrix(jointDatum.jointOffset + ind2); + massMatrix[row + col] = sa.innerProduct(tf); + } + } + + PxU32 j = linkID; + + ArticulationLink* jLink = &links[j]; + while (jLink->parent != 0) + { + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + //f[ind] = data.getChildToParent(j) * f[ind]; + f[ind] = FeatherstoneArticulation::translateSpatialVector(data.getRw(j), f[ind]); + } + + //assign j to the parent link + j = jLink->parent; + jLink = &links[j]; + + //Hij + ArticulationJointCoreData& pJointDatum = data.getJointData(j); + + for (PxU32 ind = 0; ind < pJointDatum.dof; ++ind) + { + const Cm::UnAlignedSpatialVector& sa = data.getWorldMotionMatrix(pJointDatum.jointOffset + ind); + const PxU32 col = pJointDatum.jointOffset + ind; + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const PxU32 row = (jointDatum.jointOffset + ind2)* totalDofs; + + Cm::SpatialVectorF& fcol = f[ind2]; + + massMatrix[row + col] = sa.innerProduct(fcol); + } + } + + //Hji = transpose(Hij) + { + for (PxU32 ind = 0; ind < pJointDatum.dof; ++ind) + { + const PxU32 pRow = (pJointDatum.jointOffset + ind)* totalDofs; + const PxU32 col = pJointDatum.jointOffset + ind; + + for (PxU32 ind2 = 0; ind2 < jointDatum.dof; ++ind2) + { + const PxU32 pCol = jointDatum.jointOffset + ind2; + const PxU32 row = (jointDatum.jointOffset + ind2) * totalDofs; + + massMatrix[pRow + pCol] = massMatrix[row + col]; + } + } + } + + } + return j; + } + + void FeatherstoneArticulation::calculateHFixBase(PxArticulationCache& cache) + { + const PxU32 elementCount = mArticulationData.getDofs(); + + PxReal* massMatrix = cache.massMatrix; + + PxMemZero(massMatrix, sizeof(PxReal) * elementCount * elementCount); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ArticulationLink* links = mArticulationData.getLinks(); + + const PxU32 startIndex = PxU32(linkCount - 1); + + Dy::SpatialMatrix* compositeSpatialInertia = reinterpret_cast(allocator->alloc(sizeof(Dy::SpatialMatrix) * linkCount)); + + //initialize composite spatial inertial + initCompositeSpatialInertia(mArticulationData, compositeSpatialInertia); + + Cm::SpatialVectorF F[6]; + for (PxU32 i = startIndex; i > 0; --i) + { + ArticulationLink& link = links[i]; + + Dy::SpatialMatrix cSpatialInertia = compositeSpatialInertia[i]; + //transform current link's spatial inertia to parent's space + PxVec3 rw = link.bodyCore->body2World.p - links[link.parent].bodyCore->body2World.p; + FeatherstoneArticulation::translateInertia(FeatherstoneArticulation::constructSkewSymmetricMatrix(rw), cSpatialInertia); + + //compute parent's composite spatial inertia + compositeSpatialInertia[link.parent] += cSpatialInertia; + + Dy::SpatialMatrix& tSpatialInertia = compositeSpatialInertia[i]; + + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(i); + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::UnAlignedSpatialVector& sa = mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind]; + Cm::UnAlignedSpatialVector tmp = tSpatialInertia* sa; + F[ind].top = tmp.top; + F[ind].bottom = tmp.bottom; + } + + //Hii, Hij, Hji + computeHi(mArticulationData, i, massMatrix, F); + } + + allocator->free(compositeSpatialInertia); + } + + + void FeatherstoneArticulation::calculateHFloatingBase(PxArticulationCache& cache) + { + const PxU32 elementCount = mArticulationData.getDofs(); + + PxReal* massMatrix = cache.massMatrix; + + PxMemZero(massMatrix, sizeof(PxReal) * elementCount * elementCount); + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ArticulationLink* links = mArticulationData.getLinks(); + //ArticulationLinkData* linkData = mArticulationData.getLinkData(); + + const PxU32 startIndex = PxU32(linkCount - 1); + + Dy::SpatialMatrix* compositeSpatialInertia = reinterpret_cast(allocator->alloc(sizeof(Dy::SpatialMatrix) * linkCount)); + Cm::SpatialVectorF* F = reinterpret_cast(allocator->alloc(sizeof(Cm::SpatialVectorF) * elementCount)); + + //initialize composite spatial inertial + initCompositeSpatialInertia(mArticulationData, compositeSpatialInertia); + + for (PxU32 i = startIndex; i > 0; --i) + { + ArticulationLink& link = links[i]; + + Dy::SpatialMatrix cSpatialInertia = compositeSpatialInertia[i]; + //transform current link's spatial inertia to parent's space + PxVec3 rw = link.bodyCore->body2World.p - links[link.parent].bodyCore->body2World.p; + FeatherstoneArticulation::translateInertia(FeatherstoneArticulation::constructSkewSymmetricMatrix(rw), cSpatialInertia); + + //compute parent's composite spatial inertia + compositeSpatialInertia[link.parent] += cSpatialInertia; + + Dy::SpatialMatrix& tSpatialInertia = compositeSpatialInertia[i]; + + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(i); + + Cm::SpatialVectorF* f = &F[jointDatum.jointOffset]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + Cm::UnAlignedSpatialVector& sa = mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind]; + Cm::UnAlignedSpatialVector tmp = tSpatialInertia* sa; + f[ind].top = tmp.top; + f[ind].bottom = tmp.bottom; + } + + //Hii, Hij, Hji + const PxU32 j = computeHi(mArticulationData, i, massMatrix, f); + + //transform F to the base link space + //ArticulationLinkData& fDatum = linkData[j]; + + PxVec3 brw = links[j].bodyCore->body2World.p - links[0].bodyCore->body2World.p; + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + f[ind] = translateSpatialVector(brw, f[ind]); + } + } + + //Ib = base link composite inertia tensor + //compute transpose(F) * inv(Ib) *F + Dy::SpatialMatrix invI0 = compositeSpatialInertia[0].invertInertia(); + + //H - transpose(F) * inv(Ib) * F; + for (PxU32 row = 0; row < elementCount; ++row) + { + const Cm::SpatialVectorF& f = F[row]; + for (PxU32 col = 0; col < elementCount; ++col) + { + const Cm::SpatialVectorF invIf = invI0 * F[col]; + const PxReal v = f.innerProduct(invIf); + const PxU32 index = row * elementCount + col; + massMatrix[index] = massMatrix[index] - v; + } + } + + allocator->free(compositeSpatialInertia); + allocator->free(F); + + } + + //calcualte a single column of H, jointForce is equal to a single column of H + void FeatherstoneArticulation::calculateMassMatrixColInv(ScratchData& scratchData) + { + const PxU32 linkCount = mArticulationData.getLinkCount(); + + Cm::SpatialVectorF* motionAccelerations = scratchData.motionAccelerations; + Cm::SpatialVectorF* spatialZAForces = scratchData.spatialZAVectors; + + //Input + PxReal* jointAccelerations = scratchData.jointAccelerations; + + //set base link motion acceleration to be zero because H should + //be just affected by joint position/link position + motionAccelerations[0] = Cm::SpatialVectorF::Zero(); + spatialZAForces[0] = Cm::SpatialVectorF::Zero(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + ArticulationLink& link = mArticulationData.getLink(linkID); + ArticulationJointCoreData& jointDatum = mArticulationData.getJointData(linkID); + + //parent motion accelerations into child space + Cm::SpatialVectorF accel = translateSpatialVector(-mArticulationData.getRw(linkID), motionAccelerations[link.parent]); + + const PxReal* jAcceleration = &jointAccelerations[jointDatum.jointOffset]; + + for (PxU32 ind = 0; ind < jointDatum.dof; ++ind) + { + accel.top += mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind].top * jAcceleration[ind]; + accel.bottom += mArticulationData.mWorldMotionMatrix[jointDatum.jointOffset + ind].bottom * jAcceleration[ind]; + } + + motionAccelerations[linkID] = accel; + + spatialZAForces[linkID] = mArticulationData.mWorldSpatialArticulatedInertia[linkID] * accel; + } + + computeGeneralizedForceInv(mArticulationData, scratchData); + + } + + void FeatherstoneArticulation::getGeneralizedMassMatrixCRB(PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "ArticulationHelper::getGeneralizedMassMatrix() commonInit need to be called first to initialize data!"); + return; + } + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + if (fixBase) + { + calculateHFixBase(cache); + } + else + { + calculateHFloatingBase(cache); + } + + } + + void FeatherstoneArticulation::getGeneralizedMassMatrix( PxArticulationCache& cache) + { + if (mArticulationData.getDataDirty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "ArticulationHelper::getGeneralizedMassMatrix() commonInit need to be called first to initialize data!"); + return; + } + + + //calculate each column for mass matrix + PxReal* massMatrix = cache.massMatrix; + + const PxU32 linkCount = mArticulationData.getLinkCount(); + + const PxU32 elementCount = mArticulationData.getDofs(); + + const PxU32 size = sizeof(PxReal) * elementCount; + PxcScratchAllocator* allocator = reinterpret_cast(cache.scratchAllocator); + + ScratchData scratchData; + PxU8* tempMemory = allocateScratchSpatialData(allocator, linkCount, scratchData); + + PxReal* jointAccelerations = reinterpret_cast(allocator->alloc(size)); + + scratchData.jointAccelerations = jointAccelerations; + scratchData.jointVelocities = NULL; + scratchData.externalAccels = NULL; + + const bool fixBase = mArticulationData.getArticulationFlags() & PxArticulationFlag::eFIX_BASE; + + //initialize jointAcceleration to be zero + PxMemZero(jointAccelerations, size); + + for (PxU32 colInd = 0; colInd < elementCount; ++colInd) + { + PxReal* col = &massMatrix[colInd * elementCount]; + + scratchData.jointForces = col; + + //set joint acceleration 1 in the col + 1 and zero elsewhere + jointAccelerations[colInd] = 1; + + if (fixBase) + { + //jointAcceleration is Q, HQ = ID(model, qdot, Q). + calculateMassMatrixColInv(scratchData); + } + else + { + inverseDynamicFloatingBase(mArticulationData, PxVec3(0.f), scratchData, false); + } + + //reset joint acceleration to be zero + jointAccelerations[colInd] = 0; + } + + allocator->free(jointAccelerations); + allocator->free(tempMemory); + } + + + +} //namespace Dy + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp new file mode 100644 index 0000000..1adee29 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionCorrelation.cpp @@ -0,0 +1,295 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxvConfig.h" +#include "DyCorrelationBuffer.h" +#include "PxsMaterialManager.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxBounds3.h" + +using namespace physx; + +namespace physx +{ + +namespace Dy +{ + +namespace +{ +PX_FORCE_INLINE void initContactPatch(CorrelationBuffer::ContactPatchData& patch, PxU16 index, PxReal restitution, PxReal staticFriction, PxReal dynamicFriction, + PxU8 flags) +{ + patch.start = index; + patch.count = 1; + patch.next = 0; + patch.flags = flags; + patch.restitution = restitution; + patch.staticFriction = staticFriction; + patch.dynamicFriction = dynamicFriction; +} + +PX_FORCE_INLINE void initFrictionPatch(FrictionPatch& p, const PxVec3& worldNormal, const PxTransform& body0Pose, const PxTransform& body1Pose, + PxReal restitution, PxReal staticFriction, PxReal dynamicFriction, PxU8 materialFlags) +{ + p.body0Normal = body0Pose.rotateInv(worldNormal); + p.body1Normal = body1Pose.rotateInv(worldNormal); + p.relativeQuat = body0Pose.q.getConjugate() * body1Pose.q; + p.anchorCount = 0; + p.broken = 0; + p.staticFriction = staticFriction; + p.dynamicFriction = dynamicFriction; + p.restitution = restitution; + p.materialFlags = materialFlags; +} +} + + +bool createContactPatches(CorrelationBuffer& fb, const PxContactPoint* cb, PxU32 contactCount, PxReal normalTolerance) +{ + // PT: this rewritten version below doesn't have LHS + + PxU32 contactPatchCount = fb.contactPatchCount; + if(contactPatchCount == PxContactBuffer::MAX_CONTACTS) + return false; + if(contactCount>0) + { + CorrelationBuffer::ContactPatchData* currentPatchData = fb.contactPatches + contactPatchCount; + const PxContactPoint* PX_RESTRICT contacts = cb; + + PxU8 count=1; + + initContactPatch(fb.contactPatches[contactPatchCount++], PxTo16(0), contacts[0].restitution, + contacts[0].staticFriction, contacts[0].dynamicFriction, PxU8(contacts[0].materialFlags)); + + PxBounds3 bounds(contacts[0].point, contacts[0].point); + + PxU32 patchIndex = 0; + + for (PxU32 i = 1; i=normalTolerance) + { + bounds.include(curContact.point); + count++; + } + else + { + if(contactPatchCount == PxContactBuffer::MAX_CONTACTS) + return false; + patchIndex = i; + currentPatchData->count = count; + count = 1; + currentPatchData->patchBounds = bounds; + currentPatchData = fb.contactPatches + contactPatchCount; + + initContactPatch(fb.contactPatches[contactPatchCount++], PxTo16(i), curContact.restitution, + curContact.staticFriction, curContact.dynamicFriction, PxU8(curContact.materialFlags)); + + bounds = PxBounds3(curContact.point, curContact.point); + } + } + if(count!=1) + currentPatchData->count = count; + + currentPatchData->patchBounds = bounds; + } + fb.contactPatchCount = contactPatchCount; + return true; +} + +bool correlatePatches(CorrelationBuffer& fb, + const PxContactPoint* cb, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxReal normalTolerance, + PxU32 startContactPatchIndex, + PxU32 startFrictionPatchIndex) +{ + bool overflow = false; + PxU32 frictionPatchCount = fb.frictionPatchCount; + + for(PxU32 i=startContactPatchIndex;i= frictionPatchDiagonalSq) + continue; + + fp.anchorCount = 0; + } + + PxVec3 worldAnchors[2]; + PxU16 anchorCount = 0; + PxReal pointDistSq = 0.0f, dist0, dist1; + + // if we have an anchor already, keep it + if(fp.anchorCount == 1) + { + worldAnchors[anchorCount++] = bodyFrame0.transform(fp.body0Anchors[0]); + } + + const PxReal eps = 1e-8f; + + for(PxU32 patch = fb.correlationListHeads[i]; + patch!=CorrelationBuffer::LIST_END; + patch = fb.contactPatches[patch].next) + { + CorrelationBuffer::ContactPatchData& cp = fb.contactPatches[patch]; + for(PxU16 j=0;j eps) + { + fb.contactID[i][1] = PxU16(cp.start+j); + worldAnchors[1] = worldPoint; + anchorCount++; + } + break; + default: //case 2 + dist0 = (worldPoint-worldAnchors[0]).magnitudeSquared(); + dist1 = (worldPoint-worldAnchors[1]).magnitudeSquared(); + if (dist0 > dist1) + { + if(dist0 > pointDistSq) + { + fb.contactID[i][1] = PxU16(cp.start+j); + worldAnchors[1] = worldPoint; + pointDistSq = dist0; + } + } + else if (dist1 > pointDistSq) + { + fb.contactID[i][0] = PxU16(cp.start+j); + worldAnchors[0] = worldPoint; + pointDistSq = dist1; + } + } + } + } + } + + //PX_ASSERT(anchorCount > 0); + + // add the new anchor(s) to the patch + for(PxU32 j = fp.anchorCount; j < anchorCount; j++) + { + fp.body0Anchors[j] = bodyFrame0.transformInv(worldAnchors[j]); + fp.body1Anchors[j] = bodyFrame1.transformInv(worldAnchors[j]); + } + + // the block contact solver always reads at least one anchor per patch for performance reasons even if there are no valid patches, + // so we need to initialize this in the unexpected case that we have no anchors + + if(anchorCount==0) + fp.body0Anchors[0] = fp.body1Anchors[0] = PxVec3(0); + + fp.anchorCount = anchorCount; + } +} + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatch.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatch.h new file mode 100644 index 0000000..1e21508 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatch.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FRICTION_PATCH_H +#define DY_FRICTION_PATCH_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "PxvConfig.h" + +namespace physx +{ + +namespace Dy +{ + +struct FrictionPatch +{ + PxU8 broken; // PT: must be first byte of struct, see "frictionBrokenWritebackByte" + PxU8 materialFlags; + PxU16 anchorCount; + PxReal restitution; + PxReal staticFriction; + PxReal dynamicFriction; + PxVec3 body0Normal; + PxVec3 body1Normal; + PxVec3 body0Anchors[2]; + PxVec3 body1Anchors[2]; + PxQuat relativeQuat; + + PX_FORCE_INLINE void operator = (const FrictionPatch& other) + { + broken = other.broken; + materialFlags = other.materialFlags; + anchorCount = other.anchorCount; + body0Normal = other.body0Normal; + body1Normal = other.body1Normal; + body0Anchors[0] = other.body0Anchors[0]; + body0Anchors[1] = other.body0Anchors[1]; + body1Anchors[0] = other.body1Anchors[0]; + body1Anchors[1] = other.body1Anchors[1]; + relativeQuat = other.relativeQuat; + restitution = other.restitution; + staticFriction = other.staticFriction; + dynamicFriction = other.dynamicFriction; + } +}; + +//PX_COMPILE_TIME_ASSERT(sizeof(FrictionPatch)==80); + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatchStreamPair.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatchStreamPair.h new file mode 100644 index 0000000..6a2dd1e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyFrictionPatchStreamPair.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_FRICTION_PATCH_STREAM_PAIR_H +#define DY_FRICTION_PATCH_STREAM_PAIR_H + +#include "foundation/PxSimpleTypes.h" +#include "PxvConfig.h" +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" + +// Each narrow phase thread has an input stream of friction patches from the +// previous frame and an output stream of friction patches which will be +// saved for next frame. The patches persist for exactly one frame at which +// point they get thrown away. + + +// There is a stream pair per thread. A contact callback reserves space +// for its friction patches and gets a cookie in return that can stash +// for next frame. Cookies are valid for one frame only. +// +// note that all friction patches reserved are guaranteed to be contiguous; +// this might turn out to be a bit inefficient if we often have a large +// number of friction patches + +#include "PxcNpMemBlockPool.h" + +namespace physx +{ + +class FrictionPatchStreamPair +{ +public: + FrictionPatchStreamPair(PxcNpMemBlockPool& blockPool); + + // reserve can fail and return null. Read should never fail + template + FrictionPatch* reserve(const PxU32 size); + + template + const FrictionPatch* findInputPatches(const PxU8* ptr) const; + void reset(); + + PxcNpMemBlockPool& getBlockPool() { return mBlockPool;} +private: + PxcNpMemBlockPool& mBlockPool; + PxcNpMemBlock* mBlock; + PxU32 mUsed; + + FrictionPatchStreamPair& operator=(const FrictionPatchStreamPair&); +}; + +PX_FORCE_INLINE FrictionPatchStreamPair::FrictionPatchStreamPair(PxcNpMemBlockPool& blockPool): + mBlockPool(blockPool), mBlock(NULL), mUsed(0) +{ +} + +PX_FORCE_INLINE void FrictionPatchStreamPair::reset() +{ + mBlock = NULL; + mUsed = 0; +} + +// reserve can fail and return null. Read should never fail +template +FrictionPatch* FrictionPatchStreamPair::reserve(const PxU32 size) +{ + if(size>PxcNpMemBlock::SIZE) + { + return reinterpret_cast(-1); + } + + PX_ASSERT(size <= PxcNpMemBlock::SIZE); + + FrictionPatch* ptr = NULL; + + if(mBlock == NULL || mUsed + size > PxcNpMemBlock::SIZE) + { + mBlock = mBlockPool.acquireFrictionBlock(); + mUsed = 0; + } + + if(mBlock) + { + ptr = reinterpret_cast(mBlock->data+mUsed); + mUsed += size; + } + + return ptr; +} + +template +const FrictionPatch* FrictionPatchStreamPair::findInputPatches(const PxU8* ptr) const +{ + return reinterpret_cast(ptr); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp new file mode 100644 index 0000000..67d2609 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyRigidBodyToSolverBody.cpp @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CmUtils.h" +#include "DySolverBody.h" +#include "PxsRigidBody.h" +#include "PxvDynamics.h" +#include "foundation/PxSIMDHelpers.h" + +using namespace physx; + +// PT: TODO: SIMDify all this... +void Dy::copyToSolverBodyData(const PxVec3& linearVelocity, const PxVec3& angularVelocity, const PxReal invMass, const PxVec3& invInertia, const PxTransform& globalPose, + const PxReal maxDepenetrationVelocity, const PxReal maxContactImpulse, const PxU32 nodeIndex, const PxReal reportThreshold, PxSolverBodyData& data, PxU32 lockFlags, + const PxReal dt, bool gyroscopicForces) +{ + data.nodeIndex = nodeIndex; + + const PxVec3 safeSqrtInvInertia = computeSafeSqrtInertia(invInertia); + + const PxMat33Padded rotation(globalPose.q); + + Cm::transformInertiaTensor(safeSqrtInvInertia, rotation, data.sqrtInvInertia); + + PxVec3 ang = angularVelocity; + PxVec3 lin = linearVelocity; + + if (gyroscopicForces) + { + const PxVec3 localInertia( + invInertia.x == 0.f ? 0.f : 1.f / invInertia.x, + invInertia.y == 0.f ? 0.f : 1.f / invInertia.y, + invInertia.z == 0.f ? 0.f : 1.f / invInertia.z); + + const PxVec3 localAngVel = globalPose.q.rotateInv(ang); + const PxVec3 origMom = localInertia.multiply(localAngVel); + const PxVec3 torque = -localAngVel.cross(origMom); + PxVec3 newMom = origMom + torque * dt; + const PxReal denom = newMom.magnitude(); + const PxReal ratio = denom > 0.f ? origMom.magnitude() / denom : 0.f; + newMom *= ratio; + const PxVec3 newDeltaAngVel = globalPose.q.rotate(invInertia.multiply(newMom) - localAngVel); + + ang += newDeltaAngVel; + } + + + if (lockFlags) + { + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + data.linearVelocity.x = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + data.linearVelocity.y = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + data.linearVelocity.z = 0.f; + + //KS - technically, we can zero the inertia columns and produce stiffer constraints. However, this can cause numerical issues with the + //joint solver, which is fixed by disabling joint preprocessing and setting minResponseThreshold to some reasonable value > 0. However, until + //this is handled automatically, it's probably better not to zero these inertia rows + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + { + ang.x = 0.f; + //data.sqrtInvInertia.column0 = PxVec3(0.f); + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + { + ang.y = 0.f; + //data.sqrtInvInertia.column1 = PxVec3(0.f); + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + { + ang.z = 0.f; + //data.sqrtInvInertia.column2 = PxVec3(0.f); + } + } + + PX_ASSERT(lin.isFinite()); + PX_ASSERT(ang.isFinite()); + + data.angularVelocity = ang; + data.linearVelocity = lin; + + data.invMass = invMass; + data.penBiasClamp = maxDepenetrationVelocity; + data.maxContactImpulse = maxContactImpulse; + data.body2World = globalPose; + + data.reportThreshold = reportThreshold; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverBody.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverBody.h new file mode 100644 index 0000000..c6065c4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverBody.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef DY_SOLVER_BODY_H +#define DY_SOLVER_BODY_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" +#include "CmSpatialVector.h" +#include "solver/PxSolverDefs.h" + +namespace physx +{ + +class PxsRigidBody; +struct PxsBodyCore; + +namespace Dy +{ + +// PT: TODO: make sure this is still needed / replace with V4sqrt +//This method returns values of 0 when the inertia is 0. This is a bit of a hack but allows us to +//represent kinematic objects' velocities in our new format +PX_FORCE_INLINE PxVec3 computeSafeSqrtInertia(const PxVec3& v) +{ + return PxVec3( v.x == 0.0f ? 0.0f : PxSqrt(v.x), + v.y == 0.0f ? 0.0f : PxSqrt(v.y), + v.z == 0.0f ? 0.0f : PxSqrt(v.z)); +} + +void copyToSolverBodyData(const PxVec3& linearVelocity, const PxVec3& angularVelocity, const PxReal invMass, const PxVec3& invInertia, const PxTransform& globalPose, + const PxReal maxDepenetrationVelocity, const PxReal maxContactImpulse, const PxU32 nodeIndex, const PxReal reportThreshold, PxSolverBodyData& solverBodyData, PxU32 lockFlags, + const PxReal dt, bool gyroscopicForces); + +// PT: TODO: using PxsBodyCore in the interface makes us write less data to the stack for passing arguments, and we can take advantage of the class layout +// (we know what is aligned or not, we know if it is safe to V4Load vectors, etc). Note that this is what we previously had, which is why PxsBodyCore was still +// forward-referenced above. +//void copyToSolverBodyData(PxSolverBodyData& solverBodyData, const PxsBodyCore& core, const PxU32 nodeIndex); + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D.h new file mode 100644 index 0000000..9de03f7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D.h @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_1D_H +#define DY_SOLVER_CONSTRAINT_1D_H + +#include "foundation/PxVec3.h" +#include "PxvConfig.h" +#include "DyArticulationUtils.h" +#include "DySolverConstraintTypes.h" +#include "DySolverBody.h" +#include "PxConstraintDesc.h" +#include "DySolverConstraintDesc.h" + +namespace physx +{ + +namespace Dy +{ + +// dsequeira: we should probably fork these structures for constraints and extended constraints, +// since there's a few things that are used for one but not the other + +struct SolverConstraint1DHeader +{ + PxU8 type; // enum SolverConstraintType - must be first byte + PxU8 count; // count of following 1D constraints + PxU8 dominance; + PxU8 breakable; // indicate whether this constraint is breakable or not + + PxReal linBreakImpulse; + PxReal angBreakImpulse; + PxReal invMass0D0; + PxVec3 body0WorldOffset; + PxReal invMass1D1; + PxReal linearInvMassScale0; // only used by articulations + PxReal angularInvMassScale0; // only used by articulations + PxReal linearInvMassScale1; // only used by articulations + PxReal angularInvMassScale1; // only used by articulations +}; + +PX_COMPILE_TIME_ASSERT(sizeof(SolverConstraint1DHeader) == 48); + +PX_ALIGN_PREFIX(16) +struct SolverConstraint1D +{ +public: + PxVec3 lin0; //!< linear velocity projection (body 0) + PxReal constant; //!< constraint constant term + + PxVec3 lin1; //!< linear velocity projection (body 1) + PxReal unbiasedConstant; //!< constraint constant term without bias + + PxVec3 ang0; //!< angular velocity projection (body 0) + PxReal velMultiplier; //!< constraint velocity multiplier + + PxVec3 ang1; //!< angular velocity projection (body 1) + PxReal impulseMultiplier; //!< constraint impulse multiplier + + PxVec3 ang0Writeback; //!< unscaled angular velocity projection (body 0) + PxU32 pad; + + PxReal minImpulse; //!< Lower bound on impulse magnitude + PxReal maxImpulse; //!< Upper bound on impulse magnitude + PxReal appliedForce; //!< applied force to correct velocity+bias + PxU32 flags; +} PX_ALIGN_SUFFIX(16); + +PX_COMPILE_TIME_ASSERT(sizeof(SolverConstraint1D) == 96); + + +struct SolverConstraint1DExt : public SolverConstraint1D +{ +public: + Cm::SpatialVectorV deltaVA; + Cm::SpatialVectorV deltaVB; +}; + +PX_COMPILE_TIME_ASSERT(sizeof(SolverConstraint1DExt) == 160); + + +PX_FORCE_INLINE void init(SolverConstraint1DHeader& h, + PxU8 count, + bool isExtended, + const PxConstraintInvMassScale& ims) +{ + h.type = PxU8(isExtended ? DY_SC_TYPE_EXT_1D : DY_SC_TYPE_RB_1D); + h.count = count; + h.dominance = 0; + h.linearInvMassScale0 = ims.linear0; + h.angularInvMassScale0 = ims.angular0; + h.linearInvMassScale1 = -ims.linear1; + h.angularInvMassScale1 = -ims.angular1; +} + +PX_FORCE_INLINE void init(SolverConstraint1D& c, + const PxVec3& _linear0, const PxVec3& _linear1, + const PxVec3& _angular0, const PxVec3& _angular1, + PxReal _minImpulse, PxReal _maxImpulse) +{ + PX_ASSERT(_linear0.isFinite()); + PX_ASSERT(_linear1.isFinite()); + c.lin0 = _linear0; + c.lin1 = _linear1; + c.ang0 = _angular0; + c.ang1 = _angular1; + c.minImpulse = _minImpulse; + c.maxImpulse = _maxImpulse; + c.flags = 0; + c.appliedForce = 0; +} + +PX_FORCE_INLINE bool needsNormalVel(const Px1DConstraint &c) +{ + return c.flags & Px1DConstraintFlag::eRESTITUTION + || (c.flags & Px1DConstraintFlag::eSPRING && c.flags & Px1DConstraintFlag::eACCELERATION_SPRING); +} + +PX_FORCE_INLINE void setSolverConstants(PxReal& constant, + PxReal& unbiasedConstant, + PxReal& velMultiplier, + PxReal& impulseMultiplier, + const Px1DConstraint& c, + PxReal normalVel, + PxReal unitResponse, + PxReal minRowResponse, + PxReal erp, + PxReal dt, + PxReal recipdt) +{ + PX_ASSERT(PxIsFinite(unitResponse)); + PxReal recipResponse = unitResponse <= minRowResponse ? 0 : 1.0f/unitResponse; + + + + if(c.flags & Px1DConstraintFlag::eSPRING) + { + PxReal a = dt * dt * c.mods.spring.stiffness + dt * c.mods.spring.damping; + PxReal b = dt * (c.mods.spring.damping * c.velocityTarget - c.mods.spring.stiffness * c.geometricError); + + if(c.flags & Px1DConstraintFlag::eACCELERATION_SPRING) + { + PxReal x = 1.0f/(1.0f+a); + constant = unbiasedConstant = x * recipResponse * b; + velMultiplier = -x * recipResponse * a; + impulseMultiplier = 1.0f-x; + } + else + { + PxReal x = unitResponse == 0.f ? 0.f : 1.0f/(1.0f+a*unitResponse); + constant = unbiasedConstant = x * b; + velMultiplier = -x*a; + impulseMultiplier = 1.0f-x; + } + } + else + { + PxReal geomError = c.geometricError * erp; + velMultiplier = -recipResponse; + impulseMultiplier = 1.0f; + + if(c.flags & Px1DConstraintFlag::eRESTITUTION && -normalVel>c.mods.bounce.velocityThreshold) + { + unbiasedConstant = constant = recipResponse * c.mods.bounce.restitution*-normalVel; + } + else + { + // see usage of 'for internal use' in preprocessRows() + constant = recipResponse * (c.velocityTarget - geomError*recipdt); + unbiasedConstant = recipResponse * (c.velocityTarget - c.forInternalUse*recipdt); + } + } +} + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D4.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D4.h new file mode 100644 index 0000000..779c35a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1D4.h @@ -0,0 +1,105 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_1D4_H +#define DY_SOLVER_CONSTRAINT_1D4_H + +#include "foundation/PxVec3.h" +#include "PxvConfig.h" +#include "DyArticulationUtils.h" +#include "DySolverConstraint1D.h" + +namespace physx +{ + +namespace Dy +{ + +struct SolverConstraint1DHeader4 +{ + PxU8 type; // enum SolverConstraintType - must be first byte + PxU8 pad0[3]; + //These counts are the max of the 4 sets of data. + //When certain pairs have fewer constraints than others, they are padded with 0s so that no work is performed but + //calculations are still shared (afterall, they're computationally free because we're doing 4 things at a time in SIMD) + PxU32 count; + PxU8 count0, count1, count2, count3; + PxU8 break0, break1, break2, break3; + + Vec4V linBreakImpulse; + Vec4V angBreakImpulse; + Vec4V invMass0D0; + Vec4V invMass1D1; + Vec4V angD0; + Vec4V angD1; + + Vec4V body0WorkOffsetX; + Vec4V body0WorkOffsetY; + Vec4V body0WorkOffsetZ; +}; + +struct SolverConstraint1DBase4 +{ +public: + Vec4V lin0X; + Vec4V lin0Y; + Vec4V lin0Z; + Vec4V ang0X; + Vec4V ang0Y; + Vec4V ang0Z; + Vec4V ang0WritebackX; + Vec4V ang0WritebackY; + Vec4V ang0WritebackZ; + Vec4V constant; + Vec4V unbiasedConstant; + Vec4V velMultiplier; + Vec4V impulseMultiplier; + Vec4V minImpulse; + Vec4V maxImpulse; + Vec4V appliedForce; + PxU32 flags[4]; +}; + +PX_COMPILE_TIME_ASSERT(sizeof(SolverConstraint1DBase4) == 272); + +struct SolverConstraint1DDynamic4 : public SolverConstraint1DBase4 +{ + Vec4V lin1X; + Vec4V lin1Y; + Vec4V lin1Z; + Vec4V ang1X; + Vec4V ang1Y; + Vec4V ang1Z; +}; +PX_COMPILE_TIME_ASSERT(sizeof(SolverConstraint1DDynamic4) == 368); + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1DStep.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1DStep.h new file mode 100644 index 0000000..bf418ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraint1DStep.h @@ -0,0 +1,221 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_1D_STEP_H +#define DY_SOLVER_CONSTRAINT_1D_STEP_H + +#include "foundation/PxVec3.h" +#include "PxvConfig.h" +#include "DyArticulationUtils.h" +#include "DySolverConstraintTypes.h" +#include "DySolverBody.h" +#include "PxConstraintDesc.h" +#include "DySolverConstraintDesc.h" + + +namespace physx +{ + namespace Dy + { + struct SolverContactHeaderStep + { + enum DySolverContactFlags + { + eHAS_FORCE_THRESHOLDS = 0x1 + }; + + PxU8 type; //Note: mType should be first as the solver expects a type in the first byte. + PxU8 flags; + PxU8 numNormalConstr; + PxU8 numFrictionConstr; //4 + + PxReal angDom0; //8 + PxReal angDom1; //12 + PxReal invMass0; //16 + + Vec4V staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W; //32 + PxVec3 normal; //48 + + PxReal maxPenBias; //52 + PxReal invMass1; //56 + PxReal minNormalForce; //60 + PxU32 broken; //64 + PxU8* frictionBrokenWritebackByte; //68 72 + Sc::ShapeInteraction* shapeInteraction; //72 80 +#if !PX_P64_FAMILY + PxU32 pad[2]; //80 +#endif + + PX_FORCE_INLINE FloatV getStaticFriction() const { return V4GetX(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W); } + PX_FORCE_INLINE FloatV getDynamicFriction() const { return V4GetY(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W); } + PX_FORCE_INLINE FloatV getDominance0() const { return V4GetZ(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W); } + PX_FORCE_INLINE FloatV getDominance1() const { return V4GetW(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W); } + }; + + struct SolverContactPointStep + { + PxVec3 raXnI; + PxF32 separation; + PxVec3 rbXnI; + PxF32 velMultiplier; + PxF32 targetVelocity; + PxF32 biasCoefficient; + PxF32 recipResponse; + PxF32 maxImpulse; + }; + + struct SolverContactPointStepExt : public SolverContactPointStep + { + Vec3V linDeltaVA; + Vec3V linDeltaVB; + Vec3V angDeltaVA; + Vec3V angDeltaVB; + }; + + struct SolverContactFrictionStep + { + Vec4V normalXYZ_ErrorW; //16 + Vec4V raXnI_targetVelW; + Vec4V rbXnI_velMultiplierW; + PxReal biasScale; + PxReal appliedForce; + PxReal frictionScale; + PxU32 pad[1]; + + PX_FORCE_INLINE void setAppliedForce(const FloatV f) { FStore(f, &appliedForce); } + }; + + struct SolverContactFrictionStepExt : public SolverContactFrictionStep + { + Vec3V linDeltaVA; + Vec3V linDeltaVB; + Vec3V angDeltaVA; + Vec3V angDeltaVB; + }; + + struct SolverConstraint1DHeaderStep + { + PxU8 type; // enum SolverConstraintType - must be first byte + PxU8 count; // count of following 1D constraints + PxU8 dominance; + PxU8 breakable; // indicate whether this constraint is breakable or not + PxReal linBreakImpulse; + PxReal angBreakImpulse; + PxReal invMass0D0; + + PxVec3 body0WorldOffset; + PxReal invMass1D1; + + PxVec3 rAWorld; + PxReal linearInvMassScale0; // only used by articulations + + PxVec3 rBWorld; + PxReal angularInvMassScale0; + + PxReal linearInvMassScale1; // only used by articulations + PxReal angularInvMassScale1; + PxU32 pad[2]; + + //Ortho axes for body 0, recipResponse in W component + PxVec4 angOrthoAxis0_recipResponseW[3]; + //Ortho axes for body 1, error of body in W component + PxVec4 angOrthoAxis1_Error[3]; + }; + + + PX_FORCE_INLINE void init(SolverConstraint1DHeaderStep& h, + PxU8 count, + bool isExtended, + const PxConstraintInvMassScale& ims) + { + h.type = PxU8(isExtended ? DY_SC_TYPE_EXT_1D : DY_SC_TYPE_RB_1D); + h.count = count; + h.dominance = 0; + h.linearInvMassScale0 = ims.linear0; + h.angularInvMassScale0 = ims.angular0; + h.linearInvMassScale1 = -ims.linear1; + h.angularInvMassScale1 = -ims.angular1; + } + + + PX_ALIGN_PREFIX(16) + struct SolverConstraint1DStep + { + public: + PxVec3 lin0; //!< linear velocity projection (body 0) + PxReal error; //!< constraint error term - must be scaled by biasScale. Can be adjusted at run-time + + PxVec3 lin1; //!< linear velocity projection (body 1) + PxReal biasScale; //!< constraint constant bias scale. Constant + + PxVec3 ang0; //!< angular velocity projection (body 0) + PxReal velMultiplier; //!< constraint velocity multiplier + + PxVec3 ang1; //!< angular velocity projection (body 1) + PxReal velTarget; //!< Scaled target velocity of the constraint drive + + PxReal minImpulse; //!< Lower bound on impulse magnitude + PxReal maxImpulse; //!< Upper bound on impulse magnitude + PxReal appliedForce; //!< applied force to correct velocity+bias + PxReal maxBias; + + PxU32 flags; + PxReal recipResponse; //Constant. Only used for articulations; + PxReal angularErrorScale; //Constant + PxU32 pad; + } PX_ALIGN_SUFFIX(16); + + struct SolverConstraint1DExtStep : public SolverConstraint1DStep + { + public: + Cm::SpatialVectorV deltaVA; + Cm::SpatialVectorV deltaVB; + }; + + PX_FORCE_INLINE void init(SolverConstraint1DStep& c, + const PxVec3& _linear0, const PxVec3& _linear1, + const PxVec3& _angular0, const PxVec3& _angular1, + PxReal _minImpulse, PxReal _maxImpulse) + { + PX_ASSERT(_linear0.isFinite()); + PX_ASSERT(_linear1.isFinite()); + c.lin0 = _linear0; + c.lin1 = _linear1; + c.ang0 = _angular0; + c.ang1 = _angular1; + c.minImpulse = _minImpulse; + c.maxImpulse = _maxImpulse; + c.flags = 0; + c.appliedForce = 0; + c.angularErrorScale = 1.f; + } + + }//namespace Dy +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintDesc.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintDesc.h new file mode 100644 index 0000000..9c055d3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintDesc.h @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_DESC_H +#define DY_SOLVER_CONSTRAINT_DESC_H + +#include "PxvConfig.h" +#include "DySolverConstraintTypes.h" +#include "foundation/PxUtilities.h" +#include "PxConstraintDesc.h" +#include "solver/PxSolverDefs.h" + +namespace physx +{ +struct PxcNpWorkUnit; +struct PxsContactManagerOutput; + +namespace Cm +{ + class SpatialVector; +} + +struct PxSolverBody; +struct PxSolverBodyData; + +namespace Dy +{ +class FeatherstoneArticulation; +struct FsData; + +// dsequeira: moved this articulation stuff here to sever a build dep on Articulation.h through DyThreadContext.h and onward + +struct SelfConstraintBlock +{ + PxU32 startId; + PxU32 numSelfConstraints; + PxU16 fsDataLength; + PxU16 requiredSolverProgress; + uintptr_t eaFsData; +}; + +//This class rolls together multiple contact managers into a single contact manager. +struct CompoundContactManager +{ + PxU32 mStartIndex; + PxU16 mStride; + PxU16 mReducedContactCount; + PxU16 originalContactCount; + PxU8 originalPatchCount; + PxU8 originalStatusFlags; + + PxcNpWorkUnit* unit; //This is a work unit but the contact buffer has been adjusted to contain all the contacts for all the subsequent pairs + PxsContactManagerOutput* cmOutput; + PxU8* originalContactPatches; //This is the original contact buffer that we replaced with a combined buffer + PxU8* originalContactPoints; + + PxReal* originalForceBuffer; //This is the original force buffer that we replaced with a combined force buffer + PxU16* forceBufferList; //This is a list of indices from the reduced force buffer to the original force buffers - we need this to fix up the write-backs from the solver +}; + +struct SolverConstraintPrepState +{ +enum Enum +{ + eOUT_OF_MEMORY, + eUNBATCHABLE, + eSUCCESS +}; +}; + +PX_FORCE_INLINE bool isArticulationConstraint(const PxSolverConstraintDesc& desc) +{ + return (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY ) || + (desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY); +} + + +PX_FORCE_INLINE void setConstraintLength(PxSolverConstraintDesc& desc, const PxU32 constraintLength) +{ + PX_ASSERT(0==(constraintLength & 0x0f)); + PX_ASSERT(constraintLength <= PX_MAX_U16 * 16); + desc.constraintLengthOver16 = PxTo16(constraintLength >> 4); +} + +PX_FORCE_INLINE PxU32 getConstraintLength(const PxSolverConstraintDesc& desc) +{ + return PxU32(desc.constraintLengthOver16 << 4); +} + +PX_FORCE_INLINE Dy::FeatherstoneArticulation* getArticulationA(const PxSolverConstraintDesc& desc) +{ + return reinterpret_cast(desc.articulationA); +} + +PX_FORCE_INLINE Dy::FeatherstoneArticulation* getArticulationB(const PxSolverConstraintDesc& desc) +{ + return reinterpret_cast(desc.articulationB); +} + +PX_COMPILE_TIME_ASSERT(0 == (0x0f & sizeof(PxSolverConstraintDesc))); + +#define MAX_PERMITTED_SOLVER_PROGRESS 0xFFFF + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintExtShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintExtShared.h new file mode 100644 index 0000000..8b6aa66 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintExtShared.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_EXT_SHARED_H +#define DY_SOLVER_CONSTRAINT_EXT_SHARED_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "DyArticulationContactPrep.h" +#include "DySolverConstraintDesc.h" +#include "DySolverConstraint1D.h" +#include "DySolverContact.h" +#include "DySolverContactPF.h" +#include "PxcNpWorkUnit.h" +#include "PxsMaterialManager.h" + +namespace physx +{ + namespace Dy + { + FloatV setupExtSolverContact(const SolverExtBody& b0, const SolverExtBody& b1, + const FloatV& d0, const FloatV& d1, const FloatV& angD0, const FloatV& angD1, const Vec3V& bodyFrame0p, const Vec3V& bodyFrame1p, + const Vec3VArg normal, const FloatVArg invDt, const FloatVArg invDtp8, const FloatVArg dt, const FloatVArg restDistance, const FloatVArg maxPenBias, const FloatVArg restitution, + const FloatVArg bounceThreshold, const PxContactPoint& contact, SolverContactPointExt& solverContact, const FloatVArg ccdMaxSeparation, + Cm::SpatialVectorF* Z, const Cm::SpatialVectorV& v0, const Cm::SpatialVectorV& v1, const FloatV& cfm, const Vec3VArg solverOffsetSlop, + const FloatVArg norVel0, const FloatVArg norVel1, const FloatVArg damping); + } //namespace Dy +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintTypes.h new file mode 100644 index 0000000..3b14ebd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintTypes.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_TYPES_H +#define DY_SOLVER_CONSTRAINT_TYPES_H + +#include "foundation/PxSimpleTypes.h" +#include "PxvConfig.h" + +namespace physx +{ + +enum SolverConstraintType +{ + DY_SC_TYPE_NONE = 0, + DY_SC_TYPE_RB_CONTACT, // RB-only contact + DY_SC_TYPE_RB_1D, // RB-only 1D constraint + DY_SC_TYPE_EXT_CONTACT, // contact involving articulations + DY_SC_TYPE_EXT_1D, // 1D constraint involving articulations + DY_SC_TYPE_STATIC_CONTACT, // RB-only contact where body b is static + DY_SC_TYPE_NOFRICTION_RB_CONTACT, //RB-only contact with no friction patch + DY_SC_TYPE_BLOCK_RB_CONTACT, + DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT, + DY_SC_TYPE_BLOCK_1D, + DY_SC_TYPE_FRICTION, + DY_SC_TYPE_STATIC_FRICTION, + DY_SC_TYPE_EXT_FRICTION, + DY_SC_TYPE_BLOCK_FRICTION, + DY_SC_TYPE_BLOCK_STATIC_FRICTION, + DY_SC_CONSTRAINT_TYPE_COUNT //Count of the number of different constraint types in the solver +}; + +enum SolverConstraintFlags +{ + DY_SC_FLAG_OUTPUT_FORCE = (1<<1), + DY_SC_FLAG_KEEP_BIAS = (1<<2), + DY_SC_FLAG_ROT_EQ = (1<<3), + DY_SC_FLAG_ORTHO_TARGET = (1<<4), + DY_SC_FLAG_SPRING = (1<<5), + DY_SC_FLAG_INEQUALITY = (1<<6) +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp new file mode 100644 index 0000000..f59b41f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraints.cpp @@ -0,0 +1,1305 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" + +#include "DySolverBody.h" +#include "DySolverContact.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraintDesc.h" +#include "DyThresholdTable.h" +#include "DySolverContext.h" +#include "foundation/PxUtilities.h" +#include "DyConstraint.h" +#include "foundation/PxAtomic.h" +#include "DySolverConstraintsShared.h" +#include "DyFeatherstoneArticulation.h" + +namespace physx +{ + +namespace Dy +{ + +//Port of scalar implementation to SIMD maths with some interleaving of instructions +void solve1D(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + PX_UNUSED(cache); + PxSolverBody& b0 = *desc.bodyA; + PxSolverBody& b1 = *desc.bodyB; + + PxU8* PX_RESTRICT bPtr = desc.constraint; + if (bPtr == NULL) + return; + //PxU32 length = desc.constraintLength; + + const SolverConstraint1DHeader* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1D* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeader)); + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V linVel1 = V3LoadA(b1.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + Vec3V angState1 = V3LoadA(b1.angularState); + + const FloatV invMass0 = FLoad(header->invMass0D0); + const FloatV invMass1 = FLoad(header->invMass1D1); + const FloatV invInertiaScale0 = FLoad(header->angularInvMassScale0); + const FloatV invInertiaScale1 = FLoad(header->angularInvMassScale1); + + + for(PxU32 i=0; icount;++i, base++) + { + PxPrefetchLine(base+1); + SolverConstraint1D& c = *base; + + const Vec3V clinVel0 = V3LoadA(c.lin0); + const Vec3V clinVel1 = V3LoadA(c.lin1); + const Vec3V cangVel0 = V3LoadA(c.ang0); + const Vec3V cangVel1 = V3LoadA(c.ang1); + + const FloatV constant = FLoad(c.constant); + const FloatV vMul = FLoad(c.velMultiplier); + const FloatV iMul = FLoad(c.impulseMultiplier); + const FloatV appliedForce = FLoad(c.appliedForce); + //const FloatV targetVel = FLoad(c.targetVelocity); + + const FloatV maxImpulse = FLoad(c.maxImpulse); + const FloatV minImpulse = FLoad(c.minImpulse); + + const Vec3V v0 = V3MulAdd(linVel0, clinVel0, V3Mul(angState0, cangVel0)); + const Vec3V v1 = V3MulAdd(linVel1, clinVel1, V3Mul(angState1, cangVel1)); + + const FloatV normalVel = V3SumElems(V3Sub(v0, v1)); + const FloatV unclampedForce = FScaleAdd(iMul, appliedForce, FScaleAdd(vMul, normalVel, constant)); + const FloatV clampedForce = FMin(maxImpulse, (FMax(minImpulse, unclampedForce))); + const FloatV deltaF = FSub(clampedForce, appliedForce); + + FStore(clampedForce, &c.appliedForce); + linVel0 = V3ScaleAdd(clinVel0, FMul(deltaF, invMass0), linVel0); + linVel1 = V3NegScaleSub(clinVel1, FMul(deltaF, invMass1), linVel1); + angState0 = V3ScaleAdd(cangVel0, FMul(deltaF, invInertiaScale0), angState0); + //This should be negScaleSub but invInertiaScale1 is negated already + angState1 = V3ScaleAdd(cangVel1, FMul(deltaF, invInertiaScale1), angState1); + + } + + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(angState0, b0.angularState); + V3StoreA(linVel1, b1.linearVelocity); + V3StoreA(angState1, b1.angularState); + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularState.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularState.isFinite()); +} + +void conclude1D(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + SolverConstraint1DHeader* header = reinterpret_cast(desc.constraint); + if (header == NULL) + return; + PxU8* base = desc.constraint + sizeof(SolverConstraint1DHeader); + PxU32 stride = header->type == DY_SC_TYPE_EXT_1D ? sizeof(SolverConstraint1DExt) : sizeof(SolverConstraint1D); + + for(PxU32 i=0; icount; i++) + { + SolverConstraint1D& c = *reinterpret_cast(base); + + c.constant = c.unbiasedConstant; + + base += stride; + } + //The final row may no longer be at the end of the reserved memory range. This can happen if there were degenerate + //constraint rows with articulations, in which case the rows are skipped. + //PX_ASSERT(desc.constraint + getConstraintLength(desc) == base); +} + +// ============================================================== + +void solveContact(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + PxSolverBody& b0 = *desc.bodyA; + PxSolverBody& b1 = *desc.bodyB; + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V linVel1 = V3LoadA(b1.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + Vec3V angState1 = V3LoadA(b1.angularState); + + const PxU8* PX_RESTRICT last = desc.constraint + getConstraintLength(desc); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc.constraint; + + while(currPtr < last) + { + SolverContactHeader* PX_RESTRICT hdr = reinterpret_cast(currPtr); + currPtr += sizeof(SolverContactHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverContactPoint* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPoint); + + PxF32* forceBuffer = reinterpret_cast(currPtr); + currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + SolverContactFriction* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFriction); + + const FloatV invMassA = FLoad(hdr->invMass0); + const FloatV invMassB = FLoad(hdr->invMass1); + + const FloatV angDom0 = FLoad(hdr->angDom0); + const FloatV angDom1 = FLoad(hdr->angDom1); + + const Vec3V contactNormal = Vec3V_From_Vec4V_WUndefined(hdr->normal_minAppliedImpulseForFrictionW); + + const FloatV accumulatedNormalImpulse = solveDynamicContacts(contacts, numNormalConstr, contactNormal, invMassA, invMassB, + angDom0, angDom1, linVel0, angState0, linVel1, angState1, forceBuffer); + + if(cache.doFriction && numFrictionConstr) + { + const FloatV staticFrictionCof = hdr->getStaticFriction(); + const FloatV dynamicFrictionCof = hdr->getDynamicFriction(); + const FloatV maxFrictionImpulse = FMul(staticFrictionCof, accumulatedNormalImpulse); + const FloatV maxDynFrictionImpulse = FMul(dynamicFrictionCof, accumulatedNormalImpulse); + const FloatV negMaxDynFrictionImpulse = FNeg(maxDynFrictionImpulse); + + BoolV broken = BFFFF(); + + if(cache.writeBackIteration) + PxPrefetchLine(hdr->frictionBrokenWritebackByte); + + for(PxU32 i=0;i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse = FNegScaleSub(normalVel, velMultiplier, tmp1); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const BoolV clamp = FIsGrtr(FAbs(totalImpulse), maxFrictionImpulse); + + const FloatV totalClamped = FMin(maxDynFrictionImpulse, FMax(negMaxDynFrictionImpulse, totalImpulse)); + + const FloatV newAppliedForce = FSel(clamp, totalClamped,totalImpulse); + + broken = BOr(broken, clamp); + + FloatV deltaF = FSub(newAppliedForce, appliedForce); + + // we could get rid of the stall here by calculating and clamping delta separately, but + // the complexity isn't really worth it. + + linVel0 = V3ScaleAdd(delLinVel0, deltaF, linVel0); + linVel1 = V3NegScaleSub(delLinVel1, deltaF, linVel1); + angState0 = V3ScaleAdd(raXn, FMul(deltaF, angDom0), angState0); + angState1 = V3NegScaleSub(rbXn, FMul(deltaF, angDom1), angState1); + + f.setAppliedForce(newAppliedForce); + + + } + Store_From_BoolV(broken, &hdr->broken); + } + + } + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularState.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularState.isFinite()); + + // Write back + V3StoreU(linVel0, b0.linearVelocity); + V3StoreU(linVel1, b1.linearVelocity); + V3StoreU(angState0, b0.angularState); + V3StoreU(angState1, b1.angularState); + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularState.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularState.isFinite()); + + PX_ASSERT(currPtr == last); +} + +void solveContact_BStatic(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + PxSolverBody& b0 = *desc.bodyA; + //PxSolverBody& b1 = *desc.bodyB; + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + + const PxU8* PX_RESTRICT last = desc.constraint + getConstraintLength(desc); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc.constraint; + + while(currPtr < last) + { + SolverContactHeader* PX_RESTRICT hdr = reinterpret_cast(currPtr); + currPtr += sizeof(SolverContactHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverContactPoint* PX_RESTRICT contacts = reinterpret_cast(currPtr); + //PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPoint); + + PxF32* forceBuffer = reinterpret_cast(currPtr); + currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + SolverContactFriction* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFriction); + + + + const FloatV invMassA = FLoad(hdr->invMass0); + + const Vec3V contactNormal = Vec3V_From_Vec4V_WUndefined(hdr->normal_minAppliedImpulseForFrictionW); + const FloatV angDom0 = FLoad(hdr->angDom0); + + + const FloatV accumulatedNormalImpulse = solveStaticContacts(contacts, numNormalConstr, contactNormal, + invMassA, angDom0, linVel0, angState0, forceBuffer); + + if(cache.doFriction && numFrictionConstr) + { + const FloatV maxFrictionImpulse = FMul(hdr->getStaticFriction(), accumulatedNormalImpulse); + const FloatV maxDynFrictionImpulse = FMul(hdr->getDynamicFriction(), accumulatedNormalImpulse); + + BoolV broken = BFFFF(); + if(cache.writeBackIteration) + PxPrefetchLine(hdr->frictionBrokenWritebackByte); + + for(PxU32 i=0;i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse = FNegScaleSub(normalVel, velMultiplier, tmp1); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const BoolV clamp = FIsGrtr(FAbs(totalImpulse), maxFrictionImpulse); + + const FloatV totalClamped = FMin(maxDynFrictionImpulse, FMax(negMaxDynFrictionImpulse, totalImpulse)); + + broken = BOr(broken, clamp); + + const FloatV newAppliedForce = FSel(clamp, totalClamped,totalImpulse); + + FloatV deltaF = FSub(newAppliedForce, appliedForce); + + // we could get rid of the stall here by calculating and clamping delta separately, but + // the complexity isn't really worth it. + + linVel0 = V3ScaleAdd(delLinVel0, deltaF, linVel0); + angState0 = V3ScaleAdd(raXn, FMul(deltaF, angDom0), angState0); + + f.setAppliedForce(newAppliedForce); + + } + Store_From_BoolV(broken, &hdr->broken); + } + + } + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularState.isFinite()); + + // Write back + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(angState0, b0.angularState); + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularState.isFinite()); + + PX_ASSERT(currPtr == last); +} + + +void concludeContact(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + PxU8* PX_RESTRICT cPtr = desc.constraint; + + const FloatV zero = FZero(); + + PxU8* PX_RESTRICT last = desc.constraint + getConstraintLength(desc); + while(cPtr < last) + { + const SolverContactHeader* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + //if(cPtr < last) + //PxPrefetchLine(cPtr, 512); + PxPrefetchLine(cPtr,128); + PxPrefetchLine(cPtr,256); + PxPrefetchLine(cPtr,384); + + const PxU32 pointStride = hdr->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactPointExt) + : sizeof(SolverContactPoint); + for(PxU32 i=0;i(cPtr); + cPtr += pointStride; + //c->scaledBias = PxMin(c->scaledBias, 0.f); + c->biasedErr = c->unbiasedErr; + } + + cPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); //Jump over force buffers + + const PxU32 frictionStride = hdr->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactFrictionExt) + : sizeof(SolverContactFriction); + for(PxU32 i=0;i(cPtr); + cPtr += frictionStride; + f->setBias(zero); + } + } + PX_ASSERT(cPtr == last); +} + +void writeBackContact(const PxSolverConstraintDesc& desc, SolverContext& cache, + PxSolverBodyData& bd0, PxSolverBodyData& bd1) +{ + + PxReal normalForce = 0; + + PxU8* PX_RESTRICT cPtr = desc.constraint; + PxReal* PX_RESTRICT vForceWriteback = reinterpret_cast(desc.writeBack); + PxU8* PX_RESTRICT last = desc.constraint + getConstraintLength(desc); + + bool forceThreshold = false; + + while(cPtr < last) + { + const SolverContactHeader* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactHeader); + + forceThreshold = hdr->flags & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + //if(cPtr < last) + PxPrefetchLine(cPtr, 256); + PxPrefetchLine(cPtr, 384); + + const PxU32 pointStride = hdr->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactPointExt) + : sizeof(SolverContactPoint); + + cPtr += pointStride * numNormalConstr; + PxF32* forceBuffer = reinterpret_cast(cPtr); + cPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + if(vForceWriteback!=NULL) + { + for(PxU32 i=0; itype == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactFrictionExt) + : sizeof(SolverContactFriction); + + if(hdr->broken && hdr->frictionBrokenWritebackByte != NULL) + { + *hdr->frictionBrokenWritebackByte = 1; + } + + cPtr += frictionStride * numFrictionConstr; + + } + PX_ASSERT(cPtr == last); + + + + if(forceThreshold && desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY && desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY && + normalForce !=0 && (bd0.reportThreshold < PX_MAX_REAL || bd1.reportThreshold < PX_MAX_REAL)) + { + ThresholdStreamElement elt; + elt.normalForce = normalForce; + elt.threshold = PxMin(bd0.reportThreshold, bd1.reportThreshold); + elt.nodeIndexA = PxNodeIndex(bd0.nodeIndex); + elt.nodeIndexB = PxNodeIndex(bd1.nodeIndex); + elt.shapeInteraction = reinterpret_cast(desc.constraint)->shapeInteraction; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + PX_ASSERT(cache.mThresholdStreamIndex(desc.writeBack); + if(writeback) + { + SolverConstraint1DHeader* header = reinterpret_cast(desc.constraint); + PxU8* base = desc.constraint + sizeof(SolverConstraint1DHeader); + PxU32 stride = header->type == DY_SC_TYPE_EXT_1D ? sizeof(SolverConstraint1DExt) : sizeof(SolverConstraint1D); + + PxVec3 lin(0), ang(0); + for(PxU32 i=0; icount; i++) + { + const SolverConstraint1D* c = reinterpret_cast(base); + if(c->flags & DY_SC_FLAG_OUTPUT_FORCE) + { + lin += c->lin0 * c->appliedForce; + ang += c->ang0Writeback * c->appliedForce; + } + base += stride; + } + + ang -= header->body0WorldOffset.cross(lin); + writeback->linearImpulse = lin; + writeback->angularImpulse = ang; + writeback->broken = header->breakable ? PxU32(lin.magnitude()>header->linBreakImpulse || ang.magnitude()>header->angBreakImpulse) : 0; + + //If we had degenerate rows, the final constraint row may not end at getConstraintLength bytes from the base anymore + //PX_ASSERT(desc.constraint + getConstraintLength(desc) == base); + } +} + + +void solve1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solve1D(desc[a-1], cache); + } + solve1D(desc[constraintCount-1], cache); +} + +void solve1DConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solve1D(desc[a-1], cache); + conclude1D(desc[a-1], cache); + } + solve1D(desc[constraintCount-1], cache); + conclude1D(desc[constraintCount-1], cache); +} + +void solve1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a-1].bodyBDataIndex]; + solve1D(desc[a-1], cache); + writeBack1D(desc[a-1], cache, bd0, bd1); + } + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[constraintCount-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[constraintCount-1].bodyBDataIndex]; + solve1D(desc[constraintCount-1], cache); + writeBack1D(desc[constraintCount-1], cache, bd0, bd1); +} + +void writeBack1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a-1].bodyBDataIndex]; + writeBack1D(desc[a-1], cache, bd0, bd1); + } + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[constraintCount-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[constraintCount-1].bodyBDataIndex]; + writeBack1D(desc[constraintCount-1], cache, bd0, bd1); +} + +void solveContactBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solveContact(desc[a-1], cache); + } + solveContact(desc[constraintCount-1], cache); +} + +void solveContactConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solveContact(desc[a-1], cache); + concludeContact(desc[a-1], cache); + } + solveContact(desc[constraintCount-1], cache); + concludeContact(desc[constraintCount-1], cache); +} + +void solveContactBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a-1].bodyBDataIndex]; + solveContact(desc[a-1], cache); + writeBackContact(desc[a-1], cache, bd0, bd1); + } + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[constraintCount-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[constraintCount-1].bodyBDataIndex]; + solveContact(desc[constraintCount-1], cache); + writeBackContact(desc[constraintCount-1], cache, bd0, bd1); + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveContact_BStaticBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solveContact_BStatic(desc[a-1], cache); + } + solveContact_BStatic(desc[constraintCount-1], cache); +} + +void solveContact_BStaticConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + solveContact_BStatic(desc[a-1], cache); + concludeContact(desc[a-1], cache); + } + solveContact_BStatic(desc[constraintCount-1], cache); + concludeContact(desc[constraintCount-1], cache); +} + +void solveContact_BStaticBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 1; a < constraintCount; ++a) + { + PxPrefetchLine(desc[a].constraint); + PxPrefetchLine(desc[a].constraint, 128); + PxPrefetchLine(desc[a].constraint, 256); + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a-1].bodyBDataIndex]; + solveContact_BStatic(desc[a-1], cache); + writeBackContact(desc[a-1], cache, bd0, bd1); + } + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[constraintCount-1].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[constraintCount-1].bodyBDataIndex]; + solveContact_BStatic(desc[constraintCount-1], cache); + writeBackContact(desc[constraintCount-1], cache, bd0, bd1); + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Not enough space to write 4 more thresholds back! + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void clearExt1D(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + PxU8* PX_RESTRICT bPtr = desc.constraint; + const SolverConstraint1DHeader* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DExt* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeader)); + + for (PxU32 i = 0; i < header->count; ++i, base++) + { + base->appliedForce = 0.f; + } +} + +void solveExt1D(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + Vec3V& li0, Vec3V& li1, Vec3V& ai0, Vec3V& ai1) +{ + PxU8* PX_RESTRICT bPtr = desc.constraint; + const SolverConstraint1DHeader* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DExt* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeader)); + + + + for (PxU32 i = 0; icount; ++i, base++) + { + PxPrefetchLine(base + 1); + + const Vec4V lin0XYZ_constantW = V4LoadA(&base->lin0.x); + const Vec4V lin1XYZ_unbiasedConstantW = V4LoadA(&base->lin1.x); + const Vec4V ang0XYZ_velMultiplierW = V4LoadA(&base->ang0.x); + const Vec4V ang1XYZ_impulseMultiplierW = V4LoadA(&base->ang1.x); + const Vec4V minImpulseX_maxImpulseY_appliedForceZ = V4LoadA(&base->minImpulse); + + const Vec3V lin0 = Vec3V_From_Vec4V(lin0XYZ_constantW); FloatV constant = V4GetW(lin0XYZ_constantW); + const Vec3V lin1 = Vec3V_From_Vec4V(lin1XYZ_unbiasedConstantW); + const Vec3V ang0 = Vec3V_From_Vec4V(ang0XYZ_velMultiplierW); FloatV vMul = V4GetW(ang0XYZ_velMultiplierW); + const Vec3V ang1 = Vec3V_From_Vec4V(ang1XYZ_impulseMultiplierW); FloatV iMul = V4GetW(ang1XYZ_impulseMultiplierW); + + const FloatV minImpulse = V4GetX(minImpulseX_maxImpulseY_appliedForceZ); + const FloatV maxImpulse = V4GetY(minImpulseX_maxImpulseY_appliedForceZ); + const FloatV appliedForce = V4GetZ(minImpulseX_maxImpulseY_appliedForceZ); + + const Vec3V v0 = V3MulAdd(linVel0, lin0, V3Mul(angVel0, ang0)); + const Vec3V v1 = V3MulAdd(linVel1, lin1, V3Mul(angVel1, ang1)); + const FloatV normalVel = V3SumElems(V3Sub(v0, v1)); + + const FloatV unclampedForce = FScaleAdd(iMul, appliedForce, FScaleAdd(vMul, normalVel, constant)); + const FloatV clampedForce = FMin(maxImpulse, (FMax(minImpulse, unclampedForce))); + const FloatV deltaF = FSub(clampedForce, appliedForce); + + FStore(clampedForce, &base->appliedForce); + li0 = V3ScaleAdd(lin0, deltaF, li0); ai0 = V3ScaleAdd(ang0, deltaF, ai0); + li1 = V3ScaleAdd(lin1, deltaF, li1); ai1 = V3ScaleAdd(ang1, deltaF, ai1); + + linVel0 = V3ScaleAdd(base->deltaVA.linear, deltaF, linVel0); angVel0 = V3ScaleAdd(base->deltaVA.angular, deltaF, angVel0); + linVel1 = V3ScaleAdd(base->deltaVB.linear, deltaF, linVel1); angVel1 = V3ScaleAdd(base->deltaVB.angular, deltaF, angVel1); + +#if 0 + PxVec3 lv0, lv1, av0, av1; + V3StoreU(linVel0, lv0); V3StoreU(linVel1, lv1); + V3StoreU(angVel0, av0); V3StoreU(angVel1, av1); + + PX_ASSERT(lv0.magnitude() < 30.f); + PX_ASSERT(lv1.magnitude() < 30.f); + PX_ASSERT(av0.magnitude() < 30.f); + PX_ASSERT(av1.magnitude() < 30.f); +#endif + + } + + li0 = V3Scale(li0, FLoad(header->linearInvMassScale0)); + li1 = V3Scale(li1, FLoad(header->linearInvMassScale1)); + ai0 = V3Scale(ai0, FLoad(header->angularInvMassScale0)); + ai1 = V3Scale(ai1, FLoad(header->angularInvMassScale1)); +} + +//Port of scalar implementation to SIMD maths with some interleaving of instructions +void solveExt1D(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + + //PxU32 length = desc.constraintLength; + + Vec3V linVel0, angVel0, linVel1, angVel1; + + if (desc.articulationA == desc.articulationB) + { + Cm::SpatialVectorV v0, v1; + getArticulationA(desc)->pxcFsGetVelocities(desc.linkIndexA, desc.linkIndexB, v0, v1); + linVel0 = v0.linear; + angVel0 = v0.angular; + linVel1 = v1.linear; + angVel1 = v1.angular; + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.bodyA->linearVelocity); + angVel0 = V3LoadA(desc.bodyA->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationA(desc)->pxcFsGetVelocity(desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.bodyB->linearVelocity); + angVel1 = V3LoadA(desc.bodyB->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationB(desc)->pxcFsGetVelocity(desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + } + } + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + solveExt1D(desc, linVel0, linVel1, angVel0, angVel1, li0, li1, ai0, ai1); + + if (desc.articulationA == desc.articulationB) + { + getArticulationA(desc)->pxcFsApplyImpulses(desc.linkIndexA, li0, ai0, + desc.linkIndexB, li1, ai1, cache.Z, cache.deltaV); + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.bodyA->linearVelocity); + V3StoreA(angVel0, desc.bodyA->angularState); + } + else + { + getArticulationA(desc)->pxcFsApplyImpulse(desc.linkIndexA, li0, ai0, cache.Z, cache.deltaV); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.bodyB->linearVelocity); + V3StoreA(angVel1, desc.bodyB->angularState); + } + else + { + getArticulationB(desc)->pxcFsApplyImpulse(desc.linkIndexB, li1, ai1, cache.Z, cache.deltaV); + } + } +} + +FloatV solveExtContacts(SolverContactPointExt* contacts, const PxU32 nbContactPoints, const Vec3VArg contactNormal, + Vec3V& linVel0, Vec3V& angVel0, + Vec3V& linVel1, Vec3V& angVel1, + Vec3V& li0, Vec3V& ai0, + Vec3V& li1, Vec3V& ai1, + PxF32* PX_RESTRICT appliedForceBuffer) +{ + + FloatV accumulatedNormalImpulse = FZero(); + for (PxU32 i = 0; i(currPtr); + currPtr += sizeof(SolverContactHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverContactPointExt* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPointExt); + + PxF32* appliedForceBuffer = reinterpret_cast(currPtr); + currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + SolverContactFrictionExt* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionExt); + + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + const Vec3V contactNormal = Vec3V_From_Vec4V(hdr->normal_minAppliedImpulseForFrictionW); + const FloatV minNorImpulse = V4GetW(hdr->normal_minAppliedImpulseForFrictionW); + + const FloatV accumulatedNormalImpulse = FMax(solveExtContacts(contacts, numNormalConstr, contactNormal, linVel0, angVel0, linVel1, + angVel1, li0, ai0, li1, ai1, appliedForceBuffer), minNorImpulse); + + + if (doFriction && numFrictionConstr) + { + PxPrefetchLine(frictions); + const FloatV maxFrictionImpulse = FMul(hdr->getStaticFriction(), accumulatedNormalImpulse); + const FloatV maxDynFrictionImpulse = FMul(hdr->getDynamicFriction(), accumulatedNormalImpulse); + + BoolV broken = BFFFF(); + + for (PxU32 i = 0; i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse = FNegScaleSub(normalVel, velMultiplier, tmp1); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const BoolV clampLow = FIsGrtr(negMaxFrictionImpulse, totalImpulse); + const BoolV clampHigh = FIsGrtr(totalImpulse, maxFrictionImpulse); + + const FloatV totalClampedLow = FMax(negMaxDynFrictionImpulse, totalImpulse); + const FloatV totalClampedHigh = FMin(maxDynFrictionImpulse, totalImpulse); + + const FloatV newAppliedForce = FSel(clampLow, totalClampedLow, + FSel(clampHigh, totalClampedHigh, totalImpulse)); + + broken = BOr(broken, BOr(clampLow, clampHigh)); + + FloatV deltaF = FSub(newAppliedForce, appliedForce); + + linVel0 = V3ScaleAdd(f.linDeltaVA, deltaF, linVel0); + angVel0 = V3ScaleAdd(f.angDeltaVA, deltaF, angVel0); + linVel1 = V3ScaleAdd(f.linDeltaVB, deltaF, linVel1); + angVel1 = V3ScaleAdd(f.angDeltaVB, deltaF, angVel1); + + li0 = V3ScaleAdd(normal, deltaF, li0); ai0 = V3ScaleAdd(raXn, deltaF, ai0); + li1 = V3ScaleAdd(normal, deltaF, li1); ai1 = V3ScaleAdd(rbXn, deltaF, ai1); + +#if 0 + PxVec3 lv0, lv1, av0, av1; + V3StoreU(linVel0, lv0); V3StoreU(linVel1, lv1); + V3StoreU(angVel0, av0); V3StoreU(angVel1, av1); + + PX_ASSERT(lv0.magnitude() < 30.f); + PX_ASSERT(lv1.magnitude() < 30.f); + PX_ASSERT(av0.magnitude() < 30.f); + PX_ASSERT(av1.magnitude() < 30.f); +#endif + + f.setAppliedForce(newAppliedForce); + } + Store_From_BoolV(broken, &hdr->broken); + } + + linImpulse0 = V3ScaleAdd(li0, hdr->getDominance0(), linImpulse0); + angImpulse0 = V3ScaleAdd(ai0, FLoad(hdr->angDom0), angImpulse0); + linImpulse1 = V3NegScaleSub(li1, hdr->getDominance1(), linImpulse1); + angImpulse1 = V3NegScaleSub(ai1, FLoad(hdr->angDom1), angImpulse1); + + /*linImpulse0 = V3ScaleAdd(li0, FZero(), linImpulse0); + angImpulse0 = V3ScaleAdd(ai0, FZero(), angImpulse0); + linImpulse1 = V3NegScaleSub(li1, FZero(), linImpulse1); + angImpulse1 = V3NegScaleSub(ai1, FZero(), angImpulse1);*/ + } +} + + +void solveExtContact(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + Vec3V linVel0, angVel0, linVel1, angVel1; + + if (desc.articulationA == desc.articulationB) + { + Cm::SpatialVectorV v0, v1; + getArticulationA(desc)->pxcFsGetVelocities(desc.linkIndexA, desc.linkIndexB, v0, v1); + linVel0 = v0.linear; + angVel0 = v0.angular; + linVel1 = v1.linear; + angVel1 = v1.angular; + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.bodyA->linearVelocity); + angVel0 = V3LoadA(desc.bodyA->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationA(desc)->pxcFsGetVelocity(desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.bodyB->linearVelocity); + angVel1 = V3LoadA(desc.bodyB->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationB(desc)->pxcFsGetVelocity(desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + } + } + + Vec3V linImpulse0 = V3Zero(), linImpulse1 = V3Zero(), angImpulse0 = V3Zero(), angImpulse1 = V3Zero(); + + //Vec3V origLin0 = linVel0, origAng0 = angVel0, origLin1 = linVel1, origAng1 = angVel1; + + solveExtContact(desc, linVel0, linVel1, angVel0, angVel1, linImpulse0, linImpulse1, angImpulse0, angImpulse1, cache.doFriction); + + if (desc.articulationA == desc.articulationB) + { + getArticulationA(desc)->pxcFsApplyImpulses(desc.linkIndexA, linImpulse0, angImpulse0, desc.linkIndexB, linImpulse1, angImpulse1, + cache.Z, cache.deltaV); + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.bodyA->linearVelocity); + V3StoreA(angVel0, desc.bodyA->angularState); + } + else + { + getArticulationA(desc)->pxcFsApplyImpulse(desc.linkIndexA, + linImpulse0, angImpulse0, cache.Z, cache.deltaV); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.bodyB->linearVelocity); + V3StoreA(angVel1, desc.bodyB->angularState); + } + else + { + getArticulationB(desc)->pxcFsApplyImpulse(desc.linkIndexB, + linImpulse1, angImpulse1, cache.Z, cache.deltaV); + } + } +} + + +void solveExtContactBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtContact(desc[a], cache); + } +} + +void solveExtContactConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtContact(desc[a], cache); + concludeContact(desc[a], cache); + } +} + +void solveExtContactBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyBDataIndex]; + + solveExtContact(desc[a], cache); + writeBackContact(desc[a], cache, bd0, bd1); + } + if(cache.mThresholdStreamIndex > 0) + { + //Not enough space to write 4 more thresholds back! + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveExt1DBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExt1D(desc[a], cache); + } +} + +void solveExt1DConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExt1D(desc[a], cache); + conclude1D(desc[a], cache); + } +} + +void solveExt1DBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyBDataIndex]; + solveExt1D(desc[a], cache); + writeBack1D(desc[a], cache, bd0, bd1); + } +} + +void ext1DBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].linkIndexA != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].linkIndexB != PxSolverConstraintDesc::RIGID_BODY ? 0 : desc[a].bodyBDataIndex]; + writeBack1D(desc[a], cache, bd0, bd1); + } +} + +void solveConcludeExtContact (const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveExtContact(desc, cache); + concludeContact(desc, cache); +} + +void solveConcludeExt1D (const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveExt1D(desc, cache); + conclude1D(desc, cache); +} + + +void solveConclude1D(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solve1D(desc, cache); + conclude1D(desc, cache); +} + +void solveConcludeContact (const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveContact(desc, cache); + concludeContact(desc, cache); +} + +void solveConcludeContact_BStatic (const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveContact_BStatic(desc, cache); + concludeContact(desc, cache); +} + + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp new file mode 100644 index 0000000..dc1e3a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsBlock.cpp @@ -0,0 +1,1225 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxFPU.h" + +#include "DySolverBody.h" +#include "DySolverContact.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraintDesc.h" +#include "DyThresholdTable.h" +#include "DySolverContext.h" +#include "foundation/PxUtilities.h" +#include "DyConstraint.h" +#include "foundation/PxAtomic.h" +#include "DySolverContact4.h" +#include "DySolverConstraint1D4.h" + +namespace physx +{ + +namespace Dy +{ + +static void solveContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& cache) +{ + PxSolverBody& b00 = *desc[0].bodyA; + PxSolverBody& b01 = *desc[0].bodyB; + PxSolverBody& b10 = *desc[1].bodyA; + PxSolverBody& b11 = *desc[1].bodyB; + PxSolverBody& b20 = *desc[2].bodyA; + PxSolverBody& b21 = *desc[2].bodyB; + PxSolverBody& b30 = *desc[3].bodyA; + PxSolverBody& b31 = *desc[3].bodyB; + + //We'll need this. + const Vec4V vZero = V4Zero(); + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&b01.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularState.x); + Vec4V angState01 = V4LoadA(&b01.angularState.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&b11.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularState.x); + Vec4V angState11 = V4LoadA(&b11.angularState.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&b21.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularState.x); + Vec4V angState21 = V4LoadA(&b21.angularState.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&b31.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularState.x); + Vec4V angState31 = V4LoadA(&b31.angularState.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V linVel1T0, linVel1T1, linVel1T2, linVel1T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + Vec4V angState1T0, angState1T1, angState1T2, angState1T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2, linVel1T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + PX_TRANSPOSE_44(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2, angState1T3); + + + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + Vec4V vMax = V4Splat(FMax()); + + const PxU8* PX_RESTRICT prefetchAddress = currPtr + sizeof(SolverContactHeader4) + sizeof(SolverContactBatchPointDynamic4); + + const SolverContactHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + const Vec4V invMassA = hdr->invMass0D0; + const Vec4V invMassB = hdr->invMass1D1; + + const Vec4V sumInvMass = V4Add(invMassA, invMassB); + + + while(currPtr < last) + { + + hdr = reinterpret_cast(currPtr); + + PX_ASSERT(hdr->type == DY_SC_TYPE_BLOCK_RB_CONTACT); + + currPtr = reinterpret_cast(const_cast(hdr) + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + Vec4V* appliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numNormalConstr; + + SolverContactBatchPointDynamic4* PX_RESTRICT contacts = reinterpret_cast(currPtr); + + Vec4V* maxImpulses; + currPtr = reinterpret_cast(contacts + numNormalConstr); + PxU32 maxImpulseMask = 0; + if(hasMaxImpulse) + { + maxImpulseMask = 0xFFFFFFFF; + maxImpulses = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V) * numNormalConstr; + } + else + { + maxImpulses = &vMax; + } + + + SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(currPtr); + if(numFrictionConstr) + currPtr += sizeof(SolverFrictionSharedData4); + + Vec4V* frictionAppliedForce = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numFrictionConstr; + + const SolverContactFrictionDynamic4* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionDynamic4); + + Vec4V accumulatedNormalImpulse = vZero; + + const Vec4V angD0 = hdr->angDom0; + const Vec4V angD1 = hdr->angDom1; + + const Vec4V _normalT0 = hdr->normalX; + const Vec4V _normalT1 = hdr->normalY; + const Vec4V _normalT2 = hdr->normalZ; + + Vec4V contactNormalVel1 = V4Mul(linVel0T0, _normalT0); + Vec4V contactNormalVel3 = V4Mul(linVel1T0, _normalT0); + contactNormalVel1 = V4MulAdd(linVel0T1, _normalT1, contactNormalVel1); + contactNormalVel3 = V4MulAdd(linVel1T1, _normalT1, contactNormalVel3); + contactNormalVel1 = V4MulAdd(linVel0T2, _normalT2, contactNormalVel1); + contactNormalVel3 = V4MulAdd(linVel1T2, _normalT2, contactNormalVel3); + + Vec4V relVel1 = V4Sub(contactNormalVel1, contactNormalVel3); + + Vec4V accumDeltaF = vZero; + + for(PxU32 i=0;istaticFriction; + const Vec4V dynamicFric = hdr->dynamicFriction; + + const Vec4V maxFrictionImpulse = V4Mul(staticFric, accumulatedNormalImpulse); + const Vec4V maxDynFrictionImpulse = V4Mul(dynamicFric, accumulatedNormalImpulse); + const Vec4V negMaxDynFrictionImpulse = V4Neg(maxDynFrictionImpulse); + //const Vec4V negMaxFrictionImpulse = V4Neg(maxFrictionImpulse); + BoolV broken = BFFFF(); + + if(cache.writeBackIteration) + { + PxPrefetchLine(fd->frictionBrokenWritebackByte[0]); + PxPrefetchLine(fd->frictionBrokenWritebackByte[1]); + PxPrefetchLine(fd->frictionBrokenWritebackByte[2]); + } + + + for(PxU32 i=0;inormalX[i&1]; + const Vec4V normalT1 = fd->normalY[i&1]; + const Vec4V normalT2 = fd->normalZ[i&1]; + + Vec4V normalVel1 = V4Mul(linVel0T0, normalT0); + Vec4V normalVel2 = V4Mul(f.raXnX, angState0T0); + Vec4V normalVel3 = V4Mul(linVel1T0, normalT0); + Vec4V normalVel4 = V4Mul(f.rbXnX, angState1T0); + + normalVel1 = V4MulAdd(linVel0T1, normalT1, normalVel1); + normalVel2 = V4MulAdd(f.raXnY, angState0T1, normalVel2); + normalVel3 = V4MulAdd(linVel1T1, normalT1, normalVel3); + normalVel4 = V4MulAdd(f.rbXnY, angState1T1, normalVel4); + + normalVel1 = V4MulAdd(linVel0T2, normalT2, normalVel1); + normalVel2 = V4MulAdd(f.raXnZ, angState0T2, normalVel2); + normalVel3 = V4MulAdd(linVel1T2, normalT2, normalVel3); + normalVel4 = V4MulAdd(f.rbXnZ, angState1T2, normalVel4); + + const Vec4V normalVel_tmp2 = V4Add(normalVel1, normalVel2); + const Vec4V normalVel_tmp1 = V4Add(normalVel3, normalVel4); + + // appliedForce -bias * velMultiplier - a hoisted part of the total impulse computation + + const Vec4V normalVel = V4Sub(normalVel_tmp2, normalVel_tmp1 ); + + const Vec4V tmp1 = V4Sub(appliedForce, f.scaledBias); + + const Vec4V totalImpulse = V4NegMulSub(normalVel, f.velMultiplier, tmp1); + + broken = BOr(broken, V4IsGrtr(V4Abs(totalImpulse), maxFrictionImpulse)); + + const Vec4V newAppliedForce = V4Sel(broken, V4Min(maxDynFrictionImpulse, V4Max(negMaxDynFrictionImpulse, totalImpulse)), totalImpulse); + + const Vec4V deltaF =V4Sub(newAppliedForce, appliedForce); + + frictionAppliedForce[i] = newAppliedForce; + + const Vec4V deltaFIM0 = V4Mul(deltaF, invMassA); + const Vec4V deltaFIM1 = V4Mul(deltaF, invMassB); + + const Vec4V angDetaF0 = V4Mul(deltaF, angD0); + const Vec4V angDetaF1 = V4Mul(deltaF, angD1); + + linVel0T0 = V4MulAdd(normalT0, deltaFIM0, linVel0T0); + linVel1T0 = V4NegMulSub(normalT0, deltaFIM1, linVel1T0); + angState0T0 = V4MulAdd(f.raXnX, angDetaF0, angState0T0); + angState1T0 = V4NegMulSub(f.rbXnX, angDetaF1, angState1T0); + + linVel0T1 = V4MulAdd(normalT1, deltaFIM0, linVel0T1); + linVel1T1 = V4NegMulSub(normalT1, deltaFIM1, linVel1T1); + angState0T1 = V4MulAdd(f.raXnY, angDetaF0, angState0T1); + angState1T1 = V4NegMulSub(f.rbXnY, angDetaF1, angState1T1); + + linVel0T2 = V4MulAdd(normalT2, deltaFIM0, linVel0T2); + linVel1T2 = V4NegMulSub(normalT2, deltaFIM1, linVel1T2); + angState0T2 = V4MulAdd(f.raXnZ, angDetaF0, angState0T2); + angState1T2 = V4NegMulSub(f.rbXnZ, angDetaF1, angState1T2); + } + fd->broken = broken; + } + } + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(linVel1T0, linVel1T1, linVel1T2, linVel1T3, linVel01, linVel11, linVel21, linVel31); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + PX_TRANSPOSE_44(angState1T0, angState1T1, angState1T2, angState1T3, angState01, angState11, angState21, angState31); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularState.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularState.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularState.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularState.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularState.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularState.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularState.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularState.isFinite()); + + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(angState00, &b00.angularState.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(angState10, &b10.angularState.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(angState20, &b20.angularState.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + V4StoreA(angState30, &b30.angularState.x); + + if(desc[0].bodyBDataIndex != 0) + { + V4StoreA(linVel01, &b01.linearVelocity.x); + V4StoreA(angState01, &b01.angularState.x); + } + if(desc[1].bodyBDataIndex != 0) + { + V4StoreA(linVel11, &b11.linearVelocity.x); + V4StoreA(angState11, &b11.angularState.x); + } + if(desc[2].bodyBDataIndex != 0) + { + V4StoreA(linVel21, &b21.linearVelocity.x); + V4StoreA(angState21, &b21.angularState.x); + } + if(desc[3].bodyBDataIndex != 0) + { + V4StoreA(linVel31, &b31.linearVelocity.x); + V4StoreA(angState31, &b31.angularState.x); + } + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularState.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularState.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularState.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularState.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularState.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularState.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularState.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularState.isFinite()); +} + +static void solveContact4_StaticBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& cache) +{ + PxSolverBody& b00 = *desc[0].bodyA; + PxSolverBody& b10 = *desc[1].bodyA; + PxSolverBody& b20 = *desc[2].bodyA; + PxSolverBody& b30 = *desc[3].bodyA; + + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + + //We'll need this. + const Vec4V vZero = V4Zero(); + Vec4V vMax = V4Splat(FMax()); + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularState.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularState.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularState.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularState.x); + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + + const PxU8* PX_RESTRICT prefetchAddress = currPtr + sizeof(SolverContactHeader4) + sizeof(SolverContactBatchPointBase4); + + const SolverContactHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + const Vec4V invMass0 = hdr->invMass0D0; + + while((currPtr < last)) + { + hdr = reinterpret_cast(currPtr); + + PX_ASSERT(hdr->type == DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT); + + currPtr = const_cast(reinterpret_cast(hdr + 1)); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + Vec4V* appliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numNormalConstr; + + SolverContactBatchPointBase4* PX_RESTRICT contacts = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(contacts + numNormalConstr); + + Vec4V* maxImpulses; + PxU32 maxImpulseMask; + if(hasMaxImpulse) + { + maxImpulseMask = 0xFFFFFFFF; + maxImpulses = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V) * numNormalConstr; + } + else + { + maxImpulseMask = 0; + maxImpulses = &vMax; + } + + SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(currPtr); + if(numFrictionConstr) + currPtr += sizeof(SolverFrictionSharedData4); + + Vec4V* frictionAppliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numFrictionConstr; + + const SolverContactFrictionBase4* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionBase4); + + + Vec4V accumulatedNormalImpulse = vZero; + + const Vec4V angD0 = hdr->angDom0; + const Vec4V _normalT0 = hdr->normalX; + const Vec4V _normalT1 = hdr->normalY; + const Vec4V _normalT2 = hdr->normalZ; + + Vec4V contactNormalVel1 = V4Mul(linVel0T0, _normalT0); + contactNormalVel1 = V4MulAdd(linVel0T1, _normalT1, contactNormalVel1); + + contactNormalVel1 = V4MulAdd(linVel0T2, _normalT2, contactNormalVel1); + + Vec4V accumDeltaF = vZero; + + + for(PxU32 i=0;istaticFriction; + + const Vec4V dynamicFric = hdr->dynamicFriction; + + const Vec4V maxFrictionImpulse = V4Mul(staticFric, accumulatedNormalImpulse); + const Vec4V maxDynFrictionImpulse = V4Mul(dynamicFric, accumulatedNormalImpulse); + const Vec4V negMaxDynFrictionImpulse = V4Neg(maxDynFrictionImpulse); + + BoolV broken = BFFFF(); + + if(cache.writeBackIteration) + { + PxPrefetchLine(fd->frictionBrokenWritebackByte[0]); + PxPrefetchLine(fd->frictionBrokenWritebackByte[1]); + PxPrefetchLine(fd->frictionBrokenWritebackByte[2]); + PxPrefetchLine(fd->frictionBrokenWritebackByte[3]); + } + + for(PxU32 i=0;inormalX[i&1]; + const Vec4V normalT1 = fd->normalY[i&1]; + const Vec4V normalT2 = fd->normalZ[i&1]; + + Vec4V normalVel1 = V4Mul(linVel0T0, normalT0); + Vec4V normalVel2 = V4Mul(f.raXnX, angState0T0); + + normalVel1 = V4MulAdd(linVel0T1, normalT1, normalVel1); + normalVel2 = V4MulAdd(f.raXnY, angState0T1, normalVel2); + + normalVel1 = V4MulAdd(linVel0T2, normalT2, normalVel1); + normalVel2 = V4MulAdd(f.raXnZ, angState0T2, normalVel2); + + //relative normal velocity for all 4 constraints + const Vec4V normalVel = V4Add(normalVel1, normalVel2); + + // appliedForce -bias * velMultiplier - a hoisted part of the total impulse computation + const Vec4V tmp1 = V4Sub(appliedForce, f.scaledBias); + + const Vec4V totalImpulse = V4NegMulSub(normalVel, f.velMultiplier, tmp1); + + broken = BOr(broken, V4IsGrtr(V4Abs(totalImpulse), maxFrictionImpulse)); + + const Vec4V newAppliedForce = V4Sel(broken, V4Min(maxDynFrictionImpulse, V4Max(negMaxDynFrictionImpulse, totalImpulse)), totalImpulse); + + const Vec4V deltaF =V4Sub(newAppliedForce, appliedForce); + + const Vec4V deltaFInvMass = V4Mul(invMass0, deltaF); + const Vec4V angDeltaF = V4Mul(angD0, deltaF); + + linVel0T0 = V4MulAdd(normalT0, deltaFInvMass, linVel0T0); + angState0T0 = V4MulAdd(f.raXnX, angDeltaF, angState0T0); + + linVel0T1 = V4MulAdd(normalT1, deltaFInvMass, linVel0T1); + angState0T1 = V4MulAdd(f.raXnY, angDeltaF, angState0T1); + + linVel0T2 = V4MulAdd(normalT2, deltaFInvMass, linVel0T2); + angState0T2 = V4MulAdd(f.raXnZ, angDeltaF, angState0T2); + +#if 1 + frictionAppliedForces[i] = newAppliedForce; +#endif + + } + + fd->broken = broken; + } + } + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularState.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularState.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularState.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularState.isFinite()); + + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + + V4StoreA(angState00, &b00.angularState.x); + V4StoreA(angState10, &b10.angularState.x); + V4StoreA(angState20, &b20.angularState.x); + V4StoreA(angState30, &b30.angularState.x); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularState.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularState.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularState.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularState.isFinite()); +} + +static void concludeContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& /*cache*/, PxU32 contactSize, PxU32 frictionSize) +{ + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + while((currPtr < last)) + { + const SolverContactHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + currPtr = const_cast(reinterpret_cast(hdr + 1)); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + currPtr += sizeof(Vec4V)*numNormalConstr; + + SolverContactBatchPointBase4* PX_RESTRICT contacts = reinterpret_cast(currPtr); + currPtr += (numNormalConstr * contactSize); + bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + if(hasMaxImpulse) + currPtr += sizeof(Vec4V) * numNormalConstr; + + currPtr += sizeof(Vec4V)*numFrictionConstr; + + SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(currPtr); + if(numFrictionConstr) + currPtr += sizeof(SolverFrictionSharedData4); + PX_UNUSED(fd); + + SolverContactFrictionBase4* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += (numFrictionConstr * frictionSize); + + for(PxU32 i=0;i((reinterpret_cast(contacts)) + contactSize); + c.biasedErr = V4Sub(c.biasedErr, c.scaledBias); + } + + for(PxU32 i=0;i((reinterpret_cast(frictions)) + frictionSize); + f.scaledBias = f.targetVelocity; + } + } +} + +void writeBackContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& cache, + const PxSolverBodyData** PX_RESTRICT bd0, const PxSolverBodyData** PX_RESTRICT bd1) +{ + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + PxReal* PX_RESTRICT vForceWriteback0 = reinterpret_cast(desc[0].writeBack); + PxReal* PX_RESTRICT vForceWriteback1 = reinterpret_cast(desc[1].writeBack); + PxReal* PX_RESTRICT vForceWriteback2 = reinterpret_cast(desc[2].writeBack); + PxReal* PX_RESTRICT vForceWriteback3 = reinterpret_cast(desc[3].writeBack); + + const PxU8 type = *desc[0].constraint; + const PxU32 contactSize = type == DY_SC_TYPE_BLOCK_RB_CONTACT ? sizeof(SolverContactBatchPointDynamic4) : sizeof(SolverContactBatchPointBase4); + const PxU32 frictionSize = type == DY_SC_TYPE_BLOCK_RB_CONTACT ? sizeof(SolverContactFrictionDynamic4) : sizeof(SolverContactFrictionBase4); + + + Vec4V normalForce = V4Zero(); + + + //We'll need this. + //const Vec4V vZero = V4Zero(); + + bool writeBackThresholds[4] = {false, false, false, false}; + + while((currPtr < last)) + { + SolverContactHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(hdr + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + Vec4V* PX_RESTRICT appliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numNormalConstr; + + //SolverContactBatchPointBase4* PX_RESTRICT contacts = (SolverContactBatchPointBase4*)currPtr; + currPtr += (numNormalConstr * contactSize); + + bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + if(hasMaxImpulse) + currPtr += sizeof(Vec4V) * numNormalConstr; + + SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(currPtr); + if(numFrictionConstr) + currPtr += sizeof(SolverFrictionSharedData4); + + currPtr += sizeof(Vec4V)*numFrictionConstr; + + //SolverContactFrictionBase4* PX_RESTRICT frictions = (SolverContactFrictionBase4*)currPtr; + currPtr += (numFrictionConstr * frictionSize); + + writeBackThresholds[0] = hdr->flags[0] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[1] = hdr->flags[1] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[2] = hdr->flags[2] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[3] = hdr->flags[3] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + + + for(PxU32 i=0;inumNormalConstr0) + FStore(appliedForce0, vForceWriteback0++); + if(vForceWriteback1 && i < hdr->numNormalConstr1) + FStore(appliedForce1, vForceWriteback1++); + if(vForceWriteback2 && i < hdr->numNormalConstr2) + FStore(appliedForce2, vForceWriteback2++); + if(vForceWriteback3 && i < hdr->numNormalConstr3) + FStore(appliedForce3, vForceWriteback3++); + } + + if(numFrictionConstr) + { + PX_ALIGN(16, PxU32 broken[4]); + BStoreA(fd->broken, broken); + + PxU8* frictionCounts = &hdr->numFrictionConstr0; + + for(PxU32 a = 0; a < 4; ++a) + { + if(frictionCounts[a] && broken[a]) + *fd->frictionBrokenWritebackByte[a] = 1; // PT: bad L2 miss here + } + } + } + + PX_ALIGN(16, PxReal nf[4]); + V4StoreA(normalForce, nf); + + Sc::ShapeInteraction** shapeInteractions = reinterpret_cast(desc[0].constraint)->shapeInteraction; + + for(PxU32 a = 0; a < 4; ++a) + { + if(writeBackThresholds[a] && desc[a].linkIndexA == PxSolverConstraintDesc::RIGID_BODY && desc[a].linkIndexB == PxSolverConstraintDesc::RIGID_BODY && + nf[a] !=0.f && (bd0[a]->reportThreshold < PX_MAX_REAL || bd1[a]->reportThreshold < PX_MAX_REAL)) + { + ThresholdStreamElement elt; + elt.normalForce = nf[a]; + elt.threshold = PxMin(bd0[a]->reportThreshold, bd1[a]->reportThreshold); + elt.nodeIndexA = PxNodeIndex(bd0[a]->nodeIndex); + elt.nodeIndexB = PxNodeIndex(bd1[a]->nodeIndex); + elt.shapeInteraction = shapeInteractions[a]; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + PX_ASSERT(cache.mThresholdStreamIndex(bPtr); + SolverConstraint1DDynamic4* PX_RESTRICT base = reinterpret_cast(header+1); + + //const FloatV fZero = FZero(); + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&b01.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularState.x); + Vec4V angState01 = V4LoadA(&b01.angularState.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&b11.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularState.x); + Vec4V angState11 = V4LoadA(&b11.angularState.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&b21.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularState.x); + Vec4V angState21 = V4LoadA(&b21.angularState.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&b31.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularState.x); + Vec4V angState31 = V4LoadA(&b31.angularState.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V linVel1T0, linVel1T1, linVel1T2, linVel1T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + Vec4V angState1T0, angState1T1, angState1T2, angState1T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2, linVel1T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + PX_TRANSPOSE_44(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2, angState1T3); + + const Vec4V invMass0D0 = header->invMass0D0; + const Vec4V invMass1D1 = header->invMass1D1; + + const Vec4V angD0 = header->angD0; + const Vec4V angD1 = header->angD1; + + PxU32 maxConstraints = header->count; + + for(PxU32 a = 0; a < maxConstraints; ++a) + { + SolverConstraint1DDynamic4& c = *base; + base++; + + PxPrefetchLine(base); + PxPrefetchLine(base, 64); + PxPrefetchLine(base, 128); + PxPrefetchLine(base, 192); + PxPrefetchLine(base, 256); + + const Vec4V appliedForce = c.appliedForce; + + Vec4V linProj0(V4Mul(c.lin0X, linVel0T0)); + Vec4V linProj1(V4Mul(c.lin1X, linVel1T0)); + Vec4V angProj0(V4Mul(c.ang0X, angState0T0)); + Vec4V angProj1(V4Mul(c.ang1X, angState1T0)); + + linProj0 = V4MulAdd(c.lin0Y, linVel0T1, linProj0); + linProj1 = V4MulAdd(c.lin1Y, linVel1T1, linProj1); + angProj0 = V4MulAdd(c.ang0Y, angState0T1, angProj0); + angProj1 = V4MulAdd(c.ang1Y, angState1T1, angProj1); + + linProj0 = V4MulAdd(c.lin0Z, linVel0T2, linProj0); + linProj1 = V4MulAdd(c.lin1Z, linVel1T2, linProj1); + angProj0 = V4MulAdd(c.ang0Z, angState0T2, angProj0); + angProj1 = V4MulAdd(c.ang1Z, angState1T2, angProj1); + + const Vec4V projectVel0 = V4Add(linProj0, angProj0); + const Vec4V projectVel1 = V4Add(linProj1, angProj1); + + const Vec4V normalVel = V4Sub(projectVel0, projectVel1); + + const Vec4V unclampedForce = V4MulAdd(appliedForce, c.impulseMultiplier, V4MulAdd(normalVel, c.velMultiplier, c.constant)); + const Vec4V clampedForce = V4Max(c.minImpulse, V4Min(c.maxImpulse, unclampedForce)); + const Vec4V deltaF = V4Sub(clampedForce, appliedForce); + c.appliedForce = clampedForce; + + const Vec4V deltaFInvMass0 = V4Mul(deltaF, invMass0D0); + const Vec4V deltaFInvMass1 = V4Mul(deltaF, invMass1D1); + + const Vec4V angDeltaFInvMass0 = V4Mul(deltaF, angD0); + const Vec4V angDeltaFInvMass1 = V4Mul(deltaF, angD1); + + linVel0T0 = V4MulAdd(c.lin0X, deltaFInvMass0, linVel0T0); + linVel1T0 = V4NegMulSub(c.lin1X, deltaFInvMass1, linVel1T0); + angState0T0 = V4MulAdd(c.ang0X, angDeltaFInvMass0, angState0T0); + angState1T0 = V4NegMulSub(c.ang1X, angDeltaFInvMass1, angState1T0); + + linVel0T1 = V4MulAdd(c.lin0Y, deltaFInvMass0, linVel0T1); + linVel1T1 = V4NegMulSub(c.lin1Y, deltaFInvMass1, linVel1T1); + angState0T1 = V4MulAdd(c.ang0Y, angDeltaFInvMass0, angState0T1); + angState1T1 = V4NegMulSub(c.ang1Y, angDeltaFInvMass1, angState1T1); + + linVel0T2 = V4MulAdd(c.lin0Z, deltaFInvMass0, linVel0T2); + linVel1T2 = V4NegMulSub(c.lin1Z, deltaFInvMass1, linVel1T2); + angState0T2 = V4MulAdd(c.ang0Z, angDeltaFInvMass0, angState0T2); + angState1T2 = V4NegMulSub(c.ang1Z, angDeltaFInvMass1, angState1T2); + } + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(linVel1T0, linVel1T1, linVel1T2, linVel1T3, linVel01, linVel11, linVel21, linVel31); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + PX_TRANSPOSE_44(angState1T0, angState1T1, angState1T2, angState1T3, angState01, angState11, angState21, angState31); + + + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + + V4StoreA(linVel01, &b01.linearVelocity.x); + V4StoreA(linVel11, &b11.linearVelocity.x); + V4StoreA(linVel21, &b21.linearVelocity.x); + V4StoreA(linVel31, &b31.linearVelocity.x); + + V4StoreA(angState00, &b00.angularState.x); + V4StoreA(angState10, &b10.angularState.x); + V4StoreA(angState20, &b20.angularState.x); + V4StoreA(angState30, &b30.angularState.x); + + V4StoreA(angState01, &b01.angularState.x); + V4StoreA(angState11, &b11.angularState.x); + V4StoreA(angState21, &b21.angularState.x); + V4StoreA(angState31, &b31.angularState.x); + +} + +static void conclude1D4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& /*cache*/) +{ + SolverConstraint1DHeader4* header = reinterpret_cast(desc[0].constraint); + PxU8* base = desc[0].constraint + sizeof(SolverConstraint1DHeader4); + PxU32 stride = header->type == DY_SC_TYPE_BLOCK_1D ? sizeof(SolverConstraint1DDynamic4) : sizeof(SolverConstraint1DBase4); + + for(PxU32 i=0; icount; i++) + { + SolverConstraint1DBase4& c = *reinterpret_cast(base); + c.constant = c.unbiasedConstant; + base += stride; + } + PX_ASSERT(desc[0].constraint + getConstraintLength(desc[0]) == base); +} + +void writeBack1D4(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& /*cache*/, + const PxSolverBodyData** PX_RESTRICT /*bd0*/, const PxSolverBodyData** PX_RESTRICT /*bd1*/) +{ + ConstraintWriteback* writeback0 = reinterpret_cast(desc[0].writeBack); + ConstraintWriteback* writeback1 = reinterpret_cast(desc[1].writeBack); + ConstraintWriteback* writeback2 = reinterpret_cast(desc[2].writeBack); + ConstraintWriteback* writeback3 = reinterpret_cast(desc[3].writeBack); + + if(writeback0 || writeback1 || writeback2 || writeback3) + { + SolverConstraint1DHeader4* header = reinterpret_cast(desc[0].constraint); + PxU8* base = desc[0].constraint + sizeof(SolverConstraint1DHeader4); + PxU32 stride = header->type == DY_SC_TYPE_BLOCK_1D ? sizeof(SolverConstraint1DDynamic4) : sizeof(SolverConstraint1DBase4); + + const Vec4V zero = V4Zero(); + Vec4V linX(zero), linY(zero), linZ(zero); + Vec4V angX(zero), angY(zero), angZ(zero); + + for(PxU32 i=0; icount; i++) + { + const SolverConstraint1DBase4* c = reinterpret_cast(base); + + //Load in flags + const VecI32V flags = I4LoadU(reinterpret_cast(&c->flags[0])); + //Work out masks + const VecI32V mask = I4Load(DY_SC_FLAG_OUTPUT_FORCE); + + const VecI32V masked = VecI32V_And(flags, mask); + const BoolV isEq = VecI32V_IsEq(masked, mask); + + const Vec4V appliedForce = V4Sel(isEq, c->appliedForce, zero); + + linX = V4MulAdd(c->lin0X, appliedForce, linX); + linY = V4MulAdd(c->lin0Y, appliedForce, linY); + linZ = V4MulAdd(c->lin0Z, appliedForce, linZ); + + angX = V4MulAdd(c->ang0WritebackX, appliedForce, angX); + angY = V4MulAdd(c->ang0WritebackY, appliedForce, angY); + angZ = V4MulAdd(c->ang0WritebackZ, appliedForce, angZ); + + base += stride; + } + + //We need to do the cross product now + + angX = V4Sub(angX, V4NegMulSub(header->body0WorkOffsetZ, linY, V4Mul(header->body0WorkOffsetY, linZ))); + angY = V4Sub(angY, V4NegMulSub(header->body0WorkOffsetX, linZ, V4Mul(header->body0WorkOffsetZ, linX))); + angZ = V4Sub(angZ, V4NegMulSub(header->body0WorkOffsetY, linX, V4Mul(header->body0WorkOffsetX, linY))); + + const Vec4V linLenSq = V4MulAdd(linZ, linZ, V4MulAdd(linY, linY, V4Mul(linX, linX))); + const Vec4V angLenSq = V4MulAdd(angZ, angZ, V4MulAdd(angY, angY, V4Mul(angX, angX))); + + const Vec4V linLen = V4Sqrt(linLenSq); + const Vec4V angLen = V4Sqrt(angLenSq); + + const BoolV broken = BOr(V4IsGrtr(linLen, header->linBreakImpulse), V4IsGrtr(angLen, header->angBreakImpulse)); + + PX_ALIGN(16, PxU32 iBroken[4]); + BStoreA(broken, iBroken); + + Vec4V lin0, lin1, lin2, lin3; + Vec4V ang0, ang1, ang2, ang3; + + PX_TRANSPOSE_34_44(linX, linY, linZ, lin0, lin1, lin2, lin3); + PX_TRANSPOSE_34_44(angX, angY, angZ, ang0, ang1, ang2, ang3); + + if(writeback0) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin0), writeback0->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang0), writeback0->angularImpulse); + writeback0->broken = header->break0 ? PxU32(iBroken[0] != 0) : 0; + } + if(writeback1) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin1), writeback1->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang1), writeback1->angularImpulse); + writeback1->broken = header->break1 ? PxU32(iBroken[1] != 0) : 0; + } + if(writeback2) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin2), writeback2->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang2), writeback2->angularImpulse); + writeback2->broken = header->break2 ? PxU32(iBroken[2] != 0) : 0; + } + if(writeback3) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin3), writeback3->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang3), writeback3->angularImpulse); + writeback3->broken = header->break3 ? PxU32(iBroken[3] != 0) : 0; + } + + PX_ASSERT(desc[0].constraint + getConstraintLength(desc[0]) == base); + } +} + + +void solveContactPreBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_Block(desc, cache); +} + +void solveContactPreBlock_Static(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_StaticBlock(desc, cache); +} + +void solveContactPreBlock_Conclude(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_Block(desc, cache); + concludeContact4_Block(desc, cache, sizeof(SolverContactBatchPointDynamic4), sizeof(SolverContactFrictionDynamic4)); +} + +void solveContactPreBlock_ConcludeStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_StaticBlock(desc, cache); + concludeContact4_Block(desc, cache, sizeof(SolverContactBatchPointBase4), sizeof(SolverContactFrictionBase4)); +} + +void solveContactPreBlock_WriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_Block(desc, cache); + + const PxSolverBodyData* bd0[4] = { &cache.solverBodyArray[desc[0].bodyADataIndex], + &cache.solverBodyArray[desc[1].bodyADataIndex], + &cache.solverBodyArray[desc[2].bodyADataIndex], + &cache.solverBodyArray[desc[3].bodyADataIndex]}; + + const PxSolverBodyData* bd1[4] = { &cache.solverBodyArray[desc[0].bodyBDataIndex], + &cache.solverBodyArray[desc[1].bodyBDataIndex], + &cache.solverBodyArray[desc[2].bodyBDataIndex], + &cache.solverBodyArray[desc[3].bodyBDataIndex]}; + + writeBackContact4_Block(desc, cache, bd0, bd1); + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveContactPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContact4_StaticBlock(desc, cache); + const PxSolverBodyData* bd0[4] = { &cache.solverBodyArray[desc[0].bodyADataIndex], + &cache.solverBodyArray[desc[1].bodyADataIndex], + &cache.solverBodyArray[desc[2].bodyADataIndex], + &cache.solverBodyArray[desc[3].bodyADataIndex]}; + + const PxSolverBodyData* bd1[4] = { &cache.solverBodyArray[desc[0].bodyBDataIndex], + &cache.solverBodyArray[desc[1].bodyBDataIndex], + &cache.solverBodyArray[desc[2].bodyBDataIndex], + &cache.solverBodyArray[desc[3].bodyBDataIndex]}; + + writeBackContact4_Block(desc, cache, bd0, bd1); + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solve1D4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solve1D4_Block(desc, cache); +} + + +void solve1D4Block_Conclude(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solve1D4_Block(desc, cache); + conclude1D4_Block(desc, cache); +} + + +void solve1D4Block_WriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solve1D4_Block(desc, cache); + + const PxSolverBodyData* bd0[4] = { &cache.solverBodyArray[desc[0].bodyADataIndex], + &cache.solverBodyArray[desc[1].bodyADataIndex], + &cache.solverBodyArray[desc[2].bodyADataIndex], + &cache.solverBodyArray[desc[3].bodyADataIndex]}; + + const PxSolverBodyData* bd1[4] = { &cache.solverBodyArray[desc[0].bodyBDataIndex], + &cache.solverBodyArray[desc[1].bodyBDataIndex], + &cache.solverBodyArray[desc[2].bodyBDataIndex], + &cache.solverBodyArray[desc[3].bodyBDataIndex]}; + + writeBack1D4(desc, cache, bd0, bd1); +} + +void writeBack1D4Block(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + const PxSolverBodyData* bd0[4] = { &cache.solverBodyArray[desc[0].bodyADataIndex], + &cache.solverBodyArray[desc[1].bodyADataIndex], + &cache.solverBodyArray[desc[2].bodyADataIndex], + &cache.solverBodyArray[desc[3].bodyADataIndex]}; + + const PxSolverBodyData* bd1[4] = { &cache.solverBodyArray[desc[0].bodyBDataIndex], + &cache.solverBodyArray[desc[1].bodyBDataIndex], + &cache.solverBodyArray[desc[2].bodyBDataIndex], + &cache.solverBodyArray[desc[3].bodyBDataIndex]}; + + writeBack1D4(desc, cache, bd0, bd1); +} + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsShared.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsShared.h new file mode 100644 index 0000000..2efb4b7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverConstraintsShared.h @@ -0,0 +1,170 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONSTRAINT_SHARED_H +#define DY_SOLVER_CONSTRAINT_SHARED_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" + +#include "DySolverBody.h" +#include "DySolverContact.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraintDesc.h" +#include "foundation/PxUtilities.h" +#include "DyConstraint.h" +#include "foundation/PxAtomic.h" + + +namespace physx +{ + +namespace Dy +{ + PX_FORCE_INLINE static FloatV solveDynamicContacts(SolverContactPoint* contacts, const PxU32 nbContactPoints, const Vec3VArg contactNormal, + const FloatVArg invMassA, const FloatVArg invMassB, const FloatVArg angDom0, const FloatVArg angDom1, Vec3V& linVel0_, Vec3V& angState0_, + Vec3V& linVel1_, Vec3V& angState1_, PxF32* PX_RESTRICT forceBuffer) +{ + Vec3V linVel0 = linVel0_; + Vec3V angState0 = angState0_; + Vec3V linVel1 = linVel1_; + Vec3V angState1 = angState1_; + FloatV accumulatedNormalImpulse = FZero(); + + const Vec3V delLinVel0 = V3Scale(contactNormal, invMassA); + const Vec3V delLinVel1 = V3Scale(contactNormal, invMassB); + + for(PxU32 i=0;i +#include +#include "DySolverBody.h" +#include "DySolverConstraint1D.h" +#include "DySolverContact.h" +#include "DyThresholdTable.h" +#include "DySolverControl.h" +#include "DyArticulationPImpl.h" +#include "foundation/PxThread.h" +#include "DySolverConstraintDesc.h" +#include "DySolverContext.h" +#include "DyFeatherstoneArticulation.h" + + +namespace physx +{ + +namespace Dy +{ + +//----------------------------------- + +void solve1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContact_BStaticBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock_Static (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4_Block (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + + +void solve1DConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContact_BStaticConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock_Conclude (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock_ConcludeStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4Block_Conclude (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solve1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContact_BStaticBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4Block_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void writeBack1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void contactBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void extContactBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void ext1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void contactPreBlock_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void writeBack1D4Block (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +// could move this to PxPreprocessor.h but +// no implementation available for MSVC +#if PX_GCC_FAMILY +#define PX_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +#define PX_UNUSED_ATTRIBUTE +#endif + +#define DYNAMIC_ARTICULATION_REGISTRATION(x) 0 + +static SolveBlockMethod gVTableSolveBlock[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactBlock, // DY_SC_TYPE_RB_CONTACT + solve1DBlock, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactBlock), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DBlock), // DY_SC_TYPE_EXT_1D + solveContact_BStaticBlock, // DY_SC_TYPE_STATIC_CONTACT + solveContactBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactPreBlock, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactPreBlock_Static, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4_Block, // DY_SC_TYPE_BLOCK_1D, +}; + +static SolveWriteBackBlockMethod gVTableSolveWriteBackBlock[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactBlockWriteBack, // DY_SC_TYPE_RB_CONTACT + solve1DBlockWriteBack, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactBlockWriteBack), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DBlockWriteBack), // DY_SC_TYPE_EXT_1D + solveContact_BStaticBlockWriteBack, // DY_SC_TYPE_STATIC_CONTACT + solveContactBlockWriteBack, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactPreBlock_WriteBack, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactPreBlock_WriteBackStatic, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4Block_WriteBack, // DY_SC_TYPE_BLOCK_1D, +}; + +static SolveBlockMethod gVTableSolveConcludeBlock[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactConcludeBlock, // DY_SC_TYPE_RB_CONTACT + solve1DConcludeBlock, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactConcludeBlock), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DConcludeBlock), // DY_SC_TYPE_EXT_1D + solveContact_BStaticConcludeBlock, // DY_SC_TYPE_STATIC_CONTACT + solveContactConcludeBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactPreBlock_Conclude, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactPreBlock_ConcludeStatic, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4Block_Conclude, // DY_SC_TYPE_BLOCK_1D, +}; + +void SolverCoreRegisterArticulationFns() +{ + gVTableSolveBlock[DY_SC_TYPE_EXT_CONTACT] = solveExtContactBlock; + gVTableSolveBlock[DY_SC_TYPE_EXT_1D] = solveExt1DBlock; + + gVTableSolveWriteBackBlock[DY_SC_TYPE_EXT_CONTACT] = solveExtContactBlockWriteBack; + gVTableSolveWriteBackBlock[DY_SC_TYPE_EXT_1D] = solveExt1DBlockWriteBack; + gVTableSolveConcludeBlock[DY_SC_TYPE_EXT_CONTACT] = solveExtContactConcludeBlock; + gVTableSolveConcludeBlock[DY_SC_TYPE_EXT_1D] = solveExt1DConcludeBlock; +} + +SolveBlockMethod* getSolveBlockTable() +{ + return gVTableSolveBlock; +} + +SolveBlockMethod* getSolverConcludeBlockTable() +{ + return gVTableSolveConcludeBlock; +} + +SolveWriteBackBlockMethod* getSolveWritebackBlockTable() +{ + return gVTableSolveWriteBackBlock; +} + +SolverCoreGeneral* SolverCoreGeneral::create(bool fricEveryIteration) +{ + SolverCoreGeneral* scg = reinterpret_cast( + PX_ALLOC(sizeof(SolverCoreGeneral), "SolverCoreGeneral")); + + if (scg) + { + PX_PLACEMENT_NEW(scg, SolverCoreGeneral); + scg->frictionEveryIteration = fricEveryIteration; + } + + return scg; +} + +void SolverCoreGeneral::destroyV() +{ + this->~SolverCoreGeneral(); + PX_FREE_THIS; +} + +void SolverCoreGeneral::solveV_Blocks(SolverIslandParams& params) const +{ + const PxI32 TempThresholdStreamSize = 32; + ThresholdStreamElement tempThresholdStream[TempThresholdStreamSize]; + + SolverContext cache; + cache.solverBodyArray = params.bodyDataList; + cache.mThresholdStream = tempThresholdStream; + cache.mThresholdStreamLength = TempThresholdStreamSize; + cache.mThresholdStreamIndex = 0; + cache.writeBackIteration = false; + cache.Z = params.Z; + cache.deltaV = params.deltaV; + + const PxI32 batchCount = PxI32(params.numConstraintHeaders); + + PxSolverBody* PX_RESTRICT bodyListStart = params.bodyListStart; + const PxU32 bodyListSize = params.bodyListSize; + + Cm::SpatialVector* PX_RESTRICT motionVelocityArray = params.motionVelocityArray; + + const PxU32 velocityIterations = params.velocityIterations; + const PxU32 positionIterations = params.positionIterations; + + const PxU32 numConstraintHeaders = params.numConstraintHeaders; + const PxU32 articulationListSize = params.articulationListSize; + + ArticulationSolverDesc* PX_RESTRICT articulationListStart = params.articulationListStart; + + PX_ASSERT(positionIterations >= 1); + + if(numConstraintHeaders == 0) + { + for (PxU32 baIdx = 0; baIdx < bodyListSize; baIdx++) + { + Cm::SpatialVector& motionVel = motionVelocityArray[baIdx]; + const PxSolverBody& atom = bodyListStart[baIdx]; + + motionVel.linear = atom.linearVelocity; + motionVel.angular = atom.angularState; + } + + //Even thought there are no external constraints, there may still be internal constraints in the articulations... + for(PxU32 i = 0; i < positionIterations; ++i) + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + + for (PxU32 i = 0; i < articulationListSize; i++) + ArticulationPImpl::saveVelocity(articulationListStart[i], cache.deltaV); + + for (PxU32 i = 0; i < velocityIterations; ++i) + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->writebackInternalConstraints(false); + + return; + } + + BatchIterator contactIterator(params.constraintBatchHeaders, params.numConstraintHeaders); + + PxSolverConstraintDesc* PX_RESTRICT constraintList = params.constraintList; + + //0-(n-1) iterations + PxI32 normalIter = 0; + + for (PxU32 iteration = positionIterations; iteration > 0; iteration--) //decreasing positive numbers == position iters + { + cache.doFriction = this->frictionEveryIteration ? true : iteration <= 3; + + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, iteration == 1 ? gVTableSolveConcludeBlock : gVTableSolveBlock, normalIter); + + for (PxU32 i = 0; i < articulationListSize; ++i) + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + + ++normalIter; + } + + for (PxU32 baIdx = 0; baIdx < bodyListSize; baIdx++) + { + const PxSolverBody& atom = bodyListStart[baIdx]; + Cm::SpatialVector& motionVel = motionVelocityArray[baIdx]; + motionVel.linear = atom.linearVelocity; + motionVel.angular = atom.angularState; + } + + for (PxU32 i = 0; i < articulationListSize; i++) + ArticulationPImpl::saveVelocity(articulationListStart[i], cache.deltaV); + + const PxI32 velItersMinOne = (PxI32(velocityIterations)) - 1; + + PxI32 iteration = 0; + + for(; iteration < velItersMinOne; ++iteration) + { + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, gVTableSolveBlock, normalIter); + + for (PxU32 i = 0; i < articulationListSize; ++i) + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + ++normalIter; + } + + PxI32* outThresholdPairs = params.outThresholdPairs; + ThresholdStreamElement* PX_RESTRICT thresholdStream = params.thresholdStream; + PxU32 thresholdStreamLength = params.thresholdStreamLength; + + cache.writeBackIteration = true; + cache.mSharedThresholdStream = thresholdStream; + cache.mSharedThresholdStreamLength = thresholdStreamLength; + cache.mSharedOutThresholdPairs = outThresholdPairs; + //PGS solver always runs at least one velocity iteration (otherwise writeback won't happen) + { + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, gVTableSolveWriteBackBlock, normalIter); + + for (PxU32 i = 0; i < articulationListSize; ++i) + { + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + articulationListStart[i].articulation->writebackInternalConstraints(false); + } + + ++normalIter; + } + + //Write back remaining threshold streams + if(cache.mThresholdStreamIndex > 0) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(outThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 b = 0; b < cache.mThresholdStreamIndex; ++b) + { + thresholdStream[b + threshIndex] = cache.mThresholdStream[b]; + } + cache.mThresholdStreamIndex = 0; + } +} + +PxI32 SolverCoreGeneral::solveVParallelAndWriteBack +(SolverIslandParams& params, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) const +{ +#if PX_PROFILE_SOLVE_STALLS + PxU64 startTime = readTimer(); + + PxU64 stallCount = 0; +#endif + + SolverContext cache; + cache.solverBodyArray = params.bodyDataList; + const PxU32 batchSize = params.batchSize; + + const PxI32 UnrollCount = PxI32(batchSize); + const PxI32 ArticCount = 2; + const PxI32 SaveUnrollCount = 32; + + const PxI32 TempThresholdStreamSize = 32; + ThresholdStreamElement tempThresholdStream[TempThresholdStreamSize]; + + const PxI32 bodyListSize = PxI32(params.bodyListSize); + const PxI32 articulationListSize = PxI32(params.articulationListSize); + + const PxI32 batchCount = PxI32(params.numConstraintHeaders); + cache.mThresholdStream = tempThresholdStream; + cache.mThresholdStreamLength = TempThresholdStreamSize; + cache.mThresholdStreamIndex = 0; + cache.writeBackIteration = false; + cache.Z = Z; + cache.deltaV = deltaV; + + const PxReal dt = params.dt; + const PxReal invDt = params.invDt; + + const PxI32 positionIterations = PxI32(params.positionIterations); + const PxI32 velocityIterations = PxI32(params.velocityIterations); + + PxI32* constraintIndex = ¶ms.constraintIndex; + PxI32* constraintIndex2 = ¶ms.constraintIndex2; + + PxI32* articIndex = ¶ms.articSolveIndex; + PxI32* articIndex2 = ¶ms.articSolveIndex2; + + PxSolverConstraintDesc* PX_RESTRICT constraintList = params.constraintList; + + ArticulationSolverDesc* PX_RESTRICT articulationListStart = params.articulationListStart; + + const PxU32 nbPartitions = params.nbPartitions; + + PxU32* headersPerPartition = params.headersPerPartition; + + PX_UNUSED(velocityIterations); + + PX_ASSERT(velocityIterations >= 1); + PX_ASSERT(positionIterations >= 1); + + PxI32 endIndexCount = UnrollCount; + PxI32 index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + + PxI32 articSolveStart = 0; + PxI32 articSolveEnd = 0; + PxI32 maxArticIndex = 0; + PxI32 articIndexCounter = 0; + + BatchIterator contactIter(params.constraintBatchHeaders, params.numConstraintHeaders); + + PxI32 maxNormalIndex = 0; + PxI32 normalIteration = 0; + PxU32 a = 0; + PxI32 targetConstraintIndex = 0; + PxI32 targetArticIndex = 0; + + for(PxU32 i = 0; i < 2; ++i) + { + SolveBlockMethod* solveTable = i == 0 ? gVTableSolveBlock : gVTableSolveConcludeBlock; + for(; a < positionIterations - 1 + i; ++a) + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + + cache.doFriction = this->frictionEveryIteration ? true : (positionIterations - a) <= 3; + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxNormalIndex += headersPerPartition[b]; + + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, solveTable, + normalIteration); + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + physx::PxAtomicAdd(constraintIndex2, nbSolved); + } + targetConstraintIndex += headersPerPartition[b]; //Increment target constraint index by batch count + } + + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + const PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + } + + articIndexCounter += articulationListSize; + + ++normalIteration; + } + } + + PxI32* bodyListIndex = ¶ms.bodyListIndex; + PxI32* bodyListIndex2 = ¶ms.bodyListIndex2; + + PxSolverBody* PX_RESTRICT bodyListStart = params.bodyListStart; + Cm::SpatialVector* PX_RESTRICT motionVelocityArray = params.motionVelocityArray; + + //Save velocity - articulated + PxI32 endIndexCount2 = SaveUnrollCount; + PxI32 index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount; + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + PxI32 nbConcluded = 0; + while(index2 < articulationListSize) + { + const PxI32 remainder = PxMin(SaveUnrollCount, (articulationListSize - index2)); + endIndexCount2 -= remainder; + for(PxI32 b = 0; b < remainder; ++b, ++index2) + { + ArticulationPImpl::saveVelocity(articulationListStart[index2], cache.deltaV); + } + if(endIndexCount2 == 0) + { + index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount; + endIndexCount2 = SaveUnrollCount; + } + nbConcluded += remainder; + } + + index2 -= articulationListSize; + + //save velocity + + while(index2 < bodyListSize) + { + const PxI32 remainder = PxMin(endIndexCount2, (bodyListSize - index2)); + endIndexCount2 -= remainder; + for(PxI32 b = 0; b < remainder; ++b, ++index2) + { + PxPrefetchLine(&bodyListStart[index2 + 8]); + PxPrefetchLine(&motionVelocityArray[index2 + 8]); + PxSolverBody& body = bodyListStart[index2]; + Cm::SpatialVector& motionVel = motionVelocityArray[index2]; + motionVel.linear = body.linearVelocity; + motionVel.angular = body.angularState; + PX_ASSERT(motionVel.linear.isFinite()); + PX_ASSERT(motionVel.angular.isFinite()); + } + + nbConcluded += remainder; + + //Branch not required because this is the last time we use this atomic variable + //if(index2 < articulationListSizePlusbodyListSize) + { + index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount - articulationListSize; + endIndexCount2 = SaveUnrollCount; + } + } + + if(nbConcluded) + { + PxMemoryBarrier(); + physx::PxAtomicAdd(bodyListIndex2, nbConcluded); + } + } + + WAIT_FOR_PROGRESS(bodyListIndex2, (bodyListSize + articulationListSize)); + + a = 1; + for(; a < params.velocityIterations; ++a) + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxNormalIndex += headersPerPartition[b]; + + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, gVTableSolveBlock, + normalIteration); + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + physx::PxAtomicAdd(constraintIndex2, nbSolved); + } + targetConstraintIndex += headersPerPartition[b]; //Increment target constraint index by batch count + } + + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + const PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + + } + ++normalIteration; + articIndexCounter += articulationListSize; + } + + ThresholdStreamElement* PX_RESTRICT thresholdStream = params.thresholdStream; + PxU32 thresholdStreamLength = params.thresholdStreamLength; + PxI32* outThresholdPairs = params.outThresholdPairs; + + cache.mSharedOutThresholdPairs = outThresholdPairs; + cache.mSharedThresholdStream = thresholdStream; + cache.mSharedThresholdStreamLength = thresholdStreamLength; + + //Last iteration - do writeback as well! + cache.writeBackIteration = true; + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxNormalIndex += headersPerPartition[b]; + + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, gVTableSolveWriteBackBlock, + normalIteration); + + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + physx::PxAtomicAdd(constraintIndex2, nbSolved); + } + targetConstraintIndex += headersPerPartition[b]; //Increment target constraint index by batch count + } + { + WAIT_FOR_PROGRESS(constraintIndex2, targetConstraintIndex); + + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + articulationListStart[articSolveStart - articIndexCounter].articulation->writebackInternalConstraints(false); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + } + } + + if(cache.mThresholdStreamIndex > 0) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(outThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 b = 0; b < cache.mThresholdStreamIndex; ++b) + { + thresholdStream[b + threshIndex] = cache.mThresholdStream[b]; + } + cache.mThresholdStreamIndex = 0; + } + + ++normalIteration; + } + +#if PX_PROFILE_SOLVE_STALLS + + PxU64 endTime = readTimer(); + PxReal totalTime = (PxReal)(endTime - startTime); + PxReal stallTime = (PxReal)stallCount; + PxReal stallRatio = stallTime/totalTime; + if(0)//stallRatio > 0.2f) + { + LARGE_INTEGER frequency; + QueryPerformanceFrequency( &frequency ); + printf("Warning -- percentage time stalled = %f; stalled for %f seconds; total Time took %f seconds\n", + stallRatio * 100.f, stallTime/(PxReal)frequency.QuadPart, totalTime/(PxReal)frequency.QuadPart); + } +#endif + + return normalIteration * batchCount; +} + +void SolverCoreGeneral::writeBackV +(const PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxU32 /*constraintListSize*/, PxConstraintBatchHeader* batchHeaders, const PxU32 numBatches, + ThresholdStreamElement* PX_RESTRICT thresholdStream, const PxU32 thresholdStreamLength, PxU32& outThresholdPairs, + PxSolverBodyData* atomListData, WriteBackBlockMethod writeBackTable[]) const +{ + SolverContext cache; + cache.solverBodyArray = atomListData; + cache.mThresholdStream = thresholdStream; + cache.mThresholdStreamLength = thresholdStreamLength; + cache.mThresholdStreamIndex = 0; + + PxI32 outThreshIndex = 0; + for(PxU32 j = 0; j < numBatches; ++j) + { + PxU8 type = *constraintList[batchHeaders[j].startIndex].constraint; + writeBackTable[type](constraintList + batchHeaders[j].startIndex, + batchHeaders[j].stride, cache); + } + + outThresholdPairs = PxU32(outThreshIndex); +} + +void solveVBlock(SOLVEV_BLOCK_METHOD_ARGS) +{ + solverCore->solveV_Blocks(params); +} + +} +} + + +//#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.h new file mode 100644 index 0000000..7172a5a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControl.h @@ -0,0 +1,159 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONTROL_H +#define DY_SOLVER_CONTROL_H + +#include "DySolverCore.h" +#include "DySolverConstraintDesc.h" + +namespace physx +{ + +namespace Dy +{ + +struct FsData; + +inline void BusyWaitState(volatile PxU32* state, const PxU32 requiredState) +{ + while(requiredState != *state ); +} + +inline void WaitBodyRequiredState(PxU32* state, const PxU32 requiredState) +{ + if(*state != requiredState) + { + BusyWaitState(state, requiredState); + } +} + +inline void BusyWaitStates(volatile PxU32* stateA, volatile PxU32* stateB, const PxU32 requiredStateA, const PxU32 requiredStateB) +{ + while(*stateA != requiredStateA); + while(*stateB != requiredStateB); +} + + +class BatchIterator +{ +public: + PxConstraintBatchHeader* constraintBatchHeaders; + PxU32 mSize; + PxU32 mCurrentIndex; + + BatchIterator(PxConstraintBatchHeader* _constraintBatchHeaders, PxU32 size) : constraintBatchHeaders(_constraintBatchHeaders), + mSize(size), mCurrentIndex(0) + { + } + + PX_FORCE_INLINE const PxConstraintBatchHeader& GetCurrentHeader(const PxU32 constraintIndex) + { + PxU32 currentIndex = mCurrentIndex; + while((constraintIndex - constraintBatchHeaders[currentIndex].startIndex) >= constraintBatchHeaders[currentIndex].stride) + currentIndex = (currentIndex + 1)%mSize; + PxPrefetchLine(&constraintBatchHeaders[currentIndex], 128); + mCurrentIndex = currentIndex; + return constraintBatchHeaders[currentIndex]; + } +private: + BatchIterator& operator=(const BatchIterator&); +}; + + +inline void SolveBlockParallel (PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxI32 batchCount, const PxI32 index, + const PxI32 headerCount, SolverContext& cache, BatchIterator& iterator, + SolveBlockMethod solveTable[], + const PxI32 iteration + ) +{ + const PxI32 indA = index - (iteration * headerCount); + + const PxConstraintBatchHeader* PX_RESTRICT headers = iterator.constraintBatchHeaders; + + const PxI32 endIndex = indA + batchCount; + for(PxI32 i = indA; i < endIndex; ++i) + { + const PxConstraintBatchHeader& header = headers[i]; + + const PxI32 numToGrab = header.stride; + PxSolverConstraintDesc* PX_RESTRICT block = &constraintList[header.startIndex]; + + PxPrefetch(block[0].constraint, 384); + + for(PxI32 b = 0; b < numToGrab; ++b) + { + PxPrefetchLine(block[b].bodyA); + PxPrefetchLine(block[b].bodyB); + } + + //OK. We have a number of constraints to run... + solveTable[header.constraintType](block, PxU32(numToGrab), cache); + } +} + +class SolverCoreGeneral : public SolverCore +{ +public: + bool frictionEveryIteration; + static SolverCoreGeneral* create(bool fricEveryIteration); + + // Implements SolverCore + virtual void destroyV(); + + virtual PxI32 solveVParallelAndWriteBack + (SolverIslandParams& params, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) const; + + virtual void solveV_Blocks + (SolverIslandParams& params) const; + + virtual void writeBackV + (const PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxU32 constraintListSize, PxConstraintBatchHeader* contactConstraintBatches, const PxU32 numBatches, + ThresholdStreamElement* PX_RESTRICT thresholdStream, const PxU32 thresholdStreamLength, PxU32& outThresholdPairs, + PxSolverBodyData* atomListData, WriteBackBlockMethod writeBackTable[]) const; + +private: + + //~Implements SolverCore +}; + +#define SOLVEV_BLOCK_METHOD_ARGS SolverCore* solverCore, SolverIslandParams& params + +void solveVBlock(SOLVEV_BLOCK_METHOD_ARGS); + +SolveBlockMethod* getSolveBlockTable(); + +SolveBlockMethod* getSolverConcludeBlockTable(); + +SolveWriteBackBlockMethod* getSolveWritebackBlockTable(); + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp new file mode 100644 index 0000000..747c499 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.cpp @@ -0,0 +1,888 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxIntrinsics.h" +#include +#include +#include "DySolverBody.h" +#include "DySolverConstraint1D.h" +#include "DySolverContact.h" +#include "DyThresholdTable.h" +#include "DySolverControl.h" +#include "DyArticulationPImpl.h" +#include "foundation/PxThread.h" +#include "DySolverConstraintDesc.h" +#include "DySolverContext.h" +#include "DySolverControlPF.h" +#include "DyFeatherstoneArticulation.h" + +namespace physx +{ + +namespace Dy +{ +//----------------------------------- + +void solve1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4_Block (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + + +void solve1DConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4Block_Conclude (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solve1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExt1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solve1D4Block_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void writeBack1DBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void ext1DBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void writeBack1D4Block (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + + +void solveFrictionBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFriction_BStaticBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtFrictionBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactCoulombBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulomb_BStaticBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + + +void solveContactCoulombConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactCoulombConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulomb_BStaticConcludeBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solveContactCoulombBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtContactCoulombBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulomb_BStaticBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFrictionBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFriction_BStaticBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveExtFrictionBlockWriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +//Pre-block 1d/2d friction stuff... + +void solveContactCoulombPreBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombPreBlock_Static (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombPreBlock_Conclude (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombPreBlock_ConcludeStatic (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombPreBlock_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveContactCoulombPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFrictionCoulombPreBlock (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solveFrictionCoulombPreBlock_Static (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFrictionCoulombPreBlock_Conclude (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); +void solveFrictionCoulombPreBlock_ConcludeStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solveFrictionCoulombPreBlock_WriteBack (const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + +void solveFrictionCoulombPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache); + + +// could move this to PxPreprocessor.h but +// no implementation available for MSVC +#if PX_GCC_FAMILY +#define PX_UNUSED_ATTRIBUTE __attribute__((unused)) +#else +#define PX_UNUSED_ATTRIBUTE +#endif + +#define DYNAMIC_ARTICULATION_REGISTRATION(x) 0 + + +static SolveBlockMethod gVTableSolveBlockCoulomb[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactCoulombBlock, // DY_SC_TYPE_RB_CONTACT + solve1DBlock, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactCoulombBlock), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DBlock), // DY_SC_TYPE_EXT_1D + solveContactCoulomb_BStaticBlock, // DY_SC_TYPE_STATIC_CONTACT + solveContactCoulombBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactCoulombPreBlock, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactCoulombPreBlock_Static, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4_Block, // DY_SC_TYPE_BLOCK_1D, + solveFrictionBlock, // DY_SC_TYPE_FRICTION_CONSTRAINT + solveFriction_BStaticBlock, // DY_SC_TYPE_STATIC_FRICTION_CONSTRAINT + DYNAMIC_ARTICULATION_REGISTRATION(solveExtFrictionBlock), // DY_SC_TYPE_EXT_FRICTION_CONSTRAINT + solveFrictionCoulombPreBlock, // DY_SC_TYPE_BLOCK_FRICTION + solveFrictionCoulombPreBlock_Static // DY_SC_TYPE_BLOCK_STATIC_FRICTION +}; + +static SolveWriteBackBlockMethod gVTableSolveWriteBackBlockCoulomb[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactCoulombBlockWriteBack, // DY_SC_TYPE_RB_CONTACT + solve1DBlockWriteBack, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactCoulombBlockWriteBack), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DBlockWriteBack), // DY_SC_TYPE_EXT_1D + solveContactCoulomb_BStaticBlockWriteBack, // DY_SC_TYPE_STATIC_CONTACT + solveContactCoulombBlockWriteBack, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactCoulombPreBlock_WriteBack, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactCoulombPreBlock_WriteBackStatic, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4Block_WriteBack, // DY_SC_TYPE_BLOCK_1D, + solveFrictionBlockWriteBack, // DY_SC_TYPE_FRICTION_CONSTRAINT + solveFriction_BStaticBlockWriteBack, // DY_SC_TYPE_STATIC_FRICTION_CONSTRAINT + DYNAMIC_ARTICULATION_REGISTRATION(solveExtFrictionBlockWriteBack), // DY_SC_TYPE_EXT_FRICTION_CONSTRAINT + solveFrictionCoulombPreBlock_WriteBack, // DY_SC_TYPE_BLOCK_FRICTION + solveFrictionCoulombPreBlock_WriteBackStatic // DY_SC_TYPE_BLOCK_STATIC_FRICTION +}; + + +static SolveBlockMethod gVTableSolveConcludeBlockCoulomb[] PX_UNUSED_ATTRIBUTE = +{ + 0, + solveContactCoulombConcludeBlock, // DY_SC_TYPE_RB_CONTACT + solve1DConcludeBlock, // DY_SC_TYPE_RB_1D + DYNAMIC_ARTICULATION_REGISTRATION(solveExtContactCoulombConcludeBlock), // DY_SC_TYPE_EXT_CONTACT + DYNAMIC_ARTICULATION_REGISTRATION(solveExt1DConcludeBlock), // DY_SC_TYPE_EXT_1D + solveContactCoulomb_BStaticConcludeBlock, // DY_SC_TYPE_STATIC_CONTACT + solveContactCoulombConcludeBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContactCoulombPreBlock_Conclude, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContactCoulombPreBlock_ConcludeStatic, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4Block_Conclude, // DY_SC_TYPE_BLOCK_1D, + solveFrictionBlock, // DY_SC_TYPE_FRICTION_CONSTRAINT + solveFriction_BStaticBlock, // DY_SC_TYPE_STATIC_FRICTION_CONSTRAINT + DYNAMIC_ARTICULATION_REGISTRATION(solveExtFrictionBlock), // DY_SC_TYPE_EXT_FRICTION_CONSTRAINT + solveFrictionCoulombPreBlock_Conclude, // DY_SC_TYPE_BLOCK_FRICTION + solveFrictionCoulombPreBlock_ConcludeStatic // DY_SC_TYPE_BLOCK_STATIC_FRICTION +}; + + +void SolverCoreRegisterArticulationFnsCoulomb() +{ + gVTableSolveBlockCoulomb[DY_SC_TYPE_EXT_CONTACT] = solveExtContactCoulombBlock; + gVTableSolveBlockCoulomb[DY_SC_TYPE_EXT_1D] = solveExt1DBlock; + + gVTableSolveWriteBackBlockCoulomb[DY_SC_TYPE_EXT_CONTACT] = solveExtContactCoulombBlockWriteBack; + gVTableSolveWriteBackBlockCoulomb[DY_SC_TYPE_EXT_1D] = solveExt1DBlockWriteBack; + gVTableSolveConcludeBlockCoulomb[DY_SC_TYPE_EXT_CONTACT] = solveExtContactCoulombConcludeBlock; + gVTableSolveConcludeBlockCoulomb[DY_SC_TYPE_EXT_1D] = solveExt1DConcludeBlock; + + gVTableSolveBlockCoulomb[DY_SC_TYPE_EXT_FRICTION] = solveExtFrictionBlock; + gVTableSolveWriteBackBlockCoulomb[DY_SC_TYPE_EXT_FRICTION] = solveExtFrictionBlockWriteBack; + gVTableSolveConcludeBlockCoulomb[DY_SC_TYPE_EXT_FRICTION] = solveExtFrictionBlock; +} + +SolverCoreGeneralPF* SolverCoreGeneralPF::create() +{ + SolverCoreGeneralPF* scg = reinterpret_cast( + PX_ALLOC(sizeof(SolverCoreGeneralPF), "SolverCoreGeneral")); + + if(scg) + PX_PLACEMENT_NEW(scg, SolverCoreGeneralPF); + + return scg; +} + +void SolverCoreGeneralPF::destroyV() +{ + this->~SolverCoreGeneralPF(); + PX_FREE_THIS; +} + +void SolverCoreGeneralPF::solveV_Blocks(SolverIslandParams& params) const +{ + const PxI32 TempThresholdStreamSize = 32; + ThresholdStreamElement tempThresholdStream[TempThresholdStreamSize]; + + SolverContext cache; + cache.solverBodyArray = params.bodyDataList; + cache.mThresholdStream = tempThresholdStream; + cache.mThresholdStreamLength = TempThresholdStreamSize; + cache.mThresholdStreamIndex = 0; + cache.writeBackIteration = false; + cache.deltaV = params.deltaV; + cache.Z = params.Z; + + PxI32 batchCount = PxI32(params.numConstraintHeaders); + + PxSolverBody* PX_RESTRICT bodyListStart = params.bodyListStart; + const PxU32 bodyListSize = params.bodyListSize; + + Cm::SpatialVector* PX_RESTRICT motionVelocityArray = params.motionVelocityArray; + + const PxU32 velocityIterations = params.velocityIterations; + const PxU32 positionIterations = params.positionIterations; + + const PxU32 numConstraintHeaders = params.numConstraintHeaders; + const PxU32 articulationListSize = params.articulationListSize; + + ArticulationSolverDesc* PX_RESTRICT articulationListStart = params.articulationListStart; + + PX_ASSERT(velocityIterations >= 1); + PX_ASSERT(positionIterations >= 1); + + if(numConstraintHeaders == 0) + { + for (PxU32 baIdx = 0; baIdx < bodyListSize; baIdx++) + { + Cm::SpatialVector& motionVel = motionVelocityArray[baIdx]; + PxSolverBody& atom = bodyListStart[baIdx]; + motionVel.linear = atom.linearVelocity; + motionVel.angular = atom.angularState; + } + + //Even thought there are no external constraints, there may still be internal constraints in the articulations... + for (PxU32 i = 0; i < positionIterations; ++i) + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + + for (PxU32 i = 0; i < articulationListSize; i++) + ArticulationPImpl::saveVelocity(articulationListStart[i], cache.deltaV); + + for (PxU32 i = 0; i < velocityIterations; ++i) + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + + for (PxU32 j = 0; j < articulationListSize; ++j) + articulationListStart[j].articulation->writebackInternalConstraints(false); + + return; + } + + BatchIterator contactIterator(params.constraintBatchHeaders, params.numConstraintHeaders); + BatchIterator frictionIterator(params.frictionConstraintBatches, params.numFrictionConstraintHeaders); + + const PxI32 frictionBatchCount = PxI32(params.numFrictionConstraintHeaders); + + PxSolverConstraintDesc* PX_RESTRICT constraintList = params.constraintList; + + PxSolverConstraintDesc* PX_RESTRICT frictionConstraintList = params.frictionConstraintList; + + //0-(n-1) iterations + PxI32 normalIter = 0; + PxI32 frictionIter = 0; + for (PxU32 iteration = positionIterations; iteration > 0; iteration--) //decreasing positive numbers == position iters + { + + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, iteration == 1 ? gVTableSolveConcludeBlockCoulomb : gVTableSolveBlockCoulomb, normalIter); + + for (PxU32 i = 0; i < articulationListSize; ++i) + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + + ++normalIter; + } + + if(frictionBatchCount>0) + { + const PxU32 numIterations = positionIterations * 2; + for (PxU32 iteration = numIterations; iteration > 0; iteration--) //decreasing positive numbers == position iters + { + SolveBlockParallel(frictionConstraintList, frictionBatchCount, frictionIter * frictionBatchCount, frictionBatchCount, + cache, frictionIterator, iteration == 1 ? gVTableSolveConcludeBlockCoulomb : gVTableSolveBlockCoulomb, frictionIter); + ++frictionIter; + } + } + + for (PxU32 baIdx = 0; baIdx < bodyListSize; baIdx++) + { + const PxSolverBody& atom = bodyListStart[baIdx]; + Cm::SpatialVector& motionVel = motionVelocityArray[baIdx]; + motionVel.linear = atom.linearVelocity; + motionVel.angular = atom.angularState; + } + + for (PxU32 i = 0; i < articulationListSize; i++) + ArticulationPImpl::saveVelocity(articulationListStart[i], cache.deltaV); + + const PxU32 velItersMinOne = velocityIterations - 1; + + PxU32 iteration = 0; + + for(; iteration < velItersMinOne; ++iteration) + { + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, gVTableSolveBlockCoulomb, normalIter); + + for (PxU32 i = 0; i < articulationListSize; ++i) + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + ++normalIter; + + if(frictionBatchCount > 0) + { + SolveBlockParallel(frictionConstraintList, frictionBatchCount, frictionIter * frictionBatchCount, frictionBatchCount, + cache, frictionIterator, gVTableSolveBlockCoulomb, frictionIter); + ++frictionIter; + } + } + + PxI32* outThresholdPairs = params.outThresholdPairs; + ThresholdStreamElement* PX_RESTRICT thresholdStream = params.thresholdStream; + PxU32 thresholdStreamLength = params.thresholdStreamLength; + + cache.writeBackIteration = true; + + cache.mSharedOutThresholdPairs = outThresholdPairs; + cache.mSharedThresholdStreamLength = thresholdStreamLength; + cache.mSharedThresholdStream = thresholdStream; + + //PGS always runs one velocity iteration + { + SolveBlockParallel(constraintList, batchCount, normalIter * batchCount, batchCount, + cache, contactIterator, gVTableSolveWriteBackBlockCoulomb, normalIter); + ++normalIter; + + for (PxU32 i = 0; i < articulationListSize; ++i) + { + articulationListStart[i].articulation->solveInternalConstraints(params.dt, params.invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + articulationListStart[i].articulation->writebackInternalConstraints(false); + } + + if(frictionBatchCount > 0) + { + SolveBlockParallel(frictionConstraintList, frictionBatchCount, frictionIter * frictionBatchCount, frictionBatchCount, + cache, frictionIterator, gVTableSolveWriteBackBlockCoulomb, frictionIter); + ++frictionIter; + } + } + + //Write back remaining threshold streams + if(cache.mThresholdStreamIndex > 0) + { + //Write back to global buffer + const PxI32 threshIndex = physx::PxAtomicAdd(reinterpret_cast(&outThresholdPairs), PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 b = 0; b < cache.mThresholdStreamIndex; ++b) + { + thresholdStream[b + threshIndex] = cache.mThresholdStream[b]; + } + cache.mThresholdStreamIndex = 0; + } +} + +PxI32 SolverCoreGeneralPF::solveVParallelAndWriteBack(SolverIslandParams& params, + Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) const +{ + SolverContext cache; + cache.solverBodyArray = params.bodyDataList; + + const PxI32 UnrollCount = PxI32(params.batchSize); + const PxI32 SaveUnrollCount = 64; + const PxI32 ArticCount = 2; + + const PxI32 TempThresholdStreamSize = 32; + ThresholdStreamElement tempThresholdStream[TempThresholdStreamSize]; + + const PxI32 batchCount = PxI32(params.numConstraintHeaders); + const PxI32 frictionBatchCount = PxI32(params.numFrictionConstraintHeaders);//frictionConstraintBatches.size(); + cache.mThresholdStream = tempThresholdStream; + cache.mThresholdStreamLength = TempThresholdStreamSize; + cache.mThresholdStreamIndex = 0; + cache.Z = Z; + cache.deltaV = deltaV; + + const PxReal dt = params.dt; + const PxReal invDt = params.invDt; + + ArticulationSolverDesc* PX_RESTRICT articulationListStart = params.articulationListStart; + + const PxI32 positionIterations = PxI32(params.positionIterations); + const PxU32 velocityIterations = params.velocityIterations; + + const PxI32 bodyListSize = PxI32(params.bodyListSize); + const PxI32 articulationListSize = PxI32(params.articulationListSize); + + PX_ASSERT(velocityIterations >= 1); + PX_ASSERT(positionIterations >= 1); + + PxI32* constraintIndex = ¶ms.constraintIndex; + PxI32* constraintIndex2 = ¶ms.constraintIndex2; + PxI32* frictionConstraintIndex = ¶ms.frictionConstraintIndex; + + PxI32 endIndexCount = UnrollCount; + PxI32 index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + PxI32 frictionIndex = physx::PxAtomicAdd(frictionConstraintIndex, UnrollCount) - UnrollCount; + + BatchIterator contactIter(params.constraintBatchHeaders, params.numConstraintHeaders); + BatchIterator frictionIter(params.frictionConstraintBatches, params.numFrictionConstraintHeaders); + + PxU32* headersPerPartition = params.headersPerPartition; + PxU32 nbPartitions = params.nbPartitions; + + PxU32* frictionHeadersPerPartition = params.frictionHeadersPerPartition; + PxU32 nbFrictionPartitions = params.nbFrictionPartitions; + + PxSolverConstraintDesc* PX_RESTRICT constraintList = params.constraintList; + PxSolverConstraintDesc* PX_RESTRICT frictionConstraintList = params.frictionConstraintList; + + PxI32 maxNormalIndex = 0; + PxI32 maxProgress = 0; + PxI32 frictionEndIndexCount = UnrollCount; + PxI32 maxFrictionIndex = 0; + + PxI32 articSolveStart = 0; + PxI32 articSolveEnd = 0; + PxI32 maxArticIndex = 0; + PxI32 articIndexCounter = 0; + PxI32 targetArticIndex = 0; + + PxI32* articIndex = ¶ms.articSolveIndex; + PxI32* articIndex2 = ¶ms.articSolveIndex2; + + PxI32 normalIteration = 0; + PxI32 frictionIteration = 0; + PxU32 a = 0; + for(PxU32 i = 0; i < 2; ++i) + { + SolveBlockMethod* solveTable = i == 0 ? gVTableSolveBlockCoulomb : gVTableSolveConcludeBlockCoulomb; + for(; a < positionIterations - 1 + i; ++a) + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxNormalIndex += headersPerPartition[b]; + maxProgress += headersPerPartition[b]; + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, solveTable, + normalIteration); + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + const PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + } + + articIndexCounter += articulationListSize; + + ++normalIteration; + } + + + + } + + for(PxU32 i = 0; i < 2; ++i) + { + SolveBlockMethod* solveTable = i == 0 ? gVTableSolveBlockCoulomb : gVTableSolveConcludeBlockCoulomb; + const PxI32 numIterations = positionIterations *2; + for(; a < numIterations - 1 + i; ++a) + { + for(PxU32 b = 0; b < nbFrictionPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxProgress += frictionHeadersPerPartition[b]; + maxFrictionIndex += frictionHeadersPerPartition[b]; + PxI32 nbSolved = 0; + while(frictionIndex < maxFrictionIndex) + { + const PxI32 remainder = PxMin(maxFrictionIndex - frictionIndex, frictionEndIndexCount); + SolveBlockParallel(frictionConstraintList, remainder, frictionIndex, frictionBatchCount, cache, frictionIter, + solveTable, frictionIteration); + frictionIndex += remainder; + frictionEndIndexCount -= remainder; + nbSolved += remainder; + if(frictionEndIndexCount == 0) + { + frictionEndIndexCount = UnrollCount; + frictionIndex = physx::PxAtomicAdd(frictionConstraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + ++frictionIteration; + } + } + + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + + PxI32* bodyListIndex = ¶ms.bodyListIndex; + + + + PxSolverBody* PX_RESTRICT bodyListStart = params.bodyListStart; + + Cm::SpatialVector* PX_RESTRICT motionVelocityArray = params.motionVelocityArray; + + PxI32* bodyListIndex2 = ¶ms.bodyListIndex2; + + PxI32 endIndexCount2 = SaveUnrollCount; + PxI32 index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount; + { + PxI32 nbConcluded = 0; + while(index2 < articulationListSize) + { + const PxI32 remainder = PxMin(SaveUnrollCount, (articulationListSize - index2)); + endIndexCount2 -= remainder; + for(PxI32 b = 0; b < remainder; ++b, ++index2) + { + ArticulationPImpl::saveVelocity(articulationListStart[index2], cache.deltaV); + } + nbConcluded += remainder; + if(endIndexCount2 == 0) + { + index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount; + endIndexCount2 = SaveUnrollCount; + } + nbConcluded += remainder; + } + + index2 -= articulationListSize; + + //save velocity + + while(index2 < bodyListSize) + { + const PxI32 remainder = PxMin(endIndexCount2, (bodyListSize - index2)); + endIndexCount2 -= remainder; + for(PxI32 b = 0; b < remainder; ++b, ++index2) + { + PxPrefetchLine(&bodyListStart[index2 + 8]); + PxPrefetchLine(&motionVelocityArray[index2 + 8]); + PxSolverBody& body = bodyListStart[index2]; + Cm::SpatialVector& motionVel = motionVelocityArray[index2]; + motionVel.linear = body.linearVelocity; + motionVel.angular = body.angularState; + PX_ASSERT(motionVel.linear.isFinite()); + PX_ASSERT(motionVel.angular.isFinite()); + } + + nbConcluded += remainder; + + //Branch not required because this is the last time we use this atomic variable + //if(index2 < articulationListSizePlusbodyListSize) + { + index2 = physx::PxAtomicAdd(bodyListIndex, SaveUnrollCount) - SaveUnrollCount - articulationListSize; + endIndexCount2 = SaveUnrollCount; + } + } + + if(nbConcluded) + { + PxMemoryBarrier(); + physx::PxAtomicAdd(bodyListIndex2, nbConcluded); + } + } + + WAIT_FOR_PROGRESS(bodyListIndex2, (bodyListSize + articulationListSize)); + + a = 0; + for(; a < velocityIterations-1; ++a) + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxNormalIndex += headersPerPartition[b]; + maxProgress += headersPerPartition[b]; + + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, gVTableSolveBlockCoulomb, normalIteration); + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + ++normalIteration; + + for(PxU32 b = 0; b < nbFrictionPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxFrictionIndex += frictionHeadersPerPartition[b]; + maxProgress += frictionHeadersPerPartition[b]; + + PxI32 nbSolved = 0; + while(frictionIndex < maxFrictionIndex) + { + const PxI32 remainder = PxMin(maxFrictionIndex - frictionIndex, frictionEndIndexCount); + SolveBlockParallel(constraintList, remainder, index, batchCount, cache, contactIter, gVTableSolveBlockCoulomb, + normalIteration); + + frictionIndex += remainder; + frictionEndIndexCount -= remainder; + nbSolved += remainder; + if(frictionEndIndexCount == 0) + { + frictionEndIndexCount = UnrollCount; + frictionIndex = physx::PxAtomicAdd(frictionConstraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, true, false, 0.f, 0.8f); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + const PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + + } + + ++frictionIteration; + } + + ThresholdStreamElement* PX_RESTRICT thresholdStream = params.thresholdStream; + const PxU32 thresholdStreamLength = params.thresholdStreamLength; + PxI32* outThresholdPairs = params.outThresholdPairs; + + cache.mSharedThresholdStream = thresholdStream; + cache.mSharedOutThresholdPairs = outThresholdPairs; + cache.mSharedThresholdStreamLength = thresholdStreamLength; + + { + WAIT_FOR_PROGRESS(articIndex2, targetArticIndex); + + for(PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxNormalIndex += headersPerPartition[b]; + maxProgress += headersPerPartition[b]; + + PxI32 nbSolved = 0; + while(index < maxNormalIndex) + { + const PxI32 remainder = PxMin(maxNormalIndex - index, endIndexCount); + + SolveBlockParallel(constraintList, remainder, normalIteration * batchCount, batchCount, + cache, contactIter, gVTableSolveWriteBackBlockCoulomb, normalIteration); + + index += remainder; + endIndexCount -= remainder; + nbSolved += remainder; + if(endIndexCount == 0) + { + endIndexCount = UnrollCount; + index = physx::PxAtomicAdd(constraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + + ++normalIteration; + + cache.mSharedOutThresholdPairs = outThresholdPairs; + cache.mSharedThresholdStream = thresholdStream; + cache.mSharedThresholdStreamLength = thresholdStreamLength; + + for(PxU32 b = 0; b < nbFrictionPartitions; ++b) + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxFrictionIndex += frictionHeadersPerPartition[b]; + maxProgress += frictionHeadersPerPartition[b]; + + PxI32 nbSolved = 0; + while(frictionIndex < maxFrictionIndex) + { + const PxI32 remainder = PxMin(maxFrictionIndex - frictionIndex, frictionEndIndexCount); + + SolveBlockParallel(frictionConstraintList, remainder, frictionIndex, frictionBatchCount, cache, frictionIter, + gVTableSolveWriteBackBlockCoulomb, frictionIteration); + + frictionIndex += remainder; + frictionEndIndexCount -= remainder; + nbSolved += remainder; + if(frictionEndIndexCount == 0) + { + frictionEndIndexCount = UnrollCount; + frictionIndex = physx::PxAtomicAdd(frictionConstraintIndex, UnrollCount) - UnrollCount; + } + } + if(nbSolved) + { + PxMemoryBarrier(); + PxAtomicAdd(constraintIndex2, nbSolved); + } + } + { + WAIT_FOR_PROGRESS(constraintIndex2, maxProgress); + maxArticIndex += articulationListSize; + targetArticIndex += articulationListSize; + + while (articSolveStart < maxArticIndex) + { + const PxI32 endIdx = PxMin(articSolveEnd, maxArticIndex); + + PxI32 nbSolved = 0; + while (articSolveStart < endIdx) + { + articulationListStart[articSolveStart - articIndexCounter].articulation->solveInternalConstraints(dt, invDt, cache.Z, cache.deltaV, false, false, 0.f, 0.8f); + articulationListStart[articSolveStart - articIndexCounter].articulation->writebackInternalConstraints(false); + articSolveStart++; + nbSolved++; + } + + if (nbSolved) + { + physx::PxAtomicAdd(articIndex2, nbSolved); + } + + PxI32 remaining = articSolveEnd - articSolveStart; + + if (remaining == 0) + { + articSolveStart = physx::PxAtomicAdd(articIndex, ArticCount) - ArticCount; + articSolveEnd = articSolveStart + ArticCount; + } + } + + } + + if(cache.mThresholdStreamIndex > 0) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(outThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 b = 0; b < cache.mThresholdStreamIndex; ++b) + { + thresholdStream[b + threshIndex] = cache.mThresholdStream[b]; + } + cache.mThresholdStreamIndex = 0; + } + + ++frictionIteration; + } + + return normalIteration * batchCount + frictionIteration * frictionBatchCount; +} + + +void SolverCoreGeneralPF::writeBackV +(const PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxU32 /*constraintListSize*/, PxConstraintBatchHeader* batchHeaders, const PxU32 numBatches, + ThresholdStreamElement* PX_RESTRICT thresholdStream, const PxU32 thresholdStreamLength, PxU32& outThresholdPairs, + PxSolverBodyData* atomListData, WriteBackBlockMethod writeBackTable[]) const +{ + SolverContext cache; + cache.solverBodyArray = atomListData; + cache.mThresholdStream = thresholdStream; + cache.mThresholdStreamLength = thresholdStreamLength; + cache.mThresholdStreamIndex = 0; + + PxI32 outThreshIndex = 0; + for(PxU32 j = 0; j < numBatches; ++j) + { + PxU8 type = *constraintList[batchHeaders[j].startIndex].constraint; + writeBackTable[type](constraintList + batchHeaders[j].startIndex, + batchHeaders[j].stride, cache); + } + + outThresholdPairs = PxU32(outThreshIndex); +} + +} + +} + + +//#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.h new file mode 100644 index 0000000..13a04b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverControlPF.h @@ -0,0 +1,69 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CONTROLPF_H +#define DY_SOLVER_CONTROLPF_H + +#include "DySolverCore.h" +#include "DySolverConstraintDesc.h" + +namespace physx +{ + +namespace Dy +{ + +class SolverCoreGeneralPF : public SolverCore +{ +public: + static SolverCoreGeneralPF* create(); + + // Implements SolverCore + virtual void destroyV(); + + virtual PxI32 solveVParallelAndWriteBack + (SolverIslandParams& params, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) const; + + virtual void solveV_Blocks + (SolverIslandParams& params) const; + + virtual void writeBackV + (const PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxU32 constraintListSize, PxConstraintBatchHeader* contactConstraintBatches, const PxU32 numBatches, + ThresholdStreamElement* PX_RESTRICT thresholdStream, const PxU32 thresholdStreamLength, PxU32& outThresholdPairs, + PxSolverBodyData* atomListData, WriteBackBlockMethod writeBackTable[]) const; + +private: + + //~Implements SolverCore +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverCore.h new file mode 100644 index 0000000..b91ea9f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverCore.h @@ -0,0 +1,249 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_CORE_H +#define DY_SOLVER_CORE_H + +#include "PxvConfig.h" +#include "foundation/PxArray.h" +#include "foundation/PxThread.h" + + +namespace physx +{ + +struct PxSolverBody; +struct PxSolverBodyData; +struct PxSolverConstraintDesc; +struct PxConstraintBatchHeader; + +namespace Dy +{ +struct ThresholdStreamElement; + + +struct ArticulationSolverDesc; +class Articulation; +struct SolverContext; + +typedef void (*WriteBackMethod)(const PxSolverConstraintDesc& desc, SolverContext& cache, PxSolverBodyData& sbd0, PxSolverBodyData& sbd1); +typedef void (*SolveMethod)(const PxSolverConstraintDesc& desc, SolverContext& cache); +typedef void (*SolveBlockMethod)(const PxSolverConstraintDesc* desc, const PxU32 constraintCount, SolverContext& cache); +typedef void (*SolveWriteBackBlockMethod)(const PxSolverConstraintDesc* desc, const PxU32 constraintCount, SolverContext& cache); +typedef void (*WriteBackBlockMethod)(const PxSolverConstraintDesc* desc, const PxU32 constraintCount, SolverContext& cache); + +#define PX_PROFILE_SOLVE_STALLS 0 +#if PX_PROFILE_SOLVE_STALLS +#if PX_WINDOWS +#include + + +PX_FORCE_INLINE PxU64 readTimer() +{ + //return __rdtsc(); + + LARGE_INTEGER i; + QueryPerformanceCounter(&i); + return i.QuadPart; +} + +#endif +#endif + + +#define YIELD_THREADS 1 + +#if YIELD_THREADS + +#define ATTEMPTS_BEFORE_BACKOFF 30000 +#define ATTEMPTS_BEFORE_RETEST 10000 + +#endif + +PX_INLINE void WaitForProgressCount(volatile PxI32* pGlobalIndex, const PxI32 targetIndex) +{ +#if YIELD_THREADS + if(*pGlobalIndex < targetIndex) + { + bool satisfied = false; + PxU32 count = ATTEMPTS_BEFORE_BACKOFF; + do + { + satisfied = true; + while(*pGlobalIndex < targetIndex) + { + if(--count == 0) + { + satisfied = false; + break; + } + } + if(!satisfied) + PxThread::yield(); + count = ATTEMPTS_BEFORE_RETEST; + } + while(!satisfied); + } +#else + while(*pGlobalIndex < targetIndex); +#endif +} + + +#if PX_PROFILE_SOLVE_STALLS +PX_INLINE void WaitForProgressCount(volatile PxI32* pGlobalIndex, const PxI32 targetIndex, PxU64& stallTime) +{ + if(*pGlobalIndex < targetIndex) + { + bool satisfied = false; + PxU32 count = ATTEMPTS_BEFORE_BACKOFF; + do + { + satisfied = true; + PxU64 startTime = readTimer(); + while(*pGlobalIndex < targetIndex) + { + if(--count == 0) + { + satisfied = false; + break; + } + } + PxU64 endTime = readTimer(); + stallTime += (endTime - startTime); + if(!satisfied) + PxThread::yield(); + count = ATTEMPTS_BEFORE_BACKOFF; + } + while(!satisfied); + } +} + +#define WAIT_FOR_PROGRESS(pGlobalIndex, targetIndex) if(*pGlobalIndex < targetIndex) WaitForProgressCount(pGlobalIndex, targetIndex, stallCount) +#else +#define WAIT_FOR_PROGRESS(pGlobalIndex, targetIndex) if(*pGlobalIndex < targetIndex) WaitForProgressCount(pGlobalIndex, targetIndex) +#endif +#define WAIT_FOR_PROGRESS_NO_TIMER(pGlobalIndex, targetIndex) if(*pGlobalIndex < targetIndex) WaitForProgressCount(pGlobalIndex, targetIndex) + + +struct SolverIslandParams +{ + //Default friction model params + PxU32 positionIterations; + PxU32 velocityIterations; + PxSolverBody* PX_RESTRICT bodyListStart; + PxSolverBodyData* PX_RESTRICT bodyDataList; + PxU32 bodyListSize; + PxU32 solverBodyOffset; + ArticulationSolverDesc* PX_RESTRICT articulationListStart; + PxU32 articulationListSize; + PxSolverConstraintDesc* PX_RESTRICT constraintList; + PxConstraintBatchHeader* constraintBatchHeaders; + PxU32 numConstraintHeaders; + PxU32* headersPerPartition; + PxU32 nbPartitions; + Cm::SpatialVector* PX_RESTRICT motionVelocityArray; + PxU32 batchSize; + PxsBodyCore*const* bodyArray; + PxsRigidBody** PX_RESTRICT rigidBodies; + + //Shared state progress counters + PxI32 constraintIndex; + PxI32 constraintIndex2; + PxI32 bodyListIndex; + PxI32 bodyListIndex2; + PxI32 articSolveIndex; + PxI32 articSolveIndex2; + PxI32 bodyIntegrationListIndex; + PxI32 numObjectsIntegrated; + + PxReal dt; + PxReal invDt; + + + //Additional 1d/2d friction model params + PxSolverConstraintDesc* PX_RESTRICT frictionConstraintList; + + PxConstraintBatchHeader* frictionConstraintBatches; + PxU32 numFrictionConstraintHeaders; + PxU32* frictionHeadersPerPartition; + PxU32 nbFrictionPartitions; + + //Additional Shared state progress counters + PxI32 frictionConstraintIndex; + + //Write-back threshold information + ThresholdStreamElement* PX_RESTRICT thresholdStream; + PxU32 thresholdStreamLength; + + PxI32* outThresholdPairs; + + PxU32 mMaxArticulationLinks; + Cm::SpatialVectorF* Z; + Cm::SpatialVectorF* deltaV; +}; + + +/*! +Interface to constraint solver cores + +*/ +class SolverCore +{ +public: + virtual void destroyV() = 0; + virtual ~SolverCore() {} + /* + solves dual problem exactly by GS-iterating until convergence stops + only uses regular velocity vector for storing results, and backs up initial state, which is restored. + the solution forces are saved in a vector. + + state should not be stored, this function is safe to call from multiple threads. + + Returns the total number of constraints that should be solved across all threads. Used for synchronization outside of this method + */ + + virtual PxI32 solveVParallelAndWriteBack + (SolverIslandParams& params, Cm::SpatialVectorF* Z, Cm::SpatialVectorF* deltaV) const = 0; + + + virtual void solveV_Blocks + (SolverIslandParams& params) const = 0; + + + virtual void writeBackV + (const PxSolverConstraintDesc* PX_RESTRICT constraintList, const PxU32 constraintListSize, PxConstraintBatchHeader* contactConstraintBatches, const PxU32 numConstraintBatches, + ThresholdStreamElement* PX_RESTRICT thresholdStream, const PxU32 thresholdStreamLength, PxU32& outThresholdPairs, + PxSolverBodyData* atomListData, WriteBackBlockMethod writeBackTable[]) const = 0; +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverExt.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverExt.h new file mode 100644 index 0000000..dc438c4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverExt.h @@ -0,0 +1,93 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SOLVER_EXT_H +#define DY_SOLVER_EXT_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "CmSpatialVector.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ + +class PxsRigidBody; +struct PxsBodyCore; +struct PxSolverBody; +struct PxSolverBodyData; + + +namespace Dy +{ + + +class FeatherstoneArticulation; +struct SolverConstraint1D; + +class SolverExtBody +{ +public: + union + { + const FeatherstoneArticulation* mArticulation; + const PxSolverBody* mBody; + }; + const PxSolverBodyData* mBodyData; + + PxU32 mLinkIndex; + + SolverExtBody(const void* bodyOrArticulationOrSoftBody, const void* bodyData, PxU32 linkIndex): + mBody(reinterpret_cast(bodyOrArticulationOrSoftBody)), + mBodyData(reinterpret_cast(bodyData)), + mLinkIndex(linkIndex) + {} + + void getResponse(const PxVec3& linImpulse, const PxVec3& angImpulse, + PxVec3& linDeltaV, PxVec3& angDeltaV, PxReal dominance) const; + + void getResponse(const aos::Vec3V& linImpulse, const aos::Vec3V& angImpulse, + aos::Vec3V& linDeltaV, aos::Vec3V& angDeltaV, aos::FloatV dominance) const; + + PxReal projectVelocity(const PxVec3& linear, const PxVec3& angular) const; + aos::FloatV projectVelocity(const aos::Vec3V& linear, const aos::Vec3V& angular) const; + PxVec3 getLinVel() const; + PxVec3 getAngVel() const; + + aos::Vec3V getLinVelV() const; + aos::Vec3V getAngVelV() const; + + Cm::SpatialVectorV getVelocity() const; + PxReal getCFM() const; +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp new file mode 100644 index 0000000..d4aa8a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraints.cpp @@ -0,0 +1,850 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" + +#include "DySolverBody.h" +#include "DySolverContact.h" +#include "DySolverContactPF.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraintDesc.h" +#include "DyThresholdTable.h" +#include "DySolverContext.h" +#include "foundation/PxUtilities.h" +#include "DyConstraint.h" +#include "foundation/PxAtomic.h" +#include "DyThresholdTable.h" +#include "DySolverConstraintsShared.h" +#include "DyFeatherstoneArticulation.h" + +namespace physx +{ +namespace Dy +{ + +void solveContactCoulomb(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + PxSolverBody& b0 = *desc.bodyA; + PxSolverBody& b1 = *desc.bodyB; + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V linVel1 = V3LoadA(b1.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + Vec3V angState1 = V3LoadA(b1.angularState); + + SolverContactCoulombHeader* PX_RESTRICT firstHeader = reinterpret_cast(desc.constraint); + const PxU8* PX_RESTRICT last = desc.constraint + firstHeader->frictionOffset;//getConstraintLength(desc); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc.constraint; + + //const FloatV zero = FZero(); + + while(currPtr < last) + { + SolverContactCoulombHeader* PX_RESTRICT hdr = reinterpret_cast(currPtr); + currPtr += sizeof(SolverContactCoulombHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + const Vec3V normal = hdr->getNormal(); + const FloatV invMassDom0 = FLoad(hdr->dominance0); + const FloatV invMassDom1 = FLoad(hdr->dominance1); + const FloatV angD0 = FLoad(hdr->angDom0); + const FloatV angD1 = FLoad(hdr->angDom1); + + SolverContactPoint* PX_RESTRICT contacts = reinterpret_cast(currPtr); + currPtr += numNormalConstr * sizeof(SolverContactPoint); + + PxF32* appliedImpulse = reinterpret_cast ((reinterpret_cast(hdr)) + hdr->frictionOffset + sizeof(SolverFrictionHeader)); + PxPrefetchLine(appliedImpulse); + + solveDynamicContacts(contacts, numNormalConstr, normal, invMassDom0, invMassDom1, + angD0, angD1, linVel0, angState0, linVel1, angState1, appliedImpulse); + } + + // Write back + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(linVel1, b1.linearVelocity); + V3StoreA(angState0, b0.angularState); + V3StoreA(angState1, b1.angularState); + + PX_ASSERT(currPtr == last); +} + +void solveFriction(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + PxSolverBody& b0 = *desc.bodyA; + PxSolverBody& b1 = *desc.bodyB; + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V linVel1 = V3LoadA(b1.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + Vec3V angState1 = V3LoadA(b1.angularState); + + PxU8* PX_RESTRICT ptr = desc.constraint; + PxU8* PX_RESTRICT currPtr = ptr; + + const PxU8* PX_RESTRICT last = ptr + getConstraintLength(desc); + + while(currPtr < last) + { + const SolverFrictionHeader* PX_RESTRICT frictionHeader = reinterpret_cast(currPtr); + currPtr += sizeof(SolverFrictionHeader); + PxF32* appliedImpulse = reinterpret_cast(currPtr); + currPtr += frictionHeader->getAppliedForcePaddingSize(); + + SolverContactFriction* PX_RESTRICT frictions = reinterpret_cast(currPtr); + const PxU32 numFrictionConstr = frictionHeader->numFrictionConstr; + const PxU32 numNormalConstr = frictionHeader->numNormalConstr; + + const PxU32 numFrictionPerPoint = numFrictionConstr/numNormalConstr; + + currPtr += numFrictionConstr * sizeof(SolverContactFriction); + const FloatV staticFriction = frictionHeader->getStaticFriction(); + + const FloatV invMass0D0 = FLoad(frictionHeader->invMass0D0); + const FloatV invMass1D1 = FLoad(frictionHeader->invMass1D1); + + const FloatV angD0 = FLoad(frictionHeader->angDom0); + const FloatV angD1 = FLoad(frictionHeader->angDom1); + + for(PxU32 i=0, j = 0;i(desc.constraint); + const PxU8* PX_RESTRICT last = desc.constraint + firstHeader->frictionOffset;//getConstraintLength(desc); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc.constraint; + + //const FloatV zero = FZero(); + + while(currPtr < last) + { + SolverContactCoulombHeader* PX_RESTRICT hdr = reinterpret_cast(currPtr); + currPtr += sizeof(SolverContactCoulombHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + SolverContactPoint* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPoint); + + PxF32* appliedImpulse = reinterpret_cast ((reinterpret_cast(hdr)) + hdr->frictionOffset + sizeof(SolverFrictionHeader)); + PxPrefetchLine(appliedImpulse); + + const Vec3V normal = hdr->getNormal(); + + const FloatV invMassDom0 = FLoad(hdr->dominance0); + + const FloatV angD0 = FLoad(hdr->angDom0); + + solveStaticContacts(contacts, numNormalConstr, normal, invMassDom0, + angD0, linVel0, angState0, appliedImpulse); + } + + // Write back + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(angState0, b0.angularState); + + PX_ASSERT(currPtr == last); +} + +void solveFriction_BStatic(const PxSolverConstraintDesc& desc, SolverContext& /*cache*/) +{ + PxSolverBody& b0 = *desc.bodyA; + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularState); + + PxU8* PX_RESTRICT currPtr = desc.constraint; + + const PxU8* PX_RESTRICT last = currPtr + getConstraintLength(desc); + + while(currPtr < last) + { + const SolverFrictionHeader* PX_RESTRICT frictionHeader = reinterpret_cast(currPtr); + const PxU32 numFrictionConstr = frictionHeader->numFrictionConstr; + const PxU32 numNormalConstr = frictionHeader->numNormalConstr; + const PxU32 numFrictionPerPoint = numFrictionConstr/numNormalConstr; + currPtr +=sizeof(SolverFrictionHeader); + PxF32* appliedImpulse = reinterpret_cast(currPtr); + currPtr +=frictionHeader->getAppliedForcePaddingSize(); + + SolverContactFriction* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFriction); + + const FloatV invMass0 = FLoad(frictionHeader->invMass0D0); + const FloatV angD0 = FLoad(frictionHeader->angDom0); + //const FloatV angD1 = FLoad(frictionHeader->angDom1); + + const FloatV staticFriction = frictionHeader->getStaticFriction(); + + for(PxU32 i=0, j = 0;i(cPtr); + PxU8* PX_RESTRICT last = desc.constraint + firstHeader->frictionOffset;//getConstraintLength(desc); + while(cPtr < last) + { + const SolverContactCoulombHeader* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactCoulombHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + //if(cPtr < last) + //PxPrefetchLine(cPtr, 512); + PxPrefetchLine(cPtr,128); + PxPrefetchLine(cPtr,256); + PxPrefetchLine(cPtr,384); + + const PxU32 pointStride = hdr->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactPointExt) + : sizeof(SolverContactPoint); + for(PxU32 i=0;i(cPtr); + cPtr += pointStride; + //c->scaledBias = PxMin(c->scaledBias, 0.f); + c->biasedErr = c->unbiasedErr; + } + } + PX_ASSERT(cPtr == last); +} + +void writeBackContactCoulomb(const PxSolverConstraintDesc& desc, SolverContext& cache, + PxSolverBodyData& bd0, PxSolverBodyData& bd1) +{ + PxReal normalForce = 0.f; + + PxU8* PX_RESTRICT cPtr = desc.constraint; + PxReal* PX_RESTRICT vForceWriteback = reinterpret_cast(desc.writeBack); + const SolverContactCoulombHeader* PX_RESTRICT firstHeader = reinterpret_cast(cPtr); + PxU8* PX_RESTRICT last = desc.constraint + firstHeader->frictionOffset; + + const PxU32 pointStride = firstHeader->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactPointExt) + : sizeof(SolverContactPoint); + + bool hasForceThresholds = false; + while(cPtr < last) + { + const SolverContactCoulombHeader* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactCoulombHeader); + + PxF32* appliedImpulse = reinterpret_cast (const_cast((reinterpret_cast(hdr)) + hdr->frictionOffset + sizeof(SolverFrictionHeader))); + + hasForceThresholds = hdr->flags & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + PxPrefetchLine(cPtr, 256); + PxPrefetchLine(cPtr, 384); + + if(vForceWriteback!=NULL) + { + for(PxU32 i=0; i(bd0.reportThreshold, bd1.reportThreshold); + elt.nodeIndexA = PxNodeIndex(bd0.nodeIndex); + elt.nodeIndexB = PxNodeIndex(bd1.nodeIndex); + elt.shapeInteraction = (reinterpret_cast(desc.constraint))->shapeInteraction; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + + PX_ASSERT(cache.mThresholdStreamIndex (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveContactCoulomb_BStaticBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveContactCoulomb_BStatic(desc[a], cache); + } +} + +void solveContactCoulomb_BStaticConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveContactCoulomb_BStatic(desc[a], cache); + concludeContactCoulomb(desc[a], cache); + } +} + +void solveContactCoulomb_BStaticBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].bodyADataIndex]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].bodyBDataIndex]; + solveContactCoulomb_BStatic(desc[a], cache); + writeBackContactCoulomb(desc[a], cache, bd0, bd1); + } + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Not enough space to write 4 more thresholds back! + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveExtContactCoulomb(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + //We'll need this. +// const FloatV zero = FZero(); +// const FloatV one = FOne(); + + Vec3V linVel0, angVel0, linVel1, angVel1; + + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.bodyA->linearVelocity); + angVel0 = V3LoadA(desc.bodyA->angularState); + } + else + { + //articulation + Cm::SpatialVectorV v = getArticulationA(desc)->pxcFsGetVelocity(desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.bodyB->linearVelocity); + angVel1 = V3LoadA(desc.bodyB->angularState); + } + else if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + //soft body, need to implement + linVel1 = V3Zero(); + angVel1 = V3Zero(); + } + else + { + //articulation + Cm::SpatialVectorV v = getArticulationB(desc)->pxcFsGetVelocity(desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + } + + //const PxU8* PX_RESTRICT last = desc.constraint + desc.constraintLengthOver16*16; + + PxU8* PX_RESTRICT currPtr = desc.constraint; + + const SolverContactCoulombHeader* PX_RESTRICT firstHeader = reinterpret_cast(currPtr); + + const PxU8* PX_RESTRICT last = desc.constraint + firstHeader->frictionOffset; + + //hopefully pointer aliasing doesn't bite. + + Vec3V linImpulse0 = V3Zero(), linImpulse1 = V3Zero(), angImpulse0 = V3Zero(), angImpulse1 = V3Zero(); + + while (currPtr < last) + { + const SolverContactCoulombHeader* PX_RESTRICT hdr = reinterpret_cast(currPtr); + currPtr += sizeof(SolverContactCoulombHeader); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + PxF32* appliedImpulse = reinterpret_cast(const_cast(((reinterpret_cast(hdr)) + hdr->frictionOffset + sizeof(SolverFrictionHeader)))); + PxPrefetchLine(appliedImpulse); + + SolverContactPointExt* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPointExt); + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + const Vec3V normal = hdr->getNormal(); + + solveExtContacts(contacts, numNormalConstr, normal, linVel0, angVel0, linVel1, angVel1, li0, ai0, li1, ai1, appliedImpulse); + + linImpulse0 = V3ScaleAdd(li0, FLoad(hdr->dominance0), linImpulse0); + angImpulse0 = V3ScaleAdd(ai0, FLoad(hdr->angDom0), angImpulse0); + linImpulse1 = V3NegScaleSub(li1, FLoad(hdr->dominance1), linImpulse1); + angImpulse1 = V3NegScaleSub(ai1, FLoad(hdr->angDom1), angImpulse1); + } + + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.bodyA->linearVelocity); + V3StoreA(angVel0, desc.bodyA->angularState); + } + else + { + getArticulationA(desc)->pxcFsApplyImpulse(desc.linkIndexA, linImpulse0, angImpulse0, cache.Z, cache.deltaV); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.bodyB->linearVelocity); + V3StoreA(angVel1, desc.bodyB->angularState); + } + else + { + getArticulationB(desc)->pxcFsApplyImpulse(desc.linkIndexB, linImpulse1, angImpulse1, cache.Z, cache.deltaV); + } + + PX_ASSERT(currPtr == last); +} + +void solveExtFriction(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + Vec3V linVel0, angVel0, linVel1, angVel1; + + if(desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.bodyA->linearVelocity); + angVel0 = V3LoadA(desc.bodyA->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationA(desc)->pxcFsGetVelocity(desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + } + + if(desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.bodyB->linearVelocity); + angVel1 = V3LoadA(desc.bodyB->angularState); + } + else + { + Cm::SpatialVectorV v = getArticulationB(desc)->pxcFsGetVelocity(desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + } + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc.constraint; + + const PxU8* PX_RESTRICT last = currPtr + desc.constraintLengthOver16*16; + + Vec3V linImpulse0 = V3Zero(), linImpulse1 = V3Zero(), angImpulse0 = V3Zero(), angImpulse1 = V3Zero(); + + while(currPtr < last) + { + const SolverFrictionHeader* PX_RESTRICT frictionHeader = reinterpret_cast(currPtr); + currPtr += sizeof(SolverFrictionHeader); + PxF32* appliedImpulse = reinterpret_cast(currPtr); + currPtr += frictionHeader->getAppliedForcePaddingSize(); + + SolverContactFrictionExt* PX_RESTRICT frictions = reinterpret_cast(currPtr); + const PxU32 numFrictionConstr = frictionHeader->numFrictionConstr; + + currPtr += numFrictionConstr * sizeof(SolverContactFrictionExt); + const FloatV staticFriction = frictionHeader->getStaticFriction(); + + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + PxU32 numNormalConstr = frictionHeader->numNormalConstr; + PxU32 nbFrictionsPerPoint = numFrictionConstr/numNormalConstr; + + for(PxU32 i = 0, j = 0; i < numFrictionConstr; j++) + { + for(PxU32 p=0;pinvMass0D0), linImpulse0); + angImpulse0 = V3ScaleAdd(ai0, FLoad(frictionHeader->angDom0), angImpulse0); + linImpulse1 = V3NegScaleSub(li1, FLoad(frictionHeader->invMass1D1), linImpulse1); + angImpulse1 = V3NegScaleSub(ai1, FLoad(frictionHeader->angDom1), angImpulse1); + } + + if(desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.bodyA->linearVelocity); + V3StoreA(angVel0, desc.bodyA->angularState); + } + else + { + getArticulationA(desc)->pxcFsApplyImpulse(desc.linkIndexA, linImpulse0, angImpulse0, cache.Z, cache.deltaV); + } + + if(desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.bodyB->linearVelocity); + V3StoreA(angVel1, desc.bodyB->angularState); + } + else + { + getArticulationB(desc)->pxcFsApplyImpulse(desc.linkIndexB, linImpulse1, angImpulse1, cache.Z, cache.deltaV); + } + + PX_ASSERT(currPtr == last); +} + +void solveExtFrictionBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtFriction(desc[a], cache); + } +} + +void solveExtFrictionConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtFriction(desc[a], cache); + } +} + +void solveExtFrictionBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtFriction(desc[a], cache); + } +} + +void solveConcludeExtContactCoulomb (const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveExtContactCoulomb(desc, cache); + concludeContactCoulomb(desc, cache); +} + +void solveExtContactCoulombBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtContactCoulomb(desc[a], cache); + } +} + +void solveExtContactCoulombConcludeBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + solveExtContactCoulomb(desc[a], cache); + concludeContactCoulomb(desc[a], cache); + } +} + +void solveExtContactCoulombBlockWriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 constraintCount, SolverContext& cache) +{ + for(PxU32 a = 0; a < constraintCount; ++a) + { + //PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].linkIndexA != PxSolverConstraintDesc::NO_LINK ? 0 : desc[a].bodyADataIndex]; + //PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].linkIndexB != PxSolverConstraintDesc::NO_LINK ? 0 : desc[a].bodyBDataIndex]; + + PxSolverBodyData& bd0 = cache.solverBodyArray[desc[a].linkIndexA == PxSolverConstraintDesc::RIGID_BODY ? desc[a].bodyADataIndex : 0]; + PxSolverBodyData& bd1 = cache.solverBodyArray[desc[a].linkIndexB == PxSolverConstraintDesc::RIGID_BODY ? desc[a].bodyBDataIndex : 0]; + + solveExtContactCoulomb(desc[a], cache); + writeBackContactCoulomb(desc[a], cache, bd0, bd1); + } + if(cache.mThresholdStreamIndex > 0) + { + //Not enough space to write 4 more thresholds back! + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveConcludeContactCoulomb(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveContactCoulomb(desc, cache); + concludeContactCoulomb(desc, cache); +} + +void solveConcludeContactCoulomb_BStatic(const PxSolverConstraintDesc& desc, SolverContext& cache) +{ + solveContactCoulomb_BStatic(desc, cache); + concludeContactCoulomb(desc, cache); +} + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp new file mode 100644 index 0000000..97ff38f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySolverPFConstraintsBlock.cpp @@ -0,0 +1,983 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "foundation/PxFPU.h" +#include "DySolverBody.h" +#include "DySolverContactPF4.h" +#include "DySolverConstraint1D.h" +#include "DySolverConstraintDesc.h" +#include "DyThresholdTable.h" +#include "DySolverContext.h" +#include "foundation/PxUtilities.h" +#include "DyConstraint.h" +#include "foundation/PxAtomic.h" +#include "DySolverContact.h" + +namespace physx +{ + +namespace Dy +{ + +static void solveContactCoulomb4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& /*cache*/) +{ + PxSolverBody& b00 = *desc[0].bodyA; + PxSolverBody& b01 = *desc[0].bodyB; + PxSolverBody& b10 = *desc[1].bodyA; + PxSolverBody& b11 = *desc[1].bodyB; + PxSolverBody& b20 = *desc[2].bodyA; + PxSolverBody& b21 = *desc[2].bodyB; + PxSolverBody& b30 = *desc[3].bodyA; + PxSolverBody& b31 = *desc[3].bodyB; + + //We'll need this. + const Vec4V vZero = V4Zero(); + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&b01.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularState.x); + Vec4V angState01 = V4LoadA(&b01.angularState.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&b11.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularState.x); + Vec4V angState11 = V4LoadA(&b11.angularState.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&b21.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularState.x); + Vec4V angState21 = V4LoadA(&b21.angularState.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&b31.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularState.x); + Vec4V angState31 = V4LoadA(&b31.angularState.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V linVel1T0, linVel1T1, linVel1T2, linVel1T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + Vec4V angState1T0, angState1T1, angState1T2, angState1T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2, linVel1T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + PX_TRANSPOSE_44(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2, angState1T3); + + + + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + SolverContactCoulombHeader4* PX_RESTRICT firstHeader = reinterpret_cast(currPtr); + + const PxU8* PX_RESTRICT last = desc[0].constraint + firstHeader->frictionOffset; + + //const PxU8* PX_RESTRICT endPtr = desc[0].constraint + getConstraintLength(desc[0]); + + + //TODO - can I avoid this many tests??? + while(currPtr < last) + { + + SolverContactCoulombHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + Vec4V* appliedForceBuffer = reinterpret_cast(currPtr + hdr->frictionOffset + sizeof(SolverFrictionHeader4)); + + //PX_ASSERT((PxU8*)appliedForceBuffer < endPtr); + + currPtr = reinterpret_cast(hdr + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + SolverContact4Dynamic* PX_RESTRICT contacts = reinterpret_cast(currPtr); + //const Vec4V dominance1 = V4Neg(__dominance1); + + currPtr = reinterpret_cast(contacts + numNormalConstr); + + const Vec4V invMass0D0 = hdr->invMassADom; + const Vec4V invMass1D1 = hdr->invMassBDom; + const Vec4V angD0 = hdr->angD0; + const Vec4V angD1 = hdr->angD1; + + const Vec4V normalT0 = hdr->normalX; + const Vec4V normalT1 = hdr->normalY; + const Vec4V normalT2 = hdr->normalZ; + + const Vec4V normalVel1_tmp2 = V4Mul(linVel0T0, normalT0); + const Vec4V normalVel3_tmp2 = V4Mul(linVel1T0, normalT0); + const Vec4V normalVel1_tmp1 = V4MulAdd(linVel0T1, normalT1, normalVel1_tmp2); + const Vec4V normalVel3_tmp1 = V4MulAdd(linVel1T1, normalT1, normalVel3_tmp2); + + Vec4V normalVel1 = V4MulAdd(linVel0T2, normalT2, normalVel1_tmp1); + Vec4V normalVel3 = V4MulAdd(linVel1T2, normalT2, normalVel3_tmp1); + + Vec4V accumDeltaF = vZero; + + for(PxU32 i=0;i(currPtr); + + const PxU8* PX_RESTRICT last = desc[0].constraint + firstHeader->frictionOffset; + + + //TODO - can I avoid this many tests??? + while(currPtr < last) + { + + SolverContactCoulombHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + Vec4V* appliedForceBuffer = reinterpret_cast(currPtr + hdr->frictionOffset + sizeof(SolverFrictionHeader4)); + + currPtr = reinterpret_cast(hdr + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + SolverContact4Base* PX_RESTRICT contacts = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(contacts + numNormalConstr); + + const Vec4V invMass0D0 = hdr->invMassADom; + const Vec4V angD0 = hdr->angD0; + + const Vec4V normalT0 = hdr->normalX; + const Vec4V normalT1 = hdr->normalY; + const Vec4V normalT2 = hdr->normalZ; + + const Vec4V normalVel1_tmp2 = V4Mul(linVel0T0, normalT0); + const Vec4V normalVel1_tmp1 = V4MulAdd(linVel0T1, normalT1, normalVel1_tmp2); + + Vec4V normalVel1 = V4MulAdd(linVel0T2, normalT2, normalVel1_tmp1); + + Vec4V accumDeltaF = vZero; + + for(PxU32 i=0;i(currPtr); + + currPtr = reinterpret_cast(hdr + 1); + + Vec4V* appliedImpulses = reinterpret_cast(currPtr); + + currPtr += hdr->numNormalConstr * sizeof(Vec4V); + + PxPrefetchLine(currPtr, 128); + PxPrefetchLine(currPtr,256); + PxPrefetchLine(currPtr,384); + + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverFriction4Dynamic* PX_RESTRICT frictions = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(frictions + hdr->numFrictionConstr); + + const PxU32 maxFrictionConstr = numFrictionConstr; + + const Vec4V staticFric = hdr->staticFriction; + + const Vec4V invMass0D0 = hdr->invMassADom; + const Vec4V invMass1D1 = hdr->invMassBDom; + + const Vec4V angD0 = hdr->angD0; + const Vec4V angD1 = hdr->angD1; + + for(PxU32 i=0;i>hdr->frictionPerContact]; + + const Vec4V maxFriction = V4Mul(staticFric, appliedImpulse); + + const Vec4V nMaxFriction = V4Neg(maxFriction); + + const Vec4V normalX = f.normalX; + const Vec4V normalY = f.normalY; + const Vec4V normalZ = f.normalZ; + + const Vec4V raXnX = f.raXnX; + const Vec4V raXnY = f.raXnY; + const Vec4V raXnZ = f.raXnZ; + + const Vec4V rbXnX = f.rbXnX; + const Vec4V rbXnY = f.rbXnY; + const Vec4V rbXnZ = f.rbXnZ; + + const Vec4V appliedForce(f.appliedForce); + const Vec4V velMultiplier(f.velMultiplier); + const Vec4V targetVel(f.targetVelocity); + + //4 x 4 Dot3 products encoded as 8 M44 transposes, 4 MulV and 8 MulAdd ops + + const Vec4V normalVel1_tmp2 = V4Mul(linVel0T0, normalX); + const Vec4V normalVel2_tmp2 = V4Mul(raXnX, angState0T0); + const Vec4V normalVel3_tmp2 = V4Mul(linVel1T0, normalX); + const Vec4V normalVel4_tmp2 = V4Mul(rbXnX, angState1T0); + + const Vec4V normalVel1_tmp1 = V4MulAdd(linVel0T1, normalY, normalVel1_tmp2); + const Vec4V normalVel2_tmp1 = V4MulAdd(raXnY, angState0T1, normalVel2_tmp2); + const Vec4V normalVel3_tmp1 = V4MulAdd(linVel1T1, normalY, normalVel3_tmp2); + const Vec4V normalVel4_tmp1 = V4MulAdd(rbXnY, angState1T1, normalVel4_tmp2); + + const Vec4V normalVel1 = V4MulAdd(linVel0T2, normalZ, normalVel1_tmp1); + const Vec4V normalVel2 = V4MulAdd(raXnZ, angState0T2, normalVel2_tmp1); + const Vec4V normalVel3 = V4MulAdd(linVel1T2, normalZ, normalVel3_tmp1); + const Vec4V normalVel4 = V4MulAdd(rbXnZ, angState1T2, normalVel4_tmp1); + + + const Vec4V normalVel_tmp2 = V4Add(normalVel1, normalVel2); + const Vec4V normalVel_tmp1 = V4Add(normalVel3, normalVel4); + + const Vec4V normalVel = V4Sub(normalVel_tmp2, normalVel_tmp1 ); + + const Vec4V tmp = V4NegMulSub(targetVel, velMultiplier, appliedForce); + Vec4V newAppliedForce = V4MulAdd(normalVel, velMultiplier, tmp); + newAppliedForce = V4Clamp(newAppliedForce,nMaxFriction, maxFriction); + const Vec4V deltaF = V4Sub(newAppliedForce, appliedForce); + + const Vec4V deltaLinF0 = V4Mul(invMass0D0, deltaF); + const Vec4V deltaLinF1 = V4Mul(invMass1D1, deltaF); + + const Vec4V deltaAngF0 = V4Mul(angD0, deltaF); + const Vec4V deltaAngF1 = V4Mul(angD1, deltaF); + + + linVel0T0 = V4MulAdd(normalX, deltaLinF0, linVel0T0); + linVel1T0 = V4NegMulSub(normalX, deltaLinF1, linVel1T0); + angState0T0 = V4MulAdd(raXnX, deltaAngF0, angState0T0); + angState1T0 = V4NegMulSub(rbXnX, deltaAngF1, angState1T0); + + linVel0T1 = V4MulAdd(normalY, deltaLinF0, linVel0T1); + linVel1T1 = V4NegMulSub(normalY, deltaLinF1, linVel1T1); + angState0T1 = V4MulAdd(raXnY, deltaAngF0, angState0T1); + angState1T1 = V4NegMulSub(rbXnY, deltaAngF1, angState1T1); + + linVel0T2 = V4MulAdd(normalZ, deltaLinF0, linVel0T2); + linVel1T2 = V4NegMulSub(normalZ, deltaLinF1, linVel1T2); + angState0T2 = V4MulAdd(raXnZ, deltaAngF0, angState0T2); + angState1T2 = V4NegMulSub(rbXnZ, deltaAngF1, angState1T2); + + f.appliedForce = newAppliedForce; + } + } + + PX_ASSERT(currPtr == endPtr); + + //KS - we need to use PX_TRANSPOSE_44 here instead of the 34_43 variants because the W components are being used to + //store the bodies' progress counters. + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(linVel1T0, linVel1T1, linVel1T2, linVel1T3, linVel01, linVel11, linVel21, linVel31); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + PX_TRANSPOSE_44(angState1T0, angState1T1, angState1T2, angState1T3, angState01, angState11, angState21, angState31); + + + // Write back + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + + V4StoreA(linVel01, &b01.linearVelocity.x); + V4StoreA(linVel11, &b11.linearVelocity.x); + V4StoreA(linVel21, &b21.linearVelocity.x); + V4StoreA(linVel31, &b31.linearVelocity.x); + + V4StoreA(angState00, &b00.angularState.x); + V4StoreA(angState10, &b10.angularState.x); + V4StoreA(angState20, &b20.angularState.x); + V4StoreA(angState30, &b30.angularState.x); + + V4StoreA(angState01, &b01.angularState.x); + V4StoreA(angState11, &b11.angularState.x); + V4StoreA(angState21, &b21.angularState.x); + V4StoreA(angState31, &b31.angularState.x); + +} + + +static void solveFriction4_StaticBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext& /*cache*/) +{ + + PxSolverBody& b00 = *desc[0].bodyA; + PxSolverBody& b10 = *desc[1].bodyA; + PxSolverBody& b20 = *desc[2].bodyA; + PxSolverBody& b30 = *desc[3].bodyA; + + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularState.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularState.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularState.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularState.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + PxU8* PX_RESTRICT endPtr = desc[0].constraint + getConstraintLength(desc[0]); + + + while(currPtr < endPtr) + { + SolverFrictionHeader4* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(hdr + 1); + + Vec4V* appliedImpulses = reinterpret_cast(currPtr); + + currPtr += hdr->numNormalConstr * sizeof(Vec4V); + + PxPrefetchLine(currPtr, 128); + PxPrefetchLine(currPtr,256); + PxPrefetchLine(currPtr,384); + + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverFriction4Base* PX_RESTRICT frictions = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(frictions + hdr->numFrictionConstr); + + const PxU32 maxFrictionConstr = numFrictionConstr; + + const Vec4V staticFric = hdr->staticFriction; + + const Vec4V invMass0D0 = hdr->invMassADom; + const Vec4V angD0 = hdr->angD0; + + for(PxU32 i=0;i>hdr->frictionPerContact]; + + const Vec4V maxFriction = V4Mul(staticFric, appliedImpulse); + + const Vec4V nMaxFriction = V4Neg(maxFriction); + + const Vec4V normalX = f.normalX; + const Vec4V normalY = f.normalY; + const Vec4V normalZ = f.normalZ; + + const Vec4V raXnX = f.raXnX; + const Vec4V raXnY = f.raXnY; + const Vec4V raXnZ = f.raXnZ; + + const Vec4V appliedForce(f.appliedForce); + const Vec4V velMultiplier(f.velMultiplier); + const Vec4V targetVel(f.targetVelocity); + + //4 x 4 Dot3 products encoded as 8 M44 transposes, 4 MulV and 8 MulAdd ops + + const Vec4V normalVel1_tmp2 = V4Mul(linVel0T0, normalX); + const Vec4V normalVel2_tmp2 = V4Mul(raXnX, angState0T0); + + const Vec4V normalVel1_tmp1 = V4MulAdd(linVel0T1, normalY, normalVel1_tmp2); + const Vec4V normalVel2_tmp1 = V4MulAdd(raXnY, angState0T1, normalVel2_tmp2); + + const Vec4V normalVel1 = V4MulAdd(linVel0T2, normalZ, normalVel1_tmp1); + const Vec4V normalVel2 = V4MulAdd(raXnZ, angState0T2, normalVel2_tmp1); + + const Vec4V delLinVel00 = V4Mul(normalX, invMass0D0); + + const Vec4V delLinVel10 = V4Mul(normalY, invMass0D0); + + const Vec4V normalVel = V4Add(normalVel1, normalVel2); + + const Vec4V delLinVel20 = V4Mul(normalZ, invMass0D0); + + const Vec4V tmp = V4NegMulSub(targetVel, velMultiplier, appliedForce); + + Vec4V newAppliedForce = V4MulAdd(normalVel, velMultiplier, tmp); + newAppliedForce = V4Clamp(newAppliedForce,nMaxFriction, maxFriction); + const Vec4V deltaF = V4Sub(newAppliedForce, appliedForce); + + const Vec4V deltaAngF0 = V4Mul(angD0, deltaF); + + linVel0T0 = V4MulAdd(delLinVel00, deltaF, linVel0T0); + angState0T0 = V4MulAdd(raXnX, deltaAngF0, angState0T0); + + linVel0T1 = V4MulAdd(delLinVel10, deltaF, linVel0T1); + angState0T1 = V4MulAdd(raXnY, deltaAngF0, angState0T1); + + linVel0T2 = V4MulAdd(delLinVel20, deltaF, linVel0T2); + angState0T2 = V4MulAdd(raXnZ, deltaAngF0, angState0T2); + + f.appliedForce = newAppliedForce; + } + } + + PX_ASSERT(currPtr == endPtr); + + //KS - we need to use PX_TRANSPOSE_44 here instead of the 34_43 variants because the W components are being used to + //store the bodies' progress counters. + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + + // Write back + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + + V4StoreA(angState00, &b00.angularState.x); + V4StoreA(angState10, &b10.angularState.x); + V4StoreA(angState20, &b20.angularState.x); + V4StoreA(angState30, &b30.angularState.x); +} + +static void concludeContactCoulomb4(const PxSolverConstraintDesc* desc, SolverContext& /*cache*/) +{ + PxU8* PX_RESTRICT cPtr = desc[0].constraint; + + const Vec4V zero = V4Zero(); + + const SolverContactCoulombHeader4* PX_RESTRICT firstHeader = reinterpret_cast(cPtr); + PxU8* PX_RESTRICT last = desc[0].constraint + firstHeader->frictionOffset; + + PxU32 pointStride = firstHeader->type == DY_SC_TYPE_BLOCK_RB_CONTACT ? sizeof(SolverContact4Dynamic) : sizeof(SolverContact4Base); + + while(cPtr < last) + { + const SolverContactCoulombHeader4* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactCoulombHeader4); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + //if(cPtr < last) + //PxPrefetchLine(cPtr, 512); + PxPrefetchLine(cPtr,128); + PxPrefetchLine(cPtr,256); + PxPrefetchLine(cPtr,384); + + for(PxU32 i=0;i(cPtr); + cPtr += pointStride; + c->scaledBias = V4Max(c->scaledBias, zero); + } + } + PX_ASSERT(cPtr == last); +} + +void writeBackContactCoulomb4(const PxSolverConstraintDesc* desc, SolverContext& cache, + const PxSolverBodyData** PX_RESTRICT bd0, const PxSolverBodyData** PX_RESTRICT bd1) +{ + Vec4V normalForceV = V4Zero(); + PxU8* PX_RESTRICT cPtr = desc[0].constraint; + PxReal* PX_RESTRICT vForceWriteback0 = reinterpret_cast(desc[0].writeBack); + PxReal* PX_RESTRICT vForceWriteback1 = reinterpret_cast(desc[1].writeBack); + PxReal* PX_RESTRICT vForceWriteback2 = reinterpret_cast(desc[2].writeBack); + PxReal* PX_RESTRICT vForceWriteback3 = reinterpret_cast(desc[3].writeBack); + + const SolverContactCoulombHeader4* PX_RESTRICT firstHeader = reinterpret_cast(cPtr); + PxU8* PX_RESTRICT last = desc[0].constraint + firstHeader->frictionOffset; + + const PxU32 pointStride = firstHeader->type == DY_SC_TYPE_BLOCK_RB_CONTACT ? sizeof(SolverContact4Dynamic) + : sizeof(SolverContact4Base); + + bool writeBackThresholds[4] = {false, false, false, false}; + + + while(cPtr < last) + { + const SolverContactCoulombHeader4* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactCoulombHeader4); + + writeBackThresholds[0] = hdr->flags[0] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[1] = hdr->flags[1] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[2] = hdr->flags[2] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[3] = hdr->flags[3] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + + const PxU32 numNormalConstr = hdr->numNormalConstr; + + PxPrefetchLine(cPtr, 256); + PxPrefetchLine(cPtr, 384); + + + for(PxU32 i=0; i(cPtr); + cPtr += pointStride; + + const Vec4V appliedForce = c->appliedForce; + if(vForceWriteback0 && i < hdr->numNormalConstr0) + FStore(V4GetX(appliedForce), vForceWriteback0++); + if(vForceWriteback1 && i < hdr->numNormalConstr1) + FStore(V4GetY(appliedForce), vForceWriteback1++); + if(vForceWriteback2 && i < hdr->numNormalConstr2) + FStore(V4GetZ(appliedForce), vForceWriteback2++); + if(vForceWriteback3 && i < hdr->numNormalConstr3) + FStore(V4GetW(appliedForce), vForceWriteback3++); + + normalForceV = V4Add(normalForceV, appliedForce); + } + } + PX_ASSERT(cPtr == last); + + PX_ALIGN(16, PxReal nf[4]); + V4StoreA(normalForceV, nf); + + //all constraint pointer in descs are the same constraint + Sc::ShapeInteraction** shapeInteractions = reinterpret_cast(desc[0].constraint)->shapeInteraction; + + for(PxU32 a = 0; a < 4; ++a) + { + if(writeBackThresholds[a] && desc[a].linkIndexA == PxSolverConstraintDesc::RIGID_BODY && desc[a].linkIndexB == PxSolverConstraintDesc::RIGID_BODY && + nf[a] !=0.f && (bd0[a]->reportThreshold < PX_MAX_REAL || bd1[a]->reportThreshold < PX_MAX_REAL)) + { + ThresholdStreamElement elt; + elt.normalForce = nf[a]; + elt.threshold = PxMin(bd0[a]->reportThreshold, bd1[a]->reportThreshold); + elt.nodeIndexA = PxNodeIndex(bd0[a]->nodeIndex); + elt.nodeIndexB = PxNodeIndex(bd1[a]->nodeIndex); + elt.shapeInteraction = shapeInteractions[a]; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + PX_ASSERT(cache.mThresholdStreamIndex (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveContactCoulombPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveContactCoulomb4_StaticBlock(desc, cache); + const PxSolverBodyData* bd0[4] = { &cache.solverBodyArray[desc[0].bodyADataIndex], + &cache.solverBodyArray[desc[1].bodyADataIndex], + &cache.solverBodyArray[desc[2].bodyADataIndex], + &cache.solverBodyArray[desc[3].bodyADataIndex]}; + + const PxSolverBodyData* bd1[4] = { &cache.solverBodyArray[desc[0].bodyBDataIndex], + &cache.solverBodyArray[desc[1].bodyBDataIndex], + &cache.solverBodyArray[desc[2].bodyBDataIndex], + &cache.solverBodyArray[desc[3].bodyBDataIndex]}; + + writeBackContactCoulomb4(desc, cache, bd0, bd1); + + if(cache.mThresholdStreamIndex > (cache.mThresholdStreamLength - 4)) + { + //Write back to global buffer + PxI32 threshIndex = physx::PxAtomicAdd(cache.mSharedOutThresholdPairs, PxI32(cache.mThresholdStreamIndex)) - PxI32(cache.mThresholdStreamIndex); + for(PxU32 a = 0; a < cache.mThresholdStreamIndex; ++a) + { + cache.mSharedThresholdStream[a + threshIndex] = cache.mThresholdStream[a]; + } + cache.mThresholdStreamIndex = 0; + } +} + +void solveFrictionCoulombPreBlock(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_Block(desc, cache); +} + +void solveFrictionCoulombPreBlock_Static(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_StaticBlock(desc, cache); +} + +void solveFrictionCoulombPreBlock_Conclude(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_Block(desc, cache); +} + +void solveFrictionCoulombPreBlock_ConcludeStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_StaticBlock(desc, cache); +} + +void solveFrictionCoulombPreBlock_WriteBack(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_Block(desc, cache); +} + +void solveFrictionCoulombPreBlock_WriteBackStatic(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxU32 /*constraintCount*/, SolverContext& cache) +{ + solveFriction4_StaticBlock(desc, cache); +} + + +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySpatial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySpatial.h new file mode 100644 index 0000000..ce628e7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DySpatial.h @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_SPATIAL_H +#define DY_SPATIAL_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "CmSpatialVector.h" + +namespace physx +{ +namespace Dy +{ +// translate a motion resolved at position p to the origin + + +// should have a 'from' frame and a 'to' frame +class SpInertia +{ +public: + SpInertia() {} + + SpInertia(const PxMat33& ll, const PxMat33& la, const PxMat33& aa): mLL(ll), mLA(la), mAA(aa) + { + } + + static SpInertia getZero() + { + return SpInertia(PxMat33(PxZero), PxMat33(PxZero), + PxMat33(PxZero)); + } + + static SpInertia dyad(const Cm::SpatialVector& column, const Cm::SpatialVector& row) + { + return SpInertia(dyad(column.linear, row.linear), + dyad(column.linear, row.angular), + dyad(column.angular, row.angular)); + } + + + static SpInertia inertia(PxReal mass, const PxVec3& inertia) + { + return SpInertia(PxMat33::createDiagonal(PxVec3(mass,mass,mass)), PxMat33(PxZero), + PxMat33::createDiagonal(inertia)); + } + + + SpInertia operator+(const SpInertia& m) const + { + return SpInertia(mLL+m.mLL, mLA+m.mLA, mAA+m.mAA); + } + + SpInertia operator-(const SpInertia& m) const + { + return SpInertia(mLL-m.mLL, mLA-m.mLA, mAA-m.mAA); + } + + SpInertia operator*(PxReal r) const + { + return SpInertia(mLL*r, mLA*r, mAA*r); + } + + void operator+=(const SpInertia& m) + { + mLL+=m.mLL; + mLA+=m.mLA; + mAA+=m.mAA; + } + + void operator-=(const SpInertia& m) + { + mLL-=m.mLL; + mLA-=m.mLA; + mAA-=m.mAA; + } + + + PX_FORCE_INLINE Cm::SpatialVector operator *(const Cm::SpatialVector& v) const + { + return Cm::SpatialVector(mLL*v.linear +mLA*v.angular, + mLA.transformTranspose(v.linear)+mAA*v.angular); + } + + SpInertia operator *(const SpInertia& v) const + { + return SpInertia(mLL*v.mLL + mLA * v.mLA.getTranspose(), + mLL*v.mLA + mLA * v.mAA, + mLA.getTranspose()*v.mLA + mAA * v.mAA); + } + + + bool isFinite() const + { + return true; +// return mLL.isFinite() && mLA.isFinite() && mAA.isFinite(); + } + + PxMat33 mLL, mLA; // linear force from angular motion, linear force from linear motion + PxMat33 mAA; // angular force from angular motion, mAL = mLA.transpose() + +private: + static PxMat33 dyad(PxVec3 col, PxVec3 row) + { + return PxMat33(col*row.x, col*row.y, col*row.z); + } + + +}; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp new file mode 100644 index 0000000..67d4dc4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.cpp @@ -0,0 +1,3460 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "PxcNpWorkUnit.h" +#include "DyThreadContext.h" +#include "PxcNpContactPrepShared.h" +#include "DyFeatherstoneArticulation.h" + +using namespace physx; +using namespace Gu; + +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" +#include "DyConstraintPrep.h" + +#include "DySolverContext.h" +#include "DySolverConstraint1DStep.h" + +using namespace aos; + +namespace physx +{ +namespace Dy +{ + PX_FORCE_INLINE PxReal safeRecip(const PxReal x) + { + return x > PX_EPS_F32 ? 1.f/x : 0.f; + } + + PX_FORCE_INLINE void computeBlockStreamByteSizesStep(const bool useExtContacts, const CorrelationBuffer& c, + PxU32& _solverConstraintByteSize, PxU32& _frictionPatchByteSize, PxU32& _numFrictionPatches, + PxU32& _axisConstraintCount, PxReal torsionalPatchRadius) + { + PX_ASSERT(0 == _solverConstraintByteSize); + PX_ASSERT(0 == _frictionPatchByteSize); + PX_ASSERT(0 == _numFrictionPatches); + PX_ASSERT(0 == _axisConstraintCount); + + // PT: use local vars to remove LHS + PxU32 solverConstraintByteSize = 0; + PxU32 numFrictionPatches = 0; + PxU32 axisConstraintCount = 0; + + + for (PxU32 i = 0; i < c.frictionPatchCount; i++) + { + //Friction patches. + if (c.correlationListHeads[i] != CorrelationBuffer::LIST_END) + numFrictionPatches++; + + const FrictionPatch& frictionPatch = c.frictionPatches[i]; + + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0; + + //Solver constraint data. + if (c.frictionPatchContactCounts[i] != 0) + { + solverConstraintByteSize += sizeof(SolverContactHeaderStep); + solverConstraintByteSize += useExtContacts ? c.frictionPatchContactCounts[i] * sizeof(SolverContactPointStepExt) + : c.frictionPatchContactCounts[i] * sizeof(SolverContactPointStep); + solverConstraintByteSize += sizeof(PxF32) * ((c.frictionPatchContactCounts[i] + 3)&(~3)); //Add on space for applied impulses + + axisConstraintCount += c.frictionPatchContactCounts[i]; + + if (haveFriction) + { + PxU32 nbAnchors = PxU32(c.frictionPatches[i].anchorCount * 2); + if (torsionalPatchRadius > 0.f && c.frictionPatches[i].anchorCount == 1) + nbAnchors++; + solverConstraintByteSize += useExtContacts ? nbAnchors * sizeof(SolverContactFrictionStepExt) + : nbAnchors * sizeof(SolverContactFrictionStep); + axisConstraintCount += nbAnchors; + + } + } + } + PxU32 frictionPatchByteSize = numFrictionPatches*sizeof(FrictionPatch); + + _numFrictionPatches = numFrictionPatches; + _axisConstraintCount = axisConstraintCount; + + //16-byte alignment. + _frictionPatchByteSize = ((frictionPatchByteSize + 0x0f) & ~0x0f); + _solverConstraintByteSize = ((solverConstraintByteSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); + PX_ASSERT(0 == (_frictionPatchByteSize & 0x0f)); + } + + static bool reserveBlockStreams(const bool useExtContacts, Dy::CorrelationBuffer& cBuffer, + PxU8*& solverConstraint, + FrictionPatch*& _frictionPatches, + PxU32& numFrictionPatches, PxU32& solverConstraintByteSize, + PxU32& axisConstraintCount, PxConstraintAllocator& constraintAllocator, + PxReal torsionalPatchRadius) + { + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(NULL == _frictionPatches); + PX_ASSERT(0 == numFrictionPatches); + PX_ASSERT(0 == solverConstraintByteSize); + PX_ASSERT(0 == axisConstraintCount); + + //From frictionPatchStream we just need to reserve a single buffer. + PxU32 frictionPatchByteSize = 0; + //Compute the sizes of all the buffers. + computeBlockStreamByteSizesStep( + useExtContacts, cBuffer, + solverConstraintByteSize, frictionPatchByteSize, numFrictionPatches, + axisConstraintCount, torsionalPatchRadius); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if (constraintBlockByteSize > 0) + { + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if (0 == constraintBlock || (reinterpret_cast(-1)) == constraintBlock) + { + if (0 == constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock = NULL; + } + } + PX_ASSERT((size_t(constraintBlock) & 0xF) == 0); + } + + FrictionPatch* frictionPatches = NULL; + //If the constraint block reservation didn't fail then reserve the friction buffer too. + if (frictionPatchByteSize > 0 && (0 == constraintBlockByteSize || constraintBlock)) + { + frictionPatches = reinterpret_cast(constraintAllocator.reserveFrictionData(frictionPatchByteSize)); + + if (0 == frictionPatches || (reinterpret_cast(-1)) == frictionPatches) + { + if (0 == frictionPatches) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of friction data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + frictionPatches = NULL; + } + } + } + + _frictionPatches = frictionPatches; + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if (0 == constraintBlockByteSize || constraintBlock) + { + if (solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0 == (uintptr_t(solverConstraint) & 0x0f)); + } + } + + //Return true if neither of the two block reservations failed. + return ((0 == constraintBlockByteSize || constraintBlock) && (0 == frictionPatchByteSize || frictionPatches)); + } + + class SolverExtBodyStep + { + public: + union + { + const FeatherstoneArticulation* mArticulation; + const PxTGSSolverBodyVel* mBody; + }; + + const PxTGSSolverBodyTxInertia* mTxI; + const PxTGSSolverBodyData* mData; + + PxU32 mLinkIndex; + + SolverExtBodyStep(const void* bodyOrArticulation, const PxTGSSolverBodyTxInertia* txI, + const PxTGSSolverBodyData* data, PxU32 linkIndex) : + mBody(reinterpret_cast(bodyOrArticulation)), + mTxI(txI), + mData(data), + mLinkIndex(linkIndex) + {} + + PxReal projectVelocity(const PxVec3& linear, const PxVec3& angular) const; + PxVec3 getLinVel() const; + PxVec3 getAngVel() const; + + Cm::SpatialVectorV getVelocity() const; + bool isKinematic() const + { + return (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) && mBody->isKinematic; + } + + PxReal getCFM() const + { + return (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) ? 0.f : + mArticulation->getCfm(mLinkIndex); + } + }; + + Cm::SpatialVector createImpulseResponseVector(const PxVec3& linear, const PxVec3& angular, const SolverExtBodyStep& body) + { + if (body.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return Cm::SpatialVector(linear, body.mTxI->sqrtInvInertia * angular); + + return Cm::SpatialVector(linear, angular); + } + + Cm::SpatialVectorV createImpulseResponseVector(const aos::Vec3V& linear, const aos::Vec3V& angular, const SolverExtBodyStep& body) + { + if (body.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + return Cm::SpatialVectorV(linear, M33MulV3(M33Load(body.mTxI->sqrtInvInertia), angular)); + } + return Cm::SpatialVectorV(linear, angular); + } + + PxReal getImpulseResponse(const SolverExtBodyStep& b0, const Cm::SpatialVector& impulse0, Cm::SpatialVector& deltaV0, PxReal dom0, PxReal angDom0, + const SolverExtBodyStep& b1, const Cm::SpatialVector& impulse1, Cm::SpatialVector& deltaV1, PxReal dom1, PxReal angDom1, + bool allowSelfCollision) + { + PxReal response; + if (allowSelfCollision && b0.mArticulation == b1.mArticulation) + { + Cm::SpatialVectorF Z[64]; + b0.mArticulation->getImpulseSelfResponse(b0.mLinkIndex, b1.mLinkIndex, Z, + impulse0.scale(dom0, angDom0), impulse1.scale(dom1, angDom1), deltaV0, deltaV1); + + response = impulse0.dot(deltaV0) + impulse1.dot(deltaV1); + } + else + { + if (b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV0.linear = impulse0.linear * b0.mData->invMass * dom0; + deltaV0.angular =/* b0.mBody->sqrtInvInertia * */impulse0.angular * angDom0; + } + else + { + //ArticulationHelper::getImpulseResponse(*b0.mFsData, b0.mLinkIndex, impulse0.scale(dom0, angDom0), deltaV0); + const FeatherstoneArticulation* articulation = b0.mArticulation; + Cm::SpatialVectorF Z[64]; + articulation->getImpulseResponse(b0.mLinkIndex, Z, impulse0.scale(dom0, angDom0), deltaV0); + } + + response = impulse0.dot(deltaV0); + if (b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV1.linear = impulse1.linear * b1.mData->invMass * dom1; + deltaV1.angular = /*b1.mBody->sqrtInvInertia * */impulse1.angular * angDom1; + } + else + { + const FeatherstoneArticulation* articulation = b1.mArticulation; + Cm::SpatialVectorF Z[64]; + articulation->getImpulseResponse(b1.mLinkIndex, Z, impulse1.scale(dom1, angDom1), deltaV1); + //ArticulationHelper::getImpulseResponse(*b1.mFsData, b1.mLinkIndex, impulse1.scale(dom1, angDom1), deltaV1); + + } + response += impulse1.dot(deltaV1); + } + + return response; + } + + FloatV getImpulseResponse(const SolverExtBodyStep& b0, const Cm::SpatialVectorV& impulse0, Cm::SpatialVectorV& deltaV0, const FloatV& dom0, const FloatV& angDom0, + const SolverExtBodyStep& b1, const Cm::SpatialVectorV& impulse1, Cm::SpatialVectorV& deltaV1, const FloatV& dom1, const FloatV& angDom1, + bool /*allowSelfCollision*/) + { + Vec3V response; + { + + if (b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV0.linear = V3Scale(impulse0.linear, FMul(FLoad(b0.mData->invMass), dom0)); + deltaV0.angular = V3Scale(impulse0.angular, angDom0); + } + else + { + b0.mArticulation->getImpulseResponse(b0.mLinkIndex, NULL, impulse0.scale(dom0, angDom0), deltaV0); + } + + response = V3Add(V3Mul(impulse0.linear, deltaV0.linear), V3Mul(impulse0.angular, deltaV0.angular)); + if (b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + { + deltaV1.linear = V3Scale(impulse1.linear, FMul(FLoad(b1.mData->invMass), dom1)); + deltaV1.angular = V3Scale(impulse1.angular, angDom1); + } + else + { + b1.mArticulation->getImpulseResponse(b1.mLinkIndex, NULL, impulse1.scale(dom1, angDom1), deltaV1); + } + response = V3Add(response, V3Add(V3Mul(impulse1.linear, deltaV1.linear), V3Mul(impulse1.angular, deltaV1.angular))); + } + + return V3SumElems(response); + } + + + + PxReal SolverExtBodyStep::projectVelocity(const PxVec3& linear, const PxVec3& angular) const + { + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return mData->projectVelocity(linear, angular); + else + { + Cm::SpatialVectorV velocities = mArticulation->getLinkVelocity(mLinkIndex); + FloatV fv = velocities.dot(Cm::SpatialVector(linear, angular)); + PxF32 f; + FStore(fv, &f); + /*PxF32 f; + FStore(getVelocity(*mFsData)[mLinkIndex].dot(Cm::SpatialVector(linear, angular)), &f); + return f;*/ + return f; + } + } + + + + static FloatV constructContactConstraintStep(const Mat33V& sqrtInvInertia0, const Mat33V& sqrtInvInertia1, const FloatVArg invMassNorLenSq0, + const FloatVArg invMassNorLenSq1, const FloatVArg angD0, const FloatVArg angD1, const Vec3VArg bodyFrame0p, const Vec3VArg bodyFrame1p, + const QuatV& /*bodyFrame0q*/, const QuatV& /*bodyFrame1q*/, + const Vec3VArg normal, const FloatVArg norVel0, const FloatVArg norVel1, const VecCrossV& norCross, const Vec3VArg angVel0, const Vec3VArg angVel1, + const FloatVArg invDtp8, const FloatVArg invStepDt, const FloatVArg totalDt, const FloatVArg invTotalDt, + const FloatVArg restDistance, const FloatVArg restitution, + const FloatVArg bounceThreshold, const PxContactPoint& contact, SolverContactPointStep& solverContact, + const FloatVArg /*ccdMaxSeparation*/, const bool isKinematic0, const bool isKinematic1, + const Vec3VArg solverOffsetSlop, const FloatVArg dt, const FloatVArg damping) + { + const FloatV zero = FZero(); + const Vec3V point = V3LoadA(contact.point); + const FloatV separation = FLoad(contact.separation); + + const FloatV cTargetVel = V3Dot(normal, V3LoadA(contact.targetVel)); + + const Vec3V ra = V3Sub(point, bodyFrame0p); + const Vec3V rb = V3Sub(point, bodyFrame1p); + + Vec3V raXn = V3Cross(ra, norCross); + Vec3V rbXn = V3Cross(rb, norCross); + + const FloatV angV0 = V3Dot(raXn, angVel0); + const FloatV angV1 = V3Dot(rbXn, angVel1); + + const FloatV vRelAng = FSub(angV0, angV1); + const FloatV vRelLin = FSub(norVel0, norVel1); + + const Vec3V slop = V3Scale(solverOffsetSlop, FMax(FSel(FIsEq(vRelLin,zero), FMax(), FDiv(vRelAng, vRelLin)), FOne())); + + const FloatV vrel1 = FAdd(norVel0, angV0); + const FloatV vrel2 = FAdd(norVel1, angV1); + + const FloatV vrel = FSub(vrel1, vrel2); + + raXn = V3Sel(V3IsGrtr(slop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(slop, V3Abs(rbXn)), V3Zero(), rbXn); + + const Vec3V raXnInertia = M33MulV3(sqrtInvInertia0, raXn); + const Vec3V rbXnInertia = M33MulV3(sqrtInvInertia1, rbXn); + + const FloatV i0 = FMul(V3Dot(raXnInertia, raXnInertia), angD0); + const FloatV i1 = FMul(V3Dot(rbXnInertia, rbXnInertia), angD1); + + const FloatV resp0 = FAdd(invMassNorLenSq0, i0); + const FloatV resp1 = FSub(i1, invMassNorLenSq1); + + const FloatV unitResponse = FAdd(resp0, resp1); + + + const FloatV penetration = FSub(separation, restDistance); + + const BoolV isSeparated = FIsGrtr(penetration, zero); + + const FloatV penetrationInvDt = FMul(penetration, invTotalDt); + + const BoolV isGreater2 = BAnd(BAnd(FIsGrtr(restitution, zero), FIsGrtr(bounceThreshold, vrel)), FIsGrtr(FNeg(vrel), penetrationInvDt)); + + + //The following line was replaced by an equivalent to avoid triggering an assert when FAdd sums totalDt to infinity which happens if vrel==0 + //const FloatV ratio = FSel(isGreater2, FAdd(totalDt, FDiv(penetration, vrel)), zero); + const FloatV ratio = FAdd(totalDt, FSel(isGreater2, FDiv(penetration, vrel), FNeg(totalDt))); + + FloatV scaledBias; + FloatV velMultiplier; + + FloatV recipResponse = FSel(FIsGrtr(unitResponse, FZero()), FRecip(unitResponse), FZero()); + + if (FAllGrtr(zero, restitution)) + { + //-ve restitution, so we treat it as a -spring coefficient. + const FloatV nrdt = FMul(dt, restitution); + + const FloatV a = FMul(dt, FSub(damping, nrdt)); + + const FloatV x = FRecip(FScaleAdd(a, unitResponse, FOne())); + + velMultiplier = FMul(x, a); + //scaledBias = FSel(isSeparated, FNeg(invStepDt), FDiv(FMul(nrdt, FMul(x, unitResponse)), velMultiplier)); + scaledBias = FMul(nrdt, FMul(x, unitResponse)); + + } + else + { + scaledBias = FNeg(FSel(isSeparated, invStepDt, invDtp8)); + velMultiplier = recipResponse; + } + + FloatV totalError = penetration; + + const FloatV sumVRel(vrel); + + FloatV targetVelocity = FAdd(cTargetVel, FSel(isGreater2, FMul(FNeg(sumVRel), restitution), zero)); + + totalError = FScaleAdd(targetVelocity, ratio, totalError); + + if(isKinematic0) + targetVelocity = FSub(targetVelocity, vrel1); + if(isKinematic1) + targetVelocity = FAdd(targetVelocity, vrel2); + + //KS - don't store scaled by angD0/angD1 here! It'll corrupt the velocity projection... + V3StoreA(raXnInertia, solverContact.raXnI); + V3StoreA(rbXnInertia, solverContact.rbXnI); + + FStore(velMultiplier, &solverContact.velMultiplier); + + FStore(totalError, &solverContact.separation); + FStore(scaledBias, &solverContact.biasCoefficient); + FStore(targetVelocity, &solverContact.targetVelocity); + FStore(recipResponse, &solverContact.recipResponse); + + solverContact.maxImpulse = contact.maxImpulse; + + return penetration; + + } + + + static void setupFinalizeSolverConstraints(Sc::ShapeInteraction* shapeInteraction, + const PxContactPoint* buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const PxTGSSolverBodyVel& b0, + const PxTGSSolverBodyVel& b1, + const PxTGSSolverBodyTxInertia& txI0, + const PxTGSSolverBodyTxInertia& txI1, + const PxTGSSolverBodyData& data0, + const PxTGSSolverBodyData& data1, + const PxReal invDtF32, + const PxReal totalDtF32, + const PxReal invTotalDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + bool hasForceThreshold, bool staticOrKinematicBody, + const PxReal restDist, PxU8* frictionDataPtr, + const PxReal maxCCDSeparation, + const bool disableStrongFriction, + const PxReal torsionalPatchRadiusF32, + const PxReal minTorsionalPatchRadiusF32, + const PxReal biasCoefficient, + const PxReal solverOffsetSlop) + { + bool hasTorsionalFriction = torsionalPatchRadiusF32 > 0.f || minTorsionalPatchRadiusF32 > 0.f; + + // NOTE II: the friction patches are sparse (some of them have no contact patches, and + // therefore did not get written back to the cache) but the patch addresses are dense, + // corresponding to valid patches + + const bool isKinematic0 = b0.isKinematic; + const bool isKinematic1 = b1.isKinematic; + + const FloatV ccdMaxSeparation = FLoad(maxCCDSeparation); + + PxU8 flags = PxU8(hasForceThreshold ? SolverContactHeaderStep::eHAS_FORCE_THRESHOLDS : 0); + + PxU8* PX_RESTRICT ptr = workspace; + + PxU8 type = PxTo8(staticOrKinematicBody ? DY_SC_TYPE_STATIC_CONTACT + : DY_SC_TYPE_RB_CONTACT); + + const FloatV zero = FZero(); + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + const Vec3V offsetSlop = V3Load(solverOffsetSlop); + + const FloatV nDom1fV = FNeg(d1); + + const FloatV invMass0 = FLoad(data0.invMass); + const FloatV invMass1 = FLoad(data1.invMass); + + const FloatV invMass0_dom0fV = FMul(d0, invMass0); + const FloatV invMass1_dom1fV = FMul(nDom1fV, invMass1); + + Vec4V staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4Zero(); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetZ(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, invMass0_dom0fV); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetW(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, invMass1_dom1fV); + + const FloatV restDistance = FLoad(restDist); + + const PxReal maxPenBias = PxMax(data0.penBiasClamp, data1.penBiasClamp); + + const QuatV bodyFrame0q = QuatVLoadU(&bodyFrame0.q.x); + const Vec3V bodyFrame0p = V3LoadU(bodyFrame0.p); + + const QuatV bodyFrame1q = QuatVLoadU(&bodyFrame1.q.x); + const Vec3V bodyFrame1p = V3LoadU(bodyFrame1.p); + + + + PxU32 frictionPatchWritebackAddrIndex = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + //const Vec3V linVel0 = V3LoadU_SafeReadW(b0.linearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + //const Vec3V linVel1 = V3LoadU_SafeReadW(b1.linearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + //const Vec3V angVel0 = V3LoadU_SafeReadW(b0.angularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + //const Vec3V angVel1 = V3LoadU_SafeReadW(b1.angularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + + + const Vec3V linVel0 = V3LoadU_SafeReadW(data0.originalLinearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + const Vec3V linVel1 = V3LoadU_SafeReadW(data1.originalLinearVelocity); // PT: safe because 'invMass' follows 'initialLinVel' in PxSolverBodyData + const Vec3V angVel0 = V3LoadU_SafeReadW(data0.originalAngularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + const Vec3V angVel1 = V3LoadU_SafeReadW(data1.originalAngularVelocity); // PT: safe because 'reportThreshold' follows 'initialAngVel' in PxSolverBodyData + + + PX_ALIGN(16, const Mat33V sqrtInvInertia0) + ( + V3LoadU_SafeReadW(txI0.sqrtInvInertia.column0), // PT: safe because 'column1' follows 'column0' in PxMat33 + V3LoadU_SafeReadW(txI0.sqrtInvInertia.column1), // PT: safe because 'column2' follows 'column1' in PxMat33 + V3LoadU(txI0.sqrtInvInertia.column2) + ); + + PX_ALIGN(16, const Mat33V sqrtInvInertia1) + ( + V3LoadU_SafeReadW(txI1.sqrtInvInertia.column0), // PT: safe because 'column1' follows 'column0' in PxMat33 + V3LoadU_SafeReadW(txI1.sqrtInvInertia.column1), // PT: safe because 'column2' follows 'column1' in PxMat33 + V3LoadU(txI1.sqrtInvInertia.column2) + ); + + const FloatV invDt = FLoad(invDtF32); + const FloatV dt = FLoad(dtF32); + + const FloatV totalDt = FLoad(totalDtF32); + const FloatV invTotalDt = FLoad(invTotalDtF32); + + const PxReal scale = PxMin(0.8f, biasCoefficient); + + const FloatV p8 = FLoad(scale); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + + const FloatV invDtp8 = FMul(invDt, p8); + + const PxReal frictionBiasScale = disableStrongFriction ? 0.f : invDtF32 * scale; + + + for (PxU32 i = 0; irestitution; + const PxReal combinedDamping = contactBase0->damping; + + SolverContactHeaderStep* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactHeaderStep); + + + PxPrefetchLine(ptr, 128); + PxPrefetchLine(ptr, 256); + + header->shapeInteraction = shapeInteraction; + header->flags = flags; + header->minNormalForce = 0.f; + FStore(invMass0_dom0fV, &header->invMass0); + FStore(FNeg(invMass1_dom1fV), &header->invMass1); + const FloatV restitution = FLoad(combinedRestitution); + const FloatV damping = FLoad(combinedDamping); + + PxU32 pointStride = sizeof(SolverContactPointStep); + PxU32 frictionStride = sizeof(SolverContactFrictionStep); + + const Vec3V normal = V3LoadA(buffer[c.contactPatches[c.correlationListHeads[i]].start].normal); + const FloatV normalLenSq = V3LengthSq(normal); + const VecCrossV norCross = V3PrepareCross(normal); + //const FloatV norVel = V3SumElems(V3NegMulSub(normal, linVel1, V3Mul(normal, linVel0))); + const FloatV norVel0 = V3Dot(linVel0, normal); + const FloatV norVel1 = V3Dot(linVel1, normal); + + const FloatV invMassNorLenSq0 = FMul(invMass0_dom0fV, normalLenSq); + const FloatV invMassNorLenSq1 = FMul(invMass1_dom1fV, normalLenSq); + + V3StoreA(normal, header->normal); + header->maxPenBias = contactBase0->restitution < 0.f ? -PX_MAX_F32 : maxPenBias; + + FloatV maxPenetration = FMax(); + + for (PxU32 patch = c.correlationListHeads[i]; + patch != CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer + c.contactPatches[patch].start; + + PxU8* p = ptr; + + for (PxU32 j = 0; j(p); + p += pointStride; + + maxPenetration = FMin(maxPenetration, constructContactConstraintStep(sqrtInvInertia0, sqrtInvInertia1, invMassNorLenSq0, + invMassNorLenSq1, angD0, angD1, bodyFrame0p, bodyFrame1p, bodyFrame0q, bodyFrame1q, + normal, norVel0, norVel1, norCross, angVel0, angVel1, + invDtp8, invDt, totalDt, invTotalDt, restDistance, restitution, + bounceThreshold, contact, *solverContact, + ccdMaxSeparation, isKinematic0, isKinematic1, offsetSlop, dt, damping)); + } + + ptr = p; + } + + PxF32* forceBuffers = reinterpret_cast(ptr); + PxMemZero(forceBuffers, sizeof(PxF32) * contactCount); + ptr += ((contactCount + 3) & (~3)) * sizeof(PxF32); // jump to next 16-byte boundary + + const PxReal staticFriction = contactBase0->staticFriction; + const PxReal dynamicFriction = contactBase0->dynamicFriction; + const bool disableFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetX(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(staticFriction)); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetY(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(dynamicFriction)); + + const bool haveFriction = (disableFriction == 0 && frictionPatch.anchorCount != 0);//PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0; + header->numNormalConstr = PxTo8(contactCount); + header->numFrictionConstr = PxTo8(haveFriction ? frictionPatch.anchorCount * 2 : 0); + + header->type = type; + + header->staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W; + FStore(angD0, &header->angDom0); + FStore(angD1, &header->angDom1); + + header->broken = 0; + + if (haveFriction) + { + + + const Vec3V linVrel = V3Sub(linVel0, linVel1); + //const Vec3V normal = Vec3V_From_PxVec3_Aligned(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + + const FloatV orthoThreshold = FLoad(0.70710678f); + const FloatV p1 = FLoad(0.0001f); + // fallback: normal.cross((1,0,0)) or normal.cross((0,0,1)) + const FloatV normalX = V3GetX(normal); + const FloatV normalY = V3GetY(normal); + const FloatV normalZ = V3GetZ(normal); + + Vec3V t0Fallback1 = V3Merge(zero, FNeg(normalZ), normalY); + Vec3V t0Fallback2 = V3Merge(FNeg(normalY), normalX, zero); + Vec3V t0Fallback = V3Sel(FIsGrtr(orthoThreshold, FAbs(normalX)), t0Fallback1, t0Fallback2); + + Vec3V t0 = V3Sub(linVrel, V3Scale(normal, V3Dot(normal, linVrel))); + t0 = V3Sel(FIsGrtr(V3LengthSq(t0), p1), t0, t0Fallback); + t0 = V3Normalize(t0); + + const VecCrossV t0Cross = V3PrepareCross(t0); + + const Vec3V t1 = V3Normalize(V3Cross(norCross, t0Cross)); + //const VecCrossV t1Cross = V3PrepareCross(t1); + + + // since we don't even have the body velocities we can't compute the tangent dirs, so + // the only thing we can do right now is to write the geometric information (which is the + // same for both axis constraints of an anchor) We put ra in the raXn field, rb in the rbXn + // field, and the error in the normal field. See corresponding comments in + // completeContactFriction() + + //We want to set the writeBack ptr to point to the broken flag of the friction patch. + //On spu we have a slight problem here because the friction patch array is + //in local store rather than in main memory. The good news is that the address of the friction + //patch array in main memory is stored in the work unit. These two addresses will be equal + //except on spu where one is local store memory and the other is the effective address in main memory. + //Using the value stored in the work unit guarantees that the main memory address is used on all platforms. + PxU8* PX_RESTRICT writeback = frictionDataPtr + frictionPatchWritebackAddrIndex*sizeof(FrictionPatch); + + + + const FloatV norVel00 = V3Dot(linVel0, t0); + const FloatV norVel01 = V3Dot(linVel1, t0); + const FloatV norVel10 = V3Dot(linVel0, t1); + const FloatV norVel11 = V3Dot(linVel1, t1); + + const Vec3V relTr = V3Sub(bodyFrame0p, bodyFrame1p); + + header->frictionBrokenWritebackByte = writeback; + + PxReal frictionScale = (contactBase0->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && frictionPatch.anchorCount == 2) ? 0.5f : 1.f; + + for (PxU32 j = 0; j < frictionPatch.anchorCount; j++) + { + PxPrefetchLine(ptr, 256); + PxPrefetchLine(ptr, 384); + SolverContactFrictionStep* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionStride; + SolverContactFrictionStep* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionStride; + + Vec3V body0Anchor = V3LoadU(frictionPatch.body0Anchors[j]); + Vec3V body1Anchor = V3LoadU(frictionPatch.body1Anchors[j]); + + Vec3V ra = QuatRotate(bodyFrame0q, body0Anchor); + Vec3V rb = QuatRotate(bodyFrame1q, body1Anchor); + + PxU32 index = c.contactID[i][j]; + + index = index == 0xFFFF ? c.contactPatches[c.correlationListHeads[i]].start : index; + + const Vec3V tvel = V3LoadA(buffer[index].targetVel); + + const Vec3V error = V3Add(V3Sub(ra, rb), relTr); + + + + { + Vec3V raXn = V3Cross(ra, t0); + Vec3V rbXn = V3Cross(rb, t0); + + raXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + const Vec3V raXnInertia = M33MulV3(sqrtInvInertia0, raXn); + const Vec3V rbXnInertia = M33MulV3(sqrtInvInertia1, rbXn); + + const FloatV resp0 = FAdd(invMassNorLenSq0, FMul(V3Dot(raXnInertia, raXnInertia), angD0)); + const FloatV resp1 = FSub(FMul(V3Dot(rbXnInertia, rbXnInertia), angD1), invMassNorLenSq1); + + const FloatV unitResponse = FAdd(resp0, resp1); + + const FloatV velMultiplier = FSel(FIsGrtr(unitResponse, zero), FDiv(p8, unitResponse), zero); + //const FloatV velMultiplier = FSel(FIsGrtr(unitResponse, zero), FRecip(unitResponse), zero); + + FloatV targetVel = V3Dot(tvel, t0); + + if(isKinematic0) + targetVel = FSub(targetVel, FAdd(norVel00, V3Dot(raXn, angVel0))); + if (isKinematic1) + targetVel = FAdd(targetVel, FAdd(norVel01, V3Dot(rbXn, angVel1))); + + f0->normalXYZ_ErrorW = V4SetW(t0, V3Dot(error, t0)); + //f0->raXnXYZ_targetVelW = V4SetW(body0Anchor, targetVel); + //f0->rbXnXYZ_biasW = V4SetW(body1Anchor, FZero()); + /*f0->raXn_biasScaleW = V4SetW(Vec4V_From_Vec3V(raXn), frictionBiasScale); + f0->rbXn_errorW = V4SetW(rbXn, V3Dot(error, t0));*/ + f0->raXnI_targetVelW = V4SetW(raXnInertia, targetVel); + f0->rbXnI_velMultiplierW = V4SetW(rbXnInertia, velMultiplier); + f0->appliedForce = 0.f; + f0->frictionScale = frictionScale; + f0->biasScale = frictionBiasScale; + } + + { + FloatV targetVel = V3Dot(tvel, t1); + + + Vec3V raXn = V3Cross(ra, t1); + Vec3V rbXn = V3Cross(rb, t1); + + raXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + const Vec3V raXnInertia = M33MulV3(sqrtInvInertia0, raXn); + const Vec3V rbXnInertia = M33MulV3(sqrtInvInertia1, rbXn); + + const FloatV resp0 = FAdd(invMassNorLenSq0, FMul(V3Dot(raXnInertia, raXnInertia), angD0)); + const FloatV resp1 = FSub(FMul(V3Dot(rbXnInertia, rbXnInertia), angD1), invMassNorLenSq1); + + const FloatV unitResponse = FAdd(resp0, resp1); + + const FloatV velMultiplier = FSel(FIsGrtr(unitResponse, zero), FDiv(p8, unitResponse), zero); + //const FloatV velMultiplier = FSel(FIsGrtr(unitResponse, zero), FRecip(unitResponse), zero); + + if (isKinematic0) + targetVel = FSub(targetVel, FAdd(norVel10, V3Dot(raXn, angVel0))); + if (isKinematic1) + targetVel = FAdd(targetVel, FAdd(norVel11, V3Dot(rbXn, angVel1))); + + + f1->normalXYZ_ErrorW = V4SetW(t1, V3Dot(error, t1)); + //f1->raXnXYZ_targetVelW = V4SetW(body0Anchor, targetVel); + //f1->rbXnXYZ_biasW = V4SetW(body1Anchor, FZero()); + //f1->raXn_biasScaleW = V4SetW(Vec4V_From_Vec3V(V3Cross(ra, t1)), frictionBiasScale); + //f1->rbXn_errorW = V4SetW(V3Cross(rb, t1), V3Dot(error, t1)); + f1->raXnI_targetVelW = V4SetW(raXnInertia, targetVel); + f1->rbXnI_velMultiplierW = V4SetW(rbXnInertia, velMultiplier); + f1->appliedForce = 0.f; + f1->frictionScale = frictionScale; + f1->biasScale = frictionBiasScale; + } + } + + if (hasTorsionalFriction && frictionPatch.anchorCount == 1) + { + const FloatV torsionalPatchRadius = FLoad(torsionalPatchRadiusF32); + const FloatV minTorsionalPatchRadius = FLoad(minTorsionalPatchRadiusF32); + const FloatV torsionalFriction = FMax(minTorsionalPatchRadius, FSqrt(FMul(FMax(zero, FNeg(maxPenetration)), torsionalPatchRadius))); + header->numFrictionConstr++; + SolverContactFrictionStep* PX_RESTRICT f = reinterpret_cast(ptr); + ptr += frictionStride; + + const Vec3V raXnInertia = M33MulV3(sqrtInvInertia0, normal); + const Vec3V rbXnInertia = M33MulV3(sqrtInvInertia1, normal); + + const FloatV resp0 = FMul(V3Dot(raXnInertia, raXnInertia), angD0); + const FloatV resp1 = FMul(V3Dot(rbXnInertia, rbXnInertia), angD1); + + const FloatV unitResponse = FAdd(resp0, resp1); + + const FloatV velMultiplier = FSel(FIsGrtr(unitResponse, zero), FDiv(p8, unitResponse), zero); + + FloatV targetVel = zero; + + if (isKinematic0) + targetVel = V3Dot(normal, angVel0); + if (isKinematic1) + targetVel = V3Dot(normal, angVel1); + + f->normalXYZ_ErrorW = V4Zero(); + f->raXnI_targetVelW = V4SetW(raXnInertia, targetVel); + f->rbXnI_velMultiplierW = V4SetW(rbXnInertia, velMultiplier); + f->biasScale = 0.f; + f->appliedForce = 0.f; + FStore(torsionalFriction, &f->frictionScale); + } + } + + frictionPatchWritebackAddrIndex++; + } + } + + + static FloatV setupExtSolverContactStep(const SolverExtBodyStep& b0, const SolverExtBodyStep& b1, + const FloatV& d0, const FloatV& d1, const FloatV& angD0, const FloatV& angD1, const Vec3V& bodyFrame0p, const Vec3V& bodyFrame1p, + const Vec3VArg normal, const FloatVArg invDt, const FloatVArg invDtp8, const FloatVArg invStepDt, const FloatVArg totalDt, + const FloatVArg dt, const FloatVArg restDistance, const FloatVArg restitution, const FloatVArg damping, + const FloatVArg bounceThreshold, const PxContactPoint& contact, SolverContactPointStepExt& solverContact, const FloatVArg /*ccdMaxSeparation*/, + const bool isKinematic0, const bool isKinematic1, const FloatVArg cfm, + const Cm::SpatialVectorV& v0, const Cm::SpatialVectorV& v1, + const Vec3VArg solverOffsetSlop, const FloatVArg norVel0, const FloatVArg norVel1) + { + const FloatV zero = FZero(); + const FloatV separation = FLoad(contact.separation); + + FloatV penetration = FSub(separation, restDistance); + + const Vec3V ra = V3Sub(V3LoadA(contact.point),bodyFrame0p); + const Vec3V rb = V3Sub(V3LoadA(contact.point), bodyFrame1p); + + Vec3V raXn = V3Cross(ra, normal); + Vec3V rbXn = V3Cross(rb, normal); + + Cm::SpatialVectorV deltaV0, deltaV1; + + + + const FloatV vRelAng = V3SumElems(V3Sub(V3Mul(v0.angular, raXn), V3Mul(v1.angular, rbXn))); + const FloatV vRelLin = FSub(norVel0, norVel1); + + const Vec3V slop = V3Scale(solverOffsetSlop, FMax(FSel(FIsEq(vRelLin, zero), FOne(), FDiv(vRelAng, vRelLin)), FOne())); + + raXn = V3Sel(V3IsGrtr(slop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(slop, V3Abs(rbXn)), V3Zero(), rbXn); + + const FloatV angV0 = V3Dot(v0.angular, raXn); + const FloatV angV1 = V3Dot(v1.angular, rbXn); + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(normal, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(normal), V3Neg(rbXn), b1); + + FloatV unitResponse = getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, false); + + + const FloatV vrel = FAdd(vRelAng, vRelLin); + + FloatV scaledBias, velMultiplier; + + FloatV recipResponse = FSel(FIsGrtr(unitResponse, FEps()), FRecip(FAdd(unitResponse, cfm)), zero); + + + if (FAllGrtr(zero, restitution)) + { + const FloatV nrdt = FMul(dt, restitution); + + const FloatV a = FMul(dt, FSub(damping, nrdt)); + + const FloatV x = FRecip(FScaleAdd(a, unitResponse, FOne())); + + velMultiplier = FMul(x, a); + //scaledBias = FSel(isSeparated, FNeg(invStepDt), FDiv(FMul(nrdt, FMul(x, unitResponse)), velMultiplier)); + scaledBias = FMul(nrdt, FMul(x, unitResponse)); + + } + else + { + velMultiplier = recipResponse; + scaledBias = FNeg(FSel(FIsGrtr(penetration, zero), invStepDt, invDtp8)); + } + + const FloatV penetrationInvDt = FMul(penetration, invDt); + + const BoolV isGreater2 = BAnd(BAnd(FIsGrtr(restitution, zero), FIsGrtr(bounceThreshold, vrel)), FIsGrtr(FNeg(vrel), penetrationInvDt)); + + + FloatV targetVelocity = FSel(isGreater2, FMul(FNeg(vrel), restitution), zero); + + const FloatV cTargetVel = V3Dot(V3LoadA(contact.targetVel), normal); + + targetVelocity = FAdd(targetVelocity, cTargetVel); + + //const FloatV deltaF = FMax(FMul(FSub(targetVelocity, FAdd(vrel, FMax(zero, penetrationInvDt))), velMultiplier), zero); + const FloatV deltaF = FMax(FMul(FAdd(targetVelocity, FSub(FNeg(penetrationInvDt), vrel)), velMultiplier), zero); + + const FloatV ratio = FSel(isGreater2, FAdd(totalDt, FDiv(penetration, vrel)), zero); + + penetration = FScaleAdd(targetVelocity, ratio, penetration); + + if (isKinematic0) + targetVelocity = FSub(targetVelocity, FAdd(norVel0, angV0)); + if(isKinematic1) + targetVelocity = FAdd(targetVelocity, FAdd(norVel1, angV1)); + + FStore(scaledBias, &solverContact.biasCoefficient); + FStore(targetVelocity, &solverContact.targetVelocity); + FStore(recipResponse, &solverContact.recipResponse); + + const Vec4V raXnI_Sepw = V4SetW(Vec4V_From_Vec3V(resp0.angular), penetration); + const Vec4V rbXnI_velMulW = V4SetW(Vec4V_From_Vec3V(V3Neg(resp1.angular)), velMultiplier); + //solverContact.raXnI = resp0.angular; + //solverContact.rbXnI = -resp1.angular; + + V4StoreA(raXnI_Sepw, &solverContact.raXnI.x); + V4StoreA(rbXnI_velMulW, &solverContact.rbXnI.x); + solverContact.linDeltaVA = deltaV0.linear; + solverContact.angDeltaVA = deltaV0.angular; + solverContact.linDeltaVB = deltaV1.linear; + solverContact.angDeltaVB = deltaV1.angular; + solverContact.maxImpulse = contact.maxImpulse; + + return deltaF; + } + + //PX_INLINE void computeFrictionTangents(const PxVec3& vrel, const PxVec3& unitNormal, PxVec3& t0, PxVec3& t1) + //{ + // PX_ASSERT(PxAbs(unitNormal.magnitude() - 1)<1e-3f); + + // t0 = vrel - unitNormal * unitNormal.dot(vrel); + // PxReal ll = t0.magnitudeSquared(); + + // if (ll > 0.1f) //can set as low as 0. + // { + // t0 *= PxRecipSqrt(ll); + // t1 = unitNormal.cross(t0); + // } + // else + // PxNormalToTangents(unitNormal, t0, t1); //fallback + //} + + PxVec3 SolverExtBodyStep::getLinVel() const + { + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return mBody->linearVelocity; + else + { + Cm::SpatialVectorV velocity = mArticulation->getLinkVelocity(mLinkIndex); + PxVec3 result; + V3StoreU(velocity.linear, result); + return result; + } + } + + Cm::SpatialVectorV SolverExtBodyStep::getVelocity() const + { + if (mLinkIndex == PxSolverConstraintDesc::RIGID_BODY) + return Cm::SpatialVectorV(V3LoadA(mData->originalLinearVelocity), V3LoadA(mData->originalAngularVelocity)); + else + return mArticulation->getLinkVelocity(mLinkIndex); + } + + + + void setupFinalizeExtSolverContactsStep( + const PxContactPoint* buffer, + const CorrelationBuffer& c, + const PxTransform& bodyFrame0, + const PxTransform& bodyFrame1, + PxU8* workspace, + const SolverExtBodyStep& b0, + const SolverExtBodyStep& b1, + const PxReal invDtF32, + const PxReal invTotalDtF32, + const PxReal totalDtF32, + const PxReal dtF32, + PxReal bounceThresholdF32, + PxReal invMassScale0, PxReal invInertiaScale0, + PxReal invMassScale1, PxReal invInertiaScale1, + const PxReal restDist, + PxU8* frictionDataPtr, + PxReal ccdMaxContactDist, + const PxReal torsionalPatchRadiusF32, + const PxReal minTorsionalPatchRadiusF32, + const PxReal biasCoefficient, + const PxReal solverOffsetSlop) + { + // NOTE II: the friction patches are sparse (some of them have no contact patches, and + // therefore did not get written back to the cache) but the patch addresses are dense, + // corresponding to valid patches + + /*const bool haveFriction = PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0;*/ + + const bool isKinematic0 = b0.isKinematic(); + const bool isKinematic1 = b1.isKinematic(); + + const FloatV ccdMaxSeparation = FLoad(ccdMaxContactDist); + + bool hasTorsionalFriction = torsionalPatchRadiusF32 > 0.f || minTorsionalPatchRadiusF32 > 0.f; + const FloatV quarter = FLoad(0.25f); + + PxU8* PX_RESTRICT ptr = workspace; + + const FloatV zero = FZero(); + + const PxF32 maxPenBias0 = b0.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY ? b0.mData->penBiasClamp : b0.mArticulation->getLinkMaxPenBias(b0.mLinkIndex); + const PxF32 maxPenBias1 = b1.mLinkIndex == PxSolverConstraintDesc::RIGID_BODY ? b1.mData->penBiasClamp : b1.mArticulation->getLinkMaxPenBias(b1.mLinkIndex); + + const PxReal maxPenBias = PxMax(maxPenBias0, maxPenBias1); + + const Cm::SpatialVectorV v0 = b0.getVelocity(); + const Cm::SpatialVectorV v1 = b1.getVelocity(); + + const FloatV d0 = FLoad(invMassScale0); + const FloatV d1 = FLoad(invMassScale1); + + const FloatV angD0 = FLoad(invInertiaScale0); + const FloatV angD1 = FLoad(invInertiaScale1); + + const Vec3V bodyFrame0p = V3LoadU(bodyFrame0.p); + const Vec3V bodyFrame1p = V3LoadU(bodyFrame1.p); + + Vec4V staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4Zero(); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetZ(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, d0); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetW(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, d1); + + const FloatV restDistance = FLoad(restDist); + + PxU32 frictionPatchWritebackAddrIndex = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + const FloatV invDt = FLoad(invDtF32); + const FloatV invTotalDt = FLoad(invTotalDtF32); + const PxReal scale = PxMin(0.8f, biasCoefficient); + const FloatV p8 = FLoad(scale); + const FloatV bounceThreshold = FLoad(bounceThresholdF32); + + const FloatV totalDt = FLoad(totalDtF32); + const FloatV dt = FLoad(dtF32); + + const FloatV invDtp8 = FMul(invDt, p8); + + const FloatV cfm = FLoad(PxMax(b0.getCFM(), b1.getCFM())); + + PxU8 flags = 0; + + const Vec3V offsetSlop = V3Load(solverOffsetSlop); + + for (PxU32 i = 0; imaterialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION) && frictionPatch.anchorCount == 2; + + PxReal coefficient = useImprovedFrictionPatch ? 1.f/frictionPatch.anchorCount : 1.f; + + const PxReal staticFriction = contactBase0->staticFriction*coefficient; + const PxReal dynamicFriction = contactBase0->dynamicFriction*coefficient; + const bool disableStrongFriction = !!(contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetX(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(staticFriction)); + staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = V4SetY(staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W, FLoad(dynamicFriction)); + + const PxReal frictionBiasScale = disableStrongFriction ? 0.f : invDtF32 * 0.8f; + + SolverContactHeaderStep* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactHeaderStep); + + + PxPrefetchLine(ptr + 128); + PxPrefetchLine(ptr + 256); + PxPrefetchLine(ptr + 384); + + const bool haveFriction = (disableStrongFriction == 0);//PX_IR(n.staticFriction) > 0 || PX_IR(n.dynamicFriction) > 0; + header->numNormalConstr = PxTo8(contactCount); + header->numFrictionConstr = PxTo8(haveFriction ? frictionPatch.anchorCount * 2 : 0); + + header->type = PxTo8(DY_SC_TYPE_EXT_CONTACT); + + header->flags = flags; + + const FloatV restitution = FLoad(contactBase0->restitution); + const FloatV damping = FLoad(contactBase0->damping); + + header->staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W = staticFrictionX_dynamicFrictionY_dominance0Z_dominance1W; + + header->angDom0 = invInertiaScale0; + header->angDom1 = invInertiaScale1; + + const PxU32 pointStride = sizeof(SolverContactPointStepExt); + const PxU32 frictionStride = sizeof(SolverContactFrictionStepExt); + + const Vec3V normal = V3LoadU(buffer[c.contactPatches[c.correlationListHeads[i]].start].normal); + + V3StoreA(normal, header->normal); + header->maxPenBias = maxPenBias; + + FloatV maxPenetration = FZero(); + + FloatV accumulatedImpulse = FZero(); + + const FloatV norVel0 = V3Dot(v0.linear, normal); + const FloatV norVel1 = V3Dot(v1.linear, normal); + + for (PxU32 patch = c.correlationListHeads[i]; + patch != CorrelationBuffer::LIST_END; + patch = c.contactPatches[patch].next) + { + const PxU32 count = c.contactPatches[patch].count; + const PxContactPoint* contactBase = buffer + c.contactPatches[patch].start; + + PxU8* p = ptr; + + for (PxU32 j = 0; j(p); + p += pointStride; + + accumulatedImpulse = FAdd(accumulatedImpulse, setupExtSolverContactStep(b0, b1, d0, d1, angD0, angD1, bodyFrame0p, bodyFrame1p, normal, invTotalDt, invDtp8, + invDt, totalDt, dt, restDistance, restitution, damping, bounceThreshold, contact, *solverContact, ccdMaxSeparation, isKinematic0, isKinematic1, + cfm, v0, v1, offsetSlop, norVel0, norVel1)); + + maxPenetration = FMin(FLoad(contact.separation), maxPenetration); + + } + + ptr = p; + } + accumulatedImpulse = FMul(FDiv(accumulatedImpulse, FLoad(PxF32(contactCount))), quarter); + + FStore(accumulatedImpulse, &header->minNormalForce); + + PxF32* forceBuffer = reinterpret_cast(ptr); + PxMemZero(forceBuffer, sizeof(PxF32) * contactCount); + ptr += sizeof(PxF32) * ((contactCount + 3) & (~3)); + + header->broken = 0; + + if (haveFriction) + { + //const Vec3V normal = Vec3V_From_PxVec3(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + const Vec3V linVrel = V3Sub(v0.linear, v1.linear); + //const Vec3V normal = Vec3V_From_PxVec3_Aligned(buffer.contacts[c.contactPatches[c.correlationListHeads[i]].start].normal); + + const FloatV orthoThreshold = FLoad(0.70710678f); + const FloatV p1 = FLoad(0.0001f); + // fallback: normal.cross((1,0,0)) or normal.cross((0,0,1)) + const FloatV normalX = V3GetX(normal); + const FloatV normalY = V3GetY(normal); + const FloatV normalZ = V3GetZ(normal); + + Vec3V t0Fallback1 = V3Merge(zero, FNeg(normalZ), normalY); + Vec3V t0Fallback2 = V3Merge(FNeg(normalY), normalX, zero); + Vec3V t0Fallback = V3Sel(FIsGrtr(orthoThreshold, FAbs(normalX)), t0Fallback1, t0Fallback2); + + Vec3V t0 = V3Sub(linVrel, V3Scale(normal, V3Dot(normal, linVrel))); + t0 = V3Sel(FIsGrtr(V3LengthSq(t0), p1), t0, t0Fallback); + t0 = V3Normalize(t0); + + const VecCrossV t0Cross = V3PrepareCross(t0); + + const Vec3V t1 = V3Cross(normal, t0Cross); + const VecCrossV t1Cross = V3PrepareCross(t1); + + //We want to set the writeBack ptr to point to the broken flag of the friction patch. + //On spu we have a slight problem here because the friction patch array is + //in local store rather than in main memory. The good news is that the address of the friction + //patch array in main memory is stored in the work unit. These two addresses will be equal + //except on spu where one is local store memory and the other is the effective address in main memory. + //Using the value stored in the work unit guarantees that the main memory address is used on all platforms. + PxU8* PX_RESTRICT writeback = frictionDataPtr + frictionPatchWritebackAddrIndex * sizeof(FrictionPatch); + + header->frictionBrokenWritebackByte = writeback; + + PxReal frictionScale = (contactBase0->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && frictionPatch.anchorCount == 2) ? 0.5f : 1.f; + + for (PxU32 j = 0; j < frictionPatch.anchorCount; j++) + { + SolverContactFrictionStepExt* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionStride; + SolverContactFrictionStepExt* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionStride; + + Vec3V ra = V3LoadU(bodyFrame0.q.rotate(frictionPatch.body0Anchors[j])); + Vec3V rb = V3LoadU(bodyFrame1.q.rotate(frictionPatch.body1Anchors[j])); + Vec3V error = V3Sub(V3Add(ra, bodyFrame0p), V3Add(rb,bodyFrame1p)); + + { + Vec3V raXn = V3Cross(ra, t0Cross); + Vec3V rbXn = V3Cross(rb, t0Cross); + raXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + Cm::SpatialVectorV deltaV0, deltaV1; + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(t0, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(t0), V3Neg(rbXn), b1); + FloatV resp = getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, false); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, FEps()), FDiv(p8, FAdd(cfm, resp)), zero); + + PxU32 index = c.contactPatches[c.correlationListHeads[i]].start; + FloatV targetVel = V3Dot(V3LoadA(buffer[index].targetVel), t0); + + if(isKinematic0) + targetVel = FSub(targetVel, v0.dot(resp0)); + if(isKinematic1) + targetVel = FSub(targetVel, v1.dot(resp1)); + + f0->normalXYZ_ErrorW = V4SetW(Vec4V_From_Vec3V(t0), V3Dot(error, t0)); + f0->raXnI_targetVelW = V4SetW(Vec4V_From_Vec3V(resp0.angular), targetVel); + f0->rbXnI_velMultiplierW = V4SetW(V4Neg(Vec4V_From_Vec3V(resp1.angular)), velMultiplier); + f0->appliedForce = 0.f; + f0->biasScale = frictionBiasScale; + f0->linDeltaVA = deltaV0.linear; + f0->linDeltaVB = deltaV1.linear; + f0->angDeltaVA = deltaV0.angular; + f0->angDeltaVB = deltaV1.angular; + f0->frictionScale = frictionScale; + } + + { + + Vec3V raXn = V3Cross(ra, t1Cross); + Vec3V rbXn = V3Cross(rb, t1Cross); + raXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(raXn)), V3Zero(), raXn); + rbXn = V3Sel(V3IsGrtr(offsetSlop, V3Abs(rbXn)), V3Zero(), rbXn); + + Cm::SpatialVectorV deltaV0, deltaV1; + + + const Cm::SpatialVectorV resp0 = createImpulseResponseVector(t1, raXn, b0); + const Cm::SpatialVectorV resp1 = createImpulseResponseVector(V3Neg(t1), V3Neg(rbXn), b1); + + FloatV resp = getImpulseResponse(b0, resp0, deltaV0, d0, angD0, + b1, resp1, deltaV1, d1, angD1, false); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, FEps()), FDiv(p8, FAdd(cfm, resp)), zero); + + PxU32 index = c.contactPatches[c.correlationListHeads[i]].start; + FloatV targetVel = V3Dot(V3LoadA(buffer[index].targetVel), t1); + + if (isKinematic0) + targetVel = FSub(targetVel, v0.dot(resp0)); + if (isKinematic1) + targetVel = FSub(targetVel, v1.dot(resp1)); + + f1->normalXYZ_ErrorW = V4SetW(Vec4V_From_Vec3V(t1), V3Dot(error, t1)); + f1->raXnI_targetVelW = V4SetW(Vec4V_From_Vec3V(resp0.angular), targetVel); + f1->rbXnI_velMultiplierW = V4SetW(V4Neg(Vec4V_From_Vec3V(resp1.angular)), velMultiplier); + f1->appliedForce = 0.f; + f1->biasScale = frictionBiasScale; + f1->linDeltaVA = deltaV0.linear; + f1->linDeltaVB = deltaV1.linear; + f1->angDeltaVA = deltaV0.angular; + f1->angDeltaVB = deltaV1.angular; + f1->frictionScale = frictionScale; + } + } + + if (hasTorsionalFriction && frictionPatch.anchorCount == 1) + { + const FloatV torsionalPatchRadius = FLoad(torsionalPatchRadiusF32); + const FloatV minTorsionalPatchRadius = FLoad(minTorsionalPatchRadiusF32); + const FloatV torsionalFriction = FMax(minTorsionalPatchRadius, FSqrt(FMul(FMax(zero, FNeg(maxPenetration)), torsionalPatchRadius))); + header->numFrictionConstr++; + SolverContactFrictionStepExt* PX_RESTRICT f = reinterpret_cast(ptr); + ptr += frictionStride; + + const Cm::SpatialVector resp0 = createImpulseResponseVector(PxVec3(0.f), header->normal, b0); + const Cm::SpatialVector resp1 = createImpulseResponseVector(PxVec3(0.f), -header->normal, b1); + + Cm::SpatialVector deltaV0, deltaV1; + + PxReal ur = getImpulseResponse(b0, resp0, deltaV0, invMassScale0, invInertiaScale0, + b1, resp1, deltaV1, invMassScale1, invInertiaScale1, false); + + FloatV resp = FLoad(ur); + + const FloatV velMultiplier = FSel(FIsGrtr(resp, FEps()), FDiv(p8, FAdd(cfm, resp)), zero); + + f->normalXYZ_ErrorW = V4Zero(); + f->raXnI_targetVelW = V4SetW(V3LoadA(resp0.angular), zero); + f->rbXnI_velMultiplierW = V4SetW(V4Neg(Vec4V_From_Vec3V(V3LoadA(resp1.angular))), velMultiplier); + f->biasScale = 0.f; + f->appliedForce = 0.f; + FStore(torsionalFriction, &f->frictionScale); + f->linDeltaVA = V3LoadA(deltaV0.linear); + f->linDeltaVB = V3LoadA(deltaV1.linear); + f->angDeltaVA = V3LoadA(deltaV0.angular); + f->angDeltaVB = V3LoadA(deltaV1.angular); + + } + + } + + frictionPatchWritebackAddrIndex++; + } + } + + + + + bool createFinalizeSolverContactsStep( + PxTGSSolverContactDesc& contactDesc, + CorrelationBuffer& c, + const PxReal invDtF32, + const PxReal invTotalDtF32, + const PxReal totalDtF32, + const PxReal dtF32, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator) + { + PxPrefetchLine(contactDesc.body0); + PxPrefetchLine(contactDesc.body1); + + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + const bool hasForceThreshold = contactDesc.hasForceThresholds; + const bool staticOrKinematicBody = contactDesc.bodyState1 == PxSolverContactDesc::eKINEMATIC_BODY || contactDesc.bodyState1 == PxSolverContactDesc::eSTATIC_BODY; + + const bool disableStrongFriction = contactDesc.disableStrongFriction; + + PxSolverConstraintDesc& desc = *contactDesc.desc; + + const bool useExtContacts = (desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY || desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY); + + desc.constraintLengthOver16 = 0; + + + if (contactDesc.numContacts == 0) + { + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; + desc.constraint = NULL; + return true; + } + + if (!disableStrongFriction) + { + getFrictionPatches(c, contactDesc.frictionPtr, contactDesc.frictionCount, contactDesc.bodyFrame0, contactDesc.bodyFrame1, correlationDistance); + } + + bool overflow = !createContactPatches(c, contactDesc.contacts, contactDesc.numContacts, PXC_SAME_NORMAL); + overflow = correlatePatches(c, contactDesc.contacts, contactDesc.bodyFrame0, contactDesc.bodyFrame1, PXC_SAME_NORMAL, 0, 0) || overflow; + PX_UNUSED(overflow); + +#if PX_CHECKED + if (overflow) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Dropping contacts in solver because we exceeded limit of 32 friction patches."); + } +#endif + + growPatches(c, contactDesc.contacts, contactDesc.bodyFrame0, contactDesc.bodyFrame1, 0, frictionOffsetThreshold + contactDesc.restDistance); + + //PX_ASSERT(patchCount == c.frictionPatchCount); + + FrictionPatch* frictionPatches = NULL; + PxU8* solverConstraint = NULL; + PxU32 numFrictionPatches = 0; + PxU32 solverConstraintByteSize = 0; + PxU32 axisConstraintCount = 0; + + const bool successfulReserve = reserveBlockStreams( + useExtContacts, c, + solverConstraint, frictionPatches, + numFrictionPatches, + solverConstraintByteSize, + axisConstraintCount, + constraintAllocator, + PxMax(contactDesc.torsionalPatchRadius, contactDesc.minTorsionalPatchRadius)); + // initialise the work unit's ptrs to the various buffers. + + contactDesc.frictionPtr = NULL; + contactDesc.frictionCount = 0; + desc.constraint = NULL; + desc.constraintLengthOver16 = 0; + // patch up the work unit with the reserved buffers and set the reserved buffer data as appropriate. + + if (successfulReserve) + { + PxU8* frictionDataPtr = reinterpret_cast(frictionPatches); + contactDesc.frictionPtr = frictionDataPtr; + desc.constraint = solverConstraint; + //output.nbContacts = PxTo8(numContacts); + contactDesc.frictionCount = PxTo8(numFrictionPatches); + PX_ASSERT((solverConstraintByteSize & 0xf) == 0); + desc.constraintLengthOver16 = PxTo16(solverConstraintByteSize / 16); + desc.writeBack = contactDesc.contactForces; + + //Initialise friction buffer. + if (frictionPatches) + { + // PT: TODO: revisit this... not very satisfying + //const PxU32 maxSize = numFrictionPatches*sizeof(FrictionPatch); + PxPrefetchLine(frictionPatches); + PxPrefetchLine(frictionPatches, 128); + PxPrefetchLine(frictionPatches, 256); + + for (PxU32 i = 0; i(contactDesc.body0), contactDesc.body0TxI, contactDesc.bodyData0, desc.linkIndexA); + const SolverExtBodyStep b1(reinterpret_cast(contactDesc.body1), contactDesc.body1TxI, contactDesc.bodyData1, desc.linkIndexB); + + setupFinalizeExtSolverContactsStep(contactDesc.contacts, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + b0, b1, invDtF32, invTotalDtF32, totalDtF32, dtF32, bounceThresholdF32, + contactDesc.invMassScales.linear0, contactDesc.invMassScales.angular0, contactDesc.invMassScales.linear1, contactDesc.invMassScales.angular1, + contactDesc.restDistance, frictionDataPtr, contactDesc.maxCCDSeparation, contactDesc.torsionalPatchRadius, contactDesc.minTorsionalPatchRadius, + biasCoefficient, contactDesc.offsetSlop); + } + else + { + + const PxTGSSolverBodyVel& b0 = *contactDesc.body0; + const PxTGSSolverBodyVel& b1 = *contactDesc.body1; + + setupFinalizeSolverConstraints(getInteraction(contactDesc), contactDesc.contacts, c, contactDesc.bodyFrame0, contactDesc.bodyFrame1, solverConstraint, + b0, b1, *contactDesc.body0TxI, *contactDesc.body1TxI, *contactDesc.bodyData0, *contactDesc.bodyData1, invDtF32, totalDtF32, invTotalDtF32, dtF32, bounceThresholdF32, + contactDesc.invMassScales.linear0, contactDesc.invMassScales.angular0, contactDesc.invMassScales.linear1, contactDesc.invMassScales.angular1, + hasForceThreshold, staticOrKinematicBody, contactDesc.restDistance, frictionDataPtr, contactDesc.maxCCDSeparation, disableStrongFriction, + contactDesc.torsionalPatchRadius, contactDesc.minTorsionalPatchRadius, biasCoefficient, + contactDesc.offsetSlop); + } + //KS - set to 0 so we have a counter for the number of times we solved the constraint + //only going to be used on SPU but might as well set on all platforms because this code is shared + *(reinterpret_cast(solverConstraint + solverConstraintByteSize)) = 0; + } + } + + return successfulReserve; + } + + + + + bool createFinalizeSolverContactsStep(PxTGSSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal invTotalDt, + const PxReal totalDtF32, + const PxReal dt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator) + { + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + // We pull the friction patches out of the cache to remove the dependency on how + // the cache is organized. Remember original addrs so we can write them back + // efficiently. + + PxU32 numContacts = 0; + { + PxReal invMassScale0 = 1.f; + PxReal invMassScale1 = 1.f; + PxReal invInertiaScale0 = 1.f; + PxReal invInertiaScale1 = 1.f; + contactDesc.invMassScales.angular0 = (contactDesc.bodyState0 != PxSolverContactDesc::eARTICULATION && contactDesc.body0->isKinematic) ? 0.f : contactDesc.invMassScales.angular0; + contactDesc.invMassScales.angular1 = (contactDesc.bodyState1 != PxSolverContactDesc::eARTICULATION && contactDesc.body1->isKinematic) ? 0.f : contactDesc.invMassScales.angular1; + + bool hasMaxImpulse = false, hasTargetVelocity = false; + + numContacts = extractContacts(buffer, output, hasMaxImpulse, hasTargetVelocity, invMassScale0, invMassScale1, + invInertiaScale0, invInertiaScale1, contactDesc.maxImpulse); + + contactDesc.contacts = buffer.contacts; + contactDesc.numContacts = numContacts; + contactDesc.disableStrongFriction = contactDesc.disableStrongFriction || hasTargetVelocity; + contactDesc.hasMaxImpulse = hasMaxImpulse; + contactDesc.invMassScales.linear0 *= invMassScale0; + contactDesc.invMassScales.linear1 *= invMassScale1; + contactDesc.invMassScales.angular0 *= invInertiaScale0; + contactDesc.invMassScales.angular1 *= invInertiaScale1; + } + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + + return createFinalizeSolverContactsStep(contactDesc, c, invDtF32, invTotalDt, totalDtF32, dt, bounceThresholdF32, + frictionOffsetThreshold, correlationDistance, biasCoefficient, constraintAllocator); + } + + + static FloatV solveDynamicContactsStep(SolverContactPointStep* contacts, const PxU32 nbContactPoints, const Vec3VArg contactNormal, + const FloatVArg invMassA, const FloatVArg invMassB, Vec3V& linVel0_, Vec3V& angState0_, + Vec3V& linVel1_, Vec3V& angState1_, PxF32* PX_RESTRICT forceBuffer, + const Vec3V& angMotion0, const Vec3V& angMotion1, + const Vec3V& linRelMotion, const FloatVArg maxPenBias, + const FloatVArg angD0, const FloatVArg angD1, const FloatVArg minPen, + const FloatVArg elapsedTime) + { + Vec3V linVel0 = linVel0_; + Vec3V angState0 = angState0_; + Vec3V linVel1 = linVel1_; + Vec3V angState1 = angState1_; + const FloatV zero = FZero(); + FloatV accumulatedNormalImpulse = zero; + + const Vec3V delLinVel0 = V3Scale(contactNormal, invMassA); + const Vec3V delLinVel1 = V3Scale(contactNormal, invMassB); + + const FloatV deltaV = V3Dot(linRelMotion, contactNormal); + + for (PxU32 i = 0; i(currPtr); + currPtr += sizeof(SolverContactHeaderStep); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverContactPointStep* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPointStep); + + PxF32* forceBuffer = reinterpret_cast(currPtr); + currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + SolverContactFrictionStep* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionStep); + + const FloatV invMassA = FLoad(hdr->invMass0); + const FloatV invMassB = FLoad(hdr->invMass1); + + const FloatV angDom0 = FLoad(hdr->angDom0); + const FloatV angDom1 = FLoad(hdr->angDom1); + + //const FloatV sumMass = FAdd(invMassA, invMassB); + + const Vec3V contactNormal = V3LoadA(hdr->normal); + + const FloatV maxPenBias = FLoad(hdr->maxPenBias); + + const FloatV accumulatedNormalImpulse = solveDynamicContactsStep(contacts, numNormalConstr, contactNormal, invMassA, invMassB, + linVel0, angState0, linVel1, angState1, forceBuffer,angMotion0, angMotion1, relMotion, maxPenBias, angDom0, angDom1, minPen, + elapsedTime); + + FStore(accumulatedNormalImpulse, &hdr->minNormalForce); + + if (numFrictionConstr && doFriction) + { + const FloatV staticFrictionCof = hdr->getStaticFriction(); + const FloatV dynamicFrictionCof = hdr->getDynamicFriction(); + const FloatV maxFrictionImpulse = FMul(staticFrictionCof, accumulatedNormalImpulse); + const FloatV maxDynFrictionImpulse = FMul(dynamicFrictionCof, accumulatedNormalImpulse); + const FloatV negMaxDynFrictionImpulse = FNeg(maxDynFrictionImpulse); + + BoolV broken = BFFFF(); + + //We will have either 4 or 2 frictions (with friction pairs). + //With torsional friction, we may have 3 (a single friction anchor + twist). + const PxU32 numFrictionPairs = (numFrictionConstr&6); + + for (PxU32 i = 0; i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse0 = FNegScaleSub(normalVel0, velMultiplier0, tmp10); + const FloatV totalImpulse1 = FNegScaleSub(normalVel1, velMultiplier1, tmp11); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const FloatV totalImpulse = FSqrt(FAdd(FMul(totalImpulse0, totalImpulse0), FMul(totalImpulse1, totalImpulse1))); + + const BoolV clamp = FIsGrtr(totalImpulse, FMul(frictionScale, maxFrictionImpulse)); + + const FloatV totalClamped = FSel(clamp, FMin(FMul(frictionScale, maxDynFrictionImpulse), totalImpulse), totalImpulse); + + const FloatV ratio = FSel(FIsGrtr(totalImpulse, zero), FDiv(totalClamped, totalImpulse), zero); + + const FloatV newAppliedForce0 = FMul(totalImpulse0, ratio); + const FloatV newAppliedForce1 = FMul(totalImpulse1, ratio); + + broken = BOr(broken, clamp); + + FloatV deltaF0 = FSub(newAppliedForce0, appliedForce0); + FloatV deltaF1 = FSub(newAppliedForce1, appliedForce1); + + // we could get rid of the stall here by calculating and clamping delta separately, but + // the complexity isn't really worth it. + + linVel0 = V3ScaleAdd(delLinVel00, deltaF0, V3ScaleAdd(delLinVel01, deltaF1, linVel0)); + linVel1 = V3NegScaleSub(delLinVel10, deltaF0, V3NegScaleSub(delLinVel11, deltaF1, linVel1)); + angState0 = V3ScaleAdd(raXnI0, FMul(deltaF0, angDom0), V3ScaleAdd(raXnI1, FMul(deltaF1, angDom0), angState0)); + angState1 = V3NegScaleSub(rbXnI0, FMul(deltaF0, angDom1), V3NegScaleSub(rbXnI1, FMul(deltaF1, angDom1), angState1)); + + f0.setAppliedForce(newAppliedForce0); + f1.setAppliedForce(newAppliedForce1); + } + + for (PxU32 i = numFrictionPairs; i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse = FNegScaleSub(normalVel, velMultiplier, tmp1); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const BoolV clamp = FIsGrtr(FAbs(totalImpulse), FMul(frictionScale, maxFrictionImpulse)); + + const FloatV totalClamped = FMin(FMul(frictionScale, maxDynFrictionImpulse), FMax(FMul(frictionScale, negMaxDynFrictionImpulse), totalImpulse)); + + const FloatV newAppliedForce = FSel(clamp, totalClamped, totalImpulse); + + broken = BOr(broken, clamp); + + FloatV deltaF = FSub(newAppliedForce, appliedForce); + + // we could get rid of the stall here by calculating and clamping delta separately, but + // the complexity isn't really worth it. + + angState0 = V3ScaleAdd(raXnI, FMul(deltaF, angDom0), angState0); + angState1 = V3NegScaleSub(rbXnI, FMul(deltaF, angDom1), angState1); + + f.setAppliedForce(newAppliedForce); + + + } + Store_From_BoolV(broken, &hdr->broken); + } + + } + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularVelocity.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularVelocity.isFinite()); + + // Write back + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(linVel1, b1.linearVelocity); + V3StoreA(angState0, b0.angularVelocity); + V3StoreA(angState1, b1.angularVelocity); + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularVelocity.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularVelocity.isFinite()); + + PX_ASSERT(currPtr == last); + } + + void writeBackContact(const PxSolverConstraintDesc& desc, SolverContext* cache) + { + PX_UNUSED(cache); + // PxReal normalForce = 0; + + PxU8* PX_RESTRICT cPtr = desc.constraint; + PxReal* PX_RESTRICT vForceWriteback = reinterpret_cast(desc.writeBack); + PxU8* PX_RESTRICT last = desc.constraint + desc.constraintLengthOver16 * 16; + + bool forceThreshold = false; + + while (cPtr < last) + { + const SolverContactHeaderStep* PX_RESTRICT hdr = reinterpret_cast(cPtr); + cPtr += sizeof(SolverContactHeaderStep); + + forceThreshold = hdr->flags & SolverContactHeaderStep::eHAS_FORCE_THRESHOLDS; + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + //if(cPtr < last) + PxPrefetchLine(cPtr, 256); + PxPrefetchLine(cPtr, 384); + + const PxU32 pointStride = hdr->type == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactPointStepExt) + : sizeof(SolverContactPointStep); + + cPtr += pointStride * numNormalConstr; + PxF32* forceBuffer = reinterpret_cast(cPtr); + cPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + if (vForceWriteback != NULL) + { + for (PxU32 i = 0; itype == DY_SC_TYPE_EXT_CONTACT ? sizeof(SolverContactFrictionStepExt) + : sizeof(SolverContactFrictionStep); + + if (hdr->broken && hdr->frictionBrokenWritebackByte != NULL) + { + *hdr->frictionBrokenWritebackByte = 1; + } + + cPtr += frictionStride * numFrictionConstr; + + } + PX_ASSERT(cPtr == last); + + PX_UNUSED(forceThreshold); + +#if 0 + if (cache && forceThreshold && desc.linkIndexA == PxSolverConstraintDesc::NO_LINK && desc.linkIndexB == PxSolverConstraintDesc::NO_LINK && + normalForce != 0 && (desc.bodyA->reportThreshold < PX_MAX_REAL || desc.bodyB->reportThreshold < PX_MAX_REAL)) + { + ThresholdStreamElement elt; + elt.normalForce = normalForce; + elt.threshold = PxMin(desc.bodyA->reportThreshold, desc.bodyB->reportThreshold); + elt.nodeIndexA = desc.bodyA->nodeIndex; + elt.nodeIndexB = desc.bodyB->nodeIndex; + elt.shapeInteraction = reinterpret_cast(desc.constraint)->shapeInteraction; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + PX_ASSERT(cache->mThresholdStreamIndexmThresholdStreamLength); + cache->mThresholdStream[cache->mThresholdStreamIndex++] = elt; + } +#endif + } + + PX_FORCE_INLINE Vec3V V3FromV4(Vec4V x) { return Vec3V_From_Vec4V(x); } + PX_FORCE_INLINE Vec3V V3FromV4Unsafe(Vec4V x) { return Vec3V_From_Vec4V_WUndefined(x); } + PX_FORCE_INLINE Vec4V V4FromV3(Vec3V x) { return Vec4V_From_Vec3V(x); } + //PX_FORCE_INLINE Vec4V V4ClearW(Vec4V x) { return V4SetW(x, FZero()); } + +void setSolverConstantsStep(PxReal& error, + PxReal& biasScale, + PxReal& targetVel, + PxReal& maxBias, + PxReal& velMultiplier, + PxReal& rcpResponse, + const Px1DConstraint& c, + PxReal normalVel, + PxReal unitResponse, + PxReal minRowResponse, + PxReal erp, + PxReal dt, + PxReal totalDt, + PxReal biasClamp, + PxReal recipdt, + PxReal recipTotalDt, + PxReal velTarget) +{ + PX_UNUSED(dt); + PX_UNUSED(totalDt); + PX_UNUSED(minRowResponse); + PX_ASSERT(PxIsFinite(unitResponse)); + PxReal recipResponse = unitResponse <= minRowResponse ? 0 : 1.0f / unitResponse; + //PX_ASSERT(recipResponse < 1e5f); + PxReal geomError = c.geometricError; + + rcpResponse = recipResponse; + + + + if (c.flags & Px1DConstraintFlag::eSPRING) + { + PxReal a = dt * (dt*c.mods.spring.stiffness + c.mods.spring.damping); + PxReal aDamp = dt * dt * (c.mods.spring.damping + c.mods.spring.stiffness); + PxReal b = dt * (c.mods.spring.damping * (c.velocityTarget));// - c.mods.spring.stiffness * geomError); + maxBias = PX_MAX_F32; + PxReal errorTerm; + + if (c.flags & Px1DConstraintFlag::eACCELERATION_SPRING) + { + const PxReal x = 1.0f / (1.0f + a); + const PxReal xDamp = 1.0f / (1.0f + aDamp); + targetVel = x * b; + velMultiplier = -x * a; + errorTerm = -x * c.mods.spring.stiffness * dt; + biasScale = errorTerm - xDamp*c.mods.spring.damping*dt; + } + else + { + const PxReal x = 1.0f / (1.0f + a*unitResponse); + const PxReal xDamp = 1.0f / (1.0f + aDamp*unitResponse); + targetVel = x * b*unitResponse; + velMultiplier = -x * a*unitResponse; + errorTerm = -x * c.mods.spring.stiffness * unitResponse * dt; + biasScale = errorTerm - xDamp*c.mods.spring.damping*unitResponse*dt; + } + + error = geomError * errorTerm; + + } + else + { + velMultiplier = -1.f; + + if (c.flags & Px1DConstraintFlag::eRESTITUTION && -normalVel>c.mods.bounce.velocityThreshold) + { + error = 0.f; + biasScale = 0.f; + + targetVel = c.mods.bounce.restitution*-normalVel; + maxBias = 0.f; + } + else + { + + biasScale = -recipdt*erp;// *recipResponse; + if (c.flags & Px1DConstraintFlag::eDRIVE_ROW) + { + error = 0.f; + targetVel = c.velocityTarget - geomError *recipTotalDt; + } + else + { + error = geomError * biasScale; + //KS - if there is a velocity target, then we cannot also have bias otherwise the two compete against each-other. + //Therefore, we set the velocity target + targetVel = c.velocityTarget;// *recipResponse; + } + + maxBias = biasClamp;// *recipResponse; + + /*PxReal errorBias = PxClamp(geomError*erp*recipdt, -biasClamp, biasClamp); + + constant = (c.velocityTarget - errorBias) * recipResponse;*/ + + } + } + targetVel -= velMultiplier * velTarget; +} + + + +PxU32 setupSolverConstraintStep( + const PxTGSSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + const PxReal dt, const PxReal totalDt, const PxReal invdt, const PxReal invTotalDt, + const PxReal lengthScale, const PxReal biasCoefficient) +{ + + if (prepDesc.numRows == 0) + { + prepDesc.desc->constraint = NULL; + prepDesc.desc->writeBack = NULL; + prepDesc.desc->constraintLengthOver16 = 0; + return 0; + } + + PxSolverConstraintDesc& desc = *prepDesc.desc; + + const bool isExtended = desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY + || desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY; + + const bool isKinematic0 = desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY && + desc.tgsBodyA->isKinematic; + + const bool isKinematic1 = desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY && + desc.tgsBodyB->isKinematic; + + PxU32 stride = isExtended ? sizeof(SolverConstraint1DExtStep) : sizeof(SolverConstraint1DStep); + const PxU32 constraintLength = sizeof(SolverConstraint1DHeaderStep) + stride * prepDesc.numRows; + + //KS - +16 is for the constraint progress counter, which needs to be the last element in the constraint (so that we + //know SPU DMAs have completed) + PxU8* ptr = allocator.reserveConstraintData(constraintLength + 16u); + if (NULL == ptr || (reinterpret_cast(-1)) == ptr) + { + if (NULL == ptr) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept joints detaching/exploding or increase buffer size allocated for constraint prep by increasing PxSceneDesc::maxNbContactDataBlocks."); + return 0; + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of constraint data. " + "Either accept joints detaching/exploding or simplify constraints."); + ptr = NULL; + return 0; + } + } + desc.constraint = ptr; + + //setConstraintLength(desc, constraintLength); + PX_ASSERT((constraintLength & 0xf) == 0); + desc.constraintLengthOver16 = PxTo16(constraintLength / 16); + + desc.writeBack = prepDesc.writeback; + + PxMemSet(desc.constraint, 0, constraintLength); + + SolverConstraint1DHeaderStep* header = reinterpret_cast(desc.constraint); + PxU8* constraints = desc.constraint + sizeof(SolverConstraint1DHeaderStep); + init(*header, PxTo8(prepDesc.numRows), isExtended, prepDesc.invMassScales); + header->body0WorldOffset = prepDesc.body0WorldOffset; + header->linBreakImpulse = prepDesc.linBreakForce * totalDt; + header->angBreakImpulse = prepDesc.angBreakForce * totalDt; + header->breakable = PxU8((prepDesc.linBreakForce != PX_MAX_F32) || (prepDesc.angBreakForce != PX_MAX_F32)); + header->invMass0D0 = prepDesc.bodyData0->invMass * prepDesc.invMassScales.linear0; + header->invMass1D1 = prepDesc.bodyData1->invMass * prepDesc.invMassScales.linear1; + + header->rAWorld = prepDesc.cA2w - prepDesc.bodyFrame0.p; + header->rBWorld = prepDesc.cB2w - prepDesc.bodyFrame1.p; + + /*printf("prepDesc.cA2w.p = (%f, %f, %f), prepDesc.cB2w.p = (%f, %f, %f)\n", + prepDesc.cA2w.x, prepDesc.cA2w.y, prepDesc.cA2w.z, + prepDesc.cB2w.x, prepDesc.cB2w.y, prepDesc.cB2w.z);*/ + + Px1DConstraint* sorted[MAX_CONSTRAINT_ROWS]; + + PX_ALIGN(16, PxVec4) angSqrtInvInertia0[MAX_CONSTRAINT_ROWS]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia1[MAX_CONSTRAINT_ROWS]; + + for (PxU32 i = 0; i < prepDesc.numRows; ++i) + { + if (prepDesc.rows[i].flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT) + { + if (prepDesc.rows[i].solveHint == PxConstraintSolveHint::eEQUALITY) + prepDesc.rows[i].solveHint = PxConstraintSolveHint::eROTATIONAL_EQUALITY; + else if (prepDesc.rows[i].solveHint == PxConstraintSolveHint::eINEQUALITY) + prepDesc.rows[i].solveHint = PxConstraintSolveHint::eROTATIONAL_INEQUALITY; + } + } + + preprocessRows(sorted, prepDesc.rows, angSqrtInvInertia0, angSqrtInvInertia1, prepDesc.numRows, + prepDesc.body0TxI->sqrtInvInertia, prepDesc.body1TxI->sqrtInvInertia, prepDesc.bodyData0->invMass, prepDesc.bodyData1->invMass, + prepDesc.invMassScales, isExtended || prepDesc.disablePreprocessing, prepDesc.improvedSlerp); + + PxReal erp = 0.5f * biasCoefficient; + + const PxReal recipDt = invdt; + + const PxReal angSpeedLimit = invTotalDt*0.75f; + const PxReal linSpeedLimit = isExtended ? invTotalDt*1.5f*lengthScale : invTotalDt*15.f*lengthScale; + + PxU32 orthoCount = 0; + PxU32 outCount = 0; + + const SolverExtBodyStep eb0(reinterpret_cast(prepDesc.body0), prepDesc.body0TxI, prepDesc.bodyData0, desc.linkIndexA); + const SolverExtBodyStep eb1(reinterpret_cast(prepDesc.body1), prepDesc.body1TxI, prepDesc.bodyData1, desc.linkIndexB); + + PxReal cfm = 0.f; + if (isExtended) + { + cfm = PxMax(eb0.getCFM(), eb1.getCFM()); + } + + for (PxU32 i = 0; i(constraints); + Px1DConstraint& c = *sorted[i]; + + PxReal driveScale = c.flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && prepDesc.driveLimitsAreForces ? PxMin(totalDt, 1.0f) : 1.0f; + + PxReal unitResponse; + PxReal normalVel = 0.0f; + + PxReal vel0, vel1; + + if (!isExtended) + { + const PxVec3 angSqrtInvInertia0V3(angSqrtInvInertia0[i].x, angSqrtInvInertia0[i].y, angSqrtInvInertia0[i].z); + const PxVec3 angSqrtInvInertia1V3(angSqrtInvInertia1[i].x, angSqrtInvInertia1[i].y, angSqrtInvInertia1[i].z); + init(s, c.linear0, c.linear1, c.angular0, c.angular1, c.minImpulse * driveScale, c.maxImpulse * driveScale); + + /*unitResponse = prepDesc.body0->getResponse(c.linear0, c.angular0, s.ang0, prepDesc.mInvMassScales.linear0, prepDesc.mInvMassScales.angular0) + + prepDesc.body1->getResponse(-c.linear1, -c.angular1, s.ang1, prepDesc.mInvMassScales.linear1, prepDesc.mInvMassScales.angular1);*/ + + const PxReal linSumMass = s.lin0.magnitudeSquared() * prepDesc.bodyData0->invMass * prepDesc.invMassScales.linear0 + s.lin1.magnitudeSquared() * prepDesc.bodyData1->invMass * prepDesc.invMassScales.linear1; + + PxReal resp0 = angSqrtInvInertia0V3.magnitudeSquared() * prepDesc.invMassScales.angular0; + PxReal resp1 = angSqrtInvInertia1V3.magnitudeSquared() * prepDesc.invMassScales.angular1; + unitResponse = resp0 + resp1 + linSumMass; + + //s.recipResponseOrLinearSumMass = linSumMass; + + vel0 = prepDesc.bodyData0->projectVelocity(s.lin0, s.ang0); + vel1 = prepDesc.bodyData1->projectVelocity(s.lin1, s.ang1); + + normalVel = vel0 - vel1; + + //if (c.solveHint & PxConstraintSolveHint::eEQUALITY) + if(!(c.flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT)) + { + s.ang0 = PxVec3(0.f); + s.ang1 = PxVec3(0.f); + s.angularErrorScale = 0.f; + } + + } + else + { + const Cm::SpatialVector resp0 = createImpulseResponseVector(c.linear0, c.angular0, eb0); + const Cm::SpatialVector resp1 = createImpulseResponseVector(-c.linear1, -c.angular1, eb1); + + init(s, resp0.linear, -resp1.linear, resp0.angular, -resp1.angular, c.minImpulse * driveScale, c.maxImpulse * driveScale); + SolverConstraint1DExtStep& e = static_cast(s); + + Cm::SpatialVector& delta0 = unsimdRef(e.deltaVA); + Cm::SpatialVector& delta1 = unsimdRef(e.deltaVB); + + unitResponse = getImpulseResponse(eb0, resp0, delta0, prepDesc.invMassScales.linear0, prepDesc.invMassScales.angular0, + eb1, resp1, delta1, prepDesc.invMassScales.linear1, prepDesc.invMassScales.angular1, false); + + //PxReal totalVelChange = (delta0 - delta1).magnitude(); + //PX_UNUSED(totalVelChange); + + if (unitResponse < DY_ARTICULATION_MIN_RESPONSE) + { + continue; + } + else + unitResponse += cfm; + + + + { + vel0 = eb0.projectVelocity(s.lin0, s.ang0); + vel1 = eb1.projectVelocity(s.lin1, s.ang1); + + normalVel = vel0 - vel1; + } + + if (!(c.flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT)) + { + s.angularErrorScale = 0.f; + } + } + + PxReal recipResponse = 0.f; + + PxReal velTarget = 0.f; + if (isKinematic0) + velTarget -= vel0; + if (isKinematic1) + velTarget += vel1; + + setSolverConstantsStep(s.error, s.biasScale, s.velTarget, s.maxBias, s.velMultiplier, recipResponse, c, + normalVel, unitResponse, prepDesc.minResponseThreshold, erp, dt, totalDt, + c.flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT ? angSpeedLimit : linSpeedLimit, recipDt, invTotalDt, + velTarget); + + s.recipResponse = recipResponse; + + + + + + if (c.flags & Px1DConstraintFlag::eOUTPUT_FORCE) + s.flags |= DY_SC_FLAG_OUTPUT_FORCE; + + if ((c.flags & Px1DConstraintFlag::eKEEPBIAS)) + s.flags |= DY_SC_FLAG_KEEP_BIAS; + if (c.solveHint & 1) + s.flags |= DY_SC_FLAG_INEQUALITY; + + if (!(isExtended || prepDesc.disablePreprocessing)) + { + //KS - the code that orthogonalizes constraints on-the-fly only works if the linear and angular constraints have already been pre-orthogonalized + if (c.solveHint == PxConstraintSolveHint::eROTATIONAL_EQUALITY) + { + s.flags |= DY_SC_FLAG_ROT_EQ; + + PX_ASSERT(orthoCount < 3); + + /*angOrtho0[orthoCount] = PxVec3(angSqrtInvInertia0[i].x, angSqrtInvInertia0[i].y, angSqrtInvInertia0[i].z); + angOrtho1[orthoCount] = PxVec3(angSqrtInvInertia1[i].x, angSqrtInvInertia1[i].y, angSqrtInvInertia1[i].z); + recipResponses[orthoCount] = recipResponse;*/ + + header->angOrthoAxis0_recipResponseW[orthoCount] = + PxVec4(angSqrtInvInertia0[i].x*prepDesc.invMassScales.angular0, angSqrtInvInertia0[i].y*prepDesc.invMassScales.angular0, angSqrtInvInertia0[i].z*prepDesc.invMassScales.angular0, recipResponse); + header->angOrthoAxis1_Error[orthoCount].x = angSqrtInvInertia1[i].x*prepDesc.invMassScales.angular1; + header->angOrthoAxis1_Error[orthoCount].y = angSqrtInvInertia1[i].y*prepDesc.invMassScales.angular1; + header->angOrthoAxis1_Error[orthoCount].z = angSqrtInvInertia1[i].z*prepDesc.invMassScales.angular1; + header->angOrthoAxis1_Error[orthoCount].w = c.geometricError; + + orthoCount++; + } + + else if (c.solveHint & PxConstraintSolveHint::eEQUALITY) + s.flags |= DY_SC_FLAG_ORTHO_TARGET; + } + + + + + constraints += stride; + outCount++; + } + + + //KS - we now need to re-set count because we may have skipped degenerate rows when solving articulation constraints. + //In this case, the degenerate rows would have produced no force. Skipping them is just an optimization + header->count = PxU8(outCount); + return prepDesc.numRows; +} + + +PxU32 SetupSolverConstraintStep(SolverConstraintShaderPrepDesc& shaderDesc, + PxTGSSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + const PxReal dt, const PxReal totalDt, const PxReal invdt, const PxReal invTotalDt, + const PxReal lengthScale, const PxReal biasCoefficient) +{ + // LL shouldn't see broken constraints + + PX_ASSERT(!(reinterpret_cast(prepDesc.writeback)->broken)); + + prepDesc.desc->constraintLengthOver16 = 0; + //setConstraintLength(*prepDesc.desc, 0); + + if (!shaderDesc.solverPrep) + return 0; + + //PxU32 numAxisConstraints = 0; + + Px1DConstraint rows[MAX_CONSTRAINT_ROWS]; + setupConstraintRows(rows, MAX_CONSTRAINT_ROWS); + + prepDesc.invMassScales.linear0 = prepDesc.invMassScales.linear1 = prepDesc.invMassScales.angular0 = prepDesc.invMassScales.angular1 = 1.f; + prepDesc.body0WorldOffset = PxVec3(0.0f); + + //TAG:solverprepcall + prepDesc.numRows = prepDesc.disableConstraint ? 0 : (*shaderDesc.solverPrep)(rows, + prepDesc.body0WorldOffset, + MAX_CONSTRAINT_ROWS, + prepDesc.invMassScales, + shaderDesc.constantBlock, + prepDesc.bodyFrame0, prepDesc.bodyFrame1, + prepDesc.extendedLimits, prepDesc.cA2w, prepDesc.cB2w); + + prepDesc.rows = rows; + + if (prepDesc.bodyState0 != PxSolverContactDesc::eARTICULATION && prepDesc.body0->isKinematic) + prepDesc.invMassScales.angular0 = 0.f; + if (prepDesc.bodyState1 != PxSolverContactDesc::eARTICULATION && prepDesc.body1->isKinematic) + prepDesc.invMassScales.angular1 = 0.f; + + return setupSolverConstraintStep(prepDesc, allocator, dt, totalDt, invdt, invTotalDt, lengthScale, biasCoefficient); +} + +void solveExt1D(const PxSolverConstraintDesc& desc, Vec3V& linVel0, Vec3V& linVel1, Vec3V& angVel0, Vec3V& angVel1, + const Vec3V& linMotion0, const Vec3V& linMotion1, const Vec3V& angMotion0, const Vec3V& angMotion1, + const QuatV& rotA, const QuatV& rotB, const PxReal elapsedTimeF32, Vec3V& linImpulse0, Vec3V& linImpulse1, Vec3V& angImpulse0, + Vec3V& angImpulse1) +{ + PxU8* PX_RESTRICT bPtr = desc.constraint; + + const SolverConstraint1DHeaderStep* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DExtStep* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeaderStep)); + + const FloatV elapsedTime = FLoad(elapsedTimeF32); + + const Vec3V raPrev = V3LoadA(header->rAWorld); + const Vec3V rbPrev = V3LoadA(header->rBWorld); + + const Vec3V ra = QuatRotate(rotA, V3LoadA(header->rAWorld)); + const Vec3V rb = QuatRotate(rotB, V3LoadA(header->rBWorld)); + + const Vec3V raMotion = V3Sub(V3Add(ra, linMotion0), raPrev); + const Vec3V rbMotion = V3Sub(V3Add(rb, linMotion1), rbPrev); + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + for (PxU32 i = 0; icount; ++i, base++) + { + PxPrefetchLine(base + 1); + + SolverConstraint1DExtStep& c = *base; + + const Vec3V clinVel0 = V3LoadA(c.lin0); + const Vec3V clinVel1 = V3LoadA(c.lin1); + + const Vec3V cangVel0 = V3LoadA(c.ang0); + const Vec3V cangVel1 = V3LoadA(c.ang1); + + const FloatV recipResponse = FLoad(c.recipResponse); + + const FloatV targetVel = FLoad(c.velTarget); + + const FloatV deltaAng = FMul(FSub(V3Dot(cangVel0, angMotion0), V3Dot(cangVel1, angMotion1)), FLoad(c.angularErrorScale)); + const FloatV errorChange = FNegScaleSub(targetVel, elapsedTime, FAdd(FSub(V3Dot(raMotion, clinVel0), V3Dot(rbMotion, clinVel1)), deltaAng)); + + const FloatV biasScale = FLoad(c.biasScale); + const FloatV maxBias = FLoad(c.maxBias); + + const FloatV vMul = FMul(recipResponse, FLoad(c.velMultiplier)); + const FloatV appliedForce = FLoad(c.appliedForce); + + const FloatV unclampedBias = FScaleAdd(errorChange, biasScale, FLoad(c.error)); + const FloatV minBias = c.flags & DY_SC_FLAG_INEQUALITY ? FNeg(FMax()) : FNeg(maxBias); + const FloatV bias = FClamp(unclampedBias, minBias, maxBias); + + const FloatV constant = FMul(recipResponse, FAdd(bias, targetVel)); + + const FloatV maxImpulse = FLoad(c.maxImpulse); + const FloatV minImpulse = FLoad(c.minImpulse); + + const Vec3V v0 = V3MulAdd(linVel0, clinVel0, V3Mul(angVel0, cangVel0)); + const Vec3V v1 = V3MulAdd(linVel1, clinVel1, V3Mul(angVel1, cangVel1)); + const FloatV normalVel = V3SumElems(V3Sub(v0, v1)); + + const FloatV unclampedForce = FAdd(appliedForce, FScaleAdd(vMul, normalVel, constant)); + const FloatV clampedForce = FMin(maxImpulse, (FMax(minImpulse, unclampedForce))); + const FloatV deltaF = FSub(clampedForce, appliedForce); + + FStore(clampedForce, &c.appliedForce); + + //PX_ASSERT(FAllGrtr(FLoad(1000.f), FAbs(deltaF))); + + FStore(clampedForce, &base->appliedForce); + li0 = V3ScaleAdd(clinVel0, deltaF, li0); ai0 = V3ScaleAdd(cangVel0, deltaF, ai0); + li1 = V3ScaleAdd(clinVel1, deltaF, li1); ai1 = V3ScaleAdd(cangVel1, deltaF, ai1); + + linVel0 = V3ScaleAdd(base->deltaVA.linear, deltaF, linVel0); angVel0 = V3ScaleAdd(base->deltaVA.angular, deltaF, angVel0); + linVel1 = V3ScaleAdd(base->deltaVB.linear, deltaF, linVel1); angVel1 = V3ScaleAdd(base->deltaVB.angular, deltaF, angVel1); + + /*PX_ASSERT(FAllGrtr(FLoad(40.f * 40.f), V3Dot(linVel0, linVel0))); + PX_ASSERT(FAllGrtr(FLoad(40.f * 40.f), V3Dot(linVel1, linVel1))); + PX_ASSERT(FAllGrtr(FLoad(20.f * 20.f), V3Dot(angVel0, angVel0))); + PX_ASSERT(FAllGrtr(FLoad(20.f * 20.f), V3Dot(angVel1, angVel1)));*/ + } + + linImpulse0 = V3Scale(li0, FLoad(header->linearInvMassScale0)); + linImpulse1 = V3Scale(li1, FLoad(header->linearInvMassScale1)); + angImpulse0 = V3Scale(ai0, FLoad(header->angularInvMassScale0)); + angImpulse1 = V3Scale(ai1, FLoad(header->angularInvMassScale1)); +} + +//Port of scalar implementation to SIMD maths with some interleaving of instructions +void solveExt1DStep(const PxSolverConstraintDesc& desc, const PxReal elapsedTimeF32, SolverContext& cache, + const PxTGSSolverBodyTxInertia* const txInertias) +{ + Vec3V linVel0, angVel0, linVel1, angVel1; + Vec3V linMotion0, angMotion0, linMotion1, angMotion1; + + QuatV rotA, rotB; + + Dy::FeatherstoneArticulation* artA = getArticulationA(desc); + Dy::FeatherstoneArticulation* artB = getArticulationB(desc); + + if (artA == artB) + { + Cm::SpatialVectorV v0, v1; + artA->pxcFsGetVelocities(desc.linkIndexA, desc.linkIndexB, v0, v1); + linVel0 = v0.linear; + angVel0 = v0.angular; + linVel1 = v1.linear; + angVel1 = v1.angular; + + const Cm::SpatialVectorV motionV0 = artA->getLinkMotionVector(desc.linkIndexA); //PxcFsGetMotionVector(*artA, desc.linkIndexA); + const Cm::SpatialVectorV motionV1 = artB->getLinkMotionVector(desc.linkIndexB); //PxcFsGetMotionVector(*artB, desc.linkIndexB); + + linMotion0 = motionV0.linear; + angMotion0 = motionV0.angular; + linMotion1 = motionV1.linear; + angMotion1 = motionV1.angular; + + rotA = aos::QuatVLoadU(&artA->getDeltaQ(desc.linkIndexA).x); + rotB = aos::QuatVLoadU(&artB->getDeltaQ(desc.linkIndexB).x); + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.tgsBodyA->linearVelocity); + angVel0 = V3LoadA(desc.tgsBodyA->angularVelocity); + linMotion0 = V3LoadA(desc.tgsBodyA->deltaLinDt); + angMotion0 = V3LoadA(desc.tgsBodyA->deltaAngDt); + rotA = aos::QuatVLoadA(&txInertias[desc.bodyADataIndex].deltaBody2World.q.x); + } + else + { + const Cm::SpatialVectorV v = artA->pxcFsGetVelocity(desc.linkIndexA); + rotA = aos::QuatVLoadU(&artA->getDeltaQ(desc.linkIndexA).x); + const Cm::SpatialVectorV motionV = artA->getLinkMotionVector(desc.linkIndexA);//PxcFsGetMotionVector(*artA, desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + + linMotion0 = motionV.linear; + angMotion0 = motionV.angular; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.tgsBodyB->linearVelocity); + angVel1 = V3LoadA(desc.tgsBodyB->angularVelocity); + linMotion1 = V3LoadA(desc.tgsBodyB->deltaLinDt); + angMotion1 = V3LoadA(desc.tgsBodyB->deltaAngDt); + rotB = aos::QuatVLoadA(&txInertias[desc.bodyBDataIndex].deltaBody2World.q.x); + } + else + { + Cm::SpatialVectorV v = artB->pxcFsGetVelocity(desc.linkIndexB); + rotB = aos::QuatVLoadU(&artB->getDeltaQ(desc.linkIndexB).x); + Cm::SpatialVectorV motionV = artB->getLinkMotionVector(desc.linkIndexB);// PxcFsGetMotionVector(*artB, desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + + linMotion1 = motionV.linear; + angMotion1 = motionV.angular; + } + } + + Vec3V li0, li1, ai0, ai1; + + solveExt1D(desc, linVel0, linVel1, angVel0, angVel1, linMotion0, linMotion1, angMotion0, angMotion1, rotA, rotB, elapsedTimeF32, li0, li1, ai0, ai1); + + if (artA == artB) + { + artA->pxcFsApplyImpulses(desc.linkIndexA, li0, + ai0, desc.linkIndexB, li1, + ai1, cache.Z, cache.deltaV); + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.tgsBodyA->linearVelocity); + V3StoreA(angVel0, desc.tgsBodyA->angularVelocity); + } + else + { + artA->pxcFsApplyImpulse(desc.linkIndexA, li0, ai0, cache.Z, cache.deltaV); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.tgsBodyB->linearVelocity); + V3StoreA(angVel1, desc.tgsBodyB->angularVelocity); + } + else + { + artB->pxcFsApplyImpulse(desc.linkIndexB, li1, ai1, cache.Z, cache.deltaV); + } + } +} + + + + +//Port of scalar implementation to SIMD maths with some interleaving of instructions +void solve1DStep(const PxSolverConstraintDesc& desc, const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime) +{ + PxU8* PX_RESTRICT bPtr = desc.constraint; + if (bPtr == NULL) + return; + + PxTGSSolverBodyVel& b0 = *desc.tgsBodyA; + PxTGSSolverBodyVel& b1 = *desc.tgsBodyB; + + const FloatV elapsed = FLoad(elapsedTime); + + const PxTGSSolverBodyTxInertia& txI0 = txInertias[desc.bodyADataIndex]; + const PxTGSSolverBodyTxInertia& txI1 = txInertias[desc.bodyBDataIndex]; + + const SolverConstraint1DHeaderStep* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DStep* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeaderStep)); + + Vec3V linVel0 = V3LoadA(b0.linearVelocity); + Vec3V linVel1 = V3LoadA(b1.linearVelocity); + Vec3V angState0 = V3LoadA(b0.angularVelocity); + Vec3V angState1 = V3LoadA(b1.angularVelocity); + + Mat33V sqrtInvInertia0 = Mat33V(V3LoadU(txI0.sqrtInvInertia.column0), V3LoadU(txI0.sqrtInvInertia.column1), V3LoadU(txI0.sqrtInvInertia.column2)); + Mat33V sqrtInvInertia1 = Mat33V(V3LoadU(txI1.sqrtInvInertia.column0), V3LoadU(txI1.sqrtInvInertia.column1), V3LoadU(txI1.sqrtInvInertia.column2)); + + const FloatV invMass0 = FLoad(header->invMass0D0); + const FloatV invMass1 = FLoad(header->invMass1D1); + const FloatV invInertiaScale0 = FLoad(header->angularInvMassScale0); + const FloatV invInertiaScale1 = FLoad(header->angularInvMassScale1); + + const QuatV deltaRotA = aos::QuatVLoadA(&txI0.deltaBody2World.q.x); + const QuatV deltaRotB = aos::QuatVLoadA(&txI1.deltaBody2World.q.x); + + const Vec3V raPrev = V3LoadA(header->rAWorld); + const Vec3V rbPrev = V3LoadA(header->rBWorld); + + const Vec3V ra = QuatRotate(deltaRotA, raPrev); + const Vec3V rb = QuatRotate(deltaRotB, rbPrev); + + const Vec3V ang0 = V3LoadA(b0.deltaAngDt); + const Vec3V ang1 = V3LoadA(b1.deltaAngDt); + + const Vec3V lin0 = V3LoadA(b0.deltaLinDt); + const Vec3V lin1 = V3LoadA(b1.deltaLinDt); + + const Vec3V raMotion = V3Sub(V3Add(ra, lin0), raPrev); + const Vec3V rbMotion = V3Sub(V3Add(rb, lin1), rbPrev); + + const VecCrossV raCross = V3PrepareCross(ra); + const VecCrossV rbCross = V3PrepareCross(rb); + + const Vec4V ang0Ortho0_recipResponseW = V4LoadA(&header->angOrthoAxis0_recipResponseW[0].x); + const Vec4V ang0Ortho1_recipResponseW = V4LoadA(&header->angOrthoAxis0_recipResponseW[1].x); + const Vec4V ang0Ortho2_recipResponseW = V4LoadA(&header->angOrthoAxis0_recipResponseW[2].x); + + const Vec4V ang1Ortho0_Error0 = V4LoadA(&header->angOrthoAxis1_Error[0].x); + const Vec4V ang1Ortho1_Error1 = V4LoadA(&header->angOrthoAxis1_Error[1].x); + const Vec4V ang1Ortho2_Error2 = V4LoadA(&header->angOrthoAxis1_Error[2].x); + + const FloatV recipResponse0 = V4GetW(ang0Ortho0_recipResponseW); + const FloatV recipResponse1 = V4GetW(ang0Ortho1_recipResponseW); + const FloatV recipResponse2 = V4GetW(ang0Ortho2_recipResponseW); + + const Vec3V ang0Ortho0 = Vec3V_From_Vec4V(ang0Ortho0_recipResponseW); + const Vec3V ang0Ortho1 = Vec3V_From_Vec4V(ang0Ortho1_recipResponseW); + const Vec3V ang0Ortho2 = Vec3V_From_Vec4V(ang0Ortho2_recipResponseW); + + const Vec3V ang1Ortho0 = Vec3V_From_Vec4V(ang1Ortho0_Error0); + const Vec3V ang1Ortho1 = Vec3V_From_Vec4V(ang1Ortho1_Error1); + const Vec3V ang1Ortho2 = Vec3V_From_Vec4V(ang1Ortho2_Error2); + + FloatV error0 = FAdd(V4GetW(ang1Ortho0_Error0), FSub(V3Dot(ang0Ortho0, ang0), V3Dot(ang1Ortho0, ang1))); + FloatV error1 = FAdd(V4GetW(ang1Ortho1_Error1), FSub(V3Dot(ang0Ortho1, ang0), V3Dot(ang1Ortho1, ang1))); + FloatV error2 = FAdd(V4GetW(ang1Ortho2_Error2), FSub(V3Dot(ang0Ortho2, ang0), V3Dot(ang1Ortho2, ang1))); + + for (PxU32 i = 0; icount; ++i, base++) + { + PxPrefetchLine(base + 1); + SolverConstraint1DStep& c = *base; + + const Vec3V clinVel0 = V3LoadA(c.lin0); + const Vec3V clinVel1 = V3LoadA(c.lin1); + + const Vec3V cangVel0_ = V3LoadA(c.ang0); + const Vec3V cangVel1_ = V3LoadA(c.ang1); + + const FloatV angularErrorScale = FLoad(c.angularErrorScale); + + const FloatV biasScale = FLoad(c.biasScale); + const FloatV maxBias = FLoad(c.maxBias); + const FloatV targetVel = FLoad(c.velTarget); + const FloatV appliedForce = FLoad(c.appliedForce); + const FloatV velMultiplier = FLoad(c.velMultiplier); + + const FloatV maxImpulse = FLoad(c.maxImpulse); + const FloatV minImpulse = FLoad(c.minImpulse); + + Vec3V cangVel0 = V3Add(cangVel0_, V3Cross(raCross, clinVel0)); + Vec3V cangVel1 = V3Add(cangVel1_, V3Cross(rbCross, clinVel1)); + + FloatV error = FLoad(c.error); + + const FloatV minBias = (c.flags & DY_SC_FLAG_INEQUALITY) ? FNeg(FMax()) : FNeg(maxBias); + + Vec3V raXnI = M33MulV3(sqrtInvInertia0, cangVel0); + Vec3V rbXnI = M33MulV3(sqrtInvInertia1, cangVel1); + + if (c.flags & DY_SC_FLAG_ORTHO_TARGET) + { + //Re-orthogonalize the constraints before velocity projection and impulse response calculation + //Can be done in using instruction parallelism because angular locked axes are orthogonal to linear axes! + + const FloatV proj0 = FMul(V3SumElems(V3MulAdd(raXnI, ang0Ortho0, + V3Mul(rbXnI, ang1Ortho0))), recipResponse0); + + const FloatV proj1 = FMul(V3SumElems(V3MulAdd(raXnI, ang0Ortho1, + V3Mul(rbXnI, ang1Ortho1))), recipResponse1); + const FloatV proj2 = FMul(V3SumElems(V3MulAdd(raXnI, ang0Ortho2, + V3Mul(rbXnI, ang1Ortho2))), recipResponse2); + + const Vec3V delta0 = V3ScaleAdd(ang0Ortho0, proj0, V3ScaleAdd(ang0Ortho1, proj1, V3Scale(ang0Ortho2, proj2))); + const Vec3V delta1 = V3ScaleAdd(ang1Ortho0, proj0, V3ScaleAdd(ang1Ortho1, proj1, V3Scale(ang1Ortho2, proj2))); + + raXnI = V3Sub(raXnI, delta0); + rbXnI = V3Sub(rbXnI, delta1); + + error = FSub(error, FScaleAdd(error0, proj0, FScaleAdd(error1, proj1, FMul(error2, proj2)))); + } + + const FloatV deltaAng = FMul(angularErrorScale, FSub(V3Dot(raXnI, ang0), V3Dot(rbXnI, ang1))); + + FloatV errorChange = FNegScaleSub(targetVel, elapsed, FAdd(FSub(V3Dot(raMotion, clinVel0), V3Dot(rbMotion, clinVel1)), deltaAng)); + + const FloatV resp0 = FScaleAdd(invMass0, V3Dot(clinVel0, clinVel0), V3SumElems(V3Mul(V3Scale(raXnI, invInertiaScale0), raXnI))); + const FloatV resp1 = FSub(FMul(invMass1, V3Dot(clinVel1, clinVel1)), V3SumElems(V3Mul(V3Scale(rbXnI, invInertiaScale1), rbXnI))); + + const FloatV response = FAdd(resp0, resp1); + const FloatV recipResponse = FSel(FIsGrtr(response, FZero()), FRecip(response), FZero()); + + const FloatV vMul = FMul(recipResponse, velMultiplier); + + const FloatV unclampedBias = FScaleAdd(errorChange, biasScale, error); + const FloatV bias = FClamp(unclampedBias, minBias, maxBias); + + const FloatV constant = FMul(recipResponse, FAdd(bias, targetVel)); + + const Vec3V v0 = V3MulAdd(linVel0, clinVel0, V3Mul(angState0, raXnI)); + const Vec3V v1 = V3MulAdd(linVel1, clinVel1, V3Mul(angState1, rbXnI)); + const FloatV normalVel = V3SumElems(V3Sub(v0, v1)); + + const FloatV unclampedForce = FAdd(appliedForce, FScaleAdd(vMul, normalVel, constant)); + const FloatV clampedForce = FClamp(unclampedForce, minImpulse, maxImpulse); + const FloatV deltaF = FSub(clampedForce, appliedForce); + + FStore(clampedForce, &c.appliedForce); + linVel0 = V3ScaleAdd(clinVel0, FMul(deltaF, invMass0), linVel0); + linVel1 = V3NegScaleSub(clinVel1, FMul(deltaF, invMass1), linVel1); + angState0 = V3ScaleAdd(raXnI, FMul(deltaF, invInertiaScale0), angState0); + angState1 = V3ScaleAdd(rbXnI, FMul(deltaF, invInertiaScale1), angState1); + } + + V3StoreA(linVel0, b0.linearVelocity); + V3StoreA(angState0, b0.angularVelocity); + V3StoreA(linVel1, b1.linearVelocity); + V3StoreA(angState1, b1.angularVelocity); + + PX_ASSERT(b0.linearVelocity.isFinite()); + PX_ASSERT(b0.angularVelocity.isFinite()); + PX_ASSERT(b1.linearVelocity.isFinite()); + PX_ASSERT(b1.angularVelocity.isFinite()); +} + + +//Port of scalar implementation to SIMD maths with some interleaving of instructions +void conclude1DStep(const PxSolverConstraintDesc& desc) +{ + PxU8* PX_RESTRICT bPtr = desc.constraint; + if (bPtr == NULL) + return; + + const SolverConstraint1DHeaderStep* PX_RESTRICT header = reinterpret_cast(bPtr); + PxU8* PX_RESTRICT base = bPtr + sizeof(SolverConstraint1DHeaderStep); + const PxU32 stride = header->type == DY_SC_TYPE_RB_1D ? sizeof(SolverConstraint1DStep) : sizeof(SolverConstraint1DExtStep); + + for (PxU32 i = 0; icount; ++i, base+=stride) + { + SolverConstraint1DStep& c = *reinterpret_cast(base); + PxPrefetchLine(&c + 1); + if (!(c.flags & DY_SC_FLAG_KEEP_BIAS)) + { + c.biasScale = 0.f; + c.error = 0.f; + } + } +} + +void concludeContact(const PxSolverConstraintDesc& desc) +{ + PX_UNUSED(desc); + //const PxU8* PX_RESTRICT last = desc.constraint + getConstraintLength(desc); + + ////hopefully pointer aliasing doesn't bite. + //PxU8* PX_RESTRICT currPtr = desc.constraint; + + //SolverContactHeaderStep* PX_RESTRICT firstHdr = reinterpret_cast(currPtr); + + //bool isExtended = firstHdr->type == DY_SC_TYPE_EXT_CONTACT; + + //const PxU32 contactStride = isExtended ? sizeof(SolverContactPointStepExt) : sizeof(SolverContactPointStep); + //const PxU32 frictionStride = isExtended ? sizeof(SolverContactFrictionStepExt) : sizeof(SolverContactFrictionStep); + + + //while (currPtr < last) + //{ + // SolverContactHeaderStep* PX_RESTRICT hdr = reinterpret_cast(currPtr); + // currPtr += sizeof(SolverContactHeaderStep); + + // const PxU32 numNormalConstr = hdr->numNormalConstr; + // const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + // /*PxU8* PX_RESTRICT contacts = currPtr; + // prefetchLine(contacts);*/ + // currPtr += numNormalConstr * contactStride; + + // //PxF32* forceBuffer = reinterpret_cast(currPtr); + // currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + // PxU8* PX_RESTRICT frictions = currPtr; + // currPtr += numFrictionConstr * frictionStride; + + // /*for (PxU32 i = 0; i < numNormalConstr; ++i) + // { + // SolverContactPointStep& c = *reinterpret_cast(contacts); + // contacts += contactStride; + // if(c.separation <= 0.f) + // c.biasCoefficient = 0.f; + // }*/ + + // for (PxU32 i = 0; i < numFrictionConstr; ++i) + // { + // SolverContactFrictionStep& f = *reinterpret_cast(frictions); + // frictions += frictionStride; + // f.biasScale = 0.f; + // } + //} + + //PX_ASSERT(currPtr == last); +} + + + + +void writeBack1D(const PxSolverConstraintDesc& desc) +{ + ConstraintWriteback* writeback = reinterpret_cast(desc.writeBack); + if (writeback) + { + SolverConstraint1DHeaderStep* header = reinterpret_cast(desc.constraint); + PxU8* base = desc.constraint + sizeof(SolverConstraint1DHeaderStep); + PxU32 stride = header->type == DY_SC_TYPE_EXT_1D ? sizeof(SolverConstraint1DExtStep) : sizeof(SolverConstraint1DStep); + + PxVec3 lin(0), ang(0); + for (PxU32 i = 0; icount; i++) + { + const SolverConstraint1DStep* c = reinterpret_cast(base); + if (c->flags & DY_SC_FLAG_OUTPUT_FORCE) + { + lin += c->lin0 * c->appliedForce; + ang += (c->ang0 + c->lin0.cross(header->rAWorld)) * c->appliedForce; + } + base += stride; + } + + ang -= header->body0WorldOffset.cross(lin); + writeback->linearImpulse = lin; + writeback->angularImpulse = ang; + writeback->broken = header->breakable ? PxU32(lin.magnitude()>header->linBreakImpulse || ang.magnitude()>header->angBreakImpulse) : 0; + + //KS - the amount of memory we allocated may now be significantly larger than the number of constraint rows. This is because + //we discard degenerate rows in the articulation constraint prep code. + //PX_ASSERT(desc.constraint + (desc.constraintLengthOver16 * 16) == base); + } +} + +static FloatV solveExtContactsStep(SolverContactPointStepExt* contacts, const PxU32 nbContactPoints, const Vec3VArg contactNormal, + Vec3V& linVel0, Vec3V& angVel0, + Vec3V& linVel1, Vec3V& angVel1, + Vec3V& li0, Vec3V& ai0, + Vec3V& li1, Vec3V& ai1, + const Vec3V& linDeltaA, const Vec3V& linDeltaB, const Vec3V& angDeltaA, const Vec3V angDeltaB, const FloatV& maxPenBias, + PxF32* PX_RESTRICT appliedForceBuffer, + const FloatV& minPen, + const FloatV& elapsedTime) +{ + PX_UNUSED(elapsedTime); + const FloatV deltaV = V3Dot(contactNormal, V3Sub(linDeltaA, linDeltaB)); + + FloatV accumulatedNormalImpulse = FZero(); + for (PxU32 i = 0; i(currPtr); + currPtr += sizeof(SolverContactHeaderStep); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + SolverContactPointStepExt* PX_RESTRICT contacts = reinterpret_cast(currPtr); + PxPrefetchLine(contacts); + currPtr += numNormalConstr * sizeof(SolverContactPointStepExt); + + PxF32* appliedForceBuffer = reinterpret_cast(currPtr); + currPtr += sizeof(PxF32) * ((numNormalConstr + 3) & (~3)); + + SolverContactFrictionStepExt* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionStepExt); + + Vec3V li0 = V3Zero(), li1 = V3Zero(), ai0 = V3Zero(), ai1 = V3Zero(); + + const Vec3V contactNormal = V3LoadA(hdr->normal); + + const FloatV accumulatedNormalImpulse = FMax(solveExtContactsStep(contacts, numNormalConstr, contactNormal, linVel0, angVel0, linVel1, + angVel1, li0, ai0, li1, ai1, linDelta0, linDelta1, angDelta0, angDelta1, FLoad(hdr->maxPenBias), appliedForceBuffer, minPen, elapsedTime), + FLoad(hdr->minNormalForce)); + + if (numFrictionConstr) + { + PxPrefetchLine(frictions); + const FloatV maxFrictionImpulse = FMul(hdr->getStaticFriction(), accumulatedNormalImpulse); + const FloatV maxDynFrictionImpulse = FMul(hdr->getDynamicFriction(), accumulatedNormalImpulse); + + BoolV broken = BFFFF(); + + const PxU32 numFrictionPairs = numFrictionConstr &6; + + for (PxU32 i = 0; i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse0 = FNegScaleSub(normalVel0, velMultiplier0, tmp10); + const FloatV totalImpulse1 = FNegScaleSub(normalVel1, velMultiplier1, tmp11); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const FloatV totalImpulse = FSqrt(FAdd(FMul(totalImpulse0, totalImpulse0), FMul(totalImpulse1, totalImpulse1))); + + const BoolV clamp = FIsGrtr(totalImpulse, FMul(maxFrictionImpulse, frictionScale)); + + const FloatV totalClamped = FSel(clamp, FMin(FMul(maxDynFrictionImpulse, frictionScale), totalImpulse), totalImpulse); + + const FloatV ratio = FSel(FIsGrtr(totalImpulse, zero), FDiv(totalClamped, totalImpulse), zero); + + const FloatV newAppliedForce0 = FMul(ratio, totalImpulse0); + const FloatV newAppliedForce1 = FMul(ratio, totalImpulse1); + + broken = BOr(broken, clamp); + + const FloatV deltaF0 = FSub(newAppliedForce0, appliedForce0); + const FloatV deltaF1 = FSub(newAppliedForce1, appliedForce1); + + linVel0 = V3ScaleAdd(f0.linDeltaVA, deltaF0, V3ScaleAdd(f1.linDeltaVA, deltaF1, linVel0)); + angVel0 = V3ScaleAdd(raXnI0, deltaF0, V3ScaleAdd(raXnI1, deltaF1, angVel0)); + linVel1 = V3ScaleAdd(f0.linDeltaVB, deltaF0, V3ScaleAdd(f1.linDeltaVB, deltaF1, linVel1)); + angVel1 = V3ScaleAdd(rbXnI0, deltaF0, V3ScaleAdd(rbXnI1, deltaF1, angVel1)); + + /*PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel0, linVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel1, linVel1))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel0, angVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel1, angVel1)));*/ + + li0 = V3ScaleAdd(normal0, deltaF0, V3ScaleAdd(normal1, deltaF1, li0)); + ai0 = V3ScaleAdd(raXn0, deltaF0, V3ScaleAdd(raXn1, deltaF1, ai0)); + li1 = V3ScaleAdd(normal0, deltaF0, V3ScaleAdd(normal1, deltaF1, li1)); + ai1 = V3ScaleAdd(rbXn0, deltaF0, V3ScaleAdd(rbXn1, deltaF1, ai1)); + + f0.setAppliedForce(newAppliedForce0); + f1.setAppliedForce(newAppliedForce1); + } + + for (PxU32 i = numFrictionPairs; i maxFrictionImpulse + // clamp newAppliedForce + deltaF to [-maxDynFrictionImpulse, maxDynFrictionImpulse] + // (i.e. clamp deltaF to [-maxDynFrictionImpulse-appliedForce, maxDynFrictionImpulse-appliedForce] + // set broken flag to true || broken flag + + // FloatV deltaF = FMul(FAdd(bias, normalVel), minusVelMultiplier); + // FloatV potentialSumF = FAdd(appliedForce, deltaF); + + const FloatV totalImpulse = FNegScaleSub(normalVel, velMultiplier, tmp1); + + // On XBox this clamping code uses the vector simple pipe rather than vector float, + // which eliminates a lot of stall cycles + + const BoolV clamp = FIsGrtr(FAbs(totalImpulse), FMul(maxFrictionImpulse, frictionScale)); + + const FloatV totalClamped = FMin(FMul(maxDynFrictionImpulse, frictionScale), FMax(FMul(negMaxDynFrictionImpulse, frictionScale), totalImpulse)); + + const FloatV newAppliedForce = FSel(clamp, totalClamped, totalImpulse); + + broken = BOr(broken, clamp); + + FloatV deltaF = FSub(newAppliedForce, appliedForce); + + linVel0 = V3ScaleAdd(f.linDeltaVA, deltaF, linVel0); + angVel0 = V3ScaleAdd(raXnI, deltaF, angVel0); + linVel1 = V3ScaleAdd(f.linDeltaVB, deltaF, linVel1); + angVel1 = V3ScaleAdd(rbXnI, deltaF, angVel1); + + /*PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel0, linVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel1, linVel1))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel0, angVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel1, angVel1)));*/ + + ai0 = V3ScaleAdd(raXn, deltaF, ai0); + ai1 = V3ScaleAdd(rbXn, deltaF, ai1); + + f.setAppliedForce(newAppliedForce); + } + Store_From_BoolV(broken, &hdr->broken); + } + + linImpulse0 = V3ScaleAdd(li0, hdr->getDominance0(), linImpulse0); + angImpulse0 = V3ScaleAdd(ai0, FLoad(hdr->angDom0), angImpulse0); + linImpulse1 = V3NegScaleSub(li1, hdr->getDominance1(), linImpulse1); + angImpulse1 = V3NegScaleSub(ai1, FLoad(hdr->angDom1), angImpulse1); + } + + PX_ASSERT(currPtr == last); +} + + +void solveExtContactStep(const PxSolverConstraintDesc& desc, bool doFriction, const PxReal minPenetration, + const PxReal elapsedTimeF32, SolverContext& cache) +{ + Vec3V linVel0, angVel0, linVel1, angVel1; + Vec3V linDelta0, angDelta0, linDelta1, angDelta1; + + Dy::FeatherstoneArticulation* artA = getArticulationA(desc); + Dy::FeatherstoneArticulation* artB = getArticulationB(desc); + + if (artA == artB) + { + Cm::SpatialVectorV v0, v1; + artA->pxcFsGetVelocities(desc.linkIndexA, desc.linkIndexB, v0, v1); + linVel0 = v0.linear; + angVel0 = v0.angular; + linVel1 = v1.linear; + angVel1 = v1.angular; + + Cm::SpatialVectorV motionV0 = artA->getLinkMotionVector(desc.linkIndexA);// PxcFsGetMotionVector(*artA, desc.linkIndexA); + Cm::SpatialVectorV motionV1 = artB->getLinkMotionVector(desc.linkIndexB);// PxcFsGetMotionVector(*artB, desc.linkIndexB); + + linDelta0 = motionV0.linear; + angDelta0 = motionV0.angular; + linDelta1 = motionV1.linear; + angDelta1 = motionV1.angular; + } + else + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + linVel0 = V3LoadA(desc.tgsBodyA->linearVelocity); + angVel0 = V3LoadA(desc.tgsBodyA->angularVelocity); + linDelta0 = V3LoadA(desc.tgsBodyA->deltaLinDt); + angDelta0 = V3LoadA(desc.tgsBodyA->deltaAngDt); + } + else + { + Cm::SpatialVectorV v = artA->pxcFsGetVelocity(desc.linkIndexA); + Cm::SpatialVectorV deltaV = artA->getLinkMotionVector(desc.linkIndexA);// PxcFsGetMotionVector(*artA, desc.linkIndexA); + linVel0 = v.linear; + angVel0 = v.angular; + linDelta0 = deltaV.linear; + angDelta0 = deltaV.angular; + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + linVel1 = V3LoadA(desc.tgsBodyB->linearVelocity); + angVel1 = V3LoadA(desc.tgsBodyB->angularVelocity); + linDelta1 = V3LoadA(desc.tgsBodyB->deltaLinDt); + angDelta1 = V3LoadA(desc.tgsBodyB->deltaAngDt); + } + else + { + Cm::SpatialVectorV v = artB->pxcFsGetVelocity(desc.linkIndexB); + Cm::SpatialVectorV deltaV = artB->getLinkMotionVector(desc.linkIndexB);// PxcFsGetMotionVector(*artB, desc.linkIndexB); + linVel1 = v.linear; + angVel1 = v.angular; + linDelta1 = deltaV.linear; + angDelta1 = deltaV.angular; + } + } + + /*PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel0, linVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(linVel1, linVel1))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel0, angVel0))); + PX_ASSERT(FAllGrtr(FLoad(100.f * 100.f), V3Dot(angVel1, angVel1)));*/ + + Vec3V linImpulse0 = V3Zero(), linImpulse1 = V3Zero(), angImpulse0 = V3Zero(), angImpulse1 = V3Zero(); + + + solveExtContactStep(desc, linVel0, linVel1, angVel0, angVel1, linDelta0, linDelta1, angDelta0, angDelta1, linImpulse0, linImpulse1, angImpulse0, + angImpulse1, doFriction, minPenetration, elapsedTimeF32); + + if (artA == artB) + { + artA->pxcFsApplyImpulses(desc.linkIndexA, + linImpulse0, angImpulse0, desc.linkIndexB, linImpulse1, angImpulse1, cache.Z, cache.deltaV); + } + else + { + + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel0, desc.tgsBodyA->linearVelocity); + V3StoreA(angVel0, desc.tgsBodyA->angularVelocity); + } + else + { + artA->pxcFsApplyImpulse(desc.linkIndexA, linImpulse0, angImpulse0, cache.Z, cache.deltaV); + } + + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + { + V3StoreA(linVel1, desc.tgsBodyB->linearVelocity); + V3StoreA(angVel1, desc.tgsBodyB->angularVelocity); + } + else + { + artB->pxcFsApplyImpulse(desc.linkIndexB, linImpulse1, angImpulse1, cache.Z, cache.deltaV); + } + } +} + +void solveContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const /*txInertias*/, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveContact(desc[i], true, minPenetration, elapsedTime); + } +} + +void solve1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal /*minPenetration*/, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solve1DStep(desc[i], txInertias, elapsedTime); + } +} + +void solveExtContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const /*txInertias*/, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveExtContactStep(desc[i], true, minPenetration, elapsedTime, cache); + } +} + +void solveExt1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal /*minPenetration*/, const PxReal elapsedTime, SolverContext& cache) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveExt1DStep(desc[i], elapsedTime, cache, txInertias); + } +} + +void writeBackContact(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, SolverContext* cache) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + writeBackContact(desc[i], cache); + } +} + +void writeBack1D(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, SolverContext* /*cache*/) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + writeBack1D(desc[i]); + } +} + +void solveConclude1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solve1DStep(desc[i], txInertias, elapsedTime); + conclude1DStep(desc[i]); + } +} + +void solveConclude1DBlockExt(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveExt1DStep(desc[i], elapsedTime, cache, txInertias); + conclude1DStep(desc[i]); + } +} + + +void solveConcludeContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const /*txInertias*/, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveContact(desc[i], true, -PX_MAX_F32, elapsedTime); + concludeContact(desc[i]); + } +} + +void solveConcludeContactExtBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const /*txInertias*/, const PxReal elapsedTime, SolverContext& cache) +{ + for (PxU32 i = hdr.startIndex, endIdx = hdr.startIndex + hdr.stride; i < endIdx; ++i) + { + solveExtContactStep(desc[i], true, -PX_MAX_F32, elapsedTime, cache); + concludeContact(desc[i]); + } +} + + +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.h new file mode 100644 index 0000000..d1573f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrep.h @@ -0,0 +1,150 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_TGS_CONTACT_PREP_H +#define DY_TGS_CONTACT_PREP_H + +#include "foundation/PxPreprocessor.h" +#include "DySolverConstraintDesc.h" +#include "PxSceneDesc.h" +#include "DySolverContact4.h" + +namespace physx +{ + + struct PxcNpWorkUnit; + class PxsConstraintBlockManager; + class PxcConstraintBlockStream; + struct PxsContactManagerOutput; + class FrictionPatchStreamPair; + struct PxSolverBody; + struct PxSolverBodyData; + struct PxSolverConstraintDesc; + class PxsContactManager; + + namespace Dy + { + class ThreadContext; + struct CorrelationBuffer; + + bool createFinalizeSolverContactsStep(PxTGSSolverContactDesc& contactDesc, + PxsContactManagerOutput& output, + ThreadContext& threadContext, + const PxReal invDtF32, + const PxReal invTotalDtF32, + const PxReal totalDtF32, + const PxReal stepDt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator); + + bool createFinalizeSolverContactsStep( + PxTGSSolverContactDesc& contactDesc, + CorrelationBuffer& c, + const PxReal invDtF32, + const PxReal invTotalDtF32, + const PxReal totalDtF32, + const PxReal dtF32, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator); + + SolverConstraintPrepState::Enum setupSolverConstraintStep4 + (PxTGSSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal totalDt, const PxReal recipdt, const PxReal recipTotalDt, PxU32& totalRows, + PxConstraintAllocator& allocator, PxU32 maxRows, + const PxReal lengthScale, const PxReal biasCoefficient); + + PxU32 SetupSolverConstraintStep(SolverConstraintShaderPrepDesc& shaderDesc, + PxTGSSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + const PxReal dt, const PxReal totalDt, const PxReal invdt, const PxReal invTotalDt, + const PxReal lengthScale, const PxReal biasCoefficient); + + PxU32 setupSolverConstraintStep( + const PxTGSSolverConstraintPrepDesc& prepDesc, + PxConstraintAllocator& allocator, + const PxReal dt, const PxReal totalDt, const PxReal invdt, const PxReal invTotalDt, + const PxReal lengthScale, const PxReal biasCoefficient); + + SolverConstraintPrepState::Enum setupSolverConstraintStep4 + (SolverConstraintShaderPrepDesc* PX_RESTRICT constraintShaderDescs, + PxTGSSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal totalDt, const PxReal recipdt, const PxReal recipTotalDt, PxU32& totalRows, + PxConstraintAllocator& allocator, const PxReal lengthScale, const PxReal biasCoefficient); + + SolverConstraintPrepState::Enum createFinalizeSolverContacts4Step( + PxsContactManagerOutput** cmOutputs, + ThreadContext& threadContext, + PxTGSSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal totalDtF32, + const PxReal invTotalDtF32, + const PxReal dt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator); + + SolverConstraintPrepState::Enum createFinalizeSolverContacts4Step( + Dy::CorrelationBuffer& c, + PxTGSSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal totalDt, + const PxReal invTotalDtF32, + const PxReal dt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator); + + typedef void(*TGSSolveBlockMethod) (const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + + typedef void (*TGSWriteBackMethod) (const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, SolverContext* cache); + + typedef void (*TGSSolveConcludeMethod) (const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + + extern TGSSolveBlockMethod g_SolveTGSMethods[]; + + extern TGSWriteBackMethod g_WritebackTGSMethods[]; + + extern TGSSolveConcludeMethod g_SolveConcludeTGSMethods[]; + + } + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp new file mode 100644 index 0000000..1cd0eb3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSContactPrepBlock.cpp @@ -0,0 +1,3667 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxVecMath.h" +#include "PxcNpWorkUnit.h" +#include "PxcNpContactPrepShared.h" +#include "DyTGSDynamics.h" + +using namespace physx; +using namespace Gu; + +#include "PxsMaterialManager.h" +#include "DyContactPrepShared.h" +#include "DyConstraintPrep.h" + +namespace physx +{ +namespace Dy +{ + + inline bool ValidateVec4(const Vec4V v) + { + PX_ALIGN(16, PxVec4 vF); + aos::V4StoreA(v, &vF.x); + return vF.isFinite(); + } + + PX_FORCE_INLINE void QuatRotate4(const Vec4VArg qx, const Vec4VArg qy, const Vec4VArg qz, const Vec4VArg qw, const Vec4VArg vx, const Vec4VArg vy, const Vec4VArg vz, + Vec4V& rX, Vec4V& rY, Vec4V& rZ) + { + /* + const PxVec3 qv(x,y,z); + return (v*(w*w-0.5f) + (qv.cross(v))*w + qv*(qv.dot(v)))*2; + */ + + const Vec4V two = V4Splat(FLoad(2.f)); + const Vec4V nhalf = V4Splat(FLoad(-0.5f)); + const Vec4V w2 = V4MulAdd(qw, qw, nhalf); + const Vec4V ax = V4Mul(vx, w2); + const Vec4V ay = V4Mul(vy, w2); + const Vec4V az = V4Mul(vz, w2); + + const Vec4V crX = V4NegMulSub(qz, vy, V4Mul(qy, vz)); + const Vec4V crY = V4NegMulSub(qx, vz, V4Mul(qz, vx)); + const Vec4V crZ = V4NegMulSub(qy, vx, V4Mul(qx, vy)); + + const Vec4V tempX = V4MulAdd(crX, qw, ax); + const Vec4V tempY = V4MulAdd(crY, qw, ay); + const Vec4V tempZ = V4MulAdd(crZ, qw, az); + + Vec4V dotuv = V4Mul(qx, vx); + dotuv = V4MulAdd(qy, vy, dotuv); + dotuv = V4MulAdd(qz, vz, dotuv); + + rX = V4Mul(V4MulAdd(qx, dotuv, tempX), two); + rY = V4Mul(V4MulAdd(qy, dotuv, tempY), two); + rZ = V4Mul(V4MulAdd(qz, dotuv, tempZ), two); + } + + +struct SolverContactHeaderStepBlock +{ + enum + { + eHAS_MAX_IMPULSE = 1 << 0, + eHAS_TARGET_VELOCITY = 1 << 1 + }; + + PxU8 type; //Note: mType should be first as the solver expects a type in the first byte. + PxU8 numNormalConstr; + PxU8 numFrictionConstr; + PxU8 flag; + + PxU8 flags[4]; + + //KS - used for write-back only + PxU8 numNormalConstrs[4]; + PxU8 numFrictionConstrs[4]; + + //Vec4V restitution; + Vec4V staticFriction; + Vec4V dynamicFriction; + //Technically, these mass properties could be pulled out into a new structure and shared. For multi-manifold contacts, + //this would save 64 bytes per-manifold after the cost of the first manifold + Vec4V invMass0D0; + Vec4V invMass1D1; + Vec4V angDom0; + Vec4V angDom1; + //Normal is shared between all contacts in the batch. This will save some memory! + Vec4V normalX; + Vec4V normalY; + Vec4V normalZ; + + Vec4V maxPenBias; + + Sc::ShapeInteraction* shapeInteraction[4]; //192 or 208 + + BoolV broken; + PxU8* frictionBrokenWritebackByte[4]; +}; + +struct SolverContactPointStepBlock +{ + Vec4V raXnI[3]; + Vec4V rbXnI[3]; + Vec4V separation; + Vec4V velMultiplier; + Vec4V targetVelocity; + Vec4V biasCoefficient; + Vec4V recipResponse; +}; + +//KS - technically, this friction constraint has identical data to the above contact constraint. +//We make them separate structs for clarity +struct SolverContactFrictionStepBlock +{ + Vec4V normal[3]; + Vec4V raXnI[3]; + Vec4V rbXnI[3]; + Vec4V error; + Vec4V velMultiplier; + Vec4V targetVel; + Vec4V biasCoefficient; +}; + +struct SolverConstraint1DHeaderStep4 +{ + PxU8 type; // enum SolverConstraintType - must be first byte + PxU8 pad0[3]; + //These counts are the max of the 4 sets of data. + //When certain pairs have fewer constraints than others, they are padded with 0s so that no work is performed but + //calculations are still shared (afterall, they're computationally free because we're doing 4 things at a time in SIMD) + PxU32 count; + PxU8 counts[4]; + PxU8 breakable[4]; + + Vec4V linBreakImpulse; + Vec4V angBreakImpulse; + Vec4V invMass0D0; + Vec4V invMass1D1; + Vec4V angD0; + Vec4V angD1; + + Vec4V body0WorkOffset[3]; + Vec4V rAWorld[3]; + Vec4V rBWorld[3]; + + Vec4V angOrthoAxis0X[3]; + Vec4V angOrthoAxis0Y[3]; + Vec4V angOrthoAxis0Z[3]; + Vec4V angOrthoAxis1X[3]; + Vec4V angOrthoAxis1Y[3]; + Vec4V angOrthoAxis1Z[3]; + Vec4V angOrthoRecipResponse[3]; + Vec4V angOrthoError[3]; +}; + +PX_ALIGN_PREFIX(16) +struct SolverConstraint1DStep4 +{ +public: + Vec4V lin0[3]; //!< linear velocity projection (body 0) + Vec4V error; //!< constraint error term - must be scaled by biasScale. Can be adjusted at run-time + + Vec4V lin1[3]; //!< linear velocity projection (body 1) + Vec4V biasScale; //!< constraint constant bias scale. Constant + + Vec4V ang0[3]; //!< angular velocity projection (body 0) + Vec4V velMultiplier; //!< constraint velocity multiplier + + Vec4V ang1[3]; //!< angular velocity projection (body 1) + + Vec4V velTarget; //!< Scaled target velocity of the constraint drive + + Vec4V minImpulse; //!< Lower bound on impulse magnitude + Vec4V maxImpulse; //!< Upper bound on impulse magnitude + Vec4V appliedForce; //!< applied force to correct velocity+bias + + Vec4V maxBias; + Vec4V angularErrorScale; //Constant + PxU32 flags[4]; +} PX_ALIGN_SUFFIX(16); + +static void setupFinalizeSolverConstraints4Step(PxTGSSolverContactDesc* PX_RESTRICT descs, CorrelationBuffer& c, + PxU8* PX_RESTRICT workspace, const PxReal invDtF32, const PxReal totalDtF32, const PxReal invTotalDtF32, + const PxReal dtF32, PxReal bounceThresholdF32, const PxReal biasCoefficient, + const aos::Vec4VArg invMassScale0, const aos::Vec4VArg invInertiaScale0, + const aos::Vec4VArg invMassScale1, const aos::Vec4VArg invInertiaScale1) +{ + //OK, we have a workspace of pre-allocated space to store all 4 descs in. We now need to create the constraints in it + + //const Vec4V ccdMaxSeparation = aos::V4LoadXYZW(descs[0].maxCCDSeparation, descs[1].maxCCDSeparation, descs[2].maxCCDSeparation, descs[3].maxCCDSeparation); + const Vec4V solverOffsetSlop = aos::V4LoadXYZW(descs[0].offsetSlop, descs[1].offsetSlop, descs[2].offsetSlop, descs[3].offsetSlop); + + const Vec4V zero = V4Zero(); + const BoolV bFalse = BFFFF(); + const FloatV fZero = FZero(); + + PxU8 flags[4] = { PxU8(descs[0].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[1].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[2].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0), + PxU8(descs[3].hasForceThresholds ? SolverContactHeader::eHAS_FORCE_THRESHOLDS : 0) }; + + bool hasMaxImpulse = descs[0].hasMaxImpulse || descs[1].hasMaxImpulse || descs[2].hasMaxImpulse || descs[3].hasMaxImpulse; + + //The block is dynamic if **any** of the constraints have a non-static body B. This allows us to batch static and non-static constraints but we only get a memory/perf + //saving if all 4 are static. This simplifies the constraint partitioning such that it only needs to care about separating contacts and 1D constraints (which it already does) + bool isDynamic = false; + bool hasKinematic = false; + + PxReal kinematicScale0F32[4]; + PxReal kinematicScale1F32[4]; + + for (PxU32 a = 0; a < 4; ++a) + { + isDynamic = isDynamic || (descs[a].bodyState1 == PxSolverContactDesc::eDYNAMIC_BODY); + hasKinematic = hasKinematic || descs[a].bodyState1 == PxSolverContactDesc::eKINEMATIC_BODY; + kinematicScale0F32[a] = descs[a].body0->isKinematic ? 1.f : 0.f; + kinematicScale1F32[a] = descs[a].body1->isKinematic ? 1.f : 0.f; + } + + /*BoolV kinematic0 = BLoad(isKinematic0); + BoolV kinematic1 = BLoad(isKinematic1);*/ + + const Vec4V kinematicScale0 = V4LoadU(kinematicScale0F32); + const Vec4V kinematicScale1 = V4LoadU(kinematicScale1F32); + + const PxU32 constraintSize = sizeof(SolverContactPointStepBlock); + const PxU32 frictionSize = sizeof(SolverContactFrictionStepBlock); + + PxU8* PX_RESTRICT ptr = workspace; + + const Vec4V dom0 = invMassScale0; + const Vec4V dom1 = invMassScale1; + const Vec4V angDom0 = invInertiaScale0; + const Vec4V angDom1 = invInertiaScale1; + + const Vec4V maxPenBias = V4Max(V4LoadXYZW(descs[0].bodyData0->penBiasClamp, descs[1].bodyData0->penBiasClamp, + descs[2].bodyData0->penBiasClamp, descs[3].bodyData0->penBiasClamp), + V4LoadXYZW(descs[0].bodyData1->penBiasClamp, descs[1].bodyData1->penBiasClamp, + descs[2].bodyData1->penBiasClamp, descs[3].bodyData1->penBiasClamp)); + + const Vec4V restDistance = V4LoadXYZW(descs[0].restDistance, descs[1].restDistance, descs[2].restDistance, + descs[3].restDistance); + + + //load up velocities + Vec4V linVel00 = V4LoadA(&descs[0].bodyData0->originalLinearVelocity.x); + Vec4V linVel10 = V4LoadA(&descs[1].bodyData0->originalLinearVelocity.x); + Vec4V linVel20 = V4LoadA(&descs[2].bodyData0->originalLinearVelocity.x); + Vec4V linVel30 = V4LoadA(&descs[3].bodyData0->originalLinearVelocity.x); + + Vec4V linVel01 = V4LoadA(&descs[0].bodyData1->originalLinearVelocity.x); + Vec4V linVel11 = V4LoadA(&descs[1].bodyData1->originalLinearVelocity.x); + Vec4V linVel21 = V4LoadA(&descs[2].bodyData1->originalLinearVelocity.x); + Vec4V linVel31 = V4LoadA(&descs[3].bodyData1->originalLinearVelocity.x); + + Vec4V angVel00 = V4LoadA(&descs[0].bodyData0->originalAngularVelocity.x); + Vec4V angVel10 = V4LoadA(&descs[1].bodyData0->originalAngularVelocity.x); + Vec4V angVel20 = V4LoadA(&descs[2].bodyData0->originalAngularVelocity.x); + Vec4V angVel30 = V4LoadA(&descs[3].bodyData0->originalAngularVelocity.x); + + Vec4V angVel01 = V4LoadA(&descs[0].bodyData1->originalAngularVelocity.x); + Vec4V angVel11 = V4LoadA(&descs[1].bodyData1->originalAngularVelocity.x); + Vec4V angVel21 = V4LoadA(&descs[2].bodyData1->originalAngularVelocity.x); + Vec4V angVel31 = V4LoadA(&descs[3].bodyData1->originalAngularVelocity.x); + + Vec4V linVelT00, linVelT10, linVelT20; + Vec4V linVelT01, linVelT11, linVelT21; + Vec4V angVelT00, angVelT10, angVelT20; + Vec4V angVelT01, angVelT11, angVelT21; + + PX_TRANSPOSE_44_34(linVel00, linVel10, linVel20, linVel30, linVelT00, linVelT10, linVelT20); + PX_TRANSPOSE_44_34(linVel01, linVel11, linVel21, linVel31, linVelT01, linVelT11, linVelT21); + PX_TRANSPOSE_44_34(angVel00, angVel10, angVel20, angVel30, angVelT00, angVelT10, angVelT20); + PX_TRANSPOSE_44_34(angVel01, angVel11, angVel21, angVel31, angVelT01, angVelT11, angVelT21); + + const Vec4V vrelX = V4Sub(linVelT00, linVelT01); + const Vec4V vrelY = V4Sub(linVelT10, linVelT11); + const Vec4V vrelZ = V4Sub(linVelT20, linVelT21); + + //Load up masses and invInertia + + const Vec4V invMass0 = V4LoadXYZW(descs[0].bodyData0->invMass, descs[1].bodyData0->invMass, descs[2].bodyData0->invMass, descs[3].bodyData0->invMass); + const Vec4V invMass1 = V4LoadXYZW(descs[0].bodyData1->invMass, descs[1].bodyData1->invMass, descs[2].bodyData1->invMass, descs[3].bodyData1->invMass); + + const Vec4V invMass0D0 = V4Mul(dom0, invMass0); + const Vec4V invMass1D1 = V4Mul(dom1, invMass1); + + Vec4V invInertia00X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].body0TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia00Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].body0TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia00Z = Vec4V_From_Vec3V(V3LoadU(descs[0].body0TxI->sqrtInvInertia.column2)); + + Vec4V invInertia10X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].body0TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia10Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].body0TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia10Z = Vec4V_From_Vec3V(V3LoadU(descs[1].body0TxI->sqrtInvInertia.column2)); + + Vec4V invInertia20X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].body0TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia20Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].body0TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia20Z = Vec4V_From_Vec3V(V3LoadU(descs[2].body0TxI->sqrtInvInertia.column2)); + + Vec4V invInertia30X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].body0TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia30Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].body0TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia30Z = Vec4V_From_Vec3V(V3LoadU(descs[3].body0TxI->sqrtInvInertia.column2)); + + Vec4V invInertia01X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].body1TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia01Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[0].body1TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia01Z = Vec4V_From_Vec3V(V3LoadU(descs[0].body1TxI->sqrtInvInertia.column2)); + + Vec4V invInertia11X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].body1TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia11Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[1].body1TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia11Z = Vec4V_From_Vec3V(V3LoadU(descs[1].body1TxI->sqrtInvInertia.column2)); + + Vec4V invInertia21X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].body1TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia21Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[2].body1TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia21Z = Vec4V_From_Vec3V(V3LoadU(descs[2].body1TxI->sqrtInvInertia.column2)); + + Vec4V invInertia31X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].body1TxI->sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia31Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(descs[3].body1TxI->sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia31Z = Vec4V_From_Vec3V(V3LoadU(descs[3].body1TxI->sqrtInvInertia.column2)); + + Vec4V invInertia0X0, invInertia0X1, invInertia0X2; + Vec4V invInertia0Y0, invInertia0Y1, invInertia0Y2; + Vec4V invInertia0Z0, invInertia0Z1, invInertia0Z2; + + Vec4V invInertia1X0, invInertia1X1, invInertia1X2; + Vec4V invInertia1Y0, invInertia1Y1, invInertia1Y2; + Vec4V invInertia1Z0, invInertia1Z1, invInertia1Z2; + + PX_TRANSPOSE_44_34(invInertia00X, invInertia10X, invInertia20X, invInertia30X, invInertia0X0, invInertia0Y0, invInertia0Z0); + PX_TRANSPOSE_44_34(invInertia00Y, invInertia10Y, invInertia20Y, invInertia30Y, invInertia0X1, invInertia0Y1, invInertia0Z1); + PX_TRANSPOSE_44_34(invInertia00Z, invInertia10Z, invInertia20Z, invInertia30Z, invInertia0X2, invInertia0Y2, invInertia0Z2); + + PX_TRANSPOSE_44_34(invInertia01X, invInertia11X, invInertia21X, invInertia31X, invInertia1X0, invInertia1Y0, invInertia1Z0); + PX_TRANSPOSE_44_34(invInertia01Y, invInertia11Y, invInertia21Y, invInertia31Y, invInertia1X1, invInertia1Y1, invInertia1Z1); + PX_TRANSPOSE_44_34(invInertia01Z, invInertia11Z, invInertia21Z, invInertia31Z, invInertia1X2, invInertia1Y2, invInertia1Z2); + + + const FloatV invDt = FLoad(invDtF32); + const PxReal scale = PxMin(0.8f, biasCoefficient); + + const FloatV p8 = FLoad(scale); + const FloatV frictionBiasScale = FMul(invDt, p8); + const Vec4V totalDt = V4Load(totalDtF32); + const FloatV invTotalDt = FLoad(invTotalDtF32); + + const Vec4V p84 = V4Splat(p8); + const Vec4V bounceThreshold = V4Splat(FLoad(bounceThresholdF32)); + + const Vec4V invDtp8 = V4Splat(FMul(invDt, p8)); + + const Vec3V bodyFrame00p = V3LoadU(descs[0].bodyFrame0.p); + const Vec3V bodyFrame01p = V3LoadU(descs[1].bodyFrame0.p); + const Vec3V bodyFrame02p = V3LoadU(descs[2].bodyFrame0.p); + const Vec3V bodyFrame03p = V3LoadU(descs[3].bodyFrame0.p); + + const FloatV dt = FLoad(dtF32); + + Vec4V bodyFrame00p4 = Vec4V_From_Vec3V(bodyFrame00p); + Vec4V bodyFrame01p4 = Vec4V_From_Vec3V(bodyFrame01p); + Vec4V bodyFrame02p4 = Vec4V_From_Vec3V(bodyFrame02p); + Vec4V bodyFrame03p4 = Vec4V_From_Vec3V(bodyFrame03p); + + Vec4V bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ; + PX_TRANSPOSE_44_34(bodyFrame00p4, bodyFrame01p4, bodyFrame02p4, bodyFrame03p4, bodyFrame0pX, bodyFrame0pY, bodyFrame0pZ); + + + const Vec3V bodyFrame10p = V3LoadU(descs[0].bodyFrame1.p); + const Vec3V bodyFrame11p = V3LoadU(descs[1].bodyFrame1.p); + const Vec3V bodyFrame12p = V3LoadU(descs[2].bodyFrame1.p); + const Vec3V bodyFrame13p = V3LoadU(descs[3].bodyFrame1.p); + + Vec4V bodyFrame10p4 = Vec4V_From_Vec3V(bodyFrame10p); + Vec4V bodyFrame11p4 = Vec4V_From_Vec3V(bodyFrame11p); + Vec4V bodyFrame12p4 = Vec4V_From_Vec3V(bodyFrame12p); + Vec4V bodyFrame13p4 = Vec4V_From_Vec3V(bodyFrame13p); + + Vec4V bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ; + PX_TRANSPOSE_44_34(bodyFrame10p4, bodyFrame11p4, bodyFrame12p4, bodyFrame13p4, bodyFrame1pX, bodyFrame1pY, bodyFrame1pZ); + + + const QuatV bodyFrame00q = QuatVLoadU(&descs[0].bodyFrame0.q.x); + const QuatV bodyFrame01q = QuatVLoadU(&descs[1].bodyFrame0.q.x); + const QuatV bodyFrame02q = QuatVLoadU(&descs[2].bodyFrame0.q.x); + const QuatV bodyFrame03q = QuatVLoadU(&descs[3].bodyFrame0.q.x); + + const QuatV bodyFrame10q = QuatVLoadU(&descs[0].bodyFrame1.q.x); + const QuatV bodyFrame11q = QuatVLoadU(&descs[1].bodyFrame1.q.x); + const QuatV bodyFrame12q = QuatVLoadU(&descs[2].bodyFrame1.q.x); + const QuatV bodyFrame13q = QuatVLoadU(&descs[3].bodyFrame1.q.x); + + PxU32 frictionPatchWritebackAddrIndex0 = 0; + PxU32 frictionPatchWritebackAddrIndex1 = 0; + PxU32 frictionPatchWritebackAddrIndex2 = 0; + PxU32 frictionPatchWritebackAddrIndex3 = 0; + + PxPrefetchLine(c.contactID); + PxPrefetchLine(c.contactID, 128); + + PxU32 frictionIndex0 = 0, frictionIndex1 = 0, frictionIndex2 = 0, frictionIndex3 = 0; + //PxU32 contactIndex0 = 0, contactIndex1 = 0, contactIndex2 = 0, contactIndex3 = 0; + + + //OK, we iterate through all friction patch counts in the constraint patch, building up the constraint list etc. + + PxU32 maxPatches = PxMax(descs[0].numFrictionPatches, PxMax(descs[1].numFrictionPatches, PxMax(descs[2].numFrictionPatches, descs[3].numFrictionPatches))); + + const Vec4V p1 = V4Splat(FLoad(0.0001f)); + const Vec4V orthoThreshold = V4Splat(FLoad(0.70710678f)); + + + PxU32 contact0 = 0, contact1 = 0, contact2 = 0, contact3 = 0; + PxU32 patch0 = 0, patch1 = 0, patch2 = 0, patch3 = 0; + + PxU8 flag = 0; + if (hasMaxImpulse) + flag |= SolverContactHeader4::eHAS_MAX_IMPULSE; + + bool hasFinished[4]; + + for (PxU32 i = 0; i= descs[0].numFrictionPatches; + hasFinished[1] = i >= descs[1].numFrictionPatches; + hasFinished[2] = i >= descs[2].numFrictionPatches; + hasFinished[3] = i >= descs[3].numFrictionPatches; + + + frictionIndex0 = hasFinished[0] ? frictionIndex0 : descs[0].startFrictionPatchIndex + i; + frictionIndex1 = hasFinished[1] ? frictionIndex1 : descs[1].startFrictionPatchIndex + i; + frictionIndex2 = hasFinished[2] ? frictionIndex2 : descs[2].startFrictionPatchIndex + i; + frictionIndex3 = hasFinished[3] ? frictionIndex3 : descs[3].startFrictionPatchIndex + i; + + PxU32 clampedContacts0 = hasFinished[0] ? 0 : c.frictionPatchContactCounts[frictionIndex0]; + PxU32 clampedContacts1 = hasFinished[1] ? 0 : c.frictionPatchContactCounts[frictionIndex1]; + PxU32 clampedContacts2 = hasFinished[2] ? 0 : c.frictionPatchContactCounts[frictionIndex2]; + PxU32 clampedContacts3 = hasFinished[3] ? 0 : c.frictionPatchContactCounts[frictionIndex3]; + + PxU32 firstPatch0 = c.correlationListHeads[frictionIndex0]; + PxU32 firstPatch1 = c.correlationListHeads[frictionIndex1]; + PxU32 firstPatch2 = c.correlationListHeads[frictionIndex2]; + PxU32 firstPatch3 = c.correlationListHeads[frictionIndex3]; + + const PxContactPoint* contactBase0 = descs[0].contacts + c.contactPatches[firstPatch0].start; + const PxContactPoint* contactBase1 = descs[1].contacts + c.contactPatches[firstPatch1].start; + const PxContactPoint* contactBase2 = descs[2].contacts + c.contactPatches[firstPatch2].start; + const PxContactPoint* contactBase3 = descs[3].contacts + c.contactPatches[firstPatch3].start; + + const Vec4V restitution = V4Neg(V4LoadXYZW(contactBase0->restitution, contactBase1->restitution, contactBase2->restitution, + contactBase3->restitution)); + const Vec4V damping = V4LoadXYZW(contactBase0->damping, contactBase1->damping, contactBase2->damping, contactBase3->damping); + + SolverContactHeaderStepBlock* PX_RESTRICT header = reinterpret_cast(ptr); + ptr += sizeof(SolverContactHeaderStepBlock); + + + header->flags[0] = flags[0]; + header->flags[1] = flags[1]; + header->flags[2] = flags[2]; + header->flags[3] = flags[3]; + + header->flag = flag; + + PxU32 totalContacts = PxMax(clampedContacts0, PxMax(clampedContacts1, PxMax(clampedContacts2, clampedContacts3))); + + Vec4V* PX_RESTRICT appliedNormalForces = reinterpret_cast(ptr); + ptr += sizeof(Vec4V)*totalContacts; + + PxMemZero(appliedNormalForces, sizeof(Vec4V) * totalContacts); + + header->numNormalConstr = PxTo8(totalContacts); + header->numNormalConstrs[0] = PxTo8(clampedContacts0); + header->numNormalConstrs[1] = PxTo8(clampedContacts1); + header->numNormalConstrs[2] = PxTo8(clampedContacts2); + header->numNormalConstrs[3] = PxTo8(clampedContacts3); + //header->sqrtInvMassA = sqrtInvMass0; + //header->sqrtInvMassB = sqrtInvMass1; + header->invMass0D0 = invMass0D0; + header->invMass1D1 = invMass1D1; + header->angDom0 = angDom0; + header->angDom1 = angDom1; + header->shapeInteraction[0] = getInteraction(descs[0]); header->shapeInteraction[1] = getInteraction(descs[1]); + header->shapeInteraction[2] = getInteraction(descs[2]); header->shapeInteraction[3] = getInteraction(descs[3]); + + Vec4V* maxImpulse = reinterpret_cast(ptr + constraintSize * totalContacts); + + //header->restitution = restitution; + + Vec4V normal0 = V4LoadA(&contactBase0->normal.x); + Vec4V normal1 = V4LoadA(&contactBase1->normal.x); + Vec4V normal2 = V4LoadA(&contactBase2->normal.x); + Vec4V normal3 = V4LoadA(&contactBase3->normal.x); + + Vec4V normalX, normalY, normalZ; + PX_TRANSPOSE_44_34(normal0, normal1, normal2, normal3, normalX, normalY, normalZ); + + PX_ASSERT(ValidateVec4(normalX)); + PX_ASSERT(ValidateVec4(normalY)); + PX_ASSERT(ValidateVec4(normalZ)); + + header->normalX = normalX; + header->normalY = normalY; + header->normalZ = normalZ; + + header->maxPenBias = maxPenBias; + + const Vec4V norVel0 = V4MulAdd(normalZ, linVelT20, V4MulAdd(normalY, linVelT10, V4Mul(normalX, linVelT00))); + const Vec4V norVel1 = V4MulAdd(normalZ, linVelT21, V4MulAdd(normalY, linVelT11, V4Mul(normalX, linVelT01))); + const Vec4V relNorVel = V4Sub(norVel0, norVel1); + + //For all correlation heads - need to pull this out I think + + //OK, we have a counter for all our patches... + PxU32 finished = (PxU32(hasFinished[0])) | + ((PxU32(hasFinished[1])) << 1) | + ((PxU32(hasFinished[2])) << 2) | + ((PxU32(hasFinished[3])) << 3); + + CorrelationListIterator iter0(c, firstPatch0); + CorrelationListIterator iter1(c, firstPatch1); + CorrelationListIterator iter2(c, firstPatch2); + CorrelationListIterator iter3(c, firstPatch3); + + //PxU32 contact0, contact1, contact2, contact3; + //PxU32 patch0, patch1, patch2, patch3; + + if (!hasFinished[0]) + iter0.nextContact(patch0, contact0); + if (!hasFinished[1]) + iter1.nextContact(patch1, contact1); + if (!hasFinished[2]) + iter2.nextContact(patch2, contact2); + if (!hasFinished[3]) + iter3.nextContact(patch3, contact3); + + PxU8* p = ptr; + + PxU32 contactCount = 0; + PxU32 newFinished = + (PxU32(hasFinished[0] || !iter0.hasNextContact())) | + ((PxU32(hasFinished[1] || !iter1.hasNextContact())) << 1) | + ((PxU32(hasFinished[2] || !iter2.hasNextContact())) << 2) | + ((PxU32(hasFinished[3] || !iter3.hasNextContact())) << 3); + + BoolV bFinished = BLoad(hasFinished); + + while (finished != 0xf) + { + finished = newFinished; + ++contactCount; + PxPrefetchLine(p, 384); + PxPrefetchLine(p, 512); + PxPrefetchLine(p, 640); + + SolverContactPointStepBlock* PX_RESTRICT solverContact = reinterpret_cast(p); + p += constraintSize; + + const PxContactPoint& con0 = descs[0].contacts[c.contactPatches[patch0].start + contact0]; + const PxContactPoint& con1 = descs[1].contacts[c.contactPatches[patch1].start + contact1]; + const PxContactPoint& con2 = descs[2].contacts[c.contactPatches[patch2].start + contact2]; + const PxContactPoint& con3 = descs[3].contacts[c.contactPatches[patch3].start + contact3]; + + //Now we need to splice these 4 contacts into a single structure + + { + Vec4V point0 = V4LoadA(&con0.point.x); + Vec4V point1 = V4LoadA(&con1.point.x); + Vec4V point2 = V4LoadA(&con2.point.x); + Vec4V point3 = V4LoadA(&con3.point.x); + + Vec4V pointX, pointY, pointZ; + PX_TRANSPOSE_44_34(point0, point1, point2, point3, pointX, pointY, pointZ); + + Vec4V cTargetVel0 = V4LoadA(&con0.targetVel.x); + Vec4V cTargetVel1 = V4LoadA(&con1.targetVel.x); + Vec4V cTargetVel2 = V4LoadA(&con2.targetVel.x); + Vec4V cTargetVel3 = V4LoadA(&con3.targetVel.x); + + Vec4V cTargetVelX, cTargetVelY, cTargetVelZ; + PX_TRANSPOSE_44_34(cTargetVel0, cTargetVel1, cTargetVel2, cTargetVel3, cTargetVelX, cTargetVelY, cTargetVelZ); + + const Vec4V separation = V4LoadXYZW(con0.separation, con1.separation, con2.separation, con3.separation); + + const Vec4V cTargetNorVel = V4MulAdd(cTargetVelX, normalX, V4MulAdd(cTargetVelY, normalY, V4Mul(cTargetVelZ, normalZ))); + + const Vec4V raX = V4Sub(pointX, bodyFrame0pX); + const Vec4V raY = V4Sub(pointY, bodyFrame0pY); + const Vec4V raZ = V4Sub(pointZ, bodyFrame0pZ); + + const Vec4V rbX = V4Sub(pointX, bodyFrame1pX); + const Vec4V rbY = V4Sub(pointY, bodyFrame1pY); + const Vec4V rbZ = V4Sub(pointZ, bodyFrame1pZ); + + /*raX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raX)), zero, raX); + raY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raY)), zero, raY); + raZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raZ)), zero, raZ); + + rbX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbX)), zero, rbX); + rbY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbY)), zero, rbY); + rbZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbZ)), zero, rbZ);*/ + + PX_ASSERT(ValidateVec4(raX)); + PX_ASSERT(ValidateVec4(raY)); + PX_ASSERT(ValidateVec4(raZ)); + + PX_ASSERT(ValidateVec4(rbX)); + PX_ASSERT(ValidateVec4(rbY)); + PX_ASSERT(ValidateVec4(rbZ)); + + + //raXn = cross(ra, normal) which = Vec3V( a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x); + + Vec4V raXnX = V4NegMulSub(raZ, normalY, V4Mul(raY, normalZ)); + Vec4V raXnY = V4NegMulSub(raX, normalZ, V4Mul(raZ, normalX)); + Vec4V raXnZ = V4NegMulSub(raY, normalX, V4Mul(raX, normalY)); + + Vec4V rbXnX = V4NegMulSub(rbZ, normalY, V4Mul(rbY, normalZ)); + Vec4V rbXnY = V4NegMulSub(rbX, normalZ, V4Mul(rbZ, normalX)); + Vec4V rbXnZ = V4NegMulSub(rbY, normalX, V4Mul(rbX, normalY)); + + + const Vec4V relAngVel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4Mul(raXnX, angVelT00))); + const Vec4V relAngVel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4Mul(rbXnX, angVelT01))); + + const Vec4V relAng = V4Sub(relAngVel0, relAngVel1); + + const Vec4V slop = V4Mul(solverOffsetSlop, V4Max(V4Sel(V4IsEq(relNorVel, zero), V4Splat(FMax()), V4Div(relAng, relNorVel)), V4One())); + + raXnX = V4Sel(V4IsGrtr(slop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(slop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(slop, V4Abs(raXnZ)), zero, raXnZ); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + + + + PX_ASSERT(ValidateVec4(delAngVel0X)); + PX_ASSERT(ValidateVec4(delAngVel0Y)); + PX_ASSERT(ValidateVec4(delAngVel0Z)); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0X, delAngVel0X, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0Z, delAngVel0Z))); + + + Vec4V unitResponse = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + Vec4V vrel0 = V4Add(norVel0, relAngVel0); + Vec4V vrel1 = V4Add(norVel1, relAngVel1); + + Vec4V delAngVel1X = zero; + Vec4V delAngVel1Y = zero; + Vec4V delAngVel1Z = zero; + + //The dynamic-only parts - need to if-statement these up. A branch here shouldn't cost us too much + if (isDynamic) + { + + + rbXnX = V4Sel(V4IsGrtr(slop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(slop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(slop, V4Abs(rbXnZ)), zero, rbXnZ); + + delAngVel1X = V4Mul(invInertia1X0, rbXnX); + delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + PX_ASSERT(ValidateVec4(delAngVel1X)); + PX_ASSERT(ValidateVec4(delAngVel1Y)); + PX_ASSERT(ValidateVec4(delAngVel1Z)); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1X, delAngVel1X, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1Z, delAngVel1Z))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + unitResponse = V4Add(unitResponse, resp1); + } + + Vec4V vrel = V4Sub(vrel0, vrel1); + + solverContact->rbXnI[0] = delAngVel1X; + solverContact->rbXnI[1] = delAngVel1Y; + solverContact->rbXnI[2] = delAngVel1Z; + + + Vec4V penetration = V4Sub(separation, restDistance); + + const Vec4V penetrationInvDt = V4Scale(penetration, invTotalDt); + + const BoolV isGreater2 = BAnd(BAnd(V4IsGrtr(zero, restitution), V4IsGrtr(bounceThreshold, vrel)), + V4IsGrtr(V4Neg(vrel), penetrationInvDt)); + + const Vec4V ratio = V4Sel(isGreater2, V4Add(totalDt, V4Div(penetration, vrel)), zero); + + const Vec4V recipResponse = V4Sel(V4IsGrtr(unitResponse, zero), V4Recip(unitResponse), zero); + + //Restitution is negated in the block setup code + const BoolV isCompliant = V4IsGrtr(restitution, zero); + const Vec4V rdt = V4Scale(restitution, dt); + const Vec4V a = V4Scale(V4Add(damping, rdt), dt); + const Vec4V x = V4Recip(V4MulAdd(a, unitResponse, V4One())); + const Vec4V velMultiplier = V4Sel(isCompliant, V4Mul(x, a), recipResponse); + + const Vec4V scaledBias = V4Neg(V4Sel(isCompliant, V4Mul(rdt, V4Mul(x, unitResponse)), V4Sel(V4IsGrtr(penetration, zero), V4Splat(invDt), invDtp8))); + + Vec4V targetVelocity = V4NegMulSub(vrel0, kinematicScale0, V4MulAdd(vrel1, kinematicScale1, V4Sel(isGreater2, V4Mul(vrel, restitution), zero))); + + penetration = V4MulAdd(targetVelocity, ratio, penetration); + + + + + + //Vec4V biasedErr = V4Sel(isGreater2, targetVelocity, scaledBias); + //Vec4V biasedErr = V4Add(targetVelocity, scaledBias); + + //biasedErr = V4NegMulSub(V4Sub(vrel, cTargetNorVel), velMultiplier, biasedErr); + + //These values are present for static and dynamic contacts + solverContact->raXnI[0] = delAngVel0X; + solverContact->raXnI[1] = delAngVel0Y; + solverContact->raXnI[2] = delAngVel0Z; + solverContact->velMultiplier = V4Sel(bFinished, zero, velMultiplier); + solverContact->targetVelocity = V4Add(cTargetNorVel, targetVelocity); + solverContact->separation = penetration; + solverContact->biasCoefficient = V4Sel(bFinished, zero, scaledBias); + solverContact->recipResponse = V4Sel(bFinished, zero, recipResponse); + + if (hasMaxImpulse) + { + maxImpulse[contactCount - 1] = V4Merge(FLoad(con0.maxImpulse), FLoad(con1.maxImpulse), FLoad(con2.maxImpulse), + FLoad(con3.maxImpulse)); + } + } + if (!(finished & 0x1)) + { + iter0.nextContact(patch0, contact0); + newFinished |= PxU32(!iter0.hasNextContact()); + } + else + bFinished = BSetX(bFinished, bFalse); + + if (!(finished & 0x2)) + { + iter1.nextContact(patch1, contact1); + newFinished |= (PxU32(!iter1.hasNextContact()) << 1); + } + else + bFinished = BSetY(bFinished, bFalse); + + if (!(finished & 0x4)) + { + iter2.nextContact(patch2, contact2); + newFinished |= (PxU32(!iter2.hasNextContact()) << 2); + } + else + bFinished = BSetZ(bFinished, bFalse); + + if (!(finished & 0x8)) + { + iter3.nextContact(patch3, contact3); + newFinished |= (PxU32(!iter3.hasNextContact()) << 3); + } + else + bFinished = BSetW(bFinished, bFalse); + } + ptr = p; + if (hasMaxImpulse) + { + ptr += sizeof(Vec4V) * totalContacts; + } + + //OK...friction time :-) + + Vec4V maxImpulseScale = V4One(); + { + + const FrictionPatch& frictionPatch0 = c.frictionPatches[frictionIndex0]; + const FrictionPatch& frictionPatch1 = c.frictionPatches[frictionIndex1]; + const FrictionPatch& frictionPatch2 = c.frictionPatches[frictionIndex2]; + const FrictionPatch& frictionPatch3 = c.frictionPatches[frictionIndex3]; + + PxU32 anchorCount0 = frictionPatch0.anchorCount; + PxU32 anchorCount1 = frictionPatch1.anchorCount; + PxU32 anchorCount2 = frictionPatch2.anchorCount; + PxU32 anchorCount3 = frictionPatch3.anchorCount; + + PxU32 clampedAnchorCount0 = hasFinished[0] || (contactBase0->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount0; + PxU32 clampedAnchorCount1 = hasFinished[1] || (contactBase1->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount1; + PxU32 clampedAnchorCount2 = hasFinished[2] || (contactBase2->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount2; + PxU32 clampedAnchorCount3 = hasFinished[3] || (contactBase3->materialFlags & PxMaterialFlag::eDISABLE_FRICTION) ? 0 : anchorCount3; + + const PxU32 maxAnchorCount = PxMax(clampedAnchorCount0, PxMax(clampedAnchorCount1, PxMax(clampedAnchorCount2, clampedAnchorCount3))); + + PX_ALIGN(16, PxReal staticFriction[4]); + PX_ALIGN(16, PxReal dynamicFriction[4]); + + //for (PxU32 f = 0; f < 4; ++f) + { + PxReal coeff0 = (contactBase0->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && clampedAnchorCount0 == 2) ? 0.5f : 1.f; + PxReal coeff1 = (contactBase1->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && clampedAnchorCount1 == 2) ? 0.5f : 1.f; + PxReal coeff2 = (contactBase2->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && clampedAnchorCount2 == 2) ? 0.5f : 1.f; + PxReal coeff3 = (contactBase3->materialFlags & PxMaterialFlag::eIMPROVED_PATCH_FRICTION && clampedAnchorCount3 == 2) ? 0.5f : 1.f; + + staticFriction[0] = contactBase0->staticFriction * coeff0; + dynamicFriction[0] = contactBase0->dynamicFriction * coeff0; + staticFriction[1] = contactBase1->staticFriction * coeff1; + dynamicFriction[1] = contactBase1->dynamicFriction * coeff1; + staticFriction[2] = contactBase2->staticFriction * coeff2; + dynamicFriction[2] = contactBase2->dynamicFriction * coeff2; + staticFriction[3] = contactBase3->staticFriction * coeff3; + dynamicFriction[3] = contactBase3->dynamicFriction * coeff3; + } + + PX_ASSERT(totalContacts == contactCount); + + header->numFrictionConstr = PxTo8(maxAnchorCount * 2); + header->numFrictionConstrs[0] = PxTo8(clampedAnchorCount0 * 2); + header->numFrictionConstrs[1] = PxTo8(clampedAnchorCount1 * 2); + header->numFrictionConstrs[2] = PxTo8(clampedAnchorCount2 * 2); + header->numFrictionConstrs[3] = PxTo8(clampedAnchorCount3 * 2); + + //KS - TODO - extend this if needed + header->type = PxTo8(DY_SC_TYPE_BLOCK_RB_CONTACT); + + if (maxAnchorCount) + { + const BoolV cond = V4IsGrtr(orthoThreshold, V4Abs(normalX)); + + const Vec4V t0FallbackX = V4Sel(cond, zero, V4Neg(normalY)); + const Vec4V t0FallbackY = V4Sel(cond, V4Neg(normalZ), normalX); + const Vec4V t0FallbackZ = V4Sel(cond, normalY, zero); + + //const Vec4V dotNormalVrel = V4MulAdd(normalZ, vrelZ, V4MulAdd(normalY, vrelY, V4Mul(normalX, vrelX))); + const Vec4V vrelSubNorVelX = V4NegMulSub(normalX, relNorVel, vrelX); + const Vec4V vrelSubNorVelY = V4NegMulSub(normalY, relNorVel, vrelY); + const Vec4V vrelSubNorVelZ = V4NegMulSub(normalZ, relNorVel, vrelZ); + + const Vec4V lenSqvrelSubNorVelZ = V4MulAdd(vrelSubNorVelX, vrelSubNorVelX, V4MulAdd(vrelSubNorVelY, vrelSubNorVelY, V4Mul(vrelSubNorVelZ, vrelSubNorVelZ))); + + const BoolV bcon2 = V4IsGrtr(lenSqvrelSubNorVelZ, p1); + + Vec4V t0X = V4Sel(bcon2, vrelSubNorVelX, t0FallbackX); + Vec4V t0Y = V4Sel(bcon2, vrelSubNorVelY, t0FallbackY); + Vec4V t0Z = V4Sel(bcon2, vrelSubNorVelZ, t0FallbackZ); + + + //Now normalize this... + const Vec4V recipLen = V4Rsqrt(V4MulAdd(t0Z, t0Z, V4MulAdd(t0Y, t0Y, V4Mul(t0X, t0X)))); + + t0X = V4Mul(t0X, recipLen); + t0Y = V4Mul(t0Y, recipLen); + t0Z = V4Mul(t0Z, recipLen); + + Vec4V t1X = V4NegMulSub(normalZ, t0Y, V4Mul(normalY, t0Z)); + Vec4V t1Y = V4NegMulSub(normalX, t0Z, V4Mul(normalZ, t0X)); + Vec4V t1Z = V4NegMulSub(normalY, t0X, V4Mul(normalX, t0Y)); + + PX_ASSERT((uintptr_t(descs[0].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[1].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[2].frictionPtr) & 0xF) == 0); + PX_ASSERT((uintptr_t(descs[3].frictionPtr) & 0xF) == 0); + + + PxU8* PX_RESTRICT writeback0 = descs[0].frictionPtr + frictionPatchWritebackAddrIndex0 * sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback1 = descs[1].frictionPtr + frictionPatchWritebackAddrIndex1 * sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback2 = descs[2].frictionPtr + frictionPatchWritebackAddrIndex2 * sizeof(FrictionPatch); + PxU8* PX_RESTRICT writeback3 = descs[3].frictionPtr + frictionPatchWritebackAddrIndex3 * sizeof(FrictionPatch); + + PxU32 index0 = 0, index1 = 0, index2 = 0, index3 = 0; + + header->broken = bFalse; + header->frictionBrokenWritebackByte[0] = writeback0; + header->frictionBrokenWritebackByte[1] = writeback1; + header->frictionBrokenWritebackByte[2] = writeback2; + header->frictionBrokenWritebackByte[3] = writeback3; + + + /*header->frictionNormal[0][0] = t0X; + header->frictionNormal[0][1] = t0Y; + header->frictionNormal[0][2] = t0Z; + + header->frictionNormal[1][0] = t1X; + header->frictionNormal[1][1] = t1Y; + header->frictionNormal[1][2] = t1Z;*/ + + Vec4V* PX_RESTRICT appliedForces = reinterpret_cast(ptr); + ptr += sizeof(Vec4V)*header->numFrictionConstr; + + PxMemZero(appliedForces, sizeof(Vec4V) * header->numFrictionConstr); + + for (PxU32 j = 0; j < maxAnchorCount; j++) + { + PxPrefetchLine(ptr, 384); + PxPrefetchLine(ptr, 512); + PxPrefetchLine(ptr, 640); + SolverContactFrictionStepBlock* PX_RESTRICT f0 = reinterpret_cast(ptr); + ptr += frictionSize; + SolverContactFrictionStepBlock* PX_RESTRICT f1 = reinterpret_cast(ptr); + ptr += frictionSize; + + index0 = j < clampedAnchorCount0 ? j : index0; + index1 = j < clampedAnchorCount1 ? j : index1; + index2 = j < clampedAnchorCount2 ? j : index2; + index3 = j < clampedAnchorCount3 ? j : index3; + + if (j >= clampedAnchorCount0) + maxImpulseScale = V4SetX(maxImpulseScale, fZero); + if (j >= clampedAnchorCount1) + maxImpulseScale = V4SetY(maxImpulseScale, fZero); + if (j >= clampedAnchorCount2) + maxImpulseScale = V4SetZ(maxImpulseScale, fZero); + if (j >= clampedAnchorCount3) + maxImpulseScale = V4SetW(maxImpulseScale, fZero); + + t0X = V4Mul(maxImpulseScale, t0X); + t0Y = V4Mul(maxImpulseScale, t0Y); + t0Z = V4Mul(maxImpulseScale, t0Z); + + t1X = V4Mul(maxImpulseScale, t1X); + t1Y = V4Mul(maxImpulseScale, t1Y); + t1Z = V4Mul(maxImpulseScale, t1Z); + + + Vec3V body0Anchor0 = V3LoadU(frictionPatch0.body0Anchors[index0]); + Vec3V body0Anchor1 = V3LoadU(frictionPatch1.body0Anchors[index1]); + Vec3V body0Anchor2 = V3LoadU(frictionPatch2.body0Anchors[index2]); + Vec3V body0Anchor3 = V3LoadU(frictionPatch3.body0Anchors[index3]); + + Vec4V ra0 = Vec4V_From_Vec3V(QuatRotate(bodyFrame00q, body0Anchor0)); + Vec4V ra1 = Vec4V_From_Vec3V(QuatRotate(bodyFrame01q, body0Anchor1)); + Vec4V ra2 = Vec4V_From_Vec3V(QuatRotate(bodyFrame02q, body0Anchor2)); + Vec4V ra3 = Vec4V_From_Vec3V(QuatRotate(bodyFrame03q, body0Anchor3)); + + Vec4V raX, raY, raZ; + PX_TRANSPOSE_44_34(ra0, ra1, ra2, ra3, raX, raY, raZ); + + /*raX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raX)), zero, raX); + raY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raY)), zero, raY); + raZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raZ)), zero, raZ);*/ + + const Vec4V raWorldX = V4Add(raX, bodyFrame0pX); + const Vec4V raWorldY = V4Add(raY, bodyFrame0pY); + const Vec4V raWorldZ = V4Add(raZ, bodyFrame0pZ); + + Vec3V body1Anchor0 = V3LoadU(frictionPatch0.body1Anchors[index0]); + Vec3V body1Anchor1 = V3LoadU(frictionPatch1.body1Anchors[index1]); + Vec3V body1Anchor2 = V3LoadU(frictionPatch2.body1Anchors[index2]); + Vec3V body1Anchor3 = V3LoadU(frictionPatch3.body1Anchors[index3]); + + Vec4V rb0 = Vec4V_From_Vec3V(QuatRotate(bodyFrame10q, body1Anchor0)); + Vec4V rb1 = Vec4V_From_Vec3V(QuatRotate(bodyFrame11q, body1Anchor1)); + Vec4V rb2 = Vec4V_From_Vec3V(QuatRotate(bodyFrame12q, body1Anchor2)); + Vec4V rb3 = Vec4V_From_Vec3V(QuatRotate(bodyFrame13q, body1Anchor3)); + + Vec4V rbX, rbY, rbZ; + PX_TRANSPOSE_44_34(rb0, rb1, rb2, rb3, rbX, rbY, rbZ); + + /*rbX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbX)), zero, rbX); + rbY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbY)), zero, rbY); + rbZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbZ)), zero, rbZ);*/ + + const Vec4V rbWorldX = V4Add(rbX, bodyFrame1pX); + const Vec4V rbWorldY = V4Add(rbY, bodyFrame1pY); + const Vec4V rbWorldZ = V4Add(rbZ, bodyFrame1pZ); + + Vec4V errorX = V4Sub(raWorldX, rbWorldX); + Vec4V errorY = V4Sub(raWorldY, rbWorldY); + Vec4V errorZ = V4Sub(raWorldZ, rbWorldZ); + + /*errorX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorX)), zero, errorX); + errorY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorY)), zero, errorY); + errorZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(errorZ)), zero, errorZ);*/ + + //KS - todo - get this working with per-point friction + PxU32 contactIndex0 = c.contactID[frictionIndex0][index0]; + PxU32 contactIndex1 = c.contactID[frictionIndex1][index1]; + PxU32 contactIndex2 = c.contactID[frictionIndex2][index2]; + PxU32 contactIndex3 = c.contactID[frictionIndex3][index3]; + + //Ensure that the ocntact indices are valid + PX_ASSERT(contactIndex0 == 0xffff || contactIndex0 < descs[0].numContacts); + PX_ASSERT(contactIndex1 == 0xffff || contactIndex1 < descs[1].numContacts); + PX_ASSERT(contactIndex2 == 0xffff || contactIndex2 < descs[2].numContacts); + PX_ASSERT(contactIndex3 == 0xffff || contactIndex3 < descs[3].numContacts); + + Vec4V targetVel0 = V4LoadA(contactIndex0 == 0xFFFF ? &contactBase0->targetVel.x : &descs[0].contacts[contactIndex0].targetVel.x); + Vec4V targetVel1 = V4LoadA(contactIndex1 == 0xFFFF ? &contactBase0->targetVel.x : &descs[1].contacts[contactIndex1].targetVel.x); + Vec4V targetVel2 = V4LoadA(contactIndex2 == 0xFFFF ? &contactBase0->targetVel.x : &descs[2].contacts[contactIndex2].targetVel.x); + Vec4V targetVel3 = V4LoadA(contactIndex3 == 0xFFFF ? &contactBase0->targetVel.x : &descs[3].contacts[contactIndex3].targetVel.x); + + Vec4V targetVelX, targetVelY, targetVelZ; + PX_TRANSPOSE_44_34(targetVel0, targetVel1, targetVel2, targetVel3, targetVelX, targetVelY, targetVelZ); + + + { + Vec4V raXnX = V4NegMulSub(raZ, t0Y, V4Mul(raY, t0Z)); + Vec4V raXnY = V4NegMulSub(raX, t0Z, V4Mul(raZ, t0X)); + Vec4V raXnZ = V4NegMulSub(raY, t0X, V4Mul(raX, t0Y)); + + raXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnZ)), zero, raXnZ); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + + Vec4V resp = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + + const Vec4V tVel0 = V4MulAdd(t0Z, linVelT20, V4MulAdd(t0Y, linVelT10, V4Mul(t0X, linVelT00))); + Vec4V vrel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4MulAdd(raXnX, angVelT00, tVel0))); + + Vec4V delAngVel1X = zero; + Vec4V delAngVel1Y = zero; + Vec4V delAngVel1Z = zero; + + Vec4V vrel1 = zero; + + if (isDynamic) + { + Vec4V rbXnX = V4NegMulSub(rbZ, t0Y, V4Mul(rbY, t0Z)); + Vec4V rbXnY = V4NegMulSub(rbX, t0Z, V4Mul(rbZ, t0X)); + Vec4V rbXnZ = V4NegMulSub(rbY, t0X, V4Mul(rbX, t0Y)); + + rbXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnZ)), zero, rbXnZ); + + delAngVel1X = V4Mul(invInertia1X0, rbXnX); + delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + resp = V4Add(resp, resp1); + + const Vec4V tVel1 = V4MulAdd(t0Z, linVelT21, V4MulAdd(t0Y, linVelT11, V4Mul(t0X, linVelT01))); + vrel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + } + else if (hasKinematic) + { + const Vec4V rbXnX = V4NegMulSub(rbZ, t0Y, V4Mul(rbY, t0Z)); + const Vec4V rbXnY = V4NegMulSub(rbX, t0Z, V4Mul(rbZ, t0X)); + const Vec4V rbXnZ = V4NegMulSub(rbY, t0X, V4Mul(rbX, t0Y)); + + const Vec4V tVel1 = V4MulAdd(t0Z, linVelT21, V4MulAdd(t0Y, linVelT11, V4Mul(t0X, linVelT01))); + vrel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + } + + f0->rbXnI[0] = delAngVel1X; + f0->rbXnI[1] = delAngVel1Y; + f0->rbXnI[2] = delAngVel1Z; + + const Vec4V velMultiplier = V4Mul(maxImpulseScale, V4Sel(V4IsGrtr(resp, zero), V4Div(p84, resp), zero)); + + Vec4V error = V4MulAdd(t0Z, errorZ, V4MulAdd(t0Y, errorY, V4Mul(t0X, errorX))); + + Vec4V targetVel = V4NegMulSub(vrel0, kinematicScale0, V4MulAdd(vrel1, kinematicScale1, V4MulAdd(t0Z, targetVelZ, V4MulAdd(t0Y, targetVelY, V4Mul(t0X, targetVelX))))); + + f0->normal[0] = t0X; + f0->normal[1] = t0Y; + f0->normal[2] = t0Z; + f0->raXnI[0] = delAngVel0X; + f0->raXnI[1] = delAngVel0Y; + f0->raXnI[2] = delAngVel0Z; + f0->error = error; + f0->velMultiplier = velMultiplier; + f0->biasCoefficient = V4Splat(frictionBiasScale); + f0->targetVel = targetVel; + } + + { + Vec4V raXnX = V4NegMulSub(raZ, t1Y, V4Mul(raY, t1Z)); + Vec4V raXnY = V4NegMulSub(raX, t1Z, V4Mul(raZ, t1X)); + Vec4V raXnZ = V4NegMulSub(raY, t1X, V4Mul(raX, t1Y)); + raXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnX)), zero, raXnX); + raXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnY)), zero, raXnY); + raXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(raXnZ)), zero, raXnZ); + + Vec4V delAngVel0X = V4Mul(invInertia0X0, raXnX); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, raXnX); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, raXnX); + + delAngVel0X = V4MulAdd(invInertia0Y0, raXnY, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, raXnY, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, raXnY, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, raXnZ, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, raXnZ, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, raXnZ, delAngVel0Z); + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0Z, delAngVel0Z, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0X, delAngVel0X))); + + Vec4V resp = V4MulAdd(dotDelAngVel0, angDom0, invMass0D0); + + const Vec4V tVel0 = V4MulAdd(t1Z, linVelT20, V4MulAdd(t1Y, linVelT10, V4Mul(t1X, linVelT00))); + Vec4V vrel0 = V4MulAdd(raXnZ, angVelT20, V4MulAdd(raXnY, angVelT10, V4MulAdd(raXnX, angVelT00, tVel0))); + + Vec4V delAngVel1X = zero; + Vec4V delAngVel1Y = zero; + Vec4V delAngVel1Z = zero; + + Vec4V vrel1 = zero; + + if (isDynamic) + { + + Vec4V rbXnX = V4NegMulSub(rbZ, t1Y, V4Mul(rbY, t1Z)); + Vec4V rbXnY = V4NegMulSub(rbX, t1Z, V4Mul(rbZ, t1X)); + Vec4V rbXnZ = V4NegMulSub(rbY, t1X, V4Mul(rbX, t1Y)); + rbXnX = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnX)), zero, rbXnX); + rbXnY = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnY)), zero, rbXnY); + rbXnZ = V4Sel(V4IsGrtr(solverOffsetSlop, V4Abs(rbXnZ)), zero, rbXnZ); + + delAngVel1X = V4Mul(invInertia1X0, rbXnX); + delAngVel1Y = V4Mul(invInertia1X1, rbXnX); + delAngVel1Z = V4Mul(invInertia1X2, rbXnX); + + delAngVel1X = V4MulAdd(invInertia1Y0, rbXnY, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, rbXnY, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, rbXnY, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, rbXnZ, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, rbXnZ, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, rbXnZ, delAngVel1Z); + + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1Z, delAngVel1Z, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1X, delAngVel1X))); + + const Vec4V resp1 = V4MulAdd(dotDelAngVel1, angDom1, invMass1D1); + + resp = V4Add(resp, resp1); + + + + const Vec4V tVel1 = V4MulAdd(t1Z, linVelT21, V4MulAdd(t1Y, linVelT11, V4Mul(t1X, linVelT01))); + vrel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + } + else if (hasKinematic) + { + const Vec4V rbXnX = V4NegMulSub(rbZ, t1Y, V4Mul(rbY, t1Z)); + const Vec4V rbXnY = V4NegMulSub(rbX, t1Z, V4Mul(rbZ, t1X)); + const Vec4V rbXnZ = V4NegMulSub(rbY, t1X, V4Mul(rbX, t1Y)); + + const Vec4V tVel1 = V4MulAdd(t1Z, linVelT21, V4MulAdd(t1Y, linVelT11, V4Mul(t1X, linVelT01))); + vrel1 = V4MulAdd(rbXnZ, angVelT21, V4MulAdd(rbXnY, angVelT11, V4MulAdd(rbXnX, angVelT01, tVel1))); + } + + f1->rbXnI[0] = delAngVel1X; + f1->rbXnI[1] = delAngVel1Y; + f1->rbXnI[2] = delAngVel1Z; + + + const Vec4V velMultiplier = V4Mul(maxImpulseScale, V4Sel(V4IsGrtr(resp, zero), V4Div(p84, resp), zero)); + + Vec4V error = V4MulAdd(t1Z, errorZ, V4MulAdd(t1Y, errorY, V4Mul(t1X, errorX))); + + Vec4V targetVel = V4NegMulSub(vrel0, kinematicScale0, V4MulAdd(vrel1, kinematicScale1, V4MulAdd(t1Z, targetVelZ, V4MulAdd(t1Y, targetVelY, V4Mul(t1X, targetVelX))))); + + f1->normal[0] = t1X; + f1->normal[1] = t1Y; + f1->normal[2] = t1Z; + f1->raXnI[0] = delAngVel0X; + f1->raXnI[1] = delAngVel0Y; + f1->raXnI[2] = delAngVel0Z; + f1->error = error; + f1->velMultiplier = velMultiplier; + f1->targetVel = targetVel; + f1->biasCoefficient = V4Splat(frictionBiasScale); + } + } + + header->dynamicFriction = V4LoadA(dynamicFriction); + header->staticFriction = V4LoadA(staticFriction); + + frictionPatchWritebackAddrIndex0++; + frictionPatchWritebackAddrIndex1++; + frictionPatchWritebackAddrIndex2++; + frictionPatchWritebackAddrIndex3++; + } + } + } +} + + + +PX_FORCE_INLINE void computeBlockStreamFrictionByteSizes(const CorrelationBuffer& c, + PxU32& _frictionPatchByteSize, PxU32& _numFrictionPatches, + PxU32 frictionPatchStartIndex, PxU32 frictionPatchEndIndex) +{ + // PT: use local vars to remove LHS + PxU32 numFrictionPatches = 0; + + for (PxU32 i = frictionPatchStartIndex; i < frictionPatchEndIndex; i++) + { + //Friction patches. + if (c.correlationListHeads[i] != CorrelationBuffer::LIST_END) + numFrictionPatches++; + } + PxU32 frictionPatchByteSize = numFrictionPatches * sizeof(FrictionPatch); + + _numFrictionPatches = numFrictionPatches; + + //16-byte alignment. + _frictionPatchByteSize = ((frictionPatchByteSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_frictionPatchByteSize & 0x0f)); +} + + +static bool reserveFrictionBlockStreams(const CorrelationBuffer& c, PxConstraintAllocator& constraintAllocator, PxU32 frictionPatchStartIndex, PxU32 frictionPatchEndIndex, + FrictionPatch*& _frictionPatches, + PxU32& numFrictionPatches) +{ + + //From frictionPatchStream we just need to reserve a single buffer. + PxU32 frictionPatchByteSize = 0; + //Compute the sizes of all the buffers. + + computeBlockStreamFrictionByteSizes(c, frictionPatchByteSize, numFrictionPatches, frictionPatchStartIndex, frictionPatchEndIndex); + + FrictionPatch* frictionPatches = NULL; + //If the constraint block reservation didn't fail then reserve the friction buffer too. + if (frictionPatchByteSize > 0) + { + frictionPatches = reinterpret_cast(constraintAllocator.reserveFrictionData(frictionPatchByteSize)); + + if (0 == frictionPatches || (reinterpret_cast(-1)) == frictionPatches) + { + if (0 == frictionPatches) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of friction data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + frictionPatches = NULL; + } + } + } + + _frictionPatches = frictionPatches; + + //Return true if neither of the two block reservations failed. + return (0 == frictionPatchByteSize || frictionPatches); +} + +//The persistent friction patch correlation/allocation will already have happenned as this is per-pair. +//This function just computes the size of the combined solve data. +void computeBlockStreamByteSizes4(PxTGSSolverContactDesc* descs, + PxU32& _solverConstraintByteSize, PxU32* _axisConstraintCount, + const CorrelationBuffer& c) +{ + PX_ASSERT(0 == _solverConstraintByteSize); + + PxU32 maxPatches = 0; + PxU32 maxFrictionPatches = 0; + PxU32 maxContactCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxU32 maxFrictionCount[CorrelationBuffer::MAX_FRICTION_PATCHES]; + PxMemZero(maxContactCount, sizeof(maxContactCount)); + PxMemZero(maxFrictionCount, sizeof(maxFrictionCount)); + bool hasMaxImpulse = false; + + for (PxU32 a = 0; a < 4; ++a) + { + PxU32 axisConstraintCount = 0; + hasMaxImpulse = hasMaxImpulse || descs[a].hasMaxImpulse; + for (PxU32 i = 0; i < descs[a].numFrictionPatches; i++) + { + PxU32 ind = i + descs[a].startFrictionPatchIndex; + + const FrictionPatch& frictionPatch = c.frictionPatches[ind]; + + const bool haveFriction = (frictionPatch.materialFlags & PxMaterialFlag::eDISABLE_FRICTION) == 0 + && frictionPatch.anchorCount != 0; + //Solver constraint data. + if (c.frictionPatchContactCounts[ind] != 0) + { + maxContactCount[i] = PxMax(c.frictionPatchContactCounts[ind], maxContactCount[i]); + axisConstraintCount += c.frictionPatchContactCounts[ind]; + + if (haveFriction) + { + const PxU32 fricCount = PxU32(c.frictionPatches[ind].anchorCount) * 2; + maxFrictionCount[i] = PxMax(fricCount, maxFrictionCount[i]); + axisConstraintCount += fricCount; + } + } + } + maxPatches = PxMax(descs[a].numFrictionPatches, maxPatches); + _axisConstraintCount[a] = axisConstraintCount; + } + + for (PxU32 a = 0; a < maxPatches; ++a) + { + if (maxFrictionCount[a] > 0) + maxFrictionPatches++; + } + + + PxU32 totalContacts = 0, totalFriction = 0; + for (PxU32 a = 0; a < maxPatches; ++a) + { + totalContacts += maxContactCount[a]; + totalFriction += maxFrictionCount[a]; + } + + //OK, we have a given number of friction patches, contact points and friction constraints so we can calculate how much memory we need + + //Body 2 is considered static if it is either *not dynamic* or *kinematic* + + /*bool hasDynamicBody = false; + for (PxU32 a = 0; a < 4; ++a) + { + hasDynamicBody = hasDynamicBody || ((descs[a].bodyState1 == PxSolverContactDesc::eDYNAMIC_BODY)); + } + + + const bool isStatic = !hasDynamicBody;*/ + + const PxU32 headerSize = sizeof(SolverContactHeaderStepBlock) * maxPatches; + //PxU32 constraintSize = isStatic ? (sizeof(SolverContactBatchPointBase4) * totalContacts) + (sizeof(SolverContactFrictionBase4) * totalFriction) : + // (sizeof(SolverContactBatchPointDynamic4) * totalContacts) + (sizeof(SolverContactFrictionDynamic4) * totalFriction); + + PxU32 constraintSize = (sizeof(SolverContactPointStepBlock) * totalContacts) + (sizeof(SolverContactFrictionStepBlock) * totalFriction); + + //Space for the appliedForce buffer + constraintSize += sizeof(Vec4V)*(totalContacts + totalFriction); + + //If we have max impulse, reserve a buffer for it + if (hasMaxImpulse) + constraintSize += sizeof(aos::Vec4V) * totalContacts; + + _solverConstraintByteSize = ((constraintSize + headerSize + 0x0f) & ~0x0f); + PX_ASSERT(0 == (_solverConstraintByteSize & 0x0f)); +} + +static SolverConstraintPrepState::Enum reserveBlockStreams4(PxTGSSolverContactDesc* descs, Dy::CorrelationBuffer& c, + PxU8*& solverConstraint, PxU32* axisConstraintCount, + PxU32& solverConstraintByteSize, + PxConstraintAllocator& constraintAllocator) +{ + PX_ASSERT(NULL == solverConstraint); + PX_ASSERT(0 == solverConstraintByteSize); + + //Compute the sizes of all the buffers. + computeBlockStreamByteSizes4(descs, + solverConstraintByteSize, axisConstraintCount, + c); + + //Reserve the buffers. + + //First reserve the accumulated buffer size for the constraint block. + PxU8* constraintBlock = NULL; + const PxU32 constraintBlockByteSize = solverConstraintByteSize; + if (constraintBlockByteSize > 0) + { + if ((constraintBlockByteSize + 16u) > 16384) + return SolverConstraintPrepState::eUNBATCHABLE; + + constraintBlock = constraintAllocator.reserveConstraintData(constraintBlockByteSize + 16u); + + if (0 == constraintBlock || (reinterpret_cast(-1)) == constraintBlock) + { + if (0 == constraintBlock) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept dropped contacts or increase buffer size allocated for narrow phase by increasing PxSceneDesc::maxNbContactDataBlocks."); + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of contact data for a single contact pair in constraint prep. " + "Either accept dropped contacts or simplify collision geometry."); + constraintBlock = NULL; + } + } + } + + //Patch up the individual ptrs to the buffer returned by the constraint block reservation (assuming the reservation didn't fail). + if (0 == constraintBlockByteSize || constraintBlock) + { + if (solverConstraintByteSize) + { + solverConstraint = constraintBlock; + PX_ASSERT(0 == (uintptr_t(solverConstraint) & 0x0f)); + } + } + + return ((0 == constraintBlockByteSize || constraintBlock)) ? SolverConstraintPrepState::eSUCCESS : SolverConstraintPrepState::eOUT_OF_MEMORY; +} + + + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Step( + Dy::CorrelationBuffer& c, + PxTGSSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal totalDtF32, + const PxReal invTotalDtF32, + const PxReal dt, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator) +{ + PX_ALIGN(16, PxReal invMassScale0[4]); + PX_ALIGN(16, PxReal invMassScale1[4]); + PX_ALIGN(16, PxReal invInertiaScale0[4]); + PX_ALIGN(16, PxReal invInertiaScale1[4]); + + c.frictionPatchCount = 0; + c.contactPatchCount = 0; + + for (PxU32 a = 0; a < 4; ++a) + { + PxTGSSolverContactDesc& blockDesc = blockDescs[a]; + + invMassScale0[a] = blockDesc.invMassScales.linear0; + invMassScale1[a] = blockDesc.invMassScales.linear1; + invInertiaScale0[a] = blockDesc.invMassScales.angular0; + invInertiaScale1[a] = blockDesc.invMassScales.angular1; + + blockDesc.startFrictionPatchIndex = c.frictionPatchCount; + if (!(blockDesc.disableStrongFriction)) + { + bool valid = getFrictionPatches(c, blockDesc.frictionPtr, blockDesc.frictionCount, + blockDesc.bodyFrame0, blockDesc.bodyFrame1, correlationDistance); + if (!valid) + return SolverConstraintPrepState::eUNBATCHABLE; + } + //Create the contact patches + blockDesc.startContactPatchIndex = c.contactPatchCount; + if (!createContactPatches(c, blockDesc.contacts, blockDesc.numContacts, PXC_SAME_NORMAL)) + return SolverConstraintPrepState::eUNBATCHABLE; + blockDesc.numContactPatches = PxU16(c.contactPatchCount - blockDesc.startContactPatchIndex); + + bool overflow = correlatePatches(c, blockDesc.contacts, blockDesc.bodyFrame0, blockDesc.bodyFrame1, PXC_SAME_NORMAL, + blockDesc.startContactPatchIndex, blockDesc.startFrictionPatchIndex); + + if (overflow) + return SolverConstraintPrepState::eUNBATCHABLE; + + growPatches(c, blockDesc.contacts, blockDesc.bodyFrame0, blockDesc.bodyFrame1, blockDesc.startFrictionPatchIndex, + frictionOffsetThreshold + blockDescs[a].restDistance); + + //Remove the empty friction patches - do we actually need to do this? + for (PxU32 p = c.frictionPatchCount; p > blockDesc.startFrictionPatchIndex; --p) + { + if (c.correlationListHeads[p - 1] == 0xffff) + { + //We have an empty patch...need to bin this one... + for (PxU32 p2 = p; p2 < c.frictionPatchCount; ++p2) + { + c.correlationListHeads[p2 - 1] = c.correlationListHeads[p2]; + c.frictionPatchContactCounts[p2 - 1] = c.frictionPatchContactCounts[p2]; + } + c.frictionPatchCount--; + } + } + + PxU32 numFricPatches = c.frictionPatchCount - blockDesc.startFrictionPatchIndex; + blockDesc.numFrictionPatches = numFricPatches; + } + + FrictionPatch* frictionPatchArray[4]; + PxU32 frictionPatchCounts[4]; + + for (PxU32 a = 0; a < 4; ++a) + { + PxTGSSolverContactDesc& blockDesc = blockDescs[a]; + + const bool successfulReserve = reserveFrictionBlockStreams(c, constraintAllocator, blockDesc.startFrictionPatchIndex, blockDesc.numFrictionPatches + blockDesc.startFrictionPatchIndex, + frictionPatchArray[a], + frictionPatchCounts[a]); + + //KS - TODO - how can we recover if we failed to allocate this memory? + if (!successfulReserve) + { + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + } + //At this point, all the friction data has been calculated, the correlation has been done. Provided this was all successful, + //we are ready to create the batched constraints + + PxU8* solverConstraint = NULL; + PxU32 solverConstraintByteSize = 0; + + { + PxU32 axisConstraintCount[4]; + SolverConstraintPrepState::Enum state = reserveBlockStreams4(blockDescs, c, + solverConstraint, axisConstraintCount, + solverConstraintByteSize, + constraintAllocator); + + if (state != SolverConstraintPrepState::eSUCCESS) + return state; + + for (PxU32 a = 0; a < 4; ++a) + { + FrictionPatch* frictionPatches = frictionPatchArray[a]; + + PxTGSSolverContactDesc& blockDesc = blockDescs[a]; + PxSolverConstraintDesc& desc = *blockDesc.desc; + blockDesc.frictionPtr = reinterpret_cast(frictionPatches); + blockDesc.frictionCount = PxTo8(frictionPatchCounts[a]); + + //Initialise friction buffer. + if (frictionPatches) + { + // PT: TODO: revisit this... not very satisfying + //const PxU32 maxSize = numFrictionPatches*sizeof(FrictionPatch); + PxPrefetchLine(frictionPatches); + PxPrefetchLine(frictionPatches, 128); + PxPrefetchLine(frictionPatches, 256); + + for (PxU32 i = 0; i(solverConstraint + solverConstraintByteSize)) = 0; + } + return SolverConstraintPrepState::eSUCCESS; +} + +SolverConstraintPrepState::Enum createFinalizeSolverContacts4Step( + PxsContactManagerOutput** cmOutputs, + ThreadContext& threadContext, + PxTGSSolverContactDesc* blockDescs, + const PxReal invDtF32, + const PxReal totalDtF32, + const PxReal invTotalDtF32, + const PxReal dtF32, + const PxReal bounceThresholdF32, + const PxReal frictionOffsetThreshold, + const PxReal correlationDistance, + const PxReal biasCoefficient, + PxConstraintAllocator& constraintAllocator) +{ + + for (PxU32 a = 0; a < 4; ++a) + { + blockDescs[a].desc->constraintLengthOver16 = 0; + } + + //PX_ASSERT(cmOutputs[0]->nbContacts && cmOutputs[1]->nbContacts && cmOutputs[2]->nbContacts && cmOutputs[3]->nbContacts); + + PxContactBuffer& buffer = threadContext.mContactBuffer; + + buffer.count = 0; + + //PxTransform idt = PxTransform(PxIdentity); + + CorrelationBuffer& c = threadContext.mCorrelationBuffer; + + for (PxU32 a = 0; a < 4; ++a) + { + PxTGSSolverContactDesc& blockDesc = blockDescs[a]; + PxSolverConstraintDesc& desc = *blockDesc.desc; + + //blockDesc.startContactIndex = buffer.count; + blockDesc.contacts = buffer.contacts + buffer.count; + + PxPrefetchLine(desc.bodyA); + PxPrefetchLine(desc.bodyB); + + //Unbatchable if we have (a) too many contacts or (b) torsional friction enabled - it just seems easier to handle this on an individual contact basis because it is expected to + //be used relatively rarely + if ((buffer.count + cmOutputs[a]->nbContacts) > 64 || (blockDesc.torsionalPatchRadius != 0.f || blockDesc.minTorsionalPatchRadius != 0.f) ) + { + return SolverConstraintPrepState::eUNBATCHABLE; + } + + bool hasMaxImpulse = false; + bool hasTargetVelocity = false; + + //OK...do the correlation here as well... + PxPrefetchLine(blockDescs[a].frictionPtr); + PxPrefetchLine(blockDescs[a].frictionPtr, 64); + PxPrefetchLine(blockDescs[a].frictionPtr, 128); + + if (a < 3) + { + PxPrefetchLine(cmOutputs[a]->contactPatches); + PxPrefetchLine(cmOutputs[a]->contactPoints); + } + + PxReal invMassScale0, invMassScale1, invInertiaScale0, invInertiaScale1; + + const PxReal defaultMaxImpulse = PxMin(blockDesc.bodyData0->maxContactImpulse, blockDesc.bodyData1->maxContactImpulse); + + PxU32 contactCount = extractContacts(buffer, *cmOutputs[a], hasMaxImpulse, hasTargetVelocity, invMassScale0, invMassScale1, + invInertiaScale0, invInertiaScale1, defaultMaxImpulse); + + if (contactCount == 0 || hasTargetVelocity) + return SolverConstraintPrepState::eUNBATCHABLE; + + blockDesc.numContacts = contactCount; + blockDesc.hasMaxImpulse = hasMaxImpulse; + blockDesc.disableStrongFriction = blockDesc.disableStrongFriction || hasTargetVelocity; + + blockDesc.invMassScales.linear0 *= invMassScale0; + blockDesc.invMassScales.linear1 *= invMassScale1; + blockDesc.invMassScales.angular0 *= blockDesc.body0->isKinematic ? 0.f : invInertiaScale0; + blockDesc.invMassScales.angular1 *= blockDesc.body1->isKinematic ? 0.f : invInertiaScale1; + } + + return createFinalizeSolverContacts4Step(c, blockDescs, + invDtF32, totalDtF32, invTotalDtF32, dtF32, bounceThresholdF32, frictionOffsetThreshold, + correlationDistance, biasCoefficient, constraintAllocator); +} + +void setSolverConstantsStep(PxReal& error, + PxReal& biasScale, + PxReal& targetVel, + PxReal& maxBias, + PxReal& velMultiplier, + PxReal& rcpResponse, + const Px1DConstraint& c, + PxReal normalVel, + PxReal unitResponse, + PxReal minRowResponse, + PxReal erp, + PxReal dt, + PxReal totalDt, + PxReal biasClamp, + PxReal recipdt, + PxReal recipTotalDt, + PxReal velTarget); + +namespace +{ + void setConstants(PxReal& error, PxReal& biasScale, PxReal& targetVel, PxReal& maxBias, PxReal& velMultiplier, + PxReal& rcpResponse, const Px1DConstraint& c, PxReal unitResponse, PxReal minRowResponse, PxReal dt, PxReal totalDt, + PxReal recipdt, PxReal recipTotalDt, const bool finished, + const PxReal lengthScale, const PxReal nv, const PxReal nv0, const PxReal nv1, const bool isKinematic0, const bool isKinematic1, + const PxReal erp) + { + PX_UNUSED(dt); + if (finished) + { + error = 0.f; + biasScale = 0.f; + maxBias = 0.f; + velMultiplier = 0.f; + rcpResponse = 0.f; + targetVel = 0.f; + return; + } + + //PxReal biasClamp = c.flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT ? 50.f : 200.f*lengthScale; + PxReal biasClamp = c.flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT ? 100.f : 1000.f*lengthScale; + + PxReal vt = 0.f; + if (isKinematic0) + vt -= nv0; + if (isKinematic1) + vt += nv1; + + setSolverConstantsStep(error, biasScale, targetVel, maxBias, velMultiplier, rcpResponse, c, nv, unitResponse, + minRowResponse, erp, dt, totalDt, biasClamp, recipdt, recipTotalDt, vt); + } + + void setOrthoData(const PxReal& ang0X, const PxReal& ang0Y, const PxReal& ang0Z, const PxReal& ang1X, const PxReal& ang1Y, const PxReal& ang1Z, + const PxReal& recipResponse, const PxReal& error, PxReal& orthoAng0X, PxReal& orthoAng0Y, PxReal& orthoAng0Z, PxReal& orthoAng1X, PxReal& orthoAng1Y, PxReal& orthoAng1Z, + PxReal& orthoRecipResponse, PxReal& orthoError, const bool disableProcessing, const PxU32 solveHint, PxU32& flags, PxU32& orthoCount, const bool finished) + { + if (!finished && !disableProcessing) + { + if (solveHint == PxConstraintSolveHint::eROTATIONAL_EQUALITY) + { + flags |= DY_SC_FLAG_ROT_EQ; + orthoAng0X = ang0X; orthoAng0Y = ang0Y; orthoAng0Z = ang0Z; + orthoAng1X = ang1X; orthoAng1Y = ang1Y; orthoAng1Z = ang1Z; + orthoRecipResponse = recipResponse; + orthoError = error; + orthoCount++; + } + else if (solveHint & PxConstraintSolveHint::eEQUALITY) + flags |= DY_SC_FLAG_ORTHO_TARGET; + } + } +} + +SolverConstraintPrepState::Enum setupSolverConstraintStep4 +(PxTGSSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal totalDt, const PxReal recipdt, const PxReal recipTotalDt, PxU32& totalRows, + PxConstraintAllocator& allocator, PxU32 maxRows, const PxReal lengthScale, const PxReal biasCoefficient); + +SolverConstraintPrepState::Enum setupSolverConstraintStep4 +(SolverConstraintShaderPrepDesc* PX_RESTRICT constraintShaderDescs, + PxTGSSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal totalDt, const PxReal recipdt, const PxReal recipTotalDt, PxU32& totalRows, + PxConstraintAllocator& allocator, const PxReal lengthScale, const PxReal biasCoefficient) +{ + //KS - we will never get here with constraints involving articulations so we don't need to stress about those in here + + totalRows = 0; + + Px1DConstraint allRows[MAX_CONSTRAINT_ROWS * 4]; + Px1DConstraint* rows = allRows; + Px1DConstraint* rows2 = allRows; + + PxU32 maxRows = 0; + PxU32 nbToPrep = MAX_CONSTRAINT_ROWS; + + for (PxU32 a = 0; a < 4; ++a) + { + SolverConstraintShaderPrepDesc& shaderDesc = constraintShaderDescs[a]; + PxTGSSolverConstraintPrepDesc& desc = constraintDescs[a]; + + if (!shaderDesc.solverPrep) + return SolverConstraintPrepState::eUNBATCHABLE; + + PX_ASSERT(rows2 + nbToPrep <= allRows + MAX_CONSTRAINT_ROWS*4); + setupConstraintRows(rows2, nbToPrep); + rows2 += nbToPrep; + + desc.invMassScales.linear0 = desc.invMassScales.linear1 = desc.invMassScales.angular0 = desc.invMassScales.angular1 = 1.0f; + desc.body0WorldOffset = PxVec3(0.0f); + + //TAG:solverprepcall + const PxU32 constraintCount = desc.disableConstraint ? 0 : (*shaderDesc.solverPrep)(rows, + desc.body0WorldOffset, + MAX_CONSTRAINT_ROWS, + desc.invMassScales, + shaderDesc.constantBlock, + desc.bodyFrame0, desc.bodyFrame1, desc.extendedLimits, desc.cA2w, desc.cB2w); + + nbToPrep = constraintCount; + maxRows = PxMax(constraintCount, maxRows); + + if (constraintCount == 0) + return SolverConstraintPrepState::eUNBATCHABLE; + + desc.rows = rows; + desc.numRows = constraintCount; + rows += constraintCount; + + if (desc.body0->isKinematic) + desc.invMassScales.angular0 = 0.0f; + if (desc.body1->isKinematic) + desc.invMassScales.angular1 = 0.0f; + } + + return setupSolverConstraintStep4(constraintDescs, dt, totalDt, recipdt, recipTotalDt, totalRows, allocator, maxRows, lengthScale, biasCoefficient); +} + +SolverConstraintPrepState::Enum setupSolverConstraintStep4 +(PxTGSSolverConstraintPrepDesc* PX_RESTRICT constraintDescs, + const PxReal dt, const PxReal totalDt, const PxReal recipdt, const PxReal recipTotalDt, PxU32& totalRows, + PxConstraintAllocator& allocator, PxU32 maxRows, + const PxReal lengthScale, const PxReal biasCoefficient) +{ + const Vec4V zero = V4Zero(); + Px1DConstraint* allSorted[MAX_CONSTRAINT_ROWS * 4]; + PxU32 startIndex[4]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia0[MAX_CONSTRAINT_ROWS * 4]; + PX_ALIGN(16, PxVec4) angSqrtInvInertia1[MAX_CONSTRAINT_ROWS * 4]; + + PxU32 numRows = 0; + + for (PxU32 a = 0; a < 4; ++a) + { + startIndex[a] = numRows; + PxTGSSolverConstraintPrepDesc& desc = constraintDescs[a]; + Px1DConstraint** sorted = allSorted + numRows; + + for (PxU32 i = 0; i < desc.numRows; ++i) + { + if (desc.rows[i].flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT) + { + if (desc.rows[i].solveHint == PxConstraintSolveHint::eEQUALITY) + desc.rows[i].solveHint = PxConstraintSolveHint::eROTATIONAL_EQUALITY; + else if (desc.rows[i].solveHint == PxConstraintSolveHint::eINEQUALITY) + desc.rows[i].solveHint = PxConstraintSolveHint::eROTATIONAL_INEQUALITY; + } + } + + preprocessRows(sorted, desc.rows, angSqrtInvInertia0 + numRows, angSqrtInvInertia1 + numRows, desc.numRows, + desc.body0TxI->sqrtInvInertia, desc.body1TxI->sqrtInvInertia, desc.bodyData0->invMass, desc.bodyData1->invMass, + desc.invMassScales, desc.disablePreprocessing, desc.improvedSlerp); + + numRows += desc.numRows; + } + + const PxU32 stride = sizeof(SolverConstraint1DStep4); + + const PxU32 constraintLength = sizeof(SolverConstraint1DHeaderStep4) + stride * maxRows; + + //KS - +16 is for the constraint progress counter, which needs to be the last element in the constraint (so that we + //know SPU DMAs have completed) + PxU8* ptr = allocator.reserveConstraintData(constraintLength + 16u); + if (NULL == ptr || (reinterpret_cast(-1)) == ptr) + { + for (PxU32 a = 0; a < 4; ++a) + { + PxTGSSolverConstraintPrepDesc& desc = constraintDescs[a]; + desc.desc->constraint = NULL; + desc.desc->constraintLengthOver16 = 0; + desc.desc->writeBack = desc.writeback; + } + + if (NULL == ptr) + { + PX_WARN_ONCE( + "Reached limit set by PxSceneDesc::maxNbContactDataBlocks - ran out of buffer space for constraint prep. " + "Either accept joints detaching/exploding or increase buffer size allocated for constraint prep by increasing PxSceneDesc::maxNbContactDataBlocks."); + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + else + { + PX_WARN_ONCE( + "Attempting to allocate more than 16K of constraint data. " + "Either accept joints detaching/exploding or simplify constraints."); + ptr = NULL; + return SolverConstraintPrepState::eOUT_OF_MEMORY; + } + } + //desc.constraint = ptr; + + totalRows = numRows; + + const PxReal erp = 0.5f * biasCoefficient; + + const bool isKinematic00 = constraintDescs[0].body0->isKinematic; + const bool isKinematic01 = constraintDescs[0].body1->isKinematic; + const bool isKinematic10 = constraintDescs[1].body0->isKinematic; + const bool isKinematic11 = constraintDescs[1].body1->isKinematic; + const bool isKinematic20 = constraintDescs[2].body0->isKinematic; + const bool isKinematic21 = constraintDescs[2].body1->isKinematic; + const bool isKinematic30 = constraintDescs[3].body0->isKinematic; + const bool isKinematic31 = constraintDescs[3].body1->isKinematic; + + for (PxU32 a = 0; a < 4; ++a) + { + PxTGSSolverConstraintPrepDesc& desc = constraintDescs[a]; + desc.desc->constraint = ptr; + desc.desc->constraintLengthOver16 = PxU16(constraintLength/16); + desc.desc->writeBack = desc.writeback; + } + + { + PxU8* currPtr = ptr; + SolverConstraint1DHeaderStep4* header = reinterpret_cast(currPtr); + currPtr += sizeof(SolverConstraint1DHeaderStep4); + + const PxTGSSolverBodyData& bd00 = *constraintDescs[0].bodyData0; + const PxTGSSolverBodyData& bd01 = *constraintDescs[1].bodyData0; + const PxTGSSolverBodyData& bd02 = *constraintDescs[2].bodyData0; + const PxTGSSolverBodyData& bd03 = *constraintDescs[3].bodyData0; + + const PxTGSSolverBodyData& bd10 = *constraintDescs[0].bodyData1; + const PxTGSSolverBodyData& bd11 = *constraintDescs[1].bodyData1; + const PxTGSSolverBodyData& bd12 = *constraintDescs[2].bodyData1; + const PxTGSSolverBodyData& bd13 = *constraintDescs[3].bodyData1; + + //Load up masses, invInertia, velocity etc. + + const Vec4V invMassScale0 = V4LoadXYZW(constraintDescs[0].invMassScales.linear0, constraintDescs[1].invMassScales.linear0, + constraintDescs[2].invMassScales.linear0, constraintDescs[3].invMassScales.linear0); + const Vec4V invMassScale1 = V4LoadXYZW(constraintDescs[0].invMassScales.linear1, constraintDescs[1].invMassScales.linear1, + constraintDescs[2].invMassScales.linear1, constraintDescs[3].invMassScales.linear1); + + + const Vec4V iMass0 = V4LoadXYZW(bd00.invMass, bd01.invMass, bd02.invMass, bd03.invMass); + + const Vec4V iMass1 = V4LoadXYZW(bd10.invMass, bd11.invMass, bd12.invMass, bd13.invMass); + + const Vec4V invMass0 = V4Mul(iMass0, invMassScale0); + const Vec4V invMass1 = V4Mul(iMass1, invMassScale1); + + + const Vec4V invInertiaScale0 = V4LoadXYZW(constraintDescs[0].invMassScales.angular0, constraintDescs[1].invMassScales.angular0, + constraintDescs[2].invMassScales.angular0, constraintDescs[3].invMassScales.angular0); + const Vec4V invInertiaScale1 = V4LoadXYZW(constraintDescs[0].invMassScales.angular1, constraintDescs[1].invMassScales.angular1, + constraintDescs[2].invMassScales.angular1, constraintDescs[3].invMassScales.angular1); + + + //body world offsets + Vec4V workOffset0 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[0].body0WorldOffset)); + Vec4V workOffset1 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[1].body0WorldOffset)); + Vec4V workOffset2 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[2].body0WorldOffset)); + Vec4V workOffset3 = Vec4V_From_Vec3V(V3LoadU(constraintDescs[3].body0WorldOffset)); + + Vec4V workOffsetX, workOffsetY, workOffsetZ; + + PX_TRANSPOSE_44_34(workOffset0, workOffset1, workOffset2, workOffset3, workOffsetX, workOffsetY, workOffsetZ); + + const FloatV dtV = FLoad(totalDt); + Vec4V linBreakForce = V4LoadXYZW(constraintDescs[0].linBreakForce, constraintDescs[1].linBreakForce, + constraintDescs[2].linBreakForce, constraintDescs[3].linBreakForce); + Vec4V angBreakForce = V4LoadXYZW(constraintDescs[0].angBreakForce, constraintDescs[1].angBreakForce, + constraintDescs[2].angBreakForce, constraintDescs[3].angBreakForce); + + + header->breakable[0] = PxU8((constraintDescs[0].linBreakForce != PX_MAX_F32) || (constraintDescs[0].angBreakForce != PX_MAX_F32)); + header->breakable[1] = PxU8((constraintDescs[1].linBreakForce != PX_MAX_F32) || (constraintDescs[1].angBreakForce != PX_MAX_F32)); + header->breakable[2] = PxU8((constraintDescs[2].linBreakForce != PX_MAX_F32) || (constraintDescs[2].angBreakForce != PX_MAX_F32)); + header->breakable[3] = PxU8((constraintDescs[3].linBreakForce != PX_MAX_F32) || (constraintDescs[3].angBreakForce != PX_MAX_F32)); + + //OK, I think that's everything loaded in + + header->invMass0D0 = invMass0; + header->invMass1D1 = invMass1; + header->angD0 = invInertiaScale0; + header->angD1 = invInertiaScale1; + header->body0WorkOffset[0] = workOffsetX; + header->body0WorkOffset[1] = workOffsetY; + header->body0WorkOffset[2] = workOffsetZ; + + header->count = maxRows; + header->type = DY_SC_TYPE_BLOCK_1D; + header->linBreakImpulse = V4Scale(linBreakForce, dtV); + header->angBreakImpulse = V4Scale(angBreakForce, dtV); + header->counts[0] = PxTo8(constraintDescs[0].numRows); + header->counts[1] = PxTo8(constraintDescs[1].numRows); + header->counts[2] = PxTo8(constraintDescs[2].numRows); + header->counts[3] = PxTo8(constraintDescs[3].numRows); + + + Vec4V ca2WX, ca2WY, ca2WZ; + Vec4V cb2WX, cb2WY, cb2WZ; + + Vec4V ca2W0 = V4LoadU(&constraintDescs[0].cA2w.x); + Vec4V ca2W1 = V4LoadU(&constraintDescs[1].cA2w.x); + Vec4V ca2W2 = V4LoadU(&constraintDescs[2].cA2w.x); + Vec4V ca2W3 = V4LoadU(&constraintDescs[3].cA2w.x); + + Vec4V cb2W0 = V4LoadU(&constraintDescs[0].cB2w.x); + Vec4V cb2W1 = V4LoadU(&constraintDescs[1].cB2w.x); + Vec4V cb2W2 = V4LoadU(&constraintDescs[2].cB2w.x); + Vec4V cb2W3 = V4LoadU(&constraintDescs[3].cB2w.x); + + PX_TRANSPOSE_44_34(ca2W0, ca2W1, ca2W2, ca2W3, ca2WX, ca2WY, ca2WZ); + PX_TRANSPOSE_44_34(cb2W0, cb2W1, cb2W2, cb2W3, cb2WX, cb2WY, cb2WZ); + + Vec4V pos00 = V4LoadA(&constraintDescs[0].body0TxI->deltaBody2World.p.x); + Vec4V pos01 = V4LoadA(&constraintDescs[0].body1TxI->deltaBody2World.p.x); + Vec4V pos10 = V4LoadA(&constraintDescs[1].body0TxI->deltaBody2World.p.x); + Vec4V pos11 = V4LoadA(&constraintDescs[1].body1TxI->deltaBody2World.p.x); + Vec4V pos20 = V4LoadA(&constraintDescs[2].body0TxI->deltaBody2World.p.x); + Vec4V pos21 = V4LoadA(&constraintDescs[2].body1TxI->deltaBody2World.p.x); + Vec4V pos30 = V4LoadA(&constraintDescs[3].body0TxI->deltaBody2World.p.x); + Vec4V pos31 = V4LoadA(&constraintDescs[3].body1TxI->deltaBody2World.p.x); + + Vec4V pos0X, pos0Y, pos0Z; + Vec4V pos1X, pos1Y, pos1Z; + + PX_TRANSPOSE_44_34(pos00, pos10, pos20, pos30, pos0X, pos0Y, pos0Z); + PX_TRANSPOSE_44_34(pos01, pos11, pos21, pos31, pos1X, pos1Y, pos1Z); + + Vec4V linVel00 = V4LoadA(&constraintDescs[0].bodyData0->originalLinearVelocity.x); + Vec4V linVel01 = V4LoadA(&constraintDescs[0].bodyData1->originalLinearVelocity.x); + Vec4V angState00 = V4LoadA(&constraintDescs[0].bodyData0->originalAngularVelocity.x); + Vec4V angState01 = V4LoadA(&constraintDescs[0].bodyData1->originalAngularVelocity.x); + + Vec4V linVel10 = V4LoadA(&constraintDescs[1].bodyData0->originalLinearVelocity.x); + Vec4V linVel11 = V4LoadA(&constraintDescs[1].bodyData1->originalLinearVelocity.x); + Vec4V angState10 = V4LoadA(&constraintDescs[1].bodyData0->originalAngularVelocity.x); + Vec4V angState11 = V4LoadA(&constraintDescs[1].bodyData1->originalAngularVelocity.x); + + Vec4V linVel20 = V4LoadA(&constraintDescs[2].bodyData0->originalLinearVelocity.x); + Vec4V linVel21 = V4LoadA(&constraintDescs[2].bodyData1->originalLinearVelocity.x); + Vec4V angState20 = V4LoadA(&constraintDescs[2].bodyData0->originalAngularVelocity.x); + Vec4V angState21 = V4LoadA(&constraintDescs[2].bodyData1->originalAngularVelocity.x); + + Vec4V linVel30 = V4LoadA(&constraintDescs[3].bodyData0->originalLinearVelocity.x); + Vec4V linVel31 = V4LoadA(&constraintDescs[3].bodyData1->originalLinearVelocity.x); + Vec4V angState30 = V4LoadA(&constraintDescs[3].bodyData0->originalAngularVelocity.x); + Vec4V angState31 = V4LoadA(&constraintDescs[3].bodyData1->originalAngularVelocity.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2; + Vec4V linVel1T0, linVel1T1, linVel1T2; + Vec4V angState0T0, angState0T1, angState0T2; + Vec4V angState1T0, angState1T1, angState1T2; + + + PX_TRANSPOSE_44_34(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2); + PX_TRANSPOSE_44_34(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2); + PX_TRANSPOSE_44_34(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2); + PX_TRANSPOSE_44_34(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2); + + + + const Vec4V raWorldX = V4Sub(ca2WX, pos0X); + const Vec4V raWorldY = V4Sub(ca2WY, pos0Y); + const Vec4V raWorldZ = V4Sub(ca2WZ, pos0Z); + + const Vec4V rbWorldX = V4Sub(cb2WX, pos1X); + const Vec4V rbWorldY = V4Sub(cb2WY, pos1Y); + const Vec4V rbWorldZ = V4Sub(cb2WZ, pos1Z); + + header->rAWorld[0] = raWorldX; + header->rAWorld[1] = raWorldY; + header->rAWorld[2] = raWorldZ; + + header->rBWorld[0] = rbWorldX; + header->rBWorld[1] = rbWorldY; + header->rBWorld[2] = rbWorldZ; + + //Now we loop over the constraints and build the results... + + PxU32 index0 = 0; + PxU32 endIndex0 = constraintDescs[0].numRows - 1; + PxU32 index1 = startIndex[1]; + PxU32 endIndex1 = index1 + constraintDescs[1].numRows - 1; + PxU32 index2 = startIndex[2]; + PxU32 endIndex2 = index2 + constraintDescs[2].numRows - 1; + PxU32 index3 = startIndex[3]; + PxU32 endIndex3 = index3 + constraintDescs[3].numRows - 1; + + const Vec4V one = V4One(); + const FloatV fOne = FOne(); + + PxU32 orthoCount0 = 0, orthoCount1 = 0, orthoCount2 = 0, orthoCount3 = 0; + + for (PxU32 a = 0; a < 3; ++a) + { + header->angOrthoAxis0X[a] = V4Zero(); + header->angOrthoAxis0Y[a] = V4Zero(); + header->angOrthoAxis0Z[a] = V4Zero(); + + header->angOrthoAxis1X[a] = V4Zero(); + header->angOrthoAxis1Y[a] = V4Zero(); + header->angOrthoAxis1Z[a] = V4Zero(); + + header->angOrthoRecipResponse[a] = V4Zero(); + header->angOrthoError[a] = V4Zero(); + } + + for (PxU32 a = 0; a < maxRows; ++a) + { + bool finished[] = { a >= constraintDescs[0].numRows, a >= constraintDescs[1].numRows, a >= constraintDescs[2].numRows, a >= constraintDescs[3].numRows }; + BoolV bFinished = BLoad(finished); + SolverConstraint1DStep4* c = reinterpret_cast(currPtr); + currPtr += stride; + + Px1DConstraint* con0 = allSorted[index0]; + Px1DConstraint* con1 = allSorted[index1]; + Px1DConstraint* con2 = allSorted[index2]; + Px1DConstraint* con3 = allSorted[index3]; + + bool angularConstraint[4] = + { + !!(con0->flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT), + !!(con1->flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT), + !!(con2->flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT), + !!(con3->flags & Px1DConstraintFlag::eANGULAR_CONSTRAINT), + }; + + BoolV bAngularConstraint = BLoad(angularConstraint); + + Vec4V cangDelta00 = V4LoadA(&angSqrtInvInertia0[index0].x); + Vec4V cangDelta01 = V4LoadA(&angSqrtInvInertia0[index1].x); + Vec4V cangDelta02 = V4LoadA(&angSqrtInvInertia0[index2].x); + Vec4V cangDelta03 = V4LoadA(&angSqrtInvInertia0[index3].x); + + Vec4V cangDelta10 = V4LoadA(&angSqrtInvInertia1[index0].x); + Vec4V cangDelta11 = V4LoadA(&angSqrtInvInertia1[index1].x); + Vec4V cangDelta12 = V4LoadA(&angSqrtInvInertia1[index2].x); + Vec4V cangDelta13 = V4LoadA(&angSqrtInvInertia1[index3].x); + + index0 = index0 == endIndex0 ? index0 : index0 + 1; + index1 = index1 == endIndex1 ? index1 : index1 + 1; + index2 = index2 == endIndex2 ? index2 : index2 + 1; + index3 = index3 == endIndex3 ? index3 : index3 + 1; + + Vec4V driveScale = one; + if (con0->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[0].driveLimitsAreForces) + driveScale = V4SetX(driveScale, FMin(fOne, dtV)); + if (con1->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[1].driveLimitsAreForces) + driveScale = V4SetY(driveScale, FMin(fOne, dtV)); + if (con2->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[2].driveLimitsAreForces) + driveScale = V4SetZ(driveScale, FMin(fOne, dtV)); + if (con3->flags&Px1DConstraintFlag::eHAS_DRIVE_LIMIT && constraintDescs[3].driveLimitsAreForces) + driveScale = V4SetW(driveScale, FMin(fOne, dtV)); + + + Vec4V clin00 = V4LoadA(&con0->linear0.x); + Vec4V clin01 = V4LoadA(&con1->linear0.x); + Vec4V clin02 = V4LoadA(&con2->linear0.x); + Vec4V clin03 = V4LoadA(&con3->linear0.x); + + Vec4V clin0X, clin0Y, clin0Z; + + PX_TRANSPOSE_44_34(clin00, clin01, clin02, clin03, clin0X, clin0Y, clin0Z); + + Vec4V cang00 = V4LoadA(&con0->angular0.x); + Vec4V cang01 = V4LoadA(&con1->angular0.x); + Vec4V cang02 = V4LoadA(&con2->angular0.x); + Vec4V cang03 = V4LoadA(&con3->angular0.x); + + Vec4V cang0X, cang0Y, cang0Z; + + PX_TRANSPOSE_44_34(cang00, cang01, cang02, cang03, cang0X, cang0Y, cang0Z); + + Vec4V cang10 = V4LoadA(&con0->angular1.x); + Vec4V cang11 = V4LoadA(&con1->angular1.x); + Vec4V cang12 = V4LoadA(&con2->angular1.x); + Vec4V cang13 = V4LoadA(&con3->angular1.x); + + Vec4V cang1X, cang1Y, cang1Z; + + PX_TRANSPOSE_44_34(cang10, cang11, cang12, cang13, cang1X, cang1Y, cang1Z); + + const Vec4V maxImpulse = V4LoadXYZW(con0->maxImpulse, con1->maxImpulse, con2->maxImpulse, con3->maxImpulse); + const Vec4V minImpulse = V4LoadXYZW(con0->minImpulse, con1->minImpulse, con2->minImpulse, con3->minImpulse); + + Vec4V angDelta0X, angDelta0Y, angDelta0Z; + + PX_TRANSPOSE_44_34(cangDelta00, cangDelta01, cangDelta02, cangDelta03, angDelta0X, angDelta0Y, angDelta0Z); + + c->flags[0] = 0; + c->flags[1] = 0; + c->flags[2] = 0; + c->flags[3] = 0; + + c->lin0[0] = V4Sel(bFinished, zero, clin0X); + c->lin0[1] = V4Sel(bFinished, zero, clin0Y); + c->lin0[2] = V4Sel(bFinished, zero, clin0Z); + c->ang0[0] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang0X, zero); + c->ang0[1] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang0Y, zero); + c->ang0[2] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang0Z, zero); + c->angularErrorScale = V4Sel(bAngularConstraint, one, zero); + + c->minImpulse = V4Mul(minImpulse, driveScale); + c->maxImpulse = V4Mul(maxImpulse, driveScale); + c->appliedForce = zero; + + const Vec4V lin0MagSq = V4MulAdd(clin0Z, clin0Z, V4MulAdd(clin0Y, clin0Y, V4Mul(clin0X, clin0X))); + const Vec4V cang0DotAngDelta = V4MulAdd(angDelta0Z, angDelta0Z, V4MulAdd(angDelta0Y, angDelta0Y, V4Mul(angDelta0X, angDelta0X))); + + Vec4V unitResponse = V4MulAdd(lin0MagSq, invMass0, V4Mul(cang0DotAngDelta, invInertiaScale0)); + + Vec4V clin10 = V4LoadA(&con0->linear1.x); + Vec4V clin11 = V4LoadA(&con1->linear1.x); + Vec4V clin12 = V4LoadA(&con2->linear1.x); + Vec4V clin13 = V4LoadA(&con3->linear1.x); + + Vec4V clin1X, clin1Y, clin1Z; + PX_TRANSPOSE_44_34(clin10, clin11, clin12, clin13, clin1X, clin1Y, clin1Z); + + Vec4V angDelta1X, angDelta1Y, angDelta1Z; + + PX_TRANSPOSE_44_34(cangDelta10, cangDelta11, cangDelta12, cangDelta13, angDelta1X, angDelta1Y, angDelta1Z); + + const Vec4V lin1MagSq = V4MulAdd(clin1Z, clin1Z, V4MulAdd(clin1Y, clin1Y, V4Mul(clin1X, clin1X))); + const Vec4V cang1DotAngDelta = V4MulAdd(angDelta1Z, angDelta1Z, V4MulAdd(angDelta1Y, angDelta1Y, V4Mul(angDelta1X, angDelta1X))); + + c->lin1[0] = V4Sel(bFinished, zero, clin1X); + c->lin1[1] = V4Sel(bFinished, zero, clin1Y); + c->lin1[2] = V4Sel(bFinished, zero, clin1Z); + + c->ang1[0] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang1X, zero); + c->ang1[1] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang1Y, zero); + c->ang1[2] = V4Sel(BAndNot(bAngularConstraint, bFinished), cang1Z, zero); + + unitResponse = V4Add(unitResponse, V4MulAdd(lin1MagSq, invMass1, V4Mul(cang1DotAngDelta, invInertiaScale1))); + + const Vec4V lnormalVel0 = V4MulAdd(clin0X, linVel0T0, V4MulAdd(clin0Y, linVel0T1, V4Mul(clin0Z, linVel0T2))); + const Vec4V lnormalVel1 = V4MulAdd(clin1X, linVel1T0, V4MulAdd(clin1Y, linVel1T1, V4Mul(clin1Z, linVel1T2))); + + const Vec4V angVel0 = V4MulAdd(cang0X, angState0T0, V4MulAdd(cang0Y, angState0T1, V4Mul(cang0Z, angState0T2))); + const Vec4V angVel1 = V4MulAdd(angDelta1X, angState1T0, V4MulAdd(angDelta1Y, angState1T1, V4Mul(angDelta1Z, angState1T2))); + + const Vec4V normalVel0 = V4Add(lnormalVel0, angVel0); + const Vec4V normalVel1 = V4Add(lnormalVel1, angVel1); + + const Vec4V normalVel = V4Sub(normalVel0, normalVel1); + + angDelta0X = V4Mul(angDelta0X, invInertiaScale0); + angDelta0Y = V4Mul(angDelta0Y, invInertiaScale0); + angDelta0Z = V4Mul(angDelta0Z, invInertiaScale0); + + angDelta1X = V4Mul(angDelta1X, invInertiaScale1); + angDelta1Y = V4Mul(angDelta1Y, invInertiaScale1); + angDelta1Z = V4Mul(angDelta1Z, invInertiaScale1); + + + + { + PxReal recipResponse[4]; + const PxVec4& ur = reinterpret_cast(unitResponse); + PxVec4& cBiasScale = reinterpret_cast(c->biasScale); + PxVec4& cError = reinterpret_cast(c->error); + PxVec4& cMaxBias = reinterpret_cast(c->maxBias); + PxVec4& cTargetVel = reinterpret_cast(c->velTarget); + PxVec4& cVelMultiplier = reinterpret_cast(c->velMultiplier); + const PxVec4& nVel = reinterpret_cast(normalVel); + const PxVec4& nVel0 = reinterpret_cast(normalVel0); + const PxVec4& nVel1 = reinterpret_cast(normalVel1); + + setConstants(cError.x, cBiasScale.x, cTargetVel.x, cMaxBias.x, cVelMultiplier.x, + recipResponse[0], *con0, ur.x, constraintDescs[0].minResponseThreshold, dt, totalDt, recipdt, recipTotalDt, + a >= constraintDescs[0].numRows, lengthScale, nVel.x, nVel0.x, nVel1.x, isKinematic00, isKinematic01, erp); + + setConstants(cError.y, cBiasScale.y, cTargetVel.y, cMaxBias.y, cVelMultiplier.y, + recipResponse[1], *con1, ur.y, constraintDescs[1].minResponseThreshold, dt, totalDt, recipdt, recipTotalDt, + a >= constraintDescs[1].numRows, lengthScale, nVel.y, nVel0.y, nVel1.y, isKinematic10, isKinematic11, erp); + + setConstants(cError.z, cBiasScale.z, cTargetVel.z, cMaxBias.z, cVelMultiplier.z, + recipResponse[2], *con2, ur.z, constraintDescs[2].minResponseThreshold, dt, totalDt, recipdt, recipTotalDt, + a >= constraintDescs[2].numRows, lengthScale, nVel.z, nVel0.z, nVel1.z, isKinematic20, isKinematic21, erp); + + setConstants(cError.w, cBiasScale.w, cTargetVel.w, cMaxBias.w, cVelMultiplier.w, + recipResponse[3], *con3, ur.w, constraintDescs[3].minResponseThreshold, dt, totalDt, recipdt, recipTotalDt, + a >= constraintDescs[3].numRows, lengthScale, nVel.w, nVel0.w, nVel1.w, isKinematic30, isKinematic31, erp); + + PxVec4* angOrthoAxes0X = reinterpret_cast(header->angOrthoAxis0X); + PxVec4* angOrthoAxes0Y = reinterpret_cast(header->angOrthoAxis0Y); + PxVec4* angOrthoAxes0Z = reinterpret_cast(header->angOrthoAxis0Z); + PxVec4* angOrthoAxes1X = reinterpret_cast(header->angOrthoAxis1X); + PxVec4* angOrthoAxes1Y = reinterpret_cast(header->angOrthoAxis1Y); + PxVec4* angOrthoAxes1Z = reinterpret_cast(header->angOrthoAxis1Z); + PxVec4* orthoRecipResponse = reinterpret_cast(header->angOrthoRecipResponse); + PxVec4* orthoError = reinterpret_cast(header->angOrthoError); + + const PxVec4& ang0X = reinterpret_cast(angDelta0X); + const PxVec4& ang0Y = reinterpret_cast(angDelta0Y); + const PxVec4& ang0Z = reinterpret_cast(angDelta0Z); + + const PxVec4& ang1X = reinterpret_cast(angDelta1X); + const PxVec4& ang1Y = reinterpret_cast(angDelta1Y); + const PxVec4& ang1Z = reinterpret_cast(angDelta1Z); + + setOrthoData(ang0X.x, ang0Y.x, ang0Z.x, ang1X.x, ang1Y.x, ang1Z.x, recipResponse[0], cError.x, angOrthoAxes0X[orthoCount0].x, + angOrthoAxes0Y[orthoCount0].x, angOrthoAxes0Z[orthoCount0].x, angOrthoAxes1X[orthoCount0].x, angOrthoAxes1Y[orthoCount0].x, + angOrthoAxes1Z[orthoCount0].x, orthoRecipResponse[orthoCount0].x, orthoError[orthoCount0].x, constraintDescs[0].disablePreprocessing, con0->solveHint, + c->flags[0], orthoCount0, a >= constraintDescs[0].numRows); + + setOrthoData(ang0X.y, ang0Y.y, ang0Z.y, ang1X.y, ang1Y.y, ang1Z.y, recipResponse[1], cError.y, angOrthoAxes0X[orthoCount1].y, + angOrthoAxes0Y[orthoCount1].y, angOrthoAxes0Z[orthoCount1].y, angOrthoAxes1X[orthoCount1].y, angOrthoAxes1Y[orthoCount1].y, + angOrthoAxes1Z[orthoCount1].y, orthoRecipResponse[orthoCount1].y, orthoError[orthoCount1].y, constraintDescs[1].disablePreprocessing, con1->solveHint, + c->flags[1], orthoCount1, a >= constraintDescs[1].numRows); + + setOrthoData(ang0X.z, ang0Y.z, ang0Z.z, ang1X.z, ang1Y.z, ang1Z.z, recipResponse[2], cError.z, angOrthoAxes0X[orthoCount2].z, + angOrthoAxes0Y[orthoCount2].z, angOrthoAxes0Z[orthoCount2].z, angOrthoAxes1X[orthoCount2].z, angOrthoAxes1Y[orthoCount2].z, + angOrthoAxes1Z[orthoCount2].z, orthoRecipResponse[orthoCount2].z, orthoError[orthoCount2].z, constraintDescs[2].disablePreprocessing, con2->solveHint, + c->flags[2], orthoCount2, a >= constraintDescs[2].numRows); + + setOrthoData(ang0X.w, ang0Y.w, ang0Z.w, ang1X.w, ang1Y.w, ang1Z.w, recipResponse[3], cError.w, angOrthoAxes0X[orthoCount3].w, + angOrthoAxes0Y[orthoCount3].w, angOrthoAxes0Z[orthoCount3].w, angOrthoAxes1X[orthoCount3].w, angOrthoAxes1Y[orthoCount3].w, + angOrthoAxes1Z[orthoCount3].w, orthoRecipResponse[orthoCount3].w, orthoError[orthoCount3].w, constraintDescs[3].disablePreprocessing, con3->solveHint, + c->flags[3], orthoCount3, a >= constraintDescs[3].numRows); + + } + + if (con0->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[0] |= DY_SC_FLAG_OUTPUT_FORCE; + if (con1->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[1] |= DY_SC_FLAG_OUTPUT_FORCE; + if (con2->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[2] |= DY_SC_FLAG_OUTPUT_FORCE; + if (con3->flags & Px1DConstraintFlag::eOUTPUT_FORCE) + c->flags[3] |= DY_SC_FLAG_OUTPUT_FORCE; + + if ((con0->flags & Px1DConstraintFlag::eKEEPBIAS)) + c->flags[0] |= DY_SC_FLAG_KEEP_BIAS; + if ((con1->flags & Px1DConstraintFlag::eKEEPBIAS)) + c->flags[1] |= DY_SC_FLAG_KEEP_BIAS; + if ((con2->flags & Px1DConstraintFlag::eKEEPBIAS)) + c->flags[2] |= DY_SC_FLAG_KEEP_BIAS; + if ((con3->flags & Px1DConstraintFlag::eKEEPBIAS)) + c->flags[3] |= DY_SC_FLAG_KEEP_BIAS; + + //Flag inequality constraints... + if (con0->solveHint & 1) + c->flags[0] |= DY_SC_FLAG_INEQUALITY; + if (con1->solveHint & 1) + c->flags[1] |= DY_SC_FLAG_INEQUALITY; + if (con2->solveHint & 1) + c->flags[2] |= DY_SC_FLAG_INEQUALITY; + if (con3->solveHint & 1) + c->flags[3] |= DY_SC_FLAG_INEQUALITY; + + } + *(reinterpret_cast(currPtr)) = 0; + *(reinterpret_cast(currPtr + 4)) = 0; + } + + //OK, we're ready to allocate and solve prep these constraints now :-) + return SolverConstraintPrepState::eSUCCESS; +} + + + + + +void solveContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, const bool doFriction, const PxReal minPenetration, + const PxReal elapsedTimeF32) +{ + PxTGSSolverBodyVel& b00 = *desc[0].tgsBodyA; + PxTGSSolverBodyVel& b01 = *desc[0].tgsBodyB; + PxTGSSolverBodyVel& b10 = *desc[1].tgsBodyA; + PxTGSSolverBodyVel& b11 = *desc[1].tgsBodyB; + PxTGSSolverBodyVel& b20 = *desc[2].tgsBodyA; + PxTGSSolverBodyVel& b21 = *desc[2].tgsBodyB; + PxTGSSolverBodyVel& b30 = *desc[3].tgsBodyA; + PxTGSSolverBodyVel& b31 = *desc[3].tgsBodyB; + + const Vec4V minPen = V4Load(minPenetration); + + const Vec4V elapsedTime = V4Load(elapsedTimeF32); + + //We'll need this. + const Vec4V vZero = V4Zero(); + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&b01.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularVelocity.x); + Vec4V angState01 = V4LoadA(&b01.angularVelocity.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&b11.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularVelocity.x); + Vec4V angState11 = V4LoadA(&b11.angularVelocity.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&b21.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularVelocity.x); + Vec4V angState21 = V4LoadA(&b21.angularVelocity.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&b31.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularVelocity.x); + Vec4V angState31 = V4LoadA(&b31.angularVelocity.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V linVel1T0, linVel1T1, linVel1T2, linVel1T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + Vec4V angState1T0, angState1T1, angState1T2, angState1T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2, linVel1T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + PX_TRANSPOSE_44(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2, angState1T3); + + + Vec4V linDelta00_ = V4LoadA(&b00.deltaLinDt.x); + Vec4V linDelta01_ = V4LoadA(&b01.deltaLinDt.x); + Vec4V angDelta00_ = V4LoadA(&b00.deltaAngDt.x); + Vec4V angDelta01_ = V4LoadA(&b01.deltaAngDt.x); + + Vec4V linDelta10_ = V4LoadA(&b10.deltaLinDt.x); + Vec4V linDelta11_ = V4LoadA(&b11.deltaLinDt.x); + Vec4V angDelta10_ = V4LoadA(&b10.deltaAngDt.x); + Vec4V angDelta11_ = V4LoadA(&b11.deltaAngDt.x); + + Vec4V linDelta20_ = V4LoadA(&b20.deltaLinDt.x); + Vec4V linDelta21_ = V4LoadA(&b21.deltaLinDt.x); + Vec4V angDelta20_ = V4LoadA(&b20.deltaAngDt.x); + Vec4V angDelta21_ = V4LoadA(&b21.deltaAngDt.x); + + Vec4V linDelta30_ = V4LoadA(&b30.deltaLinDt.x); + Vec4V linDelta31_ = V4LoadA(&b31.deltaLinDt.x); + Vec4V angDelta30_ = V4LoadA(&b30.deltaAngDt.x); + Vec4V angDelta31_ = V4LoadA(&b31.deltaAngDt.x); + + Vec4V linDelta0T0, linDelta0T1, linDelta0T2; + Vec4V linDelta1T0, linDelta1T1, linDelta1T2; + Vec4V angDelta0T0, angDelta0T1, angDelta0T2; + Vec4V angDelta1T0, angDelta1T1, angDelta1T2; + + + PX_TRANSPOSE_44_34(linDelta00_, linDelta10_, linDelta20_, linDelta30_, linDelta0T0, linDelta0T1, linDelta0T2); + PX_TRANSPOSE_44_34(linDelta01_, linDelta11_, linDelta21_, linDelta31_, linDelta1T0, linDelta1T1, linDelta1T2); + PX_TRANSPOSE_44_34(angDelta00_, angDelta10_, angDelta20_, angDelta30_, angDelta0T0, angDelta0T1, angDelta0T2); + PX_TRANSPOSE_44_34(angDelta01_, angDelta11_, angDelta21_, angDelta31_, angDelta1T0, angDelta1T1, angDelta1T2); + + + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + Vec4V vMax = V4Splat(FMax()); + + SolverContactHeaderStepBlock* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + const Vec4V invMassA = hdr->invMass0D0; + const Vec4V invMassB = hdr->invMass1D1; + + const Vec4V sumInvMass = V4Add(invMassA, invMassB); + + Vec4V linDeltaX = V4Sub(linDelta0T0, linDelta1T0); + Vec4V linDeltaY = V4Sub(linDelta0T1, linDelta1T1); + Vec4V linDeltaZ = V4Sub(linDelta0T2, linDelta1T2); + + + while (currPtr < last) + { + + hdr = reinterpret_cast(currPtr); + + PX_ASSERT(hdr->type == DY_SC_TYPE_BLOCK_RB_CONTACT); + + currPtr = reinterpret_cast(const_cast(hdr) + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + bool hasMaxImpulse = (hdr->flag & SolverContactHeaderStepBlock::eHAS_MAX_IMPULSE) != 0; + + Vec4V* appliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numNormalConstr; + + SolverContactPointStepBlock* PX_RESTRICT contacts = reinterpret_cast(currPtr); + + Vec4V* maxImpulses; + currPtr = reinterpret_cast(contacts + numNormalConstr); + PxU32 maxImpulseMask = 0; + if (hasMaxImpulse) + { + maxImpulseMask = 0xFFFFFFFF; + maxImpulses = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V) * numNormalConstr; + } + else + { + maxImpulses = &vMax; + } + + + /*SolverFrictionSharedData4* PX_RESTRICT fd = reinterpret_cast(currPtr); + if (numFrictionConstr) + currPtr += sizeof(SolverFrictionSharedData4);*/ + + Vec4V* frictionAppliedForce = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numFrictionConstr; + + const SolverContactFrictionStepBlock* PX_RESTRICT frictions = reinterpret_cast(currPtr); + currPtr += numFrictionConstr * sizeof(SolverContactFrictionStepBlock); + + Vec4V accumulatedNormalImpulse = vZero; + + const Vec4V angD0 = hdr->angDom0; + const Vec4V angD1 = hdr->angDom1; + + const Vec4V _normalT0 = hdr->normalX; + const Vec4V _normalT1 = hdr->normalY; + const Vec4V _normalT2 = hdr->normalZ; + + Vec4V contactNormalVel1 = V4Mul(linVel0T0, _normalT0); + Vec4V contactNormalVel3 = V4Mul(linVel1T0, _normalT0); + contactNormalVel1 = V4MulAdd(linVel0T1, _normalT1, contactNormalVel1); + contactNormalVel3 = V4MulAdd(linVel1T1, _normalT1, contactNormalVel3); + contactNormalVel1 = V4MulAdd(linVel0T2, _normalT2, contactNormalVel1); + contactNormalVel3 = V4MulAdd(linVel1T2, _normalT2, contactNormalVel3); + + const Vec4V maxPenBias = hdr->maxPenBias; + + Vec4V relVel1 = V4Sub(contactNormalVel1, contactNormalVel3); + + Vec4V deltaNormalV = V4Mul(linDeltaX, _normalT0); + deltaNormalV = V4MulAdd(linDeltaY, _normalT1, deltaNormalV); + deltaNormalV = V4MulAdd(linDeltaZ, _normalT2, deltaNormalV); + + Vec4V accumDeltaF = vZero; + + for (PxU32 i = 0; istaticFriction; + const Vec4V dynamicFric = hdr->dynamicFriction; + + const Vec4V maxFrictionImpulse = V4Add(V4Mul(staticFric, accumulatedNormalImpulse), V4Load(1e-5f)); + const Vec4V maxDynFrictionImpulse = V4Mul(dynamicFric, accumulatedNormalImpulse); + BoolV broken = BFFFF(); + + + for (PxU32 i = 0; ibroken = broken; + } + } + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(linVel1T0, linVel1T1, linVel1T2, linVel1T3, linVel01, linVel11, linVel21, linVel31); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + PX_TRANSPOSE_44(angState1T0, angState1T1, angState1T2, angState1T3, angState01, angState11, angState21, angState31); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularVelocity.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularVelocity.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularVelocity.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularVelocity.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularVelocity.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularVelocity.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularVelocity.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularVelocity.isFinite()); + + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(angState00, &b00.angularVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(angState10, &b10.angularVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(angState20, &b20.angularVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + V4StoreA(angState30, &b30.angularVelocity.x); + + if (desc[0].bodyBDataIndex != 0) + { + V4StoreA(linVel01, &b01.linearVelocity.x); + V4StoreA(angState01, &b01.angularVelocity.x); + } + if (desc[1].bodyBDataIndex != 0) + { + V4StoreA(linVel11, &b11.linearVelocity.x); + V4StoreA(angState11, &b11.angularVelocity.x); + } + if (desc[2].bodyBDataIndex != 0) + { + V4StoreA(linVel21, &b21.linearVelocity.x); + V4StoreA(angState21, &b21.angularVelocity.x); + } + if (desc[3].bodyBDataIndex != 0) + { + V4StoreA(linVel31, &b31.linearVelocity.x); + V4StoreA(angState31, &b31.angularVelocity.x); + } + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularVelocity.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularVelocity.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularVelocity.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularVelocity.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularVelocity.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularVelocity.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularVelocity.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularVelocity.isFinite()); +} + + +void writeBackContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext* cache) +{ + PX_UNUSED(cache); + const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + //hopefully pointer aliasing doesn't bite. + PxU8* PX_RESTRICT currPtr = desc[0].constraint; + PxReal* PX_RESTRICT vForceWriteback0 = reinterpret_cast(desc[0].writeBack); + PxReal* PX_RESTRICT vForceWriteback1 = reinterpret_cast(desc[1].writeBack); + PxReal* PX_RESTRICT vForceWriteback2 = reinterpret_cast(desc[2].writeBack); + PxReal* PX_RESTRICT vForceWriteback3 = reinterpret_cast(desc[3].writeBack); + + //const PxU8 type = *desc[0].constraint; + const PxU32 contactSize = sizeof(SolverContactPointStepBlock); + const PxU32 frictionSize = sizeof(SolverContactFrictionStepBlock); + + + Vec4V normalForce = V4Zero(); + + + //We'll need this. + //const Vec4V vZero = V4Zero(); + + bool writeBackThresholds[4] = { false, false, false, false }; + + while ((currPtr < last)) + { + SolverContactHeaderStepBlock* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + currPtr = reinterpret_cast(hdr + 1); + + const PxU32 numNormalConstr = hdr->numNormalConstr; + const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + Vec4V* PX_RESTRICT appliedForces = reinterpret_cast(currPtr); + currPtr += sizeof(Vec4V)*numNormalConstr; + + //SolverContactBatchPointBase4* PX_RESTRICT contacts = (SolverContactBatchPointBase4*)currPtr; + currPtr += (numNormalConstr * contactSize); + + bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + if (hasMaxImpulse) + currPtr += sizeof(Vec4V) * numNormalConstr; + + currPtr += sizeof(Vec4V)*numFrictionConstr; + + //SolverContactFrictionBase4* PX_RESTRICT frictions = (SolverContactFrictionBase4*)currPtr; + currPtr += (numFrictionConstr * frictionSize); + + writeBackThresholds[0] = hdr->flags[0] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[1] = hdr->flags[1] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[2] = hdr->flags[2] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + writeBackThresholds[3] = hdr->flags[3] & SolverContactHeader::eHAS_FORCE_THRESHOLDS; + + + for (PxU32 i = 0; inumNormalConstrs[0]) + FStore(appliedForce0, vForceWriteback0++); + if (vForceWriteback1 && i < hdr->numNormalConstrs[1]) + FStore(appliedForce1, vForceWriteback1++); + if (vForceWriteback2 && i < hdr->numNormalConstrs[2]) + FStore(appliedForce2, vForceWriteback2++); + if (vForceWriteback3 && i < hdr->numNormalConstrs[3]) + FStore(appliedForce3, vForceWriteback3++); + } + + if (numFrictionConstr) + { + PX_ALIGN(16, PxU32 broken[4]); + BStoreA(hdr->broken, broken); + + PxU8* frictionCounts = hdr->numNormalConstrs; + + for (PxU32 a = 0; a < 4; ++a) + { + if (frictionCounts[a] && broken[a]) + *hdr->frictionBrokenWritebackByte[a] = 1; // PT: bad L2 miss here + } + } + } + + PX_UNUSED(writeBackThresholds); + +#if 0 + if (cache) + { + + PX_ALIGN(16, PxReal nf[4]); + V4StoreA(normalForce, nf); + + Sc::ShapeInteraction** shapeInteractions = reinterpret_cast(desc[0].constraint)->shapeInteraction; + + for (PxU32 a = 0; a < 4; ++a) + { + if (writeBackThresholds[a] && desc[a].linkIndexA == PxSolverConstraintDesc::NO_LINK && desc[a].linkIndexB == PxSolverConstraintDesc::NO_LINK && + nf[a] != 0.f && (bd0[a]->reportThreshold < PX_MAX_REAL || bd1[a]->reportThreshold < PX_MAX_REAL)) + { + ThresholdStreamElement elt; + elt.normalForce = nf[a]; + elt.threshold = PxMin(bd0[a]->reportThreshold, bd1[a]->reportThreshold); + elt.nodeIndexA = bd0[a]->nodeIndex; + elt.nodeIndexB = bd1[a]->nodeIndex; + elt.shapeInteraction = shapeInteractions[a]; + PxOrder(elt.nodeIndexA, elt.nodeIndexB); + PX_ASSERT(elt.nodeIndexA < elt.nodeIndexB); + PX_ASSERT(cache.mThresholdStreamIndex < cache.mThresholdStreamLength); + cache.mThresholdStream[cache.mThresholdStreamIndex++] = elt; + } + } + } +#endif +} + +void solveContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, const PxTGSSolverBodyTxInertia* const /*txInertias*/, + const PxReal minPenetration, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + solveContact4_Block(desc + hdr.startIndex, true, minPenetration, elapsedTime); +} + +void writeBackContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext* cache) +{ + writeBackContact4_Block(desc + hdr.startIndex, cache); +} + +PX_FORCE_INLINE Vec4V V4Dot3(const Vec4V& x0, const Vec4V& y0, const Vec4V& z0, const Vec4V& x1, const Vec4V& y1, const Vec4V& z1) +{ + return V4MulAdd(x0, x1, V4MulAdd(y0, y1, V4Mul(z0, z1))); +} + + +void solve1DStep4(const PxSolverConstraintDesc* PX_RESTRICT desc, const PxTGSSolverBodyTxInertia* const txInertias, + const PxReal elapsedTimeF32) +{ + PxU8* PX_RESTRICT bPtr = desc->constraint; + if (bPtr == NULL) + return; + + const FloatV elapsedTime = FLoad(elapsedTimeF32); + + PxTGSSolverBodyVel& b00 = *desc[0].tgsBodyA; + PxTGSSolverBodyVel& b01 = *desc[0].tgsBodyB; + PxTGSSolverBodyVel& b10 = *desc[1].tgsBodyA; + PxTGSSolverBodyVel& b11 = *desc[1].tgsBodyB; + PxTGSSolverBodyVel& b20 = *desc[2].tgsBodyA; + PxTGSSolverBodyVel& b21 = *desc[2].tgsBodyB; + PxTGSSolverBodyVel& b30 = *desc[3].tgsBodyA; + PxTGSSolverBodyVel& b31 = *desc[3].tgsBodyB; + + const PxTGSSolverBodyTxInertia& txI00 = txInertias[desc[0].bodyADataIndex]; + const PxTGSSolverBodyTxInertia& txI01 = txInertias[desc[0].bodyBDataIndex]; + const PxTGSSolverBodyTxInertia& txI10 = txInertias[desc[1].bodyADataIndex]; + const PxTGSSolverBodyTxInertia& txI11 = txInertias[desc[1].bodyBDataIndex]; + const PxTGSSolverBodyTxInertia& txI20 = txInertias[desc[2].bodyADataIndex]; + const PxTGSSolverBodyTxInertia& txI21 = txInertias[desc[2].bodyBDataIndex]; + const PxTGSSolverBodyTxInertia& txI30 = txInertias[desc[3].bodyADataIndex]; + const PxTGSSolverBodyTxInertia& txI31 = txInertias[desc[3].bodyBDataIndex]; + + Vec4V linVel00 = V4LoadA(&b00.linearVelocity.x); + Vec4V linVel01 = V4LoadA(&b01.linearVelocity.x); + Vec4V angState00 = V4LoadA(&b00.angularVelocity.x); + Vec4V angState01 = V4LoadA(&b01.angularVelocity.x); + + Vec4V linVel10 = V4LoadA(&b10.linearVelocity.x); + Vec4V linVel11 = V4LoadA(&b11.linearVelocity.x); + Vec4V angState10 = V4LoadA(&b10.angularVelocity.x); + Vec4V angState11 = V4LoadA(&b11.angularVelocity.x); + + Vec4V linVel20 = V4LoadA(&b20.linearVelocity.x); + Vec4V linVel21 = V4LoadA(&b21.linearVelocity.x); + Vec4V angState20 = V4LoadA(&b20.angularVelocity.x); + Vec4V angState21 = V4LoadA(&b21.angularVelocity.x); + + Vec4V linVel30 = V4LoadA(&b30.linearVelocity.x); + Vec4V linVel31 = V4LoadA(&b31.linearVelocity.x); + Vec4V angState30 = V4LoadA(&b30.angularVelocity.x); + Vec4V angState31 = V4LoadA(&b31.angularVelocity.x); + + + Vec4V linVel0T0, linVel0T1, linVel0T2, linVel0T3; + Vec4V linVel1T0, linVel1T1, linVel1T2, linVel1T3; + Vec4V angState0T0, angState0T1, angState0T2, angState0T3; + Vec4V angState1T0, angState1T1, angState1T2, angState1T3; + + + PX_TRANSPOSE_44(linVel00, linVel10, linVel20, linVel30, linVel0T0, linVel0T1, linVel0T2, linVel0T3); + PX_TRANSPOSE_44(linVel01, linVel11, linVel21, linVel31, linVel1T0, linVel1T1, linVel1T2, linVel1T3); + PX_TRANSPOSE_44(angState00, angState10, angState20, angState30, angState0T0, angState0T1, angState0T2, angState0T3); + PX_TRANSPOSE_44(angState01, angState11, angState21, angState31, angState1T0, angState1T1, angState1T2, angState1T3); + + + Vec4V linDelta00 = V4LoadA(&b00.deltaLinDt.x); + Vec4V linDelta01 = V4LoadA(&b01.deltaLinDt.x); + Vec4V angDelta00 = V4LoadA(&b00.deltaAngDt.x); + Vec4V angDelta01 = V4LoadA(&b01.deltaAngDt.x); + + Vec4V linDelta10 = V4LoadA(&b10.deltaLinDt.x); + Vec4V linDelta11 = V4LoadA(&b11.deltaLinDt.x); + Vec4V angDelta10 = V4LoadA(&b10.deltaAngDt.x); + Vec4V angDelta11 = V4LoadA(&b11.deltaAngDt.x); + + Vec4V linDelta20 = V4LoadA(&b20.deltaLinDt.x); + Vec4V linDelta21 = V4LoadA(&b21.deltaLinDt.x); + Vec4V angDelta20 = V4LoadA(&b20.deltaAngDt.x); + Vec4V angDelta21 = V4LoadA(&b21.deltaAngDt.x); + + Vec4V linDelta30 = V4LoadA(&b30.deltaLinDt.x); + Vec4V linDelta31 = V4LoadA(&b31.deltaLinDt.x); + Vec4V angDelta30 = V4LoadA(&b30.deltaAngDt.x); + Vec4V angDelta31 = V4LoadA(&b31.deltaAngDt.x); + + Vec4V linDelta0T0, linDelta0T1, linDelta0T2; + Vec4V linDelta1T0, linDelta1T1, linDelta1T2; + Vec4V angDelta0T0, angDelta0T1, angDelta0T2; + Vec4V angDelta1T0, angDelta1T1, angDelta1T2; + + + PX_TRANSPOSE_44_34(linDelta00, linDelta10, linDelta20, linDelta30, linDelta0T0, linDelta0T1, linDelta0T2); + PX_TRANSPOSE_44_34(linDelta01, linDelta11, linDelta21, linDelta31, linDelta1T0, linDelta1T1, linDelta1T2); + PX_TRANSPOSE_44_34(angDelta00, angDelta10, angDelta20, angDelta30, angDelta0T0, angDelta0T1, angDelta0T2); + PX_TRANSPOSE_44_34(angDelta01, angDelta11, angDelta21, angDelta31, angDelta1T0, angDelta1T1, angDelta1T2); + + + + + const SolverConstraint1DHeaderStep4* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DStep4* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeaderStep4)); + + + Vec4V invInertia00X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI00.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia00Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI00.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia00Z = Vec4V_From_Vec3V(V3LoadU(txI00.sqrtInvInertia.column2)); + + Vec4V invInertia10X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI10.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia10Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI10.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia10Z = Vec4V_From_Vec3V(V3LoadU(txI10.sqrtInvInertia.column2)); + + Vec4V invInertia20X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI20.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia20Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI20.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia20Z = Vec4V_From_Vec3V(V3LoadU(txI20.sqrtInvInertia.column2)); + + Vec4V invInertia30X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI30.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia30Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI30.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia30Z = Vec4V_From_Vec3V(V3LoadU(txI30.sqrtInvInertia.column2)); + + Vec4V invInertia01X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI01.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia01Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI01.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia01Z = Vec4V_From_Vec3V(V3LoadU(txI01.sqrtInvInertia.column2)); + + Vec4V invInertia11X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI11.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia11Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI11.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia11Z = Vec4V_From_Vec3V(V3LoadU(txI11.sqrtInvInertia.column2)); + + Vec4V invInertia21X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI21.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia21Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI21.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia21Z = Vec4V_From_Vec3V(V3LoadU(txI21.sqrtInvInertia.column2)); + + Vec4V invInertia31X = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI31.sqrtInvInertia.column0)); // PT: safe because 'column1' follows 'column0' in PxMat33 + Vec4V invInertia31Y = Vec4V_From_Vec3V(V3LoadU_SafeReadW(txI31.sqrtInvInertia.column1)); // PT: safe because 'column2' follows 'column1' in PxMat33 + Vec4V invInertia31Z = Vec4V_From_Vec3V(V3LoadU(txI31.sqrtInvInertia.column2)); + + Vec4V invInertia0X0, invInertia0X1, invInertia0X2; + Vec4V invInertia0Y0, invInertia0Y1, invInertia0Y2; + Vec4V invInertia0Z0, invInertia0Z1, invInertia0Z2; + + Vec4V invInertia1X0, invInertia1X1, invInertia1X2; + Vec4V invInertia1Y0, invInertia1Y1, invInertia1Y2; + Vec4V invInertia1Z0, invInertia1Z1, invInertia1Z2; + + PX_TRANSPOSE_44_34(invInertia00X, invInertia10X, invInertia20X, invInertia30X, invInertia0X0, invInertia0Y0, invInertia0Z0); + PX_TRANSPOSE_44_34(invInertia00Y, invInertia10Y, invInertia20Y, invInertia30Y, invInertia0X1, invInertia0Y1, invInertia0Z1); + PX_TRANSPOSE_44_34(invInertia00Z, invInertia10Z, invInertia20Z, invInertia30Z, invInertia0X2, invInertia0Y2, invInertia0Z2); + + PX_TRANSPOSE_44_34(invInertia01X, invInertia11X, invInertia21X, invInertia31X, invInertia1X0, invInertia1Y0, invInertia1Z0); + PX_TRANSPOSE_44_34(invInertia01Y, invInertia11Y, invInertia21Y, invInertia31Y, invInertia1X1, invInertia1Y1, invInertia1Z1); + PX_TRANSPOSE_44_34(invInertia01Z, invInertia11Z, invInertia21Z, invInertia31Z, invInertia1X2, invInertia1Y2, invInertia1Z2); + + const Vec4V invInertiaScale0 = header->angD0; + const Vec4V invInertiaScale1 = header->angD1; + + //KS - todo - load this a bit quicker... + Vec4V rot00 = V4LoadA(&txI00.deltaBody2World.q.x); + Vec4V rot01 = V4LoadA(&txI01.deltaBody2World.q.x); + Vec4V rot10 = V4LoadA(&txI10.deltaBody2World.q.x); + Vec4V rot11 = V4LoadA(&txI11.deltaBody2World.q.x); + Vec4V rot20 = V4LoadA(&txI20.deltaBody2World.q.x); + Vec4V rot21 = V4LoadA(&txI21.deltaBody2World.q.x); + Vec4V rot30 = V4LoadA(&txI30.deltaBody2World.q.x); + Vec4V rot31 = V4LoadA(&txI31.deltaBody2World.q.x); + + Vec4V rot0X, rot0Y, rot0Z, rot0W; + Vec4V rot1X, rot1Y, rot1Z, rot1W; + + PX_TRANSPOSE_44(rot00, rot10, rot20, rot30, rot0X, rot0Y, rot0Z, rot0W); + PX_TRANSPOSE_44(rot01, rot11, rot21, rot31, rot1X, rot1Y, rot1Z, rot1W); + + Vec4V raX, raY, raZ; + Vec4V rbX, rbY, rbZ; + + QuatRotate4(rot0X, rot0Y, rot0Z, rot0W, header->rAWorld[0], header->rAWorld[1], header->rAWorld[2], raX, raY, raZ); + QuatRotate4(rot1X, rot1Y, rot1Z, rot1W, header->rBWorld[0], header->rBWorld[1], header->rBWorld[2], rbX, rbY, rbZ); + + + const Vec4V raMotionX = V4Sub(V4Add(raX, linDelta0T0), header->rAWorld[0]); + const Vec4V raMotionY = V4Sub(V4Add(raY, linDelta0T1), header->rAWorld[1]); + const Vec4V raMotionZ = V4Sub(V4Add(raZ, linDelta0T2), header->rAWorld[2]); + const Vec4V rbMotionX = V4Sub(V4Add(rbX, linDelta1T0), header->rBWorld[0]); + const Vec4V rbMotionY = V4Sub(V4Add(rbY, linDelta1T1), header->rBWorld[1]); + const Vec4V rbMotionZ = V4Sub(V4Add(rbZ, linDelta1T2), header->rBWorld[2]); + + const Vec4V mass0 = header->invMass0D0; + const Vec4V mass1 = header->invMass1D1; + + const VecI32V orthoMask = I4Load(DY_SC_FLAG_ORTHO_TARGET); + const VecI32V limitMask = I4Load(DY_SC_FLAG_INEQUALITY); + const Vec4V zero = V4Zero(); + const Vec4V one = V4One(); + + Vec4V error0 = V4Add(header->angOrthoError[0], + V4Sub(V4Dot3(header->angOrthoAxis0X[0], header->angOrthoAxis0Y[0], header->angOrthoAxis0Z[0], angDelta0T0, angDelta0T1, angDelta0T2), + V4Dot3(header->angOrthoAxis1X[0], header->angOrthoAxis1Y[0], header->angOrthoAxis1Z[0], angDelta1T0, angDelta1T1, angDelta1T2))); + + Vec4V error1 = V4Add(header->angOrthoError[1], + V4Sub(V4Dot3(header->angOrthoAxis0X[1], header->angOrthoAxis0Y[1], header->angOrthoAxis0Z[1], angDelta0T0, angDelta0T1, angDelta0T2), + V4Dot3(header->angOrthoAxis1X[1], header->angOrthoAxis1Y[1], header->angOrthoAxis1Z[1], angDelta1T0, angDelta1T1, angDelta1T2))); + + Vec4V error2 = V4Add(header->angOrthoError[2], + V4Sub(V4Dot3(header->angOrthoAxis0X[2], header->angOrthoAxis0Y[2], header->angOrthoAxis0Z[2], angDelta0T0, angDelta0T1, angDelta0T2), + V4Dot3(header->angOrthoAxis1X[2], header->angOrthoAxis1Y[2], header->angOrthoAxis1Z[2], angDelta1T0, angDelta1T1, angDelta1T2))); + + for (PxU32 i = 0; icount; ++i, base++) + { + PxPrefetchLine(base + 1); + SolverConstraint1DStep4& c = *base; + + const Vec4V cangVel0X = V4Add(c.ang0[0], V4NegMulSub(raZ, c.lin0[1], V4Mul(raY, c.lin0[2]))); + const Vec4V cangVel0Y = V4Add(c.ang0[1], V4NegMulSub(raX, c.lin0[2], V4Mul(raZ, c.lin0[0]))); + const Vec4V cangVel0Z = V4Add(c.ang0[2], V4NegMulSub(raY, c.lin0[0], V4Mul(raX, c.lin0[1]))); + + const Vec4V cangVel1X = V4Add(c.ang1[0], V4NegMulSub(rbZ, c.lin1[1], V4Mul(rbY, c.lin1[2]))); + const Vec4V cangVel1Y = V4Add(c.ang1[1], V4NegMulSub(rbX, c.lin1[2], V4Mul(rbZ, c.lin1[0]))); + const Vec4V cangVel1Z = V4Add(c.ang1[2], V4NegMulSub(rbY, c.lin1[0], V4Mul(rbX, c.lin1[1]))); + + const VecI32V flags = I4LoadA(reinterpret_cast(c.flags)); + + const BoolV useOrtho = VecI32V_IsEq(VecI32V_And(flags, orthoMask), orthoMask); + + + const Vec4V angOrthoCoefficient = V4Sel(useOrtho, one, zero); + + + Vec4V delAngVel0X = V4Mul(invInertia0X0, cangVel0X); + Vec4V delAngVel0Y = V4Mul(invInertia0X1, cangVel0X); + Vec4V delAngVel0Z = V4Mul(invInertia0X2, cangVel0X); + + delAngVel0X = V4MulAdd(invInertia0Y0, cangVel0Y, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Y1, cangVel0Y, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Y2, cangVel0Y, delAngVel0Z); + + delAngVel0X = V4MulAdd(invInertia0Z0, cangVel0Z, delAngVel0X); + delAngVel0Y = V4MulAdd(invInertia0Z1, cangVel0Z, delAngVel0Y); + delAngVel0Z = V4MulAdd(invInertia0Z2, cangVel0Z, delAngVel0Z); + + Vec4V delAngVel1X = V4Mul(invInertia1X0, cangVel1X); + Vec4V delAngVel1Y = V4Mul(invInertia1X1, cangVel1X); + Vec4V delAngVel1Z = V4Mul(invInertia1X2, cangVel1X); + + delAngVel1X = V4MulAdd(invInertia1Y0, cangVel1Y, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Y1, cangVel1Y, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Y2, cangVel1Y, delAngVel1Z); + + delAngVel1X = V4MulAdd(invInertia1Z0, cangVel1Z, delAngVel1X); + delAngVel1Y = V4MulAdd(invInertia1Z1, cangVel1Z, delAngVel1Y); + delAngVel1Z = V4MulAdd(invInertia1Z2, cangVel1Z, delAngVel1Z); + + Vec4V err = c.error; + { + const Vec4V proj0 = V4Mul(V4MulAdd(header->angOrthoAxis0X[0], delAngVel0X, V4MulAdd(header->angOrthoAxis0Y[0], delAngVel0Y, + V4MulAdd(header->angOrthoAxis0Z[0], delAngVel0Z, V4MulAdd(header->angOrthoAxis1X[0], delAngVel1X, + V4MulAdd(header->angOrthoAxis1Y[0], delAngVel1Y, V4Mul(header->angOrthoAxis1Z[0], delAngVel1Z)))))), header->angOrthoRecipResponse[0]); + + const Vec4V proj1 = V4Mul(V4MulAdd(header->angOrthoAxis0X[1], delAngVel0X, V4MulAdd(header->angOrthoAxis0Y[1], delAngVel0Y, + V4MulAdd(header->angOrthoAxis0Z[1], delAngVel0Z, V4MulAdd(header->angOrthoAxis1X[1], delAngVel1X, + V4MulAdd(header->angOrthoAxis1Y[1], delAngVel1Y, V4Mul(header->angOrthoAxis1Z[1], delAngVel1Z)))))), header->angOrthoRecipResponse[1]); + + const Vec4V proj2 = V4Mul(V4MulAdd(header->angOrthoAxis0X[2], delAngVel0X, V4MulAdd(header->angOrthoAxis0Y[2], delAngVel0Y, + V4MulAdd(header->angOrthoAxis0Z[2], delAngVel0Z, V4MulAdd(header->angOrthoAxis1X[2], delAngVel1X, + V4MulAdd(header->angOrthoAxis1Y[2], delAngVel1Y, V4Mul(header->angOrthoAxis1Z[2], delAngVel1Z)))))), header->angOrthoRecipResponse[2]); + + const Vec4V delta0X = V4MulAdd(header->angOrthoAxis0X[0], proj0, V4MulAdd(header->angOrthoAxis0X[1], proj1, V4Mul(header->angOrthoAxis0X[2], proj2))); + const Vec4V delta0Y = V4MulAdd(header->angOrthoAxis0Y[0], proj0, V4MulAdd(header->angOrthoAxis0Y[1], proj1, V4Mul(header->angOrthoAxis0Y[2], proj2))); + const Vec4V delta0Z = V4MulAdd(header->angOrthoAxis0Z[0], proj0, V4MulAdd(header->angOrthoAxis0Z[1], proj1, V4Mul(header->angOrthoAxis0Z[2], proj2))); + + const Vec4V delta1X = V4MulAdd(header->angOrthoAxis1X[0], proj0, V4MulAdd(header->angOrthoAxis1X[1], proj1, V4Mul(header->angOrthoAxis1X[2], proj2))); + const Vec4V delta1Y = V4MulAdd(header->angOrthoAxis1Y[0], proj0, V4MulAdd(header->angOrthoAxis1Y[1], proj1, V4Mul(header->angOrthoAxis1Y[2], proj2))); + const Vec4V delta1Z = V4MulAdd(header->angOrthoAxis1Z[0], proj0, V4MulAdd(header->angOrthoAxis1Z[1], proj1, V4Mul(header->angOrthoAxis1Z[2], proj2))); + + + delAngVel0X = V4NegMulSub(delta0X, angOrthoCoefficient, delAngVel0X); + delAngVel0Y = V4NegMulSub(delta0Y, angOrthoCoefficient, delAngVel0Y); + delAngVel0Z = V4NegMulSub(delta0Z, angOrthoCoefficient, delAngVel0Z); + + delAngVel1X = V4NegMulSub(delta1X, angOrthoCoefficient, delAngVel1X); + delAngVel1Y = V4NegMulSub(delta1Y, angOrthoCoefficient, delAngVel1Y); + delAngVel1Z = V4NegMulSub(delta1Z, angOrthoCoefficient, delAngVel1Z); + + err = V4Sub(err, V4Mul(V4MulAdd(error0, proj0, V4MulAdd(error1, proj1, V4Mul(error2, proj2))), angOrthoCoefficient)); + } + + Vec4V ang0IX = V4Mul(invInertia0X0, delAngVel0X); + Vec4V ang0IY = V4Mul(invInertia0X1, delAngVel0X); + Vec4V ang0IZ = V4Mul(invInertia0X2, delAngVel0X); + + ang0IX = V4MulAdd(invInertia0Y0, delAngVel0Y, ang0IX); + ang0IY = V4MulAdd(invInertia0Y1, delAngVel0Y, ang0IY); + ang0IZ = V4MulAdd(invInertia0Y2, delAngVel0Y, ang0IZ); + + ang0IX = V4MulAdd(invInertia0Z0, delAngVel0Z, ang0IX); + ang0IY = V4MulAdd(invInertia0Z1, delAngVel0Z, ang0IY); + ang0IZ = V4MulAdd(invInertia0Z2, delAngVel0Z, ang0IZ); + + Vec4V ang1IX = V4Mul(invInertia1X0, delAngVel1X); + Vec4V ang1IY = V4Mul(invInertia1X1, delAngVel1X); + Vec4V ang1IZ = V4Mul(invInertia1X2, delAngVel1X); + + ang1IX = V4MulAdd(invInertia1Y0, delAngVel1Y, ang1IX); + ang1IY = V4MulAdd(invInertia1Y1, delAngVel1Y, ang1IY); + ang1IZ = V4MulAdd(invInertia1Y2, delAngVel1Y, ang1IZ); + + ang1IX = V4MulAdd(invInertia1Z0, delAngVel1Z, ang1IX); + ang1IY = V4MulAdd(invInertia1Z1, delAngVel1Z, ang1IY); + ang1IZ = V4MulAdd(invInertia1Z2, delAngVel1Z, ang1IZ); + + + const Vec4V clinVel0X = c.lin0[0]; + const Vec4V clinVel0Y = c.lin0[1]; + const Vec4V clinVel0Z = c.lin0[2]; + + const Vec4V clinVel1X = c.lin1[0]; + const Vec4V clinVel1Y = c.lin1[1]; + const Vec4V clinVel1Z = c.lin1[2]; + + + const Vec4V clinVel0X_ = c.lin0[0]; + const Vec4V clinVel0Y_ = c.lin0[1]; + const Vec4V clinVel0Z_ = c.lin0[2]; + + const Vec4V clinVel1X_ = c.lin1[0]; + const Vec4V clinVel1Y_ = c.lin1[1]; + const Vec4V clinVel1Z_ = c.lin1[2]; + + + //KS - compute raXnI and effective mass. Unfortunately, the joints are noticeably less stable if we don't do this each + //iteration. It's skippable. If we do that, there's no need for the invInertiaTensors + + + + const Vec4V dotDelAngVel0 = V4MulAdd(delAngVel0X, delAngVel0X, V4MulAdd(delAngVel0Y, delAngVel0Y, V4Mul(delAngVel0Z, delAngVel0Z))); + const Vec4V dotDelAngVel1 = V4MulAdd(delAngVel1X, delAngVel1X, V4MulAdd(delAngVel1Y, delAngVel1Y, V4Mul(delAngVel1Z, delAngVel1Z))); + + const Vec4V dotRbXnAngDelta0 = V4MulAdd(delAngVel0X, angDelta0T0, V4MulAdd(delAngVel0Y, angDelta0T1, V4Mul(delAngVel0Z, angDelta0T2))); + const Vec4V dotRbXnAngDelta1 = V4MulAdd(delAngVel1X, angDelta1T0, V4MulAdd(delAngVel1Y, angDelta1T1, V4Mul(delAngVel1Z, angDelta1T2))); + + const Vec4V dotRaMotion = V4MulAdd(clinVel0X_, raMotionX, V4MulAdd(clinVel0Y_, raMotionY, V4Mul(clinVel0Z_, raMotionZ))); + const Vec4V dotRbMotion = V4MulAdd(clinVel1X_, rbMotionX, V4MulAdd(clinVel1Y_, rbMotionY, V4Mul(clinVel1Z_, rbMotionZ))); + + const Vec4V deltaAng = V4Mul(c.angularErrorScale, V4Sub(dotRbXnAngDelta0, dotRbXnAngDelta1)); + const Vec4V errorChange = V4NegScaleSub(c.velTarget, elapsedTime, V4Add(V4Sub(dotRaMotion, dotRbMotion), deltaAng)); + + const Vec4V dotClinVel0 = V4MulAdd(clinVel0X, clinVel0X, V4MulAdd(clinVel0Y, clinVel0Y, V4Mul(clinVel0Z, clinVel0Z))); + const Vec4V dotClinVel1 = V4MulAdd(clinVel1X, clinVel1X, V4MulAdd(clinVel1Y, clinVel1Y, V4Mul(clinVel1Z, clinVel1Z))); + + const Vec4V resp0 = V4MulAdd(mass0, dotClinVel0, V4Mul(invInertiaScale0, dotDelAngVel0)); + const Vec4V resp1 = V4MulAdd(mass1, dotClinVel1, V4Mul(invInertiaScale1, dotDelAngVel1)); + const Vec4V response = V4Add(resp0, resp1); + const Vec4V recipResponse = V4Sel(V4IsGrtr(response, V4Zero()), V4Recip(response), V4Zero()); + + + const Vec4V vMul = V4Mul(recipResponse, c.velMultiplier); + + const BoolV isLimitConstraint = VecI32V_IsEq(VecI32V_And(flags, limitMask), limitMask); + + const Vec4V minBias = V4Sel(isLimitConstraint, V4Neg(Vec4V_From_FloatV(FMax())), V4Neg(c.maxBias)); + const Vec4V unclampedBias = V4MulAdd(errorChange, c.biasScale, err); + const Vec4V bias = V4Clamp(unclampedBias, minBias, c.maxBias); + + const Vec4V constant = V4Mul(recipResponse, V4Add(bias, c.velTarget)); + + const Vec4V normalVel0 = V4MulAdd(clinVel0X_, linVel0T0, V4MulAdd(clinVel0Y_, linVel0T1, V4Mul(clinVel0Z_, linVel0T2))); + const Vec4V normalVel1 = V4MulAdd(clinVel1X_, linVel1T0, V4MulAdd(clinVel1Y_, linVel1T1, V4Mul(clinVel1Z_, linVel1T2))); + + const Vec4V angVel0 = V4MulAdd(delAngVel0X, angState0T0, V4MulAdd(delAngVel0Y, angState0T1, V4Mul(delAngVel0Z, angState0T2))); + const Vec4V angVel1 = V4MulAdd(delAngVel1X, angState1T0, V4MulAdd(delAngVel1Y, angState1T1, V4Mul(delAngVel1Z, angState1T2))); + + const Vec4V normalVel = V4Add(V4Sub(normalVel0, normalVel1), V4Sub(angVel0, angVel1)); + + + const Vec4V unclampedForce = V4Add(c.appliedForce, V4MulAdd(vMul, normalVel, constant)); + const Vec4V clampedForce = V4Clamp(unclampedForce, c.minImpulse, c.maxImpulse); + const Vec4V deltaF = V4Sub(clampedForce, c.appliedForce); + + c.appliedForce = clampedForce; + + const Vec4V deltaFIM0 = V4Mul(deltaF, mass0); + const Vec4V deltaFIM1 = V4Mul(deltaF, mass1); + const Vec4V angDetaF0 = V4Mul(deltaF, invInertiaScale0); + const Vec4V angDetaF1 = V4Mul(deltaF, invInertiaScale1); + + + linVel0T0 = V4MulAdd(clinVel0X_, deltaFIM0, linVel0T0); + linVel1T0 = V4NegMulSub(clinVel1X_, deltaFIM1, linVel1T0); + angState0T0 = V4MulAdd(delAngVel0X, angDetaF0, angState0T0); + angState1T0 = V4NegMulSub(delAngVel1X, angDetaF1, angState1T0); + + linVel0T1 = V4MulAdd(clinVel0Y_, deltaFIM0, linVel0T1); + linVel1T1 = V4NegMulSub(clinVel1Y_, deltaFIM1, linVel1T1); + angState0T1 = V4MulAdd(delAngVel0Y, angDetaF0, angState0T1); + angState1T1 = V4NegMulSub(delAngVel1Y, angDetaF1, angState1T1); + + linVel0T2 = V4MulAdd(clinVel0Z_, deltaFIM0, linVel0T2); + linVel1T2 = V4NegMulSub(clinVel1Z_, deltaFIM1, linVel1T2); + angState0T2 = V4MulAdd(delAngVel0Z, angDetaF0, angState0T2); + angState1T2 = V4NegMulSub(delAngVel1Z, angDetaF1, angState1T2); + + } + + PX_TRANSPOSE_44(linVel0T0, linVel0T1, linVel0T2, linVel0T3, linVel00, linVel10, linVel20, linVel30); + PX_TRANSPOSE_44(linVel1T0, linVel1T1, linVel1T2, linVel1T3, linVel01, linVel11, linVel21, linVel31); + PX_TRANSPOSE_44(angState0T0, angState0T1, angState0T2, angState0T3, angState00, angState10, angState20, angState30); + PX_TRANSPOSE_44(angState1T0, angState1T1, angState1T2, angState1T3, angState01, angState11, angState21, angState31); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularVelocity.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularVelocity.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularVelocity.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularVelocity.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularVelocity.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularVelocity.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularVelocity.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularVelocity.isFinite()); + + // Write back + V4StoreA(linVel00, &b00.linearVelocity.x); + V4StoreA(angState00, &b00.angularVelocity.x); + V4StoreA(linVel10, &b10.linearVelocity.x); + V4StoreA(angState10, &b10.angularVelocity.x); + V4StoreA(linVel20, &b20.linearVelocity.x); + V4StoreA(angState20, &b20.angularVelocity.x); + V4StoreA(linVel30, &b30.linearVelocity.x); + V4StoreA(angState30, &b30.angularVelocity.x); + + V4StoreA(linVel01, &b01.linearVelocity.x); + V4StoreA(angState01, &b01.angularVelocity.x); + V4StoreA(linVel11, &b11.linearVelocity.x); + V4StoreA(angState11, &b11.angularVelocity.x); + V4StoreA(linVel21, &b21.linearVelocity.x); + V4StoreA(angState21, &b21.angularVelocity.x); + V4StoreA(linVel31, &b31.linearVelocity.x); + V4StoreA(angState31, &b31.angularVelocity.x); + + PX_ASSERT(b00.linearVelocity.isFinite()); + PX_ASSERT(b00.angularVelocity.isFinite()); + PX_ASSERT(b10.linearVelocity.isFinite()); + PX_ASSERT(b10.angularVelocity.isFinite()); + PX_ASSERT(b20.linearVelocity.isFinite()); + PX_ASSERT(b20.angularVelocity.isFinite()); + PX_ASSERT(b30.linearVelocity.isFinite()); + PX_ASSERT(b30.angularVelocity.isFinite()); + + PX_ASSERT(b01.linearVelocity.isFinite()); + PX_ASSERT(b01.angularVelocity.isFinite()); + PX_ASSERT(b11.linearVelocity.isFinite()); + PX_ASSERT(b11.angularVelocity.isFinite()); + PX_ASSERT(b21.linearVelocity.isFinite()); + PX_ASSERT(b21.angularVelocity.isFinite()); + PX_ASSERT(b31.linearVelocity.isFinite()); + PX_ASSERT(b31.angularVelocity.isFinite()); +} + + +void solve1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, const PxTGSSolverBodyTxInertia* const txInertias, + const PxReal /*minPenetration*/, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + solve1DStep4(desc + hdr.startIndex, txInertias, elapsedTime); +} + +void writeBack1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext* /*cache*/) +{ + PX_UNUSED(hdr); + ConstraintWriteback* writeback0 = reinterpret_cast(desc[hdr.startIndex].writeBack); + ConstraintWriteback* writeback1 = reinterpret_cast(desc[hdr.startIndex + 1].writeBack); + ConstraintWriteback* writeback2 = reinterpret_cast(desc[hdr.startIndex + 2].writeBack); + ConstraintWriteback* writeback3 = reinterpret_cast(desc[hdr.startIndex + 3].writeBack); + + if (writeback0 || writeback1 || writeback2 || writeback3) + { + SolverConstraint1DHeaderStep4* header = reinterpret_cast(desc[hdr.startIndex].constraint); + SolverConstraint1DStep4* base = reinterpret_cast(desc[hdr.startIndex].constraint + sizeof(SolverConstraint1DHeaderStep4)); + + const Vec4V zero = V4Zero(); + Vec4V linX(zero), linY(zero), linZ(zero); + Vec4V angX(zero), angY(zero), angZ(zero); + + for (PxU32 i = 0; icount; i++) + { + const SolverConstraint1DStep4* c = base; + + //Load in flags + const VecI32V flags = I4LoadU(reinterpret_cast(&c->flags[0])); + //Work out masks + const VecI32V mask = I4Load(DY_SC_FLAG_OUTPUT_FORCE); + + const VecI32V masked = VecI32V_And(flags, mask); + const BoolV isEq = VecI32V_IsEq(masked, mask); + + const Vec4V appliedForce = V4Sel(isEq, c->appliedForce, zero); + + linX = V4MulAdd(c->lin0[0], appliedForce, linX); + linY = V4MulAdd(c->lin0[1], appliedForce, linY); + linZ = V4MulAdd(c->lin0[2], appliedForce, linZ); + + angX = V4MulAdd(c->ang0[0], appliedForce, angX); + angY = V4MulAdd(c->ang0[1], appliedForce, angY); + angZ = V4MulAdd(c->ang0[2], appliedForce, angZ); + + base++; + } + + //We need to do the cross product now + + angX = V4Sub(angX, V4NegMulSub(header->body0WorkOffset[0], linY, V4Mul(header->body0WorkOffset[1], linZ))); + angY = V4Sub(angY, V4NegMulSub(header->body0WorkOffset[1], linZ, V4Mul(header->body0WorkOffset[2], linX))); + angZ = V4Sub(angZ, V4NegMulSub(header->body0WorkOffset[2], linX, V4Mul(header->body0WorkOffset[0], linY))); + + const Vec4V linLenSq = V4MulAdd(linZ, linZ, V4MulAdd(linY, linY, V4Mul(linX, linX))); + const Vec4V angLenSq = V4MulAdd(angZ, angZ, V4MulAdd(angY, angY, V4Mul(angX, angX))); + + const Vec4V linLen = V4Sqrt(linLenSq); + const Vec4V angLen = V4Sqrt(angLenSq); + + const BoolV broken = BOr(V4IsGrtr(linLen, header->linBreakImpulse), V4IsGrtr(angLen, header->angBreakImpulse)); + + PX_ALIGN(16, PxU32 iBroken[4]); + BStoreA(broken, iBroken); + + Vec4V lin0, lin1, lin2, lin3; + Vec4V ang0, ang1, ang2, ang3; + + PX_TRANSPOSE_34_44(linX, linY, linZ, lin0, lin1, lin2, lin3); + PX_TRANSPOSE_34_44(angX, angY, angZ, ang0, ang1, ang2, ang3); + + if (writeback0) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin0), writeback0->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang0), writeback0->angularImpulse); + writeback0->broken = header->breakable[0] ? PxU32(iBroken[0] != 0) : 0; + } + if (writeback1) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin1), writeback1->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang1), writeback1->angularImpulse); + writeback1->broken = header->breakable[1] ? PxU32(iBroken[1] != 0) : 0; + } + if (writeback2) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin2), writeback2->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang2), writeback2->angularImpulse); + writeback2->broken = header->breakable[2] ? PxU32(iBroken[2] != 0) : 0; + } + if (writeback3) + { + V3StoreU(Vec3V_From_Vec4V_WUndefined(lin3), writeback3->linearImpulse); + V3StoreU(Vec3V_From_Vec4V_WUndefined(ang3), writeback3->angularImpulse); + writeback3->broken = header->breakable[3] ? PxU32(iBroken[3] != 0) : 0; + } + } +} + + +void concludeContact4_Block(const PxSolverConstraintDesc* PX_RESTRICT desc) +{ + PX_UNUSED(desc); + //const PxU8* PX_RESTRICT last = desc[0].constraint + getConstraintLength(desc[0]); + + ////hopefully pointer aliasing doesn't bite. + //PxU8* PX_RESTRICT currPtr = desc[0].constraint; + + //const Vec4V zero = V4Zero(); + + ////const PxU8 type = *desc[0].constraint; + //const PxU32 contactSize = sizeof(SolverContactPointStepBlock); + //const PxU32 frictionSize = sizeof(SolverContactFrictionStepBlock); + + //while ((currPtr < last)) + //{ + // SolverContactHeaderStepBlock* PX_RESTRICT hdr = reinterpret_cast(currPtr); + + // currPtr = reinterpret_cast(hdr + 1); + + // const PxU32 numNormalConstr = hdr->numNormalConstr; + // const PxU32 numFrictionConstr = hdr->numFrictionConstr; + + // //Applied forces + // currPtr += sizeof(Vec4V)*numNormalConstr; + + // //SolverContactPointStepBlock* PX_RESTRICT contacts = reinterpret_cast(currPtr); + // currPtr += (numNormalConstr * contactSize); + + // bool hasMaxImpulse = (hdr->flag & SolverContactHeader4::eHAS_MAX_IMPULSE) != 0; + + // if (hasMaxImpulse) + // currPtr += sizeof(Vec4V) * numNormalConstr; + + // currPtr += sizeof(Vec4V)*numFrictionConstr; + + // SolverContactFrictionStepBlock* PX_RESTRICT frictions = reinterpret_cast(currPtr); + // currPtr += (numFrictionConstr * frictionSize); + + // /*for (PxU32 i = 0; iconstraint; + if (bPtr == NULL) + return; + + + const SolverConstraint1DHeaderStep4* PX_RESTRICT header = reinterpret_cast(bPtr); + SolverConstraint1DStep4* PX_RESTRICT base = reinterpret_cast(bPtr + sizeof(SolverConstraint1DHeaderStep4)); + + const VecI32V mask = I4Load(DY_SC_FLAG_KEEP_BIAS); + const Vec4V zero = V4Zero(); + + for (PxU32 i = 0; icount; ++i, base++) + { + PxPrefetchLine(base + 1); + SolverConstraint1DStep4& c = *base; + + const VecI32V flags = I4LoadA(reinterpret_cast(c.flags)); + + const BoolV keepBias = VecI32V_IsEq(VecI32V_And(flags, mask), mask); + + c.biasScale = V4Sel(keepBias, c.biasScale, zero); + c.error = V4Sel(keepBias, c.error, zero); + } +} + + +void solveConcludeContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const /*txInertias*/, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + solveContact4_Block(desc + hdr.startIndex, true, -PX_MAX_F32, elapsedTime); + concludeContact4_Block(desc + hdr.startIndex); +} + +void solveConclude1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& /*cache*/) +{ + solve1DStep4(desc + hdr.startIndex, txInertias, elapsedTime); + conclude1DStep4(desc + hdr.startIndex); +} + + + + + + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp new file mode 100644 index 0000000..b047400 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.cpp @@ -0,0 +1,3407 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxTime.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxSIMDHelpers.h" +#include "PxvDynamics.h" + +#include "common/PxProfileZone.h" +#include "PxsRigidBody.h" +#include "PxsContactManager.h" +#include "DyTGSDynamics.h" +#include "DyBodyCoreIntegrator.h" +#include "DySolverCore.h" +#include "DySolverControl.h" +#include "DySolverContact.h" +#include "DySolverContactPF.h" +#include "DyArticulationContactPrep.h" +#include "DySolverBody.h" + +#include "DyConstraintPrep.h" +#include "DyConstraintPartition.h" + +#include "CmFlushPool.h" +#include "DyArticulationPImpl.h" +#include "PxsMaterialManager.h" +#include "DySolverContactPF4.h" +#include "DyContactReduction.h" +#include "PxcNpContactPrepShared.h" +#include "DyContactPrep.h" +#include "DySolverControlPF.h" +#include "PxSceneDesc.h" +#include "PxsSimpleIslandManager.h" +#include "PxvNphaseImplementationContext.h" +#include "PxsContactManagerState.h" +#include "DyContactPrepShared.h" +#include "DySolverContext.h" +#include "DyDynamics.h" +#include "DySolverConstraint1D.h" +#include "PxvSimStats.h" +#include "DyTGSContactPrep.h" +#include "DyFeatherstoneArticulation.h" + +#define PX_USE_BLOCK_SOLVER 1 +#define PX_USE_BLOCK_1D 1 + +namespace physx +{ +namespace Dy +{ + + + static inline void waitForBodyProgress(PxTGSSolverBodyVel& body, const PxU32 desiredProgress, const PxU32 iteration) + { + const PxI32 target = PxI32(desiredProgress + body.maxDynamicPartition * iteration); + + volatile PxI32* progress = reinterpret_cast(&body.partitionMask); + + WAIT_FOR_PROGRESS(progress, target); + } + + static inline void incrementBodyProgress(PxTGSSolverBodyVel& body) + { + if (body.maxDynamicPartition != 0) + (*reinterpret_cast(&body.partitionMask))++; + } + + static inline void waitForArticulationProgress(Dy::FeatherstoneArticulation& artic, const PxU32 desiredProgress, const PxU32 iteration) + { + const PxI32 target = PxI32(desiredProgress + artic.maxSolverFrictionProgress * iteration); + + volatile PxI32* progress = reinterpret_cast(&artic.solverProgress); + + WAIT_FOR_PROGRESS(progress, target); + } + + static inline void incrementArticulationProgress(Dy::FeatherstoneArticulation& artic) + { + (*reinterpret_cast(&artic.solverProgress))++; + } + + static inline void waitForProgresses(const PxSolverConstraintDesc& desc, const PxU32 iteration) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + waitForBodyProgress(*desc.tgsBodyA, desc.progressA, iteration); + else + waitForArticulationProgress(*getArticulationA(desc), desc.progressA, iteration); + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + waitForBodyProgress(*desc.tgsBodyB, desc.progressB, iteration); + else + waitForArticulationProgress(*getArticulationB(desc), desc.progressB, iteration); + } + + static inline void incrementProgress(const PxSolverConstraintDesc& desc) + { + if (desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY) + { + incrementBodyProgress(*desc.tgsBodyA); + } + else + incrementArticulationProgress(*getArticulationA(desc)); + if (desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY) + incrementBodyProgress(*desc.tgsBodyB); + else if(desc.articulationA != desc.articulationB) + incrementArticulationProgress(*getArticulationB(desc)); + } + +Context* createTGSDynamicsContext(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, Cm::FlushPool& taskPool, + PxvSimStats& simStats, PxTaskManager* taskManager, PxVirtualAllocatorCallback* allocatorCallback, PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, PxU64 contextID, + const bool enableStabilization, const bool useEnhancedDeterminism, + const PxReal lengthScale + ) +{ + return DynamicsTGSContext::create(memBlockPool, scratchAllocator, taskPool, simStats, taskManager, allocatorCallback, materialManager, islandManager, + contextID, enableStabilization, useEnhancedDeterminism, lengthScale); +} + +// PT: TODO: consider removing this function. We already have "createDynamicsContext". +DynamicsTGSContext* DynamicsTGSContext::create(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocatorCallback, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal lengthScale + ) +{ + // PT: TODO: inherit from UserAllocated, remove placement new + DynamicsTGSContext* dc = reinterpret_cast(PX_ALLOC(sizeof(DynamicsTGSContext), "DynamicsTGSContext")); + if (dc) + { + PX_PLACEMENT_NEW(dc, DynamicsTGSContext(memBlockPool, scratchAllocator, taskPool, simStats, taskManager, allocatorCallback, materialManager, islandManager, contextID, enableStabilization, useEnhancedDeterminism, lengthScale)); + } + return dc; +} + +void DynamicsTGSContext::destroy() +{ + this->~DynamicsTGSContext(); + PX_FREE_THIS; +} + +void DynamicsTGSContext::resetThreadContexts() +{ + PxcThreadCoherentCacheIterator threadContextIt(mThreadContextPool); + ThreadContext* threadContext = threadContextIt.getNext(); + + while (threadContext != NULL) + { + threadContext->reset(); + threadContext = threadContextIt.getNext(); + } +} + +PX_FORCE_INLINE PxVec3 safeRecip(const PxVec3& v) +{ + return PxVec3(v.x == 0.f ? 0.f : 1.f/v.x, v.y == 0.f ? 0.f : 1.f/v.y, v.z == 0.f ? 0.f : 1.f/v.z); +} + +void copyToSolverBodyDataStep(const PxVec3& linearVelocity, const PxVec3& angularVelocity, const PxReal invMass, const PxVec3& invInertia, const PxTransform& globalPose, + const PxReal maxDepenetrationVelocity, const PxReal maxContactImpulse, const PxU32 nodeIndex, const PxReal reportThreshold, + const PxReal maxAngVelSq, PxU32 lockFlags, bool isKinematic, + PxTGSSolverBodyVel& solverVel, PxTGSSolverBodyTxInertia& solverBodyTxInertia, PxTGSSolverBodyData& solverBodyData, const PxReal dt, + const bool gyroscopicForces) +{ + const PxMat33Padded rotation(globalPose.q); + + const PxVec3 sqrtInvInertia = computeSafeSqrtInertia(invInertia); + + const PxVec3 sqrtBodySpaceInertia = safeRecip(sqrtInvInertia); + + Cm::transformInertiaTensor(sqrtInvInertia, rotation, solverBodyTxInertia.sqrtInvInertia); + + solverBodyTxInertia.deltaBody2World.p = globalPose.p; + solverBodyTxInertia.deltaBody2World.q = PxQuat(PxIdentity); + + PxMat33 sqrtInertia; + Cm::transformInertiaTensor(sqrtBodySpaceInertia, rotation, sqrtInertia); + + PxVec3 lv = linearVelocity; + PxVec3 av = angularVelocity; + + + if (gyroscopicForces) + { + + const PxVec3 localInertia( + invInertia.x == 0.f ? 0.f : 1.f / invInertia.x, + invInertia.y == 0.f ? 0.f : 1.f / invInertia.y, + invInertia.z == 0.f ? 0.f : 1.f / invInertia.z); + + + PxVec3 localAngVel = globalPose.q.rotateInv(av); + PxVec3 origMom = localInertia.multiply(localAngVel); + PxVec3 torque = -localAngVel.cross(origMom); + PxVec3 newMom = origMom + torque * dt; + const PxReal denom = newMom.magnitude(); + PxReal ratio = denom > 0.f ? origMom.magnitude() / denom : 0.f; + newMom *= ratio; + PxVec3 newDeltaAngVel = globalPose.q.rotate(invInertia.multiply(newMom) - localAngVel); + av += newDeltaAngVel; + + } + + if (lockFlags) + { + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + lv.x = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + lv.y = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + lv.z = 0.f; + + //KS - technically, we can zero the inertia columns and produce stiffer constraints. However, this can cause numerical issues with the + //joint solver, which is fixed by disabling joint preprocessing and setting minResponseThreshold to some reasonable value > 0. However, until + //this is handled automatically, it's probably better not to zero these inertia rows + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + { + av.x = 0.f; + //data.sqrtInvInertia.column0 = PxVec3(0.f); + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + { + av.y = 0.f; + //data.sqrtInvInertia.column1 = PxVec3(0.f); + } + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + { + av.z = 0.f; + //data.sqrtInvInertia.column2 = PxVec3(0.f); + } + } + + solverVel.linearVelocity = lv; + solverVel.angularVelocity = sqrtInertia * av; + solverVel.deltaLinDt = PxVec3(0.f); + solverVel.deltaAngDt = PxVec3(0.f); + solverVel.lockFlags = PxU16(lockFlags); + solverVel.isKinematic = isKinematic; + solverVel.maxAngVel = PxSqrt(maxAngVelSq); + solverVel.partitionMask = 0; + + + + solverBodyData.nodeIndex = nodeIndex; + solverBodyData.invMass = invMass; + solverBodyData.penBiasClamp = maxDepenetrationVelocity; + solverBodyData.maxContactImpulse = maxContactImpulse; + solverBodyData.reportThreshold = reportThreshold; + solverBodyData.originalLinearVelocity = lv; + solverBodyData.originalAngularVelocity = av; + + PX_ASSERT(lv.isFinite()); + PX_ASSERT(av.isFinite()); +} + + + +void copyToSolverBodyDataStepKinematic(const PxVec3& linearVelocity, const PxVec3& angularVelocity, const PxTransform& globalPose, + const PxReal maxDepenetrationVelocity, const PxReal maxContactImpulse, const PxU32 nodeIndex, const PxReal reportThreshold, + const PxReal maxAngVelSq, + PxTGSSolverBodyVel& solverVel, PxTGSSolverBodyTxInertia& solverBodyTxInertia, PxTGSSolverBodyData& solverBodyData) +{ + const PxMat33Padded rotation(globalPose.q); + + solverBodyTxInertia.deltaBody2World.p = globalPose.p; + solverBodyTxInertia.deltaBody2World.q = PxQuat(PxIdentity); + + solverBodyTxInertia.sqrtInvInertia = PxMat33(PxVec3(0.f), PxVec3(0.f), PxVec3(0.f)); + + solverVel.linearVelocity = PxVec3(0.f); + solverVel.angularVelocity = PxVec3(0.f); + solverVel.deltaLinDt = PxVec3(0.f); + solverVel.deltaAngDt = PxVec3(0.f); + solverVel.lockFlags = 0; + solverVel.isKinematic = true; + solverVel.maxAngVel = PxSqrt(maxAngVelSq); + solverVel.partitionMask = 0; + solverVel.nbStaticInteractions = 0; + solverVel.maxDynamicPartition = 0; + + solverBodyData.nodeIndex = nodeIndex; + solverBodyData.invMass = 0.f; + solverBodyData.penBiasClamp = maxDepenetrationVelocity; + solverBodyData.maxContactImpulse = maxContactImpulse; + solverBodyData.reportThreshold = reportThreshold; + solverBodyData.originalLinearVelocity = linearVelocity; + solverBodyData.originalAngularVelocity = angularVelocity; +} + + +// =========================== Basic methods + + +DynamicsTGSContext::DynamicsTGSContext(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocatorCallback, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal lengthScale + ) : + Dy::Context(islandManager, allocatorCallback, simStats, enableStabilization, useEnhancedDeterminism, PX_MAX_F32, lengthScale), + mThreadContextPool(memBlockPool), + mMaterialManager(materialManager), + mScratchAllocator(scratchAllocator), + mTaskPool(taskPool), + mTaskManager(taskManager), + mContextID(contextID) +{ + createThresholdStream(*allocatorCallback); + createForceChangeThresholdStream(*allocatorCallback); + mExceededForceThresholdStream[0] = PX_NEW(ThresholdStream)(*allocatorCallback); + mExceededForceThresholdStream[1] = PX_NEW(ThresholdStream)(*allocatorCallback); + mThresholdStreamOut = 0; + mCurrentIndex = 0; + + PxMemZero(&mWorldSolverBodyVel, sizeof(mWorldSolverBodyVel)); + + mWorldSolverBodyVel.lockFlags = 0; + mWorldSolverBodyVel.isKinematic = false; + mWorldSolverBodyTxInertia.sqrtInvInertia = PxMat33(PxZero); + mWorldSolverBodyTxInertia.deltaBody2World = PxTransform(PxIdentity); + + mWorldSolverBodyData2.penBiasClamp = -PX_MAX_REAL; + mWorldSolverBodyData2.maxContactImpulse = PX_MAX_REAL; + mWorldSolverBodyData2.nodeIndex = PX_INVALID_NODE; + mWorldSolverBodyData2.invMass = 0; + mWorldSolverBodyData2.reportThreshold = PX_MAX_REAL; + mWorldSolverBodyData2.originalLinearVelocity = PxVec3(0.f); + mWorldSolverBodyData2.originalAngularVelocity = PxVec3(0.f); +} + +DynamicsTGSContext::~DynamicsTGSContext() +{ + PX_DELETE(mExceededForceThresholdStream[1]); + PX_DELETE(mExceededForceThresholdStream[0]); +} + +void DynamicsTGSContext::setDescFromIndices(PxSolverConstraintDesc& desc, const IG::IslandSim& islandSim, + const PxsIndexedInteraction& constraint, const PxU32 solverBodyOffset, PxTGSSolverBodyVel* solverBodies) +{ + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eBODY == 0); + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eKINEMATIC == 1); + const PxU32 offsetMap[] = { solverBodyOffset, 0 }; + //const PxU32 offsetMap[] = {mKinematicCount, 0}; + + if (constraint.indexType0 == PxsIndexedInteraction::eARTICULATION) + { + const PxNodeIndex& nodeIndex0 = reinterpret_cast(constraint.articulation0); + const IG::Node& node0 = islandSim.getNode(nodeIndex0); + desc.articulationA = node0.getArticulation(); + desc.linkIndexA = nodeIndex0.articulationLinkId(); + desc.bodyADataIndex = 0; + } + else + { + desc.tgsBodyA = constraint.indexType0 == PxsIndexedInteraction::eWORLD ? &mWorldSolverBodyVel + : &solverBodies[PxU32(constraint.solverBody0) + offsetMap[constraint.indexType0] + 1]; + + desc.bodyADataIndex = constraint.indexType0 == PxsIndexedInteraction::eWORLD ? 0 + : PxU32(constraint.solverBody0) + offsetMap[constraint.indexType0] + 1; + + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + + if (constraint.indexType1 == PxsIndexedInteraction::eARTICULATION) + { + const PxNodeIndex& nodeIndex1 = reinterpret_cast(constraint.articulation1); + const IG::Node& node1 = islandSim.getNode(nodeIndex1); + desc.articulationB = node1.getArticulation(); + desc.linkIndexB = nodeIndex1.articulationLinkId();// PxTo8(getLinkIndex(constraint.articulation1)); + desc.bodyBDataIndex = 0; + } + else + { + desc.tgsBodyB = constraint.indexType1 == PxsIndexedInteraction::eWORLD ? &mWorldSolverBodyVel + : &solverBodies[PxU32(constraint.solverBody1) + offsetMap[constraint.indexType1] + 1]; + + desc.bodyBDataIndex = constraint.indexType1 == PxsIndexedInteraction::eWORLD ? 0 + : PxU32(constraint.solverBody1) + offsetMap[constraint.indexType1] + 1; + + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } +} + +void DynamicsTGSContext::setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeIndex edgeIndex, const IG::SimpleIslandManager& islandManager, + PxU32* bodyRemap, const PxU32 solverBodyOffset, PxTGSSolverBodyVel* solverBodies) +{ + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eBODY == 0); + PX_COMPILE_TIME_ASSERT(PxsIndexedInteraction::eKINEMATIC == 1); + + const IG::IslandSim& islandSim = islandManager.getAccurateIslandSim(); + + PxNodeIndex node1 = islandSim.getNodeIndex1(edgeIndex); + if (node1.isStaticBody()) + { + desc.tgsBodyA = &mWorldSolverBodyVel; + desc.bodyADataIndex = 0; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + else + { + const IG::Node& node = islandSim.getNode(node1); + + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + PX_ASSERT(node1.isArticulation()); + + Dy::FeatherstoneArticulation* a = islandSim.getLLArticulation(node1); + PxU8 type; + + a->fillIndexType(node1.articulationLinkId(),type); + + if (type == PxsIndexedInteraction::eARTICULATION) + { + desc.articulationA = a; + desc.linkIndexA = node1.articulationLinkId(); + } + else + { + desc.tgsBodyA = &mWorldSolverBodyVel; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + + desc.bodyADataIndex = 0; + } + else + { + PX_ASSERT(!node1.isArticulation()); + PxU32 activeIndex = islandSim.getActiveNodeIndex(node1); + PxU32 index = node.isKinematic() ? activeIndex : bodyRemap[activeIndex] + solverBodyOffset; + desc.tgsBodyA = &solverBodies[index + 1]; + desc.bodyADataIndex = index + 1; + desc.linkIndexA = PxSolverConstraintDesc::RIGID_BODY; + } + } + + PxNodeIndex node2 = islandSim.getNodeIndex2(edgeIndex); + if (node2.isStaticBody()) + { + desc.tgsBodyB = &mWorldSolverBodyVel; + desc.bodyBDataIndex = 0; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + else + { + const IG::Node& node = islandSim.getNode(node2); + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + PX_ASSERT(node2.isArticulation()); + Dy::FeatherstoneArticulation* b = islandSim.getLLArticulation(node2); + + PxU8 type; + + b->fillIndexType(node2.articulationLinkId(), type); + + if (type == PxsIndexedInteraction::eARTICULATION) + { + desc.articulationB = b; + desc.linkIndexB = node2.articulationLinkId(); + } + else + { + desc.tgsBodyB = &mWorldSolverBodyVel; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + + desc.bodyBDataIndex = 0; + } + else + { + PX_ASSERT(!node2.isArticulation()); + PxU32 activeIndex = islandSim.getActiveNodeIndex(node2); + PxU32 index = node.isKinematic() ? activeIndex : bodyRemap[activeIndex] + solverBodyOffset; + desc.tgsBodyB = &solverBodies[index + 1]; + desc.bodyBDataIndex = index + 1; + desc.linkIndexB = PxSolverConstraintDesc::RIGID_BODY; + } + } +} + +class DynamicsMergeTask : public Cm::Task +{ + PxBaseTask* mSecondContinuation; + +public: + DynamicsMergeTask(PxU64 contextId) : Cm::Task(contextId), mSecondContinuation(NULL) + { + } + + void setSecondContinuation(PxBaseTask* task) { task->addReference(); mSecondContinuation = task; } + + virtual const char* getName() const { return "MergeTask"; } + + virtual void runInternal() + { + } + + virtual void release() + { + mSecondContinuation->removeReference(); + Cm::Task::release(); + } + +}; + +class KinematicCopyTGSTask : public Cm::Task +{ + const PxNodeIndex* const mKinematicIndices; + const PxU32 mNbKinematics; + const IG::IslandSim& mIslandSim; + PxTGSSolverBodyVel* mVels; + PxTGSSolverBodyTxInertia* mInertia; + PxTGSSolverBodyData* mBodyData; + + PX_NOCOPY(KinematicCopyTGSTask) + +public: + + static const PxU32 NbKinematicsPerTask = 1024; + + KinematicCopyTGSTask(const PxNodeIndex* const kinematicIndices, + const PxU32 nbKinematics, const IG::IslandSim& islandSim, PxTGSSolverBodyVel* vels, + PxTGSSolverBodyTxInertia* inertias, PxTGSSolverBodyData* datas, PxU64 contextID) : Cm::Task(contextID), + mKinematicIndices(kinematicIndices), mNbKinematics(nbKinematics), + mIslandSim(islandSim), mVels(vels), mInertia(inertias), mBodyData(datas) + { + } + + virtual const char* getName() const { return "KinematicCopyTask"; } + + virtual void runInternal() + { + for (PxU32 i = 0; igetCore(); + copyToSolverBodyDataStepKinematic(core.linearVelocity, core.angularVelocity, core.body2World, core.maxPenBias, + core.maxContactImpulse, mKinematicIndices[i].index(), core.contactReportThreshold, core.maxAngularVelocitySq, + mVels[i], mInertia[i], mBodyData[i]); + + rigidBody->saveLastCCDTransform(); + } + } +}; + +class UpdateContinuationTGSTask : public Cm::Task +{ + DynamicsTGSContext& mContext; + IG::SimpleIslandManager& mSimpleIslandManager; + PxBaseTask* mLostTouchTask; + PxU32 mMaxArticulationLinks; + + PX_NOCOPY(UpdateContinuationTGSTask) +public: + + UpdateContinuationTGSTask(DynamicsTGSContext& context, + IG::SimpleIslandManager& simpleIslandManager, + PxBaseTask* lostTouchTask, + PxU64 contextID, const PxU32 maxLinks) : Cm::Task(contextID), mContext(context), mSimpleIslandManager(simpleIslandManager), + mLostTouchTask(lostTouchTask), mMaxArticulationLinks(maxLinks) + { + } + + virtual const char* getName() const { return "UpdateContinuationTask";} + + virtual void runInternal() + { + mContext.updatePostKinematic(mSimpleIslandManager, mCont, mLostTouchTask, mMaxArticulationLinks); + //Allow lost touch task to run once all tasks have be scheduled + mLostTouchTask->removeReference(); + } + +}; + + +void DynamicsTGSContext::update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask, + PxvNphaseImplementationContext* nphase, + const PxU32 /*maxPatchesPerCM*/, const PxU32 maxArticulationLinks, + const PxReal dt, const PxVec3& gravity, PxBitMapPinned& /*changedHandleMap*/) +{ + PX_PROFILE_ZONE("Dynamics.solverQueueTasks", mContextID); + + PX_UNUSED(simpleIslandManager); + + mOutputIterator = nphase->getContactManagerOutputs(); + + //const PxU32 nbSubsteps = 16; + + mDt = dt; + mInvDt = 1.f / dt; + + mGravity = gravity; + + const IG::IslandSim& islandSim = simpleIslandManager.getAccurateIslandSim(); + + const PxU32 islandCount = islandSim.getNbActiveIslands(); + + const PxU32 activatedContactCount = islandSim.getNbActivatedEdges(IG::Edge::eCONTACT_MANAGER); + const IG::EdgeIndex* const activatingEdges = islandSim.getActivatedEdges(IG::Edge::eCONTACT_MANAGER); + + for (PxU32 a = 0; a < activatedContactCount; ++a) + { + PxsContactManager* cm = simpleIslandManager.getContactManager(activatingEdges[a]); + if (cm) + { + cm->getWorkUnit().frictionPatchCount = 0; //KS - zero the friction patch count on any activating edges + } + } + +#if PX_ENABLE_SIM_STATS + if (islandCount > 0) + { + mSimStats.mNbActiveKinematicBodies = islandSim.getNbActiveKinematics(); + mSimStats.mNbActiveDynamicBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + mSimStats.mNbActiveConstraints = islandSim.getNbActiveEdges(IG::Edge::eCONSTRAINT); + } + else + { + mSimStats.mNbActiveKinematicBodies = islandSim.getNbActiveKinematics(); + mSimStats.mNbActiveDynamicBodies = 0; + mSimStats.mNbActiveConstraints = 0; + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + mThresholdStreamOut = 0; + + resetThreadContexts(); + + //If there is no work to do then we can do nothing at all. + if (0 == islandCount) + { + return; + } + + //Block to make sure it doesn't run before stage2 of update! + lostTouchTask->addReference(); + + UpdateContinuationTGSTask* task = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(UpdateContinuationTGSTask)), UpdateContinuationTGSTask) + (*this, simpleIslandManager, lostTouchTask, mContextID, maxArticulationLinks); + + task->setContinuation(continuation); + + //KS - test that world solver body's velocities are finite and 0, then set it to 0. + //Technically, the velocity should always be 0 but can be stomped if a NAN creeps into the simulation. + PX_ASSERT(mWorldSolverBodyVel.linearVelocity == PxVec3(0.f)); + PX_ASSERT(mWorldSolverBodyVel.angularVelocity == PxVec3(0.f)); + PX_ASSERT(mWorldSolverBodyVel.linearVelocity.isFinite()); + PX_ASSERT(mWorldSolverBodyVel.angularVelocity.isFinite()); + + mWorldSolverBodyVel.linearVelocity = mWorldSolverBodyVel.angularVelocity = PxVec3(0.f); + + const PxU32 kinematicCount = islandSim.getNbActiveKinematics(); + const PxNodeIndex* const kinematicIndices = islandSim.getActiveKinematics(); + mKinematicCount = kinematicCount; + + const PxU32 bodyCount = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + PxU32 numArtics = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE); + + { + if (kinematicCount + bodyCount > mSolverBodyVelPool.capacity()) + { + mSolverBodyRemapTable.reserve((kinematicCount + bodyCount + 31 + 1) & ~31); + mSolverBodyVelPool.reserve((kinematicCount + bodyCount +31 + 1) & ~31); + mSolverBodyTxInertiaPool.reserve((kinematicCount + bodyCount +31 + 1) & ~31); + mSolverBodyDataPool2.reserve((kinematicCount + bodyCount +31 + 1) & ~31); + } + + { + mSolverBodyVelPool.resize(kinematicCount + bodyCount +1); + mSolverBodyTxInertiaPool.resize(kinematicCount + bodyCount +1); + mSolverBodyDataPool2.resize(kinematicCount + bodyCount +1); + mSolverBodyRemapTable.resize(kinematicCount + bodyCount + 1); + } + + // integrate and copy all the kinematics - overkill, since not all kinematics + // need solver bodies + + mSolverBodyVelPool[0] = mWorldSolverBodyVel; + mSolverBodyTxInertiaPool[0] = mWorldSolverBodyTxInertia; + mSolverBodyDataPool2[0] = mWorldSolverBodyData2; + + + { + PX_PROFILE_ZONE("Dynamics.updateKinematics", mContextID); + for (PxU32 i = 0; i < kinematicCount; i+= KinematicCopyTGSTask::NbKinematicsPerTask) + { + const PxU32 nbToProcess = PxMin(kinematicCount - i, KinematicCopyTGSTask::NbKinematicsPerTask); + + KinematicCopyTGSTask* kinematicTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(KinematicCopyTGSTask)), KinematicCopyTGSTask) + (kinematicIndices + i, nbToProcess, islandSim, &mSolverBodyVelPool[i+1], + &mSolverBodyTxInertiaPool[i + 1], &mSolverBodyDataPool2[i + 1], mContextID); + + kinematicTask->setContinuation(task); + kinematicTask->removeReference(); + } + } + } + + + PxU32 numArticulationConstraints = numArtics* maxArticulationLinks; //Just allocate enough memory to fit worst-case maximum size articulations... + + const PxU32 nbActiveContactManagers = islandSim.getNbActiveEdges(IG::Edge::eCONTACT_MANAGER); + const PxU32 nbActiveConstraints = islandSim.getNbActiveEdges(IG::Edge::eCONSTRAINT); + + PxU32 totalConstraintCount = nbActiveConstraints + nbActiveContactManagers + numArticulationConstraints; + + mSolverConstraintDescPool.forceSize_Unsafe(0); + mSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mOrderedSolverConstraintDescPool.forceSize_Unsafe(0); + mOrderedSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mOrderedSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mContactConstraintBatchHeaders.forceSize_Unsafe(0); + mContactConstraintBatchHeaders.reserve((totalConstraintCount + 63) & (~63)); + mContactConstraintBatchHeaders.forceSize_Unsafe(totalConstraintCount); + + mTempSolverConstraintDescPool.forceSize_Unsafe(0); + mTempSolverConstraintDescPool.reserve((totalConstraintCount + 63) & (~63)); + mTempSolverConstraintDescPool.forceSize_Unsafe(totalConstraintCount); + + mContactList.forceSize_Unsafe(0); + mContactList.reserve((nbActiveContactManagers + 63u) & (~63u)); + mContactList.forceSize_Unsafe(nbActiveContactManagers); + + mMotionVelocityArray.forceSize_Unsafe(0); + mMotionVelocityArray.reserve((bodyCount + 63u) & (~63u)); + mMotionVelocityArray.forceSize_Unsafe(bodyCount); + + mBodyCoreArray.forceSize_Unsafe(0); + mBodyCoreArray.reserve((bodyCount + 63u) & (~63u)); + mBodyCoreArray.forceSize_Unsafe(bodyCount); + + mRigidBodyArray.forceSize_Unsafe(0); + mRigidBodyArray.reserve((bodyCount + 63u) & (~63u)); + mRigidBodyArray.forceSize_Unsafe(bodyCount); + + mArticulationArray.forceSize_Unsafe(0); + mArticulationArray.reserve((numArtics + 63u) & (~63u)); + mArticulationArray.forceSize_Unsafe(numArtics); + + mNodeIndexArray.forceSize_Unsafe(0); + mNodeIndexArray.reserve((bodyCount + 63u) & (~63u)); + mNodeIndexArray.forceSize_Unsafe(bodyCount); + + + + + ThresholdStream& stream = getThresholdStream(); + stream.forceSize_Unsafe(0); + stream.reserve(PxNextPowerOfTwo(nbActiveContactManagers != 0 ? nbActiveContactManagers - 1 : nbActiveContactManagers)); + + + + //flip exceeded force threshold buffer + mCurrentIndex = 1 - mCurrentIndex; + + task->removeReference(); + +} + +void DynamicsTGSContext::updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, + PxBaseTask* lostTouchTask, const PxU32 maxLinks) +{ + const IG::IslandSim& islandSim = simpleIslandManager.getAccurateIslandSim(); + + const IG::IslandId*const islandIds = islandSim.getActiveIslands(); + + DynamicsMergeTask* mergeTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(DynamicsMergeTask)), DynamicsMergeTask)(mContextID); + + mergeTask->setContinuation(continuation); + mergeTask->setSecondContinuation(lostTouchTask); + + //PxReal dt = mDt; + + PxU32 currentIsland = 0; + PxU32 currentBodyIndex = 0; + PxU32 currentArticulation = 0; + PxU32 currentContact = 0; + + PxU32 constraintIndex = 0; + + const PxU32 minIslandSize = mSolverBatchSize; + + const PxU32 islandCount = islandSim.getNbActiveIslands(); + + const PxU32 articulationBatchSize = mSolverArticBatchSize; + + //while(startremoveReference(); +} + +void DynamicsTGSContext::prepareBodiesAndConstraints(const SolverIslandObjectsStep& objects, + IG::SimpleIslandManager& islandManager, + IslandContextStep& islandContext) +{ + Dy::ThreadContext& mThreadContext = *islandContext.mThreadContext; + + mThreadContext.mMaxSolverPositionIterations = 0; + mThreadContext.mMaxSolverVelocityIterations = 0; + mThreadContext.mAxisConstraintCount = 0; + mThreadContext.mContactDescPtr = mThreadContext.contactConstraintDescArray; + mThreadContext.mFrictionDescPtr = mThreadContext.frictionConstraintDescArray.begin(); + mThreadContext.mNumDifferentBodyConstraints = 0; + mThreadContext.mNumStaticConstraints = 0; + mThreadContext.mNumSelfConstraints = 0; + mThreadContext.mNumDifferentBodyFrictionConstraints = 0; + mThreadContext.mNumSelfConstraintFrictionBlocks = 0; + mThreadContext.mNumSelfFrictionConstraints = 0; + mThreadContext.numContactConstraintBatches = 0; + mThreadContext.contactDescArraySize = 0; + + mThreadContext.motionVelocityArray = objects.motionVelocities; + mThreadContext.mBodyCoreArray = objects.bodyCoreArray; + mThreadContext.mRigidBodyArray = objects.bodies; + mThreadContext.mArticulationArray = objects.articulations; + mThreadContext.bodyRemapTable = objects.bodyRemapTable; + mThreadContext.mNodeIndexArray = objects.nodeIndexArray; + + const PxU32 frictionConstraintCount = 0; + mThreadContext.resizeArrays(frictionConstraintCount, islandContext.mCounts.articulations); + + PxsBodyCore** PX_RESTRICT bodyArrayPtr = mThreadContext.mBodyCoreArray; + PxsRigidBody** PX_RESTRICT rigidBodyPtr = mThreadContext.mRigidBodyArray; + FeatherstoneArticulation** PX_RESTRICT articulationPtr = mThreadContext.mArticulationArray; + PxU32* PX_RESTRICT bodyRemapTable = mThreadContext.bodyRemapTable; + PxU32* PX_RESTRICT nodeIndexArray = mThreadContext.mNodeIndexArray; + + PxU32 nbIslands = objects.numIslands; + const IG::IslandId* const islandIds = objects.islandIds; + + const IG::IslandSim& islandSim = islandManager.getAccurateIslandSim(); + + PxU32 bodyIndex = 0, articIndex = 0; + for (PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + PxNodeIndex currentIndex = island.mRootNode; + + while (currentIndex.isValid()) + { + const IG::Node& node = islandSim.getNode(currentIndex); + + if (node.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + articulationPtr[articIndex++] = node.getArticulation(); + } + else + { + PxsRigidBody* rigid = node.getRigidBody(); + PX_ASSERT(bodyIndex < (islandContext.mCounts.bodies + mKinematicCount + 1)); + rigidBodyPtr[bodyIndex] = rigid; + bodyArrayPtr[bodyIndex] = &rigid->getCore(); + nodeIndexArray[bodyIndex] = currentIndex.index(); + bodyRemapTable[islandSim.getActiveNodeIndex(currentIndex)] = bodyIndex++; + } + + currentIndex = node.mNextNode; + } + } + + + PxsIndexedContactManager* indexedManagers = objects.contactManagers; + + PxU32 currentContactIndex = 0; + for (PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + IG::EdgeIndex contactEdgeIndex = island.mFirstEdge[IG::Edge::eCONTACT_MANAGER]; + + while (contactEdgeIndex != IG_INVALID_EDGE) + { + const IG::Edge& edge = islandSim.getEdge(contactEdgeIndex); + + PxsContactManager* contactManager = islandManager.getContactManager(contactEdgeIndex); + + if (contactManager) + { + const PxNodeIndex nodeIndex1 = islandSim.getNodeIndex1(contactEdgeIndex); + const PxNodeIndex nodeIndex2 = islandSim.getNodeIndex2(contactEdgeIndex); + + PxsIndexedContactManager& indexedManager = indexedManagers[currentContactIndex++]; + indexedManager.contactManager = contactManager; + + PX_ASSERT(!nodeIndex1.isStaticBody()); + { + const IG::Node& node1 = islandSim.getNode(nodeIndex1); + + //Is it an articulation or not??? + if (node1.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + indexedManager.articulation0 = nodeIndex1.getInd(); + const PxU32 linkId = nodeIndex1.articulationLinkId(); + node1.getArticulation()->fillIndexType(linkId, indexedManager.indexType0); + } + else + { + if (node1.isKinematic()) + { + indexedManager.indexType0 = PxsIndexedInteraction::eKINEMATIC; + indexedManager.solverBody0 = islandSim.getActiveNodeIndex(nodeIndex1); + } + else + { + indexedManager.indexType0 = PxsIndexedInteraction::eBODY; + indexedManager.solverBody0 = bodyRemapTable[islandSim.getActiveNodeIndex(nodeIndex1)]; + } + PX_ASSERT(indexedManager.solverBody0 < (islandContext.mCounts.bodies + mKinematicCount + 1)); + } + + } + + if (nodeIndex2.isStaticBody()) + { + indexedManager.indexType1 = PxsIndexedInteraction::eWORLD; + } + else + { + const IG::Node& node2 = islandSim.getNode(nodeIndex2); + + //Is it an articulation or not??? + if (node2.getNodeType() == IG::Node::eARTICULATION_TYPE) + { + indexedManager.articulation1 = nodeIndex2.getInd(); + const PxU32 linkId = nodeIndex2.articulationLinkId(); + node2.getArticulation()->fillIndexType(linkId, indexedManager.indexType1); + } + else + { + if (node2.isKinematic()) + { + indexedManager.indexType1 = PxsIndexedInteraction::eKINEMATIC; + indexedManager.solverBody1 = islandSim.getActiveNodeIndex(nodeIndex2); + } + else + { + indexedManager.indexType1 = PxsIndexedInteraction::eBODY; + indexedManager.solverBody1 = bodyRemapTable[islandSim.getActiveNodeIndex(nodeIndex2)]; + } + PX_ASSERT(indexedManager.solverBody1 < (islandContext.mCounts.bodies + mKinematicCount + 1)); + } + } + + } + contactEdgeIndex = edge.mNextIslandEdge; + } + } + + islandContext.mCounts.contactManagers = currentContactIndex; +} + +struct ConstraintLess +{ + bool operator()(const PxSolverConstraintDesc& left, const PxSolverConstraintDesc& right) const + { + return reinterpret_cast(left.constraint)->index > reinterpret_cast(right.constraint)->index; + } +}; + +void DynamicsTGSContext::setupDescs(IslandContextStep& mIslandContext, const SolverIslandObjectsStep& mObjects, + PxU32* mBodyRemapTable, PxU32 mSolverBodyOffset, PxsContactManagerOutputIterator& outputs) +{ + PX_UNUSED(outputs); + ThreadContext& mThreadContext = *mIslandContext.mThreadContext; + PxSolverConstraintDesc* contactDescPtr = mObjects.constraintDescs; + + //PxU32 constraintCount = mCounts.constraints + mCounts.contactManagers; + + PxU32 nbIslands = mObjects.numIslands; + const IG::IslandId* const islandIds = mObjects.islandIds; + + const IG::IslandSim& islandSim = mIslandManager->getAccurateIslandSim(); + + for (PxU32 i = 0; i < nbIslands; ++i) + { + const IG::Island& island = islandSim.getIsland(islandIds[i]); + + IG::EdgeIndex edgeId = island.mFirstEdge[IG::Edge::eCONSTRAINT]; + + while (edgeId != IG_INVALID_EDGE) + { + PxSolverConstraintDesc& desc = *contactDescPtr; + + const IG::Edge& edge = islandSim.getEdge(edgeId); + Dy::Constraint* constraint = mIslandManager->getConstraint(edgeId); + setDescFromIndices(desc, edgeId, *mIslandManager, mBodyRemapTable, mSolverBodyOffset, + mSolverBodyVelPool.begin()); + desc.constraint = reinterpret_cast(constraint); + desc.constraintLengthOver16 = DY_SC_TYPE_RB_1D; + contactDescPtr++; + edgeId = edge.mNextIslandEdge; + } + + } + + PxSort(mObjects.constraintDescs, PxU32(contactDescPtr - mObjects.constraintDescs), ConstraintLess()); + + if (mIslandContext.mCounts.contactManagers) + { + { + for (PxU32 a = 0; a < mIslandContext.mCounts.contactManagers; ++a) + { + //PxsContactManagerOutput& output = outputs.getContactManager(mObjects.contactManagers[a].contactManager->getWorkUnit().mNpIndex); + //if (output.nbContacts > 0) + { + PxSolverConstraintDesc& desc = *contactDescPtr; + setDescFromIndices(desc, islandSim, mObjects.contactManagers[a], mSolverBodyOffset, mSolverBodyVelPool.begin()); + desc.constraint = reinterpret_cast(mObjects.contactManagers[a].contactManager); + desc.constraintLengthOver16 = DY_SC_TYPE_RB_CONTACT; + contactDescPtr++; + } + //else + //{ + // //Clear friction state! + // mObjects.contactManagers[a].contactManager->getWorkUnit().frictionDataPtr = NULL; + // mObjects.contactManagers[a].contactManager->getWorkUnit().frictionPatchCount = 0; + //} + } + + } + } + mThreadContext.contactDescArraySize = PxU32(contactDescPtr - mObjects.constraintDescs); +} + +void DynamicsTGSContext::preIntegrateBodies(PxsBodyCore** bodyArray, PxsRigidBody** originalBodyArray, + PxTGSSolverBodyVel* solverBodyVelPool, PxTGSSolverBodyTxInertia* solverBodyTxInertia, PxTGSSolverBodyData* solverBodyDataPool2, PxU32* nodeIndexArray, const PxU32 bodyCount, const PxVec3& gravity, const PxReal dt, PxU32& posIters, PxU32& velIters, PxU32 /*iteration*/) +{ + PX_PROFILE_ZONE("PreIntegrate", mContextID); + PxU32 localMaxPosIter = 0; + PxU32 localMaxVelIter = 0; + for (PxU32 i = 0; i < bodyCount; ++i) + { + PxsBodyCore& core = *bodyArray[i]; + const PxsRigidBody& rBody = *originalBodyArray[i]; + + PxU16 iterWord = core.solverIterationCounts; + localMaxPosIter = PxMax(PxU32(iterWord & 0xff), localMaxPosIter); + localMaxVelIter = PxMax(PxU32(iterWord >> 8), localMaxVelIter); + + //const Cm::SpatialVector& accel = originalBodyArray[i]->getAccelerationV(); + bodyCoreComputeUnconstrainedVelocity(gravity, dt, core.linearDamping, core.angularDamping, rBody.accelScale, core.maxLinearVelocitySq, core.maxAngularVelocitySq, + core.linearVelocity, core.angularVelocity, core.disableGravity!=0); + + copyToSolverBodyDataStep(core.linearVelocity, core.angularVelocity, core.inverseMass, core.inverseInertia, core.body2World, core.maxPenBias, core.maxContactImpulse, nodeIndexArray[i], + core.contactReportThreshold, core.maxAngularVelocitySq, core.lockFlags, false, + solverBodyVelPool[i+1], solverBodyTxInertia[i+1], solverBodyDataPool2[i+1], dt, core.mFlags & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES); + } + + posIters = localMaxPosIter; + velIters = localMaxVelIter; +} + +void DynamicsTGSContext::createSolverConstraints(PxSolverConstraintDesc* contactDescPtr, PxConstraintBatchHeader* headers, const PxU32 nbHeaders, + PxsContactManagerOutputIterator& outputs, Dy::ThreadContext& islandThreadContext, Dy::ThreadContext& threadContext, PxReal stepDt, PxReal totalDt, PxReal invStepDt, + const PxReal biasCoefficient, PxI32 velIters) +{ + PX_UNUSED(totalDt); + //PX_PROFILE_ZONE("CreateConstraints", 0); + PxTransform idt(PxIdentity); + + BlockAllocator blockAllocator(islandThreadContext.mConstraintBlockManager, threadContext.mConstraintBlockStream, threadContext.mFrictionPatchStreamPair, threadContext.mConstraintSize); + + PxTGSSolverBodyTxInertia* txInertias = mSolverBodyTxInertiaPool.begin(); + PxTGSSolverBodyData* solverBodyDatas = mSolverBodyDataPool2.begin(); + + const PxReal invTotalDt = 1.f / totalDt; + PxReal denom = (totalDt); + if (velIters) + denom += stepDt; + const PxReal invTotalDtPlusStep = 1.f / denom; + + for (PxU32 h = 0; h < nbHeaders; ++h) + { + PxConstraintBatchHeader& hdr = headers[h]; + PxU32 startIdx = hdr.startIndex; + PxU32 endIdx = startIdx + hdr.stride; + + if (contactDescPtr[startIdx].constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT) + { + PxTGSSolverContactDesc blockDescs[4]; + PxsContactManagerOutput* cmOutputs[4]; + PxsContactManager* cms[4]; + + for (PxU32 a = startIdx, i = 0; a < endIdx; ++a, i++) + { + PxSolverConstraintDesc& desc = contactDescPtr[a]; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + + PxTGSSolverContactDesc& blockDesc = blockDescs[i]; + + cms[i] = cm; + + PxcNpWorkUnit& unit = cm->getWorkUnit(); + + PxsContactManagerOutput* cmOutput = &outputs.getContactManager(unit.mNpIndex); + + cmOutputs[i] = cmOutput; + + PxTGSSolverBodyVel& b0 = *desc.tgsBodyA; + PxTGSSolverBodyVel& b1 = *desc.tgsBodyB; + + PxTGSSolverBodyTxInertia& txI0 = txInertias[desc.bodyADataIndex]; + PxTGSSolverBodyTxInertia& txI1 = txInertias[desc.bodyBDataIndex]; + + PxTGSSolverBodyData& data0 = solverBodyDatas[desc.bodyADataIndex]; + PxTGSSolverBodyData& data1 = solverBodyDatas[desc.bodyBDataIndex]; + + blockDesc.body0 = &b0; + blockDesc.body1 = &b1; + blockDesc.bodyFrame0 = unit.rigidCore0->body2World; + blockDesc.bodyFrame1 = unit.rigidCore1->body2World; + blockDesc.shapeInteraction = cm->getShapeInteraction(); + blockDesc.contactForces = cmOutput->contactForces; + blockDesc.desc = &desc; + blockDesc.body0 = &b0; + blockDesc.body1 = &b1; + blockDesc.body0TxI = &txI0; + blockDesc.body1TxI = &txI1; + blockDesc.bodyData0 = &data0; + blockDesc.bodyData1 = &data1; + blockDesc.hasForceThresholds = !!(unit.flags & PxcNpWorkUnitFlag::eFORCE_THRESHOLD); + blockDesc.disableStrongFriction = !!(unit.flags & PxcNpWorkUnitFlag::eDISABLE_STRONG_FRICTION); + blockDesc.bodyState0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? PxSolverContactDesc::eARTICULATION : PxSolverContactDesc::eDYNAMIC_BODY; + if (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) + { + //kinematic link + if (desc.linkIndexB == 0xff) + { + blockDesc.bodyState1 = PxSolverContactDesc::eSTATIC_BODY; + } + else + { + blockDesc.bodyState1 = PxSolverContactDesc::eARTICULATION; + } + } + else + { + blockDesc.bodyState1 = (unit.flags & PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR) ? PxSolverContactDesc::eKINEMATIC_BODY : + ((unit.flags & PxcNpWorkUnitFlag::eDYNAMIC_BODY1) ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eSTATIC_BODY); + } + + //blockDesc.flags = unit.flags; + + PxReal maxImpulse0 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY0) ? static_cast(unit.rigidCore0)->maxContactImpulse : data0.maxContactImpulse; + PxReal maxImpulse1 = (unit.flags & PxcNpWorkUnitFlag::eARTICULATION_BODY1) ? static_cast(unit.rigidCore1)->maxContactImpulse : data1.maxContactImpulse; + + PxReal dominance0 = unit.dominance0 ? 1.f : 0.f; + PxReal dominance1 = unit.dominance1 ? 1.f : 0.f; + + blockDesc.invMassScales.linear0 = blockDesc.invMassScales.angular0 = dominance0; + blockDesc.invMassScales.linear1 = blockDesc.invMassScales.angular1 = dominance1; + blockDesc.restDistance = unit.restDistance; + blockDesc.frictionPtr = unit.frictionDataPtr; + blockDesc.frictionCount = unit.frictionPatchCount; + blockDesc.maxCCDSeparation = PX_MAX_F32; + blockDesc.maxImpulse = PxMin(maxImpulse0, maxImpulse1); + blockDesc.torsionalPatchRadius = unit.mTorsionalPatchRadius; + blockDesc.minTorsionalPatchRadius = unit.mMinTorsionalPatchRadius; + blockDesc.offsetSlop = unit.mOffsetSlop; + } + + SolverConstraintPrepState::Enum buildState = SolverConstraintPrepState::eUNBATCHABLE; + +#if PX_USE_BLOCK_SOLVER + if (hdr.stride == 4) + { + buildState = createFinalizeSolverContacts4Step( + cmOutputs, + threadContext, + blockDescs, + invStepDt, + totalDt, + invTotalDtPlusStep, + stepDt, + mBounceThreshold, + mFrictionOffsetThreshold, + mCorrelationDistance, + biasCoefficient, + blockAllocator); + } +#endif + + if (buildState != SolverConstraintPrepState::eSUCCESS) + { + + for (PxU32 a = startIdx, i = 0; a < endIdx; ++a, i++) + { + PxSolverConstraintDesc& desc = contactDescPtr[a]; + PxsContactManager* cm = reinterpret_cast(desc.constraint); + //PxcNpWorkUnit& n = cm->getWorkUnit(); + + PxsContactManagerOutput& output = *cmOutputs[i]; + //PX_ASSERT(output.nbContacts != 0); + + createFinalizeSolverContactsStep(blockDescs[i], output, threadContext, + invStepDt, invTotalDtPlusStep, totalDt, stepDt, mBounceThreshold, mFrictionOffsetThreshold, mCorrelationDistance, biasCoefficient, + blockAllocator); + + getContactManagerConstraintDesc(output, *cm, desc); + + //PX_ASSERT(desc.constraint != NULL); + } + } + + for (PxU32 i = 0; i < hdr.stride; ++i) + { + PxsContactManager* cm = cms[i]; + + PxcNpWorkUnit& unit = cm->getWorkUnit(); + unit.frictionDataPtr = blockDescs[i].frictionPtr; + unit.frictionPatchCount = blockDescs[i].frictionCount; + + } + + } + else if (contactDescPtr[startIdx].constraintLengthOver16 == DY_SC_TYPE_RB_1D) + { + SolverConstraintShaderPrepDesc shaderPrepDescs[4]; + PxTGSSolverConstraintPrepDesc prepDescs[4]; + + for (PxU32 a = startIdx, i = 0; a < endIdx; ++a, i++) + { + SolverConstraintShaderPrepDesc& shaderPrepDesc = shaderPrepDescs[i]; + PxTGSSolverConstraintPrepDesc& prepDesc = prepDescs[i]; + + const PxTransform id(PxIdentity); + + { + PxSolverConstraintDesc& desc = contactDescPtr[a]; + const Constraint* constraint = reinterpret_cast(desc.constraint); + + const PxConstraintSolverPrep solverPrep = constraint->solverPrep; + const void* constantBlock = constraint->constantBlock; + const PxU32 constantBlockByteSize = constraint->constantBlockSize; + const PxTransform& pose0 = (constraint->body0 ? constraint->body0->getPose() : id); + const PxTransform& pose1 = (constraint->body1 ? constraint->body1->getPose() : id); + const PxTGSSolverBodyVel* sbody0 = desc.tgsBodyA; + const PxTGSSolverBodyVel* sbody1 = desc.tgsBodyB; + + PxTGSSolverBodyTxInertia& txI0 = txInertias[desc.bodyADataIndex]; + PxTGSSolverBodyTxInertia& txI1 = txInertias[desc.bodyBDataIndex]; + + PxTGSSolverBodyData& data0 = solverBodyDatas[desc.bodyADataIndex]; + PxTGSSolverBodyData& data1 = solverBodyDatas[desc.bodyBDataIndex]; + + shaderPrepDesc.constantBlock = constantBlock; + shaderPrepDesc.constantBlockByteSize = constantBlockByteSize; + shaderPrepDesc.constraint = constraint; + shaderPrepDesc.solverPrep = solverPrep; + + prepDesc.desc = &desc; + prepDesc.bodyFrame0 = pose0; + prepDesc.bodyFrame1 = pose1; + prepDesc.body0 = sbody0; + prepDesc.body1 = sbody1; + prepDesc.body0TxI = &txI0; + prepDesc.body1TxI = &txI1; + prepDesc.bodyData0 = &data0; + prepDesc.bodyData1 = &data1; + prepDesc.linBreakForce = constraint->linBreakForce; + prepDesc.angBreakForce = constraint->angBreakForce; + prepDesc.writeback = &getConstraintWriteBackPool()[constraint->index]; + setupConstraintFlags(prepDesc, constraint->flags); + prepDesc.minResponseThreshold = constraint->minResponseThreshold; + + prepDesc.bodyState0 = desc.linkIndexA == PxSolverConstraintDesc::RIGID_BODY ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eARTICULATION; + prepDesc.bodyState1 = desc.linkIndexB == PxSolverConstraintDesc::RIGID_BODY ? PxSolverContactDesc::eDYNAMIC_BODY : PxSolverContactDesc::eARTICULATION; + } + } + + SolverConstraintPrepState::Enum buildState = SolverConstraintPrepState::eUNBATCHABLE; + +#if PX_USE_BLOCK_SOLVER +#if PX_USE_BLOCK_1D + if (hdr.stride == 4) + { + PxU32 totalRows; + buildState = setupSolverConstraintStep4 + (shaderPrepDescs, prepDescs, stepDt, totalDt, invStepDt, invTotalDt, totalRows, blockAllocator, mLengthScale, biasCoefficient); + } +#endif +#endif + + if (buildState != SolverConstraintPrepState::eSUCCESS) + { + for (PxU32 a = startIdx, i = 0; a < endIdx; ++a, i++) + { + PxReal clampedInvDt = invStepDt; + SetupSolverConstraintStep(shaderPrepDescs[i], prepDescs[i], blockAllocator, stepDt, totalDt, clampedInvDt, invTotalDt, mLengthScale, + biasCoefficient); + } + } + } + } +} + + + +void solveContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + +void solve1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + +void solveExtContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertia, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + +void solveExt1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + +void solveContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, const PxTGSSolverBodyTxInertia* const txInertias, + const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + +void solve1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, const PxTGSSolverBodyTxInertia* const txInertias, + const PxReal minPenetration, const PxReal elapsedTime, SolverContext& cache); + + +TGSSolveBlockMethod g_SolveTGSMethods[] = +{ + 0, + solveContactBlock, // DY_SC_TYPE_RB_CONTACT + solve1DBlock, // DY_SC_TYPE_RB_1D + solveExtContactBlock, // DY_SC_TYPE_EXT_CONTACT + solveExt1DBlock, // DY_SC_TYPE_EXT_1D + solveContactBlock, // DY_SC_TYPE_STATIC_CONTACT + solveContactBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveContact4, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveContact4, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solve1D4, // DY_SC_TYPE_BLOCK_1D, +}; + +void writeBackContact(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, SolverContext* cache); + +void writeBack1D(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, SolverContext* cache); + +void writeBackContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext* cache); + +void writeBack1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* PX_RESTRICT desc, SolverContext* cache); + +TGSWriteBackMethod g_WritebackTGSMethods[] = +{ + 0, + writeBackContact, // DY_SC_TYPE_RB_CONTACT + writeBack1D, // DY_SC_TYPE_RB_1D + writeBackContact, // DY_SC_TYPE_EXT_CONTACT + writeBack1D, // DY_SC_TYPE_EXT_1D + writeBackContact, // DY_SC_TYPE_STATIC_CONTACT + writeBackContact, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + writeBackContact4, // DY_SC_TYPE_BLOCK_RB_CONTACT + writeBackContact4, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + writeBack1D4, // DY_SC_TYPE_BLOCK_1D, +}; + +void solveConclude1DBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +void solveConcludeContactBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +void solveConcludeContact4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +void solveConclude1D4(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +void solveConcludeContactExtBlock(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +void solveConclude1DBlockExt(const PxConstraintBatchHeader& hdr, const PxSolverConstraintDesc* desc, + const PxTGSSolverBodyTxInertia* const txInertias, const PxReal elapsedTime, SolverContext& cache); + +TGSSolveConcludeMethod g_SolveConcludeTGSMethods[] = +{ + 0, + solveConcludeContactBlock, // DY_SC_TYPE_RB_CONTACT + solveConclude1DBlock, // DY_SC_TYPE_RB_1D + solveConcludeContactExtBlock, // DY_SC_TYPE_EXT_CONTACT + solveConclude1DBlockExt, // DY_SC_TYPE_EXT_1D + solveConcludeContactBlock, // DY_SC_TYPE_STATIC_CONTACT + solveConcludeContactBlock, // DY_SC_TYPE_NOFRICTION_RB_CONTACT + solveConcludeContact4, // DY_SC_TYPE_BLOCK_RB_CONTACT + solveConcludeContact4, // DY_SC_TYPE_BLOCK_STATIC_RB_CONTACT + solveConclude1D4, // DY_SC_TYPE_BLOCK_1D, +}; + + + +void DynamicsTGSContext::solveConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, + PxReal invStepDt, const PxTGSSolverBodyTxInertia* const solverTxInertia, const PxReal elapsedTime, const PxReal minPenetration, SolverContext& cache) +{ + PX_UNUSED(invStepDt); + PX_UNUSED(solverTxInertia); + + for (PxU32 h = 0; h < nbHeaders; ++h) + { + const PxConstraintBatchHeader& hdr = batchHeaders[h]; + g_SolveTGSMethods[hdr.constraintType](hdr, contactDescPtr, solverTxInertia, minPenetration, elapsedTime, cache); + } + +} + +template +void DynamicsTGSContext::parallelSolveConstraints(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, + PxTGSSolverBodyTxInertia* solverTxInertia, const PxReal elapsedTime, const PxReal minPenetration, + SolverContext& cache, const PxU32 iterCount) +{ + PX_UNUSED(solverTxInertia); + for (PxU32 h = 0; h < nbHeaders; ++h) + { + const PxConstraintBatchHeader& hdr = batchHeaders[h]; + + const PxSolverConstraintDesc& desc = contactDescPtr[hdr.startIndex]; + + if (TSync) + { + PX_ASSERT(hdr.stride == 1); + waitForProgresses(desc, iterCount); + } + + g_SolveTGSMethods[hdr.constraintType](hdr, contactDescPtr, solverTxInertia, minPenetration, elapsedTime, cache); + + if (TSync) + { + PxMemoryBarrier(); + incrementProgress(desc); + } + } + +} + + +void DynamicsTGSContext::writebackConstraintsIteration(const PxConstraintBatchHeader* const hdrs, const PxSolverConstraintDesc* const contactDescPtr, const PxU32 nbHeaders) +{ + PX_PROFILE_ZONE("Writeback", mContextID); + + for (PxU32 h = 0; h < nbHeaders; ++h) + { + const PxConstraintBatchHeader& hdr = hdrs[h]; + + g_WritebackTGSMethods[hdr.constraintType](hdr, contactDescPtr, NULL); + } +} + +void DynamicsTGSContext::parallelWritebackConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders) +{ + for (PxU32 h = 0; h < nbHeaders; ++h) + { + const PxConstraintBatchHeader& hdr = batchHeaders[h]; + + g_WritebackTGSMethods[hdr.constraintType](hdr, contactDescPtr, NULL); + } +} + + + +template +void DynamicsTGSContext::solveConcludeConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, + const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, PxTGSSolverBodyTxInertia* solverTxInertia, + const PxReal elapsedTime, SolverContext& cache, const PxU32 iterCount) +{ + for (PxU32 h = 0; h < nbHeaders; ++h) + { + const PxConstraintBatchHeader& hdr = batchHeaders[h]; + + const PxSolverConstraintDesc& desc = contactDescPtr[hdr.startIndex]; + if (TSync) + waitForProgresses(desc, iterCount); + + g_SolveConcludeTGSMethods[hdr.constraintType](hdr, contactDescPtr, solverTxInertia, elapsedTime, cache); + + if (TSync) + { + PxMemoryBarrier(); + incrementProgress(desc); + } + } +} + + +void integrateCoreStep(PxTGSSolverBodyVel& vel, PxTGSSolverBodyTxInertia& txInertia, const PxF32 dt) +{ + PxU32 lockFlags = vel.lockFlags; + if (lockFlags) + { + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + vel.linearVelocity.x = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + vel.linearVelocity.y = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + vel.linearVelocity.z = 0.f; + + //The angular velocity should be 0 because it is now impossible to make it rotate around that axis! + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + vel.angularVelocity.x = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + vel.angularVelocity.y = 0.f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + vel.angularVelocity.z = 0.f; + } + + PxVec3 linearMotionVel = vel.linearVelocity; + const PxVec3 delta = linearMotionVel * dt; + + + PxVec3 unmolestedAngVel = vel.angularVelocity; + PxVec3 angularMotionVel = txInertia.sqrtInvInertia * vel.angularVelocity; + PxReal w2 = angularMotionVel.magnitudeSquared(); + txInertia.deltaBody2World.p += delta; + PX_ASSERT(txInertia.deltaBody2World.p.isFinite()); + + + // Integrate the rotation using closed form quaternion integrator + if (w2 != 0.0f) + { + PxReal w = PxSqrt(w2); + + //KS - we allow a little bit more angular velocity than the default + //maxAngVel member otherwise the simulation feels a little flimsy + /*const PxReal maxW = PxMax(50.f, vel.maxAngVel); + + if (w > maxW) + { + PxReal ratio = maxW / w; + + vel.angularVelocity *= ratio; + }*/ + + const PxReal v = dt * w * 0.5f; + PxReal s, q; + PxSinCos(v, s, q); + s /= w; + + const PxVec3 pqr = angularMotionVel * s; + const PxQuat quatVel(pqr.x, pqr.y, pqr.z, 0); + PxQuat result = quatVel * txInertia.deltaBody2World.q; + + result += txInertia.deltaBody2World.q * q; + + txInertia.deltaBody2World.q = result.getNormalized(); + PX_ASSERT(txInertia.deltaBody2World.q.isSane()); + PX_ASSERT(txInertia.deltaBody2World.q.isFinite()); + + //Accumulate the angular rotations in a space we can project the angular constraints to + } + + vel.deltaAngDt += unmolestedAngVel * dt; + vel.deltaLinDt += delta; + + /*solverBodyData.body2World = txInertia.body2World; + solverBodyData.deltaLinDt = vel.deltaLinDt; + solverBodyData.deltaAngDt = vel.deltaAngDt;*/ +} + + +void averageVelocity(PxTGSSolverBodyVel& vel, const PxF32 invDt, const PxReal ratio) +{ + const PxVec3 frameLinVel = vel.deltaLinDt*invDt; + const PxVec3 frameAngVel = vel.deltaAngDt*invDt; + + if (frameLinVel.magnitudeSquared() < vel.linearVelocity.magnitudeSquared() || frameAngVel.magnitudeSquared() < vel.angularVelocity.magnitudeSquared()) + { + const PxReal otherRatio = 1.f - ratio; + + vel.linearVelocity = (vel.linearVelocity*ratio + frameLinVel*otherRatio); + vel.angularVelocity = (vel.angularVelocity*ratio + frameAngVel*otherRatio); + } +} + + +void DynamicsTGSContext::integrateBodies(const SolverIslandObjectsStep& /*objects*/, + const PxU32 count, PxTGSSolverBodyVel* PX_RESTRICT vels, PxTGSSolverBodyTxInertia* PX_RESTRICT txInertias, + const PxTGSSolverBodyData*const PX_RESTRICT /*bodyDatas*/, PxReal dt, PxReal invTotalDt, bool average, + const PxReal ratio) +{ + for (PxU32 k = 0; k < count; k++) + { + integrateCoreStep(vels[k + 1], txInertias[k + 1], dt); + if (average) + averageVelocity(vels[k + 1], invTotalDt, ratio); + } +} + +void DynamicsTGSContext::parallelIntegrateBodies(PxTGSSolverBodyVel* vels, PxTGSSolverBodyTxInertia* txInertias, + const PxTGSSolverBodyData* const /*bodyDatas*/, const PxU32 count, PxReal dt, const PxU32 iteration, PxReal invTotalDt, bool average, + const PxReal ratio) +{ + PX_UNUSED(iteration); + for (PxU32 k = 0; k < count; k++) + { + PX_ASSERT(vels[k + 1].partitionMask == (iteration * vels[k + 1].maxDynamicPartition)); + integrateCoreStep(vels[k + 1], txInertias[k + 1], dt); + if (average) + averageVelocity(vels[k + 1], invTotalDt, ratio); + + } +} + +void DynamicsTGSContext::copyBackBodies(const SolverIslandObjectsStep& objects, + PxTGSSolverBodyVel* vels, PxTGSSolverBodyTxInertia* txInertias, + PxTGSSolverBodyData* solverBodyDatas, PxReal invDt, IG::IslandSim& islandSim, + PxU32 startIdx, PxU32 endIdx) +{ + for (PxU32 k = startIdx; k < endIdx; k++) + { + //PxStepSolverBody& solverBodyData = solverBodyData2[k + 1]; + PxTGSSolverBodyVel& solverBodyVel = vels[k + 1]; + PxTGSSolverBodyTxInertia& solverBodyTxI = txInertias[k + 1]; + PxTGSSolverBodyData& solverBodyData = solverBodyDatas[k + 1]; + + const Cm::SpatialVector motionVel(solverBodyVel.deltaLinDt*invDt, solverBodyTxI.sqrtInvInertia*(solverBodyVel.deltaAngDt*invDt)); + + PxsRigidBody& rBody = *objects.bodies[k]; + PxsBodyCore& core = rBody.getCore(); + rBody.mLastTransform = core.body2World; + core.body2World.q = (solverBodyTxI.deltaBody2World.q * core.body2World.q).getNormalized(); + core.body2World.p = solverBodyTxI.deltaBody2World.p; + /*core.linearVelocity = (solverBodyVel.linearVelocity); + core.angularVelocity = solverBodyTxI.sqrtInvInertia*(solverBodyVel.angularVelocity);*/ + + PxVec3 linearVelocity = (solverBodyVel.linearVelocity); + PxVec3 angularVelocity = solverBodyTxI.sqrtInvInertia*(solverBodyVel.angularVelocity); + + core.linearVelocity = linearVelocity; + core.angularVelocity = angularVelocity; + + bool hasStaticTouch = islandSim.getIslandStaticTouchCount(PxNodeIndex(solverBodyData.nodeIndex)) != 0; + sleepCheck(&rBody, mDt, invDt, mEnableStabilization, motionVel, + hasStaticTouch); + } +} + + +void DynamicsTGSContext::stepArticulations(Dy::ThreadContext& threadContext, const PxsIslandIndices& counts, PxReal dt, PxReal totalInvDt) +{ + for (PxU32 a = 0; a < counts.articulations; ++a) + { + ArticulationSolverDesc& d = threadContext.getArticulations()[a]; + //if(d.articulation->numTotalConstraints > 0) + //d.articulation->solveInternalConstraints(dt, 1.f / dt, threadContext.mZVector.begin(), threadContext.mDeltaV.begin(), false); + ArticulationPImpl::updateDeltaMotion(d, dt, threadContext.mDeltaV.begin(), totalInvDt); + + } +} + +void DynamicsTGSContext::updateArticulations(Dy::ThreadContext& threadContext, const PxU32 startIdx, const PxU32 endIdx, PxReal dt) +{ + for (PxU32 a = startIdx; a < endIdx; ++a) + { + ArticulationSolverDesc& d = threadContext.getArticulations()[a]; + ArticulationPImpl::updateBodiesTGS(d, threadContext.mDeltaV.begin(), dt); + } +} + +class ArticulationTask : public Cm::Task +{ + Dy::DynamicsTGSContext& mContext; + ArticulationSolverDesc* mDescs; + PxU32 mNbDescs; + PxVec3 mGravity; + PxReal mDt; + + PX_NOCOPY(ArticulationTask) + +public: + static const PxU32 MaxNbPerTask = 32; + + ArticulationTask(Dy::DynamicsTGSContext& context, ArticulationSolverDesc* descs, const PxU32 nbDescs, const PxVec3& gravity, + PxReal dt, PxU64 contextId) : Cm::Task(contextId), mContext(context), + mDescs(descs), mNbDescs(nbDescs), mGravity(gravity), mDt(dt) + { + } + + virtual const char* getName() const { return "ArticulationTask"; } + + virtual void runInternal() + { + PxU32 maxLinks = 0; + for (PxU32 i = 0; i < mNbDescs; i++) + { + maxLinks = PxMax(maxLinks, PxU32(mDescs[i].linkCount)); + } + + Dy::ThreadContext& threadContext = *mContext.getThreadContext(); + + threadContext.mZVector.forceSize_Unsafe(0); + threadContext.mZVector.reserve(maxLinks); + threadContext.mZVector.forceSize_Unsafe(maxLinks); + + threadContext.mDeltaV.forceSize_Unsafe(0); + threadContext.mDeltaV.reserve(maxLinks); + threadContext.mDeltaV.forceSize_Unsafe(maxLinks); + + const PxReal invLengthScale = 1.f / mContext.getLengthScale(); + + for (PxU32 a = 0; a < mNbDescs; ++a) + { + + ArticulationPImpl::computeUnconstrainedVelocitiesTGS(mDescs[a], mDt, + mGravity, getContextId(), threadContext.mZVector.begin(), threadContext.mDeltaV.begin(), invLengthScale); + } + + mContext.putThreadContext(&threadContext); + } + +}; + + +void DynamicsTGSContext::setupArticulations(IslandContextStep& islandContext, const PxVec3& gravity, const PxReal dt, PxU32& posIters, + PxU32& velIters, PxBaseTask* continuation) +{ + Dy::FeatherstoneArticulation** articulations = islandContext.mThreadContext->mArticulationArray; + PxU32 nbArticulations = islandContext.mCounts.articulations; + + PxU32 maxVelIters = 0; + PxU32 maxPosIters = 0; + + //PxU32 startIdx = 0; + for (PxU32 a = 0; a < nbArticulations; a+= ArticulationTask::MaxNbPerTask) + { + const PxU32 endIdx = PxMin(nbArticulations, a + ArticulationTask::MaxNbPerTask); + for (PxU32 b = a; b < endIdx; ++b) + { + ArticulationSolverDesc& desc = islandContext.mThreadContext->getArticulations()[b]; + articulations[b]->getSolverDesc(desc); + articulations[b]->mArticulationIndex = PxU16(b); + + const PxU16 iterWord = articulations[b]->getIterationCounts(); + maxVelIters = PxMax(PxU32(iterWord >> 8), maxVelIters); + maxPosIters = PxMax(PxU32(iterWord & 0xff), maxPosIters); + } + + Dy::ThreadContext* threadContext = islandContext.mThreadContext; + ArticulationTask* task = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(ArticulationTask)), ArticulationTask)(*this, threadContext->getArticulations().begin() + a, + endIdx - a, gravity, dt, getContextId()); + + task->setContinuation(continuation); + task->removeReference(); + + + + //startIdx += descCount; + + } + + velIters = PxMax(maxVelIters, velIters); + posIters = PxMax(maxPosIters, posIters); + +} + +PxU32 DynamicsTGSContext::setupArticulationInternalConstraints(IslandContextStep& islandContext, PxReal dt, PxReal invStepDt) +{ + Dy::FeatherstoneArticulation** articulations = islandContext.mThreadContext->mArticulationArray; + PxU32 nbArticulations = islandContext.mCounts.articulations; + + ThreadContext* threadContext = getThreadContext(); + threadContext->mConstraintBlockStream.reset(); + + PxU32 totalDescCount = 0; + + for (PxU32 a = 0; a < nbArticulations; ++a) + { + ArticulationSolverDesc& desc = islandContext.mThreadContext->getArticulations()[a]; + articulations[a]->getSolverDesc(desc); + + PxU32 acCount; + PxU32 descCount = ArticulationPImpl::setupSolverInternalConstraintsTGS(desc, + islandContext.mStepDt, invStepDt, dt, islandContext.mBiasCoefficient, acCount, threadContext->mZVector.begin()); + + desc.numInternalConstraints = PxTo8(descCount); + + totalDescCount += descCount; + } + + putThreadContext(threadContext); + + islandContext.mThreadContext->contactDescArraySize += totalDescCount; + + return totalDescCount; +} + +class SetupDescsTask : public Cm::Task +{ + Dy::IslandContextStep& mIslandContext; + const SolverIslandObjectsStep& mObjects; + PxU32* mBodyRemapTable; + PxU32 mSolverBodyOffset; + PxsContactManagerOutputIterator& mOutputs; + DynamicsTGSContext& mContext; + + PX_NOCOPY(SetupDescsTask) + +public: + + SetupDescsTask(IslandContextStep& islandContext, const SolverIslandObjectsStep& objects, + PxU32* bodyRemapTable, PxU32 solverBodyOffset, PxsContactManagerOutputIterator& outputs, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mObjects(objects), mBodyRemapTable(bodyRemapTable), mSolverBodyOffset(solverBodyOffset), + mOutputs(outputs), mContext(context) + { + } + + virtual const char* getName() const { return "SetupDescsTask"; } + + virtual void runInternal() + { + mContext.setupDescs(mIslandContext, mObjects, mBodyRemapTable, mSolverBodyOffset, mOutputs); + mIslandContext.mArticulationOffset = mIslandContext.mThreadContext->contactDescArraySize; + } +}; + + +class PreIntegrateParallelTask : public Cm::Task +{ + PxsBodyCore** mBodyArray; + PxsRigidBody** mOriginalBodyArray; + PxTGSSolverBodyVel* mSolverBodyVelPool; + PxTGSSolverBodyTxInertia* mSolverBodyTxInertia; + PxTGSSolverBodyData* mSolverBodyDataPool2; + PxU32* mNodeIndexArray; + const PxU32 mBodyCount; + const PxVec3& mGravity; + const PxReal mDt; + PxU32& mPosIters; + PxU32& mVelIters; + DynamicsTGSContext& mContext; + + PX_NOCOPY(PreIntegrateParallelTask) + +public: + + PreIntegrateParallelTask(PxsBodyCore** bodyArray, PxsRigidBody** originalBodyArray, + PxTGSSolverBodyVel* solverBodyVelPool, PxTGSSolverBodyTxInertia* solverBodyTxInertia, PxTGSSolverBodyData* solverBodyDataPool2, + PxU32* nodeIndexArray, const PxU32 bodyCount, const PxVec3& gravity, const PxReal dt, PxU32& posIters, PxU32& velIters, + DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mBodyArray(bodyArray), mOriginalBodyArray(originalBodyArray), mSolverBodyVelPool(solverBodyVelPool), + mSolverBodyTxInertia(solverBodyTxInertia), mSolverBodyDataPool2(solverBodyDataPool2), mNodeIndexArray(nodeIndexArray), + mBodyCount(bodyCount), mGravity(gravity), mDt(dt), mPosIters(posIters), mVelIters(velIters), mContext(context) + { + } + + virtual const char* getName() const { return "PreIntegrateParallelTask"; } + + virtual void runInternal() + { + PxU32 posIters = 0; + PxU32 velIters = 0; + mContext.preIntegrateBodies(mBodyArray, mOriginalBodyArray, mSolverBodyVelPool, mSolverBodyTxInertia, mSolverBodyDataPool2, mNodeIndexArray, mBodyCount, mGravity, mDt, posIters, velIters, 0); + + PxAtomicMax(reinterpret_cast(&mPosIters), PxI32(posIters)); + PxAtomicMax(reinterpret_cast(&mVelIters), PxI32(velIters)); + + } +}; + + +class PreIntegrateTask : public Cm::Task +{ + PxsBodyCore** mBodyArray; + PxsRigidBody** mOriginalBodyArray; + PxTGSSolverBodyVel* mSolverBodyVelPool; + PxTGSSolverBodyTxInertia* mSolverBodyTxInertia; + PxTGSSolverBodyData* mSolverBodyDataPool2; + PxU32* mNodeIndexArray; + const PxU32 mBodyCount; + const PxVec3& mGravity; + const PxReal mDt; + PxU32& mPosIters; + PxU32& mVelIters; + DynamicsTGSContext& mContext; + + PX_NOCOPY(PreIntegrateTask) + +public: + + PreIntegrateTask(PxsBodyCore** bodyArray, PxsRigidBody** originalBodyArray, + PxTGSSolverBodyVel* solverBodyVelPool, PxTGSSolverBodyTxInertia* solverBodyTxInertia, PxTGSSolverBodyData* solverBodyDataPool2, + PxU32* nodeIndexArray, const PxU32 bodyCount, const PxVec3& gravity, const PxReal dt, PxU32& posIters, PxU32& velIters, + DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mBodyArray(bodyArray), mOriginalBodyArray(originalBodyArray), mSolverBodyVelPool(solverBodyVelPool), + mSolverBodyTxInertia(solverBodyTxInertia), mSolverBodyDataPool2(solverBodyDataPool2), mNodeIndexArray(nodeIndexArray), + mBodyCount(bodyCount), mGravity(gravity), mDt(dt), mPosIters(posIters), mVelIters(velIters), mContext(context) + { + } + + virtual const char* getName() const { return "PreIntegrateTask"; } + + virtual void runInternal() + { + const PxU32 BodiesPerTask = 512; + + if (mBodyCount <= BodiesPerTask) + { + PxU32 posIters = 0; + PxU32 velIters = 0; + mContext.preIntegrateBodies(mBodyArray, mOriginalBodyArray, mSolverBodyVelPool, mSolverBodyTxInertia, mSolverBodyDataPool2, mNodeIndexArray, mBodyCount, mGravity, mDt, posIters, velIters, 0); + + PxAtomicMax(reinterpret_cast(&mPosIters), PxI32(posIters)); + PxAtomicMax(reinterpret_cast(&mVelIters), PxI32(velIters)); + } + else + { + for (PxU32 i = 0; i < mBodyCount; i += BodiesPerTask) + { + const PxU32 nbToProcess = PxMin(mBodyCount - i, BodiesPerTask); + PreIntegrateParallelTask* task = PX_PLACEMENT_NEW(mContext.getTaskPool().allocate(sizeof(PreIntegrateParallelTask)), PreIntegrateParallelTask) + (mBodyArray+i, mOriginalBodyArray+i, mSolverBodyVelPool+i, mSolverBodyTxInertia+i, mSolverBodyDataPool2+i,mNodeIndexArray+i, + nbToProcess, mGravity, mDt, mPosIters, mVelIters, mContext); + + task->setContinuation(mCont); + task->removeReference(); + } + } + + + } +}; + +class SetStepperTask : public Cm::Task +{ + Dy::IslandContextStep& mIslandContext; + Dy::DynamicsTGSContext& mContext; + + PxBaseTask* mAdditionalContinuation; + + PX_NOCOPY(SetStepperTask) + +public: + + SetStepperTask(Dy::IslandContextStep& islandContext, + DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mContext(context), + mAdditionalContinuation(NULL) + { + } + + virtual const char* getName() const { return "SetStepperTask"; } + + void setAdditionalContinuation(PxBaseTask* cont) + { + mAdditionalContinuation = cont; + cont->addReference(); + } + + virtual void runInternal() + { + PxReal dt = mContext.getDt(); + + //ML: TGS can't work well with high velocity iteration counts, so we should limit the velocity iteration counts to be DY_MAX_ITERATION_COUNT. However, + //we should put the extra iterations to the position iteration count so the users will see some behaviour improvements + + const PxU32 newVelIters = PxMin(mIslandContext.mVelIters, PxU32(DY_MAX_VELOCITY_COUNT)); + const PxU32 remainVelIters = mIslandContext.mVelIters - newVelIters; + + mIslandContext.mVelIters = newVelIters; + mIslandContext.mPosIters = mIslandContext.mPosIters + remainVelIters; + + mIslandContext.mStepDt = dt / PxReal(mIslandContext.mPosIters); + mIslandContext.mInvStepDt = 1.f/mIslandContext.mStepDt;//PxMin(1000.f, 1.f / mIslandContext.mStepDt); + mIslandContext.mBiasCoefficient = 2.f * PxSqrt(1.f/mIslandContext.mPosIters); + } + + virtual void release() + { + Cm::Task::release(); + mAdditionalContinuation->removeReference(); + } +}; + +class SetupArticulationTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + const PxVec3& mGravity; + const PxReal mDt; + PxU32& mPosIters; + PxU32& mVelIters; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(SetupArticulationTask) + +public: + + SetupArticulationTask(IslandContextStep& islandContext, const PxVec3& gravity, const PxReal dt, PxU32& posIters, + PxU32& velIters, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mGravity(gravity), mDt(dt), mPosIters(posIters), mVelIters(velIters), mContext(context) + { + } + + virtual const char* getName() const { return "SetupArticulationTask"; } + + virtual void runInternal() + { + PxU32 posIters = 0, velIters = 0; + mContext.setupArticulations(mIslandContext, mGravity, mDt, posIters, velIters, mCont); + + PxAtomicMax(reinterpret_cast(&mPosIters), PxI32(posIters)); + PxAtomicMax(reinterpret_cast(&mVelIters), PxI32(velIters)); + } +}; + +class SetupArticulationInternalConstraintsTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + const PxReal mDt; + const PxReal mInvDt; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(SetupArticulationInternalConstraintsTask) + +public: + + SetupArticulationInternalConstraintsTask(IslandContextStep& islandContext, PxReal dt, PxReal invDt, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mDt(dt), mInvDt(invDt), mContext(context) + { + } + + virtual const char* getName() const { return "SetupArticulationInternalConstraintsTask"; } + + virtual void runInternal() + { + mContext.setupArticulationInternalConstraints(mIslandContext, mDt, mIslandContext.mInvStepDt); + } +}; + +class SetupSolverConstraintsSubTask : public Cm::Task +{ + PxSolverConstraintDesc* mContactDescPtr; + PxConstraintBatchHeader* mHeaders; + const PxU32 mNbHeaders; + PxsContactManagerOutputIterator& mOutputs; + PxReal mStepDt; + PxReal mTotalDt; + PxReal mInvStepDt; + PxReal mInvDtTotal; + PxReal mBiasCoefficient; + DynamicsTGSContext& mContext; + ThreadContext& mIslandThreadContext; + PxI32 mVelIters; + + PX_NOCOPY(SetupSolverConstraintsSubTask) + +public: + + static const PxU32 MaxPerTask = 64; + + SetupSolverConstraintsSubTask(PxSolverConstraintDesc* contactDescPtr, PxConstraintBatchHeader* headers, const PxU32 nbHeaders, + PxsContactManagerOutputIterator& outputs, PxReal stepDt, PxReal totalDt, PxReal invStepDt, PxReal invDtTotal, + PxReal biasCoefficient, ThreadContext& islandThreadContext, DynamicsTGSContext& context, PxI32 velIters) : Cm::Task(context.getContextId()), + mContactDescPtr(contactDescPtr), mHeaders(headers), mNbHeaders(nbHeaders), mOutputs(outputs), mStepDt(stepDt), mTotalDt(totalDt), mInvStepDt(invStepDt), + mInvDtTotal(invDtTotal), mBiasCoefficient(biasCoefficient), mContext(context), mIslandThreadContext(islandThreadContext), + mVelIters(velIters) + { + } + + virtual const char* getName() const { return "SetupSolverConstraintsSubTask"; } + + virtual void runInternal() + { + ThreadContext* tempContext = mContext.getThreadContext(); + tempContext->mConstraintBlockStream.reset(); + mContext.createSolverConstraints(mContactDescPtr, mHeaders, mNbHeaders, mOutputs, mIslandThreadContext, *tempContext, mStepDt, mTotalDt, mInvStepDt, + mBiasCoefficient, mVelIters); + mContext.putThreadContext(tempContext); + } + +}; + +class PxsCreateArticConstraintsSubTask : public Cm::Task +{ + PxsCreateArticConstraintsSubTask& operator=(const PxsCreateArticConstraintsSubTask&); + +public: + + static const PxU32 NbArticsPerTask = 64; + + PxsCreateArticConstraintsSubTask(Dy::FeatherstoneArticulation** articulations, const PxU32 nbArticulations, + PxTGSSolverBodyData* solverBodyData, PxTGSSolverBodyTxInertia* solverBodyTxInertia, + ThreadContext& threadContext, DynamicsTGSContext& context, PxsContactManagerOutputIterator& outputs, + Dy::IslandContextStep& islandContext) : + Cm::Task(context.getContextId()), + mArticulations(articulations), + mNbArticulations(nbArticulations), + mSolverBodyData(solverBodyData), + mSolverBodyTxInertia(solverBodyTxInertia), + mThreadContext(threadContext), mDynamicsContext(context), + mOutputs(outputs), + mIslandContext(islandContext) + {} + + virtual void runInternal() + { + const PxReal correlationDist = mDynamicsContext.getCorrelationDistance(); + const PxReal bounceThreshold = mDynamicsContext.getBounceThreshold(); + const PxReal frictionOffsetThreshold = mDynamicsContext.getFrictionOffsetThreshold(); + const PxReal dt = mDynamicsContext.getDt(); + + const PxReal invStepDt = PxMin(mDynamicsContext.getMaxBiasCoefficient(), mIslandContext.mInvStepDt); + PxReal denom = dt; + if (mIslandContext.mVelIters) + denom += mIslandContext.mStepDt; + PxReal invDt = 1.f / denom; + + ThreadContext* threadContext = mDynamicsContext.getThreadContext(); + threadContext->mConstraintBlockStream.reset(); //ensure there's no left-over memory that belonged to another island + + /*threadContext->mZVector.forceSize_Unsafe(0); + threadContext->mZVector.reserve(mThreadContext.mMaxArticulationLinks); + threadContext->mZVector.forceSize_Unsafe(mThreadContext.mMaxArticulationLinks);*/ + + for (PxU32 i = 0; i < mNbArticulations; ++i) + { + mArticulations[i]->prepareStaticConstraintsTGS(mIslandContext.mStepDt, dt, invStepDt, invDt, mOutputs, *threadContext, correlationDist, bounceThreshold, frictionOffsetThreshold, + mSolverBodyData, mSolverBodyTxInertia, mThreadContext.mConstraintBlockManager, mDynamicsContext.getConstraintWriteBackPool().begin(), + mIslandContext.mBiasCoefficient, mDynamicsContext.getLengthScale()); + } + + mDynamicsContext.putThreadContext(threadContext); + } + + virtual const char* getName() const + { + return "PxsDynamics.PxsCreateArticConstraintsSubTask"; + } + +public: + + Dy::FeatherstoneArticulation** mArticulations; + PxU32 mNbArticulations; + PxTGSSolverBodyData* mSolverBodyData; + PxTGSSolverBodyTxInertia* mSolverBodyTxInertia; + ThreadContext& mThreadContext; + DynamicsTGSContext& mDynamicsContext; + PxsContactManagerOutputIterator& mOutputs; + IslandContextStep& mIslandContext; +}; + + +class SetupSolverConstraintsTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + PxSolverConstraintDesc* mContactDescPtr; + PxsContactManagerOutputIterator& mOutputs; + Dy::ThreadContext& mThreadContext; + PxReal mTotalDt; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(SetupSolverConstraintsTask) + +public: + + + + SetupSolverConstraintsTask(IslandContextStep& islandContext, PxSolverConstraintDesc* contactDescPtr, + PxsContactManagerOutputIterator& outputs, Dy::ThreadContext& threadContext, PxReal totalDt, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mContactDescPtr(contactDescPtr), mOutputs(outputs), mThreadContext(threadContext), + mTotalDt(totalDt), mContext(context) + { + } + + virtual const char* getName() const { return "SetupSolverConstraintsTask"; } + + virtual void runInternal() + { + Dy::ThreadContext& threadContext = *mIslandContext.mThreadContext; + const PxU32 nbBatches = threadContext.numContactConstraintBatches; + PxConstraintBatchHeader* hdr = mIslandContext.mObjects.constraintBatchHeaders; + //for (PxU32 a = 0; a < mIslandContext.mArticulationOffset; a += SetupSolverConstraintsSubTask::MaxPerTask) + for (PxU32 a = 0; a < nbBatches; a += SetupSolverConstraintsSubTask::MaxPerTask) + { + const PxU32 nbConstraints = PxMin(nbBatches - a, SetupSolverConstraintsSubTask::MaxPerTask); + SetupSolverConstraintsSubTask* task = PX_PLACEMENT_NEW(mContext.mTaskPool.allocate(sizeof(SetupSolverConstraintsSubTask)), SetupSolverConstraintsSubTask) + (mContactDescPtr, hdr + a, nbConstraints, mOutputs, mIslandContext.mStepDt, mTotalDt, mIslandContext.mInvStepDt, mContext.mInvDt, mIslandContext.mBiasCoefficient, mThreadContext, mContext, + mIslandContext.mVelIters); + + task->setContinuation(mCont); + task->removeReference(); + } + + const PxU32 articCount = mIslandContext.mCounts.articulations; + + for (PxU32 i = 0; i < articCount; i += PxsCreateArticConstraintsSubTask::NbArticsPerTask) + { + const PxU32 nbToProcess = PxMin(articCount - i, PxsCreateArticConstraintsSubTask::NbArticsPerTask); + + PxsCreateArticConstraintsSubTask* task = PX_PLACEMENT_NEW(mContext.getTaskPool().allocate(sizeof(PxsCreateArticConstraintsSubTask)), PxsCreateArticConstraintsSubTask) + (mThreadContext.mArticulationArray + i, nbToProcess, mContext.mSolverBodyDataPool2.begin(), mContext.mSolverBodyTxInertiaPool.begin(), mThreadContext, mContext, mOutputs, + mIslandContext); + + task->setContinuation(mCont); + task->removeReference(); + } + } +}; + +static bool isArticulationConstraint(PxSolverConstraintDesc& desc) +{ + return desc.linkIndexA != PxSolverConstraintDesc::RIGID_BODY || + desc.linkIndexB != PxSolverConstraintDesc::RIGID_BODY; +} + + +class PartitionTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + PxSolverConstraintDesc* mContactDescPtr; + PxTGSSolverBodyVel* mSolverBodyData; + Dy::ThreadContext& mThreadContext; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(PartitionTask) + +public: + + + + PartitionTask(IslandContextStep& islandContext, PxSolverConstraintDesc* contactDescPtr, PxTGSSolverBodyVel* solverBodyData, + Dy::ThreadContext& threadContext, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mContactDescPtr(contactDescPtr), mSolverBodyData(solverBodyData), mThreadContext(threadContext), + mContext(context) + { + } + + virtual const char* getName() const { return "PartitionTask"; } + + virtual void runInternal() + { + + ArticulationSolverDesc* artics = mThreadContext.getArticulations().begin(); + + PxU32 totalDescCount = mThreadContext.contactDescArraySize; + + mThreadContext.mConstraintsPerPartition.forceSize_Unsafe(0); + mThreadContext.mConstraintsPerPartition.resize(1); + mThreadContext.mConstraintsPerPartition[0] = 0; + + ConstraintPartitionArgs args; + args.mBodies = reinterpret_cast(mSolverBodyData); + args.mStride = sizeof(PxTGSSolverBodyVel); + args.mArticulationPtrs = artics; + args.mContactConstraintDescriptors = mContactDescPtr; + args.mNumArticulationPtrs = mThreadContext.getArticulations().size(); + args.mNumBodies = mIslandContext.mCounts.bodies; + args.mNumContactConstraintDescriptors = totalDescCount; + args.mOrderedContactConstraintDescriptors = mIslandContext.mObjects.orderedConstraintDescs; + args.mOverflowConstraintDescriptors = mIslandContext.mObjects.tempConstraintDescs; + args.mNumDifferentBodyConstraints = args.mNumSelfConstraints = args.mNumStaticConstraints = 0; + args.mConstraintsPerPartition = &mThreadContext.mConstraintsPerPartition; + args.mNumOverflowConstraints = 0; + args.mBitField = &mThreadContext.mPartitionNormalizationBitmap; + args.enhancedDeterminism = false; + args.forceStaticConstraintsToSolver = false; + args.maxPartitions = 64; + + mThreadContext.mMaxPartitions = partitionContactConstraints(args); + mThreadContext.mNumDifferentBodyConstraints = args.mNumDifferentBodyConstraints; + mThreadContext.mNumSelfConstraints = args.mNumSelfConstraints; + mThreadContext.mNumStaticConstraints = args.mNumStaticConstraints; + + mThreadContext.mHasOverflowPartitions = args.mNumOverflowConstraints != 0; + + + { + PxU32 descCount = mThreadContext.mNumDifferentBodyConstraints; + PxU32 selfConstraintDescCount = mThreadContext.contactDescArraySize - (mThreadContext.mNumDifferentBodyConstraints + mThreadContext.mNumStaticConstraints); + + PxArray& accumulatedConstraintsPerPartition = mThreadContext.mConstraintsPerPartition; + + PxU32 numHeaders = 0; + PxU32 currentPartition = 0; + PxU32 maxJ = descCount == 0 ? 0 : accumulatedConstraintsPerPartition[0]; + + const PxU32 maxBatchPartition = 0xFFFFFFFF; + + const PxU32 maxBatchSize2 = args.enhancedDeterminism ? 1u : 4u; + + PxConstraintBatchHeader* batchHeaders = mIslandContext.mObjects.constraintBatchHeaders; + + PxSolverConstraintDesc* orderedConstraints = mIslandContext.mObjects.orderedConstraintDescs; + + PxU32 headersPerPartition = 0; + + //KS - if we have overflowed the partition limit, overflow constraints are pushed + //into 0th partition. If that's the case, we need to disallow batching of constraints + //in 0th partition. + PxU32 maxBatchSize = args.mNumOverflowConstraints == 0 ? maxBatchSize2 : 1; + + for (PxU32 a = 0; a < descCount;) + { + + + PxU32 loopMax = PxMin(maxJ - a, maxBatchSize); + PxU16 j = 0; + if (loopMax > 0) + { + PxConstraintBatchHeader& header = batchHeaders[numHeaders++]; + + j = 1; + PxSolverConstraintDesc& desc = orderedConstraints[a]; + if (!isArticulationConstraint(desc) && (desc.constraintLengthOver16 == DY_SC_TYPE_RB_CONTACT || + desc.constraintLengthOver16 == DY_SC_TYPE_RB_1D) && currentPartition < maxBatchPartition) + { + for (; j < loopMax && desc.constraintLengthOver16 == orderedConstraints[a + j].constraintLengthOver16 && + !isArticulationConstraint(orderedConstraints[a + j]); ++j); + } + header.startIndex = a; + header.stride = j; + header.constraintType = desc.constraintLengthOver16; + headersPerPartition++; + } + if (maxJ == (a + j) && maxJ != descCount) + { + //Go to next partition! + accumulatedConstraintsPerPartition[currentPartition] = headersPerPartition; + headersPerPartition = 0; + currentPartition++; + maxJ = accumulatedConstraintsPerPartition[currentPartition]; + maxBatchSize = maxBatchSize2; + } + a += j; + } + if (descCount) + accumulatedConstraintsPerPartition[currentPartition] = headersPerPartition; + + + + accumulatedConstraintsPerPartition.forceSize_Unsafe(mThreadContext.mMaxPartitions); + + PxU32 numDifferentBodyBatchHeaders = numHeaders; + + for (PxU32 a = 0; a < selfConstraintDescCount; ++a) + { + PxConstraintBatchHeader& header = batchHeaders[numHeaders++]; + header.startIndex = a + descCount; + header.stride = 1; + header.constraintType = DY_SC_TYPE_EXT_1D; + } + + PxU32 numSelfConstraintBatchHeaders = numHeaders - numDifferentBodyBatchHeaders; + + mThreadContext.numDifferentBodyBatchHeaders = numDifferentBodyBatchHeaders; + mThreadContext.numSelfConstraintBatchHeaders = numSelfConstraintBatchHeaders; + mThreadContext.numContactConstraintBatches = numHeaders; + } + + } +}; + +class ParallelSolveTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + const SolverIslandObjectsStep& mObjects; + const PxsIslandIndices& mCounts; + ThreadContext& mThreadContext; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(ParallelSolveTask) + +public: + + ParallelSolveTask(IslandContextStep& islandContext, const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& threadContext, + DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mObjects(objects), mCounts(counts), mThreadContext(threadContext), mContext(context) + { + } + + virtual const char* getName() const { return "ParallelSolveTask"; } + + virtual void runInternal() + { + mContext.iterativeSolveIslandParallel(mObjects, mCounts, mThreadContext, mIslandContext.mStepDt, mIslandContext.mPosIters, mIslandContext.mVelIters, + &mIslandContext.mSharedSolverIndex, &mIslandContext.mSharedRigidBodyIndex, &mIslandContext.mSharedArticulationIndex, + &mIslandContext.mSolvedCount, &mIslandContext.mRigidBodyIntegratedCount, &mIslandContext.mArticulationIntegratedCount, + 4, 128, PxMin(0.5f, mIslandContext.mBiasCoefficient), mIslandContext.mBiasCoefficient); + } +}; + + +class SolveIslandTask : public Cm::Task +{ + IslandContextStep& mIslandContext; + const SolverIslandObjectsStep& mObjects; + const PxsIslandIndices& mCounts; + ThreadContext& mThreadContext; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(SolveIslandTask) + +public: + + SolveIslandTask(IslandContextStep& islandContext, const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& threadContext, + DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mIslandContext(islandContext), mObjects(objects), mCounts(counts), mThreadContext(threadContext), mContext(context) + { + } + + virtual const char* getName() const { return "SolveIslandTask"; } + + virtual void runInternal() + { + + PxU32 j = 0, i = 0; + + PxU32 numBatches = 0; + + PxU32 currIndex = 0; + PxU32 totalCount = 0; + + PxSolverConstraintDesc* contactDescBegin = mObjects.orderedConstraintDescs; + PxSolverConstraintDesc* contactDescPtr = contactDescBegin; + PxConstraintBatchHeader* headers = mObjects.constraintBatchHeaders; + + PxU32 totalPartitions = 0; + for (PxU32 a = 0; a < mThreadContext.mConstraintsPerPartition.size(); ++a) + { + PxU32 endIndex = currIndex + mThreadContext.mConstraintsPerPartition[a]; + + PxU32 numBatchesInPartition = 0; + for (PxU32 b = currIndex; b < endIndex; ++b) + { + PxConstraintBatchHeader& _header = headers[b]; + PxU16 stride = _header.stride, newStride = _header.stride; + PxU32 startIndex = j; + for (PxU16 c = 0; c < stride; ++c) + { + if (getConstraintLength(contactDescBegin[i]) == 0) + { + newStride--; + i++; + } + else + { + if (i != j) + contactDescBegin[j] = contactDescBegin[i]; + i++; + j++; + contactDescPtr++; + } + } + + if (newStride != 0) + { + headers[numBatches].startIndex = startIndex; + headers[numBatches].stride = newStride; + PxU8 type = *contactDescBegin[startIndex].constraint; + if (type == DY_SC_TYPE_STATIC_CONTACT) + { + //Check if any block of constraints is classified as type static (single) contact constraint. + //If they are, iterate over all constraints grouped with it and switch to "dynamic" contact constraint + //type if there's a dynamic contact constraint in the group. + for (PxU32 c = 1; c < newStride; ++c) + { + if (*contactDescBegin[startIndex + c].constraint == DY_SC_TYPE_RB_CONTACT) + { + type = DY_SC_TYPE_RB_CONTACT; + } + } + } + + headers[numBatches].constraintType = type; + numBatches++; + numBatchesInPartition++; + } + } + currIndex += mThreadContext.mConstraintsPerPartition[a]; + mThreadContext.mConstraintsPerPartition[totalPartitions] = numBatchesInPartition; + if (numBatchesInPartition) + totalPartitions++; + else if (a == 0) + mThreadContext.mHasOverflowPartitions = false; //If our first partition is now empty, we have no overflows so clear the overflow flag + totalCount += numBatchesInPartition; + } + + currIndex = totalCount; + + processOverflowConstraints(reinterpret_cast(mContext.mSolverBodyVelPool.begin() + mObjects.solverBodyOffset+1), sizeof(PxTGSSolverBodyVel), + mCounts.bodies, mThreadContext.getArticulations().begin(), mThreadContext.getArticulations().size(), contactDescBegin, + mThreadContext.mHasOverflowPartitions ? mThreadContext.mConstraintsPerPartition[0] : 0); + + //Decision whether to spawn multi-threaded solver or single-threaded solver... + + mThreadContext.mConstraintsPerPartition.forceSize_Unsafe(totalPartitions); + mThreadContext.numContactConstraintBatches = totalCount; + + PxU32 maxLinks = 0; + for (PxU32 a = 0; a < mCounts.articulations; ++a) + { + ArticulationSolverDesc& desc = mThreadContext.getArticulations()[a]; + maxLinks = PxMax(maxLinks, PxU32(desc.linkCount)); + } + + mThreadContext.mZVector.forceSize_Unsafe(0); + mThreadContext.mZVector.reserve(maxLinks); + mThreadContext.mZVector.forceSize_Unsafe(maxLinks); + + mThreadContext.mDeltaV.forceSize_Unsafe(0); + mThreadContext.mDeltaV.reserve(maxLinks); + mThreadContext.mDeltaV.forceSize_Unsafe(maxLinks); + + SolverContext cache; + cache.Z = mThreadContext.mZVector.begin(); + cache.deltaV = mThreadContext.mDeltaV.begin(); + + if (mThreadContext.mConstraintsPerPartition.size()) + { + const PxU32 threadCount = this->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + PxU32 nbHeadersPerPartition; + + if (mThreadContext.mHasOverflowPartitions) + { + PxU32 nbPartitionsMinusOverflow = mThreadContext.mConstraintsPerPartition.size() - 1; + PxU32 nbConstraintsMinusOverflow = currIndex - mThreadContext.mConstraintsPerPartition[0]; + nbHeadersPerPartition = ((nbConstraintsMinusOverflow + nbPartitionsMinusOverflow - 1) / nbPartitionsMinusOverflow); + } + else + nbHeadersPerPartition = ((currIndex + mThreadContext.mConstraintsPerPartition.size() - 1) / mThreadContext.mConstraintsPerPartition.size()); + + const PxU32 NbBatchesPerThread = 8; + //const PxU32 NbBatchesPerThread = 4; + + const PxU32 nbIdealThreads = (nbHeadersPerPartition + NbBatchesPerThread-1) / NbBatchesPerThread; + + if (threadCount < 2 || nbIdealThreads < 2) + mContext.iterativeSolveIsland(mObjects, mCounts, mThreadContext, mIslandContext.mStepDt, mIslandContext.mInvStepDt, + mIslandContext.mPosIters, mIslandContext.mVelIters, cache, PxMin(0.5f, mIslandContext.mBiasCoefficient), mIslandContext.mBiasCoefficient); + else + { + + mIslandContext.mSharedSolverIndex = 0; + mIslandContext.mSolvedCount = 0; + mIslandContext.mSharedRigidBodyIndex = 0; + mIslandContext.mRigidBodyIntegratedCount = 0; + mIslandContext.mSharedArticulationIndex = 0; + mIslandContext.mArticulationIntegratedCount = 0; + + PxU32 nbThreads = PxMin(threadCount, nbIdealThreads); + + ParallelSolveTask* tasks = reinterpret_cast(mContext.getTaskPool().allocate(sizeof(ParallelSolveTask)*nbThreads)); + + for (PxU32 a = 0; a < nbThreads; ++a) + { + PX_PLACEMENT_NEW(&tasks[a], ParallelSolveTask)(mIslandContext, mObjects, mCounts, mThreadContext, mContext); + tasks[a].setContinuation(mCont); + tasks[a].removeReference(); + } + } + } + else + { + mContext.iterativeSolveIsland(mObjects, mCounts, mThreadContext, mIslandContext.mStepDt, + mIslandContext.mInvStepDt, mIslandContext.mPosIters, mIslandContext.mVelIters, cache, + PxMin(0.5f, mIslandContext.mBiasCoefficient), mIslandContext.mBiasCoefficient); + } + } +}; + +class EndIslandTask : public Cm::Task +{ + ThreadContext& mThreadContext; + DynamicsTGSContext& mContext; + + PX_NOCOPY(EndIslandTask) + +public: + + EndIslandTask(ThreadContext& threadContext, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mThreadContext(threadContext), mContext(context) + { + } + + virtual const char* getName() const { return "EndIslandTask"; } + + virtual void runInternal() + { + mContext.endIsland(mThreadContext); + } +}; + +class FinishSolveIslandTask : public Cm::Task +{ + ThreadContext& mThreadContext; + const SolverIslandObjectsStep& mObjects; + const PxsIslandIndices& mCounts; + IG::SimpleIslandManager& mIslandManager; + + DynamicsTGSContext& mContext; + + PX_NOCOPY(FinishSolveIslandTask) + +public: + + FinishSolveIslandTask(ThreadContext& threadContext, const SolverIslandObjectsStep& objects, + const PxsIslandIndices& counts, IG::SimpleIslandManager& islandManager, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mThreadContext(threadContext), mObjects(objects), mCounts(counts), mIslandManager(islandManager), mContext(context) + { + } + + virtual const char* getName() const { return "FinishSolveIslandTask"; } + + virtual void runInternal() + { + mContext.finishSolveIsland(mThreadContext, mObjects, mCounts, mIslandManager, mCont); + } +}; + + + +void DynamicsTGSContext::iterativeSolveIsland(const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& mThreadContext, + const PxReal stepDt, const PxReal invStepDt, const PxU32 posIters, const PxU32 velIters, SolverContext& cache, const PxReal ratio, const PxReal biasCoefficient) +{ + PX_PROFILE_ZONE("Dynamics:solveIsland", mContextID); + PxReal elapsedTime = 0.f; + PxReal recipStepDt = 1.f/stepDt; + + const PxU32 bodyOffset = objects.solverBodyOffset; + + if (mThreadContext.numContactConstraintBatches == 0) + { + for (PxU32 i = 0; i < counts.articulations; ++i) + { + elapsedTime = 0.f; + ArticulationSolverDesc& d = mThreadContext.getArticulations()[i]; + for (PxU32 a = 0; a < posIters; a++) + { + d.articulation->solveInternalConstraints(stepDt, recipStepDt, mThreadContext.mZVector.begin(), mThreadContext.mDeltaV.begin(), false, true, elapsedTime, biasCoefficient); + ArticulationPImpl::updateDeltaMotion(d, stepDt, mThreadContext.mDeltaV.begin(), mInvDt); + elapsedTime += stepDt; + } + + ArticulationPImpl::saveVelocityTGS(d, mInvDt); + + d.articulation->concludeInternalConstraints(true); + + for (PxU32 a = 0; a < velIters; ++a) + { + d.articulation->solveInternalConstraints(stepDt, recipStepDt, mThreadContext.mZVector.begin(), mThreadContext.mDeltaV.begin(), true, true, elapsedTime, biasCoefficient); + } + + d.articulation->writebackInternalConstraints(true); + + } + + integrateBodies(objects, counts.bodies, mSolverBodyVelPool.begin() + bodyOffset, mSolverBodyTxInertiaPool.begin() + bodyOffset, mSolverBodyDataPool2.begin() + bodyOffset, mDt, + mInvDt, false, ratio); + return; + } + + + for (PxU32 a = 1; a < posIters; a++) + { + solveConstraintsIteration(objects.orderedConstraintDescs, objects.constraintBatchHeaders, mThreadContext.numContactConstraintBatches, invStepDt, + mSolverBodyTxInertiaPool.begin(), elapsedTime, -PX_MAX_F32, cache); + integrateBodies(objects, counts.bodies, mSolverBodyVelPool.begin() + bodyOffset, mSolverBodyTxInertiaPool.begin() + bodyOffset, + mSolverBodyDataPool2.begin() + bodyOffset, stepDt, mInvDt, false, ratio); + + for (PxU32 i = 0; i < counts.articulations; ++i) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[i]; + d.articulation->solveInternalConstraints(stepDt, recipStepDt, mThreadContext.mZVector.begin(), mThreadContext.mDeltaV.begin(), false, true, elapsedTime, biasCoefficient); + } + + stepArticulations(mThreadContext, counts, stepDt, mInvDt); + elapsedTime += stepDt; + } + + solveConcludeConstraintsIteration(objects.orderedConstraintDescs, objects.constraintBatchHeaders, mThreadContext.numContactConstraintBatches, + mSolverBodyTxInertiaPool.begin(), elapsedTime, cache, 0); + + for (PxU32 i = 0; i < counts.articulations; ++i) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[i]; + d.articulation->solveInternalConstraints(stepDt, recipStepDt, mThreadContext.mZVector.begin(), mThreadContext.mDeltaV.begin(), false, true, elapsedTime, biasCoefficient); + d.articulation->concludeInternalConstraints(true); + } + + elapsedTime += stepDt; + + const PxReal invDt = mInvDt; + + integrateBodies(objects, counts.bodies, mSolverBodyVelPool.begin() + bodyOffset, mSolverBodyTxInertiaPool.begin() + bodyOffset, + mSolverBodyDataPool2.begin() + bodyOffset, stepDt, mInvDt, false, ratio); + + stepArticulations(mThreadContext, counts, stepDt, mInvDt); + + for(PxU32 a = 0; a < counts.articulations; ++a) + { + Dy::ArticulationSolverDesc& desc = mThreadContext.getArticulations()[a]; + + //ArticulationPImpl::updateDeltaMotion(desc, stepDt, mThreadContext.mDeltaV.begin()); + ArticulationPImpl::saveVelocityTGS(desc, invDt); + } + + for (PxU32 a = 0; a < velIters; ++a) + { + solveConstraintsIteration(objects.orderedConstraintDescs, objects.constraintBatchHeaders, mThreadContext.numContactConstraintBatches, invStepDt, + mSolverBodyTxInertiaPool.begin(), elapsedTime, /*-PX_MAX_F32*/0.f, cache); + for (PxU32 i = 0; i < counts.articulations; ++i) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[i]; + d.articulation->solveInternalConstraints(stepDt, recipStepDt, mThreadContext.mZVector.begin(), mThreadContext.mDeltaV.begin(), true, true, elapsedTime, biasCoefficient); + } + } + + writebackConstraintsIteration(objects.constraintBatchHeaders, objects.orderedConstraintDescs, mThreadContext.numContactConstraintBatches); + for (PxU32 i = 0; i < counts.articulations; ++i) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[i]; + d.articulation->writebackInternalConstraints(true); + } +} + + +void DynamicsTGSContext::iterativeSolveIslandParallel(const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& mThreadContext, + const PxReal stepDt, const PxU32 posIters, const PxU32 velIters, PxI32* solverCounts, PxI32* integrationCounts, PxI32* articulationIntegrationCounts, + PxI32* solverProgressCount, PxI32* integrationProgressCount, PxI32* articulationProgressCount, PxU32 solverUnrollSize, PxU32 integrationUnrollSize, + const PxReal ratio, const PxReal biasCoefficient) +{ + PX_PROFILE_ZONE("Dynamics:solveIslandParallel", mContextID); + Dy::ThreadContext& threadContext = *getThreadContext(); + PxU32 startSolveIdx = PxU32(PxAtomicAdd(solverCounts, PxI32(solverUnrollSize))) - solverUnrollSize; + PxU32 nbSolveRemaining = solverUnrollSize; + + + PxU32 startIntegrateIdx = PxU32(PxAtomicAdd(integrationCounts, PxI32(integrationUnrollSize))) - integrationUnrollSize; + PxU32 nbIntegrateRemaining = integrationUnrollSize; + + //For now, just do articulations 1 at a time. Might need to tweak this later depending on performance + PxU32 startArticulationIdx = PxU32(PxAtomicAdd(articulationIntegrationCounts, PxI32(1))) - 1; + + PxU32 targetSolverProgressCount = 0, targetIntegrationProgressCount = 0, targetArticulationProgressCount = 0; + + const PxU32 nbSolverBatches = mThreadContext.numContactConstraintBatches; + const PxU32 nbBodies = counts.bodies;// + mKinematicCount; + const PxU32 nbArticulations = counts.articulations; + + PxSolverConstraintDesc* contactDescs = objects.orderedConstraintDescs; + PxConstraintBatchHeader* batchHeaders = objects.constraintBatchHeaders; + + PxTGSSolverBodyVel* solverVels = mSolverBodyVelPool.begin(); + PxTGSSolverBodyTxInertia* solverTxInertias = mSolverBodyTxInertiaPool.begin(); + const PxTGSSolverBodyData*const solverBodyData = mSolverBodyDataPool2.begin(); + + PxU32* constraintsPerPartitions = mThreadContext.mConstraintsPerPartition.begin(); + const PxU32 nbPartitions = mThreadContext.mConstraintsPerPartition.size(); + + const PxU32 bodyOffset = objects.solverBodyOffset; + + threadContext.mZVector.reserve(mThreadContext.mZVector.size()); + threadContext.mDeltaV.reserve(mThreadContext.mZVector.size()); + + SolverContext cache; + cache.Z = threadContext.mZVector.begin(); + cache.deltaV = threadContext.mDeltaV.begin(); + + PxReal elapsedTime = 0.f; + + PxReal invStepDt = 1.f/ stepDt; + + const bool overflow = mThreadContext.mHasOverflowPartitions; + + PxU32 iterCount = 0; + + const PxU32 maxDynamic0 = contactDescs[0].tgsBodyA->maxDynamicPartition; + PX_UNUSED(maxDynamic0); + + for (PxU32 a = 1; a < posIters; ++a, targetIntegrationProgressCount += nbBodies, targetArticulationProgressCount += nbArticulations) + { + WAIT_FOR_PROGRESS(integrationProgressCount, PxI32(targetIntegrationProgressCount)); + WAIT_FOR_PROGRESS(articulationProgressCount, PxI32(targetArticulationProgressCount)); + + PxU32 offset = 0; + for (PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + //Find the startIdx in the partition to process + PxU32 startIdx = startSolveIdx - targetSolverProgressCount; + + const PxU32 nbBatches = constraintsPerPartitions[b]; + + PxU32 nbSolved = 0; + + while (startIdx < nbBatches) + { + PxU32 nbToSolve = PxMin(nbBatches - startIdx, nbSolveRemaining); + + PX_ASSERT(maxDynamic0 == contactDescs[0].tgsBodyA->maxDynamicPartition); + + if (b == 0 && overflow) + parallelSolveConstraints(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, -PX_MAX_F32, cache, iterCount); + else + parallelSolveConstraints(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, -PX_MAX_F32, cache, iterCount); + + PX_ASSERT(maxDynamic0 == contactDescs[0].tgsBodyA->maxDynamicPartition); + nbSolveRemaining -= nbToSolve; + startSolveIdx += nbToSolve; + startIdx += nbToSolve; + + nbSolved += nbToSolve; + + if (nbSolveRemaining == 0) + { + startSolveIdx = PxU32(PxAtomicAdd(solverCounts, PxI32(solverUnrollSize))) - solverUnrollSize; + nbSolveRemaining = solverUnrollSize; + startIdx = startSolveIdx - targetSolverProgressCount; + } + } + + if (nbSolved) + PxAtomicAdd(solverProgressCount, PxI32(nbSolved)); + + targetSolverProgressCount += nbBatches; + offset += nbBatches; + } + + iterCount++; + + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + + + PxU32 integStartIdx = startIntegrateIdx - targetIntegrationProgressCount; + + PxU32 nbIntegrated = 0; + while (integStartIdx < nbBodies) + { + PxU32 nbToIntegrate = PxMin(nbBodies - integStartIdx, nbIntegrateRemaining); + + parallelIntegrateBodies(solverVels + integStartIdx + bodyOffset, solverTxInertias + integStartIdx + bodyOffset, + solverBodyData + integStartIdx + bodyOffset, nbToIntegrate, stepDt, iterCount, mInvDt, false, ratio); + + nbIntegrateRemaining -= nbToIntegrate; + startIntegrateIdx += nbToIntegrate; + integStartIdx += nbToIntegrate; + + nbIntegrated += nbToIntegrate; + + if (nbIntegrateRemaining == 0) + { + startIntegrateIdx = PxU32(PxAtomicAdd(integrationCounts, PxI32(integrationUnrollSize))) - integrationUnrollSize; + nbIntegrateRemaining = integrationUnrollSize; + integStartIdx = startIntegrateIdx - targetIntegrationProgressCount; + } + } + + if (nbIntegrated) + PxAtomicAdd(integrationProgressCount, PxI32(nbIntegrated)); + + PxU32 artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + + PxU32 nbArticsProcessed = 0; + while (artIcStartIdx < nbArticulations) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[artIcStartIdx]; + + d.articulation->solveInternalConstraints(stepDt, invStepDt, threadContext.mZVector.begin(), + threadContext.mDeltaV.begin(), false, true, elapsedTime, biasCoefficient); + + ArticulationPImpl::updateDeltaMotion(d, stepDt, cache.deltaV, mInvDt); + + nbArticsProcessed++; + + startArticulationIdx = PxU32(PxAtomicAdd(articulationIntegrationCounts, PxI32(1))) - 1; + artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + } + + if (nbArticsProcessed) + PxAtomicAdd(articulationProgressCount, PxI32(nbArticsProcessed)); + + elapsedTime += stepDt; + + + + } + + { + WAIT_FOR_PROGRESS(integrationProgressCount, PxI32(targetIntegrationProgressCount)); + WAIT_FOR_PROGRESS(articulationProgressCount, PxI32(targetArticulationProgressCount)); + + WAIT_FOR_PROGRESS(articulationProgressCount, PxI32(targetArticulationProgressCount)); + + + PxU32 offset = 0; + for (PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + //Find the startIdx in the partition to process + PxU32 startIdx = startSolveIdx - targetSolverProgressCount; + + const PxU32 nbBatches = constraintsPerPartitions[b]; + + PxU32 nbSolved = 0; + while (startIdx < nbBatches) + { + PxU32 nbToSolve = PxMin(nbBatches - startIdx, nbSolveRemaining); + if (b == 0 && overflow) + solveConcludeConstraintsIteration(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, cache, iterCount); + else + solveConcludeConstraintsIteration(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, cache, iterCount); + nbSolveRemaining -= nbToSolve; + startSolveIdx += nbToSolve; + startIdx += nbToSolve; + + nbSolved += nbToSolve; + + if (nbSolveRemaining == 0) + { + startSolveIdx = PxU32(PxAtomicAdd(solverCounts, PxI32(solverUnrollSize))) - solverUnrollSize; + nbSolveRemaining = solverUnrollSize; + startIdx = startSolveIdx - targetSolverProgressCount; + } + } + + if (nbSolved) + PxAtomicAdd(solverProgressCount, PxI32(nbSolved)); + + targetSolverProgressCount += nbBatches; + offset += nbBatches; + + + } + + iterCount++; + + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + + + const PxReal invDt = mInvDt; + //const PxReal invDtPt25 = mInvDt * 0.25f; + PxU32 integStartIdx = startIntegrateIdx - targetIntegrationProgressCount; + + PxU32 nbIntegrated = 0; + while (integStartIdx < nbBodies) + { + PxU32 nbToIntegrate = PxMin(nbBodies - integStartIdx, nbIntegrateRemaining); + + parallelIntegrateBodies(solverVels + integStartIdx + bodyOffset, solverTxInertias + integStartIdx + bodyOffset, + solverBodyData + integStartIdx + bodyOffset, nbToIntegrate, stepDt, iterCount, mInvDt, false, ratio); + + nbIntegrateRemaining -= nbToIntegrate; + startIntegrateIdx += nbToIntegrate; + integStartIdx += nbToIntegrate; + + nbIntegrated += nbToIntegrate; + + if (nbIntegrateRemaining == 0) + { + startIntegrateIdx = PxU32(PxAtomicAdd(integrationCounts, PxI32(integrationUnrollSize))) - integrationUnrollSize; + nbIntegrateRemaining = integrationUnrollSize; + integStartIdx = startIntegrateIdx - targetIntegrationProgressCount; + } + } + + if (nbIntegrated) + PxAtomicAdd(integrationProgressCount, PxI32(nbIntegrated)); + + PxU32 artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + + PxU32 nbArticsProcessed = 0; + while (artIcStartIdx < nbArticulations) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[artIcStartIdx]; + + d.articulation->solveInternalConstraints(stepDt, invStepDt, threadContext.mZVector.begin(), + threadContext.mDeltaV.begin(), false, true, elapsedTime, biasCoefficient); + + d.articulation->concludeInternalConstraints(true); + + ArticulationPImpl::updateDeltaMotion(d, stepDt, cache.deltaV, mInvDt); + ArticulationPImpl::saveVelocityTGS(d, invDt); + + nbArticsProcessed++; + + startArticulationIdx = PxU32(PxAtomicAdd(articulationIntegrationCounts, PxI32(1))) - 1; + artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + } + + if (nbArticsProcessed) + PxAtomicAdd(articulationProgressCount, PxI32(nbArticsProcessed)); + + elapsedTime += stepDt; + + targetIntegrationProgressCount += nbBodies; + targetArticulationProgressCount += nbArticulations; + + putThreadContext(&threadContext); + } + + //Write back constraints... + + WAIT_FOR_PROGRESS(integrationProgressCount, PxI32(targetIntegrationProgressCount)); + WAIT_FOR_PROGRESS(articulationProgressCount, PxI32(targetArticulationProgressCount)); + + + for (PxU32 a = 0; a < velIters; ++a) + { + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + const bool lastIter = (velIters - a) == 1; + + PxU32 offset = 0; + for (PxU32 b = 0; b < nbPartitions; ++b) + { + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + + //Find the startIdx in the partition to process + PxU32 startIdx = startSolveIdx - targetSolverProgressCount; + + const PxU32 nbBatches = constraintsPerPartitions[b]; + + PxU32 nbSolved = 0; + while (startIdx < nbBatches) + { + PxU32 nbToSolve = PxMin(nbBatches - startIdx, nbSolveRemaining); + if (b == 0 && overflow) + parallelSolveConstraints(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, 0.f/*-PX_MAX_F32*/, cache, iterCount); + else + parallelSolveConstraints(contactDescs, batchHeaders + startIdx + offset, nbToSolve, + solverTxInertias, elapsedTime, 0.f/*-PX_MAX_F32*/, cache, iterCount); + + nbSolveRemaining -= nbToSolve; + startSolveIdx += nbToSolve; + startIdx += nbToSolve; + + nbSolved += nbToSolve; + + + if (nbSolveRemaining == 0) + { + startSolveIdx = PxU32(PxAtomicAdd(solverCounts, PxI32(solverUnrollSize))) - solverUnrollSize; + nbSolveRemaining = solverUnrollSize; + + startIdx = startSolveIdx - targetSolverProgressCount; + } + } + + if (nbSolved) + PxAtomicAdd(solverProgressCount, PxI32(nbSolved)); + + targetSolverProgressCount += nbBatches; + offset += nbBatches; + } + + WAIT_FOR_PROGRESS(solverProgressCount, PxI32(targetSolverProgressCount)); + + PxU32 artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + + PxU32 nbArticsProcessed = 0; + while (artIcStartIdx < nbArticulations) + { + ArticulationSolverDesc& d = mThreadContext.getArticulations()[artIcStartIdx]; + + d.articulation->solveInternalConstraints(stepDt, invStepDt, threadContext.mZVector.begin(), + threadContext.mDeltaV.begin(), true, true, elapsedTime, biasCoefficient); + + if (lastIter) + d.articulation->writebackInternalConstraints(true); + + nbArticsProcessed++; + + startArticulationIdx = PxU32(PxAtomicAdd(articulationIntegrationCounts, PxI32(1))) - 1; + artIcStartIdx = startArticulationIdx - targetArticulationProgressCount; + } + + if (nbArticsProcessed) + PxAtomicAdd(articulationProgressCount, PxI32(nbArticsProcessed)); + + targetArticulationProgressCount += nbArticulations; + + iterCount++; + + WAIT_FOR_PROGRESS(articulationProgressCount, PxI32(targetArticulationProgressCount)); + } + + { + + { + //Find the startIdx in the partition to process + PxU32 startIdx = startSolveIdx - targetSolverProgressCount; + + const PxU32 nbBatches = nbSolverBatches; + + PxU32 nbSolved = 0; + while (startIdx < nbBatches) + { + PxU32 nbToSolve = PxMin(nbBatches - startIdx, nbSolveRemaining); + parallelWritebackConstraintsIteration(contactDescs, batchHeaders + startIdx, nbToSolve); + nbSolveRemaining -= nbToSolve; + startSolveIdx += nbToSolve; + startIdx += nbToSolve; + + nbSolved += nbToSolve; + + if (nbSolveRemaining == 0) + { + startSolveIdx = PxU32(PxAtomicAdd(solverCounts, PxI32(solverUnrollSize))) - solverUnrollSize; + nbSolveRemaining = solverUnrollSize; + startIdx = startSolveIdx - targetSolverProgressCount; + } + } + + if (nbSolved) + PxAtomicAdd(solverProgressCount, PxI32(nbSolved)); + + targetSolverProgressCount += nbBatches; + } + + } + +} + +class CopyBackTask : public Cm::Task +{ + const SolverIslandObjectsStep& mObjects; + PxTGSSolverBodyVel* mVels; + PxTGSSolverBodyTxInertia* mTxInertias; + PxTGSSolverBodyData* mSolverBodyDatas; + const PxReal mInvDt; + IG::IslandSim& mIslandSim; + const PxU32 mStartIdx; + const PxU32 mEndIdx; + DynamicsTGSContext& mContext; + + PX_NOCOPY(CopyBackTask) + +public: + + CopyBackTask(const SolverIslandObjectsStep& objects, + PxTGSSolverBodyVel* vels, PxTGSSolverBodyTxInertia* txInertias, + PxTGSSolverBodyData* solverBodyDatas, PxReal invDt, IG::IslandSim& islandSim, + PxU32 startIdx, PxU32 endIdx, DynamicsTGSContext& context) : Cm::Task(context.getContextId()), + mObjects(objects), mVels(vels), mTxInertias(txInertias), mSolverBodyDatas(solverBodyDatas), mInvDt(invDt), + mIslandSim(islandSim), mStartIdx(startIdx), mEndIdx(endIdx), mContext(context) + { + } + + virtual const char* getName() const { return "CopyBackTask"; } + + virtual void runInternal() + { + mContext.copyBackBodies(mObjects, mVels, mTxInertias, mSolverBodyDatas, mInvDt, mIslandSim, mStartIdx, mEndIdx); + } +}; + +class UpdateArticTask : public Cm::Task +{ + Dy::ThreadContext& mThreadContext; + PxU32 mStartIdx; + PxU32 mEndIdx; + PxReal mDt; + DynamicsTGSContext& mContext; + + PX_NOCOPY(UpdateArticTask) + +public: + + UpdateArticTask(Dy::ThreadContext& threadContext, PxU32 startIdx, PxU32 endIdx, PxReal dt, DynamicsTGSContext& context) : + Cm::Task(context.getContextId()), + mThreadContext(threadContext), mStartIdx(startIdx), mEndIdx(endIdx), mDt(dt), mContext(context) + { + } + + virtual const char* getName() const { return "UpdateArticTask"; } + + virtual void runInternal() + { + mContext.updateArticulations(mThreadContext, mStartIdx, mEndIdx, mDt); + } +}; + + +void DynamicsTGSContext::finishSolveIsland(ThreadContext& mThreadContext, const SolverIslandObjectsStep& objects, + const PxsIslandIndices& counts, IG::SimpleIslandManager& islandManager, PxBaseTask* continuation) +{ + mThreadContext.mConstraintBlockManager.reset(); + mThreadContext.mConstraintBlockStream.reset(); + + const PxU32 NbBodiesPerTask = 512; + + for (PxU32 a = 0; a < counts.bodies; a += NbBodiesPerTask) + { + CopyBackTask* task = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(CopyBackTask)), CopyBackTask) + (objects, mSolverBodyVelPool.begin() + objects.solverBodyOffset, + mSolverBodyTxInertiaPool.begin() + objects.solverBodyOffset, mSolverBodyDataPool2.begin() + objects.solverBodyOffset, + mInvDt, islandManager.getAccurateIslandSim(), a, PxMin(a + NbBodiesPerTask, counts.bodies),*this); + + task->setContinuation(continuation); + task->removeReference(); + } + + const PxU32 NbArticsPerTask = 64; + + for (PxU32 a = 0; a < counts.articulations; a += NbArticsPerTask) + { + UpdateArticTask* task = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(UpdateArticTask)), UpdateArticTask) + (mThreadContext, a, PxMin(counts.articulations, a+NbArticsPerTask), mDt, *this); + + task->setContinuation(continuation); + task->removeReference(); + } +} + + +void DynamicsTGSContext::endIsland(ThreadContext& mThreadContext) +{ + putThreadContext(&mThreadContext); +} + + +void DynamicsTGSContext::solveIsland(const SolverIslandObjectsStep& objects, + const PxsIslandIndices& counts, + const PxU32 solverBodyOffset, + IG::SimpleIslandManager& islandManager, + PxU32* bodyRemapTable, PxsMaterialManager* /*materialManager*/, + PxsContactManagerOutputIterator& iterator, + PxBaseTask* continuation) +{ + ThreadContext& mThreadContext = *getThreadContext(); + + IslandContextStep& islandContext = *reinterpret_cast(mTaskPool.allocate(sizeof(IslandContextStep))); + islandContext.mThreadContext = &mThreadContext; + islandContext.mCounts = counts; + islandContext.mObjects = objects; + islandContext.mPosIters = 0; + islandContext.mVelIters = 0; + islandContext.mObjects.solverBodyOffset = solverBodyOffset; + + + prepareBodiesAndConstraints(islandContext.mObjects, islandManager, islandContext); + + ////Create task chain... + SetupDescsTask* descTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SetupDescsTask)), SetupDescsTask)(islandContext, islandContext.mObjects, + bodyRemapTable, solverBodyOffset, iterator, *this); + PreIntegrateTask* intTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(PreIntegrateTask)), PreIntegrateTask)(islandContext.mObjects.bodyCoreArray, islandContext.mObjects.bodies, + mSolverBodyVelPool.begin() + solverBodyOffset, + mSolverBodyTxInertiaPool.begin() + solverBodyOffset, mSolverBodyDataPool2.begin() + solverBodyOffset, + mThreadContext.mNodeIndexArray, islandContext.mCounts.bodies, mGravity, mDt, islandContext.mPosIters, + islandContext.mVelIters, *this); + SetupArticulationTask* articTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SetupArticulationTask)), SetupArticulationTask)(islandContext, mGravity, + mDt, islandContext.mPosIters, islandContext.mVelIters, *this); + SetStepperTask* stepperTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SetStepperTask)), SetStepperTask)(islandContext, *this); + SetupArticulationInternalConstraintsTask* articConTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SetupArticulationInternalConstraintsTask)), SetupArticulationInternalConstraintsTask) + (islandContext, mDt, mInvDt, *this); + PartitionTask* partitionTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(PartitionTask)), PartitionTask) + (islandContext, islandContext.mObjects.constraintDescs, mSolverBodyVelPool.begin()+solverBodyOffset+1, mThreadContext, + *this); + SetupSolverConstraintsTask* constraintTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SetupSolverConstraintsTask)), SetupSolverConstraintsTask) + (islandContext, islandContext.mObjects.orderedConstraintDescs, iterator, mThreadContext, + mDt, *this); + + SolveIslandTask* solveTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(SolveIslandTask)), SolveIslandTask)(islandContext, islandContext.mObjects, islandContext.mCounts, mThreadContext, *this); + + FinishSolveIslandTask* finishTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(FinishSolveIslandTask)), FinishSolveIslandTask)(mThreadContext, islandContext.mObjects, islandContext.mCounts, islandManager, *this); + + EndIslandTask* endTask = PX_PLACEMENT_NEW(mTaskPool.allocate(sizeof(EndIslandTask)), EndIslandTask)(mThreadContext, *this); + + endTask->setContinuation(continuation); + finishTask->setContinuation(endTask); + solveTask->setContinuation(finishTask); + constraintTask->setContinuation(solveTask); + partitionTask->setContinuation(constraintTask); + articConTask->setContinuation(partitionTask); + //Stepper triggers both articCon and constraintTask + stepperTask->setContinuation(articConTask); + stepperTask->setAdditionalContinuation(constraintTask); + + articTask->setContinuation(stepperTask); + intTask->setContinuation(stepperTask); + descTask->setContinuation(stepperTask); + + endTask->removeReference(); + finishTask->removeReference(); + solveTask->removeReference(); + constraintTask->removeReference(); + partitionTask->removeReference(); + articConTask->removeReference(); + stepperTask->removeReference(); + articTask->removeReference(); + intTask->removeReference(); + descTask->removeReference(); +} + +void DynamicsTGSContext::updateBodyCore(PxBaseTask* continuation) +{ + PX_UNUSED(continuation); +} + +void DynamicsTGSContext::mergeResults() +{ +} + + + +} +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.h new file mode 100644 index 0000000..8dfeb72 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyTGSDynamics.h @@ -0,0 +1,503 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_TGS_DYNAMICS_H +#define DY_TGS_DYNAMICS_H + +#include "PxvConfig.h" +#include "CmSpatialVector.h" +#include "CmTask.h" +#include "CmPool.h" +#include "PxcThreadCoherentCache.h" +#include "DyThreadContext.h" +#include "PxcConstraintBlockStream.h" +#include "DySolverBody.h" +#include "DyContext.h" +#include "PxsIslandManagerTypes.h" +#include "PxvNphaseImplementationContext.h" +#include "solver/PxSolverDefs.h" +#include "PxsIslandSim.h" + +namespace physx +{ + + namespace Cm + { + class FlushPool; + } + + namespace IG + { + class SimpleIslandManager; + struct Edge; + } + + class PxsRigidBody; + + struct PxsBodyCore; + class PxsIslandIndices; + struct PxsIndexedInteraction; + struct PxsIndexedContactManager; + + namespace Cm + { + class SpatialVector; + } + + namespace Dy + { + class SolverCore; + struct SolverIslandParams; + struct ArticulationSolverDesc; + class DynamicsContext; + struct SolverContext; + + struct SolverIslandObjectsStep + { + PxsRigidBody** bodies; + FeatherstoneArticulation** articulations; + FeatherstoneArticulation** articulationOwners; + PxsIndexedContactManager* contactManagers; + + const IG::IslandId* islandIds; + PxU32 numIslands; + PxU32* bodyRemapTable; + PxU32* nodeIndexArray; + + PxSolverConstraintDesc* constraintDescs; + PxSolverConstraintDesc* orderedConstraintDescs; + PxSolverConstraintDesc* tempConstraintDescs; + PxConstraintBatchHeader* constraintBatchHeaders; + Cm::SpatialVector* motionVelocities; + PxsBodyCore** bodyCoreArray; + + PxU32 solverBodyOffset; + + SolverIslandObjectsStep() : bodies(NULL), articulations(NULL), articulationOwners(NULL), + contactManagers(NULL), islandIds(NULL), numIslands(0), nodeIndexArray(NULL), constraintDescs(NULL), motionVelocities(NULL), bodyCoreArray(NULL), + solverBodyOffset(0) + { + } + }; + + struct IslandContextStep + { + //The thread context for this island (set in in the island start task, released in the island end task) + ThreadContext* mThreadContext; + PxsIslandIndices mCounts; + SolverIslandObjectsStep mObjects; + PxU32 mPosIters; + PxU32 mVelIters; + PxU32 mArticulationOffset; + PxReal mStepDt; + PxReal mInvStepDt; + PxReal mBiasCoefficient; + PxI32 mSharedSolverIndex; + PxI32 mSolvedCount; + PxI32 mSharedRigidBodyIndex; + PxI32 mRigidBodyIntegratedCount; + PxI32 mSharedArticulationIndex; + PxI32 mArticulationIntegratedCount; + }; + + struct SolverIslandObjectsStep; + + class SolverBodyVelDataPool : public PxArray > > + { + PX_NOCOPY(SolverBodyVelDataPool) + public: + SolverBodyVelDataPool() {} + }; + + class SolverBodyTxInertiaPool : public PxArray > > + { + PX_NOCOPY(SolverBodyTxInertiaPool) + public: + SolverBodyTxInertiaPool() {} + }; + + class SolverBodyDataStepPool : public PxArray > > + { + PX_NOCOPY(SolverBodyDataStepPool) + public: + SolverBodyDataStepPool() {} + }; + + class SolverStepConstraintDescPool : public PxArray > > + { + PX_NOCOPY(SolverStepConstraintDescPool) + public: + SolverStepConstraintDescPool() { } + }; + +#if PX_VC +#pragma warning(push) +#pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + class DynamicsTGSContext : public Context + { + PX_NOCOPY(DynamicsTGSContext) + public: + + /**PxBaseTask* continuation + \brief Creates a DynamicsContext associated with a PxsContext + \return A pointer to the newly-created DynamicsContext. + */ + static DynamicsTGSContext* create(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocator, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal lengthScale + ); + + /** + \brief Destroys this DynamicsContext + */ + void destroy(); + + /** + \brief Returns the static world solver body + \return The static world solver body. + */ + //PX_FORCE_INLINE PxSolverBody& getWorldSolverBody() { return mWorldSolverBody; } + + PX_FORCE_INLINE Cm::FlushPool& getTaskPool() { return mTaskPool; } + + PX_FORCE_INLINE ThresholdStream& getThresholdStream() { return *mThresholdStream; } + + PX_FORCE_INLINE PxvSimStats& getSimStats() { return mSimStats; } + +#if PX_ENABLE_SIM_STATS + void addThreadStats(const ThreadContext::ThreadSimStats& stats); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + /** + \brief The entry point for the constraint solver. + \param[in] dt The simulation time-step + \param[in] continuation The continuation task for the solver + + This method is called after the island generation has completed. Its main responsibilities are: + (1) Reserving the solver body pools + (2) Initializing the static and kinematic solver bodies, which are shared resources between islands. + (3) Construct the solver task chains for each island + + Each island is solved as an independent solver task chain in parallel. + + */ + + virtual void update(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, PxBaseTask* lostTouchTask, + PxvNphaseImplementationContext* nphase, + const PxU32 maxPatchesPerCM, const PxU32 maxArticulationLinks, const PxReal dt, const PxVec3& gravity, PxBitMapPinned& changedHandleMap); + + void updatePostKinematic(IG::SimpleIslandManager& simpleIslandManager, PxBaseTask* continuation, + PxBaseTask* lostTouchTask, const PxU32 maxLinks); + + virtual void processLostPatches(IG::SimpleIslandManager& /*simpleIslandManager*/, PxsContactManager** /*lostPatchManagers*/, PxU32 /*nbLostPatchManagers*/, PxsContactManagerOutputCounts* /*outCounts*/){} + virtual void processFoundPatches(IG::SimpleIslandManager& /*simpleIslandManager*/, PxsContactManager** /*foundPatchManagers*/, PxU32 /*nbFoundPatchManagers*/, PxsContactManagerOutputCounts* /*outCounts*/) {} + + virtual void updateBodyCore(PxBaseTask* continuation); + + virtual void setSimulationController(PxsSimulationController* simulationController){ mSimulationController = simulationController; } + /** + \brief This method combines the results of several islands, e.g. constructing scene-level simulation statistics and merging together threshold streams for contact notification. + */ + virtual void mergeResults(); + + virtual void getDataStreamBase(void*& /*contactStreamBase*/, void*& /*patchStreamBase*/, void*& /*forceAndIndicesStreamBase*/){} + + virtual PxSolverType::Enum getSolverType() const { return PxSolverType::eTGS; } + + /** + \brief Allocates and returns a thread context object. + \return A thread context. + */ + PX_FORCE_INLINE ThreadContext* getThreadContext() + { + return mThreadContextPool.get(); + } + + /** + \brief Returns a thread context to the thread context pool. + \param[in] context The thread context to return to the thread context pool. + */ + void putThreadContext(ThreadContext* context) + { + mThreadContextPool.put(context); + } + + + PX_FORCE_INLINE PxU32 getKinematicCount() const { return mKinematicCount; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + + PX_FORCE_INLINE PxReal getLengthScale() const { return mLengthScale; } + + protected: + + /** + \brief Constructor for DynamicsContext + */ + DynamicsTGSContext(PxcNpMemBlockPool* memBlockPool, + PxcScratchAllocator& scratchAllocator, + Cm::FlushPool& taskPool, + PxvSimStats& simStats, + PxTaskManager* taskManager, + PxVirtualAllocatorCallback* allocator, + PxsMaterialManager* materialManager, + IG::SimpleIslandManager* islandManager, + PxU64 contextID, + const bool enableStabilization, + const bool useEnhancedDeterminism, + const PxReal lengthScale + ); + /** + \brief Destructor for DynamicsContext + */ + virtual ~DynamicsTGSContext(); + + + // Solver helper-methods + /** + \brief Computes the unconstrained velocity for a given PxsRigidBody + \param[in] atom The PxsRigidBody + */ + void computeUnconstrainedVelocity(PxsRigidBody* atom) const; + + /** + \brief fills in a PxSolverConstraintDesc from an indexed interaction + \param[in,out] desc The PxSolverConstraintDesc + \param[in] constraint The PxsIndexedInteraction + */ + void setDescFromIndices(PxSolverConstraintDesc& desc, const IG::IslandSim& islandSim, + const PxsIndexedInteraction& constraint, const PxU32 solverBodyOffset, PxTGSSolverBodyVel* solverBodies); + + + void setDescFromIndices(PxSolverConstraintDesc& desc, IG::EdgeIndex edgeIndex, + const IG::SimpleIslandManager& islandManager, PxU32* bodyRemapTable, const PxU32 solverBodyOffset, PxTGSSolverBodyVel* solverBodies); + + + void solveIsland(const SolverIslandObjectsStep& objects, + const PxsIslandIndices& counts, + const PxU32 solverBodyOffset, + IG::SimpleIslandManager& islandManager, + PxU32* bodyRemapTable, PxsMaterialManager* materialManager, + PxsContactManagerOutputIterator& iterator, + PxBaseTask* continuation); + + void prepareBodiesAndConstraints(const SolverIslandObjectsStep& objects, + IG::SimpleIslandManager& islandManager, + IslandContextStep& islandContext); + + void setupDescs(IslandContextStep& islandContext, const SolverIslandObjectsStep& objects, PxU32* mBodyRemapTable, PxU32 mSolverBodyOffset, + PxsContactManagerOutputIterator& outputs); + + void preIntegrateBodies(PxsBodyCore** bodyArray, PxsRigidBody** originalBodyArray, + PxTGSSolverBodyVel* solverBodyVelPool, PxTGSSolverBodyTxInertia* solverBodyTxInertia, PxTGSSolverBodyData* solverBodyDataPool2, + PxU32* nodeIndexArray, const PxU32 bodyCount, const PxVec3& gravity, const PxReal dt, PxU32& posIters, PxU32& velIters, PxU32 iteration); + + void setupArticulations(IslandContextStep& islandContext, const PxVec3& gravity, const PxReal dt, PxU32& posIters, PxU32& velIters, PxBaseTask* continuation); + + PxU32 setupArticulationInternalConstraints(IslandContextStep& islandContext, PxReal dt, PxReal invStepDt); + + void createSolverConstraints(PxSolverConstraintDesc* contactDescPtr, PxConstraintBatchHeader* headers, const PxU32 nbHeaders, + PxsContactManagerOutputIterator& outputs, Dy::ThreadContext& islandThreadContext, Dy::ThreadContext& threadContext, PxReal stepDt, PxReal totalDt, + PxReal invStepDt, const PxReal biasCoefficient, PxI32 velIters); + + void solveConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, PxReal invStepDt, + const PxTGSSolverBodyTxInertia* const solverTxInertia, const PxReal elapsedTime, const PxReal minPenetration, SolverContext& cache); + + template + void solveConcludeConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, + PxTGSSolverBodyTxInertia* solverTxInertia, const PxReal elapsedTime, SolverContext& cache, const PxU32 iterCount); + + template + void parallelSolveConstraints(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders, PxTGSSolverBodyTxInertia* solverTxInertia, + const PxReal elapsedTime, const PxReal minPenetration, SolverContext& cache, const PxU32 iterCount); + + void writebackConstraintsIteration(const PxConstraintBatchHeader* const hdrs, const PxSolverConstraintDesc* const contactDescPtr, const PxU32 nbHeaders); + + void parallelWritebackConstraintsIteration(const PxSolverConstraintDesc* const contactDescPtr, const PxConstraintBatchHeader* const batchHeaders, const PxU32 nbHeaders); + + void integrateBodies(const SolverIslandObjectsStep& objects, + const PxU32 count, PxTGSSolverBodyVel* vels, + PxTGSSolverBodyTxInertia* txInertias, const PxTGSSolverBodyData*const bodyDatas, PxReal dt, PxReal invTotalDt, bool averageBodies, + const PxReal ratio); + + void parallelIntegrateBodies(PxTGSSolverBodyVel* vels, PxTGSSolverBodyTxInertia* txInertias, + const PxTGSSolverBodyData* const bodyDatas, const PxU32 count, PxReal dt, const PxU32 iteration, PxReal invTotalDt, bool average, + const PxReal ratio); + + void copyBackBodies(const SolverIslandObjectsStep& objects, + PxTGSSolverBodyVel* vels, PxTGSSolverBodyTxInertia* txInertias, + PxTGSSolverBodyData* solverBodyData, PxReal invDt, IG::IslandSim& islandSim, + PxU32 startIdx, PxU32 endIdx); + + void updateArticulations(Dy::ThreadContext& threadContext, const PxU32 startIdx, const PxU32 endIdx, PxReal dt); + + void stepArticulations(Dy::ThreadContext& threadContext, const PxsIslandIndices& counts, PxReal dt, PxReal stepInvDt); + + void iterativeSolveIsland(const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& mThreadContext, + const PxReal stepDt, const PxReal invStepDt, const PxU32 posIters, const PxU32 velIters, SolverContext& cache, const PxReal ratio, + const PxReal biasCoefficient); + + void iterativeSolveIslandParallel(const SolverIslandObjectsStep& objects, const PxsIslandIndices& counts, ThreadContext& mThreadContext, + const PxReal stepDt, const PxU32 posIters, const PxU32 velIters, PxI32* solverCounts, PxI32* integrationCounts, PxI32* articulationIntegrationCounts, + PxI32* solverProgressCount, PxI32* integrationProgressCount, PxI32* articulationProgressCount, PxU32 solverUnrollSize, PxU32 integrationUnrollSize, + const PxReal ratio, const PxReal biasCoefficient); + + void endIsland(ThreadContext& mThreadContext); + + void finishSolveIsland(ThreadContext& mThreadContext, const SolverIslandObjectsStep& objects, + const PxsIslandIndices& counts, IG::SimpleIslandManager& islandManager, PxBaseTask* continuation); + + /** + \brief Resets the thread contexts + */ + void resetThreadContexts(); + + /** + \brief Returns the scratch memory allocator. + \return The scratch memory allocator. + */ + PX_FORCE_INLINE PxcScratchAllocator& getScratchAllocator() { return mScratchAllocator; } + + //Data + + PxTGSSolverBodyVel mWorldSolverBodyVel; + PxTGSSolverBodyTxInertia mWorldSolverBodyTxInertia; + PxTGSSolverBodyData mWorldSolverBodyData2; + + /** + \brief A thread context pool + */ + PxcThreadCoherentCache mThreadContextPool; + + /** + \brief Solver constraint desc array + */ + SolverStepConstraintDescPool mSolverConstraintDescPool; + + SolverStepConstraintDescPool mOrderedSolverConstraintDescPool; + + SolverStepConstraintDescPool mTempSolverConstraintDescPool; + + PxArray mContactConstraintBatchHeaders; + + /** + \brief Array of motion velocities for all bodies in the scene. + */ + PxArray mMotionVelocityArray; + + /** + \brief Array of body core pointers for all bodies in the scene. + */ + PxArray mBodyCoreArray; + + /** + \brief Array of rigid body pointers for all bodies in the scene. + */ + PxArray mRigidBodyArray; + + /** + \brief Array of articulationpointers for all articulations in the scene. + */ + PxArray mArticulationArray; + + SolverBodyVelDataPool mSolverBodyVelPool; + + SolverBodyTxInertiaPool mSolverBodyTxInertiaPool; + + SolverBodyDataStepPool mSolverBodyDataPool2; + + + ThresholdStream* mExceededForceThresholdStream[2]; //this store previous and current exceeded force thresholdStream + + PxArray mExceededForceThresholdStreamMask; + + PxArray mSolverBodyRemapTable; //Remaps from the "active island" index to the index within a solver island + + PxArray mNodeIndexArray; //island node index + + PxArray mContactList; + + /** + \brief The total number of kinematic bodies in the scene + */ + PxU32 mKinematicCount; + + /** + \brief Atomic counter for the number of threshold stream elements. + */ + PxI32 mThresholdStreamOut; + + PxsMaterialManager* mMaterialManager; + + PxsContactManagerOutputIterator mOutputIterator; + + private: + //private: + PxcScratchAllocator& mScratchAllocator; + Cm::FlushPool& mTaskPool; + PxTaskManager* mTaskManager; + PxU32 mCurrentIndex; // this is the index point to the current exceeded force threshold stream + + PxU64 mContextID; + + friend class SetupDescsTask; + friend class PreIntegrateTask; + friend class SetupArticulationTask; + friend class SetupArticulationInternalConstraintsTask; + friend class SetupSolverConstraintsTask; + friend class SolveIslandTask; + friend class EndIslandTask; + friend class SetupSolverConstraintsSubTask; + friend class ParallelSolveTask; + friend class PreIntegrateParallelTask; + friend class CopyBackTask; + friend class UpdateArticTask; + friend class FinishSolveIslandTask; + }; + +#if PX_VC +#pragma warning(pop) +#endif + + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp new file mode 100644 index 0000000..1e476ec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.cpp @@ -0,0 +1,110 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "DyThreadContext.h" +#include "foundation/PxBitUtils.h" + +namespace physx +{ +namespace Dy +{ + +ThreadContext::ThreadContext(PxcNpMemBlockPool* memBlockPool): + mFrictionPatchStreamPair(*memBlockPool), + mConstraintBlockManager (*memBlockPool), + mConstraintBlockStream (*memBlockPool), + mNumDifferentBodyConstraints(0), + mNumSelfConstraints(0), + mNumStaticConstraints(0), + mConstraintsPerPartition("ThreadContext::mConstraintsPerPartition"), + mFrictionConstraintsPerPartition("ThreadContext::frictionsConstraintsPerPartition"), + mPartitionNormalizationBitmap("ThreadContext::mPartitionNormalizationBitmap"), + frictionConstraintDescArray("ThreadContext::solverFrictionConstraintArray"), + frictionConstraintBatchHeaders("ThreadContext::frictionConstraintBatchHeaders"), + compoundConstraints("ThreadContext::compoundConstraints"), + orderedContactList("ThreadContext::orderedContactList"), + tempContactList("ThreadContext::tempContactList"), + sortIndexArray("ThreadContext::sortIndexArray"), + mConstraintSize (0), + mAxisConstraintCount(0), + mSelfConstraintBlocks(NULL), + mMaxPartitions(0), + mMaxSolverPositionIterations(0), + mMaxSolverVelocityIterations(0), + mContactDescPtr(NULL), + mFrictionDescPtr(NULL), + mArticulations("ThreadContext::articulations") + +{ +#if PX_ENABLE_SIM_STATS + mThreadSimStats.clear(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + //Defaulted to have space for 16384 bodies + mPartitionNormalizationBitmap.reserve(512); + //Defaulted to have space for 128 partitions (should be more-than-enough) + mConstraintsPerPartition.reserve(128); +} + +void ThreadContext::resizeArrays(PxU32 frictionConstraintDescCount, PxU32 articulationCount) +{ + // resize resizes smaller arrays to the exact target size, which can generate a lot of churn + frictionConstraintDescArray.forceSize_Unsafe(0); + frictionConstraintDescArray.reserve((frictionConstraintDescCount+63)&~63); + + mArticulations.forceSize_Unsafe(0); + mArticulations.reserve(PxMax(PxNextPowerOfTwo(articulationCount), 16)); + mArticulations.forceSize_Unsafe(articulationCount); + + mContactDescPtr = contactConstraintDescArray; + mFrictionDescPtr = frictionConstraintDescArray.begin(); +} + +void ThreadContext::reset() +{ + // TODO: move these to the PxcNpThreadContext + mFrictionPatchStreamPair.reset(); + mConstraintBlockStream.reset(); + + mContactDescPtr = contactConstraintDescArray; + mFrictionDescPtr = frictionConstraintDescArray.begin(); + + mAxisConstraintCount = 0; + mMaxSolverPositionIterations = 0; + mMaxSolverVelocityIterations = 0; + mNumDifferentBodyConstraints = 0; + mNumSelfConstraints = 0; + mNumStaticConstraints = 0; + mSelfConstraintBlocks = NULL; + mConstraintSize = 0; +} + +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.h new file mode 100644 index 0000000..1c6e643 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThreadContext.h @@ -0,0 +1,210 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef DY_THREAD_CONTEXT_H +#define DY_THREAD_CONTEXT_H + +#include "foundation/PxTransform.h" +#include "geomutils/PxContactBuffer.h" + +#include "PxvConfig.h" +#include "PxvDynamics.h" +#include "PxcThreadCoherentCache.h" +#include "PxcConstraintBlockStream.h" +#include "foundation/PxBitMap.h" +#include "DyThresholdTable.h" +#include "DyVArticulation.h" +#include "DyFrictionPatchStreamPair.h" +#include "DySolverConstraintDesc.h" +#include "DyCorrelationBuffer.h" +#include "foundation/PxAllocator.h" + +namespace physx +{ +struct PxsIndexedContactManager; + +namespace Dy +{ + +/*! +Cache information specific to the software implementation(non common). + +See PxcgetThreadContext. + +Not thread-safe, so remember to have one object per thread! + +TODO! refactor this and rename(it is a general per thread cache). Move transform cache into its own class. +*/ +class ThreadContext : + public PxcThreadCoherentCache::EntryBase +{ + PX_NOCOPY(ThreadContext) +public: + +#if PX_ENABLE_SIM_STATS + struct ThreadSimStats + { + void clear() + { + + numActiveConstraints = 0; + numActiveDynamicBodies = 0; + numActiveKinematicBodies = 0; + numAxisSolverConstraints = 0; + + } + + PxU32 numActiveConstraints; + PxU32 numActiveDynamicBodies; + PxU32 numActiveKinematicBodies; + PxU32 numAxisSolverConstraints; + + }; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + //TODO: tune cache size based on number of active objects. + ThreadContext(PxcNpMemBlockPool* memBlockPool); + void reset(); + void resizeArrays(PxU32 frictionConstraintDescCount, PxU32 articulationCount); + + PX_FORCE_INLINE PxArray& getArticulations() { return mArticulations; } + + +#if PX_ENABLE_SIM_STATS + PX_FORCE_INLINE ThreadSimStats& getSimStats() + { + return mThreadSimStats; + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + PxContactBuffer mContactBuffer; + + // temporary buffer for correlation + PX_ALIGN(16, CorrelationBuffer mCorrelationBuffer); + + FrictionPatchStreamPair mFrictionPatchStreamPair; // patch streams + + PxsConstraintBlockManager mConstraintBlockManager; // for when this thread context is "lead" on an island + PxcConstraintBlockStream mConstraintBlockStream; // constraint block pool + + + // this stuff is just used for reformatting the solver data. Hopefully we should have a more + // sane format for this when the dust settles - so it's just temporary. If we keep this around + // here we should move these from public to private + + PxU32 mNumDifferentBodyConstraints; + PxU32 mNumDifferentBodyFrictionConstraints; + PxU32 mNumSelfConstraints; + PxU32 mNumStaticConstraints; + PxU32 mNumSelfFrictionConstraints; + PxU32 mNumSelfConstraintFrictionBlocks; + bool mHasOverflowPartitions; + + PxArray mConstraintsPerPartition; + PxArray mFrictionConstraintsPerPartition; + PxArray mPartitionNormalizationBitmap; + PxsBodyCore** mBodyCoreArray; + PxsRigidBody** mRigidBodyArray; + FeatherstoneArticulation** mArticulationArray; + Cm::SpatialVector* motionVelocityArray; + PxU32* bodyRemapTable; + PxU32* mNodeIndexArray; + + //Constraint info for normal constraint sovler + PxSolverConstraintDesc* contactConstraintDescArray; + PxU32 contactDescArraySize; + PxSolverConstraintDesc* orderedContactConstraints; + PxConstraintBatchHeader* contactConstraintBatchHeaders; + PxU32 numContactConstraintBatches; + + //Constraint info for partitioning + PxSolverConstraintDesc* tempConstraintDescArray; + + //Additional constraint info for 1d/2d friction model + PxArray frictionConstraintDescArray; + PxArray frictionConstraintBatchHeaders; + + //Info for tracking compound contact managers (temporary data - could use scratch memory!) + PxArray compoundConstraints; + + //Used for sorting constraints. Temporary, could use scratch memory + PxArray orderedContactList; + PxArray tempContactList; + PxArray sortIndexArray; + + PxArray mZVector; + PxArray mDeltaV; + + + PxU32 numDifferentBodyBatchHeaders; + PxU32 numSelfConstraintBatchHeaders; + + + PxU32 mOrderedContactDescCount; + PxU32 mOrderedFrictionDescCount; + + PxU32 mConstraintSize; + + PxU32 mAxisConstraintCount; + SelfConstraintBlock* mSelfConstraintBlocks; + + SelfConstraintBlock* mSelfConstraintFrictionBlocks; + + PxU32 mMaxPartitions; + PxU32 mMaxFrictionPartitions; + PxU32 mMaxSolverPositionIterations; + PxU32 mMaxSolverVelocityIterations; + PxU32 mMaxArticulationLinks; + + PxSolverConstraintDesc* mContactDescPtr; + PxSolverConstraintDesc* mStartContactDescPtr; + PxSolverConstraintDesc* mFrictionDescPtr; + +private: + + PxArray mArticulations; + +#if PX_ENABLE_SIM_STATS + ThreadSimStats mThreadSimStats; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + public: + +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp new file mode 100644 index 0000000..d8e04c9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/lowleveldynamics/src/DyThresholdTable.cpp @@ -0,0 +1,67 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "foundation/PxHash.h" +#include "foundation/PxAllocator.h" +#include "DyThresholdTable.h" +#include "foundation/PxUtilities.h" + +namespace physx +{ + namespace Dy + { + bool ThresholdTable::check(const ThresholdStream& stream, const PxU32 nodeIndexA, const PxU32 nodeIndexB, PxReal dt) + { + PxU32* PX_RESTRICT hashes = mHash; + PxU32* PX_RESTRICT nextIndices = mNexts; + Pair* PX_RESTRICT pairs = mPairs; + + /*const PxsRigidBody* b0 = PxMin(body0, body1); + const PxsRigidBody* b1 = PxMax(body0, body1);*/ + + const PxU32 nA = PxMin(nodeIndexA, nodeIndexB); + const PxU32 nB = PxMax(nodeIndexA, nodeIndexB); + + PxU32 hashKey = computeHashKey(nodeIndexA, nodeIndexB, mHashSize); + + PxU32 pairIndex = hashes[hashKey]; + while(NO_INDEX != pairIndex) + { + Pair& pair = pairs[pairIndex]; + const PxU32 thresholdStreamIndex = pair.thresholdStreamIndex; + PX_ASSERT(thresholdStreamIndex < stream.size()); + const ThresholdStreamElement& otherElement = stream[thresholdStreamIndex]; + if(otherElement.nodeIndexA.index()==nA && otherElement.nodeIndexB.index()==nB) + return (pair.accumulatedForce > (otherElement.threshold * dt)); + pairIndex = nextIndices[pairIndex]; + } + return false; + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp new file mode 100644 index 0000000..4da463e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.cpp @@ -0,0 +1,561 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpActor.h" +#include "PxRigidActor.h" +#include "NpConstraint.h" +#include "NpFactory.h" +#include "NpShape.h" +#include "NpPhysics.h" +#include "NpAggregate.h" +#include "NpScene.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "CmTransformUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "NpSoftBody.h" +#include "NpParticleSystem.h" + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "NpHairSystem.h" +#include "NpFEMCloth.h" +#endif +#endif + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////// + +Sc::BodyCore* physx::getBodyCore(PxRigidActor* actor) +{ + Sc::BodyCore* core = NULL; + if(actor) + { + const PxType type = actor->getConcreteType(); + if(type == PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic* dyn = static_cast(actor); + core = &dyn->getCore(); + } + else if(type == PxConcreteType::eARTICULATION_LINK) + { + NpArticulationLink* link = static_cast(actor); + core = &link->getCore(); + } + } + return core; +} + +/////////////////////////////////////////////////////////////////////////////// + +NpActor::NpActor(NpType::Enum type) : + NpBase (type), + mName (NULL), + mConnectorArray (NULL) +{ +} + +typedef PxHashMap ConnectorMap; +struct NpActorUserData +{ + PxU32 referenceCount; + ConnectorMap* tmpOriginalConnectors; +}; + +void NpActor::exportExtraData(PxSerializationContext& stream) +{ + const PxCollection& collection = stream.getCollection(); + if(mConnectorArray) + { + PxU32 connectorSize = mConnectorArray->size(); + PxU32 missedCount = 0; + for(PxU32 i = 0; i < connectorSize; ++i) + { + NpConnector& c = (*mConnectorArray)[i]; + PxBase* object = c.mObject; + if(!collection.contains(*object)) + { + ++missedCount; + } + } + + NpConnectorArray* exportConnectorArray = mConnectorArray; + + if(missedCount > 0) + { + exportConnectorArray = NpFactory::getInstance().acquireConnectorArray(); + if(missedCount < connectorSize) + { + exportConnectorArray->reserve(connectorSize - missedCount); + for(PxU32 i = 0; i < connectorSize; ++i) + { + NpConnector& c = (*mConnectorArray)[i]; + PxBase* object = c.mObject; + if(collection.contains(*object)) + { + exportConnectorArray->pushBack(c); + } + } + } + } + + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(exportConnectorArray, sizeof(NpConnectorArray)); + Cm::exportInlineArray(*exportConnectorArray, stream); + + if(missedCount > 0) + NpFactory::getInstance().releaseConnectorArray(exportConnectorArray); + } + stream.writeName(mName); +} + +void NpActor::importExtraData(PxDeserializationContext& context) +{ + if(mConnectorArray) + { + mConnectorArray = context.readExtraData(); + PX_PLACEMENT_NEW(mConnectorArray, NpConnectorArray(PxEmpty)); + + if(mConnectorArray->size() == 0) + mConnectorArray = NULL; + else + Cm::importInlineArray(*mConnectorArray, context); + } + context.readName(mName); +} + +void NpActor::resolveReferences(PxDeserializationContext& context) +{ + // Resolve connector pointers if needed + if(mConnectorArray) + { + const PxU32 nbConnectors = mConnectorArray->size(); + for(PxU32 i=0; isize(); + PxU32 currentIndex = 0; + while(nbConnectors--) + { + NpConnector& connector = (*mConnectorArray)[currentIndex]; + if (connector.mType == NpConnectorType::eConstraint) + { + NpConstraint* c = static_cast(connector.mObject); + c->actorDeleted(&owner); + + NpScene* s = c->getNpScene(); + if(s) + s->removeFromConstraintList(*c); + + removeConnector(owner, currentIndex); + } + else + currentIndex++; + } + } +} + +void NpActor::removeFromAggregate(PxActor& owner) +{ + if(mConnectorArray) // Need to test again because the code above might purge the connector array if no element remains + { + PX_ASSERT(mConnectorArray->size() == 1); // At this point only the aggregate should remain + PX_ASSERT((*mConnectorArray)[0].mType == NpConnectorType::eAggregate); + + NpAggregate* a = static_cast((*mConnectorArray)[0].mObject); + bool status = a->removeActorAndReinsert(owner, false); + PX_ASSERT(status); + PX_UNUSED(status); + PX_ASSERT(!mConnectorArray); // Remove should happen in aggregate code + } + + PX_ASSERT(!mConnectorArray); // All the connector objects should have been removed at this point +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 NpActor::findConnector(NpConnectorType::Enum type, PxBase* object) const +{ + if(!mConnectorArray) + return 0xffffffff; + + for(PxU32 i=0; i < mConnectorArray->size(); i++) + { + NpConnector& c = (*mConnectorArray)[i]; + if (c.mType == type && c.mObject == object) + return i; + } + + return 0xffffffff; +} + +void NpActor::addConnector(NpConnectorType::Enum type, PxBase* object, const char* errMsg) +{ + if(!mConnectorArray) + mConnectorArray = NpFactory::getInstance().acquireConnectorArray(); + + PX_CHECK_MSG(findConnector(type, object) == 0xffffffff, errMsg); + PX_UNUSED(errMsg); + + if(mConnectorArray->isInUserMemory() && mConnectorArray->size() == mConnectorArray->capacity()) + { + NpConnectorArray* newConnectorArray = NpFactory::getInstance().acquireConnectorArray(); + newConnectorArray->assign(mConnectorArray->begin(), mConnectorArray->end()); + mConnectorArray->~NpConnectorArray(); + mConnectorArray = newConnectorArray; + } + + NpConnector c(type, object); + mConnectorArray->pushBack(c); +} + +void NpActor::removeConnector(PxActor& /*owner*/, PxU32 index) +{ + PX_ASSERT(mConnectorArray); + PX_ASSERT(index < mConnectorArray->size()); + + mConnectorArray->replaceWithLast(index); + + if(mConnectorArray->size() == 0) + { + if(!mConnectorArray->isInUserMemory()) + NpFactory::getInstance().releaseConnectorArray(mConnectorArray); + else + mConnectorArray->~NpConnectorArray(); + mConnectorArray = NULL; + } +} + +void NpActor::removeConnector(PxActor& owner, NpConnectorType::Enum type, PxBase* object, const char* errorMsg) +{ + PX_CHECK_MSG(mConnectorArray, errorMsg); + PX_UNUSED(errorMsg); + + if(mConnectorArray) + { + PxU32 index = findConnector(type, object); + + PX_CHECK_MSG(index != 0xffffffff, errorMsg); + + removeConnector(owner, index); + } +} + +PxU32 NpActor::getNbConnectors(NpConnectorType::Enum type) const +{ + PxU32 nbConnectors = 0; + + if(mConnectorArray) + { + for(PxU32 i=0; i < mConnectorArray->size(); i++) + { + if ((*mConnectorArray)[i].mType == type) + nbConnectors++; + } + } + + return nbConnectors; +} + +/////////////////////////////////////////////////////////////////////////////// + +NpAggregate* NpActor::getNpAggregate(PxU32& index) const +{ + PX_ASSERT(getNbConnectors(NpConnectorType::eAggregate) <= 1); + + if(mConnectorArray) + { + // PT: TODO: sort by type to optimize this... + for(PxU32 i=0; i < mConnectorArray->size(); i++) + { + NpConnector& c = (*mConnectorArray)[i]; + if (c.mType == NpConnectorType::eAggregate) + { + index = i; + return static_cast(c.mObject); + } + } + } + + return NULL; +} + +void NpActor::setAggregate(NpAggregate* np, PxActor& owner) +{ + PxU32 index = 0xffffffff; + NpAggregate* a = getNpAggregate(index); + + if (!a) + { + PX_ASSERT(np); + addConnector(NpConnectorType::eAggregate, np, "NpActor::setAggregate() failed"); + } + else + { + PX_ASSERT(mConnectorArray); + PX_ASSERT(index != 0xffffffff); + if (!np) + removeConnector(owner, index); + else + (*mConnectorArray)[index].mObject = np; + } +} + +PxAggregate* NpActor::getAggregate() const +{ + PxU32 index = 0xffffffff; + NpAggregate* a = getNpAggregate(index); + return static_cast(a); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpActor::removeConstraintsFromScene() +{ + NpConnectorIterator iter = getConnectorIterator(NpConnectorType::eConstraint); + while (PxBase* ser = iter.getNext()) + { + NpConstraint* c = static_cast(ser); + + NpScene* s = c->getNpScene(); + if(s) + s->removeFromConstraintList(*c); + } +} + +void NpActor::addConstraintsToSceneInternal() +{ + if(!mConnectorArray) + return; + + NpConnectorIterator iter = getConnectorIterator(NpConnectorType::eConstraint); + while (PxBase* ser = iter.getNext()) + { + NpConstraint* c = static_cast(ser); + PX_ASSERT(c->getNpScene() == NULL); + + c->markDirty(); // PT: "temp" fix for crash when removing/re-adding jointed actor from/to a scene + + NpScene* s = c->getSceneFromActors(); + if(s) + s->addToConstraintList(*c); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE const NpShapeManager* getShapeManager(const PxRigidActor& actor) +{ + // DS: if the performance here becomes an issue we can use the same kind of offset hack as below + + const PxType actorType = actor.getConcreteType(); + + if (actorType == PxConcreteType::eRIGID_DYNAMIC) + return &static_cast(actor).getShapeManager(); + else if(actorType == PxConcreteType::eRIGID_STATIC) + return &static_cast(actor).getShapeManager(); + else if (actorType == PxConcreteType::eARTICULATION_LINK) + return &static_cast(actor).getShapeManager(); + else + { + PX_ASSERT(0); + return NULL; + } +} + +NpShapeManager* NpActor::getShapeManager_(PxRigidActor& actor) { return const_cast(getShapeManager(actor)); } +const NpShapeManager* NpActor::getShapeManager_(const PxRigidActor& actor) { return getShapeManager(actor); } + +void NpActor::onActorRelease(PxActor* actor) +{ + NpFactory::getInstance().onActorRelease(actor); +} + +void NpActor::scSetDominanceGroup(PxDominanceGroup v) + { + PX_ASSERT(!isAPIWriteForbidden()); + getActorCore().setDominanceGroup(v); + UPDATE_PVD_PROPERTY + OMNI_PVD_SET(actor, dominance, *getPxActor(), v) + } + +void NpActor::scSetOwnerClient(PxClientID inId) + { + //This call is only valid if we aren't in a scene. + PX_ASSERT(!isAPIWriteForbidden()); + getActorCore().setOwnerClient(inId); + UPDATE_PVD_PROPERTY + OMNI_PVD_SET(actor, ownerClient, *getPxActor(), inId) + } + +const PxActor* NpActor::getPxActor() const + { + const PxActorType::Enum type = getActorCore().getActorCoreType(); + if(type == PxActorType::eRIGID_DYNAMIC) + return static_cast(this); + else if(type == PxActorType::eRIGID_STATIC) + return static_cast(this); + else if(type == PxActorType::eARTICULATION_LINK) + return static_cast(this); + PX_ASSERT(0); + return NULL; + } + +namespace +{ + template NpActor* pxToNpActor(PxActor *p) + { + return static_cast(static_cast(p)); + } +} + +NpActor::Offsets::Offsets() +{ + for(PxU32 i=0;i(addr); + pxActorToNpActor[PxConcreteType::eRIGID_STATIC] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eRIGID_DYNAMIC] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eARTICULATION_LINK] = size_t(pxToNpActor(n)) - addr; + +#if PX_SUPPORT_GPU_PHYSX + pxActorToNpActor[PxConcreteType::eSOFT_BODY] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::ePBD_PARTICLESYSTEM] = size_t(pxToNpActor(n)) - addr; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + pxActorToNpActor[PxConcreteType::eFLIP_PARTICLESYSTEM] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eMPM_PARTICLESYSTEM] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eCUSTOM_PARTICLESYSTEM] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eFEM_CLOTH] = size_t(pxToNpActor(n)) - addr; + pxActorToNpActor[PxConcreteType::eHAIR_SYSTEM] = size_t(pxToNpActor(n)) - addr; +#endif +#endif +} + +const NpActor::Offsets NpActor::sOffsets; + +NpActor::NpOffsets::NpOffsets() +{ + // PT: ..... + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpRigidStatic* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t staticOffset = NpRigidStatic::getCoreOffset() - npOffset; + npToSc[NpType::eRIGID_STATIC] = staticOffset; + } + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpRigidDynamic* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpRigidDynamic::getCoreOffset() - npOffset; + npToSc[NpType::eBODY] = bodyOffset; + } + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpArticulationLink* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpArticulationLink::getCoreOffset() - npOffset; + npToSc[NpType::eBODY_FROM_ARTICULATION_LINK] = bodyOffset; + } +#if PX_SUPPORT_GPU_PHYSX + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpSoftBody* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpSoftBody::getCoreOffset() - npOffset; + npToSc[NpType::eSOFTBODY] = bodyOffset; + } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpFEMCloth* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpFEMCloth::getCoreOffset() - npOffset; + npToSc[NpType::eFEMCLOTH] = bodyOffset; + } +#endif + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpPBDParticleSystem* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpPBDParticleSystem::getCoreOffset() - npOffset; + npToSc[NpType::ePBD_PARTICLESYSTEM] = bodyOffset; + } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpFLIPParticleSystem* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpFLIPParticleSystem::getCoreOffset() - npOffset; + npToSc[NpType::eFLIP_PARTICLESYSTEM] = bodyOffset; + } + + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpMPMParticleSystem* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpMPMParticleSystem::getCoreOffset() - npOffset; + npToSc[NpType::eMPM_PARTICLESYSTEM] = bodyOffset; + } + + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpCustomParticleSystem* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpCustomParticleSystem::getCoreOffset() - npOffset; + npToSc[NpType::eCUSTOM_PARTICLESYSTEM] = bodyOffset; + } + + { + size_t addr = 0x100; // casting the null ptr takes a special-case code path, which we don't want + NpHairSystem* n = reinterpret_cast(addr); + const size_t npOffset = size_t(static_cast(n)) - addr; + const size_t bodyOffset = NpHairSystem::getCoreOffset() - npOffset; + npToSc[NpType::eHAIRSYSTEM] = bodyOffset; + } +#endif +#endif +} + +const NpActor::NpOffsets NpActor::sNpOffsets; + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.h new file mode 100644 index 0000000..c6f115f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActor.h @@ -0,0 +1,205 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ACTOR_H +#define NP_ACTOR_H + +#include "NpConnector.h" +#include "NpBase.h" + +namespace physx +{ + class NpShapeManager; + class NpAggregate; + class NpScene; + class NpShape; + + Sc::BodyCore* getBodyCore(PxRigidActor* actor); + +class NpActor : public NpBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + +public: +// PX_SERIALIZATION + NpActor(const PxEMPTY) : NpBase(PxEmpty) {} + void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpActor(NpType::Enum type); + + void removeConstraints(PxRigidActor& owner); + void removeFromAggregate(PxActor& owner); + + NpAggregate* getNpAggregate(PxU32& index) const; + void setAggregate(NpAggregate* np, PxActor& owner); + PxAggregate* getAggregate() const; + void scSetDominanceGroup(PxDominanceGroup v); + void scSetOwnerClient(PxClientID inId); + void removeConstraintsFromScene(); + PX_FORCE_INLINE void addConstraintsToScene() // inline the fast path for addActors() + { + if(mConnectorArray) + addConstraintsToSceneInternal(); + } + + PxU32 findConnector(NpConnectorType::Enum type, PxBase* object) const; + void addConnector(NpConnectorType::Enum type, PxBase* object, const char* errMsg); + void removeConnector(PxActor& owner, NpConnectorType::Enum type, PxBase* object, const char* errorMsg); + PxU32 getNbConnectors(NpConnectorType::Enum type) const; + + static NpShapeManager* getShapeManager_(PxRigidActor& actor); // bit misplaced here, but we don't want a separate subclass just for this + static const NpShapeManager* getShapeManager_(const PxRigidActor& actor); // bit misplaced here, but we don't want a separate subclass just for this + + static NpActor& getFromPxActor(PxActor& actor) { return *PxPointerOffset(&actor, ptrdiff_t(sOffsets.pxActorToNpActor[actor.getConcreteType()])); } + static const NpActor& getFromPxActor(const PxActor& actor) { return *PxPointerOffset(&actor, ptrdiff_t(sOffsets.pxActorToNpActor[actor.getConcreteType()])); } + + const PxActor* getPxActor() const; + + static NpScene* getNpSceneFromActor(const PxActor& actor) + { + return getFromPxActor(actor).getNpScene(); + } + + PX_FORCE_INLINE NpConnectorIterator getConnectorIterator(NpConnectorType::Enum type) + { + if (mConnectorArray) + return NpConnectorIterator(&mConnectorArray->front(), mConnectorArray->size(), type); + else + return NpConnectorIterator(NULL, 0, type); + } + + static void onActorRelease(PxActor* actor); + + template PxU32 getConnectors(NpConnectorType::Enum type, T** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const + { + PxU32 nbConnectors = 0; + if(mConnectorArray) + { + for(PxU32 i=0; isize(); i++) + { + NpConnector& c = (*mConnectorArray)[i]; + if(c.mType == type && nbConnectors < bufferSize && i>=startIndex) + userBuffer[nbConnectors++] = static_cast(c.mObject); + } + } + return nbConnectors; + } + + PX_INLINE PxActorFlags getActorFlags() const { return getActorCore().getActorFlags(); } + PX_INLINE PxDominanceGroup getDominanceGroup() const { return getActorCore().getDominanceGroup(); } + PX_INLINE PxClientID getOwnerClient() const { return getActorCore().getOwnerClient(); } + + PX_INLINE void scSetActorFlags(PxActorFlags v) + { + PX_ASSERT(!isAPIWriteForbidden()); + + // PT: TODO: move this check out of here, they should be done in Np! +#if PX_CHECKED + const PxActorFlags aFlags = getActorFlags(); + const NpType::Enum npType = getNpType(); + if((!aFlags.isSet(PxActorFlag::eDISABLE_SIMULATION)) && v.isSet(PxActorFlag::eDISABLE_SIMULATION) && + (npType != NpType::eBODY) && (npType != NpType::eRIGID_STATIC)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxActor::setActorFlag: PxActorFlag::eDISABLE_SIMULATION is only supported by PxRigidDynamic and PxRigidStatic objects."); + } +#endif + getActorCore().setActorFlags(v); + UPDATE_PVD_PROPERTY + } + + + PX_FORCE_INLINE const Sc::ActorCore& getActorCore() const + { + return *reinterpret_cast(size_t(this) + sNpOffsets.npToSc[getNpType()]); + } + PX_FORCE_INLINE Sc::ActorCore& getActorCore() + { + return *reinterpret_cast(size_t(this) + sNpOffsets.npToSc[getNpType()]); + } + + PX_INLINE const Sc::RigidCore& getScRigidCore() const + { + return static_cast(getActorCore()); + } + PX_INLINE Sc::RigidCore& getScRigidCore() + { + return static_cast(getActorCore()); + } + + PX_FORCE_INLINE void scSwitchToNoSim() + { + NpScene* scene = getNpScene(); + + if(scene && (!scene->isAPIWriteForbidden())) + scene->scSwitchRigidToNoSim(*this); + } + + PX_FORCE_INLINE void scSwitchFromNoSim() + { + NpScene* scene = getNpScene(); + + if(scene && (!scene->isAPIWriteForbidden())) + scene->scSwitchRigidFromNoSim(*this); + } +protected: + ~NpActor() {} + const char* mName; + // Lazy-create array for connector objects like constraints, observers, ... + // Most actors have no such objects, so we bias this class accordingly: + NpConnectorArray* mConnectorArray; +private: + void addConstraintsToSceneInternal(); + void removeConnector(PxActor& owner, PxU32 index); + struct Offsets + { + size_t pxActorToNpActor[PxConcreteType::ePHYSX_CORE_COUNT]; + Offsets(); + }; +public: + static const Offsets sOffsets; + + struct NpOffsets + { + size_t npToSc[NpType::eTYPE_COUNT]; + NpOffsets(); + }; + static const NpOffsets sNpOffsets; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActorTemplate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActorTemplate.h new file mode 100644 index 0000000..a1a8e82 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpActorTemplate.h @@ -0,0 +1,245 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ACTOR_TEMPLATE_H +#define NP_ACTOR_TEMPLATE_H + +#include "NpCheck.h" +#include "NpActor.h" +#include "NpScene.h" + +#include "omnipvd/OmniPvdPxSampler.h" + +namespace physx +{ + +// PT: only API (virtual) functions should be implemented here. Other shared non-virtual functions should go to NpActor. + +/** +This is an API class. API classes run in a different thread than the simulation. +For the sake of simplicity they have their own methods, and they do not call simulation +methods directly. To set simulation state, they also have their own custom set +methods in the implementation classes. + +Changing the data layout of this class breaks the binary serialization format. +See comments for PX_BINARY_SERIAL_VERSION. +*/ +template +class NpActorTemplate : public APIClass, public NpActor +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== + PX_NOCOPY(NpActorTemplate) +public: +// PX_SERIALIZATION + NpActorTemplate(PxBaseFlags baseFlags) : APIClass(baseFlags), NpActor(PxEmpty) {} + + virtual void exportExtraData(PxSerializationContext& context) { NpActor::exportExtraData(context); } + virtual void importExtraData(PxDeserializationContext& context) { NpActor::importExtraData(context); } + virtual void resolveReferences(PxDeserializationContext& context) { NpActor::resolveReferences(context); } +//~PX_SERIALIZATION + + NpActorTemplate(PxType concreteType, PxBaseFlags baseFlags, NpType::Enum type); + virtual ~NpActorTemplate(); + + // The rule is: If an API method is used somewhere in here, it has to be redeclared, else GCC whines + + // PxActor + virtual void release() = 0; + virtual PxActorType::Enum getType() const = 0; + virtual PxScene* getScene() const PX_OVERRIDE; + virtual void setName(const char*) PX_OVERRIDE; + virtual const char* getName() const PX_OVERRIDE; + virtual PxBounds3 getWorldBounds(float inflation=1.01f) const = 0; + virtual void setActorFlag(PxActorFlag::Enum flag, bool value) PX_OVERRIDE; + virtual void setActorFlags(PxActorFlags inFlags) PX_OVERRIDE; + virtual PxActorFlags getActorFlags() const PX_OVERRIDE; + virtual void setDominanceGroup(PxDominanceGroup dominanceGroup) PX_OVERRIDE; + virtual PxDominanceGroup getDominanceGroup() const PX_OVERRIDE; + virtual void setOwnerClient( PxClientID inClient ) PX_OVERRIDE; + virtual PxClientID getOwnerClient() const PX_OVERRIDE; + virtual PxAggregate* getAggregate() const PX_OVERRIDE { return NpActor::getAggregate(); } + //~PxActor + +protected: + PX_FORCE_INLINE void setActorFlagInternal(PxActorFlag::Enum flag, bool value); + PX_FORCE_INLINE void setActorFlagsInternal(PxActorFlags inFlags); +}; + +/////////////////////////////////////////////////////////////////////////////// + +template +NpActorTemplate::NpActorTemplate(PxType concreteType, PxBaseFlags baseFlags, NpType::Enum type) : + APIClass(concreteType, baseFlags), + NpActor (type) +{ + PX_ASSERT(!APIClass::userData); +} + +template +NpActorTemplate::~NpActorTemplate() +{ + NpActor::onActorRelease(this); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +PxScene* NpActorTemplate::getScene() const +{ + return getNpScene(); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +void NpActorTemplate::setName(const char* debugName) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxActor::setName() not allowed while simulation is running. Call will be ignored.") + + mName = debugName; + +#if PX_SUPPORT_OMNI_PVD + PxActor & a = *this; + streamActorName(a, mName); +#endif + + +#if PX_SUPPORT_PVD + NpScene* npScene = getNpScene(); + //Name changing is not bufferred + if(npScene) + npScene->getScenePvdClientInternal().updatePvdProperties(static_cast(this)); +#endif +} + +template +const char* NpActorTemplate::getName() const +{ + NP_READ_CHECK(getNpScene()); + return mName; +} + +/////////////////////////////////////////////////////////////////////////////// + +template +void NpActorTemplate::setDominanceGroup(PxDominanceGroup dominanceGroup) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxActor::setDominanceGroup() not allowed while simulation is running. Call will be ignored.") + + NpActor::scSetDominanceGroup(dominanceGroup); +} + +template +PxDominanceGroup NpActorTemplate::getDominanceGroup() const +{ + NP_READ_CHECK(getNpScene()); + return NpActor::getDominanceGroup(); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +void NpActorTemplate::setOwnerClient( PxClientID inId ) +{ + if ( getNpScene() != NULL ) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Attempt to set the client id when an actor is already in a scene."); + } + else + NpActor::scSetOwnerClient( inId ); +} + +template +PxClientID NpActorTemplate::getOwnerClient() const +{ + return NpActor::getOwnerClient(); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +PX_FORCE_INLINE void NpActorTemplate::setActorFlagInternal(PxActorFlag::Enum flag, bool value) +{ + NpActor& a = *this; + if (value) + a.scSetActorFlags( a.getActorFlags() | flag ); + else + a.scSetActorFlags( a.getActorFlags() & (~PxActorFlags(flag)) ); +} + +template +PX_FORCE_INLINE void NpActorTemplate::setActorFlagsInternal(PxActorFlags inFlags) +{ + NpActor::scSetActorFlags(inFlags); +} + +template +void NpActorTemplate::setActorFlag(PxActorFlag::Enum flag, bool value) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxActor::setActorFlag() not allowed while simulation is running. Call will be ignored.") + + setActorFlagInternal(flag, value); +} + +template +void NpActorTemplate::setActorFlags(PxActorFlags inFlags) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxActor::setActorFlags() not allowed while simulation is running. Call will be ignored.") + + setActorFlagsInternal(inFlags); +} + +template +PxActorFlags NpActorTemplate::getActorFlags() const +{ + NP_READ_CHECK(getNpScene()); + return NpActor::getActorFlags(); +} + +/////////////////////////////////////////////////////////////////////////////// + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp new file mode 100644 index 0000000..2bb1b89 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.cpp @@ -0,0 +1,523 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpAggregate.h" +#include "PxActor.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpActor.h" +#include "GuBVH.h" +#include "CmUtils.h" +#include "NpArticulationReducedCoordinate.h" + +using namespace physx; + +namespace +{ +#if PX_SUPPORT_PVD + PX_FORCE_INLINE void PvdAttachActorToAggregate(NpAggregate* pAggregate, NpActor* pscActor) + { + NpScene* npScene = pAggregate->getNpScene(); + if(npScene/* && scScene->getScenePvdClient().isInstanceValid(pAggregate)*/) + npScene->getScenePvdClientInternal().attachAggregateActor( pAggregate, pscActor ); + } + + PX_FORCE_INLINE void PvdDetachActorFromAggregate(NpAggregate* pAggregate, NpActor* pscActor) + { + NpScene* npScene = pAggregate->getNpScene(); + if(npScene/*&& scScene->getScenePvdClient().isInstanceValid(pAggregate)*/) + npScene->getScenePvdClientInternal().detachAggregateActor( pAggregate, pscActor ); + } + + PX_FORCE_INLINE void PvdUpdateProperties(NpAggregate* pAggregate) + { + NpScene* npScene = pAggregate->getNpScene(); + if(npScene /*&& scScene->getScenePvdClient().isInstanceValid(pAggregate)*/) + npScene->getScenePvdClientInternal().updatePvdProperties( pAggregate ); + } +#else +#define PvdAttachActorToAggregate(aggregate, scActor) {} +#define PvdDetachActorFromAggregate(aggregate, scActor) {} +#define PvdUpdateProperties(aggregate) {} +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE void setAggregate(NpAggregate* aggregate, PxActor& actor) +{ + NpActor& np = NpActor::getFromPxActor(actor); + np.setAggregate(aggregate, actor); +} + +/////////////////////////////////////////////////////////////////////////////// + +NpAggregate::NpAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) : + PxAggregate (PxConcreteType::eAGGREGATE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + NpBase (NpType::eAGGREGATE), + mAggregateID (PX_INVALID_U32), + mMaxNbActors (maxActors), + mMaxNbShapes (maxShapes), + mFilterHint (filterHint), + mNbActors (0), + mNbShapes (0) +{ + mActors = PX_ALLOCATE(PxActor*, maxActors, "PxActor*"); +} + +NpAggregate::~NpAggregate() +{ + NpFactory::getInstance().onAggregateRelease(this); + if(getBaseFlags()&PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mActors); +} + +void NpAggregate::removeAndReinsert(PxActor& actor, bool reinsert) +{ + NpActor& np = NpActor::getFromPxActor(actor); + + np.setAggregate(NULL, actor); + + scRemoveActor(np, reinsert); +} + +void NpAggregate::release() +{ + NpScene* s = getNpScene(); + NP_WRITE_CHECK(s); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(s, "PxAggregate::release() not allowed while simulation is running. Call will be ignored.") + + PX_SIMD_GUARD; + + NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, NULL); + + /* + "An aggregate should be empty when it gets released. If it isn't, the behavior should be: remove the actors from + the aggregate, then remove the aggregate from the scene (if any) then delete it. I guess that implies the actors + get individually reinserted into the broad phase if the aggregate is in a scene." + */ + for(PxU32 i=0;igetType() == PxActorType::eARTICULATION_LINK) + { + NpArticulationLink* link = static_cast(mActors[i]); + NpArticulationReducedCoordinate& articulation = static_cast(link->getRoot()); + articulation.setAggregate(NULL); + } + + removeAndReinsert(*mActors[i], true); + } + + if(s) + { + s->scRemoveAggregate(*this); + s->removeFromAggregateList(*this); + } + + NpDestroyAggregate(this); +} + +void NpAggregate::addActorInternal(PxActor& actor, NpScene& s, const PxBVH* bvh) +{ + if (actor.getType() != PxActorType::eARTICULATION_LINK) + { + NpActor& np = NpActor::getFromPxActor(actor); + + scAddActor(np); + + s.addActorInternal(actor, bvh); + } + else if (!actor.getScene()) // This check makes sure that a link of an articulation gets only added once. + { + NpArticulationLink& al = static_cast(actor); + PxArticulationReducedCoordinate& npArt = al.getRoot(); + for(PxU32 i=0; i < npArt.getNbLinks(); i++) + { + PxArticulationLink* link; + npArt.getLinks(&link, 1, i); + scAddActor(*static_cast(link)); + } + + s.addArticulationInternal(npArt); + } +} + +bool NpAggregate::addActor(PxActor& actor, const PxBVH* bvh) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, "PxAggregate::addActor() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD; + + if(mNbActors==mMaxNbActors) + return outputError(__LINE__, "PxAggregate: can't add actor to aggregate, max number of actors reached"); + + PxRigidActor* rigidActor = actor.is(); + + PxU32 numShapes = 0; + if(rigidActor) + { + numShapes = rigidActor->getNbShapes(); + if ((mNbShapes + numShapes) > mMaxNbShapes) + return outputError(__LINE__, "PxAggregate: can't add actor to aggregate, max number of shapes reached"); + } + + if(actor.getAggregate()) + return outputError(__LINE__, "PxAggregate: can't add actor to aggregate, actor already belongs to an aggregate"); + + if(actor.getScene()) + return outputError(__LINE__, "PxAggregate: can't add actor to aggregate, actor already belongs to a scene"); + + const PxType ctype = actor.getConcreteType(); + if(ctype == PxConcreteType::eARTICULATION_LINK) + return outputError(__LINE__, "PxAggregate: can't add articulation link to aggregate, only whole articulations can be added"); + + if(PxGetAggregateType(mFilterHint)==PxAggregateType::eSTATIC && ctype != PxConcreteType::eRIGID_STATIC) + return outputError(__LINE__, "PxAggregate: can't add non-static actor to static aggregate"); + + if(PxGetAggregateType(mFilterHint)==PxAggregateType::eKINEMATIC) + { + bool isKine = false; + if(ctype == PxConcreteType::eRIGID_DYNAMIC) + { + PxRigidDynamic& dyna = static_cast(actor); + isKine = dyna.getRigidBodyFlags().isSet(PxRigidBodyFlag::eKINEMATIC); + } + if(!isKine) + return outputError(__LINE__, "PxAggregate: can't add non-kinematic actor to kinematic aggregate"); + } + + setAggregate(this, actor); + + mActors[mNbActors++] = &actor; + + mNbShapes += numShapes; + + OMNI_PVD_ADD(aggregate, actors, static_cast(*this), actor); + + // PT: when an object is added to a aggregate at runtime, i.e. when the aggregate has already been added to the scene, + // we need to immediately add the newcomer to the scene as well. + if(npScene) + { + addActorInternal(actor, *npScene, bvh); + } + else + { + // A.B. if BVH is provided we need to keep it stored till the aggregate is inserted into a scene + if(bvh) + { + PxBVH* bvhMutable = const_cast(bvh); + static_cast(bvhMutable)->incRefCount(); + NpActor::getFromPxActor(actor).addConnector(NpConnectorType::eBvh, bvhMutable, "PxBVH already added to the PxActor!"); + } + } + return true; +} + +bool NpAggregate::removeActorAndReinsert(PxActor& actor, bool reinsert) +{ + for(PxU32 i=0;i(); + if(rigidActor) + mNbShapes -= rigidActor->getNbShapes(); + + mActors[i] = mActors[--mNbActors]; + removeAndReinsert(actor, reinsert); + + return true; + } + } + return outputError(__LINE__, "PxAggregate: can't remove actor, actor doesn't belong to aggregate"); +} + +bool NpAggregate::removeActor(PxActor& actor) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, "PxAggregate::removeActor() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD; + + if(actor.getType() == PxActorType::eARTICULATION_LINK) + return outputError(__LINE__, "PxAggregate: can't remove articulation link, only whole articulations can be removed"); + + // A.B. remove the BVH reference if there is and the aggregate was not added to a scene + if(!npScene) + { + NpActor& np = NpActor::getFromPxActor(actor); + Gu::BVH* bvh = NULL; + if(np.getConnectors(NpConnectorType::eBvh, &bvh, 1)) + { + np.removeConnector(actor, NpConnectorType::eBvh, bvh, "PxBVH connector could not have been removed!"); + bvh->decRefCount(); + } + } + + OMNI_PVD_REMOVE(aggregate, actors, static_cast(*this), actor); + + // PT: there are really 2 cases here: + // a) the user just wants to remove the actor from the aggregate, but the actor is still alive so if the aggregate has been added to a scene, + // we must reinsert the removed actor to that same scene + // b) this is called by the framework when releasing an actor, in which case we don't want to reinsert it anywhere. + // + // We assume that when called by the user, we always want to reinsert. The framework however will call the internal function + // without reinsertion. + return removeActorAndReinsert(actor, true); +} + +bool NpAggregate::addArticulation(PxArticulationReducedCoordinate& art) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, "PxAggregate::addArticulation() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD; + + if((mNbActors+art.getNbLinks()) > mMaxNbActors) + return outputError(__LINE__, "PxAggregate: can't add articulation links, max number of actors reached"); + + if((mNbShapes + art.getNbShapes()) > mMaxNbShapes) + return outputError(__LINE__, "PxAggregate: can't add articulation, max number of shapes reached"); + + if(art.getAggregate()) + return outputError(__LINE__, "PxAggregate: can't add articulation to aggregate, articulation already belongs to an aggregate"); + + if(art.getScene()) + return outputError(__LINE__, "PxAggregate: can't add articulation to aggregate, articulation already belongs to a scene"); + + NpArticulationReducedCoordinate* impl = static_cast(&art); + impl->setAggregate(this); + NpArticulationLink* const* links = impl->getLinks(); + + for(PxU32 i=0; i < impl->getNbLinks(); i++) + { + NpArticulationLink& l = *links[i]; + + setAggregate(this, l); + + mActors[mNbActors++] = &l; + + scAddActor(l); + } + + // PT: when an object is added to a aggregate at runtime, i.e. when the aggregate has already been added to the scene, + // we need to immediately add the newcomer to the scene as well. + if(npScene) + npScene->addArticulationInternal(art); + + return true; +} + +bool NpAggregate::removeArticulationAndReinsert(PxArticulationReducedCoordinate& art, bool reinsert) +{ + bool found = false; + PxU32 idx = 0; + while(idx < mNbActors) + { + if ((mActors[idx]->getType() == PxActorType::eARTICULATION_LINK) && (&static_cast(mActors[idx])->getRoot() == &art)) + { + PxActor* a = mActors[idx]; + mNbShapes -= static_cast(mActors[idx])->getNbShapes(); + mActors[idx] = mActors[--mNbActors]; + removeAndReinsert(*a, reinsert); + found = true; + } + else + idx++; + } + + static_cast(art).setAggregate(NULL); + + if(!found) + outputError(__LINE__, "PxAggregate: can't remove articulation, articulation doesn't belong to aggregate"); + return found; +} + +bool NpAggregate::removeArticulation(PxArticulationReducedCoordinate& art) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, "PxAggregate::removeArticulation() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD; + + // see comments in removeActor() + return removeArticulationAndReinsert(art, true); +} + +PxU32 NpAggregate::getNbActors() const +{ + NP_READ_CHECK(getNpScene()); + return mNbActors; +} + +PxU32 NpAggregate::getMaxNbActors() const +{ + NP_READ_CHECK(getNpScene()); + return mMaxNbActors; +} + +PxU32 NpAggregate::getMaxNbShapes() const +{ + NP_READ_CHECK(getNpScene()); + return mMaxNbShapes; +} + +PxU32 NpAggregate::getActors(PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mActors, getCurrentSizeFast()); +} + +PxScene* NpAggregate::getScene() +{ + return getNpScene(); +} + +bool NpAggregate::getSelfCollision() const +{ + NP_READ_CHECK(getNpScene()); + return getSelfCollideFast(); +} + +// PX_SERIALIZATION + +void NpAggregate::preExportDataReset() +{ + mAggregateID = PX_INVALID_U32; +} + +void NpAggregate::exportExtraData(PxSerializationContext& stream) +{ + if(mActors) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mActors, mNbActors * sizeof(PxActor*)); + } +} + +void NpAggregate::importExtraData(PxDeserializationContext& context) +{ + if(mActors) + mActors = context.readExtraData(mNbActors); +} + +void NpAggregate::resolveReferences(PxDeserializationContext& context) +{ + // Resolve actor pointers if needed + for(PxU32 i=0; i < mNbActors; i++) + { + context.translatePxBase(mActors[i]); + { + //update aggregate if mActors is in external reference + NpActor& np = NpActor::getFromPxActor(*mActors[i]); + if(np.getAggregate() == NULL) + { + np.setAggregate(this, *mActors[i]); + } + if(mActors[i]->getType() == PxActorType::eARTICULATION_LINK) + { + PxArticulationReducedCoordinate& articulation = static_cast(mActors[i])->getRoot(); + if(!articulation.getAggregate()) + static_cast(articulation).setAggregate(this); + } + } + } +} + +NpAggregate* NpAggregate::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpAggregate* obj = PX_PLACEMENT_NEW(address, NpAggregate(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpAggregate); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void NpAggregate::requiresObjects(PxProcessPxBaseCallback& c) +{ + for(PxU32 i=0; i < mNbActors; i++) + { + PxArticulationLink* link = mActors[i]->is(); + if(link) + c.process(link->getArticulation()); + else + c.process(*mActors[i]); + } +} +// ~PX_SERIALIZATION + +void NpAggregate::scAddActor(NpActor& actor) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + actor.getActorCore().setAggregateID(mAggregateID); + PvdAttachActorToAggregate( this, &actor ); + PvdUpdateProperties( this ); +} + +void NpAggregate::scRemoveActor(NpActor& actor, bool reinsert) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + Sc::ActorCore& ac = actor.getActorCore(); + ac.setAggregateID(PX_INVALID_U32); + + if(getNpScene() && reinsert) + ac.reinsertShapes(); + + //Update pvd status + PvdDetachActorFromAggregate( this, &actor ); + PvdUpdateProperties( this ); +} + +void NpAggregate::incShapeCount() +{ + if(mNbShapes == mMaxNbShapes) + outputError(__LINE__, "PxRigidActor::attachShape: Actor is part of an aggregate and max number of shapes reached!"); + + mNbShapes++; +} +void NpAggregate::decShapeCount() +{ + PX_ASSERT(mNbShapes > 0); + mNbShapes--; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.h new file mode 100644 index 0000000..d7dfc0d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpAggregate.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_AGGREGATE_H +#define NP_AGGREGATE_H + +#include "PxAggregate.h" +#include "NpBase.h" + +namespace physx +{ +class NpScene; + +class NpAggregate : public PxAggregate, public NpBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpAggregate(PxBaseFlags baseFlags) : PxAggregate(baseFlags), NpBase(PxEmpty) {} + void preExportDataReset(); + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); + virtual void requiresObjects(PxProcessPxBaseCallback& c); + static NpAggregate* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint); + virtual ~NpAggregate(); + + // PxAggregate + virtual void release() PX_OVERRIDE; + virtual bool addActor(PxActor&, const PxBVH*) PX_OVERRIDE; + virtual bool removeActor(PxActor&) PX_OVERRIDE; + virtual bool addArticulation(PxArticulationReducedCoordinate&) PX_OVERRIDE; + virtual bool removeArticulation(PxArticulationReducedCoordinate&) PX_OVERRIDE; + virtual PxU32 getNbActors() const PX_OVERRIDE; + virtual PxU32 getMaxNbActors() const PX_OVERRIDE; + virtual PxU32 getMaxNbShapes() const PX_OVERRIDE; + virtual PxU32 getActors(PxActor** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE; + virtual PxScene* getScene() PX_OVERRIDE; + virtual bool getSelfCollision() const PX_OVERRIDE; + //~PxAggregate + + PX_FORCE_INLINE PxU32 getMaxNbShapesFast() const { return mMaxNbShapes; } + PX_FORCE_INLINE PxU32 getCurrentSizeFast() const { return mNbActors; } + PX_FORCE_INLINE PxActor* getActorFast(PxU32 i) const { return mActors[i]; } + PX_FORCE_INLINE PxU32 getAggregateID() const { return mAggregateID; } + PX_FORCE_INLINE void setAggregateID(PxU32 cid) { mAggregateID = cid; } + + PX_FORCE_INLINE bool getSelfCollideFast() const { return PxGetAggregateSelfCollisionBit(mFilterHint)!=0; } + PX_FORCE_INLINE PxAggregateFilterHint getFilterHint() const { return mFilterHint; } + + void addActorInternal(PxActor& actor, NpScene& s, const PxBVH* bvh); + void removeAndReinsert(PxActor& actor, bool reinsert); + bool removeActorAndReinsert(PxActor& actor, bool reinsert); + bool removeArticulationAndReinsert(PxArticulationReducedCoordinate& art, bool reinsert); + + void scAddActor(NpActor&); + void scRemoveActor(NpActor& actor, bool reinsert); + + void incShapeCount(); + void decShapeCount(); +private: + PxU32 mAggregateID; + PxU32 mMaxNbActors; + PxU32 mMaxNbShapes; + PxAggregateFilterHint mFilterHint; + PxU32 mNbActors; + PxU32 mNbShapes; + PxActor** mActors; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp new file mode 100644 index 0000000..1347329 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.cpp @@ -0,0 +1,494 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpCheck.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationReducedCoordinate.h" + +using namespace physx; + +namespace physx +{ + //PX_SERIALIZATION + + NpArticulationJointReducedCoordinate* NpArticulationJointReducedCoordinate::createObject(PxU8*& address, PxDeserializationContext& context) + { + NpArticulationJointReducedCoordinate* obj = PX_PLACEMENT_NEW(address, NpArticulationJointReducedCoordinate(PxBaseFlags(0))); + address += sizeof(NpArticulationJointReducedCoordinate); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; + } + + void NpArticulationJointReducedCoordinate::resolveReferences(PxDeserializationContext& context) + { + //mImpl.resolveReferences(context, *this); + context.translatePxBase(mParent); + context.translatePxBase(mChild); + mCore.setRoot(this); + NpArticulationReducedCoordinate* articulation = static_cast(&mParent->getRoot()); + mCore.setArticulation(&articulation->getCore()); + } + + //~PX_SERIALIZATION + + NpArticulationJointReducedCoordinate::NpArticulationJointReducedCoordinate(NpArticulationLink& parent, const PxTransform& parentFrame, + NpArticulationLink& child, const PxTransform& childFrame) + : PxArticulationJointReducedCoordinate(PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_JOINT), + mCore(parentFrame, childFrame), + mParent(&parent), + mChild(&child) + { + NpArticulationReducedCoordinate* articulation = static_cast(&parent.getRoot()); + mCore.setArticulation(&articulation->getCore()); + mCore.setRoot(this); + } + + NpArticulationJointReducedCoordinate::~NpArticulationJointReducedCoordinate() + { + } + + void NpArticulationJointReducedCoordinate::setJointType(PxArticulationJointType::Enum jointType) + { + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationJointReducedCoordinate::setJointType() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + PX_CHECK_AND_RETURN(jointType != PxArticulationJointType::eUNDEFINED, "PxArticulationJointReducedCoordinate::setJointType valid joint type(ePRISMATIC, eREVOLUTE, eREVOLUTE_UNWRAPPED, eSPHERICAL, eFIX) need to be set"); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + OMNI_PVD_SET(articulationjoint, type, joint, jointType) +#endif + + scSetJointType(jointType); + } + + PxArticulationJointType::Enum NpArticulationJointReducedCoordinate::getJointType() const + { + return mCore.getJointType(); + } + +#if PX_CHECKED + bool NpArticulationJointReducedCoordinate::isValidMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) + { + bool valid = true; + switch (mCore.getJointType()) + { + case PxArticulationJointType::ePRISMATIC: + { + if (axis < PxArticulationAxis::eX && motion != PxArticulationMotion::eLOCKED) + valid = false; + else if(motion != PxArticulationMotion::eLOCKED) + { + //Check to ensure that we only have zero DOFs already active... + for (PxU32 i = PxArticulationAxis::eX; i <= PxArticulationAxis::eZ; i++) + { + if(i != PxU32(axis) && mCore.getMotion(PxArticulationAxis::Enum(i)) != PxArticulationMotion::eLOCKED) + valid = false; + } + } + break; + } + case PxArticulationJointType::eREVOLUTE: + case PxArticulationJointType::eREVOLUTE_UNWRAPPED: + { + if (axis >= PxArticulationAxis::eX && motion != PxArticulationMotion::eLOCKED) + valid = false; + else if (motion != PxArticulationMotion::eLOCKED) + { + for (PxU32 i = PxArticulationAxis::eTWIST; i < PxArticulationAxis::eX; i++) + { + if (i != PxU32(axis) && mCore.getMotion(PxArticulationAxis::Enum(i)) != PxArticulationMotion::eLOCKED) + valid = false; + } + } + break; + } + case PxArticulationJointType::eSPHERICAL: + { + if (axis >= PxArticulationAxis::eX && motion != PxArticulationMotion::eLOCKED) + valid = false; + break; + } + case PxArticulationJointType::eFIX: + { + if (motion != PxArticulationMotion::eLOCKED) + valid = false; + break; + } + case PxArticulationJointType::eUNDEFINED: + { + valid = false; + break; + } + default: + break; + } + + return valid; + } +#endif + + void NpArticulationJointReducedCoordinate::setMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) + { + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationJointReducedCoordinate::setMotion() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eUNDEFINED, "PxArticulationJointReducedCoordinate::setMotion valid joint type(ePRISMATIC, eREVOLUTE, eREVOUTE_UNWRAPPED, eSPHERICAL or eFIX) has to be set before setMotion"); + PX_CHECK_AND_RETURN(isValidMotion(axis, motion), "PxArticulationJointReducedCoordinate::setMotion illegal configuration for the joint type that is set."); + + scSetMotion(axis, motion); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxArticulationMotion::Enum motions[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + motions[ax] = mCore.getMotion(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, motion, joint, motions, sizeof(motions)); +#endif + + static_cast(&getChild().getArticulation())->mTopologyChanged = true; + } + + PxArticulationMotion::Enum NpArticulationJointReducedCoordinate::getMotion(PxArticulationAxis::Enum axis) const + { + return mCore.getMotion(axis); + } + + void NpArticulationJointReducedCoordinate::setFrictionCoefficient(const PxReal coefficient) + { + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setFrictionCoefficient() not allowed while simulation is running. Call will be ignored.") + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + OMNI_PVD_SET(articulationjoint, frictionCoefficient, joint, coefficient); +#endif + + scSetFrictionCoefficient(coefficient); + } + + PxReal NpArticulationJointReducedCoordinate::getFrictionCoefficient() const + { + NP_READ_CHECK(getNpScene()); + + return mCore.getFrictionCoefficient(); + } + + void NpArticulationJointReducedCoordinate::setMaxJointVelocity(const PxReal maxJointV) + { + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setMaxJointVelocity() not allowed while simulation is running. Call will be ignored.") + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + OMNI_PVD_SET(articulationjoint, maxJointVelocity, joint, maxJointV); +#endif + + scSetMaxJointVelocity(maxJointV); + } + + PxReal NpArticulationJointReducedCoordinate::getMaxJointVelocity() const + { + NP_READ_CHECK(getNpScene()); + + return mCore.getMaxJointVelocity(); + } + + void NpArticulationJointReducedCoordinate::setLimitParams(PxArticulationAxis::Enum axis, const PxArticulationLimit& pair) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(PxIsFinite(pair.low) && PxIsFinite(pair.high) && pair.low <= pair.high, "PxArticulationJointReducedCoordinate::setLimitParams(): Invalid limit parameters; lowLimit must be <= highLimit."); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eSPHERICAL || (PxAbs(pair.low) <= PxPi && PxAbs(pair.high) <= PxPi), "PxArticulationJointReducedCoordinate::setLimitParams() only supports limit angles in range [-Pi, Pi] for joints of type PxArticulationJointType::eSPHERICAL"); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eREVOLUTE || (PxAbs(pair.low) <= 2.0f*PxPi && PxAbs(pair.high) <= 2.0f*PxPi), "PxArticulationJointReducedCoordinate::setLimitParams() only supports limit angles in range [-2Pi, 2Pi] for joints of type PxArticulationJointType::eREVOLUTE"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setLimitParams() not allowed while simulation is running. Call will be ignored.") + + scSetLimit(axis, pair); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal limits[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + limits[ax] = mCore.getLimit(static_cast(ax)).low; + OMNI_PVD_SETB(articulationjoint, limitLow, joint, limits, sizeof(limits)); + for (PxU32 ax = 0; ax < 6; ++ax) + limits[ax] = mCore.getLimit(static_cast(ax)).high; + OMNI_PVD_SETB(articulationjoint, limitHigh, joint, limits, sizeof(limits)); +#endif + } + + PxArticulationLimit NpArticulationJointReducedCoordinate::getLimitParams(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + return mCore.getLimit(axis); + } + + void NpArticulationJointReducedCoordinate::setDriveParams(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive) + { + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setDriveParams() not allowed while simulation is running. Call will be ignored.") + + scSetDrive(axis, drive); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal stiffnesss[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + stiffnesss[ax] = mCore.getDrive(static_cast(ax)).stiffness; + OMNI_PVD_SETB(articulationjoint, driveStiffness, joint, stiffnesss, sizeof(stiffnesss)); + PxReal dampings[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + dampings[ax] = mCore.getDrive(static_cast(ax)).damping; + OMNI_PVD_SETB(articulationjoint, driveDamping, joint, dampings, sizeof(dampings)); + PxReal maxforces[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + maxforces[ax] = mCore.getDrive(static_cast(ax)).maxForce; + OMNI_PVD_SETB(articulationjoint, driveMaxForce, joint, maxforces, sizeof(maxforces)); + PxArticulationDriveType::Enum drivetypes[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + drivetypes[ax] = mCore.getDrive(static_cast(ax)).driveType; + OMNI_PVD_SETB(articulationjoint, driveType, joint, drivetypes, sizeof(drivetypes)); +#endif + } + + PxArticulationDrive NpArticulationJointReducedCoordinate::getDriveParams(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + + return mCore.getDrive(axis); + } + + void NpArticulationJointReducedCoordinate::setDriveTarget(PxArticulationAxis::Enum axis, const PxReal target, bool autowake) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eSPHERICAL || PxAbs(target) <= PxPi, "PxArticulationJointReducedCoordinate::setDriveTarget() only supports target angle in range [-Pi, Pi] for joints of type PxArticulationJointType::eSPHERICAL"); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eREVOLUTE || PxAbs(target) <= 2.0f*PxPi, "PxArticulationJointReducedCoordinate::setDriveTarget() only supports target angle in range [-2Pi, 2Pi] for joints of type PxArticulationJointType::eREVOLUTE"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setDriveTarget() not allowed while simulation is running. Call will be ignored.") + + if (autowake && getNpScene()) + { + NpArticulationReducedCoordinate* npArticulation = static_cast(&mParent->getArticulation()); + npArticulation->autoWakeInternal(); + } + + scSetDriveTarget(axis, target); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal targets[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + targets[ax] = mCore.getTargetP(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, driveTarget, joint, targets, sizeof(targets)); +#endif + } + + void NpArticulationJointReducedCoordinate::setDriveVelocity(PxArticulationAxis::Enum axis, const PxReal targetVel, bool autowake) + { + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setDriveVelocity() not allowed while simulation is running. Call will be ignored.") + + if (autowake && getNpScene()) + { + NpArticulationReducedCoordinate* npArticulation = static_cast(&mParent->getArticulation()); + npArticulation->autoWakeInternal(); + } + + scSetDriveVelocity(axis, targetVel); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal velocitys[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + velocitys[ax] = mCore.getTargetV(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, driveVelocity, joint, velocitys, sizeof(velocitys)); +#endif + } + + PxReal NpArticulationJointReducedCoordinate::getDriveTarget(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + + return mCore.getTargetP(axis); + } + + PxReal NpArticulationJointReducedCoordinate::getDriveVelocity(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + + return mCore.getTargetV(axis); + } + + void NpArticulationJointReducedCoordinate::setArmature(PxArticulationAxis::Enum axis, const PxReal armature) + { + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setArmature() not allowed while simulation is running. Call will be ignored.") + + scSetArmature(axis, armature); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal armatures[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + armatures[ax] = mCore.getArmature(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, armature, joint, armatures, sizeof(armatures)); +#endif + } + + PxReal NpArticulationJointReducedCoordinate::getArmature(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + return mCore.getArmature(axis); + } + + PxTransform NpArticulationJointReducedCoordinate::getParentPose() const + { + NP_READ_CHECK(getNpScene()); + return mParent->getCMassLocalPose().transform(mCore.getParentPose()); + } + + void NpArticulationJointReducedCoordinate::setParentPose(const PxTransform& t) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(t.isSane(), "PxArticulationJointReducedCoordinate::setParentPose: Input pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setParentPose() not allowed while simulation is running. Call will be ignored.") + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + OMNI_PVD_SET(articulationjoint, parentTranslation, joint, t.p) + OMNI_PVD_SET(articulationjoint, parentRotation, joint, t.q) +#endif + + if (mParent == NULL) + return; + + scSetParentPose(mParent->getCMassLocalPose().transformInv(t.getNormalized())); + } + + PxTransform NpArticulationJointReducedCoordinate::getChildPose() const + { + NP_READ_CHECK(getNpScene()); + + return mChild->getCMassLocalPose().transform(mCore.getChildPose()); + } + + void NpArticulationJointReducedCoordinate::setChildPose(const PxTransform& t) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(t.isSane(), "PxArticulationJointReducedCoordinate::setChildPose: Input pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setChildPose() not allowed while simulation is running. Call will be ignored.") + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + OMNI_PVD_SET(articulationjoint, childTranslation, joint, t.p) + OMNI_PVD_SET(articulationjoint, childRotation, joint, t.q) +#endif + + scSetChildPose(mChild->getCMassLocalPose().transformInv(t.getNormalized())); + } + + void NpArticulationJointReducedCoordinate::setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(PxIsFinite(jointPos), "PxArticulationJointReducedCoordinate::setJointPosition: jointPos is not valid."); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eSPHERICAL || PxAbs(jointPos) <= PxPi, "PxArticulationJointReducedCoordinate::setJointPosition() only supports jointPos in range [-Pi, Pi] for joints of type PxArticulationJointType::eSPHERICAL"); + PX_CHECK_AND_RETURN(getJointType() != PxArticulationJointType::eREVOLUTE || PxAbs(jointPos) <= 2.0f*PxPi, "PxArticulationJointReducedCoordinate::setJointPosition() only supports jointPos in range [-2Pi, 2Pi] for joints of type PxArticulationJointType::eREVOLUTE"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setJointPosition() not allowed while simulation is running. Call will be ignored."); + + scSetJointPosition(axis, jointPos); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal positions[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + positions[ax] = mCore.getJointPosition(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, jointPosition, joint, positions, sizeof(positions)); +#endif + } + + PxReal NpArticulationJointReducedCoordinate::getJointPosition(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationJointReducedCoordinate::getJointPosition() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", 0.f); + + return mCore.getJointPosition(axis); + } + + void NpArticulationJointReducedCoordinate::setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(PxIsFinite(jointVel), "PxArticulationJointReducedCoordinate::setJointVelocity: jointVel is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationJointReducedCoordinate::setJointVelocity() not allowed while simulation is running. Call will be ignored."); + + scSetJointVelocity(axis, jointVel); + +#if PX_SUPPORT_OMNI_PVD + PxArticulationJointReducedCoordinate & joint = *this; + PxReal velocitys[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + velocitys[ax] = mCore.getJointVelocity(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, jointVelocity, joint, velocitys, sizeof(velocitys)); +#endif + } + + PxReal NpArticulationJointReducedCoordinate::getJointVelocity(PxArticulationAxis::Enum axis) const + { + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationJointReducedCoordinate::getJointVelocity() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", 0.f); + + return mCore.getJointVelocity(axis); + } + + void NpArticulationJointReducedCoordinate::release() + { + NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, NULL); + + if(getNpScene()) + getNpScene()->scRemoveArticulationJoint(*this); + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyArticulationJoint(mCore.getRoot()); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.h new file mode 100644 index 0000000..ea7ca7e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationJointReducedCoordinate.h @@ -0,0 +1,231 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ARTICULATION_JOINT_RC_H +#define NP_ARTICULATION_JOINT_RC_H + +#include "PxArticulationJointReducedCoordinate.h" +#include "ScArticulationJointCore.h" +#include "NpArticulationLink.h" +#include "NpBase.h" + +#if PX_ENABLE_DEBUG_VISUALIZATION + #include "common/PxRenderOutput.h" +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +namespace physx +{ + class NpScene; + class NpArticulationLink; + + class NpArticulationJointReducedCoordinate : public PxArticulationJointReducedCoordinate, public NpBase + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpArticulationJointReducedCoordinate(PxBaseFlags baseFlags) + : PxArticulationJointReducedCoordinate(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + + virtual void resolveReferences(PxDeserializationContext& context); + static NpArticulationJointReducedCoordinate* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + virtual bool isSubordinate() const { return true; } + //~PX_SERIALIZATION + NpArticulationJointReducedCoordinate(NpArticulationLink& parent, const PxTransform& parentFrame, NpArticulationLink& child, const PxTransform& childFrame); + virtual ~NpArticulationJointReducedCoordinate(); + + //--------------------------------------------------------------------------------- + // PxArticulationJoint implementation + //--------------------------------------------------------------------------------- + + virtual void setJointType(PxArticulationJointType::Enum jointType); + virtual PxArticulationJointType::Enum getJointType() const; + + virtual void setMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion); + virtual PxArticulationMotion::Enum getMotion(PxArticulationAxis::Enum axis) const; + + virtual void setFrictionCoefficient(const PxReal coefficient); + virtual PxReal getFrictionCoefficient() const; + + virtual void setMaxJointVelocity(const PxReal maxJointV); + virtual PxReal getMaxJointVelocity() const; + + virtual void setLimitParams(PxArticulationAxis::Enum axis, const PxArticulationLimit& pair); + virtual PxArticulationLimit getLimitParams(PxArticulationAxis::Enum axis) const; + + virtual void setDriveParams(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive); + virtual PxArticulationDrive getDriveParams(PxArticulationAxis::Enum axis) const; + + virtual void setDriveTarget(PxArticulationAxis::Enum axis, const PxReal target, bool autowake = true); + virtual PxReal getDriveTarget(PxArticulationAxis::Enum axis) const; + + virtual void setDriveVelocity(PxArticulationAxis::Enum axis, const PxReal targetVel, bool autowake = true); + virtual PxReal getDriveVelocity(PxArticulationAxis::Enum axis) const; + + virtual void setArmature(PxArticulationAxis::Enum axis, const PxReal armature); + virtual PxReal getArmature(PxArticulationAxis::Enum axis) const; + + virtual void setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos); + virtual PxReal getJointPosition(PxArticulationAxis::Enum axis) const; + + virtual void setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel); + virtual PxReal getJointVelocity(PxArticulationAxis::Enum axis) const; + + void release(); + + + PX_FORCE_INLINE Sc::ArticulationJointCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpArticulationJointReducedCoordinate, mCore); } + + PX_INLINE void scSetParentPose(const PxTransform& v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setParentPose(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetChildPose(const PxTransform& v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setChildPose(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetJointType(PxArticulationJointType::Enum v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setJointType(v); + UPDATE_PVD_PROPERTY + } + PX_INLINE void scSetFrictionCoefficient(const PxReal v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setFrictionCoefficient(v); + UPDATE_PVD_PROPERTY + } + PX_INLINE void scSetMaxJointVelocity(const PxReal v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setMaxJointVelocity(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetLimit(PxArticulationAxis::Enum axis, const PxArticulationLimit& pair) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setLimit(axis, pair); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetDrive(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setDrive(axis, drive); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetDriveTarget(PxArticulationAxis::Enum axis, PxReal targetP) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setTargetP(axis, targetP); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetDriveVelocity(PxArticulationAxis::Enum axis, PxReal targetP) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setTargetV(axis, targetP); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetArmature(PxArticulationAxis::Enum axis, PxReal armature) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setArmature(axis, armature); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setMotion(axis, motion); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setJointPosition(axis, jointPos); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setJointVelocity(axis, jointVel); + UPDATE_PVD_PROPERTY + } + + virtual PxArticulationLink& getParentArticulationLink() const { return *mParent; } + virtual PxArticulationLink& getChildArticulationLink() const { return *mChild; } + + virtual PxTransform getParentPose() const; + virtual void setParentPose(const PxTransform& t); + + virtual PxTransform getChildPose() const; + virtual void setChildPose(const PxTransform& t); + + + PX_INLINE const NpArticulationLink& getParent() const { return *mParent; } + PX_INLINE NpArticulationLink& getParent() { return *mParent; } + + PX_INLINE const NpArticulationLink& getChild() const { return *mChild; } + PX_INLINE NpArticulationLink& getChild() { return *mChild; } + + Sc::ArticulationJointCore mCore; + NpArticulationLink* mParent; + NpArticulationLink* mChild; +#if PX_CHECKED + private: + bool isValidMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion); +#endif + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp new file mode 100644 index 0000000..33ee358 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.cpp @@ -0,0 +1,513 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpArticulationLink.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpCheck.h" +#include "CmVisualization.h" +#include "CmConeLimitHelper.h" +#include "CmUtils.h" +#include "NpRigidActorTemplateInternal.h" + +using namespace physx; +using namespace Cm; + +// PX_SERIALIZATION +void NpArticulationLink::requiresObjects(PxProcessPxBaseCallback& c) +{ + NpArticulationLinkT::requiresObjects(c); + + if(mInboundJoint) + c.process(*mInboundJoint); +} + +void NpArticulationLink::exportExtraData(PxSerializationContext& stream) +{ + NpArticulationLinkT::exportExtraData(stream); + exportInlineArray(mChildLinks, stream); +} + +void NpArticulationLink::importExtraData(PxDeserializationContext& context) +{ + NpArticulationLinkT::importExtraData(context); + importInlineArray(mChildLinks, context); +} + +void NpArticulationLink::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mRoot); + context.translatePxBase(mInboundJoint); + context.translatePxBase(mParent); + + NpArticulationLinkT::resolveReferences(context); + + const PxU32 nbLinks = mChildLinks.size(); + for(PxU32 i=0;iimportExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +NpArticulationLink::NpArticulationLink(const PxTransform& bodyPose, PxArticulationReducedCoordinate& root, NpArticulationLink* parent) : + NpArticulationLinkT (PxConcreteType::eARTICULATION_LINK, PxBaseFlag::eOWNS_MEMORY, PxActorType::eARTICULATION_LINK, NpType::eBODY_FROM_ARTICULATION_LINK, bodyPose), + mRoot (&root), + mInboundJoint (NULL), + mParent (parent), + mLLIndex (0xffffffff), + mInboundJointDof (0xffffffff) +{ + if (parent) + parent->addToChildList(*this); +} + +NpArticulationLink::~NpArticulationLink() +{ +} + +void NpArticulationLink::releaseInternal() +{ + NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, userData); + + NpArticulationReducedCoordinate* npArticulation = static_cast(mRoot); + npArticulation->removeLinkFromList(*this); + + if (mParent) + mParent->removeFromChildList(*this); + + if (mInboundJoint) + mInboundJoint->release(); + + //Remove constraints, aggregates, scene, shapes. + removeRigidActorT(*this); + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyArticulationLink(this); +} + +void NpArticulationLink::release() +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationLink::release() not allowed while the articulation link is in a scene. Call will be ignored."); + return; + } + + //! this function doesn't get called when the articulation root is released + // therefore, put deregistration code etc. into dtor, not here + + if (mChildLinks.empty()) + { + releaseInternal(); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationLink::release(): Only leaf articulation links can be released. Call will be ignored."); + } +} + +PxTransform NpArticulationLink::getGlobalPose() const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationLink::getGlobalPose() not allowed while simulation is running (except during PxScene::collide()).", PxTransform(PxIdentity)); + + return mCore.getBody2World() * mCore.getBody2Actor().getInverse(); +} + +bool NpArticulationLink::attachShape(PxShape& shape) +{ + static_cast(mRoot)->incrementShapeCount(); + return NpRigidActorTemplate::attachShape(shape); +} + +void NpArticulationLink::detachShape(PxShape& shape, bool wakeOnLostTouch) +{ + static_cast(mRoot)->decrementShapeCount(); + NpRigidActorTemplate::detachShape(shape, wakeOnLostTouch); +} + +PxArticulationReducedCoordinate& NpArticulationLink::getArticulation() const +{ + NP_READ_CHECK(getNpScene()); + return *mRoot; +} + +PxArticulationJointReducedCoordinate* NpArticulationLink::getInboundJoint() const +{ + NP_READ_CHECK(getNpScene()); + return mInboundJoint; +} + +PxU32 NpArticulationLink::getInboundJointDof() const +{ + NP_READ_CHECK(getNpScene()); + + return getNpScene() ? mInboundJointDof : 0xffffffffu; +} + +PxU32 NpArticulationLink::getNbChildren() const +{ + NP_READ_CHECK(getNpScene()); + return mChildLinks.size(); +} + +PxU32 NpArticulationLink::getChildren(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mChildLinks.begin(), mChildLinks.size()); +} + +PxU32 NpArticulationLink::getLinkIndex() const +{ + NP_READ_CHECK(getNpScene()); + return getNpScene() ? mLLIndex : 0xffffffffu; +} + +void NpArticulationLink::setCMassLocalPose(const PxTransform& pose) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(pose.isSane(), "PxArticulationLink::setCMassLocalPose: invalid parameter"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationLink::setCMassLocalPose() not allowed while simulation is running. Call will be ignored.") + + if (getNpScene() && getNpScene()->getFlags() & PxSceneFlag::eSUPPRESS_READBACK) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationLink::setCMassLocalPose() : it is illegal to call this method if PxSceneFlag::eSUPPRESS_ARTICULATION_READBACK is enabled!"); + } + + const PxTransform p = pose.getNormalized(); + const PxTransform oldpose = mCore.getBody2Actor(); + const PxTransform comShift = p.transformInv(oldpose); + + NpArticulationLinkT::setCMassLocalPoseInternal(p); + + if(mInboundJoint) + { + NpArticulationJointReducedCoordinate* j =static_cast(mInboundJoint); + j->scSetChildPose(comShift.transform(j->getCore().getChildPose())); + } + + for(PxU32 i=0; i(mChildLinks[i]->getInboundJoint()); + j->scSetParentPose(comShift.transform(j->getCore().getParentPose())); + } +} + +void NpArticulationLink::addForce(const PxVec3& force, PxForceMode::Enum mode, bool autowake) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(force.isFinite(), "PxArticulationLink::addForce: force is not valid."); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationLink::addForce: Articulation link must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationLink::addForce() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().Call will be ignored.") + + addSpatialForce(&force, NULL, mode); + + static_cast(mRoot)->wakeUpInternal((!force.isZero()), autowake); +} + +void NpArticulationLink::addTorque(const PxVec3& torque, PxForceMode::Enum mode, bool autowake) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(torque.isFinite(), "PxArticulationLink::addTorque: force is not valid."); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationLink::addTorque: Articulation link must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationLink::addTorque() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().Call will be ignored.") + + addSpatialForce(NULL, &torque, mode); + + static_cast(mRoot)->wakeUpInternal((!torque.isZero()), autowake); +} + +void NpArticulationLink::setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(torque.isFinite(), "PxArticulationLink::setForceAndTorque: torque is not valid."); + PX_CHECK_AND_RETURN(force.isFinite(), "PxArticulationLink::setForceAndTorque: force is not valid."); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationLink::addTorque: Articulation link must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationLink::setForceAndTorque() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().Call will be ignored."); + + setSpatialForce(&force, &torque, mode); + + static_cast(mRoot)->wakeUpInternal((!torque.isZero()), true); +} + +void NpArticulationLink::clearForce(PxForceMode::Enum mode) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationLink::clearForce: Articulation link must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationLink::clearForce() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().Call will be ignored."); + + clearSpatialForce(mode, true, false); +} + +void NpArticulationLink::clearTorque(PxForceMode::Enum mode) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationLink::clearTorque: Articulation link must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationLink::clearTorque() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().Call will be ignored."); + + clearSpatialForce(mode, false, true); +} + +void NpArticulationLink::setCfmScale(const PxReal cfmScale) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(cfmScale >= 0.f && cfmScale <= 1.f, "PxArticulationLink::setCfmScale: cfm is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationLink::setCfmScale() not allowed while simulation is running. Call will be ignored.") + + mCore.getCore().cfmScale = cfmScale; + OMNI_PVD_SET(actor, CFMScale, static_cast(*this), cfmScale); // @@@ +} + +PxReal NpArticulationLink::getCfmScale() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getCore().cfmScale; +} + +void NpArticulationLink::setGlobalPoseInternal(const PxTransform& pose, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(pose.isSane(), "PxArticulationLink::setGlobalPose: pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationLink::setGlobalPose() not allowed while simulation is running. Call will be ignored.") + +#if PX_CHECKED + if (npScene) + npScene->checkPositionSanity(*this, pose, "PxArticulationLink::setGlobalPose"); +#endif + + const PxTransform newPose = pose.getNormalized(); //AM: added to fix 1461 where users read and write orientations for no reason. + + const PxTransform body2World = newPose * mCore.getBody2Actor(); + scSetBody2World(body2World); + + if (npScene && autowake) + static_cast(mRoot)->wakeUpInternal(false, true); + + if (npScene) + static_cast(mRoot)->setGlobalPose(); +} + +void NpArticulationLink::setKinematicLink(const bool value) +{ + NP_WRITE_CHECK(getNpScene()); + + mCore.setKinematicLink(value); +} + +PxU32 physx::NpArticulationGetShapes(NpArticulationLink& actor, NpShape* const*& shapes, bool* isCompound) +{ + NpShapeManager& sm = actor.getShapeManager(); + shapes = sm.getShapes(); + if (isCompound) + *isCompound = sm.isSqCompound(); + return sm.getNbShapes(); +} + +#if PX_ENABLE_DEBUG_VISUALIZATION +void NpArticulationLink::visualize(PxRenderOutput& out, NpScene& scene, float scale) const +{ + PX_ASSERT(scale!=0.0f); // Else we shouldn't have been called + if(!(mCore.getActorFlags() & PxActorFlag::eVISUALIZATION)) + return; + + NpArticulationLinkT::visualize(out, scene, scale); + + const Sc::Scene& scScene = scene.getScScene(); + + // PT: TODO: can we share this with the PxRigidDynamic version? + const PxReal massAxes = scale * scScene.getVisualizationParameter(PxVisualizationParameter::eBODY_MASS_AXES); + if(massAxes != 0) + { + PxU32 color = 0xff; + color = (color<<16 | color<<8 | color); + PxVec3 dims = invertDiagInertia(mCore.getInverseInertia()); + dims = getDimsFromBodyInertia(dims, 1.0f / mCore.getInverseMass()); + out << color << mCore.getBody2World(); + const PxVec3 extents = dims * 0.5f; + renderOutputDebugBox(out, PxBounds3(-extents, extents)); + } + + const PxReal frameScale = scale * scScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LOCAL_FRAMES); + const PxReal limitScale = scale * scScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LIMITS); + if(frameScale != 0.0f || limitScale != 0.0f) + { + ConstraintImmediateVisualizer viz(frameScale, limitScale, out); + visualizeJoint(viz); + } +} + +static PX_FORCE_INLINE PxReal computePhi(const PxQuat& q) +{ + PxQuat twist = q; + twist.normalize(); + + PxReal angle = twist.getAngle(); + if (twist.x<0.0f) + angle = -angle; + return angle; +} + +// PT: TODO: don't duplicate this, it should be available in MathUtils or something +static PX_FORCE_INLINE float computeSwingAngle(float swingYZ, float swingW) +{ + return 4.0f * PxAtan2(swingYZ, 1.0f + swingW); // tan (t/2) = sin(t)/(1+cos t), so this is the quarter angle +} + +static PX_FORCE_INLINE void separateSwingTwist(const PxQuat& q, PxQuat& twist, PxQuat& swing1, PxQuat& swing2) +{ + twist = q.x != 0.0f ? PxQuat(q.x, 0, 0, q.w).getNormalized() : PxQuat(PxIdentity); + PxQuat swing = q * twist.getConjugate(); + swing1 = swing.y != 0.f ? PxQuat(0.f, swing.y, 0.f, swing.w).getNormalized() : PxQuat(PxIdentity); + swing = swing * swing1.getConjugate(); + swing2 = swing.z != 0.f ? PxQuat(0.f, 0.f, swing.z, swing.w).getNormalized() : PxQuat(PxIdentity); +} + +void NpArticulationLink::visualizeJoint(PxConstraintVisualizer& jointViz) const +{ + const NpArticulationLink* parent = getParent(); + if(parent) + { + PxTransform cA2w = getGlobalPose().transform(mInboundJoint->getChildPose()); + PxTransform cB2w = parent->getGlobalPose().transform(mInboundJoint->getParentPose()); + + jointViz.visualizeJointFrames(cA2w, cB2w); + + NpArticulationJointReducedCoordinate* impl = static_cast(mInboundJoint); + + PX_ASSERT(getArticulation().getConcreteType() == PxConcreteType::eARTICULATION_REDUCED_COORDINATE); + //(1) visualize any angular dofs/limits... + + const PxMat33 cA2w_m(cA2w.q), cB2w_m(cB2w.q); + + PxTransform parentFrame = cB2w; + + if (cA2w.q.dot(cB2w.q) < 0) + cB2w.q = -cB2w.q; + + //const PxTransform cB2cA = cA2w.transformInv(cB2w); + + const PxTransform cA2cB = cB2w.transformInv(cA2w); + + Sc::ArticulationJointCore& joint = impl->getCore(); + + PxQuat swing1, swing2, twist; + separateSwingTwist(cA2cB.q, twist, swing1, swing2); + + const PxReal pad = 0.01f; + + if(joint.getMotion(PxArticulationAxis::eTWIST)) + { + PxArticulationLimit pair; + + const PxReal angle = computePhi(twist); + pair = joint.getLimit(PxArticulationAxis::Enum(PxArticulationAxis::eTWIST)); + + bool active = (angle-pad) < pair.low || (angle+pad) > pair.high; + + PxTransform tmp = parentFrame; + + jointViz.visualizeAngularLimit(tmp, pair.low, pair.high, active); + } + + if (joint.getMotion(PxArticulationAxis::eSWING1)) + { + PxArticulationLimit pair; + + pair = joint.getLimit(PxArticulationAxis::Enum(PxArticulationAxis::eSWING1)); + + const PxReal angle = computeSwingAngle(swing1.y, swing1.w); + + bool active = (angle - pad) < pair.low || (angle + pad) > pair.high; + + PxTransform tmp = parentFrame; + tmp.q = tmp.q * PxQuat(-PxPiDivTwo, PxVec3(0.f, 0.f, 1.f)); + + + jointViz.visualizeAngularLimit(tmp, -pair.high, -pair.low, active); + } + + if (joint.getMotion(PxArticulationAxis::eSWING2)) + { + PxArticulationLimit pair; + + pair= joint.getLimit(PxArticulationAxis::Enum(PxArticulationAxis::eSWING2)); + + const PxReal angle = computeSwingAngle(swing2.z, swing2.w); + + bool active = (angle - pad) < pair.low || (angle + pad) > pair.high; + + PxTransform tmp = parentFrame; + tmp.q = tmp.q * PxQuat(PxPiDivTwo, PxVec3(0.f, 1.f, 0.f)); + + jointViz.visualizeAngularLimit(tmp, -pair.high, -pair.low, active); + } + + for (PxU32 i = PxArticulationAxis::eX; i <= PxArticulationAxis::eZ; ++i) + { + if (joint.getMotion(PxArticulationAxis::Enum(i)) == PxArticulationMotion::eLIMITED) + { + + PxArticulationLimit pair; + + PxU32 index = i - PxArticulationAxis::eX; + + pair = joint.getLimit(PxArticulationAxis::Enum(i)); + PxReal ordinate = cA2cB.p[index]; + PxVec3 origin = cB2w.p; + PxVec3 axis = cA2w_m[index]; + const bool active = ordinate < pair.low || ordinate > pair.high; + const PxVec3 p0 = origin + axis * pair.low; + const PxVec3 p1 = origin + axis * pair.high; + jointViz.visualizeLine(p0, p1, active ? 0xff0000u : 0xffffffu); + } + } + + } +} + +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.h new file mode 100644 index 0000000..1a6bcaf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationLink.h @@ -0,0 +1,164 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ARTICULATION_LINK_H +#define NP_ARTICULATION_LINK_H + +#include "NpRigidBodyTemplate.h" +#include "PxArticulationLink.h" + +#if PX_ENABLE_DEBUG_VISUALIZATION + #include "common/PxRenderOutput.h" +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +namespace physx +{ + +class NpArticulationLink; +class NpArticulationJointReducedCoordinate; +class PxConstraintVisualizer; + +typedef NpRigidBodyTemplate NpArticulationLinkT; + +class NpArticulationLinkArray : public PxInlineArray //!!!AL TODO: check if default of 4 elements makes sense +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpArticulationLinkArray(const PxEMPTY) : PxInlineArray (PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpArticulationLinkArray() : PxInlineArray("articulationLinkArray") {} +}; + +class NpArticulationLink : public NpArticulationLinkT +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpArticulationLink(PxBaseFlags baseFlags) : NpArticulationLinkT(baseFlags), mChildLinks(PxEmpty) {} + void preExportDataReset() { NpArticulationLinkT::preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); + virtual void requiresObjects(PxProcessPxBaseCallback& c); + virtual bool isSubordinate() const { return true; } + static NpArticulationLink* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + virtual ~NpArticulationLink(); + + //--------------------------------------------------------------------------------- + // PxArticulationLink implementation + //--------------------------------------------------------------------------------- + virtual void release(); + + + virtual PxActorType::Enum getType() const { return PxActorType::eARTICULATION_LINK; } + + // Pose + virtual void setGlobalPose(const PxTransform& /*pose*/, bool /*wake*/) { /*return false; */} + virtual PxTransform getGlobalPose() const; + + + virtual bool attachShape(PxShape& shape); + virtual void detachShape(PxShape& shape, bool wakeOnLostTouch = true); + + virtual PxArticulationReducedCoordinate& getArticulation() const; + virtual PxArticulationJointReducedCoordinate* getInboundJoint() const; + virtual PxU32 getInboundJointDof() const; + + virtual PxU32 getNbChildren() const; + virtual PxU32 getChildren(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + virtual PxU32 getLinkIndex() const; + virtual void setCMassLocalPose(const PxTransform& pose); + + virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true); + virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true); + virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE); + virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE); + virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE); + + virtual void setCfmScale(const PxReal cfmScale); + virtual PxReal getCfmScale() const; + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + NpArticulationLink(const PxTransform& bodyPose, PxArticulationReducedCoordinate& root, NpArticulationLink* parent); + + void releaseInternal(); + + PX_INLINE PxArticulationReducedCoordinate& getRoot() { return *mRoot; } + PX_INLINE NpArticulationLink* getParent() { return mParent; } + PX_INLINE const NpArticulationLink* getParent() const { return mParent; } + + PX_INLINE void setInboundJoint(PxArticulationJointReducedCoordinate& joint) { mInboundJoint = &joint; } + + void setGlobalPoseInternal(const PxTransform& pose, bool autowake); + void setLLIndex(const PxU32 index) { mLLIndex = index; } + void setInboundJointDof(const PxU32 index) { mInboundJointDof = index; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpArticulationLink, mCore); } +private: + PX_INLINE void addToChildList(NpArticulationLink& link) { mChildLinks.pushBack(&link); } + PX_INLINE void removeFromChildList(NpArticulationLink& link) { PX_ASSERT(mChildLinks.find(&link) != mChildLinks.end()); mChildLinks.findAndReplaceWithLast(&link); } + +public: + PX_INLINE NpArticulationLink* const* getChildren() { return mChildLinks.empty() ? NULL : &mChildLinks.front(); } + void setKinematicLink(const bool value); + +#if PX_ENABLE_DEBUG_VISUALIZATION + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; + void visualizeJoint(PxConstraintVisualizer& jointViz) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +private: + PxArticulationReducedCoordinate* mRoot; //!!!AL TODO: Revisit: Could probably be avoided if registration and deregistration in root is handled differently + PxArticulationJointReducedCoordinate* mInboundJoint; + NpArticulationLink* mParent; //!!!AL TODO: Revisit: Some memory waste but makes things faster + NpArticulationLinkArray mChildLinks; + PxU32 mLLIndex; + PxU32 mInboundJointDof; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp new file mode 100644 index 0000000..53b5ceb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.cpp @@ -0,0 +1,1218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationTendon.h" +#include "NpArticulationSensor.h" + +#include "DyFeatherstoneArticulation.h" +#include "ScArticulationSim.h" +#include "ScConstraintSim.h" + +#include "foundation/PxAlignedMalloc.h" +#include "foundation/PxPool.h" + +#include "PxPvdDataStream.h" +#include "NpAggregate.h" + +using namespace physx; + +void PxArticulationCache::release() +{ + PxcScratchAllocator* scratchAlloc = reinterpret_cast(scratchAllocator); + PX_DELETE(scratchAlloc); + scratchAllocator = NULL; + + PX_FREE(scratchMemory); + + PX_FREE_THIS; +} + +// PX_SERIALIZATION +NpArticulationReducedCoordinate* NpArticulationReducedCoordinate::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationReducedCoordinate* obj = PX_PLACEMENT_NEW(address, NpArticulationReducedCoordinate(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpArticulationReducedCoordinate); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void NpArticulationReducedCoordinate::preExportDataReset() +{ + //for now, no support for loop joint serialization + PxArray emptyLoopJoints; + PxMemCopy(&mLoopJoints, &emptyLoopJoints, sizeof(PxArray)); +} + +//~PX_SERIALIZATION + +NpArticulationReducedCoordinate::NpArticulationReducedCoordinate() + : PxArticulationReducedCoordinate(PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + NpBase(NpType::eARTICULATION), mNumShapes(0), mAggregate(NULL), mName(NULL), mCacheVersion(0), mTopologyChanged(false) +{ +} + +void NpArticulationReducedCoordinate::setArticulationFlags(PxArticulationFlags flags) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setArticulationFlags() not allowed while simulation is running. Call will be ignored."); + + scSetArticulationFlags(flags); + + OMNI_PVD_SET(articulation, articulationFlags, static_cast(*this), flags); +} + +void NpArticulationReducedCoordinate::setArticulationFlag(PxArticulationFlag::Enum flag, bool value) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setArticulationFlag() not allowed while simulation is running. Call will be ignored."); + + PxArticulationFlags flags = mCore.getArticulationFlags(); + + if(value) + flags |= flag; + else + flags &= (~flag); + + scSetArticulationFlags(flags); + + OMNI_PVD_SET(articulation, articulationFlags, static_cast(*this), flags); +} + +PxArticulationFlags NpArticulationReducedCoordinate::getArticulationFlags() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getArticulationFlags(); +} + +PxU32 NpArticulationReducedCoordinate::getDofs() const +{ + NP_READ_CHECK(getNpScene()); + // core will check if in scene and return 0xFFFFFFFF if not. + return mCore.getDofs(); +} + +PxArticulationCache* NpArticulationReducedCoordinate::createCache() const +{ + NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads + PX_CHECK_AND_RETURN_NULL(getNpScene(), "PxArticulationReducedCoordinate::createCache: Articulation must be in a scene."); + + PxArticulationCache* cache = mCore.createCache(); + if (cache) + cache->version = mCacheVersion; + + return cache; +} + +PxU32 NpArticulationReducedCoordinate::getCacheDataSize() const +{ + NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads + // core will check if in scene and return 0xFFFFFFFF if not. + return mCore.getCacheDataSize(); +} + +void NpArticulationReducedCoordinate::zeroCache(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); // doesn't modify the scene, only reads + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::zeroCache: Articulation must be in a scene."); + // need to check cache version as correct cache size is required for zeroing + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::zeroCache: cache is invalid, articulation configuration has changed! "); + + return mCore.zeroCache(cache); +} + +void NpArticulationReducedCoordinate::applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags, bool autowake) +{ + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::applyCache: Articulation must be in a scene."); + + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::applyCache: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_AND_RETURN(!(getScene()->getFlags() & PxSceneFlag::eSUPPRESS_READBACK), "PxArticulationReducedCoordinate::applyCache : it is illegal to call this method if PxSceneFlag::eSUPPRESS_ARTICULATION_READBACK is enabled!"); + + //if we try to do a bulk op when sim is running, return with error + if (getNpScene()->getSimulationStage() != Sc::SimulationStage::eCOMPLETE) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxArticulationReducedCoordinate::applyCache() not allowed while simulation is running. Call will be ignored."); + return; + } + + if (!(getScene()->getFlags() & PxSceneFlag::eSUPPRESS_READBACK)) + { + const bool forceWake = mCore.applyCache(cache, flags); + + if (flags & (PxArticulationCacheFlag::ePOSITION | PxArticulationCacheFlag::eROOT_TRANSFORM)) + { + const PxU32 linkCount = mArticulationLinks.size(); + + //KS - the below code forces contact managers to be updated/cached data to be dropped and + //shape transforms to be updated. + for (PxU32 i = 0; i < linkCount; ++i) + { + NpArticulationLink* link = mArticulationLinks[i]; + //in the lowlevel articulation, we have already updated bodyCore's body2World + const PxTransform internalPose = link->getCore().getBody2World(); + link->scSetBody2World(internalPose); + } + } + + wakeUpInternal(forceWake, autowake); + } +} + +void NpArticulationReducedCoordinate::copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags) const +{ + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::copyInternalStateToCache: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::copyInternalStateToCache: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::copyInternalStateToCache() not allowed while simulation is running. Call will be ignored."); + + mCore.copyInternalStateToCache(cache, flags); +} + +void NpArticulationReducedCoordinate::packJointData(const PxReal* maximum, PxReal* reduced) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::packJointData: Articulation must be in a scene."); + + mCore.packJointData(maximum, reduced); +} + +void NpArticulationReducedCoordinate::unpackJointData(const PxReal* reduced, PxReal* maximum) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::unpackJointData: Articulation must be in a scene."); + + mCore.unpackJointData(reduced, maximum); +} + +void NpArticulationReducedCoordinate::commonInit() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::commonInit: Articulation must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::commonInit() not allowed while simulation is running. Call will be ignored."); + + mCore.commonInit(); +} + +void NpArticulationReducedCoordinate::computeGeneralizedGravityForce(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedGravityForce: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version ==mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedGravityForce: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedGravityForce() not allowed while simulation is running. Call will be ignored."); + + mCore.computeGeneralizedGravityForce(cache); +} + +void NpArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeCoriolisAndCentrifugalForce() not allowed while simulation is running. Call will be ignored."); + + mCore.computeCoriolisAndCentrifugalForce(cache); +} + +void NpArticulationReducedCoordinate::computeGeneralizedExternalForce(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedExternalForce: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedExternalForce: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedExternalForce() not allowed while simulation is running. Call will be ignored."); + + mCore.computeGeneralizedExternalForce(cache); +} + +void NpArticulationReducedCoordinate::computeJointAcceleration(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeJointAcceleration: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeJointAcceleration: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeJointAcceleration() not allowed while simulation is running. Call will be ignored."); + + mCore.computeJointAcceleration(cache); +} + +void NpArticulationReducedCoordinate::computeJointForce(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeJointForce: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeJointForce: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeJointForce() not allowed while simulation is running. Call will be ignored."); + + mCore.computeJointForce(cache); +} + +void NpArticulationReducedCoordinate::computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeDenseJacobian: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeDenseJacobian: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeDenseJacobian() not allowed while simulation is running. Call will be ignored."); + + mCore.computeDenseJacobian(cache, nRows, nCols); +} + +void NpArticulationReducedCoordinate::computeCoefficientMatrix(PxArticulationCache& cache) const +{ + NpScene* npScene = getNpScene(); + NP_READ_CHECK(npScene); + PX_CHECK_AND_RETURN(npScene, "PxArticulationReducedCoordinate::computeCoefficientMatrix: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeCoefficientMatrix: cache is invalid, articulation configuration has changed! "); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationReducedCoordinate::computeCoefficientMatrix() not allowed while simulation is running. Call will be ignored."); + + npScene->updateConstants(mLoopJoints); + + mCore.computeCoefficientMatrix(cache); +} + +bool NpArticulationReducedCoordinate::computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, const PxReal* const jointTorque, const PxU32 maxIter) const +{ + if (!getNpScene()) + return PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxArticulationReducedCoordinate::computeLambda: Articulation must be in a scene."); + NP_READ_CHECK(getNpScene()); + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::computeLambda() not allowed while simulation is running. Call will be ignored.", false); + + if (cache.version != mCacheVersion) + return PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxArticulationReducedCoordinate::computeLambda: cache is invalid, articulation configuration has changed!"); + + return mCore.computeLambda(cache, initialState, jointTorque, getScene()->getGravity(), maxIter); +} + +void NpArticulationReducedCoordinate::computeGeneralizedMassMatrix(PxArticulationCache& cache) const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix: Articulation must be in a scene."); + PX_CHECK_AND_RETURN(cache.version == mCacheVersion, "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix: cache is invalid, articulation configuration has changed!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::computeGeneralizedMassMatrix() not allowed while simulation is running. Call will be ignored."); + + mCore.computeGeneralizedMassMatrix(cache); +} + +void NpArticulationReducedCoordinate::addLoopJoint(PxConstraint* joint) +{ + NP_WRITE_CHECK(getNpScene()); + +#if PX_CHECKED + PxRigidActor* actor0; + PxRigidActor* actor1; + + joint->getActors(actor0, actor1); + + PxArticulationLink* link0 = NULL; + PxArticulationLink* link1 = NULL; + + if(actor0 && actor0->getConcreteType()==PxConcreteType::eARTICULATION_LINK) + link0 = static_cast(actor0); + + if(actor1 && actor1->getConcreteType()==PxConcreteType::eARTICULATION_LINK) + link1 = static_cast(actor1); + + PX_CHECK_AND_RETURN((link0 || link1), "PxArticulationReducedCoordinate::addLoopJoint : at least one of the PxRigidActors need to be PxArticulationLink!"); + + PxArticulationReducedCoordinate* base0 = NULL; + PxArticulationReducedCoordinate* base1 = NULL; + if (link0) + base0 = &link0->getArticulation(); + + if (link1) + base1 = &link1->getArticulation(); + + PX_CHECK_AND_RETURN((base0 == this || base1 == this), "PxArticulationReducedCoordinate::addLoopJoint : at least one of the PxArticulationLink belongs to this articulation!"); +#endif + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::addLoopJoint() not allowed while simulation is running. Call will be ignored.") + + const PxU32 size = mLoopJoints.size(); + if (size >= mLoopJoints.capacity()) + mLoopJoints.reserve(size * 2 + 1); + + NpConstraint* constraint = static_cast(joint); + mLoopJoints.pushBack(constraint); + + Sc::ArticulationSim* scArtSim = mCore.getSim(); + + Sc::ConstraintSim* cSim = constraint->getCore().getSim(); + if(scArtSim) + scArtSim->addLoopConstraint(cSim); +} + +void NpArticulationReducedCoordinate::removeLoopJoint(PxConstraint* joint) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::removeLoopJoint() not allowed while simulation is running. Call will be ignored.") + + NpConstraint* constraint = static_cast(joint); + mLoopJoints.findAndReplaceWithLast(constraint); + + Sc::ArticulationSim* scArtSim = mCore.getSim(); + + Sc::ConstraintSim* cSim = constraint->getCore().getSim(); + scArtSim->removeLoopConstraint(cSim); +} + +PxU32 NpArticulationReducedCoordinate::getNbLoopJoints() const +{ + NP_READ_CHECK(getNpScene()); + + return mLoopJoints.size(); +} + +PxU32 NpArticulationReducedCoordinate::getLoopJoints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mLoopJoints.begin(), mLoopJoints.size()); +} + +PxU32 NpArticulationReducedCoordinate::getCoefficientMatrixSize() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_NULL(getNpScene(), "PxArticulationReducedCoordinate::getCoefficientMatrixSize: Articulation must be in a scene."); + + // core will check if in scene and return 0xFFFFFFFF if not. + return mCore.getCoefficientMatrixSize(); +} + +void NpArticulationReducedCoordinate::setRootGlobalPose(const PxTransform& pose, bool autowake) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootGlobalPose() called on empty articulation."); + PX_CHECK_AND_RETURN(pose.isValid(), "PxArticulationReducedCoordinate::setRootGlobalPose pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setRootGlobalPose() not allowed while simulation is running. Call will be ignored."); + + NpArticulationLink* root = mArticulationLinks[0]; + root->setGlobalPoseInternal(pose, autowake); +} + +PxTransform NpArticulationReducedCoordinate::getRootGlobalPose() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootGlobalPose() called on empty articulation.", PxTransform(PxIdentity)); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootGlobalPose() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxTransform(PxIdentity)); + + NpArticulationLink* root = mArticulationLinks[0]; + return root->getGlobalPose(); +} + +void NpArticulationReducedCoordinate::setRootLinearVelocity(const PxVec3& linearVelocity, bool autowake) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootLinearVelocity() called on empty articulation."); + PX_CHECK_AND_RETURN(linearVelocity.isFinite(), "PxArticulationReducedCoordinate::setRootLinearVelocity velocity is not finite."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setRootLinearVelocity() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored."); + + NpArticulationLink* root = mArticulationLinks[0]; + root->scSetLinearVelocity(linearVelocity); + if(getNpScene()) + { + const bool forceWakeup = !(linearVelocity.isZero()); + wakeUpInternal(forceWakeup, autowake); + } +} + +void NpArticulationReducedCoordinate::setRootAngularVelocity(const PxVec3& angularVelocity, bool autowake) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::setRootAngularVelocity() called on empty articulation."); + PX_CHECK_AND_RETURN(angularVelocity.isFinite(), "PxArticulationReducedCoordinate::setRootAngularVelocity velocity is not finite."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setRootAngularVelocity() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored."); + + NpArticulationLink* root = mArticulationLinks[0]; + root->scSetAngularVelocity(angularVelocity); + if (getNpScene()) + { + const bool forceWakeup = !(angularVelocity.isZero()); + wakeUpInternal(forceWakeup, autowake); + } +} + +PxVec3 NpArticulationReducedCoordinate::getRootLinearVelocity() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootLinearVelocity() called on empty articulation.", PxVec3(0.0f)); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootLinearVelocity() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxVec3(0.f)); + + NpArticulationLink* root = mArticulationLinks[0]; + return root->getLinearVelocity(); +} + +PxVec3 NpArticulationReducedCoordinate::getRootAngularVelocity() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(!mArticulationLinks.empty(), "PxArticulationReducedCoordinate::getRootAngularVelocity() called on empty articulation.", PxVec3(0.0f)); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getRootAngularVelocity() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxVec3(0.f)); + + NpArticulationLink* root = mArticulationLinks[0]; + return root->getAngularVelocity(); +} + +PxSpatialVelocity NpArticulationReducedCoordinate::getLinkAcceleration(const PxU32 linkId) +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getLinkAcceleration: Articulation must be in a scene.", PxSpatialVelocity()); + PX_CHECK_AND_RETURN_VAL(linkId < 64, "PxArticulationReducedCoordinate::getLinkAcceleration index is not valid.", PxSpatialVelocity()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getLinkAcceleration() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxSpatialVelocity()); + + return mCore.getLinkAcceleration(linkId); +} + +PxU32 NpArticulationReducedCoordinate::getGpuArticulationIndex() +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getGpuArticulationIndex: Articulation must be in a scene.", 0xffffffff); + + if (getScene()->getFlags() & PxSceneFlag::eSUPPRESS_READBACK) + return mCore.getGpuArticulationIndex(); + return 0xffffffff; +} + +PxArticulationSpatialTendon* NpArticulationReducedCoordinate::createSpatialTendon() +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxArticulationReducedCoordinate::createSpatialTendon() not allowed while the articulation is in a scene. Call will be ignored."); + return NULL; + } + + void* tendonMem = PX_ALLOC(sizeof(NpArticulationSpatialTendon), "NpArticulationSpatialTendon"); + PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationSpatialTendon)); + NpArticulationSpatialTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationSpatialTendon)(this); + + tendon->setHandle(mSpatialTendons.size()); + mSpatialTendons.pushBack(tendon); + return tendon; +} + +void NpArticulationReducedCoordinate::removeSpatialTendonInternal(NpArticulationSpatialTendon* npTendon) +{ + //we don't need to remove low-level tendon from the articulation sim because the only case the tendon can be removed is + //when the whole articulation is removed from the scene and the ArticulationSim get destroyed + getNpScene()->scRemoveArticulationSpatialTendon(*npTendon); +} + +PxArticulationFixedTendon* NpArticulationReducedCoordinate::createFixedTendon() +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationReducedCoordinate::createFixedTendon() not allowed while the articulation is in a scene. Call will be ignored."); + return NULL; + } + + void* tendonMem = PX_ALLOC(sizeof(NpArticulationFixedTendon), "NpArticulationFixedTendon"); + PxMarkSerializedMemory(tendonMem, sizeof(NpArticulationFixedTendon)); + NpArticulationFixedTendon* tendon = PX_PLACEMENT_NEW(tendonMem, NpArticulationFixedTendon)(this); + + tendon->setHandle(mFixedTendons.size()); + mFixedTendons.pushBack(tendon); + return tendon; +} + +void NpArticulationReducedCoordinate::removeFixedTendonInternal(NpArticulationFixedTendon* npTendon) +{ + //we don't need to remove low-level tendon from the articulation sim because the only case the tendon can be removed is + //when the whole articulation is removed from the scene and the ArticulationSim get destroyed + getNpScene()->scRemoveArticulationFixedTendon(*npTendon); +} + +void NpArticulationReducedCoordinate::removeSensorInternal(NpArticulationSensor* npSensor) +{ + //we don't need to remove low-level sensor from the articulation sim because the only case the tendon can be removed is + //when the whole articulation is removed from the scene and the ArticulationSim get destroyed + getNpScene()->scRemoveArticulationSensor(*npSensor); +} + +PxArticulationSensor* NpArticulationReducedCoordinate::createSensor(PxArticulationLink* link, const PxTransform& relativePose) +{ + if (getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationReducedCoordinate::createSensor() not allowed while the articulation is in a scene. Call will be ignored."); + return NULL; + } + + void* sensorMem = PX_ALLOC(sizeof(NpArticulationSensor), "NpArticulationSensor"); + PxMarkSerializedMemory(sensorMem, sizeof(NpArticulationSensor)); + NpArticulationSensor* sensor = PX_PLACEMENT_NEW(sensorMem, NpArticulationSensor)(link, relativePose); + + sensor->setHandle(mSensors.size()); + mSensors.pushBack(sensor); + + mTopologyChanged = true; + return sensor; +} + +void NpArticulationReducedCoordinate::releaseSensor(PxArticulationSensor& sensor) +{ + if (getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationReducedCoordinate::releaseSensor() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + + NpArticulationSensor* npSensor = static_cast(&sensor); + + const PxU32 handle = npSensor->getHandle(); + + PX_CHECK_AND_RETURN(handle < mSensors.size() && mSensors[handle] == npSensor, + "PxArticulationReducedCoordinate::releaseSensor: Attempt to release sensor that is not part of this articulation."); + + mSensors.back()->setHandle(handle); + mSensors.replaceWithLast(handle); + npSensor->~NpArticulationSensor(); + + if (npSensor->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(npSensor); + + mTopologyChanged = true; +} + +PxU32 NpArticulationReducedCoordinate::getSensors(PxArticulationSensor** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSensors.begin(), mSensors.size()); +} + +PxU32 NpArticulationReducedCoordinate::getNbSensors() +{ + return mSensors.size(); +} + +NpArticulationSensor* NpArticulationReducedCoordinate::getSensor(const PxU32 index) const +{ + return mSensors[index]; +} + +PxU32 NpArticulationReducedCoordinate::getSpatialTendons(PxArticulationSpatialTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSpatialTendons.begin(), mSpatialTendons.size()); +} + +PxU32 NpArticulationReducedCoordinate::getNbSpatialTendons() +{ + return mSpatialTendons.size(); +} + +NpArticulationSpatialTendon* NpArticulationReducedCoordinate::getSpatialTendon(const PxU32 index) const +{ + return mSpatialTendons[index]; +} + +PxU32 NpArticulationReducedCoordinate::getFixedTendons(PxArticulationFixedTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mFixedTendons.begin(), mFixedTendons.size()); +} + +PxU32 NpArticulationReducedCoordinate::getNbFixedTendons() +{ + return mFixedTendons.size(); +} + +NpArticulationFixedTendon* NpArticulationReducedCoordinate::getFixedTendon(const PxU32 index) const +{ + return mFixedTendons[index]; +} + +void NpArticulationReducedCoordinate::updateKinematic(PxArticulationKinematicFlags flags) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::updateKinematic: Articulation must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::updateKinematic() not allowed while simulation is running. Call will be ignored."); + + if(getNpScene()) + { + mCore.updateKinematic(flags); + + const PxU32 linkCount = mArticulationLinks.size(); + + //KS - the below code forces contact managers to be updated/cached data to be dropped and + //shape transforms to be updated. + for(PxU32 i = 0; i < linkCount; ++i) + { + NpArticulationLink* link = mArticulationLinks[i]; + //in the lowlevel articulation, we have already updated bodyCore's body2World + const PxTransform internalPose = link->getCore().getBody2World(); + link->scSetBody2World(internalPose); + } + } +} + +NpArticulationReducedCoordinate::~NpArticulationReducedCoordinate() +{ + //release tendons + for (PxU32 i = 0; i < mSpatialTendons.size(); ++i) + { + if (mSpatialTendons[i]) + { + mSpatialTendons[i]->~NpArticulationSpatialTendon(); + if(mSpatialTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mSpatialTendons[i]); + } + } + + for (PxU32 i = 0; i < mFixedTendons.size(); ++i) + { + if (mFixedTendons[i]) + { + mFixedTendons[i]->~NpArticulationFixedTendon(); + if(mFixedTendons[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mFixedTendons[i]); + } + } + + for (PxU32 i = 0; i < mSensors.size(); ++i) + { + if (mSensors[i]) + { + mSensors[i]->~NpArticulationSensor(); + if(mSensors[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mSensors[i]); + } + } + + NpFactory::getInstance().onArticulationRelease(this); +} + +PxArticulationJointReducedCoordinate* NpArticulationReducedCoordinate::createArticulationJoint(PxArticulationLink& parent, + const PxTransform& parentFrame, + PxArticulationLink& child, + const PxTransform& childFrame) +{ + return NpFactory::getInstance().createNpArticulationJointRC(static_cast(parent), parentFrame, static_cast(child), childFrame); +} + +void NpArticulationReducedCoordinate::recomputeLinkIDs() +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::recomputeLinkIDs: Articulation must be in a scene."); + + if (!isAPIWriteForbidden()) + { + Sc::ArticulationSim* scArtSim = getCore().getSim(); + + if (scArtSim) + { + + physx::NpArticulationLink*const* links = getLinks(); + + const PxU32 nbLinks = getNbLinks(); + for (PxU32 i = 1; i < nbLinks; ++i) + { + physx::NpArticulationLink* link = links[i]; + PxU32 cHandle = scArtSim->findBodyIndex(*link->getCore().getSim()); + link->setLLIndex(cHandle); + } + } + } +} + +// PX_SERIALIZATION +void NpArticulationReducedCoordinate::requiresObjects(PxProcessPxBaseCallback& c) +{ + // Collect articulation links + const PxU32 nbLinks = mArticulationLinks.size(); + for (PxU32 i = 0; i < nbLinks; i++) + c.process(*mArticulationLinks[i]); + + const PxU32 nbSensors = mSensors.size(); + for (PxU32 i = 0; i < nbSensors; i++) + c.process(*mSensors[i]); + + const PxU32 nbSpatialTendons = mSpatialTendons.size(); + for (PxU32 i = 0; i < nbSpatialTendons; i++) + c.process(*mSpatialTendons[i]); + + const PxU32 nbFixedTendons = mFixedTendons.size(); + for (PxU32 i = 0; i < nbFixedTendons; i++) + c.process(*mFixedTendons[i]); + +} + +void NpArticulationReducedCoordinate::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mArticulationLinks, stream); + Cm::exportArray(mSpatialTendons, stream); + Cm::exportArray(mFixedTendons, stream); + Cm::exportArray(mSensors, stream); + + stream.writeName(mName); +} + +void NpArticulationReducedCoordinate::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mArticulationLinks, context); + Cm::importArray(mSpatialTendons, context); + Cm::importArray(mFixedTendons, context); + Cm::importArray(mSensors, context); + + context.readName(mName); +} + +void NpArticulationReducedCoordinate::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbLinks = mArticulationLinks.size(); + for (PxU32 i = 0; i < nbLinks; i++) + { + NpArticulationLink*& link = mArticulationLinks[i]; + context.translatePxBase(link); + } + + const PxU32 nbSensors = mSensors.size(); + for (PxU32 i = 0; i < nbSensors; i++) + { + NpArticulationSensor*& sensor = mSensors[i]; + context.translatePxBase(sensor); + } + + const PxU32 nbSpatialTendons = mSpatialTendons.size(); + for (PxU32 i = 0; i < nbSpatialTendons; i++) + { + NpArticulationSpatialTendon*& spatialTendon = mSpatialTendons[i]; + context.translatePxBase(spatialTendon); + } + + const PxU32 nbFixedTendons = mFixedTendons.size(); + for (PxU32 i = 0; i < nbFixedTendons; i++) + { + NpArticulationFixedTendon*& fixedTendon = mFixedTendons[i]; + context.translatePxBase(fixedTendon); + } + + mAggregate = NULL; +} +// ~PX_SERIALIZATION + + +void NpArticulationReducedCoordinate::release() +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationReducedCoordinate::release() not allowed while simulation is running. Call will be ignored."); + + NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationReducedCoordinate::userData); + + //!!!AL TODO: Order should not matter in this case. Optimize by having a path which does not restrict release to leaf links or + // by using a more advanced data structure + PxU32 idx = 0; + while (mArticulationLinks.size()) + { + idx = idx % mArticulationLinks.size(); + + if (mArticulationLinks[idx]->getNbChildren() == 0) + { + mArticulationLinks[idx]->releaseInternal(); // deletes joint, link and removes link from list + } + else + { + idx++; + } + } + + if (npScene) + { + npScene->removeArticulationTendons(*this); + npScene->removeArticulationSensors(*this); + npScene->scRemoveArticulation(*this); + npScene->removeFromArticulationList(*this); + } + + mArticulationLinks.clear(); + + NpDestroyArticulation(this); +} + + +PxArticulationLink* NpArticulationReducedCoordinate::createLink(PxArticulationLink* parent, const PxTransform& pose) +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationReducedCoordinate::createLink() not allowed while the articulation is in a scene. Call will be ignored."); + return NULL; + } + PX_CHECK_AND_RETURN_NULL(pose.isSane(), "PxArticulationReducedCoordinate::createLink: pose is not valid."); + + if (parent && mArticulationLinks.empty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxArticulationReducedCoordinate::createLink: Root articulation link must have NULL parent pointer!"); + return NULL; + } + + // Check if parent is in same articulation is done internally for checked builds + if (!parent && !mArticulationLinks.empty()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationReducedCoordinate::createLink: Non-root articulation link must have valid parent pointer!"); + return NULL; + } + + NpArticulationLink* parentLink = static_cast(parent); + + NpArticulationLink* link = static_cast(NpFactory::getInstance().createArticulationLink(*this, parentLink, pose.getNormalized())); + + if (link) + { + addToLinkList(*link); + mTopologyChanged = true; + } + + return link; +} + +void NpArticulationReducedCoordinate::setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(positionIters > 0, "PxArticulationReducedCoordinate::setSolverIterationCount: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(positionIters <= 255, "PxArticulationReducedCoordinate::setSolverIterationCount: positionIters must be no greater than 255!"); + PX_CHECK_AND_RETURN(velocityIters <= 255, "PxArticulationReducedCoordinate::setSolverIterationCount: velocityIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored."); + + scSetSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff)); + + OMNI_PVD_SET(articulation, positionIterations, static_cast(*this), positionIters); + OMNI_PVD_SET(articulation, velocityIterations, static_cast(*this), velocityIters); +} + +void NpArticulationReducedCoordinate::getSolverIterationCounts(PxU32& positionIters, PxU32& velocityIters) const +{ + NP_READ_CHECK(getNpScene()); + + const PxU16 x = mCore.getSolverIterationCounts(); + velocityIters = PxU32(x >> 8); + positionIters = PxU32(x & 0xff); +} + +void NpArticulationReducedCoordinate::setGlobalPose() +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::setGlobalPose: Articulation must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setGlobalPose() not allowed while simulation is running. Call will be ignored."); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setGlobalPose(); + + //This code is force PVD to update other links position + { + physx::NpArticulationLink*const* links = getLinks(); + + const PxU32 nbLinks = getNbLinks(); + for (PxU32 i = 1; i < nbLinks; ++i) + { + physx::NpArticulationLink* link = links[i]; + //in the lowlevel articulation, we have already updated bodyCore's body2World + const PxTransform internalPose = link->getCore().getBody2World(); + link->scSetBody2World(internalPose); + } + } +} + +bool NpArticulationReducedCoordinate::isSleeping() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::isSleeping: Articulation must be in a scene.", true); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::isSleeping() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().", true); + + return mCore.isSleeping(); +} + +void NpArticulationReducedCoordinate::setSleepThreshold(PxReal threshold) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setSleepThreshold() not allowed while simulation is running. Call will be ignored."); + + scSetSleepThreshold(threshold); + + OMNI_PVD_SET(articulation, sleepThreshold, static_cast(*this), threshold); +} + +PxReal NpArticulationReducedCoordinate::getSleepThreshold() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getSleepThreshold(); +} + +void NpArticulationReducedCoordinate::setStabilizationThreshold(PxReal threshold) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setStabilizationThreshold() not allowed while simulation is running. Call will be ignored."); + + scSetFreezeThreshold(threshold); + + OMNI_PVD_SET(articulation, stabilizationThreshold, static_cast(*this), threshold); +} + +PxReal NpArticulationReducedCoordinate::getStabilizationThreshold() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getFreezeThreshold(); +} + +void NpArticulationReducedCoordinate::setWakeCounter(PxReal wakeCounterValue) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::setWakeCounter() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored."); + + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + mArticulationLinks[i]->scSetWakeCounter(wakeCounterValue); + } + + scSetWakeCounter(wakeCounterValue); + + OMNI_PVD_SET(articulation, wakeCounter, static_cast(*this), wakeCounterValue); +} + +PxReal NpArticulationReducedCoordinate::getWakeCounter() const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getWakeCounter() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance().", 0.0f); + + return mCore.getWakeCounter(); +} + +// follows D6 wakeup logic and is used for joint and tendon autowake +void NpArticulationReducedCoordinate::autoWakeInternal(void) +{ + PxReal wakeCounter = mCore.getWakeCounter(); + if (wakeCounter < getNpScene()->getWakeCounterResetValueInternal()) + { + wakeCounter = getNpScene()->getWakeCounterResetValueInternal(); + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + mArticulationLinks[i]->scWakeUpInternal(wakeCounter); + } + + scWakeUpInternal(wakeCounter); + } +} + +// Follows RB wakeup logic. If autowake is true, increase wakeup counter to at least the scene reset valu +// If forceWakeUp is true, wakeup and leave wakeup counter unchanged, so that articulation goes to sleep +// again if wakecounter was zero at forceWakeup. The value of forceWakeup has no effect if autowake is true. +void NpArticulationReducedCoordinate::wakeUpInternal(bool forceWakeUp, bool autowake) +{ + PX_ASSERT(getNpScene()); + PxReal wakeCounterResetValue = getNpScene()->getWakeCounterResetValueInternal(); + + PxReal wakeCounter = mCore.getWakeCounter(); + bool needsWakingUp = isSleeping() && (autowake || forceWakeUp); + if (autowake && (wakeCounter < wakeCounterResetValue)) + { + wakeCounter = wakeCounterResetValue; + needsWakingUp = true; + } + + if (needsWakingUp) + { + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + mArticulationLinks[i]->scWakeUpInternal(wakeCounter); + } + + scWakeUpInternal(wakeCounter); + } +} + +void NpArticulationReducedCoordinate::wakeUp() +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::wakeUp: Articulation must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(getNpScene(), "PxArticulationReducedCoordinate::wakeUp() not allowed while simulation is running, except in a split simulation in-between PxScene::fetchCollision() and PxScene::advance(). Call will be ignored."); + + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + mArticulationLinks[i]->scWakeUpInternal(getNpScene()->getWakeCounterResetValueInternal()); + } + + PX_ASSERT(getNpScene()); // only allowed for an object in a scene + scWakeUpInternal(getNpScene()->getWakeCounterResetValueInternal()); +} + +void NpArticulationReducedCoordinate::putToSleep() +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene(), "PxArticulationReducedCoordinate::putToSleep: Articulation must be in a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::putToSleep() not allowed while simulation is running. Call will be ignored."); + + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + mArticulationLinks[i]->scPutToSleepInternal(); + } + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.putToSleep(); +} + +void NpArticulationReducedCoordinate::setMaxCOMLinearVelocity(const PxReal maxLinearVelocity) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setMaxCOMLinearVelocity() not allowed while simulation is running. Call will be ignored."); + + scSetMaxLinearVelocity(maxLinearVelocity); + + OMNI_PVD_SET(articulation, maxLinVelocity, static_cast(*this), maxLinearVelocity); +} + +PxReal NpArticulationReducedCoordinate::getMaxCOMLinearVelocity() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getMaxLinearVelocity(); +} + +void NpArticulationReducedCoordinate::setMaxCOMAngularVelocity(const PxReal maxAngularVelocity) +{ + NP_WRITE_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxArticulationReducedCoordinate::setMaxCOMAngularVelocity() not allowed while simulation is running. Call will be ignored."); + + scSetMaxAngularVelocity(maxAngularVelocity); + + OMNI_PVD_SET(articulation, maxAngVelocity, static_cast(*this), maxAngularVelocity); +} + +PxReal NpArticulationReducedCoordinate::getMaxCOMAngularVelocity() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getMaxAngularVelocity(); +} + +PxU32 NpArticulationReducedCoordinate::getNbLinks() const +{ + NP_READ_CHECK(getNpScene()); + return mArticulationLinks.size(); +} + +PxU32 NpArticulationReducedCoordinate::getLinks(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mArticulationLinks.begin(), mArticulationLinks.size()); +} + +PxU32 NpArticulationReducedCoordinate::getNbShapes() const +{ + NP_READ_CHECK(getNpScene()); + return mNumShapes; +} + +PxBounds3 NpArticulationReducedCoordinate::getWorldBounds(float inflation) const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationReducedCoordinate::getWorldBounds() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxBounds3::empty()); + + PxBounds3 bounds = PxBounds3::empty(); + + for (PxU32 i = 0; i < mArticulationLinks.size(); i++) + { + bounds.include(mArticulationLinks[i]->getWorldBounds()); + } + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); +} + +PxAggregate* NpArticulationReducedCoordinate::getAggregate() const +{ + NP_READ_CHECK(getNpScene()); + return mAggregate; +} + +void NpArticulationReducedCoordinate::setName(const char* debugName) +{ + NP_WRITE_CHECK(getNpScene()); + mName = debugName; +} + +const char* NpArticulationReducedCoordinate::getName() const +{ + NP_READ_CHECK(getNpScene()); + return mName; +} + +#if PX_ENABLE_DEBUG_VISUALIZATION +void NpArticulationReducedCoordinate::visualize(PxRenderOutput& out, NpScene& scene, float scale) const +{ + const PxU32 nbLinks = mArticulationLinks.size(); + for (PxU32 i = 0; i < nbLinks; i++) + mArticulationLinks[i]->visualize(out, scene, scale); +} +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +NpArticulationLink* NpArticulationReducedCoordinate::getRoot() +{ + if (!mArticulationLinks.size()) + return NULL; + + PX_ASSERT(mArticulationLinks[0]->getInboundJoint() == NULL); + return mArticulationLinks[0]; +} + +void NpArticulationReducedCoordinate::setAggregate(PxAggregate* a) +{ + mAggregate = static_cast(a); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.h new file mode 100644 index 0000000..756e84b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationReducedCoordinate.h @@ -0,0 +1,362 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ARTICULATION_RC_H +#define NP_ARTICULATION_RC_H + +#include "PxArticulationReducedCoordinate.h" + +#if PX_ENABLE_DEBUG_VISUALIZATION + #include "common/PxRenderOutput.h" +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +#include "NpArticulationLink.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationTendon.h" +#include "ScArticulationCore.h" + +namespace physx +{ + class NpArticulationLink; + class NpScene; + class PxAggregate; + class PxConstraint; + class NpArticulationSpatialTendon; + class NpArticulationFixedTendon; + class NpArticulationSensor; + + class NpArticulationReducedCoordinate : public PxArticulationReducedCoordinate, public NpBase + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + virtual ~NpArticulationReducedCoordinate(); + + // PX_SERIALIZATION + NpArticulationReducedCoordinate(PxBaseFlags baseFlags) + : PxArticulationReducedCoordinate(baseFlags), + NpBase(PxEmpty), mCore(PxEmpty), + mArticulationLinks(PxEmpty), mLoopJoints(PxEmpty), mSpatialTendons(PxEmpty), mFixedTendons(PxEmpty), mSensors(PxEmpty) + { + } + + void preExportDataReset(); + virtual void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); + virtual void requiresObjects(PxProcessPxBaseCallback& c); + + static NpArticulationReducedCoordinate* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + virtual void release(); + //--------------------------------------------------------------------------------- + // PxArticulationReducedCoordinate implementation + //--------------------------------------------------------------------------------- + virtual PxScene* getScene() const { return NpBase::getNpScene(); } + + virtual void setSleepThreshold(PxReal threshold); + virtual PxReal getSleepThreshold() const; + + virtual void setStabilizationThreshold(PxReal threshold); + virtual PxReal getStabilizationThreshold() const; + + virtual void setWakeCounter(PxReal wakeCounterValue); + virtual PxReal getWakeCounter() const; + + virtual void setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters);// { mImpl.setSolverIterationCounts(positionIters, velocityIters); } + virtual void getSolverIterationCounts(PxU32 & positionIters, PxU32 & velocityIters) const;// { mImpl.getSolverIterationCounts(positionIters, velocityIters); } + + virtual bool isSleeping() const; + virtual void wakeUp(); + virtual void putToSleep(); + + virtual void setMaxCOMLinearVelocity(const PxReal maxLinearVelocity); + virtual PxReal getMaxCOMLinearVelocity() const; + virtual void setMaxCOMAngularVelocity(const PxReal maxAngularVelocity); + virtual PxReal getMaxCOMAngularVelocity() const; + + virtual PxU32 getNbLinks() const; + virtual PxU32 getLinks(PxArticulationLink** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + /*{ + return mImpl.getLinks(userBuffer, bufferSize, startIndex); + } +*/ + virtual PxU32 getNbShapes() const; + + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const; + + virtual PxAggregate* getAggregate() const; + + // Debug name + virtual void setName(const char* name); + virtual const char* getName() const; + + virtual PxArticulationLink* createLink(PxArticulationLink* parent, const PxTransform& pose); + + + virtual void setArticulationFlags(PxArticulationFlags flags); + + virtual void setArticulationFlag(PxArticulationFlag::Enum flag, bool value); + + virtual PxArticulationFlags getArticulationFlags() const; + + virtual PxU32 getDofs() const; + + virtual PxArticulationCache* createCache() const; + + virtual PxU32 getCacheDataSize() const; + + virtual void zeroCache(PxArticulationCache& cache) const; + + virtual void applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags, bool autowake); + + virtual void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flags) const; + + virtual void packJointData(const PxReal* maximum, PxReal* reduced) const; + + virtual void unpackJointData(const PxReal* reduced, PxReal* maximum) const; + + virtual void commonInit() const; + + virtual void computeGeneralizedGravityForce(PxArticulationCache& cache) const; + + virtual void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const; + + virtual void computeGeneralizedExternalForce(PxArticulationCache& cache) const; + + virtual void computeJointAcceleration(PxArticulationCache& cache) const; + + virtual void computeJointForce(PxArticulationCache& cache) const; + + + virtual void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const; + + virtual void computeCoefficientMatrix(PxArticulationCache& cache) const; + + virtual bool computeLambda(PxArticulationCache& cache, PxArticulationCache& rollBackCache, const PxReal* const jointTorque, const PxU32 maxIter) const; + + virtual void computeGeneralizedMassMatrix(PxArticulationCache& cache) const; + + virtual void addLoopJoint(PxConstraint* joint); + + virtual void removeLoopJoint(PxConstraint* constraint); + + virtual PxU32 getNbLoopJoints() const; + + virtual PxU32 getLoopJoints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; + + virtual PxU32 getCoefficientMatrixSize() const; + + virtual void setRootGlobalPose(const PxTransform& pose, bool autowake = true); + + virtual PxTransform getRootGlobalPose() const; + + virtual void setRootLinearVelocity(const PxVec3& velocity, bool autowake = true); + virtual void setRootAngularVelocity(const PxVec3& velocity, bool autowake = true); + virtual PxVec3 getRootLinearVelocity() const; + virtual PxVec3 getRootAngularVelocity() const; + + virtual PxSpatialVelocity getLinkAcceleration(const PxU32 linkId); + + virtual PxU32 getGpuArticulationIndex(); + + virtual const char* getConcreteTypeName() const { return "PxArticulationReducedCoordinate"; } + + virtual PxArticulationSpatialTendon* createSpatialTendon(); + + virtual PxU32 getSpatialTendons(PxArticulationSpatialTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + virtual PxU32 getNbSpatialTendons(); + + NpArticulationSpatialTendon* getSpatialTendon(const PxU32 index) const; + + virtual PxArticulationFixedTendon* createFixedTendon(); + + virtual PxU32 getFixedTendons(PxArticulationFixedTendon** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + virtual PxU32 getNbFixedTendons(); + + NpArticulationFixedTendon* getFixedTendon(const PxU32 index) const; + + virtual PxArticulationSensor* createSensor(PxArticulationLink* link, const PxTransform& relativePose); + + virtual void releaseSensor(PxArticulationSensor& sensor); + + virtual PxU32 getSensors(PxArticulationSensor** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + virtual PxU32 getNbSensors(); + + NpArticulationSensor* getSensor(const PxU32 index) const; + + virtual void updateKinematic(PxArticulationKinematicFlags flags); + + PX_FORCE_INLINE PxArray& getSpatialTendons() { return mSpatialTendons; } + PX_FORCE_INLINE PxArray& getFixedTendons() { return mFixedTendons; } + PX_FORCE_INLINE PxArray& getSensors() { return mSensors; } + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + NpArticulationReducedCoordinate(); + + virtual bool isKindOf(const char* name) const { return !::strcmp("PxArticulationReducedCoordinate", name) || PxBase::isKindOf(name); } + + PxArticulationJointReducedCoordinate* createArticulationJoint(PxArticulationLink& parent, + const PxTransform& parentFrame, + PxArticulationLink& child, + const PxTransform& childFrame); + + PX_INLINE void incrementShapeCount() { mNumShapes++; } + PX_INLINE void decrementShapeCount() { mNumShapes--; } + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + + PX_INLINE void addToLinkList(NpArticulationLink& link) { mArticulationLinks.pushBack(&link); mNumShapes += link.getNbShapes(); } + PX_INLINE bool removeLinkFromList(NpArticulationLink& link) + { + PX_ASSERT(mArticulationLinks.find(&link) != mArticulationLinks.end()); + mTopologyChanged = true; + return mArticulationLinks.findAndReplaceWithLast(&link); + } + PX_FORCE_INLINE NpArticulationLink* const* getLinks() { return mArticulationLinks.begin(); } + + NpArticulationLink* getRoot(); + void setAggregate(PxAggregate* a); + + void wakeUpInternal(bool forceWakeUp, bool autowake); + void autoWakeInternal(); + + void setGlobalPose(); + + PX_FORCE_INLINE Sc::ArticulationCore& getCore() { return mCore; } + PX_FORCE_INLINE const Sc::ArticulationCore& getCore() const { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpArticulationReducedCoordinate, mCore); } + + + PX_INLINE void scSetSolverIterationCounts(PxU16 v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setSolverIterationCounts(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetSleepThreshold(const PxReal v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setSleepThreshold(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetFreezeThreshold(const PxReal v) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setFreezeThreshold(v); + UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetWakeCounter(PxReal counter) + { + PX_ASSERT(!isAPIWriteForbiddenExceptSplitSim()); + mCore.setWakeCounter(counter); + UPDATE_PVD_PROPERTY + } + + PX_FORCE_INLINE void scSetArticulationFlags(PxArticulationFlags flags) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setArticulationFlags(flags); + UPDATE_PVD_PROPERTY + } + + PX_FORCE_INLINE void scWakeUpInternal(PxReal wakeCounter) + { + PX_ASSERT(getNpScene()); + PX_ASSERT(!isAPIWriteForbiddenExceptSplitSim()); + mCore.wakeUp(wakeCounter); + } + + PX_FORCE_INLINE void scSetMaxLinearVelocity(PxReal maxLinearVelocity) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setMaxLinearVelocity(maxLinearVelocity); + UPDATE_PVD_PROPERTY + } + + PX_FORCE_INLINE void scSetMaxAngularVelocity(PxReal maxAngularVelocity) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setMaxAngularVelocity(maxAngularVelocity); + UPDATE_PVD_PROPERTY + } + + void recomputeLinkIDs(); + + +#if PX_ENABLE_DEBUG_VISUALIZATION +public: + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + Sc::ArticulationCore mCore; + NpArticulationLinkArray mArticulationLinks; + PxU32 mNumShapes; + NpAggregate* mAggregate; + const char* mName; + PxU32 mCacheVersion; + bool mTopologyChanged; + + private: + + void removeSpatialTendonInternal(NpArticulationSpatialTendon* tendon); + void removeFixedTendonInternal(NpArticulationFixedTendon* tendon); + void removeSensorInternal(NpArticulationSensor* sensor); + + PxArray mLoopJoints; + PxArray mSpatialTendons; + PxArray mFixedTendons; + PxArray mSensors; + + friend class NpScene; + }; + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp new file mode 100644 index 0000000..4043200 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.cpp @@ -0,0 +1,157 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpArticulationSensor.h" +#include "PxArticulationLink.h" +#include "NpArticulationLink.h" +#include "ScArticulationSensorSim.h" +#include "NpArticulationReducedCoordinate.h" + +using namespace physx; + +namespace physx +{ + +// PX_SERIALIZATION + +void NpArticulationSensor::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); +} + +NpArticulationSensor* NpArticulationSensor::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationSensor* obj = PX_PLACEMENT_NEW(address, NpArticulationSensor(PxBaseFlags(0))); + address += sizeof(NpArticulationSensor); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +NpArticulationSensor::NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose) : + PxArticulationSensor(PxConcreteType::eARTICULATION_SENSOR, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_SENSOR) +{ + mLink = link; + mCore.mRelativePose = relativePose; + mCore.mSim = NULL; + mCore.mFlags = 0; +} + +void NpArticulationSensor::release() +{ + if (getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationSensor::release() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + + NpArticulationReducedCoordinate* articulation = static_cast(&mLink->getArticulation()); + + PxArray& sensors = articulation->getSensors(); + + PX_CHECK_AND_RETURN(mHandle < sensors.size() && sensors[mHandle] == this, + "PxArticulationSensor::release() attempt to release sensor that is not part of this articulation."); + + sensors.back()->setHandle(mHandle); + sensors.replaceWithLast(mHandle); + this->~NpArticulationSensor(); + + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +PxSpatialForce NpArticulationSensor::getForces() const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxArticulationSensor::getForces() not allowed while simulation is running, except in a split simulation during PxScene::collide() and up to PxScene::advance().", PxSpatialForce()); + + if (mCore.getSim()) + return mCore.getSim()->getForces(); + PxSpatialForce zero; + zero.force = PxVec3(0.f); + zero.torque = PxVec3(0.f); + return zero; +} + +PxTransform NpArticulationSensor::getRelativePose() const +{ + return mCore.mRelativePose; +} + +void NpArticulationSensor::setRelativePose(const PxTransform& pose) +{ + mCore.mRelativePose = pose; + + if (mCore.getSim()) + { + mCore.getSim()->setRelativePose(pose); + } +} + +PxArticulationLink* NpArticulationSensor::getLink() const +{ + return mLink; +} + +PxU32 NpArticulationSensor::getIndex() const +{ + NP_READ_CHECK(getNpScene()); + if(mCore.getSim()) + return mCore.getSim()->getLowLevelIndex(); + return 0xFFFFFFFFu; +} + +PxArticulationReducedCoordinate* NpArticulationSensor::getArticulation() const +{ + return &mLink->getArticulation(); +} + +PxArticulationSensorFlags NpArticulationSensor::getFlags() const +{ + return PxArticulationSensorFlags(PxU8(mCore.mFlags)); +} + +void NpArticulationSensor::setFlag(PxArticulationSensorFlag::Enum flag, bool enabled) +{ + + if(enabled) + mCore.mFlags |= flag; + else + mCore.mFlags &= (~flag); + + if (mCore.getSim()) + { + mCore.getSim()->setFlag(mCore.mFlags); + } +} + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.h new file mode 100644 index 0000000..101bc41 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationSensor.h @@ -0,0 +1,85 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxArticulationReducedCoordinate.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxMemory.h" +#include "ScArticulationSensor.h" +#include "NpBase.h" + +#ifndef NP_ARTICULATION_SENSOR_H +#define NP_ARTICULATION_SENSOR_H + +namespace physx +{ + +typedef PxU32 ArticulationSensorHandle; + +class NpArticulationSensor : public PxArticulationSensor, public NpBase +{ +public: + +// PX_SERIALIZATION + NpArticulationSensor(PxBaseFlags baseFlags) + : PxArticulationSensor(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() {} + virtual void exportExtraData(PxSerializationContext& ) {} + void importExtraData(PxDeserializationContext& ) {} + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + virtual bool isSubordinate() const { return true; } + static NpArticulationSensor* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + NpArticulationSensor(PxArticulationLink* link, const PxTransform& relativePose); + virtual ~NpArticulationSensor() {} + + virtual void release(); + virtual PxSpatialForce getForces() const; + virtual PxTransform getRelativePose() const; + virtual void setRelativePose(const PxTransform&); + virtual PxArticulationLink* getLink() const; + virtual PxU32 getIndex() const; + virtual PxArticulationReducedCoordinate* getArticulation() const; + virtual PxArticulationSensorFlags getFlags() const; + virtual void setFlag(PxArticulationSensorFlag::Enum flag, bool enabled); + + PX_FORCE_INLINE Sc::ArticulationSensorCore& getSensorCore() { return mCore; } + PX_FORCE_INLINE const Sc::ArticulationSensorCore& getSensorCore() const { return mCore; } + PX_FORCE_INLINE ArticulationSensorHandle getHandle() { return mHandle; } + PX_FORCE_INLINE void setHandle(ArticulationSensorHandle handle) { mHandle = handle; } + +private: + PxArticulationLink* mLink; + Sc::ArticulationSensorCore mCore; + ArticulationSensorHandle mHandle; +}; +} + +#endif //NP_ARTICULATION_SENSOR_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp new file mode 100644 index 0000000..260b6e7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.cpp @@ -0,0 +1,815 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpArticulationTendon.h" +#include "NpArticulationLink.h" +#include "NpArticulationReducedCoordinate.h" +#include "ScArticulationTendonSim.h" +#include "CmUtils.h" + +using namespace physx; + +// PX_SERIALIZATION +void NpArticulationAttachment::requiresObjects(PxProcessPxBaseCallback& c) +{ + // Collect articulation links + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + c.process(*mChildren[i]); +} + +void NpArticulationAttachment::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mChildren, stream); +} + +void NpArticulationAttachment::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mChildren, context); +} + +void NpArticulationAttachment::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); + context.translatePxBase(mParent); + + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + { + NpArticulationAttachment*& attachment = mChildren[i]; + context.translatePxBase(attachment); + } + + context.translatePxBase(mTendon); + mCore.mParent = mParent ? &static_cast(mParent)->mCore : NULL; +} + +NpArticulationAttachment* NpArticulationAttachment::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationAttachment* obj = PX_PLACEMENT_NEW(address, NpArticulationAttachment(PxBaseFlags(0))); + address += sizeof(NpArticulationAttachment); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +// ~PX_SERIALIZATION + +NpArticulationAttachment::NpArticulationAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link): + PxArticulationAttachment(PxConcreteType::eARTICULATION_ATTACHMENT, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_ATTACHMENT), + mLink(link), mParent(parent) +{ + NpArticulationAttachment* npParent = static_cast(parent); + + mCore.mRelativeOffset = link->getCMassLocalPose().transform(relativeOffset); + mCore.mParent = npParent ? &npParent->getCore() : NULL; + mCore.mLowLimit = PX_MAX_F32; + mCore.mHighLimit = -PX_MAX_F32; + mCore.mRestLength = 0.f; + mCore.mCoefficient = coefficient; + mCore.mTendonSim = NULL; + mCore.mAttachmentIndex = 0xffffffff; +} + +NpArticulationAttachment::~NpArticulationAttachment() +{ +} + +void NpArticulationAttachment::setRestLength(const PxReal restLength) +{ + PX_CHECK_AND_RETURN(PxIsFinite(restLength), "PxArticulationAttachment::setRestLength(): restLength must have valid value."); + PX_CHECK_AND_RETURN(isLeaf(), "PxArticulationAttachment::setRestLength(): Setting rest length on a non-leaf attachment has no effect."); + mCore.mRestLength = restLength; + + if (mCore.mTendonSim) + mCore.mTendonSim->setAttachmentRestLength(mCore, restLength); +} + +PxReal NpArticulationAttachment::getRestLength() const +{ + return mCore.mRestLength; +} + +void NpArticulationAttachment::setLimitParameters(const PxArticulationTendonLimit& parameter) +{ + PX_CHECK_AND_RETURN(PxIsFinite(parameter.lowLimit) && PxIsFinite(parameter.highLimit) && (parameter.lowLimit <= parameter.highLimit), + "NpArticulationAttachment::setLimitParameters(): lowLimit and highLimit must have valid values and lowLimit must be less than highLimit!"); + PX_CHECK_AND_RETURN(isLeaf(), "PxArticulationAttachment::setLimitParameters(): Setting limits on a non-leaf attachment has no effect."); + mCore.mLowLimit = parameter.lowLimit; + mCore.mHighLimit = parameter.highLimit; + + if (mCore.mTendonSim) + mCore.mTendonSim->setAttachmentLimits(mCore, parameter.lowLimit, parameter.highLimit); +} + +PxArticulationTendonLimit NpArticulationAttachment::getLimitParameters()const +{ + PxArticulationTendonLimit parameter; + parameter.lowLimit = mCore.mLowLimit; + parameter.highLimit = mCore.mHighLimit; + + return parameter; +} + +void NpArticulationAttachment::setRelativeOffset(const PxVec3& offset) +{ + mCore.mRelativeOffset = offset; + + if (mCore.mTendonSim) + mCore.mTendonSim->setAttachmentRelativeOffset(mCore, offset); +} + +PxVec3 NpArticulationAttachment::getRelativeOffset() const +{ + return mCore.mRelativeOffset; +} + +void NpArticulationAttachment::setCoefficient(const PxReal coefficient) +{ + PX_CHECK_AND_RETURN(PxIsFinite(coefficient), "PxArticulationAttachment::setCoefficient :: Error: NaN or Inf joint coefficient provided!"); + + mCore.mCoefficient = coefficient; + + if (mCore.mTendonSim) + mCore.mTendonSim->setAttachmentCoefficient(mCore, coefficient); +} + +PxReal NpArticulationAttachment::getCoefficient() const +{ + return mCore.mCoefficient; +} + +PxArticulationSpatialTendon* NpArticulationAttachment::getTendon() const +{ + return mTendon; +} + +void NpArticulationAttachment::release() +{ + if (mTendon->getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationAttachment::release() not allowed while the articulation is in the scene. Call will be ignored."); + return; + } + + PX_CHECK_AND_RETURN(getNumChildren() == 0, "PxArticulationAttachment:release() can only release leaf attachments, i.e. attachments with zero children."); + + NpArticulationAttachmentArray& attachments = mTendon->getAttachments(); + + NpArticulationAttachment* npParentAttachment = static_cast(mParent); + + //remove this attachment from the parent + if (npParentAttachment) + npParentAttachment->removeChild(this); + + attachments.back()->mHandle = mHandle; + attachments.replaceWithLast(mHandle); + this->~NpArticulationAttachment(); + + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +void NpArticulationAttachment::removeChild(NpArticulationAttachment* child) +{ + const PxU32 size = mChildren.size(); + + PxU32 index = 0; + for (PxU32 i = 0; i < size; ++i) + { + NpArticulationAttachment* otherChild = mChildren[i]; + if (otherChild == child) + { + index = i; + break; + } + } + const PxU32 lastIndex = size - 1; + mChildren[index] = mChildren[lastIndex]; + mChildren.forceSize_Unsafe(lastIndex); +} + +// PX_SERIALIZATION + +void NpArticulationSpatialTendon::requiresObjects(PxProcessPxBaseCallback& c) +{ + const PxU32 nbAttachments = mAttachments.size(); + for (PxU32 i = 0; i < nbAttachments; i++) + c.process(*mAttachments[i]); +} + +void NpArticulationSpatialTendon::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mAttachments, stream); +} + +void NpArticulationSpatialTendon::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mAttachments, context); +} + +void NpArticulationSpatialTendon::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbAttachments = mAttachments.size(); + for (PxU32 i = 0; i < nbAttachments; i++) + { + NpArticulationAttachment*& attachment = mAttachments[i]; + context.translatePxBase(attachment); + } + + context.translatePxBase(mArticulation); +} + +NpArticulationSpatialTendon* NpArticulationSpatialTendon::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationSpatialTendon* obj = PX_PLACEMENT_NEW(address, NpArticulationSpatialTendon(PxBaseFlags(0))); + address += sizeof(NpArticulationSpatialTendon); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +NpArticulationSpatialTendon::NpArticulationSpatialTendon(NpArticulationReducedCoordinate* articulation) : + PxArticulationSpatialTendon(PxConcreteType::eARTICULATION_SPATIAL_TENDON, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_SPATIAL_TENDON), mArticulation(articulation) +{ + mLLIndex = 0xffffffff; + mHandle = 0xffffffff; +} + +NpArticulationSpatialTendon::~NpArticulationSpatialTendon() +{ + for (PxU32 i = 0; i < mAttachments.size(); ++i) + { + if (mAttachments[i]) + { + mAttachments[i]->~NpArticulationAttachment(); + if(mAttachments[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mAttachments[i]); + } + } +} + +PxArticulationAttachment* NpArticulationSpatialTendon::createAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link) +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationSpatialTendon::createAttachment() not allowed while the articulation is in the scene. Call will be ignored."); + return NULL; + } + PX_CHECK_AND_RETURN_NULL(link, "PxArticulationSpatialTendon::createAttachment: Null pointer link provided. Need valid link."); + PX_CHECK_AND_RETURN_NULL(&link->getArticulation() == getArticulation(), "PxArticulationSpatialTendon::createAttachment: Link from another articulation provided. Need valid link from same articulation."); + +#if PX_CHECKED + if(parent) + PX_CHECK_AND_RETURN_NULL(parent->getTendon() == this, "PxArticulationSpatialTendon::createAttachment: Parent attachment from another tendon provided. Need valid parent from same tendon."); +#endif + + void* npAttachmentMem = PX_ALLOC(sizeof(NpArticulationAttachment), "NpArticulationAttachment"); + PxMarkSerializedMemory(npAttachmentMem, sizeof(NpArticulationAttachment)); + NpArticulationAttachment* npAttachment = PX_PLACEMENT_NEW(npAttachmentMem, NpArticulationAttachment)(parent, coefficient, relativeOffset, link); + + if (npAttachment) + { + npAttachment->setTendon(this); + + NpArticulationAttachment* parentAttachment = static_cast(parent); + + ArticulationAttachmentHandle handle = mAttachments.size(); + npAttachment->mHandle = handle; + + mAttachments.pushBack(npAttachment); + + if (parentAttachment) + { + parentAttachment->mChildren.pushBack(npAttachment); + npAttachment->mParent = parent; + } + else + { + npAttachment->mParent = NULL; + } + } + + return npAttachment; +} + +PxU32 NpArticulationSpatialTendon::getAttachments(PxArticulationAttachment** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(mArticulation->getNpScene()); + + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mAttachments.begin(), mAttachments.size()); +} + +void NpArticulationSpatialTendon::setStiffness(const PxReal stiffness) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(stiffness) && stiffness >= 0.0f, "PxArticulationTendon::setStiffness: spring coefficient must be >= 0!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxArticulationTendon::setStiffness() not allowed while simulation is running. Call will be ignored.") + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setStiffness(stiffness); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationSpatialTendon::getStiffness() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getStiffness(); +} + +void NpArticulationSpatialTendon::setDamping(const PxReal damping) +{ + PX_CHECK_AND_RETURN(PxIsFinite(damping) && damping >= 0.0f, "PxArticulationTendon::setDamping: damping coefficient must be >= 0!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setDamping(damping); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationSpatialTendon::getDamping() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getDamping(); +} + +void NpArticulationSpatialTendon::setLimitStiffness(const PxReal stiffness) +{ + PX_CHECK_AND_RETURN(PxIsFinite(stiffness) && stiffness >= 0.0f, "PxArticulationTendon::setLimitStiffness: stiffness must be >= 0!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setLimitStiffness(stiffness); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationSpatialTendon::getLimitStiffness() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getLimitStiffness(); +} + +void NpArticulationSpatialTendon::setOffset(const PxReal offset, bool autowake) +{ + PX_CHECK_AND_RETURN(PxIsFinite(offset), "PxArticulationTendon::setOffset(): invalid value provided!"); + + PX_ASSERT(!isAPIWriteForbidden()); + + if (autowake && getNpScene()) + mArticulation->autoWakeInternal(); + + mCore.setOffset(offset); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationSpatialTendon::getOffset() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getOffset(); +} + +PxArticulationReducedCoordinate* physx::NpArticulationSpatialTendon::getArticulation() const +{ + return mArticulation; +} + +void NpArticulationSpatialTendon::release() +{ + if (getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxArticulationSpatialTendon::release() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + + PxArray& spatialTendons = mArticulation->getSpatialTendons(); + + spatialTendons.back()->setHandle(mHandle); + spatialTendons.replaceWithLast(mHandle); + this->~NpArticulationSpatialTendon(); + + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +NpArticulationAttachment* NpArticulationSpatialTendon::getAttachment(const PxU32 index) +{ + return mAttachments[index]; +} + +PxU32 NpArticulationSpatialTendon::getNbAttachments() const +{ + return mAttachments.size(); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// PX_SERIALIZATION +void NpArticulationTendonJoint::requiresObjects(PxProcessPxBaseCallback& c) +{ + // Collect articulation links + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + c.process(*mChildren[i]); +} + +void NpArticulationTendonJoint::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mChildren, stream); +} + +void NpArticulationTendonJoint::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mChildren, context); +} + +void NpArticulationTendonJoint::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mLink); + context.translatePxBase(mParent); + + const PxU32 nbChildren = mChildren.size(); + for (PxU32 i = 0; i < nbChildren; i++) + { + NpArticulationTendonJoint*& tendonJoint = mChildren[i]; + context.translatePxBase(tendonJoint); + } + + context.translatePxBase(mTendon); + mCore.mParent = mParent ? &static_cast(mParent)->mCore : NULL; +} + +NpArticulationTendonJoint* NpArticulationTendonJoint::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationTendonJoint* obj = PX_PLACEMENT_NEW(address, NpArticulationTendonJoint(PxBaseFlags(0))); + address += sizeof(NpArticulationTendonJoint); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +// ~PX_SERIALIZATION + +NpArticulationTendonJoint::NpArticulationTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, + const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link) : + PxArticulationTendonJoint(PxConcreteType::eARTICULATION_TENDON_JOINT, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_TENDON_JOINT) +{ + NpArticulationTendonJoint* npParent = static_cast(parent); + mCore.mParent = parent ? &npParent->getCore() : NULL; + mCore.mLLTendonJointIndex = 0xffffffff; + mCore.coefficient = coefficient; + mCore.recipCoefficient = recipCoefficient; + mCore.axis = axis; + mCore.mTendonSim = NULL; + + mLink = link; + mParent = parent; + + mTendon = NULL; + mHandle = 0xffffffff; +} + +PxArticulationFixedTendon* physx::NpArticulationTendonJoint::getTendon() const +{ + return mTendon; +} + +void NpArticulationTendonJoint::setCoefficient(const PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient) +{ + PX_CHECK_AND_RETURN(PxIsFinite(coefficient), "PxArticulationTendonJoint::setCoefficient :: Error: NaN or Inf joint coefficient provided!"); + PX_CHECK_AND_RETURN(PxIsFinite(recipCoefficient), "PxArticulationTendonJoint::setCoefficient :: Error: NaN or Inf joint recipCoefficient provided!"); + + mCore.coefficient = coefficient; + mCore.recipCoefficient = recipCoefficient; + + if (mCore.mTendonSim) + { + mCore.mTendonSim->setTendonJointCoefficient(mCore, axis, coefficient, recipCoefficient); + } +} + +void NpArticulationTendonJoint::getCoefficient(PxArticulationAxis::Enum& axis, PxReal& coefficient, PxReal& recipCoefficient) const +{ + mCore.getCoefficient(axis, coefficient, recipCoefficient); +} + +void NpArticulationTendonJoint::release() +{ + if (mTendon->getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationTendonJoint::release() not allowed while the articulation is in the scene. Call will be ignored."); + return; + } + + PX_CHECK_AND_RETURN(getNumChildren() == 0, "PxArticulationTendonJoint::release() can only release leaf tendon joints, i.e. joints with zero children."); + + NpArticulationTendonJointArray& tendonJoints = mTendon->getTendonJoints(); + + //remove this joint from the parent + NpArticulationTendonJoint* npParentJoint = static_cast(mParent); + if (npParentJoint) + npParentJoint->removeChild(this); + + tendonJoints.back()->mHandle = mHandle; + tendonJoints.replaceWithLast(mHandle); + this->~NpArticulationTendonJoint(); + + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +// PX_SERIALIZATION + +void NpArticulationFixedTendon::requiresObjects(PxProcessPxBaseCallback& c) +{ + const PxU32 nbTendonJoints = mTendonJoints.size(); + for (PxU32 i = 0; i < nbTendonJoints; i++) + c.process(*mTendonJoints[i]); +} + +void NpArticulationFixedTendon::exportExtraData(PxSerializationContext& stream) +{ + Cm::exportInlineArray(mTendonJoints, stream); +} + +void NpArticulationFixedTendon::importExtraData(PxDeserializationContext& context) +{ + Cm::importInlineArray(mTendonJoints, context); +} + +void NpArticulationFixedTendon::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbTendonJoints = mTendonJoints.size(); + for (PxU32 i = 0; i < nbTendonJoints; i++) + { + NpArticulationTendonJoint*& tendonJoint = mTendonJoints[i]; + context.translatePxBase(tendonJoint); + } + + context.translatePxBase(mArticulation); +} + +NpArticulationFixedTendon* NpArticulationFixedTendon::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpArticulationFixedTendon* obj = PX_PLACEMENT_NEW(address, NpArticulationFixedTendon(PxBaseFlags(0))); + address += sizeof(NpArticulationFixedTendon); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +NpArticulationFixedTendon::NpArticulationFixedTendon(NpArticulationReducedCoordinate* articulation) : + PxArticulationFixedTendon(PxConcreteType::eARTICULATION_FIXED_TENDON, PxBaseFlag::eOWNS_MEMORY), + NpBase(NpType::eARTICULATION_FIXED_TENDON), mArticulation(articulation) +{ + mLLIndex = 0xffffffff; + mHandle = 0xffffffff; +} + +NpArticulationFixedTendon::~NpArticulationFixedTendon() +{ + for (PxU32 i = 0; i < mTendonJoints.size(); ++i) + { + if (mTendonJoints[i]) + { + mTendonJoints[i]->~NpArticulationTendonJoint(); + if (mTendonJoints[i]->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + PX_FREE(mTendonJoints[i]); + } + } + } +} + +void NpArticulationFixedTendon::release() +{ + if (getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationFixedTendon::release() not allowed while the articulation is in a scene. Call will be ignored."); + return; + } + + PxArray& fixedTendons = mArticulation->getFixedTendons(); + + fixedTendons.back()->setHandle(mHandle); + fixedTendons.replaceWithLast(mHandle); + this->~NpArticulationFixedTendon(); + + if (mBaseFlags & PxBaseFlag::eOWNS_MEMORY) + PX_FREE_THIS; +} + +PxArticulationTendonJoint* NpArticulationFixedTendon::createTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link) +{ + if(getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxArticulationFixedTendon::createTendonJoint() not allowed while the articulation is in the scene. Call will be ignored."); + return NULL; + } + PX_CHECK_AND_RETURN_NULL(link, "PxArticulationFixedTendon::createTendonJoint: Null pointer link provided. Need valid link."); + PX_CHECK_AND_RETURN_NULL(&link->getArticulation() == getArticulation(), "PxArticulationFixedTendon::createTendonJoint: Link from another articulation provided. Need valid link from same articulation."); + +#if PX_CHECKED + if (parent) + { + PX_CHECK_AND_RETURN_NULL(parent->getTendon() == this, "PxArticulationFixedTendon::createTendonJoint: Parent tendon joint from another tendon provided. Need valid parent from same tendon."); + PX_CHECK_AND_RETURN_NULL(parent->getLink() != link, "PxArticulationFixedTendon::createTendonJoint :: Error: Parent link and child link are the same link!"); + PX_CHECK_AND_RETURN_NULL(parent->getLink()== (&link->getInboundJoint()->getParentArticulationLink()), "PxArticulationFixedTendon::createTendonJoint :: Error: Link referenced by parent tendon joint must be the parent of the child link!"); + } +#endif + + void* npTendonJointtMem = PX_ALLOC(sizeof(NpArticulationTendonJoint), "NpArticulationTendonJoint"); + PxMarkSerializedMemory(npTendonJointtMem, sizeof(NpArticulationTendonJoint)); + NpArticulationTendonJoint* npTendonJoint = PX_PLACEMENT_NEW(npTendonJointtMem, NpArticulationTendonJoint)(parent, axis, coefficient, recipCoefficient, link); + + if (npTendonJoint) + { + NpArticulationTendonJoint* parentTendonJoint = static_cast(parent); + + npTendonJoint->setTendon(this); + if (parentTendonJoint) + { + parentTendonJoint->mChildren.pushBack(npTendonJoint); + npTendonJoint->mParent = parent; + } + else + { + npTendonJoint->mParent = NULL; + } + npTendonJoint->mHandle = mTendonJoints.size(); + mTendonJoints.pushBack(npTendonJoint); + } + + return npTendonJoint; +} + +PxU32 NpArticulationFixedTendon::getTendonJoints(PxArticulationTendonJoint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(mArticulation->getNpScene()); + + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mTendonJoints.begin(), mTendonJoints.size()); +} + +void NpArticulationFixedTendon::setStiffness(const PxReal stiffness) +{ + PX_CHECK_AND_RETURN(PxIsFinite(stiffness) && stiffness >= 0.0f, "PxArticulationTendon::setStiffness: spring coefficient must be >= 0!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setStiffness(stiffness); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationFixedTendon::getStiffness() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getStiffness(); +} + +void NpArticulationFixedTendon::setDamping(const PxReal damping) +{ + PX_CHECK_AND_RETURN(PxIsFinite(damping) && damping >= 0.0f, "PxArticulationTendon::setDamping: damping coefficient must be >= 0!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setDamping(damping); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationFixedTendon::getDamping() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getDamping(); +} + +void NpArticulationFixedTendon::setLimitStiffness(const PxReal stiffness) +{ + PX_CHECK_AND_RETURN(PxIsFinite(stiffness) && stiffness >=0.f , "PxArticulationTendon::setLimitStiffness: stiffness must have valid value!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setLimitStiffness(stiffness); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationFixedTendon::getLimitStiffness() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getLimitStiffness(); +} + +void NpArticulationFixedTendon::setRestLength(const PxReal restLength) +{ + PX_CHECK_AND_RETURN(PxIsFinite(restLength) , "PxArticulationTendon::setRestLength: restLength must have valid value!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setSpringRestLength(restLength); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationFixedTendon::getRestLength() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getSpringRestLength(); +} + +void NpArticulationFixedTendon::setLimitParameters(const PxArticulationTendonLimit& parameter) +{ + PX_CHECK_AND_RETURN(PxIsFinite(parameter.lowLimit) && PxIsFinite(parameter.highLimit) && (parameter.lowLimit <= parameter.highLimit), "PxArticulationFixedTendon::setLimitParameters: lowLimit and highLimit must have valid values and lowLimit must be less than highLimit!"); + + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setLimitRange(parameter.lowLimit, parameter.highLimit); + UPDATE_PVD_PROPERTY +} + +PxArticulationTendonLimit NpArticulationFixedTendon::getLimitParameters() const +{ + NP_READ_CHECK(getNpScene()); + + PxArticulationTendonLimit parameter; + mCore.getLimitRange(parameter.lowLimit, parameter.highLimit); + return parameter; +} + +NpArticulationTendonJoint* NpArticulationFixedTendon::getTendonJoint(const PxU32 index) +{ + return mTendonJoints[index]; +} + +PxU32 NpArticulationFixedTendon::getNbTendonJoints() const +{ + return mTendonJoints.size(); +} + +void NpArticulationFixedTendon::setOffset(const PxReal offset, bool autowake) +{ + PX_CHECK_AND_RETURN(PxIsFinite(offset), "PxArticulationTendon::setOffset(): invalid value provided!"); + + PX_ASSERT(!isAPIWriteForbidden()); + + if (autowake && getNpScene()) + mArticulation->autoWakeInternal(); + + mCore.setOffset(offset); + UPDATE_PVD_PROPERTY +} + +PxReal NpArticulationFixedTendon::getOffset() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getOffset(); +} + +PxArticulationReducedCoordinate* physx::NpArticulationFixedTendon::getArticulation() const +{ + return mArticulation; +} + +void NpArticulationTendonJoint::removeChild(NpArticulationTendonJoint* child) +{ + for(PxU32 i = 0; i < mChildren.size(); ++i) + { + if(mChildren[i] == child) + { + mChildren.replaceWithLast(i); + break; + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.h new file mode 100644 index 0000000..8601f9d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpArticulationTendon.h @@ -0,0 +1,321 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_ARTICULATION_TENDON_H +#define NP_ARTICULATION_TENDON_H + +#include "foundation/PxInlineArray.h" +#include "PxArticulationTendon.h" +#include "ScArticulationTendonCore.h" +#include "ScArticulationAttachmentCore.h" +#include "ScArticulationTendonJointCore.h" +#include "NpBase.h" + + +namespace physx +{ + +typedef PxU32 ArticulationAttachmentHandle; +typedef PxU32 ArticulationTendonHandle; + +class NpArticulationReducedCoordinate; + +class NpArticulationAttachment; +class NpArticulationSpatialTendon; + +class NpArticulationTendonJoint; +class NpArticulationFixedTendon; + +class NpArticulationAttachmentArray : public PxInlineArray //!!!AL TODO: check if default of 4 elements makes sense +{ + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== +public: + // PX_SERIALIZATION + NpArticulationAttachmentArray(const PxEMPTY) : PxInlineArray(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + NpArticulationAttachmentArray() : PxInlineArray("NpArticulationAttachmentArray") {} +}; + +class NpArticulationTendonJointArray : public PxInlineArray //!!!AL TODO: check if default of 4 elements makes sense +{ + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== +public: + // PX_SERIALIZATION + NpArticulationTendonJointArray(const PxEMPTY) : PxInlineArray(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + NpArticulationTendonJointArray() : PxInlineArray("NpArticulationTendonJointArray") {} +}; + +class NpArticulationAttachment : public PxArticulationAttachment, public NpBase +{ + +public: + +// PX_SERIALIZATION + NpArticulationAttachment(PxBaseFlags baseFlags) + : PxArticulationAttachment(baseFlags), NpBase(PxEmpty), mHandle(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationAttachment* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + + NpArticulationAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link); + + virtual ~NpArticulationAttachment(); + + + virtual void setRestLength(const PxReal restLength); + virtual PxReal getRestLength() const; + + virtual void setLimitParameters(const PxArticulationTendonLimit& paramters); + virtual PxArticulationTendonLimit getLimitParameters() const; + + virtual void setRelativeOffset(const PxVec3& offset); + virtual PxVec3 getRelativeOffset() const; + + virtual void setCoefficient(const PxReal coefficient); + virtual PxReal getCoefficient() const; + + virtual PxArticulationLink* getLink() const { return mLink; } + virtual PxArticulationAttachment* getParent() const { return mParent; } + virtual PxArticulationSpatialTendon* getTendon() const; + + virtual bool isLeaf() const { return mChildren.empty(); } + + virtual void release(); + + PX_FORCE_INLINE NpArticulationAttachment** getChildren() { return mChildren.begin(); } + PX_FORCE_INLINE PxU32 getNumChildren() { return mChildren.size(); } + + PX_FORCE_INLINE void setTendon(NpArticulationSpatialTendon* tendon) { mTendon = tendon; } + PX_FORCE_INLINE NpArticulationSpatialTendon& getTendon() { return *mTendon; } + + PX_FORCE_INLINE Sc::ArticulationAttachmentCore& getCore() { return mCore; } + + void removeChild(NpArticulationAttachment* child); + + PxArticulationLink* mLink; //the link this attachment attach to + PxArticulationAttachment* mParent; + ArticulationAttachmentHandle mHandle; + NpArticulationAttachmentArray mChildren; + NpArticulationSpatialTendon* mTendon; + Sc::ArticulationAttachmentCore mCore; +}; + + +class NpArticulationSpatialTendon : public PxArticulationSpatialTendon, public NpBase +{ +public: + +// PX_SERIALIZATION + NpArticulationSpatialTendon(PxBaseFlags baseFlags) + : PxArticulationSpatialTendon(baseFlags), NpBase(PxEmpty), mAttachments(PxEmpty), mCore(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationSpatialTendon* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + NpArticulationSpatialTendon(NpArticulationReducedCoordinate* articulation); + + virtual ~NpArticulationSpatialTendon(); + + virtual PxArticulationAttachment* createAttachment(PxArticulationAttachment* parent, const PxReal coefficient, const PxVec3 relativeOffset, PxArticulationLink* link); + + NpArticulationAttachment* getAttachment(const PxU32 index); + virtual PxU32 getAttachments(PxArticulationAttachment** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + PxU32 getNbAttachments() const; + + virtual void setStiffness(const PxReal stiffness); + virtual PxReal getStiffness() const; + + virtual void setDamping(const PxReal damping); + virtual PxReal getDamping() const; + + virtual void setLimitStiffness(const PxReal stiffness); + virtual PxReal getLimitStiffness() const; + + virtual void setOffset(const PxReal offset, bool autowake = true); + virtual PxReal getOffset() const; + + virtual PxArticulationReducedCoordinate* getArticulation() const; + + virtual void release(); + + PX_FORCE_INLINE Sc::ArticulationSpatialTendonCore& getTendonCore() { return mCore; } + + PX_FORCE_INLINE ArticulationTendonHandle getHandle() { return mHandle; } + PX_FORCE_INLINE void setHandle(ArticulationTendonHandle handle) { mHandle = handle; } + + PX_FORCE_INLINE NpArticulationAttachmentArray& getAttachments() { return mAttachments; } + +private: + NpArticulationAttachmentArray mAttachments; + NpArticulationReducedCoordinate* mArticulation; + PxU32 mLLIndex; + Sc::ArticulationSpatialTendonCore mCore; + ArticulationTendonHandle mHandle; +}; + +class NpArticulationTendonJoint : public PxArticulationTendonJoint, public NpBase +{ +public: + // PX_SERIALIZATION + NpArticulationTendonJoint(PxBaseFlags baseFlags) : PxArticulationTendonJoint(baseFlags), NpBase(PxEmpty), mChildren(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {} + void preExportDataReset() { mCore.preExportDataReset(); } + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationTendonJoint* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + NpArticulationTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient, PxArticulationLink* link); + + virtual ~NpArticulationTendonJoint(){} + + virtual PxArticulationLink* getLink() const { return mLink; } + + virtual PxArticulationTendonJoint* getParent() const { return mParent; } + + virtual PxArticulationFixedTendon* getTendon() const; + + virtual void setCoefficient(const PxArticulationAxis::Enum axis, const PxReal coefficient, const PxReal recipCoefficient); + virtual void getCoefficient(PxArticulationAxis::Enum& axis, PxReal& coefficient, PxReal& recipCoefficient) const; + + + virtual void release(); + + PX_FORCE_INLINE NpArticulationTendonJoint** getChildren() { return mChildren.begin(); } + PX_FORCE_INLINE PxU32 getNumChildren() { return mChildren.size(); } + + PX_FORCE_INLINE void setTendon(NpArticulationFixedTendon* tendon) { mTendon = tendon; } + PX_FORCE_INLINE NpArticulationFixedTendon& getTendon() { return *mTendon; } + + PX_FORCE_INLINE Sc::ArticulationTendonJointCore& getCore() { return mCore; } + + void removeChild(NpArticulationTendonJoint* child); + + PxArticulationLink* mLink; //the link this joint associated with + PxArticulationTendonJoint* mParent; + NpArticulationTendonJointArray mChildren; + NpArticulationFixedTendon* mTendon; + Sc::ArticulationTendonJointCore mCore; + PxU32 mHandle; + +}; + +class NpArticulationFixedTendon : public PxArticulationFixedTendon, public NpBase +{ +public: + // PX_SERIALIZATION + NpArticulationFixedTendon(PxBaseFlags baseFlags): PxArticulationFixedTendon(baseFlags), NpBase(PxEmpty), mTendonJoints(PxEmpty), mCore(PxEmpty), mHandle(PxEmpty) {} + void preExportDataReset() {} + virtual void exportExtraData(PxSerializationContext& ); + void importExtraData(PxDeserializationContext& ); + void resolveReferences(PxDeserializationContext& ); + virtual void requiresObjects(PxProcessPxBaseCallback&); + virtual bool isSubordinate() const { return true; } + static NpArticulationFixedTendon* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + NpArticulationFixedTendon(NpArticulationReducedCoordinate* articulation); + + virtual ~NpArticulationFixedTendon(); + + virtual PxArticulationTendonJoint* createTendonJoint(PxArticulationTendonJoint* parent, PxArticulationAxis::Enum axis, const PxReal scale, const PxReal recipScale, PxArticulationLink* link); + + NpArticulationTendonJoint* getTendonJoint(const PxU32 index); + virtual PxU32 getTendonJoints(PxArticulationTendonJoint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + virtual PxU32 getNbTendonJoints(void) const; + + virtual void setStiffness(const PxReal stiffness); + virtual PxReal getStiffness() const; + + virtual void setDamping(const PxReal damping); + virtual PxReal getDamping() const; + + virtual void setLimitStiffness(const PxReal damping); + virtual PxReal getLimitStiffness() const; + + virtual void setRestLength(const PxReal restLength); + virtual PxReal getRestLength() const; + + virtual void setLimitParameters(const PxArticulationTendonLimit& paramters); + virtual PxArticulationTendonLimit getLimitParameters() const; + + virtual void setOffset(const PxReal offset, bool autowake = true); + virtual PxReal getOffset() const; + + virtual PxArticulationReducedCoordinate* getArticulation() const; + + virtual void release(); + + PX_FORCE_INLINE ArticulationTendonHandle getHandle() { return mHandle; } + PX_FORCE_INLINE void setHandle(ArticulationTendonHandle handle) { mHandle = handle; } + + PX_FORCE_INLINE Sc::ArticulationFixedTendonCore& getTendonCore() { return mCore; } + + PX_FORCE_INLINE NpArticulationTendonJointArray& getTendonJoints() { return mTendonJoints; } + +private: + NpArticulationTendonJointArray mTendonJoints; + NpArticulationReducedCoordinate* mArticulation; + PxU32 mLLIndex; + Sc::ArticulationFixedTendonCore mCore; + ArticulationTendonHandle mHandle; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBase.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBase.h new file mode 100644 index 0000000..5cdd207 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBase.h @@ -0,0 +1,211 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_BASE_H +#define NP_BASE_H + +#include "foundation/PxUserAllocated.h" +#include "NpScene.h" + +#if PX_SUPPORT_PVD + // PT: updatePvdProperties() is overloaded and the compiler needs to know 'this' type to do the right thing. + // Thus we can't just move this as an inlined Base function. + #define UPDATE_PVD_PROPERTY \ + { \ + NpScene* scene = getNpScene(); /* shared shapes also return zero here */ \ + if(scene) \ + scene->getScenePvdClientInternal().updatePvdProperties(this); \ + } +#else + #define UPDATE_PVD_PROPERTY +#endif + +/////////////////////////////////////////////////////////////////////////////// +// PT: technically the following macros should all be "NP" macros (they're not exposed to the public API) +// but I only renamed the local ones (used in NpBase.h) as "NP", while the other "PX" are used by clients +// of these macros in other Np files. The PX_CHECK names are very misleading, since these checks seem to +// stay in all builds, contrary to other macros like PX_CHECK_AND_RETURN. +/////////////////////////////////////////////////////////////////////////////// + +#define NP_API_READ_WRITE_ERROR_MSG(text) PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, text) + +// some API read calls are not allowed while the simulation is running since the properties might get +// written to during simulation. Some of those are allowed while collision is running though or in callbacks +// like contact modification, contact reports etc. Furthermore, it is ok to read all of them between fetchCollide +// and advance. +#define NP_API_READ_FORBIDDEN(npScene) (npScene && npScene->isAPIReadForbidden()) +#define NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene) (npScene && npScene->isAPIReadForbidden() && (!npScene->isCollisionPhaseActive())) + +/////////////////////////////////////////////////////////////////////////////// + +#define PX_CHECK_SCENE_API_READ_FORBIDDEN(npScene, text) \ + if(NP_API_READ_FORBIDDEN(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return; \ + } + +#define PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(npScene, text, retValue) \ + if(NP_API_READ_FORBIDDEN(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return retValue; \ + } + +#define PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene, text) \ + if(NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return; \ + } + +#define PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(npScene, text, retValue) \ + if(NP_API_READ_FORBIDDEN_EXCEPT_COLLIDE(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return retValue; \ + } + +/////////////////////////////////////////////////////////////////////////////// + +#define NP_API_WRITE_FORBIDDEN(npScene) (npScene && npScene->isAPIWriteForbidden()) + +// some API write calls are allowed between fetchCollide and advance +#define NP_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene) (npScene && npScene->isAPIWriteForbidden() && (npScene->getSimulationStage() != Sc::SimulationStage::eFETCHCOLLIDE)) + +/////////////////////////////////////////////////////////////////////////////// + +#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, text) \ + if(NP_API_WRITE_FORBIDDEN(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return; \ + } + +#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, text, retValue) \ + if(NP_API_WRITE_FORBIDDEN(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return retValue; \ + } + +#define PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, text) \ + if(NP_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene)) \ + { \ + NP_API_READ_WRITE_ERROR_MSG(text); \ + return; \ + } + +/////////////////////////////////////////////////////////////////////////////// + +#define NP_UNUSED_BASE_INDEX 0x07ffffff +#define NP_BASE_INDEX_MASK 0x07ffffff +#define NP_BASE_INDEX_SHIFT 27 + +namespace physx +{ + struct NpType + { + enum Enum + { + eUNDEFINED, + eSHAPE, + eBODY, + eBODY_FROM_ARTICULATION_LINK, + eRIGID_STATIC, + eCONSTRAINT, + eARTICULATION, + eARTICULATION_JOINT, + eARTICULATION_SENSOR, + eARTICULATION_SPATIAL_TENDON, + eARTICULATION_ATTACHMENT, + eARTICULATION_FIXED_TENDON, + eARTICULATION_TENDON_JOINT, + eAGGREGATE, + eSOFTBODY, + eFEMCLOTH, + ePBD_PARTICLESYSTEM, + eFLIP_PARTICLESYSTEM, + eMPM_PARTICLESYSTEM, + eCUSTOM_PARTICLESYSTEM, + eHAIRSYSTEM, + eTYPE_COUNT, + + eFORCE_DWORD = 0x7fffffff + }; + }; + + // PT: we're going to store that type on 5 bits, leaving 27 bits for the base index. + PX_COMPILE_TIME_ASSERT(NpType::eTYPE_COUNT<32); + + class NpBase : public PxUserAllocated + { + PX_NOCOPY(NpBase) + public: +// PX_SERIALIZATION + NpBase(const PxEMPTY) : + mScene (NULL), + mFreeSlot (0) + { + // PT: preserve type, reset base index + setBaseIndex(NP_UNUSED_BASE_INDEX); + } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpBase(NpType::Enum type) : + mScene (NULL), + mFreeSlot (0) + { + mBaseIndexAndType = (PxU32(type)<>NP_BASE_INDEX_SHIFT); } + PX_FORCE_INLINE void setNpScene(NpScene* scene) { mScene = scene; } + PX_FORCE_INLINE NpScene* getNpScene() const { return mScene; } + + PX_FORCE_INLINE PxU32 getBaseIndex() const { return mBaseIndexAndType & NP_BASE_INDEX_MASK; } + PX_FORCE_INLINE void setBaseIndex(PxU32 index) + { + PX_ASSERT(!(index & ~NP_BASE_INDEX_MASK)); + const PxU32 type = mBaseIndexAndType & ~NP_BASE_INDEX_MASK; + mBaseIndexAndType = index|type; + } + protected: + ~NpBase(){} + private: + NpScene* mScene; + PxU32 mBaseIndexAndType; + protected: + PxU32 mFreeSlot; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp new file mode 100644 index 0000000..d83efb2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.cpp @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxTransform.h" +#include "NpBounds.h" +#include "CmTransformUtils.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "GuBounds.h" + +using namespace physx; +using namespace Sq; + +static void computeStaticWorldAABB(PxBounds3& bounds, const NpShape& npShape, const NpActor& npActor) +{ + const PxTransform& shape2Actor = npShape.getCore().getShape2Actor(); + + PX_ALIGN(16, PxTransform) globalPose; + + Cm::getStaticGlobalPoseAligned(static_cast(npActor).getCore().getActor2World(), shape2Actor, globalPose); + + Gu::computeBounds(bounds, npShape.getCore().getGeometry(), globalPose, 0.0f, SQ_PRUNER_INFLATION); +} + +static void computeDynamicWorldAABB(PxBounds3& bounds, const NpShape& npShape, const NpActor& npActor) +{ + const PxTransform& shape2Actor = npShape.getCore().getShape2Actor(); + + PX_ALIGN(16, PxTransform) globalPose; + { + PX_ALIGN(16, PxTransform) kinematicTarget; + const PxU16 sqktFlags = PxRigidBodyFlag::eKINEMATIC | PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES; + // PT: TODO: revisit this once the dust has settled + PX_ASSERT(npActor.getNpType()==NpType::eBODY_FROM_ARTICULATION_LINK || npActor.getNpType()==NpType::eBODY); + const Sc::BodyCore& core = npActor.getNpType()==NpType::eBODY_FROM_ARTICULATION_LINK ? static_cast(npActor).getCore() : static_cast(npActor).getCore(); + const bool useTarget = (PxU16(core.getFlags()) & sqktFlags) == sqktFlags; + const PxTransform& body2World = (useTarget && core.getKinematicTarget(kinematicTarget)) ? kinematicTarget : core.getBody2World(); + Cm::getDynamicGlobalPoseAligned(body2World, shape2Actor, core.getBody2Actor(), globalPose); + } + + Gu::computeBounds(bounds, npShape.getCore().getGeometry(), globalPose, 0.0f, SQ_PRUNER_INFLATION); +} + +const ComputeBoundsFunc Sq::gComputeBoundsTable[2] = +{ + computeStaticWorldAABB, + computeDynamicWorldAABB +}; diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.h new file mode 100644 index 0000000..f614cdd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpBounds.h @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_BOUNDS_H +#define NP_BOUNDS_H + +namespace physx +{ + class PxBounds3; + class NpShape; + class NpActor; + +namespace Sq +{ + typedef void(*ComputeBoundsFunc) (PxBounds3& bounds, const NpShape& scShape, const NpActor& npActor); + + extern const ComputeBoundsFunc gComputeBoundsTable[2]; + +// #define SQ_PRUNER_EPSILON 0.01f + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp new file mode 100644 index 0000000..a10a077 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.cpp @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpCheck.h" +#include "NpScene.h" + +using namespace physx; + +NpReadCheck::NpReadCheck(const NpScene* scene, const char* functionName) : mScene(scene), mName(functionName), mErrorCount(0) +{ + if(mScene) + { + if(!mScene->startRead()) + { + if(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "An API read call (%s) was made from thread %d but PxScene::lockRead() was not called first, note that " + "when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be " + "wrapped in the appropriate locks.", mName, PxU32(PxThread::getId())); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "Overlapping API read and write call detected during %s from thread %d! Note that read operations to " + "the SDK must not be overlapped with write calls, else the resulting behavior is undefined.", mName, PxU32(PxThread::getId())); + } + } + + // Record the NpScene read/write error counter which is + // incremented any time a NpScene::startWrite/startRead fails + // (see destructor for additional error checking based on this count) + mErrorCount = mScene->getReadWriteErrorCount(); + } +} + +NpReadCheck::~NpReadCheck() +{ + if(mScene) + { + // By checking if the NpScene::mConcurrentErrorCount has been incremented + // we can detect if an erroneous read/write was performed during + // this objects lifetime. In this case we also print this function's + // details so that the user can see which two API calls overlapped + if(mScene->getReadWriteErrorCount() != mErrorCount && !(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "Leaving %s on thread %d, an API overlapping write on another thread was detected.", mName, PxU32(PxThread::getId())); + } + + mScene->stopRead(); + } +} + +NpWriteCheck::NpWriteCheck(NpScene* scene, const char* functionName, bool allowReentry) : mScene(scene), mName(functionName), mAllowReentry(allowReentry), mErrorCount(0) +{ + if(mScene) + { + switch(mScene->startWrite(mAllowReentry)) + { + case NpScene::StartWriteResult::eOK: + break; + case NpScene::StartWriteResult::eNO_LOCK: + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "An API write call (%s) was made from thread %d but PxScene::lockWrite() was not called first, note that " + "when PxSceneFlag::eREQUIRE_RW_LOCK is enabled all API reads and writes must be " + "wrapped in the appropriate locks.", mName, PxU32(PxThread::getId())); + break; + case NpScene::StartWriteResult::eRACE_DETECTED: + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "Concurrent API write call or overlapping API read and write call detected during %s from thread %d! " + "Note that write operations to the SDK must be sequential, i.e., no overlap with " + "other write or read calls, else the resulting behavior is undefined. " + "Also note that API writes during a callback function are not permitted.", mName, PxU32(PxThread::getId())); + break; + + case NpScene::StartWriteResult::eIN_FETCHRESULTS: + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "Illegal write call detected in %s from thread %d during split fetchResults! " + "Note that write operations to the SDK are not permitted between the start of fetchResultsStart() and end of fetchResultsFinish(). " + "Behavior will be undefined. ", mName, PxU32(PxThread::getId())); + break; + } + + // Record the NpScene read/write error counter which is + // incremented any time a NpScene::startWrite/startRead fails + // (see destructor for additional error checking based on this count) + mErrorCount = mScene->getReadWriteErrorCount(); + } +} + +NpWriteCheck::~NpWriteCheck() +{ + if(mScene) + { + // By checking if the NpScene::mConcurrentErrorCount has been incremented + // we can detect if an erroneous read/write was performed during + // this objects lifetime. In this case we also print this function's + // details so that the user can see which two API calls overlapped + if(mScene->getReadWriteErrorCount() != mErrorCount && !(mScene->getScScene().getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, + "Leaving %s on thread %d, an overlapping API read or write by another thread was detected.", mName, PxU32(PxThread::getId())); + } + + mScene->stopWrite(mAllowReentry); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.h new file mode 100644 index 0000000..c47486d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpCheck.h @@ -0,0 +1,122 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_CHECK_H +#define NP_CHECK_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx +{ + +class NpScene; + +// RAII wrapper around the PxScene::startRead() method, note that this +// object does not acquire any scene locks, it is an error checking only mechanism +class NpReadCheck +{ +public: + NpReadCheck(const NpScene* scene, const char* functionName); + ~NpReadCheck(); +private: + const NpScene* mScene; + const char* mName; + PxU32 mErrorCount; +}; + +// RAII wrapper around the PxScene::startWrite() method, note that this +// object does not acquire any scene locks, it is an error checking only mechanism +class NpWriteCheck +{ +public: + NpWriteCheck(NpScene* scene, const char* functionName, bool allowReentry=true); + ~NpWriteCheck(); + +private: + + NpScene* mScene; + const char* mName; + bool mAllowReentry; + PxU32 mErrorCount; +}; + +#if (PX_DEBUG || PX_CHECKED) + // Creates a scoped read check object that detects whether appropriate scene locks + // have been acquired and checks if reads/writes overlap, this macro should typically + // be placed at the beginning of any const API methods that are not multi-thread safe, + // the error conditions checked can be summarized as: + + // 1. PxSceneFlag::eREQUIRE_RW_LOCK was specified but PxScene::lockRead() was not yet called + // 2. Other threads were already writing, or began writing during the object lifetime + #define NP_READ_CHECK(npScenePtr) NpReadCheck npReadCheck(static_cast(npScenePtr), __FUNCTION__); + + // Creates a scoped write check object that detects whether appropriate scene locks + // have been acquired and checks if reads/writes overlap, this macro should typically + // be placed at the beginning of any non-const API methods that are not multi-thread safe. + // By default re-entrant write calls by the same thread are allowed, the error conditions + // checked can be summarized as: + + // 1. PxSceneFlag::eREQUIRE_RW_LOCK was specified but PxScene::lockWrite() was not yet called + // 2. Other threads were already reading, or began reading during the object lifetime + // 3. Other threads were already writing, or began writing during the object lifetime + #define NP_WRITE_CHECK(npScenePtr) NpWriteCheck npWriteCheck(npScenePtr, __FUNCTION__); + + // Creates a scoped write check object that disallows re-entrant writes, this is used by + // the NpScene::simulate method to detect when callbacks make write calls to the API + #define NP_WRITE_CHECK_NOREENTRY(npScenePtr) NpWriteCheck npWriteCheck(npScenePtr, __FUNCTION__, false); +#else + #define NP_READ_CHECK(npScenePtr) + #define NP_WRITE_CHECK(npScenePtr) + #define NP_WRITE_CHECK_NOREENTRY(npScenePtr) +#endif + +/* + PT: suggested ordering for Np-level checks & macros: + + PX_PROFILE_ZONE(...); + NP_WRITE_CHECK(...); + PX_CHECK_AND_RETURN_XXX(...); + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(...); + PX_SIMD_GUARD; + + Current rationale: + + - profile zone first to include the cost of the checks in the profiling results. + + - NP_WRITE_CHECK before PX_CHECK macros. I tried both and the DLL size is smaller with NP_WRITE_CHECK macros first. + + - PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL after PX_CHECK_AND_RETURN macros, because contrary to the others + these macros don't vanish in Release builds. So we want to group together NP_WRITE_CHECK and PX_CHECK_AND_RETURN macros + (the ones that do vanish). That way we can eventually skip them with a runtime flag. + + - PX_SIMD_GUARD last. No need to take the guard before the PX_CHECK_SCENE_API are done, it would only generate more + guard dtor code when the macro eary exits. +*/ +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConnector.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConnector.h new file mode 100644 index 0000000..d5f861e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConnector.h @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_CONNECTOR_H +#define NP_CONNECTOR_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxInlineArray.h" +#include "foundation/PxUtilities.h" +#include "CmUtils.h" + +namespace physx +{ + +struct NpConnectorType +{ + enum Enum + { + eConstraint, + eAggregate, + eObserver, + eBvh, + eInvalid + }; +}; + + +class NpConnector +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + NpConnector() : mType(NpConnectorType::eInvalid), mObject(NULL) {} + NpConnector(NpConnectorType::Enum type, PxBase* object) : mType(PxTo8(type)), mObject(object) {} +// PX_SERIALIZATION + NpConnector(const NpConnector& c) + { + //special copy constructor that initializes padding bytes for meta data verification (PX_CHECKED only) + PxMarkSerializedMemory(this, sizeof(NpConnector)); + mType = c.mType; + mObject = c.mObject; + } + + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + PxU8 mType; // Revisit whether the type is really necessary or whether the serializable type is enough. + // Since joints might gonna inherit from observers to register for constraint release events, the type + // is necessary because a joint has its own serializable type and could not be detected as observer anymore. + PxU8 mPadding[3]; // PT: padding from prev byte + PxBase* mObject; // So far the serialization framework only supports ptr resolve for PxBase objects. + // However, so far the observers all are PxBase, hence this choice of type. +}; + + +class NpConnectorIterator +{ +public: + PX_FORCE_INLINE NpConnectorIterator(NpConnector* c, PxU32 size, NpConnectorType::Enum type) : mConnectors(c), mSize(size), mIndex(0), mType(type) {} + + PX_FORCE_INLINE PxBase* getNext() + { + PxBase* s = NULL; + while(mIndex < mSize) + { + NpConnector& c = mConnectors[mIndex]; + mIndex++; + if (c.mType == mType) + return c.mObject; + } + return s; + } + +private: + NpConnector* mConnectors; + PxU32 mSize; + PxU32 mIndex; + NpConnectorType::Enum mType; +}; + + +class NpConnectorArray: public PxInlineArray +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpConnectorArray(const PxEMPTY) : PxInlineArray (PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpConnectorArray() : PxInlineArray("connectorArray") + { + //special default constructor that initializes padding bytes for meta data verification (PX_CHECKED only) + PxMarkSerializedMemory(this->mData, 4*sizeof(NpConnector)); + } +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp new file mode 100644 index 0000000..694367c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.cpp @@ -0,0 +1,440 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxConstraint.h" +#include "NpConstraint.h" +#include "NpPhysics.h" +#include "NpRigidDynamic.h" +#include "NpRigidStatic.h" +#include "NpArticulationLink.h" +#include "ScConstraintSim.h" +#include "ScConstraintInteraction.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace Sc; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxConstraintFlags scGetFlags(const ConstraintCore& core) +{ +// return core.getFlags() & (~(PxConstraintFlag::eBROKEN | PxConstraintFlag::eGPU_COMPATIBLE)); + return core.getFlags() & (~(PxConstraintFlag::eGPU_COMPATIBLE)); +} + +static NpScene* getSceneFromActors(const PxRigidActor* actor0, const PxRigidActor* actor1) +{ + NpScene* s0 = NULL; + NpScene* s1 = NULL; + + if(actor0 && (!(actor0->getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))) + s0 = static_cast(actor0->getScene()); + if(actor1 && (!(actor1->getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))) + s1 = static_cast(actor1->getScene()); + +#if PX_CHECKED + if ((s0 && s1) && (s0 != s1)) + outputError(__LINE__, "Adding constraint to scene: Actors belong to different scenes, undefined behavior expected!"); +#endif + + if ((!actor0 || s0) && (!actor1 || s1)) + return s0 ? s0 : s1; + else + return NULL; +} + +// PT: TODO: refactor with version in ScScene.cpp & with NpActor::getFromPxActor +static NpActor* getNpActor(PxRigidActor* a) +{ + if(!a) + return NULL; + + const PxType type = a->getConcreteType(); + + if (type == PxConcreteType::eRIGID_DYNAMIC) + return static_cast(a); + else if (type == PxConcreteType::eARTICULATION_LINK) + return static_cast(a); + else + { + PX_ASSERT(type == PxConcreteType::eRIGID_STATIC); + return static_cast(a); + } +} + +void NpConstraint::setConstraintFunctions(PxConstraintConnector& n, const PxConstraintShaderTable& shaders) +{ + mCore.setConstraintFunctions(n, shaders); + + //update mConnectorArray, since mActor0 or mActor1 should be in external reference + bool bNeedUpdate = false; + if(mActor0) + { + NpActor& npActor = NpActor::getFromPxActor(*mActor0); + if(npActor.findConnector(NpConnectorType::eConstraint, this) == 0xffffffff) + { + bNeedUpdate = true; + npActor.addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 0: Constraint already added"); + } + } + + if(mActor1) + { + NpActor& npActor = NpActor::getFromPxActor(*mActor1); + if(npActor.findConnector(NpConnectorType::eConstraint, this) == 0xffffffff) + { + bNeedUpdate = true; + npActor.addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 1: Constraint already added"); + } + } + + if(bNeedUpdate) + { + NpScene* newScene = ::getSceneFromActors(mActor0, mActor1); + NpScene* oldScene = getNpScene(); + + if (oldScene != newScene) + { + if(oldScene) + oldScene->removeFromConstraintList(*this); + + if(newScene) + newScene->addToConstraintList(*this); + } + } +} + +void NpConstraint::addConnectors(PxRigidActor* actor0, PxRigidActor* actor1) +{ + if(actor0) + NpActor::getFromPxActor(*actor0).addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 0: Constraint already added"); + if(actor1) + NpActor::getFromPxActor(*actor1).addConnector(NpConnectorType::eConstraint, this, "PxConstraint: Add to rigid actor 1: Constraint already added"); +} + +void NpConstraint::removeConnectors(const char* errorMsg0, const char* errorMsg1) +{ + if(mActor0) + NpActor::getFromPxActor(*mActor0).removeConnector(*mActor0, NpConnectorType::eConstraint, this, errorMsg0); + if(mActor1) + NpActor::getFromPxActor(*mActor1).removeConnector(*mActor1, NpConnectorType::eConstraint, this, errorMsg1); +} + +NpConstraint::NpConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) : + PxConstraint(PxConcreteType::eCONSTRAINT, PxBaseFlag::eOWNS_MEMORY), + NpBase (NpType::eCONSTRAINT), + mActor0 (actor0), + mActor1 (actor1), + mCore (connector, shaders, dataSize) +{ + scSetFlags(shaders.flag); + + addConnectors(actor0, actor1); + + NpScene* s = ::getSceneFromActors(actor0, actor1); + if (s) + { + if(s->isAPIWriteForbidden()) + { + outputError(__LINE__, "PxConstraint creation not allowed while simulation is running. Call will be ignored."); + return; + } + + s->addToConstraintList(*this); + } +} + +NpConstraint::~NpConstraint() +{ + if(getBaseFlags()&PxBaseFlag::eOWNS_MEMORY) + mCore.getPxConnector()->onConstraintRelease(); + + NpFactory::getInstance().onConstraintRelease(this); +} + +static const char* gRemoveConnectorMsg = "PxConstraint::release(): internal error, mConnectorArray not created."; + +void NpConstraint::release() +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::release() not allowed while simulation is running. Call will be ignored.") + + NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, NULL); + + removeConnectors(gRemoveConnectorMsg, gRemoveConnectorMsg); + + if(npScene) + npScene->removeFromConstraintList(*this); + + NpDestroyConstraint(this); +} + +// PX_SERIALIZATION +void NpConstraint::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mActor0); + context.translatePxBase(mActor1); +} + +NpConstraint* NpConstraint::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpConstraint* obj = PX_PLACEMENT_NEW(address, NpConstraint(PxBaseFlags(0))); + address += sizeof(NpConstraint); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +// ~PX_SERIALIZATION + +PxScene* NpConstraint::getScene() const +{ + return getNpScene(); +} + +void NpConstraint::getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const +{ + NP_READ_CHECK(getNpScene()); + actor0 = mActor0; + actor1 = mActor1; +} + +static PX_INLINE void scSetBodies(ConstraintCore& core, NpActor* r0, NpActor* r1) +{ + Sc::RigidCore* scR0 = r0 ? &r0->getScRigidCore() : NULL; + Sc::RigidCore* scR1 = r1 ? &r1->getScRigidCore() : NULL; + core.setBodies(scR0, scR1); +} + +void NpConstraint::setActors(PxRigidActor* actor0, PxRigidActor* actor1) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN((actor0 && actor0->getConcreteType()!=PxConcreteType::eRIGID_STATIC) || (actor1 && actor1->getConcreteType()!=PxConcreteType::eRIGID_STATIC), "PxConstraint: at least one actor must be non-static"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::setActors() not allowed while simulation is running. Call will be ignored.") + + if(mActor0 == actor0 && mActor1 == actor1) + return; + + removeConnectors( "PxConstraint: Add to rigid actor 0: Constraint already added", + "PxConstraint: Add to rigid actor 1: Constraint already added"); + + addConnectors(actor0, actor1); + + mActor0 = actor0; + mActor1 = actor1; + + NpScene* newScene = ::getSceneFromActors(actor0, actor1); + NpScene* oldScene = getNpScene(); + + // PT: bypassing the calls to removeFromConstraintList / addToConstraintList creates issues like PX-2363, where + // various internal structures are not properly updated. Always going through the slower codepath fixes them. +// if(oldScene != newScene) + { + if(oldScene) + oldScene->removeFromConstraintList(*this); + + scSetBodies(mCore, getNpActor(actor0), getNpActor(actor1)); + + if(newScene) + newScene->addToConstraintList(*this); + } +// else +// scSetBodies(mCore, getNpActor(actor0), getNpActor(actor1)); + + UPDATE_PVD_PROPERTY +} + +PxConstraintFlags NpConstraint::getFlags() const +{ + NP_READ_CHECK(getNpScene()); + + return scGetFlags(mCore); +} + +void NpConstraint::setFlags(PxConstraintFlags flags) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(!(flags & PxConstraintFlag::eBROKEN), "PxConstraintFlag::eBROKEN is a read only flag"); + PX_CHECK_AND_RETURN(!(flags & PxConstraintFlag::eGPU_COMPATIBLE), "PxConstraintFlag::eGPU_COMPATIBLE is an internal flag and is illegal to set via the API"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::setFlags() not allowed while simulation is running. Call will be ignored.") + + scSetFlags(flags); +} + +void NpConstraint::setFlag(PxConstraintFlag::Enum flag, bool value) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(flag != PxConstraintFlag::eBROKEN, "PxConstraintFlag::eBROKEN is a read only flag"); + PX_CHECK_AND_RETURN(flag != PxConstraintFlag::eGPU_COMPATIBLE, "PxConstraintFlag::eGPU_COMPATIBLE is an internal flag and is illegal to set via the API"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::setFlag() not allowed while simulation is running. Call will be ignored.") + + const PxConstraintFlags f = scGetFlags(mCore); + scSetFlags(value ? f|flag : f&~flag); +} + +void NpConstraint::getForce(PxVec3& linear, PxVec3& angular) const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE(getNpScene(), "PxConstraint::getForce() not allowed while simulation is running (except during PxScene::collide())."); + + mCore.getForce(linear, angular); +} + +void NpConstraint::markDirty() +{ +#ifdef NEW_DIRTY_SHADERS_CODE + if(mCore.getFlags() & PxConstraintFlag::eALWAYS_UPDATE) + return; + + if(!mCore.isDirty()) + { + NpScene* npScene = getNpScene(); + if(npScene) + npScene->addDirtyConstraint(this); + mCore.setDirty(); + } +#else + mCore.setDirty(); +#endif +} + +void NpConstraint::updateConstants(PxsSimulationController& simController) +{ + if(!mCore.isDirty() && !(mCore.getFlags() & PxConstraintFlag::eALWAYS_UPDATE)) + return; + + PX_ASSERT(!isAPIWriteForbidden()); + + Sc::ConstraintSim* sim = mCore.getSim(); + if(sim) + { + Dy::Constraint& LLC = sim->getLowLevelConstraint(); + PxMemCopy(LLC.constantBlock, mCore.getPxConnector()->prepareData(), LLC.constantBlockSize); + simController.updateJoint(sim->getInteraction()->getEdgeIndex(), &LLC); + } + + mCore.clearDirty(); + +#if PX_SUPPORT_PVD + NpScene* npScene = getNpScene(); + //Changed to use the visual scenes update system which respects + //the debugger's connection type flag. + if(npScene) + npScene->getScenePvdClientInternal().updatePvdProperties(this); +#endif +} + +void NpConstraint::setBreakForce(PxReal linear, PxReal angular) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::setBreakForce() not allowed while simulation is running. Call will be ignored.") + + mCore.setBreakForce(linear, angular); + markDirty(); + UPDATE_PVD_PROPERTY +} + +void NpConstraint::getBreakForce(PxReal& linear, PxReal& angular) const +{ + NP_READ_CHECK(getNpScene()); + mCore.getBreakForce(linear, angular); +} + +void NpConstraint::setMinResponseThreshold(PxReal threshold) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(threshold) && threshold>=0, "PxConstraint::setMinResponseThreshold: threshold must be non-negative"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxConstraint::setMinResponseThreshold() not allowed while simulation is running. Call will be ignored.") + + mCore.setMinResponseThreshold(threshold); + UPDATE_PVD_PROPERTY +} + +PxReal NpConstraint::getMinResponseThreshold() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getMinResponseThreshold(); +} + +bool NpConstraint::isValid() const +{ + NP_READ_CHECK(getNpScene()); + const bool isValid0 = mActor0 && mActor0->getConcreteType()!=PxConcreteType::eRIGID_STATIC; + const bool isValid1 = mActor1 && mActor1->getConcreteType()!=PxConcreteType::eRIGID_STATIC; + return isValid0 || isValid1; +} + +void* NpConstraint::getExternalReference(PxU32& typeID) +{ + NP_READ_CHECK(getNpScene()); + return mCore.getPxConnector()->getExternalReference(typeID); +} + +void NpConstraint::comShift(PxRigidActor* actor) +{ + PX_ASSERT(actor == mActor0 || actor == mActor1); + PxConstraintConnector* connector = mCore.getPxConnector(); + if(actor == mActor0) + connector->onComShift(0); + if(actor == mActor1) + connector->onComShift(1); +} + +void NpConstraint::actorDeleted(PxRigidActor* actor) +{ + // the actor cannot be deleted without also removing it from the scene, + // which means that the joint will also have been removed from the scene, + // so we can just reset the actor here. + PX_ASSERT(actor == mActor0 || actor == mActor1); + + if(actor == mActor0) + mActor0 = NULL; + else + mActor1 = NULL; +} + +NpScene* NpConstraint::getSceneFromActors() const +{ + return ::getSceneFromActors(mActor0, mActor1); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.h new file mode 100644 index 0000000..1a92c88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpConstraint.h @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_CONSTRAINT_H +#define NP_CONSTRAINT_H + +#include "foundation/PxUserAllocated.h" +#include "PxConstraint.h" +#include "NpBase.h" +#include "../../../simulationcontroller/include/ScConstraintCore.h" +#include "NpActor.h" + +namespace physx +{ +class NpScene; + +class NpConstraint : public PxConstraint, public NpBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpConstraint(PxBaseFlags baseFlags) : PxConstraint(baseFlags), NpBase(PxEmpty), mCore(PxEmpty) {} + static NpConstraint* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + void preExportDataReset() {} + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + void resolveReferences(PxDeserializationContext& context); + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + virtual bool isSubordinate() const { return true; } +//~PX_SERIALIZATION + NpConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize); + virtual ~NpConstraint(); + // PxConstraint + virtual void release() PX_OVERRIDE; + virtual PxScene* getScene() const PX_OVERRIDE; + virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const PX_OVERRIDE; + virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) PX_OVERRIDE; + virtual void markDirty() PX_OVERRIDE; + virtual PxConstraintFlags getFlags() const PX_OVERRIDE; + virtual void setFlags(PxConstraintFlags flags) PX_OVERRIDE; + virtual void setFlag(PxConstraintFlag::Enum flag, bool value) PX_OVERRIDE; + virtual void getForce(PxVec3& linear, PxVec3& angular) const PX_OVERRIDE; + virtual bool isValid() const PX_OVERRIDE; + virtual void setBreakForce(PxReal linear, PxReal angular) PX_OVERRIDE; + virtual void getBreakForce(PxReal& linear, PxReal& angular) const PX_OVERRIDE; + virtual void setMinResponseThreshold(PxReal threshold) PX_OVERRIDE; + virtual PxReal getMinResponseThreshold() const PX_OVERRIDE; + virtual void* getExternalReference(PxU32& typeID) PX_OVERRIDE; + virtual void setConstraintFunctions(PxConstraintConnector& n, const PxConstraintShaderTable& t) PX_OVERRIDE; + //~PxConstraint + + void updateConstants(PxsSimulationController& simController); + void comShift(PxRigidActor*); + void actorDeleted(PxRigidActor*); + + NpScene* getSceneFromActors() const; + + PX_FORCE_INLINE Sc::ConstraintCore& getCore() { return mCore; } + PX_FORCE_INLINE const Sc::ConstraintCore& getCore() const { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpConstraint, mCore); } + + PX_FORCE_INLINE bool isDirty() const { return mCore.isDirty(); } + PX_FORCE_INLINE void markClean() { mCore.clearDirty(); } +private: + PxRigidActor* mActor0; + PxRigidActor* mActor1; + Sc::ConstraintCore mCore; + + void addConnectors(PxRigidActor* actor0, PxRigidActor* actor1); + void removeConnectors(const char* errorMsg0, const char* errorMsg1); + + PX_INLINE void scSetFlags(PxConstraintFlags f) + { + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setFlags(f); + markDirty(); + UPDATE_PVD_PROPERTY + } +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp new file mode 100644 index 0000000..35c0f51 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.cpp @@ -0,0 +1,1032 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpDebugViz.h" + +// PT: moving "all" debug viz code to the same file to improve cache locality when debug drawing things, +// share more code, and make sure all actors do thing consistently. + +#include "NpScene.h" +#include "NpCheck.h" +#include "common/PxProfileZone.h" + +using namespace physx; + +#if PX_ENABLE_DEBUG_VISUALIZATION + +#include "NpShapeManager.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationReducedCoordinate.h" +#if PX_SUPPORT_GPU_PHYSX + #include "NpSoftBody.h" + #include "NpParticleSystem.h" + #include "NpHairSystem.h" +#endif +#include "foundation/PxVecMath.h" +#include "geometry/PxMeshQuery.h" +#include "GuHeightFieldUtil.h" +#include "GuConvexEdgeFlags.h" +#include "GuMidphaseInterface.h" +#include "GuEdgeList.h" +#include "GuBounds.h" +#include "BpBroadPhase.h" +#include "BpAABBManager.h" + +using namespace physx::aos; +using namespace Gu; +using namespace Cm; + +///// + +static const PxU32 gCollisionShapeColor = PxU32(PxDebugColor::eARGB_MAGENTA); + +static PX_FORCE_INLINE Vec4V multiply3x3V(const Vec4V p, const PxMat34& mat) +{ + Vec4V ResV = V4Scale(V4LoadU(&mat.m.column0.x), V4GetX(p)); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.m.column1.x), V4GetY(p))); + ResV = V4Add(ResV, V4Scale(V4LoadU(&mat.m.column2.x), V4GetZ(p))); + return ResV; +} + +// PT: beware, needs padding at the end of dst/src +static PX_FORCE_INLINE void transformV(PxVec3* dst, const PxVec3* src, const Vec4V p, const PxMat34& mat) +{ + const Vec4V vertexV = V4LoadU(&src->x); + const Vec4V transformedV = V4Add(multiply3x3V(vertexV, mat), p); + V4StoreU(transformedV, &dst->x); +} + +static void visualizeSphere(const PxSphereGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose) +{ + out << gCollisionShapeColor; // PT: no need to output this for each segment! + + out << absPose; + renderOutputDebugCircle(out, 100, geometry.radius); + + PxMat44 rotPose(absPose); + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + out << rotPose; + renderOutputDebugCircle(out, 100, geometry.radius); + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + out << rotPose; + renderOutputDebugCircle(out, 100, geometry.radius); +} + +static void visualizePlane(const PxPlaneGeometry& /*geometry*/, PxRenderOutput& out, const PxTransform& absPose) +{ + PxMat44 rotPose(absPose); + PxSwap(rotPose.column1, rotPose.column2); + rotPose.column1 = -rotPose.column1; + + PxSwap(rotPose.column0, rotPose.column2); + rotPose.column0 = -rotPose.column0; + + out << rotPose << gCollisionShapeColor; // PT: no need to output this for each segment! + for(PxReal radius = 2.0f; radius < 20.0f ; radius += 2.0f) + renderOutputDebugCircle(out, 100, radius*radius); +} + +static void visualizeCapsule(const PxCapsuleGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose) +{ + out << gCollisionShapeColor; + out.outputCapsule(geometry.radius, geometry.halfHeight, absPose); +} + +static void visualizeBox(const PxBoxGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose) +{ + out << gCollisionShapeColor; + out << absPose; + renderOutputDebugBox(out, PxBounds3(-geometry.halfExtents, geometry.halfExtents)); +} + +static void visualizeConvexMesh(const PxConvexMeshGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose) +{ + const ConvexMesh* convexMesh = static_cast(geometry.convexMesh); + const ConvexHullData& hullData = convexMesh->getHull(); + + const PxVec3* vertices = hullData.getHullVertices(); + const PxU8* indexBuffer = hullData.getVertexData8(); + const PxU32 nbPolygons = convexMesh->getNbPolygonsFast(); + + const PxMat33Padded m33(absPose.q); + + const PxMat44 m44(m33 * toMat33(geometry.scale), absPose.p); + + out << m44 << gCollisionShapeColor; // PT: no need to output this for each segment! + + for(PxU32 i=0; ipos0 = center; + segments->pos1 = center + normal * fscale; + segments->color0 = segments->color1 = PxU32(PxDebugColor::eARGB_DARKRED); + segments++; + } +} + +static PxU32 MakeSolidColor(PxU32 alpha, PxU32 red, PxU32 green, PxU32 blue) +{ + return (alpha<<24) | (red << 16) | + (green << 8) | blue; +} + +static void decodeTriple(PxU32 id, PxU32& x, PxU32& y, PxU32& z) +{ + x = id & 0x000003FF; + id = id >> 10; + y = id & 0x000003FF; + id = id >> 10; + z = id & 0x000003FF; +} + +PX_FORCE_INLINE PxU32 idx(PxU32 x, PxU32 y, PxU32 z, PxU32 width, PxU32 height) +{ + return z * (width) * (height) + y * width + x; +} + +PX_FORCE_INLINE PxReal decode(PxU8* data, PxU32 bytesPerSparsePixel, PxReal subgridsMinSdfValue, PxReal subgridsMaxSdfValue) +{ + switch (bytesPerSparsePixel) + { + case 1: + return PxReal(data[0]) * (1.0f / 255.0f) * (subgridsMaxSdfValue - subgridsMinSdfValue) + subgridsMinSdfValue; + case 2: + { + PxU16* ptr = reinterpret_cast(data); + return PxReal(ptr[0]) * (1.0f / 65535.0f) * (subgridsMaxSdfValue - subgridsMinSdfValue) + subgridsMinSdfValue; + } + case 4: + //If 4 bytes per subgrid pixel are available, then normal floats are used. No need to + //de-normalize integer values since the floats already contain real distance values + PxReal* ptr = reinterpret_cast(data); + return ptr[0]; + } + return 0; +} + +PX_FORCE_INLINE PxU32 makeColor(PxReal v, PxReal invRange0, PxReal invRange1) +{ + PxVec3 midColor(0.f, 0, 255.f); + PxVec3 lowColor(255.f, 0, 0); + PxVec3 outColor(0, 255.f, 0.f); + + PxU32 color; + if (v > 0.f) + { + PxReal scale = PxPow(v * invRange0, 0.25f); + + PxVec3 blendColor = midColor + (outColor - midColor) * scale; + + color = MakeSolidColor( + 0xff000000, + PxU32(blendColor.x), + PxU32(blendColor.y), + PxU32(blendColor.z) + ); + } + else + { + PxReal scale = PxPow(v * invRange1, 0.25f); + + PxVec3 blendColor = midColor + (lowColor - midColor) * scale; + + color = MakeSolidColor( + 0xff000000, + PxU32(blendColor.x), + PxU32(blendColor.y), + PxU32(blendColor.z) + ); + } + return color; +} + +//Returns true if the number of samples chosen to visualize was reduced (to speed up rendering) compared to the total number of sdf samples available +static bool visualizeSDF(PxRenderOutput& out, const Gu::SDF& sdf, const PxMat34& absPose, bool limitNumberOfVisualizedSamples = false) +{ + bool dataReductionActive = false; + + PxU32 subgridSize; + PxReal sdfSpacing; + PxU32 NbTargetSamples = limitNumberOfVisualizedSamples ? 128 : 4096; + PxU32 nbX, nbY, nbZ; + PxU32 subgridStride = 1; + if (sdf.mSubgridSize == 0) + { + subgridSize = 1; + sdfSpacing = sdf.mSpacing; + nbX = sdf.mDims.x; + nbY = sdf.mDims.y; + nbZ = sdf.mDims.z; + } + else + { + subgridSize = sdf.mSubgridSize; + sdfSpacing = subgridSize * sdf.mSpacing; + nbX = sdf.mDims.x / subgridSize + 1; + nbY = sdf.mDims.y / subgridSize + 1; + nbZ = sdf.mDims.z / subgridSize + 1; + //Limit the max number of visualized sparse grid samples + if (limitNumberOfVisualizedSamples && subgridSize > 4) + { + subgridStride = (subgridSize + 3) / 4; + dataReductionActive = true; + } + } + + //KS - a bit arbitrary, but let's limit how many points we churn out + + const PxU32 strideX = (nbX + NbTargetSamples - 1) / NbTargetSamples; + const PxU32 strideY = (nbY + NbTargetSamples - 1) / NbTargetSamples; + const PxU32 strideZ = (nbZ + NbTargetSamples - 1) / NbTargetSamples; + if (strideX != 1 || strideY != 1 || strideZ != 1) + dataReductionActive = true; + + PxReal low = PX_MAX_F32; + PxReal high = -PX_MAX_F32; + + PxU32 count = 0; + + + + for (PxU32 k = 0; k < nbZ; k += strideZ) + for(PxU32 j = 0; j < nbY; j += strideY) + for (PxU32 i = 0; i < nbX; i += strideX) + { + PxReal v = sdf.mSdf[k*nbX*nbY + j*nbX + i]; + count++; + + low = PxMin(low, v); + high = PxMax(high, v); + + if (sdf.mSubgridSize > 0 && k < nbZ - 1 && j < nbY - 1 && i < nbX - 1) + { + PxU32 startId = sdf.mSubgridStartSlots[k*(nbX-1)*(nbY-1) + j * (nbX-1) + i]; + if (startId != 0xFFFFFFFFu) + { + PxU32 xBase, yBase, zBase; + decodeTriple(startId, xBase, yBase, zBase); + + PX_ASSERT(xBase < sdf.mSdfSubgrids3DTexBlockDim.x); + PX_ASSERT(yBase < sdf.mSdfSubgrids3DTexBlockDim.y); + PX_ASSERT(zBase < sdf.mSdfSubgrids3DTexBlockDim.z); + + PxU32 localCount = subgridSize / subgridStride + 1; + count += localCount * localCount * localCount; + } + } + } + + + const PxReal range0 = high; + const PxReal range1 = low; + + const PxReal invRange0 = 1.f / range0; + const PxReal invRange1 = 1.f / range1; + + PxDebugPoint* points = out.reservePoints(count); + + PxVec3 localPos = sdf.mMeshLower; + + PxReal spacingX = sdfSpacing * strideX; + PxReal spacingY = sdfSpacing * strideY; + PxReal spacingZ = sdfSpacing * strideZ; + + for (PxU32 k = 0; k < nbZ; k += strideZ, localPos.z += spacingZ) + { + localPos.y = sdf.mMeshLower.y; + for (PxU32 j = 0; j < nbY; j += strideY, localPos.y += spacingY) + { + localPos.x = sdf.mMeshLower.x; + for (PxU32 i = 0; i < nbX; i += strideX, localPos.x += spacingX) + { + PxU32 color; + if (sdf.mSubgridSize > 0 && k < nbZ - 1 && j < nbY - 1 && i < nbX - 1) + { + PxU32 startId = sdf.mSubgridStartSlots[k * (nbX - 1) * (nbY - 1) + j * (nbX - 1) + i]; + if (startId != 0xFFFFFFFFu) + { + PxU32 xBase, yBase, zBase; + decodeTriple(startId, xBase, yBase, zBase); + xBase *= (subgridSize + 1); + yBase *= (subgridSize + 1); + zBase *= (subgridSize + 1); + + //Visualize the subgrid + for (PxU32 z = 0; z <= subgridSize; z += subgridStride) + { + for (PxU32 y = 0; y <= subgridSize; y += subgridStride) + { + for (PxU32 x = 0; x <= subgridSize; x += subgridStride) + { + PxReal value = decode(&sdf.mSubgridSdf[sdf.mBytesPerSparsePixel * idx(xBase + x, yBase + y, zBase + z, + sdf.mSdfSubgrids3DTexBlockDim.x * (subgridSize + 1), sdf.mSdfSubgrids3DTexBlockDim.y * (subgridSize + 1))], sdf.mBytesPerSparsePixel, sdf.mSubgridsMinSdfValue, sdf.mSubgridsMaxSdfValue); + color = makeColor(value, invRange0, invRange1); + + PxVec3 subgridLocalPos = localPos + sdf.mSpacing * PxVec3(PxReal(x), PxReal(y), PxReal(z)); + + *points = PxDebugPoint(absPose.transform(subgridLocalPos), color); + points++; + } + } + } + } + } + + + PxReal v = sdf.mSdf[k*nbX*nbY + j * nbX + i]; + + color = makeColor(v, invRange0, invRange1); + + *points = PxDebugPoint(absPose.transform(localPos), color); + points++; + } + } + } + return dataReductionActive; +} + +static PX_FORCE_INLINE void outputTriangle(PxDebugLine* segments, const PxVec3& v0, const PxVec3& v1, const PxVec3& v2, PxU32 color) +{ + // PT: TODO: use SIMD + segments[0] = PxDebugLine(v0, v1, color); + segments[1] = PxDebugLine(v1, v2, color); + segments[2] = PxDebugLine(v2, v0, color); +} + +static void visualizeTriangleMesh(const PxTriangleMeshGeometry& geometry, PxRenderOutput& out, const PxTransform& pose, const PxBounds3& cullbox, PxReal fscale, bool visualizeShapes, bool visualizeEdges, bool useCullBox, bool visualizeSDFs) +{ + const TriangleMesh* triangleMesh = static_cast(geometry.triangleMesh); + + const PxMat44 midt(PxIdentity); + + // PT: TODO: why do we compute it that way sometimes? +// const PxMat34 vertex2worldSkew = pose * geometry.scale; + + const PxMat33Padded m33(pose.q); + + const PxMat34 absPose(m33 * toMat33(geometry.scale), pose.p); + + PxU32 nbTriangles = triangleMesh->getNbTrianglesFast(); + const PxU32 nbVertices = triangleMesh->getNbVerticesFast(); + const PxVec3* vertices = triangleMesh->getVerticesFast(); + const void* indices = triangleMesh->getTrianglesFast(); + const bool has16Bit = triangleMesh->has16BitIndices(); + + bool drawSDF = visualizeSDFs && triangleMesh->getSDF(); + + PxU32* results = NULL; + if (!drawSDF) + { + if (useCullBox) + { + const Box worldBox( + (cullbox.maximum + cullbox.minimum)*0.5f, + (cullbox.maximum - cullbox.minimum)*0.5f, + PxMat33(PxIdentity)); + + // PT: TODO: use the callback version here to avoid allocating this huge array + results = PX_ALLOCATE(PxU32, nbTriangles, "tmp triangle indices"); + LimitedResults limitedResults(results, nbTriangles, 0); + Midphase::intersectBoxVsMesh(worldBox, *triangleMesh, pose, geometry.scale, &limitedResults); + nbTriangles = limitedResults.mNbResults; + + if (visualizeShapes) + { + const PxU32 scolor = gCollisionShapeColor; + + out << midt << scolor; // PT: no need to output this for each segment! + + // PT: TODO: don't render the same edge multiple times + PxDebugLine* segments = out.reserveSegments(nbTriangles * 3); + for (PxU32 i = 0; i < nbTriangles; i++) + { + PxVec3 wp[3 + 1]; + getWorldTriangle(results[i], wp, vertices, indices, absPose, has16Bit); + outputTriangle(segments, wp[0], wp[1], wp[2], scolor); + segments += 3; + } + } + } + else + { + if (visualizeShapes) + { + const PxU32 scolor = gCollisionShapeColor; + + out << midt << scolor; // PT: no need to output this for each segment! + + const Vec4V posV = Vec4V_From_Vec3V(V3LoadU(&absPose.p.x)); + + PxVec3* transformed = PX_ALLOCATE(PxVec3, (nbVertices + 1), "PxVec3"); + // for(PxU32 i=0;irequestEdgeList(); + if (edgeList) + { + PxU32 nbEdges = edgeList->getNbEdges(); + PxDebugLine* segments = out.reserveSegments(nbEdges); + + const Gu::EdgeData* edges = edgeList->getEdges(); + while (nbEdges--) + { + segments->pos0 = transformed[edges->Ref0]; + segments->pos1 = transformed[edges->Ref1]; + segments->color0 = segments->color1 = scolor; + segments++; + edges++; + } + } + else + { + PxDebugLine* segments = out.reserveSegments(nbTriangles * 3); + for (PxU32 i = 0; i < nbTriangles; i++) + { + PxVec3 wp[3]; + getTriangle(i, wp, transformed, indices, has16Bit); + outputTriangle(segments, wp[0], wp[1], wp[2], scolor); + segments += 3; + } + } + + PX_FREE(transformed); + } + } + } + + if(fscale!=0.0f) + { + if(geometry.scale.hasNegativeDeterminant()) + fscale = -fscale; + + visualizeFaceNormals(fscale, out, nbTriangles, vertices, indices, has16Bit, results, absPose, midt); + } + + if(visualizeEdges) + visualizeActiveEdges(out, *triangleMesh, nbTriangles, results, absPose); + + if (drawSDF) + { + const Gu::SDF& sdf = triangleMesh->getSdfDataFast(); + //We have an SDF, we should debug render it... + visualizeSDF(out, sdf, absPose); + + } + + PX_FREE(results); +} + +static void visualizeHeightField(const PxHeightFieldGeometry& hfGeometry, PxRenderOutput& out, const PxTransform& absPose, const PxBounds3& cullbox, bool useCullBox) +{ + const HeightField* heightfield = static_cast(hfGeometry.heightField); + + // PT: TODO: the debug viz for HFs is minimal at the moment... + const PxU32 scolor = gCollisionShapeColor; + const PxMat44 midt = PxMat44(PxIdentity); + + HeightFieldUtil hfUtil(hfGeometry); + + const PxU32 nbRows = heightfield->getNbRowsFast(); + const PxU32 nbColumns = heightfield->getNbColumnsFast(); + const PxU32 nbVerts = nbRows * nbColumns; + const PxU32 nbTriangles = 2 * nbVerts; + + out << midt << scolor; // PT: no need to output the same matrix/color for each triangle + + if(useCullBox) + { + const PxTransform pose0((cullbox.maximum + cullbox.minimum)*0.5f); + const PxBoxGeometry boxGeometry((cullbox.maximum - cullbox.minimum)*0.5f); + + PxU32* results = PX_ALLOCATE(PxU32, nbTriangles, "tmp triangle indices"); + + bool overflow = false; + PxU32 nbTouchedTris = PxMeshQuery::findOverlapHeightField(boxGeometry, pose0, hfGeometry, absPose, results, nbTriangles, 0, overflow); + + PxDebugLine* segments = out.reserveSegments(nbTouchedTris*3); + + for(PxU32 i=0; iisValidTriangle(index) && heightfield->getTriangleMaterial(index) != PxHeightFieldMaterial::eHOLE) + { + outputTriangle(segments, currentTriangle.verts[0], currentTriangle.verts[1], currentTriangle.verts[2], scolor); + segments+=3; + } + } + PX_FREE(results); + } + else + { + // PT: transform vertices only once + PxVec3* tmpVerts = PX_ALLOCATE(PxVec3, nbVerts, "PxVec3"); + // PT: TODO: optimize the following line + for(PxU32 i=0;igetVertex(i))); + + for(PxU32 i=0; iisValidTriangle(i) && heightfield->getTriangleMaterial(i) != PxHeightFieldMaterial::eHOLE) + { + PxU32 vi0, vi1, vi2; + heightfield->getTriangleVertexIndices(i, vi0, vi1, vi2); + + PxDebugLine* segments = out.reserveSegments(3); + outputTriangle(segments, tmpVerts[vi0], tmpVerts[vi1], tmpVerts[vi2], scolor); + } + } + PX_FREE(tmpVerts); + } +} + +static void visualize(const PxGeometry& geometry, PxRenderOutput& out, const PxTransform& absPose, const PxBounds3& cullbox, const PxReal fscale, bool visualizeShapes, bool visualizeEdges, bool useCullBox, bool visualizeSDFs) +{ + // triangle meshes can render active edges or face normals, but for other types we can just early out if there are no collision shapes + if(!visualizeShapes && geometry.getType() != PxGeometryType::eTRIANGLEMESH) + return; + + switch(geometry.getType()) + { + case PxGeometryType::eSPHERE: + visualizeSphere(static_cast(geometry), out, absPose); + break; + case PxGeometryType::eBOX: + visualizeBox(static_cast(geometry), out, absPose); + break; + case PxGeometryType::ePLANE: + visualizePlane(static_cast(geometry), out, absPose); + break; + case PxGeometryType::eCAPSULE: + visualizeCapsule(static_cast(geometry), out, absPose); + break; + case PxGeometryType::eCONVEXMESH: + visualizeConvexMesh(static_cast(geometry), out, absPose); + break; + case PxGeometryType::eTRIANGLEMESH: + visualizeTriangleMesh(static_cast(geometry), out, absPose, cullbox, fscale, visualizeShapes, visualizeEdges, useCullBox, visualizeSDFs); + break; + case PxGeometryType::eHEIGHTFIELD: + visualizeHeightField(static_cast(geometry), out, absPose, cullbox, useCullBox); + break; + case PxGeometryType::eTETRAHEDRONMESH: + case PxGeometryType::ePARTICLESYSTEM: + // A.B. missing visualization code + break; + case PxGeometryType::eHAIRSYSTEM: + break; + case PxGeometryType::eCUSTOM: + PX_ASSERT(static_cast(geometry).isValid()); + static_cast(geometry).callbacks->visualize(geometry, out, absPose, cullbox); + break; + case PxGeometryType::eINVALID: + break; + case PxGeometryType::eGEOMETRY_COUNT: + break; + } +} + +void NpShapeManager::visualize(PxRenderOutput& out, NpScene& scene, const PxRigidActor& actor, float scale) const +{ + PX_ASSERT(scale!=0.0f); // Else we shouldn't have been called + + const Sc::Scene& scScene = scene.getScScene(); + + const PxU32 nbShapes = getNbShapes(); + NpShape*const* PX_RESTRICT shapes = getShapes(); + + const bool visualizeCompounds = (nbShapes>1) && scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_COMPOUNDS)!=0.0f; + + // PT: moved all these out of the loop, no need to grab them once per shape + const PxBounds3& cullbox = scScene.getVisualizationCullingBox(); + const bool visualizeAABBs = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_AABBS)!=0.0f; + const bool visualizeShapes = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_SHAPES)!=0.0f; + const bool visualizeEdges = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_EDGES)!=0.0f; + const bool visualizeSDFs = scScene.getVisualizationParameter(PxVisualizationParameter::eSDF)!=0.0f; + const float fNormals = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_FNORMALS); + const bool visualizeFNormals = fNormals!=0.0f; + const bool visualizeCollision = visualizeShapes || visualizeFNormals || visualizeEdges || visualizeSDFs; + const bool useCullBox = !cullbox.isEmpty(); + const bool needsShapeBounds0 = visualizeCompounds || (visualizeCollision && useCullBox); + const PxReal collisionAxes = scale * scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_AXES); + const PxReal fscale = scale * fNormals; + + const PxTransform actorPose = actor.getGlobalPose(); + + PxBounds3 compoundBounds(PxBounds3::empty()); + for(PxU32 i=0;i1.0f ? 1.0f : sleepTime)); + color = mCore.isSleeping() ? 0xff0000 : (color<<16 | color<<8 | color); + PxVec3 dims = invertDiagInertia(mCore.getInverseInertia()); + dims = getDimsFromBodyInertia(dims, 1.0f / mCore.getInverseMass()); + out << color << mCore.getBody2World(); + const PxVec3 extents = dims * 0.5f; + Cm::renderOutputDebugBox(out, PxBounds3(-extents, extents)); + } +} + +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +void NpScene::visualize() +{ + PX_PROFILE_ZONE("NpScene::visualize", getContextId()); + NP_READ_CHECK(this); + + mRenderBuffer.clear(); // clear last frame visualizations + +#if PX_ENABLE_DEBUG_VISUALIZATION + const PxReal scale = mScene.getVisualizationParameter(PxVisualizationParameter::eSCALE); + if(scale == 0.0f) + return; + + PxRenderOutput out(mRenderBuffer); + + // Visualize scene axes + const PxReal worldAxes = scale * mScene.getVisualizationParameter(PxVisualizationParameter::eWORLD_AXES); + if(worldAxes != 0) + Cm::renderOutputDebugBasis(out, PxDebugBasis(PxVec3(worldAxes))); + + // Visualize articulations + const PxU32 articulationCount = mArticulations.size(); + for(PxU32 i=0;i(mArticulations.getEntries()[i])->visualize(out, *this, scale); + + // Visualize rigid actors + const PxU32 rigidDynamicCount = mRigidDynamics.size(); + for(PxU32 i=0; ivisualize(out, *this, scale); + + const PxU32 rigidStaticCount = mRigidStatics.size(); + for(PxU32 i=0; ivisualize(out, *this, scale); + + // Visualize pruning structures + const bool visStatic = mScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_STATIC) != 0.0f; + const bool visDynamic = mScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_DYNAMIC) != 0.0f; + //flushQueryUpdates(); // DE7834 + if(visStatic) + getSQAPI().visualize(PxU32(PX_SCENE_PRUNER_STATIC), out); + if(visDynamic) + getSQAPI().visualize(PxU32(PX_SCENE_PRUNER_DYNAMIC), out); + if(visStatic || visDynamic) + getSQAPI().visualize(PxU32(PX_SCENE_COMPOUND_PRUNER), out); + + if(mScene.getVisualizationParameter(PxVisualizationParameter::eMBP_REGIONS) != 0.0f) + { + out << PxTransform(PxIdentity); + + const Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + + const PxU32 nbRegions = bp->getNbRegions(); + for(PxU32 i=0;igetRegions(&info, 1, i); + + if(info.mActive) + out << PxU32(PxDebugColor::eARGB_YELLOW); + else + out << PxU32(PxDebugColor::eARGB_BLACK); + Cm::renderOutputDebugBox(out, info.mRegion.mBounds); + } + } + + if(mScene.getVisualizationParameter(PxVisualizationParameter::eCULL_BOX)!=0.0f) + { + const PxBounds3& cullbox = mScene.getVisualizationCullingBox(); + if(!cullbox.isEmpty()) + { + out << PxU32(PxDebugColor::eARGB_YELLOW); + Cm::renderOutputDebugBox(out, cullbox); + } + } + +#if PX_SUPPORT_GPU_PHYSX + // Visualize particle systems + { + { + PxPBDParticleSystem*const* particleSystems = mPBDParticleSystems.getEntries(); + const PxU32 particleSystemCount = mPBDParticleSystems.size(); + + for (PxU32 i = 0; i < particleSystemCount; i++) + { + static_cast(particleSystems[i])->visualize(out, *this); + } + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + { + PxFLIPParticleSystem*const* particleSystems = mFLIPParticleSystems.getEntries(); + const PxU32 particleSystemCount = mFLIPParticleSystems.size(); + + for (PxU32 i = 0; i < particleSystemCount; i++) + { + static_cast(particleSystems[i])->visualize(out, *this); + + } + } + + { + PxMPMParticleSystem*const* particleSystems = mMPMParticleSystems.getEntries(); + const PxU32 particleSystemCount = mMPMParticleSystems.size(); + + for (PxU32 i = 0; i < particleSystemCount; i++) + { + static_cast(particleSystems[i])->visualize(out, *this); + } + } + + { + PxCustomParticleSystem*const* particleSystems = mCustomParticleSystems.getEntries(); + const PxU32 particleSystemCount = mCustomParticleSystems.size(); + + for (PxU32 i = 0; i < particleSystemCount; i++) + { + static_cast(particleSystems[i])->visualize(out, *this); + } + } +#endif + } + + // Visualize soft bodies + { + PxSoftBody*const* softBodies = mSoftBodies.getEntries(); + const PxU32 softBodyCount = mSoftBodies.size(); + + const bool visualize = mScene.getVisualizationParameter(PxVisualizationParameter::eSIMULATION_MESH) != 0.0f; + for(PxU32 i=0; isetSoftBodyFlag(PxSoftBodyFlag::eDISPLAY_SIM_MESH, visualize); + } + + // FEM-cloth + // no change + // visualize hair systems + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + const PxHairSystem*const* hairSystems = mHairSystems.getEntries(); + const PxU32 hairSystemCount = mHairSystems.size(); + + for (PxU32 i = 0; i < hairSystemCount; i++) + { + static_cast(hairSystems[i])->visualize(out, *this); + } +#endif + } +#endif + +#if PX_SUPPORT_PVD + mScenePvdClient.visualize(mRenderBuffer); +#endif + +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.h new file mode 100644 index 0000000..c04ea99 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpDebugViz.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_DEBUG_VIZ_H +#define NP_DEBUG_VIZ_H + +#include "common/PxPhysXCommonConfig.h" + +#if PX_ENABLE_DEBUG_VISUALIZATION + +namespace physx +{ + class PxRenderOutput; + class NpScene; + class PxRigidActor; + + namespace Sc + { + class BodyCore; + } + + void visualizeRigidBody(PxRenderOutput& out, NpScene& scene, const PxRigidActor& actor, const Sc::BodyCore& mCore, float scale); +} + +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp new file mode 100644 index 0000000..f2c0cbc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.cpp @@ -0,0 +1,678 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "NpFEMCloth.h" +#include "NpCheck.h" +#include "NpScene.h" +#include "NpShape.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "PxPhysXGpu.h" +#include "PxvGlobals.h" +#include "GuTriangleMesh.h" +#include "NpRigidDynamic.h" +#include "NpRigidStatic.h" +#include "NpArticulationLink.h" + +#include "GuTriangleMesh.h" +#include "ScFEMClothSim.h" + +using namespace physx; + +namespace physx +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpFEMCloth::NpFEMCloth(PxCudaContextManager& cudaContextManager) + : + NpActorTemplate(PxConcreteType::eFEM_CLOTH, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eFEMCLOTH), + mShape(NULL), + mCudaContextManager(&cudaContextManager) + { + } + + NpFEMCloth::NpFEMCloth(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager) : + NpActorTemplate(baseFlags), + mShape(NULL), + mCudaContextManager(&cudaContextManager) + { + } + + PxBounds3 NpFEMCloth::getWorldBounds(float inflation) const + { + NP_READ_CHECK(getNpScene()); + + if (!getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Querying bounds of a PxFEMCloth which is not part of a PxScene is not supported."); + return PxBounds3::empty(); + } + + const Sc::FEMClothSim* sim = mCore.getSim(); + PX_ASSERT(sim); + + PX_SIMD_GUARD; + + const PxBounds3 bounds = sim->getBounds(); + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); + } + + void NpFEMCloth::setFEMClothFlag(PxFEMClothFlag::Enum flag, bool val) + { + PxFEMClothFlags flags = mCore.getFlags(); + if (val) + flags.raise(flag); + else + flags.clear(flag); + + mCore.setFlags(flags); + } + + void NpFEMCloth::setFEMClothFlags(PxFEMClothFlags flags) + { + mCore.setFlags(flags); + } + + PxFEMClothFlags NpFEMCloth::getFEMClothFlag() const + { + return mCore.getFlags(); + } + + void NpFEMCloth::setDrag(const PxReal drag) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setDrag() not allowed while simulation is running. Call will be ignored.") + + mCore.setDrag(drag); + UPDATE_PVD_PROPERTY + } + + PxReal NpFEMCloth::getDrag() const + { + return mCore.getDrag(); + } + + void NpFEMCloth::setLift(const PxReal lift) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setLift() not allowed while simulation is running. Call will be ignored.") + + mCore.setLift(lift); + UPDATE_PVD_PROPERTY + } + + PxReal NpFEMCloth::getLift() const + { + return mCore.getLift(); + } + + void NpFEMCloth::setWind(const PxVec3& wind) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setWind() not allowed while simulation is running. Call will be ignored.") + + mCore.setWind(wind); + UPDATE_PVD_PROPERTY + } + + PxVec3 NpFEMCloth::getWind() const + { + return mCore.getWind(); + } + + void NpFEMCloth::setAirDensity(const PxReal airDensity) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setAirDensity() not allowed while simulation is running. Call will be ignored.") + + mCore.setAirDensity(airDensity); + UPDATE_PVD_PROPERTY + } + + float NpFEMCloth::getAirDensity() const + { + return mCore.getAirDensity(); + } + + void NpFEMCloth::setParameter(const PxFEMParameters& paramters) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setParameter() not allowed while simulation is running. Call will be ignored.") + + mCore.setParameter(paramters); + UPDATE_PVD_PROPERTY + } + + PxFEMParameters NpFEMCloth::getParameter() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getParameter(); + } + + void NpFEMCloth::setRestVolumeScale(const PxReal scale) + { + // todo: pressure should be mutable during simulation. + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setPressure() not allowed while simulation is running. Call will be ignored.") + + mCore.setRestVolumeScale(scale); + UPDATE_PVD_PROPERTY + } + + PxReal NpFEMCloth::getRestVolumeScale() const + { + // todo: is read lock necessary? + NP_READ_CHECK(getNpScene()); + return mCore.getRestVolumeScale(); + } + + void NpFEMCloth::setBendingScales(const PxReal* const bendingScales, PxU32 nbElements) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setBendingScales() not allowed while simulation is running. Call will be ignored.") + + mCore.setBendingScales(bendingScales, nbElements); + UPDATE_PVD_PROPERTY + } + + const PxReal* NpFEMCloth::getBendingScales() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getBendingScales(); + } + + PxU32 NpFEMCloth::getNbBendingScales() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getNbBendingScales(); + } + + void NpFEMCloth::setMaxVelocity(const PxReal v) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setMaxVelocity() not allowed while simulation is running. Call will be ignored.") + + mCore.setMaxVelocity(v); + UPDATE_PVD_PROPERTY + } + + PxReal NpFEMCloth::getMaxVelocity() const + { + return mCore.getMaxVelocity(); + } + + void NpFEMCloth::setBendingActivationAngle(const PxReal angle) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setBendingActivationAngle() not allowed while simulation is running. Call will be ignored.") + + mCore.setBendingActivationAngle(angle); + UPDATE_PVD_PROPERTY + } + + PxReal NpFEMCloth::getBendingActivationAngle() const + { + return mCore.getBendingActivationAngle(); + } + + void NpFEMCloth::setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setNbCollisionPairUpdatesPerTimestep() not allowed while simulation is running. Call will be ignored.") + + mCore.setNbCollisionPairUpdatesPerTimestep(frequency); + UPDATE_PVD_PROPERTY + } + + PxU32 NpFEMCloth::getNbCollisionPairUpdatesPerTimestep() const + { + return mCore.getNbCollisionPairUpdatesPerTimestep(); + } + + void NpFEMCloth::setNbCollisionSubsteps(const PxU32 frequency) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setNbCollisionSubsteps() not allowed while simulation is running. Call will be ignored.") + + mCore.setNbCollisionSubsteps(frequency); + UPDATE_PVD_PROPERTY + } + + PxU32 NpFEMCloth::getNbCollisionSubsteps() const + { + return mCore.getNbCollisionSubsteps(); + } + + PxBuffer* NpFEMCloth::getBufferFromFlag(PxFEMClothData::Enum flags) + { + PxBuffer* buf = NULL; + Dy::FEMClothCore& core = mCore.getCore(); + PX_UNUSED(core); + switch (flags) + { + case PxFEMClothData::ePOSITION_INVMASS: + buf = core.mClothPositionInvMass; + break; + case PxFEMClothData::eVELOCITY: + buf = core.mClothVelocity; + break; + case PxFEMClothData::eREST_POSITION: + buf = core.mClothRestPosition; + break; + case PxFEMClothData::eNONE: + case PxFEMClothData::eALL: + default: + PX_ASSERT(0); + } + return buf; + } + + + + void NpFEMCloth::readData(PxFEMClothData::Enum flags, PxBuffer& buffer) + { + PxBuffer* targetBuffer = getBufferFromFlag(flags); + if (!targetBuffer) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxFEMCloth::readData, source buffer hasn't been allocated."); + return; + } + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + physxGpu->addCopyCommand(buffer, *targetBuffer, false); + } + + + void NpFEMCloth::writeData(PxFEMClothData::Enum flags, PxBuffer& buffer, bool flush) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::writeData() not allowed while simulation is running. Call will be ignored.") + + PxBuffer* targetBuffer = getBufferFromFlag(flags); + if (!targetBuffer) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "NpFEMCloth::writeData, target buffer hasn't been allocated."); + return; + } + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + physxGpu->addCopyCommand(*targetBuffer, buffer, flush); + } + + PxCudaContextManager* NpFEMCloth::getCudaContextManager() const + { + return mCudaContextManager; + } + + void NpFEMCloth::setCudaContextManager(PxCudaContextManager* cudaContextManager) + { + mCudaContextManager = cudaContextManager; + } + + void NpFEMCloth::setSolverIterationCounts(PxU32 positionIters) // maybe use PxU16? + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(positionIters > 0, "NpFEMCloth::setSolverIterationCounts: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(positionIters <= 255, "NpFEMCloth::setSolverIterationCounts: positionIters must be no greater than 255!"); + //PX_CHECK_AND_RETURN(velocityIters > 0, "NpFEMCloth::setSolverIterationCounts: velocityIters must be more than zero!"); + //PX_CHECK_AND_RETURN(velocityIters <= 255, "NpFEMCloth::setSolverIterationCounts: velocityIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxFEMCloth::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.") + + //mCore.setSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff)); + mCore.setSolverIterationCounts(positionIters & 0xff); + } + + void NpFEMCloth::getSolverIterationCounts(PxU32& positionIters) const + { + NP_READ_CHECK(getNpScene()); + + PxU16 x = mCore.getSolverIterationCounts(); + //velocityIters = PxU32(x >> 8); + positionIters = PxU32(x & 0xff); + } + + PxShape* NpFEMCloth::getShape() + { + return mShape; + } + + bool NpFEMCloth::attachShape(PxShape& shape) + { + NpShape* npShape = static_cast(&shape); + + PX_CHECK_AND_RETURN_NULL(npShape->getGeometryTypeFast() == PxGeometryType::eTRIANGLEMESH, "NpFEMCloth::attachShape: Geometry type must be triangle mesh geometry"); + PX_CHECK_AND_RETURN_NULL(mShape == NULL, "NpFEMCloth::attachShape: FEM-cloth can just have one shape"); + PX_CHECK_AND_RETURN_NULL(shape.isExclusive(), "NpFEMCloth::attachShape: shape must be exclusive"); +#if PX_CHECK + PxTriangleMeshGeometry geom; + npShape->getTriangleMeshGeometry(geom); + Gu::TriangleMesh* guMesh = static_cast(geom.triangleMesh); + const PxU32 triangleReference = guMesh->getNbTriangleReferences(); + PX_CHECK_AND_RETURN_NULL(triangleReference > 0, "NpFEMCloth::attachShape: cloth triangle mesh has cooked with eENABLE_VERT_MAPPING"); +#endif + + mShape = npShape; + + PX_ASSERT(shape.getActor() == NULL); + npShape->onActorAttach(*this); + + updateMaterials(); + + return true; + } + + void NpFEMCloth::setClothCore(const PxVec4* const positionInvMasses, const PxVec4* const velocityInvMasses) + { + PX_UNUSED(positionInvMasses); + PX_UNUSED(velocityInvMasses); + + const PxTriangleMeshGeometry& triangleGeometry = static_cast(mShape->getGeometry()); + Gu::TriangleMesh* triangleMesh = static_cast(triangleGeometry.triangleMesh); + const PxU32 numVerts = triangleMesh->getNbVerticesFast(); + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + + Dy::FEMClothCore& core = mCore.getCore(); + + core.mClothPositionInvMass = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + core.mClothVelocity = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + core.mClothRestPosition = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + } + + void NpFEMCloth::addRigidFilter(PxRigidActor* actor, PxU32 vertId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addRigidFilter: Cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + return mCore.addRigidFilter(core, vertId); + } + + void NpFEMCloth::removeRigidFilter(PxRigidActor* actor, PxU32 vertId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeRigidFilter: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::removeRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + mCore.removeRigidFilter(core, vertId); + } + + PxU32 NpFEMCloth::addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* params) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addRigidAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + Sc::BodyCore* core = getBodyCore(actor); + + PxVec3 aPose = actorSpacePose; + if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* stat = static_cast(actor); + aPose = stat->getGlobalPose().transform(aPose); + } + + return mCore.addRigidAttachment(core, vertId, aPose, params); + } + + void NpFEMCloth::removeRigidAttachment(PxRigidActor* actor, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeRigidAttachment: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::removeRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeRigidAttachment: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + mCore.removeRigidAttachment(core, handle); + } + + void NpFEMCloth::addTriRigidFilter(PxRigidActor* actor, PxU32 triangleIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addTriRigidFilter: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addTriRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addTriRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + return mCore.addTriRigidFilter(core, triangleIdx); + } + + void NpFEMCloth::removeTriRigidFilter(PxRigidActor* actor, PxU32 triangleId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseTriRigidAttachment: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::releaseTriRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseTriRigidAttachment: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + mCore.removeTriRigidFilter(core, triangleId); + } + + PxU32 NpFEMCloth::addTriRigidAttachment(PxRigidActor* actor, PxU32 triangleIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addTriRigidAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::addTriRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addTriRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + Sc::BodyCore* core = getBodyCore(actor); + + PxVec3 aPose = actorSpacePose; + if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* stat = static_cast(actor); + aPose = stat->getGlobalPose().transform(aPose); + } + + return mCore.addTriRigidAttachment(core, triangleIdx, barycentric, aPose, constraint); + } + + void NpFEMCloth::removeTriRigidAttachment(PxRigidActor* actor, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseTriRigidAttachment: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpFEMCloth::releaseTriRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseTriRigidAttachment: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + + mCore.removeTriRigidAttachment(core, handle); + } + + void NpFEMCloth::addClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::addClothAttachment: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN((otherCloth == NULL || otherCloth->getScene() != NULL), "NpFEMCloth::addClothFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::addClothFilter: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(otherCloth); + Sc::FEMClothCore* otherCore = &dyn->getCore(); + + return mCore.addClothFilter(otherCore, otherTriIdx, triIdx); + } + + void NpFEMCloth::removeClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(otherCloth != NULL, "NpFEMCloth::removeClothFilter: actor must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::removeClothFilter: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN(otherCloth->getScene() != NULL, "NpFEMCloth::removeClothFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::removeClothFilter: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(otherCloth); + Sc::FEMClothCore* otherCore = &dyn->getCore(); + + mCore.removeClothFilter(otherCore, otherTriIdx, triIdx); + } + + PxU32 NpFEMCloth::addClothAttachment(PxFEMCloth* otherCloth, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx, const PxVec4& triBarycentric) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpFEMCloth::addClothAttachment: cloth must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((otherCloth == NULL || otherCloth->getScene() != NULL), "NpFEMCloth::addClothAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpFEMCloth::addClothAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + NpFEMCloth* dyn = static_cast(otherCloth); + Sc::FEMClothCore* otherCore = &dyn->getCore(); + + return mCore.addClothAttachment(otherCore, otherTriIdx, otherTriBarycentric, triIdx, triBarycentric); + } + + void NpFEMCloth::removeClothAttachment(PxFEMCloth* otherCloth, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(otherCloth != NULL, "NpFEMCloth::releaseClothAttachment: actor must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFEMCloth::releaseClothAttachment: cloth must be inserted into the scene."); + PX_CHECK_AND_RETURN(otherCloth->getScene() != NULL, "NpFEMCloth::releaseClothAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpFEMCloth::releaseClothAttachment: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(otherCloth); + Sc::FEMClothCore* otherCore = &dyn->getCore(); + + mCore.removeClothAttachment(otherCore, handle); + } + + void NpFEMCloth::detachShape() + { + if (mShape) + mShape->onActorDetach(); + mShape = NULL; + } + + void NpFEMCloth::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + if (npScene) + { + npScene->scRemoveFEMCloth(*this); + npScene->removeFromFEMClothList(*this); + } + + detachShape(); + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyFEMCloth(this); + } + + void NpFEMCloth::setName(const char* debugName) + { + NP_WRITE_CHECK(getNpScene()); + mName = debugName; + } + + const char* NpFEMCloth::getName() const + { + NP_READ_CHECK(getNpScene()); + return mName; + } + + bool NpFEMCloth::isSleeping() const + { + Sc::FEMClothSim* sim = mCore.getSim(); + if (sim) + { + return sim->isSleeping(); + } + return true; + } + + void NpFEMCloth::updateMaterials() + { + Dy::FEMClothCore& core = mCore.getCore(); + core.clearMaterials(); + for (PxU32 i = 0; i < mShape->getNbMaterials(); ++i) + { + PxFEMClothMaterial* material; + mShape->getClothMaterials(&material, 1, i); + core.setMaterial(static_cast(material)->mMaterial.mMaterialIndex); + } + } +#endif +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.h new file mode 100644 index 0000000..120b11d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMCloth.h @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSICS_NP_FEMCLOTH +#define PX_PHYSICS_NP_FEMCLOTH + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFEMCloth.h" +#endif +#include "ScFEMClothCore.h" +#include "NpActorTemplate.h" + +namespace physx +{ + class NpShape; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + class NpFEMCloth : public NpActorTemplate + { + public: + NpFEMCloth(PxCudaContextManager& cudaContextManager); + NpFEMCloth(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager); + + virtual ~NpFEMCloth() {} + + void exportData(PxSerializationContext& /*context*/) const {} + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::eFEMCLOTH; } + + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const; + + virtual void setFEMClothFlag(PxFEMClothFlag::Enum flag, bool val); + virtual void setFEMClothFlags(PxFEMClothFlags flags); + virtual PxFEMClothFlags getFEMClothFlag() const; + + virtual void setDrag(const PxReal drag); + virtual PxReal getDrag() const; + + virtual void setLift(const PxReal lift); + virtual PxReal getLift() const; + + virtual void setWind(const PxVec3& wind); + virtual PxVec3 getWind() const; + + virtual void setAirDensity(const PxReal wind); + virtual PxReal getAirDensity() const; + + virtual void setParameter(const PxFEMParameters& paramters); + virtual PxFEMParameters getParameter() const; + + virtual void setRestVolumeScale(const PxReal scale); + virtual PxReal getRestVolumeScale() const; + + virtual void setBendingScales(const PxReal* const bendingScale, PxU32 nbElements); + virtual const PxReal* getBendingScales() const; + virtual PxU32 getNbBendingScales() const; + + virtual void setMaxVelocity(const PxReal v); + virtual PxReal getMaxVelocity() const; + + virtual void setBendingActivationAngle(const PxReal angle); + virtual PxReal getBendingActivationAngle() const; + + virtual void setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency); + virtual PxU32 getNbCollisionPairUpdatesPerTimestep() const; + + virtual void setNbCollisionSubsteps(const PxU32 frequency); + virtual PxU32 getNbCollisionSubsteps() const; + + virtual void addRigidFilter(PxRigidActor* actor, PxU32 vertId); + virtual void removeRigidFilter(PxRigidActor* actor, PxU32 vertId); + + virtual PxU32 addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* params); + virtual void removeRigidAttachment(PxRigidActor* actor, PxU32 handle); + + virtual void addTriRigidFilter(PxRigidActor* actor, PxU32 triangleId); + virtual void removeTriRigidFilter(PxRigidActor* actor, PxU32 triangleId); + + virtual PxU32 addTriRigidAttachment(PxRigidActor* actor, PxU32 triangleId, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + virtual void removeTriRigidAttachment(PxRigidActor* actor, PxU32 handle); + + virtual void addClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx); + virtual void removeClothFilter(PxFEMCloth* otherCloth, PxU32 otherTriIdx, PxU32 triIdx); + + virtual PxU32 addClothAttachment(PxFEMCloth* otherCloth, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx, const PxVec4& triBarycentric); + virtual void removeClothAttachment(PxFEMCloth* otherCloth, PxU32 handle); + + virtual void readData(PxFEMClothData::Enum flags, PxBuffer& buffer); + + virtual void writeData(PxFEMClothData::Enum flags, PxBuffer& buffer, bool flush); + + virtual PxCudaContextManager* getCudaContextManager() const; + virtual void setCudaContextManager(PxCudaContextManager*); + + virtual void setSolverIterationCounts(PxU32 minPositionIters); + + virtual void getSolverIterationCounts(PxU32& minPositionIters) const; + + virtual PxShape* getShape(); + + virtual bool attachShape(PxShape& shape); + + virtual void setClothCore(const PxVec4* const positionInvMass, const PxVec4* const velocityInvMass); + + virtual void detachShape(); + + virtual void release(); + + PX_FORCE_INLINE const Sc::FEMClothCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::FEMClothCore& getCore() { return mCore; } + + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpFEMCloth, mCore); } + + virtual bool isSleeping() const; + + + // Debug name + void setName(const char*); + const char* getName() const; + + + void updateMaterials(); + + private: + + PxBuffer* getBufferFromFlag(PxFEMClothData::Enum flags); + + NpShape* mShape; + Sc::FEMClothCore mCore; + PxCudaContextManager* mCudaContextManager; + }; +#endif +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp new file mode 100644 index 0000000..1cabf58 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.cpp @@ -0,0 +1,204 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpFEMClothMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +using namespace physx; +using namespace Cm; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + +NpFEMClothMaterial::NpFEMClothMaterial(const PxsFEMClothMaterialCore& desc) : + PxFEMClothMaterial(PxConcreteType::eCLOTH_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpFEMClothMaterial::~NpFEMClothMaterial() +{ + NpPhysics::getInstance().removeFEMClothMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpFEMClothMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + // PT: TODO: why commented out? + //NpPhysics::getInstance().addFEMMaterial(this); +} + +void NpFEMClothMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releaseFEMClothMaterialToPool(*this); + } + else + this->~NpFEMClothMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpFEMClothMaterial* NpFEMClothMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpFEMClothMaterial* obj = PX_PLACEMENT_NEW(address, NpFEMClothMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpFEMClothMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpFEMClothMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpFEMClothMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpFEMClothMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpFEMClothMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateFEMClothMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setYoungsModulus(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMClothMaterial::setYoungsModulus: invalid float"); + + mMaterial.youngs = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getYoungsModulus() const +{ + return mMaterial.youngs; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setPoissons(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f && x < 0.5f, "PxFEMClothMaterial::setPoissons: invalid float"); + mMaterial.poissons = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getPoissons() const +{ + return mMaterial.poissons; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setDynamicFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFEMClothMaterial::setDynamicFriction: invalid float"); + mMaterial.dynamicFriction = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getDynamicFriction() const +{ + return mMaterial.dynamicFriction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setThickness(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFEMClothMaterial::setThickness: invalid float"); + mMaterial.thickness = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getThickness() const +{ + return mMaterial.thickness; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setElasticityDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMClothMaterial::setElasticityDamping: invalid float"); + + mMaterial.elasticityDamping = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getElasticityDamping() const +{ + return mMaterial.elasticityDamping; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMClothMaterial::setBendingDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMClothMaterial::setBendingDamping: invalid float"); + + mMaterial.bendingDamping = x; + + updateMaterial(); +} + +PxReal NpFEMClothMaterial::getBendingDamping() const +{ + return mMaterial.bendingDamping; +} + +/////////////////////////////////////////////////////////////////////////////// +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.h new file mode 100644 index 0000000..0d54e84 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMClothMaterial.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_FEM_CLOTH_MATERIAL_H +#define NP_FEM_CLOTH_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsFEMClothMaterialCore.h" + +namespace physx +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // Compared to other objects, materials are special since they belong to the SDK and not to scenes + // (similar to meshes). That's why the NpFEMClothMaterial does have direct access to the core material instead + // of having a buffered interface for it. Scenes will have copies of the SDK material table and there + // the materials will be buffered. + + class NpFEMClothMaterial : public PxFEMClothMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpFEMClothMaterial(PxBaseFlags baseFlags) : PxFEMClothMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpFEMClothMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpFEMClothMaterial(const PxsFEMClothMaterialCore& desc); + virtual ~NpFEMClothMaterial(); + + // PxBase + virtual void release() PX_OVERRIDE; + //~PxBase + + // PxRefCounted + virtual void acquireReference() PX_OVERRIDE; + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void onRefCountZero() PX_OVERRIDE; + //~PxRefCounted + + // PxFEMMaterial + virtual void setYoungsModulus(PxReal young) PX_OVERRIDE; + virtual PxReal getYoungsModulus() const PX_OVERRIDE; + virtual void setPoissons(PxReal poisson) PX_OVERRIDE; + virtual PxReal getPoissons() const PX_OVERRIDE; + virtual void setDynamicFriction(PxReal threshold) PX_OVERRIDE; + virtual PxReal getDynamicFriction() const PX_OVERRIDE; + //~PxFEMMaterial + + // PxFEMClothMaterial + virtual void setThickness(PxReal thickness) PX_OVERRIDE; + virtual PxReal getThickness() const PX_OVERRIDE; + virtual void setElasticityDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getElasticityDamping() const PX_OVERRIDE; + virtual void setBendingDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getBendingDamping() const PX_OVERRIDE; + //~PxFEMClothMaterial + + PX_FORCE_INLINE static void getMaterialIndices(PxFEMClothMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsFEMClothMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpFEMClothMaterial::getMaterialIndices(PxFEMClothMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp new file mode 100644 index 0000000..0cb3ee1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.cpp @@ -0,0 +1,232 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpFEMSoftBodyMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +using namespace physx; +using namespace Cm; + +NpFEMSoftBodyMaterial::NpFEMSoftBodyMaterial(const PxsFEMSoftBodyMaterialCore& desc) : + PxFEMSoftBodyMaterial(PxConcreteType::eSOFTBODY_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpFEMSoftBodyMaterial::~NpFEMSoftBodyMaterial() +{ + NpPhysics::getInstance().removeFEMSoftBodyMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpFEMSoftBodyMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + NpPhysics::getInstance().addFEMMaterial(this); +} + +void NpFEMSoftBodyMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releaseFEMMaterialToPool(*this); + } + else + this->~NpFEMSoftBodyMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpFEMSoftBodyMaterial* NpFEMSoftBodyMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpFEMSoftBodyMaterial* obj = PX_PLACEMENT_NEW(address, NpFEMSoftBodyMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpFEMSoftBodyMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpFEMSoftBodyMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpFEMSoftBodyMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpFEMSoftBodyMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpFEMSoftBodyMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateFEMSoftBodyMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setYoungsModulus(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "NpFEMSoftBodyMaterial::setYoungsModulus: invalid float"); + + mMaterial.youngs = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getYoungsModulus() const +{ + return mMaterial.youngs; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setPoissons(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f && x < 0.5f, "PxMaterial::setPoissons: invalid float"); + mMaterial.poissons = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getPoissons() const +{ + return mMaterial.poissons; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDynamicFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMaterial::setDynamicFriction: invalid float"); + mMaterial.dynamicFriction = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDynamicFriction() const +{ + return mMaterial.dynamicFriction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMaterial::setDamping: invalid float"); + mMaterial.damping = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDamping() const +{ + return mMaterial.damping; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDampingScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f && x<= 1.f, "PxMaterial::setDampingScale: invalid float"); + mMaterial.dampingScale = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDampingScale() const +{ + return mMaterial.dampingScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDeformThreshold(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMMaterial::setDeformThreshold: invalid float"); + + mMaterial.deformThreshold = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDeformThreshold() const +{ + return mMaterial.deformThreshold; +} + +///////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDeformLowLimitRatio(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMMaterial::setDeformLowLimitRatio: invalid float"); + + mMaterial.deformLowLimitRatio = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDeformLowLimitRatio() const +{ + return mMaterial.deformLowLimitRatio; +} + +///////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::setDeformHighLimitRatio(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFEMMaterial::setDeformLowLimitRatio: invalid float"); + + mMaterial.deformHighLimitRatio = x; + + updateMaterial(); +} + +PxReal NpFEMSoftBodyMaterial::getDeformHighLimitRatio() const +{ + return mMaterial.deformHighLimitRatio; +} + +/////////////////////////////////////////////////////////////////////////////// +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.h new file mode 100644 index 0000000..d90ad9d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFEMSoftBodyMaterial.h @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_FEM_MATERIAL_H +#define NP_FEM_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsFEMSoftBodyMaterialCore.h" + +namespace physx +{ + // Compared to other objects, materials are special since they belong to the SDK and not to scenes + // (similar to meshes). That's why the NpFEMMaterial does have direct access to the core material instead + // of having a buffered interface for it. Scenes will have copies of the SDK material table and there + // the materials will be buffered. + + class NpFEMSoftBodyMaterial : public PxFEMSoftBodyMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpFEMSoftBodyMaterial(PxBaseFlags baseFlags) : PxFEMSoftBodyMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpFEMSoftBodyMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpFEMSoftBodyMaterial(const PxsFEMSoftBodyMaterialCore& desc); + virtual ~NpFEMSoftBodyMaterial(); + + // PxBase + virtual void onRefCountZero(); + //~PxBase + + virtual void release(); + + // PxRefCounted + virtual void acquireReference(); + virtual PxU32 getReferenceCount() const; + //~PxRefCounted + + // PxFEMMaterial + virtual void setYoungsModulus(PxReal young) PX_OVERRIDE; + virtual PxReal getYoungsModulus() const PX_OVERRIDE; + virtual void setPoissons(PxReal poisson) PX_OVERRIDE; + virtual PxReal getPoissons() const PX_OVERRIDE; + virtual void setDynamicFriction(PxReal threshold) PX_OVERRIDE; + virtual PxReal getDynamicFriction() const PX_OVERRIDE; + //~PxFEMMaterial + + // PxFEMSoftBodyMaterial + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setDampingScale(PxReal scale); + virtual PxReal getDampingScale() const; + virtual void setDeformThreshold(PxReal threshold); + virtual PxReal getDeformThreshold() const; + virtual void setDeformLowLimitRatio(PxReal threshold); + virtual PxReal getDeformLowLimitRatio() const; + virtual void setDeformHighLimitRatio(PxReal threshold); + virtual PxReal getDeformHighLimitRatio() const; + //~PxFEMSoftBodyMaterial + + PX_FORCE_INLINE static void getMaterialIndices(PxFEMSoftBodyMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsFEMSoftBodyMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpFEMSoftBodyMaterial::getMaterialIndices(PxFEMSoftBodyMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp new file mode 100644 index 0000000..dd86742 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.cpp @@ -0,0 +1,200 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpFLIPMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +using namespace physx; +using namespace Cm; + +NpFLIPMaterial::NpFLIPMaterial(const PxsFLIPMaterialCore& desc) : + PxFLIPMaterial(PxConcreteType::eFLIP_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpFLIPMaterial::~NpFLIPMaterial() +{ + NpPhysics::getInstance().removeFLIPMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpFLIPMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + // PT: TODO: missing line here? +} + +void NpFLIPMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releaseFLIPMaterialToPool(*this); + } + else + this->~NpFLIPMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpFLIPMaterial* NpFLIPMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpFLIPMaterial* obj = PX_PLACEMENT_NEW(address, NpFLIPMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpFLIPMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpFLIPMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpFLIPMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpFLIPMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpFLIPMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateFLIPMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setFriction: invalid float"); + + mMaterial.friction = x; + + updateMaterial(); +} + +PxReal NpFLIPMaterial::getFriction() const +{ + return mMaterial.friction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setViscosity(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setViscosity: invalid float"); + mMaterial.viscosity = x; + + updateMaterial(); +} + +PxReal NpFLIPMaterial::getViscosity() const +{ + return mMaterial.viscosity; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setDamping: invalid float"); + mMaterial.damping = x; + + updateMaterial(); +} + +PxReal NpFLIPMaterial::getDamping() const +{ + return mMaterial.damping; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setAdhesion(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setAdhesion: invalid float"); + mMaterial.adhesion = x; + + updateMaterial(); +} + +PxReal NpFLIPMaterial::getAdhesion() const +{ + return mMaterial.adhesion; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setGravityScale(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFLIPMaterial::setAdhesion: invalid float"); + mMaterial.gravityScale = x; + + updateMaterial(); +} + +PxReal NpFLIPMaterial::getGravityScale() const +{ + return mMaterial.gravityScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::setAdhesionRadiusScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setAdhesionRadiusScale: scale must be positive"); + mMaterial.adhesionRadiusScale = x; + + updateMaterial(); +} +PxReal NpFLIPMaterial::getAdhesionRadiusScale() const +{ + return mMaterial.adhesionRadiusScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.h new file mode 100644 index 0000000..54b81ae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFLIPMaterial.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_FLIP_MATERIAL_H +#define NP_FLIP_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsFLIPMaterialCore.h" +#include "PxFLIPMaterial.h" + +namespace physx +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // Compared to other objects, materials are special since they belong to the SDK and not to scenes + // (similar to meshes). That's why the NpFLIPMaterial does have direct access to the core material instead + // of having a buffered interface for it. Scenes will have copies of the SDK material table and there + // the materials will be buffered. + + class NpFLIPMaterial : public PxFLIPMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpFLIPMaterial(PxBaseFlags baseFlags) : PxFLIPMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpFLIPMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpFLIPMaterial(const PxsFLIPMaterialCore& desc); + virtual ~NpFLIPMaterial(); + + // PxBase + virtual void release() PX_OVERRIDE; + //~PxBase + + // PxRefCounted + virtual void acquireReference() PX_OVERRIDE; + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void onRefCountZero() PX_OVERRIDE; + //~PxRefCounted + + // PxParticleMaterial + virtual void setFriction(PxReal friction) PX_OVERRIDE; + virtual PxReal getFriction() const PX_OVERRIDE; + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setAdhesion(PxReal adhesion) PX_OVERRIDE; + virtual PxReal getAdhesion() const PX_OVERRIDE; + virtual void setGravityScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getGravityScale() const PX_OVERRIDE; + virtual void setAdhesionRadiusScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getAdhesionRadiusScale() const PX_OVERRIDE; + //~PxParticleMaterial + + // PxFLIPMaterial + virtual void setViscosity(PxReal viscosity) PX_OVERRIDE; + virtual PxReal getViscosity() const PX_OVERRIDE; + //~PxFLIPMaterial + + PX_FORCE_INLINE static void getMaterialIndices(NpFLIPMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsFLIPMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpFLIPMaterial::getMaterialIndices(NpFLIPMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp new file mode 100644 index 0000000..f91f4bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.cpp @@ -0,0 +1,1436 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxGeometryQuery.h" +#include "NpFactory.h" +#include "NpPhysics.h" +#include "ScPhysics.h" +#include "GuHeightField.h" +#include "GuTriangleMesh.h" +#include "GuConvexMesh.h" + +#include "NpConnector.h" +#include "NpPtrTableStorageManager.h" +#include "CmCollection.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationTendon.h" +#include "NpAggregate.h" + +#include "PxvGlobals.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "NpParticleSystem.h" +#include "NpSoftBody.h" +#include "NpFEMCloth.h" +#include "NpHairSystem.h" +#include "PxPhysXGpu.h" +#endif + +#if PX_SUPPORT_OMNI_PVD +# define OMNI_PVD_NOTIFY_ADD(OBJECT) notifyListenersAdd(OBJECT) +# define OMNI_PVD_NOTIFY_REMOVE(OBJECT) notifyListenersRemove(OBJECT) +#else +# define OMNI_PVD_NOTIFY_ADD(OBJECT) +# define OMNI_PVD_NOTIFY_REMOVE(OBJECT) +#endif + +using namespace physx; +using namespace Cm; + +NpFactory::NpFactory() : + Gu::MeshFactory() + , mConnectorArrayPool("connectorArrayPool") + , mPtrTableStorageManager(PX_NEW(NpPtrTableStorageManager)) + , mMaterialPool("MaterialPool") + , mGpuMemStat(0) +#if PX_SUPPORT_PVD + , mNpFactoryListener(NULL) +#endif +{ +} + +template +static void releaseAll(PxHashSet& container) +{ + // a bit tricky: release will call the factory back to remove the object from + // the tracking array, immediately invalidating the iterator. Reconstructing the + // iterator per delete can be expensive. So, we use a temporary object. + // + // a coalesced hash would be efficient too, but we only ever iterate over it + // here so it's not worth the 2x remove penalty over the normal hash. + + PxArray > tmp; + tmp.reserve(container.size()); + for(typename PxHashSet::Iterator iter = container.getIterator(); !iter.done(); ++iter) + tmp.pushBack(*iter); + + PX_ASSERT(tmp.size() == container.size()); + for(PxU32 i=0;irelease(); +} + +NpFactory::~NpFactory() +{ + PX_DELETE(mPtrTableStorageManager); +} + +void NpFactory::release() +{ + releaseAll(mAggregateTracking); + releaseAll(mConstraintTracking); + releaseAll(mArticulationTracking); + releaseAll(mActorTracking); + while(mShapeTracking.size()) + static_cast(mShapeTracking.getEntries()[0])->releaseInternal(); + +#if PX_SUPPORT_GPU_PHYSX + releaseAll(mParticleBufferTracking); +#endif + + Gu::MeshFactory::release(); // deletes the class +} + +void NpFactory::createInstance() +{ + PX_ASSERT(!mInstance); + mInstance = PX_NEW(NpFactory)(); +} + +void NpFactory::destroyInstance() +{ + PX_ASSERT(mInstance); + mInstance->release(); + mInstance = NULL; +} + +NpFactory* NpFactory::mInstance = NULL; + +/////////////////////////////////////////////////////////////////////////////// + +template +static void addToTracking(T1& set, T0* element, PxMutex& mutex, bool lock) +{ + if(!element) + return; + + if(lock) + mutex.lock(); + + set.insert(element); + + if(lock) + mutex.unlock(); +} + +/////////////////////////////////////////////////////////////////////////////// Actors + +void NpFactory::addRigidStatic(PxRigidStatic* npActor, bool lock) +{ + addToTracking(mActorTracking, npActor, mTrackingMutex, lock); + OMNI_PVD_NOTIFY_ADD(npActor); +} + +void NpFactory::addRigidDynamic(PxRigidDynamic* npBody, bool lock) +{ + addToTracking(mActorTracking, npBody, mTrackingMutex, lock); + OMNI_PVD_NOTIFY_ADD(npBody); +} + +void NpFactory::addShape(PxShape* shape, bool lock) +{ + addToTracking(mShapeTracking, shape, mTrackingMutex, lock); + OMNI_PVD_NOTIFY_ADD(shape); +} + +void NpFactory::onActorRelease(PxActor* a) +{ + OMNI_PVD_NOTIFY_REMOVE(a); + PxMutex::ScopedLock lock(mTrackingMutex); + mActorTracking.erase(a); +} + +void NpFactory::onShapeRelease(PxShape* a) +{ + OMNI_PVD_NOTIFY_REMOVE(a); + PxMutex::ScopedLock lock(mTrackingMutex); + mShapeTracking.erase(a); +} + +void NpFactory::addArticulation(PxArticulationReducedCoordinate* npArticulation, bool lock) +{ + addToTracking(mArticulationTracking, npArticulation, mTrackingMutex, lock); + OMNI_PVD_NOTIFY_ADD(npArticulation); +} + +void NpFactory::addParticleBuffer(PxParticleBuffer* buffer, bool lock) +{ + addToTracking(mParticleBufferTracking, buffer, mTrackingMutex, lock); +} + +void NpFactory::onParticleBufferReleaseInternal(PxParticleBuffer* buffer) +{ + PxMutex::ScopedLock lock(mTrackingMutex); + mParticleBufferTracking.erase(buffer); +} + +static PxArticulationReducedCoordinate* createArticulationRC() +{ + NpArticulationReducedCoordinate* npArticulation = NpFactory::getInstance().createNpArticulationRC(); + if (!npArticulation) + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Articulation initialization failed: returned NULL."); + return npArticulation; +} + +static NpArticulationLink* createArticulationLink(NpArticulationReducedCoordinate &root, NpArticulationLink* parent, const PxTransform& pose) +{ + PX_CHECK_AND_RETURN_NULL(pose.isValid(),"Supplied articulation link pose is not valid. Articulation link creation method returns NULL."); + PX_CHECK_AND_RETURN_NULL((!parent || (&parent->getRoot() == &root)), "specified parent link is not part of the destination articulation. Articulation link creation method returns NULL."); + + NpArticulationLink* npArticulationLink = NpFactory::getInstance().createNpArticulationLink(root, parent, pose); + if (!npArticulationLink) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Articulation link initialization failed: returned NULL."); + return NULL; + } + + PxArticulationJointReducedCoordinate* npArticulationJoint = 0; + if (parent) + { + PxTransform parentPose = parent->getCMassLocalPose().transformInv(pose); + PxTransform childPose = PxTransform(PxIdentity); + + npArticulationJoint = root.createArticulationJoint(*parent, parentPose, *npArticulationLink, childPose); + if (!npArticulationJoint) + { + PX_DELETE(npArticulationLink); + + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "Articulation link initialization failed due to joint creation failure: returned NULL."); + return NULL; + } + + npArticulationLink->setInboundJoint(*npArticulationJoint); + } + + return npArticulationLink; +} + +// pointers to functions above, initialized during subsystem registration +static PxArticulationReducedCoordinate* (*sCreateArticulationRCFn)() = 0; +static NpArticulationLink* (*sCreateArticulationLinkFn)(NpArticulationReducedCoordinate&, NpArticulationLink* parent, const PxTransform& pose) = 0; + +void NpFactory::registerArticulations() +{ + //sCreateArticulationFn = &::createArticulation; + sCreateArticulationLinkFn = &::createArticulationLink; +} + +void NpFactory::registerArticulationRCs() +{ + sCreateArticulationRCFn = &::createArticulationRC; + sCreateArticulationLinkFn = &::createArticulationLink; +} + +void NpFactory::releaseArticulationToPool(PxArticulationReducedCoordinate& articulation) +{ + PX_ASSERT(articulation.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + + PX_ASSERT(articulation.getConcreteType() == PxConcreteType::eARTICULATION_REDUCED_COORDINATE); + PxMutex::ScopedLock lock(mArticulationRCPoolLock); + mArticulationRCPool.destroy(static_cast(&articulation)); +} + +PxArticulationReducedCoordinate* NpFactory::createArticulationRC() +{ + if (!sCreateArticulationRCFn) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Articulations not registered: returned NULL."); + return NULL; + } + + PxArticulationReducedCoordinate* npArticulation = (*sCreateArticulationRCFn)(); + if (npArticulation) + addArticulation(npArticulation); + // OMNI_PVD_CREATE() + return static_cast(npArticulation); +} + +NpArticulationReducedCoordinate* NpFactory::createNpArticulationRC() +{ + PxMutex::ScopedLock lock(mArticulationRCPoolLock); + return mArticulationRCPool.construct(); +} + +void NpFactory::onArticulationRelease(PxArticulationReducedCoordinate* a) +{ + OMNI_PVD_NOTIFY_REMOVE(a); + PxMutex::ScopedLock lock(mTrackingMutex); + mArticulationTracking.erase(a); +} + +NpArticulationLink* NpFactory::createNpArticulationLink(NpArticulationReducedCoordinate& root, NpArticulationLink* parent, const PxTransform& pose) +{ + NpArticulationLink* npArticulationLink; + { + PxMutex::ScopedLock lock(mArticulationLinkPoolLock); + npArticulationLink = mArticulationLinkPool.construct(pose, root, parent); + } + OMNI_PVD_NOTIFY_ADD(npArticulationLink); + return npArticulationLink; +} + +void NpFactory::releaseArticulationLinkToPool(NpArticulationLink& articulationLink) +{ + PX_ASSERT(articulationLink.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + OMNI_PVD_NOTIFY_REMOVE(&articulationLink); + PxMutex::ScopedLock lock(mArticulationLinkPoolLock); + mArticulationLinkPool.destroy(&articulationLink); +} + +PxArticulationLink* NpFactory::createArticulationLink(NpArticulationReducedCoordinate& root, NpArticulationLink* parent, const PxTransform& pose) +{ + if(!sCreateArticulationLinkFn) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "Articulations not registered: returned NULL."); + return NULL; + } + + return (*sCreateArticulationLinkFn)(root, parent, pose); +} + +NpArticulationJointReducedCoordinate* NpFactory::createNpArticulationJointRC(NpArticulationLink& parent, const PxTransform& parentFrame, NpArticulationLink& child, const PxTransform& childFrame) +{ + NpArticulationJointReducedCoordinate* npArticulationJoint; + { + PxMutex::ScopedLock lock(mArticulationJointRCPoolLock); + npArticulationJoint = mArticulationRCJointPool.construct(parent, parentFrame, child, childFrame); + } + OMNI_PVD_NOTIFY_ADD(npArticulationJoint); + return npArticulationJoint; +} + +void NpFactory::releaseArticulationJointRCToPool(NpArticulationJointReducedCoordinate& articulationJoint) +{ + PX_ASSERT(articulationJoint.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + OMNI_PVD_NOTIFY_REMOVE(&articulationJoint); + PxMutex::ScopedLock lock(mArticulationJointRCPoolLock); + mArticulationRCJointPool.destroy(&articulationJoint); +} + +/////////////////////////////////////////////////////////////////////////////// soft body + +PxSoftBody* NpFactory::createSoftBody(PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + NpSoftBody* sb; + { PxMutex::ScopedLock lock(mSoftBodyPoolLock); + sb = mSoftBodyPool.construct(cudaContextManager); } + OMNI_PVD_NOTIFY_ADD(sb); + return sb; +#else + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxSoftBody is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseSoftBodyToPool(PxSoftBody& softBody) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(softBody.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + OMNI_PVD_NOTIFY_REMOVE(&softBody); + PxMutex::ScopedLock lock(mSoftBodyPoolLock); + mSoftBodyPool.destroy(static_cast(&softBody)); +#else + PX_UNUSED(softBody); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// FEM cloth + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFEMCloth* NpFactory::createFEMCloth(PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mFEMClothPoolLock); + return mFEMClothPool.construct(cudaContextManager); +#else + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxFEMCloth is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseFEMClothToPool(PxFEMCloth& femCloth) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(femCloth.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mFEMClothPoolLock); + mFEMClothPool.destroy(static_cast(&femCloth)); +#else + PX_UNUSED(femCloth); +#endif +} +#endif + +//////////////////////////////////////////////////////////////////////////////// particle system + +PxPBDParticleSystem* NpFactory::createPBDParticleSystem(PxU32 maxNeighborhood, PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mPBDParticleSystemPoolLock); + + //PX_CHECK_MSG(NpPBDParticleSystem::getNumAvailableSystems() > 0, "Max. number of concurrent PxParticleSystem is 256."); + + return mPBDParticleSystemPool.construct(maxNeighborhood, cudaContextManager); +#else + PX_UNUSED(maxNeighborhood); + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxPBDParticleSystem is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releasePBDParticleSystemToPool(PxPBDParticleSystem& particleSystem) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(particleSystem.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mPBDParticleSystemPoolLock); + mPBDParticleSystemPool.destroy(static_cast(&particleSystem)); +#else + PX_UNUSED(particleSystem); +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFLIPParticleSystem* NpFactory::createFLIPParticleSystem(PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mFLIPParticleSystemPoolLock); + + //PX_CHECK_MSG(NpFLIPParticleSystem::getNumAvailableSystems() > 0, "Max. number of concurrent PxParticleSystem is 256."); + + return mFLIPParticleSystemPool.construct(cudaContextManager); +#else + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxParticleSystem is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseFLIPParticleSystemToPool(PxFLIPParticleSystem& particleSystem) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(particleSystem.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mFLIPParticleSystemPoolLock); + mFLIPParticleSystemPool.destroy(static_cast(&particleSystem)); +#else + PX_UNUSED(particleSystem); +#endif +} + +PxMPMParticleSystem* NpFactory::createMPMParticleSystem(PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mMPMParticleSystemPoolLock); + + //PX_CHECK_MSG(NpMPMParticleSystem::getNumAvailableSystems() > 0, "Max. number of concurrent PxParticleSystem is 256."); + + return mMPMParticleSystemPool.construct(cudaContextManager); +#else + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxMPMParticleSystem is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseMPMParticleSystemToPool(PxMPMParticleSystem& particleSystem) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(particleSystem.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mMPMParticleSystemPoolLock); + mMPMParticleSystemPool.destroy(static_cast(&particleSystem)); +#else + PX_UNUSED(particleSystem); +#endif +} + +PxCustomParticleSystem* NpFactory::createCustomParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mMPMParticleSystemPoolLock); + + //PX_CHECK_MSG(NpMPMParticleSystem::getNumAvailableSystems() > 0, "Max. number of concurrent PxParticleSystem is 256."); + + return mCustomParticleSystemPool.construct(cudaContextManager, maxNeighborhood); +#else + PX_UNUSED(cudaContextManager); + PX_UNUSED(maxNeighborhood); + + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxCustomParticleSystem is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseCustomParticleSystemToPool(PxCustomParticleSystem& particleSystem) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(particleSystem.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mCustomParticleSystemPoolLock); + mCustomParticleSystemPool.destroy(static_cast(&particleSystem)); +#else + PX_UNUSED(particleSystem); +#endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// Particle Buffers + +PxParticleBuffer* NpFactory::createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager) +{ + if(!cudaContextManager) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + PxParticleBuffer* buffer = physxGpu->createParticleBuffer(maxParticles, maxVolumes, cudaContextManager, &mGpuMemStat, NpFactory::onParticleBufferRelease); + addParticleBuffer(buffer); + return buffer; +#else + PX_UNUSED(maxParticles); + PX_UNUSED(maxVolumes); + PX_UNUSED(cudaContextManager); + return NULL; +#endif +} + +PxParticleAndDiffuseBuffer* NpFactory::createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager) +{ + if(!cudaContextManager) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + PxParticleAndDiffuseBuffer* diffuseBuffer = physxGpu->createParticleAndDiffuseBuffer(maxParticles, maxVolumes, maxDiffuseParticles, cudaContextManager, &mGpuMemStat, NpFactory::onParticleBufferRelease); + addParticleBuffer(diffuseBuffer); + return diffuseBuffer; +#else + PX_UNUSED(maxParticles); + PX_UNUSED(maxVolumes); + PX_UNUSED(maxDiffuseParticles); + PX_UNUSED(cudaContextManager); + return NULL; +#endif +} + +PxParticleClothBuffer* NpFactory::createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager) +{ + if(!cudaContextManager) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + PxParticleClothBuffer* clothBuffer = physxGpu->createParticleClothBuffer(maxParticles, maxNumVolumes, maxNumCloths, maxNumTriangles, maxNumSprings, cudaContextManager, &mGpuMemStat, NpFactory::onParticleBufferRelease); + addParticleBuffer(clothBuffer); + return clothBuffer; +#else + PX_UNUSED(maxParticles); + PX_UNUSED(maxNumVolumes); + PX_UNUSED(maxNumCloths); + PX_UNUSED(maxNumTriangles); + PX_UNUSED(maxNumSprings); + PX_UNUSED(cudaContextManager); + return NULL; +#endif +} + +PxParticleRigidBuffer* NpFactory::createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager) +{ + if(!cudaContextManager) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + PxParticleRigidBuffer* rigidBuffer = physxGpu->createParticleRigidBuffer(maxParticles, maxNumVolumes, maxNumRigids, cudaContextManager, &mGpuMemStat, NpFactory::onParticleBufferRelease); + addParticleBuffer(rigidBuffer); + return rigidBuffer; +#else + PX_UNUSED(maxParticles); + PX_UNUSED(maxNumVolumes); + PX_UNUSED(maxNumRigids); + PX_UNUSED(cudaContextManager); + return NULL; +#endif +} + +void NpFactory::onParticleBufferRelease(PxParticleBuffer* buffer) +{ + NpFactory::getInstance().onParticleBufferReleaseInternal(buffer); +} + +/////////////////////////////////////////////////////////////////////////////// HairSystem + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxHairSystem* NpFactory::createHairSystem(PxCudaContextManager& cudaContextManager) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mHairSystemPoolLock); + return mHairSystemPool.construct(cudaContextManager); +#else + PX_UNUSED(cudaContextManager); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxHairSystem is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseHairSystemToPool(PxHairSystem& hairSystem) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_ASSERT(hairSystem.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mHairSystemPoolLock); + mHairSystemPool.destroy(static_cast(&hairSystem)); +#else + PX_UNUSED(hairSystem); +#endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// constraint + +void NpFactory::addConstraint(PxConstraint* npConstraint, bool lock) +{ + addToTracking(mConstraintTracking, npConstraint, mTrackingMutex, lock); +} + +PxConstraint* NpFactory::createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) +{ + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->getConcreteType()!=PxConcreteType::eRIGID_STATIC) || (actor1 && actor1->getConcreteType()!=PxConcreteType::eRIGID_STATIC), "createConstraint: At least one actor must be dynamic or an articulation link"); + + NpConstraint* npConstraint; + { + PxMutex::ScopedLock lock(mConstraintPoolLock); + npConstraint = mConstraintPool.construct(actor0, actor1, connector, shaders, dataSize); + } + addConstraint(npConstraint); + connector.connectToConstraint(npConstraint); + return npConstraint; +} + +void NpFactory::releaseConstraintToPool(NpConstraint& constraint) +{ + PX_ASSERT(constraint.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mConstraintPoolLock); + mConstraintPool.destroy(&constraint); +} + +void NpFactory::onConstraintRelease(PxConstraint* c) +{ + PxMutex::ScopedLock lock(mTrackingMutex); + mConstraintTracking.erase(c); +} + +/////////////////////////////////////////////////////////////////////////////// aggregate + +void NpFactory::addAggregate(PxAggregate* npAggregate, bool lock) +{ + addToTracking(mAggregateTracking, npAggregate, mTrackingMutex, lock); + OMNI_PVD_NOTIFY_ADD(npAggregate); +} + +PxAggregate* NpFactory::createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) +{ + NpAggregate* npAggregate; + { + PxMutex::ScopedLock lock(mAggregatePoolLock); + npAggregate = mAggregatePool.construct(maxActors, maxShapes, filterHint); + } + + addAggregate(npAggregate); + return npAggregate; +} + +void NpFactory::releaseAggregateToPool(NpAggregate& aggregate) +{ + PX_ASSERT(aggregate.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mAggregatePoolLock); + mAggregatePool.destroy(&aggregate); +} + +void NpFactory::onAggregateRelease(PxAggregate* a) +{ + OMNI_PVD_NOTIFY_REMOVE(a); + PxMutex::ScopedLock lock(mTrackingMutex); + mAggregateTracking.erase(a); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxMaterial* NpFactory::createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) +{ + PX_CHECK_AND_RETURN_NULL(dynamicFriction >= 0.0f, "createMaterial: dynamicFriction must be >= 0."); + PX_CHECK_AND_RETURN_NULL(staticFriction >= 0.0f, "createMaterial: staticFriction must be >= 0."); + PX_CHECK_AND_RETURN_NULL(restitution >= 0.0f || restitution <= 1.0f, "createMaterial: restitution must be between 0 and 1."); + + PxsMaterialData materialData; + materialData.staticFriction = staticFriction; + materialData.dynamicFriction = dynamicFriction; + materialData.restitution = restitution; + + NpMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mMaterialPoolLock); + npMaterial = mMaterialPool.construct(materialData); + } + return npMaterial; +} + +void NpFactory::releaseMaterialToPool(NpMaterial& material) +{ + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mMaterialPoolLock); + mMaterialPool.destroy(&material); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxFEMSoftBodyMaterial* NpFactory::createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_CHECK_AND_RETURN_NULL(youngs >= 0.0f, "createFEMSoftBodyMaterial: youngs must be >= 0."); + PX_CHECK_AND_RETURN_NULL(poissons >= 0.0f && poissons < 0.5f, "createFEMSoftBodyMaterial: poissons must be in range[0.f, 0.5f)."); + PX_CHECK_AND_RETURN_NULL(dynamicFriction >= 0.0f, "createMaterial: dynamicFriction must be >= 0."); + + PxsFEMSoftBodyMaterialData materialData; + materialData.youngs = youngs; + materialData.poissons = poissons; + materialData.dynamicFriction = dynamicFriction; + materialData.damping = 0.f; + materialData.dampingScale = 1.f; + materialData.deformThreshold = PX_MAX_F32; + materialData.deformLowLimitRatio = 1.f; + materialData.deformHighLimitRatio = 1.f; + + NpFEMSoftBodyMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mFEMMaterialPoolLock); + npMaterial = mFEMMaterialPool.construct(materialData); + } + return npMaterial; + +#else + PX_UNUSED(youngs); + PX_UNUSED(poissons); + PX_UNUSED(dynamicFriction); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxFEMMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseFEMMaterialToPool(PxFEMSoftBodyMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpFEMSoftBodyMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mFEMMaterialPoolLock); + mFEMMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFEMClothMaterial* NpFactory::createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_CHECK_AND_RETURN_NULL(youngs >= 0.0f, "createFEMClothMaterial: youngs must be >= 0."); + PX_CHECK_AND_RETURN_NULL(poissons >= 0.0f && poissons < 0.5f, "createFEMClothMaterial: poissons must be in range[0.f, 0.5f)."); + PX_CHECK_AND_RETURN_NULL(dynamicFriction >= 0.0f, "createMaterial: dynamicFriction must be >= 0."); + + PxsFEMClothMaterialData materialData; + materialData.youngs = youngs; + materialData.poissons = poissons; + materialData.dynamicFriction = dynamicFriction; + materialData.thickness = 0.f; + materialData.elasticityDamping = 0.f; + materialData.bendingDamping = 0.f; + + NpFEMClothMaterial* npMaterial = NULL; + { + PxMutex::ScopedLock lock(mFEMClothMaterialPoolLock); + npMaterial = mFEMClothMaterialPool.construct(materialData); + } + return npMaterial; +#else + PX_UNUSED(youngs); + PX_UNUSED(poissons); + PX_UNUSED(dynamicFriction); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxFEMClothMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseFEMClothMaterialToPool(PxFEMClothMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpFEMClothMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mFEMClothMaterialPoolLock); + mFEMClothMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +PxPBDMaterial* NpFactory::createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, + PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) +{ +#if PX_SUPPORT_GPU_PHYSX + + PxsPBDMaterialData materialData; + materialData.friction = friction; + materialData.damping = damping; + materialData.viscosity = viscosity; + materialData.vorticityConfinement = vorticityConfinement; + materialData.surfaceTension = surfaceTension; + materialData.cohesion = cohesion; + materialData.adhesion = adhesion; + materialData.lift = lift; + materialData.drag = drag; + materialData.cflCoefficient = cflCoefficient; + materialData.gravityScale = gravityScale; + materialData.particleFrictionScale = 1.f; + materialData.adhesionRadiusScale = 0.f; + materialData.particleAdhesionScale = 1.f; + + NpPBDMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mPBDMaterialPoolLock); + npMaterial = mPBDMaterialPool.construct(materialData); + } + return npMaterial; +#else + PX_UNUSED(friction); + PX_UNUSED(damping); + PX_UNUSED(adhesion); + PX_UNUSED(viscosity); + PX_UNUSED(vorticityConfinement); + PX_UNUSED(surfaceTension); + PX_UNUSED(cohesion); + PX_UNUSED(lift); + PX_UNUSED(drag); + PX_UNUSED(cflCoefficient); + PX_UNUSED(gravityScale); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxPBDMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releasePBDMaterialToPool(PxPBDMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpPBDMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mPBDMaterialPoolLock); + mPBDMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFLIPMaterial* NpFactory::createFLIPMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal gravityScale) +{ +#if PX_SUPPORT_GPU_PHYSX + + PxsFLIPMaterialData materialData; + materialData.friction = friction; + materialData.damping = damping; + materialData.adhesion = adhesion; + materialData.viscosity = viscosity; + materialData.gravityScale = gravityScale; + materialData.adhesionRadiusScale = 0.f; + + NpFLIPMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mFLIPMaterialPoolLock); + npMaterial = mFLIPMaterialPool.construct(materialData); + } + return npMaterial; + +#else + PX_UNUSED(friction); + PX_UNUSED(damping); + PX_UNUSED(adhesion); + PX_UNUSED(viscosity); + PX_UNUSED(gravityScale); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxFLIPMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseFLIPMaterialToPool(PxFLIPMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpFLIPMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mFLIPMaterialPoolLock); + mFLIPMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +PxMPMMaterial* NpFactory::createMPMMaterial( + PxReal friction, PxReal damping, PxReal adhesion, + bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, + PxReal criticalCompression, PxReal criticalStretch, + PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, + PxReal attractiveForceResidual, PxReal gravityScale) +{ +#if PX_SUPPORT_GPU_PHYSX + PxsMPMMaterialData materialData; + materialData.friction = friction; + materialData.damping = damping; + materialData.adhesion = adhesion; + materialData.adhesionRadiusScale = 0.f; + materialData.isPlastic = isPlastic; + materialData.youngsModulus = youngsModulus; + materialData.poissonsRatio = poissons; + materialData.hardening = hardening; + materialData.criticalCompression = criticalCompression; + materialData.criticalStretch = criticalStretch; + materialData.tensileDamageSensitivity = tensileDamageSensitivity; + materialData.compressiveDamageSensitivity = compressiveDamageSensitivity; + materialData.attractiveForceResidual = attractiveForceResidual; + materialData.gravityScale = gravityScale; + materialData.materialModel = PxMPMMaterialModel::eNEO_HOOKEAN; + materialData.cuttingFlags = PxMPMCuttingFlag::eNONE; + materialData.yieldStress = 30000; + materialData.sandFrictionAngle = 3.1415926535898f * 0.25f; + materialData.density = 500.0f; + materialData.stretchAndShearDamping = 0.0f; + materialData.rotationalDamping = 0.0f; + + NpMPMMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mMPMMaterialPoolLock); + npMaterial = mMPMMaterialPool.construct(materialData); + } + return npMaterial; + +#else + PX_UNUSED(friction); + PX_UNUSED(damping); + PX_UNUSED(adhesion); + PX_UNUSED(isPlastic); + PX_UNUSED(youngsModulus); + PX_UNUSED(poissons); + PX_UNUSED(hardening); + PX_UNUSED(criticalCompression); + PX_UNUSED(criticalStretch); + PX_UNUSED(tensileDamageSensitivity); + PX_UNUSED(compressiveDamageSensitivity); + PX_UNUSED(attractiveForceResidual); + PX_UNUSED(gravityScale); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxMPMMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseMPMMaterialToPool(PxMPMMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpMPMMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mMPMMaterialPoolLock); + mMPMMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +PxCustomMaterial* NpFactory::createCustomMaterial(void* gpuBuffer) +{ +#if PX_SUPPORT_GPU_PHYSX + PxsCustomMaterialData materialData; + materialData.userData = gpuBuffer; + materialData.gravityScale = 1.f; + + NpCustomMaterial* npMaterial; + { + PxMutex::ScopedLock lock(mCustomMaterialPoolLock); + npMaterial = mCustomMaterialPool.construct(materialData); + } + return npMaterial; +#else + PX_UNUSED(gpuBuffer); + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxCustomMaterial is not supported on this platform."); + return NULL; +#endif +} + +void NpFactory::releaseCustomMaterialToPool(PxCustomMaterial& material_) +{ +#if PX_SUPPORT_GPU_PHYSX + NpCustomMaterial& material = static_cast(material_); + PX_ASSERT(material.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mMPMMaterialPoolLock); + mCustomMaterialPool.destroy(&material); +#else + PX_UNUSED(material_); +#endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +NpConnectorArray* NpFactory::acquireConnectorArray() +{ + PxMutexT<>::ScopedLock l(mConnectorArrayPoolLock); + return mConnectorArrayPool.construct(); +} + +void NpFactory::releaseConnectorArray(NpConnectorArray* array) +{ + PxMutexT<>::ScopedLock l(mConnectorArrayPoolLock); + mConnectorArrayPool.destroy(array); +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_CHECKED +bool checkShape(const PxGeometry& g, const char* errorMsg) +{ + const bool isValid = PxGeometryQuery::isValid(g); + if(!isValid) + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, errorMsg); + return isValid; +} +#endif + +template +NpShape* NpFactory::createShapeInternal(const PxGeometry& geometry, + PxShapeFlags shapeFlags, + PxMaterialType*const* materials, + PxU16 materialCount, + bool isExclusive, + PxShapeCoreFlag::Enum flag) +{ +#if PX_CHECKED + if(!checkShape(geometry, "Supplied PxGeometry is not valid. Shape creation method returns NULL.")) + return NULL; + + // + // Check for invalid material table setups + // + + if(!NpShape::checkMaterialSetup(geometry, "Shape creation", materials, materialCount)) + return NULL; +#endif + + PxInlineArray materialIndices("NpFactory::TmpMaterialIndexBuffer"); + materialIndices.resize(materialCount); + if (materialCount == 1) + materialIndices[0] = static_cast(materials[0])->mMaterial.mMaterialIndex; + else + NpMaterialType::getMaterialIndices(materials, materialIndices.begin(), materialCount); + + NpShape* npShape; + { + PxMutex::ScopedLock lock(mShapePoolLock); + PxU16* mi = materialIndices.begin(); // required to placate pool constructor arg passing + npShape = mShapePool.construct(geometry, shapeFlags, mi, materialCount, isExclusive, flag); + } + + if (!npShape) + return NULL; + + // PT: TODO: add material base class, move this to NpShape, drop getMaterial<> + for (PxU32 i = 0; i < materialCount; i++) + { + PxMaterialType* mat = npShape->getMaterial(i); + RefCountable_incRefCount(*mat); + } + addShape(npShape); + + return npShape; +} + +NpShape* NpFactory::createShape(const PxGeometry& geometry, + PxShapeFlags shapeFlags, + PxMaterial*const* materials, + PxU16 materialCount, + bool isExclusive) +{ + return createShapeInternal(geometry, shapeFlags, materials, materialCount, isExclusive, PxShapeCoreFlag::Enum(0)); +} + +NpShape* NpFactory::createShape(const PxGeometry& geometry, + PxShapeFlags shapeFlags, + PxFEMSoftBodyMaterial*const* materials, + PxU16 materialCount, + bool isExclusive) +{ +#if PX_SUPPORT_GPU_PHYSX + return createShapeInternal(geometry, shapeFlags, materials, materialCount, isExclusive, PxShapeCoreFlag::eSOFT_BODY_SHAPE); +#else + PX_UNUSED(geometry); PX_UNUSED(shapeFlags); PX_UNUSED(materials); PX_UNUSED(materialCount); PX_UNUSED(isExclusive); + return NULL; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +NpShape* NpFactory::createShape(const PxGeometry& geometry, + PxShapeFlags shapeFlags, + PxFEMClothMaterial*const* materials, + PxU16 materialCount, + bool isExclusive) +{ +#if PX_SUPPORT_GPU_PHYSX + return createShapeInternal(geometry, shapeFlags, materials, materialCount, isExclusive, PxShapeCoreFlag::eCLOTH_SHAPE); +#else + PX_UNUSED(geometry); PX_UNUSED(shapeFlags); PX_UNUSED(materials); PX_UNUSED(materialCount); PX_UNUSED(isExclusive); + return NULL; +#endif +} +#endif + +void NpFactory::releaseShapeToPool(NpShape& shape) +{ + PX_ASSERT(shape.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mShapePoolLock); + mShapePool.destroy(&shape); +} + +PxU32 NpFactory::getNbShapes() const +{ + // PT: TODO: isn't there a lock missing here? See usage in MeshFactory + return mShapeTracking.size(); +} + +PxU32 NpFactory::getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + // PT: TODO: isn't there a lock missing here? See usage in MeshFactory + return getArrayOfPointers(userBuffer, bufferSize, startIndex, mShapeTracking.getEntries(), mShapeTracking.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxRigidStatic* NpFactory::createRigidStatic(const PxTransform& pose) +{ + PX_CHECK_AND_RETURN_NULL(pose.isValid(), "pose is not valid. createRigidStatic returns NULL."); + + NpRigidStatic* npActor; + { + PxMutex::ScopedLock lock(mRigidStaticPoolLock); + npActor = mRigidStaticPool.construct(pose); + } + addRigidStatic(npActor); + return npActor; +} + +void NpFactory::releaseRigidStaticToPool(NpRigidStatic& rigidStatic) +{ + PX_ASSERT(rigidStatic.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mRigidStaticPoolLock); + mRigidStaticPool.destroy(&rigidStatic); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxRigidDynamic* NpFactory::createRigidDynamic(const PxTransform& pose) +{ + PX_CHECK_AND_RETURN_NULL(pose.isValid(), "pose is not valid. createRigidDynamic returns NULL."); + + NpRigidDynamic* npBody; + { + PxMutex::ScopedLock lock(mRigidDynamicPoolLock); + npBody = mRigidDynamicPool.construct(pose); + } + addRigidDynamic(npBody); + return npBody; +} + +void NpFactory::releaseRigidDynamicToPool(NpRigidDynamic& rigidDynamic) +{ + PX_ASSERT(rigidDynamic.getBaseFlags() & PxBaseFlag::eOWNS_MEMORY); + PxMutex::ScopedLock lock(mRigidDynamicPoolLock); + mRigidDynamicPool.destroy(&rigidDynamic); +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: this function is here to minimize the amount of locks when deserializing a collection +void NpFactory::addCollection(const Collection& collection) +{ + PxU32 nb = collection.getNbObjects(); + const PxPair* entries = collection.internalGetObjects(); + // PT: we take the lock only once, here + PxMutex::ScopedLock lock(mTrackingMutex); + + for(PxU32 i=0;igetConcreteType(); +////////////////////////// + if(serialType==PxConcreteType::eHEIGHTFIELD) + { + Gu::HeightField* gu = static_cast(s); + gu->setMeshFactory(this); + addHeightField(gu, false); + } + else if(serialType==PxConcreteType::eCONVEX_MESH) + { + Gu::ConvexMesh* gu = static_cast(s); + gu->setMeshFactory(this); + addConvexMesh(gu, false); + } + else if(serialType==PxConcreteType::eTRIANGLE_MESH_BVH33 || serialType==PxConcreteType::eTRIANGLE_MESH_BVH34) + { + Gu::TriangleMesh* gu = static_cast(s); + gu->setMeshFactory(this); + addTriangleMesh(gu, false); + } + else if(serialType==PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic* np = static_cast(s); + addRigidDynamic(np, false); + } + else if(serialType==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* np = static_cast(s); + addRigidStatic(np, false); + } + else if(serialType==PxConcreteType::eSHAPE) + { + NpShape* np = static_cast(s); + addShape(np, false); + } + else if(serialType==PxConcreteType::eMATERIAL) + { + } + else if(serialType==PxConcreteType::eCONSTRAINT) + { + NpConstraint* np = static_cast(s); + addConstraint(np, false); + } + else if(serialType==PxConcreteType::eAGGREGATE) + { + NpAggregate* np = static_cast(s); + addAggregate(np, false); + + // PT: TODO: double-check this.... is it correct? + for(PxU32 j=0;jgetCurrentSizeFast();j++) + { + PxBase* actor = np->getActorFast(j); + const PxType serialType1 = actor->getConcreteType(); + + if(serialType1==PxConcreteType::eRIGID_STATIC) + addRigidStatic(static_cast(actor), false); + else if(serialType1==PxConcreteType::eRIGID_DYNAMIC) + addRigidDynamic(static_cast(actor), false); + else if(serialType1==PxConcreteType::eARTICULATION_LINK) + {} + else PX_ASSERT(0); + } + } + else if (serialType == PxConcreteType::eARTICULATION_REDUCED_COORDINATE) + { + NpArticulationReducedCoordinate* np = static_cast(s); + addArticulation(np, false); + } + else if(serialType==PxConcreteType::eARTICULATION_LINK) + { +// NpArticulationLink* np = static_cast(s); + } + else if(serialType==PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { +// NpArticulationJoint* np = static_cast(s); + } + else + { +// assert(0); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_PVD +void NpFactory::setNpFactoryListener( NpFactoryListener& inListener) +{ + mNpFactoryListener = &inListener; + addFactoryListener(inListener); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE void releaseToPool(NpRigidStatic* np) +{ + NpFactory::getInstance().releaseRigidStaticToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(NpRigidDynamic* np) +{ + NpFactory::getInstance().releaseRigidDynamicToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(NpArticulationLink* np) +{ + NpFactory::getInstance().releaseArticulationLinkToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(PxArticulationJointReducedCoordinate* np) +{ + PX_ASSERT(np->getConcreteType() == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE); + NpFactory::getInstance().releaseArticulationJointRCToPool(*static_cast(np)); +} + +static PX_FORCE_INLINE void releaseToPool(PxArticulationReducedCoordinate* np) +{ + NpFactory::getInstance().releaseArticulationToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(NpAggregate* np) +{ + NpFactory::getInstance().releaseAggregateToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(NpShape* np) +{ + NpFactory::getInstance().releaseShapeToPool(*np); +} + +static PX_FORCE_INLINE void releaseToPool(NpConstraint* np) +{ + NpFactory::getInstance().releaseConstraintToPool(*np); +} + +#if PX_SUPPORT_GPU_PHYSX +static PX_FORCE_INLINE void releaseToPool(NpSoftBody* np) +{ + NpFactory::getInstance().releaseSoftBodyToPool(*np); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +static PX_FORCE_INLINE void releaseToPool(NpFEMCloth* np) +{ + NpFactory::getInstance().releaseFEMClothToPool(*np); +} +#endif + +static PX_FORCE_INLINE void releaseToPool(NpPBDParticleSystem* np) +{ + NpFactory::getInstance().releasePBDParticleSystemToPool(*np); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +static PX_FORCE_INLINE void releaseToPool(NpFLIPParticleSystem* np) +{ + NpFactory::getInstance().releaseFLIPParticleSystemToPool(*np); +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +static PX_FORCE_INLINE void releaseToPool(NpMPMParticleSystem* np) +{ + NpFactory::getInstance().releaseMPMParticleSystemToPool(*np); +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +static PX_FORCE_INLINE void releaseToPool(NpCustomParticleSystem* np) +{ + NpFactory::getInstance().releaseCustomParticleSystemToPool(*np); +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +static PX_FORCE_INLINE void releaseToPool(NpHairSystem* np) +{ + NpFactory::getInstance().releaseHairSystemToPool(*np); +} +#endif +#endif + +template +static PX_FORCE_INLINE void NpDestroy(T* np) +{ + void* ud = np->userData; + + if(np->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + releaseToPool(np); + else + np->~T(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(np, ud); +} + +void physx::NpDestroyRigidActor(NpRigidStatic* np) { NpDestroy(np); } +void physx::NpDestroyRigidDynamic(NpRigidDynamic* np) { NpDestroy(np); } +void physx::NpDestroyAggregate(NpAggregate* np) { NpDestroy(np); } +void physx::NpDestroyShape(NpShape* np) { NpDestroy(np); } +void physx::NpDestroyConstraint(NpConstraint* np) { NpDestroy(np); } +void physx::NpDestroyArticulationLink(NpArticulationLink* np) { NpDestroy(np); } +void physx::NpDestroyArticulationJoint(PxArticulationJointReducedCoordinate* np) { NpDestroy(np); } +void physx::NpDestroyArticulation(PxArticulationReducedCoordinate* np) { NpDestroy(np); } +#if PX_SUPPORT_GPU_PHYSX +void physx::NpDestroySoftBody(NpSoftBody* np) { NpDestroy(np); } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void physx::NpDestroyFEMCloth(NpFEMCloth* np) { NpDestroy(np); } +#endif +void physx::NpDestroyParticleSystem(NpPBDParticleSystem* np) { NpDestroy(np); } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void physx::NpDestroyParticleSystem(NpFLIPParticleSystem* np) { NpDestroy(np); } +void physx::NpDestroyParticleSystem(NpMPMParticleSystem* np) { NpDestroy(np); } +void physx::NpDestroyParticleSystem(NpCustomParticleSystem* np) { NpDestroy(np); } +void physx::NpDestroyHairSystem(NpHairSystem* np) { NpDestroy(np); } +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.h new file mode 100644 index 0000000..dc22130 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpFactory.h @@ -0,0 +1,409 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_FACTORY_H +#define NP_FACTORY_H + +#include "foundation/PxPool.h" +#include "foundation/PxMutex.h" +#include "foundation/PxHashSet.h" + +#include "GuMeshFactory.h" +#include "PxPhysXConfig.h" +#include "PxShape.h" +#include "PxAggregate.h" + + +#include "NpFEMCloth.h" // to be deleted + +namespace physx +{ +class PxCudaContextManager; + +class PxActor; + +class PxRigidActor; + +class PxRigidStatic; +class NpRigidStatic; + +class PxRigidDynamic; +class NpRigidDynamic; + +class NpConnectorArray; + +struct PxConstraintShaderTable; +class PxConstraintConnector; +class PxConstraint; +class NpConstraint; + +class PxArticulationReducedCoordinate; +class NpArticulationReducedCoordinate; +class PxArticulationLink; +class NpArticulationLink; +class NpArticulationJointReducedCoordinate; + +class PxSoftBody; +class PxFEMCloth; +class PxParticleSystem; +class PxHairSystem; + +#if PX_SUPPORT_GPU_PHYSX +class NpSoftBody; +class NpFEMCloth; +class NpPBDParticleSystem; +class NpFLIPParticleSystem; +class NpMPMParticleSystem; +class NpCustomParticSystem; +class NpHairSystem; + +class NpFEMSoftBodyMaterial; +class NpFEMClothMaterial; +class NpPBDMaterial; +class NpFLIPMaterial; +class NpMPMMaterial; +class NpCustomMaterial; +#endif + +class PxMaterial; +class NpMaterial; + +class PxFEMSoftBodyMaterial; +class PxFEMClothMaterial; +class PxPBDMaterial; +class PxFLIPMaterial; +class PxMPMMaterial; + +class PxGeometry; + +class NpShape; + +class NpAggregate; + +class NpPtrTableStorageManager; + +namespace Cm +{ + class Collection; +} + +class NpFactoryListener : public Gu::MeshFactoryListener +{ +protected: + virtual ~NpFactoryListener(){} +}; + +class NpFactory : public Gu::MeshFactory +{ + PX_NOCOPY(NpFactory) +public: + NpFactory(); +private: + ~NpFactory(); + + template + NpShape* createShapeInternal(const PxGeometry& geometry, PxShapeFlags shapeFlags, PxMaterialType*const* materials, PxU16 materialCount, bool isExclusive, PxShapeCoreFlag::Enum flag); +public: + static void createInstance(); + static void destroyInstance(); + static void registerArticulations(); + static void registerArticulationRCs(); + static void onParticleBufferRelease(PxParticleBuffer* buffer); + + void release(); + + void addCollection(const Cm::Collection& collection); + + PX_INLINE static NpFactory& getInstance() { return *mInstance; } + + // Rigid dynamic + PxRigidDynamic* createRigidDynamic(const PxTransform& pose); + void addRigidDynamic(PxRigidDynamic*, bool lock=true); + void releaseRigidDynamicToPool(NpRigidDynamic&); +// PT: TODO: add missing functions +// PxU32 getNbRigidDynamics() const; +// PxU32 getRigidDynamics(PxRigidDynamic** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Rigid static + PxRigidStatic* createRigidStatic(const PxTransform& pose); + void addRigidStatic(PxRigidStatic*, bool lock=true); + void releaseRigidStaticToPool(NpRigidStatic&); +// PT: TODO: add missing functions +// PxU32 getNbRigidStatics() const; +// PxU32 getRigidStatics(PxRigidStatic** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Shapes + NpShape* createShape(const PxGeometry& geometry, PxShapeFlags shapeFlags, PxMaterial*const* materials, PxU16 materialCount, bool isExclusive); + NpShape* createShape(const PxGeometry& geometry, PxShapeFlags shapeFlags, PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount, bool isExclusive); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpShape* createShape(const PxGeometry& geometry, PxShapeFlags shapeFlags, PxFEMClothMaterial*const* materials, PxU16 materialCount, bool isExclusive); +#endif + void addShape(PxShape*, bool lock=true); + void releaseShapeToPool(NpShape&); + PxU32 getNbShapes() const; + PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Constraints + PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize); + void addConstraint(PxConstraint*, bool lock=true); + void releaseConstraintToPool(NpConstraint&); +// PT: TODO: add missing functions +// PxU32 getNbConstraints() const; +// PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Articulations + void addArticulation(PxArticulationReducedCoordinate*, bool lock=true); + void releaseArticulationToPool(PxArticulationReducedCoordinate& articulation); + PxArticulationReducedCoordinate* createArticulationRC(); + NpArticulationReducedCoordinate* createNpArticulationRC(); + + // Articulation links + NpArticulationLink* createNpArticulationLink(NpArticulationReducedCoordinate& root, NpArticulationLink* parent, const PxTransform& pose); + void releaseArticulationLinkToPool(NpArticulationLink& articulation); + PxArticulationLink* createArticulationLink(NpArticulationReducedCoordinate& root, NpArticulationLink* parent, const PxTransform& pose); + + NpArticulationJointReducedCoordinate* createNpArticulationJointRC(NpArticulationLink& parent, const PxTransform& parentFrame, NpArticulationLink& child, const PxTransform& childFrame); + void releaseArticulationJointRCToPool(NpArticulationJointReducedCoordinate& articulationJoint); + + //Soft bodys + PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager); + void releaseSoftBodyToPool(PxSoftBody& softBody); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // FEMCloth + PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager); + void releaseFEMClothToPool(PxFEMCloth& femCloth); +#endif + + //Particle systems + PxPBDParticleSystem* createPBDParticleSystem(PxU32 maxNeighborhood, PxCudaContextManager& cudaContexManager); + void releasePBDParticleSystemToPool(PxPBDParticleSystem& particleSystem); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + //Particle systems + PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContexManager); + void releaseFLIPParticleSystemToPool(PxFLIPParticleSystem& particleSystem); + + //Particle systems + PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContexManager); + void releaseMPMParticleSystemToPool(PxMPMParticleSystem& particleSystem); + + //Particle systems + PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood); + void releaseCustomParticleSystemToPool(PxCustomParticleSystem& particleSystem); +#endif + + //Particle buffers + PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager); + + //Diffuse Particle buffers + PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager); + + //Particle cloth buffers + PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager); + + //Particle rigid buffers + PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // HairSystem + PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager); + void releaseHairSystemToPool(PxHairSystem& hairSystem); +#endif + + // Aggregates + PxAggregate* createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint); + void addAggregate(PxAggregate*, bool lock=true); + void releaseAggregateToPool(NpAggregate&); +// PT: TODO: add missing functions +// PxU32 getNbAggregates() const; +// PxU32 getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex) const; + + // Materials + PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution); + void releaseMaterialToPool(NpMaterial& material); + + PxFEMSoftBodyMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction); + void releaseFEMMaterialToPool(PxFEMSoftBodyMaterial& material); + + PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction); + void releaseFEMClothMaterialToPool(PxFEMClothMaterial& material); + + PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale); + void releasePBDMaterialToPool(PxPBDMaterial& material); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal gravityScale); + void releaseFLIPMaterialToPool(PxFLIPMaterial& material); +#endif + + PxMPMMaterial* createMPMMaterial(PxReal friction, PxReal damping, PxReal adhesion, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale); + void releaseMPMMaterialToPool(PxMPMMaterial& material); + + PxCustomMaterial* createCustomMaterial(void* gpuBuffer); + void releaseCustomMaterialToPool(PxCustomMaterial& material); + + // It's easiest to track these uninvasively, so it's OK to use the Px pointers + void onActorRelease(PxActor*); + void onConstraintRelease(PxConstraint*); + void onAggregateRelease(PxAggregate*); + void onArticulationRelease(PxArticulationReducedCoordinate*); + void onShapeRelease(PxShape*); + + void addParticleBuffer(PxParticleBuffer* buffer, bool lock = true); + void onParticleBufferReleaseInternal(PxParticleBuffer* buffer); + + NpConnectorArray* acquireConnectorArray(); + void releaseConnectorArray(NpConnectorArray*); + + PX_FORCE_INLINE NpPtrTableStorageManager& getPtrTableStorageManager() { return *mPtrTableStorageManager; } + +#if PX_SUPPORT_PVD + void setNpFactoryListener( NpFactoryListener& ); +#endif + +private: + void releaseExclusiveShapeUserReferences(); + + PxPool mConnectorArrayPool; + PxMutex mConnectorArrayPoolLock; + + NpPtrTableStorageManager* mPtrTableStorageManager; + + PxHashSet mAggregateTracking; + PxHashSet mArticulationTracking; + PxHashSet mConstraintTracking; + PxHashSet mActorTracking; + PxCoalescedHashSet mShapeTracking; + PxHashSet mParticleBufferTracking; + + PxPool2 mRigidDynamicPool; + PxMutex mRigidDynamicPoolLock; + + PxPool2 mRigidStaticPool; + PxMutex mRigidStaticPoolLock; + + PxPool2 mShapePool; + PxMutex mShapePoolLock; + + PxPool2 mAggregatePool; + PxMutex mAggregatePoolLock; + + PxPool2 mConstraintPool; + PxMutex mConstraintPoolLock; + + PxPool2 mMaterialPool; + PxMutex mMaterialPoolLock; + + PxPool2 mArticulationRCPool; + PxMutex mArticulationRCPoolLock; + + PxPool2 mArticulationLinkPool; + PxMutex mArticulationLinkPoolLock; + + + PxPool2 mArticulationRCJointPool; + PxMutex mArticulationJointRCPoolLock; + +#if PX_SUPPORT_GPU_PHYSX + PxPool2 mSoftBodyPool; + PxMutex mSoftBodyPoolLock; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxPool2 mFEMClothPool; + PxMutex mFEMClothPoolLock; +#endif + + PxPool2 mPBDParticleSystemPool; + PxMutex mPBDParticleSystemPoolLock; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxPool2 mFLIPParticleSystemPool; + PxMutex mFLIPParticleSystemPoolLock; + + PxPool2 mMPMParticleSystemPool; + PxMutex mMPMParticleSystemPoolLock; + + PxPool2 mCustomParticleSystemPool; + PxMutex mCustomParticleSystemPoolLock; +#endif + + PxPool2 mFEMMaterialPool; + PxMutex mFEMMaterialPoolLock; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxPool2 mFEMClothMaterialPool; + PxMutex mFEMClothMaterialPoolLock; +#endif + PxPool2 mPBDMaterialPool; + PxMutex mPBDMaterialPoolLock; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxPool2 mFLIPMaterialPool; + PxMutex mFLIPMaterialPoolLock; + + PxPool2 mMPMMaterialPool; + PxMutex mMPMMaterialPoolLock; + + PxPool2 mCustomMaterialPool; + PxMutex mCustomMaterialPoolLock; + /*PxPool2 mFEMMaterialPool; + PxMutex mFEMMaterialPoolLock;*/ + + PxPool2 mHairSystemPool; + PxMutex mHairSystemPoolLock; +#endif +#endif + + static NpFactory* mInstance; + PxU64 mGpuMemStat; + +#if PX_SUPPORT_PVD + NpFactoryListener* mNpFactoryListener; +#endif +}; + + void NpDestroyRigidActor(NpRigidStatic* np); + void NpDestroyRigidDynamic(NpRigidDynamic* np); + void NpDestroyArticulationLink(NpArticulationLink* np); + void NpDestroyArticulationJoint(PxArticulationJointReducedCoordinate* np); + void NpDestroyArticulation(PxArticulationReducedCoordinate* artic); + void NpDestroyAggregate(NpAggregate* np); + void NpDestroyShape(NpShape* np); + void NpDestroyConstraint(NpConstraint* np); + +#if PX_SUPPORT_GPU_PHYSX + void NpDestroySoftBody(NpSoftBody* softBody); + void NpDestroyFEMCloth(NpFEMCloth* femCloth); + void NpDestroyParticleSystem(NpPBDParticleSystem* particleSystem); + void NpDestroyParticleSystem(NpFLIPParticleSystem* particleSystem); + void NpDestroyParticleSystem(NpMPMParticleSystem* particleSystem); + void NpDestroyParticleSystem(NpCustomParticleSystem* particleSystem); + void NpDestroyHairSystem(NpHairSystem* hairSystem); +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp new file mode 100644 index 0000000..7214613 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.cpp @@ -0,0 +1,1000 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "NpHairSystem.h" +#include "NpCheck.h" +#include "NpScene.h" +#include "ScHairSystemSim.h" +#include "NpFactory.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "ScBodyCore.h" +#include "ScBodySim.h" +#include "geometry/PxHairSystemDesc.h" +#include "PxsMemoryManager.h" + +#include "PxPhysXGpu.h" +#include "PxvGlobals.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaContext.h" + +using namespace physx; + +namespace physx +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpHairSystem::NpHairSystem(PxCudaContextManager& cudaContextManager) : + NpActorTemplate(PxConcreteType::eHAIR_SYSTEM, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eHAIRSYSTEM), + mCudaContextManager(&cudaContextManager), + mMemoryManager(NULL), + mHostMemoryAllocator(NULL), + mDeviceMemoryAllocator(NULL), + mRestPositionActor(NULL) + { + mCore.getShapeCore().createBuffers(&cudaContextManager); + } + + + NpHairSystem::NpHairSystem(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager) : + NpActorTemplate(baseFlags), + mCudaContextManager(&cudaContextManager), + mMemoryManager(NULL), + mHostMemoryAllocator(NULL), + mDeviceMemoryAllocator(NULL), + mRestPositionActor(NULL) + { + mCore.getShapeCore().createBuffers(&cudaContextManager); + } + + NpHairSystem::~NpHairSystem() + { + releaseAllocator(); + } + + void NpHairSystem::releaseAllocator() + { + // destroy internal buffers if they exist before destroying allocators + if(mStrandPastEndIndicesInternal.size() > 0) + mStrandPastEndIndicesInternal.reset(); + if (mPosInvMassInternal.size() > 0) + mPosInvMassInternal.reset(); + if (mVelInternal.size() > 0) + mVelInternal.reset(); + if (mParticleRigidAttachmentsInternal.size() > 0) + mParticleRigidAttachmentsInternal.reset(); + if (mRestPositionsInternal.size() > 0) + mRestPositionsInternal.reset(); + + if (mRestPositionTransformPinnedBuf.size() > 0) + { + mRestPositionTransformPinnedBuf.reset(); + mCore.getShapeCore().getLLCore().mRestPositionsTransform = NULL; + } + + if (mMemoryManager != NULL) + { + mMemoryManager->~PxsMemoryManager(); + mHostMemoryAllocator = NULL; // released by memory manager + mDeviceMemoryAllocator = NULL; // released by memory manager + PX_FREE(mMemoryManager); + } + } + + PxBounds3 NpHairSystem::getWorldBounds(float inflation) const + { + NP_READ_CHECK(getNpScene()); + + if (!getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Querying bounds of a PxHairSystem which is not part of a PxScene is not supported."); + return PxBounds3::empty(); + } + + const Sc::HairSystemSim* sim = mCore.getSim(); + PX_ASSERT(sim); + + PX_SIMD_GUARD; + + PxBounds3 bounds = sim->getBounds(); + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); + } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void NpHairSystem::visualize(PxRenderOutput& out, NpScene& scene) const + { + if(!(mCore.getActorFlags() & PxActorFlag::eVISUALIZATION)) + return; + + const Sc::Scene& scScene = scene.getScScene(); + + const bool visualizeAABBs = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_AABBS) != 0.0f; + if(visualizeAABBs) + { + out << PxU32(PxDebugColor::eARGB_YELLOW) << PxMat44(PxIdentity); + Cm::renderOutputDebugBox(out, mCore.getSim()->getBounds()); + } + } +#endif + + + void NpHairSystem::setHairSystemFlag(PxHairSystemFlag::Enum flag, bool val) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setHairSystemFlag() not allowed while simulation is running. Call will be ignored."); + + PxHairSystemFlags flags = mCore.getFlags(); + if (val) + { + flags.raise(flag); + } + else + { + flags.clear(flag); + } + mCore.setFlags(flags); + mCore.getShapeCore().getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::setReadRequestFlag(PxHairSystemData::Enum flag, bool val) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setReadRequestFlag() not allowed while simulation is running. Call will be ignored."); + + if (val) + { + mCore.getShapeCore().getLLCore().mReadRequests.raise(flag); + } + else + { + mCore.getShapeCore().getLLCore().mReadRequests.clear(flag); + } + } + + void NpHairSystem::setReadRequestFlags(PxHairSystemDataFlags flags) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setReadRequestFlag() not allowed while simulation is running. Call will be ignored."); + + mCore.getShapeCore().getLLCore().mReadRequests = flags; + } + + PxHairSystemDataFlags NpHairSystem::getReadRequestFlags() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getShapeCore().getLLCore().mReadRequests; + } + + void NpHairSystem::setPositionsInvMass(PxVec4* vertexPositionsInvMass, const PxBounds3& bounds) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(vertexPositionsInvMass != NULL, "PxHairSystem::setPositionsInvMass vertexPositionsInvMass must not be NULL.") + PX_CHECK_AND_RETURN(!((uintptr_t)static_cast(vertexPositionsInvMass) & 15), "PxHairSystem::setPositionsInvMass vertexPositionInvMass not aligned to 16 bytes"); + PX_CHECK_AND_RETURN(!bounds.isEmpty(), "PxHairSystem::setPositionsInvMass bounds must not be empty"); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + PX_CHECK_AND_RETURN(llCore.mNumVertices > 0, "PxHairSystem::setPositionsInvMass numVertices must be greater than zero. Use setTopology().") + PX_CHECK_AND_RETURN(llCore.mNumStrands > 0, "PxHairSystem::setPositionsInvMass numStrands must be greater than zero. Use setTopology().") + PX_CHECK_AND_RETURN(llCore.mStrandPastEndIndices != NULL, "PxHairSystem::setPositionsInvMass StrandPastEndIndices are not set. Use setTopology().") + + setLlGridSize(bounds); + + llCore.mPositionInvMass = vertexPositionsInvMass; + + // release internal buffers if they're not needed anymore + if (vertexPositionsInvMass != mPosInvMassInternal.begin()) + mPosInvMassInternal.reset(); + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePOSITIONS_VELOCITIES_MASS | + Dy::HairSystemDirtyFlag::eGRID_SIZE; + } + + void NpHairSystem::setVelocities(PxVec4* vertexVelocities) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(vertexVelocities != NULL, "PxHairSystem::setVelocities vertexVelocities must not be NULL.") + PX_CHECK_AND_RETURN(!((uintptr_t)static_cast(vertexVelocities) & 15), "PxHairSystem::setVelocities vertexVelocities not aligned to 16 bytes"); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + PX_CHECK_AND_RETURN(llCore.mNumVertices > 0, "PxHairSystem::setPositionsInvMass numVertices must be greater than zero. Use setTopology().") + + // release internal buffers if they're not needed anymore + if (vertexVelocities != mVelInternal.begin()) + mVelInternal.reset(); + + llCore.mVelocity = vertexVelocities; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePOSITIONS_VELOCITIES_MASS; + } + + void NpHairSystem::setBendingRestAngles(const PxReal* bendingRestAngles, PxReal bendingCompliance) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + PX_CHECK_AND_RETURN(bendingRestAngles || llCore.mRestPositions, "PxHairSystem::setBendingRestAngles() NULL bendingRestAngles only allowed if restPositions have been set."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setBendingRestAngles() not allowed while simulation is running. Call will be ignored."); + + llCore.mBendingRestAngles = bendingRestAngles; + llCore.mParams.mBendingCompliance = bendingCompliance; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eBENDING_REST_ANGLES | Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::setTwistingCompliance(PxReal twistingCompliance) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setTwistingCompliance() not allowed while simulation is running. Call will be ignored.") + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mParams.mTwistingCompliance = twistingCompliance; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::getTwistingRestPositions(PxReal* buffer) + { + NP_READ_CHECK(getNpScene()); + + PxScopedCudaLock lock(*mCudaContextManager); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + mCudaContextManager->getCudaContext()->memcpyDtoH(buffer, + reinterpret_cast(llCore.mTwistingRestPositionsGpuSim), + sizeof(float) * llCore.mNumVertices); + } + + void NpHairSystem::setWakeCounter(PxReal wakeCounterValue) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setWakeCounter() not allowed while simulation is running. Call will be ignored.") + + mCore.setWakeCounter(wakeCounterValue); + mCore.getShapeCore().getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getWakeCounter() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getWakeCounter(); + } + + bool NpHairSystem::isSleeping() const + { + NP_READ_CHECK(getNpScene()); + return mCore.isSleeping(); + } + + void NpHairSystem::setSolverIterationCounts(PxU32 iters) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(iters > 0, "PxHairSystem::setSolverIterationCounts: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(iters <= 255, "PxHairSystem::setSolverIterationCounts: positionIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxHairSystem::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.") + + mCore.setSolverIterationCounts(static_cast(iters)); + } + + PxU32 NpHairSystem::getSolverIterationCounts() const + { + NP_READ_CHECK(getNpScene()); + + PxU16 x = mCore.getSolverIterationCounts(); + return x; + } + + void NpHairSystem::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if(mRestPositionActor) + { + removeRigidAttachment(mRestPositionActor); + mRestPositionActor = NULL; + } + + if (npScene) + { + npScene->scRemoveHairSystem(*this); + npScene->removeFromHairSystemList(*this); + } + + // detachShape(); + + PX_ASSERT(!isAPIWriteForbidden()); + + mCore.getShapeCore().releaseBuffers(); + releaseAllocator(); + NpDestroyHairSystem(this); + } + + void NpHairSystem::addRigidAttachment(const PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "PxHairSystem::addRigidAttachment: Hair system must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor != NULL && actor->getScene() != NULL), "PxHairSystem::addRigidAttachment: Actor invalid or not part of a scene."); + PX_CHECK_AND_RETURN(getScene() == actor->getScene(), "PxHairSystem::addRigidAttachment: Actor and hair must be part of the same scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxHairSystem::addRigidAttachment: Illegal to call while simulation is running."); + + const Sc::BodyCore* attachmentBodyCore = NULL; + const PxActorType::Enum actorType = actor->getType(); + switch (actorType) + { + case PxActorType::eRIGID_STATIC: + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxHairSystem::addRigidAttachment does not support attachments to static actors. Use attachment to world (NULL) instead."); + break; + } + case PxActorType::eRIGID_DYNAMIC: + { + const NpRigidDynamic* dyn = static_cast(actor); + attachmentBodyCore = &dyn->getCore(); + break; + } + case PxActorType::eARTICULATION_LINK: + { + const NpArticulationLink* link = static_cast(actor); + attachmentBodyCore = &link->getCore(); + break; + } + default: + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxHairSystem::addRigidAttachment Unknown actor type. Must be a rigid dynamic or an articulation link"); + } + } + + PX_CHECK_AND_RETURN(attachmentBodyCore != NULL, "PxHairSystem::addRigidAttachment: Attachment body must be rigid dynamic or articulation."); + + if(attachmentBodyCore != NULL) + { + mCore.addRigidAttachment(attachmentBodyCore); + } +} + + void NpHairSystem::removeRigidAttachment(const PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "PxHairSystem::removeRigidAttachment: Hair system must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor != NULL && actor->getScene() != NULL), "PxHairSystem::removeRigidAttachment: Actor invalid or not part of a scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxHairSystem::removeRigidAttachment: Illegal to call while simulation is running."); + + const Sc::BodyCore* attachmentBodyCore = NULL; + const PxActorType::Enum actorType = actor->getType(); + switch (actorType) + { + case PxActorType::eRIGID_DYNAMIC: + { + const NpRigidDynamic* dyn = static_cast(actor); + attachmentBodyCore = &dyn->getCore(); + break; + } + case PxActorType::eARTICULATION_LINK: + { + const NpArticulationLink* link = static_cast(actor); + attachmentBodyCore = &link->getCore(); + break; + } + default: + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxHairSystem::removeRigidAttachment Invalid actor type"); + } + } + + if(attachmentBodyCore != NULL) + { + mCore.removeRigidAttachment(attachmentBodyCore); + } + } + + void NpHairSystem::setRigidAttachments(PxParticleRigidAttachment* attachments, PxU32 numAttachments, bool isGpuPtr) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "PxHairSystem::setRigidAttachments: Hair system must be inserted into the scene."); + PX_CHECK_AND_RETURN(attachments != NULL || numAttachments == 0, "PxHairSystem::setRigidAttachments: attachments must not be NULL if numAttachments > 0."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxHairSystem::setRigidAttachments: Illegal to call while simulation is running."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mNumRigidAttachments = numAttachments; + + if(!isGpuPtr) + { + // create fresh buffer + mParticleRigidAttachmentsInternal.reset(); + createAllocator(); + mParticleRigidAttachmentsInternal.setAllocatorCallback(mDeviceMemoryAllocator); + mParticleRigidAttachmentsInternal.allocate(numAttachments); + llCore.mRigidAttachments = mParticleRigidAttachmentsInternal.begin(); + + // copy H2D + PxScopedCudaLock lock(*mCudaContextManager); + PxCUresult result = mCudaContextManager->getCudaContext()->memcpyHtoD(reinterpret_cast(llCore.mRigidAttachments), attachments, + sizeof(PxParticleRigidAttachment) * numAttachments); + + PX_ASSERT(result == 0); + PX_UNUSED(result); + } + else if (mParticleRigidAttachmentsInternal.begin() != attachments) + { + mParticleRigidAttachmentsInternal.reset(); + llCore.mRigidAttachments = attachments; + } + // Don't clear mParticleRigidAttachmentsInternal if isGpuPtr==true and user has passed in the same pointer again + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eATTACHMENT; + } + + PxParticleRigidAttachment* NpHairSystem::getRigidAttachmentsGpu(PxU32* numAttachments) + { + NP_READ_CHECK(getNpScene()); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + if(numAttachments) + *numAttachments = llCore.mNumRigidAttachments; + return llCore.mRigidAttachments; + } + + void NpHairSystem::setRestPositions(PxVec4* restPos, bool isGpuPtr, const PxTransform& transf, const PxRigidBody* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "PxHairSystem::setRestPositions: Actor invalid or not part of a scene."); + PX_CHECK_AND_RETURN((actor == NULL || getScene() == actor->getScene()), "PxHairSystem::setRestPositions: Actor and hair must be part of the same scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxHairSystem::setRestPositions: Illegal to call while simulation is running."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + if(restPos) + { + if(!isGpuPtr) + { + // create fresh buffer + mRestPositionsInternal.reset(); + createAllocator(); + mRestPositionsInternal.setAllocatorCallback(mDeviceMemoryAllocator); + mRestPositionsInternal.allocate(llCore.mNumVertices); + llCore.mRestPositions = mRestPositionsInternal.begin(); + + // copy H2D + PxScopedCudaLock lock(*mCudaContextManager); + mCudaContextManager->getCudaContext()->memcpyHtoD(reinterpret_cast(llCore.mRestPositions), restPos, + sizeof(PxVec4) * llCore.mNumVertices); + } + else if (mRestPositionsInternal.begin() != restPos) + { + mRestPositionsInternal.reset(); + llCore.mRestPositions = restPos; + } + // Don't clear mRestPositionsInternal if isGpuPtr==true and user has passed in the same pointer again + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eREST_POSITIONS; + } + + if(llCore.mRestPositionsTransform == NULL) + { + createAllocator(); + mRestPositionTransformPinnedBuf.setAllocatorCallback(mHostMemoryAllocator); + mRestPositionTransformPinnedBuf.allocate(1); + llCore.mRestPositionsTransform = mRestPositionTransformPinnedBuf.begin(); + } + *llCore.mRestPositionsTransform = transf; + + // update actor relative to which the positions are specified + if(mRestPositionActor && actor != mRestPositionActor) + { + removeRigidAttachment(mRestPositionActor); + mRestPositionActor = NULL; + llCore.mRestPositionBodyNodeIdx = PxNodeIndex().getInd(); + } + if(actor && actor != mRestPositionActor) + { + addRigidAttachment(actor); // ensure actor is in the same island + mRestPositionActor = actor; + llCore.mRestPositionBodyNodeIdx = actor->getInternalIslandNodeIndex().getInd(); + } + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eREST_POSITION_TRANSFORM; + } + + PxVec4* NpHairSystem::getRestPositionsGpu(PxTransform* transf) + { + NP_READ_CHECK(getNpScene()); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + if(transf) + *transf = *llCore.mRestPositionsTransform; + return llCore.mRestPositions; + } + + void NpHairSystem::setLlGridSize(const PxBounds3& bounds) + { + // give system some space to expand: create a grid twice the initial size + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + const PxVec3 dimensions = bounds.getDimensions(); + const PxReal maxXZ = PxMax(dimensions.x, dimensions.z); // rotations in plane perpendicular to gravity are very likely + const PxReal cellSize = llCore.mParams.getCellSize(); + llCore.mParams.mGridSize[0] = 2 * PxNextPowerOfTwo(1u + static_cast(maxXZ / cellSize)); + llCore.mParams.mGridSize[1] = 2 * PxNextPowerOfTwo(1u + static_cast(dimensions.y / cellSize)); + llCore.mParams.mGridSize[2] = llCore.mParams.mGridSize[0]; + + if (static_cast(dimensions.maxElement() / cellSize) > 512) + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Grid of hair system appears very large. Double check ratio of segment" + " length to extent of the hair system defined by the vertices."); + } + + void NpHairSystem::createAllocator() + { + if (!mMemoryManager) + { + PxPhysXGpu* physXGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physXGpu != NULL); + + mMemoryManager = physXGpu->createGpuMemoryManager(mCudaContextManager); + mHostMemoryAllocator = mMemoryManager->getHostMemoryAllocator(); + mDeviceMemoryAllocator = mMemoryManager->getDeviceMemoryAllocator(); + } + PX_ASSERT(mMemoryManager != NULL); + PX_ASSERT(mHostMemoryAllocator != NULL); + PX_ASSERT(mDeviceMemoryAllocator != NULL); + } + + void NpHairSystem::initFromDesc(const PxHairSystemDesc& desc) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(desc.isValid(), "PxHairSystem::initFromDesc desc is not valid."); + PX_ASSERT(mCudaContextManager != NULL); + + // destroy internal buffers if they exist because we might switch allocators + if(mStrandPastEndIndicesInternal.size() > 0) + mStrandPastEndIndicesInternal.reset(); + if (mPosInvMassInternal.size() > 0) + mPosInvMassInternal.reset(); + if (mVelInternal.size() > 0) + mVelInternal.reset(); + + // create internal buffers + createAllocator(); + if (desc.flags.isSet(PxHairSystemDescFlag::eDEVICE_MEMORY)) + { + mPosInvMassInternal.setAllocatorCallback(mDeviceMemoryAllocator); + mVelInternal.setAllocatorCallback(mDeviceMemoryAllocator); + mStrandPastEndIndicesInternal.setAllocatorCallback(mDeviceMemoryAllocator); + } + else + { + mPosInvMassInternal.setAllocatorCallback(mHostMemoryAllocator); + mVelInternal.setAllocatorCallback(mHostMemoryAllocator); + mStrandPastEndIndicesInternal.setAllocatorCallback(mHostMemoryAllocator); + } + + PxScopedCudaLock lock(*mCudaContextManager); + + // StrandPastEndIndices + MemoryWithAlloc strandPastEndIndicesLocal; + strandPastEndIndicesLocal.setAllocatorCallback(mHostMemoryAllocator); + strandPastEndIndicesLocal.allocate(desc.numStrands); + const PxU32* hostStrandPastEndIndices = strandPastEndIndicesLocal.begin(); + PxU32 numVertices = 0; + for (PxU32 strandIdx = 0; strandIdx < desc.numStrands; strandIdx++) + { + numVertices += desc.numVerticesPerStrand.at(strandIdx); + strandPastEndIndicesLocal[strandIdx] = numVertices; + } + if (desc.flags.isSet(PxHairSystemDescFlag::eDEVICE_MEMORY)) + { + mStrandPastEndIndicesInternal.allocate(desc.numStrands); + mCudaContextManager->getCudaContext()->memcpyHtoD( + reinterpret_cast(mStrandPastEndIndicesInternal.begin()), + strandPastEndIndicesLocal.begin(), desc.numStrands * sizeof(PxU32)); + } + else + { + strandPastEndIndicesLocal.swap(mStrandPastEndIndicesInternal); + } + + // positions, velocities + const bool onlyRootPositionsGiven = desc.numStrands == desc.vertices.count; + const bool velocitiesGiven = desc.velocities.count > 0; + + MemoryWithAlloc posInvMassLocal, velLocal; + posInvMassLocal.setAllocatorCallback(mHostMemoryAllocator); + posInvMassLocal.allocate(numVertices); + velLocal.setAllocatorCallback(mHostMemoryAllocator); + velLocal.allocate(numVertices); + + PxBounds3 bounds = PxBounds3::empty(); + PxU32 overallVertexIdx = 0; + for (PxU32 strandIdx = 0; strandIdx < desc.numStrands; strandIdx++) + { + for (; overallVertexIdx < hostStrandPastEndIndices[strandIdx]; overallVertexIdx++) + { + const PxU32 inputVertexIdx = onlyRootPositionsGiven ? strandIdx : overallVertexIdx; + posInvMassLocal[overallVertexIdx] = desc.vertices.at(inputVertexIdx); + velLocal[overallVertexIdx] = velocitiesGiven ? desc.velocities.at(overallVertexIdx) : PxVec4(PxZero); + bounds.include(desc.vertices.at(inputVertexIdx).getXYZ()); + } + } + PX_ASSERT(overallVertexIdx == numVertices); + if (desc.flags.isSet(PxHairSystemDescFlag::eDEVICE_MEMORY)) + { + mPosInvMassInternal.allocate(numVertices); + mVelInternal.allocate(numVertices); + + mCudaContextManager->getCudaContext()->memcpyHtoD( + reinterpret_cast(mPosInvMassInternal.begin()), + posInvMassLocal.begin(), numVertices * sizeof(PxVec4)); + mCudaContextManager->getCudaContext()->memcpyHtoD( + reinterpret_cast(mVelInternal.begin()), + velLocal.begin(), numVertices * sizeof(PxVec4)); + } + else + { + posInvMassLocal.swap(mPosInvMassInternal); + velLocal.swap(mVelInternal); + } + + setTopology(mPosInvMassInternal.begin(), mVelInternal.begin(), mStrandPastEndIndicesInternal.begin(), + desc.segmentLength, desc.segmentRadius, numVertices, desc.numStrands, bounds); + } + + void NpHairSystem::setTopology(PxVec4* vertexPositionsInvMass, PxVec4* vertexVelocities, const PxU32* strandPastEndIndices, + PxReal segmentLength, PxReal segmentRadius, PxU32 numVertices, PxU32 numStrands, const PxBounds3& bounds) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(numVertices > 0, "PxHairSystem::setTopology numVertices must be greater than zero"); + PX_CHECK_AND_RETURN(numStrands > 0, "PxHairSystem::setTopology numStrands must be greater than zero"); + PX_CHECK_AND_RETURN(segmentLength > 0.0f, "PxHairSystem::setTopology segmentLength must be greater than zero"); + PX_CHECK_AND_RETURN(segmentRadius > 0.0f, "PxHairSystem::setTopology segmentRadius must be greater than zero"); + PX_CHECK_AND_RETURN(2.0f * segmentRadius < segmentLength, "PxHairSystem::setTopology segmentRadius must be smaller than half of segmentLength. Call ignored"); + PX_CHECK_AND_RETURN(!bounds.isEmpty(), "PxHairSystem::setTopology bounds must not be empty"); + PX_CHECK_AND_RETURN((vertexPositionsInvMass != NULL && vertexVelocities != NULL), "PxHairSystem::setTopology positions and velocities must not be NULL") + PX_CHECK_AND_RETURN(!((uintptr_t)static_cast(vertexPositionsInvMass) & 15), "PxHairSystem::setTopology vertexPositionInvMass not aligned to 16 bytes"); + PX_CHECK_AND_RETURN(!((uintptr_t)static_cast(vertexVelocities) & 15), "PxHairSystem::setTopology vertexVelocities not aligned to 16 bytes"); + PX_CHECK_AND_RETURN(numVertices < (1 << 24), "PxHairSystem::setTopology numVertices must be smaller than 1<<24"); // due to encoding compressedVtxIndex with hairsystem index + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + // release internal buffers if they're not needed anymore + if (vertexPositionsInvMass != mPosInvMassInternal.begin()) + mPosInvMassInternal.reset(); + if (vertexVelocities != mVelInternal.begin()) + mVelInternal.reset(); + if (strandPastEndIndices != mStrandPastEndIndicesInternal.begin()) + mStrandPastEndIndicesInternal.reset(); + + llCore.mParams.mSegmentLength = segmentLength; + setSegmentRadius(segmentRadius); + llCore.mParams.mSegmentRadius = segmentRadius; + llCore.mNumVertices = numVertices; + llCore.mNumStrands = numStrands; + llCore.mStrandPastEndIndices = strandPastEndIndices; + llCore.mPositionInvMass = vertexPositionsInvMass; + llCore.mVelocity = vertexVelocities; + + // reset rest positions + llCore.mRestPositions = NULL; + setRestPositions(NULL, false, PxTransform(PxIdentity), NULL); + + setLlGridSize(bounds); + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eNUM_STRANDS_OR_VERTS | + Dy::HairSystemDirtyFlag::ePOSITIONS_VELOCITIES_MASS | Dy::HairSystemDirtyFlag::ePARAMETERS | + Dy::HairSystemDirtyFlag::eSTRAND_LENGTHS | Dy::HairSystemDirtyFlag::eGRID_SIZE; + } + + void NpHairSystem::setLevelOfDetailGradations(const PxReal* proportionOfStrands, const PxReal* proportionOfVertices, + PxU32 numLevels) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(numLevels > 0, "PxHairSystem::defineLevelOfDetailGradations Must specify at least one level."); + for (PxU32 i = 0; i < numLevels; i++) + { + PX_CHECK_AND_RETURN(proportionOfStrands[i] <= 1.0f && proportionOfStrands[i] > 0.0f, "PxHairSystem::defineLevelOfDetailGradations proportionOfStrands must be in (0, 1] "); + PX_CHECK_AND_RETURN(proportionOfVertices[i] <= 1.0f && proportionOfVertices[i] > 0.0f, "PxHairSystem::defineLevelOfDetailGradations proportionOfStrands must be in (0, 1] "); + } + + // deep copy because user buffers may go out of scope / deallocate + mLodProportionOfStrands.assign(proportionOfStrands, proportionOfStrands + numLevels); + mLodProportionOfVertices.assign(proportionOfVertices, proportionOfVertices + numLevels); + + // TODO(jcarius) check that hair system is initialized already + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mLodNumLevels = numLevels; + llCore.mLodProportionOfStrands = mLodProportionOfStrands.begin(); + llCore.mLodProportionOfVertices = mLodProportionOfVertices.begin(); + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eLOD_DATA; + + // in case the level that we were on got removed switch to closest one + if(llCore.mLodLevel > numLevels) + { + llCore.mLodLevel = numLevels; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eLOD_SWITCH; + } + } + + void NpHairSystem::setLevelOfDetail(PxU32 level) + { + NP_WRITE_CHECK(getNpScene()); + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + PX_CHECK_AND_RETURN(level == 0 || llCore.mLodNumLevels >= level, "PxHairSystem::setLevelOfDetail Invalid level given"); + + llCore.mLodLevel = level; + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eLOD_SWITCH; + } + + PxU32 NpHairSystem::getLevelOfDetail(PxU32* numLevels) const + { + NP_READ_CHECK(getNpScene()); + if(numLevels != NULL) + { + *numLevels = mCore.getShapeCore().getLLCore().mLodNumLevels; + } + return mCore.getShapeCore().getLLCore().mLodLevel; + } + + void NpHairSystem::setName(const char* debugName) + { + NP_WRITE_CHECK(getNpScene()); + mName = debugName; + } + + const char* NpHairSystem::getName() const + { + NP_READ_CHECK(getNpScene()); + return mName; + } + + void NpHairSystem::getSegmentDimensions(PxReal& length, PxReal& radius) const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + length = llCore.mParams.mSegmentLength; + radius = llCore.mParams.mSegmentRadius; + } + + void NpHairSystem::setSegmentRadius(PxReal radius) + { + NP_WRITE_CHECK(getNpScene()); + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + PX_CHECK_AND_RETURN(2.0f * radius < llCore.mParams.mSegmentLength, "PxHairSystem::setSegmentRadius radius must be smaller than half of segment length. Call ignored"); + + llCore.mParams.mSegmentRadius = radius; + mCore.setContactOffset(2.0f * radius); // sensible default + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::setWind(const PxVec3& wind) + { + NP_WRITE_CHECK(getNpScene()); + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + PxVec3 windNormalized = wind; + const PxReal magnitude = windNormalized.normalize(); + llCore.mWind = PxVec4(windNormalized, magnitude); + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxVec3 NpHairSystem::getWind() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mWind.getXYZ() * llCore.mWind.w; + } + + void NpHairSystem::setFrictionParameters(PxReal interHairVelDamping, PxReal frictionCoeff) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(interHairVelDamping >= 0.0f, "PxHairSystem::setFrictionParameters interHairVelDamping must be greater or equal zero."); + PX_CHECK_AND_RETURN(interHairVelDamping <= 1.0f, "PxHairSystem::setFrictionParameters interHairVelDamping must be smaller or equal one."); + PX_CHECK_AND_RETURN(frictionCoeff >= 0.0f, "PxHairSystem::setFrictionParameters frictionCoeff must be greater or equal zero."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + + llCore.mParams.mInterHairVelocityDamping = interHairVelDamping; + llCore.mParams.mFrictionCoeff = frictionCoeff; + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::getFrictionParameters(PxReal& interHairVelDamping, PxReal& frictionCoeff) const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + interHairVelDamping = llCore.mParams.mInterHairVelocityDamping; + frictionCoeff = llCore.mParams.mFrictionCoeff; + } + + void NpHairSystem::setShapeCompliance(PxReal startCompliance, PxReal strandRatio) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(strandRatio >= 0.0f, "PxHairSystem::setShapeCompliance strandRatio must not be negative."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + PX_CHECK_AND_RETURN(llCore.mRestPositions, "PxHairSystem::setShapeCompliance restPositions must be set before enabling shape compliance"); + + llCore.mParams.mShapeCompliance[0] = startCompliance; + llCore.mParams.mShapeCompliance[1] = strandRatio; + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void NpHairSystem::getShapeCompliance(PxReal& startCompliance, PxReal& strandRatio) const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + startCompliance = llCore.mParams.mShapeCompliance[0]; + strandRatio = llCore.mParams.mShapeCompliance[1]; + } + + void NpHairSystem::setInterHairRepulsion(PxReal repulsion) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(repulsion >= 0.0f, "PxHairSystem::setInterHairRepulsion repulsion must not be negative."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mParams.mInterHairRepulsion = repulsion; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getInterHairRepulsion() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mParams.mInterHairRepulsion; + } + + void NpHairSystem::setSelfCollisionRelaxation(PxReal relaxation) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(relaxation > 0.0f, "PxHairSystem::setSelfCollisionRelaxation relaxation must be greater zero."); + PX_CHECK_AND_RETURN(relaxation <= 1.0f, "PxHairSystem::setSelfCollisionRelaxation relaxation must not be greater 1.0."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mParams.mSelfCollisionRelaxation = relaxation; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getSelfCollisionRelaxation() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mParams.mSelfCollisionRelaxation; + } + + void NpHairSystem::setStretchingRelaxation(PxReal relaxation) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(relaxation > 0.0f, "PxHairSystem::setStretchingRelaxation relaxation must be greater zero."); + PX_CHECK_AND_RETURN(relaxation <= 1.0f, "PxHairSystem::setStretchingRelaxation relaxation must not be greater 1.0."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mParams.mLraRelaxation = relaxation; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getStretchingRelaxation() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mParams.mLraRelaxation; + } + + void NpHairSystem::setContactOffset(PxReal contactOffset) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(contactOffset >= 0.0f, "PxHairSystem::setContactOffset contactOffset must not be negative."); + + mCore.setContactOffset(contactOffset); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getContactOffset() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getContactOffset(); + } + + void NpHairSystem::setHairContactOffset(PxReal hairContactOffset) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(hairContactOffset >= 1.0f, "PxHairSystem::setHairContactOffset hairContactOffset must not be below 1.0."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + llCore.mParams.mSelfCollisionContactDist = hairContactOffset; + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxReal NpHairSystem::getHairContactOffset() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mParams.mSelfCollisionContactDist; + } + + void NpHairSystem::setShapeMatchingParameters(PxReal compliance, PxReal linearStretching, + PxU16 numVerticesPerGroup, PxU16 numVerticesOverlap) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(linearStretching >= 0.0f, "PxHairSystem::setShapeMatchingParameters linearStretching must not be below 0.0."); + PX_CHECK_AND_RETURN(linearStretching <= 1.0f, "PxHairSystem::setShapeMatchingParameters linearStretching must not be above 1.0."); + PX_CHECK_AND_RETURN(numVerticesPerGroup > 1, "PxHairSystem::setShapeMatchingParameters numVerticesPerGroup must be greater 1."); + PX_CHECK_AND_RETURN(numVerticesPerGroup >= 2 * numVerticesOverlap, "PxHairSystem::setShapeMatchingParameters numVerticesOverlap must at most be numVerticesPerGroup/2."); + + Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + PX_CHECK_AND_RETURN(llCore.mRestPositions, "PxHairSystem::setShapeMatchingParameters restPositions must be set before enabling shape compliance"); + + llCore.mParams.mShapeMatchingCompliance = compliance; + llCore.mParams.mShapeMatchingBeta = linearStretching; + llCore.mParams.mShapeMatchingNumVertsPerGroup = numVerticesPerGroup; + llCore.mParams.mShapeMatchingNumVertsOverlap = numVerticesOverlap; + + llCore.mDirtyFlags |= Dy::HairSystemDirtyFlag::eSHAPE_MATCHING_SIZES; + } + + PxReal NpHairSystem::getShapeMatchingCompliance() const + { + NP_READ_CHECK(getNpScene()); + const Dy::HairSystemCore& llCore = mCore.getShapeCore().getLLCore(); + return llCore.mParams.mShapeMatchingCompliance; + } +#endif +} // namespace physx + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.h new file mode 100644 index 0000000..cd5c84e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpHairSystem.h @@ -0,0 +1,275 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef NP_HAIR_SYSTEM_H +#define NP_HAIR_SYSTEM_H + +#include "foundation/PxPreprocessor.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxHairSystem.h" +#include "ScHairSystemCore.h" +#include "NpActorTemplate.h" + +namespace physx +{ + class NpScene; + class NpShape; + + class NpHairSystem : public NpActorTemplate + { + public: + template + class MemoryWithAlloc + { + PX_NOCOPY(MemoryWithAlloc) + public: + MemoryWithAlloc() : mData(NULL), mSize(0), mAlloc(NULL) {} + + ~MemoryWithAlloc() + { + deallocate(); + } + + void allocate(uint32_t size) + { + if (size == mSize) + return; + + deallocate(); + if (size > 0) + { + mData = reinterpret_cast(mAlloc->allocate(sizeof(T) * size, 0, __FILE__, __LINE__)); + if (mData != NULL) + mSize = size; + } + else + { + mData = NULL; + mSize = 0; + } + } + + void setAllocatorCallback(physx::PxVirtualAllocatorCallback* cb) + { + if (mSize > 0) + { + deallocate(); + } + mAlloc = cb; + } + + void reset() + { + if (mSize > 0) + { + deallocate(); + } + } + + void swap(MemoryWithAlloc& other) + { + physx::PxSwap(mData, other.mData); + physx::PxSwap(mSize, other.mSize); + physx::PxSwap(mAlloc, other.mAlloc); + } + + uint32_t size() const + { + return mSize; + } + + const T& operator[](uint32_t i) const + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + T& operator[](uint32_t i) + { + PX_ASSERT(i < mSize); + return mData[i]; + } + + const T* begin() const + { + return mData; + } + + T* begin() + { + return mData; + } + + private: + void deallocate() + { + if (mSize > 0) + { + mAlloc->deallocate(mData); + mSize = 0; + } + } + + private: + T* mData; + uint32_t mSize; + physx::PxVirtualAllocatorCallback* mAlloc; + }; + + public: + NpHairSystem(PxCudaContextManager& cudaContextManager); + NpHairSystem(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager); + + virtual ~NpHairSystem() PX_OVERRIDE; + + // external API + virtual void release() PX_OVERRIDE; + + virtual PxActorType::Enum getType() const PX_OVERRIDE { return PxActorType::eHAIRSYSTEM; } + + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const PX_OVERRIDE; + + virtual void setHairSystemFlag(PxHairSystemFlag::Enum flag, bool val) PX_OVERRIDE; + virtual void setHairSystemFlags(PxHairSystemFlags flags) PX_OVERRIDE { mCore.setFlags(flags); } + virtual PxHairSystemFlags getHairSystemFlags() const PX_OVERRIDE { return mCore.getFlags(); } + + virtual void setReadRequestFlag(PxHairSystemData::Enum flag, bool val) PX_OVERRIDE; + virtual void setReadRequestFlags(PxHairSystemDataFlags flags) PX_OVERRIDE; + virtual PxHairSystemDataFlags getReadRequestFlags() const PX_OVERRIDE; + + virtual void setBendingRestAngles(const PxReal* bendingRestAngles, PxReal bendingCompliance) PX_OVERRIDE; + + virtual void setTwistingCompliance(PxReal twistingCompliance) PX_OVERRIDE; + virtual void getTwistingRestPositions(PxReal* buffer) PX_OVERRIDE; + + virtual PxCudaContextManager* getCudaContextManager() const PX_OVERRIDE { return mCudaContextManager; } + + virtual void setWakeCounter(PxReal wakeCounterValue) PX_OVERRIDE; + virtual PxReal getWakeCounter() const PX_OVERRIDE; + virtual bool isSleeping() const PX_OVERRIDE; + + virtual void setRestPositions(PxVec4* restPos, bool isGpuPtr, const PxTransform& transf, const PxRigidBody* actor) PX_OVERRIDE; + virtual PxVec4* getRestPositionsGpu(PxTransform* transf) PX_OVERRIDE; + + virtual void addRigidAttachment(const PxRigidActor* actor) PX_OVERRIDE; + virtual void removeRigidAttachment(const PxRigidActor* actor) PX_OVERRIDE; + virtual void setRigidAttachments(PxParticleRigidAttachment* attachments, PxU32 numAttachments, bool isGpuPtr) PX_OVERRIDE; + virtual PxParticleRigidAttachment* getRigidAttachmentsGpu(PxU32* numAttachments = NULL) PX_OVERRIDE; + + virtual void initFromDesc(const PxHairSystemDesc& desc) PX_OVERRIDE; + + virtual void setTopology(PxVec4* vertexPositionsInvMass, PxVec4* vertexVelocities, + const PxU32* strandPastEndIndices, PxReal segmentLength, PxReal segmentRadius, PxU32 numVertices, + PxU32 numStrands, const PxBounds3& bounds) PX_OVERRIDE; + + virtual void setLevelOfDetailGradations(const PxReal* proportionOfStrands, const PxReal* proportionOfVertices, PxU32 numLevels) PX_OVERRIDE; + virtual void setLevelOfDetail(PxU32 level) PX_OVERRIDE; + virtual PxU32 getLevelOfDetail(PxU32* numLevels) const PX_OVERRIDE; + + virtual void setPositionsInvMass(PxVec4* vertexPositionsInvMass, const PxBounds3& bounds) PX_OVERRIDE; + virtual PxVec4* getPositionInvMass() PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mPositionInvMass; } + virtual const PxVec4* getPositionInvMass() const PX_OVERRIDE{ return mCore.getShapeCore().getLLCore().mPositionInvMass; } + virtual const PxVec4* getPositionInvMassGpuSim() const PX_OVERRIDE{ return mCore.getShapeCore().getLLCore().mPositionInvMassGpuSim; } + + virtual void setVelocities(PxVec4* vertexVelocities) PX_OVERRIDE; + virtual PxVec4* getVelocities() PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mVelocity; } + virtual const PxVec4* getVelocities() const PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mVelocity; } + + virtual PxU32 getNumVertices() const PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mNumVertices; } + virtual PxU32 getNumStrands() const PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mNumStrands; } + virtual const PxU32* getStrandPastEndIndices() const PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mStrandPastEndIndices; } + virtual const PxU32* getStrandPastEndIndicesGpuSim() const PX_OVERRIDE { return mCore.getShapeCore().getLLCore().mStrandPastEndIndicesGpuSim; } + + virtual void setSolverIterationCounts(PxU32 iters) PX_OVERRIDE; + virtual PxU32 getSolverIterationCounts() const PX_OVERRIDE; + virtual void setWind(const PxVec3& wind) PX_OVERRIDE; + virtual PxVec3 getWind() const PX_OVERRIDE; + virtual void setSegmentRadius(PxReal radius) PX_OVERRIDE; + virtual void getSegmentDimensions(PxReal& length, PxReal& radius) const PX_OVERRIDE; + virtual void setFrictionParameters(PxReal interHairVelDamping, PxReal frictionCoeff) PX_OVERRIDE; + virtual void getFrictionParameters(PxReal& interHairVelDamping, PxReal& frictionCoeff) const PX_OVERRIDE; + virtual void setShapeCompliance(PxReal startCompliance, PxReal strandRatio) PX_OVERRIDE; + virtual void getShapeCompliance(PxReal& startCompliance, PxReal& strandRatio) const PX_OVERRIDE; + virtual void setInterHairRepulsion(PxReal repulsion) PX_OVERRIDE; + virtual PxReal getInterHairRepulsion() const PX_OVERRIDE; + virtual void setSelfCollisionRelaxation(PxReal relaxation) PX_OVERRIDE; + virtual PxReal getSelfCollisionRelaxation() const PX_OVERRIDE; + virtual void setStretchingRelaxation(PxReal relaxation) PX_OVERRIDE; + virtual PxReal getStretchingRelaxation() const PX_OVERRIDE; + virtual void setContactOffset(PxReal contactOffset) PX_OVERRIDE; + virtual PxReal getContactOffset() const PX_OVERRIDE; + virtual void setHairContactOffset(PxReal hairContactOffset) PX_OVERRIDE; + virtual PxReal getHairContactOffset() const PX_OVERRIDE; + virtual void setShapeMatchingParameters(PxReal compliance, PxReal linearStretching, PxU16 numVerticesPerGroup, PxU16 numVerticesOverlap) PX_OVERRIDE; + virtual PxReal getShapeMatchingCompliance() const PX_OVERRIDE; + +#if PX_ENABLE_DEBUG_VISUALIZATION + void visualize(PxRenderOutput& out, NpScene& npScene) const; +#endif + + PX_FORCE_INLINE const Sc::HairSystemCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::HairSystemCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpHairSystem, mCore); } + + // Debug name + void setName(const char*); + const char* getName() const; + + private: + void setLlGridSize(const PxBounds3& bounds); + void createAllocator(); + void releaseAllocator(); + + private: + Sc::HairSystemCore mCore; + PxHairSystemGeometry mGeometry; + PxCudaContextManager* mCudaContextManager; + + PxsMemoryManager* mMemoryManager; + PxVirtualAllocatorCallback* mHostMemoryAllocator; + PxVirtualAllocatorCallback* mDeviceMemoryAllocator; + + // internal buffers populated when hair system initialized from desc instead of user-provided buffers + MemoryWithAlloc mPosInvMassInternal; + MemoryWithAlloc mVelInternal; + MemoryWithAlloc mStrandPastEndIndicesInternal; + + // internal buffers in case user gives us CPU-buffers + MemoryWithAlloc mParticleRigidAttachmentsInternal; + MemoryWithAlloc mRestPositionsInternal; + + MemoryWithAlloc mRestPositionTransformPinnedBuf; + + PxArray mLodProportionOfStrands; + PxArray mLodProportionOfVertices; + + const PxRigidActor* mRestPositionActor; + }; +} + +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp new file mode 100644 index 0000000..366af88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.cpp @@ -0,0 +1,411 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpMPMMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +using namespace physx; +using namespace Cm; + +NpMPMMaterial::NpMPMMaterial(const PxsMPMMaterialCore& desc) : + PxMPMMaterial(PxConcreteType::eMPM_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpMPMMaterial::~NpMPMMaterial() +{ + NpPhysics::getInstance().removeMPMMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpMPMMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + // PT: TODO: missing line here? +} + +void NpMPMMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releaseMPMMaterialToPool(*this); + } + else + this->~NpMPMMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpMPMMaterial* NpMPMMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpMPMMaterial* obj = PX_PLACEMENT_NEW(address, NpMPMMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpMPMMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpMPMMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpMPMMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpMPMMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpMPMMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateMPMMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setFriction: invalid float"); + + mMaterial.friction = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getFriction() const +{ + return mMaterial.friction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setDamping: invalid float"); + mMaterial.damping = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getDamping() const +{ + return mMaterial.damping; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setStretchAndShearDamping(PxReal stretchAndShearDamping) +{ + mMaterial.stretchAndShearDamping = stretchAndShearDamping; + updateMaterial(); +} + +PxReal NpMPMMaterial::getStretchAndShearDamping() const +{ + return mMaterial.stretchAndShearDamping; +} + + +void NpMPMMaterial::setRotationalDamping(PxReal rotationalDamping) +{ + mMaterial.rotationalDamping = rotationalDamping; + updateMaterial(); +} + +PxReal NpMPMMaterial::getRotationalDamping() const +{ + return mMaterial.rotationalDamping; +} + + +void NpMPMMaterial::setDensity(PxReal density) +{ + mMaterial.density = density; + updateMaterial(); +} + +PxReal NpMPMMaterial::getDensity() const +{ + return mMaterial.density; +} + + +void NpMPMMaterial::setMaterialModel(PxMPMMaterialModel::Enum materialModel) +{ + mMaterial.materialModel = materialModel; + updateMaterial(); +} + +PxMPMMaterialModel::Enum NpMPMMaterial::getMaterialModel() const +{ + return mMaterial.materialModel; +} + + +void NpMPMMaterial::setCuttingFlags(PxMPMCuttingFlags cuttingFlags) +{ + mMaterial.cuttingFlags = cuttingFlags; + updateMaterial(); +} + +PxMPMCuttingFlags NpMPMMaterial::getCuttingFlags() const +{ + return mMaterial.cuttingFlags; +} + + +void NpMPMMaterial::setSandFrictionAngle(PxReal sandFrictionAngle) +{ + mMaterial.sandFrictionAngle = sandFrictionAngle; + updateMaterial(); +} + +PxReal NpMPMMaterial::getSandFrictionAngle() const +{ + return mMaterial.sandFrictionAngle; +} + + +void NpMPMMaterial::setYieldStress(PxReal yieldStress) +{ + mMaterial.yieldStress = yieldStress; + updateMaterial(); +} + +PxReal NpMPMMaterial::getYieldStress() const +{ + return mMaterial.yieldStress; +} + + +void NpMPMMaterial::setIsPlastic(bool x) +{ + mMaterial.isPlastic = x; + + updateMaterial(); +} + +bool NpMPMMaterial::getIsPlastic() const +{ + return mMaterial.isPlastic != 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setYoungsModulus(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setYoungsModulus: invalid float"); + + mMaterial.youngsModulus = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getYoungsModulus() const +{ + return mMaterial.youngsModulus; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setPoissons(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f && x <= 0.5f, "PxMPMMaterial::setPoissons: invalid float"); + + mMaterial.poissonsRatio = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getPoissons() const +{ + return mMaterial.poissonsRatio; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setHardening(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setPoissons: invalid float"); + + mMaterial.hardening = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getHardening() const +{ + return mMaterial.hardening; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setCriticalCompression(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setCriticalCompression: invalid float"); + + mMaterial.criticalCompression = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getCriticalCompression() const +{ + return mMaterial.criticalCompression; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setCriticalStretch(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setCriticalStretch: invalid float"); + + mMaterial.criticalStretch = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getCriticalStretch() const +{ + return mMaterial.criticalStretch; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setTensileDamageSensitivity(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setTensileDamageSensitivity: invalid float"); + + mMaterial.tensileDamageSensitivity = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getTensileDamageSensitivity() const +{ + return mMaterial.tensileDamageSensitivity; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setCompressiveDamageSensitivity(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setCompressiveDamageSensitivity: invalid float"); + + mMaterial.compressiveDamageSensitivity = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getCompressiveDamageSensitivity() const +{ + return mMaterial.compressiveDamageSensitivity; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setAttractiveForceResidual(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setAttractiveForceResidual: invalid float"); + + mMaterial.attractiveForceResidual = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getAttractiveForceResidual() const +{ + return mMaterial.attractiveForceResidual; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setAdhesion(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setAdhesion: invalid float"); + mMaterial.adhesion = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getAdhesion() const +{ + return mMaterial.adhesion; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setGravityScale(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxMPMMaterial::setAdhesion: invalid float"); + mMaterial.gravityScale = x; + + updateMaterial(); +} + +PxReal NpMPMMaterial::getGravityScale() const +{ + return mMaterial.gravityScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::setAdhesionRadiusScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxMPMMaterial::setAdhesionRadiusScale: scale must be positive"); + mMaterial.adhesionRadiusScale = x; + + updateMaterial(); +} +PxReal NpMPMMaterial::getAdhesionRadiusScale() const +{ + return mMaterial.adhesionRadiusScale; +} + +////////////////////////////////////////////////////////////////////////////// + +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.h new file mode 100644 index 0000000..b007810 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMPMMaterial.h @@ -0,0 +1,149 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_MPM_MATERIAL_H +#define NP_MPM_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsMPMMaterialCore.h" +#include "PxMPMMaterial.h" + +namespace physx +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // Compared to other objects, materials are special since they belong to the SDK and not to scenes + // (similar to meshes). That's why the NpMPMMaterial does have direct access to the core material instead + // of having a buffered interface for it. Scenes will have copies of the SDK material table and there + // the materials will be buffered. + + class NpMPMMaterial : public PxMPMMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpMPMMaterial(PxBaseFlags baseFlags) : PxMPMMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpMPMMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpMPMMaterial(const PxsMPMMaterialCore& desc); + virtual ~NpMPMMaterial(); + + // PxBase + virtual void release() PX_OVERRIDE; + //~PxBase + + // PxRefCounted + virtual void acquireReference() PX_OVERRIDE; + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void onRefCountZero() PX_OVERRIDE; + //~PxRefCounted + + // PxParticleMaterial + virtual void setFriction(PxReal friction) PX_OVERRIDE; + virtual PxReal getFriction() const PX_OVERRIDE; + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setAdhesion(PxReal adhesion) PX_OVERRIDE; + virtual PxReal getAdhesion() const PX_OVERRIDE; + virtual void setGravityScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getGravityScale() const PX_OVERRIDE; + virtual void setAdhesionRadiusScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getAdhesionRadiusScale() const PX_OVERRIDE; + //~PxParticleMaterial + + // PxMPMMaterial + virtual void setStretchAndShearDamping(PxReal stretchAndShearDamping) PX_OVERRIDE; + virtual PxReal getStretchAndShearDamping() const PX_OVERRIDE; + virtual void setRotationalDamping(PxReal rotationalDamping) PX_OVERRIDE; + virtual PxReal getRotationalDamping() const PX_OVERRIDE; + virtual void setDensity(PxReal) PX_OVERRIDE; + virtual PxReal getDensity() const PX_OVERRIDE; + virtual void setMaterialModel(PxMPMMaterialModel::Enum) PX_OVERRIDE; + virtual PxMPMMaterialModel::Enum getMaterialModel() const PX_OVERRIDE; + virtual void setCuttingFlags(PxMPMCuttingFlags cuttingFlags) PX_OVERRIDE; + virtual PxMPMCuttingFlags getCuttingFlags() const PX_OVERRIDE; + virtual void setSandFrictionAngle(PxReal sandFrictionAngle) PX_OVERRIDE; + virtual PxReal getSandFrictionAngle() const PX_OVERRIDE; + virtual void setYieldStress(PxReal yieldStress) PX_OVERRIDE; + virtual PxReal getYieldStress() const PX_OVERRIDE; + + + virtual void setIsPlastic(bool) PX_OVERRIDE; + virtual bool getIsPlastic() const PX_OVERRIDE; + virtual void setYoungsModulus(PxReal) PX_OVERRIDE; + virtual PxReal getYoungsModulus() const PX_OVERRIDE; + virtual void setPoissons(PxReal) PX_OVERRIDE; + virtual PxReal getPoissons() const PX_OVERRIDE; + virtual void setHardening(PxReal) PX_OVERRIDE; + virtual PxReal getHardening() const PX_OVERRIDE; + virtual void setCriticalCompression(PxReal) PX_OVERRIDE; + virtual PxReal getCriticalCompression() const PX_OVERRIDE; + virtual void setCriticalStretch(PxReal) PX_OVERRIDE; + virtual PxReal getCriticalStretch() const PX_OVERRIDE; + virtual void setTensileDamageSensitivity(PxReal) PX_OVERRIDE; + virtual PxReal getTensileDamageSensitivity() const PX_OVERRIDE; + virtual void setCompressiveDamageSensitivity(PxReal) PX_OVERRIDE; + virtual PxReal getCompressiveDamageSensitivity() const PX_OVERRIDE; + virtual void setAttractiveForceResidual(PxReal) PX_OVERRIDE; + virtual PxReal getAttractiveForceResidual() const PX_OVERRIDE; + //~PxMPMMaterial + + PX_FORCE_INLINE static void getMaterialIndices(NpMPMMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsMPMMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpMPMMaterial::getMaterialIndices(NpMPMMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp new file mode 100644 index 0000000..7995e41 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.cpp @@ -0,0 +1,230 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" +#include "omnipvd/OmniPvdPxSampler.h" + +using namespace physx; +using namespace Cm; + +NpMaterial::NpMaterial(const PxsMaterialCore& desc) : + PxMaterial(PxConcreteType::eMATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpMaterial::~NpMaterial() +{ + OMNI_PVD_DESTROY(material, static_cast(*this)) + + NpPhysics::getInstance().removeMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + NpPhysics::getInstance().addMaterial(this); +} + +void NpMaterial::onRefCountZero() +{ + void* ud = userData; + + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + NpFactory::getInstance().releaseMaterialToPool(*this); + else + this->~NpMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpMaterial* NpMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpMaterial* obj = PX_PLACEMENT_NEW(address, NpMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setDynamicFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxMaterial::setDynamicFriction: invalid float"); + mMaterial.dynamicFriction = x; + updateMaterial(); + OMNI_PVD_SET(material, dynamicFriction, static_cast(*this), x) +} + +PxReal NpMaterial::getDynamicFriction() const +{ + return mMaterial.dynamicFriction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setStaticFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxMaterial::setStaticFriction: invalid float"); + mMaterial.staticFriction = x; + updateMaterial(); + OMNI_PVD_SET(material, staticFriction, static_cast(*this), x) +} + +PxReal NpMaterial::getStaticFriction() const +{ + return mMaterial.staticFriction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setRestitution(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxMaterial::setRestitution: invalid float"); + PX_CHECK_MSG(((mMaterial.flags & PxMaterialFlag::eCOMPLIANT_CONTACT || x >= 0.0f) && (x <= 1.0f)), "PxMaterial::setRestitution: Restitution value has to be in [0,1]!"); + if ((!(mMaterial.flags & PxMaterialFlag::eCOMPLIANT_CONTACT) && x < 0.0f) || (x > 1.0f)) + { + PxClamp(x, 0.0f, 1.0f); + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxMaterial::setRestitution: Invalid value %f was clamped to [0,1]!", PxF64(x)); + } + mMaterial.restitution = x; + updateMaterial(); + OMNI_PVD_SET(material, restitution, static_cast(*this), x) +} + +PxReal NpMaterial::getRestitution() const +{ + return mMaterial.restitution; +} + +///////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x) && x >= 0.f, "PxMaterial::setDamping: invalid float. Must be >= 0"); + PX_CHECK_MSG((((mMaterial.flags & PxMaterialFlag::eCOMPLIANT_CONTACT) && x >= 0.f) || x == 0.f), "PxMaterial::setDamping: Damping value has to be in [0,INF] and PxMaterialFlag::eCOMPLIANT_CONTACT should be raised!"); + if ((!(mMaterial.flags & PxMaterialFlag::eCOMPLIANT_CONTACT) && x != 0.0f)) + { + x = 0.f; + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxMaterial::setDamping: Attempting to set a non-zero damping coefficient without raising PxMaterialFlag::eCOMPLIANT_CONTACT first!"); + } + mMaterial.damping = x; + updateMaterial(); + OMNI_PVD_SET(material, damping, static_cast(*this), x) +} + +PxReal NpMaterial::getDamping() const +{ + return mMaterial.damping; +} + +///////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setFlag(PxMaterialFlag::Enum flag, bool value) +{ + if (value) + mMaterial.flags |= flag; + else + mMaterial.flags &= ~PxMaterialFlags(flag); + updateMaterial(); + OMNI_PVD_SET(material, flags, static_cast(*this), mMaterial.flags) +} + +void NpMaterial::setFlags(PxMaterialFlags inFlags) +{ + mMaterial.flags = inFlags; + updateMaterial(); + OMNI_PVD_SET(material, flags, static_cast(*this), mMaterial.flags) +} + +PxMaterialFlags NpMaterial::getFlags() const +{ + return mMaterial.flags; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setFrictionCombineMode(PxCombineMode::Enum x) +{ + mMaterial.setFrictionCombineMode(x); + updateMaterial(); + OMNI_PVD_SET(material, frictionCombineMode, static_cast(*this), x) +} + +PxCombineMode::Enum NpMaterial::getFrictionCombineMode() const +{ + return mMaterial.getFrictionCombineMode(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::setRestitutionCombineMode(PxCombineMode::Enum x) +{ + mMaterial.setRestitutionCombineMode(x); + updateMaterial(); + OMNI_PVD_SET(material, restitutionCombineMode, static_cast(*this), x) +} + +PxCombineMode::Enum NpMaterial::getRestitutionCombineMode() const +{ + return mMaterial.getRestitutionCombineMode(); +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.h new file mode 100644 index 0000000..9ab223b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterial.h @@ -0,0 +1,114 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_MATERIAL_H +#define NP_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsMaterialCore.h" + +namespace physx +{ +// Compared to other objects, materials are special since they belong to the SDK and not to scenes +// (similar to meshes). That's why the NpMaterial does have direct access to the core material instead +// of having a buffered interface for it. Scenes will have copies of the SDK material table and there +// the materials will be buffered. + +class NpMaterial : public PxMaterial, public PxUserAllocated +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpMaterial(PxBaseFlags baseFlags) : PxMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&){} +//~PX_SERIALIZATION + NpMaterial(const PxsMaterialCore& desc); + virtual ~NpMaterial(); + + // PxBase + virtual void release() PX_OVERRIDE; + //~PxBase + + // PxRefCounted + virtual void acquireReference() PX_OVERRIDE; + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void onRefCountZero() PX_OVERRIDE; + //~PxRefCounted + + // PxMaterial + virtual void setDynamicFriction(PxReal) PX_OVERRIDE; + virtual PxReal getDynamicFriction() const PX_OVERRIDE; + virtual void setStaticFriction(PxReal) PX_OVERRIDE; + virtual PxReal getStaticFriction() const PX_OVERRIDE; + virtual void setRestitution(PxReal) PX_OVERRIDE; + virtual PxReal getRestitution() const PX_OVERRIDE; + virtual void setDamping(PxReal) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setFlag(PxMaterialFlag::Enum flag, bool value) PX_OVERRIDE; + virtual void setFlags(PxMaterialFlags inFlags) PX_OVERRIDE; + virtual PxMaterialFlags getFlags() const PX_OVERRIDE; + virtual void setFrictionCombineMode(PxCombineMode::Enum) PX_OVERRIDE; + virtual PxCombineMode::Enum getFrictionCombineMode() const PX_OVERRIDE; + virtual void setRestitutionCombineMode(PxCombineMode::Enum) PX_OVERRIDE; + virtual PxCombineMode::Enum getRestitutionCombineMode() const PX_OVERRIDE; + //~PxMaterial + + PX_FORCE_INLINE static void getMaterialIndices(PxMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + +private: + PX_INLINE void updateMaterial(); + +// PX_SERIALIZATION +public: +//~PX_SERIALIZATION + PxsMaterialCore mMaterial; +}; + +PX_FORCE_INLINE void NpMaterial::getMaterialIndices(PxMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) +{ + for(PxU32 i=0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterialManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterialManager.h new file mode 100644 index 0000000..63c8acd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMaterialManager.h @@ -0,0 +1,168 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef NP_MATERIALMANAGER +#define NP_MATERIALMANAGER + +#include "foundation/PxMemory.h" +#include "CmIDPool.h" + +namespace physx +{ + template + class NpMaterialManager + { + public: + NpMaterialManager() + { + const PxU32 matCount = 128; + mMaterials = reinterpret_cast(PX_ALLOC(sizeof(Material*) * matCount, "NpMaterialManager::initialise")); + mMaxMaterials = matCount; + PxMemZero(mMaterials, sizeof(Material*)*mMaxMaterials); + } + + ~NpMaterialManager() {} + + void releaseMaterials() + { + for(PxU32 i=0; imMaterial.mMaterialIndex); + mHandleManager.freeID(handle); + mMaterials[i]->release(); + mMaterials[i] = NULL; + } + } + PX_FREE(mMaterials); + } + + bool setMaterial(Material& mat) + { + const PxU32 poolID = mHandleManager.getNewID(); + if (poolID >= MATERIAL_INVALID_HANDLE) + return false; + + const PxU16 materialIndex = PxTo16(poolID); + + if(materialIndex >= mMaxMaterials) + resize(); + + mMaterials[materialIndex] = &mat; + mat.mMaterial.mMaterialIndex = materialIndex; + return true; + } + + void updateMaterial(Material& mat) + { + mMaterials[mat.mMaterial.mMaterialIndex] = &mat; + } + + PX_FORCE_INLINE PxU32 getNumMaterials() const + { + return mHandleManager.getNumUsedID(); + } + + void removeMaterial(Material& mat) + { + const PxU16 handle = mat.mMaterial.mMaterialIndex; + if(handle != MATERIAL_INVALID_HANDLE) + { + mMaterials[handle] = NULL; + mHandleManager.freeID(PxU32(handle)); + } + } + + PX_FORCE_INLINE Material* getMaterial(const PxU32 index) const + { + PX_ASSERT(index < mMaxMaterials); + return mMaterials[index]; + } + + PX_FORCE_INLINE PxU32 getMaxSize() const + { + return mMaxMaterials; + } + + PX_FORCE_INLINE Material** getMaterials() const + { + return mMaterials; + } + + private: + void resize() + { + const PxU32 numMaterials = mMaxMaterials; + mMaxMaterials = PxMin(mMaxMaterials*2, PxU32(MATERIAL_INVALID_HANDLE)); + + Material** mat = reinterpret_cast(PX_ALLOC(sizeof(Material*)*mMaxMaterials, "NpMaterialManager::resize")); + PxMemZero(mat, sizeof(Material*)*mMaxMaterials); + for(PxU32 i=0; i + class NpMaterialManagerIterator + { + public: + NpMaterialManagerIterator(const NpMaterialManager& manager) : mManager(manager), mIndex(0) + { + } + + bool getNextMaterial(Material*& np) + { + const PxU32 maxSize = mManager.getMaxSize(); + PxU32 index = mIndex; + while(index < maxSize && mManager.getMaterial(index)==NULL) + index++; + np = NULL; + if(index < maxSize) + np = mManager.getMaterial(index++); + mIndex = index; + return np!=NULL; + } + + private: + NpMaterialManagerIterator& operator=(const NpMaterialManagerIterator&); + const NpMaterialManager& mManager; + PxU32 mIndex; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp new file mode 100644 index 0000000..b42c4ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpMetaData.cpp @@ -0,0 +1,838 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIO.h" +#include "PxPhysicsSerialization.h" +#include "NpShape.h" +#include "NpShapeManager.h" +#include "NpConstraint.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationLink.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationSensor.h" +#include "NpArticulationTendon.h" +#include "NpAggregate.h" +#include "NpPruningStructure.h" +#include "NpMaterial.h" +#include "NpFEMSoftBodyMaterial.h" +#include "NpFEMClothMaterial.h" +#include "NpMPMMaterial.h" +#include "NpFLIPMaterial.h" +#include "NpPBDMaterial.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "GuTriangleMeshBV4.h" +#include "GuTriangleMeshRTree.h" +#include "GuHeightField.h" +#include "GuPrunerMergeData.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +// PT: the offsets can be different for different templated classes so I need macros here. + +#define DefineMetaData_PxActor(x) \ + PX_DEF_BIN_METADATA_ITEM(stream, x, void, userData, PxMetaDataFlag::ePTR) + +#define DefineMetaData_NpRigidActorTemplate(x) \ + PX_DEF_BIN_METADATA_ITEM(stream, x, NpShapeManager, mShapeManager, 0) +// PX_DEF_BIN_METADATA_ITEM(stream, x, PxU32, mIndex, 0) + +#define DefineMetaData_NpRigidBodyTemplate(x) \ + PX_DEF_BIN_METADATA_ITEM(stream, x, Sc::BodyCore, mCore, 0) + + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PxVec3(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxVec3) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec3, PxReal, x, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec3, PxReal, y, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec3, PxReal, z, 0) +} + +static void getBinaryMetaData_PxVec4(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxVec4) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec4, PxReal, x, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec4, PxReal, y, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec4, PxReal, z, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVec4, PxReal, w, 0) +} + +static void getBinaryMetaData_PxQuat(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxQuat) + PX_DEF_BIN_METADATA_ITEM(stream, PxQuat, PxReal, x, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxQuat, PxReal, y, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxQuat, PxReal, z, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxQuat, PxReal, w, 0) +} + +static void getBinaryMetaData_PxBounds3(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxBounds3) + PX_DEF_BIN_METADATA_ITEM(stream, PxBounds3, PxVec3, minimum, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxBounds3, PxVec3, maximum, 0) +} + +static void getBinaryMetaData_PxTransform(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxTransform) + PX_DEF_BIN_METADATA_ITEM(stream, PxTransform, PxQuat, q, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxTransform, PxVec3, p, 0) +} + +static void getBinaryMetaData_PxMat33(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxMat33) + PX_DEF_BIN_METADATA_ITEM(stream, PxMat33, PxVec3, column0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxMat33, PxVec3, column1, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxMat33, PxVec3, column2, 0) +} + +static void getBinaryMetaData_SpatialVectorF(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, Cm::SpatialVectorF) + PX_DEF_BIN_METADATA_ITEM(stream, Cm::SpatialVectorF, PxVec3, top, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Cm::SpatialVectorF, PxReal, pad0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Cm::SpatialVectorF, PxVec3, bottom, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Cm::SpatialVectorF, PxReal, pad1, 0) +} + +namespace +{ + class ShadowBitMap : public PxBitMap + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowBitMap) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBitMap, PxU32, mMap, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBitMap, PxU32, mWordCount, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBitMap, PxAllocator, mAllocator, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream_, ShadowBitMap, PxU8, mPadding, PxMetaDataFlag::ePADDING) + + //------ Extra-data ------ + + // mMap + PX_DEF_BIN_METADATA_EXTRA_ARRAY(stream_, ShadowBitMap, PxU32, mWordCount, PX_SERIAL_ALIGN, PxMetaDataFlag::eCOUNT_MASK_MSB) + } + }; +} + +static void getBinaryMetaData_BitMap(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxAllocator, PxU8) + ShadowBitMap::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, BitMap, ShadowBitMap) +} + +static void getBinaryMetaData_PxPlane(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxPlane) + PX_DEF_BIN_METADATA_ITEM(stream, PxPlane, PxVec3, n, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxPlane, PxReal, d, 0) +} + +static void getBinaryMetaData_PxConstraintInvMassScale(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxConstraintInvMassScale) + + PX_DEF_BIN_METADATA_ITEM(stream, PxConstraintInvMassScale, PxReal, linear0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxConstraintInvMassScale, PxReal, angular0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxConstraintInvMassScale, PxReal, linear1, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxConstraintInvMassScale, PxReal, angular1, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpBase::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, NpType::Enum, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpBase, NpScene, mScene, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpBase, PxU32, mBaseIndexAndType, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpBase, PxU32, mFreeSlot, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpActor::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpActor) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpActor, NpBase) + PX_DEF_BIN_METADATA_ITEM(stream, NpActor, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpActor, NpConnectorArray, mConnectorArray, PxMetaDataFlag::ePTR) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpMaterial, PxsMaterialCore, mMaterial, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFEMSoftBodyMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpFEMSoftBodyMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpFEMSoftBodyMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpFEMSoftBodyMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpFEMSoftBodyMaterial, PxsFEMSoftBodyMaterialCore, mMaterial, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpFEMClothMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpFEMClothMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpFEMClothMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpFEMClothMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpFEMClothMaterial, PxsFEMClothMaterialCore, mMaterial, 0) +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpPBDMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpPBDMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpPBDMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpPBDMaterial, PxsPBDMaterialCore, mMaterial, 0) +} + +/////////////////////////////////////////////////////////////////////////////// +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpCustomMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpCustomMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpCustomMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpCustomMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpCustomMaterial, PxsCustomMaterialCore, mMaterial, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpFLIPMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpFLIPMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpFLIPMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpFLIPMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpFLIPMaterial, PxsFLIPMaterialCore, mMaterial, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpMPMMaterial::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpMPMMaterial) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpMPMMaterial, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpMPMMaterial, void, userData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpMPMMaterial, PxsMPMMaterialCore, mMaterial, 0) +} +#endif +/////////////////////////////////////////////////////////////////////////////// + +void NpConstraint::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpConstraint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpConstraint, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpConstraint, NpBase) + + // PxConstraint + PX_DEF_BIN_METADATA_ITEM(stream, NpConstraint, void, userData, PxMetaDataFlag::ePTR) + + // NpConstraint + PX_DEF_BIN_METADATA_ITEM(stream, NpConstraint, PxRigidActor, mActor0, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpConstraint, PxRigidActor, mActor1, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpConstraint, ConstraintCore, mCore, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpShapeManager::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpShapeManager) + PX_DEF_BIN_METADATA_ITEM(stream, NpShapeManager, PtrTable, mShapes, 0) +// PX_DEF_BIN_METADATA_ITEM(stream, NpShapeManager, PxU32, mSqCompoundId, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpShapeManager, Sq::PruningStructure, mPruningStructure, PxMetaDataFlag::ePTR) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpShape::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpShape) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpShape, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpShape, NpBase) + + // PxShape + PX_DEF_BIN_METADATA_ITEM(stream, NpShape, void, userData, PxMetaDataFlag::ePTR) + + // NpShape + PX_DEF_BIN_METADATA_ITEM(stream, NpShape, PxRigidActor, mActor, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpShape, ShapeCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpShape, PxFilterData, mQueryFilterData, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpRigidStatic::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpRigidStatic) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpRigidStatic, PxBase) +// PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpRigidStatic, NpRigidStaticT) // ### ??? + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpRigidStatic, NpActor) + + DefineMetaData_PxActor(NpRigidStatic) + DefineMetaData_NpRigidActorTemplate(NpRigidStatic) + + // NpRigidStatic + PX_DEF_BIN_METADATA_ITEM(stream, NpRigidStatic, Sc::StaticCore, mCore, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, NpRigidStatic, NpConnectorArray, mConnectorArray, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, NpRigidStatic, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpConnector::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpConnector) + PX_DEF_BIN_METADATA_ITEM(stream, NpConnector, PxU8, mType, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, NpConnector, PxU8, mPadding, PxMetaDataFlag::ePADDING) + PX_DEF_BIN_METADATA_ITEM(stream, NpConnector, PxBase, mObject, PxMetaDataFlag::ePTR) +} + +void NpConnectorArray::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpConnectorArray) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, NpConnectorArray, NpConnector, mBuffer, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpConnectorArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitly in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpConnectorArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpConnectorArray, NpConnector, mData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpConnectorArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpConnectorArray, PxU32, mCapacity, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpConnectorArray, NpConnector, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpRigidDynamic::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpRigidDynamic) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpRigidDynamic, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpRigidDynamic, NpActor) + + DefineMetaData_PxActor(NpRigidDynamic) + DefineMetaData_NpRigidActorTemplate(NpRigidDynamic) + DefineMetaData_NpRigidBodyTemplate(NpRigidDynamic) + + // NpRigidDynamic + + //------ Extra-data ------ + +// Extra data: +// - inline array from shape manager +// - optional constraint array + +// PX_DEF_BIN_METADATA_ITEM(stream,NpRigidDynamic, NpShapeManager, mShapeManager.mShapes, 0) + +/* + virtual void exportExtraData(PxOutputStream& stream) + { + mShapeManager.exportExtraData(stream); + ActorTemplateClass::exportExtraData(stream); + } +void NpActorTemplate::exportExtraData(PxOutputStream& stream) +{ + if(mConnectorArray) + { + stream.storeBuffer(mConnectorArray, sizeof(NpConnectorArray) + mConnectorArray->exportExtraData(stream); + } +} +*/ + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, NpRigidDynamic, NpConnectorArray, mConnectorArray, PX_SERIAL_ALIGN) +//### missing inline array data here... only works for "buffered" arrays so far +/* + Big issue: we can't output the "offset of" the inline array within the class, since the inline array itself is extra-data. But we need to read + the array itself to know if it's inline or not (the "is buffered" bool). So we need to read from the extra data! +*/ + +/* +[17:41:39] Gordon Yeoman nvidia: PxsBodyCore need to be 16-byte aligned for spu. If it is 128-byte aligned then that is a mistake. Feel free to change it to 16. +*/ + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, NpRigidDynamic, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpArticulationLinkArray::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpArticulationLinkArray) + PX_DEF_BIN_METADATA_ITEMS(stream, NpArticulationLinkArray, NpArticulationLink, mBuffer, PxMetaDataFlag::ePTR, 4) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLinkArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitely in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpArticulationLinkArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLinkArray, NpArticulationLink, mData, PxMetaDataFlag::ePTR) // ### + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLinkArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLinkArray, PxU32, mCapacity, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationLinkArray, NpArticulationLink, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) +} + +void NpArticulationAttachmentArray::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpArticulationAttachmentArray) + PX_DEF_BIN_METADATA_ITEMS(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mBuffer, PxMetaDataFlag::ePTR, 4) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitely in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpArticulationAttachmentArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mData, PxMetaDataFlag::ePTR) // ### + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachmentArray, PxU32, mCapacity, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationAttachmentArray, NpArticulationAttachment, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) +} + +namespace +{ + struct ShadowLoopJointArray : public PxArray + { + static void getBinaryMetaData(PxOutputStream& stream) + { + PX_DEF_BIN_METADATA_CLASS(stream, ShadowLoopJointArray) + + PX_DEF_BIN_METADATA_ITEM(stream, ShadowLoopJointArray, NpConstraint, mData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowLoopJointArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowLoopJointArray, PxU32, mCapacity, 0) + } + }; + +#define DECL_SHADOW_PTR_ARRAY(T) \ +struct ShadowArray##T : public PxArray \ +{ \ + static void getBinaryMetaData(PxOutputStream& stream) \ + { \ + PX_DEF_BIN_METADATA_CLASS(stream, ShadowArray##T) \ + PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, T, mData, PxMetaDataFlag::ePTR)\ + PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, PxU32, mSize, 0) \ + PX_DEF_BIN_METADATA_ITEM(stream, ShadowArray##T, PxU32, mCapacity, 0) \ + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, ShadowArray##T, T, mData, mCapacity, PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) \ + } \ +}; + +DECL_SHADOW_PTR_ARRAY(NpArticulationSpatialTendon) +DECL_SHADOW_PTR_ARRAY(NpArticulationFixedTendon) +DECL_SHADOW_PTR_ARRAY(NpArticulationSensor) + +} + +void NpArticulationReducedCoordinate::getBinaryMetaData(PxOutputStream& stream) +{ + ShadowLoopJointArray::getBinaryMetaData(stream); + ShadowArrayNpArticulationSpatialTendon::getBinaryMetaData(stream); + ShadowArrayNpArticulationFixedTendon::getBinaryMetaData(stream); + ShadowArrayNpArticulationSensor::getBinaryMetaData(stream); + + //sticking this here, since typedefs are only allowed to declared once. + PX_DEF_BIN_METADATA_TYPEDEF(stream, ArticulationTendonHandle, PxU32) + + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationReducedCoordinate) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationReducedCoordinate, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationReducedCoordinate, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ArticulationCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, NpArticulationLinkArray, mArticulationLinks, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, PxU32, mNumShapes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, NpAggregate, mAggregate, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, NpArticulationReducedCoordinate, mName, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, PxU32, mCacheVersion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, bool, mTopologyChanged, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowLoopJointArray, mLoopJoints, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationSpatialTendon, mSpatialTendons, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationFixedTendon, mFixedTendons, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationReducedCoordinate, ShadowArrayNpArticulationSensor, mSensors, 0) +} + +void NpArticulationSensor::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationSensor) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSensor, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSensor, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, ArticulationSensorCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSensor, PxU32, mHandle, 0) +} + +void NpArticulationAttachment::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationAttachment) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationAttachment, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationAttachment, NpBase) + + PX_DEF_BIN_METADATA_TYPEDEF(stream, ArticulationAttachmentHandle, PxU32); + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, PxArticulationAttachment, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, ArticulationAttachmentHandle, mHandle, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationAttachmentArray, mChildren, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, NpArticulationSpatialTendon, mTendon, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationAttachment, ArticulationAttachmentCore, mCore, 0) +} + +void NpArticulationTendonJoint::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationTendonJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationTendonJoint, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationTendonJoint, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxArticulationLink, mLink, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxArticulationTendonJoint, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, NpArticulationTendonJointArray, mChildren, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, NpArticulationFixedTendon, mTendon, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, ArticulationTendonJointCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJoint, PxU32, mHandle, 0) +} + +void NpArticulationTendonJointArray::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, NpArticulationTendonJointArray) + PX_DEF_BIN_METADATA_ITEMS(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mBuffer, PxMetaDataFlag::ePTR, 4) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, bool, mBufferUsed, 0) + // PT: OMG this is so painful... I can't put the padding explicitely in the template + { PxMetaDataEntry tmp = {"char", "mPadding", 1 + PxU32(PX_OFFSET_OF_RT(NpArticulationTendonJointArray, mBufferUsed)), 3, 3, 0, PxMetaDataFlag::ePADDING, 0}; PX_STORE_METADATA(stream, tmp); } + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mData, PxMetaDataFlag::ePTR) // ### + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationTendonJointArray, PxU32, mCapacity, 0) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpArticulationTendonJointArray, NpArticulationTendonJoint, mBufferUsed, mCapacity, PxMetaDataFlag::eCONTROL_FLIP|PxMetaDataFlag::eCOUNT_MASK_MSB|PxMetaDataFlag::ePTR, 0) +} + +void NpArticulationSpatialTendon::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationSpatialTendon) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSpatialTendon, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationSpatialTendon, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationAttachmentArray, mAttachments, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, NpArticulationReducedCoordinate, mArticulation, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, PxU32, mLLIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, ArticulationSpatialTendonCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationSpatialTendon, ArticulationTendonHandle, mHandle, 0) +} + +void NpArticulationFixedTendon::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationFixedTendon) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationFixedTendon, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationFixedTendon, NpBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, NpArticulationTendonJointArray, mTendonJoints, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, NpArticulationReducedCoordinate, mArticulation, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, PxU32, mLLIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, ArticulationFixedTendonCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationFixedTendon, ArticulationTendonHandle, mHandle, 0) +} + +void NpArticulationLink::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationLink) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationLink, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationLink, NpActor) + + DefineMetaData_PxActor(NpArticulationLink) + DefineMetaData_NpRigidActorTemplate(NpArticulationLink) + DefineMetaData_NpRigidBodyTemplate(NpArticulationLink) + + // NpArticulationLink + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, NpArticulation, mRoot, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, NpArticulationJoint, mInboundJoint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, NpArticulationLink, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, NpArticulationLinkArray, mChildLinks, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, PxU32, mLLIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationLink, PxU32, mInboundJointDof, 0); + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, NpArticulationLink, NpConnectorArray, mConnectorArray, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, NpArticulationLink, mName, 0) +} + + +void NpArticulationJointReducedCoordinate::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpArticulationJointReducedCoordinate) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationJointReducedCoordinate, NpBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpArticulationJointReducedCoordinate, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationJointReducedCoordinate, void, userData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationJointReducedCoordinate, ArticulationJointCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationJointReducedCoordinate, NpArticulationLink, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, NpArticulationJointReducedCoordinate, NpArticulationLink, mChild, PxMetaDataFlag::ePTR) + +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpAggregate::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, NpAggregate) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpAggregate, PxBase) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, NpAggregate, NpBase) + + // PxAggregate + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, void, userData, PxMetaDataFlag::ePTR) + + // NpAggregate + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mAggregateID, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mMaxNbActors, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mMaxNbShapes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mFilterHint, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mNbActors, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxU32, mNbShapes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, NpAggregate, PxActor, mActors, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + // mActors + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, NpAggregate, PxActor, mActors, mNbActors, PxMetaDataFlag::ePTR, PX_SERIAL_ALIGN) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PxMeshScale(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxMeshScale) + PX_DEF_BIN_METADATA_ITEM(stream, PxMeshScale, PxVec3, scale, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxMeshScale, PxQuat, rotation, 0) +} + +static void getBinaryMetaData_AABBPrunerMergeData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, AABBPrunerMergeData) + PX_DEF_BIN_METADATA_ITEM(stream, AABBPrunerMergeData, PxU32, mNbNodes, 0) + PX_DEF_BIN_METADATA_ITEM(stream, AABBPrunerMergeData, Gu::BVHNode, mAABBTreeNodes, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, AABBPrunerMergeData, PxU32, mNbObjects, 0) + PX_DEF_BIN_METADATA_ITEM(stream, AABBPrunerMergeData, PxU32, mAABBTreeIndices, PxMetaDataFlag::ePTR) +} + +void Sq::PruningStructure::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_AABBPrunerMergeData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, PruningStructure) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PruningStructure, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, PruningStructure, AABBPrunerMergeData, mData[0], 0) + PX_DEF_BIN_METADATA_ITEM(stream, PruningStructure, AABBPrunerMergeData, mData[1], 0) + + PX_DEF_BIN_METADATA_ITEM(stream, PruningStructure, PxU32, mNbActors, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PruningStructure, PxActor*, mActors, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PruningStructure, bool, mValid, 0) +} + +/////////////////////////////////////////////////////////////////////////////// +namespace physx +{ +void getBinaryMetaData_PxBase(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxBaseFlags, PxU16) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxType, PxU16) + PX_DEF_BIN_METADATA_VCLASS(stream, PxBase) + PX_DEF_BIN_METADATA_ITEM(stream, PxBase, PxType, mConcreteType, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxBase, PxBaseFlags, mBaseFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxBase, PxI32, mBuiltInRefCount, 0) +} +} +void RefCountable::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, RefCountable) + PX_DEF_BIN_METADATA_ITEM(stream, RefCountable, PxI32, mRefCount, 0) +} + +static void getFoundationMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxU8, char) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxI8, char) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxU16, short) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxI16, short) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxU32, int) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxI32, int) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxReal, float) + + getBinaryMetaData_PxVec3(stream); + getBinaryMetaData_PxVec4(stream); + getBinaryMetaData_PxQuat(stream); + getBinaryMetaData_PxBounds3(stream); + getBinaryMetaData_PxTransform(stream); + getBinaryMetaData_PxMat33(stream); + getBinaryMetaData_SpatialVectorF(stream); + getBinaryMetaData_BitMap(stream); + Cm::PtrTable::getBinaryMetaData(stream); + getBinaryMetaData_PxPlane(stream); + getBinaryMetaData_PxConstraintInvMassScale(stream); + + getBinaryMetaData_PxBase(stream); + RefCountable::getBinaryMetaData(stream); +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace physx +{ +template<> void PxsMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsFEMSoftBodyMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsFEMClothMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsPBDMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsCustomMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsFLIPMaterialCore::getBinaryMetaData(PxOutputStream& stream); +template<> void PxsMPMMaterialCore::getBinaryMetaData(PxOutputStream& stream); +} + +void PxGetPhysicsBinaryMetaData(PxOutputStream& stream) +{ + getFoundationMetaData(stream); + getBinaryMetaData_PxMeshScale(stream); + + Gu::ConvexMesh::getBinaryMetaData(stream); + Gu::TriangleMesh::getBinaryMetaData(stream); + Gu::RTreeTriangleMesh::getBinaryMetaData(stream); + Gu::BV4TriangleMesh::getBinaryMetaData(stream); + Gu::HeightField::getBinaryMetaData(stream); + + PxsMaterialCore::getBinaryMetaData(stream); + PxsFEMSoftBodyMaterialCore::getBinaryMetaData(stream); + PxsFEMClothMaterialCore::getBinaryMetaData(stream); + PxsPBDMaterialCore::getBinaryMetaData(stream); + PxsCustomMaterialCore::getBinaryMetaData(stream); + PxsFLIPMaterialCore::getBinaryMetaData(stream); + PxsMPMMaterialCore::getBinaryMetaData(stream); + + MaterialIndicesStruct::getBinaryMetaData(stream); + GeometryUnion::getBinaryMetaData(stream); + Sc::ActorCore::getBinaryMetaData(stream); + Sc::RigidCore::getBinaryMetaData(stream); + Sc::StaticCore::getBinaryMetaData(stream); + Sc::BodyCore::getBinaryMetaData(stream); + Sc::ShapeCore::getBinaryMetaData(stream); + Sc::ConstraintCore::getBinaryMetaData(stream); + Sc::ArticulationCore::getBinaryMetaData(stream); + Sc::ArticulationJointCore::getBinaryMetaData(stream); + Sc::ArticulationSensorCore::getBinaryMetaData(stream); + Sc::ArticulationTendonCore::getBinaryMetaData(stream); + Sc::ArticulationSpatialTendonCore::getBinaryMetaData(stream); + Sc::ArticulationAttachmentCore::getBinaryMetaData(stream); + Sc::ArticulationFixedTendonCore::getBinaryMetaData(stream); + Sc::ArticulationTendonJointCore::getBinaryMetaData(stream); + + NpConnector::getBinaryMetaData(stream); + NpConnectorArray::getBinaryMetaData(stream); + NpBase::getBinaryMetaData(stream); + NpActor::getBinaryMetaData(stream); + NpMaterial::getBinaryMetaData(stream); + NpFEMSoftBodyMaterial::getBinaryMetaData(stream); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpFEMClothMaterial::getBinaryMetaData(stream); +#endif + NpPBDMaterial::getBinaryMetaData(stream); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpCustomMaterial::getBinaryMetaData(stream); + NpFLIPMaterial::getBinaryMetaData(stream); + NpMPMMaterial::getBinaryMetaData(stream); +#endif + NpRigidDynamic::getBinaryMetaData(stream); + NpRigidStatic::getBinaryMetaData(stream); + NpShape::getBinaryMetaData(stream); + NpConstraint::getBinaryMetaData(stream); + NpArticulationReducedCoordinate::getBinaryMetaData(stream); + NpArticulationLink::getBinaryMetaData(stream); + NpArticulationJointReducedCoordinate::getBinaryMetaData(stream); + NpArticulationLinkArray::getBinaryMetaData(stream); + NpArticulationSensor::getBinaryMetaData(stream); + NpArticulationSpatialTendon::getBinaryMetaData(stream); + NpArticulationFixedTendon::getBinaryMetaData(stream); + NpArticulationAttachment::getBinaryMetaData(stream); + NpArticulationAttachmentArray::getBinaryMetaData(stream); + NpArticulationTendonJoint::getBinaryMetaData(stream); + NpArticulationTendonJointArray::getBinaryMetaData(stream); + NpShapeManager::getBinaryMetaData(stream); + NpAggregate::getBinaryMetaData(stream); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp new file mode 100644 index 0000000..1360631 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.cpp @@ -0,0 +1,465 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpPBDMaterial.h" +#include "NpPhysics.h" +#include "CmUtils.h" + +#if PX_SUPPORT_GPU_PHYSX +using namespace physx; +using namespace Cm; + +NpPBDMaterial::NpPBDMaterial(const PxsPBDMaterialCore& desc) : + PxPBDMaterial(PxConcreteType::ePBD_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpPBDMaterial::~NpPBDMaterial() +{ + NpPhysics::getInstance().removePBDMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpPBDMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + // PT: TODO: missing line here? +} + +void NpPBDMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releasePBDMaterialToPool(*this); + } + else + this->~NpPBDMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpPBDMaterial* NpPBDMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpPBDMaterial* obj = PX_PLACEMENT_NEW(address, NpPBDMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpPBDMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpPBDMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpPBDMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpPBDMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpPBDMaterial::updateMaterial() +{ + NpPhysics::getInstance().updatePBDMaterial(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setFriction(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setFriction: invalid float"); + + mMaterial.friction = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getFriction() const +{ + return mMaterial.friction; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setViscosity(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setViscosity: invalid float"); + mMaterial.viscosity = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getViscosity() const +{ + return mMaterial.viscosity; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setDamping(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setDamping: invalid float"); + mMaterial.damping = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getDamping() const +{ + return mMaterial.damping; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setLift(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setLift: invalid float"); + mMaterial.lift = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getLift() const +{ + return mMaterial.lift; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setDrag(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setDrag: invalid float"); + + mMaterial.drag = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getDrag() const +{ + return mMaterial.drag; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setCFLCoefficient(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 1.f, "PxPBDMaterial::setCFLCoefficient: invalid float"); + + mMaterial.cflCoefficient = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getCFLCoefficient() const +{ + return mMaterial.cflCoefficient; +} + + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setVorticityConfinement(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setVorticityConfinement: invalid float"); + + mMaterial.vorticityConfinement = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getVorticityConfinement() const +{ + return mMaterial.vorticityConfinement; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setSurfaceTension(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setSurfaceTension: invalid float"); + + mMaterial.surfaceTension = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getSurfaceTension() const +{ + return mMaterial.surfaceTension; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setCohesion(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setCohesion: invalid float"); + + mMaterial.cohesion = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getCohesion() const +{ + return mMaterial.cohesion; +} + +////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setAdhesion(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxFLIPMaterial::setAdhesion: invalid float"); + mMaterial.adhesion = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getAdhesion() const +{ + return mMaterial.adhesion; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setGravityScale(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxFLIPMaterial::setAdhesion: invalid float"); + mMaterial.gravityScale = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getGravityScale() const +{ + return mMaterial.gravityScale; +} + +/////////////////////////////////////////////////////////////////////////////// +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +NpCustomMaterial::NpCustomMaterial(const PxsCustomMaterialCore& desc) : + PxCustomMaterial(PxConcreteType::eCUSTOM_MATERIAL, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mMaterial(desc) +{ + mMaterial.mMaterial = this; // back-reference +} + +NpCustomMaterial::~NpCustomMaterial() +{ + NpPhysics::getInstance().removeCustomMaterialFromTable(*this); +} + +// PX_SERIALIZATION +void NpCustomMaterial::resolveReferences(PxDeserializationContext&) +{ + // ### this one could be automated if NpMaterial would inherit from MaterialCore + // ### well actually in that case the pointer would not even be needed.... + mMaterial.mMaterial = this; // Resolve MaterialCore::mMaterial + + // Maybe not the best place to do it but it has to be done before the shapes resolve material indices + // since the material index translation table is needed there. This requires that the materials have + // been added to the table already. + // PT: TODO: missing line here? +} + +void NpCustomMaterial::onRefCountZero() +{ + void* ud = userData; + + if (getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + NpFactory::getInstance().releaseCustomMaterialToPool(*this); + } + else + this->~NpCustomMaterial(); + + NpPhysics::getInstance().notifyDeletionListenersMemRelease(this, ud); +} + +NpCustomMaterial* NpCustomMaterial::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpCustomMaterial* obj = PX_PLACEMENT_NEW(address, NpCustomMaterial(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpCustomMaterial); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpCustomMaterial::release() +{ + RefCountable_decRefCount(*this); +} + +void NpCustomMaterial::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +PxU32 NpCustomMaterial::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +PX_INLINE void NpCustomMaterial::updateMaterial() +{ + NpPhysics::getInstance().updateCustomMaterial(*this); +} + +void NpCustomMaterial::setFriction(PxReal x) +{ + PX_UNUSED(x); +} + +PxReal NpCustomMaterial::getFriction() const +{ + return 0.0f; +} + +void NpCustomMaterial::setDamping(PxReal x) +{ + PX_UNUSED(x); +} + +PxReal NpCustomMaterial::getDamping() const +{ + return 0.0f; +} + + +/////////////////////////////////////////////////////////////////////////////// + +void NpCustomMaterial::setAdhesion(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxCustomMaterial::setAdhesion: invalid float"); + mMaterial.adhesion = x; + + updateMaterial(); +} + +PxReal NpCustomMaterial::getAdhesion() const +{ + return mMaterial.adhesion; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpCustomMaterial::setGravityScale(PxReal x) +{ + PX_CHECK_AND_RETURN(PxIsFinite(x), "PxCustomMaterial::setAdhesion: invalid float"); + mMaterial.gravityScale = x; + + updateMaterial(); +} + +PxReal NpCustomMaterial::getGravityScale() const +{ + return mMaterial.gravityScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpCustomMaterial::setAdhesionRadiusScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f , "PxCustomMaterial::setAdhesionRadiusScale: scale must be positive"); + mMaterial.adhesionRadiusScale = x; + + updateMaterial(); +} +PxReal NpCustomMaterial::getAdhesionRadiusScale() const +{ + return mMaterial.adhesionRadiusScale; +} +#endif + +////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setAdhesionRadiusScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setAdhesionRadiusScale: invalid float"); + + mMaterial.adhesionRadiusScale = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getAdhesionRadiusScale() const +{ + return mMaterial.adhesionRadiusScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setParticleFrictionScale(PxReal x) +{ + PX_CHECK_AND_RETURN(x >= 0.f, "PxPBDMaterial::setParticleFrictionScale: invalid float"); + + mMaterial.particleFrictionScale = x; + + updateMaterial(); +} + +PxReal NpPBDMaterial::getParticleFrictionScale() const +{ + return mMaterial.particleFrictionScale; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpPBDMaterial::setParticleAdhesionScale(PxReal adhesionScale) +{ + PX_CHECK_AND_RETURN(adhesionScale >= 0.f, "PxPBDMaterial::setParticleAdhesionScale: adhesion value must be >= 0"); + + mMaterial.particleAdhesionScale = adhesionScale; + + updateMaterial(); +} + + +PxReal NpPBDMaterial::getParticleAdhesionScale() const +{ + return mMaterial.particleAdhesionScale; +} + +/////////////////////////////////////////////////////////////////////////////// +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.h new file mode 100644 index 0000000..5d53c47 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPBDMaterial.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PBD_MATERIAL_H +#define NP_PBD_MATERIAL_H + +#include "common/PxSerialFramework.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" +#include "CmRefCountable.h" +#include "PxsPBDMaterialCore.h" +#include "PxPBDMaterial.h" + +namespace physx +{ + // Compared to other objects, materials are special since they belong to the SDK and not to scenes + // (similar to meshes). That's why the NpPBDMaterial does have direct access to the core material instead + // of having a buffered interface for it. Scenes will have copies of the SDK material table and there + // the materials will be buffered. + + class NpPBDMaterial : public PxPBDMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpPBDMaterial(PxBaseFlags baseFlags) : PxPBDMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpPBDMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpPBDMaterial(const PxsPBDMaterialCore& desc); + virtual ~NpPBDMaterial(); + + // PxBase + virtual void release() PX_OVERRIDE; + //~PxBase + + // PxRefCounted + virtual void acquireReference() PX_OVERRIDE; + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void onRefCountZero() PX_OVERRIDE; + //~PxRefCounted + + // PxParticleMaterial + virtual void setFriction(PxReal friction) PX_OVERRIDE; + virtual PxReal getFriction() const PX_OVERRIDE; + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setAdhesion(PxReal adhesion) PX_OVERRIDE; + virtual PxReal getAdhesion() const PX_OVERRIDE; + virtual void setGravityScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getGravityScale() const PX_OVERRIDE; + virtual void setAdhesionRadiusScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getAdhesionRadiusScale() const PX_OVERRIDE; + //~PxParticleMaterial + + // PxPBDMaterial + virtual void setViscosity(PxReal viscosity) PX_OVERRIDE; + virtual PxReal getViscosity() const PX_OVERRIDE; + virtual void setVorticityConfinement(PxReal vorticityConfinement) PX_OVERRIDE; + virtual PxReal getVorticityConfinement() const PX_OVERRIDE; + virtual void setSurfaceTension(PxReal surfaceTension) PX_OVERRIDE; + virtual PxReal getSurfaceTension() const PX_OVERRIDE; + virtual void setCohesion(PxReal cohesion) PX_OVERRIDE; + virtual PxReal getCohesion() const PX_OVERRIDE; + virtual void setLift(PxReal lift) PX_OVERRIDE; + virtual PxReal getLift() const PX_OVERRIDE; + virtual void setDrag(PxReal drag) PX_OVERRIDE; + virtual PxReal getDrag() const PX_OVERRIDE; + virtual void setCFLCoefficient(PxReal coefficient) PX_OVERRIDE; + virtual PxReal getCFLCoefficient() const PX_OVERRIDE; + virtual void setParticleFrictionScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getParticleFrictionScale() const PX_OVERRIDE; + virtual void setParticleAdhesionScale(PxReal adhesion) PX_OVERRIDE; + virtual PxReal getParticleAdhesionScale() const PX_OVERRIDE; + //~PxPBDMaterial + + PX_FORCE_INLINE static void getMaterialIndices(NpPBDMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsPBDMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpPBDMaterial::getMaterialIndices(NpPBDMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + class NpCustomMaterial : public PxCustomMaterial, public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + NpCustomMaterial(PxBaseFlags baseFlags) : PxCustomMaterial(baseFlags), mMaterial(PxEmpty) {} + virtual void resolveReferences(PxDeserializationContext& context); + static NpCustomMaterial* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + + // PxBase + virtual void onRefCountZero(); + //~PxBase + + void preExportDataReset() { Cm::RefCountable_preExportDataReset(*this); } + void exportExtraData(PxSerializationContext&) {} + void importExtraData(PxDeserializationContext&) {} + virtual void requiresObjects(PxProcessPxBaseCallback&) {} + //~PX_SERIALIZATION + NpCustomMaterial(const PxsCustomMaterialCore& desc); + virtual ~NpCustomMaterial(); + + virtual void release(); + + // PxRefCounted + virtual void acquireReference(); + virtual PxU32 getReferenceCount() const; + //~PxRefCounted + + // PxParticleMaterial + virtual void setFriction(PxReal friction) PX_OVERRIDE; + virtual PxReal getFriction() const PX_OVERRIDE; + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setAdhesion(PxReal adhesion) PX_OVERRIDE; + virtual PxReal getAdhesion() const PX_OVERRIDE; + virtual void setGravityScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getGravityScale() const PX_OVERRIDE; + virtual void setAdhesionRadiusScale(PxReal scale) PX_OVERRIDE; + virtual PxReal getAdhesionRadiusScale() const PX_OVERRIDE; + //~PxParticleMaterial + + PX_FORCE_INLINE static void getMaterialIndices(NpCustomMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount); + + private: + PX_INLINE void updateMaterial(); + + // PX_SERIALIZATION + public: + //~PX_SERIALIZATION + PxsCustomMaterialCore mMaterial; + }; + + PX_FORCE_INLINE void NpCustomMaterial::getMaterialIndices(NpCustomMaterial*const* materials, PxU16* materialIndices, PxU32 materialCount) + { + for (PxU32 i = 0; i < materialCount; i++) + materialIndices[i] = static_cast(materials[i])->mMaterial.mMaterialIndex; + } +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp new file mode 100644 index 0000000..51a63f6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.cpp @@ -0,0 +1,1172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "NpParticleSystem.h" + +#include "foundation/PxAllocator.h" +#include "foundation/PxArray.h" +#include "foundation/PxMath.h" +#include "foundation/PxMemory.h" +#include "foundation/PxSort.h" + +#include "common/PxPhysXCommonConfig.h" + +#include "cudamanager/PxCudaContext.h" +#include "cudamanager/PxCudaContextManager.h" + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxGridParticleSystem.h" +#endif +#include "PxRigidActor.h" + +#include "PxsSimulationController.h" + +#include "NpArticulationLink.h" +#include "NpRigidDynamic.h" +#include "NpScene.h" +#include "NpCheck.h" + +#include "ScBodyCore.h" +#include "ScParticleSystemCore.h" +#include "ScParticleSystemSim.h" +#include "ScParticleSystemShapeCore.h" + +#include "DyParticleSystemCore.h" + +#include "CmVisualization.h" + +#define PARTICLE_MAX_NUM_PARTITIONS_TEMP 32 +#define PARTICLE_MAX_NUM_PARTITIONS_FINAL 8 + +using namespace physx; + +namespace physx +{ +#if PX_ENABLE_DEBUG_VISUALIZATION + static void visualizeParticleSystem(PxRenderOutput& out, NpScene& npScene, const Sc::ParticleSystemCore& core) + { + if (!(core.getActorFlags() & PxActorFlag::eVISUALIZATION)) + return; + + const Sc::Scene& scScene = npScene.getScScene(); + + const bool visualizeAABBs = scScene.getVisualizationParameter(PxVisualizationParameter::eCOLLISION_AABBS) != 0.0f; + if (visualizeAABBs) + { + out << PxU32(PxDebugColor::eARGB_YELLOW) << PxMat44(PxIdentity); + Cm::renderOutputDebugBox(out, core.getSim()->getBounds()); + } + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + //////////////////////////////////////////////////////////////////////////////////////// + + PxPartitionedParticleCloth::PxPartitionedParticleCloth() + { + PxMemZero(this, sizeof(*this)); + } + + PxPartitionedParticleCloth::~PxPartitionedParticleCloth() + { + if (mCudaManager) + { + PxScopedCudaLock lock(*mCudaManager); + PxCudaContext* context = mCudaManager->getCudaContext(); + + if (context) + { + context->memFreeHost(accumulatedSpringsPerPartitions); + context->memFreeHost(accumulatedCopiesPerParticles); + context->memFreeHost(remapOutput); + context->memFreeHost(orderedSprings); + context->memFreeHost(sortedClothStartIndices); + context->memFreeHost(cloths); + } + } + } + + void PxPartitionedParticleCloth::allocateBuffers(PxU32 nbParticles, PxCudaContextManager* cudaManager) + { + mCudaManager = cudaManager; + + PxScopedCudaLock lock(*mCudaManager); + PxCudaContext* context = mCudaManager->getCudaContext(); + + const unsigned int CU_MEMHOSTALLOC_DEVICEMAP = 0x02; + const unsigned int CU_MEMHOSTALLOC_PORTABLE = 0x01; + + PxCUresult result = context->memHostAlloc(reinterpret_cast(&accumulatedSpringsPerPartitions), size_t(sizeof(PxU32) * PARTICLE_MAX_NUM_PARTITIONS_FINAL), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); // TODO AD: WTF where does 32 come from? + result = context->memHostAlloc(reinterpret_cast(&accumulatedCopiesPerParticles), size_t(sizeof(PxU32) * nbParticles), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); + result = context->memHostAlloc(reinterpret_cast(&orderedSprings), size_t(sizeof(PxParticleSpring) * nbSprings), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); + result = context->memHostAlloc(reinterpret_cast(&remapOutput), size_t(sizeof(PxU32) * nbSprings * 2), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); + result = context->memHostAlloc(reinterpret_cast(&sortedClothStartIndices), size_t(sizeof(PxU32) * nbCloths), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); + result = context->memHostAlloc(reinterpret_cast(&cloths), size_t(sizeof(PxParticleCloth) * nbCloths), CU_MEMHOSTALLOC_DEVICEMAP | CU_MEMHOSTALLOC_PORTABLE); + } + + //////////////////////////////////////////////////////////////////////////////////////// + + PxU32 NpParticleClothPreProcessor::computeSpringPartition(const PxParticleSpring& spring, const PxU32 partitionStartIndex, PxU32* partitionProgresses) + { + PxU32 partitionA = partitionProgresses[spring.ind0]; + PxU32 partitionB = partitionProgresses[spring.ind1]; + + const PxU32 combinedMask = (~partitionA & ~partitionB); + PxU32 availablePartition = combinedMask == 0 ? PARTICLE_MAX_NUM_PARTITIONS_TEMP : PxLowestSetBit(combinedMask); + + if (availablePartition == PARTICLE_MAX_NUM_PARTITIONS_TEMP) + { + return 0xFFFFFFFF; + } + + const PxU32 partitionBit = (1u << availablePartition); + partitionA |= partitionBit; + partitionB |= partitionBit; + + availablePartition += partitionStartIndex; + + partitionProgresses[spring.ind0] = partitionA; + partitionProgresses[spring.ind1] = partitionB; + + return availablePartition; + + } + + void NpParticleClothPreProcessor::writeSprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, + PxU32* orderedSprings, PxU32* accumulatedSpringsPerPartition) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * mNumParticles); + + PxU32 numUnpartitionedSprings = 0; + + // Goes through all the springs and assigns them to a partition. This code is exactly the same as in classifySprings + // except that we now know the start indices of all the partitions so we can write THEIR INDEX into the ordered spring + // index list. + // AD: All of this relies on the fact that we partition exactly the same way twice. Remember that when changing anything + // here. + for (PxU32 i = 0; i < mNumSprings; ++i) + { + const PxParticleSpring& spring = springs[i]; + + const PxU32 availablePartition = computeSpringPartition(spring, 0, partitionProgresses); + + if (availablePartition == 0xFFFFFFFF) + { + tempSprings[numUnpartitionedSprings++] = i; + continue; + } + + //output springs + orderedSprings[accumulatedSpringsPerPartition[availablePartition]++] = i; + } + + PxU32 partitionStartIndex = 0; + + // handle the overflow of springs we couldn't partition above. + while (numUnpartitionedSprings > 0) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * mNumParticles); + + partitionStartIndex += PARTICLE_MAX_NUM_PARTITIONS_TEMP; + + PxU32 newNumUnpartitionedSprings = 0; + + for (PxU32 i = 0; i < numUnpartitionedSprings; ++i) + { + const PxU32 springInd = tempSprings[i]; + const PxParticleSpring& spring = springs[springInd]; + + const PxU32 availablePartition = computeSpringPartition(spring, partitionStartIndex, partitionProgresses); + + if (availablePartition == 0xFFFFFFFF) + { + tempSprings[newNumUnpartitionedSprings++] = springInd; + continue; + } + + //output springs + orderedSprings[accumulatedSpringsPerPartition[availablePartition]++] = springInd; + } + + numUnpartitionedSprings = newNumUnpartitionedSprings; + } + + // at this point all of the springs are partitioned and in the ordered list. + } + + void NpParticleClothPreProcessor::classifySprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, physx::PxArray& tempSpringsPerPartition) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * mNumParticles); + + PxU32 numUnpartitionedSprings = 0; + + // Goes through all the springs and tries to partition, but will max out at 32 partitions (because we only have 32 bits) + for (PxU32 i = 0; i < mNumSprings; ++i) + { + const PxParticleSpring& spring = springs[i]; + + // will return the first partition where it's possible to place this spring. + const PxU32 availablePartition = computeSpringPartition(spring, 0, partitionProgresses); + + if (availablePartition == 0xFFFFFFFF) + { + // we couldn't find a partition, so we add the index to this list for later. + tempSprings[numUnpartitionedSprings++] = i; + continue; + } + + // tracks how many springs we have in each partition. + tempSpringsPerPartition[availablePartition]++; + } + + PxU32 partitionStartIndex = 0; + + // handle the overflow of the springs we couldn't partition above + // we work in batches of 32 bits. + while (numUnpartitionedSprings > 0) + { + //initialize the partition progress counter to be zero + PxMemZero(partitionProgresses, sizeof(PxU32) * mNumParticles); + + partitionStartIndex += PARTICLE_MAX_NUM_PARTITIONS_TEMP; + + //Keep partitioning the un-partitioned constraints and blat the whole thing to 0! + tempSpringsPerPartition.resize(PARTICLE_MAX_NUM_PARTITIONS_TEMP + tempSpringsPerPartition.size()); + PxMemZero(tempSpringsPerPartition.begin() + partitionStartIndex, sizeof(PxU32) * PARTICLE_MAX_NUM_PARTITIONS_TEMP); + + PxU32 newNumUnpartitionedSprings = 0; + + for (PxU32 i = 0; i < numUnpartitionedSprings; ++i) + { + const PxU32 springInd = tempSprings[i]; + + const PxParticleSpring& spring = springs[springInd]; + + const PxU32 availablePartition = computeSpringPartition(spring, partitionStartIndex, partitionProgresses); + + if (availablePartition == 0xFFFFFFFF) + { + tempSprings[newNumUnpartitionedSprings++] = springInd; + continue; + } + + tempSpringsPerPartition[availablePartition]++; + } + + numUnpartitionedSprings = newNumUnpartitionedSprings; + } + + // after all of this we have the number of springs per partition in tempSpringsPerPartition. we don't really know what spring will + // go where yet, that will follow later. + } + + PxU32* NpParticleClothPreProcessor::partitions(const PxParticleSpring* springs, PxU32* orderedSpringIndices) + { + //each particle has a partition progress counter + PxU32* tempPartitionProgresses = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * mNumParticles, "tempPartitionProgresses")); + + //this stores the spring index for the unpartitioned springs + PxU32* tempSprings = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * mNumSprings, "tempSprings")); + + PxArray tempSpringsPerPartition; + tempSpringsPerPartition.reserve(PARTICLE_MAX_NUM_PARTITIONS_TEMP); + tempSpringsPerPartition.forceSize_Unsafe(PARTICLE_MAX_NUM_PARTITIONS_TEMP); + + PxMemZero(tempSpringsPerPartition.begin(), sizeof(PxU32) * PARTICLE_MAX_NUM_PARTITIONS_TEMP); + + classifySprings(springs, tempPartitionProgresses, tempSprings, tempSpringsPerPartition); + + //compute number of partitions + PxU32 maxPartitions = 0; + for (PxU32 a = 0; a < tempSpringsPerPartition.size(); ++a, maxPartitions++) + { + if (tempSpringsPerPartition[a] == 0) + break; + } + + PxU32* tempAccumulatedSpringsPerPartition = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * maxPartitions, "mAccumulatedSpringsPerPartition")); + mNbPartitions = maxPartitions; // save the current number of partitions + + //compute run sum + PxU32 accumulation = 0; + for (PxU32 a = 0; a < maxPartitions; ++a) + { + PxU32 count = tempSpringsPerPartition[a]; + tempAccumulatedSpringsPerPartition[a] = accumulation; + accumulation += count; + } + PX_ASSERT(accumulation == mNumSprings); + + // this will assign the springs to partitions + writeSprings(springs, tempPartitionProgresses, tempSprings, + orderedSpringIndices, tempAccumulatedSpringsPerPartition); + +#if 0 && PX_CHECKED + //validate spring partitions + for (PxU32 i = 0; i < mNumSprings; ++i) + { + PxU32 springInd = orderedSprings[i]; + for (PxU32 j = i + 1; j < mNumSprings; ++j) + { + PxU32 otherSpringInd = orderedSprings[j]; + PX_ASSERT(springInd != otherSpringInd); + } + } + + PxArray mFound(mNumParticles); + PxU32 startIndex = 0; + for (PxU32 i = 0; i < maxPartition; ++i) + { + PxU32 endIndex = tempAccumulatedSpringsPerPartition[i]; + PxMemZero(mFound.begin(), sizeof(bool) * mNumParticles); + + for (PxU32 j = startIndex; j < endIndex; ++j) + { + PxU32 tetrahedronIdx = orderedSprings[j]; + const PxParticleSpring& spring = springs[tetrahedronIdx]; + + PX_ASSERT(!mFound[spring.ind0]); + PX_ASSERT(!mFound[spring.ind1]); + + mFound[spring.ind0] = true; + mFound[spring.ind1] = true; + } + + startIndex = endIndex; + } +#endif + + PX_FREE(tempPartitionProgresses); + PX_FREE(tempSprings); + return tempAccumulatedSpringsPerPartition; + } + + PxU32 NpParticleClothPreProcessor::combinePartitions(const PxParticleSpring* springs, const PxU32* orderedSpringIndices, const PxU32* accumulatedSpringsPerPartition, + PxU32* accumulatedSpringsPerCombinedPartition, PxParticleSpring* orderedSprings, PxU32* accumulatedCopiesPerParticles, PxU32* remapOutput) + { + // reduces the number of partitions from mNbPartitions to PARTICLE_MAX_NUM_PARTITIONS_FINAL + + const PxU32 nbPartitions = mNbPartitions; + mNbPartitions = PARTICLE_MAX_NUM_PARTITIONS_FINAL; + + PxMemZero(accumulatedSpringsPerCombinedPartition, sizeof(PxU32) * PARTICLE_MAX_NUM_PARTITIONS_FINAL); + + // ceil(nbPartitions/maxPartitions) -basically the number of "repetitions" before combining. Example, MAX_FINAL is 8, we have 20 total, so this is 3. + const PxU32 maxAccumulatedCP = (nbPartitions + PARTICLE_MAX_NUM_PARTITIONS_FINAL - 1) / PARTICLE_MAX_NUM_PARTITIONS_FINAL; + + // enough space for all partitions. + const PxU32 partitionArraySize = maxAccumulatedCP * PARTICLE_MAX_NUM_PARTITIONS_FINAL; + + // for each particle, have a table of all partitions. + const PxU32 nbPartitionTables = partitionArraySize * mNumParticles; + + // per-particle, stores whether particle is part of partition + PxU32* tempPartitionTablePerVert = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * nbPartitionTables, "tempPartitionTablePerVert")); + // per-particle, stores remapping ????? + PxU32* tempRemapTablePerVert = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * nbPartitionTables, "tempRemapTablePerVert")); + + // per-particle, stores the number of copies for each particle. + PxU32* tempNumCopiesEachVerts = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * mNumParticles, "tempNumCopiesEachVerts")); + PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * mNumParticles); + + //initialize partitionTablePerVert + for (PxU32 i = 0; i < nbPartitionTables; ++i) + { + tempPartitionTablePerVert[i] = 0xffffffff; + tempRemapTablePerVert[i] = 0xffffffff; + } + + // combine partitions: + // let PARTICLE_MAX_NUM_PARTITIONS_FINAL be 8 and the current number of partitions be 20 + // this will merge partition 0, 8, 16 into the first partition, + // then put 1, 9, 17 into the second partition, etc. + + // we move all the springs of partition x*PARTICLE_MAX_NUM_PARTITION_FINAL to the end of partition x, + // using the count variable. + + // output of this stage + // orderedSprings - has springs per partition + // accumulatedSpringsPerCombinedPartition - has number of springs of each partition + // tempPartitionTablePerVert - has spring index of spring that connects to this particle in this partition. + + mMaxSpringsPerPartition = 0; + PxU32 count = 0; + for (PxU32 i = 0; i < PARTICLE_MAX_NUM_PARTITIONS_FINAL; ++i) + { + PxU32 totalSpringsInPartition = 0; + for (PxU32 j = 0; j < maxAccumulatedCP; ++j) + { + PxU32 partitionId = i + PARTICLE_MAX_NUM_PARTITIONS_FINAL * j; + if (partitionId < nbPartitions) + { + const PxU32 startInd = partitionId == 0 ? 0 : accumulatedSpringsPerPartition[partitionId - 1]; + const PxU32 endInd = accumulatedSpringsPerPartition[partitionId]; + const PxU32 index = i * maxAccumulatedCP + j; + + for (PxU32 k = startInd; k < endInd; ++k) + { + const PxU32 springInd = orderedSpringIndices[k]; + + const PxParticleSpring& spring = springs[springInd]; + + orderedSprings[count] = spring; + + PX_ASSERT(spring.ind0 != spring.ind1); + tempPartitionTablePerVert[spring.ind0 * partitionArraySize + index] = count; + tempPartitionTablePerVert[spring.ind1 * partitionArraySize + index] = count + mNumSprings; + + count++; + } + + totalSpringsInPartition += (endInd - startInd); + } + } + + accumulatedSpringsPerCombinedPartition[i] = count; + mMaxSpringsPerPartition = PxMax(mMaxSpringsPerPartition, totalSpringsInPartition); + } + + PX_ASSERT(count == mNumSprings); + + PxMemZero(tempNumCopiesEachVerts, sizeof(PxU32) * mNumParticles); + bool* tempHasOccupied = reinterpret_cast(PX_ALLOC(sizeof(bool) * partitionArraySize, "tempOrderedSprings")); + + // compute num of copies and remap index + // + // remap table - builds a chain of indices of the same particle across partitions + // if particle x is at index y in partition 1, we build a table such that particle x in partition 2 can look up the index in partition 1 + // This basically maintains the gauss-seidel part of the solver, where each partition works on the results of the another partition. + // This remap table is build across combined partitions. So there will never be a remap into the same partition. + // + // numCopies is then the number of final copies, meaning all copies of each particle that don't have a remap into one of the following + // partitions. + // + for (PxU32 i = 0; i < mNumParticles; ++i) + { + // for each particle, use this list to track which partition is occupied. + PxMemZero(tempHasOccupied, sizeof(bool) * partitionArraySize); + + // partition table has size numPartitions for each particle, tells you the spring index for this partition + const PxU32* partitionTable = &tempPartitionTablePerVert[i * partitionArraySize]; + // remapTable is still empty (0xFFFFFFFF) + PxU32* remapTable = &tempRemapTablePerVert[i * partitionArraySize]; + + // for all of the final partitions. + for (PxU32 j = 0; j < PARTICLE_MAX_NUM_PARTITIONS_FINAL; ++j) + { + // start index of this combined partition in the initial partition array + const PxU32 startInd = j * maxAccumulatedCP; + // start index if the next combined partition in the initial partition array + PxU32 nextStartInd = (j + 1) * maxAccumulatedCP; + + // for our 8/20 example, that would be startInd 0, nextStartInd 3 because every + // final partition will be combined from 3 partitions. + + // go through the indices of this combined partition (0-2) + for (PxU32 k = 0; k < maxAccumulatedCP; ++k) + { + const PxU32 index = startInd + k; + if (partitionTable[index] != 0xffffffff) + { + // there is a spring in this partition connected to this particle + + bool found = false; + + // look at the next partition, potentially also further ahead to figure out if there is any other partition having this particle index. + for (PxU32 h = nextStartInd; h < partitionArraySize; ++h) + { + // check if any of the partitions in this combined partition is occupied. + const PxU32 remapInd = partitionTable[h]; + if (remapInd != 0xffffffff && !tempHasOccupied[h]) + { + // if it is, and none of the other partitions in the partition before already remapped to that one + remapTable[index] = remapInd; // maps from partition i to one of the next ones. + found = true; + tempHasOccupied[h] = true; // mark as occupied + nextStartInd++; // look one more (initial!) partition ahead for next remap. + break; + } + } + + if (!found) + { + tempNumCopiesEachVerts[i]++; // if not found, add one more copy as there won't be any follow-up partition taking this position as an input. + } + } + } + } + } + + + const PxU32 totalNumVerts = mNumSprings * 2; + + // compute a runSum for the number of copies for each particle + PxU32 totalCopies = 0; + for (PxU32 i = 0; i < mNumParticles; ++i) + { + totalCopies += tempNumCopiesEachVerts[i]; + accumulatedCopiesPerParticles[i] = totalCopies; + } + + const PxU32 remapOutputSize = totalNumVerts + totalCopies; + + // fill the output of the remap + // + // for all particle copies that are at the end of a remap chain, calculate the remap + // into the final accumulation buffer. + // + // the final accumulation buffer will have numCopies entries for each particle. + // + for (PxU32 i = 0; i < mNumParticles; ++i) + { + const PxU32 index = i * partitionArraySize; + const PxU32* partitionTable = &tempPartitionTablePerVert[index]; + PxU32* remapTable = &tempRemapTablePerVert[index]; + + PxU32 accumulatedCount = 0; + for (PxU32 j = 0; j < partitionArraySize; ++j) + { + const PxU32 vertInd = partitionTable[j]; + if (vertInd != 0xffffffff) + { + PxU32 remapInd = remapTable[j]; + + //this remap is in the accumulation buffer + if (remapInd == 0xffffffff) + { + const PxU32 start = i == 0 ? 0 : accumulatedCopiesPerParticles[i - 1]; + remapInd = totalNumVerts + start + accumulatedCount; + accumulatedCount++; + } + PX_ASSERT(remapInd < remapOutputSize); + remapOutput[vertInd] = remapInd; + } + } + + } + + PX_FREE(tempHasOccupied); + PX_FREE(tempPartitionTablePerVert); + PX_FREE(tempRemapTablePerVert); + PX_FREE(tempNumCopiesEachVerts); + + return remapOutputSize; + } + + void NpParticleClothPreProcessor::partitionSprings(const PxParticleClothDesc& clothDesc, PxPartitionedParticleCloth& output) + { + mNumSprings = clothDesc.nbSprings; + mNumParticles = clothDesc.nbParticles; + + // prepare the output + output.nbSprings = clothDesc.nbSprings; + output.nbCloths = clothDesc.nbCloths; + output.allocateBuffers(mNumParticles, mCudaContextManager); + + // will create a temp partitioning with too many partitions + PxU32* orderedSpringIndices = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * mNumSprings, "orderedSpringIndices")); + PxU32* accumulatedSpringsPerPartitionTemp = partitions(clothDesc.springs, orderedSpringIndices); + + // combine these partitions to a max of PARTICLE_MAX_NUM_PARTITIONS_FINAL + // build remap chains and accumulation buffer. + output.remapOutputSize = combinePartitions(clothDesc.springs, orderedSpringIndices, accumulatedSpringsPerPartitionTemp, output.accumulatedSpringsPerPartitions, + output.orderedSprings, output.accumulatedCopiesPerParticles, output.remapOutput); + + // get the max number of partitions for each cloth + // AD Todo: figure out why blendScale is computed like this. + PxParticleCloth* cloths = clothDesc.cloths; + for (PxU32 i = 0; i < clothDesc.nbCloths; ++i) + { + PxU32 maxPartitions = 0; + + for (PxU32 p = cloths[i].startVertexIndex, endIndex = cloths[i].startVertexIndex + cloths[i].numVertices; + p < endIndex; p++) + { + PxU32 copyStart = p == 0 ? 0 : output.accumulatedCopiesPerParticles[p - 1]; + PxU32 copyEnd = output.accumulatedCopiesPerParticles[p]; + + maxPartitions = PxMax(maxPartitions, copyEnd - copyStart); + } + + cloths[i].clothBlendScale = 1.f / (maxPartitions + 1); + } + + // sort the cloths in this clothDesc according to their startVertexIndex into the particle list. + PxSort(cloths, clothDesc.nbCloths); + + // reorder such that things still match after the sorting. + for (PxU32 i = 0; i < clothDesc.nbCloths; ++i) + { + output.sortedClothStartIndices[i] = cloths[i].startVertexIndex; + output.cloths[i] = cloths[i]; + } + + output.nbPartitions = mNbPartitions; + output.maxSpringsPerPartition = mMaxSpringsPerPartition; + + PX_FREE(accumulatedSpringsPerPartitionTemp); + PX_FREE(orderedSpringIndices); + } + + void NpParticleClothPreProcessor::release() + { + PX_DELETE_THIS; + } + + /////////////////////////////////////////////////////////////////////////////////////// + + NpPBDParticleSystem::NpPBDParticleSystem(PxU32 maxNeighborhood, PxCudaContextManager& cudaContextManager) : + NpParticleSystem(cudaContextManager, PxConcreteType::ePBD_PARTICLESYSTEM, NpType::ePBD_PARTICLESYSTEM, PxActorType::ePBD_PARTICLESYSTEM) + { + //PX_ASSERT(mCudaContextManager); + setSolverType(PxParticleSolverType::ePBD); + mCore.getShapeCore().initializeLLCoreData(maxNeighborhood); + enableCCD(false); + } + + + PxU32 NpPBDParticleSystem::createPhase(PxParticleMaterial* material, const PxParticlePhaseFlags flags) + { + if (material->getConcreteType() == PxConcreteType::ePBD_MATERIAL) + { + Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore(); + Dy::ParticleSystemCore& core = shapeCore.getLLCore(); + + PxU16 materialHandle = static_cast(material)->mMaterial.mMaterialIndex; + + const PxU32 groupID = mNextPhaseGroupID++; + + core.mPhaseGroupToMaterialHandle.pushBack(materialHandle); + + if (mCore.getSim()) + mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PHASE; + + return (groupID & PxParticlePhaseFlag::eParticlePhaseGroupMask) + | (PxU32(flags) & PxParticlePhaseFlag::eParticlePhaseFlagsMask); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPBDParticleSystem:createPhase(): the provided material is not supported by this type of particle system."); + return 0; + } + } + + void NpPBDParticleSystem::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if (npScene) + { + npScene->scRemoveParticleSystem(*this); + npScene->removeFromParticleSystemList(*this); + } + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyParticleSystem(this); + } + + void NpPBDParticleSystem::addParticleBuffer(PxParticleBuffer* clothBuffer) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpPBDParticleSystem::addParticleBuffer: this function cannot be called when the particle system is not inserted into the scene!"); + + mCore.getShapeCore().addParticleBuffer(clothBuffer); + } + + void NpPBDParticleSystem::removeParticleBuffer(PxParticleBuffer* clothBuffer) + { + mCore.getShapeCore().removeParticleBuffer(clothBuffer); + } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void NpPBDParticleSystem::visualize(PxRenderOutput& out, NpScene& npScene) const + { + visualizeParticleSystem(out, npScene, mCore); + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + static void internalAddRigidAttachment(PxRigidActor* actor, Sc::ParticleSystemCore& psCore) + { + Sc::BodyCore* core = getBodyCore(actor); + + psCore.addRigidAttachment(core); + } + + static void internalRemoveRigidAttachment(PxRigidActor* actor, Sc::ParticleSystemCore& psCore) + { + Sc::BodyCore* core = getBodyCore(actor); + psCore.removeRigidAttachment(core); + } + + void NpPBDParticleSystem::addRigidAttachment(PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpPBDParticleSystem::addRigidAttachment: particleSystem must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpPBDParticleSystem::addRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpPBDParticleSystem::addRigidAttachment: Illegal to call while simulation is running."); + + internalAddRigidAttachment(actor, mCore); + } + + void NpPBDParticleSystem::removeRigidAttachment(PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpPBDParticleSystem::removeRigidAttachment: particleSystem must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpPBDParticleSystem::removeRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpPBDParticleSystem::removeRigidAttachment: Illegal to call while simulation is running."); + + internalRemoveRigidAttachment(actor, mCore); + } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpFLIPParticleSystem::NpFLIPParticleSystem(PxCudaContextManager& cudaContextManager) : + NpParticleSystem(cudaContextManager, PxConcreteType::eFLIP_PARTICLESYSTEM, NpType::eFLIP_PARTICLESYSTEM, PxActorType::eFLIP_PARTICLESYSTEM) + { + //PX_ASSERT(mCudaContextManager); + setSolverType(PxParticleSolverType::eFLIP); + mCore.getShapeCore().initializeLLCoreData(0); + enableCCD(false); + } + + PxU32 NpFLIPParticleSystem::createPhase(PxParticleMaterial* material, const PxParticlePhaseFlags flags) + { + if (material->getConcreteType() == PxConcreteType::eFLIP_MATERIAL) + { + Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore(); + Dy::ParticleSystemCore& core = shapeCore.getLLCore(); + + PxU16 materialHandle = static_cast(material)->mMaterial.mMaterialIndex; + + const PxU32 groupID = mNextPhaseGroupID++; + + core.mPhaseGroupToMaterialHandle.pushBack(materialHandle); + + if (mCore.getSim()) + mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PHASE; + + return (groupID & PxParticlePhaseFlag::eParticlePhaseGroupMask) + | (PxU32(flags) & PxParticlePhaseFlag::eParticlePhaseFlagsMask); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxFLIPParticleSystem:createPhase(): the provided material is not supported by this type of particle system."); + return 0; + } + } + + void NpFLIPParticleSystem::getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id) + { + const PxI32 iid = static_cast(id); + x = iid % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + y = (iid / MAX_SPARSEGRID_DIM) % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + z = iid / MAX_SPARSEGRID_DIM / MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + } + + void NpFLIPParticleSystem::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if (npScene) + { + npScene->scRemoveParticleSystem(*this); + npScene->removeFromParticleSystemList(*this); + } + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyParticleSystem(this); + } + + void* NpFLIPParticleSystem::getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags) + { + NpScene* scene = getNpScene(); + if (!scene) + return NULL; + + if ((flags & (PxSparseGridDataFlag::eSUBGRID_MASK | PxSparseGridDataFlag::eSUBGRID_ID + | PxSparseGridDataFlag::eGRIDCELL_SOLID_GRADIENT_AND_SDF | PxSparseGridDataFlag::eGRIDCELL_SOLID_VELOCITY + | PxSparseGridDataFlag::eGRIDCELL_FLUID_SDF | PxSparseGridDataFlag::eGRIDCELL_FLUID_VELOCITY + )) == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxParticleSystem::getSparseGridDataPointer, specified data is not available."); + return NULL; + } + + NP_READ_CHECK(scene); + + return scene->getSimulationController()->getSparseGridDataPointer(*getCore().getSim()->getLowLevelParticleSystem(), flags, getCore().getSolverType()); + } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void NpFLIPParticleSystem::visualize(PxRenderOutput& out, NpScene& npScene) const + { + visualizeParticleSystem(out, npScene, mCore); + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + void NpFLIPParticleSystem::addParticleBuffer(PxParticleBuffer* particleBuffer) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpFLIPParticleSystem::addParticleBuffer: this function cannot be called when the particle system is not inserted into the scene!"); + + PxType type = particleBuffer->getConcreteType(); + if (type == PxConcreteType::ePARTICLE_BUFFER || type == PxConcreteType::ePARTICLE_DIFFUSE_BUFFER) + { + mCore.getShapeCore().addParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpFLIPParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + void NpFLIPParticleSystem::removeParticleBuffer(PxParticleBuffer* particleBuffer) + { + PxType type = particleBuffer->getConcreteType(); + if (type == PxConcreteType::ePARTICLE_BUFFER || type == PxConcreteType::ePARTICLE_DIFFUSE_BUFFER) + { + mCore.getShapeCore().removeParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpFLIPParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + NpMPMParticleSystem::NpMPMParticleSystem(PxCudaContextManager& cudaContextManager) : + NpParticleSystem(cudaContextManager, PxConcreteType::eMPM_PARTICLESYSTEM, NpType::eMPM_PARTICLESYSTEM, PxActorType::eMPM_PARTICLESYSTEM) + { + //PX_ASSERT(mCudaContextManager); + setSolverType(PxParticleSolverType::eMPM); + mCore.getShapeCore().initializeLLCoreData(0); + enableCCD(false); + } + + PxU32 NpMPMParticleSystem::createPhase(PxParticleMaterial* material, const PxParticlePhaseFlags flags) + { + if (material->getConcreteType() == PxConcreteType::eMPM_MATERIAL) + { + Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore(); + Dy::ParticleSystemCore& core = shapeCore.getLLCore(); + + PxU16 materialHandle = static_cast(material)->mMaterial.mMaterialIndex; + + const PxU32 groupID = mNextPhaseGroupID++; + + core.mPhaseGroupToMaterialHandle.pushBack(materialHandle); + + if (mCore.getSim()) + mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PHASE; + + return (groupID & PxParticlePhaseFlag::eParticlePhaseGroupMask) + | (PxU32(flags) & PxParticlePhaseFlag::eParticlePhaseFlagsMask); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxMPMParticleSystem:createPhase(): the provided material is not supported by this type of particle system."); + return 0; + } + } + + void NpMPMParticleSystem::getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id) + { + const PxI32 iid = static_cast(id); + x = iid % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + y = (iid / MAX_SPARSEGRID_DIM) % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + z = iid / MAX_SPARSEGRID_DIM / MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + } + + void NpMPMParticleSystem::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if (npScene) + { + npScene->scRemoveParticleSystem(*this); + npScene->removeFromParticleSystemList(*this); + } + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyParticleSystem(this); + } + + void* NpMPMParticleSystem::getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags) + { + if ((flags & (PxSparseGridDataFlag::eSUBGRID_MASK | PxSparseGridDataFlag::eSUBGRID_ID + | PxSparseGridDataFlag::eGRIDCELL_SOLID_GRADIENT_AND_SDF | PxSparseGridDataFlag::eGRIDCELL_SOLID_VELOCITY + | PxSparseGridDataFlag::eGRIDCELL_FLUID_SDF | PxSparseGridDataFlag::eGRIDCELL_FLUID_VELOCITY + )) == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxParticleSystem::getSparseGridDataPointer, specified data is not available."); + return NULL; + } + + NP_READ_CHECK(getNpScene()); + + NpScene* scene = getNpScene(); + return scene->getSimulationController()->getSparseGridDataPointer(*getCore().getSim()->getLowLevelParticleSystem(), flags, getCore().getSolverType()); + } + + void* NpMPMParticleSystem::getMPMDataPointer(PxMPMParticleDataFlag::Enum flags) + { + NpScene* scene = getNpScene(); + + if (!scene) + return NULL; + + if ((flags & (PxMPMParticleDataFlag::eMPM_AFFINE_C1 | PxMPMParticleDataFlag::eMPM_AFFINE_C2 | PxMPMParticleDataFlag::eMPM_AFFINE_C3 + | PxMPMParticleDataFlag::eMPM_DEFORMATION_GRADIENT_F1 | PxMPMParticleDataFlag::eMPM_DEFORMATION_GRADIENT_F2 | PxMPMParticleDataFlag::eMPM_DEFORMATION_GRADIENT_F3)) == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxMPMParticleSystem::copyData, specified data is not available."); + return NULL; + } + + NP_READ_CHECK(scene); + + return scene->getSimulationController()->getMPMDataPointer(*getCore().getSim()->getLowLevelParticleSystem(), flags); + } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void NpMPMParticleSystem::visualize(PxRenderOutput& out, NpScene& npScene) const + { + visualizeParticleSystem(out, npScene, mCore); + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + void NpMPMParticleSystem::addParticleBuffer(PxParticleBuffer* particleBuffer) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpMPMParticleSystem::addParticleBuffer: this function cannot be called when the particle system is not inserted into the scene!"); + + if (particleBuffer->getConcreteType() == PxConcreteType::ePARTICLE_BUFFER) + { + mCore.getShapeCore().addParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpMPMParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + void NpMPMParticleSystem::removeParticleBuffer(PxParticleBuffer* particleBuffer) + { + if (particleBuffer->getConcreteType() == PxConcreteType::ePARTICLE_BUFFER) + { + mCore.getShapeCore().removeParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpMPMParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + void NpMPMParticleSystem::addRigidAttachment(PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpMPMParticleSystem::addRigidAttachment: particleSystem must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpMPMParticleSystem::addRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpMPMParticleSystem::addRigidAttachment: Illegal to call while simulation is running."); + + internalAddRigidAttachment(actor, mCore); + } + + void NpMPMParticleSystem::removeRigidAttachment(PxRigidActor* actor) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpMPMParticleSystem::removeRigidAttachment: particleSystem must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpMPMParticleSystem::removeRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpMPMParticleSystem::removeRigidAttachment: Illegal to call while simulation is running."); + + internalRemoveRigidAttachment(actor, mCore); + } + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + NpCustomParticleSystem::NpCustomParticleSystem(PxCudaContextManager& cudaContextManager, PxU32 maxNeighborhood) : + NpParticleSystem(cudaContextManager, PxConcreteType::eCUSTOM_PARTICLESYSTEM, NpType::eCUSTOM_PARTICLESYSTEM, PxActorType::eCUSTOM_PARTICLESYSTEM) + { + //PX_ASSERT(mCudaContextManager); + setSolverType(PxParticleSolverType::eCUSTOM); + mCore.getShapeCore().initializeLLCoreData(maxNeighborhood); + enableCCD(false); + } + + void NpCustomParticleSystem::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if (npScene) + { + npScene->scRemoveParticleSystem(*this); + npScene->removeFromParticleSystemList(*this); + } + + PX_ASSERT(!isAPIWriteForbidden()); + NpDestroyParticleSystem(this); + } + + void NpCustomParticleSystem::getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id) + { + const PxI32 iid = static_cast(id); + x = iid % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + y = (iid / MAX_SPARSEGRID_DIM) % MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + z = iid / MAX_SPARSEGRID_DIM / MAX_SPARSEGRID_DIM + MIN_SPARSEGRID_ID; + } + + void* NpCustomParticleSystem::getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags) + { + if ((flags & (PxSparseGridDataFlag::eSUBGRID_MASK | PxSparseGridDataFlag::eSUBGRID_ID + | PxSparseGridDataFlag::eGRIDCELL_SOLID_GRADIENT_AND_SDF | PxSparseGridDataFlag::eGRIDCELL_SOLID_VELOCITY + | PxSparseGridDataFlag::eGRIDCELL_FLUID_SDF | PxSparseGridDataFlag::eGRIDCELL_FLUID_VELOCITY + )) == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, PX_FL, "PxParticleSystem::copySparseGridData, specified data is not available."); + return NULL; + } + + NP_READ_CHECK(getNpScene()); + + NpScene* scene = getNpScene(); + return scene->getSimulationController()->getSparseGridDataPointer(*getCore().getSim()->getLowLevelParticleSystem(), flags, getCore().getSolverType()); + } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void NpCustomParticleSystem::visualize(PxRenderOutput& out, NpScene& npScene) const + { + visualizeParticleSystem(out, npScene, mCore); + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + void NpCustomParticleSystem::addParticleBuffer(PxParticleBuffer* particleBuffer) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpCustomParticleSystem::addParticleBuffer: this function cannot be called when the particle system is not inserted into the scene!"); + + if (particleBuffer->getConcreteType() == PxConcreteType::ePARTICLE_BUFFER) + { + mCore.getShapeCore().addParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpCustomParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + void NpCustomParticleSystem::removeParticleBuffer(PxParticleBuffer* particleBuffer) + { + if (particleBuffer->getConcreteType() == PxConcreteType::ePARTICLE_BUFFER) + { + mCore.getShapeCore().removeParticleBuffer(particleBuffer); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "NpCustomParticleSystem:addParticleBuffer(): the provided buffer type is not supported by this type of particle system."); + } + } + + PxU32 NpCustomParticleSystem::createPhase(PxParticleMaterial* material, const PxParticlePhaseFlags flags) + { + if (material->getConcreteType() == PxConcreteType::eCUSTOM_MATERIAL) + { + Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore(); + Dy::ParticleSystemCore& core = shapeCore.getLLCore(); + + PxU16 materialHandle = static_cast(material)->mMaterial.mMaterialIndex; + + const PxU32 groupID = mNextPhaseGroupID++; + + core.mPhaseGroupToMaterialHandle.pushBack(materialHandle); + + if (mCore.getSim()) + mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PHASE; + + return (groupID & PxParticlePhaseFlag::eParticlePhaseGroupMask) + | (PxU32(flags) & PxParticlePhaseFlag::eParticlePhaseFlagsMask); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxCustomParticleSystem:createPhase(): the provided material is not supported by this type of particle system."); + return 0; + } + } + + void NpCustomParticleSystem::setCustomParticleCallback(PxCustomParticleSystemSolverCallback* callback) + { + mCore.setParticleSystemSolverCallback(callback); + } + PxCustomParticleSystemSolverCallback* + NpCustomParticleSystem::getCustomParticleCallback() const + { + return mCore.getParticleSystemSolverCallback(); + } +#endif + +} + +physx::PxParticleClothPreProcessor* PxCreateParticleClothPreProcessor(physx::PxCudaContextManager* cudaContextManager) +{ + physx::PxParticleClothPreProcessor* processor = PX_NEW(physx::NpParticleClothPreProcessor)(cudaContextManager); + return processor; +} + + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.h new file mode 100644 index 0000000..55f5993 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpParticleSystem.h @@ -0,0 +1,630 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PARTICLE_SYSTEM_H +#define NP_PARTICLE_SYSTEM_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxErrors.h" +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxVec3.h" + +#include "common/PxBase.h" +#include "common/PxRenderOutput.h" + +#include "PxActor.h" +#include "PxFiltering.h" +#include "PxParticleBuffer.h" +//#include "PxParticlePhase.h" +#include "PxParticleSolverType.h" +#include "PxParticleSystem.h" +#include "PxPBDParticleSystem.h" +#include "PxPBDMaterial.h" +#include "PxSceneDesc.h" +#include "PxSparseGridParams.h" + +#include "DyParticleSystem.h" + +#include "NpActor.h" +#include "NpActorTemplate.h" +#include "NpBase.h" + +#include "ScParticleSystemSim.h" + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxCustomParticleSystem.h" +#include "PxFLIPParticleSystem.h" +#include "PxFLIPMaterial.h" +#include "PxMPMParticleSystem.h" +#include "PxMPMMaterial.h" +#endif + +namespace physx +{ + class NpScene; + + class PxCudaContextManager; + class PxParticleMaterial; + class PxRigidActor; + class PxSerializationContext; + + namespace Sc + { + class ParticleSystemSim; + } + + template + class NpParticleSystem : public NpActorTemplate + { + public: + NpParticleSystem(PxCudaContextManager& contextManager, PxType concreteType, NpType::Enum npType, PxActorType::Enum actorType) : + NpActorTemplate(concreteType, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, npType), + mCore(actorType), + mCudaContextManager(&contextManager), + mNextPhaseGroupID(0) + { + + } + NpParticleSystem(PxBaseFlags baseFlags) : NpActorTemplate(baseFlags) + {} + + virtual ~NpParticleSystem() + { + //TODO!!!!! Do this correctly + //sParticleSystemIdPool.tryRemoveID(mID); + } + virtual void exportData(PxSerializationContext& /*context*/) const {} + //external API + + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const + { + NP_READ_CHECK(NpBase::getNpScene()); + + if (!NpBase::getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Querying bounds of a PxParticleSystem which is not part of a PxScene is not supported."); + return PxBounds3::empty(); + } + + const Sc::ParticleSystemSim* sim = mCore.getSim(); + PX_ASSERT(sim); + + PX_SIMD_GUARD; + + PxBounds3 bounds = sim->getBounds(); + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); + } + + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) + { + NpScene* npScene = NpBase::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(minPositionIters > 0, "NpParticleSystem::setSolverIterationCounts: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(minPositionIters <= 255, "NpParticleSystem::setSolverIterationCounts: positionIters must be no greater than 255!"); + PX_CHECK_AND_RETURN(minVelocityIters <= 255, "NpParticleSystem::setSolverIterationCounts: velocityIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxParticleSystem::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.") + + mCore.setSolverIterationCounts((minVelocityIters & 0xff) << 8 | (minPositionIters & 0xff)); + + //UPDATE_PVD_PROPERTY + } + + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const + { + NP_READ_CHECK(NpBase::getNpScene()); + + PxU16 x = mCore.getSolverIterationCounts(); + minVelocityIters = PxU32(x >> 8); + minPositionIters = PxU32(x & 0xff); + } + + virtual PxCudaContextManager* getCudaContextManager() const { return mCudaContextManager; } + + virtual void setRestOffset(PxReal restOffset) { scSetRestOffset(restOffset); } + virtual PxReal getRestOffset() const { return mCore.getRestOffset(); } + + virtual void setContactOffset(PxReal contactOffset) { scSetContactOffset(contactOffset); } + virtual PxReal getContactOffset() const { return mCore.getContactOffset(); } + + virtual void setParticleContactOffset(PxReal particleContactOffset) { scSetParticleContactOffset(particleContactOffset); } + virtual PxReal getParticleContactOffset() const { return mCore.getParticleContactOffset(); } + + virtual void setSolidRestOffset(PxReal solidRestOffset) { scSetSolidRestOffset(solidRestOffset); } + virtual PxReal getSolidRestOffset() const { return mCore.getSolidRestOffset(); } + + virtual void setMaxDepenetrationVelocity(PxReal v) {scSetMaxDepenetrationVelocity(v); } + virtual PxReal getMaxDepenetrationVelocity(){ return mCore.getMaxDepenetrationVelocity(); } + + virtual void setMaxVelocity(PxReal v) { scSetMaxVelocity(v); } + virtual PxReal getMaxVelocity() { return mCore.getMaxVelocity(); } + + virtual void setParticleSystemCallback(PxParticleSystemCallback* callback) { mCore.setParticleSystemCallback(callback); } + virtual PxParticleSystemCallback* getParticleSystemCallback() const { return mCore.getParticleSystemCallback(); } + // TOFIX + virtual void enableCCD(bool enable) { scSnableCCD(enable); } + + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) = 0; + + virtual PxFilterData getSimulationFilterData() const + { + return mCore.getShapeCore().getSimulationFilterData(); + } + + virtual void setSimulationFilterData(const PxFilterData& data) + { + mCore.getShapeCore().setSimulationFilterData(data); + } + + virtual void setParticleFlag(PxParticleFlag::Enum flag, bool val) + { + PxParticleFlags flags = mCore.getFlags(); + if (val) + flags.raise(flag); + else + flags.clear(flag); + mCore.setFlags(flags); + } + + virtual void setParticleFlags(PxParticleFlags flags) + { + mCore.setFlags(flags); + } + + virtual PxParticleFlags getParticleFlags() const + { + return mCore.getFlags(); + } + + + void setSolverType(const PxParticleSolverType::Enum solverType) { scSetSolverType(solverType); } + virtual PxParticleSolverType::Enum getSolverType() const { return mCore.getSolverType(); } + + + virtual PxU32 getNbParticleMaterials() const + { + const Sc::ParticleSystemShapeCore& shapeCore = mCore.getShapeCore(); + return shapeCore.getNbMaterialIndices(); + } + + virtual void setPeriodicBoundary(const PxVec3& boundary) + { + mCore.setPeriodicBoundary(boundary); + scSetDirtyFlag(); + } + + + virtual PxVec3 getPeriodicBoundary() const + { + return mCore.getPeriodicBoundary(); + } + + virtual void addParticleBuffer(PxParticleBuffer* userBuffer) = 0; + virtual void removeParticleBuffer(PxParticleBuffer* userBuffer) = 0; + + virtual PxU32 getGpuParticleSystemIndex() + { + NP_READ_CHECK(NpBase::getNpScene()); + PX_CHECK_AND_RETURN_VAL(NpBase::getNpScene(), "NpParticleSystem::getGpuParticleSystemIndex: particle system must be in a scene.", 0xffffffff); + + if (NpBase::getNpScene()->getFlags() & PxSceneFlag::eSUPPRESS_READBACK) + return mCore.getSim()->getLowLevelParticleSystem()->getGpuRemapId(); + return 0xffffffff; + } + + PX_FORCE_INLINE const Sc::ParticleSystemCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::ParticleSystemCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpParticleSystem, mCore); } + + PX_INLINE void scSetDirtyFlag() + { + NP_READ_CHECK(NpBase::getNpScene()); + NpScene* scene = NpBase::getNpScene(); + if (scene) + { + mCore.getSim()->getLowLevelParticleSystem()->mFlag |= Dy::ParticleSystemFlag::eUPDATE_PARAMS; + } + } + + PX_INLINE void scSetSleepThreshold(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setSleepThreshold(v); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetRestOffset(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setRestOffset(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetContactOffset(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setContactOffset(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetParticleContactOffset(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setParticleContactOffset(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetSolidRestOffset(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setSolidRestOffset(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetFluidRestOffset(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setFluidRestOffset(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetGridSizeX(const PxU32 v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setGridSizeX(v); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetGridSizeY(const PxU32 v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setGridSizeY(v); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetGridSizeZ(const PxU32 v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setGridSizeZ(v); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSnableCCD(const bool enable) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.enableCCD(enable); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetWind(const PxVec3& v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setWind(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetMaxDepenetrationVelocity(const PxReal v) + { + PX_CHECK_AND_RETURN(v > 0.f, "PxParticleSystem::setMaxDepenetrationVelocity: Max Depenetration Velocity must be > 0!"); + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setMaxDepenetrationVelocity(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetMaxVelocity(const PxReal v) + { + PX_CHECK_AND_RETURN(v > 0.f, "PxParticleSystem::setMaxVelocity: Max Velocity must be > 0!"); + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setMaxVelocity(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + + PX_INLINE void scSetSolverType(const PxParticleSolverType::Enum solverType) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setSolverType(solverType); + //UPDATE_PVD_PROPERTY + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PX_INLINE void scSetSparseGridParams(const PxSparseGridParams& params) + { + PX_CHECK_AND_RETURN(params.subgridSizeX > 1 && params.subgridSizeX % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeX must be > 1 and even number!"); + PX_CHECK_AND_RETURN(params.subgridSizeY > 1 && params.subgridSizeY % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeY must be > 1 and even number!"); + PX_CHECK_AND_RETURN(params.subgridSizeZ > 1 && params.subgridSizeZ % 2 == 0, "PxParticleSystem::setSparseGridParams: Sparse grid subgridSizeZ must be > 1 and even number!"); + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setSparseGridParams(params); + //UPDATE_PVD_PROPERTY + } +#endif + +#if PX_ENABLE_DEBUG_VISUALIZATION + virtual void visualize(PxRenderOutput& out, NpScene& npScene) const = 0; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + // Debug name + void setName(const char* debugName) + { + NP_WRITE_CHECK(NpBase::getNpScene()); + NpActor::mName = debugName; + } + + const char* getName() const + { + NP_READ_CHECK(NpBase::getNpScene()); + return NpActor::mName; + } + + virtual void setGridSizeX(PxU32 gridSizeX) { scSetGridSizeX(gridSizeX); } + virtual void setGridSizeY(PxU32 gridSizeY) { scSetGridSizeY(gridSizeY); } + virtual void setGridSizeZ(PxU32 gridSizeZ) { scSetGridSizeZ(gridSizeZ); } + + protected: + Sc::ParticleSystemCore mCore; + PxCudaContextManager* mCudaContextManager; + PxU32 mNextPhaseGroupID; + }; + + + class NpParticleClothPreProcessor : public PxParticleClothPreProcessor, public PxUserAllocated + { + public: + NpParticleClothPreProcessor(PxCudaContextManager* cudaContextManager) : mCudaContextManager(cudaContextManager), mNbPartitions(0){} + virtual ~NpParticleClothPreProcessor() {} + + virtual void release(); + + virtual void partitionSprings(const PxParticleClothDesc& clothDesc, PxPartitionedParticleCloth& output) PX_OVERRIDE; + + private: + PxU32 computeSpringPartition(const PxParticleSpring& springs, const PxU32 partitionStartIndex, PxU32* partitionProgresses); + + PxU32* partitions(const PxParticleSpring* springs, PxU32* orderedSpringIndices); + + PxU32 combinePartitions(const PxParticleSpring* springs, const PxU32* orderedSpringIndices, const PxU32* accumulatedSpringsPerPartition, + PxU32* accumulatedSpringsPerCombinedPartitions, PxParticleSpring* orderedSprings, PxU32* accumulatedCopiesPerParticles, PxU32* remapOutput); + + void classifySprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, physx::PxArray& springsPerPartition); + + void writeSprings(const PxParticleSpring* springs, PxU32* partitionProgresses, PxU32* tempSprings, PxU32* orderedSprings, + PxU32* accumulatedSpringsPerPartition); + + + PxCudaContextManager* mCudaContextManager; + + PxU32 mNumSprings; + PxU32 mNbPartitions; + PxU32 mNumParticles; + PxU32 mMaxSpringsPerPartition; + }; + + + class NpPBDParticleSystem : public NpParticleSystem + { + public: + + NpPBDParticleSystem(PxU32 maxNeighborhood, PxCudaContextManager& contextManager); + + virtual ~NpPBDParticleSystem(){} + + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE; + + virtual void release(); + + + virtual void setWind(const PxVec3& wind) { scSetWind(wind); } + virtual PxVec3 getWind() const { return mCore.getWind(); } + + virtual void setFluidBoundaryDensityScale(PxReal fluidBoundaryDensityScale) { scSetFluidBoundaryDensityScale(fluidBoundaryDensityScale); } + virtual PxReal getFluidBoundaryDensityScale() const { return mCore.getFluidBoundaryDensityScale(); } + + virtual void setFluidRestOffset(PxReal fluidRestOffset) { scSetFluidRestOffset(fluidRestOffset); } + virtual PxReal getFluidRestOffset() const { return mCore.getFluidRestOffset(); } + + +#if PX_ENABLE_DEBUG_VISUALIZATION + virtual void visualize(PxRenderOutput& out, NpScene& npScene) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::ePBD_PARTICLESYSTEM; } + + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer); + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer); + + virtual void addRigidAttachment(PxRigidActor* actor); + virtual void removeRigidAttachment(PxRigidActor* actor); + + private: + + PX_FORCE_INLINE void scSetFluidBoundaryDensityScale(const PxReal v) + { + PX_ASSERT(!NpBase::isAPIWriteForbidden()); + mCore.setFluidBoundaryDensityScale(v); + scSetDirtyFlag(); + //UPDATE_PVD_PROPERTY + } + }; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + class NpFLIPParticleSystem : public NpParticleSystem + { + public: + + NpFLIPParticleSystem(PxCudaContextManager& contextManager); + + virtual ~NpFLIPParticleSystem() {} + + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE; + virtual void release(); + + virtual void setSparseGridParams(const PxSparseGridParams& params) { scSetSparseGridParams(params); } + virtual PxSparseGridParams getSparseGridParams() const { return mCore.getSparseGridParams(); } + + virtual void* getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags); + + virtual void getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id); + + virtual void setFLIPParams(const PxFLIPParams& params) { scSetFLIPParams(params); } + virtual PxFLIPParams getFLIPParams() const { return mCore.getFLIPParams(); } + +#if PX_ENABLE_DEBUG_VISUALIZATION + virtual void visualize(PxRenderOutput& out, NpScene& npScene) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer); + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer); + + virtual void addRigidAttachment(PxRigidActor* /*actor*/) {} + virtual void removeRigidAttachment(PxRigidActor* /*actor*/) {} + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::eFLIP_PARTICLESYSTEM; } + + + + private: + + PX_FORCE_INLINE void scSetFLIPParams(const PxFLIPParams& params) + { + PX_CHECK_AND_RETURN(params.blendingFactor >= 0.f && params.blendingFactor <= 1.f, "PxParticleSystem::setFLIPParams: FLIP blending factor must be >= 0 and <= 1!"); + PX_ASSERT(!isAPIWriteForbidden()); + mCore.setFLIPParams(params); + //UPDATE_PVD_PROPERTY + } + + }; + + class NpMPMParticleSystem :public NpParticleSystem + { + public: + + NpMPMParticleSystem(PxCudaContextManager& contextManager); + + virtual ~NpMPMParticleSystem() {} + + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE; + virtual void release(); + + virtual void setSparseGridParams(const PxSparseGridParams& params) { scSetSparseGridParams(params); } + virtual PxSparseGridParams getSparseGridParams() const { return mCore.getSparseGridParams(); } + + virtual void* getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags); + + virtual void getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id); + + virtual void setMPMParams(const PxMPMParams& params) { scSetMPMParams(params); } + virtual PxMPMParams getMPMParams() const { return mCore.getMPMParams(); } + + virtual void* getMPMDataPointer(PxMPMParticleDataFlag::Enum flags); +#if PX_ENABLE_DEBUG_VISUALIZATION + virtual void visualize(PxRenderOutput& out, NpScene& npScene) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer); + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer); + + virtual void addRigidAttachment(PxRigidActor* actor); + virtual void removeRigidAttachment(PxRigidActor* actor); + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::eMPM_PARTICLESYSTEM; } + + private: + PX_INLINE void scSetMPMParams(const PxMPMParams& params) + { + mCore.setMPMParams(params); + //UPDATE_PVD_PROPERTY + } + }; + + class NpCustomParticleSystem : public NpParticleSystem + { + public: + + NpCustomParticleSystem(PxCudaContextManager& contextManager, PxU32 maxNeighborhood); + + virtual ~NpCustomParticleSystem() {} + + virtual void release(); + + + + virtual void setSparseGridParams(const PxSparseGridParams& params) { scSetSparseGridParams(params); } + virtual PxSparseGridParams getSparseGridParams() const { return mCore.getSparseGridParams(); } + + virtual void* getSparseGridDataPointer(PxSparseGridDataFlag::Enum flags); + + virtual void getSparseGridCoord(PxI32& x, PxI32& y, PxI32& z, PxU32 id); + + virtual PxU32 createPhase(PxParticleMaterial* material, PxParticlePhaseFlags flags) PX_OVERRIDE; + +#if PX_ENABLE_DEBUG_VISUALIZATION + virtual void visualize(PxRenderOutput& out, NpScene& npScene) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + virtual void addParticleBuffer(PxParticleBuffer* particleBuffer); + virtual void removeParticleBuffer(PxParticleBuffer* particleBuffer); + + virtual void addRigidAttachment(PxRigidActor* /*actor*/) {} + virtual void removeRigidAttachment(PxRigidActor* /*actor*/) {} + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::eCUSTOM_PARTICLESYSTEM; } + + virtual void setCustomParticleCallback(PxCustomParticleSystemSolverCallback* callback); + virtual PxCustomParticleSystemSolverCallback* getCustomParticleCallback() const; + }; +#endif + +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp new file mode 100644 index 0000000..8c7ef78 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.cpp @@ -0,0 +1,1776 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpPhysics.h" + +// PX_SERIALIZATION +#include "foundation/PxProfiler.h" +#include "foundation/PxIO.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxString.h" +#include "foundation/PxPhysicsVersion.h" +#include "common/PxTolerancesScale.h" +#include "CmCollection.h" +#include "CmUtils.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#if PX_SUPPORT_GPU_PHYSX +#include "NpSoftBody.h" +#include "NpParticleSystem.h" +#include "NpHairSystem.h" +#endif +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationLink.h" +#include "NpMaterial.h" +#include "GuHeightFieldData.h" +#include "GuHeightField.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "foundation/PxIntrinsics.h" +#include "PxvGlobals.h" // dynamic registration of HFs & articulations in LL +#include "GuOverlapTests.h" // dynamic registration of HFs in Gu +#include "PxDeletionListener.h" +#include "PxPhysicsSerialization.h" +#include "PvdPhysicsClient.h" + +#if PX_SUPPORT_OMNI_PVD +#include "omnipvd/NpOmniPvd.h" +#include "OmniPvdWriter.h" +#endif + +#if PX_SUPPORT_GPU_PHYSX +#include "PxPhysXGpu.h" +#endif + +//~PX_SERIALIZATION + +#include "NpFactory.h" + +#if PX_SWITCH +#include "switch/NpMiddlewareInfo.h" +#endif + +#if PX_SUPPORT_OMNI_PVD +# define OMNI_PVD_NOTIFY_ADD(OBJECT) mOmniPvdListener.onObjectAdd(OBJECT) +# define OMNI_PVD_NOTIFY_REMOVE(OBJECT) mOmniPvdListener.onObjectRemove(OBJECT) +#else +# define OMNI_PVD_NOTIFY_ADD(OBJECT) +# define OMNI_PVD_NOTIFY_REMOVE(OBJECT) +#endif + +using namespace physx; +using namespace Cm; + +bool NpPhysics::apiReentryLock = false; +NpPhysics* NpPhysics::mInstance = NULL; +PxU32 NpPhysics::mRefCount = 0; + +#if PX_CHECKED +bool NpPhysics::mHeightFieldsRegistered = false; //just for error checking +#endif + +NpPhysics::NpPhysics(const PxTolerancesScale& scale, const PxvOffsetTable& pxvOffsetTable, bool trackOutstandingAllocations, pvdsdk::PsPvd* pvd, PxFoundation& foundation, PxOmniPvd* omniPvd) : + mSceneArray ("physicsSceneArray"), + mPhysics (scale, pxvOffsetTable), + mDeletionListenersExist (false), + mFoundation (foundation) +#if PX_SUPPORT_GPU_PHYSX + , mNbRegisteredGpuClients (0) +#endif +{ + PX_UNUSED(trackOutstandingAllocations); + + //mMasterMaterialTable.reserve(10); + +#if PX_SUPPORT_PVD + mPvd = pvd; + if(pvd) + { + mPvdPhysicsClient = PX_NEW(Vd::PvdPhysicsClient)(mPvd); + foundation.registerErrorCallback(*mPvdPhysicsClient); + foundation.registerAllocationListener(*mPvd); + } + else + { + mPvdPhysicsClient = NULL; + } +#else + PX_UNUSED(pvd); +#endif + + // PT: please leave this commented-out block here. +/* + printf("sizeof(NpScene) = %d\n", sizeof(NpScene)); + printf("sizeof(NpShape) = %d\n", sizeof(NpShape)); + printf("sizeof(NpActor) = %d\n", sizeof(NpActor)); + printf("sizeof(NpRigidStatic) = %d\n", sizeof(NpRigidStatic)); + printf("sizeof(NpRigidDynamic) = %d\n", sizeof(NpRigidDynamic)); + printf("sizeof(NpMaterial) = %d\n", sizeof(NpMaterial)); + printf("sizeof(NpConstraint) = %d\n", sizeof(NpConstraint)); + printf("sizeof(NpAggregate) = %d\n", sizeof(NpAggregate)); + printf("sizeof(NpArticulationRC) = %d\n", sizeof(NpArticulationReducedCoordinate)); + + printf("sizeof(GeometryUnion) = %d\n", sizeof(GeometryUnion)); + printf("sizeof(PxGeometry) = %d\n", sizeof(PxGeometry)); + printf("sizeof(PxPlaneGeometry) = %d\n", sizeof(PxPlaneGeometry)); + printf("sizeof(PxSphereGeometry) = %d\n", sizeof(PxSphereGeometry)); + printf("sizeof(PxCapsuleGeometry) = %d\n", sizeof(PxCapsuleGeometry)); + printf("sizeof(PxBoxGeometry) = %d\n", sizeof(PxBoxGeometry)); + printf("sizeof(PxConvexMeshGeometry) = %d\n", sizeof(PxConvexMeshGeometry)); + printf("sizeof(PxConvexMeshGeometryLL) = %d\n", sizeof(PxConvexMeshGeometryLL)); + printf("sizeof(PxTriangleMeshGeometry) = %d\n", sizeof(PxTriangleMeshGeometry)); + printf("sizeof(PxTriangleMeshGeometryLL) = %d\n", sizeof(PxTriangleMeshGeometryLL)); + printf("sizeof(PxsShapeCore) = %d\n", sizeof(PxsShapeCore)); +*/ + +#if PX_SUPPORT_OMNI_PVD + mOmniPvdSampler = NULL; + mOmniPvd = NULL; + if (omniPvd) + { + OmniPvdWriter* omniWriter = omniPvd->getWriter(); + if (omniWriter && omniWriter->getWriteStream()) + { + mOmniPvdSampler = PX_NEW(::OmniPvdPxSampler)(); + mOmniPvd = omniPvd; + NpOmniPvd* npOmniPvd = static_cast(mOmniPvd); + NpOmniPvd::incRefCount(); + npOmniPvd->mPhysXSampler = mOmniPvdSampler; // Dirty hack to do startSampling from PxOmniPvd + mOmniPvdSampler->setOmniPvdWriter(omniPvd->getWriter()); + } + } +#else + PX_UNUSED(omniPvd); +#endif +} + +NpPhysics::~NpPhysics() +{ + // Release all scenes in case the user didn't do it + PxU32 nbScenes = mSceneArray.size(); + NpScene** scenes = mSceneArray.begin(); + for(PxU32 i=0;i 0) + //{ + // // It's done this way since the material destructor removes the material from the table and adjusts indices + + // PX_ASSERT(mMasterMaterialTable[0]->getRefCount() == 1); + // mMasterMaterialTable[0]->decRefCount(); + //} + //mMasterMaterialTable.clear(); + + mMasterMaterialManager.releaseMaterials(); + mMasterFEMSoftBodyMaterialManager.releaseMaterials(); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + mMasterFEMClothMaterialManager.releaseMaterials(); +#endif + mMasterPBDMaterialManager.releaseMaterials(); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + mMasterFLIPMaterialManager.releaseMaterials(); + mMasterMPMMaterialManager.releaseMaterials(); + mMasterCustomMaterialManager.releaseMaterials(); +#endif + +#if PX_SUPPORT_PVD + if(mPvd) + { + mPvdPhysicsClient->destroyPvdInstance(this); + mPvd->removeClient(mPvdPhysicsClient); + mFoundation.deregisterErrorCallback(*mPvdPhysicsClient); + PX_DELETE(mPvdPhysicsClient); + mFoundation.deregisterAllocationListener(*mPvd); + } +#endif + + const DeletionListenerMap::Entry* delListenerEntries = mDeletionListenerMap.getEntries(); + const PxU32 delListenerEntryCount = mDeletionListenerMap.size(); + for(PxU32 i=0; i < delListenerEntryCount; i++) + { + NpDelListenerEntry* listener = delListenerEntries[i].second; + PX_DELETE(listener); + } + mDeletionListenerMap.clear(); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_DESTROY(physics, static_cast(*this)) + PX_DELETE(mOmniPvdSampler); + if (mOmniPvd) + { + NpOmniPvd::decRefCount(); + } +#endif +} + +PxOmniPvd* NpPhysics::getOmniPvd() +{ +#if PX_SUPPORT_OMNI_PVD + return mOmniPvd; +#else + return NULL; +#endif +} + +void NpPhysics::initOffsetTables(PxvOffsetTable& pxvOffsetTable) +{ + // init offset tables for Pxs/Sc/Px conversions + { + Sc::OffsetTable& offsetTable = Sc::gOffsetTable; + offsetTable.scRigidStatic2PxActor = -ptrdiff_t(NpRigidStatic::getCoreOffset()); + offsetTable.scRigidDynamic2PxActor = -ptrdiff_t(NpRigidDynamic::getCoreOffset()); + offsetTable.scArticulationLink2PxActor = -ptrdiff_t(NpArticulationLink::getCoreOffset()); +#if PX_SUPPORT_GPU_PHYSX + offsetTable.scSoftBody2PxActor = -ptrdiff_t(NpSoftBody::getCoreOffset()); + offsetTable.scPBDParticleSystem2PxActor = -ptrdiff_t(NpPBDParticleSystem::getCoreOffset()); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + offsetTable.scFLIPParticleSystem2PxActor = -ptrdiff_t(NpFLIPParticleSystem::getCoreOffset()); + offsetTable.scMPMParticleSystem2PxActor = -ptrdiff_t(NpMPMParticleSystem::getCoreOffset()); + offsetTable.scCustomParticleSystem2PxActor = -ptrdiff_t(NpCustomParticleSystem::getCoreOffset()); + offsetTable.scHairSystem2PxActor = -ptrdiff_t(NpHairSystem::getCoreOffset()); +#endif +#endif + offsetTable.scArticulationRC2Px = -ptrdiff_t(NpArticulationReducedCoordinate::getCoreOffset()); + offsetTable.scArticulationJointRC2Px = -ptrdiff_t(NpArticulationJointReducedCoordinate::getCoreOffset()); + offsetTable.scConstraint2Px = -ptrdiff_t(NpConstraint::getCoreOffset()); + offsetTable.scShape2Px = -ptrdiff_t(NpShape::getCoreOffset()); + + for(PxU32 i=0;imOmniPvdListener); +#endif + +#if PX_SUPPORT_PVD + if(pvd) + { + NpFactory::getInstance().setNpFactoryListener( *mInstance->mPvdPhysicsClient ); + pvd->addClient(mInstance->mPvdPhysicsClient); + } +#endif + + NpFactory::getInstance().addFactoryListener(mInstance->mDeletionMeshListener); + } + ++mRefCount; + + return mInstance; +} + +PxU32 NpPhysics::releaseInstance() +{ + PX_ASSERT(mRefCount > 0); + if (--mRefCount) + return mRefCount; + +#if PX_SUPPORT_PVD + if(mInstance->mPvd) + { + NpFactory::getInstance().removeFactoryListener( *mInstance->mPvdPhysicsClient ); + } +#endif + + NpFactory::destroyInstance(); + + PX_ASSERT(mInstance); + PX_DELETE(mInstance); + + PxDecFoundationRefCount(); + + return mRefCount; +} + +void NpPhysics::release() +{ + NpPhysics::releaseInstance(); +} + +PxScene* NpPhysics::createScene(const PxSceneDesc& desc) +{ + PX_CHECK_AND_RETURN_NULL(desc.isValid(), "Physics::createScene: desc.isValid() is false!"); + + const PxTolerancesScale& scale = mPhysics.getTolerancesScale(); + const PxTolerancesScale& descScale = desc.getTolerancesScale(); + PX_UNUSED(scale); + PX_UNUSED(descScale); + PX_CHECK_AND_RETURN_NULL((descScale.length == scale.length) && (descScale.speed == scale.speed), "Physics::createScene: PxTolerancesScale must be the same as used for creation of PxPhysics!"); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); // done here because scene constructor accesses profiling manager of the SDK + + NpScene* npScene = PX_NEW (NpScene)(desc, *this); + if(!npScene) + { + mFoundation.error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Unable to create scene."); + return NULL; + } + if(!npScene->getTaskManagerFast()) + { + mFoundation.error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Unable to create scene. Task manager creation failed."); + return NULL; + } + + npScene->loadFromDesc(desc); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_ADD(physics, scenes, static_cast(*this), static_cast(*npScene)) +#endif + +#if PX_SUPPORT_PVD + if(mPvd) + { + npScene->getScenePvdClientInternal().setPsPvd(mPvd); + mPvd->addClient(&npScene->getScenePvdClientInternal()); + } +#endif + + if (!sendMaterialTable(*npScene) || !npScene->getScScene().isValid()) + { + PX_DELETE(npScene); + mFoundation.error(PxErrorCode::eOUT_OF_MEMORY, __FILE__, __LINE__, "Unable to create scene."); + return NULL; + } + + mSceneArray.pushBack(npScene); + return npScene; +} + +void NpPhysics::releaseSceneInternal(PxScene& scene) +{ + NpScene* pScene = static_cast(&scene); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_REMOVE(physics, scenes, static_cast(*this), scene) +#endif + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + for(PxU32 i=0;i(mSceneAndMaterialMutex)); + return mSceneArray.size(); +} + +PxU32 NpPhysics::getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSceneArray.begin(), mSceneArray.size()); +} + +PxRigidStatic* NpPhysics::createRigidStatic(const PxTransform& globalPose) +{ + PX_CHECK_AND_RETURN_NULL(globalPose.isSane(), "PxPhysics::createRigidStatic: invalid transform"); + return NpFactory::getInstance().createRigidStatic(globalPose.getNormalized()); +} + +PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags) +{ + PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL"); + PX_CHECK_AND_RETURN_NULL(materialCount>0, "createShape: material count is zero"); + +#if PX_CHECKED + const bool isHeightfield = geometry.getType() == PxGeometryType::eHEIGHTFIELD; + if (isHeightfield) + { + PX_CHECK_AND_RETURN_NULL(mHeightFieldsRegistered, "NpPhysics::createShape: Creating Heightfield shape without having called PxRegister[Unified]HeightFields()!"); + } + const bool hasMeshTypeGeom = isHeightfield || (geometry.getType() == PxGeometryType::eTRIANGLEMESH) || (geometry.getType() == PxGeometryType::eTETRAHEDRONMESH); + PX_CHECK_AND_RETURN_NULL(!(hasMeshTypeGeom && (shapeFlags & PxShapeFlag::eTRIGGER_SHAPE)), "NpPhysics::createShape: triangle mesh/heightfield/tetrahedron mesh triggers are not supported!"); + PX_CHECK_AND_RETURN_NULL(!((shapeFlags & PxShapeFlag::eSIMULATION_SHAPE) && (shapeFlags & PxShapeFlag::eTRIGGER_SHAPE)), "NpPhysics::createShape: shapes cannot simultaneously be trigger shapes and simulation shapes."); +#endif + + return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive); +} + +PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxFEMSoftBodyMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags) +{ + PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL"); + PX_CHECK_AND_RETURN_NULL(materialCount > 0, "createShape: material count is zero"); + PX_CHECK_AND_RETURN_NULL(geometry.getType() == PxGeometryType::eTETRAHEDRONMESH, "createShape: soft bodies only accept PxTetrahedronMeshGeometry"); + PX_CHECK_AND_RETURN_NULL(shapeFlags & PxShapeFlag::eSIMULATION_SHAPE, "createShape: soft body shapes must be simulation shapes"); + + return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxShape* NpPhysics::createShape(const PxGeometry& geometry, PxFEMClothMaterial*const * materials, PxU16 materialCount, bool isExclusive, PxShapeFlags shapeFlags) +{ + PX_CHECK_AND_RETURN_NULL(materials, "createShape: material pointer is NULL"); + PX_CHECK_AND_RETURN_NULL(materialCount > 0, "createShape: material count is zero"); + PX_CHECK_AND_RETURN_NULL(geometry.getType() == PxGeometryType::eTRIANGLEMESH, "createShape: cloth only accept PxTriangleMeshGeometry"); + PX_CHECK_AND_RETURN_NULL(shapeFlags & PxShapeFlag::eSIMULATION_SHAPE, "createShape: cloth shapes must be simulation shapes"); + + return NpFactory::getInstance().createShape(geometry, shapeFlags, materials, materialCount, isExclusive); +} +#else +PxShape* NpPhysics::createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags) +{ + return NULL; +} +#endif + +PxU32 NpPhysics::getNbShapes() const +{ + return NpFactory::getInstance().getNbShapes(); +} + +PxU32 NpPhysics::getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getShapes(userBuffer, bufferSize, startIndex); +} + +PxRigidDynamic* NpPhysics::createRigidDynamic(const PxTransform& globalPose) +{ + PX_CHECK_AND_RETURN_NULL(globalPose.isSane(), "PxPhysics::createRigidDynamic: invalid transform"); + return NpFactory::getInstance().createRigidDynamic(globalPose.getNormalized()); +} + +PxConstraint* NpPhysics::createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) +{ + return NpFactory::getInstance().createConstraint(actor0, actor1, connector, shaders, dataSize); +} + +PxArticulationReducedCoordinate* NpPhysics::createArticulationReducedCoordinate() +{ + return NpFactory::getInstance().createArticulationRC(); +} + +PxSoftBody* NpPhysics::createSoftBody(PxCudaContextManager& cudaContextManager) +{ + return NpFactory::getInstance().createSoftBody(cudaContextManager); +} + +PxPBDParticleSystem* NpPhysics::createPBDParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) +{ + return NpFactory::getInstance().createPBDParticleSystem(maxNeighborhood, cudaContexManager); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFLIPParticleSystem* NpPhysics::createFLIPParticleSystem(PxCudaContextManager& cudaContexManager) +{ + return NpFactory::getInstance().createFLIPParticleSystem(cudaContexManager); +} + +PxMPMParticleSystem* NpPhysics::createMPMParticleSystem(PxCudaContextManager& cudaContexManager) +{ + return NpFactory::getInstance().createMPMParticleSystem( cudaContexManager); +} + +PxCustomParticleSystem* NpPhysics::createCustomParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) +{ + return NpFactory::getInstance().createCustomParticleSystem(cudaContexManager, maxNeighborhood); +} + + PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager& cudaContextManager) + { + return NpFactory::getInstance().createFEMCloth(cudaContextManager); + } + +PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager& cudaContextManager) +{ + return NpFactory::getInstance().createHairSystem(cudaContextManager); +} +#else + PxFLIPParticleSystem* NpPhysics::createFLIPParticleSystem(PxCudaContextManager&) + { + return NULL; + } + + PxMPMParticleSystem* NpPhysics::createMPMParticleSystem(PxCudaContextManager&) + { + return NULL; + } + + PxCustomParticleSystem* NpPhysics::createCustomParticleSystem(PxCudaContextManager&, PxU32) + { + return NULL; + } + PxFEMCloth* NpPhysics::createFEMCloth(PxCudaContextManager&) + { + return NULL; + } + PxHairSystem* NpPhysics::createHairSystem(PxCudaContextManager&) + { + return NULL; + } +#endif + +PxBuffer* NpPhysics::createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContexManager) +{ + if(!cudaContexManager) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + return physxGpu->createBuffer(byteSize, bufferType, cudaContexManager, NULL); +#else + PX_UNUSED(byteSize); + PX_UNUSED(bufferType); + return NULL; +#endif +} + +PxAggregate* NpPhysics::createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) +{ + PX_CHECK_AND_RETURN_VAL(!(PxGetAggregateSelfCollisionBit(filterHint) && PxGetAggregateType(filterHint)==PxAggregateType::eSTATIC), + "PxPhysics::createAggregate: static aggregates with self-collisions are not allowed.", NULL); + + return NpFactory::getInstance().createAggregate(maxActors, maxShapes, filterHint); +} + +/////////////////////////////////////////////////////////////////////////////// + +NpMaterial* NpPhysics::addMaterial(NpMaterial* m) +{ + if(!m) + return NULL; + + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if(mMasterMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for(PxU32 i=0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::createMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +} + +PxMaterial* NpPhysics::createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) +{ + PxMaterial* m = NpFactory::getInstance().createMaterial(staticFriction, dynamicFriction, restitution); + + if (m) + return addMaterial(static_cast(m)); + else + return NULL; +} + +PxU32 NpPhysics::getNbMaterials() const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterMaterialManager.getNumMaterials(); +} + +PxU32 NpPhysics::getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterMaterialManager); + PxU32 writeCount =0; + PxU32 index = 0; + NpMaterial* mat; + while(iter.getNextMaterial(mat)) + { + if(index++ < startIndex) + continue; + if(writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} + +void NpPhysics::removeMaterialFromTable(NpMaterial& m) +{ + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for(PxU32 i=0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterMaterialManager.removeMaterial(m); +} + +void NpPhysics::updateMaterial(NpMaterial& m) +{ + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for(PxU32 i=0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterMaterialManager.updateMaterial(m); +} + +bool NpPhysics::sendMaterialTable(NpScene& scene) +{ + // note: no lock here because this method gets only called at scene creation and there we do lock + + NpMaterialManagerIterator iter(mMasterMaterialManager); + NpMaterial* mat; + while(iter.getNextMaterial(mat)) + scene.addMaterial(*mat); + +#if PX_SUPPORT_GPU_PHYSX + + NpMaterialManagerIterator iterSoftBody(mMasterFEMSoftBodyMaterialManager); + NpFEMSoftBodyMaterial* softmat; + while (iterSoftBody.getNextMaterial(softmat)) + scene.addMaterial(*softmat); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManagerIterator iterCloth(mMasterFEMClothMaterialManager); + NpFEMClothMaterial* clothmat; + while (iterCloth.getNextMaterial(clothmat)) + scene.addMaterial(*clothmat); +#endif + + NpMaterialManagerIterator iterPBD(mMasterPBDMaterialManager); + NpPBDMaterial* pbdmat; + while (iterPBD.getNextMaterial(pbdmat)) + scene.addMaterial(*pbdmat); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManagerIterator iterFLIP(mMasterFLIPMaterialManager); + NpFLIPMaterial* flipmat; + while (iterFLIP.getNextMaterial(flipmat)) + scene.addMaterial(*flipmat); + + NpMaterialManagerIterator iterMPM(mMasterMPMMaterialManager); + NpMPMMaterial* mpmmat; + while (iterMPM.getNextMaterial(mpmmat)) + scene.addMaterial(*mpmmat); + + NpMaterialManagerIterator iterCustom(mMasterCustomMaterialManager); + NpCustomMaterial* custommat; + while (iterCustom.getNextMaterial(custommat)) + scene.addMaterial(*custommat); +#endif + +#endif //PX_SUPPORT_GPU_PHYSX + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +NpFEMSoftBodyMaterial* NpPhysics::addFEMMaterial(NpFEMSoftBodyMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterFEMSoftBodyMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::createMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} + +PxFEMSoftBodyMaterial* NpPhysics::createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) +{ + PxFEMSoftBodyMaterial* m = NpFactory::getInstance().createFEMSoftBodyMaterial(youngs, poissons, dynamicFriction); + return addFEMMaterial(static_cast(m)); +} + +PxU32 NpPhysics::getNbFEMSoftBodyMaterials() const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterFEMSoftBodyMaterialManager.getNumMaterials(); +} + +PxU32 NpPhysics::getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterFEMSoftBodyMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpFEMSoftBodyMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} + +void NpPhysics::removeFEMSoftBodyMaterialFromTable(NpFEMSoftBodyMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterFEMSoftBodyMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updateFEMSoftBodyMaterial(NpFEMSoftBodyMaterial& m) +{ + +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterFEMSoftBodyMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +NpFEMClothMaterial* NpPhysics::addFEMClothMaterial(NpFEMClothMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterFEMClothMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::addFEMClothMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} + +PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) +{ + PxFEMClothMaterial* m = NpFactory::getInstance().createFEMClothMaterial(youngs, poissons, dynamicFriction); + return addFEMClothMaterial(static_cast(m)); +} +#else +PxFEMClothMaterial* NpPhysics::createFEMClothMaterial(PxReal, PxReal, PxReal) +{ + return NULL; +} +#endif + +PxU32 NpPhysics::getNbFEMClothMaterials() const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterFEMClothMaterialManager.getNumMaterials(); +#else + return 0; +#endif +} + +PxU32 NpPhysics::getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterFEMClothMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpFEMClothMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +#else + PX_UNUSED(userBuffer); PX_UNUSED(bufferSize); PX_UNUSED(startIndex); + return 0; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpPhysics::removeFEMClothMaterialFromTable(NpFEMClothMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterFEMClothMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updateFEMClothMaterial(NpFEMClothMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterFEMClothMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +NpPBDMaterial* NpPhysics::addPBDMaterial(NpPBDMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterPBDMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::addPBDMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} + +PxPBDMaterial* NpPhysics::createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, + PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) +{ + PxPBDMaterial* m = NpFactory::getInstance().createPBDMaterial(friction, damping, adhesion, viscosity, vorticityConfinement, surfaceTension, cohesion, lift, drag, cflCoefficient, gravityScale); + return addPBDMaterial(static_cast(m)); +} + +PxU32 NpPhysics::getNbPBDMaterials() const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterPBDMaterialManager.getNumMaterials(); +} + +PxU32 NpPhysics::getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterPBDMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpPBDMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} + +void NpPhysics::removePBDMaterialFromTable(NpPBDMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterPBDMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updatePBDMaterial(NpPBDMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterPBDMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +NpFLIPMaterial* NpPhysics::addFLIPMaterial(NpFLIPMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterFLIPMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::addFLIPMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} +#endif + + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) +{ + PxFLIPMaterial* m = NpFactory::getInstance().createFLIPMaterial(friction, damping, maxVelocity, viscosity, gravityScale); + return addFLIPMaterial(static_cast(m)); +} +#else +PxFLIPMaterial* NpPhysics::createFLIPMaterial(PxReal, PxReal, PxReal, PxReal, PxReal) +{ + return NULL; +} +#endif + +PxU32 NpPhysics::getNbFLIPMaterials() const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterFLIPMaterialManager.getNumMaterials(); +#else + return 0; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterFLIPMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpFLIPMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} +#else +PxU32 NpPhysics::getFLIPMaterials(PxFLIPMaterial** , PxU32, PxU32) const +{ + return 0; +} +#endif + + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpPhysics::removeFLIPMaterialFromTable(NpFLIPMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterFLIPMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updateFLIPMaterial(NpFLIPMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterFLIPMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +NpMPMMaterial* NpPhysics::addMPMMaterial(NpMPMMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_ADD(m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterMPMMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::addMPMMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} +#endif // PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) +{ + PxMPMMaterial* m = NpFactory::getInstance().createMPMMaterial(friction, damping, maxVelocity, isPlastic, youngsModulus, poissons, hardening, criticalCompression, criticalStretch, tensileDamageSensitivity, compressiveDamageSensitivity, attractiveForceResidual, gravityScale); + return addMPMMaterial(static_cast(m)); +} +#else +PxMPMMaterial* NpPhysics::createMPMMaterial(PxReal, PxReal, PxReal, bool, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal, PxReal) +{ + return NULL; +} +#endif + +PxU32 NpPhysics::getNbMPMMaterials() const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterMPMMaterialManager.getNumMaterials(); +#else + return 0; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterMPMMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpMPMMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} +#else +PxU32 NpPhysics::getMPMMaterials(PxMPMMaterial**, PxU32, PxU32) const +{ + return 0; +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpPhysics::removeMPMMaterialFromTable(NpMPMMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + OMNI_PVD_NOTIFY_REMOVE(&m); + + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterMPMMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updateMPMMaterial(NpMPMMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterMPMMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +NpCustomMaterial* NpPhysics::addCustomMaterial(NpCustomMaterial* m) +{ + if (!m) + return NULL; + +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + //the handle is set inside the setMaterial method + if (mMasterCustomMaterialManager.setMaterial(*m)) + { + // Let all scenes know of the new material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->addMaterial(*m); + } + return m; + } + else + { + mFoundation.error(PxErrorCode::eINVALID_PARAMETER, PX_FL, "PxPhysics::addCustomMaterial: limit of 64K materials reached."); + m->release(); + return NULL; + } +#else + m->release(); + return NULL; +#endif +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxCustomMaterial* NpPhysics::createCustomMaterial(void* gpuBuffer) +{ + PxCustomMaterial* m = NpFactory::getInstance().createCustomMaterial(gpuBuffer); + return addCustomMaterial(static_cast(m)); +} +#else +PxCustomMaterial* NpPhysics::createCustomMaterial(void*) +{ + return NULL; +} +#endif + +PxU32 NpPhysics::getNbCustomMaterials() const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + return mMasterCustomMaterialManager.getNumMaterials(); +#else + return 0; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxU32 NpPhysics::getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + PxMutex::ScopedLock lock(const_cast(mSceneAndMaterialMutex)); + NpMaterialManagerIterator iter(mMasterCustomMaterialManager); + PxU32 writeCount = 0; + PxU32 index = 0; + NpCustomMaterial* mat; + while (iter.getNextMaterial(mat)) + { + if (index++ < startIndex) + continue; + if (writeCount == bufferSize) + break; + userBuffer[writeCount++] = mat; + } + return writeCount; +} +#else +PxU32 NpPhysics::getCustomMaterials(PxCustomMaterial**, PxU32, PxU32) const +{ + return 0; +} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpPhysics::removeCustomMaterialFromTable(NpCustomMaterial& m) +{ +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the deleted material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->removeMaterial(m); + } + + mMasterCustomMaterialManager.removeMaterial(m); +#else + PX_UNUSED(m); +#endif +} + +void NpPhysics::updateCustomMaterial(NpCustomMaterial& m) +{ + +#if PX_SUPPORT_GPU_PHYSX + PxMutex::ScopedLock lock(mSceneAndMaterialMutex); + + // Let all scenes know of the updated material + for (PxU32 i = 0; i < mSceneArray.size(); i++) + { + NpScene* s = getScene(i); + s->updateMaterial(m); + } + mMasterCustomMaterialManager.updateMaterial(m); +#else + PX_UNUSED(m); +#endif +} +#endif // PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + +/////////////////////////////////////////////////////////////////////////////// + +PxTriangleMesh* NpPhysics::createTriangleMesh(PxInputStream& stream) +{ + return NpFactory::getInstance().createTriangleMesh(stream); +} + +PxU32 NpPhysics::getNbTriangleMeshes() const +{ + return NpFactory::getInstance().getNbTriangleMeshes(); +} + +PxU32 NpPhysics::getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getTriangleMeshes(userBuffer, bufferSize, startIndex); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxTetrahedronMesh* NpPhysics::createTetrahedronMesh(PxInputStream& stream) +{ + return NpFactory::getInstance().createTetrahedronMesh(stream); +} + +PxU32 NpPhysics::getNbTetrahedronMeshes() const +{ + return NpFactory::getInstance().getNbTetrahedronMeshes(); +} + +PxU32 NpPhysics::getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getTetrahedronMeshes(userBuffer, bufferSize, startIndex); +} + +PxSoftBodyMesh* NpPhysics::createSoftBodyMesh(PxInputStream& stream) +{ + return NpFactory::getInstance().createSoftBodyMesh(stream); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxHeightField* NpPhysics::createHeightField(PxInputStream& stream) +{ + return NpFactory::getInstance().createHeightField(stream); +} + +PxU32 NpPhysics::getNbHeightFields() const +{ + return NpFactory::getInstance().getNbHeightFields(); +} + +PxU32 NpPhysics::getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getHeightFields(userBuffer, bufferSize, startIndex); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxConvexMesh* NpPhysics::createConvexMesh(PxInputStream& stream) +{ + return NpFactory::getInstance().createConvexMesh(stream); +} + +PxU32 NpPhysics::getNbConvexMeshes() const +{ + return NpFactory::getInstance().getNbConvexMeshes(); +} + +PxU32 NpPhysics::getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getConvexMeshes(userBuffer, bufferSize, startIndex); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxBVH* NpPhysics::createBVH(PxInputStream& stream) +{ + return NpFactory::getInstance().createBVH(stream); +} + +PxU32 NpPhysics::getNbBVHs() const +{ + return NpFactory::getInstance().getNbBVHs(); +} + +PxU32 NpPhysics::getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return NpFactory::getInstance().getBVHs(userBuffer, bufferSize, startIndex); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxParticleBuffer* NpPhysics::createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContexManager) +{ + return NpFactory::getInstance().createParticleBuffer(maxParticles, maxVolumes, cudaContexManager); +} + +PxParticleAndDiffuseBuffer* NpPhysics::createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContexManager) +{ + return NpFactory::getInstance().createParticleAndDiffuseBuffer(maxParticles, maxVolumes, maxDiffuseParticles, cudaContexManager); +} + +PxParticleClothBuffer* NpPhysics::createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContexManager) +{ + return NpFactory::getInstance().createParticleClothBuffer(maxParticles, maxNumVolumes, maxNumCloths, maxNumTriangles, maxNumSprings, cudaContexManager); +} + +PxParticleRigidBuffer* NpPhysics::createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContexManager) +{ + return NpFactory::getInstance().createParticleRigidBuffer(maxParticles, maxNumVolumes, maxNumRigids, cudaContexManager); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxPruningStructure* NpPhysics::createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) +{ + PX_SIMD_GUARD; + + PX_ASSERT(actors); + PX_ASSERT(nbActors > 0); + + Sq::PruningStructure* ps = PX_NEW(Sq::PruningStructure)(); + if(!ps->build(actors, nbActors)) + { + PX_DELETE(ps); + } + return ps; +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX +void NpPhysics::registerPhysXIndicatorGpuClient() +{ + PxMutex::ScopedLock lock(mPhysXIndicatorMutex); + + ++mNbRegisteredGpuClients; + + mPhysXIndicator.setIsGpu(mNbRegisteredGpuClients>0); +} + +void NpPhysics::unregisterPhysXIndicatorGpuClient() +{ + PxMutex::ScopedLock lock(mPhysXIndicatorMutex); + + if (mNbRegisteredGpuClients) + --mNbRegisteredGpuClients; + + mPhysXIndicator.setIsGpu(mNbRegisteredGpuClients>0); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void NpPhysics::registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet) +{ + PxMutex::ScopedLock lock(mDeletionListenerMutex); + + const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer); + if(!entry) + { + NpDelListenerEntry* e = PX_NEW(NpDelListenerEntry)(deletionEvents, restrictedObjectSet); + if (e) + { + if (mDeletionListenerMap.insert(&observer, e)) + mDeletionListenersExist = true; + else + { + PX_DELETE(e); + PX_ALWAYS_ASSERT(); + } + } + } + else + PX_ASSERT(mDeletionListenersExist); +} + +void NpPhysics::unregisterDeletionListener(PxDeletionListener& observer) +{ + PxMutex::ScopedLock lock(mDeletionListenerMutex); + + const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer); + if(entry) + { + NpDelListenerEntry* e = entry->second; + mDeletionListenerMap.erase(&observer); + PX_DELETE(e); + } + mDeletionListenersExist = mDeletionListenerMap.size()>0; +} + +void NpPhysics::registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) +{ + PxMutex::ScopedLock lock(mDeletionListenerMutex); + + const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer); + if(entry) + { + NpDelListenerEntry* e = entry->second; + PX_CHECK_AND_RETURN(e->restrictedObjectSet, "PxPhysics::registerDeletionListenerObjects: deletion listener is not configured to receive events from specific objects."); + + e->registeredObjects.reserve(e->registeredObjects.size() + observableCount); + for(PxU32 i=0; i < observableCount; i++) + e->registeredObjects.insert(observables[i]); + } + else + { + PX_CHECK_AND_RETURN(false, "PxPhysics::registerDeletionListenerObjects: deletion listener has to be registered in PxPhysics first."); + } +} + +void NpPhysics::unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) +{ + PxMutex::ScopedLock lock(mDeletionListenerMutex); + + const DeletionListenerMap::Entry* entry = mDeletionListenerMap.find(&observer); + if(entry) + { + NpDelListenerEntry* e = entry->second; + if (e->restrictedObjectSet) + { + for(PxU32 i=0; i < observableCount; i++) + e->registeredObjects.erase(observables[i]); + } + else + { + PX_CHECK_AND_RETURN(false, "PxPhysics::unregisterDeletionListenerObjects: deletion listener is not configured to receive events from specific objects."); + } + } + else + { + PX_CHECK_AND_RETURN(false, "PxPhysics::unregisterDeletionListenerObjects: deletion listener has to be registered in PxPhysics first."); + } +} + +void NpPhysics::notifyDeletionListeners(const PxBase* base, void* userData, PxDeletionEventFlag::Enum deletionEvent) +{ + // we don't protect the check for whether there are any listeners, because we don't want to take a hit in the + // common case where there are no listeners. Note the API comments here, that users should not register or + // unregister deletion listeners while deletions are occurring + + if(mDeletionListenersExist) + { + PxMutex::ScopedLock lock(mDeletionListenerMutex); + + const DeletionListenerMap::Entry* delListenerEntries = mDeletionListenerMap.getEntries(); + const PxU32 delListenerEntryCount = mDeletionListenerMap.size(); + for(PxU32 i=0; i < delListenerEntryCount; i++) + { + const NpDelListenerEntry* entry = delListenerEntries[i].second; + + if (entry->flags & deletionEvent) + { + if (entry->restrictedObjectSet) + { + if (entry->registeredObjects.contains(base)) + delListenerEntries[i].first->onRelease(base, userData, deletionEvent); + } + else + delListenerEntries[i].first->onRelease(base, userData, deletionEvent); + } + } + } +} + +#if PX_SUPPORT_OMNI_PVD +void NpPhysics::OmniPvdListener::onObjectAdd(const PxBase* object) +{ + ::OmniPvdPxSampler::getInstance()->onObjectAdd(object); +} + +void NpPhysics::OmniPvdListener::onObjectRemove(const PxBase* object) +{ + ::OmniPvdPxSampler::getInstance()->onObjectRemove(object); +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +const PxTolerancesScale& NpPhysics::getTolerancesScale() const +{ + return mPhysics.getTolerancesScale(); +} + +PxFoundation& NpPhysics::getFoundation() +{ + return mFoundation; +} + +PxPhysics& PxGetPhysics() +{ + return NpPhysics::getInstance(); +} + +PxPhysics* PxCreateBasePhysics(PxU32 version, PxFoundation& foundation, const PxTolerancesScale& scale, bool trackOutstandingAllocations, PxPvd* pvd, PxOmniPvd* omniPvd) +{ + return NpPhysics::createInstance(version, foundation, scale, trackOutstandingAllocations, static_cast(pvd), omniPvd); +} + +//void PxRegisterArticulations(PxPhysics& physics) +//{ +// PX_UNUSED(&physics); // for the moment +// Dy::PxvRegisterArticulations(); +// NpFactory::registerArticulations(); +//} + +void PxRegisterArticulationsReducedCoordinate(PxPhysics& physics) +{ + PX_UNUSED(&physics); // for the moment + Dy::PxvRegisterArticulationsReducedCoordinate(); + NpFactory::registerArticulationRCs(); +} + +void PxRegisterHeightFields(PxPhysics& physics) +{ + PX_UNUSED(&physics); // for the moment + PX_CHECK_AND_RETURN(NpPhysics::getInstance().getNumScenes() == 0, "PxRegisterHeightFields: it is illegal to call a heightfield registration function after you have a scene."); + + PxvRegisterHeightFields(); + Gu::registerHeightFields(); +#if PX_CHECKED + NpPhysics::heightfieldsAreRegistered(); +#endif +} + +void PxAddCollectionToPhysics(const PxCollection& collection) +{ + NpFactory& factory = NpFactory::getInstance(); + const Cm::Collection& c = static_cast(collection); + factory.addCollection(c); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.h new file mode 100644 index 0000000..1e6bc0a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysics.h @@ -0,0 +1,450 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PHYSICS_H +#define NP_PHYSICS_H + +#include "PxPhysics.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "GuMeshFactory.h" +#include "NpMaterial.h" +#include "NpFEMSoftBodyMaterial.h" +#include "NpFEMClothMaterial.h" +#include "NpPBDMaterial.h" +#include "NpFLIPMaterial.h" +#include "NpMPMMaterial.h" +#include "NpPhysicsInsertionCallback.h" +#include "NpMaterialManager.h" +#include "ScPhysics.h" + +#ifdef LINUX +#include +#endif + +#if PX_SUPPORT_GPU_PHYSX +#include "device/PhysXIndicator.h" +#endif + +#include "PsPvd.h" + +#if PX_SUPPORT_OMNI_PVD +class OmniPvdPxSampler; +namespace physx +{ + class PxOmniPvd; +} +#endif + +namespace physx +{ + +#if PX_SUPPORT_PVD +namespace Vd +{ + class PvdPhysicsClient; +} +#endif + struct NpMaterialIndexTranslator + { + NpMaterialIndexTranslator() : indicesNeedTranslation(false) {} + + PxHashMap map; + bool indicesNeedTranslation; + }; + + class NpScene; + struct PxvOffsetTable; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4996) // We have to implement deprecated member functions, do not warn. +#endif + +template class NpMaterialAccessor; + +class NpPhysics : public PxPhysics, public PxUserAllocated +{ + NpPhysics& operator=(const NpPhysics&); + NpPhysics(const NpPhysics &); + + struct NpDelListenerEntry : public PxUserAllocated + { + NpDelListenerEntry(const PxDeletionEventFlags& de, bool restrictedObjSet) + : flags(de) + , restrictedObjectSet(restrictedObjSet) + { + } + + PxHashSet registeredObjects; // specifically registered objects for deletion events + PxDeletionEventFlags flags; + bool restrictedObjectSet; + }; + + + NpPhysics( const PxTolerancesScale& scale, + const PxvOffsetTable& pxvOffsetTable, + bool trackOutstandingAllocations, + physx::pvdsdk::PsPvd* pvd, + PxFoundation&, + physx::PxOmniPvd* omniPvd); + virtual ~NpPhysics(); + +public: + + static NpPhysics* createInstance( PxU32 version, + PxFoundation& foundation, + const PxTolerancesScale& scale, + bool trackOutstandingAllocations, + physx::pvdsdk::PsPvd* pvd, + physx::PxOmniPvd* omniPvd); + + static PxU32 releaseInstance(); + + static NpPhysics& getInstance() { return *mInstance; } + + virtual void release() PX_OVERRIDE; + + virtual PxOmniPvd* getOmniPvd() PX_OVERRIDE; + + virtual PxScene* createScene(const PxSceneDesc&) PX_OVERRIDE; + void releaseSceneInternal(PxScene&); + virtual PxU32 getNbScenes() const PX_OVERRIDE; + virtual PxU32 getScenes(PxScene** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxRigidStatic* createRigidStatic(const PxTransform&) PX_OVERRIDE; + virtual PxRigidDynamic* createRigidDynamic(const PxTransform&) PX_OVERRIDE; + virtual PxArticulationReducedCoordinate* createArticulationReducedCoordinate() PX_OVERRIDE; + virtual PxSoftBody* createSoftBody(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; + virtual PxHairSystem* createHairSystem(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; + virtual PxFEMCloth* createFEMCloth(PxCudaContextManager& cudaContextManager) PX_OVERRIDE; + virtual PxPBDParticleSystem* createPBDParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE; + virtual PxFLIPParticleSystem* createFLIPParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE; + virtual PxMPMParticleSystem* createMPMParticleSystem(PxCudaContextManager& cudaContexManager) PX_OVERRIDE; + virtual PxCustomParticleSystem* createCustomParticleSystem(PxCudaContextManager& cudaContexManager, PxU32 maxNeighborhood) PX_OVERRIDE; + + virtual PxBuffer* createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContextManager) PX_OVERRIDE; + virtual PxConstraint* createConstraint(PxRigidActor* actor0, PxRigidActor* actor1, PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) PX_OVERRIDE; + virtual PxAggregate* createAggregate(PxU32 maxActors, PxU32 maxShapes, PxAggregateFilterHint filterHint) PX_OVERRIDE; + + virtual PxShape* createShape(const PxGeometry&, PxMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; + virtual PxShape* createShape(const PxGeometry&, PxFEMSoftBodyMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; + virtual PxShape* createShape(const PxGeometry&, PxFEMClothMaterial*const *, PxU16, bool, PxShapeFlags shapeFlags) PX_OVERRIDE; + + virtual PxU32 getNbShapes() const PX_OVERRIDE; + virtual PxU32 getShapes(PxShape** userBuffer, PxU32 bufferSize, PxU32 startIndex) const PX_OVERRIDE; + + virtual PxMaterial* createMaterial(PxReal staticFriction, PxReal dynamicFriction, PxReal restitution) PX_OVERRIDE; + virtual PxU32 getNbMaterials() const PX_OVERRIDE; + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxFEMSoftBodyMaterial* createFEMSoftBodyMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE; + virtual PxU32 getNbFEMSoftBodyMaterials() const PX_OVERRIDE; + virtual PxU32 getFEMSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxFEMClothMaterial* createFEMClothMaterial(PxReal youngs, PxReal poissons, PxReal dynamicFriction) PX_OVERRIDE; + virtual PxU32 getNbFEMClothMaterials() const PX_OVERRIDE; + virtual PxU32 getFEMClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxPBDMaterial* createPBDMaterial(PxReal friction, PxReal damping, PxReal adhesion, PxReal viscosity, PxReal vorticityConfinement, PxReal surfaceTension, PxReal cohesion, PxReal lift, PxReal drag, PxReal cflCoefficient, PxReal gravityScale) PX_OVERRIDE; + virtual PxU32 getNbPBDMaterials() const PX_OVERRIDE; + virtual PxU32 getPBDMaterials(PxPBDMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxFLIPMaterial* createFLIPMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, PxReal viscosity, PxReal gravityScale) PX_OVERRIDE; + virtual PxU32 getNbFLIPMaterials() const PX_OVERRIDE; + virtual PxU32 getFLIPMaterials(PxFLIPMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxMPMMaterial* createMPMMaterial(PxReal friction, PxReal damping, PxReal maxVelocity, bool isPlastic, PxReal youngsModulus, PxReal poissons, PxReal hardening, PxReal criticalCompression, PxReal criticalStretch, PxReal tensileDamageSensitivity, PxReal compressiveDamageSensitivity, PxReal attractiveForceResidual, PxReal gravityScale) PX_OVERRIDE; + virtual PxU32 getNbMPMMaterials() const PX_OVERRIDE; + virtual PxU32 getMPMMaterials(PxMPMMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxCustomMaterial* createCustomMaterial(void* gpuBuffer) PX_OVERRIDE; + virtual PxU32 getNbCustomMaterials() const PX_OVERRIDE; + virtual PxU32 getCustomMaterials(PxCustomMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxTriangleMesh* createTriangleMesh(PxInputStream&) PX_OVERRIDE; + virtual PxU32 getNbTriangleMeshes() const PX_OVERRIDE; + virtual PxU32 getTriangleMeshes(PxTriangleMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxTetrahedronMesh* createTetrahedronMesh(PxInputStream&) PX_OVERRIDE; + virtual PxU32 getNbTetrahedronMeshes() const PX_OVERRIDE; + virtual PxU32 getTetrahedronMeshes(PxTetrahedronMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + + virtual PxSoftBodyMesh* createSoftBodyMesh(PxInputStream&) PX_OVERRIDE; + + virtual PxHeightField* createHeightField(PxInputStream& stream) PX_OVERRIDE; + virtual PxU32 getNbHeightFields() const PX_OVERRIDE; + virtual PxU32 getHeightFields(PxHeightField** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxConvexMesh* createConvexMesh(PxInputStream&) PX_OVERRIDE; + virtual PxU32 getNbConvexMeshes() const PX_OVERRIDE; + virtual PxU32 getConvexMeshes(PxConvexMesh** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxBVH* createBVH(PxInputStream&) PX_OVERRIDE; + virtual PxU32 getNbBVHs() const PX_OVERRIDE; + virtual PxU32 getBVHs(PxBVH** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + + virtual PxParticleBuffer* createParticleBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContexManager) PX_OVERRIDE; + virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContexManager) PX_OVERRIDE; + virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContexManager) PX_OVERRIDE; + virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxParticles, PxU32 maxNumVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContexManager) PX_OVERRIDE; + +#if PX_SUPPORT_GPU_PHYSX + void registerPhysXIndicatorGpuClient(); + void unregisterPhysXIndicatorGpuClient(); +#else + PX_FORCE_INLINE void registerPhysXIndicatorGpuClient() {} + PX_FORCE_INLINE void unregisterPhysXIndicatorGpuClient() {} +#endif + + virtual PxPruningStructure* createPruningStructure(PxRigidActor*const* actors, PxU32 nbActors) PX_OVERRIDE; + + virtual const PxTolerancesScale& getTolerancesScale() const PX_OVERRIDE; + + virtual PxFoundation& getFoundation() PX_OVERRIDE; + + PX_INLINE NpScene* getScene(PxU32 i) const { return mSceneArray[i]; } + PX_INLINE PxU32 getNumScenes() const { return mSceneArray.size(); } +#if PX_CHECKED + static PX_INLINE void heightfieldsAreRegistered() { mHeightFieldsRegistered = true; } +#endif + + virtual void registerDeletionListener(PxDeletionListener& observer, const PxDeletionEventFlags& deletionEvents, bool restrictedObjectSet) PX_OVERRIDE; + virtual void unregisterDeletionListener(PxDeletionListener& observer) PX_OVERRIDE; + virtual void registerDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE; + virtual void unregisterDeletionListenerObjects(PxDeletionListener& observer, const PxBase* const* observables, PxU32 observableCount) PX_OVERRIDE; + + void notifyDeletionListeners(const PxBase*, void* userData, PxDeletionEventFlag::Enum deletionEvent); + PX_FORCE_INLINE void notifyDeletionListenersUserRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eUSER_RELEASE); } + PX_FORCE_INLINE void notifyDeletionListenersMemRelease(const PxBase* b, void* userData) { notifyDeletionListeners(b, userData, PxDeletionEventFlag::eMEMORY_RELEASE); } + + virtual PxInsertionCallback& getPhysicsInsertionCallback() PX_OVERRIDE { return mObjectInsertion; } + + void removeMaterialFromTable(NpMaterial&); + void updateMaterial(NpMaterial&); + bool sendMaterialTable(NpScene&); + + NpMaterialManager& getMaterialManager() { return mMasterMaterialManager; } + NpMaterialManager& getFEMSoftBodyMaterialManager() { return mMasterFEMSoftBodyMaterialManager; } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManager& getFEMClothMaterialManager() { return mMasterFEMClothMaterialManager; } +#endif + NpMaterialManager& getPBDMaterialManager() { return mMasterPBDMaterialManager; } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManager& getFLIPMaterialManager() { return mMasterFLIPMaterialManager; } + NpMaterialManager& getMPMMaterialManager() { return mMasterMPMMaterialManager; } + NpMaterialManager& getCustomMaterialManager() { return mMasterCustomMaterialManager; } +#endif + /*template + NpMaterialManager* getMaterialManagerT(); + template <> + NpMaterialManager* getMaterialManagerT() { return &mMasterMaterialManager; } + template <> + NpMaterialManager* getMaterialManagerT() { return &mMasterFEMSoftBodyMaterialManager; } + template <> + NpMaterialManager* getMaterialManagerT() { return &mMasterFEMClothMaterialManager; }*/ + + NpMaterial* addMaterial(NpMaterial* np); + + void removeFEMSoftBodyMaterialFromTable(NpFEMSoftBodyMaterial&); + void updateFEMSoftBodyMaterial(NpFEMSoftBodyMaterial&); + + NpFEMSoftBodyMaterial* addFEMMaterial(NpFEMSoftBodyMaterial* np); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void removeFEMClothMaterialFromTable(NpFEMClothMaterial&); + void updateFEMClothMaterial(NpFEMClothMaterial&); + NpFEMClothMaterial* addFEMClothMaterial(NpFEMClothMaterial* np); +#endif + void removePBDMaterialFromTable(NpPBDMaterial&); + void updatePBDMaterial(NpPBDMaterial&); + NpPBDMaterial* addPBDMaterial(NpPBDMaterial* np); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void removeFLIPMaterialFromTable(NpFLIPMaterial&); + void updateFLIPMaterial(NpFLIPMaterial&); + NpFLIPMaterial* addFLIPMaterial(NpFLIPMaterial* np); + + void removeMPMMaterialFromTable(NpMPMMaterial&); + void updateMPMMaterial(NpMPMMaterial&); + NpMPMMaterial* addMPMMaterial(NpMPMMaterial* np); + + void removeCustomMaterialFromTable(NpCustomMaterial&); + void updateCustomMaterial(NpCustomMaterial&); + NpCustomMaterial* addCustomMaterial(NpCustomMaterial* np); +#endif + static void initOffsetTables(PxvOffsetTable& pxvOffsetTable); + + static bool apiReentryLock; + +#if PX_SUPPORT_OMNI_PVD + OmniPvdPxSampler* mOmniPvdSampler; + PxOmniPvd* mOmniPvd; +#endif + +private: + typedef PxCoalescedHashMap DeletionListenerMap; + + PxArray mSceneArray; + + Sc::Physics mPhysics; + NpMaterialManager mMasterMaterialManager; + NpMaterialManager mMasterFEMSoftBodyMaterialManager; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManager mMasterFEMClothMaterialManager; +#endif + NpMaterialManager mMasterPBDMaterialManager; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NpMaterialManager mMasterFLIPMaterialManager; + NpMaterialManager mMasterMPMMaterialManager; + NpMaterialManager mMasterCustomMaterialManager; +#endif + NpPhysicsInsertionCallback mObjectInsertion; + + struct MeshDeletionListener: public Gu::MeshFactoryListener + { + void onMeshFactoryBufferRelease(const PxBase* object, PxType type) + { + PX_UNUSED(type); + NpPhysics::getInstance().notifyDeletionListeners(object, NULL, PxDeletionEventFlag::eMEMORY_RELEASE); + } + }; + + PxMutex mDeletionListenerMutex; + DeletionListenerMap mDeletionListenerMap; + MeshDeletionListener mDeletionMeshListener; + bool mDeletionListenersExist; + + PxMutex mSceneAndMaterialMutex; // guarantees thread safety for API calls related to scene and material containers + + PxFoundation& mFoundation; + +#if PX_SUPPORT_GPU_PHYSX + PhysXIndicator mPhysXIndicator; + PxU32 mNbRegisteredGpuClients; + PxMutex mPhysXIndicatorMutex; +#endif +#if PX_SUPPORT_PVD + physx::pvdsdk::PsPvd* mPvd; + Vd::PvdPhysicsClient* mPvdPhysicsClient; +#endif + + static PxU32 mRefCount; + static NpPhysics* mInstance; + +#if PX_CHECKED + static bool mHeightFieldsRegistered; //just for error checking +#endif + + friend class NpCollection; + +#if PX_SUPPORT_OMNI_PVD + class OmniPvdListener : public physx::NpFactoryListener + { + public: + virtual void onMeshFactoryBufferRelease(const PxBase*, PxType) {} + virtual void onObjectAdd(const PxBase*); + virtual void onObjectRemove(const PxBase*); + } + mOmniPvdListener; +#endif +}; + +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getMaterialManager(); + } +}; + +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getFEMSoftBodyMaterialManager(); + } +}; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getFEMClothMaterialManager(); + } +}; +#endif + +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getPBDMaterialManager(); + } +}; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getFLIPMaterialManager(); + } +}; + +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getMPMMaterialManager(); + } +}; + +template <> class NpMaterialAccessor +{ +public: + static NpMaterialManager& getMaterialManager(NpPhysics& physics) + { + return physics.getCustomMaterialManager(); + } +}; +#endif + +#if PX_VC +#pragma warning(pop) +#endif +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysicsInsertionCallback.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysicsInsertionCallback.h new file mode 100644 index 0000000..4069b25 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPhysicsInsertionCallback.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PHYSICS_INSERTION_CALLBACK_H +#define NP_PHYSICS_INSERTION_CALLBACK_H + +#include "common/PxInsertionCallback.h" +#include "GuTriangleMesh.h" +#include "GuHeightField.h" +#include "GuConvexMesh.h" +#include "NpFactory.h" +#include "GuTetrahedronMesh.h" + +namespace physx +{ + class NpPhysicsInsertionCallback : public PxInsertionCallback + { + public: + NpPhysicsInsertionCallback() {} + + virtual PxBase* buildObjectFromData(PxConcreteType::Enum type, void* data) + { + if(type == PxConcreteType::eTRIANGLE_MESH_BVH33 || type == PxConcreteType::eTRIANGLE_MESH_BVH34) + return NpFactory::getInstance().createTriangleMesh(data); + + if (type == PxConcreteType::eCONVEX_MESH) + return NpFactory::getInstance().createConvexMesh(data); + + if (type == PxConcreteType::eHEIGHTFIELD) + return NpFactory::getInstance().createHeightField(data); + + if (type == PxConcreteType::eBVH) + return NpFactory::getInstance().createBVH(data); + + if (type == PxConcreteType::eTETRAHEDRON_MESH) + return NpFactory::getInstance().createTetrahedronMesh(data); + + if (type == PxConcreteType::eSOFTBODY_MESH) + return NpFactory::getInstance().createSoftBodyMesh(data); + + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Inserting object failed: " + "Object type not supported for buildObjectFromData."); + + return NULL; + } + + }; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp new file mode 100644 index 0000000..10970d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.cpp @@ -0,0 +1,401 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpPruningStructure.h" +#include "GuAABBTree.h" +#include "GuAABBTreeNode.h" +#include "NpBounds.h" + +#include "NpRigidDynamic.h" +#include "NpRigidStatic.h" +#include "NpShape.h" + +#include "GuBounds.h" + +#include "CmTransformUtils.h" +#include "CmUtils.h" + +#include "SqPrunerData.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +////////////////////////////////////////////////////////////////////////// + +#define PS_NB_OBJECTS_PER_NODE 4 + +////////////////////////////////////////////////////////////////////////// +PruningStructure::PruningStructure(PxBaseFlags baseFlags) + : PxPruningStructure(baseFlags) +{ +} + +////////////////////////////////////////////////////////////////////////// +PruningStructure::PruningStructure() + : PxPruningStructure(PxConcreteType::ePRUNING_STRUCTURE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mNbActors(0), mActors(0), mValid(true) +{ + for(PxU32 i=0; i<2; i++) + mData[i].init(); +} + +////////////////////////////////////////////////////////////////////////// +PruningStructure::~PruningStructure() +{ + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + { + for(PxU32 i=0; i<2; i++) + { + PX_FREE(mData[i].mAABBTreeIndices); + PX_FREE(mData[i].mAABBTreeNodes); + } + + PX_FREE(mActors); + } +} + +////////////////////////////////////////////////////////////////////////// +void PruningStructure::release() +{ + // if we release the pruning structure we set the pruner structure to NUUL + for (PxU32 i = 0; i < mNbActors; i++) + { + PX_ASSERT(mActors[i]); + + PxType type = mActors[i]->getConcreteType(); + if (type == PxConcreteType::eRIGID_STATIC) + static_cast(mActors[i])->getShapeManager().setPruningStructure(NULL); + else if (type == PxConcreteType::eRIGID_DYNAMIC) + static_cast(mActors[i])->getShapeManager().setPruningStructure(NULL); + } + + if(getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_DELETE_THIS; + else + this->~PruningStructure(); +} + +template +static void getShapeBounds(PxRigidActor* actor, bool dynamic, PxBounds3* bounds, PxU32& numShapes) +{ + PruningIndex::Enum treeStructure = dynamic ? PruningIndex::eDYNAMIC : PruningIndex::eSTATIC; + ActorType& a = *static_cast(actor); + const PxU32 nbShapes = a.getNbShapes(); + for (PxU32 iShape = 0; iShape < nbShapes; iShape++) + { + NpShape* shape = a.getShapeManager().getShapes()[iShape]; + if (shape->getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE) + { + (gComputeBoundsTable[treeStructure])(*bounds, *shape, a); + bounds++; + numShapes++; + } + } +} + +////////////////////////////////////////////////////////////////////////// +bool PruningStructure::build(PxRigidActor*const* actors, PxU32 nbActors) +{ + PX_ASSERT(actors); + PX_ASSERT(nbActors > 0); + + PxU32 numShapes[2] = { 0, 0 }; + // parse the actors first to get the shapes size + for (PxU32 actorsDone = 0; actorsDone < nbActors; actorsDone++) + { + if (actorsDone + 1 < nbActors) + PxPrefetch(actors[actorsDone + 1], sizeof(NpRigidDynamic)); // worst case: PxRigidStatic is smaller + + PxType type = actors[actorsDone]->getConcreteType(); + const PxRigidActor& actor = *(actors[actorsDone]); + + NpScene* scene = NpActor::getFromPxActor(actor).getNpScene(); + if(scene) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PrunerStructure::build: Actor already assigned to a scene!"); + return false; + } + + const PxU32 nbShapes = actor.getNbShapes(); + bool hasQueryShape = false; + for (PxU32 iShape = 0; iShape < nbShapes; iShape++) + { + PxShape* shape; + actor.getShapes(&shape, 1, iShape); + if(shape->getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE) + { + hasQueryShape = true; + if (type == PxConcreteType::eRIGID_STATIC) + numShapes[PruningIndex::eSTATIC]++; + else + numShapes[PruningIndex::eDYNAMIC]++; + } + } + + // each provided actor must have a query shape + if(!hasQueryShape) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PrunerStructure::build: Provided actor has no scene query shape!"); + return false; + } + + if (type == PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* rs = static_cast(actors[actorsDone]); + if(rs->getShapeManager().getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PrunerStructure::build: Provided actor has already a pruning structure!"); + return false; + } + rs->getShapeManager().setPruningStructure(this); + } + else if (type == PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic* rd = static_cast(actors[actorsDone]); + if (rd->getShapeManager().getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PrunerStructure::build: Provided actor has already a pruning structure!"); + return false; + } + rd->getShapeManager().setPruningStructure(this); + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PrunerStructure::build: Provided actor is not a rigid actor!"); + return false; + } + } + + AABBTreeBounds bounds[2]; + + for (PxU32 i = 0; i < 2; i++) + { + if(numShapes[i]) + { + bounds[i].init(numShapes[i]); + } + } + + // now I go again and gather bounds and payload + numShapes[PruningIndex::eSTATIC] = 0; + numShapes[PruningIndex::eDYNAMIC] = 0; + for (PxU32 actorsDone = 0; actorsDone < nbActors; actorsDone++) + { + PxType type = actors[actorsDone]->getConcreteType(); + if (type == PxConcreteType::eRIGID_STATIC) + { + getShapeBounds(actors[actorsDone], false, &bounds[PruningIndex::eSTATIC].getBounds()[numShapes[PruningIndex::eSTATIC]], numShapes[PruningIndex::eSTATIC]); + } + else if (type == PxConcreteType::eRIGID_DYNAMIC) + { + getShapeBounds(actors[actorsDone], true, &bounds[PruningIndex::eDYNAMIC].getBounds()[numShapes[PruningIndex::eDYNAMIC]], numShapes[PruningIndex::eDYNAMIC]); + } + } + + AABBTree aabbTrees[2]; + for (PxU32 i = 0; i < 2; i++) + { + mData[i].mNbObjects = numShapes[i]; + if (numShapes[i]) + { + // create the AABB tree + NodeAllocator nodeAllocator; + bool status = aabbTrees[i].build(AABBTreeBuildParams(PS_NB_OBJECTS_PER_NODE, numShapes[i], &bounds[i]), nodeAllocator); + + PX_UNUSED(status); + PX_ASSERT(status); + + // store the tree nodes + mData[i].mNbNodes = aabbTrees[i].getNbNodes(); + mData[i].mAABBTreeNodes = PX_ALLOCATE(BVHNode, mData[i].mNbNodes, "BVHNode"); + PxMemCopy(mData[i].mAABBTreeNodes, aabbTrees[i].getNodes(), sizeof(BVHNode)*mData[i].mNbNodes); + mData[i].mAABBTreeIndices = PX_ALLOCATE(PxU32, mData[i].mNbObjects, "PxU32"); + PxMemCopy(mData[i].mAABBTreeIndices, aabbTrees[i].getIndices(), sizeof(PxU32)*mData[i].mNbObjects); + + // discard the data + bounds[i].release(); + } + } + + // store the actors for verification and serialization + mNbActors = nbActors; + mActors = PX_ALLOCATE(PxActor*, mNbActors, "PxActor*"); + PxMemCopy(mActors, actors, sizeof(PxActor*)*mNbActors); + + return true; +} + +////////////////////////////////////////////////////////////////////////// + +PruningStructure* PruningStructure::createObject(PxU8*& address, PxDeserializationContext& context) +{ + PruningStructure* obj = PX_PLACEMENT_NEW(address, PruningStructure(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(PruningStructure); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +////////////////////////////////////////////////////////////////////////// + +void PruningStructure::resolveReferences(PxDeserializationContext& context) +{ + if (!isValid()) + return; + + for (PxU32 i = 0; i < mNbActors; i++) + context.translatePxBase(mActors[i]); +} + +////////////////////////////////////////////////////////////////////////// + +void PruningStructure::requiresObjects(PxProcessPxBaseCallback& c) +{ + if (!isValid()) + return; + + for (PxU32 i = 0; i < mNbActors; i++) + c.process(*mActors[i]); +} + +////////////////////////////////////////////////////////////////////////// + +void PruningStructure::exportExtraData(PxSerializationContext& stream) +{ + if (!isValid()) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PrunerStructure::exportExtraData: Pruning structure is invalid!"); + return; + } + + for (PxU32 i = 0; i < 2; i++) + { + if (mData[i].mAABBTreeNodes) + { + // store nodes + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mData[i].mAABBTreeNodes, mData[i].mNbNodes * sizeof(BVHNode)); + } + + if(mData[i].mAABBTreeIndices) + { + // store indices + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mData[i].mAABBTreeIndices, mData[i].mNbObjects * sizeof(PxU32)); + } + } + + if(mActors) + { + // store actor pointers + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mActors, mNbActors * sizeof(PxActor*)); + } +} + +////////////////////////////////////////////////////////////////////////// + +void PruningStructure::importExtraData(PxDeserializationContext& context) +{ + if (!isValid()) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PrunerStructure::importExtraData: Pruning structure is invalid!"); + return; + } + + for (PxU32 i = 0; i < 2; i++) + { + if (mData[i].mAABBTreeNodes) + mData[i].mAABBTreeNodes = context.readExtraData(mData[i].mNbNodes); + if(mData[i].mAABBTreeIndices) + mData[i].mAABBTreeIndices = context.readExtraData(mData[i].mNbObjects); + } + + if (mActors) + { + // read actor pointers + mActors = context.readExtraData(mNbActors); + } +} + +////////////////////////////////////////////////////////////////////////// + +PxU32 PruningStructure::getNbRigidActors() const +{ + return mNbActors; +} + +const void* PruningStructure::getStaticMergeData() const +{ + return &mData[PruningIndex::eSTATIC]; +} + +const void* PruningStructure::getDynamicMergeData() const +{ + return &mData[PruningIndex::eDYNAMIC]; +} + +PxU32 PruningStructure::getRigidActors(PxRigidActor** userBuffer, PxU32 bufferSize, PxU32 startIndex/* =0 */) const +{ + if(!isValid()) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PrunerStructure::getRigidActors: Pruning structure is invalid!"); + return 0; + } + + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mActors, mNbActors); +} + +////////////////////////////////////////////////////////////////////////// + +void PruningStructure::invalidate(PxActor* actor) +{ + PX_ASSERT(actor); + + // remove actor from the actor list to avoid mem corruption + // this slow, but should be called only with error msg send to user about invalid behavior + for (PxU32 i = 0; i < mNbActors; i++) + { + if(mActors[i] == actor) + { + // set pruning structure to NULL and remove the actor from the list + PxType type = mActors[i]->getConcreteType(); + if (type == PxConcreteType::eRIGID_STATIC) + static_cast(mActors[i])->getShapeManager().setPruningStructure(NULL); + else if (type == PxConcreteType::eRIGID_DYNAMIC) + static_cast(mActors[i])->getShapeManager().setPruningStructure(NULL); + + mActors[i] = mActors[mNbActors--]; + break; + } + } + + mValid = false; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.h new file mode 100644 index 0000000..b842c04 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPruningStructure.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PRUNING_STRUCTURE_H +#define NP_PRUNING_STRUCTURE_H +/** \addtogroup physics +@{ */ + +#include "PxPruningStructure.h" + +#include "foundation/PxUserAllocated.h" +#include "GuPrunerMergeData.h" + +namespace physx +{ + namespace Sq + { + class PruningStructure : public PxPruningStructure, public PxUserAllocated + { + PX_NOCOPY(PruningStructure) + public: + // PX_SERIALIZATION + PruningStructure(PxBaseFlags baseFlags); + virtual void resolveReferences(PxDeserializationContext& ); + static PruningStructure* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + void preExportDataReset() {} + void exportExtraData(PxSerializationContext&); + void importExtraData(PxDeserializationContext&); + virtual void requiresObjects(PxProcessPxBaseCallback&); + //~PX_SERIALIZATION + + // PxPruningStructure + virtual void release(); + virtual PxU32 getRigidActors(PxRigidActor** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + virtual PxU32 getNbRigidActors() const; + virtual const void* getStaticMergeData() const; + virtual const void* getDynamicMergeData() const; + // ~PxPruningStructure + PruningStructure(); + virtual ~PruningStructure(); + + bool build(PxRigidActor*const* actors, PxU32 nbActors); + + PX_FORCE_INLINE PxU32 getNbActors() const { return mNbActors; } + PX_FORCE_INLINE PxActor*const* getActors() const { return mActors; } + + PX_FORCE_INLINE bool isValid() const { return mValid; } + void invalidate(PxActor* actor); + private: + Gu::AABBPrunerMergeData mData[2]; + PxU32 mNbActors; // Nb actors from which the pruner structure was build + PxActor** mActors; // actors used for pruner structure build, used later for serialization + bool mValid; // pruning structure validity + }; + } + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPtrTableStorageManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPtrTableStorageManager.h new file mode 100644 index 0000000..41f532e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPtrTableStorageManager.h @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PTR_TABLE_STORAGE_MANAGER_H +#define NP_PTR_TABLE_STORAGE_MANAGER_H + +#include "foundation/PxMutex.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBitUtils.h" +#include "CmPtrTable.h" + +namespace physx +{ +class NpPtrTableStorageManager : public Cm::PtrTableStorageManager, public PxUserAllocated +{ + PX_NOCOPY(NpPtrTableStorageManager) + +public: + + NpPtrTableStorageManager() {} + ~NpPtrTableStorageManager() {} + + // PtrTableStorageManager + virtual void** allocate(PxU32 capacity) + { + PX_ASSERT(PxIsPowerOfTwo(capacity)); + + PxMutex::ScopedLock lock(mMutex); + + return capacity<=4 ? reinterpret_cast(mPool4.construct()) + : capacity<=16 ? reinterpret_cast(mPool16.construct()) + : capacity<=64 ? reinterpret_cast(mPool64.construct()) + : reinterpret_cast(PX_ALLOC(capacity*sizeof(void*), "CmPtrTable pointer array")); + } + + virtual void deallocate(void** addr, PxU32 capacity) + { + PX_ASSERT(PxIsPowerOfTwo(capacity)); + + PxMutex::ScopedLock lock(mMutex); + + if(capacity<=4) mPool4.destroy(reinterpret_cast< PtrBlock<4>*>(addr)); + else if(capacity<=16) mPool16.destroy(reinterpret_cast< PtrBlock<16>*>(addr)); + else if(capacity<=64) mPool64.destroy(reinterpret_cast< PtrBlock<64>*>(addr)); + else PX_FREE(addr); + } + + // originalCapacity is the only way we know which pool the alloc request belongs to, + // so if those are no longer going to match, we need to realloc. + + virtual bool canReuse(PxU32 originalCapacity, PxU32 newCapacity) + { + PX_ASSERT(PxIsPowerOfTwo(originalCapacity)); + PX_ASSERT(PxIsPowerOfTwo(newCapacity)); + + return poolId(originalCapacity) == poolId(newCapacity) && newCapacity<=64; + } + //~PtrTableStorageManager + +private: + PxMutex mMutex; + + int poolId(PxU32 size) + { + return size<=4 ? 0 + : size<=16 ? 1 + : size<=64 ? 2 + : 3; + } + + template class PtrBlock { void* ptr[N]; }; + + PxPool2, 4096 > mPool4; + PxPool2, 4096 > mPool16; + PxPool2, 4096 > mPool64; +}; + +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp new file mode 100644 index 0000000..26e423b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.cpp @@ -0,0 +1,1365 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#if PX_SUPPORT_PVD +#include "common/PxProfileZone.h" +#include "common/PxRenderBuffer.h" +#include "PxParticleSystem.h" +#include "PxPBDParticleSystem.h" +//#include "PxFLIPParticleSystem.h" +//#include "PxMPMParticleSystem.h" +//#include "PxCustomParticleSystem.h" +#include "PxPhysics.h" +#include "PxConstraintDesc.h" +#include "NpPvdSceneClient.h" +#include "ScBodySim.h" +#include "ScConstraintSim.h" +#include "ScConstraintCore.h" +#include "PxsMaterialManager.h" +#include "PvdTypeNames.h" +#include "PxPvdUserRenderer.h" +#include "PxvNphaseImplementationContext.h" +#include "NpConstraint.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "NpSoftBody.h" +//#include "NpFEMCloth.h" +#include "NpHairSystem.h" +#include "NpAggregate.h" +#include "NpScene.h" +#include "NpArticulationJointReducedCoordinate.h" +#include "NpArticulationReducedCoordinate.h" + +using namespace physx; +using namespace physx::Vd; +using namespace physx::pvdsdk; + +namespace +{ + PX_FORCE_INLINE PxU64 getContextId(NpScene& scene) { return scene.getScScene().getContextId(); } + + /////////////////////////////////////////////////////////////////////////////// + + // Sc-to-Np + PX_FORCE_INLINE static NpConstraint* getNpConstraint(Sc::ConstraintCore* scConstraint) + { + return reinterpret_cast(reinterpret_cast(scConstraint) - NpConstraint::getCoreOffset()); + } + + /////////////////////////////////////////////////////////////////////////////// + + PX_FORCE_INLINE static const PxActor* getPxActor(const NpActor* scActor) + { + return scActor->getPxActor(); + } + + struct CreateOp + { + CreateOp& operator=(const CreateOp&); + physx::pvdsdk::PvdDataStream& mStream; + PvdMetaDataBinding& mBinding; + PsPvd* mPvd; + PxScene& mScene; + CreateOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind, PsPvd* pvd, PxScene& scene) + : mStream(str), mBinding(bind), mPvd(pvd), mScene(scene) + { + } + template + void operator()(const TDataType& dtype) + { + mBinding.createInstance(mStream, dtype, mScene, PxGetPhysics(), mPvd); + } + void operator()(const PxArticulationLink&) + { + } + }; + + struct UpdateOp + { + UpdateOp& operator=(const UpdateOp&); + physx::pvdsdk::PvdDataStream& mStream; + PvdMetaDataBinding& mBinding; + UpdateOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind) : mStream(str), mBinding(bind) + { + } + template + void operator()(const TDataType& dtype) + { + mBinding.sendAllProperties(mStream, dtype); + } + }; + + struct DestroyOp + { + DestroyOp& operator=(const DestroyOp&); + physx::pvdsdk::PvdDataStream& mStream; + PvdMetaDataBinding& mBinding; + PxScene& mScene; + DestroyOp(physx::pvdsdk::PvdDataStream& str, PvdMetaDataBinding& bind, PxScene& scene) + : mStream(str), mBinding(bind), mScene(scene) + { + } + template + void operator()(const TDataType& dtype) + { + mBinding.destroyInstance(mStream, dtype, mScene); + } + void operator()(const PxArticulationLink& dtype) + { + mBinding.destroyInstance(mStream, dtype); + } + }; + + template + inline void BodyTypeOperation(const NpActor* scBody, TOperator op) + { +// const bool isArticulationLink = scBody->getActorType_() == PxActorType::eARTICULATION_LINK; + const bool isArticulationLink = scBody->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK; + if(isArticulationLink) + { + const NpArticulationLink* link = static_cast(scBody); + op(*static_cast(link)); + } + else + { + const NpRigidDynamic* npRigidDynamic = static_cast(scBody); + op(*static_cast(npRigidDynamic)); + } + } + + template + inline void ActorTypeOperation(const PxActor* actor, TOperator op) + { + switch(actor->getType()) + { + case PxActorType::eRIGID_STATIC: + op(*static_cast(actor)); + break; + case PxActorType::eRIGID_DYNAMIC: + op(*static_cast(actor)); + break; + case PxActorType::eARTICULATION_LINK: + op(*static_cast(actor)); + break; + case PxActorType::eSOFTBODY: + op(*static_cast(actor)); + break; + case PxActorType::eFEMCLOTH: + //op(*static_cast(actor)); + break; + case PxActorType::ePBD_PARTICLESYSTEM: + #if PX_SUPPORT_GPU_PHYSX + op(*static_cast(actor)); + #endif + break; + case PxActorType::eFLIP_PARTICLESYSTEM: + //op(*static_cast(actor)); + break; + case PxActorType::eMPM_PARTICLESYSTEM: + //op(*static_cast(actor)); + break; + case PxActorType::eCUSTOM_PARTICLESYSTEM: + //op(*static_cast(actor)); + break; + case PxActorType::eHAIRSYSTEM: + //op(*static_cast(actor)); + break; + case PxActorType::eACTOR_COUNT: + case PxActorType::eACTOR_FORCE_DWORD: + PX_ASSERT(false); + break; + }; + } + + namespace + { + struct PvdConstraintVisualizer : public PxConstraintVisualizer + { + PX_NOCOPY(PvdConstraintVisualizer) + public: + physx::pvdsdk::PvdUserRenderer& mRenderer; + PvdConstraintVisualizer(const void* id, physx::pvdsdk::PvdUserRenderer& r) : mRenderer(r) + { + mRenderer.setInstanceId(id); + } + virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) + { + mRenderer.visualizeJointFrames(parent, child); + } + + virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, PxReal value, bool active) + { + mRenderer.visualizeLinearLimit(t0, t1, PxF32(value), active); + } + + virtual void visualizeAngularLimit(const PxTransform& t0, PxReal lower, PxReal upper, bool active) + { + mRenderer.visualizeAngularLimit(t0, PxF32(lower), PxF32(upper), active); + } + + virtual void visualizeLimitCone(const PxTransform& t, PxReal tanQSwingY, PxReal tanQSwingZ, bool active) + { + mRenderer.visualizeLimitCone(t, PxF32(tanQSwingY), PxF32(tanQSwingZ), active); + } + + virtual void visualizeDoubleCone(const PxTransform& t, PxReal angle, bool active) + { + mRenderer.visualizeDoubleCone(t, PxF32(angle), active); + } + + virtual void visualizeLine( const PxVec3& p0, const PxVec3& p1, PxU32 color) + { + const PxDebugLine line(p0, p1, color); + mRenderer.drawLines(&line, 1); + } + }; + } + + class SceneRendererClient : public RendererEventClient, public physx::PxUserAllocated + { + PX_NOCOPY(SceneRendererClient) + public: + SceneRendererClient(PvdUserRenderer* renderer, PxPvd* pvd):mRenderer(renderer) + { + mStream = PvdDataStream::create(pvd); + mStream->createInstance(renderer); + } + + ~SceneRendererClient() + { + mStream->destroyInstance(mRenderer); + mStream->release(); + } + + virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) + { + mStream->setPropertyValue(mRenderer, "events", inData, inLength); + } + + private: + + PvdUserRenderer* mRenderer; + PvdDataStream* mStream; + }; + +} // namespace + +PvdSceneClient::PvdSceneClient(NpScene& scene) : + mPvd (NULL), + mScene (scene), + mPvdDataStream (NULL), + mUserRender (NULL), + mRenderClient (NULL), + mIsConnected (false) +{ +} + +PvdSceneClient::~PvdSceneClient() +{ + if(mPvd) + mPvd->removeClient(this); +} + +void PvdSceneClient::updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) +{ + if(mIsConnected) + mPvdDataStream->updateCamera(name, origin, up, target); +} + +void PvdSceneClient::drawPoints(const PxDebugPoint* points, PxU32 count) +{ + if(mUserRender) + mUserRender->drawPoints(points, count); +} + +void PvdSceneClient::drawLines(const PxDebugLine* lines, PxU32 count) +{ + if(mUserRender) + mUserRender->drawLines(lines, count); +} + +void PvdSceneClient::drawTriangles(const PxDebugTriangle* triangles, PxU32 count) +{ + if(mUserRender) + mUserRender->drawTriangles(triangles, count); +} + +void PvdSceneClient::drawText(const PxDebugText& text) +{ + if(mUserRender) + mUserRender->drawText(text); +} + +void PvdSceneClient::setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value) +{ + if(value) + mFlags |= flag; + else + mFlags &= ~flag; +} + +void PvdSceneClient::onPvdConnected() +{ + if(mIsConnected || !mPvd) + return; + + mIsConnected = true; + + mPvdDataStream = PvdDataStream::create(mPvd); + + mUserRender = PvdUserRenderer::create(); + mRenderClient = PX_NEW(SceneRendererClient)(mUserRender, mPvd); + mUserRender->setClient(mRenderClient); + + sendEntireScene(); +} + +void PvdSceneClient::onPvdDisconnected() +{ + if(!mIsConnected) + return; + mIsConnected = false; + + PX_DELETE(mRenderClient); + mUserRender->release(); + mUserRender = NULL; + mPvdDataStream->release(); + mPvdDataStream = NULL; +} + +void PvdSceneClient::updatePvdProperties() +{ + mMetaDataBinding.sendAllProperties(*mPvdDataStream, mScene); +} + +void PvdSceneClient::releasePvdInstance() +{ + if(mPvdDataStream) + { + PxScene* theScene = &mScene; + // remove from parent + mPvdDataStream->removeObjectRef(&PxGetPhysics(), "Scenes", theScene); + mPvdDataStream->destroyInstance(theScene); + } +} + +// PT: this is only called once, from "onPvdConnected" +void PvdSceneClient::sendEntireScene() +{ + NpScene* npScene = &mScene; + + if(npScene->getFlagsFast() & PxSceneFlag::eREQUIRE_RW_LOCK) // getFlagsFast() will trigger a warning of lock check + npScene->lockRead(__FILE__, __LINE__); + + PxPhysics& physics = PxGetPhysics(); + { + PxScene* theScene = &mScene; + mPvdDataStream->createInstance(theScene); + updatePvdProperties(); + + // Create parent/child relationship. + mPvdDataStream->setPropertyValue(theScene, "Physics", reinterpret_cast(&physics)); + mPvdDataStream->pushBackObjectRef(&physics, "Scenes", theScene); + } + + // materials: + { + PxsMaterialManager& manager = mScene.getScScene().getMaterialManager(); + PxsMaterialManagerIterator iter(manager); + PxsMaterialCore* mat; + while(iter.getNextMaterial(mat)) + { + const PxMaterial* theMaterial = mat->mMaterial; + if(mPvd->registerObject(theMaterial)) + mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, physics); + }; + } + + if(mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG) + { + PxArray actorArray; + + // RBs + // static: + { + PxU32 numActors = npScene->getNbActors(PxActorTypeFlag::eRIGID_STATIC | PxActorTypeFlag::eRIGID_DYNAMIC); + actorArray.resize(numActors); + npScene->getActors(PxActorTypeFlag::eRIGID_STATIC | PxActorTypeFlag::eRIGID_DYNAMIC, actorArray.begin(), actorArray.size()); + for(PxU32 i = 0; i < numActors; i++) + { + PxActor* pxActor = actorArray[i]; + if(pxActor->getConcreteType()==PxConcreteType::eRIGID_STATIC) + mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast(pxActor), *npScene, physics, mPvd); + else + mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast(pxActor), *npScene, physics, mPvd); + } + } + // articulations & links + { + PxArray articulations; + PxU32 numArticulations = npScene->getNbArticulations(); + articulations.resize(numArticulations); + npScene->getArticulations(articulations.begin(), articulations.size()); + for(PxU32 i = 0; i < numArticulations; i++) + mMetaDataBinding.createInstance(*mPvdDataStream, *articulations[i], *npScene, physics, mPvd); + } + + // joints + { + Sc::ConstraintCore*const * constraints = mScene.getScScene().getConstraints(); + PxU32 nbConstraints = mScene.getScScene().getNbConstraints(); + for(PxU32 i = 0; i < nbConstraints; i++) + { + updateConstraint(*constraints[i], PxPvdUpdateType::CREATE_INSTANCE); + updateConstraint(*constraints[i], PxPvdUpdateType::UPDATE_ALL_PROPERTIES); + } + } + } + + if(npScene->getFlagsFast() & PxSceneFlag::eREQUIRE_RW_LOCK) + npScene->unlockRead(); +} + +void PvdSceneClient::updateConstraint(const Sc::ConstraintCore& scConstraint, PxU32 updateType) +{ + PxConstraintConnector* conn = scConstraint.getPxConnector(); + if(conn && checkPvdDebugFlag()) + conn->updatePvdProperties(*mPvdDataStream, scConstraint.getPxConstraint(), PxPvdUpdateType::Enum(updateType)); +} + +void PvdSceneClient::createPvdInstance(const PxActor* actor) +{ + if(checkPvdDebugFlag()) + ActorTypeOperation(actor, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene)); +} + +void PvdSceneClient::updatePvdProperties(const PxActor* actor) +{ + if(checkPvdDebugFlag()) + ActorTypeOperation(actor, UpdateOp(*mPvdDataStream, mMetaDataBinding)); +} + +void PvdSceneClient::releasePvdInstance(const PxActor* actor) +{ + if(checkPvdDebugFlag()) + ActorTypeOperation(actor, DestroyOp(*mPvdDataStream, mMetaDataBinding, mScene)); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpActor* actor) +{ + // PT: why not UPDATE_PVD_PROPERTIES_CHECK() here? + createPvdInstance(getPxActor(actor)); +} + +void PvdSceneClient::updatePvdProperties(const NpActor* actor) +{ + // PT: why not UPDATE_PVD_PROPERTIES_CHECK() here? + updatePvdProperties(getPxActor(actor)); +} + +void PvdSceneClient::releasePvdInstance(const NpActor* actor) +{ + // PT: why not UPDATE_PVD_PROPERTIES_CHECK() here? + releasePvdInstance(getPxActor(actor)); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpRigidDynamic* body) +{ + if(checkPvdDebugFlag() && body->getNpType() != NpType::eBODY_FROM_ARTICULATION_LINK) + BodyTypeOperation(body, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene)); +} + +void PvdSceneClient::createPvdInstance(const NpArticulationLink* body) +{ + if(checkPvdDebugFlag() && body->getNpType() != NpType::eBODY_FROM_ARTICULATION_LINK) + BodyTypeOperation(body, CreateOp(*mPvdDataStream, mMetaDataBinding, mPvd, mScene)); +} + +void PvdSceneClient::releasePvdInstance(const NpRigidDynamic* body) +{ + releasePvdInstance(getPxActor(body)); +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationLink* body) +{ + releasePvdInstance(getPxActor(body)); +} + +void PvdSceneClient::updateBodyPvdProperties(const NpActor* body) +{ + if(checkPvdDebugFlag()) + { + if(body->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK) + updatePvdProperties(static_cast(body)); + else if(body->getNpType() == NpType::eBODY) + updatePvdProperties(static_cast(body)); + else PX_ASSERT(0); + } +} + +void PvdSceneClient::updatePvdProperties(const NpRigidDynamic* body) +{ + if(checkPvdDebugFlag()) + BodyTypeOperation(body, UpdateOp(*mPvdDataStream, mMetaDataBinding)); +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationLink* body) +{ + if(checkPvdDebugFlag()) + BodyTypeOperation(body, UpdateOp(*mPvdDataStream, mMetaDataBinding)); +} + +void PvdSceneClient::updateKinematicTarget(const NpActor* body, const PxTransform& p) +{ + if(checkPvdDebugFlag()) + { + if(body->getNpType() == NpType::eBODY_FROM_ARTICULATION_LINK) + mPvdDataStream->setPropertyValue(static_cast(body), "KinematicTarget", p); + else if(body->getNpType() == NpType::eBODY) + mPvdDataStream->setPropertyValue(static_cast(body), "KinematicTarget", p); + else PX_ASSERT(0); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::releasePvdInstance(const NpRigidStatic* rigidStatic) +{ + releasePvdInstance(static_cast(rigidStatic)); +} + +void PvdSceneClient::createPvdInstance(const NpRigidStatic* rigidStatic) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.createInstance(*mPvdDataStream, *rigidStatic, mScene, PxGetPhysics(), mPvd); +} + +void PvdSceneClient::updatePvdProperties(const NpRigidStatic* rigidStatic) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *rigidStatic); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpConstraint* constraint) +{ + if(checkPvdDebugFlag()) + updateConstraint(constraint->getCore(), PxPvdUpdateType::CREATE_INSTANCE); +} + +void PvdSceneClient::updatePvdProperties(const NpConstraint* constraint) +{ + if(checkPvdDebugFlag()) + updateConstraint(constraint->getCore(), PxPvdUpdateType::UPDATE_ALL_PROPERTIES); +} + +void PvdSceneClient::releasePvdInstance(const NpConstraint* constraint) +{ + const Sc::ConstraintCore& scConstraint = constraint->getCore(); + PxConstraintConnector* conn; + if(checkPvdDebugFlag() && (conn = scConstraint.getPxConnector()) != NULL) + conn->updatePvdProperties(*mPvdDataStream, scConstraint.getPxConstraint(), PxPvdUpdateType::RELEASE_INSTANCE); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpArticulationReducedCoordinate* articulation) +{ + if (checkPvdDebugFlag()) + { + mMetaDataBinding.createInstance(*mPvdDataStream, *articulation, mScene, PxGetPhysics(), mPvd); + } +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationReducedCoordinate* articulation) +{ + if(checkPvdDebugFlag()) + { + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *articulation); + } +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationReducedCoordinate* articulation) +{ + if (checkPvdDebugFlag()) + { + mMetaDataBinding.destroyInstance(*mPvdDataStream, *articulation, mScene); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpArticulationJointReducedCoordinate* articulationJoint) +{ + PX_UNUSED(articulationJoint); +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationJointReducedCoordinate* articulationJoint) +{ + if (checkPvdDebugFlag()) + { + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *articulationJoint); + } +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationJointReducedCoordinate* articulationJoint) +{ + PX_UNUSED(articulationJoint); +} +///////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpArticulationSpatialTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationSpatialTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationSpatialTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +///////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpArticulationFixedTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationFixedTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationFixedTendon* articulationTendon) +{ + PX_UNUSED(articulationTendon); +} + +///////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpArticulationSensor* sensor) +{ + PX_UNUSED(sensor); +} + +void PvdSceneClient::updatePvdProperties(const NpArticulationSensor* sensor) +{ + PX_UNUSED(sensor); +} + +void PvdSceneClient::releasePvdInstance(const NpArticulationSensor* sensor) +{ + PX_UNUSED(sensor); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const PxsMaterialCore* materialCore) +{ + if(checkPvdDebugFlag()) + { + const PxMaterial* theMaterial = materialCore->mMaterial; + if(mPvd->registerObject(theMaterial)) + mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics()); + } +} + +void PvdSceneClient::updatePvdProperties(const PxsMaterialCore* materialCore) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *materialCore->mMaterial); +} + +void PvdSceneClient::releasePvdInstance(const PxsMaterialCore* materialCore) +{ + if(checkPvdDebugFlag() && mPvd->unRegisterObject(materialCore->mMaterial)) + mMetaDataBinding.destroyInstance(*mPvdDataStream, *materialCore->mMaterial, PxGetPhysics()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const PxsFEMSoftBodyMaterialCore* materialCore) +{ + if (checkPvdDebugFlag()) + { + const PxFEMSoftBodyMaterial* theMaterial = materialCore->mMaterial; + if (mPvd->registerObject(theMaterial)) + mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics()); + } +} + +void PvdSceneClient::updatePvdProperties(const PxsFEMSoftBodyMaterialCore* materialCore) +{ + if (checkPvdDebugFlag()) + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *materialCore->mMaterial); +} + +void PvdSceneClient::releasePvdInstance(const PxsFEMSoftBodyMaterialCore* materialCore) +{ + if (checkPvdDebugFlag() && mPvd->unRegisterObject(materialCore->mMaterial)) + mMetaDataBinding.destroyInstance(*mPvdDataStream, *materialCore->mMaterial, PxGetPhysics()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const PxsFEMClothMaterialCore* /*materialCore*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + + // if (checkPvdDebugFlag()) + // { + // const PxFEMClothMaterial* theMaterial = materialCore->mMaterial; + // if (mPvd->registerObject(theMaterial)) + // mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics()); + // } +} + +void PvdSceneClient::updatePvdProperties(const PxsFEMClothMaterialCore* /*materialCore*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + // if (checkPvdDebugFlag()) + // mMetaDataBinding.sendAllProperties(*mPvdDataStream, *materialCore->mMaterial); +} + +void PvdSceneClient::releasePvdInstance(const PxsFEMClothMaterialCore* /*materialCore*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + // if (checkPvdDebugFlag() && mPvd->unRegisterObject(materialCore->mMaterial)) + // mMetaDataBinding.destroyInstance(*mPvdDataStream, *materialCore->mMaterial, PxGetPhysics()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const PxsPBDMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::updatePvdProperties(const PxsPBDMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::releasePvdInstance(const PxsPBDMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::createPvdInstance(const PxsFLIPMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::updatePvdProperties(const PxsFLIPMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::releasePvdInstance(const PxsFLIPMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::createPvdInstance(const PxsMPMMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::updatePvdProperties(const PxsMPMMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::releasePvdInstance(const PxsMPMMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::createPvdInstance(const PxsCustomMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::updatePvdProperties(const PxsCustomMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +void PvdSceneClient::releasePvdInstance(const PxsCustomMaterialCore* /*materialCore*/) +{ +// PX_ASSERT(0); +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpShape* npShape, PxActor& owner) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene)); + mMetaDataBinding.createInstance(*mPvdDataStream, *npShape, static_cast(owner), PxGetPhysics(), mPvd); + } +} + +static void addShapesToPvd(PxU32 nbShapes, NpShape* const* shapes, PxActor& pxActor, PsPvd* pvd, PvdDataStream& stream, PvdMetaDataBinding& binding) +{ + PxPhysics& physics = PxGetPhysics(); + for(PxU32 i=0;i(pxActor), physics, pvd); + } +} + +void PvdSceneClient::addBodyAndShapesToPvd(NpRigidDynamic& b) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene)); + createPvdInstance(&b); + + PxActor& pxActor = *b.getCore().getPxActor(); + NpShape* const* shapes; + const PxU32 nbShapes = NpRigidDynamicGetShapes(b, shapes); + addShapesToPvd(nbShapes, shapes, pxActor, mPvd, *mPvdDataStream, mMetaDataBinding); + } +} + +void PvdSceneClient::addStaticAndShapesToPvd(NpRigidStatic& s) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene)); + createPvdInstance(&s); + + PxActor& pxActor = static_cast(s); + NpShape* const* shapes; + const PxU32 nbShapes = NpRigidStaticGetShapes(s, shapes); + addShapesToPvd(nbShapes, shapes, pxActor, mPvd, *mPvdDataStream, mMetaDataBinding); + } +} + +void PvdSceneClient::updateMaterials(const NpShape* npShape) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.updateMaterials(*mPvdDataStream, *npShape, mPvd); +} + +void PvdSceneClient::updatePvdProperties(const NpShape* npShape) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *npShape); +} + +void PvdSceneClient::releaseAndRecreateGeometry(const NpShape* npShape) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.releaseAndRecreateGeometry(*mPvdDataStream, *npShape, NpPhysics::getInstance(), mPvd); +} + +void PvdSceneClient::releasePvdInstance(const NpShape* npShape, PxActor& owner) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.releasePVDInstance", getContextId(mScene)); + + mMetaDataBinding.destroyInstance(*mPvdDataStream, *npShape, static_cast(owner)); + + const PxU32 numMaterials = npShape->getNbMaterials(); + PX_ALLOCA(materialPtr, PxMaterial*, numMaterials); + npShape->getMaterials(materialPtr, numMaterials); + + for(PxU32 idx = 0; idx < numMaterials; ++idx) + releasePvdInstance(&(static_cast(materialPtr[idx])->mMaterial)); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::originShift(PxVec3 shift) +{ + mMetaDataBinding.originShift(*mPvdDataStream, &mScene, shift); +} + +void PvdSceneClient::frameStart(PxReal simulateElapsedTime) +{ + PX_PROFILE_ZONE("Basic.pvdFrameStart", mScene.getScScene().getContextId()); + + if(!mIsConnected) + return; + + mPvdDataStream->flushPvdCommand(); + mMetaDataBinding.sendBeginFrame(*mPvdDataStream, &mScene, simulateElapsedTime); +} + +void PvdSceneClient::frameEnd() +{ + PX_PROFILE_ZONE("Basic.pvdFrameEnd", mScene.getScScene().getContextId()); + + if(!mIsConnected) + { + if(mPvd) + mPvd->flush(); // Even if we aren't connected, we may need to flush buffered events. + return; + } + + PxScene* theScene = &mScene; + + mMetaDataBinding.sendStats(*mPvdDataStream, theScene); + + // flush our data to the main connection + mPvd->flush(); + + // End the frame *before* we send the dynamic object current data. + // This ensures that contacts end up synced with the rest of the system. + // Note that contacts were sent much earler in NpScene::fetchResults. + mMetaDataBinding.sendEndFrame(*mPvdDataStream, &mScene); + + if(mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG) + { + PX_PROFILE_ZONE("PVD.sceneUpdate", getContextId(mScene)); + + PvdVisualizer* vizualizer = NULL; + const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS; + if(visualizeJoints) + vizualizer = this; + + mMetaDataBinding.updateDynamicActorsAndArticulations(*mPvdDataStream, theScene, vizualizer); + } + + // frame end moved to update contacts to have them in the previous frame. +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpAggregate* npAggregate) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScene)); + mMetaDataBinding.createInstance(*mPvdDataStream, *npAggregate, mScene); + } +} + +void PvdSceneClient::updatePvdProperties(const NpAggregate* npAggregate) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *npAggregate); +} + +void PvdSceneClient::attachAggregateActor(const NpAggregate* npAggregate, NpActor* actor) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.attachAggregateActor(*mPvdDataStream, *npAggregate, *getPxActor(actor)); +} + +void PvdSceneClient::detachAggregateActor(const NpAggregate* npAggregate, NpActor* actor) +{ + if(checkPvdDebugFlag()) + mMetaDataBinding.detachAggregateActor(*mPvdDataStream, *npAggregate, *getPxActor(actor)); +} + +void PvdSceneClient::releasePvdInstance(const NpAggregate* npAggregate) +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.releasePVDInstance", getContextId(mScene)); + mMetaDataBinding.destroyInstance(*mPvdDataStream, *npAggregate, mScene); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX +void PvdSceneClient::createPvdInstance(const NpSoftBody* softBody) +{ + PX_UNUSED(softBody); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpSoftBody* softBody) +{ + PX_UNUSED(softBody); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpSoftBody* softBody, NpActor* actor) +{ + PX_UNUSED(softBody); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpSoftBody* softBody, NpActor* actor) +{ + PX_UNUSED(softBody); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpSoftBody* softBody) +{ + PX_UNUSED(softBody); + //Todo +} + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpFEMCloth* femCloth) +{ + PX_UNUSED(femCloth); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpFEMCloth* femCloth) +{ + PX_UNUSED(femCloth); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor) +{ + PX_UNUSED(femCloth); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor) +{ + PX_UNUSED(femCloth); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpFEMCloth* femCloth) +{ + PX_UNUSED(femCloth); + //Todo +} + +/////////////////////////////////////////////////////////////////////////////// +void PvdSceneClient::createPvdInstance(const NpPBDParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpPBDParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpPBDParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +/////////////////////////////////////////////////////////////////////////////// +void PvdSceneClient::createPvdInstance(const NpFLIPParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpFLIPParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpFLIPParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +/////////////////////////////////////////////////////////////////////////////// +void PvdSceneClient::createPvdInstance(const NpMPMParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpMPMParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpMPMParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +/////////////////////////////////////////////////////////////////////////////// +void PvdSceneClient::createPvdInstance(const NpCustomParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpCustomParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpCustomParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpCustomParticleSystem* particleSystem, NpActor* actor) +{ + PX_UNUSED(particleSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpCustomParticleSystem* particleSystem) +{ + PX_UNUSED(particleSystem); + //Todo +} + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::createPvdInstance(const NpHairSystem* hairSystem) +{ + PX_UNUSED(hairSystem); + //Todo +} + +void PvdSceneClient::updatePvdProperties(const NpHairSystem* hairSystem) +{ + PX_UNUSED(hairSystem); + //Todo +} + +void PvdSceneClient::attachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor) +{ + PX_UNUSED(hairSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::detachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor) +{ + PX_UNUSED(hairSystem); + PX_UNUSED(actor); + //Todo +} + +void PvdSceneClient::releasePvdInstance(const NpHairSystem* hairSystem) +{ + PX_UNUSED(hairSystem); + //Todo +} + +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void PvdSceneClient::updateJoints() +{ + if(checkPvdDebugFlag()) + { + PX_PROFILE_ZONE("PVD.updateJoints", getContextId(mScene)); + + const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS; + + Sc::ConstraintCore*const * constraints = mScene.getScScene().getConstraints(); + const PxU32 nbConstraints = mScene.getScScene().getNbConstraints(); + PxI64 constraintCount = 0; + + for(PxU32 i=0; iisDirty() + ? PxPvdUpdateType::UPDATE_ALL_PROPERTIES + : PxPvdUpdateType::UPDATE_SIM_PROPERTIES; + updateConstraint(*constraint, updateType); + PxConstraintConnector* conn = constraint->getPxConnector(); + // visualization is updated here + { + PxU32 typeId = 0; + void* joint = NULL; + if(conn) + joint = conn->getExternalReference(typeId); + // visualize: + Sc::ConstraintSim* sim = constraint->getSim(); + if(visualizeJoints && sim && sim->getConstantsLL() && joint && constraint->getVisualize()) + { + Sc::BodySim* b0 = sim->getBody(0); + Sc::BodySim* b1 = sim->getBody(1); + PxTransform t0 = b0 ? b0->getBody2World() : PxTransform(PxIdentity); + PxTransform t1 = b1 ? b1->getBody2World() : PxTransform(PxIdentity); + PvdConstraintVisualizer viz(joint, *mUserRender); + (*constraint->getVisualize())(viz, sim->getConstantsLL(), t0, t1, 0xffffFFFF); + } + } + ++constraintCount; + } + + mUserRender->flushRenderEvents(); + } +} + +void PvdSceneClient::updateContacts() +{ + if(!checkPvdDebugFlag()) + return; + + PX_PROFILE_ZONE("PVD.updateContacts", getContextId(mScene)); + + // if contacts are disabled, send empty array and return + const PxScene* theScene = &mScene; + if(!(getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONTACTS)) + { + mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene); + return; + } + + PxsContactManagerOutputIterator outputIter; + + Sc::ContactIterator contactIter; + mScene.getScScene().initContactsIterator(contactIter, outputIter); + Sc::ContactIterator::Pair* pair; + Sc::Contact* contact; + PxArray contacts; + while ((pair = contactIter.getNextPair()) != NULL) + { + while ((contact = pair->getNextContact()) != NULL) + contacts.pushBack(*contact); + } + + mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene, contacts); +} + +void PvdSceneClient::updateSceneQueries() +{ + if(checkPvdDebugFlag() && (getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES)) + mMetaDataBinding.sendSceneQueries(*mPvdDataStream, mScene, mPvd); +} + +void PvdSceneClient::visualize(PxArticulationLink& link) +{ +#if PX_ENABLE_DEBUG_VISUALIZATION + NpArticulationLink& npLink = static_cast(link); + const void* itemId = npLink.getInboundJoint(); + if(itemId && mUserRender) + { + PvdConstraintVisualizer viz(itemId, *mUserRender); + npLink.visualizeJoint(viz); + } +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION + PX_UNUSED(link); +#endif +} + +void PvdSceneClient::visualize(const PxRenderBuffer& debugRenderable) +{ + if(mUserRender) + { + // PT: I think the mUserRender object can contain extra data (including things coming from the user), because the various + // draw functions are exposed e.g. in PxPvdSceneClient.h. So I suppose we have to keep the render buffer around regardless + // of the connection flags. Thus I only skip the "drawRenderbuffer" call, for minimal intrusion into this file. + if(checkPvdDebugFlag()) + { + mUserRender->drawRenderbuffer( + reinterpret_cast(debugRenderable.getPoints()), debugRenderable.getNbPoints(), + reinterpret_cast(debugRenderable.getLines()), debugRenderable.getNbLines(), + reinterpret_cast(debugRenderable.getTriangles()), debugRenderable.getNbTriangles()); + } + mUserRender->flushRenderEvents(); + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.h new file mode 100644 index 0000000..fa08e29 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneClient.h @@ -0,0 +1,295 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SCENE_PVD_CLIENT_H +#define NP_SCENE_PVD_CLIENT_H + +#include "PxPhysXConfig.h" + +#if PX_SUPPORT_PVD + +#include "foundation/PxStrideIterator.h" +#include "pvd/PxPvdTransport.h" +#include "pvd/PxPvdSceneClient.h" + +#include "PvdMetaDataPvdBinding.h" +#include "foundation/PxBitMap.h" +#include "PxPvdClient.h" +#include "PxPvdUserRenderer.h" +#include "PsPvd.h" + +#include "PxsMaterialCore.h" +#include "PxsFEMSoftBodyMaterialCore.h" +#include "PxsFEMClothMaterialCore.h" +#include "PxsPBDMaterialCore.h" +#include "PxsFLIPMaterialCore.h" +#include "PxsMPMMaterialCore.h" + +namespace physx +{ +class PxActor; +class PxArticulationLink; +class PxRenderBuffer; +class NpConstraint; +class NpShape; +class NpAggregate; +class NpRigidStatic; +class NpRigidDynamic; +class NpArticulationLink; +class NpArticulationJointReducedCoordinate; +class NpArticulationReducedCoordinate; +class NpArticulationSpatialTendon; +class NpArticulationFixedTendon; +class NpArticulationSensor; +class NpActor; +class NpScene; + +#if PX_SUPPORT_GPU_PHYSX +class NpSoftBody; +class NpFEMCloth; +class NpPBDParticleSystem; +class NpFLIPParticleSystem; +class NpMPMParticleSystem; +class NpCustomParticleSystem; +class NpHairSystem; +#endif + +namespace Sc +{ +class ConstraintCore; +} + +namespace Vd +{ +class PvdSceneClient : public PxPvdSceneClient, public PvdClient, public PvdVisualizer +{ + PX_NOCOPY(PvdSceneClient) + public: + PvdSceneClient(NpScene& scene); + virtual ~PvdSceneClient(); + + // PxPvdSceneClient + virtual void setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value); + virtual void setScenePvdFlags(PxPvdSceneFlags flags) { mFlags = flags; } + virtual PxPvdSceneFlags getScenePvdFlags() const { return mFlags; } + virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target); + virtual void drawPoints(const PxDebugPoint* points, PxU32 count); + virtual void drawLines(const PxDebugLine* lines, PxU32 count); + virtual void drawTriangles(const PxDebugTriangle* triangles, PxU32 count); + virtual void drawText(const PxDebugText& text); + virtual PvdClient* getClientInternal() { return this; } + //~PxPvdSceneClient + + // pvdClient + virtual PvdDataStream* getDataStream() { return mPvdDataStream; } + virtual bool isConnected() const { return mIsConnected; } + virtual void onPvdConnected(); + virtual void onPvdDisconnected(); + virtual void flush() {} + //~pvdClient + + PX_FORCE_INLINE bool checkPvdDebugFlag() const + { + return mIsConnected && (mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG); + } + + PX_FORCE_INLINE PxPvdSceneFlags getScenePvdFlagsFast() const { return mFlags; } + PX_FORCE_INLINE void setPsPvd(PsPvd* pvd) { mPvd = pvd; } + + void frameStart(PxReal simulateElapsedTime); + void frameEnd(); + + void updatePvdProperties(); + void releasePvdInstance(); + + void createPvdInstance (const PxActor* actor); // temporary for deformables and particle systems - sschirm: deformables and particles are gone... + void updatePvdProperties(const PxActor* actor); + void releasePvdInstance (const PxActor* actor); // temporary for deformables and particle systems - sschirm: deformables and particles are gone... + + void createPvdInstance (const NpActor* actor); // temporary for deformables and particle systems - sschirm: deformables and particles are gone... + void updatePvdProperties(const NpActor* actor); + void releasePvdInstance (const NpActor* actor); // temporary for deformables and particle systems - sschirm: deformables and particles are gone... + + void createPvdInstance (const NpRigidDynamic* body); + void createPvdInstance (const NpArticulationLink* body); + void updatePvdProperties (const NpRigidDynamic* body); + void updatePvdProperties (const NpArticulationLink* body); + void releasePvdInstance (const NpRigidDynamic* body); + void releasePvdInstance (const NpArticulationLink* body); + void updateBodyPvdProperties(const NpActor* body); + void updateKinematicTarget (const NpActor* body, const PxTransform& p); + + void createPvdInstance (const NpRigidStatic* rigidStatic); + void updatePvdProperties (const NpRigidStatic* rigidStatic); + void releasePvdInstance (const NpRigidStatic* rigidStatic); + + void createPvdInstance (const NpConstraint* constraint); + void updatePvdProperties(const NpConstraint* constraint); + void releasePvdInstance (const NpConstraint* constraint); + + void createPvdInstance (const NpArticulationReducedCoordinate* articulation); + void updatePvdProperties(const NpArticulationReducedCoordinate* articulation); + void releasePvdInstance (const NpArticulationReducedCoordinate* articulation); + + void createPvdInstance (const NpArticulationJointReducedCoordinate* articulationJoint); + void updatePvdProperties(const NpArticulationJointReducedCoordinate* articulationJoint); + void releasePvdInstance (const NpArticulationJointReducedCoordinate* articulationJoint); + + void createPvdInstance(const NpArticulationSpatialTendon* articulationTendon); + void updatePvdProperties(const NpArticulationSpatialTendon* articulationTendon); + void releasePvdInstance(const NpArticulationSpatialTendon* articulationTendon); + + void createPvdInstance(const NpArticulationFixedTendon* articulationTendon); + void updatePvdProperties(const NpArticulationFixedTendon* articulationTendon); + void releasePvdInstance(const NpArticulationFixedTendon* articulationTendon); + + void createPvdInstance(const NpArticulationSensor* sensor); + void updatePvdProperties(const NpArticulationSensor* sensor); + void releasePvdInstance(const NpArticulationSensor* sensor); + + /////////////////////////////////////////////////////////////////////////// + + void createPvdInstance (const PxsMaterialCore* materialCore); + void updatePvdProperties(const PxsMaterialCore* materialCore); + void releasePvdInstance (const PxsMaterialCore* materialCore); + + void createPvdInstance (const PxsFEMSoftBodyMaterialCore* materialCore); + void updatePvdProperties(const PxsFEMSoftBodyMaterialCore* materialCore); + void releasePvdInstance (const PxsFEMSoftBodyMaterialCore* materialCore); + + void createPvdInstance (const PxsFEMClothMaterialCore* materialCore); + void updatePvdProperties(const PxsFEMClothMaterialCore* materialCore); + void releasePvdInstance (const PxsFEMClothMaterialCore* materialCore); + + void createPvdInstance (const PxsPBDMaterialCore* materialCore); + void updatePvdProperties(const PxsPBDMaterialCore* materialCore); + void releasePvdInstance (const PxsPBDMaterialCore* materialCore); + + void createPvdInstance (const PxsFLIPMaterialCore* materialCore); + void updatePvdProperties(const PxsFLIPMaterialCore* materialCore); + void releasePvdInstance (const PxsFLIPMaterialCore* materialCore); + + void createPvdInstance (const PxsMPMMaterialCore* materialCore); + void updatePvdProperties(const PxsMPMMaterialCore* materialCore); + void releasePvdInstance (const PxsMPMMaterialCore* materialCore); + + void createPvdInstance (const PxsCustomMaterialCore* materialCore); + void updatePvdProperties(const PxsCustomMaterialCore* materialCore); + void releasePvdInstance (const PxsCustomMaterialCore* materialCore); + + /////////////////////////////////////////////////////////////////////////// + + void createPvdInstance (const NpShape* shape, PxActor& owner); + void updateMaterials (const NpShape* shape); + void updatePvdProperties (const NpShape* shape); + void releaseAndRecreateGeometry (const NpShape* shape); + void releasePvdInstance (const NpShape* shape, PxActor& owner); + void addBodyAndShapesToPvd (NpRigidDynamic& b); + void addStaticAndShapesToPvd (NpRigidStatic& s); + + void createPvdInstance (const NpAggregate* aggregate); + void updatePvdProperties (const NpAggregate* aggregate); + void attachAggregateActor (const NpAggregate* aggregate, NpActor* actor); + void detachAggregateActor (const NpAggregate* aggregate, NpActor* actor); + void releasePvdInstance (const NpAggregate* aggregate); + +#if PX_SUPPORT_GPU_PHYSX + void createPvdInstance(const NpSoftBody* softBody); + void updatePvdProperties(const NpSoftBody* softBody); + void attachAggregateActor(const NpSoftBody* softBody, NpActor* actor); + void detachAggregateActor(const NpSoftBody* softBody, NpActor* actor); + void releasePvdInstance(const NpSoftBody* softBody); + + void createPvdInstance(const NpFEMCloth* femCloth); + void updatePvdProperties(const NpFEMCloth* femCloth); + void attachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor); + void detachAggregateActor(const NpFEMCloth* femCloth, NpActor* actor); + void releasePvdInstance(const NpFEMCloth* femCloth); + + void createPvdInstance(const NpPBDParticleSystem* particleSystem); + void updatePvdProperties(const NpPBDParticleSystem* particleSystem); + void attachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor); + void detachAggregateActor(const NpPBDParticleSystem* particleSystem, NpActor* actor); + void releasePvdInstance(const NpPBDParticleSystem* particleSystem); + + void createPvdInstance(const NpFLIPParticleSystem* particleSystem); + void updatePvdProperties(const NpFLIPParticleSystem* particleSystem); + void attachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor); + void detachAggregateActor(const NpFLIPParticleSystem* particleSystem, NpActor* actor); + void releasePvdInstance(const NpFLIPParticleSystem* particleSystem); + + void createPvdInstance(const NpMPMParticleSystem* particleSystem); + void updatePvdProperties(const NpMPMParticleSystem* particleSystem); + void attachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor); + void detachAggregateActor(const NpMPMParticleSystem* particleSystem, NpActor* actor); + void releasePvdInstance(const NpMPMParticleSystem* particleSystem); + + void createPvdInstance(const NpCustomParticleSystem* particleSystem); + void updatePvdProperties(const NpCustomParticleSystem* particleSystem); + void attachAggregateActor(const NpCustomParticleSystem* particleSystem, NpActor* actor); + void detachAggregateActor(const NpCustomParticleSystem* particleSystem, NpActor* actor); + void releasePvdInstance(const NpCustomParticleSystem* particleSystem); + + void createPvdInstance(const NpHairSystem* hairSystem); + void updatePvdProperties(const NpHairSystem* hairSystem); + void attachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor); + void detachAggregateActor(const NpHairSystem* hairSystem, NpActor* actor); + void releasePvdInstance(const NpHairSystem* hairSystem); +#endif + + void originShift(PxVec3 shift); + void updateJoints(); + void updateContacts(); + void updateSceneQueries(); + + // PvdVisualizer + void visualize(PxArticulationLink& link); + void visualize(const PxRenderBuffer& debugRenderable); + + private: + + void sendEntireScene(); + void updateConstraint(const Sc::ConstraintCore& scConstraint, PxU32 updateType); + + PxPvdSceneFlags mFlags; + PsPvd* mPvd; + NpScene& mScene; + + PvdDataStream* mPvdDataStream; + PvdMetaDataBinding mMetaDataBinding; + PvdUserRenderer* mUserRender; + RendererEventClient* mRenderClient; + bool mIsConnected; +}; + +} // pvd + +} // physx +#endif // PX_SUPPORT_PVD + +#endif // NP_SCENE_PVD_CLIENT_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp new file mode 100644 index 0000000..243e0cd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.cpp @@ -0,0 +1,153 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpPvdSceneQueryCollector.h" +#include "NpPvdSceneClient.h" + +#if PX_SUPPORT_PVD +using namespace physx; +using namespace Vd; + +static const char* gName_PvdRaycast[2] = { "SceneQueries.Raycasts", "BatchedQueries.Raycasts" }; +static const char* gName_PvdSweep[2] = { "SceneQueries.Sweeps", "BatchedQueries.Sweeps" }; +static const char* gName_PvdOverlap[2] = { "SceneQueries.Overlaps", "BatchedQueries.Overlaps" }; +static const char* gName_PvdSqHit[2] = { "SceneQueries.Hits", "BatchedQueries.Hits" }; +static const char* gName_PxTransform[2] = { "SceneQueries.PoseList", "BatchedQueries.PoseList" }; +static const char* gName_PxFilterData[2] = { "SceneQueries.FilterDataList", "BatchedQueries.FilterDataList" }; +static const char* gName_PxGeometryHolder[2] = { "SceneQueries.GeometryList", "BatchedQueries.GeometryList" }; + +PvdSceneQueryCollector::PvdSceneQueryCollector(Vd::PvdSceneClient* pvd, bool isBatched) : + mAccumulatedRaycastQueries (gName_PvdRaycast), + mAccumulatedSweepQueries (gName_PvdSweep), + mAccumulatedOverlapQueries (gName_PvdOverlap), + mPvdSqHits (gName_PvdSqHit), + mPoses (gName_PxTransform), + mFilterData (gName_PxFilterData), + mPVD (pvd), + mGeometries0 (gName_PxGeometryHolder), + mGeometries1 (gName_PxGeometryHolder), + mInUse (0), + mIsBatched (isBatched) +{ +} + +void PvdSceneQueryCollector::release() +{ + physx::pvdsdk::PvdDataStream* stream = mPVD->getDataStream(); + if(stream && stream->isConnected()) + { + const PxArray& geoms = getPrevFrameGeometries(); + for(PxU32 k=0; kdestroyInstance(&geoms[k]); + + clearGeometryArrays(); + } +} + +template +static void accumulate(PvdHitType& query, PxArray& accumulated, const char* arrayName, PxArray& dst, const SDKHitType* src, PxU32 nb, const PxQueryFilterData& fd) +{ + query.mFilterFlags = fd.flags; + query.mHits = PvdReference(arrayName, dst.size(), nb); + + PX_ASSERT(PxU32(-1) != nb); + for(PxU32 i=0; i 0 ? 1u : 0; +} + +template static void pushBackT(PxArray& array, const Type& item, PvdReference& ref, const char* arrayName) +{ + ref = PvdReference(arrayName, array.size(), 1); + array.pushBack(item); +} + +void PvdSceneQueryCollector::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& fd, bool multipleHits) +{ + PxMutex::ScopedLock lock(mMutex); + + PvdRaycast raycastQuery; + raycastQuery.mOrigin = origin; + raycastQuery.mUnitDir = unitDir; + raycastQuery.mDistance = distance; + raycastQuery.mFilterData = fd.data; + if(fd.flags & PxQueryFlag::eANY_HIT) raycastQuery.mType = QueryID::QUERY_RAYCAST_ANY_OBJECT; + else if(multipleHits) raycastQuery.mType = QueryID::QUERY_RAYCAST_ALL_OBJECTS; + else raycastQuery.mType = QueryID::QUERY_RAYCAST_CLOSEST_OBJECT; + clampNbHits(hitsNum, fd, multipleHits); + + accumulate(raycastQuery, mAccumulatedRaycastQueries, getArrayName(mPvdSqHits), mPvdSqHits, hit, hitsNum, fd); +} + +void PvdSceneQueryCollector::sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& fd, bool multipleHits) +{ + PxMutex::ScopedLock lock(mMutex); + + PvdSweep sweepQuery; + pushBackT(getGeometries(mInUse), PxGeometryHolder(geometry), sweepQuery.mGeometries, getArrayName(getGeometries(mInUse))); // PT: TODO: optimize this. We memcopy once to the stack, then again to the array.... + pushBackT(mPoses, pose, sweepQuery.mPoses, getArrayName(mPoses)); + pushBackT(mFilterData, fd.data, sweepQuery.mFilterData, getArrayName(mFilterData)); + + const PxGeometryType::Enum type = geometry.getType(); // PT: TODO: QueryID::QUERY_LINEAR_xxx_SWEEP_ALL_OBJECTS are never used! + if(type==PxGeometryType::eBOX) sweepQuery.mType = QueryID::QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT; + else if(type==PxGeometryType::eSPHERE || type==PxGeometryType::eCAPSULE) sweepQuery.mType = QueryID::QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT; + else if(type==PxGeometryType::eCONVEXMESH) sweepQuery.mType = QueryID::QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT; + else PX_ASSERT(0); + sweepQuery.mUnitDir = unitDir; + sweepQuery.mDistance = distance; + clampNbHits(hitsNum, fd, multipleHits); + + accumulate(sweepQuery, mAccumulatedSweepQueries, getArrayName(mPvdSqHits), mPvdSqHits, hit, hitsNum, fd); +} + +void PvdSceneQueryCollector::overlapMultiple(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& fd) +{ + PxMutex::ScopedLock lock(mMutex); + + PvdOverlap overlapQuery; + pushBackT(getGeometries(mInUse), PxGeometryHolder(geometry), overlapQuery.mGeometries, getArrayName(getGeometries(mInUse))); // PT: TODO: optimize this. We memcopy once to the stack, then again to the array.... + + const PxGeometryType::Enum type = geometry.getType(); + if(type==PxGeometryType::eBOX) overlapQuery.mType = pose.q.isIdentity() ? QueryID::QUERY_OVERLAP_AABB_ALL_OBJECTS : QueryID::QUERY_OVERLAP_OBB_ALL_OBJECTS; + else if(type==PxGeometryType::eSPHERE) overlapQuery.mType = QueryID::QUERY_OVERLAP_SPHERE_ALL_OBJECTS; + else if(type==PxGeometryType::eCAPSULE) overlapQuery.mType = QueryID::QUERY_OVERLAP_CAPSULE_ALL_OBJECTS; + else if(type==PxGeometryType::eCONVEXMESH) overlapQuery.mType = QueryID::QUERY_OVERLAP_CONVEX_ALL_OBJECTS; + else PX_ASSERT(0); + overlapQuery.mPose = pose; + overlapQuery.mFilterData = fd.data; + + accumulate(overlapQuery, mAccumulatedOverlapQueries, getArrayName(mPvdSqHits), mPvdSqHits, hit, hitsNum, fd); +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.h new file mode 100644 index 0000000..50f3a47 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpPvdSceneQueryCollector.h @@ -0,0 +1,240 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_PVD_SCENEQUERYCOLLECTOR_H +#define NP_PVD_SCENEQUERYCOLLECTOR_H + +#include "geometry/PxGeometryHelpers.h" +#include "PxFiltering.h" +#include "PxQueryReport.h" +#include "PxQueryFiltering.h" + +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" + +#if PX_SUPPORT_PVD + +namespace physx +{ +namespace Vd +{ + class PvdSceneClient; + + struct QueryID { enum Enum { + QUERY_RAYCAST_ANY_OBJECT, + QUERY_RAYCAST_CLOSEST_OBJECT, + QUERY_RAYCAST_ALL_OBJECTS, + + QUERY_OVERLAP_SPHERE_ALL_OBJECTS, + QUERY_OVERLAP_AABB_ALL_OBJECTS, + QUERY_OVERLAP_OBB_ALL_OBJECTS, + QUERY_OVERLAP_CAPSULE_ALL_OBJECTS, + QUERY_OVERLAP_CONVEX_ALL_OBJECTS, + + QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT, + QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT, + QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT + }; }; + +struct PvdReference +{ + PX_FORCE_INLINE PvdReference() {} + PX_FORCE_INLINE PvdReference(const char* arrayName, PxU32 baseIndex, PxU32 count) : mArrayName(arrayName), mBaseIndex(baseIndex), mCount(count) {} + + const char* mArrayName; + PxU32 mBaseIndex; + PxU32 mCount; +}; + +struct PvdRaycast +{ + PxU32 mType; + PxFilterData mFilterData; + PxU32 mFilterFlags; + PxVec3 mOrigin; + PxVec3 mUnitDir; + PxReal mDistance; + PvdReference mHits; +}; + +struct PvdOverlap +{ + PxU32 mType; + PxFilterData mFilterData; + PxU32 mFilterFlags; + PxTransform mPose; + PvdReference mGeometries; + PvdReference mHits; +}; + +struct PvdSweep +{ + PxU32 mType; + PxU32 mFilterFlags; + PxVec3 mUnitDir; + PxReal mDistance; + PvdReference mGeometries; + PvdReference mPoses; + PvdReference mFilterData; + PvdReference mHits; +}; + +struct PvdSqHit +{ + const void* mShape; + const void* mActor; + PxU32 mFaceIndex; + PxU32 mFlags; + PxVec3 mImpact; + PxVec3 mNormal; + PxF32 mDistance; + PxF32 mU; + PxF32 mV; + + PvdSqHit() + { + setDefaults(0xFFFFffff, NULL, NULL); + } + + explicit PvdSqHit(const PxOverlapHit& hit) + { + setDefaults(hit.faceIndex, hit.shape, hit.actor); + } + + explicit PvdSqHit(const PxRaycastHit& hit) + { + setDefaults(hit.faceIndex, hit.shape, hit.actor); + + mImpact = hit.position; + mNormal = hit.normal; + mDistance = hit.distance; + mFlags = hit.flags; + mU = hit.u; + mV = hit.v; + } + + explicit PvdSqHit(const PxSweepHit& hit) + { + setDefaults(hit.faceIndex, hit.shape, hit.actor); + + mImpact = hit.position; + mNormal = hit.normal; + mDistance = hit.distance; + mFlags = hit.flags; + } + + private: + void setDefaults(PxU32 faceIndex, const void* shape, const void* actor) + { + mShape = shape; + mActor = actor; + mFaceIndex = faceIndex; + mFlags = 0; + mImpact = mNormal = PxVec3(0.0f); + mDistance = mU = mV = 0.0f; + } +}; + +template +class NamedArray : public PxArray +{ + public: + NamedArray(const char* names[2]) { mNames[0] = names[0]; mNames[1] = names[1]; } + + const char* mNames[2]; +}; + +class PvdSceneQueryCollector +{ + PX_NOCOPY(PvdSceneQueryCollector) +public: + PvdSceneQueryCollector(Vd::PvdSceneClient* pvd, bool isBatched); + ~PvdSceneQueryCollector() {} + + void clear() + { + PxMutex::ScopedLock lock(mMutex); + + mAccumulatedRaycastQueries.clear(); + mAccumulatedOverlapQueries.clear(); + mAccumulatedSweepQueries.clear(); + mPvdSqHits.clear(); + mPoses.clear(); + mFilterData.clear(); + } + + void clearGeometryArrays() + { + mGeometries0.clear(); + mGeometries1.clear(); + } + + void release(); + + void raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits); + void sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits); + void overlapMultiple(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData); + + PX_FORCE_INLINE PxMutex& getLock() { return mMutex; } + + template + PX_FORCE_INLINE const char* getArrayName(const NamedArray& namedArray) const { return namedArray.mNames[mIsBatched]; } + + PX_FORCE_INLINE const NamedArray& getGeometries(PxU32 index) const { return index ? mGeometries1 : mGeometries0; } + PX_FORCE_INLINE NamedArray& getGeometries(PxU32 index) { return index ? mGeometries1 : mGeometries0; } + + PX_FORCE_INLINE const NamedArray& getCurrentFrameGeometries() const { return getGeometries(mInUse); } + PX_FORCE_INLINE const NamedArray& getPrevFrameGeometries() const { return getGeometries(mInUse ^ 1); } + + void prepareNextFrameGeometries() + { + mInUse ^= 1; + getGeometries(mInUse).clear(); + } + + NamedArray mAccumulatedRaycastQueries; + NamedArray mAccumulatedSweepQueries; + NamedArray mAccumulatedOverlapQueries; + NamedArray mPvdSqHits; + NamedArray mPoses; + NamedArray mFilterData; + +private: + Vd::PvdSceneClient* mPVD; + PxMutex mMutex; + NamedArraymGeometries0; + NamedArraymGeometries1; + PxU32 mInUse; + const bool mIsBatched; +}; +} +} + +#endif // PX_SUPPORT_PVD + +#endif // NP_PVD_SCENEQUERYCOLLECTOR_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplate.h new file mode 100644 index 0000000..2060f5e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplate.h @@ -0,0 +1,464 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_RIGID_ACTOR_TEMPLATE_H +#define NP_RIGID_ACTOR_TEMPLATE_H + +#include "NpActorTemplate.h" +#include "NpShapeManager.h" +#include "NpConstraint.h" +#include "NpFactory.h" +#include "NpActor.h" + +// PX_SERIALIZATION +#include "foundation/PxErrors.h" +//~PX_SERIALIZATION +#include "omnipvd/OmniPvdPxSampler.h" + +namespace physx +{ +template +class NpRigidActorTemplate : public NpActorTemplate +{ +private: + typedef NpActorTemplate ActorTemplateClass; + +public: +// PX_SERIALIZATION + NpRigidActorTemplate(PxBaseFlags baseFlags) : ActorTemplateClass(baseFlags), mShapeManager(PxEmpty)//, mIndex(0xFFFFFFFF) + { + NpBase::mFreeSlot = 0xFFFFFFFF; + } + virtual void requiresObjects(PxProcessPxBaseCallback& c); + void preExportDataReset(); + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); +//~PX_SERIALIZATION + virtual ~NpRigidActorTemplate(); + + // The rule is: If an API method is used somewhere in here, it has to be redeclared, else GCC whines + + // PxActor + void removeShapes(PxSceneQuerySystem* sqManager); + virtual PxActorType::Enum getType() const = 0; + virtual PxBounds3 getWorldBounds(float inflation=1.01f) const PX_OVERRIDE; + virtual void setActorFlag(PxActorFlag::Enum flag, bool value) PX_OVERRIDE; + virtual void setActorFlags(PxActorFlags inFlags) PX_OVERRIDE; + //~PxActor + + // PxRigidActor + virtual PxU32 getInternalActorIndex() const PX_OVERRIDE; + virtual bool attachShape(PxShape& s) PX_OVERRIDE; + virtual void detachShape(PxShape& s, bool wakeOnLostTouch) PX_OVERRIDE; + virtual PxU32 getNbShapes() const PX_OVERRIDE; + virtual PxU32 getShapes(PxShape** buffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + virtual PxU32 getNbConstraints() const PX_OVERRIDE; + virtual PxU32 getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + //~PxRigidActor + NpRigidActorTemplate(PxType concreteType, PxBaseFlags baseFlags, NpType::Enum type); + + // not optimal but the template alternative is hardly more readable and perf is not that critical here + virtual void switchToNoSim() { PX_ASSERT(false); } + virtual void switchFromNoSim() { PX_ASSERT(false); } + + PX_FORCE_INLINE NpShapeManager& getShapeManager() { return mShapeManager; } + PX_FORCE_INLINE const NpShapeManager& getShapeManager() const { return mShapeManager; } + + void updateShaderComs(); + + // index for the NpScene rigid dynamic or static array + // PT: note that this index changes during the lifetime of the object, e.g. when another object + // is removed and swaps happen in the scene's mRigidStatics/mRigidDynamics arrays. + PX_FORCE_INLINE PxU32 getRigidActorArrayIndex() const { return NpBase::mFreeSlot; } + PX_FORCE_INLINE void setRigidActorArrayIndex(PxU32 index) { NpBase::mFreeSlot = index; } +// PX_FORCE_INLINE PxU32 getRigidActorArrayIndex() const { return mIndex; } +// PX_FORCE_INLINE void setRigidActorArrayIndex(PxU32 index) { mIndex = index; } + + PX_FORCE_INLINE PxU32 getRigidActorSceneIndex() const { return NpBase::getBaseIndex(); } + PX_FORCE_INLINE void setRigidActorSceneIndex(PxU32 index) { NpBase::setBaseIndex(index); } + + bool resetFiltering_(NpActor& ro, Sc::RigidCore& core, PxShape*const* shapes, PxU32 shapeCount); + +#if PX_ENABLE_DEBUG_VISUALIZATION +public: + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif +protected: + PX_FORCE_INLINE void setActorSimFlag(bool value); + + NpShapeManager mShapeManager; + // PT: note that this index changes during the lifetime of the object, e.g. when another object + // is removed and swaps happen in the scene's mRigidStatics/mRigidDynamics arrays. +// PxU32 mIndex; // index for the NpScene rigid dynamic or static array + // PT: TODO: reduce padding +}; + +// PX_SERIALIZATION + +template +void NpRigidActorTemplate::requiresObjects(PxProcessPxBaseCallback& c) +{ + // export shapes + PxU32 nbShapes = mShapeManager.getNbShapes(); + for(PxU32 i=0;i +void NpRigidActorTemplate::preExportDataReset() +{ + //Clearing the aggregate ID for serialization so we avoid having a stale + //reference after deserialization. The aggregate ID get's reset on readding to the + //scene anyway. + Sc::ActorCore& actorCore = NpActor::getActorCore(); + actorCore.setAggregateID(PX_INVALID_U32); + mShapeManager.preExportDataReset(); + //mIndex = 0xFFFFFFFF; + NpBase::mFreeSlot = 0xFFFFFFFF; + NpBase::setBaseIndex(NP_UNUSED_BASE_INDEX); +} + +template +void NpRigidActorTemplate::exportExtraData(PxSerializationContext& context) +{ + mShapeManager.exportExtraData(context); + ActorTemplateClass::exportExtraData(context); +} + +template +void NpRigidActorTemplate::importExtraData(PxDeserializationContext& context) +{ + mShapeManager.importExtraData(context); + ActorTemplateClass::importExtraData(context); +} + +template +void NpRigidActorTemplate::resolveReferences(PxDeserializationContext& context) +{ + const PxU32 nbShapes = mShapeManager.getNbShapes(); + NpShape** shapes = const_cast(mShapeManager.getShapes()); + for(PxU32 j=0;jonActorAttach(*this); + } + + ActorTemplateClass::resolveReferences(context); +} + +//~PX_SERIALIZATION + +template +NpRigidActorTemplate::NpRigidActorTemplate(PxType concreteType, PxBaseFlags baseFlags, NpType::Enum type) : + ActorTemplateClass (concreteType, baseFlags, type) + //mIndex (0xffffffff) +{ + NpBase::mFreeSlot = 0xFFFFFFFF; +} + +template +NpRigidActorTemplate::~NpRigidActorTemplate() +{ + // TODO: no mechanism for notifying shaders of actor destruction yet +} + +template +PxU32 NpRigidActorTemplate::getInternalActorIndex() const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + + const PxU32 index = NpBase::getBaseIndex(); + return index!=NP_UNUSED_BASE_INDEX ? index : 0xffffffff; +} + +template +void NpRigidActorTemplate::removeShapes(PxSceneQuerySystem* sqManager) +{ + if(mShapeManager.getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxRigidActor::release: Actor is part of a pruning structure, pruning structure is now invalid!"); + mShapeManager.getPruningStructure()->invalidate(this); + } + + mShapeManager.detachAll(sqManager, *this); +} + +template +bool NpRigidActorTemplate::attachShape(PxShape& shape) +{ + NpScene* npScene = ActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + NpShape& npShape = static_cast(shape); + PX_CHECK_AND_RETURN_VAL(!static_cast(shape).isExclusive() || shape.getActor()==NULL, "PxRigidActor::attachShape: shape must be shared or unowned", false); + PX_CHECK_AND_RETURN_VAL(!(npShape.getCore().getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE), "PxRigidActor::attachShape() not allowed to attach a soft body shape to a rigid actor", false); + PX_CHECK_AND_RETURN_VAL(!(npShape.getCore().getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "PxRigidActor::attachShape() not allowed to attach a cloth shape to a rigid actor", false); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(npScene, "PxRigidActor::attachShape() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD + // invalidate the pruning structure if the actor bounds changed + if (mShapeManager.getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxRigidActor::attachShape: Actor is part of a pruning structure, pruning structure is now invalid!"); + mShapeManager.getPruningStructure()->invalidate(this); + } + + mShapeManager.attachShape(npShape, *this); + + OMNI_PVD_ADD(actor, shapes, static_cast(*this), shape) + + return true; +} + +template +void NpRigidActorTemplate::detachShape(PxShape& shape, bool wakeOnLostTouch) +{ + NpScene* npScene = ActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidActor::detachShape() not allowed while simulation is running. Call will be ignored.") + + OMNI_PVD_REMOVE(actor, shapes, static_cast(*this), shape) //this needs to happen before the actual detach happens below, because that detach might actually delete the shape, which invalidates the shape handle. + + if (mShapeManager.getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxRigidActor::detachShape: Actor is part of a pruning structure, pruning structure is now invalid!"); + mShapeManager.getPruningStructure()->invalidate(this); + } + + if(!mShapeManager.detachShape(static_cast(shape), *this, wakeOnLostTouch)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxRigidActor::detachShape: shape is not attached to this actor!"); + } +} + +template +PxU32 NpRigidActorTemplate::getNbShapes() const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + return mShapeManager.getNbShapes(); +} + +template +PxU32 NpRigidActorTemplate::getShapes(PxShape** buffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + return mShapeManager.getShapes(buffer, bufferSize, startIndex); +} + +template +PxU32 NpRigidActorTemplate::getNbConstraints() const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + return ActorTemplateClass::getNbConnectors(NpConnectorType::eConstraint); +} + +template +PxU32 NpRigidActorTemplate::getConstraints(PxConstraint** buffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + return ActorTemplateClass::template getConnectors(NpConnectorType::eConstraint, buffer, bufferSize, startIndex); // Some people will love me for this one... The syntax is to be standard compliant and + // picky gcc won't compile without it. It is needed if you call a templated member function + // of a templated class +} + +template +PxBounds3 NpRigidActorTemplate::getWorldBounds(float inflation) const +{ + NP_READ_CHECK(ActorTemplateClass::getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(ActorTemplateClass::getNpScene(), "PxRigidActor::getWorldBounds() not allowed while simulation is running (except during PxScene::collide()).", PxBounds3::empty()); + PX_SIMD_GUARD; + + const PxBounds3 bounds = mShapeManager.getWorldBounds_(*this); + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); +} + +template +PX_FORCE_INLINE void NpRigidActorTemplate::setActorSimFlag(bool value) +{ + NpScene* scene = ActorTemplateClass::getNpScene(); + + PxActorFlags oldFlags = ActorTemplateClass::getActorFlags(); + bool hadNoSimFlag = oldFlags.isSet(PxActorFlag::eDISABLE_SIMULATION); + + PX_CHECK_AND_RETURN((getType() != PxActorType::eARTICULATION_LINK) || (!value && !hadNoSimFlag), "PxActor::setActorFlag: PxActorFlag::eDISABLE_SIMULATION is only supported by PxRigidDynamic and PxRigidStatic objects."); + + if (hadNoSimFlag && (!value)) + { + switchFromNoSim(); + ActorTemplateClass::setActorFlagsInternal(oldFlags & (~PxActorFlag::eDISABLE_SIMULATION)); // needs to be done before the code below to make sure the latest flags get picked up + if (scene) + NpActor::addConstraintsToScene(); + } + else if ((!hadNoSimFlag) && value) + { + if (scene) + NpActor::removeConstraintsFromScene(); + ActorTemplateClass::setActorFlagsInternal(oldFlags | PxActorFlag::eDISABLE_SIMULATION); + switchToNoSim(); + } +} + +template +void NpRigidActorTemplate::setActorFlag(PxActorFlag::Enum flag, bool value) +{ + NpScene* npScene = ActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidActor::setActorFlag() not allowed while simulation is running. Call will be ignored.") + + if (flag == PxActorFlag::eDISABLE_SIMULATION) + setActorSimFlag(value); + + ActorTemplateClass::setActorFlagInternal(flag, value); +} + +template +void NpRigidActorTemplate::setActorFlags(PxActorFlags inFlags) +{ + NpScene* npScene = ActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidActor::setActorFlags() not allowed while simulation is running. Call will be ignored.") + + bool noSim = inFlags.isSet(PxActorFlag::eDISABLE_SIMULATION); + setActorSimFlag(noSim); + + ActorTemplateClass::setActorFlagsInternal(inFlags); +} + +template +void NpRigidActorTemplate::updateShaderComs() +{ + NpConnectorIterator iter = ActorTemplateClass::getConnectorIterator(NpConnectorType::eConstraint); + while (PxBase* ser = iter.getNext()) + { + NpConstraint* c = static_cast(ser); + c->comShift(this); + } +} + +template +bool NpRigidActorTemplate::resetFiltering_(NpActor& ro, Sc::RigidCore& core, PxShape*const* shapes, PxU32 shapeCount) +{ +#if PX_CHECKED + PX_CHECK_AND_RETURN_VAL(!(ro.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxScene::resetFiltering(): Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!", false); + for(PxU32 i=0; i < shapeCount; i++) + { + PxRigidActor* ra = shapes[i]->getActor(); + if (ra != this) + { + bool found = false; + if (ra == NULL) + { + NpShape*const* sh = mShapeManager.getShapes(); + for(PxU32 j=0; j < mShapeManager.getNbShapes(); j++) + { + if (sh[j] == shapes[i]) + { + found = true; + break; + } + } + } + + PX_CHECK_AND_RETURN_VAL(found, "PxScene::resetFiltering(): specified shape not in actor!", false); + } + PX_CHECK_AND_RETURN_VAL(static_cast(shapes[i])->getCore().getFlags() & (PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE), "PxScene::resetFiltering(): specified shapes not of type eSIMULATION_SHAPE or eTRIGGER_SHAPE!", false); + } +#endif + + PxU32 sCount; + if (shapes) + sCount = shapeCount; + else + sCount = mShapeManager.getNbShapes(); + + PX_ALLOCA(scShapes, NpShape*, sCount); + if (scShapes) + { + if (shapes) // the user specified the shapes + { + PxU32 sAccepted = 0; + for(PxU32 i=0; i < sCount; i++) + scShapes[sAccepted++] = static_cast(shapes[i]); + + sCount = sAccepted; + } + else // the user just specified the actor and the shapes are taken from the actor + { + NpShape* const* sh = mShapeManager.getShapes(); + PxU32 sAccepted = 0; + for(PxU32 i=0; i < sCount; i++) + { + if(sh[i]->getCore().getFlags() & (PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE)) + scShapes[sAccepted++] = sh[i]; + } + sCount = sAccepted; + } + + if (sCount) + { + PX_ASSERT(!(core.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))); + PX_ASSERT(!ro.isAPIWriteForbidden()); + PX_UNUSED(ro); + + // PT: TODO: rewrite this thing, we end up in getSimForShape() each time + for(PxU32 i=0; i < sCount; i++) + core.onShapeChange(scShapes[i]->getCore(), Sc::ShapeChangeNotifyFlag::eRESET_FILTERING); + } + } + + return true; +} + +#if PX_ENABLE_DEBUG_VISUALIZATION +template +void NpRigidActorTemplate::visualize(PxRenderOutput& out, NpScene& scene, float scale) const +{ + mShapeManager.visualize(out, scene, *this, scale); +} +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplateInternal.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplateInternal.h new file mode 100644 index 0000000..e2f4aa4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidActorTemplateInternal.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_RIGID_ACTOR_TEMPLATE_INTERNAL_H +#define NP_RIGID_ACTOR_TEMPLATE_INTERNAL_H + +// PT: TODO: what is not internal about NpRigidActorTemplate.h ? Just merge the two files + + + +namespace physx +{ + +template +static PX_FORCE_INLINE void removeRigidActorT(T& rigidActor) +{ + NpScene* s = rigidActor.getNpScene(); + NP_WRITE_CHECK(s); + + //Remove constraints (if any constraint is attached to the actor). + rigidActor.NpRigidActorTemplate::removeConstraints(rigidActor); + + //Remove from aggregate (if it is in an aggregate). + rigidActor.NpActorTemplate::removeFromAggregate(rigidActor); + + //Remove from scene (if it is in a scene). + PxSceneQuerySystem* sqManager = NULL; + if(s) + { + sqManager = &s->getSQAPI(); + const bool noSim = rigidActor.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION); + s->scRemoveActor(rigidActor, true, noSim); + } + + //Remove associated shapes. + rigidActor.NpRigidActorTemplate::removeShapes(sqManager); +} + +template +static PX_FORCE_INLINE bool releaseRigidActorT(T& rigidActor) +{ + NpScene* s = rigidActor.getNpScene(); + NP_WRITE_CHECK(s); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(s, "PxActor::release() not allowed while simulation is running. Call will be ignored.", false) + + const bool noSim = rigidActor.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION); + if(s && noSim) + { + // need to do it here because the Np-shape buffer will not be valid anymore after the removal below + // and unlike simulation objects, there is no shape buffer in the simulation controller + rigidActor.getShapeManager().clearShapesOnRelease(*s, rigidActor); + } + + NpPhysics::getInstance().notifyDeletionListenersUserRelease(&rigidActor, rigidActor.userData); + + //Remove constraints, aggregates, scene, shapes. + removeRigidActorT(rigidActor); + + if (s) + { + s->removeFromRigidActorList(rigidActor); + } + + return true; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidBodyTemplate.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidBodyTemplate.h new file mode 100644 index 0000000..9cc7d4c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidBodyTemplate.h @@ -0,0 +1,962 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_RIGIDBODY_TEMPLATE_H +#define NP_RIGIDBODY_TEMPLATE_H + +#include "NpRigidActorTemplate.h" +#include "ScBodyCore.h" +#include "NpPhysics.h" +#include "NpShape.h" +#include "NpScene.h" +#include "CmVisualization.h" +#include "NpDebugViz.h" + +#if PX_SUPPORT_PVD + // PT: updatePvdProperties() is overloaded and the compiler needs to know 'this' type to do the right thing. + // Thus we can't just move this as an inlined Base function. + #define UPDATE_PVD_PROPERTY_BODY \ + { \ + NpScene* sceneForPVD = RigidActorTemplateClass::getNpScene(); /* shared shapes also return zero here */ \ + if(sceneForPVD) \ + sceneForPVD->getScenePvdClientInternal().updateBodyPvdProperties(static_cast(this)); \ + } +#else + #define UPDATE_PVD_PROPERTY_BODY +#endif + +namespace physx +{ +PX_INLINE PxVec3 invertDiagInertia(const PxVec3& m) +{ + return PxVec3( m.x == 0.0f ? 0.0f : 1.0f/m.x, + m.y == 0.0f ? 0.0f : 1.0f/m.y, + m.z == 0.0f ? 0.0f : 1.0f/m.z); +} + +#if PX_ENABLE_DEBUG_VISUALIZATION +/* +given the diagonal of the body space inertia tensor, and the total mass +this returns the body space AABB width, height and depth of an equivalent box +*/ +PX_INLINE PxVec3 getDimsFromBodyInertia(const PxVec3& inertiaMoments, PxReal mass) +{ + const PxVec3 inertia = inertiaMoments * (6.0f/mass); + return PxVec3( PxSqrt(PxAbs(- inertia.x + inertia.y + inertia.z)), + PxSqrt(PxAbs(+ inertia.x - inertia.y + inertia.z)), + PxSqrt(PxAbs(+ inertia.x + inertia.y - inertia.z))); +} +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +template +class NpRigidBodyTemplate : public NpRigidActorTemplate +{ +protected: + typedef NpRigidActorTemplate RigidActorTemplateClass; +public: +// PX_SERIALIZATION + NpRigidBodyTemplate(PxBaseFlags baseFlags) : RigidActorTemplateClass(baseFlags), mCore(PxEmpty) {} +//~PX_SERIALIZATION + virtual ~NpRigidBodyTemplate(); + + // The rule is: If an API method is used somewhere in here, it has to be redeclared, else GCC whines + + // PxRigidActor + virtual PxTransform getGlobalPose() const = 0; + virtual bool attachShape(PxShape& shape) PX_OVERRIDE; + //~PxRigidActor + + // PxRigidBody + virtual PxTransform getCMassLocalPose() const PX_OVERRIDE; + virtual void setMass(PxReal mass) PX_OVERRIDE; + virtual PxReal getMass() const PX_OVERRIDE; + virtual PxReal getInvMass() const PX_OVERRIDE; + virtual void setMassSpaceInertiaTensor(const PxVec3& m) PX_OVERRIDE; + virtual PxVec3 getMassSpaceInertiaTensor() const PX_OVERRIDE; + virtual PxVec3 getMassSpaceInvInertiaTensor() const PX_OVERRIDE; + virtual void setLinearDamping(PxReal linDamp) PX_OVERRIDE; + virtual PxReal getLinearDamping() const PX_OVERRIDE; + virtual void setAngularDamping(PxReal angDamp) PX_OVERRIDE; + virtual PxReal getAngularDamping() const PX_OVERRIDE; + virtual PxVec3 getLinearVelocity() const PX_OVERRIDE; + virtual PxVec3 getAngularVelocity() const PX_OVERRIDE; + virtual void setMaxLinearVelocity(PxReal maxLinVel) PX_OVERRIDE; + virtual PxReal getMaxLinearVelocity() const PX_OVERRIDE; + virtual void setMaxAngularVelocity(PxReal maxAngVel) PX_OVERRIDE; + virtual PxReal getMaxAngularVelocity() const PX_OVERRIDE; + //~PxRigidBody + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + NpRigidBodyTemplate(PxType concreteType, PxBaseFlags baseFlags, const PxActorType::Enum type, NpType::Enum npType, const PxTransform& bodyPose); + + PX_FORCE_INLINE const Sc::BodyCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::BodyCore& getCore() { return mCore; } + + // Flags + virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum, bool value) PX_OVERRIDE; + virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) PX_OVERRIDE; + PX_FORCE_INLINE PxRigidBodyFlags getRigidBodyFlagsFast() const { return mCore.getFlags(); } + virtual PxRigidBodyFlags getRigidBodyFlags() const PX_OVERRIDE + { + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return getRigidBodyFlagsFast() & ~PxRigidBodyFlag::eRESERVED; + } + + virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) PX_OVERRIDE; + virtual PxReal getMinCCDAdvanceCoefficient() const PX_OVERRIDE; + virtual void setMaxDepenetrationVelocity(PxReal maxDepenVel) PX_OVERRIDE; + virtual PxReal getMaxDepenetrationVelocity() const PX_OVERRIDE; + virtual void setMaxContactImpulse(PxReal maxDepenVel) PX_OVERRIDE; + virtual PxReal getMaxContactImpulse() const PX_OVERRIDE; + virtual void setContactSlopCoefficient(PxReal slopCoefficient) PX_OVERRIDE; + virtual PxReal getContactSlopCoefficient() const PX_OVERRIDE; + + virtual PxNodeIndex getInternalIslandNodeIndex() const PX_OVERRIDE; + +protected: + void setCMassLocalPoseInternal(const PxTransform&); + + void addSpatialForce(const PxVec3* force, const PxVec3* torque, PxForceMode::Enum mode); + void clearSpatialForce(PxForceMode::Enum mode, bool force, bool torque); + void setSpatialForce(const PxVec3* force, const PxVec3* torque, PxForceMode::Enum mode); + + PX_FORCE_INLINE void setRigidBodyFlagsInternal(const PxRigidBodyFlags& currentFlags, const PxRigidBodyFlags& newFlags); + +public: +#if PX_ENABLE_DEBUG_VISUALIZATION + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + PX_FORCE_INLINE bool isKinematic() const + { + return (APIClass::getConcreteType() == PxConcreteType::eRIGID_DYNAMIC) && (mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC); + } + + PX_INLINE void scSetSolverIterationCounts(PxU16 c) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.setSolverIterationCounts(c); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetLockFlags(PxRigidDynamicLockFlags f) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.setRigidDynamicLockFlags(f); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetBody2World(const PxTransform& p) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.setBody2World(p); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetLinearVelocity(const PxVec3& v) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + mCore.setLinearVelocity(v); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetAngularVelocity(const PxVec3& v) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + mCore.setAngularVelocity(v); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scWakeUpInternal(PxReal wakeCounter) + { + PX_ASSERT(RigidActorTemplateClass::getNpScene()); + + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + mCore.wakeUp(wakeCounter); + } + + PX_FORCE_INLINE void scWakeUp() + { + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + NpScene* scene = RigidActorTemplateClass::getNpScene(); + PX_ASSERT(scene); // only allowed for an object in a scene + + scWakeUpInternal(scene->getWakeCounterResetValueInternal()); + } + + PX_INLINE void scPutToSleepInternal() + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.putToSleep(); + } + + PX_FORCE_INLINE void scPutToSleep() + { + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + scPutToSleepInternal(); + } + + PX_INLINE void scSetWakeCounter(PxReal w) + { + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + mCore.setWakeCounter(w); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetFlags(PxRigidBodyFlags f) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.setFlags(RigidActorTemplateClass::getNpScene() ? RigidActorTemplateClass::getNpScene()->getScScene().getSimStateDataPool() : NULL, f); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scAddSpatialAcceleration(const PxVec3* linAcc, const PxVec3* angAcc) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.addSpatialAcceleration(RigidActorTemplateClass::getNpScene()->getScScene().getSimStateDataPool(), linAcc, angAcc); + //Spatial acceleration isn't sent to PVD. + } + + PX_INLINE void scSetSpatialAcceleration(const PxVec3* linAcc, const PxVec3* angAcc) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.setSpatialAcceleration(RigidActorTemplateClass::getNpScene()->getScScene().getSimStateDataPool(), linAcc, angAcc); + //Spatial acceleration isn't sent to PVD. + } + + PX_INLINE void scClearSpatialAcceleration(bool force, bool torque) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.clearSpatialAcceleration(force, torque); + //Spatial acceleration isn't sent to PVD. + } + + PX_INLINE void scAddSpatialVelocity(const PxVec3* linVelDelta, const PxVec3* angVelDelta) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.addSpatialVelocity(RigidActorTemplateClass::getNpScene()->getScScene().getSimStateDataPool(), linVelDelta, angVelDelta); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scClearSpatialVelocity(bool force, bool torque) + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.clearSpatialVelocity(force, torque); + UPDATE_PVD_PROPERTY_BODY + } + + PX_INLINE void scSetKinematicTarget(const PxTransform& p) + { + NpScene* scene = RigidActorTemplateClass::getNpScene(); + PX_ASSERT(scene); // only allowed for an object in a scene + const PxReal wakeCounterResetValue = scene->getWakeCounterResetValueInternal(); + + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbiddenExceptSplitSim()); + + mCore.setKinematicTarget(p, wakeCounterResetValue); + + UPDATE_PVD_PROPERTY_BODY + + #if PX_SUPPORT_PVD + scene->getScenePvdClientInternal().updateKinematicTarget(this, p); + #endif + } + + PX_INLINE PxMat33 scGetGlobalInertiaTensorInverse() const + { + PxMat33 inverseInertiaWorldSpace; + Cm::transformInertiaTensor(mCore.getInverseInertia(), PxMat33Padded(mCore.getBody2World().q), inverseInertiaWorldSpace); + return inverseInertiaWorldSpace; + } + + PX_FORCE_INLINE bool scCheckSleepReadinessBesidesWakeCounter() + { + return (getLinearVelocity().isZero() && getAngularVelocity().isZero()); + // no need to test for pending force updates yet since currently this is not supported on scene insertion + } + +protected: + Sc::BodyCore mCore; +}; + +template +NpRigidBodyTemplate::NpRigidBodyTemplate(PxType concreteType, PxBaseFlags baseFlags, PxActorType::Enum type, NpType::Enum npType, const PxTransform& bodyPose) : + RigidActorTemplateClass (concreteType, baseFlags, npType), + mCore (type, bodyPose) +{ +} + +template +NpRigidBodyTemplate::~NpRigidBodyTemplate() +{ +} + +namespace +{ + PX_FORCE_INLINE static bool hasNegativeMass(const PxShape& shape) + { + const PxGeometryType::Enum t = shape.getGeometryType(); + if (t == PxGeometryType::eTRIANGLEMESH) + { + const PxTriangleMeshGeometry& triGeom = static_cast(shape.getGeometry()); + const Gu::TriangleMesh* mesh = static_cast(triGeom.triangleMesh); + return mesh->getSdfDataFast().mSdf != NULL && mesh->getMass() < 0.f; + } + return false; + } + + PX_FORCE_INLINE static bool isDynamicMesh(const PxGeometry& geom) + { + const PxTriangleMeshGeometry& triGeom = static_cast(geom); + const Gu::TriangleMesh* mesh = static_cast(triGeom.triangleMesh); + return mesh->getSdfDataFast().mSdf != NULL && mesh->getMass() > 0.f; + } + + PX_FORCE_INLINE static bool isSimGeom(const PxShape& shape) + { + const PxGeometryType::Enum t = shape.getGeometryType(); + return t != PxGeometryType::ePLANE && t != PxGeometryType::eHEIGHTFIELD && t != PxGeometryType::eTETRAHEDRONMESH && + (t != PxGeometryType::eTRIANGLEMESH || isDynamicMesh(shape.getGeometry())); + } +} + +template +bool NpRigidBodyTemplate::attachShape(PxShape& shape) +{ + NP_WRITE_CHECK(RigidActorTemplateClass::getNpScene()); + PX_CHECK_AND_RETURN_VAL(!(shape.getFlags() & PxShapeFlag::eSIMULATION_SHAPE) + || !hasNegativeMass(shape) + || isKinematic(), + "attachShape: The faces of the mesh are oriented the wrong way round leading to a negative mass. Please invert the orientation of all faces and try again.", false); + + PX_CHECK_AND_RETURN_VAL(!(shape.getFlags() & PxShapeFlag::eSIMULATION_SHAPE) + || isSimGeom(shape) + || isKinematic(), + "attachShape: non-SDF triangle mesh, tetrahedron mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for non-kinematic PxRigidDynamic instances.", false); + + return RigidActorTemplateClass::attachShape(shape); +} + +template +void NpRigidBodyTemplate::setCMassLocalPoseInternal(const PxTransform& body2Actor) +{ + //the point here is to change the mass distribution w/o changing the actors' pose in the world + + const PxTransform newBody2World = getGlobalPose() * body2Actor; + + scSetBody2World(newBody2World); + + // PT: TODO: assert & PVD update already done in scSetBody2World... + { + PX_ASSERT(!RigidActorTemplateClass::isAPIWriteForbidden()); + mCore.setBody2Actor(body2Actor); + UPDATE_PVD_PROPERTY_BODY + } + + RigidActorTemplateClass::updateShaderComs(); + +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, cMassLocalPose, *actor, body2Actor) +#endif +} + +template +PxTransform NpRigidBodyTemplate::getCMassLocalPose() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return mCore.getBody2Actor(); +} + +template +void NpRigidBodyTemplate::setMass(PxReal mass) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(mass), "PxRigidBody::setMass(): invalid float"); + PX_CHECK_AND_RETURN(mass>=0, "PxRigidBody::setMass(): mass must be non-negative!"); + PX_CHECK_AND_RETURN(this->getType() != PxActorType::eARTICULATION_LINK || mass > 0.0f, "PxRigidBody::setMass(): components must be > 0 for articulations"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMass() not allowed while simulation is running. Call will be ignored.") + + mCore.setInverseMass(mass > 0.0f ? 1.0f/mass : 0.0f); + + UPDATE_PVD_PROPERTY_BODY + +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, mass, *actor, mass) +#endif +} + +template +PxReal NpRigidBodyTemplate::getMass() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + const PxReal invMass = mCore.getInverseMass(); + + return invMass > 0.0f ? 1.0f/invMass : 0.0f; +} + +template +PxReal NpRigidBodyTemplate::getInvMass() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return mCore.getInverseMass(); +} + +template +void NpRigidBodyTemplate::setMassSpaceInertiaTensor(const PxVec3& m) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(m.isFinite(), "PxRigidBody::setMassSpaceInertiaTensor(): invalid inertia"); + PX_CHECK_AND_RETURN(m.x>=0.0f && m.y>=0.0f && m.z>=0.0f, "PxRigidBody::setMassSpaceInertiaTensor(): components must be non-negative"); + PX_CHECK_AND_RETURN(this->getType() != PxActorType::eARTICULATION_LINK || (m.x > 0.0f && m.y > 0.0f && m.z > 0.0f), "PxRigidBody::setMassSpaceInertiaTensor(): components must be > 0 for articulations"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMassSpaceInertiaTensor() not allowed while simulation is running. Call will be ignored.") + + mCore.setInverseInertia(invertDiagInertia(m)); + UPDATE_PVD_PROPERTY_BODY + +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, massSpaceInertiaTensor, *actor, m) +#endif +} + +template +PxVec3 NpRigidBodyTemplate::getMassSpaceInertiaTensor() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return invertDiagInertia(mCore.getInverseInertia()); +} + +template +PxVec3 NpRigidBodyTemplate::getMassSpaceInvInertiaTensor() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return mCore.getInverseInertia(); +} + +template +PxVec3 NpRigidBodyTemplate::getLinearVelocity() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(RigidActorTemplateClass::getNpScene(), "PxRigidBody::getLinearVelocity() not allowed while simulation is running (except during PxScene::collide()).", PxVec3(PxZero)); + + return mCore.getLinearVelocity(); +} + +template +PxVec3 NpRigidBodyTemplate::getAngularVelocity() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(RigidActorTemplateClass::getNpScene(), "PxRigidBody::getAngularVelocity() not allowed while simulation is running (except during PxScene::collide()).", PxVec3(PxZero)); + + return mCore.getAngularVelocity(); +} + +template +void NpRigidBodyTemplate::addSpatialForce(const PxVec3* force, const PxVec3* torque, PxForceMode::Enum mode) +{ + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + switch (mode) + { + case PxForceMode::eFORCE: + { + PxVec3 linAcc, angAcc; + if (force) + { + linAcc = (*force) * mCore.getInverseMass(); + force = &linAcc; + } + if (torque) + { + angAcc = scGetGlobalInertiaTensorInverse() * (*torque); + torque = &angAcc; + } + scAddSpatialAcceleration(force, torque); + } + break; + + case PxForceMode::eACCELERATION: + scAddSpatialAcceleration(force, torque); + break; + + case PxForceMode::eIMPULSE: + { + PxVec3 linVelDelta, angVelDelta; + if (force) + { + linVelDelta = ((*force) * mCore.getInverseMass()); + force = &linVelDelta; + } + if (torque) + { + angVelDelta = (scGetGlobalInertiaTensorInverse() * (*torque)); + torque = &angVelDelta; + } + scAddSpatialVelocity(force, torque); + } + break; + + case PxForceMode::eVELOCITY_CHANGE: + scAddSpatialVelocity(force, torque); + break; + } +} + +template +void NpRigidBodyTemplate::setSpatialForce(const PxVec3* force, const PxVec3* torque, PxForceMode::Enum mode) +{ + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + switch (mode) + { + case PxForceMode::eFORCE: + { + PxVec3 linAcc, angAcc; + if (force) + { + linAcc = (*force) * mCore.getInverseMass(); + force = &linAcc; + } + if (torque) + { + angAcc = scGetGlobalInertiaTensorInverse() * (*torque); + torque = &angAcc; + } + scSetSpatialAcceleration(force, torque); + } + break; + + case PxForceMode::eACCELERATION: + scSetSpatialAcceleration(force, torque); + break; + + case PxForceMode::eIMPULSE: + { + PxVec3 linVelDelta, angVelDelta; + if (force) + { + linVelDelta = ((*force) * mCore.getInverseMass()); + force = &linVelDelta; + } + if (torque) + { + angVelDelta = (scGetGlobalInertiaTensorInverse() * (*torque)); + torque = &angVelDelta; + } + scAddSpatialVelocity(force, torque); + } + break; + + case PxForceMode::eVELOCITY_CHANGE: + scAddSpatialVelocity(force, torque); + break; + } +} + +template +void NpRigidBodyTemplate::clearSpatialForce(PxForceMode::Enum mode, bool force, bool torque) +{ + PX_ASSERT(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + switch (mode) + { + case PxForceMode::eFORCE: + case PxForceMode::eACCELERATION: + scClearSpatialAcceleration(force, torque); + break; + case PxForceMode::eIMPULSE: + case PxForceMode::eVELOCITY_CHANGE: + scClearSpatialVelocity(force, torque); + break; + } +} + +#if PX_ENABLE_DEBUG_VISUALIZATION +template +void NpRigidBodyTemplate::visualize(PxRenderOutput& out, NpScene& scene, float scale) const +{ + RigidActorTemplateClass::visualize(out, scene, scale); + + visualizeRigidBody(out, scene, *this, mCore, scale); +} +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +template +PX_FORCE_INLINE void NpRigidBodyTemplate::setRigidBodyFlagsInternal(const PxRigidBodyFlags& currentFlags, const PxRigidBodyFlags& newFlags) +{ + PxRigidBodyFlags filteredNewFlags = newFlags; + //Test to ensure we are not enabling both CCD and kinematic state on a body. This is unsupported + if((filteredNewFlags & PxRigidBodyFlag::eENABLE_CCD) && (filteredNewFlags & PxRigidBodyFlag::eKINEMATIC)) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxRigidBody::setRigidBodyFlag(): kinematic bodies with CCD enabled are not supported! CCD will be ignored."); + filteredNewFlags &= PxRigidBodyFlags(~PxRigidBodyFlag::eENABLE_CCD); + } + + NpScene* scene = RigidActorTemplateClass::getNpScene(); + Sc::Scene* scScene = scene ? &scene->getScScene() : NULL; + + const bool isKinematic = currentFlags & PxRigidBodyFlag::eKINEMATIC; + const bool willBeKinematic = filteredNewFlags & PxRigidBodyFlag::eKINEMATIC; + const bool kinematicSwitchingToDynamic = isKinematic && (!willBeKinematic); + const bool dynamicSwitchingToKinematic = (!isKinematic) && willBeKinematic; + + bool mustUpdateSQ = false; + + if(kinematicSwitchingToDynamic) + { + NpShapeManager& shapeManager = this->getShapeManager(); + PxU32 nbShapes = shapeManager.getNbShapes(); + NpShape*const* shapes = shapeManager.getShapes(); + bool hasTriangleMesh = false; + for(PxU32 i=0;igetFlags() & PxShapeFlag::eSIMULATION_SHAPE) && (shapes[i]->getGeometryTypeFast()==PxGeometryType::eTRIANGLEMESH || shapes[i]->getGeometryTypeFast()==PxGeometryType::ePLANE || shapes[i]->getGeometryTypeFast()==PxGeometryType::eHEIGHTFIELD)) + { + hasTriangleMesh = true; + break; + } + } + if(hasTriangleMesh) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRigidBody::setRigidBodyFlag(): dynamic meshes/planes/heightfields are not supported!"); + return; + } + + PxTransform bodyTarget; + if ((currentFlags & PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES) && mCore.getKinematicTarget(bodyTarget) && scene) + mustUpdateSQ = true; + + if(scScene) + { + scScene->decreaseNumKinematicsCounter(); + scScene->increaseNumDynamicsCounter(); + } + } + else if (dynamicSwitchingToKinematic) + { + if (this->getType() == PxActorType::eARTICULATION_LINK) + { + //We're an articulation, raise an issue + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRigidBody::setRigidBodyFlag(): kinematic articulation links are not supported!"); + return; + } + + if(scScene) + { + scScene->decreaseNumDynamicsCounter(); + scScene->increaseNumKinematicsCounter(); + } + } + + const bool kinematicSwitchingUseTargetForSceneQuery = isKinematic && willBeKinematic && + ((currentFlags & PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES) != (filteredNewFlags & PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES)); + if (kinematicSwitchingUseTargetForSceneQuery) + { + PxTransform bodyTarget; + if (mCore.getKinematicTarget(bodyTarget) && scene) + mustUpdateSQ = true; + } + + scSetFlags(filteredNewFlags); +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, rigidBodyFlags, *actor, filteredNewFlags) +#endif + + // PT: the SQ update should be done after the scSetFlags() call + if(mustUpdateSQ) + this->getShapeManager().markActorForSQUpdate(scene->getSQAPI(), *this); +} + +template +void NpRigidBodyTemplate::setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setRigidBodyFlag() not allowed while simulation is running. Call will be ignored.") + + const PxRigidBodyFlags currentFlags = mCore.getFlags(); + const PxRigidBodyFlags newFlags = value ? currentFlags | flag : currentFlags & (~PxRigidBodyFlags(flag)); + + setRigidBodyFlagsInternal(currentFlags, newFlags); +} + +template +void NpRigidBodyTemplate::setRigidBodyFlags(PxRigidBodyFlags inFlags) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setRigidBodyFlags() not allowed while simulation is running. Call will be ignored.") + + const PxRigidBodyFlags currentFlags = mCore.getFlags(); + + setRigidBodyFlagsInternal(currentFlags, inFlags); +} + +template +void NpRigidBodyTemplate::setMinCCDAdvanceCoefficient(PxReal minCCDAdvanceCoefficient) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMinCCDAdvanceCoefficient() not allowed while simulation is running. Call will be ignored.") + + mCore.setCCDAdvanceCoefficient(minCCDAdvanceCoefficient); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, minAdvancedCCDCoefficient, *actor, minCCDAdvanceCoefficient) +#endif + +} + +template +PxReal NpRigidBodyTemplate::getMinCCDAdvanceCoefficient() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return mCore.getCCDAdvanceCoefficient(); +} + +template +void NpRigidBodyTemplate::setMaxDepenetrationVelocity(PxReal maxDepenVel) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(maxDepenVel > 0.0f, "PxRigidBody::setMaxDepenetrationVelocity(): maxDepenVel must be greater than zero."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMaxDepenetrationVelocity() not allowed while simulation is running. Call will be ignored.") + + mCore.setMaxPenetrationBias(-maxDepenVel); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, maxDepenetrationVelocity, *actor, maxDepenVel) +#endif +} + +template +PxReal NpRigidBodyTemplate::getMaxDepenetrationVelocity() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return -mCore.getMaxPenetrationBias(); +} + +template +void NpRigidBodyTemplate::setMaxContactImpulse(const PxReal maxImpulse) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(maxImpulse >= 0.f, "PxRigidBody::setMaxContactImpulse(): impulse limit must be greater than or equal to zero."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMaxContactImpulse() not allowed while simulation is running. Call will be ignored.") + + mCore.setMaxContactImpulse(maxImpulse); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, maxContactImpulse, *actor, maxImpulse) +#endif +} + +template +PxReal NpRigidBodyTemplate::getMaxContactImpulse() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return mCore.getMaxContactImpulse(); +} + +template +void NpRigidBodyTemplate::setContactSlopCoefficient(const PxReal contactSlopCoefficient) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(contactSlopCoefficient >= 0.f, "PxRigidBody::setContactSlopCoefficient(): contact slop coefficientmust be greater than or equal to zero."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setContactSlopCoefficient() not allowed while simulation is running. Call will be ignored.") + + mCore.setOffsetSlop(contactSlopCoefficient); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, contactSlopCoefficient, *actor, contactSlopCoefficient) +#endif +} + +template +PxReal NpRigidBodyTemplate::getContactSlopCoefficient() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return mCore.getOffsetSlop(); +} + +template +PxNodeIndex NpRigidBodyTemplate::getInternalIslandNodeIndex() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + return mCore.getInternalIslandNodeIndex(); +} + +template +void NpRigidBodyTemplate::setLinearDamping(PxReal linearDamping) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(linearDamping), "PxRigidBody::setLinearDamping(): invalid float"); + PX_CHECK_AND_RETURN(linearDamping >= 0, "PxRigidBody::setLinearDamping(): The linear damping must be nonnegative!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setLinearDamping() not allowed while simulation is running. Call will be ignored.") + + mCore.setLinearDamping(linearDamping); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, linearDamping, *actor, linearDamping) +#endif +} + +template +PxReal NpRigidBodyTemplate::getLinearDamping() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return mCore.getLinearDamping(); +} + +template +void NpRigidBodyTemplate::setAngularDamping(PxReal angularDamping) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(angularDamping), "PxRigidBody::setAngularDamping(): invalid float"); + PX_CHECK_AND_RETURN(angularDamping>=0, "PxRigidBody::setAngularDamping(): The angular damping must be nonnegative!") + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setAngularDamping() not allowed while simulation is running. Call will be ignored.") + + mCore.setAngularDamping(angularDamping); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, angularDamping, *actor, angularDamping) +#endif +} + +template +PxReal NpRigidBodyTemplate::getAngularDamping() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return mCore.getAngularDamping(); +} + +template +void NpRigidBodyTemplate::setMaxAngularVelocity(PxReal maxAngularVelocity) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(maxAngularVelocity), "PxRigidBody::setMaxAngularVelocity(): invalid float"); + PX_CHECK_AND_RETURN(maxAngularVelocity>=0.0f, "PxRigidBody::setMaxAngularVelocity(): threshold must be non-negative!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMaxAngularVelocity() not allowed while simulation is running. Call will be ignored.") + + mCore.setMaxAngVelSq(maxAngularVelocity * maxAngularVelocity); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, maxAngularVelocity, *actor, maxAngularVelocity) +#endif +} + +template +PxReal NpRigidBodyTemplate::getMaxAngularVelocity() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return PxSqrt(mCore.getMaxAngVelSq()); +} + +template +void NpRigidBodyTemplate::setMaxLinearVelocity(PxReal maxLinearVelocity) +{ + NpScene* npScene = RigidActorTemplateClass::getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(maxLinearVelocity), "PxRigidBody::setMaxLinearVelocity(): invalid float"); + PX_CHECK_AND_RETURN(maxLinearVelocity >= 0.0f, "PxRigidBody::setMaxLinearVelocity(): threshold must be non-negative!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidBody::setMaxLinearVelocity() not allowed while simulation is running. Call will be ignored.") + + mCore.setMaxLinVelSq(maxLinearVelocity * maxLinearVelocity); + UPDATE_PVD_PROPERTY_BODY +#if PX_SUPPORT_OMNI_PVD + PxActor* actor = static_cast(this); + OMNI_PVD_SET(actor, maxLinearVelocity, *actor, maxLinearVelocity) +#endif +} + +template +PxReal NpRigidBodyTemplate::getMaxLinearVelocity() const +{ + NP_READ_CHECK(RigidActorTemplateClass::getNpScene()); + + return PxSqrt(mCore.getMaxLinVelSq()); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp new file mode 100644 index 0000000..f5c2ffe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.cpp @@ -0,0 +1,540 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpRigidDynamic.h" +#include "NpRigidActorTemplateInternal.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +NpRigidDynamic::NpRigidDynamic(const PxTransform& bodyPose) +: NpRigidDynamicT(PxConcreteType::eRIGID_DYNAMIC, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, PxActorType::eRIGID_DYNAMIC, NpType::eBODY, bodyPose) +{} + +NpRigidDynamic::~NpRigidDynamic() +{ +} + +// PX_SERIALIZATION +void NpRigidDynamic::requiresObjects(PxProcessPxBaseCallback& c) +{ + NpRigidDynamicT::requiresObjects(c); +} + +void NpRigidDynamic::preExportDataReset() +{ + NpRigidDynamicT::preExportDataReset(); + if (isKinematic() && getNpScene()) + { + //Restore dynamic data in case the actor is configured as a kinematic. + //otherwise we would loose the data for switching the kinematic actor back to dynamic + //after deserialization. Not necessary if the kinematic is not yet part of + //a scene since the dynamic data will still hold the original values. + mCore.restoreDynamicData(); + } +} + +NpRigidDynamic* NpRigidDynamic::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpRigidDynamic* obj = PX_PLACEMENT_NEW(address, NpRigidDynamic(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpRigidDynamic); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpRigidDynamic::release() +{ + if(releaseRigidActorT(*this)) + { + PX_ASSERT(!isAPIWriteForbidden()); // the code above should return false in that case + NpDestroyRigidDynamic(this); + } +} + +void NpRigidDynamic::setGlobalPose(const PxTransform& pose, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(pose.isSane(), "PxRigidDynamic::setGlobalPose: pose is not valid."); + +#if PX_CHECKED + if(npScene) + npScene->checkPositionSanity(*this, pose, "PxRigidDynamic::setGlobalPose"); +#endif + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setGlobalPose() not allowed while simulation is running. Call will be ignored.") + + const PxTransform newPose = pose.getNormalized(); //AM: added to fix 1461 where users read and write orientations for no reason. + + const PxTransform body2World = newPose * mCore.getBody2Actor(); + scSetBody2World(body2World); + + if(npScene) + mShapeManager.markActorForSQUpdate(npScene->getSQAPI(), *this); + + // invalidate the pruning structure if the actor bounds changed + if(mShapeManager.getPruningStructure()) + { + outputError(__LINE__, "PxRigidDynamic::setGlobalPose: Actor is part of a pruning structure, pruning structure is now invalid!"); + mShapeManager.getPruningStructure()->invalidate(this); + } + + if(npScene && autowake && !(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))) + wakeUpInternal(); +} + +PX_FORCE_INLINE void NpRigidDynamic::setKinematicTargetInternal(const PxTransform& targetPose) +{ + // The target is actor related. Transform to body related target + const PxTransform bodyTarget = targetPose * mCore.getBody2Actor(); + + scSetKinematicTarget(bodyTarget); + + NpScene* scene = getNpScene(); + if((mCore.getFlags() & PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES) && scene) + mShapeManager.markActorForSQUpdate(scene->getSQAPI(), *this); +} + +void NpRigidDynamic::setKinematicTarget(const PxTransform& destination) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(destination.isSane(), "PxRigidDynamic::setKinematicTarget: destination is not valid."); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::setKinematicTarget: Body must be in a scene!"); + PX_CHECK_AND_RETURN((mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::setKinematicTarget: Body must be kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::setKinematicTarget: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + +#if PX_CHECKED + if(npScene) + npScene->checkPositionSanity(*this, destination, "PxRigidDynamic::setKinematicTarget"); +#endif + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::setKinematicTarget() not allowed while simulation is running. Call will be ignored.") + + setKinematicTargetInternal(destination.getNormalized()); +} + +bool NpRigidDynamic::getKinematicTarget(PxTransform& target) const +{ + NP_READ_CHECK(getNpScene()); + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + PxTransform bodyTarget; + if(mCore.getKinematicTarget(bodyTarget)) + { + // The internal target is body related. Transform to actor related target + target = bodyTarget * mCore.getBody2Actor().getInverse(); + return true; + } + } + return false; +} + +void NpRigidDynamic::setCMassLocalPose(const PxTransform& pose) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(pose.isSane(), "PxRigidDynamic::setCMassLocalPose pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setCMassLocalPose() not allowed while simulation is running. Call will be ignored.") + + const PxTransform p = pose.getNormalized(); + + const PxTransform oldBody2Actor = mCore.getBody2Actor(); + + NpRigidDynamicT::setCMassLocalPoseInternal(p); + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + PxTransform bodyTarget; + if(mCore.getKinematicTarget(bodyTarget)) + { + PxTransform actorTarget = bodyTarget * oldBody2Actor.getInverse(); // get old target pose for the actor from the body target + setKinematicTargetInternal(actorTarget); + } + } +} + +void NpRigidDynamic::setLinearVelocity(const PxVec3& velocity, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(velocity.isFinite(), "PxRigidDynamic::setLinearVelocity: velocity is not valid."); + PX_CHECK_AND_RETURN(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::setLinearVelocity: Body must be non-kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::setLinearVelocity: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::setLinearVelocity() not allowed while simulation is running. Call will be ignored.") + + scSetLinearVelocity(velocity); + + if(npScene) + wakeUpInternalNoKinematicTest((!velocity.isZero()), autowake); +} + +void NpRigidDynamic::setAngularVelocity(const PxVec3& velocity, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(velocity.isFinite(), "PxRigidDynamic::setAngularVelocity: velocity is not valid."); + PX_CHECK_AND_RETURN(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::setAngularVelocity: Body must be non-kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::setAngularVelocity: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::setAngularVelocity() not allowed while simulation is running. Call will be ignored.") + + scSetAngularVelocity(velocity); + + if(npScene) + wakeUpInternalNoKinematicTest((!velocity.isZero()), autowake); +} + +void NpRigidDynamic::addForce(const PxVec3& force, PxForceMode::Enum mode, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(force.isFinite(), "PxRigidDynamic::addForce: force is not valid."); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::addForce: Body must be in a scene!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::addForce: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::addForce() not allowed while simulation is running. Call will be ignored.") + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + outputError(__LINE__, "PxRigidDynamic::addForce: Body must be non-kinematic!"); + return; + } + + addSpatialForce(&force, NULL, mode); + + wakeUpInternalNoKinematicTest(!force.isZero(), autowake); +} + +void NpRigidDynamic::setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(force.isFinite(), "PxRigidDynamic::setForceAndTorque: force is not valid."); + PX_CHECK_AND_RETURN(torque.isFinite(), "PxRigidDynamic::setForceAndTorque: torque is not valid."); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::setForceAndTorque: Body must be in a scene!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::setForceAndTorque: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::setForceAndTorque() not allowed while simulation is running. Call will be ignored.") + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + outputError(__LINE__, "PxRigidDynamic::setForceAndTorque: Body must be non-kinematic!"); + return; + } + + setSpatialForce(&force, &torque, mode); + + wakeUpInternalNoKinematicTest(!force.isZero(), true); +} + +void NpRigidDynamic::addTorque(const PxVec3& torque, PxForceMode::Enum mode, bool autowake) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(torque.isFinite(), "PxRigidDynamic::addTorque: torque is not valid."); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::addTorque: Body must be in a scene!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::addTorque: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::addTorque() not allowed while simulation is running. Call will be ignored.") + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + outputError(__LINE__, "PxRigidDynamic::addTorque: Body must be non-kinematic!"); + return; + } + + addSpatialForce(NULL, &torque, mode); + + wakeUpInternalNoKinematicTest(!torque.isZero(), autowake); +} + +void NpRigidDynamic::clearForce(PxForceMode::Enum mode) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::clearForce: Body must be in a scene!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::clearForce: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::clearForce() not allowed while simulation is running. Call will be ignored.") + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + outputError(__LINE__, "PxRigidDynamic::clearForce: Body must be non-kinematic!"); + return; + } + + clearSpatialForce(mode, true, false); +} + +void NpRigidDynamic::clearTorque(PxForceMode::Enum mode) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::clearTorque: Body must be in a scene!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::clearTorque: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::clearTorque() not allowed while simulation is running. Call will be ignored.") + + if(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) + { + outputError(__LINE__, "PxRigidDynamic::clearTorque: Body must be non-kinematic!"); + return; + } + + clearSpatialForce(mode, false, true); +} + +bool NpRigidDynamic::isSleeping() const +{ + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxRigidDynamic::isSleeping: Body must be in a scene.", true); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxRigidDynamic::isSleeping() not allowed while simulation is running.", true); + + return mCore.isSleeping(); +} + +void NpRigidDynamic::setSleepThreshold(PxReal threshold) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(threshold), "PxRigidDynamic::setSleepThreshold: invalid float."); + PX_CHECK_AND_RETURN(threshold>=0.0f, "PxRigidDynamic::setSleepThreshold: threshold must be non-negative!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setSleepThreshold() not allowed while simulation is running. Call will be ignored.") + + OMNI_PVD_SET(actor, sleepThreshold, static_cast(*this), threshold); // @@@ + + mCore.setSleepThreshold(threshold); + UPDATE_PVD_PROPERTY_BODY +} + +PxReal NpRigidDynamic::getSleepThreshold() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getSleepThreshold(); +} + +void NpRigidDynamic::setStabilizationThreshold(PxReal threshold) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(threshold), "PxRigidDynamic::setSleepThreshold: invalid float."); + PX_CHECK_AND_RETURN(threshold>=0.0f, "PxRigidDynamic::setSleepThreshold: threshold must be non-negative!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setStabilizationThreshold() not allowed while simulation is running. Call will be ignored.") + + OMNI_PVD_SET(actor, stabilizationThreshold, static_cast(*this), threshold); // @@@ + + mCore.setFreezeThreshold(threshold); + UPDATE_PVD_PROPERTY_BODY +} + +PxReal NpRigidDynamic::getStabilizationThreshold() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getFreezeThreshold(); +} + +void NpRigidDynamic::setWakeCounter(PxReal wakeCounterValue) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(wakeCounterValue), "PxRigidDynamic::setWakeCounter: invalid float."); + PX_CHECK_AND_RETURN(wakeCounterValue>=0.0f, "PxRigidDynamic::setWakeCounter: wakeCounterValue must be non-negative!"); + PX_CHECK_AND_RETURN(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::setWakeCounter: Body must be non-kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::setWakeCounter: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::setWakeCounter() not allowed while simulation is running. Call will be ignored.") + + scSetWakeCounter(wakeCounterValue); + + OMNI_PVD_SET(actor, wakeCounter, static_cast(*this), wakeCounterValue); // @@@ +} + +PxReal NpRigidDynamic::getWakeCounter() const +{ + NP_READ_CHECK(getNpScene()); + + PX_CHECK_SCENE_API_READ_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "PxRigidDynamic::getWakeCounter() not allowed while simulation is running.", 0.0f); + + return mCore.getWakeCounter(); +} + +void NpRigidDynamic::wakeUp() +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::wakeUp: Body must be in a scene."); + PX_CHECK_AND_RETURN(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::wakeUp: Body must be non-kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::wakeUp: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_EXCEPT_SPLIT_SIM(npScene, "PxRigidDynamic::wakeUp() not allowed while simulation is running. Call will be ignored.") + + scWakeUp(); +} + +void NpRigidDynamic::putToSleep() +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(npScene, "PxRigidDynamic::putToSleep: Body must be in a scene."); + PX_CHECK_AND_RETURN(!(mCore.getFlags() & PxRigidBodyFlag::eKINEMATIC), "PxRigidDynamic::putToSleep: Body must be non-kinematic!"); + PX_CHECK_AND_RETURN(!(mCore.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)), "PxRigidDynamic::putToSleep: Not allowed if PxActorFlag::eDISABLE_SIMULATION is set!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::putToSleep() not allowed while simulation is running. Call will be ignored.") + + scPutToSleep(); +} + +void NpRigidDynamic::setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(positionIters > 0, "PxRigidDynamic::setSolverIterationCounts: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(positionIters <= 255, "PxRigidDynamic::setSolverIterationCounts: positionIters must be no greater than 255!"); + PX_CHECK_AND_RETURN(velocityIters <= 255, "PxRigidDynamic::setSolverIterationCounts: velocityIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.") + + scSetSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff)); + + OMNI_PVD_SET(actor, positionIterations, static_cast(*this), positionIters); // @@@ + OMNI_PVD_SET(actor, velocityIterations, static_cast(*this), velocityIters); // @@@ +} + +void NpRigidDynamic::getSolverIterationCounts(PxU32 & positionIters, PxU32 & velocityIters) const +{ + NP_READ_CHECK(getNpScene()); + + PxU16 x = mCore.getSolverIterationCounts(); + velocityIters = PxU32(x >> 8); + positionIters = PxU32(x & 0xff); +} + +void NpRigidDynamic::setContactReportThreshold(PxReal threshold) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(threshold), "PxRigidDynamic::setContactReportThreshold: invalid float."); + PX_CHECK_AND_RETURN(threshold >= 0.0f, "PxRigidDynamic::setContactReportThreshold: Force threshold must be greater than zero!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidDynamic::setContactReportThreshold() not allowed while simulation is running. Call will be ignored.") + + OMNI_PVD_SET(actor, contactReportThreshold, static_cast(*this), threshold); // @@@ + + mCore.setContactReportThreshold(threshold<0 ? 0 : threshold); + UPDATE_PVD_PROPERTY_BODY +} + +PxReal NpRigidDynamic::getContactReportThreshold() const +{ + NP_READ_CHECK(getNpScene()); + + return mCore.getContactReportThreshold(); +} + +PxU32 physx::NpRigidDynamicGetShapes(NpRigidDynamic& actor, NpShape* const*& shapes, bool* isCompound) +{ + NpShapeManager& sm = actor.getShapeManager(); + shapes = sm.getShapes(); + if(isCompound) + *isCompound = sm.isSqCompound(); + return sm.getNbShapes(); +} + +void NpRigidDynamic::switchToNoSim() +{ + NpActor::scSwitchToNoSim(); + scPutToSleepInternal(); +} + +void NpRigidDynamic::switchFromNoSim() +{ + NpActor::scSwitchFromNoSim(); +} + +void NpRigidDynamic::wakeUpInternalNoKinematicTest(bool forceWakeUp, bool autowake) +{ + NpScene* scene = getNpScene(); + PX_ASSERT(scene); + PxReal wakeCounterResetValue = scene->getWakeCounterResetValueInternal(); + + PxReal wakeCounter = mCore.getWakeCounter(); + + bool needsWakingUp = mCore.isSleeping() && (autowake || forceWakeUp); + if (autowake && (wakeCounter < wakeCounterResetValue)) + { + wakeCounter = wakeCounterResetValue; + needsWakingUp = true; + } + + if (needsWakingUp) + scWakeUpInternal(wakeCounter); +} + +PxRigidDynamicLockFlags NpRigidDynamic::getRigidDynamicLockFlags() const +{ + return mCore.getRigidDynamicLockFlags(); +} + +void NpRigidDynamic::setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxRigidDynamic::setRigidDynamicLockFlags() not allowed while simulation is running. Call will be ignored.") + scSetLockFlags(flags); + + OMNI_PVD_SET(actor, rigidDynamicLockFlags, static_cast(*this), flags); // @@@ +} + +void NpRigidDynamic::setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "PxRigidDynamic::setRigidDynamicLockFlag() not allowed while simulation is running. Call will be ignored.") + PxRigidDynamicLockFlags flags = mCore.getRigidDynamicLockFlags(); + if (value) + flags = flags | flag; + else + flags = flags & (~flag); + + scSetLockFlags(flags); + + OMNI_PVD_SET(actor, rigidDynamicLockFlags, static_cast(*this), flags); // @@@ +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.h new file mode 100644 index 0000000..2d5695c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidDynamic.h @@ -0,0 +1,169 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_RIGID_DYNAMIC_H +#define NP_RIGID_DYNAMIC_H + +#include "common/PxMetaData.h" +#include "PxRigidDynamic.h" +#include "NpRigidBodyTemplate.h" + +namespace physx +{ +typedef NpRigidBodyTemplate NpRigidDynamicT; + +class NpRigidDynamic : public NpRigidDynamicT +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpRigidDynamic(PxBaseFlags baseFlags) : NpRigidDynamicT(baseFlags) {} + + void preExportDataReset(); + virtual void requiresObjects(PxProcessPxBaseCallback& c); + + static NpRigidDynamic* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + virtual ~NpRigidDynamic(); + + //--------------------------------------------------------------------------------- + // PxActor implementation + //--------------------------------------------------------------------------------- + + virtual void release() PX_OVERRIDE; + + //--------------------------------------------------------------------------------- + // PxRigidDynamic implementation + //--------------------------------------------------------------------------------- + + virtual PxActorType::Enum getType() const PX_OVERRIDE { return PxActorType::eRIGID_DYNAMIC; } + + // Pose + virtual void setGlobalPose(const PxTransform& pose, bool autowake) PX_OVERRIDE; + + PX_FORCE_INLINE PxTransform getGlobalPoseFast() const + { + const Sc::BodyCore& body = getCore(); + return body.getBody2World() * body.getBody2Actor().getInverse(); + } + virtual PxTransform getGlobalPose() const PX_OVERRIDE + { + NP_READ_CHECK(getNpScene()); + PX_CHECK_SCENE_API_READ_FORBIDDEN_EXCEPT_COLLIDE_AND_RETURN_VAL(getNpScene(), "PxRigidDynamic::getGlobalPose() not allowed while simulation is running (except during PxScene::collide()).", PxTransform(PxIdentity)); + return getGlobalPoseFast(); + } + + virtual void setKinematicTarget(const PxTransform& destination) PX_OVERRIDE; + virtual bool getKinematicTarget(PxTransform& target) const PX_OVERRIDE; + + // Center of mass pose + virtual void setCMassLocalPose(const PxTransform&) PX_OVERRIDE; + + // Velocity + virtual void setLinearVelocity(const PxVec3&, bool autowake) PX_OVERRIDE; + virtual void setAngularVelocity(const PxVec3&, bool autowake) PX_OVERRIDE; + + // Force/Torque modifiers + virtual void addForce(const PxVec3&, PxForceMode::Enum mode, bool autowake) PX_OVERRIDE; + virtual void clearForce(PxForceMode::Enum mode) PX_OVERRIDE; + virtual void addTorque(const PxVec3&, PxForceMode::Enum mode, bool autowake) PX_OVERRIDE; + virtual void clearTorque(PxForceMode::Enum mode) PX_OVERRIDE; + virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) PX_OVERRIDE; + + // Sleeping + virtual bool isSleeping() const PX_OVERRIDE; + virtual PxReal getSleepThreshold() const PX_OVERRIDE; + virtual void setSleepThreshold(PxReal threshold) PX_OVERRIDE; + virtual PxReal getStabilizationThreshold() const PX_OVERRIDE; + virtual void setStabilizationThreshold(PxReal threshold) PX_OVERRIDE; + virtual void setWakeCounter(PxReal wakeCounterValue) PX_OVERRIDE; + virtual PxReal getWakeCounter() const PX_OVERRIDE; + virtual void wakeUp() PX_OVERRIDE; + virtual void putToSleep() PX_OVERRIDE; + + virtual void setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters) PX_OVERRIDE; + virtual void getSolverIterationCounts(PxU32 & positionIters, PxU32 & velocityIters) const PX_OVERRIDE; + + virtual void setContactReportThreshold(PxReal threshold) PX_OVERRIDE; + virtual PxReal getContactReportThreshold() const PX_OVERRIDE; + + virtual PxRigidDynamicLockFlags getRigidDynamicLockFlags() const PX_OVERRIDE; + virtual void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) PX_OVERRIDE; + virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) PX_OVERRIDE; + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + NpRigidDynamic(const PxTransform& bodyPose); + + virtual void switchToNoSim() PX_OVERRIDE; + virtual void switchFromNoSim() PX_OVERRIDE; + + PX_FORCE_INLINE void wakeUpInternal(); + void wakeUpInternalNoKinematicTest(bool forceWakeUp, bool autowake); + + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpRigidDynamic, mCore); } + static PX_FORCE_INLINE size_t getNpShapeManagerOffset() { return PX_OFFSET_OF_RT(NpRigidDynamic, mShapeManager); } + +#if PX_CHECKED + PX_FORCE_INLINE bool checkConstraintValidity() const { return true; } +#endif + +private: + PX_FORCE_INLINE void setKinematicTargetInternal(const PxTransform& destination); + +#if PX_ENABLE_DEBUG_VISUALIZATION +public: + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif +}; + +PX_FORCE_INLINE void NpRigidDynamic::wakeUpInternal() +{ + PX_ASSERT(getNpScene()); + + const Sc::BodyCore& body = getCore(); + + const PxRigidBodyFlags currentFlags = body.getFlags(); + + if (!(currentFlags & PxRigidBodyFlag::eKINEMATIC)) // kinematics are only awake when a target is set, else they are asleep + wakeUpInternalNoKinematicTest(false, true); +} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp new file mode 100644 index 0000000..40b30f0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.cpp @@ -0,0 +1,138 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpRigidStatic.h" +#include "NpRigidActorTemplateInternal.h" + +using namespace physx; + +NpRigidStatic::NpRigidStatic(const PxTransform& pose) : + NpRigidStaticT (PxConcreteType::eRIGID_STATIC, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eRIGID_STATIC), + mCore (pose) +{ +} + +NpRigidStatic::~NpRigidStatic() +{ +} + +// PX_SERIALIZATION +void NpRigidStatic::requiresObjects(PxProcessPxBaseCallback& c) +{ + NpRigidStaticT::requiresObjects(c); +} + +NpRigidStatic* NpRigidStatic::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpRigidStatic* obj = PX_PLACEMENT_NEW(address, NpRigidStatic(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpRigidStatic); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +void NpRigidStatic::release() +{ + if(releaseRigidActorT(*this)) + { + PX_ASSERT(!isAPIWriteForbidden()); // the code above should return false in that case + NpDestroyRigidActor(this); + } +} + +void NpRigidStatic::setGlobalPose(const PxTransform& pose, bool /*wake*/) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(pose.isSane(), "PxRigidStatic::setGlobalPose: pose is not valid."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxRigidStatic::setGlobalPose() not allowed while simulation is running. Call will be ignored.") + +#if PX_CHECKED + if(npScene) + npScene->checkPositionSanity(*this, pose, "PxRigidStatic::setGlobalPose"); +#endif + + const PxTransform newPose = pose.getNormalized(); //AM: added to fix 1461 where users read and write orientations for no reason. + + mCore.setActor2World(newPose); + UPDATE_PVD_PROPERTY + + if(npScene) + mShapeManager.markActorForSQUpdate(npScene->getSQAPI(), *this); + + // invalidate the pruning structure if the actor bounds changed + if(mShapeManager.getPruningStructure()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxRigidStatic::setGlobalPose: Actor is part of a pruning structure, pruning structure is now invalid!"); + mShapeManager.getPruningStructure()->invalidate(this); + } + + updateShaderComs(); +} + +PxTransform NpRigidStatic::getGlobalPose() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getActor2World(); +} + +PxU32 physx::NpRigidStaticGetShapes(NpRigidStatic& rigid, NpShape* const *&shapes) +{ + NpShapeManager& sm = rigid.getShapeManager(); + shapes = sm.getShapes(); + return sm.getNbShapes(); +} + +void NpRigidStatic::switchToNoSim() +{ + NpActor::scSwitchToNoSim(); +} + +void NpRigidStatic::switchFromNoSim() +{ + NpActor::scSwitchFromNoSim(); +} + +#if PX_CHECKED +bool NpRigidStatic::checkConstraintValidity() const +{ + // Perhaps NpConnectorConstIterator would be worth it... + NpConnectorIterator iter = (const_cast(this))->getConnectorIterator(NpConnectorType::eConstraint); + while (PxBase* ser = iter.getNext()) + { + NpConstraint* c = static_cast(ser); + if(!c->NpConstraint::isValid()) + return false; + } + return true; +} +#endif + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.h new file mode 100644 index 0000000..26f12d9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpRigidStatic.h @@ -0,0 +1,101 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_RIGID_STATIC_H +#define NP_RIGID_STATIC_H + +#include "common/PxMetaData.h" +#include "PxRigidStatic.h" +#include "NpRigidActorTemplate.h" +#include "ScStaticCore.h" + +namespace physx +{ +typedef NpRigidActorTemplate NpRigidStaticT; + +class NpRigidStatic : public NpRigidStaticT +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpRigidStatic(PxBaseFlags baseFlags) : NpRigidStaticT(baseFlags), mCore(PxEmpty) {} + void preExportDataReset() { NpRigidStaticT::preExportDataReset(); } + virtual void requiresObjects(PxProcessPxBaseCallback& c); + static NpRigidStatic* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + NpRigidStatic(const PxTransform& pose); + virtual ~NpRigidStatic(); + + // PxActor + virtual void release() PX_OVERRIDE; + virtual PxActorType::Enum getType() const PX_OVERRIDE { return PxActorType::eRIGID_STATIC; } + //~PxActor + + // PxRigidActor + virtual void setGlobalPose(const PxTransform& pose, bool wake) PX_OVERRIDE; + + virtual PxTransform getGlobalPose() const PX_OVERRIDE; + + //~PxRigidActor + + + // PT: I think these come from NpRigidActorTemplate + // PT: TODO: drop them eventually, they all re-route to NpActor now + virtual void switchToNoSim() PX_OVERRIDE; + virtual void switchFromNoSim() PX_OVERRIDE; + +#if PX_CHECKED + bool checkConstraintValidity() const; +#endif + + PX_FORCE_INLINE const Sc::StaticCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::StaticCore& getCore() { return mCore; } + + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpRigidStatic, mCore); } + static PX_FORCE_INLINE size_t getNpShapeManagerOffset() { return PX_OFFSET_OF_RT(NpRigidStatic, mShapeManager); } + +#if PX_ENABLE_DEBUG_VISUALIZATION + void visualize(PxRenderOutput& out, NpScene& scene, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +private: + Sc::StaticCore mCore; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp new file mode 100644 index 0000000..d6bb5cf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.cpp @@ -0,0 +1,4855 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpScene.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationTendon.h" +#include "NpArticulationSensor.h" +#include "NpAggregate.h" +#if PX_SUPPORT_GPU_PHYSX + #include "NpSoftBody.h" + #include "NpParticleSystem.h" + #include "NpFEMCloth.h" + #include "NpHairSystem.h" + #include "cudamanager/PxCudaContextManager.h" + #include "cudamanager/PxCudaContext.h" +#endif +#include "ScArticulationSim.h" +#include "ScArticulationTendonSim.h" +#include "CmCollection.h" +#include "PxsSimulationController.h" +#include "common/PxProfileZone.h" +#include "BpBroadPhase.h" +#include "BpAABBManagerBase.h" + +using namespace physx; + +// enable thread checks in all debug builds +#if PX_DEBUG || PX_CHECKED + #define NP_ENABLE_THREAD_CHECKS 1 +#else + #define NP_ENABLE_THREAD_CHECKS 0 +#endif + +using namespace Sq; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_PVD + #define CREATE_PVD_INSTANCE(obj) \ + { \ + if(mScenePvdClient.checkPvdDebugFlag()) \ + { \ + PX_PROFILE_ZONE("PVD.createPVDInstance", mScene.getContextId());\ + mScenePvdClient.createPvdInstance(obj); \ + } \ + } + #define RELEASE_PVD_INSTANCE(obj) \ + { \ + if(mScenePvdClient.checkPvdDebugFlag()) \ + { \ + PX_PROFILE_ZONE("PVD.releasePVDInstance", mScene.getContextId());\ + mScenePvdClient.releasePvdInstance(obj); \ + } \ + } + #define UPDATE_PVD_PROPERTIES(obj) \ + { \ + if(mScenePvdClient.checkPvdDebugFlag()) \ + { \ + PX_PROFILE_ZONE("PVD.updatePVDProperties", mScene.getContextId());\ + mScenePvdClient.updatePvdProperties(obj); \ + } \ + } + #define PVD_ORIGIN_SHIFT(shift) \ + { \ + if(mScenePvdClient.checkPvdDebugFlag()) \ + { \ + PX_PROFILE_ZONE("PVD.originShift", mScene.getContextId());\ + mScenePvdClient.originShift(shift); \ + } \ + } +#else + #define CREATE_PVD_INSTANCE(obj) {} + #define RELEASE_PVD_INSTANCE(obj) {} + #define UPDATE_PVD_PROPERTIES(obj) {} + #define PVD_ORIGIN_SHIFT(shift){} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE bool removeFromSceneCheck(NpScene* npScene, PxScene* scene, const char* name) +{ + if(scene == static_cast(npScene)) + return true; + else + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "%s not assigned to scene or assigned to another scene. Call will be ignored!", name); +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_OMNI_PVD +static void SleepingStateChanged(PxActor* actor, bool sleeping) +{ + OMNI_PVD_SET(actor, isSleeping, *actor, sleeping) +} +#endif + +NpScene::NpScene(const PxSceneDesc& desc, NpPhysics& physics) : + mNpSQ (desc, +#if PX_SUPPORT_PVD + &mScenePvdClient, +#else + NULL, +#endif + getContextId()), + mSceneQueriesStaticPrunerUpdate (getContextId(), 0, "NpScene.sceneQueriesStaticPrunerUpdate"), + mSceneQueriesDynamicPrunerUpdate(getContextId(), 0, "NpScene.sceneQueriesDynamicPrunerUpdate"), + mRigidDynamics ("sceneRigidDynamics"), + mRigidStatics ("sceneRigidStatics"), + mArticulations ("sceneArticulations"), + mAggregates ("sceneAggregates"), + mSanityBounds (desc.sanityBounds), + mNbClients (1), //we always have the default client. + mSceneCompletion (getContextId(), mPhysicsDone), + mCollisionCompletion (getContextId(), mCollisionDone), + mSceneQueriesCompletion (getContextId(), mSceneQueriesDone), + mSceneExecution (getContextId(), 0, "NpScene.execution"), + mSceneCollide (getContextId(), 0, "NpScene.collide"), + mSceneAdvance (getContextId(), 0, "NpScene.solve"), + mStaticBuildStepHandle (NULL), + mDynamicBuildStepHandle (NULL), + mControllingSimulation (false), + mIsAPIReadForbidden (false), + mIsAPIWriteForbidden (false), + mSimThreadStackSize (0), + mConcurrentWriteCount (0), + mConcurrentReadCount (0), + mConcurrentErrorCount (0), + mCurrentWriter (0), + mSQUpdateRunning (false), + mHasSimulatedOnce (false), + mBetweenFetchResults (false), + mBuildFrozenActors (false), + mScene (desc, getContextId()), +#if PX_SUPPORT_PVD + mScenePvdClient (*this), +#endif + mWakeCounterResetValue (desc.wakeCounterResetValue), + mPhysics (physics) +{ + mGpuDynamicsConfig = desc.gpuDynamicsConfig; + mSceneQueriesStaticPrunerUpdate.setObject(this); + mSceneQueriesDynamicPrunerUpdate.setObject(this); + + mPrunerType[0] = desc.staticStructure; + mPrunerType[1] = desc.dynamicStructure; + + mSceneExecution.setObject(this); + mSceneCollide.setObject(this); + mSceneAdvance.setObject(this); + + mTaskManager = mScene.getTaskManagerPtr(); + mCudaContextManager = mScene.getCudaContextManager(); + + mThreadReadWriteDepth = PxTlsAlloc(); + + updatePhysXIndicator(); + createInOmniPVD(desc); + +#if PX_SUPPORT_OMNI_PVD + if (NpPhysics::getInstance().mOmniPvdSampler) + mScene.mOnSleepingStateChanged = SleepingStateChanged; +#endif +} + +NpScene::~NpScene() +{ + OMNI_PVD_DESTROY(scene, static_cast(*this)) + + // PT: we need to do that one first, now that we don't release the objects anymore. Otherwise we end up with a sequence like: + // - actor is part of an aggregate, and part of a scene + // - actor gets removed from the scene. This does *not* remove it from the aggregate. + // - aggregate gets removed from the scene, sees that one contained actor ain't in the scene => we get a warning message + PxU32 aggregateCount = mAggregates.size(); + while(aggregateCount--) + removeAggregate(*mAggregates.getEntries()[aggregateCount], false); + + PxU32 rigidDynamicCount = mRigidDynamics.size(); + while(rigidDynamicCount--) + removeRigidDynamic(*mRigidDynamics[rigidDynamicCount], false, true); + + PxU32 rigidStaticCount = mRigidStatics.size(); + while(rigidStaticCount--) + removeRigidStatic(*mRigidStatics[rigidStaticCount], false, true); + + PxU32 articCount = mArticulations.size(); + while(articCount--) + removeArticulation(*mArticulations.getEntries()[articCount], false); + +#if PX_SUPPORT_GPU_PHYSX + PxU32 particleCount = mPBDParticleSystems.size(); + while(particleCount--) + removeParticleSystem(*mPBDParticleSystems.getEntries()[particleCount], false); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + particleCount = mFLIPParticleSystems.size(); + while (particleCount--) + removeParticleSystem(*mFLIPParticleSystems.getEntries()[particleCount], false); + + particleCount = mMPMParticleSystems.size(); + while (particleCount--) + removeParticleSystem(*mMPMParticleSystems.getEntries()[particleCount], false); + + particleCount = mCustomParticleSystems.size(); + while (particleCount--) + removeParticleSystem(*mCustomParticleSystems.getEntries()[particleCount], false); +#endif + + PxU32 softBodyCount = mSoftBodies.size(); + while(softBodyCount--) + removeSoftBody(*mSoftBodies.getEntries()[softBodyCount], false); + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxU32 femClothCount = mFEMCloths.size(); + while (femClothCount--) + removeFEMCloth(*mFEMCloths.getEntries()[femClothCount], false); + + PxU32 hairSystemsCount = mHairSystems.size(); + while (hairSystemsCount--) + removeHairSystem(*mHairSystems.getEntries()[hairSystemsCount], false); +#endif +#endif + bool unlock = mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK; + +#if PX_SUPPORT_PVD + mNpSQ.getSingleSqCollector().release(); +#endif + +#if PX_SUPPORT_PVD + mScenePvdClient.releasePvdInstance(); +#endif + mScene.release(); + + // unlock the lock taken in release(), must unlock before + // mRWLock is destroyed otherwise behavior is undefined + if (unlock) + unlockWrite(); + + PxTlsFree(mThreadReadWriteDepth); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::release() +{ + // need to acquire lock for release, note this is unlocked in the destructor + if (mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK) + lockWrite(__FILE__, __LINE__); + + // It will be hard to do a write check here since all object release calls in the scene destructor do it and would mess + // up the test. If we really want it on scene destruction as well, we need to either have internal and external release + // calls or come up with a different approach (for example using thread ID as detector variable). + + if(getSimulationStage() != Sc::SimulationStage::eCOMPLETE) + { + outputError(__LINE__, "PxScene::release(): Scene is still being simulated! PxScene::fetchResults() is called implicitly."); + + if(getSimulationStage() == Sc::SimulationStage::eCOLLIDE) + fetchCollision(true); + + if(getSimulationStage() == Sc::SimulationStage::eFETCHCOLLIDE) // need to call getSimulationStage() again beacause fetchCollision() might change the value. + { + // this is for split sim + advance(NULL); + } + + fetchResults(true, NULL); + } + NpPhysics::getInstance().releaseSceneInternal(*this); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::loadFromDesc(const PxSceneDesc& desc) +{ + if (desc.limits.maxNbBodies) + mRigidDynamics.reserve(desc.limits.maxNbBodies); + + if (desc.limits.maxNbActors) + mRigidStatics.reserve(desc.limits.maxNbActors); // to be consistent with code below (but to match previous interpretation + // it would rather be desc.limits.maxNbActors - desc.limits.maxNbBodies) + + mScene.preAllocate(desc.limits.maxNbActors, desc.limits.maxNbBodies, desc.limits.maxNbStaticShapes, desc.limits.maxNbDynamicShapes); + + userData = desc.userData; + + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setGravity(const PxVec3& g) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setGravity() not allowed while simulation is running. Call will be ignored.") + + mScene.setGravity(g); + + OMNI_PVD_SET(scene, gravity, static_cast(*this), g) + + updatePvdProperties(); +} + +PxVec3 NpScene::getGravity() const +{ + NP_READ_CHECK(this); + return mScene.getGravity(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setBounceThresholdVelocity(const PxReal t) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((t>0.0f), "PxScene::setBounceThresholdVelocity(): threshold value has to be in (0, PX_MAX_F32)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setBounceThresholdVelocity() not allowed while simulation is running. Call will be ignored.") + + mScene.setBounceThresholdVelocity(t); + updatePvdProperties(); + OMNI_PVD_SET(scene, bounceThresholdVelocity, static_cast(*this), t) +} + +PxReal NpScene::getBounceThresholdVelocity() const +{ + NP_READ_CHECK(this) + return mScene.getBounceThresholdVelocity(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setLimits(const PxSceneLimits& limits) +{ + NP_WRITE_CHECK(this); + + if (limits.maxNbBodies) + mRigidDynamics.reserve(limits.maxNbBodies); + + if (limits.maxNbActors) + mRigidStatics.reserve(limits.maxNbActors); // to be consistent with code below (but to match previous interpretation + // it would rather be desc.limits.maxNbActors - desc.limits.maxNbBodies) + + mScene.preAllocate(limits.maxNbActors, limits.maxNbBodies, limits.maxNbStaticShapes, limits.maxNbDynamicShapes); + mScene.setLimits(limits); + + // PT: TODO: there is no guarantee that all simulation shapes will be SQ shapes so this is wrong + getSQAPI().preallocate(PX_SCENE_PRUNER_STATIC, limits.maxNbStaticShapes); + getSQAPI().preallocate(PX_SCENE_PRUNER_DYNAMIC, limits.maxNbDynamicShapes); + + updatePvdProperties(); + + OMNI_PVD_SET(scene, limitsMaxNbActors, static_cast(*this), limits.maxNbActors) + OMNI_PVD_SET(scene, limitsMaxNbBodies, static_cast(*this), limits.maxNbBodies) + OMNI_PVD_SET(scene, limitsMaxNbStaticShapes, static_cast(*this), limits.maxNbStaticShapes) + OMNI_PVD_SET(scene, limitsMaxNbDynamicShapes, static_cast(*this), limits.maxNbDynamicShapes) + OMNI_PVD_SET(scene, limitsMaxNbAggregates, static_cast(*this), limits.maxNbAggregates) + OMNI_PVD_SET(scene, limitsMaxNbConstraints, static_cast(*this), limits.maxNbConstraints) + OMNI_PVD_SET(scene, limitsMaxNbRegions, static_cast(*this), limits.maxNbRegions) + OMNI_PVD_SET(scene, limitsMaxNbBroadPhaseOverlaps, static_cast(*this), limits.maxNbBroadPhaseOverlaps) + + +} + +////////////////////////////////////////////////////////////////////////// + +PxSceneLimits NpScene::getLimits() const +{ + NP_READ_CHECK(this); + + return mScene.getLimits(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setFlag(PxSceneFlag::Enum flag, bool value) +{ + NP_WRITE_CHECK(this); + // this call supports mutable flags only + PX_CHECK_AND_RETURN(PxSceneFlags(flag) & PxSceneFlags(PxSceneFlag::eMUTABLE_FLAGS), "PxScene::setFlag: This flag is not mutable - you can only set it once in PxSceneDesc at startup!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setFlag() not allowed while simulation is running. Call will be ignored.") + + PxSceneFlags currentFlags = mScene.getFlags(); + + if(value) + currentFlags |= flag; + else + currentFlags &= ~PxSceneFlags(flag); + + mScene.setPublicFlags(currentFlags); + const bool pcm = (currentFlags & PxSceneFlag::eENABLE_PCM); + mScene.setPCM(pcm); + const bool contactCache = !(currentFlags & PxSceneFlag::eDISABLE_CONTACT_CACHE); + mScene.setContactCache(contactCache); + updatePvdProperties(); + + OMNI_PVD_SET(scene, flags, static_cast(*this), getFlags()) +} + +PxSceneFlags NpScene::getFlags() const +{ + NP_READ_CHECK(this); + return mScene.getFlags(); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static PX_NOINLINE bool doRigidActorChecks(const actorT& actor, const PruningStructure* ps, const NpScene* scene) +{ + if(!ps && actor.getShapeManager().getPruningStructure()) + return outputError(__LINE__, "PxScene::addActors(): actor is in a pruning structure and cannot be added to a scene directly, use addActors(const PxPruningStructure& )"); + + if(actor.getNpScene()) + return outputError(__LINE__, "PxScene::addActors(): Actor already assigned to a scene. Call will be ignored!"); + +#if PX_CHECKED + if(!actor.checkConstraintValidity()) + return outputError(__LINE__, "PxScene::addActors(): actor has invalid constraint and may not be added to scene"); + + scene->checkPositionSanity(actor, actor.getGlobalPose(), "PxScene::addActors"); +#else + PX_UNUSED(scene); +#endif + return true; +} + +// PT: make sure we always add to array and set the array index properly / at the same time +template +static PX_FORCE_INLINE void addRigidActorToArray(T& a, PxArray& rigidActors, Cm::IDPool& idPool) +{ + a.setRigidActorArrayIndex(rigidActors.size()); + rigidActors.pushBack(&a); + + a.setRigidActorSceneIndex(idPool.getNewID()); +} + +bool NpScene::addActor(PxActor& actor, const PxBVH* bvh) +{ + PX_PROFILE_ZONE("API.addActor", getContextId()); + + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::addActor() not allowed while simulation is running. Call will be ignored.", false) + + PX_SIMD_GUARD; + + NpScene* scene = NpActor::getFromPxActor(actor).getNpScene(); + if (scene) + return outputError(__LINE__, "PxScene::addActor(): Actor already assigned to a scene. Call will be ignored!"); + + return addActorInternal(actor, bvh); +} + +bool NpScene::addActorInternal(PxActor& actor, const PxBVH* bvh) +{ + if(bvh) + { + PxRigidActor* ra = &static_cast(actor); + if(!ra || bvh->getNbBounds() == 0 || bvh->getNbBounds() > ra->getNbShapes()) + return outputError(__LINE__, "PxRigidActor::setBVH: BVH is empty or does not match shapes in the actor."); + } + + PxType type = actor.getConcreteType(); + switch (type) + { + case (PxConcreteType::eRIGID_STATIC): + { + NpRigidStatic& npStatic = static_cast(actor); + if (!doRigidActorChecks(npStatic, NULL, this)) + return false; + + return addRigidStatic(npStatic, static_cast(bvh)); + } + case (PxConcreteType::eRIGID_DYNAMIC): + { + NpRigidDynamic& npDynamic = static_cast(actor); + if (!doRigidActorChecks(npDynamic, NULL, this)) + return false; + + return addRigidDynamic(npDynamic, static_cast(bvh)); + } + case (PxConcreteType::eARTICULATION_LINK): + { + return outputError(__LINE__, "PxScene::addActor(): Individual articulation links can not be added to the scene"); + } +#if PX_SUPPORT_GPU_PHYSX + case (PxConcreteType::eSOFT_BODY): + { + return addSoftBody(static_cast(actor)); + } + case (PxConcreteType::eFEM_CLOTH): + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return addFEMCloth(static_cast(actor)); +#else + return false; +#endif + } + case (PxConcreteType::ePBD_PARTICLESYSTEM): + case (PxConcreteType::eFLIP_PARTICLESYSTEM): + case (PxConcreteType::eMPM_PARTICLESYSTEM): + case (PxConcreteType::eCUSTOM_PARTICLESYSTEM): + { + return addParticleSystem(static_cast(actor)); + } + case (PxConcreteType::eHAIR_SYSTEM): + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return addHairSystem(static_cast(actor)); +#else + return false; +#endif + } +#endif + default: + PX_ASSERT(false); // should not happen + return false; + } +} + +static void updateScStateAndSetupSq(NpScene* scene, PxSceneQuerySystem& sqManager, NpActor& npActor, const PxRigidActor& actor, NpShapeManager& shapeManager, bool actorDynamic, const PxBounds3* bounds, const PruningStructure* ps) +{ + npActor.setNpScene(scene); + NpShape*const * shapes = shapeManager.getShapes(); + PxU32 nbShapes = shapeManager.getNbShapes(); + + for(PxU32 i=0;isetSceneIfExclusive(scene); + + shapeManager.setupAllSceneQuery(sqManager, npActor, actor, ps, bounds, actorDynamic); +} + +bool NpScene::addActors(PxActor*const* actors, PxU32 nbActors) +{ + return addActorsInternal(actors, nbActors, NULL); +} + +bool NpScene::addActors(const PxPruningStructure& ps) +{ + const PruningStructure& prunerStructure = static_cast(ps); + if(!prunerStructure.isValid()) + return outputError(__LINE__, "PxScene::addActors(): Provided pruning structure is not valid."); + + return addActorsInternal(prunerStructure.getActors(), prunerStructure.getNbActors(), &prunerStructure); +} + +///////////// + +bool NpScene::addActorsInternal(PxActor*const* PX_RESTRICT actors, PxU32 nbActors, const PruningStructure* ps) +{ + NP_WRITE_CHECK(this); + PX_PROFILE_ZONE("API.addActors", getContextId()); + + PX_SIMD_GUARD; + + if(getSimulationStage() != Sc::SimulationStage::eCOMPLETE) + return outputError(__LINE__, "PxScene::addActors() not allowed while simulation is running. Call will be ignored."); + + Sc::Scene& scScene = mScene; + PxU32 actorsDone; + + Sc::BatchInsertionState scState; + scScene.startBatchInsertion(scState); + + scState.staticActorOffset = ptrdiff_t(NpRigidStatic::getCoreOffset()); + scState.staticShapeTableOffset = ptrdiff_t(NpRigidStatic::getNpShapeManagerOffset() + NpShapeManager::getShapeTableOffset()); + scState.dynamicActorOffset = ptrdiff_t(NpRigidDynamic::getCoreOffset()); + scState.dynamicShapeTableOffset = ptrdiff_t(NpRigidDynamic::getNpShapeManagerOffset() + NpShapeManager::getShapeTableOffset()); + scState.shapeOffset = ptrdiff_t(NpShape::getCoreOffset()); + + PxInlineArray shapeBounds; + for(actorsDone=0; actorsDonegetConcreteType(); + if(type == PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic& a = *static_cast(actors[actorsDone]); + if(!doRigidActorChecks(a, ps, this)) + break; + + if(!(a.getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))) + { + shapeBounds.resizeUninitialized(a.NpRigidStatic::getNbShapes()+1); // PT: +1 for safe reads in addPrunerData/inflateBounds + scScene.addStatic(&a, scState, shapeBounds.begin()); + // PT: must call this one before doing SQ calls + addRigidActorToArray(a, mRigidStatics, mRigidActorIndexPool); + updateScStateAndSetupSq(this, getSQAPI(), a, a, a.getShapeManager(), false, shapeBounds.begin(), ps); + a.addConstraintsToScene(); + } + else + addRigidStatic(a, NULL, ps); + } + else if(type == PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic& a = *static_cast(actors[actorsDone]); + if(!doRigidActorChecks(a, ps, this)) + break; + + if(!(a.getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))) + { + shapeBounds.resizeUninitialized(a.NpRigidDynamic::getNbShapes()+1); // PT: +1 for safe reads in addPrunerData/inflateBounds + scScene.addBody(&a, scState, shapeBounds.begin(), false); + // PT: must call this one before doing SQ calls + addRigidActorToArray(a, mRigidDynamics, mRigidActorIndexPool); + updateScStateAndSetupSq(this, getSQAPI(), a, a, a.getShapeManager(), true, shapeBounds.begin(), ps); + a.addConstraintsToScene(); + } + else + addRigidDynamic(a, NULL, ps); + } + else + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::addActors(): Batch addition is not permitted for this actor type, aborting at index %u!", actorsDone); + break; + } + } + // merge sq PrunerStructure + if(ps) + { + getSQAPI().merge(*ps); + } + + scScene.finishBatchInsertion(scState); + + // if we failed, still complete everything for the successful inserted actors before backing out +#if PX_SUPPORT_PVD + for(PxU32 i=0;igetConcreteType()==PxConcreteType::eRIGID_STATIC) && (!(static_cast(actors[i])->getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))) + mScenePvdClient.addStaticAndShapesToPvd(*static_cast(actors[i])); + else if ((actors[i]->getConcreteType() == PxConcreteType::eRIGID_DYNAMIC) && (!(static_cast(actors[i])->getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))) + mScenePvdClient.addBodyAndShapesToPvd(*static_cast(actors[i])); + } +#endif + + if(actorsDone +static PX_FORCE_INLINE void removeFromRigidActorListT(T& rigidActor, PxArray& rigidActorList, Cm::IDPool& idPool) +{ + const PxU32 index = rigidActor.getRigidActorArrayIndex(); + PX_ASSERT(index != 0xFFFFFFFF); + PX_ASSERT(index < rigidActorList.size()); + + const PxU32 size = rigidActorList.size() - 1; + rigidActorList.replaceWithLast(index); + if (size && size != index) + { + T& swappedActor = *rigidActorList[index]; + swappedActor.setRigidActorArrayIndex(index); + } + + idPool.freeID(rigidActor.getRigidActorSceneIndex()); + rigidActor.setRigidActorSceneIndex(NP_UNUSED_BASE_INDEX); +} + +// PT: TODO: inline this one in the header for consistency +void NpScene::removeFromRigidDynamicList(NpRigidDynamic& rigidDynamic) +{ + removeFromRigidActorListT(rigidDynamic, mRigidDynamics, mRigidActorIndexPool); +} + +// PT: TODO: inline this one in the header for consistency +void NpScene::removeFromRigidStaticList(NpRigidStatic& rigidStatic) +{ + removeFromRigidActorListT(rigidStatic, mRigidStatics, mRigidActorIndexPool); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static void removeActorT(NpScene* npScene, ActorT& actor, PxArray& actors, bool wakeOnLostTouch) +{ + const PxActorFlags actorFlags = actor.getCore().getActorFlags(); + + if(actor.getShapeManager().getNbShapes()) + PxPrefetch(actor.getShapeManager().getShapes()[0],sizeof(NpShape)); + PxPrefetch(actors[actors.size()-1],sizeof(ActorT)); + + const bool noSim = actorFlags.isSet(PxActorFlag::eDISABLE_SIMULATION); + if (!noSim) + actor.removeConstraintsFromScene(); + + actor.getShapeManager().teardownAllSceneQuery(npScene->getSQAPI(), actor); + + npScene->scRemoveActor(actor, wakeOnLostTouch, noSim); + removeFromRigidActorListT(actor, actors, npScene->mRigidActorIndexPool); + + OMNI_PVD_REMOVE(scene, actors, static_cast(*npScene), static_cast(actor)) +} + +void NpScene::removeActors(PxActor*const* PX_RESTRICT actors, PxU32 nbActors, bool wakeOnLostTouch) +{ + PX_PROFILE_ZONE("API.removeActors", getContextId()); + NP_WRITE_CHECK(this); + + Sc::Scene& scScene = mScene; + // resize the bitmap so it does not allocate each remove actor call + scScene.resizeReleasedBodyIDMaps(mRigidDynamics.size() + mRigidStatics.size(), nbActors); + Sc::BatchRemoveState removeState; + scScene.setBatchRemove(&removeState); + + for(PxU32 actorsDone=0; actorsDonegetConcreteType(); + if(!removeFromSceneCheck(this, actors[actorsDone]->getScene(), "PxScene::removeActors(): Actor")) + break; + + removeState.bufferedShapes.clear(); + removeState.removedShapes.clear(); + + if(type == PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic& actor = *static_cast(actors[actorsDone]); + removeActorT(this, actor, mRigidStatics, wakeOnLostTouch); + } + else if(type == PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic& actor = *static_cast(actors[actorsDone]); + removeActorT(this, actor, mRigidDynamics, wakeOnLostTouch); + } + else + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::removeActor(): Batch removal is not supported for this actor type, aborting at index %u!", actorsDone); + break; + } + } + + scScene.setBatchRemove(NULL); +} + +void NpScene::removeActor(PxActor& actor, bool wakeOnLostTouch) +{ + if(0) // PT: repro for PX-1999 + { + PxActor* toRemove = &actor; + removeActors(&toRemove, 1, wakeOnLostTouch); + return; + } + + PX_PROFILE_ZONE("API.removeActor", getContextId()); + NP_WRITE_CHECK(this); + + if(removeFromSceneCheck(this, actor.getScene(), "PxScene::removeActor(): Actor")) + removeActorInternal(actor, wakeOnLostTouch, true); +} + +void NpScene::removeActorInternal(PxActor& actor, bool wakeOnLostTouch, bool removeFromAggregate) +{ + switch(actor.getType()) + { + case PxActorType::eRIGID_STATIC: + { + NpRigidStatic& npStatic = static_cast(actor); + removeRigidStatic(npStatic, wakeOnLostTouch, removeFromAggregate); + } + break; + + case PxActorType::eRIGID_DYNAMIC: + { + NpRigidDynamic& npDynamic = static_cast(actor); + removeRigidDynamic(npDynamic, wakeOnLostTouch, removeFromAggregate); + } + break; + + case PxActorType::eARTICULATION_LINK: + { + outputError(__LINE__, "PxScene::removeActor(): Individual articulation links can not be removed from the scene"); + } + break; + +#if PX_SUPPORT_GPU_PHYSX + case PxActorType::eSOFTBODY: + { + NpSoftBody& npSoftBody = static_cast(actor); + removeSoftBody(npSoftBody, wakeOnLostTouch); + } + break; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + case PxActorType::eFEMCLOTH: + { + NpFEMCloth& npFEMCloth= static_cast(actor); + removeFEMCloth(npFEMCloth, wakeOnLostTouch); + } + break; +#endif + case PxActorType::ePBD_PARTICLESYSTEM: + { + PxPBDParticleSystem& npParticleSystem = static_cast(actor); + removeParticleSystem(npParticleSystem, wakeOnLostTouch); + } + break; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + case PxActorType::eFLIP_PARTICLESYSTEM: + { + PxFLIPParticleSystem& npParticleSystem = static_cast(actor); + removeParticleSystem(npParticleSystem, wakeOnLostTouch); + } + break; + + case PxActorType::eMPM_PARTICLESYSTEM: + { + PxMPMParticleSystem& npParticleSystem = static_cast(actor); + removeParticleSystem(npParticleSystem, wakeOnLostTouch); + } + break; + + case PxActorType::eCUSTOM_PARTICLESYSTEM: + { + PxCustomParticleSystem& npParticleSystem = static_cast(actor); + removeParticleSystem(npParticleSystem, wakeOnLostTouch); + } + break; + case PxActorType::eHAIRSYSTEM: + { + NpHairSystem& npHairSystem = static_cast(actor); + removeHairSystem(npHairSystem, wakeOnLostTouch); + } + break; +#endif +#endif + default: + PX_ASSERT(0); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static PX_FORCE_INLINE bool addRigidActorT(T& rigidActor, PxArray& rigidActorList, NpScene* scene, const BVH* bvh, const PruningStructure* ps) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(scene, "PxScene::addActor() not allowed while simulation is running. Call will be ignored.", false) + +#if PX_CHECKED + if (!scene->getScScene().isUsingGpuDynamics()) + { + for (PxU32 i = 0; i < rigidActor.getShapeManager().getNbShapes(); ++i) + { + const NpShape* shape = rigidActor.getShapeManager().getShapes()[i]; + const PxGeometryType::Enum t = shape->getGeometryType(); + if (t == PxGeometryType::eTRIANGLEMESH) + { + const PxTriangleMeshGeometry& triGeom = static_cast(shape->getGeometry()); + if (triGeom.triangleMesh->getSDF() != NULL) + { + return outputError(__LINE__, "PxScene::addRigidActor(): Rigid actors with SDFs are currently only supported with GPU-accelerated scenes!"); + } + } + } + } +#endif + + const bool isNoSimActor = rigidActor.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION); + + PxBounds3 bounds[8+1]; // PT: +1 for safe reads in addPrunerData/inflateBounds + const bool canReuseBounds = !isNoSimActor && rigidActor.getShapeManager().getNbShapes()<=8; + PxBounds3* uninflatedBounds = canReuseBounds ? bounds : NULL; + + scene->scAddActor(rigidActor, isNoSimActor, uninflatedBounds, bvh); + + // PT: must call this one before doing SQ calls + addRigidActorToArray(rigidActor, rigidActorList, scene->mRigidActorIndexPool); + + // PT: SQ_CODEPATH1 + rigidActor.getShapeManager().setupAllSceneQuery(scene->getSQAPI(), rigidActor, ps, uninflatedBounds, bvh); + if(!isNoSimActor) + rigidActor.addConstraintsToScene(); + + OMNI_PVD_ADD(scene, actors, static_cast(*scene), static_cast(rigidActor)) + + return true; +} + +bool NpScene::addRigidStatic(NpRigidStatic& actor, const BVH* bvh, const PruningStructure* ps) +{ + return addRigidActorT(actor, mRigidStatics, this, bvh, ps); +} + +bool NpScene::addRigidDynamic(NpRigidDynamic& body, const BVH* bvh, const PruningStructure* ps) +{ + return addRigidActorT(body, mRigidDynamics, this, bvh, ps); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static PX_FORCE_INLINE void removeRigidActorT(T& rigidActor, NpScene* scene, bool wakeOnLostTouch, bool removeFromAggregate) +{ + PX_ASSERT(rigidActor.getNpScene() == scene); + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(scene, "PxScene::removeActor() not allowed while simulation is running. Call will be ignored.") + + const bool isNoSimActor = rigidActor.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION); + + if(removeFromAggregate) + { + PxU32 index = 0xffffffff; + NpAggregate* aggregate = rigidActor.getNpAggregate(index); + if(aggregate) + { + aggregate->removeActorAndReinsert(rigidActor, false); + PX_ASSERT(!rigidActor.getAggregate()); + } + } + + rigidActor.getShapeManager().teardownAllSceneQuery(scene->getSQAPI(), rigidActor); + if(!isNoSimActor) + rigidActor.removeConstraintsFromScene(); + + scene->scRemoveActor(rigidActor, wakeOnLostTouch, isNoSimActor); + scene->removeFromRigidActorList(rigidActor); + + OMNI_PVD_REMOVE(scene, actors, static_cast(*scene), static_cast(rigidActor)) +} + +void NpScene::removeRigidStatic(NpRigidStatic& actor, bool wakeOnLostTouch, bool removeFromAggregate) +{ + removeRigidActorT(actor, this, wakeOnLostTouch, removeFromAggregate); +} + +void NpScene::removeRigidDynamic(NpRigidDynamic& body, bool wakeOnLostTouch, bool removeFromAggregate) +{ + removeRigidActorT(body, this, wakeOnLostTouch, removeFromAggregate); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::addArticulation(PxArticulationReducedCoordinate& articulation) +{ + PX_PROFILE_ZONE("API.addArticulation", getContextId()); + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN_VAL(articulation.getNbLinks()>0, "PxScene::addArticulation: Empty articulations may not be added to a scene.", false); + + NpArticulationReducedCoordinate& npa = static_cast(articulation); + // check that any tendons are not empty +#if PX_CHECKED + for(PxU32 i = 0u; i < articulation.getNbFixedTendons(); ++i) + { + PX_CHECK_AND_RETURN_VAL(npa.getFixedTendon(i)->getNbTendonJoints() > 0u, "PxScene::addArticulation: Articulations with empty fixed tendons may not be added to a scene.", false) + } + for(PxU32 i = 0u; i < articulation.getNbSpatialTendons(); ++i) + { + PX_CHECK_AND_RETURN_VAL(npa.getSpatialTendon(i)->getNbAttachments() > 0u, "PxScene::addArticulation: Articulations with empty spatial tendons may not be added to a scene.", false) + } +#endif + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::addArticulation() not allowed while simulation is running. Call will be ignored.", false); + + PX_SIMD_GUARD; + + if(this->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS && articulation.getConcreteType() != PxConcreteType::eARTICULATION_REDUCED_COORDINATE) + return outputError(__LINE__, "PxScene::addArticulation(): Only Reduced coordinate articulations are currently supported when PxSceneFlag::eENABLE_GPU_DYNAMICS is set!"); + + if(getSimulationStage() != Sc::SimulationStage::eCOMPLETE && articulation.getConcreteType() == PxConcreteType::eARTICULATION_REDUCED_COORDINATE) + return outputError(__LINE__, "PxScene::addArticulation(): this call is not allowed while the simulation is running. Call will be ignored!"); + + if(!npa.getNpScene()) + return addArticulationInternal(articulation); + else + return outputError(__LINE__, "PxScene::addArticulation(): Articulation already assigned to a scene. Call will be ignored!"); +} + +static void checkArticulationLink(NpScene* scene, NpArticulationLink* link) +{ +#if PX_CHECKED + scene->checkPositionSanity(*link, link->getGlobalPose(), "PxScene::addArticulation or PxScene::addAggregate"); +#else + PX_UNUSED(scene); +#endif + if(link->getMass()==0.0f) + { + outputError(__LINE__, "PxScene::addArticulation(): Articulation link with zero mass added to scene; defaulting mass to 1"); + link->setMass(1.0f); + } + + const PxVec3 inertia0 = link->getMassSpaceInertiaTensor(); + if(inertia0.x == 0.0f || inertia0.y == 0.0f || inertia0.z == 0.0f) + { + outputError(__LINE__, "PxScene::addArticulation(): Articulation link with zero moment of inertia added to scene; defaulting inertia to (1,1,1)"); + link->setMassSpaceInertiaTensor(PxVec3(1.0f, 1.0f, 1.0f)); + } +} + +bool NpScene::addSpatialTendonInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim) +{ + const PxU32 nbTendons = npaRC->getNbSpatialTendons(); + + PxU32 maxAttachments = 0; + for (PxU32 i = 0; i < nbTendons; ++i) + { + NpArticulationSpatialTendon* tendon = npaRC->getSpatialTendon(i); + + const PxU32 numAttachments = tendon->getNbAttachments(); + + maxAttachments = PxMax(numAttachments, maxAttachments); + } + + PxU32 stackSize = 1; + // Add spatial tendons + PX_ALLOCA(attachementStack, NpArticulationAttachment*, maxAttachments); + + for (PxU32 i = 0; i < nbTendons; ++i) + { + NpArticulationSpatialTendon* tendon = npaRC->getSpatialTendon(i); + + //addTendon(npaRC->getImpl(), *tendon); + scAddArticulationSpatialTendon(*tendon); + + //add tendon sim to articulation sim + Sc::ArticulationSpatialTendonSim* tendonSim = tendon->getTendonCore().getSim(); + scArtSim->addTendon(tendonSim); + + const PxU32 numAttachments = tendon->getNbAttachments(); + + NpArticulationAttachment* attchment = tendon->getAttachment(0); + + NpArticulationLink* pLink = static_cast(attchment->mLink); + + Sc::ArticulationAttachmentCore& lcore = attchment->getCore(); + lcore.mLLLinkIndex = pLink->getLinkIndex(); + + tendonSim->addAttachment(lcore); + + attachementStack[0] = attchment; + PxU32 curAttachment = 0; + stackSize = 1; + while (curAttachment < (numAttachments - 1)) + { + PX_ASSERT(curAttachment < stackSize); + NpArticulationAttachment* p = attachementStack[curAttachment]; + + const PxU32 numChildrens = p->getNumChildren(); + + NpArticulationAttachment*const* children = p->getChildren(); + + for (PxU32 j = 0; j < numChildrens; j++) + { + NpArticulationAttachment* child = children[j]; + + NpArticulationLink* cLink = static_cast(child->mLink); + + Sc::ArticulationAttachmentCore& cCore = child->getCore(); + cCore.mLLLinkIndex = cLink->getLinkIndex(); + + tendonSim->addAttachment(cCore); + + attachementStack[stackSize] = child; + stackSize++; + } + + curAttachment++; + } + } + return true; +} + +bool NpScene::addFixedTendonInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim) +{ + const PxU32 nbFixedTendons = npaRC->getNbFixedTendons(); + + PxU32 maxTendonJoints = 0; + for (PxU32 i = 0; i < nbFixedTendons; ++i) + { + NpArticulationFixedTendon* tendon = npaRC->getFixedTendon(i); + + const PxU32 numTendonJoints = tendon->getNbTendonJoints(); + + maxTendonJoints = PxMax(numTendonJoints, maxTendonJoints); + } + + PxU32 stackSize = 1; + // Add fixed tendon joint + PX_ALLOCA(tendonJointStack, NpArticulationTendonJoint*, maxTendonJoints); + + for (PxU32 i = 0; i < nbFixedTendons; ++i) + { + NpArticulationFixedTendon* tendon = npaRC->getFixedTendon(i); + + //addTendon(npaRC->getImpl(), *tendon); + scAddArticulationFixedTendon(*tendon); + + //add tendon sim to articulation sim + Sc::ArticulationFixedTendonSim* tendonSim = tendon->getTendonCore().getSim(); + scArtSim->addTendon(tendonSim); + + const PxU32 numTendonJoints = tendon->getNbTendonJoints(); + + NpArticulationTendonJoint* tendonJoint = tendon->getTendonJoint(0); + + NpArticulationLink* pLink = static_cast(tendonJoint->mLink); + + Sc::ArticulationTendonJointCore& lcore = tendonJoint->getCore(); + lcore.mLLLinkIndex = pLink->getLinkIndex(); + + //add parent joint + tendonSim->addTendonJoint(lcore); + + tendonJointStack[0] = tendonJoint; + + PxU32 curTendonJoint = 0; + stackSize = 1; + while (curTendonJoint < (numTendonJoints - 1)) + { + PX_ASSERT(curTendonJoint < stackSize); + NpArticulationTendonJoint* p = tendonJointStack[curTendonJoint]; + + const PxU32 numChildrens = p->getNumChildren(); + + NpArticulationTendonJoint*const* children = p->getChildren(); + + for (PxU32 j = 0; j < numChildrens; j++) + { + NpArticulationTendonJoint* child = children[j]; + + NpArticulationLink* cLink = static_cast(child->mLink); + + Sc::ArticulationTendonJointCore& cCore = child->getCore(); + cCore.mLLLinkIndex = cLink->getLinkIndex(); + + tendonSim->addTendonJoint(cCore); + + tendonJointStack[stackSize] = child; + stackSize++; + } + + curTendonJoint++; + } + } + return true; +} + +bool NpScene::addArticulationSensorInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim) +{ + const PxU32 nbSensors = npaRC->getNbSensors(); + + for (PxU32 i = 0; i < nbSensors; ++i) + { + NpArticulationSensor* sensor = npaRC->getSensor(i); + + scAddArticulationSensor(*sensor); + + //add tendon sim to articulation sim + Sc::ArticulationSensorSim* sensorSim = sensor->getSensorCore().getSim(); + scArtSim->addSensor(sensorSim, sensor->getLink()->getLinkIndex()); + } + return true; +} + +bool NpScene::addArticulationInternal(PxArticulationReducedCoordinate& npa) +{ + // Add root link first + const PxU32 nbLinks = npa.getNbLinks(); + PX_ASSERT(nbLinks > 0); + NpArticulationReducedCoordinate& npaRC = static_cast(npa); + NpArticulationLink* rootLink = static_cast(npaRC.getRoot()); + + checkArticulationLink(this, rootLink); + + bool linkTriggersWakeUp = !rootLink->scCheckSleepReadinessBesidesWakeCounter(); + + addArticulationLinkBody(*rootLink); + + // Add articulation + scAddArticulation(npaRC); + + if (npaRC.mTopologyChanged) + { + //increase cache version + npaRC.mCacheVersion++; + npaRC.mTopologyChanged = false; + } + + Sc::ArticulationCore& scArtCore = npaRC.getCore(); + Sc::ArticulationSim* scArtSim = scArtCore.getSim(); + + PxU32 handle = scArtSim->findBodyIndex(*rootLink->getCore().getSim()); + rootLink->setLLIndex(handle); + + rootLink->setInboundJointDof(0); + + addArticulationLinkConstraint(*rootLink); + + // Add links & joints + PX_ALLOCA(linkStack, NpArticulationLink*, nbLinks); + linkStack[0] = rootLink; + + PxU32 curLink = 0; + PxU32 stackSize = 1; + while(curLink < (nbLinks-1)) + { + PX_ASSERT(curLink < stackSize); + NpArticulationLink* l = linkStack[curLink]; + NpArticulationLink*const* children = l->getChildren(); + + for(PxU32 i=0; i < l->getNbChildren(); i++) + { + NpArticulationLink* child = children[i]; + + NpArticulationJointReducedCoordinate* joint = static_cast(child->getInboundJoint()); + Sc::ArticulationJointCore& jCore = joint->getCore(); + + jCore.getCore().jointDirtyFlag = Dy::ArticulationJointCoreDirtyFlag::eALL; + + checkArticulationLink(this, child); + + linkTriggersWakeUp = linkTriggersWakeUp || (!child->scCheckSleepReadinessBesidesWakeCounter()); + + addArticulationLink(*child); // Adds joint too + + //child->setInboundJointDof(scArtSim->getDof(child->getLinkIndex())); + + linkStack[stackSize] = child; + stackSize++; + } + + curLink++; + } + + //create low-level tendons + addSpatialTendonInternal(&npaRC, scArtSim); + + addFixedTendonInternal(&npaRC, scArtSim); + + addArticulationSensorInternal(&npaRC, scArtSim); + + scArtSim->createLLStructure(); + + if ((scArtCore.getWakeCounter() == 0.0f) && linkTriggersWakeUp) + { + //The articulation needs to wake up, if one of the links triggers activation. + npaRC.wakeUpInternal(true, false); + } + + mArticulations.insert(&npa); + + //add loop joints + + if ((scArtCore.getArticulationFlags() & PxArticulationFlag::eFIX_BASE)) + { + rootLink->setKinematicLink(true); + } + //This method will prepare link data for the gpu + mScene.addArticulationSimControl(scArtCore); + const PxU32 maxLinks = mScene.getMaxArticulationLinks(); + if (maxLinks < nbLinks) + mScene.setMaxArticulationLinks(nbLinks); + + for (PxU32 i = 0; i < npaRC.mLoopJoints.size(); ++i) + { + Sc::ConstraintSim* cSim = npaRC.mLoopJoints[i]->getCore().getSim(); + scArtSim->addLoopConstraint(cSim); + } + + scArtSim->initializeConfiguration(); + + npaRC.updateKinematic(PxArticulationKinematicFlag::ePOSITION | PxArticulationKinematicFlag::eVELOCITY); + + if (scArtSim) + { + //scArtSim->checkResize(); + + linkStack[0] = rootLink; + curLink = 0; + stackSize = 1; + + while (curLink < (nbLinks - 1)) + { + PX_ASSERT(curLink < stackSize); + NpArticulationLink* l = linkStack[curLink]; + NpArticulationLink*const* children = l->getChildren(); + + for (PxU32 i = 0; i < l->getNbChildren(); i++) + { + NpArticulationLink* child = children[i]; + + child->setInboundJointDof(scArtSim->getDof(child->getLinkIndex())); + + NpArticulationJointReducedCoordinate* joint = static_cast(child->getInboundJoint()); + + PxArticulationJointType::Enum jointType = joint->getJointType(); + + if (jointType == PxArticulationJointType::eUNDEFINED) + { +#if PX_CHECKED + outputError(__LINE__, "PxScene::addArticulation(): The application need to set joint type. defaulting joint type to eFix"); +#endif + joint->scSetJointType(PxArticulationJointType::eFIX); + child->setInboundJointDof(0); + } + + if (jointType != PxArticulationJointType::eFIX) + { + + PxArticulationMotion::Enum motionX = joint->getMotion(PxArticulationAxis::eX); + PxArticulationMotion::Enum motionY = joint->getMotion(PxArticulationAxis::eY); + PxArticulationMotion::Enum motionZ = joint->getMotion(PxArticulationAxis::eZ); + + PxArticulationMotion::Enum motionSwing1 = joint->getMotion(PxArticulationAxis::eSWING1); + PxArticulationMotion::Enum motionSwing2 = joint->getMotion(PxArticulationAxis::eSWING2); + PxArticulationMotion::Enum motionTwist = joint->getMotion(PxArticulationAxis::eTWIST); + + //PxArticulationMotion::eLOCKED is 0 + if (!(motionX | motionY | motionZ | motionSwing1 | motionSwing2 | motionTwist)) + { + //if all axis are locked, which means the user doesn't set the motion. In this case, we should change the joint type to be + //fix to avoid crash in the solver +#if PX_CHECKED + outputError(__LINE__, "PxScene::addArticulation(): The application need to set joint motion. defaulting joint type to eFix"); +#endif + joint->scSetJointType(PxArticulationJointType::eFIX); + child->setInboundJointDof(0); + } + } + + + linkStack[stackSize] = child; + stackSize++; + } + + curLink++; + } + } + + OMNI_PVD_ADD(scene, articulations, static_cast(*this), static_cast(npa)); + OMNI_PVD_SET(articulation, dofs, static_cast(npa), npa.getDofs()); + + return true; +} + +void NpScene::removeArticulation(PxArticulationReducedCoordinate& articulation, bool wakeOnLostTouch) +{ + PX_PROFILE_ZONE("API.removeArticulation", getContextId()); + NP_WRITE_CHECK(this); + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::removeArticulation() not allowed while simulation is running. Call will be ignored.") + + if(removeFromSceneCheck(this, articulation.getScene(), "PxScene::removeArticulation(): Articulation")) + removeArticulationInternal(articulation, wakeOnLostTouch, true); +} + +void NpScene::removeArticulationInternal(PxArticulationReducedCoordinate& pxa, bool wakeOnLostTouch, bool removeFromAggregate) +{ + + NpArticulationReducedCoordinate& npArticulation = static_cast(pxa); + + PxU32 nbLinks = npArticulation.getNbLinks(); + PX_ASSERT(nbLinks > 0); + + if(removeFromAggregate && npArticulation.getAggregate()) + { + static_cast(npArticulation.getAggregate())->removeArticulationAndReinsert(npArticulation, false); + PX_ASSERT(!npArticulation.getAggregate()); + } + + //!!!AL + // Inefficient. We might want to introduce a LL method to kill the whole LL articulation together with all joints in one go, then + // the order of removing the links/joints does not matter anymore. + + // Remove links & joints + PX_ALLOCA(linkStack, NpArticulationLink*, nbLinks); + linkStack[0] = npArticulation.getLinks()[0]; + PxU32 curLink = 0, stackSize = 1; + + while(curLink < (nbLinks-1)) + { + PX_ASSERT(curLink < stackSize); + NpArticulationLink* l = linkStack[curLink]; + NpArticulationLink*const* children = l->getChildren(); + + for(PxU32 i=0; i < l->getNbChildren(); i++) + { + linkStack[stackSize] = children[i]; + stackSize++; + } + + curLink++; + } + + PxRigidBodyFlags flag; + for(PxI32 j=PxI32(nbLinks); j-- > 0; ) + { + flag |= linkStack[j]->getCore().getCore().mFlags; + removeArticulationLink(*linkStack[j], wakeOnLostTouch); + } + + // Remove tendons (RC checked in method) + removeArticulationTendons(npArticulation); + + //Remove sensors + removeArticulationSensors(npArticulation); + + if (flag & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + { + PxNodeIndex index = npArticulation.getCore().getIslandNodeIndex(); + if (index.isValid()) + mScene.resetSpeculativeCCDArticulationLink(index.index()); + } + + // Remove articulation + scRemoveArticulation(npArticulation); + removeFromArticulationList(npArticulation); + + OMNI_PVD_REMOVE(scene, articulations, static_cast(*this), pxa) + OMNI_PVD_SET(articulation, dofs, pxa, pxa.getDofs()); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::addSoftBody(PxSoftBody& softBody) +{ + if (!(this->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS)) + return outputError(__LINE__, "PxScene::addActor(): Soft bodies can only be simulated by GPU-accelerated scenes!"); + +#if PX_SUPPORT_GPU_PHYSX + if (!softBody.getSimulationMesh()) + return outputError(__LINE__, "PxScene::addActor(): Soft body does not have simulation mesh, will not be added to scene!"); + + // Add soft body + NpSoftBody& npSB = static_cast(softBody); + scAddSoftBody(npSB); + + NpShape* npShape = static_cast(npSB.getShape()); + Sc::ShapeCore* shapeCore = &npShape->getCore(); + npSB.getCore().attachShapeCore(shapeCore); + npSB.getCore().attachSimulationMesh(softBody.getSimulationMesh(), softBody.getSoftBodyAuxData()); + + mSoftBodies.insert(&softBody); + + //for gpu soft body + mScene.addSoftBodySimControl(npSB.getCore()); + return true; +#else + PX_UNUSED(softBody); + return false; +#endif +} + +void NpScene::removeSoftBody(PxSoftBody& softBody, bool /*wakeOnLostTouch*/) +{ +#if PX_SUPPORT_GPU_PHYSX + // Remove soft body + NpSoftBody& npSB = reinterpret_cast(softBody); + scRemoveSoftBody(npSB); + + removeFromSoftBodyList(softBody); +#else + PX_UNUSED(softBody); +#endif +} + +PxU32 NpScene::getNbSoftBodies() const +{ +#if PX_SUPPORT_GPU_PHYSX + NP_READ_CHECK(this); + return mSoftBodies.size(); +#else + return 0; +#endif +} + +PxU32 NpScene::getSoftBodies(PxSoftBody** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ +#if PX_SUPPORT_GPU_PHYSX + NP_READ_CHECK(this); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mSoftBodies.getEntries(), mSoftBodies.size()); +#else + PX_UNUSED(userBuffer); + PX_UNUSED(bufferSize); + PX_UNUSED(startIndex); + return 0; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + +bool NpScene::addFEMCloth(PxFEMCloth& femCloth) +{ + if (!(this->getFlags() & PxSceneFlag::eENABLE_GPU_DYNAMICS)) + return PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::addFEMCloth(): FEM-cloth can only be simulated by GPU-accelerated scenes!"); + +#if PX_SUPPORT_GPU_PHYSX + // Add FEM-cloth + NpFEMCloth& npCloth = static_cast(femCloth); + scAddFEMCloth(this, npCloth); + + NpShape* npShape = static_cast(npCloth.getShape()); + Sc::ShapeCore* shapeCore = &npShape->getCore(); + npCloth.getCore().attachShapeCore(shapeCore); + + mFEMCloths.insert(&femCloth); + + //for gpu FEM-cloth + mScene.addFEMClothSimControl(npCloth.getCore()); + return true; +#else + PX_UNUSED(femCloth); + return false; +#endif +} + +void NpScene::removeFEMCloth(PxFEMCloth& femCloth, bool /*wakeOnLostTouch*/) +{ +#if PX_SUPPORT_GPU_PHYSX + // Remove FEM-cloth + NpFEMCloth& npCloth = reinterpret_cast(femCloth); + scRemoveFEMCloth(npCloth); + + removeFromFEMClothList(femCloth); +#else + PX_UNUSED(femCloth); +#endif +} +#endif + +PxU32 NpScene::getNbFEMCloths() const +{ +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NP_READ_CHECK(this); + return mFEMCloths.size(); +#else + return 0; +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxU32 NpScene::getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ +#if PX_SUPPORT_GPU_PHYSX + NP_READ_CHECK(this); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mFEMCloths.getEntries(), mFEMCloths.size()); +#else + PX_UNUSED(userBuffer); + PX_UNUSED(bufferSize); + PX_UNUSED(startIndex); + return 0; +#endif +} +#else +PxU32 NpScene::getFEMCloths(PxFEMCloth**, PxU32, PxU32) const +{ + return 0; +} +#endif + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::addParticleSystem(PxParticleSystem& particleSystem) +{ + if (!mScene.isUsingGpuDynamicsAndBp()) + return outputError(__LINE__, "PxScene::addActor(): Particle systems only currently supported with GPU-accelerated scenes!"); + +#if PX_SUPPORT_GPU_PHYSX + + switch(particleSystem.getConcreteType()) + { + case PxConcreteType::ePBD_PARTICLESYSTEM: + { + NpPBDParticleSystem& npPS = static_cast(particleSystem); + scAddParticleSystem(npPS); + + PxPBDParticleSystem& pxPs = static_cast(particleSystem); + mPBDParticleSystems.insert(&pxPs); + + mScene.addParticleSystemSimControl(npPS.getCore()); + + return true; + } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + case PxConcreteType::eFLIP_PARTICLESYSTEM: + { + NpFLIPParticleSystem& npPS = static_cast(particleSystem); + scAddParticleSystem(npPS); + + PxFLIPParticleSystem& pxPS = static_cast(particleSystem); + mFLIPParticleSystems.insert(&pxPS); + + mScene.addParticleSystemSimControl(npPS.getCore()); + + return true; + } + + case PxConcreteType::eMPM_PARTICLESYSTEM: + { + NpMPMParticleSystem& npPS = static_cast(particleSystem); + scAddParticleSystem(npPS); + + PxMPMParticleSystem& pxPS = static_cast(particleSystem); + mMPMParticleSystems.insert(&pxPS); + + //for gpu particle system + mScene.addParticleSystemSimControl(npPS.getCore()); + + return true; + } + + case PxConcreteType::eCUSTOM_PARTICLESYSTEM: + { + NpCustomParticleSystem& npPS = static_cast(particleSystem); + scAddParticleSystem(npPS); + + PxCustomParticleSystem& pxPS = static_cast(particleSystem); + mCustomParticleSystems.insert(&pxPS); + + //for gpu particle system + mScene.addParticleSystemSimControl(npPS.getCore()); + + return true; + } +#endif + default: + { + PX_ASSERT(false); + return false; + } + } +#else + PX_UNUSED(particleSystem); + return false; +#endif +} + +void NpScene::removeParticleSystem(PxParticleSystem& particleSystem, bool /*wakeOnLostTouch*/) +{ +#if PX_SUPPORT_GPU_PHYSX + + switch(particleSystem.getConcreteType()) + { + case PxConcreteType::ePBD_PARTICLESYSTEM: + { + // Remove particle system + NpPBDParticleSystem& npPS = reinterpret_cast(particleSystem); + scRemoveParticleSystem(npPS); + + PxPBDParticleSystem& pxPS = static_cast(particleSystem); + removeFromParticleSystemList(pxPS); + return; + } +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + case PxConcreteType::eFLIP_PARTICLESYSTEM: + { + // Remove particle system + NpFLIPParticleSystem& npPS = reinterpret_cast(particleSystem); + scRemoveParticleSystem(npPS); + + PxFLIPParticleSystem& pxPS = static_cast(particleSystem); + removeFromParticleSystemList(pxPS); + return; + } + + case PxConcreteType::eMPM_PARTICLESYSTEM: + { + // Remove particle system + NpMPMParticleSystem& npPS = reinterpret_cast(particleSystem); + scRemoveParticleSystem(npPS); + + PxMPMParticleSystem& pxPS = static_cast(particleSystem); + removeFromParticleSystemList(pxPS); + return; + } + + case PxConcreteType::eCUSTOM_PARTICLESYSTEM: + { + // Remove particle system + NpCustomParticleSystem& npPS = reinterpret_cast(particleSystem); + scRemoveParticleSystem(npPS); + + PxCustomParticleSystem& pxPS = static_cast(particleSystem); + removeFromParticleSystemList(pxPS); + return; + } +#endif + default: + PX_ASSERT(false); + } +#else + PX_UNUSED(particleSystem); +#endif +} + +PxU32 NpScene::getNbParticleSystems(PxParticleSolverType::Enum type) const +{ + NP_READ_CHECK(this); +#if PX_SUPPORT_GPU_PHYSX + + switch (type) + { + case PxParticleSolverType::ePBD: + { + return mPBDParticleSystems.size(); + } + + case PxParticleSolverType::eFLIP: + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return mFLIPParticleSystems.size(); +#else + return 0; +#endif + } + + case PxParticleSolverType::eMPM: + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return mMPMParticleSystems.size(); +#else + return 0; +#endif + } + + case PxParticleSolverType::eCUSTOM: + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return mCustomParticleSystems.size(); +#else + return 0; +#endif + } + default: + { + PX_ASSERT(false); + return 0; + } + + } +#else + PX_UNUSED(type); + return 0; +#endif +} + +PxU32 NpScene::getParticleSystems(PxParticleSolverType::Enum type, PxParticleSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(this); + +#if PX_SUPPORT_GPU_PHYSX + + switch (type) + { + case PxParticleSolverType::ePBD: + { + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mPBDParticleSystems.getEntries(), mPBDParticleSystems.size()); + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + case PxParticleSolverType::eFLIP: + { + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mFLIPParticleSystems.getEntries(), mFLIPParticleSystems.size()); + } + + case PxParticleSolverType::eMPM: + { + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mMPMParticleSystems.getEntries(), mMPMParticleSystems.size()); + } + + case PxParticleSolverType::eCUSTOM: + { + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mCustomParticleSystems.getEntries(), mCustomParticleSystems.size()); + } +#endif + default: + { + PX_ASSERT(false); + return 0; + } + } +#else + PX_UNUSED(type); + PX_UNUSED(userBuffer); + PX_UNUSED(bufferSize); + PX_UNUSED(startIndex); + return 0; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +bool NpScene::addHairSystem(PxHairSystem& hairSystem) +{ + if (!mScene.isUsingGpuDynamicsAndBp()) + { + return outputError(__LINE__, "PxScene::addHairSystem(): Hair systems only currently supported with GPU-accelerated scenes!"); + } + +#if PX_SUPPORT_GPU_PHYSX + NpHairSystem& npHairSystem = static_cast(hairSystem); + scAddHairSystem(npHairSystem); + mHairSystems.insert(&npHairSystem); + mScene.addHairSystemSimControl(npHairSystem.getCore()); + return true; +#else + PX_UNUSED(hairSystem); + return false; +#endif +} + +void NpScene::removeHairSystem(PxHairSystem& hairSystem, bool /*wakeOnLostTouch*/) +{ +#if PX_SUPPORT_GPU_PHYSX + NpHairSystem& npHairSystem = static_cast(hairSystem); + scRemoveHairSystem(npHairSystem); + removeFromHairSystemList(hairSystem); +#else + PX_UNUSED(hairSystem); +#endif +} +#endif + +PxU32 NpScene::getNbHairSystems() const +{ +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NP_READ_CHECK(this); + return mHairSystems.size(); +#else + return 0; +#endif +} + +PxU32 NpScene::getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + NP_READ_CHECK(this); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mHairSystems.getEntries(), mHairSystems.size()); +#else + PX_UNUSED(userBuffer); + PX_UNUSED(bufferSize); + PX_UNUSED(startIndex); + return 0; +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::addArticulationLinkBody(NpArticulationLink& link) +{ + scAddActor(link, false, NULL, NULL); + + link.setRigidActorSceneIndex(mRigidActorIndexPool.getNewID()); + + link.getShapeManager().setupAllSceneQuery(getSQAPI(), link, NULL); +} + +void NpScene::addArticulationLinkConstraint(NpArticulationLink& link) +{ + NpArticulationJointReducedCoordinate* j = static_cast(link.getInboundJoint()); + if (j) + { + scAddArticulationJoint(*j); + } + + link.addConstraintsToScene(); +} + +void NpScene::addArticulationLink(NpArticulationLink& link) +{ + Sc::ArticulationCore& scArtCore = static_cast(link.getArticulation()).getCore(); + Sc::ArticulationSim* scArtSim = scArtCore.getSim(); + + Sc::ArticulationSimDirtyFlags dirtyFlags = scArtSim->getDirtyFlag(); + + addArticulationLinkBody(link); + addArticulationLinkConstraint(link); + + if (scArtSim) + { + PxU32 cHandle = scArtSim->findBodyIndex(*link.getCore().getSim()); + link.setLLIndex(cHandle); + + NpArticulationJointReducedCoordinate* j = static_cast(link.getInboundJoint()); + + j->getCore().setLLIndex(cHandle); + + const bool isDirty = (dirtyFlags & Sc::ArticulationSimDirtyFlag::eUPDATE); + if (j && (!isDirty)) + { + getScScene().addDirtyArticulationSim(scArtSim); + } + } +} + +void NpScene::removeArticulationLink(NpArticulationLink& link, bool wakeOnLostTouch) +{ + NpArticulationJointReducedCoordinate* j = static_cast(link.getInboundJoint()); + + link.removeConstraintsFromScene(); + link.getShapeManager().teardownAllSceneQuery(getSQAPI(), link); + + Sc::ArticulationCore& scArtCore = static_cast(link.getArticulation()).getCore(); + Sc::ArticulationSim* scArtSim = scArtCore.getSim(); + + Sc::ArticulationSimDirtyFlags dirtyFlags = scArtSim->getDirtyFlag(); + + if (j) + { + const bool isDirty = (dirtyFlags & Sc::ArticulationSimDirtyFlag::eUPDATE); + if (!isDirty) + { + getScScene().addDirtyArticulationSim(scArtSim); + } + const PxU32 linkIndex = link.getLinkIndex(); + scArtSim->copyJointStatus(linkIndex); + scRemoveArticulationJoint(*j); + } + + scRemoveActor(link, wakeOnLostTouch, false); + + mRigidActorIndexPool.freeID(link.getRigidActorSceneIndex()); + link.setRigidActorSceneIndex(NP_UNUSED_BASE_INDEX); +} + +//////////////////////////////////////////////////////////////////////////////// +void NpScene::addArticulationAttachment(NpArticulationAttachment& attachment) +{ + Sc::ArticulationSpatialTendonCore& tendonCore = attachment.getTendon().getTendonCore(); + Sc::ArticulationSpatialTendonSim* sim = tendonCore.getSim(); + + if (sim) + { + Sc::ArticulationAttachmentCore& attachmentCore = attachment.getCore(); + attachmentCore.mLLLinkIndex = attachment.mLink->getLinkIndex(); + sim->addAttachment(attachmentCore); + } +} + +void NpScene::removeArticulationAttachment(NpArticulationAttachment& attachment) +{ + Sc::ArticulationSpatialTendonCore& tendonCore = attachment.getTendon().getTendonCore(); + Sc::ArticulationSpatialTendonSim* sim = tendonCore.getSim(); + + if (sim) + { + Sc::ArticulationAttachmentCore& attachmentCore = attachment.getCore(); + sim->removeAttachment(attachmentCore); + } +} + +//////////////////////////////////////////////////////////////////////////////////// + +void NpScene::addArticulationTendonJoint(NpArticulationTendonJoint& tendonJoint) +{ + Sc::ArticulationFixedTendonCore& tendonCore = tendonJoint.getTendon().getTendonCore(); + Sc::ArticulationFixedTendonSim* sim = tendonCore.getSim(); + + if (sim) + { + Sc::ArticulationTendonJointCore& jointCore = tendonJoint.getCore(); + jointCore.mLLLinkIndex = tendonJoint.mLink->getLinkIndex(); + sim->addTendonJoint(jointCore); + } +} + +void NpScene::removeArticulationTendonJoint(NpArticulationTendonJoint& joint) +{ + Sc::ArticulationFixedTendonCore& tendonCore = joint.getTendon().getTendonCore(); + Sc::ArticulationFixedTendonSim* sim = tendonCore.getSim(); + + if (sim) + { + Sc::ArticulationTendonJointCore& jointCore = joint.getCore(); + sim->removeTendonJoint(jointCore); + } +} + +void NpScene::removeArticulationTendons(PxArticulationReducedCoordinate& articulation) +{ + NpArticulationReducedCoordinate* npaRC = static_cast(&articulation); + + // Remove spatial tendons + const PxU32 nbSpatialTendons = npaRC->getNbSpatialTendons(); + + for(PxU32 i = 0; i < nbSpatialTendons; i++) + { + NpArticulationSpatialTendon* tendon = npaRC->getSpatialTendon(i); + + npaRC->removeSpatialTendonInternal(tendon); + } + + //Remove fixed tendons + const PxU32 nbFixedTendons = npaRC->getNbFixedTendons(); + + for(PxU32 i = 0; i < nbFixedTendons; i++) + { + NpArticulationFixedTendon* tendon = npaRC->getFixedTendon(i); + npaRC->removeFixedTendonInternal(tendon); + } +} + +void NpScene::removeArticulationSensors(PxArticulationReducedCoordinate& articulation) +{ + NpArticulationReducedCoordinate* npaRC = static_cast(&articulation); + + //Remove sensors + const PxU32 nbSensors = npaRC->getNbSensors(); + + for (PxU32 i = 0; i < nbSensors; i++) + { + NpArticulationSensor* sensor = npaRC->getSensor(i); + npaRC->removeSensorInternal(sensor); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddAggregate(NpAggregate& agg) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + agg.setNpScene(this); + + const PxU32 aggregateID = mScene.createAggregate(&agg, agg.getMaxNbShapesFast(), agg.getFilterHint()); + agg.setAggregateID(aggregateID); +#if PX_SUPPORT_PVD + //Sending pvd events after all aggregates's actors are inserted into scene + mScenePvdClient.createPvdInstance(&agg); +#endif +} + +void NpScene::scRemoveAggregate(NpAggregate& agg) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + mScene.deleteAggregate(agg.getAggregateID()); + agg.setNpScene(NULL); +#if PX_SUPPORT_PVD + mScenePvdClient.releasePvdInstance(&agg); +#endif +} + +bool NpScene::addAggregate(PxAggregate& aggregate) +{ + PX_PROFILE_ZONE("API.addAggregate", getContextId()); + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::addAggregate() not allowed while simulation is running. Call will be ignored.", false) + + PX_SIMD_GUARD; + + NpAggregate& np = static_cast(aggregate); + + const PxU32 nb = np.getCurrentSizeFast(); +#if PX_CHECKED + for(PxU32 i=0;iis(); + if(a && !static_cast(a)->checkConstraintValidity()) + return outputError(__LINE__, "PxScene::addAggregate(): Aggregate contains an actor with an invalid constraint!"); + } +#endif + + if(mScene.isUsingGpuDynamicsOrBp()) + { + if(np.getMaxNbShapesFast() == PX_MAX_U32) + return outputError(__LINE__, "PxScene::addAggregate(): Aggregates cannot be added to GPU scene unless you provide a maxNbShapes!"); + } + + if(!np.getNpScene()) + { + scAddAggregate(np); + + for(PxU32 i=0;i(NpConnectorType::eBvh, &bvh, 1)) + npActor.removeConnector(actor, NpConnectorType::eBvh, bvh, "PxBVH connector could not have been removed!"); + + np.addActorInternal(actor, *this, bvh); + + // if a bvh was used dec ref count, we increased the ref count when adding the actor connection + if(bvh) + bvh->decRefCount(); + } + + mAggregates.insert(&aggregate); + + OMNI_PVD_ADD(scene, aggregates, static_cast(*this), aggregate); + OMNI_PVD_SET(aggregate, scene, aggregate, static_cast(this)); + + return true; + } + else + return outputError(__LINE__, "PxScene::addAggregate(): Aggregate already assigned to a scene. Call will be ignored!"); +} + +void NpScene::removeAggregate(PxAggregate& aggregate, bool wakeOnLostTouch) +{ + PX_PROFILE_ZONE("API.removeAggregate", getContextId()); + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::removeAggregate() not allowed while simulation is running. Call will be ignored.") + + if(!removeFromSceneCheck(this, aggregate.getScene(), "PxScene::removeAggregate(): Aggregate")) + return; + + NpAggregate& np = static_cast(aggregate); + if(np.getScene()!=this) + return; + + const PxU32 nb = np.getCurrentSizeFast(); + for(PxU32 j=0;jgetType() != PxActorType::eARTICULATION_LINK) + { + NpActor& sc = NpActor::getFromPxActor(*a); + + np.scRemoveActor(sc, false); // This is only here to make sure the aggregateID gets set to invalid + + removeActorInternal(*a, wakeOnLostTouch, false); + } + else if (a->getScene()) + { + NpArticulationLink& al = static_cast(*a); + NpArticulationReducedCoordinate& npArt = static_cast(al.getRoot()); + NpArticulationLink* const* links = npArt.getLinks(); + + for(PxU32 i=0; i < npArt.getNbLinks(); i++) + { + np.scRemoveActor(*links[i], false); // This is only here to make sure the aggregateID gets set to invalid + } + + removeArticulationInternal(npArt, wakeOnLostTouch, false); + } + } + + scRemoveAggregate(np); + + removeFromAggregateList(aggregate); + + OMNI_PVD_REMOVE(scene, aggregates, static_cast(*this), aggregate); + OMNI_PVD_SET(aggregate, scene, aggregate, static_cast(NULL)); +} + +PxU32 NpScene::getNbAggregates() const +{ + NP_READ_CHECK(this); + return mAggregates.size(); +} + +PxU32 NpScene::getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(this); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mAggregates.getEntries(), mAggregates.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scSwitchRigidToNoSim(NpActor& r) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + if(r.getNpScene()) + { + PxInlineArray scShapes; + + const NpType::Enum npType = r.getNpType(); + if(npType==NpType::eRIGID_STATIC) + getScScene().removeStatic(static_cast(r).getCore(), scShapes, true); + else if(npType==NpType::eBODY) + getScScene().removeBody(static_cast(r).getCore(), scShapes, true); + else if(npType==NpType::eBODY_FROM_ARTICULATION_LINK) + getScScene().removeBody(static_cast(r).getCore(), scShapes, true); + else PX_ASSERT(0); + } +} + +void NpScene::scSwitchRigidFromNoSim(NpActor& r) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + if(r.getNpScene()) + { + NpShape* const* shapes; + const size_t shapePtrOffset = NpShape::getCoreOffset(); + PxU32 nbShapes; + { + bool isCompound; + const NpType::Enum npType = r.getNpType(); + if(npType==NpType::eRIGID_STATIC) + { + NpRigidStatic& np = static_cast(r); + nbShapes = NpRigidStaticGetShapes(np, shapes); + getScScene().addStatic(np.getCore(), shapes, nbShapes, shapePtrOffset, NULL); + } + else if(npType==NpType::eBODY) + { + NpRigidDynamic& np = static_cast(r); + nbShapes = NpRigidDynamicGetShapes(np, shapes, &isCompound); + getScScene().addBody(np.getCore(), shapes, nbShapes, shapePtrOffset, NULL, isCompound); + } + else if(npType==NpType::eBODY_FROM_ARTICULATION_LINK) + { + NpArticulationLink& np = static_cast(r); + nbShapes = NpArticulationGetShapes(np, shapes, &isCompound); + getScScene().addBody(np.getCore(), shapes, nbShapes, shapePtrOffset, NULL, isCompound); + } + else + { + nbShapes = 0; + shapes = NULL; + isCompound = false; + PX_ASSERT(0); + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::addCollection(const PxCollection& collection) +{ + PX_PROFILE_ZONE("API.addCollection", getContextId()); + const Cm::Collection& col = static_cast(collection); + + PxU32 nb = col.internalGetNbObjects(); +#if PX_CHECKED + for(PxU32 i=0;iis(); + if(a && !static_cast(a)->checkConstraintValidity()) + return outputError( __LINE__, "PxScene::addCollection(): collection contains an actor with an invalid constraint!"); + } +#endif + + PxArray actorsToInsert; + actorsToInsert.reserve(nb); + + struct Local + { + static void addActorIfNeeded(PxActor* actor, PxArray& actorArray) + { + if(actor->getAggregate()) + return; // The actor will be added when the aggregate is added + actorArray.pushBack(actor); + } + }; + + for(PxU32 i=0;igetConcreteType(); + + //NpArticulationLink, NpArticulationJoint are added with the NpArticulation + //Actors and Articulations that are members of an Aggregate are added with the NpAggregate + + if(serialType==PxConcreteType::eRIGID_DYNAMIC) + { + NpRigidDynamic* np = static_cast(s); + // if pruner structure exists for the actor, actor will be added with the pruner structure + if(!np->getShapeManager().getPruningStructure()) + Local::addActorIfNeeded(np, actorsToInsert); + } + else if(serialType==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* np = static_cast(s); + // if pruner structure exists for the actor, actor will be added with the pruner structure + if(!np->getShapeManager().getPruningStructure()) + Local::addActorIfNeeded(np, actorsToInsert); + } + else if(serialType==PxConcreteType::eSHAPE) + { + } + else if (serialType == PxConcreteType::eARTICULATION_REDUCED_COORDINATE) + { + NpArticulationReducedCoordinate* np = static_cast(s); + if (!np->getAggregate()) // The actor will be added when the aggregate is added + { + addArticulation(static_cast(*np)); + } + } + else if(serialType==PxConcreteType::eAGGREGATE) + { + NpAggregate* np = static_cast(s); + addAggregate(*np); + } + else if(serialType == PxConcreteType::ePRUNING_STRUCTURE) + { + PxPruningStructure* ps = static_cast(s); + addActors(*ps); + } + } + + if(!actorsToInsert.empty()) + addActorsInternal(&actorsToInsert[0], actorsToInsert.size(), NULL); + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 NpScene::getNbActors(PxActorTypeFlags types) const +{ + NP_READ_CHECK(this); + PxU32 nbActors = 0; + + if(types & PxActorTypeFlag::eRIGID_STATIC) + nbActors += mRigidStatics.size(); + + if(types & PxActorTypeFlag::eRIGID_DYNAMIC) + nbActors += mRigidDynamics.size(); + + return nbActors; +} + +static PxU32 getArrayOfPointers_RigidActors(PxActor** PX_RESTRICT userBuffer, PxU32 bufferSize, PxU32 startIndex, + NpRigidStatic*const* PX_RESTRICT src0, PxU32 size0, + NpRigidDynamic*const* PX_RESTRICT src1, PxU32 size1) +{ + // PT: we run the same code as getArrayOfPointers but with a virtual array containing both static & dynamic actors. + const PxU32 size = size0 + size1; + + const PxU32 remainder = PxU32(PxMax(PxI32(size - startIndex), 0)); + const PxU32 writeCount = PxMin(remainder, bufferSize); + for(PxU32 i=0;i(__LINE__, "PxScene::getActiveActors() not allowed while simulation is running. Call will be ignored."); + nbActorsOut = 0; + return NULL; + } +} + +PxActor** NpScene::getFrozenActors(PxU32& nbActorsOut) +{ + NP_READ_CHECK(this); + + if(!isAPIWriteForbidden()) + return mScene.getFrozenActors(nbActorsOut); + else + { + outputError(__LINE__, "PxScene::getFrozenActors() not allowed while simulation is running. Call will be ignored."); + nbActorsOut = 0; + return NULL; + } +} + +void NpScene::setFrozenActorFlag(const bool buildFrozenActors) +{ +#if PX_CHECKED + PxSceneFlags combinedFlag(PxSceneFlag::eENABLE_ACTIVE_ACTORS | PxSceneFlag::eENABLE_STABILIZATION); + + PX_CHECK_AND_RETURN((getFlags() & combinedFlag)== combinedFlag, + "NpScene::setFrozenActorFlag: Cannot raise BuildFrozenActors if PxSceneFlag::eENABLE_STABILIZATION and PxSceneFlag::eENABLE_ACTIVE_ACTORS is not raised!"); +#endif + mBuildFrozenActors = buildFrozenActors; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 NpScene::getNbArticulations() const +{ + NP_READ_CHECK(this); + return mArticulations.size(); +} + +PxU32 NpScene::getArticulations(PxArticulationReducedCoordinate** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(this); + return Cm::getArrayOfPointers(userBuffer, bufferSize, startIndex, mArticulations.getEntries(), mArticulations.size()); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxU32 NpScene::getNbConstraints() const +{ + NP_READ_CHECK(this); + return mScene.getNbConstraints(); +} + +static PX_FORCE_INLINE PxU32 getArrayOfPointers(PxConstraint** PX_RESTRICT userBuffer, PxU32 bufferSize, PxU32 startIndex, Sc::ConstraintCore*const* PX_RESTRICT src, PxU32 size) +{ + const PxU32 remainder = PxU32(PxMax(PxI32(size - startIndex), 0)); + const PxU32 writeCount = PxMin(remainder, bufferSize); + src += startIndex; + for(PxU32 i=0;igetPxConstraint(); + userBuffer[i] = static_cast(pxc); + } + return writeCount; +} + +PxU32 NpScene::getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(this); + return ::getArrayOfPointers(userBuffer, bufferSize, startIndex, mScene.getConstraints(), mScene.getNbConstraints()); +} + +/////////////////////////////////////////////////////////////////////////////// + +const PxRenderBuffer& NpScene::getRenderBuffer() +{ + if (getSimulationStage() != Sc::SimulationStage::eCOMPLETE) + { + // will be reading the Sc::Scene renderable which is getting written + // during the sim, hence, avoid call while simulation is running. + outputError(__LINE__, "PxScene::getRenderBuffer() not allowed while simulation is running. Call will be ignored."); + } + + return mRenderBuffer; +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::getSimulationStatistics(PxSimulationStatistics& s) const +{ + NP_READ_CHECK(this); + + if (getSimulationStage() == Sc::SimulationStage::eCOMPLETE) + { +#if PX_ENABLE_SIM_STATS + mScene.getStats(s); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + PX_UNUSED(s); +#endif + } + else + { + //will be reading data that is getting written during the sim, hence, avoid call while simulation is running. + outputError(__LINE__, "PxScene::getSimulationStatistics() not allowed while simulation is running. Call will be ignored."); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +PxClientID NpScene::createClient() +{ + NP_WRITE_CHECK(this); + + // PT: mNbClients starts at 1, 0 reserved for PX_DEFAULT_CLIENT + const PxClientID clientID = PxClientID(mNbClients); + mNbClients++; + return clientID; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxSolverType::Enum NpScene::getSolverType() const +{ + NP_READ_CHECK(this); + return mScene.getSolverType(); +} + +//FrictionModel + +PxFrictionType::Enum NpScene::getFrictionType() const +{ + NP_READ_CHECK(this); + return mScene.getFrictionType(); +} + +/////////////////////////////////////////////////////////////////////////////// + +// Callbacks + +void NpScene::setSimulationEventCallback(PxSimulationEventCallback* callback) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setSimulationEventCallback() not allowed while simulation is running. Call will be ignored.") + + mScene.setSimulationEventCallback(callback); + updatePvdProperties(); + OMNI_PVD_SET(scene, hasSimulationEventCallback, static_cast(*this), callback ? true : false) +} + +PxSimulationEventCallback* NpScene::getSimulationEventCallback() const +{ + NP_READ_CHECK(this); + return mScene.getSimulationEventCallback(); +} + +void NpScene::setContactModifyCallback(PxContactModifyCallback* callback) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setContactModifyCallback() not allowed while simulation is running. Call will be ignored.") + + mScene.setContactModifyCallback(callback); + updatePvdProperties(); + OMNI_PVD_SET(scene, hasContactModifyCallback, static_cast(*this), callback ? true : false) +} + +PxContactModifyCallback* NpScene::getContactModifyCallback() const +{ + NP_READ_CHECK(this); + return mScene.getContactModifyCallback(); +} + +void NpScene::setCCDContactModifyCallback(PxCCDContactModifyCallback* callback) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setCCDContactModifyCallback() not allowed while simulation is running. Call will be ignored.") + + mScene.setCCDContactModifyCallback(callback); + updatePvdProperties(); + OMNI_PVD_SET(scene, hasCCDContactModifyCallback, static_cast(*this), callback ? true : false) +} + +PxCCDContactModifyCallback* NpScene::getCCDContactModifyCallback() const +{ + NP_READ_CHECK(this); + return mScene.getCCDContactModifyCallback(); +} + +void NpScene::setBroadPhaseCallback(PxBroadPhaseCallback* callback) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setBroadPhaseCallback() not allowed while simulation is running. Call will be ignored.") + + mScene.setBroadPhaseCallback(callback); + updatePvdProperties(); + OMNI_PVD_SET(scene, hasBroadPhaseCallback, static_cast(*this), callback ? true : false) +} + +PxBroadPhaseCallback* NpScene::getBroadPhaseCallback() const +{ + NP_READ_CHECK(this); + return mScene.getBroadPhaseCallback(); +} + +void NpScene::setCCDMaxPasses(PxU32 ccdMaxPasses) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((ccdMaxPasses!=0), "PxScene::setCCDMaxPasses(): ccd max passes cannot be zero!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setCCDMaxPasses() not allowed while simulation is running. Call will be ignored.") + + mScene.setCCDMaxPasses(ccdMaxPasses); + updatePvdProperties(); + OMNI_PVD_SET(scene, ccdMaxPasses, static_cast(*this), ccdMaxPasses) +} + +PxU32 NpScene::getCCDMaxPasses() const +{ + NP_READ_CHECK(this); + return mScene.getCCDMaxPasses(); +} + +void NpScene::setCCDMaxSeparation(const PxReal separation) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((separation>=0.0f), "PxScene::setCCDMaxSeparation(): separation value has to be in [0, PX_MAX_F32)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setCCDMaxSeparation() not allowed while simulation is running. Call will be ignored.") + + mScene.setCCDMaxSeparation(separation); + updatePvdProperties(); + OMNI_PVD_SET(scene, ccdMaxSeparation, static_cast(*this), separation) +} + +PxReal NpScene::getCCDMaxSeparation() const +{ + NP_READ_CHECK(this); + return mScene.getCCDMaxSeparation(); +} + +void NpScene::setCCDThreshold(const PxReal t) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((t>0.0f), "PxScene::setCCDThreshold(): threshold value has to be in [eps, PX_MAX_F32)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setCCDThreshold() not allowed while simulation is running. Call will be ignored.") + + mScene.setCCDThreshold(t); + updatePvdProperties(); + OMNI_PVD_SET(scene, ccdThreshold, static_cast(*this), t) +} + +PxReal NpScene::getCCDThreshold() const +{ + NP_READ_CHECK(this); + return mScene.getCCDThreshold(); +} + +PxBroadPhaseType::Enum NpScene::getBroadPhaseType() const +{ + NP_READ_CHECK(this); + const Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + return bp->getType(); +} + +bool NpScene::getBroadPhaseCaps(PxBroadPhaseCaps& caps) const +{ + NP_READ_CHECK(this); + const Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + bp->getCaps(caps); + return true; +} + +PxU32 NpScene::getNbBroadPhaseRegions() const +{ + NP_READ_CHECK(this); + const Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + return bp->getNbRegions(); +} + +PxU32 NpScene::getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(this); + const Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + return bp->getRegions(userBuffer, bufferSize, startIndex); +} + +PxU32 NpScene::addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion) +{ + PX_PROFILE_ZONE("BroadPhase.addBroadPhaseRegion", getContextId()); + + NP_WRITE_CHECK(this); + PX_CHECK_MSG(region.mBounds.isValid(), "PxScene::addBroadPhaseRegion(): invalid bounds provided!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::addBroadPhaseRegion() not allowed while simulation is running. Call will be ignored.", 0xffffffff) + + if(region.mBounds.isEmpty()) + { + outputError(__LINE__, "PxScene::addBroadPhaseRegion(): region bounds are empty. Call will be ignored."); + return 0xffffffff; + } + + Bp::AABBManagerBase* aabbManager = mScene.getAABBManager(); + Bp::BroadPhase* bp = aabbManager->getBroadPhase(); + return bp->addRegion(region, populateRegion, aabbManager->getBoundsArray().begin(), aabbManager->getContactDistances()); +} + +bool NpScene::removeBroadPhaseRegion(PxU32 handle) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::removeBroadPhaseRegion() not allowed while simulation is running. Call will be ignored.", false) + + Bp::BroadPhase* bp = mScene.getAABBManager()->getBroadPhase(); + return bp->removeRegion(handle); +} + +/////////////////////////////////////////////////////////////////////////////// + +// Filtering +void NpScene::setFilterShaderData(const void* data, PxU32 dataSize) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN(( ((dataSize == 0) && (data == NULL)) || + ((dataSize > 0) && (data != NULL)) ), "PxScene::setFilterShaderData(): data pointer must not be NULL unless the specified data size is 0 too and vice versa."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setFilterShaderData() not allowed while simulation is running. Call will be ignored.") + + mScene.setFilterShaderData(data, dataSize); + updatePvdProperties(); +} + +const void* NpScene::getFilterShaderData() const +{ + NP_READ_CHECK(this); + return mScene.getFilterShaderDataFast(); +} + +PxU32 NpScene::getFilterShaderDataSize() const +{ + NP_READ_CHECK(this); + return mScene.getFilterShaderDataSizeFast(); +} + +PxSimulationFilterShader NpScene::getFilterShader() const +{ + NP_READ_CHECK(this); + return mScene.getFilterShaderFast(); +} + +PxSimulationFilterCallback* NpScene::getFilterCallback() const +{ + NP_READ_CHECK(this); + return mScene.getFilterCallbackFast(); +} + +bool NpScene::resetFiltering(PxActor& actor) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN_VAL(NpActor::getNpSceneFromActor(actor) && (NpActor::getNpSceneFromActor(actor) == this), "PxScene::resetFiltering(): Actor must be in a scene.", false); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::resetFiltering() not allowed while simulation is running. Call will be ignored.", false) + + bool status; + switch(actor.getConcreteType()) + { + case PxConcreteType::eRIGID_STATIC: + { + NpRigidStatic& npStatic = static_cast(actor); + status = npStatic.NpRigidStaticT::resetFiltering_(npStatic, npStatic.getCore(), NULL, 0); + } + break; + + case PxConcreteType::eRIGID_DYNAMIC: + { + NpRigidDynamic& npDynamic = static_cast(actor); + status = npDynamic.resetFiltering_(npDynamic, npDynamic.getCore(), NULL, 0); + if(status) + npDynamic.wakeUpInternal(); + } + break; + + case PxConcreteType::eARTICULATION_LINK: + { + NpArticulationLink& npLink = static_cast(actor); + status = npLink.resetFiltering_(npLink, npLink.getCore(), NULL, 0); + if(status) + { + NpArticulationReducedCoordinate& npArticulation = static_cast(npLink.getRoot()); + npArticulation.wakeUpInternal(false, true); + } + } + break; + + default: + status = outputError(__LINE__, "PxScene::resetFiltering(): only PxRigidActor supports this operation!"); + } + return status; +} + +bool NpScene::resetFiltering(PxRigidActor& actor, PxShape*const* shapes, PxU32 shapeCount) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN_VAL(NpActor::getNpSceneFromActor(actor) && (NpActor::getNpSceneFromActor(actor) == this), "PxScene::resetFiltering(): Actor must be in a scene.", false); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::resetFiltering() not allowed while simulation is running. Call will be ignored.", false) + + PX_SIMD_GUARD; + + bool status = false; + switch(actor.getConcreteType()) + { + case PxConcreteType::eRIGID_STATIC: + { + NpRigidStatic& npStatic = static_cast(actor); + status = npStatic.NpRigidStaticT::resetFiltering_(npStatic, npStatic.getCore(), shapes, shapeCount); + } + break; + + case PxConcreteType::eRIGID_DYNAMIC: + { + NpRigidDynamic& npDynamic = static_cast(actor); + status = npDynamic.resetFiltering_(npDynamic, npDynamic.getCore(), shapes, shapeCount); + if(status) + npDynamic.wakeUpInternal(); + } + break; + + case PxConcreteType::eARTICULATION_LINK: + { + NpArticulationLink& npLink = static_cast(actor); + status = npLink.resetFiltering_(npLink, npLink.getCore(), shapes, shapeCount); + if(status) + { + NpArticulationReducedCoordinate& impl = static_cast(npLink.getRoot()); + impl.wakeUpInternal(false, true); + } + } + break; + } + return status; +} + +PxPairFilteringMode::Enum NpScene::getKinematicKinematicFilteringMode() const +{ + NP_READ_CHECK(this); + return mScene.getKineKineFilteringMode(); +} + +PxPairFilteringMode::Enum NpScene::getStaticKinematicFilteringMode() const +{ + NP_READ_CHECK(this); + return mScene.getStaticKineFilteringMode(); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxPhysics& NpScene::getPhysics() +{ + return mPhysics; +} + +void NpScene::updateConstants(const PxArray& constraints) +{ + PxsSimulationController* simController = mScene.getSimulationController(); + PX_ASSERT(simController); + + PxU32 nbConstraints = constraints.size(); + NpConstraint*const* currentConstraint = constraints.begin(); + while(nbConstraints--) + { + (*currentConstraint)->updateConstants(*simController); + currentConstraint++; + } +} + +void NpScene::updateDirtyShaders() +{ + PX_PROFILE_ZONE("Sim.updateDirtyShaders", getContextId()); + // this should continue to be done in the Np layer even after SC has taken over + // all vital simulation functions, because it needs to complete before simulate() + // returns to the application + +#ifdef NEW_DIRTY_SHADERS_CODE + if(1) + { + updateConstants(mAlwaysUpdatedConstraints); + updateConstants(mDirtyConstraints); + mDirtyConstraints.clear(); + } + else +#endif + { + // However, the implementation needs fixing so that it does work proportional to + // the number of dirty shaders + + PxsSimulationController* simController = mScene.getSimulationController(); + PX_ASSERT(simController); + const PxU32 nbConstraints = mScene.getNbConstraints(); + Sc::ConstraintCore*const* constraints = mScene.getConstraints(); + for(PxU32 i=0;igetPxConstraint(); + static_cast(pxc)->updateConstants(*simController); + } + } +} + +// PT: TODO +// - do we really need a different mutex per material type? +// - classes like PxsMaterialManager are already typedef of templated types so maybe we don't need them here + +template +static void updateLowLevelMaterials(NpPhysics& physics, PxMutex& sceneMaterialBufferLock, MaterialManagerT& pxsMaterialManager, PxArray& materialBuffer, PxvNphaseImplementationContext* context) +{ + PxMutex::ScopedLock lock(sceneMaterialBufferLock); + + NpMaterialT** masterMaterial = NpMaterialAccessor::getMaterialManager(physics).getMaterials(); + + //sync all the material events + const PxU32 size = materialBuffer.size(); + for(PxU32 i=0; imMaterial; + pxsMaterialManager.setMaterial(materialCore); + context->registerMaterial(*materialCore); + } + break; + case NpScene::MATERIAL_UPDATE: + if(masMat) + { + MaterialCoreT* materialCore = &masterMaterial[event.mHandle]->mMaterial; + pxsMaterialManager.updateMaterial(materialCore); + context->updateMaterial(*materialCore); + } + break; + case NpScene::MATERIAL_REMOVE: + if (event.mHandle < pxsMaterialManager.getMaxSize()) // materials might get added and then removed again immediately. However, the add does not get processed (see case MATERIAL_ADD above), + { // so the remove might end up reading out of bounds memory unless checked. + MaterialCoreT* materialCore = pxsMaterialManager.getMaterial(event.mHandle); + if (materialCore->mMaterialIndex == event.mHandle) + { + context->unregisterMaterial(*materialCore); + pxsMaterialManager.removeMaterial(materialCore); + } + } + break; + }; + } + + materialBuffer.resize(0); +} + +/////////////////////////////////////////////////////////////////////////////// +bool NpScene::simulateOrCollide(PxReal elapsedTime, PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation, const char* invalidCallMsg, Sc::SimulationStage::Enum simStage) +{ + PX_SIMD_GUARD; + + { + // write guard must end before simulation kicks off worker threads + // otherwise the simulation callbacks could overlap with this function + // and perform API reads,triggering an error + NP_WRITE_CHECK(this); + + PX_PROFILE_START_CROSSTHREAD("Basic.simulate", getContextId()); + + if(getSimulationStage() != Sc::SimulationStage::eCOMPLETE) + { + //fetchResult doesn't get called + return outputError(__LINE__, invalidCallMsg); + } + +#if PX_SUPPORT_GPU_PHYSX + if (mCudaContextManager) + { + if (mScene.isUsingGpuDynamicsOrBp()) + { + if (mCudaContextManager->getCudaContext()->getLastError()) + return outputError(__LINE__, "PhysX Internal CUDA error. Simulation can not continue!"); + } + } +#endif + + PX_CHECK_AND_RETURN_VAL(elapsedTime > 0, "PxScene::collide/simulate: The elapsed time must be positive!", false); + + PX_CHECK_AND_RETURN_VAL((size_t(scratchBlock)&15) == 0, "PxScene::simulate: scratch block must be 16-byte aligned!", false); + + PX_CHECK_AND_RETURN_VAL((scratchBlockSize&16383) == 0, "PxScene::simulate: scratch block size must be a multiple of 16K", false); + +#if PX_SUPPORT_PVD + //signal the frame is starting. + mScenePvdClient.frameStart(elapsedTime); +#endif + +#if PX_ENABLE_DEBUG_VISUALIZATION + visualize(); +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + + updateDirtyShaders(); + +#if PX_SUPPORT_PVD + mScenePvdClient.updateJoints(); +#endif + + mScene.setScratchBlock(scratchBlock, scratchBlockSize); + + mElapsedTime = elapsedTime; + if (simStage == Sc::SimulationStage::eCOLLIDE) + mScene.setElapsedTime(elapsedTime); + + mControllingSimulation = controlSimulation; + + //sync all the material events + PxvNphaseImplementationContext* context = mScene.getLowLevelContext()->getNphaseImplementationContext(); + updateLowLevelMaterials(mPhysics, mSceneMaterialBufferLock, mScene.getMaterialManager(), mSceneMaterialBuffer, context); + +#if PX_SUPPORT_GPU_PHYSX + updateLowLevelMaterials (mPhysics, mSceneFEMSoftBodyMaterialBufferLock, mScene.getFEMMaterialManager(), mSceneFEMSoftBodyMaterialBuffer, context); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + updateLowLevelMaterials (mPhysics, mSceneFEMClothMaterialBufferLock, mScene.getFEMClothMaterialManager(), mSceneFEMClothMaterialBuffer, context); +#endif + updateLowLevelMaterials (mPhysics, mScenePBDMaterialBufferLock, mScene.getPBDMaterialManager(), mScenePBDMaterialBuffer, context); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + updateLowLevelMaterials (mPhysics, mSceneFLIPMaterialBufferLock, mScene.getFLIPMaterialManager(), mSceneFLIPMaterialBuffer, context); + updateLowLevelMaterials (mPhysics, mSceneMPMMaterialBufferLock, mScene.getMPMMaterialManager(), mSceneMPMMaterialBuffer, context); + updateLowLevelMaterials (mPhysics, mSceneCustomMaterialBufferLock, mScene.getCustomMaterialManager(), mSceneCustomMaterialBuffer, context); +#endif +#endif + + setSimulationStage(simStage); + setAPIWriteToForbidden(); + setAPIReadToForbidden(); + mScene.setCollisionPhaseToActive(); + mHasSimulatedOnce = true; + } + + { + PX_PROFILE_ZONE("Sim.taskFrameworkSetup", getContextId()); + + if (controlSimulation) + { + { + PX_PROFILE_ZONE("Sim.resetDependencies", getContextId()); + // Only reset dependencies, etc if we own the TaskManager. Will be false + // when an NpScene is controlled by an APEX scene. + mTaskManager->resetDependencies(); + } + mTaskManager->startSimulation(); + } + + if (simStage == Sc::SimulationStage::eCOLLIDE) + { + mCollisionCompletion.setContinuation(*mTaskManager, completionTask); + mSceneCollide.setContinuation(&mCollisionCompletion); + //Initialize scene completion task + mSceneCompletion.setContinuation(*mTaskManager, NULL); + + mCollisionCompletion.removeReference(); + mSceneCollide.removeReference(); + } + else + { + mSceneCompletion.setContinuation(*mTaskManager, completionTask); + mSceneExecution.setContinuation(*mTaskManager, &mSceneCompletion); + + mSceneCompletion.removeReference(); + mSceneExecution.removeReference(); + } + } + return true; +} + +bool NpScene::simulate(PxReal elapsedTime, PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation) +{ + return simulateOrCollide( elapsedTime, completionTask, scratchBlock, scratchBlockSize, controlSimulation, + "PxScene::simulate: Simulation is still processing last simulate call, you should call fetchResults()!", Sc::SimulationStage::eADVANCE); +} + +bool NpScene::advance(PxBaseTask* completionTask) +{ + NP_WRITE_CHECK(this); + + //issue error if advance() doesn't get called between fetchCollision() and fetchResult() + if(getSimulationStage() != Sc::SimulationStage::eFETCHCOLLIDE) + return outputError(__LINE__, "PxScene::advance: advance() called illegally! advance() needed to be called after fetchCollision() and before fetchResult()!!"); + + //if mSimulateStage == eFETCHCOLLIDE, which means collide() has been kicked off and finished running, we can run advance() safely + { + //change the mSimulateStaget to eADVANCE to indicate the next stage to run is fetchResult() + setSimulationStage(Sc::SimulationStage::eADVANCE); + setAPIReadToForbidden(); + + { + PX_PROFILE_ZONE("Sim.taskFrameworkSetup", getContextId()); + + mSceneCompletion.setDependent(completionTask); + mSceneAdvance.setContinuation(*mTaskManager, &mSceneCompletion); + mSceneCompletion.removeReference(); + mSceneAdvance.removeReference(); + } + } + return true; +} + +bool NpScene::collide(PxReal elapsedTime, PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation) +{ + return simulateOrCollide( elapsedTime, + completionTask, + scratchBlock, + scratchBlockSize, + controlSimulation, + "PxScene::collide: collide() called illegally! If it isn't the first frame, collide() needed to be called between fetchResults() and fetchCollision(). Otherwise, collide() needed to be called before fetchCollision()", + Sc::SimulationStage::eCOLLIDE); +} + +bool NpScene::checkCollisionInternal(bool block) +{ + PX_PROFILE_ZONE("Basic.checkCollision", getContextId()); + return mCollisionDone.wait(block ? PxSync::waitForever : 0); +} + +bool NpScene::checkCollision(bool block) +{ + return checkCollisionInternal(block); +} + +bool NpScene::fetchCollision(bool block) +{ + if(getSimulationStage() != Sc::SimulationStage::eCOLLIDE) + { + return outputError(__LINE__, "PxScene::fetchCollision: fetchCollision() should be called after collide() and before advance()!"); + } + + //if collision isn't finish running (and block is false), then return false + if(!checkCollisionInternal(block)) + return false; + + // take write check *after* collision() finished, otherwise + // we will block fetchCollision() from using the API + NP_WRITE_CHECK_NOREENTRY(this); + + setSimulationStage(Sc::SimulationStage::eFETCHCOLLIDE); + setAPIReadToAllowed(); + + return true; +} + +void NpScene::flushSimulation(bool sendPendingReports) +{ + PX_PROFILE_ZONE("API.flushSimulation", getContextId()); + NP_WRITE_CHECK_NOREENTRY(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::flushSimulation(): This call is not allowed while the simulation is running. Call will be ignored") + + PX_SIMD_GUARD; + + mScene.flush(sendPendingReports); + getSQAPI().flushMemory(); + + //!!! TODO: Shrink all NpObject lists? +} + +/* +Replaces finishRun() with the addition of appropriate thread sync(pulled out of PhysicsThread()) + +Note: this function can be called from the application thread or the physics thread, depending on the +scene flags. +*/ +void NpScene::executeScene(PxBaseTask* continuation) +{ + mScene.simulate(mElapsedTime, continuation); +} + +void NpScene::executeCollide(PxBaseTask* continuation) +{ + mScene.collide(mElapsedTime, continuation); +} + +void NpScene::executeAdvance(PxBaseTask* continuation) +{ + mScene.advance(mElapsedTime, continuation); +} + +/////////////////////////////////////////////////////////////////////////////// + +#define IMPLEMENT_MATERIAL(MaterialType, CoreType, LockName, BufferName) \ +void NpScene::addMaterial(const MaterialType& mat) \ +{ \ + const CoreType& material = mat.mMaterial; \ + PxMutex::ScopedLock lock(LockName); \ + BufferName.pushBack(MaterialEvent(material.mMaterialIndex, MATERIAL_ADD)); \ + CREATE_PVD_INSTANCE(&material) \ +} \ + \ +void NpScene::updateMaterial(const MaterialType& mat) \ +{ \ + const CoreType& material = mat.mMaterial; \ + PxMutex::ScopedLock lock(LockName); \ + BufferName.pushBack(MaterialEvent(material.mMaterialIndex, MATERIAL_UPDATE)); \ + UPDATE_PVD_PROPERTIES(&material) \ +} \ + \ +void NpScene::removeMaterial(const MaterialType& mat) \ +{ \ + const CoreType& material = mat.mMaterial; \ + if(material.mMaterialIndex == MATERIAL_INVALID_HANDLE) \ + return; \ + PxMutex::ScopedLock lock(LockName); \ + BufferName.pushBack(MaterialEvent(material.mMaterialIndex, MATERIAL_REMOVE)); \ + RELEASE_PVD_INSTANCE(&material); \ +} + +IMPLEMENT_MATERIAL(NpMaterial, PxsMaterialCore, mSceneMaterialBufferLock, mSceneMaterialBuffer) + +#if PX_SUPPORT_GPU_PHYSX + IMPLEMENT_MATERIAL(NpFEMSoftBodyMaterial, PxsFEMSoftBodyMaterialCore, mSceneFEMSoftBodyMaterialBufferLock, mSceneFEMSoftBodyMaterialBuffer) +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + IMPLEMENT_MATERIAL(NpFEMClothMaterial, PxsFEMClothMaterialCore, mSceneFEMClothMaterialBufferLock, mSceneFEMClothMaterialBuffer) +#endif + IMPLEMENT_MATERIAL(NpPBDMaterial, PxsPBDMaterialCore, mScenePBDMaterialBufferLock, mScenePBDMaterialBuffer) +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + IMPLEMENT_MATERIAL(NpFLIPMaterial, PxsFLIPMaterialCore, mSceneFLIPMaterialBufferLock, mSceneFLIPMaterialBuffer) + IMPLEMENT_MATERIAL(NpMPMMaterial, PxsMPMMaterialCore, mSceneMPMMaterialBufferLock, mSceneMPMMaterialBuffer) + IMPLEMENT_MATERIAL(NpCustomMaterial, PxsCustomMaterialCore, mSceneCustomMaterialBufferLock, mSceneCustomMaterialBuffer) +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((group1 < PX_MAX_DOMINANCE_GROUP && group2 < PX_MAX_DOMINANCE_GROUP), + "PxScene::setDominanceGroupPair: invalid params! Groups must be <= 31!"); + //can't change matrix diagonal + PX_CHECK_AND_RETURN(group1 != group2, "PxScene::setDominanceGroupPair: invalid params! Groups must be unequal! Can't change matrix diagonal!"); + PX_CHECK_AND_RETURN( + ((dominance.dominance0) == 1.0f && (dominance.dominance1 == 1.0f)) + || ((dominance.dominance0) == 1.0f && (dominance.dominance1 == 0.0f)) + || ((dominance.dominance0) == 0.0f && (dominance.dominance1 == 1.0f)) + , "PxScene::setDominanceGroupPair: invalid params! dominance must be one of (1,1), (1,0), or (0,1)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setDominanceGroupPair() not allowed while simulation is running. Call will be ignored.") + + mScene.setDominanceGroupPair(group1, group2, dominance); + updatePvdProperties(); +} + +PxDominanceGroupPair NpScene::getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const +{ + NP_READ_CHECK(this); + PX_CHECK_AND_RETURN_VAL((group1 < PX_MAX_DOMINANCE_GROUP && group2 < PX_MAX_DOMINANCE_GROUP), + "PxScene::getDominanceGroupPair: invalid params! Groups must be <= 31!", PxDominanceGroupPair(PxU8(1u), PxU8(1u))); + return mScene.getDominanceGroupPair(group1, group2); +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX +void NpScene::updatePhysXIndicator() +{ + PxIntBool isGpu = mScene.isUsingGpuDynamicsOrBp(); + + mPhysXIndicator.setIsGpu(isGpu != 0); +} +#endif //PX_SUPPORT_GPU_PHYSX + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::setSolverBatchSize(PxU32 solverBatchSize) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setSolverBatchSize() not allowed while simulation is running. Call will be ignored.") + + mScene.setSolverBatchSize(solverBatchSize); + updatePvdProperties(); + OMNI_PVD_SET(scene, solverBatchSize, static_cast(*this), solverBatchSize) +} + +PxU32 NpScene::getSolverBatchSize(void) const +{ + NP_READ_CHECK(this); + // get from our local copy + return mScene.getSolverBatchSize(); +} + +void NpScene::setSolverArticulationBatchSize(PxU32 solverBatchSize) +{ + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setSolverArticulationBatchSize() not allowed while simulation is running. Call will be ignored.") + + mScene.setSolverArticBatchSize(solverBatchSize); + updatePvdProperties(); + OMNI_PVD_SET(scene, solverArticulationBatchSize, static_cast(*this), solverBatchSize) +} + +PxU32 NpScene::getSolverArticulationBatchSize(void) const +{ + NP_READ_CHECK(this); + // get from our local copy + return mScene.getSolverArticBatchSize(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool NpScene::setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(value), "PxScene::setVisualizationParameter: value is not valid.", false); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(this, "PxScene::setVisualizationParameter() not allowed while simulation is running. Call will be ignored.", false) + + if (param >= PxVisualizationParameter::eNUM_VALUES) + return outputError(__LINE__, "setVisualizationParameter: parameter out of range."); + else if (value < 0.0f) + return outputError(__LINE__, "setVisualizationParameter: value must be larger or equal to 0."); + else + { + mScene.setVisualizationParameter(param, value); + return true; + } +} + +PxReal NpScene::getVisualizationParameter(PxVisualizationParameter::Enum param) const +{ + if (param < PxVisualizationParameter::eNUM_VALUES) + return mScene.getVisualizationParameter(param); + else + outputError(__LINE__, "getVisualizationParameter: param is not an enum."); + + return 0.0f; +} + +void NpScene::setVisualizationCullingBox(const PxBounds3& box) +{ + NP_WRITE_CHECK(this); + PX_CHECK_MSG(box.isValid(), "PxScene::setVisualizationCullingBox(): invalid bounds provided!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setVisualizationCullingBox() not allowed while simulation is running. Call will be ignored.") + + mScene.setVisualizationCullingBox(box); +} + +PxBounds3 NpScene::getVisualizationCullingBox() const +{ + NP_READ_CHECK(this); + const PxBounds3& bounds = mScene.getVisualizationCullingBox(); + PX_ASSERT(bounds.isValid()); + return bounds; +} + +void NpScene::setNbContactDataBlocks(PxU32 numBlocks) +{ + PX_CHECK_AND_RETURN((getSimulationStage() == Sc::SimulationStage::eCOMPLETE), + "PxScene::setNbContactDataBlock: This call is not allowed while the simulation is running. Call will be ignored!"); + + mScene.setNbContactDataBlocks(numBlocks); + OMNI_PVD_SET(scene, nbContactDataBlocks, static_cast(*this), numBlocks) +} + +PxU32 NpScene::getNbContactDataBlocksUsed() const +{ + PX_CHECK_AND_RETURN_VAL((getSimulationStage() == Sc::SimulationStage::eCOMPLETE), + "PxScene::getNbContactDataBlocksUsed: This call is not allowed while the simulation is running. Returning 0.", 0); + + return mScene.getNbContactDataBlocksUsed(); +} + +PxU32 NpScene::getMaxNbContactDataBlocksUsed() const +{ + PX_CHECK_AND_RETURN_VAL((getSimulationStage() == Sc::SimulationStage::eCOMPLETE), + "PxScene::getMaxNbContactDataBlocksUsed: This call is not allowed while the simulation is running. Returning 0.", 0); + + return mScene.getMaxNbContactDataBlocksUsed(); +} + +PxU32 NpScene::getTimestamp() const +{ + return mScene.getTimeStamp(); +} + +PxCpuDispatcher* NpScene::getCpuDispatcher() const +{ + return mTaskManager->getCpuDispatcher(); +} + +PxCudaContextManager* NpScene::getCudaContextManager() const +{ + return mCudaContextManager; +} + +void NpScene::setMaxBiasCoefficient(const PxReal coeff) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((coeff>=0.0f), "PxScene::setMaxBiasCoefficient(): coefficient has to be in [0, PX_MAX_F32]!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setMaxBiasCoefficient() not allowed while simulation is running. Call will be ignored.") + + mScene.setMaxBiasCoefficient(coeff); + updatePvdProperties(); + OMNI_PVD_SET(scene, maxBiasCoefficient, static_cast(*this), coeff) +} + +PxReal NpScene::getMaxBiasCoefficient() const +{ + NP_READ_CHECK(this); + return mScene.getMaxBiasCoefficient(); +} + +void NpScene::setFrictionOffsetThreshold(const PxReal t) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((t>=0.0f), "PxScene::setFrictionOffsetThreshold(): threshold value has to be in [0, PX_MAX_F32)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setFrictionOffsetThreshold() not allowed while simulation is running. Call will be ignored.") + + mScene.setFrictionOffsetThreshold(t); + updatePvdProperties(); + OMNI_PVD_SET(scene, frictionOffsetThreshold, static_cast(*this), t) +} + +PxReal NpScene::getFrictionOffsetThreshold() const +{ + NP_READ_CHECK(this); + return mScene.getFrictionOffsetThreshold(); +} + +void NpScene::setFrictionCorrelationDistance(const PxReal t) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((t >= 0.0f), "PxScene::setFrictionCorrelationDistance(): threshold value has to be in [0, PX_MAX_F32)!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::setFrictionCorrelationDistance() not allowed while simulation is running. Call will be ignored.") + + mScene.setFrictionCorrelationDistance(t); + updatePvdProperties(); + OMNI_PVD_SET(scene, frictionCorrelationDistance, static_cast(*this), t) +} + +PxReal NpScene::getFrictionCorrelationDistance() const +{ + NP_READ_CHECK(this); + return mScene.getFrictionCorrelationDistance(); +} + +PxU32 NpScene::getContactReportStreamBufferSize() const +{ + NP_READ_CHECK(this); + return mScene.getDefaultContactReportStreamBufferSize(); +} + +#if PX_CHECKED +void NpScene::checkPositionSanity(const PxRigidActor& a, const PxTransform& pose, const char* fnName) const +{ + if(!mSanityBounds.contains(pose.p)) + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "%s: actor pose for %lp is outside sanity bounds\n", fnName, &a); +} +#endif + +namespace +{ + struct ThreadReadWriteCount + { + ThreadReadWriteCount(const size_t data) + : readDepth(data & 0xFF), + writeDepth((data >> 8) & 0xFF), + readLockDepth((data >> 16) & 0xFF), + writeLockDepth((data >> 24) & 0xFF) + { + + } + + size_t getData() const { return size_t(writeLockDepth) << 24 | size_t(readLockDepth) << 16 | size_t(writeDepth) << 8 | size_t(readDepth); } + + PxU8 readDepth; // depth of re-entrant reads + PxU8 writeDepth; // depth of re-entrant writes + + PxU8 readLockDepth; // depth of read-locks + PxU8 writeLockDepth; // depth of write-locks + }; +} + +#if NP_ENABLE_THREAD_CHECKS + +NpScene::StartWriteResult::Enum NpScene::startWrite(bool allowReentry) +{ + PX_COMPILE_TIME_ASSERT(sizeof(ThreadReadWriteCount) == 4); + + if (mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK) + { + ThreadReadWriteCount localCounts(PxTlsGetValue(mThreadReadWriteDepth)); + + if (mBetweenFetchResults) + return StartWriteResult::eIN_FETCHRESULTS; + + // ensure we already have the write lock + return localCounts.writeLockDepth > 0 ? StartWriteResult::eOK : StartWriteResult::eNO_LOCK; + } + + { + ThreadReadWriteCount localCounts(PxTlsGetValue(mThreadReadWriteDepth)); + StartWriteResult::Enum result; + + if (mBetweenFetchResults) + result = StartWriteResult::eIN_FETCHRESULTS; + + // check we are the only thread reading (allows read->write order on a single thread) and no other threads are writing + else if (mConcurrentReadCount != localCounts.readDepth || mConcurrentWriteCount != localCounts.writeDepth) + result = StartWriteResult::eRACE_DETECTED; + + else + result = StartWriteResult::eOK; + + // increment shared write counter + PxAtomicIncrement(&mConcurrentWriteCount); + + // in the normal case (re-entry is allowed) then we simply increment + // the writeDepth by 1, otherwise (re-entry is not allowed) increment + // by 2 to force subsequent writes to fail by creating a mismatch between + // the concurrent write counter and the local counter, any value > 1 will do + localCounts.writeDepth += allowReentry ? 1 : 2; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + if (result != StartWriteResult::eOK) + PxAtomicIncrement(&mConcurrentErrorCount); + + return result; + } +} + +void NpScene::stopWrite(bool allowReentry) +{ + if (!(mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)) + { + PxAtomicDecrement(&mConcurrentWriteCount); + + // decrement depth of writes for this thread + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + + // see comment in startWrite() + if (allowReentry) + localCounts.writeDepth--; + else + localCounts.writeDepth-=2; + + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + } +} + +bool NpScene::startRead() const +{ + if (mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK) + { + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + + // ensure we already have the write or read lock + return localCounts.writeLockDepth > 0 || localCounts.readLockDepth > 0; + } + else + { + PxAtomicIncrement(&mConcurrentReadCount); + + // update current threads read depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + localCounts.readDepth++; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + // success if the current thread is already performing a write (API re-entry) or no writes are in progress + const bool success = (localCounts.writeDepth > 0 || mConcurrentWriteCount == 0); + + if (!success) + PxAtomicIncrement(&mConcurrentErrorCount); + + return success; + } +} + +void NpScene::stopRead() const +{ + if (!(mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)) + { + PxAtomicDecrement(&mConcurrentReadCount); + + // update local threads read depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + localCounts.readDepth--; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + } +} + +#else + +NpScene::StartWriteResult::Enum NpScene::startWrite(bool) { PX_ASSERT(0); return NpScene::StartWriteResult::eOK; } +void NpScene::stopWrite(bool) {} + +bool NpScene::startRead() const { PX_ASSERT(0); return false; } +void NpScene::stopRead() const {} + +#endif // NP_ENABLE_THREAD_CHECKS + +void NpScene::lockRead(const char* /*file*/, PxU32 /*line*/) +{ + // increment this threads read depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + localCounts.readLockDepth++; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + // if we are the current writer then increment the reader count but don't actually lock (allow reading from threads with write ownership) + if(localCounts.readLockDepth == 1) + mRWLock.lockReader(mCurrentWriter != PxThread::getId()); +} + +void NpScene::unlockRead() +{ + // increment this threads read depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + if(localCounts.readLockDepth < 1) + { + outputError(__LINE__, "PxScene::unlockRead() called without matching call to PxScene::lockRead(), behaviour will be undefined."); + return; + } + localCounts.readLockDepth--; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + // only unlock on last read + if(localCounts.readLockDepth == 0) + mRWLock.unlockReader(); +} + +void NpScene::lockWrite(const char* file, PxU32 line) +{ + // increment this threads write depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + if (localCounts.writeLockDepth == 0 && localCounts.readLockDepth > 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, file?file:__FILE__, file?int(line):__LINE__, "PxScene::lockWrite() detected after a PxScene::lockRead(), lock upgrading is not supported, behaviour will be undefined."); + return; + } + localCounts.writeLockDepth++; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + // only lock on first call + if (localCounts.writeLockDepth == 1) + mRWLock.lockWriter(); + + PX_ASSERT(mCurrentWriter == 0 || mCurrentWriter == PxThread::getId()); + + // set ourselves as the current writer + mCurrentWriter = PxThread::getId(); +} + +void NpScene::unlockWrite() +{ + // increment this thread's write depth + ThreadReadWriteCount localCounts (PxTlsGetValue(mThreadReadWriteDepth)); + if (localCounts.writeLockDepth < 1) + { + outputError(__LINE__, "PxScene::unlockWrite() called without matching call to PxScene::lockWrite(), behaviour will be undefined."); + return; + } + localCounts.writeLockDepth--; + PxTlsSetValue(mThreadReadWriteDepth, localCounts.getData()); + + PX_ASSERT(mCurrentWriter == PxThread::getId()); + + if (localCounts.writeLockDepth == 0) + { + mCurrentWriter = 0; + mRWLock.unlockWriter(); + } +} + +PxReal NpScene::getWakeCounterResetValue() const +{ + NP_READ_CHECK(this); + + return getWakeCounterResetValueInternal(); +} + +static PX_FORCE_INLINE void shiftRigidActor(PxRigidActor* a, const PxVec3& shift) +{ + PxActorType::Enum t = a->getType(); + if (t == PxActorType::eRIGID_DYNAMIC) + { + NpRigidDynamic* rd = static_cast(a); + rd->getCore().onOriginShift(shift); + } + else if (t == PxActorType::eRIGID_STATIC) + { + NpRigidStatic* rs = static_cast(a); + rs->getCore().onOriginShift(shift); + } + else + { + PX_ASSERT(t == PxActorType::eARTICULATION_LINK); + NpArticulationLink* al = static_cast(a); + al->getCore().onOriginShift(shift); + } +} + +template +static void shiftRigidActors(PxArray& rigidActorList, const PxVec3& shift) +{ + const PxU32 prefetchLookAhead = 4; + PxU32 rigidCount = rigidActorList.size(); + T*const* rigidActors = rigidActorList.begin(); + PxU32 batchIterCount = rigidCount / prefetchLookAhead; + + PxU32 idx = 0; + for(PxU32 i=0; i < batchIterCount; i++) + { + // prefetch elements for next batch + if (i < (batchIterCount-1)) + { + PxPrefetchLine(rigidActors[idx + prefetchLookAhead]); + PxPrefetchLine(reinterpret_cast(rigidActors[idx + prefetchLookAhead]) + 128); + PxPrefetchLine(rigidActors[idx + prefetchLookAhead + 1]); + PxPrefetchLine(reinterpret_cast(rigidActors[idx + prefetchLookAhead + 1]) + 128); + PxPrefetchLine(rigidActors[idx + prefetchLookAhead + 2]); + PxPrefetchLine(reinterpret_cast(rigidActors[idx + prefetchLookAhead + 2]) + 128); + PxPrefetchLine(rigidActors[idx + prefetchLookAhead + 3]); + PxPrefetchLine(reinterpret_cast(rigidActors[idx + prefetchLookAhead + 3]) + 128); + } + else + { + for(PxU32 k=(idx + prefetchLookAhead); k < rigidCount; k++) + { + PxPrefetchLine(rigidActors[k]); + PxPrefetchLine(reinterpret_cast(rigidActors[k]) + 128); + } + } + + for(PxU32 j=idx; j < (idx + prefetchLookAhead); j++) + { + shiftRigidActor(rigidActors[j], shift); + } + + idx += prefetchLookAhead; + } + // process remaining objects + for(PxU32 i=idx; i < rigidCount; i++) + { + shiftRigidActor(rigidActors[i], shift); + } +} + +void NpScene::shiftOrigin(const PxVec3& shift) +{ + PX_PROFILE_ZONE("API.shiftOrigin", getContextId()); + NP_WRITE_CHECK(this); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::shiftOrigin() not allowed while simulation is running. Call will be ignored.") + + PX_SIMD_GUARD; + + shiftRigidActors(mRigidDynamics, shift); + shiftRigidActors(mRigidStatics, shift); + + PxArticulationReducedCoordinate*const* articulations = mArticulations.getEntries(); + for(PxU32 i=0; i < mArticulations.size(); i++) + { + PxArticulationReducedCoordinate* np = (articulations[i]); + + NpArticulationLink*const* links = static_cast(np)->getLinks(); + + for(PxU32 j=0; j < np->getNbLinks(); j++) + { + shiftRigidActor(links[j], shift); + } + } + + mScene.shiftOrigin(shift); + PVD_ORIGIN_SHIFT(shift); + + // shift scene query related data structures + getSQAPI().shiftOrigin(shift); + +#if PX_ENABLE_DEBUG_VISUALIZATION + // debug visualization + mRenderBuffer.shift(-shift); +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif +} + +PxPvdSceneClient* NpScene::getScenePvdClient() +{ +#if PX_SUPPORT_PVD + return &mScenePvdClient; +#else + return NULL; +#endif +} + +void NpScene::copyArticulationData(void* jointData, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbCopyArticulations, void* copyEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::copyArticulationData() not allowed while simulation is running. Call will be ignored."); + + if (dataType == PxArticulationGpuDataType::eJOINT_FORCE || dataType == PxArticulationGpuDataType::eLINK_FORCE || + dataType == PxArticulationGpuDataType::eLINK_TORQUE) + { + outputError(__LINE__, "PxScene::copyArticulationData, specified data is write only."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->copyArticulationData(jointData, index, dataType, nbCopyArticulations, copyEvent); +} + +void NpScene::applyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbUpdatedArticulations, void* waitEvent, void* signalEvent) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::applyArticulationData() not allowed while simulation is running. Call will be ignored."); + + if (!data || !index) + { + outputError(__LINE__, "PxScene::applyArticulationData, data and/or index has to be valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->applyArticulationData(data,index, dataType, nbUpdatedArticulations, waitEvent, signalEvent); +} + +void NpScene::copySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbCopySoftBodies, const PxU32 maxSize, void* copyEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::copySoftBodyData() not allowed while simulation is running. Call will be ignored."); + + //if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuRigidBodies()) + mScene.getSimulationController()->copySoftBodyData(data, dataSizes, softBodyIndices, flag, nbCopySoftBodies, maxSize, copyEvent); +} +void NpScene::applySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbUpdatedSoftBodies, const PxU32 maxSize, void* applyEvent) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::applySoftBodyData() not allowed while simulation is running. Call will be ignored."); + + //if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuRigidBodies()) + mScene.getSimulationController()->applySoftBodyData(data, dataSizes, softBodyIndices, flag, nbUpdatedSoftBodies, maxSize, applyEvent); +} + +void NpScene::copyContactData(void* data, const PxU32 maxContactPairs, void* numContactPairs, void* copyEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::copyContactData() not allowed while simulation is running. Call will be ignored."); + + if (!data || !numContactPairs) + { + outputError(__LINE__, "PxScene::copyContactData, data and/or count has to be valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->copyContactData(mScene.getDynamicsContext(), data, maxContactPairs, numContactPairs, copyEvent); +} + +void NpScene::copyBodyData(PxGpuBodyData* data, PxGpuActorPair* index, const PxU32 nbCopyActors, void* copyEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::copyBodyData() not allowed while simulation is running. Call will be ignored."); + + if (!data) + { + outputError(__LINE__, "PxScene::copyBodyData, data has to be valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->copyBodyData(data, index, nbCopyActors, copyEvent); +} + +void NpScene::applyActorData(void* data, PxGpuActorPair* index, PxActorCacheFlag::Enum flag, const PxU32 nbUpdatedActors, void* waitEvent, void* signalEvent) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::applyActorData() not allowed while simulation is running. Call will be ignored."); + + if (!data || !index) + { + outputError(__LINE__, "PxScene::applyActorData, data and/or index has to be valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->applyActorData(data, index, flag, nbUpdatedActors, waitEvent, signalEvent); +} + +void NpScene::computeDenseJacobians(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::computeDenseJacobians() not allowed while simulation is running. Call will be ignored."); + + if (!indices) + { + outputError(__LINE__, "PxScene::computeDenseJacobians, indices have to be a valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->computeDenseJacobians(indices, nbIndices, computeEvent); +} + +void NpScene::computeGeneralizedMassMatrices(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::computeGeneralizedMassMatrices() not allowed while simulation is running. Call will be ignored."); + + if (!indices) + { + outputError(__LINE__, "PxScene::computeGeneralizedMassMatrices, indices have to be a valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->computeGeneralizedMassMatrices(indices, nbIndices, computeEvent); +} + +void NpScene::computeGeneralizedGravityForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::computeGeneralizedGravityForces() not allowed while simulation is running. Call will be ignored."); + + if (!indices) + { + outputError(__LINE__, "PxScene::computeGeneralizedGravityForces, indices have to be a valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->computeGeneralizedGravityForces(indices, nbIndices, getGravity(), computeEvent); +} + +void NpScene::computeCoriolisAndCentrifugalForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent) +{ + PX_CHECK_SCENE_API_READ_FORBIDDEN(this, "PxScene::computeCoriolisAndCentrifugalForces() not allowed while simulation is running. Call will be ignored."); + + if (!indices) + { + outputError(__LINE__, "PxScene::computeCoriolisAndCentrifugalForces, indices have to be a valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->computeCoriolisAndCentrifugalForces(indices, nbIndices, computeEvent); +} + +void NpScene::applyParticleBufferData(const PxU32* indices, const PxGpuParticleBufferIndexPair* indexPairs, const PxParticleBufferFlags* flags, PxU32 nbUpdatedBuffers, void* waitEvent, void* signalEvent) +{ + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(this, "PxScene::applyParticleBufferData() not allowed while simulation is running. Call will be ignored."); + + if (!indices || !flags) + { + outputError(__LINE__, "PxScene::applyParticleBufferData, indices and/or flags has to be valid pointer."); + return; + } + + if ((mScene.getFlags() & PxSceneFlag::eSUPPRESS_READBACK) && mScene.isUsingGpuDynamicsOrBp()) + mScene.getSimulationController()->applyParticleBufferData(indices, indexPairs, flags, nbUpdatedBuffers, waitEvent, signalEvent); +} + +PxsSimulationController* NpScene::getSimulationController() +{ + return mScene.getSimulationController(); +} + +void NpScene::setActiveActors(PxActor** actors, PxU32 nbActors) +{ + NP_WRITE_CHECK(this); + + mScene.setActiveActors(actors, nbActors); +} + +void NpScene::frameEnd() +{ +#if PX_SUPPORT_PVD + mScenePvdClient.frameEnd(); +#endif +} + +/////////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE PxU32 getShapes(NpRigidStatic& rigid, NpShape* const *& shapes) +{ + return NpRigidStaticGetShapes(rigid, shapes); +} + +PX_FORCE_INLINE PxU32 getShapes(NpRigidDynamic& rigid, NpShape* const *& shapes) +{ + return NpRigidDynamicGetShapes(rigid, shapes); +} + +PX_FORCE_INLINE PxU32 getShapes(NpArticulationLink& rigid, NpShape* const *& shapes) +{ + return NpArticulationGetShapes(rigid, shapes); +} + +PX_FORCE_INLINE NpShape* getShape(NpShape* const* shapeArray, const PxU32 i) +{ + return shapeArray[i]; +} + +PX_FORCE_INLINE NpShape* getShape(Sc::ShapeCore* const* shapeArray, const PxU32 i) +{ + return static_cast(shapeArray[i]->getPxShape()); +} + +template +PX_FORCE_INLINE static void addActorShapes(T* const* shapeArray, const PxU32 nbShapes, PxActor* pxActor, NpScene* scScene) +{ + PX_ASSERT(pxActor); + PX_ASSERT(scScene); + PX_ASSERT((0==nbShapes) || shapeArray); + for (PxU32 i = 0; i < nbShapes; i++) + { + NpShape* npShape = getShape(shapeArray, i); + PX_ASSERT(npShape); + npShape->setSceneIfExclusive(scScene); +#if PX_SUPPORT_PVD + scScene->getScenePvdClientInternal().createPvdInstance(npShape, *pxActor); +#else + PX_UNUSED(pxActor); +#endif + } +} + +template +PX_FORCE_INLINE static void removeActorShapes(T* const* shapeArray, const PxU32 nbShapes, PxActor* pxActor, NpScene* scScene) +{ + PX_ASSERT(pxActor); + PX_ASSERT(scScene); + PX_ASSERT((0 == nbShapes) || shapeArray); + for (PxU32 i = 0; i < nbShapes; i++) + { + NpShape* npShape = getShape(shapeArray, i); + PX_ASSERT(npShape); +#if PX_SUPPORT_PVD + scScene->getScenePvdClientInternal().releasePvdInstance(npShape, *pxActor); +#else + PX_UNUSED(pxActor); + PX_UNUSED(scScene); +#endif + npShape->setSceneIfExclusive(NULL); + } +} + +void addSimActorToScScene(Sc::Scene& s, NpRigidStatic& staticObject, NpShape* const* npShapes, PxU32 nbShapes, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + PX_UNUSED(bvh); + const size_t shapePtrOffset = NpShape::getCoreOffset(); + s.addStatic(staticObject.getCore(), npShapes, nbShapes, shapePtrOffset, uninflatedBounds); +} + +template +void addSimActorToScSceneT(Sc::Scene& s, NpRigidBodyTemplate& dynamicObject, NpShape* const* npShapes, PxU32 nbShapes, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + const bool isCompound = bvh ? true : false; + const size_t shapePtrOffset = NpShape::getCoreOffset(); + s.addBody(dynamicObject.getCore(), npShapes, nbShapes, shapePtrOffset, uninflatedBounds, isCompound); +} + +void addSimActorToScScene(Sc::Scene& s, NpRigidDynamic& dynamicObject, NpShape* const* npShapes, PxU32 nbShapes, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + addSimActorToScSceneT(s, dynamicObject, npShapes, nbShapes, uninflatedBounds, bvh); +} + +void addSimActorToScScene(Sc::Scene& s, NpArticulationLink& dynamicObject, NpShape* const* npShapes, PxU32 nbShapes, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + addSimActorToScSceneT(s, dynamicObject, npShapes, nbShapes, uninflatedBounds, bvh); +} + +PX_FORCE_INLINE static void removeSimActorFromScScene(Sc::Scene& s, NpRigidStatic& staticObject, PxInlineArray& scBatchRemovedShapes, bool wakeOnLostTouch) +{ + s.removeStatic(staticObject.getCore(), scBatchRemovedShapes, wakeOnLostTouch); +} + +template +PX_FORCE_INLINE static void removeSimActorFromScSceneT(Sc::Scene& s, NpRigidBodyTemplate& dynamicObject, PxInlineArray& scBatchRemovedShapes, bool wakeOnLostTouch) +{ + s.removeBody(dynamicObject.getCore(), scBatchRemovedShapes, wakeOnLostTouch); +} + +PX_FORCE_INLINE static void removeSimActorFromScScene(Sc::Scene& s, NpRigidDynamic& dynamicObject, PxInlineArray& scBatchRemovedShapes, bool wakeOnLostTouch) +{ + removeSimActorFromScSceneT(s, dynamicObject, scBatchRemovedShapes, wakeOnLostTouch); +} + +PX_FORCE_INLINE static void removeSimActorFromScScene(Sc::Scene& s, NpArticulationLink& dynamicObject, PxInlineArray& scBatchRemovedShapes, bool wakeOnLostTouch) +{ + removeSimActorFromScSceneT(s, dynamicObject, scBatchRemovedShapes, wakeOnLostTouch); +} + +template +PX_FORCE_INLINE static void addSimActor(Sc::Scene& s, T& object, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + NpShape* const* npShapes = NULL; + const PxU32 nbShapes = getShapes(object, npShapes); + PX_ASSERT((0 == nbShapes) || npShapes); + + addSimActorToScScene(s, object, npShapes, nbShapes, uninflatedBounds, bvh); + + NpScene* scScene = object.getNpScene(); + addActorShapes(npShapes, nbShapes, &object, scScene); +} + +template +PX_FORCE_INLINE static void removeSimActor(Sc::Scene& s, T& object, bool wakeOnLostTouch) +{ + NpScene* scScene = object.getNpScene(); + + PxInlineArray localShapes; + PxInlineArray& scBatchRemovedShapes = s.getBatchRemove() ? s.getBatchRemove()->removedShapes : localShapes; + removeSimActorFromScScene(s, object, scBatchRemovedShapes, wakeOnLostTouch); + Sc::ShapeCore* const* scShapes = const_cast(scBatchRemovedShapes.begin()); + const PxU32 nbShapes = scBatchRemovedShapes.size(); + PX_ASSERT((0 == nbShapes) || scShapes); + + removeActorShapes(scShapes, nbShapes, &object, scScene); +} + +// PT: TODO: consider unifying addNonSimActor / removeNonSimActor +template +PX_FORCE_INLINE static void addNonSimActor(T& rigid) +{ + NpShape* const* npShapes = NULL; + const PxU32 nbShapes = getShapes(rigid, npShapes); + PX_ASSERT((0 == nbShapes) || npShapes); + NpScene* scScene = rigid.getNpScene(); + PX_ASSERT(scScene); + addActorShapes(npShapes, nbShapes, &rigid, scScene); +} + +template +PX_FORCE_INLINE static void removeNonSimActor(T& rigid) +{ + NpShape* const* npShapes = NULL; + const PxU32 nbShapes = getShapes(rigid, npShapes); + PX_ASSERT((0 == nbShapes) || npShapes); + NpScene* scScene = rigid.getNpScene(); + PX_ASSERT(scScene); + removeActorShapes(npShapes, nbShapes, &rigid, scScene); +} + +template struct ScSceneFns {}; + +#if PX_SUPPORT_GPU_PHYSX +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpSoftBody& v, PxBounds3*, const BVH*, bool) + { + s.addSoftBody(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpSoftBody& v, bool /*wakeOnLostTouch*/) + { + s.removeSoftBody(v.getCore()); + } +}; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpFEMCloth& v, PxBounds3*, const Gu::BVH*, bool) + { + s.addFEMCloth(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpFEMCloth& v, bool /*wakeOnLostTouch*/) + { + s.removeFEMCloth(v.getCore()); + } +}; +#endif + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpPBDParticleSystem& v, PxBounds3*, const BVH*, bool) + { + s.addParticleSystem(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpPBDParticleSystem& v, bool /*wakeOnLostTouch*/) + { + s.removeParticleSystem(v.getCore()); + } +}; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpFLIPParticleSystem& v, PxBounds3*, const BVH*, bool) + { + s.addParticleSystem(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpFLIPParticleSystem& v, bool /*wakeOnLostTouch*/) + { + s.removeParticleSystem(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpMPMParticleSystem& v, PxBounds3*, const BVH*, bool) + { + s.addParticleSystem(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpMPMParticleSystem& v, bool /*wakeOnLostTouch*/) + { + s.removeParticleSystem(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpCustomParticleSystem& v, PxBounds3*, const BVH*, bool) + { + s.addParticleSystem(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpCustomParticleSystem& v, bool /*wakeOnLostTouch*/) + { + s.removeParticleSystem(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpHairSystem& v, PxBounds3*, const BVH*, bool) + { + s.addHairSystem(v.getCore()); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpHairSystem& v, bool /*wakeOnLostTouch*/) + { + s.removeHairSystem(v.getCore()); + } +}; +#endif +#endif + + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationReducedCoordinate& v, PxBounds3*, const BVH*, bool) + { + s.addArticulation(v.getCore(), v.getRoot()->getCore()); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationReducedCoordinate& v, bool /*wakeOnLostTouch*/) + { + s.removeArticulation(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationJointReducedCoordinate& v, PxBounds3*, const BVH*, bool) + { + s.addArticulationJoint(v.getCore(), v.getParent().getCore(), v.getChild().getCore()); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationJointReducedCoordinate& v, bool /*wakeOnLostTouch*/) + { + s.removeArticulationJoint(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationSpatialTendon& v, PxBounds3*, const BVH*, bool) + { + s.addArticulationTendon(v.getTendonCore()); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationSpatialTendon& v, bool /*wakeOnLostTouch*/) + { + s.removeArticulationTendon(v.getTendonCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationFixedTendon& v, PxBounds3*, const BVH*, bool) + { + s.addArticulationTendon(v.getTendonCore()); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationFixedTendon& v, bool /*wakeOnLostTouch*/) + { + s.removeArticulationTendon(v.getTendonCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationSensor& v, PxBounds3*, const BVH*, bool) + { + s.addArticulationSensor(v.getSensorCore()); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationSensor& v, bool /*wakeOnLostTouch*/) + { + s.removeArticulationSensor(v.getSensorCore()); + } +}; + +// PT: TODO: refactor with version in NpConstraint.cpp & with NpActor::getFromPxActor +static NpActor* getNpActor(PxRigidActor* a) +{ + if(!a) + return NULL; + + const PxType type = a->getConcreteType(); + + if(type == PxConcreteType::eRIGID_DYNAMIC) + return static_cast(a); + else if(type == PxConcreteType::eARTICULATION_LINK) + return static_cast(a); + else + { + PX_ASSERT(type == PxConcreteType::eRIGID_STATIC); + return static_cast(a); + } +} + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpConstraint& v, PxBounds3*, const BVH*, bool) + { + PxRigidActor* a0, * a1; + v.getActors(a0, a1); + NpActor* sc0 = getNpActor(a0); + NpActor* sc1 = getNpActor(a1); + + PX_ASSERT((!sc0) || (!(sc0->getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))); + PX_ASSERT((!sc1) || (!(sc1->getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)))); + + s.addConstraint(v.getCore(), sc0 ? &sc0->getScRigidCore() : NULL, sc1 ? &sc1->getScRigidCore() : NULL); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpConstraint& v, bool /*wakeOnLostTouch*/) + { + s.removeConstraint(v.getCore()); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpRigidStatic& v, PxBounds3* uninflatedBounds, const BVH* bvh, bool noSim) + { + PX_ASSERT(v.getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)==noSim); + + if(!noSim) + addSimActor(s, v, uninflatedBounds, bvh); + else + addNonSimActor(v); + } + + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpRigidStatic& v, bool wakeOnLostTouch) + { + if(!v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)) + removeSimActor(s, v, wakeOnLostTouch); + else + removeNonSimActor(v); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpRigidDynamic& v, PxBounds3* uninflatedBounds, const BVH* bvh, bool noSim) + { + PX_ASSERT(v.getCore().getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)==noSim); + + if(!noSim) + addSimActor(s, v, uninflatedBounds, bvh); + else + addNonSimActor(v); + + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpRigidDynamic& v, bool wakeOnLostTouch) + { + if(!v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)) + removeSimActor(s, v, wakeOnLostTouch); + else + removeNonSimActor(v); + } +}; + +template<> struct ScSceneFns +{ + static PX_FORCE_INLINE void insert(Sc::Scene& s, NpArticulationLink& v, PxBounds3* uninflatedBounds, const BVH* bvh, bool noSim) + { + PX_UNUSED(noSim); + PX_ASSERT(!noSim); // PT: the flag isn't supported on NpArticulationLink + PX_ASSERT(!v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)); + + //if(!noSim) + addSimActor(s, v, uninflatedBounds, bvh); + //else + // addNonSimActor(v); + } + static PX_FORCE_INLINE void remove(Sc::Scene& s, NpArticulationLink& v, bool wakeOnLostTouch) + { + PX_ASSERT(!v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)); + //if(!v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)) + removeSimActor(s, v, wakeOnLostTouch); + //else + // removeNonSimActor(v); + } +}; + +/////////////////////////////////////////////////////////////////////////////// +#if PX_SUPPORT_PVD +template struct PvdFns +{ + // PT: in the following functions, checkPvdDebugFlag() is done by the callers to save time when functions are called from a loop. + + static void createInstance(NpScene& scene, Vd::PvdSceneClient& d, T* v) + { + PX_PROFILE_ZONE("PVD.createPVDInstance", scene.getScScene().getContextId()); + PX_UNUSED(scene); + d.createPvdInstance(v); + } + + static void updateInstance(NpScene& scene, Vd::PvdSceneClient& d, T* v) + { + PX_UNUSED(scene); + { + PX_PROFILE_ZONE("PVD.updatePVDProperties", scene.getScScene().getContextId()); + d.updatePvdProperties(v); + } + } + + static void releaseInstance(NpScene& scene, Vd::PvdSceneClient& d, T* v) + { + PX_UNUSED(scene); + PX_PROFILE_ZONE("PVD.releasePVDInstance", scene.getScScene().getContextId()); + d.releasePvdInstance(v); + } +}; +#endif + +/////////////////////////////////////////////////////////////////////////////// + +template +static void add(NpScene* npScene, T& v, PxBounds3* uninflatedBounds=NULL, const BVH* bvh=NULL, bool noSim=false) +{ + PX_ASSERT(!npScene->isAPIWriteForbidden()); + + v.setNpScene(npScene); + + ScSceneFns::insert(npScene->getScScene(), v, uninflatedBounds, bvh, noSim); +#if PX_SUPPORT_PVD + Vd::PvdSceneClient& pvdClient = npScene->getScenePvdClientInternal(); + if(pvdClient.checkPvdDebugFlag()) + PvdFns::createInstance(*npScene, pvdClient, &v); +#endif +} + +template +static void remove(NpScene* npScene, T& v, bool wakeOnLostTouch=false) +{ + PX_ASSERT(!npScene->isAPIWriteForbidden()); + + ScSceneFns::remove(npScene->getScScene(), v, wakeOnLostTouch); +#if PX_SUPPORT_PVD + Vd::PvdSceneClient& pvdClient = npScene->getScenePvdClientInternal(); + if(pvdClient.checkPvdDebugFlag()) + PvdFns::releaseInstance(*npScene, pvdClient, &v); +#endif + v.setNpScene(NULL); +} + +template +static void removeRigidNoSimT(NpScene* npScene, T& v) +{ + PX_ASSERT(!npScene->isAPIWriteForbidden()); + + PX_ASSERT(v.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)); + + removeNonSimActor(v); +#if PX_SUPPORT_PVD + Vd::PvdSceneClient& pvdClient = npScene->getScenePvdClientInternal(); + if(pvdClient.checkPvdDebugFlag()) + PvdFns::releaseInstance(*npScene, pvdClient, &v); +#else + PX_UNUSED(npScene); +#endif + v.setNpScene(NULL); +} + +template +static PX_FORCE_INLINE void addActorT(NpScene* npScene, T& actor, bool noSim, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + PX_ASSERT(!npScene->isAPIWriteForbidden()); + PX_PROFILE_ZONE("API.addActorToSim", npScene->getScScene().getContextId()); + if(!noSim) + { + // PT: TODO: this codepath re-tests the sim flag and actually supports both cases!!! + add(npScene, actor, uninflatedBounds, bvh, noSim); + } + else + { + PX_ASSERT(actor.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)); + actor.setNpScene(npScene); + +#if PX_SUPPORT_PVD + Vd::PvdSceneClient& pvdClient = npScene->getScenePvdClientInternal(); + if(pvdClient.checkPvdDebugFlag()) + PvdFns::createInstance(*npScene, pvdClient, &actor); +#endif + + OMNI_PVD_ADD(scene, actors, static_cast(*npScene), static_cast(actor)) + + addNonSimActor(actor); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddActor(NpRigidStatic& rigidStatic, bool noSim, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + addActorT(this, rigidStatic, noSim, uninflatedBounds, bvh); +} + +void NpScene::scAddActor(NpRigidDynamic& body, bool noSim, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + addActorT(this, body, noSim, uninflatedBounds, bvh); +} + +void NpScene::scAddActor(NpArticulationLink& body, bool noSim, PxBounds3* uninflatedBounds, const BVH* bvh) +{ + addActorT(this, body, noSim, uninflatedBounds, bvh); +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: TODO: refactor scRemoveActor for NpRigidStatic & NpRigidDynamic +void NpScene::scRemoveActor(NpRigidStatic& rigidStatic, bool wakeOnLostTouch, bool noSim) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + PX_PROFILE_ZONE("API.removeActorFromSim", getScScene().getContextId()); + + if(!noSim) + remove(this, rigidStatic, wakeOnLostTouch); + else + removeRigidNoSimT(this, rigidStatic); +} + +void NpScene::scRemoveActor(NpRigidDynamic& body, bool wakeOnLostTouch, bool noSim) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + PX_PROFILE_ZONE("API.removeActorFromSim", getScScene().getContextId()); + + if(!noSim) + remove(this, body, wakeOnLostTouch); + else + removeRigidNoSimT(this, body); +} + +void NpScene::scRemoveActor(NpArticulationLink& body, bool wakeOnLostTouch, bool noSim) +{ + PX_ASSERT(!noSim); + PX_UNUSED(noSim); + PX_ASSERT(!isAPIWriteForbidden()); + + PX_PROFILE_ZONE("API.removeActorFromSim", getScScene().getContextId()); + + remove(this, body, wakeOnLostTouch); +} + +/////////////////////////////////////////////////////////////////////////////// + +#ifdef NEW_DIRTY_SHADERS_CODE +void NpScene::addDirtyConstraint(NpConstraint* constraint) +{ + PX_ASSERT(!constraint->isDirty()); + + // PT: lock needed because PxConstraint::markDirty() can be called from multiple threads. + // PT: TODO: consider optimizing this + PxMutex::ScopedLock lock(mDirtyConstraintsLock); + mDirtyConstraints.pushBack(constraint); +} +#endif + +void NpScene::addToConstraintList(PxConstraint& constraint) +{ + NpConstraint& npConstraint = static_cast(constraint); + + add(this, npConstraint); + +#ifdef NEW_DIRTY_SHADERS_CODE + if(npConstraint.getCore().getFlags() & PxConstraintFlag::eALWAYS_UPDATE) + mAlwaysUpdatedConstraints.pushBack(&npConstraint); + else + { + // PT: mark all new constraints dirty to make sure their data is copied at least once + mDirtyConstraints.pushBack(&npConstraint); + npConstraint.getCore().setDirty(); + } +#endif +} + +void NpScene::removeFromConstraintList(PxConstraint& constraint) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + NpConstraint& npConstraint = static_cast(constraint); + +#ifdef NEW_DIRTY_SHADERS_CODE + // PT: TODO: consider optimizing this + { + if(npConstraint.getCore().isDirty()) + mDirtyConstraints.findAndReplaceWithLast(&npConstraint); + + if(npConstraint.getCore().getFlags() & PxConstraintFlag::eALWAYS_UPDATE) + mAlwaysUpdatedConstraints.findAndReplaceWithLast(&npConstraint); + } +#endif + + mScene.removeConstraint(npConstraint.getCore()); + + // Release pvd constraint immediately since delayed removal with already released ext::joints does not work, can't call callback. + RELEASE_PVD_INSTANCE(&npConstraint) + + npConstraint.setNpScene(NULL); +} + +/////////////////////////////////////////////////////////////////////////////// + +#if PX_SUPPORT_GPU_PHYSX +void NpScene::scAddSoftBody(NpSoftBody& softBody) +{ + add(this, softBody); +} + +void NpScene::scRemoveSoftBody(NpSoftBody& softBody) +{ + mScene.removeSoftBodySimControl(softBody.getCore()); + remove(this, softBody); +} + +//////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpScene::scAddFEMCloth(NpScene* npScene, NpFEMCloth& femCloth) +{ + add(npScene, femCloth, NULL, NULL); +} + +void NpScene::scRemoveFEMCloth(NpFEMCloth& femCloth) +{ + mScene.removeFEMClothSimControl(femCloth.getCore()); + remove(this, femCloth, false); +} +#endif + +//////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddParticleSystem(NpPBDParticleSystem& particleSystem) +{ + add(this, particleSystem); +} + +void NpScene::scRemoveParticleSystem(NpPBDParticleSystem& particleSystem) +{ + mScene.removeParticleSystemSimControl(particleSystem.getCore()); + remove(this, particleSystem); +} + +//////////////////////////////////////////////////////////////////////////////// + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void NpScene::scAddParticleSystem(NpFLIPParticleSystem& particleSystem) +{ + add(this, particleSystem); +} + +void NpScene::scRemoveParticleSystem(NpFLIPParticleSystem& particleSystem) +{ + mScene.removeParticleSystemSimControl(particleSystem.getCore()); + remove(this, particleSystem); +} + +//////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddParticleSystem(NpMPMParticleSystem& particleSystem) +{ + add(this, particleSystem); +} + +void NpScene::scRemoveParticleSystem(NpMPMParticleSystem& particleSystem) +{ + mScene.removeParticleSystemSimControl(particleSystem.getCore()); + remove(this, particleSystem); +} + +//////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddParticleSystem(NpCustomParticleSystem& particleSystem) +{ + add(this, particleSystem); +} + +void NpScene::scRemoveParticleSystem(NpCustomParticleSystem& particleSystem) +{ + mScene.removeParticleSystemSimControl(particleSystem.getCore()); + remove(this, particleSystem); +} +//////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddHairSystem(NpHairSystem& hairSystem) +{ + add(this, hairSystem); +} + +void NpScene::scRemoveHairSystem(NpHairSystem& hairSystem) +{ + mScene.removeHairSystemSimControl(hairSystem.getCore()); + remove(this, hairSystem); +} + +#endif +#endif + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddArticulation(NpArticulationReducedCoordinate& articulation) +{ + add(this, articulation); +} + +void NpScene::scRemoveArticulation(NpArticulationReducedCoordinate& articulation) +{ + mScene.removeArticulationSimControl(articulation.getCore()); + remove(this, articulation); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddArticulationJoint(NpArticulationJointReducedCoordinate& joint) +{ + add(this, joint); +} + +void NpScene::scRemoveArticulationJoint(NpArticulationJointReducedCoordinate& joint) +{ + remove(this, joint); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddArticulationSpatialTendon(NpArticulationSpatialTendon& tendon) +{ + add(this, tendon); +} + +void NpScene::scRemoveArticulationSpatialTendon(NpArticulationSpatialTendon& tendon) +{ + remove(this, tendon); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::scAddArticulationFixedTendon(NpArticulationFixedTendon& tendon) +{ + add(this, tendon); +} + +void NpScene::scRemoveArticulationFixedTendon(NpArticulationFixedTendon& tendon) +{ + remove(this, tendon); +} + +void NpScene::scAddArticulationSensor(NpArticulationSensor& sensor) +{ + add(this, sensor); +} +void NpScene::scRemoveArticulationSensor(NpArticulationSensor& sensor) +{ + remove(this, sensor); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpScene::createInOmniPVD(const PxSceneDesc& desc) +{ + PX_UNUSED(desc); + + OMNI_PVD_CREATE(scene, static_cast(*this)) + + OMNI_PVD_SET(scene, gravity, static_cast(*this), getGravity()) + OMNI_PVD_SET(scene, flags, static_cast(*this), getFlags()) + OMNI_PVD_SET(scene, frictionType, static_cast(*this), getFrictionType()) + OMNI_PVD_SET(scene, broadPhaseType, static_cast(*this), getBroadPhaseType()) + OMNI_PVD_SET(scene, kineKineFilteringMode, static_cast(*this), getKinematicKinematicFilteringMode()) + OMNI_PVD_SET(scene, staticKineFilteringMode, static_cast(*this), getStaticKinematicFilteringMode()) + + OMNI_PVD_SET(scene, solverType, static_cast(*this), getSolverType()) + OMNI_PVD_SET(scene, bounceThresholdVelocity, static_cast(*this), getBounceThresholdVelocity()) + OMNI_PVD_SET(scene, frictionOffsetThreshold, static_cast(*this), getFrictionOffsetThreshold()) + OMNI_PVD_SET(scene, frictionCorrelationDistance, static_cast(*this), getFrictionCorrelationDistance()) + OMNI_PVD_SET(scene, solverBatchSize, static_cast(*this), getSolverBatchSize()) + OMNI_PVD_SET(scene, solverArticulationBatchSize, static_cast(*this), getSolverArticulationBatchSize()) + OMNI_PVD_SET(scene, nbContactDataBlocks, static_cast(*this), getNbContactDataBlocksUsed()) + OMNI_PVD_SET(scene, maxNbContactDataBlocks, static_cast(*this), getMaxNbContactDataBlocksUsed())//naming problem of functions + OMNI_PVD_SET(scene, maxBiasCoefficient, static_cast(*this), getMaxBiasCoefficient()) + OMNI_PVD_SET(scene, contactReportStreamBufferSize, static_cast(*this), getContactReportStreamBufferSize()) + OMNI_PVD_SET(scene, ccdMaxPasses, static_cast(*this), getCCDMaxPasses()) + OMNI_PVD_SET(scene, ccdThreshold, static_cast(*this), getCCDThreshold()) + OMNI_PVD_SET(scene, ccdMaxSeparation, static_cast(*this), getCCDMaxSeparation()) + OMNI_PVD_SET(scene, wakeCounterResetValue, static_cast(*this), getWakeCounterResetValue()) + //OMNI_PVD_SET(scene, sceneQuerySystem, static_cast(*this), getSQAPI())//needs class + //OMNI_PVD_CREATE(scenelimits, limits)//owned temp object .. would be cool if this could be automated + OMNI_PVD_SET(scene, limitsMaxNbActors, static_cast(*this), desc.limits.maxNbActors) + OMNI_PVD_SET(scene, limitsMaxNbBodies, static_cast(*this), desc.limits.maxNbBodies) + OMNI_PVD_SET(scene, limitsMaxNbStaticShapes, static_cast(*this), desc.limits.maxNbStaticShapes) + OMNI_PVD_SET(scene, limitsMaxNbDynamicShapes, static_cast(*this), desc.limits.maxNbDynamicShapes) + OMNI_PVD_SET(scene, limitsMaxNbAggregates, static_cast(*this), desc.limits.maxNbAggregates) + OMNI_PVD_SET(scene, limitsMaxNbConstraints, static_cast(*this), desc.limits.maxNbConstraints) + OMNI_PVD_SET(scene, limitsMaxNbRegions, static_cast(*this), desc.limits.maxNbRegions) + OMNI_PVD_SET(scene, limitsMaxNbBroadPhaseOverlaps, static_cast(*this), desc.limits.maxNbBroadPhaseOverlaps) + + OMNI_PVD_SET(scene, hasCPUDispatcher, static_cast(*this), getCpuDispatcher() ? true : false) + OMNI_PVD_SET(scene, hasCUDAContextManager, static_cast(*this), getCudaContextManager() ? true : false) + OMNI_PVD_SET(scene, hasSimulationEventCallback, static_cast(*this), getSimulationEventCallback() ? true : false) + OMNI_PVD_SET(scene, hasContactModifyCallback, static_cast(*this), getContactModifyCallback() ? true : false) + OMNI_PVD_SET(scene, hasCCDContactModifyCallback, static_cast(*this), getCCDContactModifyCallback() ? true : false) + OMNI_PVD_SET(scene, hasBroadPhaseCallback, static_cast(*this), getBroadPhaseCallback() ? true : false) + OMNI_PVD_SET(scene, hasFilterCallback, static_cast(*this), getFilterCallback() ? true : false) + + //TODO: add these too, currently we don't have getter functions to retrieve them: + OMNI_PVD_SET(scene, sanityBounds, static_cast(*this), desc.sanityBounds) + OMNI_PVD_SET(scene, gpuDynamicsConfig, static_cast(*this), desc.gpuDynamicsConfig) + OMNI_PVD_SET(scene, gpuMaxNumPartitions, static_cast(*this), desc.gpuMaxNumPartitions) + OMNI_PVD_SET(scene, gpuMaxNumStaticPartitions, static_cast(*this), desc.gpuMaxNumStaticPartitions) + OMNI_PVD_SET(scene, gpuComputeVersion, static_cast(*this), desc.gpuComputeVersion) + OMNI_PVD_SET(scene, contactPairSlabSize, static_cast(*this), desc.contactPairSlabSize) + OMNI_PVD_SET(scene, tolerancesScale, static_cast(*this), desc.getTolerancesScale()) +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.h new file mode 100644 index 0000000..e5871dc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpScene.h @@ -0,0 +1,853 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SCENE_H +#define NP_SCENE_H + +#define NEW_DIRTY_SHADERS_CODE + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxSync.h" +#include "foundation/PxArray.h" +#include "foundation/PxThread.h" +#include "PxPhysXConfig.h" + +#include "CmRenderBuffer.h" +#include "CmIDPool.h" + +#if PX_SUPPORT_GPU_PHYSX + #include "device/PhysXIndicator.h" +#endif + +#include "NpSceneQueries.h" +#include "NpSceneAccessor.h" +#include "NpPruningStructure.h" + +#if PX_SUPPORT_PVD + #include "PxPhysics.h" + #include "NpPvdSceneClient.h" +#endif + +#include "ScScene.h" + +namespace physx +{ +namespace Sc +{ + class Joint; + class ConstraintBreakEvent; +} + +namespace Sq +{ + class PrunerManager; +} + +class PhysicsThread; +class NpMaterial; +class NpScene; +class NpArticulationReducedCoordinate; +class NpAggregate; +class NpObjectFactory; +class NpRigidStatic; +class NpRigidDynamic; +class NpConstraint; +class NpArticulationLink; +class NpArticulationJointReducedCoordinate; +class NpArticulationAttachment; +class NpArticulationTendonJoint; +class NpArticulationSpatialTendon; +class NpArticulationFixedTendon; +class NpArticulationSensor; +class NpShapeManager; +class NpBatchQuery; +class NpActor; +class NpShape; +class NpPhysics; + +#if PX_SUPPORT_GPU_PHYSX +class NpSoftBody; +class NpFEMCloth; +class NpHairSystem; + +class NpPBDParticleSystem; +class NpFLIPParticleSystem; +class NpMPMParticleSystem; +class NpCustomParticleSystem; +class NpFEMSoftBodyMaterial; +class NpFEMClothMaterial; +class NpPBDMaterial; +class NpFLIPMaterial; +class NpMPMMaterial; +class NpCustomMaterial; +#endif + +class NpContactCallbackTask : public physx::PxLightCpuTask +{ + NpScene* mScene; + const PxContactPairHeader* mContactPairHeaders; + uint32_t mNbContactPairHeaders; + +public: + + void setData(NpScene* scene, const PxContactPairHeader* contactPairHeaders, const uint32_t nbContactPairHeaders); + + virtual void run(); + + virtual const char* getName() const + { + return "NpContactCallbackTask"; + } +}; + +class NpScene : public NpSceneAccessor, public PxUserAllocated +{ + //virtual interfaces: + + PX_NOCOPY(NpScene) + public: + + virtual void release(); + + virtual void setFlag(PxSceneFlag::Enum flag, bool value); + virtual PxSceneFlags getFlags() const; + + // implement PxScene: + + virtual void setGravity(const PxVec3&); + virtual PxVec3 getGravity() const; + + virtual void setBounceThresholdVelocity(const PxReal t); + virtual PxReal getBounceThresholdVelocity() const; + virtual void setMaxBiasCoefficient(const PxReal t); + virtual PxReal getMaxBiasCoefficient() const; + virtual void setFrictionOffsetThreshold(const PxReal t); + virtual PxReal getFrictionOffsetThreshold() const; + virtual void setFrictionCorrelationDistance(const PxReal t); + virtual PxReal getFrictionCorrelationDistance() const; + + virtual void setLimits(const PxSceneLimits& limits); + virtual PxSceneLimits getLimits() const; + + virtual bool addActor(PxActor& actor, const PxBVH* bvh); + virtual void removeActor(PxActor& actor, bool wakeOnLostTouch); + + virtual PxU32 getNbConstraints() const; + virtual PxU32 getConstraints(PxConstraint** buffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + virtual bool addArticulation(PxArticulationReducedCoordinate&); + virtual void removeArticulation(PxArticulationReducedCoordinate&, bool wakeOnLostTouch); + + virtual PxU32 getNbArticulations() const; + virtual PxU32 getArticulations(PxArticulationReducedCoordinate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + virtual PxU32 getNbSoftBodies() const; + virtual PxU32 getSoftBodies(PxSoftBody** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; + + virtual PxU32 getNbParticleSystems(PxParticleSolverType::Enum type) const; + virtual PxU32 getParticleSystems(PxParticleSolverType::Enum type, PxParticleSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; + + virtual PxU32 getNbFEMCloths() const; + virtual PxU32 getFEMCloths(PxFEMCloth** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; + + virtual PxU32 getNbHairSystems() const; + virtual PxU32 getHairSystems(PxHairSystem** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const; + + // Aggregates + virtual bool addAggregate(PxAggregate&); + virtual void removeAggregate(PxAggregate&, bool wakeOnLostTouch); + virtual PxU32 getNbAggregates() const; + virtual PxU32 getAggregates(PxAggregate** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + virtual bool addCollection(const PxCollection& collection); + + // Groups + virtual void setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance); + virtual PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const; + + // Actors + virtual PxU32 getNbActors(PxActorTypeFlags types) const; + virtual PxU32 getActors(PxActorTypeFlags types, PxActor** buffer, PxU32 bufferSize, PxU32 startIndex=0) const; + virtual PxActor** getActiveActors(PxU32& nbActorsOut); + + // Run + virtual void getSimulationStatistics(PxSimulationStatistics& s) const; + + // Multiclient + virtual PxClientID createClient(); + + // FrictionModel + virtual PxFrictionType::Enum getFrictionType() const; + + // Callbacks + virtual void setSimulationEventCallback(PxSimulationEventCallback* callback); + virtual PxSimulationEventCallback* getSimulationEventCallback() const; + virtual void setContactModifyCallback(PxContactModifyCallback* callback); + virtual PxContactModifyCallback* getContactModifyCallback() const; + virtual void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback); + virtual PxCCDContactModifyCallback* getCCDContactModifyCallback() const; + virtual void setBroadPhaseCallback(PxBroadPhaseCallback* callback); + virtual PxBroadPhaseCallback* getBroadPhaseCallback() const; + + //CCD + virtual void setCCDMaxPasses(PxU32 ccdMaxPasses); + virtual PxU32 getCCDMaxPasses() const; + virtual void setCCDMaxSeparation(const PxReal t); + virtual PxReal getCCDMaxSeparation() const; + virtual void setCCDThreshold(const PxReal t); + virtual PxReal getCCDThreshold() const; + + // Collision filtering + virtual void setFilterShaderData(const void* data, PxU32 dataSize); + virtual const void* getFilterShaderData() const; + virtual PxU32 getFilterShaderDataSize() const; + virtual PxSimulationFilterShader getFilterShader() const; + virtual PxSimulationFilterCallback* getFilterCallback() const; + virtual bool resetFiltering(PxActor& actor); + virtual bool resetFiltering(PxRigidActor& actor, PxShape*const* shapes, PxU32 shapeCount); + virtual PxPairFilteringMode::Enum getKinematicKinematicFilteringMode() const; + virtual PxPairFilteringMode::Enum getStaticKinematicFilteringMode() const; + + // Get Physics SDK + virtual PxPhysics& getPhysics(); + + // new API methods + virtual bool simulate(PxReal elapsedTime, physx::PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation); + virtual bool advance(physx::PxBaseTask* completionTask); + virtual bool collide(PxReal elapsedTime, physx::PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation = true); + virtual bool checkResults(bool block); + virtual bool checkCollision(bool block); + virtual bool fetchCollision(bool block); + virtual bool fetchResults(bool block, PxU32* errorState); + virtual bool fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block = false); + virtual void processCallbacks(physx::PxBaseTask* continuation); + virtual void fetchResultsFinish(PxU32* errorState = 0); + + virtual void flush(bool sendPendingReports) { flushSimulation(sendPendingReports); } + virtual void flushSimulation(bool sendPendingReports); + virtual const PxRenderBuffer& getRenderBuffer(); + + virtual void setSolverBatchSize(PxU32 solverBatchSize); + virtual PxU32 getSolverBatchSize(void) const; + + virtual void setSolverArticulationBatchSize(PxU32 solverBatchSize); + virtual PxU32 getSolverArticulationBatchSize(void) const; + + virtual bool setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value); + virtual PxReal getVisualizationParameter(PxVisualizationParameter::Enum param) const; + + virtual void setVisualizationCullingBox(const PxBounds3& box); + virtual PxBounds3 getVisualizationCullingBox() const; + + virtual PxTaskManager* getTaskManager() const { return mTaskManager; } + void checkBeginWrite() const {} + + virtual PxCudaContextManager* getCudaContextManager() { return mCudaContextManager; } + + virtual void setNbContactDataBlocks(PxU32 numBlocks); + virtual PxU32 getNbContactDataBlocksUsed() const; + virtual PxU32 getMaxNbContactDataBlocksUsed() const; + + virtual PxU32 getContactReportStreamBufferSize() const; + + virtual PxU32 getTimestamp() const; + + virtual PxCpuDispatcher* getCpuDispatcher() const; + virtual PxCudaContextManager* getCudaContextManager() const; + + + virtual PxBroadPhaseType::Enum getBroadPhaseType() const; + virtual bool getBroadPhaseCaps(PxBroadPhaseCaps& caps) const; + virtual PxU32 getNbBroadPhaseRegions() const; + virtual PxU32 getBroadPhaseRegions(PxBroadPhaseRegionInfo* userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const; + virtual PxU32 addBroadPhaseRegion(const PxBroadPhaseRegion& region, bool populateRegion); + virtual bool removeBroadPhaseRegion(PxU32 handle); + + virtual bool addActors(PxActor*const* actors, PxU32 nbActors); + virtual bool addActors(const PxPruningStructure& prunerStructure); + virtual void removeActors(PxActor*const* actors, PxU32 nbActors, bool wakeOnLostTouch); + + virtual void lockRead(const char* file=NULL, PxU32 line=0); + virtual void unlockRead(); + + virtual void lockWrite(const char* file=NULL, PxU32 line=0); + virtual void unlockWrite(); + + virtual PxReal getWakeCounterResetValue() const; + + virtual void shiftOrigin(const PxVec3& shift); + + virtual PxPvdSceneClient* getScenePvdClient(); + + virtual void copyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbCopyArticulations, void* copyEvent); + virtual void applyArticulationData(void* data, void* index, PxArticulationGpuDataType::Enum dataType, const PxU32 nbUpdatedArticulations, void* waitEvent, void* signalEvent); + virtual void copyContactData(void* data, const PxU32 numContactPatches, void* numContactPairs, void* copyEvent); + + virtual void copySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbCopySoftBodies, const PxU32 maxSize, void* copyEvent); + virtual void applySoftBodyData(void** data, void* dataSizes, void* softBodyIndices, PxSoftBodyDataFlag::Enum flag, const PxU32 nbUpdatedSoftBodies, const PxU32 maxSize, void* applyEvent); + + virtual void copyBodyData(PxGpuBodyData* data, PxGpuActorPair* index, const PxU32 nbCopyActors, void* copyEvent); + virtual void applyActorData(void* data, PxGpuActorPair* index, PxActorCacheFlag::Enum flag, const PxU32 nbUpdatedActors, void* waitEvent, void* signalEvent); + + virtual void computeDenseJacobians(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent); + virtual void computeGeneralizedMassMatrices(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent); + virtual void computeGeneralizedGravityForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent); + virtual void computeCoriolisAndCentrifugalForces(const PxIndexDataPair* indices, PxU32 nbIndices, void* computeEvent); + virtual void applyParticleBufferData(const PxU32* indices, const PxGpuParticleBufferIndexPair* bufferIndexPairs, const PxParticleBufferFlags* flags, PxU32 nbUpdatedBuffers, void* waitEvent, void* signalEvent); + + virtual PxSolverType::Enum getSolverType() const; + + // NpSceneAccessor + virtual PxsSimulationController* getSimulationController(); + virtual void setActiveActors(PxActor** actors, PxU32 nbActors); + virtual PxActor** getFrozenActors(PxU32& nbActorsOut); + virtual void setFrozenActorFlag(const bool buildFrozenActors); + virtual void forceSceneQueryRebuild(); + virtual void frameEnd(); + //~NpSceneAccessor + + // PxSceneQuerySystemBase + virtual void setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint); + virtual PxU32 getDynamicTreeRebuildRateHint() const; + virtual void forceRebuildDynamicTree(PxU32 prunerIndex); + virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum updateMode); + virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const; + virtual PxU32 getStaticTimestamp() const; + virtual void flushUpdates(); + virtual bool raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, // Ray data + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + + virtual bool sweep( + const PxGeometry& geometry, const PxTransform& pose, // GeomObject data + const PxVec3& unitDir, const PxReal distance, // Ray data + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const; + + virtual bool overlap( + const PxGeometry& geometry, const PxTransform& transform, // GeomObject data + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + //~PxSceneQuerySystemBase + + // PxSceneSQSystem + virtual PxPruningStructureType::Enum getStaticStructure() const; + virtual PxPruningStructureType::Enum getDynamicStructure() const; + virtual void sceneQueriesUpdate(physx::PxBaseTask* completionTask, bool controlSimulation); + virtual bool checkQueries(bool block); + virtual bool fetchQueries(bool block); + //~PxSceneSQSystem + + //internal public methods: + public: + NpScene(const PxSceneDesc& desc, NpPhysics&); + ~NpScene(); + + PX_FORCE_INLINE NpSceneQueries& getNpSQ() { return mNpSQ; } + PX_FORCE_INLINE const NpSceneQueries& getNpSQ() const { return mNpSQ; } + + PX_FORCE_INLINE PxSceneQuerySystem& getSQAPI() { return mNpSQ.getSQAPI(); } + PX_FORCE_INLINE const PxSceneQuerySystem& getSQAPI() const { return mNpSQ.getSQAPI(); } + + PX_FORCE_INLINE PxU64 getContextId() const { return PxU64(this); } + + PX_FORCE_INLINE PxTaskManager* getTaskManagerFast() const { return mTaskManager; } + + PX_FORCE_INLINE Sc::SimulationStage::Enum getSimulationStage() const { return mScene.getSimulationStage(); } + PX_FORCE_INLINE void setSimulationStage(Sc::SimulationStage::Enum stage) { mScene.setSimulationStage(stage); } + + bool addActorInternal(PxActor& actor, const PxBVH* bvh); + void removeActorInternal(PxActor& actor, bool wakeOnLostTouch, bool removeFromAggregate); + bool addActorsInternal(PxActor*const* PX_RESTRICT actors, PxU32 nbActors, const Sq::PruningStructure* ps = NULL); + + bool addArticulationInternal(PxArticulationReducedCoordinate&); + void removeArticulationInternal(PxArticulationReducedCoordinate&, bool wakeOnLostTouch, bool removeFromAggregate); + // materials + void addMaterial(const NpMaterial& mat); + void updateMaterial(const NpMaterial& mat); + void removeMaterial(const NpMaterial& mat); +#if PX_SUPPORT_GPU_PHYSX + void addMaterial(const NpFEMSoftBodyMaterial& mat); + void updateMaterial(const NpFEMSoftBodyMaterial& mat); + void removeMaterial(const NpFEMSoftBodyMaterial& mat); + + void addMaterial(const NpFEMClothMaterial& mat); + void updateMaterial(const NpFEMClothMaterial& mat); + void removeMaterial(const NpFEMClothMaterial& mat); + + void addMaterial(const NpPBDMaterial& mat); + void updateMaterial(const NpPBDMaterial& mat); + void removeMaterial(const NpPBDMaterial& mat); + + void addMaterial(const NpFLIPMaterial& mat); + void updateMaterial(const NpFLIPMaterial& mat); + void removeMaterial(const NpFLIPMaterial& mat); + + void addMaterial(const NpMPMMaterial& mat); + void updateMaterial(const NpMPMMaterial& mat); + void removeMaterial(const NpMPMMaterial& mat); + + void addMaterial(const NpCustomMaterial& mat); + void updateMaterial(const NpCustomMaterial& mat); + void removeMaterial(const NpCustomMaterial& mat); +#endif + + void executeScene(PxBaseTask* continuation); + void executeCollide(PxBaseTask* continuation); + void executeAdvance(PxBaseTask* continuation); + void constraintBreakEventNotify(PxConstraint *const *constraints, PxU32 count); + + bool loadFromDesc(const PxSceneDesc&); + + template + void removeFromRigidActorList(T&); + void removeFromRigidDynamicList(NpRigidDynamic&); + void removeFromRigidStaticList(NpRigidStatic&); + PX_FORCE_INLINE void removeFromArticulationList(PxArticulationReducedCoordinate&); + PX_FORCE_INLINE void removeFromSoftBodyList(PxSoftBody&); + PX_FORCE_INLINE void removeFromFEMClothList(PxFEMCloth&); + PX_FORCE_INLINE void removeFromParticleSystemList(PxPBDParticleSystem&); + PX_FORCE_INLINE void removeFromParticleSystemList(PxFLIPParticleSystem&); + PX_FORCE_INLINE void removeFromParticleSystemList(PxMPMParticleSystem&); + PX_FORCE_INLINE void removeFromParticleSystemList(PxCustomParticleSystem&); + PX_FORCE_INLINE void removeFromHairSystemList(PxHairSystem&); + PX_FORCE_INLINE void removeFromAggregateList(PxAggregate&); + +#ifdef NEW_DIRTY_SHADERS_CODE + void addDirtyConstraint(NpConstraint* constraint); +#endif + void addToConstraintList(PxConstraint&); + void removeFromConstraintList(PxConstraint&); + + void addArticulationLink(NpArticulationLink& link); + void addArticulationLinkBody(NpArticulationLink& link); + void addArticulationLinkConstraint(NpArticulationLink& link); + void removeArticulationLink(NpArticulationLink& link, bool wakeOnLostTouch); + + void addArticulationAttachment(NpArticulationAttachment& attachment); + void removeArticulationAttachment(NpArticulationAttachment& attachment); + + void addArticulationTendonJoint(NpArticulationTendonJoint& joint); + void removeArticulationTendonJoint(NpArticulationTendonJoint& joint); + + void removeArticulationTendons(PxArticulationReducedCoordinate& articulation); + void removeArticulationSensors(PxArticulationReducedCoordinate& articulation); + + struct StartWriteResult + { + enum Enum { eOK, eNO_LOCK, eIN_FETCHRESULTS, eRACE_DETECTED }; + }; + + StartWriteResult::Enum startWrite(bool allowReentry); + void stopWrite(bool allowReentry); + + bool startRead() const; + void stopRead() const; + + PxU32 getReadWriteErrorCount() const { return PxU32(mConcurrentErrorCount); } + +#if PX_CHECKED + void checkPositionSanity(const PxRigidActor& a, const PxTransform& pose, const char* fnName) const; +#endif + +#if PX_SUPPORT_GPU_PHYSX + void updatePhysXIndicator(); +#else + PX_FORCE_INLINE void updatePhysXIndicator() {} +#endif + + void scAddAggregate(NpAggregate&); + void scRemoveAggregate(NpAggregate&); + + void scSwitchRigidToNoSim(NpActor&); + void scSwitchRigidFromNoSim(NpActor&); + +#if PX_SUPPORT_PVD + PX_FORCE_INLINE Vd::PvdSceneClient& getScenePvdClientInternal() { return mScenePvdClient; } + PX_FORCE_INLINE const Vd::PvdSceneClient& getScenePvdClientInternal() const { return mScenePvdClient; } +#endif + PX_FORCE_INLINE bool isAPIReadForbidden() const { return mIsAPIReadForbidden; } + PX_FORCE_INLINE void setAPIReadToForbidden() { mIsAPIReadForbidden = true; } + PX_FORCE_INLINE void setAPIReadToAllowed() { mIsAPIReadForbidden = false; } + + PX_FORCE_INLINE bool isCollisionPhaseActive() const { return mScene.isCollisionPhaseActive(); } + + PX_FORCE_INLINE bool isAPIWriteForbidden() const { return mIsAPIWriteForbidden; } + PX_FORCE_INLINE void setAPIWriteToForbidden() { mIsAPIWriteForbidden = true; } + PX_FORCE_INLINE void setAPIWriteToAllowed() { mIsAPIWriteForbidden = false; } + + PX_FORCE_INLINE const Sc::Scene& getScScene() const { return mScene; } + PX_FORCE_INLINE Sc::Scene& getScScene() { return mScene; } + + PX_FORCE_INLINE PxU32 getFlagsFast() const { return mScene.getFlags(); } + PX_FORCE_INLINE PxReal getWakeCounterResetValueInternal() const { return mWakeCounterResetValue; } + + // PT: TODO: consider merging the "sc" methods with the np ones, as we did for constraints + + void scAddActor(NpRigidStatic&, bool noSim, PxBounds3* uninflatedBounds, const Gu::BVH* bvh); + void scRemoveActor(NpRigidStatic&, bool wakeOnLostTouch, bool noSim); + void scAddActor(NpRigidDynamic&, bool noSim, PxBounds3* uninflatedBounds, const Gu::BVH* bvh); + void scRemoveActor(NpRigidDynamic&, bool wakeOnLostTouch, bool noSim); + void scAddActor(NpArticulationLink&, bool noSim, PxBounds3* uninflatedBounds, const Gu::BVH* bvh); + void scRemoveActor(NpArticulationLink&, bool wakeOnLostTouch, bool noSim); + +#if PX_SUPPORT_GPU_PHYSX + void scAddSoftBody(NpSoftBody&); + void scRemoveSoftBody(NpSoftBody&); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void scAddFEMCloth(NpScene* npScene, NpFEMCloth&); + void scRemoveFEMCloth(NpFEMCloth&); +#endif + void scAddParticleSystem(NpPBDParticleSystem&); + void scRemoveParticleSystem(NpPBDParticleSystem&); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void scAddParticleSystem(NpFLIPParticleSystem&); + void scRemoveParticleSystem(NpFLIPParticleSystem&); + + void scAddParticleSystem(NpMPMParticleSystem&); + void scRemoveParticleSystem(NpMPMParticleSystem&); + + void scAddParticleSystem(NpCustomParticleSystem&); + void scRemoveParticleSystem(NpCustomParticleSystem&); +#endif + void scAddHairSystem(NpHairSystem&); + void scRemoveHairSystem(NpHairSystem&); +#endif + void scAddArticulation(NpArticulationReducedCoordinate&); + void scRemoveArticulation(NpArticulationReducedCoordinate&); + + void scAddArticulationJoint(NpArticulationJointReducedCoordinate&); + void scRemoveArticulationJoint(NpArticulationJointReducedCoordinate&); + + void scAddArticulationSpatialTendon(NpArticulationSpatialTendon&); + void scRemoveArticulationSpatialTendon(NpArticulationSpatialTendon&); + + void scAddArticulationFixedTendon(NpArticulationFixedTendon&); + void scRemoveArticulationFixedTendon(NpArticulationFixedTendon&); + + void scAddArticulationSensor(NpArticulationSensor&); + void scRemoveArticulationSensor(NpArticulationSensor&); + + void createInOmniPVD(const PxSceneDesc& desc); + PX_FORCE_INLINE void updatePvdProperties() + { +#if PX_SUPPORT_PVD + // PT: TODO: shouldn't we test PxPvdInstrumentationFlag::eDEBUG here? + if(mScenePvdClient.isConnected()) + mScenePvdClient.updatePvdProperties(); +#endif + } + + void updateConstants(const PxArray& constraints); + + virtual PxgDynamicsMemoryConfig getGpuDynamicsConfig() const { return mGpuDynamicsConfig; } +private: + bool checkResultsInternal(bool block); + bool checkCollisionInternal(bool block); + bool checkSceneQueriesInternal(bool block); + bool simulateOrCollide(PxReal elapsedTime, physx::PxBaseTask* completionTask, void* scratchBlock, PxU32 scratchBlockSize, bool controlSimulation, const char* invalidCallMsg, Sc::SimulationStage::Enum simStage); + + bool addRigidStatic(NpRigidStatic& , const Gu::BVH* bvh, const Sq::PruningStructure* ps = NULL); + void removeRigidStatic(NpRigidStatic&, bool wakeOnLostTouch, bool removeFromAggregate); + bool addRigidDynamic(NpRigidDynamic& , const Gu::BVH* bvh, const Sq::PruningStructure* ps = NULL); + void removeRigidDynamic(NpRigidDynamic&, bool wakeOnLostTouch, bool removeFromAggregate); + + bool addSoftBody(PxSoftBody&); + void removeSoftBody(PxSoftBody&, bool wakeOnLostTouch); + + bool addParticleSystem(PxParticleSystem& particleSystem); + void removeParticleSystem(PxParticleSystem& particleSystem, bool wakeOnLostTouch); +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + bool addFEMCloth(PxFEMCloth&); + void removeFEMCloth(PxFEMCloth&, bool wakeOnLostTouch); + + bool addHairSystem(PxHairSystem&); + void removeHairSystem(PxHairSystem&, bool wakeOnLostTouch); +#endif + void visualize(); + + void updateDirtyShaders(); + + void fireOutOfBoundsCallbacks(); + void fetchResultsPreContactCallbacks(); + void fetchResultsPostContactCallbacks(); + void fetchResultsParticleSystem(); + + bool addSpatialTendonInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim); + bool addFixedTendonInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim); + + bool addArticulationSensorInternal(NpArticulationReducedCoordinate* npaRC, Sc::ArticulationSim* scArtSim); + + void syncSQ(); + void sceneQueriesStaticPrunerUpdate(PxBaseTask* continuation); + void sceneQueriesDynamicPrunerUpdate(PxBaseTask* continuation); + + NpSceneQueries mNpSQ; + PxPruningStructureType::Enum mPrunerType[2]; + typedef Cm::DelegateTask SceneQueriesStaticPrunerUpdate; + typedef Cm::DelegateTask SceneQueriesDynamicPrunerUpdate; + SceneQueriesStaticPrunerUpdate mSceneQueriesStaticPrunerUpdate; + SceneQueriesDynamicPrunerUpdate mSceneQueriesDynamicPrunerUpdate; + + Cm::RenderBuffer mRenderBuffer; + public: + Cm::IDPool mRigidActorIndexPool; + private: + PxArray mRigidDynamics; // no hash set used because it would be quite a bit slower when adding a large number of actors + PxArray mRigidStatics; // no hash set used because it would be quite a bit slower when adding a large number of actors + PxCoalescedHashSet mArticulations; + PxCoalescedHashSet mSoftBodies; + PxCoalescedHashSet mFEMCloths; + PxCoalescedHashSet mPBDParticleSystems; + PxCoalescedHashSet mFLIPParticleSystems; + PxCoalescedHashSet mMPMParticleSystems; + PxCoalescedHashSet mCustomParticleSystems; + PxCoalescedHashSet mHairSystems; + PxCoalescedHashSet mAggregates; + +#ifdef NEW_DIRTY_SHADERS_CODE + PxArray mAlwaysUpdatedConstraints; + PxArray mDirtyConstraints; + PxMutex mDirtyConstraintsLock; +#endif + + PxBounds3 mSanityBounds; +#if PX_SUPPORT_GPU_PHYSX + PhysXIndicator mPhysXIndicator; +#endif + + PxSync mPhysicsDone; // physics thread signals this when update ready + PxSync mCollisionDone; // physics thread signals this when all collisions ready + PxSync mSceneQueriesDone; // physics thread signals this when all scene queries update ready + + //legacy timing settings: + PxReal mElapsedTime; //needed to transfer the elapsed time param from the user to the sim thread. + + PxU32 mNbClients; // Tracks reserved clients for multiclient support. + + struct SceneCompletion : public Cm::Task + { + SceneCompletion(PxU64 contextId, PxSync& sync) : Cm::Task(contextId), mSync(sync){} + virtual void runInternal() {} + //ML: As soon as mSync.set is called, and the scene is shutting down, + //the scene may be deleted. That means this running task may also be deleted. + //As such, we call mSync.set() inside release() to avoid a crash because the v-table on this + //task might be deleted between the call to runInternal() and release() in the worker thread. + virtual void release() + { + //We cache the continuation pointer because this class may be deleted + //as soon as mSync.set() is called if the application releases the scene. + PxBaseTask* c = mCont; + //once mSync.set(), fetchResults() will be allowed to run. + mSync.set(); + //Call the continuation task that we cached above. If we use mCont or + //any other member variable of this class, there is a small chance + //that the variables might have become corrupted if the class + //was deleted. + if(c) c->removeReference(); + } + virtual const char* getName() const { return "NpScene.completion"; } + + // //This method just is called in the split sim approach as a way to set continuation after the task has been initialized + void setDependent(PxBaseTask* task){PX_ASSERT(mCont == NULL); mCont = task; if(task)task->addReference();} + PxSync& mSync; + private: + SceneCompletion& operator=(const SceneCompletion&); + }; + + typedef Cm::DelegateTask SceneExecution; + typedef Cm::DelegateTask SceneCollide; + typedef Cm::DelegateTask SceneAdvance; + + PxTaskManager* mTaskManager; + PxCudaContextManager* mCudaContextManager; + SceneCompletion mSceneCompletion; + SceneCompletion mCollisionCompletion; + SceneCompletion mSceneQueriesCompletion; + SceneExecution mSceneExecution; + SceneCollide mSceneCollide; + SceneAdvance mSceneAdvance; + PxSQBuildStepHandle mStaticBuildStepHandle; + PxSQBuildStepHandle mDynamicBuildStepHandle; + bool mControllingSimulation; + bool mIsAPIReadForbidden; // Set to true when the user is not allowed to call certain read APIs + // (properties that get written to during the simulation. Search the macros PX_CHECK_SCENE_API_READ_FORBIDDEN... + // to see which calls) + bool mIsAPIWriteForbidden; // Set to true when the user is not allowed to do API write calls + + PxU32 mSimThreadStackSize; + + volatile PxI32 mConcurrentWriteCount; + mutable volatile PxI32 mConcurrentReadCount; + mutable volatile PxI32 mConcurrentErrorCount; + + // TLS slot index, keeps track of re-entry depth for this thread + PxU32 mThreadReadWriteDepth; + PxThread::Id mCurrentWriter; + PxReadWriteLock mRWLock; + + bool mSQUpdateRunning; + + bool mHasSimulatedOnce; + bool mBetweenFetchResults; + bool mBuildFrozenActors; + + // + public: + enum MATERIAL_EVENT + { + MATERIAL_ADD, + MATERIAL_UPDATE, + MATERIAL_REMOVE + }; + + class MaterialEvent + { + public: + PX_FORCE_INLINE MaterialEvent(PxU16 handle, MATERIAL_EVENT type) : mHandle(handle), mType(type) {} + PX_FORCE_INLINE MaterialEvent() {} + + PxU16 mHandle;//handle to the master material table + MATERIAL_EVENT mType; + }; + private: + PxArray mSceneMaterialBuffer; + PxArray mSceneFEMSoftBodyMaterialBuffer; + PxArray mSceneFEMClothMaterialBuffer; + PxArray mScenePBDMaterialBuffer; + PxArray mSceneFLIPMaterialBuffer; + PxArray mSceneMPMMaterialBuffer; + PxArray mSceneCustomMaterialBuffer; + PxMutex mSceneMaterialBufferLock; + PxMutex mSceneFEMSoftBodyMaterialBufferLock; + PxMutex mSceneFEMClothMaterialBufferLock; + PxMutex mScenePBDMaterialBufferLock; + PxMutex mSceneFLIPMaterialBufferLock; + PxMutex mSceneMPMMaterialBufferLock; + PxMutex mSceneCustomMaterialBufferLock; + Sc::Scene mScene; +#if PX_SUPPORT_PVD + Vd::PvdSceneClient mScenePvdClient; +#endif + PxReal mWakeCounterResetValue; + + PxgDynamicsMemoryConfig mGpuDynamicsConfig; + + NpPhysics& mPhysics; +}; + +template<> +PX_FORCE_INLINE void NpScene::removeFromRigidActorList(NpRigidDynamic& rigidDynamic) +{ + removeFromRigidDynamicList(rigidDynamic); +} + +template<> +PX_FORCE_INLINE void NpScene::removeFromRigidActorList(NpRigidStatic& rigidStatic) +{ + removeFromRigidStaticList(rigidStatic); +} + +PX_FORCE_INLINE void NpScene::removeFromArticulationList(PxArticulationReducedCoordinate& articulation) +{ + const bool exists = mArticulations.erase(&articulation); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromSoftBodyList(PxSoftBody& softBody) +{ + const bool exists = mSoftBodies.erase(&softBody); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromFEMClothList(PxFEMCloth& femCloth) +{ + const bool exists = mFEMCloths.erase(&femCloth); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromParticleSystemList(PxPBDParticleSystem& particleSystem) +{ + const bool exists = mPBDParticleSystems.erase(&particleSystem); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PX_FORCE_INLINE void NpScene::removeFromParticleSystemList(PxFLIPParticleSystem& particleSystem) +{ + const bool exists = mFLIPParticleSystems.erase(&particleSystem); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromParticleSystemList(PxMPMParticleSystem& particleSystem) +{ + const bool exists = mMPMParticleSystems.erase(&particleSystem); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromParticleSystemList(PxCustomParticleSystem& particleSystem) +{ + const bool exists = mCustomParticleSystems.erase(&particleSystem); + PX_ASSERT(exists); + PX_UNUSED(exists); +} +#endif + +PX_FORCE_INLINE void NpScene::removeFromHairSystemList(PxHairSystem& hairSystem) +{ + const bool exists = mHairSystems.erase(&hairSystem); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + +PX_FORCE_INLINE void NpScene::removeFromAggregateList(PxAggregate& aggregate) +{ + const bool exists = mAggregates.erase(&aggregate); + PX_ASSERT(exists); + PX_UNUSED(exists); +} + + + PxU32 NpRigidStaticGetShapes(NpRigidStatic& rigid, NpShape* const *& shapes); + PxU32 NpRigidDynamicGetShapes(NpRigidDynamic& actor, NpShape* const *& shapes, bool* isCompound = NULL); + PxU32 NpArticulationGetShapes(NpArticulationLink& actor, NpShape* const *& shapes, bool* isCompound = NULL); + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneAccessor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneAccessor.h new file mode 100644 index 0000000..3a4fd94 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneAccessor.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SCENE_ACCESSOR_H +#define NP_SCENE_ACCESSOR_H + +#include "PxScene.h" + +namespace physx +{ + class PxsSimulationController; + + class NpSceneAccessor : public PxScene + { + PX_NOCOPY(NpSceneAccessor) + + public: + NpSceneAccessor() {} + virtual ~NpSceneAccessor() {} + + virtual PxsSimulationController* getSimulationController() = 0; + virtual void setActiveActors(PxActor** actors, PxU32 nbActors) = 0; + virtual PxActor** getFrozenActors(PxU32& nbActorsOut) = 0; + virtual void setFrozenActorFlag(const bool buildFrozenActors) = 0; + virtual void forceSceneQueryRebuild() = 0; + virtual void frameEnd() = 0; + }; +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp new file mode 100644 index 0000000..0ba46c5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneFetchResults.cpp @@ -0,0 +1,497 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpScene.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationTendon.h" +#include "NpArticulationSensor.h" +#include "NpAggregate.h" +#if PX_SUPPORT_GPU_PHYSX + #include "NpSoftBody.h" + #include "NpParticleSystem.h" + #include "NpFEMCloth.h" + #include "NpHairSystem.h" + #include "cudamanager/PxCudaContextManager.h" + #include "cudamanager/PxCudaContext.h" +#endif +#include "ScArticulationSim.h" +#include "ScArticulationTendonSim.h" +#include "CmCollection.h" +#include "PxsSimulationController.h" +#include "common/PxProfileZone.h" +#include "BpBroadPhase.h" +#include "BpAABBManagerBase.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +using namespace physx; + +bool NpScene::checkResultsInternal(bool block) +{ + PX_PROFILE_ZONE("Basic.checkResults", getContextId()); + + /*if(0 && block) + { + PxCpuDispatcher* d = mTaskManager->getCpuDispatcher(); + while(!mPhysicsDone.wait(0)) + { + PxBaseTask* nextTask = d->fetchNextTask(); + if(nextTask) + { + PX_PROFILE_ZONE(nextTask->getName(), getContextId()); + nextTask->run(); + nextTask->release(); + } + } + }*/ + + return mPhysicsDone.wait(block ? PxSync::waitForever : 0); +} + +bool NpScene::checkResults(bool block) +{ + return checkResultsInternal(block); +} + +void NpScene::fetchResultsParticleSystem() +{ + mScene.getSimulationController()->syncParticleData(); +} + +void NpScene::fireOutOfBoundsCallbacks() +{ + PX_PROFILE_ZONE("Sim.fireOutOfBoundsCallbacks", getContextId()); + + // Fire broad-phase callbacks + { + Sc::Scene& scene = mScene; + using namespace physx::Sc; + + bool outputWarning = scene.fireOutOfBoundsCallbacks(); + + // Aggregates + { + Bp::AABBManagerBase* aabbManager = scene.getAABBManager(); + + PxU32 nbOut1; + void** outAgg = aabbManager->getOutOfBoundsAggregates(nbOut1); + if(nbOut1) + { + PxBroadPhaseCallback* cb = scene.getBroadPhaseCallback(); + + for(PxU32 i=0;i(outAgg[i]); + if(cb) + cb->onObjectOutOfBounds(*px); + else + outputWarning = true; + } + aabbManager->clearOutOfBoundsAggregates(); + } + } + + if(outputWarning) + outputError(__LINE__, "At least one object is out of the broadphase bounds. To manage those objects, define a PxBroadPhaseCallback for each used client."); + } +} + +// The order of the following operations is important! +// 1. Mark the simulation as not running internally to allow reading data which should not be read otherwise +// 2. Fire callbacks with latest state. + +void NpScene::fetchResultsPreContactCallbacks() +{ +#if PX_SUPPORT_PVD + mScenePvdClient.updateContacts(); +#endif + + mScene.prepareOutOfBoundsCallbacks(); + mScene.endSimulation(); + + setAPIReadToAllowed(); + + { + PX_PROFILE_ZONE("Sim.fireCallbacksPreSync", getContextId()); + fireOutOfBoundsCallbacks(); // fire out-of-bounds callbacks + mScene.fireBrokenConstraintCallbacks(); + mScene.fireTriggerCallbacks(); + } +} + +void NpScene::fetchResultsPostContactCallbacks() +{ + mScene.postCallbacksPreSync(); + + syncSQ(); + +#if PX_SUPPORT_PVD + mScenePvdClient.updateSceneQueries(); + + mNpSQ.getSingleSqCollector().clear(); +#endif + + // fire sleep and wake-up events + { + PX_PROFILE_ZONE("Sim.fireCallbacksPostSync", getContextId()); + mScene.fireCallbacksPostSync(); + } + + mScene.postReportsCleanup(); + + // build the list of active actors + { + PX_PROFILE_ZONE("Sim.buildActiveActors", getContextId()); + + const bool buildActiveActors = (mScene.getFlags() & PxSceneFlag::eENABLE_ACTIVE_ACTORS) || OMNI_PVD_ACTIVE; + + if (buildActiveActors && mBuildFrozenActors) + mScene.buildActiveAndFrozenActors(); + else if (buildActiveActors) + mScene.buildActiveActors(); + } + + mRenderBuffer.append(mScene.getRenderBuffer()); + + PX_ASSERT(getSimulationStage() != Sc::SimulationStage::eCOMPLETE); + if (mControllingSimulation) + mTaskManager->stopSimulation(); + + setSimulationStage(Sc::SimulationStage::eCOMPLETE); + setAPIWriteToAllowed(); + + mPhysicsDone.reset(); // allow Physics to run again + mCollisionDone.reset(); +} + +bool NpScene::fetchResults(bool block, PxU32* errorState) +{ + if(getSimulationStage() != Sc::SimulationStage::eADVANCE) + return outputError(__LINE__, "PxScene::fetchResults: fetchResults() called illegally! It must be called after advance() or simulate()"); + + if(!checkResultsInternal(block)) + return false; + +#if PX_SUPPORT_GPU_PHYSX + if (mCudaContextManager) + { + if (mScene.isUsingGpuDynamicsOrBp()) + { + PxCUresult res = mCudaContextManager->getCudaContext()->getLastError(); + if (res) + { + outputError(__LINE__, "PhysX Internal CUDA error. Simulation can not continue!"); + if(errorState) + *errorState = res; + } + } + } +#endif + + { + PX_SIMD_GUARD; + + // take write check *after* simulation has finished, otherwise + // we will block simulation callbacks from using the API + // disallow re-entry to detect callbacks making write calls + NP_WRITE_CHECK_NOREENTRY(this); + + // we use cross thread profile here, to show the event in cross thread view + // PT: TODO: why do we want to show it in the cross thread view? + PX_PROFILE_START_CROSSTHREAD("Basic.fetchResults", getContextId()); + PX_PROFILE_ZONE("Sim.fetchResults", getContextId()); + + fetchResultsPreContactCallbacks(); + + { + // PT: TODO: why a cross-thread event here? + PX_PROFILE_START_CROSSTHREAD("Basic.processCallbacks", getContextId()); + mScene.fireQueuedContactCallbacks(); + PX_PROFILE_STOP_CROSSTHREAD("Basic.processCallbacks", getContextId()); + } + + fetchResultsPostContactCallbacks(); + + PX_PROFILE_STOP_CROSSTHREAD("Basic.fetchResults", getContextId()); + PX_PROFILE_STOP_CROSSTHREAD("Basic.simulate", getContextId()); + + if(errorState) + *errorState = 0; + +#if PX_SUPPORT_OMNI_PVD + OmniPvdPxSampler* omniPvdSampler = NpPhysics::getInstance().mOmniPvdSampler; + if (omniPvdSampler && omniPvdSampler->isSampling()) + { + //send all xforms updated by the sim: + PxU32 nActiveActors; + PxActor ** activeActors = mScene.getActiveActors(nActiveActors); + while (nActiveActors--) + { + PxActor * a = *activeActors++; + if ((a->getType() == PxActorType::eRIGID_STATIC) || (a->getType() == PxActorType::eRIGID_DYNAMIC)) + { + PxRigidActor* ra = static_cast(a); + PxTransform t = ra->getGlobalPose(); + OMNI_PVD_SET(actor, translation, *a, t.p) + OMNI_PVD_SET(actor, rotation, *a, t.q) + + if (a->getType() == PxActorType::eRIGID_DYNAMIC) + { + PxRigidDynamic* rdyn = static_cast(a); + + const PxVec3 linVel = rdyn->getLinearVelocity(); + OMNI_PVD_SET(actor, linearVelocity, *a, linVel) + + const PxVec3 angVel = rdyn->getAngularVelocity(); + OMNI_PVD_SET(actor, angularVelocity, *a, angVel) + + const PxRigidBodyFlags rFlags = rdyn->getRigidBodyFlags(); + OMNI_PVD_SET(actor, rigidBodyFlags, *a, rFlags) + } + + } + else if (a->getType() == PxActorType::eARTICULATION_LINK) + { + PxArticulationLink* pxArticulationParentLink = 0; + PxArticulationLink* pxArticulationLink = static_cast(a); + PxArticulationJointReducedCoordinate* pxArticulationJoint = pxArticulationLink->getInboundJoint(); + if (pxArticulationJoint) + { + pxArticulationParentLink = &(pxArticulationJoint->getParentArticulationLink()); + + PxArticulationJointReducedCoordinate & jcord = *pxArticulationJoint; + PxReal vals[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + vals[ax] = jcord.getJointPosition(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, jointPosition, jcord, vals, sizeof(vals)); + for (PxU32 ax = 0; ax < 6; ++ax) + vals[ax] = jcord.getJointVelocity(static_cast(ax)); + OMNI_PVD_SETB(articulationjoint, jointVelocity, jcord, vals, sizeof(vals)); + } + + physx::PxTransform TArtLinkLocal; + if (pxArticulationParentLink) + { + // TGlobal = TFatherGlobal * TLocal + // Inv(TFatherGlobal)* TGlobal = Inv(TFatherGlobal)*TFatherGlobal * TLocal + // Inv(TFatherGlobal)* TGlobal = TLocal + // TLocal = Inv(TFatherGlobal) * TGlobal + //physx::PxTransform TParentGlobal = pxArticulationParentLink->getGlobalPose(); + physx::PxTransform TParentGlobalInv = pxArticulationParentLink->getGlobalPose().getInverse(); + physx::PxTransform TArtLinkGlobal = pxArticulationLink->getGlobalPose(); + TArtLinkLocal = TParentGlobalInv * TArtLinkGlobal; + } + else { + TArtLinkLocal = pxArticulationLink->getGlobalPose(); + OMNI_PVD_SET(articulation, worldBounds, pxArticulationLink->getArticulation(), pxArticulationLink->getArticulation().getWorldBounds()); + } + OMNI_PVD_SET(actor, translation, *a, TArtLinkLocal.p) + OMNI_PVD_SET(actor, rotation, *a, TArtLinkLocal.q) + + const PxVec3 linVel = pxArticulationLink->getLinearVelocity(); + OMNI_PVD_SET(actor, linearVelocity, *a, linVel) + + const PxVec3 angVel = pxArticulationLink->getAngularVelocity(); + OMNI_PVD_SET(actor, angularVelocity, *a, angVel) + + const PxRigidBodyFlags rFlags = pxArticulationLink->getRigidBodyFlags(); + OMNI_PVD_SET(actor, rigidBodyFlags, *a, rFlags) + } + + const PxBounds3 worldBounds = a->getWorldBounds(); + OMNI_PVD_SET(actor, worldBounds, *a, worldBounds) + + // update active actors' joints + const PxRigidActor* ra = a->is(); + if (ra) + { + static const PxU32 MAX_CONSTRAINTS = 32; + PxConstraint* constraints[MAX_CONSTRAINTS]; + PxU32 index = 0; + while (true) + { + PxU32 count = ra->getConstraints(constraints, MAX_CONSTRAINTS, index); + for (PxU32 i = 0; i < count; ++i) + { + const NpConstraint& c = static_cast(*constraints[i]); + PxRigidActor *ra0, *ra1; c.getActors(ra0, ra1); + bool ra0static = !ra0 || !!ra0->is(), ra1static = !ra1 || !!ra1->is(); + // this check is to not update a joint twice + if ((ra == ra0 && (ra1static || ra0 > ra1)) || (ra == ra1 && (ra0static || ra1 > ra0))) + c.getCore().getPxConnector()->updateOmniPvdProperties(); + } + if (count == MAX_CONSTRAINTS) + { + index += MAX_CONSTRAINTS; + continue; + } + break; + } + } + } + + // send contacts info + omniPvdSampler->streamSceneContacts(*this); + + //end frame + omniPvdSampler->sampleScene(this); + } +#endif + } + +#if PX_SUPPORT_PVD + { + PX_SIMD_GUARD; + mScenePvdClient.frameEnd(); + } +#endif + return true; +} + +bool NpScene::fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block) +{ + if (getSimulationStage() != Sc::SimulationStage::eADVANCE) + return outputError(__LINE__, "PxScene::fetchResultsStart: fetchResultsStart() called illegally! It must be called after advance() or simulate()"); + + if (!checkResultsInternal(block)) + return false; + + PX_SIMD_GUARD; + NP_WRITE_CHECK(this); + + // we use cross thread profile here, to show the event in cross thread view + PX_PROFILE_START_CROSSTHREAD("Basic.fetchResults", getContextId()); + PX_PROFILE_ZONE("Sim.fetchResultsStart", getContextId()); + + fetchResultsPreContactCallbacks(); + + const PxArray& pairs = mScene.getQueuedContactPairHeaders(); + nbContactPairs = pairs.size(); + contactPairs = pairs.begin(); + + mBetweenFetchResults = true; + return true; +} + +void NpContactCallbackTask::setData(NpScene* scene, const PxContactPairHeader* contactPairHeaders, const uint32_t nbContactPairHeaders) +{ + mScene = scene; + mContactPairHeaders = contactPairHeaders; + mNbContactPairHeaders = nbContactPairHeaders; +} + +void NpContactCallbackTask::run() +{ + PxSimulationEventCallback* callback = mScene->getSimulationEventCallback(); + if (!callback) + return; + + mScene->lockRead(); + for (uint32_t i = 0; ionContact(pairHeader, pairHeader.pairs, pairHeader.nbPairs); + } + mScene->unlockRead(); +} + +void NpScene::processCallbacks(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Basic.processCallbacks", getContextId()); + PX_PROFILE_ZONE("Sim.processCallbacks", getContextId()); + //ML: because Apex destruction callback isn't thread safe so that we make this run single thread first + const PxArray& pairs = mScene.getQueuedContactPairHeaders(); + const PxU32 nbPairs = pairs.size(); + const PxContactPairHeader* contactPairs = pairs.begin(); + const PxU32 nbToProcess = 256; + + Cm::FlushPool* flushPool = mScene.getFlushPool(); + + for (PxU32 i = 0; i < nbPairs; i += nbToProcess) + { + NpContactCallbackTask* task = PX_PLACEMENT_NEW(flushPool->allocate(sizeof(NpContactCallbackTask)), NpContactCallbackTask)(); + task->setData(this, contactPairs+i, PxMin(nbToProcess, nbPairs - i)); + task->setContinuation(continuation); + task->removeReference(); + } +} + +void NpScene::fetchResultsFinish(PxU32* errorState) +{ +#if PX_SUPPORT_GPU_PHYSX + if (mCudaContextManager) + { + if (mScene.isUsingGpuDynamicsOrBp()) + { + if (mCudaContextManager->getCudaContext()->getLastError()) + { + outputError(__LINE__, "PhysX Internal CUDA error. Simulation can not continue!"); + if (errorState) + *errorState = mCudaContextManager->getCudaContext()->getLastError(); + } + } + } +#endif + + { + PX_SIMD_GUARD; + PX_PROFILE_STOP_CROSSTHREAD("Basic.processCallbacks", getContextId()); + PX_PROFILE_ZONE("Basic.fetchResultsFinish", getContextId()); + + mBetweenFetchResults = false; + NP_WRITE_CHECK(this); + + fetchResultsPostContactCallbacks(); + + if (errorState) + *errorState = 0; + + PX_PROFILE_STOP_CROSSTHREAD("Basic.fetchResults", getContextId()); + PX_PROFILE_STOP_CROSSTHREAD("Basic.simulate", getContextId()); +#if PX_SUPPORT_OMNI_PVD + OmniPvdPxSampler* omniPvdSampler = NpPhysics::getInstance().mOmniPvdSampler; + if (omniPvdSampler && omniPvdSampler->isSampling()) + { + omniPvdSampler->sampleScene(this); + } +#endif + } + +#if PX_SUPPORT_PVD + mScenePvdClient.frameEnd(); +#endif +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp new file mode 100644 index 0000000..6888157 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.cpp @@ -0,0 +1,798 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpSceneQueries.h" + +#include "common/PxProfileZone.h" +#include "GuBounds.h" +#include "CmTransformUtils.h" + +#include "NpShape.h" +#include "NpActor.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "GuActorShapeMap.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +#if PX_SUPPORT_PVD + #include "NpPvdSceneQueryCollector.h" +#endif + +PX_IMPLEMENT_OUTPUT_ERROR + +static PX_FORCE_INLINE NpShape* getShapeFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[0]); +} + +static PX_FORCE_INLINE NpActor* getActorFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[1]); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE ActorShapeData createActorShapeData(PrunerData data, PrunerCompoundId id) { return (ActorShapeData(id) << 32) | ActorShapeData(data); } +static PX_FORCE_INLINE PrunerData getPrunerData(ActorShapeData data) { return PrunerData(data); } +static PX_FORCE_INLINE PrunerCompoundId getCompoundID(ActorShapeData data) { return PrunerCompoundId(data >> 32); } + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class NpSqAdapter : public QueryAdapter + { + public: + NpSqAdapter() {} + virtual ~NpSqAdapter() {} + + // Adapter + virtual const PxGeometry& getGeometry(const PrunerPayload& payload) const; + //~Adapter + + // QueryAdapter + virtual PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const; + virtual void getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const; + virtual void getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const; + //~QueryAdapter + + ActorShapeMap mDatabase; + }; +} + +PrunerHandle NpSqAdapter::findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const +{ + const NpActor& npActor = NpActor::getFromPxActor(*cache.actor); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + const ActorShapeData actorShapeData = mDatabase.find(actorIndex, &npActor, static_cast(cache.shape)); + + const PrunerData prunerData = getPrunerData(actorShapeData); + compoundId = getCompoundID(actorShapeData); + + prunerIndex = getPrunerIndex(prunerData); + return getPrunerHandle(prunerData); +} + +void NpSqAdapter::getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const +{ + NpShape* npShape = getShapeFromPayload(payload); + filterData = npShape->getQueryFilterData(); +} + +void NpSqAdapter::getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const +{ + NpShape* npShape = getShapeFromPayload(payload); + NpActor* npActor = getActorFromPayload(payload); + actorShape.actor = static_cast(static_cast(npActor->getActorCore()).getPxActor()); + actorShape.shape = npShape; + PX_ASSERT(actorShape.shape == npShape->getCore().getPxShape()); +} + +const PxGeometry& NpSqAdapter::getGeometry(const PrunerPayload& payload) const +{ + NpShape* npShape = getShapeFromPayload(payload); + return npShape->getCore().getGeometry(); +} + +#if PX_SUPPORT_PVD +bool NpSceneQueries::transmitSceneQueries() +{ + if(!mPVDClient) + return false; + if(!(mPVDClient->checkPvdDebugFlag() && (mPVDClient->getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES))) + return false; + return true; +} + +void NpSceneQueries::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) +{ + mSingleSqCollector.raycast(origin, unitDir, distance, hit, hitsNum, filterData, multipleHits); +} + +void NpSceneQueries::sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) +{ + mSingleSqCollector.sweep(geometry, pose, unitDir, distance, hit, hitsNum, filterData, multipleHits); +} + +void NpSceneQueries::overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData) +{ + mSingleSqCollector.overlapMultiple(geometry, pose, hit, hitsNum, filterData); +} +#endif + +static PX_FORCE_INLINE void setPayload(PrunerPayload& pp, const NpShape* npShape, const NpActor* npActor) +{ + pp.data[0] = size_t(npShape); + pp.data[1] = size_t(npActor); +} +static PX_FORCE_INLINE bool isDynamicActor(const PxRigidActor& actor) +{ + const PxType actorType = actor.getConcreteType(); + return actorType != PxConcreteType::eRIGID_STATIC; +} + +namespace +{ + struct DatabaseCleaner : PrunerPayloadRemovalCallback + { + DatabaseCleaner(NpSqAdapter& adapter) : mAdapter(adapter){} + + virtual void invoke(PxU32 nbRemoved, const PrunerPayload* removed) + { + PxU32 actorIndex = NP_UNUSED_BASE_INDEX; + const NpActor* cachedActor = NULL; + + while(nbRemoved--) + { + const PrunerPayload& payload = *removed++; + + const NpActor* npActor = getActorFromPayload(payload); + + if(npActor!=cachedActor) + { + actorIndex = npActor->getBaseIndex(); + cachedActor = npActor; + } + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + bool status = mAdapter.mDatabase.remove(actorIndex, npActor, getShapeFromPayload(payload), NULL); + PX_ASSERT(status); + PX_UNUSED(status); + } + } + NpSqAdapter& mAdapter; + + PX_NOCOPY(DatabaseCleaner) + }; +} + +namespace +{ + class InternalPxSQ : public PxSceneQuerySystem, public PxUserAllocated + { + public: + InternalPxSQ(const PxSceneDesc& desc, PVDCapture* pvd, PxU64 contextID, Pruner* staticPruner, Pruner* dynamicPruner) : + mQueries(pvd, contextID, staticPruner, dynamicPruner, desc.dynamicTreeRebuildRateHint, SQ_PRUNER_EPSILON, desc.limits, mAdapter), + mUpdateMode (desc.sceneQueryUpdateMode), + mRefCount (1) + {} + virtual ~InternalPxSQ(){} + + PX_FORCE_INLINE Sq::PrunerManager& SQ() { return mQueries.mSQManager; } + PX_FORCE_INLINE const Sq::PrunerManager& SQ() const { return mQueries.mSQManager; } + + virtual void release() + { + mRefCount--; + if(!mRefCount) + PX_DELETE_THIS; + } + + virtual void acquireReference() + { + mRefCount++; + } + + virtual void preallocate(PxU32 prunerIndex, PxU32 nbShapes) + { + SQ().preallocate(prunerIndex, nbShapes); + } + + // PT: TODO: returning PxSQShapeHandle means we have to store them in PhysX, inside the shape manager's mSceneQueryData array. But if we'd change the API here + // and also pass the actor/shape couple instead of cached PxSQShapeHandle to functions like removeSQShape, it would simplify the internal PhysX code and truly + // decouple the SQ parts from the rest. It is unclear what the consequences would be on performance: on one hand the PxSQ implementation would need a + // hashmap or something to remap actor/shape to the SQ data, on the other hand the current code for that in PhysX is only fast for non-shared shapes. + // (see findSceneQueryData) + // + // Another appealing side-effect here is that there probably wouldn't be a "compound ID" anymore: we just pass the actor/shape couple and it's up to + // the implementation to know that this actor was added "as a compound" or not. Again, consequences on the code are unknown. We might have to just try. + // + // It might become quite tedious for the sync function though, since that one caches *PxSQPrunerHandles*. We don't want to do the "ref finding" equivalent each + // frame for each shape, so some kind of cache is needed. That probably means these cached items must appear and be handled on the PhysX/internal side of + // the API. That being said and as noted already in another part of the code: + // PT: TODO: this is similar to findPrunerData in QueryAdapter. Maybe we could unify these. + // => so the ref-finding code could stay, and just reuse findPrunerData (like the query cache). It wouldn't fully decouple the internal PhysX code from SQ, + // since we'd still store an array of "PrunerData" internally. *BUT* we could still drop mSceneQueryData. So, still worth trying. + // + // The nail in the coffin for this idea though is that we still need to provide an internal implementation of PxSQ, and that one does use mSceneQueryData. + // So we're struck with this array, unless we decide that there is NO internal implementation, and it's all moved to Extensions all the time. + // + // If we move the implementation to Extension, suddenly we need to link to SceneQuery.lib, which was not the case previously. At this point it becomes + // appealing to just move the Sq code to Gu: it solves the link errors, we could finally include it from Sc, we'd get rid of cross-DLL calls between + // Sq and Gu, etc + virtual void addSQShape( const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, + const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure) + { + const NpShape& npShape = static_cast(shape); + const NpActor& npActor = NpActor::getFromPxActor(actor); + + PrunerPayload payload; + setPayload(payload, &npShape, &npActor); + + const PrunerCompoundId pcid = compoundHandle ? PrunerCompoundId(*compoundHandle) : INVALID_COMPOUND_ID; + + const PrunerData prunerData = SQ().addPrunerShape(payload, isDynamicActor(actor), pcid, bounds, transform, hasPruningStructure); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + mAdapter.mDatabase.add(actorIndex, &npActor, &npShape, createActorShapeData(prunerData, pcid)); + } + + virtual void removeSQShape(const PxRigidActor& actor, const PxShape& shape) + { + const NpActor& npActor = NpActor::getFromPxActor(actor); + const NpShape& npShape = static_cast(shape); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + ActorShapeData actorShapeData; + mAdapter.mDatabase.remove(actorIndex, &npActor, &npShape, &actorShapeData); + + const PrunerData data = getPrunerData(actorShapeData); + const PrunerCompoundId compoundId = getCompoundID(actorShapeData); + + SQ().removePrunerShape(compoundId, data, NULL); + } + + virtual void updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform) + { + const NpActor& npActor = NpActor::getFromPxActor(actor); + const NpShape& npShape = static_cast(shape); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + const ActorShapeData actorShapeData = mAdapter.mDatabase.find(actorIndex, &npActor, &npShape); + + const PrunerData shapeHandle = getPrunerData(actorShapeData); + const PrunerCompoundId pcid = getCompoundID(actorShapeData); + + SQ().markForUpdate(pcid, shapeHandle, transform); + } + + virtual PxSQCompoundHandle addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& pxbvh, const PxTransform* transforms) + { + const BVH& bvh = static_cast(pxbvh); + + const PxU32 numSqShapes = bvh.BVH::getNbBounds(); + + const NpActor& npActor = NpActor::getFromPxActor(actor); + + PX_ALLOCA(payloads, PrunerPayload, numSqShapes); + for(PxU32 i=0; i(shapes[i]), &npActor); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + PX_ALLOCA(shapeHandles, PrunerData, numSqShapes); + SQ().addCompoundShape(bvh, PrunerCompoundId(actorIndex), actor.getGlobalPose(), shapeHandles, payloads, transforms, isDynamicActor(actor)); + + for(PxU32 i=0; i(shapes[i]), createActorShapeData(shapeHandles[i], actorIndex)); + } + + return PxSQCompoundHandle(actorIndex); + } + + virtual void removeSQCompound(PxSQCompoundHandle compoundHandle) + { + DatabaseCleaner cleaner(mAdapter); + SQ().removeCompoundActor(PrunerCompoundId(compoundHandle), &cleaner); + } + + virtual void updateSQCompound(PxSQCompoundHandle compoundHandle, const PxTransform& compoundTransform) + { + SQ().updateCompoundActor(PrunerCompoundId(compoundHandle), compoundTransform); + } + + virtual void flushUpdates() { SQ().flushUpdates(); } + virtual void flushMemory() { SQ().flushMemory(); } + virtual void visualize(PxU32 prunerIndex, PxRenderOutput& out) const { SQ().visualize(prunerIndex, out); } + virtual void shiftOrigin(const PxVec3& shift) { SQ().shiftOrigin(shift); } + virtual PxSQBuildStepHandle prepareSceneQueryBuildStep(PxU32 prunerIndex) { return SQ().prepareSceneQueriesUpdate(PruningIndex::Enum(prunerIndex)); } + virtual void sceneQueryBuildStep(PxSQBuildStepHandle handle) { SQ().sceneQueryBuildStep(handle); } + virtual void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint) { SQ().setDynamicTreeRebuildRateHint(dynTreeRebuildRateHint); } + virtual PxU32 getDynamicTreeRebuildRateHint() const { return SQ().getDynamicTreeRebuildRateHint(); } + virtual void forceRebuildDynamicTree(PxU32 prunerIndex) { SQ().forceRebuildDynamicTree(prunerIndex); } + virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const { return mUpdateMode; } + virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum mode) { mUpdateMode = mode; } + virtual PxU32 getStaticTimestamp() const { return SQ().getStaticTimestamp(); } + + virtual void finalizeUpdates() + { + switch(mUpdateMode) + { + case PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED: SQ().afterSync(true, true); break; + case PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_DISABLED: SQ().afterSync(true, false); break; + case PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED: SQ().afterSync(false, false); break; + } + } + + virtual void merge(const PxPruningStructure& pxps) + { + Pruner* staticPruner = SQ().getPruner(PruningIndex::eSTATIC); + if(staticPruner) + staticPruner->merge(pxps.getStaticMergeData()); + + Pruner* dynamicPruner = SQ().getPruner(PruningIndex::eDYNAMIC); + if(dynamicPruner) + dynamicPruner->merge(pxps.getDynamicMergeData()); + } + + virtual bool raycast( const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const + { + return mQueries._raycast(origin, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, flags); + } + + virtual bool sweep( const PxGeometry& geometry, const PxTransform& pose, + const PxVec3& unitDir, const PxReal distance, + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const + + { + return mQueries._sweep(geometry, pose, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, inflation, flags); + } + + virtual bool overlap( const PxGeometry& geometry, const PxTransform& transform, + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const + { + return mQueries._overlap( geometry, transform, hitCall, filterData, filterCall, cache, flags); + } + + virtual PxSQPrunerHandle getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const + { + const NpActor& npActor = NpActor::getFromPxActor(actor); + const NpShape& npShape = static_cast(shape); + + const PxU32 actorIndex = npActor.getBaseIndex(); + PX_ASSERT(actorIndex!=NP_UNUSED_BASE_INDEX); + + const ActorShapeData actorShapeData = mAdapter.mDatabase.find(actorIndex, &npActor, &npShape); + + const PrunerData prunerData = getPrunerData(actorShapeData); + + prunerIndex = getPrunerIndex(prunerData); + + return PxSQPrunerHandle(getPrunerHandle(prunerData)); + } + + virtual void sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) + { + PX_ASSERT(prunerIndex==PruningIndex::eDYNAMIC); + if(prunerIndex==PruningIndex::eDYNAMIC) + SQ().sync(handles, boundsIndices, bounds, transforms, count, ignoredIndices); + } + + SceneQueries mQueries; + NpSqAdapter mAdapter; + PxSceneQueryUpdateMode::Enum mUpdateMode; + PxU32 mRefCount; + }; +} + +#include "SqFactory.h" + +static CompanionPrunerType getCompanionType(PxDynamicTreeSecondaryPruner::Enum type) +{ + switch(type) + { + case PxDynamicTreeSecondaryPruner::eNONE: return COMPANION_PRUNER_NONE; + case PxDynamicTreeSecondaryPruner::eBUCKET: return COMPANION_PRUNER_BUCKET; + case PxDynamicTreeSecondaryPruner::eINCREMENTAL: return COMPANION_PRUNER_INCREMENTAL; + case PxDynamicTreeSecondaryPruner::eBVH: return COMPANION_PRUNER_AABB_TREE; + case PxDynamicTreeSecondaryPruner::eLAST: return COMPANION_PRUNER_NONE; + } + return COMPANION_PRUNER_NONE; +} + +static BVHBuildStrategy getBuildStrategy(PxBVHBuildStrategy::Enum bs) +{ + switch(bs) + { + case PxBVHBuildStrategy::eFAST: return BVH_SPLATTER_POINTS; + case PxBVHBuildStrategy::eDEFAULT: return BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER; + case PxBVHBuildStrategy::eSAH: return BVH_SAH; + case PxBVHBuildStrategy::eLAST: return BVH_SPLATTER_POINTS; + } + return BVH_SPLATTER_POINTS; +} + +static Pruner* create(PxPruningStructureType::Enum type, PxU64 contextID, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxBVHBuildStrategy::Enum buildStrategy, PxU32 nbObjectsPerNode) +{ + // PT: to force testing the bucket pruner +// return createBucketPruner(contextID); +// return createIncrementalPruner(contextID); + + const CompanionPrunerType cpType = getCompanionType(secondaryType); + const BVHBuildStrategy bs = getBuildStrategy(buildStrategy); + + Pruner* pruner = NULL; + switch(type) + { + case PxPruningStructureType::eNONE: { pruner = createBucketPruner(contextID); break; } + case PxPruningStructureType::eDYNAMIC_AABB_TREE: { pruner = createAABBPruner(contextID, true, cpType, bs, nbObjectsPerNode); break; } + case PxPruningStructureType::eSTATIC_AABB_TREE: { pruner = createAABBPruner(contextID, false, cpType, bs, nbObjectsPerNode); break; } + // PT: for tests + case PxPruningStructureType::eLAST: { pruner = createIncrementalPruner(contextID); break; } +// case PxPruningStructureType::eLAST: break; + } + return pruner; +} + +static PxSceneQuerySystem* getPxSQ(const PxSceneDesc& desc, PVDCapture* pvd, PxU64 contextID) +{ + if(desc.sceneQuerySystem) + { + desc.sceneQuerySystem->acquireReference(); + return desc.sceneQuerySystem; + } + else + { + Pruner* staticPruner = create(desc.staticStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.staticBVHBuildStrategy, desc.staticNbObjectsPerNode); + Pruner* dynamicPruner = create(desc.dynamicStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.dynamicBVHBuildStrategy, desc.dynamicNbObjectsPerNode); + return PX_NEW(InternalPxSQ)(desc, pvd, contextID, staticPruner, dynamicPruner); + } +} + +#if PX_SUPPORT_PVD + #define PVD_PARAM this +#else + #define PVD_PARAM NULL +#endif + +NpSceneQueries::NpSceneQueries(const PxSceneDesc& desc, Vd::PvdSceneClient* pvd, PxU64 contextID) : + mSQ (getPxSQ(desc, PVD_PARAM, contextID)) +#if PX_SUPPORT_PVD + // PT: warning, pvd object not created yet at this point + ,mPVDClient (pvd) + ,mSingleSqCollector (pvd, false) +#endif +{ + PX_UNUSED(pvd); + PX_UNUSED(contextID); +} + +NpSceneQueries::~NpSceneQueries() +{ + if(mSQ) + { + mSQ->release(); + mSQ = NULL; + } +} + +void NpSceneQueries::sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, + const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) +{ + mSQ->sync(prunerIndex, handles, indices, bounds, transforms, count, ignoredIndices); +} + + +#include "NpScene.h" + +// PT: TODO: eventually move NP_READ_CHECK to internal PxSQ version ? + +bool NpScene::raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + NP_READ_CHECK(this); + return mNpSQ.mSQ->raycast(origin, unitDir, distance, hits, hitFlags, filterData, filterCall, cache, flags); +} + +bool NpScene::overlap( + const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hits, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + NP_READ_CHECK(this); + return mNpSQ.mSQ->overlap(geometry, pose, hits, filterData, filterCall, cache, flags); +} + +bool NpScene::sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const +{ + NP_READ_CHECK(this); + return mNpSQ.mSQ->sweep(geometry, pose, unitDir, distance, hits, hitFlags, filterData, filterCall, cache, inflation, flags); +} + +void NpScene::setUpdateMode(PxSceneQueryUpdateMode::Enum updateMode) +{ + NP_WRITE_CHECK(this); + + getSQAPI().setUpdateMode(updateMode); + updatePvdProperties(); +} + +PxSceneQueryUpdateMode::Enum NpScene::getUpdateMode() const +{ + NP_READ_CHECK(this); + return getSQAPI().getUpdateMode(); +} + +void NpScene::setDynamicTreeRebuildRateHint(PxU32 dynamicTreeRebuildRateHint) +{ + NP_WRITE_CHECK(this); + PX_CHECK_AND_RETURN((dynamicTreeRebuildRateHint >= 4), "PxScene::setDynamicTreeRebuildRateHint(): Param has to be >= 4!"); + + getSQAPI().setDynamicTreeRebuildRateHint(dynamicTreeRebuildRateHint); + updatePvdProperties(); +} + +PxU32 NpScene::getDynamicTreeRebuildRateHint() const +{ + NP_READ_CHECK(this); + return getSQAPI().getDynamicTreeRebuildRateHint(); +} + +void NpScene::forceRebuildDynamicTree(PxU32 prunerIndex) +{ + PX_PROFILE_ZONE("API.forceDynamicTreeRebuild", getContextId()); + NP_WRITE_CHECK(this); + + PX_SIMD_GUARD; + getSQAPI().forceRebuildDynamicTree(prunerIndex); +} + +PxU32 NpScene::getStaticTimestamp() const +{ + return getSQAPI().getStaticTimestamp(); +} + +PxPruningStructureType::Enum NpScene::getStaticStructure() const +{ + return mPrunerType[0]; +} + +PxPruningStructureType::Enum NpScene::getDynamicStructure() const +{ + return mPrunerType[1]; +} + +void NpScene::flushUpdates() +{ + PX_PROFILE_ZONE("API.flushQueryUpdates", getContextId()); + NP_WRITE_CHECK(this); + + PX_SIMD_GUARD; + + getSQAPI().flushUpdates(); +} + +namespace +{ + class SqRefFinder: public Sc::SqRefFinder + { + PX_NOCOPY(SqRefFinder) + public: + SqRefFinder(const PxSceneQuerySystem& pxsq) : mPXSQ(pxsq) {} + const PxSceneQuerySystem& mPXSQ; + + virtual ScPrunerHandle find(const PxRigidBody* body, const PxShape* shape, PxU32& prunerIndex) + { + return mPXSQ.getHandle(*body, *shape, prunerIndex); + } + }; +} + +void NpScene::syncSQ() +{ + PxSceneQuerySystem& pm = getSQAPI(); + + { + const PxU32 numBodies = mScene.getNumActiveCompoundBodies(); + const Sc::BodyCore*const* bodies = mScene.getActiveCompoundBodiesArray(); + + // PT: we emulate "getGlobalPose" here by doing the equivalent matrix computation directly. + // This works because the code is the same for rigid dynamic & articulation links. + // PT: TODO: SIMD + for(PxU32 i = 0; i < numBodies; i++) + { + // PT: we don't have access to Np from here so we have to go through Px, which is a bit ugly. + // If this creates perf issues an alternative would be to just store the ID along with the body + // pointer in the active compound bodies array. + PxActor* actor = bodies[i]->getPxActor(); + PX_ASSERT(actor); + + const PxU32 id = static_cast(actor)->getInternalActorIndex(); + PX_ASSERT(id!=0xffffffff); + + pm.updateSQCompound(PxSQCompoundHandle(id), bodies[i]->getBody2World() * bodies[i]->getBody2Actor().getInverse()); + } + } + + SqRefFinder sqRefFinder(pm); + mScene.syncSceneQueryBounds(mNpSQ, sqRefFinder); + + pm.finalizeUpdates(); +} + +void NpScene::forceSceneQueryRebuild() +{ + // PT: what is this function anyway? What's the difference between this and forceDynamicTreeRebuild ? Why is the implementation different? + syncSQ(); +} + +void NpScene::sceneQueriesStaticPrunerUpdate(PxBaseTask* ) +{ + PX_PROFILE_ZONE("SceneQuery.sceneQueriesStaticPrunerUpdate", getContextId()); + // run pruner build only, this will build the new tree only, no commit happens + getSQAPI().sceneQueryBuildStep(mStaticBuildStepHandle); +} + +void NpScene::sceneQueriesDynamicPrunerUpdate(PxBaseTask*) +{ + PX_PROFILE_ZONE("SceneQuery.sceneQueriesDynamicPrunerUpdate", getContextId()); + // run pruner build only, this will build the new tree only, no commit happens + getSQAPI().sceneQueryBuildStep(mDynamicBuildStepHandle); +} + +void NpScene::sceneQueriesUpdate(PxBaseTask* completionTask, bool controlSimulation) +{ + PX_SIMD_GUARD; + + PxSQBuildStepHandle runUpdateTasksStatic = NULL; + PxSQBuildStepHandle runUpdateTasksDynamic = NULL; + { + // write guard must end before scene queries tasks kicks off worker threads + NP_WRITE_CHECK(this); + + PX_PROFILE_START_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId()); + + if(mSQUpdateRunning) + { + //fetchSceneQueries doesn't get called + outputError(__LINE__, "PxScene::fetchSceneQueries was not called!"); + return; + } + + PxSceneQuerySystem& pxsq = getSQAPI(); + + // flush scene queries updates + pxsq.flushUpdates(); + + // prepare scene queries for build - copy bounds + runUpdateTasksStatic = pxsq.prepareSceneQueryBuildStep(PX_SCENE_PRUNER_STATIC); + runUpdateTasksDynamic = pxsq.prepareSceneQueryBuildStep(PX_SCENE_PRUNER_DYNAMIC); + mStaticBuildStepHandle = runUpdateTasksStatic; + mDynamicBuildStepHandle = runUpdateTasksDynamic; + mSQUpdateRunning = true; + } + + { + PX_PROFILE_ZONE("Sim.sceneQueriesTaskSetup", getContextId()); + + if (controlSimulation) + { + { + PX_PROFILE_ZONE("Sim.resetDependencies", getContextId()); + // Only reset dependencies, etc if we own the TaskManager. Will be false + // when an NpScene is controlled by an APEX scene. + mTaskManager->resetDependencies(); + } + mTaskManager->startSimulation(); + } + + mSceneQueriesCompletion.setContinuation(*mTaskManager, completionTask); + if(runUpdateTasksStatic) + mSceneQueriesStaticPrunerUpdate.setContinuation(&mSceneQueriesCompletion); + if(runUpdateTasksDynamic) + mSceneQueriesDynamicPrunerUpdate.setContinuation(&mSceneQueriesCompletion); + + mSceneQueriesCompletion.removeReference(); + if(runUpdateTasksStatic) + mSceneQueriesStaticPrunerUpdate.removeReference(); + if(runUpdateTasksDynamic) + mSceneQueriesDynamicPrunerUpdate.removeReference(); + } +} + +bool NpScene::checkSceneQueriesInternal(bool block) +{ + PX_PROFILE_ZONE("Basic.checkSceneQueries", getContextId()); + return mSceneQueriesDone.wait(block ? PxSync::waitForever : 0); +} + +bool NpScene::checkQueries(bool block) +{ + return checkSceneQueriesInternal(block); +} + +bool NpScene::fetchQueries(bool block) +{ + if(!mSQUpdateRunning) + { + //fetchSceneQueries doesn't get called + outputError(__LINE__, "PxScene::fetchQueries: fetchQueries() called illegally! It must be called after sceneQueriesUpdate()"); + return false; + } + + if(!checkSceneQueriesInternal(block)) + return false; + + { + PX_SIMD_GUARD; + + NP_WRITE_CHECK(this); + + // we use cross thread profile here, to show the event in cross thread view + // PT: TODO: why do we want to show it in the cross thread view? + PX_PROFILE_START_CROSSTHREAD("Basic.fetchQueries", getContextId()); + + // flush updates and commit if work is done + getSQAPI().flushUpdates(); + + PX_PROFILE_STOP_CROSSTHREAD("Basic.fetchQueries", getContextId()); + PX_PROFILE_STOP_CROSSTHREAD("Basic.sceneQueriesUpdate", getContextId()); + + mSceneQueriesDone.reset(); + mSQUpdateRunning = false; + } + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.h new file mode 100644 index 0000000..f3fd341 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSceneQueries.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SCENE_QUERIES_H +#define NP_SCENE_QUERIES_H + +#include "PxSceneQueryDesc.h" + +#include "SqQuery.h" + +#include "ScSqBoundsSync.h" +#if PX_SUPPORT_PVD + #include "NpPvdSceneQueryCollector.h" + #include "NpPvdSceneClient.h" +#endif + +#include "PxSceneQuerySystem.h" + +#include "NpBounds.h" // PT: for SQ_PRUNER_EPSILON + +namespace physx +{ + class PxScene; + class PxSceneDesc; + +namespace Vd +{ + class PvdSceneClient; +} + +class NpSceneQueries : public Sc::SqBoundsSync +#if PX_SUPPORT_PVD + , public Sq::PVDCapture +#endif +{ + PX_NOCOPY(NpSceneQueries) + public: + // PT: TODO: use PxSceneQueryDesc here, but we need some SQ-specific "scene limits" + NpSceneQueries(const PxSceneDesc& desc, Vd::PvdSceneClient* pvd, PxU64 contextID); + ~NpSceneQueries(); + + PX_FORCE_INLINE PxSceneQuerySystem& getSQAPI() { PX_ASSERT(mSQ); return *mSQ; } + PX_FORCE_INLINE const PxSceneQuerySystem& getSQAPI() const { PX_ASSERT(mSQ); return *mSQ; } + + protected: + // SqBoundsSync + virtual void sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, + const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) PX_OVERRIDE; + //~SqBoundsSync + + public: + PxSceneQuerySystem* mSQ; + +#if PX_SUPPORT_PVD + Vd::PvdSceneClient* mPVDClient; + //Scene query and hits for pvd, collected in current frame + mutable Vd::PvdSceneQueryCollector mSingleSqCollector; + PX_FORCE_INLINE Vd::PvdSceneQueryCollector& getSingleSqCollector() const { return mSingleSqCollector; } + + // PVDCapture + virtual bool transmitSceneQueries(); + virtual void raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits); + virtual void sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits); + virtual void overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData); + //~PVDCapture +#endif // PX_SUPPORT_PVD +}; + +} // namespace physx, sq + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp new file mode 100644 index 0000000..b1d42bd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSerializerAdapter.cpp @@ -0,0 +1,182 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxBase.h" +#include "common/PxSerialFramework.h" +#include "common/PxSerializer.h" +#include "PxPhysicsSerialization.h" + +#include "GuHeightField.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "GuTriangleMeshBV4.h" +#include "GuTriangleMeshRTree.h" +#include "GuHeightFieldData.h" +#include "NpPruningStructure.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationReducedCoordinate.h" +#include "NpArticulationLink.h" +#include "NpArticulationSensor.h" +#include "NpMaterial.h" +#include "NpAggregate.h" + +namespace physx +{ + using namespace physx::Gu; + + template<> + void PxSerializerDefaultAdapter::registerReferences(PxBase& obj, PxSerializationContext& context) const + { + NpMaterial& t = static_cast(obj); + context.registerReference(obj, PX_SERIAL_REF_KIND_PXBASE, size_t(&obj)); + context.registerReference(obj, PX_SERIAL_REF_KIND_MATERIAL_IDX, size_t(t.mMaterial.mMaterialIndex)); + } + + template<> + void PxSerializerDefaultAdapter::registerReferences(PxBase& obj, PxSerializationContext& context) const + { + NpRigidDynamic& dynamic = static_cast(obj); + + context.registerReference(obj, PX_SERIAL_REF_KIND_PXBASE, size_t(&obj)); + + struct RequiresCallback : public PxProcessPxBaseCallback + { + RequiresCallback(physx::PxSerializationContext& c) : context(c) {} + RequiresCallback& operator=(const RequiresCallback&) { PX_ASSERT(0); return *this; } //PX_NOCOPY doesn't work for local classes + void process(PxBase& base) + { + context.registerReference(base, PX_SERIAL_REF_KIND_PXBASE, size_t(&base)); + } + PxSerializationContext& context; + }; + + RequiresCallback callback(context); + dynamic.requiresObjects(callback); + } + + template<> + bool PxSerializerDefaultAdapter::isSubordinate() const + { + return true; + } + + template<> + void PxSerializerDefaultAdapter::registerReferences(PxBase& obj, PxSerializationContext& context) const + { + NpShape& shape = static_cast(obj); + + context.registerReference(obj, PX_SERIAL_REF_KIND_PXBASE, size_t(&obj)); + + struct RequiresCallback : public PxProcessPxBaseCallback + { + RequiresCallback(physx::PxSerializationContext& c) : context(c) {} + RequiresCallback &operator=(const RequiresCallback&) { PX_ASSERT(0); return *this; } //PX_NOCOPY doesn't work for local classes + void process(PxBase& base) + { + PxMaterial* pxMaterial = base.is(); + if (!pxMaterial) + { + context.registerReference(base, PX_SERIAL_REF_KIND_PXBASE, size_t(&base)); + } + else + { + //ideally we would move this part to ScShapeCore but we don't yet have a MaterialManager available there. + const PxU16 index = static_cast(pxMaterial)->mMaterial.mMaterialIndex; + context.registerReference(base, PX_SERIAL_REF_KIND_MATERIAL_IDX, size_t(index)); + } + } + PxSerializationContext& context; + }; + + RequiresCallback callback(context); + shape.requiresObjects(callback); + } + + template<> + bool PxSerializerDefaultAdapter::isSubordinate() const + { + return true; + } + + template<> + bool PxSerializerDefaultAdapter::isSubordinate() const + { + return true; + } + +} + +using namespace physx; + +void PxRegisterPhysicsSerializers(PxSerializationRegistry& sr) +{ + sr.registerSerializer(PxConcreteType::eCONVEX_MESH, PX_NEW_SERIALIZER_ADAPTER(ConvexMesh)); + sr.registerSerializer(PxConcreteType::eTRIANGLE_MESH_BVH33, PX_NEW_SERIALIZER_ADAPTER(RTreeTriangleMesh)); + sr.registerSerializer(PxConcreteType::eTRIANGLE_MESH_BVH34, PX_NEW_SERIALIZER_ADAPTER(BV4TriangleMesh)); + sr.registerSerializer(PxConcreteType::eHEIGHTFIELD, PX_NEW_SERIALIZER_ADAPTER(HeightField)); + sr.registerSerializer(PxConcreteType::eRIGID_DYNAMIC, PX_NEW_SERIALIZER_ADAPTER(NpRigidDynamic)); + sr.registerSerializer(PxConcreteType::eRIGID_STATIC, PX_NEW_SERIALIZER_ADAPTER(NpRigidStatic)); + sr.registerSerializer(PxConcreteType::eSHAPE, PX_NEW_SERIALIZER_ADAPTER(NpShape)); + sr.registerSerializer(PxConcreteType::eMATERIAL, PX_NEW_SERIALIZER_ADAPTER(NpMaterial)); + sr.registerSerializer(PxConcreteType::eCONSTRAINT, PX_NEW_SERIALIZER_ADAPTER(NpConstraint)); + sr.registerSerializer(PxConcreteType::eAGGREGATE, PX_NEW_SERIALIZER_ADAPTER(NpAggregate)); + sr.registerSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PX_NEW_SERIALIZER_ADAPTER(NpArticulationReducedCoordinate)); + sr.registerSerializer(PxConcreteType::eARTICULATION_LINK, PX_NEW_SERIALIZER_ADAPTER(NpArticulationLink)); + sr.registerSerializer(PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE, PX_NEW_SERIALIZER_ADAPTER(NpArticulationJointReducedCoordinate)); + sr.registerSerializer(PxConcreteType::eARTICULATION_SENSOR, PX_NEW_SERIALIZER_ADAPTER(NpArticulationSensor)); + sr.registerSerializer(PxConcreteType::eARTICULATION_SPATIAL_TENDON, PX_NEW_SERIALIZER_ADAPTER(NpArticulationSpatialTendon)); + sr.registerSerializer(PxConcreteType::eARTICULATION_ATTACHMENT, PX_NEW_SERIALIZER_ADAPTER(NpArticulationAttachment)); + sr.registerSerializer(PxConcreteType::eARTICULATION_FIXED_TENDON, PX_NEW_SERIALIZER_ADAPTER(NpArticulationFixedTendon)); + sr.registerSerializer(PxConcreteType::eARTICULATION_TENDON_JOINT, PX_NEW_SERIALIZER_ADAPTER(NpArticulationTendonJoint)); + sr.registerSerializer(PxConcreteType::ePRUNING_STRUCTURE, PX_NEW_SERIALIZER_ADAPTER(Sq::PruningStructure)); +} + + +void PxUnregisterPhysicsSerializers(PxSerializationRegistry& sr) +{ + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eCONVEX_MESH)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eTRIANGLE_MESH_BVH33)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eTRIANGLE_MESH_BVH34)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eHEIGHTFIELD)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eRIGID_DYNAMIC)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eRIGID_STATIC)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eSHAPE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eMATERIAL)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eCONSTRAINT)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eAGGREGATE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_LINK)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_SENSOR)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_SPATIAL_TENDON)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_ATTACHMENT)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_FIXED_TENDON)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::eARTICULATION_TENDON_JOINT)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxConcreteType::ePRUNING_STRUCTURE)); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp new file mode 100644 index 0000000..a6c6a24 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.cpp @@ -0,0 +1,950 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpShape.h" +#include "NpCheck.h" +#include "NpRigidStatic.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "GuTetrahedronMesh.h" +#include "GuBounds.h" +#include "NpFEMCloth.h" +#include "NpSoftBody.h" + +#include "omnipvd/OmniPvdPxSampler.h" + +using namespace physx; +using namespace Sq; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +// PT: we're using mFreeSlot as a replacement for previous mExclusiveAndActorCount +static PX_FORCE_INLINE void increaseActorCount(PxU32* count) +{ + volatile PxI32* val = reinterpret_cast(count); + PxAtomicIncrement(val); +} + +static PX_FORCE_INLINE void decreaseActorCount(PxU32* count) +{ + volatile PxI32* val = reinterpret_cast(count); + PxAtomicDecrement(val); +} + +NpShape::NpShape(const PxGeometry& geometry, PxShapeFlags shapeFlags, const PxU16* materialIndices, PxU16 materialCount, bool isExclusive, PxShapeCoreFlag::Enum flag) : + PxShape (PxConcreteType::eSHAPE, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + NpBase (NpType::eSHAPE), + mActor (NULL), + mCore (geometry, shapeFlags, materialIndices, materialCount, isExclusive, flag) +{ + mFreeSlot = isExclusive ? EXCLUSIVE_MASK : 0; + + PX_ASSERT(mCore.getPxShape() == static_cast(this)); + PX_ASSERT(!PxShape::userData); + + mCore.mName = NULL; + + incMeshRefCount(); +} + +NpShape::~NpShape() +{ + decMeshRefCount(); + + const PxU32 nbMaterials = scGetNbMaterials(); + PxShapeCoreFlags flags = mCore.getCore().mShapeCoreFlags; + + if (flags & PxShapeCoreFlag::eCLOTH_SHAPE) + { +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + for (PxU32 i = 0; i < nbMaterials; i++) + RefCountable_decRefCount(*scGetMaterial(i)); +#endif + } + else if(flags & PxShapeCoreFlag::eSOFT_BODY_SHAPE) + { + for (PxU32 i = 0; i < nbMaterials; i++) + RefCountable_decRefCount(*scGetMaterial(i)); + } + else + { + for (PxU32 i = 0; i < nbMaterials; i++) + RefCountable_decRefCount(*scGetMaterial(i)); + } +} + +void NpShape::onRefCountZero() +{ + NpFactory::getInstance().onShapeRelease(this); + // see NpShape.h for ref counting semantics for shapes + NpDestroyShape(this); +} + +// PX_SERIALIZATION + +NpShape::NpShape(PxBaseFlags baseFlags) : PxShape(baseFlags), NpBase(PxEmpty), mCore(PxEmpty), mQueryFilterData(PxEmpty) +{ +} + +void NpShape::preExportDataReset() +{ + RefCountable_preExportDataReset(*this); + mFreeSlot &= EXCLUSIVE_MASK; +} + +void NpShape::exportExtraData(PxSerializationContext& context) +{ + mCore.exportExtraData(context); + context.writeName(mCore.mName); +} + +void NpShape::importExtraData(PxDeserializationContext& context) +{ + mCore.importExtraData(context); + context.readName(mCore.mName); +} + +void NpShape::requiresObjects(PxProcessPxBaseCallback& c) +{ + //meshes + PxBase* mesh = NULL; + const PxGeometry& geometry = mCore.getGeometry(); + switch(PxU32(mCore.getGeometryType())) + { + case PxGeometryType::eCONVEXMESH: mesh = static_cast(geometry).convexMesh; break; + case PxGeometryType::eHEIGHTFIELD: mesh = static_cast(geometry).heightField; break; + case PxGeometryType::eTRIANGLEMESH: mesh = static_cast(geometry).triangleMesh; break; + case PxGeometryType::eTETRAHEDRONMESH: mesh = static_cast(geometry).tetrahedronMesh; break; + } + + if(mesh) + c.process(*mesh); + + //material + const PxU32 nbMaterials = scGetNbMaterials(); + for (PxU32 i=0; i < nbMaterials; i++) + { + NpMaterial* mat = scGetMaterial(i); + c.process(*mat); + } +} + +void NpShape::resolveReferences(PxDeserializationContext& context) +{ + // getMaterials() only works after material indices have been patched. + // in order to get to the new material indices, we need access to the new materials. + // this only leaves us with the option of acquiring the material through the context given an old material index (we do have the mapping) + { + PxU32 nbIndices = mCore.getNbMaterialIndices(); + const PxU16* indices = mCore.getMaterialIndices(); + + for (PxU32 i=0; i < nbIndices; i++) + { + PxBase* base = context.resolveReference(PX_SERIAL_REF_KIND_MATERIAL_IDX, size_t(indices[i])); + PX_ASSERT(base && base->is()); + + NpMaterial& material = *static_cast(base); + mCore.resolveMaterialReference(i, material.mMaterial.mMaterialIndex); + } + } + + context.translatePxBase(mActor); + + mCore.resolveReferences(context); + + incMeshRefCount(); + + // Increment materials' refcounts in a second pass. Works better in case of failure above. + const PxU32 nbMaterials = scGetNbMaterials(); + for (PxU32 i=0; i < nbMaterials; i++) + RefCountable_incRefCount(*scGetMaterial(i)); +} + +NpShape* NpShape::createObject(PxU8*& address, PxDeserializationContext& context) +{ + NpShape* obj = PX_PLACEMENT_NEW(address, NpShape(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(NpShape); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} +//~PX_SERIALIZATION + +PxU32 NpShape::getReferenceCount() const +{ + return RefCountable_getRefCount(*this); +} + +void NpShape::acquireReference() +{ + RefCountable_incRefCount(*this); +} + +void NpShape::release() +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(RefCountable_getRefCount(*this) > 1 || getActorCount() == 0, "PxShape::release: last reference to a shape released while still attached to an actor!"); + + releaseInternal(); +} + +void NpShape::releaseInternal() +{ + RefCountable_decRefCount(*this); +} + +Sc::RigidCore& NpShape::getScRigidObjectExclusive() const +{ + const PxType actorType = mActor->getConcreteType(); + + if (actorType == PxConcreteType::eRIGID_DYNAMIC) + return static_cast(*mActor).getCore(); + else if (actorType == PxConcreteType::eARTICULATION_LINK) + return static_cast(*mActor).getCore(); + else + return static_cast(*mActor).getCore(); +} + +void NpShape::updateSQ(const char* errorMessage) +{ + PxRigidActor* actor = getActor(); + if(actor && (mCore.getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE)) + { + NpScene* scene = NpActor::getNpSceneFromActor(*actor); + NpShapeManager* shapeManager = NpActor::getShapeManager_(*actor); + if(scene) + shapeManager->markShapeForSQUpdate(scene->getSQAPI(), *this, static_cast(*actor)); + + // invalidate the pruning structure if the actor bounds changed + if(shapeManager->getPruningStructure()) + { + outputError(__LINE__, errorMessage); + shapeManager->getPruningStructure()->invalidate(mActor); + } + } +} + +#if PX_CHECKED +bool checkShape(const PxGeometry& g, const char* errorMsg); +#endif + +void NpShape::setGeometry(const PxGeometry& g) +{ + NpScene* ownerScene = getNpScene(); + NP_WRITE_CHECK(ownerScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setGeometry: shared shapes attached to actors are not writable."); +#if PX_CHECKED + if(!checkShape(g, "PxShape::setGeometry(): Invalid geometry!")) + return; +#endif + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(ownerScene, "PxShape::setGeometry() not allowed while simulation is running. Call will be ignored.") + + // PT: fixes US2117 + if(g.getType() != getGeometryTypeFast()) + { + outputError(__LINE__, "PxShape::setGeometry(): Invalid geometry type. Changing the type of the shape is not supported."); + return; + } + + PX_SIMD_GUARD; + + //Do not decrement ref count here, but instead cache the refcountable mesh pointer if we had one. + //We instead decrement the ref counter after incrementing the ref counter on the new geometry. + //This resolves a case where the user changed a property of a mesh geometry and set the same mesh geometry. If the user had + //called release() on the mesh, the ref count could hit 0 and be destroyed and then crash when we call incMeshRefCount(). + PxRefCounted* mesh = getMeshRefCountable(); + + { + Sc::RigidCore* rigidCore = getScRigidObjectSLOW(); + + if(rigidCore) + rigidCore->unregisterShapeFromNphase(mCore); + + mCore.setGeometry(g); + + if (rigidCore) + { + rigidCore->registerShapeInNphase(mCore); + rigidCore->onShapeChange(mCore, Sc::ShapeChangeNotifyFlag::eGEOMETRY); + } + +#if PX_SUPPORT_PVD + NpScene* npScene = getNpScene(); + if(npScene) + npScene->getScenePvdClientInternal().releaseAndRecreateGeometry(this); +#endif + } + + incMeshRefCount(); + + if(mesh) + RefCountable_decRefCount(*mesh); + + updateSQ("PxShape::setGeometry: Shape is a part of pruning structure, pruning structure is now invalid!"); +} + +const PxGeometry& NpShape::getGeometry() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getGeometry(); +} + +PxRigidActor* NpShape::getActor() const +{ + NP_READ_CHECK(getNpScene()); + return mActor ? mActor->is() : NULL; +} + +void NpShape::setLocalPose(const PxTransform& newShape2Actor) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(newShape2Actor.isSane(), "PxShape::setLocalPose: pose is not valid."); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setLocalPose: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setLocalPose() not allowed while simulation is running. Call will be ignored."); + + PxTransform normalizedTransform = newShape2Actor.getNormalized(); + mCore.setShape2Actor(normalizedTransform); + + notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eSHAPE2BODY); + + OMNI_PVD_SET(shape, translation, static_cast(*this), normalizedTransform.p) + OMNI_PVD_SET(shape, rotation, static_cast(*this), normalizedTransform.q) + updateSQ("PxShape::setLocalPose: Shape is a part of pruning structure, pruning structure is now invalid!"); +} + +PxTransform NpShape::getLocalPose() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getShape2Actor(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void NpShape::setSimulationFilterData(const PxFilterData& data) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setSimulationFilterData: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setSimulationFilterData() not allowed while simulation is running. Call will be ignored.") + + mCore.setSimulationFilterData(data); + + notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eFILTERDATA); + + OMNI_PVD_SET(shape, simulationFilterData, static_cast(*this), data); +} + +PxFilterData NpShape::getSimulationFilterData() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getSimulationFilterData(); +} + +void NpShape::setQueryFilterData(const PxFilterData& data) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setQueryFilterData: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setQueryFilterData() not allowed while simulation is running. Call will be ignored.") + + OMNI_PVD_SET(shape, queryFilterData, static_cast(*this), data); + + mQueryFilterData = data; + UPDATE_PVD_PROPERTY +} + +PxFilterData NpShape::getQueryFilterData() const +{ + NP_READ_CHECK(getNpScene()); + return getQueryFilterDataFast(); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +void NpShape::setMaterialsInternal(PxMaterialType* const * materials, PxU16 materialCount) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setMaterials: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setMaterials() not allowed while simulation is running. Call will be ignored.") + +#if PX_CHECKED + if (!NpShape::checkMaterialSetup(mCore.getGeometry(), "PxShape::setMaterials()", materials, materialCount)) + return; +#endif + + const PxU32 oldMaterialCount = scGetNbMaterials(); + PX_ALLOCA(oldMaterials, PxMaterialType*, oldMaterialCount); + PxU32 tmp = scGetMaterials(oldMaterials, oldMaterialCount); + PX_ASSERT(tmp == oldMaterialCount); + PX_UNUSED(tmp); + + const bool ret = setMaterialsHelper(materials, materialCount); +#if PX_SUPPORT_PVD + if (npScene) + npScene->getScenePvdClientInternal().updateMaterials(this); +#endif + +#if PX_SUPPORT_OMNI_PVD + streamShapeMaterials((physx::PxShape*)this, (physx::PxMaterial**)materials, materialCount); +#endif + + if (ret) + { + for (PxU32 i = 0; i < materialCount; i++) + RefCountable_incRefCount(*materials[i]); + + for (PxU32 i = 0; i < oldMaterialCount; i++) + RefCountable_decRefCount(*oldMaterials[i]); + } +} + +void NpShape::setMaterials(PxMaterial*const* materials, PxU16 materialCount) +{ + PX_CHECK_AND_RETURN(!(mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE), "NpShape::setMaterials: cannot set rigid body materials to a soft body shape!"); + PX_CHECK_AND_RETURN(!(mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "NpShape::setMaterials: cannot set rigid body materials to a cloth shape!"); + setMaterialsInternal(materials, materialCount); +} +void NpShape::setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount) +{ +#if PX_SUPPORT_GPU_PHYSX + PX_CHECK_AND_RETURN((mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE), "NpShape::setMaterials: can only apply soft body materials to a soft body shape!"); + + setMaterialsInternal(materials, materialCount); + if (this->mActor) + { + static_cast(mActor)->updateMaterials(); + } +#else + PX_UNUSED(materials); + PX_UNUSED(materialCount); +#endif +} + +void NpShape::setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) +{ +#if PX_SUPPORT_GPU_PHYSX && PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + + PX_CHECK_AND_RETURN((mCore.getCore().mShapeCoreFlags & PxShapeCoreFlag::eCLOTH_SHAPE), "NpShape::setMaterials: can only apply cloth materials to a cloth shape!"); + + setMaterialsInternal(materials, materialCount); +#else + PX_UNUSED(materials); + PX_UNUSED(materialCount); +#endif +} + +PxU16 NpShape::getNbMaterials() const +{ + NP_READ_CHECK(getNpScene()); + return scGetNbMaterials(); +} + +PxU32 NpShape::getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return scGetMaterials(userBuffer, bufferSize, startIndex); +} + +PxU32 NpShape::getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return scGetMaterials(userBuffer, bufferSize, startIndex); +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +PxU32 NpShape::getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + NP_READ_CHECK(getNpScene()); + return scGetMaterials(userBuffer, bufferSize, startIndex); +} +#else +PxU32 NpShape::getClothMaterials(PxFEMClothMaterial**, PxU32, PxU32) const +{ + return 0; +} +#endif + +PxBaseMaterial* NpShape::getMaterialFromInternalFaceIndex(PxU32 faceIndex) const +{ + NP_READ_CHECK(getNpScene()); + + bool isHf = (getGeometryType() == PxGeometryType::eHEIGHTFIELD); + bool isMesh = (getGeometryType() == PxGeometryType::eTRIANGLEMESH); + + // if SDF tri-mesh, where no multi-material setup is allowed, return zero-index material + if (isMesh) + { + PxTriangleMeshGeometry triGeo; + getTriangleMeshGeometry(triGeo); + if (triGeo.triangleMesh->getSDF()) + { + return getMaterial(0); + } + } + + if( faceIndex == 0xFFFFffff && (isHf || isMesh) ) + { + outputError(__LINE__, "PxShape::getMaterialFromInternalFaceIndex received 0xFFFFffff as input - returning NULL."); + return NULL; + } + + PxMaterialTableIndex hitMatTableId = 0; + + if(isHf) + { + PxHeightFieldGeometry hfGeom; + getHeightFieldGeometry(hfGeom); + + hitMatTableId = hfGeom.heightField->getTriangleMaterialIndex(faceIndex); + } + else if(isMesh) + { + PxTriangleMeshGeometry triGeo; + getTriangleMeshGeometry(triGeo); + + Gu::TriangleMesh* tm = static_cast(triGeo.triangleMesh); + if(tm->hasPerTriangleMaterials()) + hitMatTableId = triGeo.triangleMesh->getTriangleMaterialIndex(faceIndex); + } + + // PT: TODO: what's going on here? + return getMaterial(hitMatTableId); +} + +void NpShape::setContactOffset(PxReal contactOffset) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(contactOffset), "PxShape::setContactOffset: invalid float"); + PX_CHECK_AND_RETURN((contactOffset >= 0.0f && contactOffset > mCore.getRestOffset()), "PxShape::setContactOffset: contactOffset should be positive, and greater than restOffset!"); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setContactOffset: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setContactOffset() not allowed while simulation is running. Call will be ignored.") + + mCore.setContactOffset(contactOffset); + + notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eCONTACTOFFSET); + + OMNI_PVD_SET(shape, contactOffset, static_cast(*this), contactOffset) +} + +PxReal NpShape::getContactOffset() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getContactOffset(); +} + +void NpShape::setRestOffset(PxReal restOffset) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(restOffset), "PxShape::setRestOffset: invalid float"); + PX_CHECK_AND_RETURN((restOffset < mCore.getContactOffset()), "PxShape::setRestOffset: restOffset should be less than contactOffset!"); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setRestOffset: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setRestOffset() not allowed while simulation is running. Call will be ignored.") + + mCore.setRestOffset(restOffset); + + notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eRESTOFFSET); + + OMNI_PVD_SET(shape, restOffset, static_cast(*this), restOffset) +} + +PxReal NpShape::getRestOffset() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getRestOffset(); +} + +void NpShape::setDensityForFluid(PxReal densityForFluid) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(densityForFluid), "PxShape::setDensityForFluid: invalid float"); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setDensityForFluid: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setDensityForFluid() not allowed while simulation is running. Call will be ignored.") + + mCore.setDensityForFluid(densityForFluid); + + ///notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlag::eRESTOFFSET); + + OMNI_PVD_SET(shape, densityForFluid, static_cast(*this), densityForFluid); +} + +PxReal NpShape::getDensityForFluid() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getDensityForFluid(); +} + +void NpShape::setTorsionalPatchRadius(PxReal radius) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(radius), "PxShape::setTorsionalPatchRadius: invalid float"); + PX_CHECK_AND_RETURN((radius >= 0.f), "PxShape::setTorsionalPatchRadius: must be >= 0.f"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setTorsionalPatchRadius() not allowed while simulation is running. Call will be ignored.") + +// const PxShapeFlags oldShapeFlags = mShape.getFlags(); + mCore.setTorsionalPatchRadius(radius); + + OMNI_PVD_SET(shape, torsionalPatchRadius, static_cast(*this), radius); + +// shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed. +// Sc::RigidCore* rigidCore = NpShapeGetScRigidObjectFromScSLOW(); +// if(rigidCore) +// rigidCore->onShapeChange(mShape, Sc::ShapeChangeNotifyFlag::eFLAGS, oldShapeFlags); + + UPDATE_PVD_PROPERTY +} + +PxReal NpShape::getTorsionalPatchRadius() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getTorsionalPatchRadius(); +} + +void NpShape::setMinTorsionalPatchRadius(PxReal radius) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(PxIsFinite(radius), "PxShape::setMinTorsionalPatchRadius: invalid float"); + PX_CHECK_AND_RETURN((radius >= 0.f), "PxShape::setMinTorsionalPatchRadius: must be >= 0.f"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setMinTorsionalPatchRadius() not allowed while simulation is running. Call will be ignored.") + +// const PxShapeFlags oldShapeFlags = mShape.getFlags(); + mCore.setMinTorsionalPatchRadius(radius); + + OMNI_PVD_SET(shape, minTorsionalPatchRadius, static_cast(*this), radius); + +// Sc::RigidCore* rigidCore = NpShapeGetScRigidObjectFromSbSLOW(); +// if(rigidCore) +// rigidCore->onShapeChange(mShape, Sc::ShapeChangeNotifyFlag::eFLAGS, oldShapeFlags); + + UPDATE_PVD_PROPERTY +} + +PxReal NpShape::getMinTorsionalPatchRadius() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getMinTorsionalPatchRadius(); +} + +void NpShape::setFlagsInternal(PxShapeFlags inFlags) +{ + const bool hasMeshTypeGeom = mCore.getGeometryType() == PxGeometryType::eTRIANGLEMESH || mCore.getGeometryType() == PxGeometryType::eHEIGHTFIELD; + + if(hasMeshTypeGeom && (inFlags & PxShapeFlag::eTRIGGER_SHAPE)) + { + outputError(__LINE__, "PxShape::setFlag(s): triangle mesh and heightfield triggers are not supported!"); + return; + } + + if((inFlags & PxShapeFlag::eSIMULATION_SHAPE) && (inFlags & PxShapeFlag::eTRIGGER_SHAPE)) + { + outputError(__LINE__, "PxShape::setFlag(s): shapes cannot simultaneously be trigger shapes and simulation shapes."); + return; + } + + const PxShapeFlags oldFlags = mCore.getFlags(); + + const bool oldIsSimShape = oldFlags & PxShapeFlag::eSIMULATION_SHAPE; + const bool isSimShape = inFlags & PxShapeFlag::eSIMULATION_SHAPE; + + if(mActor) + { + const PxType type = mActor->getConcreteType(); + + // PT: US5732 - support kinematic meshes + bool isKinematic = false; + if(type==PxConcreteType::eRIGID_DYNAMIC) + { + PxRigidDynamic* rigidDynamic = static_cast(mActor); + isKinematic = rigidDynamic->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC; + } + + if((type != PxConcreteType::eRIGID_STATIC) && !isKinematic && isSimShape && !oldIsSimShape && (hasMeshTypeGeom || mCore.getGeometryType() == PxGeometryType::ePLANE)) + { + outputError(__LINE__, "PxShape::setFlag(s): triangle mesh, heightfield and plane shapes can only be simulation shapes if part of a PxRigidStatic!"); + return; + } + } + + const bool oldHasSceneQuery = oldFlags & PxShapeFlag::eSCENE_QUERY_SHAPE; + const bool hasSceneQuery = inFlags & PxShapeFlag::eSCENE_QUERY_SHAPE; + + { + PX_ASSERT(!isAPIWriteForbidden()); + const PxShapeFlags oldShapeFlags = mCore.getFlags(); + mCore.setFlags(inFlags); + + notifyActorAndUpdatePVD(oldShapeFlags); + } + + PxRigidActor* actor = getActor(); + if(oldHasSceneQuery != hasSceneQuery && actor) + { + NpScene* npScene = getNpScene(); + NpShapeManager* shapeManager = NpActor::getShapeManager_(*actor); + if(npScene) + { + if(hasSceneQuery) + { + // PT: SQ_CODEPATH3 + shapeManager->setupSceneQuery(npScene->getSQAPI(), NpActor::getFromPxActor(*actor), *actor, *this); + } + else + { + shapeManager->teardownSceneQuery(npScene->getSQAPI(), *actor, *this); + } + } + + // invalidate the pruning structure if the actor bounds changed + if(shapeManager->getPruningStructure()) + { + outputError(__LINE__, "PxShape::setFlag: Shape is a part of pruning structure, pruning structure is now invalid!"); + shapeManager->getPruningStructure()->invalidate(mActor); + } + } +} + +void NpShape::setFlag(PxShapeFlag::Enum flag, bool value) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setFlag: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setFlag() not allowed while simulation is running. Call will be ignored.") + + PX_SIMD_GUARD; + + PxShapeFlags shapeFlags = mCore.getFlags(); + shapeFlags = value ? shapeFlags | flag : shapeFlags & ~flag; + + setFlagsInternal(shapeFlags); + + OMNI_PVD_SET(shape, shapeFlags, static_cast(*this), shapeFlags); +} + +void NpShape::setFlags(PxShapeFlags inFlags) +{ + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setFlags: shared shapes attached to actors are not writable."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxShape::setFlags() not allowed while simulation is running. Call will be ignored.") + + PX_SIMD_GUARD; + + setFlagsInternal(inFlags); + + OMNI_PVD_SET(shape, shapeFlags, static_cast(*this), inFlags); +} + +PxShapeFlags NpShape::getFlags() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.getFlags(); +} + +bool NpShape::isExclusive() const +{ + NP_READ_CHECK(getNpScene()); + return isExclusiveFast(); +} + +void NpShape::onActorAttach(PxActor& actor) +{ + RefCountable_incRefCount(*this); + if(isExclusiveFast()) + mActor = &actor; + increaseActorCount(&mFreeSlot); +} + +void NpShape::onActorDetach() +{ + PX_ASSERT(getActorCount() > 0); + decreaseActorCount(&mFreeSlot); + if(isExclusiveFast()) + mActor = NULL; + RefCountable_decRefCount(*this); +} + +void NpShape::incActorCount() +{ + RefCountable_incRefCount(*this); + increaseActorCount(&mFreeSlot); +} + +void NpShape::decActorCount() +{ + PX_ASSERT(getActorCount() > 0); + decreaseActorCount(&mFreeSlot); + RefCountable_decRefCount(*this); +} + +void NpShape::setName(const char* debugName) +{ + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(isWritable(), "PxShape::setName: shared shapes attached to actors are not writable."); + + mCore.mName = debugName; + + UPDATE_PVD_PROPERTY +} + +const char* NpShape::getName() const +{ + NP_READ_CHECK(getNpScene()); + return mCore.mName; +} + +/////////////////////////////////////////////////////////////////////////////// + +// see NpConvexMesh.h, NpHeightField.h, NpTriangleMesh.h for details on how ref counting works for meshes +PxRefCounted* NpShape::getMeshRefCountable() +{ + const PxGeometry& geometry = mCore.getGeometry(); + switch(PxU32(mCore.getGeometryType())) + { + case PxGeometryType::eCONVEXMESH: return static_cast(geometry).convexMesh; + case PxGeometryType::eHEIGHTFIELD: return static_cast(geometry).heightField; + case PxGeometryType::eTRIANGLEMESH: return static_cast(geometry).triangleMesh; + case PxGeometryType::eTETRAHEDRONMESH: return static_cast(geometry).tetrahedronMesh; + default: + break; + } + return NULL; +} + +bool NpShape::isWritable() +{ + // a shape is writable if it's exclusive, or it's not connected to any actors (which is true if the ref count is 1 and the user ref is not released.) + return isExclusiveFast() || (RefCountable_getRefCount(*this)==1 && (mBaseFlags & PxBaseFlag::eIS_RELEASABLE)); +} + +void NpShape::incMeshRefCount() +{ + PxRefCounted* mesh = getMeshRefCountable(); + if(mesh) + RefCountable_incRefCount(*mesh); +} + +void NpShape::decMeshRefCount() +{ + PxRefCounted* mesh = getMeshRefCountable(); + if(mesh) + RefCountable_decRefCount(*mesh); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +bool NpShape::setMaterialsHelper(PxMaterialType* const* materials, PxU16 materialCount) +{ + PX_ASSERT(!isAPIWriteForbidden()); + + if(materialCount == 1) + { + const PxU16 materialIndex = static_cast(materials[0])->mMaterial.mMaterialIndex; + + mCore.setMaterialIndices(&materialIndex, 1); + } + else + { + PX_ASSERT(materialCount > 1); + + PX_ALLOCA(materialIndices, PxU16, materialCount); + + if(materialIndices) + { + NpMaterialType::getMaterialIndices(materials, materialIndices, materialCount); + mCore.setMaterialIndices(materialIndices, materialCount); + } + else + return outputError(__LINE__, "PxShape::setMaterials() failed. Out of memory. Call will be ignored."); + } + + NpScene* npScene = getNpScene(); + if(npScene) + npScene->getScScene().notifyNphaseOnUpdateShapeMaterial(mCore); + + return true; +} + +void NpShape::notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlags notifyFlags) +{ + // shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed. + if(mActor) + { + Sc::RigidCore* rigidCore = getScRigidObjectSLOW(); + if(rigidCore) + rigidCore->onShapeChange(mCore, notifyFlags); + +#if PX_SUPPORT_GPU_PHYSX + const PxType type = mActor->getConcreteType(); + #if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + if(type==PxConcreteType::eFEM_CLOTH) + static_cast(mActor)->getCore().onShapeChange(mCore, notifyFlags); + #endif + if(type==PxConcreteType::eSOFT_BODY) + static_cast(mActor)->getCore().onShapeChange(mCore, notifyFlags); +#endif + } + + UPDATE_PVD_PROPERTY +} + +void NpShape::notifyActorAndUpdatePVD(const PxShapeFlags oldShapeFlags) +{ + // shared shapes return NULL. But shared shapes aren't mutable when attached to an actor, so no notification needed. + Sc::RigidCore* rigidCore = getScRigidObjectSLOW(); + if(rigidCore) + rigidCore->onShapeFlagsChange(mCore, oldShapeFlags); + + UPDATE_PVD_PROPERTY +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.h new file mode 100644 index 0000000..28bf9ef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShape.h @@ -0,0 +1,346 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SHAPE_H +#define NP_SHAPE_H + +#include "common/PxMetaData.h" +#include "PxShape.h" +#include "NpBase.h" +#include "ScShapeCore.h" +#include "NpPhysics.h" +#include "CmPtrTable.h" + +namespace physx +{ +class NpScene; + +class NpShape : public PxShape, public NpBase +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + NpShape(PxBaseFlags baseFlags); + void preExportDataReset(); + virtual void exportExtraData(PxSerializationContext& context); + void importExtraData(PxDeserializationContext& context); + virtual void requiresObjects(PxProcessPxBaseCallback& c); + void resolveReferences(PxDeserializationContext& context); + static NpShape* createObject(PxU8*& address, PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + NpShape(const PxGeometry& geometry, + PxShapeFlags shapeFlags, + const PxU16* materialIndices, + PxU16 materialCount, + bool isExclusive, + PxShapeCoreFlag::Enum flag = PxShapeCoreFlag::Enum(0)); + + virtual ~NpShape(); + + // PxRefCounted + virtual PxU32 getReferenceCount() const PX_OVERRIDE; + virtual void acquireReference() PX_OVERRIDE; + //~PxRefCounted + + // PxShape + virtual void release() PX_OVERRIDE; //!< call to release from actor + virtual void setGeometry(const PxGeometry&) PX_OVERRIDE; + virtual const PxGeometry& getGeometry() const PX_OVERRIDE; + virtual PxRigidActor* getActor() const PX_OVERRIDE; + virtual void setLocalPose(const PxTransform& pose) PX_OVERRIDE; + virtual PxTransform getLocalPose() const PX_OVERRIDE; + virtual void setSimulationFilterData(const PxFilterData& data) PX_OVERRIDE; + virtual PxFilterData getSimulationFilterData() const PX_OVERRIDE; + virtual void setQueryFilterData(const PxFilterData& data) PX_OVERRIDE; + virtual PxFilterData getQueryFilterData() const PX_OVERRIDE; + virtual void setMaterials(PxMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; + virtual void setSoftBodyMaterials(PxFEMSoftBodyMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; + virtual void setClothMaterials(PxFEMClothMaterial*const* materials, PxU16 materialCount) PX_OVERRIDE; + virtual PxU16 getNbMaterials() const PX_OVERRIDE; + virtual PxU32 getMaterials(PxMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex=0) const PX_OVERRIDE; + virtual PxU32 getSoftBodyMaterials(PxFEMSoftBodyMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + virtual PxU32 getClothMaterials(PxFEMClothMaterial** userBuffer, PxU32 bufferSize, PxU32 startIndex = 0) const PX_OVERRIDE; + virtual PxBaseMaterial* getMaterialFromInternalFaceIndex(PxU32 faceIndex) const PX_OVERRIDE; + virtual void setContactOffset(PxReal) PX_OVERRIDE; + virtual PxReal getContactOffset() const PX_OVERRIDE; + virtual void setRestOffset(PxReal) PX_OVERRIDE; + virtual PxReal getRestOffset() const PX_OVERRIDE; + virtual void setDensityForFluid(PxReal) PX_OVERRIDE; + virtual PxReal getDensityForFluid() const PX_OVERRIDE; + virtual void setTorsionalPatchRadius(PxReal) PX_OVERRIDE; + virtual PxReal getTorsionalPatchRadius() const PX_OVERRIDE; + virtual void setMinTorsionalPatchRadius(PxReal) PX_OVERRIDE; + virtual PxReal getMinTorsionalPatchRadius() const PX_OVERRIDE; + virtual void setFlag(PxShapeFlag::Enum flag, bool value) PX_OVERRIDE; + virtual void setFlags(PxShapeFlags inFlags) PX_OVERRIDE; + virtual PxShapeFlags getFlags() const PX_OVERRIDE; + virtual bool isExclusive() const PX_OVERRIDE; + virtual void setName(const char* debugName) PX_OVERRIDE; + virtual const char* getName() const PX_OVERRIDE; + //~PxShape + + // Ref counting for shapes works like this: + // * for exclusive shapes the actor has a counted reference + // * for shared shapes, each actor has a counted reference, and the user has a counted reference + // * for either kind, each instance of the shape in a scene (i.e. each shapeSim) causes the reference count to be incremented by 1. + // Because these semantics aren't clear to users, this reference count should not be exposed in the API + + // PxBase + virtual void onRefCountZero() PX_OVERRIDE; + //~PxBase + + PX_FORCE_INLINE PxShapeFlags getFlagsFast() const { return mCore.getFlags(); } + PX_FORCE_INLINE const PxTransform& getLocalPoseFast() const { return mCore.getShape2Actor(); } + PX_FORCE_INLINE PxGeometryType::Enum getGeometryTypeFast() const { return mCore.getGeometryType(); } + PX_FORCE_INLINE const PxFilterData& getQueryFilterDataFast() const { return mQueryFilterData; } + + PX_FORCE_INLINE PxU32 getActorCount() const { return mFreeSlot & ACTOR_COUNT_MASK; } + PX_FORCE_INLINE bool isExclusiveFast() const { return mCore.getCore().mShapeCoreFlags.isSet(PxShapeCoreFlag::eIS_EXCLUSIVE); } + + PX_FORCE_INLINE const Sc::ShapeCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::ShapeCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpShape, mCore); } + + + // PT: TODO: this one only used internally and by NpFactory + template + PX_INLINE PxMaterialType* getMaterial(PxU32 index) const { return scGetMaterial(index); } + + PX_FORCE_INLINE void setSceneIfExclusive(NpScene* s) + { + if(isExclusiveFast()) + setNpScene(s); + } + + void releaseInternal(); // PT: it's "internal" but called by the NpFactory + template + static PX_INLINE bool checkMaterialSetup(const PxGeometry& geom, const char* errorMsgPrefix, PxMaterialType*const* materials, PxU16 materialCount); + + void onActorAttach(PxActor& actor); + void onActorDetach(); + + void incActorCount(); + void decActorCount(); + + //Always returns 0xffffffff for shared shapes. + PX_FORCE_INLINE PxU32 getShapeManagerArrayIndex(const Cm::PtrTable& shapes) const + { + if(isExclusiveFast()) + { + PX_ASSERT(isExclusiveFast() || NP_UNUSED_BASE_INDEX == getBaseIndex()); + PX_ASSERT(!isExclusiveFast() || NP_UNUSED_BASE_INDEX != getBaseIndex()); + const PxU32 index = getBaseIndex(); + return index!=NP_UNUSED_BASE_INDEX ? index : 0xffffffff; + } + else + return shapes.find(this); + } + PX_FORCE_INLINE bool checkShapeManagerArrayIndex(const Cm::PtrTable& shapes) const + { + return + ((!isExclusiveFast() && NP_UNUSED_BASE_INDEX==getBaseIndex()) || + ((getBaseIndex() < shapes.getCount()) && (shapes.getPtrs()[getBaseIndex()] == this))); + } + PX_FORCE_INLINE void setShapeManagerArrayIndex(const PxU32 id) + { + setBaseIndex(isExclusiveFast() ? id : NP_UNUSED_BASE_INDEX); + } + PX_FORCE_INLINE void clearShapeManagerArrayIndex() + { + setBaseIndex(NP_UNUSED_BASE_INDEX); + } + + PX_FORCE_INLINE PxRigidActor* getRigidActor() const { return mActor->is(); } +private: + PxActor* mActor; + Sc::ShapeCore mCore; + PxFilterData mQueryFilterData; // Query filter data PT: TODO: consider moving this to SQ structures + + static const PxI32 EXCLUSIVE_MASK = 0x80000000; + static const PxI32 ACTOR_COUNT_MASK = 0x7fffffff; +private: + void notifyActorAndUpdatePVD(Sc::ShapeChangeNotifyFlags notifyFlags); + void notifyActorAndUpdatePVD(const PxShapeFlags oldShapeFlags); // PT: for shape flags change + void incMeshRefCount(); + void decMeshRefCount(); + PxRefCounted* getMeshRefCountable(); + bool isWritable(); + void updateSQ(const char* errorMessage); + template + bool setMaterialsHelper(PxMaterialType* const* materials, PxU16 materialCount); + void setFlagsInternal(PxShapeFlags inFlags); + Sc::RigidCore& getScRigidObjectExclusive() const; + PX_FORCE_INLINE Sc::RigidCore* getScRigidObjectSLOW() + { + return NpShape::getActor() ? &getScRigidObjectExclusive() : NULL; + } + + PX_INLINE PxU16 scGetNbMaterials() const + { + return mCore.getNbMaterialIndices(); + } + + template + PX_INLINE Material* scGetMaterial(PxU32 index) const + { + PX_ASSERT(index < scGetNbMaterials()); + + NpMaterialManager& matManager = NpMaterialAccessor::getMaterialManager(NpPhysics::getInstance()); + // PT: TODO: revisit this indirection + const PxU16 matTableIndex = mCore.getMaterialIndices()[index]; + return matManager.getMaterial(matTableIndex); + } + + // PT: TODO: this one only used internally + template + PX_INLINE PxU32 scGetMaterials(PxMaterialType** buffer, PxU32 bufferSize, PxU32 startIndex=0) const + { + const PxU16* materialIndices; + PxU32 matCount; + NpMaterialManager& matManager = NpMaterialAccessor::getMaterialManager(NpPhysics::getInstance()); + materialIndices = mCore.getMaterialIndices(); + matCount = mCore.getNbMaterialIndices(); + + // PT: this is copied from Cm::getArrayOfPointers(). We cannot use the Cm function here + // because of the extra indirection needed to access the materials. + PxU32 size = matCount; + const PxU32 remainder = PxU32(PxMax(PxI32(size - startIndex), 0)); + const PxU32 writeCount = PxMin(remainder, bufferSize); + materialIndices += startIndex; + for(PxU32 i=0;i void setMaterialsInternal(PxMaterialType* const * materials, PxU16 materialCount); +}; + +template +PX_INLINE bool NpShape::checkMaterialSetup(const PxGeometry& geom, const char* errorMsgPrefix, PxMaterialType*const* materials, PxU16 materialCount) +{ + for (PxU32 i = 0; i < materialCount; ++i) + { + if (!materials[i]) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "material pointer %d is NULL!", i); + return false; + } + } + + // check that simple shapes don't get assigned multiple materials + if (materialCount > 1 && (geom.getType() != PxGeometryType::eHEIGHTFIELD) && (geom.getType() != PxGeometryType::eTRIANGLEMESH) && (geom.getType() != PxGeometryType::eTETRAHEDRONMESH)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: multiple materials defined for single material geometry!", errorMsgPrefix); + return false; + } + + // verify we provide all materials required + if (materialCount > 1 && (geom.getType() == PxGeometryType::eTRIANGLEMESH)) + { + const PxTriangleMeshGeometry& meshGeom = static_cast(geom); + const PxTriangleMesh& mesh = *meshGeom.triangleMesh; + + // do not allow SDF multi-material tri-meshes: + if (mesh.getSDF()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: multiple materials defined for an SDF triangle-mesh geometry!", errorMsgPrefix); + return false; + } + + if (mesh.getTriangleMaterialIndex(0) != 0xffff) + { + for (PxU32 i = 0; i < mesh.getNbTriangles(); i++) + { + const PxMaterialTableIndex meshMaterialIndex = mesh.getTriangleMaterialIndex(i); + if (meshMaterialIndex >= materialCount) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: PxTriangleMesh material indices reference more materials than provided!", errorMsgPrefix); + break; + } + } + } + } + + if (materialCount > 1 && (geom.getType() == PxGeometryType::eTETRAHEDRONMESH)) + { + const PxTetrahedronMeshGeometry& meshGeom = static_cast(geom); + const PxTetrahedronMesh& mesh = *meshGeom.tetrahedronMesh; + PX_UNUSED(mesh); + //Need to fill in material + /*if (mesh.getTriangleMaterialIndex(0) != 0xffff) + { + for (PxU32 i = 0; i < mesh.getNbTriangles(); i++) + { + const PxMaterialTableIndex meshMaterialIndex = mesh.getTriangleMaterialIndex(i); + if (meshMaterialIndex >= materialCount) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: PxTriangleMesh material indices reference more materials than provided!", errorMsgPrefix); + break; + } + } + }*/ + } + + if (materialCount > 1 && (geom.getType() == PxGeometryType::eHEIGHTFIELD)) + { + const PxHeightFieldGeometry& meshGeom = static_cast(geom); + const PxHeightField& mesh = *meshGeom.heightField; + if (mesh.getTriangleMaterialIndex(0) != 0xffff) + { + const PxU32 nbTris = mesh.getNbColumns()*mesh.getNbRows() * 2; + for (PxU32 i = 0; i < nbTris; i++) + { + const PxMaterialTableIndex meshMaterialIndex = mesh.getTriangleMaterialIndex(i); + if (meshMaterialIndex != PxHeightFieldMaterial::eHOLE && meshMaterialIndex >= materialCount) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: PxHeightField material indices reference more materials than provided!", errorMsgPrefix); + break; + } + } + } + } + + return true; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp new file mode 100644 index 0000000..7445ae9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.cpp @@ -0,0 +1,491 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpShapeManager.h" +#include "NpPtrTableStorageManager.h" +#include "NpRigidDynamic.h" +#include "NpArticulationLink.h" +#include "ScBodySim.h" +#include "GuBounds.h" +#include "NpAggregate.h" +#include "CmTransformUtils.h" +#include "NpRigidStatic.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; +using namespace Cm; + +// PT: TODO: refactor if we keep it +static void getSQGlobalPose(PxTransform& globalPose, const NpShape& npShape, const NpActor& npActor) +{ + const PxTransform& shape2Actor = npShape.getCore().getShape2Actor(); + + PX_ALIGN(16, PxTransform) kinematicTarget; + + // PT: TODO: duplicated from SqBounds.cpp. Refactor. + const NpType::Enum actorType = npActor.getNpType(); + const PxTransform* actor2World; + if(actorType==NpType::eRIGID_STATIC) + { + actor2World = &static_cast(npActor).getCore().getActor2World(); + + if(npShape.getCore().getCore().mShapeCoreFlags.isSet(PxShapeCoreFlag::eIDT_TRANSFORM)) + { + PX_ASSERT(shape2Actor.p.isZero() && shape2Actor.q.isIdentity()); + globalPose = *actor2World; + return; + } + + } + else + { + PX_ASSERT(actorType==NpType::eBODY || actorType == NpType::eBODY_FROM_ARTICULATION_LINK); + + const PxU16 sqktFlags = PxRigidBodyFlag::eKINEMATIC | PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES; + + // PT: TODO: revisit this once the dust has settled + const Sc::BodyCore& core = actorType==NpType::eBODY ? static_cast(npActor).getCore() : static_cast(npActor).getCore(); + const bool useTarget = (PxU16(core.getFlags()) & sqktFlags) == sqktFlags; + const PxTransform& body2World = (useTarget && core.getKinematicTarget(kinematicTarget)) ? kinematicTarget : core.getBody2World(); + + if(!core.getCore().hasIdtBody2Actor()) + { + Cm::getDynamicGlobalPoseAligned(body2World, shape2Actor, core.getBody2Actor(), globalPose); + return; + } + + actor2World = &body2World; + } + + Cm::getStaticGlobalPoseAligned(*actor2World, shape2Actor, globalPose); +} + + +static PX_FORCE_INLINE bool isSceneQuery(const NpShape& shape) { return shape.getFlagsFast() & PxShapeFlag::eSCENE_QUERY_SHAPE; } + +static PX_FORCE_INLINE bool isDynamicActor(const PxRigidActor& actor) +{ + const PxType actorType = actor.getConcreteType(); + return actorType != PxConcreteType::eRIGID_STATIC; +} + +static PX_FORCE_INLINE bool isDynamicActor(const NpActor& actor) +{ + const NpType::Enum actorType = actor.getNpType(); + return actorType != NpType::eRIGID_STATIC; +} + +NpShapeManager::NpShapeManager() : + mPruningStructure (NULL) +{ + setCompoundID(NP_INVALID_COMPOUND_ID); +} + +// PX_SERIALIZATION +NpShapeManager::NpShapeManager(const PxEMPTY) : + mShapes (PxEmpty) +{ +} + +NpShapeManager::~NpShapeManager() +{ + PX_ASSERT(!mPruningStructure); + PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); + mShapes.clear(sm); +} + +void NpShapeManager::preExportDataReset() +{ +} + +void NpShapeManager::exportExtraData(PxSerializationContext& stream) +{ + mShapes.exportExtraData(stream); +} + +void NpShapeManager::importExtraData(PxDeserializationContext& context) +{ + mShapes.importExtraData(context); +} +//~PX_SERIALIZATION + +static PX_INLINE void onShapeAttach(NpActor& ro, NpShape& shape) +{ + // * if the shape is exclusive, set its Sc control state appropriately. + // * add the shape to pvd. + NpScene* npScene = ro.getNpScene(); + if(!npScene) + return; + + PX_ASSERT(!npScene->isAPIWriteForbidden()); + + if(!(ro.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))) + ro.getScRigidCore().addShapeToScene(shape.getCore()); + +#if PX_SUPPORT_PVD + npScene->getScenePvdClientInternal().createPvdInstance(&shape, *ro.getScRigidCore().getPxActor()); +#endif + shape.setSceneIfExclusive(npScene); + +} + +static PX_INLINE void onShapeDetach(NpActor& ro, NpShape& shape, bool wakeOnLostTouch) +{ + // see comments in onShapeAttach + NpScene* npScene = ro.getNpScene(); + if(!npScene) + return; + PX_ASSERT(!npScene->isAPIWriteForbidden()); + +#if PX_SUPPORT_PVD + npScene->getScenePvdClientInternal().releasePvdInstance(&shape, *ro.getScRigidCore().getPxActor()); +#endif + if(!(ro.getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION))) + ro.getScRigidCore().removeShapeFromScene(shape.getCore(), wakeOnLostTouch); + + shape.setSceneIfExclusive(NULL); + +} + +void NpShapeManager::attachShape(NpShape& shape, PxRigidActor& actor) +{ + PX_ASSERT(!mPruningStructure); + + PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); + + const PxU32 index = getNbShapes(); + mShapes.add(&shape, sm); + + NpActor& ro = NpActor::getFromPxActor(actor); + + NpScene* scene = NpActor::getNpSceneFromActor(actor); + if(scene && isSceneQuery(shape)) + { + // PT: SQ_CODEPATH2 + setupSceneQuery_(scene->getSQAPI(), ro, actor, shape); + } + + onShapeAttach(ro, shape); + + PxAggregate* agg = ro.getAggregate(); + if(agg) + static_cast(agg)->incShapeCount(); + + PX_ASSERT(!shape.isExclusive() || shape.getActor()==NULL); + shape.onActorAttach(actor); + + shape.setShapeManagerArrayIndex(index); +} + +bool NpShapeManager::detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch) +{ + PX_ASSERT(!mPruningStructure); + + const PxU32 index = s.getShapeManagerArrayIndex(mShapes); + if(index==0xffffffff) + return false; + + NpScene* scene = NpActor::getNpSceneFromActor(actor); + if(scene && isSceneQuery(s)) + { + scene->getSQAPI().removeSQShape(actor, s); + + // if this is the last shape of a compound shape, we have to remove the compound id + // and in case of a dynamic actor, remove it from the active list + if(isSqCompound() && (mShapes.getCount() == 1)) + { + setCompoundID(NP_INVALID_COMPOUND_ID); + const PxType actorType = actor.getConcreteType(); + // for PxRigidDynamic and PxArticulationLink we need to remove the compound rigid flag and remove them from active list + if(actorType == PxConcreteType::eRIGID_DYNAMIC) + static_cast(actor).getCore().getSim()->disableCompound(); + else if(actorType == PxConcreteType::eARTICULATION_LINK) + static_cast(actor).getCore().getSim()->disableCompound(); + } + } + + NpActor& ro = NpActor::getFromPxActor(actor); + + onShapeDetach(ro, s, wakeOnLostTouch); + + PxAggregate* agg = ro.getAggregate(); + if (agg) + static_cast(agg)->decShapeCount(); + + PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); + + void** ptrs = mShapes.getPtrs(); + PX_ASSERT(reinterpret_cast(ptrs[index]) == &s); + const PxU32 last = mShapes.getCount() - 1; + if (index != last) + { + NpShape* moved = reinterpret_cast(ptrs[last]); + PX_ASSERT(moved->checkShapeManagerArrayIndex(mShapes)); + moved->setShapeManagerArrayIndex(index); + } + mShapes.replaceWithLast(index, sm); + s.clearShapeManagerArrayIndex(); + + s.onActorDetach(); + return true; +} + +void NpShapeManager::detachAll(PxSceneQuerySystem* pxsq, const PxRigidActor& actor) +{ + // assumes all SQ data has been released, which is currently the responsibility of the owning actor + const PxU32 nbShapes = getNbShapes(); + NpShape*const *shapes = getShapes(); + + if(pxsq) + teardownAllSceneQuery(*pxsq, actor); + + // actor cleanup in Sc will remove any outstanding references corresponding to sim objects, so we don't need to do that here. + for(PxU32 i=0;ionActorDetach(); + + PtrTableStorageManager& sm = NpFactory::getInstance().getPtrTableStorageManager(); + + mShapes.clear(sm); +} + +PxU32 NpShapeManager::getShapes(PxShape** buffer, PxU32 bufferSize, PxU32 startIndex) const +{ + return getArrayOfPointers(buffer, bufferSize, startIndex, getShapes(), getNbShapes()); +} + +// PT: this one is only used by the API getWorldBounds() functions +PxBounds3 NpShapeManager::getWorldBounds_(const PxRigidActor& actor) const +{ + PxBounds3 bounds(PxBounds3::empty()); + + const PxU32 nbShapes = getNbShapes(); + const PxTransform actorPose = actor.getGlobalPose(); + NpShape*const* PX_RESTRICT shapes = getShapes(); + + for(PxU32 i=0;igetCore().getGeometry(), actorPose * shapes[i]->getLocalPoseFast())); + + return bounds; +} + +void NpShapeManager::clearShapesOnRelease(NpScene& s, PxRigidActor& r) +{ + PX_ASSERT(NpActor::getFromPxActor(r).getActorFlags().isSet(PxActorFlag::eDISABLE_SIMULATION)); + + const PxU32 nbShapes = getNbShapes(); +#if PX_SUPPORT_PVD + NpShape*const* PX_RESTRICT shapes = getShapes(); +#endif + for(PxU32 i=0;iisExclusiveFast() && shapes[i]->getReferenceCount()>1) + shapes[i]->release(); + } +} + +void NpShapeManager::setupSceneQuery(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const NpShape& shape) +{ + PX_ASSERT(shape.getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE); + + setupSceneQuery_(pxsq, npActor, actor, shape); +} + +// PT: TODO: function called from a single place? +void NpShapeManager::teardownSceneQuery(PxSceneQuerySystem& pxsq, const PxRigidActor& actor, const NpShape& shape) +{ + pxsq.removeSQShape(actor, shape); +} + +void NpShapeManager::setupAllSceneQuery(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const PruningStructure* ps, const PxBounds3* bounds, bool isDynamic) +{ + const PxU32 nbShapes = getNbShapes(); + NpShape*const *shapes = getShapes(); + + for(PxU32 i=0;i(shape); + + const NpActor& npActor = NpActor::getFromPxActor(actor); + if(getCompoundID() == NP_INVALID_COMPOUND_ID) + getSQGlobalPose(transform, nbShape, npActor); + else + transform = nbShape.getCore().getShape2Actor(); + + pxsq.updateSQShape(actor, shape, transform); +} + +void NpShapeManager::markActorForSQUpdate(PxSceneQuerySystem& pxsq, const PxRigidActor& actor) +{ + // PT: SQ_CODEPATH5 + if(isSqCompound()) + { + pxsq.updateSQCompound(getCompoundID(), actor.getGlobalPose()); + } + else + { + const NpActor& npActor = NpActor::getFromPxActor(actor); + const PxU32 nbShapes = getNbShapes(); + for(PxU32 i=0;i(scShapes[i]); + transforms[i] = npShape->getLocalPoseFast(); + } + + const PxSQCompoundHandle cid = pxsq.addSQCompound(actor, scShapes, bvh, transforms); + setCompoundID(cid); +} + +void NpShapeManager::setupSQShape(PxSceneQuerySystem& pxsq, const NpShape& shape, const NpActor& npActor, const PxRigidActor& actor, bool dynamic, const PxBounds3* bounds, const PruningStructure* ps) +{ + PX_ALIGN(16, PxTransform) transform; + + PxBounds3 b; + if(getCompoundID() == NP_INVALID_COMPOUND_ID) + { + if(bounds) + inflateBounds(b, *bounds, SQ_PRUNER_EPSILON); + else + (gComputeBoundsTable[dynamic])(b, shape, npActor); + + // PT: TODO: don't recompute it? + getSQGlobalPose(transform, shape, npActor); + } + else + { + const PxTransform& shape2Actor = shape.getCore().getShape2Actor(); + Gu::computeBounds(b, shape.getCore().getGeometry(), shape2Actor, 0.0f, SQ_PRUNER_INFLATION); + + transform = shape2Actor; + } + + const NpCompoundId cid = getCompoundID(); + pxsq.addSQShape(actor, shape, b, transform, &cid, ps!=NULL); +} + +void NpShapeManager::setupSceneQuery_(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const NpShape& shape) +{ + const bool isDynamic = isDynamicActor(npActor); + setupSQShape(pxsq, shape, npActor, actor, isDynamic, NULL, NULL); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.h new file mode 100644 index 0000000..08cd39c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpShapeManager.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SHAPE_MANAGER_H +#define NP_SHAPE_MANAGER_H + +#include "NpShape.h" +#include "CmPtrTable.h" +#include "GuBVH.h" + +#if PX_ENABLE_DEBUG_VISUALIZATION + #include "common/PxRenderOutput.h" +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + +#include "SqTypedef.h" + +namespace physx +{ + +namespace Sq +{ + class PruningStructure; + class PrunerManager; +} + +class NpScene; + + // PT: if we go through an SQ virtual interface then the implementation can be different from our internal version, + // and nothing says it uses the same types as what we have internally in SQ. So we need a separate set of types. + typedef PxSQCompoundHandle NpCompoundId; + static const NpCompoundId NP_INVALID_COMPOUND_ID = NpCompoundId(Sq::INVALID_COMPOUND_ID); + +class NpShapeManager : public PxUserAllocated +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: +// PX_SERIALIZATION + static void getBinaryMetaData(PxOutputStream& stream); + NpShapeManager(const PxEMPTY); + void preExportDataReset(); + void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); +//~PX_SERIALIZATION + NpShapeManager(); + ~NpShapeManager(); + + PX_FORCE_INLINE PxU32 getNbShapes() const { return mShapes.getCount(); } + PX_FORCE_INLINE NpShape* const* getShapes() const { return reinterpret_cast(mShapes.getPtrs()); } + PxU32 getShapes(PxShape** buffer, PxU32 bufferSize, PxU32 startIndex=0) const; + + void attachShape(NpShape& shape, PxRigidActor& actor); + bool detachShape(NpShape& s, PxRigidActor& actor, bool wakeOnLostTouch); + void detachAll(PxSceneQuerySystem* pxsq, const PxRigidActor& actor); + + void setupSQShape(PxSceneQuerySystem& pxsq, const NpShape& shape, const NpActor& npActor, const PxRigidActor& actor, bool dynamic, const PxBounds3* bounds, const Sq::PruningStructure* ps); + void setupSceneQuery(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const NpShape& shape); + void setupAllSceneQuery(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const Sq::PruningStructure* ps, const PxBounds3* bounds, bool isDynamic); + void setupAllSceneQuery(PxSceneQuerySystem& pxsq, const PxRigidActor& actor, const Sq::PruningStructure* ps, const PxBounds3* bounds=NULL, const Gu::BVH* bvh = NULL); + void teardownAllSceneQuery(PxSceneQuerySystem& pxsq, const PxRigidActor& actor); + void teardownSceneQuery(PxSceneQuerySystem& pxsq, const PxRigidActor& actor, const NpShape& shape); + void markShapeForSQUpdate(PxSceneQuerySystem& pxsq, const PxShape& shape, const PxRigidActor& actor); + void markActorForSQUpdate(PxSceneQuerySystem& pxsq, const PxRigidActor& actor); + + PxBounds3 getWorldBounds_(const PxRigidActor&) const; + + PX_FORCE_INLINE void setPruningStructure(Sq::PruningStructure* ps) { mPruningStructure = ps; } + PX_FORCE_INLINE Sq::PruningStructure* getPruningStructure() const { return mPruningStructure; } + +// PX_FORCE_INLINE bool isSqCompound() const { return mSqCompoundId != NP_INVALID_COMPOUND_ID; } +// PX_FORCE_INLINE NpCompoundId getCompoundID() const { return mSqCompoundId; } +// PX_FORCE_INLINE void setCompoundID(NpCompoundId id) { mSqCompoundId = id; } + + // PT: TODO: we don't really need to store the compound id anymore + PX_FORCE_INLINE bool isSqCompound() const { return mShapes.mFreeSlot != NP_INVALID_COMPOUND_ID; } + PX_FORCE_INLINE NpCompoundId getCompoundID() const { return mShapes.mFreeSlot; } + PX_FORCE_INLINE void setCompoundID(NpCompoundId id) { mShapes.mFreeSlot = id; } + + void clearShapesOnRelease(NpScene& s, PxRigidActor&); + +#if PX_ENABLE_DEBUG_VISUALIZATION + void visualize(PxRenderOutput& out, NpScene& scene, const PxRigidActor& actor, float scale) const; +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif + // for batching + PX_FORCE_INLINE const Cm::PtrTable& getShapeTable() const { return mShapes; } + static PX_FORCE_INLINE size_t getShapeTableOffset() { return PX_OFFSET_OF_RT(NpShapeManager, mShapes); } +private: + Cm::PtrTable mShapes; + Sq::PruningStructure* mPruningStructure; // Shape scene query data are pre-build in pruning structure +// NpCompoundId mSqCompoundId; + + void releaseExclusiveUserReferences(); + void setupSceneQuery_(PxSceneQuerySystem& pxsq, const NpActor& npActor, const PxRigidActor& actor, const NpShape& shape); + void addBVHShapes(PxSceneQuerySystem& pxsq, const PxRigidActor& actor, const Gu::BVH& bvh); +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp new file mode 100644 index 0000000..06364ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.cpp @@ -0,0 +1,857 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "NpSoftBody.h" +#include "NpParticleSystem.h" +#include "NpCheck.h" +#include "NpScene.h" +#include "NpShape.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTetrahedronMeshGeometry.h" +#include "PxPhysXGpu.h" +#include "PxvGlobals.h" +#include "GuTetrahedronMesh.h" +#include "NpRigidDynamic.h" +#include "NpRigidStatic.h" +#include "NpArticulationLink.h" +#include "ScSoftBodySim.h" +#include "NpFEMSoftBodyMaterial.h" + +using namespace physx; + +namespace physx +{ + NpSoftBody::NpSoftBody(PxCudaContextManager& cudaContextManager) : + NpActorTemplate (PxConcreteType::eSOFT_BODY, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE, NpType::eSOFTBODY), + mShape (NULL), + mCudaContextManager(&cudaContextManager) + { + } + + NpSoftBody::NpSoftBody(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager) : + NpActorTemplate (baseFlags), + mShape (NULL), + mCudaContextManager(&cudaContextManager) + { + } + + PxBounds3 NpSoftBody::getWorldBounds(float inflation) const + { + NP_READ_CHECK(getNpScene()); + + if (!getNpScene()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Querying bounds of a PxSoftBody which is not part of a PxScene is not supported."); + return PxBounds3::empty(); + } + + const Sc::SoftBodySim* sim = mCore.getSim(); + PX_ASSERT(sim); + + PX_SIMD_GUARD; + + PxBounds3 bounds = sim->getBounds(); + PX_ASSERT(bounds.isValid()); + + // PT: unfortunately we can't just scale the min/max vectors, we need to go through center/extents. + const PxVec3 center = bounds.getCenter(); + const PxVec3 inflatedExtents = bounds.getExtents() * inflation; + return PxBounds3::centerExtents(center, inflatedExtents); + } + + PxU32 NpSoftBody::getGpuSoftBodyIndex() + { + NP_READ_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene(), "PxSoftBody::getGpuSoftBodyIndex: Soft body must be in a scene.", 0xffffffff); + + return mCore.getGpuSoftBodyIndex(); + } + + void NpSoftBody::setSoftBodyFlag(PxSoftBodyFlag::Enum flag, bool val) + { + PxSoftBodyFlags flags = mCore.getFlags(); + if (val) + flags.raise(flag); + else + flags.clear(flag); + + mCore.setFlags(flags); + } + + void NpSoftBody::setSoftBodyFlags(PxSoftBodyFlags flags) + { + mCore.setFlags(flags); + } + + PxSoftBodyFlags NpSoftBody::getSoftBodyFlag() const + { + return mCore.getFlags(); + } + + void NpSoftBody::setParameter(const PxFEMParameters paramters) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setInternalIterationCount() not allowed while simulation is running. Call will be ignored.") + + mCore.setParameter(paramters); + UPDATE_PVD_PROPERTY + } + + PxFEMParameters NpSoftBody::getParameter() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getParameter(); + } + + PxBuffer* NpSoftBody::getBufferFromFlag(PxSoftBodyData::Enum flags) + { + PxBuffer* buf = NULL; + Dy::SoftBodyCore& core = mCore.getCore(); + PX_UNUSED(core); + switch (flags) + { + case PxSoftBodyData::ePOSITION_INVMASS: + buf = core.mPositionInvMass; + break; + case PxSoftBodyData::eSIM_POSITION_INVMASS: + buf = core.mSimPositionInvMass; + break; + case PxSoftBodyData::eSIM_VELOCITY: + buf = core.mSimVelocityInvMass; + break; + case PxSoftBodyData::eSIM_KINEMATIC_TARGET: + buf = core.mKinematicTarget; + break; + case PxSoftBodyData::eNONE: + case PxSoftBodyData::eALL: + default: + PX_ASSERT(0); + } + return buf; + } + + PxBuffer* NpSoftBody::getBufferHostFromFlag(PxSoftBodyData::Enum flags) + { + PxBuffer* buf = NULL; + Dy::SoftBodyCore& core = mCore.getCore(); + PX_UNUSED(core); + switch (flags) + { + case PxSoftBodyData::ePOSITION_INVMASS: + buf = core.mPositionInvMassCPU; + break; + case PxSoftBodyData::eSIM_POSITION_INVMASS: + buf = core.mSimPositionInvMassCPU; + break; + case PxSoftBodyData::eSIM_VELOCITY: + buf = core.mSimVelocityInvMassCPU; + break; + case PxSoftBodyData::eSIM_KINEMATIC_TARGET: + buf = core.mKinematicTargetCPU; + break; + case PxSoftBodyData::eNONE: + case PxSoftBodyData::eALL: + default: + PX_ASSERT(0); + } + return buf; + } + + void NpSoftBody::readData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush) + { + PxBuffer* sourceBuffer = getBufferFromFlag(flags); + if (!sourceBuffer) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxSoftBody::readData, source buffer hasn't been allocated."); + return; + } + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + physxGpu->addCopyCommand(buffer, *sourceBuffer, flush); + } + + void NpSoftBody::readData(PxSoftBodyData::Enum flags, bool flush) + { + readData(flags, *getBufferHostFromFlag(flags), flush); + } + + void NpSoftBody::writeData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::writeData() not allowed while simulation is running. Call will be ignored.") + + if (flags == PxSoftBodyData::ePOSITION_INVMASS) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "NpSoftBody::writeData, ePOSITION_INVMASS is immutable."); + return; + } + PxBuffer* targetBuffer = getBufferFromFlag(flags); + if (!targetBuffer) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "NpSoftBody::writeData, target buffer hasn't been allocated."); + return; + } + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + PX_ASSERT(physxGpu); + + physxGpu->addCopyCommand(*targetBuffer, buffer, flush); + } + + void NpSoftBody::writeData(PxSoftBodyData::Enum flags, bool flush) + { + writeData(flags, *getBufferHostFromFlag(flags), flush); + } + + PxCudaContextManager* NpSoftBody::getCudaContextManager() const + { + return mCudaContextManager; + } + + void NpSoftBody::setWakeCounter(PxReal wakeCounterValue) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setWakeCounter() not allowed while simulation is running. Call will be ignored.") + + mCore.setWakeCounter(wakeCounterValue); + //UPDATE_PVD_PROPERTIES_OBJECT() + } + + PxReal NpSoftBody::getWakeCounter() const + { + NP_READ_CHECK(getNpScene()); + return mCore.getWakeCounter(); + } + + bool NpSoftBody::isSleeping() const + { + NP_READ_CHECK(getNpScene()); + return mCore.isSleeping(); + } + + void NpSoftBody::setSolverIterationCounts(PxU32 positionIters, PxU32 velocityIters) + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + PX_CHECK_AND_RETURN(positionIters > 0, "NpSoftBody::setSolverIterationCounts: positionIters must be more than zero!"); + PX_CHECK_AND_RETURN(positionIters <= 255, "NpSoftBody::setSolverIterationCounts: positionIters must be no greater than 255!"); + PX_CHECK_AND_RETURN(velocityIters <= 255, "NpSoftBody::setSolverIterationCounts: velocityIters must be no greater than 255!"); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(npScene, "PxSoftBody::setSolverIterationCounts() not allowed while simulation is running. Call will be ignored.") + + mCore.setSolverIterationCounts((velocityIters & 0xff) << 8 | (positionIters & 0xff)); + } + + void NpSoftBody::getSolverIterationCounts(PxU32& positionIters, PxU32& velocityIters) const + { + NP_READ_CHECK(getNpScene()); + + PxU16 x = mCore.getSolverIterationCounts(); + velocityIters = PxU32(x >> 8); + positionIters = PxU32(x & 0xff); + } + + PxShape* NpSoftBody::getShape() + { + return mShape; + } + + PxTetrahedronMesh* NpSoftBody::getCollisionMesh() + { + PxTetrahedronMeshGeometry tetMeshGeom; + mShape->getTetrahedronMeshGeometry(tetMeshGeom); + return tetMeshGeom.tetrahedronMesh; + } + + PxTetrahedronMesh* NpSoftBody::getSimulationMesh() + { + return mSimulationMesh; + } + + PxSoftBodyAuxData* NpSoftBody::getSoftBodyAuxData() + { + return mSoftBodyAuxData; + } + + bool NpSoftBody::attachSimulationMesh(PxTetrahedronMesh& simulationMesh, PxSoftBodyAuxData& softBodyAuxData) + { + Dy::SoftBodyCore& core = mCore.getCore(); + + PX_CHECK_AND_RETURN_NULL(core.mSimPositionInvMassCPU == NULL, "NpSoftBody::attachSimulationMesh: mSimPositionInvMassCPU already exists, overwrite not allowed, call detachSimulationMesh first"); + PX_CHECK_AND_RETURN_NULL(core.mSimVelocityInvMassCPU == NULL, "NpSoftBody::attachSimulationMesh: mSimVelocityInvMassCPU already exists, overwrite not allowed, call detachSimulationMesh first"); + + PX_CHECK_AND_RETURN_NULL(core.mSimPositionInvMass == NULL, "NpSoftBody::attachSimulationMesh: mSimPositionInvMass already exists, overwrite not allowed, call detachSimulationMesh first"); + PX_CHECK_AND_RETURN_NULL(core.mSimVelocityInvMass == NULL, "NpSoftBody::attachSimulationMesh: mSimVelocityInvMass already exists, overwrite not allowed, call detachSimulationMesh first"); + + mSimulationMesh = static_cast(&simulationMesh); + mSoftBodyAuxData = static_cast(&softBodyAuxData); + + //const PxTetrahedronMeshGeometry& tetGeometry = mSimShape->getGeometry().tetMesh(); + Gu::TetrahedronMesh* tetMesh = static_cast(&simulationMesh); + + const PxU32 numVertsGM = tetMesh->getNbVerticesFast(); + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + + core.mSimPositionInvMassCPU = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eHOST, mCudaContextManager, &mCore.getGpuMemStat()); + core.mSimVelocityInvMassCPU = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eHOST, mCudaContextManager, &mCore.getGpuMemStat()); + core.mKinematicTargetCPU = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eHOST, mCudaContextManager, &mCore.getGpuMemStat()); + + core.mSimPositionInvMass = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + core.mSimVelocityInvMass = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + core.mKinematicTarget = physxGpu->createBuffer(numVertsGM * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + + const Gu::TetrahedronMesh* meshData = static_cast(tetMesh); + PxVec3* positions = meshData->getVerticesFast(); + PxVec4* positionInv = reinterpret_cast(core.mSimPositionInvMassCPU->map()); + PxVec4* velocityInv = reinterpret_cast(core.mSimVelocityInvMassCPU->map()); + PxVec4* kinematicTarget = reinterpret_cast(core.mKinematicTargetCPU->map()); + const Gu::SoftBodyAuxData* s = static_cast(&softBodyAuxData); + const float* invMassGM = s->mGridModelInvMass; + for (PxU32 i = 0; i < numVertsGM; ++i) + { + const PxVec3 vert = positions[i]; + PxReal invMass = invMassGM ? invMassGM[i] : 1.0f; + positionInv[i] = PxVec4(vert.x, vert.y, vert.z, invMass); + velocityInv[i] = PxVec4(0.f, 0.f, 0.f, invMass); + kinematicTarget[i] = PxVec4(vert.x, vert.y, vert.z, 0.f); + } + core.mSimPositionInvMassCPU->unmap(); + core.mSimVelocityInvMassCPU->unmap(); + core.mKinematicTargetCPU->unmap(); + + return true; + } + + void NpSoftBody::updateMaterials() + { + Dy::SoftBodyCore& core = mCore.getCore(); + core.clearMaterials(); + for (PxU32 i = 0; i < mShape->getNbMaterials(); ++i) + { + PxFEMSoftBodyMaterial* material; + mShape->getSoftBodyMaterials(&material, 1, i); + core.setMaterial(static_cast(material)->mMaterial.mMaterialIndex); + } + } + + bool NpSoftBody::attachShape(PxShape& shape) + { + NpShape* npShape = static_cast(&shape); + + PX_CHECK_AND_RETURN_NULL(npShape->getGeometryTypeFast() == PxGeometryType::eTETRAHEDRONMESH, "NpSoftBody::attachShape: Geometry type must be tetrahedron mesh geometry"); + PX_CHECK_AND_RETURN_NULL(mShape == NULL, "NpSoftBody::attachShape: soft body can just have one shape"); + PX_CHECK_AND_RETURN_NULL(shape.isExclusive(), "NpSoftBody::attachShape: shape must be exclusive"); + PX_CHECK_AND_RETURN_NULL(npShape->getCore().getCore().mShapeCoreFlags & PxShapeCoreFlag::eSOFT_BODY_SHAPE, "NpSoftBody::attachShape: shape must be a soft body shape!"); + + Dy::SoftBodyCore& core = mCore.getCore(); + + PX_CHECK_AND_RETURN_NULL(core.mPositionInvMassCPU == NULL, "NpSoftBody::attachShape: mPositionInvMassCPU already exists, overwrite not allowed, call detachShape first"); + + PX_CHECK_AND_RETURN_NULL(core.mPositionInvMass == NULL, "NpSoftBody::attachShape: mPositionInvMass already exists, overwrite not allowed, call detachShape first"); + + mShape = npShape; + + PX_ASSERT(shape.getActor() == NULL); + npShape->onActorAttach(*this); + + const PxGeometryHolder gh(mShape->getGeometry()); // PT: TODO: avoid that copy + const PxTetrahedronMeshGeometry& tetGeometry = gh.tetMesh(); + Gu::BVTetrahedronMesh* tetMesh = static_cast(tetGeometry.tetrahedronMesh); + const PxU32 numVerts = tetMesh->getNbVerticesFast(); + + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + + core.mPositionInvMassCPU = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eHOST, mCudaContextManager, &mCore.getGpuMemStat()); + core.mRestPositionInvMassCPU = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eHOST, mCudaContextManager, &mCore.getGpuMemStat()); + + core.mPositionInvMass = physxGpu->createBuffer(numVerts * sizeof(PxVec4), PxBufferType::eDEVICE, mCudaContextManager, &mCore.getGpuMemStat()); + + const Gu::TetrahedronMesh* meshData = static_cast(tetMesh); + PxVec3* positions = meshData->getVerticesFast(); + PxVec4* positionInv = reinterpret_cast(core.mPositionInvMassCPU->map()); + PxVec4* restPositionInv = reinterpret_cast(core.mRestPositionInvMassCPU->map()); + for (PxU32 i = 0; i < numVerts; ++i) + { + const PxVec3 vert = positions[i]; + positionInv[i] = PxVec4(vert.x, vert.y, vert.z, 1.0f); + restPositionInv[i] = PxVec4(vert.x, vert.y, vert.z, 1.f); + } + core.mPositionInvMassCPU->unmap(); + core.mRestPositionInvMassCPU->unmap(); + + updateMaterials(); + + return true; + } + + void NpSoftBody::detachShape() + { + PX_CHECK_MSG(getNpSceneFromActor(*this) == NULL, "Detaching a shape from a softbody is currenly only allowed as long as it is not part of a scene. Please remove the softbody from its scene first."); + + Dy::SoftBodyCore& core = mCore.getCore(); + if (core.mPositionInvMassCPU) + { + core.mPositionInvMassCPU->release(); + core.mPositionInvMassCPU = NULL; + } + if (core.mRestPositionInvMassCPU) + { + core.mRestPositionInvMassCPU->release(); + core.mRestPositionInvMassCPU = NULL; + } + if (core.mPositionInvMass) + { + core.mPositionInvMass->release(); + core.mPositionInvMass = NULL; + } + + if (core.mKinematicTargetCPU) + { + core.mKinematicTargetCPU->release(); + core.mKinematicTargetCPU = NULL; + } + + if (core.mKinematicTarget) + { + core.mKinematicTarget->release(); + core.mKinematicTarget = NULL; + } + + if (mShape) + mShape->onActorDetach(); + mShape = NULL; + } + + void NpSoftBody::detachSimulationMesh() + { + Dy::SoftBodyCore& core = mCore.getCore(); + if (core.mSimPositionInvMassCPU) + { + core.mSimPositionInvMassCPU->release(); + core.mSimPositionInvMassCPU = NULL; + } + if (core.mSimPositionInvMass) + { + core.mSimPositionInvMass->release(); + core.mSimPositionInvMass = NULL; + } + + if (core.mSimVelocityInvMassCPU) + { + core.mSimVelocityInvMassCPU->release(); + core.mSimVelocityInvMassCPU = NULL; + } + if (core.mSimVelocityInvMass) + { + core.mSimVelocityInvMass->release(); + core.mSimVelocityInvMass = NULL; + } + + if (core.mKinematicTargetCPU) + { + core.mKinematicTargetCPU->release(); + core.mKinematicTargetCPU = NULL; + } + if (core.mKinematicTarget) + { + core.mKinematicTarget->release(); + core.mKinematicTarget = NULL; + } + + mSimulationMesh = NULL; + mSoftBodyAuxData = NULL; + } + + void NpSoftBody::release() + { + NpScene* npScene = getNpScene(); + NP_WRITE_CHECK(npScene); + + // NpPhysics::getInstance().notifyDeletionListenersUserRelease(this, PxArticulationBase::userData); + + if (npScene) + { + npScene->scRemoveSoftBody(*this); + npScene->removeFromSoftBodyList(*this); + } + + detachShape(); + + PX_ASSERT(!isAPIWriteForbidden()); + + NpDestroySoftBody(this); + } + + void NpSoftBody::setName(const char* debugName) + { + NP_WRITE_CHECK(getNpScene()); + mName = debugName; + } + + const char* NpSoftBody::getName() const + { + NP_READ_CHECK(getNpScene()); + return mName; + } + + void NpSoftBody::addParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addParticleFilter: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addParticleFilter: Illegal to call while simulation is running."); + + NpPBDParticleSystem* npParticleSystem = static_cast(particlesystem); + Sc::ParticleSystemCore& core = npParticleSystem->getCore(); + mCore.addParticleFilter(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId); + } + + void NpSoftBody::removeParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeParticleFilter: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::removeParticleFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeParticleFilter: Illegal to call while simulation is running."); + + NpPBDParticleSystem* npParticleSystem = static_cast(particlesystem); + Sc::ParticleSystemCore& core = npParticleSystem->getCore(); + mCore.removeParticleFilter(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId); + } + + PxU32 NpSoftBody::addParticleAttachment(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId, const PxVec4& barycentric) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addParticleAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addParticleAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + NpPBDParticleSystem* npParticleSystem = static_cast(particlesystem); + Sc::ParticleSystemCore& core = npParticleSystem->getCore(); + return mCore.addParticleAttachment(&core, particleId, buffer ? buffer->bufferUniqueId : 0, tetId, barycentric); + } + + void NpSoftBody::removeParticleAttachment(PxPBDParticleSystem* particlesystem, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addParticleAttachment: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((particlesystem == NULL || particlesystem->getScene() != NULL), "NpSoftBody::addParticleAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addParticleAttachment: Illegal to call while simulation is running."); + + NpPBDParticleSystem* npParticleSystem = static_cast(particlesystem); + Sc::ParticleSystemCore& core = npParticleSystem->getCore(); + mCore.removeParticleAttachment(&core, handle); + } + + void NpSoftBody::addRigidFilter(PxRigidActor* actor, PxU32 vertId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addRigidFilter: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + mCore.addRigidFilter(core, vertId); + } + + void NpSoftBody::removeRigidFilter(PxRigidActor* actor, PxU32 vertId) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeRigidFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + mCore.removeRigidFilter(core, vertId); + } + + PxU32 NpSoftBody::addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addRigidAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + Sc::BodyCore* core = getBodyCore(actor); + + PxVec3 aPose = actorSpacePose; + if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* stat = static_cast(actor); + aPose = stat->getGlobalPose().transform(aPose); + } + + return mCore.addRigidAttachment(core, vertId, aPose, constraint); + } + + void NpSoftBody::removeRigidAttachment(PxRigidActor* actor, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeRigidAttachment: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeRigidAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeRigidAttachment: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + mCore.removeRigidAttachment(core, handle); + } + + void NpSoftBody::addTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addTetRigidFilter: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addTetRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addTetRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + return mCore.addTetRigidFilter(core, tetIdx); + } + + void NpSoftBody::removeTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeTetRigidFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN((actor == NULL || actor->getScene() != NULL), "NpSoftBody::removeTetRigidFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeTetRigidFilter: Illegal to call while simulation is running."); + + Sc::BodyCore* core = getBodyCore(actor); + mCore.removeTetRigidFilter(core, tetIdx); + } + + PxU32 NpSoftBody::addTetRigidAttachment(PxRigidActor* actor, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addTetRigidAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL((actor == NULL || actor->getScene() != NULL), "NpSoftBody::addTetRigidAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addTetRigidAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + Sc::BodyCore* core = getBodyCore(actor); + + PxVec3 aPose = actorSpacePose; + if(actor && actor->getConcreteType()==PxConcreteType::eRIGID_STATIC) + { + NpRigidStatic* stat = static_cast(actor); + aPose = stat->getGlobalPose().transform(aPose); + } + + return mCore.addTetRigidAttachment(core, tetIdx, barycentric, aPose, constraint); + } + + void NpSoftBody::addSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::addSoftBodyFilter: soft body must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addSoftBodyFilter: Illegal to call while simulation is running."); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + mCore.addSoftBodyFilter(*core, tetIdx0, tetIdx1); + } + + void NpSoftBody::removeSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyFilter: Illegal to call while simulation is running."); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + mCore.removeSoftBodyFilter(*core, tetIdx0, tetIdx1); + } + + void NpSoftBody::addSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::addSoftBodyFilter: soft body must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyFilter: soft body must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addSoftBodyFilter: Illegal to call while simulation is running."); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + mCore.addSoftBodyFilters(*core, tetIndices0, tetIndices1, tetIndicesSize); + } + + void NpSoftBody::removeSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyFilter: soft body must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyFilter: Illegal to call while simulation is running."); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + mCore.removeSoftBodyFilters(*core, tetIndices0, tetIndices1, tetIndicesSize); + } + + PxU32 NpSoftBody::addSoftBodyAttachment(PxSoftBody* softbody0, PxU32 tetIdx0, const PxVec4& tetBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1, PxConeLimitedConstraint* constraint) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(softbody0 != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must not be null", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL(softbody0->getScene() != NULL, "NpSoftBody::addSoftBodyAttachment: soft body must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addSoftBodyAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + return mCore.addSoftBodyAttachment(*core, tetIdx0, tetBarycentric0, tetIdx1, tetBarycentric1, constraint); + } + + void NpSoftBody::removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(softbody0 != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(softbody0->getScene() != NULL, "NpSoftBody::removeSoftBodyAttachment: soft body must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeSoftBodyAttachment: Illegal to call while simulation is running."); + + NpSoftBody* dyn = static_cast(softbody0); + Sc::SoftBodyCore* core = &dyn->getCore(); + + mCore.removeSoftBodyAttachment(*core, handle); + } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void NpSoftBody::addClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::addClothFilter: actor must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::addClothFilter: Soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::addClothFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::addClothFilter: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(cloth); + Sc::FEMClothCore* core = &dyn->getCore(); + + return mCore.addClothFilter(*core, triIdx, tetIdx); + } +#else + void NpSoftBody::addClothFilter(PxFEMCloth*, PxU32, PxU32) {} +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void NpSoftBody::removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::removeClothFilter: actor must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::removeClothFilter: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::removeClothFilter: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::removeClothFilter: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(cloth); + Sc::FEMClothCore* core = &dyn->getCore(); + + mCore.removeClothFilter(*core, triIdx, tetIdx); + } +#else + void NpSoftBody::removeClothFilter(PxFEMCloth*, PxU32, PxU32) {} +#endif + + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxU32 NpSoftBody::addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN_VAL(cloth != NULL, "NpSoftBody::addClothAttachment: actor must not be null", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL(getNpScene() != NULL, "NpSoftBody::addClothAttachment: Soft body must be inserted into the scene.", 0xFFFFFFFF); + PX_CHECK_AND_RETURN_VAL(cloth->getScene() != NULL, "NpSoftBody::addClothAttachment: actor must be inserted into the scene.", 0xFFFFFFFF); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN_AND_RETURN_VAL(getNpScene(), "NpSoftBody::addClothAttachment: Illegal to call while simulation is running.", 0xFFFFFFFF); + + NpFEMCloth* dyn = static_cast(cloth); + Sc::FEMClothCore* core = &dyn->getCore(); + + return mCore.addClothAttachment(*core, triIdx, triBarycentric, tetIdx, tetBarycentric, constraint); + } +#else + PxU32 NpSoftBody::addClothAttachment(PxFEMCloth*, PxU32, const PxVec4&, PxU32, const PxVec4&, PxConeLimitedConstraint*) + { + return 0; + } +#endif + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + void NpSoftBody::removeClothAttachment(PxFEMCloth* cloth, PxU32 handle) + { + NP_WRITE_CHECK(getNpScene()); + PX_CHECK_AND_RETURN(cloth != NULL, "NpSoftBody::releaseClothAttachment: actor must not be null"); + PX_CHECK_AND_RETURN(getNpScene() != NULL, "NpSoftBody::releaseClothAttachment: soft body must be inserted into the scene."); + PX_CHECK_AND_RETURN(cloth->getScene() != NULL, "NpSoftBody::releaseClothAttachment: actor must be inserted into the scene."); + + PX_CHECK_SCENE_API_WRITE_FORBIDDEN(getNpScene(), "NpSoftBody::releaseClothAttachment: Illegal to call while simulation is running."); + + NpFEMCloth* dyn = static_cast(cloth); + Sc::FEMClothCore* core = &dyn->getCore(); + + mCore.removeClothAttachment(*core, handle); + } +#else + void NpSoftBody::removeClothAttachment(PxFEMCloth*, PxU32) {} +#endif +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.h new file mode 100644 index 0000000..f97f7a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/NpSoftBody.h @@ -0,0 +1,158 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_SOFTBODY_H +#define NP_SOFTBODY_H + +#include "PxSoftBody.h" +#include "ScSoftBodyCore.h" +#include "NpActorTemplate.h" +#include "GuTetrahedronMesh.h" + +namespace physx +{ + class NpScene; + class NpShape; + + class NpSoftBody : public NpActorTemplate + { + public: + NpSoftBody(PxCudaContextManager& cudaContextManager); + NpSoftBody(PxBaseFlags baseFlags, PxCudaContextManager& cudaContextManager); + + virtual ~NpSoftBody() {} + + void exportData(PxSerializationContext& /*context*/) const{} + + //external API + virtual PxActorType::Enum getType() const { return PxActorType::eSOFTBODY; } + + virtual PxBounds3 getWorldBounds(float inflation = 1.01f) const; + virtual PxU32 getGpuSoftBodyIndex(); + + virtual void setSoftBodyFlag(PxSoftBodyFlag::Enum flag, bool val); + virtual void setSoftBodyFlags(PxSoftBodyFlags flags); + virtual PxSoftBodyFlags getSoftBodyFlag() const; + + virtual void setParameter(const PxFEMParameters paramters); + virtual PxFEMParameters getParameter() const; + + virtual void readData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush); + virtual void readData(PxSoftBodyData::Enum flags, bool flush); + + virtual void writeData(PxSoftBodyData::Enum flags, PxBuffer& buffer, bool flush); + virtual void writeData(PxSoftBodyData::Enum flags, bool flush); + + virtual PxCudaContextManager* getCudaContextManager() const; + + virtual void setWakeCounter(PxReal wakeCounterValue); + virtual PxReal getWakeCounter() const; + + virtual bool isSleeping() const; + + virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters); + + virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const; + + virtual PxShape* getShape(); + virtual PxTetrahedronMesh* getCollisionMesh(); + virtual PxTetrahedronMesh* getSimulationMesh(); + virtual PxSoftBodyAuxData* getSoftBodyAuxData(); + + virtual bool attachShape(PxShape& shape); + virtual bool attachSimulationMesh(PxTetrahedronMesh& simulationMesh, PxSoftBodyAuxData& softBodyAuxData); + + virtual void detachShape(); + virtual void detachSimulationMesh(); + + virtual void release(); + + PX_FORCE_INLINE const Sc::SoftBodyCore& getCore() const { return mCore; } + PX_FORCE_INLINE Sc::SoftBodyCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(NpSoftBody, mCore); } + + virtual void addParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId); + virtual void removeParticleFilter(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId); + + virtual PxU32 addParticleAttachment(PxPBDParticleSystem* particlesystem, const PxParticleBuffer* buffer, PxU32 particleId, PxU32 tetId, const PxVec4& barycentric); + virtual void removeParticleAttachment(PxPBDParticleSystem* particlesystem, PxU32 handle); + + virtual void addRigidFilter(PxRigidActor* actor, PxU32 vertId); + virtual void removeRigidFilter(PxRigidActor* actor, PxU32 vertId); + + virtual PxU32 addRigidAttachment(PxRigidActor* actor, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + virtual void removeRigidAttachment(PxRigidActor* actor, PxU32 handle); + + virtual void addTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx); + virtual void removeTetRigidFilter(PxRigidActor* actor, PxU32 tetIdx); + + virtual PxU32 addTetRigidAttachment(PxRigidActor* actor, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint); + + virtual void addSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1); + virtual void removeSoftBodyFilter(PxSoftBody* softbody0, PxU32 tetIdx0, PxU32 tetIdx1); + virtual void addSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + virtual void removeSoftBodyFilters(PxSoftBody* softbody0, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + + virtual PxU32 addSoftBodyAttachment(PxSoftBody* softbody0, PxU32 tetIdx0, const PxVec4& tetBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint); + virtual void removeSoftBodyAttachment(PxSoftBody* softbody0, PxU32 handle); + + virtual void addClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx); + virtual void removeClothFilter(PxFEMCloth* cloth, PxU32 triIdx, PxU32 tetIdx); + + virtual PxU32 addClothAttachment(PxFEMCloth* cloth, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, + PxConeLimitedConstraint* constraint); + virtual void removeClothAttachment(PxFEMCloth* cloth, PxU32 handle); + + // Debug name + void setName(const char*); + const char* getName() const; + + virtual PxBuffer* getSimPositionInvMassCPU() { return mCore.getCore().mSimPositionInvMassCPU; } + virtual PxBuffer* getSimVelocityInvMassCPU() { return mCore.getCore().mSimVelocityInvMassCPU; } + virtual PxBuffer* getKinematicTargetCPU() { return mCore.getCore().mKinematicTargetCPU; } + + virtual PxBuffer* getPositionInvMassCPU() { return mCore.getCore().mPositionInvMassCPU; } + virtual PxBuffer* getRestPositionInvMassCPU() { return mCore.getCore().mRestPositionInvMassCPU; } + + void updateMaterials(); + + private: + + PxBuffer* getBufferFromFlag(PxSoftBodyData::Enum flags); + PxBuffer* getBufferHostFromFlag(PxSoftBodyData::Enum flags); + + NpShape* mShape; //soft body should just have one shape. The geometry type should be tetrahedron mesh + Gu::TetrahedronMesh* mSimulationMesh; + Gu::SoftBodyAuxData* mSoftBodyAuxData; + Sc::SoftBodyCore mCore; + PxCudaContextManager* mCudaContextManager; + }; +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataBindingData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataBindingData.h new file mode 100644 index 0000000..ca26d36 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataBindingData.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PVD_META_DATA_BINDING_DATA_H +#define PVD_META_DATA_BINDING_DATA_H + +#if PX_SUPPORT_PVD +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" + + +namespace physx +{ +namespace Vd +{ + +typedef PxHashSet OwnerActorsValueType; +typedef PxHashMap OwnerActorsMap; + +struct PvdMetaDataBindingData : public PxUserAllocated +{ + PxArray mTempU8Array; + PxArray mActors; + PxArray mArticulations; + PxArray mArticulationLinks; + PxHashSet mSleepingActors; + OwnerActorsMap mOwnerActorsMap; + + PvdMetaDataBindingData() + : mTempU8Array("TempU8Array") + , mActors("PxActor") + , mArticulations("Articulations") + , mArticulationLinks("ArticulationLinks") + , mSleepingActors("SleepingActors") + { + } + + template + TDataType* allocateTemp(PxU32 numItems) + { + mTempU8Array.resize(numItems * sizeof(TDataType)); + if(numItems) + return reinterpret_cast(mTempU8Array.begin()); + else + return NULL; + } + + DataRef tempToRef() + { + return DataRef(mTempU8Array.begin(), mTempU8Array.size()); + } +}; +} +} +#endif // PX_SUPPORT_PVD +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp new file mode 100644 index 0000000..bb21c42 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.cpp @@ -0,0 +1,2030 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// suppress LNK4221 +#include "foundation/PxPreprocessor.h" +PX_DUMMY_SYMBOL + +#if PX_SUPPORT_PVD + +#include "foundation/PxSimpleTypes.h" +#include "foundation/Px.h" + +#include "PxMetaDataObjects.h" +#include "PxPvdDataStream.h" +#include "PxScene.h" +#include "ScBodyCore.h" +#include "PvdMetaDataExtensions.h" +#include "PvdMetaDataPropertyVisitor.h" +#include "PvdMetaDataDefineProperties.h" +#include "PvdMetaDataBindingData.h" +#include "PxRigidDynamic.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxArticulationLink.h" +#include "NpScene.h" +#include "NpPhysics.h" + +#include "PvdTypeNames.h" +#include "PvdMetaDataPvdBinding.h" + +using namespace physx; +using namespace Sc; +using namespace Vd; +using namespace Sq; + +namespace physx +{ +namespace Vd +{ + +struct NameValuePair +{ + const char* mName; + PxU32 mValue; +}; + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif + +static const NameValuePair g_physx_Sq_SceneQueryID__EnumConversion[] = { + { "QUERY_RAYCAST_ANY_OBJECT", PxU32(QueryID::QUERY_RAYCAST_ANY_OBJECT) }, + { "QUERY_RAYCAST_CLOSEST_OBJECT", PxU32(QueryID::QUERY_RAYCAST_CLOSEST_OBJECT) }, + { "QUERY_RAYCAST_ALL_OBJECTS", PxU32(QueryID::QUERY_RAYCAST_ALL_OBJECTS) }, + { "QUERY_OVERLAP_SPHERE_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_SPHERE_ALL_OBJECTS) }, + { "QUERY_OVERLAP_AABB_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_AABB_ALL_OBJECTS) }, + { "QUERY_OVERLAP_OBB_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_OBB_ALL_OBJECTS) }, + { "QUERY_OVERLAP_CAPSULE_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_CAPSULE_ALL_OBJECTS) }, + { "QUERY_OVERLAP_CONVEX_ALL_OBJECTS", PxU32(QueryID::QUERY_OVERLAP_CONVEX_ALL_OBJECTS) }, + { "QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_OBB_SWEEP_CLOSEST_OBJECT) }, + { "QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_CAPSULE_SWEEP_CLOSEST_OBJECT) }, + { "QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT", PxU32(QueryID::QUERY_LINEAR_CONVEX_SWEEP_CLOSEST_OBJECT) }, + { NULL, 0 } +}; + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +struct SceneQueryIDConvertor +{ + const NameValuePair* NameConversion; + SceneQueryIDConvertor() : NameConversion(g_physx_Sq_SceneQueryID__EnumConversion) + { + } +}; + +PvdMetaDataBinding::PvdMetaDataBinding() : mBindingData(PX_NEW(PvdMetaDataBindingData)()) +{ +} + +PvdMetaDataBinding::~PvdMetaDataBinding() +{ + for(OwnerActorsMap::Iterator iter = mBindingData->mOwnerActorsMap.getIterator(); !iter.done(); iter++) + { + iter->second->~OwnerActorsValueType(); + PX_FREE(iter->second); + } + + PX_DELETE(mBindingData); +} + +template +static inline void definePropertyStruct(PvdDataStream& inStream, const char* pushName = NULL) +{ + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoValueStructDefine definitionObj(helper); + bool doPush = pushName && *pushName; + if(doPush) + definitionObj.pushName(pushName); + visitAllPvdProperties(definitionObj); + if(doPush) + definitionObj.popName(); + helper.addPropertyMessage(getPvdNamespacedNameForType(), getPvdNamespacedNameForType(), sizeof(TValueType)); +} + +template +static inline void createClassAndDefineProperties(PvdDataStream& inStream) +{ + inStream.createClass(); + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType()); + visitAllPvdProperties(definitionObj); +} + +template +static inline void createClassDeriveAndDefineProperties(PvdDataStream& inStream) +{ + inStream.createClass(); + inStream.deriveClass(); + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType()); + visitInstancePvdProperties(definitionObj); +} + +template +static inline void defineProperty(PvdDataStream& inStream, const char* inPropertyName, const char* semantic) +{ + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + // PxEnumTraits< TValueType > filterFlagsEnum; + TConvertSrc filterFlagsEnum; + const TConvertData* convertor = filterFlagsEnum.NameConversion; + + for(; convertor->mName != NULL; ++convertor) + helper.addNamedValue(convertor->mName, convertor->mValue); + + inStream.createProperty(inPropertyName, semantic, PropertyType::Scalar, helper.getNamedValues()); + helper.clearNamedValues(); +} + +template +static inline void definePropertyFlags(PvdDataStream& inStream, const char* inPropertyName) +{ + defineProperty(inStream, inPropertyName, "Bitflag"); +} +template +static inline void definePropertyEnums(PvdDataStream& inStream, const char* inPropertyName) +{ + defineProperty(inStream, inPropertyName, "Enumeration Value"); +} + +static PX_FORCE_INLINE void registerPvdRaycast(PvdDataStream& inStream) +{ + inStream.createClass(); + definePropertyEnums(inStream, "type"); + inStream.createProperty("filterData"); + definePropertyFlags, PxU32ToName>(inStream, "filterFlags"); + inStream.createProperty("origin"); + inStream.createProperty("unitDir"); + inStream.createProperty("distance"); + inStream.createProperty("hits_arrayName"); + inStream.createProperty("hits_baseIndex"); + inStream.createProperty("hits_count"); +} + +static PX_FORCE_INLINE void registerPvdSweep(PvdDataStream& inStream) +{ + inStream.createClass(); + definePropertyEnums(inStream, "type"); + definePropertyFlags, PxU32ToName>(inStream, "filterFlags"); + inStream.createProperty("unitDir"); + inStream.createProperty("distance"); + inStream.createProperty("geom_arrayName"); + inStream.createProperty("geom_baseIndex"); + inStream.createProperty("geom_count"); + inStream.createProperty("pose_arrayName"); + inStream.createProperty("pose_baseIndex"); + inStream.createProperty("pose_count"); + inStream.createProperty("filterData_arrayName"); + inStream.createProperty("filterData_baseIndex"); + inStream.createProperty("filterData_count"); + inStream.createProperty("hits_arrayName"); + inStream.createProperty("hits_baseIndex"); + inStream.createProperty("hits_count"); +} + +static PX_FORCE_INLINE void registerPvdOverlap(PvdDataStream& inStream) +{ + inStream.createClass(); + definePropertyEnums(inStream, "type"); + inStream.createProperty("filterData"); + definePropertyFlags, PxU32ToName>(inStream, "filterFlags"); + inStream.createProperty("pose"); + inStream.createProperty("geom_arrayName"); + inStream.createProperty("geom_baseIndex"); + inStream.createProperty("geom_count"); + inStream.createProperty("hits_arrayName"); + inStream.createProperty("hits_baseIndex"); + inStream.createProperty("hits_count"); +} + +static PX_FORCE_INLINE void registerPvdSqHit(PvdDataStream& inStream) +{ + inStream.createClass(); + inStream.createProperty("Shape"); + inStream.createProperty("Actor"); + inStream.createProperty("FaceIndex"); + definePropertyFlags, PxU32ToName>(inStream, "Flags"); + inStream.createProperty("Impact"); + inStream.createProperty("Normal"); + inStream.createProperty("Distance"); + inStream.createProperty("U"); + inStream.createProperty("V"); +} + +void PvdMetaDataBinding::registerSDKProperties(PvdDataStream& inStream) +{ + if (inStream.isClassExist()) + return; + // PxPhysics + { + inStream.createClass(); + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType()); + helper.pushName("TolerancesScale"); + visitAllPvdProperties(definitionObj); + helper.popName(); + inStream.createProperty("Scenes", "children", PropertyType::Array); + inStream.createProperty("SharedShapes", "children", PropertyType::Array); + inStream.createProperty("Materials", "children", PropertyType::Array); + inStream.createProperty("HeightFields", "children", PropertyType::Array); + inStream.createProperty("ConvexMeshes", "children", PropertyType::Array); + inStream.createProperty("TriangleMeshes", "children", PropertyType::Array); + inStream.createProperty("Version.Major"); + inStream.createProperty("Version.Minor"); + inStream.createProperty("Version.Bugfix"); + inStream.createProperty("Version.Build"); + definePropertyStruct(inStream, "TolerancesScale"); + } + { // PxGeometry + inStream.createClass(); + inStream.createProperty("Shape", "parents", PropertyType::Scalar); + } + { // PxBoxGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxSphereGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxCapsuleGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxPlaneGeometry + createClassDeriveAndDefineProperties(inStream); + } + { // PxConvexMeshGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + + { // PxTetrahedronMeshGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + + { // PxTriangleMeshGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxHeightFieldGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxCustomGeometry + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + + // PxScene + { + // PT: TODO: why inline this for PvdContact but do PvdRaycast/etc in separate functions? + { // contact information + inStream.createClass(); + inStream.createProperty("Point"); + inStream.createProperty("Axis"); + inStream.createProperty("Shapes[0]"); + inStream.createProperty("Shapes[1]"); + inStream.createProperty("Separation"); + inStream.createProperty("NormalForce"); + inStream.createProperty("InternalFaceIndex[0]"); + inStream.createProperty("InternalFaceIndex[1]"); + inStream.createProperty("NormalForceValid"); + } + + registerPvdSqHit(inStream); + registerPvdRaycast(inStream); + registerPvdSweep(inStream); + registerPvdOverlap(inStream); + + inStream.createClass(); + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType()); + visitAllPvdProperties(definitionObj); + helper.pushName("SimulationStatistics"); + visitAllPvdProperties(definitionObj); + helper.popName(); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + inStream.createProperty("Timestamp"); + inStream.createProperty("SimulateElapsedTime"); + definePropertyStruct(inStream); + definePropertyStruct(inStream, "SimulationStatistics"); + inStream.createProperty("Contacts", "", PropertyType::Array); + + inStream.createProperty("SceneQueries.Overlaps", "", PropertyType::Array); + inStream.createProperty("SceneQueries.Sweeps", "", PropertyType::Array); + inStream.createProperty("SceneQueries.Hits", "", PropertyType::Array); + inStream.createProperty("SceneQueries.Raycasts", "", PropertyType::Array); + inStream.createProperty("SceneQueries.PoseList", "", PropertyType::Array); + inStream.createProperty("SceneQueries.FilterDataList", "", PropertyType::Array); + inStream.createProperty("SceneQueries.GeometryList", "", PropertyType::Array); + + inStream.createProperty("BatchedQueries.Overlaps", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.Sweeps", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.Hits", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.Raycasts", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.PoseList", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.FilterDataList", "", PropertyType::Array); + inStream.createProperty("BatchedQueries.GeometryList", "", PropertyType::Array); + + inStream.createProperty("RigidStatics", "children", PropertyType::Array); + inStream.createProperty("RigidDynamics", "children", PropertyType::Array); + inStream.createProperty("Articulations", "children", PropertyType::Array); + inStream.createProperty("Joints", "children", PropertyType::Array); + inStream.createProperty("Aggregates", "children", PropertyType::Array); + } + // PxMaterial + { + createClassAndDefineProperties(inStream); + definePropertyStruct(inStream); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + } + // PxHeightField + { + { + inStream.createClass(); + inStream.createProperty("Height"); + inStream.createProperty("MaterialIndex[0]"); + inStream.createProperty("MaterialIndex[1]"); + } + + inStream.createClass(); + // It is important the PVD fields match the RepX fields, so this has + // to be hand coded. + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + PvdClassInfoDefine definitionObj(helper, getPvdNamespacedNameForType()); + visitAllPvdProperties(definitionObj); + inStream.createProperty("Samples", "", PropertyType::Array); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + definePropertyStruct(inStream); + } + // PxConvexMesh + { + { // hull polygon data. + inStream.createClass(); + inStream.createProperty("NumVertices"); + inStream.createProperty("IndexBase"); + } + inStream.createClass(); + inStream.createProperty("Mass"); + inStream.createProperty("LocalInertia"); + inStream.createProperty("LocalCenterOfMass"); + inStream.createProperty("Points", "", PropertyType::Array); + inStream.createProperty("HullPolygons", "", PropertyType::Array); + inStream.createProperty("PolygonIndexes", "", PropertyType::Array); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + } + // PxTriangleMesh + { + inStream.createClass(); + inStream.createProperty("Points", "", PropertyType::Array); + inStream.createProperty("NbTriangles", "", PropertyType::Scalar); + inStream.createProperty("Triangles", "", PropertyType::Array); + inStream.createProperty("MaterialIndices", "", PropertyType::Array); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + } + + // PxTetrahedronMesh + { + inStream.createClass(); + inStream.createProperty("Points", "", PropertyType::Array); + inStream.createProperty("NbTriangles", "", PropertyType::Scalar); + inStream.createProperty("Triangles", "", PropertyType::Array); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + } + + // PxFEMSoftBodyMaterial + { + createClassAndDefineProperties(inStream); + definePropertyStruct(inStream); + inStream.createProperty("Physics", "parents", PropertyType::Scalar); + } + + // PxFEMClothMaterial + // jcarius: Commented-out until FEMCloth is not under construction anymore + // { + // createClassAndDefineProperties(inStream); + // definePropertyStruct(inStream); + // inStream.createProperty("Physics", "parents", PropertyType::Scalar); + // } + + { // PxShape + createClassAndDefineProperties(inStream); + definePropertyStruct(inStream); + inStream.createProperty("Geometry", "children"); + inStream.createProperty("Materials", "children", PropertyType::Array); + inStream.createProperty("Actor", "parents"); + } + // PxActor + { + createClassAndDefineProperties(inStream); + inStream.createProperty("Scene", "parents"); + } + // PxRigidActor + { + createClassDeriveAndDefineProperties(inStream); + inStream.createProperty("Shapes", "children", PropertyType::Array); + inStream.createProperty("Joints", "children", PropertyType::Array); + } + // PxRigidStatic + { + createClassDeriveAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { // PxRigidBody + createClassDeriveAndDefineProperties(inStream); + } + // PxRigidDynamic + { + createClassDeriveAndDefineProperties(inStream); + // If anyone adds a 'getKinematicTarget' to PxRigidDynamic you can remove the line + // below (after the code generator has run). + inStream.createProperty("KinematicTarget"); + definePropertyStruct(inStream); + // Manually define the update struct. + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + /*struct PxRigidDynamicUpdateBlock + { + Transform GlobalPose; + Float3 LinearVelocity; + Float3 AngularVelocity; + PxU8 IsSleeping; + PxU8 padding[3]; + }; + */ + helper.pushName("GlobalPose"); + helper.addPropertyMessageArg(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, GlobalPose)); + helper.popName(); + helper.pushName("LinearVelocity"); + helper.addPropertyMessageArg(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, LinearVelocity)); + helper.popName(); + helper.pushName("AngularVelocity"); + helper.addPropertyMessageArg(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, AngularVelocity)); + helper.popName(); + helper.pushName("IsSleeping"); + helper.addPropertyMessageArg(PX_OFFSET_OF_RT(PxRigidDynamicUpdateBlock, IsSleeping)); + helper.popName(); + helper.addPropertyMessage(); + } + + // PxArticulationReducedCoordinate + { + createClassAndDefineProperties(inStream); + inStream.createProperty("Scene", "parents"); + inStream.createProperty("Links", "children", PropertyType::Array); + definePropertyStruct(inStream); + } + + { // PxArticulationLink + createClassDeriveAndDefineProperties(inStream); + inStream.createProperty("Parent", "parents"); + inStream.createProperty("Links", "children", PropertyType::Array); + inStream.createProperty("InboundJoint", "children"); + definePropertyStruct(inStream); + + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + /*struct PxArticulationLinkUpdateBlock + { + Transform GlobalPose; + Float3 LinearVelocity; + Float3 AngularVelocity; + };*/ + + helper.pushName("GlobalPose"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, GlobalPose)); + helper.popName(); + helper.pushName("LinearVelocity"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, LinearVelocity)); + helper.popName(); + helper.pushName("AngularVelocity"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationLinkUpdateBlock, AngularVelocity)); + helper.popName(); + helper.addPropertyMessage(); + + } + { // PxArticulationJoint + createClassAndDefineProperties(inStream); + inStream.createProperty("Link", "parents"); + definePropertyStruct(inStream); + + PvdPropertyDefinitionHelper& helper(inStream.getPropertyDefinitionHelper()); + + helper.pushName("JointPosition[eX]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eX)); + helper.popName(); + helper.pushName("JointPosition[eY]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eY)); + helper.popName(); + helper.pushName("JointPosition[eZ]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eZ)); + helper.popName(); + helper.pushName("JointPosition[eTWIST]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eTwist)); + helper.popName(); + helper.pushName("JointPosition[eSWING1]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eSwing1)); + helper.popName(); + helper.pushName("JointPosition[eSWING2]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointPosition_eSwing2)); + helper.popName(); + + helper.pushName("JointVelocity[eX]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eX)); + helper.popName(); + helper.pushName("JointVelocity[eY]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eY)); + helper.popName(); + helper.pushName("JointVelocity[eZ]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eZ)); + helper.popName(); + helper.pushName("JointVelocity[eTWIST]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eTwist)); + helper.popName(); + helper.pushName("JointVelocity[eSWING1]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eSwing1)); + helper.popName(); + helper.pushName("JointVelocity[eSWING2]"); + helper.addPropertyMessageArg(PX_OFFSET_OF(PxArticulationJointUpdateBlock, JointVelocity_eSwing2)); + helper.popName(); + + helper.addPropertyMessage(); + } + { // PxConstraint + createClassAndDefineProperties(inStream); + definePropertyStruct(inStream); + } + { + // PxAggregate + createClassAndDefineProperties(inStream); + inStream.createProperty("Scene", "parents"); + definePropertyStruct(inStream); + inStream.createProperty("Actors", "children", PropertyType::Array); + inStream.createProperty("Articulations", "children", PropertyType::Array); + } +} + +template +static void doSendAllProperties(PvdDataStream& inStream, const TDataType* inDatatype, const void* instanceId) +{ + TValueType theValues(inDatatype); + inStream.setPropertyMessage(instanceId, theValues); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxPhysics& inPhysics) +{ + PxTolerancesScale theScale(inPhysics.getTolerancesScale()); + doSendAllProperties(inStream, &theScale, &inPhysics); + inStream.setPropertyValue(&inPhysics, "Version.Major", PxU32(PX_PHYSICS_VERSION_MAJOR)); + inStream.setPropertyValue(&inPhysics, "Version.Minor", PxU32(PX_PHYSICS_VERSION_MINOR)); + inStream.setPropertyValue(&inPhysics, "Version.Bugfix", PxU32(PX_PHYSICS_VERSION_BUGFIX)); + +#if PX_CHECKED +#if defined(NDEBUG) + // This is a checked build + String buildType = "Checked"; +#elif defined(_DEBUG) + // This is a debug build + String buildType = "Debug"; +#endif +#elif PX_PROFILE + String buildType = "Profile"; +#elif defined(NDEBUG) + // This is a release build + String buildType = "Release"; +#endif + inStream.setPropertyValue(&inPhysics, "Version.Build", buildType); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxScene& inScene) +{ + const PxPhysics& physics(const_cast(inScene).getPhysics()); + PxTolerancesScale theScale; + PxSceneDesc theDesc(theScale); + + { + // setDominanceGroupPair ? + + theDesc.gravity = inScene.getGravity(); + theDesc.simulationEventCallback = inScene.getSimulationEventCallback(); + theDesc.contactModifyCallback = inScene.getContactModifyCallback(); + theDesc.ccdContactModifyCallback = inScene.getCCDContactModifyCallback(); + theDesc.filterShaderData = inScene.getFilterShaderData(); + theDesc.filterShaderDataSize = inScene.getFilterShaderDataSize(); + theDesc.filterShader = inScene.getFilterShader(); + theDesc.filterCallback = inScene.getFilterCallback(); +// PxPairFilteringMode::Enum KineKineFilteringMode; +// PxPairFilteringMode::Enum StaticKineFilteringMode; + theDesc.broadPhaseType = inScene.getBroadPhaseType(); + theDesc.broadPhaseCallback = inScene.getBroadPhaseCallback(); + theDesc.limits = inScene.getLimits(); + theDesc.frictionType = inScene.getFrictionType(); +// PxSolverType::Enum SolverType; + theDesc.bounceThresholdVelocity = inScene.getBounceThresholdVelocity(); + theDesc.frictionOffsetThreshold = inScene.getFrictionOffsetThreshold(); + theDesc.frictionCorrelationDistance = inScene.getFrictionCorrelationDistance(); + theDesc.flags = inScene.getFlags(); + theDesc.cpuDispatcher = inScene.getCpuDispatcher(); + theDesc.cudaContextManager = inScene.getCudaContextManager(); + theDesc.staticStructure = inScene.getStaticStructure(); + theDesc.dynamicStructure = inScene.getDynamicStructure(); + theDesc.dynamicTreeRebuildRateHint = inScene.getDynamicTreeRebuildRateHint(); + theDesc.sceneQueryUpdateMode = inScene.getSceneQueryUpdateMode(); + theDesc.userData = inScene.userData; + theDesc.solverBatchSize = inScene.getSolverBatchSize(); + theDesc.solverArticulationBatchSize = inScene.getSolverArticulationBatchSize(); +// PxU32 NbContactDataBlocks; +// PxU32 MaxNbContactDataBlocks; + // theDesc.nbContactDataBlocks = inScene.getNbContactDataBlocksUsed(); + // theDesc.maxNbContactDataBlocks = inScene.getMaxNbContactDataBlocksUsed(); + theDesc.maxBiasCoefficient = inScene.getMaxBiasCoefficient(); + theDesc.contactReportStreamBufferSize = inScene.getContactReportStreamBufferSize(); + theDesc.ccdMaxPasses = inScene.getCCDMaxPasses(); + theDesc.ccdThreshold = inScene.getCCDThreshold(); + theDesc.ccdMaxSeparation = inScene.getCCDMaxSeparation(); + // theDesc.simulationOrder = inScene.getSimulationOrder(); + theDesc.wakeCounterResetValue = inScene.getWakeCounterResetValue(); + + theDesc.gpuDynamicsConfig = inScene.getGpuDynamicsConfig(); +// PxBounds3 SanityBounds; +// PxgDynamicsMemoryConfig GpuDynamicsConfig; +// PxU32 GpuMaxNumPartitions; +// PxU32 GpuComputeVersion; +// PxReal BroadPhaseInflation; +// PxU32 ContactPairSlabSize; + } + + PxSceneDescGeneratedValues theValues(&theDesc); + inStream.setPropertyMessage(&inScene, theValues); + // Create parent/child relationship. + inStream.setPropertyValue(&inScene, "Physics", reinterpret_cast(&physics)); + inStream.pushBackObjectRef(&physics, "Scenes", &inScene); +} + +void PvdMetaDataBinding::sendBeginFrame(PvdDataStream& inStream, const PxScene* inScene, PxReal simulateElapsedTime) +{ + inStream.beginSection(inScene, "frame"); + inStream.setPropertyValue(inScene, "Timestamp", inScene->getTimestamp()); + inStream.setPropertyValue(inScene, "SimulateElapsedTime", simulateElapsedTime); +} + +template +struct NullConverter +{ + void operator()(TDataType& data, const TDataType& src) + { + data = src; + } +}; + +template > +class ScopedPropertyValueSender +{ + TTargetType mStack[T_NUM_ITEMS]; + TTargetType* mCur; + const TTargetType* mEnd; + PvdDataStream& mStream; + + public: + ScopedPropertyValueSender(PvdDataStream& inStream, const void* inObj, String name) + : mCur(mStack), mEnd(&mStack[T_NUM_ITEMS]), mStream(inStream) + { + mStream.beginSetPropertyValue(inObj, name, getPvdNamespacedNameForType()); + } + + ~ScopedPropertyValueSender() + { + if(mStack != mCur) + { + PxU32 size = sizeof(TTargetType) * PxU32(mCur - mStack); + mStream.appendPropertyValueData(DataRef(reinterpret_cast(mStack), size)); + } + mStream.endSetPropertyValue(); + } + + void append(const TSourceType& data) + { + Converter()(*mCur, data); + if(mCur < mEnd - 1) + ++mCur; + else + { + mStream.appendPropertyValueData(DataRef(reinterpret_cast(mStack), sizeof mStack)); + mCur = mStack; + } + } + + private: + ScopedPropertyValueSender& operator=(const ScopedPropertyValueSender&); +}; + +void PvdMetaDataBinding::sendContacts(PvdDataStream& inStream, const PxScene& inScene) +{ + inStream.setPropertyValue(&inScene, "Contacts", DataRef(), getPvdNamespacedNameForType()); +} + +void PvdMetaDataBinding::sendStats(PvdDataStream& inStream, const PxScene* inScene) +{ + PxSimulationStatistics theStats; + inScene->getSimulationStatistics(theStats); + + PxSimulationStatisticsGeneratedValues values(&theStats); + inStream.setPropertyMessage(inScene, values); +} + +struct PvdContactConverter +{ + void operator()(PvdContact& data, const Sc::Contact& src) + { + data.point = src.point; + data.axis = src.normal; + data.shape0 = src.shape0; + data.shape1 = src.shape1; + data.separation = src.separation; + data.normalForce = src.normalForce; + data.internalFaceIndex0 = src.faceIndex0; + data.internalFaceIndex1 = src.faceIndex1; + data.normalForceAvailable = src.normalForceAvailable; + } +}; + +void PvdMetaDataBinding::sendContacts(PvdDataStream& inStream, const PxScene& inScene, PxArray& inContacts) +{ + ScopedPropertyValueSender sender(inStream, &inScene, "Contacts"); + + for(PxU32 i = 0; i < inContacts.size(); i++) + { + sender.append(inContacts[i]); + } +} + +void PvdMetaDataBinding::sendEndFrame(PvdDataStream& inStream, const PxScene* inScene) +{ + //flush other client + inStream.endSection(inScene, "frame"); +} + +template +static void addPhysicsGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inData, const PxPhysics& ownerPhysics) +{ + inStream.setPropertyValue(&inData, "Physics", reinterpret_cast(&ownerPhysics)); + inStream.pushBackObjectRef(&ownerPhysics, groupName, &inData); + // Buffer type objects *have* to be flushed directly out once created else scene creation doesn't work. +} + +template +static void removePhysicsGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inData, const PxPhysics& ownerPhysics) +{ + inStream.removeObjectRef(&ownerPhysics, groupName, &inData); + inStream.destroyInstance(&inData); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inMaterial); + sendAllProperties(inStream, inMaterial); + addPhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxMaterial& inMaterial) +{ + PxMaterialGeneratedValues values(&inMaterial); + inStream.setPropertyMessage(&inMaterial, values); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics) +{ + removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMSoftBodyMaterial& inMaterial, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inMaterial); + sendAllProperties(inStream, inMaterial); + addPhysicsGroupProperty(inStream, "FEMMaterials", inMaterial, ownerPhysics); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxFEMSoftBodyMaterial& /*inMaterial*/) +{ + /*PxMaterialGeneratedValues values(&inMaterial); + inStream.setPropertyMessage(&inMaterial, values);*/ +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxFEMSoftBodyMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/) +{ + //removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics); +} +// jcarius: Commented-out until FEMCloth is not under construction anymore +// void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMClothMaterial& inMaterial, const PxPhysics& ownerPhysics) +// { +// inStream.createInstance(&inMaterial); +// sendAllProperties(inStream, inMaterial); +// addPhysicsGroupProperty(inStream, "FEMMaterials", inMaterial, ownerPhysics); +// } + +// void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxFEMClothMaterial& /*inMaterial*/) +// { +// /*PxMaterialGeneratedValues values(&inMaterial); +// inStream.setPropertyMessage(&inMaterial, values);*/ +// } + +// void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxFEMClothMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/) +// { +// //removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics); +// } + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxPBDMaterial& inMaterial, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inMaterial); + sendAllProperties(inStream, inMaterial); + addPhysicsGroupProperty(inStream, "PBDMaterials", inMaterial, ownerPhysics); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& /*inStream*/, const PxPBDMaterial& /*inMaterial*/) +{ + /*PxMaterialGeneratedValues values(&inMaterial); + inStream.setPropertyMessage(&inMaterial, values);*/ +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& /*inStream*/, const PxPBDMaterial& /*inMaterial*/, const PxPhysics& /*ownerPhysics*/) +{ + //removePhysicsGroupProperty(inStream, "Materials", inMaterial, ownerPhysics); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxHeightField& inData) +{ + PxHeightFieldDesc theDesc; + // Save the height field to desc. + theDesc.nbRows = inData.getNbRows(); + theDesc.nbColumns = inData.getNbColumns(); + theDesc.format = inData.getFormat(); + theDesc.samples.stride = inData.getSampleStride(); + theDesc.samples.data = NULL; + theDesc.convexEdgeThreshold = inData.getConvexEdgeThreshold(); + theDesc.flags = inData.getFlags(); + + PxU32 theCellCount = inData.getNbRows() * inData.getNbColumns(); + PxU32 theSampleStride = sizeof(PxHeightFieldSample); + PxU32 theSampleBufSize = theCellCount * theSampleStride; + mBindingData->mTempU8Array.resize(theSampleBufSize); + PxHeightFieldSample* theSamples = reinterpret_cast(mBindingData->mTempU8Array.begin()); + inData.saveCells(theSamples, theSampleBufSize); + theDesc.samples.data = theSamples; + PxHeightFieldDescGeneratedValues values(&theDesc); + inStream.setPropertyMessage(&inData, values); + PxHeightFieldSample* theSampleData = reinterpret_cast(mBindingData->mTempU8Array.begin()); + inStream.setPropertyValue(&inData, "Samples", theSampleData, theCellCount); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inData); + sendAllProperties(inStream, inData); + addPhysicsGroupProperty(inStream, "HeightFields", inData, ownerPhysics); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics) +{ + removePhysicsGroupProperty(inStream, "HeightFields", inData, ownerPhysics); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inData); + PxReal mass; + PxMat33 localInertia; + PxVec3 localCom; + inData.getMassInformation(mass, localInertia, localCom); + inStream.setPropertyValue(&inData, "Mass", mass); + inStream.setPropertyValue(&inData, "LocalInertia", localInertia); + inStream.setPropertyValue(&inData, "LocalCenterOfMass", localCom); + + // update arrays: + // vertex Array: + { + const PxVec3* vertexPtr = inData.getVertices(); + const PxU32 numVertices = inData.getNbVertices(); + inStream.setPropertyValue(&inData, "Points", vertexPtr, numVertices); + } + + // HullPolyArray: + PxU16 maxIndices = 0; + { + + PxU32 numPolygons = inData.getNbPolygons(); + PvdHullPolygonData* tempData = mBindingData->allocateTemp(numPolygons); + // Get the polygon data stripping the plane equations + for(PxU32 index = 0; index < numPolygons; index++) + { + PxHullPolygon curOut; + inData.getPolygonData(index, curOut); + maxIndices = PxMax(maxIndices, PxU16(curOut.mIndexBase + curOut.mNbVerts)); + tempData[index].mIndexBase = curOut.mIndexBase; + tempData[index].mNumVertices = curOut.mNbVerts; + } + inStream.setPropertyValue(&inData, "HullPolygons", tempData, numPolygons); + } + + // poly index Array: + { + const PxU8* indices = inData.getIndexBuffer(); + inStream.setPropertyValue(&inData, "PolygonIndexes", indices, maxIndices); + } + addPhysicsGroupProperty(inStream, "ConvexMeshes", inData, ownerPhysics); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics) +{ + removePhysicsGroupProperty(inStream, "ConvexMeshes", inData, ownerPhysics); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inData); + + // vertex Array: + { + const PxVec3* vertexPtr = inData.getVertices(); + const PxU32 numVertices = inData.getNbVertices(); + inStream.setPropertyValue(&inData, "Vertices", vertexPtr, numVertices); + } + + ////invert mass array + //{ + // const float* invMassPtr = inData.getVertInvMasses(); + // const PxU32 numVertices = inData.getCollisionMesh().getNbVertices(); + // inStream.setPropertyValue(&inData, "invert mass", invMassPtr, numVertices); + //} + + // index Array: + { + const bool has16BitIndices = inData.getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES ? true : false; + const PxU32 numTetrahedrons= inData.getNbTetrahedrons(); + + inStream.setPropertyValue(&inData, "NbTetrahedron", numTetrahedrons); + + const PxU32 numIndexes = numTetrahedrons * 4; + const PxU8* tetrahedronsPtr = reinterpret_cast(inData.getTetrahedrons()); + // We declared this type as a 32 bit integer above. + // PVD will automatically unsigned-extend data that is smaller than the target type. + if (has16BitIndices) + inStream.setPropertyValue(&inData, "Tetrahedrons", reinterpret_cast(tetrahedronsPtr), numIndexes); + else + inStream.setPropertyValue(&inData, "Tetrahedrons", reinterpret_cast(tetrahedronsPtr), numIndexes); + } + + addPhysicsGroupProperty(inStream, "TetrahedronMeshes", inData, ownerPhysics); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics) +{ + removePhysicsGroupProperty(inStream, "TetrahedronMeshes", inData, ownerPhysics); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics) +{ + inStream.createInstance(&inData); + bool hasMatIndex = inData.getTriangleMaterialIndex(0) != 0xffff; + // update arrays: + // vertex Array: + { + const PxVec3* vertexPtr = inData.getVertices(); + const PxU32 numVertices = inData.getNbVertices(); + inStream.setPropertyValue(&inData, "Points", vertexPtr, numVertices); + } + + // index Array: + { + const bool has16BitIndices = inData.getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES ? true : false; + const PxU32 numTriangles = inData.getNbTriangles(); + + inStream.setPropertyValue(&inData, "NbTriangles", numTriangles); + + const PxU32 numIndexes = numTriangles * 3; + const PxU8* trianglePtr = reinterpret_cast(inData.getTriangles()); + // We declared this type as a 32 bit integer above. + // PVD will automatically unsigned-extend data that is smaller than the target type. + if(has16BitIndices) + inStream.setPropertyValue(&inData, "Triangles", reinterpret_cast(trianglePtr), numIndexes); + else + inStream.setPropertyValue(&inData, "Triangles", reinterpret_cast(trianglePtr), numIndexes); + } + + // material Array: + if(hasMatIndex) + { + PxU32 numMaterials = inData.getNbTriangles(); + PxU16* matIndexData = mBindingData->allocateTemp(numMaterials); + for(PxU32 m = 0; m < numMaterials; m++) + matIndexData[m] = inData.getTriangleMaterialIndex(m); + inStream.setPropertyValue(&inData, "MaterialIndices", matIndexData, numMaterials); + } + addPhysicsGroupProperty(inStream, "TriangleMeshes", inData, ownerPhysics); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics) +{ + removePhysicsGroupProperty(inStream, "TriangleMeshes", inData, ownerPhysics); +} + +template +void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream&, const TDataType&, PsPvd*) +{ +} + +template <> +void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream& inStream, const PxConvexMeshGeometry& geom, PsPvd* pvd) +{ + if(pvd->registerObject(geom.convexMesh)) + createInstance(inStream, *geom.convexMesh, PxGetPhysics()); +} + +template <> +void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream& inStream, const PxTetrahedronMeshGeometry& geom, PsPvd* pvd) +{ + if (pvd->registerObject(geom.tetrahedronMesh)) + createInstance(inStream, *geom.tetrahedronMesh, PxGetPhysics()); +} + +template <> +void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream& inStream, const PxTriangleMeshGeometry& geom, PsPvd* pvd) +{ + if(pvd->registerObject(geom.triangleMesh)) + createInstance(inStream, *geom.triangleMesh, PxGetPhysics()); +} + +template <> +void PvdMetaDataBinding::registrarPhysicsObject(PvdDataStream& inStream, const PxHeightFieldGeometry& geom, PsPvd* pvd) +{ + if(pvd->registerObject(geom.heightField)) + createInstance(inStream, *geom.heightField, PxGetPhysics()); +} + +template +static void sendGeometry(PvdMetaDataBinding& metaBind, PvdDataStream& inStream, const PxShape& inShape, const TGeomType& geom, PsPvd* pvd) +{ + const void* geomInst = (reinterpret_cast(&inShape)) + 4; + inStream.createInstance(getPvdNamespacedNameForType(), geomInst); + metaBind.registrarPhysicsObject(inStream, geom, pvd); + TGeneratedValuesType values(&geom); + inStream.setPropertyMessage(geomInst, values); + inStream.setPropertyValue(&inShape, "Geometry", geomInst); + inStream.setPropertyValue(geomInst, "Shape", reinterpret_cast(&inShape)); +} + +static void setGeometry(PvdMetaDataBinding& metaBind, PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd) +{ + switch(inObj.getGeometryType()) + { +#define SEND_PVD_GEOM_TYPE(enumType, geomType, valueType) \ + case PxGeometryType::enumType: \ + { \ + Px##geomType geom; \ + inObj.get##geomType(geom); \ + sendGeometry(metaBind, inStream, inObj, geom, pvd); \ + } \ + break; + SEND_PVD_GEOM_TYPE(eSPHERE, SphereGeometry, PxSphereGeometryGeneratedValues); + // Plane geometries don't have any properties, so this avoids using a property + // struct for them. + case PxGeometryType::ePLANE: + { + PxPlaneGeometry geom; + inObj.getPlaneGeometry(geom); + const void* geomInst = (reinterpret_cast(&inObj)) + 4; + inStream.createInstance(getPvdNamespacedNameForType(), geomInst); + inStream.setPropertyValue(&inObj, "Geometry", geomInst); + inStream.setPropertyValue(geomInst, "Shape", reinterpret_cast(&inObj)); + } + break; + SEND_PVD_GEOM_TYPE(eCAPSULE, CapsuleGeometry, PxCapsuleGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eBOX, BoxGeometry, PxBoxGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eCONVEXMESH, ConvexMeshGeometry, PxConvexMeshGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eTETRAHEDRONMESH, TetrahedronMeshGeometry, PxTetrahedronMeshGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eTRIANGLEMESH, TriangleMeshGeometry, PxTriangleMeshGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eHEIGHTFIELD, HeightFieldGeometry, PxHeightFieldGeometryGeneratedValues); + SEND_PVD_GEOM_TYPE(eCUSTOM, CustomGeometry, PxCustomGeometryGeneratedValues); +#undef SEND_PVD_GEOM_TYPE + case PxGeometryType::ePARTICLESYSTEM: + // A.B. implement later + break; + case PxGeometryType::eHAIRSYSTEM: + break; + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + PX_ASSERT(false); + break; + } +} + +static void setMaterials(PvdMetaDataBinding& metaBing, PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd, PvdMetaDataBindingData* mBindingData) +{ + PxU32 numMaterials = inObj.getNbMaterials(); + PxMaterial** materialPtr = mBindingData->allocateTemp(numMaterials); + inObj.getMaterials(materialPtr, numMaterials); + for(PxU32 idx = 0; idx < numMaterials; ++idx) + { + if(pvd->registerObject(materialPtr[idx])) + metaBing.createInstance(inStream, *materialPtr[idx], PxGetPhysics()); + inStream.pushBackObjectRef(&inObj, "Materials", materialPtr[idx]); + } +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + if(!inStream.isInstanceValid(&owner)) + return; + + const OwnerActorsMap::Entry* entry = mBindingData->mOwnerActorsMap.find(&inObj); + if(entry != NULL) + { + if(!mBindingData->mOwnerActorsMap[&inObj]->contains(&owner)) + mBindingData->mOwnerActorsMap[&inObj]->insert(&owner); + } + else + { + OwnerActorsValueType* data = reinterpret_cast( + PX_ALLOC(sizeof(OwnerActorsValueType), "mOwnerActorsMapValue")); //( 1 ); + OwnerActorsValueType* actors = PX_PLACEMENT_NEW(data, OwnerActorsValueType); + actors->insert(&owner); + + mBindingData->mOwnerActorsMap.insert(&inObj, actors); + } + + if(inStream.isInstanceValid(&inObj)) + { + inStream.pushBackObjectRef(&owner, "Shapes", &inObj); + return; + } + + inStream.createInstance(&inObj); + inStream.pushBackObjectRef(&owner, "Shapes", &inObj); + inStream.setPropertyValue(&inObj, "Actor", reinterpret_cast(&owner)); + sendAllProperties(inStream, inObj); + setGeometry(*this, inStream, inObj, pvd); + setMaterials(*this, inStream, inObj, pvd, mBindingData); + if(!inObj.isExclusive()) + inStream.pushBackObjectRef(&ownerPhysics, "SharedShapes", &inObj); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxShape& inObj) +{ + PxShapeGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} + +void PvdMetaDataBinding::releaseAndRecreateGeometry(PvdDataStream& inStream, const PxShape& inObj, PxPhysics& /*ownerPhysics*/, PsPvd* pvd) +{ + const void* geomInst = (reinterpret_cast(&inObj)) + 4; + inStream.destroyInstance(geomInst); + // Quick fix for HF modify, PxConvexMesh and PxTriangleMesh need recook, they should always be new if modified + if(inObj.getGeometryType() == PxGeometryType::eHEIGHTFIELD) + { + PxHeightFieldGeometry hfGeom; + inObj.getHeightFieldGeometry(hfGeom); + if(inStream.isInstanceValid(hfGeom.heightField)) + sendAllProperties(inStream, *hfGeom.heightField); + } + + setGeometry(*this, inStream, inObj, pvd); + + // Need update actor cause PVD takes actor-shape as a pair. + { + PxRigidActor* actor = inObj.getActor(); + if(actor != NULL) + { + if(const PxRigidStatic* rgS = actor->is()) + sendAllProperties(inStream, *rgS); + else if(const PxRigidDynamic* rgD = actor->is()) + sendAllProperties(inStream, *rgD); + } + } +} + +void PvdMetaDataBinding::updateMaterials(PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd) +{ + // Clear the shape's materials array. + inStream.setPropertyValue(&inObj, "Materials", DataRef(), getPvdNamespacedNameForType()); + setMaterials(*this, inStream, inObj, pvd, mBindingData); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner) +{ + if(inStream.isInstanceValid(&inObj)) + { + inStream.removeObjectRef(&owner, "Shapes", &inObj); + + bool bDestroy = true; + const OwnerActorsMap::Entry* entry0 = mBindingData->mOwnerActorsMap.find(&inObj); + if(entry0 != NULL) + { + entry0->second->erase(&owner); + if(entry0->second->size() > 0) + bDestroy = false; + else + { + mBindingData->mOwnerActorsMap[&inObj]->~OwnerActorsValueType(); + PX_FREE(mBindingData->mOwnerActorsMap[&inObj]); + mBindingData->mOwnerActorsMap.erase(&inObj); + } + } + + if(bDestroy) + { + if(!inObj.isExclusive()) + inStream.removeObjectRef(&PxGetPhysics(), "SharedShapes", &inObj); + + const void* geomInst = (reinterpret_cast(&inObj)) + 4; + inStream.destroyInstance(geomInst); + inStream.destroyInstance(&inObj); + + const OwnerActorsMap::Entry* entry = mBindingData->mOwnerActorsMap.find(&inObj); + if(entry != NULL) + { + entry->second->~OwnerActorsValueType(); + OwnerActorsValueType* ptr = entry->second; + PX_FREE(ptr); + mBindingData->mOwnerActorsMap.erase(&inObj); + } + } + } +} + +template +static void addSceneGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inObj, const PxScene& inScene) +{ + inStream.createInstance(&inObj); + inStream.pushBackObjectRef(&inScene, groupName, &inObj); + inStream.setPropertyValue(&inObj, "Scene", reinterpret_cast(&inScene)); +} + +template +static void removeSceneGroupProperty(PvdDataStream& inStream, const char* groupName, const TDataType& inObj, const PxScene& inScene) +{ + inStream.removeObjectRef(&inScene, groupName, &inObj); + inStream.destroyInstance(&inObj); +} + +static void sendShapes(PvdMetaDataBinding& binding, PvdDataStream& inStream, const PxRigidActor& inObj, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PxInlineArray shapeData; + PxU32 nbShapes = inObj.getNbShapes(); + shapeData.resize(nbShapes); + inObj.getShapes(shapeData.begin(), nbShapes); + for(PxU32 idx = 0; idx < nbShapes; ++idx) + binding.createInstance(inStream, *shapeData[idx], inObj, ownerPhysics, pvd); +} + +static void releaseShapes(PvdMetaDataBinding& binding, PvdDataStream& inStream, const PxRigidActor& inObj) +{ + PxInlineArray shapeData; + PxU32 nbShapes = inObj.getNbShapes(); + shapeData.resize(nbShapes); + inObj.getShapes(shapeData.begin(), nbShapes); + for(PxU32 idx = 0; idx < nbShapes; ++idx) + binding.destroyInstance(inStream, *shapeData[idx], inObj); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + addSceneGroupProperty(inStream, "RigidStatics", inObj, ownerScene); + sendAllProperties(inStream, inObj); + sendShapes(*this, inStream, inObj, ownerPhysics, pvd); +} +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxRigidStatic& inObj) +{ + PxRigidStaticGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene) +{ + releaseShapes(*this, inStream, inObj); + removeSceneGroupProperty(inStream, "RigidStatics", inObj, ownerScene); +} +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + addSceneGroupProperty(inStream, "RigidDynamics", inObj, ownerScene); + sendAllProperties(inStream, inObj); + sendShapes(*this, inStream, inObj, ownerPhysics, pvd); +} +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxRigidDynamic& inObj) +{ + PxRigidDynamicGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene) +{ + releaseShapes(*this, inStream, inObj); + removeSceneGroupProperty(inStream, "RigidDynamics", inObj, ownerScene); +} + +static void addChild(PvdDataStream& inStream, const void* inParent, const PxArticulationLink& inChild) +{ + inStream.pushBackObjectRef(inParent, "Links", &inChild); + inStream.setPropertyValue(&inChild, "Parent", inParent); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + addSceneGroupProperty(inStream, "Articulations", inObj, ownerScene); + sendAllProperties(inStream, inObj); + PxU32 numLinks = inObj.getNbLinks(); + mBindingData->mArticulationLinks.resize(numLinks); + inObj.getLinks(mBindingData->mArticulationLinks.begin(), numLinks); + // From Dilip Sequiera: + /* + No, there can only be one root, and in all the code I wrote (which is not 100% of the HL code for + articulations), the index of a child is always > the index of the parent. + */ + + // Create all the links + for(PxU32 idx = 0; idx < numLinks; ++idx) + { + if(!inStream.isInstanceValid(mBindingData->mArticulationLinks[idx])) + createInstance(inStream, *mBindingData->mArticulationLinks[idx], ownerPhysics, pvd); + } + + // Setup the link graph + for(PxU32 idx = 0; idx < numLinks; ++idx) + { + PxArticulationLink* link = mBindingData->mArticulationLinks[idx]; + if(idx == 0) + addChild(inStream, &inObj, *link); + + PxU32 numChildren = link->getNbChildren(); + PxArticulationLink** children = mBindingData->allocateTemp(numChildren); + link->getChildren(children, numChildren); + for(PxU32 i = 0; i < numChildren; ++i) + addChild(inStream, link, *children[i]); + } +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj) +{ + PxArticulationReducedCoordinateGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene) +{ + removeSceneGroupProperty(inStream, "Articulations", inObj, ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxArticulationLink& inObj, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + inStream.createInstance(&inObj); + PxArticulationJointReducedCoordinate* joint(inObj.getInboundJoint()); + if(joint) + { + inStream.createInstance(joint); + inStream.setPropertyValue(&inObj, "InboundJoint", reinterpret_cast(joint)); + inStream.setPropertyValue(joint, "Link", reinterpret_cast(&inObj)); + sendAllProperties(inStream, *joint); + } + sendAllProperties(inStream, inObj); + sendShapes(*this, inStream, inObj, ownerPhysics, pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationLink& inObj) +{ + PxArticulationLinkGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxArticulationLink& inObj) +{ + PxArticulationJointReducedCoordinate* joint(inObj.getInboundJoint()); + if(joint) + inStream.destroyInstance(joint); + releaseShapes(*this, inStream, inObj); + inStream.destroyInstance(&inObj); +} +// These are created as part of the articulation link's creation process, so outside entities don't need to +// create them. +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxArticulationJointReducedCoordinate& inObj) +{ + PxArticulationJointReducedCoordinateGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxSoftBody& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxFEMCloth& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxPBDParticleSystem& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxMPMParticleSystem& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxCustomParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxCustomParticleSystem& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxCustomParticleSystem& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); + PX_UNUSED(ownerPhysics); + PX_UNUSED(pvd); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxHairSystem& inObj) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene) +{ + PX_UNUSED(inStream); + PX_UNUSED(inObj); + PX_UNUSED(ownerScene); +} + +void PvdMetaDataBinding::originShift(PvdDataStream& inStream, const PxScene* inScene, PxVec3 shift) +{ + inStream.originShift(inScene, shift); +} + +template +static void updateActor(PvdDataStream& inStream, TActorType** actorGroup, PxU32 numActors, TOperator sleepingOp, PvdMetaDataBindingData& bindingData) +{ + TBlockType theBlock; + if(numActors == 0) + return; + for(PxU32 idx = 0; idx < numActors; ++idx) + { + TActorType* theActor(actorGroup[idx]); + bool sleeping = sleepingOp(theActor, theBlock); + bool wasSleeping = bindingData.mSleepingActors.contains(theActor); + + if(sleeping == false || sleeping != wasSleeping) + { + theBlock.GlobalPose = theActor->getGlobalPose(); + theBlock.AngularVelocity = theActor->getAngularVelocity(); + theBlock.LinearVelocity = theActor->getLinearVelocity(); + inStream.sendPropertyMessageFromGroup(theActor, theBlock); + if(sleeping != wasSleeping) + { + if(sleeping) + bindingData.mSleepingActors.insert(theActor); + else + bindingData.mSleepingActors.erase(theActor); + } + } + } +} + +struct RigidDynamicUpdateOp +{ + bool operator()(PxRigidDynamic* actor, PxRigidDynamicUpdateBlock& block) + { + bool sleeping = actor->isSleeping(); + block.IsSleeping = sleeping; + return sleeping; + } +}; + +struct ArticulationLinkUpdateOp +{ + bool sleeping; + ArticulationLinkUpdateOp(bool s) : sleeping(s) + { + } + bool operator()(PxArticulationLink*, PxArticulationLinkUpdateBlock&) + { + return sleeping; + } +}; + +void PvdMetaDataBinding::updateDynamicActorsAndArticulations(PvdDataStream& inStream, const PxScene* inScene, PvdVisualizer* linkJointViz) +{ + PX_COMPILE_TIME_ASSERT(sizeof(PxRigidDynamicUpdateBlock) == 14 * 4); + { + PxU32 actorCount = inScene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC); + if(actorCount) + { + inStream.beginPropertyMessageGroup(); + mBindingData->mActors.resize(actorCount); + PxActor** theActors = mBindingData->mActors.begin(); + inScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC, theActors, actorCount); + updateActor(inStream, reinterpret_cast(theActors), actorCount, RigidDynamicUpdateOp(), *mBindingData); + inStream.endPropertyMessageGroup(); + } + } + { + PxU32 articulationCount = inScene->getNbArticulations(); + if(articulationCount) + { + mBindingData->mArticulations.resize(articulationCount); + PxArticulationReducedCoordinate** firstArticulation = mBindingData->mArticulations.begin(); + PxArticulationReducedCoordinate** lastArticulation = firstArticulation + articulationCount; + inScene->getArticulations(firstArticulation, articulationCount); + inStream.beginPropertyMessageGroup(); + for(; firstArticulation < lastArticulation; ++firstArticulation) + { + PxU32 linkCount = (*firstArticulation)->getNbLinks(); + bool sleeping = (*firstArticulation)->isSleeping(); + if(linkCount) + { + mBindingData->mArticulationLinks.resize(linkCount); + PxArticulationLink** theLink = mBindingData->mArticulationLinks.begin(); + (*firstArticulation)->getLinks(theLink, linkCount); + updateActor(inStream, theLink, linkCount, ArticulationLinkUpdateOp(sleeping), *mBindingData); + if(linkJointViz) + { + for(PxU32 idx = 0; idx < linkCount; ++idx) + linkJointViz->visualize(*theLink[idx]); + } + } + } + inStream.endPropertyMessageGroup(); + firstArticulation = mBindingData->mArticulations.begin(); + for (; firstArticulation < lastArticulation; ++firstArticulation) + { + inStream.setPropertyValue(*firstArticulation, "IsSleeping", (*firstArticulation)->isSleeping()); + inStream.setPropertyValue(*firstArticulation, "RootGlobalPose", (*firstArticulation)->getRootGlobalPose()); + inStream.setPropertyValue(*firstArticulation, "RootLinearVelocity", (*firstArticulation)->getRootLinearVelocity()); + inStream.setPropertyValue(*firstArticulation, "RootAngularVelocity", (*firstArticulation)->getRootAngularVelocity()); + } + + inStream.beginPropertyMessageGroup(); + firstArticulation = mBindingData->mArticulations.begin(); + + for (; firstArticulation < lastArticulation; ++firstArticulation) + { + PxU32 linkCount = (*firstArticulation)->getNbLinks(); + bool sleeping = (*firstArticulation)->isSleeping(); + if (!sleeping) + { + for (PxU32 idx = 1; idx < linkCount; ++idx) + { + mBindingData->mArticulationLinks.resize(linkCount); + PxArticulationLink** theLink = mBindingData->mArticulationLinks.begin(); + (*firstArticulation)->getLinks(theLink, linkCount); + + PxArticulationJointUpdateBlock jointBlock; + PxArticulationJointReducedCoordinate* joint = theLink[idx]->getInboundJoint(); + jointBlock.JointPosition_eX = joint->getJointPosition(PxArticulationAxis::eX); + jointBlock.JointPosition_eY = joint->getJointPosition(PxArticulationAxis::eY); + jointBlock.JointPosition_eZ = joint->getJointPosition(PxArticulationAxis::eZ); + jointBlock.JointPosition_eTwist = joint->getJointPosition(PxArticulationAxis::eTWIST); + jointBlock.JointPosition_eSwing1 = joint->getJointPosition(PxArticulationAxis::eSWING1); + jointBlock.JointPosition_eSwing2 = joint->getJointPosition(PxArticulationAxis::eSWING2); + + jointBlock.JointVelocity_eX = joint->getJointVelocity(PxArticulationAxis::eX); + jointBlock.JointVelocity_eY = joint->getJointVelocity(PxArticulationAxis::eY); + jointBlock.JointVelocity_eZ = joint->getJointVelocity(PxArticulationAxis::eZ); + jointBlock.JointVelocity_eTwist = joint->getJointVelocity(PxArticulationAxis::eTWIST); + jointBlock.JointVelocity_eSwing1 = joint->getJointVelocity(PxArticulationAxis::eSWING1); + jointBlock.JointVelocity_eSwing2 = joint->getJointVelocity(PxArticulationAxis::eSWING2); + + inStream.sendPropertyMessageFromGroup(joint, jointBlock); + } + } + } + inStream.endPropertyMessageGroup(); + } + } +} + +template +struct CollectionOperator +{ + PxArray& mTempArray; + const TObjType& mObject; + PvdDataStream& mStream; + + CollectionOperator(PxArray& ary, const TObjType& obj, PvdDataStream& stream) + : mTempArray(ary), mObject(obj), mStream(stream) + { + } + void pushName(const char*) + { + } + void popName() + { + } + template + void simpleProperty(PxU32 /*key*/, const TAccessor&) + { + } + template + void flagsProperty(PxU32 /*key*/, const TAccessor&, const PxU32ToName*) + { + } + + template + void handleCollection(const TCollectionProp& prop, NamespacedName dtype, PxU32 countMultiplier = 1) + { + PxU32 count = prop.size(&mObject); + mTempArray.resize(count * sizeof(TDataType)); + TColType* start = reinterpret_cast(mTempArray.begin()); + prop.get(&mObject, start, count * countMultiplier); + mStream.setPropertyValue(&mObject, prop.mName, DataRef(mTempArray.begin(), mTempArray.size()), dtype); + } + template + void handleCollection(const PxReadOnlyCollectionPropertyInfo& prop) + { + handleCollection(prop, getPvdNamespacedNameForType()); + } + // Enumerations or bitflags. + template + void handleCollection(const PxReadOnlyCollectionPropertyInfo& prop, const PxU32ToName*) + { + PX_COMPILE_TIME_ASSERT(sizeof(TColType) == sizeof(PxU32)); + handleCollection(prop, getPvdNamespacedNameForType()); + } + + private: + CollectionOperator& operator=(const CollectionOperator&); +}; + +// per frame update + +#define ENABLE_AGGREGATE_PVD_SUPPORT 1 +#ifdef ENABLE_AGGREGATE_PVD_SUPPORT + +void PvdMetaDataBinding::createInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene) +{ + addSceneGroupProperty(inStream, "Aggregates", inObj, ownerScene); + sendAllProperties(inStream, inObj); +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream& inStream, const PxAggregate& inObj) +{ + PxAggregateGeneratedValues values(&inObj); + inStream.setPropertyMessage(&inObj, values); +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene) +{ + removeSceneGroupProperty(inStream, "Aggregates", inObj, ownerScene); +} + +class ChangeOjectRefCmd : public PvdDataStream::PvdCommand +{ + ChangeOjectRefCmd& operator=(const ChangeOjectRefCmd&) + { + PX_ASSERT(0); + return *this; + } // PX_NOCOPY doesn't work for local classes + public: + const void* mInstance; + String mPropName; + const void* mPropObj; + const bool mPushBack; + + ChangeOjectRefCmd(const void* inInst, String inName, const void* inObj, bool pushBack) + : mInstance(inInst), mPropName(inName), mPropObj(inObj), mPushBack(pushBack) + { + } + + // Assigned is needed for copying + ChangeOjectRefCmd(const ChangeOjectRefCmd& other) + : PvdDataStream::PvdCommand(other), mInstance(other.mInstance), mPropName(other.mPropName), mPropObj(other.mPropObj), mPushBack(other.mPushBack) + { + } + + virtual bool canRun(PvdInstanceDataStream& inStream) + { + PX_ASSERT(inStream.isInstanceValid(mInstance)); + return inStream.isInstanceValid(mPropObj); + } + virtual void run(PvdInstanceDataStream& inStream) + { + if(!inStream.isInstanceValid(mInstance)) + return; + + if(mPushBack) + { + if(inStream.isInstanceValid(mPropObj)) + inStream.pushBackObjectRef(mInstance, mPropName, mPropObj); + } + else + { + // the called function will assert if propobj is already removed + inStream.removeObjectRef(mInstance, mPropName, mPropObj); + } + } +}; + +static void changeAggregateSubActors(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor, bool pushBack) +{ + const PxArticulationLink* link = inActor.is(); + String propName = NULL; + const void* object = NULL; + if(link == NULL) + { + propName = "Actors"; + object = &inActor; + } + else if(link->getInboundJoint() == NULL) + { + propName = "Articulations"; + object = &link->getArticulation(); + } + else + return; + + ChangeOjectRefCmd* cmd = PX_PLACEMENT_NEW(inStream.allocateMemForCmd(sizeof(ChangeOjectRefCmd)), ChangeOjectRefCmd)(&inObj, propName, object, pushBack); + + if(cmd->canRun(inStream)) + cmd->run(inStream); + else + inStream.pushPvdCommand(*cmd); +} +void PvdMetaDataBinding::detachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor) +{ + changeAggregateSubActors(inStream, inObj, inActor, false); +} + +void PvdMetaDataBinding::attachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor) +{ + changeAggregateSubActors(inStream, inObj, inActor, true); +} +#else +void PvdMetaDataBinding::createInstance(PvdDataStream&, const PxAggregate&, const PxScene&, ObjectRegistrar&) +{ +} + +void PvdMetaDataBinding::sendAllProperties(PvdDataStream&, const PxAggregate&) +{ +} + +void PvdMetaDataBinding::destroyInstance(PvdDataStream&, const PxAggregate&, const PxScene&) +{ +} + +void PvdMetaDataBinding::detachAggregateActor(PvdDataStream&, const PxAggregate&, const PxActor&) +{ +} + +void PvdMetaDataBinding::attachAggregateActor(PvdDataStream&, const PxAggregate&, const PxActor&) +{ +} +#endif + +template +static void sendSceneArray(PvdDataStream& inStream, const PxScene& inScene, const PxArray& inArray, const char* propName) +{ + if(0 == inArray.size()) + inStream.setPropertyValue(&inScene, propName, DataRef(), getPvdNamespacedNameForType()); + else + { + ScopedPropertyValueSender sender(inStream, &inScene, propName); + for(PxU32 i = 0; i < inArray.size(); ++i) + sender.append(inArray[i]); + } +} + +static void sendSceneArray(PvdDataStream& inStream, const PxScene& inScene, const PxArray& inArray, const char* propName) +{ + if(0 == inArray.size()) + inStream.setPropertyValue(&inScene, propName, DataRef(), getPvdNamespacedNameForType()); + else + { + ScopedPropertyValueSender sender(inStream, &inScene, propName); + for(PxU32 i = 0; i < inArray.size(); ++i) + { + if(!inStream.isInstanceValid(inArray[i].mShape) || !inStream.isInstanceValid(inArray[i].mActor)) + { + PvdSqHit hit = inArray[i]; + hit.mShape = NULL; + hit.mActor = NULL; + sender.append(hit); + } + else + sender.append(inArray[i]); + } + } +} + +void PvdMetaDataBinding::sendSceneQueries(PvdDataStream& inStream, const PxScene& inScene, PsPvd* pvd) +{ + if(!inStream.isConnected()) + return; + + const physx::NpScene& scene = static_cast(inScene); + + { + PvdSceneQueryCollector& collector = scene.getNpSQ().getSingleSqCollector(); + PxMutex::ScopedLock lock(collector.getLock()); + + String propName = collector.getArrayName(collector.mPvdSqHits); + sendSceneArray(inStream, inScene, collector.mPvdSqHits, propName); + + propName = collector.getArrayName(collector.mPoses); + sendSceneArray(inStream, inScene, collector.mPoses, propName); + + propName = collector.getArrayName(collector.mFilterData); + sendSceneArray(inStream, inScene, collector.mFilterData, propName); + + const NamedArray& geometriesToDestroy = collector.getPrevFrameGeometries(); + propName = collector.getArrayName(geometriesToDestroy); + for(PxU32 k = 0; k < geometriesToDestroy.size(); ++k) + { + const PxGeometryHolder& inObj = geometriesToDestroy[k]; + inStream.removeObjectRef(&inScene, propName, &inObj); + inStream.destroyInstance(&inObj); + } + const PxArray& geometriesToCreate = collector.getCurrentFrameGeometries(); + for(PxU32 k = 0; k < geometriesToCreate.size(); ++k) + { + const PxGeometry& geometry = geometriesToCreate[k].any(); + switch(geometry.getType()) + { +#define SEND_PVD_GEOM_TYPE(enumType, TGeomType, TValueType) \ + case enumType: \ + { \ + const TGeomType& inObj = static_cast(geometry); \ + inStream.createInstance(getPvdNamespacedNameForType(), &inObj); \ + registrarPhysicsObject(inStream, inObj, pvd); \ + TValueType values(&inObj); \ + inStream.setPropertyMessage(&inObj, values); \ + inStream.pushBackObjectRef(&inScene, propName, &inObj); \ + } \ + break; + SEND_PVD_GEOM_TYPE(PxGeometryType::eBOX, PxBoxGeometry, PxBoxGeometryGeneratedValues) + SEND_PVD_GEOM_TYPE(PxGeometryType::eSPHERE, PxSphereGeometry, PxSphereGeometryGeneratedValues) + SEND_PVD_GEOM_TYPE(PxGeometryType::eCAPSULE, PxCapsuleGeometry, PxCapsuleGeometryGeneratedValues) + SEND_PVD_GEOM_TYPE(PxGeometryType::eCONVEXMESH, PxConvexMeshGeometry, PxConvexMeshGeometryGeneratedValues) +#undef SEND_PVD_GEOM_TYPE + case PxGeometryType::ePLANE: + case PxGeometryType::eTRIANGLEMESH: + case PxGeometryType::eHEIGHTFIELD: + case PxGeometryType::eTETRAHEDRONMESH: + case PxGeometryType::ePARTICLESYSTEM: + case PxGeometryType::eHAIRSYSTEM: + case PxGeometryType::eCUSTOM: + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + PX_ALWAYS_ASSERT_MESSAGE("unsupported scene query geometry type"); + break; + } + } + collector.prepareNextFrameGeometries(); + + propName = collector.getArrayName(collector.mAccumulatedRaycastQueries); + sendSceneArray(inStream, inScene, collector.mAccumulatedRaycastQueries, propName); + + propName = collector.getArrayName(collector.mAccumulatedOverlapQueries); + sendSceneArray(inStream, inScene, collector.mAccumulatedOverlapQueries, propName); + + propName = collector.getArrayName(collector.mAccumulatedSweepQueries); + sendSceneArray(inStream, inScene, collector.mAccumulatedSweepQueries, propName); + } +} +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.h new file mode 100644 index 0000000..3c2faaa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdMetaDataPvdBinding.h @@ -0,0 +1,205 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PVD_META_DATA_PVD_BINDING_H +#define PVD_META_DATA_PVD_BINDING_H + +#if PX_SUPPORT_PVD + +#include "PxPhysXConfig.h" +#include "foundation/PxArray.h" + +namespace physx +{ + class PxScene; + + namespace pvdsdk + { + class PsPvd; + class PvdDataStream; + struct PvdMetaDataBindingData; + } +} + +namespace physx +{ + +namespace Sc +{ +struct Contact; +} + +namespace Vd +{ + +using namespace physx::pvdsdk; + +class PvdVisualizer +{ + protected: + virtual ~PvdVisualizer() + { + } + + public: + virtual void visualize(PxArticulationLink& link) = 0; +}; + +class PvdMetaDataBinding +{ + PvdMetaDataBindingData* mBindingData; + + public: + PvdMetaDataBinding(); + ~PvdMetaDataBinding(); + void registerSDKProperties(PvdDataStream& inStream); + + void sendAllProperties(PvdDataStream& inStream, const PxPhysics& inPhysics); + + void sendAllProperties(PvdDataStream& inStream, const PxScene& inScene); + // per frame update + void sendBeginFrame(PvdDataStream& inStream, const PxScene* inScene, PxReal simulateElapsedTime); + void sendContacts(PvdDataStream& inStream, const PxScene& inScene, PxArray& inContacts); + void sendContacts(PvdDataStream& inStream, const PxScene& inScene); + void sendStats(PvdDataStream& inStream, const PxScene* inScene); + void sendSceneQueries(PvdDataStream& inStream, const PxScene& inScene, PsPvd* pvd); + void sendEndFrame(PvdDataStream& inStream, const PxScene* inScene); + + void createInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxMaterial& inMaterial); + void destroyInstance(PvdDataStream& inStream, const PxMaterial& inMaterial, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxFEMSoftBodyMaterial& inMaterial, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxFEMSoftBodyMaterial& inMaterial); + void destroyInstance(PvdDataStream& inStream, const PxFEMSoftBodyMaterial& inMaterial, const PxPhysics& ownerPhysics); + + // jcarius: Commented-out until FEMCloth is not under construction anymore + // void createInstance(PvdDataStream& inStream, const PxFEMClothMaterial& inMaterial, const PxPhysics& ownerPhysics); + // void sendAllProperties(PvdDataStream& inStream, const PxFEMClothMaterial& inMaterial); + // void destroyInstance(PvdDataStream& inStream, const PxFEMClothMaterial& inMaterial, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxPBDMaterial& inMaterial, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxPBDMaterial& inMaterial); + void destroyInstance(PvdDataStream& inStream, const PxPBDMaterial& inMaterial, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxFLIPMaterial& inMaterial, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxFLIPMaterial& inMaterial); + void destroyInstance(PvdDataStream& inStream, const PxFLIPMaterial& inMaterial, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxMPMMaterial& inMaterial, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxMPMMaterial& inMaterial); + void destroyInstance(PvdDataStream& inStream, const PxMPMMaterial& inMaterial, const PxPhysics& ownerPhysics); + + + void createInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics); + void sendAllProperties(PvdDataStream& inStream, const PxHeightField& inData); + void destroyInstance(PvdDataStream& inStream, const PxHeightField& inData, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics); + void destroyInstance(PvdDataStream& inStream, const PxConvexMesh& inData, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics); + void destroyInstance(PvdDataStream& inStream, const PxTetrahedronMesh& inData, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics); + void destroyInstance(PvdDataStream& inStream, const PxTriangleMesh& inData, const PxPhysics& ownerPhysics); + + void createInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxRigidStatic& inObj); + void destroyInstance(PvdDataStream& inStream, const PxRigidStatic& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxRigidDynamic& inObj); + void destroyInstance(PvdDataStream& inStream, const PxRigidDynamic& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxSoftBody& inObj); + void destroyInstance(PvdDataStream& inStream, const PxSoftBody& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxFEMCloth& inObj); + void destroyInstance(PvdDataStream& inStream, const PxFEMCloth& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxPBDParticleSystem& inObj); + void destroyInstance(PvdDataStream& inStream, const PxPBDParticleSystem& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj); + void destroyInstance(PvdDataStream& inStream, const PxFLIPParticleSystem& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxMPMParticleSystem& inObj); + void destroyInstance(PvdDataStream& inStream, const PxMPMParticleSystem& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxCustomParticleSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxCustomParticleSystem& inObj); + void destroyInstance(PvdDataStream& inStream, const PxCustomParticleSystem& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxHairSystem& inObj); + void destroyInstance(PvdDataStream& inStream, const PxHairSystem& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj); + void destroyInstance(PvdDataStream& inStream, const PxArticulationReducedCoordinate& inObj, const PxScene& ownerScene); + + void createInstance(PvdDataStream& inStream, const PxArticulationLink& inObj, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxArticulationLink& inObj); + void destroyInstance(PvdDataStream& inStream, const PxArticulationLink& inObj); + + void createInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner, const PxPhysics& ownerPhysics, PsPvd* pvd); + void sendAllProperties(PvdDataStream& inStream, const PxShape& inObj); + void releaseAndRecreateGeometry(PvdDataStream& inStream, const PxShape& inObj, PxPhysics& ownerPhysics, PsPvd* pvd); + void updateMaterials(PvdDataStream& inStream, const PxShape& inObj, PsPvd* pvd); + void destroyInstance(PvdDataStream& inStream, const PxShape& inObj, const PxRigidActor& owner); + + // These are created as part of the articulation link's creation process, so outside entities don't need to + // create them. + void sendAllProperties(PvdDataStream& inStream, const PxArticulationJointReducedCoordinate& inObj); + + // per frame update + void updateDynamicActorsAndArticulations(PvdDataStream& inStream, const PxScene* inScene, PvdVisualizer* linkJointViz); + + // Origin Shift + void originShift(PvdDataStream& inStream, const PxScene* inScene, PxVec3 shift); + + void createInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene); + void sendAllProperties(PvdDataStream& inStream, const PxAggregate& inObj); + void destroyInstance(PvdDataStream& inStream, const PxAggregate& inObj, const PxScene& ownerScene); + void detachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor); + void attachAggregateActor(PvdDataStream& inStream, const PxAggregate& inObj, const PxActor& inActor); + + template + void registrarPhysicsObject(PvdDataStream&, const TDataType&, PsPvd*); +}; +} +} + +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp new file mode 100644 index 0000000..fd032fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.cpp @@ -0,0 +1,274 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// PX_DUMMY_SYMBOL + +#if PX_SUPPORT_PVD + +#include "pvd/PxPvdTransport.h" +#include "PxPhysics.h" +#include "PxPvdClient.h" +#include "PxPvdDataStream.h" +#include "PxPvdObjectModelBaseTypes.h" +#include "PvdPhysicsClient.h" +#include "PvdTypeNames.h" + +using namespace physx; +using namespace physx::Vd; + +PvdPhysicsClient::PvdPhysicsClient(PsPvd* pvd) +: mPvd(pvd), mPvdDataStream(NULL), mIsConnected(false) +{ +} + +PvdPhysicsClient::~PvdPhysicsClient() +{ + mPvd->removeClient(this); +} + +PvdDataStream* PvdPhysicsClient::getDataStream() +{ + return mPvdDataStream; +} + +bool PvdPhysicsClient::isConnected() const +{ + return mIsConnected; +} + +void PvdPhysicsClient::onPvdConnected() +{ + if(mIsConnected || !mPvd) + return; + + mIsConnected = true; + mPvdDataStream = PvdDataStream::create(mPvd); + sendEntireSDK(); +} + +void PvdPhysicsClient::onPvdDisconnected() +{ + if(!mIsConnected) + return; + mIsConnected = false; + + mPvdDataStream->release(); + mPvdDataStream = NULL; +} + +void PvdPhysicsClient::flush() +{ +} + +void PvdPhysicsClient::sendEntireSDK() +{ + PxPhysics& physics = PxGetPhysics(); + + mMetaDataBinding.registerSDKProperties(*mPvdDataStream); + mPvdDataStream->createInstance(&physics); + + mPvdDataStream->setIsTopLevelUIElement(&physics, true); + mMetaDataBinding.sendAllProperties(*mPvdDataStream, physics); + +#define SEND_BUFFER_GROUP(type, name) \ + { \ + physx::PxArray buffers; \ + PxU32 numBuffers = physics.getNb##name(); \ + buffers.resize(numBuffers); \ + physics.get##name(buffers.begin(), numBuffers); \ + for(PxU32 i = 0; i < numBuffers; i++) \ + { \ + if(mPvd->registerObject(buffers[i])) \ + createPvdInstance(buffers[i]); \ + } \ + } + + SEND_BUFFER_GROUP(PxMaterial, Materials); + SEND_BUFFER_GROUP(PxTriangleMesh, TriangleMeshes); + SEND_BUFFER_GROUP(PxConvexMesh, ConvexMeshes); + SEND_BUFFER_GROUP(PxTetrahedronMesh, TetrahedronMeshes); + SEND_BUFFER_GROUP(PxHeightField, HeightFields); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxPhysics* physics) +{ + if(mPvdDataStream) + mPvdDataStream->destroyInstance(physics); +} + +void PvdPhysicsClient::createPvdInstance(const PxTriangleMesh* triMesh) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *triMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxTriangleMesh* triMesh) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *triMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxTetrahedronMesh* tetMesh) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *tetMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxTetrahedronMesh* tetMesh) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *tetMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxConvexMesh* convexMesh) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *convexMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxConvexMesh* convexMesh) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *convexMesh, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxHeightField* heightField) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *heightField, PxGetPhysics()); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxHeightField* heightField) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *heightField, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxMaterial* mat) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::updatePvdProperties(const PxMaterial* mat) +{ + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *mat); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxMaterial* mat) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxFEMSoftBodyMaterial* mat) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::updatePvdProperties(const PxFEMSoftBodyMaterial* mat) +{ + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *mat); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxFEMSoftBodyMaterial* mat) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + + +void PvdPhysicsClient::createPvdInstance(const PxFEMClothMaterial* /*mat*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + + // mMetaDataBinding.createInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::updatePvdProperties(const PxFEMClothMaterial* /*mat*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + + // mMetaDataBinding.sendAllProperties(*mPvdDataStream, *mat); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxFEMClothMaterial* /*mat*/) +{ + // jcarius: Commented-out until FEMCloth is not under construction anymore + PX_ASSERT(0); + + // mMetaDataBinding.destroyInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::createPvdInstance(const PxPBDMaterial* mat) +{ + mMetaDataBinding.createInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::updatePvdProperties(const PxPBDMaterial* mat) +{ + mMetaDataBinding.sendAllProperties(*mPvdDataStream, *mat); +} + +void PvdPhysicsClient::destroyPvdInstance(const PxPBDMaterial* mat) +{ + mMetaDataBinding.destroyInstance(*mPvdDataStream, *mat, PxGetPhysics()); +} + +void PvdPhysicsClient::onMeshFactoryBufferRelease(const PxBase* object, PxType typeID) +{ + if(!mIsConnected || !mPvd) + return; + + if(mPvd->unRegisterObject(object)) + { + switch(typeID) + { + case PxConcreteType::eHEIGHTFIELD: + destroyPvdInstance(static_cast(object)); + break; + + case PxConcreteType::eCONVEX_MESH: + destroyPvdInstance(static_cast(object)); + break; + + case PxConcreteType::eTRIANGLE_MESH_BVH33: + case PxConcreteType::eTRIANGLE_MESH_BVH34: + destroyPvdInstance(static_cast(object)); + break; + + case PxConcreteType::eTETRAHEDRON_MESH: + destroyPvdInstance(static_cast(object)); + break; + + default: + break; + } + } +} + +void PvdPhysicsClient::reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) +{ + if(mIsConnected) + { + mPvdDataStream->sendErrorMessage(code, message, file, PxU32(line)); + } +} + +#endif // PX_SUPPORT_PVD diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.h new file mode 100644 index 0000000..bf56aef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdPhysicsClient.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PVD_PHYSICS_CLIENT_H +#define PVD_PHYSICS_CLIENT_H +#if PX_SUPPORT_PVD +#include "foundation/PxErrorCallback.h" +#include "foundation/PxHashMap.h" +#include "PxPvdClient.h" +#include "PvdMetaDataPvdBinding.h" +#include "NpFactory.h" +#include "foundation/PxMutex.h" +#include "PsPvd.h" + +namespace physx +{ +class PxProfileMemoryEventBuffer; + +namespace Vd +{ + +class PvdPhysicsClient : public PvdClient, public PxErrorCallback, public NpFactoryListener, public PxUserAllocated +{ + PX_NOCOPY(PvdPhysicsClient) + public: + PvdPhysicsClient(PsPvd* pvd); + virtual ~PvdPhysicsClient(); + + bool isConnected() const; + void onPvdConnected(); + void onPvdDisconnected(); + void flush(); + + physx::pvdsdk::PvdDataStream* getDataStream(); + + void sendEntireSDK(); + void destroyPvdInstance(const PxPhysics* physics); + + // NpFactoryListener + virtual void onMeshFactoryBufferRelease(const PxBase* object, PxType typeID); + /// NpFactoryListener + + // PxErrorCallback + void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line); + + private: + void createPvdInstance(const PxTriangleMesh* triMesh); + void destroyPvdInstance(const PxTriangleMesh* triMesh); + void createPvdInstance(const PxTetrahedronMesh* tetMesh); + void destroyPvdInstance(const PxTetrahedronMesh* tetMesh); + void createPvdInstance(const PxConvexMesh* convexMesh); + void destroyPvdInstance(const PxConvexMesh* convexMesh); + void createPvdInstance(const PxHeightField* heightField); + void destroyPvdInstance(const PxHeightField* heightField); + void createPvdInstance(const PxMaterial* mat); + void destroyPvdInstance(const PxMaterial* mat); + void updatePvdProperties(const PxMaterial* mat); + + void createPvdInstance(const PxFEMSoftBodyMaterial* mat); + void destroyPvdInstance(const PxFEMSoftBodyMaterial* mat); + void updatePvdProperties(const PxFEMSoftBodyMaterial* mat); + + void createPvdInstance(const PxFEMClothMaterial* mat); + void destroyPvdInstance(const PxFEMClothMaterial* mat); + void updatePvdProperties(const PxFEMClothMaterial* mat); + + void createPvdInstance(const PxPBDMaterial* mat); + void destroyPvdInstance(const PxPBDMaterial* mat); + void updatePvdProperties(const PxPBDMaterial* mat); + + PsPvd* mPvd; + PvdDataStream* mPvdDataStream; + PvdMetaDataBinding mMetaDataBinding; + bool mIsConnected; +}; + +} // namespace Vd +} // namespace physx + +#endif // PX_SUPPORT_PVD +#endif // PVD_PHYSICS_CLIENT_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdTypeNames.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdTypeNames.h new file mode 100644 index 0000000..1f3b105 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/PvdTypeNames.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#ifndef PVD_TYPE_NAMES_H +#define PVD_TYPE_NAMES_H +#if PX_SUPPORT_PVD +#include "geometry/PxHeightFieldSample.h" +#include "PxPvdObjectModelBaseTypes.h" +#include "PxMetaDataObjects.h" + +namespace physx +{ +namespace Vd +{ +struct PvdSqHit; +struct PvdRaycast; +struct PvdOverlap; +struct PvdSweep; + +struct PvdHullPolygonData +{ + PxU16 mNumVertices; + PxU16 mIndexBase; + PvdHullPolygonData(PxU16 numVert, PxU16 idxBase) : mNumVertices(numVert), mIndexBase(idxBase) + { + } +}; + + +struct PxArticulationLinkUpdateBlock +{ + PxTransform GlobalPose; + PxVec3 LinearVelocity; + PxVec3 AngularVelocity; +}; + +struct PxArticulationJointUpdateBlock +{ + PxReal JointPosition_eX; + PxReal JointPosition_eY; + PxReal JointPosition_eZ; + PxReal JointPosition_eTwist; + PxReal JointPosition_eSwing1; + PxReal JointPosition_eSwing2; + PxReal JointVelocity_eX; + PxReal JointVelocity_eY; + PxReal JointVelocity_eZ; + PxReal JointVelocity_eTwist; + PxReal JointVelocity_eSwing1; + PxReal JointVelocity_eSwing2; +}; + +struct PxRigidDynamicUpdateBlock : public PxArticulationLinkUpdateBlock +{ + bool IsSleeping; +}; + +struct PvdContact +{ + PxVec3 point; + PxVec3 axis; + const void* shape0; + const void* shape1; + PxF32 separation; + PxF32 normalForce; + PxU32 internalFaceIndex0; + PxU32 internalFaceIndex1; + bool normalForceAvailable; +}; + +struct PvdPositionAndRadius +{ + PxVec3 position; + PxF32 radius; +}; + +} //Vd +} //physx + +namespace physx +{ +namespace pvdsdk +{ + +#define DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(type) DEFINE_PVD_TYPE_NAME_MAP(physx::type, "physx3", #type) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPhysics) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxScene) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTolerancesScale) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTolerancesScaleGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSceneDescGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSceneDesc) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSimulationStatistics) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSimulationStatisticsGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxMaterial) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxMaterialGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFEMSoftBodyMaterial) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFEMSoftBodyMaterialGeneratedValues) +// DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFEMClothMaterial) // jcarius: Commented-out until FEMCloth is not under construction anymore +// DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFEMClothMaterialGeneratedValues) // jcarius: Commented-out until FEMCloth is not under construction anymore +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPBDMaterial) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPBDMaterialGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightField) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightFieldDesc) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightFieldDescGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTriangleMesh) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTetrahedronMesh) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxConvexMesh) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxActor) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidActor) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidBody) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidDynamic) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidDynamicGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidStatic) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRigidStaticGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxShape) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxShapeGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxBoxGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPlaneGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxCapsuleGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSphereGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightFieldGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTriangleMeshGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTetrahedronMeshGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxConvexMeshGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxCustomGeometry) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxBoxGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPlaneGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxCapsuleGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSphereGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTetrahedronMeshGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightFieldGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxTriangleMeshGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxConvexMeshGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxCustomGeometryGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxHeightFieldSample) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxConstraint) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxConstraintGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationReducedCoordinate) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationReducedCoordinateGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationLink) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationLinkGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationJointReducedCoordinate) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxArticulationJointReducedCoordinateGeneratedValues) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxAggregate) +DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxAggregateGeneratedValues) + +#undef DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP + +#define DEFINE_NATIVE_PVD_TYPE_MAP(type) DEFINE_PVD_TYPE_NAME_MAP(physx::Vd::type, "physx3", #type) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdHullPolygonData) +DEFINE_NATIVE_PVD_TYPE_MAP(PxRigidDynamicUpdateBlock) +DEFINE_NATIVE_PVD_TYPE_MAP(PxArticulationLinkUpdateBlock) +DEFINE_NATIVE_PVD_TYPE_MAP(PxArticulationJointUpdateBlock) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdContact) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdRaycast) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdSweep) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdOverlap) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdSqHit) +DEFINE_NATIVE_PVD_TYPE_MAP(PvdPositionAndRadius) + +#undef DEFINE_NATIVE_PVD_TYPE_MAP + + +DEFINE_PVD_TYPE_ALIAS(physx::PxFilterData, U32Array4) + + +} +} + +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/PhysXIndicator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/PhysXIndicator.h new file mode 100644 index 0000000..9702c90 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/PhysXIndicator.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef __PHYSXINDICATOR_H__ +#define __PHYSXINDICATOR_H__ + +#include "foundation/PxPreprocessor.h" + +namespace physx +{ + struct NvPhysXToDrv_Data_V1_; + + class PhysXIndicator + { + public: + PhysXIndicator(bool isGpu = false); + ~PhysXIndicator(); + + void setIsGpu(bool isGpu); + + private: + void updateCounter(int delta); + + NvPhysXToDrv_Data_V1_* mPhysXDataPtr; + void* mFileHandle; + bool mIsGpu; + }; +} + +#endif // __PHYSXINDICATOR_H__ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/linux/PhysXIndicatorLinux.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/linux/PhysXIndicatorLinux.cpp new file mode 100644 index 0000000..07925fe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/linux/PhysXIndicatorLinux.cpp @@ -0,0 +1,50 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PhysXIndicator.h" +#include "nvPhysXtoDrv.h" + +physx::PhysXIndicator::PhysXIndicator(bool isGpu) +: mPhysXDataPtr(0), mFileHandle(0), mIsGpu(isGpu) +{ + +} + +physx::PhysXIndicator::~PhysXIndicator() +{ +} + +void physx::PhysXIndicator::setIsGpu(bool isGpu) +{ + PX_UNUSED(isGpu); +} + +PX_INLINE void physx::PhysXIndicator::updateCounter(int delta) +{ + PX_UNUSED(delta); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/nvPhysXtoDrv.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/nvPhysXtoDrv.h new file mode 100644 index 0000000..639f1b8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/nvPhysXtoDrv.h @@ -0,0 +1,92 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef __NVPHYSXTODRV_H__ +#define __NVPHYSXTODRV_H__ + +// The puprose of this interface is to provide graphics drivers with information +// about PhysX state to draw PhysX visual indicator + +// We share information between modules using a memory section object. PhysX creates +// such object, graphics drivers try to open it. The name of the object has +// fixed part (NvPhysXToDrv_SectionName) followed by the process id. This allows +// each process to have its own communication channel. + +namespace physx +{ + +#define NvPhysXToDrv_SectionName "PH71828182845_" + +// Vista apps cannot create stuff in Global\\ namespace when NOT elevated, so use local scope +#define NvPhysXToDrv_Build_SectionName(PID, buf) sprintf(buf, NvPhysXToDrv_SectionName "%x", static_cast(PID)) +#define NvPhysXToDrv_Build_SectionNameXP(PID, buf) sprintf(buf, "Global\\" NvPhysXToDrv_SectionName "%x", static_cast(PID)) + +typedef struct NvPhysXToDrv_Header_ +{ + int signature; // header interface signature + int version; // version of the interface + int size; // size of the structure + int reserved; // reserved, must be zero +} NvPhysXToDrv_Header; + +// this structure describes layout of data in the shared memory section +typedef struct NvPhysXToDrv_Data_V1_ +{ + NvPhysXToDrv_Header header; // keep this member first in all versions of the interface. + + int bCpuPhysicsPresent; // nonzero if cpu physics is initialized + int bGpuPhysicsPresent; // nonzero if gpu physics is initialized + +} NvPhysXToDrv_Data_V1; + +// some random magic number as our interface signature +#define NvPhysXToDrv_Header_Signature 0xA7AB + +// use the macro to setup the header to the latest version of the interface +// update the macro when a new verson of the interface is added +#define NvPhysXToDrv_Header_Init(header) \ +{ \ + header.signature = NvPhysXToDrv_Header_Signature; \ + header.version = 1; \ + header.size = sizeof(NvPhysXToDrv_Data_V1); \ + header.reserved = 0; \ +} + +// validate the header against all known interface versions +// add validation checks when new interfaces are added +#define NvPhysXToDrv_Header_Validate(header, curVersion) \ + ( \ + (header.signature == NvPhysXToDrv_Header_Signature) && \ + (header.version == curVersion) && \ + (curVersion == 1) && \ + (header.size == sizeof(NvPhysXToDrv_Data_V1)) \ + ) + +} + +#endif // __NVPHYSXTODRV_H__ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/windows/PhysXIndicatorWindows.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/windows/PhysXIndicatorWindows.cpp new file mode 100644 index 0000000..ffa4a31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/device/windows/PhysXIndicatorWindows.cpp @@ -0,0 +1,130 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PhysXIndicator.h" +#include "nvPhysXtoDrv.h" + +#pragma warning (push) +#pragma warning (disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' +#include +#pragma warning (pop) + +#include + +#if _MSC_VER >= 1800 +#include +#endif + +// Scope-based to indicate to NV driver that CPU PhysX is happening +physx::PhysXIndicator::PhysXIndicator(bool isGpu) +: mPhysXDataPtr(0), mFileHandle(0), mIsGpu(isGpu) +{ + // Get the windows version (we can only create Global\\ namespace objects in XP) + /** + Operating system Version number + ---------------- -------------- + Windows 7 6.1 + Windows Server 2008 R2 6.1 + Windows Server 2008 6.0 + Windows Vista 6.0 + Windows Server 2003 R2 5.2 + Windows Server 2003 5.2 + Windows XP 5.1 + Windows 2000 5.0 + **/ + + char configName[128]; + +#if _MSC_VER >= 1800 + if (!IsWindowsVistaOrGreater()) +#else + OSVERSIONINFOEX windowsVersionInfo; + windowsVersionInfo.dwOSVersionInfoSize = sizeof (windowsVersionInfo); + GetVersionEx((LPOSVERSIONINFO)&windowsVersionInfo); + + if (windowsVersionInfo.dwMajorVersion < 6) +#endif + NvPhysXToDrv_Build_SectionNameXP(GetCurrentProcessId(), configName); + else + NvPhysXToDrv_Build_SectionName(GetCurrentProcessId(), configName); + + mFileHandle = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, + PAGE_READWRITE, 0, sizeof(NvPhysXToDrv_Data_V1), configName); + + if (!mFileHandle || mFileHandle == INVALID_HANDLE_VALUE) + return; + + bool alreadyExists = ERROR_ALREADY_EXISTS == GetLastError(); + + mPhysXDataPtr = (physx::NvPhysXToDrv_Data_V1*)MapViewOfFile(mFileHandle, + FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(NvPhysXToDrv_Data_V1)); + + if(!mPhysXDataPtr) + return; + + if (!alreadyExists) + { + mPhysXDataPtr->bCpuPhysicsPresent = 0; + mPhysXDataPtr->bGpuPhysicsPresent = 0; + } + + updateCounter(1); + + // init header last to prevent race conditions + // this must be done because the driver may have already created the shared memory block, + // thus alreadyExists may be true, even if PhysX hasn't been initialized + NvPhysXToDrv_Header_Init(mPhysXDataPtr->header); +} + +physx::PhysXIndicator::~PhysXIndicator() +{ + if(mPhysXDataPtr) + { + updateCounter(-1); + UnmapViewOfFile(mPhysXDataPtr); + } + + if(mFileHandle && mFileHandle != INVALID_HANDLE_VALUE) + CloseHandle(mFileHandle); +} + +void physx::PhysXIndicator::setIsGpu(bool isGpu) +{ + if(!mPhysXDataPtr) + return; + + updateCounter(-1); + mIsGpu = isGpu; + updateCounter(1); +} + +PX_INLINE void physx::PhysXIndicator::updateCounter(int delta) +{ + (mIsGpu ? mPhysXDataPtr->bGpuPhysicsPresent + : mPhysXDataPtr->bCpuPhysicsPresent) += delta; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxGpu.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxGpu.cpp new file mode 100644 index 0000000..309275e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxGpu.cpp @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "PxPhysXConfig.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "gpu/PxGpu.h" + +#ifndef PX_PHYSX_GPU_STATIC + +namespace physx +{ + //forward declare stuff from PxPhysXGpuModuleLoader.cpp + void PxLoadPhysxGPUModule(const char* appGUID); + + typedef physx::PxCudaContextManager* (PxCreateCudaContextManager_FUNC)(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback); + typedef int (PxGetSuggestedCudaDeviceOrdinal_FUNC)(physx::PxErrorCallback& errc); + typedef void (PxSetPhysXGpuProfilerCallback_FUNC)(physx::PxProfilerCallback* cbk); + typedef void (PxCudaRegisterFunction_FUNC)(int, const char*); + typedef void** (PxCudaRegisterFatBinary_FUNC)(void*); + typedef physx::PxKernelIndex* (PxGetCudaFunctionTable_FUNC)(); + typedef PxU32 (PxGetCudaFunctionTableSize_FUNC)(); + typedef void** PxGetCudaModuleTable_FUNC(); + + extern PxCreateCudaContextManager_FUNC* g_PxCreateCudaContextManager_Func; + extern PxGetSuggestedCudaDeviceOrdinal_FUNC* g_PxGetSuggestedCudaDeviceOrdinal_Func; + extern PxSetPhysXGpuProfilerCallback_FUNC* g_PxSetPhysXGpuProfilerCallback_Func; + extern PxCudaRegisterFunction_FUNC* g_PxCudaRegisterFunction_Func; + extern PxCudaRegisterFatBinary_FUNC* g_PxCudaRegisterFatBinary_Func; + extern PxGetCudaFunctionTable_FUNC* g_PxGetCudaFunctionTable_Func; + extern PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaFunctionTableSize_Func; + extern PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaModuleTableSize_Func; + extern PxGetCudaModuleTable_FUNC* g_PxGetCudaModuleTable_Func; + +} // end of physx namespace + + + +physx::PxCudaContextManager* PxCreateCudaContextManager(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback) +{ + if (!physx::g_PxCreateCudaContextManager_Func) + physx::PxLoadPhysxGPUModule(desc.appGUID); + + if (physx::g_PxCreateCudaContextManager_Func) + return physx::g_PxCreateCudaContextManager_Func(foundation, desc, profilerCallback); + else + return NULL; +} + +int PxGetSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc) +{ + if (!physx::g_PxGetSuggestedCudaDeviceOrdinal_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if (physx::g_PxGetSuggestedCudaDeviceOrdinal_Func) + return physx::g_PxGetSuggestedCudaDeviceOrdinal_Func(errc); + else + return -1; +} + +void PxSetPhysXGpuProfilerCallback(physx::PxProfilerCallback* profilerCallback) +{ + if (!physx::g_PxSetPhysXGpuProfilerCallback_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if (physx::g_PxSetPhysXGpuProfilerCallback_Func) + physx::g_PxSetPhysXGpuProfilerCallback_Func(profilerCallback); +} + +void PxCudaRegisterFunction(int moduleIndex, const char* functionName) +{ + if (!physx::g_PxCudaRegisterFunction_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if (physx::g_PxCudaRegisterFunction_Func) + physx::g_PxCudaRegisterFunction_Func(moduleIndex, functionName); +} + +void** PxCudaRegisterFatBinary(void* fatBin) +{ + if (!physx::g_PxCudaRegisterFatBinary_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if (physx::g_PxCudaRegisterFatBinary_Func) + return physx::g_PxCudaRegisterFatBinary_Func(fatBin); + + return NULL; +} + + +physx::PxKernelIndex* PxGetCudaFunctionTable() +{ + if(!physx::g_PxGetCudaFunctionTable_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if(physx::g_PxGetCudaFunctionTable_Func) + return physx::g_PxGetCudaFunctionTable_Func(); + + return NULL; +} + +physx::PxU32 PxGetCudaFunctionTableSize() { + + if(!physx::g_PxGetCudaFunctionTableSize_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if(physx::g_PxGetCudaFunctionTableSize_Func) + return physx::g_PxGetCudaFunctionTableSize_Func(); + + return 0; +} + +void** PxGetCudaModuleTable() { + if(!physx::g_PxGetCudaModuleTable_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if(physx::g_PxGetCudaModuleTable_Func) + return physx::g_PxGetCudaModuleTable_Func(); + + return NULL; +} + + +physx::PxU32 PxGetCudaModuleTableSize() +{ + if(!physx::g_PxGetCudaModuleTableSize_Func) + physx::PxLoadPhysxGPUModule(NULL); + + if(physx::g_PxGetCudaModuleTableSize_Func) + return physx::g_PxGetCudaModuleTableSize_Func(); + + return 0; +} + + +#endif // PX_PHYSX_GPU_STATIC + +#endif // PX_SUPPORT_GPU_PHYSX + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxPhysXGpuModuleLoader.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxPhysXGpuModuleLoader.cpp new file mode 100644 index 0000000..5731efa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/gpu/PxPhysXGpuModuleLoader.cpp @@ -0,0 +1,213 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "PxPhysXConfig.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "foundation/Px.h" +#include "gpu/PxGpu.h" +#include "cudamanager/PxCudaContextManager.h" +#include "PxPhysics.h" + +#if PX_WINDOWS +#include "common/windows/PxWindowsDelayLoadHook.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "windows/CmWindowsModuleUpdateLoader.h" +#elif PX_LINUX +#include +#endif // ~PX_LINUX + +#include "stdio.h" + +#define STRINGIFY(x) #x +#define GETSTRING(x) STRINGIFY(x) + +#define PHYSX_GPU_SHARED_LIB_NAME GETSTRING(PX_PHYSX_GPU_SHARED_LIB_NAME) +static const char* gPhysXGpuLibraryName = PHYSX_GPU_SHARED_LIB_NAME; + +#undef GETSTRING +#undef STRINGIFY + +// Use reportError to handle cases where PxFoundation has not been created yet +static void reportError(const char* file, int line, const char* format, ...) +{ + va_list args; + va_start(args, format); + + physx::PxFoundation* foundation = &PxGetFoundation(); + if(foundation) + { + foundation->error(physx::PxErrorCode::eINTERNAL_ERROR, file, line, format, args); + } + else + { + printf("Error in %s:%i: ", file, line); + vprintf(format, args); + } + + va_end(args); +} + + +void PxSetPhysXGpuLoadHook(const PxGpuLoadHook* hook) +{ + gPhysXGpuLibraryName = hook->getPhysXGpuDllName(); +} + +namespace physx +{ +#if PX_VC +#pragma warning(disable: 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' +#endif + + class PxFoundation; + class PxPhysXGpu; + + typedef physx::PxPhysXGpu* (PxCreatePhysXGpu_FUNC)(); + typedef physx::PxCudaContextManager* (PxCreateCudaContextManager_FUNC)(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback); + typedef int (PxGetSuggestedCudaDeviceOrdinal_FUNC)(physx::PxErrorCallback& errc); + typedef void (PxSetPhysXGpuProfilerCallback_FUNC)(physx::PxProfilerCallback* cbk); + typedef void (PxCudaRegisterFunction_FUNC)(int, const char*); + typedef void** (PxCudaRegisterFatBinary_FUNC)(void*); + typedef physx::PxKernelIndex* (PxGetCudaFunctionTable_FUNC)(); + typedef PxU32 (PxGetCudaFunctionTableSize_FUNC)(); + typedef void** PxGetCudaModuleTable_FUNC(); + + + PxCreatePhysXGpu_FUNC* g_PxCreatePhysXGpu_Func = NULL; + PxCreateCudaContextManager_FUNC* g_PxCreateCudaContextManager_Func = NULL; + PxGetSuggestedCudaDeviceOrdinal_FUNC* g_PxGetSuggestedCudaDeviceOrdinal_Func = NULL; + PxSetPhysXGpuProfilerCallback_FUNC* g_PxSetPhysXGpuProfilerCallback_Func = NULL; + PxCudaRegisterFunction_FUNC* g_PxCudaRegisterFunction_Func = NULL; + PxCudaRegisterFatBinary_FUNC* g_PxCudaRegisterFatBinary_Func = NULL; + PxGetCudaFunctionTable_FUNC* g_PxGetCudaFunctionTable_Func = NULL; + PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaFunctionTableSize_Func = NULL; + PxGetCudaFunctionTableSize_FUNC* g_PxGetCudaModuleTableSize_Func = NULL; + PxGetCudaModuleTable_FUNC* g_PxGetCudaModuleTable_Func = NULL; + +#if PX_WINDOWS + + typedef void (PxSetPhysXGpuDelayLoadHook_FUNC)(const PxDelayLoadHook* delayLoadHook); + +#define DEFAULT_PHYSX_GPU_GUID "D79FA4BF-177C-4841-8091-4375D311D6A3" + + void PxLoadPhysxGPUModule(const char* appGUID) + { + static HMODULE s_library; + + if (s_library == NULL) + s_library = GetModuleHandle(gPhysXGpuLibraryName); + + if (s_library == NULL) + { + Cm::CmModuleUpdateLoader moduleLoader(UPDATE_LOADER_DLL_NAME); + s_library = moduleLoader.LoadModule(gPhysXGpuLibraryName, appGUID == NULL ? DEFAULT_PHYSX_GPU_GUID : appGUID); + } + + if (s_library) + { + g_PxCreatePhysXGpu_Func = (PxCreatePhysXGpu_FUNC*)GetProcAddress(s_library, "PxCreatePhysXGpu"); + g_PxCreateCudaContextManager_Func = (PxCreateCudaContextManager_FUNC*)GetProcAddress(s_library, "PxCreateCudaContextManager"); + g_PxGetSuggestedCudaDeviceOrdinal_Func = (PxGetSuggestedCudaDeviceOrdinal_FUNC*)GetProcAddress(s_library, "PxGetSuggestedCudaDeviceOrdinal"); + g_PxSetPhysXGpuProfilerCallback_Func = (PxSetPhysXGpuProfilerCallback_FUNC*)GetProcAddress(s_library, "PxSetPhysXGpuProfilerCallback"); + g_PxCudaRegisterFunction_Func = (PxCudaRegisterFunction_FUNC*)GetProcAddress(s_library, "PxGpuCudaRegisterFunction"); + g_PxCudaRegisterFatBinary_Func = (PxCudaRegisterFatBinary_FUNC*)GetProcAddress(s_library, "PxGpuCudaRegisterFatBinary"); + g_PxGetCudaFunctionTable_Func = (PxGetCudaFunctionTable_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaFunctionTable"); + g_PxGetCudaFunctionTableSize_Func = (PxGetCudaFunctionTableSize_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaFunctionTableSize"); + g_PxGetCudaModuleTableSize_Func = (PxGetCudaFunctionTableSize_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaModuleTableSize"); + g_PxGetCudaModuleTable_Func = (PxGetCudaModuleTable_FUNC*)GetProcAddress(s_library, "PxGpuGetCudaModuleTable"); + } + + // Check for errors + if (s_library == NULL) + { + reportError(PX_FL, "Failed to load %s!\n", gPhysXGpuLibraryName); + return; + } + + if (g_PxCreatePhysXGpu_Func == NULL || g_PxCreateCudaContextManager_Func == NULL || g_PxGetSuggestedCudaDeviceOrdinal_Func == NULL || g_PxSetPhysXGpuProfilerCallback_Func == NULL) + { + reportError(PX_FL, "PhysXGpu dll is incompatible with this version of PhysX!\n"); + return; + } + } + +#elif PX_LINUX + + void PxLoadPhysxGPUModule(const char*) + { + static void* s_library; + + if (s_library == NULL) + { + // load libcuda.so here since gcc configured with --as-needed won't link to it + // if there is no call from the binary to it. + void* hLibCuda = dlopen("libcuda.so", RTLD_NOW | RTLD_GLOBAL); + if (hLibCuda) + { + s_library = dlopen(gPhysXGpuLibraryName, RTLD_NOW); + } + else + { + reportError(PX_FL, "Could not find libcuda.so!"); + return; + } + } + + // no UpdateLoader + if (s_library) + { + *reinterpret_cast(&g_PxCreatePhysXGpu_Func) = dlsym(s_library, "PxCreatePhysXGpu"); + *reinterpret_cast(&g_PxCreateCudaContextManager_Func) = dlsym(s_library, "PxCreateCudaContextManager"); + *reinterpret_cast(&g_PxGetSuggestedCudaDeviceOrdinal_Func) = dlsym(s_library, "PxGetSuggestedCudaDeviceOrdinal"); + *reinterpret_cast(&g_PxSetPhysXGpuProfilerCallback_Func) = dlsym(s_library, "PxSetPhysXGpuProfilerCallback"); + *reinterpret_cast(&g_PxCudaRegisterFunction_Func) = dlsym(s_library, "PxGpuCudaRegisterFunction"); + *reinterpret_cast(&g_PxCudaRegisterFatBinary_Func) = dlsym(s_library, "PxGpuCudaRegisterFatBinary"); + *reinterpret_cast(&g_PxGetCudaFunctionTable_Func) = dlsym(s_library, "PxGpuGetCudaFunctionTable"); + *reinterpret_cast(&g_PxGetCudaFunctionTableSize_Func) = dlsym(s_library, "PxGpuGetCudaFunctionTableSize"); + *reinterpret_cast(&g_PxGetCudaModuleTableSize_Func) = dlsym(s_library, "PxGpuGetCudaModuleTableSize"); + *reinterpret_cast(&g_PxGetCudaModuleTable_Func) = dlsym(s_library, "PxGpuGetCudaModuleTable"); + } + + // Check for errors + if (s_library == NULL) + { + reportError(PX_FL, "Failed to load %s!", gPhysXGpuLibraryName); + return; + } + if (g_PxCreatePhysXGpu_Func == NULL || g_PxCreateCudaContextManager_Func == NULL || g_PxGetSuggestedCudaDeviceOrdinal_Func == NULL) + { + reportError(PX_FL, "%s is incompatible with this version of PhysX!", gPhysXGpuLibraryName); + return; + } + } + +#endif // PX_LINUX + +} // end physx namespace + +#endif // PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.cpp new file mode 100644 index 0000000..6df425a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.cpp @@ -0,0 +1,231 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "NpOmniPvd.h" + +#if PX_SUPPORT_OMNI_PVD +#include "OmniPvdPxSampler.h" +#include "OmniPvdLoader.h" +#include "OmniPvdFileWriteStream.h" +#endif +#include "foundation/PxUserAllocated.h" + +physx::PxU32 physx::NpOmniPvd::mRefCount = 0; +physx::NpOmniPvd* physx::NpOmniPvd::mInstance = NULL; + +namespace physx +{ + NpOmniPvd::NpOmniPvd() : + mLoader (NULL), + mFileWriteStream(NULL), + mWriter (NULL), + mPhysXSampler (NULL) + { + } + + NpOmniPvd::~NpOmniPvd() + { +#if PX_SUPPORT_OMNI_PVD + if (mFileWriteStream) + { + mFileWriteStream->closeStream(); + mLoader->mDestroyOmniPvdFileWriteStream(mFileWriteStream); + mFileWriteStream = NULL; + } + if (mWriter) + { + mLoader->mDestroyOmniPvdWriter(mWriter); + mWriter = NULL; + } + if (mLoader) + { + mLoader->~OmniPvdLoader(); + PX_FREE(mLoader); + mLoader = NULL; + } +#endif + } + + void NpOmniPvd::destroyInstance() + { + PX_ASSERT(mInstance != NULL); + if (mInstance->mRefCount == 1) + { + mInstance->~NpOmniPvd(); + PX_FREE(mInstance); + mInstance = NULL; + } + else + { + /* + mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Foundation destruction failed due to pending module references. Close/release all depending " + "modules first."); + */ + } + } + + // Called once by physx::PxOmniPvd* PxCreateOmniPvd(...) + // Called once by NpPhysics::NpPhysics(...) + void NpOmniPvd::incRefCount() + { + PX_ASSERT(mInstance != NULL); + NpOmniPvd::mRefCount++; + } + + // Called once by the Physics destructor in NpPhysics::~NpPhysics(...) + void NpOmniPvd::decRefCount() + { + PX_ASSERT(mInstance != NULL); + if (NpOmniPvd::mRefCount > 0) + { + NpOmniPvd::mRefCount--; + } + } + + void NpOmniPvd::release() + { + NpOmniPvd::destroyInstance(); + } + + bool NpOmniPvd::initOmniPvd() + { +#if PX_SUPPORT_OMNI_PVD + if (mLoader) + { + return true; + } + + mLoader = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(OmniPvdLoader), "OmniPvdLoader"), OmniPvdLoader)(); + + if (!mLoader) + { + return false; + } + + bool success; +#if PX_WIN64 + success = mLoader->loadOmniPvd("PVDRuntime_64.dll"); +#else + success = mLoader->loadOmniPvd("libPVDRuntime_64.so"); +#endif + return success; +#else + return true; +#endif + } + + OmniPvdWriter* NpOmniPvd::getWriter() + { +#if PX_SUPPORT_OMNI_PVD + if (mWriter) + { + return mWriter; + } + if (mLoader == NULL) + { + return NULL; + } + mWriter = mLoader->mCreateOmniPvdWriter(); + return mWriter; +#else + return NULL; +#endif + } + + OmniPvdFileWriteStream* NpOmniPvd::getFileWriteStream() + { +#if PX_SUPPORT_OMNI_PVD + if (mFileWriteStream) + { + return mFileWriteStream; + } + if (mLoader == NULL) + { + return NULL; + } + mFileWriteStream = mLoader->mCreateOmniPvdFileWriteStream(); + return mFileWriteStream; +#else + return NULL; +#endif + } + + bool NpOmniPvd::startSampling() + { +#if PX_SUPPORT_OMNI_PVD + if (mPhysXSampler) + { + mPhysXSampler->startSampling(); + return true; + } + return false; +#else + return false; +#endif + } +} + +physx::PxOmniPvd* PxCreateOmniPvd(physx::PxFoundation& foundation) +{ + PX_UNUSED(foundation); +#if PX_SUPPORT_OMNI_PVD + if (physx::NpOmniPvd::mInstance) + { + // No need to call this function again + //foundation.getErrorCallback() + return physx::NpOmniPvd::mInstance; + } + physx::NpOmniPvd::mInstance = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(physx::NpOmniPvd), "NpOmniPvd"), physx::NpOmniPvd)(); + + if (physx::NpOmniPvd::mInstance) + { + if (physx::NpOmniPvd::mInstance->initOmniPvd()) + { + physx::NpOmniPvd::mRefCount = 1; // Sets the reference counter to exactly 1 + return physx::NpOmniPvd::mInstance; + } + else + { + physx::NpOmniPvd::mInstance->~NpOmniPvd(); + PX_FREE(physx::NpOmniPvd::mInstance); + physx::NpOmniPvd::mInstance = NULL; + physx::NpOmniPvd::mRefCount = 0; + return NULL; + } + } + else + { + return NULL; + } +#else + return NULL; +#endif +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.h new file mode 100644 index 0000000..d83405c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/NpOmniPvd.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef NP_OMNI_PVD_H +#define NP_OMNI_PVD_H + +#include "omnipvd/PxOmniPvd.h" + +class OmniPvdReader; +class OmniPvdWriter; +class OmniPvdLoader; +class OmniPvdFileWriteStream; +class OmniPvdPxSampler; + +namespace physx +{ + +class NpOmniPvd : public PxOmniPvd +{ +public: + NpOmniPvd(); + ~NpOmniPvd(); + static void destroyInstance(); + static void incRefCount(); + static void decRefCount(); + void release(); + + bool initOmniPvd(); + OmniPvdWriter* getWriter(); + OmniPvdFileWriteStream* getFileWriteStream(); + bool startSampling(); + + OmniPvdLoader* mLoader; + OmniPvdFileWriteStream* mFileWriteStream; + OmniPvdWriter* mWriter; + OmniPvdPxSampler* mPhysXSampler; + static PxU32 mRefCount; + static NpOmniPvd* mInstance; +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.cpp new file mode 100644 index 0000000..f8885d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.cpp @@ -0,0 +1,228 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "OmniPvdChunkAlloc.h" +#include // memcpy +#include "foundation/PxAllocator.h" + +OmniPvdChunkElement::OmniPvdChunkElement() +{ +} + +OmniPvdChunkElement::~OmniPvdChunkElement() +{ +} + +OmniPvdChunk::OmniPvdChunk() : + mData (NULL), + mNbrBytesAllocated (0), + mNbrBytesFree (0), + mBytePtr (NULL), + mNextChunk (NULL) +{ +} + +OmniPvdChunk::~OmniPvdChunk() +{ + PX_FREE(mData); +} + +void OmniPvdChunk::resetChunk(int nbrBytes) +{ + if (nbrBytes>mNbrBytesAllocated) + { + PX_FREE(mData); + mData = static_cast(PX_ALLOC(sizeof(unsigned char)*(nbrBytes), "m_data")); + mNbrBytesAllocated=nbrBytes; + } + mNbrBytesFree=mNbrBytesAllocated; + mBytePtr=mData; +} + +int OmniPvdChunk::nbrBytesUSed() +{ + return mNbrBytesAllocated-mNbrBytesFree; +} + +OmniPvdChunkList::OmniPvdChunkList() +{ + resetList(); +} + +OmniPvdChunkList::~OmniPvdChunkList() +{ +} + +void OmniPvdChunkList::resetList() +{ + mFirstChunk=0; + mLastChunk=0; + mNbrChunks=0; +} + +OmniPvdChunk* OmniPvdChunkList::removeFirst() +{ + if (mFirstChunk) + { + OmniPvdChunk* chunk=mFirstChunk; + mFirstChunk=mFirstChunk->mNextChunk; + if (!mFirstChunk) + { // Did we remove the last one? + mLastChunk=NULL; + } + chunk->mNextChunk=NULL; + mNbrChunks--; + return chunk; + } + else + { + return 0; + } +} + +void OmniPvdChunkList::appendList(OmniPvdChunkList* list) +{ + if (!list) return; + if (list->mNbrChunks==0) return; + if (list->mFirstChunk==NULL) return; + if (mFirstChunk) + { + mLastChunk->mNextChunk=list->mFirstChunk; + mLastChunk=list->mLastChunk; + } else + { + mFirstChunk=list->mFirstChunk; + mLastChunk=list->mLastChunk; + } + mNbrChunks+=list->mNbrChunks; + list->resetList(); +} + +void OmniPvdChunkList::appendChunk(OmniPvdChunk* chunk) +{ + if (!chunk) return; + if (mFirstChunk) + { + mLastChunk->mNextChunk=chunk; + mLastChunk=chunk; + } else + { + mFirstChunk=chunk; + mLastChunk=chunk; + } + chunk->mNextChunk=NULL; + mNbrChunks++; +} + +OmniPvdChunkPool::OmniPvdChunkPool() +{ + mNbrAllocatedChunks = 0; + mChunkSize = 65536; // random default value :-) +} + +OmniPvdChunkPool::~OmniPvdChunkPool() +{ + OmniPvdChunk* chunk=mFreeChunks.mFirstChunk; + while (chunk) + { + OmniPvdChunk* nextChunk=chunk->mNextChunk; + PX_DELETE(chunk); + chunk=nextChunk; + } + mNbrAllocatedChunks = 0; +} + +void OmniPvdChunkPool::setChunkSize(int chunkSize) +{ + if (mNbrAllocatedChunks > 0) return; // makes it impossible to re-set the size of a chunk once a chunk was already allocated + mChunkSize = chunkSize; +} + +OmniPvdChunk* OmniPvdChunkPool::getChunk() +{ + OmniPvdChunk* chunk=mFreeChunks.removeFirst(); + if (!chunk) + { + chunk= PX_NEW(OmniPvdChunk); + mNbrAllocatedChunks++; + } + chunk->resetChunk(mChunkSize); + return chunk; +} + +OmniPvdChunkByteAllocator::OmniPvdChunkByteAllocator() +{ + mPool = NULL; +} + +OmniPvdChunkByteAllocator::~OmniPvdChunkByteAllocator() +{ + freeChunks(); +} + +OmniPvdChunkElement* OmniPvdChunkByteAllocator::allocChunkElement(int totalStructSize) +{ + return reinterpret_cast(allocBytes(totalStructSize)); +} + +void OmniPvdChunkByteAllocator::setPool(OmniPvdChunkPool* pool) +{ + mPool = pool; +} + +unsigned char* OmniPvdChunkByteAllocator::allocBytes(int nbrBytes) +{ + if (!mPool) return 0; + if (mPool->mChunkSize < nbrBytes) + { + return 0; // impossible request! + } + if (mUsedChunks.mLastChunk) + { // If a chunk is free + if (mUsedChunks.mLastChunk->mNbrBytesFree< nbrBytes) + { + // The last chunk has not enough space, so get a fresh one from the pool + mUsedChunks.appendChunk(mPool->getChunk()); + } + } + else + { // No last chunk is available, allocate a fresh one + mUsedChunks.appendChunk(mPool->getChunk()); + } + // Use the last chunk to allocate the data necessary + unsigned char* pSubChunk=mUsedChunks.mLastChunk->mBytePtr; + mUsedChunks.mLastChunk->mNbrBytesFree-= nbrBytes; + mUsedChunks.mLastChunk->mBytePtr+= nbrBytes; + return pSubChunk; +} + +void OmniPvdChunkByteAllocator::freeChunks() +{ + if (!mPool) return; + mPool->mFreeChunks.appendList(&mUsedChunks); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.h new file mode 100644 index 0000000..7e2d3d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdChunkAlloc.h @@ -0,0 +1,151 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_CHUNK_ALLOC_H +#define OMNI_PVD_CHUNK_ALLOC_H + +#include "foundation/PxUserAllocated.h" + +//////////////////////////////////////////////////////////////////////////////// +// The usage reason for splitting the Chunk allocator into a ChunkPool and a +// ByteAllocator is so that similarly accessed objects get allocated next to each +// other within the same Chunk, which is managed by the ByteAllocator. The +// ChunkPool is basically just a resource pool. Not thread safe anything :-) +// Locking is bad mkkk... +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +// Usage example of setting up a ChunkPool, a ByteAllocator and allocating some +// bytes, for the lulz. +//////////////////////////////////////////////////////////////////////////////// + +/* + OmniPvdChunkPool pool; + + // set the individual Chunks to a size of 100k bytes + pool.setChunkSize(100000); + + // all allocations must go through a ByteAllocator, so create one + OmniPvdChunkByteAllocator allocator; + + // connect the ByteAllocator to the pool + allocator.setPool(&pool); + + // we allocate 100 bytes through the ByteAllocator + unsigned char *someBytes=allocator.allocBytes(100); +*/ + +//////////////////////////////////////////////////////////////////////////////// +// Once we want to cleanup the allocations, return the Chunks to the ChunkPool, +// which is also done silently in the destructor of the ByteAllocator. +//////////////////////////////////////////////////////////////////////////////// + +/* + allocator.freeChunks(); +*/ + +//////////////////////////////////////////////////////////////////////////////// +// Memory management warning! The ByteAllocator does not deallocate the Chunks, +// but must return the Chunks to the ChunkPool before going out of scope. The +// ChunkPool can only deallocate the Chunks that is has in its free Chunks list, +// so all ByteAllocators must either all go out of scope before the ChunkPool +// goes out of scope or the ByteAllocators must all call the function freeChunks +// before the ChunkPool goes out of scope. +//////////////////////////////////////////////////////////////////////////////// + +class OmniPvdChunkElement +{ +public: + OmniPvdChunkElement(); + ~OmniPvdChunkElement(); + OmniPvdChunkElement* mNextElement; +}; + +class OmniPvdChunk : public physx::PxUserAllocated +{ +public: + OmniPvdChunk(); + ~OmniPvdChunk(); + + void resetChunk(int nbrBytes); + int nbrBytesUSed(); + + unsigned char* mData; + int mNbrBytesAllocated; + int mNbrBytesFree; + unsigned char* mBytePtr; + OmniPvdChunk* mNextChunk; +}; + +class OmniPvdChunkList +{ +public: + OmniPvdChunkList(); + ~OmniPvdChunkList(); + + void resetList(); + void appendList(OmniPvdChunkList* list); + void appendChunk(OmniPvdChunk* chunk); + OmniPvdChunk* removeFirst(); + + OmniPvdChunk* mFirstChunk; + OmniPvdChunk* mLastChunk; + int mNbrChunks; +}; + +class OmniPvdChunkPool +{ +public: + OmniPvdChunkPool(); + ~OmniPvdChunkPool(); + + void setChunkSize(int chunkSize); + OmniPvdChunk* getChunk(); + + OmniPvdChunkList mFreeChunks; + int mChunkSize; + int mNbrAllocatedChunks; +}; + + +class OmniPvdChunkByteAllocator +{ +public: + OmniPvdChunkByteAllocator(); + ~OmniPvdChunkByteAllocator(); + + OmniPvdChunkElement* allocChunkElement(int totalStructSize); + void setPool(OmniPvdChunkPool* pool); + unsigned char* allocBytes(int nbrBytes); + void freeChunks(); + + OmniPvdChunkList mUsedChunks; + OmniPvdChunkPool* mPool; +}; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.cpp new file mode 100644 index 0000000..49d2c01 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.cpp @@ -0,0 +1,1226 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#if PX_SUPPORT_OMNI_PVD +#include "OmniPvdPxSampler.h" +#include "common/PxProfileZone.h" +#include "NpPhysics.h" +#include "NpScene.h" +#include "NpShape.h" +#include "NpArticulationLink.h" +#include "NpRigidDynamic.h" +#include "NpRigidStatic.h" +#include "NpActor.h" +#include "NpSoftBody.h" +#include "NpAggregate.h" +#include "NpOmniPvd.h" +#include "OmniPvdWriter.h" +#include "OmniPvdWriteStream.h" +#include "foundation/PxAllocator.h" +#include "ScInteraction.h" +#include "NpArticulationJointReducedCoordinate.h" + +#include + +using namespace physx; + +#define UNNECESSARY_SCENE_HANDLE 1 + +void createGeometry(const physx::PxGeometry & g); +void destroyGeometry(const physx::PxGeometry & g); + +class OmniPvdStreamContainer +{ +public: + OmniPvdStreamContainer(); + ~OmniPvdStreamContainer(); + bool initOmniPvd(); + void registerClasses(); + void setOmniPvdWriter(OmniPvdWriter* omniPvdWriter); + + OmniPvdWriter* mWriter; + physx::PxMutex mMutex; + bool mClassesRegistered; +}; + +class OmniPvdSamplerInternals : public physx::PxUserAllocated +{ +public: +OmniPvdStreamContainer mPvdStream; +bool addSharedMeshIfNotSeen(const void* geom, OmniPvdSharedMeshEnum geomEnum); // Returns true if the Geom was not yet seen and added +physx::PxMutex mSampleMutex; +bool mIsSampling; + +physx::PxMutex mSampledScenesMutex; +physx::PxHashMap mSampledScenes; + +physx::PxMutex mSharedGeomsMutex; +physx::PxHashMap mSharedMeshesMap; +}; +OmniPvdSamplerInternals * samplerInternals = NULL; + +class OmniPvdPxScene : public physx::PxUserAllocated +{ +public: + OmniPvdPxScene() : mFrameId(0) {} + ~OmniPvdPxScene() {} + + void sampleScene() + { + mFrameId++; + samplerInternals->mPvdStream.mWriter->startFrame(UNNECESSARY_SCENE_HANDLE, mFrameId); + } + + physx::PxU64 mFrameId; +}; + +OmniPvdStreamContainer::OmniPvdStreamContainer() +{ + physx::PxMutex::ScopedLock myLock(mMutex); + mWriter = NULL; + mClassesRegistered = false; +} + +OmniPvdStreamContainer::~OmniPvdStreamContainer() +{ +} + +void OmniPvdStreamContainer::setOmniPvdWriter(OmniPvdWriter* omniPvdWriter) +{ + mWriter = omniPvdWriter; +} + +bool OmniPvdStreamContainer::initOmniPvd() +{ + physx::PxMutex::ScopedLock myLock(mMutex); + + registerClasses(); + + PxPhysics& physicsRef = static_cast(NpPhysics::getInstance()); + + OMNI_PVD_CREATE(physics, physicsRef); + const physx::PxTolerancesScale tolScale = physicsRef.getTolerancesScale(); + PxF32 scale[2]; + scale[0] = tolScale.length; + scale[1] = tolScale.speed; + OMNI_PVD_SETB(physics, tolerancesScale, physicsRef, scale, sizeof(PxF32) * 2); + + return true; +} + +//array to hold PVD type to size conversion table. Should be large enough for all basic PVD types. +static unsigned sizeOfOmniPvdTypes[32]; + +//create a class for each SDK type and attribute -- the primary thing is to allocate handle storage, the rest is just fluff. +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) OmniPvdClassHandle OmniPvdPxSampler::classHandle_##c; +#define OMNI_PVD_CLASS(c, classT) OmniPvdClassHandle OmniPvdPxSampler::classHandle_##c; +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) OmniPvdAttributeHandle OmniPvdPxSampler::attributeHandle_##c##_##a; + +//enum values don't need to save their handle, since they are const/immutable: +#define OMNI_PVD_ENUM_VALUE(c, a, v) +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) OmniPvdAttributeHandle OmniPvdPxSampler::attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) OmniPvdAttributeHandle OmniPvdPxSampler::attributeHandle_##c##_##a; + + +#include "OmniPvdTypes.h" +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + +void OmniPvdStreamContainer::registerClasses() +{ + if (mClassesRegistered) return; + if (mWriter) + { +//register all SDK classes and attributes: +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) OmniPvdPxSampler::classHandle_##c = mWriter->registerClass(#classStr); +#define OMNI_PVD_CLASS(c, classT) OmniPvdPxSampler::classHandle_##c = mWriter->registerClass(#classT); +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OmniPvdPxSampler::classHandle_##c = mWriter->registerClass(#classT, OmniPvdPxSampler::classHandle_##baseClass); +#define OMNI_PVD_ENUM_VALUE(c, a, v) mWriter->registerEnumValue(OmniPvdPxSampler::classHandle_##c, #a, v); +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) OmniPvdPxSampler::attributeHandle_##c##_##a = mWriter->registerSetAttribute(OmniPvdPxSampler::classHandle_##c, #a, OmniPvdDataTypeEnum::eOBJECT_HANDLE); +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) PX_ASSERT((n == 0) || (sizeof(attrT) == sizeOfOmniPvdTypes[t] * n)); OmniPvdPxSampler::attributeHandle_##c##_##a = mWriter->registerAttribute(OmniPvdPxSampler::classHandle_##c, #a, t, n); +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) OmniPvdPxSampler::attributeHandle_##c##_##a = mWriter->registerFlagsAttribute(OmniPvdPxSampler::classHandle_##c, OmniPvdPxSampler::classHandle_##enumClass, #a); +#include "OmniPvdTypes.h" +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + + mClassesRegistered = true; + } +} + + + +//instance any templates that are not used in this compilation unit so that code gets generated anyways + +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) \ +template void OmniPvdPxSampler::createObject (OmniPvdClassHandle, classT const &);\ +template void OmniPvdPxSampler::destroyObject(classT const &); + +#define OMNI_PVD_CLASS(c, classT) \ +template void OmniPvdPxSampler::createObject (OmniPvdClassHandle, classT const &);\ +template void OmniPvdPxSampler::destroyObject(classT const &); + +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) + +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) \ +template void OmniPvdPxSampler::addToSet(OmniPvdAttributeHandle, classT const & , attrT const & );\ +template void OmniPvdPxSampler::removeFromSet(OmniPvdAttributeHandle, classT const & , attrT const & ); + +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) \ +template void OmniPvdPxSampler::setAttribute(OmniPvdAttributeHandle, const classT&, attrT const &); \ +template void OmniPvdPxSampler::setAttributeBytes(OmniPvdAttributeHandle, const classT&, attrT const *, unsigned); + +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) \ +template void OmniPvdPxSampler::setAttribute(OmniPvdAttributeHandle, classT const &, attrT const &); + +#define OMNI_PVD_ENUM(c, enumT) +#define OMNI_PVD_ENUM_VALUE(c, a, v) + +#include "OmniPvdTypes.h" +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +//end instance templates + +void streamActorName(physx::PxActor & a, const char* name) +{ +#if PX_SUPPORT_OMNI_PVD + if (NpPhysics::getInstance().mOmniPvdSampler == NULL) + { + return; + } + if (name == NULL) + { + return; + } + int len = static_cast(strlen(name)); + if (len > 0) + { + len += 1; + OMNI_PVD_SETB(actor, name, a, name, len); // copies over the trailing zero too + } +#endif +} + +void streamSphere(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geomsphere, g); + OMNI_PVD_SET(geomsphere, radius, g, gh.sphere().radius); +} + +void streamCapsule(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geomcapsule, g); + OMNI_PVD_SET(geomcapsule, halfHeight, g, gh.capsule().halfHeight); + OMNI_PVD_SET(geomcapsule, radius, g, gh.capsule().radius); +} + +void streamBox(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geombox, g); + OMNI_PVD_SET(geombox, halfExtents, g, gh.box().halfExtents); +} + +void streamPlane(const physx::PxGeometry& g) +{ + OMNI_PVD_CREATE(geomplane, g); +} + +void streamConvexMesh(const physx::PxConvexMesh* mesh) +{ + if (samplerInternals->addSharedMeshIfNotSeen(mesh, OmniPvdSharedMeshEnum::eOmniPvdConvexMesh)) + { + OMNI_PVD_CREATE(convexmesh, *mesh); + + const physx::PxU32 nbPolys = mesh->getNbPolygons(); + const physx::PxU8* polygons = mesh->getIndexBuffer(); + const physx::PxVec3* verts = mesh->getVertices(); + const int nbrVerts = mesh->getNbVertices(); + + int totalTris = 0; + for (unsigned int i = 0; i < nbPolys; i++) + { + physx::PxHullPolygon data; + mesh->getPolygonData(i, data); + totalTris += physx::PxU32(data.mNbVerts - 2); + } + + float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts"); + int* tmpIndices = (int*)PX_ALLOC(sizeof(int)*(totalTris * 3), "tmpIndices"); + //TODO: this copy is useless + + int vertIndex = 0; + for (int v = 0; v < nbrVerts; v++) + { + tmpVerts[vertIndex + 0] = verts[v].x; + tmpVerts[vertIndex + 1] = verts[v].y; + tmpVerts[vertIndex + 2] = verts[v].z; + vertIndex += 3; + } + + int triIndex = 0; + for (unsigned int p = 0; p < nbPolys; p++) + { + physx::PxHullPolygon data; + mesh->getPolygonData(p, data); + int nbTris = physx::PxU32(data.mNbVerts - 2); + const physx::PxU32 vref0 = polygons[data.mIndexBase + 0 + 0]; + for (int t = 0; t < nbTris; t++) + { + const physx::PxU32 vref1 = polygons[data.mIndexBase + t + 1]; + const physx::PxU32 vref2 = polygons[data.mIndexBase + t + 2]; + tmpIndices[triIndex + 0] = vref0; + tmpIndices[triIndex + 1] = vref1; + tmpIndices[triIndex + 2] = vref2; + triIndex += 3; + } + } + + OMNI_PVD_SETB(convexmesh, verts, *mesh, tmpVerts, sizeof(float) * 3 * nbrVerts); + OMNI_PVD_SETB(convexmesh, tris, *mesh, tmpIndices, sizeof(int) * 3 * totalTris); + PX_FREE(tmpVerts); + PX_FREE(tmpIndices); + } +} + +void streamConvexMeshGeometry(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geomconvexmesh, g); + OMNI_PVD_SET(geomconvexmesh, scale, g, gh.convexMesh().scale.scale); + const physx::PxConvexMeshGeometry& geometry = gh.convexMesh(); + physx::PxConvexMesh const* mesh = geometry.convexMesh; + streamConvexMesh(mesh); + OMNI_PVD_SET(geomconvexmesh, convexMesh, g, mesh); +} + +void streamHeightField(const physx::PxHeightField* hf) +{ + if (samplerInternals->addSharedMeshIfNotSeen(hf, OmniPvdSharedMeshEnum::eOmniPvdHeightField)) + { + OMNI_PVD_CREATE(heightfield, *hf); + const physx::PxU32 nbCols = hf->getNbColumns(); + const physx::PxU32 nbRows = hf->getNbRows(); + const physx::PxU32 nbVerts = nbRows * nbCols; + const physx::PxU32 nbFaces = (nbCols - 1) * (nbRows - 1) * 2; + physx::PxHeightFieldSample* sampleBuffer = (physx::PxHeightFieldSample*)PX_ALLOC(sizeof(physx::PxHeightFieldSample)*(nbVerts), "sampleBuffer"); + hf->saveCells(sampleBuffer, nbVerts * sizeof(physx::PxHeightFieldSample)); + //TODO: are the copies necessary? + float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbVerts * 3), "tmpVerts"); + int* tmpIndices = (int*)PX_ALLOC(sizeof(int)*(nbFaces * 3), "tmpIndices"); + for (physx::PxU32 i = 0; i < nbRows; i++) + { + for (physx::PxU32 j = 0; j < nbCols; j++) + { + const float x = physx::PxReal(i);// *rs; + const float y = physx::PxReal(sampleBuffer[j + (i*nbCols)].height);// *hs; + const float z = physx::PxReal(j);// *cs; + const int vertexIndex = 3 * (i * nbCols + j); + float* vert = &tmpVerts[vertexIndex]; + vert[0] = x; + vert[1] = y; + vert[2] = z; + } + } + for (physx::PxU32 i = 0; i < (nbCols - 1); ++i) + { + for (physx::PxU32 j = 0; j < (nbRows - 1); ++j) + { + physx::PxU8 tessFlag = sampleBuffer[i + j * nbCols].tessFlag(); + physx::PxU32 i0 = j * nbCols + i; + physx::PxU32 i1 = j * nbCols + i + 1; + physx::PxU32 i2 = (j + 1) * nbCols + i; + physx::PxU32 i3 = (j + 1) * nbCols + i + 1; + // i2---i3 + // | | + // | | + // i0---i1 + // this is really a corner vertex index, not triangle index + physx::PxU32 mat0 = hf->getTriangleMaterialIndex((j*nbCols + i) * 2); + physx::PxU32 mat1 = hf->getTriangleMaterialIndex((j*nbCols + i) * 2 + 1); + bool hole0 = (mat0 == physx::PxHeightFieldMaterial::eHOLE); + bool hole1 = (mat1 == physx::PxHeightFieldMaterial::eHOLE); + // first triangle + tmpIndices[6 * (i * (nbRows - 1) + j) + 0] = hole0 ? i0 : i2; // duplicate i0 to make a hole + tmpIndices[6 * (i * (nbRows - 1) + j) + 1] = i0; + tmpIndices[6 * (i * (nbRows - 1) + j) + 2] = tessFlag ? i3 : i1; + // second triangle + tmpIndices[6 * (i * (nbRows - 1) + j) + 3] = hole1 ? i1 : i3; // duplicate i1 to make a hole + tmpIndices[6 * (i * (nbRows - 1) + j) + 4] = tessFlag ? i0 : i2; + tmpIndices[6 * (i * (nbRows - 1) + j) + 5] = i1; + } + } + PX_FREE(sampleBuffer); + OMNI_PVD_SETB(heightfield, verts, *hf, tmpVerts, sizeof(float) * 3 * nbVerts); + OMNI_PVD_SETB(heightfield, tris, *hf, tmpIndices, sizeof(int) * 3 * nbFaces); + PX_FREE(tmpVerts); + PX_FREE(tmpIndices); + } +} + +void streamHeightFieldGeometry(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geomheightfield, g); + const physx::PxHeightFieldGeometry& geometry = gh.heightField(); + + float vertScale[3]; + vertScale[0] = geometry.rowScale; + vertScale[1] = geometry.heightScale; + vertScale[2] = geometry.columnScale; + OMNI_PVD_SET(geomheightfield, scale, g, vertScale); + + physx::PxHeightField const * hf = geometry.heightField; + streamHeightField(hf); + OMNI_PVD_SET(geomheightfield, heightField, g, hf); +} + +void streamRigidStatic(const physx::PxRigidStatic* rs) +{ + const PxActor& a = *rs; + OMNI_PVD_CREATE(actor, a); + OMNI_PVD_SET(actor, type, a, PxActorType::eRIGID_STATIC); + PxTransform t = rs->getGlobalPose(); + OMNI_PVD_SET(actor, translation, a, t.p); + OMNI_PVD_SET(actor, rotation, a, t.q); +} + +void streamRigidDynamic(const physx::PxRigidDynamic* rd) +{ + const PxActor& a = *rd; + OMNI_PVD_CREATE(actor, a); + OMNI_PVD_SET(actor, type, a, PxActorType::eRIGID_DYNAMIC); + PxTransform t = rd->getGlobalPose(); + OMNI_PVD_SET(actor, translation, a, t.p); + OMNI_PVD_SET(actor, rotation, a, t.q); + //OMNI_PVD_SET(actor, isSleeping, a, rd->isSleeping()); // Seems to throw errors since you cannot call isSleeping before a body is part of a scene + OMNI_PVD_SET(actor, sleepThreshold, a, rd->getSleepThreshold()); + OMNI_PVD_SET(actor, wakeCounter, a, rd->getWakeCounter()); + OMNI_PVD_SET(actor, stabilizationThreshold, a, rd->getStabilizationThreshold()); + PxU32 positionIters, velocityIters; rd->getSolverIterationCounts(positionIters, velocityIters); + OMNI_PVD_SET(actor, positionIterations, a, positionIters); + OMNI_PVD_SET(actor, velocityIterations, a, velocityIters); + OMNI_PVD_SET(actor, rigidDynamicLockFlags, a, rd->getRigidDynamicLockFlags()); + OMNI_PVD_SET(actor, contactReportThreshold, a, rd->getContactReportThreshold()); +} + +void streamArticulationJoint(const physx::PxArticulationJointReducedCoordinate* joint) +{ + const PxArticulationJointReducedCoordinate& jointRef = *joint; + PxArticulationJointType::Enum jointType = jointRef.getJointType(); + const PxArticulationLink* parentPxLinkPtr = &jointRef.getParentArticulationLink(); + const PxArticulationLink* childPxLinkPtr = &jointRef.getChildArticulationLink(); + PxArticulationMotion::Enum motions[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + motions[ax] = jointRef.getMotion(static_cast(ax)); + PxReal armatures[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + armatures[ax] = jointRef.getArmature(static_cast(ax)); + PxReal coefficient = jointRef.getFrictionCoefficient(); + PxReal maxJointV = jointRef.getMaxJointVelocity(); + PxReal positions[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + positions[ax] = jointRef.getJointPosition(static_cast(ax)); + PxReal velocitys[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + velocitys[ax] = jointRef.getJointVelocity(static_cast(ax)); + const char* concreteTypeName = jointRef.getConcreteTypeName(); + PxU32 concreteTypeNameLen = PxU32(strlen(concreteTypeName)) + 1; + PxReal lowlimits[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + lowlimits[ax] = jointRef.getLimitParams(static_cast(ax)).low; + PxReal highlimits[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + highlimits[ax] = jointRef.getLimitParams(static_cast(ax)).high; + PxReal stiffnesss[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + stiffnesss[ax] = jointRef.getDriveParams(static_cast(ax)).stiffness; + PxReal dampings[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + dampings[ax] = jointRef.getDriveParams(static_cast(ax)).damping; + PxReal maxforces[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + maxforces[ax] = jointRef.getDriveParams(static_cast(ax)).maxForce; + PxArticulationDriveType::Enum drivetypes[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + drivetypes[ax] = jointRef.getDriveParams(static_cast(ax)).driveType; + PxReal drivetargets[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + drivetargets[ax] = jointRef.getDriveTarget(static_cast(ax)); + PxReal drivevelocitys[6]; + for (PxU32 ax = 0; ax < 6; ++ax) + drivevelocitys[ax] = jointRef.getDriveVelocity(static_cast(ax)); + + OMNI_PVD_CREATE(articulationjoint, jointRef); + OMNI_PVD_SET(articulationjoint, type, jointRef, jointType); + OMNI_PVD_SET(articulationjoint, parentLink, jointRef, parentPxLinkPtr); + OMNI_PVD_SET(articulationjoint, childLink, jointRef, childPxLinkPtr); + OMNI_PVD_SETB(articulationjoint, motion, jointRef, motions, sizeof(motions)); + OMNI_PVD_SETB(articulationjoint, armature, jointRef, armatures, sizeof(armatures)); + OMNI_PVD_SET(articulationjoint, frictionCoefficient, jointRef, coefficient); + OMNI_PVD_SET(articulationjoint, maxJointVelocity, jointRef, maxJointV); + OMNI_PVD_SETB(articulationjoint, jointPosition, jointRef, positions, sizeof(positions)); + OMNI_PVD_SETB(articulationjoint, jointVelocity, jointRef, velocitys, sizeof(velocitys)); + OMNI_PVD_SETB(articulationjoint, concreteTypeName, jointRef, concreteTypeName, concreteTypeNameLen); + OMNI_PVD_SETB(articulationjoint, limitLow, jointRef, lowlimits, sizeof(lowlimits)); + OMNI_PVD_SETB(articulationjoint, limitHigh, jointRef, highlimits, sizeof(highlimits)); + OMNI_PVD_SETB(articulationjoint, driveStiffness, jointRef, stiffnesss, sizeof(stiffnesss)); + OMNI_PVD_SETB(articulationjoint, driveDamping, jointRef, dampings, sizeof(dampings)); + OMNI_PVD_SETB(articulationjoint, driveMaxForce, jointRef, maxforces, sizeof(maxforces)); + OMNI_PVD_SETB(articulationjoint, driveType, jointRef, drivetypes, sizeof(drivetypes)); + OMNI_PVD_SETB(articulationjoint, driveTarget, jointRef, drivetargets, sizeof(drivetargets)); + OMNI_PVD_SETB(articulationjoint, driveVelocity, jointRef, drivevelocitys, sizeof(drivevelocitys)); +} + +void streamArticulationLink(const physx::PxArticulationLink* al) +{ + const PxActor& a = *al; + OMNI_PVD_CREATE(actor, a); + OMNI_PVD_SET(actor, type, a, PxActorType::eARTICULATION_LINK); + OMNI_PVD_SET(actor, articulation, a, &al->getArticulation()); + OMNI_PVD_SET(actor, CFMScale, a, al->getCfmScale()); + OMNI_PVD_SET(actor, inboundJointDOF, a, al->getInboundJointDof()); +} + +void streamArticulation(const physx::PxArticulationReducedCoordinate* art) +{ + OMNI_PVD_CREATE(articulation, *art); + PxU32 solverIterations[2]; art->getSolverIterationCounts(solverIterations[0], solverIterations[1]); + OMNI_PVD_SET(articulation, positionIterations, *art, solverIterations[0]); + OMNI_PVD_SET(articulation, velocityIterations, *art, solverIterations[1]); + OMNI_PVD_SET(articulation, isSleeping, *art, false); + OMNI_PVD_SET(articulation, sleepThreshold, *art, art->getSleepThreshold()); + OMNI_PVD_SET(articulation, stabilizationThreshold, *art, art->getStabilizationThreshold()); + OMNI_PVD_SET(articulation, wakeCounter, *art, art->getWakeCounter()); + OMNI_PVD_SET(articulation, maxLinVelocity, *art, art->getMaxCOMLinearVelocity()); + OMNI_PVD_SET(articulation, maxAngVelocity, *art, art->getMaxCOMAngularVelocity()); + OMNI_PVD_SET(articulation, worldBounds, *art, art->getWorldBounds()); + OMNI_PVD_SET(articulation, articulationFlags, *art, art->getArticulationFlags()); + OMNI_PVD_SET(articulation, dofs, *art, art->getDofs()); +} + +void streamAggregate(const physx::PxAggregate* agg) +{ + OMNI_PVD_CREATE(aggregate, *agg); + PxU32 actorCount = agg->getNbActors(); + for (PxU32 i = 0; i < actorCount; ++i) + { + PxActor* a; agg->getActors(&a, 1, i); + OMNI_PVD_ADD(aggregate, actors, *agg, *a); + } + OMNI_PVD_SET(aggregate, selfCollision, *agg, agg->getSelfCollision()); + OMNI_PVD_SET(aggregate, maxNbShapes, *agg, agg->getMaxNbShapes()); + OMNI_PVD_SET(aggregate, scene, *agg, const_cast(agg)->getScene()); +} + +void streamSoBo(const physx::PxSoftBody* b) +{ + OMNI_PVD_CREATE(actor, *b); // @@@ +} + +void streamMPMMaterial(const physx::PxMPMMaterial* m) +{ + OMNI_PVD_CREATE(mpmmaterial, *m); +} + +void streamFLIPMaterial(const physx::PxFLIPMaterial* m) +{ + OMNI_PVD_CREATE(flipmaterial, *m); +} + +void streamPBDMaterial(const physx::PxPBDMaterial* m) +{ + OMNI_PVD_CREATE(pbdmaterial, *m); +} + +void streamFEMClothMaterial(const physx::PxFEMClothMaterial* m) +{ + OMNI_PVD_CREATE(femclothmaterial, *m); +} + +void streamFEMSoBoMaterial(const physx::PxFEMSoftBodyMaterial* m) +{ + OMNI_PVD_CREATE(femsoftbodymaterial, *m); +} + +void streamMaterial(const physx::PxMaterial* m) +{ + OMNI_PVD_CREATE(material, *m); + OMNI_PVD_SET(material, flags, *m, m->getFlags()); + OMNI_PVD_SET(material, frictionCombineMode, *m, m->getFrictionCombineMode()); + OMNI_PVD_SET(material, restitutionCombineMode, *m, m->getRestitutionCombineMode()); + OMNI_PVD_SET(material, staticFriction, *m, m->getStaticFriction()); + OMNI_PVD_SET(material, dynamicFriction, *m, m->getDynamicFriction()); + OMNI_PVD_SET(material, restitution, *m, m->getRestitution()); +} + +void streamShapeMaterials(physx::PxShape* shapePtr, physx::PxMaterial** mats, physx::PxU32 nbrMaterials) +{ + OMNI_PVD_SETB(shape, materials, *shapePtr, mats, sizeof(PxMaterial*) * nbrMaterials); +} + +void streamShape(const physx::PxShape* shape) +{ + OMNI_PVD_CREATE(shape, *shape); + OMNI_PVD_SET(shape, isExclusive, *shape, shape->isExclusive()); + OMNI_PVD_SET(shape, geom, *shape, &shape->getGeometry()); + OMNI_PVD_SET(shape, contactOffset, *shape, shape->getContactOffset()); + OMNI_PVD_SET(shape, restOffset, *shape, shape->getRestOffset()); + OMNI_PVD_SET(shape, densityForFluid, *shape, shape->getDensityForFluid()); + OMNI_PVD_SET(shape, torsionalPatchRadius, *shape, shape->getTorsionalPatchRadius()); + OMNI_PVD_SET(shape, minTorsionalPatchRadius, *shape, shape->getMinTorsionalPatchRadius()); + OMNI_PVD_SET(shape, shapeFlags, *shape, shape->getFlags()); + OMNI_PVD_SET(shape, simulationFilterData, *shape, shape->getSimulationFilterData()); + OMNI_PVD_SET(shape, queryFilterData, *shape, shape->getQueryFilterData()); + + const int nbrMaterials = shape->getNbMaterials(); + PxMaterial** tmpMaterials = (PxMaterial**)PX_ALLOC(sizeof(PxMaterial*) * nbrMaterials, "tmpMaterials"); + physx::PxU32 nbrMats = shape->getMaterials(tmpMaterials, nbrMaterials); + streamShapeMaterials((PxShape*)shape, tmpMaterials, nbrMats); + + PX_FREE(tmpMaterials); +} + +void streamBVH(const physx::PxBVH* bvh) +{ + OMNI_PVD_CREATE(bvh, *bvh); +} + +void streamSoBoMesh(const physx::PxSoftBodyMesh* mesh) +{ + OMNI_PVD_CREATE(softbodymesh, *mesh); + OMNI_PVD_SET(softbodymesh, collisionMesh, *mesh, mesh->getCollisionMesh()); + OMNI_PVD_SET(softbodymesh, simulationMesh, *mesh, mesh->getSimulationMesh()); +} + +void streamTetMesh(const physx::PxTetrahedronMesh* mesh) +{ + OMNI_PVD_CREATE(tetrahedronmesh, *mesh); + //this gets done at the bottom now + const physx::PxU32 tetrahedronCount = mesh->getNbTetrahedrons(); + const physx::PxU32 has16BitIndices = mesh->getTetrahedronMeshFlags() & physx::PxTetrahedronMeshFlag::e16_BIT_INDICES; + const void* indexBuffer = mesh->getTetrahedrons(); + const physx::PxVec3* vertexBuffer = mesh->getVertices(); + const physx::PxU32* intIndices = reinterpret_cast(indexBuffer); + const physx::PxU16* shortIndices = reinterpret_cast(indexBuffer); + //TODO: not needed to copy this + const int nbrVerts = mesh->getNbVertices(); + const int nbrTets = mesh->getNbTetrahedrons(); + float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts"); + int vertIndex = 0; + for (int v = 0; v < nbrVerts; v++) + { + tmpVerts[vertIndex + 0] = vertexBuffer[v].x; + tmpVerts[vertIndex + 1] = vertexBuffer[v].y; + tmpVerts[vertIndex + 2] = vertexBuffer[v].z; + vertIndex += 3; + } + int* tmpIndices = (int*)PX_ALLOC(sizeof(int)*(nbrTets * 4), "tmpIndices"); + const int totalIndexCount = tetrahedronCount * 4; + if (has16BitIndices) + { + for (int i = 0; i < totalIndexCount; ++i) + { + tmpIndices[i] = shortIndices[i]; + } + } + else + { + for (int i = 0; i < totalIndexCount; ++i) + { + tmpIndices[i] = intIndices[i]; + } + } + OMNI_PVD_SETB(tetrahedronmesh, verts, *mesh, tmpVerts, sizeof(float) * 3 * nbrVerts); + OMNI_PVD_SETB(tetrahedronmesh, tets, *mesh, tmpIndices, sizeof(int) * 4 * nbrTets); + PX_FREE(tmpVerts); + PX_FREE(tmpIndices); +} + +void streamTriMesh(const physx::PxTriangleMesh* mesh) +{ + if (samplerInternals->addSharedMeshIfNotSeen(mesh, OmniPvdSharedMeshEnum::eOmniPvdTriMesh)) + { + OMNI_PVD_CREATE(trianglemesh, *mesh); + //this gets done at the bottom now + const physx::PxU32 triangleCount = mesh->getNbTriangles(); + const physx::PxU32 has16BitIndices = mesh->getTriangleMeshFlags() & physx::PxTriangleMeshFlag::e16_BIT_INDICES; + const void* indexBuffer = mesh->getTriangles(); + const physx::PxVec3* vertexBuffer = mesh->getVertices(); + const physx::PxU32* intIndices = reinterpret_cast(indexBuffer); + const physx::PxU16* shortIndices = reinterpret_cast(indexBuffer); + //TODO: not needed to copy this + const int nbrVerts = mesh->getNbVertices(); + const int nbrTris = mesh->getNbTriangles(); + float* tmpVerts = (float*)PX_ALLOC(sizeof(float)*(nbrVerts * 3), "tmpVerts"); + int vertIndex = 0; + for (int v = 0; v < nbrVerts; v++) + { + tmpVerts[vertIndex + 0] = vertexBuffer[v].x; + tmpVerts[vertIndex + 1] = vertexBuffer[v].y; + tmpVerts[vertIndex + 2] = vertexBuffer[v].z; + vertIndex += 3; + } + int* tmpIndices = (int*)PX_ALLOC(sizeof(float)*(nbrTris * 3), "tmpIndices"); + const int totalIndexCount = triangleCount * 3; + if (has16BitIndices) + { + for (int i = 0; i < totalIndexCount; ++i) + { + tmpIndices[i] = shortIndices[i]; + } + } + else + { + for (int i = 0; i < totalIndexCount; ++i) + { + tmpIndices[i] = intIndices[i]; + } + } + OMNI_PVD_SETB(trianglemesh, verts, *mesh, tmpVerts, sizeof(float) * 3 * nbrVerts); + OMNI_PVD_SETB(trianglemesh, tris, *mesh, tmpIndices, sizeof(int) * 3 * nbrTris); + PX_FREE(tmpVerts); + PX_FREE(tmpIndices); + } +} + +void streamTriMeshGeometry(const physx::PxGeometry& g) +{ + PxGeometryHolder gh(g); + OMNI_PVD_CREATE(geomtrianglemesh, g); + const physx::PxTriangleMeshGeometry& geometry = gh.triangleMesh(); + physx::PxTriangleMesh const * mesh = geometry.triangleMesh; + OMNI_PVD_SET(geomtrianglemesh, scale, g, geometry.scale.scale); + streamTriMesh(mesh); + OMNI_PVD_SET(geomtrianglemesh, triangleMesh, g, mesh); +} + +void OmniPvdPxSampler::streamSceneContacts(physx::NpScene& scene) +{ + if (!isSampling()) return; + PxsContactManagerOutputIterator outputIter; + Sc::ContactIterator contactIter; + scene.getScScene().initContactsIterator(contactIter, outputIter); + Sc::ContactIterator::Pair* pair; + PxU32 pairCount = 0; + PxArray pairsActors; + PxArray pairsContactCounts; + PxArray pairsContactPoints; + PxArray pairsContactNormals; + PxArray pairsContactSeparations; + PxArray pairsContactShapes; + PxArray pairsContactFacesIndices; + + while ((pair = contactIter.getNextPair()) != NULL) + { + PxU32 pairContactCount = 0; + Sc::Contact* contact = NULL; + bool firstContact = true; + while ((contact = pair->getNextContact()) != NULL) + { + if (firstContact) { + pairsActors.pushBack(pair->getActor0()); + pairsActors.pushBack(pair->getActor1()); + ++pairCount; + firstContact = false; + } + ++pairContactCount; + pairsContactPoints.pushBack(contact->point); + pairsContactNormals.pushBack(contact->normal); + pairsContactSeparations.pushBack(contact->separation); + pairsContactShapes.pushBack(contact->shape0); + pairsContactShapes.pushBack(contact->shape1); + pairsContactFacesIndices.pushBack(contact->faceIndex0); + pairsContactFacesIndices.pushBack(contact->faceIndex1); + } + if (pairContactCount) + { + pairsContactCounts.pushBack(pairContactCount); + } + } + + if (pairCount == 0) return; + + OMNI_PVD_SET(scene, pairCount, scene, pairCount); + PxU32 actorsSize = pairsActors.size() * sizeof(PxActor*); + PxActor** actors = actorsSize ? &pairsActors[0] : NULL; + OMNI_PVD_SETB(scene, pairsActors, scene, actors, actorsSize); + PxU32 contactCountsSize = pairsContactCounts.size() * sizeof(PxU32); + PxU32* contactCounts = contactCountsSize ? &pairsContactCounts[0] : NULL; + OMNI_PVD_SETB(scene, pairsContactCounts, scene, contactCounts, contactCountsSize); + PxU32 contactPointsSize = pairsContactPoints.size() * sizeof(PxVec3); + PxReal* contactPoints = contactPointsSize ? &pairsContactPoints[0].x : NULL; + OMNI_PVD_SETB(scene, pairsContactPoints, scene, contactPoints, contactPointsSize); + PxU32 contactNormalsSize = pairsContactNormals.size() * sizeof(PxVec3); + PxReal* contactNormals = contactNormalsSize ? &pairsContactNormals[0].x : NULL; + OMNI_PVD_SETB(scene, pairsContactNormals, scene, contactNormals, contactNormalsSize); + PxU32 contactSeparationsSize = pairsContactSeparations.size() * sizeof(PxReal); + PxReal* contactSeparations = contactSeparationsSize ? &pairsContactSeparations[0] : NULL; + OMNI_PVD_SETB(scene, pairsContactSeparations, scene, contactSeparations, contactSeparationsSize); + PxU32 contactShapesSize = pairsContactShapes.size() * sizeof(PxShape*); + PxShape** contactShapes = contactShapesSize ? &pairsContactShapes[0] : NULL; + OMNI_PVD_SETB(scene, pairsContactShapes, scene, contactShapes, contactShapesSize); + PxU32 contactFacesIndicesSize = pairsContactFacesIndices.size() * sizeof(PxU32); + PxU32* contactFacesIndices = contactFacesIndicesSize ? &pairsContactFacesIndices[0] : NULL; + OMNI_PVD_SETB(scene, pairsContactFacesIndices, scene, contactFacesIndices, contactFacesIndicesSize); +} + +OmniPvdPxSampler::OmniPvdPxSampler() +{ + samplerInternals = PX_NEW(OmniPvdSamplerInternals)(); + + physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex); + samplerInternals->mIsSampling = false; + + //TODO: this could be done better + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT8] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT16] = 2; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT8] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT16] = 2; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eFLOAT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eFLOAT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eSTRING] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eOBJECT_HANDLE] = sizeof(uint64_t); +} + +OmniPvdPxSampler::~OmniPvdPxSampler() +{ + physx::PxHashMap::Iterator iterScenes = samplerInternals->mSampledScenes.getIterator(); + while (!iterScenes.done()) + { + OmniPvdPxScene* scene = iterScenes->second; + PX_DELETE(scene); + iterScenes++; + } + PX_DELETE(samplerInternals); +} + +void OmniPvdPxSampler::startSampling() +{ + physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex); + if (samplerInternals->mIsSampling) + { + return; + } + if (samplerInternals->mPvdStream.initOmniPvd()) + { + samplerInternals->mIsSampling = true; + } +} + +bool OmniPvdPxSampler::isSampling() +{ + if (!samplerInternals) return false; + physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex); + return samplerInternals->mIsSampling; +} + +void OmniPvdPxSampler::setOmniPvdWriter(OmniPvdWriter* omniPvdWriter) +{ + samplerInternals->mPvdStream.setOmniPvdWriter(omniPvdWriter); +} + +void createGeometry(const physx::PxGeometry & pxGeom) +{ + + switch (pxGeom.getType()) + { + case physx::PxGeometryType::eSPHERE: + { + streamSphere(pxGeom); + } + break; + case physx::PxGeometryType::eCAPSULE: + { + streamCapsule(pxGeom); + } + break; + case physx::PxGeometryType::eBOX: + { + streamBox(pxGeom); + } + break; + case physx::PxGeometryType::eTRIANGLEMESH: + { + streamTriMeshGeometry(pxGeom); + } + break; + case physx::PxGeometryType::eCONVEXMESH: + { + streamConvexMeshGeometry(pxGeom); + } + break; + case physx::PxGeometryType::eHEIGHTFIELD: + { + streamHeightFieldGeometry(pxGeom); + } + break; + case physx::PxGeometryType::ePLANE: + { + streamPlane(pxGeom); + } + break; + default: + break; + } +} + +void destroyGeometry(const physx::PxGeometry & pxGeom) +{ + + switch (pxGeom.getType()) + { + case physx::PxGeometryType::eSPHERE: + { + OMNI_PVD_DESTROY(geomsphere, pxGeom); + } + break; + case physx::PxGeometryType::eCAPSULE: + { + OMNI_PVD_DESTROY(geomcapsule, pxGeom); + } + break; + case physx::PxGeometryType::eBOX: + { + OMNI_PVD_DESTROY(geombox, pxGeom); + } + break; + case physx::PxGeometryType::eTRIANGLEMESH: + { + OMNI_PVD_DESTROY(geomtrianglemesh, pxGeom); + } + break; + case physx::PxGeometryType::eCONVEXMESH: + { + OMNI_PVD_DESTROY(geomconvexmesh, pxGeom); + } + break; + case physx::PxGeometryType::eHEIGHTFIELD: + { + OMNI_PVD_DESTROY(geomheightfield, pxGeom); + } + break; + case physx::PxGeometryType::ePLANE: + { + OMNI_PVD_DESTROY(geomplane, pxGeom); + } + break; + default: + break; + } +} + +void OmniPvdPxSampler::sampleScene(physx::NpScene* scene) +{ + { + physx::PxMutex::ScopedLock myLock(samplerInternals->mSampleMutex); + if (!samplerInternals->mIsSampling) return; + } + OmniPvdPxScene* ovdScene = getSampledScene(scene); + ovdScene->sampleScene(); +} + +void OmniPvdPxSampler::onObjectAdd(const physx::PxBase* object) +{ + if (!isSampling()) return; + switch (object->getConcreteType()) + { + case physx::PxConcreteType::eHEIGHTFIELD: + streamHeightField(static_cast(object)); + OMNI_PVD_ADD(physics, heightFields, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eCONVEX_MESH: + streamConvexMesh(static_cast(object)); + OMNI_PVD_ADD(physics, convexMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eTRIANGLE_MESH_BVH33: + case physx::PxConcreteType::eTRIANGLE_MESH_BVH34: + streamTriMesh(static_cast(object)); + OMNI_PVD_ADD(physics, triangleMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eTETRAHEDRON_MESH: + streamTetMesh(static_cast(object)); + OMNI_PVD_ADD(physics, tetrahedronMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eSOFTBODY_MESH: + streamSoBoMesh(static_cast(object)); + OMNI_PVD_ADD(physics, softBodyMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eBVH: + streamBVH(static_cast(object)); + OMNI_PVD_ADD(physics, bvhs, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eSHAPE: + createGeometry(static_cast(object)->getGeometry()); + streamShape(static_cast(object)); + OMNI_PVD_ADD(physics, shapes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eMATERIAL: + streamMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, materials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eSOFTBODY_MATERIAL: + streamFEMSoBoMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, FEMSoftBodyMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eCLOTH_MATERIAL: + streamFEMClothMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, FEMClothMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::ePBD_MATERIAL: + streamPBDMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, PBDMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eFLIP_MATERIAL: + streamFLIPMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, FLIPMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eMPM_MATERIAL: + streamMPMMaterial(static_cast(object)); + OMNI_PVD_ADD(physics, MPMMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eSOFT_BODY: + streamSoBo(static_cast(object)); + OMNI_PVD_ADD(physics, softBodies, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eAGGREGATE: + streamAggregate(static_cast(object)); + OMNI_PVD_ADD(physics, aggregates, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_REDUCED_COORDINATE: + streamArticulation(static_cast(object)); + OMNI_PVD_ADD(physics, articulations, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_LINK: + streamArticulationLink(static_cast(object)); + OMNI_PVD_ADD(articulation, links, static_cast(object)->getArticulation(), static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE: + streamArticulationJoint(static_cast(object)); + break; + case physx::PxConcreteType::eRIGID_DYNAMIC: + streamRigidDynamic(static_cast(object)); + OMNI_PVD_ADD(physics, rigidDynamics, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + case physx::PxConcreteType::eRIGID_STATIC: + streamRigidStatic(static_cast(object)); + OMNI_PVD_ADD(physics, rigidStatics, static_cast(NpPhysics::getInstance()), static_cast(*object)); + break; + } +} + +void OmniPvdPxSampler::onObjectRemove(const physx::PxBase* object) +{ + if (!isSampling()) return; + switch (object->getConcreteType()) + { + case physx::PxConcreteType::eHEIGHTFIELD: + OMNI_PVD_REMOVE(physics, heightFields, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(heightfield, static_cast(*object)); + break; + case physx::PxConcreteType::eCONVEX_MESH: + OMNI_PVD_REMOVE(physics, convexMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(convexmesh, static_cast(*object)); + break; + case physx::PxConcreteType::eTRIANGLE_MESH_BVH33: + case physx::PxConcreteType::eTRIANGLE_MESH_BVH34: + OMNI_PVD_REMOVE(physics, triangleMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(trianglemesh, static_cast(*object)); + break; + case physx::PxConcreteType::eTETRAHEDRON_MESH: + OMNI_PVD_REMOVE(physics, tetrahedronMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(tetrahedronmesh, static_cast(*object)); + break; + case physx::PxConcreteType::eSOFTBODY_MESH: + OMNI_PVD_REMOVE(physics, softBodyMeshes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(softbodymesh, static_cast(*object)); + break; + case physx::PxConcreteType::eBVH: + OMNI_PVD_REMOVE(physics, bvhs, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(bvh, static_cast(*object)); + break; + case physx::PxConcreteType::eSHAPE: + OMNI_PVD_REMOVE(physics, shapes, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(shape, static_cast(*object)); + destroyGeometry(static_cast(*object).getGeometry()); + break; + case physx::PxConcreteType::eMATERIAL: + OMNI_PVD_REMOVE(physics, materials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(material, static_cast(*object)); + break; + case physx::PxConcreteType::eSOFTBODY_MATERIAL: + OMNI_PVD_REMOVE(physics, FEMSoftBodyMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(femsoftbodymaterial, static_cast(*object)); + break; + case physx::PxConcreteType::eCLOTH_MATERIAL: + OMNI_PVD_REMOVE(physics, FEMClothMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(femclothmaterial, static_cast(*object)); + break; + case physx::PxConcreteType::ePBD_MATERIAL: + OMNI_PVD_REMOVE(physics, PBDMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(pbdmaterial, static_cast(*object)); + break; + case physx::PxConcreteType::eFLIP_MATERIAL: + OMNI_PVD_REMOVE(physics, FLIPMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(flipmaterial, static_cast(*object)); + break; + case physx::PxConcreteType::eMPM_MATERIAL: + OMNI_PVD_REMOVE(physics, MPMMaterials, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(mpmmaterial, static_cast(*object)); + break; + case physx::PxConcreteType::eSOFT_BODY: + OMNI_PVD_REMOVE(physics, softBodies, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(actor, static_cast(*object)); // @@@ + break; + case physx::PxConcreteType::eAGGREGATE: + OMNI_PVD_REMOVE(physics, aggregates, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(aggregate, static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_REDUCED_COORDINATE: + OMNI_PVD_REMOVE(physics, articulations, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(articulation, static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_LINK: + OMNI_PVD_DESTROY(actor, static_cast(*object)); + break; + case physx::PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE: + OMNI_PVD_DESTROY(articulationjoint, static_cast(*object)); + break; + case physx::PxConcreteType::eRIGID_DYNAMIC: + OMNI_PVD_REMOVE(physics, rigidDynamics, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(actor, static_cast(*object)); + break; + case physx::PxConcreteType::eRIGID_STATIC: + OMNI_PVD_REMOVE(physics, rigidStatics, static_cast(NpPhysics::getInstance()), static_cast(*object)); + OMNI_PVD_DESTROY(actor, static_cast(*object)); + break; + } +} + +OmniPvdPxScene* OmniPvdPxSampler::getSampledScene(physx::NpScene* scene) +{ + physx::PxMutex::ScopedLock myLock(samplerInternals->mSampledScenesMutex); + const physx::PxHashMap::Entry* entry = samplerInternals->mSampledScenes.find(scene); + if (entry) + { + return entry->second; + } + else + { + OmniPvdPxScene* ovdScene = PX_NEW(OmniPvdPxScene)(); + samplerInternals->mSampledScenes[scene] = ovdScene; + return ovdScene; + } +} + +// Returns true if the Geom was not yet seen and added +bool OmniPvdSamplerInternals::addSharedMeshIfNotSeen(const void* geom, OmniPvdSharedMeshEnum geomEnum) +{ + physx::PxMutex::ScopedLock myLock(samplerInternals->mSharedGeomsMutex); + const physx::PxHashMap::Entry* entry = samplerInternals->mSharedMeshesMap.find(geom); + if (entry) + { + return false; + } + else + { + samplerInternals->mSharedMeshesMap[geom] = geomEnum; + return true; + } +} + +//generic PVD API: +//TODO: Put back context handles. + +template void OmniPvdPxSampler::createObject(OmniPvdClassHandle ch, ClassType const & objectId) +{ + samplerInternals->mPvdStream.mWriter->createObject(UNNECESSARY_SCENE_HANDLE, ch, OmniPvdObjectHandle(&objectId), NULL); +} + +template void OmniPvdPxSampler::destroyObject(ClassType const & objectId) +{ + samplerInternals->mPvdStream.mWriter->destroyObject(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId)); +} + +template void OmniPvdPxSampler::setAttribute(OmniPvdAttributeHandle ah, const ClassType & objectId, const AttributeType & value) +{ + samplerInternals->mPvdStream.mWriter->setAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&value, sizeof(AttributeType)); +} + +template void OmniPvdPxSampler::setAttributeBytes(OmniPvdAttributeHandle ah, ClassType const & objectId, const AttributeType * value, unsigned nBytes) +{ + samplerInternals->mPvdStream.mWriter->setAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)value, nBytes); +} + +template void OmniPvdPxSampler::addToSet(OmniPvdAttributeHandle ah, ClassType const & objectId, AttributeType const & value) +{ + const AttributeType * atp = &value; + samplerInternals->mPvdStream.mWriter->addToSetAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&atp, sizeof(atp)); +} + +template void OmniPvdPxSampler::removeFromSet(OmniPvdAttributeHandle ah, ClassType const & objectId, AttributeType const & value) +{ + const AttributeType * atp = &value; + samplerInternals->mPvdStream.mWriter->removeFromSetAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&atp, sizeof(atp) ); +} + +/////////////////////////////////////////////////////////////////////////////// + +OmniPvdPxSampler* OmniPvdPxSampler::getInstance() +{ + PX_ASSERT(&physx::NpPhysics::getInstance() != NULL); + return &physx::NpPhysics::getInstance() ? physx::NpPhysics::getInstance().mOmniPvdSampler : NULL; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.h new file mode 100644 index 0000000..25c219b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdPxSampler.h @@ -0,0 +1,177 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_PX_SAMPLER_H +#define OMNI_PVD_PX_SAMPLER_H + +/* +The below helper macros are to be used in SDK code to send information to PVD as unintrusively as possible. + +Principles: +* Data created or changed by the user should be sent as soon as it has been written to an SDK class, ideally right at the end of the API create() or set() call. +* Objects should ideally be destroyed from their destructors (since release() calls might just decrement). +* Data written by the SDK should be sent at the end of the simulate frame. +* Ideally use Px-pointers as object handles. Beware that multiple inheritance can result in different pointer values so its best to cast to the Px-type pointer / reference explicitly. + Even if the code works by passing in different equivalent pointer types, this will generate unnecessary duplicate template code. +*/ +#if PX_SUPPORT_OMNI_PVD +// You can use this in conditional statements to check for a connection + #define OMNI_PVD_ACTIVE (::OmniPvdPxSampler::getInstance() != NULL) +// Create object reference o of PVD type c. Example: OMNI_PVD_CREATE(scene, static_cast(*npScene)); + #define OMNI_PVD_CREATE(c, o) if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->createObject(OmniPvdPxSampler::classHandle_##c, o); } +// Destroy object reference o of PVD type c. Example: OMNI_PVD_DESTROY(scene, static_cast(*npScene)); + #define OMNI_PVD_DESTROY(c, o) if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->destroyObject(o); } +// Set PVD attribute a of object reference o of PVD type c to value v. v is passed as reference to value; PVD object handles are passed as reference to POINTER here! +// Example: OMNI_PVD_SET(actor, isdynamic, a, false) + #define OMNI_PVD_SET(c, a, o, v) if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->setAttribute(OmniPvdPxSampler::attributeHandle_##c##_##a, o, v); } +// Same as set, but for variable length attributes like vertex buffers. pv is the address of the data, and n is the size in bytes. + #define OMNI_PVD_SETB(c, a, o, pv, n)if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->setAttributeBytes(OmniPvdPxSampler::attributeHandle_##c##_##a, o, pv, n); } +// Same as set, but for attribute sets of unique things like an array of references. v is passed as a REFERENCE. + #define OMNI_PVD_ADD(c, a, o, v) if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->addToSet(OmniPvdPxSampler::attributeHandle_##c##_##a, o, v); } +// TO remove a member handle from the set. + #define OMNI_PVD_REMOVE(c, a, o, v) if (::OmniPvdPxSampler::getInstance() != NULL) {::OmniPvdPxSampler::getInstance()->removeFromSet(OmniPvdPxSampler::attributeHandle_##c##_##a, o, v); } + +#else + #define OMNI_PVD_ACTIVE (false) + #define OMNI_PVD_CREATE(c, p) + #define OMNI_PVD_DESTROY(c, p) + #define OMNI_PVD_SET(c, a, p, v) + #define OMNI_PVD_SETB(c, a, p, v, n) + #define OMNI_PVD_ADD(c, a, p, v) + #define OMNI_PVD_REMOVE(c, a, p, v) +#endif + + +#if PX_SUPPORT_OMNI_PVD +#include "omnipvd/PxOmniPvd.h" + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxMutex.h" +#include "OmniPvdChunkAlloc.h" +#include "foundation/PxUserAllocated.h" + +#include "../../../pvdruntime/include/OmniPvdDefines.h" + +namespace physx +{ + class PxScene; + class PxBase; + class NpActor; + class NpScene; + class NpShape; + class NpShapeManager; + class PxActor; + class PxGeometryHolder; + class NpOmniPvd; + class PxGeometry; + class PxJoint; + class PxShape; + class PxMaterial; +} + +extern void streamActorName(physx::PxActor & a, const char* name); +extern void streamShapeMaterials(physx::PxShape* shapePtr, physx::PxMaterial** mats, physx::PxU32 nbrMaterials); + +enum OmniPvdSharedMeshEnum { + eOmniPvdTriMesh = 0, + eOmniPvdConvexMesh = 1, + eOmniPvdHeightField = 2, +}; + +class OmniPvdLoader; +class OmniPvdWriter; +class OmniPvdPxSampler; +class OmniPvdWriteStream; +class OmniPvdActorMod; +class OmniPvdShapeMod; +class OmniPvdPxScene; + +class OmniPvdPxSampler : public physx::PxUserAllocated +{ +public: + OmniPvdPxSampler(); + ~OmniPvdPxSampler(); + //enables sampling: + void startSampling(); + bool isSampling(); + //sets destination: + void setOmniPvdWriter(OmniPvdWriter* omniPvdWriter); + + // writes all contacts to the stream + void streamSceneContacts(physx::NpScene& scene); + + // call at the end of a simulation step: + void sampleScene(physx::NpScene* scene); + //// convenience function to handle different kinds of geometry correctly, including capturing meshes: + //void createGeometry(const physx::PxGeometry & g); + //void destroyGeometry(const physx::PxGeometry & g); + + //simplified generic API to be used via simple macros above: + template void createObject(OmniPvdClassHandle, ClassType const & objectId); + template void destroyObject(ClassType const & objectId); + template void setAttribute(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + template void setAttributeBytes(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const * value, unsigned nBytes); + template void addToSet(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + template void removeFromSet(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + + //handles for all SDK classes and attributes + +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) static OmniPvdClassHandle classHandle_##c; +#define OMNI_PVD_CLASS(c, classT) static OmniPvdClassHandle classHandle_##c; +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ENUM_VALUE(c, a, v) +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) static OmniPvdAttributeHandle attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) static OmniPvdAttributeHandle attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) static OmniPvdAttributeHandle attributeHandle_##c##_##a; + + +#include "OmniPvdTypes.h" //SDK classes and attributes declared here +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + + static OmniPvdPxSampler* getInstance(); + + void onObjectAdd(const physx::PxBase* object); + void onObjectRemove(const physx::PxBase* object); + + +private: + OmniPvdPxScene* getSampledScene(physx::NpScene* scene); +}; + +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdTypes.h new file mode 100644 index 0000000..0106faa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/omnipvd/OmniPvdTypes.h @@ -0,0 +1,497 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// Declare OMNI_PVD Types and Attributes here! +// The last two attribute parameters could now be derived from the other data, so could be removed in a refactor, +// though explicit control may be better. +// Note that HANDLE attributes have to use (Type const *) style, otherwise it won't compile! +// Note also that if we update the PVD USD reader code to not need different names than we use in the source code we don't need to pass both e.g. "scene" and "PxScene" and we can simplify + + +//////////////////////////////////////////////////////////////////////////////// +// Bitfields +//////////////////////////////////////////////////////////////////////////////// + +OMNI_PVD_ENUM (sceneflag, PxSceneFlag) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_ACTIVE_ACTORS, PxSceneFlag::eENABLE_ACTIVE_ACTORS) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_CCD, PxSceneFlag::eENABLE_CCD) +OMNI_PVD_ENUM_VALUE (sceneflag, eDISABLE_CCD_RESWEEP, PxSceneFlag::eDISABLE_CCD_RESWEEP) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_PCM, PxSceneFlag::eENABLE_PCM) +OMNI_PVD_ENUM_VALUE (sceneflag, eDISABLE_CONTACT_REPORT_BUFFER_RESIZE, PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE) +OMNI_PVD_ENUM_VALUE (sceneflag, eDISABLE_CONTACT_CACHE, PxSceneFlag::eDISABLE_CONTACT_CACHE) +OMNI_PVD_ENUM_VALUE (sceneflag, eREQUIRE_RW_LOCK, PxSceneFlag::eREQUIRE_RW_LOCK) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_STABILIZATION, PxSceneFlag::eENABLE_STABILIZATION) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_AVERAGE_POINT, PxSceneFlag::eENABLE_AVERAGE_POINT) +OMNI_PVD_ENUM_VALUE (sceneflag, eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS, PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_GPU_DYNAMICS, PxSceneFlag::eENABLE_GPU_DYNAMICS) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_ENHANCED_DETERMINISM, PxSceneFlag::eENABLE_ENHANCED_DETERMINISM) +OMNI_PVD_ENUM_VALUE (sceneflag, eENABLE_FRICTION_EVERY_ITERATION, PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION) +OMNI_PVD_ENUM_VALUE (sceneflag, eSUPPRESS_READBACK, PxSceneFlag::eSUPPRESS_READBACK) +OMNI_PVD_ENUM_VALUE (sceneflag, eFORCE_READBACK, PxSceneFlag::eFORCE_READBACK) + +OMNI_PVD_ENUM (materialflag, PxMaterialFlag) +OMNI_PVD_ENUM_VALUE (materialflag, eDISABLE_FRICTION, PxMaterialFlag::eDISABLE_FRICTION) +OMNI_PVD_ENUM_VALUE (materialflag, eDISABLE_STRONG_FRICTION,PxMaterialFlag::eDISABLE_STRONG_FRICTION) +OMNI_PVD_ENUM_VALUE (materialflag, eIMPROVED_PATCH_FRICTION,PxMaterialFlag::eIMPROVED_PATCH_FRICTION) + +OMNI_PVD_ENUM (actorflag, PxActorFlag) +OMNI_PVD_ENUM_VALUE (actorflag, eVISUALIZATION, PxActorFlag::eVISUALIZATION) +OMNI_PVD_ENUM_VALUE (actorflag, eDISABLE_GRAVITY, PxActorFlag::eDISABLE_GRAVITY) +OMNI_PVD_ENUM_VALUE (actorflag, eSEND_SLEEP_NOTIFIES, PxActorFlag::eSEND_SLEEP_NOTIFIES) +OMNI_PVD_ENUM_VALUE (actorflag, eDISABLE_SIMULATION, PxActorFlag::eDISABLE_SIMULATION) + +OMNI_PVD_ENUM (rigidbodyflag, PxRigidBodyFlag) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eKINEMATIC, PxRigidBodyFlag::eKINEMATIC) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES, PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_CCD, PxRigidBodyFlag::eENABLE_CCD) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_CCD_FRICTION, PxRigidBodyFlag::eENABLE_CCD_FRICTION) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_POSE_INTEGRATION_PREVIEW, PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_SPECULATIVE_CCD, PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_CCD_MAX_CONTACT_IMPULSE, PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eRETAIN_ACCELERATIONS, PxRigidBodyFlag::eRETAIN_ACCELERATIONS) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eFORCE_KINE_KINE_NOTIFICATIONS, PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eFORCE_STATIC_KINE_NOTIFICATIONS, PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eENABLE_GYROSCOPIC_FORCES, PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES) +OMNI_PVD_ENUM_VALUE (rigidbodyflag, eRESERVED, PxRigidBodyFlag::eRESERVED) + +OMNI_PVD_ENUM (articulationflag, PxArticulationFlag) +OMNI_PVD_ENUM_VALUE (articulationflag, eFIX_BASE, PxArticulationFlag::eFIX_BASE) +OMNI_PVD_ENUM_VALUE (articulationflag, eDRIVE_LIMITS_ARE_FORCES, PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES) +OMNI_PVD_ENUM_VALUE (articulationflag, eDISABLE_SELF_COLLISION, PxArticulationFlag::eDISABLE_SELF_COLLISION) +OMNI_PVD_ENUM_VALUE (articulationflag, eCOMPUTE_JOINT_FORCES, PxArticulationFlag::eCOMPUTE_JOINT_FORCES) + +OMNI_PVD_ENUM (rigiddynamiclockflag, PxRigidDynamicLockFlag) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_LINEAR_X, PxRigidDynamicLockFlag::eLOCK_LINEAR_X) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_LINEAR_Y, PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_LINEAR_Z, PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_ANGULAR_X, PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_ANGULAR_Y, PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) +OMNI_PVD_ENUM_VALUE (rigiddynamiclockflag, eLOCK_ANGULAR_Z, PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + +OMNI_PVD_ENUM (shapeflag, PxShapeFlag) +OMNI_PVD_ENUM_VALUE (shapeflag, eSIMULATION_SHAPE, PxShapeFlag::eSIMULATION_SHAPE) +OMNI_PVD_ENUM_VALUE (shapeflag, eSCENE_QUERY_SHAPE, PxShapeFlag::eSCENE_QUERY_SHAPE) +OMNI_PVD_ENUM_VALUE (shapeflag, eTRIGGER_SHAPE, PxShapeFlag::eTRIGGER_SHAPE) +OMNI_PVD_ENUM_VALUE (shapeflag, eVISUALIZATION, PxShapeFlag::eVISUALIZATION) + +//////////////////////////////////////////////////////////////////////////////// +// Single value enums +//////////////////////////////////////////////////////////////////////////////// + +OMNI_PVD_ENUM (frictiontype, PxFrictionType) +OMNI_PVD_ENUM_VALUE (frictiontype, ePATCH, PxFrictionType::ePATCH) +OMNI_PVD_ENUM_VALUE (frictiontype, eONE_DIRECTIONAL, PxFrictionType::eONE_DIRECTIONAL) +OMNI_PVD_ENUM_VALUE (frictiontype, eTWO_DIRECTIONAL, PxFrictionType::eTWO_DIRECTIONAL) + +OMNI_PVD_ENUM (broadphasetype, PxBroadPhaseType) +OMNI_PVD_ENUM_VALUE (broadphasetype, eSAP, PxBroadPhaseType::eSAP) +OMNI_PVD_ENUM_VALUE (broadphasetype, eMBP, PxBroadPhaseType::eMBP) +OMNI_PVD_ENUM_VALUE (broadphasetype, eABP, PxBroadPhaseType::eABP) +OMNI_PVD_ENUM_VALUE (broadphasetype, eGPU, PxBroadPhaseType::eGPU) + +OMNI_PVD_ENUM (solvertype, PxSolverType) +OMNI_PVD_ENUM_VALUE (solvertype, ePGS, PxSolverType::ePGS) +OMNI_PVD_ENUM_VALUE (solvertype, eTGS, PxSolverType::eTGS) + +OMNI_PVD_ENUM (pairfilteringmode, PxPairFilteringMode) +OMNI_PVD_ENUM_VALUE (pairfilteringmode, eKEEP, PxPairFilteringMode::eKEEP) +OMNI_PVD_ENUM_VALUE (pairfilteringmode, eSUPPRESS, PxPairFilteringMode::eSUPPRESS) +OMNI_PVD_ENUM_VALUE (pairfilteringmode, eKILL, PxPairFilteringMode::eKILL) + +OMNI_PVD_ENUM (combinemode, PxCombineMode) +OMNI_PVD_ENUM_VALUE (combinemode, eAVERAGE, PxCombineMode::eAVERAGE) +OMNI_PVD_ENUM_VALUE (combinemode, eMIN, PxCombineMode::eMIN) +OMNI_PVD_ENUM_VALUE (combinemode, eMULTIPLY, PxCombineMode::eMULTIPLY) +OMNI_PVD_ENUM_VALUE (combinemode, eMAX, PxCombineMode::eMAX) + +OMNI_PVD_ENUM (actortype, PxActorType) +OMNI_PVD_ENUM_VALUE (actortype, eRIGID_STATIC, PxActorType::eRIGID_STATIC) +OMNI_PVD_ENUM_VALUE (actortype, eRIGID_DYNAMIC, PxActorType::eRIGID_DYNAMIC) +OMNI_PVD_ENUM_VALUE (actortype, eARTICULATION_LINK, PxActorType::eARTICULATION_LINK) +OMNI_PVD_ENUM_VALUE (actortype, eSOFTBODY, PxActorType::eSOFTBODY) +OMNI_PVD_ENUM_VALUE (actortype, eFEMCLOTH, PxActorType::eFEMCLOTH) +OMNI_PVD_ENUM_VALUE (actortype, ePBD_PARTICLESYSTEM, PxActorType::ePBD_PARTICLESYSTEM) +OMNI_PVD_ENUM_VALUE (actortype, eFLIP_PARTICLESYSTEM, PxActorType::eFLIP_PARTICLESYSTEM) +OMNI_PVD_ENUM_VALUE (actortype, eMPM_PARTICLESYSTEM, PxActorType::eMPM_PARTICLESYSTEM) +OMNI_PVD_ENUM_VALUE (actortype, eCUSTOM_PARTICLESYSTEM, PxActorType::eCUSTOM_PARTICLESYSTEM) +OMNI_PVD_ENUM_VALUE (actortype, eHAIRSYSTEM, PxActorType::eHAIRSYSTEM) + +OMNI_PVD_ENUM (articulationjointtype, PxArticulationJointType) +OMNI_PVD_ENUM_VALUE (articulationjointtype, eFIX, PxArticulationJointType::eFIX) +OMNI_PVD_ENUM_VALUE (articulationjointtype, ePRISMATIC, PxArticulationJointType::ePRISMATIC) +OMNI_PVD_ENUM_VALUE (articulationjointtype, eREVOLUTE, PxArticulationJointType::eREVOLUTE) +OMNI_PVD_ENUM_VALUE (articulationjointtype, eREVOLUTE_UNWRAPPED, PxArticulationJointType::eREVOLUTE_UNWRAPPED) +OMNI_PVD_ENUM_VALUE (articulationjointtype, eSPHERICAL, PxArticulationJointType::eSPHERICAL) +OMNI_PVD_ENUM_VALUE (articulationjointtype, eUNDEFINED, PxArticulationJointType::eUNDEFINED) + +OMNI_PVD_ENUM (articulationmotion, PxArticulationMotion) +OMNI_PVD_ENUM_VALUE (articulationmotion, eLOCKED, PxArticulationMotion::eLOCKED) +OMNI_PVD_ENUM_VALUE (articulationmotion, eLIMITED, PxArticulationMotion::eLIMITED) +OMNI_PVD_ENUM_VALUE (articulationmotion, eFREE, PxArticulationMotion::eFREE) + +OMNI_PVD_ENUM (articulationdrivetype, PxArticulationDriveType) +OMNI_PVD_ENUM_VALUE (articulationdrivetype, eFORCE, PxArticulationDriveType::eFORCE) +OMNI_PVD_ENUM_VALUE (articulationdrivetype, eACCELERATION, PxArticulationDriveType::eACCELERATION) +OMNI_PVD_ENUM_VALUE (articulationdrivetype, eTARGET, PxArticulationDriveType::eTARGET) +OMNI_PVD_ENUM_VALUE (articulationdrivetype, eVELOCITY, PxArticulationDriveType::eVELOCITY) +OMNI_PVD_ENUM_VALUE (articulationdrivetype, eNONE, PxArticulationDriveType::eNONE) + +//////////////////////////////////////////////////////////////////////////////// +// Classes +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +// PVD name, PVD attr, Px classT, Px attrT, PVD basicT, PVD basicTsize +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +// Physics +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (physics, PxPhysics) +OMNI_PVD_ATTRIBUTE_SET (physics, scenes, PxPhysics, PxScene) +OMNI_PVD_ATTRIBUTE_SET (physics, heightFields, PxPhysics, PxHeightField) +OMNI_PVD_ATTRIBUTE_SET (physics, convexMeshes, PxPhysics, PxConvexMesh) +OMNI_PVD_ATTRIBUTE_SET (physics, triangleMeshes, PxPhysics, PxTriangleMesh) +OMNI_PVD_ATTRIBUTE_SET (physics, tetrahedronMeshes, PxPhysics, PxTetrahedronMesh) +OMNI_PVD_ATTRIBUTE_SET (physics, softBodyMeshes, PxPhysics, PxSoftBodyMesh) +OMNI_PVD_ATTRIBUTE_SET (physics, shapes, PxPhysics, PxShape) +OMNI_PVD_ATTRIBUTE_SET (physics, bvhs, PxPhysics, PxBVH) +OMNI_PVD_ATTRIBUTE_SET (physics, materials, PxPhysics, PxMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, FEMSoftBodyMaterials, PxPhysics, PxFEMSoftBodyMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, FEMClothMaterials, PxPhysics, PxFEMClothMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, PBDMaterials, PxPhysics, PxPBDMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, FLIPMaterials, PxPhysics, PxFLIPMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, MPMMaterials, PxPhysics, PxMPMMaterial) +OMNI_PVD_ATTRIBUTE_SET (physics, softBodies, PxPhysics, PxActor) +OMNI_PVD_ATTRIBUTE_SET (physics, rigidDynamics, PxPhysics, PxActor) +OMNI_PVD_ATTRIBUTE_SET (physics, rigidStatics, PxPhysics, PxActor) +OMNI_PVD_ATTRIBUTE_SET (physics, aggregates, PxPhysics, PxAggregate) +OMNI_PVD_ATTRIBUTE_SET (physics, articulations, PxPhysics, PxArticulationReducedCoordinate) +OMNI_PVD_ATTRIBUTE (physics, tolerancesScale, PxPhysics, PxTolerancesScale, OmniPvdDataTypeEnum::eFLOAT32, 2) + +//////////////////////////////////////////////////////////////////////////////// +// Scene +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (scene, PxScene) +OMNI_PVD_ATTRIBUTE_SET (scene, actors, PxScene, PxActor) +OMNI_PVD_ATTRIBUTE_SET (scene, articulations, PxScene, PxArticulationReducedCoordinate) +OMNI_PVD_ATTRIBUTE_SET (scene, aggregates, PxScene, PxAggregate) +OMNI_PVD_ATTRIBUTE_FLAG (scene, flags, PxScene, PxSceneFlags, sceneflag) +OMNI_PVD_ATTRIBUTE_FLAG (scene, frictionType,PxScene, PxFrictionType::Enum, frictiontype) +OMNI_PVD_ATTRIBUTE_FLAG (scene, broadPhaseType,PxScene, PxBroadPhaseType::Enum, broadphasetype) +OMNI_PVD_ATTRIBUTE_FLAG (scene, kineKineFilteringMode, PxScene, PxPairFilteringMode::Enum, pairfilteringmode) +OMNI_PVD_ATTRIBUTE_FLAG (scene, staticKineFilteringMode,PxScene, PxPairFilteringMode::Enum, pairfilteringmode) +OMNI_PVD_ATTRIBUTE_FLAG (scene, solverType, PxScene, PxSolverType::Enum, solvertype) +OMNI_PVD_ATTRIBUTE (scene, gravity, PxScene, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (scene, bounceThresholdVelocity,PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, frictionOffsetThreshold,PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, frictionCorrelationDistance, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, solverOffsetSlop, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, solverBatchSize, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, solverArticulationBatchSize, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, nbContactDataBlocks, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, maxNbContactDataBlocks, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, maxBiasCoefficient, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, contactReportStreamBufferSize, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, ccdMaxPasses, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, ccdThreshold, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, ccdMaxSeparation, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, wakeCounterResetValue, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (scene, hasCPUDispatcher, PxScene, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasCUDAContextManager, PxScene, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasSimulationEventCallback, PxScene,bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasContactModifyCallback, PxScene, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasCCDContactModifyCallback, PxScene,bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasBroadPhaseCallback, PxScene, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, hasFilterCallback, PxScene, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbActors, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbBodies, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbStaticShapes,PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbDynamicShapes,PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbAggregates, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbConstraints,PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbRegions, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, limitsMaxNbBroadPhaseOverlaps,PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, sanityBounds, PxScene, PxBounds3, OmniPvdDataTypeEnum::eFLOAT32, 6) +OMNI_PVD_ATTRIBUTE (scene, gpuDynamicsConfig, PxScene, PxgDynamicsMemoryConfig, OmniPvdDataTypeEnum::eUINT32, 12) +OMNI_PVD_ATTRIBUTE (scene, gpuMaxNumPartitions, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, gpuMaxNumStaticPartitions,PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, gpuComputeVersion, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, contactPairSlabSize, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, tolerancesScale, PxScene, PxTolerancesScale, OmniPvdDataTypeEnum::eFLOAT32, 2) +//OMNI_PVD_SET(scene, sceneQuerySystem, PxScene, npScene->getSQAPI())//needs class + +OMNI_PVD_ATTRIBUTE (scene, pairCount, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (scene, pairsActors, PxScene, PxActor*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 0) // 2 for each pair +OMNI_PVD_ATTRIBUTE (scene, pairsContactCounts, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) // 1 for each pair +OMNI_PVD_ATTRIBUTE (scene, pairsContactPoints, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) // 3 for each contact +OMNI_PVD_ATTRIBUTE (scene, pairsContactNormals, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) // 3 for each contact +OMNI_PVD_ATTRIBUTE (scene, pairsContactSeparations, PxScene, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) // 1 for each contact +OMNI_PVD_ATTRIBUTE (scene, pairsContactShapes, PxScene, PxShape*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 0) // 2 for each contact +OMNI_PVD_ATTRIBUTE (scene, pairsContactFacesIndices, PxScene, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) // 2 for each contact + +//////////////////////////////////////////////////////////////////////////////// +// Material +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (material, PxMaterial) +OMNI_PVD_ATTRIBUTE_FLAG (material, flags, PxMaterial, PxMaterialFlags, materialflag) +OMNI_PVD_ATTRIBUTE_FLAG (material, frictionCombineMode, PxMaterial, PxCombineMode::Enum, combinemode) +OMNI_PVD_ATTRIBUTE_FLAG (material, restitutionCombineMode, PxMaterial, PxCombineMode::Enum, combinemode) +OMNI_PVD_ATTRIBUTE (material, staticFriction, PxMaterial, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (material, dynamicFriction, PxMaterial, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (material, restitution, PxMaterial, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (material, damping, PxMaterial, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) + +//////////////////////////////////////////////////////////////////////////////// +// FEMSoftBodyMaterial +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (femsoftbodymaterial, PxFEMSoftBodyMaterial) + +//////////////////////////////////////////////////////////////////////////////// +// FEMClothMaterial +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (femclothmaterial, PxFEMClothMaterial) + +//////////////////////////////////////////////////////////////////////////////// +// PBDMaterial +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (pbdmaterial, PxPBDMaterial) + +//////////////////////////////////////////////////////////////////////////////// +// FLIPMaterial +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (flipmaterial, PxFLIPMaterial) + +//////////////////////////////////////////////////////////////////////////////// +// MPMMaterial +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (mpmmaterial, PxMPMMaterial) + +//////////////////////////////////////////////////////////////////////////////// +// Aggregate +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (aggregate, PxAggregate) +OMNI_PVD_ATTRIBUTE_SET (aggregate, actors, PxAggregate, PxActor) +OMNI_PVD_ATTRIBUTE (aggregate, selfCollision, PxAggregate, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (aggregate, maxNbShapes, PxAggregate, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (aggregate, scene, PxAggregate, PxScene const*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// Actor +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (actor, PxActor) +//name - is there a string type? +OMNI_PVD_ATTRIBUTE_FLAG (actor, type, PxActor, PxActorType::Enum, actortype) +OMNI_PVD_ATTRIBUTE_FLAG (actor, flags, PxActor, PxActorFlags, actorflag) +OMNI_PVD_ATTRIBUTE_FLAG (actor, rigidBodyFlags, PxActor, PxRigidBodyFlags, rigidbodyflag) +OMNI_PVD_ATTRIBUTE (actor, name, PxActor, char, OmniPvdDataTypeEnum::eSTRING, 1) +OMNI_PVD_ATTRIBUTE (actor, dominance, PxActor, PxDominanceGroup, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (actor, ownerClient, PxActor, PxClientID, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (actor, translation, PxActor, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (actor, rotation, PxActor, PxQuat, OmniPvdDataTypeEnum::eFLOAT32, 4) +OMNI_PVD_ATTRIBUTE (actor, scale, PxActor, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (actor, cMassLocalPose, PxActor, PxTransform, OmniPvdDataTypeEnum::eFLOAT32, 7) +OMNI_PVD_ATTRIBUTE (actor, mass, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, massSpaceInertiaTensor, PxActor, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (actor, linearDamping, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, angularDamping, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, linearVelocity, PxActor, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (actor, angularVelocity, PxActor, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (actor, maxLinearVelocity, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, maxAngularVelocity, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, minAdvancedCCDCoefficient, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, maxDepenetrationVelocity, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, maxContactImpulse, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, contactSlopCoefficient, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_SET (actor, shapes, PxActor, PxShape) +OMNI_PVD_ATTRIBUTE (actor, articulation, PxActor, PxArticulationReducedCoordinate const*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (actor, worldBounds, PxActor, PxBounds3, OmniPvdDataTypeEnum::eFLOAT32, 6) +OMNI_PVD_ATTRIBUTE (actor, isSleeping, PxActor, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (actor, sleepThreshold, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, wakeCounter, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, stabilizationThreshold, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, positionIterations, PxActor, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (actor, velocityIterations, PxActor, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (actor, rigidDynamicLockFlags, PxActor, PxRigidDynamicLockFlags, rigiddynamiclockflag) +OMNI_PVD_ATTRIBUTE (actor, contactReportThreshold, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, CFMScale, PxActor, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (actor, inboundJointDOF, PxActor, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) + +//////////////////////////////////////////////////////////////////////////////// +// Articulation +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (articulation, PxArticulationReducedCoordinate) +OMNI_PVD_ATTRIBUTE (articulation, positionIterations, PxArticulationReducedCoordinate, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, velocityIterations, PxArticulationReducedCoordinate, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, isSleeping, PxArticulationReducedCoordinate, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (articulation, sleepThreshold, PxArticulationReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, stabilizationThreshold, PxArticulationReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, wakeCounter, PxArticulationReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, maxLinVelocity, PxArticulationReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulation, maxAngVelocity, PxArticulationReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_SET (articulation, links, PxArticulationReducedCoordinate, PxArticulationLink) +OMNI_PVD_ATTRIBUTE (articulation, worldBounds, PxArticulationReducedCoordinate, PxBounds3, OmniPvdDataTypeEnum::eFLOAT32, 6) +OMNI_PVD_ATTRIBUTE_FLAG (articulation, articulationFlags, PxArticulationReducedCoordinate, PxArticulationFlags, articulationflag) +OMNI_PVD_ATTRIBUTE (articulation, dofs, PxArticulationReducedCoordinate, PxU32, OmniPvdDataTypeEnum::eUINT32, 1) + +//////////////////////////////////////////////////////////////////////////////// +// Articulation Joint +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (articulationjoint, PxArticulationJointReducedCoordinate) +OMNI_PVD_ATTRIBUTE (articulationjoint, parentLink, PxArticulationJointReducedCoordinate, PxArticulationLink const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (articulationjoint, childLink, PxArticulationJointReducedCoordinate, PxArticulationLink const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (articulationjoint, parentTranslation, PxArticulationJointReducedCoordinate, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (articulationjoint, parentRotation, PxArticulationJointReducedCoordinate, PxQuat, OmniPvdDataTypeEnum::eFLOAT32, 4) +OMNI_PVD_ATTRIBUTE (articulationjoint, childTranslation, PxArticulationJointReducedCoordinate, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (articulationjoint, childRotation, PxArticulationJointReducedCoordinate, PxQuat, OmniPvdDataTypeEnum::eFLOAT32, 4) +OMNI_PVD_ATTRIBUTE_FLAG (articulationjoint, type, PxArticulationJointReducedCoordinate, PxArticulationJointType::Enum, articulationjointtype) +OMNI_PVD_ATTRIBUTE (articulationjoint, motion, PxArticulationJointReducedCoordinate, PxArticulationMotion::Enum, OmniPvdDataTypeEnum::eUINT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, armature, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, frictionCoefficient, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulationjoint, maxJointVelocity, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (articulationjoint, jointPosition, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, jointVelocity, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, concreteTypeName, PxArticulationJointReducedCoordinate, char, OmniPvdDataTypeEnum::eSTRING, 1) +OMNI_PVD_ATTRIBUTE (articulationjoint, limitLow, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, limitHigh, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveStiffness, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveDamping, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveMaxForce, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveType, PxArticulationJointReducedCoordinate, PxArticulationDriveType::Enum, OmniPvdDataTypeEnum::eUINT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveTarget, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (articulationjoint, driveVelocity, PxArticulationJointReducedCoordinate, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) + +//////////////////////////////////////////////////////////////////////////////// +// Shape +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (shape, PxShape) +OMNI_PVD_ATTRIBUTE (shape, translation, PxShape, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (shape, rotation, PxShape, PxQuat, OmniPvdDataTypeEnum::eFLOAT32, 4) +OMNI_PVD_ATTRIBUTE (shape, scale, PxShape, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (shape, isExclusive, PxShape, bool, OmniPvdDataTypeEnum::eUINT8, 1) +OMNI_PVD_ATTRIBUTE (shape, geom, PxShape, PxGeometry const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (shape, contactOffset, PxShape, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (shape, restOffset, PxShape, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (shape, densityForFluid, PxShape, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (shape, torsionalPatchRadius, PxShape, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (shape, minTorsionalPatchRadius, PxShape, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (shape, shapeFlags, PxShape, PxShapeFlags, shapeflag) +OMNI_PVD_ATTRIBUTE (shape, simulationFilterData, PxShape, PxFilterData, OmniPvdDataTypeEnum::eUINT32, 4) +OMNI_PVD_ATTRIBUTE (shape, queryFilterData, PxShape, PxFilterData, OmniPvdDataTypeEnum::eUINT32, 4) +OMNI_PVD_ATTRIBUTE (shape, materials, PxShape, PxMaterial const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 0) + +//////////////////////////////////////////////////////////////////////////////// +// GeomSphere +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomsphere, PxGeometry, PxGeomSphere) +OMNI_PVD_ATTRIBUTE (geomsphere, radius, PxGeometry, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) + +//////////////////////////////////////////////////////////////////////////////// +// GeomCapsule +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomcapsule, PxGeometry, PxGeomCapsule) +OMNI_PVD_ATTRIBUTE (geomcapsule, halfHeight,PxGeometry,PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (geomcapsule, radius, PxGeometry, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) + +//////////////////////////////////////////////////////////////////////////////// +// GeomBox +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geombox, PxGeometry, PxGeomBox) +OMNI_PVD_ATTRIBUTE (geombox, halfExtents,PxGeometry, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) + +//////////////////////////////////////////////////////////////////////////////// +// GeomPlane +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomplane, PxGeometry, PxGeomPlane) + +//////////////////////////////////////////////////////////////////////////////// +// GeomConvexMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomconvexmesh, PxGeometry, PxGeomConvexMesh) +OMNI_PVD_ATTRIBUTE (geomconvexmesh, scale, PxGeometry, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (geomconvexmesh, convexMesh, PxGeometry, PxConvexMesh const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// ConvexMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (convexmesh, PxConvexMesh) +OMNI_PVD_ATTRIBUTE (convexmesh, verts, PxConvexMesh, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (convexmesh, tris, PxConvexMesh, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) + +//////////////////////////////////////////////////////////////////////////////// +// GeomHeightfield +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomheightfield, PxGeometry, PxGeomHeightField) +OMNI_PVD_ATTRIBUTE (geomheightfield, scale,PxGeometry, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (geomheightfield, heightField, PxGeometry,PxHeightField const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// Heightfield +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (heightfield, PxHeightField) +OMNI_PVD_ATTRIBUTE (heightfield, verts, PxHeightField, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (heightfield, tris, PxHeightField, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) + +//////////////////////////////////////////////////////////////////////////////// +// GeomTriangleMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomtrianglemesh, PxGeometry, PxGeomTriangleMesh) +OMNI_PVD_ATTRIBUTE (geomtrianglemesh, scale,PxGeometry, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (geomtrianglemesh, triangleMesh, PxGeometry, PxTriangleMesh const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// TriangleMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (trianglemesh, PxTriangleMesh) +OMNI_PVD_ATTRIBUTE (trianglemesh, verts, PxTriangleMesh, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (trianglemesh, tris, PxTriangleMesh, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) + +//////////////////////////////////////////////////////////////////////////////// +// GeomTetrahedronMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_FAKE_CLASS (geomtetrahedronmesh, PxGeometry, PxGeomTetrahedronMesh) +OMNI_PVD_ATTRIBUTE (geomtetrahedronmesh, tetrahedronMesh, PxGeometry, PxTetrahedronMesh const *, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// TetrahedronMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (tetrahedronmesh, PxTetrahedronMesh) +OMNI_PVD_ATTRIBUTE (tetrahedronmesh, verts, PxTetrahedronMesh, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (tetrahedronmesh, tets, PxTetrahedronMesh, PxU32, OmniPvdDataTypeEnum::eUINT32, 0) + +//////////////////////////////////////////////////////////////////////////////// +// SoftBodyMesh +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (softbodymesh, PxSoftBodyMesh) +OMNI_PVD_ATTRIBUTE (softbodymesh, collisionMesh, PxSoftBodyMesh, PxTetrahedronMesh*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (softbodymesh, simulationMesh, PxSoftBodyMesh, PxTetrahedronMesh*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) + +//////////////////////////////////////////////////////////////////////////////// +// BVH +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (bvh, PxBVH) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/windows/NpWindowsDelayLoadHook.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/windows/NpWindowsDelayLoadHook.cpp new file mode 100644 index 0000000..935db0f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physx/src/windows/NpWindowsDelayLoadHook.cpp @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "common/windows/PxWindowsDelayLoadHook.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "windows/CmWindowsLoadLibrary.h" + +namespace physx +{ + static const PxDelayLoadHook* gPhysXDelayLoadHook = NULL; + + void PxSetPhysXDelayLoadHook(const PxDelayLoadHook* hook) + { + gPhysXDelayLoadHook = hook; + } +} + +// delay loading is enabled only for non static configuration +#if !defined PX_PHYSX_STATIC_LIB + +// Prior to Visual Studio 2015 Update 3, these hooks were non-const. +#define DELAYIMP_INSECURE_WRITABLE_HOOKS +#include + +using namespace physx; + +#pragma comment(lib, "delayimp") + +FARPROC WINAPI physxDelayHook(unsigned dliNotify, PDelayLoadInfo pdli) +{ + switch (dliNotify) { + case dliStartProcessing : + break; + + case dliNotePreLoadLibrary : + { + return Cm::physXCommonDliNotePreLoadLibrary(pdli->szDll,gPhysXDelayLoadHook); + } + break; + + case dliNotePreGetProcAddress : + break; + + case dliFailLoadLib : + break; + + case dliFailGetProc : + break; + + case dliNoteEndProcessing : + break; + + default : + + return NULL; + } + + return NULL; +} + +PfnDliHook __pfnDliNotifyHook2 = physxDelayHook; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp new file mode 100644 index 0000000..872f6ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.cpp @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxBoxGeometry.h" +#include "characterkinematic/PxController.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" + +#include "CctBoxController.h" +#include "CctCharacterControllerManager.h" + +using namespace physx; +using namespace Cct; + +static PX_FORCE_INLINE PxVec3 CCTtoProxyExtents(PxF32 halfHeight, PxF32 halfSideExtent, PxF32 halfForwardExtent, PxF32 coeff) +{ + // PT: because we now orient the box CCT using the same quat as for capsules... + // i.e. the identity quat corresponds to a up dir = 1,0,0 (which is like the worst choice we could have made, of course) + return PxVec3(halfHeight * coeff, halfSideExtent * coeff, halfForwardExtent * coeff); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +BoxController::BoxController(const PxControllerDesc& desc, PxPhysics& sdk, PxScene* s) : Controller(desc, s) +{ + mType = PxControllerShapeType::eBOX; + + const PxBoxControllerDesc& bc = static_cast(desc); + + mHalfHeight = bc.halfHeight; + mHalfSideExtent = bc.halfSideExtent; + mHalfForwardExtent = bc.halfForwardExtent; + + // Create kinematic actor under the hood + PxBoxGeometry boxGeom; + boxGeom.halfExtents = CCTtoProxyExtents(bc.halfHeight, bc.halfSideExtent, bc.halfForwardExtent, mProxyScaleCoeff); + + createProxyActor(sdk, boxGeom, *desc.material, desc.clientID); +} + +BoxController::~BoxController() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void BoxController::invalidateCache() +{ + if(mManager->mLockingEnabled) + mWriteLock.lock(); + + mCctModule.voidTestCache(); + + if(mManager->mLockingEnabled) + mWriteLock.unlock(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool BoxController::getWorldBox(PxExtendedBounds3& box) const +{ + setCenterExtents(box, mPosition, PxVec3(mHalfHeight, mHalfSideExtent, mHalfForwardExtent)); + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxF32 BoxController::getHalfHeight() const +{ + return mHalfHeight; +} + +PxF32 BoxController::getHalfSideExtent() const +{ + return mHalfSideExtent; +} + +PxF32 BoxController::getHalfForwardExtent() const +{ + return mHalfForwardExtent; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool BoxController::updateKinematicProxy() +{ + // Set extents for kinematic proxy + if(mKineActor) + { + PxShape* shape = getKineShape(); + + PX_ASSERT(shape->getGeometryType() == PxGeometryType::eBOX); + PxBoxGeometry bg; + shape->getBoxGeometry(bg); + + bg.halfExtents = CCTtoProxyExtents(mHalfHeight, mHalfSideExtent, mHalfForwardExtent, mProxyScaleCoeff); + shape->setGeometry(bg); + } + return true; +} + +bool BoxController::setHalfHeight(PxF32 halfHeight) +{ + if(halfHeight<=0.0f) + return false; + + mHalfHeight = halfHeight; + return updateKinematicProxy(); +} + +bool BoxController::setHalfSideExtent(PxF32 halfSideExtent) +{ + if(halfSideExtent<=0.0f) + return false; + + mHalfSideExtent = halfSideExtent; + return updateKinematicProxy(); +} + +bool BoxController::setHalfForwardExtent(PxF32 halfForwardExtent) +{ + if(halfForwardExtent<=0.0f) + return false; + + mHalfForwardExtent = halfForwardExtent; + return updateKinematicProxy(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxExtendedVec3 BoxController::getFootPosition() const +{ + PxExtendedVec3 groundPosition = mPosition; // Middle of the CCT + groundPosition -= mUserParams.mUpDirection * (mHalfHeight + mUserParams.mContactOffset); // Ground + return groundPosition; +} + +bool BoxController::setFootPosition(const PxExtendedVec3& position) +{ + PxExtendedVec3 centerPosition = position; + centerPosition += mUserParams.mUpDirection * (mHalfHeight + mUserParams.mContactOffset); + return setPosition(centerPosition); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void BoxController::getOBB(PxExtendedBox& obb) const +{ + // PT: TODO: optimize this + PxExtendedBounds3 worldBox; + getWorldBox(worldBox); + + getCenter(worldBox, obb.center); + getExtents(worldBox, obb.extents); + obb.rot = mUserParams.mQuatFromUp; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void BoxController::resize(PxReal height) +{ + const float oldHeight = getHalfHeight(); + setHalfHeight(height); + + const float delta = height - oldHeight; + PxExtendedVec3 pos = getPosition(); + pos += mUserParams.mUpDirection * delta; + setPosition(pos); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.h new file mode 100644 index 0000000..bfd77cb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctBoxController.h @@ -0,0 +1,112 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_BOX_CONTROLLER +#define CCT_BOX_CONTROLLER + +/* Exclude from documentation */ +/** \cond */ + +#include "characterkinematic/PxBoxController.h" + +#include "CctController.h" + +namespace physx +{ + +class PxPhysics; + +namespace Cct +{ + + class BoxController : public PxBoxController, public Controller + { + public: + BoxController(const PxControllerDesc& desc, PxPhysics& sdk, PxScene* scene); + virtual ~BoxController(); + + // Controller + virtual PxF32 getHalfHeightInternal() const PX_OVERRIDE { return mHalfHeight; } + virtual bool getWorldBox(PxExtendedBounds3& box) const PX_OVERRIDE; + virtual PxController* getPxController() PX_OVERRIDE { return this; } + //~Controller + + // PxController + virtual PxControllerShapeType::Enum getType() const PX_OVERRIDE { return mType; } + virtual void release() PX_OVERRIDE { releaseInternal(); } + virtual PxControllerCollisionFlags move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles) PX_OVERRIDE; + virtual bool setPosition(const PxExtendedVec3& position) PX_OVERRIDE { return setPos(position); } + virtual const PxExtendedVec3& getPosition() const PX_OVERRIDE { return mPosition; } + virtual bool setFootPosition(const PxExtendedVec3& position) PX_OVERRIDE; + virtual PxExtendedVec3 getFootPosition() const PX_OVERRIDE; + virtual PxRigidDynamic* getActor() const PX_OVERRIDE { return mKineActor; } + virtual void setStepOffset(const float offset) PX_OVERRIDE { if(offset>=0.0f) + mUserParams.mStepOffset = offset; } + virtual PxF32 getStepOffset() const PX_OVERRIDE { return mUserParams.mStepOffset; } + virtual void setNonWalkableMode(PxControllerNonWalkableMode::Enum flag) PX_OVERRIDE { mUserParams.mNonWalkableMode = flag; } + virtual PxControllerNonWalkableMode::Enum getNonWalkableMode() const PX_OVERRIDE { return mUserParams.mNonWalkableMode; } + virtual PxF32 getContactOffset() const PX_OVERRIDE { return mUserParams.mContactOffset; } + virtual void setContactOffset(PxF32 offset) PX_OVERRIDE { if(offset>0.0f) + mUserParams.mContactOffset = offset;} + virtual PxVec3 getUpDirection() const PX_OVERRIDE { return mUserParams.mUpDirection; } + virtual void setUpDirection(const PxVec3& up) PX_OVERRIDE { setUpDirectionInternal(up); } + virtual PxF32 getSlopeLimit() const PX_OVERRIDE { return mUserParams.mSlopeLimit; } + virtual void setSlopeLimit(PxF32 slopeLimit) PX_OVERRIDE { if(slopeLimit>0.0f) + mUserParams.mSlopeLimit = slopeLimit;} + virtual void invalidateCache(); + virtual PxScene* getScene() PX_OVERRIDE { return mScene; } + virtual void* getUserData() const PX_OVERRIDE { return mUserData; } + virtual void setUserData(void* userData) PX_OVERRIDE { mUserData = userData; } + virtual void getState(PxControllerState& state) const PX_OVERRIDE { return getInternalState(state); } + virtual void getStats(PxControllerStats& stats) const PX_OVERRIDE { return getInternalStats(stats); } + virtual void resize(PxReal height); + //~PxController + + // PxBoxController + virtual PxF32 getHalfHeight() const PX_OVERRIDE; + virtual PxF32 getHalfSideExtent() const PX_OVERRIDE; + virtual PxF32 getHalfForwardExtent() const PX_OVERRIDE; + virtual bool setHalfHeight(PxF32 halfHeight) PX_OVERRIDE; + virtual bool setHalfSideExtent(PxF32 halfSideExtent) PX_OVERRIDE; + virtual bool setHalfForwardExtent(PxF32 halfForwardExtent) PX_OVERRIDE; + //~ PxBoxController + + PxF32 mHalfHeight; + PxF32 mHalfSideExtent; + PxF32 mHalfForwardExtent; + + bool updateKinematicProxy(); + void getOBB(PxExtendedBox& obb) const; + }; + +} // namespace Cct + +} + +/** \endcond */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp new file mode 100644 index 0000000..944a01b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.cpp @@ -0,0 +1,191 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxCapsuleGeometry.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" +#include "characterkinematic/PxController.h" +#include "CctCapsuleController.h" +#include "CctCharacterControllerManager.h" + +using namespace physx; +using namespace Cct; + +static PX_FORCE_INLINE float CCTtoProxyRadius(float r, PxF32 coeff) { return r * coeff; } +static PX_FORCE_INLINE float CCTtoProxyHeight(float h, PxF32 coeff) { return 0.5f * h * coeff; } + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +CapsuleController::CapsuleController(const PxControllerDesc& desc, PxPhysics& sdk, PxScene* s) : Controller(desc, s) +{ + mType = PxControllerShapeType::eCAPSULE; + + const PxCapsuleControllerDesc& cc = static_cast(desc); + + mRadius = cc.radius; + mHeight = cc.height; + mClimbingMode = cc.climbingMode; + + // Create kinematic actor under the hood + PxCapsuleGeometry capsGeom; + capsGeom.radius = CCTtoProxyRadius(cc.radius, mProxyScaleCoeff); + capsGeom.halfHeight = CCTtoProxyHeight(cc.height, mProxyScaleCoeff); + + createProxyActor(sdk, capsGeom, *desc.material, desc.clientID); +} + +CapsuleController::~CapsuleController() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CapsuleController::invalidateCache() +{ + if(mManager->mLockingEnabled) + mWriteLock.lock(); + + mCctModule.voidTestCache(); + + if(mManager->mLockingEnabled) + mWriteLock.unlock(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CapsuleController::getWorldBox(PxExtendedBounds3& box) const +{ + setCenterExtents(box, mPosition, PxVec3(mRadius, mRadius+mHeight*0.5f, mRadius)); + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CapsuleController::setRadius(PxF32 r) +{ + // Set radius for CCT volume + mRadius = r; + + // Set radius for kinematic proxy + if(mKineActor) + { + PxShape* shape = getKineShape(); + + PX_ASSERT(shape->getGeometryType() == PxGeometryType::eCAPSULE); + PxCapsuleGeometry cg; + shape->getCapsuleGeometry(cg); + + cg.radius = CCTtoProxyRadius(r, mProxyScaleCoeff); + shape->setGeometry(cg); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool CapsuleController::setHeight(PxF32 h) +{ + // Set height for CCT volume + mHeight = h; + + // Set height for kinematic proxy + if(mKineActor) + { + PxShape* shape = getKineShape(); + + PX_ASSERT(shape->getGeometryType() == PxGeometryType::eCAPSULE); + PxCapsuleGeometry cg; + shape->getCapsuleGeometry(cg); + + cg.halfHeight = CCTtoProxyHeight(h, mProxyScaleCoeff); + shape->setGeometry(cg); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxCapsuleClimbingMode::Enum CapsuleController::getClimbingMode() const +{ + return mClimbingMode; +} + +bool CapsuleController::setClimbingMode(PxCapsuleClimbingMode::Enum mode) +{ + if(mode>=PxCapsuleClimbingMode::eLAST) + return false; + mClimbingMode = mode; + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxExtendedVec3 CapsuleController::getFootPosition() const +{ + PxExtendedVec3 groundPosition = mPosition; // Middle of the CCT + groundPosition -= mUserParams.mUpDirection * (mUserParams.mContactOffset+mRadius+mHeight*0.5f); // Ground + return groundPosition; +} + +bool CapsuleController::setFootPosition(const PxExtendedVec3& position) +{ + PxExtendedVec3 centerPosition = position; + centerPosition += mUserParams.mUpDirection * (mUserParams.mContactOffset+mRadius+mHeight*0.5f); + return setPosition(centerPosition); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CapsuleController::getCapsule(PxExtendedCapsule& capsule) const +{ + // PT: TODO: optimize this + PxExtendedVec3 p0 = mPosition; + PxExtendedVec3 p1 = mPosition; + const PxVec3 extents = mUserParams.mUpDirection*mHeight*0.5f; + p0 -= extents; + p1 += extents; + + capsule.p0 = p0; + capsule.p1 = p1; + capsule.radius = mRadius; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CapsuleController::resize(PxReal height) +{ + const float oldHeight = getHeight(); + setHeight(height); + + const float delta = height - oldHeight; + PxExtendedVec3 pos = getPosition(); + pos += mUserParams.mUpDirection * delta * 0.5f; + setPosition(pos); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.h new file mode 100644 index 0000000..c8f20c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCapsuleController.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_CAPSULE_CONTROLLER +#define CCT_CAPSULE_CONTROLLER + +/* Exclude from documentation */ +/** \cond */ + +#include "characterkinematic/PxCapsuleController.h" + +#include "CctController.h" + +namespace physx +{ +class PxPhysics; + +namespace Cct +{ + class CapsuleController : public PxCapsuleController, public Controller + { + public: + CapsuleController(const PxControllerDesc& desc, PxPhysics& sdk, PxScene* scene); + virtual ~CapsuleController(); + + // Controller + virtual PxF32 getHalfHeightInternal() const PX_OVERRIDE { return mRadius+mHeight*0.5f; } + virtual bool getWorldBox(PxExtendedBounds3& box) const PX_OVERRIDE; + virtual PxController* getPxController() PX_OVERRIDE { return this; } + //~Controller + + // PxController + virtual PxControllerShapeType::Enum getType() const PX_OVERRIDE { return mType; } + virtual void release() PX_OVERRIDE { releaseInternal(); } + virtual PxControllerCollisionFlags move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles) PX_OVERRIDE; + virtual bool setPosition(const PxExtendedVec3& position) PX_OVERRIDE { return setPos(position); } + virtual const PxExtendedVec3& getPosition() const PX_OVERRIDE { return mPosition; } + virtual bool setFootPosition(const PxExtendedVec3& position) PX_OVERRIDE; + virtual PxExtendedVec3 getFootPosition() const PX_OVERRIDE; + virtual PxRigidDynamic* getActor() const PX_OVERRIDE { return mKineActor; } + virtual void setStepOffset(const float offset) PX_OVERRIDE { if(offset>=0.0f) + mUserParams.mStepOffset = offset; } + virtual PxF32 getStepOffset() const PX_OVERRIDE { return mUserParams.mStepOffset; } + virtual void setNonWalkableMode(PxControllerNonWalkableMode::Enum flag) PX_OVERRIDE { mUserParams.mNonWalkableMode = flag; } + virtual PxControllerNonWalkableMode::Enum getNonWalkableMode() const PX_OVERRIDE { return mUserParams.mNonWalkableMode; } + virtual PxF32 getContactOffset() const PX_OVERRIDE { return mUserParams.mContactOffset; } + virtual void setContactOffset(PxF32 offset) PX_OVERRIDE { if(offset>0.0f) + mUserParams.mContactOffset = offset;} + virtual PxVec3 getUpDirection() const PX_OVERRIDE { return mUserParams.mUpDirection; } + virtual void setUpDirection(const PxVec3& up) PX_OVERRIDE { setUpDirectionInternal(up); } + virtual PxF32 getSlopeLimit() const PX_OVERRIDE { return mUserParams.mSlopeLimit; } + virtual void setSlopeLimit(PxF32 slopeLimit) PX_OVERRIDE { if(slopeLimit>0.0f) + mUserParams.mSlopeLimit = slopeLimit;} + virtual void invalidateCache() PX_OVERRIDE; + virtual PxScene* getScene() PX_OVERRIDE { return mScene; } + virtual void* getUserData() const PX_OVERRIDE { return mUserData; } + virtual void setUserData(void* userData) PX_OVERRIDE { mUserData = userData; } + virtual void getState(PxControllerState& state) const PX_OVERRIDE { return getInternalState(state); } + virtual void getStats(PxControllerStats& stats) const PX_OVERRIDE { return getInternalStats(stats); } + virtual void resize(PxReal height) PX_OVERRIDE; + //~PxController + + // PxCapsuleController + virtual PxF32 getRadius() const PX_OVERRIDE { return mRadius; } + virtual PxF32 getHeight() const PX_OVERRIDE { return mHeight; } + virtual PxCapsuleClimbingMode::Enum getClimbingMode() const PX_OVERRIDE; + virtual bool setRadius(PxF32 radius) PX_OVERRIDE; + virtual bool setHeight(PxF32 height) PX_OVERRIDE; + virtual bool setClimbingMode(PxCapsuleClimbingMode::Enum) PX_OVERRIDE; + //~ PxCapsuleController + + void getCapsule(PxExtendedCapsule& capsule) const; + + PxF32 mRadius; + PxF32 mHeight; + PxCapsuleClimbingMode::Enum mClimbingMode; + }; + +} // namespace Cct + +} + +/** \endcond */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp new file mode 100644 index 0000000..ebc972a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.cpp @@ -0,0 +1,2622 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "geometry/PxMeshQuery.h" +#include "foundation/PxMathUtils.h" +#include "PxRigidDynamic.h" + +#include "CctCharacterController.h" +#include "CctCharacterControllerManager.h" +#include "CctSweptBox.h" +#include "CctSweptCapsule.h" +#include "CctObstacleContext.h" +#include "GuIntersectionBoxBox.h" +#include "GuDistanceSegmentBox.h" +#include "foundation/PxFPU.h" +#include "CmVisualization.h" +#include "CmUtils.h" + +// PT: TODO: remove those includes.... shouldn't be allowed from here +#include "characterkinematic/PxControllerObstacles.h" // (*) +#include "characterkinematic/PxControllerManager.h" // (*) +#include "characterkinematic/PxControllerBehavior.h" // (*) +#include "CctInternalStructs.h" // (*) + +//#define DEBUG_MTD +#ifdef DEBUG_MTD + #include +#endif + +#define MAX_ITER 10 + +using namespace physx; +using namespace Cct; +using namespace Gu; +using namespace Cm; + +static const PxU32 gObstacleDebugColor = PxU32(PxDebugColor::eARGB_CYAN); +//static const PxU32 gCCTBoxDebugColor = PxU32(PxDebugColor::eARGB_YELLOW); +static const PxU32 gTBVDebugColor = PxU32(PxDebugColor::eARGB_MAGENTA); +static const bool gUsePartialUpdates = true; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxHitFlags getSweepHitFlags(const CCTParams& params) +{ + PxHitFlags sweepHitFlags = PxHitFlag::eDEFAULT/*|PxHitFlag::eMESH_BOTH_SIDES*/; +// sweepHitFlags |= PxHitFlag::eASSUME_NO_INITIAL_OVERLAP; + if(params.mPreciseSweeps) + sweepHitFlags |= PxHitFlag::ePRECISE_SWEEP; + return sweepHitFlags; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static bool shouldApplyRecoveryModule(const PxRigidActor& rigidActor) +{ + // PT: we must let the dynamic objects go through the CCT for proper 2-way interactions. + // But we should still apply the recovery module for kinematics. + + const PxType type = rigidActor.getConcreteType(); + if(type==PxConcreteType::eRIGID_STATIC) + return true; + + if(type!=PxConcreteType::eRIGID_DYNAMIC) + return false; + + return static_cast(rigidActor).getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static const bool gUseLocalSpace = true; +static PxVec3 worldToLocal(const PxObstacle& obstacle, const PxExtendedVec3& worldPos) +{ + const PxTransform tr(toVec3(obstacle.mPos), obstacle.mRot); + return tr.transformInv(toVec3(worldPos)); +} + +static PxVec3 localToWorld(const PxObstacle& obstacle, const PxVec3& localPos) +{ + const PxTransform tr(toVec3(obstacle.mPos), obstacle.mRot); + return tr.transform(localPos); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifdef PX_BIG_WORLDS + typedef PxExtendedBounds3 PxCCTBounds3; + typedef PxExtendedVec3 PxCCTVec3; +#else + typedef PxBounds3 PxCCTBounds3; + typedef PxVec3 PxCCTVec3; +#endif + +static PX_INLINE void scale(PxCCTBounds3& b, const PxVec3& scale) +{ + PxCCTVec3 center; getCenter(b, center); + PxVec3 extents; getExtents(b, extents); + extents.x *= scale.x; + extents.y *= scale.y; + extents.z *= scale.z; + setCenterExtents(b, center, extents); +} + +static PX_INLINE void computeReflexionVector(PxVec3& reflected, const PxVec3& incomingDir, const PxVec3& outwardNormal) +{ + reflected = incomingDir - outwardNormal * 2.0f * (incomingDir.dot(outwardNormal)); +} + +static PX_INLINE void collisionResponse(PxExtendedVec3& targetPosition, const PxExtendedVec3& currentPosition, const PxVec3& currentDir, const PxVec3& hitNormal, PxF32 bump, PxF32 friction, bool normalize=false) +{ + // Compute reflect direction + PxVec3 reflectDir; + computeReflexionVector(reflectDir, currentDir, hitNormal); + reflectDir.normalize(); + + // Decompose it + PxVec3 normalCompo, tangentCompo; + decomposeVector(normalCompo, tangentCompo, reflectDir, hitNormal); + + // Compute new destination position + const PxF32 amplitude = (targetPosition - currentPosition).magnitude(); + + targetPosition = currentPosition; + if(bump!=0.0f) + { + if(normalize) + normalCompo.normalize(); + targetPosition += normalCompo*bump*amplitude; + } + if(friction!=0.0f) + { + if(normalize) + tangentCompo.normalize(); + targetPosition += tangentCompo*friction*amplitude; + } +} + +static PX_INLINE void relocateBox(PxBoxGeometry& boxGeom, PxTransform& pose, const PxExtendedVec3& center, const PxVec3& extents, const PxExtendedVec3& origin, const PxQuat& quatFromUp) +{ + boxGeom.halfExtents = extents; + + pose.p.x = float(center.x - origin.x); + pose.p.y = float(center.y - origin.y); + pose.p.z = float(center.z - origin.z); + + pose.q = quatFromUp; +} + +static PX_INLINE void relocateBox(PxBoxGeometry& boxGeom, PxTransform& pose, const TouchedUserBox& userBox) +{ + relocateBox(boxGeom, pose, userBox.mBox.center, userBox.mBox.extents, userBox.mOffset, userBox.mBox.rot); +} + +static PX_INLINE void relocateBox(PxBoxGeometry& boxGeom, PxTransform& pose, const TouchedBox& box) +{ + boxGeom.halfExtents = box.mExtents; + + pose.p = box.mCenter; + pose.q = box.mRot; +} + +static PX_INLINE void relocateCapsule( + PxCapsuleGeometry& capsuleGeom, PxTransform& pose, const SweptCapsule* sc, + const PxQuat& quatFromUp, + const PxExtendedVec3& center, const PxExtendedVec3& origin) +{ + capsuleGeom.radius = sc->mRadius; + capsuleGeom.halfHeight = 0.5f * sc->mHeight; + + pose.p.x = float(center.x - origin.x); + pose.p.y = float(center.y - origin.y); + pose.p.z = float(center.z - origin.z); + + pose.q = quatFromUp; +} + +static PX_INLINE void relocateCapsule(PxCapsuleGeometry& capsuleGeom, PxTransform& pose, const PxVec3& p0, const PxVec3& p1, PxReal radius) +{ + capsuleGeom.radius = radius; + pose = PxTransformFromSegment(p0, p1, &capsuleGeom.halfHeight); + if(capsuleGeom.halfHeight==0.0f) + capsuleGeom.halfHeight = FLT_EPSILON; +} + +static PX_INLINE void relocateCapsule(PxCapsuleGeometry& capsuleGeom, PxTransform& pose, const TouchedUserCapsule& userCapsule) +{ + PxVec3 p0, p1; + p0.x = float(userCapsule.mCapsule.p0.x - userCapsule.mOffset.x); + p0.y = float(userCapsule.mCapsule.p0.y - userCapsule.mOffset.y); + p0.z = float(userCapsule.mCapsule.p0.z - userCapsule.mOffset.z); + p1.x = float(userCapsule.mCapsule.p1.x - userCapsule.mOffset.x); + p1.y = float(userCapsule.mCapsule.p1.y - userCapsule.mOffset.y); + p1.z = float(userCapsule.mCapsule.p1.z - userCapsule.mOffset.z); + + relocateCapsule(capsuleGeom, pose, p0, p1, userCapsule.mCapsule.radius); +} + +static bool SweepBoxUserBox(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eUSER_BOX); + const SweptBox* SB = static_cast(volume); + const TouchedUserBox* TC = static_cast(geom); + + PxBoxGeometry boxGeom0; + PxTransform boxPose0; + // To precompute + relocateBox(boxGeom0, boxPose0, center, SB->mExtents, TC->mOffset, test->mUserParams.mQuatFromUp); + + PxBoxGeometry boxGeom1; + PxTransform boxPose1; + relocateBox(boxGeom1, boxPose1, *TC); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom0, boxPose0, boxGeom1, boxPose1, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mWorldNormal = sweepHit.normal; + impact.mDistance = sweepHit.distance; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TC->mOffset); + return true; +} + +static bool SweepBoxUserCapsule(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eUSER_CAPSULE); + const SweptBox* SB = static_cast(volume); + const TouchedUserCapsule* TC = static_cast(geom); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + // To precompute + relocateBox(boxGeom, boxPose, center, SB->mExtents, TC->mOffset, test->mUserParams.mQuatFromUp); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, *TC); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom, boxPose, capsuleGeom, capsulePose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + //TO CHECK: Investigate whether any significant performance improvement can be achieved through + // making the impact point computation optional in the sweep calls and compute it later + /*{ + // ### check this + float t; + PxVec3 p; + float d = gUtilLib->PxSegmentOBBSqrDist(Capsule, Box0.center, Box0.extents, Box0.rot, &t, &p); + Box0.rot.multiply(p,p); + impact.mWorldPos.x = p.x + Box0.center.x + TC->mOffset.x; + impact.mWorldPos.y = p.y + Box0.center.y + TC->mOffset.y; + impact.mWorldPos.z = p.z + Box0.center.z + TC->mOffset.z; + }*/ + { + impact.setWorldPos(sweepHit.position, TC->mOffset); + } + return true; +} + +static bool sweepVolumeVsMesh( const SweepTest* sweepTest, const TouchedMesh* touchedMesh, SweptContact& impact, + const PxVec3& unitDir, const PxGeometry& geom, const PxTransform& pose, + PxU32 nbTris, const PxTriangle* triangles, + PxU32 cachedIndex) +{ + PxGeomSweepHit sweepHit; + if(PxMeshQuery::sweep(unitDir, impact.mDistance, geom, pose, nbTris, triangles, sweepHit, getSweepHitFlags(sweepTest->mUserParams), &cachedIndex)) + { + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.setWorldPos(sweepHit.position, touchedMesh->mOffset); + + // Returned index is only between 0 and nbTris, i.e. it indexes the array of cached triangles, not the original mesh. + PX_ASSERT(sweepHit.faceIndex < nbTris); + sweepTest->mCachedTriIndex[sweepTest->mCachedTriIndexIndex] = sweepHit.faceIndex; + + // The CCT loop will use the index from the start of the cache... + impact.mInternalIndex = sweepHit.faceIndex + touchedMesh->mIndexWorldTriangles; + const PxU32* triangleIndices = &sweepTest->mTriangleIndices[touchedMesh->mIndexWorldTriangles]; + impact.mTriangleIndex = triangleIndices[sweepHit.faceIndex]; + return true; + } + return false; +} + +static bool SweepBoxMesh(const SweepTest* sweep_test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eMESH); + const SweptBox* SB = static_cast(volume); + const TouchedMesh* TM = static_cast(geom); + + PxU32 nbTris = TM->mNbTris; + if(!nbTris) + return false; + + // Fetch triangle data for current mesh (the stream may contain triangles from multiple meshes) + const PxTriangle* T = &sweep_test->mWorldTriangles.getTriangle(TM->mIndexWorldTriangles); + + // PT: this only really works when the CCT collides with a single mesh, but that's the most common case. When it doesn't, there's just no speedup but it still works. + PxU32 CachedIndex = sweep_test->mCachedTriIndex[sweep_test->mCachedTriIndexIndex]; + if(CachedIndex>=nbTris) + CachedIndex=0; + + PxBoxGeometry boxGeom; + boxGeom.halfExtents = SB->mExtents; + PxTransform boxPose(PxVec3(float(center.x - TM->mOffset.x), float(center.y - TM->mOffset.y), float(center.z - TM->mOffset.z)), sweep_test->mUserParams.mQuatFromUp); // Precompute + return sweepVolumeVsMesh(sweep_test, TM, impact, dir, boxGeom, boxPose, nbTris, T, CachedIndex); +} + +static bool SweepCapsuleMesh( + const SweepTest* sweep_test, const SweptVolume* volume, const TouchedGeom* geom, + const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eMESH); + const SweptCapsule* SC = static_cast(volume); + const TouchedMesh* TM = static_cast(geom); + + PxU32 nbTris = TM->mNbTris; + if(!nbTris) + return false; + + // Fetch triangle data for current mesh (the stream may contain triangles from multiple meshes) + const PxTriangle* T = &sweep_test->mWorldTriangles.getTriangle(TM->mIndexWorldTriangles); + + // PT: this only really works when the CCT collides with a single mesh, but that's the most common case. + // When it doesn't, there's just no speedup but it still works. + PxU32 CachedIndex = sweep_test->mCachedTriIndex[sweep_test->mCachedTriIndexIndex]; + if(CachedIndex>=nbTris) + CachedIndex=0; + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, SC, sweep_test->mUserParams.mQuatFromUp, center, TM->mOffset); + + return sweepVolumeVsMesh(sweep_test, TM, impact, dir, capsuleGeom, capsulePose, nbTris, T, CachedIndex); +} + +static bool SweepBoxBox(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eBOX); + const SweptBox* SB = static_cast(volume); + const TouchedBox* TB = static_cast(geom); + + PxBoxGeometry boxGeom0; + PxTransform boxPose0; + // To precompute + relocateBox(boxGeom0, boxPose0, center, SB->mExtents, TB->mOffset, test->mUserParams.mQuatFromUp); + + PxBoxGeometry boxGeom1; + PxTransform boxPose1; + relocateBox(boxGeom1, boxPose1, *TB); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom0, boxPose0, boxGeom1, boxPose1, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mWorldNormal = sweepHit.normal; + impact.mDistance = sweepHit.distance; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TB->mOffset); + return true; +} + +static bool SweepBoxSphere(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eSPHERE); + const SweptBox* SB = static_cast(volume); + const TouchedSphere* TS = static_cast(geom); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + // To precompute + relocateBox(boxGeom, boxPose, center, SB->mExtents, TS->mOffset, test->mUserParams.mQuatFromUp); + + PxSphereGeometry sphereGeom; + sphereGeom.radius = TS->mRadius; + PxTransform spherePose; + spherePose.p = TS->mCenter; + spherePose.q = PxQuat(PxIdentity); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom, boxPose, sphereGeom, spherePose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + //TO CHECK: Investigate whether any significant performance improvement can be achieved through + // making the impact point computation optional in the sweep calls and compute it later + /* + { + // The sweep test doesn't compute the impact point automatically, so we have to do it here. + PxVec3 NewSphereCenter = TS->mSphere.center - d * dir; + PxVec3 Closest; + gUtilLib->PxPointOBBSqrDist(NewSphereCenter, Box0.center, Box0.extents, Box0.rot, &Closest); + // Compute point on the box, after sweep + Box0.rot.multiply(Closest, Closest); + impact.mWorldPos.x = TS->mOffset.x + Closest.x + Box0.center.x + d * dir.x; + impact.mWorldPos.y = TS->mOffset.y + Closest.y + Box0.center.y + d * dir.y; + impact.mWorldPos.z = TS->mOffset.z + Closest.z + Box0.center.z + d * dir.z; + + impact.mWorldNormal = -impact.mWorldNormal; + }*/ + { + impact.setWorldPos(sweepHit.position, TS->mOffset); + } + return true; +} + +static bool SweepBoxCapsule(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eBOX); + PX_ASSERT(geom->mType==TouchedGeomType::eCAPSULE); + const SweptBox* SB = static_cast(volume); + const TouchedCapsule* TC = static_cast(geom); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + // To precompute + relocateBox(boxGeom, boxPose, center, SB->mExtents, TC->mOffset, test->mUserParams.mQuatFromUp); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, TC->mP0, TC->mP1, TC->mRadius); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom, boxPose, capsuleGeom, capsulePose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + //TO CHECK: Investigate whether any significant performance improvement can be achieved through + // making the impact point computation optional in the sweep calls and compute it later + /*{ + float t; + PxVec3 p; + float d = gUtilLib->PxSegmentOBBSqrDist(TC->mCapsule, Box0.center, Box0.extents, Box0.rot, &t, &p); + Box0.rot.multiply(p,p); + impact.mWorldPos.x = p.x + Box0.center.x + TC->mOffset.x; + impact.mWorldPos.y = p.y + Box0.center.y + TC->mOffset.y; + impact.mWorldPos.z = p.z + Box0.center.z + TC->mOffset.z; + }*/ + { + impact.setWorldPos(sweepHit.position, TC->mOffset); + } + return true; +} + +static bool SweepCapsuleBox(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eBOX); + const SweptCapsule* SC = static_cast(volume); + const TouchedBox* TB = static_cast(geom); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, SC, test->mUserParams.mQuatFromUp, center, TB->mOffset); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + // To precompute + relocateBox(boxGeom, boxPose, *TB); + + // The box and capsule coordinates are relative to the center of the cached bounding box + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom, capsulePose, boxGeom, boxPose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + + //TO CHECK: Investigate whether any significant performance improvement can be achieved through + // making the impact point computation optional in the sweep calls and compute it later + /*{ + float t; + PxVec3 p; + float d = gUtilLib->PxSegmentOBBSqrDist(Capsule, TB->mBox.center, TB->mBox.extents, TB->mBox.rot, &t, &p); + TB->mBox.rot.multiply(p,p); + p += TB->mBox.center; + impact.mWorldPos.x = p.x + TB->mOffset.x; + impact.mWorldPos.y = p.y + TB->mOffset.y; + impact.mWorldPos.z = p.z + TB->mOffset.z; + }*/ + { + impact.setWorldPos(sweepHit.position, TB->mOffset); + } + return true; +} + +static bool SweepCapsuleSphere(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eSPHERE); + const SweptCapsule* SC = static_cast(volume); + const TouchedSphere* TS = static_cast(geom); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, SC, test->mUserParams.mQuatFromUp, center, TS->mOffset); + + PxSphereGeometry sphereGeom; + sphereGeom.radius = TS->mRadius; + PxTransform spherePose; + spherePose.p = TS->mCenter; + spherePose.q = PxQuat(PxIdentity); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom, capsulePose, sphereGeom, spherePose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TS->mOffset); + return true; +} + +static bool SweepCapsuleCustom(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType() == SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType == TouchedGeomType::eCUSTOM); + const SweptCapsule* SC = static_cast(volume); + const TouchedCustom* TC = static_cast(geom); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, SC, test->mUserParams.mQuatFromUp, center, TC->mOffset); + + PxCustomGeometry customGeom(*TC->mCustomCallbacks); + PxTransform customPose; + customPose.p = TC->mCenter; + customPose.q = PxQuat(PxIdentity); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom, capsulePose, customGeom, customPose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TC->mOffset); + return true; +} + +static bool SweepBoxCustom(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType() == SweptVolumeType::eBOX); + PX_ASSERT(geom->mType == TouchedGeomType::eCUSTOM); + const SweptBox* SB = static_cast(volume); + const TouchedCustom* TC = static_cast(geom); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + // To precompute + relocateBox(boxGeom, boxPose, center, SB->mExtents, TC->mOffset, test->mUserParams.mQuatFromUp); + + PxCustomGeometry customGeom(*TC->mCustomCallbacks); + PxTransform customPose; + customPose.p = TC->mCenter; + customPose.q = PxQuat(PxIdentity); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, boxGeom, boxPose, customGeom, customPose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TC->mOffset); + return true; +} + +static bool SweepCapsuleCapsule(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eCAPSULE); + const SweptCapsule* SC = static_cast(volume); + const TouchedCapsule* TC = static_cast(geom); + + PxCapsuleGeometry capsuleGeom0; + PxTransform capsulePose0; + relocateCapsule(capsuleGeom0, capsulePose0, SC, test->mUserParams.mQuatFromUp, center, TC->mOffset); + + PxCapsuleGeometry capsuleGeom1; + PxTransform capsulePose1; + relocateCapsule(capsuleGeom1, capsulePose1, TC->mP0, TC->mP1, TC->mRadius); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom0, capsulePose0, capsuleGeom1, capsulePose1, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TC->mOffset); + return true; +} + +static bool SweepCapsuleUserCapsule(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eUSER_CAPSULE); + const SweptCapsule* SC = static_cast(volume); + const TouchedUserCapsule* TC = static_cast(geom); + + PxCapsuleGeometry capsuleGeom0; + PxTransform capsulePose0; + relocateCapsule(capsuleGeom0, capsulePose0, SC, test->mUserParams.mQuatFromUp, center, TC->mOffset); + + PxCapsuleGeometry capsuleGeom1; + PxTransform capsulePose1; + relocateCapsule(capsuleGeom1, capsulePose1, *TC); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom0, capsulePose0, capsuleGeom1, capsulePose1, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.setWorldPos(sweepHit.position, TC->mOffset); + return true; +} + +static bool SweepCapsuleUserBox(const SweepTest* test, const SweptVolume* volume, const TouchedGeom* geom, const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact) +{ + PX_ASSERT(volume->getType()==SweptVolumeType::eCAPSULE); + PX_ASSERT(geom->mType==TouchedGeomType::eUSER_BOX); + const SweptCapsule* SC = static_cast(volume); + const TouchedUserBox* TB = static_cast(geom); + + PxCapsuleGeometry capsuleGeom; + PxTransform capsulePose; + relocateCapsule(capsuleGeom, capsulePose, SC, test->mUserParams.mQuatFromUp, center, TB->mOffset); + + PxBoxGeometry boxGeom; + PxTransform boxPose; + relocateBox(boxGeom, boxPose, *TB); + + PxGeomSweepHit sweepHit; + if(!PxGeometryQuery::sweep(dir, impact.mDistance, capsuleGeom, capsulePose, boxGeom, boxPose, sweepHit, getSweepHitFlags(test->mUserParams))) + return false; + + if(sweepHit.distance >= impact.mDistance) + return false; + + impact.mDistance = sweepHit.distance; + impact.mWorldNormal = sweepHit.normal; + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + + //TO CHECK: Investigate whether any significant performance improvement can be achieved through + // making the impact point computation optional in the sweep calls and compute it later + /*{ + // ### check this + float t; + PxVec3 p; + float d = gUtilLib->PxSegmentOBBSqrDist(Capsule, Box.center, Box.extents, Box.rot, &t, &p); + p += Box.center; + impact.mWorldPos.x = p.x + TB->mOffset.x; + impact.mWorldPos.y = p.y + TB->mOffset.y; + impact.mWorldPos.z = p.z + TB->mOffset.z; + }*/ + { + impact.setWorldPos(sweepHit.position, TB->mOffset); + } + return true; +} + +typedef bool (*SweepFunc) (const SweepTest*, const SweptVolume*, const TouchedGeom*, const PxExtendedVec3&, const PxVec3&, SweptContact&); + +static SweepFunc gSweepMap[SweptVolumeType::eLAST][TouchedGeomType::eLAST] = { + // Box funcs + { + SweepBoxUserBox, + SweepBoxUserCapsule, + SweepBoxMesh, + SweepBoxBox, + SweepBoxSphere, + SweepBoxCapsule, + SweepBoxCustom + }, + + // Capsule funcs + { + SweepCapsuleUserBox, + SweepCapsuleUserCapsule, + SweepCapsuleMesh, + SweepCapsuleBox, + SweepCapsuleSphere, + SweepCapsuleCapsule, + SweepCapsuleCustom + } +}; + +PX_COMPILE_TIME_ASSERT(sizeof(gSweepMap)==SweptVolumeType::eLAST*TouchedGeomType::eLAST*sizeof(SweepFunc)); + +static const PxU32 GeomSizes[] = +{ + sizeof(TouchedUserBox), + sizeof(TouchedUserCapsule), + sizeof(TouchedMesh), + sizeof(TouchedBox), + sizeof(TouchedSphere), + sizeof(TouchedCapsule), + sizeof(TouchedCustom) +}; + +static const TouchedGeom* CollideGeoms( + const SweepTest* sweep_test, const SweptVolume& volume, const IntArray& geom_stream, + const PxExtendedVec3& center, const PxVec3& dir, SweptContact& impact, bool discardInitialOverlap) +{ + impact.mInternalIndex = PX_INVALID_U32; + impact.mTriangleIndex = PX_INVALID_U32; + impact.mGeom = NULL; + + const PxU32* Data = geom_stream.begin(); + const PxU32* Last = geom_stream.end(); + while(Data!=Last) + { + const TouchedGeom* CurrentGeom = reinterpret_cast(Data); + + SweepFunc ST = gSweepMap[volume.getType()][CurrentGeom->mType]; + if(ST) + { + SweptContact C; + C.mDistance = impact.mDistance; // Initialize with current best distance + C.mInternalIndex = PX_INVALID_U32; + C.mTriangleIndex = PX_INVALID_U32; + if((ST)(sweep_test, &volume, CurrentGeom, center, dir, C)) + { + if(C.mDistance==0.0f) + { + if(!discardInitialOverlap) + { + if(CurrentGeom->mType==TouchedGeomType::eUSER_BOX || CurrentGeom->mType==TouchedGeomType::eUSER_CAPSULE) + { + } + else + { + const PxRigidActor* touchedActor = CurrentGeom->mActor; + PX_ASSERT(touchedActor); + + if(shouldApplyRecoveryModule(*touchedActor)) + { + impact = C; + impact.mGeom = const_cast(CurrentGeom); + return CurrentGeom; + } + } + } + } +/* else + if(discardInitialOverlap && C.mDistance==0.0f) + { + // PT: we previously used eINITIAL_OVERLAP without eINITIAL_OVERLAP_KEEP, i.e. initially overlapping shapes got ignored. + // So we replicate this behavior here. + }*/ + else if(C.mDistance(CurrentGeom); + if(C.mDistance <= 0.0f) // there is no point testing for closer hits + return CurrentGeom; // since we are touching a shape already + } + } + } + + const PxU8* ptr = reinterpret_cast(Data); + ptr += GeomSizes[CurrentGeom->mType]; + Data = reinterpret_cast(ptr); + } + return impact.mGeom; +} + +static PxVec3 computeMTD(const SweepTest* sweep_test, const SweptVolume& volume, const IntArray& geom_stream, const PxExtendedVec3& center, float contactOffset) +{ + PxVec3 p = toVec3(center); + +// contactOffset += 0.01f; + + const PxU32 maxIter = 4; + PxU32 nbIter = 0; + bool isValid = true; + while(isValid && nbIter(Data); + + if(CurrentGeom->mType==TouchedGeomType::eUSER_BOX || CurrentGeom->mType==TouchedGeomType::eUSER_CAPSULE) + { + } + else + { + const PxRigidActor* touchedActor = CurrentGeom->mActor; + PX_ASSERT(touchedActor); + + if(shouldApplyRecoveryModule(*touchedActor)) + { + const PxShape* touchedShape = reinterpret_cast(CurrentGeom->mTGUserData); + PX_ASSERT(touchedShape); + + const PxGeometry& touchedGeom = touchedShape->getGeometry(); + const PxTransform globalPose = getShapeGlobalPose(*touchedShape, *touchedActor); + + PxVec3 mtd; + PxF32 depth; + + const PxTransform volumePose(p, sweep_test->mUserParams.mQuatFromUp); + if(volume.getType()==SweptVolumeType::eCAPSULE) + { + const SweptCapsule& sc = static_cast(volume); + const PxCapsuleGeometry capsuleGeom(sc.mRadius+contactOffset, sc.mHeight*0.5f); + isValid = PxGeometryQuery::computePenetration(mtd, depth, capsuleGeom, volumePose, touchedGeom, globalPose); + } + else + { + PX_ASSERT(volume.getType()==SweptVolumeType::eBOX); + const SweptBox& sb = static_cast(volume); + const PxBoxGeometry boxGeom(sb.mExtents+PxVec3(contactOffset)); + isValid = PxGeometryQuery::computePenetration(mtd, depth, boxGeom, volumePose, touchedGeom, globalPose); + } + + if(isValid) + { + nbIter++; + PX_ASSERT(depth>=0.0f); + PX_ASSERT(mtd.isFinite()); + PX_ASSERT(PxIsFinite(depth)); +#ifdef DEBUG_MTD + PX_ASSERT(depth<=1.0f); + if(depth>1.0f || !mtd.isFinite() || !PxIsFinite(depth)) + { + int stop=1; + (void)stop; + } + printf("Depth: %f\n", depth); + printf("mtd: %f %f %f\n", mtd.x, mtd.y, mtd.z); +#endif + p += mtd * depth; + } + } + } + + const PxU8* ptr = reinterpret_cast(Data); + ptr += GeomSizes[CurrentGeom->mType]; + Data = reinterpret_cast(ptr); + } + } + return p; +} + + + +static bool ParseGeomStream(const void* object, const IntArray& geom_stream) +{ + const PxU32* Data = geom_stream.begin(); + const PxU32* Last = geom_stream.end(); + while(Data!=Last) + { + const TouchedGeom* CurrentGeom = reinterpret_cast(Data); + if(CurrentGeom->mTGUserData==object) + return true; + + const PxU8* ptr = reinterpret_cast(Data); + ptr += GeomSizes[CurrentGeom->mType]; + Data = reinterpret_cast(ptr); + } + return false; +} + +CCTParams::CCTParams() : + mNonWalkableMode (PxControllerNonWalkableMode::ePREVENT_CLIMBING), + mQuatFromUp (PxQuat(PxIdentity)), + mUpDirection (PxVec3(0.0f)), + mSlopeLimit (0.0f), + mContactOffset (0.0f), + mStepOffset (0.0f), + mInvisibleWallHeight (0.0f), + mMaxJumpHeight (0.0f), + mMaxEdgeLength2 (0.0f), + mTessellation (false), + mHandleSlope (false), + mOverlapRecovery (false), + mPreciseSweeps (true), + mPreventVerticalSlidingAgainstCeiling (false) +{ +} + +SweepTest::SweepTest(bool registerDeletionListener) : + mRenderBuffer (NULL), + mRenderFlags (0), + mTriangleIndices ("sweepTestTriangleIndices"), + mGeomStream ("sweepTestStream"), + mTouchedShape (registerDeletionListener), + mTouchedActor (registerDeletionListener), + mSQTimeStamp (0xffffffff), + mNbFullUpdates (0), + mNbPartialUpdates (0), + mNbTessellation (0), + mNbIterations (0), + mFlags (0), + mRegisterDeletionListener(registerDeletionListener), + mCctManager (NULL) +{ + mCacheBounds.setEmpty(); + mCachedTriIndexIndex = 0; + mCachedTriIndex[0] = mCachedTriIndex[1] = mCachedTriIndex[2] = 0; + mNbCachedStatic = 0; + mNbCachedT = 0; + + mTouchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; + mTouchedPos = PxVec3(0); + mTouchedPosShape_Local = PxVec3(0); + mTouchedPosShape_World = PxVec3(0); + mTouchedPosObstacle_Local = PxVec3(0); + mTouchedPosObstacle_World = PxVec3(0); + +// mVolumeGrowth = 1.2f; // Must be >1.0f and not too big + mVolumeGrowth = 1.5f; // Must be >1.0f and not too big +// mVolumeGrowth = 2.0f; // Must be >1.0f and not too big + + mContactNormalDownPass = PxVec3(0.0f); + mContactNormalSidePass = PxVec3(0.0f); + mTouchedTriMin = 0.0f; + mTouchedTriMax = 0.0f; +} + + +SweepTest::~SweepTest() +{ + // set the TouchedObject to NULL so we unregister the actor/shape + mTouchedShape = NULL; + mTouchedActor = NULL; +} + +void SweepTest::voidTestCache() +{ + mTouchedShape = NULL; + mTouchedActor = NULL; + mCacheBounds.setEmpty(); + mTouchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; +} + +void SweepTest::onRelease(const PxBase& observed) +{ + if (mTouchedActor == &observed) + { + mTouchedShape = NULL; + mTouchedActor = NULL; + return; + } + + if(ParseGeomStream(&observed, mGeomStream)) + mCacheBounds.setEmpty(); + + if (mTouchedShape == &observed) + mTouchedShape = NULL; +} + +void SweepTest::updateCachedShapesRegistration(PxU32 startIndex, bool unregister) +{ + if(!mRegisterDeletionListener) + return; + + if(!mGeomStream.size() || startIndex == mGeomStream.size()) + return; + + PX_ASSERT(startIndex <= mGeomStream.size()); + + const PxU32* data = &mGeomStream[startIndex]; + const PxU32* last = mGeomStream.end(); + while (data != last) + { + const TouchedGeom* CurrentGeom = reinterpret_cast(data); + if (CurrentGeom->mActor) + { + if(unregister) + mCctManager->unregisterObservedObject(reinterpret_cast(CurrentGeom->mTGUserData)); + else + mCctManager->registerObservedObject(reinterpret_cast(CurrentGeom->mTGUserData)); + } + else + { + // we can early exit, the rest of the data are user obstacles + return; + } + + const PxU8* ptr = reinterpret_cast(data); + ptr += GeomSizes[CurrentGeom->mType]; + data = reinterpret_cast(ptr); + } +} + +void SweepTest::onObstacleAdded(PxObstacleHandle index, const PxObstacleContext* context, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance ) +{ + if(mTouchedObstacleHandle != PX_INVALID_OBSTACLE_HANDLE) + { + // check if new obstacle is closer + const ObstacleContext* obstContext = static_cast (context); + PxGeomRaycastHit obstacleHit; + const PxObstacle* obst = obstContext->raycastSingle(obstacleHit,index,origin,unitDir,distance); + + if(obst && (obstacleHit.position.dot(unitDir))<(mTouchedPosObstacle_World.dot(unitDir))) + { + PX_ASSERT(obstacleHit.distance<=distance); + mTouchedObstacleHandle = index; + if(!gUseLocalSpace) + { + mTouchedPos = toVec3(obst->mPos); + } + else + { + mTouchedPosObstacle_World = obstacleHit.position; + mTouchedPosObstacle_Local = worldToLocal(*obst, PxExtendedVec3(PxExtended(obstacleHit.position.x),PxExtended(obstacleHit.position.y),PxExtended(obstacleHit.position.z))); + } + } + } +} + +void SweepTest::onObstacleRemoved(PxObstacleHandle index) +{ + if(index == mTouchedObstacleHandle) + { + mTouchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; + } +} + +void SweepTest::onObstacleUpdated(PxObstacleHandle index, const PxObstacleContext* context, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance) +{ + if(index == mTouchedObstacleHandle) + { + // check if updated obstacle is still closest + const ObstacleContext* obstContext = static_cast (context); + PxGeomRaycastHit obstacleHit; + PxObstacleHandle closestHandle = PX_INVALID_OBSTACLE_HANDLE; + const PxObstacle* obst = obstContext->raycastSingle(obstacleHit,origin,unitDir,distance,closestHandle); + + if(mTouchedObstacleHandle == closestHandle) + return; + + if(obst) + { + PX_ASSERT(obstacleHit.distance<=distance); + mTouchedObstacleHandle = closestHandle; + if(!gUseLocalSpace) + { + mTouchedPos = toVec3(obst->mPos); + } + else + { + mTouchedPosObstacle_World = obstacleHit.position; + mTouchedPosObstacle_Local = worldToLocal(*obst, PxExtendedVec3(PxExtended(obstacleHit.position.x),PxExtended(obstacleHit.position.y),PxExtended(obstacleHit.position.z))); + } + } + } +} + +void SweepTest::onOriginShift(const PxVec3& shift) +{ + mCacheBounds.minimum -= shift; + mCacheBounds.maximum -= shift; + + if(mTouchedShape) + { + const PxRigidActor* rigidActor = mTouchedActor.get(); + if(rigidActor->getConcreteType() != PxConcreteType::eRIGID_STATIC) + { + mTouchedPosShape_World -= shift; + } + } + else if (mTouchedObstacleHandle != PX_INVALID_OBSTACLE_HANDLE) + { + if(!gUseLocalSpace) + { + mTouchedPos -= shift; + } + else + { + mTouchedPosObstacle_World -= shift; + } + } + + // adjust cache + PxU32* data = mGeomStream.begin(); + PxU32* last = mGeomStream.end(); + while(data != last) + { + TouchedGeom* currentGeom = reinterpret_cast(data); + + currentGeom->mOffset -= shift; + + PxU8* ptr = reinterpret_cast(data); + ptr += GeomSizes[currentGeom->mType]; + data = reinterpret_cast(ptr); + } +} + +static PxBounds3 getBounds3(const PxExtendedBounds3& extended) +{ + return PxBounds3(toVec3(extended.minimum), toVec3(extended.maximum)); // LOSS OF ACCURACY +} + +// PT: finds both touched CCTs and touched user-defined obstacles +void SweepTest::findTouchedObstacles(const UserObstacles& userObstacles, const PxExtendedBounds3& worldBox) +{ + PxExtendedVec3 Origin; // Will be TouchedGeom::mOffset + getCenter(worldBox, Origin); + + { + const PxU32 nbBoxes = userObstacles.mNbBoxes; + const PxExtendedBox* boxes = userObstacles.mBoxes; + const void** boxUserData = userObstacles.mBoxUserData; + + const PxBounds3 singlePrecisionWorldBox = getBounds3(worldBox); + + // Find touched boxes, i.e. other box controllers + for(PxU32 i=0;i(reserveContainerMemory(mGeomStream, sizeof(TouchedUserBox)/sizeof(PxU32))); + UserBox->mType = TouchedGeomType::eUSER_BOX; + UserBox->mTGUserData = boxUserData[i]; + UserBox->mActor = NULL; + UserBox->mOffset = Origin; + UserBox->mBox = boxes[i]; + } + } + + { + // Find touched capsules, i.e. other capsule controllers + const PxU32 nbCapsules = userObstacles.mNbCapsules; + const PxExtendedCapsule* capsules = userObstacles.mCapsules; + const void** capsuleUserData = userObstacles.mCapsuleUserData; + + PxExtendedVec3 Center; + PxVec3 Extents; + getCenter(worldBox, Center); + getExtents(worldBox, Extents); + + for(PxU32 i=0;i worldBox.maximum.x) || (worldBox.minimum.x > capMaxx + PxExtended(r))) continue; + + const PxExtended capMiny = PxMin(capsules[i].p0.y, capsules[i].p1.y); + const PxExtended capMaxy = PxMax(capsules[i].p0.y, capsules[i].p1.y); + if((capMiny - PxExtended(r) > worldBox.maximum.y) || (worldBox.minimum.y > capMaxy + PxExtended(r))) continue; + + const PxExtended capMinz = PxMin(capsules[i].p0.z, capsules[i].p1.z); + const PxExtended capMaxz = PxMax(capsules[i].p0.z, capsules[i].p1.z); + if((capMinz - PxExtended(r) > worldBox.maximum.z) || (worldBox.minimum.z > capMaxz + PxExtended(r))) continue; + + // PT: more accurate capsule-box test. Not strictly necessary but worth doing if available + const PxReal d2 = Gu::distanceSegmentBoxSquared(toVec3(capsules[i].p0), toVec3(capsules[i].p1), toVec3(Center), Extents, PxMat33(PxIdentity)); + if(d2>r*r) + continue; + + TouchedUserCapsule* UserCapsule = reinterpret_cast(reserveContainerMemory(mGeomStream, sizeof(TouchedUserCapsule)/sizeof(PxU32))); + UserCapsule->mType = TouchedGeomType::eUSER_CAPSULE; + UserCapsule->mTGUserData = capsuleUserData[i]; + UserCapsule->mActor = NULL; + UserCapsule->mOffset = Origin; + UserCapsule->mCapsule = capsules[i]; + } + } +} + +void SweepTest::updateTouchedGeoms( const InternalCBData_FindTouchedGeom* userData, const UserObstacles& userObstacles, + const PxExtendedBounds3& worldTemporalBox, const PxControllerFilters& filters, const PxVec3& sideVector) +{ + /* + - if this is the first iteration (new frame) we have to redo the dynamic objects & the CCTs. The static objects can + be cached. + - if this is not, we can cache everything + */ + + // PT: using "worldTemporalBox" instead of "mCacheBounds" seems to produce TTP 6207 +//#define DYNAMIC_BOX worldTemporalBox +#define DYNAMIC_BOX mCacheBounds + + bool newCachedBox = false; + + CCTFilter filter; + filter.mFilterData = filters.mFilterData; + filter.mFilterCallback = filters.mFilterCallback; + filter.mPreFilter = filters.mFilterFlags & PxQueryFlag::ePREFILTER; + filter.mPostFilter = filters.mFilterFlags & PxQueryFlag::ePOSTFILTER; + + // PT: detect changes to the static pruning structure + bool sceneHasChanged = false; + { + const PxU32 currentTimestamp = getSceneTimestamp(userData); + if(currentTimestamp!=mSQTimeStamp) + { + mSQTimeStamp = currentTimestamp; + sceneHasChanged = true; + } + } + + // If the input box is inside the cached box, nothing to do + if(gUsePartialUpdates && !sceneHasChanged && worldTemporalBox.isInside(mCacheBounds)) + { + //printf("CACHEIN%d\n", mFirstUpdate); + if(mFlags & STF_FIRST_UPDATE) + { + mFlags &= ~STF_FIRST_UPDATE; + + // Only redo the dynamic + updateCachedShapesRegistration(mNbCachedStatic, true); + mGeomStream.forceSize_Unsafe(mNbCachedStatic); + mWorldTriangles.forceSize_Unsafe(mNbCachedT); + mTriangleIndices.forceSize_Unsafe(mNbCachedT); + + filter.mStaticShapes = false; + if(filters.mFilterFlags & PxQueryFlag::eDYNAMIC) + filter.mDynamicShapes = true; + findTouchedGeometry(userData, DYNAMIC_BOX, mWorldTriangles, mTriangleIndices, mGeomStream, filter, mUserParams, mNbTessellation); + updateCachedShapesRegistration(mNbCachedStatic, false); + + findTouchedObstacles(userObstacles, DYNAMIC_BOX); + + mNbPartialUpdates++; + } + } + else + { + //printf("CACHEOUTNS=%d\n", mNbCachedStatic); + newCachedBox = true; + + // Cache BV used for the query + mCacheBounds = worldTemporalBox; + + // Grow the volume a bit. The temporal box here doesn't take sliding & collision response into account. + // In bad cases it is possible to eventually touch a portion of space not covered by this volume. Just + // in case, we grow the initial volume slightly. Then, additional tests are performed within the loop + // to make sure the TBV is always correct. There's a tradeoff between the original (artificial) growth + // of the volume, and the number of TBV recomputations performed at runtime... + scale(mCacheBounds, PxVec3(mVolumeGrowth)); +// scale(mCacheBounds, PxVec3(mVolumeGrowth, 1.0f, mVolumeGrowth)); + + if(1 && !sideVector.isZero()) + { + const PxVec3 sn = sideVector.getNormalized(); + float dp0 = PxAbs((worldTemporalBox.maximum - worldTemporalBox.minimum).dot(sn)); + float dp1 = PxAbs((mCacheBounds.maximum - mCacheBounds.minimum).dot(sn)); + dp1 -= dp0; + dp1 *= 0.5f * 0.9f; + const PxVec3 offset = sn * dp1; +// printf("%f %f %f\n", offset.x, offset.y, offset.z); + mCacheBounds.minimum += offset; + mCacheBounds.maximum += offset; + add(mCacheBounds, worldTemporalBox); + PX_ASSERT(worldTemporalBox.isInside(mCacheBounds)); + } + + updateCachedShapesRegistration(0, true); + + // Gather triangles touched by this box. This covers multiple meshes. + mWorldTriangles.clear(); + mTriangleIndices.clear(); + mGeomStream.clear(); +// mWorldTriangles.reset(); +// mTriangleIndices.reset(); +// mGeomStream.reset(); + + mCachedTriIndexIndex = 0; + mCachedTriIndex[0] = mCachedTriIndex[1] = mCachedTriIndex[2] = 0; + + mNbFullUpdates++; + + if(filters.mFilterFlags & PxQueryFlag::eSTATIC) + filter.mStaticShapes = true; + filter.mDynamicShapes = false; + findTouchedGeometry(userData, mCacheBounds, mWorldTriangles, mTriangleIndices, mGeomStream, filter, mUserParams, mNbTessellation); + + mNbCachedStatic = mGeomStream.size(); + mNbCachedT = mWorldTriangles.size(); + PX_ASSERT(mTriangleIndices.size()==mNbCachedT); + + filter.mStaticShapes = false; + if(filters.mFilterFlags & PxQueryFlag::eDYNAMIC) + filter.mDynamicShapes = true; + findTouchedGeometry(userData, DYNAMIC_BOX, mWorldTriangles, mTriangleIndices, mGeomStream, filter, mUserParams, mNbTessellation); + // We can't early exit when no tris are touched since we also have to handle the boxes + updateCachedShapesRegistration(0, false); + + findTouchedObstacles(userObstacles, DYNAMIC_BOX); + + mFlags &= ~STF_FIRST_UPDATE; + //printf("CACHEOUTNSDONE=%d\n", mNbCachedStatic); + } + + if(mRenderBuffer) + { + // PT: worldTemporalBox = temporal BV for this frame + PxRenderOutput out(*mRenderBuffer); + + if(mRenderFlags & PxControllerDebugRenderFlag::eTEMPORAL_BV) + { + out << gTBVDebugColor; + renderOutputDebugBox(out, getBounds3(worldTemporalBox)); + } + + if(mRenderFlags & PxControllerDebugRenderFlag::eCACHED_BV) + { + if(newCachedBox) + out << PxU32(PxDebugColor::eARGB_RED); + else + out << PxU32(PxDebugColor::eARGB_GREEN); + renderOutputDebugBox(out, getBounds3(mCacheBounds)); + } + } +} + +// This is the generic sweep test for all swept volumes, but not character-controller specific +bool SweepTest::doSweepTest(const InternalCBData_FindTouchedGeom* userData, + InternalCBData_OnHit* userHitData, + const UserObstacles& userObstacles, + SweptVolume& swept_volume, + const PxVec3& direction, const PxVec3& sideVector, PxU32 max_iter, PxU32* nb_collisions, + float min_dist, const PxControllerFilters& filters, SweepPass sweepPass, + const PxRigidActor*& touchedActorOut, const PxShape*& touchedShapeOut, PxU64 contextID) +{ + // Early exit when motion is zero. Since the motion is decomposed into several vectors + // and this function is called for each of them, it actually happens quite often. + if(direction.isZero()) + return false; + + PX_PROFILE_ZONE("CharacterController.doSweepTest", contextID); + PX_UNUSED(contextID); + + bool hasMoved = false; + mFlags &= ~(STF_VALIDATE_TRIANGLE_DOWN|STF_TOUCH_OTHER_CCT|STF_TOUCH_OBSTACLE); + touchedShapeOut = NULL; + touchedActorOut = NULL; + mTouchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; + + PxExtendedVec3 currentPosition = swept_volume.mCenter; + PxExtendedVec3 targetOrientation = swept_volume.mCenter; + targetOrientation += direction; + + PxU32 NbCollisions = 0; + while(max_iter--) + { + mNbIterations++; + // Compute current direction + PxVec3 currentDirection = targetOrientation - currentPosition; + + // Make sure the new TBV is still valid + { + // Compute temporal bounding box. We could use a capsule or an OBB instead: + // - the volume would be smaller + // - but the query would be slower + // Overall it's unclear whether it's worth it or not. + // TODO: optimize this part ? + PxExtendedBounds3 temporalBox; + swept_volume.computeTemporalBox(*this, temporalBox, currentPosition, currentDirection); + + // Gather touched geoms + updateTouchedGeoms(userData, userObstacles, temporalBox, filters, sideVector); + } + + const float Length = currentDirection.magnitude(); + if(Length<=min_dist) //Use <= to handle the case where min_dist is zero. + break; + + currentDirection /= Length; + + // From Quake2: "if velocity is against the original velocity, stop dead to avoid tiny occilations in sloping corners" + if((currentDirection.dot(direction)) <= 0.0f) + break; + + // From this point, we're going to update the position at least once + hasMoved = true; + + // Find closest collision + SweptContact C; + C.mDistance = Length + mUserParams.mContactOffset; + + if(!CollideGeoms(this, swept_volume, mGeomStream, currentPosition, currentDirection, C, !mUserParams.mOverlapRecovery)) + { + // no collision found => move to desired position + currentPosition = targetOrientation; + break; + } + + PX_ASSERT(C.mGeom); // If we reach this point, we must have touched a geom + + if(mUserParams.mOverlapRecovery && C.mDistance==0.0f) + { +/* SweptContact C; + C.mDistance = 10.0f; + CollideGeoms(this, swept_volume, mGeomStream, currentPosition, -currentDirection, C, true); + currentPosition -= currentDirection*C.mDistance; + + C.mDistance = 10.0f; + CollideGeoms(this, swept_volume, mGeomStream, currentPosition, currentDirection, C, true); + const float DynSkin = mUserParams.mContactOffset; + if(C.mDistance>DynSkin) + currentPosition += currentDirection*(C.mDistance-DynSkin);*/ + + const PxVec3 mtd = computeMTD(this, swept_volume, mGeomStream, currentPosition, mUserParams.mContactOffset); + + NbCollisions++; + + if(nb_collisions) + *nb_collisions = NbCollisions; + +#ifdef DEBUG_MTD + printf("MTD FIXUP: %f %f %f\n", mtd.x - swept_volume.mCenter.x, mtd.y - swept_volume.mCenter.y, mtd.z - swept_volume.mCenter.z); +#endif + swept_volume.mCenter.x = PxExtended(mtd.x); + swept_volume.mCenter.y = PxExtended(mtd.y); + swept_volume.mCenter.z = PxExtended(mtd.z); + return hasMoved; +// currentPosition.x = mtd.x; +// currentPosition.y = mtd.y; +// currentPosition.z = mtd.z; +// continue; + } + + bool preventVerticalMotion = false; + bool stopSliding = true; + if(C.mGeom->mType==TouchedGeomType::eUSER_BOX || C.mGeom->mType==TouchedGeomType::eUSER_CAPSULE) + { + if(sweepPass!=SWEEP_PASS_SENSOR) + { + // We touched a user object, typically another CCT, but can also be a user-defined obstacle + + // PT: TODO: technically lines marked with (*) shouldn't be here... revisit later + + const PxObstacle* touchedObstacle = NULL; // (*) + PxObstacleHandle touchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; + // if(mValidateCallback) + { + PxInternalCBData_OnHit* internalData = static_cast(userHitData); // (*) + internalData->touchedObstacle = NULL; // (*) + internalData->touchedObstacleHandle = PX_INVALID_OBSTACLE_HANDLE; + const PxU32 behaviorFlags = userHitCallback(userHitData, C, currentDirection, Length); + stopSliding = (behaviorFlags & PxControllerBehaviorFlag::eCCT_SLIDE)==0; // (*) + touchedObstacle = internalData->touchedObstacle; // (*) + touchedObstacleHandle = internalData->touchedObstacleHandle; + } + // printf("INTERNAL: %d\n", int(touchedObstacle)); + + if(sweepPass==SWEEP_PASS_DOWN) + { + // (*) + if(touchedObstacle) + { + mFlags |= STF_TOUCH_OBSTACLE; + + mTouchedObstacleHandle = touchedObstacleHandle; + if(!gUseLocalSpace) + { + mTouchedPos = toVec3(touchedObstacle->mPos); + } + else + { + mTouchedPosObstacle_World = toVec3(C.mWorldPos); + mTouchedPosObstacle_Local = worldToLocal(*touchedObstacle, C.mWorldPos); + } + } + else + { + mFlags |= STF_TOUCH_OTHER_CCT; + } + } + } + } + else + { + const PxShape* touchedShape = reinterpret_cast(C.mGeom->mTGUserData); + PX_ASSERT(touchedShape); + const PxRigidActor* touchedActor = C.mGeom->mActor; + PX_ASSERT(touchedActor); + + // We touched a normal object + if(sweepPass==SWEEP_PASS_DOWN) + { + mFlags &= ~(STF_TOUCH_OTHER_CCT|STF_TOUCH_OBSTACLE); + +#ifdef USE_CONTACT_NORMAL_FOR_SLOPE_TEST + mFlags |= STF_VALIDATE_TRIANGLE_DOWN; + mContactNormalDownPass = C.mWorldNormal; +#else + + // Work out if the shape is attached to a static or dynamic actor. + // The slope limit is currently only considered when walking on static actors. + // It is ignored for shapes attached attached to dynamics and kinematics. + // TODO: 1. should we treat stationary kinematics the same as statics. + // 2. should we treat all kinematics the same as statics. + // 3. should we treat no kinematics the same as statics. + if((touchedActor->getConcreteType() == PxConcreteType::eRIGID_STATIC) && (C.mInternalIndex!=PX_INVALID_U32)) + { + mFlags |= STF_VALIDATE_TRIANGLE_DOWN; + const PxTriangle& touchedTri = mWorldTriangles.getTriangle(C.mInternalIndex); + const PxVec3& upDirection = mUserParams.mUpDirection; + const float dp0 = touchedTri.verts[0].dot(upDirection); + const float dp1 = touchedTri.verts[1].dot(upDirection); + const float dp2 = touchedTri.verts[2].dot(upDirection); + float dpmin = dp0; + dpmin = physx::intrinsics::selectMin(dpmin, dp1); + dpmin = physx::intrinsics::selectMin(dpmin, dp2); + float dpmax = dp0; + dpmax = physx::intrinsics::selectMax(dpmax, dp1); + dpmax = physx::intrinsics::selectMax(dpmax, dp2); + + PxExtendedVec3 cacheCenter; + getCenter(mCacheBounds, cacheCenter); + const float offset = upDirection.dot(toVec3(cacheCenter)); + mTouchedTriMin = dpmin + offset; + mTouchedTriMax = dpmax + offset; + + touchedTri.normal(mContactNormalDownPass); + } +#endif + // Update touched shape in down pass + touchedShapeOut = const_cast(touchedShape); + touchedActorOut = touchedActor; +// mTouchedPos = getShapeGlobalPose(*touchedShape).p; + const PxTransform shapeTransform = getShapeGlobalPose(*touchedShape, *touchedActor); + const PxVec3 worldPos = toVec3(C.mWorldPos); + mTouchedPosShape_World = worldPos; + mTouchedPosShape_Local = shapeTransform.transformInv(worldPos); + } + else if(sweepPass==SWEEP_PASS_SIDE || sweepPass==SWEEP_PASS_SENSOR) + { + if((touchedActor->getConcreteType() == PxConcreteType::eRIGID_STATIC) && (C.mInternalIndex!=PX_INVALID_U32)) + { + mFlags |= STF_VALIDATE_TRIANGLE_SIDE; + const PxTriangle& touchedTri = mWorldTriangles.getTriangle(C.mInternalIndex); + touchedTri.normal(mContactNormalSidePass); +// printf("%f | %f | %f\n", mContactNormalSidePass.x, mContactNormalSidePass.y, mContactNormalSidePass.z); + if(mUserParams.mPreventVerticalSlidingAgainstCeiling && mContactNormalSidePass.dot(mUserParams.mUpDirection)<0.0f) + preventVerticalMotion = true; + } + } + + if(sweepPass!=SWEEP_PASS_SENSOR) +// if(mValidateCallback) + { + const PxU32 behaviorFlags = shapeHitCallback(userHitData, C, currentDirection, Length); + stopSliding = (behaviorFlags & PxControllerBehaviorFlag::eCCT_SLIDE)==0; // (*) + } + } + + if(sweepPass==SWEEP_PASS_DOWN && !stopSliding) + { + // Trying to solve the following problem: + // - by default, the CCT "friction" is infinite, i.e. a CCT will not slide on a slope (this is by design) + // - this produces bad results when a capsule CCT stands on top of another capsule CCT, without sliding. Visually it looks + // like the character is standing on the other character's head, it looks bad. So, here, we would like to let the CCT + // slide away, i.e. we don't want friction. + // So here we simply increase the number of iterations (== let the CCT slide) when the first down collision is with another CCT. + if(!NbCollisions) + max_iter += 9; +// max_iter += 1; + } + + NbCollisions++; +// mContactPointHeight = (float)C.mWorldPos[mUserParams.mUpDirection]; // UBI + mContactPointHeight = toVec3(C.mWorldPos).dot(mUserParams.mUpDirection); // UBI + + const float DynSkin = mUserParams.mContactOffset; + + if(C.mDistance>DynSkin/*+0.01f*/) + currentPosition += currentDirection*(C.mDistance-DynSkin); +// DE6513 +/* else if(sweepPass==SWEEP_PASS_SIDE) + { + // Might be better to do a proper sweep pass here, in the opposite direction + currentPosition += currentDirection*(C.mDistance-DynSkin); + }*/ +//~DE6513 + + PxVec3 WorldNormal = C.mWorldNormal; + if(preventVerticalMotion || ((mFlags & STF_WALK_EXPERIMENT) && (mUserParams.mNonWalkableMode!=PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING))) + { + // Make sure the auto-step doesn't bypass this ! + // PT: cancel out normal compo +// WorldNormal[mUserParams.mUpDirection]=0.0f; +// WorldNormal.normalize(); + PxVec3 normalCompo, tangentCompo; + decomposeVector(normalCompo, tangentCompo, WorldNormal, mUserParams.mUpDirection); + WorldNormal = tangentCompo; + WorldNormal.normalize(); + } + + const float Bump = 0.0f; // ### doesn't work when !=0 because of Quake2 hack! + const float Friction = 1.0f; + collisionResponse(targetOrientation, currentPosition, currentDirection, WorldNormal, Bump, Friction, (mFlags & STF_NORMALIZE_RESPONSE)!=0); + } + + if(nb_collisions) + *nb_collisions = NbCollisions; + + // Final box position that should be reflected in the graphics engine + swept_volume.mCenter = currentPosition; + + // If we didn't move, don't update the box position at all (keeping possible lazy-evaluated structures valid) + return hasMoved; +} + +// ### have a return code to tell if we really moved or not + +// Using swept code & direct position update (no physics engine) +// This function is the generic character controller logic, valid for all swept volumes +PxControllerCollisionFlags SweepTest::moveCharacter( + const InternalCBData_FindTouchedGeom* userData, + InternalCBData_OnHit* userHitData, + SweptVolume& volume, + const PxVec3& direction, + const UserObstacles& userObstacles, + float min_dist, + const PxControllerFilters& filters, + bool constrainedClimbingMode, + bool standingOnMoving, + const PxRigidActor*& touchedActor, + const PxShape*& touchedShape, + PxU64 contextID) +{ + PX_PROFILE_ZONE("CharacterController.moveCharacter", contextID); + PX_UNUSED(contextID); + + bool standingOnMovingUp = standingOnMoving; + + mFlags &= ~STF_HIT_NON_WALKABLE; + PxControllerCollisionFlags CollisionFlags = PxControllerCollisionFlags(0); + const PxU32 maxIter = MAX_ITER; // 1 for "collide and stop" + const PxU32 maxIterSides = maxIter; + const PxU32 maxIterDown = ((mFlags & STF_WALK_EXPERIMENT) && mUserParams.mNonWalkableMode==PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING) ? maxIter : 1; +// const PxU32 maxIterDown = 1; + + // ### this causes the artificial gap on top of chars + float stepOffset = mUserParams.mStepOffset; // Default step offset can be cancelled in some cases. + + // Save initial height + const PxVec3& upDirection = mUserParams.mUpDirection; + const PxExtended originalHeight = volume.mCenter.dot(upDirection); + const PxExtended originalBottomPoint = originalHeight - PxExtended(volume.mHalfHeight); // UBI + + // TEST! Disable auto-step when flying. Not sure this is really useful. +// if(direction[upDirection]>0.0f) + const float dir_dot_up = direction.dot(upDirection); +//printf("%f\n", dir_dot_up); + if(dir_dot_up>0.0f) + { + mFlags |= STF_IS_MOVING_UP; + + // PT: this makes it fail on a platform moving up when jumping + // However if we don't do that a jump when moving up a slope doesn't work anymore! + // Not doing this also creates jittering when a capsule CCT jumps against another capsule CCT + if(!standingOnMovingUp) // PT: if we're standing on something moving up it's safer to do the up motion anyway, even though this won't work well before we add the flag in TA13542 + { +// static int count=0; printf("Cancelling step offset... %d\n", count++); + stepOffset = 0.0f; + } + } + else + { + mFlags &= ~STF_IS_MOVING_UP; + } + + // Decompose motion into 3 independent motions: up, side, down + // - if the motion is purely down (gravity only), the up part is needed to fight accuracy issues. For example if the + // character is already touching the geometry a bit, the down sweep test might have troubles. If we first move it above + // the geometry, the problems disappear. + // - if the motion is lateral (character moving forward under normal gravity) the decomposition provides the autostep feature + // - if the motion is purely up, the down part can be skipped + + PxVec3 UpVector(0.0f, 0.0f, 0.0f); + PxVec3 DownVector(0.0f, 0.0f, 0.0f); + + PxVec3 normal_compo, tangent_compo; + decomposeVector(normal_compo, tangent_compo, direction, upDirection); + +// if(direction[upDirection]<0.0f) + if(dir_dot_up<=0.0f) +// DownVector[upDirection] = direction[upDirection]; + DownVector = normal_compo; + else +// UpVector[upDirection] = direction[upDirection]; + UpVector = normal_compo; + +// PxVec3 SideVector = direction; +// SideVector[upDirection] = 0.0f; + PxVec3 SideVector = tangent_compo; + + // If the side motion is zero, i.e. if the character is not really moving, disable auto-step. + // This is important to prevent the CCT from automatically climbing on small objects that move + // against it. We should climb over those only if there's a valid side motion from the player. + const bool sideVectorIsZero = !standingOnMovingUp && isAlmostZero(SideVector); // We can't use PxVec3::isZero() safely with arbitrary up vectors + // #### however if we do this the up pass is disabled, with bad consequences when the CCT is on a dynamic object!! + // ### this line makes it possible to push other CCTs by jumping on them +// const bool sideVectorIsZero = false; +// printf("sideVectorIsZero: %d\n", sideVectorIsZero); + +// if(!SideVector.isZero()) + if(!sideVectorIsZero) +// UpVector[upDirection] += stepOffset; + UpVector += upDirection*stepOffset; +// printf("stepOffset: %f\n", stepOffset); + + // ==========[ Initial volume query ]=========================== + // PT: the main difference between this initial query and subsequent ones is that we use the + // full direction vector here, not the components along each axis. So there is a good chance + // that this initial query will contain all the motion we need, and thus subsequent queries + // will be skipped. + { + PxExtendedBounds3 temporalBox; + volume.computeTemporalBox(*this, temporalBox, volume.mCenter, direction); + + // Gather touched geoms + updateTouchedGeoms(userData, userObstacles, temporalBox, filters, SideVector); + } + + // ==========[ UP PASS ]=========================== + + mCachedTriIndexIndex = 0; + const bool performUpPass = true; + PxU32 NbCollisions=0; + + PxU32 maxIterUp; + if(mUserParams.mPreventVerticalSlidingAgainstCeiling) + maxIterUp = 1; + else + maxIterUp = isAlmostZero(SideVector) ? maxIter : 1; + + if(performUpPass) + { +// printf("%f | %f | %f\n", UpVector.x, UpVector.y, UpVector.z); + + // Prevent user callback for up motion. This up displacement is artificial, and only needed for auto-stepping. + // If we call the user for this, we might eventually apply upward forces to objects resting on top of us, even + // if we visually don't move. This produces weird-looking motions. +// mValidateCallback = false; + // PT: actually I think the previous comment is wrong. It's not only needed for auto-stepping: when the character + // jumps there's a legit up motion and the lack of callback in that case could need some object can't be pushed + // by the character's 'head' (for example). So I now think it's better to use the callback all the time, and + // let users figure out what to do using the available state (like "isMovingUp", etc). +// mValidateCallback = true; + + // In the walk-experiment we explicitly want to ban any up motions, to avoid characters climbing slopes they shouldn't climb. + // So let's bypass the whole up pass. + if(!(mFlags & STF_WALK_EXPERIMENT)) + { + // ### maxIter here seems to "solve" the V bug + if(doSweepTest(userData, userHitData, userObstacles, volume, UpVector, SideVector, maxIterUp, &NbCollisions, min_dist, filters, SWEEP_PASS_UP, touchedActor, touchedShape, contextID)) + { + if(NbCollisions) + { + CollisionFlags |= PxControllerCollisionFlag::eCOLLISION_UP; + + // Clamp step offset to make sure we don't undo more than what we did + float Delta = float(volume.mCenter.dot(upDirection) - originalHeight); + + if(Delta(volume).mRadius; + + const float sideM = SideVector.magnitude(); + if(sideM originalBottomPoint + PxExtended(stepOffset)) + { + mFlags |= STF_HIT_NON_WALKABLE; + if(!(mFlags & STF_WALK_EXPERIMENT)) + return CollisionFlags; + // printf("Contrained\n"); + } + } + //~constrainedClimbingMode + } + } + } + //printf("AD:%.2f %.2f %.2f NS=%d\n", volume.mCenter.x, volume.mCenter.y, volume.mCenter.z, mNbCachedStatic); +// printf("%d\n", mTouchOtherCCT); + + // TEST: do another down pass if we're on a non-walkable poly + // ### kind of works but still not perfect + // ### could it be because we zero the Y impulse later? + // ### also check clamped response vectors +// if(mUserParams.mHandleSlope && mValidateTriangle && direction[upDirection]<0.0f) +// if(mUserParams.mHandleSlope && !mTouchOtherCCT && !mTouchObstacle && mValidateTriangle && dir_dot_up<0.0f) + if(mUserParams.mHandleSlope && !(mFlags & (STF_TOUCH_OTHER_CCT|STF_TOUCH_OBSTACLE)) && (mFlags & STF_VALIDATE_TRIANGLE_DOWN) && dir_dot_up<=0.0f) + { + PxVec3 Normal; + #ifdef USE_CONTACT_NORMAL_FOR_SLOPE_TEST + Normal = mContactNormalDownPass; + #else + //mTouchedTriangle.normal(Normal); + Normal = mContactNormalDownPass; + #endif + + const float touchedTriHeight = float(PxExtended(mTouchedTriMax) - originalBottomPoint); + +/* if(touchedTriHeight>mUserParams.mStepOffset) + { + if(constrainedClimbingMode && mContactPointHeight > originalBottomPoint + stepOffset) + { + mFlags |= STF_HIT_NON_WALKABLE; + if(!(mFlags & STF_WALK_EXPERIMENT)) + return CollisionFlags; + } + }*/ + + if(touchedTriHeight>mUserParams.mStepOffset && testSlope(Normal, upDirection, mUserParams.mSlopeLimit)) + { + mFlags |= STF_HIT_NON_WALKABLE; + // Early exit if we're going to run this again anyway... + if(!(mFlags & STF_WALK_EXPERIMENT)) + return CollisionFlags; + /* CatchScene()->GetRenderer()->AddLine(mTouchedTriangle.mVerts[0], mTouched.mVerts[1], ARGB_YELLOW); + CatchScene()->GetRenderer()->AddLine(mTouchedTriangle.mVerts[0], mTouched.mVerts[2], ARGB_YELLOW); + CatchScene()->GetRenderer()->AddLine(mTouchedTriangle.mVerts[1], mTouched.mVerts[2], ARGB_YELLOW); + */ + + // ==========[ WALK EXPERIMENT ]=========================== + + mFlags |= STF_NORMALIZE_RESPONSE; + + const PxExtended tmp = volume.mCenter.dot(upDirection); + float Delta = tmp > originalHeight ? float(tmp - originalHeight) : 0.0f; + Delta += fabsf(direction.dot(upDirection)); + float Recover = Delta; + + NbCollisions=0; + const float MD = Recover < min_dist ? Recover/float(maxIter) : min_dist; + + PxVec3 RecoverPoint(0,0,0); + RecoverPoint = -upDirection*Recover; + + // PT: we pass "SWEEP_PASS_UP" for compatibility with previous code, but it's technically wrong (this is a 'down' pass) + if(doSweepTest(userData, userHitData, userObstacles, volume, RecoverPoint, SideVector, maxIter, &NbCollisions, MD, filters, SWEEP_PASS_UP, touchedActor, touchedShape, contextID)) + { + // if(NbCollisions) CollisionFlags |= COLLISION_Y_DOWN; + // PT: why did we do this ? Removed for now. It creates a bug (non registered event) when we land on a steep poly. + // However this might have been needed when we were sliding on those polygons, and we didn't want the land anim to + // start while we were sliding. + // if(NbCollisions) CollisionFlags &= ~PxControllerCollisionFlag::eCOLLISION_DOWN; + } + mFlags &= ~STF_NORMALIZE_RESPONSE; + } + } + } + + return CollisionFlags; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// This is an interface between NX users and the internal character controller module. + +#include "characterkinematic/PxControllerBehavior.h" +#include "PxActor.h" +#include "PxScene.h" + +#include "CctInternalStructs.h" +#include "CctBoxController.h" +#include "CctCapsuleController.h" +#include "CctCharacterControllerManager.h" +#include "CctObstacleContext.h" + +bool Controller::filterTouchedShape(const PxControllerFilters& filters) +{ + if(filters.mFilterCallback && (filters.mFilterFlags & PxQueryFlag::ePREFILTER)) + { + const PxQueryFlags filterFlags = PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER; + const PxQueryFilterData filterData(filters.mFilterData ? *filters.mFilterData : PxFilterData(), filterFlags); + PxHitFlags hitFlags = PxHitFlags(0); + + const PxQueryHitType::Enum retVal = filters.mFilterCallback->preFilter(filterData.data, mCctModule.mTouchedShape.get(), mCctModule.mTouchedActor.get(), hitFlags); + if(retVal != PxQueryHitType::eNONE) + return true; + else + return false; + } + + return true; +} + +void Controller::findTouchedObject(const PxControllerFilters& filters, const PxObstacleContext* obstacleContext, const PxVec3& upDirection) +{ + PX_ASSERT(!mCctModule.mTouchedShape && (mCctModule.mTouchedObstacleHandle == PX_INVALID_OBSTACLE_HANDLE)); + + // PT: the CCT works perfectly on statics without this extra mechanism, so we only raycasts against dynamics. + // The pre-filter callback is used to filter out our own proxy actor shapes. We need to make sure our own filter + // doesn't disturb the user-provided filter(s). + + // PT: for starter, if user doesn't want to collide against dynamics, we can skip the whole thing + if(filters.mFilterFlags & PxQueryFlag::eDYNAMIC) + { + // PT: we use a local class instead of making "Controller" a PxQueryFilterCallback, since it would waste more memory. + // Ideally we'd have a C-style callback and a user-data pointer, instead of being forced to create a class. + class ControllerFilter : public PxQueryFilterCallback + { + public: + virtual PxQueryHitType::Enum preFilter(const PxFilterData& filterData, const PxShape* shape, const PxRigidActor* actor, PxHitFlags& queryFlags) + { + // PT: ignore triggers + if(shape->getFlags() & physx::PxShapeFlag::eTRIGGER_SHAPE) + return PxQueryHitType::eNONE; + + // PT: we want to discard our own internal shapes only + if(mShapeHashSet->contains(const_cast(shape))) + return PxQueryHitType::eNONE; + + // PT: otherwise we revert to the user-callback, if it exists, and if users enabled that call + if(mUserFilterCallback && (mUserFilterFlags & PxQueryFlag::ePREFILTER)) + return mUserFilterCallback->preFilter(filterData, shape, actor, queryFlags); + + return PxQueryHitType::eBLOCK; + } + + virtual PxQueryHitType::Enum postFilter(const PxFilterData& filterData, const PxQueryHit& hit, const PxShape* shape, const PxRigidActor* actor) + { + // PT: we may get called if users have asked for such a callback + if(mUserFilterCallback && (mUserFilterFlags & PxQueryFlag::ePOSTFILTER)) + return mUserFilterCallback->postFilter(filterData, hit, shape, actor); + + PX_ASSERT(0); // PT: otherwise we shouldn't have been called + return PxQueryHitType::eNONE; + } + + PxHashSet* mShapeHashSet; + PxQueryFilterCallback* mUserFilterCallback; + PxQueryFlags mUserFilterFlags; + }; + + ControllerFilter preFilter; + preFilter.mShapeHashSet = &mManager->mCCTShapes; + preFilter.mUserFilterCallback = filters.mFilterCallback; + preFilter.mUserFilterFlags = filters.mFilterFlags; + + // PT: for our own purpose we just want dynamics & pre-filter + PxQueryFlags filterFlags = PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER; + // PT: but we may need the post-filter callback as well if users want it + if(filters.mFilterFlags & PxQueryFlag::ePOSTFILTER) + filterFlags |= PxQueryFlag::ePOSTFILTER; + + PxQueryFilterData filterData(filters.mFilterData ? *filters.mFilterData : PxFilterData(), filterFlags); + + const PxF32 probeLength = getHalfHeightInternal(); // Distance to feet + const PxF32 extra = 0.0f;//probeLength * 0.1f; + + const PxVec3 rayOrigin = toVec3(mPosition); + + PxRaycastBuffer hit; + hit.block.distance = FLT_MAX; + if(mScene->raycast(rayOrigin, -upDirection, probeLength+extra, hit, PxHitFlags(0), filterData, &preFilter)) + { + // copy touching hit to blocking so that the rest of the code works with .block + hit.block = hit.getAnyHit(0); + PX_ASSERT(hit.block.shape); + PX_ASSERT(hit.block.actor); + PX_ASSERT(hit.block.distance<=probeLength+extra); + mCctModule.mTouchedShape = hit.block.shape; + mCctModule.mTouchedActor = hit.block.actor; +// mCctModule.mTouchedPos = getShapeGlobalPose(*hit.shape).p - upDirection*(probeLength-hit.distance); + // PT: we only care about the up delta here + const PxTransform shapeTransform = getShapeGlobalPose(*hit.block.shape, *hit.block.actor); + mCctModule.mTouchedPosShape_World = PxVec3(0) - upDirection*(probeLength-hit.block.distance); + mCctModule.mTouchedPosShape_Local = shapeTransform.transformInv(PxVec3(0)); + + mPreviousSceneTimestamp = mScene->getTimestamp()-1; // PT: just make sure cached timestamp is different + } + + if(obstacleContext) + { + const ObstacleContext* obstacles = static_cast(obstacleContext); + PxGeomRaycastHit obstacleHit; + PxObstacleHandle obstacleHandle; + const PxObstacle* touchedObstacle = obstacles->raycastSingle(obstacleHit, rayOrigin, -upDirection, probeLength+extra, obstacleHandle); +// printf("Touched raycast obstacle: %d\n", int(touchedObstacle)); + if(touchedObstacle && obstacleHit.distancemPos) - upDirection*(probeLength-obstacleHit.distance); + } + else + { + // PT: we only care about the up delta here + mCctModule.mTouchedPosObstacle_World = PxVec3(0) - upDirection*(probeLength-obstacleHit.distance); + mCctModule.mTouchedPosObstacle_Local = worldToLocal(*touchedObstacle, PxExtendedVec3(0,0,0)); + } + } + } + } +} + +bool Controller::rideOnTouchedObject(SweptVolume& volume, const PxVec3& upDirection, PxVec3& disp, const PxObstacleContext* obstacleContext) +{ + PX_ASSERT(mCctModule.mTouchedShape || (mCctModule.mTouchedObstacleHandle != PX_INVALID_OBSTACLE_HANDLE)); + + bool standingOnMoving = false; + + bool canDoUpdate = true; // Always true on obstacles + PxU32 behaviorFlags = 0; // Default on shapes + PxVec3 delta(0); + float timeCoeff = 1.0f; + + if(mCctModule.mTouchedShape) + { + // PT: riding on a shape + + // PT: it is important to skip this stuff for static meshes, + // otherwise accuracy issues create bugs like TA14007. + const PxRigidActor& rigidActor = *mCctModule.mTouchedActor.get(); + if(rigidActor.getConcreteType()!=PxConcreteType::eRIGID_STATIC) + { + // PT: we only do the update when the timestamp has changed, otherwise "delta" will be zero + // even if the underlying shape is moving. + const PxU32 timestamp = mScene->getTimestamp(); +// printf("TimeStamp: %d\n", timestamp); + canDoUpdate = timestamp!=mPreviousSceneTimestamp; + if(canDoUpdate) + { + mPreviousSceneTimestamp = timestamp; + + timeCoeff = computeTimeCoeff(); + + if(mBehaviorCallback) + behaviorFlags = mBehaviorCallback->getBehaviorFlags(*mCctModule.mTouchedShape.get(), *mCctModule.mTouchedActor.get()); + +// delta = getShapeGlobalPose(*mCctModule.mTouchedShape).p - mCctModule.mTouchedPos; + const PxTransform shapeTransform = getShapeGlobalPose(*mCctModule.mTouchedShape.get(), rigidActor); + const PxVec3 posPreviousFrame = mCctModule.mTouchedPosShape_World; + const PxVec3 posCurrentFrame = shapeTransform.transform(mCctModule.mTouchedPosShape_Local); + delta = posCurrentFrame - posPreviousFrame; + } + } + } + else + { + // PT: riding on an obstacle + behaviorFlags = PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; // Default on obstacles + + timeCoeff = computeTimeCoeff(); + + const PxObstacle* touchedObstacle = obstacleContext->getObstacleByHandle(mCctModule.mTouchedObstacleHandle); + PX_ASSERT(touchedObstacle); + + if(mBehaviorCallback) + behaviorFlags = mBehaviorCallback->getBehaviorFlags(*touchedObstacle); + + if(!gUseLocalSpace) + { + delta = toVec3(touchedObstacle->mPos) - mCctModule.mTouchedPos; + } + else + { + PxVec3 posPreviousFrame = mCctModule.mTouchedPosObstacle_World; + PxVec3 posCurrentFrame = localToWorld(*touchedObstacle, mCctModule.mTouchedPosObstacle_Local); + delta = posCurrentFrame - posPreviousFrame; + } + } + + if(canDoUpdate && !(behaviorFlags & PxControllerBehaviorFlag::eCCT_USER_DEFINED_RIDE)) + { + // PT: amazingly enough even isAlmostZero doesn't solve this one. + // Moving on a static mesh sometimes produces delta bigger than 1e-6f! + // This may also explain the drift on some rotating platforms. It looks + // like this delta computation is not very accurate. +// standingOnMoving = !delta.isZero(); + standingOnMoving = !isAlmostZero(delta); + mCachedStandingOnMoving = standingOnMoving; +//printf("%f %f %f\n", delta.x, delta.y, delta.z); + if(standingOnMoving) + { + const float dir_dot_up = delta.dot(upDirection); + const bool deltaMovingUp = dir_dot_up>0.0f; + + PxVec3 deltaUpDisp, deltaSideDisp; + decomposeVector(deltaUpDisp, deltaSideDisp, delta, upDirection); + + if(deltaMovingUp) + { + volume.mCenter.x += PxExtended(deltaUpDisp.x); + volume.mCenter.y += PxExtended(deltaUpDisp.y); + volume.mCenter.z += PxExtended(deltaUpDisp.z); + } + else + { + disp += deltaUpDisp; + } + + if(behaviorFlags & PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT) + disp += deltaSideDisp; + } +// printf("delta in: %f %f %f (%f)\n", delta.x, delta.y, delta.z, 1.0f/timeCoeff); + mDeltaXP = delta * timeCoeff; + } + else + { + standingOnMoving = mCachedStandingOnMoving; + } +// mDelta = delta; + + return standingOnMoving; +} + +PxControllerCollisionFlags Controller::move(SweptVolume& volume, const PxVec3& originalDisp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacleContext, bool constrainedClimbingMode) +{ + const bool lockWrite = mManager->mLockingEnabled; + if(lockWrite) + mWriteLock.lock(); + + mGlobalTime += PxF64(elapsedTime); + + // Init CCT with per-controller settings + PxRenderBuffer* renderBuffer = mManager->mRenderBuffer; + const PxU32 debugRenderFlags = mManager->mDebugRenderingFlags; + mCctModule.mRenderBuffer = renderBuffer; + mCctModule.mRenderFlags = debugRenderFlags; + mCctModule.mUserParams = mUserParams; + mCctModule.mFlags |= STF_FIRST_UPDATE; + mCctModule.mUserParams.mMaxEdgeLength2 = mManager->mMaxEdgeLength * mManager->mMaxEdgeLength; + mCctModule.mUserParams.mTessellation = mManager->mTessellation; + mCctModule.mUserParams.mOverlapRecovery = mManager->mOverlapRecovery; + mCctModule.mUserParams.mPreciseSweeps = mManager->mPreciseSweeps; + mCctModule.mUserParams.mPreventVerticalSlidingAgainstCeiling = mManager->mPreventVerticalSlidingAgainstCeiling; + mCctModule.resetStats(); + + const PxVec3& upDirection = mUserParams.mUpDirection; + + /////////// + + PxVec3 disp = originalDisp + mOverlapRecover; + mOverlapRecover = PxVec3(0.0f); + + bool standingOnMoving = false; // PT: whether the CCT is currently standing on a moving object + //printf("Touched shape: %d\n", int(mCctModule.mTouchedShape)); +//standingOnMoving=true; +// printf("Touched obstacle: %d\n", int(mCctModule.mTouchedObstacle)); + + if(mCctModule.mTouchedActor && mCctModule.mTouchedShape) + { + PxU32 nbShapes = mCctModule.mTouchedActor->getNbShapes(); + bool found = false; + for(PxU32 i=0;igetShapes(&shape, 1, i); + if(mCctModule.mTouchedShape==shape) + { + found = true; + break; + } + } + + if(!found) + { + mCctModule.mTouchedActor = NULL; + mCctModule.mTouchedShape = NULL; + } + else + { + // check if we are still in the same scene + if(mCctModule.mTouchedActor->getScene() != mScene) + { + mCctModule.mTouchedShape = NULL; + mCctModule.mTouchedActor = NULL; + } + else + { + // check if the shape still does have the sq flag + if(!(mCctModule.mTouchedShape->getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE)) + { + mCctModule.mTouchedShape = NULL; + mCctModule.mTouchedActor = NULL; + } + else + { + // invoke the CCT filtering for the shape + if(!filterTouchedShape(filters)) + { + mCctModule.mTouchedShape = NULL; + mCctModule.mTouchedActor = NULL; + } + } + } + } + } + + if(!mCctModule.mTouchedShape && (mCctModule.mTouchedObstacleHandle == PX_INVALID_OBSTACLE_HANDLE)) + findTouchedObject(filters, obstacleContext, upDirection); + + if(mCctModule.mTouchedShape || (mCctModule.mTouchedObstacleHandle != PX_INVALID_OBSTACLE_HANDLE)) + { + standingOnMoving = rideOnTouchedObject(volume, upDirection, disp, obstacleContext); + } + else + { + mCachedStandingOnMoving = false; + mDeltaXP = PxVec3(0.0f); + } +// printf("standingOnMoving: %d\n", standingOnMoving); + + /////////// + PxArray& boxUserData = mManager->mBoxUserData; + PxArray& boxes = mManager->mBoxes; + PxArray& capsuleUserData = mManager->mCapsuleUserData; + PxArray& capsules = mManager->mCapsules; + PX_ASSERT(!boxUserData.size()); + PX_ASSERT(!boxes.size()); + PX_ASSERT(!capsuleUserData.size()); + PX_ASSERT(!capsules.size()); + + { + PX_PROFILE_ZONE("CharacterController.filterCandidateControllers", getContextId()); + + // Experiment - to do better + const PxU32 nbControllers = mManager->getNbControllers(); + Controller** controllers = mManager->getControllers(); + + for(PxU32 i=0;ifilter(*getPxController(), *currentController->getPxController()); + + if(keepController) + { + if(currentController->mType==PxControllerShapeType::eBOX) + { + // PT: TODO: optimize this + BoxController* BC = static_cast(currentController); + PxExtendedBox obb; + BC->getOBB(obb); + + boxes.pushBack(obb); + +#ifdef REMOVED + if(renderBuffer /*&& (debugRenderFlags & PxControllerDebugRenderFlag::eOBSTACLES)*/) + { + RenderOutput out(*renderBuffer); + out << gCCTBoxDebugColor; + + out << PxTransform(toVec3(obb.center), obb.rot); + + out << DebugBox(obb.extents, true); + } +#endif + const size_t code = encodeUserObject(i, USER_OBJECT_CCT); + boxUserData.pushBack(reinterpret_cast(code)); + } + else if(currentController->mType==PxControllerShapeType::eCAPSULE) + { + CapsuleController* CC = static_cast(currentController); + + // PT: TODO: optimize this + PxExtendedCapsule worldCapule; + CC->getCapsule(worldCapule); + capsules.pushBack(worldCapule); + + const size_t code = encodeUserObject(i, USER_OBJECT_CCT); + capsuleUserData.pushBack(reinterpret_cast(code)); + } + else PX_ASSERT(0); + } + } + } + + const ObstacleContext* obstacles = NULL; + if(obstacleContext) + { + obstacles = static_cast(obstacleContext); + + // PT: TODO: optimize this + const PxU32 nbExtraBoxes = obstacles->mBoxObstacles.size(); + for(PxU32 i=0;imBoxObstacles[i].mData; + + PxExtendedBox extraBox; + extraBox.center = userBoxObstacle.mPos; + extraBox.extents = userBoxObstacle.mHalfExtents; + extraBox.rot = userBoxObstacle.mRot; + boxes.pushBack(extraBox); + + const size_t code = encodeUserObject(i, USER_OBJECT_BOX_OBSTACLE); + boxUserData.pushBack(reinterpret_cast(code)); + + if(renderBuffer && (debugRenderFlags & PxControllerDebugRenderFlag::eOBSTACLES)) + { + PxRenderOutput out(*renderBuffer); + out << gObstacleDebugColor; + + out << PxTransform(toVec3(userBoxObstacle.mPos), userBoxObstacle.mRot); + + renderOutputDebugBox(out, PxBounds3(-userBoxObstacle.mHalfExtents, userBoxObstacle.mHalfExtents)); + } + } + + const PxU32 nbExtraCapsules = obstacles->mCapsuleObstacles.size(); + for(PxU32 i=0;imCapsuleObstacles[i].mData; + + PxExtendedCapsule extraCapsule; + const PxVec3 capsuleAxis = userCapsuleObstacle.mRot.getBasisVector0() * userCapsuleObstacle.mHalfHeight; + extraCapsule.p0 = PxExtendedVec3( userCapsuleObstacle.mPos.x - PxExtended(capsuleAxis.x), + userCapsuleObstacle.mPos.y - PxExtended(capsuleAxis.y), + userCapsuleObstacle.mPos.z - PxExtended(capsuleAxis.z)); + extraCapsule.p1 = PxExtendedVec3( userCapsuleObstacle.mPos.x + PxExtended(capsuleAxis.x), + userCapsuleObstacle.mPos.y + PxExtended(capsuleAxis.y), + userCapsuleObstacle.mPos.z + PxExtended(capsuleAxis.z)); + + extraCapsule.radius = userCapsuleObstacle.mRadius; + capsules.pushBack(extraCapsule); + const size_t code = encodeUserObject(i, USER_OBJECT_CAPSULE_OBSTACLE); + capsuleUserData.pushBack(reinterpret_cast(code)); + + if(renderBuffer && (debugRenderFlags & PxControllerDebugRenderFlag::eOBSTACLES)) + { + PxRenderOutput out(*renderBuffer); + out << gObstacleDebugColor; + out.outputCapsule(userCapsuleObstacle.mRadius, userCapsuleObstacle.mHalfHeight, PxTransform(toVec3(userCapsuleObstacle.mPos), userCapsuleObstacle.mRot)); + } + } + } + + + UserObstacles userObstacles; + + const PxU32 nbBoxes = boxes.size(); + userObstacles.mNbBoxes = nbBoxes; + userObstacles.mBoxes = nbBoxes ? boxes.begin() : NULL; + userObstacles.mBoxUserData = nbBoxes ? boxUserData.begin() : NULL; + + const PxU32 nbCapsules = capsules.size(); + userObstacles.mNbCapsules = nbCapsules; + userObstacles.mCapsules = nbCapsules ? capsules.begin() : NULL; + userObstacles.mCapsuleUserData = nbCapsules ? capsuleUserData.begin() : NULL; + + PxInternalCBData_OnHit userHitData; + userHitData.controller = this; + userHitData.obstacles = obstacles; + + /////////// + + PxControllerCollisionFlags collisionFlags = PxControllerCollisionFlags(0); + + PxInternalCBData_FindTouchedGeom findGeomData; + findGeomData.scene = mScene; + findGeomData.renderBuffer = renderBuffer; + findGeomData.cctShapeHashSet = &mManager->mCCTShapes; + + mCctModule.mFlags &= ~STF_WALK_EXPERIMENT; + + // store new touched actor/shape. Then set new actor/shape to avoid register/unregister for same objects + const PxRigidActor* touchedActor = NULL; + const PxShape* touchedShape = NULL; + PxExtendedVec3 Backup = volume.mCenter; + collisionFlags = mCctModule.moveCharacter(&findGeomData, &userHitData, volume, disp, userObstacles, minDist, filters, constrainedClimbingMode, standingOnMoving, touchedActor, touchedShape, getContextId()); + + if(mCctModule.mFlags & STF_HIT_NON_WALKABLE) + { + // A bit slow, but everything else I tried was less convincing... + mCctModule.mFlags |= STF_WALK_EXPERIMENT; + volume.mCenter = Backup; + + PxVec3 xpDisp; + if(mUserParams.mNonWalkableMode==PxControllerNonWalkableMode::ePREVENT_CLIMBING_AND_FORCE_SLIDING) + { + PxVec3 tangent_compo; + decomposeVector(xpDisp, tangent_compo, disp, upDirection); + } + else xpDisp = disp; + + collisionFlags = mCctModule.moveCharacter(&findGeomData, &userHitData, volume, xpDisp, userObstacles, minDist, filters, constrainedClimbingMode, standingOnMoving, touchedActor, touchedShape, getContextId()); + + mCctModule.mFlags &= ~STF_WALK_EXPERIMENT; + } + mCctModule.mTouchedActor = touchedActor; + mCctModule.mTouchedShape = touchedShape; + + mCollisionFlags = collisionFlags; + + // Copy results back + mPosition = volume.mCenter; + + // Update kinematic actor + if(mKineActor) + { + const PxVec3 delta = Backup - volume.mCenter; + const PxF32 deltaM2 = delta.magnitudeSquared(); + if(deltaM2!=0.0f) + { + PxTransform targetPose = mKineActor->getGlobalPose(); + targetPose.p = toVec3(mPosition); + targetPose.q = mUserParams.mQuatFromUp; + mKineActor->setKinematicTarget(targetPose); + } + } + + mManager->resetObstaclesBuffers(); + + if (lockWrite) + mWriteLock.unlock(); + + return collisionFlags; +} + + +PxControllerCollisionFlags BoxController::move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles) +{ + PX_PROFILE_ZONE("CharacterController.move", getContextId()); + + PX_SIMD_GUARD; + + // Create internal swept box + SweptBox sweptBox; + sweptBox.mCenter = mPosition; + sweptBox.mExtents = PxVec3(mHalfHeight, mHalfSideExtent, mHalfForwardExtent); + sweptBox.mHalfHeight = mHalfHeight; // UBI + return Controller::move(sweptBox, disp, minDist, elapsedTime, filters, obstacles, false); +} + +PxControllerCollisionFlags CapsuleController::move(const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles) +{ + PX_PROFILE_ZONE("CharacterController.move", getContextId()); + + PX_SIMD_GUARD; + + // Create internal swept capsule + SweptCapsule sweptCapsule; + sweptCapsule.mCenter = mPosition; + sweptCapsule.mRadius = mRadius; + sweptCapsule.mHeight = mHeight; + sweptCapsule.mHalfHeight = mHeight*0.5f + mRadius; // UBI + return Controller::move(sweptCapsule, disp, minDist, elapsedTime, filters, obstacles, mClimbingMode==PxCapsuleClimbingMode::eCONSTRAINED); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.h new file mode 100644 index 0000000..4f4e0d8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterController.h @@ -0,0 +1,475 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_CHARACTER_CONTROLLER +#define CCT_CHARACTER_CONTROLLER + +//#define USE_CONTACT_NORMAL_FOR_SLOPE_TEST + +#include "geometry/PxTriangle.h" +#include "foundation/PxHashSet.h" +#include "characterkinematic/PxController.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "CctCharacterControllerManager.h" +#include "CctUtils.h" +#include "foundation/PxArray.h" + +namespace physx +{ + +struct PxFilterData; +class PxQueryFilterCallback; +class PxObstacle; +class RenderBuffer; + +namespace Cct +{ + struct CCTParams + { + CCTParams(); + + PxControllerNonWalkableMode::Enum mNonWalkableMode; + PxQuat mQuatFromUp; + PxVec3 mUpDirection; + PxF32 mSlopeLimit; + PxF32 mContactOffset; + PxF32 mStepOffset; + PxF32 mInvisibleWallHeight; + PxF32 mMaxJumpHeight; + PxF32 mMaxEdgeLength2; + bool mTessellation; + bool mHandleSlope; // True to handle walkable parts according to slope + bool mOverlapRecovery; + bool mPreciseSweeps; + bool mPreventVerticalSlidingAgainstCeiling; + }; + +// typedef PxArray TriArray; + typedef PxArray IntArray; + + // PT: using private inheritance to control access, and make sure allocations are SIMD friendly + class TriArray : private PxArray + { + public: + + PX_FORCE_INLINE PxTriangle* reserve(PxU32 nbTris) + { + // PT: customized version of "reserveContainerMemory" + + const PxU32 maxNbEntries = PxArray::capacity(); + const PxU32 realRequiredSize = PxArray::size() + nbTris; + // PT: allocate one more tri to make sure we can safely V4Load the last one... + const PxU32 requiredSize = realRequiredSize + 1; + + if(requiredSize>maxNbEntries) + { + // PT: ok so the commented out growing policy was introduced by PX-837 but it produces + // large memory usage regressions (see PX-881) while not actually making things run + // faster. Our benchmarks show no performance difference, but up to +38% more memory + // used with this "standard" growing policy. So for now we just go back to the initial + // growing policy. It should be fine since PX-837 was not actually reported by a customer, + // it was just a concern that appeared while looking at the code. Ideally we'd use a pool + // with fixed-size slabs to get the best of both worlds but it would make iterating over + // triangles more complicated and would need more refactoring. So for now we don't bother, + // but we'll keep this note here for the next time this problem shows up. + // PT: new August 2018: turns out PX-837 was correct. Not doing this produces very large + // performance problems (like: the app freezes!) in SampleCCT. We didn't see it because + // it's an internal sample that it rarely used these days... + const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2; + const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize); +// const PxU32 newSize = requiredSize; + + PxArray::reserve(newSize); + } + + PxTriangle* buf = PxArray::end(); + // ...but we still want the size to reflect the correct number + PxArray::forceSize_Unsafe(realRequiredSize); + return buf; + } + + PX_FORCE_INLINE void pushBack(const PxTriangle& tri) + { + PxTriangle* memory = reserve(1); + memory->verts[0] = tri.verts[0]; + memory->verts[1] = tri.verts[1]; + memory->verts[2] = tri.verts[2]; + } + + PX_FORCE_INLINE PxU32 size() const + { + return PxArray::size(); + } + + PX_FORCE_INLINE const PxTriangle* begin() const + { + return PxArray::begin(); + } + + PX_FORCE_INLINE void clear() + { + PxArray::clear(); + } + + PX_FORCE_INLINE void forceSize_Unsafe(PxU32 size) + { + PxArray::forceSize_Unsafe(size); + } + + PX_FORCE_INLINE const PxTriangle& getTriangle(PxU32 index) const + { + return (*this)[index]; + } + + }; + + /* Exclude from documentation */ + /** \cond */ + + struct TouchedGeomType + { + enum Enum + { + eUSER_BOX, + eUSER_CAPSULE, + eMESH, + eBOX, + eSPHERE, + eCAPSULE, + eCUSTOM, + + eLAST, + + eFORCE_DWORD = 0x7fffffff + }; + }; + + class SweptVolume; + + struct TouchedGeom + { + TouchedGeomType::Enum mType; + const void* mTGUserData; // PxController or PxShape pointer + const PxRigidActor* mActor; // PxActor for PxShape pointers (mandatory with shared shapes) + PxExtendedVec3 mOffset; // Local origin, typically the center of the world bounds around the character. We translate both + // touched shapes & the character so that they are nearby this PxVec3, then add the offset back to + // computed "world" impacts. + protected: + ~TouchedGeom(){} + }; + + struct TouchedUserBox : public TouchedGeom + { + PxExtendedBox mBox; + }; + PX_COMPILE_TIME_ASSERT(sizeof(TouchedUserBox)==sizeof(TouchedGeom)+sizeof(PxExtendedBox)); + + struct TouchedUserCapsule : public TouchedGeom + { + PxExtendedCapsule mCapsule; + }; + PX_COMPILE_TIME_ASSERT(sizeof(TouchedUserCapsule)==sizeof(TouchedGeom)+sizeof(PxExtendedCapsule)); + + struct TouchedMesh : public TouchedGeom + { + PxU32 mNbTris; + PxU32 mIndexWorldTriangles; + }; + + struct TouchedBox : public TouchedGeom + { + PxVec3 mCenter; + PxVec3 mExtents; + PxQuat mRot; + }; + + struct TouchedSphere : public TouchedGeom + { + PxVec3 mCenter; //!< Sphere's center + PxF32 mRadius; //!< Sphere's radius + }; + + struct TouchedCustom : public TouchedGeom + { + PxVec3 mCenter; //!< Custom geometry's center + PxCustomGeometryCallbacks* mCustomCallbacks; //!< Custom geometry's callback object + }; + + struct TouchedCapsule : public TouchedGeom + { + PxVec3 mP0; //!< Start of segment + PxVec3 mP1; //!< End of segment + PxF32 mRadius; //!< Capsule's radius + }; + + struct SweptContact + { + PxExtendedVec3 mWorldPos; // Contact position in world space + PxVec3 mWorldNormal; // Contact normal in world space + PxF32 mDistance; // Contact distance + PxU32 mInternalIndex; // Reserved for internal usage + PxU32 mTriangleIndex; // Triangle index for meshes/heightfields + TouchedGeom* mGeom; + + PX_FORCE_INLINE void setWorldPos(const PxVec3& localImpact, const PxExtendedVec3& offset) + { + mWorldPos.x = PxExtended(localImpact.x) + offset.x; + mWorldPos.y = PxExtended(localImpact.y) + offset.y; + mWorldPos.z = PxExtended(localImpact.z) + offset.z; + } + }; + + // PT: user-defined obstacles. Note that "user" is from the SweepTest class' point of view, + // i.e. the PhysX CCT module is the user in this case. This is to limit coupling between the + // core CCT module and the PhysX classes. + struct UserObstacles// : PxObstacleContext + { + PxU32 mNbBoxes; + const PxExtendedBox* mBoxes; + const void** mBoxUserData; + + PxU32 mNbCapsules; + const PxExtendedCapsule* mCapsules; + const void** mCapsuleUserData; + }; + + struct InternalCBData_OnHit{}; + struct InternalCBData_FindTouchedGeom{}; + + enum SweepTestFlag + { + STF_HIT_NON_WALKABLE = (1<<0), + STF_WALK_EXPERIMENT = (1<<1), + STF_VALIDATE_TRIANGLE_DOWN = (1<<2), // Validate touched triangle data (down pass) + STF_VALIDATE_TRIANGLE_SIDE = (1<<3), // Validate touched triangle data (side pass) + STF_TOUCH_OTHER_CCT = (1<<4), // Are we standing on another CCT or not? (only updated for down pass) + STF_TOUCH_OBSTACLE = (1<<5), // Are we standing on an obstacle or not? (only updated for down pass) + STF_NORMALIZE_RESPONSE = (1<<6), + STF_FIRST_UPDATE = (1<<7), + STF_IS_MOVING_UP = (1<<8) + }; + + enum SweepPass + { + SWEEP_PASS_UP, + SWEEP_PASS_SIDE, + SWEEP_PASS_DOWN, + SWEEP_PASS_SENSOR + }; + + class Controller; + + template + struct TouchedObject + { + TouchedObject(bool regDl) + : mTouchedObject(NULL), mRegisterDeletionListener(regDl), mCctManager(NULL) + { + } + + PX_FORCE_INLINE const T* operator->() const { return mTouchedObject; } + PX_FORCE_INLINE bool operator==(const TouchedObject& otherObject) { return mTouchedObject == otherObject.mTouchedObject; } + PX_FORCE_INLINE bool operator==(const T* otherObject) { return mTouchedObject == otherObject; } + PX_FORCE_INLINE bool operator==(const PxBase* otherObject) { return mTouchedObject == otherObject; } + PX_FORCE_INLINE operator bool() const { return mTouchedObject != NULL; } + PX_FORCE_INLINE TouchedObject& operator=(const T* assignedObject) + { + if(mRegisterDeletionListener && (mTouchedObject != assignedObject)) + { + if(mTouchedObject) + mCctManager->unregisterObservedObject(mTouchedObject); + + if(assignedObject) + mCctManager->registerObservedObject(assignedObject); + } + mTouchedObject = assignedObject; + return *this; + } + + const T* get() const { return mTouchedObject; } + + void setCctManager(CharacterControllerManager* cm) { mCctManager = cm; } + + private: + TouchedObject& operator=(const TouchedObject&); + + const T* mTouchedObject; + bool mRegisterDeletionListener; + CharacterControllerManager* mCctManager; + }; + + class SweepTest + { + public: + SweepTest(bool registerDeletionListener); + ~SweepTest(); + + PxControllerCollisionFlags moveCharacter( const InternalCBData_FindTouchedGeom* userData, + InternalCBData_OnHit* user_data2, + SweptVolume& volume, + const PxVec3& direction, + const UserObstacles& userObstacles, + PxF32 min_dist, + const PxControllerFilters& filters, + bool constrainedClimbingMode, + bool standingOnMoving, + const PxRigidActor*& touchedActor, + const PxShape*& touchedShape, + PxU64 contextID); + + bool doSweepTest(const InternalCBData_FindTouchedGeom* userDataTouchedGeom, + InternalCBData_OnHit* userDataOnHit, + const UserObstacles& userObstacles, + SweptVolume& swept_volume, + const PxVec3& direction, const PxVec3& sideVector, PxU32 max_iter, + PxU32* nb_collisions, PxF32 min_dist, const PxControllerFilters& filters, SweepPass sweepPass, + const PxRigidActor*& touchedActor, const PxShape*& touchedShape, PxU64 contextID); + + void findTouchedObstacles(const UserObstacles& userObstacles, const PxExtendedBounds3& world_box); + + void voidTestCache(); + void onRelease(const PxBase& observed); + void updateCachedShapesRegistration(PxU32 startIndex, bool unregister); + + // observer notifications + void onObstacleRemoved(PxObstacleHandle index); + void onObstacleUpdated(PxObstacleHandle index, const PxObstacleContext* context, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance); + void onObstacleAdded(PxObstacleHandle index, const PxObstacleContext* context, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance); + + void onOriginShift(const PxVec3& shift); + + PxRenderBuffer* mRenderBuffer; + PxU32 mRenderFlags; + TriArray mWorldTriangles; + IntArray mTriangleIndices; + IntArray mGeomStream; + PxExtendedBounds3 mCacheBounds; + PxU32 mCachedTriIndexIndex; + mutable PxU32 mCachedTriIndex[3]; + PxU32 mNbCachedStatic; + PxU32 mNbCachedT; + public: +#ifdef USE_CONTACT_NORMAL_FOR_SLOPE_TEST + PxVec3 mContactNormalDownPass; +#else + PxVec3 mContactNormalDownPass; + PxVec3 mContactNormalSidePass; + float mTouchedTriMin; + float mTouchedTriMax; + //PxTriangle mTouchedTriangle; +#endif + // + TouchedObject mTouchedShape; // Shape on which the CCT is standing + TouchedObject mTouchedActor; // Actor from touched shape + PxObstacleHandle mTouchedObstacleHandle; // Obstacle on which the CCT is standing + PxVec3 mTouchedPos; // Last known position of mTouchedShape/mTouchedObstacle + // PT: TODO: union those + PxVec3 mTouchedPosShape_Local; + PxVec3 mTouchedPosShape_World; + PxVec3 mTouchedPosObstacle_Local; + PxVec3 mTouchedPosObstacle_World; + // + CCTParams mUserParams; + PxF32 mVolumeGrowth; // Must be >1.0f and not too big + PxF32 mContactPointHeight; // UBI + PxU32 mSQTimeStamp; + PxU16 mNbFullUpdates; + PxU16 mNbPartialUpdates; + PxU16 mNbTessellation; + PxU16 mNbIterations; + PxU32 mFlags; + bool mRegisterDeletionListener; + + PX_FORCE_INLINE void resetStats() + { + mNbFullUpdates = 0; + mNbPartialUpdates = 0; + mNbTessellation = 0; + mNbIterations = 0; + } + + void setCctManager(CharacterControllerManager* cm) + { + mCctManager = cm; + mTouchedActor.setCctManager(cm); + mTouchedShape.setCctManager(cm); + } + + private: + void updateTouchedGeoms( const InternalCBData_FindTouchedGeom* userData, const UserObstacles& userObstacles, + const PxExtendedBounds3& worldBox, const PxControllerFilters& filters, const PxVec3& sideVector); + + CharacterControllerManager* mCctManager; + SweepTest(const SweepTest&); + SweepTest& operator=(const SweepTest& ); + }; + + class CCTFilter // PT: internal filter data, could be replaced with PxControllerFilters eventually + { + public: + PX_FORCE_INLINE CCTFilter() : + mFilterData (NULL), + mFilterCallback (NULL), + mStaticShapes (false), + mDynamicShapes (false), + mPreFilter (false), + mPostFilter (false), + mCCTShapes (NULL) + { + } + const PxFilterData* mFilterData; + PxQueryFilterCallback* mFilterCallback; + bool mStaticShapes; + bool mDynamicShapes; + bool mPreFilter; + bool mPostFilter; + PxHashSet* mCCTShapes; + }; + + PxU32 getSceneTimestamp(const InternalCBData_FindTouchedGeom* userData); + + void findTouchedGeometry(const InternalCBData_FindTouchedGeom* userData, + const PxExtendedBounds3& world_aabb, + + TriArray& world_triangles, + IntArray& triIndicesArray, + IntArray& geomStream, + + const CCTFilter& filter, + const CCTParams& params, + PxU16& nbTessellation); + + PxU32 shapeHitCallback(const InternalCBData_OnHit* userData, const SweptContact& contact, const PxVec3& dir, PxF32 length); + PxU32 userHitCallback(const InternalCBData_OnHit* userData, const SweptContact& contact, const PxVec3& dir, PxF32 length); + +} // namespace Cct + +} + +/** \endcond */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp new file mode 100644 index 0000000..6e2eef6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerCallbacks.cpp @@ -0,0 +1,1126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxMeshQuery.h" +#include "common/PxRenderBuffer.h" +#include "common/PxRenderOutput.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxAlloca.h" +#include "extensions/PxTriangleMeshExt.h" +#include "PxScene.h" +#include "CctInternalStructs.h" +#include "GuIntersectionTriangleBox.h" +#include "CmUtils.h" + +static const bool gVisualizeTouchedTris = false; +static const float gDebugVisOffset = 0.01f; + +using namespace physx; +using namespace Cct; +using namespace Gu; +using namespace Cm; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +// PT: HINT: disable gUsePartialUpdates for easier visualization +static void visualizeTouchedTriangles(PxU32 nbTrisToRender, PxU32 startIndex, const PxTriangle* triangles, PxRenderBuffer* renderBuffer, const PxVec3& offset, const PxVec3& upDirection) +{ + if(!renderBuffer) + return; + + PxVec3 yy = -offset; + yy += upDirection * gDebugVisOffset; // PT: move slightly in the up direction + + for(PxU32 i=0; inbTessellation++; + + // PT: this one is safe, v0/v1/v2 can always be V4Loaded + if(!intersectTriangleBox_Unsafe(tp->cullingBoxCenter, tp->cullingBoxExtents, v0, v1, v2)) + return; + + PxU32 code; + { + const PxVec3 edge0 = v0 - v1; + const PxVec3 edge1 = v1 - v2; + const PxVec3 edge2 = v2 - v0; + const float maxEdgeLength2 = tp->maxEdgeLength2; + const bool split0 = edge0.magnitudeSquared()>maxEdgeLength2; + const bool split1 = edge1.magnitudeSquared()>maxEdgeLength2; + const bool split2 = edge2.magnitudeSquared()>maxEdgeLength2; + code = (PxU32(split2)<<2)|(PxU32(split1)<<1)|PxU32(split0); + } + + // PT: using PxVec3p to make sure we can safely V4LoadU these vertices + const PxVec3p m0 = (v0 + v1)*0.5f; + const PxVec3p m1 = (v1 + v2)*0.5f; + const PxVec3p m2 = (v2 + v0)*0.5f; + + switch(code) + { + case 0: // 000: no split + { + tp->worldTriangles->pushBack(PxTriangle(v0, v1, v2)); + tp->triIndicesArray->pushBack(tp->index); + tp->nbNewTris++; + } + break; + case 1: // 001: split edge0 + { + tessellateTriangleRecursive(tp, v0, m0, v2); + tessellateTriangleRecursive(tp, m0, v1, v2); + } + break; + case 2: // 010: split edge1 + { + tessellateTriangleRecursive(tp, v0, v1, m1); + tessellateTriangleRecursive(tp, v0, m1, v2); + } + break; + case 3: // 011: split edge0/edge1 + { + tessellateTriangleRecursive(tp, v0, m0, m1); + tessellateTriangleRecursive(tp, v0, m1, v2); + tessellateTriangleRecursive(tp, m0, v1, m1); + } + break; + case 4: // 100: split edge2 + { + tessellateTriangleRecursive(tp, v0, v1, m2); + tessellateTriangleRecursive(tp, v1, v2, m2); + } + break; + case 5: // 101: split edge0/edge2 + { + tessellateTriangleRecursive(tp, v0, m0, m2); + tessellateTriangleRecursive(tp, m0, v1, m2); + tessellateTriangleRecursive(tp, m2, v1, v2); + } + break; + case 6: // 110: split edge1/edge2 + { + tessellateTriangleRecursive(tp, v0, v1, m1); + tessellateTriangleRecursive(tp, v0, m1, m2); + tessellateTriangleRecursive(tp, m2, m1, v2); + } + break; + case 7: // 111: split edge0/edge1/edge2 + { + tessellateTriangleRecursive(tp, v0, m0, m2); + tessellateTriangleRecursive(tp, m0, v1, m1); + tessellateTriangleRecursive(tp, m2, m1, v2); + tessellateTriangleRecursive(tp, m0, m1, m2); + } + break; + }; +} + +static void tessellateTriangle(PxU32& nbNewTris, const PxTrianglePadded& tr, PxU32 index, TriArray& worldTriangles, IntArray& triIndicesArray, const PxBounds3& cullingBox, const CCTParams& params, PxU16& nbTessellation) +{ + TessParams tp; + tp.nbNewTris = 0; + tp.index = index; + tp.worldTriangles = &worldTriangles; + tp.triIndicesArray = &triIndicesArray; + tp.cullingBoxCenter = cullingBox.getCenter(); + tp.cullingBoxExtents = cullingBox.getExtents(); + tp.maxEdgeLength2 = params.mMaxEdgeLength2; + tp.nbTessellation = 0; + tessellateTriangleRecursive(&tp, tr.verts[0], tr.verts[1], tr.verts[2]); + + nbNewTris += tp.nbNewTris; + nbTessellation += tp.nbTessellation; +// nbTessellation += PxU16(tp.nbNewTris); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputPlaneToStream(PxShape* planeShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, TriArray& worldTriangles, IntArray& triIndicesArray, + const PxExtendedVec3& origin, const PxBounds3& tmpBounds, const CCTParams& params, PxRenderBuffer* renderBuffer) +{ + PX_ASSERT(planeShape->getGeometryType() == PxGeometryType::ePLANE); + + const PxF32 length = (tmpBounds.maximum - tmpBounds.minimum).magnitude(); + PxVec3 center = toVec3(origin); + + const PxPlane plane = PxPlaneEquationFromTransform(globalPose); + + PxVec3 right, up; + PxComputeBasisVectors(plane.n, right, up); + right *= length; + up *= length; + + const PxVec3 p = plane.project(center); + const PxVec3 p0 = p - right + up; + const PxVec3 p1 = p - right - up; + const PxVec3 p2 = p + right - up; + const PxVec3 p3 = p + right + up; + + const PxU32 nbTouchedTris = 2; + + const PxVec3 offset(float(-origin.x), float(-origin.y), float(-origin.z)); + + TouchedMesh* touchedMesh = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedMesh)/sizeof(PxU32))); + touchedMesh->mType = TouchedGeomType::eMESH; + touchedMesh->mTGUserData = planeShape; + touchedMesh->mActor = actor; + touchedMesh->mOffset = origin; + touchedMesh->mNbTris = nbTouchedTris; + touchedMesh->mIndexWorldTriangles = worldTriangles.size(); + + // Reserve memory for incoming triangles + PxTriangle* TouchedTriangles = worldTriangles.reserve(nbTouchedTris); + + triIndicesArray.pushBack(0); + triIndicesArray.pushBack(1); + + TouchedTriangles[0].verts[0] = p0 + offset; + TouchedTriangles[0].verts[1] = p1 + offset; + TouchedTriangles[0].verts[2] = p2 + offset; + + TouchedTriangles[1].verts[0] = p0 + offset; + TouchedTriangles[1].verts[1] = p2 + offset; + TouchedTriangles[1].verts[2] = p3 + offset; + + if(gVisualizeTouchedTris) + visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection); +} + +static void outputSphereToStream(PxShape* sphereShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, const PxExtendedVec3& origin) +{ + PX_ASSERT(sphereShape->getGeometryType() == PxGeometryType::eSPHERE); + PxExtendedSphere WorldSphere; + { + PxSphereGeometry sg; + sphereShape->getSphereGeometry(sg); + + WorldSphere.radius = sg.radius; + WorldSphere.center.x = PxExtended(globalPose.p.x); + WorldSphere.center.y = PxExtended(globalPose.p.y); + WorldSphere.center.z = PxExtended(globalPose.p.z); + } + + TouchedSphere* PX_RESTRICT touchedSphere = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedSphere)/sizeof(PxU32))); + touchedSphere->mType = TouchedGeomType::eSPHERE; + touchedSphere->mTGUserData = sphereShape; + touchedSphere->mActor = actor; + touchedSphere->mOffset = origin; + touchedSphere->mRadius = WorldSphere.radius; + touchedSphere->mCenter.x = float(WorldSphere.center.x - origin.x); + touchedSphere->mCenter.y = float(WorldSphere.center.y - origin.y); + touchedSphere->mCenter.z = float(WorldSphere.center.z - origin.z); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputCustomToStream(PxShape* customShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, const PxExtendedVec3& origin) +{ + PX_ASSERT_WITH_MESSAGE(static_cast(customShape->getGeometry()).isValid(), "Character controller touched invalid PxGeometryType::eCUSTOM"); + + TouchedCustom* PX_RESTRICT touchedCustom = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedCustom) / sizeof(PxU32))); + touchedCustom->mType = TouchedGeomType::eCUSTOM; + touchedCustom->mTGUserData = customShape; + touchedCustom->mActor = actor; + touchedCustom->mOffset = origin; + touchedCustom->mCustomCallbacks = static_cast(customShape->getGeometry()).callbacks; + touchedCustom->mCenter.x = static_cast(PxExtended(globalPose.p.x) - origin.x); + touchedCustom->mCenter.y = static_cast(PxExtended(globalPose.p.y) - origin.y); + touchedCustom->mCenter.z = static_cast(PxExtended(globalPose.p.z) - origin.z); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputCapsuleToStream(PxShape* capsuleShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, const PxExtendedVec3& origin) +{ + PX_ASSERT(capsuleShape->getGeometryType() == PxGeometryType::eCAPSULE); + PxExtendedCapsule WorldCapsule; + { + PxCapsuleGeometry cg; + capsuleShape->getCapsuleGeometry(cg); + + PxVec3 p0 = cg.halfHeight * globalPose.q.getBasisVector0(); + PxVec3 p1 = -p0; + p0 += globalPose.p; + p1 += globalPose.p; + + WorldCapsule.radius = cg.radius; + WorldCapsule.p0.x = PxExtended(p0.x); + WorldCapsule.p0.y = PxExtended(p0.y); + WorldCapsule.p0.z = PxExtended(p0.z); + WorldCapsule.p1.x = PxExtended(p1.x); + WorldCapsule.p1.y = PxExtended(p1.y); + WorldCapsule.p1.z = PxExtended(p1.z); + } + + TouchedCapsule* PX_RESTRICT touchedCapsule = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedCapsule)/sizeof(PxU32))); + touchedCapsule->mType = TouchedGeomType::eCAPSULE; + touchedCapsule->mTGUserData = capsuleShape; + touchedCapsule->mActor = actor; + touchedCapsule->mOffset = origin; + touchedCapsule->mRadius = WorldCapsule.radius; + touchedCapsule->mP0.x = float(WorldCapsule.p0.x - origin.x); + touchedCapsule->mP0.y = float(WorldCapsule.p0.y - origin.y); + touchedCapsule->mP0.z = float(WorldCapsule.p0.z - origin.z); + touchedCapsule->mP1.x = float(WorldCapsule.p1.x - origin.x); + touchedCapsule->mP1.y = float(WorldCapsule.p1.y - origin.y); + touchedCapsule->mP1.z = float(WorldCapsule.p1.z - origin.z); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputBoxToStream( PxShape* boxShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, TriArray& worldTriangles, IntArray& triIndicesArray, + const PxExtendedVec3& origin, const PxBounds3& tmpBounds, const CCTParams& params, PxU16& nbTessellation) +{ + PX_ASSERT(boxShape->getGeometryType() == PxGeometryType::eBOX); + PxBoxGeometry bg; + boxShape->getBoxGeometry(bg); + + //8 verts in local space. + const PxF32 dx = bg.halfExtents.x; + const PxF32 dy = bg.halfExtents.y; + const PxF32 dz = bg.halfExtents.z; + PxVec3 boxVerts[8]= + { + PxVec3(-dx,-dy,-dz), + PxVec3(+dx,-dy,-dz), + PxVec3(+dx,+dy,-dz), + PxVec3(-dx,+dy,-dz), + PxVec3(-dx,-dy,+dz), + PxVec3(+dx,-dy,+dz), + PxVec3(+dx,+dy,+dz), + PxVec3(-dx,+dy,+dz) + }; + //Transform verts into world space. + const PxVec3 pxOrigin = toVec3(origin); + for(PxU32 i = 0; i < 8; i++) + { + boxVerts[i] = globalPose.transform(boxVerts[i]) - pxOrigin; + } + + //Index of triangles. + const PxU32 boxTris[12][3]= + { + {0,2,1}, + {2,0,3}, //0,1,2,3 + + {3,6,2}, + {6,3,7}, //3,2,6,7 + + {7,5,6}, + {5,7,4}, //7,6,5,4 + + {4,1,5}, + {1,4,0}, //4,5,1,0 + + {0,7,3}, + {7,0,4}, //0,3,7,4 + + {2,5,1}, + {5,2,6} //2,1,5,6 + }; + + TouchedMesh* touchedMesh = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedMesh)/sizeof(PxU32))); + touchedMesh->mType = TouchedGeomType::eMESH; + touchedMesh->mTGUserData = boxShape; + touchedMesh->mActor = actor; + touchedMesh->mOffset = origin; + touchedMesh->mIndexWorldTriangles = worldTriangles.size(); + + if(params.mTessellation) + { + const PxBoxGeometry boxGeom(tmpBounds.getExtents()); + const PxVec3 offset(float(-origin.x), float(-origin.y), float(-origin.z)); + const PxBounds3 cullingBox = PxBounds3::centerExtents(tmpBounds.getCenter() + offset, boxGeom.halfExtents); + + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i<12; i++) + { + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + currentTriangle.verts[0] = boxVerts[boxTris[i][0]]; + currentTriangle.verts[1] = boxVerts[boxTris[i][1]]; + currentTriangle.verts[2] = boxVerts[boxTris[i][2]]; + + PxU32 nbNewTris = 0; + tessellateTriangle(nbNewTris, currentTriangle, PX_INVALID_U32, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); + nbCreatedTris += nbNewTris; + } + touchedMesh->mNbTris = nbCreatedTris; + } + else + { + touchedMesh->mNbTris = 12; + + // Reserve memory for incoming triangles + PxTriangle* TouchedTriangles = worldTriangles.reserve(12); + + for(PxU32 i=0; i<12; i++) + { + PxTriangle& currentTriangle = TouchedTriangles[i]; + currentTriangle.verts[0] = boxVerts[boxTris[i][0]]; + currentTriangle.verts[1] = boxVerts[boxTris[i][1]]; + currentTriangle.verts[2] = boxVerts[boxTris[i][2]]; + + triIndicesArray.pushBack(PX_INVALID_U32); + } + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PxU32 createInvisibleWalls(const CCTParams& params, const PxTriangle& currentTriangle, TriArray& worldTriangles, IntArray& triIndicesArray) +{ + const PxF32 wallHeight = params.mInvisibleWallHeight; + if(wallHeight==0.0f) + return 0; + + PxU32 nbNewTris = 0; // Number of newly created tris + + const PxVec3& upDirection = params.mUpDirection; + + PxVec3 normal; + currentTriangle.normal(normal); + if(testSlope(normal, upDirection, params.mSlopeLimit)) + { + const PxVec3 upWall = upDirection*wallHeight; + PxVec3 v0p = currentTriangle.verts[0] + upWall; + PxVec3 v1p = currentTriangle.verts[1] + upWall; + PxVec3 v2p = currentTriangle.verts[2] + upWall; + + // Extrude edge 0-1 + PxVec3 faceNormal01; + { + // 0-1-0p + const PxTriangle tri0_1_0p(currentTriangle.verts[0], currentTriangle.verts[1], v0p); + worldTriangles.pushBack(tri0_1_0p); + + // 0p-1-1p + const PxTriangle tri0p_1_1p(v0p, currentTriangle.verts[1], v1p); + worldTriangles.pushBack(tri0p_1_1p); + + tri0p_1_1p.normal(faceNormal01); + } + + // Extrude edge 1-2 + PxVec3 faceNormal12; + { + // 1p-1-2p + const PxTriangle tri1p_1_2p(v1p, currentTriangle.verts[1], v2p); + worldTriangles.pushBack(tri1p_1_2p); + + // 2p-1-2 + const PxTriangle tri2p_1_2(v2p, currentTriangle.verts[1], currentTriangle.verts[2]); + worldTriangles.pushBack(tri2p_1_2); + + tri2p_1_2.normal(faceNormal12); + } + + // Extrude edge 2-0 + PxVec3 faceNormal20; + { + // 0p-2-0 + const PxTriangle tri0p_2_0(v0p, currentTriangle.verts[2], currentTriangle.verts[0]); + worldTriangles.pushBack(tri0p_2_0); + + // 0p-2p-2 + const PxTriangle tri0p_2p_2(v0p, v2p, currentTriangle.verts[2]); + worldTriangles.pushBack(tri0p_2p_2); + + tri0p_2p_2.normal(faceNormal20); + } + + const PxU32 triIndex = PX_INVALID_U32; + for(PxU32 i=0;i<6;i++) + triIndicesArray.pushBack(triIndex); + + nbNewTris += 6; + } + return nbNewTris; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputMeshToStream( PxShape* meshShape, const PxRigidActor* actor, const PxTransform& meshPose, IntArray& geomStream, TriArray& worldTriangles, IntArray& triIndicesArray, + const PxExtendedVec3& origin, const PxBounds3& tmpBounds, const CCTParams& params, PxRenderBuffer* renderBuffer, PxU16& nbTessellation) +{ + PX_ASSERT(meshShape->getGeometryType() == PxGeometryType::eTRIANGLEMESH); + // Do AABB-mesh query + + PxTriangleMeshGeometry triGeom; + meshShape->getTriangleMeshGeometry(triGeom); + + const PxBoxGeometry boxGeom(tmpBounds.getExtents()); + const PxTransform boxPose(tmpBounds.getCenter()); + + // Collide AABB against current mesh + PxMeshOverlapUtil overlapUtil; + const PxU32 nbTouchedTris = overlapUtil.findOverlap(boxGeom, boxPose, triGeom, meshPose); + + const PxVec3 offset(float(-origin.x), float(-origin.y), float(-origin.z)); + + TouchedMesh* touchedMesh = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedMesh)/sizeof(PxU32))); + touchedMesh->mType = TouchedGeomType::eMESH; + touchedMesh->mTGUserData = meshShape; + touchedMesh->mActor = actor; + touchedMesh->mOffset = origin; + touchedMesh->mNbTris = nbTouchedTris; + touchedMesh->mIndexWorldTriangles = worldTriangles.size(); + + const PxU32* PX_RESTRICT indices = overlapUtil.getResults(); + + if(params.mSlopeLimit!=0.0f) + { + if(!params.mTessellation) + { + // Loop through touched triangles + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(triGeom, meshPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + const PxU32 nbNewTris = createInvisibleWalls(params, currentTriangle, worldTriangles, triIndicesArray); + nbCreatedTris += nbNewTris; + if(!nbNewTris) + { + worldTriangles.pushBack(currentTriangle); + + triIndicesArray.pushBack(triangleIndex); + nbCreatedTris++; + } + } + touchedMesh->mNbTris = nbCreatedTris; + } + else + { + const PxBounds3 cullingBox = PxBounds3::centerExtents(boxPose.p + offset, boxGeom.halfExtents); + + // Loop through touched triangles + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(triGeom, meshPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + PxU32 nbNewTris = createInvisibleWalls(params, currentTriangle, worldTriangles, triIndicesArray); + nbCreatedTris += nbNewTris; + if(!nbNewTris) + { +/* worldTriangles.pushBack(currentTriangle); + triIndicesArray.pushBack(triangleIndex); + nbCreatedTris++;*/ + + tessellateTriangle(nbNewTris, currentTriangle, triangleIndex, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); + nbCreatedTris += nbNewTris; +// printf("Tesselate: %d new tris\n", nbNewTris); + } + } + touchedMesh->mNbTris = nbCreatedTris; + } + } + else + { + if(!params.mTessellation) + { + // Reserve memory for incoming triangles + PxTriangle* TouchedTriangles = worldTriangles.reserve(nbTouchedTris); + + // Loop through touched triangles + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTriangle& currentTriangle = *TouchedTriangles++; + PxMeshQuery::getTriangle(triGeom, meshPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + triIndicesArray.pushBack(triangleIndex); + } + } + else + { + const PxBounds3 cullingBox = PxBounds3::centerExtents(boxPose.p + offset, boxGeom.halfExtents); + + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(triGeom, meshPose, triangleIndex, currentTriangle); + + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + PxU32 nbNewTris = 0; + tessellateTriangle(nbNewTris, currentTriangle, triangleIndex, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); +// printf("Tesselate: %d new tris\n", nbNewTris); + nbCreatedTris += nbNewTris; + } + touchedMesh->mNbTris = nbCreatedTris; + } + } + + if(gVisualizeTouchedTris) + visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputHeightFieldToStream( PxShape* hfShape, const PxRigidActor* actor, const PxTransform& heightfieldPose, IntArray& geomStream, TriArray& worldTriangles, IntArray& triIndicesArray, + const PxExtendedVec3& origin, const PxBounds3& tmpBounds, const CCTParams& params, PxRenderBuffer* renderBuffer, PxU16& nbTessellation) +{ + PX_ASSERT(hfShape->getGeometryType() == PxGeometryType::eHEIGHTFIELD); + // Do AABB-mesh query + + PxHeightFieldGeometry hfGeom; + hfShape->getHeightFieldGeometry(hfGeom); + + const PxBoxGeometry boxGeom(tmpBounds.getExtents()); + const PxTransform boxPose(tmpBounds.getCenter()); + + // Collide AABB against current heightfield + PxMeshOverlapUtil overlapUtil; + const PxU32 nbTouchedTris = overlapUtil.findOverlap(boxGeom, boxPose, hfGeom, heightfieldPose); + + const PxVec3 offset(float(-origin.x), float(-origin.y), float(-origin.z)); + + TouchedMesh* touchedMesh = reinterpret_cast(reserveContainerMemory(geomStream, sizeof(TouchedMesh)/sizeof(PxU32))); + touchedMesh->mType = TouchedGeomType::eMESH; // ptchernev: seems to work + touchedMesh->mTGUserData = hfShape; + touchedMesh->mActor = actor; + touchedMesh->mOffset = origin; + touchedMesh->mNbTris = nbTouchedTris; + touchedMesh->mIndexWorldTriangles = worldTriangles.size(); + + const PxU32* PX_RESTRICT indices = overlapUtil.getResults(); + + if(params.mSlopeLimit!=0.0f) + { + if(!params.mTessellation) + { + // Loop through touched triangles + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(hfGeom, heightfieldPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + const PxU32 nbNewTris = createInvisibleWalls(params, currentTriangle, worldTriangles, triIndicesArray); + nbCreatedTris += nbNewTris; + if(!nbNewTris) + { + worldTriangles.pushBack(currentTriangle); + + triIndicesArray.pushBack(triangleIndex); + nbCreatedTris++; + } + } + touchedMesh->mNbTris = nbCreatedTris; + } + else + { + const PxBounds3 cullingBox = PxBounds3::centerExtents(boxPose.p + offset, boxGeom.halfExtents); + + // Loop through touched triangles + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(hfGeom, heightfieldPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + PxU32 nbNewTris = createInvisibleWalls(params, currentTriangle, worldTriangles, triIndicesArray); + nbCreatedTris += nbNewTris; + if(!nbNewTris) + { + tessellateTriangle(nbNewTris, currentTriangle, triangleIndex, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); + nbCreatedTris += nbNewTris; +// printf("Tesselate: %d new tris\n", nbNewTris); + } + } + touchedMesh->mNbTris = nbCreatedTris; + } + } + else + { + if(!params.mTessellation) + { + // Reserve memory for incoming triangles + PxTriangle* TouchedTriangles = worldTriangles.reserve(nbTouchedTris); + + // Loop through touched triangles + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTriangle& currentTriangle = *TouchedTriangles++; + PxMeshQuery::getTriangle(hfGeom, heightfieldPose, triangleIndex, currentTriangle); + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + triIndicesArray.pushBack(triangleIndex); + } + } + else + { + const PxBounds3 cullingBox = PxBounds3::centerExtents(boxPose.p + offset, boxGeom.halfExtents); + + PxU32 nbCreatedTris = 0; + for(PxU32 i=0; i < nbTouchedTris; i++) + { + const PxU32 triangleIndex = indices[i]; + + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + PxMeshQuery::getTriangle(hfGeom, heightfieldPose, triangleIndex, currentTriangle); + + currentTriangle.verts[0] += offset; + currentTriangle.verts[1] += offset; + currentTriangle.verts[2] += offset; + + PxU32 nbNewTris = 0; + tessellateTriangle(nbNewTris, currentTriangle, triangleIndex, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); +// printf("Tesselate: %d new tris\n", nbNewTris); + nbCreatedTris += nbNewTris; + } + touchedMesh->mNbTris = nbCreatedTris; + } + } + + if(gVisualizeTouchedTris) + visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void outputConvexToStream(PxShape* convexShape, const PxRigidActor* actor, const PxTransform& absPose_, IntArray& geomStream, TriArray& worldTriangles, IntArray& triIndicesArray, + const PxExtendedVec3& origin, const PxBounds3& tmpBounds, const CCTParams& params, PxRenderBuffer* renderBuffer, PxU16& nbTessellation) +{ + PX_ASSERT(convexShape->getGeometryType() == PxGeometryType::eCONVEXMESH); + PxConvexMeshGeometry cg; + convexShape->getConvexMeshGeometry(cg); + PX_ASSERT(cg.convexMesh); + + // Do AABB-mesh query + + PxU32* TF; + + // Collide AABB against current mesh + // The overlap function doesn't exist for convexes so let's just dump all tris + PxConvexMesh& cm = *cg.convexMesh; + + // PT: convex triangles are not exposed anymore so we need to access convex polygons & triangulate them + + // PT: TODO: this is copied from "DrawObjects", move this to a shared place. Actually a helper directly in PxConvexMesh would be useful. + PxU32 Nb = 0; + { + const PxU32 nbPolys = cm.getNbPolygons(); + const PxU8* polygons = cm.getIndexBuffer(); + + for(PxU32 i=0;i(PxAlloca(sizeof(PxU32)*Nb*3)); + PxU32* t = TF; + for(PxU32 i=0;i(reserveContainerMemory(geomStream, sizeof(TouchedMesh)/sizeof(PxU32))); + touchedMesh->mType = TouchedGeomType::eMESH; + touchedMesh->mTGUserData = convexShape; + touchedMesh->mActor = actor; + touchedMesh->mOffset = origin; + touchedMesh->mIndexWorldTriangles = worldTriangles.size(); + + const PxVec3* verts = cm.getVertices(); + // Loop through touched triangles + if(params.mTessellation) + { + const PxBoxGeometry boxGeom(tmpBounds.getExtents()); + const PxBounds3 cullingBox = PxBounds3::centerExtents(tmpBounds.getCenter() + offset, boxGeom.halfExtents); + + PxU32 nbCreatedTris = 0; + while(Nb--) + { + // Compute triangle in world space, add to array + PxTrianglePadded currentTriangle; + + const PxU32 vref0 = *TF++; + const PxU32 vref1 = *TF++; + const PxU32 vref2 = *TF++; + + currentTriangle.verts[0] = MeshOffset + absPose.rotate(verts[vref0]); + currentTriangle.verts[1] = MeshOffset + absPose.rotate(verts[vref1]); + currentTriangle.verts[2] = MeshOffset + absPose.rotate(verts[vref2]); + + PxU32 nbNewTris = 0; + tessellateTriangle(nbNewTris, currentTriangle, PX_INVALID_U32, worldTriangles, triIndicesArray, cullingBox, params, nbTessellation); + nbCreatedTris += nbNewTris; + } + touchedMesh->mNbTris = nbCreatedTris; + } + else + { + // Reserve memory for incoming triangles + PxTriangle* TouchedTriangles = worldTriangles.reserve(Nb); + + touchedMesh->mNbTris = Nb; + while(Nb--) + { + // Compute triangle in world space, add to array + PxTriangle& currentTriangle = *TouchedTriangles++; + + const PxU32 vref0 = *TF++; + const PxU32 vref1 = *TF++; + const PxU32 vref2 = *TF++; + + currentTriangle.verts[0] = MeshOffset + absPose.rotate(verts[vref0]); + currentTriangle.verts[1] = MeshOffset + absPose.rotate(verts[vref1]); + currentTriangle.verts[2] = MeshOffset + absPose.rotate(verts[vref2]); + + triIndicesArray.pushBack(PX_INVALID_U32); + } + } + if(gVisualizeTouchedTris) + visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxU32 Cct::getSceneTimestamp(const InternalCBData_FindTouchedGeom* userData) +{ + PX_ASSERT(userData); + const PxInternalCBData_FindTouchedGeom* internalData = static_cast(userData); + PxScene* scene = internalData->scene; + return scene->getSceneQueryStaticTimestamp(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Cct::findTouchedGeometry( + const InternalCBData_FindTouchedGeom* userData, + const PxExtendedBounds3& worldBounds, // ### we should also accept other volumes + + TriArray& worldTriangles, + IntArray& triIndicesArray, + IntArray& geomStream, + + const CCTFilter& filter, + const CCTParams& params, + PxU16& nbTessellation) +{ + PX_ASSERT(userData); + + const PxInternalCBData_FindTouchedGeom* internalData = static_cast(userData); + PxScene* scene = internalData->scene; + + PX_PROFILE_ZONE("CharacterController.findTouchedGeometry", PxU64(scene)); + + PxRenderBuffer* renderBuffer = internalData->renderBuffer; + + PxExtendedVec3 Origin; // Will be TouchedGeom::mOffset + getCenter(worldBounds, Origin); + + // Find touched *boxes* i.e. touched objects' AABBs in the world + // We collide against dynamic shapes too, to get back dynamic boxes/etc + // TODO: add active groups in interface! + PxQueryFlags sqFilterFlags; + if(filter.mStaticShapes) sqFilterFlags |= PxQueryFlag::eSTATIC; + if(filter.mDynamicShapes) sqFilterFlags |= PxQueryFlag::eDYNAMIC; + if(filter.mFilterCallback) + { + if(filter.mPreFilter) + sqFilterFlags |= PxQueryFlag::ePREFILTER; + if(filter.mPostFilter) + sqFilterFlags |= PxQueryFlag::ePOSTFILTER; + } + + // ### this one is dangerous + const PxBounds3 tmpBounds(toVec3(worldBounds.minimum), toVec3(worldBounds.maximum)); // LOSS OF ACCURACY + + // PT: unfortunate conversion forced by the PxGeometry API + const PxVec3 center = tmpBounds.getCenter(); + const PxVec3 extents = tmpBounds.getExtents(); + + const PxU32 size = 100; + PxOverlapHit hits[size]; + + PxQueryFilterData sceneQueryFilterData = filter.mFilterData ? PxQueryFilterData(*filter.mFilterData, sqFilterFlags) : PxQueryFilterData(sqFilterFlags); + + PxOverlapBuffer hitBuffer(hits, size); + sceneQueryFilterData.flags |= PxQueryFlag::eNO_BLOCK; // fix for DE8255 + scene->overlap(PxBoxGeometry(extents), PxTransform(center), hitBuffer, sceneQueryFilterData, filter.mFilterCallback); + PxU32 numberHits = hitBuffer.getNbAnyHits(); + for(PxU32 i = 0; i < numberHits; i++) + { + const PxOverlapHit& hit = hitBuffer.getAnyHit(i); + PxShape* shape = hit.shape; + PxRigidActor* actor = hit.actor; + if(!shape || !actor) + continue; + + // Filtering + + // Discard all CCT shapes, i.e. kinematic actors we created ourselves. We don't need to collide with them since they're surrounded + // by the real CCT volume - and collisions with those are handled elsewhere. + if(internalData->cctShapeHashSet->contains(shape)) + continue; + + // Ubi (EA) : Discarding Triggers : + if(shape->getFlags() & PxShapeFlag::eTRIGGER_SHAPE) + continue; + + // PT: here you might want to disable kinematic objects. + + // Output shape to stream + const PxTransform globalPose = getShapeGlobalPose(*shape, *actor); + + const PxGeometryType::Enum type = shape->getGeometryType(); // ### VIRTUAL! + if(type==PxGeometryType::eSPHERE) outputSphereToStream (shape, actor, globalPose, geomStream, Origin); + else if(type==PxGeometryType::eCAPSULE) outputCapsuleToStream (shape, actor, globalPose, geomStream, Origin); + else if(type==PxGeometryType::eBOX) outputBoxToStream (shape, actor, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, nbTessellation); + else if(type==PxGeometryType::eTRIANGLEMESH) outputMeshToStream (shape, actor, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer, nbTessellation); + else if(type==PxGeometryType::eHEIGHTFIELD) outputHeightFieldToStream (shape, actor, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer, nbTessellation); + else if(type==PxGeometryType::eCONVEXMESH) outputConvexToStream (shape, actor, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer, nbTessellation); + else if(type==PxGeometryType::ePLANE) outputPlaneToStream (shape, actor, globalPose, geomStream, worldTriangles, triIndicesArray, Origin, tmpBounds, params, renderBuffer); + else if(type==PxGeometryType::eCUSTOM) outputCustomToStream (shape, actor, globalPose, geomStream, Origin); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "characterkinematic/PxControllerBehavior.h" + +#include "CctCharacterControllerManager.h" +#include "CctObstacleContext.h" + +// #### hmmm, in the down case, isn't reported length too big ? It contains our artificial up component, +// that might confuse the user + +static void fillCCTHit(PxControllerHit& hit, const SweptContact& contact, const PxVec3& dir, float length, Controller* controller) +{ + hit.controller = controller->getPxController(); + hit.worldPos = contact.mWorldPos; + hit.worldNormal = contact.mWorldNormal; + hit.dir = dir; + hit.length = length; +} + +static const PxU32 defaultBehaviorFlags = 0; + +PxU32 Cct::shapeHitCallback(const InternalCBData_OnHit* userData, const SweptContact& contact, const PxVec3& dir, float length) +{ + Controller* controller = static_cast(userData)->controller; + + PxControllerShapeHit hit; + fillCCTHit(hit, contact, dir, length, controller); + + hit.shape = const_cast(reinterpret_cast(contact.mGeom->mTGUserData)); + hit.actor = const_cast(contact.mGeom->mActor); + hit.triangleIndex = contact.mTriangleIndex; + + if(controller->mReportCallback) + controller->mReportCallback->onShapeHit(hit); + + PxControllerBehaviorCallback* behaviorCB = controller->mBehaviorCallback; + return behaviorCB ? behaviorCB->getBehaviorFlags(*hit.shape, *hit.actor) : defaultBehaviorFlags; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxU32 handleObstacleHit(const PxObstacle& touchedObstacle, const PxObstacleHandle& obstacleHandle, PxControllerObstacleHit& hit, const PxInternalCBData_OnHit* internalData, Controller* controller) +{ + hit.userData = touchedObstacle.mUserData; + const_cast(internalData)->touchedObstacle = &touchedObstacle; // (*) PT: TODO: revisit + const_cast(internalData)->touchedObstacleHandle = obstacleHandle; + + if(controller->mReportCallback) + controller->mReportCallback->onObstacleHit(hit); + + PxControllerBehaviorCallback* behaviorCB = controller->mBehaviorCallback; + return behaviorCB ? behaviorCB->getBehaviorFlags(touchedObstacle) : defaultBehaviorFlags; +} + +PxU32 Cct::userHitCallback(const InternalCBData_OnHit* userData, const SweptContact& contact, const PxVec3& dir, float length) +{ + const PxInternalCBData_OnHit* internalData = static_cast(userData); + Controller* controller = internalData->controller; + + const PxU32 objectCode = PxU32(size_t(contact.mGeom->mTGUserData)); + const UserObjectType type = decodeType(objectCode); + const PxU32 index = decodeIndex(objectCode); + + if(type==USER_OBJECT_CCT) + { + PX_ASSERT(indexgetCctManager()->getNbControllers()); + Controller** controllers = controller->getCctManager()->getControllers(); + Controller* other = controllers[index]; + + PxControllersHit hit; + fillCCTHit(hit, contact, dir, length, controller); + + hit.other = other->getPxController(); + + if(controller->mReportCallback) + controller->mReportCallback->onControllerHit(hit); + + PxControllerBehaviorCallback* behaviorCB = controller->mBehaviorCallback; + return behaviorCB ? behaviorCB->getBehaviorFlags(*hit.other) : defaultBehaviorFlags; + } + else if(type==USER_OBJECT_BOX_OBSTACLE) + { + PX_ASSERT(internalData->obstacles); + PX_ASSERT(indexobstacles->mBoxObstacles.size()); + + PxControllerObstacleHit hit; + fillCCTHit(hit, contact, dir, length, controller); + + const ObstacleContext::InternalBoxObstacle& obstacle = internalData->obstacles->mBoxObstacles[index]; + const PxBoxObstacle& touchedObstacle = obstacle.mData; + return handleObstacleHit(touchedObstacle, obstacle.mHandle , hit, internalData, controller); + } + else if(type==USER_OBJECT_CAPSULE_OBSTACLE) + { + PX_ASSERT(internalData->obstacles); + PX_ASSERT(indexobstacles->mCapsuleObstacles.size()); + + PxControllerObstacleHit hit; + fillCCTHit(hit, contact, dir, length, controller); + + const ObstacleContext::InternalCapsuleObstacle& obstacle = internalData->obstacles->mCapsuleObstacles[index]; + const PxCapsuleObstacle& touchedObstacle = obstacle.mData; + return handleObstacleHit(touchedObstacle, obstacle.mHandle, hit, internalData, controller); + } + else PX_ASSERT(0); + + return defaultBehaviorFlags; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp new file mode 100644 index 0000000..86b6777 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.cpp @@ -0,0 +1,686 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CctCharacterControllerManager.h" +#include "CctBoxController.h" +#include "CctCapsuleController.h" +#include "CctObstacleContext.h" +#include "GuDistanceSegmentSegment.h" +#include "GuDistanceSegmentBox.h" +#include "foundation/PxUtilities.h" +#include "PxRigidDynamic.h" +#include "PxScene.h" +#include "PxPhysics.h" +#include "CmRenderBuffer.h" +#include "CmRadixSort.h" + +using namespace physx; +using namespace Cct; + +static const PxF32 gMaxOverlapRecover = 4.0f; // PT: TODO: expose this + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +CharacterControllerManager::CharacterControllerManager(PxScene& scene, bool lockingEnabled) : + mScene (scene), + mRenderBuffer (NULL), + mDebugRenderingFlags (0), + mMaxEdgeLength (1.0f), + mTessellation (false), + mOverlapRecovery (true), + mPreciseSweeps (true), + mPreventVerticalSlidingAgainstCeiling (false), + mLockingEnabled (lockingEnabled) +{ + // PT: register ourself as a deletion listener, to be called by the SDK whenever an object is deleted + PxPhysics& physics = scene.getPhysics(); + physics.registerDeletionListener(*this, PxDeletionEventFlag::eUSER_RELEASE); +} + +CharacterControllerManager::~CharacterControllerManager() +{ + PX_DELETE(mRenderBuffer); +} + +void CharacterControllerManager::release() +{ + // PT: TODO: use non virtual calls & move to dtor + while(getNbControllers()!= 0) + releaseController(*getController(0)); + + while(getNbObstacleContexts()!= 0) + mObstacleContexts[0]->release(); + + PxPhysics& physics = mScene.getPhysics(); + physics.unregisterDeletionListener(*this); + + PX_DELETE_THIS; + + PxDecFoundationRefCount(); +} + +PxScene& CharacterControllerManager::getScene() const +{ + return mScene; +} + +PxRenderBuffer& CharacterControllerManager::getRenderBuffer() +{ + if(!mRenderBuffer) + mRenderBuffer = PX_NEW(Cm::RenderBuffer); + + return *mRenderBuffer; +} + +void CharacterControllerManager::setDebugRenderingFlags(PxControllerDebugRenderFlags flags) +{ + mDebugRenderingFlags = flags; + + if(!flags) + { + PX_DELETE(mRenderBuffer); + } +} + +PxU32 CharacterControllerManager::getNbControllers() const +{ + return mControllers.size(); +} + +Controller** CharacterControllerManager::getControllers() +{ + return mControllers.begin(); +} + +PxController* CharacterControllerManager::getController(PxU32 index) +{ + if(index>=mControllers.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxControllerManager::getController(): out-of-range index"); + return NULL; + } + + PX_ASSERT(mControllers[index]); + return mControllers[index]->getPxController(); +} + +PxController* CharacterControllerManager::createController(const PxControllerDesc& desc) +{ + if(!desc.isValid()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxControllerManager::createController(): desc.isValid() fails."); + return NULL; + } + + Controller* newController = NULL; + + PxController* N = NULL; + if(desc.getType()==PxControllerShapeType::eBOX) + { + BoxController* boxController = PX_NEW(BoxController)(desc, mScene.getPhysics(), &mScene); + newController = boxController; + N = boxController; + } + else if(desc.getType()==PxControllerShapeType::eCAPSULE) + { + CapsuleController* capsuleController = PX_NEW(CapsuleController)(desc, mScene.getPhysics(), &mScene); + newController = capsuleController; + N = capsuleController; + } + else PX_ALWAYS_ASSERT_MESSAGE( "INTERNAL ERROR - invalid CCT type, should have been caught by isValid()."); + + if(newController) + { + mControllers.pushBack(newController); + newController->setCctManager(this); + + PxShape* shape = NULL; + PxU32 nb = N->getActor()->getShapes(&shape, 1); + PX_ASSERT(nb==1); + PX_UNUSED(nb); + mCCTShapes.insert(shape); + } + + return N; +} + +void CharacterControllerManager::releaseController(PxController& controller) +{ + for(PxU32 i = 0; igetPxController() == &controller) + { + mControllers.replaceWithLast(i); + break; + } + } + + PxShape* shape = NULL; + PxU32 nb = controller.getActor()->getShapes(&shape, 1); + PX_ASSERT(nb==1); + PX_UNUSED(nb); + mCCTShapes.erase(shape); + + if(controller.getType() == PxControllerShapeType::eCAPSULE) + { + CapsuleController* cc = static_cast(&controller); + PX_DELETE(cc); + } + else if(controller.getType() == PxControllerShapeType::eBOX) + { + BoxController* bc = static_cast(&controller); + PX_DELETE(bc); + } + else PX_ASSERT(0); +} + +void CharacterControllerManager::purgeControllers() +{ + while(mControllers.size()) + releaseController(*mControllers[0]->getPxController()); +} + +void CharacterControllerManager::onRelease(const PxBase* observed, void* , PxDeletionEventFlag::Enum deletionEvent) +{ + PX_ASSERT(deletionEvent == PxDeletionEventFlag::eUSER_RELEASE); // the only type we registered for + PX_UNUSED(deletionEvent); + + const PxType type = observed->getConcreteType(); + + if(type!=PxConcreteType:: eRIGID_DYNAMIC && type!=PxConcreteType:: eRIGID_STATIC && type!=PxConcreteType::eSHAPE && type!=PxConcreteType::eARTICULATION_LINK) + return; + + // check if object was registered + if(mLockingEnabled) + mWriteLock.lock(); + + const ObservedRefCountMap::Entry* releaseEntry = mObservedRefCountMap.find(observed); + + if(mLockingEnabled) + mWriteLock.unlock(); + + if(releaseEntry) + { + const PxU32 size = mControllers.size(); + for(PxU32 i=0; imWriteLock.lock(); + + controller->onRelease(*observed); + + if(mLockingEnabled) + controller->mWriteLock.unlock(); + } + } +} + +void CharacterControllerManager::registerObservedObject(const PxBase* obj) +{ + if(mLockingEnabled) + mWriteLock.lock(); + + mObservedRefCountMap[obj].refCount++; + + if(mLockingEnabled) + mWriteLock.unlock(); +} + +void CharacterControllerManager::unregisterObservedObject(const PxBase* obj) +{ + if(mLockingEnabled) + mWriteLock.lock(); + + ObservedRefCounter& refCounter = mObservedRefCountMap[obj]; + PX_ASSERT(refCounter.refCount); + refCounter.refCount--; + if(!refCounter.refCount) + mObservedRefCountMap.erase(obj); + + if(mLockingEnabled) + mWriteLock.unlock(); +} + +PxU32 CharacterControllerManager::getNbObstacleContexts() const +{ + return mObstacleContexts.size(); +} + +PxObstacleContext* CharacterControllerManager::getObstacleContext(PxU32 index) +{ + if(index>=mObstacleContexts.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxControllerManager::getObstacleContext(): out-of-range index"); + return NULL; + } + + PX_ASSERT(mObstacleContexts[index]); + return mObstacleContexts[index]; +} + +PxObstacleContext* CharacterControllerManager::createObstacleContext() +{ + ObstacleContext* oc = PX_NEW(ObstacleContext)(*this); + + mObstacleContexts.pushBack(oc); + + return oc; +} + +void CharacterControllerManager::releaseObstacleContext(ObstacleContext& oc) +{ + PX_ASSERT(mObstacleContexts.find(&oc) != mObstacleContexts.end()); + mObstacleContexts.findAndReplaceWithLast(&oc); + + ObstacleContext* ptr = &oc; + PX_DELETE(ptr); +} + +void CharacterControllerManager::onObstacleRemoved(PxObstacleHandle index) const +{ + for(PxU32 i = 0; imCctModule.onObstacleRemoved(index); + } +} + +void CharacterControllerManager::onObstacleUpdated(PxObstacleHandle index, const PxObstacleContext* context) const +{ + for(PxU32 i = 0; imCctModule.onObstacleUpdated(index,context, toVec3(mControllers[i]->mPosition), -mControllers[i]->mUserParams.mUpDirection, mControllers[i]->getHalfHeightInternal()); + } +} + +void CharacterControllerManager::onObstacleAdded(PxObstacleHandle index, const PxObstacleContext* context) const +{ + for(PxU32 i = 0; imCctModule.onObstacleAdded(index,context, toVec3(mControllers[i]->mPosition), -mControllers[i]->mUserParams.mUpDirection, mControllers[i]->getHalfHeightInternal()); + } +} + +void CharacterControllerManager::resetObstaclesBuffers() +{ + mBoxUserData.resetOrClear(); + mBoxes.resetOrClear(); + mCapsuleUserData.resetOrClear(); + mCapsules.resetOrClear(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CharacterControllerManager::setTessellation(bool flag, float maxEdgeLength) +{ + mTessellation = flag; + mMaxEdgeLength = maxEdgeLength; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CharacterControllerManager::setOverlapRecoveryModule(bool flag) +{ + mOverlapRecovery = flag; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CharacterControllerManager::setPreciseSweeps(bool flag) +{ + mPreciseSweeps = flag; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CharacterControllerManager::setPreventVerticalSlidingAgainstCeiling(bool flag) +{ + mPreventVerticalSlidingAgainstCeiling = flag; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void CharacterControllerManager::shiftOrigin(const PxVec3& shift) +{ + for(PxU32 i=0; i < mControllers.size(); i++) + { + mControllers[i]->onOriginShift(shift); + } + + for(PxU32 i=0; i < mObstacleContexts.size(); i++) + { + mObstacleContexts[i]->onOriginShift(shift); + } + + if(mRenderBuffer) + mRenderBuffer->shift(-shift); + + // assumption is that these are just used for temporary stuff + PX_ASSERT(!mBoxes.size()); + PX_ASSERT(!mCapsules.size()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static bool computeMTD(PxVec3& mtd, PxF32& depth, const PxVec3& e0, const PxVec3& c0, const PxMat33& r0, const PxVec3& e1, const PxVec3& c1, const PxMat33& r1) +{ + // Translation, in parent frame + const PxVec3 v = c1 - c0; + // Translation, in A's frame + const PxVec3 T(v.dot(r0[0]), v.dot(r0[1]), v.dot(r0[2])); + + // B's basis with respect to A's local frame + PxReal R[3][3]; + PxReal FR[3][3]; + PxReal ra, rb, t, d; + + PxReal overlap[15]; + + // Calculate rotation matrix + for(PxU32 i=0;i<3;i++) + { + for(PxU32 k=0;k<3;k++) + { + R[i][k] = r0[i].dot(r1[k]); + FR[i][k] = 1e-6f + PxAbs(R[i][k]); // Precompute fabs matrix + } + } + + // A's basis vectors + for(PxU32 i=0;i<3;i++) + { + ra = e0[i]; + rb = e1[0]*FR[i][0] + e1[1]*FR[i][1] + e1[2]*FR[i][2]; + t = PxAbs(T[i]); + + d = ra + rb - t; + if(d<0.0f) + return false; + + overlap[i] = d; + } + + // B's basis vectors + for(PxU32 k=0;k<3;k++) + { + ra = e0[0]*FR[0][k] + e0[1]*FR[1][k] + e0[2]*FR[2][k]; + rb = e1[k]; + t = PxAbs(T[0]*R[0][k] + T[1]*R[1][k] + T[2]*R[2][k]); + + d = ra + rb - t; + if(d<0.0f) + return false; + + overlap[k+3] = d; + } + + // PT: edge-edge tests are skipped, by design + + PxU32 minIndex=0; + PxReal minD = overlap[0]; + for(PxU32 i=1;i<6;i++) + { + if(overlap[i]mType>entity1->mType) + PxSwap(entity0, entity1); + + if(entity0->mType==PxControllerShapeType::eCAPSULE && entity1->mType==PxControllerShapeType::eCAPSULE) + { + CapsuleController* cc0 = static_cast(entity0); + CapsuleController* cc1 = static_cast(entity1); + + PxExtendedCapsule capsule0; + cc0->getCapsule(capsule0); + + PxExtendedCapsule capsule1; + cc1->getCapsule(capsule1); + + const PxF32 r = capsule0.radius + capsule1.radius; + + const PxVec3 p00 = toVec3(capsule0.p0); + const PxVec3 p01 = toVec3(capsule0.p1); + const PxVec3 p10 = toVec3(capsule1.p0); + const PxVec3 p11 = toVec3(capsule1.p1); + + PxF32 s,t; + const PxF32 d = sqrtf(Gu::distanceSegmentSegmentSquared(p00, p01 - p00, p10, p11 - p10, &s, &t)); + if(dmCctModule.mUserParams.mUpDirection; + dir = fixDir(center0 - center1, up); + overlap = r - d; + } + } + else if(entity0->mType==PxControllerShapeType::eBOX && entity1->mType==PxControllerShapeType::eCAPSULE) + { + BoxController* cc0 = static_cast(entity0); + CapsuleController* cc1 = static_cast(entity1); + + PxExtendedBox obb; + cc0->getOBB(obb); + + PxExtendedCapsule capsule; + cc1->getCapsule(capsule); + const PxVec3 p0 = toVec3(capsule.p0); + const PxVec3 p1 = toVec3(capsule.p1); + + PxF32 t; + PxVec3 p; + const PxMat33 M(obb.rot); + const PxVec3 boxCenter = toVec3(obb.center); + const PxF32 d = sqrtf(Gu::distanceSegmentBoxSquared(p0, p1, boxCenter, obb.extents, M, &t, &p)); + if(dmCctModule.mUserParams.mUpDirection; + dir = fixDir(center0 - center1, up); + overlap = capsule.radius - d; + } + } + else + { + PX_ASSERT(entity0->mType==PxControllerShapeType::eBOX); + PX_ASSERT(entity1->mType==PxControllerShapeType::eBOX); + BoxController* cc0 = static_cast(entity0); + BoxController* cc1 = static_cast(entity1); + + PxExtendedBox obb0; + cc0->getOBB(obb0); + + PxExtendedBox obb1; + cc1->getOBB(obb1); + + PxVec3 mtd; + PxF32 depth; + if(computeMTD( mtd, depth, + obb0.extents, toVec3(obb0.center), PxMat33(obb0.rot), + obb1.extents, toVec3(obb1.center), PxMat33(obb1.rot))) + { + const PxVec3 center0 = toVec3(obb0.center); + const PxVec3 center1 = toVec3(obb1.center); + const PxVec3 witness = center0 - center1; + if(mtd.dot(witness)<0.0f) + dir = -mtd; + else + dir = mtd; + const PxVec3 up = entity0->mCctModule.mUserParams.mUpDirection; + dir = fixDir(dir, up); + overlap = depth; + } + } + + if(overlap!=0.0f) + { + // We want to limit this to some reasonable amount, to avoid obvious "popping". + const PxF32 maxOverlap = gMaxOverlapRecover * elapsedTime; + if(overlap>maxOverlap) + overlap=maxOverlap; + + const PxVec3 sep = dir * overlap * 0.5f; + entity0->mOverlapRecover += sep; + entity1->mOverlapRecover -= sep; + } +} + +// PT: TODO: this is the very old version, revisit with newer one +static void completeBoxPruning(const PxBounds3* bounds, PxU32 nb, PxArray& pairs) +{ + if(!nb) + return; + + pairs.clear(); + + float* PosList = PX_ALLOCATE(float, nb, "completeBoxPruning"); + + for(PxU32 i=0;igetWorldBox(extBox); + + *runningBoxes++ = PxBounds3(toVec3(extBox.minimum), toVec3(extBox.maximum)); // ### LOSS OF ACCURACY + } + + // + + const PxU32 nbEntities = PxU32(runningBoxes - boxes); + + PxArray pairs; // PT: TODO: get rid of alloc + completeBoxPruning(boxes, nbEntities, pairs); + + PxU32 nbPairs = pairs.size()>>1; + const PxU32* indices = pairs.begin(); + while(nbPairs--) + { + const PxU32 index0 = *indices++; + const PxU32 index1 = *indices++; + Controller* ctrl0 = mControllers[index0]; + Controller* ctrl1 = mControllers[index1]; + + bool keep=true; + if(cctFilterCb) + keep = cctFilterCb->filter(*ctrl0->getPxController(), *ctrl1->getPxController()); + + if(keep) + InteractionCharacterCharacter(ctrl0, ctrl1, elapsedTime); + } + + PX_FREE(boxes); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Public factory methods + +PX_C_EXPORT PxControllerManager* PX_CALL_CONV PxCreateControllerManager(PxScene& scene, bool lockingEnabled) +{ + PxIncFoundationRefCount(); + return PX_NEW(CharacterControllerManager)(scene, lockingEnabled); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.h new file mode 100644 index 0000000..6e469cc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctCharacterControllerManager.h @@ -0,0 +1,148 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_CHARACTER_CONTROLLER_MANAGER +#define CCT_CHARACTER_CONTROLLER_MANAGER + +//Exclude file from docs +/** \cond */ + +#include "geometry/PxMeshQuery.h" +#include "common/PxRenderBuffer.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "characterkinematic/PxControllerManager.h" +#include "characterkinematic/PxControllerObstacles.h" +#include "PxDeletionListener.h" +#include "CctUtils.h" +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Cct +{ + class Controller; + class ObstacleContext; + + struct ObservedRefCounter + { + ObservedRefCounter(): refCount(0) + { + } + + PxU32 refCount; + }; + + typedef PxHashMap ObservedRefCountMap; + + //Implements the PxControllerManager interface, this class used to be called ControllerManager + class CharacterControllerManager : public PxControllerManager, public PxUserAllocated, public PxDeletionListener + { + public: + CharacterControllerManager(PxScene& scene, bool lockingEnabled = false); + virtual ~CharacterControllerManager(); + + // PxControllerManager + virtual void release() PX_OVERRIDE; + virtual PxScene& getScene() const PX_OVERRIDE; + virtual PxU32 getNbControllers() const PX_OVERRIDE; + virtual PxController* getController(PxU32 index) PX_OVERRIDE; + virtual PxController* createController(const PxControllerDesc& desc) PX_OVERRIDE; + + virtual void purgeControllers() PX_OVERRIDE; + virtual PxRenderBuffer& getRenderBuffer() PX_OVERRIDE; + virtual void setDebugRenderingFlags(PxControllerDebugRenderFlags flags) PX_OVERRIDE; + virtual PxU32 getNbObstacleContexts() const PX_OVERRIDE; + virtual PxObstacleContext* getObstacleContext(PxU32 index) PX_OVERRIDE; + virtual PxObstacleContext* createObstacleContext() PX_OVERRIDE; + virtual void computeInteractions(PxF32 elapsedTime, PxControllerFilterCallback* cctFilterCb) PX_OVERRIDE; + virtual void setTessellation(bool flag, float maxEdgeLength) PX_OVERRIDE; + virtual void setOverlapRecoveryModule(bool flag) PX_OVERRIDE; + virtual void setPreciseSweeps(bool flag) PX_OVERRIDE; + virtual void setPreventVerticalSlidingAgainstCeiling(bool flag) PX_OVERRIDE; + virtual void shiftOrigin(const PxVec3& shift) PX_OVERRIDE; + //~PxControllerManager + + // PxDeletionListener + virtual void onRelease(const PxBase* observed, void* userData, PxDeletionEventFlag::Enum deletionEvent) PX_OVERRIDE; + //~PxDeletionListener + void registerObservedObject(const PxBase* obj); + void unregisterObservedObject(const PxBase* obj); + + // ObstacleContextNotifications + void onObstacleRemoved(PxObstacleHandle index) const; + void onObstacleUpdated(PxObstacleHandle index, const PxObstacleContext* ) const; + void onObstacleAdded(PxObstacleHandle index, const PxObstacleContext*) const; + + void releaseController(PxController& controller); + Controller** getControllers(); + void releaseObstacleContext(ObstacleContext& oc); + void resetObstaclesBuffers(); + + PxScene& mScene; + + PxRenderBuffer* mRenderBuffer; + PxControllerDebugRenderFlags mDebugRenderingFlags; + // Shared buffers for obstacles + PxArray mBoxUserData; + PxArray mBoxes; + + PxArray mCapsuleUserData; + PxArray mCapsules; + + PxArray mControllers; + PxHashSet mCCTShapes; + + PxArray mObstacleContexts; + + float mMaxEdgeLength; + bool mTessellation; + + bool mOverlapRecovery; + bool mPreciseSweeps; + bool mPreventVerticalSlidingAgainstCeiling; + + bool mLockingEnabled; + + protected: + CharacterControllerManager &operator=(const CharacterControllerManager &); + CharacterControllerManager(const CharacterControllerManager& ); + + private: + ObservedRefCountMap mObservedRefCountMap; + mutable PxMutex mWriteLock; // Lock used for guarding pointers in observedrefcountmap + }; + +} // namespace Cct + +} + +/** \endcond */ +#endif //CCT_CHARACTER_CONTROLLER_MANAGER diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp new file mode 100644 index 0000000..9174a97 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.cpp @@ -0,0 +1,238 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMathUtils.h" +#include "extensions/PxRigidBodyExt.h" +#include "characterkinematic/PxController.h" +#include "PxPhysics.h" +#include "PxScene.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" + +#include "CctController.h" +#include "CctBoxController.h" +#include "CctCharacterControllerManager.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Cct; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Controller::Controller(const PxControllerDesc& desc, PxScene* s) : + mCctModule (desc.registerDeletionListener), + mScene (s), + mPreviousSceneTimestamp (0xffffffff), + mGlobalTime (0.0), + mPreviousGlobalTime (0.0), + mProxyDensity (0.0f), + mProxyScaleCoeff (0.0f), + mCollisionFlags (0), + mCachedStandingOnMoving (false), + mManager (NULL) +{ + mType = PxControllerShapeType::eFORCE_DWORD; + + mUserParams.mNonWalkableMode = desc.nonWalkableMode; + mUserParams.mSlopeLimit = desc.slopeLimit; + mUserParams.mContactOffset = desc.contactOffset; + mUserParams.mStepOffset = desc.stepOffset; + mUserParams.mInvisibleWallHeight = desc.invisibleWallHeight; + mUserParams.mMaxJumpHeight = desc.maxJumpHeight; + mUserParams.mHandleSlope = desc.slopeLimit!=0.0f; + + mReportCallback = desc.reportCallback; + mBehaviorCallback = desc.behaviorCallback; + mUserData = desc.userData; + + mKineActor = NULL; + mPosition = desc.position; + mProxyDensity = desc.density; + mProxyScaleCoeff = desc.scaleCoeff; + + mCctModule.mVolumeGrowth = desc.volumeGrowth; + + mRegisterDeletionListener = desc.registerDeletionListener; + + mDeltaXP = PxVec3(0); + mOverlapRecover = PxVec3(0); + + mUserParams.mUpDirection = PxVec3(0.0f); + setUpDirectionInternal(desc.upDirection); +} + +Controller::~Controller() +{ + if(mScene) + { + if(mKineActor) + mKineActor->release(); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::onRelease(const PxBase& observed) +{ + mCctModule.onRelease(observed); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::onOriginShift(const PxVec3& shift) +{ + mPosition -= shift; + + if(mManager && mManager->mLockingEnabled) + mWriteLock.lock(); + + mCctModule.onOriginShift(shift); + + if(mManager && mManager->mLockingEnabled) + mWriteLock.unlock(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::setUpDirectionInternal(const PxVec3& up) +{ + PX_CHECK_MSG(up.isNormalized(), "CCT: up direction must be normalized"); + + if(mUserParams.mUpDirection==up) + return; + + const PxQuat q = PxShortestRotation(PxVec3(1.0f, 0.0f, 0.0f), up); + + mUserParams.mQuatFromUp = q; + mUserParams.mUpDirection = up; + + // Update kinematic actor + /*if(mKineActor) + { + PxTransform pose = mKineActor->getGlobalPose(); + pose.q = q; + mKineActor->setGlobalPose(pose); + }*/ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::releaseInternal() +{ + mManager->releaseController(*getPxController()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::getInternalState(PxControllerState& state) const +{ + if(mManager->mLockingEnabled) + mWriteLock.lock(); + + state.deltaXP = mDeltaXP; + state.touchedShape = const_cast(mCctModule.mTouchedShape.get()); + state.touchedActor = const_cast(mCctModule.mTouchedActor.get()); + state.touchedObstacleHandle = mCctModule.mTouchedObstacleHandle; + state.standOnAnotherCCT = (mCctModule.mFlags & STF_TOUCH_OTHER_CCT)!=0; + state.standOnObstacle = (mCctModule.mFlags & STF_TOUCH_OBSTACLE)!=0; + state.isMovingUp = (mCctModule.mFlags & STF_IS_MOVING_UP)!=0; + state.collisionFlags = mCollisionFlags; + + if(mManager->mLockingEnabled) + mWriteLock.unlock(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Controller::getInternalStats(PxControllerStats& stats) const +{ + stats.nbFullUpdates = mCctModule.mNbFullUpdates; + stats.nbPartialUpdates = mCctModule.mNbPartialUpdates; + stats.nbIterations = mCctModule.mNbIterations; + stats.nbTessellation = mCctModule.mNbTessellation; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool Controller::setPos(const PxExtendedVec3& pos) +{ + mPosition = pos; + + // Update kinematic actor + if(mKineActor) + { + PxTransform targetPose = mKineActor->getGlobalPose(); + targetPose.p = toVec3(mPosition); // LOSS OF ACCURACY + targetPose.q = mUserParams.mQuatFromUp; + mKineActor->setKinematicTarget(targetPose); + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +bool Controller::createProxyActor(PxPhysics& sdk, const PxGeometry& geometry, const PxMaterial& material, PxClientID clientID) +{ + // PT: we don't disable raycasting or CD because: + // - raycasting is needed for visibility queries (the SDK otherwise doesn't know about the CCTS) + // - collision is needed because the only reason we create actors there is to handle collisions with dynamic shapes + // So it's actually wrong to disable any of those. + + PxTransform globalPose; + globalPose.p = toVec3(mPosition); // LOSS OF ACCURACY + globalPose.q = mUserParams.mQuatFromUp; + + mKineActor = sdk.createRigidDynamic(globalPose); + if(!mKineActor) + return false; + + PxShape* shape = sdk.createShape(geometry, material, true); + mKineActor->attachShape(*shape); + shape->release(); + mKineActor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + + PxRigidBodyExt::updateMassAndInertia(*mKineActor, mProxyDensity); + + if(clientID!=PX_DEFAULT_CLIENT) + mKineActor->setOwnerClient(clientID); + + mScene->addActor(*mKineActor); + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxShape* Controller::getKineShape() const +{ + // PT: TODO: cache this and avoid the virtual call + PxShape* shape = NULL; + PxU32 nb = mKineActor->getShapes(&shape, 1); + PX_ASSERT(nb==1); + PX_UNUSED(nb); + return shape; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.h new file mode 100644 index 0000000..72114fd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctController.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_CONTROLLER +#define CCT_CONTROLLER + +/* Exclude from documentation */ +/** \cond */ + +#include "CctCharacterController.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxMutex.h" + +namespace physx +{ + +class PxPhysics; +class PxScene; +class PxRigidDynamic; +class PxGeometry; +class PxMaterial; + +namespace Cct +{ + class CharacterControllerManager; + + class Controller : public PxUserAllocated + { + PX_NOCOPY(Controller) + public: + Controller(const PxControllerDesc& desc, PxScene* scene); + virtual ~Controller(); + + void releaseInternal(); + void getInternalState(PxControllerState& state) const; + void getInternalStats(PxControllerStats& stats) const; + + virtual PxF32 getHalfHeightInternal() const = 0; + virtual bool getWorldBox(PxExtendedBounds3& box) const = 0; + virtual PxController* getPxController() = 0; + + void onOriginShift(const PxVec3& shift); + + void onRelease(const PxBase& observed); + + void setCctManager(CharacterControllerManager* cm) + { + mManager = cm; + mCctModule.setCctManager(cm); + } + + PX_FORCE_INLINE CharacterControllerManager* getCctManager() { return mManager; } + PX_FORCE_INLINE PxU64 getContextId() const { return PxU64(mScene); } + + PxControllerShapeType::Enum mType; + // User params + CCTParams mUserParams; + PxUserControllerHitReport* mReportCallback; + PxControllerBehaviorCallback* mBehaviorCallback; + void* mUserData; + // Internal data + SweepTest mCctModule; // Internal CCT object. Optim test for Ubi. + PxRigidDynamic* mKineActor; // Associated kinematic actor + PxExtendedVec3 mPosition; // Current position + PxVec3 mDeltaXP; + PxVec3 mOverlapRecover; + PxScene* mScene; // Handy scene owner + PxU32 mPreviousSceneTimestamp; + PxF64 mGlobalTime; + PxF64 mPreviousGlobalTime; + PxF32 mProxyDensity; // Density for proxy actor + PxF32 mProxyScaleCoeff; // Scale coeff for proxy actor + PxControllerCollisionFlags mCollisionFlags; // Last known collision flags (PxControllerCollisionFlag) + bool mCachedStandingOnMoving; + bool mRegisterDeletionListener; + mutable PxMutex mWriteLock; // Lock used for guarding touched pointers and cache data from overwriting + // during onRelease call. + protected: + // Internal methods + void setUpDirectionInternal(const PxVec3& up); + PxShape* getKineShape() const; + bool createProxyActor(PxPhysics& sdk, const PxGeometry& geometry, const PxMaterial& material, PxClientID clientID); + bool setPos(const PxExtendedVec3& pos); + void findTouchedObject(const PxControllerFilters& filters, const PxObstacleContext* obstacleContext, const PxVec3& upDirection); + bool rideOnTouchedObject(SweptVolume& volume, const PxVec3& upDirection, PxVec3& disp, const PxObstacleContext* obstacleContext); + PxControllerCollisionFlags move(SweptVolume& volume, const PxVec3& disp, PxF32 minDist, PxF32 elapsedTime, const PxControllerFilters& filters, const PxObstacleContext* obstacles, bool constrainedClimbingMode); + bool filterTouchedShape(const PxControllerFilters& filters); + + PX_FORCE_INLINE float computeTimeCoeff() + { + const float elapsedTime = float(mGlobalTime - mPreviousGlobalTime); + mPreviousGlobalTime = mGlobalTime; + return 1.0f / elapsedTime; + } + + CharacterControllerManager* mManager; // Owner manager + }; + +} // namespace Cct + +} + +/** \endcond */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctInternalStructs.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctInternalStructs.h new file mode 100644 index 0000000..706db9c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctInternalStructs.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_INTERNAL_STRUCTS_H +#define CCT_INTERNAL_STRUCTS_H + +#include "CctController.h" + +namespace physx +{ + class PxObstacle; // (*) + +namespace Cct +{ + class ObstacleContext; + + enum UserObjectType + { + USER_OBJECT_CCT = 0, + USER_OBJECT_BOX_OBSTACLE = 1, + USER_OBJECT_CAPSULE_OBSTACLE = 2 + }; + + PX_FORCE_INLINE PxU32 encodeUserObject(PxU32 index, UserObjectType type) + { + PX_ASSERT(index<=0xffff); + PX_ASSERT(PxU32(type)<=0xffff); + return (PxU16(index)<<16)|PxU32(type); + } + + PX_FORCE_INLINE UserObjectType decodeType(PxU32 code) + { + return UserObjectType(code & 0xffff); + } + + PX_FORCE_INLINE PxU32 decodeIndex(PxU32 code) + { + return code>>16; + } + + struct PxInternalCBData_OnHit : InternalCBData_OnHit + { + Controller* controller; + const ObstacleContext* obstacles; + const PxObstacle* touchedObstacle; + PxObstacleHandle touchedObstacleHandle; + }; + + struct PxInternalCBData_FindTouchedGeom : InternalCBData_FindTouchedGeom + { + PxScene* scene; + PxRenderBuffer* renderBuffer; // Render buffer from controller manager, not the one from the scene + + PxHashSet* cctShapeHashSet; + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp new file mode 100644 index 0000000..9ae34b6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctObstacleContext.cpp @@ -0,0 +1,536 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "CctObstacleContext.h" +#include "CctCharacterControllerManager.h" +#include "foundation/PxUtilities.h" + +using namespace physx; +using namespace Cct; + +//! Initial list size +#define DEFAULT_HANDLEMANAGER_SIZE 2 + +HandleManager::HandleManager() : mCurrentNbObjects(0), mNbFreeIndices(0) +{ + mMaxNbObjects = DEFAULT_HANDLEMANAGER_SIZE; + mObjects = PX_ALLOCATE(void*, mMaxNbObjects, "HandleManager"); + mOutToIn = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); + mInToOut = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); + mStamps = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); + PxMemSet(mOutToIn, 0xff, mMaxNbObjects*sizeof(PxU16)); + PxMemSet(mInToOut, 0xff, mMaxNbObjects*sizeof(PxU16)); + PxMemZero(mStamps, mMaxNbObjects*sizeof(PxU16)); +} + +HandleManager::~HandleManager() +{ + SetupLists(); +} + +bool HandleManager::SetupLists(void** objects, PxU16* oti, PxU16* ito, PxU16* stamps) +{ + // Release old data + PX_FREE(mStamps); + PX_FREE(mInToOut); + PX_FREE(mOutToIn); + PX_FREE(mObjects); + // Assign new data + mObjects = objects; + mOutToIn = oti; + mInToOut = ito; + mStamps = stamps; + return true; +} + +Handle HandleManager::Add(void* object) +{ + // Are there any free indices I should recycle? + if(mNbFreeIndices) + { + const PxU16 FreeIndex = mInToOut[mCurrentNbObjects];// Get the recycled virtual index + mObjects[mCurrentNbObjects] = object; // The physical location is always at the end of the list (it never has holes). + mOutToIn[FreeIndex] = PxTo16(mCurrentNbObjects++); // Update virtual-to-physical remapping table. + mNbFreeIndices--; + return Handle((mStamps[FreeIndex]<<16)|FreeIndex); // Return virtual index (handle) to the client app + } + else + { + PX_ASSERT_WITH_MESSAGE(mCurrentNbObjects<0xffff ,"Internal error - 64K objects in HandleManager!"); + + // Is the array large enough for another entry? + if(mCurrentNbObjects==mMaxNbObjects) + { + // Nope! Resize all arrays (could be avoided with linked lists... one day) + mMaxNbObjects<<=1; // The more you eat, the more you're given + if(mMaxNbObjects>0xffff) mMaxNbObjects = 0xffff; // Clamp to 64K + void** NewList = PX_ALLOCATE(void*, mMaxNbObjects, "HandleManager"); // New physical list + PxU16* NewOTI = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); // New remapping table + PxU16* NewITO = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); // New remapping table + PxU16* NewStamps = PX_ALLOCATE(PxU16, mMaxNbObjects, "HandleManager"); // New stamps + PxMemCopy(NewList, mObjects, mCurrentNbObjects*sizeof(void*)); // Copy old data + PxMemCopy(NewOTI, mOutToIn, mCurrentNbObjects*sizeof(PxU16)); // Copy old data + PxMemCopy(NewITO, mInToOut, mCurrentNbObjects*sizeof(PxU16)); // Copy old data + PxMemCopy(NewStamps, mStamps, mCurrentNbObjects*sizeof(PxU16)); // Copy old data + PxMemSet(NewOTI+mCurrentNbObjects, 0xff, (mMaxNbObjects-mCurrentNbObjects)*sizeof(PxU16)); + PxMemSet(NewITO+mCurrentNbObjects, 0xff, (mMaxNbObjects-mCurrentNbObjects)*sizeof(PxU16)); + PxMemZero(NewStamps+mCurrentNbObjects, (mMaxNbObjects-mCurrentNbObjects)*sizeof(PxU16)); + SetupLists(NewList, NewOTI, NewITO, NewStamps); + } + + mObjects[mCurrentNbObjects] = object; // Store object at mCurrentNbObjects = physical index = virtual index + mOutToIn[mCurrentNbObjects] = PxTo16(mCurrentNbObjects); // Update virtual-to-physical remapping table. + mInToOut[mCurrentNbObjects] = PxTo16(mCurrentNbObjects); // Update physical-to-virtual remapping table. + PxU32 tmp = mCurrentNbObjects++; + return (mStamps[tmp]<<16)|tmp; // Return virtual index (handle) to the client app + } +} + +void HandleManager::Remove(Handle handle) +{ + const PxU16 VirtualIndex = PxU16(handle); + if(VirtualIndex>=mMaxNbObjects) return; // Invalid handle + const PxU16 PhysicalIndex = mOutToIn[VirtualIndex]; // Get the physical index + if(PhysicalIndex==0xffff) return; // Value has already been deleted + if(PhysicalIndex>=mMaxNbObjects) return; // Invalid index + + // There must be at least one valid entry. + if(mCurrentNbObjects) + { + if(mStamps[VirtualIndex]!=handle>>16) return; // Stamp mismatch => index has been recycled + + // Update list so that there's no hole + mObjects[PhysicalIndex] = mObjects[--mCurrentNbObjects];// Move the real object so that the array has no holes. + mOutToIn[mInToOut[mCurrentNbObjects]] = PhysicalIndex; // Update virtual-to-physical remapping table. + mInToOut[PhysicalIndex] = mInToOut[mCurrentNbObjects]; // Update physical-to-virtual remapping table. + // Keep track of the recyclable virtual index + mInToOut[mCurrentNbObjects] = VirtualIndex; // Store the free virtual index/handle at the end of mInToOut + mOutToIn[VirtualIndex] = 0xffff; // Invalidate the entry + mNbFreeIndices++; // One more free index + mStamps[VirtualIndex]++; // Update stamp + } +} + +void* HandleManager::GetObject(Handle handle) const +{ + const PxU16 VirtualIndex = PxU16(handle); + if(VirtualIndex>=mMaxNbObjects) return NULL; // Invalid handle + const PxU16 PhysicalIndex = mOutToIn[VirtualIndex]; // Get physical index + if(PhysicalIndex==0xffff) return NULL; // Object has been deleted + if(PhysicalIndex>=mMaxNbObjects) return NULL; // Index is invalid + if(mStamps[VirtualIndex]!=handle>>16) return NULL; // Index has been recycled + return mObjects[PhysicalIndex]; // Returns stored pointer +} + +bool HandleManager::UpdateObject(Handle handle, void* object) +{ + const PxU16 VirtualIndex = PxU16(handle); + if(VirtualIndex>=mMaxNbObjects) return false; // Invalid handle + const PxU16 PhysicalIndex = mOutToIn[VirtualIndex]; // Get physical index + if(PhysicalIndex==0xffff) return false; // Object has been deleted + if(PhysicalIndex>=mMaxNbObjects) return false; // Index is invalid + if(mStamps[VirtualIndex]!=handle>>16) return false; // Index has been recycled + mObjects[PhysicalIndex] = object; // Updates stored pointer + return true; +} + + +// PT: please do not expose these functions outside of this class, +// as we want to retain the ability to easily modify the handle format if necessary. + +#define NEW_ENCODING +#ifdef NEW_ENCODING +static PX_FORCE_INLINE void* encodeInternalHandle(PxU32 index, PxGeometryType::Enum type) +{ + PX_ASSERT(index<=0xffff); + PX_ASSERT(PxU32(type)<=0xffff); + // PT: we do type+1 to ban internal handles with a 0 value, since it's reserved for NULL pointers + return reinterpret_cast((size_t(index)<<16)|(size_t(type)+1)); +} + +static PX_FORCE_INLINE PxGeometryType::Enum decodeInternalType(void* handle) +{ + return PxGeometryType::Enum((PxU32(size_t(handle)) & 0xffff)-1); +} + +static PX_FORCE_INLINE PxU32 decodeInternalIndex(void* handle) +{ + return (PxU32(size_t(handle)))>>16; +} +#else +static PX_FORCE_INLINE ObstacleHandle encodeHandle(PxU32 index, PxGeometryType::Enum type) +{ + PX_ASSERT(index<=0xffff); + PX_ASSERT(type<=0xffff); + return (PxU16(index)<<16)|PxU32(type); +} + +static PX_FORCE_INLINE PxGeometryType::Enum decodeType(ObstacleHandle handle) +{ + return PxGeometryType::Enum(handle & 0xffff); +} + +static PX_FORCE_INLINE PxU32 decodeIndex(ObstacleHandle handle) +{ + return handle>>16; +} +#endif + +ObstacleContext::ObstacleContext(CharacterControllerManager& cctMan) + : mCCTManager(cctMan) +{ +} + +ObstacleContext::~ObstacleContext() +{ +} + +void ObstacleContext::release() +{ + mCCTManager.releaseObstacleContext(*this); +} + +PxControllerManager& ObstacleContext::getControllerManager() const +{ + return mCCTManager; +} + +PxObstacleHandle ObstacleContext::addObstacle(const PxObstacle& obstacle) +{ + const PxGeometryType::Enum type = obstacle.getType(); + if(type==PxGeometryType::eBOX) + { + const PxU32 index = mBoxObstacles.size(); +#ifdef NEW_ENCODING + const PxObstacleHandle handle = mHandleManager.Add(encodeInternalHandle(index, type)); +#else + const PxObstacleHandle handle = encodeHandle(index, type); +#endif + mBoxObstacles.pushBack(InternalBoxObstacle(handle, static_cast(obstacle))); + mCCTManager.onObstacleAdded(handle, this); + return handle; + } + else if(type==PxGeometryType::eCAPSULE) + { + const PxU32 index = mCapsuleObstacles.size(); +#ifdef NEW_ENCODING + const PxObstacleHandle handle = mHandleManager.Add(encodeInternalHandle(index, type)); +#else + const PxObstacleHandle handle = encodeHandle(index, type); +#endif + mCapsuleObstacles.pushBack(InternalCapsuleObstacle(handle, static_cast(obstacle))); + mCCTManager.onObstacleAdded(handle, this); + return handle; + } + else return PX_INVALID_OBSTACLE_HANDLE; +} + +#ifdef NEW_ENCODING +template +static PX_FORCE_INLINE void remove(HandleManager& manager, void* object, PxObstacleHandle handle, PxU32 index, PxU32 size, const PxArray& obstacles) +{ + manager.Remove(handle); + if(index!=size-1) + { + bool status = manager.UpdateObject(obstacles[size-1].mHandle, object); + PX_ASSERT(status); + PX_UNUSED(status); + } +} +#endif + +bool ObstacleContext::removeObstacle(PxObstacleHandle handle) +{ +#ifdef NEW_ENCODING + void* object = mHandleManager.GetObject(handle); + if(!object) + return false; + const PxGeometryType::Enum type = decodeInternalType(object); + const PxU32 index = decodeInternalIndex(object); +#else + const PxGeometryType::Enum type = decodeType(handle); + const PxU32 index = decodeIndex(handle); +#endif + + if(type==PxGeometryType::eBOX) + { + const PxU32 size = mBoxObstacles.size(); + PX_ASSERT(index=size) + return false; + +#ifdef NEW_ENCODING + remove(mHandleManager, object, handle, index, size, mBoxObstacles); +#endif + mBoxObstacles.replaceWithLast(index); +#ifdef NEW_ENCODING + mCCTManager.onObstacleRemoved(handle); +#else + mCCTManager.onObstacleRemoved(handle, encodeHandle(size-1, type)); +#endif + return true; + } + else if(type==PxGeometryType::eCAPSULE) + { + const PxU32 size = mCapsuleObstacles.size(); + PX_ASSERT(index=size) + return false; + +#ifdef NEW_ENCODING + remove(mHandleManager, object, handle, index, size, mCapsuleObstacles); +#endif + + mCapsuleObstacles.replaceWithLast(index); +#ifdef NEW_ENCODING + mCCTManager.onObstacleRemoved(handle); +#else + mCCTManager.onObstacleRemoved(handle, encodeHandle(size-1, type)); +#endif + return true; + } + else return false; +} + +bool ObstacleContext::updateObstacle(PxObstacleHandle handle, const PxObstacle& obstacle) +{ +#ifdef NEW_ENCODING + void* object = mHandleManager.GetObject(handle); + if(!object) + return false; + const PxGeometryType::Enum type = decodeInternalType(object); + PX_ASSERT(type==obstacle.getType()); + if(type!=obstacle.getType()) + return false; + const PxU32 index = decodeInternalIndex(object); +#else + const PxGeometryType::Enum type = decodeType(handle); + PX_ASSERT(type==obstacle.getType()); + if(type!=obstacle.getType()) + return false; + const PxU32 index = decodeIndex(handle); +#endif + + if(type==PxGeometryType::eBOX) + { + const PxU32 size = mBoxObstacles.size(); + PX_ASSERT(index=size) + return false; + + mBoxObstacles[index].mData = static_cast(obstacle); + mCCTManager.onObstacleUpdated(handle,this); + return true; + } + else if(type==PxGeometryType::eCAPSULE) + { + const PxU32 size = mCapsuleObstacles.size(); + PX_ASSERT(index=size) + return false; + + mCapsuleObstacles[index].mData = static_cast(obstacle); + mCCTManager.onObstacleUpdated(handle,this); + return true; + } + else return false; +} + +PxU32 ObstacleContext::getNbObstacles() const +{ + return mBoxObstacles.size() + mCapsuleObstacles.size(); +} + +const PxObstacle* ObstacleContext::getObstacle(PxU32 i) const +{ + const PxU32 nbBoxes = mBoxObstacles.size(); + if(i=size) + return NULL; + PX_ASSERT(mBoxObstacles[index].mHandle==handle); + return &mBoxObstacles[index].mData; + } + else if(type==PxGeometryType::eCAPSULE) + { + const PxU32 size = mCapsuleObstacles.size(); + if(index>=size) + return NULL; + PX_ASSERT(mCapsuleObstacles[index].mHandle==handle); + return &mCapsuleObstacles[index].mData; + } + else return NULL; +} + +#include "GuRaycastTests.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +using namespace Gu; +const PxObstacle* ObstacleContext::raycastSingle(PxGeomRaycastHit& hit, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, PxObstacleHandle& obstacleHandle) const +{ + PxGeomRaycastHit localHit; + PxF32 t = FLT_MAX; + const PxObstacle* touchedObstacle = NULL; + + const PxHitFlags hitFlags = PxHitFlags(0); + + { + const RaycastFunc raycastFunc = Gu::getRaycastFuncTable()[PxGeometryType::eBOX]; + PX_ASSERT(raycastFunc); + + const PxU32 nbExtraBoxes = mBoxObstacles.size(); + for(PxU32 i=0;i mBoxObstacles; + + struct InternalCapsuleObstacle + { + InternalCapsuleObstacle(PxObstacleHandle handle, const PxCapsuleObstacle& data) : mHandle(handle), mData(data) {} + + PxObstacleHandle mHandle; + PxCapsuleObstacle mData; + }; + PxArray mCapsuleObstacles; + + private: + ObstacleContext& operator=(const ObstacleContext&); + HandleManager mHandleManager; + CharacterControllerManager& mCCTManager; + }; + + +} // namespace Cct + +} + +/** \endcond */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp new file mode 100644 index 0000000..55c82b6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.cpp @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CctSweptBox.h" +#include "CctCharacterController.h" + +using namespace physx; +using namespace Cct; + +SweptBox::SweptBox() +{ + mType = SweptVolumeType::eBOX; +} + +SweptBox::~SweptBox() +{ +} + +void SweptBox::computeTemporalBox(const SweepTest& test, PxExtendedBounds3& box, const PxExtendedVec3& center, const PxVec3& direction) const +{ + const float radius = PxMax(mExtents.y, mExtents.z); + const float height = 2.0f * mExtents.x; + Cct::computeTemporalBox(box, radius, height, test.mUserParams.mContactOffset, test.mUserParams.mMaxJumpHeight, test.mUserParams.mUpDirection, center, direction); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.h new file mode 100644 index 0000000..e88a65b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptBox.h @@ -0,0 +1,54 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_SWEPT_BOX +#define CCT_SWEPT_BOX + +#include "CctSweptVolume.h" + +namespace physx +{ +namespace Cct +{ + + class SweptBox : public SweptVolume + { + public: + SweptBox(); + virtual ~SweptBox(); + + virtual void computeTemporalBox(const SweepTest&, PxExtendedBounds3& box, const PxExtendedVec3& center, const PxVec3& direction) const PX_OVERRIDE; + + PxVec3 mExtents; + }; + +} // namespace Cct + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp new file mode 100644 index 0000000..84c5b72 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.cpp @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CctSweptCapsule.h" +#include "CctCharacterController.h" + +using namespace physx; +using namespace Cct; + +SweptCapsule::SweptCapsule() +{ + mType = SweptVolumeType::eCAPSULE; +} + +SweptCapsule::~SweptCapsule() +{ +} + +void SweptCapsule::computeTemporalBox(const SweepTest& test, PxExtendedBounds3& box, const PxExtendedVec3& center, const PxVec3& direction) const +{ + Cct::computeTemporalBox(box, mRadius, mHeight, test.mUserParams.mContactOffset, test.mUserParams.mMaxJumpHeight, test.mUserParams.mUpDirection, center, direction); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.h new file mode 100644 index 0000000..7034a62 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptCapsule.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_SWEPT_CAPSULE +#define CCT_SWEPT_CAPSULE + +#include "CctSweptVolume.h" + +namespace physx +{ +namespace Cct +{ + + class SweptCapsule : public SweptVolume + { + public: + SweptCapsule(); + virtual ~SweptCapsule(); + + virtual void computeTemporalBox(const SweepTest&, PxExtendedBounds3& box, const PxExtendedVec3& center, const PxVec3& direction) const PX_OVERRIDE; + + PxF32 mRadius; + PxF32 mHeight; + }; + +} // namespace Cct + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp new file mode 100644 index 0000000..7d106b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "CctSweptVolume.h" + +using namespace physx; +using namespace Cct; + +SweptVolume::SweptVolume() +{ + mType = SweptVolumeType::eLAST; +} + +SweptVolume::~SweptVolume() +{ +} + +void Cct::computeTemporalBox(PxExtendedBounds3& _box, float radius, float height, float contactOffset, float maxJumpHeight, const PxVec3& upDirection, const PxExtendedVec3& center, const PxVec3& direction) +{ + const float r = radius + contactOffset; + PxVec3 extents(r); + const float halfHeight = height*0.5f; + extents.x += fabsf(upDirection.x)*halfHeight; + extents.y += fabsf(upDirection.y)*halfHeight; + extents.z += fabsf(upDirection.z)*halfHeight; + + PxExtendedBounds3 box; + setCenterExtents(box, center, extents); + + { + PxExtendedBounds3 destBox; + PxExtendedVec3 tmp = center; + tmp += direction; + setCenterExtents(destBox, tmp, extents); + add(box, destBox); + } + + if(maxJumpHeight!=0.0f) + { + PxExtendedBounds3 destBox; + PxExtendedVec3 tmp = center; + tmp -= upDirection * maxJumpHeight; + setCenterExtents(destBox, tmp, extents); + add(box, destBox); + } + + _box = box; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.h new file mode 100644 index 0000000..4fe9894 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctSweptVolume.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef CCT_SWEPT_VOLUME +#define CCT_SWEPT_VOLUME + +#include "CctUtils.h" + +namespace physx +{ +namespace Cct +{ + + struct SweptVolumeType + { + enum Enum + { + eBOX, + eCAPSULE, + + eLAST + }; + }; + + class SweepTest; + + class SweptVolume + { + public: + SweptVolume(); + virtual ~SweptVolume(); + + virtual void computeTemporalBox(const SweepTest& test, PxExtendedBounds3& box, const PxExtendedVec3& center, const PxVec3& direction) const = 0; + + PX_FORCE_INLINE SweptVolumeType::Enum getType() const { return mType; } + + PxExtendedVec3 mCenter; + PxF32 mHalfHeight; // UBI + protected: + SweptVolumeType::Enum mType; + }; + + void computeTemporalBox(PxExtendedBounds3& _box, float radius, float height, float contactOffset, float maxJumpHeight, const PxVec3& upDirection, const PxExtendedVec3& center, const PxVec3& direction); + +} // namespace Cct + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctUtils.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctUtils.h new file mode 100644 index 0000000..cee5a3c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcharacterkinematic/src/CctUtils.h @@ -0,0 +1,228 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef CCT_UTILS +#define CCT_UTILS + +#include "extensions/PxShapeExt.h" +#include "characterkinematic/PxExtended.h" + +namespace physx +{ + +PX_FORCE_INLINE bool testSlope(const PxVec3& normal, const PxVec3& upDirection, PxF32 slopeLimit) +{ + const float dp = normal.dot(upDirection); + return dp>=0.0f && dp 1e-6f || PxAbs(v.y) > 1e-6f || PxAbs(v.z) > 1e-6f) + return false; + return true; +} + + +#ifdef PX_BIG_WORLDS + + class PxExtendedBox + { + public: + PX_INLINE PxExtendedBox() {} + PX_INLINE PxExtendedBox(const PxExtendedVec3& _center, const PxVec3& _extents, const PxQuat& _rot) : center(_center), extents(_extents), rot(_rot){} + PX_INLINE ~PxExtendedBox() {} + + PxExtendedVec3 center; + PxVec3 extents; + PxQuat rot; + }; + + class PxExtendedSphere + { + public: + PX_INLINE PxExtendedSphere() {} + PX_INLINE ~PxExtendedSphere() {} + PX_INLINE PxExtendedSphere(const PxExtendedVec3& _center, PxF32 _radius) : center(_center), radius(_radius) {} + PX_INLINE PxExtendedSphere(const PxExtendedSphere& sphere) : center(sphere.center), radius(sphere.radius) {} + + PxExtendedVec3 center; //!< Sphere's center + PxF32 radius; //!< Sphere's radius + }; + + struct PxExtendedSegment + { + PX_INLINE const PxExtendedVec3& getOrigin() const + { + return p0; + } + + PX_INLINE void computeDirection(PxVec3& dir) const + { + dir = p1 - p0; + } + + PX_INLINE void computePoint(PxExtendedVec3& pt, PxExtended t) const + { + pt.x = p0.x + t * (p1.x - p0.x); + pt.y = p0.y + t * (p1.y - p0.y); + pt.z = p0.z + t * (p1.z - p0.z); + } + + PxExtendedVec3 p0; //!< Start of segment + PxExtendedVec3 p1; //!< End of segment + }; + + struct PxExtendedCapsule : public PxExtendedSegment + { + PxReal radius; + }; + + struct PxExtendedBounds3 + { + PX_INLINE PxExtendedBounds3() + { + } + + PX_INLINE void setEmpty() + { + // We now use this particular pattern for empty boxes + set(PX_MAX_EXTENDED, PX_MAX_EXTENDED, PX_MAX_EXTENDED, + -PX_MAX_EXTENDED, -PX_MAX_EXTENDED, -PX_MAX_EXTENDED); + } + + PX_INLINE void set(PxExtended minx, PxExtended miny, PxExtended minz, PxExtended maxx, PxExtended maxy, PxExtended maxz) + { + minimum.set(minx, miny, minz); + maximum.set(maxx, maxy, maxz); + } + + PX_INLINE bool isInside(const PxExtendedBounds3& box) const + { + if(box.minimum.x > minimum.x) return false; + if(box.minimum.y > minimum.y) return false; + if(box.minimum.z > minimum.z) return false; + if(box.maximum.x < maximum.x) return false; + if(box.maximum.y < maximum.y) return false; + if(box.maximum.z < maximum.z) return false; + return true; + } + PxExtendedVec3 minimum, maximum; + }; + + PX_INLINE void getCenter(const PxExtendedBounds3& b, PxExtendedVec3& center) + { + center = b.minimum + b.maximum; + center *= 0.5; + } + + PX_INLINE void getExtents(const PxExtendedBounds3& b, PxVec3& extents) + { + extents = b.maximum - b.minimum; + extents *= 0.5f; + } + + PX_INLINE void setCenterExtents(PxExtendedBounds3& b, const PxExtendedVec3& c, const PxVec3& e) + { + b.minimum = c; b.minimum -= e; + b.maximum = c; b.maximum += e; + } + + PX_INLINE void add(PxExtendedBounds3& b, const PxExtendedBounds3& b2) + { + // - if we're empty, minimum = MAX,MAX,MAX => minimum will be b2 in all cases => it will copy b2, ok + // - if b2 is empty, the opposite happens => keep us unchanged => ok + // => same behaviour as before, automatically + b.minimum.minimum(b2.minimum); + b.maximum.maximum(b2.maximum); + } +#else + + #include "foundation/PxBounds3.h" + #include "GuBox.h" + #include "GuCapsule.h" + #include "GuPlane.h" + + typedef Gu::Box PxExtendedBox; + typedef Gu::Sphere PxExtendedSphere; + typedef Gu::Segment PxExtendedSegment; + typedef Gu::Capsule PxExtendedCapsule; + typedef PxBounds3 PxExtendedBounds3; + + PX_INLINE PxExtended distance(const PxVec3& v2, const PxVec3& v) + { + const PxExtended dx = v2.x - v.x; + const PxExtended dy = v2.y - v.y; + const PxExtended dz = v2.z - v.z; + return PxSqrt(dx * dx + dy * dy + dz * dz); + } + + PX_INLINE void getCenter(const PxBounds3& b, PxVec3& center) + { + center = b.minimum + b.maximum; + center *= 0.5; + } + + PX_INLINE void getExtents(const PxBounds3& b, PxVec3& extents) + { + extents = b.maximum - b.minimum; + extents *= 0.5f; + } + + PX_INLINE void setCenterExtents(PxBounds3& b, const PxVec3& center, const PxVec3& extents) + { + b.minimum = center - extents; + b.maximum = center + extents; + } + + PX_INLINE void add(PxBounds3& b, const PxBounds3& b2) + { + // - if we're empty, minimum = MAX,MAX,MAX => minimum will be b2 in all cases => it will copy b2, ok + // - if b2 is empty, the opposite happens => keep us unchanged => ok + // => same behaviour as before, automatically + b.minimum.minimum(b2.minimum); + b.maximum.maximum(b2.maximum); + } +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp new file mode 100644 index 0000000..e1fc7ae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.cpp @@ -0,0 +1,342 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "Cooking.h" +#include "GuCooking.h" +#include "GuBVH.h" + +/////////////////////////////////////////////////////////////////////////////// + +using namespace physx; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +void Cooking::setParams(const PxCookingParams& params) +{ + mParams = params; +} + +const PxCookingParams& Cooking::getParams() const +{ + return mParams; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Cooking::platformMismatch() const +{ + return immediateCooking::platformMismatch(); +} + +/////////////////////////////////////////////////////////////////////////////// + +void Cooking::release() +{ + PX_DELETE_THIS; + + PxDecFoundationRefCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Cooking::validateTriangleMesh(const PxTriangleMeshDesc& desc) const +{ + return immediateCooking::validateTriangleMesh(mParams, desc); +} + +bool Cooking::cookTriangleMesh(const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition) const +{ + return immediateCooking::cookTriangleMesh(mParams, desc, stream, condition); +} + +PxTriangleMesh* Cooking::createTriangleMesh(const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition) const +{ + return immediateCooking::createTriangleMesh(mParams, desc, insertionCallback, condition); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxTetrahedronMesh* Cooking::createTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::createTetrahedronMesh(mParams, meshDesc, insertionCallback); +} + +bool Cooking::cookTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream) const +{ + return immediateCooking::cookTetrahedronMesh(mParams, meshDesc, stream); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Cooking::cookSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream) const +{ + return immediateCooking::cookSoftBodyMesh(mParams, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, stream); +} + +PxCollisionMeshMappingData* Cooking::computeModelsMapping(PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet) const +{ + return immediateCooking::computeModelsMapping(mParams, simulationMesh, collisionMesh, collisionData, vertexToTet); +} + +PxCollisionTetrahedronMeshData* Cooking::computeCollisionData(const PxTetrahedronMeshDesc& collisionMeshDesc) const +{ + return immediateCooking::computeCollisionData(mParams, collisionMeshDesc); +} + +PxSimulationTetrahedronMeshData* Cooking::computeSimulationData(const PxTetrahedronMeshDesc& simulationMeshDesc) const +{ + return immediateCooking::computeSimulationData(mParams, simulationMeshDesc); +} + +PxSoftBodyMesh* Cooking::assembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, + PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::assembleSoftBodyMesh(simulationMesh, simulationData, collisionMesh, collisionData, mappingData, insertionCallback); +} + +PxSoftBodyMesh* Cooking::assembleSoftBodyMesh(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::assembleSoftBodyMesh_Sim(simulationMesh, collisionMesh, mappingData, insertionCallback); +} + +PxSoftBodyMesh* Cooking::createSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::createSoftBodyMesh(mParams, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, insertionCallback); +} + +/////////////////////////////////////////////////////////////////////////////// + +// cook convex mesh from given desc, save the results into stream +bool Cooking::cookConvexMesh(const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition) const +{ + return immediateCooking::cookConvexMesh(mParams, desc, stream, condition); +} + +// cook convex mesh from given desc, copy the results into internal convex mesh +// and insert the mesh into PxPhysics +PxConvexMesh* Cooking::createConvexMesh(const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition) const +{ + return immediateCooking::createConvexMesh(mParams, desc, insertionCallback, condition); +} + +bool Cooking::validateConvexMesh(const PxConvexMeshDesc& desc) const +{ + return immediateCooking::validateConvexMesh(mParams, desc); +} + +bool Cooking::computeHullPolygons(const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback,PxU32& nbVerts, PxVec3*& vertices, + PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) const +{ + return immediateCooking::computeHullPolygons(mParams, mesh, inCallback, nbVerts, vertices, nbIndices, indices, nbPolygons, hullPolygons); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Cooking::cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) const +{ + return immediateCooking::cookHeightField(desc, stream); +} + +PxHeightField* Cooking::createHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::createHeightField(desc, insertionCallback); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Cooking::cookBVH(const PxBVHDesc& desc, PxOutputStream& stream) const +{ + return immediateCooking::cookBVH(desc, stream); +} + +PxBVH* Cooking::createBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback) const +{ + return immediateCooking::createBVH(desc, insertionCallback); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxInsertionCallback& Cooking::getStandaloneInsertionCallback() +{ + return *immediateCooking::getInsertionCallback(); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxCooking* PxCreateCooking(PxU32 /*version*/, PxFoundation& foundation, const PxCookingParams& params) +{ + PX_ASSERT(&foundation == &PxGetFoundation()); + PX_UNUSED(foundation); + + PxIncFoundationRefCount(); + + return PX_NEW(Cooking)(params); +} + +/////////////////////////////////////////////////////////////////////////////// + +// PT: temporary for Kit + +#include "cooking/PxCookingInternal.h" +#include "GuTriangleMeshBV4.h" +PxTriangleMesh* Cooking::createTriangleMesh(const PxTriangleMeshInternalData& data) const +{ + TriangleMesh* np; + PX_NEW_SERIALIZED(np, BV4TriangleMesh)(data); + return np; +} + +PxBVH* Cooking::createBVH(const PxBVHInternalData& data) const +{ + BVH* np; + PX_NEW_SERIALIZED(np, BVH)(data); + return np; +} + +physx::PxTriangleMesh* PxCreateTriangleMeshInternal(const physx::PxTriangleMeshInternalData& data, const physx::PxCooking& cooking) +{ + return static_cast(cooking).createTriangleMesh(data); +} + +physx::PxBVH* PxCreateBVHInternal(const physx::PxBVHInternalData& data, const physx::PxCooking& cooking) +{ + return static_cast(cooking).createBVH(data); +} + +//~ PT: temporary for Kit + +/////////////////////////////////////////////////////////////////////////////// + +PxInsertionCallback* PxGetStandaloneInsertionCallback() +{ + return immediateCooking::getInsertionCallback(); +} + +bool PxCookBVH(const PxBVHDesc& desc, PxOutputStream& stream) +{ + return immediateCooking::cookBVH(desc, stream); +} + +PxBVH* PxCreateBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::createBVH(desc, insertionCallback); +} + +bool PxCookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) +{ + return immediateCooking::cookHeightField(desc, stream); +} + +PxHeightField* PxCreateHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::createHeightField(desc, insertionCallback); +} + +bool PxCookConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition) +{ + return immediateCooking::cookConvexMesh(params, desc, stream, condition); +} + +PxConvexMesh* PxCreateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition) +{ + return immediateCooking::createConvexMesh(params, desc, insertionCallback, condition); +} + +bool PxValidateConvexMesh(const PxCookingParams& params, const PxConvexMeshDesc& desc) +{ + return immediateCooking::validateConvexMesh(params, desc); +} + +bool PxComputeHullPolygons(const PxCookingParams& params, const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices, PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) +{ + return immediateCooking::computeHullPolygons(params, mesh, inCallback, nbVerts, vertices, nbIndices, indices, nbPolygons, hullPolygons); +} + +bool PxValidateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc) +{ + return immediateCooking::validateTriangleMesh(params, desc); +} + +PxTriangleMesh* PxCreateTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition) +{ + return immediateCooking::createTriangleMesh(params, desc, insertionCallback, condition); +} + +bool PxCookTriangleMesh(const PxCookingParams& params, const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition) +{ + return immediateCooking::cookTriangleMesh(params, desc, stream, condition); +} + +bool PxCookTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream) +{ + return immediateCooking::cookTetrahedronMesh(params, meshDesc, stream); +} + +PxTetrahedronMesh* PxCreateTetrahedronMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::createTetrahedronMesh(params, meshDesc, insertionCallback); +} + +bool PxCookSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream) +{ + return immediateCooking::cookSoftBodyMesh(params, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, stream); +} + +PxSoftBodyMesh* PxCreateSoftBodyMesh(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::createSoftBodyMesh(params, simulationMeshDesc, collisionMeshDesc, softbodyDataDesc, insertionCallback); +} + +PxCollisionMeshMappingData* PxComputeModelsMapping(const PxCookingParams& params, PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet) +{ + return immediateCooking::computeModelsMapping(params, simulationMesh, collisionMesh, collisionData, vertexToTet); +} + +PxCollisionTetrahedronMeshData* PxComputeCollisionData(const PxCookingParams& params, const PxTetrahedronMeshDesc& collisionMeshDesc) +{ + return immediateCooking::computeCollisionData(params, collisionMeshDesc); +} + +PxSimulationTetrahedronMeshData* PxComputeSimulationData(const PxCookingParams& params, const PxTetrahedronMeshDesc& simulationMeshDesc) +{ + return immediateCooking::computeSimulationData(params, simulationMeshDesc); +} + +PxSoftBodyMesh* PxAssembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::assembleSoftBodyMesh(simulationMesh, simulationData, collisionMesh, collisionData, mappingData, insertionCallback); +} + +PxSoftBodyMesh* PxAssembleSoftBodyMesh_Sim(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) +{ + return immediateCooking::assembleSoftBodyMesh_Sim(simulationMesh, collisionMesh, mappingData, insertionCallback); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.h new file mode 100644 index 0000000..fef1f4d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/Cooking.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef COOKING_H +#define COOKING_H + +#include "foundation/PxMemory.h" +#include "cooking/PxCooking.h" + +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +class TriangleMeshBuilder; +class TetrahedronMeshBuilder; +class ConvexMeshBuilder; +class ConvexHullLib; +class PxInsertionCallback; +struct PxTriangleMeshInternalData; +struct PxBVHInternalData; + +class Cooking : public PxCooking, public PxUserAllocated +{ +public: + Cooking(const PxCookingParams& params): mParams(params) {} + + virtual void release(); + virtual void setParams(const PxCookingParams& params); + virtual const PxCookingParams& getParams() const; + virtual bool platformMismatch() const; + virtual bool cookTriangleMesh(const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition = NULL) const; + virtual PxTriangleMesh* createTriangleMesh(const PxTriangleMeshDesc& desc, PxInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition = NULL) const; + virtual bool validateTriangleMesh(const PxTriangleMeshDesc& desc) const; + + virtual bool cookSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxOutputStream& stream) const; + virtual PxSoftBodyMesh* createSoftBodyMesh(const PxTetrahedronMeshDesc& simulationMeshDesc, const PxTetrahedronMeshDesc& collisionMeshDesc, + const PxSoftBodySimulationDataDesc& softbodyDataDesc, PxInsertionCallback& insertionCallback) const; + + virtual bool cookTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxOutputStream& stream) const; + virtual PxTetrahedronMesh* createTetrahedronMesh(const PxTetrahedronMeshDesc& meshDesc, PxInsertionCallback& insertionCallback) const; + + virtual PxCollisionMeshMappingData* computeModelsMapping(PxTetrahedronMeshData& simulationMesh, const PxTetrahedronMeshData& collisionMesh, const PxSoftBodyCollisionData& collisionData, const PxBoundedData* vertexToTet) const; + virtual PxCollisionTetrahedronMeshData* computeCollisionData(const PxTetrahedronMeshDesc& collisionMeshDesc) const; + virtual PxSimulationTetrahedronMeshData* computeSimulationData(const PxTetrahedronMeshDesc& simulationMeshDesc) const; + virtual PxSoftBodyMesh* assembleSoftBodyMesh(PxTetrahedronMeshData& simulationMesh, PxSoftBodySimulationData& simulationData, PxTetrahedronMeshData& collisionMesh, + PxSoftBodyCollisionData& collisionData, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const; + virtual PxSoftBodyMesh* assembleSoftBodyMesh(PxSimulationTetrahedronMeshData& simulationMesh, PxCollisionTetrahedronMeshData& collisionMesh, PxCollisionMeshMappingData& mappingData, PxInsertionCallback& insertionCallback) const; + + virtual bool cookConvexMesh(const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition) const; + virtual PxConvexMesh* createConvexMesh(const PxConvexMeshDesc& desc, PxInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition) const; + virtual bool validateConvexMesh(const PxConvexMeshDesc& desc) const; + virtual bool computeHullPolygons(const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback,PxU32& nbVerts, PxVec3*& vertices, + PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) const; + virtual bool cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) const; + virtual PxHeightField* createHeightField(const PxHeightFieldDesc& desc, PxInsertionCallback& insertionCallback) const; + virtual bool cookBVH(const PxBVHDesc& desc, PxOutputStream& stream) const; + virtual PxBVH* createBVH(const PxBVHDesc& desc, PxInsertionCallback& insertionCallback) const; + virtual PxInsertionCallback& getStandaloneInsertionCallback(); + + PxTriangleMesh* createTriangleMesh(const PxTriangleMeshInternalData& data) const; + PxBVH* createBVH(const PxBVHInternalData& data) const; + +private: + PxCookingParams mParams; +}; + +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/windows/WindowsCookingDelayLoadHook.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/windows/WindowsCookingDelayLoadHook.cpp new file mode 100644 index 0000000..0421aa4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxcooking/src/windows/WindowsCookingDelayLoadHook.cpp @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "common/windows/PxWindowsDelayLoadHook.h" +#include "foundation/windows/PxWindowsInclude.h" +#include "windows/CmWindowsLoadLibrary.h" + +static const physx::PxDelayLoadHook* gCookingDelayLoadHook = NULL; + +void physx::PxSetPhysXCookingDelayLoadHook(const physx::PxDelayLoadHook* hook) +{ + gCookingDelayLoadHook = hook; +} + +// delay loading is enabled only for non static configuration +#if !defined PX_PHYSX_STATIC_LIB + +// Prior to Visual Studio 2015 Update 3, these hooks were non-const. +#define DELAYIMP_INSECURE_WRITABLE_HOOKS +#include + +using namespace physx; + +#pragma comment(lib, "delayimp") + +FARPROC WINAPI cookingDelayHook(unsigned dliNotify, PDelayLoadInfo pdli) +{ + switch (dliNotify) { + case dliStartProcessing : + break; + + case dliNotePreLoadLibrary : + { + return Cm::physXCommonDliNotePreLoadLibrary(pdli->szDll,gCookingDelayLoadHook); + } + break; + + case dliNotePreGetProcAddress : + break; + + case dliFailLoadLib : + break; + + case dliFailGetProc : + break; + + case dliNoteEndProcessing : + break; + + default : + + return NULL; + } + + return NULL; +} + +PfnDliHook __pfnDliNotifyHook2 = cookingDelayHook; + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp new file mode 100644 index 0000000..6d01e8e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtBroadPhase.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "foundation/PxBounds3.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxFoundation.h" +#include "extensions/PxBroadPhaseExt.h" + +using namespace physx; + +PxU32 PxBroadPhaseExt::createRegionsFromWorldBounds(PxBounds3* regions, const PxBounds3& globalBounds, PxU32 nbSubdiv, PxU32 upAxis) +{ + PX_CHECK_MSG(globalBounds.isValid(), "PxBroadPhaseExt::createRegionsFromWorldBounds(): invalid bounds provided!"); + PX_CHECK_MSG(upAxis<3, "PxBroadPhaseExt::createRegionsFromWorldBounds(): invalid up-axis provided!"); + + const PxVec3& min = globalBounds.minimum; + const PxVec3& max = globalBounds.maximum; + const float dx = (max.x - min.x) / float(nbSubdiv); + const float dy = (max.y - min.y) / float(nbSubdiv); + const float dz = (max.z - min.z) / float(nbSubdiv); + PxU32 nbRegions = 0; + PxVec3 currentMin, currentMax; + for(PxU32 j=0;j releasableObjects; + + for (PxU32 i = 0; i < collection.getNbObjects(); ++i) + { + PxBase* s = &collection.getObject(i); + // pruning structure must be released before its actors + if(s->is()) + { + if(!releasableObjects.empty()) + { + PxBase* first = releasableObjects[0]; + releasableObjects.pushBack(first); + releasableObjects[0] = s; + } + } + else + { + if (s->isReleasable() && (releaseExclusiveShapes || !s->is() || !s->is()->isExclusive())) + releasableObjects.pushBack(s); + } + } + + for (PxU32 i = 0; i < releasableObjects.size(); ++i) + releasableObjects[i]->release(); + + while (collection.getNbObjects() > 0) + collection.remove(collection.getObject(0)); +} + + +void PxCollectionExt::remove(PxCollection& collection, PxType concreteType, PxCollection* to) +{ + PxArray removeObjects; + + for (PxU32 i = 0; i < collection.getNbObjects(); i++) + { + PxBase& object = collection.getObject(i); + if(concreteType == object.getConcreteType()) + { + if(to) + to->add(object); + + removeObjects.pushBack(&object); + } + } + + for (PxU32 i = 0; i < removeObjects.size(); ++i) + collection.remove(*removeObjects[i]); +} + +PxCollection* PxCollectionExt::createCollection(PxPhysics& physics) +{ + PxCollection* collection = PxCreateCollection(); + if (!collection) + return NULL; + + // Collect convexes + { + PxArray objects(physics.getNbConvexMeshes()); + const PxU32 nb = physics.getConvexMeshes(objects.begin(), objects.size()); + PX_ASSERT(nb == objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + // Collect triangle meshes + { + PxArray objects(physics.getNbTriangleMeshes()); + const PxU32 nb = physics.getTriangleMeshes(objects.begin(), objects.size()); + + PX_ASSERT(nb == objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + // Collect heightfields + { + PxArray objects(physics.getNbHeightFields()); + const PxU32 nb = physics.getHeightFields(objects.begin(), objects.size()); + + PX_ASSERT(nb == objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + // Collect materials + { + PxArray objects(physics.getNbMaterials()); + const PxU32 nb = physics.getMaterials(objects.begin(), objects.size()); + + PX_ASSERT(nb == objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + // Collect shapes + { + PxArray objects(physics.getNbShapes()); + const PxU32 nb = physics.getShapes(objects.begin(), objects.size()); + + PX_ASSERT(nb == objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + return collection; +} + +PxCollection* PxCollectionExt::createCollection(PxScene& scene) +{ + PxCollection* collection = PxCreateCollection(); + if (!collection) + return NULL; + + // Collect actors + { + PxActorTypeFlags selectionFlags = PxActorTypeFlag::eRIGID_STATIC | PxActorTypeFlag::eRIGID_DYNAMIC; + + + PxArray objects(scene.getNbActors(selectionFlags)); + const PxU32 nb = scene.getActors(selectionFlags, objects.begin(), objects.size()); + + PX_ASSERT(nb==objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + + // Collect constraints + { + PxArray objects(scene.getNbConstraints()); + const PxU32 nb = scene.getConstraints(objects.begin(), objects.size()); + + PX_ASSERT(nb==objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;i(objects[i]->getExternalReference(typeId)); + if(typeId == PxConstraintExtIDs::eJOINT) + collection->add(*joint); + } + } + + // Collect articulations + { + PxArray objects(scene.getNbArticulations()); + const PxU32 nb = scene.getArticulations(objects.begin(), objects.size()); + + PX_ASSERT(nb==objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + // Collect aggregates + { + PxArray objects(scene.getNbAggregates()); + const PxU32 nb = scene.getAggregates(objects.begin(), objects.size()); + + PX_ASSERT(nb==objects.size()); + PX_UNUSED(nb); + + for(PxU32 i=0;iadd(*objects[i]); + } + + return collection; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConstraintHelper.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConstraintHelper.h new file mode 100644 index 0000000..0843385 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConstraintHelper.h @@ -0,0 +1,387 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_CONSTRAINT_HELPER_H +#define EXT_CONSTRAINT_HELPER_H + +#include "foundation/PxAssert.h" +#include "foundation/PxTransform.h" +#include "foundation/PxMat33.h" +#include "foundation/PxSIMDHelpers.h" +#include "extensions/PxD6Joint.h" +#include "ExtJointData.h" +#include "foundation/PxVecMath.h" + +namespace physx +{ +namespace Ext +{ + namespace joint + { + PX_INLINE void computeJointFrames(PxTransform& cA2w, PxTransform& cB2w, const JointData& data, const PxTransform& bA2w, const PxTransform& bB2w) + { + PX_ASSERT(bA2w.isValid() && bB2w.isValid()); + + cA2w = bA2w.transform(data.c2b[0]); + cB2w = bB2w.transform(data.c2b[1]); + + PX_ASSERT(cA2w.isValid() && cB2w.isValid()); + } + + PX_INLINE void computeDerived(const JointData& data, + const PxTransform& bA2w, const PxTransform& bB2w, + PxTransform& cA2w, PxTransform& cB2w, PxTransform& cB2cA, + bool useShortestPath=true) + { + computeJointFrames(cA2w, cB2w, data, bA2w, bB2w); + + if(useShortestPath) + { + if(cA2w.q.dot(cB2w.q)<0.0f) // minimum error quat + cB2w.q = -cB2w.q; + } + + cB2cA = cA2w.transformInv(cB2w); + PX_ASSERT(cB2cA.isValid()); + } + + PX_INLINE PxVec3 truncateLinear(const PxVec3& in, PxReal tolerance, bool& truncated) + { + const PxReal m = in.magnitudeSquared(); + truncated = m>tolerance * tolerance; + return truncated ? in * PxRecipSqrt(m) * tolerance : in; + } + + PX_INLINE PxQuat truncateAngular(const PxQuat& in, PxReal sinHalfTol, PxReal cosHalfTol, bool& truncated) + { + truncated = false; + + if(sinHalfTol > 0.9999f) // fixes numerical tolerance issue of projecting because quat is not exactly normalized + return in; + + const PxQuat q = in.w>=0.0f ? in : -in; + + const PxVec3 im = q.getImaginaryPart(); + const PxReal m = im.magnitudeSquared(); + truncated = m>sinHalfTol*sinHalfTol; + if(!truncated) + return in; + + const PxVec3 outV = im * sinHalfTol * PxRecipSqrt(m); + return PxQuat(outV.x, outV.y, outV.z, cosHalfTol); + } + + PX_FORCE_INLINE void projectTransforms(PxTransform& bA2w, PxTransform& bB2w, + const PxTransform& cA2w, const PxTransform& cB2w, + const PxTransform& cB2cA, const JointData& data, bool projectToA) + { + PX_ASSERT(cB2cA.isValid()); + + // normalization here is unfortunate: long chains of projected constraints can result in + // accumulation of error in the quaternion which eventually leaves the quaternion + // magnitude outside the validation range. The approach here is slightly overconservative + // in that we could just normalize the quaternions which are out of range, but since we + // regard projection as an occasional edge case it shouldn't be perf-sensitive, and + // this way we maintain the invariant (also maintained by the dynamics integrator) that + // body quats are properly normalized up to FP error. + + if(projectToA) + { + bB2w = cA2w.transform(cB2cA.transform(data.c2b[1].getInverse())); + bB2w.q.normalize(); + } + else + { + bA2w = cB2w.transform(cB2cA.transformInv(data.c2b[0].getInverse())); + bA2w.q.normalize(); + } + + PX_ASSERT(bA2w.isValid()); + PX_ASSERT(bB2w.isValid()); + } + + PX_INLINE void computeJacobianAxes(PxVec3 row[3], const PxQuat& qa, const PxQuat& qb) + { + // Compute jacobian matrix for (qa* qb) [[* means conjugate in this expr]] + // d/dt (qa* qb) = 1/2 L(qa*) R(qb) (omega_b - omega_a) + // result is L(qa*) R(qb), where L(q) and R(q) are left/right q multiply matrix + + const PxReal wa = qa.w, wb = qb.w; + const PxVec3 va(qa.x,qa.y,qa.z), vb(qb.x,qb.y,qb.z); + + const PxVec3 c = vb*wa + va*wb; + const PxReal d0 = wa*wb; + const PxReal d1 = va.dot(vb); + const PxReal d = d0 - d1; + + row[0] = (va * vb.x + vb * va.x + PxVec3(d, c.z, -c.y)) * 0.5f; + row[1] = (va * vb.y + vb * va.y + PxVec3(-c.z, d, c.x)) * 0.5f; + row[2] = (va * vb.z + vb * va.z + PxVec3(c.y, -c.x, d)) * 0.5f; + + if((d0 + d1) != 0.0f) // check if relative rotation is 180 degrees which can lead to singular matrix + return; + else + { + row[0].x += PX_EPS_F32; + row[1].y += PX_EPS_F32; + row[2].z += PX_EPS_F32; + } + } + + PX_FORCE_INLINE Px1DConstraint* _linear(const PxVec3& axis, const PxVec3& ra, const PxVec3& rb, PxReal posErr, PxConstraintSolveHint::Enum hint, Px1DConstraint* c) + { + c->solveHint = PxU16(hint); + c->linear0 = axis; + c->angular0 = ra.cross(axis); + c->linear1 = axis; + c->angular1 = rb.cross(axis); + c->geometricError = posErr; + PX_ASSERT(c->linear0.isFinite()); + PX_ASSERT(c->linear1.isFinite()); + PX_ASSERT(c->angular0.isFinite()); + PX_ASSERT(c->angular1.isFinite()); + return c; + } + + PX_FORCE_INLINE Px1DConstraint* _angular(const PxVec3& axis, PxReal posErr, PxConstraintSolveHint::Enum hint, Px1DConstraint* c) + { + c->solveHint = PxU16(hint); + c->linear0 = PxVec3(0.0f); + c->angular0 = axis; + c->linear1 = PxVec3(0.0f); + c->angular1 = axis; + c->geometricError = posErr; + c->flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + return c; + } + + class ConstraintHelper + { + Px1DConstraint* mConstraints; + Px1DConstraint* mCurrent; + PxVec3 mRa, mRb; + PxVec3 mCA2w, mCB2w; + + public: + ConstraintHelper(Px1DConstraint* c, const PxVec3& ra, const PxVec3& rb) + : mConstraints(c), mCurrent(c), mRa(ra), mRb(rb) {} + + /*PX_NOINLINE*/ ConstraintHelper(Px1DConstraint* c, PxConstraintInvMassScale& invMassScale, + PxTransform& cA2w, PxTransform& cB2w, PxVec3p& body0WorldOffset, + const JointData& data, const PxTransform& bA2w, const PxTransform& bB2w) + : mConstraints(c), mCurrent(c) + { + using namespace aos; + + V4StoreA(V4LoadA(&data.invMassScale.linear0), &invMassScale.linear0); //invMassScale = data.invMassScale; + + computeJointFrames(cA2w, cB2w, data, bA2w, bB2w); + + const PxVec3 ra = cB2w.p - bA2w.p; + body0WorldOffset = ra; + + mRa = ra; + mRb = cB2w.p - bB2w.p; + + mCA2w = cA2w.p; + mCB2w = cB2w.p; + } + + PX_FORCE_INLINE const PxVec3& getRa() const { return mRa; } + PX_FORCE_INLINE const PxVec3& getRb() const { return mRb; } + + // hard linear & angular + PX_FORCE_INLINE void linearHard(const PxVec3& axis, PxReal posErr) + { + Px1DConstraint* c = linear(axis, posErr, PxConstraintSolveHint::eEQUALITY); + c->flags |= Px1DConstraintFlag::eOUTPUT_FORCE; + } + + PX_FORCE_INLINE void angularHard(const PxVec3& axis, PxReal posErr) + { + Px1DConstraint* c = angular(axis, posErr, PxConstraintSolveHint::eEQUALITY); + c->flags |= Px1DConstraintFlag::eOUTPUT_FORCE; + } + + // limited linear & angular + PX_FORCE_INLINE void linearLimit(const PxVec3& axis, PxReal ordinate, PxReal limitValue, const PxJointLimitParameters& limit) + { + const PxReal pad = limit.isSoft() ? 0.0f : limit.contactDistance_deprecated; + + if(ordinate + pad > limitValue) + addLimit(linear(axis, limitValue - ordinate, PxConstraintSolveHint::eNONE), limit); + } + + PX_FORCE_INLINE void angularLimit(const PxVec3& axis, PxReal ordinate, PxReal limitValue, PxReal pad, const PxJointLimitParameters& limit) + { + if(limit.isSoft()) + pad = 0.0f; + + if(ordinate + pad > limitValue) + addLimit(angular(axis, limitValue - ordinate, PxConstraintSolveHint::eNONE), limit); + } + + PX_FORCE_INLINE void angularLimit(const PxVec3& axis, PxReal error, const PxJointLimitParameters& limit) + { + addLimit(angular(axis, error, PxConstraintSolveHint::eNONE), limit); + } + + PX_FORCE_INLINE void anglePair(PxReal angle, PxReal lower, PxReal upper, PxReal pad, const PxVec3& axis, const PxJointLimitParameters& limit) + { + PX_ASSERT(lower upper-pad) + angularLimit(axis, (upper - angle), limit); + } + + // driven linear & angular + + PX_FORCE_INLINE void linear(const PxVec3& axis, PxReal velTarget, PxReal error, const PxD6JointDrive& drive) + { + addDrive(linear(axis, error, PxConstraintSolveHint::eNONE), velTarget, drive); + } + + PX_FORCE_INLINE void angular(const PxVec3& axis, PxReal velTarget, PxReal error, const PxD6JointDrive& drive, PxConstraintSolveHint::Enum hint = PxConstraintSolveHint::eNONE) + { + addDrive(angular(axis, error, hint), velTarget, drive); + } + + PX_FORCE_INLINE PxU32 getCount() const { return PxU32(mCurrent - mConstraints); } + + void prepareLockedAxes(const PxQuat& qA, const PxQuat& qB, const PxVec3& cB2cAp, PxU32 lin, PxU32 ang, PxVec3& raOut, PxVec3& rbOut) + { + Px1DConstraint* current = mCurrent; + + PxVec3 errorVector(0.0f); + + PxVec3 ra = mRa; + PxVec3 rb = mRb; + if(lin) + { + const PxMat33Padded axes(qA); + + if(lin&1) errorVector -= axes.column0 * cB2cAp.x; + if(lin&2) errorVector -= axes.column1 * cB2cAp.y; + if(lin&4) errorVector -= axes.column2 * cB2cAp.z; + + ra += errorVector; + + if(lin&1) _linear(axes.column0, ra, rb, -cB2cAp.x, PxConstraintSolveHint::eEQUALITY, current++); + if(lin&2) _linear(axes.column1, ra, rb, -cB2cAp.y, PxConstraintSolveHint::eEQUALITY, current++); + if(lin&4) _linear(axes.column2, ra, rb, -cB2cAp.z, PxConstraintSolveHint::eEQUALITY, current++); + } + + if (ang) + { + const PxQuat qB2qA = qA.getConjugate() * qB; + + PxVec3 row[3]; + computeJacobianAxes(row, qA, qB); + if (ang & 1) _angular(row[0], -qB2qA.x, PxConstraintSolveHint::eEQUALITY, current++); + if (ang & 2) _angular(row[1], -qB2qA.y, PxConstraintSolveHint::eEQUALITY, current++); + if (ang & 4) _angular(row[2], -qB2qA.z, PxConstraintSolveHint::eEQUALITY, current++); + } + + raOut = ra; + rbOut = rb; + + for(Px1DConstraint* front = mCurrent; front < current; front++) + front->flags |= Px1DConstraintFlag::eOUTPUT_FORCE; + + mCurrent = current; + } + + PX_FORCE_INLINE Px1DConstraint* getConstraintRow() + { + return mCurrent++; + } + + private: + PX_FORCE_INLINE Px1DConstraint* linear(const PxVec3& axis, PxReal posErr, PxConstraintSolveHint::Enum hint) + { + return _linear(axis, mRa, mRb, posErr, hint, mCurrent++); + } + + PX_FORCE_INLINE Px1DConstraint* angular(const PxVec3& axis, PxReal posErr, PxConstraintSolveHint::Enum hint) + { + return _angular(axis, posErr, hint, mCurrent++); + } + + void addLimit(Px1DConstraint* c, const PxJointLimitParameters& limit) + { + PxU16 flags = PxU16(c->flags | Px1DConstraintFlag::eOUTPUT_FORCE); + + if(limit.isSoft()) + { + flags |= Px1DConstraintFlag::eSPRING; + c->mods.spring.stiffness = limit.stiffness; + c->mods.spring.damping = limit.damping; + } + else + { + c->solveHint = PxConstraintSolveHint::eINEQUALITY; + c->mods.bounce.restitution = limit.restitution; + c->mods.bounce.velocityThreshold = limit.bounceThreshold; + if(c->geometricError>0.0f) + flags |= Px1DConstraintFlag::eKEEPBIAS; + if(limit.restitution>0.0f) + flags |= Px1DConstraintFlag::eRESTITUTION; + } + + c->flags = flags; + c->minImpulse = 0.0f; + } + + void addDrive(Px1DConstraint* c, PxReal velTarget, const PxD6JointDrive& drive) + { + c->velocityTarget = velTarget; + + PxU16 flags = PxU16(c->flags | Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eHAS_DRIVE_LIMIT); + if(drive.flags & PxD6JointDriveFlag::eACCELERATION) + flags |= Px1DConstraintFlag::eACCELERATION_SPRING; + c->flags = flags; + c->mods.spring.stiffness = drive.stiffness; + c->mods.spring.damping = drive.damping; + + c->minImpulse = -drive.forceLimit; + c->maxImpulse = drive.forceLimit; + + PX_ASSERT(c->linear0.isFinite()); + PX_ASSERT(c->angular0.isFinite()); + } + }; + } +} // namespace + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp new file mode 100644 index 0000000..ec6dc6b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.cpp @@ -0,0 +1,249 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtContactJoint.h" + +using namespace physx; +using namespace Ext; + +ContactJoint::ContactJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + ContactJointT(PxJointConcreteType::eCONTACT, actor0, localFrame0, actor1, localFrame1, "ContactJointData") +{ + PX_UNUSED(scale); + + ContactJointData* data = static_cast(mData); + + data->contact = PxVec3(0.f); + data->normal = PxVec3(0.f); + data->penetration = 0.f; + data->restitution = 0.f; + data->bounceThreshold = 0.f; +} + +PxVec3 ContactJoint::getContact() const +{ + return data().contact; +} + +void ContactJoint::setContact(const PxVec3& contact) +{ + PX_CHECK_AND_RETURN(contact.isFinite(), "PxContactJoint::setContact: invalid parameter"); + data().contact = contact; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, contactPoint, static_cast(*this), getContact()) +#endif +} + +PxVec3 ContactJoint::getContactNormal() const +{ + return data().normal; +} + +void ContactJoint::setContactNormal(const PxVec3& normal) +{ + PX_CHECK_AND_RETURN(normal.isFinite(), "PxContactJoint::setContactNormal: invalid parameter"); + data().normal = normal; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, contactNormal, static_cast(*this), getContactNormal()) +#endif +} + +PxReal ContactJoint::getPenetration() const +{ + return data().penetration; +} + +void ContactJoint::setPenetration(PxReal penetration) +{ + PX_CHECK_AND_RETURN(PxIsFinite(penetration), "ContactJoint::setPenetration: invalid parameter"); + data().penetration = penetration; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, contactPenetration, static_cast(*this), getPenetration()) +#endif +} + +PxReal ContactJoint::getRestitution() const +{ + return data().restitution; +} + +void ContactJoint::setRestitution(const PxReal restitution) +{ + PX_CHECK_AND_RETURN(PxIsFinite(restitution) && restitution >= 0.f && restitution <= 1.f, "ContactJoint::setRestitution: invalid parameter"); + data().restitution = restitution; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, contactRestitution, static_cast(*this), getRestitution()) +#endif +} + +PxReal ContactJoint::getBounceThreshold() const +{ + return data().bounceThreshold; +} + +void ContactJoint::setBounceThreshold(const PxReal bounceThreshold) +{ + PX_CHECK_AND_RETURN(PxIsFinite(bounceThreshold) && bounceThreshold > 0.f, "ContactJoint::setBounceThreshold: invalid parameter"); + data().bounceThreshold = bounceThreshold; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, contactBounceThreshold, static_cast(*this), getBounceThreshold()) +#endif +} + +void ContactJoint::computeJacobians(PxJacobianRow* jacobian) const +{ + const PxVec3 cp = data().contact; + const PxVec3 normal = data().normal; + + PxRigidActor* actor0, *actor1; + this->getActors(actor0, actor1); + + PxVec3 raXn(0.f), rbXn(0.f); + + if (actor0 && actor0->is()) + { + PxRigidBody* dyn = actor0->is(); + PxTransform cmassPose = dyn->getGlobalPose() * dyn->getCMassLocalPose(); + raXn = (cp - cmassPose.p).cross(normal); + } + + if (actor1 && actor1->is()) + { + PxRigidBody* dyn = actor1->is(); + PxTransform cmassPose = dyn->getGlobalPose() * dyn->getCMassLocalPose(); + rbXn = (cp - cmassPose.p).cross(normal); + } + + jacobian->linear0 = normal; + jacobian->angular0 = raXn; + jacobian->linear1 = -normal; + jacobian->angular1 = -rbXn; + +} +PxU32 ContactJoint::getNbJacobianRows() const +{ + return 1; +} + +static void ContactJointProject(const void* /*constantBlock*/, PxTransform& /*bodyAToWorld*/, PxTransform& /*bodyBToWorld*/, bool /*projectToA*/) +{ + // Not required +} + +static void ContactJointVisualize(PxConstraintVisualizer& /*viz*/, const void* /*constantBlock*/, const PxTransform& /*body0Transform*/, const PxTransform& /*body1Transform*/, PxU32 /*flags*/) +{ + //TODO +} + +//TAG:solverprepshader +static PxU32 ContactJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& /*invMassScale*/, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const ContactJointData& data = *reinterpret_cast(constantBlock); + + const PxVec3& contact = data.contact; + const PxVec3& normal = data.normal; + + cA2wOut = contact; + cB2wOut = contact; + + const PxVec3 ra = contact - bA2w.p; + const PxVec3 rb = contact - bB2w.p; + + body0WorldOffset = PxVec3(0.f); + + Px1DConstraint& con = constraints[0]; + con.linear0 = normal; + con.linear1 = normal; + con.angular0 = ra.cross(normal); + con.angular1 = rb.cross(normal); + + con.geometricError = data.penetration; + con.minImpulse = 0.f; + con.maxImpulse = PX_MAX_F32; + + con.velocityTarget = 0.f; + con.forInternalUse = 0.f; + con.solveHint = 0; + con.flags = Px1DConstraintFlag::eOUTPUT_FORCE; + con.mods.bounce.restitution = data.restitution; + con.mods.bounce.velocityThreshold = data.bounceThreshold; + + return 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gContactJointShaders = { ContactJointSolverPrep, ContactJointProject, ContactJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep ContactJoint::getPrep() const { return gContactJointShaders.solverPrep; } + +PxContactJoint* physx::PxContactJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxContactJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxContactJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxContactJointCreate: actors must be different"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxContactJointCreate: at least one actor must be dynamic"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gContactJointShaders); +} + +// PX_SERIALIZATION +void ContactJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gContactJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +template<> +void physx::Ext::omniPvdInitJoint(ContactJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eCONTACT) + OMNI_PVD_SET(joint, contactPoint, j, joint->getContact()) + OMNI_PVD_SET(joint, contactNormal, j, joint->getContactNormal()) + OMNI_PVD_SET(joint, contactPenetration, j, joint->getPenetration()) + OMNI_PVD_SET(joint, contactRestitution, j, joint->getRestitution()) + OMNI_PVD_SET(joint, contactBounceThreshold, j, joint->getBounceThreshold()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.h new file mode 100644 index 0000000..338d386 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtContactJoint.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_CONTACT_JOINT_H +#define EXT_CONTACT_JOINT_H + +#include "common/PxTolerancesScale.h" +#include "extensions/PxContactJoint.h" + +#include "ExtJoint.h" +#include "foundation/PxUserAllocated.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxContactJointGeneratedValues; +namespace Ext +{ + struct ContactJointData : public JointData + { + PxVec3 contact; + PxVec3 normal; + PxReal penetration; + PxReal restitution; + PxReal bounceThreshold; + }; + + typedef JointT ContactJointT; + class ContactJoint : public ContactJointT + { + public: + // PX_SERIALIZATION + ContactJoint(PxBaseFlags baseFlags) : ContactJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static ContactJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + ContactJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxContactJoint + virtual PxVec3 getContact() const PX_OVERRIDE; + virtual void setContact(const PxVec3& contact) PX_OVERRIDE; + virtual PxVec3 getContactNormal() const PX_OVERRIDE; + virtual void setContactNormal(const PxVec3& normal) PX_OVERRIDE; + virtual PxReal getPenetration() const PX_OVERRIDE; + virtual void setPenetration(const PxReal penetration) PX_OVERRIDE; + virtual PxReal getRestitution() const PX_OVERRIDE; + virtual void setRestitution(const PxReal resititution) PX_OVERRIDE; + virtual PxReal getBounceThreshold() const PX_OVERRIDE; + virtual void setBounceThreshold(const PxReal bounceThreshold) PX_OVERRIDE; + virtual void computeJacobians(PxJacobianRow* jacobian) const PX_OVERRIDE; + virtual PxU32 getNbJacobianRows() const PX_OVERRIDE; + //~PxContactJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; + //~PxConstraintConnector + }; + +} // namespace Ext + +} // namespace physx +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp new file mode 100644 index 0000000..f1a1ce9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtConvexMeshExt.cpp @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPlane.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "extensions/PxConvexMeshExt.h" + +using namespace physx; + +static const PxReal gEpsilon = .01f; + +PxU32 physx::PxFindFaceIndex(const PxConvexMeshGeometry& convexGeom, const PxTransform& pose, + const PxVec3& impactPos, const PxVec3& unitDir) +{ + PX_ASSERT(unitDir.isFinite()); + PX_ASSERT(unitDir.isNormalized()); + PX_ASSERT(impactPos.isFinite()); + PX_ASSERT(pose.isFinite()); + + const PxVec3 impact = impactPos - unitDir * gEpsilon; + + const PxVec3 localPoint = pose.transformInv(impact); + const PxVec3 localDir = pose.rotateInv(unitDir); + + // Create shape to vertex scale transformation matrix + const PxMeshScale& meshScale = convexGeom.scale; + const PxMat33 rot(meshScale.rotation); + PxMat33 shape2VertexSkew = rot.getTranspose(); + const PxMat33 diagonal = PxMat33::createDiagonal(PxVec3(1.0f / meshScale.scale.x, 1.0f / meshScale.scale.y, 1.0f / meshScale.scale.z)); + shape2VertexSkew = shape2VertexSkew * diagonal; + shape2VertexSkew = shape2VertexSkew * rot; + + const PxU32 nbPolys = convexGeom.convexMesh->getNbPolygons(); + PxU32 minIndex = 0; + PxReal minD = PX_MAX_REAL; + for (PxU32 j = 0; j < nbPolys; j++) + { + PxHullPolygon hullPolygon; + convexGeom.convexMesh->getPolygonData(j, hullPolygon); + + // transform hull plane into shape space + PxPlane plane; + const PxVec3 tmp = shape2VertexSkew.transformTranspose(PxVec3(hullPolygon.mPlane[0],hullPolygon.mPlane[1],hullPolygon.mPlane[2])); + const PxReal denom = 1.0f / tmp.magnitude(); + plane.n = tmp * denom; + plane.d = hullPolygon.mPlane[3] * denom; + + PxReal d = plane.distance(localPoint); + if (d < 0.0f) + continue; + + const PxReal tweak = plane.n.dot(localDir) * gEpsilon; + d += tweak; + + if (d < minD) + { + minIndex = j; + minD = d; + } + } + return minIndex; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp new file mode 100644 index 0000000..4f4c419 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.cpp @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "task/PxTask.h" +#include "ExtCpuWorkerThread.h" +#include "ExtDefaultCpuDispatcher.h" +#include "ExtTaskQueueHelper.h" +#include "foundation/PxFPU.h" + +using namespace physx; + +Ext::CpuWorkerThread::CpuWorkerThread() +: mQueueEntryPool(EXT_TASK_QUEUE_ENTRY_POOL_SIZE), + mThreadId(0) +{ +} + +Ext::CpuWorkerThread::~CpuWorkerThread() +{ +} + +void Ext::CpuWorkerThread::initialize(DefaultCpuDispatcher* ownerDispatcher) +{ + mOwner = ownerDispatcher; +} + +bool Ext::CpuWorkerThread::tryAcceptJobToLocalQueue(PxBaseTask& task, PxThread::Id taskSubmitionThread) +{ + if(taskSubmitionThread == mThreadId) + { + SharedQueueEntry* entry = mQueueEntryPool.getEntry(&task); + if (entry) + { + mLocalJobList.push(*entry); + return true; + } + else + return false; + } + + return false; +} + +PxBaseTask* Ext::CpuWorkerThread::giveUpJob() +{ + return TaskQueueHelper::fetchTask(mLocalJobList, mQueueEntryPool); +} + +void Ext::CpuWorkerThread::execute() +{ + mThreadId = getId(); + + const PxDefaultCpuDispatcherWaitForWorkMode::Enum ownerWaitForWorkMode = mOwner->getWaitForWorkMode(); + + while(!quitIsSignalled()) + { + if(PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK == ownerWaitForWorkMode) + mOwner->resetWakeSignal(); + + PxBaseTask* task = TaskQueueHelper::fetchTask(mLocalJobList, mQueueEntryPool); + + if(!task) + task = mOwner->fetchNextTask(); + + if(task) + { + mOwner->runTask(*task); + task->release(); + } + else if(PxDefaultCpuDispatcherWaitForWorkMode::eYIELD_THREAD == ownerWaitForWorkMode) + { + PxThread::yield(); + } + else if(PxDefaultCpuDispatcherWaitForWorkMode::eYIELD_PROCESSOR == ownerWaitForWorkMode) + { + const PxU32 pauseCounter = mOwner->getYieldProcessorCount(); + for(PxU32 j = 0; j < pauseCounter; j++) + PxThread::yieldProcesor(); + } + else + { + PX_ASSERT(PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK == ownerWaitForWorkMode); + mOwner->waitForWork(); + } + } + + quit(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.h new file mode 100644 index 0000000..fceded2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCpuWorkerThread.h @@ -0,0 +1,74 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_CPU_WORKER_THREAD_H +#define EXT_CPU_WORKER_THREAD_H + +#include "foundation/PxThread.h" +#include "ExtDefaultCpuDispatcher.h" +#include "ExtSharedQueueEntryPool.h" + +namespace physx +{ +namespace Ext +{ +class DefaultCpuDispatcher; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif // Because of the SList member I assume + + class CpuWorkerThread : public PxThread + { + public: + CpuWorkerThread(); + ~CpuWorkerThread(); + + void initialize(DefaultCpuDispatcher* ownerDispatcher); + void execute(); + bool tryAcceptJobToLocalQueue(PxBaseTask& task, PxThread::Id taskSubmitionThread); + PxBaseTask* giveUpJob(); + PxThread::Id getWorkerThreadId() const { return mThreadId; } + + protected: + SharedQueueEntryPool<> mQueueEntryPool; + DefaultCpuDispatcher* mOwner; + PxSList mLocalJobList; + PxThread::Id mThreadId; + }; + +#if PX_VC +#pragma warning(pop) +#endif + +} // namespace Ext + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp new file mode 100644 index 0000000..40c4f62 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomGeometryExt.cpp @@ -0,0 +1,806 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxCustomGeometryExt.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace physx; + +static const PxU32 gCollisionShapeColor = PxU32(PxDebugColor::eARGB_MAGENTA); + +/////////////////////////////////////////////////////////////////////////////// + +static const PxU32 MAX_TRIANGLES = 64; +static const PxU32 MAX_TRIANGLE_CONTACTS = 6; +const PxReal FACE_CONTACT_THRESHOLD = 0.99999f; + +struct TrimeshContactFilter +{ + PxU32 triCount; + PxU32 triIndices[MAX_TRIANGLES]; + PxU32 triAdjacencies[MAX_TRIANGLES][3]; + PxU32 triContactCounts[MAX_TRIANGLES][2]; + PxContactPoint triContacts[MAX_TRIANGLES][MAX_TRIANGLE_CONTACTS]; + + TrimeshContactFilter() : triCount(0) {} + + void addTriangleContacts(const PxContactPoint* points, PxU32 count, const PxU32 triIndex, const PxVec3 triVerts[3], const PxU32 triAdjacency[3]) + { + if (triCount == MAX_TRIANGLES) + return; + + triIndices[triCount] = triIndex; + PxU32& faceContactCount = triContactCounts[triCount][0]; + PxU32& edgeContactCount = triContactCounts[triCount][1]; + faceContactCount = edgeContactCount = 0; + + for (PxU32 i = 0; i < 3; ++i) + triAdjacencies[triCount][i] = triAdjacency[i]; + + PxVec3 triNormal = (triVerts[1] - triVerts[0]).cross(triVerts[2] - triVerts[0]).getNormalized(); + + for (PxU32 i = 0; i < count; ++i) + { + const PxContactPoint& point = points[i]; + bool faceContact = fabsf(point.normal.dot(triNormal)) > FACE_CONTACT_THRESHOLD; + + if (faceContactCount + edgeContactCount < MAX_TRIANGLE_CONTACTS) + { + if (faceContact) triContacts[triCount][faceContactCount++] = point; + else triContacts[triCount][MAX_TRIANGLE_CONTACTS - 1 - edgeContactCount++] = point; + } + } + + ++triCount; + } + + void writeToBuffer(PxContactBuffer& buffer) + { + for (PxU32 i = 0; i < triCount; ++i) + { + if (triContactCounts[i][1] > 0) + { + for (PxU32 j = 0; j < triCount; ++j) + { + if (triIndices[j] == triAdjacencies[i][0] || triIndices[j] == triAdjacencies[i][1] || triIndices[j] == triAdjacencies[i][2]) + { + if (triContactCounts[j][0] > 0) + { + triContactCounts[i][1] = 0; + break; + } + } + } + } + + for (PxU32 j = 0; j < triContactCounts[i][0]; ++j) + buffer.contact(triContacts[i][j]); + + for (PxU32 j = 0; j < triContactCounts[i][1]; ++j) + buffer.contact(triContacts[i][MAX_TRIANGLE_CONTACTS - 1 - j]); + } + } + + PX_NOCOPY(TrimeshContactFilter) +}; + +/////////////////////////////////////////////////////////////////////////////// + +struct TriangleSupport : PxGjkQuery::Support +{ + PxVec3 v0, v1, v2; + PxReal margin; + + TriangleSupport(const PxVec3& _v0, const PxVec3& _v1, const PxVec3& _v2, PxReal _margin) + : + v0(_v0), v1(_v1), v2(_v2), margin(_margin) + {} + + virtual PxReal getMargin() const + { + return margin; + } + virtual PxVec3 supportLocal(const PxVec3& dir) const + { + float d0 = dir.dot(v0), d1 = dir.dot(v1), d2 = dir.dot(v2); + return (d0 > d1 && d0 > d2) ? v0 : (d1 > d2) ? v1 : v2; + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static void drawArc(const PxVec3& center, const PxVec3& radius, const PxVec3& axis, PxReal angle, PxReal error, PxRenderOutput& out) +{ + int sides = int(ceilf(angle / (2 * acosf(1.0f - error)))); + float step = angle / sides; + out << PxRenderOutput::LINESTRIP; + for (int i = 0; i <= sides; ++i) + out << center + PxQuat(step * i, axis).rotate(radius); +} +static void drawCircle(const PxVec3& center, const PxVec3& radius, const PxVec3& axis, PxReal error, PxRenderOutput& out) +{ + drawArc(center, radius, axis, PxTwoPi, error, out); +} +static void drawQuarterCircle(const PxVec3& center, const PxVec3& radius, const PxVec3& axis, PxReal error, PxRenderOutput& out) +{ + drawArc(center, radius, axis, PxPiDivTwo, error, out); +} +static void drawLine(const PxVec3& s, const PxVec3& e, PxRenderOutput& out) +{ + out << PxRenderOutput::LINES << s << e; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxBounds3 PxCustomGeometryExt::BaseConvexCallbacks::getLocalBounds(const PxGeometry&) const +{ + const PxVec3 min(supportLocal(PxVec3(-1, 0, 0)).x, supportLocal(PxVec3(0, -1, 0)).y, supportLocal(PxVec3(0, 0, -1)).z); + const PxVec3 max(supportLocal(PxVec3(1, 0, 0)).x, supportLocal(PxVec3(0, 1, 0)).y, supportLocal(PxVec3(0, 0, 1)).z); + PxBounds3 bounds(min, max); + bounds.fattenSafe(getMargin()); + return bounds; +} + +bool PxCustomGeometryExt::BaseConvexCallbacks::generateContacts(const PxGeometry& geom0, const PxGeometry& geom1, + const PxTransform& pose0, const PxTransform& pose1, const PxReal contactDistance, const PxReal meshContactMargin, + const PxReal toleranceLength, PxContactBuffer& contactBuffer) const +{ + struct ContactRecorder : immediate::PxContactRecorder + { + PxContactBuffer* contactBuffer; + ContactRecorder(PxContactBuffer& _contactBuffer) : contactBuffer(&_contactBuffer) {} + virtual bool recordContacts(const PxContactPoint* contactPoints, const PxU32 nbContacts, const PxU32 /*index*/) + { + for (PxU32 i = 0; i < nbContacts; ++i) + contactBuffer->contact(contactPoints[i]); + return true; + } + } + contactRecorder(contactBuffer); + + PxCache contactCache; + + struct ContactCacheAllocator : PxCacheAllocator + { + PxU8 buffer[1024]; + ContactCacheAllocator() { PxMemSet(buffer, 0, sizeof(buffer)); } + virtual PxU8* allocateCacheData(const PxU32 /*byteSize*/) { return reinterpret_cast(size_t(buffer + 0xf) & ~0xf); } + } + contactCacheAllocator; + + const PxTransform identityPose(PxIdentity); + + switch (geom1.getType()) + { + case PxGeometryType::eSPHERE: + case PxGeometryType::eCAPSULE: + case PxGeometryType::eBOX: + case PxGeometryType::eCONVEXMESH: + { + PxGjkQueryExt::ConvexGeomSupport geomSupport(geom1); + if (PxGjkQueryExt::generateContacts(*this, geomSupport, pose0, pose1, contactDistance, toleranceLength, contactBuffer)) + { + PxGeometryHolder substituteGeom; PxTransform preTransform; + if (useSubstituteGeometry(substituteGeom, preTransform, contactBuffer.contacts[contactBuffer.count - 1], pose0, PxGeometryQuery::getWorldBounds(geom1, pose1).getCenter())) + { + const PxGeometry* pGeom0 = &substituteGeom.any(); + const PxGeometry* pGeom1 = &geom1; + PxTransform pose = pose0.transform(preTransform); + immediate::PxGenerateContacts(&pGeom0, &pGeom1, &pose, &pose1, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + } + } + break; + } + case PxGeometryType::ePLANE: + { + const PxPlane plane = PxPlane(1.0f, 0.0f, 0.0f, 0.0f).transform(pose1); + const PxPlane localPlane = plane.inverseTransform(pose0); + const PxVec3 point = supportLocal(-localPlane.n) - localPlane.n * margin; + const float dist = localPlane.distance(point); + if (dist < contactDistance) + { + const PxVec3 n = localPlane.n; + const PxVec3 p = point - n * dist * 0.5f; + PxContactPoint contact; + contact.point = pose0.transform(p); + contact.normal = pose0.rotate(n); + contact.separation = dist; + contactBuffer.contact(contact); + PxGeometryHolder substituteGeom; PxTransform preTransform; + if (useSubstituteGeometry(substituteGeom, preTransform, contactBuffer.contacts[contactBuffer.count - 1], pose0, pose0.p)) + { + const PxGeometry* pGeom0 = &substituteGeom.any(); + const PxGeometry* pGeom1 = &geom1; + PxTransform pose = pose0.transform(preTransform); + immediate::PxGenerateContacts(&pGeom0, &pGeom1, &pose, &pose1, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + } + } + break; + } + case PxGeometryType::eTRIANGLEMESH: + case PxGeometryType::eHEIGHTFIELD: + { + TrimeshContactFilter contactFilter; + bool hasAdjacency = (geom1.getType() != PxGeometryType::eTRIANGLEMESH || (static_cast(geom1).triangleMesh->getTriangleMeshFlags() & PxTriangleMeshFlag::eADJACENCY_INFO)); + PxBoxGeometry boxGeom(getLocalBounds(geom0).getDimensions() * 0.5f + PxVec3(meshContactMargin)); + PxU32 triangles[MAX_TRIANGLES]; + bool overflow = false; + PxU32 triangleCount = (geom1.getType() == PxGeometryType::eTRIANGLEMESH) ? + PxMeshQuery::findOverlapTriangleMesh(boxGeom, pose0, static_cast(geom1), pose1, triangles, MAX_TRIANGLES, 0, overflow) : + PxMeshQuery::findOverlapHeightField(boxGeom, pose0, static_cast(geom1), pose1, triangles, MAX_TRIANGLES, 0, overflow); + for (PxU32 i = 0; i < triangleCount; ++i) + { + PxTriangle tri; PxU32 adjacent[3]; + if (geom1.getType() == PxGeometryType::eTRIANGLEMESH) PxMeshQuery::getTriangle(static_cast(geom1), pose1, triangles[i], tri, NULL, hasAdjacency ? adjacent : NULL); + else PxMeshQuery::getTriangle(static_cast(geom1), pose1, triangles[i], tri, NULL, adjacent); + TriangleSupport triSupport(tri.verts[0], tri.verts[1], tri.verts[2], meshContactMargin); + if (PxGjkQueryExt::generateContacts(*this, triSupport, pose0, identityPose, contactDistance, toleranceLength, contactBuffer)) + { + contactBuffer.contacts[contactBuffer.count - 1].internalFaceIndex1 = triangles[i]; + PxGeometryHolder substituteGeom; PxTransform preTransform; PxVec3 pos1 = (tri.verts[0] + tri.verts[1] + tri.verts[2]) / 3.0f; + if (useSubstituteGeometry(substituteGeom, preTransform, contactBuffer.contacts[contactBuffer.count - 1], pose0, pos1)) + { + const PxGeometry& geom = substituteGeom.any(); + PxTransform pose = pose0.transform(preTransform); + PxGeometryQuery::generateTriangleContacts(geom, pose, tri.verts, triangles[i], contactDistance, meshContactMargin, toleranceLength, contactBuffer); + } + } + if (hasAdjacency) + { + contactFilter.addTriangleContacts(contactBuffer.contacts, contactBuffer.count, triangles[i], tri.verts, adjacent); + contactBuffer.count = 0; + } + } + if (hasAdjacency) + contactFilter.writeToBuffer(contactBuffer); + break; + } + case PxGeometryType::eCUSTOM: + { + const PxCustomGeometry& customGeom1 = static_cast(geom1); + if (customGeom1.getCustomType() == CylinderCallbacks::TYPE() || + customGeom1.getCustomType() == ConeCallbacks::TYPE()) // It's a CustomConvex + { + BaseConvexCallbacks* custom1 = static_cast(customGeom1.callbacks); + if (PxGjkQueryExt::generateContacts(*this, *custom1, pose0, pose1, contactDistance, toleranceLength, contactBuffer)) + { + PxGeometryHolder substituteGeom; PxTransform preTransform; + if (useSubstituteGeometry(substituteGeom, preTransform, contactBuffer.contacts[contactBuffer.count - 1], pose0, PxGeometryQuery::getWorldBounds(geom1, pose1).getCenter())) + { + PxU32 oldCount = contactBuffer.count; + + const PxGeometry* pGeom0 = &substituteGeom.any(); + const PxGeometry* pGeom1 = &geom1; + PxTransform pose = pose0.transform(preTransform); + immediate::PxGenerateContacts(&pGeom1, &pGeom0, &pose1, &pose, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + + for (int i = oldCount; i < int(contactBuffer.count); ++i) + contactBuffer.contacts[i].normal = -contactBuffer.contacts[i].normal; + } + } + } + else + { + const PxGeometry* pGeom0 = &geom0; + const PxGeometry* pGeom1 = &geom1; + immediate::PxGenerateContacts(&pGeom1, &pGeom0, &pose1, &pose0, &contactCache, 1, contactRecorder, + contactDistance, meshContactMargin, toleranceLength, contactCacheAllocator); + + for (int i = 0; i < int(contactBuffer.count); ++i) + contactBuffer.contacts[i].normal = -contactBuffer.contacts[i].normal; + } + break; + } + default: + break; + } + + return contactBuffer.count > 0; +} + +PxU32 PxCustomGeometryExt::BaseConvexCallbacks::raycast(const PxVec3& origin, const PxVec3& unitDir, const PxGeometry& /*geom*/, const PxTransform& pose, + PxReal maxDist, PxHitFlags /*hitFlags*/, PxU32 /*maxHits*/, PxGeomRaycastHit* rayHits, PxU32 /*stride*/, PxRaycastThreadContext*) const +{ + PxReal t; + PxVec3 n, p; + if (PxGjkQuery::raycast(*this, pose, origin, unitDir, maxDist, t, n, p)) + { + PxGeomRaycastHit& hit = *rayHits; + hit.distance = t; + hit.position = p; + hit.normal = n; + return 1; + } + + return 0; +} + +bool PxCustomGeometryExt::BaseConvexCallbacks::overlap(const PxGeometry& /*geom0*/, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, PxOverlapThreadContext*) const +{ + switch (geom1.getType()) + { + case PxGeometryType::eSPHERE: + case PxGeometryType::eCAPSULE: + case PxGeometryType::eBOX: + case PxGeometryType::eCONVEXMESH: + { + PxGjkQueryExt::ConvexGeomSupport geomSupport(geom1); + if (PxGjkQuery::overlap(*this, geomSupport, pose0, pose1)) + return true; + break; + } + default: + break; + } + + return false; +} + +bool PxCustomGeometryExt::BaseConvexCallbacks::sweep(const PxVec3& unitDir, const PxReal maxDist, + const PxGeometry& /*geom0*/, const PxTransform& pose0, const PxGeometry& geom1, const PxTransform& pose1, + PxGeomSweepHit& sweepHit, PxHitFlags /*hitFlags*/, const PxReal inflation, PxSweepThreadContext*) const +{ + switch (geom1.getType()) + { + case PxGeometryType::eSPHERE: + case PxGeometryType::eCAPSULE: + case PxGeometryType::eBOX: + case PxGeometryType::eCONVEXMESH: + { + PxGjkQueryExt::ConvexGeomSupport geomSupport(geom1, inflation); + PxReal t; + PxVec3 n, p; + if (PxGjkQuery::sweep(*this, geomSupport, pose0, pose1, unitDir, maxDist, t, n, p)) + { + PxGeomSweepHit& hit = sweepHit; + hit.distance = t; + hit.position = p; + hit.normal = n; + return true; + } + break; + } + default: + break; + } + + return false; +} + +bool PxCustomGeometryExt::BaseConvexCallbacks::usePersistentContactManifold(const PxGeometry& /*geometry*/, PxReal& /*breakingThreshold*/) const +{ + return false; +} + +/////////////////////////////////////////////////////////////////////////////// + +IMPLEMENT_CUSTOM_GEOMETRY_TYPE(PxCustomGeometryExt::CylinderCallbacks) + +PxCustomGeometryExt::CylinderCallbacks::CylinderCallbacks(float _height, float _radius, int _axis, float _margin) + : + BaseConvexCallbacks(_margin), height(_height), radius(_radius), axis(_axis) +{} + +void PxCustomGeometryExt::CylinderCallbacks::visualize(const PxGeometry&, PxRenderOutput& out, const PxTransform& transform, const PxBounds3&) const +{ + const float ERR = 0.001f; + + out << gCollisionShapeColor; + out << transform; + + int axis1 = (axis + 1) % 3; + int axis2 = (axis + 2) % 3; + + PxVec3 zr(PxZero), rd(PxZero), ax(PxZero), ax1(PxZero), ax2(PxZero), r0(PxZero), r1(PxZero); + ax[axis] = ax1[axis1] = ax2[axis2] = 1.0f; + r0[axis1] = r1[axis2] = radius; + + rd[axis1] = radius; + rd[axis] = -(height * 0.5f + margin); + drawCircle(zr, rd, ax, ERR, out); + rd[axis] = (height * 0.5f + margin); + drawCircle(zr, rd, ax, ERR, out); + rd[axis1] = radius + margin; + rd[axis] = -(height * 0.5f); + drawCircle(zr, rd, ax, ERR, out); + rd[axis] = (height * 0.5f); + drawCircle(zr, rd, ax, ERR, out); + + drawLine(-ax * height * 0.5f + ax1 * (radius + margin), ax * height * 0.5f + ax1 * (radius + margin), out); + drawLine(-ax * height * 0.5f - ax1 * (radius + margin), ax * height * 0.5f - ax1 * (radius + margin), out); + drawLine(-ax * height * 0.5f + ax2 * (radius + margin), ax * height * 0.5f + ax2 * (radius + margin), out); + drawLine(-ax * height * 0.5f - ax2 * (radius + margin), ax * height * 0.5f - ax2 * (radius + margin), out); + + drawQuarterCircle(-ax * height * 0.5f + ax1 * radius, -ax * margin, -ax2, ERR, out); + drawQuarterCircle(-ax * height * 0.5f - ax1 * radius, -ax * margin, ax2, ERR, out); + drawQuarterCircle(-ax * height * 0.5f + ax2 * radius, -ax * margin, ax1, ERR, out); + drawQuarterCircle(-ax * height * 0.5f - ax2 * radius, -ax * margin, -ax1, ERR, out); + + drawQuarterCircle(ax * height * 0.5f + ax1 * radius, ax * margin, ax2, ERR, out); + drawQuarterCircle(ax * height * 0.5f - ax1 * radius, ax * margin, -ax2, ERR, out); + drawQuarterCircle(ax * height * 0.5f + ax2 * radius, ax * margin, -ax1, ERR, out); + drawQuarterCircle(ax * height * 0.5f - ax2 * radius, ax * margin, ax1, ERR, out); +} + +PxVec3 PxCustomGeometryExt::CylinderCallbacks::supportLocal(const PxVec3& dir) const +{ + float halfHeight = height * 0.5f; + PxVec3 d = dir.getNormalized(); + + switch (axis) + { + case 0: // X + { + if (PxSign2(d.x) != 0 && PxSign2(d.y) == 0 && PxSign2(d.z) == 0) return PxVec3(PxSign2(d.x) * halfHeight, 0, 0); + return PxVec3(PxSign2(d.x) * halfHeight, 0, 0) + PxVec3(0, d.y, d.z).getNormalized() * radius; + } + case 1: // Y + { + if (PxSign2(d.x) == 0 && PxSign2(d.y) != 0 && PxSign2(d.z) == 0) return PxVec3(0, PxSign2(d.y) * halfHeight, 0); + return PxVec3(0, PxSign2(d.y) * halfHeight, 0) + PxVec3(d.x, 0, d.z).getNormalized() * radius; + } + case 2: // Z + { + if (PxSign2(d.x) == 0 && PxSign2(d.y) == 0 && PxSign2(d.z) != 0) return PxVec3(0, 0, PxSign2(d.z) * halfHeight); + return PxVec3(0, 0, PxSign2(d.z) * halfHeight) + PxVec3(d.x, d.y, 0).getNormalized() * radius; + } + } + + return PxVec3(0); +} + +void PxCustomGeometryExt::CylinderCallbacks::computeMassProperties(const PxGeometry& /*geometry*/, PxMassProperties& massProperties) const +{ + if (margin == 0) + { + PxMassProperties& mass = massProperties; + float R = radius, H = height; + + mass.mass = PxPi * R * R * H; + mass.inertiaTensor = PxMat33(PxZero); + mass.centerOfMass = PxVec3(PxZero); + + float I0 = mass.mass * R * R / 2.0f; + float I1 = mass.mass * (3 * R * R + H * H) / 12.0f; + + mass.inertiaTensor[axis][axis] = I0; + mass.inertiaTensor[(axis + 1) % 3][(axis + 1) % 3] = mass.inertiaTensor[(axis + 2) % 3][(axis + 2) % 3] = I1; + } + else + { + const int SLICE_COUNT = 32; + PxMassProperties sliceMasses[SLICE_COUNT]; + PxTransform slicePoses[SLICE_COUNT]; + float sliceHeight = height / SLICE_COUNT; + + for (int i = 0; i < SLICE_COUNT; ++i) + { + float t = -height * 0.5f + i * sliceHeight + sliceHeight * 0.5f; + float R = getRadiusAtHeight(t), H = sliceHeight; + + PxMassProperties mass; + mass.mass = PxPi * R * R * H; + mass.inertiaTensor = PxMat33(PxZero); + mass.centerOfMass = PxVec3(PxZero); + + float I0 = mass.mass * R * R / 2.0f; + float I1 = mass.mass * (3 * R * R + H * H) / 12.0f; + + mass.inertiaTensor[axis][axis] = I0; + mass.inertiaTensor[(axis + 1) % 3][(axis + 1) % 3] = mass.inertiaTensor[(axis + 2) % 3][(axis + 2) % 3] = I1; + mass.centerOfMass[axis] = t; + + sliceMasses[i] = mass; + slicePoses[i] = PxTransform(PxIdentity); + } + + massProperties = PxMassProperties::sum(sliceMasses, slicePoses, SLICE_COUNT); + } +} + +bool PxCustomGeometryExt::CylinderCallbacks::useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0, const PxVec3& pos1) const +{ + PxVec3 locN = pose0.rotateInv(p.normal); + float nAng = acosf(PxClamp(-locN[axis], -1.0f, 1.0f)); + float epsAng = PxPi / 36.0f; // 5 degrees + if (nAng < epsAng || nAng > PxPi - epsAng) + { + PxVec3 halfSize; + halfSize[axis] = height * 0.5f + margin; + halfSize[(axis + 1) % 3] = halfSize[(axis + 2) % 3] = radius / sqrtf(2.0f); + geom = PxBoxGeometry(halfSize); + PxVec3 axisDir(PxZero); axisDir[axis] = 1.0f; + PxVec3 locP = pose0.transformInv(pos1); + float s1 = locP[(axis + 1) % 3], s2 = locP[(axis + 2) % 3]; + float ang = ((s1 * s1) + (s2 * s2) > 1e-3f) ? atan2f(s2, s1) : 0; + preTransform = PxTransform(PxQuat(ang + PxPi * 0.25f, axisDir)); + return true; + } + else if (nAng > PxPiDivTwo - epsAng && nAng < PxPiDivTwo + epsAng) + { + geom = PxCapsuleGeometry(radius + margin, height * 0.5f); + switch (axis) + { + case 0: preTransform = PxTransform(PxIdentity); break; + case 1: preTransform = PxTransform(PxQuat(PxPi * 0.5f, PxVec3(0, 0, 1))); break; + case 2: preTransform = PxTransform(PxQuat(PxPi * 0.5f, PxVec3(0, 1, 0))); break; + } + return true; + } + return false; +} + +float PxCustomGeometryExt::CylinderCallbacks::getRadiusAtHeight(float h) const +{ + if (h >= -height * 0.5f && h <= height * 0.5f) + return radius + margin; + + if (h < -height * 0.5f) + { + float a = -h - height * 0.5f; + return radius + sqrtf(margin * margin - a * a); + } + + if (h > height * 0.5f) + { + float a = h - height * 0.5f; + return radius + sqrtf(margin * margin - a * a); + } + + PX_ASSERT(0); + return 0; +} + +/////////////////////////////////////////////////////////////////////////////// + +IMPLEMENT_CUSTOM_GEOMETRY_TYPE(PxCustomGeometryExt::ConeCallbacks) + +PxCustomGeometryExt::ConeCallbacks::ConeCallbacks(float _height, float _radius, int _axis, float _margin) + : + BaseConvexCallbacks(_margin), height(_height), radius(_radius), axis(_axis) +{} + +void PxCustomGeometryExt::ConeCallbacks::visualize(const PxGeometry&, PxRenderOutput& out, const PxTransform& transform, const PxBounds3&) const +{ + const float ERR = 0.001f; + + out << gCollisionShapeColor; + out << transform; + + int axis1 = (axis + 1) % 3; + int axis2 = (axis + 2) % 3; + + PxVec3 zr(PxZero), rd(PxZero), ax(PxZero), ax1(PxZero), ax2(PxZero), r0(PxZero), r1(PxZero); + ax[axis] = ax1[axis1] = ax2[axis2] = 1.0f; + r0[axis1] = r1[axis2] = radius; + + float ang = atan2f(radius, height); + float aSin = sinf(ang); + + rd[axis1] = radius; + rd[axis] = -(height * 0.5f + margin); + drawCircle(zr, rd, ax, ERR, out); + rd[axis] = -(height * 0.5f) + margin * aSin; + rd[axis1] = getRadiusAtHeight(rd[axis]); + drawCircle(zr, rd, ax, ERR, out); + rd[axis] = height * 0.5f + margin * aSin; + rd[axis1] = getRadiusAtHeight(rd[axis]); + drawCircle(zr, rd, ax, ERR, out); + + float h0 = -height * 0.5f + margin * aSin, h1 = height * 0.5f + margin * aSin; + float s0 = getRadiusAtHeight(h0), s1 = getRadiusAtHeight(h1); + drawLine(ax * h0 + ax1 * s0, ax * h1 + ax1 * s1, out); + drawLine(ax * h0 - ax1 * s0, ax * h1 - ax1 * s1, out); + drawLine(ax * h0 + ax2 * s0, ax * h1 + ax2 * s1, out); + drawLine(ax * h0 - ax2 * s0, ax * h1 - ax2 * s1, out); + + drawArc(-ax * height * 0.5f + ax1 * radius, -ax * margin, -ax2, PxPiDivTwo + ang, ERR, out); + drawArc(-ax * height * 0.5f - ax1 * radius, -ax * margin, ax2, PxPiDivTwo + ang, ERR, out); + drawArc(-ax * height * 0.5f + ax2 * radius, -ax * margin, ax1, PxPiDivTwo + ang, ERR, out); + drawArc(-ax * height * 0.5f - ax2 * radius, -ax * margin, -ax1, PxPiDivTwo + ang, ERR, out); + + drawArc(ax * height * 0.5f, ax * margin, ax2, PxPiDivTwo - ang, ERR, out); + drawArc(ax * height * 0.5f, ax * margin, -ax2, PxPiDivTwo - ang, ERR, out); + drawArc(ax * height * 0.5f, ax * margin, -ax1, PxPiDivTwo - ang, ERR, out); + drawArc(ax * height * 0.5f, ax * margin, ax1, PxPiDivTwo - ang, ERR, out); +} + +PxVec3 PxCustomGeometryExt::ConeCallbacks::supportLocal(const PxVec3& dir) const +{ + float halfHeight = height * 0.5f; + float cosAlph = radius / sqrtf(height * height + radius * radius); + PxVec3 d = dir.getNormalized(); + + switch (axis) + { + case 0: // X + { + if (d.x > cosAlph || (PxSign2(d.x) != 0 && PxSign2(d.y) == 0 && PxSign2(d.z) == 0)) return PxVec3(PxSign2(d.x) * halfHeight, 0, 0); + return PxVec3(-halfHeight, 0, 0) + PxVec3(0, d.y, d.z).getNormalized() * radius; + } + case 1: // Y + { + if (d.y > cosAlph || (PxSign2(d.y) != 0 && PxSign2(d.x) == 0 && PxSign2(d.z) == 0)) return PxVec3(0, PxSign2(d.y) * halfHeight, 0); + return PxVec3(0, -halfHeight, 0) + PxVec3(d.x, 0, d.z).getNormalized() * radius; + } + case 2: // Z + { + if (d.z > cosAlph || (PxSign2(d.z) != 0 && PxSign2(d.x) == 0 && PxSign2(d.y) == 0)) return PxVec3(0, 0, PxSign2(d.z) * halfHeight); + return PxVec3(0, 0, -halfHeight) + PxVec3(d.x, d.y, 0).getNormalized() * radius; + } + } + + return PxVec3(0); +} + +void PxCustomGeometryExt::ConeCallbacks::computeMassProperties(const PxGeometry& /*geometry*/, PxMassProperties& massProperties) const +{ + if (margin == 0) + { + PxMassProperties& mass = massProperties; + + float H = height, R = radius; + + mass.mass = PxPi * R * R * H / 3.0f; + mass.inertiaTensor = PxMat33(PxZero); + mass.centerOfMass = PxVec3(PxZero); + + float I0 = mass.mass * R * R * 3.0f / 10.0f; + float I1 = mass.mass * (R * R * 3.0f / 20.0f + H * H * 3.0f / 80.0f); + + mass.inertiaTensor[axis][axis] = I0; + mass.inertiaTensor[(axis + 1) % 3][(axis + 1) % 3] = mass.inertiaTensor[(axis + 2) % 3][(axis + 2) % 3] = I1; + + mass.centerOfMass[axis] = -H / 4.0f; + + mass.inertiaTensor = PxMassProperties::translateInertia(mass.inertiaTensor, mass.mass, mass.centerOfMass); + } + else + { + const int SLICE_COUNT = 32; + PxMassProperties sliceMasses[SLICE_COUNT]; + PxTransform slicePoses[SLICE_COUNT]; + float sliceHeight = height / SLICE_COUNT; + + for (int i = 0; i < SLICE_COUNT; ++i) + { + float t = -height * 0.5f + i * sliceHeight + sliceHeight * 0.5f; + float R = getRadiusAtHeight(t), H = sliceHeight; + + PxMassProperties mass; + mass.mass = PxPi * R * R * H; + mass.inertiaTensor = PxMat33(PxZero); + mass.centerOfMass = PxVec3(PxZero); + + float I0 = mass.mass * R * R / 2.0f; + float I1 = mass.mass * (3 * R * R + H * H) / 12.0f; + + mass.inertiaTensor[axis][axis] = I0; + mass.inertiaTensor[(axis + 1) % 3][(axis + 1) % 3] = mass.inertiaTensor[(axis + 2) % 3][(axis + 2) % 3] = I1; + mass.centerOfMass[axis] = t; + + sliceMasses[i] = mass; + slicePoses[i] = PxTransform(PxIdentity); + } + + massProperties = PxMassProperties::sum(sliceMasses, slicePoses, SLICE_COUNT); + + massProperties.inertiaTensor = PxMassProperties::translateInertia(massProperties.inertiaTensor, massProperties.mass, massProperties.centerOfMass); + } +} + +bool PxCustomGeometryExt::ConeCallbacks::useSubstituteGeometry(PxGeometryHolder& geom, PxTransform& preTransform, const PxContactPoint& p, const PxTransform& pose0, const PxVec3& pos1) const +{ + PxVec3 locN = pose0.rotateInv(p.normal); + float nAng = acosf(PxClamp(-locN[axis], -1.0f, 1.0f)); + float epsAng = PxPi / 36.0f; // 5 degrees + float coneAng = atan2f(radius, height); + if (nAng > PxPi - epsAng) + { + PxVec3 halfSize; + halfSize[axis] = height * 0.5f + margin; + halfSize[(axis + 1) % 3] = halfSize[(axis + 2) % 3] = radius / sqrtf(2.0f); + geom = PxBoxGeometry(halfSize); + PxVec3 axisDir(PxZero); axisDir[axis] = 1.0f; + PxVec3 locP = pose0.transformInv(pos1); + float s1 = locP[(axis + 1) % 3], s2 = locP[(axis + 2) % 3]; + float ang = ((s1 * s1) + (s2 * s2) > 1e-3f) ? atan2f(s2, s1) : 0; + preTransform = PxTransform(PxQuat(ang + PxPi * 0.25f, axisDir)); + return true; + } + else if (nAng > PxPiDivTwo - coneAng - epsAng && nAng < PxPiDivTwo - coneAng + epsAng) + { + geom = PxCapsuleGeometry(radius * 0.25f + margin, sqrtf(height * height + radius * radius) * 0.5f); + switch (axis) + { + case 0: + { + PxVec3 capC = (PxVec3(height * 0.5f, 0, 0) + PxVec3(-height * 0.5f, radius, 0)) * 0.5f - PxVec3(radius, height, 0).getNormalized() * radius * 0.25f; + preTransform = PxTransform(capC, PxQuat(-coneAng, PxVec3(0, 0, 1))); + break; + } + case 1: + { + PxVec3 capC = (PxVec3(0, height * 0.5f, 0) + PxVec3(0, -height * 0.5f, radius)) * 0.5f - PxVec3(0, radius, height).getNormalized() * radius * 0.25f; + preTransform = PxTransform(capC, PxQuat(-coneAng, PxVec3(1, 0, 0)) * PxQuat(PxPiDivTwo, PxVec3(0, 0, 1))); + break; + } + case 2: + { + PxVec3 capC = (PxVec3(0, 0, height * 0.5f) + PxVec3(radius, 0, -height * 0.5f)) * 0.5f - PxVec3(height, 0, radius).getNormalized() * radius * 0.25f; + preTransform = PxTransform(capC, PxQuat(-coneAng, PxVec3(0, 1, 0)) * PxQuat(PxPiDivTwo, PxVec3(0, 1, 0))); + break; + } + } + PxVec3 axisDir(PxZero); axisDir[axis] = 1.0f; + float n1 = -locN[(axis + 1) % 3], n2 = -locN[(axis + 2) % 3]; + float ang = atan2f(n2, n1); + preTransform = PxTransform(PxQuat(ang, axisDir)) * preTransform; + return true; + } + return false; +} + +float PxCustomGeometryExt::ConeCallbacks::getRadiusAtHeight(float h) const +{ + float angle = atan2f(radius, height); + float aSin = sinf(angle); + float aCos = cosf(angle); + + if (h >= -height * 0.5f + margin * aSin && h <= height * 0.5f + margin * aSin) + return radius * (height * 0.5f - h) / height + margin / aCos; + + if (h < -height * 0.5f + margin * aSin) + { + float a = -h - height * 0.5f; + return radius + sqrtf(margin * margin - a * a); + } + + if (h > height * 0.5f + margin * aSin) + { + float a = h - height * 0.5f; + return sqrtf(margin * margin - a * a); + } + + PX_ASSERT(0); + return 0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp new file mode 100644 index 0000000..215ecf5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtCustomSceneQuerySystem.cpp @@ -0,0 +1,511 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxCustomSceneQuerySystem.h" +#include "extensions/PxShapeExt.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "geometry/PxBVH.h" +#include "GuActorShapeMap.h" +#include "ExtSqQuery.h" +#include "SqFactory.h" +#include "PxRigidActor.h" +#include "PxPruningStructure.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +// PT: this customized version uses: +// - a modified version of Sq::PrunerManager, named Sq::ExtPrunerManager, located in ExtSqManager.cpp +// - a modified version of Sq::SceneQueries, named Sq::ExtSceneQueries, located in ExtSqQuery.cpp +// +// Sq::PrunerManager and Sq::SceneQueries live in the SceneQuery lib, and are used by PhysX internally +// to implement the regular SQ system. +// +// Sq::ExtPrunerManager and Sq::ExtSceneQueries live in the Extensions lib, and are not used by the +// regular PhysX SQ system. They are examples of how the default code can be customized. +// + +static CompanionPrunerType getCompanionType(PxDynamicTreeSecondaryPruner::Enum type) +{ + switch(type) + { + case PxDynamicTreeSecondaryPruner::eNONE: return COMPANION_PRUNER_NONE; + case PxDynamicTreeSecondaryPruner::eBUCKET: return COMPANION_PRUNER_BUCKET; + case PxDynamicTreeSecondaryPruner::eINCREMENTAL: return COMPANION_PRUNER_INCREMENTAL; + case PxDynamicTreeSecondaryPruner::eBVH: return COMPANION_PRUNER_AABB_TREE; + case PxDynamicTreeSecondaryPruner::eLAST: return COMPANION_PRUNER_NONE; + } + return COMPANION_PRUNER_NONE; +} + +static BVHBuildStrategy getBuildStrategy(PxBVHBuildStrategy::Enum bs) +{ + switch(bs) + { + case PxBVHBuildStrategy::eFAST: return BVH_SPLATTER_POINTS; + case PxBVHBuildStrategy::eDEFAULT: return BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER; + case PxBVHBuildStrategy::eSAH: return BVH_SAH; + case PxBVHBuildStrategy::eLAST: return BVH_SPLATTER_POINTS; + } + return BVH_SPLATTER_POINTS; +} + +static Pruner* create(PxPruningStructureType::Enum type, PxU64 contextID, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxBVHBuildStrategy::Enum buildStrategy, PxU32 nbObjectsPerNode) +{ +// if(0) +// return createIncrementalPruner(contextID); + + const CompanionPrunerType cpType = getCompanionType(secondaryType); + const BVHBuildStrategy bs = getBuildStrategy(buildStrategy); + + Pruner* pruner = NULL; + switch(type) + { + case PxPruningStructureType::eNONE: { pruner = createBucketPruner(contextID); break; } + case PxPruningStructureType::eDYNAMIC_AABB_TREE: { pruner = createAABBPruner(contextID, true, cpType, bs, nbObjectsPerNode); break; } + case PxPruningStructureType::eSTATIC_AABB_TREE: { pruner = createAABBPruner(contextID, false, cpType, bs, nbObjectsPerNode); break; } + case PxPruningStructureType::eLAST: break; + } + return pruner; +} + +#define EXT_PRUNER_EPSILON 0.005f + +// PT: in this external implementation we'll use Px pointers instead of Np pointers in the payload. +static PX_FORCE_INLINE void setPayload(PrunerPayload& pp, const PxShape* shape, const PxRigidActor* actor) +{ + pp.data[0] = size_t(shape); + pp.data[1] = size_t(actor); +} + +static PX_FORCE_INLINE PxShape* getShapeFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[0]); +} + +static PX_FORCE_INLINE PxRigidActor* getActorFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[1]); +} + +static PX_FORCE_INLINE bool isDynamicActor(const PxRigidActor& actor) +{ + const PxType actorType = actor.getConcreteType(); + return actorType != PxConcreteType::eRIGID_STATIC; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE ActorShapeData createActorShapeData(PrunerHandle h, PrunerCompoundId id) { return (ActorShapeData(id) << 32) | ActorShapeData(h); } +static PX_FORCE_INLINE PrunerHandle getPrunerHandle(ActorShapeData data) { return PrunerHandle(data); } +static PX_FORCE_INLINE PrunerCompoundId getCompoundID(ActorShapeData data) { return PrunerCompoundId(data >> 32); } + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class ExtSqAdapter : public ExtQueryAdapter + { + PX_NOCOPY(ExtSqAdapter) + public: + ExtSqAdapter(const PxCustomSceneQuerySystemAdapter& adapter) : mUserAdapter(adapter)/*, mFilterData(NULL)*/ {} + virtual ~ExtSqAdapter() {} + + // Adapter + virtual const PxGeometry& getGeometry(const PrunerPayload& payload) const; + //~Adapter + + // ExtQueryAdapter + virtual PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const; + virtual void getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const; + virtual void getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const; + virtual bool processPruner(PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const; + //~ExtQueryAdapter + + const PxCustomSceneQuerySystemAdapter& mUserAdapter; + ActorShapeMap mDatabase; + const PxQueryFilterData* mFilterData; + + }; +} + +const PxGeometry& ExtSqAdapter::getGeometry(const PrunerPayload& payload) const +{ + PxShape* shape = getShapeFromPayload(payload); + return shape->getGeometry(); +} + +PrunerHandle ExtSqAdapter::findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const +{ + const PxU32 actorIndex = cache.actor->getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + const ActorShapeData actorShapeData = mDatabase.find(actorIndex, cache.actor, cache.shape); + + compoundId = getCompoundID(actorShapeData); + + prunerIndex = mUserAdapter.getPrunerIndex(*cache.actor, *cache.shape); + + return getPrunerHandle(actorShapeData); +} + +void ExtSqAdapter::getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const +{ + PxShape* shape = getShapeFromPayload(payload); + filterData = shape->getQueryFilterData(); +} + +void ExtSqAdapter::getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const +{ + actorShape.actor = getActorFromPayload(payload); + actorShape.shape = getShapeFromPayload(payload); +} + +bool ExtSqAdapter::processPruner(PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const +{ + return mUserAdapter.processPruner(prunerIndex, context, filterData, filterCall); +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class CustomPxSQ : public PxCustomSceneQuerySystem, public PxUserAllocated + { + public: + CustomPxSQ(const PxCustomSceneQuerySystemAdapter& adapter, ExtPVDCapture* pvd, PxU64 contextID, + PxSceneQueryUpdateMode::Enum mode, bool usesTreeOfPruners) : + mExtAdapter (adapter), + mQueries (pvd, contextID, EXT_PRUNER_EPSILON, mExtAdapter, usesTreeOfPruners), + mUpdateMode (mode), + mRefCount (1) + {} + virtual ~CustomPxSQ() {} + + virtual void release(); + virtual void acquireReference(); + virtual void preallocate(PxU32 prunerIndex, PxU32 nbShapes) { SQ().preallocate(prunerIndex, nbShapes); } + virtual void addSQShape( const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, + const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure); + virtual void removeSQShape(const PxRigidActor& actor, const PxShape& shape); + virtual void updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform); + virtual PxSQCompoundHandle addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& pxbvh, const PxTransform* transforms); + virtual void removeSQCompound(PxSQCompoundHandle compoundHandle); + virtual void updateSQCompound(PxSQCompoundHandle compoundHandle, const PxTransform& compoundTransform); + virtual void flushUpdates() { SQ().flushUpdates(); } + virtual void flushMemory() { SQ().flushMemory(); } + virtual void visualize(PxU32 prunerIndex, PxRenderOutput& out) const { SQ().visualize(prunerIndex, out); } + virtual void shiftOrigin(const PxVec3& shift) { SQ().shiftOrigin(shift); } + virtual PxSQBuildStepHandle prepareSceneQueryBuildStep(PxU32 prunerIndex); + virtual void sceneQueryBuildStep(PxSQBuildStepHandle handle); + virtual void finalizeUpdates(); + virtual void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint) { SQ().setDynamicTreeRebuildRateHint(dynTreeRebuildRateHint); } + virtual PxU32 getDynamicTreeRebuildRateHint() const { return SQ().getDynamicTreeRebuildRateHint(); } + virtual void forceRebuildDynamicTree(PxU32 prunerIndex) { SQ().forceRebuildDynamicTree(prunerIndex); } + virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const { return mUpdateMode; } + virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum mode) { mUpdateMode = mode; } + virtual PxU32 getStaticTimestamp() const { return SQ().getStaticTimestamp(); } + virtual void merge(const PxPruningStructure& pxps); + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + virtual bool sweep( const PxGeometry& geometry, const PxTransform& pose, + const PxVec3& unitDir, const PxReal distance, + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const; + virtual bool overlap(const PxGeometry& geometry, const PxTransform& transform, + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + virtual PxSQPrunerHandle getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const; + virtual void sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, + const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices); + + virtual PxU32 addPruner(PxPruningStructureType::Enum primaryType, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxU32 preallocated); + virtual PxU32 startCustomBuildstep(); + virtual void customBuildstep(PxU32 index); + virtual void finishCustomBuildstep(); + + PX_FORCE_INLINE ExtPrunerManager& SQ() { return mQueries.mSQManager; } + PX_FORCE_INLINE const ExtPrunerManager& SQ() const { return mQueries.mSQManager; } + + ExtSqAdapter mExtAdapter; + ExtSceneQueries mQueries; + PxSceneQueryUpdateMode::Enum mUpdateMode; + PxU32 mRefCount; + }; +} + +/////////////////////////////////////////////////////////////////////////////// + +void addExternalSQ(PxSceneQuerySystem* added); +void removeExternalSQ(PxSceneQuerySystem* removed); + +void CustomPxSQ::release() +{ + mRefCount--; + if(!mRefCount) + { + removeExternalSQ(this); + PX_DELETE_THIS; + } +} + +void CustomPxSQ::acquireReference() +{ + mRefCount++; +} + +void CustomPxSQ::addSQShape(const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure) +{ + PrunerPayload payload; + setPayload(payload, &shape, &actor); + + const bool isDynamic = isDynamicActor(actor); + const PxU32 prunerIndex = mExtAdapter.mUserAdapter.getPrunerIndex(actor, shape); + + const PrunerCompoundId cid = compoundHandle ? PrunerCompoundId(*compoundHandle) : INVALID_COMPOUND_ID; + const PrunerHandle shapeHandle = SQ().addPrunerShape(payload, prunerIndex, isDynamic, cid, bounds, transform, hasPruningStructure); + + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + mExtAdapter.mDatabase.add(actorIndex, &actor, &shape, createActorShapeData(shapeHandle, cid)); +} + +namespace +{ + struct DatabaseCleaner : PrunerPayloadRemovalCallback + { + DatabaseCleaner(ExtSqAdapter& adapter) : mAdapter(adapter){} + + virtual void invoke(PxU32 nbRemoved, const PrunerPayload* removed) + { + PxU32 actorIndex = 0xffffffff; + const PxRigidActor* cachedActor = NULL; + + while(nbRemoved--) + { + const PrunerPayload& payload = *removed++; + + const PxRigidActor* actor = getActorFromPayload(payload); + + if(actor!=cachedActor) + { + actorIndex = actor->getInternalActorIndex(); + cachedActor = actor; + } + PX_ASSERT(actorIndex!=0xffffffff); + + bool status = mAdapter.mDatabase.remove(actorIndex, actor, getShapeFromPayload(payload), NULL); + PX_ASSERT(status); + PX_UNUSED(status); + } + } + ExtSqAdapter& mAdapter; + + PX_NOCOPY(DatabaseCleaner) + }; +} + +void CustomPxSQ::removeSQShape(const PxRigidActor& actor, const PxShape& shape) +{ + const bool isDynamic = isDynamicActor(actor); + const PxU32 prunerIndex = mExtAdapter.mUserAdapter.getPrunerIndex(actor, shape); + + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + ActorShapeData actorShapeData; + mExtAdapter.mDatabase.remove(actorIndex, &actor, &shape, &actorShapeData); + + const PrunerHandle shapeHandle = getPrunerHandle(actorShapeData); + const PrunerCompoundId compoundId = getCompoundID(actorShapeData); + + SQ().removePrunerShape(prunerIndex, isDynamic, compoundId, shapeHandle, NULL); +} + +void CustomPxSQ::updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform) +{ + const bool isDynamic = isDynamicActor(actor); + const PxU32 prunerIndex = mExtAdapter.mUserAdapter.getPrunerIndex(actor, shape); + + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + const ActorShapeData actorShapeData = mExtAdapter.mDatabase.find(actorIndex, &actor, &shape); + + const PrunerHandle shapeHandle = getPrunerHandle(actorShapeData); + const PrunerCompoundId cid = getCompoundID(actorShapeData); + + SQ().markForUpdate(prunerIndex, isDynamic, cid, shapeHandle, transform); +} + +PxSQCompoundHandle CustomPxSQ::addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& bvh, const PxTransform* transforms) +{ + const PxU32 numSqShapes = bvh.getNbBounds(); + + PX_ALLOCA(payloads, PrunerPayload, numSqShapes); + for(PxU32 i=0; i(mData); + + for(PxU32 i=0;i<6;i++) + data->motion[i] = PxD6Motion::eLOCKED; + + data->twistLimit = PxJointAngularLimitPair(-PxPi/2, PxPi/2); + data->swingLimit = PxJointLimitCone(PxPi/2, PxPi/2); + data->pyramidSwingLimit = PxJointLimitPyramid(-PxPi/2, PxPi/2, -PxPi/2, PxPi/2); + data->distanceLimit = PxJointLinearLimit(scale, PX_MAX_F32); + data->distanceMinDist = 1e-6f*scale.length; + + data->linearLimitX = PxJointLinearLimitPair(scale); + data->linearLimitY = PxJointLinearLimitPair(scale); + data->linearLimitZ = PxJointLinearLimitPair(scale); + + for(PxU32 i=0;idrive[i] = PxD6JointDrive(); + + data->drivePosition = PxTransform(PxIdentity); + data->driveLinearVelocity = PxVec3(0.0f); + data->driveAngularVelocity = PxVec3(0.0f); + + data->projectionLinearTolerance = 1e10f; + data->projectionAngularTolerance = PxPi; + + data->mUseDistanceLimit = false; + data->mUseNewLinearLimits = false; + data->mUseConeLimit = false; + data->mUsePyramidLimits = false; +} + +PxD6Motion::Enum D6Joint::getMotion(PxD6Axis::Enum index) const +{ + return data().motion[index]; +} + +void D6Joint::setMotion(PxD6Axis::Enum index, PxD6Motion::Enum t) +{ + data().motion[index] = t; + mRecomputeMotion = true; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxD6Motion::Enum motions[6]; + for (PxU32 i = 0; i < 6; ++i) + motions[i] = getMotion(PxD6Axis::Enum(i)); + OMNI_PVD_SETB(joint, d6Motions, static_cast(*this), motions, sizeof(motions)) +#endif +} + +PxReal D6Joint::getTwistAngle() const +{ + return getTwistAngle_Internal(); +} + +PxReal D6Joint::getSwingYAngle() const +{ + return getSwingYAngle_Internal(); +} + +PxReal D6Joint::getSwingZAngle() const +{ + return getSwingZAngle_Internal(); +} + +PxD6JointDrive D6Joint::getDrive(PxD6Drive::Enum index) const +{ + return data().drive[index]; +} + +void D6Joint::setDrive(PxD6Drive::Enum index, const PxD6JointDrive& d) +{ + PX_CHECK_AND_RETURN(d.isValid(), "PxD6Joint::setDrive: drive is invalid"); + + data().drive[index] = d; + mRecomputeMotion = true; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + PxReal forceLimit[6]; + for (PxU32 i = 0; i < 6; ++i) + forceLimit[i] = getDrive(PxD6Drive::Enum(i)).forceLimit; + OMNI_PVD_SETB(joint, d6DriveForceLimit, j, forceLimit, sizeof(forceLimit)) + PxD6JointDriveFlags flags[6]; + for (PxU32 i = 0; i < 6; ++i) + flags[i] = getDrive(PxD6Drive::Enum(i)).flags; + OMNI_PVD_SETB(joint, d6DriveFlags, j, flags, sizeof(flags)) + PxReal stiffness[6]; + for (PxU32 i = 0; i < 6; ++i) + stiffness[i] = getDrive(PxD6Drive::Enum(i)).stiffness; + OMNI_PVD_SETB(joint, d6DriveStiffness, j, stiffness, sizeof(stiffness)) + PxReal damping[6]; + for (PxU32 i = 0; i < 6; ++i) + damping[i] = getDrive(PxD6Drive::Enum(i)).damping; + OMNI_PVD_SETB(joint, d6DriveDamping, j, damping, sizeof(damping)) +#endif +} + +void D6Joint::setDistanceLimit(const PxJointLinearLimit& l) +{ + PX_CHECK_AND_RETURN(l.isValid(), "PxD6Joint::setDistanceLimit: limit invalid"); + data().distanceLimit = l; + data().mUseDistanceLimit = true; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, d6DistanceLimitValue, j, l.value) + OMNI_PVD_SET(joint, d6DistanceLimitRestitution, j, l.restitution) + OMNI_PVD_SET(joint, d6DistanceLimitBounceThreshold, j, l.bounceThreshold) + OMNI_PVD_SET(joint, d6DistanceLimitStiffness, j, l.stiffness) + OMNI_PVD_SET(joint, d6DistanceLimitDamping, j, l.damping) + OMNI_PVD_SET(joint, d6DistanceLimitContactDistance, j, l.contactDistance_deprecated) +#endif +} + +PxJointLinearLimit D6Joint::getDistanceLimit() const +{ + return data().distanceLimit; +} + +void D6Joint::setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair& limit) +{ + PX_CHECK_AND_RETURN(axis>=PxD6Axis::eX && axis<=PxD6Axis::eZ, "PxD6Joint::setLinearLimit: invalid axis value"); + PX_CHECK_AND_RETURN(limit.isValid(), "PxD6Joint::setLinearLimit: limit invalid"); + D6JointData& d = data(); + if(axis==PxD6Axis::eX) + d.linearLimitX = limit; + else if(axis==PxD6Axis::eY) + d.linearLimitY = limit; + else if(axis==PxD6Axis::eZ) + d.linearLimitZ = limit; + else + return; + d.mUseNewLinearLimits = true; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + PxReal values[3]; + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).lower; + OMNI_PVD_SETB(joint, d6LinearLimitLower, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).upper; + OMNI_PVD_SETB(joint, d6LinearLimitUpper, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).restitution; + OMNI_PVD_SETB(joint, d6LinearLimitRestitution, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).bounceThreshold; + OMNI_PVD_SETB(joint, d6LinearLimitBounceThreshold, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).stiffness; + OMNI_PVD_SETB(joint, d6LinearLimitStiffness, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).damping; + OMNI_PVD_SETB(joint, d6LinearLimitDamping, j, values, sizeof(values)) + for (PxU32 i = 0; i < 3; ++i) + values[i] = getLinearLimit(PxD6Axis::Enum(i)).contactDistance_deprecated; + OMNI_PVD_SETB(joint, d6LinearLimitContactDistance, j, values, sizeof(values)) +#endif +} + +PxJointLinearLimitPair D6Joint::getLinearLimit(PxD6Axis::Enum axis) const +{ + PX_CHECK_AND_RETURN_VAL(axis>=PxD6Axis::eX && axis<=PxD6Axis::eZ, "PxD6Joint::getLinearLimit: invalid axis value", PxJointLinearLimitPair(PxTolerancesScale(), 0.0f, 0.0f)); + const D6JointData& d = data(); + if(axis==PxD6Axis::eX) + return d.linearLimitX; + else if(axis==PxD6Axis::eY) + return d.linearLimitY; + else if(axis==PxD6Axis::eZ) + return d.linearLimitZ; + return PxJointLinearLimitPair(PxTolerancesScale(), 0.0f, 0.0f); +} + +PxJointAngularLimitPair D6Joint::getTwistLimit() const +{ + return data().twistLimit; +} + +void D6Joint::setTwistLimit(const PxJointAngularLimitPair& l) +{ + PX_CHECK_AND_RETURN(l.isValid(), "PxD6Joint::setTwistLimit: limit invalid"); + // PT: the tangent version is not compatible with the double-cover feature, since the potential limit extent in that case is 4*PI. + // i.e. we'd potentially take the tangent of something equal to PI/2. So the tangent stuff makes the limits less accurate, and it + // also reduces the available angular range for the joint. All that for questionable performance gains. + PX_CHECK_AND_RETURN(l.lower>-PxTwoPi && l.upper(*this); + OMNI_PVD_SET(joint, d6TwistLimitLower, j, l.lower) + OMNI_PVD_SET(joint, d6TwistLimitUpper, j, l.upper) + OMNI_PVD_SET(joint, d6TwistLimitRestitution, j, l.restitution) + OMNI_PVD_SET(joint, d6TwistLimitBounceThreshold, j, l.bounceThreshold) + OMNI_PVD_SET(joint, d6TwistLimitStiffness, j, l.stiffness) + OMNI_PVD_SET(joint, d6TwistLimitDamping, j, l.damping) + OMNI_PVD_SET(joint, d6TwistLimitContactDistance, j, l.contactDistance_deprecated) +#endif +} + +PxJointLimitPyramid D6Joint::getPyramidSwingLimit() const +{ + return data().pyramidSwingLimit; +} + +void D6Joint::setPyramidSwingLimit(const PxJointLimitPyramid& l) +{ + PX_CHECK_AND_RETURN(l.isValid(), "PxD6Joint::setPyramidSwingLimit: limit invalid"); + + data().pyramidSwingLimit = l; + data().mUsePyramidLimits = true; + markDirty(); + +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, d6PyramidSwingLimitYAngleMin, j, l.yAngleMin) + OMNI_PVD_SET(joint, d6PyramidSwingLimitYAngleMax, j, l.yAngleMax) + OMNI_PVD_SET(joint, d6PyramidSwingLimitZAngleMin, j, l.zAngleMin) + OMNI_PVD_SET(joint, d6PyramidSwingLimitZAngleMax, j, l.zAngleMax) + OMNI_PVD_SET(joint, d6PyramidSwingLimitRestitution, j, l.restitution) + OMNI_PVD_SET(joint, d6PyramidSwingLimitBounceThreshold, j, l.bounceThreshold) + OMNI_PVD_SET(joint, d6PyramidSwingLimitStiffness, j, l.stiffness) + OMNI_PVD_SET(joint, d6PyramidSwingLimitDamping, j, l.damping) + OMNI_PVD_SET(joint, d6PyramidSwingLimitContactDistance, j, l.contactDistance_deprecated) +#endif +} + +PxJointLimitCone D6Joint::getSwingLimit() const +{ + return data().swingLimit; +} + +void D6Joint::setSwingLimit(const PxJointLimitCone& l) +{ + PX_CHECK_AND_RETURN(l.isValid(), "PxD6Joint::setSwingLimit: limit invalid"); + + data().swingLimit = l; + data().mUseConeLimit = true; + markDirty(); + +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, d6SwingLimitYAngle, j, l.yAngle) + OMNI_PVD_SET(joint, d6SwingLimitZAngle, j, l.zAngle) + OMNI_PVD_SET(joint, d6SwingLimitRestitution, j, l.restitution) + OMNI_PVD_SET(joint, d6SwingLimitBounceThreshold, j, l.bounceThreshold) + OMNI_PVD_SET(joint, d6SwingLimitStiffness, j, l.stiffness) + OMNI_PVD_SET(joint, d6SwingLimitDamping, j, l.damping) + OMNI_PVD_SET(joint, d6SwingLimitContactDistance, j, l.contactDistance_deprecated) +#endif +} + +PxTransform D6Joint::getDrivePosition() const +{ + return data().drivePosition; +} + +void D6Joint::setDrivePosition(const PxTransform& pose, bool autowake) +{ + PX_CHECK_AND_RETURN(pose.isSane(), "PxD6Joint::setDrivePosition: pose invalid"); + data().drivePosition = pose.getNormalized(); + if(autowake) + wakeUpActors(); + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, d6DrivePosition, static_cast(*this), pose) +#endif +} + +void D6Joint::getDriveVelocity(PxVec3& linear, PxVec3& angular) const +{ + linear = data().driveLinearVelocity; + angular = data().driveAngularVelocity; +} + +void D6Joint::setDriveVelocity(const PxVec3& linear, const PxVec3& angular, bool autowake) +{ + PX_CHECK_AND_RETURN(linear.isFinite() && angular.isFinite(), "PxD6Joint::setDriveVelocity: velocity invalid"); + data().driveLinearVelocity = linear; + data().driveAngularVelocity = angular; + if(autowake) + wakeUpActors(); + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, d6DriveLinVelocity, static_cast(*this), linear) + OMNI_PVD_SET(joint, d6DriveAngVelocity, static_cast(*this), angular) +#endif +} + +void D6Joint::setProjectionAngularTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0 && tolerance <= PxPi, "PxD6Joint::setProjectionAngularTolerance: tolerance invalid"); + data().projectionAngularTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, d6ProjectionAngularTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal D6Joint::getProjectionAngularTolerance() const +{ + return data().projectionAngularTolerance; +} + +void D6Joint::setProjectionLinearTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0, "PxD6Joint::setProjectionLinearTolerance: invalid parameter"); + data().projectionLinearTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, d6ProjectionLinearTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal D6Joint::getProjectionLinearTolerance() const +{ + return data().projectionLinearTolerance; +} + +void* D6Joint::prepareData() +{ + D6JointData& d = data(); + + if(mRecomputeMotion) + { + mRecomputeMotion = false; + + d.driving = 0; + d.limited = 0; + d.locked = 0; + + for(PxU32 i=0;iD6JointT::prepareData(); + + return mData; +} + +// Notes: +/* + +This used to be in the linear drive model: + + if(motion[PxD6Axis::eX+i] == PxD6Motion::eLIMITED) + { + if(data.driveLinearVelocity[i] < 0.0f && cB2cA.p[i] < -mLimits[PxD6Limit::eLINEAR].mValue || + data.driveLinearVelocity[i] > 0.0f && cB2cA.p[i] > mLimits[PxD6Limit::eLINEAR].mValue) + continue; + } + +it doesn't seem like a good idea though, because it turns off drive altogether, despite the fact that positional +drive might pull us back in towards the limit. Might be better to make the drive unilateral so it can only pull +us in from the limit + +This used to be in angular locked: + + // Angular locked + //TODO fix this properly. + if(PxAbs(cB2cA.q.x) < 0.0001f) cB2cA.q.x = 0; + if(PxAbs(cB2cA.q.y) < 0.0001f) cB2cA.q.y = 0; + if(PxAbs(cB2cA.q.z) < 0.0001f) cB2cA.q.z = 0; + if(PxAbs(cB2cA.q.w) < 0.0001f) cB2cA.q.w = 0; +*/ + +static PxQuat truncate(const PxQuat& qIn, PxReal minCosHalfTol, bool& truncated) +{ + const PxQuat q = qIn.w >= 0.0f ? qIn : -qIn; + truncated = q.w < minCosHalfTol; + if(!truncated) + return q; + const PxVec3 v = q.getImaginaryPart().getNormalized() * PxSqrt(1.0f - minCosHalfTol * minCosHalfTol); + return PxQuat(v.x, v.y, v.z, minCosHalfTol); +} + +// we decompose the quaternion as q1 * q2, where q1 is a rotation orthogonal to the unit axis, and q2 a rotation around it. +// (so for example if 'axis' is the twist axis, this is separateSwingTwist). +static PxQuat project(const PxQuat& q, const PxVec3& axis, PxReal cosHalfTol, bool& truncated) +{ + const PxReal a = q.getImaginaryPart().dot(axis); + const PxQuat q2 = PxAbs(a) >= 1e-6f ? PxQuat(a*axis.x, a*axis.y, a*axis.z, q.w).getNormalized() : PxQuat(PxIdentity); + const PxQuat q1 = q * q2.getConjugate(); + + PX_ASSERT(PxAbs(q1.getImaginaryPart().dot(q2.getImaginaryPart())) < 1e-6f); + + return truncate(q1, cosHalfTol, truncated) * q2; +} + +// Here's how the angular part works: +// * if no DOFs are locked, there's nothing to do. +// * if all DOFs are locked, we just truncate the rotation +// * if two DOFs are locked +// * we decompose the rotation into swing * twist, where twist is a rotation around the free DOF and swing is a rotation around an axis orthogonal to the free DOF +// * then we truncate swing +// The case of one locked DOF is currently unimplemented, but one option would be: +// * if one DOF is locked (the tricky case), we define the 'free' axis as follows (as the velocity solver prep function does) +// TWIST: cB[0] +// SWING1: cB[0].cross(cA[2]) +// SWING2: cB[0].cross(cA[1]) +// then, as above, we decompose into swing * free, and truncate the free rotation + +//export this in the physx namespace so we can unit test it +namespace physx +{ +PxQuat angularProject(PxU32 lockedDofs, const PxQuat& q, PxReal cosHalfTol, bool& truncated) +{ + PX_ASSERT(lockedDofs <= 7); + truncated = false; + + switch(lockedDofs) + { + case 0: return q; + case 1: return q; // currently unimplemented + case 2: return q; // currently unimplemented + case 3: return project(q, PxVec3(0.0f, 0.0f, 1.0f), cosHalfTol, truncated); + case 4: return q; // currently unimplemented + case 5: return project(q, PxVec3(0.0f, 1.0f, 0.0f), cosHalfTol, truncated); + case 6: return project(q, PxVec3(1.0f, 0.0f, 0.0f), cosHalfTol, truncated); + case 7: return truncate(q, cosHalfTol, truncated); + default: return PxQuat(PxIdentity); + } +} +} + +static void D6JointProject(const void* constantBlock, PxTransform& bodyAToWorld, PxTransform& bodyBToWorld, bool projectToA) +{ + const D6JointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w, cB2cA, projected; + joint::computeDerived(data, bodyAToWorld, bodyBToWorld, cA2w, cB2w, cB2cA, false); + + const PxVec3 v(data.locked & 1 ? cB2cA.p.x : 0.0f, + data.locked & 2 ? cB2cA.p.y : 0.0f, + data.locked & 4 ? cB2cA.p.z : 0.0f); + + bool linearTrunc, angularTrunc = false; + projected.p = joint::truncateLinear(v, data.projectionLinearTolerance, linearTrunc) + (cB2cA.p - v); + + projected.q = angularProject(data.locked >> 3, cB2cA.q, PxCos(data.projectionAngularTolerance / 2), angularTrunc); + + if(linearTrunc || angularTrunc) + joint::projectTransforms(bodyAToWorld, bodyBToWorld, cA2w, cB2w, projected, data, projectToA); +} + +static PX_FORCE_INLINE PxReal computePhi(const PxQuat& q) +{ + PxQuat twist = q; + twist.normalize(); + + PxReal angle = twist.getAngle(); + if(twist.x<0.0f) + angle = -angle; + return angle; +} + +static void visualizeAngularLimit(PxConstraintVisualizer& viz, const D6JointData& data, const PxTransform& t, float swingYZ, float swingW, float swingLimitYZ) +{ + bool active = PxAbs(computeSwingAngle(swingYZ, swingW)) > swingLimitYZ - data.swingLimit.contactDistance_deprecated; + viz.visualizeAngularLimit(t, -swingLimitYZ, swingLimitYZ, active); +} + +static void visualizeDoubleCone(PxConstraintVisualizer& viz, const D6JointData& data, const PxTransform& t, float sin, float swingLimitYZ) +{ + const PxReal angle = PxAsin(sin); + const PxReal pad = data.swingLimit.contactDistance_deprecated; + const PxReal low = -swingLimitYZ; + const PxReal high = swingLimitYZ; + + const bool active = isLimitActive(data.swingLimit, pad, angle, low, high); + viz.visualizeDoubleCone(t, swingLimitYZ, active); +} + +// PT: TODO: refactor with spherical joint code +static void visualizeCone(PxConstraintVisualizer& viz, const D6JointData& data, const PxQuat& swing, const PxTransform& cA2w) +{ + const PxVec3 swingAngle(0.0f, computeSwingAngle(swing.y, swing.w), computeSwingAngle(swing.z, swing.w)); + const PxReal pad = data.swingLimit.isSoft() ? 0.0f : data.swingLimit.contactDistance_deprecated; + Cm::ConeLimitHelperTanLess coneHelper(data.swingLimit.yAngle, data.swingLimit.zAngle, pad); + viz.visualizeLimitCone(cA2w, PxTan(data.swingLimit.zAngle / 4), PxTan(data.swingLimit.yAngle / 4), !coneHelper.contains(swingAngle)); +} + +static PX_FORCE_INLINE bool isLinearLimitActive(const PxJointLinearLimitPair& limit, float ordinate) +{ + const PxReal pad = limit.isSoft() ? 0.0f : limit.contactDistance_deprecated; + return (ordinate < limit.lower + pad) || (ordinate > limit.upper - pad); +} + +static void visualizeLine(PxConstraintVisualizer& viz, const PxVec3& origin, const PxVec3& axis, const PxJointLinearLimitPair& limit, float ordinate) +{ + const bool active = isLinearLimitActive(limit, ordinate); + const PxVec3 p0 = origin + axis * limit.lower; + const PxVec3 p1 = origin + axis * limit.upper; + viz.visualizeLine(p0, p1, active ? 0xff0000u : 0xffffffu); +} + +static void visualizeQuad(PxConstraintVisualizer& viz, const PxVec3& origin, const PxVec3& axis0, const PxJointLinearLimitPair& limit0, float ordinate0, + const PxVec3& axis1, const PxJointLinearLimitPair& limit1, float ordinate1) +{ + const bool active0 = isLinearLimitActive(limit0, ordinate0); + const bool active1 = isLinearLimitActive(limit1, ordinate1); + const PxU32 color = (active0 || active1) ? 0xff0000u : 0xffffffu; + + const PxVec3 l0 = axis0 * limit0.lower; + const PxVec3 u0 = axis0 * limit0.upper; + const PxVec3 l1 = axis1 * limit1.lower; + const PxVec3 u1 = axis1 * limit1.upper; + + const PxVec3 p0 = origin + l0 + l1; + const PxVec3 p1 = origin + u0 + l1; + const PxVec3 p2 = origin + u0 + u1; + const PxVec3 p3 = origin + l0 + u1; + + viz.visualizeLine(p0, p1, color); + viz.visualizeLine(p1, p2, color); + viz.visualizeLine(p2, p3, color); + viz.visualizeLine(p3, p0, color); +} + +static void visualizeBox(PxConstraintVisualizer& viz, const PxVec3& origin, const PxVec3& axis0, const PxJointLinearLimitPair& limit0, float ordinate0, + const PxVec3& axis1, const PxJointLinearLimitPair& limit1, float ordinate1, + const PxVec3& axis2, const PxJointLinearLimitPair& limit2, float ordinate2) +{ + const bool active0 = isLinearLimitActive(limit0, ordinate0); + const bool active1 = isLinearLimitActive(limit1, ordinate1); + const bool active2 = isLinearLimitActive(limit2, ordinate2); + const PxU32 color = (active0 || active1 || active2) ? 0xff0000u : 0xffffffu; + + const PxVec3 l0 = axis0 * limit0.lower; + const PxVec3 u0 = axis0 * limit0.upper; + const PxVec3 l1 = axis1 * limit1.lower; + const PxVec3 u1 = axis1 * limit1.upper; + const PxVec3 l2 = axis2 * limit2.lower; + const PxVec3 u2 = axis2 * limit2.upper; + + const PxVec3 p0 = origin + l0 + l1 + l2; + const PxVec3 p1 = origin + u0 + l1 + l2; + const PxVec3 p2 = origin + u0 + u1 + l2; + const PxVec3 p3 = origin + l0 + u1 + l2; + const PxVec3 p0b = origin + l0 + l1 + u2; + const PxVec3 p1b = origin + u0 + l1 + u2; + const PxVec3 p2b = origin + u0 + u1 + u2; + const PxVec3 p3b = origin + l0 + u1 + u2; + + viz.visualizeLine(p0, p1, color); + viz.visualizeLine(p1, p2, color); + viz.visualizeLine(p2, p3, color); + viz.visualizeLine(p3, p0, color); + viz.visualizeLine(p0b, p1b, color); + viz.visualizeLine(p1b, p2b, color); + viz.visualizeLine(p2b, p3b, color); + viz.visualizeLine(p3b, p0b, color); + viz.visualizeLine(p0, p0b, color); + viz.visualizeLine(p1, p1b, color); + viz.visualizeLine(p2, p2b, color); + viz.visualizeLine(p3, p3b, color); +} + +static float computeLimitedDistance(const D6JointData& data, const PxTransform& cB2cA, const PxMat33& cA2w_m, PxVec3& _limitDir) +{ + PxVec3 limitDir(0.0f); + + for(PxU32 i = 0; i<3; i++) + { + if(data.limited & (1 << (PxD6Axis::eX + i))) + limitDir += cA2w_m[i] * cB2cA.p[i]; + } + + _limitDir = limitDir; + return limitDir.magnitude(); +} + +void setRotX(PxMat33& m, PxReal angle) +{ + m = PxMat33(PxIdentity); + + const PxReal cos = cosf(angle); + const PxReal sin = sinf(angle); + + m[1][1] = m[2][2] = cos; + m[1][2] = sin; + m[2][1] = -sin; +} + +void setRotY(PxMat33& m, PxReal angle) +{ + m = PxMat33(PxIdentity); + + const PxReal cos = cosf(angle); + const PxReal sin = sinf(angle); + + m[0][0] = m[2][2] = cos; + m[0][2] = -sin; + m[2][0] = sin; +} + +void setRotZ(PxMat33& m, PxReal angle) +{ + m = PxMat33(PxIdentity); + + const PxReal cos = cosf(angle); + const PxReal sin = sinf(angle); + + m[0][0] = m[1][1] = cos; + m[0][1] = sin; + m[1][0] = -sin; +} + +PxQuat getRotXQuat(float angle) +{ + PxMat33 m; + setRotX(m, angle); + return PxQuat(m); +} + +PxQuat getRotYQuat(float angle) +{ + PxMat33 m; + setRotY(m, angle); + return PxQuat(m); +} + +PxQuat getRotZQuat(float angle) +{ + PxMat33 m; + setRotZ(m, angle); + return PxQuat(m); +} + + +static void drawPyramid(PxConstraintVisualizer& viz, const D6JointData& data, const PxTransform& cA2w, const PxQuat& swing, bool useY, bool useZ) +{ + struct Local + { + static void drawArc(PxConstraintVisualizer& _viz, const PxTransform& _cA2w, float ymin, float ymax, float zmin, float zmax, PxU32 color) + { + // PT: we use 32 segments for the cone case, so that's 32/4 segments per arc in the pyramid case + const PxU32 nb = 32/4; + PxVec3 prev(0.0f); + for(PxU32 i=0;i(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + viz.visualizeJointFrames(cA2w, cB2w); + + if(flags & PxConstraintVisualizationFlag::eLIMITS) + { + // PT: it is a mistake to use the neighborhood operator since it + // prevents us from using the quat's double-cover feature. +// if(cA2w.q.dot(cB2w.q)<0.0f) +// cB2w.q = -cB2w.q; + + const PxTransform cB2cA = cA2w.transformInv(cB2w); + const PxMat33 cA2w_m(cA2w.q), cB2w_m(cB2w.q); + + if(data.mUseNewLinearLimits) + { + switch(data.limited) + { + case 1< data.distanceMinDist) + { + PxU32 color = 0x00ff00; + if(distance>data.distanceLimit.value) + color = 0xff0000; + + viz.visualizeLine(cA2w.p, cB2w.p, color); + } + } + + PxQuat swing, twist; + PxSeparateSwingTwist(cB2cA.q, swing, twist); + + const PxVec3& bX = cB2w_m.column0; + const PxVec3& aY = cA2w_m.column1; + const PxVec3& aZ = cA2w_m.column2; + + if(data.limited&TWIST_FLAG) + { + const PxReal angle = computePhi(twist); + const PxReal pad = data.twistLimit.contactDistance_deprecated; + const PxReal low = data.twistLimit.lower; + const PxReal high = data.twistLimit.upper; + + const bool active = isLimitActive(data.twistLimit, pad, angle, low, high); + viz.visualizeAngularLimit(cA2w, data.twistLimit.lower, data.twistLimit.upper, active); + } + + const bool swing1Limited = (data.limited & SWING1_FLAG)!=0, swing2Limited = (data.limited & SWING2_FLAG)!=0; + + if(swing1Limited && swing2Limited) + { + if(data.mUseConeLimit) + visualizeCone(viz, data, swing, cA2w); + + if(data.mUsePyramidLimits) + drawPyramid(viz, data, cA2w, swing, true, true); + } + else if(swing1Limited ^ swing2Limited) + { + const PxTransform yToX(PxVec3(0.0f), PxQuat(-PxPi/2.0f, PxVec3(0.0f, 0.0f, 1.0f))); + const PxTransform zToX(PxVec3(0.0f), PxQuat(PxPi/2.0f, PxVec3(0.0f, 1.0f, 0.0f))); + + if(swing1Limited) + { + if(data.locked & SWING2_FLAG) + { + if(data.mUsePyramidLimits) + drawPyramid(viz, data, cA2w, swing, true, false); + else + visualizeAngularLimit(viz, data, cA2w * yToX, swing.y, swing.w, data.swingLimit.yAngle); // PT: swing Y limited, swing Z locked + } + else + if(!data.mUsePyramidLimits) + visualizeDoubleCone(viz, data, cA2w * zToX, aZ.dot(bX), data.swingLimit.yAngle); // PT: swing Y limited, swing Z free + } + else + { + if(data.locked & SWING1_FLAG) + { + if(data.mUsePyramidLimits) + drawPyramid(viz, data, cA2w, swing, false, true); + else + visualizeAngularLimit(viz, data, cA2w * zToX, swing.z, swing.w, data.swingLimit.zAngle); // PT: swing Z limited, swing Y locked + } + else + if(!data.mUsePyramidLimits) + visualizeDoubleCone(viz, data, cA2w * yToX, aY.dot(bX), data.swingLimit.zAngle); // PT: swing Z limited, swing Y free + } + } + } +} + +static PX_FORCE_INLINE void setupSingleSwingLimit(joint::ConstraintHelper& ch, const D6JointData& data, const PxVec3& axis, float swingYZ, float swingW, float swingLimitYZ) +{ + ch.anglePair(computeSwingAngle(swingYZ, swingW), -swingLimitYZ, swingLimitYZ, data.swingLimit.contactDistance_deprecated, axis, data.swingLimit); +} + +static PX_FORCE_INLINE void setupDualConeSwingLimits(joint::ConstraintHelper& ch, const D6JointData& data, const PxVec3& axis, float sin, float swingLimitYZ) +{ + ch.anglePair(PxAsin(sin), -swingLimitYZ, swingLimitYZ, data.swingLimit.contactDistance_deprecated, axis.getNormalized(), data.swingLimit); +} + +// PT: TODO: refactor with spherical joint code +static void setupConeSwingLimits(joint::ConstraintHelper& ch, const D6JointData& data, const PxQuat& swing, const PxTransform& cA2w) +{ + PxVec3 axis; + PxReal error; + const PxReal pad = data.swingLimit.isSoft() ? 0.0f : data.swingLimit.contactDistance_deprecated; + const Cm::ConeLimitHelperTanLess coneHelper(data.swingLimit.yAngle, data.swingLimit.zAngle, pad); + bool active = coneHelper.getLimit(swing, axis, error); + if(active) + ch.angularLimit(cA2w.rotate(axis), error, data.swingLimit); +} + +static void setupPyramidSwingLimits(joint::ConstraintHelper& ch, const D6JointData& data, const PxQuat& swing, const PxTransform& cA2w, bool useY, bool useZ) +{ + const PxQuat q = cA2w.q * swing; + const PxJointLimitPyramid& l = data.pyramidSwingLimit; + if(useY) + ch.anglePair(computeSwingAngle(swing.y, swing.w), l.yAngleMin, l.yAngleMax, l.contactDistance_deprecated, q.getBasisVector1(), l); + if(useZ) + ch.anglePair(computeSwingAngle(swing.z, swing.w), l.zAngleMin, l.zAngleMax, l.contactDistance_deprecated, q.getBasisVector2(), l); +} + +static void setupLinearLimit(joint::ConstraintHelper& ch, const PxJointLinearLimitPair& limit, const float origin, const PxVec3& axis) +{ + ch.linearLimit(axis, origin, limit.upper, limit); + ch.linearLimit(-axis, -origin, -limit.lower, limit); +} + +//TAG:solverprepshader +static PxU32 D6JointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool useExtendedLimits, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const D6JointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + const PxU32 SWING1_FLAG = 1<0.0f ? data.drivePosition.q : -data.drivePosition.q; + + const PxVec3& v = data.driveAngularVelocity; + const PxQuat delta = d2cA_q.getConjugate() * cB2cA.q; + + if(driving & (1< data.distanceMinDist) + ch.linearLimit(limitDir * (1.0f/distance), distance, data.distanceLimit.value, data.distanceLimit); + } + + if(data.mUseNewLinearLimits) // PT: new asymmetric linear limits + { + const PxVec3& bOriginInA = cB2cA.p; + + // PT: TODO: we check that the DOFs are not "locked" to be consistent with the prismatic joint, but it + // doesn't look like this case is possible, since it would be caught by the "isValid" check when setting + // the limits. And in fact the "distance" linear limit above doesn't do this check. + if((limited & (1<>3, ra, rb); + + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + /*cA2wOut = cA2w.p; + cB2wOut = cB2w.p;*/ + + // PT: TODO: check the number cannot be too high now + return ch.getCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gD6JointShaders = { D6JointSolverPrep, D6JointProject, D6JointVisualize, /*PxConstraintFlag::Enum(0)*/PxConstraintFlag::eGPU_COMPATIBLE }; + +PxConstraintSolverPrep D6Joint::getPrep() const { return gD6JointShaders.solverPrep; } + +PxD6Joint* physx::PxD6JointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxD6JointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxD6JointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxD6JointCreate: actors must be different"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxD6JointCreate: at least one actor must be dynamic"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gD6JointShaders); +} + +// PX_SERIALIZATION +void D6Joint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gD6JointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +void D6Joint::updateOmniPvdProperties() const +{ + const PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, d6TwistAngle, j, getTwistAngle()) + OMNI_PVD_SET(joint, d6SwingYAngle, j, getSwingYAngle()) + OMNI_PVD_SET(joint, d6SwingZAngle, j, getSwingZAngle()) +} + +template<> +void physx::Ext::omniPvdInitJoint(D6Joint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eD6) + OMNI_PVD_SET(joint, d6ProjectionLinearTolerance, j, joint->getProjectionLinearTolerance()) + OMNI_PVD_SET(joint, d6ProjectionAngularTolerance, j, joint->getProjectionAngularTolerance()) + + PxD6Motion::Enum motions[6]; + for (PxU32 i = 0; i < 6; ++i) + motions[i] = joint->getMotion(PxD6Axis::Enum(i)); + OMNI_PVD_SETB(joint, d6Motions, j, motions, sizeof(motions)) + + //Set limits lazily in the corresponding setters. + //This reduces unused data in OVD and allows for testing for the attribute presence + //to figure out what limit approaches are used, instead of also serializing + //mUseDistanceLimit, mUseNewLinearLimits, mUseConeLimit and mUsePyramidLimits. + + { + PxReal forceLimit[6]; + for (PxU32 i = 0; i < 6; ++i) + forceLimit[i] = joint->getDrive(PxD6Drive::Enum(i)).forceLimit; + OMNI_PVD_SETB(joint, d6DriveForceLimit, j, forceLimit, sizeof(forceLimit)) + PxD6JointDriveFlags flags[6]; + for (PxU32 i = 0; i < 6; ++i) + flags[i] = joint->getDrive(PxD6Drive::Enum(i)).flags; + OMNI_PVD_SETB(joint, d6DriveFlags, j, flags, sizeof(flags)) + PxReal stiffness[6]; + for (PxU32 i = 0; i < 6; ++i) + stiffness[i] = joint->getDrive(PxD6Drive::Enum(i)).stiffness; + OMNI_PVD_SETB(joint, d6DriveStiffness, j, stiffness, sizeof(stiffness)) + PxReal damping[6]; + for (PxU32 i = 0; i < 6; ++i) + damping[i] = joint->getDrive(PxD6Drive::Enum(i)).damping; + OMNI_PVD_SETB(joint, d6DriveDamping, j, damping, sizeof(damping)) + } + OMNI_PVD_SET(joint, d6DrivePosition, j, joint->getDrivePosition()) + PxVec3 driveLinVel, driveAngVel; joint->getDriveVelocity(driveLinVel, driveAngVel); + OMNI_PVD_SET(joint, d6DriveLinVelocity, j, driveLinVel) + OMNI_PVD_SET(joint, d6DriveAngVelocity, j, driveAngVel) + + OMNI_PVD_SET(joint, d6TwistAngle, j, joint->getTwistAngle()) + OMNI_PVD_SET(joint, d6SwingYAngle, j, joint->getSwingYAngle()) + OMNI_PVD_SET(joint, d6SwingZAngle, j, joint->getSwingZAngle()) +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.h new file mode 100644 index 0000000..4fdee66 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6Joint.h @@ -0,0 +1,172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_D6_JOINT_H +#define EXT_D6_JOINT_H + +#include "extensions/PxD6Joint.h" + +#include "ExtJoint.h" + +namespace physx +{ +struct PxD6JointGeneratedValues; +namespace Ext +{ + struct D6JointData : public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PxD6Motion::Enum motion[6]; + PxJointLinearLimit distanceLimit; + PxJointLinearLimitPair linearLimitX; + PxJointLinearLimitPair linearLimitY; + PxJointLinearLimitPair linearLimitZ; + PxJointAngularLimitPair twistLimit; + PxJointLimitCone swingLimit; + PxJointLimitPyramid pyramidSwingLimit; + + PxD6JointDrive drive[PxD6Drive::eCOUNT]; + + PxTransform drivePosition; + PxVec3 driveLinearVelocity; + PxVec3 driveAngularVelocity; + + // derived quantities + + PxU32 locked; // bitmap of locked DOFs + PxU32 limited; // bitmap of limited DOFs + PxU32 driving; // bitmap of active drives (implies driven DOFs not locked) + + PxReal distanceMinDist; // distance limit minimum distance to get a good direction + + // projection quantities + PxReal projectionLinearTolerance; + PxReal projectionAngularTolerance; + + // PT: the PxD6Motion values are now shared for both kind of linear limits, so we need + // an extra bool to know which one(s) should be actually used. + bool mUseDistanceLimit; + bool mUseNewLinearLimits; + + // PT: the swing limits can now be a cone or a pyramid, so we need + // an extra bool to know which one(s) should be actually used. + bool mUseConeLimit; + bool mUsePyramidLimits; + + private: + D6JointData(const PxJointLinearLimit& distance, + const PxJointLinearLimitPair& linearX, + const PxJointLinearLimitPair& linearY, + const PxJointLinearLimitPair& linearZ, + const PxJointAngularLimitPair& twist, + const PxJointLimitCone& swing, + const PxJointLimitPyramid& pyramid) : + distanceLimit (distance), + linearLimitX (linearX), + linearLimitY (linearY), + linearLimitZ (linearZ), + twistLimit (twist), + swingLimit (swing), + pyramidSwingLimit (pyramid), + mUseDistanceLimit (false), + mUseNewLinearLimits (false), + mUseConeLimit (false), + mUsePyramidLimits (false) + {} + }; + + typedef JointT D6JointT; + + class D6Joint : public D6JointT + { + public: +// PX_SERIALIZATION + D6Joint(PxBaseFlags baseFlags) : D6JointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static D6Joint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + D6Joint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxD6Joint + virtual void setMotion(PxD6Axis::Enum index, PxD6Motion::Enum t) PX_OVERRIDE; + virtual PxD6Motion::Enum getMotion(PxD6Axis::Enum index) const PX_OVERRIDE; + virtual PxReal getTwistAngle() const PX_OVERRIDE; + virtual PxReal getSwingYAngle() const PX_OVERRIDE; + virtual PxReal getSwingZAngle() const PX_OVERRIDE; + virtual void setDistanceLimit(const PxJointLinearLimit& l) PX_OVERRIDE; + virtual PxJointLinearLimit getDistanceLimit() const PX_OVERRIDE; + virtual void setLinearLimit(PxD6Axis::Enum axis, const PxJointLinearLimitPair& limit) PX_OVERRIDE; + virtual PxJointLinearLimitPair getLinearLimit(PxD6Axis::Enum axis) const PX_OVERRIDE; + virtual void setTwistLimit(const PxJointAngularLimitPair& l) PX_OVERRIDE; + virtual PxJointAngularLimitPair getTwistLimit() const PX_OVERRIDE; + virtual void setSwingLimit(const PxJointLimitCone& l) PX_OVERRIDE; + virtual PxJointLimitCone getSwingLimit() const PX_OVERRIDE; + virtual void setPyramidSwingLimit(const PxJointLimitPyramid& limit) PX_OVERRIDE; + virtual PxJointLimitPyramid getPyramidSwingLimit() const PX_OVERRIDE; + virtual void setDrive(PxD6Drive::Enum index, const PxD6JointDrive& d) PX_OVERRIDE; + virtual PxD6JointDrive getDrive(PxD6Drive::Enum index) const PX_OVERRIDE; + virtual void setDrivePosition(const PxTransform& pose, bool autowake = true) PX_OVERRIDE; + virtual PxTransform getDrivePosition() const PX_OVERRIDE; + virtual void setDriveVelocity(const PxVec3& linear, const PxVec3& angular, bool autowake = true) PX_OVERRIDE; + virtual void getDriveVelocity(PxVec3& linear, PxVec3& angular) const PX_OVERRIDE; + virtual void setProjectionLinearTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionLinearTolerance() const PX_OVERRIDE; + virtual void setProjectionAngularTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionAngularTolerance() const PX_OVERRIDE; + //~PxD6Joint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; + virtual void* prepareData() PX_OVERRIDE; +#if PX_SUPPORT_OMNI_PVD + virtual void updateOmniPvdProperties() const PX_OVERRIDE; +#endif + //~PxConstraintConnector + + private: + bool active(const PxD6Drive::Enum index) const + { + const PxD6JointDrive& d = data().drive[index]; + return d.stiffness!=0 || d.damping != 0; + } + + bool mRecomputeMotion; + bool mPadding[3]; // PT: padding from prev bool + }; + +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp new file mode 100644 index 0000000..050c3ff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtD6JointCreate.cpp @@ -0,0 +1,288 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMathUtils.h" +#include "extensions/PxD6JointCreate.h" +#include "extensions/PxD6Joint.h" +#include "extensions/PxFixedJoint.h" +#include "extensions/PxRevoluteJoint.h" +#include "extensions/PxSphericalJoint.h" +#include "extensions/PxPrismaticJoint.h" +#include "extensions/PxDistanceJoint.h" +#include "PxPhysics.h" + +using namespace physx; + +static const PxVec3 gX(1.0f, 0.0f, 0.0f); + +static void setRotY(PxMat33& m, PxReal angle) +{ + m = PxMat33(PxIdentity); + + const PxReal cos = cosf(angle); + const PxReal sin = sinf(angle); + + m[0][0] = m[2][2] = cos; + m[0][2] = -sin; + m[2][0] = sin; +} + +static void setRotZ(PxMat33& m, PxReal angle) +{ + m = PxMat33(PxIdentity); + + const PxReal cos = cosf(angle); + const PxReal sin = sinf(angle); + + m[0][0] = m[1][1] = cos; + m[0][1] = sin; + m[1][0] = -sin; +} + +static PxQuat getRotYQuat(float angle) +{ + PxMat33 m; + setRotY(m, angle); + return PxQuat(m); +} + +static PxQuat getRotZQuat(float angle) +{ + PxMat33 m; + setRotZ(m, angle); + return PxQuat(m); +} + +PxJoint* physx::PxD6JointCreate_Fixed(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, bool useD6) +{ + const PxTransform jointFrame0(localPos0); + const PxTransform jointFrame1(localPos1); + if(useD6) + // PT: by default all D6 axes are locked, i.e. it is a fixed joint. + return PxD6JointCreate(physics, actor0, jointFrame0, actor1, jointFrame1); + else + return PxFixedJointCreate(physics, actor0, jointFrame0, actor1, jointFrame1); +} + +PxJoint* physx::PxD6JointCreate_Distance(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float maxDist, bool useD6) +{ + const PxTransform localFrame0(localPos0); + const PxTransform localFrame1(localPos1); + + if(useD6) + { + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + + j->setMotion(PxD6Axis::eX, PxD6Motion::eLIMITED); + j->setMotion(PxD6Axis::eY, PxD6Motion::eLIMITED); + j->setMotion(PxD6Axis::eZ, PxD6Motion::eLIMITED); + j->setDistanceLimit(PxJointLinearLimit(PxTolerancesScale(), maxDist)); + return j; + } + else + { + PxDistanceJoint* j = PxDistanceJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setDistanceJointFlag(PxDistanceJointFlag::eMAX_DISTANCE_ENABLED, true); + j->setMaxDistance(maxDist); + return j; + } +} + +PxJoint* physx::PxD6JointCreate_Prismatic(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6) +{ + const PxQuat q = PxShortestRotation(gX, axis); + const PxTransform localFrame0(localPos0, q); + const PxTransform localFrame1(localPos1, q); + + const PxJointLinearLimitPair limit(PxTolerancesScale(), minLimit, maxLimit); + + if(useD6) + { + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setMotion(PxD6Axis::eX, PxD6Motion::eFREE); + if(minLimit==maxLimit) + j->setMotion(PxD6Axis::eX, PxD6Motion::eLOCKED); + else if(minLimit>maxLimit) + j->setMotion(PxD6Axis::eX, PxD6Motion::eFREE); + else// if(minLimitsetMotion(PxD6Axis::eX, PxD6Motion::eLIMITED); + j->setLinearLimit(PxD6Axis::eX, limit); + } + return j; + } + else + { + PxPrismaticJoint* j = PxPrismaticJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + if(minLimitsetPrismaticJointFlag(PxPrismaticJointFlag::eLIMIT_ENABLED, true); + j->setLimit(limit); + } + return j; + } +} + +PxJoint* physx::PxD6JointCreate_Revolute(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float minLimit, float maxLimit, bool useD6) +{ + const PxQuat q = PxShortestRotation(gX, axis); + const PxTransform localFrame0(localPos0, q); + const PxTransform localFrame1(localPos1, q); + + const PxJointAngularLimitPair limit(minLimit, maxLimit); + + if(useD6) + { + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + if(minLimit==maxLimit) + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eLOCKED); + else if(minLimit>maxLimit) + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + else// if(minLimitsetMotion(PxD6Axis::eTWIST, PxD6Motion::eLIMITED); + j->setTwistLimit(limit); + } + return j; + } + else + { + PxRevoluteJoint* j = PxRevoluteJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + if(minLimitsetRevoluteJointFlag(PxRevoluteJointFlag::eLIMIT_ENABLED, true); + j->setLimit(limit); + } + return j; + } +} + +PxJoint* physx::PxD6JointCreate_Spherical(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, float limit1, float limit2, bool useD6) +{ + const PxQuat q = PxShortestRotation(gX, axis); + const PxTransform localFrame0(localPos0, q); + const PxTransform localFrame1(localPos1, q); + + const PxJointLimitCone limit(limit1, limit2); + + if(useD6) + { + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + if(limit1>0.0f && limit2>0.0f) + { + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eLIMITED); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eLIMITED); + j->setSwingLimit(limit); + } + else + { + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + } + return j; + } + else + { + PxSphericalJoint* j = PxSphericalJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + if(limit1>0.0f && limit2>0.0f) + { + j->setSphericalJointFlag(PxSphericalJointFlag::eLIMIT_ENABLED, true); + j->setLimitCone(limit); + } + return j; + } +} + +PxJoint* physx::PxD6JointCreate_GenericCone(float& apiroty, float& apirotz, PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, float minLimit1, float maxLimit1, float minLimit2, float maxLimit2, bool useD6) +{ + const float DesiredMinSwingY = minLimit1; + const float DesiredMaxSwingY = maxLimit1; + const float DesiredMinSwingZ = minLimit2; + const float DesiredMaxSwingZ = maxLimit2; + const float APIMaxY = (DesiredMaxSwingY - DesiredMinSwingY)*0.5f; + const float APIMaxZ = (DesiredMaxSwingZ - DesiredMinSwingZ)*0.5f; + const float APIRotY = (DesiredMaxSwingY + DesiredMinSwingY)*0.5f; + const float APIRotZ = (DesiredMaxSwingZ + DesiredMinSwingZ)*0.5f; + apiroty = APIRotY; + apirotz = APIRotZ; + + const PxQuat RotY = getRotYQuat(APIRotY); + const PxQuat RotZ = getRotZQuat(APIRotZ); + const PxQuat Rot = RotY * RotZ; + + const PxTransform localFrame0(localPos0, Rot); + const PxTransform localFrame1(localPos1); + + const PxJointLimitCone limit(APIMaxY, APIMaxZ); + + if(useD6) + { + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eLIMITED); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eLIMITED); + j->setSwingLimit(limit); + return j; + } + else + { + PxSphericalJoint* j = PxSphericalJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setSphericalJointFlag(PxSphericalJointFlag::eLIMIT_ENABLED, true); + j->setLimitCone(limit); + return j; + } +} + +PxJoint* physx::PxD6JointCreate_Pyramid(PxPhysics& physics, PxRigidActor* actor0, const PxVec3& localPos0, PxRigidActor* actor1, const PxVec3& localPos1, const PxVec3& axis, + float minLimit1, float maxLimit1, float minLimit2, float maxLimit2) +{ + const PxQuat q = PxShortestRotation(gX, axis); + const PxTransform localFrame0(localPos0, q); + const PxTransform localFrame1(localPos1, q); + + const PxJointLimitPyramid limit(minLimit1, maxLimit1, minLimit2, maxLimit2); + + PxD6Joint* j = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + j->setMotion(PxD6Axis::eTWIST, PxD6Motion::eFREE); + if(limit.isValid()) + { + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eLIMITED); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eLIMITED); + j->setPyramidSwingLimit(limit); + } + else + { + j->setMotion(PxD6Axis::eSWING1, PxD6Motion::eFREE); + j->setMotion(PxD6Axis::eSWING2, PxD6Motion::eFREE); + } + return j; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp new file mode 100644 index 0000000..61b751c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.cpp @@ -0,0 +1,217 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtDefaultCpuDispatcher.h" +#include "ExtCpuWorkerThread.h" +#include "ExtTaskQueueHelper.h" +#include "foundation/PxString.h" + +using namespace physx; + +PxDefaultCpuDispatcher* physx::PxDefaultCpuDispatcherCreate(PxU32 numThreads, PxU32* affinityMasks, PxDefaultCpuDispatcherWaitForWorkMode::Enum mode, PxU32 yieldProcessorCount) +{ + return PX_NEW(Ext::DefaultCpuDispatcher)(numThreads, affinityMasks, mode, yieldProcessorCount); +} + +#if !PX_SWITCH +void Ext::DefaultCpuDispatcher::getAffinityMasks(PxU32* affinityMasks, PxU32 threadCount) +{ + for(PxU32 i=0; i < threadCount; i++) + { + affinityMasks[i] = 0; + } +} +#endif + +Ext::DefaultCpuDispatcher::DefaultCpuDispatcher(PxU32 numThreads, PxU32* affinityMasks, PxDefaultCpuDispatcherWaitForWorkMode::Enum mode, PxU32 yieldProcessorCount) + : mQueueEntryPool(EXT_TASK_QUEUE_ENTRY_POOL_SIZE, "QueueEntryPool"), mNumThreads(numThreads), mShuttingDown(false) +#if PX_PROFILE + ,mRunProfiled(true) +#else + ,mRunProfiled(false) +#endif + , mWaitForWorkMode(mode) + , mYieldProcessorCount(yieldProcessorCount) +{ + PX_CHECK_MSG((((PxDefaultCpuDispatcherWaitForWorkMode::eYIELD_PROCESSOR == mWaitForWorkMode) && (mYieldProcessorCount > 0)) || + (((PxDefaultCpuDispatcherWaitForWorkMode::eYIELD_THREAD == mWaitForWorkMode) || (PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK == mWaitForWorkMode)) && (0 == mYieldProcessorCount))), "Illegal yield processor count for chosen execute mode"); + + PxU32* defaultAffinityMasks = NULL; + + if(!affinityMasks) + { + defaultAffinityMasks = PX_ALLOCATE(PxU32, numThreads, "ThreadAffinityMasks"); + getAffinityMasks(defaultAffinityMasks, numThreads); + affinityMasks = defaultAffinityMasks; + } + + // initialize threads first, then start + + mWorkerThreads = PX_ALLOCATE(CpuWorkerThread, numThreads, "CpuWorkerThread"); + const PxU32 nameLength = 32; + mThreadNames = PX_ALLOCATE(PxU8, nameLength * numThreads, "CpuWorkerThreadName"); + + if (mWorkerThreads) + { + for(PxU32 i = 0; i < numThreads; ++i) + { + PX_PLACEMENT_NEW(mWorkerThreads+i, CpuWorkerThread)(); + mWorkerThreads[i].initialize(this); + } + + for(PxU32 i = 0; i < numThreads; ++i) + { + if (mThreadNames) + { + char* threadName = reinterpret_cast(mThreadNames + (i*nameLength)); + Pxsnprintf(threadName, nameLength, "PxWorker%02d", i); + mWorkerThreads[i].setName(threadName); + } + + mWorkerThreads[i].setAffinityMask(affinityMasks[i]); + mWorkerThreads[i].start(PxThread::getDefaultStackSize()); + } + + PX_FREE(defaultAffinityMasks); + } + else + { + mNumThreads = 0; + } +} + +Ext::DefaultCpuDispatcher::~DefaultCpuDispatcher() +{ + for(PxU32 i = 0; i < mNumThreads; ++i) + mWorkerThreads[i].signalQuit(); + + mShuttingDown = true; + if(PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK == mWaitForWorkMode) + mWorkReady.set(); + for(PxU32 i = 0; i < mNumThreads; ++i) + mWorkerThreads[i].waitForQuit(); + + for(PxU32 i = 0; i < mNumThreads; ++i) + mWorkerThreads[i].~CpuWorkerThread(); + + PX_FREE(mWorkerThreads); + PX_FREE(mThreadNames); +} + +void Ext::DefaultCpuDispatcher::release() +{ + PX_DELETE_THIS; +} + +void Ext::DefaultCpuDispatcher::submitTask(PxBaseTask& task) +{ + if(!mNumThreads) + { + // no worker threads, run directly + runTask(task); + task.release(); + return; + } + + // TODO: Could use TLS to make this more efficient + const PxThread::Id currentThread = PxThread::getId(); + const PxU32 nbThreads = mNumThreads; + for(PxU32 i=0; i process + // 4) else -> wait for wake signal + // + // If a thread reaches 1) after the thread pool signaled wake up, + // the wake up sync gets reset and all other threads which have not + // passed 4) already will wait forever. + // The code below makes sure that on shutdown, the wake up signal gets + // sent again after it was reset + // + if (mShuttingDown) + mWorkReady.set(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.h new file mode 100644 index 0000000..8f77ab8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultCpuDispatcher.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_DEFAULT_CPU_DISPATCHER_H +#define EXT_DEFAULT_CPU_DISPATCHER_H + +#include "common/PxProfileZone.h" +#include "task/PxTask.h" +#include "extensions/PxDefaultCpuDispatcher.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxSync.h" +#include "foundation/PxSList.h" +#include "ExtSharedQueueEntryPool.h" + +namespace physx +{ +namespace Ext +{ + class CpuWorkerThread; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif // Because of the SList member I assume + + class DefaultCpuDispatcher : public PxDefaultCpuDispatcher, public PxUserAllocated + { + friend class TaskQueueHelper; + PX_NOCOPY(DefaultCpuDispatcher) + private: + ~DefaultCpuDispatcher(); + public: + DefaultCpuDispatcher(PxU32 numThreads, PxU32* affinityMasks, PxDefaultCpuDispatcherWaitForWorkMode::Enum mode = PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK, PxU32 yieldProcessorCount = 0); + + // PxCpuDispatcher + virtual void submitTask(PxBaseTask& task) PX_OVERRIDE; + virtual PxU32 getWorkerCount() const PX_OVERRIDE { return mNumThreads; } + //~PxCpuDispatcher + + // PxDefaultCpuDispatcher + virtual void release() PX_OVERRIDE; + virtual void setRunProfiled(bool runProfiled) PX_OVERRIDE { mRunProfiled = runProfiled; } + virtual bool getRunProfiled() const PX_OVERRIDE { return mRunProfiled; } + //~PxDefaultCpuDispatcher + + PxBaseTask* getJob(); + PxBaseTask* stealJob(); + PxBaseTask* fetchNextTask(); + + PX_FORCE_INLINE void runTask(PxBaseTask& task) + { + if(mRunProfiled) + { + PX_PROFILE_ZONE(task.getName(), task.getContextId()); + task.run(); + } + else + task.run(); + } + + void waitForWork() { PX_ASSERT(PxDefaultCpuDispatcherWaitForWorkMode::eWAIT_FOR_WORK == mWaitForWorkMode); mWorkReady.wait(); } + void resetWakeSignal(); + + static void getAffinityMasks(PxU32* affinityMasks, PxU32 threadCount); + + PX_FORCE_INLINE PxDefaultCpuDispatcherWaitForWorkMode::Enum getWaitForWorkMode() const { return mWaitForWorkMode; } + PX_FORCE_INLINE PxU32 getYieldProcessorCount() const { return mYieldProcessorCount; } + + protected: + CpuWorkerThread* mWorkerThreads; + SharedQueueEntryPool<> mQueueEntryPool; + PxSList mJobList; + PxSync mWorkReady; + PxU8* mThreadNames; + PxU32 mNumThreads; + bool mShuttingDown; + bool mRunProfiled; + const PxDefaultCpuDispatcherWaitForWorkMode::Enum mWaitForWorkMode; + const PxU32 mYieldProcessorCount; + }; + +#if PX_VC +#pragma warning(pop) +#endif + +} // namespace Ext +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp new file mode 100644 index 0000000..8eda7a0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultErrorCallback.cpp @@ -0,0 +1,104 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAssert.h" +#include "foundation/PxString.h" +#include "foundation/PxThread.h" +#include "extensions/PxDefaultErrorCallback.h" + +#include + +using namespace physx; + + +PxDefaultErrorCallback::PxDefaultErrorCallback() +{ +} + +PxDefaultErrorCallback::~PxDefaultErrorCallback() +{ +} + +void PxDefaultErrorCallback::reportError(PxErrorCode::Enum e, const char* message, const char* file, int line) +{ + const char* errorCode = NULL; + + switch (e) + { + case PxErrorCode::eNO_ERROR: + errorCode = "no error"; + break; + case PxErrorCode::eINVALID_PARAMETER: + errorCode = "invalid parameter"; + break; + case PxErrorCode::eINVALID_OPERATION: + errorCode = "invalid operation"; + break; + case PxErrorCode::eOUT_OF_MEMORY: + errorCode = "out of memory"; + break; + case PxErrorCode::eDEBUG_INFO: + errorCode = "info"; + break; + case PxErrorCode::eDEBUG_WARNING: + errorCode = "warning"; + break; + case PxErrorCode::ePERF_WARNING: + errorCode = "performance warning"; + break; + case PxErrorCode::eABORT: + errorCode = "abort"; + break; + case PxErrorCode::eINTERNAL_ERROR: + errorCode = "internal error"; + break; + case PxErrorCode::eMASK_ALL: + errorCode = "unknown error"; + break; + } + + PX_ASSERT(errorCode); + if(errorCode) + { + char buffer[1024]; + sprintf(buffer, "%s (%d) : %s : %s\n", file, line, errorCode, message); + + PxPrintString(buffer); + + // in debug builds halt execution for abort codes + PX_ASSERT(e != PxErrorCode::eABORT); + + // in release builds we also want to halt execution + // and make sure that the error message is flushed + while (e == PxErrorCode::eABORT) + { + PxPrintString(buffer); + PxThread::sleep(1000); + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp new file mode 100644 index 0000000..6297fb2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultSimulationFilterShader.cpp @@ -0,0 +1,331 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "extensions/PxDefaultSimulationFilterShader.h" +#include "PxRigidActor.h" +#include "PxShape.h" + +#include "foundation/PxIntrinsics.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxInlineArray.h" + +using namespace physx; + +namespace +{ + #define GROUP_SIZE 32 + + struct PxCollisionBitMap + { + PX_INLINE PxCollisionBitMap() : enable(true) {} + + bool operator()() const { return enable; } + bool& operator= (const bool &v) { enable = v; return enable; } + + private: + bool enable; + }; + + PxCollisionBitMap gCollisionTable[GROUP_SIZE][GROUP_SIZE]; + + PxFilterOp::Enum gFilterOps[3] = { PxFilterOp::PX_FILTEROP_AND, PxFilterOp::PX_FILTEROP_AND, PxFilterOp::PX_FILTEROP_AND }; + + PxGroupsMask gFilterConstants[2]; + + bool gFilterBool = false; + + static void gAND(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(mask0.bits0 & mask1.bits0); + results.bits1 = PxU16(mask0.bits1 & mask1.bits1); + results.bits2 = PxU16(mask0.bits2 & mask1.bits2); + results.bits3 = PxU16(mask0.bits3 & mask1.bits3); + } + static void gOR(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(mask0.bits0 | mask1.bits0); + results.bits1 = PxU16(mask0.bits1 | mask1.bits1); + results.bits2 = PxU16(mask0.bits2 | mask1.bits2); + results.bits3 = PxU16(mask0.bits3 | mask1.bits3); + } + static void gXOR(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(mask0.bits0 ^ mask1.bits0); + results.bits1 = PxU16(mask0.bits1 ^ mask1.bits1); + results.bits2 = PxU16(mask0.bits2 ^ mask1.bits2); + results.bits3 = PxU16(mask0.bits3 ^ mask1.bits3); + } + static void gNAND(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(~(mask0.bits0 & mask1.bits0)); + results.bits1 = PxU16(~(mask0.bits1 & mask1.bits1)); + results.bits2 = PxU16(~(mask0.bits2 & mask1.bits2)); + results.bits3 = PxU16(~(mask0.bits3 & mask1.bits3)); + } + static void gNOR(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(~(mask0.bits0 | mask1.bits0)); + results.bits1 = PxU16(~(mask0.bits1 | mask1.bits1)); + results.bits2 = PxU16(~(mask0.bits2 | mask1.bits2)); + results.bits3 = PxU16(~(mask0.bits3 | mask1.bits3)); + } + static void gNXOR(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(~(mask0.bits0 ^ mask1.bits0)); + results.bits1 = PxU16(~(mask0.bits1 ^ mask1.bits1)); + results.bits2 = PxU16(~(mask0.bits2 ^ mask1.bits2)); + results.bits3 = PxU16(~(mask0.bits3 ^ mask1.bits3)); + } + + static void gSWAP_AND(PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1) + { + results.bits0 = PxU16(mask0.bits0 & mask1.bits2); + results.bits1 = PxU16(mask0.bits1 & mask1.bits3); + results.bits2 = PxU16(mask0.bits2 & mask1.bits0); + results.bits3 = PxU16(mask0.bits3 & mask1.bits1); + } + + typedef void (*FilterFunction) (PxGroupsMask& results, const PxGroupsMask& mask0, const PxGroupsMask& mask1); + + FilterFunction const gTable[] = { gAND, gOR, gXOR, gNAND, gNOR, gNXOR, gSWAP_AND }; + + static PxFilterData convert(const PxGroupsMask& mask) + { + PxFilterData fd; + + fd.word2 = PxU32(mask.bits0 | (mask.bits1 << 16)); + fd.word3 = PxU32(mask.bits2 | (mask.bits3 << 16)); + + return fd; + } + + static PxGroupsMask convert(const PxFilterData& fd) + { + PxGroupsMask mask; + + mask.bits0 = PxU16((fd.word2 & 0xffff)); + mask.bits1 = PxU16((fd.word2 >> 16)); + mask.bits2 = PxU16((fd.word3 & 0xffff)); + mask.bits3 = PxU16((fd.word3 >> 16)); + + return mask; + } + + static bool getFilterData(const PxActor& actor, PxFilterData& fd) + { + PxActorType::Enum aType = actor.getType(); + switch (aType) + { + case PxActorType::eRIGID_DYNAMIC: + case PxActorType::eRIGID_STATIC: + case PxActorType::eARTICULATION_LINK: + { + const PxRigidActor& rActor = static_cast(actor); + PX_CHECK_AND_RETURN_VAL(rActor.getNbShapes() >= 1,"There must be a shape in actor", false); + + PxShape* shape = NULL; + rActor.getShapes(&shape, 1); + + fd = shape->getSimulationFilterData(); + } + break; + default: + break; + } + + return true; + } + + PX_FORCE_INLINE static void adjustFilterData(bool groupsMask, const PxFilterData& src, PxFilterData& dst) + { + if (groupsMask) + { + dst.word2 = src.word2; + dst.word3 = src.word3; + } + else + dst.word0 = src.word0; + } + + template + static void setFilterData(PxActor& actor, const PxFilterData& fd) + { + PxActorType::Enum aType = actor.getType(); + switch (aType) + { + case PxActorType::eRIGID_DYNAMIC: + case PxActorType::eRIGID_STATIC: + case PxActorType::eARTICULATION_LINK: + { + const PxRigidActor& rActor = static_cast(actor); + + PxShape* shape; + for(PxU32 i=0; i < rActor.getNbShapes(); i++) + { + rActor.getShapes(&shape, 1, i); + + // retrieve current group mask + PxFilterData resultFd = shape->getSimulationFilterData(); + + adjustFilterData(TGroupsMask, fd, resultFd); + + // set new filter data + shape->setSimulationFilterData(resultFd); + } + } + break; + default: + break; + } + } +} + +PxFilterFlags physx::PxDefaultSimulationFilterShader( + PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, + PxU32 constantBlockSize) +{ + PX_UNUSED(constantBlock); + PX_UNUSED(constantBlockSize); + + // let triggers through + if(PxFilterObjectIsTrigger(attributes0) || PxFilterObjectIsTrigger(attributes1)) + { + pairFlags = PxPairFlag::eTRIGGER_DEFAULT; + return PxFilterFlags(); + } + + // Collision Group + if (!gCollisionTable[filterData0.word0][filterData1.word0]()) + { + return PxFilterFlag::eSUPPRESS; + } + + // Filter function + PxGroupsMask g0 = convert(filterData0); + PxGroupsMask g1 = convert(filterData1); + + PxGroupsMask g0k0; gTable[gFilterOps[0]](g0k0, g0, gFilterConstants[0]); + PxGroupsMask g1k1; gTable[gFilterOps[1]](g1k1, g1, gFilterConstants[1]); + PxGroupsMask final; gTable[gFilterOps[2]](final, g0k0, g1k1); + + bool r = final.bits0 || final.bits1 || final.bits2 || final.bits3; + if (r != gFilterBool) + { + return PxFilterFlag::eSUPPRESS; + } + + pairFlags = PxPairFlag::eCONTACT_DEFAULT; + + return PxFilterFlags(); +} + +bool physx::PxGetGroupCollisionFlag(const PxU16 group1, const PxU16 group2) +{ + PX_CHECK_AND_RETURN_NULL(group1 < 32 && group2 < 32, "Group must be less than 32"); + + return gCollisionTable[group1][group2](); +} + +void physx::PxSetGroupCollisionFlag(const PxU16 group1, const PxU16 group2, const bool enable) +{ + PX_CHECK_AND_RETURN(group1 < 32 && group2 < 32, "Group must be less than 32"); + + gCollisionTable[group1][group2] = enable; + gCollisionTable[group2][group1] = enable; +} + +PxU16 physx::PxGetGroup(const PxActor& actor) +{ + PxFilterData fd; + getFilterData(actor, fd); + return PxU16(fd.word0); +} + +void physx::PxSetGroup(PxActor& actor, const PxU16 collisionGroup) +{ + PX_CHECK_AND_RETURN(collisionGroup < 32,"Collision group must be less than 32"); + PxFilterData fd(collisionGroup, 0, 0, 0); + setFilterData(actor, fd); +} + +void physx::PxGetFilterOps(PxFilterOp::Enum& op0, PxFilterOp::Enum& op1, PxFilterOp::Enum& op2) +{ + op0 = gFilterOps[0]; + op1 = gFilterOps[1]; + op2 = gFilterOps[2]; +} + +void physx::PxSetFilterOps(const PxFilterOp::Enum& op0, const PxFilterOp::Enum& op1, const PxFilterOp::Enum& op2) +{ + gFilterOps[0] = op0; + gFilterOps[1] = op1; + gFilterOps[2] = op2; +} + +bool physx::PxGetFilterBool() +{ + return gFilterBool; +} + +void physx::PxSetFilterBool(const bool enable) +{ + gFilterBool = enable; +} + +void physx::PxGetFilterConstants(PxGroupsMask& c0, PxGroupsMask& c1) +{ + c0 = gFilterConstants[0]; + c1 = gFilterConstants[1]; +} + +void physx::PxSetFilterConstants(const PxGroupsMask& c0, const PxGroupsMask& c1) +{ + gFilterConstants[0] = c0; + gFilterConstants[1] = c1; +} + +PxGroupsMask physx::PxGetGroupsMask(const PxActor& actor) +{ + PxFilterData fd; + if (getFilterData(actor, fd)) + return convert(fd); + else + return PxGroupsMask(); +} + +void physx::PxSetGroupsMask(PxActor& actor, const PxGroupsMask& mask) +{ + PxFilterData fd = convert(mask); + setFilterData(actor, fd); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp new file mode 100644 index 0000000..b4bb4e1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDefaultStreams.cpp @@ -0,0 +1,193 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxAssert.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxMemory.h" +#include "foundation/PxBitUtils.h" +#include "extensions/PxDefaultStreams.h" + +#include "SnFile.h" +#include "foundation/PxUtilities.h" + +#include + +using namespace physx; + +PxDefaultMemoryOutputStream::PxDefaultMemoryOutputStream(PxAllocatorCallback &allocator) +: mAllocator (allocator) +, mData (NULL) +, mSize (0) +, mCapacity (0) +{ +} + +PxDefaultMemoryOutputStream::~PxDefaultMemoryOutputStream() +{ + if(mData) + mAllocator.deallocate(mData); +} + +PxU32 PxDefaultMemoryOutputStream::write(const void* src, PxU32 size) +{ + PxU32 expectedSize = mSize + size; + if(expectedSize > mCapacity) + { + mCapacity = PxMax(PxNextPowerOfTwo(expectedSize), 4096u); + + PxU8* newData = reinterpret_cast(mAllocator.allocate(mCapacity,"PxDefaultMemoryOutputStream",__FILE__,__LINE__)); + PX_ASSERT(newData!=NULL); + + PxMemCopy(newData, mData, mSize); + if(mData) + mAllocator.deallocate(mData); + + mData = newData; + } + PxMemCopy(mData+mSize, src, size); + mSize += size; + return size; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxDefaultMemoryInputData::PxDefaultMemoryInputData(PxU8* data, PxU32 length) : + mSize (length), + mData (data), + mPos (0) +{ +} + +PxU32 PxDefaultMemoryInputData::read(void* dest, PxU32 count) +{ + PxU32 length = PxMin(count, mSize-mPos); + PxMemCopy(dest, mData+mPos, length); + mPos += length; + return length; +} + +PxU32 PxDefaultMemoryInputData::getLength() const +{ + return mSize; +} + +void PxDefaultMemoryInputData::seek(PxU32 offset) +{ + mPos = PxMin(mSize, offset); +} + +PxU32 PxDefaultMemoryInputData::tell() const +{ + return mPos; +} + +PxDefaultFileOutputStream::PxDefaultFileOutputStream(const char* filename) +{ + mFile = NULL; + sn::fopen_s(&mFile, filename, "wb"); + // PT: when this fails, check that: + // - the path is correct + // - the file does not already exist. If it does, check that it is not write protected. + if(NULL == mFile) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "Unable to open file %s, errno 0x%x\n",filename,errno); + } + PX_ASSERT(mFile); +} + +PxDefaultFileOutputStream::~PxDefaultFileOutputStream() +{ + if(mFile) + fclose(mFile); + mFile = NULL; +} + +PxU32 PxDefaultFileOutputStream::write(const void* src, PxU32 count) +{ + return mFile ? PxU32(fwrite(src, 1, count, mFile)) : 0; +} + +bool PxDefaultFileOutputStream::isValid() +{ + return mFile != NULL; +} + +/////////////////////////////////////////////////////////////////////////////// + +PxDefaultFileInputData::PxDefaultFileInputData(const char* filename) +{ + mFile = NULL; + sn::fopen_s(&mFile, filename, "rb"); + + if(mFile) + { + fseek(mFile, 0, SEEK_END); + mLength = PxU32(ftell(mFile)); + fseek(mFile, 0, SEEK_SET); + } + else + { + mLength = 0; + } +} + +PxDefaultFileInputData::~PxDefaultFileInputData() +{ + if(mFile) + fclose(mFile); +} + +PxU32 PxDefaultFileInputData::read(void* dest, PxU32 count) +{ + PX_ASSERT(mFile); + const size_t size = fread(dest, 1, count, mFile); + // there should be no assert here since by spec of PxInputStream we can read fewer bytes than expected + return PxU32(size); +} + +PxU32 PxDefaultFileInputData::getLength() const +{ + return mLength; +} + +void PxDefaultFileInputData::seek(PxU32 pos) +{ + fseek(mFile, long(pos), SEEK_SET); +} + +PxU32 PxDefaultFileInputData::tell() const +{ + return PxU32(ftell(mFile)); +} + +bool PxDefaultFileInputData::isValid() const +{ + return mFile != NULL; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp new file mode 100644 index 0000000..5b311ce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.cpp @@ -0,0 +1,360 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtDistanceJoint.h" +#include "ExtConstraintHelper.h" + +using namespace physx; +using namespace Ext; + +DistanceJoint::DistanceJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + DistanceJointT(PxJointConcreteType::eDISTANCE, actor0, localFrame0, actor1, localFrame1, "DistanceJointData") +{ + DistanceJointData* data = static_cast(mData); + + data->stiffness = 0.0f; + data->damping = 0.0f; + data->contactDistance = 0.0f; + data->minDistance = 0.0f; + data->maxDistance = 0.0f; + data->tolerance = 0.025f * scale.length; + data->jointFlags = PxDistanceJointFlag::eMAX_DISTANCE_ENABLED; +} + +PxReal DistanceJoint::getDistance() const +{ + return getRelativeTransform().p.magnitude(); +} + +void DistanceJoint::setMinDistance(PxReal distance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(distance) && distance>=0.0f, "PxDistanceJoint::setMinDistance: invalid parameter"); + data().minDistance = distance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceMinDistance, static_cast(*this), distance) +#endif +} + +PxReal DistanceJoint::getMinDistance() const +{ + return data().minDistance; +} + +void DistanceJoint::setMaxDistance(PxReal distance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(distance) && distance>=0.0f, "PxDistanceJoint::setMaxDistance: invalid parameter"); + data().maxDistance = distance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceMaxDistance, static_cast(*this), distance) +#endif +} + +PxReal DistanceJoint::getMaxDistance() const +{ + return data().maxDistance; +} + +void DistanceJoint::setTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance), "PxDistanceJoint::setTolerance: invalid parameter"); + data().tolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal DistanceJoint::getTolerance() const +{ + return data().tolerance; +} + +void DistanceJoint::setStiffness(PxReal stiffness) +{ + PX_CHECK_AND_RETURN(PxIsFinite(stiffness), "PxDistanceJoint::setStiffness: invalid parameter"); + data().stiffness = stiffness; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceStiffness, static_cast(*this), stiffness) +#endif +} + +PxReal DistanceJoint::getStiffness() const +{ + return data().stiffness; +} + +void DistanceJoint::setDamping(PxReal damping) +{ + PX_CHECK_AND_RETURN(PxIsFinite(damping), "PxDistanceJoint::setDamping: invalid parameter"); + data().damping = damping; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceDamping, static_cast(*this), damping) +#endif +} + +PxReal DistanceJoint::getDamping() const +{ + return data().damping; +} + +void DistanceJoint::setContactDistance(PxReal contactDistance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(contactDistance) && contactDistance>=0.0f, "PxDistanceJoint::setContactDistance: invalid parameter"); + data().contactDistance = contactDistance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceContactDistance, static_cast(*this), contactDistance) +#endif +} + +PxReal DistanceJoint::getContactDistance() const +{ + return data().contactDistance; +} + +PxDistanceJointFlags DistanceJoint::getDistanceJointFlags(void) const +{ + return data().jointFlags; +} + +void DistanceJoint::setDistanceJointFlags(PxDistanceJointFlags flags) +{ + data().jointFlags = flags; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceJointFlags, static_cast(*this), flags) +#endif +} + +void DistanceJoint::setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) +{ + if(value) + data().jointFlags |= flag; + else + data().jointFlags &= ~flag; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, distanceJointFlags, static_cast(*this), getDistanceJointFlags()) +#endif +} + +static void DistanceJointProject(const void* /*constantBlock*/, PxTransform& /*bodyAToWorld*/, PxTransform& /*bodyBToWorld*/, bool /*projectToA*/) +{ + // TODO +} + +static void DistanceJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + const DistanceJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + viz.visualizeJointFrames(cA2w, cB2w); + + // PT: we consider the following is part of the joint's "limits" since that's the only available flag we have + if(flags & PxConstraintVisualizationFlag::eLIMITS) + { + const bool enforceMax = (data.jointFlags & PxDistanceJointFlag::eMAX_DISTANCE_ENABLED); + const bool enforceMin = (data.jointFlags & PxDistanceJointFlag::eMIN_DISTANCE_ENABLED); + if(!enforceMin && !enforceMax) + return; + + PxVec3 dir = cB2w.p - cA2w.p; + const float currentDist = dir.normalize(); + + PxU32 color = 0x00ff00; + if(enforceMax && currentDist>data.maxDistance) + color = 0xff0000; + if(enforceMin && currentDist=data.minDistance) + c.flags |= Px1DConstraintFlag::eKEEPBIAS; + return 1; + } + return 0; +} + +static PX_FORCE_INLINE PxU32 setupMaxConstraint(Px1DConstraint& c, const PxVec3& direction, const PxVec3& angular0, const PxVec3& angular1, const DistanceJointData& data, float distance, float contactDistance) +{ + if(distance > data.maxDistance - contactDistance) + { + setupContraint(c, direction, angular0, angular1, data); + c.geometricError = distance - data.maxDistance - data.tolerance; + c.maxImpulse = 0.0f; + if(distance<=data.maxDistance) + c.flags |= Px1DConstraintFlag::eKEEPBIAS; + return 1; + } + return 0; +} + +//TAG:solverprepshader +static PxU32 DistanceJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const DistanceJointData& data = *reinterpret_cast(constantBlock); + + const bool enforceMax = (data.jointFlags & PxDistanceJointFlag::eMAX_DISTANCE_ENABLED) && data.maxDistance>=0.0f; + const bool enforceMin = (data.jointFlags & PxDistanceJointFlag::eMIN_DISTANCE_ENABLED) && data.minDistance>=0.0f; + if(!enforceMax && !enforceMin) + return 0; + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + cA2wOut = cB2w.p; + cB2wOut = cB2w.p; + + PxVec3 direction = cA2w.p - cB2w.p; + const PxReal distance = direction.normalize(); + +#define EPS_REAL 1.192092896e-07F + + if(distance < EPS_REAL) + direction = PxVec3(1.0f, 0.0f, 0.0f); + + Px1DConstraint* c = constraints; + + const PxVec3 angular0 = ch.getRa().cross(direction); + const PxVec3 angular1 = ch.getRb().cross(direction); + + if(enforceMin && !enforceMax) + return setupMinConstraint(*c, direction, angular0, angular1, data, distance, data.contactDistance); + else if(enforceMax && !enforceMin) + return setupMaxConstraint(*c, direction, angular0, angular1, data, distance, data.contactDistance); + else + { + if(data.minDistance == data.maxDistance) + { + setupContraint(*c, direction, angular0, angular1, data); + + //add tolerance so we don't have contact-style jitter problem. + const PxReal error = distance - data.maxDistance; + c->geometricError = error > data.tolerance ? error - data.tolerance : + error < -data.tolerance ? error + data.tolerance : 0.0f; + return 1; + } + + // since we dont know the current rigid velocity, we need to insert row for both limits + PxU32 nb = setupMinConstraint(*c, direction, angular0, angular1, data, distance, data.contactDistance); + if(nb) + c++; + nb += setupMaxConstraint(*c, direction, angular0, angular1, data, distance, data.contactDistance); + return nb; + } +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gDistanceJointShaders = { DistanceJointSolverPrep, DistanceJointProject, DistanceJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep DistanceJoint::getPrep() const { return gDistanceJointShaders.solverPrep; } + +PxDistanceJoint* physx::PxDistanceJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxDistanceJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxDistanceJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxDistanceJointCreate: actors must be different"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxD6JointCreate: at least one actor must be dynamic"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gDistanceJointShaders); +} + +// PX_SERIALIZATION +void DistanceJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gDistanceJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +void DistanceJoint::updateOmniPvdProperties() const +{ + const PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, distanceDistance, j, getDistance()) +} + +template<> +void physx::Ext::omniPvdInitJoint(DistanceJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eDISTANCE) + OMNI_PVD_SET(joint, distanceMinDistance, j, joint->getMinDistance()) + OMNI_PVD_SET(joint, distanceMaxDistance, j, joint->getMaxDistance()) + OMNI_PVD_SET(joint, distanceTolerance, j, joint->getTolerance()) + OMNI_PVD_SET(joint, distanceStiffness, j, joint->getStiffness()) + OMNI_PVD_SET(joint, distanceDamping, j, joint->getDamping()) + OMNI_PVD_SET(joint, distanceContactDistance, j, joint->getContactDistance()) + OMNI_PVD_SET(joint, distanceJointFlags, j, joint->getDistanceJointFlags()) + OMNI_PVD_SET(joint, distanceDistance, j, joint->getDistance()) +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.h new file mode 100644 index 0000000..e7d1e8d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtDistanceJoint.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_DISTANCE_JOINT_H +#define EXT_DISTANCE_JOINT_H + +#include "common/PxTolerancesScale.h" +#include "extensions/PxDistanceJoint.h" + +#include "ExtJoint.h" +#include "foundation/PxUserAllocated.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxDistanceJointGeneratedValues; +namespace Ext +{ + struct DistanceJointData : public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PxReal minDistance; + PxReal maxDistance; + PxReal tolerance; + PxReal stiffness; + PxReal damping; + PxReal contactDistance; + + PxDistanceJointFlags jointFlags; + }; + + typedef JointT DistanceJointT; + class DistanceJoint : public DistanceJointT + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + DistanceJoint(PxBaseFlags baseFlags) : DistanceJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static DistanceJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + DistanceJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxDistanceJoint + virtual PxReal getDistance() const PX_OVERRIDE; + virtual void setMinDistance(PxReal distance) PX_OVERRIDE; + virtual PxReal getMinDistance() const PX_OVERRIDE; + virtual void setMaxDistance(PxReal distance) PX_OVERRIDE; + virtual PxReal getMaxDistance() const PX_OVERRIDE; + virtual void setTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getTolerance() const PX_OVERRIDE; + virtual void setStiffness(PxReal spring) PX_OVERRIDE; + virtual PxReal getStiffness() const PX_OVERRIDE; + virtual void setDamping(PxReal damping) PX_OVERRIDE; + virtual PxReal getDamping() const PX_OVERRIDE; + virtual void setContactDistance(PxReal contactDistance) PX_OVERRIDE; + virtual PxReal getContactDistance() const PX_OVERRIDE; + virtual void setDistanceJointFlags(PxDistanceJointFlags flags) PX_OVERRIDE; + virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) PX_OVERRIDE; + virtual PxDistanceJointFlags getDistanceJointFlags() const PX_OVERRIDE; + //~PxDistanceJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; +#if PX_SUPPORT_OMNI_PVD + virtual void updateOmniPvdProperties() const PX_OVERRIDE; +#endif + //~PxConstraintConnector + }; + +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp new file mode 100644 index 0000000..035edc6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtExtensions.cpp @@ -0,0 +1,255 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIO.h" +#include "common/PxMetaData.h" +#include "common/PxSerializer.h" +#include "extensions/PxExtensionsAPI.h" +#include "extensions/PxRepXSerializer.h" + +#include "ExtDistanceJoint.h" +#include "ExtD6Joint.h" +#include "ExtFixedJoint.h" +#include "ExtPrismaticJoint.h" +#include "ExtRevoluteJoint.h" +#include "ExtSphericalJoint.h" +#include "ExtSerialization.h" +#include "SnRepXCoreSerializer.h" +#include "SnJointRepXSerializer.h" +#include "PxExtensionMetaDataObjects.h" + +#if PX_SUPPORT_PVD +#include "ExtPvd.h" +#include "PxPvdDataStream.h" +#include "PxPvdClient.h" +#include "PsPvd.h" +#endif + +#if PX_SUPPORT_OMNI_PVD +# include "omnipvd/PxOmniPvd.h" +# include "omnipvd/OmniPvdPxExtensionsSampler.h" +#endif + +using namespace physx; +using namespace physx::pvdsdk; + +#if PX_SUPPORT_PVD +struct JointConnectionHandler : public PvdClient +{ + JointConnectionHandler() : mPvd(NULL),mConnected(false){} + + PvdDataStream* getDataStream() + { + return NULL; + } + + void onPvdConnected() + { + PvdDataStream* stream = PvdDataStream::create(mPvd); + if(stream) + { + mConnected = true; + Ext::Pvd::sendClassDescriptions(*stream); + stream->release(); + } + } + + bool isConnected() const + { + return mConnected; + } + + void onPvdDisconnected() + { + mConnected = false; + } + + void flush() + { + } + + PsPvd* mPvd; + bool mConnected; +}; + +static JointConnectionHandler gPvdHandler; +#endif + +bool PxInitExtensions(PxPhysics& physics, PxPvd* pvd) +{ + PX_ASSERT(&physics.getFoundation() == &PxGetFoundation()); + PX_UNUSED(physics); + PX_UNUSED(pvd); + PxIncFoundationRefCount(); + +#if PX_SUPPORT_PVD + if(pvd) + { + gPvdHandler.mPvd = static_cast(pvd); + gPvdHandler.mPvd->addClient(&gPvdHandler); + } +#endif + +#if PX_SUPPORT_OMNI_PVD + if (physics.getOmniPvd() && physics.getOmniPvd()->getWriter()) + { + if (OmniPvdPxExtensionsSampler::createInstance()) + { + OmniPvdPxExtensionsSampler::getInstance()->setOmniPvdWriter(physics.getOmniPvd()->getWriter()); + OmniPvdPxExtensionsSampler::getInstance()->registerClasses(); + } + } +#endif + return true; +} + +static PxArray* gExternalSQ = NULL; + +void addExternalSQ(PxSceneQuerySystem* added) +{ + if(!gExternalSQ) + gExternalSQ = new PxArray; + + gExternalSQ->pushBack(added); +} + +void removeExternalSQ(PxSceneQuerySystem* removed) +{ + if(gExternalSQ) + { + const PxU32 nb = gExternalSQ->size(); + for(PxU32 i=0;ireplaceWithLast(i); + return; + } + } + } +} + +static void releaseExternalSQ() +{ + if(gExternalSQ) + { + PxArray* copy = gExternalSQ; + gExternalSQ = NULL; + + const PxU32 nb = copy->size(); + for(PxU32 i=0;irelease(); + } + PX_DELETE(copy); + } +} + +void PxCloseExtensions(void) +{ + releaseExternalSQ(); + + PxDecFoundationRefCount(); + +#if PX_SUPPORT_PVD + if(gPvdHandler.mConnected) + { + PX_ASSERT(gPvdHandler.mPvd); + gPvdHandler.mPvd->removeClient(&gPvdHandler); + gPvdHandler.mPvd = NULL; + } +#endif + +#if PX_SUPPORT_OMNI_PVD + if (OmniPvdPxExtensionsSampler::getInstance()) + { + OmniPvdPxExtensionsSampler::destroyInstance(); + } +#endif +} + +void Ext::RegisterExtensionsSerializers(PxSerializationRegistry& sr) +{ + //for repx serialization + sr.registerRepXSerializer(PxConcreteType::eMATERIAL, PX_NEW_REPX_SERIALIZER( PxMaterialRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eSHAPE, PX_NEW_REPX_SERIALIZER( PxShapeRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eTRIANGLE_MESH_BVH33, PX_NEW_REPX_SERIALIZER( PxBVH33TriangleMeshRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eTRIANGLE_MESH_BVH34, PX_NEW_REPX_SERIALIZER( PxBVH34TriangleMeshRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eHEIGHTFIELD, PX_NEW_REPX_SERIALIZER( PxHeightFieldRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eCONVEX_MESH, PX_NEW_REPX_SERIALIZER( PxConvexMeshRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eRIGID_STATIC, PX_NEW_REPX_SERIALIZER( PxRigidStaticRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eRIGID_DYNAMIC, PX_NEW_REPX_SERIALIZER( PxRigidDynamicRepXSerializer )); + sr.registerRepXSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE, PX_NEW_REPX_SERIALIZER( PxArticulationReducedCoordinateRepXSerializer)); + sr.registerRepXSerializer(PxConcreteType::eAGGREGATE, PX_NEW_REPX_SERIALIZER( PxAggregateRepXSerializer )); + + sr.registerRepXSerializer(PxJointConcreteType::eFIXED, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + sr.registerRepXSerializer(PxJointConcreteType::eDISTANCE, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + sr.registerRepXSerializer(PxJointConcreteType::eD6, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + sr.registerRepXSerializer(PxJointConcreteType::ePRISMATIC, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + sr.registerRepXSerializer(PxJointConcreteType::eREVOLUTE, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + sr.registerRepXSerializer(PxJointConcreteType::eSPHERICAL, PX_NEW_REPX_SERIALIZER( PxJointRepXSerializer )); + + //for binary serialization + sr.registerSerializer(PxJointConcreteType::eFIXED, PX_NEW_SERIALIZER_ADAPTER( FixedJoint )); + sr.registerSerializer(PxJointConcreteType::eDISTANCE, PX_NEW_SERIALIZER_ADAPTER( DistanceJoint )); + sr.registerSerializer(PxJointConcreteType::eD6, PX_NEW_SERIALIZER_ADAPTER( D6Joint) ); + sr.registerSerializer(PxJointConcreteType::ePRISMATIC, PX_NEW_SERIALIZER_ADAPTER( PrismaticJoint )); + sr.registerSerializer(PxJointConcreteType::eREVOLUTE, PX_NEW_SERIALIZER_ADAPTER( RevoluteJoint )); + sr.registerSerializer(PxJointConcreteType::eSPHERICAL, PX_NEW_SERIALIZER_ADAPTER( SphericalJoint )); +} + +void Ext::UnregisterExtensionsSerializers(PxSerializationRegistry& sr) +{ + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::eFIXED)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::eDISTANCE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::eD6 )); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::ePRISMATIC)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::eREVOLUTE)); + PX_DELETE_SERIALIZER_ADAPTER(sr.unregisterSerializer(PxJointConcreteType::eSPHERICAL)); + + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eMATERIAL)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eSHAPE)); +// PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eTRIANGLE_MESH)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eTRIANGLE_MESH_BVH33)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eTRIANGLE_MESH_BVH34)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eHEIGHTFIELD)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eCONVEX_MESH)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eRIGID_STATIC)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eRIGID_DYNAMIC)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eARTICULATION_REDUCED_COORDINATE)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxConcreteType::eAGGREGATE)); + + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::eFIXED)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::eDISTANCE)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::eD6)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::ePRISMATIC)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::eREVOLUTE)); + PX_DELETE_REPX_SERIALIZER(sr.unregisterRepXSerializer(PxJointConcreteType::eSPHERICAL)); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp new file mode 100644 index 0000000..192376d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.cpp @@ -0,0 +1,162 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtFixedJoint.h" +#include "ExtConstraintHelper.h" + +using namespace physx; +using namespace Ext; + +FixedJoint::FixedJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + FixedJointT(PxJointConcreteType::eFIXED, actor0, localFrame0, actor1, localFrame1, "FixedJointData") +{ + FixedJointData* data = static_cast(mData); + + data->projectionLinearTolerance = 1e10f; + data->projectionAngularTolerance = PxPi; +} + +PxReal FixedJoint::getProjectionLinearTolerance() const +{ + return data().projectionLinearTolerance; +} + +void FixedJoint::setProjectionLinearTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0, "PxFixedJoint::setProjectionLinearTolerance: invalid parameter"); + data().projectionLinearTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, fixedProjectionLinearTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal FixedJoint::getProjectionAngularTolerance() const +{ + return data().projectionAngularTolerance; +} + +void FixedJoint::setProjectionAngularTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0 && tolerance <= PxPi, "PxFixedJoint::setProjectionAngularTolerance: invalid parameter"); + data().projectionAngularTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, fixedProjectionAngularTolerance, static_cast(*this), tolerance) +#endif +} + +static void FixedJointProject(const void* constantBlock, PxTransform& bodyAToWorld, PxTransform& bodyBToWorld, bool projectToA) +{ + const FixedJointData &data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w, cB2cA, projected; + joint::computeDerived(data, bodyAToWorld, bodyBToWorld, cA2w, cB2w, cB2cA); + + bool linearTrunc, angularTrunc; + projected.p = joint::truncateLinear(cB2cA.p, data.projectionLinearTolerance, linearTrunc); + projected.q = joint::truncateAngular(cB2cA.q, PxSin(data.projectionAngularTolerance/2), PxCos(data.projectionAngularTolerance/2), angularTrunc); + + if(linearTrunc || angularTrunc) + joint::projectTransforms(bodyAToWorld, bodyBToWorld, cA2w, cB2w, projected, data, projectToA); +} + +static void FixedJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + { + const FixedJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + viz.visualizeJointFrames(cA2w, cB2w); + } +} + +//TAG:solverprepshader +static PxU32 FixedJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const FixedJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + if (cA2w.q.dot(cB2w.q)<0.0f) // minimum dist quat (equiv to flipping cB2bB.q, which we don't use anywhere) + cB2w.q = -cB2w.q; + + PxVec3 ra, rb; + ch.prepareLockedAxes(cA2w.q, cB2w.q, cA2w.transformInv(cB2w.p), 7, 7, ra, rb); + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + return ch.getCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gFixedJointShaders = { FixedJointSolverPrep, FixedJointProject, FixedJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep FixedJoint::getPrep() const { return gFixedJointShaders.solverPrep; } + +PxFixedJoint* physx::PxFixedJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxFixedJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxFixedJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxFixedJointCreate: at least one actor must be dynamic"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxFixedJointCreate: actors must be different"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gFixedJointShaders); +} + +// PX_SERIALIZATION +void FixedJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gFixedJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +template<> +void physx::Ext::omniPvdInitJoint(FixedJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eFIXED) + OMNI_PVD_SET(joint, fixedProjectionLinearTolerance, j, joint->getProjectionLinearTolerance()) + OMNI_PVD_SET(joint, fixedProjectionAngularTolerance, j, joint->getProjectionAngularTolerance()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.h new file mode 100644 index 0000000..a070fff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtFixedJoint.h @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_FIXED_JOINT_H +#define EXT_FIXED_JOINT_H + +#include "extensions/PxFixedJoint.h" + +#include "ExtJoint.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxFixedJointGeneratedValues; +namespace Ext +{ + struct FixedJointData : public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PxReal projectionLinearTolerance; + PxReal projectionAngularTolerance; + }; + + typedef JointT FixedJointT; + + class FixedJoint : public FixedJointT + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + FixedJoint(PxBaseFlags baseFlags) : FixedJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static FixedJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + FixedJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxFixedJoint + virtual void setProjectionLinearTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionLinearTolerance() const PX_OVERRIDE; + virtual void setProjectionAngularTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionAngularTolerance() const PX_OVERRIDE; + //~PxFixedJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; + //~PxConstraintConnector + }; +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp new file mode 100644 index 0000000..12ea1d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.cpp @@ -0,0 +1,330 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtGearJoint.h" +#include "ExtConstraintHelper.h" +#include "extensions/PxRevoluteJoint.h" +#include "PxArticulationJointReducedCoordinate.h" +//#include + +using namespace physx; +using namespace Ext; + +GearJoint::GearJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + GearJointT(PxJointConcreteType::eGEAR, actor0, localFrame0, actor1, localFrame1, "GearJointData") +{ + GearJointData* data = static_cast(mData); + data->hingeJoint0 = NULL; + data->hingeJoint1 = NULL; + data->gearRatio = 0.0f; + data->error = 0.0f; + + resetError(); +} + +bool GearJoint::setHinges(const PxBase* hinge0, const PxBase* hinge1) +{ + GearJointData* data = static_cast(mData); + + if(!hinge0 || !hinge1) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setHinges: cannot pass null pointers to this function."); + return false; + } + + const PxType type0 = hinge0->getConcreteType(); + if(type0 == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* joint0 = static_cast(hinge0); + const PxArticulationJointType::Enum artiJointType = joint0->getJointType(); + if(artiJointType != PxArticulationJointType::eREVOLUTE && artiJointType != PxArticulationJointType::eREVOLUTE_UNWRAPPED) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setHinges: passed joint must be either a revolute joint."); + return false; + } + } + else + { + if(type0 != PxJointConcreteType::eREVOLUTE && type0 != PxJointConcreteType::eD6) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setHinges: passed joint must be either a revolute joint or a D6 joint."); + return false; + } + } + + const PxType type1 = hinge1->getConcreteType(); + if(type1 == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* joint1 = static_cast(hinge1); + const PxArticulationJointType::Enum artiJointType = joint1->getJointType(); + if(artiJointType != PxArticulationJointType::eREVOLUTE && artiJointType != PxArticulationJointType::eREVOLUTE_UNWRAPPED) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setHinges: passed joint must be either a revolute joint."); + return false; + } + } + else + { + if(type1 != PxJointConcreteType::eREVOLUTE && type1 != PxJointConcreteType::eD6) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setHinges: passed joint must be either a revolute joint or a D6 joint."); + return false; + } + } + + data->hingeJoint0 = hinge0; + data->hingeJoint1 = hinge1; + resetError(); + markDirty(); + +#if PX_SUPPORT_OMNI_PVD + const PxBase* joints[] ={ hinge0, hinge1 }; + PxU32 jointsLength = sizeof(joints); + OMNI_PVD_SETB(joint, gearHinges, static_cast(*this), joints, jointsLength) +#endif + + return true; +} + +void GearJoint::setGearRatio(float ratio) +{ + GearJointData* data = static_cast(mData); + data->gearRatio = ratio; + resetError(); + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, gearRatio, static_cast(*this), ratio) +#endif +} + +float GearJoint::getGearRatio() const +{ + const GearJointData* data = static_cast(mData); + return data->gearRatio; +} + +static float angleDiff(float angle0, float angle1) +{ + const float diff = fmodf(angle1 - angle0 + PxPi, PxTwoPi) - PxPi; + return diff < -PxPi ? diff + PxTwoPi : diff; +} + +static void getAngleAndSign(float& angle, float& sign, const PxBase* dataHingeJoint, PxRigidActor* gearActor0, PxRigidActor* gearActor1) +{ + PxRigidActor* hingeActor0; + PxRigidActor* hingeActor1; + const PxType type = dataHingeJoint->getConcreteType(); + + if(type == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* artiHingeJoint = static_cast(dataHingeJoint); + + hingeActor0 = &artiHingeJoint->getParentArticulationLink(); + hingeActor1 = &artiHingeJoint->getChildArticulationLink(); + + angle = artiHingeJoint->getJointPosition(PxArticulationAxis::eTWIST); + } + else + { + const PxJoint* hingeJoint = static_cast(dataHingeJoint); + + hingeJoint->getActors(hingeActor0, hingeActor1); + + if(type == PxJointConcreteType::eREVOLUTE) + angle = static_cast(hingeJoint)->getAngle(); + else if(type == PxJointConcreteType::eD6) + angle = static_cast(hingeJoint)->getTwistAngle(); + } + + if(gearActor0 == hingeActor0 || gearActor1 == hingeActor0) + sign = -1.0f; + else if(gearActor0 == hingeActor1 || gearActor1 == hingeActor1) + sign = 1.0f; + else + PX_ASSERT(0); +} + +void GearJoint::updateError() +{ + GearJointData* data = static_cast(mData); + + if(!data->hingeJoint0 || !data->hingeJoint1) + return; + + PxRigidActor* gearActor0; + PxRigidActor* gearActor1; + getActors(gearActor0, gearActor1); + + float Angle0 = 0.0f; + float Sign0 = 0.0f; + getAngleAndSign(Angle0, Sign0, data->hingeJoint0, gearActor0, gearActor1); + + float Angle1 = 0.0f; + float Sign1 = 0.0f; + getAngleAndSign(Angle1, Sign1, data->hingeJoint1, gearActor0, gearActor1); + Angle1 = -Angle1; + + if(!mInitDone) + { + mInitDone = true; + mPersistentAngle0 = Angle0; + mPersistentAngle1 = Angle1; + } + + const float travelThisFrame0 = angleDiff(Angle0, mPersistentAngle0); + const float travelThisFrame1 = angleDiff(Angle1, mPersistentAngle1); + mVirtualAngle0 += travelThisFrame0; + mVirtualAngle1 += travelThisFrame1; + +// printf("travelThisFrame0: %f\n", travelThisFrame0); +// printf("travelThisFrame1: %f\n", travelThisFrame1); +// printf("ratio: %f\n", travelThisFrame1/travelThisFrame0); + mPersistentAngle0 = Angle0; + mPersistentAngle1 = Angle1; + + const float error = Sign0*mVirtualAngle0*data->gearRatio - Sign1*mVirtualAngle1; +// printf("error: %f\n", error); + + data->error = error; + markDirty(); +} + +void GearJoint::resetError() +{ + mVirtualAngle0 = mVirtualAngle1 = 0.0f; + mPersistentAngle0 = mPersistentAngle1 = 0.0f; + mInitDone = false; +} + +static void GearJointProject(const void* /*constantBlock*/, PxTransform& /*bodyAToWorld*/, PxTransform& /*bodyBToWorld*/, bool /*projectToA*/) +{ +// const GearJointData& data = *reinterpret_cast(constantBlock); +} + +static const bool gVizJointFrames = true; +static const bool gVizGearAxes = false; + +static void GearJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + { + const GearJointData& data = *reinterpret_cast(constantBlock); + + // Visualize joint frames + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(gVizJointFrames) + viz.visualizeJointFrames(cA2w, cB2w); + + if(gVizGearAxes) + { + const PxVec3 gearAxis0 = cA2w.rotate(PxVec3(1.0f, 0.0f, 0.0f)).getNormalized(); + const PxVec3 gearAxis1 = cB2w.rotate(PxVec3(1.0f, 0.0f, 0.0f)).getNormalized(); + viz.visualizeLine(body0Transform.p+gearAxis0, body0Transform.p, 0xff0000ff); + viz.visualizeLine(body1Transform.p+gearAxis1, body1Transform.p, 0xff0000ff); + } + } +} + +//TAG:solverprepshader +static PxU32 GearJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const GearJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + cA2wOut = cB2w.p; + cB2wOut = cB2w.p; + + const PxVec3 gearAxis0 = cA2w.q.getBasisVector0(); + const PxVec3 gearAxis1 = cB2w.q.getBasisVector0(); + + Px1DConstraint& con = constraints[0]; + con.linear0 = PxVec3(0.0f); + con.linear1 = PxVec3(0.0f); + con.angular0 = gearAxis0*data.gearRatio; + con.angular1 = -gearAxis1; + con.geometricError = -data.error; + con.minImpulse = -PX_MAX_F32; + con.maxImpulse = PX_MAX_F32; + con.velocityTarget = 0.f; + con.forInternalUse = 0.f; + con.solveHint = 0; + con.flags = Px1DConstraintFlag::eOUTPUT_FORCE|Px1DConstraintFlag::eANGULAR_CONSTRAINT; + con.mods.bounce.restitution = 0.0f; + con.mods.bounce.velocityThreshold = 0.0f; + return 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gGearJointShaders = { GearJointSolverPrep, GearJointProject, GearJointVisualize, PxConstraintFlag::eALWAYS_UPDATE }; + +PxConstraintSolverPrep GearJoint::getPrep() const { return gGearJointShaders.solverPrep; } + +PxGearJoint* physx::PxGearJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxGearJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxGearJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxGearJointCreate: at least one actor must be dynamic"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxGearJointCreate: actors must be different"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gGearJointShaders); +} + +// PX_SERIALIZATION +void GearJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gGearJointShaders); + + GearJointData* data = static_cast(mData); + context.translatePxBase(data->hingeJoint0); + context.translatePxBase(data->hingeJoint1); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +template<> +void physx::Ext::omniPvdInitJoint(GearJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eGEAR) + OMNI_PVD_SET(joint, gearRatio, j, joint->getGearRatio()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.h new file mode 100644 index 0000000..1fd51e6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGearJoint.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_GEAR_JOINT_H +#define EXT_GEAR_JOINT_H + +#include "extensions/PxGearJoint.h" +#include "ExtJoint.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxGearJointGeneratedValues; +namespace Ext +{ + struct GearJointData : public JointData + { + const PxBase* hingeJoint0; //either PxJoint or PxArticulationJointReducedCoordinate + const PxBase* hingeJoint1; //either PxJoint or PxArticulationJointReducedCoordinate + float gearRatio; + float error; + }; + + typedef JointT GearJointT; + + class GearJoint : public GearJointT + { + public: +// PX_SERIALIZATION + GearJoint(PxBaseFlags baseFlags) : GearJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static GearJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + GearJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxGearJoint + virtual bool setHinges(const PxBase* hinge0, const PxBase* hinge1) PX_OVERRIDE; + virtual void setGearRatio(float ratio) PX_OVERRIDE; + virtual float getGearRatio() const PX_OVERRIDE; + //~PxGearJoint + + // PxConstraintConnector + virtual void* prepareData() PX_OVERRIDE + { + updateError(); + return mData; + } + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; + //~PxConstraintConnector + private: + float mVirtualAngle0; + float mVirtualAngle1; + float mPersistentAngle0; + float mPersistentAngle1; + bool mInitDone; + + void updateError(); + void resetError(); + }; +} // namespace Ext + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp new file mode 100644 index 0000000..dcabae2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtGjkQueryExt.cpp @@ -0,0 +1,248 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxGjkQueryExt.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "foundation/PxAllocator.h" +#include "geomutils/PxContactBuffer.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////// + +PxGjkQueryExt::SphereSupport::SphereSupport() : radius(0.0f) +{ +} + +PxGjkQueryExt::SphereSupport::SphereSupport(PxReal _radius) : radius(_radius) +{ +} + +PxGjkQueryExt::SphereSupport::SphereSupport(const PxSphereGeometry& geom) : radius(geom.radius) +{ +} + +PxReal PxGjkQueryExt::SphereSupport::getMargin() const +{ + return radius; +} + +PxVec3 PxGjkQueryExt::SphereSupport::supportLocal(const PxVec3& /*dir*/) const +{ + return PxVec3(0.0f); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxGjkQueryExt::CapsuleSupport::CapsuleSupport() : radius(0.0f), halfHeight(0.0f) +{ +} + +PxGjkQueryExt::CapsuleSupport::CapsuleSupport(PxReal _radius, PxReal _halfHeight) : radius(_radius), halfHeight(_halfHeight) +{ +} + +PxGjkQueryExt::CapsuleSupport::CapsuleSupport(const PxCapsuleGeometry& geom) : radius(geom.radius) +{ +} + +PxReal PxGjkQueryExt::CapsuleSupport::getMargin() const +{ + return radius; +} + +PxVec3 PxGjkQueryExt::CapsuleSupport::supportLocal(const PxVec3& dir) const +{ + return PxVec3(PxSign2(dir.x) * halfHeight, 0.0f, 0.0f); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxGjkQueryExt::BoxSupport::BoxSupport() : halfExtents(0.0f), margin(0.0f) +{ +} + +PxGjkQueryExt::BoxSupport::BoxSupport(const PxVec3& _halfExtents, PxReal _margin) : halfExtents(_halfExtents), margin(_margin) +{ +} + +PxGjkQueryExt::BoxSupport::BoxSupport(const PxBoxGeometry& box, PxReal _margin) : halfExtents(box.halfExtents), margin(_margin) +{ +} + +PxReal PxGjkQueryExt::BoxSupport::getMargin() const +{ + return margin; +} + +PxVec3 PxGjkQueryExt::BoxSupport::supportLocal(const PxVec3& dir) const +{ + const PxVec3 d = dir.getNormalized(); + return PxVec3(PxSign2(d.x) * halfExtents.x, PxSign2(d.y) * halfExtents.y, PxSign2(d.z) * halfExtents.z); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxGjkQueryExt::ConvexMeshSupport::ConvexMeshSupport() : + convexMesh (NULL), + scale (0.0f), + scaleRotation (0.0f), + margin (0.0f) +{ +} + +PxGjkQueryExt::ConvexMeshSupport::ConvexMeshSupport(const PxConvexMesh& _convexMesh, const PxVec3& _scale, const PxQuat& _scaleRotation, PxReal _margin) : + convexMesh (&_convexMesh), + scale (_scale), + scaleRotation (_scaleRotation), + margin (_margin) +{ +} + +PxGjkQueryExt::ConvexMeshSupport::ConvexMeshSupport(const PxConvexMeshGeometry& _convexMesh, PxReal _margin) : + convexMesh (_convexMesh.convexMesh), + scale (_convexMesh.scale.scale), + scaleRotation (_convexMesh.scale.rotation), + margin (_margin) +{ +} + +PxReal PxGjkQueryExt::ConvexMeshSupport::getMargin() const +{ + return margin * scale.minElement(); +} + +PxVec3 PxGjkQueryExt::ConvexMeshSupport::supportLocal(const PxVec3& dir) const +{ + if (convexMesh == NULL) + return PxVec3(0.0f); + + PxVec3 d = scaleRotation.rotateInv(scaleRotation.rotate(dir).multiply(PxVec3(1.0f / scale.x, 1.0f / scale.y, 1.0f / scale.z))); + const PxVec3* verts = convexMesh->getVertices(); + int count = int(convexMesh->getNbVertices()); + float maxDot = -FLT_MAX; + int index = -1; + for (int i = 0; i < count; ++i) + { + float dot = verts[i].dot(d); + if (dot > maxDot) + { + maxDot = dot; + index = i; + } + } + + if (index == -1) + return PxVec3(0); + + return scaleRotation.rotateInv(scaleRotation.rotate(verts[index]).multiply(scale)); +} + +/////////////////////////////////////////////////////////////////////////////// + +PxGjkQueryExt::ConvexGeomSupport::ConvexGeomSupport() : mType(PxGeometryType::eINVALID) +{ +} + +PxGjkQueryExt::ConvexGeomSupport::ConvexGeomSupport(const PxGeometry& geom, PxReal margin) +{ + mType = PxGeometryType::eINVALID; + switch (geom.getType()) + { + case PxGeometryType::eSPHERE: + { + mType = PxGeometryType::eSPHERE; + const PxSphereGeometry& sphere = static_cast(geom); + PX_PLACEMENT_NEW(&mSupport, SphereSupport(sphere.radius + margin)); + break; + } + case PxGeometryType::eCAPSULE: + { + mType = PxGeometryType::eCAPSULE; + const PxCapsuleGeometry& capsule = static_cast(geom); + PX_PLACEMENT_NEW(&mSupport, CapsuleSupport(capsule.radius + margin, capsule.halfHeight)); + break; + } + case PxGeometryType::eBOX: + { + mType = PxGeometryType::eBOX; + PX_PLACEMENT_NEW(&mSupport, BoxSupport(static_cast(geom), margin)); + break; + } + case PxGeometryType::eCONVEXMESH: + { + mType = PxGeometryType::eCONVEXMESH; + PX_PLACEMENT_NEW(&mSupport, ConvexMeshSupport(static_cast(geom), margin)); + break; + } + default: + break; + } +} + +PxGjkQueryExt::ConvexGeomSupport::~ConvexGeomSupport() +{ + if (isValid()) + reinterpret_cast(mSupport).~Support(); +} + +bool PxGjkQueryExt::ConvexGeomSupport::isValid() const +{ + return mType != PxGeometryType::eINVALID; +} + +PxReal PxGjkQueryExt::ConvexGeomSupport::getMargin() const +{ + return isValid() ? reinterpret_cast(mSupport).getMargin() : 0.0f; +} + +PxVec3 PxGjkQueryExt::ConvexGeomSupport::supportLocal(const PxVec3& dir) const +{ + return isValid() ? reinterpret_cast(mSupport).supportLocal(dir) : PxVec3(0.0f); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool PxGjkQueryExt::generateContacts(const PxGjkQuery::Support& a, const PxGjkQuery::Support& b, const PxTransform& poseA, const PxTransform& poseB, PxReal contactDistance, PxReal toleranceLength, PxContactBuffer& contactBuffer) +{ + PxVec3 pointA, pointB, separatingAxis; PxReal separation; + if (!PxGjkQuery::proximityInfo(a, b, poseA, poseB, contactDistance, toleranceLength, pointA, pointB, separatingAxis, separation)) + return false; + + PxContactPoint contact; + contact.point = (pointA + pointB) * 0.5f; // VR: should I make it just pointB? + contact.normal = separatingAxis; + contact.separation = separation; + contactBuffer.contact(contact); + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtInertiaTensor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtInertiaTensor.h new file mode 100644 index 0000000..cee3a76 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtInertiaTensor.h @@ -0,0 +1,376 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_INERTIA_TENSOR_H +#define EXT_INERTIA_TENSOR_H + +#include "foundation/PxMat33.h" +#include "foundation/PxMathUtils.h" + +namespace physx +{ +namespace Ext +{ + class InertiaTensorComputer + { + public: + InertiaTensorComputer(bool initTozero = true); + InertiaTensorComputer(const PxMat33& inertia, const PxVec3& com, PxReal mass); + ~InertiaTensorComputer(); + + PX_INLINE void zero(); //sets to zero mass + PX_INLINE void setDiagonal(PxReal mass, const PxVec3& diagonal); //sets as a diagonal tensor + PX_INLINE void rotate(const PxMat33& rot); //rotates the mass + void translate(const PxVec3& t); //translates the mass + PX_INLINE void transform(const PxTransform& transform); //transforms the mass + PX_INLINE void scaleDensity(PxReal densityScale); //scales by a density factor + PX_INLINE void add(const InertiaTensorComputer& it); //adds a mass + PX_INLINE void center(); //recenters inertia around center of mass + + void setBox(const PxVec3& halfWidths); //sets as an axis aligned box + PX_INLINE void setBox(const PxVec3& halfWidths, const PxTransform* pose); //sets as an oriented box + + void setSphere(PxReal radius); + PX_INLINE void setSphere(PxReal radius, const PxTransform* pose); + + void setCylinder(int dir, PxReal r, PxReal l); + PX_INLINE void setCylinder(int dir, PxReal r, PxReal l, const PxTransform* pose); + + void setCapsule(int dir, PxReal r, PxReal l); + PX_INLINE void setCapsule(int dir, PxReal r, PxReal l, const PxTransform* pose); + + void setEllipsoid(PxReal rx, PxReal ry, PxReal rz); + PX_INLINE void setEllipsoid(PxReal rx, PxReal ry, PxReal rz, const PxTransform* pose); + + PX_INLINE PxVec3 getCenterOfMass() const { return mG; } + PX_INLINE PxReal getMass() const { return mMass; } + PX_INLINE PxMat33 getInertia() const { return mI; } + + private: + PxMat33 mI; + PxVec3 mG; + PxReal mMass; + }; + + //-------------------------------------------------------------- + // + // Helper routines + // + //-------------------------------------------------------------- + + // Special version allowing 2D quads + PX_INLINE PxReal volume(const PxVec3& extents) + { + PxReal v = 1.0f; + if(extents.x != 0.0f) v*=extents.x; + if(extents.y != 0.0f) v*=extents.y; + if(extents.z != 0.0f) v*=extents.z; + return v; + } + + // Sphere + PX_INLINE PxReal computeSphereRatio(PxReal radius) { return (4.0f/3.0f) * PxPi * radius * radius * radius; } + PxReal computeSphereMass(PxReal radius, PxReal density) { return density * computeSphereRatio(radius); } + PxReal computeSphereDensity(PxReal radius, PxReal mass) { return mass / computeSphereRatio(radius); } + + // Box + PX_INLINE PxReal computeBoxRatio(const PxVec3& extents) { return volume(extents); } + PxReal computeBoxMass(const PxVec3& extents, PxReal density) { return density * computeBoxRatio(extents); } + PxReal computeBoxDensity(const PxVec3& extents, PxReal mass) { return mass / computeBoxRatio(extents); } + + // Ellipsoid + PX_INLINE PxReal computeEllipsoidRatio(const PxVec3& extents) { return (4.0f/3.0f) * PxPi * volume(extents); } + PxReal computeEllipsoidMass(const PxVec3& extents, PxReal density) { return density * computeEllipsoidRatio(extents); } + PxReal computeEllipsoidDensity(const PxVec3& extents, PxReal mass) { return mass / computeEllipsoidRatio(extents); } + + // Cylinder + PX_INLINE PxReal computeCylinderRatio(PxReal r, PxReal l) { return PxPi * r * r * (2.0f*l); } + PxReal computeCylinderMass(PxReal r, PxReal l, PxReal density) { return density * computeCylinderRatio(r, l); } + PxReal computeCylinderDensity(PxReal r, PxReal l, PxReal mass) { return mass / computeCylinderRatio(r, l); } + + // Capsule + PX_INLINE PxReal computeCapsuleRatio(PxReal r, PxReal l) { return computeSphereRatio(r) + computeCylinderRatio(r, l);} + PxReal computeCapsuleMass(PxReal r, PxReal l, PxReal density) { return density * computeCapsuleRatio(r, l); } + PxReal computeCapsuleDensity(PxReal r, PxReal l, PxReal mass) { return mass / computeCapsuleRatio(r, l); } + + // Cone + PX_INLINE PxReal computeConeRatio(PxReal r, PxReal l) { return PxPi * r * r * PxAbs(l)/3.0f; } + PxReal computeConeMass(PxReal r, PxReal l, PxReal density) { return density * computeConeRatio(r, l); } + PxReal computeConeDensity(PxReal r, PxReal l, PxReal mass) { return mass / computeConeRatio(r, l); } + + void computeBoxInertiaTensor(PxVec3& inertia, PxReal mass, PxReal xlength, PxReal ylength, PxReal zlength); + void computeSphereInertiaTensor(PxVec3& inertia, PxReal mass, PxReal radius, bool hollow); + bool jacobiTransform(PxI32 n, PxF64 a[], PxF64 w[]); + bool diagonalizeInertiaTensor(const PxMat33& denseInertia, PxVec3& diagonalInertia, PxMat33& rotation); + +} // namespace Ext + +void Ext::computeBoxInertiaTensor(PxVec3& inertia, PxReal mass, PxReal xlength, PxReal ylength, PxReal zlength) +{ + //to model a hollow block, one would have to multiply coeff by up to two. + const PxReal coeff = mass/12; + inertia.x = coeff * (ylength*ylength + zlength*zlength); + inertia.y = coeff * (xlength*xlength + zlength*zlength); + inertia.z = coeff * (xlength*xlength + ylength*ylength); + + PX_ASSERT(inertia.x != 0.0f); + PX_ASSERT(inertia.y != 0.0f); + PX_ASSERT(inertia.z != 0.0f); + PX_ASSERT(inertia.isFinite()); +} + +void Ext::computeSphereInertiaTensor(PxVec3& inertia, PxReal mass, PxReal radius, bool hollow) +{ + inertia.x = mass * radius * radius; + if (hollow) + inertia.x *= PxReal(2 / 3.0); + else + inertia.x *= PxReal(2 / 5.0); + + inertia.z = inertia.y = inertia.x; + PX_ASSERT(inertia.isFinite()); +} + +//-------------------------------------------------------------- +// +// InertiaTensorComputer implementation +// +//-------------------------------------------------------------- + +Ext::InertiaTensorComputer::InertiaTensorComputer(bool initTozero) +{ + if (initTozero) + zero(); +} + +Ext::InertiaTensorComputer::InertiaTensorComputer(const PxMat33& inertia, const PxVec3& com, PxReal mass) : + mI(inertia), + mG(com), + mMass(mass) +{ +} + + +Ext::InertiaTensorComputer::~InertiaTensorComputer() +{ +} + +PX_INLINE void Ext::InertiaTensorComputer::zero() +{ + mMass = 0.0f; + mI = PxMat33(PxZero); + mG = PxVec3(0); +} + +PX_INLINE void Ext::InertiaTensorComputer::setDiagonal(PxReal mass, const PxVec3& diag) +{ + mMass = mass; + mI = PxMat33::createDiagonal(diag); + mG = PxVec3(0); + PX_ASSERT(mI.column0.isFinite() && mI.column1.isFinite() && mI.column2.isFinite()); + PX_ASSERT(PxIsFinite(mMass)); +} + +void Ext::InertiaTensorComputer::setBox(const PxVec3& halfWidths) +{ + // Setup inertia tensor for a cube with unit density + const PxReal mass = 8.0f * computeBoxRatio(halfWidths); + const PxReal s =(1.0f/3.0f) * mass; + + const PxReal x = halfWidths.x*halfWidths.x; + const PxReal y = halfWidths.y*halfWidths.y; + const PxReal z = halfWidths.z*halfWidths.z; + + setDiagonal(mass, PxVec3(y+z, z+x, x+y) * s); +} + +PX_INLINE void Ext::InertiaTensorComputer::rotate(const PxMat33& rot) +{ + //well known inertia tensor rotation expression is: RIR' -- this could be optimized due to symmetry, see code to do that in Body::updateGlobalInverseInertia + mI = rot * mI * rot.getTranspose(); + PX_ASSERT(mI.column0.isFinite() && mI.column1.isFinite() && mI.column2.isFinite()); + //com also needs to be rotated + mG = rot * mG; + PX_ASSERT(mG.isFinite()); +} + +void Ext::InertiaTensorComputer::translate(const PxVec3& t) +{ + if (!t.isZero()) //its common for this to be zero + { + PxMat33 t1, t2; + + t1.column0 = PxVec3(0, mG.z, -mG.y); + t1.column1 = PxVec3(-mG.z, 0, mG.x); + t1.column2 = PxVec3(mG.y, -mG.x, 0); + + PxVec3 sum = mG + t; + if (sum.isZero()) + { + mI += (t1 * t1)*mMass; + } + else + { + t2.column0 = PxVec3(0, sum.z, -sum.y); + t2.column1 = PxVec3(-sum.z, 0, sum.x); + t2.column2 = PxVec3(sum.y, -sum.x, 0); + mI += (t1 * t1 - t2 * t2)*mMass; + } + + //move center of mass + mG += t; + + PX_ASSERT(mI.column0.isFinite() && mI.column1.isFinite() && mI.column2.isFinite()); + PX_ASSERT(mG.isFinite()); + } +} + +PX_INLINE void Ext::InertiaTensorComputer::transform(const PxTransform& transform) +{ + rotate(PxMat33(transform.q)); + translate(transform.p); +} + +PX_INLINE void Ext::InertiaTensorComputer::setBox(const PxVec3& halfWidths, const PxTransform* pose) +{ + setBox(halfWidths); + if (pose) + transform(*pose); +} + +PX_INLINE void Ext::InertiaTensorComputer::scaleDensity(PxReal densityScale) +{ + mI *= densityScale; + mMass *= densityScale; + PX_ASSERT(mI.column0.isFinite() && mI.column1.isFinite() && mI.column2.isFinite()); + PX_ASSERT(PxIsFinite(mMass)); +} + +PX_INLINE void Ext::InertiaTensorComputer::add(const InertiaTensorComputer& it) +{ + const PxReal TotalMass = mMass + it.mMass; + mG = (mG * mMass + it.mG * it.mMass) / TotalMass; + + mMass = TotalMass; + mI += it.mI; + PX_ASSERT(mI.column0.isFinite() && mI.column1.isFinite() && mI.column2.isFinite()); + PX_ASSERT(mG.isFinite()); + PX_ASSERT(PxIsFinite(mMass)); +} + +PX_INLINE void Ext::InertiaTensorComputer::center() +{ + PxVec3 center = -mG; + translate(center); +} + +void Ext::InertiaTensorComputer::setSphere(PxReal radius) +{ + // Compute mass of the sphere + const PxReal m = computeSphereRatio(radius); + // Compute moment of inertia + const PxReal s = m * radius * radius * (2.0f/5.0f); + setDiagonal(m,PxVec3(s,s,s)); +} + +PX_INLINE void Ext::InertiaTensorComputer::setSphere(PxReal radius, const PxTransform* pose) +{ + setSphere(radius); + if (pose) + transform(*pose); +} + +void Ext::InertiaTensorComputer::setCylinder(int dir, PxReal r, PxReal l) +{ + // Compute mass of cylinder + const PxReal m = computeCylinderRatio(r, l); + + const PxReal i1 = r*r*m/2.0f; + const PxReal i2 = (3.0f*r*r+4.0f*l*l)*m/12.0f; + + switch(dir) + { + case 0: setDiagonal(m,PxVec3(i1,i2,i2)); break; + case 1: setDiagonal(m,PxVec3(i2,i1,i2)); break; + default: setDiagonal(m,PxVec3(i2,i2,i1)); break; + } +} + +PX_INLINE void Ext::InertiaTensorComputer::setCylinder(int dir, PxReal r, PxReal l, const PxTransform* pose) +{ + setCylinder(dir, r, l); + if (pose) + transform(*pose); +} + +void Ext::InertiaTensorComputer::setCapsule(int dir, PxReal r, PxReal l) +{ + // Compute mass of capsule + const PxReal m = computeCapsuleRatio(r, l); + + const PxReal t = PxPi * r * r; + const PxReal i1 = t * ((r*r*r * 8.0f/15.0f) + (l*r*r)); + const PxReal i2 = t * ((r*r*r * 8.0f/15.0f) + (l*r*r * 3.0f/2.0f) + (l*l*r * 4.0f/3.0f) + (l*l*l * 2.0f/3.0f)); + + switch(dir) + { + case 0: setDiagonal(m,PxVec3(i1,i2,i2)); break; + case 1: setDiagonal(m,PxVec3(i2,i1,i2)); break; + default: setDiagonal(m,PxVec3(i2,i2,i1)); break; + } +} + +PX_INLINE void Ext::InertiaTensorComputer::setCapsule(int dir, PxReal r, PxReal l, const PxTransform* pose) +{ + setCapsule(dir, r, l); + if (pose) + transform(*pose); +} + +void Ext::InertiaTensorComputer::setEllipsoid(PxReal rx, PxReal ry, PxReal rz) +{ + // Compute mass of ellipsoid + const PxReal m = computeEllipsoidRatio(PxVec3(rx, ry, rz)); + + // Compute moment of inertia + const PxReal s = m * (2.0f/5.0f); + + // Setup inertia tensor for an ellipsoid centered at the origin + setDiagonal(m,PxVec3(ry*rz,rz*rx,rx*ry)*s); +} + +PX_INLINE void Ext::InertiaTensorComputer::setEllipsoid(PxReal rx, PxReal ry, PxReal rz, const PxTransform* pose) +{ + setEllipsoid(rx,ry,rz); + if (pose) + transform(*pose); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp new file mode 100644 index 0000000..1d2daa3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.cpp @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtJoint.h" + +using namespace physx; +using namespace Ext; + +// PX_SERIALIZATION +PxConstraint* physx::resolveConstraintPtr(PxDeserializationContext& v, PxConstraint* old, PxConstraintConnector* connector, PxConstraintShaderTable &shaders) +{ + v.translatePxBase(old); + PxConstraint* new_nx = static_cast(old); + new_nx->setConstraintFunctions(*connector, shaders); + return new_nx; +} +//~PX_SERIALIZATION + +static void normalToTangents(const PxVec3& n, PxVec3& t1, PxVec3& t2) +{ + const PxReal m_sqrt1_2 = PxReal(0.7071067811865475244008443621048490); + if(fabsf(n.z) > m_sqrt1_2) + { + const PxReal a = n.y*n.y + n.z*n.z; + const PxReal k = PxReal(1.0)/PxSqrt(a); + t1 = PxVec3(0,-n.z*k,n.y*k); + t2 = PxVec3(a*k,-n.x*t1.z,n.x*t1.y); + } + else + { + const PxReal a = n.x*n.x + n.y*n.y; + const PxReal k = PxReal(1.0)/PxSqrt(a); + t1 = PxVec3(-n.y*k,n.x*k,0); + t2 = PxVec3(-n.z*t1.y,n.z*t1.x,a*k); + } + t1.normalize(); + t2.normalize(); +} + +void PxSetJointGlobalFrame(PxJoint& joint, const PxVec3* wsAnchor, const PxVec3* axisIn) +{ + PxRigidActor* actors[2]; + joint.getActors(actors[0], actors[1]); + + PxTransform localPose[2]; + for(PxU32 i=0; i<2; i++) + localPose[i] = PxTransform(PxIdentity); + + // 1) global anchor + if(wsAnchor) + { + //transform anchorPoint to local space + for(PxU32 i=0; i<2; i++) + localPose[i].p = actors[i] ? actors[i]->getGlobalPose().transformInv(*wsAnchor) : *wsAnchor; + } + + // 2) global axis + if(axisIn) + { + PxVec3 localAxis[2], localNormal[2]; + + //find 2 orthogonal vectors. + //gotta do this in world space, if we choose them + //separately in local space they won't match up in worldspace. + PxVec3 axisw = *axisIn; + axisw.normalize(); + + PxVec3 normalw, binormalw; + ::normalToTangents(axisw, binormalw, normalw); + //because axis is supposed to be the Z axis of a frame with the other two being X and Y, we need to negate + //Y to make the frame right handed. Note that the above call makes a right handed frame if we pass X --> Y,Z, so + //it need not be changed. + + for(PxU32 i=0; i<2; i++) + { + if(actors[i]) + { + const PxTransform& m = actors[i]->getGlobalPose(); + PxMat33 mM(m.q); + localAxis[i] = mM.transformTranspose(axisw); + localNormal[i] = mM.transformTranspose(normalw); + } + else + { + localAxis[i] = axisw; + localNormal[i] = normalw; + } + + PxMat33 rot(localAxis[i], localNormal[i], localAxis[i].cross(localNormal[i])); + + localPose[i].q = PxQuat(rot); + localPose[i].q.normalize(); + } + } + + for(PxU32 i=0; i<2; i++) + joint.setLocalPose(static_cast( i ), localPose[i]); +} + +#if PX_SUPPORT_OMNI_PVD + +void physx::Ext::omniPvdCreateJoint(PxJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_CREATE(joint, j) + PxRigidActor* actors[2]; j.getActors(actors[0], actors[1]); + OMNI_PVD_SET(joint, actor0, j, actors[0]) + OMNI_PVD_SET(joint, actor1, j, actors[1]) + PxTransform actor0LocalPose = j.getLocalPose(PxJointActorIndex::eACTOR0); + OMNI_PVD_SET(joint, actor0LocalPose, j, actor0LocalPose) + PxTransform actor1LocalPose = j.getLocalPose(PxJointActorIndex::eACTOR1); + OMNI_PVD_SET(joint, actor1LocalPose, j, actor1LocalPose) + PxReal breakForce, breakTorque; j.getBreakForce(breakForce, breakTorque); + OMNI_PVD_SET(joint, breakForce, j, breakForce) + OMNI_PVD_SET(joint, breakTorque, j, breakTorque) + OMNI_PVD_SET(joint, constraintFlags, j, j.getConstraintFlags()) + OMNI_PVD_SET(joint, invMassScale0, j, j.getInvMassScale0()) + OMNI_PVD_SET(joint, invInertiaScale0, j, j.getInvInertiaScale0()) + OMNI_PVD_SET(joint, invMassScale1, j, j.getInvMassScale1()) + OMNI_PVD_SET(joint, invInertiaScale1, j, j.getInvInertiaScale1()) + const char* name = j.getName() ? j.getName() : ""; + PxU32 nameLen = PxU32(strlen(name)) + 1; + OMNI_PVD_SETB(joint, name, j, name, nameLen) + const char* typeName = j.getConcreteTypeName(); + PxU32 typeNameLen = PxU32(strlen(typeName)) + 1; + OMNI_PVD_SETB(joint, concreteTypeName, j, typeName, typeNameLen) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.h new file mode 100644 index 0000000..8130f43 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJoint.h @@ -0,0 +1,726 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_JOINT_H +#define EXT_JOINT_H + +#include "PxPhysics.h" +#include "extensions/PxConstraintExt.h" +#include "PxRigidStatic.h" +#include "PxRigidDynamic.h" +#include "PxArticulationLink.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxScene.h" + +#include "foundation/PxAllocator.h" +#include "foundation/PxMathUtils.h" +#include "CmUtils.h" +#include "ExtJointData.h" + +#if PX_SUPPORT_PVD + #include "pvd/PxPvdSceneClient.h" + #include "ExtPvd.h" + #include "PxPvdClient.h" +#endif + +#if PX_SUPPORT_OMNI_PVD +# include "omnipvd/OmniPvdPxExtensionsSampler.h" +#endif + +namespace physx +{ +// PX_SERIALIZATION + class PxDeserializationContext; + +PxConstraint* resolveConstraintPtr(PxDeserializationContext& v, PxConstraint* old, PxConstraintConnector* connector, PxConstraintShaderTable& shaders); + +// ~PX_SERIALIZATION + +namespace Ext +{ + PX_FORCE_INLINE float computeSwingAngle(float swingYZ, float swingW) + { + return 4.0f * PxAtan2(swingYZ, 1.0f + swingW); // tan (t/2) = sin(t)/(1+cos t), so this is the quarter angle + } + + template + PX_FORCE_INLINE JointType* createJointT(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1, const PxConstraintShaderTable& shaders) + { + JointType* j; + PX_NEW_SERIALIZED(j, JointType)(physics.getTolerancesScale(), actor0, localFrame0, actor1, localFrame1); + + if(!physics.createConstraint(actor0, actor1, *j, shaders, sizeof(DataType))) + PX_DELETE(j); + +#if PX_SUPPORT_OMNI_PVD + if (j) + { + omniPvdCreateJoint(j); + omniPvdInitJoint(j); + } +#endif + + return j; + } + +// PX_SERIALIZATION + template + PX_FORCE_INLINE JointType* createJointObject(PxU8*& address, PxDeserializationContext& context) + { + JointType* obj = PX_PLACEMENT_NEW(address, JointType(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(JointType); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; + } +//~PX_SERIALIZATION + + template + class JointT : public Base, public PxConstraintConnector, public PxUserAllocated + { + public: +// PX_SERIALIZATION + JointT(PxBaseFlags baseFlags) : Base(baseFlags) {} + + void exportExtraData(PxSerializationContext& stream) + { + if(mData) + { + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(mData, sizeof(DataClass)); + } + stream.writeName(mName); + } + + void importExtraData(PxDeserializationContext& context) + { + if(mData) + mData = context.readExtraData(); + context.readName(mName); + } + + virtual void preExportDataReset(){} + virtual void requiresObjects(PxProcessPxBaseCallback& c) + { + c.process(*mPxConstraint); + + { + PxRigidActor* a0 = NULL; + PxRigidActor* a1 = NULL; + mPxConstraint->getActors(a0,a1); + + if (a0) + { + c.process(*a0); + } + if (a1) + { + c.process(*a1); + } + } + } +//~PX_SERIALIZATION + +#if PX_SUPPORT_PVD + // PxConstraintConnector + virtual bool updatePvdProperties(physx::pvdsdk::PvdDataStream& pvdConnection, const PxConstraint* c, PxPvdUpdateType::Enum updateType) const PX_OVERRIDE + { + if(updateType == PxPvdUpdateType::UPDATE_SIM_PROPERTIES) + { + Ext::Pvd::simUpdate(pvdConnection, *this); + return true; + } + else if(updateType == PxPvdUpdateType::UPDATE_ALL_PROPERTIES) + { + Ext::Pvd::updatePvdProperties(pvdConnection, *this); + return true; + } + else if(updateType == PxPvdUpdateType::CREATE_INSTANCE) + { + Ext::Pvd::createPvdInstance(pvdConnection, *c, *this); + return true; + } + else if(updateType == PxPvdUpdateType::RELEASE_INSTANCE) + { + Ext::Pvd::releasePvdInstance(pvdConnection, *c, *this); + return true; + } + return false; + } +#else + virtual bool updatePvdProperties(physx::pvdsdk::PvdDataStream&, const PxConstraint*, PxPvdUpdateType::Enum) const PX_OVERRIDE + { + return false; + } +#endif + + // PxConstraintConnector + virtual void updateOmniPvdProperties() const PX_OVERRIDE + { + } + + // PxJoint + virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) PX_OVERRIDE + { + //TODO SDK-DEV + //You can get the debugger stream from the NpScene + //Ext::Pvd::setActors( stream, this, mPxConstraint, actor0, actor1 ); + PX_CHECK_AND_RETURN(actor0 != actor1, "PxJoint::setActors: actors must be different"); + PX_CHECK_AND_RETURN((actor0 && !actor0->is()) || (actor1 && !actor1->is()), "PxJoint::setActors: at least one actor must be non-static"); + +#if PX_SUPPORT_PVD + PxScene* scene = getScene(); + if(scene) + { + //if pvd not connect data stream is NULL + physx::pvdsdk::PvdDataStream* conn = scene->getScenePvdClient()->getClientInternal()->getDataStream(); + if( conn != NULL ) + Ext::Pvd::setActors( + *conn, + *this, + *mPxConstraint, + actor0, + actor1 + ); + } +#endif + mPxConstraint->setActors(actor0, actor1); + mData->c2b[0] = getCom(actor0).transformInv(mLocalPose[0]); + mData->c2b[1] = getCom(actor1).transformInv(mLocalPose[1]); + mPxConstraint->markDirty(); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, actor0, static_cast(*this), actor0) + OMNI_PVD_SET(joint, actor1, static_cast(*this), actor1) +#endif + } + + // PxJoint + virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const PX_OVERRIDE + { + if(mPxConstraint) + mPxConstraint->getActors(actor0,actor1); + else + { + actor0 = NULL; + actor1 = NULL; + } + } + + // this is the local pose relative to the actor, and we store internally the local + // pose relative to the body + + // PxJoint + virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& pose) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(pose.isSane(), "PxJoint::setLocalPose: transform is invalid"); + const PxTransform p = pose.getNormalized(); + mLocalPose[actor] = p; + mData->c2b[actor] = getCom(actor).transformInv(p); + mPxConstraint->markDirty(); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, actor0LocalPose, static_cast(*this), mLocalPose[0]) + OMNI_PVD_SET(joint, actor1LocalPose, static_cast(*this), mLocalPose[1]) +#endif + } + + // PxJoint + virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const PX_OVERRIDE + { + return mLocalPose[actor]; + } + + static PxTransform getGlobalPose(const PxRigidActor* actor) + { + if(!actor) + return PxTransform(PxIdentity); + return actor->getGlobalPose(); + } + + static void getActorVelocity(const PxRigidActor* actor, PxVec3& linear, PxVec3& angular) + { + if(!actor || actor->is()) + { + linear = angular = PxVec3(0.0f); + return; + } + + linear = static_cast(actor)->getLinearVelocity(); + angular = static_cast(actor)->getAngularVelocity(); + } + + // PxJoint + virtual PxTransform getRelativeTransform() const PX_OVERRIDE + { + PxRigidActor* actor0, * actor1; + mPxConstraint->getActors(actor0, actor1); + const PxTransform t0 = getGlobalPose(actor0) * mLocalPose[0]; + const PxTransform t1 = getGlobalPose(actor1) * mLocalPose[1]; + return t0.transformInv(t1); + } + + // PxJoint + virtual PxVec3 getRelativeLinearVelocity() const PX_OVERRIDE + { + PxRigidActor* actor0, * actor1; + PxVec3 l0, a0, l1, a1; + mPxConstraint->getActors(actor0, actor1); + + PxTransform t0 = getCom(actor0), t1 = getCom(actor1); + getActorVelocity(actor0, l0, a0); + getActorVelocity(actor1, l1, a1); + + PxVec3 p0 = t0.q.rotate(mLocalPose[0].p), + p1 = t1.q.rotate(mLocalPose[1].p); + return t0.transformInv(l1 - a1.cross(p1) - l0 + a0.cross(p0)); + } + + // PxJoint + virtual PxVec3 getRelativeAngularVelocity() const PX_OVERRIDE + { + PxRigidActor* actor0, * actor1; + PxVec3 l0, a0, l1, a1; + mPxConstraint->getActors(actor0, actor1); + + PxTransform t0 = getCom(actor0); + getActorVelocity(actor0, l0, a0); + getActorVelocity(actor1, l1, a1); + + return t0.transformInv(a1 - a0); + } + + // PxJoint + virtual void setBreakForce(PxReal force, PxReal torque) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(PxIsFinite(force) && PxIsFinite(torque), "PxJoint::setBreakForce: invalid float"); + mPxConstraint->setBreakForce(force,torque); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, breakForce, static_cast(*this), force) + OMNI_PVD_SET(joint, breakTorque, static_cast(*this), torque) +#endif + } + + // PxJoint + virtual void getBreakForce(PxReal& force, PxReal& torque) const PX_OVERRIDE + { + mPxConstraint->getBreakForce(force,torque); + } + + // PxJoint + virtual void setConstraintFlags(PxConstraintFlags flags) PX_OVERRIDE + { + mPxConstraint->setFlags(flags); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, constraintFlags, static_cast(*this), flags) +#endif + } + + // PxJoint + virtual void setConstraintFlag(PxConstraintFlag::Enum flag, bool value) PX_OVERRIDE + { + mPxConstraint->setFlag(flag, value); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, constraintFlags, static_cast(*this), getConstraintFlags()) +#endif + } + + // PxJoint + virtual PxConstraintFlags getConstraintFlags() const PX_OVERRIDE + { + return mPxConstraint->getFlags(); + } + + // PxJoint + virtual void setInvMassScale0(PxReal invMassScale) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(PxIsFinite(invMassScale) && invMassScale>=0, "PxJoint::setInvMassScale0: scale must be non-negative"); + mData->invMassScale.linear0 = invMassScale; + mPxConstraint->markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, invMassScale0, static_cast(*this), invMassScale) +#endif + } + + // PxJoint + virtual PxReal getInvMassScale0() const PX_OVERRIDE + { + return mData->invMassScale.linear0; + } + + // PxJoint + virtual void setInvInertiaScale0(PxReal invInertiaScale) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(PxIsFinite(invInertiaScale) && invInertiaScale>=0, "PxJoint::setInvInertiaScale0: scale must be non-negative"); + mData->invMassScale.angular0 = invInertiaScale; + mPxConstraint->markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, invInertiaScale0, static_cast(*this), invInertiaScale) +#endif + } + + // PxJoint + virtual PxReal getInvInertiaScale0() const PX_OVERRIDE + { + return mData->invMassScale.angular0; + } + + // PxJoint + virtual void setInvMassScale1(PxReal invMassScale) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(PxIsFinite(invMassScale) && invMassScale>=0, "PxJoint::setInvMassScale1: scale must be non-negative"); + mData->invMassScale.linear1 = invMassScale; + mPxConstraint->markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, invMassScale1, static_cast(*this), invMassScale) +#endif + } + + // PxJoint + virtual PxReal getInvMassScale1() const PX_OVERRIDE + { + return mData->invMassScale.linear1; + } + + // PxJoint + virtual void setInvInertiaScale1(PxReal invInertiaScale) PX_OVERRIDE + { + PX_CHECK_AND_RETURN(PxIsFinite(invInertiaScale) && invInertiaScale>=0, "PxJoint::setInvInertiaScale: scale must be non-negative"); + mData->invMassScale.angular1 = invInertiaScale; + mPxConstraint->markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, invInertiaScale1, static_cast(*this), invInertiaScale) +#endif + } + + // PxJoint + virtual PxReal getInvInertiaScale1() const PX_OVERRIDE + { + return mData->invMassScale.angular1; + } + + // PxJoint + virtual PxConstraint* getConstraint() const PX_OVERRIDE + { + return mPxConstraint; + } + + // PxJoint + virtual void setName(const char* name) PX_OVERRIDE + { + mName = name; +#if PX_SUPPORT_OMNI_PVD + const char* n = name ? name : ""; + PxU32 nLen = PxU32(strlen(n)) + 1; + OMNI_PVD_SETB(joint, name, static_cast(*this), n, nLen) +#endif + } + + // PxJoint + virtual const char* getName() const PX_OVERRIDE + { + return mName; + } + + // PxJoint + virtual void release() PX_OVERRIDE + { + mPxConstraint->release(); + } + + // PxJoint + virtual PxScene* getScene() const PX_OVERRIDE + { + return mPxConstraint ? mPxConstraint->getScene() : NULL; + } + + // PxConstraintConnector + virtual void onComShift(PxU32 actor) PX_OVERRIDE + { + mData->c2b[actor] = getCom(actor).transformInv(mLocalPose[actor]); + markDirty(); + } + + // PxConstraintConnector + virtual void onOriginShift(const PxVec3& shift) PX_OVERRIDE + { + PxRigidActor* a[2]; + mPxConstraint->getActors(a[0], a[1]); + + if (!a[0]) + { + mLocalPose[0].p -= shift; + mData->c2b[0].p -= shift; + markDirty(); + } + else if (!a[1]) + { + mLocalPose[1].p -= shift; + mData->c2b[1].p -= shift; + markDirty(); + } + } + + // PxConstraintConnector + virtual void* prepareData() PX_OVERRIDE + { + return mData; + } + + // PxConstraintConnector + virtual void* getExternalReference(PxU32& typeID) PX_OVERRIDE + { + typeID = PxConstraintExtIDs::eJOINT; + return static_cast( this ); + } + + // PxConstraintConnector + virtual PxBase* getSerializable() PX_OVERRIDE + { + return this; + } + + // PxConstraintConnector + virtual void onConstraintRelease() PX_OVERRIDE + { + PX_FREE(mData); + PX_DELETE_THIS; + } + + // PxConstraintConnector + virtual const void* getConstantBlock() const PX_OVERRIDE + { + return mData; + } + + virtual void connectToConstraint(PxConstraint* c) PX_OVERRIDE + { + mPxConstraint = c; + } + + private: + PxTransform getCom(PxU32 index) const + { + PxRigidActor* a[2]; + mPxConstraint->getActors(a[0],a[1]); + return getCom(a[index]); + } + + PxTransform getCom(PxRigidActor* actor) const + { + if (!actor) + return PxTransform(PxIdentity); + else if (actor->getType() == PxActorType::eRIGID_DYNAMIC || actor->getType() == PxActorType::eARTICULATION_LINK) + return static_cast(actor)->getCMassLocalPose(); + else + { + PX_ASSERT(actor->getType() == PxActorType::eRIGID_STATIC); + return static_cast(actor)->getGlobalPose().getInverse(); + } + } + + protected: + + JointT(PxType concreteType, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1, const char* name) : + Base (concreteType, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE), + mName (NULL), + mPxConstraint (NULL) + { + PX_UNUSED(name); + Base::userData = NULL; + + const PxU32 size = sizeof(DataClass); + JointData* data = reinterpret_cast(PX_ALLOC(size, name)); + PxMarkSerializedMemory(data, size); + + mLocalPose[0] = localFrame0.getNormalized(); + mLocalPose[1] = localFrame1.getNormalized(); + data->c2b[0] = getCom(actor0).transformInv(mLocalPose[0]); + data->c2b[1] = getCom(actor1).transformInv(mLocalPose[1]); + data->invMassScale.linear0 = 1.0f; + data->invMassScale.angular0 = 1.0f; + data->invMassScale.linear1 = 1.0f; + data->invMassScale.angular1 = 1.0f; + + mData = data; + } + + virtual ~JointT() + { + if(Base::getBaseFlags() & PxBaseFlag::eOWNS_MEMORY) + PX_FREE(mData); + +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_DESTROY(joint, static_cast(*this)) +#endif + } + + PX_FORCE_INLINE DataClass& data() const + { + return *static_cast(mData); + } + + PX_FORCE_INLINE void markDirty() + { + mPxConstraint->markDirty(); + } + + void wakeUpActors() + { + PxRigidActor* a[2]; + mPxConstraint->getActors(a[0], a[1]); + for(PxU32 i = 0; i < 2; i++) + { + if(a[i] && a[i]->getScene()) + { + if(a[i]->getType() == PxActorType::eRIGID_DYNAMIC) + { + PxRigidDynamic* rd = static_cast(a[i]); + if(!(rd->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC)) + { + const PxScene* scene = rd->getScene(); + const PxReal wakeCounterResetValue = scene->getWakeCounterResetValue(); + const PxReal wakeCounter = rd->getWakeCounter(); + if(wakeCounter < wakeCounterResetValue) + { + rd->wakeUp(); + } + } + } + else if(a[i]->getType() == PxActorType::eARTICULATION_LINK) + { + PxArticulationLink* link = reinterpret_cast(a[i]); + PxArticulationReducedCoordinate& articulation = link->getArticulation(); + const PxReal wakeCounter = articulation.getWakeCounter(); + const PxScene* scene = link->getScene(); + const PxReal wakeCounterResetValue = scene->getWakeCounterResetValue(); + if(wakeCounter < wakeCounterResetValue) + { + articulation.wakeUp(); + } + } + } + } + } + + PX_FORCE_INLINE PxQuat getTwistOrSwing(bool needTwist) const + { + const PxQuat q = getRelativeTransform().q; + // PT: TODO: we don't need to compute both quats here + PxQuat swing, twist; + PxSeparateSwingTwist(q, swing, twist); + return needTwist ? twist : swing; + } + + PxReal getTwistAngle_Internal() const + { + const PxQuat twist = getTwistOrSwing(true); + + // PT: the angle-axis formulation creates the quat like this: + // + // const float a = angleRadians * 0.5f; + // const float s = PxSin(a); + // w = PxCos(a); + // x = unitAxis.x * s; + // y = unitAxis.y * s; + // z = unitAxis.z * s; + // + // With the twist axis = (1;0;0) this gives: + // + // w = PxCos(angleRadians * 0.5f); + // x = PxSin(angleRadians * 0.5f); + // y = 0.0f; + // z = 0.0f; + // + // Thus the quat's "getAngle" function returns: + // + // angle = PxAcos(w) * 2.0f; + // + // PxAcos will return an angle between 0 and PI in radians, so "getAngle" will return an angle between 0 and PI*2. + + PxReal angle = twist.getAngle(); + + if(twist.x<0.0f) + angle = -angle; + + return angle; + } + + PxReal getSwingYAngle_Internal() const + { + PxQuat swing = getTwistOrSwing(false); + + if(swing.w < 0.0f) // choose the shortest rotation + swing = -swing; + + const PxReal angle = computeSwingAngle(swing.y, swing.w); + PX_ASSERT(angle>-PxPi && angle<=PxPi); // since |y| < w+1, the atan magnitude is < PI/4 + return angle; + } + + PxReal getSwingZAngle_Internal() const + { + PxQuat swing = getTwistOrSwing(false); + + if(swing.w < 0.0f) // choose the shortest rotation + swing = -swing; + + const PxReal angle = computeSwingAngle(swing.z, swing.w); + PX_ASSERT(angle>-PxPi && angle <= PxPi); // since |y| < w+1, the atan magnitude is < PI/4 + return angle; + } + + const char* mName; + PxTransform mLocalPose[2]; + PxConstraint* mPxConstraint; + JointData* mData; + }; + + PX_FORCE_INLINE bool isLimitActive(const PxJointLimitParameters& limit, PxReal pad, PxReal angle, PxReal low, PxReal high) + { + PX_ASSERT(low high - pad) + active = true; + return active; + } + +#if PX_SUPPORT_OMNI_PVD + void omniPvdCreateJoint(PxJoint* joint); + template void omniPvdInitJoint(JointType* joint); +#endif + +} // namespace Ext + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointData.h new file mode 100644 index 0000000..db7f50a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointData.h @@ -0,0 +1,56 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_JOINT_DATA_H +#define EXT_JOINT_DATA_H + +#include "extensions/PxJointLimit.h" + +namespace physx +{ +namespace Ext +{ + struct JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + PxConstraintInvMassScale invMassScale; //16 + PxTransform c2b[2]; //72 + PxU32 pading[2]; //80 + protected: + ~JointData() {} + }; + +} // namespace Ext +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointMetaDataExtensions.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointMetaDataExtensions.h new file mode 100644 index 0000000..5142ffa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtJointMetaDataExtensions.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_JOINT_META_DATA_EXTENSIONS_H +#define EXT_JOINT_META_DATA_EXTENSIONS_H +#include "PvdMetaDataExtensions.h" + +namespace physx +{ + +namespace pvdsdk +{ + + +struct PxExtensionPvdOnlyProperties +{ + enum Enum + { + FirstProp = PxExtensionsPropertyInfoName::LastPxPropertyInfoName, + DEFINE_ENUM_RANGE( PxJoint_Actors, 2 ), + DEFINE_ENUM_RANGE( PxJoint_BreakForce, 2 ), + DEFINE_ENUM_RANGE( PxD6Joint_DriveVelocity, 2 ), + DEFINE_ENUM_RANGE( PxD6Joint_Motion, PxD6Axis::eCOUNT ), + DEFINE_ENUM_RANGE( PxD6Joint_Drive, PxD6Drive::eCOUNT * ( PxExtensionsPropertyInfoName::PxD6JointDrive_PropertiesStop - PxExtensionsPropertyInfoName::PxD6JointDrive_PropertiesStart ) ), + DEFINE_ENUM_RANGE( PxD6Joint_LinearLimit, 100 ), + DEFINE_ENUM_RANGE( PxD6Joint_SwingLimit, 100 ), + DEFINE_ENUM_RANGE( PxD6Joint_TwistLimit, 100 ), + DEFINE_ENUM_RANGE( PxPrismaticJoint_Limit, 100 ), + DEFINE_ENUM_RANGE( PxRevoluteJoint_Limit, 100 ), + DEFINE_ENUM_RANGE( PxSphericalJoint_LimitCone, 100 ), + DEFINE_ENUM_RANGE( PxJoint_LocalPose, 2 ) + }; +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp new file mode 100644 index 0000000..be329a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtMetaData.cpp @@ -0,0 +1,444 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIO.h" +#include "common/PxMetaData.h" +#include "extensions/PxJoint.h" + +#include "ExtJoint.h" +#include "ExtD6Joint.h" +#include "ExtFixedJoint.h" +#include "ExtSphericalJoint.h" +#include "ExtDistanceJoint.h" +#include "ExtContactJoint.h" +#include "ExtRevoluteJoint.h" +#include "ExtPrismaticJoint.h" +#include "serialization/SnSerializationRegistry.h" +#include "serialization/Binary/SnSerializationContext.h" + +using namespace physx; +using namespace Cm; +using namespace Ext; + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_JointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, JointData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, JointData, PxTransform, c2b, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, JointData, PxU32, paddingFromFlags, PxMetaDataFlag::ePADDING) +#endif + PX_DEF_BIN_METADATA_ITEM(stream, JointData, PxConstraintInvMassScale, invMassScale, 0) +} + +static void getBinaryMetaData_PxD6JointDrive(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxD6JointDriveFlags, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, PxD6JointDrive) + PX_DEF_BIN_METADATA_ITEM(stream, PxD6JointDrive, PxReal, stiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxD6JointDrive, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxD6JointDrive, PxReal, forceLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxD6JointDrive, PxD6JointDriveFlags, flags, 0) +} + +static void getBinaryMetaData_PxJointLimitParameters(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitParameters, PxReal, restitution, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitParameters, PxReal, bounceThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitParameters, PxReal, stiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitParameters, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitParameters, PxReal, contactDistance_deprecated, 0) +} + +static void getBinaryMetaData_PxJointLinearLimit(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointLinearLimit) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJointLinearLimit, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLinearLimit, PxReal, value, 0) +} + +static void getBinaryMetaData_PxJointLinearLimitPair(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointLinearLimitPair) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJointLinearLimitPair, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLinearLimitPair, PxReal, upper, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLinearLimitPair, PxReal, lower, 0) +} + +static void getBinaryMetaData_PxJointAngularLimitPair(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointAngularLimitPair) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJointAngularLimitPair, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointAngularLimitPair, PxReal, upper, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointAngularLimitPair, PxReal, lower, 0) +} + +static void getBinaryMetaData_PxJointLimitCone(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointLimitCone) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJointLimitCone, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitCone, PxReal, yAngle, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitCone, PxReal, zAngle, 0) +} + +static void getBinaryMetaData_PxJointLimitPyramid(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxJointLimitPyramid) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJointLimitPyramid, PxJointLimitParameters) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitPyramid, PxReal, yAngleMin, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitPyramid, PxReal, yAngleMax, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitPyramid, PxReal, zAngleMin, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxJointLimitPyramid, PxReal, zAngleMax, 0) +} + +void PxJoint::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxJoint, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, PxJoint, void, userData, PxMetaDataFlag::ePTR) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_RevoluteJointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxRevoluteJointFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, RevoluteJointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, RevoluteJointData, JointData) + + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxReal, driveVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxReal, driveForceLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxReal, driveGearRatio, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxJointAngularLimitPair,limit, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxReal, projectionLinearTolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxReal, projectionAngularTolerance, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxRevoluteJointFlags, jointFlags, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJointData, PxU16, paddingFromFlags, PxMetaDataFlag::ePADDING) +#endif +} + +void RevoluteJoint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_RevoluteJointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, RevoluteJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, RevoluteJoint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, RevoluteJoint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJoint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, RevoluteJoint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJoint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, RevoluteJoint, JointData, mData, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, RevoluteJoint, RevoluteJointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, RevoluteJoint, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_SphericalJointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxSphericalJointFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, SphericalJointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, SphericalJointData, JointData) + + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJointData, PxJointLimitCone, limit, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJointData, PxReal, projectionLinearTolerance, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJointData, PxSphericalJointFlags, jointFlags, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJointData, PxU16, paddingFromFlags, PxMetaDataFlag::ePADDING) +#endif +} + +void SphericalJoint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_SphericalJointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, SphericalJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, SphericalJoint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, SphericalJoint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJoint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, SphericalJoint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJoint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, SphericalJoint, JointData, mData, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, SphericalJoint, SphericalJointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, SphericalJoint, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_DistanceJointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxDistanceJointFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, DistanceJointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, DistanceJointData, JointData) + + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxReal, minDistance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxReal, maxDistance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxReal, tolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxReal, stiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxDistanceJointFlags, jointFlags, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJointData, PxU16, paddingFromFlags, PxMetaDataFlag::ePADDING) +#endif +} + +void DistanceJoint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_DistanceJointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, DistanceJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, DistanceJoint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, DistanceJoint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJoint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, DistanceJoint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJoint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, DistanceJoint, JointData, mData, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, DistanceJoint, DistanceJointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, DistanceJoint, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_D6JointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxD6Motion::Enum, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, D6JointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, D6JointData, JointData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, D6JointData, PxD6Motion::Enum, motion, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLinearLimit, distanceLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLinearLimitPair, linearLimitX, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLinearLimitPair, linearLimitY, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLinearLimitPair, linearLimitZ, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointAngularLimitPair, twistLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLimitCone, swingLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxJointLimitPyramid, pyramidSwingLimit, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, D6JointData, PxD6JointDrive, drive, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxTransform, drivePosition, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxVec3, driveLinearVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxVec3, driveAngularVelocity, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxU32, locked, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxU32, limited, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxU32, driving, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxReal, distanceMinDist, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxReal, projectionLinearTolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, PxReal, projectionAngularTolerance, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, bool, mUseDistanceLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, bool, mUseNewLinearLimits, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, bool, mUseConeLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6JointData, bool, mUsePyramidLimits, 0) +} + +void D6Joint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_D6JointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, D6Joint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, D6Joint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, D6Joint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, D6Joint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, D6Joint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, D6Joint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, D6Joint, JointData, mData, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, D6Joint, bool, mRecomputeMotion, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, D6Joint, bool, mPadding, PxMetaDataFlag::ePADDING) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, D6Joint, D6JointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, D6Joint, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PrismaticJointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxPrismaticJointFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, PrismaticJointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PrismaticJointData, JointData) + + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJointData, PxJointLinearLimitPair, limit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJointData, PxReal, projectionLinearTolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJointData, PxReal, projectionAngularTolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJointData, PxPrismaticJointFlags, jointFlags, 0) +#ifdef EXPLICIT_PADDING_METADATA + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJointData, PxU16, paddingFromFlags, PxMetaDataFlag::ePADDING) +#endif +} + +void PrismaticJoint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_PrismaticJointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, PrismaticJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PrismaticJoint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PrismaticJoint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJoint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PrismaticJoint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJoint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PrismaticJoint, JointData, mData, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, PrismaticJoint, PrismaticJointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, PrismaticJoint, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_FixedJointData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, FixedJointData) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, FixedJointData, JointData) + + PX_DEF_BIN_METADATA_ITEM(stream, FixedJointData, PxReal, projectionLinearTolerance, 0) + PX_DEF_BIN_METADATA_ITEM(stream, FixedJointData, PxReal, projectionAngularTolerance, 0) +} + +void FixedJoint::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_FixedJointData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, FixedJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, FixedJoint, PxJoint) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, FixedJoint, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, FixedJoint, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, FixedJoint, PxTransform, mLocalPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, FixedJoint, PxConstraint, mPxConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, FixedJoint, JointData, mData, PxMetaDataFlag::ePTR) + + //------ Extra-data ------ + + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, FixedJoint, FixedJointData, mData, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, FixedJoint, mName, 0) +} + + +void getBinaryMetaData_SerializationContext(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxSerialObjectId, PxU64) + PX_DEF_BIN_METADATA_TYPEDEF(stream, SerialObjectIndex, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, Sn::ManifestEntry) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ManifestEntry, PxU32, offset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ManifestEntry, PxType, type, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, Sn::ImportReference) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ImportReference, PxSerialObjectId, id, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ImportReference, PxType, type, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, Sn::ExportReference) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ExportReference, PxSerialObjectId, id, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::ExportReference, SerialObjectIndex, objIndex, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, Sn::InternalReferencePtr) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::InternalReferencePtr, void, reference, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::InternalReferencePtr, SerialObjectIndex, objIndex, 0) + + PX_DEF_BIN_METADATA_CLASS(stream, Sn::InternalReferenceHandle16) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::InternalReferenceHandle16, PxU16, reference, PxMetaDataFlag::eHANDLE) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::InternalReferenceHandle16, PxU16, pad, PxMetaDataFlag::ePADDING) + PX_DEF_BIN_METADATA_ITEM(stream, Sn::InternalReferenceHandle16, SerialObjectIndex, objIndex, 0) +} + +namespace physx +{ +namespace Ext +{ +void GetExtensionsBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream,PxConstraintConnector) + + getBinaryMetaData_JointData(stream); + getBinaryMetaData_PxD6JointDrive(stream); + getBinaryMetaData_PxJointLimitParameters(stream); + getBinaryMetaData_PxJointLimitCone(stream); + getBinaryMetaData_PxJointLimitPyramid(stream); + getBinaryMetaData_PxJointLinearLimit(stream); + getBinaryMetaData_PxJointLinearLimitPair(stream); + getBinaryMetaData_PxJointAngularLimitPair(stream); + + PxJoint::getBinaryMetaData(stream); + RevoluteJoint::getBinaryMetaData(stream); + SphericalJoint::getBinaryMetaData(stream); + DistanceJoint::getBinaryMetaData(stream); + D6Joint::getBinaryMetaData(stream); + PrismaticJoint::getBinaryMetaData(stream); + FixedJoint::getBinaryMetaData(stream); + + getBinaryMetaData_SerializationContext(stream); +} + +} +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleClothCooker.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleClothCooker.cpp new file mode 100644 index 0000000..c69f86a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleClothCooker.cpp @@ -0,0 +1,462 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxParticleClothCooker.h" + +#include "foundation/PxArray.h" +#include "foundation/PxSort.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxHashSet.h" +#include "GuInternal.h" + +namespace physx +{ +namespace ExtGpu +{ + +namespace +{ + +struct Edge +{ + Edge(PxU32 v0, PxU32 v1, PxU32 triangle0, PxU32 triangle1, bool isLongest0, bool isLongest1) + { + a = PxMin(v0, v1); + b = PxMax(v0, v1); + triangleA = triangle0; + triangleB = triangle1; + longestA = isLongest0; + longestB = isLongest1; + PX_ASSERT_WITH_MESSAGE(a != b, "PxCreateInflatableFromMesh encountered a degenerate edge inside a triangle."); + } + PxU32 a, b; + PxU32 triangleA, triangleB; + bool longestA, longestB; //true if it is the longest edge of triangle + + bool operator<(const Edge& other) const + { + if(a == other.a) + return b < other.b; + return a < other.a; + } + bool operator==(const Edge& other) const + { + if(a == other.a) + return b == other.b; + return false; + } +}; + +class EdgeHash +{ +public: + uint32_t operator()(const Edge& e) const + { + return PxComputeHash(e.a) ^ PxComputeHash(e.b); + } + bool equal(const Edge& e0, const Edge& e1) const + { + return e0.a == e1.a && e0.b == e1.b; + } +}; + +class EdgeSet : public PxHashSet +{ +public: + typedef PxHashSet Base; + typedef Base::Iterator Iterator; + + void insert(const Edge& newEdge) + { + PX_ASSERT(newEdge.a < newEdge.b); + bool exists; + Edge* edge = mBase.create(newEdge, exists); + if (!exists) + { + PX_PLACEMENT_NEW(edge, Edge)(newEdge); + } + else + { + PX_ASSERT_WITH_MESSAGE(edge->triangleB == 0xffffffff, "Edge with more than 2 triangles found in PxCreateInflatableFromMesh"); + edge->triangleB = newEdge.triangleA; //Add triangle info from duplicate to Unique edge + edge->longestB = newEdge.longestA; + } + } +}; + +template +void partialSum(T* begin, T* end, T* dest) +{ + *dest = *begin; + dest++; + begin++; + while(begin!=end) + { + *dest = dest[-1] + *begin; + dest++; + begin++; + } +} + +/* +outAdjacencies is a list of adjacent vertices in outAdjacencies +outAdjacencyIndices is a list of indices to quickly find adjacent vertices in outAdjacencies. + +all the adjacent vertices to vertex V are stored in outAdjacencies starting at outAdjacencyIndices[V] and ending at outAdjacencyIndices[V+1] +so the first vertex is outAdjacencies[outAdjacencyIndices[V]], and the last one is outAdjacencies[outAdjacencyIndices[V+1]-1] + +*/ +void gatherAdjacencies(PxArray& outAdjacencyIndices, PxArray& outAdjacencies, + PxU32 vertexCount, PxArray const& inUniqueEdges, bool ignoreDiagonals = false +) +{ + PX_ASSERT(outAdjacencyIndices.size() == 0); + PX_ASSERT(outAdjacencies.size() == 0); + + outAdjacencyIndices.resize(vertexCount+1, 0); + + //calculate valency + for(PxU32 i = 0; i < inUniqueEdges.size(); i++) + { + const Edge& edge = inUniqueEdges[i]; + if(ignoreDiagonals && edge.longestA && edge.longestB) + continue; + outAdjacencyIndices[edge.a]++; + outAdjacencyIndices[edge.b]++; + } + + partialSum(outAdjacencyIndices.begin(), outAdjacencyIndices.end(), outAdjacencyIndices.begin()); + outAdjacencyIndices.back() = outAdjacencyIndices[vertexCount-1]; + outAdjacencies.resize(outAdjacencyIndices.back(),0xffffffff); + + for(PxU32 i = 0; i < inUniqueEdges.size(); i++) + { + const Edge& edge = inUniqueEdges[i]; + if(ignoreDiagonals && edge.longestA && edge.longestB) + continue; + outAdjacencyIndices[edge.a]--; + outAdjacencies[outAdjacencyIndices[edge.a]]=edge.b; + outAdjacencyIndices[edge.b]--; + outAdjacencies[outAdjacencyIndices[edge.b]] = edge.a; + } +} + +template +A MaxArg(T const& vA, T const& vB, A const& aA, A const& aB) +{ + if(vA > vB) + return aA; + return aB; +} + +PxU32 GetOppositeVertex(PxU32* inTriangleIndices, PxU32 triangleIndex, PxU32 a, PxU32 b) +{ + for(int i = 0; i<3; i++) + { + if(inTriangleIndices[triangleIndex+i] != a && inTriangleIndices[triangleIndex + i] !=b) + return inTriangleIndices[triangleIndex + i]; + } + PX_ASSERT_WITH_MESSAGE(0, "Degenerate Triangle found in PxCreateInflatableFromMesh"); + return 0; +} + +Edge GetAlternateDiagonal(Edge const& edge, PxU32* inTriangleIndices) +{ + PxU32 vA = GetOppositeVertex(inTriangleIndices, edge.triangleA, edge.a, edge.b); + PxU32 vB = GetOppositeVertex(inTriangleIndices, edge.triangleB, edge.a, edge.b); + bool longestA = true; + bool longestB = true; + PxU32 tA = 0xffffffff; + PxU32 tB = 0xffffffff; + return Edge(vA, vB, tA, tB, longestA, longestB); +} +} //namespace + +class PxParticleClothCookerImpl : public PxParticleClothCooker, public PxUserAllocated +{ +public: + PxParticleClothCookerImpl(PxU32 vertexCount, physx::PxVec4* inVertices, PxU32 triangleIndexCount, PxU32* inTriangleIndices, + PxU32 constraintTypeFlags, PxVec3 verticalDirection, PxReal bendingConstraintMaxAngle) + : + mVertexCount(vertexCount), + mVertices(inVertices), + mTriangleIndexCount(triangleIndexCount), + mTriangleIndices(inTriangleIndices), + mConstraintTypeFlags(constraintTypeFlags), + mVerticalDirection(verticalDirection), + mBendingConstraintMaxAngle(bendingConstraintMaxAngle) + { + } + virtual void release() + { + PX_DELETE_THIS; + } + + /** + \brief generate the constraint and triangle per vertex information. + */ + virtual void cookConstraints(const PxParticleClothConstraint* constraints, const PxU32 numConstraints); + virtual PxU32* getTriangleIndices() { return mTriangleIndexBuffer.begin(); } + virtual PxU32 getTriangleIndicesCount() { return mTriangleIndexBuffer.size(); } + virtual PxParticleClothConstraint* getConstraints() { return mConstraintBuffer.begin(); } + virtual PxU32 getConstraintCount() { return mConstraintBuffer.size(); } + + /** + \brief Computes the volume of a closed mesh and the contraintScale. Expects vertices in local space - 'close' to origin. + */ + virtual void calculateMeshVolume(); + virtual float getMeshVolume() {return mMeshVolume;} + +private: + PxArray mTriangleIndexBuffer; + PxArray mConstraintBuffer; + + PxU32 mVertexCount; + physx::PxVec4* mVertices; //we don't own this + PxU32 mTriangleIndexCount; + PxU32* mTriangleIndices; //we don't own this + PxU32 mConstraintTypeFlags; + PxVec3 mVerticalDirection; + float mBendingConstraintMaxAngle; + + float mMeshVolume; + + void addTriangle(PxArray& trianglesPerVertex, PxU32 triangleIndex) + { + for(int j = 0; j < 3; j++) + { + PxU32 vertexIndex = mTriangleIndices[triangleIndex + j]; + mTriangleIndexBuffer.pushBack(vertexIndex); + trianglesPerVertex[vertexIndex]++; + } + } +}; + +void PxParticleClothCookerImpl::cookConstraints(const PxParticleClothConstraint* constraints, const PxU32 numConstraints) +{ + EdgeSet edgeSet; + edgeSet.reserve(mTriangleIndexCount); + + PxArray trianglesPerVertex; + trianglesPerVertex.resize(mVertexCount, 0); + + mTriangleIndexBuffer.clear(); + mTriangleIndexBuffer.reserve(mTriangleIndexCount); + + mConstraintBuffer.clear(); + mConstraintBuffer.reserve(mVertexCount*12); + + //Add all edges to Edges + for(PxU32 i = 0; i uniqueEdges; + uniqueEdges.reserve(mTriangleIndexCount); //over allocate to avoid resizes + for (EdgeSet::Iterator iter = edgeSet.getIterator(); !iter.done(); ++iter) + { + const Edge& e = *iter; + uniqueEdges.pushBack(e); + } + + //Maximum angle before it is a horizontal constraint + const float cosAngle45 = cosf(45.0f / 360.0f * PxTwoPi); + + //Add all horizontal, vertical and shearing constraints + PxU32 constraintCount = uniqueEdges.size(); //we are going to push back more edges, but we don't need to process them + for(PxU32 i = 0; i < constraintCount; i++) + { + const Edge& edge = uniqueEdges[i]; + PxParticleClothConstraint c; + c.particleIndexA = edge.a; + c.particleIndexB = edge.b; + + //Get vertices's + PxVec3 vA = mVertices[c.particleIndexA].getXYZ(); + PxVec3 vB = mVertices[c.particleIndexB].getXYZ(); + + //Calculate rest length + c.length = (vA - vB).magnitude(); + + if(edge.longestA && edge.longestB && (mConstraintTypeFlags & PxParticleClothConstraint::eTYPE_DIAGONAL_CONSTRAINT)) + { + //Shearing constraint + c.constraintType = c.eTYPE_DIAGONAL_CONSTRAINT; + //add constraint + mConstraintBuffer.pushBack(c); + + //We only have one of the quad diagonals in a triangle mesh, get the other one here + const Edge alternateEdge = GetAlternateDiagonal(edge, mTriangleIndices); + c.particleIndexA = alternateEdge.a; + c.particleIndexB = alternateEdge.b; + + //Get vertices's + PxVec3 vA2 = mVertices[c.particleIndexA].getXYZ(); + PxVec3 vB2 = mVertices[c.particleIndexB].getXYZ(); + + //Calculate rest length + c.length = (vA2 - vB2).magnitude(); + + //add constraint + mConstraintBuffer.pushBack(c); + + if (mConstraintTypeFlags & PxParticleClothConstraint::eTYPE_DIAGONAL_BENDING_CONSTRAINT) + { + if (!edgeSet.contains(alternateEdge)) + { + edgeSet.insert(alternateEdge); + uniqueEdges.pushBack(alternateEdge); //Add edge for bending constraint step + } + } + } + else + { + //horizontal/vertical constraint + PxVec3 dir = (vA - vB) / c.length; + if(mVerticalDirection.dot(dir)> cosAngle45) + c.constraintType = c.eTYPE_VERTICAL_CONSTRAINT; + else + c.constraintType = c.eTYPE_HORIZONTAL_CONSTRAINT; + + if(mConstraintTypeFlags & c.constraintType) + { + //add constraint + mConstraintBuffer.pushBack(c); + } + } + } + + if(!(mConstraintTypeFlags & PxParticleClothConstraint::eTYPE_BENDING_CONSTRAINT)) + return; + + //Get adjacency information needed for the bending constraints + PxArray adjacencyIndices; + PxArray adjacencies; + gatherAdjacencies(adjacencyIndices, adjacencies, mVertexCount, uniqueEdges, !(mConstraintTypeFlags & PxParticleClothConstraint::eTYPE_DIAGONAL_BENDING_CONSTRAINT)); + + //Maximum angle we consider to be parallel for the bending constraints + const float maxCosAngle = cosf(mBendingConstraintMaxAngle / 360.0f * PxTwoPi); + + for(PxU32 i = 0; i bestCosAngle) + { + bestCosAngle = cosAngle; + bestAdjB = adjB; + } + } + + //Check if the lines a-center and center-b are roughly parallel + if(bestCosAngle > maxCosAngle) + { + //Add bending constraint + PxParticleClothConstraint c; + c.particleIndexA = adjacencies[adjA]; + c.particleIndexB = adjacencies[bestAdjB]; + + PX_ASSERT(c.particleIndexA != c.particleIndexB); + + //Get vertices's + PxVec3 vA = mVertices[c.particleIndexA].getXYZ(); + PxVec3 vB = mVertices[c.particleIndexB].getXYZ(); + + //Calculate rest length + c.length = (vA - vB).magnitude(); + + c.constraintType = c.eTYPE_BENDING_CONSTRAINT; + //add constraint + mConstraintBuffer.pushBack(c); + } + } + } +} + +void PxParticleClothCookerImpl::calculateMeshVolume() +{ + // the physx api takes volume*6 now. + mMeshVolume = Gu::computeTriangleMeshVolume(mVertices, mTriangleIndices, mTriangleIndexCount / 3) * 6.0f; +} + +} // namespace ExtGpu + +ExtGpu::PxParticleClothCooker* PxCreateParticleClothCooker(PxU32 vertexCount, PxVec4* inVertices, PxU32 triangleIndexCount, PxU32* inTriangleIndices, + PxU32 constraintTypeFlags, PxVec3 verticalDirection, PxReal bendingConstraintMaxAngle) +{ + return PX_NEW(ExtGpu::PxParticleClothCookerImpl)(vertexCount, inVertices, triangleIndexCount, inTriangleIndices, + constraintTypeFlags, verticalDirection, bendingConstraintMaxAngle); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleExt.cpp new file mode 100644 index 0000000..076c7b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtParticleExt.cpp @@ -0,0 +1,769 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxParticleExt.h" + +#include "foundation/PxUserAllocated.h" +#include "PxScene.h" +#include "PxPhysics.h" +#include "PxRigidBody.h" +#include "cudamanager/PxCudaContextManager.h" +#include "cudamanager/PxCudaContext.h" + +namespace physx +{ +namespace ExtGpu +{ + +void PxDmaDataToDevice(PxCudaContextManager* cudaContextManager, PxParticleBuffer* particleBuffer, const PxParticleBufferDesc& desc) +{ + cudaContextManager->acquireContext(); + + PxVec4* posInvMass = particleBuffer->getPositionInvMasses(); + PxVec4* velocities = particleBuffer->getVelocities(); + PxU32* phases = particleBuffer->getPhases(); + PxParticleVolume* volumes = particleBuffer->getParticleVolumes(); + + PxCudaContext* cudaContext = cudaContextManager->getCudaContext(); + + //KS - TODO - use an event to wait for this + cudaContext->memcpyHtoDAsync(CUdeviceptr(posInvMass), desc.positions, desc.numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(velocities), desc.velocities, desc.numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(phases), desc.phases, desc.numActiveParticles * sizeof(PxU32), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(volumes), desc.volumes, desc.numVolumes * sizeof(PxParticleVolume), 0); + + particleBuffer->setNbActiveParticles(desc.numActiveParticles); + particleBuffer->setNbParticleVolumes(desc.numVolumes); + + cudaContext->streamSynchronize(0); + + cudaContextManager->releaseContext(); +} + +PxParticleBuffer* PxCreateAndPopulateParticleBuffer(const PxParticleBufferDesc& desc, PxCudaContextManager* cudaContextManager) +{ + PxParticleBuffer* particleBuffer = PxGetPhysics().createParticleBuffer(desc.maxParticles, desc.maxVolumes, cudaContextManager); + PxDmaDataToDevice(cudaContextManager, particleBuffer, desc); + return particleBuffer; +} + +PxParticleAndDiffuseBuffer* PxCreateAndPopulateParticleAndDiffuseBuffer(const PxParticleAndDiffuseBufferDesc& desc, PxCudaContextManager* cudaContextManager) +{ + PxParticleAndDiffuseBuffer* particleBuffer = PxGetPhysics().createParticleAndDiffuseBuffer(desc.maxParticles, desc.maxVolumes, desc.maxDiffuseParticles, cudaContextManager); + PxDmaDataToDevice(cudaContextManager, particleBuffer, desc); + particleBuffer->setMaxActiveDiffuseParticles(desc.maxActiveDiffuseParticles); + return particleBuffer; +} + + +PxParticleClothBuffer* PxCreateAndPopulateParticleClothBuffer(const PxParticleBufferDesc& desc, const PxParticleClothDesc& clothDesc, PxPartitionedParticleCloth& output, PxCudaContextManager* cudaContextManager) +{ + cudaContextManager->acquireContext(); + + PxParticleClothBuffer* clothBuffer = PxGetPhysics().createParticleClothBuffer(desc.maxParticles, desc.maxVolumes, clothDesc.nbCloths, clothDesc.nbTriangles, clothDesc.nbSprings, cudaContextManager); + + PxVec4* posInvMass = clothBuffer->getPositionInvMasses(); + PxVec4* velocities = clothBuffer->getVelocities(); + PxU32* phases = clothBuffer->getPhases(); + PxParticleVolume* volumes = clothBuffer->getParticleVolumes(); + PxU32* triangles = clothBuffer->getTriangles(); + PxVec4* restPositions = clothBuffer->getRestPositions(); + + PxCudaContext* cudaContext = cudaContextManager->getCudaContext(); + + cudaContext->memcpyHtoDAsync(CUdeviceptr(posInvMass), desc.positions, desc.numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(velocities), desc.velocities, desc.numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(phases), desc.phases, desc.numActiveParticles * sizeof(PxU32), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(volumes), desc.volumes, desc.numVolumes * sizeof(PxParticleVolume), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(triangles), clothDesc.triangles, clothDesc.nbTriangles * sizeof(PxU32) * 3, 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(restPositions), clothDesc.restPositions, desc.numActiveParticles * sizeof(PxVec4), 0); + + clothBuffer->setNbActiveParticles(desc.numActiveParticles); + clothBuffer->setNbParticleVolumes(desc.numVolumes); + clothBuffer->setNbTriangles(clothDesc.nbTriangles); + + clothBuffer->setCloths(output); + + cudaContext->streamSynchronize(0); + + cudaContextManager->releaseContext(); + + + return clothBuffer; +} + +PxParticleRigidBuffer* PxCreateAndPopulateParticleRigidBuffer(const PxParticleBufferDesc& desc, const PxParticleRigidDesc& rigidDesc, PxCudaContextManager* cudaContextManager) +{ + cudaContextManager->acquireContext(); + + PxParticleRigidBuffer* rigidBuffer = PxGetPhysics().createParticleRigidBuffer(desc.maxParticles, desc.maxVolumes, rigidDesc.maxRigids, cudaContextManager); + + PxVec4* posInvMassd = rigidBuffer->getPositionInvMasses(); + PxVec4* velocitiesd = rigidBuffer->getVelocities(); + PxU32* phasesd = rigidBuffer->getPhases(); + PxParticleVolume* volumesd = rigidBuffer->getParticleVolumes(); + PxU32* rigidOffsetsd = rigidBuffer->getRigidOffsets(); + PxReal* rigidCoefficientsd = rigidBuffer->getRigidCoefficients(); + PxVec4* rigidTranslationsd = rigidBuffer->getRigidTranslations(); + PxVec4* rigidRotationsd = rigidBuffer->getRigidRotations(); + PxVec4* rigidLocalPositionsd = rigidBuffer->getRigidLocalPositions(); + PxVec4* rigidLocalNormalsd = rigidBuffer->getRigidLocalNormals(); + + PxCudaContext* cudaContext = cudaContextManager->getCudaContext(); + + const PxU32 numRigids = rigidDesc.numActiveRigids; + const PxU32 numActiveParticles = desc.numActiveParticles; + + cudaContext->memcpyHtoDAsync(CUdeviceptr(posInvMassd), desc.positions, numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(velocitiesd), desc.velocities, numActiveParticles * sizeof(PxVec4), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(phasesd), desc.phases, numActiveParticles * sizeof(PxU32), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(volumesd), desc.volumes, desc.numVolumes * sizeof(PxParticleVolume), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidOffsetsd), rigidDesc.rigidOffsets, sizeof(PxU32) * (numRigids + 1), 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidCoefficientsd), rigidDesc.rigidCoefficients, sizeof(PxReal) * numRigids, 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidTranslationsd), rigidDesc.rigidTranslations, sizeof(PxVec4) * numRigids, 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidRotationsd), rigidDesc.rigidRotations, sizeof(PxQuat) * numRigids, 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidLocalPositionsd), rigidDesc.rigidLocalPositions, sizeof(PxVec4) * desc.numActiveParticles, 0); + cudaContext->memcpyHtoDAsync(CUdeviceptr(rigidLocalNormalsd), rigidDesc.rigidLocalNormals, sizeof(PxVec4) * desc.numActiveParticles, 0); + + rigidBuffer->setNbActiveParticles(numActiveParticles); + rigidBuffer->setNbRigids(numRigids); + rigidBuffer->setNbParticleVolumes(desc.numVolumes); + + cudaContext->streamSynchronize(0); + + cudaContextManager->releaseContext(); + +return rigidBuffer; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxParticleAttachmentBuffer::PxParticleAttachmentBuffer(PxParticleBuffer& particleBuffer, PxParticleSystem& particleSystem) : mParticleBuffer(particleBuffer), + mDeviceAttachments(NULL), mDeviceFilters(NULL), mNumDeviceAttachments(0), mNumDeviceFilters(0), mCudaContextManager(particleSystem.getCudaContextManager()), + mParticleSystem(particleSystem), mDirty(false) +{ +} + +PxParticleAttachmentBuffer::~PxParticleAttachmentBuffer() +{ + mCudaContextManager->acquireContext(); + + PxCudaContext* cudaContext = mCudaContextManager->getCudaContext(); + + if (mDeviceAttachments) + cudaContext->memFree((CUdeviceptr)mDeviceAttachments); + if (mDeviceFilters) + cudaContext->memFree((CUdeviceptr)mDeviceFilters); + + mDeviceAttachments = NULL; + mDeviceFilters = NULL; + + mCudaContextManager->releaseContext(); +} + +void PxParticleAttachmentBuffer::copyToDevice(CUstream stream) +{ + mCudaContextManager->acquireContext(); + + PxCudaContext* cudaContext = mCudaContextManager->getCudaContext(); + + if (mAttachments.size() > mNumDeviceAttachments) + { + if (mDeviceAttachments) + cudaContext->memFree((CUdeviceptr)mDeviceAttachments); + + cudaContext->memAlloc((CUdeviceptr*)&mDeviceAttachments, sizeof(PxParticleRigidAttachment)*mAttachments.size()); + mNumDeviceAttachments = mAttachments.size(); + } + if (mFilters.size() > mNumDeviceFilters) + { + if (mDeviceFilters) + cudaContext->memFree((CUdeviceptr)mDeviceFilters); + + cudaContext->memAlloc((CUdeviceptr*)&mDeviceFilters, sizeof(PxParticleRigidFilterPair)*mFilters.size()); + mNumDeviceFilters = mFilters.size(); + } + + if (mAttachments.size()) + cudaContext->memcpyHtoDAsync((CUdeviceptr)mDeviceAttachments, mAttachments.begin(), sizeof(PxParticleRigidAttachment)*mAttachments.size(), stream); + + if (mFilters.size()) + cudaContext->memcpyHtoDAsync((CUdeviceptr)mDeviceFilters, mFilters.begin(), sizeof(PxParticleRigidFilterPair)*mFilters.size(), stream); + + mParticleBuffer.setRigidAttachments(mDeviceAttachments, mAttachments.size()); + mParticleBuffer.setRigidFilters(mDeviceFilters, mFilters.size()); + + mDirty = true; + + for (PxU32 i = 0; i < mNewReferencedBodies.size(); ++i) + { + if (mReferencedBodies[mNewReferencedBodies[i]] > 0) + mParticleSystem.addRigidAttachment(mNewReferencedBodies[i]); + } + + for (PxU32 i = 0; i < mDestroyedRefrencedBodies.size(); ++i) + { + if (mReferencedBodies[mDestroyedRefrencedBodies[i]] == 0) + mParticleSystem.removeRigidAttachment(mDestroyedRefrencedBodies[i]); + } + + mNewReferencedBodies.resize(0); + mDestroyedRefrencedBodies.resize(0); + + mCudaContextManager->releaseContext(); +} + +void PxParticleAttachmentBuffer::addRigidAttachment(PxRigidActor* rigidActor, const PxU32 particleID, const PxVec3& localPose, PxConeLimitedConstraint* coneLimit) +{ + PX_ASSERT(particleID < mParticleBuffer.getNbActiveParticles()); + PxParticleRigidAttachment attachment; + + if (coneLimit) + { + attachment.mParams.axisAngle = PxVec4(coneLimit->mAxis, coneLimit->mAngle); + attachment.mParams.lowHighLimits = PxVec4(coneLimit->mLowLimit, coneLimit->mHighLimit, 0.f, 0.f); + } + else + { + attachment.mParams.axisAngle = PxVec4(0.f); + attachment.mParams.lowHighLimits = PxVec4(0.f); + } + + if (rigidActor->getType() == PxActorType::eRIGID_STATIC) + { + // attachments to rigid static work in global space + attachment.mLocalPose0 = PxVec4(static_cast(rigidActor)->getGlobalPose().transform(localPose), 0.0f); + attachment.mID0 = PxNodeIndex().getInd(); + } + else + { + // others use body space. + PxRigidBody* rigid = static_cast(rigidActor); + PxTransform body2Actor = rigid->getCMassLocalPose(); + attachment.mLocalPose0 = PxVec4(body2Actor.transformInv(localPose), 0.f); + attachment.mID0 = rigid->getInternalIslandNodeIndex().getInd(); + } + attachment.mID1 = particleID; + + //Insert in order... + + PxU32 l = 0, r = PxU32(mAttachments.size()); + + while (l < r) //If difference is just 1, we've found an item... + { + PxU32 index = (l + r) / 2; + + if (attachment < mAttachments[index]) + r = index; + else if (attachment > mAttachments[index]) + l = index + 1; + else + l = r = index; //This is a match so insert before l + } + + mAttachments.insert(); + + for (PxU32 i = mAttachments.size()-1; i > l; --i) + { + mAttachments[i] = mAttachments[i - 1]; + } + mAttachments[l] = attachment; + + mDirty = true; + + if (rigidActor) + { + PxU32& refCount = mReferencedBodies[rigidActor]; + + if (refCount == 0) + mNewReferencedBodies.pushBack(rigidActor); + refCount++; + } +} + +bool PxParticleAttachmentBuffer::removeRigidAttachment(PxRigidActor* rigidActor, const PxU32 particleID) +{ + PX_ASSERT(particleID < mParticleBuffer.getNbActiveParticles()); + + if (rigidActor) + { + PxU32& refCount = mReferencedBodies[rigidActor]; + refCount--; + + if (refCount == 0) + mDestroyedRefrencedBodies.pushBack(rigidActor); + } + + PxParticleRigidFilterPair attachment; + attachment.mID0 = rigidActor->getType() != PxActorType::eRIGID_STATIC ? static_cast(rigidActor)->getInternalIslandNodeIndex().getInd() : + PxNodeIndex().getInd(); + attachment.mID1 = particleID; + PxU32 l = 0, r = PxU32(mAttachments.size()); + + while (l < r) //If difference is just 1, we've found an item... + { + PxU32 index = (l + r) / 2; + + if (attachment < mAttachments[index]) + r = index; + else if (attachment > mAttachments[index]) + l = index + 1; + else + l = r = index; //This is a match so insert before l + } + + if (mAttachments[l] == attachment) + { + mDirty = true; + //Remove + mAttachments.remove(l); + return true; + } + return false; +} + +void PxParticleAttachmentBuffer::addRigidFilter(PxRigidActor* rigidActor, const PxU32 particleID) +{ + PX_ASSERT(particleID < mParticleBuffer.getNbActiveParticles()); + PxParticleRigidFilterPair attachment; + attachment.mID0 = rigidActor->getType() != PxActorType::eRIGID_STATIC ? static_cast(rigidActor)->getInternalIslandNodeIndex().getInd() : + PxNodeIndex().getInd(); + attachment.mID1 = particleID; + + //Insert in order... + + PxU32 l = 0, r = PxU32(mFilters.size()); + + while (l < r) //If difference is just 1, we've found an item... + { + PxU32 index = (l + r) / 2; + + if (attachment < mFilters[index]) + r = index; + else if (attachment > mFilters[index]) + l = index + 1; + else + l = r = index; //This is a match so insert before l + } + + mFilters.insert(); + + for (PxU32 i = mFilters.size() - 1; i > l; --i) + { + mFilters[i] = mFilters[i - 1]; + } + mFilters[l] = attachment; + + mDirty = true; +} + +bool PxParticleAttachmentBuffer::removeRigidFilter(PxRigidActor* rigidActor, const PxU32 particleID) +{ + PX_ASSERT(particleID < mParticleBuffer.getNbActiveParticles()); + PxParticleRigidFilterPair attachment; + attachment.mID0 = rigidActor->getType() != PxActorType::eRIGID_STATIC ? static_cast(rigidActor)->getInternalIslandNodeIndex().getInd() : + PxNodeIndex().getInd(); + attachment.mID1 = particleID; + PxU32 l = 0, r = PxU32(mFilters.size()); + + while (l < r) //If difference is just 1, we've found an item... + { + PxU32 index = (l + r) / 2; + + if (attachment < mFilters[index]) + r = index; + else if (attachment > mFilters[index]) + l = index + 1; + else + l = r = index; //This is a match so insert before l + } + + if (mFilters[l] == attachment) + { + mDirty = true; + //Remove + mFilters.remove(l); + return true; + } + return false; +} + +PxParticleAttachmentBuffer* PxCreateParticleAttachmentBuffer(PxParticleBuffer& buffer, PxParticleSystem& particleSystem) +{ + return PX_NEW(PxParticleAttachmentBuffer)(buffer, particleSystem); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +struct ParticleClothBuffersImpl : public PxParticleClothBufferHelper, public PxUserAllocated +{ + ParticleClothBuffersImpl(const PxU32 maxCloths, const PxU32 maxTriangles, const PxU32 maxSprings, const PxU32 maxParticles, PxCudaContextManager* cudaContextManager) + : mCudaContextManager(cudaContextManager) + { + mMaxParticles = maxParticles; + mClothDesc.nbParticles = 0; + mClothDesc.restPositions = mCudaContextManager->allocPinnedHostBuffer(maxParticles); + + mMaxTriangles = maxTriangles; + mClothDesc.nbTriangles = 0; + mClothDesc.triangles = mCudaContextManager->allocPinnedHostBuffer(maxTriangles * 3); + + mMaxSprings = maxSprings; + mClothDesc.nbSprings = 0; + mClothDesc.springs = mCudaContextManager->allocPinnedHostBuffer(maxSprings); + + mMaxCloths = maxCloths; + mClothDesc.nbCloths = 0; + mClothDesc.cloths = mCudaContextManager->allocPinnedHostBuffer(maxCloths); + } + + void release() + { + mCudaContextManager->freePinnedHostBuffer(mClothDesc.cloths); + mCudaContextManager->freePinnedHostBuffer(mClothDesc.restPositions); + mCudaContextManager->freePinnedHostBuffer(mClothDesc.triangles); + mCudaContextManager->freePinnedHostBuffer(mClothDesc.springs); + PX_DELETE_THIS; + } + + PxU32 getMaxCloths() const { return mMaxCloths; } + PxU32 getNumCloths() const { return mClothDesc.nbCloths; } + PxU32 getMaxSprings() const { return mMaxSprings; } + PxU32 getNumSprings() const { return mClothDesc.nbSprings; } + PxU32 getMaxTriangles() const { return mMaxTriangles; } + PxU32 getNumTriangles() const { return mClothDesc.nbTriangles; } + PxU32 getMaxParticles() const { return mMaxParticles; } + PxU32 getNumParticles() const { return mClothDesc.nbParticles; } + + void addCloth(const PxParticleCloth& particleCloth, const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, const PxVec4* restPositions, const PxU32 numParticles) + { + if (mClothDesc.nbCloths + 1 > mMaxCloths) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxParticleClothBufferHelper::addCloth: exceeding maximal number of cloths that can be added."); + return; + } + + if (mClothDesc.nbSprings + numSprings > mMaxSprings) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxParticleClothBufferHelper::addCloth: exceeding maximal number of springs that can be added."); + return; + } + + if (mClothDesc.nbTriangles + numTriangles > mMaxTriangles) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxParticleClothBufferHelper::addCloth: exceeding maximal number of triangles that can be added."); + return; + } + + if (mClothDesc.nbParticles + numParticles > mMaxParticles) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxParticleClothBufferHelper::addCloth: exceeding maximal number of particles that can be added."); + return; + } + + mClothDesc.cloths[mClothDesc.nbCloths] = particleCloth; + mClothDesc.nbCloths += 1; + + for (PxU32 i = 0; i < numSprings; ++i) + { + PxParticleSpring& dst = mClothDesc.springs[mClothDesc.nbSprings + i]; + dst = springs[i]; + dst.ind0 += mClothDesc.nbParticles; + dst.ind1 += mClothDesc.nbParticles; + } + mClothDesc.nbSprings += numSprings; + + for (PxU32 i = 0; i < numTriangles*3; ++i) + { + PxU32& dst = mClothDesc.triangles[mClothDesc.nbTriangles*3 + i]; + dst = triangles[i] + mClothDesc.nbParticles; + } + mClothDesc.nbTriangles += numTriangles; + + PxMemCopy(mClothDesc.restPositions + mClothDesc.nbParticles, restPositions, sizeof(PxVec4)*numParticles); + mClothDesc.nbParticles += numParticles; + } + + void addCloth(const PxReal blendScale, const PxReal restVolume, const PxReal pressure, const PxU32* triangles, const PxU32 numTriangles, + const PxParticleSpring* springs, const PxU32 numSprings, const PxVec4* restPositions, const PxU32 numParticles) + { + PX_UNUSED(blendScale); + PxParticleCloth particleCloth; + //particleCloth.clothBlendScale = blendScale; + particleCloth.restVolume = restVolume; + particleCloth.pressure = pressure; + particleCloth.startVertexIndex = mClothDesc.nbParticles; + particleCloth.numVertices = numParticles; + particleCloth.startTriangleIndex = mClothDesc.nbTriangles * 3; + particleCloth.numTriangles = numTriangles; + + addCloth(particleCloth, triangles, numTriangles, springs, numSprings, restPositions, numParticles); + } + + PxParticleClothDesc& getParticleClothDesc() + { + return mClothDesc; + } + + PxU32 mMaxCloths; + PxU32 mMaxSprings; + PxU32 mMaxTriangles; + PxU32 mMaxParticles; + PxParticleClothDesc mClothDesc; + PxCudaContextManager* mCudaContextManager; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +struct ParticleVolumeBuffersImpl : public PxParticleVolumeBufferHelper, public PxUserAllocated +{ + ParticleVolumeBuffersImpl(PxU32 maxVolumes, PxU32 maxTriangles, PxCudaContextManager* cudaContextManager) + { + mMaxVolumes = maxVolumes; + mNumVolumes = 0; + mMaxTriangles = maxTriangles; + mNumTriangles = 0; + mParticleVolumeMeshes = reinterpret_cast(PX_ALLOC(sizeof(PxParticleVolumeMesh) * maxVolumes, "ParticleVolumeBuffersImpl::mParticleVolumeMeshes")); + mTriangles = reinterpret_cast(PX_ALLOC(sizeof(PxU32) * maxTriangles * 3, "ParticleVolumeBuffersImpl::mTriangles")); + + mParticleVolumes = cudaContextManager->allocPinnedHostBuffer(maxVolumes); + mCudaContextManager = cudaContextManager; + } + + void release() + { + mCudaContextManager->freePinnedHostBuffer(mParticleVolumes); + PX_FREE(mParticleVolumeMeshes); + PX_FREE(mTriangles); + PX_DELETE_THIS; + } + + virtual PxU32 getMaxVolumes() const + { + return mMaxVolumes; + } + + virtual PxU32 getNumVolumes() const + { + return mNumVolumes; + } + + virtual PxU32 getMaxTriangles() const + { + return mMaxTriangles; + } + + virtual PxU32 getNumTriangles() const + { + return mNumTriangles; + } + + virtual PxParticleVolume* getParticleVolumes() + { + return mParticleVolumes; + } + + virtual PxParticleVolumeMesh* getParticleVolumeMeshes() + { + return mParticleVolumeMeshes; + } + + virtual PxU32* getTriangles() + { + return mTriangles; + } + + virtual void addVolume(const PxParticleVolume& volume, const PxParticleVolumeMesh& volumeMesh, const PxU32* triangles, const PxU32 numTriangles) + { + if (mNumVolumes < mMaxVolumes && mNumTriangles + numTriangles <= mMaxTriangles) + { + PX_ASSERT(volumeMesh.startIndex == mNumTriangles); + + mParticleVolumes[mNumVolumes] = volume; + mParticleVolumeMeshes[mNumVolumes] = volumeMesh; + mNumVolumes++; + + for (PxU32 i = 0; i < numTriangles*3; ++i) + { + mTriangles[mNumTriangles*3 + i] = triangles[i] + volumeMesh.startIndex; + } + mNumTriangles += numTriangles; + } + } + + virtual void addVolume(const PxU32 particleOffset, const PxU32 numParticles, const PxU32* triangles, const PxU32 numTriangles) + { + if (mNumVolumes < mMaxVolumes && mNumTriangles + numTriangles <= mMaxTriangles) + { + PxParticleVolume particleVolume; + particleVolume.bound.setEmpty(); + particleVolume.particleIndicesOffset = particleOffset; + particleVolume.numParticles = numParticles; + PxParticleVolumeMesh particleVolumeMesh; + particleVolumeMesh.startIndex = mNumTriangles; + particleVolumeMesh.count = numTriangles; + + mParticleVolumes[mNumVolumes] = particleVolume; + mParticleVolumeMeshes[mNumVolumes] = particleVolumeMesh; + mNumVolumes++; + + for (PxU32 i = 0; i < numTriangles*3; ++i) + { + mTriangles[mNumTriangles*3 + i] = triangles[i] + particleOffset; + } + mNumTriangles += numTriangles; + } + } + + PxU32 mMaxVolumes; + PxU32 mNumVolumes; + PxU32 mMaxTriangles; + PxU32 mNumTriangles; + PxParticleVolume* mParticleVolumes; + PxParticleVolumeMesh* mParticleVolumeMeshes; + PxU32* mTriangles; + PxCudaContextManager* mCudaContextManager; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +struct ParticleRigidBuffersImpl : public PxParticleRigidBufferHelper, public PxUserAllocated +{ + ParticleRigidBuffersImpl(PxU32 maxRigids, PxU32 maxParticles, PxCudaContextManager* cudaContextManager) + : mCudaContextManager(cudaContextManager) + { + mRigidDesc.maxRigids = maxRigids; + mRigidDesc.numActiveRigids = 0; + mMaxParticles = maxParticles; + mNumParticles = 0; + + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidOffsets, maxRigids + 1); + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidCoefficients, maxRigids); + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidTranslations, maxRigids); + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidRotations, maxRigids); + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidLocalPositions, maxParticles); + mCudaContextManager->allocPinnedHostBuffer(mRigidDesc.rigidLocalNormals, maxParticles); + } + + void release() + { + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidOffsets); + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidCoefficients); + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidTranslations); + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidRotations); + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidLocalPositions); + mCudaContextManager->freePinnedHostBuffer(mRigidDesc.rigidLocalNormals); + PX_DELETE_THIS; + } + + virtual PxU32 getMaxRigids() const { return mRigidDesc.maxRigids; } + virtual PxU32 getNumRigids() const { return mRigidDesc.numActiveRigids; } + virtual PxU32 getMaxParticles() const { return mMaxParticles; } + virtual PxU32 getNumParticles() const { return mNumParticles; } + + void addRigid(const PxVec3& translation, const PxQuat& rotation, const PxReal coefficient, + const PxVec4* localPositions, const PxVec4* localNormals, PxU32 numParticles) + { + PX_ASSERT(numParticles > 0); + const PxU32 numRigids = mRigidDesc.numActiveRigids; + + if (numParticles > 0 && numRigids < mRigidDesc.maxRigids && mNumParticles + numParticles <= mMaxParticles) + { + mRigidDesc.rigidOffsets[numRigids] = mNumParticles; + mRigidDesc.rigidOffsets[numRigids + 1] = mNumParticles + numParticles; + mRigidDesc.rigidTranslations[numRigids] = PxVec4(translation, 0.0f); + mRigidDesc.rigidRotations[numRigids] = rotation; + mRigidDesc.rigidCoefficients[numRigids] = coefficient; + PxMemCopy(mRigidDesc.rigidLocalPositions + mNumParticles, localPositions, numParticles * sizeof(PxVec4)); + PxMemCopy(mRigidDesc.rigidLocalNormals + mNumParticles, localNormals, numParticles * sizeof(PxVec4)); + mRigidDesc.numActiveRigids += 1; + mNumParticles += numParticles; + } + } + + PxParticleRigidDesc& getParticleRigidDesc() + { + return mRigidDesc; + } + + PxU32 mMaxParticles; + PxU32 mNumParticles; + PxParticleRigidDesc mRigidDesc; + PxCudaContextManager* mCudaContextManager; +}; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxParticleVolumeBufferHelper* PxCreateParticleVolumeBufferHelper(PxU32 maxVolumes, PxU32 maxTriangles, PxCudaContextManager* cudaContextManager) +{ + PxParticleVolumeBufferHelper* ret = NULL; +#if PX_SUPPORT_GPU_PHYSX + ret = PX_NEW(ParticleVolumeBuffersImpl)(maxVolumes, maxTriangles, cudaContextManager); +#else + PX_UNUSED(maxVolumes); + PX_UNUSED(maxTriangles); + PX_UNUSED(cudaContextManager); +#endif + return ret; +} + +PxParticleClothBufferHelper* PxCreateParticleClothBufferHelper(const PxU32 maxCloths, const PxU32 maxTriangles, const PxU32 maxSprings, const PxU32 maxParticles, PxCudaContextManager* cudaContextManager) +{ + PxParticleClothBufferHelper* ret = NULL; +#if PX_SUPPORT_GPU_PHYSX + ret = PX_NEW(ParticleClothBuffersImpl)(maxCloths, maxTriangles, maxSprings, maxParticles, cudaContextManager); +#else + PX_UNUSED(maxCloths); + PX_UNUSED(maxTriangles); + PX_UNUSED(maxSprings); + PX_UNUSED(maxParticles); + PX_UNUSED(cudaContextManager); +#endif + return ret; +} + +PxParticleRigidBufferHelper* PxCreateParticleRigidBufferHelper(const PxU32 maxRigids, const PxU32 maxParticles, PxCudaContextManager* cudaContextManager) +{ + PxParticleRigidBufferHelper* ret = NULL; +#if PX_SUPPORT_GPU_PHYSX + ret = PX_NEW(ParticleRigidBuffersImpl)(maxRigids, maxParticles, cudaContextManager); +#else + PX_UNUSED(maxRigids); + PX_UNUSED(maxParticles); + PX_UNUSED(cudaContextManager); +#endif + return ret; +} + +} //namespace ExtGpu +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPlatform.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPlatform.h new file mode 100644 index 0000000..2d7d31b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPlatform.h @@ -0,0 +1,36 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PLATFORM_H +#define PLATFORM_H + +#include +#include "foundation/Px.h" +#include "foundation/PxThread.h" + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp new file mode 100644 index 0000000..94db236 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.cpp @@ -0,0 +1,257 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtPrismaticJoint.h" +#include "ExtConstraintHelper.h" + +using namespace physx; +using namespace Ext; + +PrismaticJoint::PrismaticJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + PrismaticJointT(PxJointConcreteType::ePRISMATIC, actor0, localFrame0, actor1, localFrame1, "PrismaticJointData") +{ + PrismaticJointData* data = static_cast(mData); + + data->limit = PxJointLinearLimitPair(scale); + data->projectionLinearTolerance = 1e10f; + data->projectionAngularTolerance = PxPi; + data->jointFlags = PxPrismaticJointFlags(); +} + +void PrismaticJoint::setProjectionAngularTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0 && tolerance <= PxPi, "PxPrismaticJoint::setProjectionAngularTolerance: invalid parameter"); + data().projectionAngularTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, prismaticProjectionAngularTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal PrismaticJoint::getProjectionAngularTolerance() const +{ + return data().projectionAngularTolerance; +} + +void PrismaticJoint::setProjectionLinearTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0, "PxPrismaticJoint::setProjectionLinearTolerance: invalid parameter"); + data().projectionLinearTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, prismaticProjectionLinearTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal PrismaticJoint::getProjectionLinearTolerance() const +{ + return data().projectionLinearTolerance; +} + +PxPrismaticJointFlags PrismaticJoint::getPrismaticJointFlags(void) const +{ + return data().jointFlags; +} + +void PrismaticJoint::setPrismaticJointFlags(PxPrismaticJointFlags flags) +{ + data().jointFlags = flags; markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, prismaticJointFlags, static_cast(*this), flags) +#endif +} + +void PrismaticJoint::setPrismaticJointFlag(PxPrismaticJointFlag::Enum flag, bool value) +{ + if(value) + data().jointFlags |= flag; + else + data().jointFlags &= ~flag; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, prismaticJointFlags, static_cast(*this), getPrismaticJointFlags()) +#endif +} + +PxJointLinearLimitPair PrismaticJoint::getLimit() const +{ + return data().limit; +} + +void PrismaticJoint::setLimit(const PxJointLinearLimitPair& limit) +{ + PX_CHECK_AND_RETURN(limit.isValid(), "PxPrismaticJoint::setLimit: invalid parameter"); + data().limit = limit; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, prismaticLimitLower, j, limit.lower) + OMNI_PVD_SET(joint, prismaticLimitUpper, j, limit.upper) + OMNI_PVD_SET(joint, prismaticLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, prismaticLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, prismaticLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, prismaticLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, prismaticLimitContactDistance, j, limit.contactDistance_deprecated) +#endif +} + +static void PrismaticJointProject(const void* constantBlock, PxTransform& bodyAToWorld, PxTransform& bodyBToWorld, bool projectToA) +{ + const PrismaticJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w, cB2cA, projected; + joint::computeDerived(data, bodyAToWorld, bodyBToWorld, cA2w, cB2w, cB2cA); + + const PxVec3 v(0.0f, cB2cA.p.y, cB2cA.p.z); + bool linearTrunc, angularTrunc; + projected.p = joint::truncateLinear(v, data.projectionLinearTolerance, linearTrunc); + projected.q = joint::truncateAngular(cB2cA.q, PxSin(data.projectionAngularTolerance/2), PxCos(data.projectionAngularTolerance/2), angularTrunc); + + if(linearTrunc || angularTrunc) + { + projected.p.x = cB2cA.p.x; + joint::projectTransforms(bodyAToWorld, bodyBToWorld, cA2w, cB2w, projected, data, projectToA); + } +} + +static void PrismaticJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + const PrismaticJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + viz.visualizeJointFrames(cA2w, cB2w); + + if((flags & PxConstraintVisualizationFlag::eLIMITS) && (data.jointFlags & PxPrismaticJointFlag::eLIMIT_ENABLED)) + { + const PxVec3 bOriginInA = cA2w.transformInv(cB2w.p); + const PxReal ordinate = bOriginInA.x; + + const PxReal pad = data.limit.isSoft() ? 0.0f : data.limit.contactDistance_deprecated; + viz.visualizeLinearLimit(cA2w, cB2w, data.limit.lower, ordinate < data.limit.lower + pad); + viz.visualizeLinearLimit(cA2w, cB2w, data.limit.upper, ordinate > data.limit.upper - pad); + } +} + +//TAG:solverprepshader +static PxU32 PrismaticJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const PrismaticJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + if (cA2w.q.dot(cB2w.q)<0.0f) // minimum dist quat (equiv to flipping cB2bB.q, which we don't use anywhere) + cB2w.q = -cB2w.q; + + const bool limitEnabled = data.jointFlags & PxPrismaticJointFlag::eLIMIT_ENABLED; + const PxJointLinearLimitPair& limit = data.limit; + const bool limitIsLocked = limitEnabled && limit.lower >= limit.upper; + + const PxVec3 bOriginInA = cA2w.transformInv(cB2w.p); + PxVec3 ra, rb; + ch.prepareLockedAxes(cA2w.q, cB2w.q, bOriginInA, limitIsLocked ? 7ul : 6ul, 7ul, ra, rb); + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + if(limitEnabled && !limitIsLocked) + { + const PxVec3 axis = cA2w.q.getBasisVector0(); // PT: TODO: this has already been computed as part of the quat-to-matrix transform within prepareLockedAxes + + const PxReal ordinate = bOriginInA.x; + + ch.linearLimit(axis, ordinate, limit.upper, limit); + ch.linearLimit(-axis, -ordinate, -limit.lower, limit); + } + + return ch.getCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gPrismaticJointShaders = { PrismaticJointSolverPrep, PrismaticJointProject, PrismaticJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep PrismaticJoint::getPrep() const { return gPrismaticJointShaders.solverPrep; } + +PxPrismaticJoint* physx::PxPrismaticJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxPrismaticJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxPrismaticJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxPrismaticJointCreate: at least one actor must be dynamic"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxPrismaticJointCreate: actors must be different"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gPrismaticJointShaders); +} + +// PX_SERIALIZATION +void PrismaticJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gPrismaticJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +void PrismaticJoint::updateOmniPvdProperties() const +{ + const PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, prismaticPosition, j, getPosition()) + OMNI_PVD_SET(joint, prismaticVelocity, j, getVelocity()) +} + +template<> +void physx::Ext::omniPvdInitJoint(PrismaticJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::ePRISMATIC) + OMNI_PVD_SET(joint, prismaticProjectionLinearTolerance, j, joint->getProjectionLinearTolerance()) + OMNI_PVD_SET(joint, prismaticProjectionAngularTolerance, j, joint->getProjectionAngularTolerance()) + + PxJointLinearLimitPair limit = joint->getLimit(); + OMNI_PVD_SET(joint, prismaticLimitLower, j, limit.lower) + OMNI_PVD_SET(joint, prismaticLimitUpper, j, limit.upper) + OMNI_PVD_SET(joint, prismaticLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, prismaticLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, prismaticLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, prismaticLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, prismaticLimitContactDistance, j, limit.contactDistance_deprecated) + + OMNI_PVD_SET(joint, prismaticPosition, j, joint->getPosition()) + OMNI_PVD_SET(joint, prismaticVelocity, j, joint->getVelocity()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.h new file mode 100644 index 0000000..b42c713 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPrismaticJoint.h @@ -0,0 +1,105 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_PRISMATIC_JOINT_H +#define EXT_PRISMATIC_JOINT_H + +#include "common/PxTolerancesScale.h" +#include "extensions/PxPrismaticJoint.h" + +#include "ExtJoint.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxPrismaticJointGeneratedValues; +namespace Ext +{ + struct PrismaticJointData : public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PxJointLinearLimitPair limit; + PxReal projectionLinearTolerance; + PxReal projectionAngularTolerance; + + PxPrismaticJointFlags jointFlags; + + private: + PrismaticJointData(const PxJointLinearLimitPair& pair) : limit(pair) {} + }; + + typedef JointT PrismaticJointT; + + class PrismaticJoint : public PrismaticJointT + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + PrismaticJoint(PxBaseFlags baseFlags) : PrismaticJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static PrismaticJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + PrismaticJoint(const PxTolerancesScale& scale, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxPrismaticJoint + virtual PxReal getPosition() const PX_OVERRIDE { return getRelativeTransform().p.x; } + virtual PxReal getVelocity() const PX_OVERRIDE { return getRelativeLinearVelocity().x; } + virtual void setLimit(const PxJointLinearLimitPair& limit) PX_OVERRIDE; + virtual PxJointLinearLimitPair getLimit() const PX_OVERRIDE; + virtual void setPrismaticJointFlags(PxPrismaticJointFlags flags) PX_OVERRIDE; + virtual void setPrismaticJointFlag(PxPrismaticJointFlag::Enum flag, bool value) PX_OVERRIDE; + virtual PxPrismaticJointFlags getPrismaticJointFlags() const PX_OVERRIDE; + virtual void setProjectionLinearTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionLinearTolerance() const PX_OVERRIDE; + virtual void setProjectionAngularTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionAngularTolerance() const PX_OVERRIDE; + //~PxPrismaticJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; +#if PX_SUPPORT_OMNI_PVD + virtual void updateOmniPvdProperties() const PX_OVERRIDE; +#endif + //~PxConstraintConnector + }; +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp new file mode 100644 index 0000000..aee1c4c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.cpp @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// suppress LNK4221 +#include "foundation/PxPreprocessor.h" +PX_DUMMY_SYMBOL + +#if PX_SUPPORT_PVD +#include "ExtPvd.h" +#include "PxExtensionMetaDataObjects.h" + +#include "ExtD6Joint.h" +#include "ExtFixedJoint.h" +#include "ExtSphericalJoint.h" +#include "ExtDistanceJoint.h" +#include "ExtRevoluteJoint.h" +#include "ExtPrismaticJoint.h" +#include "ExtJointMetaDataExtensions.h" +#include "PvdMetaDataPropertyVisitor.h" +#include "PvdMetaDataDefineProperties.h" + +namespace physx +{ +namespace Ext +{ + using namespace physx::Vd; + + template + inline void visitPvdInstanceProperties( TOperator inOperator ) + { + PxClassInfoTraits().Info.visitInstanceProperties( makePvdPropertyFilter( inOperator ), 0 ); + } + + template + inline void visitPvdProperties( TOperator inOperator ) + { + PvdPropertyFilter theFilter( makePvdPropertyFilter( inOperator ) ); + PxU32 thePropCount = PxClassInfoTraits().Info.visitBaseProperties( theFilter ); + PxClassInfoTraits().Info.visitInstanceProperties( theFilter, thePropCount ); + } + + Pvd::PvdNameSpace::PvdNameSpace(physx::pvdsdk::PvdDataStream& conn, const char* /*name*/) + : mConnection(conn) + { + } + + Pvd::PvdNameSpace::~PvdNameSpace() + { + } + + void Pvd::releasePvdInstance(physx::pvdsdk::PvdDataStream& pvdConnection, const PxConstraint& c, const PxJoint& joint) + { + if(!pvdConnection.isConnected()) + return; + //remove from scene and from any attached actors. + PxRigidActor* actor0, *actor1; + c.getActors( actor0, actor1 ); + PxScene* scene = c.getScene(); + if(scene) pvdConnection.removeObjectRef( scene, "Joints", &joint ); + if ( actor0 && actor0->getScene() ) pvdConnection.removeObjectRef( actor0, "Joints", &joint ); + if ( actor1 && actor1->getScene()) pvdConnection.removeObjectRef( actor1, "Joints", &joint ); + pvdConnection.destroyInstance(&joint); + } + + template + void registerProperties( PvdDataStream& inStream ) + { + inStream.createClass(); + PvdPropertyDefinitionHelper& theHelper( inStream.getPropertyDefinitionHelper() ); + PvdClassInfoDefine theDefinitionObj( theHelper, getPvdNamespacedNameForType() ); + visitPvdInstanceProperties( theDefinitionObj ); + } + + template + void registerPropertiesAndValueStruct( PvdDataStream& inStream ) + { + inStream.createClass(); + inStream.deriveClass(); + PvdPropertyDefinitionHelper& theHelper( inStream.getPropertyDefinitionHelper() ); + { + PvdClassInfoDefine theDefinitionObj( theHelper, getPvdNamespacedNameForType() ); + visitPvdInstanceProperties( theDefinitionObj ); + } + { + PvdClassInfoValueStructDefine theDefinitionObj( theHelper ); + visitPvdProperties( theDefinitionObj ); + theHelper.addPropertyMessage(); + } + } + + void Pvd::sendClassDescriptions(physx::pvdsdk::PvdDataStream& inStream) + { + if (inStream.isClassExist()) + return; + + { //PxJoint + registerProperties( inStream ); + inStream.createProperty( "Parent", "parents" ); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct(inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + registerPropertiesAndValueStruct( inStream); + } + } + + void Pvd::setActors( physx::pvdsdk::PvdDataStream& inStream, const PxJoint& inJoint, const PxConstraint& c, const PxActor* newActor0, const PxActor* newActor1 ) + { + PxRigidActor* actor0, *actor1; + c.getActors( actor0, actor1 ); + if ( actor0 ) + inStream.removeObjectRef( actor0, "Joints", &inJoint ); + if ( actor1 ) + inStream.removeObjectRef( actor1, "Joints", &inJoint ); + + if ( newActor0 && newActor0->getScene()) + inStream.pushBackObjectRef( newActor0, "Joints", &inJoint ); + if ( newActor1 && newActor1->getScene()) + inStream.pushBackObjectRef( newActor1, "Joints", &inJoint ); + + inStream.setPropertyValue( &inJoint, "Actors.actor0", reinterpret_cast(newActor0) ); + inStream.setPropertyValue( &inJoint, "Actors.actor1", reinterpret_cast(newActor1) ); + const void* parent = newActor0 ? newActor0 : newActor1; + inStream.setPropertyValue( &inJoint, "Parent", parent ); + + if((newActor0 && !newActor0->getScene()) || (newActor1 && !newActor1->getScene())) + { + inStream.removeObjectRef( c.getScene(), "Joints", &inJoint ); + } + + } +} + +} + +#endif // PX_SUPPORT_PVD diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.h new file mode 100644 index 0000000..4ee15ce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPvd.h @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_PVD_H +#define EXT_PVD_H + +#if PX_SUPPORT_PVD + +#include "extensions/PxJoint.h" + +#include "foundation/PxUserAllocated.h" +#include "PxPvdDataStream.h" +#include "PvdTypeNames.h" +#include "PxPvdObjectModelBaseTypes.h" + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif +#include "PxExtensionMetaDataObjects.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +namespace physx +{ + +class PxJoint; +class PxD6Joint; +class PxDistanceJoint; +class PxFixedJoint; +class PxPrismaticJoint; +class PxRevoluteJoint; +class PxSphericalJoint; +class PxContactJoint; +class PxGearJoint; +class PxRackAndPinionJoint; +} + +#define JOINT_GROUP 3 +namespace physx +{ +namespace pvdsdk { + #define DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP( type ) DEFINE_PVD_TYPE_NAME_MAP( physx::type, "physx3", #type ) + + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFixedJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxFixedJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxDistanceJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxDistanceJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxContactJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxContactJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPrismaticJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxPrismaticJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRevoluteJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRevoluteJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSphericalJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxSphericalJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxD6Joint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxD6JointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxGearJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxGearJointGeneratedValues) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRackAndPinionJoint) + DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP(PxRackAndPinionJointGeneratedValues) +#undef DEFINE_NATIVE_PVD_PHYSX3_TYPE_MAP +} //pvdsdk +} // physx + +namespace physx +{ +namespace Ext +{ + using namespace physx::pvdsdk; + + class Pvd: public physx::PxUserAllocated + { + Pvd& operator=(const Pvd&); + public: + class PvdNameSpace + { + + public: + PvdNameSpace(PvdDataStream& conn, const char* name); + ~PvdNameSpace(); + private: + PvdNameSpace& operator=(const PvdNameSpace&); + PvdDataStream& mConnection; + }; + + static void setActors( PvdDataStream& PvdDataStream, + const PxJoint& inJoint, const PxConstraint& c, const PxActor* newActor0, const PxActor* newActor1 ); + + template + static void createInstance( PvdDataStream& inStream, const PxConstraint& c, const TObjType& inSource ) + { + inStream.createInstance( &inSource ); + inStream.pushBackObjectRef( c.getScene(), "Joints", &inSource ); + + class ConstraintUpdateCmd : public PvdDataStream::PvdCommand + { + ConstraintUpdateCmd &operator=(const ConstraintUpdateCmd&) { PX_ASSERT(0); return *this; } //PX_NOCOPY doesn't work for local classes + public: + + const PxConstraint& mConstraint; + const PxJoint& mJoint; + + PxRigidActor* actor0, *actor1; + ConstraintUpdateCmd(const PxConstraint& constraint, const PxJoint& joint):PvdDataStream::PvdCommand(), mConstraint(constraint), mJoint(joint) + { + mConstraint.getActors( actor0, actor1 ); + } + + //Assigned is needed for copying + ConstraintUpdateCmd(const ConstraintUpdateCmd& cmd) + :PvdDataStream::PvdCommand(), mConstraint(cmd.mConstraint), mJoint(cmd.mJoint) + { + } + + virtual bool canRun(PvdInstanceDataStream &inStream_ ) + { + PX_ASSERT(inStream_.isInstanceValid(&mJoint)); + //When run this command, the constraint maybe buffer removed + return ((actor0 == NULL) || inStream_.isInstanceValid(actor0)) + && ((actor1 == NULL) || inStream_.isInstanceValid(actor1)); + } + virtual void run( PvdInstanceDataStream &inStream_ ) + { + //When run this command, the constraint maybe buffer removed + if(!inStream_.isInstanceValid(&mJoint)) + return; + + PxRigidActor* actor0_, *actor1_; + mConstraint.getActors( actor0_, actor1_ ); + + if ( actor0_ && (inStream_.isInstanceValid(actor0_)) ) + inStream_.pushBackObjectRef( actor0_, "Joints", &mJoint ); + if ( actor1_ && (inStream_.isInstanceValid(actor1_)) ) + inStream_.pushBackObjectRef( actor1_, "Joints", &mJoint ); + const void* parent = actor0_ ? actor0_ : actor1_; + inStream_.setPropertyValue( &mJoint, "Parent", parent ); + } + }; + + ConstraintUpdateCmd* cmd = PX_PLACEMENT_NEW(inStream.allocateMemForCmd(sizeof(ConstraintUpdateCmd)), + ConstraintUpdateCmd)(c, inSource); + + if(cmd->canRun( inStream )) + cmd->run( inStream ); + else + inStream.pushPvdCommand( *cmd ); + } + + template + static void updatePvdProperties(PvdDataStream& pvdConnection, const jointtype& joint) + { + structValue theValueStruct( &joint ); + pvdConnection.setPropertyMessage( &joint, theValueStruct ); + } + + template + static void simUpdate(PvdDataStream& /*pvdConnection*/, const jointtype& /*joint*/) {} + + template + static void createPvdInstance(PvdDataStream& pvdConnection, const PxConstraint& c, const jointtype& joint) + { + createInstance( pvdConnection, c, joint ); + } + + static void releasePvdInstance(PvdDataStream& pvdConnection, const PxConstraint& c, const PxJoint& joint); + static void sendClassDescriptions(PvdDataStream& pvdConnection); + }; +} // ext + +} // physx + +#endif // PX_SUPPORT_PVD +#endif // EXT_PVD_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp new file mode 100644 index 0000000..2be6554 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtPxStringTable.cpp @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxString.h" +#include "foundation/PxUserAllocated.h" +#include "extensions/PxStringTableExt.h" +#include "PxProfileAllocatorWrapper.h" //tools for using a custom allocator + +namespace physx +{ + using namespace physx::profile; + + class PxStringTableImpl : public PxStringTable, public PxUserAllocated + { + typedef PxProfileHashMap THashMapType; + PxProfileAllocatorWrapper mWrapper; + THashMapType mHashMap; + public: + + PxStringTableImpl( PxAllocatorCallback& inAllocator ) + : mWrapper ( inAllocator ) + , mHashMap ( mWrapper ) + { + } + + virtual ~PxStringTableImpl() + { + for ( THashMapType::Iterator iter = mHashMap.getIterator(); + iter.done() == false; + ++iter ) + PX_PROFILE_DELETE( mWrapper, const_cast( iter->first ) ); + mHashMap.clear(); + } + + + virtual const char* allocateStr( const char* inSrc ) + { + if ( inSrc == NULL ) + inSrc = ""; + const THashMapType::Entry* existing( mHashMap.find( inSrc ) ); + if ( existing == NULL ) + { + size_t len( strlen( inSrc ) ); + len += 1; + char* newMem = reinterpret_cast(mWrapper.getAllocator().allocate( len, "PxStringTableImpl: const char*", __FILE__, __LINE__ )); + physx::Pxstrlcpy( newMem, len, inSrc ); + mHashMap.insert( newMem, 1 ); + return newMem; + } + else + { + ++const_cast(existing)->second; + return existing->first; + } + } + + /** + * Release the string table and all the strings associated with it. + */ + virtual void release() + { + PX_PROFILE_DELETE( mWrapper.getAllocator(), this ); + } + }; + + PxStringTable& PxStringTableExt::createStringTable( PxAllocatorCallback& inAllocator ) + { + return *PX_PROFILE_NEW( inAllocator, PxStringTableImpl )( inAllocator ); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp new file mode 100644 index 0000000..20b4629 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.cpp @@ -0,0 +1,404 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtRackAndPinionJoint.h" +#include "ExtConstraintHelper.h" +#include "extensions/PxRevoluteJoint.h" +#include "extensions/PxPrismaticJoint.h" +#include "PxArticulationJointReducedCoordinate.h" +//#include + +using namespace physx; +using namespace Ext; + +RackAndPinionJoint::RackAndPinionJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + RackAndPinionJointT(PxJointConcreteType::eRACK_AND_PINION, actor0, localFrame0, actor1, localFrame1, "RackAndPinionJointData") +{ + RackAndPinionJointData* data = static_cast(mData); + data->hingeJoint = NULL; + data->prismaticJoint = NULL; + data->ratio = 1.0f; + data->px = 0.0f; + data->vangle = 0.0f; + + resetError(); +} + +void RackAndPinionJoint::setRatio(float ratio) +{ + RackAndPinionJointData* data = reinterpret_cast(mData); + data->ratio = ratio; + resetError(); + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, rackAndPinionRatio, static_cast(*this), ratio) +#endif +} + +float RackAndPinionJoint::getRatio() const +{ + RackAndPinionJointData* data = reinterpret_cast(mData); + return data->ratio; +} + +bool RackAndPinionJoint::setData(PxU32 nbRackTeeth, PxU32 nbPinionTeeth, float rackLength) +{ + if(!nbRackTeeth) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setData: nbRackTeeth cannot be zero."); + return false; + } + + if(!nbPinionTeeth) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setData: nbPinionTeeth cannot be zero."); + return false; + } + + if(rackLength<=0.0f) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setData: rackLength must be positive."); + return false; + } + + RackAndPinionJointData* data = reinterpret_cast(mData); + data->ratio = (PxTwoPi*nbRackTeeth)/(rackLength*nbPinionTeeth); + resetError(); + markDirty(); + return true; +} + +bool RackAndPinionJoint::setJoints(const PxBase* hinge, const PxBase* prismatic) +{ + RackAndPinionJointData* data = static_cast(mData); + + if(!hinge || !prismatic) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setJoints: cannot pass null pointers to this function."); + return false; + } + + const PxType type0 = hinge->getConcreteType(); + if(type0 == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* joint0 = static_cast(hinge); + const PxArticulationJointType::Enum artiJointType0 = joint0->getJointType(); + if(artiJointType0 != PxArticulationJointType::eREVOLUTE && artiJointType0 != PxArticulationJointType::eREVOLUTE_UNWRAPPED) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setJoints: passed joint must be a revolute joint."); + return false; + } + } + else + { + if(type0 != PxJointConcreteType::eREVOLUTE && type0 != PxJointConcreteType::eD6) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setJoints: passed hinge joint must be either a revolute joint or a D6 joint."); + return false; + } + } + + const PxType type1 = prismatic->getConcreteType(); + if(type1 == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* joint1 = static_cast(prismatic); + const PxArticulationJointType::Enum artiJointType1 = joint1->getJointType(); + if(artiJointType1 != PxArticulationJointType::ePRISMATIC) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxGearJoint::setJoints: passed joint must be a prismatic joint."); + return false; + } + } + else + { + if(type1 != PxJointConcreteType::ePRISMATIC && type1 != PxJointConcreteType::eD6) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxRackAndPinionJoint::setJoints: passed prismatic joint must be either a prismatic joint or a D6 joint."); + return false; + } + } + + data->hingeJoint = hinge; + data->prismaticJoint = prismatic; + resetError(); + markDirty(); + +#if PX_SUPPORT_OMNI_PVD + const PxBase* joints[] ={ hinge, prismatic }; + PxU32 jointsLength = sizeof(joints); + OMNI_PVD_SETB(joint, rackAndPinionJoints, static_cast(*this), joints, jointsLength) +#endif + + return true; +} + +static float angleDiff(float angle0, float angle1) +{ + const float diff = fmodf( angle1 - angle0 + PxPi, PxTwoPi) - PxPi; + return diff < -PxPi ? diff + PxTwoPi : diff; +} + +void RackAndPinionJoint::updateError() +{ + RackAndPinionJointData* data = static_cast(mData); + + if(!data->hingeJoint || !data->prismaticJoint) + return; + + PxRigidActor* rackActor0; + PxRigidActor* rackActor1; + getActors(rackActor0, rackActor1); + + float Angle0 = 0.0f; + float Sign0 = 0.0f; + { + PxRigidActor* hingeActor0; + PxRigidActor* hingeActor1; + + const PxType type = data->hingeJoint->getConcreteType(); + if(type == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* artiHingeJoint = static_cast(data->hingeJoint); + + hingeActor0 = &artiHingeJoint->getParentArticulationLink(); + hingeActor1 = &artiHingeJoint->getChildArticulationLink(); + + Angle0 = artiHingeJoint->getJointPosition(PxArticulationAxis::eTWIST); + } + else + { + const PxJoint* hingeJoint = static_cast(data->hingeJoint); + + hingeJoint->getActors(hingeActor0, hingeActor1); + + if(type == PxJointConcreteType::eREVOLUTE) + Angle0 = static_cast(hingeJoint)->getAngle(); + else if (type == PxJointConcreteType::eD6) + Angle0 = static_cast(hingeJoint)->getTwistAngle(); + } + + if(rackActor0 == hingeActor0 || rackActor1 == hingeActor0) + Sign0 = -1.0f; + else if (rackActor0 == hingeActor1 || rackActor1 == hingeActor1) + Sign0 = 1.0f; + else + PX_ASSERT(0); + } + + if(!mInitDone) + { + mInitDone = true; + mPersistentAngle0 = Angle0; + } + + const float travelThisFrame0 = angleDiff(Angle0, mPersistentAngle0); + mVirtualAngle0 += travelThisFrame0; +// printf("mVirtualAngle0: %f\n", mVirtualAngle0); + + mPersistentAngle0 = Angle0; + + float px = 0.0f; + float Sign1 = 0.0f; + { + PxRigidActor* prismaticActor0; + PxRigidActor* prismaticActor1; + + const PxType type = data->prismaticJoint->getConcreteType(); + if(type == PxConcreteType::eARTICULATION_JOINT_REDUCED_COORDINATE) + { + const PxArticulationJointReducedCoordinate* artiPrismaticJoint = static_cast(data->prismaticJoint); + + prismaticActor0 = &artiPrismaticJoint->getParentArticulationLink(); + prismaticActor1 = &artiPrismaticJoint->getChildArticulationLink(); + + px = artiPrismaticJoint->getJointPosition(PxArticulationAxis::eX); + } + else + { + const PxJoint* prismaticJoint = static_cast(data->prismaticJoint); + + prismaticJoint->getActors(prismaticActor0, prismaticActor1); + + if(type==PxJointConcreteType::ePRISMATIC) + px = static_cast(prismaticJoint)->getPosition(); + else if(type==PxJointConcreteType::eD6) + px = prismaticJoint->getRelativeTransform().p.x; + } + + if(rackActor0 == prismaticActor0 || rackActor1 == prismaticActor0) + Sign1 = -1.0f; + else if(rackActor0 == prismaticActor1 || rackActor1 == prismaticActor1) + Sign1 = 1.0f; + else + PX_ASSERT(0); + } + +// printf("px: %f\n", px); + data->px = Sign1*px; + data->vangle = Sign0*mVirtualAngle0; + markDirty(); +} + +void RackAndPinionJoint::resetError() +{ + mVirtualAngle0 = 0.0f; + mPersistentAngle0 = 0.0f; + mInitDone = false; +} + +static void RackAndPinionJointProject(const void* /*constantBlock*/, PxTransform& /*bodyAToWorld*/, PxTransform& /*bodyBToWorld*/, bool /*projectToA*/) +{ +// const RackAndPinionJointData& data = *reinterpret_cast(constantBlock); +} + +static void RackAndPinionJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + { + const RackAndPinionJointData& data = *reinterpret_cast(constantBlock); + + // Visualize joint frames + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + viz.visualizeJointFrames(cA2w, cB2w); + } + + if(0) + { + const RackAndPinionJointData& data = *reinterpret_cast(constantBlock); + + if(0) + { + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + + const PxVec3 gearAxis0 = cA2w.q.getBasisVector0(); + const PxVec3 rackPrismaticAxis = cB2w.q.getBasisVector0(); + viz.visualizeLine(cA2w.p, cA2w.p + gearAxis0, 0xff0000ff); + viz.visualizeLine(cB2w.p, cB2w.p + rackPrismaticAxis, 0xff0000ff); + } + } +} + +//TAG:solverprepshader +static PxU32 RackAndPinionJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const RackAndPinionJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + cA2wOut = cB2w.p; + cB2wOut = cB2w.p; + + const PxVec3 gearAxis = cA2w.q.getBasisVector0(); + const PxVec3 rackPrismaticAxis = cB2w.q.getBasisVector0(); + + // PT: this optional bit of code tries to fix the ratio for cases where the "same" rack is moved e.g. above or below a gear. + // In that case the rack would move in one direction or another depending on its position compared to the gear, and to avoid + // having to use a negative ratio in one of these cases this code tries to compute the proper sign and handle both cases the + // same way from the user's perspective. This created unexpected issues in ill-defined cases where e.g. the gear and the rack + // completely overlap, and we end up with a +0 or -0 for "dp" in the code below. So now this code disables itself in these + // cases but it would probably be better to disable it entirely. We don't do it though since it could break existing scenes. + // We might want to revisit these decisions at some point. + float Coeff = 1.0f; + const float epsilon = 0.001f; + const PxVec3 delta = cB2w.p - cA2w.p; + if(delta.magnitudeSquared()>epsilon*epsilon) + { + const PxVec3 velocity = gearAxis.cross(delta); + if(velocity.magnitudeSquared()>epsilon*epsilon) + { + const float dp = velocity.dot(rackPrismaticAxis); + Coeff = fabsf(dp)>epsilon ? PxSign(dp) : 1.0f; + } + } + + Px1DConstraint& con = constraints[0]; + con.linear0 = PxVec3(0.0f); + con.linear1 = rackPrismaticAxis * data.ratio*Coeff; + con.angular0 = gearAxis; + con.angular1 = PxVec3(0.0f); + con.geometricError = -Coeff*data.px*data.ratio - data.vangle; + con.minImpulse = -PX_MAX_F32; + con.maxImpulse = PX_MAX_F32; + con.velocityTarget = 0.f; + con.forInternalUse = 0.f; + con.solveHint = 0; + con.flags = Px1DConstraintFlag::eOUTPUT_FORCE|Px1DConstraintFlag::eANGULAR_CONSTRAINT; + con.mods.bounce.restitution = 0.0f; + con.mods.bounce.velocityThreshold = 0.0f; + return 1; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gRackAndPinionJointShaders = { RackAndPinionJointSolverPrep, RackAndPinionJointProject, RackAndPinionJointVisualize, PxConstraintFlag::eALWAYS_UPDATE }; + +PxConstraintSolverPrep RackAndPinionJoint::getPrep() const { return gRackAndPinionJointShaders.solverPrep; } + +PxRackAndPinionJoint* physx::PxRackAndPinionJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxRackAndPinionJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxRackAndPinionJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxRackAndPinionJointCreate: at least one actor must be dynamic"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxRackAndPinionJointCreate: actors must be different"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gRackAndPinionJointShaders); +} + +// PX_SERIALIZATION +void RackAndPinionJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gRackAndPinionJointShaders); + + RackAndPinionJointData* data = static_cast(mData); + context.translatePxBase(data->hingeJoint); + context.translatePxBase(data->prismaticJoint); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +template<> +void physx::Ext::omniPvdInitJoint(RackAndPinionJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eRACK_AND_PINION) + OMNI_PVD_SET(joint, rackAndPinionRatio, j, joint->getRatio()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.h new file mode 100644 index 0000000..89e498a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRackAndPinionJoint.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_RACK_AND_PINION_JOINT_H +#define EXT_RACK_AND_PINION_JOINT_H + +#include "extensions/PxRackAndPinionJoint.h" +#include "ExtJoint.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxRackAndPinionJointGeneratedValues; +namespace Ext +{ + struct RackAndPinionJointData : public JointData + { + const PxBase* hingeJoint; + const PxBase* prismaticJoint; + float ratio; + float px; + float vangle; + }; + + typedef JointT RackAndPinionJointT; + + class RackAndPinionJoint : public RackAndPinionJointT + { + public: +// PX_SERIALIZATION + RackAndPinionJoint(PxBaseFlags baseFlags) : RackAndPinionJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static RackAndPinionJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + RackAndPinionJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxRackAndPinionJoint + virtual bool setJoints(const PxBase* hinge, const PxBase* prismatic) PX_OVERRIDE; + virtual void setRatio(float ratio) PX_OVERRIDE; + virtual float getRatio() const PX_OVERRIDE; + virtual bool setData(PxU32 nbRackTeeth, PxU32 nbPinionTeeth, float rackLength) PX_OVERRIDE; + //~PxRackAndPinionJoint + + // PxConstraintConnector + virtual void* prepareData() PX_OVERRIDE + { + updateError(); + return mData; + } + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; + //~PxConstraintConnector + + private: + float mVirtualAngle0; + float mPersistentAngle0; + bool mInitDone; + + void updateError(); + void resetError(); + }; +} // namespace Ext + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp new file mode 100644 index 0000000..d2b47ff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRaycastCCD.cpp @@ -0,0 +1,324 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "extensions/PxShapeExt.h" +#include "extensions/PxRaycastCCD.h" +#include "PxScene.h" +#include "PxRigidDynamic.h" + +#include "foundation/PxArray.h" + +using namespace physx; + +namespace physx +{ +class RaycastCCDManagerInternal +{ + PX_NOCOPY(RaycastCCDManagerInternal) + public: + RaycastCCDManagerInternal(PxScene* scene) : mScene(scene) {} + ~RaycastCCDManagerInternal(){} + + bool registerRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + bool unregisterRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape); + + void doRaycastCCD(bool doDynamicDynamicCCD); + + struct CCDObject + { + PX_FORCE_INLINE CCDObject(PxRigidDynamic* actor, PxShape* shape, const PxVec3& witness) : mActor(actor), mShape(shape), mWitness(witness) {} + PxRigidDynamic* mActor; + PxShape* mShape; + PxVec3 mWitness; + }; + + private: + PxScene* mScene; + physx::PxArray mObjects; +}; +} + +static PxVec3 getShapeCenter(PxShape* shape, const PxTransform& pose) +{ + PxVec3 offset(0.0f); + if(shape->getGeometryType()==PxGeometryType::eCONVEXMESH) + { + PxConvexMeshGeometry geometry; + bool status = shape->getConvexMeshGeometry(geometry); + PX_UNUSED(status); + PX_ASSERT(status); + + PxReal mass; + PxMat33 localInertia; + PxVec3 localCenterOfMass; + geometry.convexMesh->getMassInformation(mass, localInertia, localCenterOfMass); + + offset += localCenterOfMass; + } + return pose.transform(offset); +} + +static PX_FORCE_INLINE PxVec3 getShapeCenter(PxRigidActor* actor, PxShape* shape) +{ + const PxTransform pose = PxShapeExt::getGlobalPose(*shape, *actor); + return getShapeCenter(shape, pose); +} + +static PxReal computeInternalRadius(PxRigidActor* actor, PxShape* shape, const PxVec3& dir) +{ + const PxBounds3 bounds = PxShapeExt::getWorldBounds(*shape, *actor); + const PxReal diagonal = (bounds.maximum - bounds.minimum).magnitude(); + const PxReal offsetFromOrigin = diagonal * 2.0f; + + PxTransform pose = PxShapeExt::getGlobalPose(*shape, *actor); + + PxReal internalRadius = 0.0f; + const PxReal length = offsetFromOrigin*2.0f; + + switch(shape->getGeometryType()) + { + case PxGeometryType::eSPHERE: + { + PxSphereGeometry geometry; + bool status = shape->getSphereGeometry(geometry); + PX_UNUSED(status); + PX_ASSERT(status); + + internalRadius = geometry.radius; + } + break; + + case PxGeometryType::eBOX: + case PxGeometryType::eCAPSULE: + { + pose.p = PxVec3(0.0f); + const PxVec3 virtualOrigin = pose.p + dir * offsetFromOrigin; + + PxRaycastHit hit; + PxU32 nbHits = PxGeometryQuery::raycast(virtualOrigin, -dir, shape->getGeometry(), pose, length, PxHitFlags(0), 1, &hit); + PX_UNUSED(nbHits); + PX_ASSERT(nbHits); + + internalRadius = offsetFromOrigin - hit.distance; + } + break; + + case PxGeometryType::eCONVEXMESH: + { + PxVec3 shapeCenter = getShapeCenter(shape, pose); + shapeCenter -= pose.p; + pose.p = PxVec3(0.0f); + + const PxVec3 virtualOrigin = shapeCenter + dir * offsetFromOrigin; + PxRaycastHit hit; + PxU32 nbHits = PxGeometryQuery::raycast(virtualOrigin, -dir, shape->getGeometry(), pose, length, PxHitFlags(0), 1, &hit); + PX_UNUSED(nbHits); + PX_ASSERT(nbHits); + + internalRadius = offsetFromOrigin - hit.distance; + } + break; + + default: + break; + } + return internalRadius; +} + +class CCDRaycastFilterCallback : public PxQueryFilterCallback +{ +public: + CCDRaycastFilterCallback(PxRigidActor* actor, PxShape* shape) : mActor(actor), mShape(shape){} + + PxRigidActor* mActor; + PxShape* mShape; + + virtual PxQueryHitType::Enum preFilter(const PxFilterData&, const PxShape* shape, const PxRigidActor* actor, PxHitFlags&) + { + if(mActor==actor && mShape==shape) + return PxQueryHitType::eNONE; + return PxQueryHitType::eBLOCK; + } + + virtual PxQueryHitType::Enum postFilter(const PxFilterData&, const PxQueryHit&, const PxShape*, const PxRigidActor*) + { + return PxQueryHitType::eNONE; + } +}; + +static bool CCDRaycast(PxScene* scene, PxRigidActor* actor, PxShape* shape, const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, PxRaycastHit& hit, bool dyna_dyna) +{ + const PxQueryFlags qf(dyna_dyna ? PxQueryFlags(PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER) : PxQueryFlags(PxQueryFlag::eSTATIC)); + const PxQueryFilterData filterData(PxFilterData(), qf); + + CCDRaycastFilterCallback CB(actor, shape); + + PxRaycastBuffer buf1; + scene->raycast(origin, unitDir, distance, buf1, PxHitFlags(0), filterData, &CB); + hit = buf1.block; + return buf1.hasBlock; +} + +static PxRigidDynamic* canDoCCD(PxRigidActor& actor, PxShape* /*shape*/) +{ + if(actor.getConcreteType()!=PxConcreteType::eRIGID_DYNAMIC) + return NULL; // PT: no need to do it for statics + PxRigidDynamic* dyna = static_cast(&actor); + + const PxU32 nbShapes = dyna->getNbShapes(); + if(nbShapes!=1) + return NULL; // PT: only works with simple actors for now + + if(dyna->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC) + return NULL; // PT: no need to do it for kinematics + + return dyna; +} + +static bool doRaycastCCD(PxScene* scene, const RaycastCCDManagerInternal::CCDObject& object, PxTransform& newPose, PxVec3& newShapeCenter, bool dyna_dyna) +{ + PxRigidDynamic* dyna = canDoCCD(*object.mActor, object.mShape); + if(!dyna) + return true; + + bool updateCCDWitness = true; + + const PxVec3 offset = newPose.p - newShapeCenter; + const PxVec3& origin = object.mWitness; + const PxVec3& dest = newShapeCenter; + + PxVec3 dir = dest - origin; + const PxReal length = dir.magnitude(); + if(length!=0.0f) + { + dir /= length; + + const PxReal internalRadius = computeInternalRadius(object.mActor, object.mShape, dir); + + PxRaycastHit hit; + if(internalRadius!=0.0f && CCDRaycast(scene, object.mActor, object.mShape, origin, dir, length, hit, dyna_dyna)) + { + updateCCDWitness = false; + + const PxReal radiusLimit = internalRadius * 0.75f; + if(hit.distance>radiusLimit) + { + newShapeCenter = origin + dir * (hit.distance - radiusLimit); + } + else + { + if(hit.actor->getConcreteType()==PxConcreteType::eRIGID_DYNAMIC) + return true; + + newShapeCenter = origin; + } + + newPose.p = offset + newShapeCenter; + const PxTransform shapeLocalPose = object.mShape->getLocalPose(); + const PxTransform inverseShapeLocalPose = shapeLocalPose.getInverse(); + const PxTransform newGlobalPose = newPose * inverseShapeLocalPose; + dyna->setGlobalPose(newGlobalPose); + } + } + return updateCCDWitness; +} + +bool RaycastCCDManagerInternal::registerRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape) +{ + if(!actor || !shape) + return false; + + mObjects.pushBack(CCDObject(actor, shape, getShapeCenter(actor, shape))); + return true; +} + +bool RaycastCCDManagerInternal::unregisterRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape) +{ + if(!actor || !shape) + return false; + + const PxU32 nbObjects = mObjects.size(); + for(PxU32 i=0;iisSleeping()) + continue; + + PxTransform newPose = PxShapeExt::getGlobalPose(*object.mShape, *object.mActor); + PxVec3 newShapeCenter = getShapeCenter(object.mShape, newPose); + + if(::doRaycastCCD(mScene, object, newPose, newShapeCenter, doDynamicDynamicCCD)) + object.mWitness = newShapeCenter; + } +} + +RaycastCCDManager::RaycastCCDManager(PxScene* scene) +{ + mImpl = new RaycastCCDManagerInternal(scene); +} + +RaycastCCDManager::~RaycastCCDManager() +{ + delete mImpl; +} + +bool RaycastCCDManager::registerRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape) +{ + return mImpl->registerRaycastCCDObject(actor, shape); +} + +bool RaycastCCDManager::unregisterRaycastCCDObject(PxRigidDynamic* actor, PxShape* shape) +{ + return mImpl->unregisterRaycastCCDObject(actor, shape); +} + +void RaycastCCDManager::doRaycastCCD(bool doDynamicDynamicCCD) +{ + mImpl->doRaycastCCD(doDynamicDynamicCCD); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp new file mode 100644 index 0000000..3c20eab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRemeshingExt.cpp @@ -0,0 +1,201 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxRemeshingExt.h" +#include "foundation/PxHashMap.h" + +namespace physx +{ + void assignTriangle(PxArray& triangles, PxU32 triIndex, PxU32 a, PxU32 b, PxU32 c) + { + triangles[3 * triIndex] = a; + triangles[3 * triIndex + 1] = b; + triangles[3 * triIndex + 2] = c; + } + + void addTriangle(PxArray& triangles, PxU32 a, PxU32 b, PxU32 c) + { + triangles.pushBack(a); + triangles.pushBack(b); + triangles.pushBack(c); + } + + void subdivideTriangle(int i, int ab, int bc, int ac, PxArray& triangles, PxArray& points) + { + PxU32 tri[3] = { triangles[3 * i],triangles[3 * i + 1],triangles[3 * i + 2] }; + if (ab >= 0 && bc >= 0 && ac >= 0) + { + addTriangle(triangles, tri[0], ab, ac); + addTriangle(triangles, tri[1], bc, ab); + addTriangle(triangles, tri[2], ac, bc); + assignTriangle(triangles, i, ab, bc, ac); + } + else if (ac >= 0 && ab >= 0) + { + float dB = (points[ac] - points[tri[1]]).magnitudeSquared(); + float dC = (points[ab] - points[tri[2]]).magnitudeSquared(); + if (dB < dC) + { + addTriangle(triangles, tri[1], tri[2], ac); + addTriangle(triangles, tri[1], ac, ab); + } + else + { + addTriangle(triangles, tri[1], tri[2], ab); + addTriangle(triangles, tri[2], ac, ab); + } + assignTriangle(triangles, i, tri[0], ab, ac); + } + else if (ab >= 0 && bc >= 0) + { + float dA = (points[bc] - points[tri[0]]).magnitudeSquared(); + float dC = (points[ab] - points[tri[2]]).magnitudeSquared(); + if (dC < dA) + { + addTriangle(triangles, tri[2], tri[0], ab); + addTriangle(triangles, tri[2], ab, bc); + } + else + { + addTriangle(triangles, tri[2], tri[0], bc); + addTriangle(triangles, tri[0], ab, bc); + } + assignTriangle(triangles, i, tri[1], bc, ab); + } + else if (bc >= 0 && ac >= 0) + { + float dA = (points[bc] - points[tri[0]]).magnitudeSquared(); + float dB = (points[ac] - points[tri[1]]).magnitudeSquared(); + if (dA < dB) + { + addTriangle(triangles, tri[0], tri[1], bc); + addTriangle(triangles, tri[0], bc, ac); + } + else + { + addTriangle(triangles, tri[0], tri[1], ac); + addTriangle(triangles, tri[1], bc, ac); + } + assignTriangle(triangles, i, tri[2], ac, bc); + } + else if (ab >= 0) + { + addTriangle(triangles, tri[1], tri[2], ab); + assignTriangle(triangles, i, tri[2], tri[0], ab); + } + else if (bc >= 0) + { + addTriangle(triangles, tri[2], tri[0], bc); + assignTriangle(triangles, i, tri[0], tri[1], bc); + } + else if (ac >= 0) + { + addTriangle(triangles, tri[1], tri[2], ac); + assignTriangle(triangles, i, tri[0], tri[1], ac); + } + } + + PX_FORCE_INLINE PxU64 key(PxU32 a, PxU32 b) + { + if (a < b) + return ((PxU64(a)) << 32) | (PxU64(b)); + else + return ((PxU64(b)) << 32) | (PxU64(a)); + } + + void checkEdge(PxU32 a, PxU32 b, PxHashMap& edges, PxArray& points, PxReal maxEdgeLength) + { + if ((points[a] - points[b]).magnitudeSquared() < maxEdgeLength * maxEdgeLength) + return; + + PxU64 k = key(a, b); + if (edges.find(k)) + return; + + edges.insert(k, points.size()); + points.pushBack(0.5f * (points[a] + points[b])); + } + + PX_FORCE_INLINE PxI32 getEdge(PxU32 a, PxU32 b, PxHashMap& edges) + { + if (const PxPair* ptr = edges.find(key(a, b))) + return ptr->second; + return -1; + } + + bool PxRemeshingExt::limitMaxEdgeLength(PxArray& triangles, PxArray& points, PxReal maxEdgeLength, PxU32 maxIterations, PxArray* triangleMap, PxU32 triangleCountThreshold) + { + if (triangleMap) + { + triangleMap->clear(); + triangleMap->reserve(triangles.size() / 3); + for (PxU32 i = 0; i < triangles.size() / 3; ++i) + triangleMap->pushBack(i); + } + + PxU32 numIndices = triangles.size(); + PxHashMap edges; + bool success = true; + for (PxU32 k = 0; k < maxIterations && success; ++k) + { + success = false; + edges.clear(); + + //Analyze edges + for (PxU32 i = 0; i < triangles.size(); i += 3) + { + checkEdge(triangles[i], triangles[i + 1], edges, points, maxEdgeLength); + checkEdge(triangles[i + 1], triangles[i + 2], edges, points, maxEdgeLength); + checkEdge(triangles[i], triangles[i + 2], edges, points, maxEdgeLength); + } + + //Subdivide triangles if required + PxU32 size = triangles.size(); + for (PxU32 i = 0; i < size; i += 3) + { + PxI32 ab = getEdge(triangles[i], triangles[i + 1], edges); + PxI32 bc = getEdge(triangles[i + 1], triangles[i + 2], edges); + PxI32 ac = getEdge(triangles[i], triangles[i + 2], edges); + if (ab >= 0 || bc >= 0 || ac >= 0) + { + PxU32 s = triangles.size(); + subdivideTriangle(i / 3, ab, bc, ac, triangles, points); + success = true; + if (triangleMap) + { + for (PxU32 j = s / 3; j < triangles.size() / 3; ++j) + triangleMap->pushBack((*triangleMap)[i / 3]); + } + } + } + if (triangles.size() >= triangleCountThreshold) + break; + } + return numIndices != triangles.size(); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp new file mode 100644 index 0000000..30a53c4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.cpp @@ -0,0 +1,381 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtRevoluteJoint.h" +#include "ExtConstraintHelper.h" + +using namespace physx; +using namespace Ext; + +RevoluteJoint::RevoluteJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + RevoluteJointT(PxJointConcreteType::eREVOLUTE, actor0, localFrame0, actor1, localFrame1, "RevoluteJointData") +{ + RevoluteJointData* data = static_cast(mData); + + data->projectionLinearTolerance = 1e10f; + data->projectionAngularTolerance = PxPi; + data->driveForceLimit = PX_MAX_F32; + data->driveVelocity = 0.0f; + data->driveGearRatio = 1.0f; + data->limit = PxJointAngularLimitPair(-PxPi/2, PxPi/2); + data->jointFlags = PxRevoluteJointFlags(); +} + +PxReal RevoluteJoint::getAngle() const +{ + return getTwistAngle_Internal(); +} + +PxReal RevoluteJoint::getVelocity() const +{ + return getRelativeAngularVelocity().magnitude(); +} + +PxJointAngularLimitPair RevoluteJoint::getLimit() const +{ + return data().limit; +} + +void RevoluteJoint::setLimit(const PxJointAngularLimitPair& limit) +{ + PX_CHECK_AND_RETURN(limit.isValid(), "PxRevoluteJoint::setLimit: limit invalid"); + PX_CHECK_AND_RETURN(limit.lower>-PxTwoPi && limit.upper(*this); + OMNI_PVD_SET(joint, revoluteLimitLower, j, limit.lower) + OMNI_PVD_SET(joint, revoluteLimitUpper, j, limit.upper) + OMNI_PVD_SET(joint, revoluteLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, revoluteLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, revoluteLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, revoluteLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, revoluteLimitContactDistance, j, limit.contactDistance_deprecated) +#endif +} + +PxReal RevoluteJoint::getDriveVelocity() const +{ + return data().driveVelocity; +} + +void RevoluteJoint::setDriveVelocity(PxReal velocity, bool autowake) +{ + PX_CHECK_AND_RETURN(PxIsFinite(velocity), "PxRevoluteJoint::setDriveVelocity: invalid parameter"); + data().driveVelocity = velocity; + if(autowake) + wakeUpActors(); + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteDriveVelocity, static_cast(*this), velocity) +#endif +} + +PxReal RevoluteJoint::getDriveForceLimit() const +{ + return data().driveForceLimit; +} + +void RevoluteJoint::setDriveForceLimit(PxReal forceLimit) +{ + PX_CHECK_AND_RETURN(PxIsFinite(forceLimit), "PxRevoluteJoint::setDriveForceLimit: invalid parameter"); + data().driveForceLimit = forceLimit; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteDriveForceLimit, static_cast(*this), forceLimit) +#endif +} + +PxReal RevoluteJoint::getDriveGearRatio() const +{ + return data().driveGearRatio; +} + +void RevoluteJoint::setDriveGearRatio(PxReal gearRatio) +{ + PX_CHECK_AND_RETURN(PxIsFinite(gearRatio) && gearRatio>0, "PxRevoluteJoint::setDriveGearRatio: invalid parameter"); + data().driveGearRatio = gearRatio; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteDriveGearRatio, static_cast(*this), gearRatio) +#endif +} + +void RevoluteJoint::setProjectionAngularTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance>=0 && tolerance<=PxPi, "PxRevoluteJoint::setProjectionAngularTolerance: invalid parameter"); + data().projectionAngularTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteProjectionAngularTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal RevoluteJoint::getProjectionAngularTolerance() const +{ + return data().projectionAngularTolerance; +} + +void RevoluteJoint::setProjectionLinearTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0, "PxRevoluteJoint::setProjectionLinearTolerance: invalid parameter"); + data().projectionLinearTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteProjectionLinearTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal RevoluteJoint::getProjectionLinearTolerance() const +{ + return data().projectionLinearTolerance; +} + +PxRevoluteJointFlags RevoluteJoint::getRevoluteJointFlags(void) const +{ + return data().jointFlags; +} + +void RevoluteJoint::setRevoluteJointFlags(PxRevoluteJointFlags flags) +{ + data().jointFlags = flags; +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteJointFlags, static_cast(*this), flags) +#endif +} + +void RevoluteJoint::setRevoluteJointFlag(PxRevoluteJointFlag::Enum flag, bool value) +{ + if(value) + data().jointFlags |= flag; + else + data().jointFlags &= ~flag; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, revoluteJointFlags, static_cast(*this), getRevoluteJointFlags()) +#endif +} + +static void RevoluteJointProject(const void* constantBlock, PxTransform& bodyAToWorld, PxTransform& bodyBToWorld, bool projectToA) +{ + const RevoluteJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w, cB2cA, projected; + joint::computeDerived(data, bodyAToWorld, bodyBToWorld, cA2w, cB2w, cB2cA, false); + + bool linearTrunc, angularTrunc; + projected.p = joint::truncateLinear(cB2cA.p, data.projectionLinearTolerance, linearTrunc); + + PxQuat swing, twist, projSwing; + PxSeparateSwingTwist(cB2cA.q, swing, twist); + projSwing = joint::truncateAngular(swing, PxSin(data.projectionAngularTolerance/2), PxCos(data.projectionAngularTolerance/2), angularTrunc); + + if(linearTrunc || angularTrunc) + { + projected.q = projSwing * twist; + joint::projectTransforms(bodyAToWorld, bodyBToWorld, cA2w, cB2w, projected, data, projectToA); + } +} + +static PxQuat computeTwist(const PxTransform& cA2w, const PxTransform& cB2w) +{ + // PT: following code is the same as this part of the "getAngle" function: + // const PxQuat q = getRelativeTransform().q; + // PxQuat swing, twist; + // PxSeparateSwingTwist(q, swing, twist); + // But it's done a little bit more efficiently since we don't need the swing quat. + + // PT: rotation part of "const PxTransform cB2cA = cA2w.transformInv(cB2w);" + const PxQuat cB2cAq = cA2w.q.getConjugate() * cB2w.q; + + // PT: twist part of "PxSeparateSwingTwist(cB2cAq,swing,twist)" (more or less) + return PxQuat(cB2cAq.x, 0.0f, 0.0f, cB2cAq.w); +} + +// PT: this version is similar to the "getAngle" function, but the twist is computed slightly differently. +static PX_FORCE_INLINE PxReal computePhi(const PxTransform& cA2w, const PxTransform& cB2w) +{ + PxQuat twist = computeTwist(cA2w, cB2w); + twist.normalize(); + + PxReal angle = twist.getAngle(); + if(twist.x<0.0f) + angle = -angle; + return angle; +} + +static void RevoluteJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + const RevoluteJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + viz.visualizeJointFrames(cA2w, cB2w); + + if((data.jointFlags & PxRevoluteJointFlag::eLIMIT_ENABLED) && (flags & PxConstraintVisualizationFlag::eLIMITS)) + { + const PxReal angle = computePhi(cA2w, cB2w); + const PxReal pad = data.limit.contactDistance_deprecated; + const PxReal low = data.limit.lower; + const PxReal high = data.limit.upper; + + const bool active = isLimitActive(data.limit, pad, angle, low, high); + viz.visualizeAngularLimit(cA2w, data.limit.lower, data.limit.upper, active); + } +} + +//TAG:solverprepshader +static PxU32 RevoluteJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool useExtendedLimits, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const RevoluteJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + const PxJointAngularLimitPair& limit = data.limit; + + const bool limitEnabled = data.jointFlags & PxRevoluteJointFlag::eLIMIT_ENABLED; + const bool limitIsLocked = limitEnabled && limit.lower >= limit.upper; + + // PT: it is a mistake to use the neighborhood operator since it + // prevents us from using the quat's double-cover feature. + if(!useExtendedLimits && cB2w.q.dot(cA2w.q)<0.0f) + cB2w.q = -cB2w.q; + + PxVec3 ra, rb; + ch.prepareLockedAxes(cA2w.q, cB2w.q, cA2w.transformInv(cB2w.p), 7, PxU32(limitIsLocked ? 7 : 6), ra, rb); + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + if(limitIsLocked) + return ch.getCount(); + + const PxVec3 axis = cA2w.q.getBasisVector0(); + + if(data.jointFlags & PxRevoluteJointFlag::eDRIVE_ENABLED) + { + Px1DConstraint* c = ch.getConstraintRow(); + + c->solveHint = PxConstraintSolveHint::eNONE; + c->linear0 = PxVec3(0.0f); + c->angular0 = -axis; + c->linear1 = PxVec3(0.0f); + c->angular1 = -axis * data.driveGearRatio; + c->velocityTarget = data.driveVelocity; + c->minImpulse = -data.driveForceLimit; + c->maxImpulse = data.driveForceLimit; + c->flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + if(data.jointFlags & PxRevoluteJointFlag::eDRIVE_FREESPIN) + { + if(data.driveVelocity > 0.0f) + c->minImpulse = 0.0f; + if(data.driveVelocity < 0.0f) + c->maxImpulse = 0.0f; + } + c->flags |= Px1DConstraintFlag::eHAS_DRIVE_LIMIT; + } + + if(limitEnabled) + { + const PxReal phi = computePhi(cA2w, cB2w); + ch.anglePair(phi, data.limit.lower, data.limit.upper, data.limit.contactDistance_deprecated, axis, limit); + } + + return ch.getCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gRevoluteJointShaders = { RevoluteJointSolverPrep, RevoluteJointProject, RevoluteJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep RevoluteJoint::getPrep() const { return gRevoluteJointShaders.solverPrep; } + +PxRevoluteJoint* physx::PxRevoluteJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxRevoluteJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxRevoluteJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxRevoluteJointCreate: actors must be different"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxRevoluteJointCreate: at least one actor must be dynamic"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gRevoluteJointShaders); +} + +// PX_SERIALIZATION +void RevoluteJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gRevoluteJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +void RevoluteJoint::updateOmniPvdProperties() const +{ + const PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, revoluteAngle, j, getAngle()) + OMNI_PVD_SET(joint, revoluteVelocity, j, getVelocity()) +} + +template<> +void physx::Ext::omniPvdInitJoint(RevoluteJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eREVOLUTE) + OMNI_PVD_SET(joint, revoluteProjectionLinearTolerance, j, joint->getProjectionLinearTolerance()) + OMNI_PVD_SET(joint, revoluteProjectionAngularTolerance, j, joint->getProjectionAngularTolerance()) + + PxJointAngularLimitPair limit = joint->getLimit(); + OMNI_PVD_SET(joint, revoluteLimitLower, j, limit.lower) + OMNI_PVD_SET(joint, revoluteLimitUpper, j, limit.upper) + OMNI_PVD_SET(joint, revoluteLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, revoluteLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, revoluteLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, revoluteLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, revoluteLimitContactDistance, j, limit.contactDistance_deprecated) + + OMNI_PVD_SET(joint, revoluteDriveVelocity, j, joint->getDriveVelocity()) + OMNI_PVD_SET(joint, revoluteDriveForceLimit, j, joint->getDriveForceLimit()) + OMNI_PVD_SET(joint, revoluteDriveGearRatio, j, joint->getDriveGearRatio()) + OMNI_PVD_SET(joint, revoluteJointFlags, j, joint->getRevoluteJointFlags()) + + OMNI_PVD_SET(joint, revoluteAngle, j, joint->getAngle()) + OMNI_PVD_SET(joint, revoluteVelocity, j, joint->getVelocity()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.h new file mode 100644 index 0000000..1b46bf7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRevoluteJoint.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_REVOLUTE_JOINT_H +#define EXT_REVOLUTE_JOINT_H + +#include "extensions/PxRevoluteJoint.h" + +#include "ExtJoint.h" +#include "foundation/PxIntrinsics.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxRevoluteJointGeneratedValues; + +namespace Ext +{ + struct RevoluteJointData : public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PxReal driveVelocity; + PxReal driveForceLimit; + PxReal driveGearRatio; + + PxJointAngularLimitPair limit; + + PxReal projectionLinearTolerance; + PxReal projectionAngularTolerance; + + PxRevoluteJointFlags jointFlags; + private: + RevoluteJointData(const PxJointAngularLimitPair& pair) : limit(pair) {} + }; + + typedef JointT RevoluteJointT; + + class RevoluteJoint : public RevoluteJointT + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + RevoluteJoint(PxBaseFlags baseFlags) : RevoluteJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static RevoluteJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + RevoluteJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxRevoluteJoint + virtual PxReal getAngle() const PX_OVERRIDE; + virtual PxReal getVelocity() const PX_OVERRIDE; + virtual void setLimit(const PxJointAngularLimitPair& limit) PX_OVERRIDE; + virtual PxJointAngularLimitPair getLimit() const PX_OVERRIDE; + virtual void setDriveVelocity(PxReal velocity, bool autowake = true) PX_OVERRIDE; + virtual PxReal getDriveVelocity() const PX_OVERRIDE; + virtual void setDriveForceLimit(PxReal forceLimit) PX_OVERRIDE; + virtual PxReal getDriveForceLimit() const PX_OVERRIDE; + virtual void setDriveGearRatio(PxReal gearRatio) PX_OVERRIDE; + virtual PxReal getDriveGearRatio() const PX_OVERRIDE; + virtual void setRevoluteJointFlags(PxRevoluteJointFlags flags) PX_OVERRIDE; + virtual void setRevoluteJointFlag(PxRevoluteJointFlag::Enum flag, bool value) PX_OVERRIDE; + virtual PxRevoluteJointFlags getRevoluteJointFlags() const PX_OVERRIDE; + virtual void setProjectionLinearTolerance(PxReal distance) PX_OVERRIDE; + virtual PxReal getProjectionLinearTolerance() const PX_OVERRIDE; + virtual void setProjectionAngularTolerance(PxReal tolerance) PX_OVERRIDE; + virtual PxReal getProjectionAngularTolerance() const PX_OVERRIDE; + //~PxRevoluteJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; +#if PX_SUPPORT_OMNI_PVD + virtual void updateOmniPvdProperties() const PX_OVERRIDE; +#endif + //~PxConstraintConnector + }; + +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp new file mode 100644 index 0000000..bc2c638 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidActorExt.cpp @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxRigidActorExt.h" +#include "foundation/PxFPU.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxInlineArray.h" +#include "geometry/PxGeometryQuery.h" + +#include "cooking/PxBVHDesc.h" +#include "cooking/PxCooking.h" + +using namespace physx; + +PxBounds3* PxRigidActorExt::getRigidActorShapeLocalBoundsList(const PxRigidActor& actor, PxU32& numBounds) +{ + const PxU32 numShapes = actor.getNbShapes(); + if(numShapes == 0) + return NULL; + + PxInlineArray shapes("PxShape*"); + shapes.resize(numShapes); + + actor.getShapes(shapes.begin(), shapes.size()); + + PxU32 numSqShapes = 0; + for(PxU32 i=0; igetFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE) + numSqShapes++; + } + + PxBounds3* bounds = PX_ALLOCATE(PxBounds3, numSqShapes, "PxBounds3"); + + numSqShapes = 0; + { + PX_SIMD_GUARD // PT: external guard because we use PxGeometryQueryFlag::Enum(0) below + for(PxU32 i=0; igetFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE) + PxGeometryQuery::computeGeomBounds(bounds[numSqShapes++], shapes[i]->getGeometry(), shapes[i]->getLocalPose(), 0.0f, 1.0f, PxGeometryQueryFlag::Enum(0)); + } + } + + numBounds = numSqShapes; + return bounds; +} + +PxBVH* PxRigidActorExt::createBVHFromActor(PxPhysics& physics, const PxRigidActor& actor) +{ + PxU32 nbBounds = 0; + PxBounds3* bounds = PxRigidActorExt::getRigidActorShapeLocalBoundsList(actor, nbBounds); + + PxBVHDesc bvhDesc; + bvhDesc.bounds.count = nbBounds; + bvhDesc.bounds.data = bounds; + bvhDesc.bounds.stride = sizeof(PxBounds3); + + PxBVH* bvh = PxCreateBVH(bvhDesc, physics.getPhysicsInsertionCallback()); + + PX_FREE(bounds); + return bvh; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp new file mode 100644 index 0000000..c37d383 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtRigidBodyExt.cpp @@ -0,0 +1,644 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxGeometryHelpers.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxTriangleMesh.h" +#include "extensions/PxRigidBodyExt.h" +#include "extensions/PxShapeExt.h" +#include "extensions/PxMassProperties.h" +#include "PxShape.h" +#include "PxScene.h" +#include "PxRigidDynamic.h" +#include "PxRigidStatic.h" + +#include "ExtInertiaTensor.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxSIMDHelpers.h" + +#include "CmUtils.h" + +using namespace physx; +using namespace Cm; + +static bool computeMassAndDiagInertia(Ext::InertiaTensorComputer& inertiaComp, + PxVec3& diagTensor, PxQuat& orient, PxReal& massOut, PxVec3& coM, bool lockCOM, const PxRigidBody& body, const char* errorStr) +{ + // The inertia tensor and center of mass is relative to the actor at this point. Transform to the + // body frame directly if CoM is specified, else use computed center of mass + if (lockCOM) + { + inertiaComp.translate(-coM); // base the tensor on user's desired center of mass. + } + else + { + //get center of mass - has to be done BEFORE centering. + coM = inertiaComp.getCenterOfMass(); + + //the computed result now needs to be centered around the computed center of mass: + inertiaComp.center(); + } + // The inertia matrix is now based on the body's center of mass desc.massLocalPose.p + + massOut = inertiaComp.getMass(); + diagTensor = PxDiagonalize(inertiaComp.getInertia(), orient); + + if ((diagTensor.x > 0.0f) && (diagTensor.y > 0.0f) && (diagTensor.z > 0.0f)) + return true; + else + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "%s: inertia tensor has negative components (ill-conditioned input expected). Approximation for inertia tensor will be used instead.", errorStr); + + // keep center of mass but use the AABB as a crude approximation for the inertia tensor + PxBounds3 bounds = body.getWorldBounds(); + const PxTransform pose = body.getGlobalPose(); + bounds = PxBounds3::transformFast(pose.getInverse(), bounds); + Ext::InertiaTensorComputer it(false); + it.setBox(bounds.getExtents()); + it.scaleDensity(massOut / it.getMass()); + const PxMat33 inertia = it.getInertia(); + diagTensor = PxVec3(inertia.column0.x, inertia.column1.y, inertia.column2.z); + orient = PxQuat(PxIdentity); + + return true; + } +} + +static bool computeMassAndInertia(Ext::InertiaTensorComputer& inertiaComp, bool multipleMassOrDensity, PxRigidBody& body, const PxReal* densities, const PxReal* masses, PxU32 densityOrMassCount, bool includeNonSimShapes) +{ + PX_ASSERT(!densities || !masses); + PX_ASSERT((densities || masses) && (densityOrMassCount > 0)); + + PxInlineArray shapes("PxShape*"); shapes.resize(body.getNbShapes()); + + body.getShapes(shapes.begin(), shapes.size()); + + PxU32 validShapeIndex = 0; + PxReal currentMassOrDensity; + const PxReal* massOrDensityArray; + if (densities) + { + massOrDensityArray = densities; + currentMassOrDensity = densities[0]; + } + else + { + massOrDensityArray = masses; + currentMassOrDensity = masses[0]; + } + if (!PxIsFinite(currentMassOrDensity)) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeMassAndInertia: Provided mass or density has no valid value"); + + for(PxU32 i=0; i < shapes.size(); i++) + { + if ((!(shapes[i]->getFlags() & PxShapeFlag::eSIMULATION_SHAPE)) && (!includeNonSimShapes)) + continue; + + if (multipleMassOrDensity) + { + if (validShapeIndex < densityOrMassCount) + { + currentMassOrDensity = massOrDensityArray[validShapeIndex]; + + if (!PxIsFinite(currentMassOrDensity)) + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeMassAndInertia: Provided mass or density has no valid value"); + } + else + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeMassAndInertia: Not enough mass/density values provided for all (simulation) shapes"); + } + + Ext::InertiaTensorComputer it(false); + + switch(shapes[i]->getGeometryType()) + { + case PxGeometryType::eSPHERE : + { + PxSphereGeometry g; + bool ok = shapes[i]->getSphereGeometry(g); + PX_ASSERT(ok); + PX_UNUSED(ok); + PxTransform temp(shapes[i]->getLocalPose()); + + it.setSphere(g.radius, &temp); + } + break; + + case PxGeometryType::eBOX : + { + PxBoxGeometry g; + bool ok = shapes[i]->getBoxGeometry(g); + PX_ASSERT(ok); + PX_UNUSED(ok); + PxTransform temp(shapes[i]->getLocalPose()); + + it.setBox(g.halfExtents, &temp); + } + break; + + case PxGeometryType::eCAPSULE : + { + PxCapsuleGeometry g; + bool ok = shapes[i]->getCapsuleGeometry(g); + PX_ASSERT(ok); + PX_UNUSED(ok); + PxTransform temp(shapes[i]->getLocalPose()); + + it.setCapsule(0, g.radius, g.halfHeight, &temp); + } + break; + + case PxGeometryType::eCONVEXMESH : + { + PxConvexMeshGeometry g; + bool ok = shapes[i]->getConvexMeshGeometry(g); + PX_ASSERT(ok); + PX_UNUSED(ok); + PxConvexMesh& convMesh = *g.convexMesh; + + PxReal convMass; + PxMat33 convInertia; + PxVec3 convCoM; + convMesh.getMassInformation(convMass, convInertia, convCoM); + + if (!g.scale.isIdentity()) + { + //scale the mass properties + convMass *= (g.scale.scale.x * g.scale.scale.y * g.scale.scale.z); + convCoM = g.scale.transform(convCoM); + convInertia = PxMassProperties::scaleInertia(convInertia, g.scale.rotation, g.scale.scale); + } + + it = Ext::InertiaTensorComputer(convInertia, convCoM, convMass); + it.transform(shapes[i]->getLocalPose()); + } + break; + case PxGeometryType::eCUSTOM: + { + PxMassProperties mp(shapes[i]->getGeometry()); + it = Ext::InertiaTensorComputer(mp.inertiaTensor, mp.centerOfMass, mp.mass); + it.transform(shapes[i]->getLocalPose()); + } + break; + case PxGeometryType::eTRIANGLEMESH: + { + PxTriangleMeshGeometry g; + bool ok = shapes[i]->getTriangleMeshGeometry(g); + PX_ASSERT(ok); + PX_UNUSED(ok); + + PxReal mass; + PxMat33 inertia; + PxVec3 centerOfMass; + g.triangleMesh->getMassInformation(mass, inertia, centerOfMass); + + if (!g.scale.isIdentity()) + { + //scale the mass properties + mass *= (g.scale.scale.x * g.scale.scale.y * g.scale.scale.z); + centerOfMass = g.scale.transform(centerOfMass); + inertia = PxMassProperties::scaleInertia(inertia, g.scale.rotation, g.scale.scale); + } + + it = Ext::InertiaTensorComputer(inertia, centerOfMass, mass); + + it.transform(shapes[i]->getLocalPose()); + } + break; + default: + { + return PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeMassAndInertia: Dynamic actor with illegal collision shapes"); + } + } + + if (densities) + it.scaleDensity(currentMassOrDensity); + else if (multipleMassOrDensity) // mass per shape -> need to scale density per shape + it.scaleDensity(currentMassOrDensity / it.getMass()); + + inertiaComp.add(it); + + validShapeIndex++; + } + + if (validShapeIndex && masses && (!multipleMassOrDensity)) // at least one simulation shape and single mass for all shapes -> scale density at the end + inertiaComp.scaleDensity(currentMassOrDensity / inertiaComp.getMass()); + + return true; +} + +static bool updateMassAndInertia(bool multipleMassOrDensity, PxRigidBody& body, const PxReal* densities, PxU32 densityCount, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + bool success; + + // default values in case there were no shapes + PxReal massOut = 1.0f; + PxVec3 diagTensor(1.0f); + PxQuat orient(PxIdentity); + bool lockCom = massLocalPose != NULL; + PxVec3 com = lockCom ? *massLocalPose : PxVec3(0); + const char* errorStr = "PxRigidBodyExt::updateMassAndInertia"; + + if (densities && densityCount) + { + Ext::InertiaTensorComputer inertiaComp(true); + if(computeMassAndInertia(inertiaComp, multipleMassOrDensity, body, densities, NULL, densityCount, includeNonSimShapes)) + { + if(inertiaComp.getMass()!=0 && computeMassAndDiagInertia(inertiaComp, diagTensor, orient, massOut, com, lockCom, body, errorStr)) + success = true; + else + success = false; // body with no shapes provided or computeMassAndDiagInertia() failed + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)", errorStr); + + success = false; + } + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: No density specified, setting mass to 1 and inertia to (1,1,1)", errorStr); + + success = false; + } + + PX_ASSERT(orient.isFinite()); + PX_ASSERT(diagTensor.isFinite()); + PX_ASSERT(PxIsFinite(massOut)); + + body.setMass(massOut); + body.setMassSpaceInertiaTensor(diagTensor); + body.setCMassLocalPose(PxTransform(com, orient)); + + return success; +} + +bool PxRigidBodyExt::updateMassAndInertia(PxRigidBody& body, const PxReal* densities, PxU32 densityCount, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + return ::updateMassAndInertia(true, body, densities, densityCount, massLocalPose, includeNonSimShapes); +} + +bool PxRigidBodyExt::updateMassAndInertia(PxRigidBody& body, PxReal density, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + return ::updateMassAndInertia(false, body, &density, 1, massLocalPose, includeNonSimShapes); +} + +static bool setMassAndUpdateInertia(bool multipleMassOrDensity, PxRigidBody& body, const PxReal* masses, PxU32 massCount, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + bool success; + + // default values in case there were no shapes + PxReal massOut = 1.0f; + PxVec3 diagTensor(1.0f); + PxQuat orient(PxIdentity); + bool lockCom = massLocalPose != NULL; + PxVec3 com = lockCom ? *massLocalPose : PxVec3(0); + const char* errorStr = "PxRigidBodyExt::setMassAndUpdateInertia"; + + if(masses && massCount) + { + Ext::InertiaTensorComputer inertiaComp(true); + if(computeMassAndInertia(inertiaComp, multipleMassOrDensity, body, NULL, masses, massCount, includeNonSimShapes)) + { + success = true; + + if (inertiaComp.getMass()!=0 && !computeMassAndDiagInertia(inertiaComp, diagTensor, orient, massOut, com, lockCom, body, errorStr)) + success = false; // computeMassAndDiagInertia() failed (mass zero?) + + if (massCount == 1) + massOut = masses[0]; // to cover special case where body has no simulation shape + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: Mass and inertia computation failed, setting mass to 1 and inertia to (1,1,1)", errorStr); + + success = false; + } + } + else + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "%s: No mass specified, setting mass to 1 and inertia to (1,1,1)", errorStr); + success = false; + } + + PX_ASSERT(orient.isFinite()); + PX_ASSERT(diagTensor.isFinite()); + + body.setMass(massOut); + body.setMassSpaceInertiaTensor(diagTensor); + body.setCMassLocalPose(PxTransform(com, orient)); + + return success; +} + +bool PxRigidBodyExt::setMassAndUpdateInertia(PxRigidBody& body, const PxReal* masses, PxU32 massCount, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + return ::setMassAndUpdateInertia(true, body, masses, massCount, massLocalPose, includeNonSimShapes); +} + +bool PxRigidBodyExt::setMassAndUpdateInertia(PxRigidBody& body, PxReal mass, const PxVec3* massLocalPose, bool includeNonSimShapes) +{ + return ::setMassAndUpdateInertia(false, body, &mass, 1, massLocalPose, includeNonSimShapes); +} + +PxMassProperties PxRigidBodyExt::computeMassPropertiesFromShapes(const PxShape* const* shapes, PxU32 shapeCount) +{ + PxInlineArray massProps; + massProps.reserve(shapeCount); + PxInlineArray localTransforms; + localTransforms.reserve(shapeCount); + + for(PxU32 shapeIdx=0; shapeIdx < shapeCount; shapeIdx++) + { + const PxShape* shape = shapes[shapeIdx]; + PxMassProperties mp(shape->getGeometry()); + massProps.pushBack(mp); + localTransforms.pushBack(shape->getLocalPose()); + } + + return PxMassProperties::sum(massProps.begin(), localTransforms.begin(), shapeCount); +} + +PX_INLINE void addForceAtPosInternal(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode, bool wakeup) +{ + if(mode == PxForceMode::eACCELERATION || mode == PxForceMode::eVELOCITY_CHANGE) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxRigidBodyExt::addForce methods do not support eACCELERATION or eVELOCITY_CHANGE modes"); + return; + } + + const PxTransform globalPose = body.getGlobalPose(); + const PxVec3 centerOfMass = globalPose.transform(body.getCMassLocalPose().p); + + const PxVec3 torque = (pos - centerOfMass).cross(force); + body.addForce(force, mode, wakeup); + body.addTorque(torque, mode, wakeup); +} + +void PxRigidBodyExt::addForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode, bool wakeup) +{ + addForceAtPosInternal(body, force, pos, mode, wakeup); +} + +void PxRigidBodyExt::addForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode, bool wakeup) +{ + //transform pos to world space + const PxVec3 globalForcePos = body.getGlobalPose().transform(pos); + + addForceAtPosInternal(body, force, globalForcePos, mode, wakeup); +} + +void PxRigidBodyExt::addLocalForceAtPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode, bool wakeup) +{ + const PxVec3 globalForce = body.getGlobalPose().rotate(force); + + addForceAtPosInternal(body, globalForce, pos, mode, wakeup); +} + +void PxRigidBodyExt::addLocalForceAtLocalPos(PxRigidBody& body, const PxVec3& force, const PxVec3& pos, PxForceMode::Enum mode, bool wakeup) +{ + const PxTransform globalPose = body.getGlobalPose(); + const PxVec3 globalForcePos = globalPose.transform(pos); + const PxVec3 globalForce = globalPose.rotate(force); + + addForceAtPosInternal(body, globalForce, globalForcePos, mode, wakeup); +} + +PX_INLINE PxVec3 getVelocityAtPosInternal(const PxRigidBody& body, const PxVec3& point) +{ + PxVec3 velocity = body.getLinearVelocity(); + velocity += body.getAngularVelocity().cross(point); + + return velocity; +} + +PxVec3 PxRigidBodyExt::getVelocityAtPos(const PxRigidBody& body, const PxVec3& point) +{ + const PxTransform globalPose = body.getGlobalPose(); + const PxVec3 centerOfMass = globalPose.transform(body.getCMassLocalPose().p); + const PxVec3 rpoint = point - centerOfMass; + + return getVelocityAtPosInternal(body, rpoint); +} + +PxVec3 PxRigidBodyExt::getLocalVelocityAtLocalPos(const PxRigidBody& body, const PxVec3& point) +{ + const PxTransform globalPose = body.getGlobalPose(); + const PxVec3 centerOfMass = globalPose.transform(body.getCMassLocalPose().p); + const PxVec3 rpoint = globalPose.transform(point) - centerOfMass; + + return getVelocityAtPosInternal(body, rpoint); +} + +PxVec3 PxRigidBodyExt::getVelocityAtOffset(const PxRigidBody& body, const PxVec3& point) +{ + const PxTransform globalPose = body.getGlobalPose(); + const PxVec3 centerOfMass = globalPose.rotate(body.getCMassLocalPose().p); + const PxVec3 rpoint = point - centerOfMass; + + return getVelocityAtPosInternal(body, rpoint); +} + +void PxRigidBodyExt::computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& linearVelocityChange, PxVec3& angularVelocityChange) +{ + const PxVec3 centerOfMass = globalPose.transform(body.getCMassLocalPose().p); + const PxReal invMass = body.getInvMass() * invMassScale; + const PxVec3 invInertiaMS = body.getMassSpaceInvInertiaTensor() * invInertiaScale; + + PxMat33 invInertia; + transformInertiaTensor(invInertiaMS, PxMat33Padded(globalPose.q), invInertia); + linearVelocityChange = impulse * invMass; + const PxVec3 rXI = (point - centerOfMass).cross(impulse); + angularVelocityChange = invInertia * rXI; +} + +void PxRigidBodyExt::computeLinearAngularImpulse(const PxRigidBody& body, const PxTransform& globalPose, const PxVec3& point, const PxVec3& impulse, const PxReal invMassScale, + const PxReal invInertiaScale, PxVec3& linearImpulse, PxVec3& angularImpulse) +{ + const PxVec3 centerOfMass = globalPose.transform(body.getCMassLocalPose().p); + linearImpulse = impulse * invMassScale; + angularImpulse = (point - centerOfMass).cross(impulse) * invInertiaScale; +} + +void PxRigidBodyExt::computeVelocityDeltaFromImpulse(const PxRigidBody& body, const PxVec3& impulsiveForce, const PxVec3& impulsiveTorque, PxVec3& deltaLinearVelocity, PxVec3& deltaAngularVelocity) +{ + { + const PxF32 recipMass = body.getInvMass(); + deltaLinearVelocity = impulsiveForce*recipMass; + } + + { + const PxTransform globalPose = body.getGlobalPose(); + const PxTransform cmLocalPose = body.getCMassLocalPose(); + const PxTransform body2World = globalPose*cmLocalPose; + const PxMat33Padded M(body2World.q); + + const PxVec3 recipInertiaBodySpace = body.getMassSpaceInvInertiaTensor(); + + PxMat33 recipInertiaWorldSpace; + const float axx = recipInertiaBodySpace.x*M(0,0), axy = recipInertiaBodySpace.x*M(1,0), axz = recipInertiaBodySpace.x*M(2,0); + const float byx = recipInertiaBodySpace.y*M(0,1), byy = recipInertiaBodySpace.y*M(1,1), byz = recipInertiaBodySpace.y*M(2,1); + const float czx = recipInertiaBodySpace.z*M(0,2), czy = recipInertiaBodySpace.z*M(1,2), czz = recipInertiaBodySpace.z*M(2,2); + recipInertiaWorldSpace(0,0) = axx*M(0,0) + byx*M(0,1) + czx*M(0,2); + recipInertiaWorldSpace(1,1) = axy*M(1,0) + byy*M(1,1) + czy*M(1,2); + recipInertiaWorldSpace(2,2) = axz*M(2,0) + byz*M(2,1) + czz*M(2,2); + recipInertiaWorldSpace(0,1) = recipInertiaWorldSpace(1,0) = axx*M(1,0) + byx*M(1,1) + czx*M(1,2); + recipInertiaWorldSpace(0,2) = recipInertiaWorldSpace(2,0) = axx*M(2,0) + byx*M(2,1) + czx*M(2,2); + recipInertiaWorldSpace(1,2) = recipInertiaWorldSpace(2,1) = axy*M(2,0) + byy*M(2,1) + czy*M(2,2); + + deltaAngularVelocity = recipInertiaWorldSpace*(impulsiveTorque); + } +} + +//================================================================================= +// Single closest hit compound sweep +bool PxRigidBodyExt::linearSweepSingle( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, + PxHitFlags outputFlags, PxSweepHit& closestHit, PxU32& shapeIndex, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation) +{ + shapeIndex = 0xFFFFffff; + PxReal closestDist = distance; + PxU32 nbShapes = body.getNbShapes(); + for(PxU32 i=0; i < nbShapes; i++) + { + PxShape* shape = NULL; + body.getShapes(&shape, 1, i); + PX_ASSERT(shape != NULL); + PxTransform pose = PxShapeExt::getGlobalPose(*shape, body); + PxQueryFilterData fd; + fd.flags = filterData.flags; + PxU32 or4 = (filterData.data.word0 | filterData.data.word1 | filterData.data.word2 | filterData.data.word3); + fd.data = or4 ? filterData.data : shape->getQueryFilterData(); + + PxSweepBuffer subHit; // touching hits are not allowed to be returned from the filters + scene.sweep(shape->getGeometry(), pose, unitDir, distance, subHit, outputFlags, fd, filterCall, cache, inflation); + if (subHit.hasBlock && subHit.block.distance < closestDist) + { + closestDist = subHit.block.distance; + closestHit = subHit.block; + shapeIndex = i; + } + } + + return (shapeIndex != 0xFFFFffff); +} + +//================================================================================= +// Multiple hits compound sweep +// AP: we might be able to improve the return results API but no time for it in 3.3 +PxU32 PxRigidBodyExt::linearSweepMultiple( + PxRigidBody& body, PxScene& scene, const PxVec3& unitDir, const PxReal distance, PxHitFlags outputFlags, + PxSweepHit* hitBuffer, PxU32* hitShapeIndices, PxU32 hitBufferSize, PxSweepHit& block, PxI32& blockingHitShapeIndex, + bool& overflow, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation) +{ + overflow = false; + blockingHitShapeIndex = -1; + + for (PxU32 i = 0; i < hitBufferSize; i++) + hitShapeIndices[i] = 0xFFFFffff; + + PxI32 sumNbResults = 0; + + PxU32 nbShapes = body.getNbShapes(); + PxF32 shrunkMaxDistance = distance; + for(PxU32 i=0; i < nbShapes; i++) + { + PxShape* shape = NULL; + body.getShapes(&shape, 1, i); + PX_ASSERT(shape != NULL); + PxTransform pose = PxShapeExt::getGlobalPose(*shape, body); + PxQueryFilterData fd; + fd.flags = filterData.flags; + PxU32 or4 = (filterData.data.word0 | filterData.data.word1 | filterData.data.word2 | filterData.data.word3); + fd.data = or4 ? filterData.data : shape->getQueryFilterData(); + + PxU32 bufSizeLeft = hitBufferSize-sumNbResults; + PxSweepHit extraHit; + PxSweepBuffer buffer(bufSizeLeft == 0 ? &extraHit : hitBuffer+sumNbResults, bufSizeLeft == 0 ? 1 : hitBufferSize-sumNbResults); + scene.sweep(shape->getGeometry(), pose, unitDir, shrunkMaxDistance, buffer, outputFlags, fd, filterCall, cache, inflation); + + // Check and abort on overflow. Assume overflow if result count is bufSize. + PxU32 nbNewResults = buffer.getNbTouches(); + overflow |= (nbNewResults >= bufSizeLeft); + if (bufSizeLeft == 0) // this is for when we used the extraHit buffer + nbNewResults = 0; + + // set hitShapeIndices for each new non-blocking hit + for (PxU32 j = 0; j < nbNewResults; j++) + if (sumNbResults + PxU32(j) < hitBufferSize) + hitShapeIndices[sumNbResults+j] = i; + + if (buffer.hasBlock) // there's a blocking hit in the most recent sweepMultiple results + { + // overwrite the return result blocking hit with the new blocking hit if under + if (blockingHitShapeIndex == -1 || buffer.block.distance < block.distance) + { + blockingHitShapeIndex = PxI32(i); + block = buffer.block; + } + + // Remove all the old touching hits below the new maxDist + // sumNbResults is not updated yet at this point + // and represents the count accumulated so far excluding the very last query + PxI32 nbNewResultsSigned = PxI32(nbNewResults); // need a signed version, see nbNewResultsSigned-- below + for (PxI32 j = sumNbResults-1; j >= 0; j--) // iterate over "old" hits (up to shapeIndex-1) + if (buffer.block.distance < hitBuffer[j].distance) + { + // overwrite with last "new" hit + PxI32 sourceIndex = PxI32(sumNbResults)+nbNewResultsSigned-1; PX_ASSERT(sourceIndex >= j); + hitBuffer[j] = hitBuffer[sourceIndex]; + hitShapeIndices[j] = hitShapeIndices[sourceIndex]; + nbNewResultsSigned--; // can get negative, that means we are shifting the last results array + } + + sumNbResults += nbNewResultsSigned; + } else // if there was no new blocking hit we don't need to do anything special, simply append all results to touch array + sumNbResults += nbNewResults; + + PX_ASSERT(sumNbResults >= 0 && sumNbResults <= PxI32(hitBufferSize)); + } + + return PxU32(sumNbResults); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp new file mode 100644 index 0000000..242217a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSampling.cpp @@ -0,0 +1,1486 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "extensions/PxSamplingExt.h" +#include "GuSDF.h" +#include "foundation/PxQuat.h" +#include "foundation/PxHashSet.h" +#include "GuDistancePointTriangle.h" +#include "extensions/PxRemeshingExt.h" +#include "geometry/PxGeometryQuery.h" +#include "PxQueryReport.h" +#include "foundation/PxHashMap.h" +#include "CmRandom.h" + +#include "GuAABBTreeNode.h" +#include "GuAABBTree.h" +#include "GuAABBTreeBounds.h" +#include "GuWindingNumber.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxSort.h" + +namespace physx +{ + namespace + { + using namespace Gu; + using namespace Cm; + + static const PxI32 neighborEdges[3][2] = { { 0, 1 }, { 2, 0 }, { 1, 2 } }; + + struct Int3 + { + PxI32 x; + PxI32 y; + PxI32 z; + + Int3(PxI32 x_, PxI32 y_, PxI32 z_) : x(x_), y(y_), z(z_) {} + + Int3() : x(0), y(0), z(0) {} + }; + + struct ActiveSample + { + PxI32 mIndex; + PxArray mNearbyTriangles; + PxArray mCumulativeTriangleAreas; + + ActiveSample() : mIndex(-1) {} + + ActiveSample(PxI32 index, const PxArray& nearbyTriangles, const PxArray& cumulativeTriangleAreas) + { + mIndex = index; + mNearbyTriangles = nearbyTriangles; + mCumulativeTriangleAreas = cumulativeTriangleAreas; + } + }; + + struct PointWithNormal + { + PxVec3 mPoint; + PxVec3 mNormal; + + PointWithNormal() {} + + PointWithNormal(const PxVec3& point, const PxVec3& normal) : mPoint(point), mNormal(normal) + { + } + }; + + struct IndexWithNormal + { + PxI32 mIndex; + PxVec3 mNormal; + + IndexWithNormal(PxI32 index, const PxVec3& normal) : mIndex(index), mNormal(normal) + { + } + }; + + void getBoundsFromPoints(const PxVec3* points, const PxU32 numPoints, PxVec3& outMinExtents, PxVec3& outMaxExtents) + { + PxVec3 minExtents(FLT_MAX); + PxVec3 maxExtents(-FLT_MAX); + + // calculate face bounds + for (PxU32 i = 0; i < numPoints; ++i) + { + const PxVec3& a = points[i]; + + minExtents = a.minimum(minExtents); + maxExtents = a.maximum(maxExtents); + } + + outMinExtents = minExtents; + outMaxExtents = maxExtents; + } + + PX_FORCE_INLINE PxReal triArea(const PxVec3& a, const PxVec3& b, const PxVec3& c) + { + return 0.5f * (b - a).cross(c - a).magnitude(); + } + + PX_FORCE_INLINE PxReal triArea(const PxU32* tri, const PxVec3* points) + { + return triArea(points[tri[0]], points[tri[1]], points[tri[2]]); + } + + PX_FORCE_INLINE PxU64 edgeKey(PxI32 a, PxI32 b) + { + if (a < b) + return ((PxU64(a)) << 32) | (PxU64(b)); + else + return ((PxU64(b)) << 32) | (PxU64(a)); + } + + void buildTriangleAdjacency(const PxU32* tris, PxU32 numTriangles, PxArray& result) + { + PxU32 l = 4 * numTriangles; //4 elements per triangle - waste one entry per triangle to get a power of 2 which allows for bit shift usage instead of modulo + result.clear(); + result.resize(l, -1); + + for (PxU32 i = 3; i < l; i += 4) + result[i] = -2; + + PxHashMap edges; + for (PxU32 i = 0; i < numTriangles; ++i) + { + const PxU32* tri = &tris[3 * i]; + + for (PxU32 j = 0; j < 3; ++j) + { + const PxU64 edge = edgeKey(tri[neighborEdges[j][0]], tri[neighborEdges[j][1]]); + const PxPair* it = edges.find(edge); + if (it) + { + result[4u * i + j] = it->second; + result[it->second] = 4u * i + j; + } + else + { + PxU32 v = 4u * i + j; + edges.insert(edge, v); + } + } + } + } + + + + void collectTrianglesInSphere(const PxVec3& center, PxReal radius, PxI32 startTri, const PxU32* triangles, const PxVec3* points, + const PxArray& adj, PxHashSet& result) + { + PxArray stack; + stack.pushBack(startTri); + + result.clear(); + result.insert(startTri); + + while (stack.size() > 0) + { + PxI32 tri = stack.popBack() * 4; + for (PxI32 i = 0; i < 3; ++i) + { + PxI32 n = adj[tri + i] >> 2; + if (n >= 0 && !result.contains(n)) + { + const PxU32* t = &triangles[3 * n]; + if (Gu::distancePointTriangleSquared(center, points[t[0]], points[t[1]] - points[t[0]], points[t[2]] - points[t[0]]) < radius * radius) + { + result.insert(n); + stack.pushBack(n); + } + } + } + } + } + + void createActiveSample(const PxArray& triangleAreaBuffer, PxI32 sampleIndex, const PxVec3& sample, PxReal radius, PxI32 startTri, + const PxU32* triangles, const PxVec3* points, const PxArray& adj, ActiveSample& result) + { + PxHashSet nearbyTriangles; + collectTrianglesInSphere(sample, radius, startTri, triangles, points, adj, nearbyTriangles); + + result.mNearbyTriangles.clear(); + result.mNearbyTriangles.reserve(nearbyTriangles.size()); + //for (PxI32 t : nearbyTriangles) + for (PxHashSet::Iterator iter = nearbyTriangles.getIterator(); !iter.done(); ++iter) + result.mNearbyTriangles.pushBack(*iter); + + result.mCumulativeTriangleAreas.clear(); + result.mCumulativeTriangleAreas.resize(nearbyTriangles.size()); + result.mCumulativeTriangleAreas[0] = triangleAreaBuffer[result.mNearbyTriangles[0]]; + for (PxU32 i = 1; i < nearbyTriangles.size(); ++i) + result.mCumulativeTriangleAreas[i] = result.mCumulativeTriangleAreas[i - 1] + triangleAreaBuffer[result.mNearbyTriangles[i]]; + + result.mIndex = sampleIndex; + } + + //Returns the index of the element with value <= v + PxU32 binarySearch(const PxArray& sorted, PxReal v) + { + PxU32 low = 0; + PxU32 up = PxU32(sorted.size()); + + while (up - low > 1) + { + PxU32 middle = (up + low) >> 1; + PxReal m = sorted[middle]; + if (v <= m) + up = middle; + else + low = middle; + } + return low; + } + + PxVec3 randomPointOnTriangle(BasicRandom& rnd, const PxU32* tri, const PxVec3* points, PxVec3* barycentricCoordinates = NULL) + { + while (true) + { + PxReal a = rnd.rand(0.0f, 1.0f); + PxReal b = rnd.rand(0.0f, 1.0f); + + PxReal sum = a + b; + if (sum > 1) + continue; + + PxReal c = 1 - a - b; + if (barycentricCoordinates) + (*barycentricCoordinates) = PxVec3(a, b, c); + return points[tri[0]] * a + points[tri[1]] * b + points[tri[2]] * c; + } + } + + bool samplePointInBallOnSurface(BasicRandom& rnd, const PxArray& cumulativeAreas, const PxVec3* points, const PxU32* triangles, const PxArray& nearbyTriangles, + const PxVec3& point, PxReal radius, PxVec3& sample, PxI32& triId, PxI32 numAttempts = 30, PxVec3* barycentricCoordinates = NULL) + { + triId = -1; + + //Use variable upper bound as described in http://extremelearning.com.au/an-improved-version-of-bridsons-algorithm-n-for-poisson-disc-sampling/ + PxReal step = radius / numAttempts; + PxReal rUpper = radius + step; + PxVec3 fallback; + PxReal fallbackDist = FLT_MAX; + PxI32 fallbackId = -1; + PxVec3 fallbackBary; + for (PxI32 i = 0; i < numAttempts; ++i) + { + PxReal totalArea = cumulativeAreas[cumulativeAreas.size() - 1]; + PxReal r = rnd.rand(0.0f, 1.0f) * totalArea; + PxI32 id; + id = binarySearch(cumulativeAreas, r); + + triId = nearbyTriangles[id]; + sample = randomPointOnTriangle(rnd, &triangles[3 * triId], points, barycentricCoordinates); + + const PxReal dist2 = (sample - point).magnitudeSquared(); + if (dist2 > radius * radius && dist2 < rUpper * rUpper) + return true; + if (dist2 > radius * radius && dist2 < 4 * radius * radius && dist2 < fallbackDist) + { + fallbackDist = dist2; + fallbackId = triId; + fallback = sample; + if (barycentricCoordinates) + fallbackBary = *barycentricCoordinates; + } + rUpper += step; + } + if (fallbackId >= 0) + { + sample = fallback; + triId = fallbackId; + if (barycentricCoordinates) + *barycentricCoordinates = fallbackBary; + return true; + } + + return false; + } + } + + class PoissonSamplerShared + { + private: + struct SparseGridNode + { + PxI32 mPointIndex; + PxI32 mExcessStartIndex; + PxI32 mExcessEndIndex; + + SparseGridNode(PxI32 pointIndex_) : mPointIndex(pointIndex_), mExcessStartIndex(0), mExcessEndIndex(-1) + { + } + + SparseGridNode() : mPointIndex(-1), mExcessStartIndex(0), mExcessEndIndex(-1) + { } + }; + + //Returns true if successful. False if too many cells are required (overflow) + bool rebuildSparseGrid(); + + public: + PoissonSamplerShared() : maxNumSamples(0), currentSamplingRadius(0.0f) {} + + //Returns true if successful. False if too many cells are required (overflow) + bool setSamplingRadius(PxReal r); + + void addSamples(const PxArray& samples); + + PxU32 removeSamples(const PxArray& samples); + + PxI32 findSample(const PxVec3& p); + + PxReal minDistanceToOtherSamplesSquared(const PxVec3& p) const; + + const PxArray& getSamples() const { return result; } + + bool addPointToSparseGrid(const PxVec3& p, PxI32 pointIndex); + + protected: + bool postAddPointToSparseGrid(const PxVec3& p, PxI32 pointIndex); + bool preAddPointToSparseGrid(const PxVec3& p, PxI32 pointIndex); + + public: + //Input + PxI32 numSampleAttemptsAroundPoint; + PxVec3 size; + PxVec3 min; + PxU32 maxNumSamples; + + //Intermediate data + PxReal currentSamplingRadius; + Int3 resolution; + PxReal cellSize; + PxArray occupiedCellBits; + PxHashMap sparseGrid3D; + PxArray excessList; + Cm::BasicRandom rnd; + + bool gridResolutionValid = false; + + //Output + PxArray result; + + PX_NOCOPY(PoissonSamplerShared) + }; + + struct PointInVolumeTester + { + virtual bool pointInVolume(const PxVec3& p) const = 0; + + virtual ~PointInVolumeTester() {} + }; + + PX_FORCE_INLINE bool pointInSphere(const PxVec3& p, const PxVec3& sphereCenter, PxReal sphereRadius) + { + return (p - sphereCenter).magnitudeSquared() < sphereRadius * sphereRadius; + } + + struct AlwaysInsideTester : public PointInVolumeTester + { + AlwaysInsideTester() {} + + virtual bool pointInVolume(const PxVec3&) const + { + return true; + } + + virtual ~AlwaysInsideTester() {} + }; + + struct PointInSphereTester : public PointInVolumeTester + { + PxVec3 mCenter; + PxReal mRadius; + + PointInSphereTester(const PxVec3& center, const PxReal radius) : mCenter(center), mRadius(radius) {} + + virtual bool pointInVolume(const PxVec3& p) const + { + return pointInSphere(p, mCenter, mRadius); + } + + virtual ~PointInSphereTester() {} + }; + + struct PointInOBBTester : public PointInVolumeTester + { + PxVec3 mBoxCenter; + PxVec3 mBoxAxisAlignedExtents; + PxQuat mBoxOrientation; + + PointInOBBTester(const PxVec3& boxCenter, const PxVec3& boxAxisAlignedExtents, const PxQuat boxOrientation) + : mBoxCenter(boxCenter), mBoxAxisAlignedExtents(boxAxisAlignedExtents), mBoxOrientation(boxOrientation) {} + + virtual bool pointInVolume(const PxVec3& p) const + { + PxVec3 localPoint = mBoxOrientation.rotateInv(p - mBoxCenter); + return localPoint.x >= -mBoxAxisAlignedExtents.x && localPoint.x <= mBoxAxisAlignedExtents.x && + localPoint.y >= -mBoxAxisAlignedExtents.y && localPoint.y <= mBoxAxisAlignedExtents.y && + localPoint.z >= -mBoxAxisAlignedExtents.z && localPoint.z <= mBoxAxisAlignedExtents.z; + } + + virtual ~PointInOBBTester() {} + }; + + class TriangleMeshPoissonSampler : public PxTriangleMeshPoissonSampler + { + public: + TriangleMeshPoissonSampler(const PxU32* tris, PxU32 numTris, const PxVec3* pts_, PxU32 numPts, PxReal r, PxI32 numSampleAttemptsAroundPoint_ = 30, PxU32 maxNumSamples_ = 0); + + virtual void addSamplesInVolume(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples); + + virtual void addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples); + + virtual void addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples); + + virtual const PxArray& getSampleTriangleIds() const { return triangleIds; } + + virtual const PxArray& getSampleBarycentrics() const { return barycentricCoordinates; } + + virtual bool setSamplingRadius(PxReal samplingRadius) { return poissonSamplerShared.setSamplingRadius(samplingRadius); } + + virtual void addSamples(const PxArray& samples) { poissonSamplerShared.addSamples(samples); } + + void createVolumeSamples(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, PxReal randomScale, PxReal r, bool addToSparseGrid = true); + + virtual PxU32 removeSamples(const PxArray& samples) { return poissonSamplerShared.removeSamples(samples); } + + virtual const PxArray& getSamples() const { return poissonSamplerShared.result; } + + virtual bool isPointInTriangleMesh(const PxVec3& p); + + virtual ~TriangleMeshPoissonSampler() { } + + public: + bool pointInMesh(const PxVec3& p); + + PoissonSamplerShared poissonSamplerShared; + + //Input + const PxVec3* originalPoints; + const PxU32* originalTriangles; + const PxU32 numOriginalTriangles; + + PxVec3 max; + + PxArray points; + PxArray triangles; + PxArray triangleMap; + PxArray triangleAreaBuffer; + PxArray adj; + + PxArray tree; + PxHashMap clusters; + + //Intermediate data + PxArray activeSamples; + + //Output + PxArray triangleIds; + PxArray barycentricCoordinates; + + PX_NOCOPY(TriangleMeshPoissonSampler) + }; + + class ShapePoissonSampler : public PxPoissonSampler + { + public: + ShapePoissonSampler(const PxGeometry& geometry_, const PxTransform& transform_, const PxBounds3& worldBounds_, PxReal r, PxI32 numSampleAttemptsAroundPoint_ = 30, PxU32 maxNumSamples_ = 0); + + virtual void addSamplesInVolume(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples); + + virtual void addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples); + + virtual void addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples); + + virtual bool setSamplingRadius(PxReal samplingRadius) { return poissonSamplerShared.setSamplingRadius(samplingRadius); } + + virtual void addSamples(const PxArray& samples) { poissonSamplerShared.addSamples(samples); } + + void createVolumeSamples(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, PxReal randomScale, PxReal r, bool addToSparseGrid = true); + + virtual PxU32 removeSamples(const PxArray& samples) { return poissonSamplerShared.removeSamples(samples); } + + virtual const PxArray& getSamples() const { return poissonSamplerShared.result; } + + virtual ~ShapePoissonSampler() { } + + public: + PoissonSamplerShared poissonSamplerShared; + + //Input + const PxGeometry& shape; + const PxTransform actorGlobalPose; + + //Intermediate data + PxArray activeSamples; + }; + + bool TriangleMeshPoissonSampler::pointInMesh(const PxVec3& p) + { + return Gu::computeWindingNumber(tree.begin(), p, clusters, originalTriangles, originalPoints) > 0.5f; + } + + + PxPoissonSampler* PxCreateShapeSampler(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal r, PxI32 numSampleAttemptsAroundPoint) + { + return PX_NEW(ShapePoissonSampler)(geometry, transform, worldBounds, r, numSampleAttemptsAroundPoint); + } + + PxTriangleMeshPoissonSampler* PxCreateTriangleMeshSampler(const PxU32* tris, PxU32 numTris, const PxVec3* pts, PxU32 numPts, PxReal r, PxI32 numSampleAttemptsAroundPoint) + { + return PX_NEW(TriangleMeshPoissonSampler)(tris, numTris, pts, numPts, r, numSampleAttemptsAroundPoint); + } + + PxVec3 computeBarycentricCoordinates(PxVec3 p, const PxVec3& a, PxVec3 b, PxVec3 c) + { + PxVec4 bary; + computeBarycentric(a, b, c, p, bary); + return PxVec3(bary.x, bary.y, bary.z); + } + + + ShapePoissonSampler::ShapePoissonSampler(const PxGeometry& shape_, const PxTransform& actorGlobalPose_, const PxBounds3& worldBounds_, + PxReal r, PxI32 numSampleAttemptsAroundPoint_, PxU32 maxNumSamples_) : shape(shape_), actorGlobalPose(actorGlobalPose_) + { + poissonSamplerShared.size = worldBounds_.maximum - worldBounds_.minimum; + poissonSamplerShared.min = worldBounds_.minimum; + poissonSamplerShared.numSampleAttemptsAroundPoint = numSampleAttemptsAroundPoint_; + poissonSamplerShared.maxNumSamples = maxNumSamples_; + + setSamplingRadius(r); + } + + TriangleMeshPoissonSampler::TriangleMeshPoissonSampler(const PxU32* tris, PxU32 numTris, const PxVec3* pts_, PxU32 numPts, PxReal r, PxI32 numSampleAttemptsAroundPoint_, PxU32 maxNumSamples_) + : originalPoints(pts_), originalTriangles(tris), numOriginalTriangles(numTris) + { + poissonSamplerShared.currentSamplingRadius = 0.0f; + poissonSamplerShared.numSampleAttemptsAroundPoint = numSampleAttemptsAroundPoint_; + poissonSamplerShared.maxNumSamples = maxNumSamples_; + + getBoundsFromPoints(originalPoints, numPts, poissonSamplerShared.min, max); + poissonSamplerShared.size = max - poissonSamplerShared.min; + + points.assign(originalPoints, originalPoints + numPts); + triangles.assign(tris, tris + 3 * numTris); + PxRemeshingExt::limitMaxEdgeLength(triangles, points, 2.0f * r, 100, &triangleMap, PxMax(10000u, 4 * numTris)); + + PxU32 numTriangles = triangles.size() / 3; + triangleAreaBuffer.resize(numTriangles); + for (PxU32 i = 0; i < numTriangles; ++i) + triangleAreaBuffer[i] = triArea(&triangles[3 * i], points.begin()); + + buildTriangleAdjacency(triangles.begin(), numTriangles, adj); + + setSamplingRadius(r); + } + + void PoissonSamplerShared::addSamples(const PxArray& samples) + { + if (samples.size() > 0) + { + for (PxU32 i = 0; i < samples.size(); ++i) + { + result.pushBack(samples[i]); + } + rebuildSparseGrid(); + } + } + + PxI32 PoissonSamplerShared::findSample(const PxVec3& p) + { + PxI32 x = PxI32((p.x - min.x) / cellSize); + PxI32 y = PxI32((p.y - min.y) / cellSize); + PxI32 z = PxI32((p.z - min.z) / cellSize); + if (x >= resolution.x) x = resolution.x - 1; + if (y >= resolution.y) y = resolution.y - 1; + if (z >= resolution.z) z = resolution.z - 1; + + PxReal minDist = FLT_MAX; + PxI32 index = -1; + for (PxI32 oX = -1; oX <= 1; ++oX) + { + for (PxI32 oY = -1; oY <= 1; ++oY) + { + for (PxI32 oZ = -1; oZ <= 1; ++oZ) + { + const PxI32 xx = x + oX; + const PxI32 yy = y + oY; + const PxI32 zz = z + oZ; + + if (xx >= 0 && xx < resolution.x && yy >= 0 && yy < resolution.y && zz >= 0 && zz < resolution.z) + { + PxI32 cellIndex = xx + resolution.x * yy + (resolution.x * resolution.y) * zz; + if ((occupiedCellBits[cellIndex >> 5] & (1u << (cellIndex & 31))) != 0) + { + const PxPair* it = sparseGrid3D.find(cellIndex); + if (it) + { + const PxReal dist2 = (result[it->second.mPointIndex] - p).magnitudeSquared(); + if (dist2 < minDist) + { + minDist = dist2; + index = it->second.mPointIndex; + } + if (it->second.mExcessStartIndex >= 0) + { + for (PxI32 i = it->second.mExcessStartIndex; i < it->second.mExcessEndIndex; ++i) + { + const PxReal dist2_ = (result[excessList[i]] - p).magnitudeSquared(); + if (dist2_ < minDist) + { + minDist = dist2_; + index = it->second.mPointIndex; + } + } + } + if (minDist == 0.0f) + { + return index; + } + } + } + } + } + } + } + return -1; + } + + PxU32 PoissonSamplerShared::removeSamples(const PxArray& samples) + { + if (samples.size() > 0) + { + PxArray samplesToRemove; + samplesToRemove.reserve(samples.size()); + for (PxU32 i = 0; i < samples.size(); ++i) + { + PxI32 index = findSample(samples[i]); + PX_ASSERT(samples[i] == result[index]); + if (index >= 0) + samplesToRemove.pushBack(index); + } + + PxSort(samplesToRemove.begin(), samplesToRemove.size()); + + PxI32 counter = 0; + for (PxI32 i = PxI32(samplesToRemove.size()) - 1; i >= 0; --i) + { + result[samplesToRemove[i]] = result[result.size() - 1 - counter]; + ++counter; + } + result.removeRange(result.size() - counter, counter); + + rebuildSparseGrid(); + return samplesToRemove.size(); + } + return 0; + } + + bool PoissonSamplerShared::setSamplingRadius(PxReal r) + { + if (r != currentSamplingRadius) + { + currentSamplingRadius = r; + return rebuildSparseGrid(); + } + return gridResolutionValid; + } + + bool PoissonSamplerShared::rebuildSparseGrid() + { + const PxReal dimension = 3.0f; + cellSize = (currentSamplingRadius / PxSqrt(dimension)) * 0.9999f; + + const PxF64 cellsX = PxF64(size.x) / PxF64(cellSize); + const PxF64 cellsY = PxF64(size.y) / PxF64(cellSize); + const PxF64 cellsZ = PxF64(size.z) / PxF64(cellSize); + + resolution = Int3(PxMax(1, PxI32(ceil(cellsX))), PxMax(1, PxI32(ceil(cellsY))), PxMax(1, PxI32(ceil(cellsZ)))); + + const PxF64 numCellsDbl = PxF64(resolution.x) * PxF64(resolution.y) * PxI64(resolution.z); + if (numCellsDbl >= (1u << 31) || + cellsX >= (1u << 31) || + cellsY >= (1u << 31) || + cellsZ >= (1u << 31)) + { + gridResolutionValid = false; + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, PX_FL, "Internal grid resolution of sampler too high. Either a smaller mesh or a bigger radius must be used."); + return false; + } + + gridResolutionValid = true; + + PxU32 numCells = PxU32(resolution.x * resolution.y * resolution.z); + + occupiedCellBits.clear(); + occupiedCellBits.resize((numCells + 32 - 1) / 32, 0); + sparseGrid3D.clear(); + + for (PxU32 i = 0; i < result.size(); ++i) + preAddPointToSparseGrid(result[i], i); + + PxI32 cumulativeSum = 0; + for (PxHashMap::Iterator iter = sparseGrid3D.getIterator(); !iter.done(); ++iter) + { + if (iter->second.mExcessStartIndex > 0) + { + PxI32 start = cumulativeSum; + cumulativeSum += iter->second.mExcessStartIndex; + iter->second.mExcessStartIndex = start; + iter->second.mExcessEndIndex = start - 1; + } + else + { + iter->second.mExcessStartIndex = -1; + } + } + excessList.resize(cumulativeSum); + for (PxU32 i = 0; i < result.size(); ++i) + postAddPointToSparseGrid(result[i], i); + + return true; + } + + bool PoissonSamplerShared::postAddPointToSparseGrid(const PxVec3& p, PxI32 pointIndex) + { + PxI32 x = PxI32((p.x - min.x) / cellSize); + PxI32 y = PxI32((p.y - min.y) / cellSize); + PxI32 z = PxI32((p.z - min.z) / cellSize); + if (x >= resolution.x) x = resolution.x - 1; + if (y >= resolution.y) y = resolution.y - 1; + if (z >= resolution.z) z = resolution.z - 1; + + PxI32 cellIndex = x + resolution.x * y + (resolution.x * resolution.y) * z; + + SparseGridNode& n = sparseGrid3D[cellIndex]; + if (n.mExcessStartIndex < 0) + { + PX_ASSERT(n.mPointIndex == pointIndex); + return true; + } + + if (n.mExcessEndIndex < n.mExcessStartIndex) + { + PX_ASSERT(n.mPointIndex == pointIndex); + n.mExcessEndIndex++; + return true; + } + else + { + excessList[n.mExcessEndIndex] = pointIndex; + n.mExcessEndIndex++; + return true; + } + } + + bool PoissonSamplerShared::preAddPointToSparseGrid(const PxVec3& p, PxI32 pointIndex) + { + PxI32 x = PxI32((p.x - min.x) / cellSize); + PxI32 y = PxI32((p.y - min.y) / cellSize); + PxI32 z = PxI32((p.z - min.z) / cellSize); + if (x >= resolution.x) x = resolution.x - 1; + if (y >= resolution.y) y = resolution.y - 1; + if (z >= resolution.z) z = resolution.z - 1; + + PxI32 cellIndex = x + resolution.x * y + (resolution.x * resolution.y) * z; + + if ((occupiedCellBits[cellIndex >> 5] & (1u << (cellIndex & 31))) != 0) + { + SparseGridNode& n = sparseGrid3D[cellIndex]; + n.mExcessStartIndex++; + return true; + } + else + { + sparseGrid3D.insert(cellIndex, SparseGridNode(pointIndex)); + occupiedCellBits[cellIndex >> 5] ^= (1u << (cellIndex & 31)); + return true; + } + } + + bool PoissonSamplerShared::addPointToSparseGrid(const PxVec3& p, PxI32 pointIndex) + { + PxI32 x = PxI32((p.x - min.x) / cellSize); + PxI32 y = PxI32((p.y - min.y) / cellSize); + PxI32 z = PxI32((p.z - min.z) / cellSize); + if (x >= resolution.x) x = resolution.x - 1; + if (y >= resolution.y) y = resolution.y - 1; + if (z >= resolution.z) z = resolution.z - 1; + + PxI32 cellIndex = x + resolution.x * y + (resolution.x * resolution.y) * z; + + //if (sparseGrid3D.ContainsKey(cellIndex)) + // return false; + + sparseGrid3D.insert(cellIndex, pointIndex); + occupiedCellBits[cellIndex >> 5] ^= (1u << (cellIndex & 31)); + return true; + } + + PxReal PoissonSamplerShared::minDistanceToOtherSamplesSquared(const PxVec3& p) const + { + PxI32 x = PxI32((p.x - min.x) / cellSize); + PxI32 y = PxI32((p.y - min.y) / cellSize); + PxI32 z = PxI32((p.z - min.z) / cellSize); + if (x >= resolution.x) x = resolution.x - 1; + if (y >= resolution.y) y = resolution.y - 1; + if (z >= resolution.z) z = resolution.z - 1; + + PxReal minDist = FLT_MAX; + + for (PxI32 oX = -2; oX <= 2; ++oX) + { + for (PxI32 oY = -2; oY <= 2; ++oY) + { + for (PxI32 oZ = -2; oZ <= 2; ++oZ) + { + const PxI32 xx = x + oX; + const PxI32 yy = y + oY; + const PxI32 zz = z + oZ; + + if (xx >= 0 && xx < resolution.x && yy >= 0 && yy < resolution.y && zz >= 0 && zz < resolution.z) + { + PxI32 cellIndex = xx + resolution.x * yy + (resolution.x * resolution.y) * zz; + if ((occupiedCellBits[cellIndex >> 5] & (1u << (cellIndex & 31))) != 0) + { + const PxPair* it = sparseGrid3D.find(cellIndex); + if (it) + { + const PxReal dist2 = (result[it->second.mPointIndex] - p).magnitudeSquared(); + if (dist2 < minDist) + minDist = dist2; + if (it->second.mExcessStartIndex >= 0) + { + for (PxI32 i = it->second.mExcessStartIndex; i < it->second.mExcessEndIndex; ++i) + { + const PxReal dist2_ = (result[excessList[i]] - p).magnitudeSquared(); + if (dist2_ < minDist) + minDist = dist2_; + } + } + } + } + } + } + } + } + + return minDist; + } + + + void buildTree(const PxU32* triangles, const PxU32 numTriangles, const PxVec3* points, PxArray& tree, PxF32 enlargement = 1e-4f) + { + //Computes a bounding box for every triangle in triangles + Gu::AABBTreeBounds boxes; + boxes.init(numTriangles); + for (PxU32 i = 0; i < numTriangles; ++i) + { + const PxU32* tri = &triangles[3 * i]; + PxBounds3 box = PxBounds3::empty(); + box.include(points[tri[0]]); + box.include(points[tri[1]]); + box.include(points[tri[2]]); + box.fattenFast(enlargement); + boxes.getBounds()[i] = box; + } + + Gu::buildAABBTree(numTriangles, boxes, tree); + } + + bool TriangleMeshPoissonSampler::isPointInTriangleMesh(const PxVec3& p) + { + if (tree.size() == 0) + { + //Lazy initialization + buildTree(originalTriangles, numOriginalTriangles, originalPoints, tree); + Gu::precomputeClusterInformation(tree.begin(), originalTriangles, numOriginalTriangles, originalPoints, clusters); + } + + return pointInMesh(p); + } + + void TriangleMeshPoissonSampler::addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples) + { + PointInOBBTester pointInOBB(axisAlignedBox.getCenter(), axisAlignedBox.getExtents(), boxOrientation); + addSamplesInVolume(pointInOBB, axisAlignedBox.getCenter(), axisAlignedBox.getExtents().magnitude(), createVolumeSamples); + } + + void TriangleMeshPoissonSampler::addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples) + { + PointInSphereTester pointInSphere(sphereCenter, sphereRadius); + addSamplesInVolume(pointInSphere, sphereCenter, sphereRadius, createVolumeSamples); + } + + //Ideally the sphere center is located on the mesh's surface + void TriangleMeshPoissonSampler::addSamplesInVolume(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, bool volumeSamples) + { + PxArray localActiveSamples; + for (PxU32 i = 0; i < activeSamples.size();) + { + if (activeSamples[i].mIndex >= PxI32(poissonSamplerShared.result.size())) + { + activeSamples[i] = activeSamples[activeSamples.size() - 1]; + activeSamples.remove(activeSamples.size() - 1); + continue; + } + + if (pointInSphere(poissonSamplerShared.result[activeSamples[i].mIndex], sphereCenter, sphereRadius)) + localActiveSamples.pushBack(i); + + ++i; + } + + if (localActiveSamples.size() == 0) + { + const PxReal r = poissonSamplerShared.currentSamplingRadius; + + //Try to find a seed sample + for (PxU32 i = 0; i < triangles.size(); i += 3) + { + PxVec3 p = (1.0f / 3.0f) * (points[triangles[i]] + points[triangles[i + 1]] + points[triangles[i + 2]]); + PxReal triRadius = PxSqrt(PxMax((p - points[triangles[i]]).magnitudeSquared(), PxMax((p - points[triangles[i + 1]]).magnitudeSquared(), (p - points[triangles[i + 2]]).magnitudeSquared()))); + PxReal sum = triRadius + sphereRadius; + if ((p - sphereCenter).magnitudeSquared() < sum * sum) + { + bool success = false; + for (PxI32 j = 0; j < 30; ++j) + { + PxVec3 sample = randomPointOnTriangle(poissonSamplerShared.rnd, triangles.begin() + i, points.begin()); + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(sample) > r * r) + { + if (pointInVolume.pointInVolume(sample)) + { + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + PxU32 sampleTriId = i / 3; + + ActiveSample as; + createActiveSample(triangleAreaBuffer, newSampleId, sample, 2 * r, sampleTriId, triangles.begin(), points.begin(), adj, as); + localActiveSamples.pushBack(activeSamples.size()); + activeSamples.pushBack(as); + + poissonSamplerShared.result.pushBack(sample); + triangleIds.pushBack(triangleMap[sampleTriId]); + { + const PxU32 triId = triangleMap[sampleTriId]; + const PxU32* origTri = &originalTriangles[3 * triId]; + barycentricCoordinates.pushBack(computeBarycentricCoordinates(sample, originalPoints[origTri[0]], originalPoints[origTri[1]], originalPoints[origTri[2]])); + } + + poissonSamplerShared.addPointToSparseGrid(sample, newSampleId); + + success = true; + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + + break; + } + } + } + if (success) + break; + } + } + } + + //Start poisson sampling + while (localActiveSamples.size() > 0) + { + const PxReal r = poissonSamplerShared.currentSamplingRadius; + + PxI32 localSampleIndex = poissonSamplerShared.rnd.rand32() % localActiveSamples.size(); + PxI32 selectedActiveSample = localActiveSamples[localSampleIndex]; + const ActiveSample& s = activeSamples[selectedActiveSample]; + + bool successDist = false; + bool success = false; + for (PxI32 i = 0; i < poissonSamplerShared.numSampleAttemptsAroundPoint; ++i) + { + PxI32 sampleTriId; + PxVec3 barycentricCoordinate; + PxVec3 sample; + if (samplePointInBallOnSurface(poissonSamplerShared.rnd, s.mCumulativeTriangleAreas, points.begin(), triangles.begin(), s.mNearbyTriangles, poissonSamplerShared.result[s.mIndex], r, sample, sampleTriId, 30, &barycentricCoordinate)) + { + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(sample) > r * r) + { + successDist = true; + if (pointInVolume.pointInVolume(sample)) + { + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + + ActiveSample as; + createActiveSample(triangleAreaBuffer, newSampleId, sample, 2 * r, sampleTriId, triangles.begin(), points.begin(), adj, as); + localActiveSamples.pushBack(activeSamples.size()); + activeSamples.pushBack(as); + + poissonSamplerShared.result.pushBack(sample); + triangleIds.pushBack(triangleMap[sampleTriId]); + { + const PxU32 triId = triangleMap[sampleTriId]; + const PxU32* origTri = &originalTriangles[3 * triId]; + barycentricCoordinates.pushBack(computeBarycentricCoordinates(sample, originalPoints[origTri[0]], originalPoints[origTri[1]], originalPoints[origTri[2]])); + } + + poissonSamplerShared.addPointToSparseGrid(sample, newSampleId); + success = true; + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + + break; + } + } + } + } + if (!successDist) + { + PxU32 oldId = activeSamples.size() - 1; + activeSamples[selectedActiveSample] = activeSamples[activeSamples.size() - 1]; + activeSamples.remove(activeSamples.size() - 1); + + for (PxU32 i = 0; i < localActiveSamples.size(); ++i) + { + if (localActiveSamples[i] == oldId) + { + localActiveSamples[i] = selectedActiveSample; + break; + } + } + } + if (!success) + { + localActiveSamples[localSampleIndex] = localActiveSamples[localActiveSamples.size() - 1]; + localActiveSamples.remove(localActiveSamples.size() - 1); + } + } + + if (volumeSamples) + { + PxReal randomScale = 0.1f; //Relative to particleSpacing + PxReal r = (1.0f + 2.0f * randomScale) * 1.001f * poissonSamplerShared.currentSamplingRadius; + createVolumeSamples(pointInVolume, sphereCenter, sphereRadius, randomScale, r); + } + } + + void TriangleMeshPoissonSampler::createVolumeSamples(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, PxReal randomScale, PxReal r, bool addToSparseGrid) + { + if (tree.size() == 0) + { + //Lazy initialization + buildTree(originalTriangles, numOriginalTriangles, originalPoints, tree); + Gu::precomputeClusterInformation(tree.begin(), originalTriangles, numOriginalTriangles, originalPoints, clusters); + } + + + PxVec3 sphereBoxMin = PxVec3(sphereCenter.x - sphereRadius, sphereCenter.y - sphereRadius, sphereCenter.z - sphereRadius) - poissonSamplerShared.min; + PxVec3 sphereBoxMax = PxVec3(sphereCenter.x + sphereRadius, sphereCenter.y + sphereRadius, sphereCenter.z + sphereRadius) - poissonSamplerShared.min; + + Int3 start(PxI32(PxFloor(sphereBoxMin.x / r)), PxI32(PxFloor(sphereBoxMin.y / r)), PxI32(PxFloor(sphereBoxMin.z / r))); + Int3 end(PxI32(PxCeil(sphereBoxMax.x / r)), PxI32(PxCeil(sphereBoxMax.y / r)), PxI32(PxCeil(sphereBoxMax.z / r))); + + for (PxI32 x = start.x; x < end.x; ++x) + { + for (PxI32 y = start.y; y < end.y; ++y) + { + for (PxI32 z = start.z; z < end.z; ++z) + { + PxVec3 p = poissonSamplerShared.min + PxVec3(x * r, y * r, z * r); + p += PxVec3(poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius, + poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius, + poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius); + if (pointInVolume.pointInVolume(p)) + { + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(p) > poissonSamplerShared.currentSamplingRadius * poissonSamplerShared.currentSamplingRadius && pointInMesh(p)) + { + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + poissonSamplerShared.result.pushBack(p); + + if (addToSparseGrid) + poissonSamplerShared.addPointToSparseGrid(p, newSampleId); + + triangleIds.pushBack(-1); + barycentricCoordinates.pushBack(PxVec3(0.0f)); + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + } + } + } + } + } + } + + + + PxU32 PX_FORCE_INLINE raycast(const PxGeometry& geometry, const PxTransform& transform, + const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, PxHitFlags hitFlags, + PxU32 maxHits, PxRaycastHit* rayHits) + { + return PxGeometryQuery::raycast( + rayOrigin, rayDir, geometry, transform, maxDist, hitFlags, maxHits, rayHits); + } + + bool PX_FORCE_INLINE pointInShape(const PxGeometry& geometry, const PxTransform& transform, const PxVec3& p) + { + //This is a bit a work-around solution: When a raycast starts inside of a shape, it returns the ray origin as hit point + PxRaycastHit hit; + return PxGeometryQuery::raycast(p, PxVec3(1.0f, 0.0f, 0.0f), geometry, transform, + 1.0f, PxHitFlag::ePOSITION, 1, &hit) > 0 && hit.position == p; + } + + bool projectionCallback(PxReal targetDistance, const PxGeometry& geometry, const PxTransform& transform, PxReal boundingBoxDiagonalLength, const PxVec3& p, const PxVec3& n, PointWithNormal& result) + { + PxRaycastHit hitPos; + PxU32 numHitsPos = raycast(geometry, transform, p - boundingBoxDiagonalLength * n, n, 2 * boundingBoxDiagonalLength, PxHitFlag::eMESH_BOTH_SIDES | PxHitFlag::ePOSITION | PxHitFlag::eNORMAL, 1, &hitPos); + + PxRaycastHit hitNeg; + PxU32 numHitsNeg = raycast(geometry, transform, p + boundingBoxDiagonalLength * n, -n, 2 * boundingBoxDiagonalLength, PxHitFlag::eMESH_BOTH_SIDES | PxHitFlag::ePOSITION | PxHitFlag::eNORMAL, 1, &hitNeg); + + targetDistance *= 0.5f; + + if (numHitsPos && numHitsNeg) + { + if (PxAbs((hitPos.position - p).magnitude() - targetDistance) < PxAbs((hitNeg.position - p).magnitude() - targetDistance)) + result = PointWithNormal(hitPos.position, hitPos.normal); + else + result = PointWithNormal(hitNeg.position, hitNeg.normal); + return true; + } + else if (numHitsPos) + { + result = PointWithNormal(hitPos.position, hitPos.normal); + return true; + } + else if (numHitsNeg) + { + result = PointWithNormal(hitNeg.position, hitNeg.normal); + return true; + } + return false; + } + + PxVec3 randomDirection(BasicRandom& rnd) + { + PxVec3 dir; + do + { + dir = PxVec3((rnd.rand(0.0f, 1.0f) - 0.5f), (rnd.rand(0.0f, 1.0f) - 0.5f), (rnd.rand(0.0f, 1.0f) - 0.5f)); + } while (dir.magnitudeSquared() < 1e-8f); + return dir.getNormalized(); + } + + + + PxVec3 getPerpendicularVectorNormalized(const PxVec3& dir) + { + PxReal x = PxAbs(dir.x); + PxReal y = PxAbs(dir.y); + PxReal z = PxAbs(dir.z); + if (x >= y && x >= z) + return dir.cross(PxVec3(0, 1, 0)).getNormalized(); + else if (y >= x && y >= z) + return dir.cross(PxVec3(0, 0, 1)).getNormalized(); + else + return dir.cross(PxVec3(1, 0, 0)).getNormalized(); + } + + PxVec3 randomPointOnDisc(BasicRandom& rnd, const PxVec3& point, const PxVec3& normal, PxReal radius, PxReal rUpper) + { + //TODO: Use better random number generator + PxReal r = radius + rnd.rand(0.0f, 1.0f) * (rUpper - radius); + PxVec3 x = getPerpendicularVectorNormalized(normal); + PxVec3 y = normal.cross(x).getNormalized(); + PxReal angle = rnd.rand(0.0f, 1.0f) * (2.0f * 3.1415926535898f); + return point + x * (r * PxCos(angle)) + y * (r * PxSin(angle)); + } + + bool samplePointInBallOnSurface(BasicRandom& rnd, const PxGeometry& shape, const PxTransform& actorGlobalPose, const PxReal diagonalLength, + const PxVec3& point, const PxVec3& normal, PxReal radius, PointWithNormal& sample, PxI32 numAttempts = 30) + { + for (PxI32 i = 0; i < numAttempts; ++i) { + PxVec3 p = randomPointOnDisc(rnd, point, normal, radius, 2 * radius); + + //Distort the direction of the normal a bit + PxVec3 n = normal; + do + { + n.x += 0.5f * (rnd.rand(0.0f, 1.0f) - 0.5f); + n.y += 0.5f * (rnd.rand(0.0f, 1.0f) - 0.5f); + n.z += 0.5f * (rnd.rand(0.0f, 1.0f) - 0.5f); + } while (n.magnitudeSquared() < 1e-8f); + + n.normalize(); + + if (projectionCallback(radius, shape, actorGlobalPose, diagonalLength, p, n, sample)) + { + PxReal d2 = (sample.mPoint - point).magnitudeSquared(); + if (d2 >= radius * radius && d2 < 4 * radius * radius) + return true; + } + } + return false; + } + + + void ShapePoissonSampler::addSamplesInBox(const PxBounds3& axisAlignedBox, const PxQuat& boxOrientation, bool createVolumeSamples) + { + PointInOBBTester pointInOBB(axisAlignedBox.getCenter(), axisAlignedBox.getExtents(), boxOrientation); + addSamplesInVolume(pointInOBB, axisAlignedBox.getCenter(), axisAlignedBox.getExtents().magnitude(), createVolumeSamples); + } + + void ShapePoissonSampler::addSamplesInSphere(const PxVec3& sphereCenter, PxReal sphereRadius, bool createVolumeSamples) + { + PointInSphereTester pointInSphere(sphereCenter, sphereRadius); + addSamplesInVolume(pointInSphere, sphereCenter, sphereRadius, createVolumeSamples); + } + + void ShapePoissonSampler::addSamplesInVolume(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, bool volumeSamples) + { + PxReal boundingBoxDiagonalLength = poissonSamplerShared.size.magnitude(); + + PxArray localActiveSamples; + for (PxU32 i = 0; i < activeSamples.size();) + { + if (activeSamples[i].mIndex >= PxI32(poissonSamplerShared.result.size())) + { + activeSamples[i] = activeSamples[activeSamples.size() - 1]; + activeSamples.remove(activeSamples.size() - 1); + continue; + } + + if (pointInSphere(poissonSamplerShared.result[activeSamples[i].mIndex], sphereCenter, sphereRadius)) + localActiveSamples.pushBack(i); + + ++i; + } + + if (localActiveSamples.size() == 0) + { + PxVec3 center = poissonSamplerShared.min + 0.5f * poissonSamplerShared.size;; + PointWithNormal sample; + PxVec3 arbitrarySeedPointOnSurface; + + PxVec3 reference = sphereCenter - center; + reference.normalizeSafe(); + + + for (PxI32 i = 0; i < 1000; ++i) + { + PxVec3 dir = /*reference + 0.5f**/randomDirection(poissonSamplerShared.rnd); + dir.normalize(); + if (projectionCallback(poissonSamplerShared.currentSamplingRadius, shape, actorGlobalPose, boundingBoxDiagonalLength, sphereCenter, dir, sample)) + { + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(sample.mPoint) > poissonSamplerShared.currentSamplingRadius * poissonSamplerShared.currentSamplingRadius) + { + if (pointInVolume.pointInVolume(sample.mPoint)) + { + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + + localActiveSamples.pushBack(activeSamples.size()); + activeSamples.pushBack(IndexWithNormal(newSampleId, sample.mNormal)); + + poissonSamplerShared.result.pushBack(sample.mPoint); + poissonSamplerShared.addPointToSparseGrid(sample.mPoint, newSampleId); + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + + break; + } + } + } + } + } + + while (localActiveSamples.size() > 0) + { + PxI32 localSampleIndex = poissonSamplerShared.rnd.rand32() % localActiveSamples.size(); + PxI32 selectedActiveSample = localActiveSamples[localSampleIndex]; + const IndexWithNormal& s = activeSamples[selectedActiveSample]; + + bool successDist = false; + bool success = false; + for (PxI32 i = 0; i < poissonSamplerShared.numSampleAttemptsAroundPoint; ++i) + { + PointWithNormal sample; + if (samplePointInBallOnSurface(poissonSamplerShared.rnd, shape, actorGlobalPose, boundingBoxDiagonalLength, poissonSamplerShared.result[s.mIndex], s.mNormal, poissonSamplerShared.currentSamplingRadius, sample)) + { + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(sample.mPoint) > poissonSamplerShared.currentSamplingRadius * poissonSamplerShared.currentSamplingRadius) + { + successDist = true; + if (pointInVolume.pointInVolume(sample.mPoint)) + { + successDist = true; + + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + localActiveSamples.pushBack(activeSamples.size()); + activeSamples.pushBack(IndexWithNormal(newSampleId, sample.mNormal)); + + poissonSamplerShared.result.pushBack(sample.mPoint); + poissonSamplerShared.addPointToSparseGrid(sample.mPoint, newSampleId); + success = true; + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + + break; + } + } + } + } + if (!successDist) + { + PxU32 oldId = activeSamples.size() - 1; + activeSamples[selectedActiveSample] = activeSamples[activeSamples.size() - 1]; + activeSamples.remove(activeSamples.size() - 1); + + for (PxU32 i = 0; i < localActiveSamples.size(); ++i) + { + if (localActiveSamples[i] == oldId) + { + localActiveSamples[i] = selectedActiveSample; + break; + } + } + } + if (!success) + { + localActiveSamples[localSampleIndex] = localActiveSamples[localActiveSamples.size() - 1]; + localActiveSamples.remove(localActiveSamples.size() - 1); + } + } + + if (volumeSamples) + { + PxReal randomScale = 0.1f; //Relative to particleSpacing + PxReal r = (1.0f + 2.0f * randomScale) * 1.001f * poissonSamplerShared.currentSamplingRadius; + createVolumeSamples(pointInVolume, sphereCenter, sphereRadius, randomScale, r); + } + } + + void ShapePoissonSampler::createVolumeSamples(const PointInVolumeTester& pointInVolume, const PxVec3& sphereCenter, PxReal sphereRadius, PxReal randomScale, PxReal r, bool addToSparseGrid) + { + PxVec3 sphereBoxMin = PxVec3(sphereCenter.x - sphereRadius, sphereCenter.y - sphereRadius, sphereCenter.z - sphereRadius) - poissonSamplerShared.min; + PxVec3 sphereBoxMax = PxVec3(sphereCenter.x + sphereRadius, sphereCenter.y + sphereRadius, sphereCenter.z + sphereRadius) - poissonSamplerShared.min; + + Int3 start(PxI32(PxFloor(sphereBoxMin.x / r)), PxI32(PxFloor(sphereBoxMin.y / r)), PxI32(PxFloor(sphereBoxMin.z / r))); + Int3 end(PxI32(PxCeil(sphereBoxMax.x / r)), PxI32(PxCeil(sphereBoxMax.y / r)), PxI32(PxCeil(sphereBoxMax.z / r))); + + for (PxI32 x = start.x; x < end.x; ++x) + { + for (PxI32 y = start.y; y < end.y; ++y) + { + for (PxI32 z = start.z; z < end.z; ++z) + { + PxVec3 p = poissonSamplerShared.min + PxVec3(x * r, y * r, z * r); + p += PxVec3(poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius, + poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius, + poissonSamplerShared.rnd.randomFloat32(-randomScale, randomScale) * poissonSamplerShared.currentSamplingRadius); + if (pointInVolume.pointInVolume(p) && pointInShape(shape, actorGlobalPose, p)) + { + if (poissonSamplerShared.minDistanceToOtherSamplesSquared(p) > poissonSamplerShared.currentSamplingRadius * poissonSamplerShared.currentSamplingRadius) + { + PxI32 newSampleId = PxI32(poissonSamplerShared.result.size()); + poissonSamplerShared.result.pushBack(p); + + if (addToSparseGrid) + poissonSamplerShared.addPointToSparseGrid(p, newSampleId); + + if (poissonSamplerShared.maxNumSamples > 0 && poissonSamplerShared.result.size() >= poissonSamplerShared.maxNumSamples) + return; + } + } + } + } + } + } + + //Use for triangle meshes + //https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf + bool PxSamplingExt::poissonSample(const PxSimpleTriangleMesh& mesh, PxReal r, PxArray& result, PxReal rVolume, PxArray* triangleIds, PxArray* barycentricCoordinates, + const PxBounds3* axisAlignedBox, const PxQuat* boxOrientation, PxU32 maxNumSamples, PxU32 numSampleAttemptsAroundPoint) + { + TriangleMeshPoissonSampler sampler(reinterpret_cast(mesh.triangles.data), mesh.triangles.count, reinterpret_cast(mesh.points.data), mesh.points.count, r, numSampleAttemptsAroundPoint, maxNumSamples); + + if (!sampler.poissonSamplerShared.gridResolutionValid) + { + return false; + } + + PxVec3 center = 0.5f*(sampler.max + sampler.poissonSamplerShared.min); + PxReal boundingSphereRadius = 1.001f * (sampler.max - sampler.poissonSamplerShared.min).magnitude() * 0.5f; + + if (axisAlignedBox == NULL || boxOrientation == NULL) + { + sampler.addSamplesInSphere(center, boundingSphereRadius, false); + + if (rVolume > 0.0f) + { + AlwaysInsideTester tester; + sampler.createVolumeSamples(tester, center, boundingSphereRadius, 0.1f, rVolume, false); + } + } + else + { + sampler.addSamplesInBox(*axisAlignedBox, *boxOrientation, false); + + if (rVolume > 0.0f) + { + PointInOBBTester tester(axisAlignedBox->getCenter(), axisAlignedBox->getExtents(), *boxOrientation); + sampler.createVolumeSamples(tester, center, boundingSphereRadius, 0.1f, rVolume, false); + } + } + + result = sampler.getSamples(); + if (triangleIds) + *triangleIds = sampler.getSampleTriangleIds(); + if (barycentricCoordinates) + *barycentricCoordinates = sampler.getSampleBarycentrics(); + + return true; + } + + bool PxSamplingExt::poissonSample(const PxGeometry& geometry, const PxTransform& transform, const PxBounds3& worldBounds, PxReal r, PxArray& result, PxReal rVolume, + const PxBounds3* axisAlignedBox, const PxQuat* boxOrientation, PxU32 maxNumSamples, PxU32 numSampleAttemptsAroundPoint) + { + PxVec3 center = worldBounds.getCenter(); + + ShapePoissonSampler sampler(geometry, transform, worldBounds, r, numSampleAttemptsAroundPoint, maxNumSamples); + PxReal boundingSphereRadius = 1.001f * worldBounds.getExtents().magnitude(); + + if (!sampler.poissonSamplerShared.gridResolutionValid) + return false; + + if (axisAlignedBox == NULL || boxOrientation == NULL) + { + sampler.addSamplesInSphere(center, worldBounds.getExtents().magnitude() * 1.001f, false); + + if (rVolume > 0.0f) + { + AlwaysInsideTester tester; + sampler.createVolumeSamples(tester, center, boundingSphereRadius, 0.1f, rVolume, false); + } + } + else + { + sampler.addSamplesInBox(*axisAlignedBox, *boxOrientation, false); + + if (rVolume > 0.0f) + { + PointInOBBTester tester(axisAlignedBox->getCenter(), axisAlignedBox->getExtents(), *boxOrientation); + sampler.createVolumeSamples(tester, center, boundingSphereRadius, 0.1f, rVolume, false); + } + } + + result = sampler.getSamples(); + return true; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp new file mode 100644 index 0000000..7485e8c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQueryExt.cpp @@ -0,0 +1,696 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxSceneQueryExt.h" +#include "geometry/PxGeometryHelpers.h" +#include "foundation/PxAllocatorCallback.h" +#include "CmUtils.h" +#include "foundation/PxAllocator.h" + +using namespace physx; + +bool PxSceneQueryExt::raycastAny( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryHit& hit, const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, const PxSceneQueryCache* cache) +{ + PxSceneQueryFilterData fdAny = filterData; + fdAny.flags |= PxQueryFlag::eANY_HIT; + PxRaycastBuffer buf; + scene.raycast(origin, unitDir, distance, buf, PxHitFlag::eANY_HIT, fdAny, filterCall, cache); + hit = buf.block; + return buf.hasBlock; +} + +bool PxSceneQueryExt::raycastSingle(const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxRaycastHit& hit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, const PxSceneQueryCache* cache) +{ + PxRaycastBuffer buf; + PxQueryFilterData fd1 = filterData; + scene.raycast(origin, unitDir, distance, buf, outputFlags, fd1, filterCall, cache); + hit = buf.block; + return buf.hasBlock; +} + +PxI32 PxSceneQueryExt::raycastMultiple( const PxScene& scene, + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxRaycastHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, const PxSceneQueryCache* cache) +{ + PxRaycastBuffer buf(hitBuffer, hitBufferSize); + PxQueryFilterData fd1 = filterData; + scene.raycast(origin, unitDir, distance, buf, outputFlags, fd1, filterCall, cache); + blockingHit = buf.hasBlock; + if(blockingHit) + { + if(buf.nbTouches < hitBufferSize) + { + hitBuffer[buf.nbTouches] = buf.block; + return PxI32(buf.nbTouches+1); + } + else // overflow, drop the last touch + { + hitBuffer[hitBufferSize-1] = buf.block; + return -1; + } + } else + // no block + return PxI32(buf.nbTouches); +} + +bool PxSceneQueryExt::sweepAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags queryFlags, + PxSceneQueryHit& hit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, + const PxSceneQueryCache* cache, + PxReal inflation) +{ + PxSceneQueryFilterData fdAny = filterData; + fdAny.flags |= PxQueryFlag::eANY_HIT; + PxSweepBuffer buf; + scene.sweep(geometry, pose, unitDir, distance, buf, queryFlags|PxHitFlag::eANY_HIT, fdAny, filterCall, cache, inflation); + hit = buf.block; + return buf.hasBlock; +} + +bool PxSceneQueryExt::sweepSingle( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, + PxSweepHit& hit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, + const PxSceneQueryCache* cache, + PxReal inflation) +{ + PxSweepBuffer buf; + PxQueryFilterData fd1 = filterData; + scene.sweep(geometry, pose, unitDir, distance, buf, outputFlags, fd1, filterCall, cache, inflation); + hit = buf.block; + return buf.hasBlock; +} + +PxI32 PxSceneQueryExt::sweepMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxSceneQueryFlags outputFlags, PxSweepHit* hitBuffer, PxU32 hitBufferSize, bool& blockingHit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall, const PxSceneQueryCache* cache, + PxReal inflation) +{ + PxQueryFilterData fd1 = filterData; + PxSweepBuffer buf(hitBuffer, hitBufferSize); + scene.sweep(geometry, pose, unitDir, distance, buf, outputFlags, fd1, filterCall, cache, inflation); + blockingHit = buf.hasBlock; + if(blockingHit) + { + if(buf.nbTouches < hitBufferSize) + { + hitBuffer[buf.nbTouches] = buf.block; + return PxI32(buf.nbTouches+1); + } + else // overflow, drop the last touch + { + hitBuffer[hitBufferSize-1] = buf.block; + return -1; + } + } else + // no block + return PxI32(buf.nbTouches); +} + +PxI32 PxSceneQueryExt::overlapMultiple( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit* hitBuffer, PxU32 hitBufferSize, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall) +{ + PxQueryFilterData fd1 = filterData; + fd1.flags |= PxQueryFlag::eNO_BLOCK; + PxOverlapBuffer buf(hitBuffer, hitBufferSize); + scene.overlap(geometry, pose, buf, fd1, filterCall); + if(buf.hasBlock) + { + if(buf.nbTouches < hitBufferSize) + { + hitBuffer[buf.nbTouches] = buf.block; + return PxI32(buf.nbTouches+1); + } + else // overflow, drop the last touch + { + hitBuffer[hitBufferSize-1] = buf.block; + return -1; + } + } else + // no block + return PxI32(buf.nbTouches); +} + +bool PxSceneQueryExt::overlapAny( const PxScene& scene, + const PxGeometry& geometry, const PxTransform& pose, + PxOverlapHit& hit, + const PxSceneQueryFilterData& filterData, + PxSceneQueryFilterCallback* filterCall) +{ + PxSceneQueryFilterData fdAny = filterData; + fdAny.flags |= (PxQueryFlag::eANY_HIT | PxQueryFlag::eNO_BLOCK); + PxOverlapBuffer buf; + scene.overlap(geometry, pose, buf, fdAny, filterCall); + hit = buf.block; + return buf.hasBlock; +} + +namespace +{ + struct Raycast + { + PxVec3 origin; + PxVec3 unitDir; + PxReal distance; + PxHitFlags hitFlags; + PxQueryFilterData filterData; + const PxQueryCache* cache; + }; + struct Sweep + { + PxGeometryHolder geometry; + PxTransform pose; + PxVec3 unitDir; + PxReal distance; + PxHitFlags hitFlags; + PxQueryFilterData filterData; + const PxQueryCache* cache; + PxReal inflation; + }; + struct Overlap + { + PxGeometryHolder geometry; + PxTransform pose; + PxQueryFilterData filterData; + const PxQueryCache* cache; + }; +} + +template +struct NpOverflowBuffer : PxHitBuffer +{ + bool overflow; + bool processCalled; + PxU32 saveNbTouches; + NpOverflowBuffer(HitType* hits, PxU32 count) : PxHitBuffer(hits, count), overflow(false), processCalled(false), saveNbTouches(0) + { + } + + virtual PxAgain processTouches(const HitType* /*hits*/, PxU32 /*count*/) + { + if (processCalled) + return false; + saveNbTouches = this->nbTouches; + processCalled = true; + return true; + } + + virtual void finalizeQuery() + { + if (processCalled) + { + overflow = (this->nbTouches > 0); + this->nbTouches = saveNbTouches; + } + } +}; + + +class ExtBatchQuery : public PxBatchQueryExt +{ + PX_NOCOPY(ExtBatchQuery) +public: + + ExtBatchQuery( + const PxScene& scene, + PxQueryFilterCallback* queryFilterCallback, + PxRaycastBuffer* raycastBuffers, Raycast* raycastQueries, const PxU32 maxNbRaycasts, PxRaycastHit* raycastTouches, const PxU32 maxNbRaycastTouches, + PxSweepBuffer* sweepBuffers, Sweep* sweepQueries, const PxU32 maxNbSweeps, PxSweepHit* sweepTouches, const PxU32 maxNbSweepTouches, + PxOverlapBuffer* overlapBuffers, Overlap* overlapQueries, const PxU32 maxNbOverlaps, PxOverlapHit* overlapTouches, const PxU32 maxNbOverlapTouches); + + ~ExtBatchQuery() {} + + virtual void release(); + + virtual PxRaycastBuffer* raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, const PxU16 maxNbTouches, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL); + + virtual PxSweepBuffer* sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, const PxU16 maxNbTouches, + PxHitFlags hitFlags = PxHitFlags(PxHitFlag::eDEFAULT), + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL, + const PxReal inflation = 0.f); + + virtual PxOverlapBuffer* overlap( + const PxGeometry& geometry, const PxTransform& pose, PxU16 maxNbTouches = 0, + const PxQueryFilterData& filterData = PxQueryFilterData(), + const PxQueryCache* cache = NULL); + + virtual void execute(); + +private: + + template struct Query + { + PxHitBuffer* mBuffers; + QueryType* mQueries; + PxU32 mMaxNbBuffers; + HitType* mTouches; + PxU32 mMaxNbTouches; + + PxU32 mBufferTide; + + Query() + : mBuffers(NULL), + mQueries(NULL), + mMaxNbBuffers(0), + mTouches(NULL), + mMaxNbTouches(0), + mBufferTide(0) + { + } + + Query(PxHitBuffer* buffers, QueryType* queries, const PxU32 maxNbBuffers, HitType* touches, const PxU32 maxNbTouches) + : mBuffers(buffers), + mQueries(queries), + mMaxNbBuffers(maxNbBuffers), + mTouches(touches), + mMaxNbTouches(maxNbTouches), + mBufferTide(0) + { + for (PxU32 i = 0; i < mMaxNbBuffers; i++) + { + mBuffers[i].hasBlock = false; + mBuffers[i].nbTouches = 0; + } + } + + PxHitBuffer* addQuery(const QueryType& query, const PxU32 maxNbTouches) + { + if ((mBufferTide + 1) > mMaxNbBuffers) + { + //Ran out of queries. + return NULL; + } + + PxHitBuffer* buffer = mBuffers + mBufferTide; + buffer->touches = NULL; + buffer->maxNbTouches = maxNbTouches; + buffer->hasBlock = false; + buffer->nbTouches = 0xffffffff; + + mQueries[mBufferTide] = query; + + mBufferTide++; + + return buffer; + } + + static void performQuery(const PxScene& scene, const Raycast& query, NpOverflowBuffer& hitBuffer, PxQueryFilterCallback* qfcb) + { + scene.raycast( + query.origin, query.unitDir, query.distance, + hitBuffer, + query.hitFlags, + query.filterData, qfcb, + query.cache); + } + + static void performQuery(const PxScene& scene, const Sweep& query, NpOverflowBuffer& hitBuffer, PxQueryFilterCallback* qfcb) + { + scene.sweep( + query.geometry.any(), query.pose, query.unitDir, query.distance, + hitBuffer, + query.hitFlags, + query.filterData, qfcb, + query.cache, + query.inflation); + } + + static void performQuery(const PxScene& scene, const Overlap& query, NpOverflowBuffer& hitBuffer, PxQueryFilterCallback* qfcb) + { + scene.overlap( + query.geometry.any(), query.pose, + hitBuffer, + query.filterData, qfcb, + query.cache); + } + + void execute(const PxScene& scene, PxQueryFilterCallback* qfcb) + { + PxU32 touchesTide = 0; + for (PxU32 i = 0; i < mBufferTide; i++) + { + PX_ASSERT(0xffffffff == mBuffers[i].nbTouches); + PX_ASSERT(0xffffffff != mBuffers[i].maxNbTouches); + PX_ASSERT(!mBuffers[i].touches); + + bool noTouchesRemaining = false; + if (mBuffers[i].maxNbTouches > 0) + { + if (touchesTide >= mMaxNbTouches) + { + //No resources left. + mBuffers[i].maxNbTouches = 0; + mBuffers[i].touches = NULL; + noTouchesRemaining = true; + } + else if ((touchesTide + mBuffers[i].maxNbTouches) > mMaxNbTouches) + { + //Some resources left but not enough to match requested number. + //This might be enough but it depends on the number of hits generated by the query. + mBuffers[i].maxNbTouches = mMaxNbTouches - touchesTide; + mBuffers[i].touches = mTouches + touchesTide; + } + else + { + //Enough resources left to match request. + mBuffers[i].touches = mTouches + touchesTide; + } + } + + bool overflow = false; + { + PX_ALIGN(16, NpOverflowBuffer overflowBuffer)(mBuffers[i].touches, mBuffers[i].maxNbTouches); + performQuery(scene, mQueries[i], overflowBuffer, qfcb); + overflow = overflowBuffer.overflow || noTouchesRemaining; + mBuffers[i].hasBlock = overflowBuffer.hasBlock; + mBuffers[i].block = overflowBuffer.block; + mBuffers[i].nbTouches = overflowBuffer.nbTouches; + } + + if(overflow) + { + mBuffers[i].maxNbTouches = 0xffffffff; + } + touchesTide += mBuffers[i].nbTouches; + } + + mBufferTide = 0; + } + }; + + const PxScene& mScene; + PxQueryFilterCallback* mQueryFilterCallback; + + Query mRaycasts; + Query mSweeps; + Query mOverlaps; +}; + +template +class ExtBatchQueryDesc +{ +public: + ExtBatchQueryDesc(const PxU32 maxNbResults, const PxU32 maxNbTouches) + : mResults(NULL), + mMaxNbResults(maxNbResults), + mTouches(NULL), + mMaxNbTouches(maxNbTouches) + { + } + ExtBatchQueryDesc(PxHitBuffer* results, const PxU32 maxNbResults, HitType* touches, PxU32 maxNbTouches) + : mResults(results), + mMaxNbResults(maxNbResults), + mTouches(touches), + mMaxNbTouches(maxNbTouches) + { + } + + PX_FORCE_INLINE PxHitBuffer* getResults() const { return mResults; } + PX_FORCE_INLINE PxU32 getNbResults() const { return mMaxNbResults; } + PX_FORCE_INLINE HitType* getTouches() const { return mTouches; } + PX_FORCE_INLINE PxU32 getNbTouches() const { return mMaxNbTouches; } + +private: + PxHitBuffer* mResults; + PxU32 mMaxNbResults; + HitType* mTouches; + PxU32 mMaxNbTouches; +}; + +template +PxU32 computeByteSize(const ExtBatchQueryDesc& queryDesc) +{ + PxU32 byteSize = 0; + if (queryDesc.getNbResults() > 0) + { + byteSize += sizeof(QueryType)*queryDesc.getNbResults(); + if (!queryDesc.getResults()) + { + byteSize += sizeof(PxHitBuffer)*queryDesc.getNbResults() + sizeof(HitType)*queryDesc.getNbTouches(); + } + } + return byteSize; +} + +template PxU8* parseDesc +(PxU8* bufIn, const ExtBatchQueryDesc& queryDesc, + PxHitBuffer*& results, + QueryType*& queries, + PxU32& maxBufferSize, + HitType*& touches, + PxU32& maxNbTouches) +{ + PxU8* bufOut = bufIn; + + results = queryDesc.getResults(); + queries = NULL; + maxBufferSize = queryDesc.getNbResults(); + touches = queryDesc.getTouches(); + maxNbTouches = queryDesc.getNbTouches(); + + if (maxBufferSize > 0) + { + queries = reinterpret_cast(bufOut); + bufOut += sizeof(QueryType)*maxBufferSize; + + if (!results) + { + results = reinterpret_cast*>(bufOut); + for (PxU32 i = 0; i < maxBufferSize; i++) + { + PX_PLACEMENT_NEW(results + i, PxHitBuffer); + } + bufOut += sizeof(PxHitBuffer)*maxBufferSize; + + if (maxNbTouches > 0) + { + touches = reinterpret_cast(bufOut); + bufOut += sizeof(HitType)*maxNbTouches; + } + } + } + + return bufOut; +} + +PxBatchQueryExt* create +(const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + const ExtBatchQueryDesc& raycastDesc, const ExtBatchQueryDesc& sweepDesc, const ExtBatchQueryDesc& overlapDesc) +{ + const PxU32 byteSize = + sizeof(ExtBatchQuery) + + computeByteSize(raycastDesc) + + computeByteSize(sweepDesc) + + computeByteSize(overlapDesc); + + PxAllocatorCallback& allocator = *PxGetAllocatorCallback(); + + PxU8* buf = reinterpret_cast(allocator.allocate(byteSize, "NpBatchQueryExt", __FILE__, __LINE__)); + PX_CHECK_AND_RETURN_NULL(buf, "PxCreateBatchQueryExt - alllocation failed"); + ExtBatchQuery* bq = reinterpret_cast(buf); + buf += sizeof(ExtBatchQuery); + + PxHitBuffer* raycastBuffers = NULL; + Raycast* raycastQueries = NULL; + PxU32 maxNbRaycasts = 0; + PxRaycastHit* raycastTouches = NULL; + PxU32 maxNbRaycastTouches = 0; + buf = parseDesc(buf, raycastDesc, raycastBuffers, raycastQueries, maxNbRaycasts, raycastTouches, maxNbRaycastTouches); + + PxHitBuffer* sweepBuffers = NULL; + Sweep* sweepQueries = NULL; + PxU32 maxNbSweeps = 0; + PxSweepHit* sweepTouches = NULL; + PxU32 maxNbSweepTouches = 0; + buf = parseDesc(buf, sweepDesc, sweepBuffers, sweepQueries, maxNbSweeps, sweepTouches, maxNbSweepTouches); + + PxHitBuffer* overlapBuffers = NULL; + Overlap* overlapQueries = NULL; + PxU32 maxNbOverlaps = 0; + PxOverlapHit* overlapTouches = NULL; + PxU32 maxNbOverlapTouches = 0; + buf = parseDesc(buf, overlapDesc, overlapBuffers, overlapQueries, maxNbOverlaps, overlapTouches, maxNbOverlapTouches); + + PX_ASSERT((reinterpret_cast(bq) + byteSize) == buf); + + PX_PLACEMENT_NEW(bq, ExtBatchQuery)( + scene, queryFilterCallback, + raycastBuffers, raycastQueries, maxNbRaycasts, raycastTouches, maxNbRaycastTouches, + sweepBuffers, sweepQueries, maxNbSweeps, sweepTouches, maxNbSweepTouches, + overlapBuffers, overlapQueries, maxNbOverlaps, overlapTouches, maxNbOverlapTouches); + + return bq; +} + +PxBatchQueryExt* physx::PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + const PxU32 maxNbRaycasts, const PxU32 maxNbRaycastTouches, + const PxU32 maxNbSweeps, const PxU32 maxNbSweepTouches, + const PxU32 maxNbOverlaps, const PxU32 maxNbOverlapTouches) +{ + PX_CHECK_AND_RETURN_NULL(!((0 != maxNbRaycastTouches) && (0 == maxNbRaycasts)), + "PxCreateBatchQueryExt - maxNbRaycastTouches is non-zero but maxNbRaycasts is zero"); + PX_CHECK_AND_RETURN_NULL(!((0 != maxNbSweepTouches) && (0 == maxNbSweeps)), + "PxCreateBatchQueryExt - maxNbSweepTouches is non-zero but maxNbSweeps is zero"); + PX_CHECK_AND_RETURN_NULL(!((0 != maxNbOverlapTouches) && (0 == maxNbOverlaps)), + "PxCreateBatchQueryExt - maxNbOverlaps is non-zero but maxNbOverlaps is zero"); + + return create(scene, queryFilterCallback, + ExtBatchQueryDesc(maxNbRaycasts, maxNbRaycastTouches), + ExtBatchQueryDesc(maxNbSweeps, maxNbSweepTouches), + ExtBatchQueryDesc(maxNbOverlaps, maxNbOverlapTouches)); +} + +PxBatchQueryExt* physx::PxCreateBatchQueryExt( + const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + PxRaycastBuffer* raycastBuffers, const PxU32 maxNbRaycasts, PxRaycastHit* raycastTouches, const PxU32 maxNbRaycastTouches, + PxSweepBuffer* sweepBuffers, const PxU32 maxNbSweeps, PxSweepHit* sweepTouches, const PxU32 maxNbSweepTouches, + PxOverlapBuffer* overlapBuffers, const PxU32 maxNbOverlaps, PxOverlapHit* overlapTouches, const PxU32 maxNbOverlapTouches) +{ + PX_CHECK_AND_RETURN_NULL(!(!raycastTouches && (maxNbRaycastTouches != 0)), + "PxCreateBatchQueryExt - maxNbRaycastTouches > 0 but raycastTouches is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!raycastBuffers && (maxNbRaycasts != 0)), + "PxCreateBatchQueryExt - maxNbRaycasts > 0 but raycastBuffers is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!raycastBuffers && raycastTouches), + "PxCreateBatchQueryExt - raycastBuffers is NULL but raycastTouches is non-NULL"); + + PX_CHECK_AND_RETURN_NULL(!(!sweepTouches && (maxNbSweepTouches != 0)), + "PxCreateBatchQueryExt - maxNbSweepTouches > 0 but sweepTouches is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!sweepBuffers && (maxNbSweeps != 0)), + "PxCreateBatchQueryExt - maxNbSweeps > 0 but sweepBuffers is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!sweepBuffers && sweepTouches), + "PxCreateBatchQueryExt - sweepBuffers is NULL but sweepTouches is non-NULL"); + + PX_CHECK_AND_RETURN_NULL(!(!overlapTouches && (maxNbOverlapTouches != 0)), + "PxCreateBatchQueryExt - maxNbOverlapTouches > 0 but overlapTouches is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!overlapBuffers && (maxNbOverlaps != 0)), + "PxCreateBatchQueryExt - maxNbOverlaps > 0 but overlapBuffers is NULL"); + PX_CHECK_AND_RETURN_NULL(!(!overlapBuffers && overlapTouches), + "PxCreateBatchQueryExt - overlapBuffers is NULL but overlapTouches is non-NULL"); + + return create(scene, queryFilterCallback, + ExtBatchQueryDesc(raycastBuffers, maxNbRaycasts, raycastTouches, maxNbRaycastTouches), + ExtBatchQueryDesc(sweepBuffers, maxNbSweeps, sweepTouches, maxNbSweepTouches), + ExtBatchQueryDesc(overlapBuffers, maxNbOverlaps, overlapTouches, maxNbOverlapTouches)); +} + + +ExtBatchQuery::ExtBatchQuery +(const PxScene& scene, PxQueryFilterCallback* queryFilterCallback, + PxRaycastBuffer* raycastBuffers, Raycast* raycastQueries, const PxU32 maxNbRaycasts, PxRaycastHit* raycastTouches, const PxU32 maxNbRaycastTouches, + PxSweepBuffer* sweepBuffers, Sweep* sweepQueries, const PxU32 maxNbSweeps, PxSweepHit* sweepTouches, const PxU32 maxNbSweepTouches, + PxOverlapBuffer* overlapBuffers, Overlap* overlapQueries, const PxU32 maxNbOverlaps, PxOverlapHit* overlapTouches, const PxU32 maxNbOverlapTouches) + : mScene(scene), + mQueryFilterCallback(queryFilterCallback) +{ + typedef Query QueryRaycast; + typedef Query QuerySweep; + typedef Query QueryOverlap; + PX_PLACEMENT_NEW(&mRaycasts, QueryRaycast)(raycastBuffers, raycastQueries, maxNbRaycasts, raycastTouches, maxNbRaycastTouches); + PX_PLACEMENT_NEW(&mSweeps, QuerySweep)(sweepBuffers, sweepQueries, maxNbSweeps, sweepTouches, maxNbSweepTouches); + PX_PLACEMENT_NEW(&mOverlaps, QueryOverlap)(overlapBuffers, overlapQueries, maxNbOverlaps, overlapTouches, maxNbOverlapTouches); +} + +void ExtBatchQuery::release() +{ + PxGetAllocatorCallback()->deallocate(this); +} + +PxRaycastBuffer* ExtBatchQuery::raycast +(const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches, + PxHitFlags hitFlags, + const PxQueryFilterData& filterData, + const PxQueryCache* cache) +{ + const PxQueryFilterData qfd(filterData.data, filterData.flags | PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR); + const Raycast raycast = { origin, unitDir, distance, hitFlags, qfd, cache }; + PxRaycastBuffer* buffer = mRaycasts.addQuery(raycast, maxNbTouches); + PX_CHECK_MSG(buffer, "PxBatchQueryExt::raycast - number of raycast() calls exceeds maxNbRaycasts. query discarded"); + return buffer; +} + +PxSweepBuffer* ExtBatchQuery::sweep +(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + const PxU16 maxNbTouches, + PxHitFlags hitFlags, + const PxQueryFilterData& filterData, + const PxQueryCache* cache, + const PxReal inflation) +{ + const PxQueryFilterData qfd(filterData.data, filterData.flags | PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR); + const Sweep sweep = { geometry, pose, unitDir, distance, hitFlags, qfd, cache, inflation}; + PxSweepBuffer* buffer = mSweeps.addQuery(sweep, maxNbTouches); + PX_CHECK_MSG(buffer, "PxBatchQueryExt::sweep - number of sweep() calls exceeds maxNbSweeps. query discarded"); + return buffer; +} + +PxOverlapBuffer* ExtBatchQuery::overlap +(const PxGeometry& geometry, const PxTransform& pose, PxU16 maxNbTouches, + const PxQueryFilterData& filterData, + const PxQueryCache* cache) +{ + const PxQueryFilterData qfd(filterData.data, filterData.flags | PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR); + const Overlap overlap = { geometry, pose, qfd, cache}; + PxOverlapBuffer* buffer = mOverlaps.addQuery(overlap, maxNbTouches); + PX_CHECK_MSG(buffer, "PxBatchQueryExt::overlap - number of overlap() calls exceeds maxNbOverlaps. query discarded"); + return buffer; +} + +void ExtBatchQuery::execute() +{ + mRaycasts.execute(mScene, mQueryFilterCallback); + mSweeps.execute(mScene, mQueryFilterCallback); + mOverlaps.execute(mScene, mQueryFilterCallback); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp new file mode 100644 index 0000000..72dabda --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSceneQuerySystem.cpp @@ -0,0 +1,469 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxSceneQuerySystemExt.h" +#include "extensions/PxShapeExt.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" +#include "geometry/PxBVH.h" +#include "GuActorShapeMap.h" +#include "SqQuery.h" +#include "SqFactory.h" +#include "PxRigidActor.h" +#include "PxPruningStructure.h" +#include "PxSceneDesc.h" // PT: for PxSceneLimits TODO: remove + +// PT: this file re-implements a scene-queries system for PxScene inside PxExtensions. All SQ-related calls from the PxScene API +// will be re-routed to this class. This version re-uses the same internal code as PhysX (most notably from SqQuery.h) so there is +// little differences between the internal PhysX version and this one except minor implementation details like what we store in the +// PrunerPayload. The whole API is available, it uses the same number of "pruners" for the queries, etc. This is a good working +// starting point for users who want to start tinkering with the system without starting from scratch. + +using namespace physx; +using namespace Sq; +using namespace Gu; + +#define EXT_PRUNER_EPSILON 0.005f + +// PT: in this external implementation we'll use Px pointers instead of Np pointers in the payload. +static PX_FORCE_INLINE void setPayload(PrunerPayload& pp, const PxShape* shape, const PxRigidActor* actor) +{ + pp.data[0] = size_t(shape); + pp.data[1] = size_t(actor); +} + +static PX_FORCE_INLINE PxShape* getShapeFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[0]); +} + +static PX_FORCE_INLINE PxRigidActor* getActorFromPayload(const PrunerPayload& payload) +{ + return reinterpret_cast(payload.data[1]); +} + +static PX_FORCE_INLINE bool isDynamicActor(const PxRigidActor& actor) +{ + const PxType actorType = actor.getConcreteType(); + return actorType != PxConcreteType::eRIGID_STATIC; +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE ActorShapeData createActorShapeData(PrunerData data, PrunerCompoundId id) { return (ActorShapeData(id) << 32) | ActorShapeData(data); } +static PX_FORCE_INLINE PrunerData getPrunerData(ActorShapeData data) { return PrunerData(data); } +static PX_FORCE_INLINE PrunerCompoundId getCompoundID(ActorShapeData data) { return PrunerCompoundId(data >> 32); } + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class ExtSqAdapter : public QueryAdapter + { + public: + ExtSqAdapter() {} + virtual ~ExtSqAdapter() {} + + // Adapter + virtual const PxGeometry& getGeometry(const PrunerPayload& payload) const; + //~Adapter + + // QueryAdapter + virtual PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const; + virtual void getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const; + virtual void getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const; + //~QueryAdapter + + ActorShapeMap mDatabase; + }; +} + +const PxGeometry& ExtSqAdapter::getGeometry(const PrunerPayload& payload) const +{ + PxShape* shape = getShapeFromPayload(payload); + return shape->getGeometry(); +} + +PrunerHandle ExtSqAdapter::findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const +{ + const PxU32 actorIndex = cache.actor->getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + const ActorShapeData actorShapeData = mDatabase.find(actorIndex, cache.actor, cache.shape); + + const PrunerData prunerData = getPrunerData(actorShapeData); + compoundId = getCompoundID(actorShapeData); + + prunerIndex = getPrunerIndex(prunerData); + return getPrunerHandle(prunerData); +} + +void ExtSqAdapter::getFilterData(const PrunerPayload& payload, PxFilterData& filterData) const +{ + PxShape* shape = getShapeFromPayload(payload); + filterData = shape->getQueryFilterData(); +} + +void ExtSqAdapter::getActorShape(const PrunerPayload& payload, PxActorShape& actorShape) const +{ + actorShape.actor = getActorFromPayload(payload); + actorShape.shape = getShapeFromPayload(payload); +} + +/////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class ExternalPxSQ : public PxSceneQuerySystem, public PxUserAllocated + { + public: + ExternalPxSQ(PVDCapture* pvd, PxU64 contextID, Pruner* staticPruner, Pruner* dynamicPruner, + PxU32 dynamicTreeRebuildRateHint, PxSceneQueryUpdateMode::Enum mode, const PxSceneLimits& limits) : + mQueries (pvd, contextID, staticPruner, dynamicPruner, dynamicTreeRebuildRateHint, EXT_PRUNER_EPSILON, limits, mExtAdapter), + mUpdateMode (mode), + mRefCount (1) + {} + virtual ~ExternalPxSQ() {} + + virtual void release(); + virtual void acquireReference(); + virtual void preallocate(PxU32 prunerIndex, PxU32 nbShapes) { SQ().preallocate(prunerIndex, nbShapes); } + virtual void addSQShape( const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, + const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure); + virtual void removeSQShape(const PxRigidActor& actor, const PxShape& shape); + virtual void updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform); + virtual PxSQCompoundHandle addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& pxbvh, const PxTransform* transforms); + virtual void removeSQCompound(PxSQCompoundHandle compoundHandle); + virtual void updateSQCompound(PxSQCompoundHandle compoundHandle, const PxTransform& compoundTransform); + virtual void flushUpdates() { SQ().flushUpdates(); } + virtual void flushMemory() { SQ().flushMemory(); } + virtual void visualize(PxU32 prunerIndex, PxRenderOutput& out) const { SQ().visualize(prunerIndex, out); } + virtual void shiftOrigin(const PxVec3& shift) { SQ().shiftOrigin(shift); } + virtual PxSQBuildStepHandle prepareSceneQueryBuildStep(PxU32 prunerIndex); + virtual void sceneQueryBuildStep(PxSQBuildStepHandle handle); + virtual void finalizeUpdates(); + virtual void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint) { SQ().setDynamicTreeRebuildRateHint(dynTreeRebuildRateHint); } + virtual PxU32 getDynamicTreeRebuildRateHint() const { return SQ().getDynamicTreeRebuildRateHint(); } + virtual void forceRebuildDynamicTree(PxU32 prunerIndex) { SQ().forceRebuildDynamicTree(prunerIndex); } + virtual PxSceneQueryUpdateMode::Enum getUpdateMode() const { return mUpdateMode; } + virtual void setUpdateMode(PxSceneQueryUpdateMode::Enum mode) { mUpdateMode = mode; } + virtual PxU32 getStaticTimestamp() const { return SQ().getStaticTimestamp(); } + virtual void merge(const PxPruningStructure& pxps); + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + virtual bool sweep( const PxGeometry& geometry, const PxTransform& pose, + const PxVec3& unitDir, const PxReal distance, + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const; + virtual bool overlap(const PxGeometry& geometry, const PxTransform& transform, + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + virtual PxSQPrunerHandle getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const; + virtual void sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, + const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices); + + PX_FORCE_INLINE PrunerManager& SQ() { return mQueries.mSQManager; } + PX_FORCE_INLINE const PrunerManager& SQ() const { return mQueries.mSQManager; } + + ExtSqAdapter mExtAdapter; + SceneQueries mQueries; + PxSceneQueryUpdateMode::Enum mUpdateMode; + PxU32 mRefCount; + }; +} + +/////////////////////////////////////////////////////////////////////////////// + +void addExternalSQ(PxSceneQuerySystem* added); +void removeExternalSQ(PxSceneQuerySystem* removed); + +void ExternalPxSQ::release() +{ + mRefCount--; + if(!mRefCount) + { + removeExternalSQ(this); + PX_DELETE_THIS; + } +} + +void ExternalPxSQ::acquireReference() +{ + mRefCount++; +} + +void ExternalPxSQ::addSQShape(const PxRigidActor& actor, const PxShape& shape, const PxBounds3& bounds, const PxTransform& transform, const PxSQCompoundHandle* compoundHandle, bool hasPruningStructure) +{ + PrunerPayload payload; + setPayload(payload, &shape, &actor); + + const PrunerCompoundId cid = compoundHandle ? PrunerCompoundId(*compoundHandle) : INVALID_COMPOUND_ID; + const PrunerData prunerData = SQ().addPrunerShape(payload, isDynamicActor(actor), cid, bounds, transform, hasPruningStructure); + + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + mExtAdapter.mDatabase.add(actorIndex, &actor, &shape, createActorShapeData(prunerData, cid)); +} + +namespace +{ + struct DatabaseCleaner : PrunerPayloadRemovalCallback + { + DatabaseCleaner(ExtSqAdapter& adapter) : mAdapter(adapter){} + + virtual void invoke(PxU32 nbRemoved, const PrunerPayload* removed) + { + PxU32 actorIndex = 0xffffffff; + const PxRigidActor* cachedActor = NULL; + + while(nbRemoved--) + { + const PrunerPayload& payload = *removed++; + + const PxRigidActor* actor = getActorFromPayload(payload); + + if(actor!=cachedActor) + { + actorIndex = actor->getInternalActorIndex(); + cachedActor = actor; + } + PX_ASSERT(actorIndex!=0xffffffff); + + bool status = mAdapter.mDatabase.remove(actorIndex, actor, getShapeFromPayload(payload), NULL); + PX_ASSERT(status); + PX_UNUSED(status); + } + } + ExtSqAdapter& mAdapter; + + PX_NOCOPY(DatabaseCleaner) + }; +} + +void ExternalPxSQ::removeSQShape(const PxRigidActor& actor, const PxShape& shape) +{ + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + ActorShapeData actorShapeData; + mExtAdapter.mDatabase.remove(actorIndex, &actor, &shape, &actorShapeData); + + const PrunerData data = getPrunerData(actorShapeData); + const PrunerCompoundId compoundId = getCompoundID(actorShapeData); + + SQ().removePrunerShape(compoundId, data, NULL); +} + +void ExternalPxSQ::updateSQShape(const PxRigidActor& actor, const PxShape& shape, const PxTransform& transform) +{ + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + const ActorShapeData actorShapeData = mExtAdapter.mDatabase.find(actorIndex, &actor, &shape); + + const PrunerData shapeHandle = getPrunerData(actorShapeData); + const PrunerCompoundId cid = getCompoundID(actorShapeData); + + SQ().markForUpdate(cid, shapeHandle, transform); +} + +PxSQCompoundHandle ExternalPxSQ::addSQCompound(const PxRigidActor& actor, const PxShape** shapes, const PxBVH& bvh, const PxTransform* transforms) +{ + const PxU32 numSqShapes = bvh.getNbBounds(); + + PX_ALLOCA(payloads, PrunerPayload, numSqShapes); + for(PxU32 i=0; imerge(pxps.getStaticMergeData()); + + Pruner* dynamicPruner = SQ().getPruner(PruningIndex::eDYNAMIC); + if(dynamicPruner) + dynamicPruner->merge(pxps.getDynamicMergeData()); +} + +bool ExternalPxSQ::raycast( const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + return mQueries._raycast(origin, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, flags); +} + +bool ExternalPxSQ::sweep( const PxGeometry& geometry, const PxTransform& pose, + const PxVec3& unitDir, const PxReal distance, + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const +{ + return mQueries._sweep(geometry, pose, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, inflation, flags); +} + +bool ExternalPxSQ::overlap( const PxGeometry& geometry, const PxTransform& transform, + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + return mQueries._overlap( geometry, transform, hitCall, filterData, filterCall, cache, flags); +} + +PxSQPrunerHandle ExternalPxSQ::getHandle(const PxRigidActor& actor, const PxShape& shape, PxU32& prunerIndex) const +{ + const PxU32 actorIndex = actor.getInternalActorIndex(); + PX_ASSERT(actorIndex!=0xffffffff); + + const ActorShapeData actorShapeData = mExtAdapter.mDatabase.find(actorIndex, &actor, &shape); + + const PrunerData prunerData = getPrunerData(actorShapeData); + + prunerIndex = getPrunerIndex(prunerData); + + return PxSQPrunerHandle(getPrunerHandle(prunerData)); +} + +void ExternalPxSQ::sync(PxU32 prunerIndex, const PxSQPrunerHandle* handles, const PxU32* indices, const PxBounds3* bounds, + const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) +{ + PX_ASSERT(prunerIndex==PruningIndex::eDYNAMIC); + if(prunerIndex==PruningIndex::eDYNAMIC) + SQ().sync(handles, indices, bounds, transforms, count, ignoredIndices); +} + +/////////////////////////////////////////////////////////////////////////////// + +static CompanionPrunerType getCompanionType(PxDynamicTreeSecondaryPruner::Enum type) +{ + switch(type) + { + case PxDynamicTreeSecondaryPruner::eNONE: return COMPANION_PRUNER_NONE; + case PxDynamicTreeSecondaryPruner::eBUCKET: return COMPANION_PRUNER_BUCKET; + case PxDynamicTreeSecondaryPruner::eINCREMENTAL: return COMPANION_PRUNER_INCREMENTAL; + case PxDynamicTreeSecondaryPruner::eBVH: return COMPANION_PRUNER_AABB_TREE; + case PxDynamicTreeSecondaryPruner::eLAST: return COMPANION_PRUNER_NONE; + } + return COMPANION_PRUNER_NONE; +} + +static BVHBuildStrategy getBuildStrategy(PxBVHBuildStrategy::Enum bs) +{ + switch(bs) + { + case PxBVHBuildStrategy::eFAST: return BVH_SPLATTER_POINTS; + case PxBVHBuildStrategy::eDEFAULT: return BVH_SPLATTER_POINTS_SPLIT_GEOM_CENTER; + case PxBVHBuildStrategy::eSAH: return BVH_SAH; + case PxBVHBuildStrategy::eLAST: return BVH_SPLATTER_POINTS; + } + return BVH_SPLATTER_POINTS; +} + +static Pruner* create(PxPruningStructureType::Enum type, PxU64 contextID, PxDynamicTreeSecondaryPruner::Enum secondaryType, PxBVHBuildStrategy::Enum buildStrategy, PxU32 nbObjectsPerNode) +{ +// if(0) +// return createIncrementalPruner(contextID); + + const CompanionPrunerType cpType = getCompanionType(secondaryType); + const BVHBuildStrategy bs = getBuildStrategy(buildStrategy); + + Pruner* pruner = NULL; + switch(type) + { + case PxPruningStructureType::eNONE: { pruner = createBucketPruner(contextID); break; } + case PxPruningStructureType::eDYNAMIC_AABB_TREE: { pruner = createAABBPruner(contextID, true, cpType, bs, nbObjectsPerNode); break; } + case PxPruningStructureType::eSTATIC_AABB_TREE: { pruner = createAABBPruner(contextID, false, cpType, bs, nbObjectsPerNode); break; } + case PxPruningStructureType::eLAST: break; + } + return pruner; +} + +PxSceneQuerySystem* physx::PxCreateExternalSceneQuerySystem(const PxSceneQueryDesc& desc, PxU64 contextID) +{ + PVDCapture* pvd = NULL; + Pruner* staticPruner = create(desc.staticStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.staticBVHBuildStrategy, desc.staticNbObjectsPerNode); + Pruner* dynamicPruner = create(desc.dynamicStructure, contextID, desc.dynamicTreeSecondaryPruner, desc.dynamicBVHBuildStrategy, desc.dynamicNbObjectsPerNode); + + ExternalPxSQ* pxsq = PX_NEW(ExternalPxSQ)(pvd, contextID, staticPruner, dynamicPruner, desc.dynamicTreeRebuildRateHint, desc.sceneQueryUpdateMode, PxSceneLimits()); + + addExternalSQ(pxsq); + + return pxsq; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSerialization.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSerialization.h new file mode 100644 index 0000000..ddd26ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSerialization.h @@ -0,0 +1,43 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef EXT_SERIALIZATION_H +#define EXT_SERIALIZATION_H + +namespace physx +{ +namespace Ext +{ + void RegisterExtensionsSerializers(PxSerializationRegistry& sr); + void UnregisterExtensionsSerializers(PxSerializationRegistry& sr); + void GetExtensionsBinaryMetaData(PxOutputStream& stream); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSharedQueueEntryPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSharedQueueEntryPool.h new file mode 100644 index 0000000..6abf451 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSharedQueueEntryPool.h @@ -0,0 +1,151 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_SHARED_QUEUE_ENTRY_POOL_H +#define EXT_SHARED_QUEUE_ENTRY_POOL_H + +#include "foundation/PxAllocator.h" +#include "foundation/PxArray.h" +#include "foundation/PxSList.h" + +namespace physx +{ +namespace Ext +{ + class SharedQueueEntry : public PxSListEntry + { + public: + SharedQueueEntry(void* objectRef) : mObjectRef(objectRef), mPooledEntry(false) {} + SharedQueueEntry() : mObjectRef(NULL), mPooledEntry(true) {} + + public: + void* mObjectRef; + bool mPooledEntry; // True if the entry was preallocated in a pool + }; + +#if PX_VC +#pragma warning(push) +#pragma warning(disable:4324) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif // Because of the SList member I assume*/ + + template::Type > + class SharedQueueEntryPool : private Alloc + { + public: + SharedQueueEntryPool(PxU32 poolSize, const Alloc& alloc = Alloc("SharedQueueEntryPool")); + ~SharedQueueEntryPool(); + + SharedQueueEntry* getEntry(void* objectRef); + void putEntry(SharedQueueEntry& entry); + + private: + SharedQueueEntry* mTaskEntryPool; + PxSList mTaskEntryPtrPool; + }; + +#if PX_VC +#pragma warning(pop) +#endif + +template +SharedQueueEntryPool::SharedQueueEntryPool(PxU32 poolSize, const Alloc& alloc) + : Alloc(alloc) +{ + PxAlignedAllocator alignedAlloc("SharedQueueEntryPool"); + + mTaskEntryPool = poolSize ? reinterpret_cast(alignedAlloc.allocate(sizeof(SharedQueueEntry) * poolSize, __FILE__, __LINE__)) : NULL; + + if (mTaskEntryPool) + { + for(PxU32 i=0; i < poolSize; i++) + { + PX_ASSERT((size_t(&mTaskEntryPool[i]) & (PX_SLIST_ALIGNMENT-1)) == 0); // The SList entry must be aligned according to PX_SLIST_ALIGNMENT + + PX_PLACEMENT_NEW(&mTaskEntryPool[i], SharedQueueEntry)(); + PX_ASSERT(mTaskEntryPool[i].mPooledEntry == true); + mTaskEntryPtrPool.push(mTaskEntryPool[i]); + } + } +} + + +template +SharedQueueEntryPool::~SharedQueueEntryPool() +{ + if (mTaskEntryPool) + { + PxAlignedAllocator alignedAlloc("SharedQueueEntryPool"); + alignedAlloc.deallocate(mTaskEntryPool); + } +} + + +template +SharedQueueEntry* SharedQueueEntryPool::getEntry(void* objectRef) +{ + SharedQueueEntry* e = static_cast(mTaskEntryPtrPool.pop()); + if (e) + { + PX_ASSERT(e->mPooledEntry == true); + e->mObjectRef = objectRef; + return e; + } + else + { + PxAlignedAllocator alignedAlloc; + e = reinterpret_cast(alignedAlloc.allocate(sizeof(SharedQueueEntry), __FILE__, __LINE__)); + if (e) + { + PX_PLACEMENT_NEW(e, SharedQueueEntry)(objectRef); + PX_ASSERT(e->mPooledEntry == false); + } + + return e; + } +} + + +template +void SharedQueueEntryPool::putEntry(SharedQueueEntry& entry) +{ + if (entry.mPooledEntry) + { + entry.mObjectRef = NULL; + mTaskEntryPtrPool.push(entry); + } + else + { + PxAlignedAllocator alignedAlloc; + alignedAlloc.deallocate(&entry); + } +} + +} // namespace Ext +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp new file mode 100644 index 0000000..6743e66 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSimpleFactory.cpp @@ -0,0 +1,365 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMathUtils.h" +#include "foundation/PxQuat.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxPlaneGeometry.h" +#include "extensions/PxRigidBodyExt.h" +#include "extensions/PxSimpleFactory.h" +#include "PxPhysics.h" +#include "PxScene.h" +#include "PxRigidStatic.h" +#include "PxRigidStatic.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" + +#include "foundation/PxUtilities.h" +#include "foundation/PxInlineArray.h" + +using namespace physx; + +static bool isDynamicGeometry(PxGeometryType::Enum type) +{ + return type == PxGeometryType::eBOX + || type == PxGeometryType::eSPHERE + || type == PxGeometryType::eCAPSULE + || type == PxGeometryType::eCONVEXMESH; +} + +namespace physx +{ +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateDynamic: transform is not valid."); + + PxRigidDynamic* actor = sdk.createRigidDynamic(transform); + if(actor) + { + actor->attachShape(shape); + PxRigidBodyExt::updateMassAndInertia(*actor, density); + } + return actor; +} + +PxRigidDynamic* PxCreateDynamic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateDynamic: transform is not valid."); + PX_CHECK_AND_RETURN_NULL(shapeOffset.isValid(), "PxCreateDynamic: shapeOffset is not valid."); + + if(!isDynamicGeometry(geometry.getType()) || density <= 0.0f) + return NULL; + + PxShape* shape = sdk.createShape(geometry, material, true); + if(!shape) + return NULL; + + shape->setLocalPose(shapeOffset); + + PxRigidDynamic* body = shape ? PxCreateDynamic(sdk, transform, *shape, density) : NULL; + shape->release(); + return body; +} + +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape, + PxReal density) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateKinematic: transform is not valid."); + + bool isDynGeom = isDynamicGeometry(shape.getGeometryType()); + if(isDynGeom && density <= 0.0f) + return NULL; + + PxRigidDynamic* actor = sdk.createRigidDynamic(transform); + if(actor) + { + actor->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + if(!isDynGeom) + shape.setFlag(PxShapeFlag::eSIMULATION_SHAPE, false); + + actor->attachShape(shape); + + if(isDynGeom) + PxRigidBodyExt::updateMassAndInertia(*actor, density); + else + { + actor->setMass(1.f); + actor->setMassSpaceInertiaTensor(PxVec3(1.f,1.f,1.f)); + } + } + + return actor; +} + +PxRigidDynamic* PxCreateKinematic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + PxReal density, + const PxTransform& shapeOffset) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateKinematic: transform is not valid."); + PX_CHECK_AND_RETURN_NULL(shapeOffset.isValid(), "PxCreateKinematic: shapeOffset is not valid."); + + bool isDynGeom = isDynamicGeometry(geometry.getType()); + if(isDynGeom && density <= 0.0f) + return NULL; + + PxShape* shape = sdk.createShape(geometry, material, true); + if(!shape) + return NULL; + + shape->setLocalPose(shapeOffset); + + PxRigidDynamic* body = PxCreateKinematic(sdk, transform, *shape, density); + shape->release(); + return body; +} + +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + PxShape& shape) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateStatic: transform is not valid."); + + PxRigidStatic* s = sdk.createRigidStatic(transform); + if(s) + s->attachShape(shape); + return s; +} + +PxRigidStatic* PxCreateStatic(PxPhysics& sdk, + const PxTransform& transform, + const PxGeometry& geometry, + PxMaterial& material, + const PxTransform& shapeOffset) +{ + PX_CHECK_AND_RETURN_NULL(transform.isValid(), "PxCreateStatic: transform is not valid."); + PX_CHECK_AND_RETURN_NULL(shapeOffset.isValid(), "PxCreateStatic: shapeOffset is not valid."); + + PxShape* shape = sdk.createShape(geometry, material, true); + if(!shape) + return NULL; + + shape->setLocalPose(shapeOffset); + + PxRigidStatic* s = PxCreateStatic(sdk, transform, *shape); + shape->release(); + return s; +} + +PxRigidStatic* PxCreatePlane(PxPhysics& sdk, + const PxPlane& plane, + PxMaterial& material) +{ + PX_CHECK_AND_RETURN_NULL(plane.n.isFinite(), "PxCreatePlane: plane normal is not valid."); + + if (!plane.n.isNormalized()) + return NULL; + + return PxCreateStatic(sdk, PxTransformFromPlaneEquation(plane), PxPlaneGeometry(), material); +} + +PxShape* PxCloneShape(PxPhysics& physics, const PxShape& from, bool isExclusive) +{ + PxInlineArray materials; + PxU16 materialCount = from.getNbMaterials(); + materials.resize(materialCount); + from.getMaterials(materials.begin(), materialCount); + + PxShape* to = physics.createShape(from.getGeometry(), materials.begin(), materialCount, isExclusive, from.getFlags()); + + to->setLocalPose(from.getLocalPose()); + to->setContactOffset(from.getContactOffset()); + to->setRestOffset(from.getRestOffset()); + to->setSimulationFilterData(from.getSimulationFilterData()); + to->setQueryFilterData(from.getQueryFilterData()); + to->setTorsionalPatchRadius(from.getTorsionalPatchRadius()); + to->setMinTorsionalPatchRadius(from.getMinTorsionalPatchRadius()); + return to; +} + +static void copyStaticProperties(PxPhysics& physics, PxRigidActor& to, const PxRigidActor& from) +{ + PxInlineArray shapes; + shapes.resize(from.getNbShapes()); + + PxU32 shapeCount = from.getNbShapes(); + from.getShapes(shapes.begin(), shapeCount); + + for(PxU32 i = 0; i < shapeCount; i++) + { + PxShape* s = shapes[i]; + if(!s->isExclusive()) + to.attachShape(*s); + else + { + PxShape* newShape = physx::PxCloneShape(physics, *s, true); + to.attachShape(*newShape); + newShape->release(); + } + } + + to.setActorFlags(from.getActorFlags()); + to.setOwnerClient(from.getOwnerClient()); + to.setDominanceGroup(from.getDominanceGroup()); +} + +PxRigidStatic* PxCloneStatic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidActor& from) +{ + PxRigidStatic* to = physicsSDK.createRigidStatic(transform); + if(!to) + return NULL; + + copyStaticProperties(physicsSDK, *to, from); + + return to; +} + +PxRigidDynamic* PxCloneDynamic(PxPhysics& physicsSDK, + const PxTransform& transform, + const PxRigidDynamic& from) +{ + PxRigidDynamic* to = physicsSDK.createRigidDynamic(transform); + if(!to) + return NULL; + + copyStaticProperties(physicsSDK, *to, from); + + to->setRigidBodyFlags(from.getRigidBodyFlags()); + + to->setMass(from.getMass()); + to->setMassSpaceInertiaTensor(from.getMassSpaceInertiaTensor()); + to->setCMassLocalPose(from.getCMassLocalPose()); + + to->setLinearVelocity(from.getLinearVelocity()); + to->setAngularVelocity(from.getAngularVelocity()); + + to->setLinearDamping(from.getLinearDamping()); + to->setAngularDamping(from.getAngularDamping()); + + PxU32 posIters, velIters; + from.getSolverIterationCounts(posIters, velIters); + to->setSolverIterationCounts(posIters, velIters); + + to->setMaxLinearVelocity(from.getMaxLinearVelocity()); + to->setMaxAngularVelocity(from.getMaxAngularVelocity()); + to->setMaxDepenetrationVelocity(from.getMaxDepenetrationVelocity()); + to->setSleepThreshold(from.getSleepThreshold()); + to->setStabilizationThreshold(from.getStabilizationThreshold()); + to->setMinCCDAdvanceCoefficient(from.getMinCCDAdvanceCoefficient()); + to->setContactReportThreshold(from.getContactReportThreshold()); + to->setMaxContactImpulse(from.getMaxContactImpulse()); + + PxTransform target; + if (from.getKinematicTarget(target)) + to->setKinematicTarget(target); + + to->setRigidDynamicLockFlags(from.getRigidDynamicLockFlags()); + + return to; +} + +static PxTransform scalePosition(const PxTransform& t, PxReal scale) +{ + return PxTransform(t.p*scale, t.q); +} + +void PxScaleRigidActor(PxRigidActor& actor, PxReal scale, bool scaleMassProps) +{ + PX_CHECK_AND_RETURN(scale > 0, + "PxScaleRigidActor requires that the scale parameter is greater than zero"); + + PxInlineArray shapes; + shapes.resize(actor.getNbShapes()); + actor.getShapes(shapes.begin(), shapes.size()); + + for(PxU32 i=0;isetLocalPose(scalePosition(shapes[i]->getLocalPose(), scale)); + PxGeometryHolder h(shapes[i]->getGeometry()); + + switch(h.getType()) + { + case PxGeometryType::eSPHERE: + h.sphere().radius *= scale; + break; + case PxGeometryType::ePLANE: + break; + case PxGeometryType::eCAPSULE: + h.capsule().halfHeight *= scale; + h.capsule().radius *= scale; + break; + case PxGeometryType::eBOX: + h.box().halfExtents *= scale; + break; + case PxGeometryType::eCONVEXMESH: + h.convexMesh().scale.scale *= scale; + break; + case PxGeometryType::eTRIANGLEMESH: + h.triangleMesh().scale.scale *= scale; + break; + case PxGeometryType::eHEIGHTFIELD: + h.heightField().heightScale *= scale; + h.heightField().rowScale *= scale; + h.heightField().columnScale *= scale; + break; + default: + PX_ASSERT(0); + } + shapes[i]->setGeometry(h.any()); + } + + if(!scaleMassProps) + return; + + PxRigidDynamic* dynamic = (&actor)->is(); + if(!dynamic) + return; + + PxReal scale3 = scale*scale*scale; + dynamic->setMass(dynamic->getMass()*scale3); + dynamic->setMassSpaceInertiaTensor(dynamic->getMassSpaceInertiaTensor()*scale3*scale*scale); + dynamic->setCMassLocalPose(scalePosition(dynamic->getCMassLocalPose(), scale)); +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp new file mode 100644 index 0000000..6f86166 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSmoothNormals.cpp @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "extensions/PxSmoothNormals.h" + +#include "foundation/PxMathUtils.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" + +using namespace physx; + +static PxReal computeAngle(const PxVec3* verts, const PxU32* refs, PxU32 vref) +{ + PxU32 e0=0,e2=0; + if(vref==refs[0]) + { + e0 = 2; + e2 = 1; + } + else if(vref==refs[1]) + { + e0 = 2; + e2 = 0; + } + else if(vref==refs[2]) + { + e0 = 0; + e2 = 1; + } + else + { + PX_ASSERT(0); + } + const PxVec3 edge0 = verts[refs[e0]] - verts[vref]; + const PxVec3 edge1 = verts[refs[e2]] - verts[vref]; + + return PxComputeAngle(edge0, edge1); +} + +bool PxBuildSmoothNormals(PxU32 nbTris, PxU32 nbVerts, const PxVec3* verts, const PxU32* dFaces, const PxU16* wFaces, PxVec3* normals, bool flip) +{ + if(!verts || !normals || !nbTris || !nbVerts) + return false; + + // Get correct destination buffers + // - if available, write directly to user-provided buffers + // - else get some ram and keep track of it + PxVec3* FNormals = PX_ALLOCATE(PxVec3, nbTris, "PxVec3"); + if(!FNormals) return false; + + // Compute face normals + const PxU32 c = PxU32(flip!=0); + for(PxU32 i=0; igetNbTetrahedrons(); + + const PxU32* tetPtr32 = reinterpret_cast(sb.getSimulationMesh()->getTetrahedrons()); + const PxU16* tetPtr16 = reinterpret_cast(sb.getSimulationMesh()->getTetrahedrons()); + const bool sixteenBit = sb.getSimulationMesh()->getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES; + + PxVec4* positionInvGM = reinterpret_cast(sb.getSimPositionInvMassCPU()->map()); + + PxReal volume = 0; + for (PxU32 i = 0; i < numTetsGM; ++i) + { + PxVec4& x0 = positionInvGM[sixteenBit ? tetPtr16[4 * i] : tetPtr32[4 * i]]; + PxVec4& x1 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 1] : tetPtr32[4 * i + 1]]; + PxVec4& x2 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 2] : tetPtr32[4 * i + 2]]; + PxVec4& x3 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 3] : tetPtr32[4 * i + 3]]; + + const PxVec3 u1 = x1.getXYZ() - x0.getXYZ(); + const PxVec3 u2 = x2.getXYZ() - x0.getXYZ(); + const PxVec3 u3 = x3.getXYZ() - x0.getXYZ(); + + PxMat33 Q = PxMat33(u1, u2, u3); + + const PxReal det = Q.getDeterminant(); + volume += det; + } + volume /= 6.0f; + + sb.getSimPositionInvMassCPU()->unmap(); + + return volume; +} + +//Recomputes the volume associated with a vertex. Every tetrahedron distributes a quarter of its volume to +//each vertex it is connected to. Finally the volume stored for every vertex is inverted. +static void updateNodeInverseVolumes(PxSoftBody& sb) +{ + const PxU32 numVertsGM = sb.getSimulationMesh()->getNbVertices(); + const PxU32 numTetsGM = sb.getSimulationMesh()->getNbTetrahedrons(); + + const PxU32* tetPtr32 = reinterpret_cast(sb.getSimulationMesh()->getTetrahedrons()); + const PxU16* tetPtr16 = reinterpret_cast(sb.getSimulationMesh()->getTetrahedrons()); + const bool sixteenBit = sb.getSimulationMesh()->getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES; + + PxVec4* positionInvGM = reinterpret_cast(sb.getSimPositionInvMassCPU()->map()); + + for (PxU32 i = 0; i < numVertsGM; ++i) + positionInvGM[i].w = 0.0f; + + for (PxU32 i = 0; i < numTetsGM; ++i) + { + PxVec4& x0 = positionInvGM[sixteenBit ? tetPtr16[4 * i] : tetPtr32[4 * i]]; + PxVec4& x1 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 1] : tetPtr32[4 * i + 1]]; + PxVec4& x2 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 2] : tetPtr32[4 * i + 2]]; + PxVec4& x3 = positionInvGM[sixteenBit ? tetPtr16[4 * i + 3] : tetPtr32[4 * i + 3]]; + + const PxVec3 u1 = x1.getXYZ() - x0.getXYZ(); + const PxVec3 u2 = x2.getXYZ() - x0.getXYZ(); + const PxVec3 u3 = x3.getXYZ() - x0.getXYZ(); + + PxMat33 Q = PxMat33(u1, u2, u3); + + //det should be positive + const PxReal det = Q.getDeterminant(); + + if (det <= 1.e-9f) + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "updateNodeInverseVolumes(): tretrahedron is degenerate or inverted"); + + //Distribute one quarter of the volume to each vertex the tetrahedron is connected to + const PxReal volume = det / 6.0f; + x0.w += 0.25f * volume; + x1.w += 0.25f * volume; + x2.w += 0.25f * volume; + x3.w += 0.25f * volume; + } + + //Invert the volumes stored per vertex and copy it to the velocity buffer + PxVec4* velocityInvGM = reinterpret_cast(sb.getSimVelocityInvMassCPU()->map()); + for (PxU32 i = 0; i < numVertsGM; ++i) + { + if (positionInvGM[i].w > 0) + { + positionInvGM[i].w = 1.0f / positionInvGM[i].w; + } + velocityInvGM[i].w = positionInvGM[i].w; + } + + sb.getSimPositionInvMassCPU()->unmap(); + sb.getSimVelocityInvMassCPU()->unmap(); +} + +void PxSoftBodyExt::updateMass(PxSoftBody& sb, const PxReal density, const PxReal maxInvMassRatio) +{ + //Inverse volumes are recomputed to ensure that multiple subsequent calls of this method lead to correct results + updateNodeInverseVolumes(sb); + + const PxU32 numVertsGM = sb.getSimulationMesh()->getNbVertices(); + + PxVec4* positionInvGM = reinterpret_cast(sb.getSimPositionInvMassCPU()->map()); + PxVec4* velocityInvGM = reinterpret_cast(sb.getSimVelocityInvMassCPU()->map()); + + PxReal minInvMass = PX_MAX_F32, maxInvMass = 0.f; + for (PxU32 i = 0; i < numVertsGM; ++i) + { + const PxVec4& vert = positionInvGM[i]; + PxReal invMass = vert.w; + invMass = invMass / (density); + minInvMass = invMass > 0.f ? PxMin(invMass, minInvMass) : minInvMass; + maxInvMass = PxMax(invMass, maxInvMass); + positionInvGM[i] = PxVec4(vert.x, vert.y, vert.z, invMass); + + const PxVec4& vel = velocityInvGM[i]; + velocityInvGM[i] = PxVec4(vel.x, vel.y, vel.z, invMass); + } + if (minInvMass != PX_MAX_F32) + { + const PxReal ratio = maxInvMass / minInvMass; + if (ratio > maxInvMassRatio) + { + //Clamp the upper limit... + maxInvMass = minInvMass * maxInvMassRatio; + for (PxU32 i = 0; i < numVertsGM; ++i) + { + PxVec4& posInvMass = positionInvGM[i]; + PxVec4& velInvMass = velocityInvGM[i]; + posInvMass.w = PxMin(posInvMass.w, maxInvMass); + velInvMass.w = PxMin(velInvMass.w, maxInvMass); + } + } + } + + sb.getSimPositionInvMassCPU()->unmap(); + sb.getSimVelocityInvMassCPU()->unmap(); +} + +void PxSoftBodyExt::setMass(PxSoftBody& sb, const PxReal mass, const PxReal maxInvMassRatio) +{ + //Compute the density such that density times volume is equal to the desired mass + updateMass(sb, mass / computeSimulationMeshVolume(sb), maxInvMassRatio); +} + +void PxSoftBodyExt::transform(PxSoftBody& sb, const PxTransform& transform, const PxReal scale) +{ + const PxU32 numVertsGM = sb.getSimulationMesh()->getNbVertices(); + const PxU32 numVerts = sb.getCollisionMesh()->getNbVertices(); + + PxVec4* collPositionInvGM = reinterpret_cast(sb.getPositionInvMassCPU()->map()); + PxVec4* positionInvGM = reinterpret_cast(sb.getSimPositionInvMassCPU()->map()); + PxVec4* velocityInvGM = reinterpret_cast(sb.getSimVelocityInvMassCPU()->map()); + PxVec4* restPositions = reinterpret_cast(sb.getRestPositionInvMassCPU()->map()); + + for (PxU32 i = 0; i < numVertsGM; ++i) + { + const PxVec4 tpInvMass = positionInvGM[i]; + const PxReal invMass = tpInvMass.w; + PxVec3 vert = PxVec3(tpInvMass.x * scale, tpInvMass.y * scale, tpInvMass.z * scale); + //Transform the vertex position and keep the inverse mass + vert = transform.transform(vert); + positionInvGM[i] = PxVec4(vert.x, vert.y, vert.z, invMass); + + PxVec4 vel = velocityInvGM[i]; + PxVec3 v = PxVec3(vel.x * scale, vel.y * scale, vel.z * scale); + //Velocities are translation invariant, therefore only the direction needs to get adjusted. + //The inverse mass is stored as well to optimize memory access on the GPU + v = transform.rotate(v); + velocityInvGM[i] = PxVec4(v.x, v.y, v.z, invMass); + } + + for (PxU32 i = 0; i < numVerts; ++i) + { + restPositions[i] = PxVec4(restPositions[i].x*scale, restPositions[i].y*scale, restPositions[i].z*scale, 1.f); + + const PxVec4 tpInvMass = collPositionInvGM[i]; + PxVec3 vert = PxVec3(tpInvMass.x * scale, tpInvMass.y * scale, tpInvMass.z * scale); + vert = transform.transform(vert); + collPositionInvGM[i] = PxVec4(vert.x, vert.y, vert.z, tpInvMass.w); + } + + sb.getSimPositionInvMassCPU()->unmap(); + sb.getSimVelocityInvMassCPU()->unmap(); + sb.getRestPositionInvMassCPU()->unmap(); + sb.getPositionInvMassCPU()->unmap(); + + PxMat33* tetraRestPosesGM = static_cast(sb.getSoftBodyAuxData())->getGridModelRestPosesFast(); // reinterpret_cast(simMeshData->softBodyAuxData.getGridModelRestPosesFast()); + const PxU32 nbTetraGM = sb.getSimulationMesh()->getNbTetrahedrons(); + + const PxReal invScale = 1.0f / scale; + for (PxU32 i = 0; i < nbTetraGM; ++i) + { + PxMat33& m = tetraRestPosesGM[i]; + //Scale the rest pose + m.column0 = m.column0 * invScale; + m.column1 = m.column1 * invScale; + m.column2 = m.column2 * invScale; + + //The rest pose is translation invariant, it only needs be rotated + PxVec3 row0 = transform.rotateInv(PxVec3(m.column0.x, m.column1.x, m.column2.x)); + PxVec3 row1 = transform.rotateInv(PxVec3(m.column0.y, m.column1.y, m.column2.y)); + PxVec3 row2 = transform.rotateInv(PxVec3(m.column0.z, m.column1.z, m.column2.z)); + + m.column0 = PxVec3(row0.x, row1.x, row2.x); + m.column1 = PxVec3(row0.y, row1.y, row2.y); + m.column2 = PxVec3(row0.z, row1.z, row2.z); + } + + + PxMat33* tetraRestPoses = static_cast(sb.getSoftBodyAuxData())->getRestPosesFast(); // reinterpret_cast(simMeshData->softBodyAuxData.getGridModelRestPosesFast()); + const PxU32 nbTetra = sb.getCollisionMesh()->getNbTetrahedrons(); + + for (PxU32 i = 0; i < nbTetra; ++i) + { + PxMat33& m = tetraRestPoses[i]; + //Scale the rest pose + m.column0 = m.column0 * invScale; + m.column1 = m.column1 * invScale; + m.column2 = m.column2 * invScale; + + //The rest pose is translation invariant, it only needs be rotated + PxVec3 row0 = transform.rotateInv(PxVec3(m.column0.x, m.column1.x, m.column2.x)); + PxVec3 row1 = transform.rotateInv(PxVec3(m.column0.y, m.column1.y, m.column2.y)); + PxVec3 row2 = transform.rotateInv(PxVec3(m.column0.z, m.column1.z, m.column2.z)); + + m.column0 = PxVec3(row0.x, row1.x, row2.x); + m.column1 = PxVec3(row0.y, row1.y, row2.y); + m.column2 = PxVec3(row0.z, row1.z, row2.z); + } + +} + +void PxSoftBodyExt::updateEmbeddedCollisionMesh(PxSoftBody& sb) +{ + Gu::SoftBodyAuxData* softBodyAuxData = static_cast(sb.getSoftBodyAuxData()); + const PxU32* remapTable = softBodyAuxData->mVertsRemapInGridModel; + PxReal* barycentricCoordinates = softBodyAuxData->mVertsBarycentricInGridModel; + + PxTetrahedronMesh* simMesh = sb.getSimulationMesh(); + const void* tets = simMesh->getTetrahedrons(); + const PxU32* tets32 = static_cast(tets); + const PxU16* tets16 = static_cast(tets); + + bool sixteenBit = simMesh->getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES; + + PxVec4* positionInvGM = reinterpret_cast(sb.getSimPositionInvMassCPU()->map()); + PxVec4* positionInv = reinterpret_cast(sb.getPositionInvMassCPU()->map()); + + const PxU32 numVerts = sb.getCollisionMesh()->getNbVertices(); + for (PxU32 i = 0; i < numVerts; ++i) + { + //The tetrahedra are ordered differently on the GPU, therefore the index must be taken from the remap table + const PxU32 tetrahedronIdx = remapTable[i]; + const PxVec4 p0 = positionInvGM[sixteenBit ? tets16[4 * tetrahedronIdx] : tets32[4 * tetrahedronIdx]]; + const PxVec4 p1 = positionInvGM[sixteenBit ? tets16[4 * tetrahedronIdx + 1] : tets32[4 * tetrahedronIdx + 1]]; + const PxVec4 p2 = positionInvGM[sixteenBit ? tets16[4 * tetrahedronIdx + 2] : tets32[4 * tetrahedronIdx + 2]]; + const PxVec4 p3 = positionInvGM[sixteenBit ? tets16[4 * tetrahedronIdx + 3] : tets32[4 * tetrahedronIdx + 3]]; + + const PxReal* barycentric = &barycentricCoordinates[4*i]; + + //Compute the embedded position as a weigted sum of vertices from the simulation mesh + //This ensures that all tranformations and scale changes applied to the simulation mesh get transferred + //to the collision mesh + positionInv[i] = p0 * barycentric[0] + p1 * barycentric[1] + p2 * barycentric[2] + p3 * barycentric[3]; + positionInv[i].w = 1.0f; + } + + sb.getSimPositionInvMassCPU()->unmap(); + sb.getPositionInvMassCPU()->unmap(); +} + +void PxSoftBodyExt::commit(PxSoftBody& sb, PxSoftBodyDataFlags flags, bool flush) +{ + //Updating the collision mesh's vertices ensures that simulation mesh and collision mesh are + //represented in the same coordinate system and the same scale + updateEmbeddedCollisionMesh(sb); + + //Schedule data uploads for all buffers specified + if (flags & PxSoftBodyData::eSIM_POSITION_INVMASS) + sb.writeData(PxSoftBodyData::eSIM_POSITION_INVMASS, *sb.getSimPositionInvMassCPU(), flush); + + if (flags & PxSoftBodyData::eSIM_VELOCITY) + sb.writeData(PxSoftBodyData::eSIM_VELOCITY, *sb.getSimVelocityInvMassCPU(), flush); + + if (flags & PxSoftBodyData::eSIM_KINEMATIC_TARGET) + sb.writeData(PxSoftBodyData::eSIM_KINEMATIC_TARGET, *sb.getKinematicTargetCPU(), flush); +} + +PxSoftBodyMesh* PxSoftBodyExt::createSoftBodyMesh(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxU32 numVoxelsAlongLongestAABBAxis, PxInsertionCallback& insertionCallback, const bool validate) +{ + //Compute collision mesh + physx::PxArray collisionMeshVertices; + physx::PxArray collisionMeshIndices; + if (!PxTetMaker::createConformingTetrahedronMesh(surfaceMesh, collisionMeshVertices, collisionMeshIndices, validate)) + return NULL; + PxTetrahedronMeshDesc meshDesc(collisionMeshVertices, collisionMeshIndices); + + //Compute simulation mesh + physx::PxArray vertexToTet; + vertexToTet.resize(meshDesc.points.count); + physx::PxArray simulationMeshVertices; + physx::PxArray simulationMeshIndices; + PxTetMaker::createVoxelTetrahedronMesh(meshDesc, numVoxelsAlongLongestAABBAxis, simulationMeshVertices, simulationMeshIndices, vertexToTet.begin()); + PxTetrahedronMeshDesc simMeshDesc(simulationMeshVertices, simulationMeshIndices); + PxSoftBodySimulationDataDesc simDesc(vertexToTet); + + physx::PxSoftBodyMesh* softBodyMesh = PxCreateSoftBodyMesh(params, simMeshDesc, meshDesc, simDesc, insertionCallback); + + return softBodyMesh; +} + +PxSoftBodyMesh* PxSoftBodyExt::createSoftBodyMeshNoVoxels(const PxCookingParams& params, const PxSimpleTriangleMesh& surfaceMesh, PxInsertionCallback& insertionCallback, PxReal maxWeightRatioInTet, const bool validate) +{ + PxCookingParams p = params; + p.maxWeightRatioInTet = maxWeightRatioInTet; + + physx::PxArray collisionMeshVertices; + physx::PxArray collisionMeshIndices; + if (!PxTetMaker::createConformingTetrahedronMesh(surfaceMesh, collisionMeshVertices, collisionMeshIndices, validate)) + return NULL; + PxTetrahedronMeshDesc meshDesc(collisionMeshVertices, collisionMeshIndices); + PxSoftBodySimulationDataDesc simDesc; + + physx::PxSoftBodyMesh* softBodyMesh = PxCreateSoftBodyMesh(p, meshDesc, meshDesc, simDesc, insertionCallback); + + return softBodyMesh; +} + +PxSoftBody* PxSoftBodyExt::createSoftBodyFromMesh(PxSoftBodyMesh* softBodyMesh, const PxTransform& transform, const PxFEMSoftBodyMaterial& material, PxCudaContextManager& cudaContextManager, + PxReal density, PxU32 solverIterationCount, const PxFEMParameters& femParams, PxReal scale) +{ + PxSoftBody* softBody = PxGetPhysics().createSoftBody(cudaContextManager); + if (softBody) + { + PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE; + + PxTetrahedronMeshGeometry geometry(softBodyMesh->getCollisionMesh()); + PxFEMSoftBodyMaterial* materialPointer = const_cast(&material); + PxShape* shape = PxGetPhysics().createShape(geometry, &materialPointer, 1, true, shapeFlags); + if (shape) + { + softBody->attachShape(*shape); + } + softBody->attachSimulationMesh(*softBodyMesh->getSimulationMesh(), *softBodyMesh->getSoftBodyAuxData()); + + + const PxReal maxInvMassRatio = 50.f; + + softBody->setParameter(femParams); + softBody->setSolverIterationCounts(solverIterationCount); + + PxSoftBodyExt::transform(*softBody, transform, scale); + PxSoftBodyExt::updateMass(*softBody, density, maxInvMassRatio); + PxSoftBodyExt::commit(*softBody, PxSoftBodyData::eALL); + } + return softBody; +} + +PxSoftBody* PxSoftBodyExt::createSoftBodyBox(const PxTransform& transform, const PxVec3& boxDimensions, const PxFEMSoftBodyMaterial& material, + PxCudaContextManager& cudaContextManager, PxReal maxEdgeLength, PxReal density, PxU32 solverIterationCount, const PxFEMParameters& femParams, PxU32 numVoxelsAlongLongestAABBAxis, PxReal scale) +{ + PxArray triVerts; + triVerts.reserve(8); + triVerts.pushBack(PxVec3(0.5f, -0.5f, -0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(0.5f, -0.5f, 0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(-0.5f, -0.5f, 0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(-0.5f, -0.5f, -0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(0.5f, 0.5f, -0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(0.5f, 0.5f, 0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(-0.5f, 0.5f, 0.5f).multiply(boxDimensions)); + triVerts.pushBack(PxVec3(-0.5f, 0.5f, -0.5f).multiply(boxDimensions)); + + PxArray triIndices; + triIndices.reserve(12 * 3); + triIndices.pushBack(1); triIndices.pushBack(2); triIndices.pushBack(3); + triIndices.pushBack(7); triIndices.pushBack(6); triIndices.pushBack(5); + triIndices.pushBack(4); triIndices.pushBack(5); triIndices.pushBack(1); + triIndices.pushBack(5); triIndices.pushBack(6); triIndices.pushBack(2); + + triIndices.pushBack(2); triIndices.pushBack(6); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(3); triIndices.pushBack(7); + triIndices.pushBack(0); triIndices.pushBack(1); triIndices.pushBack(3); + triIndices.pushBack(4); triIndices.pushBack(7); triIndices.pushBack(5); + + triIndices.pushBack(0); triIndices.pushBack(4); triIndices.pushBack(1); + triIndices.pushBack(1); triIndices.pushBack(5); triIndices.pushBack(2); + triIndices.pushBack(3); triIndices.pushBack(2); triIndices.pushBack(7); + triIndices.pushBack(4); triIndices.pushBack(0); triIndices.pushBack(7); + + if (maxEdgeLength > 0.0f) + PxRemeshingExt::limitMaxEdgeLength(triIndices, triVerts, maxEdgeLength, 3); + + PxSimpleTriangleMesh surfaceMesh; + surfaceMesh.points.count = triVerts.size(); + surfaceMesh.points.data = triVerts.begin(); + surfaceMesh.triangles.count = triIndices.size() / 3; + surfaceMesh.triangles.data = triIndices.begin(); + + PxTolerancesScale tolerancesScale; + PxCookingParams params(tolerancesScale); + params.meshWeldTolerance = 0.001f; + params.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES); + params.buildTriangleAdjacencies = false; + params.buildGPUData = true; + params.midphaseDesc = PxMeshMidPhase::eBVH34; + + PxSoftBodyMesh* softBodyMesh = createSoftBodyMesh(params, surfaceMesh, numVoxelsAlongLongestAABBAxis, PxGetPhysics().getPhysicsInsertionCallback()); + + return createSoftBodyFromMesh(softBodyMesh, transform, material, cudaContextManager, density, solverIterationCount, femParams, scale); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp new file mode 100644 index 0000000..13b6032 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.cpp @@ -0,0 +1,258 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtSphericalJoint.h" +#include "ExtConstraintHelper.h" +#include "CmConeLimitHelper.h" + +using namespace physx; +using namespace Ext; + +SphericalJoint::SphericalJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) : + SphericalJointT(PxJointConcreteType::eSPHERICAL, actor0, localFrame0, actor1, localFrame1, "SphericalJointData") +{ + SphericalJointData* data = static_cast(mData); + + data->projectionLinearTolerance = 1e10f; + data->limit = PxJointLimitCone(PxPi/2, PxPi/2); + data->jointFlags = PxSphericalJointFlags(); +} + +void SphericalJoint::setProjectionLinearTolerance(PxReal tolerance) +{ + PX_CHECK_AND_RETURN(PxIsFinite(tolerance) && tolerance >=0, "PxSphericalJoint::setProjectionLinearTolerance: invalid parameter"); + data().projectionLinearTolerance = tolerance; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, sphericalProjectionLinearTolerance, static_cast(*this), tolerance) +#endif +} + +PxReal SphericalJoint::getProjectionLinearTolerance() const +{ + return data().projectionLinearTolerance; +} + +void SphericalJoint::setLimitCone(const PxJointLimitCone &limit) +{ + PX_CHECK_AND_RETURN(limit.isValid(), "PxSphericalJoint::setLimit: invalid parameter"); + data().limit = limit; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, sphericalLimitYAngle, j, limit.yAngle) + OMNI_PVD_SET(joint, sphericalLimitZAngle, j, limit.zAngle) + OMNI_PVD_SET(joint, sphericalLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, sphericalLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, sphericalLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, sphericalLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, sphericalLimitContactDistance, j, limit.contactDistance_deprecated) +#endif +} + +PxJointLimitCone SphericalJoint::getLimitCone() const +{ + return data().limit; +} + +PxSphericalJointFlags SphericalJoint::getSphericalJointFlags(void) const +{ + return data().jointFlags; +} + +void SphericalJoint::setSphericalJointFlags(PxSphericalJointFlags flags) +{ + data().jointFlags = flags; +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, sphericalJointFlags, static_cast(*this), flags) +#endif +} + +void SphericalJoint::setSphericalJointFlag(PxSphericalJointFlag::Enum flag, bool value) +{ + if(value) + data().jointFlags |= flag; + else + data().jointFlags &= ~flag; + markDirty(); +#if PX_SUPPORT_OMNI_PVD + OMNI_PVD_SET(joint, sphericalJointFlags, static_cast(*this), getSphericalJointFlags()) +#endif +} + +PxReal SphericalJoint::getSwingYAngle() const +{ + return getSwingYAngle_Internal(); +} + +PxReal SphericalJoint::getSwingZAngle() const +{ + return getSwingZAngle_Internal(); +} + +static void SphericalJointProject(const void* constantBlock, PxTransform& bodyAToWorld, PxTransform& bodyBToWorld, bool projectToA) +{ + const SphericalJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w, cB2cA, projected; + joint::computeDerived(data, bodyAToWorld, bodyBToWorld, cA2w, cB2w, cB2cA); + + bool linearTrunc; + projected.p = joint::truncateLinear(cB2cA.p, data.projectionLinearTolerance, linearTrunc); + + if(linearTrunc) + { + projected.q = cB2cA.q; + joint::projectTransforms(bodyAToWorld, bodyBToWorld, cA2w, cB2w, projected, data, projectToA); + } +} + +static void SphericalJointVisualize(PxConstraintVisualizer& viz, const void* constantBlock, const PxTransform& body0Transform, const PxTransform& body1Transform, PxU32 flags) +{ + const SphericalJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::computeJointFrames(cA2w, cB2w, data, body0Transform, body1Transform); + if(flags & PxConstraintVisualizationFlag::eLOCAL_FRAMES) + viz.visualizeJointFrames(cA2w, cB2w); + + if((flags & PxConstraintVisualizationFlag::eLIMITS) && (data.jointFlags & PxSphericalJointFlag::eLIMIT_ENABLED)) + { + if(cA2w.q.dot(cB2w.q)<0.0f) + cB2w.q = -cB2w.q; + + const PxTransform cB2cA = cA2w.transformInv(cB2w); + PxQuat swing, twist; + PxSeparateSwingTwist(cB2cA.q,swing,twist); + + // PT: TODO: refactor with D6 joint code + const PxReal pad = data.limit.isSoft() ? 0.0f : data.limit.contactDistance_deprecated; + const PxVec3 swingAngle(0.0f, computeSwingAngle(swing.y, swing.w), computeSwingAngle(swing.z, swing.w)); + Cm::ConeLimitHelperTanLess coneHelper(data.limit.yAngle, data.limit.zAngle, pad); + viz.visualizeLimitCone(cA2w, PxTan(data.limit.zAngle/4), PxTan(data.limit.yAngle/4), !coneHelper.contains(swingAngle)); + } +} + +//TAG:solverprepshader +static PxU32 SphericalJointSolverPrep(Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 /*maxConstraints*/, + PxConstraintInvMassScale& invMassScale, + const void* constantBlock, + const PxTransform& bA2w, + const PxTransform& bB2w, + bool /*useExtendedLimits*/, + PxVec3p& cA2wOut, PxVec3p& cB2wOut) +{ + const SphericalJointData& data = *reinterpret_cast(constantBlock); + + PxTransform cA2w, cB2w; + joint::ConstraintHelper ch(constraints, invMassScale, cA2w, cB2w, body0WorldOffset, data, bA2w, bB2w); + + if(cB2w.q.dot(cA2w.q)<0.0f) + cB2w.q = -cB2w.q; + + if(data.jointFlags & PxSphericalJointFlag::eLIMIT_ENABLED) + { + PxQuat swing, twist; + PxSeparateSwingTwist(cA2w.q.getConjugate() * cB2w.q, swing, twist); + PX_ASSERT(PxAbs(swing.x)<1e-6f); + + // PT: TODO: refactor with D6 joint code + PxVec3 axis; + PxReal error; + const PxReal pad = data.limit.isSoft() ? 0.0f : data.limit.contactDistance_deprecated; + const Cm::ConeLimitHelperTanLess coneHelper(data.limit.yAngle, data.limit.zAngle, pad); + const bool active = coneHelper.getLimit(swing, axis, error); + if(active) + ch.angularLimit(cA2w.rotate(axis), error, data.limit); + } + + PxVec3 ra, rb; + ch.prepareLockedAxes(cA2w.q, cB2w.q, cA2w.transformInv(cB2w.p), 7, 0, ra, rb); + cA2wOut = ra + bA2w.p; + cB2wOut = rb + bB2w.p; + + return ch.getCount(); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PxConstraintShaderTable gSphericalJointShaders = { SphericalJointSolverPrep, SphericalJointProject, SphericalJointVisualize, PxConstraintFlag::Enum(0) }; + +PxConstraintSolverPrep SphericalJoint::getPrep() const { return gSphericalJointShaders.solverPrep; } + +PxSphericalJoint* physx::PxSphericalJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1) +{ + PX_CHECK_AND_RETURN_NULL(localFrame0.isSane(), "PxSphericalJointCreate: local frame 0 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(localFrame1.isSane(), "PxSphericalJointCreate: local frame 1 is not a valid transform"); + PX_CHECK_AND_RETURN_NULL(actor0 != actor1, "PxSphericalJointCreate: actors must be different"); + PX_CHECK_AND_RETURN_NULL((actor0 && actor0->is()) || (actor1 && actor1->is()), "PxSphericalJointCreate: at least one actor must be dynamic"); + + return createJointT(physics, actor0, localFrame0, actor1, localFrame1, gSphericalJointShaders); +} + +// PX_SERIALIZATION +void SphericalJoint::resolveReferences(PxDeserializationContext& context) +{ + mPxConstraint = resolveConstraintPtr(context, mPxConstraint, this, gSphericalJointShaders); +} +//~PX_SERIALIZATION + +#if PX_SUPPORT_OMNI_PVD + +void SphericalJoint::updateOmniPvdProperties() const +{ + const PxJoint& j = static_cast(*this); + OMNI_PVD_SET(joint, sphericalSwingYAngle, j, getSwingYAngle()) + OMNI_PVD_SET(joint, sphericalSwingZAngle, j, getSwingZAngle()) +} + +template<> +void physx::Ext::omniPvdInitJoint(SphericalJoint* joint) +{ + PxJoint& j = static_cast(*joint); + OMNI_PVD_SET(joint, type, j, PxJointConcreteType::eSPHERICAL) + OMNI_PVD_SET(joint, sphericalProjectionLinearTolerance, j, joint->getProjectionLinearTolerance()) + + PxJointLimitCone limit = joint->getLimitCone(); + OMNI_PVD_SET(joint, sphericalLimitYAngle, j, limit.yAngle) + OMNI_PVD_SET(joint, sphericalLimitZAngle, j, limit.zAngle) + OMNI_PVD_SET(joint, sphericalLimitRestitution, j, limit.restitution) + OMNI_PVD_SET(joint, sphericalLimitBounceThreshold, j, limit.bounceThreshold) + OMNI_PVD_SET(joint, sphericalLimitStiffness, j, limit.stiffness) + OMNI_PVD_SET(joint, sphericalLimitDamping, j, limit.damping) + OMNI_PVD_SET(joint, sphericalLimitContactDistance, j, limit.contactDistance_deprecated) + + OMNI_PVD_SET(joint, sphericalJointFlags, j, joint->getSphericalJointFlags()) + + OMNI_PVD_SET(joint, sphericalSwingYAngle, j, joint->getSwingYAngle()) + OMNI_PVD_SET(joint, sphericalSwingZAngle, j, joint->getSwingZAngle()) +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.h new file mode 100644 index 0000000..389cd41 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSphericalJoint.h @@ -0,0 +1,101 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_SPHERICAL_JOINT_H +#define EXT_SPHERICAL_JOINT_H + +#include "extensions/PxSphericalJoint.h" + +#include "ExtJoint.h" +#include "CmUtils.h" + +namespace physx +{ +struct PxSphericalJointGeneratedValues; +namespace Ext +{ + struct SphericalJointData: public JointData + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + PxJointLimitCone limit; + + PxReal projectionLinearTolerance; + + PxSphericalJointFlags jointFlags; + private: + SphericalJointData(const PxJointLimitCone& cone) : limit(cone) {} + }; + + typedef JointT SphericalJointT; + + class SphericalJoint : public SphericalJointT + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + SphericalJoint(PxBaseFlags baseFlags) : SphericalJointT(baseFlags) {} + void resolveReferences(PxDeserializationContext& context); + static SphericalJoint* createObject(PxU8*& address, PxDeserializationContext& context) { return createJointObject(address, context); } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + SphericalJoint(const PxTolerancesScale& /*scale*/, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1); + // PxSphericalJoint + virtual void setLimitCone(const PxJointLimitCone &limit) PX_OVERRIDE; + virtual PxJointLimitCone getLimitCone() const PX_OVERRIDE; + virtual void setSphericalJointFlags(PxSphericalJointFlags flags) PX_OVERRIDE; + virtual void setSphericalJointFlag(PxSphericalJointFlag::Enum flag, bool value) PX_OVERRIDE; + virtual PxSphericalJointFlags getSphericalJointFlags(void) const PX_OVERRIDE; + virtual void setProjectionLinearTolerance(PxReal distance) PX_OVERRIDE; + virtual PxReal getProjectionLinearTolerance() const PX_OVERRIDE; + virtual PxReal getSwingYAngle() const PX_OVERRIDE; + virtual PxReal getSwingZAngle() const PX_OVERRIDE; + //~PxSphericalJoint + + // PxConstraintConnector + virtual PxConstraintSolverPrep getPrep() const PX_OVERRIDE; +#if PX_SUPPORT_OMNI_PVD + virtual void updateOmniPvdProperties() const PX_OVERRIDE; +#endif + //~PxConstraintConnector + }; + +} // namespace Ext + +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp new file mode 100644 index 0000000..c265445 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.cpp @@ -0,0 +1,578 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtSqManager.h" + #define SQ_DEBUG_VIZ_STATIC_COLOR PxU32(PxDebugColor::eARGB_BLUE) + #define SQ_DEBUG_VIZ_DYNAMIC_COLOR PxU32(PxDebugColor::eARGB_RED) + #define SQ_DEBUG_VIZ_STATIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKBLUE) + #define SQ_DEBUG_VIZ_DYNAMIC_COLOR2 PxU32(PxDebugColor::eARGB_DARKRED) + #define SQ_DEBUG_VIZ_COMPOUND_COLOR PxU32(PxDebugColor::eARGB_MAGENTA) +#include "GuBounds.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +#include "SqFactory.h" +#include "common/PxProfileZone.h" +#include "common/PxRenderBuffer.h" +#include "GuBVH.h" +#include "foundation/PxAlloca.h" + +// PT: this is a customized version of physx::Sq::PrunerManager that supports more than 2 hardcoded pruners. +// It might not be possible to support the whole PxSceneQuerySystem API with an arbitrary number of pruners. + +ExtPrunerManager::ExtPrunerManager(PxU64 contextID, float inflation, const Adapter& adapter, bool usesTreeOfPruners) : + mAdapter (adapter), + mTreeOfPruners (NULL), + mContextID (contextID), + mStaticTimestamp (0), + mRebuildRateHint (100), + mInflation (inflation), + mPrunerNeedsUpdating (false), + mTimestampNeedsUpdating (false), + mUsesTreeOfPruners (usesTreeOfPruners) +{ + mCompoundPrunerExt.mPruner = createCompoundPruner(contextID); +} + +ExtPrunerManager::~ExtPrunerManager() +{ + PX_DELETE(mTreeOfPruners); + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iinit(pruner); + if(preallocated) + pe->preallocate(preallocated); + mPrunerExt.pushBack(pe); + return index; +} + +void ExtPrunerManager::preallocate(PxU32 prunerIndex, PxU32 nbShapes) +{ + const bool preallocateCompoundPruner = prunerIndex==0xffffffff; + if(preallocateCompoundPruner) + { + mCompoundPrunerExt.preallocate(nbShapes); + } + else + { + if(prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + mPrunerExt[prunerIndex]->preallocate(nbShapes); + } +} + +void ExtPrunerManager::flushMemory() +{ + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iflushMemory(); + } + + mCompoundPrunerExt.flushMemory(); +} + +PrunerHandle ExtPrunerManager::addPrunerShape(const PrunerPayload& payload, PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, const PxBounds3& bounds, const PxTransform& transform, bool hasPruningStructure) +{ + if(compoundId==INVALID_COMPOUND_ID && prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return INVALID_PRUNERHANDLE; + } + + mPrunerNeedsUpdating = true; + + if(!dynamic) + invalidateStaticTimestamp(); + + PrunerHandle handle; + if(compoundId == INVALID_COMPOUND_ID) + { + PX_ASSERT(prunerIndexpruner()); + mPrunerExt[prunerIndex]->pruner()->addObjects(&handle, &bounds, &payload, &transform, 1, hasPruningStructure); + //mPrunerExt[prunerIndex].growDirtyList(handle); + } + else + { + PX_ASSERT(mCompoundPrunerExt.pruner()); + mCompoundPrunerExt.pruner()->addObject(compoundId, handle, bounds, payload, transform); + } + + return handle; +} + +void ExtPrunerManager::removePrunerShape(PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, PrunerHandle shapeHandle, PrunerPayloadRemovalCallback* removalCallback) +{ + if(compoundId==INVALID_COMPOUND_ID && prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + mPrunerNeedsUpdating = true; + + if(!dynamic) + invalidateStaticTimestamp(); + + if(compoundId == INVALID_COMPOUND_ID) + { + PX_ASSERT(prunerIndexpruner()); + + mPrunerExt[prunerIndex]->removeFromDirtyList(shapeHandle); + mPrunerExt[prunerIndex]->pruner()->removeObjects(&shapeHandle, 1, removalCallback); + } + else + { + mCompoundPrunerExt.removeFromDirtyList(compoundId, shapeHandle); + mCompoundPrunerExt.pruner()->removeObject(compoundId, shapeHandle, removalCallback); + } +} + +void ExtPrunerManager::markForUpdate(PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, PrunerHandle shapeHandle, const PxTransform& transform) +{ + if(compoundId==INVALID_COMPOUND_ID && prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + mPrunerNeedsUpdating = true; + + if(!dynamic) + invalidateStaticTimestamp(); + + if(compoundId == INVALID_COMPOUND_ID) + { + PX_ASSERT(prunerIndexpruner()); + + // PT: TODO: at this point do we still need a dirty list? we could just update the bounds directly? + mPrunerExt[prunerIndex]->addToDirtyList(shapeHandle, dynamic, transform); + } + else + mCompoundPrunerExt.addToDirtyList(compoundId, shapeHandle, transform); +} + +void ExtPrunerManager::setDynamicTreeRebuildRateHint(PxU32 rebuildRateHint) +{ + mRebuildRateHint = rebuildRateHint; + + // PT: we are still using the same rebuild hint for all pruners here, which may or may + // not make sense. We could also have a different build rate for each pruner. + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;ipruner(); + if(pruner && pruner->isDynamic()) + static_cast(pruner)->setRebuildRateHint(rebuildRateHint); + } +} + +void ExtPrunerManager::afterSync(bool buildStep, bool commit) +{ + PX_PROFILE_ZONE("Sim.sceneQueryBuildStep", mContextID); + + if(!buildStep && !commit) + { + mPrunerNeedsUpdating = true; + return; + } + + // flush user modified objects + flushShapes(); + + // PT: TODO: with N pruners this part would be worth multi-threading + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;ipruner(); + if(pruner) + { + if(pruner->isDynamic()) + static_cast(pruner)->buildStep(true); + + if(commit) + pruner->commit(); + } + } + + if(commit) + { + if(mUsesTreeOfPruners) + createTreeOfPruners(); + } + + mPrunerNeedsUpdating = !commit; +} + +void ExtPrunerManager::flushShapes() +{ + PX_PROFILE_ZONE("SceneQuery.flushShapes", mContextID); + + // must already have acquired writer lock here + + const float inflation = 1.0f + mInflation; + + bool mustInvalidateStaticTimestamp = false; + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;iprocessDirtyList(i, mAdapter, inflation)) + mustInvalidateStaticTimestamp = true; + } + + if(mustInvalidateStaticTimestamp) + invalidateStaticTimestamp(); + + mCompoundPrunerExt.flushShapes(mAdapter, inflation); +} + +void ExtPrunerManager::flushUpdates() +{ + PX_PROFILE_ZONE("SceneQuery.flushUpdates", mContextID); + + if(mPrunerNeedsUpdating) + { + // no need to take lock if manual sq update is enabled + // as flushUpdates will only be called from NpScene::flushQueryUpdates() + mSQLock.lock(); + + if(mPrunerNeedsUpdating) + { + flushShapes(); + + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;ipruner()) + pe->pruner()->commit(); + } + + if(mUsesTreeOfPruners) + createTreeOfPruners(); + + PxMemoryBarrier(); + mPrunerNeedsUpdating = false; + } + mSQLock.unlock(); + } +} + +void ExtPrunerManager::forceRebuildDynamicTree(PxU32 prunerIndex) +{ + // PT: beware here when called from the PxScene, the prunerIndex may not match + + PX_PROFILE_ZONE("SceneQuery.forceDynamicTreeRebuild", mContextID); + + if(prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + PxMutex::ScopedLock lock(mSQLock); + + PrunerExt* pe = mPrunerExt[prunerIndex]; + Pruner* pruner = pe->pruner(); + + if(pruner && pruner->isDynamic()) + { + static_cast(pruner)->purge(); + static_cast(pruner)->commit(); + } +} + +void* ExtPrunerManager::prepareSceneQueriesUpdate(PxU32 prunerIndex) +{ + // PT: beware here when called from the PxScene, the prunerIndex may not match + + if(prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return NULL; + } + + PX_ASSERT(mPrunerExt[prunerIndex]->pruner()); + + bool retVal = false; + Pruner* pruner = mPrunerExt[prunerIndex]->pruner(); + if(pruner && pruner->isDynamic()) + retVal = static_cast(pruner)->prepareBuild(); + + return retVal ? pruner : NULL; +} + +void ExtPrunerManager::sceneQueryBuildStep(void* handle) +{ + PX_PROFILE_ZONE("SceneQuery.sceneQueryBuildStep", mContextID); + + Pruner* pruner = reinterpret_cast(handle); + + if(pruner && pruner->isDynamic()) + { + const bool buildFinished = static_cast(pruner)->buildStep(false); + if(buildFinished) + mPrunerNeedsUpdating = true; + } +} + +void ExtPrunerManager::visualize(PxU32 prunerIndex, PxRenderOutput& out) const +{ + // PT: beware here when called from the PxScene, the prunerIndex may not match + // This is quite awkward and should be improved. + + // PT: problem here is that this function will be called by the regular PhysX scene when plugged to its PxSceneDesc, + // and the calling code only understands the regular PhysX pruners. + + const bool visualizeCompoundPruner = prunerIndex==0xffffffff; + if(visualizeCompoundPruner) + { + const CompoundPruner* cp = mCompoundPrunerExt.pruner(); + if(cp) + cp->visualizeEx(out, SQ_DEBUG_VIZ_COMPOUND_COLOR, true, true); + } + else + { + if(prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + PrunerExt* pe = mPrunerExt[prunerIndex]; + Pruner* pruner = pe->pruner(); + if(pruner) + { + // PT: TODO: this doesn't really work: the static color was for static shapes but they + // could still be stored in a dynamic pruner. So this code doesn't use a color scheme + // consistent with what we use in the default code. + if(pruner->isDynamic()) + { + //if(visDynamic) + pruner->visualize(out, SQ_DEBUG_VIZ_DYNAMIC_COLOR, SQ_DEBUG_VIZ_DYNAMIC_COLOR2); + } + else + { + //if(visStatic) + pruner->visualize(out, SQ_DEBUG_VIZ_STATIC_COLOR, SQ_DEBUG_VIZ_STATIC_COLOR2); + } + } + } +} + +void ExtPrunerManager::shiftOrigin(const PxVec3& shift) +{ + const PxU32 nb = mPrunerExt.size(); + for(PxU32 i=0;ipruner(); + if(pruner) + pruner->shiftOrigin(shift); + } + + mCompoundPrunerExt.pruner()->shiftOrigin(shift); +} + +void ExtPrunerManager::addCompoundShape(const PxBVH& pxbvh, PrunerCompoundId compoundId, const PxTransform& compoundTransform, PrunerHandle* prunerHandle, const PrunerPayload* payloads, const PxTransform* transforms, bool isDynamic) +{ + const Gu::BVH& bvh = static_cast(pxbvh); + + PX_ASSERT(mCompoundPrunerExt.mPruner); + mCompoundPrunerExt.mPruner->addCompound(prunerHandle, bvh, compoundId, compoundTransform, isDynamic, payloads, transforms); + if(!isDynamic) + invalidateStaticTimestamp(); +} + +void ExtPrunerManager::updateCompoundActor(PrunerCompoundId compoundId, const PxTransform& compoundTransform) +{ + PX_ASSERT(mCompoundPrunerExt.mPruner); + const bool isDynamic = mCompoundPrunerExt.mPruner->updateCompound(compoundId, compoundTransform); + if(!isDynamic) + invalidateStaticTimestamp(); +} + +void ExtPrunerManager::removeCompoundActor(PrunerCompoundId compoundId, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_ASSERT(mCompoundPrunerExt.mPruner); + const bool isDynamic = mCompoundPrunerExt.mPruner->removeCompound(compoundId, removalCallback); + if(!isDynamic) + invalidateStaticTimestamp(); +} + +void ExtPrunerManager::sync(PxU32 prunerIndex, const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) +{ + if(!count) + return; + + if(prunerIndex>=mPrunerExt.size()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Invalid pruner index"); + return; + } + + Pruner* pruner = getPruner(prunerIndex); + if(!pruner) + return; + + PxU32 startIndex = 0; + PxU32 numIndices = count; + + // if shape sim map is not empty, parse the indices and skip update for the dirty one + if(ignoredIndices.count()) + { + // PT: I think this codepath was used with SCB / buffered changes, but it's not needed anymore + numIndices = 0; + + for(PxU32 i=0; iupdateObjects(handles + startIndex, numIndices, mInflation, boundsIndices + startIndex, bounds, transforms); + numIndices = 0; + startIndex = i + 1; + } + else + numIndices++; + } + // PT: we fallback to the next line on purpose - no "else" + } + + pruner->updateObjects(handles + startIndex, numIndices, mInflation, boundsIndices + startIndex, bounds, transforms); +} + +PxU32 ExtPrunerManager::startCustomBuildstep() +{ + PX_PROFILE_ZONE("SceneQuery.startCustomBuildstep", mContextID); + + // flush user modified objects + //flushShapes(); + { + PX_PROFILE_ZONE("SceneQuery.flushShapes", mContextID); + // PT: only flush the compound pruner synchronously + // must already have acquired writer lock here + const float inflation = 1.0f + mInflation; + mCompoundPrunerExt.flushShapes(mAdapter, inflation); + } + + mTimestampNeedsUpdating = false; + + return mPrunerExt.size(); +} + +void ExtPrunerManager::customBuildstep(PxU32 index) +{ + PX_PROFILE_ZONE("SceneQuery.customBuildstep", mContextID); + + PX_ASSERT(indexpruner(); + + //void ExtPrunerManager::flushShapes() + { + PX_PROFILE_ZONE("SceneQuery.flushShapes", mContextID); + // must already have acquired writer lock here + const float inflation = 1.0f + mInflation; + if(pe->processDirtyList(index, mAdapter, inflation)) + mTimestampNeedsUpdating = true; + } + + if(pruner) + { + if(pruner->isDynamic()) + static_cast(pruner)->buildStep(true); // PT: "true" because that parameter was made for PxSceneQuerySystem::sceneQueryBuildStep(), not us + + pruner->commit(); + } +} + +void ExtPrunerManager::finishCustomBuildstep() +{ + PX_PROFILE_ZONE("SceneQuery.finishCustomBuildstep", mContextID); + + if(mUsesTreeOfPruners) + createTreeOfPruners(); + + mPrunerNeedsUpdating = false; + if(mTimestampNeedsUpdating) + invalidateStaticTimestamp(); +} + +void ExtPrunerManager::createTreeOfPruners() +{ + PX_PROFILE_ZONE("SceneQuery.createTreeOfPruners", mContextID); + + PX_DELETE(mTreeOfPruners); + + mTreeOfPruners = PX_NEW(BVH)(NULL); + + const PxU32 nb = mPrunerExt.size(); + + PxBounds3* prunerBounds = reinterpret_cast(PxAlloca(sizeof(PxBounds3)*(nb+1))); + + PxU32 nbBounds = 0; + for(PxU32 i=0;ipruner(); + if(pruner) + pruner->getGlobalBounds(prunerBounds[nbBounds++]); + } + + mTreeOfPruners->init(nbBounds, NULL, prunerBounds, sizeof(PxBounds3), BVH_SPLATTER_POINTS, 1, 0.01f); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.h new file mode 100644 index 0000000..83408dd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqManager.h @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_SQ_MANAGER_H +#define EXT_SQ_MANAGER_H + +#include "common/PxPhysXCommonConfig.h" + +#include "foundation/PxBitMap.h" +#include "foundation/PxArray.h" +#include "SqPruner.h" +#include "SqManager.h" + +#include "foundation/PxHashSet.h" +namespace physx +{ +namespace Sq +{ + class CompoundPruner; +} +} + +#include "foundation/PxMutex.h" + +namespace physx +{ +class PxRenderOutput; +class PxBVH; +class PxSceneLimits; + +namespace Gu +{ + class BVH; +} + +namespace Sq +{ + // PT: this is a customized version of physx::Sq::PrunerManager that supports more than 2 hardcoded pruners. + // It might not be possible to support the whole PxSceneQuerySystem API with an arbitrary number of pruners. + class ExtPrunerManager : public PxUserAllocated + { + public: + ExtPrunerManager(PxU64 contextID, float inflation, const Adapter& adapter, bool usesTreeOfPruners); + ~ExtPrunerManager(); + + PxU32 addPruner(Gu::Pruner* pruner, PxU32 preallocated); + + Gu::PrunerHandle addPrunerShape(const Gu::PrunerPayload& payload, PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, const PxBounds3& bounds, const PxTransform& transform, bool hasPruningStructure=false); + void addCompoundShape(const PxBVH& bvh, PrunerCompoundId compoundId, const PxTransform& compoundTransform, Gu::PrunerHandle* prunerHandle, const Gu::PrunerPayload* payloads, const PxTransform* transforms, bool isDynamic); + void markForUpdate(PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, Gu::PrunerHandle shapeHandle, const PxTransform& transform); + void removePrunerShape(PxU32 prunerIndex, bool dynamic, PrunerCompoundId compoundId, Gu::PrunerHandle shapeHandle, Gu::PrunerPayloadRemovalCallback* removalCallback); + + PX_FORCE_INLINE PxU32 getNbPruners() const { return mPrunerExt.size(); } + PX_FORCE_INLINE const Gu::Pruner* getPruner(PxU32 index) const { return mPrunerExt[index]->mPruner; } + PX_FORCE_INLINE Gu::Pruner* getPruner(PxU32 index) { return mPrunerExt[index]->mPruner; } + PX_FORCE_INLINE const CompoundPruner* getCompoundPruner() const { return mCompoundPrunerExt.mPruner; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + + void preallocate(PxU32 prunerIndex, PxU32 nbShapes); + + void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint); + PX_FORCE_INLINE PxU32 getDynamicTreeRebuildRateHint() const { return mRebuildRateHint; } + + void flushUpdates(); + void forceRebuildDynamicTree(PxU32 prunerIndex); + + void updateCompoundActor(PrunerCompoundId compoundId, const PxTransform& compoundTransform); + void removeCompoundActor(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback* removalCallback); + + void* prepareSceneQueriesUpdate(PxU32 prunerIndex); + void sceneQueryBuildStep(void* handle); + + void sync(PxU32 prunerIndex, const Gu::PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices); + void afterSync(bool buildStep, bool commit); + void shiftOrigin(const PxVec3& shift); + void visualize(PxU32 prunerIndex, PxRenderOutput& out) const; + + void flushMemory(); + PX_FORCE_INLINE PxU32 getStaticTimestamp() const { return mStaticTimestamp; } + PX_FORCE_INLINE const Adapter& getAdapter() const { return mAdapter; } + PX_FORCE_INLINE const Gu::BVH* getTreeOfPruners() const { return mTreeOfPruners; } + + PxU32 startCustomBuildstep(); + void customBuildstep(PxU32 index); + void finishCustomBuildstep(); + + void createTreeOfPruners(); + private: + const Adapter& mAdapter; + PxArray mPrunerExt; + CompoundPrunerExt mCompoundPrunerExt; + + Gu::BVH* mTreeOfPruners; + + const PxU64 mContextID; + PxU32 mStaticTimestamp; + PxU32 mRebuildRateHint; + const float mInflation; // SQ_PRUNER_EPSILON + + PxMutex mSQLock; // to make sure only one query updates the dirty pruner structure if multiple queries run in parallel + + volatile bool mPrunerNeedsUpdating; + volatile bool mTimestampNeedsUpdating; + const bool mUsesTreeOfPruners; + + void flushShapes(); + PX_FORCE_INLINE void invalidateStaticTimestamp() { mStaticTimestamp++; } + + PX_NOCOPY(ExtPrunerManager) + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp new file mode 100644 index 0000000..a995a0a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.cpp @@ -0,0 +1,1236 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ExtSqQuery.h" + +using namespace physx; +using namespace Sq; + +#include "common/PxProfileZone.h" +#include "foundation/PxFPU.h" +#include "GuBounds.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionRay.h" +#include "GuBVH.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" +//#include "geometry/PxBVH.h" + +#include "PxQueryFiltering.h" +#include "PxRigidActor.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +// compiling for a windows target with clang will completely fail due to errors +// physx/include/foundation/PxFlags.h(81,29): note: candidate constructor not viable: no known conversion from 'const __restrict physx::PxHitFlags' (aka 'const __restrict PxFlagsfaceIndex = src->faceIndex; + dest->flags = src->flags; + dest->position = src->position; + dest->normal = src->normal; + dest->distance = src->distance; + dest->u = src->u; + dest->v = src->v; + dest->actor = src->actor; + dest->shape = src->shape; +} + +static PX_FORCE_INLINE void copy(PxSweepHit* PX_RESTRICT dest, const PxSweepHit* PX_RESTRICT src) +{ + dest->faceIndex = src->faceIndex; + dest->flags = src->flags; + dest->position = src->position; + dest->normal = src->normal; + dest->distance = src->distance; + dest->actor = src->actor; + dest->shape = src->shape; +} + +static PX_FORCE_INLINE void copy(PxOverlapHit* PX_RESTRICT dest, const PxOverlapHit* PX_RESTRICT src) +{ + dest->faceIndex = src->faceIndex; + dest->actor = src->actor; + dest->shape = src->shape; +} + +// these partial template specializations are used to generalize the query code to be reused for all permutations of +// hit type=(raycast, overlap, sweep) x query type=(ANY, SINGLE, MULTIPLE) +template struct HitTypeSupport { enum { IsRaycast = 0, IsSweep = 0, IsOverlap = 0 }; }; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 1, IsSweep = 0, IsOverlap = 0 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit& hit) { return static_cast(hit).distance; } +}; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 0, IsSweep = 1, IsOverlap = 0 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit& hit) { return static_cast(hit).distance; } +}; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 0, IsSweep = 0, IsOverlap = 1 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit&) { return -1.0f; } +}; + +#define HITDIST(hit) HitTypeSupport::getDistance(hit) + +template +static PxU32 clipHitsToNewMaxDist(HitType* ppuHits, PxU32 count, PxReal newMaxDist) +{ + PxU32 i=0; + while(i!=count) + { + if(HITDIST(ppuHits[i]) > newMaxDist) + ppuHits[i] = ppuHits[--count]; + else + i++; + } + return count; +} + +namespace physx +{ + namespace Sq + { + struct ExtMultiQueryInput + { + const PxVec3* rayOrigin; // only valid for raycasts + const PxVec3* unitDir; // only valid for raycasts and sweeps + PxReal maxDistance; // only valid for raycasts and sweeps + const PxGeometry* geometry; // only valid for overlaps and sweeps + const PxTransform* pose; // only valid for overlaps and sweeps + PxReal inflation; // only valid for sweeps + + // Raycast constructor + ExtMultiQueryInput(const PxVec3& aRayOrigin, const PxVec3& aUnitDir, PxReal aMaxDist) + { + rayOrigin = &aRayOrigin; + unitDir = &aUnitDir; + maxDistance = aMaxDist; + geometry = NULL; + pose = NULL; + inflation = 0.0f; + } + + // Overlap constructor + ExtMultiQueryInput(const PxGeometry* aGeometry, const PxTransform* aPose) + { + geometry = aGeometry; + pose = aPose; + inflation = 0.0f; + rayOrigin = unitDir = NULL; + } + + // Sweep constructor + ExtMultiQueryInput( + const PxGeometry* aGeometry, const PxTransform* aPose, + const PxVec3& aUnitDir, const PxReal aMaxDist, const PxReal aInflation) + { + rayOrigin = NULL; + maxDistance = aMaxDist; + unitDir = &aUnitDir; + geometry = aGeometry; + pose = aPose; + inflation = aInflation; + } + + PX_FORCE_INLINE const PxVec3& getDir() const { PX_ASSERT(unitDir); return *unitDir; } + PX_FORCE_INLINE const PxVec3& getOrigin() const { PX_ASSERT(rayOrigin); return *rayOrigin; } + }; + + } +} + +// performs a single geometry query for any HitType (PxSweepHit, PxOverlapHit, PxRaycastHit) +template +struct ExtGeomQueryAny +{ + static PX_FORCE_INLINE PxU32 geomHit( + const CachedFuncs& funcs, const ExtMultiQueryInput& input, const Gu::ShapeData& sd, + const PxGeometry& sceneGeom, const PxTransform& pose, PxHitFlags hitFlags, + PxU32 maxHits, HitType* hits, const PxReal shrunkMaxDistance, const PxBounds3* precomputedBounds, + PxQueryThreadContext* context) + { + using namespace Gu; + + const PxGeometry& geom0 = *input.geometry; + const PxTransform& pose0 = *input.pose; + const PxGeometry& geom1 = sceneGeom; + const PxTransform& pose1 = pose; + + // Handle raycasts + if(HitTypeSupport::IsRaycast) + { + // the test for mesh AABB is archived in //sw/physx/dev/apokrovsky/graveyard/sqMeshAABBTest.cpp + // TODO: investigate performance impact (see US12801) + PX_CHECK_AND_RETURN_VAL(input.getDir().isFinite(), "PxScene::raycast(): rayDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(input.getOrigin().isFinite(), "PxScene::raycast(): rayOrigin is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(pose1.isValid(), "PxScene::raycast(): pose is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(shrunkMaxDistance >= 0.0f, "PxScene::raycast(): maxDist is negative.", 0); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(shrunkMaxDistance), "PxScene::raycast(): maxDist is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(PxAbs(input.getDir().magnitudeSquared()-1)<1e-4f, + "PxScene::raycast(): ray direction must be unit vector.", 0); + + // PT: TODO: investigate perf difference + const RaycastFunc func = funcs.mCachedRaycastFuncs[geom1.getType()]; + return func(geom1, pose1, input.getOrigin(), input.getDir(), shrunkMaxDistance, + hitFlags, maxHits, reinterpret_cast(hits), sizeof(PxRaycastHit), context); + } + // Handle sweeps + else if(HitTypeSupport::IsSweep) + { + PX_ASSERT(precomputedBounds != NULL); + // b0 = query shape bounds + // b1 = scene shape bounds + // AP: Here we clip the sweep to bounds with sum of extents. This is needed for GJK stability. + // because sweep is equivalent to a raycast vs a scene shape with inflated bounds. + // This also may (or may not) provide an optimization for meshes because top level of rtree has multiple boxes + // and there is no bounds test for the whole mesh elsewhere + PxBounds3 b0 = *precomputedBounds, b1; + // compute the scene geometry bounds + // PT: TODO: avoid recomputing the bounds here + Gu::computeBounds(b1, sceneGeom, pose, 0.0f, 1.0f); + const PxVec3 combExt = (b0.getExtents() + b1.getExtents())*1.01f; + + PxF32 tnear, tfar; + if(!intersectRayAABB2(-combExt, combExt, b0.getCenter() - b1.getCenter(), input.getDir(), shrunkMaxDistance, tnear, tfar)) // returns (tneartfar) // this second test is needed because shrunkMaxDistance can be 0 for 0 length sweep + return 0; + PX_ASSERT(input.getDir().isNormalized()); + // tfar is now the t where the ray exits the AABB. input.getDir() is normalized + + const PxVec3& unitDir = input.getDir(); + PxSweepHit& sweepHit = reinterpret_cast(hits[0]); + + // if we don't start inside the AABB box, offset the start pos, because of precision issues with large maxDist + const bool offsetPos = (tnear > GU_RAY_SURFACE_OFFSET); + const PxReal offset = offsetPos ? (tnear - GU_RAY_SURFACE_OFFSET) : 0.0f; + const PxVec3 offsetVec(offsetPos ? (unitDir*offset) : PxVec3(0.0f)); + // we move the geometry we sweep against, so that we avoid the Gu::Capsule/Box recomputation + const PxTransform pose1Offset(pose1.p - offsetVec, pose1.q); + + const PxReal distance = PxMin(tfar, shrunkMaxDistance) - offset; + const PxReal inflation = input.inflation; + PX_CHECK_AND_RETURN_VAL(pose0.isValid(), "PxScene::sweep(): pose0 is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(pose1Offset.isValid(), "PxScene::sweep(): pose1 is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(unitDir.isFinite(), "PxScene::sweep(): unitDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(distance), "PxScene::sweep(): distance is not valid.", 0); + PX_CHECK_AND_RETURN_VAL((distance >= 0.0f && !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) || distance > 0.0f, + "PxScene::sweep(): sweep distance must be >=0 or >0 with eASSUME_NO_INITIAL_OVERLAP.", 0); + + PxU32 retVal = 0; + const GeomSweepFuncs& sf = funcs.mCachedSweepFuncs; + switch(geom0.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxCapsuleGeometry capsuleGeom(sphereGeom.radius, 0.0f); + const Capsule worldCapsule(pose0.p, pose0.p, sphereGeom.radius); // AP: precompute? + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, capsuleGeom, pose0, worldCapsule, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eCAPSULE: + { + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, static_cast(geom0), pose0, sd.getGuCapsule(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eBOX: + { + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepBoxFunc func = precise ? sf.preciseBoxMap[geom1.getType()] : sf.boxMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, static_cast(geom0), pose0, sd.getGuBox(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const SweepConvexFunc func = sf.convexMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, convexGeom, pose0, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + default: + outputError(__LINE__, "PxScene::sweep(): first geometry object parameter must be sphere, capsule, box or convex geometry."); + break; + } + if (retVal) + { + // we need to offset the distance back + sweepHit.distance += offset; + // we need to offset the hit position back as we moved the geometry we sweep against + sweepHit.position += offsetVec; + } + return retVal; + } + // Handle overlaps + else if(HitTypeSupport::IsOverlap) + { + const GeomOverlapTable* overlapFuncs = funcs.mCachedOverlapFuncs; + return PxU32(Gu::overlap(geom0, pose0, geom1, pose1, overlapFuncs, context)); + } + else + { + PX_ALWAYS_ASSERT_MESSAGE("Unexpected template expansion in GeomQueryAny::geomHit"); + return 0; + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE bool applyFilterEquation(const ExtQueryAdapter& adapter, const PrunerPayload& payload, const PxFilterData& queryFd) +{ + // if the filterData field is non-zero, and the bitwise-AND value of filterData AND the shape's + // queryFilterData is zero, the shape is skipped. + if(queryFd.word0 | queryFd.word1 | queryFd.word2 | queryFd.word3) + { + // PT: TODO: revisit this, there's an obvious LHS here otherwise + // We could maybe make this more flexible and let the user do the filtering +// const PxFilterData& objFd = adapter.getFilterData(payload); + PxFilterData objFd; + adapter.getFilterData(payload, objFd); + + const PxU32 keep = (queryFd.word0 & objFd.word0) | (queryFd.word1 & objFd.word1) | (queryFd.word2 & objFd.word2) | (queryFd.word3 & objFd.word3); + if(!keep) + return false; + } + return true; +} + +static PX_FORCE_INLINE bool applyAllPreFiltersSQ( + const ExtQueryAdapter& adapter, const PrunerPayload& payload, const PxActorShape& as, PxQueryHitType::Enum& shapeHitType, const PxQueryFlags& inFilterFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + PxHitFlags& queryFlags/*, PxU32 maxNbTouches*/) +{ + // #MODIFIED + // PT: we have to do the static / dynamic filtering here now, because we're operating on N pruners + // and we don't know which one(s) are "static", which ones are "dynamic", and which ones are a mix of both. + const bool doStatics = filterData.flags & PxQueryFlag::eSTATIC; + const bool doDynamic = filterData.flags & PxQueryFlag::eDYNAMIC; + const PxType actorType = as.actor->getConcreteType(); + const bool isStatic = (actorType == PxConcreteType::eRIGID_STATIC); + if(isStatic && !doStatics) + return false; + if(!isStatic && !doDynamic) + return false; + //~#MODIFIED + + if(!(filterData.flags & PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR) && !applyFilterEquation(adapter, payload, filterData.data)) + return false; + + if((inFilterFlags & PxQueryFlag::ePREFILTER) && (filterCall)) + { + PxHitFlags outQueryFlags = queryFlags; + + if(filterCall) + shapeHitType = filterCall->preFilter(filterData.data, as.shape, as.actor, outQueryFlags); + + // AP: at this point the callback might return eTOUCH but the touch buffer can be empty, the hit will be discarded + //PX_CHECK_MSG(hitType == PxQueryHitType::eTOUCH ? maxNbTouches > 0 : true, + // "SceneQuery: preFilter returned eTOUCH but empty touch buffer was provided, hit discarded."); + + queryFlags = (queryFlags & ~PxHitFlag::eMODIFIABLE_FLAGS) | (outQueryFlags & PxHitFlag::eMODIFIABLE_FLAGS); + + if(shapeHitType == PxQueryHitType::eNONE) + return false; + } + // test passed, continue to return as; + return true; +} + +static PX_NOINLINE void computeCompoundShapeTransform(PxTransform* PX_RESTRICT transform, const PxTransform* PX_RESTRICT compoundPose, const PxTransform* PX_RESTRICT transforms, PxU32 primIndex) +{ + *transform = (*compoundPose) * transforms[primIndex]; +} + +// struct to access protected data members in the public PxHitCallback API +template +struct ExtMultiQueryCallback : public PrunerRaycastCallback, public PrunerOverlapCallback, public CompoundPrunerRaycastCallback, public CompoundPrunerOverlapCallback +{ + const ExtSceneQueries& mScene; + const ExtMultiQueryInput& mInput; + PxHitCallback& mHitCall; + const PxHitFlags mHitFlags; + const PxQueryFilterData& mFilterData; + PxQueryFilterCallback* mFilterCall; + PxReal mShrunkDistance; + const PxHitFlags mMeshAnyHitFlags; + bool mReportTouchesAgain; + bool mFarBlockFound; // this is to prevent repeated searches for far block + const bool mNoBlock; + const bool mAnyHit; + + // The reason we need these bounds is because we need to know combined(inflated shape) bounds to clip the sweep path + // to be tolerable by GJK precision issues. This test is done for (queryShape vs touchedShapes) + // So it makes sense to cache the bounds for sweep query shape, otherwise we'd have to recompute them every time + // Currently only used for sweeps. + const PxBounds3* mQueryShapeBounds; + const ShapeData* mShapeData; + PxTransform mCompoundShapeTransform; + + ExtMultiQueryCallback( + const ExtSceneQueries& scene, const ExtMultiQueryInput& input, bool anyHit, PxHitCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, PxReal shrunkDistance) : + mScene (scene), + mInput (input), + mHitCall (hitCall), + mHitFlags (hitFlags), + mFilterData (filterData), + mFilterCall (filterCall), + mShrunkDistance (shrunkDistance), + mMeshAnyHitFlags ((hitFlags.isSet(PxHitFlag::eMESH_ANY) || anyHit) ? PxHitFlag::eMESH_ANY : PxHitFlag::Enum(0)), + mReportTouchesAgain (true), + mFarBlockFound (filterData.flags & PxQueryFlag::eNO_BLOCK), + mNoBlock (filterData.flags & PxQueryFlag::eNO_BLOCK), + mAnyHit (anyHit), + mQueryShapeBounds (NULL), + mShapeData (NULL) + { + } + + bool processTouchHit(const HitType& hit, PxReal& aDist) PX_MSVC_RESTRICT + { + // -------------------------- handle eTOUCH hits --------------------------------- + // for qType=multiple, store the hit. For other qTypes ignore it. + // <= is important for initially overlapping sweeps + #if PX_CHECKED + if(mHitCall.maxNbTouches == 0 && !mFilterData.flags.isSet(PxQueryFlag::eRESERVED)) + // issue a warning if eTOUCH was returned by the prefilter, we have 0 touch buffer and not a batch query + // not doing for BQ because the touches buffer can be overflown and thats ok by spec + // eRESERVED to avoid a warning from nested callback (closest blocking hit recursive search) + outputError(__LINE__, "User filter returned PxQueryHitType::eTOUCH but the touches buffer was empty. Hit was discarded."); + #endif + + if(mHitCall.maxNbTouches && mReportTouchesAgain && HITDIST(hit) <= mShrunkDistance) + { + // Buffer full: need to find the closest blocking hit, clip touch hits and flush the buffer + if(mHitCall.nbTouches == mHitCall.maxNbTouches) + { + // issue a second nested query just looking for the closest blocking hit + // could do better perf-wise by saving traversal state (start looking for blocking from this point) + // but this is not a perf critical case because users can provide a bigger buffer + // that covers non-degenerate cases + // far block search doesn't apply to overlaps because overlaps don't work with blocking hits + if(HitTypeSupport::IsOverlap == 0) + { + // AP: the use of eRESERVED is a bit tricky, see other comments containing #LABEL1 + PxQueryFilterData fd1 = mFilterData; fd1.flags |= PxQueryFlag::eRESERVED; + PxHitBuffer buf1; // create a temp callback buffer for a single blocking hit + if(!mFarBlockFound && mHitCall.maxNbTouches > 0 && mScene.ExtSceneQueries::multiQuery(mInput, buf1, mHitFlags, NULL, fd1, mFilterCall)) + { + mHitCall.block = buf1.block; + mHitCall.hasBlock = true; + mHitCall.nbTouches = + clipHitsToNewMaxDist(mHitCall.touches, mHitCall.nbTouches, HITDIST(buf1.block)); + mShrunkDistance = HITDIST(buf1.block); + aDist = mShrunkDistance; + } + mFarBlockFound = true; + } + if(mHitCall.nbTouches == mHitCall.maxNbTouches) + { + mReportTouchesAgain = mHitCall.processTouches(mHitCall.touches, mHitCall.nbTouches); + if(!mReportTouchesAgain) + return false; // optimization - buffer is full + else + mHitCall.nbTouches = 0; // reset nbTouches so we can continue accumulating again + } + } + + //if(hitCall.nbTouches < hitCall.maxNbTouches) // can be true if maxNbTouches is 0 + mHitCall.touches[mHitCall.nbTouches++] = hit; + } // if(hitCall.maxNbTouches && reportTouchesAgain && HITDIST(hit) <= shrunkDistance) + + return true; + } + + template // is this call coming as a callback from the pruner or a single item cached callback? + bool _invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) PX_MSVC_RESTRICT + { + PX_ASSERT(payloads); + const PrunerPayload& payload = payloads[primIndex]; + const ExtQueryAdapter& adapter = static_cast(mScene.mSQManager.getAdapter()); + + PxActorShape actorShape; + adapter.getActorShape(payload, actorShape); + + const PxQueryFlags filterFlags = mFilterData.flags; + + // for no filter callback, default to eTOUCH for MULTIPLE, eBLOCK otherwise + // also always treat as eBLOCK if currently tested shape is cached + // Using eRESERVED flag as a special condition to default to eTOUCH hits while only looking for a single blocking hit + // from a nested query (see other comments containing #LABEL1) + PxQueryHitType::Enum shapeHitType = + ((mHitCall.maxNbTouches || (mFilterData.flags & PxQueryFlag::eRESERVED)) && !isCached) + ? PxQueryHitType::eTOUCH + : PxQueryHitType::eBLOCK; + + // apply pre-filter + PxHitFlags filteredHitFlags = mHitFlags; + if(!isCached) // don't run filters on single item cache + { + if(!applyAllPreFiltersSQ(adapter, payload, actorShape, shapeHitType/*in&out*/, filterFlags, mFilterData, mFilterCall, filteredHitFlags/*, mHitCall.maxNbTouches*/)) + return true; // skip this shape from reporting if prefilter said to do so + +// if(shapeHitType == PxQueryHitType::eNONE) +// return true; + } + + const PxGeometry& shapeGeom = adapter.getGeometry(payload); + + PX_ASSERT(transforms); + const PxTransform* shapeTransform; + if(!compoundPose) + { + shapeTransform = transforms + primIndex; + } + else + { + computeCompoundShapeTransform(&mCompoundShapeTransform, compoundPose, transforms, primIndex); + shapeTransform = &mCompoundShapeTransform; + } + + const PxU32 tempCount = 1; + HitType tempBuf[tempCount]; + + // Here we decide whether to use the user provided buffer in place or a local stack buffer + // see if we have more room left in the callback results buffer than in the parent stack buffer + // if so get subHits in-place in the hit buffer instead of the parent stack buffer + // nbTouches is the number of accumulated touch hits so far + // maxNbTouches is the size of the user buffer + PxU32 maxSubHits1; + HitType* subHits1; + if(mHitCall.nbTouches >= mHitCall.maxNbTouches) + // if there's no room left in the user buffer, use a stack buffer + { + // tried using 64 here - causes check stack code to get generated on xbox, perhaps because of guard page + // need this buffer in case the input buffer is full but we still want to correctly merge results from later hits + maxSubHits1 = tempCount; + subHits1 = reinterpret_cast(tempBuf); + } + else + { + maxSubHits1 = mHitCall.maxNbTouches - mHitCall.nbTouches; // how much room is left in the user buffer + subHits1 = mHitCall.touches + mHitCall.nbTouches; // pointer to the first free hit in the user buffer + } + + // call the geometry specific intersection template + const PxU32 nbSubHits = ExtGeomQueryAny::geomHit( + mScene.mCachedFuncs, mInput, *mShapeData, shapeGeom, + *shapeTransform, filteredHitFlags | mMeshAnyHitFlags, + maxSubHits1, subHits1, mShrunkDistance, mQueryShapeBounds, &mHitCall); + + // ------------------------- iterate over geometry subhits ----------------------------------- + for (PxU32 iSubHit = 0; iSubHit < nbSubHits; iSubHit++) + { + HitType& hit = subHits1[iSubHit]; + hit.actor = actorShape.actor; + hit.shape = actorShape.shape; + + // some additional processing only for sweep hits with initial overlap + if(HitTypeSupport::IsSweep && HITDIST(hit) == 0.0f && !(filteredHitFlags & PxHitFlag::eMTD)) + // PT: necessary as some leaf routines are called with reversed params, thus writing +unitDir there. + // AP: apparently still necessary to also do in Gu because Gu can be used standalone (without SQ) + reinterpret_cast(hit).normal = -mInput.getDir(); + + // start out with hitType for this cached shape set to a pre-filtered hit type + PxQueryHitType::Enum hitType = shapeHitType; + + // run the post-filter if specified in filterFlags and filterCall is non-NULL + if(!isCached && mFilterCall && (filterFlags & PxQueryFlag::ePOSTFILTER)) + { + //if(mFilterCall) + hitType = mFilterCall->postFilter(mFilterData.data, hit, hit.shape, hit.actor); + } + + // early out on any hit if eANY_HIT was specified, regardless of hit type + if(mAnyHit && hitType != PxQueryHitType::eNONE) + { + // block or touch qualifies for qType=ANY type hit => return it as blocking according to spec. Ignore eNONE. + //mHitCall.block = hit; + copy(&mHitCall.block, &hit); + mHitCall.hasBlock = true; + return false; // found a hit for ANY qType, can early exit now + } + + if(mNoBlock) + hitType = PxQueryHitType::eTOUCH; + + PX_WARN_ONCE_IF(HitTypeSupport::IsOverlap && hitType == PxQueryHitType::eBLOCK, + "eBLOCK returned from user filter for overlap() query. This may cause undesired behavior. " + "Consider using PxQueryFlag::eNO_BLOCK for overlap queries."); + + if(hitType == PxQueryHitType::eTOUCH) + { + if(!processTouchHit(hit, aDist)) + return false; + } // if(hitType == PxQueryHitType::eTOUCH) + else if(hitType == PxQueryHitType::eBLOCK) + { + // -------------------------- handle eBLOCK hits ---------------------------------- + // only eBLOCK qualifies as a closest hit candidate => compare against best distance and store + // <= is needed for eTOUCH hits to be recorded correctly vs same eBLOCK distance for overlaps + if(HITDIST(hit) <= mShrunkDistance) + { + if(HitTypeSupport::IsOverlap == 0) + { + mShrunkDistance = HITDIST(hit); + aDist = mShrunkDistance; + } + //mHitCall.block = hit; + copy(&mHitCall.block, &hit); + mHitCall.hasBlock = true; + } + } // if(hitType == eBLOCK) + else { + PX_ASSERT(hitType == PxQueryHitType::eNONE); + } + } // for iSubHit + return true; + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + return _invoke(aDist, primIndex, payloads, transforms, NULL); + } + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + float unused = 0.0f; + return _invoke(unused, primIndex, payloads, transforms, NULL); + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) + { + return _invoke(aDist, primIndex, payloads, transforms, compoundPose); + } + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) + { + float unused = 0.0f; + return _invoke(unused, primIndex, payloads, transforms, compoundPose); + } + +private: + ExtMultiQueryCallback& operator=(const ExtMultiQueryCallback&); +}; + +//======================================================================================================================== +#if PX_SUPPORT_PVD +template +struct ExtCapturePvdOnReturn : public PxHitCallback +{ + // copy the arguments of multiQuery into a struct, this is strictly for PVD recording + const ExtSceneQueries* mSQ; + const ExtMultiQueryInput& mInput; + const PxQueryFilterData& mFilterData; + PxArray mAllHits; + PxHitCallback& mParentCallback; + + ExtCapturePvdOnReturn( + const ExtSceneQueries* sq, const ExtMultiQueryInput& input, + const PxQueryFilterData& filterData, + PxHitCallback& parentCallback) : + PxHitCallback (parentCallback.touches, parentCallback.maxNbTouches), + mSQ (sq), + mInput (input), + mFilterData (filterData), + mParentCallback (parentCallback) + {} + + virtual PxAgain processTouches(const HitType* hits, PxU32 nbHits) + { + const PxAgain again = mParentCallback.processTouches(hits, nbHits); + for(PxU32 i=0; imPVD; + if(!pvd || !pvd->transmitSceneQueries()) + return; + + if(mParentCallback.nbTouches) + { + for(PxU32 i = 0; i < mParentCallback.nbTouches; i++) + mAllHits.pushBack(mParentCallback.touches[i]); + } + + if(mParentCallback.hasBlock) + mAllHits.pushBack(mParentCallback.block); + + // PT: TODO: why do we need reinterpret_casts below? + if(HitTypeSupport::IsRaycast) + pvd->raycast(mInput.getOrigin(), mInput.getDir(), mInput.maxDistance, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData, this->maxNbTouches!=0); + else if(HitTypeSupport::IsOverlap) + pvd->overlap(*mInput.geometry, *mInput.pose, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData); + else if(HitTypeSupport::IsSweep) + pvd->sweep (*mInput.geometry, *mInput.pose, mInput.getDir(), mInput.maxDistance, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData, this->maxNbTouches!=0); + } + +private: + ExtCapturePvdOnReturn& operator=(const ExtCapturePvdOnReturn&); +}; +#endif // PX_SUPPORT_PVD + +//======================================================================================================================== +template +struct ExtIssueCallbacksOnReturn +{ + PxHitCallback& hits; + bool again; // query was stopped by previous processTouches. This means that nbTouches is still non-zero + // but we don't need to issue processTouches again + PX_FORCE_INLINE ExtIssueCallbacksOnReturn(PxHitCallback& aHits) : hits(aHits) + { + again = true; + } + + ~ExtIssueCallbacksOnReturn() + { + if(again) + // only issue processTouches if query wasn't stopped + // this is because nbTouches doesn't get reset to 0 in this case (according to spec) + // and the touches in touches array were already processed by the callback + { + if(hits.hasBlock && hits.nbTouches) + hits.nbTouches = clipHitsToNewMaxDist(hits.touches, hits.nbTouches, HITDIST(hits.block)); + if(hits.nbTouches) + { + bool again_ = hits.processTouches(hits.touches, hits.nbTouches); + if(again_) + hits.nbTouches = 0; + } + } + hits.finalizeQuery(); + } + +private: + ExtIssueCallbacksOnReturn& operator=(const ExtIssueCallbacksOnReturn&); +}; + +#undef HITDIST + +//======================================================================================================================== + +template +static bool doQueryVsCached(const PrunerHandle handle, PxU32 prunerIndex, const PrunerCompoundId cachedCompoundId, const ExtPrunerManager& manager, ExtMultiQueryCallback& pcb, const ExtMultiQueryInput& input); + +static PX_FORCE_INLINE PxCompoundPrunerQueryFlags convertFlags(PxQueryFlags inFlags) +{ + PxCompoundPrunerQueryFlags outFlags(0); + if(inFlags.isSet(PxQueryFlag::eSTATIC)) + outFlags.raise(PxCompoundPrunerQueryFlag::eSTATIC); + if(inFlags.isSet(PxQueryFlag::eDYNAMIC)) + outFlags.raise(PxCompoundPrunerQueryFlag::eDYNAMIC); + return outFlags; +} + +// #MODIFIED +static PX_FORCE_INLINE bool prunerFilter(const ExtQueryAdapter& adapter, PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) +{ + // PT: the internal PhysX code can skip an entire pruner by just testing one query flag, since there is a direct + // mapping between the static/dynamic flags and the static/dynamic pruners. This is not the case here anymore, + // so instead we call a user-provided callback to validate processing each pruner. + return adapter.processPruner(prunerIndex, context, filterData, filterCall); +} +//~#MODIFIED + +// PT: the following local callbacks are for the "tree of pruners" +template +struct LocalBaseCallback +{ + LocalBaseCallback(ExtMultiQueryCallback& pcb, const Sq::ExtPrunerManager& manager, const ExtQueryAdapter& adapter, PxHitCallback& hits, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) : + mPCB (pcb), + mSQManager (manager), + mAdapter (adapter), + mHits (hits), + mFilterData (filterData), + mFilterCall (filterCall) + {} + + ExtMultiQueryCallback& mPCB; + const Sq::ExtPrunerManager& mSQManager; + const ExtQueryAdapter& mAdapter; + PxHitCallback& mHits; + const PxQueryFilterData& mFilterData; + PxQueryFilterCallback* mFilterCall; + + PX_FORCE_INLINE const Pruner* filtering(PxU32 prunerIndex) + { + if(!prunerFilter(mAdapter, prunerIndex, &mHits, mFilterData, mFilterCall)) + return NULL; + + return mSQManager.getPruner(prunerIndex); + } + + PX_NOCOPY(LocalBaseCallback) +}; + +template +struct LocalRaycastCallback : LocalBaseCallback, PxBVHRaycastCallback +{ + LocalRaycastCallback(const ExtMultiQueryInput& input, ExtMultiQueryCallback& pcb, const Sq::ExtPrunerManager& manager, const ExtQueryAdapter& adapter, PxHitCallback& hits, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) : + LocalBaseCallback(pcb, manager, adapter, hits, filterData, filterCall), mInput(input) {} + + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) + { + const Pruner* pruner = LocalBaseCallback::filtering(boundsIndex); + if(!pruner) + return true; + return pruner->raycast(mInput.getOrigin(), mInput.getDir(), distance, this->mPCB); + } + + const ExtMultiQueryInput& mInput; + + PX_NOCOPY(LocalRaycastCallback) +}; + +template +struct LocalOverlapCallback : LocalBaseCallback, PxBVHOverlapCallback +{ + LocalOverlapCallback(const ShapeData& shapeData, ExtMultiQueryCallback& pcb, const Sq::ExtPrunerManager& manager, const ExtQueryAdapter& adapter, PxHitCallback& hits, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) : + LocalBaseCallback(pcb, manager, adapter, hits, filterData, filterCall), mShapeData(shapeData) {} + + virtual bool reportHit(PxU32 boundsIndex) + { + const Pruner* pruner = LocalBaseCallback::filtering(boundsIndex); + if(!pruner) + return true; + return pruner->overlap(mShapeData, this->mPCB); + } + + const ShapeData& mShapeData; + + PX_NOCOPY(LocalOverlapCallback) +}; + +template +struct LocalSweepCallback : LocalBaseCallback, PxBVHRaycastCallback +{ + LocalSweepCallback(const ShapeData& shapeData, const PxVec3& dir, ExtMultiQueryCallback& pcb, const Sq::ExtPrunerManager& manager, const ExtQueryAdapter& adapter, PxHitCallback& hits, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) : + LocalBaseCallback(pcb, manager, adapter, hits, filterData, filterCall), mShapeData(shapeData), mDir(dir) {} + + virtual bool reportHit(PxU32 boundsIndex, PxReal& distance) + { + const Pruner* pruner = LocalBaseCallback::filtering(boundsIndex); + if(!pruner) + return true; + return pruner->sweep(mShapeData, mDir, distance, this->mPCB); + } + + const ShapeData& mShapeData; + const PxVec3& mDir; + + PX_NOCOPY(LocalSweepCallback) +}; + +// PT: TODO: revisit error messages without breaking UTs +template +bool ExtSceneQueries::multiQuery( + const ExtMultiQueryInput& input, PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryCache* cache, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const +{ + const bool anyHit = (filterData.flags & PxQueryFlag::eANY_HIT) == PxQueryFlag::eANY_HIT; + + if(HitTypeSupport::IsRaycast == 0) + { + PX_CHECK_AND_RETURN_VAL(input.pose != NULL, "NpSceneQueries::overlap/sweep pose is NULL.", 0); + PX_CHECK_AND_RETURN_VAL(input.pose->isValid(), "NpSceneQueries::overlap/sweep pose is not valid.", 0); + } + else + { + PX_CHECK_AND_RETURN_VAL(input.getOrigin().isFinite(), "NpSceneQueries::raycast pose is not valid.", 0); + } + + if(HitTypeSupport::IsOverlap == 0) + { + PX_CHECK_AND_RETURN_VAL(input.getDir().isFinite(), "NpSceneQueries multiQuery input check: unitDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(input.getDir().isNormalized(), "NpSceneQueries multiQuery input check: direction must be normalized", 0); + } + + if(HitTypeSupport::IsRaycast) + { + PX_CHECK_AND_RETURN_VAL(input.maxDistance > 0.0f, "NpSceneQueries::multiQuery input check: distance cannot be negative or zero", 0); + } + + if(HitTypeSupport::IsOverlap && !anyHit) + { + PX_CHECK_AND_RETURN_VAL(hits.maxNbTouches > 0, "PxScene::overlap() calls without eANY_HIT flag require a touch hit buffer for return results.", 0); + } + + if(HitTypeSupport::IsSweep) + { + PX_CHECK_AND_RETURN_VAL(input.maxDistance >= 0.0f, "NpSceneQueries multiQuery input check: distance cannot be negative", 0); + PX_CHECK_AND_RETURN_VAL(input.maxDistance != 0.0f || !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP), + "NpSceneQueries multiQuery input check: zero-length sweep only valid without the PxHitFlag::eASSUME_NO_INITIAL_OVERLAP flag", 0); + } + + PX_CHECK_MSG(!cache || (cache && cache->shape && cache->actor), "Raycast cache specified but shape or actor pointer is NULL!"); + PrunerCompoundId cachedCompoundId = INVALID_COMPOUND_ID; + // PT: this is similar to the code in the SqRefFinder so we could share that code maybe. But here we later retrieve the payload from the PrunerData, + // i.e. we basically go back to the same pointers we started from. I suppose it's to make sure they get properly invalidated when an object is deleted etc, + // but we could still probably find a more efficient way to do that here. Isn't it exactly why we had the Signature class initially? + // + // how can this work anyway? if the actor has been deleted the lookup won't work either => doc says it's up to users to manage that.... + const ExtQueryAdapter& adapter = static_cast(mSQManager.getAdapter()); + PxU32 prunerIndex = 0xffffffff; + const PrunerHandle cacheData = cache ? adapter.findPrunerHandle(*cache, cachedCompoundId, prunerIndex) : INVALID_PRUNERHANDLE; + + // this function is logically const for the SDK user, as flushUpdates() will not have an API-visible effect on this object + // internally however, flushUpdates() changes the states of the Pruners in mSQManager + // because here is the only place we need this, const_cast instead of making SQM mutable + const_cast(this)->mSQManager.flushUpdates(); + +#if PX_SUPPORT_PVD + ExtCapturePvdOnReturn pvdCapture(this, input, filterData, hits); +#endif + + ExtIssueCallbacksOnReturn cbr(hits); // destructor will execute callbacks on return from this function + hits.hasBlock = false; + hits.nbTouches = 0; + + PxReal shrunkDistance = HitTypeSupport::IsOverlap ? PX_MAX_REAL : input.maxDistance; // can be progressively shrunk as we go over the list of shapes + if(HitTypeSupport::IsSweep) + shrunkDistance = PxMin(shrunkDistance, PX_MAX_SWEEP_DISTANCE); + + ExtMultiQueryCallback pcb(*this, input, anyHit, hits, hitFlags, filterData, filterCall, shrunkDistance); + + if(cacheData!=INVALID_PRUNERHANDLE && hits.maxNbTouches == 0) // don't use cache for queries that can return touch hits + { + if(!doQueryVsCached(cacheData, prunerIndex, cachedCompoundId, mSQManager, pcb, input)) + return hits.hasAnyHits(); + } + + const PxU32 nbPruners = mSQManager.getNbPruners(); + const CompoundPruner* compoundPruner = mSQManager.getCompoundPruner(); + + const PxCompoundPrunerQueryFlags compoundPrunerQueryFlags = convertFlags(filterData.flags); + + const BVH* treeOfPruners = mSQManager.getTreeOfPruners(); + + if(HitTypeSupport::IsRaycast) + { + // #MODIFIED + bool again = true; + if(treeOfPruners) + { + LocalRaycastCallback prunerRaycastCB(input, pcb, mSQManager, adapter, hits, filterData, filterCall); + again = treeOfPruners->raycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, prunerRaycastCB, PxGeometryQueryFlag::Enum(0)); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + else + { + for(PxU32 i=0;iraycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, pcb); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + } + } + //~#MODIFIED + + if(again && compoundPruner) + again = compoundPruner->raycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + else if(HitTypeSupport::IsOverlap) + { + PX_ASSERT(input.geometry); + + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mShapeData = &sd; + + // #MODIFIED + bool again = true; + if(treeOfPruners) + { + LocalOverlapCallback prunerOverlapCB(sd, pcb, mSQManager, adapter, hits, filterData, filterCall); + again = treeOfPruners->overlap(*input.geometry, *input.pose, prunerOverlapCB, PxGeometryQueryFlag::Enum(0)); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + else + { + for(PxU32 i=0;ioverlap(sd, pcb); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + } + } + //~#MODIFIED + + if(again && compoundPruner) + again = compoundPruner->overlap(sd, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + else + { + PX_ASSERT(HitTypeSupport::IsSweep); + PX_ASSERT(input.geometry); + + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mQueryShapeBounds = &sd.getPrunerInflatedWorldAABB(); + pcb.mShapeData = &sd; + + // #MODIFIED + bool again = true; + if(treeOfPruners) + { + LocalSweepCallback prunerSweepCB(sd, input.getDir(), pcb, mSQManager, adapter, hits, filterData, filterCall); + again = treeOfPruners->sweep(*input.geometry, *input.pose, input.getDir(), pcb.mShrunkDistance, prunerSweepCB, PxGeometryQueryFlag::Enum(0)); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + else + { + for(PxU32 i=0;isweep(sd, input.getDir(), pcb.mShrunkDistance, pcb); + if(!again) + { + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + } + } + } + //~#MODIFIED + + if(again && compoundPruner) + again = compoundPruner->sweep(sd, input.getDir(), pcb.mShrunkDistance, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } +} + +//explicit template instantiation +template bool ExtSceneQueries::multiQuery(const ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +template bool ExtSceneQueries::multiQuery(const ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +template bool ExtSceneQueries::multiQuery(const ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + +/////////////////////////////////////////////////////////////////////////////// + +bool ExtSceneQueries::_raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.raycast", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + ExtMultiQueryInput input(origin, unitDir, distance); + return multiQuery(input, hits, hitFlags, cache, filterData, filterCall); +} + +////////////////////////////////////////////////////////////////////////// + +bool ExtSceneQueries::_overlap( + const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hits, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.overlap", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + ExtMultiQueryInput input(&geometry, &pose); + return multiQuery(input, hits, PxHitFlags(), cache, filterData, filterCall); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool ExtSceneQueries::_sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.sweep", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + +#if PX_CHECKED + if(!PxGeometryQuery::isValid(geometry)) + return outputError(__LINE__, "Provided geometry is not valid"); +#endif + + if((hitFlags & PxHitFlag::ePRECISE_SWEEP) && (hitFlags & PxHitFlag::eMTD)) + { + outputError(__LINE__, " Precise sweep doesn't support MTD. Perform MTD with default sweep"); + hitFlags &= ~PxHitFlag::ePRECISE_SWEEP; + } + + if((hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP) && (hitFlags & PxHitFlag::eMTD)) + { + outputError(__LINE__, " eMTD cannot be used in conjunction with eASSUME_NO_INITIAL_OVERLAP. eASSUME_NO_INITIAL_OVERLAP will be ignored"); + hitFlags &= ~PxHitFlag::eASSUME_NO_INITIAL_OVERLAP; + } + + PxReal realInflation = inflation; + if((hitFlags & PxHitFlag::ePRECISE_SWEEP)&& inflation > 0.f) + { + realInflation = 0.f; + outputError(__LINE__, " Precise sweep doesn't support inflation, inflation will be overwritten to be zero"); + } + ExtMultiQueryInput input(&geometry, &pose, unitDir, distance, realInflation); + return multiQuery(input, hits, hitFlags, cache, filterData, filterCall); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static bool doQueryVsCached(const PrunerHandle handle, PxU32 prunerIndex, const PrunerCompoundId cachedCompoundId, const ExtPrunerManager& manager, ExtMultiQueryCallback& pcb, const ExtMultiQueryInput& input) +{ + // this block is only executed for single shape cache + const PrunerPayload* payloads; + const PxTransform* compoundPosePtr; + + PxTransform* transform; + PxTransform compoundPose; + if(cachedCompoundId == INVALID_COMPOUND_ID) + { + const Pruner* pruner = manager.getPruner(PruningIndex::Enum(prunerIndex)); + PX_ASSERT(pruner); + + PrunerPayloadData ppd; + const PrunerPayload& cachedPayload = pruner->getPayloadData(handle, &ppd); + + payloads = &cachedPayload; + compoundPosePtr = NULL; + transform = ppd.mTransform; + } + else + { + const CompoundPruner* pruner = manager.getCompoundPruner(); + PX_ASSERT(pruner); + + PrunerPayloadData ppd; + const PrunerPayload& cachedPayload = pruner->getPayloadData(handle, cachedCompoundId, &ppd); + + compoundPose = pruner->getTransform(cachedCompoundId); + + payloads = &cachedPayload; + compoundPosePtr = &compoundPose; + transform = ppd.mTransform; + } + PxReal dummyDist; + + bool againAfterCache; + if(HitTypeSupport::IsSweep) + { + // AP: for sweeps we cache the bounds because we need to know them for the test to clip the sweep to bounds + // otherwise GJK becomes unstable. The bounds can be used multiple times so this is an optimization. + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mQueryShapeBounds = &sd.getPrunerInflatedWorldAABB(); + pcb.mShapeData = &sd; +// againAfterCache = pcb.invoke(dummyDist, 0); + againAfterCache = pcb.template _invoke(dummyDist, 0, payloads, transform, compoundPosePtr); + pcb.mShapeData = NULL; + } else +// againAfterCache = pcb.invoke(dummyDist, 0); + againAfterCache = pcb.template _invoke(dummyDist, 0, payloads, transform, compoundPosePtr); + + return againAfterCache; +} + +/////////////////////////////////////////////////////////////////////////////// + +ExtSceneQueries::ExtSceneQueries(ExtPVDCapture* pvd, PxU64 contextID, float inflation, const ExtQueryAdapter& adapter, bool usesTreeOfPruners) : + mSQManager (contextID, inflation, adapter, usesTreeOfPruners), + mPVD (pvd) +{ +} + +ExtSceneQueries::~ExtSceneQueries() +{ +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.h new file mode 100644 index 0000000..1272a5d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtSqQuery.h @@ -0,0 +1,142 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_SQ_QUERY_H +#define EXT_SQ_QUERY_H + +#include "foundation/PxSimpleTypes.h" +#include "geometry/PxGeometryQueryFlags.h" + +#include "ExtSqManager.h" +#include "PxQueryReport.h" +#include "GuCachedFuncs.h" + +namespace physx +{ +class PxGeometry; +struct PxQueryFilterData; +struct PxFilterData; +class PxQueryFilterCallback; + +namespace Sq +{ + struct ExtMultiQueryInput; + + class ExtPVDCapture + { + public: + ExtPVDCapture() {} + virtual ~ExtPVDCapture() {} + + virtual bool transmitSceneQueries() = 0; + + virtual void raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) = 0; + virtual void sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) = 0; + virtual void overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData) = 0; + }; + + // SceneQueries-level adapter. Augments the PrunerManager-level adapter with functions needed to perform queries. + class ExtQueryAdapter : public Adapter + { + public: + ExtQueryAdapter() {} + virtual ~ExtQueryAdapter() {} + + // PT: TODO: decouple from PxQueryCache? + virtual Gu::PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const = 0; + + // PT: TODO: return reference? but this version is at least consistent with getActorShape + virtual void getFilterData(const Gu::PrunerPayload& payload, PxFilterData& filterData) const = 0; + virtual void getActorShape(const Gu::PrunerPayload& payload, PxActorShape& actorShape) const = 0; + + // PT: new for this customized version: a function to perform per-pruner filtering + virtual bool processPruner(PxU32 prunerIndex, const PxQueryThreadContext* context, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const = 0; + }; +} + + // PT: this is a customized version of physx::Sq::SceneQueries that supports more than 2 hardcoded pruners. + // It might not be possible to support the whole PxSceneQuerySystem API with an arbitrary number of pruners. + class ExtSceneQueries + { + PX_NOCOPY(ExtSceneQueries) + public: + ExtSceneQueries(Sq::ExtPVDCapture* pvd, PxU64 contextID, + float inflation, const Sq::ExtQueryAdapter& adapter, bool usesTreeOfPruners); + ~ExtSceneQueries(); + + PX_FORCE_INLINE Sq::ExtPrunerManager& getPrunerManagerFast() { return mSQManager; } + PX_FORCE_INLINE const Sq::ExtPrunerManager& getPrunerManagerFast() const { return mSQManager; } + + template + bool multiQuery( + const Sq::ExtMultiQueryInput& in, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryCache*, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const; + + bool _raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, // Ray data + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + + bool _sweep( + const PxGeometry& geometry, const PxTransform& pose, // GeomObject data + const PxVec3& unitDir, const PxReal distance, // Ray data + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const; + + bool _overlap( + const PxGeometry& geometry, const PxTransform& transform, // GeomObject data + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + + PX_FORCE_INLINE PxU64 getContextId() const { return mSQManager.getContextId(); } + Sq::ExtPrunerManager mSQManager; + public: + Gu::CachedFuncs mCachedFuncs; + + Sq::ExtPVDCapture* mPVD; + }; + +#if PX_SUPPORT_EXTERN_TEMPLATE + //explicit template instantiation declaration + extern template + bool ExtSceneQueries::multiQuery(const Sq::ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + + extern template + bool ExtSceneQueries::multiQuery(const Sq::ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + + extern template + bool ExtSceneQueries::multiQuery(const Sq::ExtMultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTaskQueueHelper.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTaskQueueHelper.h new file mode 100644 index 0000000..1596854 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTaskQueueHelper.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_TASK_QUEUE_HELPER_H +#define EXT_TASK_QUEUE_HELPER_H + +#include "task/PxTask.h" +#include "ExtSharedQueueEntryPool.h" + +namespace physx +{ + +#define EXT_TASK_QUEUE_ENTRY_POOL_SIZE 128 + +namespace Ext +{ + class TaskQueueHelper + { + public: + static PxBaseTask* fetchTask(PxSList& taskQueue, Ext::SharedQueueEntryPool<>& entryPool) + { + SharedQueueEntry* entry = static_cast(taskQueue.pop()); + if (entry) + { + PxBaseTask* task = reinterpret_cast(entry->mObjectRef); + entryPool.putEntry(*entry); + return task; + } + else + return NULL; + } + }; + +} // namespace Ext + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp new file mode 100644 index 0000000..a2ca894 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetMakerExt.cpp @@ -0,0 +1,224 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "tet/ExtDelaunayBoundaryInserter.h" +#include "extensions/PxTetMakerExt.h" +#include "cooking/PxTetrahedronMeshDesc.h" +#include "geometry/PxTriangleMesh.h" +#include "tet/ExtMeshSimplificator.h" +#include "tet/ExtRemesher.h" +#include "tet/ExtOctreeTetrahedralizer.h" +#include "tet/ExtVoxelTetrahedralizer.h" +#include "foundation/PxMat33.h" +#include + +using namespace physx; + +PX_FORCE_INLINE PxReal computeTetrahedronVolume(const PxVec3& x0, const PxVec3& x1, const PxVec3& x2, const PxVec3& x3) +{ + const PxVec3 u1 = x1 - x0; + const PxVec3 u2 = x2 - x0; + const PxVec3 u3 = x3 - x0; + + PxMat33 edgeMatrix = PxMat33(u1, u2, u3); + + const PxReal det = edgeMatrix.getDeterminant(); + + const PxReal volume = det / 6.0f; + return volume; +} + +//Remove tets with small volume +void removeSmallVolumeTetrahedra(PxArray<::physx::PxVec3>& vertices, PxArray& indices, PxReal volumeThreshold = 1e-8f) +{ + uint32_t indexer = 0; + + for (uint32_t i = 0; i < indices.size(); i += 4) + { + for (uint32_t j = 0; j < 4; ++j) + { + indices[indexer + j] = indices[i + j]; + } + + if (computeTetrahedronVolume(vertices[indices[i]], vertices[indices[i + 1]], vertices[indices[i + 2]], vertices[indices[i + 3]]) >= volumeThreshold) + { + indexer += 4; + } + } + + if (indexer < indices.size()) + { + indices.removeRange(indexer, indices.size() - indexer); + } +} + +//Removes vertices not referenced by any tetrahedron and maps the tet's indices to match the compacted vertex list +void removeUnusedVertices(PxArray<::physx::PxVec3>& vertices, PxArray& tets, PxU32 numPointsToKeepAtBeginning = 0) +{ + PxArray compressorMap; + compressorMap.resize(vertices.size()); + + for (PxU32 i = 0; i < numPointsToKeepAtBeginning; ++i) + compressorMap[i] = 0; + for (PxU32 i = numPointsToKeepAtBeginning; i < compressorMap.size(); ++i) + compressorMap[i] = -1; + + for (PxU32 i = 0; i < tets.size(); i += 4) + { + const PxU32* tet = &tets[i]; + if (tet[0] == 0xFFFFFFFFu) + continue; + compressorMap[tet[0]] = 0; + compressorMap[tet[1]] = 0; + compressorMap[tet[2]] = 0; + compressorMap[tet[3]] = 0; + } + + PxU32 indexer = 0; + for (PxU32 i = 0; i < compressorMap.size(); ++i) + { + if (compressorMap[i] >= 0) + { + compressorMap[i] = indexer; + vertices[indexer] = vertices[i]; + indexer++; + } + } + + for (PxU32 i = 0; i < tets.size(); i += 4) + { + PxU32* tet = &tets[i]; + if (tet[0] == 0xFFFFFFFFu) + continue; + tet[0] = compressorMap[tet[0]]; + tet[1] = compressorMap[tet[1]]; + tet[2] = compressorMap[tet[2]]; + tet[3] = compressorMap[tet[3]]; + } + + if (indexer < vertices.size()) + vertices.removeRange(indexer, vertices.size() - indexer); +} + +bool PxTetMaker::createConformingTetrahedronMesh(const PxSimpleTriangleMesh& triangleMesh, + physx::PxArray& outVertices, physx::PxArray& outTetIndices, const bool validate, PxReal volumeThreshold) +{ + if (validate) + { + PxTriangleMeshAnalysisResults result = PxTetMaker::validateTriangleMesh(triangleMesh); + if (result & PxTriangleMeshAnalysisResult::eMESH_IS_INVALID) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_INFO, __FILE__, __LINE__, "createConformingTetrahedronMesh(): Input triangle mesh is not suited to create a tetmesh due to deficiencies. Please call PxTetMaker::validateTriangleMesh(triangleMesh) for more details."); + return false; + } + } + + Ext::generateTetmesh(triangleMesh.points, triangleMesh.triangles, triangleMesh.flags & PxMeshFlag::e16_BIT_INDICES, outVertices, outTetIndices); + + if (volumeThreshold > 0.0f) + removeSmallVolumeTetrahedra(outVertices, outTetIndices, volumeThreshold); + + PxU32 numRemoveAtEnd = Ext::removeDisconnectedIslands(reinterpret_cast(outTetIndices.begin()), outTetIndices.size() / 4); + if (numRemoveAtEnd > 0) + outTetIndices.removeRange(outTetIndices.size() - 4 * numRemoveAtEnd, 4 * numRemoveAtEnd); + + removeUnusedVertices(outVertices, outTetIndices, triangleMesh.points.count); + + return true; +} + +bool PxTetMaker::createVoxelTetrahedronMesh(const PxTetrahedronMeshDesc& tetMesh, + const PxU32 numVoxelsAlongLongestBoundingBoxAxis, physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices) +{ + Ext::generateVoxelTetmesh(tetMesh.points, tetMesh.tetrahedrons, numVoxelsAlongLongestBoundingBoxAxis, outVertices, outTetIndices, intputPointToOutputTetIndex, anchorNodeIndices); + return true; +} + +bool PxTetMaker::createVoxelTetrahedronMeshFromEdgeLength(const PxTetrahedronMeshDesc& tetMesh, + const PxReal voxelEdgeLength, physx::PxArray& outVertices, physx::PxArray& outTetIndices, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices) +{ + Ext::generateVoxelTetmesh(tetMesh.points, tetMesh.tetrahedrons, voxelEdgeLength, outVertices, outTetIndices, intputPointToOutputTetIndex, anchorNodeIndices); + return true; +} + +PxTriangleMeshAnalysisResults PxTetMaker::validateTriangleMesh(const PxSimpleTriangleMesh& triangleMesh, const PxReal minVolumeThreshold, const PxReal minTriangleAngleRadians) +{ + return Ext::validateTriangleMesh(triangleMesh.points, triangleMesh.triangles, triangleMesh.flags & PxMeshFlag::e16_BIT_INDICES, minVolumeThreshold, minTriangleAngleRadians); +} + +PxTetrahedronMeshAnalysisResults PxTetMaker::validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const PxReal minTetVolumeThreshold) +{ + return Ext::validateTetrahedronMesh(points, tetrahedra, false, minTetVolumeThreshold); +} + +void PxTetMaker::simplifyTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, int targetTriangleCount, PxF32 maximalEdgeLength, + PxArray& outputVertices, PxArray& outputIndices, + PxArray *vertexMap, PxReal edgeLengthCostWeight, PxReal flatnessDetectionThreshold) +{ + Ext::MeshSimplificator ms; + ms.init(inputVertices, inputIndices, edgeLengthCostWeight, flatnessDetectionThreshold); + ms.decimateBySize(targetTriangleCount, maximalEdgeLength); + ms.readBack(outputVertices, outputIndices, vertexMap); +} + +void PxTetMaker::remeshTriangleMesh(const PxArray& inputVertices, const PxArray&inputIndices, int gridResolution, + PxArray& outputVertices, PxArray& outputIndices, PxArray *vertexMap) +{ + Ext::Remesher rm; + rm.remesh(inputVertices, inputIndices, gridResolution, vertexMap); + rm.readBack(outputVertices, outputIndices); +} + + +void PxTetMaker::createTreeBasedTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + bool useTreeNodes, PxArray& outputVertices, PxArray& outputIndices, PxReal volumeThreshold) +{ + Ext::OctreeTetrahedralizer ot; + ot.createTetMesh(inputVertices, inputIndices, useTreeNodes); + ot.readBack(outputVertices, outputIndices); + + if (volumeThreshold > 0.0f) + removeSmallVolumeTetrahedra(outputVertices, outputIndices, volumeThreshold); + + PxU32 numRemoveAtEnd = Ext::removeDisconnectedIslands(reinterpret_cast(outputIndices.begin()), outputIndices.size() / 4); + if (numRemoveAtEnd > 0) + outputIndices.removeRange(outputIndices.size() - 4 * numRemoveAtEnd, 4 * numRemoveAtEnd); + + removeUnusedVertices(outputVertices, outputIndices, inputVertices.size()); +} + +void PxTetMaker::createRelaxedVoxelTetrahedralMesh(const PxArray& inputVertices, const PxArray&inputIndices, + PxArray& outputVertices, PxArray& outputIndices, + PxI32 resolution, PxI32 numRelaxationIters, PxF32 relMinTetVolume) +{ + Ext::VoxelTetrahedralizer vt; + vt.createTetMesh(inputVertices, inputIndices, resolution, numRelaxationIters, relMinTetVolume); + vt.readBack(outputVertices, outputIndices); +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp new file mode 100644 index 0000000..70ae145 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTetrahedronMeshExt.cpp @@ -0,0 +1,281 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxTetrahedronMeshExt.h" +#include "foundation/PxMathUtils.h" +#include "foundation/PxHashMap.h" +#include "GuTetrahedronMesh.h" +#include "GuBox.h" +#include "GuBV4.h" +#include "GuBV4_Common.h" +#include "GuDistancePointTetrahedron.h" + +namespace physx +{ + struct TetrahedronFinderCallback + { + PxVec3 mQueryPoint; + PxI32 mTetId; + PxVec4 mBary; + + const PxVec3* mVertices; + const PxU32* mTets; + + PxReal mTolerance = 1e-6f; + + TetrahedronFinderCallback(const PxVec3& queryPoint, const PxVec3* vertices, const PxU32* tets, const PxReal tolerance = 1e-6f) : + mQueryPoint(queryPoint), mTetId(-1), mVertices(vertices), mTets(tets), mTolerance(tolerance) {} + + + PX_FORCE_INLINE bool testPrimitive(const PxU32 primitiveStartId, const PxU32 numPrimitives) + { + for (PxU32 i = 0; i < numPrimitives; ++i) + { + const PxU32* tet = &mTets[4 * (primitiveStartId + i)]; + computeBarycentric(mVertices[tet[0]], mVertices[tet[1]], mVertices[tet[2]], mVertices[tet[3]], mQueryPoint, mBary); + + if (mBary.x >= -mTolerance && mBary.x <= 1 + mTolerance && mBary.y >= -mTolerance && mBary.y <= 1 + mTolerance && + mBary.z >= -mTolerance && mBary.z <= 1 + mTolerance && mBary.w >= -mTolerance && mBary.w <= 1 + mTolerance) + { + mTetId = PxI32(primitiveStartId + i); + return true; + } + } + return false; + } + + PX_FORCE_INLINE bool testBox(const float boxMinX, const float boxMinY, const float boxMinZ, const float boxMaxX, const float boxMaxY, const float boxMaxZ) + { + return mQueryPoint.x >= boxMinX && mQueryPoint.y >= boxMinY && mQueryPoint.z >= boxMinZ && + mQueryPoint.x <= boxMaxX && mQueryPoint.y <= boxMaxY && mQueryPoint.z <= boxMaxZ; + } + }; + + struct ClosestTetrahedronFinderCallback + { + PxVec3 mQueryPoint; + PxI32 mTetId; + PxVec4 mBary; + PxReal mDist = 1.84467e+19f; // sqrtf(FLT_MAX) + + const PxVec3* mVertices; + const PxU32* mTets; + PxReal mTolerance = 1e-6f; + + ClosestTetrahedronFinderCallback(const PxVec3& queryPoint, const PxVec3* vertices, const PxU32* tets) : + mQueryPoint(queryPoint), mTetId(-1), mVertices(vertices), mTets(tets) {} + + PX_FORCE_INLINE bool testPrimitive(const PxU32 primitiveStartId, const PxU32 numPrimitives) + { + for (PxU32 i = 0; i < numPrimitives; ++i) + { + PxVec4 bary; + const PxU32* tet = &mTets[4 * (primitiveStartId + i)]; + computeBarycentric(mVertices[tet[0]], mVertices[tet[1]], mVertices[tet[2]], mVertices[tet[3]], mQueryPoint, bary); + + if (bary.x >= -mTolerance && bary.x <= 1 + mTolerance && bary.y >= -mTolerance && bary.y <= 1 + mTolerance && + bary.z >= -mTolerance && bary.z <= 1 + mTolerance && bary.w >= -mTolerance && bary.w <= 1 + mTolerance) + { + mTetId = PxI32(primitiveStartId + i); + mBary = bary; + mDist = 0; + return true; + } + + PxVec3 closest = Gu::closestPtPointTetrahedron(mQueryPoint, mVertices[tet[0]], mVertices[tet[1]], mVertices[tet[2]], mVertices[tet[3]]); + PxReal distSq = (closest - mQueryPoint).magnitudeSquared(); + if (distSq < mDist * mDist) + { + mTetId = PxI32(primitiveStartId + i); + mBary = bary; + mDist = PxSqrt(distSq); + } + } + return false; + } + + PX_FORCE_INLINE bool testBox(const float boxMinX, const float boxMinY, const float boxMinZ, const float boxMaxX, const float boxMaxY, const float boxMaxZ) + { + if (mQueryPoint.x >= boxMinX && mQueryPoint.y >= boxMinY && mQueryPoint.z >= boxMinZ && + mQueryPoint.x <= boxMaxX && mQueryPoint.y <= boxMaxY && mQueryPoint.z <= boxMaxZ) + return true; + PxVec3 closest = mQueryPoint; + closest.x = PxClamp(closest.x, boxMinX, boxMaxX); + closest.y = PxClamp(closest.y, boxMinY, boxMaxY); + closest.z = PxClamp(closest.z, boxMinZ, boxMaxZ); + PxReal distSq = (closest - mQueryPoint).magnitudeSquared(); + return distSq < mDist * mDist; + } + }; + + + template + int process(PxU32* stack, PxU32& stackSize, const Gu::BVDataSwizzledNQ* node, T& callback) + { + if (callback.testBox(node->mMinX[i], node->mMinY[i], node->mMinZ[i], node->mMaxX[i], node->mMaxY[i], node->mMaxZ[i])) + { + if (node->isLeaf(i)) + { + PxU32 primitiveIndex = node->getPrimitive(i); + const PxU32 numPrimitives = Gu::getNbPrimitives(primitiveIndex); + if(callback.testPrimitive(primitiveIndex, numPrimitives)) //Returns true if the query should be terminated immediately + return 1; + } + else + stack[stackSize++] = node->getChildData(i); + } + return 0; + } + + template + void traverseBVH(const Gu::BV4Tree& tree, T& callback) + { + const Gu::BVDataPackedNQ* root = static_cast(tree.mNodes); + + PxU32 stack[GU_BV4_STACK_SIZE]; + PxU32 stackSize = 0; + stack[stackSize++] = tree.mInitData; + + while (stackSize > 0) + { + const PxU32 childData = stack[--stackSize]; + const Gu::BVDataSwizzledNQ* node = reinterpret_cast(root + Gu::getChildOffset(childData)); + + const PxU32 nodeType = Gu::getChildType(childData); + + if (nodeType > 1) + if (process(stack, stackSize, node, callback)) return; + if (nodeType > 0) + if (process(stack, stackSize, node, callback)) return; + if (process(stack, stackSize, node, callback)) return; + if (process(stack, stackSize, node, callback)) return; + } + } + + PxI32 PxTetrahedronMeshExt::findTetrahedronContainingPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary, PxReal tolerance) + { + TetrahedronFinderCallback callback(point, mesh->getVertices(), static_cast(mesh->getTetrahedrons()), tolerance); + traverseBVH(static_cast(mesh)->getBV4Tree(), callback); + bary = callback.mBary; + return callback.mTetId; + } + + PxI32 PxTetrahedronMeshExt::findTetrahedronClosestToPoint(const PxTetrahedronMesh* mesh, const PxVec3& point, PxVec4& bary) + { + ClosestTetrahedronFinderCallback callback(point, mesh->getVertices(), static_cast(mesh->getTetrahedrons())); + const Gu::BV4Tree& tree = static_cast(mesh)->getBV4Tree(); + if (tree.mNbNodes) traverseBVH(tree, callback); + else callback.testPrimitive(0, mesh->getNbTetrahedrons()); + bary = callback.mBary; + return callback.mTetId; + } + + struct SortedTriangle + { + public: + PxU32 A; + PxU32 B; + PxU32 C; + PxI32 TetIndex; + bool Flipped; + + PX_FORCE_INLINE SortedTriangle(PxU32 a, PxU32 b, PxU32 c, PxI32 tetIndex = -1) + { + A = a; B = b; C = c; Flipped = false; TetIndex = tetIndex; + if (A > B) { PxSwap(A, B); Flipped = !Flipped; } + if (B > C) { PxSwap(B, C); Flipped = !Flipped; } + if (A > B) { PxSwap(A, B); Flipped = !Flipped; } + } + }; + + struct TriangleHash + { + PX_FORCE_INLINE std::size_t operator()(const SortedTriangle& k) const + { + return k.A ^ k.B ^ k.C; + } + + PX_FORCE_INLINE bool equal(const SortedTriangle& first, const SortedTriangle& second) const + { + return first.A == second.A && first.B == second.B && first.C == second.C; + } + }; + + static const PxU32 tetFaces[4][3] = { {0, 2, 1}, {0, 1, 3}, {0, 3, 2}, {1, 2, 3} }; + + + void PxTetrahedronMeshExt::extractTetMeshSurface(const void* tetrahedra, PxU32 numTetrahedra, bool sixteenBitIndices, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet, bool flipTriangleOrientation) + { + PxHashMap tris; + + const PxU32* tets32 = reinterpret_cast(tetrahedra); + const PxU16* tets16 = reinterpret_cast(tetrahedra); + + PxU32 l = 4 * numTetrahedra; + for (PxU32 i = 0; i < l; i += 4) + { + for (PxU32 j = 0; j < 4; ++j) + { + SortedTriangle tri(sixteenBitIndices ? tets16[i + tetFaces[j][0]] : tets32[i + tetFaces[j][0]], + sixteenBitIndices ? tets16[i + tetFaces[j][1]] : tets32[i + tetFaces[j][1]], + sixteenBitIndices ? tets16[i + tetFaces[j][2]] : tets32[i + tetFaces[j][2]], i); + if (const PxPair* ptr = tris.find(tri)) + tris[tri] = ptr->second + 1; + else + tris.insert(tri, 1); + } + } + + surfaceTriangles.clear(); + if (surfaceTriangleToTet) + surfaceTriangleToTet->clear(); + for (PxHashMap::Iterator iter = tris.getIterator(); !iter.done(); ++iter) + { + if (iter->second == 1) { + surfaceTriangles.pushBack(iter->first.A); + if (iter->first.Flipped != flipTriangleOrientation) + { + surfaceTriangles.pushBack(iter->first.C); + surfaceTriangles.pushBack(iter->first.B); + } + else + { + surfaceTriangles.pushBack(iter->first.B); + surfaceTriangles.pushBack(iter->first.C); + } + if (surfaceTriangleToTet) + surfaceTriangleToTet->pushBack(iter->first.TetIndex); + } + } + } + + void PxTetrahedronMeshExt::extractTetMeshSurface(const PxTetrahedronMesh* mesh, PxArray& surfaceTriangles, PxArray* surfaceTriangleToTet, bool flipTriangleOrientation) + { + extractTetMeshSurface(mesh->getTetrahedrons(), mesh->getNbTetrahedrons(), mesh->getTetrahedronMeshFlags() & PxTetrahedronMeshFlag::e16_BIT_INDICES, surfaceTriangles, surfaceTriangleToTet, flipTriangleOrientation); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp new file mode 100644 index 0000000..02e7871 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/ExtTriangleMeshExt.cpp @@ -0,0 +1,189 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "geometry/PxMeshQuery.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxTriangleMesh.h" +#include "extensions/PxTriangleMeshExt.h" +#include "GuSDF.h" +#include "GuTriangleMesh.h" + +#include "foundation/PxAllocator.h" + +using namespace physx; + +PxMeshOverlapUtil::PxMeshOverlapUtil() : mResultsMemory(mResults), mNbResults(0), mMaxNbResults(256) +{ +} + +PxMeshOverlapUtil::~PxMeshOverlapUtil() +{ + if(mResultsMemory != mResults) + PX_FREE(mResultsMemory); +} + +PxU32 PxMeshOverlapUtil::findOverlap(const PxGeometry& geom, const PxTransform& geomPose, const PxTriangleMeshGeometry& meshGeom, const PxTransform& meshPose) +{ + bool overflow; + PxU32 nbTouchedTris = PxMeshQuery::findOverlapTriangleMesh(geom, geomPose, meshGeom, meshPose, mResultsMemory, mMaxNbResults, 0, overflow); + + if(overflow) + { + const PxU32 maxNbTris = meshGeom.triangleMesh->getNbTriangles(); + if(!maxNbTris) + { + mNbResults = 0; + return 0; + } + + if(mMaxNbResultsgetNbRows()*hfGeom.heightField->getNbColumns()*2; + if(!maxNbTris) + { + mNbResults = 0; + return 0; + } + + if(mMaxNbResults +bool computeMeshPenetrationT(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const MeshGeometry& meshGeom, + const PxTransform& meshPose, + PxU32 maxIter, + PxU32* nbIterOut) +{ + PxU32 nbIter = 0; + PxTransform pose = geomPose; + for (; nbIter < maxIter; nbIter++) + { + PxVec3 currentDir; + PxF32 currentDepth; + + if (!PxGeometryQuery::computePenetration(currentDir, currentDepth, geom, pose, meshGeom, meshPose)) + break; + + pose.p += currentDir * currentDepth; + } + + if(nbIterOut) + *nbIterOut = nbIter; + + PxVec3 diff = pose.p - geomPose.p; + depth = diff.magnitude(); + + if (depth>0) + direction = diff / depth; + + return nbIter!=0; +} +} + +bool physx::PxComputeTriangleMeshPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxTriangleMeshGeometry& meshGeom, + const PxTransform& meshPose, + PxU32 maxIter, + PxU32* nbIter) +{ + return computeMeshPenetrationT(direction, depth, geom, geomPose, meshGeom, meshPose, maxIter, nbIter); +} + +bool physx::PxComputeHeightFieldPenetration(PxVec3& direction, + PxReal& depth, + const PxGeometry& geom, + const PxTransform& geomPose, + const PxHeightFieldGeometry& hfGeom, + const PxTransform& meshPose, + PxU32 maxIter, + PxU32* nbIter) +{ + return computeMeshPenetrationT(direction, depth, geom, geomPose, hfGeom, meshPose, maxIter, nbIter); +} + +bool physx::PxExtractIsosurfaceFromSDF(const PxTriangleMesh& triangleMesh, PxArray& isosurfaceVertices, PxArray& isosurfaceTriangleIndices) +{ + PxU32 dimX, dimY, dimZ; + triangleMesh.getSDFDimensions(dimX, dimY, dimZ); + if (dimX == 0 || dimY == 0 || dimZ == 0) + return false; + + const Gu::TriangleMesh* guTriangleMesh = static_cast(&triangleMesh); + const Gu::SDF& sdf = guTriangleMesh->getSdfDataFast(); + + extractIsosurfaceFromSDF(sdf, isosurfaceVertices, isosurfaceTriangleIndices); + + return true; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.cpp new file mode 100644 index 0000000..16593f6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.cpp @@ -0,0 +1,217 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#if PX_SUPPORT_OMNI_PVD + +#include "OmniPvdPxExtensionsSampler.h" +#include "../pvdruntime/include/OmniPvdWriter.h" +#include "extensions/PxExtensionsAPI.h" +#include + +using namespace physx; + +#define UNNECESSARY_SCENE_HANDLE 1 + +//array to hold PVD type to size conversion table. Should be large enough for all basic PVD types. +static uint32_t sizeOfOmniPvdTypes[32]; + +//create a class for each SDK type and attribute -- the primary thing is to allocate handle storage, the rest is just fluff. +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) OmniPvdClassHandle OmniPvdPxExtensionsSampler::classHandle_##c; +#define OMNI_PVD_CLASS(c, classT) OmniPvdClassHandle OmniPvdPxExtensionsSampler::classHandle_##c; +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) OmniPvdAttributeHandle OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a; +//enum values don't need to save their handle, since they are const/immutable: +#define OMNI_PVD_ENUM_VALUE(c, a, v) +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) OmniPvdAttributeHandle OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) OmniPvdAttributeHandle OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a; + +#include "OmniPvdPxExtensionsTypes.h" + +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + +void OmniPvdPxExtensionsSampler::registerClasses() +{ + if (mWriter) + { +//register all SDK classes and attributes: +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) OmniPvdPxExtensionsSampler::classHandle_##c = mWriter->registerClass(#classStr); +#define OMNI_PVD_CLASS(c, classT) OmniPvdPxExtensionsSampler::classHandle_##c = mWriter->registerClass(#classT); +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OmniPvdPxExtensionsSampler::classHandle_##c = mWriter->registerClass(#classT, OmniPvdPxExtensionsSampler::classHandle_##baseClass); +#define OMNI_PVD_ENUM_VALUE(c, a, v) mWriter->registerEnumValue(OmniPvdPxExtensionsSampler::classHandle_##c, #a, v); +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a = mWriter->registerSetAttribute(OmniPvdPxExtensionsSampler::classHandle_##c, #a, OmniPvdDataTypeEnum::eOBJECT_HANDLE); +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) PX_ASSERT((n == 0) || (sizeof(attrT) == sizeOfOmniPvdTypes[t] * n)); OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a = mWriter->registerAttribute(OmniPvdPxExtensionsSampler::classHandle_##c, #a, t, n); +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a = mWriter->registerFlagsAttribute(OmniPvdPxExtensionsSampler::classHandle_##c, OmniPvdPxExtensionsSampler::classHandle_##enumClass, #a); + +#include "OmniPvdPxExtensionsTypes.h" + +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + } +} + +//instance any templates that are not used in this compilation unit so that code gets generated anyways + +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) \ +template void OmniPvdPxExtensionsSampler::createObject (OmniPvdClassHandle, classT const &);\ +template void OmniPvdPxExtensionsSampler::destroyObject(classT const &); + +#define OMNI_PVD_CLASS(c, classT) \ +template void OmniPvdPxExtensionsSampler::createObject (OmniPvdClassHandle, classT const &);\ +template void OmniPvdPxExtensionsSampler::destroyObject(classT const &); + +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) + +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) \ +template void OmniPvdPxExtensionsSampler::addToSet(OmniPvdAttributeHandle, classT const & , attrT const & );\ +template void OmniPvdPxExtensionsSampler::removeFromSet(OmniPvdAttributeHandle, classT const & , attrT const & ); + +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) \ +template void OmniPvdPxExtensionsSampler::setAttribute(OmniPvdAttributeHandle, const classT&, attrT const &); \ +template void OmniPvdPxExtensionsSampler::setAttributeBytes(OmniPvdAttributeHandle, const classT&, attrT const *, unsigned); + +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) \ +template void OmniPvdPxExtensionsSampler::setAttribute(OmniPvdAttributeHandle, classT const &, attrT const &); + +#define OMNI_PVD_ENUM(c, enumT) +#define OMNI_PVD_ENUM_VALUE(c, a, v) + +#include "OmniPvdPxExtensionsTypes.h" + +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +//end instance templates + +OmniPvdPxExtensionsSampler::OmniPvdPxExtensionsSampler() : mWriter(NULL) +{ + + //TODO: this could be done better + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT8] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT16] = 2; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eINT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT8] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT16] = 2; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eUINT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eFLOAT32] = 4; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eFLOAT64] = 8; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eSTRING] = 1; + sizeOfOmniPvdTypes[OmniPvdDataTypeEnum::eOBJECT_HANDLE] = sizeof(uint64_t); +} + +OmniPvdPxExtensionsSampler::~OmniPvdPxExtensionsSampler() +{ +} + +void OmniPvdPxExtensionsSampler::setOmniPvdWriter(OmniPvdWriter* omniPvdWriter) +{ + mWriter = omniPvdWriter; +} + +//generic PVD API: + +template void OmniPvdPxExtensionsSampler::createObject(OmniPvdClassHandle ch, ClassType const & objectId) +{ + PX_ASSERT(mWriter); + mWriter->createObject(UNNECESSARY_SCENE_HANDLE, ch, OmniPvdObjectHandle(&objectId), NULL); +} + +template void OmniPvdPxExtensionsSampler::destroyObject(ClassType const & objectId) +{ + PX_ASSERT(mWriter); + mWriter->destroyObject(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId)); +} + +template void OmniPvdPxExtensionsSampler::setAttribute(OmniPvdAttributeHandle ah, const ClassType & objectId, const AttributeType & value) +{ + PX_ASSERT(mWriter); + mWriter->setAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&value, sizeof(AttributeType)); +} + +template void OmniPvdPxExtensionsSampler::setAttributeBytes(OmniPvdAttributeHandle ah, ClassType const & objectId, const AttributeType * value, unsigned nBytes) +{ + PX_ASSERT(mWriter); + mWriter->setAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)value, nBytes); +} + +template void OmniPvdPxExtensionsSampler::addToSet(OmniPvdAttributeHandle ah, ClassType const & objectId, AttributeType const & value) +{ + PX_ASSERT(mWriter); + const AttributeType * atp = &value; + mWriter->addToSetAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&atp, sizeof(atp)); +} + +template void OmniPvdPxExtensionsSampler::removeFromSet(OmniPvdAttributeHandle ah, ClassType const & objectId, AttributeType const & value) +{ + PX_ASSERT(mWriter); + const AttributeType * atp = &value; + mWriter->removeFromSetAttributeShallow(UNNECESSARY_SCENE_HANDLE, OmniPvdObjectHandle(&objectId), ah, (const unsigned char*)&atp, sizeof(atp) ); +} + +/////////////////////////////////////////////////////////////////////////////// + +static OmniPvdPxExtensionsSampler* gOmniPvdPxExtensionsSampler = NULL; + +bool OmniPvdPxExtensionsSampler::createInstance() +{ + gOmniPvdPxExtensionsSampler = PX_NEW(OmniPvdPxExtensionsSampler)(); + return gOmniPvdPxExtensionsSampler != NULL; +} + +OmniPvdPxExtensionsSampler* OmniPvdPxExtensionsSampler::getInstance() +{ + return gOmniPvdPxExtensionsSampler; +} + +void OmniPvdPxExtensionsSampler::destroyInstance() +{ + PX_DELETE(gOmniPvdPxExtensionsSampler); +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.h new file mode 100644 index 0000000..d3ae58f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsSampler.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef OMNI_PVD_EXTENSION_SAMPLER_H +#define OMNI_PVD_EXTENSION_SAMPLER_H + +/* +The below helper macros are to be used in Extensions code to send information to PVD as unintrusively as possible. + +Principles: +* Data created or changed by the user should be sent as soon as it has been written to an Extensions class, ideally right at the end of the API create() or set() call. +* Objects should ideally be destroyed from their destructors (since release() calls might just decrement). +* Data written by the Extensions should be sent at the end of the simulate frame. +* Ideally use Px-pointers as object handles. Beware that multiple inheritance can result in different pointer values so its best to cast to the Px-type pointer / reference explicitly. + Even if the code works by passing in different equivalent pointer types, this will generate unnecessary duplicate template code. +*/ +#if PX_SUPPORT_OMNI_PVD + // You can use this in conditional statements to check for a connection + #define OMNI_PVD_ACTIVE (::OmniPvdPxExtensionsSampler::getInstance() != NULL) + // Create object reference o of PVD type c. Example: OMNI_PVD_CREATE(scene, static_cast(*npScene)); + #define OMNI_PVD_CREATE(c, o) if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->createObject(OmniPvdPxExtensionsSampler::classHandle_##c, o); } + // Destroy object reference o of PVD type c. Example: OMNI_PVD_DESTROY(scene, static_cast(*npScene)); + #define OMNI_PVD_DESTROY(c, o) if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->destroyObject(o); } + // Set PVD attribute a of object reference o of PVD type c to value v. v is passed as reference to value; PVD object handles are passed as reference to POINTER here! + // Example: OMNI_PVD_SET(actor, isdynamic, a, false) + #define OMNI_PVD_SET(c, a, o, v) if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->setAttribute(OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a, o, v); } + // Same as set, but for variable length attributes like vertex buffers. pv is the address of the data, and n is the size in bytes. + #define OMNI_PVD_SETB(c, a, o, pv, n)if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->setAttributeBytes(OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a, o, pv, n); } + // Same as set, but for attribute sets of unique things like an array of references. v is passed as a REFERENCE. + #define OMNI_PVD_ADD(c, a, o, v) if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->addToSet(OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a, o, v); } + // TO remove a member handle from the set. + #define OMNI_PVD_REMOVE(c, a, o, v) if (::OmniPvdPxExtensionsSampler::getInstance() != NULL) {::OmniPvdPxExtensionsSampler::getInstance()->removeFromSet(OmniPvdPxExtensionsSampler::attributeHandle_##c##_##a, o, v); } +#else + #define OMNI_PVD_ACTIVE (false) + #define OMNI_PVD_CREATE(c, p) + #define OMNI_PVD_DESTROY(c, p) + #define OMNI_PVD_SET(c, a, p, v) + #define OMNI_PVD_SETB(c, a, p, v, n) + #define OMNI_PVD_ADD(c, a, p, v) + #define OMNI_PVD_REMOVE(c, a, p, v) +#endif + + +#if PX_SUPPORT_OMNI_PVD + +#include "foundation/PxUserAllocated.h" +#include "../pvdruntime/include/OmniPvdDefines.h" + +class OmniPvdWriter; + +class OmniPvdPxExtensionsSampler : public physx::PxUserAllocated +{ +public: + OmniPvdPxExtensionsSampler(); + ~OmniPvdPxExtensionsSampler(); + void setOmniPvdWriter(OmniPvdWriter* omniPvdWriter); + void registerClasses(); + + //simplified generic API to be used via simple macros above: + template void createObject(OmniPvdClassHandle, ClassType const & objectId); + template void destroyObject(ClassType const & objectId); + template void setAttribute(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + template void setAttributeBytes(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const * value, unsigned nBytes); + template void addToSet(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + template void removeFromSet(OmniPvdAttributeHandle, ClassType const & objectId, AttributeType const & value); + + //handles for all Extensions classes and attributes + +#define OMNI_PVD_FAKE_CLASS(c, classT, classStr) static OmniPvdClassHandle classHandle_##c; +#define OMNI_PVD_CLASS(c, classT) static OmniPvdClassHandle classHandle_##c; +#define OMNI_PVD_CLASS_DERIVED(c, classT, baseClass) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ENUM(c, classT) OMNI_PVD_CLASS(c, classT) +#define OMNI_PVD_ENUM_VALUE(c, a, v) +#define OMNI_PVD_ATTRIBUTE(c, a, classT, attrT, t, n) static OmniPvdAttributeHandle attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_SET(c, a, classT, attrT) static OmniPvdAttributeHandle attributeHandle_##c##_##a; +#define OMNI_PVD_ATTRIBUTE_FLAG(c, a, classT, attrT, enumClass) static OmniPvdAttributeHandle attributeHandle_##c##_##a; + +#include "OmniPvdPxExtensionsTypes.h" //Extensions classes and attributes declared here + +#undef OMNI_PVD_ENUM +#undef OMNI_PVD_ENUM_VALUE +#undef OMNI_PVD_FAKE_CLASS +#undef OMNI_PVD_CLASS +#undef OMNI_PVD_CLASS_DERIVED +#undef OMNI_PVD_ATTRIBUTE +#undef OMNI_PVD_ATTRIBUTE_SET +#undef OMNI_PVD_ATTRIBUTE_FLAG + + // OmniPvdPxExtensionsSampler singleton + static bool createInstance(); + static OmniPvdPxExtensionsSampler* getInstance(); + static void destroyInstance(); + +private: + OmniPvdWriter* mWriter; +}; + +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsTypes.h new file mode 100644 index 0000000..bae4112 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/omnipvd/OmniPvdPxExtensionsTypes.h @@ -0,0 +1,222 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// Declare OMNI_PVD Types and Attributes here! +// The last two attribute parameters could now be derived from the other data, so could be removed in a refactor, +// though explicit control may be better. +// Note that HANDLE attributes have to use (Type const *) style, otherwise it won't compile! +// Note also that if we update the PVD USD reader code to not need different names than we use in the source code we don't need to pass both e.g. "scene" and "PxScene" and we can simplify + +OMNI_PVD_ENUM (constraintflag, PxConstraintFlag) +OMNI_PVD_ENUM_VALUE (constraintflag, eBROKEN, PxConstraintFlag::eBROKEN) +OMNI_PVD_ENUM_VALUE (constraintflag, ePROJECT_TO_ACTOR0, PxConstraintFlag::ePROJECT_TO_ACTOR0) +OMNI_PVD_ENUM_VALUE (constraintflag, ePROJECT_TO_ACTOR1, PxConstraintFlag::ePROJECT_TO_ACTOR1) +OMNI_PVD_ENUM_VALUE (constraintflag, ePROJECTION, PxConstraintFlag::ePROJECTION) +OMNI_PVD_ENUM_VALUE (constraintflag, eCOLLISION_ENABLED, PxConstraintFlag::eCOLLISION_ENABLED) +OMNI_PVD_ENUM_VALUE (constraintflag, eVISUALIZATION, PxConstraintFlag::eVISUALIZATION) +OMNI_PVD_ENUM_VALUE (constraintflag, eDRIVE_LIMITS_ARE_FORCES, PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES) +OMNI_PVD_ENUM_VALUE (constraintflag, eIMPROVED_SLERP, PxConstraintFlag::eIMPROVED_SLERP) +OMNI_PVD_ENUM_VALUE (constraintflag, eDISABLE_PREPROCESSING, PxConstraintFlag::eDISABLE_PREPROCESSING) +OMNI_PVD_ENUM_VALUE (constraintflag, eENABLE_EXTENDED_LIMITS, PxConstraintFlag::eENABLE_EXTENDED_LIMITS) +OMNI_PVD_ENUM_VALUE (constraintflag, eGPU_COMPATIBLE, PxConstraintFlag::eGPU_COMPATIBLE) +OMNI_PVD_ENUM_VALUE (constraintflag, eALWAYS_UPDATE, PxConstraintFlag::eALWAYS_UPDATE) +OMNI_PVD_ENUM_VALUE (constraintflag, eDISABLE_CONSTRAINT, PxConstraintFlag::eDISABLE_CONSTRAINT) + +OMNI_PVD_ENUM (revolutejointflag, PxRevoluteJointFlag) +OMNI_PVD_ENUM_VALUE (revolutejointflag, eLIMIT_ENABLED, PxRevoluteJointFlag::eLIMIT_ENABLED) +OMNI_PVD_ENUM_VALUE (revolutejointflag, eDRIVE_ENABLED, PxRevoluteJointFlag::eDRIVE_ENABLED) +OMNI_PVD_ENUM_VALUE (revolutejointflag, eDRIVE_FREESPIN, PxRevoluteJointFlag::eDRIVE_FREESPIN) + +OMNI_PVD_ENUM (prismaticjointflag, PxPrismaticJointFlag) +OMNI_PVD_ENUM_VALUE (prismaticjointflag, eLIMIT_ENABLED, PxPrismaticJointFlag::eLIMIT_ENABLED) + +OMNI_PVD_ENUM (distancejointflag, PxDistanceJointFlag) +OMNI_PVD_ENUM_VALUE (distancejointflag, eMAX_DISTANCE_ENABLED, PxDistanceJointFlag::eMAX_DISTANCE_ENABLED) +OMNI_PVD_ENUM_VALUE (distancejointflag, eMIN_DISTANCE_ENABLED, PxDistanceJointFlag::eMIN_DISTANCE_ENABLED) +OMNI_PVD_ENUM_VALUE (distancejointflag, eSPRING_ENABLED, PxDistanceJointFlag::eSPRING_ENABLED) + +OMNI_PVD_ENUM (sphericaljointflag, PxSphericalJointFlag) +OMNI_PVD_ENUM_VALUE (sphericaljointflag, eLIMIT_ENABLED, PxSphericalJointFlag::eLIMIT_ENABLED) + +OMNI_PVD_ENUM (d6jointdriveflag, PxD6JointDriveFlag) +OMNI_PVD_ENUM_VALUE (d6jointdriveflag, eACCELERATION, PxD6JointDriveFlag::eACCELERATION) + +OMNI_PVD_ENUM (jointconcretetype, PxJointConcreteType) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eSPHERICAL, PxJointConcreteType::eSPHERICAL) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eREVOLUTE, PxJointConcreteType::eREVOLUTE) +OMNI_PVD_ENUM_VALUE (jointconcretetype, ePRISMATIC, PxJointConcreteType::ePRISMATIC) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eFIXED, PxJointConcreteType::eFIXED) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eDISTANCE, PxJointConcreteType::eDISTANCE) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eD6, PxJointConcreteType::eD6) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eCONTACT, PxJointConcreteType::eCONTACT) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eGEAR, PxJointConcreteType::eGEAR) +OMNI_PVD_ENUM_VALUE (jointconcretetype, eRACK_AND_PINION, PxJointConcreteType::eRACK_AND_PINION) + +OMNI_PVD_ENUM (d6motion, PxD6Motion) +OMNI_PVD_ENUM_VALUE (d6motion, eLOCKED, PxD6Motion::eLOCKED) +OMNI_PVD_ENUM_VALUE (d6motion, eLIMITED, PxD6Motion::eLIMITED) +OMNI_PVD_ENUM_VALUE (d6motion, eFREE, PxD6Motion::eFREE) + +//////////////////////////////////////////////////////////////////////////////// +// Classes +//////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////// +// Joint +//////////////////////////////////////////////////////////////////////////////// +OMNI_PVD_CLASS (joint, PxJoint) +// Common +OMNI_PVD_ATTRIBUTE_FLAG (joint, type, PxJoint, PxJointConcreteType::Enum, jointconcretetype) +OMNI_PVD_ATTRIBUTE (joint, actor0, PxJoint, PxRigidActor*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (joint, actor1, PxJoint, PxRigidActor*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1) +OMNI_PVD_ATTRIBUTE (joint, actor0LocalPose, PxJoint, PxTransform, OmniPvdDataTypeEnum::eFLOAT32, 7) +OMNI_PVD_ATTRIBUTE (joint, actor1LocalPose, PxJoint, PxTransform, OmniPvdDataTypeEnum::eFLOAT32, 7) +OMNI_PVD_ATTRIBUTE (joint, breakForce, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, breakTorque, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (joint, constraintFlags, PxJoint, PxConstraintFlags, constraintflag) +OMNI_PVD_ATTRIBUTE (joint, invMassScale0, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, invInertiaScale0, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, invMassScale1, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, invInertiaScale1, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, name, PxJoint, char, OmniPvdDataTypeEnum::eSTRING, 1) +OMNI_PVD_ATTRIBUTE (joint, concreteTypeName, PxJoint, char, OmniPvdDataTypeEnum::eSTRING, 1) +// Fixed +OMNI_PVD_ATTRIBUTE (joint, fixedProjectionLinearTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, fixedProjectionAngularTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +// Prismatic +OMNI_PVD_ATTRIBUTE (joint, prismaticPosition, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticVelocity, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticProjectionLinearTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticProjectionAngularTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitLower, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitUpper, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, prismaticLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (joint, prismaticJointFlags, PxJoint, PxPrismaticJointFlags, prismaticjointflag) +// Revolute +OMNI_PVD_ATTRIBUTE (joint, revoluteAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteVelocity, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteProjectionLinearTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteProjectionAngularTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitLower, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitUpper, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteDriveVelocity, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteDriveForceLimit, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, revoluteDriveGearRatio, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (joint, revoluteJointFlags, PxJoint, PxRevoluteJointFlags, revolutejointflag) +// Spherical +OMNI_PVD_ATTRIBUTE (joint, sphericalSwingYAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalSwingZAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalProjectionLinearTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitYAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitZAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, sphericalLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (joint, sphericalJointFlags, PxJoint, PxSphericalJointFlags, sphericaljointflag) +// Distance +OMNI_PVD_ATTRIBUTE (joint, distanceDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceMinDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceMaxDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, distanceContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE_FLAG (joint, distanceJointFlags, PxJoint, PxDistanceJointFlags, distancejointflag) +// Contact +OMNI_PVD_ATTRIBUTE (joint, contactPoint, PxJoint, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (joint, contactNormal, PxJoint, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (joint, contactPenetration, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, contactRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, contactBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +// Gear +OMNI_PVD_ATTRIBUTE (joint, gearRatio, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, gearHinges, PxJoint, const PxBase*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 0) +// RackAndPinion +OMNI_PVD_ATTRIBUTE (joint, rackAndPinionRatio, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, rackAndPinionJoints, PxJoint, const PxBase*, OmniPvdDataTypeEnum::eOBJECT_HANDLE, 0) +// D6 +OMNI_PVD_ATTRIBUTE (joint, d6TwistAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingYAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingZAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6ProjectionLinearTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6ProjectionAngularTolerance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6Motions, PxJoint, PxD6Motion::Enum, OmniPvdDataTypeEnum::eUINT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitValue, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DistanceLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitLower, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitUpper, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6LinearLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitLower, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitUpper, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6TwistLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitYAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitZAngle, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6SwingLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitYAngleMin, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitYAngleMax, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitZAngleMin, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitZAngleMax, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitRestitution, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitBounceThreshold, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6PyramidSwingLimitContactDistance, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 1) +OMNI_PVD_ATTRIBUTE (joint, d6DriveForceLimit, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6DriveFlags, PxJoint, PxD6JointDriveFlags, OmniPvdDataTypeEnum::eUINT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6DriveStiffness, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6DriveDamping, PxJoint, PxReal, OmniPvdDataTypeEnum::eFLOAT32, 0) +OMNI_PVD_ATTRIBUTE (joint, d6DrivePosition, PxJoint, PxTransform, OmniPvdDataTypeEnum::eFLOAT32, 7) +OMNI_PVD_ATTRIBUTE (joint, d6DriveLinVelocity, PxJoint, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) +OMNI_PVD_ATTRIBUTE (joint, d6DriveAngVelocity, PxJoint, PxVec3, OmniPvdDataTypeEnum::eFLOAT32, 3) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp new file mode 100644 index 0000000..cc078a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinaryDeserialization.cpp @@ -0,0 +1,303 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxSerializer.h" +#include "foundation/PxHash.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxString.h" +#include "extensions/PxSerialization.h" +#include "PxPhysics.h" +#include "PxPhysicsSerialization.h" + +#include "SnFile.h" +#include "SnSerializationContext.h" +#include "SnConvX_Align.h" +#include "serialization/SnSerializationRegistry.h" +#include "serialization/SnSerialUtils.h" +#include "CmCollection.h" + +using namespace physx; +using namespace Sn; + +namespace +{ + PX_INLINE PxU8* alignPtr(PxU8* ptr, PxU32 alignment = PX_SERIAL_ALIGN) + { + if(!alignment) + return ptr; + + const PxU32 padding = getPadding(size_t(ptr), alignment); + PX_ASSERT(!getPadding(size_t(ptr + padding), alignment)); + return ptr + padding; + } + + PX_FORCE_INLINE PxU32 read32(PxU8*& address) + { + const PxU32 value = *reinterpret_cast(address); + address += sizeof(PxU32); + return value; + } + + bool readHeader(PxU8*& address) + { + const PxU32 header = read32(address); + PX_UNUSED(header); + + const PxU32 version = read32(address); + PX_UNUSED(version); + + char binaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS + 1]; + PxMemCopy(binaryVersionGuid, address, SN_BINARY_VERSION_GUID_NUM_CHARS); + binaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS] = 0; + address += SN_BINARY_VERSION_GUID_NUM_CHARS; + PX_UNUSED(binaryVersionGuid); + + const PxU32 platformTag = read32(address); + PX_UNUSED(platformTag); + + const PxU32 markedPadding = read32(address); + PX_UNUSED(markedPadding); + +#if PX_CHECKED + if (header != PX_MAKE_FOURCC('S','E','B','D')) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "Buffer contains data with wrong header indicating invalid binary data."); + return false; + } + + if (!checkCompatibility(binaryVersionGuid)) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "Buffer contains binary data version 0x%s and is incompatible with this PhysX sdk (0x%s).\n", + binaryVersionGuid, getBinaryVersionGuid()); + return false; + } + + if (platformTag != getBinaryPlatformTag()) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "Buffer contains data with platform mismatch:\nExpected: %s \nActual: %s\n", + getBinaryPlatformName(getBinaryPlatformTag()), + getBinaryPlatformName(platformTag)); + return false; + } +#endif + return true; + } + + bool checkImportReferences(const ImportReference* importReferences, PxU32 nbImportReferences, const Cm::Collection* externalRefs) + { + if (!externalRefs) + { + if (nbImportReferences > 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxSerialization::createCollectionFromBinary: External references needed but no externalRefs collection specified."); + return false; + } + } + else + { + for (PxU32 i=0; ifind(id); + if (!referencedObject) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxSerialization::createCollectionFromBinary: External reference %" PX_PRIu64 " expected in externalRefs collection but not found.", id); + return false; + } + if (referencedObject->getConcreteType() != type) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxSerialization::createCollectionFromBinary: External reference %d type mismatch. Expected %d but found %d in externalRefs collection.", type, referencedObject->getConcreteType()); + return false; + } + } + } + return true; + } + +} + +PxCollection* PxSerialization::createCollectionFromBinary(void* memBlock, PxSerializationRegistry& sr, const PxCollection* pxExternalRefs) +{ +#if PX_CHECKED + if(size_t(memBlock) & (PX_SERIAL_FILE_ALIGN-1)) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Buffer must be 128-bytes aligned."); + return NULL; + } +#endif + PxU8* address = reinterpret_cast(memBlock); + const Cm::Collection* externalRefs = static_cast(pxExternalRefs); + + if (!readHeader(address)) + { + return NULL; + } + + ManifestEntry* manifestTable; + PxU32 nbObjectsInCollection; + PxU32 objectDataEndOffset; + + // read number of objects in collection + address = alignPtr(address); + nbObjectsInCollection = read32(address); + + // read manifest (PxU32 offset, PxConcreteType type) + { + address = alignPtr(address); + PxU32 nbManifestEntries = read32(address); + PX_ASSERT(*reinterpret_cast(address) == 0); //first offset is always 0 + manifestTable = (nbManifestEntries > 0) ? reinterpret_cast(address) : NULL; + address += nbManifestEntries*sizeof(ManifestEntry); + objectDataEndOffset = read32(address); + } + + ImportReference* importReferences; + PxU32 nbImportReferences; + // read import references + { + address = alignPtr(address); + nbImportReferences = read32(address); + importReferences = (nbImportReferences > 0) ? reinterpret_cast(address) : NULL; + address += nbImportReferences*sizeof(ImportReference); + } + + if (!checkImportReferences(importReferences, nbImportReferences, externalRefs)) + { + return NULL; + } + + ExportReference* exportReferences; + PxU32 nbExportReferences; + // read export references + { + address = alignPtr(address); + nbExportReferences = read32(address); + exportReferences = (nbExportReferences > 0) ? reinterpret_cast(address) : NULL; + address += nbExportReferences*sizeof(ExportReference); + } + + // read internal references arrays + PxU32 nbInternalPtrReferences = 0; + PxU32 nbInternalHandle16References = 0; + InternalReferencePtr* internalPtrReferences = NULL; + InternalReferenceHandle16* internalHandle16References = NULL; + { + address = alignPtr(address); + + nbInternalPtrReferences = read32(address); + internalPtrReferences = (nbInternalPtrReferences > 0) ? reinterpret_cast(address) : NULL; + address += nbInternalPtrReferences*sizeof(InternalReferencePtr); + + nbInternalHandle16References = read32(address); + internalHandle16References = (nbInternalHandle16References > 0) ? reinterpret_cast(address) : NULL; + address += nbInternalHandle16References*sizeof(InternalReferenceHandle16); + } + + // create internal references map + InternalPtrRefMap internalPtrReferencesMap(nbInternalPtrReferences*2); + { + //create hash (we should load the hashes directly from memory) + for (PxU32 i = 0; i < nbInternalPtrReferences; i++) + { + const InternalReferencePtr& ref = internalPtrReferences[i]; + internalPtrReferencesMap.insertUnique(ref.reference, SerialObjectIndex(ref.objIndex)); + } + } + InternalHandle16RefMap internalHandle16ReferencesMap(nbInternalHandle16References*2); + { + for (PxU32 i=0;i(sr); + Cm::Collection* collection = static_cast(PxCreateCollection()); + PX_ASSERT(collection); + collection->mObjects.reserve(nbObjectsInCollection*2); + if(nbExportReferences > 0) + collection->mIds.reserve(nbExportReferences*2); + + PxU8* addressObjectData = alignPtr(address); + PxU8* addressExtraData = alignPtr(addressObjectData + objectDataEndOffset); + + DeserializationContext context(manifestTable, importReferences, addressObjectData, internalPtrReferencesMap, internalHandle16ReferencesMap, externalRefs, addressExtraData); + + // iterate over memory containing PxBase objects, create the instances, resolve the addresses, import the external data, add to collection. + { + PxU32 nbObjects = nbObjectsInCollection; + + while(nbObjects--) + { + address = alignPtr(address); + context.alignExtraData(); + + // read PxBase header with type and get corresponding serializer. + PxBase* header = reinterpret_cast(address); + const PxType classType = header->getConcreteType(); + const PxSerializer* serializer = sn.getSerializer(classType); + PX_ASSERT(serializer); + + PxBase* instance = serializer->createObject(address, context); + if (!instance) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "Cannot create class instance for concrete type %d.", classType); + collection->release(); + return NULL; + } + + collection->internalAdd(instance); + } + } + + PX_ASSERT(nbObjectsInCollection == collection->internalGetNbObjects()); + + // update new collection with export references + { + PX_ASSERT(addressObjectData != NULL); + for (PxU32 i=0;i(addressObjectData + manifestTable[manifestIndex].offset); + collection->mIds.insertUnique(exportReferences[i].id, obj); + collection->mObjects[obj] = exportReferences[i].id; + } + } + + PxAddCollectionToPhysics(*collection); + return collection; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp new file mode 100644 index 0000000..97aa320 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnBinarySerialization.cpp @@ -0,0 +1,441 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxSerializer.h" +#include "foundation/PxPhysicsVersion.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxSort.h" +#include "extensions/PxBinaryConverter.h" +#include "SnSerializationContext.h" +#include "serialization/SnSerialUtils.h" +#include "serialization/SnSerializationRegistry.h" + +using namespace physx; +using namespace Cm; +using namespace Sn; + +//------------------------------------------------------------------------------------ +//// Binary Serialized PxCollection, format documentation +//------------------------------------------------------------------------------------ +// +// +//------------------------------------------------------------------------------------ +//// overview: +//// header information +//// manifest table +//// import references +//// export references +//// internal references +//// object data +//// extra data +//------------------------------------------------------------------------------------ +// +// +//------------------------------------------------------------------------------------ +//// header information: +//// header tag plus various version and platform information +//------------------------------------------------------------------------------------ +// header SEBD +// PX_PHYSICS_VERSION +// PX_BINARY_SERIAL_VERSION +// platform tag +// markedPadding (on for PX_CHECKED) +// nbObjectsInCollection +// +// +//------------------------------------------------------------------------------------ +//// manifest table: +//// one entry per collected object +//// offsets relative to object data buffer +//------------------------------------------------------------------------------------ +// alignment +// PxU32 size +// (PxU32 offset, PxType type)*size +// PxU32 endOffset +// +// +//------------------------------------------------------------------------------------ +//// import references: +//// one entry per required reference to external collection +//------------------------------------------------------------------------------------ +// alignment +// PxU32 size +// (PxSerialObjectId id, PxType type)*size +// +// +//------------------------------------------------------------------------------------ +//// export references: +//// one entry per object in the collection with id +//// object indices point into the manifest table (objects in the same collection) +//------------------------------------------------------------------------------------ +// alignment +// PxU32 size +// (PxSerialObjectId id, SerialObjectIndex objIndex)*size +// +// +//------------------------------------------------------------------------------------ +//// internal references: +//// one entry per reference, kind pair +//// object indices point either into the manifest table or into the import references +//// depending on whether the entry references the same collection or the external one +//// one section for pointer type references and one for index type references. +//------------------------------------------------------------------------------------ +// alignment +// PxU32 sizePtrs; +// (size_t reference, PxU32 kind, SerialObjectIndex objIndex)*sizePtrs +// PxU32 sizeHandle16; +// (PxU16 reference, PxU32 kind, SerialObjectIndex objIndex)*sizeHandle16 +// +// +//------------------------------------------------------------------------------------ +//// object data: +//// serialized PxBase derived class instances +//// each object size depends on specific class +//// offsets are stored in manifest table +//------------------------------------------------------------------------------------ +// alignment +// (PxConcreteType type, -----) +// alignment +// (PxConcreteType type, --------) +// alignment +// (PxConcreteType type, --) +// . +// . +// +// +// ----------------------------------------------------------------------------------- +//// extra data: +//// extra data memory block +//// serialized and deserialized by PxBase implementations +////---------------------------------------------------------------------------------- +// extra data +// +//------------------------------------------------------------------------------------ + +namespace +{ + class OutputStreamWriter + { + public: + + PX_INLINE OutputStreamWriter(PxOutputStream& stream) + : mStream(stream) + , mCount(0) + {} + + PX_INLINE PxU32 write(const void* src, PxU32 offset) + { + PxU32 count = mStream.write(src, offset); + mCount += count; + return count; + } + + PX_INLINE PxU32 getStoredSize() + { + return mCount; + } + + private: + + OutputStreamWriter& operator=(const OutputStreamWriter&); + PxOutputStream& mStream; + PxU32 mCount; + }; + + class LegacySerialStream : public PxSerializationContext + { + public: + LegacySerialStream(OutputStreamWriter& writer, + const PxCollection& collection, + bool exportNames) : mWriter(writer), mCollection(collection), mExportNames(exportNames) {} + void writeData(const void* buffer, PxU32 size) { mWriter.write(buffer, size); } + PxU32 getTotalStoredSize() { return mWriter.getStoredSize(); } + void alignData(PxU32 alignment) + { + if(!alignment) + return; + + PxI32 bytesToPad = PxI32(getPadding(getTotalStoredSize(), alignment)); + static const PxI32 BUFSIZE = 64; + char buf[BUFSIZE]; + PxMemSet(buf, 0, bytesToPad < BUFSIZE ? PxU32(bytesToPad) : PxU32(BUFSIZE)); + while(bytesToPad > 0) + { + writeData(buf, bytesToPad < BUFSIZE ? PxU32(bytesToPad) : PxU32(BUFSIZE)); + bytesToPad -= BUFSIZE; + } + PX_ASSERT(!getPadding(getTotalStoredSize(), alignment)); + } + + virtual void registerReference(PxBase&, PxU32, size_t) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Cannot register references during exportData, exportExtraData."); + } + + virtual const PxCollection& getCollection() const + { + return mCollection; + } + virtual void writeName(const char* name) + { + PxU32 len = name && mExportNames ? PxU32(strlen(name)) + 1 : 0; + writeData(&len, sizeof(len)); + if(len) writeData(name, len); + } + + private: + LegacySerialStream& operator=(const LegacySerialStream&); + OutputStreamWriter& mWriter; + const PxCollection& mCollection; + bool mExportNames; + }; + + void writeHeader(PxSerializationContext& stream, bool hasDeserializedAssets) + { + PX_UNUSED(hasDeserializedAssets); + + //serialized binary data. + const PxU32 header = PX_MAKE_FOURCC('S','E','B','D'); + stream.writeData(&header, sizeof(PxU32)); + + PxU32 version = PX_PHYSICS_VERSION; + stream.writeData(&version, sizeof(PxU32)); + + stream.writeData(PX_BINARY_SERIAL_VERSION, SN_BINARY_VERSION_GUID_NUM_CHARS); + + PxU32 platformTag = getBinaryPlatformTag(); + stream.writeData(&platformTag, sizeof(PxU32)); + + PxU32 markedPadding = 0; +#if PX_CHECKED + if(!hasDeserializedAssets) + markedPadding = 1; +#endif + stream.writeData(&markedPadding, sizeof(PxU32)); + } + + template + struct InternalReferencePredicate + { + PX_FORCE_INLINE bool operator()(InternalReferenceType& a, InternalReferenceType& b) const { return a.objIndex < b.objIndex; } + }; + +} + +bool PxSerialization::serializeCollectionToBinary(PxOutputStream& outputStream, PxCollection& pxCollection, PxSerializationRegistry& sr, const PxCollection* pxExternalRefs, bool exportNames) +{ + if(!PxSerialization::isSerializable(pxCollection, sr, pxExternalRefs)) + return false; + + Collection& collection = static_cast(pxCollection); + const Collection* externalRefs = static_cast(pxExternalRefs); + + //temporary memory stream which allows fixing up data up stream + + SerializationRegistry& sn = static_cast(sr); + + // sort collection by "order" value (this will be the order in which they get serialized) + sortCollection(collection, sn, false); + + //initialized the context with the sorted collection. + SerializationContext context(collection, externalRefs); + + // gather reference information + bool hasDeserializedAssets = false; + { + const PxU32 nb = collection.internalGetNbObjects(); + for(PxU32 i=0;igetConcreteType()); +#if PX_CHECKED + //can't guarantee marked padding for deserialized instances + if(!(s->getBaseFlags() & PxBaseFlag::eOWNS_MEMORY)) + hasDeserializedAssets = true; +#endif + const PxSerializer* serializer = sn.getSerializer(s->getConcreteType()); + PX_ASSERT(serializer); + serializer->registerReferences(*s, context); + } + } + + // now start the actual serialization into the output stream + OutputStreamWriter writer(outputStream); + LegacySerialStream stream(writer, collection, exportNames); + + writeHeader(stream, hasDeserializedAssets); + + // write size of collection + stream.alignData(PX_SERIAL_ALIGN); + PxU32 nbObjectsInCollection = collection.internalGetNbObjects(); + stream.writeData(&nbObjectsInCollection, sizeof(PxU32)); + + // write the manifest table (PxU32 offset, PxConcreteType type) + { + PxArray manifestTable(collection.internalGetNbObjects()); + PxU32 headerOffset = 0; + for(PxU32 i=0;igetConcreteType()); + PxType concreteType = s->getConcreteType(); + const PxSerializer* serializer = sn.getSerializer(concreteType); + PX_ASSERT(serializer); + manifestTable[i] = ManifestEntry(headerOffset, concreteType); + PxU32 classSize = PxU32(serializer->getClassSize()); + headerOffset += getPadding(classSize, PX_SERIAL_ALIGN) + classSize; + } + stream.alignData(PX_SERIAL_ALIGN); + const PxU32 nb = manifestTable.size(); + stream.writeData(&nb, sizeof(PxU32)); + stream.writeData(manifestTable.begin(), manifestTable.size()*sizeof(ManifestEntry)); + + //store offset for end of object buffer (PxU32 offset) + stream.writeData(&headerOffset, sizeof(PxU32)); + } + + // write import references + { + const PxArray& importReferences = context.getImportReferences(); + stream.alignData(PX_SERIAL_ALIGN); + const PxU32 nb = importReferences.size(); + stream.writeData(&nb, sizeof(PxU32)); + stream.writeData(importReferences.begin(), importReferences.size()*sizeof(ImportReference)); + } + + // write export references + { + PxU32 nbIds = collection.getNbIds(); + PxArray exportReferences(nbIds); + //we can't get quickly from id to object index in collection. + //if we only need this here, its not worth to build a hash + nbIds = 0; + for (PxU32 i=0;i internalReferencesPtr(internalPtrReferencesMap.size()); + PxU32 nbInternalPtrReferences = 0; + + InternalHandle16RefMap& internalHandle16ReferencesMap = context.getInternalHandle16ReferencesMap(); + PxArray internalReferencesHandle16(internalHandle16ReferencesMap.size()); + PxU32 nbInternalHandle16References = 0; + + { + for(InternalPtrRefMap::Iterator iter = internalPtrReferencesMap.getIterator(); !iter.done(); ++iter) + internalReferencesPtr[nbInternalPtrReferences++] = InternalReferencePtr(iter->first, iter->second); + + for(InternalHandle16RefMap::Iterator iter = internalHandle16ReferencesMap.getIterator(); !iter.done(); ++iter) + internalReferencesHandle16[nbInternalHandle16References++] = InternalReferenceHandle16(PxTo16(iter->first), iter->second); + + //sort InternalReferences according to SerialObjectIndex for determinism + PxSort >(internalReferencesPtr.begin(), internalReferencesPtr.size(), InternalReferencePredicate()); + PxSort >(internalReferencesHandle16.begin(), internalReferencesHandle16.size(), InternalReferencePredicate()); + } + + stream.alignData(PX_SERIAL_ALIGN); + + stream.writeData(&nbInternalPtrReferences, sizeof(PxU32)); + stream.writeData(internalReferencesPtr.begin(), internalReferencesPtr.size()*sizeof(InternalReferencePtr)); + + stream.writeData(&nbInternalHandle16References, sizeof(PxU32)); + stream.writeData(internalReferencesHandle16.begin(), internalReferencesHandle16.size()*sizeof(InternalReferenceHandle16)); + } + + // write object data + { + stream.alignData(PX_SERIAL_ALIGN); + const PxU32 nb = collection.internalGetNbObjects(); + for(PxU32 i=0;igetConcreteType()); + const PxSerializer* serializer = sn.getSerializer(s->getConcreteType()); + PX_ASSERT(serializer); + stream.alignData(PX_SERIAL_ALIGN); + serializer->exportData(*s, stream); + } + } + + // write extra data + { + const PxU32 nb = collection.internalGetNbObjects(); + for(PxU32 i=0;igetConcreteType()); + + const PxSerializer* serializer = sn.getSerializer(s->getConcreteType()); + PX_ASSERT(serializer); + + stream.alignData(PX_SERIAL_ALIGN); + serializer->exportExtraData(*s, stream); + } + } + + return true; +} + +bool PxSerialization::serializeCollectionToBinaryDeterministic(PxOutputStream& outputStream, PxCollection& pxCollection, PxSerializationRegistry& sr, const PxCollection* pxExternalRefs, bool exportNames) +{ + PxDefaultMemoryOutputStream tmpOutputStream; + if (!serializeCollectionToBinary(tmpOutputStream, pxCollection, sr, pxExternalRefs, exportNames)) + return false; + + PxDefaultMemoryOutputStream metaDataOutput; + dumpBinaryMetaData(metaDataOutput, sr); + + PxBinaryConverter* converter = createBinaryConverter(); + PxDefaultMemoryInputData srcMetaData(metaDataOutput.getData(), metaDataOutput.getSize()); + PxDefaultMemoryInputData dstMetaData(metaDataOutput.getData(), metaDataOutput.getSize()); + + if (!converter->setMetaData(srcMetaData, dstMetaData)) + return false; + + PxDefaultMemoryInputData srcBinaryData(tmpOutputStream.getData(), tmpOutputStream.getSize()); + bool ret = converter->convert(srcBinaryData, srcBinaryData.getLength(), outputStream); + converter->release(); + + return ret; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp new file mode 100644 index 0000000..b0b5a3e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.cpp @@ -0,0 +1,164 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +/* +- get rid of STL + +- NpArticulationLinkArray with more than 4 entries +- big convexes Xbox => PC + +- put a cache in "convertClass" function +- remove MD one at a time and check what happens in the converter. Make it robust/report errors +- for xbox, compare against source xbox file if it exists +- maybe put some info in the header to display "File generated by ConvX 1.xx" on screen (to debug) +- report inconsistent naming convention in each class!!!! +- try to automatically discover padding bytes? use "0xcd" pattern? +* do last param of XXXX_ITEMS macro automatically +- what if source files are 64bits? can we safely convert a 64bit ptr to 32bit? +*/ + +#include "foundation/PxErrorCallback.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxIO.h" +#include "SnConvX.h" +#include "serialization/SnSerializationRegistry.h" +#include + +using namespace physx; + +Sn::ConvX::ConvX() : + mMetaData_Src (NULL), + mMetaData_Dst (NULL), + mOutStream (NULL), + mMustFlip (false), + mOutputSize (0), + mSrcPtrSize (0), + mDstPtrSize (0), + mNullPtr (false), + mNoOutput (false), + mMarkedPadding (false), + mNbErrors (0), + mNbWarnings (0), + mReportMode (PxConverterReportMode::eNORMAL), + mPerformConversion (true) +{ + // memset(mZeros, 0, CONVX_ZERO_BUFFER_SIZE); + memset(mZeros, 0x42, CONVX_ZERO_BUFFER_SIZE); +} + +Sn::ConvX::~ConvX() +{ + resetNbErrors(); + resetConvexFlags(); + releaseMetaData(); + resetUnions(); +} + +void Sn::ConvX::release() +{ + PX_DELETE_THIS; +} + +bool Sn::ConvX::setMetaData(PxInputStream& inputStream, MetaDataType type) +{ + resetNbErrors(); + return (loadMetaData(inputStream, type) != NULL); +} + +bool Sn::ConvX::setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaData) +{ + releaseMetaData(); + resetUnions(); + + if(!setMetaData(srcMetaData, META_DATA_SRC)) + return false; + if(!setMetaData(dstMetaData, META_DATA_DST)) + return false; + + return true; +} + +bool Sn::ConvX::compareMetaData() const +{ + if (!mMetaData_Src || !mMetaData_Dst) { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxBinaryConverter: metadata not defined. Call PxBinaryConverter::setMetaData first.\n"); + return false; + } + + return mMetaData_Src->compare(*mMetaData_Dst); +} + +bool Sn::ConvX::convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream) +{ + if(!mMetaData_Src || !mMetaData_Dst) + { + PxGetFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "PxBinaryConverter: metadata not defined. Call PxBinaryConverter::setMetaData first.\n"); + return false; + } + + resetConvexFlags(); + resetNbErrors(); + + bool conversionStatus = false; + if(mPerformConversion) + { + if(srcSize == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxBinaryConverter: source serialized data size is zero.\n"); + return false; + } + + void* memory = PX_ALLOC(srcSize+ALIGN_FILE, "ConvX source file"); + void* memoryA = reinterpret_cast((size_t(memory) + ALIGN_FILE)&~(ALIGN_FILE-1)); + + const PxU32 nbBytesRead = srcStream.read(memoryA, srcSize); + if(nbBytesRead != srcSize) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxBinaryConverter: failure on reading source serialized data.\n"); + PX_FREE(memory); + return false; + } + + displayMessage(PxErrorCode::eDEBUG_INFO, "\n\nConverting...\n\n"); + + { + if(!initOutput(targetStream)) + { + PX_FREE(memory); + return false; + } + conversionStatus = convert(memoryA, int(srcSize)); + closeOutput(); + } + + PX_FREE(memory); + } + return conversionStatus; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.h new file mode 100644 index 0000000..ced90d8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX.h @@ -0,0 +1,195 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SN_CONVX_H +#define SN_CONVX_H + +#include "foundation/PxErrors.h" +#include "common/PxTypeInfo.h" +#include "extensions/PxBinaryConverter.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashMap.h" +#include "SnConvX_Common.h" +#include "SnConvX_Union.h" +#include "SnConvX_MetaData.h" +#include "SnConvX_Align.h" + +#define CONVX_ZERO_BUFFER_SIZE 256 + +namespace physx { + +class PxSerializationRegistry; + +namespace Sn { + + struct HeightFieldData; + class PointerRemap + { + public: + PointerRemap(); + ~PointerRemap(); + + void setObjectRef(PxU64 object64, PxU32 ref); + bool getObjectRef(PxU64 object64, PxU32& ref) const; + + typedef PxHashMap PointerMap; + PointerMap mData; + }; + + class Handle16Remap + { + public: + Handle16Remap(); + ~Handle16Remap(); + + void setObjectRef(PxU16 object, PxU16 ref); + bool getObjectRef(PxU16 object, PxU16& ref) const; + + typedef PxHashMap Handle16Map; + Handle16Map mData; + }; + + class ConvX : public physx::PxBinaryConverter, public PxUserAllocated + { + public: + ConvX(); + virtual ~ConvX(); + + virtual void release(); + virtual void setReportMode(PxConverterReportMode::Enum mode) { mReportMode = mode; } + PX_FORCE_INLINE bool silentMode() const { return mReportMode==PxConverterReportMode::eNONE; } + PX_FORCE_INLINE bool verboseMode() const { return mReportMode==PxConverterReportMode::eVERBOSE; } + + virtual bool setMetaData(PxInputStream& srcMetaData, PxInputStream& dstMetaData); + virtual bool compareMetaData() const; + virtual bool convert(PxInputStream& srcStream, PxU32 srcSize, PxOutputStream& targetStream); + + private: + ConvX& operator=(const ConvX&); + bool setMetaData(PxInputStream& inputStream, MetaDataType type); + + // Meta-data + void releaseMetaData(); + const MetaData* loadMetaData(PxInputStream& inputStream, MetaDataType type); + const MetaData* getBinaryMetaData(MetaDataType type); + int getNbMetaClasses(MetaDataType type); + MetaClass* getMetaClass(unsigned int i, MetaDataType type) const; + MetaClass* getMetaClass(const char* name, MetaDataType type) const; + MetaClass* getMetaClass(PxConcreteType::Enum concreteType, MetaDataType type); + MetaData* mMetaData_Src; + MetaData* mMetaData_Dst; + + // Convert + + bool convert(const void* buffer, int fileSize); + void resetConvexFlags(); + void _enumerateFields(const MetaClass* mc, ExtraDataEntry2* entries, int& nb, int baseOffset, MetaDataType type) const; + void _enumerateExtraData(const char* address, const MetaClass* mc, ExtraDataEntry* entries, int& nb, int offset, MetaDataType type) const; + PxU64 read64(const void*& buffer); + int read32(const void*& buffer); + short read16(const void*& buffer); + bool convertClass(const char* buffer, const MetaClass* mc, int offset); + const char* convertExtraData_Array(const char* Address, const char* lastAddress, const char* objectAddress, const ExtraDataEntry& ed); + const char* convertExtraData_Ptr(const char* Address, const char* lastAddress, const PxMetaDataEntry& entry, int count, int ptrSize_Src, int ptrSize_Dst); + const char* convertExtraData_Handle(const char* Address, const char* lastAddress, const PxMetaDataEntry& entry, int count); + int getConcreteType(const char* buffer); + bool convertCollection(const void* buffer, int fileSize, int nbObjects); + const void* convertManifestTable(const void* buffer, int& fileSize); + const void* convertImportReferences(const void* buffer, int& fileSize); + const void* convertExportReferences(const void* buffer, int& fileSize); + const void* convertInternalReferences(const void* buffer, int& fileSize); + const void* convertReferenceTables(const void* buffer, int& fileSize, int& nbObjectsInCollection); + bool checkPaddingBytes(const char* buffer, int byteCount); + + // ---- big convex surgery ---- + PsArray mConvexFlags; + // Align + const char* alignStream(const char* buffer, int alignment=ALIGN_DEFAULT); + void alignTarget(int alignment); + + char mZeros[CONVX_ZERO_BUFFER_SIZE]; + // Unions + bool registerUnion(const char* name); + bool registerUnionType(const char* unionName, const char* typeName, int typeValue); + const char* getTypeName(const char* unionName, int typeValue); + void resetUnions(); + PsArray mUnions; + // Output + void setNullPtr(bool); + void setNoOutput(bool); + bool initOutput(PxOutputStream& targetStream); + void closeOutput(); + int getCurrentOutputSize(); + void output(short value); + void output(int value); + void output(PxU64 value); + void output(const char* buffer, int nbBytes); + void convert8 (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convertPad8 (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convert16 (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convert32 (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convert64 (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convertFloat(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convertPtr (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + void convertHandle16(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + PxOutputStream* mOutStream; + bool mMustFlip; + int mOutputSize; + int mSrcPtrSize; + int mDstPtrSize; + bool mNullPtr; + bool mNoOutput; + bool mMarkedPadding; + + // Errors + void resetNbErrors(); + int getNbErrors() const; + void displayMessage(physx::PxErrorCode::Enum code, const char* format, ...); + int mNbErrors; + int mNbWarnings; + + // Settings + PxConverterReportMode::Enum mReportMode; + bool mPerformConversion; + + // Remap pointers + void exportIntAsPtr(int value); + void exportInt(int value); + void exportInt64(PxU64 value); + PointerRemap mPointerRemap; + PointerRemap* mPointerActiveRemap; + PxU32 mPointerRemapCounter; + Handle16Remap mHandle16Remap; + Handle16Remap* mHandle16ActiveRemap; + PxU16 mHandle16RemapCounter; + + friend class MetaData; + friend struct MetaClass; + }; +} } +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp new file mode 100644 index 0000000..c98b294 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Align.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "SnConvX.h" +#include "SnConvX_Align.h" +#include +using namespace physx; + +void Sn::ConvX::alignTarget(int alignment) +{ + const int outputSize = getCurrentOutputSize(); + const PxU32 outPadding = getPadding(size_t(outputSize), PxU32(alignment)); + if(outPadding) + { + assert(outPadding + +using namespace physx; +using namespace physx::Sn; +using namespace Cm; + +void Sn::ConvX::resetConvexFlags() +{ + mConvexFlags.clear(); +} + +void Sn::ConvX::_enumerateFields(const MetaClass* mc, ExtraDataEntry2* entries, int& nb, int baseOffset, MetaDataType type) const +{ + PxU32 nbFields = mc->mFields.size(); + int offsetCheck = baseOffset; + PX_UNUSED(offsetCheck); + + for(PxU32 j=0;jmFields[j]; + if(entry.mFlags & PxMetaDataFlag::eCLASS || entry.mFlags & PxMetaDataFlag::eEXTRA_DATA) + continue; + + assert(offsetCheck == baseOffset + entry.mOffset); + + int currentOffset = baseOffset + entry.mOffset; + + //for(int c=0;cmCallback) + { + entries[nb].entry = entry; + entries[nb].offset = currentOffset; + entries[nb].cb = fieldType->mCallback; + nb++; + } + else + { + for(int c=0;cmFields.size(); + for(PxU32 j=0;jmFields[j]; + if(entry.mFlags & PxMetaDataFlag::eCLASS /*|| entry.mFlags & PxMetaDataFlag::ePTR*/ || entry.mFlags & PxMetaDataFlag::eTYPEDEF) + continue; + + const char* entryType = entry.mType; + + // + // Insanely Twisted Shadow GeometryUnion + // + // Special code is needed as long as there are no meta data tags to describe our unions properly. The way it is done here is + // not future-proof at all. There should be a tag to describe where the union type can be found and the number of bytes + // this type id needs. Then a mapping needs to get added from each union type id to the proper meta class name. + // + if (entry.mFlags & PxMetaDataFlag::eUNION) + { + if (!mc->mClassName || Pxstrcmp(mc->mClassName, "GeometryUnion")!=0) + continue; + else + { + // ### hardcoded bit here, will only work when union type is the first int of the struct + const int* tmp = reinterpret_cast(address + offset); + const int unionType = *tmp; + + ConvX* tmpConv = const_cast(this); // ... don't ask + const char* typeName = tmpConv->getTypeName(entry.mType, unionType); + assert(typeName); + + bool isTriMesh = (Pxstrcmp(typeName, "PxTriangleMeshGeometryLL") == 0); + bool isHeightField = (Pxstrcmp(typeName, "PxHeightFieldGeometryLL") == 0); + if (!isTriMesh && !isHeightField) + { + continue; + } + else + { + entryType = typeName; + } + } + } + + // MetaClass* extraDataType = getMetaClass(entry.mType, type); + // if(!extraDataType) + // continue; + + if(entry.mFlags & PxMetaDataFlag::eEXTRA_DATA) + { + entries[nb].entry = entry; + entries[nb].offset = offset+entry.mOffset; + nb++; + } + else + { + if(entry.mFlags & PxMetaDataFlag::ePTR) + continue; + + MetaClass* extraDataType = getMetaClass(entryType, type); + if(!extraDataType) + continue; + + if(!extraDataType->mCallback) + _enumerateExtraData(address, extraDataType, entries, nb, offset+entry.mOffset, type); + } + } +} + +PxU64 Sn::ConvX::read64(const void*& buffer) +{ + const PxU64* buf64 = reinterpret_cast(buffer); + buffer = reinterpret_cast(size_t(buffer) + sizeof(PxU64)); + PxU64 value = *buf64; + output(value); + return value; +} + +int Sn::ConvX::read32(const void*& buffer) +{ + const int* buf32 = reinterpret_cast(buffer); + buffer = reinterpret_cast(size_t(buffer) + sizeof(int)); + int value = *buf32; + output(value); + return value; +} + +short Sn::ConvX::read16(const void*& buffer) +{ + const short* buf16 = reinterpret_cast(buffer); + buffer = reinterpret_cast(size_t(buffer) + sizeof(short)); + short value = *buf16; + output(value); + return value; +} + +#if PX_CHECKED +extern const char* gVTable; +static bool compareEntries(const ExtraDataEntry2& e0, const ExtraDataEntry2& e1) +{ + if(e0.entry.isVTablePtr() && e1.entry.isVTablePtr()) + return true; + + if((e0.entry.mFlags & PxMetaDataFlag::eUNION) && (e1.entry.mFlags & PxMetaDataFlag::eUNION)) + { + if(e0.entry.mType && e1.entry.mType) + { + // We can't compare the ptrs since they index different string tables + if(Pxstrcmp(e0.entry.mType, e1.entry.mType)==0) + return true; + } + return false; + } + + if(e0.entry.mName && e1.entry.mName) + { + // We can't compare the ptrs since they index different string tables + if(Pxstrcmp(e0.entry.mName, e1.entry.mName)==0) + return true; + } + return false; +} +#endif + +// TODO: optimize this +bool Sn::ConvX::convertClass(const char* buffer, const MetaClass* mc, int offset) +{ + // ---- big convex surgery ---- + bool convexSurgery = false; + bool foundNbVerts = false; + bool removeBigData = false; + + // force reference + (void)foundNbVerts; + + displayMessage(PxErrorCode::eDEBUG_INFO, "%s\n", mc->mClassName); + displayMessage(PxErrorCode::eDEBUG_INFO, "+++++++++++++++++++++++++++++++++++++++++++++\n"); + + if(Pxstrcmp(mc->mClassName, "ConvexMesh")==0) + { + convexSurgery = true; + } + // ---- big convex surgery ---- + + int nbSrcEntries = 0; + PX_ALLOCA(srcEntries, ExtraDataEntry2, 256); // ### painful ctors here + int nbDstEntries = 0; + PX_ALLOCA(dstEntries, ExtraDataEntry2, 256); // ### painful ctors here + // Find corresponding meta-class for target platform + const MetaClass* target_mc = getMetaClass(mc->mClassName, META_DATA_DST); + assert(target_mc); + + if(mc->mCallback) + { + srcEntries[0].cb = mc->mCallback; + srcEntries[0].offset = offset; + srcEntries[0].entry.mType = mc->mClassName; + srcEntries[0].entry.mName = mc->mClassName; + srcEntries[0].entry.mOffset = offset; + srcEntries[0].entry.mSize = mc->mSize; + srcEntries[0].entry.mCount = 1; + srcEntries[0].entry.mFlags = 0; + nbSrcEntries = 1; + + assert(target_mc->mCallback); + dstEntries[0].cb = target_mc->mCallback; + dstEntries[0].offset = offset; + dstEntries[0].entry.mType = target_mc->mClassName; + dstEntries[0].entry.mName = target_mc->mClassName; + dstEntries[0].entry.mOffset = offset; + dstEntries[0].entry.mSize = target_mc->mSize; + dstEntries[0].entry.mCount = 1; + dstEntries[0].entry.mFlags = 0; + nbDstEntries = 1; + } + else + { + nbSrcEntries = 0; + _enumerateFields(mc, srcEntries, nbSrcEntries, 0, META_DATA_SRC); + assert(nbSrcEntries<256); + + nbDstEntries = 0; + _enumerateFields(target_mc, dstEntries, nbDstEntries, 0, META_DATA_DST); + assert(nbDstEntries<256); + + // nb = mc->mNbEntries; + // assert(nb>=0); + // memcpy(entries, mc->mEntries, nb*sizeof(ExtraDataEntry2)); + } + + int srcOffsetCheck = 0; + int dstOffsetCheck = 0; + PX_UNUSED(dstOffsetCheck); + int j = 0; + // Track cases where the vtable pointer location is different for different platforms. + // The variables indicate whether a platform has a vtable pointer entry that has not been converted yet + // and they will remember the index of the corrssponding entry. This works because there can only + // be one open vtable pointer entry at a time. + int srcOpenVTablePtrEntry = -1; + int dstOpenVTablePtrEntry = -1; + + //if the src and dst platform place the vtable pointers at different locations some fiddling with the iteration count can be necessary. + int addVTablePtrShiftIteration = 0; + const int maxNb = nbSrcEntries > nbDstEntries ? nbSrcEntries : nbDstEntries; + for(int i=0; i < (maxNb + addVTablePtrShiftIteration); i++) + { + + if (i < nbSrcEntries) + { + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t%d\t%d\t%s", buffer + srcOffsetCheck, + static_cast(buffer[srcOffsetCheck]), srcOffsetCheck, srcEntries[i].entry.mOffset, srcEntries[i].entry.mName); + for (int byteCount = 1; byteCount < srcEntries[i].entry.mSize; ++byteCount) + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t%d\t%d\t.", buffer + srcOffsetCheck + byteCount, + static_cast(buffer[srcOffsetCheck + byteCount]), srcOffsetCheck + byteCount, srcEntries[i].entry.mOffset + byteCount); + } + + bool handlePadding = true; + bool skipLoop = false; + while(handlePadding) + { + const int pad0 = i0) + { + displayMessage(PxErrorCode::eDEBUG_WARNING, + "PxBinaryConverter warning: Bytes after %s::%s don't look like padding bytes. Likely mismatch between binary data and metadata.\n", + mc->mClassName, srcEntries[i-1].entry.mName ); + } + else + displayMessage(PxErrorCode::eDEBUG_WARNING, + "PxBinaryConverter warning: Bytes after %s don't look like padding bytes. Likely mismatch between binary data and metadata.\n", + mc->mClassName); + + } +#endif + if(pad1) + { + // Both have padding + // ### check sizes, output bytes + if(srcEntries[i].entry.mSize==dstEntries[j].entry.mSize) + { + // I guess we can just go on with the normal code here + handlePadding = false; + } + else + { + // Output padding + assert(srcEntries[i].cb); + assert(srcEntries[i].offset == srcOffsetCheck); + + const int padSize = dstEntries[j].entry.mSize; + char* paddingBytes = reinterpret_cast(PX_ALLOC(sizeof(char)*padSize, "paddingByte")); + memset(paddingBytes, 0, size_t(padSize)); + assert(dstEntries[j].cb); + (this->*dstEntries[j].cb)(paddingBytes, dstEntries[j].entry, dstEntries[j].entry); + assert(dstOffsetCheck==dstEntries[j].offset); + dstOffsetCheck += padSize; + PX_FREE(paddingBytes); + + // srcEntries[i].cb(buffer+srcOffsetCheck, srcEntries[i].entry, dstEntries[j].entry); + // assert(dstOffsetCheck==dstEntries[j].offset); + // dstOffsetCheck += dstEntries[j].entry.mSize; + srcOffsetCheck += srcEntries[i].entry.mSize; + + // Skip dest padding field + j++; + + // continue; // ### BUG, doesn't go back to the "for" + skipLoop = true; + handlePadding = false; + } + } + else + { + // Src has padding, dst has not => skip conversion + // Don't increase j + skipLoop = true; + handlePadding = false; + srcOffsetCheck += srcEntries[i].entry.mSize; + } + } + else + { + if(pad1) + { + // Dst has padding, src has not + + // Output padding + const int padSize = dstEntries[j].entry.mSize; + char* paddingBytes = reinterpret_cast(PX_ALLOC(sizeof(char)*padSize, "paddingByte")); + memset(paddingBytes, 0, size_t(padSize)); + assert(dstEntries[j].cb); + (this->*dstEntries[j].cb)(paddingBytes, dstEntries[j].entry, dstEntries[j].entry); + assert(dstOffsetCheck==dstEntries[j].offset); + dstOffsetCheck += padSize; + PX_FREE(paddingBytes); + + // Skip dest padding field, keep same src field + j++; + } + else + { + assert(0); + } + } + } + else handlePadding = false; + } + + if(skipLoop) + continue; + + int modSrcOffsetCheck = srcOffsetCheck; + const ExtraDataEntry2* srcEntryPtr = &srcEntries[i]; + const ExtraDataEntry2* dstEntryPtr = &dstEntries[j]; + + bool isSrcVTablePtr = (i < nbSrcEntries) ? srcEntryPtr->entry.isVTablePtr() : false; + if (isSrcVTablePtr && (dstOpenVTablePtrEntry != -1)) + { + // vtable ptr position mismatch: + // this check is necessary to align src and dst index again when the + // dst vtable pointer has been written already and the src vtable ptr + // element is reached. + // + // i + // src: | a | b | vt-ptr | c | ... + // dst: | vt-ptr | a | b | c | ... + // j + // + // it needs special treatment because the following case fails otherwise + // i + // src: | a | b | vt-ptr | c | vt-ptr | ... + // dst: | vt-ptr | a | b | vt-ptr | c | ... + // j + + // + // This entry has been written already -> advance to next src entry + // + srcOffsetCheck += srcEntryPtr->entry.mSize; + i++; + isSrcVTablePtr = (i < nbSrcEntries) ? srcEntryPtr->entry.isVTablePtr() : false; + PX_ASSERT(dstOpenVTablePtrEntry < nbDstEntries); + PX_ASSERT(dstEntries[dstOpenVTablePtrEntry].entry.isVTablePtr()); + dstOpenVTablePtrEntry = -1; + PX_ASSERT(addVTablePtrShiftIteration == 0); + } + bool isDstVTablePtr = (j < nbDstEntries) ? dstEntryPtr->entry.isVTablePtr() : false; + if (isDstVTablePtr && (srcOpenVTablePtrEntry != -1)) + { + // i + // src: | vt-ptr | a | b | c | ... + // dst: | a | b | vt-ptr | c | ... + // j + + i--; // next iteration the current element should get processed + isSrcVTablePtr = true; + PX_ASSERT(srcOpenVTablePtrEntry < nbSrcEntries); + srcEntryPtr = &srcEntries[srcOpenVTablePtrEntry]; + PX_ASSERT(srcEntryPtr->entry.isVTablePtr()); + modSrcOffsetCheck = srcEntryPtr->offset; + srcOffsetCheck -= srcEntryPtr->entry.mSize; // to make sure total change is 0 after this iteration + srcOpenVTablePtrEntry = -1; + PX_ASSERT(addVTablePtrShiftIteration == 1); + addVTablePtrShiftIteration = 0; + } + + if(i==nbSrcEntries && j==nbDstEntries) + { + PX_ASSERT((srcOpenVTablePtrEntry == -1) && (dstOpenVTablePtrEntry == -1)); + break; + } + + if (isSrcVTablePtr || isDstVTablePtr) + { + if (!isSrcVTablePtr) + { + // i + // src: | a | b | vt-ptr | c | ... + // dst: | vt-ptr | a | b | c | ... + // j + + PX_ASSERT(dstOpenVTablePtrEntry == -1); // the other case should be detected and treated earlier + PX_ASSERT(srcOpenVTablePtrEntry == -1); + PX_ASSERT(addVTablePtrShiftIteration == 0); + + int k; + for(k=i+1; k < nbSrcEntries; k++) + { + if (srcEntries[k].entry.isVTablePtr()) + break; + } + PX_ASSERT(k < nbSrcEntries); + + srcEntryPtr = &srcEntries[k]; + modSrcOffsetCheck = srcEntryPtr->offset; + srcOffsetCheck -= srcEntryPtr->entry.mSize; // to make sure total change is 0 after this iteration + + dstOpenVTablePtrEntry = j; + i--; // to make sure the original entry gets processed in the next iteration + } + else if (!isDstVTablePtr) + { + // i ---> i + // src: | vt-ptr | a | b | c | ... + // dst: | a | b | vt-ptr | c | ... + // j + + PX_ASSERT(srcOpenVTablePtrEntry == -1); // the other case should be detected and treated earlier + PX_ASSERT(dstOpenVTablePtrEntry == -1); + PX_ASSERT(addVTablePtrShiftIteration == 0); + + srcOffsetCheck += srcEntryPtr->entry.mSize; + modSrcOffsetCheck = srcOffsetCheck; + srcOpenVTablePtrEntry = i; + i++; + srcEntryPtr = &srcEntries[i]; + + addVTablePtrShiftIteration = 1; // additional iteration might be needed to process vtable pointer at the end of a class + + PX_ASSERT((i < nbSrcEntries) && ((srcEntryPtr->entry.mFlags & PxMetaDataFlag::ePADDING) == 0)); + // if the second check fails, this whole section might have to be done before the padding bytes get processed. Not sure + // what other consequences that might have though. + } + } +#if PX_CHECKED + else + { + if(!compareEntries(*srcEntryPtr, *dstEntryPtr)) + { + displayMessage(PxErrorCode::eINVALID_PARAMETER, "\rConvX::convertClass: %s, src meta data and dst meta data don't match!", mc->mClassName); + return false; + } + } +#endif + + const ExtraDataEntry2& srcEntry = *srcEntryPtr; + const ExtraDataEntry2& dstEntry = *dstEntryPtr; + + if(srcEntry.entry.mFlags & PxMetaDataFlag::eUNION) + { + // ### hardcoded bit here, will only work when union type is the first int of the struct + const int* tmp = reinterpret_cast(buffer + modSrcOffsetCheck); + const int unionType = *tmp; + + const char* typeName = getTypeName(srcEntry.entry.mType, unionType); + assert(typeName); + + MetaClass* unionMC = getMetaClass(typeName, META_DATA_SRC); + assert(unionMC); + + convertClass(buffer + modSrcOffsetCheck, unionMC, 0); // ### recurse + + dstOffsetCheck += dstEntry.entry.mSize; + + MetaClass* targetUnionMC = getMetaClass(typeName, META_DATA_DST); + assert(targetUnionMC); + + const int delta = dstEntry.entry.mSize - targetUnionMC->mSize; + char* deltaBytes = reinterpret_cast(PX_ALLOC(sizeof(char)*delta, "deltaBytes")); + memset(deltaBytes, 0, size_t(delta)); + output(deltaBytes, delta); // Skip unused bytes at the end of the union + PX_FREE(deltaBytes); + srcOffsetCheck += srcEntry.entry.mSize; // do not use modSrcOffsetCheck here! + } + else + { + assert(srcEntry.cb); + assert(srcEntry.offset == modSrcOffsetCheck); + + // ---- big convex surgery ---- + if(convexSurgery) + { + if(Pxstrcmp(srcEntry.entry.mName, "mNbHullVertices")==0) + { + assert(srcEntry.entry.mSize==1); + const PxU8 nbVerts = static_cast(*(buffer+modSrcOffsetCheck)); + assert(!foundNbVerts); + foundNbVerts = true; + + const PxU8 gaussMapLimit = static_cast(getBinaryMetaData(META_DATA_DST)->getGaussMapLimit()); + if(nbVerts > gaussMapLimit) + { + // We need a gauss map and we have one => keep it + } + else + { + // We don't need a gauss map and we have one => remove it + removeBigData = true; + } + } + else + { + if(removeBigData) + { + const bool isBigConvexData = Pxstrcmp(srcEntry.entry.mType, "BigConvexData")==0 || + Pxstrcmp(srcEntry.entry.mType, "BigConvexRawData")==0; + if(isBigConvexData) + { + assert(foundNbVerts); + setNullPtr(true); + } + } + } + } + // ---- big convex surgery ---- + + (this->*srcEntry.cb)(buffer+modSrcOffsetCheck, srcEntry.entry, dstEntry.entry); + assert(dstOffsetCheck==dstEntry.offset); + dstOffsetCheck += dstEntry.entry.mSize; + srcOffsetCheck += srcEntry.entry.mSize; // do not use modSrcOffsetCheck here! + + // ---- big convex surgery ---- + if(convexSurgery && removeBigData) + setNullPtr(false); + // ---- big convex surgery ---- + } + + j++; + } + + displayMessage(PxErrorCode::eDEBUG_INFO, "---------------------------------------------\n"); + + while(jmSize); + assert(srcOffsetCheck==mc->mSize); + + // ---- big convex surgery ---- + if(convexSurgery) + mConvexFlags.pushBack(removeBigData); + // ---- big convex surgery ---- + + return true; +} + +// Handles data defined with PX_DEF_BIN_METADATA_EXTRA_ARRAY +const char* Sn::ConvX::convertExtraData_Array(const char* Address, const char* lastAddress, const char* objectAddress, + const ExtraDataEntry& ed) +{ + (void)lastAddress; + MetaClass* mc = getMetaClass(ed.entry.mType, META_DATA_SRC); + assert(mc); + + // PT: safe to cast to int here since we're reading a count. + const int count = int(peek(ed.entry.mSize, objectAddress + ed.offset, ed.entry.mFlags)); + + // if(ed.entry.mCount) // Reused as align value + if(ed.entry.mAlignment) + { + Address = alignStream(Address, ed.entry.mAlignment); + // Address = alignStream(Address, ed.entry.mCount); + assert(Address<=lastAddress); + } + + for(int c=0;cmSize; + assert(Address<=lastAddress); + } + return Address; +} + +const char* Sn::ConvX::convertExtraData_Ptr(const char* Address, const char* lastAddress, const PxMetaDataEntry& entry, int count, + int ptrSize_Src, int ptrSize_Dst) +{ + (void)lastAddress; + + PxMetaDataEntry tmpSrc = entry; + tmpSrc.mCount = count; + tmpSrc.mSize = count * ptrSize_Src; + + PxMetaDataEntry tmpDst = entry; + tmpDst.mCount = count; + tmpDst.mSize = count * ptrSize_Dst; + + + displayMessage(PxErrorCode::eDEBUG_INFO, "extra data ptrs\n"); + displayMessage(PxErrorCode::eDEBUG_INFO, "+++++++++++++++++++++++++++++++++++++++++++++\n"); + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t\t\t%s", Address, static_cast(Address[0]), entry.mName); + for (int byteCount = 1; byteCount < ptrSize_Src*count; ++byteCount) + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t\t\t.", Address + byteCount, static_cast(Address[byteCount])); + + convertPtr(Address, tmpSrc, tmpDst); + Address += count * ptrSize_Src; + assert(Address<=lastAddress); + return Address; +} + +const char* Sn::ConvX::convertExtraData_Handle(const char* Address, const char* lastAddress, const PxMetaDataEntry& entry, int count) +{ + (void)lastAddress; + + MetaClass* fieldType = getMetaClass(entry.mType, META_DATA_SRC); + int typeSize = fieldType->mSize; + + PxMetaDataEntry tmpSrc = entry; + tmpSrc.mCount = count; + tmpSrc.mSize = count*typeSize; + + PxMetaDataEntry tmpDst = entry; + tmpDst.mCount = count; + tmpDst.mSize = count*typeSize; + + displayMessage(PxErrorCode::eDEBUG_INFO, "extra data handles\n"); + displayMessage(PxErrorCode::eDEBUG_INFO, "+++++++++++++++++++++++++++++++++++++++++++++\n"); + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t\t\t%s", Address, static_cast(Address[0]), entry.mName); + for (int byteCount = 1; byteCount < tmpSrc.mSize; ++byteCount) + displayMessage(PxErrorCode::eDEBUG_INFO, "\t0x%p\t%02x\t\t\t.", Address + byteCount, static_cast(Address[byteCount])); + + convertHandle16(Address, tmpSrc, tmpDst); + Address += count*typeSize; + assert(Address<=lastAddress); + return Address; +} + +static bool decodeControl(PxU64 control, const ExtraDataEntry& ed, PxU64 controlMask = 0) +{ + if(ed.entry.mFlags & PxMetaDataFlag::eCONTROL_FLIP) + { + if(controlMask) + { + return (control & controlMask) ? false : true; + } + else + { + return control==0; + } + } + else + { + if(controlMask) + { + return (control & controlMask) ? true : false; + } + else + { + return control!=0; + } + } + +} + +// ### currently hardcoded, should change +int Sn::ConvX::getConcreteType(const char* buffer) +{ + MetaClass* mc = getMetaClass("PxBase", META_DATA_SRC); + assert(mc); + PxMetaDataEntry entry; + if(mc->getFieldByType("PxType", entry)) + { + // PT: safe to cast to int here since we're reading our own PxType + return int(peek(entry.mSize, buffer + entry.mOffset)); + } + assert(0); + return 0xffffffff; +} + +struct Item : public PxUserAllocated +{ + MetaClass* mc; + const char* address; +}; + +bool Sn::ConvX::convertCollection(const void* buffer, int fileSize, int nbObjects) +{ + const char* lastAddress = reinterpret_cast(buffer) + fileSize; + const char* Address = alignStream(reinterpret_cast(buffer)); + + const int ptrSize_Src = mSrcPtrSize; + const int ptrSize_Dst = mDstPtrSize; + Item* objects = PX_NEW(Item)[PxU32(nbObjects)]; + + for(PxU32 i=0;imSize; + assert(Address<=lastAddress); + } + + // Fields / extra data + if(1) + { + // ---- big convex surgery ---- + unsigned int nbConvexes = 0; + // ---- big convex surgery ---- + //const char* StartAddress2 = Address; + //int startDstSize2 = getCurrentOutputSize(); + for(int i=0;imClassName); + // if(strcmp(mc->mClassName, "TriangleMesh")==0) + // if(strcmp(mc->mClassName, "NpRigidDynamic")==0) + if(Pxstrcmp(mc0->mClassName, "HybridModel")==0) + { + int stop=1; + (void)(stop); + } + + // ### we actually need to collect all extra data for this class, including data from embedded members. + + PX_ALLOCA(entries, ExtraDataEntry, 256); + int nbEntries = 0; + _enumerateExtraData(objectAddress, mc0, entries, nbEntries, 0, META_DATA_SRC); + assert(nbEntries<256); + + Address = alignStream(Address); + assert(Address<=lastAddress); + + for(int j=0;jmSize; + assert(Address<=lastAddress); + + // Enumerate extra data for this optional class, and convert it too. + // This assumes the extra data for the optional class is always appended to the class itself, + // which is something we'll need to enforce in the SDK. So far this is only to handle optional + // inline arrays. + + // ### this should probably be recursive eventually + PX_ALLOCA(entries2, ExtraDataEntry, 256); + int nbEntries2 = 0; + _enumerateExtraData(objectAddress, extraDataType, entries2, nbEntries2, 0, META_DATA_SRC); + assert(nbEntries2<256); + for(int k=0;k> 16; + } + + if(decodeControl(controlValue2, ed2, controlMask)) + { + // PT: safe to cast to int here since we're reading a count + int count = int(peek(countSize, classAddress + countOffset, ed2.entry.mFlags)); + + if(ed2.entry.mAlignment) + { + assert(0); // Never tested + Address = alignStream(Address, ed2.entry.mAlignment); + assert(Address<=lastAddress); + } + + if(ed2.entry.mFlags & PxMetaDataFlag::ePTR) + { + assert(0); // Never tested + } + else + { + MetaClass* mc = getMetaClass(ed2.entry.mType, META_DATA_SRC); + assert(mc); + + while(count--) + { + convertClass(Address, mc, 0); + Address += mc->mSize; + assert(Address<=lastAddress); + } + } + + } + } + else + { + if( (ed2.entry.mFlags & PxMetaDataFlag::eALIGNMENT) && ed2.entry.mAlignment) + { + Address = alignStream(Address, ed2.entry.mAlignment); + assert(Address<=lastAddress); + } + else + { + // We assume it's an normal array, e.g. the ones from "big convexes" + assert(!(ed2.entry.mFlags & PxMetaDataFlag::eEXTRA_ITEM)); + + Address = convertExtraData_Array(Address, lastAddress, classAddress, ed2); + } + } + } + + } + else + { + int stop = 0; + (void)(stop); + } + + // ---- big convex surgery ---- + setNoOutput(false); + // ---- big convex surgery ---- + } + else if(ed.entry.mFlags & PxMetaDataFlag::eEXTRA_ITEMS) + { + // PX_DEF_BIN_METADATA_EXTRA_ITEMS + int reloc = ed.offset - ed.entry.mOffset; // ### because the enum code only fixed the "controlOffset"! + const int controlOffset = ed.entry.mOffset; + const int controlSize = ed.entry.mSize; + const int countOffset = ed.entry.mCount; + const int countSize = ed.entry.mOffsetSize; + + // const int controlValue2 = peek(controlSize, objectAddress + controlOffset); + const PxU64 controlValue2 = peek(controlSize, objectAddress + controlOffset + reloc); + + PxU64 controlMask = 0; + if(ed.entry.mFlags & PxMetaDataFlag::eCONTROL_MASK) + { + controlMask = PxU64(ed.entry.mFlags & (PxMetaDataFlag::eCONTROL_MASK_RANGE << 16)); + controlMask = controlMask >> 16; + } + + if(decodeControl(controlValue2, ed, controlMask)) + { + // PT: safe to cast to int here since we're reading a count + // int count = peek(countSize, objectAddress + countOffset); // ### + int count = int(peek(countSize, objectAddress + countOffset + reloc, ed.entry.mFlags)); // ### + + if(ed.entry.mAlignment) + { + Address = alignStream(Address, ed.entry.mAlignment); + assert(Address<=lastAddress); + } + + if(ed.entry.mFlags & PxMetaDataFlag::ePTR) + { + Address = convertExtraData_Ptr(Address, lastAddress, ed.entry, count, ptrSize_Src, ptrSize_Dst); + } + else if (ed.entry.mFlags & PxMetaDataFlag::eHANDLE) + { + Address = convertExtraData_Handle(Address, lastAddress, ed.entry, count); + } + else + { + MetaClass* mc = getMetaClass(ed.entry.mType, META_DATA_SRC); + assert(mc); + + while(count--) + { + convertClass(Address, mc, 0); + Address += mc->mSize; + assert(Address<=lastAddress); + } + } + } + + } + else if(ed.entry.mFlags & PxMetaDataFlag::eALIGNMENT) + { + if(ed.entry.mAlignment) + { + displayMessage(PxErrorCode::eDEBUG_INFO, " align to %d bytes\n", ed.entry.mAlignment); + displayMessage(PxErrorCode::eDEBUG_INFO, "---------------------------------------------\n"); + + Address = alignStream(Address, ed.entry.mAlignment); + assert(Address<=lastAddress); + } + } + else if(ed.entry.mFlags & PxMetaDataFlag::eEXTRA_NAME) + { + if(ed.entry.mAlignment) + { + Address = alignStream(Address, ed.entry.mAlignment); + assert(Address<=lastAddress); + } + + //get string count + MetaClass* mc = getMetaClass("PxU32", META_DATA_SRC); + assert(mc); + //safe to cast to int here since we're reading a count. + const int count = int(peek(mc->mSize, Address, 0)); + + displayMessage(PxErrorCode::eDEBUG_INFO, " convert %d bytes string\n", count); + + convertClass(Address, mc, 0); + Address += mc->mSize; + + mc = getMetaClass(ed.entry.mType, META_DATA_SRC); + assert(mc); + + for(int c=0;cmSize; + assert(Address<=lastAddress); + } + } + else + { + Address = convertExtraData_Array(Address, lastAddress, objectAddress, ed); + } + } + } + PX_DELETE_ARRAY(objects); + assert(nbConvexes==mConvexFlags.size()); + } + + assert(Address==lastAddress); + + return true; +} + +bool Sn::ConvX::convert(const void* buffer, int fileSize) +{ + // Test initial alignment + if(size_t(buffer) & (ALIGN_DEFAULT-1)) + { + assert(0); + return false; + } + + const int header = read32(buffer); fileSize -= 4; (void)header; + + if (header != PX_MAKE_FOURCC('S','E','B','D')) + { + displayMessage(physx::PxErrorCode::eINVALID_PARAMETER, + "PxBinaryConverter: Buffer contains data with bad header indicating invalid serialized data."); + return false; + } + + const int version = read32(buffer); fileSize -= 4; (void)version; + + char binaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS + 1]; + memcpy(binaryVersionGuid, buffer, SN_BINARY_VERSION_GUID_NUM_CHARS); + binaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS] = 0; + buffer = reinterpret_cast(size_t(buffer) + SN_BINARY_VERSION_GUID_NUM_CHARS); + fileSize -= SN_BINARY_VERSION_GUID_NUM_CHARS; + output(binaryVersionGuid, SN_BINARY_VERSION_GUID_NUM_CHARS); + + if (!checkCompatibility(binaryVersionGuid)) + { + displayMessage(physx::PxErrorCode::eINVALID_PARAMETER, + "PxBinaryConverter: Buffer contains binary data version 0x%s which is incompatible with this PhysX sdk (0x%s).\n", + binaryVersionGuid, getBinaryVersionGuid()); + return false; + } + + //read src platform tag and write dst platform tag according dst meta data + const int srcPlatformTag = *reinterpret_cast(buffer); + buffer = reinterpret_cast(size_t(buffer) + 4); + fileSize -= 4; + const int dstPlatformTag = mMetaData_Dst->getPlatformTag(); + output(dstPlatformTag); + + if (srcPlatformTag != mMetaData_Src->getPlatformTag()) + { + displayMessage(physx::PxErrorCode::eINVALID_PARAMETER, + "PxBinaryConverter: Mismatch of platform tags of binary data and metadata:\n Binary Data: %s\n MetaData: %s\n", + getBinaryPlatformName(PxU32(srcPlatformTag)), + getBinaryPlatformName(PxU32(mMetaData_Src->getPlatformTag()))); + return false; + } + + //read whether input data has marked padding, and set it for the output data (since 0xcd is written into pads on conversion) + const int srcMarkedPadding = *reinterpret_cast(buffer); + buffer = reinterpret_cast(size_t(buffer) + 4); + fileSize -= 4; + mMarkedPadding = srcMarkedPadding != 0; + const int dstMarkedPadding = 1; + output(dstMarkedPadding); + + int nbObjectsInCollection; + + buffer = convertReferenceTables(buffer, fileSize, nbObjectsInCollection); + if(!buffer) + return false; + + bool ret = convertCollection(buffer, fileSize, nbObjectsInCollection); + mMarkedPadding = false; + return ret; +} + +// PT: code below added to support 64bit-to-32bit conversions +void Sn::ConvX::exportIntAsPtr(int value) +{ + const int ptrSize_Src = mSrcPtrSize; + const int ptrSize_Dst = mDstPtrSize; + + PxMetaDataEntry entry; + + const char* address = NULL; + const PxU32 value32 = PxU32(value); + const PxU64 value64 = PxU64(value)&0xffffffff; + + if(ptrSize_Src==4) + { + address = reinterpret_cast(&value32); + } + else if(ptrSize_Src==8) + { + address = reinterpret_cast(&value64); + } + else assert(0); + + convertExtraData_Ptr(address, address + ptrSize_Src, entry, 1, ptrSize_Src, ptrSize_Dst); +} + +void Sn::ConvX::exportInt(int value) +{ + output(value); +} + +void Sn::ConvX::exportInt64(PxU64 value) +{ + output(value); +} + +PointerRemap::PointerRemap() +{ +} + +PointerRemap::~PointerRemap() +{ +} + +void PointerRemap::setObjectRef(PxU64 object64, PxU32 ref) +{ + mData[object64] = ref; +} + +bool PointerRemap::getObjectRef(PxU64 object64, PxU32& ref) const +{ + const PointerMap::Entry* entry = mData.find(object64); + if(entry) + { + ref = entry->second; + return true; + } + return false; +} + +Handle16Remap::Handle16Remap() +{ +} + +Handle16Remap::~Handle16Remap() +{ +} + +void Handle16Remap::setObjectRef(PxU16 object, PxU16 ref) +{ + mData[object] = ref; +} + +bool Handle16Remap::getObjectRef(PxU16 object, PxU16& ref) const +{ + const Handle16Map::Entry* entry = mData.find(object); + if(entry) + { + ref = entry->second; + return true; + } + return false; +} + +/** +Converting the PxBase object offsets in the manifest table is fairly complicated now. +It would be good to have an easy callback mechanism for custom things like this. +*/ +const void* Sn::ConvX::convertManifestTable(const void* buffer, int& fileSize) +{ + PxU32 padding = getPadding(size_t(buffer), ALIGN_DEFAULT); + buffer = alignStream(reinterpret_cast(buffer)); + fileSize -= padding; + int nb = read32(buffer); + fileSize -= 4; + + MetaClass* mc_src = getMetaClass("Sn::ManifestEntry", META_DATA_SRC); + assert(mc_src); + + MetaClass* mc_dst = getMetaClass("Sn::ManifestEntry", META_DATA_DST); + assert(mc_dst); + + bool mdOk; + PxMetaDataEntry srcTypeField; + mdOk = mc_src->getFieldByName("type", srcTypeField); + PX_UNUSED(mdOk); + PX_ASSERT(mdOk); + + PxMetaDataEntry dstOffsetField; + mdOk = mc_dst->getFieldByName("offset", dstOffsetField); + PX_ASSERT(mdOk); + + const char* address = reinterpret_cast(buffer); + PxU32 headerOffset = 0; + for(int i=0;imSize)); + + //restore output state + mOutStream = outStream; + mOutputSize = int(outputSize); + } + + //output patched offset + PX_ASSERT(dstOffsetField.mOffset == 0); //assuming offset is the first data + output(int(headerOffset)); + + //output rest of ManifestEntry + PxU32 restSize = PxU32(mc_dst->mSize - dstOffsetField.mSize); + mOutStream->write(tmpStream.getData() + dstOffsetField.mSize, restSize); + mOutputSize += restSize; + + //increment source stream + address += mc_src->mSize; + fileSize -= mc_src->mSize; + assert(fileSize>=0); + + //update headerOffset using the type and dst meta data of the type + MetaClass* mc_classType_dst = getMetaClass(classType, META_DATA_DST); + if(!mc_classType_dst) + return NULL; + headerOffset += getPadding(size_t(mc_classType_dst->mSize), PX_SERIAL_ALIGN) + mc_classType_dst->mSize; + } + + output(int(headerOffset)); //endoffset + buffer = address + 4; + fileSize -= 4; + return buffer; +} + +const void* Sn::ConvX::convertImportReferences(const void* buffer, int& fileSize) +{ + PxU32 padding = getPadding(size_t(buffer), ALIGN_DEFAULT); + buffer = alignStream(reinterpret_cast(buffer)); + fileSize -= padding; + int nb = read32(buffer); + fileSize -= 4; + + if(!nb) + return buffer; + + MetaClass* mc = getMetaClass("Sn::ImportReference", META_DATA_SRC); + assert(mc); + + const char* address = reinterpret_cast(buffer); + for(int i=0;imSize; + fileSize -= mc->mSize; + assert(fileSize>=0); + } + return address; +} + +const void* Sn::ConvX::convertExportReferences(const void* buffer, int& fileSize) +{ + PxU32 padding = getPadding(size_t(buffer), ALIGN_DEFAULT); + buffer = alignStream(reinterpret_cast(buffer)); + fileSize -= padding; + int nb = read32(buffer); + fileSize -= 4; + + if(!nb) + return buffer; + + MetaClass* mc = getMetaClass("Sn::ExportReference", META_DATA_SRC); + assert(mc); + + const char* address = reinterpret_cast(buffer); + for(int i=0;imSize; + fileSize -= mc->mSize; + assert(fileSize>=0); + } + return address; +} + +const void* Sn::ConvX::convertInternalReferences(const void* buffer, int& fileSize) +{ + PxU32 padding = getPadding(size_t(buffer), ALIGN_DEFAULT); + buffer = alignStream(reinterpret_cast(buffer)); + fileSize -= padding; + + //pointer references + int nbPtrReferences = read32(buffer); + fileSize -= 4; + if(nbPtrReferences) + { + const char* address = reinterpret_cast(buffer); + MetaClass* mc = getMetaClass("Sn::InternalReferencePtr", META_DATA_SRC); + assert(mc); + for(int i=0;imSize; + fileSize -= mc->mSize; + assert(fileSize>=0); + } + buffer = address; + } + + //16 bit handle references + int nbHandle16References = read32(buffer); + fileSize -= 4; + if (nbHandle16References) + { + //pre add invalid handle value + mHandle16Remap.setObjectRef(0xffff, 0xffff); + const char* address = reinterpret_cast(buffer); + MetaClass* mc = getMetaClass("Sn::InternalReferenceHandle16", META_DATA_SRC); + assert(mc); + for(int i=0;imSize; + fileSize -= mc->mSize; + assert(fileSize>=0); + } + buffer = address; + } + + return buffer; +} + + +const void* Sn::ConvX::convertReferenceTables(const void* buffer, int& fileSize, int& nbObjectsInCollection) +{ + // PT: the map should not be used while creating it, so use one indirection + mPointerActiveRemap = NULL; + mPointerRemap.mData.clear(); + mPointerRemapCounter = 0; + + mHandle16ActiveRemap = NULL; + mHandle16Remap.mData.clear(); + mHandle16RemapCounter = 0; + + PxU32 padding = getPadding(size_t(buffer), ALIGN_DEFAULT); + buffer = alignStream(reinterpret_cast(buffer)); + fileSize -= padding; + + nbObjectsInCollection = read32(buffer); + if (nbObjectsInCollection == 0) + displayMessage(PxErrorCode::eDEBUG_INFO, "\n\nConverting empty collection!\n\n"); + fileSize -= 4; + + buffer = convertManifestTable(buffer, fileSize); + + if(!buffer) + return NULL; + + buffer = convertImportReferences(buffer, fileSize); + buffer = convertExportReferences(buffer, fileSize); + buffer = convertInternalReferences(buffer, fileSize); + + // PT: the map can now be used + mPointerActiveRemap = &mPointerRemap; + mHandle16ActiveRemap = &mHandle16Remap; + + return buffer; +} + +bool Sn::ConvX::checkPaddingBytes(const char* buffer, int byteCount) +{ + const unsigned char* src = reinterpret_cast(buffer); + + int i = 0; + while ((i < byteCount) && (src[i] == 0xcd)) + i++; + return (i == byteCount); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp new file mode 100644 index 0000000..bed82fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Error.cpp @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxErrorCallback.h" +#include "foundation/PxString.h" +#include "SnConvX.h" +#include + +#define MAX_DISPLAYED_ISSUES 10 + +using namespace physx; + +void Sn::ConvX::resetNbErrors() +{ + mNbErrors = 0; + mNbWarnings = 0; +} + +int Sn::ConvX::getNbErrors() const +{ + return mNbErrors; +} + +void Sn::ConvX::displayMessage(PxErrorCode::Enum code, const char* format, ...) +{ + if(silentMode()) + return; + + int sum = mNbWarnings + mNbErrors; + if(sum >= MAX_DISPLAYED_ISSUES) + return; + + bool display = false; + + if(code==PxErrorCode::eINTERNAL_ERROR || code==PxErrorCode::eINVALID_OPERATION || code==PxErrorCode::eINVALID_PARAMETER) + { + mNbErrors++; + display = true; + } + else if(code == PxErrorCode::eDEBUG_WARNING) + { + mNbWarnings++; + display = true; + } + + if(display || ((sum == 0) && verboseMode()) ) + { + va_list va; + va_start(va, format); + PxGetFoundation().error(code, __FILE__, __LINE__, format, va); + va_end(va); + } + + if(display) + { + if( sum == 0) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_INFO, __FILE__, __LINE__, "Hit warnings or errors: skipping further verbose output.\n"); + } + else if(sum == MAX_DISPLAYED_ISSUES-1) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_INFO, __FILE__, __LINE__, "Exceeding 10 warnings or errors: skipping further output.\n"); + } + } + + return; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp new file mode 100644 index 0000000..892f557 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.cpp @@ -0,0 +1,953 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxIO.h" +#include "foundation/PxMemory.h" +#include "foundation/PxString.h" +#include "SnConvX.h" +#include "common/PxSerialFramework.h" +#include "serialization/SnSerialUtils.h" +#include + +using namespace physx; +using namespace physx::Sn; + +//#define REMOVE_EXPLICIT_PADDING + +static const char gVTablePtr[] = "v-table ptr"; +static const char gAutoPadding[] = "auto-generated padding"; +static const char gByte[] = "paddingByte"; + +/////////////////////////////////////////////////////////////////////////////// + +bool PxMetaDataEntry::isVTablePtr() const +{ + return mType==gVTablePtr; +} + +/////////////////////////////////////////////////////////////////////////////// + +bool MetaClass::getFieldByType(const char* type, PxMetaDataEntry& entry) const +{ + assert(type); + PxU32 nbFields = mFields.size(); + for(PxU32 i=0;i(PX_ALLOC(sizeof(bool)*mSize, "bool")); + memset(map, 0, size_t(mSize)); + + const PxU32 nbFields = mFields.size(); + for(PxU32 i=0;i=0 && byteStart=0 && byteEnd<=mSize); + + int startOffset = -1; + int nbBytes = 0; + for(int j=byteStart;jmSize*current.mCount==current.mSize); + } + } + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// + +MetaData::MetaData(ConvX& convx) : + mConvX (convx), + mType (META_DATA_NONE), + mNbEntries (0), + mEntries (NULL), + mStringTable (NULL), + mVersion (0), + mSizeOfPtr (0), + mPlatformTag (0), + mGaussMapLimit (0), + mFlip (false) +{ +} + +MetaData::~MetaData() +{ + PxU32 nbMetaClasses = mMetaClasses.size(); + for(PxU32 i=0;imClassName, name)==0) + { + while(current->mMaster) + current = current->mMaster; + return current; + } + } + return NULL; +} + +MetaClass* MetaData::getMetaClass(PxConcreteType::Enum concreteType) const +{ + for(PxU32 i=0; i< mConcreteTypeTable.size(); i++) + { + if(mConcreteTypeTable[i].first == concreteType) + { + const char* className = offsetToText(reinterpret_cast(size_t(mConcreteTypeTable[i].second))); + return getMetaClass(className); + } + } + return NULL; +} + +MetaClass* MetaData::addNewClass(const char* name, int size, MetaClass* master, ConvertCallback callback) +{ + // PT: if you reach this assert, you used PX_DEF_BIN_METADATA_TYPEDEF twice on the same type + assert(!getMetaClass(name)); + MetaClass* mc = PX_NEW(MetaClass); + mc->mCallback = callback; + mc->mMaster = master; + mc->mClassName = name; + mc->mSize = size; + mc->mDepth = 0; + mc->mProcessed = false; +// mc->mNbEntries = -1; + + mMetaClasses.pushBack(mc); + + return mc; +} + +bool MetaData::load(PxInputStream& inputStream, MetaDataType type) +{ + assert(type!=META_DATA_NONE); + + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "Loading %s meta-data...\n", type==META_DATA_SRC ? "source" : "target"); + + mType = type; + + mFlip = false; + { + int header; + inputStream.read(&header, 4); + if(header==PX_MAKE_FOURCC('M','E','T','A')) + { + mFlip = false; + } + else if(header==PX_MAKE_FOURCC('A','T','E','M')) + { + mFlip = true; + } + else + { + mConvX.displayMessage(PxErrorCode::eINVALID_PARAMETER, "PxBinaryConverter: invalid meta-data file!\n"); + return false; + } + + if (type == META_DATA_SRC && mFlip) + { + mConvX.displayMessage(PxErrorCode::eINVALID_PARAMETER, + "PxBinaryConverter: source meta data needs to match endianness with current system!"); + return false; + } + + inputStream.read(&mVersion, 4); + if(mFlip) + { + flip(mVersion); + } + inputStream.read(mBinaryVersionGuid, SN_BINARY_VERSION_GUID_NUM_CHARS); + mBinaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS] = 0; + + if (!checkCompatibility(mBinaryVersionGuid)) + { + mConvX.displayMessage(PxErrorCode::eINVALID_PARAMETER, + "PxBinaryConverter: binary data version 0x%s is incompatible with this PhysX sdk (0x%s).\n", + mBinaryVersionGuid, getBinaryVersionGuid()); + + return false; + } + + inputStream.read(&mSizeOfPtr, 4); + if(mFlip) + flip(mSizeOfPtr); + + inputStream.read(&mPlatformTag, 4); + if(mFlip) + flip(mPlatformTag); + + if (!Sn::isBinaryPlatformTagValid(PxU32(mPlatformTag))) + { + mConvX.displayMessage(PxErrorCode::eINVALID_PARAMETER, "PxBinaryConverter: Unknown meta data platform tag"); + return false; + } + + inputStream.read(&mGaussMapLimit, 4); + if(mFlip) + flip(mGaussMapLimit); + + inputStream.read(&mNbEntries, 4); + if(mFlip) + flip(mNbEntries); + + mEntries = PX_NEW(PxMetaDataEntry)[PxU32(mNbEntries)]; + if(mSizeOfPtr==8) + { + for(int i=0;i(size_t(tmp.mType)); + mEntries[i].mName = reinterpret_cast(size_t(tmp.mName)); + mEntries[i].mOffset = tmp.mOffset; + mEntries[i].mSize = tmp.mSize; + mEntries[i].mCount = tmp.mCount; + mEntries[i].mOffsetSize = tmp.mOffsetSize; + mEntries[i].mFlags = tmp.mFlags; + mEntries[i].mAlignment = tmp.mAlignment; + } + } + else + { + assert(mSizeOfPtr==4); +// inputStream.read(mEntries, mNbEntries*sizeof(PxMetaDataEntry)); + for(int i=0;i(size_t(tmp.mType)); + mEntries[i].mName = reinterpret_cast(size_t(tmp.mName)); + mEntries[i].mOffset = tmp.mOffset; + mEntries[i].mSize = tmp.mSize; + mEntries[i].mCount = tmp.mCount; + mEntries[i].mOffsetSize = tmp.mOffsetSize; + mEntries[i].mFlags = tmp.mFlags; + mEntries[i].mAlignment = tmp.mAlignment; + } + } + + if(mFlip) + { + for(int i=0;i(PxConcreteType::Enum(concreteType), nameOffset) ); + } + + int tableSize; + inputStream.read(&tableSize, 4); + if(mFlip) + flip(tableSize); + + mStringTable = reinterpret_cast(PX_ALLOC(sizeof(char)*tableSize, "MetaData StringTable")); + inputStream.read(mStringTable, PxU32(tableSize)); + } + + // Register atomic types + { + addNewClass("bool", 1, NULL, &ConvX::convert8); + addNewClass("char", 1, NULL, &ConvX::convert8); + addNewClass("short", 2, NULL, &ConvX::convert16); + addNewClass("int", 4, NULL, &ConvX::convert32); + addNewClass("PxU64", 8, NULL, &ConvX::convert64); + addNewClass("float", 4, NULL, &ConvX::convertFloat); + + addNewClass("paddingByte", 1, NULL, &ConvX::convertPad8); + } + + { + MetaClass* currentClass = NULL; + for(int i=0;i %s\n", mEntries[i].mName, mEntries[i].mType); + MetaClass* mc = getMetaClass(mEntries[i].mName); + if(mc) + addNewClass(mEntries[i].mType, mc->mSize, mc, mc->mCallback); + else + mConvX.displayMessage(PxErrorCode::eINTERNAL_ERROR, + "PxBinaryConverter: Invalid typedef - Missing metadata for: %s, please check the source metadata.\n" + , mEntries[i].mName); + } + else if(mEntries[i].mFlags & PxMetaDataFlag::eCLASS) + { + if(!mEntries[i].mName) + { + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "Found class: %s\n", mEntries[i].mType); + currentClass = addNewClass(mEntries[i].mType, mEntries[i].mSize); + + if(mEntries[i].mFlags & PxMetaDataFlag::eVIRTUAL) + { + PxMetaDataEntry vtable; + vtable.mType = gVTablePtr; + vtable.mName = gVTablePtr; + vtable.mOffset = 0; + vtable.mSize = mSizeOfPtr; + vtable.mCount = 1; + vtable.mFlags = PxMetaDataFlag::ePTR; + currentClass->mFields.pushBack(vtable); + } + } + else + { + assert(currentClass); + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, " - inherits from: %s\n", mEntries[i].mName); + currentClass->mBaseClasses.pushBack(mEntries[i]); + } + } + else + { + const int isUnion = mEntries[i].mFlags & PxMetaDataFlag::eUNION; + + if(isUnion && !mEntries[i].mSize) + { + mConvX.registerUnionType(mEntries[i].mType, mEntries[i].mName, mEntries[i].mOffset); + } + else + { + if(isUnion) + { + mConvX.registerUnion(mEntries[i].mType); + } + + const int isPadding = mEntries[i].mFlags & PxMetaDataFlag::ePADDING; + + assert(currentClass); +#ifdef REMOVE_EXPLICIT_PADDING + if(!isPadding) +#endif + currentClass->mFields.pushBack(mEntries[i]); + + if(isPadding) + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, + " - contains padding: %s - %s\n", mEntries[i].mType, mEntries[i].mName); + else if(mEntries[i].mFlags & PxMetaDataFlag::eEXTRA_DATA) + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, + " - contains extra data: %s%s\n", mEntries[i].mType, mEntries[i].mFlags & PxMetaDataFlag::ePTR ? "*" : ""); + else + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, + " - contains field: %s%s\n", mEntries[i].mType, mEntries[i].mFlags & PxMetaDataFlag::ePTR ? "*" : ""); + + } + } + } + } + + // Sort classes by depth + struct Local + { + static bool _computeDepth(const MetaData& md, MetaClass* current, int currentDepth, int& maxDepth) + { + if(currentDepth>maxDepth) + maxDepth = currentDepth; + + PxU32 nbBases = current->mBaseClasses.size(); + for(PxU32 i=0;imBaseClasses[i]; + MetaClass* baseClass = md.getMetaClass(baseClassEntry.mName); + if(!baseClass) + { + md.mConvX.displayMessage(PxErrorCode::eINTERNAL_ERROR, + "PxBinaryConverter: Can't find class %s metadata, please check the source metadata.\n", baseClassEntry.mName); + return false; + } + if (!_computeDepth(md, baseClass, currentDepth+1, maxDepth)) + return false; + } + return true; + } + + static int compareClasses(const void* c0, const void* c1) + { + MetaClass** mc0 = reinterpret_cast(const_cast(c0)); + MetaClass** mc1 = reinterpret_cast(const_cast(c1)); +// return (*mc0)->mSize - (*mc1)->mSize; + return (*mc0)->mDepth - (*mc1)->mDepth; + } + + static int compareEntries(const void* c0, const void* c1) + { + PxMetaDataEntry* mc0 = reinterpret_cast(const_cast(c0)); + PxMetaDataEntry* mc1 = reinterpret_cast(const_cast(c1)); + //mOffset is used to access control information for extra data, and not for offsets of the data itself. + assert(!(mc0->mFlags & PxMetaDataFlag::eEXTRA_DATA)); + assert(!(mc1->mFlags & PxMetaDataFlag::eEXTRA_DATA)); + return mc0->mOffset - mc1->mOffset; + } + }; + { + // Compute depths + const PxU32 nbMetaClasses = mMetaClasses.size(); + for(PxU32 i=0;imDepth = maxDepth; + } + + // Sort by depth + MetaClass** metaClasses = &mMetaClasses[0]; + qsort(metaClasses, size_t(nbMetaClasses), sizeof(MetaClass*), Local::compareClasses); + } + + // Replicate fields from base classes + { + PxU32 nbMetaClasses = mMetaClasses.size(); + for(PxU32 k=0;kmBaseClasses.size(); + + // merge entries of base classes and current class in the right order + // this is needed for extra data ordering, which is not covered by the mOffset sort + // in the next stage below + PsArray mergedEntries; + + for(PxU32 i=0;imBaseClasses[i]; + MetaClass* baseClass = getMetaClass(baseClassEntry.mName); + assert(baseClass); + assert(baseClass->mBaseClasses.size()==0 || baseClass->mProcessed); + + PxU32 nbBaseFields = baseClass->mFields.size(); + for(PxU32 j=0;jmFields[j]; + // Don't merge primary v-tables to avoid redundant v-table entries. + // It means the base v-table won't be inherited & needs to be explicitly defined in the metadata. Seems reasonable. + // Could be done better though. + + if(f.mType==gVTablePtr && !f.mOffset && !baseClassEntry.mOffset) + continue; + + f.mOffset += baseClassEntry.mOffset; + mergedEntries.pushBack(f); + } + current->mProcessed = true; + } + + //append current fields to base class fields + for (PxU32 i = 0; i < current->mFields.size(); i++) + { + mergedEntries.pushBack(current->mFields[i]); + } + current->mFields.clear(); + current->mFields.assign(mergedEntries.begin(), mergedEntries.end()); + } + } + + // Check classes + { + PxU32 nbMetaClasses = mMetaClasses.size(); + for(PxU32 i=0;icheck(*this)) + return false; + } + } + + // Sort meta-data by offset + { + PxU32 nbMetaClasses = mMetaClasses.size(); + for(PxU32 i=0;imFields.size(); + if(nbFields<2) + continue; + PxMetaDataEntry* entries = ¤t->mFields[0]; + + PxMetaDataEntry* newEntries = PX_NEW(PxMetaDataEntry)[nbFields]; + PxU32 nb = 0; + for(PxU32 j=0;jmClassName); + + if (mcDst == NULL) + { + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "dst is missing meta class %s", mcSrc->mClassName); + } + } + + //find classes missing in src + for (PxU32 i = 0; imClassName); + + if (mcSrc == NULL) + { + mConvX.displayMessage(PxErrorCode::eDEBUG_INFO, "src is missing meta class %s", mcDst->mClassName); + } + } + + //compare classes present in src and dst + for (PxU32 i = 0; imClassName; + MetaClass* mcSrc = getMetaClass(className); + MetaClass* mcDst = dst.getMetaClass(className); + if (mcSrc != NULL && mcDst != NULL) + { + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mCallback) + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mMaster) //should be 0 for both anyway + COMPARE_METADATA_STRING_MD(MetaClass, *mcSrc, *mcDst, mClassName) + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mSize) + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mDepth) + + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mBaseClasses.size()) + if (mcSrc->mBaseClasses.size() == mcDst->mBaseClasses.size()) + { + for (PxU32 b = 0; b < mcSrc->mBaseClasses.size(); b++) + { + COMPARE_METADATA_STRING_MD(PxMetaDataEntry, mcSrc->mBaseClasses[b], mcDst->mBaseClasses[b], mName); + } + } + + COMPARE_METADATA_INT_MD(MetaClass, *mcSrc, *mcDst, mFields.size()) + if (mcSrc->mFields.size() == mcDst->mFields.size()) + { + for (PxU32 f = 0; f < mcSrc->mFields.size(); f++) + { + PxMetaDataEntry srcMde = mcSrc->mFields[f]; + PxMetaDataEntry dstMde = mcDst->mFields[f]; + + COMPARE_METADATA_STRING_MD(PxMetaDataEntry, srcMde, dstMde, mType) + COMPARE_METADATA_STRING_MD(PxMetaDataEntry, srcMde, dstMde, mName) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mOffset) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mSize) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mCount) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mOffsetSize) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mFlags) + COMPARE_METADATA_INT_MD(PxMetaDataEntry, srcMde, dstMde, mAlignment) + } + } + } + } + return isEquivalent; +} + +#undef COMPARE_METADATA_BOOL_MD +#undef COMPARE_METADATA_INT_MD +#undef COMPARE_METADATA_STRING_MD + +/////////////////////////////////////////////////////////////////////////////// + +void ConvX::releaseMetaData() +{ + PX_DELETE(mMetaData_Dst); + PX_DELETE(mMetaData_Src); +} + +const MetaData* ConvX::loadMetaData(PxInputStream& inputStream, MetaDataType type) +{ + if (type != META_DATA_SRC && type != META_DATA_DST) + { + displayMessage(PxErrorCode::eINTERNAL_ERROR, + "PxBinaryConverter: Wrong meta data type, please check the source metadata.\n"); + return NULL; + } + + PX_ASSERT(type == META_DATA_SRC || type == META_DATA_DST); + + MetaData*& metaDataPtr = (type == META_DATA_SRC) ? mMetaData_Src : mMetaData_Dst; + metaDataPtr = PX_NEW(MetaData)(*this); + if(!(metaDataPtr)->load(inputStream, type)) + PX_DELETE(metaDataPtr); + return metaDataPtr; +} + +const MetaData* ConvX::getBinaryMetaData(MetaDataType type) +{ + if(type==META_DATA_SRC) + return mMetaData_Src; + if(type==META_DATA_DST) + return mMetaData_Dst; + PX_ASSERT(0); + return NULL; +} + +int ConvX::getNbMetaClasses(MetaDataType type) +{ + if(type==META_DATA_SRC) + return mMetaData_Src->getNbMetaClasses(); + if(type==META_DATA_DST) + return mMetaData_Dst->getNbMetaClasses(); + PX_ASSERT(0); + return 0; +} + +MetaClass* ConvX::getMetaClass(unsigned int i, MetaDataType type) const +{ + if(type==META_DATA_SRC) + return mMetaData_Src->getMetaClass(i); + if(type==META_DATA_DST) + return mMetaData_Dst->getMetaClass(i); + PX_ASSERT(0); + return NULL; +} + +MetaClass* ConvX::getMetaClass(const char* name, MetaDataType type) const +{ + if(type==META_DATA_SRC) + return mMetaData_Src->getMetaClass(name); + if(type==META_DATA_DST) + return mMetaData_Dst->getMetaClass(name); + PX_ASSERT(0); + return NULL; +} + +MetaClass* ConvX::getMetaClass(PxConcreteType::Enum concreteType, MetaDataType type) +{ + MetaClass* metaClass = NULL; + if(type==META_DATA_SRC) + metaClass = mMetaData_Src->getMetaClass(concreteType); + if(type==META_DATA_DST) + metaClass = mMetaData_Dst->getMetaClass(concreteType); + + if(!metaClass) + { + displayMessage(PxErrorCode::eINTERNAL_ERROR, + "PxBinaryConverter: Missing concreteType %d metadata! serialized a class without dumping metadata. Please check the metadata.", + concreteType); + return NULL; + } + + return metaClass; +} + +/////////////////////////////////////////////////////////////////////////////// + +// Peek & poke, yes sir. +PxU64 physx::Sn::peek(int size, const char* buffer, int flags) +{ + const int maskMSB = flags & PxMetaDataFlag::eCOUNT_MASK_MSB; + const int skipIfOne = flags & PxMetaDataFlag::eCOUNT_SKIP_IF_ONE; + switch(size) + { + case 1: + { + unsigned char value = *(reinterpret_cast(buffer)); + if(maskMSB) + value &= 0x7f; + if(skipIfOne && value==1) + return 0; + return PxU64(value); + } + case 2: + { + unsigned short value = *(reinterpret_cast(buffer)); + if(maskMSB) + value &= 0x7fff; + if(skipIfOne && value==1) + return 0; + return PxU64(value); + } + case 4: + { + unsigned int value = *(reinterpret_cast(buffer)); + if(maskMSB) + value &= 0x7fffffff; + if(skipIfOne && value==1) + return 0; + return PxU64(value); + } + case 8: + { + PxU64 value = *(reinterpret_cast(buffer)); + if(maskMSB) + value &= (PxU64(-1))>>1; + if(skipIfOne && value==1) + return 0; + return value; + } + }; + PX_ASSERT(0); + return PxU64(-1); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.h new file mode 100644 index 0000000..e1081c1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_MetaData.h @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SN_CONVX_METADATA_H +#define SN_CONVX_METADATA_H + +#include "common/PxMetaDataFlags.h" + +#include "SnConvX_Output.h" +#include "serialization/SnSerialUtils.h" + +namespace physx { namespace Sn { + +#if PX_VC +#pragma warning (push) +#pragma warning (disable : 4371) //layout of class may have changed from a previous version of the compiler due to better packing of member +#endif + + + // PT: beware, must match corresponding structure in PxMetaData.h + struct PxMetaDataEntry : public PxUserAllocated + { + PxMetaDataEntry() + { + memset(this, 0, sizeof(*this)); + } + bool isVTablePtr() const; + + const char* mType; //!< Field type (bool, byte, quaternion, etc) + const char* mName; //!< Field name (appears exactly as in the source file) + int mOffset; //!< Offset from the start of the class (ie from "this", field is located at "this"+Offset) + int mSize; //!< sizeof(Type) + int mCount; //!< Number of items of type Type (0 for dynamic sizes) + int mOffsetSize; //!< Offset of dynamic size param, for dynamic arrays + int mFlags; //!< Field parameters + int mAlignment; //!< Explicit alignment added for DE1340 + }; + + struct MetaDataEntry32 + { + PxI32 mType; //!< Field type (bool, byte, quaternion, etc) + PxI32 mName; //!< Field name (appears exactly as in the source file) + int mOffset; //!< Offset from the start of the class (ie from "this", field is located at "this"+Offset) + int mSize; //!< sizeof(Type) + int mCount; //!< Number of items of type Type (0 for dynamic sizes) + int mOffsetSize; //!< Offset of dynamic size param, for dynamic arrays + int mFlags; //!< Field parameters + int mAlignment; //!< Explicit alignment added for DE1340 + }; + + struct MetaDataEntry64 + { + PxI64 mType; //!< Field type (bool, byte, quaternion, etc) + PxI64 mName; //!< Field name (appears exactly as in the source file) + int mOffset; //!< Offset from the start of the class (ie from "this", field is located at "this"+Offset) + int mSize; //!< sizeof(Type) + int mCount; //!< Number of items of type Type (0 for dynamic sizes) + int mOffsetSize; //!< Offset of dynamic size param, for dynamic arrays + int mFlags; //!< Field parameters + int mAlignment; //!< Explicit alignment added for DE1340 + }; + + struct ExtraDataEntry + { + PxMetaDataEntry entry; + int offset; + }; + + struct ExtraDataEntry2 : ExtraDataEntry + { + ConvertCallback cb; + }; + + class MetaData; + + struct MetaClass : public PxUserAllocated + { + bool getFieldByType(const char* type, PxMetaDataEntry& entry) const; + bool getFieldByName(const char* name, PxMetaDataEntry& entry) const; + bool check(const MetaData& owner); + + ConvertCallback mCallback; + MetaClass* mMaster; + const char* mClassName; + int mSize; + int mDepth; + PsArray mBaseClasses; + PsArray mFields; + bool mProcessed; + +// int mNbEntries; +// ExtraDataEntry2 mEntries[256]; + + private: + void checkAndCompleteClass(const MetaData& owner, int& startOffset, int& nbBytes); + }; + + enum MetaDataType + { + META_DATA_NONE, + META_DATA_SRC, + META_DATA_DST + }; + + class ConvX; + class MetaData : public PxUserAllocated + { + public: + MetaData(Sn::ConvX&); + ~MetaData(); + + bool load(PxInputStream& inputStream, MetaDataType type); + + inline_ MetaDataType getType() const { return mType; } + inline_ int getVersion() const { return mVersion; } + inline_ int getPtrSize() const { return mSizeOfPtr; } + inline_ int getPlatformTag() const { return mPlatformTag; } + inline_ int getGaussMapLimit() const { return mGaussMapLimit; } + inline_ int getNbMetaClasses() const { return int(mMetaClasses.size()); } + inline_ MetaClass* getMetaClass(unsigned int i) const { return mMetaClasses[i]; } + inline_ bool getFlip() const { return mFlip; } + + MetaClass* getMetaClass(const char* name) const; + MetaClass* getMetaClass(PxConcreteType::Enum concreteType) const; + MetaClass* addNewClass(const char* name, int size, MetaClass* master=NULL, ConvertCallback callback=NULL); + + bool compare(const MetaData& candidate) const; + private: + MetaData& operator=(const MetaData&); + Sn::ConvX& mConvX; + MetaDataType mType; + int mNbEntries; + PxMetaDataEntry* mEntries; + char* mStringTable; + PsArray mMetaClasses; + int mVersion; + char mBinaryVersionGuid[SN_BINARY_VERSION_GUID_NUM_CHARS + 1]; + int mSizeOfPtr; + int mPlatformTag; + int mGaussMapLimit; + bool mFlip; + + PsArray< PxPair > mConcreteTypeTable; + + inline_ const char* offsetToText(const char* text) const + { + const size_t offset = size_t(text); + const PxU32 offset32 = PxU32(offset); +// if(offset==-1) + if(offset32==0xffffffff) + return NULL; + return mStringTable + offset32; + } + friend struct MetaClass; + }; + + PxU64 peek(int size, const char* buffer, int flags=0); + +#if PX_VC +#pragma warning (pop) +#endif +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp new file mode 100644 index 0000000..2e60046 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.cpp @@ -0,0 +1,491 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxIO.h" +#include "foundation/PxErrorCallback.h" +#include "SnConvX.h" + +#if PX_VC +#pragma warning(disable:4389) // signed/unsigned mismatch +#endif + +using namespace physx; + +void Sn::ConvX::setNullPtr(bool flag) +{ + mNullPtr = flag; +} + +void Sn::ConvX::setNoOutput(bool flag) +{ + mNoOutput = flag; +} + +bool Sn::ConvX::initOutput(PxOutputStream& targetStream) +{ + mOutStream = &targetStream; + + mOutputSize = 0; + mNullPtr = false; + mNoOutput = false; + + const MetaData* srcMetaData = getBinaryMetaData(META_DATA_SRC); + PX_ASSERT(srcMetaData); + const MetaData* dstMetaData = getBinaryMetaData(META_DATA_DST); + PX_ASSERT(dstMetaData); + + mSrcPtrSize = srcMetaData->getPtrSize(); + mDstPtrSize = dstMetaData->getPtrSize(); + + PX_ASSERT(!srcMetaData->getFlip()); + mMustFlip = dstMetaData->getFlip(); + return true; +} + +void Sn::ConvX::closeOutput() +{ + mOutStream = NULL; +} + +int Sn::ConvX::getCurrentOutputSize() +{ + return mOutputSize; +} + +void Sn::ConvX::output(short value) +{ + if(mNoOutput) + return; + + if(mMustFlip) + flip(value); + + PX_ASSERT(mOutStream); + const size_t size = mOutStream->write(&value, 2); + PX_ASSERT(size==2); + mOutputSize += int(size); +} + +void Sn::ConvX::output(int value) +{ + if(mNoOutput) + return; + + if(mMustFlip) + flip(value); + + PX_ASSERT(mOutStream); + const size_t size = mOutStream->write(&value, 4); + PX_ASSERT(size==4); + mOutputSize += int(size); +} + +//ntohll is a macro on apple yosemite +static PxU64 ntohll_internal(const PxU64 value) +{ + union + { + PxU64 ull; + PxU8 c[8]; + } x; + + x.ull = value; + + PxU8 c = 0; + c = x.c[0]; x.c[0] = x.c[7]; x.c[7] = c; + c = x.c[1]; x.c[1] = x.c[6]; x.c[6] = c; + c = x.c[2]; x.c[2] = x.c[5]; x.c[5] = c; + c = x.c[3]; x.c[3] = x.c[4]; x.c[4] = c; + + return x.ull; +} + +void Sn::ConvX::output(PxU64 value) +{ + if(mNoOutput) + return; + + if(mMustFlip) +// flip(value); + value = ntohll_internal(value); + + PX_ASSERT(mOutStream); + const size_t size = mOutStream->write(&value, 8); + PX_ASSERT(size==8); + mOutputSize += int(size); +} + +void Sn::ConvX::output(const char* buffer, int nbBytes) +{ + if(mNoOutput) + return; + + if(!nbBytes) + return; + + PX_ASSERT(mOutStream); + const PxU32 size = mOutStream->write(buffer, PxU32(nbBytes)); + PX_ASSERT(size== PxU32(nbBytes)); + mOutputSize += int(size); +} + +void Sn::ConvX::convert8(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==1*entry.mCount); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + const PxU32 size = mOutStream->write(src, PxU32(entry.mSize)); + PX_ASSERT(size== PxU32(entry.mSize)); + mOutputSize += int(size); +} + +// This is called to convert auto-generated "padding bytes" (or so we think). +// We use a special converter to check the input bytes and issue warnings when it doesn't look like padding +void Sn::ConvX::convertPad8(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + (void)src; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize); + PX_ASSERT(entry.mSize==1*entry.mCount); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + // PT: we don't output the source data on purpose, to catch missing meta-data + // sschirm: changed that to 0xcd, so we can mark the output as "having marked pads" + const unsigned char b = 0xcd; + for(int i=0;iwrite(&b, 1); + (void)size; + } + mOutputSize += entry.mSize; +} + +void Sn::ConvX::convert16(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==int(sizeof(short)*entry.mCount)); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + const short* data = reinterpret_cast(src); + for(int i=0;iwrite(&value, sizeof(short)); + PX_ASSERT(size==sizeof(short)); + mOutputSize += int(size); + } +} + +void Sn::ConvX::convert32(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==int(sizeof(int)*entry.mCount)); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + const int* data = reinterpret_cast(src); + for(int i=0;iwrite(&value, sizeof(int)); + PX_ASSERT(size==sizeof(int)); + mOutputSize += int(size); + } +} + +void Sn::ConvX::convert64(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==int(sizeof(PxU64)*entry.mCount)); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + const PxU64* data = reinterpret_cast(src); + for(int i=0;iwrite(&value, sizeof(PxU64)); + PX_ASSERT(size==sizeof(PxU64)); + mOutputSize += int(size); + } +} + +void Sn::ConvX::convertFloat(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==int(sizeof(float)*entry.mCount)); + PX_ASSERT(mOutStream); + PX_ASSERT(entry.mSize==dstEntry.mSize); + + const float* data = reinterpret_cast(src); + for(int i=0;iwrite(&value, sizeof(float)); + PX_ASSERT(size==sizeof(float)); + mOutputSize += int(size); + } +} + +void Sn::ConvX::convertPtr(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(entry.mSize==mSrcPtrSize*entry.mCount); + PX_ASSERT(mOutStream); + + char buffer[16]; + for(int i=0;i(src); + PxU32 value = *data++; + src = reinterpret_cast(data); + + if(mPointerActiveRemap) + { + PxU32 ref; + if(mPointerActiveRemap->getObjectRef(value, ref)) + { + value = ref; + } + else if(value) + { + // all pointers not in the pointer remap table get set as 0x12345678, this also applies to PhysX name properties (mName) + value=0x12345678; + } + } + else + { + //we should only get here during convertReferenceTables to build up the pointer map + PxU32 ref; + if (mPointerRemap.getObjectRef(value, ref)) + { + value = ref; + } + else if(value) + { + const PxU32 remappedRef = 0x80000000 | (mPointerRemapCounter++ +1); + mPointerRemap.setObjectRef(value, remappedRef); + value = remappedRef; + } + } + + if(mMustFlip) + flip(value); + + if(mNullPtr) + value = 0; + + *reinterpret_cast(buffer) = value; + } + else + { + PX_ASSERT(mSrcPtrSize==8); + PX_ASSERT(sizeof(PxU64)==8); + const PxU64* data = reinterpret_cast(src); + PxU64 value = *data++; + src = reinterpret_cast(data); + + if(mPointerActiveRemap) + { + PxU32 ref; + if(mPointerActiveRemap->getObjectRef(value, ref)) + { + value = ref; + } + else if(value) + { + // all pointers not in the pointer remap table get set as 0x12345678, this also applies to PhysX name properties (mName) + value=0x12345678; + } + } + else + { + //we should only get here during convertReferenceTables to build up the pointer map + PxU32 ref; + if (mPointerRemap.getObjectRef(value, ref)) + { + value = ref; + } + else if(value) + { + const PxU32 remappedRef = 0x80000000 | (mPointerRemapCounter++ +1); + mPointerRemap.setObjectRef(value, remappedRef); + value = remappedRef; + } + } + + if(mNullPtr) + value = 0; + + testValue = value; + + *reinterpret_cast(buffer) = value; + } + + if(mSrcPtrSize==mDstPtrSize) + { + const size_t size = mOutStream->write(buffer, PxU32(mSrcPtrSize)); + PX_ASSERT(size==PxU32(mSrcPtrSize)); + mOutputSize += int(size); + } + else + { + if(mDstPtrSize>mSrcPtrSize) + { + // 32bit to 64bit + PX_ASSERT(mDstPtrSize==8); + PX_ASSERT(mSrcPtrSize==4); + + // We need to output the lower 32bits first for PC. Might be different on a 64bit console.... + + // Output src ptr for the lower 32bits + const size_t size = mOutStream->write(buffer, PxU32(mSrcPtrSize)); + PX_ASSERT(size==PxU32(mSrcPtrSize)); + mOutputSize += int(size); + + // Output zeros for the higher 32bits + const int zero = 0; + const size_t size0 = mOutStream->write(&zero, 4); + PX_ASSERT(size0==4); + mOutputSize += int(size0); + } + else + { + // 64bit to 32bit + PX_ASSERT(mSrcPtrSize==8); + PX_ASSERT(mDstPtrSize==4); + + // Not sure how we can safely convert 64bit ptrs to 32bit... just drop the high 32 bits?!? + + PxU32 ptr32 = *reinterpret_cast(buffer); + (void)ptr32; + PxU32 ptr32b = PxU32(testValue); + (void)ptr32b; + + if(mMustFlip) + flip(ptr32b); + + // Output src ptr for the lower 32bits + const size_t size = mOutStream->write(&ptr32b, 4); + PX_ASSERT(size==4); + mOutputSize += int(size); + } + } + } +} + +void Sn::ConvX::convertHandle16(const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry) +{ + (void)dstEntry; + if(mNoOutput) + return; + + PX_ASSERT(strcmp(entry.mType, "PxU16") == 0); + PX_ASSERT(entry.mSize==dstEntry.mSize); + PX_ASSERT(mOutStream); + + const PxU16* handles = reinterpret_cast(src); + + for(int i=0;igetObjectRef(value, ref); + PX_UNUSED(isMapped); + PX_ASSERT(isMapped); + value = ref; + } + else + { + //we should only get here during convertReferenceTables to build up the pointer map + PxU16 ref; + if (mHandle16Remap.getObjectRef(value, ref)) + { + value = ref; + } + else + { + const PxU16 remappedRef = mHandle16RemapCounter++; + mHandle16Remap.setObjectRef(value, remappedRef); + value = remappedRef; + } + } + + if(mMustFlip) + flip(value); + + const size_t size = mOutStream->write(&value, sizeof(PxU16)); + PX_UNUSED(size); + PX_ASSERT(size==sizeof(PxU16)); + mOutputSize += sizeof(PxU16); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.h new file mode 100644 index 0000000..dfbf4ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Output.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SN_CONVX_OUTPUT_H +#define SN_CONVX_OUTPUT_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx { namespace Sn { + + struct PxMetaDataEntry; + class ConvX; + + typedef void (Sn::ConvX::*ConvertCallback) (const char* src, const PxMetaDataEntry& entry, const PxMetaDataEntry& dstEntry); + + inline_ void flip(PxI16& v) + { + PxI8* b = reinterpret_cast(&v); + PxI8 temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } + + inline_ void flip(PxU16& v) + { + flip(reinterpret_cast(v)); + } + + inline_ void flip32(PxI8* b) + { + PxI8 temp = b[0]; + b[0] = b[3]; + b[3] = temp; + temp = b[1]; + b[1] = b[2]; + b[2] = temp; + } + + inline_ void flip(PxI32& v) + { + PxI8* b = reinterpret_cast(&v); + flip32(b); + } + + inline_ void flip(PxU32& v) + { + PxI8* b = reinterpret_cast(&v); + flip32(b); + } + + inline_ void flip(PxI64& v) + { + PxI8* b = reinterpret_cast(&v); + + PxI8 temp = b[0]; + b[0] = b[7]; + b[7] = temp; + temp = b[1]; + b[1] = b[6]; + b[6] = temp; + temp = b[2]; + b[2] = b[5]; + b[5] = temp; + temp = b[3]; + b[3] = b[4]; + b[4] = temp; + } + + inline_ void flip(PxF32& v) + { + PxI8* b = reinterpret_cast(&v); + flip32(b); + } + + inline_ void flip(void*& v) + { + PxI8* b = reinterpret_cast(&v); + flip32(b); + } + + inline_ void flip(const PxI8*& v) + { + PxI8* b = const_cast(v); + flip32(b); + } +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp new file mode 100644 index 0000000..e154aa7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnConvX_Union.cpp @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "SnConvX.h" +#include +#include "foundation/PxString.h" + +using namespace physx; + +void Sn::ConvX::resetUnions() +{ + mUnions.clear(); +} + +bool Sn::ConvX::registerUnion(const char* name) +{ + displayMessage(PxErrorCode::eDEBUG_INFO, "Registering union: %s\n", name); + + Sn::Union u; + u.mName = name; + + mUnions.pushBack(u); + return true; +} + +bool Sn::ConvX::registerUnionType(const char* unionName, const char* typeName, int typeValue) +{ + const PxU32 nb = mUnions.size(); + for(PxU32 i=0;i mTypes; + }; +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp new file mode 100644 index 0000000..80f87b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.cpp @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxBase.h" +#include "SnSerializationContext.h" + +using namespace physx; +using namespace Sn; + +PxBase* DeserializationContext::resolveReference(PxU32 kind, size_t reference) const +{ + SerialObjectIndex objIndex; + if (kind == PX_SERIAL_REF_KIND_PXBASE) + { + const InternalPtrRefMap::Entry* entry0 = mInternalPtrReferencesMap.find(reference); + PX_ASSERT(entry0); + objIndex = entry0->second; + } + else if (kind == PX_SERIAL_REF_KIND_MATERIAL_IDX) + { + const InternalHandle16RefMap::Entry* entry0 = mInternalHandle16ReferencesMap.find(PxU16(reference)); + PX_ASSERT(entry0); + objIndex = entry0->second; + } + else + { + return NULL; + } + + bool isExternal; + PxU32 index = objIndex.getIndex(isExternal); + PxBase* base = NULL; + if (isExternal) + { + const ImportReference& entry = mImportReferences[index]; + base = mExternalRefs->find(entry.id); + } + else + { + const ManifestEntry& entry = mManifestTable[index]; + base = reinterpret_cast(mObjectDataAddress + entry.offset); + } + PX_ASSERT(base); + return base; +} + +void SerializationContext::registerReference(PxBase& serializable, PxU32 kind, size_t reference) +{ +#if PX_CHECKED + if ((kind & PX_SERIAL_REF_KIND_PTR_TYPE_BIT) == 0 && reference > 0xffff) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxSerializationContext::registerReference: only 16 bit handles supported."); + return; + } +#endif + + bool isExternal = mExternalRefs && mExternalRefs->contains(serializable); + PxU32 index; + if (isExternal) + { + PxSerialObjectId id = mExternalRefs->getId(serializable); + PX_ASSERT(id != PX_SERIAL_OBJECT_ID_INVALID); + if (const PxHashMap::Entry* entry = mImportReferencesMap.find(id)) + { + index = entry->second; + } + else + { + index = mImportReferences.size(); + mImportReferencesMap.insert(id, index); + mImportReferences.pushBack(ImportReference(id, serializable.getConcreteType())); + } + } + else + { + PX_ASSERT(mCollection.contains(serializable)); + index = mObjToCollectionIndexMap[&serializable]; + } + + if (kind & PX_SERIAL_REF_KIND_PXBASE) + { + mInternalPtrReferencesMap[reference] = SerialObjectIndex(index, isExternal); + } + else if (kind & PX_SERIAL_REF_KIND_MATERIAL_IDX) + { + mInternalHandle16ReferencesMap[PxU16(reference)] = SerialObjectIndex(index, isExternal); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.h new file mode 100644 index 0000000..472beaf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Binary/SnSerializationContext.h @@ -0,0 +1,325 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_SERIALIZATION_CONTEXT_H +#define SN_SERIALIZATION_CONTEXT_H + +#include "foundation/PxAssert.h" +#include "foundation/PxMemory.h" +#include "foundation/PxHash.h" +#include "common/PxSerialFramework.h" +#include "extensions/PxDefaultStreams.h" + +#include "foundation/PxUserAllocated.h" +#include "CmCollection.h" +#include "CmUtils.h" +#include "SnConvX_Align.h" + +namespace physx +{ + namespace Sn + { + + struct ManifestEntry + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE ManifestEntry(PxU32 _offset, PxType _type) + { + PxMarkSerializedMemory(this, sizeof(ManifestEntry)); + offset = _offset; + type = _type; + } + PX_FORCE_INLINE ManifestEntry() { PxMarkSerializedMemory(this, sizeof(ManifestEntry)); } + PX_FORCE_INLINE void operator =(const ManifestEntry& m) + { + PxMemCopy(this, &m, sizeof(ManifestEntry)); + } + + PxU32 offset; + PxType type; + }; + + struct ImportReference + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE ImportReference(PxSerialObjectId _id, PxType _type) + { + PxMarkSerializedMemory(this, sizeof(ImportReference)); + id = _id; + type = _type; + } + PX_FORCE_INLINE ImportReference() { PxMarkSerializedMemory(this, sizeof(ImportReference)); } + PX_FORCE_INLINE void operator =(const ImportReference& m) + { + PxMemCopy(this, &m, sizeof(ImportReference)); + } + PxSerialObjectId id; + PxType type; + }; + +#define SERIAL_OBJECT_INDEX_TYPE_BIT (1u<<31) + struct SerialObjectIndex + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE SerialObjectIndex(PxU32 index, bool external) { setIndex(index, external); } + PX_FORCE_INLINE SerialObjectIndex(const SerialObjectIndex& objIndex) : mObjIndex(objIndex.mObjIndex) {} + PX_FORCE_INLINE SerialObjectIndex() : mObjIndex(PX_INVALID_U32) {} + + PX_FORCE_INLINE void setIndex(PxU32 index, bool external) + { + PX_ASSERT((index & SERIAL_OBJECT_INDEX_TYPE_BIT) == 0); + mObjIndex = index | (external ? SERIAL_OBJECT_INDEX_TYPE_BIT : 0); + } + + PX_FORCE_INLINE PxU32 getIndex(bool& isExternal) + { + PX_ASSERT(mObjIndex != PX_INVALID_U32); + isExternal = (mObjIndex & SERIAL_OBJECT_INDEX_TYPE_BIT) > 0; + return mObjIndex & ~SERIAL_OBJECT_INDEX_TYPE_BIT; + } + + PX_FORCE_INLINE bool operator < (const SerialObjectIndex& so) const + { + return mObjIndex < so.mObjIndex; + } + + private: + PxU32 mObjIndex; + }; + + struct ExportReference + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE ExportReference(PxSerialObjectId _id, SerialObjectIndex _objIndex) + { + PxMarkSerializedMemory(this, sizeof(ExportReference)); + id = _id; + objIndex = _objIndex; + } + PX_FORCE_INLINE ExportReference() { PxMarkSerializedMemory(this, sizeof(ExportReference)); } + PX_FORCE_INLINE void operator =(const ExportReference& m) + { + PxMemCopy(this, &m, sizeof(ExportReference)); + } + PxSerialObjectId id; + SerialObjectIndex objIndex; + }; + + struct InternalReferencePtr + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE InternalReferencePtr() {} + + PX_FORCE_INLINE InternalReferencePtr(size_t _reference, SerialObjectIndex _objIndex) : + reference(_reference), + objIndex(_objIndex) +#if PX_P64_FAMILY + ,pad(PX_PADDING_32) +#endif + { + } + + size_t reference; + SerialObjectIndex objIndex; +#if PX_P64_FAMILY + PxU32 pad; +#endif + }; + + struct InternalReferenceHandle16 + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + PX_FORCE_INLINE InternalReferenceHandle16() {} + + PX_FORCE_INLINE InternalReferenceHandle16(PxU16 _reference, SerialObjectIndex _objIndex) : + reference(_reference), + pad(PX_PADDING_16), + objIndex(_objIndex) + { + } + + PxU16 reference; + PxU16 pad; + SerialObjectIndex objIndex; + }; + + typedef Cm::CollectionHashMap InternalPtrRefMap; + typedef Cm::CollectionHashMap InternalHandle16RefMap; + + class DeserializationContext : public PxDeserializationContext, public PxUserAllocated + { + PX_NOCOPY(DeserializationContext) + + public: + DeserializationContext(const ManifestEntry* manifestTable, + const ImportReference* importReferences, + PxU8* objectDataAddress, + const InternalPtrRefMap& internalPtrReferencesMap, + const InternalHandle16RefMap& internalHandle16ReferencesMap, + const Cm::Collection* externalRefs, + PxU8* extraData) + : mManifestTable(manifestTable) + , mImportReferences(importReferences) + , mObjectDataAddress(objectDataAddress) + , mInternalPtrReferencesMap(internalPtrReferencesMap) + , mInternalHandle16ReferencesMap(internalHandle16ReferencesMap) + , mExternalRefs(externalRefs) + { + mExtraDataAddress = extraData; + } + + virtual PxBase* resolveReference(PxU32 kind, size_t reference) const; + + private: + //various pointers to deserialized data + const ManifestEntry* mManifestTable; + const ImportReference* mImportReferences; + PxU8* mObjectDataAddress; + + //internal references maps for resolving references. + const InternalPtrRefMap& mInternalPtrReferencesMap; + const InternalHandle16RefMap& mInternalHandle16ReferencesMap; + + //external collection for resolving import references. + const Cm::Collection* mExternalRefs; + //const PxU32 mPhysXVersion; + }; + + class SerializationContext : public PxSerializationContext, public PxUserAllocated + { + PX_NOCOPY(SerializationContext) + public: + SerializationContext(const Cm::Collection& collection, const Cm::Collection* externalRefs) + : mCollection(collection) + , mExternalRefs(externalRefs) + { + // fill object to collection index map (same ordering as manifest) + for (PxU32 i=0;i 0) + { + mMemStream.write(buf, bytesToPad < BUFSIZE ? PxU32(bytesToPad) : PxU32(BUFSIZE)); + bytesToPad -= BUFSIZE; + } + PX_ASSERT(!getPadding(getTotalStoredSize(), alignment)); + } + + virtual void writeName(const char*) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, + "Cannot export names during exportData."); + } + + const PxCollection& getCollection() const { return mCollection; } + + virtual void registerReference(PxBase& serializable, PxU32 kind, size_t reference); + + const PxArray& getImportReferences() { return mImportReferences; } + InternalPtrRefMap& getInternalPtrReferencesMap() { return mInternalPtrReferencesMap; } + InternalHandle16RefMap& getInternalHandle16ReferencesMap() { return mInternalHandle16ReferencesMap; } + + PxU32 getSize() const { return mMemStream.getSize(); } + PxU8* getData() const { return mMemStream.getData(); } + + + + private: + //import reference map for unique registration of import references and corresponding buffer. + PxHashMap mImportReferencesMap; + PxArray mImportReferences; + + //maps for unique registration of internal references + InternalPtrRefMap mInternalPtrReferencesMap; + InternalHandle16RefMap mInternalHandle16ReferencesMap; + + //map for quick lookup of manifest index. + PxHashMap mObjToCollectionIndexMap; + + //collection and externalRefs collection for assigning references. + const Cm::Collection& mCollection; + const Cm::Collection* mExternalRefs; + + PxDefaultMemoryOutputStream mMemStream; + + }; + + } // namespace Sn +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/File/SnFile.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/File/SnFile.h new file mode 100644 index 0000000..9fdb8e0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/File/SnFile.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef SN_FILE_H +#define SN_FILE_H + +// fopen_s - returns 0 on success, non-zero on failure + +#if PX_WINDOWS_FAMILY + +#include + +namespace physx +{ +namespace sn +{ +PX_INLINE PxI32 fopen_s(FILE** file, const char* name, const char* mode) +{ + static const PxU32 MAX_LEN = 300; + char buf[MAX_LEN+1]; + + PxU32 i; + for(i = 0; i + +namespace physx +{ +namespace sn +{ +PX_INLINE PxI32 fopen_s(FILE** file, const char* name, const char* mode) +{ + FILE* fp = ::fopen(name, mode); + if(fp) + { + *file = fp; + return PxI32(0); + } + return -1; +} +} // namespace sn +} // namespace physx +#else +#error "Platform not supported!" +#endif + +#endif //SN_FILE_H + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp new file mode 100644 index 0000000..de12db0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerialUtils.cpp @@ -0,0 +1,135 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "extensions/PxSerialization.h" +#include "foundation/PxPhysicsVersion.h" + +#include "SnSerialUtils.h" +#include "foundation/PxString.h" +#include "foundation/PxBasicTemplates.h" + +using namespace physx; + +namespace +{ + +#define SN_NUM_BINARY_PLATFORMS 10 +const PxU32 sBinaryPlatformTags[SN_NUM_BINARY_PLATFORMS] = +{ + PX_MAKE_FOURCC('W','_','3','2'), + PX_MAKE_FOURCC('W','_','6','4'), + PX_MAKE_FOURCC('L','_','3','2'), + PX_MAKE_FOURCC('L','_','6','4'), + PX_MAKE_FOURCC('M','_','3','2'), + PX_MAKE_FOURCC('M','_','6','4'), + PX_MAKE_FOURCC('N','X','3','2'), + PX_MAKE_FOURCC('N','X','6','4'), + PX_MAKE_FOURCC('L','A','6','4'), + PX_MAKE_FOURCC('M','A','6','4'), +}; + +const char* sBinaryPlatformNames[SN_NUM_BINARY_PLATFORMS] = +{ + "win32", + "win64", + "linux32", + "linux64", + "mac32", + "mac64", + "switch32", + "switch64", + "linuxaarch64", + "macaarch64", +}; + +} + +namespace physx { namespace Sn { + +PxU32 getBinaryPlatformTag() +{ +#if PX_WINDOWS && PX_X86 + return sBinaryPlatformTags[0]; +#elif PX_WINDOWS && PX_X64 + return sBinaryPlatformTags[1]; +#elif PX_LINUX && PX_X86 + return sBinaryPlatformTags[2]; +#elif PX_LINUX && PX_X64 + return sBinaryPlatformTags[3]; +#elif PX_OSX && PX_X86 + return sBinaryPlatformTags[4]; +#elif PX_OSX && PX_X64 + return sBinaryPlatformTags[5]; +#elif PX_SWITCH && !PX_A64 + return sBinaryPlatformTags[6]; +#elif PX_SWITCH && PX_A64 + return sBinaryPlatformTags[7]; +#elif PX_LINUX && PX_A64 + return sBinaryPlatformTags[8]; +#elif PX_OSX && PX_A64 + return sBinaryPlatformTags[9]; +#else + #error Unknown binary platform +#endif +} + +bool isBinaryPlatformTagValid(physx::PxU32 platformTag) +{ + PxU32 platformIndex = 0; + while (platformIndex < SN_NUM_BINARY_PLATFORMS && platformTag != sBinaryPlatformTags[platformIndex]) platformIndex++; + return platformIndex < SN_NUM_BINARY_PLATFORMS; +} + +const char* getBinaryPlatformName(physx::PxU32 platformTag) +{ + PxU32 platformIndex = 0; + while (platformIndex < SN_NUM_BINARY_PLATFORMS && platformTag != sBinaryPlatformTags[platformIndex]) platformIndex++; + return (platformIndex == SN_NUM_BINARY_PLATFORMS) ? "unknown" : sBinaryPlatformNames[platformIndex]; +} + +const char* getBinaryVersionGuid() +{ + PX_COMPILE_TIME_ASSERT(sizeof(PX_BINARY_SERIAL_VERSION) == SN_BINARY_VERSION_GUID_NUM_CHARS + 1); + return PX_BINARY_SERIAL_VERSION; +} + +bool checkCompatibility(const char* binaryVersionGuidCandidate) +{ + for(PxU32 i=0; icontains(base))) + return; + if(!required.contains(base)) + required.add(base); + } + + PxCollection& required; + PxCollection& complete; + const PxCollection* external; + PX_NOCOPY(CompleteCallback) + }; + + void getRequiresCollection(PxCollection& required, PxCollection& collection, PxCollection& complete, const PxCollection* external, PxSerializationRegistry& sr, bool followJoints) + { + CompleteCallback callback(required, complete, external); + for (PxU32 i = 0; i < collection.getNbObjects(); ++i) + { + PxBase& s = collection.getObject(i); + const PxSerializer* serializer = sr.getSerializer(s.getConcreteType()); + PX_ASSERT(serializer); + serializer->requiresObjects(s, callback); + + if(followJoints) + { + PxRigidActor* actor = s.is(); + if(actor) + { + PxArray objects(actor->getNbConstraints()); + actor->getConstraints(objects.begin(), objects.size()); + + for(PxU32 j=0;j(objects[j]->getExternalReference(typeId)); + if(typeId == PxConstraintExtIDs::eJOINT) + { + const PxSerializer* sj = sr.getSerializer(joint->getConcreteType()); + PX_ASSERT(sj); + sj->requiresObjects(*joint, callback); + if(!required.contains(*joint)) + required.add(*joint); + } + } + } + } + } + } +} + +bool PxSerialization::isSerializable(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* externalReferences) +{ + PxCollection* subordinateCollection = PxCreateCollection(); + PX_ASSERT(subordinateCollection); + + for(PxU32 i = 0; i < collection.getNbObjects(); ++i) + { + PxBase& s = collection.getObject(i); + const PxSerializer* serializer = sr.getSerializer(s.getConcreteType()); + PX_ASSERT(serializer); + if(serializer->isSubordinate()) + subordinateCollection->add(s); + + if(externalReferences) + { + PxSerialObjectId id = collection.getId(s); + if(id != PX_SERIAL_OBJECT_ID_INVALID) + { + PxBase* object = externalReferences->find(id); + if(object && (object != &s)) + { + subordinateCollection->release(); + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: Reference id %" PX_PRIu64 " used both in current collection and in externalReferences. " + "Please use unique identifiers.", id); + return false; + } + } + } + } + + PxCollection* requiresCollection = PxCreateCollection(); + PX_ASSERT(requiresCollection); + + RequiresCallback requiresCallback0(*requiresCollection); + + for (PxU32 i = 0; i < collection.getNbObjects(); ++i) + { + PxBase& s = collection.getObject(i); + const PxSerializer* serializer = sr.getSerializer(s.getConcreteType()); + PX_ASSERT(serializer); + serializer->requiresObjects(s, requiresCallback0); + + Cm::Collection* cmRequiresCollection = static_cast(requiresCollection); + + for(PxU32 j = 0; j < cmRequiresCollection->getNbObjects(); ++j) + { + PxBase& s0 = cmRequiresCollection->getObject(j); + + if(subordinateCollection->contains(s0)) + { + subordinateCollection->remove(s0); + continue; + } + + bool requiredIsInCollection = collection.contains(s0); + if(!requiredIsInCollection) + { + if(externalReferences) + { + if(!externalReferences->contains(s0)) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: Object of type %s references a missing object of type %s. " + "The missing object needs to be added to either the current collection or the externalReferences collection.", + s.getConcreteTypeName(), s0.getConcreteTypeName()); + } + else if(externalReferences->getId(s0) == PX_SERIAL_OBJECT_ID_INVALID) + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: Object of type %s in externalReferences collection requires an id.", + s0.getConcreteTypeName()); + } + else + continue; + } + else + { + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: Object of type %s references a missing serial object of type %s. " + "Please completed the collection or specify an externalReferences collection containing the object.", + s.getConcreteTypeName(), s0.getConcreteTypeName()); + } + subordinateCollection->release(); + requiresCollection->release(); + return false; + } + } + cmRequiresCollection->mObjects.clear(); + } + requiresCollection->release(); + + PxU32 numOrphans = subordinateCollection->getNbObjects(); + + for(PxU32 j = 0; j < numOrphans; ++j) + { + PxBase& subordinate = subordinateCollection->getObject(j); + + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: An object of type %s is subordinate but not required " + "by other objects in the collection (orphan). Please remove the object from the collection or add its owner.", + subordinate.getConcreteTypeName()); + } + + subordinateCollection->release(); + + if(numOrphans>0) + return false; + + if(externalReferences) + { + PxCollection* oppositeRequiresCollection = PxCreateCollection(); + PX_ASSERT(oppositeRequiresCollection); + + RequiresCallback requiresCallback(*oppositeRequiresCollection); + + for (PxU32 i = 0; i < externalReferences->getNbObjects(); ++i) + { + PxBase& s = externalReferences->getObject(i); + const PxSerializer* serializer = sr.getSerializer(s.getConcreteType()); + PX_ASSERT(serializer); + serializer->requiresObjects(s, requiresCallback); + + Cm::Collection* cmCollection = static_cast(oppositeRequiresCollection); + + for(PxU32 j = 0; j < cmCollection->getNbObjects(); ++j) + { + PxBase& s0 = cmCollection->getObject(j); + + if(collection.contains(s0)) + { + oppositeRequiresCollection->release(); + PxGetFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::isSerializable: Object of type %s in externalReferences references an object " + "of type %s in collection (circular dependency).", + s.getConcreteTypeName(), s0.getConcreteTypeName()); + return false; + } + } + cmCollection->mObjects.clear(); + } + oppositeRequiresCollection->release(); + } + + return true; +} + +void PxSerialization::complete(PxCollection& collection, PxSerializationRegistry& sr, const PxCollection* exceptFor, bool followJoints) +{ + PxCollection* curCollection = PxCreateCollection(); + PX_ASSERT(curCollection); + curCollection->add(collection); + + PxCollection* requiresCollection = PxCreateCollection(); + PX_ASSERT(requiresCollection); + + do + { + getRequiresCollection(*requiresCollection, *curCollection, collection, exceptFor, sr, followJoints); + + collection.add(*requiresCollection); + PxCollection* swap = curCollection; + curCollection = requiresCollection; + requiresCollection = swap; + (static_cast(requiresCollection))->mObjects.clear(); + + }while(curCollection->getNbObjects() > 0); + + requiresCollection->release(); + curCollection->release(); + +} + +void PxSerialization::createSerialObjectIds(PxCollection& collection, const PxSerialObjectId base) +{ + PxSerialObjectId localBase = base; + PxU32 nbObjects = collection.getNbObjects(); + + for (PxU32 i = 0; i < nbObjects; ++i) + { + while(collection.find(localBase)) + { + localBase++; + } + + PxBase& s = collection.getObject(i); + if(PX_SERIAL_OBJECT_ID_INVALID == collection.getId(s)) + { + collection.addId(s, localBase); + localBase++; + } + } +} + +namespace physx { namespace Sn +{ + static PxU32 addToStringTable(physx::PxArray& stringTable, const char* str) + { + if(!str) + return 0xffffffff; + + PxI32 length = PxI32(stringTable.size()); + const char* table = stringTable.begin(); + const char* start = table; + while(length) + { + if(Pxstrcmp(table, str)==0) + return PxU32(table - start); + + const char* saved = table; + while(*table++); + length -= PxU32(table - saved); + PX_ASSERT(length>=0); + } + + const PxU32 offset = stringTable.size(); + + while(*str) + stringTable.pushBack(*str++); + stringTable.pushBack(0); + return offset; + } +} } + +void PxSerialization::dumpBinaryMetaData(PxOutputStream& outputStream, PxSerializationRegistry& sr) +{ + class MetaDataStream : public PxOutputStream + { + public: + bool addNewType(const char* typeName) + { + for(PxU32 i=0;i(src); + if(( entry->flags & PxMetaDataFlag::eTYPEDEF) || ((entry->flags & PxMetaDataFlag::eCLASS) && (!entry->name)) ) + newType = addNewType(entry->type); + if(newType) + metaData.pushBack(*entry); + return count; + } + PxArray metaData; + PxArray types; + bool newType; + }s; + + SerializationRegistry& sn = static_cast(sr); + sn.getBinaryMetaData(s); + + PxArray stringTable; + + PxU32 nb = s.metaData.size(); + PxMetaDataEntry* entries = s.metaData.begin(); + for(PxU32 i=0;i(size_t(addToStringTable(stringTable, entries[i].type))); + entries[i].name = reinterpret_cast(size_t(addToStringTable(stringTable, entries[i].name))); + } + + PxU32 platformTag = getBinaryPlatformTag(); + + const PxU32 gaussMapLimit = 32; + + const PxU32 header = PX_MAKE_FOURCC('M','E','T','A'); + const PxU32 version = PX_PHYSICS_VERSION; + const PxU32 ptrSize = sizeof(void*); + outputStream.write(&header, 4); + outputStream.write(&version, 4); + outputStream.write(PX_BINARY_SERIAL_VERSION, SN_BINARY_VERSION_GUID_NUM_CHARS); + outputStream.write(&ptrSize, 4); + outputStream.write(&platformTag, 4); + outputStream.write(&gaussMapLimit, 4); + + outputStream.write(&nb, 4); + outputStream.write(entries, nb*sizeof(PxMetaDataEntry)); + + //concreteTypes to name + PxU32 num = sn.getNbSerializers(); + outputStream.write(&num, 4); + for(PxU32 i=0; i Object; + + class Element + { + public: + Object object; + PxArray children; + bool isFinished; + + Element(PxBase* obj = NULL) : object(obj, PX_SERIAL_OBJECT_ID_INVALID), isFinished(false) {} + }; + + public: + CollectionSorter(Cm::Collection& collection, Sn::SerializationRegistry& sr, bool isRepx) : mCollection(collection), mSr(sr), mIsRepx(isRepx) {} + virtual ~CollectionSorter(){} + + void process(PxBase& base) + { + addChild(&base); + //ArticulationLink is not a repx serializer, so should require Articulation here + if( mIsRepx && PxConcreteType::eARTICULATION_LINK == base.getConcreteType() ) + { + PxArticulationLink* link = static_cast(&base); + PxBase* a = reinterpret_cast(&link->getArticulation()); + if(mCurElement->object.first != a ) //don't require itself + addChild(a); + } + } + + void sort() + { + Element element; + PxU32 i; + + PxU32 nbObject = mCollection.internalGetNbObjects(); + const Cm::Collection::ObjectToIdMap::Entry* objectdatas = mCollection.internalGetObjects(); + for( i = 0; i < nbObject; ++i ) + { + element.object.first = objectdatas[i].first; + element.object.second = objectdatas[i].second; + mObjToIdMap.insert(objectdatas[i].first, mElements.size()); + mElements.pushBack(element); + } + + for( i = 0; i < nbObject; ++i ) + { + mCurElement = &mElements[i]; + const PxSerializer* serializer = mSr.getSerializer(mCurElement->object.first->getConcreteType()); + PX_ASSERT(serializer); + serializer->requiresObjects(*mCurElement->object.first, *this); + } + + for( i = 0; i < nbObject; ++i ) + { + if( mElements[i].isFinished ) + continue; + + AddElement(mElements[i]); + } + + mCollection.mObjects.clear(); + for(PxArray::Iterator o = mSorted.begin(); o != mSorted.end(); ++o ) + { + mCollection.internalAdd(o->first, o->second); + } + } + + void AddElement(Element& e) + { + if( !e.isFinished ) + { + for( PxArray::Iterator child = e.children.begin(); child != e.children.end(); ++child ) + { + AddElement(mElements[*child]); + } + mSorted.pushBack(e.object); + e.isFinished = true; + } + } + + private: + PX_INLINE void addChild(PxBase* base) + { + PX_ASSERT(mCurElement); + const PxHashMap::Entry* entry = mObjToIdMap.find(base); + if(entry) + mCurElement->children.pushBack(entry->second); + } + + CollectionSorter& operator=(const CollectionSorter&); + PxHashMap mObjToIdMap; + PxArray mElements; + Cm::Collection& mCollection; + Sn::SerializationRegistry& mSr; + PxArray mSorted; + Element* mCurElement; + bool mIsRepx; + }; +} + +namespace physx { namespace Sn { + +SerializationRegistry::SerializationRegistry(PxPhysics& physics) + : mPhysics(physics) +{ + PxRegisterPhysicsSerializers(*this); + Ext::RegisterExtensionsSerializers(*this); + + registerBinaryMetaDataCallback(PxGetPhysicsBinaryMetaData); + registerBinaryMetaDataCallback(Ext::GetExtensionsBinaryMetaData); +} + +SerializationRegistry::~SerializationRegistry() +{ + PxUnregisterPhysicsSerializers(*this); + Ext::UnregisterExtensionsSerializers(*this); + + if(mSerializers.size() > 0) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::release(): some registered PxSerializer instances were not unregistered"); + } + + if(mRepXSerializers.size() > 0) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::release(): some registered PxRepXSerializer instances were not unregistered"); + } +} + +void SerializationRegistry::registerSerializer(PxType type, PxSerializer& serializer) +{ + if(mSerializers.find(type)) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::registerSerializer: Type %d has already been registered", type); + } + + mSerializers.insert(type, &serializer); +} + +PxSerializer* SerializationRegistry::unregisterSerializer(PxType type) +{ + const SerializerMap::Entry* e = mSerializers.find(type); + PxSerializer* s = e ? e->second : NULL; + + if(!mSerializers.erase(type)) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::unregisterSerializer: failed to find PxSerializer instance for type %d", type); + } + return s; +} + +const PxSerializer* SerializationRegistry::getSerializer(PxType type) const +{ + const SerializerMap::Entry* e = mSerializers.find(type); +#if PX_CHECKED + if (!e) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::getSerializer: failed to find PxSerializer instance for type %d", type); + } +#endif + return e ? e->second : NULL; +} + +PxType SerializationRegistry::getSerializerType(PxU32 index) const +{ + PX_ASSERT(index < mSerializers.size()); + return mSerializers.getEntries()[index].first; +} + +const char* SerializationRegistry::getSerializerName(PxU32 index) const +{ + PX_ASSERT(index < mSerializers.size()); + return mSerializers.getEntries()[index].second->getConcreteTypeName(); +} + +void SerializationRegistry::registerBinaryMetaDataCallback(PxBinaryMetaDataCallback callback) +{ + mMetaDataCallbacks.pushBack(callback); +} + +void SerializationRegistry::getBinaryMetaData(PxOutputStream& stream) const +{ + for(PxU32 i = 0; i < mMetaDataCallbacks.size(); i++) + { + mMetaDataCallbacks[i](stream); + } +} + +void SerializationRegistry::registerRepXSerializer(PxType type, PxRepXSerializer& serializer) +{ + if(mRepXSerializers.find(type)) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::registerRepXSerializer: Type %d has already been registered", type); + } + + mRepXSerializers.insert(type, &serializer); +} + +PxRepXSerializer* SerializationRegistry::getRepXSerializer(const char* typeName) const +{ + SerializationRegistry* sr = const_cast(this); + for( RepXSerializerMap::Iterator iter = sr->mRepXSerializers.getIterator(); !iter.done(); ++iter) + { + if ( physx::Pxstricmp( iter->second->getTypeName(), typeName ) == 0 ) + return iter->second; + } + return NULL; +} + +PxRepXSerializer* SerializationRegistry::unregisterRepXSerializer(PxType type) +{ + const RepXSerializerMap::Entry* e = mRepXSerializers.find(type); + PxRepXSerializer* s = e ? e->second : NULL; + + if(!mRepXSerializers.erase(type)) + { + PxGetFoundation().error(physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "PxSerializationRegistry::unregisterRepXSerializer: failed to find PxRepXSerializer instance for type %d", type); + } + return s; +} + +void sortCollection(Cm::Collection& collection, SerializationRegistry& sr, bool isRepx) +{ + CollectionSorter sorter(collection, sr, isRepx); + sorter.sort(); +} + +} // Sn + +PxSerializationRegistry* PxSerialization::createSerializationRegistry(PxPhysics& physics) +{ + return PX_NEW(Sn::SerializationRegistry)(physics); +} + +} // physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.h new file mode 100644 index 0000000..6dc301d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/SnSerializationRegistry.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_SERIALIZATION_REGISTRY_H +#define SN_SERIALIZATION_REGISTRY_H + +#include "extensions/PxSerialization.h" +#include "extensions/PxRepXSerializer.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" + + +namespace physx +{ + +namespace Cm { class Collection; } + +namespace Sn { + + class SerializationRegistry : public PxSerializationRegistry, public PxUserAllocated + { + public: + SerializationRegistry(PxPhysics& physics); + virtual ~SerializationRegistry(); + + virtual void release(){ PX_DELETE_THIS; } + + PxPhysics& getPhysics() const { return mPhysics; } + + //binary + void registerSerializer(PxType type, PxSerializer& serializer); + PxSerializer* unregisterSerializer(PxType type); + void registerBinaryMetaDataCallback(PxBinaryMetaDataCallback callback); + void getBinaryMetaData(PxOutputStream& stream) const; + const PxSerializer* getSerializer(PxType type) const; + const char* getSerializerName(PxU32 index) const; + PxType getSerializerType(PxU32 index) const; + PxU32 getNbSerializers() const { return mSerializers.size(); } + //repx + void registerRepXSerializer(PxType type, PxRepXSerializer& serializer); + PxRepXSerializer* getRepXSerializer(const char* typeName) const; + PxRepXSerializer* unregisterRepXSerializer(PxType type); + + protected: + SerializationRegistry &operator=(const SerializationRegistry &); + private: + typedef PxCoalescedHashMap SerializerMap; + typedef PxHashMap RepXSerializerMap; + + PxPhysics& mPhysics; + SerializerMap mSerializers; + RepXSerializerMap mRepXSerializers; + PxArray mMetaDataCallbacks; + }; + + void sortCollection(Cm::Collection& collection, SerializationRegistry& sr, bool isRepx); +} // Sn + +} // physx + + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp new file mode 100644 index 0000000..d5db23a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.cpp @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include "PxMetaDataObjects.h" +#include "PxExtensionMetaDataObjects.h" +#include "ExtJointMetaDataExtensions.h" +#include "SnJointRepXSerializer.h" + +namespace physx { + + template + inline TJointType* createJoint( PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1 ) + { + PX_UNUSED(physics); + PX_UNUSED(actor0); + PX_UNUSED(actor1); + PX_UNUSED(localFrame0); + PX_UNUSED(localFrame1); + return NULL; + } + + template<> + inline PxD6Joint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxD6JointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxDistanceJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxDistanceJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxContactJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxContactJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxFixedJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxFixedJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxPrismaticJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxPrismaticJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxRevoluteJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxRevoluteJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template<> + inline PxSphericalJoint* createJoint(PxPhysics& physics, + PxRigidActor* actor0, const PxTransform& localFrame0, + PxRigidActor* actor1, const PxTransform& localFrame1) + { + return PxSphericalJointCreate( physics, actor0, localFrame0, actor1, localFrame1 ); + } + + template + PxRepXObject PxJointRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + PxRigidActor* actor0 = NULL; + PxRigidActor* actor1 = NULL; + PxTransform localPose0 = PxTransform(PxIdentity); + PxTransform localPose1 = PxTransform(PxIdentity); + bool ok = true; + if ( inReader.gotoChild( "Actors" ) ) + { + ok = readReference( inReader, *inCollection, "actor0", actor0 ); + ok &= readReference( inReader, *inCollection, "actor1", actor1 ); + inReader.leaveChild(); + } + TJointType* theJoint = !ok ? NULL : createJoint( inArgs.physics, actor0, localPose0, actor1, localPose1 ); + + if ( theJoint ) + { + PxConstraint* constraint = theJoint->getConstraint(); + PX_ASSERT( constraint ); + inCollection->add( *constraint ); + this->fileToObjectImpl( theJoint, inReader, inAllocator, inArgs, inCollection ); + } + return PxCreateRepXObject(theJoint); + } + + template + void PxJointRepXSerializer::objectToFileImpl( const TJointType* inObj, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& ) + { + writeAllProperties( inObj, inWriter, inTempBuffer, *inCollection ); + } + + // explicit template instantiations + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; + template struct PxJointRepXSerializer; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.h new file mode 100644 index 0000000..5531ca0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnJointRepXSerializer.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#ifndef SN_JOINT_REPX_SERIALIZER_H +#define SN_JOINT_REPX_SERIALIZER_H +/** \addtogroup RepXSerializers + @{ +*/ + +#include "extensions/PxRepXSimpleType.h" +#include "SnRepXSerializerImpl.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class XmlReader; + class XmlMemoryAllocator; + class XmlWriter; + class MemoryBuffer; + + template + struct PxJointRepXSerializer : public RepXSerializerImpl + { + PxJointRepXSerializer(PxAllocatorCallback& inAllocator) : RepXSerializerImpl(inAllocator) {} + virtual PxRepXObject fileToObject(XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection); + virtual void objectToFileImpl(const TJointType* inObj, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs&); + virtual TJointType* allocateObject(PxRepXInstantiationArgs&) { return NULL; } + }; + +#if PX_SUPPORT_EXTERN_TEMPLATE + // explicit template instantiations declarations + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; + extern template struct PxJointRepXSerializer; +#endif + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnPxStreamOperators.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnPxStreamOperators.h new file mode 100644 index 0000000..c8db760 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnPxStreamOperators.h @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_PX_STREAM_OPERATORS_H +#define SN_PX_STREAM_OPERATORS_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxString.h" +#include "PxFiltering.h" + + +namespace physx +{ + static inline PxU32 strLenght( const char* inStr ) + { + return inStr ? PxU32(strlen(inStr)) : 0; + } +} + +namespace physx // ADL requires we put the operators in the same namespace as the underlying type of PxOutputStream +{ + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const char* inString ) + { + if ( inString && *inString ) + { + ioStream.write( inString, PxU32(strlen(inString)) ); + } + return ioStream; + } + + template + inline PxOutputStream& toStream( PxOutputStream& ioStream, const char* inFormat, const TDataType inData ) + { + char buffer[128] = { 0 }; + Pxsnprintf( buffer, 128, inFormat, inData ); + ioStream << buffer; + return ioStream; + } + + struct endl_obj {}; + //static endl_obj endl; + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, bool inData ) { ioStream << (inData ? "true" : "false"); return ioStream; } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxI32 inData ) { return toStream( ioStream, "%d", inData ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxU16 inData ) { return toStream( ioStream, "%u", PxU32(inData) ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxU8 inData ) { return toStream( ioStream, "%u", PxU32(inData) ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, char inData ) { return toStream( ioStream, "%c", inData ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxU32 inData ) { return toStream( ioStream, "%u", inData ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxU64 inData ) { return toStream( ioStream, "%" PX_PRIu64, inData ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const void* inData ) { return ioStream << static_cast(size_t(inData)); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxF32 inData ) { return toStream( ioStream, "%g", PxF64(inData) ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, PxF64 inData ) { return toStream( ioStream, "%g", inData ); } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, endl_obj) { return ioStream << "\n"; } + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const PxVec3& inData ) + { + ioStream << inData[0]; + ioStream << " "; + ioStream << inData[1]; + ioStream << " "; + ioStream << inData[2]; + return ioStream; + } + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const PxQuat& inData ) + { + ioStream << inData.x; + ioStream << " "; + ioStream << inData.y; + ioStream << " "; + ioStream << inData.z; + ioStream << " "; + ioStream << inData.w; + return ioStream; + } + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const PxTransform& inData ) + { + ioStream << inData.q; + ioStream << " "; + ioStream << inData.p; + return ioStream; + } + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const PxBounds3& inData ) + { + ioStream << inData.minimum; + ioStream << " "; + ioStream << inData.maximum; + return ioStream; + } + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, const PxFilterData& inData ) + { + ioStream << inData.word0 << " " << inData.word1 << " " << inData.word2 << " " << inData.word3; + return ioStream; + } + + inline PxOutputStream& operator << ( PxOutputStream& ioStream, struct PxMetaDataPlane& inData ) + { + ioStream << inData.normal; + ioStream << " "; + ioStream << inData.distance; + return ioStream; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX1_0Defaults.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX1_0Defaults.h new file mode 100644 index 0000000..4907362 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX1_0Defaults.h @@ -0,0 +1,244 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + DEFINE_REPX_DEFAULT_PROPERTY("PxBoxGeometry.HalfExtents", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphereGeometry.Radius", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.ConvexMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.MeshFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.TriangleMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightField", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.RowScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.ColumnScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightFieldFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Length", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Mass", "1000" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Speed", "10" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DynamicFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.StaticFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DynamicFrictionV", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.StaticFrictionV", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DirOfAnisotropy", "1 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.FrictionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.RestitutionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.LocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.SimulationFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.QueryFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.ContactOffset", "0.02" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.RestOffset", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Flags", "eSIMULATION_SHAPE|eSCENE_QUERY_SHAPE|eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Mass", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MassSpaceInertiaTensor", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearDamping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularDamping", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MaxAngularVelocity", "7" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SleepEnergyThreshold", "0.005" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ContactReportThreshold", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.RigidDynamicFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ParentPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ChildPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetOrientation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.InternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ExternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.yLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.zLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.lower", "-0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.upper", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Mass", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.MassSpaceInertiaTensor", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.MaxProjectionIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SeparationTolerance", "0.1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.InternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.ExternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eX", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eY", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eZ", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eTWIST", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING1", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING2", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Value", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DrivePosition", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.linear", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.angular", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MinDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MaxDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Tolerance", "0.025" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.DistanceJointFlags", "eMAX_DISTANCE_ENABLED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveVelocity", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveGearRatio", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.RevoluteJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.ContactDistance", "0.01" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Upper", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Lower", "-3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.PrismaticJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.UserData", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.SphericalJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("THEEND", "false" ) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_1Defaults.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_1Defaults.h new file mode 100644 index 0000000..a78a29c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_1Defaults.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Length", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Mass", "1000" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Speed", "10" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxBoxGeometry.HalfExtents", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphereGeometry.Radius", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.ConvexMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.MeshFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.TriangleMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightField", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.RowScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.ColumnScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightFieldFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DynamicFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.StaticFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DynamicFrictionV", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.StaticFrictionV", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DirOfAnisotropy", "1 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.FrictionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.RestitutionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.LocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.SimulationFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.QueryFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.ContactOffset", "0.02" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.RestOffset", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Flags", "eSIMULATION_SHAPE|eSCENE_QUERY_SHAPE|eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Mass", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MassSpaceInertiaTensor", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearDamping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularDamping", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MaxAngularVelocity", "7" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SleepThreshold", "0.005" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ContactReportThreshold", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.RigidDynamicFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ParentPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ChildPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetOrientation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.InternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ExternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.yLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.zLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TangentialSpring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TangentialDamping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimitContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.lower", "-0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.upper", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimitContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Mass", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.MassSpaceInertiaTensor", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.MaxProjectionIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SeparationTolerance", "0.1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.InternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.ExternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SleepThreshold", "0.005" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eX", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eY", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eZ", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eTWIST", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING1", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING2", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Value", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DrivePosition", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.linear", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.angular", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MinDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MaxDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Tolerance", "0.025" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.DistanceJointFlags", "eMAX_DISTANCE_ENABLED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveVelocity", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveGearRatio", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.RevoluteJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.ContactDistance", "0.01" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Upper", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Lower", "-3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.PrismaticJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.SphericalJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.MotionConstraintScaleBias.scale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.MotionConstraintScaleBias.bias", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ExternalAcceleration", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.DampingCoefficient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.SolverFrequency", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.SleepLinearVelocity", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("THEEND", "false" ) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_2Defaults.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_2Defaults.h new file mode 100644 index 0000000..7f662be --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepX3_2Defaults.h @@ -0,0 +1,312 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Length", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Mass", "1000" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTolerancesScale.Speed", "10" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxBoxGeometry.HalfExtents", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphereGeometry.Radius", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxConvexMeshGeometry.ConvexMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Scale", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.Scale.Rotation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.MeshFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxTriangleMeshGeometry.TriangleMesh", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightField", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.RowScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.ColumnScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxHeightFieldGeometry.HeightFieldFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.DynamicFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.StaticFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.FrictionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxMaterial.RestitutionCombineMode", "eAVERAGE" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.LocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.SimulationFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.QueryFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.ContactOffset", "0.02" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.RestOffset", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Flags", "eSIMULATION_SHAPE|eSCENE_QUERY_SHAPE|eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxShape.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidStatic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.Mass", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MassSpaceInertiaTensor", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.LinearDamping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.AngularDamping", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.MaxAngularVelocity", "7" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SleepThreshold", "0.005" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.ContactReportThreshold", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRigidDynamic.RigidDynamicFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ParentPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ChildPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetOrientation", "0 0 0 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TargetVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.InternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.ExternalCompliance", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.yLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimit.zLimit", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TangentialSpring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TangentialDamping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimitContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.SwingLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.lower", "-0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimit.upper", "0.78539816339" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimitEnabled", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationJoint.TwistLimitContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.CMassLocalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.Mass", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.MassSpaceInertiaTensor", "1 1 1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.LinearVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulationLink.AngularVelocity", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.MaxProjectionIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SeparationTolerance", "0.1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.InternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.ExternalDriveIterations", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minPositionIters", "4" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SolverIterationCounts.minVelocityIters", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.SleepThreshold", "0.005" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxArticulation.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eX", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eY", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eZ", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eTWIST", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING1", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Motion.eSWING2", "eLOCKED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.LinearLimit.Value", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.TwistLimit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.SwingLimit.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eX.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eY.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eZ.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSWING.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eTWIST.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.ForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.Drive.eSLERP.Flags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DrivePosition", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.linear", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.DriveVelocity.angular", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxD6Joint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxFixedJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MinDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.MaxDistance", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Tolerance", "0.025" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxDistanceJoint.DistanceJointFlags", "eMAX_DISTANCE_ENABLED" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Upper", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.Limit.Lower", "-1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveVelocity", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveForceLimit", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.DriveGearRatio", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.RevoluteJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxRevoluteJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.ContactDistance", "0.01" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Upper", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.Limit.Lower", "-3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.PrismaticJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxPrismaticJoint.ProjectionAngularTolerance", "3.14159" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Actors.actor0", "8887040" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Actors.actor1", "8887456" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LocalPose.eACTOR0", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LocalPose.eACTOR1", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.force", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.BreakForce.torque", "3.40282e+038" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ConstraintFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Restitution", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Spring", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ContactDistance", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.YAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.LimitCone.ZAngle", "1.5708" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.SphericalJointFlags", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxSphericalJoint.ProjectionLinearTolerance", "1e+010" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.Name", "" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ClientBehaviorBits", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.MotionConstraintScaleBias.scale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.MotionConstraintScaleBias.bias", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.GlobalPose", "0 0 0 1 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.ExternalAcceleration", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.DampingCoefficient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.SolverFrequency", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.SleepLinearVelocity", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.InertiaScale", "1" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.FrictionCoefficient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.DragCoefficient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxCloth.CollisionMassScale", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ExternalAcceleration", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ParticleMass", "0.001" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.Restitution", "0.5" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.DynamicFriction", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.StaticFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.SimulationFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.MaxMotionDistance", "0.06" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.RestOffset", "0.004" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ContactOffset", "0.008" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.GridSize", "0.96" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ProjectionPlane", "0 0 1 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ParticleReadDataFlags", "ePOSITION_BUFFER|eFLAGS_BUFFER" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleSystem.ParticleBaseFlags", "eCOLLISION_WITH_DYNAMIC_ACTORS|eENABLED|ePER_PARTICLE_REST_OFFSET|ePER_PARTICLE_COLLISION_CACHE_HINT") + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ActorFlags", "eVISUALIZATION" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.DominanceGroup", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.OwnerClient", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.Damping", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ExternalAcceleration", "0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ParticleMass", "0.001" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.Restitution", "0.5" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.DynamicFriction", "0.05" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.StaticFriction", "0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.SimulationFilterData", "0 0 0 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.MaxMotionDistance", "0.06" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.RestOffset", "0.004" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ContactOffset", "0.008" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.GridSize", "0.64" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ProjectionPlane", "0 0 1 0" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.Stiffness", "20" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.Viscosity", "6" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.RestParticleDistance", "0.02" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ParticleReadDataFlags", "ePOSITION_BUFFER|eFLAGS_BUFFER" ) + DEFINE_REPX_DEFAULT_PROPERTY("PxParticleFluid.ParticleBaseFlags", "eCOLLISION_WITH_DYNAMIC_ACTORS|eENABLED|ePER_PARTICLE_REST_OFFSET|ePER_PARTICLE_COLLISION_CACHE_HINT") + DEFINE_REPX_DEFAULT_PROPERTY("PxAggregate.SelfCollision", "false" ) + DEFINE_REPX_DEFAULT_PROPERTY("THEEND", "false" ) diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCollection.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCollection.h new file mode 100644 index 0000000..2d521ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCollection.h @@ -0,0 +1,173 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_REPX_COLLECTION_H +#define SN_REPX_COLLECTION_H + +#include "common/PxTolerancesScale.h" +#include "extensions/PxRepXSerializer.h" + +namespace physx { namespace Sn { + + struct XmlNode; + + struct RepXCollectionItem + { + PxRepXObject liveObject; + XmlNode* descriptor; + RepXCollectionItem( PxRepXObject inItem = PxRepXObject(), XmlNode* inDescriptor = NULL ) + : liveObject( inItem ) + , descriptor( inDescriptor ) + { + } + }; + + struct RepXDefaultEntry + { + const char* name; + const char* value; + RepXDefaultEntry( const char* pn, const char* val ) : name( pn ), value( val ){} + }; + + /** + * The result of adding an object to the collection. + */ + struct RepXAddToCollectionResult + { + enum Enum + { + Success, + SerializerNotFound, + InvalidParameters, //Null data passed in. + AlreadyInCollection + }; + + PxSerialObjectId collectionId; + Enum result; + + RepXAddToCollectionResult( Enum inResult = Success, const PxSerialObjectId inId = 0 ) + : collectionId( inId ) + , result( inResult ) + { + } + bool isValid() { return result == Success && collectionId != 0; } + }; + /** + * A RepX collection contains a set of static data objects that can be transformed + * into live objects. It uses RepX serializer to do two transformations: + * live object <-> collection object (descriptor) + * collection object <-> file system. + * + * A live object is considered to be something live in the physics + * world such as a material or a rigidstatic. + * + * A collection object is a piece of data from which a live object + * of identical characteristics can be created. + * + * Clients need to pass PxCollection so that objects can resolve + * references. In addition, objects must be added in an order such that + * references can be resolved in the first place. So objects must be added + * to the collection *after* objects they are dependent upon. + * + * When deserializing from a file, the collection will allocate char*'s that will + * not be freed when the collection itself is freed. The user must be responsible + * for these character allocations. + */ + class RepXCollection + { + protected: + virtual ~RepXCollection(){} + + public: + virtual void destroy() = 0; + + /** + * Set the scale on this collection. The scale is saved with the collection. + * + * If the scale wasn't set, it will be invalid. + */ + virtual void setTolerancesScale( const PxTolerancesScale& inScale ) = 0; + + /** + * Get the scale that was set at collection creation time or at load time. + * If this is a loaded file and the source data does not contain a scale + * this value will be invalid (PxTolerancesScale::isValid()). + */ + virtual PxTolerancesScale getTolerancesScale() const = 0; + + /** + * Set the up vector on this collection. The up vector is saved with the collection. + * + * If the up vector wasn't set, it will be (0,0,0). + */ + virtual void setUpVector( const PxVec3& inUpVector ) = 0; + + /** + * If the up vector wasn't set, it will be (0,0,0). Else this will be the up vector + * optionally set when the collection was created. + */ + virtual PxVec3 getUpVector() const = 0; + + virtual const char* getVersion() = 0; + static const char* getLatestVersion(); + + //Necessary accessor functions for translation/upgrading. + virtual const RepXCollectionItem* begin() const = 0; + virtual const RepXCollectionItem* end() const = 0; + + + //Performs a deep copy of the repx node. + virtual XmlNode* copyRepXNode( const XmlNode* srcNode ) = 0; + + virtual void addCollectionItem( RepXCollectionItem inItem ) = 0; + + //Create a new repx node with this name. Its value is unset. + virtual XmlNode& createRepXNode( const char* name ) = 0; + + virtual RepXCollection& createCollection( const char* inVersionStr ) = 0; + //Release this when finished. + virtual XmlReaderWriter& createNodeEditor() = 0; + + virtual PxAllocatorCallback& getAllocator() = 0; + + virtual bool instantiateCollection( PxRepXInstantiationArgs& inArgs, PxCollection& inPxCollection ) = 0; + + + virtual RepXAddToCollectionResult addRepXObjectToCollection( const PxRepXObject& inObject, PxCollection* inCollection, PxRepXInstantiationArgs& inArgs ) = 0; + + /** + * Save this collection out to a file stream. Uses the RepX serialize to perform + * collection object->file conversions. + * + * /param[in] inStream Write-only stream to save collection out to. + */ + virtual void save( PxOutputStream& inStream ) = 0; + }; +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp new file mode 100644 index 0000000..b4a451a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.cpp @@ -0,0 +1,567 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPhysicsAPI.h" +#include "PxMetaDataObjects.h" +#include "SnPxStreamOperators.h" +#include "foundation/PxUtilities.h" +#include "SnXmlImpl.h" +#include "SnXmlSerializer.h" +#include "SnXmlDeserializer.h" +#include "SnRepXCoreSerializer.h" + +using namespace physx::Sn; +namespace physx { + typedef PxReadOnlyPropertyInfo TIncomingJointPropType; + + //************************************************************* + // Actual RepXSerializer implementations for PxMaterial + //************************************************************* + PxMaterial* PxMaterialRepXSerializer::allocateObject( PxRepXInstantiationArgs& inArgs ) + { + return inArgs.physics.createMaterial(0, 0, 0); + } + + PxRepXObject PxShapeRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + PxProfileAllocatorWrapper wrapper( inAllocator.getAllocator() ); + TReaderNameStack names( wrapper ); + PxProfileArray contexts( wrapper ); + bool hadError = false; + RepXVisitorReader theVisitor( names, contexts, inArgs, inReader, NULL, inAllocator, *inCollection, hadError ); + + PxArray materials; + PxGeometry* geometry = NULL; + parseShape( theVisitor, geometry, materials ); + if(hadError) + return PxRepXObject(); + PxShape *theShape = inArgs.physics.createShape( *geometry, materials.begin(), PxTo16(materials.size()) ); + + switch(geometry->getType()) + { + case PxGeometryType::eSPHERE : + static_cast(geometry)->~PxSphereGeometry(); + break; + case PxGeometryType::ePLANE : + static_cast(geometry)->~PxPlaneGeometry(); + break; + case PxGeometryType::eCAPSULE : + static_cast(geometry)->~PxCapsuleGeometry(); + break; + case PxGeometryType::eBOX : + static_cast(geometry)->~PxBoxGeometry(); + break; + case PxGeometryType::eCONVEXMESH : + static_cast(geometry)->~PxConvexMeshGeometry(); + break; + case PxGeometryType::eTRIANGLEMESH : + static_cast(geometry)->~PxTriangleMeshGeometry(); + break; + case PxGeometryType::eHEIGHTFIELD : + static_cast(geometry)->~PxHeightFieldGeometry(); + break; + case PxGeometryType::eTETRAHEDRONMESH : + static_cast(geometry)->~PxTetrahedronMeshGeometry(); + break; + case PxGeometryType::ePARTICLESYSTEM: + static_cast(geometry)->~PxParticleSystemGeometry(); + break; + case PxGeometryType::eHAIRSYSTEM: + static_cast(geometry)->~PxHairSystemGeometry(); + break; + case PxGeometryType::eCUSTOM : + static_cast(geometry)->~PxCustomGeometry(); + break; + + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + PX_ASSERT(0); + } + inAllocator.getAllocator().deallocate(geometry); + + bool ret = readAllProperties( inArgs, inReader, theShape, inAllocator, *inCollection ); + + return ret ? PxCreateRepXObject(theShape) : PxRepXObject(); + } + + //************************************************************* + // Actual RepXSerializer implementations for PxTriangleMesh + //************************************************************* + + template + inline void writeTriangle( MemoryBuffer& inTempBuffer, const Triangle& inTriangle ) + { + inTempBuffer << inTriangle.mIdx0 + << " " << inTriangle.mIdx1 + << " " << inTriangle.mIdx2; + } + + PxU32 materialAccess( const PxTriangleMesh* inMesh, PxU32 inIndex ) { return inMesh->getTriangleMaterialIndex( inIndex ); } + template + void writeDatatype( MemoryBuffer& inTempBuffer, const TDataType& inType ) { inTempBuffer << inType; } + + void PxBVH33TriangleMeshRepXSerializer::objectToFileImpl( const PxBVH33TriangleMesh* mesh, PxCollection* /*inCollection*/, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) + { + bool hasMatIndex = mesh->getTriangleMaterialIndex(0) != 0xffff; + PxU32 numVertices = mesh->getNbVertices(); + const PxVec3* vertices = mesh->getVertices(); + writeBuffer( inWriter, inTempBuffer, 2, vertices, numVertices, "Points", writePxVec3 ); + bool isU16 = mesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES ? true : false; + PxU32 triCount = mesh->getNbTriangles(); + const void* indices = mesh->getTriangles(); + if ( isU16 ) + writeBuffer( inWriter, inTempBuffer, 2, reinterpret_cast* >( indices ), triCount, "Triangles", writeTriangle ); + else + writeBuffer( inWriter, inTempBuffer, 2, reinterpret_cast* >( indices ), triCount, "Triangles", writeTriangle ); + if ( hasMatIndex ) + writeBuffer( inWriter, inTempBuffer, 6, mesh, materialAccess, triCount, "materialIndices", writeDatatype ); + + //Cooked stream + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = numVertices; + meshDesc.points.data = vertices; + meshDesc.points.stride = sizeof(PxVec3); + meshDesc.triangles.count = triCount; + meshDesc.triangles.data = indices; + meshDesc.triangles.stride = isU16?3*sizeof(PxU16):3*sizeof(PxU32); + + if(isU16) + { + meshDesc.triangles.stride = sizeof(PxU16)*3; + meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES; + } + else + { + meshDesc.triangles.stride = sizeof(PxU32)*3; + } + + if(hasMatIndex) + { + PxMaterialTableIndex* materialIndices = new PxMaterialTableIndex[triCount]; + for(PxU32 i = 0; i < triCount; i++) + materialIndices[i] = mesh->getTriangleMaterialIndex(i); + + meshDesc.materialIndices.data = materialIndices; + meshDesc.materialIndices.stride = sizeof(PxMaterialTableIndex); + + } + + if(inArgs.cooker != NULL) + { + TMemoryPoolManager theManager(mAllocator); + MemoryBuffer theTempBuf( &theManager ); + theTempBuf.clear(); + inArgs.cooker->cookTriangleMesh( meshDesc, theTempBuf ); + + writeBuffer( inWriter, inTempBuffer, 16, theTempBuf.mBuffer, theTempBuf.mWriteOffset, "CookedData", writeDatatype ); + } + + delete []meshDesc.materialIndices.data; + } + + PxRepXObject PxBVH33TriangleMeshRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* /*inCollection*/ ) + { + //We can't do a simple inverse; we *have* to cook data to get a mesh. + PxTriangleMeshDesc theDesc; + readStridedBufferProperty( inReader, "points", theDesc.points, inAllocator); + readStridedBufferProperty >( inReader, "triangles", theDesc.triangles, inAllocator); + PxU32 triCount; + readStridedBufferProperty( inReader, "materialIndices", theDesc.materialIndices, triCount, inAllocator); + PxStridedData cookedData; + cookedData.stride = sizeof(PxU8); + PxU32 dataSize; + readStridedBufferProperty( inReader, "CookedData", cookedData, dataSize, inAllocator); + + TMemoryPoolManager theManager(inAllocator.getAllocator()); + MemoryBuffer theTempBuf( &theManager ); + +// PxTriangleMesh* theMesh = NULL; + PxBVH33TriangleMesh* theMesh = NULL; + + if(dataSize != 0) + { + theTempBuf.write(cookedData.data, dataSize*sizeof(PxU8)); +// theMesh = inArgs.physics.createTriangleMesh( theTempBuf ); + theMesh = static_cast(inArgs.physics.createTriangleMesh( theTempBuf )); + } + + if(theMesh == NULL) + { + PX_ASSERT(inArgs.cooker); + theTempBuf.clear(); + + { + PxCookingParams params = inArgs.cooker->getParams(); + params.midphaseDesc = PxMeshMidPhase::eBVH33; + inArgs.cooker->setParams(params); + } + + inArgs.cooker->cookTriangleMesh( theDesc, theTempBuf ); +// theMesh = inArgs.physics.createTriangleMesh( theTempBuf ); + theMesh = static_cast(inArgs.physics.createTriangleMesh( theTempBuf )); + } + + return PxCreateRepXObject( theMesh ); + } + + void PxBVH34TriangleMeshRepXSerializer::objectToFileImpl( const PxBVH34TriangleMesh* mesh, PxCollection* /*inCollection*/, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) + { + bool hasMatIndex = mesh->getTriangleMaterialIndex(0) != 0xffff; + PxU32 numVertices = mesh->getNbVertices(); + const PxVec3* vertices = mesh->getVertices(); + writeBuffer( inWriter, inTempBuffer, 2, vertices, numVertices, "Points", writePxVec3 ); + bool isU16 = mesh->getTriangleMeshFlags() & PxTriangleMeshFlag::e16_BIT_INDICES ? true : false; + PxU32 triCount = mesh->getNbTriangles(); + const void* indices = mesh->getTriangles(); + if ( isU16 ) + writeBuffer( inWriter, inTempBuffer, 2, reinterpret_cast* >( indices ), triCount, "Triangles", writeTriangle ); + else + writeBuffer( inWriter, inTempBuffer, 2, reinterpret_cast* >( indices ), triCount, "Triangles", writeTriangle ); + if ( hasMatIndex ) + writeBuffer( inWriter, inTempBuffer, 6, mesh, materialAccess, triCount, "materialIndices", writeDatatype ); + + //Cooked stream + PxTriangleMeshDesc meshDesc; + meshDesc.points.count = numVertices; + meshDesc.points.data = vertices; + meshDesc.points.stride = sizeof(PxVec3); + meshDesc.triangles.count = triCount; + meshDesc.triangles.data = indices; + meshDesc.triangles.stride = isU16?3*sizeof(PxU16):3*sizeof(PxU32); + + if(isU16) + { + meshDesc.triangles.stride = sizeof(PxU16)*3; + meshDesc.flags |= PxMeshFlag::e16_BIT_INDICES; + } + else + { + meshDesc.triangles.stride = sizeof(PxU32)*3; + } + + if(hasMatIndex) + { + PxMaterialTableIndex* materialIndices = new PxMaterialTableIndex[triCount]; + for(PxU32 i = 0; i < triCount; i++) + materialIndices[i] = mesh->getTriangleMaterialIndex(i); + + meshDesc.materialIndices.data = materialIndices; + meshDesc.materialIndices.stride = sizeof(PxMaterialTableIndex); + + } + + if(inArgs.cooker != NULL) + { + TMemoryPoolManager theManager(mAllocator); + MemoryBuffer theTempBuf( &theManager ); + theTempBuf.clear(); + inArgs.cooker->cookTriangleMesh( meshDesc, theTempBuf ); + + writeBuffer( inWriter, inTempBuffer, 16, theTempBuf.mBuffer, theTempBuf.mWriteOffset, "CookedData", writeDatatype ); + } + + delete []meshDesc.materialIndices.data; + } + + PxRepXObject PxBVH34TriangleMeshRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* /*inCollection*/ ) + { + //We can't do a simple inverse; we *have* to cook data to get a mesh. + PxTriangleMeshDesc theDesc; + readStridedBufferProperty( inReader, "points", theDesc.points, inAllocator); + readStridedBufferProperty >( inReader, "triangles", theDesc.triangles, inAllocator); + PxU32 triCount; + readStridedBufferProperty( inReader, "materialIndices", theDesc.materialIndices, triCount, inAllocator); + PxStridedData cookedData; + cookedData.stride = sizeof(PxU8); + PxU32 dataSize; + readStridedBufferProperty( inReader, "CookedData", cookedData, dataSize, inAllocator); + + TMemoryPoolManager theManager(inAllocator.getAllocator()); + MemoryBuffer theTempBuf( &theManager ); + +// PxTriangleMesh* theMesh = NULL; + PxBVH34TriangleMesh* theMesh = NULL; + + if(dataSize != 0) + { + theTempBuf.write(cookedData.data, dataSize*sizeof(PxU8)); +// theMesh = inArgs.physics.createTriangleMesh( theTempBuf ); + theMesh = static_cast(inArgs.physics.createTriangleMesh( theTempBuf )); + } + + if(theMesh == NULL) + { + PX_ASSERT(inArgs.cooker); + theTempBuf.clear(); + + { + PxCookingParams params = inArgs.cooker->getParams(); + params.midphaseDesc = PxMeshMidPhase::eBVH34; + inArgs.cooker->setParams(params); + } + + inArgs.cooker->cookTriangleMesh( theDesc, theTempBuf ); +// theMesh = inArgs.physics.createTriangleMesh( theTempBuf ); + theMesh = static_cast(inArgs.physics.createTriangleMesh( theTempBuf )); + } + + return PxCreateRepXObject(theMesh); + } + + + //************************************************************* + // Actual RepXSerializer implementations for PxHeightField + //************************************************************* + void PxHeightFieldRepXSerializer::objectToFileImpl( const PxHeightField* inHeightField, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& /*inArgs*/) + { + PxHeightFieldDesc theDesc; + + theDesc.nbRows = inHeightField->getNbRows(); + theDesc.nbColumns = inHeightField->getNbColumns(); + theDesc.format = inHeightField->getFormat(); + theDesc.samples.stride = inHeightField->getSampleStride(); + theDesc.samples.data = NULL; + theDesc.convexEdgeThreshold = inHeightField->getConvexEdgeThreshold(); + theDesc.flags = inHeightField->getFlags(); + + PxU32 theCellCount = inHeightField->getNbRows() * inHeightField->getNbColumns(); + PxU32 theSampleStride = sizeof( PxHeightFieldSample ); + PxU32 theSampleBufSize = theCellCount * theSampleStride; + PxHeightFieldSample* theSamples = reinterpret_cast< PxHeightFieldSample*> ( inTempBuffer.mManager->allocate( theSampleBufSize ) ); + inHeightField->saveCells( theSamples, theSampleBufSize ); + theDesc.samples.data = theSamples; + writeAllProperties( &theDesc, inWriter, inTempBuffer, *inCollection ); + writeStridedBufferProperty( inWriter, inTempBuffer, "samples", theDesc.samples, theDesc.nbRows * theDesc.nbColumns, 6, writeHeightFieldSample); + inTempBuffer.mManager->deallocate( reinterpret_cast(theSamples) ); + } + + PxRepXObject PxHeightFieldRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + PX_ASSERT(inArgs.cooker); + PxHeightFieldDesc theDesc; + readAllProperties( inArgs, inReader, &theDesc, inAllocator, *inCollection ); + //Now read the data... + PxU32 count = 0; //ignored becaues numRows and numColumns tells the story + readStridedBufferProperty( inReader, "samples", theDesc.samples, count, inAllocator); + PxHeightField* retval = inArgs.cooker->createHeightField( theDesc, inArgs.physics.getPhysicsInsertionCallback() ); + return PxCreateRepXObject(retval); + } + + //************************************************************* + // Actual RepXSerializer implementations for PxConvexMesh + //************************************************************* + void PxConvexMeshRepXSerializer::objectToFileImpl( const PxConvexMesh* mesh, PxCollection* /*inCollection*/, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) + { + writeBuffer( inWriter, inTempBuffer, 2, mesh->getVertices(), mesh->getNbVertices(), "points", writePxVec3 ); + + if(inArgs.cooker != NULL) + { + //Cache cooked Data + PxConvexMeshDesc theDesc; + theDesc.points.data = mesh->getVertices(); + theDesc.points.stride = sizeof(PxVec3); + theDesc.points.count = mesh->getNbVertices(); + + theDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + TMemoryPoolManager theManager(mAllocator); + MemoryBuffer theTempBuf( &theManager ); + inArgs.cooker->cookConvexMesh( theDesc, theTempBuf ); + + writeBuffer( inWriter, inTempBuffer, 16, theTempBuf.mBuffer, theTempBuf.mWriteOffset, "CookedData", writeDatatype ); + } + + } + + //Conversion from scene object to descriptor. + PxRepXObject PxConvexMeshRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* /*inCollection*/) + { + PxConvexMeshDesc theDesc; + readStridedBufferProperty( inReader, "points", theDesc.points, inAllocator); + theDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + + PxStridedData cookedData; + cookedData.stride = sizeof(PxU8); + PxU32 dataSize; + readStridedBufferProperty( inReader, "CookedData", cookedData, dataSize, inAllocator); + + TMemoryPoolManager theManager(inAllocator.getAllocator()); + MemoryBuffer theTempBuf( &theManager ); + + PxConvexMesh* theMesh = NULL; + + if(dataSize != 0) + { + theTempBuf.write(cookedData.data, dataSize*sizeof(PxU8)); + theMesh = inArgs.physics.createConvexMesh( theTempBuf ); + } + + if(theMesh == NULL) + { + PX_ASSERT(inArgs.cooker); + theTempBuf.clear(); + + inArgs.cooker->cookConvexMesh( theDesc, theTempBuf ); + theMesh = inArgs.physics.createConvexMesh( theTempBuf ); + } + + return PxCreateRepXObject(theMesh); + } + + //************************************************************* + // Actual RepXSerializer implementations for PxRigidStatic + //************************************************************* + PxRigidStatic* PxRigidStaticRepXSerializer::allocateObject( PxRepXInstantiationArgs& inArgs ) + { + return inArgs.physics.createRigidStatic( PxTransform(PxIdentity) ); + } + + //************************************************************* + // Actual RepXSerializer implementations for PxRigidDynamic + //************************************************************* + PxRigidDynamic* PxRigidDynamicRepXSerializer::allocateObject( PxRepXInstantiationArgs& inArgs ) + { + return inArgs.physics.createRigidDynamic( PxTransform(PxIdentity) ); + } + + //************************************************************* + // Actual RepXSerializer implementations for PxArticulationReducedCoordinate + //************************************************************* + void PxArticulationReducedCoordinateRepXSerializer::objectToFileImpl(const PxArticulationReducedCoordinate* inObj, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& /*inArgs*/) + { + TNameStack nameStack(inTempBuffer.mManager->mWrapper); + Sn::TArticulationLinkLinkMap linkMap(inTempBuffer.mManager->mWrapper); + RepXVisitorWriter writer(nameStack, inWriter, inObj, inTempBuffer, *inCollection, &linkMap); + RepXPropertyFilter > theOp(writer); + visitAllProperties(theOp); + } + PxArticulationReducedCoordinate* PxArticulationReducedCoordinateRepXSerializer::allocateObject(PxRepXInstantiationArgs& inArgs) { return inArgs.physics.createArticulationReducedCoordinate(); } + + //************************************************************* + // Actual RepXSerializer implementations for PxAggregate + //************************************************************* + void PxAggregateRepXSerializer::objectToFileImpl( const PxAggregate* data, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& /*inArgs*/) + { + PxArticulationLink *link = NULL; + inWriter.addAndGotoChild( "Actors" ); + for(PxU32 i = 0; i < data->getNbActors(); ++i) + { + PxActor* actor; + + if(data->getActors(&actor, 1, i)) + { + link = actor->is(); + } + + if(link && !link->getInboundJoint() ) + { + writeProperty( inWriter, *inCollection, inTempBuffer, "PxArticulationRef", &link->getArticulation()); + } + else if( !link ) + { + PxSerialObjectId theId = 0; + + theId = inCollection->getId( *actor ); + if( theId == 0 ) + theId = static_cast(size_t(actor)); + + writeProperty( inWriter, *inCollection, inTempBuffer, "PxActorRef", theId ); + } + } + + inWriter.leaveChild( ); + + writeProperty( inWriter, *inCollection, inTempBuffer, "NumActors", data->getNbActors() ); + writeProperty( inWriter, *inCollection, inTempBuffer, "MaxNbActors", data->getMaxNbActors() ); + writeProperty(inWriter, *inCollection, inTempBuffer, "MaxNbShapes", data->getMaxNbShapes()); + writeProperty( inWriter, *inCollection, inTempBuffer, "SelfCollision", data->getSelfCollision() ); + + writeAllProperties( data, inWriter, inTempBuffer, *inCollection ); + } + + PxRepXObject PxAggregateRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + PxU32 numActors; + readProperty( inReader, "NumActors", numActors ); + PxU32 maxNbActors; + readProperty( inReader, "MaxNbActors", maxNbActors ); + + PxU32 maxNbShapes; + readProperty(inReader, "MaxNbShapes", maxNbShapes); + + bool selfCollision; + bool ret = readProperty( inReader, "SelfCollision", selfCollision ); + + PxAggregate* theAggregate = inArgs.physics.createAggregate(maxNbActors, maxNbShapes, selfCollision); + ret &= readAllProperties( inArgs, inReader, theAggregate, inAllocator, *inCollection ); + + inReader.pushCurrentContext(); + if ( inReader.gotoChild( "Actors" ) ) + { + inReader.pushCurrentContext(); + for( bool matSuccess = inReader.gotoFirstChild(); matSuccess; + matSuccess = inReader.gotoNextSibling() ) + { + const char* actorType = inReader.getCurrentItemName(); + if ( 0 == physx::Pxstricmp( actorType, "PxActorRef" ) ) + { + PxActor *actor = NULL; + ret &= readReference( inReader, *inCollection, actor ); + + if(actor) + { + PxScene *currScene = actor->getScene(); + if(currScene) + { + currScene->removeActor(*actor); + } + theAggregate->addActor(*actor); + } + } + else if ( 0 == physx::Pxstricmp( actorType, "PxArticulationRef" ) ) + { + PxArticulationReducedCoordinate* articulation = NULL; + ret &= readReference( inReader, *inCollection, articulation ); + if(articulation) + { + PxScene *currScene = articulation->getScene(); + if(currScene) + { + currScene->removeArticulation(*articulation); + } + theAggregate->addArticulation(*articulation); + } + } + } + inReader.popCurrentContext(); + inReader.leaveChild(); + } + inReader.popCurrentContext(); + + return ret ? PxCreateRepXObject(theAggregate) : PxRepXObject(); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.h new file mode 100644 index 0000000..e28217a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXCoreSerializer.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#ifndef SN_REPX_CORE_SERIALIZER_H +#define SN_REPX_CORE_SERIALIZER_H +/** \addtogroup RepXSerializers + @{ +*/ +#include "foundation/PxSimpleTypes.h" +#include "SnRepXSerializerImpl.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + + class XmlReader; + class XmlMemoryAllocator; + class XmlWriter; + class MemoryBuffer; + + struct PxMaterialRepXSerializer : RepXSerializerImpl + { + PxMaterialRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual PxMaterial* allocateObject( PxRepXInstantiationArgs& ); + }; + + struct PxShapeRepXSerializer : public RepXSerializerImpl + { + PxShapeRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxShape* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + + struct PxBVH33TriangleMeshRepXSerializer : public RepXSerializerImpl + { + PxBVH33TriangleMeshRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual void objectToFileImpl( const PxBVH33TriangleMesh*, PxCollection*, XmlWriter&, MemoryBuffer&, PxRepXInstantiationArgs& ); + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxBVH33TriangleMesh* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + struct PxBVH34TriangleMeshRepXSerializer : public RepXSerializerImpl + { + PxBVH34TriangleMeshRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual void objectToFileImpl( const PxBVH34TriangleMesh*, PxCollection*, XmlWriter&, MemoryBuffer&, PxRepXInstantiationArgs& ); + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxBVH34TriangleMesh* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + + struct PxHeightFieldRepXSerializer : public RepXSerializerImpl + { + PxHeightFieldRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual void objectToFileImpl( const PxHeightField*, PxCollection*, XmlWriter&, MemoryBuffer&, PxRepXInstantiationArgs& ); + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxHeightField* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + + struct PxConvexMeshRepXSerializer : public RepXSerializerImpl + { + PxConvexMeshRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual void objectToFileImpl( const PxConvexMesh*, PxCollection*, XmlWriter&, MemoryBuffer&, PxRepXInstantiationArgs& ); + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxConvexMesh* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + + struct PxRigidStaticRepXSerializer : public RepXSerializerImpl + { + PxRigidStaticRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual PxRigidStatic* allocateObject( PxRepXInstantiationArgs& ); + }; + + struct PxRigidDynamicRepXSerializer : public RepXSerializerImpl + { + PxRigidDynamicRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual PxRigidDynamic* allocateObject( PxRepXInstantiationArgs& ); + }; + + + struct PxArticulationReducedCoordinateRepXSerializer : public RepXSerializerImpl + { + PxArticulationReducedCoordinateRepXSerializer(PxAllocatorCallback& inCallback) : RepXSerializerImpl(inCallback) {} + virtual void objectToFileImpl(const PxArticulationReducedCoordinate*, PxCollection*, XmlWriter&, MemoryBuffer&, PxRepXInstantiationArgs&); + virtual PxArticulationReducedCoordinate* allocateObject(PxRepXInstantiationArgs&); + }; + + struct PxAggregateRepXSerializer : public RepXSerializerImpl + { + PxAggregateRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual void objectToFileImpl( const PxAggregate*, PxCollection*, XmlWriter& , MemoryBuffer&, PxRepXInstantiationArgs& ); + virtual PxRepXObject fileToObject( XmlReader&, XmlMemoryAllocator&, PxRepXInstantiationArgs&, PxCollection* ); + virtual PxAggregate* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif +/** @} */ + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXSerializerImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXSerializerImpl.h new file mode 100644 index 0000000..4c29ced --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXSerializerImpl.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_REPX_SERIALIZER_IMPL_H +#define SN_REPX_SERIALIZER_IMPL_H + +#include "foundation/PxUserAllocated.h" +#include "SnXmlVisitorWriter.h" +#include "SnXmlVisitorReader.h" + +namespace physx { + using namespace Sn; + + /** + * The repx serializer impl takes the raw, untyped repx extension interface + * and implements the simpler functions plus does the reinterpret-casts required + * for any object to implement the serializer safely. + */ + template + struct RepXSerializerImpl : public PxRepXSerializer, PxUserAllocated + { + protected: + RepXSerializerImpl( const RepXSerializerImpl& inOther ); + RepXSerializerImpl& operator=( const RepXSerializerImpl& inOther ); + + public: + PxAllocatorCallback& mAllocator; + + RepXSerializerImpl( PxAllocatorCallback& inAllocator ) + : mAllocator( inAllocator ) + { + } + + virtual const char* getTypeName() { return PxTypeInfo::name(); } + + virtual void objectToFile( const PxRepXObject& inLiveObject, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& inArgs ) + { + const TLiveType* theObj = reinterpret_cast( inLiveObject.serializable ); + objectToFileImpl( theObj, inCollection, inWriter, inTempBuffer, inArgs ); + } + + virtual PxRepXObject fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + TLiveType* theObj( allocateObject( inArgs ) ); + if ( theObj ) + if(fileToObjectImpl( theObj, inReader, inAllocator, inArgs, inCollection )) + return PxCreateRepXObject(theObj); + return PxRepXObject(); + } + + virtual void objectToFileImpl( const TLiveType* inObj, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& /*inArgs*/) + { + writeAllProperties( inObj, inWriter, inTempBuffer, *inCollection ); + } + + virtual bool fileToObjectImpl( TLiveType* inObj, XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + return readAllProperties( inArgs, inReader, inObj, inAllocator, *inCollection ); + } + + virtual TLiveType* allocateObject( PxRepXInstantiationArgs& inArgs ) = 0; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp new file mode 100644 index 0000000..d1348e4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnRepXUpgrader.cpp @@ -0,0 +1,462 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "SnXmlImpl.h" +#include "SnXmlReader.h" +#include "SnXmlMemoryAllocator.h" +#include "SnRepXCollection.h" +#include "SnRepXUpgrader.h" + +using namespace physx::profile; + +namespace physx { namespace Sn { + + #define DEFINE_REPX_DEFAULT_PROPERTY( name, val ) RepXDefaultEntry( name, val ), + + static RepXDefaultEntry gRepX1_0Defaults[] = { + #include "SnRepX1_0Defaults.h" + }; + static PxU32 gNumRepX1_0Default = sizeof( gRepX1_0Defaults ) / sizeof ( *gRepX1_0Defaults ); + + static RepXDefaultEntry gRepX3_1Defaults[] = { + #include "SnRepX3_1Defaults.h" + }; + static PxU32 gNumRepX3_1Defaults = sizeof( gRepX3_1Defaults ) / sizeof ( *gRepX3_1Defaults ); + + static RepXDefaultEntry gRepX3_2Defaults[] = { + #include "SnRepX3_2Defaults.h" + }; + static PxU32 gNumRepX3_2Defaults = sizeof( gRepX3_2Defaults ) / sizeof ( *gRepX3_2Defaults ); + + inline const char* nextPeriod( const char* str ) + { + for( ++str; str && *str && *str != '.'; ++str ); //empty loop intentional + return str; + } + + inline bool safeStrEq(const char* lhs, const char* rhs) + { + if (lhs == rhs) + return true; + //If they aren't equal, and one of them is null, + //then they can't be equal. + //This is assuming that the null char* is not equal to + //the empty "" char*. + if (!lhs || !rhs) + return false; + + return ::strcmp(lhs, rhs) == 0; + } + + typedef PxProfileHashMap TNameOffsetMap; + + void setMissingPropertiesToDefault( XmlNode* topNode, XmlReaderWriter& editor, const RepXDefaultEntry* defaults, PxU32 numDefaults, TNameOffsetMap& map ) + { + for ( XmlNode* child = topNode->mFirstChild; child != NULL; child = child->mNextSibling ) + setMissingPropertiesToDefault( child, editor, defaults, numDefaults, map ); + + const TNameOffsetMap::Entry* entry( map.find( topNode->mName ) ); + if ( entry ) + { + XmlReaderWriter& theReader( editor ); + theReader.setNode( *topNode ); + char nameBuffer[512] = {0}; + size_t nameLen = strlen( topNode->mName ); + //For each default property entry for this node type. + for ( const RepXDefaultEntry* item = defaults + entry->second; Pxstrncmp( item->name, topNode->mName, nameLen ) == 0; ++item ) + { + bool childAdded = false; + const char* nameStart = item->name + nameLen; + ++nameStart; + theReader.pushCurrentContext(); + const char* str = nameStart; + while( *str ) + { + const char *period = nextPeriod( str ); + size_t len = size_t(PxMin( period - str, ptrdiff_t(1023) )); //can't be too careful these days. + PxMemCopy( nameBuffer, str, PxU32(len) ); + nameBuffer[len] = 0; + if ( theReader.gotoChild( nameBuffer ) == false ) + { + childAdded = true; + theReader.addOrGotoChild( nameBuffer ); + } + if (*period ) + str = period + 1; + else + str = period; + } + if ( childAdded ) + theReader.setCurrentItemValue( item->value ); + theReader.popCurrentContext(); + } + } + } + + + static void setMissingPropertiesToDefault( RepXCollection& collection, XmlReaderWriter& editor, const RepXDefaultEntry* defaults, PxU32 numDefaults ) + { + PxProfileAllocatorWrapper wrapper( collection.getAllocator() ); + //Release all strings at once, instead of piece by piece + XmlMemoryAllocatorImpl alloc( collection.getAllocator() ); + //build a hashtable of the initial default value strings. + TNameOffsetMap nameOffsets( wrapper ); + for ( PxU32 idx = 0; idx < numDefaults; ++idx ) + { + const RepXDefaultEntry& item( defaults[idx] ); + size_t nameLen = 0; + const char* periodPtr = nextPeriod (item.name); + for ( ; periodPtr && *periodPtr; ++periodPtr ) if( *periodPtr == '.' ) break; + if ( periodPtr == NULL || *periodPtr != '.' ) continue; + nameLen = size_t(periodPtr - item.name); + char* newMem = reinterpret_cast(alloc.allocate( PxU32(nameLen + 1) )); + PxMemCopy( newMem, item.name, PxU32(nameLen) ); + newMem[nameLen] = 0; + + if ( nameOffsets.find( newMem ) ) + alloc.deallocate( reinterpret_cast(newMem) ); + else + nameOffsets.insert( newMem, idx ); + } + //Run through each collection item, and recursively find it and its children + //If an object's name is in the hash map, check and add any properties that don't exist. + //else return. + for ( const RepXCollectionItem* item = collection.begin(), *end = collection.end(); item != end; ++ item ) + { + RepXCollectionItem theItem( *item ); + setMissingPropertiesToDefault( theItem.descriptor, editor, defaults, numDefaults, nameOffsets ); + } + } + + struct RecursiveTraversal + { + RecursiveTraversal(XmlReaderWriter& editor): mEditor(editor) {} + void traverse() + { + mEditor.pushCurrentContext(); + updateNode(); + for(bool exists = mEditor.gotoFirstChild(); exists; exists = mEditor.gotoNextSibling()) + traverse(); + mEditor.popCurrentContext(); + } + virtual void updateNode() = 0; + virtual ~RecursiveTraversal() {} + XmlReaderWriter& mEditor; + protected: + RecursiveTraversal& operator=(const RecursiveTraversal&){return *this;} + }; + + + RepXCollection& RepXUpgrader::upgrade10CollectionTo3_1Collection(RepXCollection& src) + { + XmlReaderWriter& editor( src.createNodeEditor() ); + setMissingPropertiesToDefault(src, editor, gRepX1_0Defaults, gNumRepX1_0Default ); + + + RepXCollection* dest = &src.createCollection("3.1.1"); + + for ( const RepXCollectionItem* item = src.begin(), *end = src.end(); item != end; ++ item ) + { + //either src or dest could do the copy operation, it doesn't matter who does it. + RepXCollectionItem newItem( item->liveObject, src.copyRepXNode( item->descriptor ) ); + editor.setNode( *const_cast( newItem.descriptor ) ); + //Some old files have this name in their system. + editor.renameProperty( "MassSpaceInertia", "MassSpaceInertiaTensor" ); + editor.renameProperty( "SleepEnergyThreshold", "SleepThreshold" ); + + if ( strstr( newItem.liveObject.typeName, "Joint" ) || strstr( newItem.liveObject.typeName, "joint" ) ) + { + //Joints changed format a bit. old joints looked like: + /* + 1627536 + 1628368 + 0 0 0 1 0.5 0.5 0.5 + 0 0 0 1 0.3 0.3 0.3*/ + //New joints look like: + /* + + 58320336 + 56353568 + + + 0 0 0 1 0.5 0.5 0.5 + 0 0 0 1 0.3 0.3 0.3 + + */ + const char* actor0, *actor1, *lp0, *lp1; + editor.readAndRemoveProperty( "Actor0", actor0 ); + editor.readAndRemoveProperty( "Actor1", actor1 ); + editor.readAndRemoveProperty( "LocalPose0", lp0 ); + editor.readAndRemoveProperty( "LocalPose1", lp1 ); + + editor.addOrGotoChild( "Actors" ); + editor.writePropertyIfNotEmpty( "actor0", actor0 ); + editor.writePropertyIfNotEmpty( "actor1", actor1 ); + editor.leaveChild(); + + editor.addOrGotoChild( "LocalPose" ); + editor.writePropertyIfNotEmpty( "eACTOR0", lp0 ); + editor.writePropertyIfNotEmpty( "eACTOR1", lp1 ); + editor.leaveChild(); + } + + + + //now desc owns the new node. Collections share a single allocation pool, however, + //which will get destroyed when all the collections referencing it are destroyed themselves. + //Data on nodes is shared between nodes, but the node structure itself is allocated. + dest->addCollectionItem( newItem ); + } + editor.release(); + src.destroy(); + return *dest; + } + + RepXCollection& RepXUpgrader::upgrade3_1CollectionTo3_2Collection(RepXCollection& src) + { + XmlReaderWriter& editor( src.createNodeEditor() ); + setMissingPropertiesToDefault(src, editor, gRepX3_1Defaults, gNumRepX3_1Defaults ); + + RepXCollection* dest = &src.createCollection("3.2.0"); + + for ( const RepXCollectionItem* item = src.begin(), *end = src.end(); item != end; ++ item ) + { + //either src or dest could do the copy operation, it doesn't matter who does it. + RepXCollectionItem newItem( item->liveObject, src.copyRepXNode( item->descriptor ) ); + editor.setNode( *const_cast( newItem.descriptor ) ); + + if ( strstr( newItem.liveObject.typeName, "PxMaterial" ) ) + { + editor.removeChild( "DynamicFrictionV" ); + editor.removeChild( "StaticFrictionV" ); + editor.removeChild( "dirOfAnisotropy" ); + } + //now desc owns the new node. Collections share a single allocation pool, however, + //which will get destroyed when all the collections referencing it are destroyed themselves. + //Data on nodes is shared between nodes, but the node structure itself is allocated. + dest->addCollectionItem( newItem ); + } + editor.release(); + src.destroy(); + return *dest; + } + + RepXCollection& RepXUpgrader::upgrade3_2CollectionTo3_3Collection(RepXCollection& src) + { + XmlReaderWriter& editor( src.createNodeEditor() ); + setMissingPropertiesToDefault(src, editor, gRepX3_2Defaults, gNumRepX3_2Defaults ); + + RepXCollection* dest = &src.createCollection("3.3.0"); + + + + struct RenameSpringToStiffness : public RecursiveTraversal + { + RenameSpringToStiffness(XmlReaderWriter& editor_): RecursiveTraversal(editor_) {} + + void updateNode() + { + mEditor.renameProperty("Spring", "Stiffness"); + mEditor.renameProperty("TangentialSpring", "TangentialStiffness"); + } + }; + + + struct UpdateArticulationSwingLimit : public RecursiveTraversal + { + UpdateArticulationSwingLimit(XmlReaderWriter& editor_): RecursiveTraversal(editor_) {} + + void updateNode() + { + if(!Pxstricmp(mEditor.getCurrentItemName(), "yLimit") && !Pxstricmp(mEditor.getCurrentItemValue(), "0")) + mEditor.setCurrentItemValue("0.785398"); + + if(!Pxstricmp(mEditor.getCurrentItemName(), "zLimit") && !Pxstricmp(mEditor.getCurrentItemValue(), "0")) + mEditor.setCurrentItemValue("0.785398"); + + if(!Pxstricmp(mEditor.getCurrentItemName(), "TwistLimit")) + { + mEditor.gotoFirstChild(); + PxReal lower = PxReal(strtod(mEditor.getCurrentItemValue(), NULL)); + mEditor.gotoNextSibling(); + PxReal upper = PxReal(strtod(mEditor.getCurrentItemValue(), NULL)); + mEditor.leaveChild(); + if(lower>=upper) + { + mEditor.writePropertyIfNotEmpty("lower", "-0.785398"); + mEditor.writePropertyIfNotEmpty("upper", "0.785398"); + } + } + } + }; + + + for ( const RepXCollectionItem* item = src.begin(), *end = src.end(); item != end; ++ item ) + { + //either src or dest could do the copy operation, it doesn't matter who does it. + RepXCollectionItem newItem( item->liveObject, src.copyRepXNode( item->descriptor ) ); + + if ( strstr( newItem.liveObject.typeName, "PxCloth" ) || strstr( newItem.liveObject.typeName, "PxClothFabric" ) ) + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "Didn't suppot PxCloth upgrate from 3.2 to 3.3! "); + continue; + } + + if ( strstr( newItem.liveObject.typeName, "PxParticleSystem" ) || strstr( newItem.liveObject.typeName, "PxParticleFluid" ) ) + { + editor.setNode( *const_cast( newItem.descriptor ) ); + editor.renameProperty( "PositionBuffer", "Positions" ); + editor.renameProperty( "VelocityBuffer", "Velocities" ); + editor.renameProperty( "RestOffsetBuffer", "RestOffsets" ); + } + + if(strstr(newItem.liveObject.typeName, "PxPrismaticJoint" ) + || strstr(newItem.liveObject.typeName, "PxRevoluteJoint") + || strstr(newItem.liveObject.typeName, "PxSphericalJoint") + || strstr(newItem.liveObject.typeName, "PxD6Joint") + || strstr(newItem.liveObject.typeName, "PxArticulation")) + { + editor.setNode( *const_cast( newItem.descriptor ) ); + RenameSpringToStiffness(editor).traverse(); + } + + if(strstr(newItem.liveObject.typeName, "PxArticulation")) + { + editor.setNode( *const_cast( newItem.descriptor ) ); + UpdateArticulationSwingLimit(editor).traverse(); + } + + + + //now dest owns the new node. Collections share a single allocation pool, however, + //which will get destroyed when all the collections referencing it are destroyed themselves. + //Data on nodes is shared between nodes, but the node structure itself is allocated. + + dest->addCollectionItem( newItem ); + + } + editor.release(); + src.destroy(); + + return *dest; + } + + RepXCollection& RepXUpgrader::upgrade3_3CollectionTo3_4Collection(RepXCollection& src) + { + RepXCollection* dest = &src.createCollection("3.4.0"); + + for ( const RepXCollectionItem* item = src.begin(), *end = src.end(); item != end; ++ item ) + { + if(strstr(item->liveObject.typeName, "PxTriangleMesh")) + { + PxRepXObject newMeshRepXObj("PxBVH33TriangleMesh", item->liveObject.serializable, item->liveObject.id); + XmlNode* newMeshNode = src.copyRepXNode( item->descriptor ); + newMeshNode->mName = "PxBVH33TriangleMesh"; + RepXCollectionItem newMeshItem(newMeshRepXObj, newMeshNode); + dest->addCollectionItem( newMeshItem ); + continue; + } + + RepXCollectionItem newItem( item->liveObject, src.copyRepXNode( item->descriptor ) ); + dest->addCollectionItem( newItem ); + } + src.destroy(); + return *dest; + } + + RepXCollection& RepXUpgrader::upgrade3_4CollectionTo4_0Collection(RepXCollection& src) + { + RepXCollection* dest = &src.createCollection("4.0.0"); + + for (const RepXCollectionItem* item = src.begin(), *end = src.end(); item != end; ++item) + { + if (strstr(item->liveObject.typeName, "PxParticleFluid") || + strstr(item->liveObject.typeName, "PxParticleSystem") || + strstr(item->liveObject.typeName, "PxClothFabric") || + strstr(item->liveObject.typeName, "PxCloth")) + { + continue; + } + + RepXCollectionItem newItem(item->liveObject, src.copyRepXNode(item->descriptor)); + dest->addCollectionItem(newItem); + } + src.destroy(); + return *dest; + } + + RepXCollection& RepXUpgrader::upgradeCollection(RepXCollection& src) + { + const char* srcVersion = src.getVersion(); + if( safeStrEq( srcVersion, RepXCollection::getLatestVersion() )) + return src; + + typedef RepXCollection& (*UPGRADE_FUNCTION)(RepXCollection& src); + + struct Upgrade { const char* versionString; UPGRADE_FUNCTION upgradeFunction; }; + + static const Upgrade upgradeTable[] = + { + { "1.0", upgrade10CollectionTo3_1Collection }, + { "3.1", NULL }, + { "3.1.1", upgrade3_1CollectionTo3_2Collection }, + { "3.2.0", upgrade3_2CollectionTo3_3Collection }, + { "3.3.0", NULL }, + { "3.3.1", NULL }, + { "3.3.2", NULL }, + { "3.3.3", NULL }, + { "3.3.4", upgrade3_3CollectionTo3_4Collection }, + { "3.4.0", NULL }, + { "3.4.1", NULL }, + { "3.4.2", upgrade3_4CollectionTo4_0Collection } + }; //increasing order and complete + + const PxU32 upgradeTableSize = sizeof(upgradeTable)/sizeof(upgradeTable[0]); + + PxU32 repxVersion = UINT16_MAX; + + for (PxU32 i=0; i + class SimpleXmlWriterImpl : public SimpleXmlWriter + { + PxProfileAllocatorWrapper mWrapper; + TStreamType& mStream; + SimpleXmlWriterImpl( const SimpleXmlWriterImpl& inOther ); + SimpleXmlWriterImpl& operator=( const SimpleXmlWriterImpl& inOther ); + PxProfileArray mTags; + bool mTagOpen; + PxU32 mInitialTagDepth; + public: + + SimpleXmlWriterImpl( TStreamType& inStream, PxAllocatorCallback& inAllocator, PxU32 inInitialTagDepth = 0 ) + : mWrapper( inAllocator ) + , mStream( inStream ) + , mTags( mWrapper ) + , mTagOpen( false ) + , mInitialTagDepth( inInitialTagDepth ) + { + } + virtual ~SimpleXmlWriterImpl() + { + while( mTags.size() ) + endTag(); + } + PxU32 tabCount() { return mTags.size() + mInitialTagDepth; } + + void writeTabs( PxU32 inSize ) + { + inSize += mInitialTagDepth; + for ( PxU32 idx =0; idx < inSize; ++idx ) + mStream << "\t"; + } + void beginTag( const char* inTagname ) + { + closeTag(); + writeTabs(mTags.size()); + mTags.pushBack( inTagname ); + mStream << "<" << inTagname; + mTagOpen = true; + } + void addAttribute( const char* inName, const char* inValue ) + { + PX_ASSERT( mTagOpen ); + mStream << " " << inName << "=" << "\"" << inValue << "\""; + } + void closeTag(bool useNewline = true) + { + if ( mTagOpen ) + { + mStream << " " << ">"; + if (useNewline ) + mStream << "\n"; + } + mTagOpen = false; + } + void doEndOpenTag() + { + mStream << "" << "\n"; + } + void endTag() + { + PX_ASSERT( mTags.size() ); + if ( mTagOpen ) + mStream << " " << "/>" << "\n"; + else + { + writeTabs(mTags.size()-1); + doEndOpenTag(); + } + mTagOpen = false; + mTags.popBack(); + } + + static bool IsNormalizableWhitespace(char c) { return c == 0x9 || c == 0xA || c == 0xD; } + static bool IsValidXmlCharacter(char c) { return IsNormalizableWhitespace(c) || c >= 0x20; } + + void addContent( const char* inContent ) + { + closeTag(false); + //escape xml + for( ; *inContent; inContent++ ) + { + switch (*inContent) + { + case '<': + mStream << "<"; + break; + case '>': + mStream << ">"; + break; + case '&': + mStream << "&"; + break; + case '\'': + mStream << "'"; + break; + case '"': + mStream << """; + break; + default: + if (IsValidXmlCharacter(*inContent)) { + if (IsNormalizableWhitespace(*inContent)) + { + char s[32]; + Pxsnprintf(s, 32, "&#x%02X;", unsigned(*inContent)); + mStream << s; + } + else + mStream << *inContent; + } + break; + } + } + } + + void writeContentTag( const char* inTag, const char* inContent ) + { + beginTag( inTag ); + addContent( inContent ); + doEndOpenTag(); + mTags.popBack(); + } + void insertXml( const char* inXml ) + { + closeTag(); + mStream << inXml; + } + }; + + struct BeginTag + { + const char* mTagName; + BeginTag( const char* inTagName ) + : mTagName( inTagName ) { } + }; + + struct EndTag + { + EndTag() {} + }; + + struct Att + { + const char* mAttName; + const char* mAttValue; + Att( const char* inAttName, const char* inAttValue ) + : mAttName( inAttName ) + , mAttValue( inAttValue ) { } + }; + + struct Content + { + const char* mContent; + Content( const char* inContent ) + : mContent( inContent ) { } + }; + + + struct ContentTag + { + const char* mTagName; + const char* mContent; + ContentTag( const char* inTagName, const char* inContent ) + : mTagName( inTagName ) + , mContent( inContent ) { } + }; + + inline SimpleXmlWriter& operator<<( SimpleXmlWriter& inWriter, const BeginTag& inTag ) { inWriter.beginTag( inTag.mTagName ); return inWriter; } + inline SimpleXmlWriter& operator<<( SimpleXmlWriter& inWriter, const EndTag& inTag ) { PX_UNUSED(inTag); inWriter.endTag(); return inWriter; } + inline SimpleXmlWriter& operator<<( SimpleXmlWriter& inWriter, const Att& inTag ) { inWriter.addAttribute(inTag.mAttName, inTag.mAttValue); return inWriter; } + inline SimpleXmlWriter& operator<<( SimpleXmlWriter& inWriter, const Content& inTag ) { inWriter.addContent(inTag.mContent); return inWriter; } + inline SimpleXmlWriter& operator<<( SimpleXmlWriter& inWriter, const ContentTag& inTag ) { inWriter.writeContentTag(inTag.mTagName, inTag.mContent); return inWriter; } + + inline void writeProperty( SimpleXmlWriter& inWriter, MemoryBuffer& tempBuffer, const char* inPropName ) + { + PxU8 data = 0; + tempBuffer.write( &data, sizeof(PxU8) ); + inWriter.writeContentTag( inPropName, reinterpret_cast( tempBuffer.mBuffer ) ); + tempBuffer.clear(); + } + + template + inline void writeProperty( SimpleXmlWriter& inWriter, MemoryBuffer& tempBuffer, const char* inPropName, TDataType inValue ) + { + tempBuffer << inValue; + writeProperty( inWriter, tempBuffer, inPropName ); + } +} } +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlDeserializer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlDeserializer.h new file mode 100644 index 0000000..a9eafd8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlDeserializer.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_DESERIALIZER_H +#define SN_XML_DESERIALIZER_H + +#include "SnXmlVisitorReader.h" + +namespace physx { namespace Sn { + + //Definitions needed internally in the Serializer headers. + template + struct Triangle + { + TTriIndexElem mIdx0; + TTriIndexElem mIdx1; + TTriIndexElem mIdx2; + Triangle( TTriIndexElem inIdx0 = 0, TTriIndexElem inIdx1 = 0, TTriIndexElem inIdx2 = 0) + : mIdx0( inIdx0 ) + , mIdx1( inIdx1 ) + , mIdx2( inIdx2 ) + { + } + }; + + struct XmlMemoryAllocateMemoryPoolAllocator + { + XmlMemoryAllocator* mAllocator; + XmlMemoryAllocateMemoryPoolAllocator( XmlMemoryAllocator* inAlloc ) : mAllocator( inAlloc ) {} + + PxU8* allocate( PxU32 inSize ) { return mAllocator->allocate( inSize ); } + void deallocate( PxU8* inMem ) { mAllocator->deallocate( inMem ); } + }; + + inline bool isEmpty(const char *s) + { + while (*s != '\0') + { + if (!isspace(*s)) + return false; + s++; + } + return true; + } + + inline void strtoLong( Triangle& ioDatatype,const char*& ioData ) + { + strto( ioDatatype.mIdx0, ioData ); + strto( ioDatatype.mIdx1, ioData ); + strto( ioDatatype.mIdx2, ioData ); + } + + inline void strtoLong( PxHeightFieldSample& ioDatatype,const char*& ioData ) + { + PxU32 tempData; + strto( tempData, ioData ); + if ( isBigEndian() ) + { + PxU32& theItem(tempData); + PxU32 theDest = 0; + PxU8* theReadPtr( reinterpret_cast< PxU8* >( &theItem ) ); + PxU8* theWritePtr( reinterpret_cast< PxU8* >( &theDest ) ); + //A height field sample is a 16 bit number + //followed by two bytes. + + //We write this out as a 32 bit integer, LE. + //Thus, on a big endian, we need to move the bytes + //around a bit. + //LE - 1 2 3 4 + //BE - 4 3 2 1 - after convert from xml number + //Correct BE - 2 1 3 4, just like LE but with the 16 number swapped + theWritePtr[0] = theReadPtr[2]; + theWritePtr[1] = theReadPtr[3]; + theWritePtr[2] = theReadPtr[1]; + theWritePtr[3] = theReadPtr[0]; + theItem = theDest; + } + ioDatatype = *reinterpret_cast( &tempData ); + } + + template + inline void readStridedFlagsProperty( XmlReader& ioReader, const char* inPropName, TDataType*& outData, PxU32& outStride, PxU32& outCount, XmlMemoryAllocator& inAllocator, + const PxU32ToName* inConversions) + { + const char* theSrcData; + outStride = sizeof( TDataType ); + outData = NULL; + outCount = 0; + if ( ioReader.read( inPropName, theSrcData ) ) + { + XmlMemoryAllocateMemoryPoolAllocator tempAllocator( &inAllocator ); + MemoryBufferBase tempBuffer( &tempAllocator ); + + if ( theSrcData ) + { + static PxU32 theCount = 0; + ++theCount; + char* theStartData = const_cast< char*>( copyStr( &tempAllocator, theSrcData ) ); + char* aData = strtok(theStartData, " \n"); + while( aData ) + { + TDataType tempValue; + stringToFlagsType( aData, inAllocator, tempValue, inConversions ); + aData = strtok(NULL," \n"); + tempBuffer.write( &tempValue, sizeof(TDataType) ); + } + outData = reinterpret_cast< TDataType* >( tempBuffer.mBuffer ); + outCount = tempBuffer.mWriteOffset / sizeof( TDataType ); + tempAllocator.deallocate( reinterpret_cast(theStartData) ); + } + tempBuffer.releaseBuffer(); + } + } + + template + inline void readStridedBufferProperty( XmlReader& ioReader, const char* inPropName, TDataType*& outData, PxU32& outStride, PxU32& outCount, XmlMemoryAllocator& inAllocator) + { + const char* theSrcData; + outStride = sizeof( TDataType ); + outData = NULL; + outCount = 0; + if ( ioReader.read( inPropName, theSrcData ) ) + { + XmlMemoryAllocateMemoryPoolAllocator tempAllocator( &inAllocator ); + MemoryBufferBase tempBuffer( &tempAllocator ); + + if ( theSrcData ) + { + static PxU32 theCount = 0; + ++theCount; + char* theStartData = const_cast< char*>( copyStr( &tempAllocator, theSrcData ) ); + const char* theData = theStartData; + while( !isEmpty(theData) ) + { + //These buffers are whitespace delimited. + TDataType theType; + strtoLong( theType, theData ); + tempBuffer.write( &theType, sizeof(theType) ); + } + outData = reinterpret_cast< TDataType* >( tempBuffer.mBuffer ); + outCount = tempBuffer.mWriteOffset / sizeof( TDataType ); + tempAllocator.deallocate( reinterpret_cast(theStartData) ); + } + tempBuffer.releaseBuffer(); + } + } + + template + inline void readStridedBufferProperty( XmlReader& ioReader, const char* inPropName, PxStridedData& ioData, PxU32& outCount, XmlMemoryAllocator& inAllocator) + { + TDataType* tempData = NULL; + readStridedBufferProperty( ioReader, inPropName, tempData, ioData.stride, outCount, inAllocator ); + ioData.data = tempData; + } + + template + inline void readStridedBufferProperty( XmlReader& ioReader, const char* inPropName, PxTypedStridedData& ioData, PxU32& outCount, XmlMemoryAllocator& inAllocator) + { + TDataType* tempData = NULL; + readStridedBufferProperty( ioReader, inPropName, tempData, ioData.stride, outCount, inAllocator ); + ioData.data = reinterpret_cast( tempData ); + } + + template + inline void readStridedBufferProperty( XmlReader& ioReader, const char* inPropName, PxBoundedData& ioData, XmlMemoryAllocator& inAllocator) + { + return readStridedBufferProperty( ioReader, inPropName, ioData, ioData.count, inAllocator ); + } + +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlImpl.h new file mode 100644 index 0000000..a15fe54 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlImpl.h @@ -0,0 +1,243 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_IMPL_H +#define SN_XML_IMPL_H + +#include "SnXmlMemoryPool.h" +#include "foundation/PxString.h" +#include "foundation/PxMemory.h" + +namespace physx { namespace Sn { + +typedef CMemoryPoolManager TMemoryPoolManager; + +namespace snXmlImpl { + + inline PxU32 strLen( const char* inStr ) + { + PxU32 len = 0; + if ( inStr ) + { + while ( *inStr ) + { + ++len; + ++inStr; + } + } + return len; + } +} + inline const char* copyStr( PxAllocatorCallback& inAllocator, const char* inStr ) + { + if ( inStr && *inStr ) + { + PxU32 theLen = snXmlImpl::strLen( inStr ); + //The memory will never be released by repx. If you want it released, you need to pass in a custom allocator + //that tracks all allocations and releases unreleased allocations yourself. + char* dest = reinterpret_cast( inAllocator.allocate( theLen + 1, "Repx::const char*", __FILE__, __LINE__ ) ); + PxMemCopy( dest, inStr, theLen ); + dest[theLen] = 0; + return dest; + } + return ""; + } + + template + inline const char* copyStr( TManagerType* inMgr, const char* inStr ) + { + if ( inStr && *inStr ) + { + PxU32 theLen = snXmlImpl::strLen( inStr ); + char* dest = reinterpret_cast( inMgr->allocate( theLen + 1 ) ); + PxMemCopy( dest, inStr, theLen ); + dest[theLen] = 0; + return dest; + } + return ""; + } + + inline void releaseStr( TMemoryPoolManager* inMgr, const char* inStr, PxU32 ) + { + if ( inStr && *inStr ) + { + inMgr->deallocate( reinterpret_cast< PxU8* >( const_cast( inStr ) ) ); + } + } + + inline void releaseStr( TMemoryPoolManager* inMgr, const char* inStr ) + { + if ( inStr && *inStr ) + { + PxU32 theLen = snXmlImpl::strLen( inStr ); + releaseStr( inMgr, inStr, theLen ); + } + } + + struct XmlNode + { + const char* mName; //Never released until all collections are released + const char* mData; //Never released until all collections are released + + XmlNode* mNextSibling; + XmlNode* mPreviousSibling; + XmlNode* mFirstChild; + XmlNode* mParent; + XmlNode( const XmlNode& ); + XmlNode& operator=( const XmlNode& ); + + PX_INLINE void initPtrs() + { + mNextSibling = NULL; + mPreviousSibling = NULL; + mFirstChild = NULL; + mParent = NULL; + } + + PX_INLINE XmlNode( const char* inName = "", const char* inData = "" ) + : mName( inName ) + , mData( inData ) + { initPtrs(); } + + void addChild( XmlNode* inItem ) + { + inItem->mParent = this; + if ( mFirstChild == NULL ) + mFirstChild = inItem; + else + { + XmlNode* theNode = mFirstChild; + //Follow the chain till the end. + while( theNode->mNextSibling != NULL ) + theNode = theNode->mNextSibling; + theNode->mNextSibling = inItem; + inItem->mPreviousSibling = theNode; + } + } + + PX_INLINE XmlNode* findChildByName( const char* inName ) + { + for ( XmlNode* theNode = mFirstChild; theNode; theNode = theNode->mNextSibling ) + { + XmlNode* theRepXNode = theNode; + if ( physx::Pxstricmp( theRepXNode->mName, inName ) == 0 ) + return theNode; + } + return NULL; + } + + PX_INLINE void orphan() + { + if ( mParent ) + { + if ( mParent->mFirstChild == this ) + mParent->mFirstChild = mNextSibling; + } + if ( mPreviousSibling ) + mPreviousSibling->mNextSibling = mNextSibling; + if ( mNextSibling ) + mNextSibling->mPreviousSibling = mPreviousSibling; + if ( mFirstChild ) + mFirstChild->mParent = NULL; + initPtrs(); + } + }; + + inline XmlNode* allocateRepXNode( TMemoryPoolManager* inManager, const char* inName, const char* inData ) + { + XmlNode* retval = inManager->allocate(); + retval->mName = copyStr( inManager, inName ); + retval->mData = copyStr( inManager, inData ); + return retval; + } + + inline void release( TMemoryPoolManager* inManager, XmlNode* inNode ) + { + //We *don't* release the strings associated with the node + //because they could be shared. Instead, we just let them 'leak' + //in some sense, at least until the memory manager itself is deleted. + //DO NOT UNCOMMENT THE LINES BELOW!! + //releaseStr( inManager, inNode->mName ); + //releaseStr( inManager, inNode->mData ); + inManager->deallocate( inNode ); + } + + static PX_INLINE void releaseNodeAndChildren( TMemoryPoolManager* inManager, XmlNode* inNode ) + { + if ( inNode->mFirstChild ) + { + XmlNode* childNode( inNode->mFirstChild ); + while( childNode ) + { + XmlNode* _node( childNode ); + childNode = _node->mNextSibling; + releaseNodeAndChildren( inManager, _node ); + } + } + inNode->orphan(); + release( inManager, inNode ); + } + + static XmlNode* copyRepXNodeAndSiblings( TMemoryPoolManager* inManager, const XmlNode* inNode, XmlNode* inParent ); + + static XmlNode* copyRepXNode( TMemoryPoolManager* inManager, const XmlNode* inNode, XmlNode* inParent = NULL ) + { + XmlNode* newNode( allocateRepXNode( inManager, NULL, NULL ) ); + newNode->mName = inNode->mName; //Some light structural sharing + newNode->mData = inNode->mData; //Some light structural sharing + newNode->mParent = inParent; + if ( inNode->mFirstChild ) + newNode->mFirstChild = copyRepXNodeAndSiblings( inManager, inNode->mFirstChild, newNode ); + return newNode; + } + + static XmlNode* copyRepXNodeAndSiblings( TMemoryPoolManager* inManager, const XmlNode* inNode, XmlNode* inParent ) + { + XmlNode* sibling = inNode->mNextSibling; + if ( sibling ) sibling = copyRepXNodeAndSiblings( inManager, sibling, inParent ); + XmlNode* newNode = copyRepXNode( inManager, inNode, inParent ); + newNode->mNextSibling = sibling; + if ( sibling ) sibling->mPreviousSibling = newNode; + return newNode; + } + + inline bool isBigEndian() { int i = 1; return *(reinterpret_cast(&i))==0; } + + + struct NameStackEntry + { + const char* mName; + bool mOpen; + NameStackEntry( const char* nm ) : mName( nm ), mOpen( false ) {} + }; + + typedef PxProfileArray TNameStack; +} } + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryAllocator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryAllocator.h new file mode 100644 index 0000000..a05db28 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryAllocator.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_MEMORY_ALLOCATOR_H +#define SN_XML_MEMORY_ALLOCATOR_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx { + + class XmlMemoryAllocator + { + protected: + virtual ~XmlMemoryAllocator(){} + public: + virtual PxU8* allocate(PxU32 inSize) = 0; + virtual void deallocate( PxU8* inMem ) = 0; + virtual PxAllocatorCallback& getAllocator() = 0; + template + TObjectType* allocate() + { + TObjectType* retval = reinterpret_cast< TObjectType* >( allocate( sizeof( TObjectType ) ) ); + new (retval) TObjectType(); + return retval; + } + + template + TObjectType* allocate(const TArgType &arg) + { + TObjectType* retval = reinterpret_cast< TObjectType* >( allocate( sizeof( TObjectType ) ) ); + new (retval) TObjectType(arg); + return retval; + } + + template + void deallocate( TObjectType* inObject ) + { + deallocate( reinterpret_cast( inObject ) ); + } + template + inline TObjectType* batchAllocate(PxU32 inCount ) + { + TObjectType* retval = reinterpret_cast( allocate( sizeof(TObjectType) * inCount ) ); + for ( PxU32 idx = 0; idx < inCount; ++idx ) + { + new (retval + idx) TObjectType(); + } + return retval; + } + + template + inline TObjectType* batchAllocate(PxU32 inCount, const TArgType &arg) + { + TObjectType* retval = reinterpret_cast( allocate( sizeof(TObjectType) * inCount ) ); + for ( PxU32 idx = 0; idx < inCount; ++idx ) + { + new (retval + idx) TObjectType(arg); + } + return retval; + } + + + //Duplicate function definition for gcc. + template + inline TObjectType* batchAllocate(TObjectType*, PxU32 inCount ) + { + TObjectType* retval = reinterpret_cast( allocate( sizeof(TObjectType) * inCount ) ); + for ( PxU32 idx = 0; idx < inCount; ++idx ) + { + new (retval + idx) TObjectType(); + } + return retval; + } + }; + + struct XmlMemoryAllocatorImpl : public XmlMemoryAllocator + { + Sn::TMemoryPoolManager mManager; + + XmlMemoryAllocatorImpl( PxAllocatorCallback& inAllocator ) + : mManager( inAllocator ) + { + } + XmlMemoryAllocatorImpl &operator=(const XmlMemoryAllocatorImpl &); + virtual PxAllocatorCallback& getAllocator() + { + return mManager.getWrapper().getAllocator(); + } + + virtual PxU8* allocate(PxU32 inSize ) + { + if ( !inSize ) + return NULL; + + return mManager.allocate( inSize ); + } + virtual void deallocate( PxU8* inMem ) + { + if ( inMem ) + mManager.deallocate( inMem ); + } + }; +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPool.h new file mode 100644 index 0000000..a693bf8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPool.h @@ -0,0 +1,315 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_MEMORY_POOL_H +#define SN_XML_MEMORY_POOL_H + +#include "foundation/PxAssert.h" +#include "foundation/PxArray.h" +#include "PxProfileAllocatorWrapper.h" + +namespace physx { + + using namespace physx::profile; + + /** + * Linked list used to store next node ptr. + */ + struct SMemPoolNode + { + SMemPoolNode* mNextNode; + }; + + /** + * Template arguments are powers of two. + * A very fast memory pool that is not memory efficient. It contains a vector of pointers + * to blocks of memory along with a linked list of free sections. All sections are + * of the same size so allocating memory is very fast, there isn't a linear search + * through blocks of indeterminate size. It also means there is memory wasted + * when objects aren't sized to powers of two. + */ + template + class CMemoryPool + { + typedef PxProfileArray TPxU8PtrList; + + PxProfileAllocatorWrapper& mWrapper; + TPxU8PtrList mAllMemory; + SMemPoolNode* mFirstFreeNode; + public: + CMemoryPool(PxProfileAllocatorWrapper& inWrapper) + : mWrapper( inWrapper ) + , mAllMemory( inWrapper ) + , mFirstFreeNode( NULL ) + {} + ~CMemoryPool() + { + TPxU8PtrList::ConstIterator theEnd = mAllMemory.end(); + for ( TPxU8PtrList::ConstIterator theIter = mAllMemory.begin(); + theIter != theEnd; + ++theIter ) + { + PxU8* thePtr = *theIter; + mWrapper.getAllocator().deallocate( thePtr ); + } + mAllMemory.clear(); + mFirstFreeNode = NULL; + } + //Using deallocated memory to hold the pointers to the next amount of memory. + PxU8* allocate() + { + if ( mFirstFreeNode ) + { + PxU8* retval = reinterpret_cast(mFirstFreeNode); + mFirstFreeNode = mFirstFreeNode->mNextNode; + return retval; + } + PxU32 itemSize = GetItemSize(); + PxU32 itemCount = 1 << TItemCount; + //No free nodes, make some more. + PxU8* retval = reinterpret_cast(mWrapper.getAllocator().allocate( itemCount * itemSize, "RepX fixed-size memory pool", __FILE__, __LINE__ )); + PxU8* dataPtr = retval + itemSize; + //Free extra chunks + for( PxU32 idx = 1; idx < itemCount; ++idx, dataPtr += itemSize ) + deallocate( dataPtr ); + mAllMemory.pushBack(retval); + return retval; + } + void deallocate( PxU8* inData ) + { + SMemPoolNode* nodePtr = reinterpret_cast(inData); + nodePtr->mNextNode = mFirstFreeNode; + mFirstFreeNode = nodePtr; + } + //We have to have at least a pointer's worth of memory + inline PxU32 GetItemSize() { return sizeof(SMemPoolNode) << TItemSize; } + }; + + typedef PxU32 TMemAllocSizeType; + + struct SVariableMemPoolNode : SMemPoolNode + { + TMemAllocSizeType mSize; + SVariableMemPoolNode* NextNode() { return static_cast< SVariableMemPoolNode* >( mNextNode ); } + }; + + /** + * Manages variable sized allocations. + * Keeps track of freed allocations in a insertion sorted + * list. Allocating new memory traverses the list linearly. + * This object will split nodes if the node is more than + * twice as large as the request memory allocation. + */ + class CVariableMemoryPool + { + typedef PxProfileHashMap TFreeNodeMap; + typedef PxProfileArray TPxU8PtrList; + PxProfileAllocatorWrapper& mWrapper; + TPxU8PtrList mAllMemory; + TFreeNodeMap mFreeNodeMap; + PxU32 mMinAllocationSize; + + CVariableMemoryPool &operator=(const CVariableMemoryPool &); + + public: + CVariableMemoryPool(PxProfileAllocatorWrapper& inWrapper, PxU32 inMinAllocationSize = 0x20 ) + : mWrapper( inWrapper ) + , mAllMemory( inWrapper ) + , mFreeNodeMap( inWrapper) + , mMinAllocationSize( inMinAllocationSize ) + {} + + ~CVariableMemoryPool() + { + TPxU8PtrList::ConstIterator theEnd = mAllMemory.end(); + for ( TPxU8PtrList::ConstIterator theIter = mAllMemory.begin(); + theIter != theEnd; + ++theIter ) + { + PxU8* thePtr = *theIter; + mWrapper.getAllocator().deallocate( thePtr ); + } + mAllMemory.clear(); + mFreeNodeMap.clear(); + } + PxU8* MarkMem( PxU8* inMem, TMemAllocSizeType inSize ) + { + PX_ASSERT( inSize >= sizeof( SVariableMemPoolNode ) ); + SVariableMemPoolNode* theMem = reinterpret_cast( inMem ); + theMem->mSize = inSize; + return reinterpret_cast< PxU8* >( theMem + 1 ); + } + //Using deallocated memory to hold the pointers to the next amount of memory. + PxU8* allocate( PxU32 size ) + { + //Ensure we can place the size of the memory at the start + //of the memory block. + //Kai: to reduce the size of hash map, the requested size is aligned to 128 bytes + PxU32 theRequestedSize = (size + sizeof(SVariableMemPoolNode) + 127) & ~127; + + TFreeNodeMap::Entry* entry = const_cast( mFreeNodeMap.find( theRequestedSize ) ); + if ( NULL != entry ) + { + SVariableMemPoolNode* theNode = entry->second; + PX_ASSERT( NULL != theNode ); + PX_ASSERT( theNode->mSize == theRequestedSize ); + entry->second = theNode->NextNode(); + if (entry->second == NULL) + mFreeNodeMap.erase( theRequestedSize ); + + return reinterpret_cast< PxU8* >( theNode + 1 ); + } + + if ( theRequestedSize < mMinAllocationSize ) + theRequestedSize = mMinAllocationSize; + + //No large enough free nodes, make some more. + PxU8* retval = reinterpret_cast(mWrapper.getAllocator().allocate( size_t(theRequestedSize), "RepX variable sized memory pool", __FILE__, __LINE__ )); + //If we allocated it, we free it. + mAllMemory.pushBack( retval ); + return MarkMem( retval, theRequestedSize ); + } + + //The size is stored at the beginning of the memory block. + void deallocate( PxU8* inData ) + { + SVariableMemPoolNode* theData = reinterpret_cast< SVariableMemPoolNode* >( inData ) - 1; + TMemAllocSizeType theSize = theData->mSize; + AddFreeMem( reinterpret_cast< PxU8* >( theData ), theSize ); + } + + void CheckFreeListInvariant( SVariableMemPoolNode* inNode ) + { + if ( inNode && inNode->mNextNode ) + { + PX_ASSERT( inNode->mSize <= inNode->NextNode()->mSize ); + } + } + + void AddFreeMem( PxU8* inMemory, TMemAllocSizeType inSize ) + { + PX_ASSERT( inSize >= sizeof( SVariableMemPoolNode ) ); + SVariableMemPoolNode* theNewNode = reinterpret_cast< SVariableMemPoolNode* >( inMemory ); + theNewNode->mNextNode = NULL; + theNewNode->mSize = inSize; + TFreeNodeMap::Entry* entry = const_cast( mFreeNodeMap.find( inSize ) ); + if (NULL != entry) + { + theNewNode->mNextNode = entry->second; + entry->second = theNewNode; + } + else + { + mFreeNodeMap.insert( inSize, theNewNode ); + } + } + }; + + /** + * The manager keeps a list of memory pools for different sizes of allocations. + * Anything too large simply gets allocated using the new operator. + * This doesn't mark the memory with the size of the allocated memory thus + * allowing much more efficient allocation of small items. For large enough + * allocations, it does mark the size. + * + * When using as a general memory manager, you need to wrap this class with + * something that actually does mark the returned allocation with the size + * of the allocation. + */ + class CMemoryPoolManager + { + CMemoryPoolManager &operator=(const CMemoryPoolManager &); + + public: + PxProfileAllocatorWrapper mWrapper; + + CVariableMemoryPool mVariablePool; + CMemoryPoolManager( PxAllocatorCallback& inAllocator ) + : mWrapper( inAllocator ) + , mVariablePool( mWrapper ) + { + } + PxProfileAllocatorWrapper& getWrapper() { return mWrapper; } + inline PxU8* allocate( PxU32 inSize ) + { + return mVariablePool.allocate( inSize ); + } + inline void deallocate( PxU8* inMemory ) + { + if ( inMemory == NULL ) + return; + + mVariablePool.deallocate(inMemory); + } + /** + * allocate an object. Calls constructor on the new memory. + */ + template + inline TObjectType* allocate() + { + TObjectType* retval = reinterpret_cast( allocate( sizeof(TObjectType) ) ); + new (retval)TObjectType(); + return retval; + } + + /** + * deallocate an object calling the destructor on the object. + * This *must* be the concrete type, it cannot be a generic type. + */ + template + inline void deallocate( TObjectType* inObject ) + { + inObject->~TObjectType(); + deallocate( reinterpret_cast(inObject) ); + } + + /** + * allocate an object. Calls constructor on the new memory. + */ + template + inline TObjectType* BatchAllocate(PxU32 inCount ) + { + TObjectType* retval = reinterpret_cast( allocate( sizeof(TObjectType) * inCount ) ); + return retval; + } + + /** + * deallocate an object calling the destructor on the object. + * This *must* be the concrete type, it cannot be a generic type. + */ + template + inline void BatchDeallocate( TObjectType* inObject, PxU32 inCount ) + { + PX_UNUSED(inCount); + deallocate( reinterpret_cast(inObject) ); + } + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPoolStreams.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPoolStreams.h new file mode 100644 index 0000000..b55e42c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlMemoryPoolStreams.h @@ -0,0 +1,172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_MEMORY_POOL_STREAMS_H +#define SN_XML_MEMORY_POOL_STREAMS_H + +#include "foundation/PxTransform.h" +#include "foundation/PxIO.h" +#include "SnXmlMemoryPool.h" + +namespace physx { + + template + struct XmlDefaultValue + { + bool force_compile_error; + }; + + +#define XML_DEFINE_DEFAULT_VALUE(type, defVal ) \ + template<> \ + struct XmlDefaultValue \ + { \ + type getDefaultValue() { return type(defVal); } \ + }; + + XML_DEFINE_DEFAULT_VALUE(PxU8, 0) + XML_DEFINE_DEFAULT_VALUE(PxI8, 0) + XML_DEFINE_DEFAULT_VALUE(PxU16, 0) + XML_DEFINE_DEFAULT_VALUE(PxI16, 0) + XML_DEFINE_DEFAULT_VALUE(PxU32, 0) + XML_DEFINE_DEFAULT_VALUE(PxI32, 0) + XML_DEFINE_DEFAULT_VALUE(PxU64, 0) + XML_DEFINE_DEFAULT_VALUE(PxI64, 0) + XML_DEFINE_DEFAULT_VALUE(PxF32, 0) + XML_DEFINE_DEFAULT_VALUE(PxF64, 0) + +#undef XML_DEFINE_DEFAULT_VALUE + + template<> + struct XmlDefaultValue + { + PxVec3 getDefaultValue() { return PxVec3( 0,0,0 ); } + }; + + template<> + struct XmlDefaultValue + { + PxTransform getDefaultValue() { return PxTransform(PxIdentity); } + }; + + template<> + struct XmlDefaultValue + { + PxQuat getDefaultValue() { return PxQuat(PxIdentity); } + }; + +/** + * Mapping of PxOutputStream to a memory pool manager. + * Allows write-then-read semantics of a set of + * data. Can safely write up to 4GB of data; then you + * will silently fail... + */ + +template +struct MemoryBufferBase : public PxOutputStream, public PxInputStream +{ + TAllocatorType* mManager; + mutable PxU32 mWriteOffset; + mutable PxU32 mReadOffset; + PxU8* mBuffer; + PxU32 mCapacity; + + + MemoryBufferBase( TAllocatorType* inManager ) + : mManager( inManager ) + , mWriteOffset( 0 ) + , mReadOffset( 0 ) + , mBuffer( NULL ) + , mCapacity( 0 ) + { + } + virtual ~MemoryBufferBase() + { + mManager->deallocate( mBuffer ); + } + PxU8* releaseBuffer() + { + clear(); + mCapacity = 0; + PxU8* retval(mBuffer); + mBuffer = NULL; + return retval; + } + void clear() + { + mWriteOffset = mReadOffset = 0; + } + + virtual PxU32 read(void* dest, PxU32 count) + { + bool fits = ( mReadOffset + count ) <= mWriteOffset; + PX_ASSERT( fits ); + if ( fits ) + { + PxMemCopy( dest, mBuffer + mReadOffset, count ); + mReadOffset += count; + return count; + } + return 0; + } + + inline void checkCapacity( PxU32 inNewCapacity ) + { + if ( mCapacity < inNewCapacity ) + { + PxU32 newCapacity = 32; + while( newCapacity < inNewCapacity ) + newCapacity = newCapacity << 1; + + PxU8* newData( mManager->allocate( newCapacity ) ); + if ( mWriteOffset ) + PxMemCopy( newData, mBuffer, mWriteOffset ); + mManager->deallocate( mBuffer ); + mBuffer = newData; + mCapacity = newCapacity; + } + } + + virtual PxU32 write(const void* src, PxU32 count) + { + checkCapacity( mWriteOffset + count ); + PxMemCopy( mBuffer + mWriteOffset, src, count ); + mWriteOffset += count; + return count; + } +}; + +class MemoryBuffer : public MemoryBufferBase +{ +public: + MemoryBuffer( CMemoryPoolManager* inManager ) : MemoryBufferBase( inManager ) {} +}; + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlReader.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlReader.h new file mode 100644 index 0000000..0149f27 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlReader.h @@ -0,0 +1,130 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_READER_H +#define SN_XML_READER_H + +#include "foundation/PxSimpleTypes.h" +#include "extensions/PxRepXSimpleType.h" + +namespace physx { + namespace Sn { struct XmlNode; } + + /** + * Reader used to read data out of the repx format. + */ + class XmlReader + { + protected: + virtual ~XmlReader(){} + public: + /** Read a key-value pair out of the database */ + virtual bool read( const char* inName, const char*& outData ) = 0; + /** Read an object id out of the database */ + virtual bool read( const char* inName, PxSerialObjectId& outId ) = 0; + /** Goto a child element by name. That child becomes this reader's context */ + virtual bool gotoChild( const char* inName ) = 0; + /** Goto the first child regardless of name */ + virtual bool gotoFirstChild() = 0; + /** Goto the next sibling regardless of name */ + virtual bool gotoNextSibling() = 0; + /** Count all children of the current object */ + virtual PxU32 countChildren() = 0; + /** Get the name of the current item */ + virtual const char* getCurrentItemName() = 0; + /** Get the value of the current item */ + virtual const char* getCurrentItemValue() = 0; + /** Leave the current child */ + virtual bool leaveChild() = 0; + /** Get reader for the parental object */ + virtual XmlReader* getParentReader() = 0; + + /** + * Ensures we don't leave the reader in an odd state + * due to not leaving a given child + */ + virtual void pushCurrentContext() = 0; + /** Pop the current context back to where it during push*/ + virtual void popCurrentContext() = 0; + }; + + //Used when upgrading a repx collection + class XmlReaderWriter : public XmlReader + { + public: + //Clears the stack of nodes (push/pop current node reset) + //and sets the current node to inNode. + virtual void setNode( Sn::XmlNode& node ) = 0; + //If the child exists, add it. + //the either way goto that child. + virtual void addOrGotoChild( const char* name ) = 0; + //Value is copied into the collection, inValue has no further references + //to it. + virtual void setCurrentItemValue( const char* value ) = 0; + //Removes the child but does not release the char* name or char* data ptrs. + //Those pointers are never released and are shared among collections. + //Thus copying nodes is cheap and safe. + virtual bool removeChild( const char* name ) = 0; + virtual void release() = 0; + + bool renameProperty( const char* oldName, const char* newName ) + { + if ( gotoChild( oldName ) ) + { + const char* value = getCurrentItemValue(); + leaveChild(); + removeChild( oldName ); + addOrGotoChild( newName ); + setCurrentItemValue( value ); + leaveChild(); + return true; + } + return false; + } + bool readAndRemoveProperty( const char* name, const char*& outValue ) + { + bool retval = read( name, outValue ); + if ( retval ) removeChild( name ); + return retval; + } + + bool writePropertyIfNotEmpty( const char* name, const char* value ) + { + if ( value && *value ) + { + addOrGotoChild( name ); + setCurrentItemValue( value ); + leaveChild(); + return true; + } + return false; + } + }; + +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp new file mode 100644 index 0000000..a5344a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerialization.cpp @@ -0,0 +1,831 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. +#include "SnXmlImpl.h" +#include "foundation/PxHash.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxString.h" +#include "SnSimpleXmlWriter.h" +#include "foundation/PxSort.h" +#include "PsFastXml.h" +#include "SnXmlMemoryPool.h" +#include "PxExtensionMetaDataObjects.h" +#include "SnXmlVisitorWriter.h" +#include "SnXmlVisitorReader.h" +#include "SnXmlMemoryAllocator.h" +#include "SnXmlStringToType.h" +#include "SnRepXCollection.h" +#include "SnRepXUpgrader.h" +#include "../SnSerializationRegistry.h" +#include "CmCollection.h" + +using namespace physx; +using namespace Sn; + +using namespace physx::profile; //for the foundation wrapper system. + +namespace physx { namespace Sn { + + class XmlNodeWriter : public SimpleXmlWriter + { + XmlMemoryAllocatorImpl& mParseAllocator; + XmlNode* mCurrentNode; + XmlNode* mTopNode; + PxU32 mTabCount; + + public: + XmlNodeWriter( XmlMemoryAllocatorImpl& inAllocator, PxU32 inTabCount = 0 ) + : mParseAllocator( inAllocator ) + , mCurrentNode( NULL ) + , mTopNode( NULL ) + , mTabCount( inTabCount ) + {} + XmlNodeWriter& operator=(const XmlNodeWriter&); + virtual ~XmlNodeWriter(){} + void onNewNode( XmlNode* newNode ) + { + if ( mCurrentNode != NULL ) + mCurrentNode->addChild( newNode ); + if ( mTopNode == NULL ) + mTopNode = newNode; + mCurrentNode = newNode; + ++mTabCount; + } + + XmlNode* getTopNode() const { return mTopNode; } + + virtual void beginTag( const char* inTagname ) + { + onNewNode( allocateRepXNode( &mParseAllocator.mManager, inTagname, NULL ) ); + } + virtual void endTag() + { + if ( mCurrentNode ) + mCurrentNode = mCurrentNode->mParent; + if ( mTabCount ) + --mTabCount; + } + virtual void addAttribute( const char*, const char* ) + { + PX_ASSERT( false ); + } + virtual void writeContentTag( const char* inTag, const char* inContent ) + { + onNewNode( allocateRepXNode( &mParseAllocator.mManager, inTag, inContent ) ); + endTag(); + } + virtual void addContent( const char* inContent ) + { + if ( mCurrentNode->mData ) + releaseStr( &mParseAllocator.mManager, mCurrentNode->mData ); + mCurrentNode->mData = copyStr( &mParseAllocator.mManager, inContent ); + } + virtual PxU32 tabCount() { return mTabCount; } + }; + + struct XmlWriterImpl : public XmlWriter + { + PxU32 mTagDepth; + SimpleXmlWriter* mWriter; + MemoryBuffer* mMemBuffer; + + XmlWriterImpl( SimpleXmlWriter* inWriter, MemoryBuffer* inMemBuffer ) + : mTagDepth( 0 ) + , mWriter( inWriter ) + , mMemBuffer( inMemBuffer ) + { + } + ~XmlWriterImpl() + { + while( mTagDepth ) + { + --mTagDepth; + mWriter->endTag(); + } + } + virtual void write( const char* inName, const char* inData ) + { + mWriter->writeContentTag( inName, inData ); + } + virtual void write( const char* inName, const PxRepXObject& inLiveObject ) + { + (*mMemBuffer) << inLiveObject.id; + writeProperty( *mWriter, *mMemBuffer, inName ); + } + virtual void addAndGotoChild( const char* inName ) + { + mWriter->beginTag( inName ); + mTagDepth++; + } + virtual void leaveChild() + { + if ( mTagDepth ) + { + mWriter->endTag(); + --mTagDepth; + } + } + }; + + struct XmlParseArgs + { + XmlMemoryAllocatorImpl* mAllocator; + PxProfileArray* mCollection; + + XmlParseArgs( XmlMemoryAllocatorImpl* inAllocator + , PxProfileArray* inCollection) + : mAllocator( inAllocator ) + , mCollection( inCollection ) + { + } + }; + + struct XmlNodeReader : public XmlReaderWriter + { + PxProfileAllocatorWrapper mWrapper; + CMemoryPoolManager& mManager; + XmlNode* mCurrentNode; + XmlNode* mTopNode; + PxProfileArray mContext; + XmlNodeReader( XmlNode* inCurrentNode, PxAllocatorCallback& inAllocator, CMemoryPoolManager& nodePoolManager ) + : mWrapper( inAllocator ) + , mManager( nodePoolManager ) + , mCurrentNode( inCurrentNode ) + , mTopNode( inCurrentNode ) + , mContext( mWrapper ) + { + } + + //Does this node exist as data in the format. + virtual bool read( const char* inName, const char*& outData ) + { + XmlNode* theChild( mCurrentNode->findChildByName( inName ) ); + if ( theChild ) + { + outData = theChild->mData; + return outData && *outData; + } + return false; + } + + virtual bool read( const char* inName, PxSerialObjectId& outId ) + { + XmlNode* theChild( mCurrentNode->findChildByName( inName ) ); + if ( theChild ) + { + const char* theValue( theChild->mData ); + strto( outId, theValue ); + return true; + } + return false; + } + + virtual bool gotoChild( const char* inName ) + { + XmlNode* theChild( mCurrentNode->findChildByName( inName ) ); + if ( theChild ) + { + mCurrentNode =theChild; + return true; + } + return false; + } + virtual bool gotoFirstChild() + { + if ( mCurrentNode->mFirstChild ) + { + mCurrentNode = mCurrentNode->mFirstChild; + return true; + } + return false; + } + virtual bool gotoNextSibling() + { + if ( mCurrentNode->mNextSibling ) + { + mCurrentNode = mCurrentNode->mNextSibling; + return true; + } + return false; + } + virtual PxU32 countChildren() + { + PxU32 retval= 0; + for ( XmlNode* theChild = mCurrentNode->mFirstChild; theChild != NULL; theChild = theChild->mNextSibling ) + ++retval; + return retval; + } + virtual const char* getCurrentItemName() + { + return mCurrentNode->mName; + } + virtual const char* getCurrentItemValue() + { + return mCurrentNode->mData; + } + + virtual bool leaveChild() + { + if ( mCurrentNode != mTopNode && mCurrentNode->mParent ) + { + mCurrentNode = mCurrentNode->mParent; + return true; + } + return false; + } + + virtual void pushCurrentContext() + { + mContext.pushBack( mCurrentNode ); + } + virtual void popCurrentContext() + { + if ( mContext.size() ) + { + mCurrentNode = mContext.back(); + mContext.popBack(); + } + } + + virtual void setNode( XmlNode& inNode ) + { + mContext.clear(); + mCurrentNode = &inNode; + mTopNode = mCurrentNode; + } + + virtual XmlReader* getParentReader() + { + XmlReader* retval = PX_PLACEMENT_NEW((mWrapper.getAllocator().allocate(sizeof(XmlNodeReader), "createNodeEditor", __FILE__, __LINE__ )), XmlNodeReader) + ( mTopNode, mWrapper.getAllocator(), mManager ); + return retval; + } + + virtual void addOrGotoChild( const char* inName ) + { + if ( gotoChild( inName )== false ) + { + XmlNode* newNode = allocateRepXNode( &mManager, inName, NULL ); + mCurrentNode->addChild( newNode ); + mCurrentNode = newNode; + } + } + virtual void setCurrentItemValue( const char* inValue ) + { + mCurrentNode->mData = copyStr( &mManager, inValue ); + } + virtual bool removeChild( const char* name ) + { + XmlNode* theChild( mCurrentNode->findChildByName( name ) ); + if ( theChild ) + { + releaseNodeAndChildren( &mManager, theChild ); + return true; + } + return false; + } + virtual void release() { this->~XmlNodeReader(); mWrapper.getAllocator().deallocate(this); } + + private: + XmlNodeReader& operator=(const XmlNodeReader&); + }; + + PX_INLINE void freeNodeAndChildren( XmlNode* tempNode, TMemoryPoolManager& inManager ) + { + for( XmlNode* theNode = tempNode->mFirstChild; theNode != NULL; theNode = theNode->mNextSibling ) + freeNodeAndChildren( theNode, inManager ); + tempNode->orphan(); + release( &inManager, tempNode ); + } + + class XmlParser : public shdfnd::FastXml::Callback + { + XmlParseArgs mParseArgs; + //For parse time only allocations + XmlMemoryAllocatorImpl& mParseAllocator; + XmlNode* mCurrentNode; + XmlNode* mTopNode; + + public: + XmlParser( XmlParseArgs inArgs, XmlMemoryAllocatorImpl& inParseAllocator ) + : mParseArgs( inArgs ) + , mParseAllocator( inParseAllocator ) + , mCurrentNode( NULL ) + , mTopNode( NULL ) + { + } + + virtual ~XmlParser(){} + + virtual bool processComment(const char* /*comment*/) { return true; } + // 'element' is the name of the element that is being closed. + // depth is the recursion depth of this element. + // Return true to continue processing the XML file. + // Return false to stop processing the XML file; leaves the read pointer of the stream right after this close tag. + // The bool 'isError' indicates whether processing was stopped due to an error, or intentionally canceled early. + virtual bool processClose(const char* /*element*/,physx::PxU32 /*depth*/,bool& /*isError*/) + { + mCurrentNode = mCurrentNode->mParent; + return true; + } + + // return true to continue processing the XML document, false to skip. + virtual bool processElement( + const char *elementName, // name of the element + const char *elementData, // element data, null if none + const shdfnd::FastXml::AttributePairs& attr, // attributes + PxI32 /*lineno*/) + { + XmlNode* newNode = allocateRepXNode( &mParseAllocator.mManager, elementName, elementData ); + if ( mCurrentNode ) + mCurrentNode->addChild( newNode ); + mCurrentNode = newNode; + //Add the elements as children. + for( PxI32 item = 0; item < attr.getNbAttr(); item ++ ) + { + XmlNode* node = allocateRepXNode( &mParseAllocator.mManager, attr.getKey(PxU32(item)), attr.getValue(PxU32(item)) ); + mCurrentNode->addChild( node ); + } + if ( mTopNode == NULL ) mTopNode = newNode; + return true; + } + + XmlNode* getTopNode() { return mTopNode; } + + virtual void * allocate(PxU32 size) + { + if ( size ) + return mParseAllocator.allocate(size); + return NULL; + } + virtual void deallocate(void *mem) + { + if ( mem ) + mParseAllocator.deallocate(reinterpret_cast(mem)); + } + + private: + XmlParser& operator=(const XmlParser&); + }; + + struct RepXCollectionSharedData + { + PxProfileAllocatorWrapper mWrapper; + XmlMemoryAllocatorImpl mAllocator; + PxU32 mRefCount; + + RepXCollectionSharedData( PxAllocatorCallback& inAllocator ) + : mWrapper( inAllocator ) + , mAllocator( inAllocator ) + , mRefCount( 0 ) + { + } + ~RepXCollectionSharedData() {} + + void addRef() { ++mRefCount;} + void release() + { + if ( mRefCount ) --mRefCount; + if ( !mRefCount ) { this->~RepXCollectionSharedData(); mWrapper.getAllocator().deallocate(this);} + } + }; + + struct SharedDataPtr + { + RepXCollectionSharedData* mData; + SharedDataPtr( RepXCollectionSharedData* inData ) + : mData( inData ) + { + mData->addRef(); + } + SharedDataPtr( const SharedDataPtr& inOther ) + : mData( inOther.mData ) + { + mData->addRef(); + } + SharedDataPtr& operator=( const SharedDataPtr& inOther ); + ~SharedDataPtr() + { + mData->release(); + mData = NULL; + } + RepXCollectionSharedData* operator->() { return mData; } + const RepXCollectionSharedData* operator->() const { return mData; } + }; + + class RepXCollectionImpl : public RepXCollection, public PxUserAllocated + { + SharedDataPtr mSharedData; + + XmlMemoryAllocatorImpl& mAllocator; + PxSerializationRegistry& mSerializationRegistry; + PxProfileArray mCollection; + TMemoryPoolManager mSerializationManager; + MemoryBuffer mPropertyBuffer; + PxTolerancesScale mScale; + PxVec3 mUpVector; + const char* mVersionStr; + PxCollection* mPxCollection; + + public: + RepXCollectionImpl( PxSerializationRegistry& inRegistry, PxAllocatorCallback& inAllocator, PxCollection& inPxCollection ) + : mSharedData( &PX_NEW_REPX_SERIALIZER( RepXCollectionSharedData )) + , mAllocator( mSharedData->mAllocator ) + , mSerializationRegistry( inRegistry ) + , mCollection( mSharedData->mWrapper ) + , mSerializationManager( inAllocator ) + , mPropertyBuffer( &mSerializationManager ) + , mScale(0.f, 0.f) + , mUpVector( 0,0,0 ) + , mVersionStr( getLatestVersion() ) + , mPxCollection( &inPxCollection ) + { + PX_ASSERT( mScale.isValid() == false ); + } + + RepXCollectionImpl( PxSerializationRegistry& inRegistry, const RepXCollectionImpl& inSrc, const char* inNewVersion ) + : mSharedData( inSrc.mSharedData ) + , mAllocator( mSharedData->mAllocator ) + , mSerializationRegistry( inRegistry ) + , mCollection( mSharedData->mWrapper ) + , mSerializationManager( mSharedData->mWrapper.getAllocator() ) + , mPropertyBuffer( &mSerializationManager ) + , mScale( inSrc.mScale ) + , mUpVector( inSrc.mUpVector ) + , mVersionStr( inNewVersion ) + , mPxCollection( NULL ) + { + } + + virtual ~RepXCollectionImpl() + { + PxU32 numItems = mCollection.size(); + for ( PxU32 idx = 0; idx < numItems; ++idx ) + { + XmlNode* theNode = mCollection[idx].descriptor; + releaseNodeAndChildren( &mAllocator.mManager, theNode ); + } + } + RepXCollectionImpl& operator=(const RepXCollectionImpl&); + + virtual void destroy() + { + PxProfileAllocatorWrapper tempWrapper( mSharedData->mWrapper.getAllocator() ); + this->~RepXCollectionImpl(); + tempWrapper.getAllocator().deallocate(this); + } + + virtual void setTolerancesScale(const PxTolerancesScale& inScale) { mScale = inScale; } + virtual PxTolerancesScale getTolerancesScale() const { return mScale; } + virtual void setUpVector( const PxVec3& inUpVector ) { mUpVector = inUpVector; } + virtual PxVec3 getUpVector() const { return mUpVector; } + + + PX_INLINE RepXCollectionItem findItemBySceneItem( const PxRepXObject& inObject ) const + { + //See if the object is in the collection + for ( PxU32 idx =0; idx < mCollection.size(); ++idx ) + if ( mCollection[idx].liveObject.serializable == inObject.serializable ) + return mCollection[idx]; + return RepXCollectionItem(); + } + + virtual RepXAddToCollectionResult addRepXObjectToCollection( const PxRepXObject& inObject, PxCollection* inCollection, PxRepXInstantiationArgs& inArgs ) + { + PX_ASSERT( inObject.serializable ); + PX_ASSERT( inObject.id ); + if ( inObject.serializable == NULL || inObject.id == 0 ) + return RepXAddToCollectionResult( RepXAddToCollectionResult::InvalidParameters ); + + PxRepXSerializer* theSerializer = mSerializationRegistry.getRepXSerializer( inObject.typeName ); + if ( theSerializer == NULL ) + return RepXAddToCollectionResult( RepXAddToCollectionResult::SerializerNotFound ); + + RepXCollectionItem existing = findItemBySceneItem( inObject ); + if ( existing.liveObject.serializable ) + return RepXAddToCollectionResult( RepXAddToCollectionResult::AlreadyInCollection, existing.liveObject.id ); + + XmlNodeWriter theXmlWriter( mAllocator, 1 ); + XmlWriterImpl theRepXWriter( &theXmlWriter, &mPropertyBuffer ); + { + SimpleXmlWriter::STagWatcher theWatcher( theXmlWriter, inObject.typeName ); + writeProperty( theXmlWriter, mPropertyBuffer, "Id", inObject.id ); + theSerializer->objectToFile( inObject, inCollection, theRepXWriter, mPropertyBuffer,inArgs ); + } + mCollection.pushBack( RepXCollectionItem( inObject, theXmlWriter.getTopNode() ) ); + return RepXAddToCollectionResult( RepXAddToCollectionResult::Success, inObject.id ); + } + + virtual bool instantiateCollection( PxRepXInstantiationArgs& inArgs, PxCollection& inCollection ) + { + for ( PxU32 idx =0; idx < mCollection.size(); ++idx ) + { + RepXCollectionItem theItem( mCollection[idx] ); + PxRepXSerializer* theSerializer = mSerializationRegistry.getRepXSerializer( theItem.liveObject.typeName ); + if (theSerializer ) + { + XmlNodeReader theReader( theItem.descriptor, mAllocator.getAllocator(), mAllocator.mManager ); + XmlMemoryAllocatorImpl instantiationAllocator( mAllocator.getAllocator() ); + PxRepXObject theLiveObject = theSerializer->fileToObject( theReader, instantiationAllocator, inArgs, &inCollection ); + if (theLiveObject.isValid()) + { + const PxBase* s = reinterpret_cast( theLiveObject.serializable ) ; + inCollection.add( *const_cast(s), PxSerialObjectId( theItem.liveObject.id )); + } + else + return false; + } + else + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PxSerialization::createCollectionFromXml: " + "PxRepXSerializer missing for type %s", theItem.liveObject.typeName); + return false; + } + } + + return true; + } + + void saveXmlNode( XmlNode* inNode, SimpleXmlWriter& inWriter ) + { + XmlNode* theNode( inNode ); + if ( theNode->mData && *theNode->mData && theNode->mFirstChild == NULL ) + inWriter.writeContentTag( theNode->mName, theNode->mData ); + else + { + inWriter.beginTag( theNode->mName ); + if ( theNode->mData && *theNode->mData ) + inWriter.addContent( theNode->mData ); + for ( XmlNode* theChild = theNode->mFirstChild; + theChild != NULL; + theChild = theChild->mNextSibling ) + saveXmlNode( theChild, inWriter ); + inWriter.endTag(); + } + } + + virtual void save( PxOutputStream& inStream ) + { + SimpleXmlWriterImpl theWriter( inStream, mAllocator.getAllocator() ); + theWriter.beginTag( "PhysXCollection" ); + theWriter.addAttribute( "version", mVersionStr ); + { + XmlWriterImpl theRepXWriter( &theWriter, &mPropertyBuffer ); + writeProperty( theWriter, mPropertyBuffer, "UpVector", mUpVector ); + theRepXWriter.addAndGotoChild( "Scale" ); + writeAllProperties( &mScale, theRepXWriter, mPropertyBuffer, *mPxCollection); + theRepXWriter.leaveChild(); + } + for ( PxU32 idx =0; idx < mCollection.size(); ++idx ) + { + RepXCollectionItem theItem( mCollection[idx] ); + XmlNode* theNode( theItem.descriptor ); + saveXmlNode( theNode, theWriter ); + } + } + + void load( PxInputData& inFileBuf, SerializationRegistry& s ) + { + inFileBuf.seek(0); + XmlParser theParser( XmlParseArgs( &mAllocator, &mCollection ), mAllocator ); + shdfnd::FastXml* theFastXml = shdfnd::createFastXml( &theParser ); + theFastXml->processXml( inFileBuf ); + XmlNode* theTopNode = theParser.getTopNode(); + if ( theTopNode != NULL ) + { + { + + XmlMemoryAllocatorImpl instantiationAllocator( mAllocator.getAllocator() ); + XmlNodeReader theReader( theTopNode, mAllocator.getAllocator(), mAllocator.mManager ); + readProperty( theReader, "UpVector", mUpVector ); + if ( theReader.gotoChild( "Scale" ) ) + { + readAllProperties( PxRepXInstantiationArgs( s.getPhysics() ), theReader, &mScale, instantiationAllocator, *mPxCollection); + theReader.leaveChild(); + } + const char* verStr = NULL; + if ( theReader.read( "version", verStr ) ) + mVersionStr = verStr; + } + for ( XmlNode* theChild = theTopNode->mFirstChild; + theChild != NULL; + theChild = theChild->mNextSibling ) + { + if ( physx::Pxstricmp( theChild->mName, "scale" ) == 0 + || physx::Pxstricmp( theChild->mName, "version" ) == 0 + || physx::Pxstricmp( theChild->mName, "upvector" ) == 0 ) + continue; + XmlNodeReader theReader( theChild, mAllocator.getAllocator(), mAllocator.mManager ); + PxRepXObject theObject; + theObject.typeName = theChild->mName; + theObject.serializable = NULL; + PxSerialObjectId theId = 0; + theReader.read( "Id", theId ); + theObject.id = theId; + mCollection.pushBack( RepXCollectionItem( theObject, theChild ) ); + } + } + else + { + PxGetFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, + "Cannot parse any object from the input buffer, please check the input repx data."); + } + theFastXml->release(); + } + + virtual const char* getVersion() { return mVersionStr; } + + virtual const RepXCollectionItem* begin() const + { + return mCollection.begin(); + } + virtual const RepXCollectionItem* end() const + { + return mCollection.end(); + } + + virtual RepXCollection& createCollection( const char* inVersionStr ) + { + PxAllocatorCallback& allocator = mSharedData->mWrapper.getAllocator(); + RepXCollectionImpl* retval = PX_PLACEMENT_NEW((allocator.allocate(sizeof(RepXCollectionImpl), "createCollection", __FILE__, __LINE__ )), RepXCollectionImpl) ( mSerializationRegistry, *this, inVersionStr ); + + return *retval; + } + + //Performs a deep copy of the repx node. + virtual XmlNode* copyRepXNode( const XmlNode* srcNode ) + { + return physx::Sn::copyRepXNode( &mAllocator.mManager, srcNode ); + } + + virtual void addCollectionItem( RepXCollectionItem inItem ) + { + mCollection.pushBack( inItem ); + } + + virtual PxAllocatorCallback& getAllocator() { return mSharedData->mAllocator.getAllocator(); } + //Create a new repx node with this name. Its value is unset. + virtual XmlNode& createRepXNode( const char* name ) + { + XmlNode* newNode = allocateRepXNode( &mSharedData->mAllocator.mManager, name, NULL ); + return *newNode; + } + + //Release this when finished. + virtual XmlReaderWriter& createNodeEditor() + { + PxAllocatorCallback& allocator = mSharedData->mWrapper.getAllocator(); + XmlReaderWriter* retval = PX_PLACEMENT_NEW((allocator.allocate(sizeof(XmlNodeReader), "createNodeEditor", __FILE__, __LINE__ )), XmlNodeReader) ( NULL, allocator, mAllocator.mManager ); + return *retval; + } + }; + + const char* RepXCollection::getLatestVersion() + { +#define TOSTR_(x) #x +#define CONCAT_(a, b, c) TOSTR_(a.##b.##c) +#define MAKE_VERSION_STR(a,b,c) CONCAT_(a, b, c) + + return MAKE_VERSION_STR(PX_PHYSICS_VERSION_MAJOR,PX_PHYSICS_VERSION_MINOR,PX_PHYSICS_VERSION_BUGFIX); + + } + + static RepXCollection* create(SerializationRegistry& s, PxAllocatorCallback& inAllocator, PxCollection& inCollection ) + { + return PX_PLACEMENT_NEW((inAllocator.allocate(sizeof(RepXCollectionImpl), "RepXCollection::create", __FILE__, __LINE__ )), RepXCollectionImpl) ( s, inAllocator, inCollection ); + } + + static RepXCollection* create(SerializationRegistry& s, PxInputData &data, PxAllocatorCallback& inAllocator, PxCollection& inCollection ) + { + RepXCollectionImpl* theCollection = static_cast( create(s, inAllocator, inCollection ) ); + theCollection->load( data, s ); + return theCollection; + } +} + + bool PxSerialization::serializeCollectionToXml( PxOutputStream& outputStream, PxCollection& collection, PxSerializationRegistry& sr, PxCooking* cooking, const PxCollection* externalRefs, PxXmlMiscParameter* inArgs ) + { + if( !PxSerialization::isSerializable(collection, sr, const_cast(externalRefs)) ) + return false; + + bool bRet = true; + + SerializationRegistry& sn = static_cast(sr); + PxRepXInstantiationArgs args( sn.getPhysics(), cooking ); + + PxCollection* tmpCollection = PxCreateCollection(); + PX_ASSERT(tmpCollection); + + tmpCollection->add( collection ); + if(externalRefs) + { + tmpCollection->add(*const_cast(externalRefs)); + } + + PxAllocatorCallback& allocator = *PxGetAllocatorCallback(); + Sn::RepXCollection* theRepXCollection = Sn::create(sn, allocator, *tmpCollection ); + + if(inArgs != NULL) + { + theRepXCollection->setTolerancesScale(inArgs->scale); + theRepXCollection->setUpVector(inArgs->upVector); + } + + PxU32 nbObjects = collection.getNbObjects(); + if( nbObjects ) + { + sortCollection( static_cast(collection), sn, true); + + for( PxU32 i = 0; i < nbObjects; i++ ) + { + PxBase& s = collection.getObject(i); + if( PxConcreteType::eSHAPE == s.getConcreteType() ) + { + PxShape& shape = static_cast(s); + if( shape.isExclusive() ) + continue; + } + + PxSerialObjectId id = collection.getId(s); + if(id == PX_SERIAL_OBJECT_ID_INVALID) + id = static_cast( size_t( &s )); + + PxRepXObject ro = PxCreateRepXObject( &s, id ); + if ( ro.serializable == NULL || ro.id == 0 ) + { + bRet = false; + break; + } + + theRepXCollection->addRepXObjectToCollection( ro, tmpCollection, args ); + } + } + tmpCollection->release(); + + theRepXCollection->save(outputStream); + theRepXCollection->destroy(); + + + return bRet; + } + + PxCollection* PxSerialization::createCollectionFromXml(PxInputData& inputData, PxCooking& cooking, PxSerializationRegistry& sr, const PxCollection* externalRefs, PxStringTable* stringTable, PxXmlMiscParameter* outArgs) + { + SerializationRegistry& sn = static_cast(sr); + PxCollection* collection = PxCreateCollection(); + PX_ASSERT(collection); + + if( externalRefs ) + collection->add(*const_cast(externalRefs)); + + PxAllocatorCallback& allocator = *PxGetAllocatorCallback(); + Sn::RepXCollection* theRepXCollection = Sn::create(sn, inputData, allocator, *collection); + theRepXCollection = &Sn::RepXUpgrader::upgradeCollection( *theRepXCollection ); + + PxRepXInstantiationArgs args( sn.getPhysics(), &cooking, stringTable ); + if( !theRepXCollection->instantiateCollection(args, *collection) ) + { + collection->release(); + theRepXCollection->destroy(); + return NULL; + } + + if( externalRefs ) + collection->remove(*const_cast(externalRefs)); + + if(outArgs != NULL) + { + outArgs->upVector = theRepXCollection->getUpVector(); + outArgs->scale = theRepXCollection->getTolerancesScale(); + } + + theRepXCollection->destroy(); + + return collection; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerializer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerializer.h new file mode 100644 index 0000000..86f70f1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSerializer.h @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_SERIALIZER_H +#define SN_XML_SERIALIZER_H + +#include "PxExtensionMetaDataObjects.h" +#include "SnXmlVisitorWriter.h" + +namespace physx { + +namespace Sn { + + void writeHeightFieldSample( PxOutputStream& inStream, const PxHeightFieldSample& inSample ) + { + PxU32 retval = 0; + PxU8* writePtr( reinterpret_cast< PxU8*>( &retval ) ); + const PxU8* inPtr( reinterpret_cast( &inSample ) ); + if ( isBigEndian() ) + { + //Height field samples are a + //16 bit integer followed by two bytes. + //right now, data is 2 1 3 4 + //We need a 32 bit integer that + //when read in by a LE system is 4 3 2 1. + //Thus, we need a BE integer that looks like: + //4 3 2 1 + + writePtr[0] = inPtr[3]; + writePtr[1] = inPtr[2]; + writePtr[2] = inPtr[0]; + writePtr[3] = inPtr[1]; + } + else + { + writePtr[0] = inPtr[0]; + writePtr[1] = inPtr[1]; + writePtr[2] = inPtr[2]; + writePtr[3] = inPtr[3]; + } + inStream << retval; + } + + + + template + inline void writeStridedBufferProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, const void* inData, PxU32 inStride, PxU32 inCount, PxU32 inItemsPerLine, TWriteOperator inOperator ) + { + PX_ASSERT( inStride == 0 || inStride == sizeof( TDataType ) ); + PX_UNUSED( inStride ); + writeBuffer( writer, tempBuffer + , inItemsPerLine, reinterpret_cast( inData ) + , inCount, inPropName, inOperator ); + } + + template + inline void writeStridedBufferProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, const PxStridedData& inData, PxU32 inCount, PxU32 inItemsPerLine, TWriteOperator inOperator ) + { + writeStridedBufferProperty( writer, tempBuffer, inPropName, inData.data, inData.stride, inCount, inItemsPerLine, inOperator ); + } + + template + inline void writeStridedBufferProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, const PxTypedStridedData& inData, PxU32 inCount, PxU32 inItemsPerLine, TWriteOperator inOperator ) + { + writeStridedBufferProperty( writer, tempBuffer, inPropName, inData.data, inData.stride, inCount, inItemsPerLine, inOperator ); + } + + template + inline void writeStridedBufferProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, const PxBoundedData& inData, PxU32 inItemsPerLine, TWriteOperator inWriteOperator ) + { + writeStridedBufferProperty( writer, tempBuffer, inPropName, inData, inData.count, inItemsPerLine, inWriteOperator ); + } + + template + inline void writeStridedBufferProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, PxStrideIterator& inData, PxU32 inCount, PxU32 inItemsPerLine, TWriteOperator inWriteOperator ) + { + writeStrideBuffer(writer, tempBuffer + , inItemsPerLine, inData, PtrAccess + , inCount, inPropName, inData.stride(), inWriteOperator ); + } + + template + inline void writeStridedFlagsProperty( XmlWriter& writer, MemoryBuffer& tempBuffer, const char* inPropName, PxStrideIterator& inData, PxU32 inCount, PxU32 inItemsPerLine, const PxU32ToName* inTable ) + { + writeStrideFlags(writer, tempBuffer + , inItemsPerLine, inData, PtrAccess + , inCount, inPropName, inTable ); + } + +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSimpleXmlWriter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSimpleXmlWriter.h new file mode 100644 index 0000000..31e8afc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlSimpleXmlWriter.h @@ -0,0 +1,214 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_SIMPLE_XML_WRITER_H +#define SN_XML_SIMPLE_XML_WRITER_H + +#include "foundation/PxArray.h" +#include "SnXmlMemoryPoolStreams.h" + +namespace physx { namespace Sn { + class XmlWriter + { + public: + + struct STagWatcher + { + typedef XmlWriter TXmlWriterType; + TXmlWriterType& mWriter; + STagWatcher( const STagWatcher& inOther ); + STagWatcher& operator-( const STagWatcher& inOther ); + STagWatcher( TXmlWriterType& inWriter, const char* inTagName ) + : mWriter( inWriter ) + { + mWriter.beginTag( inTagName ); + } + ~STagWatcher() { mWriter.endTag(); } + }; + + virtual ~XmlWriter(){} + virtual void beginTag( const char* inTagname ) = 0; + virtual void endTag() = 0; + virtual void addAttribute( const char* inName, const char* inValue ) = 0; + virtual void writeContentTag( const char* inTag, const char* inContent ) = 0; + virtual void addContent( const char* inContent ) = 0; + virtual PxU32 tabCount() = 0; + }; + + template + class XmlWriterImpl : public XmlWriter + { + PxProfileAllocatorWrapper mWrapper; + TStreamType& mStream; + XmlWriterImpl( const XmlWriterImpl& inOther ); + XmlWriterImpl& operator=( const XmlWriterImpl& inOther ); + PxProfileArray mTags; + bool mTagOpen; + PxU32 mInitialTagDepth; + public: + + XmlWriterImpl( TStreamType& inStream, PxAllocatorCallback& inAllocator, PxU32 inInitialTagDepth = 0 ) + : mWrapper( inAllocator ) + , mStream( inStream ) + , mTags( mWrapper ) + , mTagOpen( false ) + , mInitialTagDepth( inInitialTagDepth ) + { + } + virtual ~XmlWriterImpl() + { + while( mTags.size() ) + endTag(); + } + PxU32 tabCount() { return mTags.size() + mInitialTagDepth; } + + void writeTabs( PxU32 inSize ) + { + inSize += mInitialTagDepth; + for ( PxU32 idx =0; idx < inSize; ++idx ) + mStream << "\t"; + } + void beginTag( const char* inTagname ) + { + closeTag(); + writeTabs(mTags.size()); + mTags.pushBack( inTagname ); + mStream << "<" << inTagname; + mTagOpen = true; + } + void addAttribute( const char* inName, const char* inValue ) + { + PX_ASSERT( mTagOpen ); + mStream << " " << inName << "=" << "\"" << inValue << "\""; + } + void closeTag(bool useNewline = true) + { + if ( mTagOpen ) + { + mStream << " " << ">"; + if (useNewline ) + mStream << "\n"; + } + mTagOpen = false; + } + void doEndOpenTag() + { + mStream << "" << "\n"; + } + void endTag() + { + PX_ASSERT( mTags.size() ); + if ( mTagOpen ) + mStream << " " << "/>" << "\n"; + else + { + writeTabs(mTags.size()-1); + doEndOpenTag(); + } + mTagOpen = false; + mTags.popBack(); + } + void addContent( const char* inContent ) + { + closeTag(false); + mStream << inContent; + } + void writeContentTag( const char* inTag, const char* inContent ) + { + beginTag( inTag ); + addContent( inContent ); + doEndOpenTag(); + mTags.popBack(); + } + void insertXml( const char* inXml ) + { + closeTag(); + mStream << inXml; + } + }; + + struct BeginTag + { + const char* mTagName; + BeginTag( const char* inTagName ) + : mTagName( inTagName ) { } + }; + + struct EndTag + { + EndTag() {} + }; + + struct Att + { + const char* mAttName; + const char* mAttValue; + Att( const char* inAttName, const char* inAttValue ) + : mAttName( inAttName ) + , mAttValue( inAttValue ) { } + }; + + struct Content + { + const char* mContent; + Content( const char* inContent ) + : mContent( inContent ) { } + }; + + + struct ContentTag + { + const char* mTagName; + const char* mContent; + ContentTag( const char* inTagName, const char* inContent ) + : mTagName( inTagName ) + , mContent( inContent ) { } + }; + + inline XmlWriter& operator<<( XmlWriter& inWriter, const BeginTag& inTag ) { inWriter.beginTag( inTag.mTagName ); return inWriter; } + inline XmlWriter& operator<<( XmlWriter& inWriter, const EndTag& inTag ) { inWriter.endTag(); return inWriter; } + inline XmlWriter& operator<<( XmlWriter& inWriter, const Att& inTag ) { inWriter.addAttribute(inTag.mAttName, inTag.mAttValue); return inWriter; } + inline XmlWriter& operator<<( XmlWriter& inWriter, const Content& inTag ) { inWriter.addContent(inTag.mContent); return inWriter; } + inline XmlWriter& operator<<( XmlWriter& inWriter, const ContentTag& inTag ) { inWriter.writeContentTag(inTag.mTagName, inTag.mContent); return inWriter; } + + inline void writeProperty( XmlWriter& inWriter, MemoryBuffer& tempBuffer, const char* inPropName ) + { + PxU8 data = 0; + tempBuffer.write( &data, sizeof(PxU8) ); + inWriter.writeContentTag( inPropName, reinterpret_cast( tempBuffer.mBuffer ) ); + tempBuffer.clear(); + } + + template + inline void writeProperty( XmlWriter& inWriter, MemoryBuffer& tempBuffer, const char* inPropName, TDataType inValue ) + { + tempBuffer << inValue; + writeProperty( inWriter, tempBuffer, inPropName ); + } +} } +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlStringToType.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlStringToType.h new file mode 100644 index 0000000..de140d6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlStringToType.h @@ -0,0 +1,277 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_STRING_TO_TYPE_H +#define SN_XML_STRING_TO_TYPE_H + +#include "common/PxCoreUtilityTypes.h" +#include "PxFiltering.h" + +#include "foundation/PxString.h" + +#include +#include + +//Remapping function name for gcc-based systems. +#ifndef _MSC_VER +#define _strtoui64 strtoull +#endif + + +namespace physx { namespace Sn { + + template + struct StrToImpl + { + bool compile_error; + }; + + template<> struct StrToImpl { + //Id's (void ptrs) are written to file as unsigned + //64 bit integers, so this method gets called more + //often than one might think. + PX_INLINE void strto( PxU64& ioDatatype,const char*& ioData ) + { + ioDatatype = _strtoui64( ioData, const_cast(&ioData), 10 ); + } + }; + + PX_INLINE PxF32 strToFloat(const char *str,const char **nextScan) + { + PxF32 ret; + while ( *str && isspace(static_cast(*str))) str++; // skip leading whitespace + char temp[256] = ""; + char *dest = temp; + char *end = &temp[255]; + const char *begin = str; + while ( *str && !isspace(static_cast(*str)) && dest < end ) // copy the number up to the first whitespace or eos + { + *dest++ = *str++; + } + *dest = 0; + ret = PxF32(strtod(temp,&end)); + if ( nextScan ) + { + *nextScan = begin+(end-temp); + } + return ret; + } + + + template<> struct StrToImpl { + PX_INLINE void strto( PxU32& ioDatatype,const char*& ioData ) + { + ioDatatype = static_cast( strtoul( ioData,const_cast(&ioData), 10 ) ); + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxI32& ioDatatype,const char*& ioData ) + { + ioDatatype = static_cast( strtoul( ioData,const_cast(&ioData), 10 ) ); + } + }; + + + template<> struct StrToImpl { + PX_INLINE void strto( PxU16& ioDatatype,const char*& ioData ) + { + ioDatatype = static_cast( strtoul( ioData,const_cast(&ioData), 10 ) ); + } + }; + + PX_INLINE void eatwhite(const char*& ioData ) + { + if ( ioData ) + { + while( isspace( static_cast(*ioData) ) ) + ++ioData; + } + } + + // copy the source data to the dest buffer until the first whitespace is encountered. + // Do not overflow the buffer based on the bufferLen provided. + // Advance the input 'ioData' pointer so that it sits just at the next whitespace + PX_INLINE void nullTerminateWhite(const char*& ioData,char *buffer,PxU32 bufferLen) + { + if ( ioData ) + { + char *eof = buffer+(bufferLen-1); + char *dest = buffer; + while( *ioData && !isspace(static_cast(*ioData)) && dest < eof ) + { + *dest++ = *ioData++; + } + *dest = 0; + } + } + + inline void nonNullTerminateWhite(const char*& ioData ) + { + if ( ioData ) + { + while( *ioData && !isspace( static_cast(*ioData) ) ) + ++ioData; + } + } + + template<> struct StrToImpl { + inline void strto( PxF32& ioDatatype,const char*& ioData ) + { + ioDatatype = strToFloat(ioData,&ioData); + } + + }; + + + template<> struct StrToImpl { + inline void strto( void*& ioDatatype,const char*& ioData ) + { + PxU64 theData; + StrToImpl().strto( theData, ioData ); + ioDatatype = reinterpret_cast( size_t( theData ) ); + } + }; + + + template<> struct StrToImpl { + inline void strto( physx::PxVec3& ioDatatype,const char*& ioData ) + { + StrToImpl().strto( ioDatatype[0], ioData ); + StrToImpl().strto( ioDatatype[1], ioData ); + StrToImpl().strto( ioDatatype[2], ioData ); + } + }; + + template<> struct StrToImpl { + inline void strto( PxU8*& /*ioDatatype*/,const char*& /*ioData*/) + { + } + }; + + template<> struct StrToImpl { + inline void strto( bool& ioType,const char*& inValue ) + { + ioType = physx::Pxstricmp( inValue, "true" ) == 0 ? true : false; + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxU8& ioType,const char* & inValue) + { + ioType = static_cast( strtoul( inValue,const_cast(&inValue), 10 ) ); + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxFilterData& ioType,const char*& inValue) + { + ioType.word0 = static_cast( strtoul( inValue,const_cast(&inValue), 10 ) ); + ioType.word1 = static_cast( strtoul( inValue,const_cast(&inValue), 10 ) ); + ioType.word2 = static_cast( strtoul( inValue,const_cast(&inValue), 10 ) ); + ioType.word3 = static_cast( strtoul( inValue, NULL, 10 ) ); + } + }; + + + template<> struct StrToImpl { + PX_INLINE void strto( PxQuat& ioType,const char*& inValue ) + { + ioType.x = static_cast( strToFloat( inValue, &inValue ) ); + ioType.y = static_cast( strToFloat( inValue, &inValue ) ); + ioType.z = static_cast( strToFloat( inValue, &inValue ) ); + ioType.w = static_cast( strToFloat( inValue, &inValue ) ); + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxTransform& ioType,const char*& inValue) + { + ioType.q.x = static_cast( strToFloat( inValue, &inValue ) ); + ioType.q.y = static_cast( strToFloat( inValue, &inValue ) ); + ioType.q.z = static_cast( strToFloat( inValue, &inValue ) ); + ioType.q.w = static_cast( strToFloat( inValue, &inValue ) ); + + ioType.p[0] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.p[1] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.p[2] = static_cast( strToFloat( inValue, &inValue ) ); + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxBounds3& ioType,const char*& inValue) + { + ioType.minimum[0] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.minimum[1] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.minimum[2] = static_cast( strToFloat( inValue, &inValue ) ); + + ioType.maximum[0] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.maximum[1] = static_cast( strToFloat( inValue, &inValue ) ); + ioType.maximum[2] = static_cast( strToFloat( inValue, &inValue ) ); + } + }; + + template<> struct StrToImpl { + PX_INLINE void strto( PxMetaDataPlane& ioType,const char*& inValue) + { + ioType.normal.x = static_cast( strToFloat( inValue, &inValue ) ); + ioType.normal.y = static_cast( strToFloat( inValue, &inValue ) ); + ioType.normal.z = static_cast( strToFloat( inValue, &inValue ) ); + ioType.distance = static_cast( strToFloat( inValue, &inValue ) ); + } + }; + + + template<> struct StrToImpl { + PX_INLINE void strto( PxRigidDynamic*& /*ioDatatype*/,const char*& /*ioData*/) + { + } + }; + + template + inline void strto( TDataType& ioType,const char*& ioData ) + { + if ( ioData && *ioData ) StrToImpl().strto( ioType, ioData ); + } + + template + inline void strtoLong( TDataType& ioType,const char*& ioData ) + { + if ( ioData && *ioData ) StrToImpl().strto( ioType, ioData ); + } + + template + inline void stringToType( const char* inValue, TDataType& ioType ) + { + const char* theValue( inValue ); + return strto( ioType, theValue ); + } + +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorReader.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorReader.h new file mode 100644 index 0000000..55de5e1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorReader.h @@ -0,0 +1,913 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_VISITOR_READER_H +#define SN_XML_VISITOR_READER_H + +#include "foundation/PxArray.h" +#include "foundation/PxUtilities.h" +#include "RepXMetaDataPropertyVisitor.h" +#include "SnPxStreamOperators.h" +#include "SnXmlMemoryPoolStreams.h" +#include "SnXmlReader.h" +#include "SnXmlImpl.h" +#include "SnXmlMemoryAllocator.h" +#include "SnXmlStringToType.h" + +namespace physx { namespace Sn { + + + inline PxU32 findEnumByName( const char* inName, const PxU32ToName* inTable ) + { + for ( PxU32 idx = 0; inTable[idx].mName != NULL; ++idx ) + { + if ( physx::Pxstricmp( inTable[idx].mName, inName ) == 0 ) + return inTable[idx].mValue; + } + return 0; + } + + PX_INLINE void stringToFlagsType( const char* strData, XmlMemoryAllocator& alloc, PxU32& ioType, const PxU32ToName* inTable ) + { + if ( inTable == NULL ) + return; + ioType = 0; + if ( strData && *strData) + { + //Destructively parse the string to get out the different flags. + char* theValue = const_cast( copyStr( &alloc, strData ) ); + char* theMarker = theValue; + char* theNext = theValue; + while( theNext && *theNext ) + { + ++theNext; + if( *theNext == '|' ) + { + *theNext = 0; + ++theNext; + ioType |= static_cast< PxU32 > ( findEnumByName( theMarker, inTable ) ); + theMarker = theNext; + } + } + if ( theMarker && *theMarker ) + ioType |= static_cast< PxU32 > ( findEnumByName( theMarker, inTable ) ); + alloc.deallocate( reinterpret_cast( theValue ) ); + } + } + + template + PX_INLINE void stringToEnumType( const char* strData, TDataType& ioType, const PxU32ToName* inTable ) + { + ioType = static_cast( findEnumByName( strData, inTable ) ); + } + + template + PX_INLINE bool readProperty( XmlReader& inReader, const char* pname, TDataType& ioType ) + { + const char* value; + if ( inReader.read( pname, value ) ) + { + stringToType( value, ioType ); + return true; + } + return false; + } + + template + inline TObjType* findReferencedObject( PxCollection& collection, PxSerialObjectId id) + { + PX_ASSERT(id > 0); + TObjType* outObject = static_cast(const_cast(collection.find(id))); + if (outObject == NULL) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::createCollectionFromXml: " + "Reference to ID %d cannot be resolved. Make sure externalRefs collection is specified if required and " + "check Xml file for completeness.", + id); + } + return outObject; + } + + template + inline bool readReference( XmlReader& inReader, PxCollection& collection, TObjType*& outObject ) + { + PxSerialObjectId theId; + const char* theValue = inReader.getCurrentItemValue(); + strto( theId, theValue ); + if( theId == 0) + { + // the NULL pointer is a valid pointer if the input id is 0 + outObject = NULL; + return true; + } + else + { + outObject = findReferencedObject(collection, theId); + return outObject != NULL; + } + } + + template + inline bool readReference( XmlReader& inReader, PxCollection& inCollection, const char* pname, TObjType*& outObject ) + { + outObject = NULL; + PxSerialObjectId theId = 0; + if (readProperty ( inReader, pname, theId ) && theId ) + { + outObject = findReferencedObject(inCollection, theId); + } + // the NULL pointer is a valid pointer if the input id is 0 + return (outObject != NULL) || 0 == theId; + } + + template + inline bool readFlagsProperty( XmlReader& reader, XmlMemoryAllocator& allocator, const char* pname, const PxU32ToName* inConversions, PxFlags& outFlags ) + { + const char* value; + if ( reader.read( pname, value ) ) + { + PxU32 tempValue = 0; + stringToFlagsType( value, allocator, tempValue, inConversions ); + outFlags = PxFlags(PxTo16(tempValue) ); + return true; + } + return false; + } + + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj, TInfoType& info); + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj); + + template + inline PxGeometry* parseGeometry( TReaderType& reader, TGeomType& /*inGeom*/) + { + PxAllocatorCallback& inAllocator = reader.mAllocator.getAllocator(); + + TGeomType* shape = PX_PLACEMENT_NEW((inAllocator.allocate(sizeof(TGeomType), "parseGeometry", __FILE__, __LINE__ )), TGeomType); + PxClassInfoTraits info; + readComplexObj( reader, shape); + return shape; + } + + + template + inline void parseShape( TReaderType& visitor, PxGeometry*& outResult, PxArray& outMaterials) + { + XmlReader& theReader( visitor.mReader ); + PxCollection& collection = visitor.mCollection; + visitor.pushCurrentContext(); + if ( visitor.gotoTopName() ) + { + visitor.pushCurrentContext(); + if ( visitor.gotoChild( "Materials" ) ) + { + for( bool matSuccess = visitor.gotoFirstChild(); matSuccess; + matSuccess = visitor.gotoNextSibling() ) + { + PxMaterial* material = NULL; + if(!readReference( theReader, collection, material )) + visitor.mHadError = true; + if ( material ) + outMaterials.pushBack( material ); + } + } + visitor.popCurrentContext(); + visitor.pushCurrentContext(); + + PxPlaneGeometry plane; + PxHeightFieldGeometry heightField; + PxSphereGeometry sphere; + PxTriangleMeshGeometry mesh; + PxConvexMeshGeometry convex; + PxBoxGeometry box; + PxCapsuleGeometry capsule; + if ( visitor.gotoChild( "Geometry" ) ) + { + if ( visitor.gotoFirstChild() ) + { + const char* geomTypeName = visitor.getCurrentItemName(); + + if ( physx::Pxstricmp( geomTypeName, "PxSphereGeometry" ) == 0 ) outResult = parseGeometry(visitor, sphere); + else if ( physx::Pxstricmp( geomTypeName, "PxPlaneGeometry" ) == 0 ) outResult = parseGeometry(visitor, plane); + else if ( physx::Pxstricmp( geomTypeName, "PxCapsuleGeometry" ) == 0 ) outResult = parseGeometry(visitor, capsule); + else if ( physx::Pxstricmp( geomTypeName, "PxBoxGeometry" ) == 0 ) outResult = parseGeometry(visitor, box); + else if ( physx::Pxstricmp( geomTypeName, "PxConvexMeshGeometry" ) == 0 ) outResult = parseGeometry(visitor, convex); + else if ( physx::Pxstricmp( geomTypeName, "PxTriangleMeshGeometry" ) == 0 ) outResult = parseGeometry(visitor, mesh); + else if ( physx::Pxstricmp( geomTypeName, "PxHeightFieldGeometry" ) == 0 ) outResult = parseGeometry(visitor, heightField); + else + PX_ASSERT( false ); + } + } + visitor.popCurrentContext(); + } + visitor.popCurrentContext(); + + return; + } + + template + inline void readShapesProperty( TReaderType& visitor, TObjType* inObj, const PxRigidActorShapeCollection* inProp = NULL, bool isSharedShape = false ) + { + PX_UNUSED(isSharedShape); + PX_UNUSED(inProp); + + XmlReader& theReader( visitor.mReader ); + PxCollection& collection( visitor.mCollection ); + + visitor.pushCurrentContext(); + if ( visitor.gotoTopName() ) + { + //uggh working around the shape collection api. + //read out materials and geometry + for ( bool success = visitor.gotoFirstChild(); success; + success = visitor.gotoNextSibling() ) + { + if( 0 == physx::Pxstricmp( visitor.getCurrentItemName(), "PxShapeRef" ) ) + { + PxShape* shape = NULL; + if(!readReference( theReader, collection, shape )) + visitor.mHadError = true; + if(shape) + inObj->attachShape( *shape ); + } + else + { + PxArray materials; + PxGeometry* geometry = NULL; + parseShape( visitor, geometry, materials); + PxShape* theShape = NULL; + if ( materials.size() ) + { + theShape = visitor.mArgs.physics.createShape( *geometry, materials.begin(), PxTo16(materials.size()), true ); + if ( theShape ) + { + readComplexObj( visitor, theShape ); + + if(theShape) + { + inObj->attachShape(*theShape); + collection.add( *theShape ); + } + } + } + + switch(geometry->getType()) + { + case PxGeometryType::eSPHERE : + static_cast(geometry)->~PxSphereGeometry(); + break; + case PxGeometryType::ePLANE : + static_cast(geometry)->~PxPlaneGeometry(); + break; + case PxGeometryType::eCAPSULE : + static_cast(geometry)->~PxCapsuleGeometry(); + break; + case PxGeometryType::eBOX : + static_cast(geometry)->~PxBoxGeometry(); + break; + case PxGeometryType::eCONVEXMESH : + static_cast(geometry)->~PxConvexMeshGeometry(); + break; + case PxGeometryType::eTRIANGLEMESH : + static_cast(geometry)->~PxTriangleMeshGeometry(); + break; + case PxGeometryType::eHEIGHTFIELD : + static_cast(geometry)->~PxHeightFieldGeometry(); + break; + case PxGeometryType::eTETRAHEDRONMESH : + static_cast(geometry)->~PxTetrahedronMeshGeometry(); + break; + case PxGeometryType::ePARTICLESYSTEM: + static_cast(geometry)->~PxParticleSystemGeometry(); + break; + case PxGeometryType::eHAIRSYSTEM: + static_cast(geometry)->~PxHairSystemGeometry(); + break; + case PxGeometryType::eCUSTOM : + static_cast(geometry)->~PxCustomGeometry(); + break; + + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + PX_ASSERT(0); + } + visitor.mAllocator.getAllocator().deallocate(geometry); + } + } + } + visitor.popCurrentContext(); + } + + struct ReaderNameStackEntry : NameStackEntry + { + bool mValid; + ReaderNameStackEntry( const char* nm, bool valid ) : NameStackEntry(nm), mValid(valid) {} + }; + + typedef PxProfileArray TReaderNameStack; + + template + struct RepXVisitorReaderBase + { + + protected: + RepXVisitorReaderBase& operator=(const RepXVisitorReaderBase&); + public: + TReaderNameStack& mNames; + PxProfileArray& mContexts; + PxRepXInstantiationArgs mArgs; + XmlReader& mReader; + TObjType* mObj; + XmlMemoryAllocator& mAllocator; + PxCollection& mCollection; + bool mValid; + bool& mHadError; + + RepXVisitorReaderBase( TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, TObjType* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& hadError ) + : mNames( names ) + , mContexts( contexts ) + , mArgs( args ) + , mReader( reader ) + , mObj( obj ) + , mAllocator( alloc ) + , mCollection( collection ) + , mValid( true ) + , mHadError(hadError) + { + } + RepXVisitorReaderBase( const RepXVisitorReaderBase& other ) + : mNames( other.mNames ) + , mContexts( other.mContexts ) + , mArgs( other.mArgs ) + , mReader( other.mReader ) + , mObj( other.mObj ) + , mAllocator( other.mAllocator ) + , mCollection( other.mCollection ) + , mValid( other.mValid ) + , mHadError( other.mHadError ) + { + } + + + void pushName( const char* name ) + { + gotoTopName(); + mNames.pushBack( ReaderNameStackEntry( name, mValid ) ); + } + void pushBracketedName( const char* name ) { pushName( name ); } + void popName() + { + if ( mNames.size() ) + { + if ( mNames.back().mOpen && mNames.back().mValid ) + mReader.leaveChild(); + mNames.popBack(); + } + mValid =true; + if ( mNames.size() && mNames.back().mValid == false ) + mValid = false; + } + + void pushCurrentContext() + { + mContexts.pushBack( static_cast( mNames.size() ) ); + } + void popCurrentContext() + { + if ( mContexts.size() ) + { + PxU32 depth = mContexts.back(); + PX_ASSERT( mNames.size() >= depth ); + while( mNames.size() > depth ) + popName(); + mContexts.popBack(); + } + } + + bool updateLastEntryAfterOpen() + { + mNames.back().mValid = mValid; + mNames.back().mOpen = mValid; + return mValid; + } + + bool gotoTopName() + { + if ( mNames.size() && mNames.back().mOpen == false ) + { + if ( mValid ) + mValid = mReader.gotoChild( mNames.back().mName ); + updateLastEntryAfterOpen(); + } + return mValid; + } + + bool isValid() const { return mValid; } + + bool gotoChild( const char* name ) + { + pushName( name ); + return gotoTopName(); + } + + bool gotoFirstChild() + { + pushName( "__child" ); + if ( mValid ) mValid = mReader.gotoFirstChild(); + return updateLastEntryAfterOpen(); + } + + bool gotoNextSibling() + { + bool retval = mValid; + if ( mValid ) retval = mReader.gotoNextSibling(); + return retval; + } + + const char* getCurrentItemName() { if (mValid ) return mReader.getCurrentItemName(); return ""; } + + const char* topName() const + { + if ( mNames.size() ) return mNames.back().mName; + PX_ASSERT( false ); + return "bad__repx__name"; + } + + const char* getCurrentValue() + { + const char* value = NULL; + if ( isValid() && mReader.read( topName(), value ) ) + return value; + return NULL; + } + + template + bool readProperty(TDataType& outType) + { + const char* value = getCurrentValue(); + if ( value && *value ) + { + stringToType( value, outType ); + return true; + } + return false; + } + + template + bool readExtendedIndexProperty(TDataType& outType) + { + const char* value = mReader.getCurrentItemValue(); + if ( value && *value ) + { + stringToType( value, outType ); + return true; + } + return false; + } + + + template + bool readReference(TRefType*& outRef) + { + return physx::Sn::readReference( mReader, mCollection, topName(), outRef ); + } + + inline bool readProperty(const char*& outProp ) + { + outProp = ""; + const char* value = getCurrentValue(); + if ( value && *value && mArgs.stringTable ) + { + outProp = mArgs.stringTable->allocateStr( value ); + return true; + } + return false; + } + + inline bool readProperty(PxConvexMesh*& outProp ) + { + return readReference( outProp ); + } + + inline bool readProperty(PxTriangleMesh*& outProp ) + { + return readReference( outProp ); + } + inline bool readProperty(PxBVH33TriangleMesh*& outProp ) + { + return readReference( outProp ); + } + inline bool readProperty(PxBVH34TriangleMesh*& outProp ) + { + return readReference( outProp ); + } + + inline bool readProperty(PxHeightField*& outProp ) + { + return readReference( outProp ); + } + + inline bool readProperty( PxRigidActor *& outProp ) + { + return readReference( outProp ); + } + + template + void simpleProperty( PxU32 /*key*/, TAccessorType& inProp ) + { + typedef typename TAccessorType::prop_type TPropertyType; + TPropertyType value; + if ( readProperty( value ) ) + inProp.set( mObj, value ); + } + + template + void enumProperty( PxU32 /*key*/, TAccessorType& inProp, const PxU32ToName* inConversions ) + { + typedef typename TAccessorType::prop_type TPropertyType; + const char* strVal = getCurrentValue(); + if ( strVal && *strVal ) + { + TPropertyType pval; + stringToEnumType( strVal, pval, inConversions ); + inProp.set( mObj, pval ); + } + } + + template + void flagsProperty( PxU32 /*key*/, const TAccessorType& inProp, const PxU32ToName* inConversions ) + { + typedef typename TAccessorType::prop_type TPropertyType; + typedef typename TPropertyType::InternalType TInternalType; + + const char* strVal = getCurrentValue(); + if ( strVal && *strVal ) + { + PxU32 tempValue = 0; + stringToFlagsType( strVal, mAllocator, tempValue, inConversions ); + inProp.set( mObj, TPropertyType(TInternalType( tempValue ))); + } + } + + template + void complexProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + if ( gotoTopName() ) + { + TPropertyType propVal = inProp.get( mObj ); + readComplexObj( *this, &propVal, inInfo ); + inProp.set( mObj, propVal ); + } + } + + template + void bufferCollectionProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + PxInlineArray theData; + + this->pushCurrentContext(); + if ( this->gotoTopName() ) + { + for ( bool success = this->gotoFirstChild(); success; + success = this->gotoNextSibling() ) + { + TPropertyType propVal; + readComplexObj( *this, &propVal, inInfo ); + theData.pushBack(propVal); + } + } + this->popCurrentContext(); + + inProp.set( mObj, theData.begin(), theData.size() ); + + } + + template + void extendedIndexedProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + + this->pushCurrentContext(); + if ( this->gotoTopName() ) + { + PxU32 index = 0; + for ( bool success = this->gotoFirstChild(); success; + success = this->gotoNextSibling() ) + { + TPropertyType propVal; + readComplexObj( *this, &propVal, inInfo ); + inProp.set(mObj, index, propVal); + ++index; + } + } + this->popCurrentContext(); + } + + template + void PxFixedSizeLookupTableProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + const_cast(inProp).clear( mObj ); + + this->pushCurrentContext(); + if ( this->gotoTopName() ) + { + for ( bool success = this->gotoFirstChild(); success; + success = this->gotoNextSibling() ) + { + TPropertyType propXVal; + readComplexObj( *this, &propXVal, inInfo ); + + if(this->gotoNextSibling()) + { + TPropertyType propYVal; + readComplexObj( *this, &propYVal, inInfo ); + const_cast(inProp).addPair(mObj, propXVal, propYVal); + } + } + } + this->popCurrentContext(); + } + + void handleShapes( const PxRigidActorShapeCollection& inProp ) + { + physx::Sn::readShapesProperty( *this, mObj, &inProp ); + } + + void handleRigidActorGlobalPose(const PxRigidActorGlobalPosePropertyInfo& inProp) + { + PxArticulationLink* link = mObj->template is(); + bool isReducedCoordinateLink = (link != NULL); + if (!isReducedCoordinateLink) + { + PxRepXPropertyAccessor theAccessor(inProp); + simpleProperty(PxPropertyInfoName::PxRigidActor_GlobalPose, theAccessor); + } + } + }; + + template + struct RepXVisitorReader : public RepXVisitorReaderBase + { + RepXVisitorReader( TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, TObjType* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& ret) + : RepXVisitorReaderBase( names, contexts, args, reader, obj, alloc, collection, ret) + { + } + RepXVisitorReader( const RepXVisitorReader& other ) + : RepXVisitorReaderBase( other ) + { + } + }; + + // Specialized template to load dynamic rigid, to determine the kinematic state first + template<> + struct RepXVisitorReader : public RepXVisitorReaderBase + { + RepXVisitorReader( TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, PxRigidDynamic* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& ret) + : RepXVisitorReaderBase( names, contexts, args, reader, obj, alloc, collection, ret) + { + } + RepXVisitorReader( const RepXVisitorReader& other ) + : RepXVisitorReaderBase( other ) + { + } + + void handleShapes( const PxRigidActorShapeCollection& inProp ) + { + // Need to read the parental actor to check if actor is kinematic + // in that case we need to apply the kinematic flag before a shape is set + XmlReaderWriter* parentReader = static_cast(mReader.getParentReader()); + if(mObj) + { + const char* value; + if (parentReader->read( "RigidBodyFlags", value )) + { + if(strstr(value, "eKINEMATIC")) + { + mObj->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true); + } + } + } + physx::Sn::readShapesProperty( *this, mObj, &inProp ); + parentReader->release(); + } + + + template + void simpleProperty( PxU32 /*key*/, TAccessorType& inProp ) + { + typedef typename TAccessorType::prop_type TPropertyType; + TPropertyType value; + if (readProperty(value)) + { + // If the rigid body is kinematic, we cannot set the LinearVelocity or AngularVelocity + const bool kinematic = (mObj->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC); + if(kinematic && (inProp.mProperty.mKey == PxPropertyInfoName::PxRigidDynamic_LinearVelocity || inProp.mProperty.mKey == PxPropertyInfoName::PxRigidDynamic_AngularVelocity)) + return; + + inProp.set(mObj, value ); + } + } + private: + RepXVisitorReader& operator=(const RepXVisitorReader&); + }; + + template<> + struct RepXVisitorReader : public RepXVisitorReaderBase + { + RepXVisitorReader( TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, PxShape* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& ret ) + : RepXVisitorReaderBase( names, contexts, args, reader, obj, alloc, collection, ret ) + { + } + RepXVisitorReader( const RepXVisitorReader& other ) + : RepXVisitorReaderBase( other ) + { + } + void handleShapeMaterials( const PxShapeMaterialsProperty& ) //these were handled during construction. + { + } + void handleGeomProperty( const PxShapeGeomProperty& ) + { + } + private: + RepXVisitorReader& operator=(const RepXVisitorReader&); + }; + + template<> + struct RepXVisitorReader : public RepXVisitorReaderBase + { + RepXVisitorReader( TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, PxArticulationLink* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& ret ) + : RepXVisitorReaderBase( names, contexts, args, reader, obj, alloc, collection, ret ) + { + } + RepXVisitorReader( const RepXVisitorReader& other ) + : RepXVisitorReaderBase( other ) + { + } + void handleIncomingJoint( const TIncomingJointPropType& prop ) + { + pushName( "Joint" ); + if ( gotoTopName() ) + { + + PxArticulationJointReducedCoordinate* theJoint = static_cast((prop.get(mObj))); + readComplexObj(*this, theJoint); + //Add joint to PxCollection, since PxArticulation requires PxArticulationLink and joint. + mCollection.add(*theJoint); + + } + popName(); + } + + private: + RepXVisitorReader& operator=(const RepXVisitorReader&); + }; + + template + inline void readProperty( RepXVisitorReaderBase& inSerializer, ArticulationType* inObj, const PxArticulationLinkCollectionProp&) + { + PxProfileAllocatorWrapper theWrapper( inSerializer.mAllocator.getAllocator() ); + PxCollection& collection( inSerializer.mCollection ); + + TArticulationLinkLinkMap linkRemapMap( theWrapper ); + inSerializer.pushCurrentContext(); + if( inSerializer.gotoTopName() ) + { + for ( bool links = inSerializer.gotoFirstChild(); + links != false; + links = inSerializer.gotoNextSibling() ) + { + //Need enough information to create the link... + PxSerialObjectId theParentPtr = 0; + const PxArticulationLink* theParentLink = NULL; + if ( inSerializer.mReader.read( "Parent", theParentPtr ) ) + { + const TArticulationLinkLinkMap::Entry* theRemappedParent( linkRemapMap.find( theParentPtr ) ); + //If we have a valid at write time, we had better have a valid parent at read time. + PX_ASSERT( theRemappedParent ); + theParentLink = theRemappedParent->second; + } + PxArticulationLink* newLink = inObj->createLink( const_cast( theParentLink ), PxTransform(PxIdentity) ); + PxSerialObjectId theIdPtr = 0; + inSerializer.mReader.read( "Id", theIdPtr ); + + linkRemapMap.insert( theIdPtr, newLink ); + readComplexObj( inSerializer, newLink ); + + //Add link to PxCollection, since PxArticulation requires PxArticulationLink and joint. + collection.add( *newLink, theIdPtr ); + } + } + inSerializer.popCurrentContext(); + } + + template<> + struct RepXVisitorReader : public RepXVisitorReaderBase + { + RepXVisitorReader(TReaderNameStack& names, PxProfileArray& contexts, const PxRepXInstantiationArgs& args, XmlReader& reader, PxArticulationReducedCoordinate* obj + , XmlMemoryAllocator& alloc, PxCollection& collection, bool& ret) + : RepXVisitorReaderBase(names, contexts, args, reader, obj, alloc, collection, ret) + {} + RepXVisitorReader(const RepXVisitorReader& other) + : RepXVisitorReaderBase(other) + {} + + void handleArticulationLinks(const PxArticulationLinkCollectionProp& inProp) + { + physx::Sn::readProperty(*this, mObj, inProp); + } + }; + + template + inline bool readAllProperties( PxRepXInstantiationArgs args, TReaderNameStack& names, PxProfileArray& contexts, XmlReader& reader, TObjType* obj, XmlMemoryAllocator& alloc, PxCollection& collection, TInfoType& info ) + { + bool hadError = false; + RepXVisitorReader theReader( names, contexts, args, reader, obj, alloc, collection, hadError); + RepXPropertyFilter > theOp( theReader ); + info.visitBaseProperties( theOp ); + info.visitInstanceProperties( theOp ); + return !hadError; + } + + + template + inline bool readAllProperties( PxRepXInstantiationArgs args, XmlReader& reader, TObjType* obj, XmlMemoryAllocator& alloc, PxCollection& collection ) + { + PxProfileAllocatorWrapper wrapper( alloc.getAllocator() ); + TReaderNameStack names( wrapper ); + PxProfileArray contexts( wrapper ); + PxClassInfoTraits info; + return readAllProperties( args, names, contexts, reader, obj, alloc, collection, info.Info ); + } + + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj, TInfoType& info) + { + if(!readAllProperties( oldVisitor.mArgs, oldVisitor.mNames, oldVisitor.mContexts, oldVisitor.mReader, inObj, oldVisitor.mAllocator, oldVisitor.mCollection, info )) + oldVisitor.mHadError = true; + } + + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj, const TInfoType& info) + { + if(!readAllProperties( oldVisitor.mArgs, oldVisitor.mNames, oldVisitor.mContexts, oldVisitor.mReader, inObj, oldVisitor.mAllocator, oldVisitor.mCollection, info )) + oldVisitor.mHadError = true; + } + + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj, const PxUnknownClassInfo& /*info*/) + { + const char* value = oldVisitor.mReader.getCurrentItemValue(); + if ( value && *value ) + { + stringToType( value, *inObj ); + return; + } + oldVisitor.mHadError = true; + } + + template + inline void readComplexObj( TReaderType& oldVisitor, TObjType* inObj) + { + PxClassInfoTraits info; + if(!readAllProperties( oldVisitor.mArgs, oldVisitor.mNames, oldVisitor.mContexts, oldVisitor.mReader, inObj, oldVisitor.mAllocator, oldVisitor.mCollection, info.Info )) + oldVisitor.mHadError = true; + } + +} } + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorWriter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorWriter.h new file mode 100644 index 0000000..643f1ad --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlVisitorWriter.h @@ -0,0 +1,807 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_VISITOR_WRITER_H +#define SN_XML_VISITOR_WRITER_H + +#include "foundation/PxInlineArray.h" +#include "RepXMetaDataPropertyVisitor.h" +#include "SnPxStreamOperators.h" +#include "SnXmlMemoryPoolStreams.h" +#include "SnXmlWriter.h" +#include "SnXmlImpl.h" +#include "foundation/PxStrideIterator.h" + +namespace physx { namespace Sn { + + template + inline void writeReference( XmlWriter& writer, PxCollection& inCollection, const char* inPropName, const TDataType* inDatatype ) + { + const PxBase* s = static_cast( inDatatype ) ; + if( inDatatype && !inCollection.contains( *const_cast(s) )) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, + "PxSerialization::serializeCollectionToXml: Reference \"%s\" could not be resolved.", inPropName); + } + + PxSerialObjectId theId = 0; + if( s ) + { + theId = inCollection.getId( *s ); + if( theId == 0 ) + theId = static_cast(size_t(inDatatype)); + } + + writer.write( inPropName, PxCreateRepXObject( inDatatype, theId ) ); + } + + inline void writeProperty( XmlWriter& inWriter, MemoryBuffer& inBuffer, const char* inProp ) + { + PxU8 data = 0; + inBuffer.write( &data, sizeof(PxU8) ); + inWriter.write( inProp, reinterpret_cast( inBuffer.mBuffer ) ); + inBuffer.clear(); + } + + template + inline void writeProperty( XmlWriter& inWriter, PxCollection&, MemoryBuffer& inBuffer, const char* inPropName, TDataType inValue ) + { + inBuffer << inValue; + writeProperty( inWriter, inBuffer, inPropName ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxConvexMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxConvexMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxTriangleMesh* inDatatype ) + { + if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH33) + { + const PxBVH33TriangleMesh* dataType = inDatatype->is(); + writeReference(writer, inCollection, inPropName, dataType); + } + else if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH34) + { + const PxBVH34TriangleMesh* dataType = inDatatype->is(); + writeReference(writer, inCollection, inPropName, dataType); + } + else + { + PX_ASSERT(0); + } + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxTriangleMesh* inDatatype ) + { + if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH33) + { + PxBVH33TriangleMesh* dataType = inDatatype->is(); + writeReference(writer, inCollection, inPropName, dataType); + } + else if (inDatatype->getConcreteType() == PxConcreteType::eTRIANGLE_MESH_BVH34) + { + PxBVH34TriangleMesh* dataType = inDatatype->is(); + writeReference(writer, inCollection, inPropName, dataType); + } + else + { + PX_ASSERT(0); + } + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxBVH33TriangleMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxBVH33TriangleMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxBVH34TriangleMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxBVH34TriangleMesh* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxHeightField* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxHeightField* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, const PxRigidActor* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeProperty(XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxArticulationReducedCoordinate* inDatatype) + { + writeReference(writer, inCollection, inPropName, inDatatype); + } + + inline void writeProperty( XmlWriter& writer, PxCollection& inCollection, MemoryBuffer& /*inBuffer*/, const char* inPropName, PxRigidActor* inDatatype ) + { + writeReference( writer, inCollection, inPropName, inDatatype ); + } + + inline void writeFlagsProperty( XmlWriter& inWriter, MemoryBuffer& tempBuf, const char* inPropName, PxU32 inFlags, const PxU32ToName* inTable ) + { + if ( inTable ) + { + PxU32 flagValue( inFlags ); + if ( flagValue ) + { + for ( PxU32 idx =0; inTable[idx].mName != NULL; ++idx ) + { + if ( (inTable[idx].mValue & flagValue) == inTable[idx].mValue ) + { + if ( tempBuf.mWriteOffset != 0 ) + tempBuf << "|"; + tempBuf << inTable[idx].mName; + } + } + writeProperty( inWriter, tempBuf, inPropName ); + } + else + { + if ( tempBuf.mWriteOffset != 0 ) + tempBuf << "|"; + tempBuf << "0"; + writeProperty( inWriter, tempBuf, inPropName ); + } + } + } + + inline void writeFlagsBuffer( MemoryBuffer& tempBuf, PxU32 flagValue, const PxU32ToName* inTable ) + { + PX_ASSERT(inTable); + bool added = false; + + if ( flagValue ) + { + for ( PxU32 item =0; inTable[item].mName != NULL; ++item ) + { + if ( (inTable[item].mValue & flagValue) != 0 ) + { + if ( added ) + tempBuf << "|"; + tempBuf << inTable[item].mName; + added = true; + } + } + } + } + + inline void writePxVec3( PxOutputStream& inStream, const PxVec3& inVec ) { inStream << inVec; } + + + template + inline const TDataType& PtrAccess( const TDataType* inPtr, PxU32 inIndex ) + { + return inPtr[inIndex]; + } + + template + inline void BasicDatatypeWrite( PxOutputStream& inStream, const TDataType& item ) { inStream << item; } + + template + inline void writeBuffer( XmlWriter& inWriter, MemoryBuffer& inTempBuffer + , PxU32 inObjPerLine, const TObjType* inObjType, TAccessOperator inAccessOperator + , PxU32 inBufSize, const char* inPropName, TWriteOperator inOperator ) + { + if ( inBufSize && inObjType ) + { + for ( PxU32 idx = 0; idx < inBufSize; ++idx ) + { + if ( idx && ( idx % inObjPerLine == 0 ) ) + inTempBuffer << "\n\t\t\t"; + else + inTempBuffer << " "; + inOperator( inTempBuffer, inAccessOperator( inObjType, idx ) ); + } + writeProperty( inWriter, inTempBuffer, inPropName ); + } + } + + template + inline void writeStrideBuffer( XmlWriter& inWriter, MemoryBuffer& inTempBuffer + , PxU32 inObjPerLine, PxStrideIterator& inData, TAccessOperator inAccessOperator + , PxU32 inBufSize, const char* inPropName, PxU32 /*inStride*/, TWriteOperator inOperator ) + { +#if PX_SWITCH + const auto *dat = &inData[0]; + if (inBufSize && dat != NULL) +#else + if ( inBufSize && &inData[0]) +#endif + { + for ( PxU32 idx = 0; idx < inBufSize; ++idx ) + { + if ( idx && ( idx % inObjPerLine == 0 ) ) + inTempBuffer << "\n\t\t\t"; + else + inTempBuffer << " "; + + inOperator( inTempBuffer, inAccessOperator( &inData[idx], 0 ) ); + } + writeProperty( inWriter, inTempBuffer, inPropName ); + } + } + + + template + inline void writeStrideFlags( XmlWriter& inWriter, MemoryBuffer& inTempBuffer + , PxU32 inObjPerLine, PxStrideIterator& inData, TAccessOperator /*inAccessOperator*/ + , PxU32 inBufSize, const char* inPropName, const PxU32ToName* inTable) + { +#if PX_SWITCH + const auto *dat = &inData[0]; + if (inBufSize && dat != NULL) +#else + if ( inBufSize && &inData[0]) +#endif + { + for ( PxU32 idx = 0; idx < inBufSize; ++idx ) + { + writeFlagsBuffer(inTempBuffer, inData[idx], inTable); + + if ( idx && ( idx % inObjPerLine == 0 ) ) + inTempBuffer << "\n\t\t\t"; + else + inTempBuffer << " "; + } + writeProperty( inWriter, inTempBuffer, inPropName ); + } + } + + template + inline void writeBuffer( XmlWriter& inWriter, MemoryBuffer& inTempBuffer + , PxU32 inObjPerLine, const TDataType* inBuffer + , PxU32 inBufSize, const char* inPropName, TWriteOperator inOperator ) + { + writeBuffer( inWriter, inTempBuffer, inObjPerLine, inBuffer, PtrAccess, inBufSize, inPropName, inOperator ); + } + + template + inline void writeEnumProperty( XmlWriter& inWriter, const char* inPropName, TEnumType inEnumValue, const PxU32ToName* inConversions ) + { + PxU32 theValue = static_cast( inEnumValue ); + for ( const PxU32ToName* conv = inConversions; conv->mName != NULL; ++conv ) + if ( conv->mValue == theValue ) inWriter.write( inPropName, conv->mName ); + } + + + + template + inline void handleComplexObj( TWriterType& oldVisitor, const TObjType* inObj, const TInfoType& info); + + template + void handleComplexCollection( TVisitor& visitor, const TPropType& inProp, const char* childName, TInfoType& inInfo ) + { + PxU32 count( inProp.size( visitor.mObj ) ); + if ( count ) + { + PxInlineArray theData; + theData.resize( count ); + inProp.get( visitor.mObj, theData.begin(), count ); + for( PxU32 idx =0; idx < count; ++idx ) + { + visitor.pushName( childName ); + handleComplexObj( visitor, theData[idx], inInfo ); + visitor.popName(); + } + } + } + + template + void handleBufferCollection( TVisitor& visitor, const TPropType& inProp, const char* childName, TInfoType& inInfo ) + { + PxU32 count( inProp.size( visitor.mObj ) ); + if ( count ) + { + PxInlineArray theData; + theData.resize( count ); + inProp.get( visitor.mObj, theData.begin()); + + for( PxU32 idx =0; idx < count; ++idx ) + { + visitor.pushName( childName ); + handleComplexObj( visitor, theData[idx], inInfo ); + visitor.popName(); + } + } + } + + template + void handleShapes( TVisitor& visitor, const PxRigidActorShapeCollection& inProp ) + { + PxShapeGeneratedInfo theInfo; + + PxU32 count( inProp.size( visitor.mObj ) ); + if ( count ) + { + PxInlineArray theData; + theData.resize( count ); + inProp.get( visitor.mObj, theData.begin(), count ); + for( PxU32 idx = 0; idx < count; ++idx ) + { + const PxShape* shape = theData[idx]; + visitor.pushName( "PxShape" ); + + if( !shape->isExclusive() ) + { + writeReference( visitor.mWriter, visitor.mCollection, "PxShapeRef", shape ); + } + else + { + handleComplexObj( visitor, shape, theInfo ); + } + visitor.popName(); + } + } + } + + template + void handleShapeMaterials( TVisitor& visitor, const PxShapeMaterialsProperty& inProp ) + { + PxU32 count( inProp.size( visitor.mObj ) ); + if ( count ) + { + PxInlineArray theData; + theData.resize( count ); + inProp.get( visitor.mObj, theData.begin(), count ); + visitor.pushName( "PxMaterialRef" ); + + for( PxU32 idx =0; idx < count; ++idx ) + writeReference( visitor.mWriter, visitor.mCollection, "PxMaterialRef", theData[idx] ); + visitor.popName(); + } + } + + template + struct RepXVisitorWriterBase + { + TNameStack& mNameStack; + XmlWriter& mWriter; + const TObjType* mObj; + MemoryBuffer& mTempBuffer; + PxCollection& mCollection; + + RepXVisitorWriterBase( TNameStack& ns, XmlWriter& writer, const TObjType* obj, MemoryBuffer& buf, PxCollection& collection ) + : mNameStack( ns ) + , mWriter( writer ) + , mObj( obj ) + , mTempBuffer( buf ) + , mCollection( collection ) + { + } + + RepXVisitorWriterBase( const RepXVisitorWriterBase& other ) + : mNameStack( other.mNameStack ) + , mWriter( other.mWriter ) + , mObj( other.mObj ) + , mTempBuffer( other.mTempBuffer ) + , mCollection( other.mCollection ) + { + } + + RepXVisitorWriterBase& operator=( const RepXVisitorWriterBase& ){ PX_ASSERT( false ); return *this; } + + void gotoTopName() + { + if ( mNameStack.size() && mNameStack.back().mOpen == false ) + { + mWriter.addAndGotoChild( mNameStack.back().mName ); + mNameStack.back().mOpen = true; + } + } + + void pushName( const char* inName ) + { + gotoTopName(); + mNameStack.pushBack( inName ); + } + + void pushBracketedName( const char* inName ) { pushName( inName ); } + void popName() + { + if ( mNameStack.size() ) + { + if ( mNameStack.back().mOpen ) + mWriter.leaveChild(); + mNameStack.popBack(); + } + } + + const char* topName() const + { + if ( mNameStack.size() ) return mNameStack.back().mName; + PX_ASSERT( false ); + return "bad__repx__name"; + } + + template + void simpleProperty( PxU32 /*key*/, TAccessorType& inProp ) + { + typedef typename TAccessorType::prop_type TPropertyType; + TPropertyType propVal = inProp.get( mObj ); + writeProperty( mWriter, mCollection, mTempBuffer, topName(), propVal ); + } + + template + void enumProperty( PxU32 /*key*/, TAccessorType& inProp, const PxU32ToName* inConversions ) + { + writeEnumProperty( mWriter, topName(), inProp.get( mObj ), inConversions ); + } + + template + void flagsProperty( PxU32 /*key*/, const TAccessorType& inProp, const PxU32ToName* inConversions ) + { + writeFlagsProperty( mWriter, mTempBuffer, topName(), inProp.get( mObj ), inConversions ); + } + + template + void complexProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + TPropertyType propVal = inProp.get( mObj ); + handleComplexObj( *this, &propVal, inInfo ); + } + + template + void bufferCollectionProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo ) + { + typedef typename TAccessorType::prop_type TPropertyType; + + PxU32 count( inProp.size( mObj ) ); + PxInlineArray theData; + theData.resize( count ); + + PxClassInfoTraits theTraits; + PX_UNUSED(theTraits); + PxU32 numItems = inProp.get( mObj, theData.begin(), count ); + PX_ASSERT( numItems == count ); + for( PxU32 idx =0; idx < numItems; ++idx ) + { + pushName( inProp.name() ); + handleComplexObj( *this, &theData[idx], inInfo ); + popName(); + } + } + + template + void extendedIndexedProperty( PxU32* /*key*/, const TAccessorType& inProp, TInfoType& /*inInfo */) + { + typedef typename TAccessorType::prop_type TPropertyType; + + PxU32 count( inProp.size( mObj ) ); + PxInlineArray theData; + theData.resize( count ); + + for(PxU32 i = 0; i < count; ++i) + { + char buffer[32] = { 0 }; + sprintf( buffer, "id_%u", i ); + pushName( buffer ); + + TPropertyType propVal = inProp.get( mObj, i ); + TInfoType& infoType = PxClassInfoTraits().Info; + handleComplexObj(*this, &propVal, infoType); + popName(); + } + } + + template + void PxFixedSizeLookupTableProperty( PxU32* /*key*/, TAccessorType& inProp, TInfoType& /*inInfo */) + { + typedef typename TAccessorType::prop_type TPropertyType; + PxU32 count( inProp.size( mObj ) ); + + PxU32 index = 0; + for(PxU32 i = 0; i < count; ++i) + { + char buffer[32] = { 0 }; + sprintf( buffer, "id_%u", index++ ); + pushName( buffer ); + TPropertyType propVal = inProp.getX( mObj , i); + writeProperty( mWriter, mCollection, mTempBuffer, topName(), propVal ); + popName(); + + sprintf( buffer, "id_%u", index++ ); + pushName( buffer ); + propVal = inProp.getY( mObj , i); + writeProperty( mWriter, mCollection, mTempBuffer, topName(), propVal ); + popName(); + } + } + + void handleShapes( const PxRigidActorShapeCollection& inProp ) + { + physx::Sn::handleShapes( *this, inProp ); + } + + void handleShapeMaterials( const PxShapeMaterialsProperty& inProp ) + { + physx::Sn::handleShapeMaterials( *this, inProp ); + } + + void handleRigidActorGlobalPose(const PxRigidActorGlobalPosePropertyInfo& inProp) + { + PxRepXPropertyAccessor theAccessor(inProp); + simpleProperty(PxPropertyInfoName::PxRigidActor_GlobalPose, theAccessor); + } + + }; + + template + struct RepXVisitorWriter : RepXVisitorWriterBase + { + RepXVisitorWriter( TNameStack& ns, XmlWriter& writer, const TObjType* obj, MemoryBuffer& buf, PxCollection& collection ) + : RepXVisitorWriterBase( ns, writer, obj, buf, collection ) + { + } + + RepXVisitorWriter( const RepXVisitorWriter& other ) + : RepXVisitorWriterBase( other ) + { + } + }; + + template<> + struct RepXVisitorWriter : RepXVisitorWriterBase + { + RepXVisitorWriter( TNameStack& ns, XmlWriter& writer, const PxArticulationLink* obj, MemoryBuffer& buf, PxCollection& collection ) + : RepXVisitorWriterBase( ns, writer, obj, buf, collection ) + { + } + + RepXVisitorWriter( const RepXVisitorWriter& other ) + : RepXVisitorWriterBase( other ) + { + } + + void handleIncomingJoint( const TIncomingJointPropType& prop ) + { + const PxArticulationJointReducedCoordinate* joint( prop.get( mObj ) ); + if (joint) + { + pushName( "Joint" ); + + handleComplexObj( *this, joint, PxArticulationJointReducedCoordinateGeneratedInfo()); + + popName(); + } + } + }; + + typedef PxProfileHashMap< const PxSerialObjectId, const PxArticulationLink* > TArticulationLinkLinkMap; + + static void recurseAddLinkAndChildren( const PxArticulationLink* inLink, PxInlineArray& ioLinks ) + { + ioLinks.pushBack( inLink ); + PxInlineArray theChildren; + PxU32 childCount( inLink->getNbChildren() ); + theChildren.resize( childCount ); + inLink->getChildren( theChildren.begin(), childCount ); + for ( PxU32 idx = 0; idx < childCount; ++idx ) + recurseAddLinkAndChildren( theChildren[idx], ioLinks ); + } + + template<> + struct RepXVisitorWriter : RepXVisitorWriterBase + { + TArticulationLinkLinkMap& mArticulationLinkParents; + + RepXVisitorWriter(TNameStack& ns, XmlWriter& writer, const PxArticulationReducedCoordinate* inArticulation, MemoryBuffer& buf, PxCollection& collection, TArticulationLinkLinkMap* artMap = NULL) + : RepXVisitorWriterBase(ns, writer, inArticulation, buf, collection) + , mArticulationLinkParents(*artMap) + { + PxInlineArray > linkList(PxProfileWrapperReflectionAllocator(buf.mManager->getWrapper())); + PxU32 numLinks = inArticulation->getNbLinks(); + linkList.resize(numLinks); + inArticulation->getLinks(linkList.begin(), numLinks); + for (PxU32 idx = 0; idx < numLinks; ++idx) + { + const PxArticulationLink* theLink(linkList[idx]); + + PxInlineArray theChildList; + PxU32 numChildren = theLink->getNbChildren(); + theChildList.resize(numChildren); + theLink->getChildren(theChildList.begin(), numChildren); + for (PxU32 childIdx = 0; childIdx < numChildren; ++childIdx) + mArticulationLinkParents.insert(static_cast(size_t(theChildList[childIdx])), theLink); + } + } + + RepXVisitorWriter(const RepXVisitorWriter& other) + : RepXVisitorWriterBase(other) + , mArticulationLinkParents(other.mArticulationLinkParents) + { + } + template + void complexProperty(PxU32* /*key*/, const TAccessorType& inProp, TInfoType& inInfo) + { + typedef typename TAccessorType::prop_type TPropertyType; + TPropertyType propVal = inProp.get(mObj); + handleComplexObj(*this, &propVal, inInfo); + } + + void writeArticulationLink(const PxArticulationLink* inLink) + { + pushName("PxArticulationLink"); + gotoTopName(); + + const TArticulationLinkLinkMap::Entry* theParentPtr = mArticulationLinkParents.find(static_cast(size_t(inLink))); + if (theParentPtr != NULL) + writeProperty(mWriter, mCollection, mTempBuffer, "Parent", theParentPtr->second); + writeProperty(mWriter, mCollection, mTempBuffer, "Id", inLink); + + PxArticulationLinkGeneratedInfo info; + handleComplexObj(*this, inLink, info); + popName(); + } + + void handleArticulationLinks(const PxArticulationLinkCollectionProp& inProp) + { + //topologically sort the links as per my discussion with Dilip because + //links aren't guaranteed to have the parents before the children in the + //overall link list and it is unlikely to be done by beta 1. + PxU32 count(inProp.size(mObj)); + if (count) + { + PxInlineArray theLinks; + theLinks.resize(count); + inProp.get(mObj, theLinks.begin(), count); + + PxInlineArray theSortedLinks; + for (PxU32 idx = 0; idx < count; ++idx) + { + const PxArticulationLink* theLink(theLinks[idx]); + if (mArticulationLinkParents.find(static_cast(size_t(theLink))) == NULL) + recurseAddLinkAndChildren(theLink, theSortedLinks); + } + PX_ASSERT(theSortedLinks.size() == count); + for (PxU32 idx = 0; idx < count; ++idx) + writeArticulationLink(theSortedLinks[idx]); + popName(); + } + } + private: + RepXVisitorWriter& operator=(const RepXVisitorWriter&); + }; + + template<> + struct RepXVisitorWriter : RepXVisitorWriterBase + { + RepXVisitorWriter( TNameStack& ns, XmlWriter& writer, const PxShape* obj, MemoryBuffer& buf, PxCollection& collection ) + : RepXVisitorWriterBase( ns, writer, obj, buf, collection ) + { + } + + RepXVisitorWriter( const RepXVisitorWriter& other ) + : RepXVisitorWriterBase( other ) + { + } + + template + inline void writeGeomProperty( const PxShapeGeomProperty& inProp, const char* inTypeName ) + { + pushName( "Geometry" ); + pushName( inTypeName ); + GeometryType theType; + inProp.getGeometry( mObj, theType ); + PxClassInfoTraits theTraits; + PxU32 count = theTraits.Info.totalPropertyCount(); + if(count) + { + handleComplexObj( *this, &theType, theTraits.Info); + } + else + { + writeProperty(mWriter, mTempBuffer, inTypeName); + } + popName(); + popName(); + } + + void handleGeomProperty( const PxShapeGeomProperty& inProp ) + { + switch( mObj->getGeometryType() ) + { + case PxGeometryType::eSPHERE: writeGeomProperty( inProp, "PxSphereGeometry" ); break; + case PxGeometryType::ePLANE: writeGeomProperty( inProp, "PxPlaneGeometry" ); break; + case PxGeometryType::eCAPSULE: writeGeomProperty( inProp, "PxCapsuleGeometry" ); break; + case PxGeometryType::eBOX: writeGeomProperty( inProp, "PxBoxGeometry" ); break; + case PxGeometryType::eCONVEXMESH: writeGeomProperty( inProp, "PxConvexMeshGeometry" ); break; + case PxGeometryType::eTRIANGLEMESH: writeGeomProperty( inProp, "PxTriangleMeshGeometry" ); break; + case PxGeometryType::eHEIGHTFIELD: writeGeomProperty( inProp, "PxHeightFieldGeometry" ); break; + case PxGeometryType::eTETRAHEDRONMESH: writeGeomProperty( inProp, "PxTetrahedronMeshGeometry" ); break; + default: + PX_ASSERT( false ); + } + } + }; + + template + inline void writeAllProperties( TNameStack& inNameStack, const TObjType* inObj, XmlWriter& writer, MemoryBuffer& buffer, PxCollection& collection ) + { + RepXVisitorWriter newVisitor( inNameStack, writer, inObj, buffer, collection ); + RepXPropertyFilter > theOp( newVisitor ); + PxClassInfoTraits info; + info.Info.visitBaseProperties( theOp ); + info.Info.visitInstanceProperties( theOp ); + } + + template + inline void writeAllProperties( TNameStack& inNameStack, TObjType* inObj, XmlWriter& writer, MemoryBuffer& buffer, PxCollection& collection ) + { + RepXVisitorWriter newVisitor( inNameStack, writer, inObj, buffer, collection ); + RepXPropertyFilter > theOp( newVisitor ); + PxClassInfoTraits info; + info.Info.visitBaseProperties( theOp ); + info.Info.visitInstanceProperties( theOp ); + } + + template + inline void writeAllProperties( const TObjType* inObj, XmlWriter& writer, MemoryBuffer& buffer, PxCollection& collection ) + { + TNameStack theNames( buffer.mManager->getWrapper() ); + writeAllProperties( theNames, inObj, writer, buffer, collection ); + } + + template + inline void handleComplexObj( TWriterType& oldVisitor, const TObjType* inObj, const TInfoType& /*info*/) + { + writeAllProperties( oldVisitor.mNameStack, inObj, oldVisitor.mWriter, oldVisitor.mTempBuffer, oldVisitor.mCollection ); + } + + template + inline void handleComplexObj( TWriterType& oldVisitor, const TObjType* inObj, const PxUnknownClassInfo& /*info*/) + { + writeProperty( oldVisitor.mWriter, oldVisitor.mCollection, oldVisitor.mTempBuffer, oldVisitor.topName(), *inObj ); + } + +} } +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlWriter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlWriter.h new file mode 100644 index 0000000..b6a0cf1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/serialization/Xml/SnXmlWriter.h @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SN_XML_WRITER_H +#define SN_XML_WRITER_H + +#include "foundation/PxSimpleTypes.h" + +namespace physx { + + struct PxRepXObject; + + /** + * Writer used by extensions to write elements to a file or database + */ + class XmlWriter + { + protected: + virtual ~XmlWriter(){} + public: + /** Write a key-value pair into the current item */ + virtual void write( const char* inName, const char* inData ) = 0; + /** Write an object id into the current item */ + virtual void write( const char* inName, const PxRepXObject& inLiveObject ) = 0; + /** Add a child that then becomes the current context */ + virtual void addAndGotoChild( const char* inName ) = 0; + /** Leave the current child */ + virtual void leaveChild() = 0; + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp new file mode 100644 index 0000000..4607ae1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.cpp @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtBVH.h" +#include "ExtUtilities.h" + +namespace physx +{ + namespace Ext + { + using namespace Gu; + + void BVHDesc::query(const PxBounds3& bounds, PxArray& items) + { + items.clear(); + IntersectionCollectingTraversalController traversalController(bounds, items); + traverseBVH(tree.begin(), traversalController, 0); + } + + void BVHBuilder::build(BVHDesc& bvh, const PxBounds3* items, PxI32 n) + { + AABBTreeBounds boxes; + boxes.init(n); + for (PxI32 i = 0; i < n; ++i) + boxes.getBounds()[i] = items[i]; + Gu::buildAABBTree(n, boxes, bvh.tree); + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.h new file mode 100644 index 0000000..1dfe891 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtBVH.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef EXT_BVH_H +#define EXT_BVH_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxArray.h" +#include "GuAABBTreeNode.h" + +namespace physx +{ + namespace Ext + { + struct BVHDesc + { + PxArray tree; + void query(const PxBounds3& bounds, PxArray& items); + }; + + class BVHBuilder + { + public: + static void build(BVHDesc& bvh, const PxBounds3* items, PxI32 numItems); + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp new file mode 100644 index 0000000..672967b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.cpp @@ -0,0 +1,2350 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtDelaunayBoundaryInserter.h" +#include "ExtTetSplitting.h" +#include "ExtFastWindingNumber.h" +#include "ExtTetUnionFind.h" + +#include "ExtVec3.h" +#include "foundation/PxSort.h" +#include "foundation/PxBasicTemplates.h" +#include "CmRandom.h" + +#include "tet/ExtUtilities.h" +#include "GuAABBTree.h" +#include "GuAABBTreeQuery.h" +#include "GuIntersectionTriangleTriangle.h" +#include "GuIntersectionTetrahedronBox.h" +#include "foundation/PxMathUtils.h" +#include "GuInternal.h" +#include "common/GuMeshAnalysis.h" + +#include + +#define PI 3.141592653589793238462643383 + +namespace physx +{ +namespace Ext +{ + using namespace Gu; + + template + bool contains(const PxArray& list, const T& value) + { + for (PxU32 i = 0; i < list.size(); ++i) + if (list[i] == value) + return true; + return false; + } + + //Returns a value proportional to the signed volume of the tetrahedron specified by the points a, b, c and d + //Usualy only the result's sign is used in algorithms checking for intersections etc. + PX_FORCE_INLINE PxF64 orient3D(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& d) + { + return (a - d).dot((b - d).cross(c - d)); + } + + PX_FORCE_INLINE PxF64 sign(const PxF64 value) + { + if (value == 0) + return 0.0; + if (value > 0) + return 1.0; + return -1.0; + } + + PX_FORCE_INLINE PxF64 signedDistancePointPlane(const Vec3& point, const Vec3& normal, PxF64 planeD) + { + return point.dot(normal) + planeD; + } + + PX_FORCE_INLINE bool lineSegmentIntersectsTriangle(const Vec3& segmentStart, const Vec3& segmentEnd, + const Vec3& triA, const Vec3& triB, const Vec3& triC, Vec3& intersectionPoint) + { + Vec3 n = (triB - triA).cross(triC - triA); + + PxF64 l2 = n.magnitudeSquared(); + if (l2 < 1e-12) + return false; + + //const PxF64 s = orient3D(segmentStart, triA, triB, triC); + //const PxF64 e = orient3D(segmentEnd, triA, triB, triC); + + PxF64 planeD = -n.dot(triA); + + PxF64 s = signedDistancePointPlane(segmentStart, n, planeD); + PxF64 e = signedDistancePointPlane(segmentEnd, n, planeD); + + if (s == 0 || e == 0) + return false; + + if (/*s == 0 || e == 0 ||*/ sign(s) != sign(e)) + { + const PxF64 ab = orient3D(segmentStart, segmentEnd, triA, triB); + const PxF64 bc = orient3D(segmentStart, segmentEnd, triB, triC); + const PxF64 ca = orient3D(segmentStart, segmentEnd, triC, triA); + + const bool signAB = ab > 0; + const bool signBC = bc > 0; + const bool signCA = ca > 0; + + if ((ab == 0 && signBC == signCA) || + (bc == 0 && signAB == signCA) || + (ca == 0 && signAB == signBC) || + (signAB == signBC && signAB == signCA)) + { + s = PxAbs(s); + e = PxAbs(e); + intersectionPoint = (segmentEnd * s + segmentStart * e) / (s + e); + return true; + } + return false; + } + else + return false; + } + + //Helper class that controls the BVH traversal when checking if a specified edge intersects a triangle mesh with a BVH build around it + //Edges intersecting the triangle mesh are scheduled to get split at the point where they intersect the mesh's surface + class IntersectionFixingTraversalController + { + private: + const PxArray& triangles; + PxArray& points; + PxHashMap& edgesToSplit; + PxArray>& pointToOriginalTriangle; + + PxU64 edge; + PxI32 a; + PxI32 b; + //PxF32 minX, minY, minZ, maxX, maxY, maxZ; + PxBounds3 box; + bool repeat = false; + + public: + PX_FORCE_INLINE IntersectionFixingTraversalController(const PxArray& triangles_, PxArray& points_, + PxHashMap& edgesToSplit_, PxArray>& pointToOriginalTriangle_) : + triangles(triangles_), points(points_), edgesToSplit(edgesToSplit_), pointToOriginalTriangle(pointToOriginalTriangle_) + { } + + bool shouldRepeat() const { return repeat; } + void resetRepeat() { repeat = false; } + + PX_FORCE_INLINE void update(PxU64 e) + { + edge = e; + + a = PxI32(e >> 32); + b = PxI32(e); + const Vec3& pA = points[a]; + const Vec3& pB = points[b]; + box = PxBounds3(PxVec3(PxF32(PxMin(pA.x, pB.x)), PxF32(PxMin(pA.y, pB.y)), PxF32(PxMin(pA.z, pB.z))), + PxVec3(PxF32(PxMax(pA.x, pB.x)), PxF32(PxMax(pA.y, pB.y)), PxF32(PxMax(pA.z, pB.z)))); + } + + PX_FORCE_INLINE TraversalControl::Enum analyze(const BVHNode& node, PxI32) + { + if (node.isLeaf()) + { + PxI32 j = node.getPrimitiveIndex(); + if (!contains(pointToOriginalTriangle[a], PxI32(j)) && !contains(pointToOriginalTriangle[b], PxI32(j))) + { + const Triangle& tri = triangles[j]; + const Vec3& triA = points[tri[0]]; + const Vec3& triB = points[tri[1]]; + const Vec3& triC = points[tri[2]]; + + Vec3 intersectionPoint; + if (lineSegmentIntersectsTriangle(points[a], points[b], triA, triB, triC, intersectionPoint)) + { + if (edgesToSplit.find(edge) == NULL) + { + edgesToSplit.insert(edge, PxI32(points.size())); + points.pushBack(intersectionPoint); + PxArray arr; + arr.pushBack(j); + pointToOriginalTriangle.pushBack(arr); + } + else + { + repeat = true; + } + } + } + + return TraversalControl::eDontGoDeeper; + } + + if (node.mBV.intersects(box)) + return TraversalControl::eGoDeeper; + return TraversalControl::eDontGoDeeper; + } + + private: + PX_NOCOPY(IntersectionFixingTraversalController) + }; + +#if PX_LINUX +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + + void minMax(const PxArray& points, Vec3& min, Vec3& max) + { + min = Vec3(DBL_MAX, DBL_MAX, DBL_MAX); + max = Vec3(-DBL_MAX, -DBL_MAX, -DBL_MAX); + + for (PxU32 i = 0; i < points.size(); ++i) + { + const Vec3& p = points[i]; + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + continue; + if (p.x > max.x) max.x = p.x; if (p.y > max.y) max.y = p.y; if (p.z > max.z) max.z = p.z; + if (p.x < min.x) min.x = p.x; if (p.y < min.y) min.y = p.y; if (p.z < min.z) min.z = p.z; + } + } + +#if PX_LINUX +#pragma GCC diagnostic pop +#endif + + //Creates a delaunay tetrahedralization out of the specified points + void generateDelaunay3D(const PxArray& points, PxArray& tetrahedra) + { + Vec3 min, max; + minMax(points, min, max); + + DelaunayTetrahedralizer delaunay(min, max); + + delaunay.insertPoints(points, 0, points.size(), tetrahedra); + } + + PX_FORCE_INLINE PxF64 determinant(const Vec3& col1, const Vec3& col2, const Vec3& col3) + { + return col1.dot(col2.cross(col3)); + } + + //Simple but slow implementation of winding numbers to determine if a point is inside a mesh or not + //https://igl.ethz.ch/projects/winding-number/robust-inside-outside-segmentation-using-generalized-winding-numbers-siggraph-2013-jacobson-et-al.pdf + PxF64 windingNumber(const PxArray& points, const PxArray& triangles, const Vec3& p) + { + PxF64 sum = 0; + + for (PxU32 i = 0; i < triangles.size(); i++) + { + const Triangle& tri = triangles[i]; + const Vec3 a = points[tri[0]] - p; + const Vec3 b = points[tri[1]] - p; + const Vec3 c = points[tri[2]] - p; + PxF64 la = a.magnitude(), lb = b.magnitude(), lc = c.magnitude(); + PxF64 omega = atan2(determinant(a, b, c), (la * lb * lc + a.dot(b) * lc + b.dot(c) * la + c.dot(a) * lb)); + sum += omega; + } + + sum *= 2; + sum /= (4 * PI); + return sum; + } + + //Helper class to record the subdivision history of an edge + struct SubdivisionEdge + { + PxI32 Start; + PxI32 End; + + PxI32 ChildA; + PxI32 ChildB; + + PX_FORCE_INLINE SubdivisionEdge(PxI32 start, PxI32 end, PxI32 childA = -1, PxI32 childB = -1) : Start(start), End(end), ChildA(childA), ChildB(childB) { } + + PX_FORCE_INLINE bool HasChildren() const { return ChildA >= 0; } + }; + + //A memory friendly implementation to compute a full batch of winding numbers for every specified query point in testPoints + void multiWindingNumberMemoryFriendly(const PxArray& meshPoints, const PxArray& meshTriangles, + const PxArray& testPoints, PxArray& result) + { + PxU32 l = testPoints.size(); + result.resize(l); + for (PxU32 i = 0; i < l; ++i) + result[i] = 0.0; + + for (PxU32 i = 0; i < meshTriangles.size(); i++) + { + const Triangle& tri = meshTriangles[i]; + const Vec3 aa = meshPoints[tri[0]]; + const Vec3 bb = meshPoints[tri[1]]; + const Vec3 cc = meshPoints[tri[2]]; + + for (PxU32 j = 0; j < l; ++j) + { + const Vec3 p = testPoints[j]; + Vec3 a = aa; + Vec3 b = bb; + Vec3 c = cc; + a.x -= p.x; a.y -= p.y; a.z -= p.z; + b.x -= p.x; b.y -= p.y; b.z -= p.z; + c.x -= p.x; c.y -= p.y; c.z -= p.z; + + const PxF64 la = sqrt(a.x * a.x + a.y * a.y + a.z * a.z), + lb = sqrt(b.x * b.x + b.y * b.y + b.z * b.z), + lc = sqrt(c.x * c.x + c.y * c.y + c.z * c.z); + + const PxF64 y = a.x * b.y * c.z - a.x * b.z * c.y - a.y * b.x * c.z + a.y * b.z * c.x + a.z * b.x * c.y - a.z * b.y * c.x; + const PxF64 x = (la * lb * lc + (a.x * b.x + a.y * b.y + a.z * b.z) * lc + + (b.x * c.x + b.y * c.y + b.z * c.z) * la + (c.x * a.x + c.y * a.y + c.z * a.z) * lb); + const PxF64 omega = atan2(y, x); + + result[j] += omega; + } + } + + PxF64 scaling = 2.0 / (4 * PI); + for (PxU32 i = 0; i < l; ++i) + result[i] *= scaling; + } + + + //Generates a tetmesh matching the surface of the specified triangle mesh exactly - might insert additional points on the + //triangle mesh's surface. I also provides access about the location of newly created points. + void generateTetmesh(const PxArray& trianglePoints, const PxArray& triangles, + PxArray& allEdges, PxI32& numOriginalEdges, PxArray>& pointToOriginalTriangle, + PxI32& numPointsBelongingToMultipleTriangles, PxArray& points, PxArray& finalTets) + { + points.resize(trianglePoints.size()); + for (PxU32 i = 0; i < trianglePoints.size(); ++i) + points[i] = trianglePoints[i]; + + Vec3 min, max; + minMax(points, min, max); + + PxHashSet edges; + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + edges.insert(key(tri[0], tri[1])); + edges.insert(key(tri[1], tri[2])); + edges.insert(key(tri[0], tri[2])); + } + numOriginalEdges = PxI32(edges.size()); + + allEdges.clear(); + for (PxHashSet::Iterator iter = edges.getIterator(); !iter.done(); ++iter) + { + allEdges.pushBack(SubdivisionEdge(PxI32((*iter) >> 32), PxI32(*iter))); + } + + pointToOriginalTriangle.clear(); + for (PxU32 i = 0; i < points.size(); ++i) + pointToOriginalTriangle.pushBack(PxArray()); + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + pointToOriginalTriangle[tri[0]].pushBack(i); + pointToOriginalTriangle[tri[1]].pushBack(i); + pointToOriginalTriangle[tri[2]].pushBack(i); + } + for (PxU32 i = 0; i < points.size(); ++i) { + PxArray& list = pointToOriginalTriangle[i]; + PxSort(list.begin(), list.size()); + } + + + PxArray tets; + + DelaunayTetrahedralizer del(min, max); + PxU32 prevCount = 0; + + bool success = true; + PxHashSet tetEdges; + PxArray intersection; + //Subdivide edges and insert new points ond edges into delaunay tetrahedralization until + //all required edges are present in the tetrahedralization + while (success) + { + success = false; + + del.insertPoints(points, prevCount, points.size(), tets); + prevCount = points.size(); + + tetEdges.clear(); + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + tetEdges.insert(key(tet[0], tet[1])); + tetEdges.insert(key(tet[0], tet[2])); + tetEdges.insert(key(tet[0], tet[3])); + tetEdges.insert(key(tet[1], tet[2])); + tetEdges.insert(key(tet[1], tet[3])); + tetEdges.insert(key(tet[2], tet[3])); + } + + PxU32 l = allEdges.size(); + for (PxU32 i = 0; i < l; ++i) + { + SubdivisionEdge e = allEdges[i]; //Copy the edge here because we modify the list below and the reference could get invalid if the list resizes internally + if (e.HasChildren()) + continue; + + const PxU64 k = key(e.Start, e.End); + if (!tetEdges.contains(k)) + { + allEdges.pushBack(SubdivisionEdge(e.Start, PxI32(points.size()))); + allEdges.pushBack(SubdivisionEdge(PxI32(points.size()), e.End)); + e.ChildA = PxI32(allEdges.size()) - 2; + e.ChildB = PxI32(allEdges.size()) - 1; + allEdges[i] = e; //Write the modified edge back since we did not capture a reference but made a copy + + points.pushBack((points[e.Start] + points[e.End]) * 0.5); + intersection.clear(); + intersectionOfSortedLists(pointToOriginalTriangle[e.Start], pointToOriginalTriangle[e.End], intersection); + pointToOriginalTriangle.pushBack(intersection); + + success = true; + } + } + } + + for (PxU32 i = 0; i < tets.size(); ++i) + { + Tetrahedron& tet = tets[i]; + if (tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]) < 0) + PxSwap(tet[0], tet[1]); + } + + + PxHashMap edgesToSplit; + numPointsBelongingToMultipleTriangles = PxI32(points.size()); + + //Split all tetrahedron edges that penetrate the triangle mesh's surface + PxArray tree; + buildTree(triangles, points, tree); + IntersectionFixingTraversalController controller(triangles, points, edgesToSplit, pointToOriginalTriangle); + + for (PxHashSet::Iterator iter = tetEdges.getIterator(); !iter.done(); ++iter) + { + const PxU64 edge = *iter; + controller.update(edge); + traverseBVH(tree.begin(), controller); + } + split(tets, points, edgesToSplit); + + //Remove all tetrahedra that are outside of the triangle mesh + PxHashMap clusters; + precomputeClusterInformation(tree, triangles, points, clusters); + + PxArray windingNumbers; + windingNumbers.resize(tets.size()); + PxF64 sign = 1; + PxF64 windingNumberSum = 0; + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + Vec3 q = (points[tet[0]] + points[tet[1]] + points[tet[2]] + points[tet[3]]) * 0.25; + PxF64 windingNumber = computeWindingNumber(tree, q, 2.0, clusters, triangles, points); + + windingNumbers[i] = windingNumber; + windingNumberSum += windingNumber; + } + if (windingNumberSum < 0.0) + sign = -1; + + //Array tetCenters; + //tetCenters.resize(tets.size()); + //for (PxU32 i = 0; i < tets.size(); ++i) + //{ + // const Tetrahedron& tet = tets[i]; + // tetCenters[i] = (points[tet.A] + points[tet.B] + points[tet.c] + points[tet.D]) * 0.25; + //} + //multiWindingNumberMemoryFriendly(points, triangles, tetCenters, windingNumbers); + + finalTets.clear(); + for (PxU32 i = 0; i < windingNumbers.size(); ++i) + if (sign * windingNumbers[i] > 0.5) + finalTets.pushBack(tets[i]); + + for (PxU32 i = 0; i < finalTets.size(); ++i) + { + Tetrahedron& tet = finalTets[i]; + if (tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]) < 0) + PxSwap(tet[0], tet[1]); + } + } + + void generateTetmesh(const PxArray& trianglePoints, const PxArray& triangles, + PxArray& points, PxArray& finalTets) + { + PxArray allEdges; + PxI32 numOriginalEdges; + PxArray> pointToOriginalTriangle; + PxI32 numPointsBelongingToMultipleTriangles; + generateTetmesh(trianglePoints, triangles, allEdges, numOriginalEdges, pointToOriginalTriangle, numPointsBelongingToMultipleTriangles, points, finalTets); + } + + static const PxI32 tetFaces[4][3] = { {0, 1, 2}, {0, 3, 1}, {0, 2, 3}, {1, 3, 2} }; + void extractTetmeshSurface(const PxArray& tets, PxArray& triangles) + { + PxHashMap tris; + + for (PxU32 i = 0; i < tets.size(); i += 4) + { + for (PxU32 j = 0; j < 4; ++j) + { + SortedTriangle tri(tets[i + tetFaces[j][0]], tets[i + tetFaces[j][1]], tets[i + tetFaces[j][2]]); + if (const PxPair* ptr = tris.find(tri)) + tris[tri] = ptr->second + 1; + else + tris.insert(tri, 1); + } + } + + triangles.clear(); + for (PxHashMap::Iterator iter = tris.getIterator(); !iter.done(); ++iter) + { + if (iter->second == 1) { + triangles.pushBack(iter->first.A); + if (iter->first.Flipped) + { + triangles.pushBack(iter->first.C); + triangles.pushBack(iter->first.B); + } + else + { + triangles.pushBack(iter->first.B); + triangles.pushBack(iter->first.C); + } + } + } + } + + struct TriangleWithTetLink + { + PxI32 triA; + PxI32 triB; + PxI32 triC; + PxI32 tetId; + + TriangleWithTetLink(PxI32 triA_, PxI32 triB_, PxI32 triC_, PxI32 tetId_) : triA(triA_), triB(triB_), triC(triC_), tetId(tetId_) + {} + }; + + void extractTetmeshSurfaceWithTetLink(const PxArray& tets, PxArray& surface) + { + PxHashMap tris; + + for (PxU32 i = 0; i < tets.size(); ++i) + { + if (tets[i][0] < 0) + continue; + for (PxU32 j = 0; j < 4; ++j) + { + SortedTriangle tri(tets[i][tetFaces[j][0]], tets[i][tetFaces[j][1]], tets[i][tetFaces[j][2]]); + if (tris.find(tri)) + tris[tri] = -1; + else + tris.insert(tri, i); + } + } + + surface.clear(); + for (PxHashMap::Iterator iter = tris.getIterator(); !iter.done(); ++iter) + { + if (iter->second >= 0) + surface.pushBack(TriangleWithTetLink(iter->first.A, iter->first.B, iter->first.C, iter->second)); + } + } + + //Removes vertices not referenced by any tetrahedron and maps the tet's indices to match the compacted vertex list + void removeUnusedVertices(PxArray& vertices, PxArray& tets, PxU32 numPointsToKeepAtBeginning = 0) + { + PxArray compressorMap; + compressorMap.resize(vertices.size()); + + for (PxU32 i = 0; i < numPointsToKeepAtBeginning; ++i) + compressorMap[i] = 0; + for (PxU32 i = numPointsToKeepAtBeginning; i < compressorMap.size(); ++i) + compressorMap[i] = -1; + + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + compressorMap[tet[0]] = 0; + compressorMap[tet[1]] = 0; + compressorMap[tet[2]] = 0; + compressorMap[tet[3]] = 0; + } + + PxU32 indexer = 0; + for (PxU32 i = 0; i < compressorMap.size(); ++i) + { + if (compressorMap[i] >= 0) + { + compressorMap[i] = indexer; + vertices[indexer] = vertices[i]; + indexer++; + } + } + + for (PxU32 i = 0; i < tets.size(); ++i) + { + Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + tet[0] = compressorMap[tet[0]]; + tet[1] = compressorMap[tet[1]]; + tet[2] = compressorMap[tet[2]]; + tet[3] = compressorMap[tet[3]]; + } + + if (indexer < vertices.size()) + vertices.removeRange(indexer, vertices.size() - indexer); + } + + PxF64 tetQuality(const Vec3& p0, const Vec3& p1, const Vec3& p2, const Vec3& p3) + { + const Vec3 d0 = p1 - p0; + const Vec3 d1 = p2 - p0; + const Vec3 d2 = p3 - p0; + const Vec3 d3 = p2 - p1; + const Vec3 d4 = p3 - p2; + const Vec3 d5 = p1 - p3; + + PxF64 s0 = d0.magnitudeSquared(); + PxF64 s1 = d1.magnitudeSquared(); + PxF64 s2 = d2.magnitudeSquared(); + PxF64 s3 = d3.magnitudeSquared(); + PxF64 s4 = d4.magnitudeSquared(); + PxF64 s5 = d5.magnitudeSquared(); + + PxF64 ms = (1.0 / 6.0) * (s0 + s1 + s2 + s3 + s4 + s5); + PxF64 rms = PxSqrt(ms); + + PxF64 s = 12.0 / PxSqrt(2.0); + + PxF64 vol = PxAbs((1.0 / 6.0) * d0.dot(d1.cross(d2))); + return s * vol / (rms * rms * rms); // Ideal tet has quality 1 + } + + //The face must be one of the 4 faces from the tetrahedron, otherwise the result will be incorrect + PX_FORCE_INLINE PxI32 getTetCornerOppositeToFace(const Tetrahedron& tet, PxI32 faceA, PxI32 faceB, PxI32 faceC) + { + return tet[0] + tet[1] + tet[2] + tet[3] - faceA - faceB - faceC; + } + + void improveTetmesh(PxArray& points, PxArray& finalTets, PxI32 numPointsBelongingToMultipleTriangles, + PxArray>& pointToOriginalTriangle, PxArray>& edges, PxI32 numOriginalPoints) + { + DelaunayTetrahedralizer del(points, finalTets); + bool success = true; + //Collapse edges as long as we find collapsible edges + //Only collaps edges such that the input triangle mesh's edges are preserved + while (success) + { + success = false; + + PxArray adjTets; + // Try to remove points that are on the interior of an original face + for (PxU32 i = numPointsBelongingToMultipleTriangles; i < points.size(); ++i) + { + PxI32 tri = pointToOriginalTriangle[i][0]; + + adjTets.forceSize_Unsafe(0); + del.collectTetsConnectedToVertex(i, adjTets); + for (PxU32 j = 0; j < adjTets.size(); ++j) + { + const Tetrahedron& tet = del.tetrahedron(adjTets[j]); + if (tet[0] < 0) + continue; + + for (PxI32 k = 0; k < 4; ++k) { + PxI32 id = tet[k]; + if (id != PxI32(i) && contains(pointToOriginalTriangle[id], tri)) + { + if (del.canCollapseEdge(id, i)) + { + del.collapseEdge(id, i); + break; + } + } + } + } + } + + // Try to remove points that are on the edge between two original faces + for (PxU32 i = 0; i < edges.size(); ++i) + { + PxArray& edge = edges[i]; + if (edge.size() == 2) + continue; + + for (PxU32 j = edge.size() - 1; j >= 1; --j) + { + const PxI32 remove = edge[j - 1]; + const PxI32 keep = edge[j]; + if (remove >= numOriginalPoints && del.canCollapseEdge(keep, remove)) + { + del.collapseEdge(keep, remove); + success = true; + edge.remove(j - 1); + } + } + + for (PxU32 j = 1; j < edge.size(); ++j) + { + const PxI32 keep = edge[j - 1]; + const PxI32 remove = edge[j]; + if (remove >= numOriginalPoints && del.canCollapseEdge(keep, remove)) + { + del.collapseEdge(keep, remove); + success = true; + edge.remove(j); + --j; + } + } + } + } + + optimize(del, pointToOriginalTriangle, numOriginalPoints, points, finalTets, 10); + + //Remove sliver tets on surface + success = true; + while (success) + { + success = false; + PxArray surface; + extractTetmeshSurfaceWithTetLink(finalTets, surface); + + for (PxU32 i = 0; i < surface.size(); ++i) + { + const TriangleWithTetLink& link = surface[i]; + const Tetrahedron& tet = finalTets[link.tetId]; + if (tet[0] < 0) + continue; + PxI32 other = getTetCornerOppositeToFace(tet, link.triA, link.triB, link.triC); + + const Vec3& a = points[link.triA]; + const Vec3& b = points[link.triB]; + const Vec3& c = points[link.triC]; + Vec3 n = (b - a).cross(c - a); + //n.normalize(); + PxF64 planeD = -(n.dot(a)); + + PxF64 dist = PxAbs(signedDistancePointPlane(points[other], n, planeD)); + if (dist < 1e-4 * n.magnitude()) + { + finalTets[link.tetId] = Tetrahedron(-1, -1, -1, -1); + success = true; + } + } + } + + + PxU32 indexer = 0; + for (PxU32 i = 0; i < finalTets.size(); ++i) + { + const Tetrahedron& tet = finalTets[i]; + if (tet[0] >= 0) + finalTets[indexer++] = tet; + } + if (indexer < finalTets.size()) + finalTets.removeRange(indexer, finalTets.size() - indexer); + + removeUnusedVertices(points, finalTets, numOriginalPoints); + + for (PxU32 i = 0; i < finalTets.size(); ++i) + { + Tetrahedron& tet = finalTets[i]; + if (tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]) < 0) + PxSwap(tet[0], tet[1]); + } + } + + PxU32 removeDisconnectedIslands(PxI32* finalTets, PxU32 numTets) + { + //Detect islands + PxArray neighborhood; + buildNeighborhood(finalTets, numTets, neighborhood); + PxArray tetColors; + tetColors.resize(numTets, -1); + PxU32 start = 0; + PxI32 color = -1; + PxArray stack; + while (true) + { + stack.clear(); + while (start < tetColors.size()) + { + if (tetColors[start] < 0) + { + stack.pushBack(start); + ++color; + tetColors[start] = color; + break; + } + ++start; + } + + if (start == tetColors.size()) + break; + + while (stack.size() > 0) + { + PxI32 id = stack.popBack(); + for (PxI32 i = 0; i < 4; ++i) + { + PxI32 a = neighborhood[4 * id + i]; + PxI32 tetId = a >> 2; + if (tetId >= 0 && tetColors[tetId] == -1) + { + stack.pushBack(tetId); + tetColors[tetId] = color; + } + } + } + } + + if (color > 0) + { + //Found more than one island: Count number of tets per color + PxArray numTetsPerColor; + numTetsPerColor.resize(color + 1, 0); + for (PxU32 i = 0; i < tetColors.size(); ++i) + numTetsPerColor[tetColors[i]] += 1; + + PxI32 colorWithHighestTetCount = 0; + for (PxU32 i = 1; i < numTetsPerColor.size(); ++i) + if (numTetsPerColor[i] > numTetsPerColor[colorWithHighestTetCount]) + colorWithHighestTetCount = i; + + PxU32 indexer = 0; + for (PxU32 i = 0; i < numTets; ++i) + { + for (PxU32 j = 0; j < 4; ++j) + finalTets[4 * indexer + j] = finalTets[4 * i + j]; + if (tetColors[i] == colorWithHighestTetCount) + ++indexer; + } + //if (indexer < finalTets.size()) + // finalTets.removeRange(indexer, finalTets.size() - indexer); + return numTets - indexer; + } + return 0; + } + + void removeDisconnectedIslands(PxArray& finalTets) + { + PxU32 numRemoveAtEnd = removeDisconnectedIslands(reinterpret_cast(finalTets.begin()), finalTets.size()); + if (numRemoveAtEnd > 0) + finalTets.removeRange(finalTets.size() - numRemoveAtEnd, numRemoveAtEnd); + } + + //Generates a tetmesh matching the surface of the specified triangle mesh exactly - might insert additional points on the + //triangle mesh's surface. It will try to remove as many points inserted during construction as possible by applying an + //edge collapse post processing step. + void generateTetsWithCollapse(const PxArray& trianglePoints, const PxArray& triangles, + PxArray& points, PxArray& finalTets) + { + const PxI32 numOriginalPoints = PxI32(trianglePoints.size()); + + PxArray> pointToOriginalTriangle; + + PxI32 numPointsBelongingToMultipleTriangles; + + PxArray> edges; + + + Vec3 min, max; + minMax(trianglePoints, min, max); + DelaunayTetrahedralizer del(min, max); + PxArray tets; + del.generateTetmeshEnforcingEdges(trianglePoints, triangles, edges, pointToOriginalTriangle, points, tets); + + + PxHashSet tetEdges; + + numPointsBelongingToMultipleTriangles = points.size(); + PxHashMap edgesToSplit; + + IntersectionFixingTraversalController controller(triangles, points, edgesToSplit, pointToOriginalTriangle); + + PxArray tree; + buildTree(triangles, points, tree); + + PxI32 counter = 0; + do + { + controller.resetRepeat(); + tetEdges.clear(); + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + tetEdges.insert(key(tet[0], tet[1])); + tetEdges.insert(key(tet[0], tet[2])); + tetEdges.insert(key(tet[0], tet[3])); + tetEdges.insert(key(tet[1], tet[2])); + tetEdges.insert(key(tet[1], tet[3])); + tetEdges.insert(key(tet[2], tet[3])); + } + + edgesToSplit.clear(); + for (PxHashSet::Iterator iter = tetEdges.getIterator(); !iter.done(); ++iter) + { + const PxU64 edge = *iter; + controller.update(edge); + traverseBVH(tree.begin(), controller); + } + + split(tets, points, /*remaining*/edgesToSplit); + ++counter; + if (counter >= 2) + break; + } while (controller.shouldRepeat()); + + //Remove all tetrahedra that are outside of the triangle mesh + PxHashMap clusters; + precomputeClusterInformation(tree, triangles, points, clusters); + + PxArray windingNumbers; + windingNumbers.resize(tets.size()); + PxF64 sign = 1; + PxF64 windingNumberSum = 0; + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + Vec3 q = (points[tet[0]] + points[tet[1]] + points[tet[2]] + points[tet[3]]) * 0.25; + PxF64 windingNumber = computeWindingNumber(tree, q, 2.0, clusters, triangles, points); + windingNumbers[i] = windingNumber; + windingNumberSum += windingNumber; + } + if (windingNumberSum < 0.0) + sign = -1; + + finalTets.clear(); + for (PxU32 i = 0; i < windingNumbers.size(); ++i) + if (sign * windingNumbers[i] > 0.5) + finalTets.pushBack(tets[i]); + + for (PxU32 i = 0; i < finalTets.size(); ++i) + { + Tetrahedron& tet = finalTets[i]; + if (tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]) < 0) + PxSwap(tet[0], tet[1]); + } + + improveTetmesh(points, finalTets, numPointsBelongingToMultipleTriangles, pointToOriginalTriangle, edges, numOriginalPoints); + } + + bool convexTetmesh(PxArray& points, const PxArray& tris, PxArray& tets) + { + Vec3 centroid = Vec3(0.0f, 0.0f, 0.0f); + PxI32 counter = 0; + for (PxU32 i = 0; i < points.size(); ++i) + { + const Vec3& p = points[i]; + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + continue; + centroid += p; + ++counter; + } + + centroid /= counter; + + PxF64 volSign = 0; + PxU32 centerIndex = points.size(); + points.pushBack(centroid); + tets.clear(); + tets.reserve(tris.size()); + for (PxU32 i = 0; i < tris.size(); ++i) + { + const Triangle& tri = tris[i]; + Tetrahedron tet = Tetrahedron(centerIndex, tri[0], tri[1], tri[2]); + const PxF64 vol = tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + + if (vol < 0) + PxSwap(tet[2], tet[3]); + + tets.pushBack(tet); + + if (volSign == 0) + { + volSign = vol > 0 ? 1 : -1; + } + else if (volSign * vol < 0) + { + points.remove(points.size() - 1); + tets.clear(); + return false; + } + } + + return true; + } + + void convert(const PxArray& points, PxArray& result) + { + result.resize(points.size() / 3); + for (PxU32 i = 0; i < result.size(); ++i) + result[i] = Vec3(points[3 * i], points[3 * i + 1], points[3 * i + 2]); + } + + void convert(const PxArray& points, PxArray& result) + { + result.resize(3 * points.size()); + for (PxU32 i = 0; i < points.size(); ++i) + { + const Vec3& p = points[i]; + result[3 * i] = PxF32(p.x); + result[3 * i + 1] = PxF32(p.y); + result[3 * i + 2] = PxF32(p.z); + } + } + + void convert(const PxArray& points, PxArray& result) + { + result.resize(points.size()); + for (PxU32 i = 0; i < points.size(); ++i) + { + const Vec3& p = points[i]; + result[i] = PxVec3(PxF32(p.x), PxF32(p.y), PxF32(p.z)); + } + } + + void convert(const PxBoundedData& points, PxArray& result) + { + result.resize(points.count); + for (PxU32 i = 0; i < points.count; ++i) + { + const PxVec3& p = points.at(i); + result[i] = Vec3(p.x, p.y, p.z); + } + } + + void convert(const PxArray& indices, PxArray& result) + { + //static cast possible? + result.resize(indices.size() / 3); + for (PxU32 i = 0; i < result.size(); ++i) + result[i] = Triangle(indices[3 * i], indices[3 * i + 1], indices[3 * i + 2]); + } + + void convert(const PxBoundedData& indices, bool has16bitIndices, PxArray& result) + { + result.resize(indices.count); + if (has16bitIndices) + { + for (PxU32 i = 0; i < indices.count; ++i) + { + const Triangle16& tri = indices.at(i); + result[i] = Triangle(tri[0], tri[1], tri[2]); + } + } + else + { + for (PxU32 i = 0; i < indices.count; ++i) + result[i] = indices.at(i); + } + } + + void convert(const PxArray& tetrahedra, PxArray& result) + { + //static cast possible? + result.resize(4 * tetrahedra.size()); + for (PxU32 i = 0; i < tetrahedra.size(); ++i) + { + const Tetrahedron& t = tetrahedra[i]; + result[4 * i] = t[0]; + result[4 * i + 1] = t[1]; + result[4 * i + 2] = t[2]; + result[4 * i + 3] = t[3]; + } + } + + //Keep for debugging & verification + void writeTets(const char* path, const PxArray& tetPoints, const PxArray& tets) + { + FILE *fp; + + fp = fopen(path, "w+"); + fprintf(fp, "# Tetrahedral mesh generated using\n\n"); + + + fprintf(fp, "# %d vertices\n", tetPoints.size()); + for (PxU32 i = 0; i < tetPoints.size(); ++i) + { + fprintf(fp, "v %f %f %f\n", PxF64(tetPoints[i].x), PxF64(tetPoints[i].y), PxF64(tetPoints[i].z)); + } + + fprintf(fp, "\n"); + fprintf(fp, "# %d tetrahedra\n", (tets.size() / 4)); + for (PxU32 i = 0; i < tets.size(); i += 4) + { + fprintf(fp, "t %d %d %d %d\n", tets[i], tets[i + 1], tets[i + 2], tets[i + 3]); + } + + fclose(fp); + } + + //Keep for debugging & verification + void writeOFF(const char* path, const PxArray& vertices, const PxArray& tris) + { + FILE *fp; + + fp = fopen(path, "w+"); + fprintf(fp, "OFF\n"); + + fprintf(fp, "%d %d 0\n", vertices.size() / 3, tris.size() / 3); + for (PxU32 i = 0; i < vertices.size(); i += 3) + { + fprintf(fp, "%f %f %f\n", PxF64(vertices[i]), PxF64(vertices[i + 1]), PxF64(vertices[i + 2])); + } + + for (PxU32 i = 0; i < tris.size(); i += 3) + { + fprintf(fp, "3 %d %d %d\n", tris[i], tris[i + 1], tris[i + 2]); + } + + fclose(fp); + } + + //Keep for debugging & verification + void writeSTL(const char* path, const PxArray& vertices, const PxArray& tris) + { + FILE *fp; + + fp = fopen(path, "w+"); + fprintf(fp, "solid mesh\n"); + + for (PxU32 i = 0; i < tris.size(); i += 3) + { + const PxI32* tri = &tris[3 * i]; + const PxVec3& a = vertices[tri[0]]; + const PxVec3& b = vertices[tri[1]]; + const PxVec3& c = vertices[tri[2]]; + PxVec3 n = (b - a).cross(c - a); + n.normalize(); + + fprintf(fp, "facet normal %f %f %f\n", PxF64(n.x), PxF64(n.y), PxF64(n.z)); + fprintf(fp, "%s", "outer loop\n"); + + fprintf(fp, " vertex %f %f %f\n", PxF64(a.x), PxF64(a.y), PxF64(a.z)); + fprintf(fp, " vertex %f %f %f\n", PxF64(b.x), PxF64(b.y), PxF64(b.z)); + fprintf(fp, " vertex %f %f %f\n", PxF64(c.x), PxF64(c.y), PxF64(c.z)); + + fprintf(fp, "%s", "endloop\n"); + fprintf(fp, "%s", "endfacet\n"); + } + + fprintf(fp, "endsolid mesh\n"); + fclose(fp); + } + + void generateTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTriangles, const bool has16bitIndices, + PxArray& tetPoints, PxArray& finalTets) + { + //writeOFF("c:\\tmp\\debug.off", trianglePoints, triangles); + + PxArray points; + convert(inputPoints, points); + PxArray tris; + convert(inputTriangles, has16bitIndices, tris); + + //PxTriangleMeshAnalysisResults result = validateTriangleMesh(inputPoints, inputTriangles, has16bitIndices); + //PX_ASSERT(!(result & PxTriangleMeshAnalysisResult::eMESH_IS_INVALID)); + + PxArray map; + MeshAnalyzer::mapDuplicatePoints(points, map); + for (PxI32 i = 0; i < PxI32(points.size()); ++i) + { + if(map[i] != i) + points[i] = Vec3(NAN, NAN, NAN); + } + for (PxU32 i = 0; i < tris.size(); ++i) + { + Triangle& t = tris[i]; + for (PxU32 j = 0; j < 3; ++j) + t[j] = map[t[j]]; + if (t[0] == t[1] || t[1] == t[2] || t[0] == t[2]) + { + tris[i] = tris[tris.size() - 1]; + tris.remove(tris.size() - 1); + --i; + } + } + + PxArray tetPts; + PxArray tets; + //if (makeTriOrientationConsistent(tris)) + { + if (convexTetmesh(points, tris, tets)) + { + tetPts.clear(); + tetPts.reserve(tris.size()); + for (PxU32 i = 0/*l*/; i < map.size(); ++i) + { + tetPts.pushBack(points[map[i]]); + } + for (PxU32 i = map.size(); i < points.size(); ++i) + { + tetPts.pushBack(points[i]); + } + } + else + { + //Transform points such that the are located inside the unit cube + Vec3 min, max; + minMax(points, min, max); + Vec3 size = max - min; + PxF64 scaling = 1.0 / PxMax(size.x, PxMax(size.y, size.z)); + + //Add some noise to avoid geometric degeneracies + Cm::RandomR250 r(0); + PxF64 randomMagnitude = 1e-6; + for (PxU32 i = 0; i < points.size(); ++i) + { + Vec3& p = points[i]; + p = (p - min) * scaling; + p.x += PxF64(r.rand(-0.5f, 0.5f)) * randomMagnitude; + p.y += PxF64(r.rand(-0.5f, 0.5f)) * randomMagnitude; + p.z += PxF64(r.rand(-0.5f, 0.5f)) * randomMagnitude; + } + + generateTetsWithCollapse(points, tris, tetPts, tets); + + //Scale back to original size + scaling = 1.0 / scaling; + //for (PxU32 i = 0; i < l; ++i) + // tetPts[i] = Vec3(trianglePoints[3 * i], trianglePoints[3 * i + 1], trianglePoints[3 * i + 2]); + for (PxU32 i = 0; i < map.size(); ++i) + { + tetPts[i] = tetPts[map[i]]; + } + for (PxU32 i = 0; i < tetPts.size(); ++i) + { + tetPts[i] = tetPts[i] * scaling + min; + } + } + } + convert(tetPts, tetPoints); + convert(tets, finalTets); + + //writeTets("c:\\tmp\\bottle.tet", tetPoints, finalTets); + } + + PX_FORCE_INLINE PxF32 tetVolume(const PxVec3& a, const PxVec3& b, const PxVec3& c, const PxVec3& d) + { + return (-1.0f / 6.0f) * (a - d).dot((b - d).cross(c - d)); + } + + void pointMasses(const PxArray& tetVerts, const PxArray& tets, PxF32 density, PxArray& mass) + { + mass.resize(tetVerts.size()); + for (PxU32 i = 0; i < mass.size(); ++i) + mass[i] = 0.0f; + + //const PxVec3* verts = (PxVec3*)&tetVerts[0]; + for (PxU32 i = 0; i < tets.size(); i += 4) + { + PxF32 weightDiv4 = density * 0.25f * PxAbs(tetVolume(tetVerts[tets[i]], tetVerts[tets[i + 1]], tetVerts[tets[i + 2]], tetVerts[tets[i + 3]])); + mass[tets[i]] += weightDiv4; + mass[tets[i + 1]] += weightDiv4; + mass[tets[i + 2]] += weightDiv4; + mass[tets[i + 3]] += weightDiv4; + } + } + + void restPoses(const PxArray& tetVerts, const PxArray& tets, PxArray& restPoses) + { + restPoses.resize(tets.size() / 4); + + //const PxVec3* verts = (PxVec3*)&tetVerts[0]; + for (PxU32 i = 0; i < tets.size(); i += 4) + { + const PxVec3 u1 = tetVerts[tets[i + 1]] - tetVerts[tets[i]]; + const PxVec3 u2 = tetVerts[tets[i + 2]] - tetVerts[tets[i]]; + const PxVec3 u3 = tetVerts[tets[i + 3]] - tetVerts[tets[i]]; + + const PxMat33 m = PxMat33(u1, u2, u3); + const PxMat33 rest = m.getInverse(); + restPoses[i / 4] = rest; + } + } + + void tetFibers(const PxArray& /*tetVerts*/, const PxArray& tets, PxArray& tetFibers) + { + //Just use dummy data for the moment. Could solve a heat equation on the tetmesh to get better fibers but the boundary conditions of the heat quations need to be known + tetFibers.resize(tets.size() / 4); + for (PxU32 i = 0; i < tets.size(); i += 4) + { + tetFibers[i / 4] = PxVec3(1.0f, 0.f, 0.f); + } + } + + + + void minMax(const PxBoundedData& points, PxVec3& min, PxVec3& max) + { + min = PxVec3(PX_MAX_F32); + max = PxVec3(-PX_MAX_F32); + + for (PxU32 i = 0; i < points.count; ++i) + { + const PxVec3& p = points.at(i); + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + continue; + max = max.maximum(p); + min = min.minimum(p); + } + } + + const PxI32 xNegFace[4] = { 0, 1, 2, 3 }; + const PxI32 xPosFace[4] = { 4, 5, 6, 7 }; + const PxI32 yNegFace[4] = { 0, 1, 4, 5 }; + const PxI32 yPosFace[4] = { 2, 3, 6, 7 }; + const PxI32 zNegFace[4] = { 0, 2, 4, 6 }; + const PxI32 zPosFace[4] = { 1, 3, 5, 7 }; + + const PxI32 offsetsX[8] = { 0, 0, 0, 0, 1, 1, 1, 1 }; + const PxI32 offsetsY[8] = { 0, 0, 1, 1, 0, 0, 1, 1 }; + const PxI32 offsetsZ[8] = { 0, 1, 0, 1, 0, 1, 0, 1 }; + + + const PxI32 tets6PerVoxel[24] = { 0,1,6,2, 0,1,4,6, 1,4,6,5, 1,2,3,6, 1,3,7,6, 1,5,6,7 }; + + struct VoxelNodes + { + PxI32 c[8]; + + // XYZ + PxI32 c000() { return c[0]; } + PxI32 c001() { return c[1]; } + PxI32 c010() { return c[2]; } + PxI32 c011() { return c[3]; } + PxI32 c100() { return c[4]; } + PxI32 c101() { return c[5]; } + PxI32 c110() { return c[6]; } + PxI32 c111() { return c[7]; } + + VoxelNodes(PxI32& nodeIndexer) + { + for (PxI32 i = 0; i < 8; ++i) + c[i] = nodeIndexer++; + } + }; + + + static const PxI32 neighborFacesAscending[4][3] = { { 0, 1, 2 }, { 0, 1, 3 }, { 0, 2, 3 }, { 1, 2, 3 } }; + struct Vox + { + PxU32 mLocationX, mLocationY, mLocationZ; + PxArray mTets; + PxArray> mClusters; + PxArray mNodes; + PxU32 mBaseTetIndex; + PxU32 mNumEmittedTets; + + Vox(PxU32 locationX, PxU32 locationY, PxU32 locationZ) : mLocationX(locationX), mLocationY(locationY), mLocationZ(locationZ), mBaseTetIndex(0), mNumEmittedTets(0) + { } + + void operator=(const Vox &v) + { + mLocationX = v.mLocationX; + mLocationY = v.mLocationY; + mLocationZ = v.mLocationZ; + mTets = v.mTets; + mClusters = v.mClusters; + mNodes = v.mNodes; + mBaseTetIndex = v.mBaseTetIndex; + mNumEmittedTets = v.mNumEmittedTets; + } + + void initNodes(PxI32& nodeIndexer) + { + for (PxU32 i = 0; i < mClusters.size(); ++i) + mNodes.pushBack(VoxelNodes(nodeIndexer)); + } + + void buildLocalTetAdjacency(const PxBoundedData& tetrahedra, const PxArray& indices, PxArray& result) + { + PxU32 l = 4 * indices.size(); + result.clear(); + result.resize(l, -1); + + PxHashMap faces(indices.size()); + for (PxU32 i = 0; i < indices.size(); ++i) + { + Tetrahedron tet = tetrahedra.at(indices[i]); + if (tet[0] < 0) + continue; + + tet.sort(); + for (PxI32 j = 0; j < 4; ++j) + { + const PxU64 tri = ((PxU64(tet[neighborFacesAscending[j][0]])) << 42) | ((PxU64(tet[neighborFacesAscending[j][1]])) << 21) | ((PxU64(tet[neighborFacesAscending[j][2]]))); + if (const PxPair* ptr = faces.find(tri)) + { + result[4 * i + j] = ptr->second; + result[ptr->second] = 4 * i + j; + faces.erase(tri); //Keep memory low + } + else + faces.insert(tri, 4 * i + j); + } + } + } + + void computeClusters(const PxBoundedData& tetrahedra) + { + PxArray adj; + buildLocalTetAdjacency(tetrahedra, mTets, adj); + + PxArray done; + done.resize(mTets.size(), false); + PxU32 start = 0; + PxArray stack; + while (true) + { + stack.clear(); + while (start < done.size()) + { + if (!done[start]) + { + stack.pushBack(start); + done[start] = true; + PxArray c; + c.pushBack(mTets[start]); + mClusters.pushBack(c); + break; + } + ++start; + } + + if (start == done.size()) + break; + + while (stack.size() > 0) + { + PxI32 id = stack.popBack(); + for (PxI32 i = 0; i < 4; ++i) + { + PxI32 a = adj[4 * id + i]; + PxI32 tetId = a >> 2; + if (tetId >= 0 && !done[tetId]) + { + stack.pushBack(tetId); + done[tetId] = true; + mClusters[mClusters.size() - 1].pushBack(mTets[tetId]); + } + } + } + } + +#if PX_DEBUG + if (mClusters.size() > 1) + { + PxI32 abc = 0; + ++abc; + } +#endif + + for (PxU32 i = 0; i < mClusters.size(); ++i) + PxSort(mClusters[i].begin(), mClusters[i].size()); + } + + void embed(PxArray& embeddingError, PxI32 id, const PxVec3& p, const PxU32 startIndex, const PxU32 endIndex, const Tetrahedron* voxelTets, const PxArray& voxelPoints, PxI32* embeddings) + { + //PxVec4 best(1000, 1000, 1000, 1000); + PxReal bestError = embeddingError[id]; + PxI32 bestIndex = -1; + for (PxU32 i = startIndex; i < endIndex; ++i) + { + const Tetrahedron& candidate = voxelTets[i]; + + PxVec4 bary; + computeBarycentric(voxelPoints[candidate[0]], voxelPoints[candidate[1]], voxelPoints[candidate[2]], voxelPoints[candidate[3]], p, bary); + + const PxReal eps = 0; + if ((bary.x >= -eps && bary.x <= 1.f + eps) && (bary.y >= -eps && bary.y <= 1.f + eps) && + (bary.z >= -eps && bary.z <= 1.f + eps) && (bary.w >= -eps && bary.w <= 1.f + eps)) + { + embeddings[id] = i; + embeddingError[id] = 0; + return; + } + else + { + PxReal error = 0; + PxReal min = PxMin(PxMin(bary.x, bary.y), PxMin(bary.z, bary.w)); + if (min < 0) + error = -min; + + PxReal max = PxMax(PxMax(bary.x, bary.y), PxMax(bary.z, bary.w)); + if (max > 1) + { + PxReal e = max - 1; + if (e > error) + error = e; + } + + if (error < bestError) + { + //best = bary; + bestError = error; + bestIndex = i; + } + } + } + + if (bestIndex >= 0) + { + embeddings[id] = bestIndex; + embeddingError[id] = bestError; + } + } + + + bool embed(const PxU32 anchorNodeIndex, const PxBoundedData& colTets, PxI32 numTetsPerVoxel, PxArray& embeddingError, PxI32 id, const PxVec3& p, const Tetrahedron* voxelTets, const PxArray& voxelPoints, PxI32* embeddings) + { + if (mClusters.size() > 1) + { + for (PxU32 i = 0; i < mClusters.size(); ++i) + { + const PxArray& c = mClusters[i]; + for (PxU32 j = 0; j < c.size(); ++j) + { + const Tetrahedron& candidate = colTets.at(c[j]); + if (candidate.contains(anchorNodeIndex)) + { + embed(embeddingError, id, p, mBaseTetIndex + i * numTetsPerVoxel, mBaseTetIndex + (i + 1) * numTetsPerVoxel, voxelTets, voxelPoints, embeddings); + return true; + } + } + } + return false; + } + + embed(embeddingError, id, p, mBaseTetIndex, mBaseTetIndex + numTetsPerVoxel, voxelTets, voxelPoints, embeddings); + return true; + } + + + + void embed(const PxBoundedData& colPoints, const PxBoundedData& colTets, PxI32 numTetsPerVoxel, PxArray& embeddingError, PxI32 id, const PxVec3& p, const Tetrahedron* voxelTets, const PxArray& voxelPoints, PxI32* embeddings) + { + PxReal bestError = embeddingError[id]; + PxI32 bestIndex = 0; + if (mClusters.size() > 1) + { + for (PxU32 i = 0; i < mClusters.size(); ++i) + { + const PxArray& c = mClusters[i]; + for (PxU32 j = 0; j < c.size(); ++j) + { + const Tetrahedron& candidate = colTets.at(c[j]); + + PxVec4 bary; + computeBarycentric(colPoints.at< PxVec3>(candidate[0]), colPoints.at(candidate[1]), colPoints.at(candidate[2]), colPoints.at(candidate[3]), p, bary); + + const PxReal eps = 0; + if ((bary.x >= -eps && bary.x <= 1.f + eps) && (bary.y >= -eps && bary.y <= 1.f + eps) && + (bary.z >= -eps && bary.z <= 1.f + eps) && (bary.w >= -eps && bary.w <= 1.f + eps)) + { + embed(embeddingError, id, p, mBaseTetIndex + i * numTetsPerVoxel, mBaseTetIndex + (i + 1) * numTetsPerVoxel, voxelTets, voxelPoints, embeddings); + return; + } + else + { + PxReal error = 0; + PxReal min = PxMin(PxMin(bary.x, bary.y), PxMin(bary.z, bary.w)); + if (min < 0) + error = -min; + + PxReal max = PxMax(PxMax(bary.x, bary.y), PxMax(bary.z, bary.w)); + if (max > 1) + { + PxReal e = max - 1; + if (e > error) + error = e; + } + + if (error < bestError) + { + //best = bary; + bestError = error; + bestIndex = i; + } + } + } + } + } + + if (bestIndex >= 0) + { + embed(embeddingError, id, p, mBaseTetIndex + bestIndex * numTetsPerVoxel, mBaseTetIndex + (bestIndex + 1) * numTetsPerVoxel, voxelTets, voxelPoints, embeddings); + } + } + + + void emitTets(PxArray& voxelTets, PxArray& voxelPoints, PxI32* embeddings,/* UnionFind uf,*/ const PxVec3& voxelBlockMin, const PxVec3& voxelSize, + const PxBoundedData& inputPoints, const PxBoundedData& inputTets, PxArray& embeddingError, const PxI32& numTetsPerVoxel) + { + for (PxU32 i = 0; i < mNodes.size(); ++i) + { + const VoxelNodes& n = mNodes[i]; + for (PxI32 j = 0; j < 8; ++j) + { + PxI32 id = n.c[j]; + voxelPoints[id] = PxVec3(voxelBlockMin.x + (mLocationX + offsetsX[j]) * voxelSize.x, + voxelBlockMin.y + (mLocationY + offsetsY[j]) * voxelSize.y, + voxelBlockMin.z + (mLocationZ + offsetsZ[j]) * voxelSize.z); + } + + //Emit 5 or 6 tets + //if (numTetsPerVoxel == 5) { + // PxI32 flip = (mLocationX + mLocationY + mLocationZ) % 2; + // PxI32 offset = flip * 20; + // for (PxI32 j = 0; j < 20; j += 4) + // { + // PxI32 a = n.c[tets5PerVoxel[j + 0 + offset]]; + // PxI32 b = n.c[tets5PerVoxel[j + 1 + offset]]; + // PxI32 c = n.c[tets5PerVoxel[j + 2 + offset]]; + // PxI32 d = n.c[tets5PerVoxel[j + 3 + offset]]; + // //Tetrahedron tet(a, b, c, d); + // //voxelTets.pushBack(tet); + // voxelTets.pushBack(a); + // voxelTets.pushBack(b); + // voxelTets.pushBack(c); + // voxelTets.pushBack(d); + // } + //} + //else + { + for (PxI32 j = 0; j < 24; j += 4) + { + PxI32 a = n.c[tets6PerVoxel[j + 0]]; + PxI32 b = n.c[tets6PerVoxel[j + 1]]; + PxI32 c = n.c[tets6PerVoxel[j + 2]]; + PxI32 d = n.c[tets6PerVoxel[j + 3]]; + //Tetrahedron tet(a, b, c, d); + //voxelTets.pushBack(tet); + voxelTets.pushBack(a); + voxelTets.pushBack(b); + voxelTets.pushBack(c); + voxelTets.pushBack(d); + } + } + + if (embeddings) + { + PxVec3 min(voxelBlockMin.x + (mLocationX + 0) * voxelSize.x, + voxelBlockMin.y + (mLocationY + 0) * voxelSize.y, + voxelBlockMin.z + (mLocationZ + 0) * voxelSize.z); + PxVec3 max(voxelBlockMin.x + (mLocationX + 1) * voxelSize.x, + voxelBlockMin.y + (mLocationY + 1) * voxelSize.y, + voxelBlockMin.z + (mLocationZ + 1) * voxelSize.z); + PxBounds3 box(min, max); + box.fattenFast(1e-5f); + //Embedding + const PxArray& cluster = mClusters[i]; + Tetrahedron* voxelTetPtr = reinterpret_cast(voxelTets.begin()); + for (PxU32 j = 0; j < cluster.size(); ++j) + { + const Tetrahedron& tet = inputTets.at(cluster[j]); + + const PxU32 end = voxelTets.size() / 4; + const PxU32 start = end - numTetsPerVoxel; + + for (PxU32 k = 0; k < 4; ++k) + if (embeddingError[tet[k]] > 0 && box.contains(inputPoints.at(tet[k]))) + embed(embeddingError, tet[k], inputPoints.at(tet[k]), start, end, voxelTetPtr, voxelPoints, embeddings); + } + } + } + } + + void mapNodes(UnionFind& uf) + { + for (PxU32 i = 0; i < mNodes.size(); ++i) + { + VoxelNodes& n = mNodes[i]; + for (PxI32 j = 0; j < 8; ++j) + n.c[j] = uf.getSetNr(n.c[j]); + mNodes[i] = n; + } + } + }; + + + struct Int3 + { + PxU32 x; + PxU32 y; + PxU32 z; + }; + +#if PX_LINUX +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + + void getVoxelRange(const PxBoundedData& points, Tetrahedron tet, const PxVec3& voxelBlockMin, const PxVec3& voxelSize, + PxU32 numVoxelsX, PxU32 numVoxelsY, PxU32 numVoxelsZ, Int3& min, Int3& max, PxBounds3& box, PxReal enlarge) + { + PxVec3 mi = points.at(tet[0]); + PxVec3 ma = mi; + for (PxI32 i = 1; i < 4; ++i) { + const PxVec3& p = points.at(tet[i]); + if (p.x < mi.x) mi.x = p.x; if (p.y < mi.y) mi.y = p.y; if (p.z < mi.z) mi.z = p.z; + if (p.x > ma.x) ma.x = p.x; if (p.y > ma.y) ma.y = p.y; if (p.z > ma.z) ma.z = p.z; + } + mi.x -= enlarge; + mi.y -= enlarge; + mi.z -= enlarge; + ma.x += enlarge; + ma.y += enlarge; + ma.z += enlarge; + box.minimum = mi; + box.maximum = ma; + + min.x = PxU32((mi.x - voxelBlockMin.x) / voxelSize.x); + min.y = PxU32((mi.y - voxelBlockMin.y) / voxelSize.y); + min.z = PxU32((mi.z - voxelBlockMin.z) / voxelSize.z); + max.x = PxU32((ma.x - voxelBlockMin.x) / voxelSize.x); + max.y = PxU32((ma.y - voxelBlockMin.y) / voxelSize.y); + max.z = PxU32((ma.z - voxelBlockMin.z) / voxelSize.z); + + min.x = PxMax(0u, min.x); + min.y = PxMax(0u, min.y); + min.z = PxMax(0u, min.z); + max.x = PxMin(numVoxelsX - 1, max.x); + max.y = PxMin(numVoxelsY - 1, max.y); + max.z = PxMin(numVoxelsZ - 1, max.z); + } + +#if PX_LINUX +#pragma GCC diagnostic pop +#endif + + PX_FORCE_INLINE void connect(const VoxelNodes& voxelNodesA, const PxI32* faceVoxelA, const VoxelNodes& voxelNodesB, const PxI32* faceVoxelB, UnionFind& uf) + { + for (PxI32 i = 0; i < 4; ++i) + uf.makeSet(voxelNodesA.c[faceVoxelA[i]], voxelNodesB.c[faceVoxelB[i]]); + } + + PX_FORCE_INLINE bool intersectionOfSortedListsNotEmpty(const PxArray& sorted1, const PxArray& sorted2) + { + PxU32 a = 0; + PxU32 b = 0; + while (a < sorted1.size() && b < sorted2.size()) + { + if (sorted1[a] == sorted2[b]) + return true; + else if (sorted1[a] > sorted2[b]) + ++b; + else + ++a; + } + return false; + } + + void connect(const Vox& voxelA, const PxI32* faceVoxelA, const Vox& voxelB, const PxI32* faceVoxelB, UnionFind& uf) + { + for (PxU32 i = 0; i < voxelA.mClusters.size(); ++i) + { + const PxArray& clusterA = voxelA.mClusters[i]; + for (PxU32 j = 0; j < voxelB.mClusters.size(); ++j) + { + const PxArray& clusterB = voxelB.mClusters[j]; + if (intersectionOfSortedListsNotEmpty(clusterA, clusterB)) + connect(voxelA.mNodes[i], faceVoxelA, voxelB.mNodes[j], faceVoxelB, uf); + } + } + } + + + PX_FORCE_INLINE PxU32 cell(PxU32 x, PxU32 y, PxU32 z, PxU32 numX, PxU32 numXtimesNumY) + { + return x + y * numX + z * numXtimesNumY; + } + + Int3 getCell(const PxVec3& p, const PxVec3& voxelBlockMin, const PxVec3& voxelSize, const PxU32 numVoxelsX, const PxU32 numVoxelsY, const PxU32 numVoxelsZ) + { + Int3 cell; + PxVec3 c = p - voxelBlockMin; + cell.x = PxU32(c.x / voxelSize.x); + cell.y = PxU32(c.y / voxelSize.y); + cell.z = PxU32(c.z / voxelSize.z); + if (cell.x >= numVoxelsX) cell.x = numVoxelsX - 1; + if (cell.y >= numVoxelsY) cell.y = numVoxelsY - 1; + if (cell.z >= numVoxelsZ) cell.z = numVoxelsZ - 1; + return cell; + } + + PX_FORCE_INLINE PxReal aabbDistanceSquaredToPoint(const PxVec3& min, const PxVec3& max, const PxVec3& p) + { + PxReal sqDist = 0.0f; + + if (p.x < min.x) sqDist += (min.x - p.x) * (min.x - p.x); + if (p.x > max.x) sqDist += (p.x - max.x) * (p.x - max.x); + + if (p.y < min.y) sqDist += (min.y - p.y) * (min.y - p.y); + if (p.y > max.y) sqDist += (p.y - max.y) * (p.y - max.y); + + if (p.z < min.z) sqDist += (min.z - p.z) * (min.z - p.z); + if (p.z > max.z) sqDist += (p.z - max.z) * (p.z - max.z); + + return sqDist; + } + + PxI32 getVoxelId(PxArray voxelIds, const PxVec3& p, const PxVec3& voxelBlockMin, const PxVec3& voxelSize, const PxU32 numVoxelsX, const PxU32 numVoxelsY, const PxU32 numVoxelsZ) + { + PxVec3 pt = p - voxelBlockMin; + + PxU32 ix = PxU32(PxMax(0.0f, pt.x / voxelSize.x)); + PxU32 iy = PxU32(PxMax(0.0f, pt.y / voxelSize.y)); + PxU32 iz = PxU32(PxMax(0.0f, pt.z / voxelSize.z)); + if (ix >= numVoxelsX) ix = numVoxelsX - 1; + if (iy >= numVoxelsY) iy = numVoxelsY - 1; + if (iz >= numVoxelsZ) iz = numVoxelsZ - 1; + + PxU32 id = cell(ix, iy, iz, numVoxelsX, numVoxelsX * numVoxelsY); + if (voxelIds[id] >= 0) + return voxelIds[id]; + + const PxI32 numOffsets = 6; + const PxI32 offsets[numOffsets][3] = { {-1, 0, 0}, {+1, 0, 0}, {0, -1, 0}, {0, +1, 0}, {0, 0, -1}, {0, 0, +1} }; + + PxReal minDist = FLT_MAX; + for (PxU32 i = 0; i < numOffsets; ++i) + { + const PxI32* o = offsets[i]; + PxI32 newX = ix + o[0]; + PxI32 newY = iy + o[1]; + PxI32 newZ = iz + o[2]; + if (newX >= 0 && newX < PxI32(numVoxelsX) && newY >= 0 && newY < PxI32(numVoxelsY) && newZ >= 0 && newZ < PxI32(numVoxelsZ)) + { + PxU32 candidate = cell(newX, newY, newZ, numVoxelsX, numVoxelsX * numVoxelsY); + if (voxelIds[candidate] >= 0) + { + PxVec3 min(voxelBlockMin.x + newX * voxelSize.x, voxelBlockMin.y + newY * voxelSize.y, voxelBlockMin.z + newZ * voxelSize.z); + PxVec3 max = min + voxelSize; + PxReal d = aabbDistanceSquaredToPoint(min, max, p); + if (d < minDist) + { + id = candidate; + minDist = d; + } + } + } + } + + PxI32 result = voxelIds[id]; + + if (result < 0) + { + //Search the closest voxel over all voxels + minDist = FLT_MAX; + for (PxU32 newX = 0; newX < numVoxelsX; ++newX) + for (PxU32 newY = 0; newY < numVoxelsY; ++newY) + for (PxU32 newZ = 0; newZ < numVoxelsZ; ++newZ) + { + PxU32 candidate = cell(newX, newY, newZ, numVoxelsX, numVoxelsX * numVoxelsY); + if (voxelIds[candidate] >= 0) + { + PxVec3 min(voxelBlockMin.x + newX * voxelSize.x, voxelBlockMin.y + newY * voxelSize.y, voxelBlockMin.z + newZ * voxelSize.z); + PxVec3 max = min + voxelSize; + PxReal d = aabbDistanceSquaredToPoint(min, max, p); + if (d < minDist) + { + id = candidate; + minDist = d; + } + } + } + } + result = voxelIds[id]; + + if (result < 0) + return 0; + + return result; + } + + void generateVoxelTetmesh(const PxBoundedData& inputPointsOrig, const PxBoundedData& inputTets, PxU32 numVoxelsX, PxU32 numVoxelsY, PxU32 numVoxelsZ, + PxArray& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices) + { + if (inputTets.count == 0) + return; //No input, so there is no basis for creating an output + + PxU32 xy = numVoxelsX * numVoxelsY; + + PxVec3 origMin, origMax; + minMax(inputPointsOrig, origMin, origMax); + PxVec3 size = origMax - origMin; + PxReal scaling = 1.0f / PxMax(size.x, PxMax(size.y, size.z)); + PxArray scaledPoints; + scaledPoints.resize(inputPointsOrig.count); + for (PxU32 i = 0; i < inputPointsOrig.count; ++i) + { + PxVec3 p = inputPointsOrig.at(i); + scaledPoints[i] = (p - origMin) * scaling; + } + + PxBoundedData inputPoints; + inputPoints.count = inputPointsOrig.count; + inputPoints.stride = sizeof(PxVec3); + inputPoints.data = scaledPoints.begin(); + + PxVec3 voxelBlockMin, voxelBlockMax; + minMax(inputPoints, voxelBlockMin, voxelBlockMax); + + PxVec3 voxelBlockSize = voxelBlockMax - voxelBlockMin; + PxVec3 voxelSize(voxelBlockSize.x / numVoxelsX, voxelBlockSize.y / numVoxelsY, voxelBlockSize.z / numVoxelsZ); + + PxArray voxelIds; + voxelIds.resize(numVoxelsX * numVoxelsY * numVoxelsZ, -1); + + PxArray voxels; + + for(PxU32 i=0;i< inputTets.count;++i) + { + Int3 min, max; + const Tetrahedron& tet = inputTets.at(i); + PxBounds3 tetBox; + getVoxelRange(inputPoints, tet, voxelBlockMin, voxelSize, numVoxelsX, numVoxelsY, numVoxelsZ, min, max, tetBox, 1.e-4f); + + //bool success = false; + for (PxU32 x = min.x; x <= max.x; ++x) + { + for (PxU32 y = min.y; y <= max.y; ++y) + { + for (PxU32 z = min.z; z <= max.z; ++z) + { + PxBounds3 box(PxVec3(voxelBlockMin.x + x * voxelSize.x, voxelBlockMin.y + y * voxelSize.y, voxelBlockMin.z + z * voxelSize.z), + PxVec3(voxelBlockMin.x + (x + 1) * voxelSize.x, voxelBlockMin.y + (y + 1) * voxelSize.y, voxelBlockMin.z + (z + 1) * voxelSize.z)); + + if (intersectTetrahedronBox(inputPoints.at(tet[0]), inputPoints.at(tet[1]), inputPoints.at(tet[2]), inputPoints.at(tet[3]), box)) + { + //success = true; + PxI32 voxelId = voxelIds[cell(x, y, z, numVoxelsX, xy)]; + if (voxelId < 0) + { + voxelId = voxels.size(); + voxelIds[cell(x, y, z, numVoxelsX, xy)] = voxelId; + voxels.pushBack(Vox(x, y, z)); + } + Vox& v = voxels[voxelId]; + v.mTets.pushBack(i); + } + } + } + } + /*if (!success) + { + PxI32 abc = 0; + ++abc; + }*/ + } + + PxI32 nodeIndexer = 0; + for(PxU32 i=0;i 0 && voxelIds[cell(v.mLocationX - 1, v.mLocationY, v.mLocationZ, numVoxelsX, xy)] >= 0) + connect(voxels[voxelIds[cell(v.mLocationX - 1, v.mLocationY, v.mLocationZ, numVoxelsX, xy)]], xPosFace, v, xNegFace, uf); + if (v.mLocationX < numVoxelsX - 1 && voxelIds[cell(v.mLocationX + 1, v.mLocationY, v.mLocationZ, numVoxelsX, xy)] >= 0) + connect(v, xPosFace, voxels[voxelIds[cell(v.mLocationX + 1, v.mLocationY, v.mLocationZ, numVoxelsX, xy)]], xNegFace, uf); + + if (v.mLocationY > 0 && voxelIds[cell(v.mLocationX, v.mLocationY - 1, v.mLocationZ, numVoxelsX, xy)] >= 0) + connect(voxels[voxelIds[cell(v.mLocationX, v.mLocationY - 1, v.mLocationZ, numVoxelsX, xy)]], yPosFace, v, yNegFace, uf); + if (v.mLocationY < numVoxelsY - 1 && voxelIds[cell(v.mLocationX, v.mLocationY + 1, v.mLocationZ, numVoxelsX, xy)] >= 0) + connect(v, yPosFace, voxels[voxelIds[cell(v.mLocationX, v.mLocationY + 1, v.mLocationZ, numVoxelsX, xy)]], yNegFace, uf); + + if (v.mLocationZ > 0 && voxelIds[cell(v.mLocationX, v.mLocationY, v.mLocationZ - 1, numVoxelsX, xy)] >= 0) + connect(voxels[voxelIds[cell(v.mLocationX, v.mLocationY, v.mLocationZ - 1, numVoxelsX, xy)]], zPosFace, v, zNegFace, uf); + if (v.mLocationZ < numVoxelsZ - 1 && voxelIds[cell(v.mLocationX, v.mLocationY, v.mLocationZ + 1, numVoxelsX, xy)] >= 0) + connect(v, zPosFace, voxels[voxelIds[cell(v.mLocationX, v.mLocationY, v.mLocationZ + 1, numVoxelsX, xy)]], zNegFace, uf); + } + + PxI32 numVertices = uf.computeSetNrs(); + + for (PxU32 i = 0; i < voxels.size(); ++i) + { + voxels[i].mapNodes(uf); + } + + const PxU32 numTetsPerVoxel = 6; + voxelPoints.resize(numVertices); + //intputPointToOutputTetIndex.resize(numInputPoints); + voxelTets.clear(); + PxArray embeddingError; + embeddingError.resize(inputPoints.count, 1000); + for (PxU32 i = 0; i < voxels.size(); ++i) + { + Vox& v = voxels[i]; + v.mBaseTetIndex = voxelTets.size() / 4; + v.emitTets(voxelTets, voxelPoints, intputPointToOutputTetIndex, voxelBlockMin, voxelSize, inputPoints, inputTets, embeddingError, numTetsPerVoxel); + v.mNumEmittedTets = voxelTets.size() / 4 - v.mBaseTetIndex; + } + +#if PX_DEBUG + PxArray pointUsed; + pointUsed.resize(inputPoints.count, false); + for (PxU32 i = 0; i < inputTets.count; ++i) + { + const Tetrahedron& tet = inputTets.at(i); + for (PxU32 j = 0; j < 4; ++j) + pointUsed[tet[j]] = true; + } +#endif + Tetrahedron* voxelTetPtr = reinterpret_cast(voxelTets.begin()); + for (PxU32 i = 0; i < embeddingError.size(); ++i) + { + if (embeddingError[i] == 1000) + { + const PxVec3& p = inputPoints.at(i); + + PxI32 voxelId = getVoxelId(voxelIds, p, voxelBlockMin, voxelSize, numVoxelsX, numVoxelsY, numVoxelsZ); + PX_ASSERT(voxelId >= 0); + + Vox& vox = voxels[voxelId]; + + if (anchorNodeIndices && anchorNodeIndices[i] < inputPoints.count) + { + if (!vox.embed(anchorNodeIndices[i], inputTets, numTetsPerVoxel, embeddingError, i, p, voxelTetPtr, voxelPoints, intputPointToOutputTetIndex)) + { + PxVec3 pt = inputPoints.at(anchorNodeIndices[i]); + + voxelId = getVoxelId(voxelIds, pt, voxelBlockMin, voxelSize, numVoxelsX, numVoxelsY, numVoxelsZ); + PX_ASSERT(voxelId >= 0); + + Vox& v = voxels[voxelId]; + if (!v.embed(anchorNodeIndices[i], inputTets, numTetsPerVoxel, embeddingError, i, p, voxelTetPtr, voxelPoints, intputPointToOutputTetIndex)) + v.embed(inputPoints, inputTets, numTetsPerVoxel, embeddingError, i, p, voxelTetPtr, voxelPoints, intputPointToOutputTetIndex); + } + } + else + vox.embed(inputPoints, inputTets, numTetsPerVoxel, embeddingError, i, p, voxelTetPtr, voxelPoints, intputPointToOutputTetIndex); + } + } + + //Scale back to original size + scaling = 1.0f / scaling; + for(PxU32 i=0;i& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices) + { + PxVec3 min, max; + minMax(inputPoints, min, max); + PxVec3 blockSize = max - min; + PxU32 numCellsX = PxMax(1u, PxU32(blockSize.x / voxelEdgeLength + 0.5f)); + PxU32 numCellsY = PxMax(1u, PxU32(blockSize.y / voxelEdgeLength + 0.5f)); + PxU32 numCellsZ = PxMax(1u, PxU32(blockSize.z / voxelEdgeLength + 0.5f)); + + generateVoxelTetmesh(inputPoints, inputTets, numCellsX, numCellsY, numCellsZ, voxelPoints, voxelTets, intputPointToOutputTetIndex, anchorNodeIndices); + } + + void generateVoxelTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTets, PxU32 numVoxelsAlongLongestBoundingBoxAxis, + PxArray& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices) + { + PxVec3 min, max; + minMax(inputPoints, min, max); + PxVec3 size = max - min; + PxReal voxelEdgeLength = PxMax(size.x, PxMax(size.y, size.z)) / numVoxelsAlongLongestBoundingBoxAxis; + generateVoxelTetmesh(inputPoints, inputTets, voxelEdgeLength, voxelPoints, voxelTets, intputPointToOutputTetIndex, anchorNodeIndices); + } + + + + static PxReal computeMeshVolume(const PxArray& points, const PxArray& triangles) + { + PxVec3 center(0, 0, 0); + for (PxU32 i = 0; i < points.size(); ++i) + { + center += points[i]; + } + center /= PxReal(points.size()); + + PxReal volume = 0; + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + volume += tetVolume(points[tri[0]], points[tri[1]], points[tri[2]], center); + } + + return PxAbs(volume); + } + + + static PxTriangleMeshAnalysisResults validateConnectivity(const PxArray& triangles) + { + PxArray flip; + PxHashMap edges; + if (!MeshAnalyzer::checkConsistentTriangleOrientation(triangles.begin(), triangles.size(), flip, edges)) + return PxTriangleMeshAnalysisResult::Enum::eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES; + + PxTriangleMeshAnalysisResults result = PxTriangleMeshAnalysisResult::eVALID; + for (PxHashMap::Iterator iter = edges.getIterator(); !iter.done(); ++iter) + if (iter->second >= 0) + { + result = result | PxTriangleMeshAnalysisResult::eOPEN_BOUNDARIES; + break; + } + + for (PxU32 i = 0; i < flip.size(); ++i) + { + if (flip[i]) + { + return result | PxTriangleMeshAnalysisResult::Enum::eINCONSISTENT_TRIANGLE_ORIENTATION; + } + } + return result; + } + + + static bool trianglesIntersect(const Triangle& tri1, const Triangle& tri2, const PxArray& points) + { + int counter = 0; + if (tri1.contains(tri2[0])) ++counter; + if (tri1.contains(tri2[1])) ++counter; + if (tri1.contains(tri2[2])) ++counter; + + if (counter > 0) + return false; //Triangles share at leat one point + + return Gu::trianglesIntersect(points[tri1[0]], points[tri1[1]], points[tri1[2]], points[tri2[0]], points[tri2[1]], points[tri2[2]]); + } + + static PxBounds3 triBounds(const PxArray& points, const Triangle& tri, PxReal enlargement) + { + PxBounds3 box = PxBounds3::empty(); + box.include(points[tri[0]]); + box.include(points[tri[1]]); + box.include(points[tri[2]]); + box.fattenFast(enlargement); + return box; + } + + static bool meshContainsSelfIntersections(const PxArray& points, const PxArray& triangles) + { + PxReal enlargement = 1e-6f; + AABBTreeBounds boxes; + boxes.init(triangles.size()); + for (PxU32 i = 0; i < triangles.size(); ++i) + { + boxes.getBounds()[i] = triBounds(points, triangles[i], enlargement); + } + + PxArray tree; + Gu::buildAABBTree(triangles.size(), boxes, tree); + + PxArray candidateTriangleIndices; + IntersectionCollectingTraversalController tc(candidateTriangleIndices); + + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + PxBounds3 box = triBounds(points, tri, enlargement); + tc.reset(box); + + traverseBVH(tree, tc); + + for (PxU32 j = 0; j < candidateTriangleIndices.size(); ++j) + { + Triangle tri2 = triangles[j]; + if (trianglesIntersect(tri, tri2, points)) + return true; + } + } + return false; + } + + static PxReal maxDotProduct(const PxVec3& a, const PxVec3& b, const PxVec3& c) + { + const PxVec3 ab = b - a; + const PxVec3 ac = c - a; + const PxVec3 bc = c - b; + + PxReal maxDot = ab.dot(ac) / PxSqrt(ab.magnitudeSquared() * ac.magnitudeSquared()); + PxReal dot = ac.dot(bc) / PxSqrt(ac.magnitudeSquared() * bc.magnitudeSquared()); + if (dot > maxDot) maxDot = dot; + dot = -ab.dot(bc) / PxSqrt(ab.magnitudeSquared() * bc.magnitudeSquared()); + if (dot > maxDot) maxDot = dot; + + return maxDot; + } + + static PxReal minimumAngle(const PxArray& points, const PxArray& triangles) + { + PxReal maxDot = -1; + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + PxReal dot = maxDotProduct(points[tri[0]], points[tri[1]], points[tri[2]]); + if (dot > maxDot) + maxDot = dot; + } + if (maxDot > 1) + maxDot = 1; + + return PxAcos(maxDot); //Converts to the minimal angle + } + + PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const bool has16BitIndices, const PxReal minTetVolumeThreshold) + { + PxTetrahedronMeshAnalysisResults result = PxTetrahedronMeshAnalysisResult::eVALID; + + PxArray tets; + tets.reserve(tetrahedra.count); + + for (PxU32 i = 0; i < tetrahedra.count; ++i) + { + Tetrahedron t; + if (has16BitIndices) + { + Tetrahedron16 t16 = tetrahedra.at(i); + t = Tetrahedron(t16[0], t16[1], t16[2], t16[3]); + } + else + t = tetrahedra.at(i); + + tets.pushBack(t); + } + + for (PxU32 i = 0; i < tetrahedra.count; ++i) + { + const Tetrahedron& tetInd = tets[i]; + const PxReal volume = computeTetrahedronVolume(points.at(tetInd.v[0]), points.at(tetInd.v[1]), points.at(tetInd.v[2]), points.at(tetInd.v[3])); + if (volume <= minTetVolumeThreshold) + { + result |= PxTetrahedronMeshAnalysisResult::eDEGENERATE_TETRAHEDRON; + break; + } + } + + if (result & PxTetrahedronMeshAnalysisResult::eDEGENERATE_TETRAHEDRON) result |= PxTetrahedronMeshAnalysisResult::eMESH_IS_INVALID; + + return result; + } + + PxTriangleMeshAnalysisResults validateTriangleMesh(const PxBoundedData& points, const PxBoundedData& triangles, const bool has16BitIndices, const PxReal minVolumeThreshold, const PxReal minTriangleAngleRadians) + { + PxVec3 min, max; + minMax(points, min, max); + PxVec3 size = max - min; + PxReal scaling = 1.0f / PxMax(PxMax(size.x, size.y), PxMax(1e-6f, size.z)); + + PxArray normalizedPoints; + normalizedPoints.reserve(points.count); + + PxTriangleMeshAnalysisResults result = PxTriangleMeshAnalysisResult::eVALID; + + if (has16BitIndices && points.count > PX_MAX_U16) + result |= PxTriangleMeshAnalysisResult::eREQUIRES_32BIT_INDEX_BUFFER; + + for (PxU32 i = 0; i < points.count; ++i) + { + const PxVec3& p = points.at(i); + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + { + result |= PxTriangleMeshAnalysisResult::eCONTAINS_INVALID_POINTS; + normalizedPoints.pushBack(p); + continue; + } + normalizedPoints.pushBack((p - min) * scaling); + } + + + PxArray map; + MeshAnalyzer::mapDuplicatePoints(normalizedPoints, map); + PxArray mappedTriangles; + mappedTriangles.reserve(triangles.count); + for (PxU32 i = 0; i < triangles.count; ++i) + { + Triangle t; + if (has16BitIndices) + { + Triangle16 t16 = triangles.at(i); + t = Triangle(t16[0], t16[1], t16[2]); + } + else + t = triangles.at(i); + + mappedTriangles.pushBack(t); + } + + + for (PxU32 i = 0; i < map.size(); ++i) + if (map[i] != PxI32(i)) + { + result = result | PxTriangleMeshAnalysisResult::eCONTAINS_DUPLICATE_POINTS; + break; + } + + if(minimumAngle(normalizedPoints, mappedTriangles) < minTriangleAngleRadians) + result = result | PxTriangleMeshAnalysisResult::eCONTAINS_ACUTE_ANGLED_TRIANGLES; + + PxReal volume = computeMeshVolume(normalizedPoints, mappedTriangles); + if (volume < minVolumeThreshold) + result = result | PxTriangleMeshAnalysisResult::eZERO_VOLUME; + + result = result | validateConnectivity(mappedTriangles); + + if(meshContainsSelfIntersections(normalizedPoints, mappedTriangles)) + result = result | PxTriangleMeshAnalysisResult::eSELF_INTERSECTIONS; + + if (result & PxTriangleMeshAnalysisResult::eZERO_VOLUME) result |= PxTriangleMeshAnalysisResult::eMESH_IS_INVALID; + if (result & PxTriangleMeshAnalysisResult::eOPEN_BOUNDARIES) result |= PxTriangleMeshAnalysisResult::eMESH_IS_PROBLEMATIC; + if (result & PxTriangleMeshAnalysisResult::eSELF_INTERSECTIONS) result |= PxTriangleMeshAnalysisResult::eMESH_IS_PROBLEMATIC; + if (result & PxTriangleMeshAnalysisResult::eINCONSISTENT_TRIANGLE_ORIENTATION) result |= PxTriangleMeshAnalysisResult::eMESH_IS_INVALID; + if (result & PxTriangleMeshAnalysisResult::eCONTAINS_ACUTE_ANGLED_TRIANGLES) result |= PxTriangleMeshAnalysisResult::eMESH_IS_PROBLEMATIC; + if (result & PxTriangleMeshAnalysisResult::eEDGE_SHARED_BY_MORE_THAN_TWO_TRIANGLES) result |= PxTriangleMeshAnalysisResult::eMESH_IS_PROBLEMATIC; + if (result & PxTriangleMeshAnalysisResult::eCONTAINS_INVALID_POINTS) result |= PxTriangleMeshAnalysisResult::eMESH_IS_INVALID; + if (result & PxTriangleMeshAnalysisResult::eREQUIRES_32BIT_INDEX_BUFFER) result |= PxTriangleMeshAnalysisResult::eMESH_IS_INVALID; + + return result; + } + + //Consistent triangle orientation +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.h new file mode 100644 index 0000000..afc5e88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayBoundaryInserter.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_DELAUNAY_BOUNDARY_INSERTER_H +#define EXT_DELAUNAY_BOUNDARY_INSERTER_H + +#include "foundation/PxHashSet.h" +#include "foundation/PxVec3.h" +#include "foundation/PxMat33.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" +#include "common/PxCoreUtilityTypes.h" +#include "extensions/PxTriangleMeshAnalysisResult.h" +#include "extensions/PxTetrahedronMeshAnalysisResult.h" + +#include "ExtDelaunayTetrahedralizer.h" + +namespace physx +{ +namespace Ext +{ + //Generates a tetmesh that matches the specified triangle mesh. All triangle mesh points are present in the tetmesh, additional points on edges and faces might be present. + void generateTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTriangles, const bool has16bitIndices, PxArray& tetPoints, PxArray& finalTets); + + //Generates a tetmesh that that matches the surface of the input tetmesh approximately but creats very regular shaped tetrahedra. + void generateVoxelTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTets, PxU32 numVoxelsX, PxU32 numVoxelsY, PxU32 numVoxelsZ, + PxArray& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices = NULL); + + //Generates a tetmesh that that matches the surface of the input tetmesh approximately but creats very regular shaped tetrahedra. + void generateVoxelTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTets, PxReal voxelEdgeLength, + PxArray& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices = NULL); + + //Generates a tetmesh that that matches the surface of the input tetmesh approximately but creats very regular shaped tetrahedra. + void generateVoxelTetmesh(const PxBoundedData& inputPoints, const PxBoundedData& inputTets, PxU32 numVoxelsAlongLongestBoundingBoxAxis, + PxArray& voxelPoints, PxArray& voxelTets, PxI32* intputPointToOutputTetIndex, const PxU32* anchorNodeIndices = NULL); + + //Extracts the surface triangles from the specified tetrahedra + void extractTetmeshSurface(const PxArray& tets, PxArray& triangles); + + //Computes the lumped mass per vertex for the specified tetmesh + void pointMasses(const PxArray& tetVerts, const PxArray& tets, PxF32 density, PxArray& mass); + + //Computes a rest pose matrix for every tetrahedron in the specified tetmesh + void restPoses(const PxArray& tetVerts, const PxArray& tets, PxArray& restPoses); + + //Computes a fiber direction for every tetrahedron in the specified tetmesh. Currently just returns dummy values. + void tetFibers(const PxArray& tetVerts, const PxArray& tets, PxArray& tetFibers); + + //Analyzes the triangle mesh to get a report about deficiencies. Some deficiencies can be handled by the tetmesher, others cannot. + PxTriangleMeshAnalysisResults validateTriangleMesh(const PxBoundedData& points, const PxBoundedData& triangles, const bool has16BitIndices, const PxReal minVolumeThreshold = 1e-6f, const PxReal minTriangleAngleRadians = 10.0f*3.1415926535898f / 180.0f); + + //Analyzes the tetrahedron mesh to get a report about deficiencies. Some deficiencies can be handled by the softbody cooker, others cannot. + PxTetrahedronMeshAnalysisResults validateTetrahedronMesh(const PxBoundedData& points, const PxBoundedData& tetrahedra, const bool has16BitIndices, const PxReal minTetVolumeThreshold = 1e-8f); + + PxU32 removeDisconnectedIslands(PxI32* finalTets, PxU32 numTets); +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp new file mode 100644 index 0000000..cdecc07 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.cpp @@ -0,0 +1,2180 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtDelaunayTetrahedralizer.h" +#include "foundation/PxSort.h" + +#include "foundation/PxHashMap.h" +#include "ExtUtilities.h" + + +namespace physx +{ +namespace Ext +{ + using Triangle = Gu::IndexedTriangleT; + + //http://tizian.cs.uni-bonn.de/publications/BaudsonKlein.pdf Page 44 + static const PxI32 neighborFaces[4][3] = { { 0, 1, 2 }, { 0, 3, 1 }, { 0, 2, 3 }, { 1, 3, 2 } }; + static const PxI32 tetTip[4] = { 3, 2, 1, 0 }; + + struct Plane + { + Vec3 normal; + PxF64 planeD; + + PX_FORCE_INLINE Plane(const Vec3& n, PxF64 d) : normal(n), planeD(d) + { } + + PX_FORCE_INLINE Plane(const Vec3& n, const Vec3& pointOnPlane) : normal(n) + { + planeD = -pointOnPlane.dot(normal); + } + + PX_FORCE_INLINE Plane(const Vec3& a, const Vec3& b, const Vec3& c) + { + normal = (b - a).cross(c - a); + PxF64 norm = normal.magnitude(); + normal /= norm; + + planeD = -a.dot(normal); + } + + PX_FORCE_INLINE PxF64 signedDistance(const Vec3& p) + { + return normal.dot(p) + planeD; + } + + PX_FORCE_INLINE PxF64 unsignedDistance(const Vec3& p) + { + return PxAbs(signedDistance(p)); + } + }; + + DelaunayTetrahedralizer::DelaunayTetrahedralizer(const Vec3& min, const Vec3& max) + { + for(PxI32 i = 0; i < 4; ++i) + neighbors.pushBack(-1); + + PxF64 radius = 1.1 * 0.5 * (max - min).magnitude(); + + PxF64 scaledRadius = 6 * radius; + centeredNormalizedPoints.pushBack(Vec3(-scaledRadius, -scaledRadius, -scaledRadius)); + centeredNormalizedPoints.pushBack(Vec3(scaledRadius, scaledRadius, -scaledRadius)); + centeredNormalizedPoints.pushBack(Vec3(-scaledRadius, scaledRadius, scaledRadius)); + centeredNormalizedPoints.pushBack(Vec3(scaledRadius, -scaledRadius, scaledRadius)); + + numAdditionalPointsAtBeginning = 4; + + result.pushBack(Tetrahedron(0, 1, 2, 3)); + for (PxI32 i = 0; i < 4; ++i) + vertexToTet.pushBack(0); + } + + void buildNeighborhood(const PxI32* tets, PxU32 numTets, PxArray& result) + { + PxU32 l = 4 * numTets; + result.clear(); + result.resize(l, -1); + + PxHashMap faces; + for (PxU32 i = 0; i < numTets; ++i) + { + const PxI32* tet = &tets[4 * i]; + if (tet[0] < 0) + continue; + + for (PxI32 j = 0; j < 4; ++j) + { + SortedTriangle tri(tet[neighborFaces[j][0]], tet[neighborFaces[j][1]], tet[neighborFaces[j][2]]); + if (const PxPair* ptr = faces.find(tri)) + { + if (ptr->second < 0) + { + //PX_ASSERT(false); //Invalid tetmesh since a face is shared by more than 2 tetrahedra + continue; + } + + result[4 * i + j] = ptr->second; + result[ptr->second] = 4 * i + j; + + faces[tri] = -1; + } + else + faces.insert(tri, 4 * i + j); + } + } + } + + void buildNeighborhood(const PxArray& tets, PxArray& result) + { + buildNeighborhood(reinterpret_cast(tets.begin()), tets.size(), result); + } + + bool shareFace(const Tetrahedron& t1, const Tetrahedron& t2) + { + PxI32 counter = 0; + + if (t1.contains(t2[0])) ++counter; + if (t1.contains(t2[1])) ++counter; + if (t1.contains(t2[2])) ++counter; + if (t1.contains(t2[3])) ++counter; + + if (counter == 4) + PX_ASSERT(false); + return counter == 3; + } + + //Keep for debugging & verification + void validateNeighborhood(const PxArray& tets, PxArray& neighbors) + { + PxI32 borderCounter = 0; + for (PxU32 i = 0; i < neighbors.size(); ++i) + if (neighbors[i] == -1) + ++borderCounter; + + //if (borderCounter != 4) + // throw new Exception(); + + + PxArray n; + buildNeighborhood(tets, n); + + for (PxU32 i = 0; i < n.size(); ++i) + { + if (n[i] < 0) + continue; + if (n[i] != neighbors[i]) + PX_ASSERT(false); + } + + for (PxU32 i = 0; i < neighbors.size(); ++i) + { + if (neighbors[i] < 0) + continue; + + Tetrahedron tet1 = tets[i >> 2]; + Tetrahedron tet2 = tets[neighbors[i] >> 2]; + + if (!shareFace(tet1, tet2)) + PX_ASSERT(false); + + PxI32 face1 = i & 3; + SortedTriangle tri1(tet1[neighborFaces[face1][0]], tet1[neighborFaces[face1][1]], tet1[neighborFaces[face1][2]]); + + PxI32 face2 = neighbors[i] & 3; + SortedTriangle tri2(tet2[neighborFaces[face2][0]], tet2[neighborFaces[face2][1]], tet2[neighborFaces[face2][2]]); + + if (tri1.A != tri2.A || tri1.B != tri2.B || tri1.C != tri2.C) + PX_ASSERT(false); + } + } + + void buildVertexToTet(const PxArray& tets, PxI32 numPoints, PxArray& result) + { + result.clear(); + result.resize(numPoints, -1); + + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + result[tet[0]] = i; + result[tet[1]] = i; + result[tet[2]] = i; + result[tet[3]] = i; + } + } + + DelaunayTetrahedralizer::DelaunayTetrahedralizer(PxArray& points, PxArray& tets) + { + initialize(points, tets); + } + + void DelaunayTetrahedralizer::initialize(PxArray& points, PxArray& tets) + { + clearLockedEdges(); + clearLockedTriangles(); + + centeredNormalizedPoints = points; + result = tets; + + numAdditionalPointsAtBeginning = 0; + + buildNeighborhood(tets, neighbors); + buildVertexToTet(tets, points.size(), vertexToTet); + + for (PxU32 i = 0; i < tets.size(); ++i) + if (tets[i][0] < 0) + unusedTets.pushBack(i); + } + + PX_FORCE_INLINE PxF64 inSphere(const Vec3& pa, const Vec3& pb, const Vec3& pc, const Vec3& pd, const Vec3& candidiate) + { + PxF64 aex = pa.x - candidiate.x; + PxF64 bex = pb.x - candidiate.x; + PxF64 cex = pc.x - candidiate.x; + PxF64 dex = pd.x - candidiate.x; + PxF64 aey = pa.y - candidiate.y; + PxF64 bey = pb.y - candidiate.y; + PxF64 cey = pc.y - candidiate.y; + PxF64 dey = pd.y - candidiate.y; + PxF64 aez = pa.z - candidiate.z; + PxF64 bez = pb.z - candidiate.z; + PxF64 cez = pc.z - candidiate.z; + PxF64 dez = pd.z - candidiate.z; + + PxF64 ab = aex * bey - bex * aey; + PxF64 bc = bex * cey - cex * bey; + PxF64 cd = cex * dey - dex * cey; + PxF64 da = dex * aey - aex * dey; + + PxF64 ac = aex * cey - cex * aey; + PxF64 bd = bex * dey - dex * bey; + + PxF64 abc = aez * bc - bez * ac + cez * ab; + PxF64 bcd = bez * cd - cez * bd + dez * bc; + PxF64 cda = cez * da + dez * ac + aez * cd; + PxF64 dab = dez * ab + aez * bd + bez * da; + + PxF64 alift = aex * aex + aey * aey + aez * aez; + PxF64 blift = bex * bex + bey * bey + bez * bez; + PxF64 clift = cex * cex + cey * cey + cez * cez; + PxF64 dlift = dex * dex + dey * dey + dez * dez; + + return (dlift * abc - clift * dab) + (blift * cda - alift * bcd); + } + + PX_FORCE_INLINE bool isDelaunay(const PxArray& points, const PxArray& tets, const PxArray& neighbors, PxI32 faceId) + { + PxI32 neighborPointer = neighbors[faceId]; + if (neighborPointer < 0) + return true; //Border faces are always delaunay + + PxI32 tet1Id = faceId >> 2; + PxI32 tet2Id = neighborPointer >> 2; + const PxI32* localTriangle1 = neighborFaces[faceId & 3]; + PxI32 localTip1 = tetTip[faceId & 3]; + PxI32 localTip2 = tetTip[neighborPointer & 3]; + + Tetrahedron tet1 = tets[tet1Id]; + Tetrahedron tet2 = tets[tet2Id]; + + return inSphere(points[tet1[localTriangle1[0]]], points[tet1[localTriangle1[1]]], points[tet1[localTriangle1[2]]], points[tet1[localTip1]], points[tet2[localTip2]]) > 0; + } + + PX_FORCE_INLINE PxI32 storeNewTet(PxArray& tets, PxArray& neighbors, const Tetrahedron& tet, PxArray& unusedTets) + { + if (unusedTets.size() == 0) + { + PxU32 tetId = tets.size(); + tets.pushBack(tet); + for (PxI32 i = 0; i < 4; ++i) + neighbors.pushBack(-1); + return tetId; + } + else + { + PxI32 tetId = unusedTets[unusedTets.size() - 1]; + unusedTets.remove(unusedTets.size() - 1); + tets[tetId] = tet; + return tetId; + } + } + + PX_FORCE_INLINE PxI32 localFaceId(PxI32 localA, PxI32 localB, PxI32 localC) + { + PxI32 result = localA + localB + localC - 3; + PX_ASSERT(result >= 0 || result <= 3); + return result; + } + + PX_FORCE_INLINE PxI32 localFaceId(const Tetrahedron& tet, PxI32 globalA, PxI32 globalB, PxI32 globalC) + { + PxI32 result = localFaceId(tet.indexOf(globalA), tet.indexOf(globalB), tet.indexOf(globalC)); + return result; + } + + PX_FORCE_INLINE void setFaceNeighbor(PxArray& neighbors, PxI32 tetId, PxI32 faceId, PxI32 newNeighborTet, PxI32 newNeighborFace) + { + neighbors[4 * tetId + faceId] = 4 * newNeighborTet + newNeighborFace; + neighbors[4 * newNeighborTet + newNeighborFace] = 4 * tetId + faceId; + } + PX_FORCE_INLINE void setFaceNeighbor(PxArray& neighbors, PxI32 tetId, PxI32 faceId, PxI32 newNeighbor) + { + neighbors[4 * tetId + faceId] = newNeighbor; + + if (newNeighbor >= 0) + neighbors[newNeighbor] = 4 * tetId + faceId; + } + PX_FORCE_INLINE void setFaceNeighbor(PxArray& affectedFaces, PxArray& neighbors, PxI32 tetId, PxI32 faceId, PxI32 newNeighbor) + { + setFaceNeighbor(neighbors, tetId, faceId, newNeighbor); + affectedFaces.pushBack(newNeighbor); + } + + void flip1to4(PxI32 pointToInsert, PxI32 tetId, PxArray& neighbors, PxArray& vertexToTet, PxArray& tets, PxArray& unusedTets, PxArray& affectedFaces) + { + const Tetrahedron origTet = tets[tetId]; + Tetrahedron tet(origTet[0], origTet[1], origTet[2], pointToInsert); + tets[tetId] = tet; + Tetrahedron tet2(origTet[0], origTet[3], origTet[1], pointToInsert); + Tetrahedron tet3(origTet[0], origTet[2], origTet[3], pointToInsert); + Tetrahedron tet4(origTet[1], origTet[3], origTet[2], pointToInsert); + + PxI32 tet2Id = storeNewTet(tets, neighbors, tet2, unusedTets); + PxI32 tet3Id = storeNewTet(tets, neighbors, tet3, unusedTets); + PxI32 tet4Id = storeNewTet(tets, neighbors, tet4, unusedTets); + + PxI32 n1 = neighbors[4 * tetId + localFaceId(origTet, origTet[0], origTet[1], origTet[2])]; + PxI32 n2 = neighbors[4 * tetId + localFaceId(origTet, origTet[0], origTet[1], origTet[3])]; + PxI32 n3 = neighbors[4 * tetId + localFaceId(origTet, origTet[0], origTet[2], origTet[3])]; + PxI32 n4 = neighbors[4 * tetId + localFaceId(origTet, origTet[1], origTet[2], origTet[3])]; + + setFaceNeighbor(affectedFaces, neighbors, tetId, localFaceId(tet, origTet[0], origTet[1], origTet[2]), n1); + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, origTet[0], origTet[1], origTet[3]), n2); + setFaceNeighbor(affectedFaces, neighbors, tet3Id, localFaceId(tet3, origTet[0], origTet[2], origTet[3]), n3); + setFaceNeighbor(affectedFaces, neighbors, tet4Id, localFaceId(tet4, origTet[1], origTet[2], origTet[3]), n4); + + setFaceNeighbor(neighbors, tetId, localFaceId(tet, pointToInsert, origTet[0], origTet[1]), tet2Id, localFaceId(tet2, pointToInsert, origTet[0], origTet[1])); + setFaceNeighbor(neighbors, tetId, localFaceId(tet, pointToInsert, origTet[0], origTet[2]), tet3Id, localFaceId(tet3, pointToInsert, origTet[0], origTet[2])); + setFaceNeighbor(neighbors, tetId, localFaceId(tet, pointToInsert, origTet[1], origTet[2]), tet4Id, localFaceId(tet4, pointToInsert, origTet[1], origTet[2])); + + setFaceNeighbor(neighbors, tet2Id, localFaceId(tet2, pointToInsert, origTet[0], origTet[3]), tet3Id, localFaceId(tet3, pointToInsert, origTet[0], origTet[3])); + setFaceNeighbor(neighbors, tet2Id, localFaceId(tet2, pointToInsert, origTet[1], origTet[3]), tet4Id, localFaceId(tet4, pointToInsert, origTet[1], origTet[3])); + + setFaceNeighbor(neighbors, tet3Id, localFaceId(tet3, pointToInsert, origTet[2], origTet[3]), tet4Id, localFaceId(tet4, pointToInsert, origTet[2], origTet[3])); + + vertexToTet[tet[0]] = tetId; vertexToTet[tet[1]] = tetId; vertexToTet[tet[2]] = tetId; vertexToTet[tet[3]] = tetId; + vertexToTet[tet2[0]] = tet2Id; vertexToTet[tet2[1]] = tet2Id; vertexToTet[tet2[2]] = tet2Id; vertexToTet[tet2[3]] = tet2Id; + vertexToTet[tet3[0]] = tet3Id; vertexToTet[tet3[1]] = tet3Id; vertexToTet[tet3[2]] = tet3Id; vertexToTet[tet3[3]] = tet3Id; + vertexToTet[tet4[0]] = tet4Id; vertexToTet[tet4[1]] = tet4Id; vertexToTet[tet4[2]] = tet4Id; vertexToTet[tet4[3]] = tet4Id; + } + + bool flip2to3(PxI32 tet1Id, PxI32 tet2Id, + PxArray& neighbors, PxArray& vertexToTet, PxArray& tets, PxArray& unusedTets, PxArray& affectedFaces, + PxI32 tip1, PxI32 tip2, const Triangle& tri) + { + // 2->3 flip + Tetrahedron tet1(tip2, tip1, tri[0], tri[1]); + Tetrahedron tet2(tip2, tip1, tri[1], tri[2]); + Tetrahedron tet3(tip2, tip1, tri[2], tri[0]); + + + PxI32 n1 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[0], tri[1], tip1)]; + PxI32 n2 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[0], tri[1], tip2)]; + if (n1 >= 0 && (n1 >> 2) == (n2 >> 2)) + { + if (Tetrahedron::identical(tet1, tets[n1 >> 2])) + return false; + } + + PxI32 n3 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[1], tri[2], tip1)]; + PxI32 n4 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[1], tri[2], tip2)]; + if (n3 >= 0 && (n3 >> 2) == (n4 >> 2)) + { + if (Tetrahedron::identical(tet2, tets[n3 >> 2])) + return false; + } + + PxI32 n5 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[2], tri[0], tip1)]; + PxI32 n6 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[2], tri[0], tip2)]; + if (n5 >= 0 && (n5 >> 2) == (n6 >> 2)) + { + if (Tetrahedron::identical(tet3, tets[n5 >> 2])) + return false; + } + + PxI32 tet3Id = storeNewTet(tets, neighbors, tet3, unusedTets); + + setFaceNeighbor(affectedFaces, neighbors, tet1Id, localFaceId(tet1, tri[0], tri[1], tip1), n1); + setFaceNeighbor(affectedFaces, neighbors, tet1Id, localFaceId(tet1, tri[0], tri[1], tip2), n2); + setFaceNeighbor(neighbors, tet1Id, localFaceId(tet1, tri[0], tip1, tip2), tet3Id, localFaceId(tet3, tri[0], tip1, tip2)); //Interior face + setFaceNeighbor(neighbors, tet1Id, localFaceId(tet1, tri[1], tip1, tip2), tet2Id, localFaceId(tet2, tri[1], tip1, tip2)); //Interior face + + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, tri[1], tri[2], tip1), n3); + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, tri[1], tri[2], tip2), n4); + setFaceNeighbor(neighbors, tet2Id, localFaceId(tet2, tri[2], tip1, tip2), tet3Id, localFaceId(tet3, tri[2], tip1, tip2)); //Interior face + + setFaceNeighbor(affectedFaces, neighbors, tet3Id, localFaceId(tet3, tri[2], tri[0], tip1), n5); + setFaceNeighbor(affectedFaces, neighbors, tet3Id, localFaceId(tet3, tri[2], tri[0], tip2), n6); + + tets[tet1Id] = tet1; + tets[tet2Id] = tet2; + + vertexToTet[tet1[0]] = tet1Id; vertexToTet[tet1[1]] = tet1Id; vertexToTet[tet1[2]] = tet1Id; vertexToTet[tet1[3]] = tet1Id; + vertexToTet[tet2[0]] = tet2Id; vertexToTet[tet2[1]] = tet2Id; vertexToTet[tet2[2]] = tet2Id; vertexToTet[tet2[3]] = tet2Id; + vertexToTet[tet3[0]] = tet3Id; vertexToTet[tet3[1]] = tet3Id; vertexToTet[tet3[2]] = tet3Id; vertexToTet[tet3[3]] = tet3Id; + + return true; + } + + bool flip3to2(PxI32 tet1Id, PxI32 tet2Id, PxI32 tet3Id, + PxArray& neighbors, PxArray& vertexToTet, PxArray& tets, PxArray& unusedTets, PxArray& affectedFaces, + PxI32 tip1, PxI32 tip2, PxI32 reflexEdgeA, PxI32 reflexEdgeB, PxI32 nonReflexTrianglePoint) + { + // 3->2 flip + Tetrahedron tet1(tip1, tip2, reflexEdgeA, nonReflexTrianglePoint); + Tetrahedron tet2(tip2, tip1, reflexEdgeB, nonReflexTrianglePoint); + + PxI32 n1 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], reflexEdgeA, tip1, nonReflexTrianglePoint)]; + PxI32 n2 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], reflexEdgeA, tip2, nonReflexTrianglePoint)]; + PxI32 n3 = neighbors[4 * tet3Id + localFaceId(tets[tet3Id], reflexEdgeA, tip1, tip2)]; + if (n1 >= 0 && n2 >= 0 && (n1 >> 2) == (n2 >> 2) && Tetrahedron::identical(tet1, tets[n1 >> 2])) + return false; + if (n1 >= 0 && n3 >= 0 && (n1 >> 2) == (n3 >> 2) && Tetrahedron::identical(tet1, tets[n1 >> 2])) + return false; + if (n2 >= 0 && n3 >= 0 && (n2 >> 2) == (n3 >> 2) && Tetrahedron::identical(tet1, tets[n2 >> 2])) + return false; + + PxI32 n4 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], reflexEdgeB, tip1, nonReflexTrianglePoint)]; + PxI32 n5 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], reflexEdgeB, tip2, nonReflexTrianglePoint)]; + PxI32 n6 = neighbors[4 * tet3Id + localFaceId(tets[tet3Id], reflexEdgeB, tip1, tip2)]; + if (n4 >= 0 && n5 >= 0 && (n4 >> 2) == (n5 >> 2) && Tetrahedron::identical(tet2, tets[n4 >> 2])) + return false; + if (n4 >= 0 && n6 >= 0 && (n4 >> 2) == (n6 >> 2) && Tetrahedron::identical(tet2, tets[n4 >> 2])) + return false; + if (n5 >= 0 && n6 >= 0 && (n5 >> 2) == (n6 >> 2) && Tetrahedron::identical(tet2, tets[n5 >> 2])) + return false; + + + setFaceNeighbor(affectedFaces, neighbors, tet1Id, localFaceId(tet1, reflexEdgeA, tip1, nonReflexTrianglePoint), n1); + setFaceNeighbor(affectedFaces, neighbors, tet1Id, localFaceId(tet1, reflexEdgeA, tip2, nonReflexTrianglePoint), n2); + setFaceNeighbor(affectedFaces, neighbors, tet1Id, localFaceId(tet1, reflexEdgeA, tip1, tip2), n3); + setFaceNeighbor(neighbors, tet1Id, localFaceId(tet1, nonReflexTrianglePoint, tip1, tip2), tet2Id, localFaceId(tet2, nonReflexTrianglePoint, tip1, tip2)); //Interior face // Marker (*) + + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, reflexEdgeB, tip1, nonReflexTrianglePoint), n4); + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, reflexEdgeB, tip2, nonReflexTrianglePoint), n5); + setFaceNeighbor(affectedFaces, neighbors, tet2Id, localFaceId(tet2, reflexEdgeB, tip1, tip2), n6); + + tets[tet1Id] = tet1; + tets[tet2Id] = tet2; + + tets[tet3Id] = Tetrahedron(-1, -1, -1, -1); + for (PxI32 i = 0; i < 4; ++i) + neighbors[4 * tet3Id + i] = -2; + unusedTets.pushBack(tet3Id); + + vertexToTet[tet1[0]] = tet1Id; vertexToTet[tet1[1]] = tet1Id; vertexToTet[tet1[2]] = tet1Id; vertexToTet[tet1[3]] = tet1Id; + vertexToTet[tet2[0]] = tet2Id; vertexToTet[tet2[1]] = tet2Id; vertexToTet[tet2[2]] = tet2Id; vertexToTet[tet2[3]] = tet2Id; + return true; + } + + PX_FORCE_INLINE PxF64 orient3D(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& d) + { + return (a - d).dot((b - d).cross(c - d)); + } + + PX_FORCE_INLINE bool edgeIsLocked(const PxHashSet& lockedEdges, int edgeA, int edgeB) + { + return lockedEdges.contains(key(edgeA, edgeB)); + } + + PX_FORCE_INLINE bool faceIsLocked(const PxHashSet& lockedTriangles, int triA, int triB, int triC) + { + return lockedTriangles.contains(SortedTriangle(triA, triB, triC)); + } + + void flip(const PxArray& points, PxArray& tets, PxArray& neighbors, PxArray& vertexToTet, PxI32 faceId, PxArray& unusedTets, PxArray& affectedFaces, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + PxI32 neighborPointer = neighbors[faceId]; + if (neighborPointer < 0) + return; + + PxI32 tet1Id = faceId >> 2; + const PxI32* localTriangle1 = neighborFaces[faceId & 3]; + Tetrahedron tet1 = tets[tet1Id]; + Triangle tri(tet1[localTriangle1[0]], tet1[localTriangle1[1]], tet1[localTriangle1[2]]); + PxI32 localTip1 = tetTip[faceId & 3]; + PxI32 localTip2 = tetTip[neighborPointer & 3]; + PxI32 tip1 = tet1[localTip1]; + + PxI32 tet2Id = neighborPointer >> 2; + Tetrahedron tet2 = tets[tet2Id]; + PxI32 tip2 = tet2[localTip2]; + + PX_ASSERT(tet2.contains(tri[0]) && tet2.contains(tri[1]) && tet2.contains(tri[2])); + + PxI32 face1 = -1; + PxI32 face2 = -1; + PxI32 numReflexEdges = 0; + PxI32 reflexEdgeA = -1; + PxI32 reflexEdgeB = -1; + PxI32 nonReflexTrianglePoint = -1; + PxF64 ab = orient3D(points[tri[0]], points[tri[1]], points[tip1], points[tip2]); + if (ab < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[0], localTriangle1[1], localTip1); reflexEdgeA = tri[0]; reflexEdgeB = tri[1]; nonReflexTrianglePoint = tri[2]; face2 = localFaceId(tet2, tri[0], tri[1], tip2); } + PxF64 bc = orient3D(points[tri[1]], points[tri[2]], points[tip1], points[tip2]); + if (bc < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[1], localTriangle1[2], localTip1); reflexEdgeA = tri[1]; reflexEdgeB = tri[2]; nonReflexTrianglePoint = tri[0]; face2 = localFaceId(tet2, tri[1], tri[2], tip2); } + PxF64 ca = orient3D(points[tri[2]], points[tri[0]], points[tip1], points[tip2]); + if (ca < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[2], localTriangle1[0], localTip1); reflexEdgeA = tri[2]; reflexEdgeB = tri[0]; nonReflexTrianglePoint = tri[1]; face2 = localFaceId(tet2, tri[2], tri[0], tip2); } + + if (numReflexEdges == 0) + { + if (!faceIsLocked(lockedFaces, tri[0], tri[1], tri[2])) + flip2to3(tet1Id, tet2Id, neighbors, vertexToTet, tets, unusedTets, affectedFaces, tip1, tip2, tri); + } + else if (numReflexEdges == 1) + { + PxI32 candidate1 = neighbors[4 * tet1Id + face1] >> 2; + PxI32 candidate2 = neighbors[4 * tet2Id + face2] >> 2; + if (candidate1 == candidate2 && candidate1 >= 0) + { + if (!edgeIsLocked(lockedEdges, reflexEdgeA, reflexEdgeB) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, nonReflexTrianglePoint) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, tip1) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, tip2)) + flip3to2(tet1Id, tet2Id, candidate1, neighbors, vertexToTet, tets, unusedTets, affectedFaces, tip1, tip2, reflexEdgeA, reflexEdgeB, nonReflexTrianglePoint); + } + } + else if (numReflexEdges == 2) + { + //Cannot do anything + } + else if (numReflexEdges == 3) + { + //Something is wrong if we end up here - maybe there are degenerate tetrahedra or issues due to numerical rounding + } + } + + void flip(PxArray& faces, PxArray& neighbors, PxArray& vertexToTet, const PxArray& points, + PxArray& tets, PxArray& unusedTets, PxArray& affectedFaces, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + while (faces.size() > 0) + { + PxI32 faceId = faces.popBack(); + if (faceId < 0) + continue; + + if (isDelaunay(points, tets, neighbors, faceId)) + continue; + + affectedFaces.clear(); + flip(points, tets, neighbors, vertexToTet, faceId, unusedTets, affectedFaces, lockedFaces, lockedEdges); + + for (PxU32 j = 0; j < affectedFaces.size(); ++j) + if (faces.find(affectedFaces[j]) == faces.end()) + faces.pushBack(affectedFaces[j]); + } + } + + void insertAndFlip(PxI32 pointToInsert, PxI32 tetId, PxArray& neighbors, PxArray& vertexToTet, const PxArray& points, + PxArray& tets, PxArray& unusedTets, PxArray& affectedFaces, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + flip1to4(pointToInsert, tetId, neighbors, vertexToTet, tets, unusedTets, affectedFaces); + + PxArray stack; + for (PxU32 j = 0; j < affectedFaces.size(); ++j) + if (stack.find(affectedFaces[j]) == stack.end()) + stack.pushBack(affectedFaces[j]); + + flip(stack, neighbors, vertexToTet, points, tets, unusedTets, affectedFaces, lockedFaces, lockedEdges); + } + + PxI32 searchAll(const Vec3& p, const PxArray& tets, const PxArray& points) + { + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + + PxI32 j = 0; + for (; j < 4; j++) + { + Plane plane(points[tet[neighborFaces[j][0]]], points[tet[neighborFaces[j][1]]], points[tet[neighborFaces[j][2]]]); + PxF64 distP = plane.signedDistance(p); + if (distP < 0) + break; + } + if (j == 4) + return i; + } + return -1; + } + + bool runDelaunay(const PxArray& points, PxI32 start, PxI32 end, PxArray& tets, PxArray& neighbors, PxArray& vertexToTet, PxArray& unusedTets, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + PxI32 tetId = 0; + + PxArray affectedFaces; + for (PxI32 i = start; i < end; ++i) + { + const Vec3 p = points[i]; + if (!PxIsFinite(p.x) || !PxIsFinite(p.y) || !PxIsFinite(p.z)) + continue; + + if (tetId < 0 || unusedTets.find(tetId) != unusedTets.end()) + tetId = 0; + + while (unusedTets.find(tetId) != unusedTets.end()) + ++tetId; + + PxU32 counter = 0; + bool tetLocated = false; + while (!tetLocated) + { + const Tetrahedron& tet = tets[tetId]; + const Vec3 center = (points[tet[0]] + points[tet[1]] + points[tet[2]] + points[tet[3]]) * 0.25; + + PxF64 minDist = DBL_MAX; + PxI32 minFaceNr = -1; + + for (PxI32 j = 0; j < 4; j++) + { + Plane plane(points[tet[neighborFaces[j][0]]], points[tet[neighborFaces[j][1]]], points[tet[neighborFaces[j][2]]]); + PxF64 distP = plane.signedDistance(p); + PxF64 distCenter = plane.signedDistance(center); + PxF64 delta = distP - distCenter; + if (delta == 0.0) + continue; + delta = -distCenter / delta; + if (delta >= 0.0 && delta < minDist) + { + minDist = delta; + minFaceNr = j; + } + } + if (minDist >= 1.0) + tetLocated = true; + else + { + tetId = neighbors[4 * tetId + minFaceNr] >> 2; + if (tetId < 0) + { + tetId = searchAll(p, tets, points); + tetLocated = true; + } + } + + ++counter; + if (counter > tets.size()) + { + tetId = searchAll(p, tets, points); + if (tetId < 0) + return false; + tetLocated = true; + } + } + + insertAndFlip(i, tetId, neighbors, vertexToTet, points, tets, unusedTets, affectedFaces, lockedFaces, lockedEdges); + } + return true; + } + + bool DelaunayTetrahedralizer::insertPoints(const PxArray& inPoints, PxI32 start, PxI32 end) + { + for (PxI32 i = start; i < end; ++i) + { + centeredNormalizedPoints.pushBack(inPoints[i]); + vertexToTet.pushBack(-1); + } + + if (!runDelaunay(centeredNormalizedPoints, start + numAdditionalPointsAtBeginning, end + numAdditionalPointsAtBeginning, result, neighbors, vertexToTet, unusedTets, lockedTriangles, lockedEdges)) + return false; + return true; + } + + void DelaunayTetrahedralizer::exportTetrahedra(PxArray& tetrahedra) + { + tetrahedra.clear(); + for (PxU32 i = 0; i < result.size(); ++i) + { + const Tetrahedron& tet = result[i]; + if (tet[0] >= numAdditionalPointsAtBeginning && tet[1] >= numAdditionalPointsAtBeginning && tet[2] >= numAdditionalPointsAtBeginning && tet[3] >= numAdditionalPointsAtBeginning) + tetrahedra.pushBack(Tetrahedron(tet[0] - numAdditionalPointsAtBeginning, tet[1] - numAdditionalPointsAtBeginning, tet[2] - numAdditionalPointsAtBeginning, tet[3] - numAdditionalPointsAtBeginning)); + } + } + + void DelaunayTetrahedralizer::insertPoints(const PxArray& inPoints, PxI32 start, PxI32 end, PxArray& tetrahedra) + { + insertPoints(inPoints, start, end); + exportTetrahedra(tetrahedra); + } + + //Code below this line is for tetmesh manipulation and not directly required to generate a Delaunay tetrahedron mesh. It is used to impmrove the quality of a tetrahedral mesh. + + //https://cs.nyu.edu/~panozzo/papers/SLIM-2016.pdf + PxF64 evaluateAmipsEnergyPow3(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& d) + { + PxF64 x1 = a.x + d.x - 2.0 * b.x; + PxF64 x2 = a.x + b.x + d.x - 3.0 * c.x; + PxF64 y1 = a.y + d.y - 2.0 * b.y; + PxF64 y2 = a.y + b.y + d.y - 3.0 * c.y; + PxF64 z1 = a.z + d.z - 2.0 * b.z; + PxF64 z2 = a.z + b.z + d.z - 3.0 * c.z; + + PxF64 f = (1.0 / (PxSqrt(3.0) * PxSqrt(6.0))) * + ((a.x - d.x) * (y1 * z2 - y2 * z1) - + (a.y - d.y) * (z2 * x1 - x2 * z1) + + (a.z - d.z) * (y2 * x1 - y1 * x2)); + + if (f >= 0) + return 0.25 * DBL_MAX; + + PxF64 g = a.x * (b.x + c.x + d.x - 3.0 * a.x) + + a.y * (b.y + c.y + d.y - 3.0 * a.y) + + a.z * (b.z + c.z + d.z - 3.0 * a.z) + + b.x * (a.x + c.x + d.x - 3.0 * b.x) + + b.y * (a.y + c.y + d.y - 3.0 * b.y) + + b.z * (a.z + c.z + d.z - 3.0 * b.z) + + c.x * x2 + + c.y * y2 + + c.z * z2 + + d.x * (a.x + b.x + c.x - 3.0 * d.x) + + d.y * (a.y + b.y + c.y - 3.0 * d.y) + + d.z * (a.z + b.z + c.z - 3.0 * d.z); + + return -0.125 * (g * g * g) / (f * f); + //return -0.5 * PxPow(f * f, -1.0 / 3.0) * g; + } + + PX_FORCE_INLINE PxF64 pow(const PxF64 a, const PxF64 b) + { + return PxF64(PxPow(PxF32(a), PxF32(b))); + } + + PX_FORCE_INLINE PxF64 evaluateAmipsEnergy(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& d) + { + return pow(evaluateAmipsEnergyPow3(a, b, c, d), 1.0 / 3.0); + } + + PxF64 maxEnergyPow3(const PxArray& points, const PxArray& tets) + { + PxF64 maxEnergy = 0; + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + PxF64 e = evaluateAmipsEnergyPow3(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + if (e > maxEnergy) + maxEnergy = e; + } + return maxEnergy; + } + + PX_FORCE_INLINE PxF64 maxEnergy(const PxArray& points, const PxArray& tets) + { + return pow(maxEnergyPow3(points, tets), 1.0 / 3.0); + } + + PxF64 maxEnergyPow3(const PxArray& points, const PxArray& tets, const PxArray& tetIds) + { + PxF64 maxEnergy = 0; + for (PxU32 i = 0; i < tetIds.size(); ++i) + { + const Tetrahedron& tet = tets[tetIds[i]]; + if (tet[0] < 0) + continue; + PxF64 e = evaluateAmipsEnergyPow3(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + if (e > maxEnergy) + maxEnergy = e; + } + return maxEnergy; + } + + PxF64 minAbsTetVolume(const PxArray& points, const PxArray& tets) + { + PxF64 minVol = DBL_MAX; + for (PxU32 i = 0; i < tets.size(); ++i) { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + PxF64 vol = PxAbs(tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]])); + if (vol < minVol) + minVol = vol; + } + return minVol; + } + + PxF64 minTetVolume(const PxArray& points, const PxArray& tets) + { + PxF64 minVol = DBL_MAX; + for (PxU32 i = 0; i < tets.size(); ++i) { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + PxF64 vol = tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + if (vol < minVol) + minVol = vol; + } + return minVol; + } + + PxF64 minTetVolume(const PxArray& points, const PxArray& tets, const PxArray& indices) + { + PxF64 minVol = DBL_MAX; + for (PxU32 i = 0; i < indices.size(); ++i) { + const Tetrahedron& tet = tets[indices[i]]; + if (tet[0] < 0) + continue; + PxF64 vol = tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + if (vol < minVol) + minVol = vol; + } + return minVol; + } + + PxF64 MinimizeMaxAmipsEnergy::quality(const PxArray tetIndices) const + { + return maxEnergyPow3(points, tetrahedra, tetIndices); + } + + PxF64 MinimizeMaxAmipsEnergy::quality(const PxArray tetrahedraToCheck) const + { + return maxEnergyPow3(points, tetrahedraToCheck); + } + + bool MinimizeMaxAmipsEnergy::improved(PxF64 previousQuality, PxF64 newQuality) const + { + return newQuality < previousQuality; //Minimize quality for Amips energy + } + + PxF64 MaximizeMinTetVolume::quality(const PxArray tetIndices) const + { + return minTetVolume(points, tetrahedra, tetIndices); + } + + PxF64 MaximizeMinTetVolume::quality(const PxArray tetrahedraToCheck) const + { + return minTetVolume(points, tetrahedraToCheck); + } + + bool MaximizeMinTetVolume::improved(PxF64 previousQuality, PxF64 newQuality) const + { + return newQuality > previousQuality; //Maximize quality for min volume + } + + void fixVertexToTet(PxArray& vertexToTet, const PxArray& newTetIds, const PxArray& tets) + { + for (PxU32 i = 0; i < newTetIds.size(); ++i) + { + PxI32 id = newTetIds[i]; + const Tetrahedron& tet = tets[id]; + if (tet[0] < 0) + continue; + while (PxU32(tet[0]) >= vertexToTet.size()) vertexToTet.pushBack(-1); + while (PxU32(tet[1]) >= vertexToTet.size()) vertexToTet.pushBack(-1); + while (PxU32(tet[2]) >= vertexToTet.size()) vertexToTet.pushBack(-1); + while (PxU32(tet[3]) >= vertexToTet.size()) vertexToTet.pushBack(-1); + vertexToTet[tet[0]] = id; vertexToTet[tet[1]] = id; vertexToTet[tet[2]] = id; vertexToTet[tet[3]] = id; + } + } + + void fixNeighborhoodLocally(const PxArray& removedTets, const PxArray& tetIndices, const PxArray& tets, + PxArray& neighborhood, PxArray* affectedFaces = NULL) + { + for (PxU32 k = 0; k < removedTets.size(); ++k) + { + PxI32 i = removedTets[k]; + for (PxI32 j = 0; j < 4; ++j) + { + PxI32 faceId = 4 * i + j; + neighborhood[faceId] = -1; + + if (affectedFaces != NULL && affectedFaces->find(faceId) == affectedFaces->end()) + affectedFaces->pushBack(faceId); + } + } + + PxHashMap faces; + for(PxU32 k = 0; k< tetIndices.size(); ++k) + { + PxI32 i = tetIndices[k]; + if (i < 0) + continue; + + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) + continue; + + for (PxI32 j = 0; j < 4; ++j) + { + SortedTriangle tri(tet[neighborFaces[j][0]], tet[neighborFaces[j][1]], tet[neighborFaces[j][2]]); + if (const PxPair* ptr = faces.find(tri)) + { + neighborhood[4 * i + j] = ptr->second; + neighborhood[ptr->second] = 4 * i + j; + } + else + faces.insert(tri, 4 * i + j); + } + } + + //validateNeighborhood(tets, neighborhood); + } + + void collectTetsConnectedToVertex(PxArray& faces, PxHashSet& tetsDone, const PxArray& tets, const PxArray& tetNeighbors, const PxArray& vertexToTet, + PxI32 vertexIndex, PxArray& tetIds, PxI32 secondVertexId = -1, PxI32 thirdVertexId = -1) + { + tetIds.clear(); + int tetIndex = vertexToTet[vertexIndex]; + if (tetIndex < 0) + return; //Free floating point + + if ((secondVertexId < 0 || tets[tetIndex].contains(secondVertexId)) && (thirdVertexId < 0 || tets[tetIndex].contains(thirdVertexId))) + tetIds.pushBack(tetIndex); + + faces.clear(); + tetsDone.clear(); + for (int i = 0; i < 4; ++i) + { + if (tetNeighbors[4 * tetIndex + i] >= 0) + faces.pushBack(4 * tetIndex + i); + } + tetsDone.insert(tetIndex); + + while (faces.size() > 0) + { + PxI32 faceId = faces.popBack(); + int tetId = tetNeighbors[faceId] >> 2; + + if (tetId < 0 || tetIds.find(tetId) != tetIds.end()) + continue; + + const Tetrahedron& tet = tets[tetId]; + int id = tet.indexOf(vertexIndex); + if (id >= 0) + { + if ((secondVertexId < 0 || tets[tetId].contains(secondVertexId)) && (thirdVertexId < 0 || tets[tetId].contains(thirdVertexId))) + tetIds.pushBack(tetId); + + const PxI32* f = neighborFaces[id]; + for (int i = 0; i < 3; ++i) + { + int candidate = 4 * tetId + f[i]; + if (tetsDone.insert(tetNeighbors[candidate] >> 2)) + { + int otherTetId = tetNeighbors[candidate] >> 2; + if (otherTetId >= 0 && tets[otherTetId].contains(vertexIndex)) + faces.pushBack(candidate); + } + } + } + } + } + + void DelaunayTetrahedralizer::collectTetsConnectedToVertex(PxI32 vertexIndex, PxArray& tetIds) + { + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, vertexIndex, tetIds, -1, -1); + } + + void DelaunayTetrahedralizer::collectTetsConnectedToVertex(PxArray& faces, PxHashSet& tetsDone, PxI32 vertexIndex, PxArray& tetIds) + { + faces.clear(); + tetsDone.clear(); + physx::Ext::collectTetsConnectedToVertex(faces, tetsDone, result, neighbors, vertexToTet, vertexIndex, tetIds); + } + + void DelaunayTetrahedralizer::collectTetsConnectedToEdge(PxI32 edgeStart, PxI32 edgeEnd, PxArray& tetIds) + { + if (edgeStart < edgeEnd) + PxSwap(edgeStart, edgeEnd); + + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, edgeStart, tetIds, edgeEnd); + } + + PX_FORCE_INLINE bool containsDuplicates(PxI32 a, PxI32 b, PxI32 c, PxI32 d) + { + return a == b || a == c || a == d || b == c || b == d || c == d; + } + + //Returns true if the volume of a tet would become negative if a vertex it contains would get replaced by another one + bool tetFlipped(const Tetrahedron& tet, PxI32 vertexToReplace, PxI32 replacement, const PxArray& points, PxF64 volumeChangeThreshold = 0.1) + { + PxF64 volumeBefore = tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + + PxI32 a = tet[0] == vertexToReplace ? replacement : tet[0]; + PxI32 b = tet[1] == vertexToReplace ? replacement : tet[1]; + PxI32 c = tet[2] == vertexToReplace ? replacement : tet[2]; + PxI32 d = tet[3] == vertexToReplace ? replacement : tet[3]; + + if (containsDuplicates(a, b, c, d)) + return false; + + PxF64 volume = tetVolume(points[a], points[b], points[c], points[d]); + if (volume < 0) + return true; + if (PxAbs(volume / volumeBefore) < volumeChangeThreshold) + return true; + return false; + } + + PX_FORCE_INLINE Tetrahedron getTet(const Tetrahedron& tet, PxI32 vertexToReplace, PxI32 replacement) + { + return Tetrahedron(tet[0] == vertexToReplace ? replacement : tet[0], + tet[1] == vertexToReplace ? replacement : tet[1], + tet[2] == vertexToReplace ? replacement : tet[2], + tet[3] == vertexToReplace ? replacement : tet[3]); + } + + PX_FORCE_INLINE bool containsDuplicates(const Tetrahedron& tet) + { + return tet[0] == tet[1] || tet[0] == tet[2] || tet[0] == tet[3] || tet[1] == tet[2] || tet[1] == tet[3] || tet[2] == tet[3]; + } + + //Returns true if a tetmesh's edge, defined by vertex indices keep and remove, can be collapsed without leading to an invalid tetmesh topology + bool canCollapseEdge(PxI32 keep, PxI32 remove, const PxArray& points, + const PxArray& tetsConnectedToKeepVertex, const PxArray& tetsConnectedToRemoveVertex, const PxArray& allTet, + PxF64& qualityAfterCollapse, PxF64 volumeChangeThreshold = 0.1, BaseTetAnalyzer* tetAnalyzer = NULL) + { + const PxArray& tets = tetsConnectedToRemoveVertex; + //If a tet would get a negative volume due to the edge collapse, then this edge is not collapsible + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = allTet[tets[i]]; + if (tet[0] < 0) + return false; + if (tetFlipped(tet, remove, keep, points, volumeChangeThreshold)) + return false; + } + + PxHashMap triangles; + + PxHashSet candidates; + for (PxU32 i = 0; i < tets.size(); ++i) + candidates.insert(tets[i]); + const PxArray& tets2 = tetsConnectedToKeepVertex; + for (PxU32 i = 0; i < tets2.size(); ++i) + if (allTet[tets2[i]][0] >= 0) + candidates.insert(tets2[i]); + + PxArray affectedTets; + affectedTets.reserve(candidates.size()); + PxArray remainingTets; + remainingTets.reserve(candidates.size()); + //If a tet-face would get referenced by more than 2 tetrahedra due to the edge collapse, then this edge is not collapsible + for (PxHashSet::Iterator iter = candidates.getIterator(); !iter.done(); ++iter) + { + PxI32 tetRef = *iter; + affectedTets.pushBack(tetRef); + Tetrahedron tet = getTet(allTet[tetRef], remove, keep); + if (containsDuplicates(tet)) + continue; + + remainingTets.pushBack(tet); + + for (PxU32 j = 0; j < 4; ++j) + { + SortedTriangle tri(tet[neighborFaces[j][0]], tet[neighborFaces[j][1]], tet[neighborFaces[j][2]]); + if (const PxPair* ptr = triangles.find(tri)) + triangles[tri] = ptr->second + 1; + else + triangles.insert(tri, 1); + } + } + + for (PxHashMap::Iterator iter = triangles.getIterator(); !iter.done(); ++iter) + if (iter->second > 2) + return false; + + if (tetAnalyzer == NULL) + return true; + + qualityAfterCollapse = tetAnalyzer->quality(remainingTets); + return tetAnalyzer->improved(tetAnalyzer->quality(affectedTets), qualityAfterCollapse); + } + + bool DelaunayTetrahedralizer::canCollapseEdge(PxI32 edgeVertexToKeep, PxI32 edgeVertexToRemove, PxF64 volumeChangeThreshold, BaseTetAnalyzer* tetAnalyzer) + { + PxF64 qualityAfterCollapse; + PxArray tetsA, tetsB; + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, edgeVertexToKeep, tetsA); + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, edgeVertexToRemove, tetsB); + return canCollapseEdge(edgeVertexToKeep, edgeVertexToRemove, tetsA, tetsB, qualityAfterCollapse, volumeChangeThreshold, tetAnalyzer); + } + + bool DelaunayTetrahedralizer::canCollapseEdge(PxI32 edgeVertexAToKeep, PxI32 edgeVertexBToRemove, const PxArray& tetsConnectedToA, const PxArray& tetsConnectedToB, + PxF64& qualityAfterCollapse, PxF64 volumeChangeThreshold, BaseTetAnalyzer* tetAnalyzer) + { + return physx::Ext::canCollapseEdge(edgeVertexAToKeep, edgeVertexBToRemove, centeredNormalizedPoints, + tetsConnectedToA, //physx::Ext::collectTetsConnectedToVertex(result, neighbors, vertexToTet, edgeVertexAToKeep), + tetsConnectedToB, //physx::Ext::collectTetsConnectedToVertex(result, neighbors, vertexToTet, edgeVertexBToRemove), + result, qualityAfterCollapse, volumeChangeThreshold, tetAnalyzer); + } + + void collapseEdge(PxI32 keep, PxI32 remove, const PxArray& tetsConnectedToKeepVertex, const PxArray& tetsConnectedToRemoveVertex, + PxArray& allTets, PxArray& neighborhood, PxArray& vertexToTet, PxArray& unusedTets, PxArray& changedTets) + { + PxArray removedTets; + changedTets.clear(); + + const PxArray& tets = tetsConnectedToRemoveVertex; + for (PxI32 i = tets.size() - 1; i >= 0; --i) + { + PxI32 tetId = tets[i]; + Tetrahedron tet = allTets[tetId]; + tet.replace(remove, keep); + if (containsDuplicates(tet)) + { + for (PxU32 j = 0; j < 4; ++j) + { + if (vertexToTet[tet[j]] == tetId) vertexToTet[tet[j]] = -1; + tet[j] = -1; + } + removedTets.pushBack(tetId); + unusedTets.pushBack(tetId); + } + else + { + changedTets.pushBack(tetId); + } + allTets[tetId] = tet; + } + + for (PxU32 i = 0; i < tetsConnectedToKeepVertex.size(); ++i) + { + PxI32 id = tetsConnectedToKeepVertex[i]; + if (removedTets.find(id) == removedTets.end()) + changedTets.pushBack(id); + } + + for (PxU32 i = 0; i < removedTets.size(); ++i) + { + PxI32 id = removedTets[i]; + for (PxI32 j = 0; j < 4; ++j) + { + PxI32 n = neighborhood[4 * id + j]; + if (n >= 0) + neighborhood[n] = -1; + } + } + + fixNeighborhoodLocally(removedTets, changedTets, allTets, neighborhood); + fixVertexToTet(vertexToTet, changedTets, allTets); + vertexToTet[remove] = -1; + } + + void DelaunayTetrahedralizer::collapseEdge(PxI32 edgeVertexToKeep, PxI32 edgeVertexToRemove) + { + PxArray changedTets; + + PxArray keepTetIds; + PxArray removeTetIds; + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, edgeVertexToKeep, keepTetIds); + stackMemory.clear(); + physx::Ext::collectTetsConnectedToVertex(stackMemory.faces, stackMemory.hashSet, result, neighbors, vertexToTet, edgeVertexToRemove, removeTetIds); + physx::Ext::collapseEdge(edgeVertexToKeep, edgeVertexToRemove, + keepTetIds, + removeTetIds, + result, neighbors, vertexToTet, unusedTets, changedTets); + } + + void DelaunayTetrahedralizer::collapseEdge(PxI32 edgeVertexAToKeep, PxI32 edgeVertexBToRemove, const PxArray& tetsConnectedToA, const PxArray& tetsConnectedToB) + { + PxArray changedTets; + physx::Ext::collapseEdge(edgeVertexAToKeep, edgeVertexBToRemove, + tetsConnectedToA, tetsConnectedToB, + result, neighbors, vertexToTet, unusedTets, changedTets); + } + + bool buildRing(const PxArray& edges, PxArray& result) + { + result.reserve(edges.size() + 1); + const Edge& first = edges[0]; + result.pushBack(first.first); + result.pushBack(first.second); + + PxU32 currentEdge = 0; + PxI32 connector = first.second; + + for (PxU32 j = 1; j < edges.size(); ++j) + { + for (PxU32 i = 1; i < edges.size(); ++i) + { + if (i == currentEdge) + continue; + + const Edge& e = edges[i]; + if (e.first == connector) + { + currentEdge = i; + result.pushBack(e.second); + connector = e.second; + } + else if (e.second == connector) + { + currentEdge = i; + result.pushBack(e.first); + connector = e.first; + } + if (connector == result[0]) + { + result.remove(result.size() - 1); + if (result.size() != edges.size()) + { + result.clear(); + return false; //Multiple segments - unexpected input + } + return true; //Cyclic + } + } + } + result.clear(); + return false; + } + + void addRange(PxHashSet& set, const PxArray& list) + { + for (PxU32 i = 0; i < list.size(); ++i) + set.insert(list[i]); + } + + static Edge createEdge(PxI32 x, PxI32 y, bool swap) + { + if (swap) + return Edge(y, x); + else + return Edge(x, y); + } + + Edge getOtherEdge(const Tetrahedron& tet, PxI32 x, PxI32 y) + { + x = tet.indexOf(x); + y = tet.indexOf(y); + + bool swap = x > y; + if (swap) + PxSwap(x, y); + + if (x == 0 && y == 1) return createEdge(tet[2], tet[3], swap); + if (x == 0 && y == 2) return createEdge(tet[3], tet[1], swap); + if (x == 0 && y == 3) return createEdge(tet[1], tet[2], swap); + if (x == 1 && y == 2) return createEdge(tet[0], tet[3], swap); + if (x == 1 && y == 3) return createEdge(tet[2], tet[0], swap); + if (x == 2 && y == 3) return createEdge(tet[0], tet[1], swap); + + return Edge(-1, -1); + } + + bool removeEdgeByFlip(PxI32 edgeA, PxI32 edgeB, PxArray& faces, PxHashSet& hashset, PxArray& tetIndices, + PxArray& tets, PxArray& pts, PxArray& unusedTets, PxArray& neighbors, PxArray& vertexToTet, + BaseTetAnalyzer* qualityAnalyzer = NULL) + { + //validateNeighborhood(tets, neighbors); + + PxArray ringEdges; + ringEdges.reserve(tetIndices.size()); + for (PxU32 i = 0; i < tetIndices.size(); ++i) + ringEdges.pushBack(getOtherEdge(tets[tetIndices[i]], edgeA, edgeB)); + + PxArray ring; + buildRing(ringEdges, ring); + if (ring.size() == 0) + return false; + + PxArray ringCopy(ring); + + const Vec3& a = pts[edgeA]; + const Vec3& b = pts[edgeB]; + + PxArray newTets; + newTets.reserve(ring.size() * 2); + PxArray newFaces; + while (ring.size() >= 3) + { + PxF64 shortestDist = DBL_MAX; + PxI32 id = -1; + for (PxI32 i = 0; i < PxI32(ring.size()); ++i) + { + const Vec3& s = pts[ring[(i - 1 + ring.size()) % ring.size()]]; + const Vec3& middle = pts[ring[i]]; + const Vec3& e = pts[ring[(i + 1) % ring.size()]]; + const PxF64 d = (s - e).magnitudeSquared(); + if (d < shortestDist) + { + const PxF64 vol1 = tetVolume(s, middle, e, b); + const PxF64 vol2 = tetVolume(a, s, middle, e); + if (vol1 > 0 && vol2 > 0) + { + shortestDist = d; + id = i; + } + } + } + + if (id < 0) + return false; + + { + const PxI32& s = ring[(id - 1 + ring.size()) % ring.size()]; + const PxI32& middle = ring[id]; + const PxI32& e = ring[(id + 1) % ring.size()]; + newTets.pushBack(Tetrahedron(s, middle, e, edgeB)); + newTets.pushBack(Tetrahedron(edgeA, s, middle, e)); + + newFaces.pushBack(Triangle(s, middle, e)); + if (ring.size() > 3) + { + newFaces.pushBack(Triangle(s, e, edgeA)); + newFaces.pushBack(Triangle(s, e, edgeB)); + } + } + + ring.remove(id); + } + + //Analyze and decide if operation should be done + if (qualityAnalyzer != NULL && !qualityAnalyzer->improved(qualityAnalyzer->quality(tetIndices), qualityAnalyzer->quality(newTets))) + return false; + + PxArray newTetIds; + for (PxU32 i = 0; i < tetIndices.size(); ++i) + { + for (PxI32 j = 0; j < 4; ++j) + { + PxI32 id = 4 * tetIndices[i] + j; + PxI32 neighborTet = neighbors[id] >> 2; + if (neighborTet >= 0 && tetIndices.find(neighborTet) == tetIndices.end() && newTetIds.find(neighborTet) == newTetIds.end()) + newTetIds.pushBack(neighborTet); + } + } + + + PxHashSet set; + PxArray tetIds; + collectTetsConnectedToVertex(faces, hashset, tets, neighbors, vertexToTet, edgeA, tetIds); + addRange(set, tetIds); + + faces.forceSize_Unsafe(0); + hashset.clear(); + tetIds.forceSize_Unsafe(0); + collectTetsConnectedToVertex(faces, hashset, tets, neighbors, vertexToTet, edgeB, tetIds); + + addRange(set, tetIds); + + for (PxU32 i = 0; i < ringCopy.size(); ++i) + { + faces.forceSize_Unsafe(0); + hashset.clear(); + tetIds.forceSize_Unsafe(0); + collectTetsConnectedToVertex(faces, hashset, tets, neighbors, vertexToTet, ringCopy[i], tetIds); + addRange(set, tetIds); + } + for (PxHashSet::Iterator iter = set.getIterator(); !iter.done(); ++iter) + { + PxI32 i = *iter; + const Tetrahedron& neighborTet = tets[i]; + for (PxU32 j = 0; j < newFaces.size(); ++j) + if (neighborTet.containsFace(newFaces[j])) + return false; + + for (PxU32 j = 0; j < newTets.size(); ++j) + { + const Tetrahedron& t = newTets[j]; + if (Tetrahedron::identical(t, neighborTet)) + return false; + } + } + + for (PxU32 i = 0; i < tetIndices.size(); ++i) + { + tets[tetIndices[i]] = Tetrahedron(-1, -1, -1, -1); + unusedTets.pushBack(tetIndices[i]); + } + + PxU32 l = newTetIds.size(); + for (PxU32 i = 0; i < newTets.size(); ++i) + newTetIds.pushBack(storeNewTet(tets, neighbors, newTets[i], unusedTets)); + + fixNeighborhoodLocally(tetIndices, newTetIds, tets, neighbors); + tetIndices.clear(); + for (PxU32 i = l; i < newTetIds.size(); ++i) + tetIndices.pushBack(newTetIds[i]); + fixVertexToTet(vertexToTet, tetIndices, tets); + + return true; + } + + bool DelaunayTetrahedralizer::removeEdgeByFlip(PxI32 edgeA, PxI32 edgeB, PxArray& tetIndices, BaseTetAnalyzer* qualityAnalyzer) + { + stackMemory.clear(); + return physx::Ext::removeEdgeByFlip(edgeA, edgeB, stackMemory.faces, stackMemory.hashSet, tetIndices, result, centeredNormalizedPoints, unusedTets, neighbors, vertexToTet, qualityAnalyzer); + } + + void DelaunayTetrahedralizer::addLockedEdges(const PxArray& triangles) + { + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& t = triangles[i]; + lockedEdges.insert(key(t[0] + numAdditionalPointsAtBeginning, t[1] + numAdditionalPointsAtBeginning)); + lockedEdges.insert(key(t[0] + numAdditionalPointsAtBeginning, t[2] + numAdditionalPointsAtBeginning)); + lockedEdges.insert(key(t[1] + numAdditionalPointsAtBeginning, t[2] + numAdditionalPointsAtBeginning)); + } + } + + void DelaunayTetrahedralizer::addLockedTriangles(const PxArray& triangles) + { + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + lockedTriangles.insert(SortedTriangle(tri[0] + numAdditionalPointsAtBeginning, tri[1] + numAdditionalPointsAtBeginning, tri[2] + numAdditionalPointsAtBeginning)); + } + } + + void previewFlip3to2(PxI32 tip1, PxI32 tip2, PxI32 reflexEdgeA, PxI32 reflexEdgeB, PxI32 nonReflexTrianglePoint, Tetrahedron& tet1, Tetrahedron& tet2) + { + // 3->2 flip + tet1 = Tetrahedron(tip1, tip2, reflexEdgeA, nonReflexTrianglePoint); + tet2 = Tetrahedron(tip2, tip1, reflexEdgeB, nonReflexTrianglePoint); + } + + bool previewFlip2to3(PxI32 tet1Id, PxI32 tet2Id, const PxArray& neighbors, const PxArray& tets, + PxI32 tip1, PxI32 tip2, Triangle tri, Tetrahedron& tet1, Tetrahedron& tet2, Tetrahedron& tet3) + { + // 2->3 flip + tet1 = Tetrahedron(tip2, tip1, tri[0], tri[1]); + tet2 = Tetrahedron(tip2, tip1, tri[1], tri[2]); + tet3 = Tetrahedron(tip2, tip1, tri[2], tri[0]); + + PxI32 n1 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[0], tri[1], tip1)]; + PxI32 n2 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[0], tri[1], tip2)]; + if (n1 >= 0 && (n1 >> 2) == (n2 >> 2)) + { + if (Tetrahedron::identical(tet1, tets[n1 >> 2])) + return false; + } + + PxI32 n3 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[1], tri[2], tip1)]; + PxI32 n4 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[1], tri[2], tip2)]; + if (n3 >= 0 && (n3 >> 2) == (n4 >> 2)) + { + if (Tetrahedron::identical(tet2, tets[n3 >> 2])) + return false; + } + + PxI32 n5 = neighbors[4 * tet1Id + localFaceId(tets[tet1Id], tri[2], tri[0], tip1)]; + PxI32 n6 = neighbors[4 * tet2Id + localFaceId(tets[tet2Id], tri[2], tri[0], tip2)]; + if (n5 >= 0 && (n5 >> 2) == (n6 >> 2)) + { + if (Tetrahedron::identical(tet3, tets[n5 >> 2])) + return false; + } + return true; + } + + bool previewFlip(const PxArray& points, const PxArray& tets, const PxArray& neighbors, PxI32 faceId, + PxArray& newTets, PxArray& removedTets, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + newTets.clear(); + removedTets.clear(); + + PxI32 neighborPointer = neighbors[faceId]; + if (neighborPointer < 0) + return false; + + PxI32 tet1Id = faceId >> 2; + const PxI32* localTriangle1 = neighborFaces[faceId & 3]; + Tetrahedron tet1 = tets[tet1Id]; + Triangle tri(tet1[localTriangle1[0]], tet1[localTriangle1[1]], tet1[localTriangle1[2]]); + PxI32 localTip1 = tetTip[faceId & 3]; + PxI32 localTip2 = tetTip[neighborPointer & 3]; + PxI32 tip1 = tet1[localTip1]; + + PxI32 tet2Id = neighborPointer >> 2; + Tetrahedron tet2 = tets[tet2Id]; + PxI32 tip2 = tet2[localTip2]; + + if (!tet2.contains(tri[0]) || !tet2.contains(tri[1]) || !tet2.contains(tri[2])) + { + return false; + } + + PxI32 face1 = -1; + PxI32 face2 = -1; + PxI32 numReflexEdges = 0; + PxI32 reflexEdgeA = -1; + PxI32 reflexEdgeB = -1; + PxI32 nonReflexTrianglePoint = -1; + PxF64 ab = orient3D(points[tri[0]], points[tri[1]], points[tip1], points[tip2]); + if (ab < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[0], localTriangle1[1], localTip1); reflexEdgeA = tri[0]; reflexEdgeB = tri[1]; nonReflexTrianglePoint = tri[2]; face2 = localFaceId(tet2, tri[0], tri[1], tip2); } + PxF64 bc = orient3D(points[tri[1]], points[tri[2]], points[tip1], points[tip2]); + if (bc < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[1], localTriangle1[2], localTip1); reflexEdgeA = tri[1]; reflexEdgeB = tri[2]; nonReflexTrianglePoint = tri[0]; face2 = localFaceId(tet2, tri[1], tri[2], tip2); } + PxF64 ca = orient3D(points[tri[2]], points[tri[0]], points[tip1], points[tip2]); + if (ca < 0) { ++numReflexEdges; face1 = localFaceId(localTriangle1[2], localTriangle1[0], localTip1); reflexEdgeA = tri[2]; reflexEdgeB = tri[0]; nonReflexTrianglePoint = tri[1]; face2 = localFaceId(tet2, tri[2], tri[0], tip2); } + + if (numReflexEdges == 0) + { + if (!faceIsLocked(lockedFaces, tri[0], tri[1], tri[2])) + { + Tetrahedron tet3; + if (previewFlip2to3(tet1Id, tet2Id, neighbors, tets, tip1, tip2, tri, tet1, tet2, tet3)) + { + newTets.pushBack(tet1); newTets.pushBack(tet2); newTets.pushBack(tet3); + removedTets.pushBack(tet1Id); removedTets.pushBack(tet2Id); + return true; + } + else return true; + } + } + else if (numReflexEdges == 1) + { + PxI32 candidate1 = neighbors[4 * tet1Id + face1] >> 2; + PxI32 candidate2 = neighbors[4 * tet2Id + face2] >> 2; + if (candidate1 == candidate2 && candidate1 >= 0) + { + if (!edgeIsLocked(lockedEdges, reflexEdgeA, reflexEdgeB) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, nonReflexTrianglePoint) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, tip1) && + !faceIsLocked(lockedFaces, reflexEdgeA, reflexEdgeB, tip2)) + { + previewFlip3to2(tip1, tip2, reflexEdgeA, reflexEdgeB, nonReflexTrianglePoint, tet1, tet2); + newTets.pushBack(tet1); newTets.pushBack(tet2); + removedTets.pushBack(tet1Id); removedTets.pushBack(tet2Id); removedTets.pushBack(candidate1); + return true;; + } + } + } + else if (numReflexEdges == 2) + { + //Cannot do anything + } + else if (numReflexEdges == 3) + { + } + return true; + } + + void collectCommonFaces(const PxArray& a, const PxArray& b, const PxArray& neighbors, PxArray& result) + { + result.clear(); + for (PxU32 i = 0; i < a.size(); ++i) + { + PxI32 tetId = a[i]; + for (int j = 0; j < 4; ++j) + { + int id = 4 * tetId + j; + if (b.find(neighbors[id] >> 2) != b.end()) + { + if (result.find(id) == result.end()) + result.pushBack(id); + } + } + } + } + + void previewFlip2to3(PxI32 tip1, PxI32 tip2, const Triangle& tri, Tetrahedron& tet1, Tetrahedron& tet2, Tetrahedron& tet3) + { + // 2->3 flip + tet1 = Tetrahedron(tip2, tip1, tri[0], tri[1]); + tet2 = Tetrahedron(tip2, tip1, tri[1], tri[2]); + tet3 = Tetrahedron(tip2, tip1, tri[2], tri[0]); + } + + bool DelaunayTetrahedralizer::recoverEdgeByFlip(PxI32 eStart, PxI32 eEnd, RecoverEdgeMemoryCache& cache) + { + PxArray& tetsStart = cache.resultStart; + PxArray& tetsEnd = cache.resultEnd; + collectTetsConnectedToVertex(cache.facesStart, cache.tetsDoneStart, eStart, tetsStart); + collectTetsConnectedToVertex(cache.facesEnd, cache.tetsDoneEnd, eEnd, tetsEnd); + + for (PxU32 i = 0; i < tetsEnd.size(); ++i) + { + const Tetrahedron& tet = result[tetsEnd[i]]; + if (tet.contains(eStart)) + return true; + } + + PxArray commonFaces; + collectCommonFaces(tetsStart, tetsEnd, neighbors, commonFaces); + + if (commonFaces.size() > 0) + { + for (PxU32 i = 0; i < commonFaces.size(); ++i) + { + PxI32 faceId = commonFaces[i]; + PxI32 tetId = faceId >> 2; + const Tetrahedron& tet = result[tetId]; + const PxI32* local = neighborFaces[faceId & 3]; + Triangle tri(tet[local[0]], tet[local[1]], tet[local[2]]); + + if (tri.contains(eStart) || tri.contains(eEnd)) + continue; + + int n = neighbors[faceId]; + int tetId2 = n >> 2; + int tip1 = tet[tetTip[faceId & 3]]; + int tip2 = result[tetId2][tetTip[n & 3]]; + + Tetrahedron tet1, tet2, tet3; + previewFlip2to3(tip1, tip2, tri, tet1, tet2, tet3); + + if (tetVolume(tet1, centeredNormalizedPoints) > 0 && + tetVolume(tet2, centeredNormalizedPoints) > 0 && + tetVolume(tet3, centeredNormalizedPoints) > 0) + { + PxArray affectedFaces; + if (flip2to3(tetId, tetId2, neighbors, vertexToTet, result, unusedTets, affectedFaces, tip1, tip2, tri)) + return true; + } + } + } + return false; + } + + void insert(PxArray& list, int a, int b, int id) + { + for (PxI32 i = 0; i < PxI32(list.size()); ++i) + if (list[i] == a || list[i] == b) + { + list.pushBack(-1); + for (PxI32 j = list.size() - 2; j > i; --j) + { + list[j + 1] = list[j]; + } + list[i + 1] = id; + return; + } + PX_ASSERT(false); + } + + void DelaunayTetrahedralizer::generateTetmeshEnforcingEdges(const PxArray& trianglePoints, const PxArray& triangles, PxArray>& allEdges, + PxArray>& pointToOriginalTriangle, + PxArray& points, PxArray& finalTets) + { + clearLockedEdges(); + clearLockedTriangles(); + addLockedEdges(triangles); + addLockedTriangles(triangles); + + points.resize(trianglePoints.size()); + for (PxU32 i = 0; i < trianglePoints.size(); ++i) + points[i] = trianglePoints[i]; + + insertPoints(points, 0, points.size()); + + allEdges.clear(); + allEdges.reserve(lockedEdges.size()); + PxHashMap edgeToIndex; + PxArray list; + for (PxHashSet::Iterator iter = lockedEdges.getIterator(); !iter.done(); ++iter) + { + edgeToIndex.insert(*iter, allEdges.size()); + + list.forceSize_Unsafe(0); + list.pushBack(PxI32((*iter) >> 32)); + list.pushBack(PxI32((*iter))); + allEdges.pushBack(list); + } + + + pointToOriginalTriangle.clear(); + for (PxU32 i = 0; i < points.size(); ++i) + pointToOriginalTriangle.pushBack(PxArray()); + for (PxU32 i = 0; i < triangles.size(); ++i) + { + const Triangle& tri = triangles[i]; + pointToOriginalTriangle[tri[0]].pushBack(i); + pointToOriginalTriangle[tri[1]].pushBack(i); + pointToOriginalTriangle[tri[2]].pushBack(i); + } + + for (PxU32 i = 0;i < points.size(); ++i) { + PxArray& tempList = pointToOriginalTriangle[i]; + PxSort(tempList.begin(), tempList.size()); + } + + PxArray intersection; + RecoverEdgeMemoryCache cache; + while (true) { + PxArray copy; + copy.reserve(lockedEdges.size()); + for (PxHashSet::Iterator e = lockedEdges.getIterator(); !e.done(); ++e) + copy.pushBack(*e); + PxI32 missing = 0; + for (PxU32 k = 0; k < copy.size(); ++k) + { + PxU64 e = copy[k]; + PxI32 a = PxI32(e >> 32); + PxI32 b = PxI32(e); + if (!recoverEdgeByFlip(a, b, cache)) + { + PxU32 id = centeredNormalizedPoints.size(); + PxU32 i = edgeToIndex[e]; + if (allEdges[i].size() < 10) + { + Vec3 p = (centeredNormalizedPoints[a] + centeredNormalizedPoints[b]) * 0.5; + points.pushBack(p); + insertPoints(points, points.size() - 1, points.size()); + + intersection.forceSize_Unsafe(0); + intersectionOfSortedLists(pointToOriginalTriangle[a - numAdditionalPointsAtBeginning], pointToOriginalTriangle[b - numAdditionalPointsAtBeginning], intersection); + pointToOriginalTriangle.pushBack(intersection); + + insert(allEdges[i], a, b, id); + edgeToIndex.insert(key(a, id), i); + edgeToIndex.insert(key(b, id), i); + edgeToIndex.erase(e); + + lockedEdges.erase(e); + lockedEdges.insert(key(a, id)); + lockedEdges.insert(key(b, id)); + ++missing; + } + } + } + if (missing == 0) + break; + } + + for (PxU32 i = 0; i < allEdges.size(); ++i) + { + PxArray& tempList = allEdges[i]; + for (PxU32 j = 0; j < tempList.size(); ++j) + tempList[j] -= numAdditionalPointsAtBeginning; + } + + exportTetrahedra(finalTets); + } + + + PxI32 optimizeByFlipping(PxArray& faces, PxArray& neighbors, PxArray& vertexToTet, + const PxArray& points, PxArray& tets, PxArray& unusedTets, const BaseTetAnalyzer& qualityAnalyzer, + PxArray& affectedFaces, + const PxHashSet& lockedFaces, const PxHashSet& lockedEdges) + { + PxI32 counter = 0; + while (faces.size() > 0) + { + PxI32 faceId = faces.popBack(); + if (faceId < 0) + continue; + + PxArray newTets; + PxArray removedTets; + if (!previewFlip(points, tets, neighbors, faceId, newTets, removedTets, lockedFaces, lockedEdges)) + continue; + + if (!qualityAnalyzer.improved(qualityAnalyzer.quality(removedTets), qualityAnalyzer.quality(newTets))) + continue; + + affectedFaces.clear(); + flip(points, tets, neighbors, vertexToTet, faceId, unusedTets, affectedFaces, lockedFaces, lockedEdges); + + for (PxU32 j = 0; j < affectedFaces.size(); ++j) + if (faces.find(affectedFaces[j]) == faces.end()) + faces.pushBack(affectedFaces[j]); + + ++counter; + } + return counter; + } + + bool DelaunayTetrahedralizer::optimizeByFlipping(PxArray& affectedFaces, const BaseTetAnalyzer& qualityAnalyzer) + { + PxArray stack; + for (PxU32 i = 0; i < affectedFaces.size(); ++i) + stack.pushBack(affectedFaces[i]); + PxI32 counter = physx::Ext::optimizeByFlipping(stack, neighbors, vertexToTet, centeredNormalizedPoints, result, unusedTets, qualityAnalyzer, affectedFaces, lockedTriangles, lockedEdges); + return counter > 0; + } + + + void insertPointIntoEdge(PxI32 newPointIndex, PxI32 edgeA, PxI32 edgeB, PxArray& tets, + PxArray& neighbors, PxArray& vertexToTet, PxArray& unusedTets, PxArray* affectedFaces, PxArray& affectedTets) + { + PxU32 l = affectedTets.size(); + if (l == 0) + return; + + PxArray removedTets; + for (PxU32 i = 0; i < affectedTets.size(); ++i) + removedTets.pushBack(affectedTets[i]); + + PxArray newTets; + for (PxU32 i = 0; i < affectedTets.size(); ++i) + newTets.pushBack(affectedTets[i]); + + for (PxU32 i = 0; i < l; ++i) + { + for (PxI32 j = 0; j < 4; ++j) + { + PxI32 id = 4 * affectedTets[i] + j; + PxI32 neighborTet = neighbors[id] >> 2; + if (neighborTet >= 0 && affectedTets.find(neighborTet) == affectedTets.end()) + affectedTets.pushBack(neighborTet); + } + } + PxU32 l2 = affectedTets.size(); + + for (PxU32 i = 0; i < l; ++i) + { + PxI32 id = affectedTets[i]; + const Tetrahedron& tet = tets[id]; + + Edge oppositeEdge = getOtherEdge(tet, edgeA, edgeB); + + tets[id] = Tetrahedron(oppositeEdge.first, oppositeEdge.second, edgeA, newPointIndex); + PxI32 j = storeNewTet(tets, neighbors, Tetrahedron(oppositeEdge.first, oppositeEdge.second, newPointIndex, edgeB), unusedTets); + affectedTets.pushBack(j); + newTets.pushBack(j); + } + + fixNeighborhoodLocally(removedTets, affectedTets, tets, neighbors, affectedFaces); + fixVertexToTet(vertexToTet, newTets, tets); + affectedTets.removeRange(l, l2 - l); + } + + void DelaunayTetrahedralizer::insertPointIntoEdge(PxI32 newPointIndex, PxI32 edgeA, PxI32 edgeB, PxArray& affectedTets, BaseTetAnalyzer* qualityAnalyzer) + { + PxArray affectedFaces; + physx::Ext::insertPointIntoEdge(newPointIndex, edgeA, edgeB, result, neighbors, vertexToTet, unusedTets, &affectedFaces, affectedTets); + + if (qualityAnalyzer != NULL) + optimizeByFlipping(affectedFaces, *qualityAnalyzer); + } + + + bool containsAll(const PxArray& list, const PxArray& itemsToBePresentInList) + { + for (PxU32 i = 0; i < itemsToBePresentInList.size(); ++i) + if (list.find(itemsToBePresentInList[i]) == list.end()) + return false; + return true; + } + + bool optimizeByCollapsing(DelaunayTetrahedralizer& del, const PxArray& edges, + PxArray>& pointToOriginalTriangle, PxI32 numFixPoints, BaseTetAnalyzer* qualityAnalyzer) + { + PxI32 l = PxI32(pointToOriginalTriangle.size()); + + bool success = false; + PxArray tetsA; + PxArray tetsB; + + for (PxU32 i = 0; i < edges.size(); ++i) + { + const EdgeWithLength& e = edges[i]; + + tetsA.forceSize_Unsafe(0); + del.collectTetsConnectedToVertex(e.A, tetsA); + if (tetsA.empty()) continue; + + bool edgeExists = false; + for (PxU32 j = 0; j < tetsA.size(); ++j) + { + const Tetrahedron& tet = del.tetrahedron(tetsA[j]); + if (tet.contains(e.B)) + { + edgeExists = true; + break; + } + } + if (!edgeExists) + continue; + + tetsB.forceSize_Unsafe(0); + del.collectTetsConnectedToVertex(e.B, tetsB); + if (tetsB.empty()) continue; + + PxF64 firstQuality = 0, secondQuality = 0; + bool firstOptionValid = e.B >= numFixPoints && (e.B >= l || (e.A < l && containsAll(pointToOriginalTriangle[e.A], pointToOriginalTriangle[e.B]))) && + del.canCollapseEdge(e.A, e.B, tetsA, tetsB, firstQuality, 0, qualityAnalyzer); + bool secondOptionValid = e.A >= numFixPoints && (e.A >= l || (e.B < l && containsAll(pointToOriginalTriangle[e.B], pointToOriginalTriangle[e.A]))) && + del.canCollapseEdge(e.B, e.A, tetsB, tetsA, secondQuality, 0, qualityAnalyzer); + + if (qualityAnalyzer != NULL && firstOptionValid && secondOptionValid) + { + if (qualityAnalyzer->improved(firstQuality, secondQuality)) + firstOptionValid = false; + else + secondOptionValid = false; + } + if (firstOptionValid) + { + if (e.B >= numFixPoints) + { + del.collapseEdge(e.A, e.B, tetsA, tetsB); + if (e.B < l) + pointToOriginalTriangle[e.B].clear(); + success = true; + } + } + else if (secondOptionValid) + { + if (e.A >= numFixPoints) + { + del.collapseEdge(e.B, e.A, tetsB, tetsA); + if (e.A < l) + pointToOriginalTriangle[e.A].clear(); + success = true; + } + } + } + return success; + } + + bool optimizeBySwapping(DelaunayTetrahedralizer& del, const PxArray& edges, + const PxArray>& pointToOriginalTriangle, BaseTetAnalyzer* qualityAnalyzer) + { + PxI32 l = PxI32(pointToOriginalTriangle.size()); + + bool success = false; + PxArray tetIds; + for (PxU32 i = 0; i < edges.size(); ++i) + { + const EdgeWithLength& e = edges[i]; + + const bool isInteriorEdge = e.A >= l || e.B >= l || !intersectionOfSortedListsContainsElements(pointToOriginalTriangle[e.A], pointToOriginalTriangle[e.B]); + if (isInteriorEdge) + { + tetIds.forceSize_Unsafe(0); + del.collectTetsConnectedToEdge(e.A, e.B, tetIds); + if (tetIds.size() <= 2) + continue; //This would mean we have a surface edge + + if (del.removeEdgeByFlip(e.A, e.B, tetIds, qualityAnalyzer)) + success = true; + } + } + return success; + } + + void patternSearchOptimize(PxI32 pointToModify, PxF64 step, PxArray& points, BaseTetAnalyzer& score, const PxArray& tetrahedra, PxF64 minStep) + { + const Vec3 dir[] = { Vec3(1.0, 0.0, 0.0), Vec3(-1.0, 0.0, 0.0), Vec3(0.0, 1.0, 0.0), Vec3(0.0, -1.0, 0.0), Vec3(0.0, 0.0, 1.0), Vec3(0.0, 0.0, -1.0), }; + const PxI32 oppositeDir[] = { 1, 0, 3, 2, 5, 4 }; + PxF64 currentScore = score.quality(tetrahedra); // score(); + Vec3 p = points[pointToModify]; + PxI32 skip = -1; + + PxI32 maxIter = 100; + PxI32 iter = 0; + while (step > minStep && iter < maxIter) + { + PxF64 best = currentScore; + PxI32 id = -1; + for (PxI32 i = 0; i < 6; ++i) + { + if (i == skip) + continue; //That point was the best before current iteration - it cannot be the best anymore + + points[pointToModify] = p + dir[i] * step; + PxF64 s = score.quality(tetrahedra); // score(); + if (score.improved(best, s)) + { + best = s; + id = i; + } + } + if (id >= 0) + { + p = p + dir[id] * step; + points[pointToModify] = p; + currentScore = best; + skip = oppositeDir[id]; + } + else + { + points[pointToModify] = p; + step = step * 0.5; + skip = -1; + } + ++iter; + } + } + + bool optimizeBySplitting(DelaunayTetrahedralizer& del, const PxArray& edges, const PxArray>& pointToOriginalTriangle, + PxI32 maxPointsToInsert, bool sortByQuality, BaseTetAnalyzer* qualityAnalyzer, PxF64 qualityThreshold) + { + const PxF64 qualityThresholdPow3 = qualityThreshold * qualityThreshold * qualityThreshold; + + PxArray tetQualityBuffer; + tetQualityBuffer.resize(del.numTetrahedra()); + for (PxU32 i = 0; i < del.numTetrahedra(); ++i) { + const Tetrahedron& tet = del.tetrahedron(i); + if (tet[0] >= 0) + tetQualityBuffer[i] = evaluateAmipsEnergyPow3(del.point(tet[0]), del.point(tet[1]), del.point(tet[2]), del.point(tet[3])); + } + + PxI32 l = PxI32(pointToOriginalTriangle.size()); + PxArray edgesToSplit; + PxArray tetIds; + for (PxI32 i = edges.size() - 1; i >= 0; --i) + { + const EdgeWithLength& e = edges[i]; + + const bool isInteriorEdge = e.A >= l || e.B >= l || !intersectionOfSortedListsContainsElements(pointToOriginalTriangle[e.A], pointToOriginalTriangle[e.B]); + if (isInteriorEdge) + { + tetIds.forceSize_Unsafe(0); + del.collectTetsConnectedToEdge(e.A, e.B, tetIds); + if (tetIds.size() <= 2) + continue; //This would mean we got a surface edge... + PxF64 max = 0; + for (PxU32 j = 0; j < tetIds.size(); ++j) + { + if (tetQualityBuffer[tetIds[j]] > max) + max = tetQualityBuffer[tetIds[j]]; + } + if (max > qualityThresholdPow3) + edgesToSplit.pushBack(SplitEdge(e.A, e.B, max, (del.point(e.A) - del.point(e.B)).magnitudeSquared(), isInteriorEdge)); + } + } + + if (sortByQuality) + { + PxSort(edgesToSplit.begin(), edgesToSplit.size(), PxGreater()); + } + PxI32 counter = 0; + PxArray tetsConnectedToEdge; + PxArray tetsConnectedToVertex; + for (PxU32 i = 0; i < edgesToSplit.size(); ++i) + { + const SplitEdge& e = edgesToSplit[i]; + if (i > 0 && edgesToSplit[i - 1].Q == e.Q) + continue; + + if (counter == maxPointsToInsert) + break; + + PxU32 id = del.addPoint((del.point(e.A) + del.point(e.B)) * 0.5); + tetsConnectedToEdge.forceSize_Unsafe(0); + + del.collectTetsConnectedToEdge(e.A, e.B, tetsConnectedToEdge); + del.insertPointIntoEdge(id, e.A, e.B, tetsConnectedToEdge, qualityAnalyzer); + + if (e.InteriorEdge && qualityAnalyzer) + { + tetsConnectedToVertex.forceSize_Unsafe(0); + del.collectTetsConnectedToVertex(id, tetsConnectedToVertex); + patternSearchOptimize(id, e.L, del.points(), *qualityAnalyzer, tetsConnectedToVertex, 0.01 * e.L); + } + + ++counter; + } + return edgesToSplit.size() > 0; + } + + void updateEdges(PxArray& edges, PxHashSet& tetEdges, const PxArray& tets, const PxArray& points) + { + edges.clear(); + tetEdges.clear(); + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + if (tet[0] < 0) continue; + tetEdges.insert(key(tet[0], tet[1])); + tetEdges.insert(key(tet[0], tet[2])); + tetEdges.insert(key(tet[0], tet[3])); + tetEdges.insert(key(tet[1], tet[2])); + tetEdges.insert(key(tet[1], tet[3])); + tetEdges.insert(key(tet[2], tet[3])); + } + for (PxHashSet::Iterator iter = tetEdges.getIterator(); !iter.done(); ++iter) + { + PxU64 e = *iter; + PxI32 a = PxI32(e >> 32); + PxI32 b = PxI32(e); + edges.pushBack(EdgeWithLength(a, b, (points[a] - points[b]).magnitudeSquared())); + } + PxSort(edges.begin(), edges.size(), PxLess()); + } + + void optimize(DelaunayTetrahedralizer& del, PxArray>& pointToOriginalTriangle, PxI32 numFixPoints, + PxArray& optimizedPoints, PxArray& optimizedTets, PxI32 numPasses) + { + PxHashSet tetEdges; + PxArray edges; + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + + MinimizeMaxAmipsEnergy qualityAnalyzer(del.points(), del.tetrahedra()); + //MaximizeMinTetVolume qualityAnalyzer(del.points(), del.tetrahedra()); + + optimizedTets = PxArray(del.tetrahedra()); + optimizedPoints = PxArray(del.points()); + + PxF64 minVolBefore = minAbsTetVolume(del.points(), del.tetrahedra()); + PxF64 maxEnergyBefore = maxEnergy(del.points(), del.tetrahedra()); + PxI32 numPointsToInsertPerPass = PxMax(20, PxI32(0.05 * del.numPoints())); + for (PxI32 j = 0; j < numPasses; ++j) + { + //(1) Splitting + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + optimizeBySplitting(del, edges, pointToOriginalTriangle, numPointsToInsertPerPass, true, &qualityAnalyzer); + + //(3) Swapping + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + optimizeBySwapping(del, edges, pointToOriginalTriangle, &qualityAnalyzer); + + //(2) Collapsing + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + optimizeByCollapsing(del, edges, pointToOriginalTriangle, numFixPoints, &qualityAnalyzer); + + //(4) Smoothing + //Note done here - seems not to improve the quality that much + + PxF64 energy = maxEnergy(del.points(), del.tetrahedra()); + PxF64 minVol = minAbsTetVolume(del.points(), del.tetrahedra()); + + if (energy / minVol >= maxEnergyBefore / minVolBefore/*minVol <= minVolBefore*/) + { + del.initialize(optimizedPoints, optimizedTets); + + bool swapped = true, collapsed = true; + PxI32 maxReductionLoops = 30; + PxI32 counter = 0; + while (swapped || collapsed) + { + //(3) Swapping + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + swapped = optimizeBySwapping(del, edges, pointToOriginalTriangle, &qualityAnalyzer); + + //(2) Collapsing + updateEdges(edges, tetEdges, del.tetrahedra(), del.points()); + collapsed = optimizeByCollapsing(del, edges, pointToOriginalTriangle, numFixPoints, &qualityAnalyzer); + + if (counter >= maxReductionLoops) + break; + + ++counter; + } + + optimizedTets = PxArray(del.tetrahedra()); + optimizedPoints = PxArray(del.points()); + return; + } + + optimizedTets = PxArray(del.tetrahedra()); + optimizedPoints = PxArray(del.points()); + + minVolBefore = minVol; + maxEnergyBefore = energy; + } + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.h new file mode 100644 index 0000000..50246fa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtDelaunayTetrahedralizer.h @@ -0,0 +1,362 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_DELAUNAY_TETRAHEDRALIZER_H +#define EXT_DELAUNAY_TETRAHEDRALIZER_H + +#include "foundation/PxArray.h" +#include "foundation/PxVec3.h" +#include "foundation/PxHashSet.h" +#include "GuTetrahedron.h" +#include "ExtVec3.h" + +namespace physx +{ + +namespace Ext +{ + using Edge = PxPair; + using Tetrahedron = Gu::TetrahedronT; + using Tetrahedron16 = Gu::TetrahedronT; + + void buildNeighborhood(const PxArray& tets, PxArray& result); + void buildNeighborhood(const PxI32* tets, PxU32 numTets, PxArray& result); + + PX_FORCE_INLINE PxF64 tetVolume(const Vec3& a, const Vec3& b, const Vec3& c, const Vec3& d) + { + return (-1.0 / 6.0) * (a - d).dot((b - d).cross(c - d)); + } + + PX_FORCE_INLINE PxF64 tetVolume(const Tetrahedron& tet, const PxArray& points) + { + return tetVolume(points[tet[0]], points[tet[1]], points[tet[2]], points[tet[3]]); + } + + //Returns the intersection (set operation) of two sorted lists + PX_FORCE_INLINE void intersectionOfSortedLists(const PxArray& sorted1, const PxArray& sorted2, PxArray& result) + { + PxU32 a = 0; + PxU32 b = 0; + result.clear(); + while (a < sorted1.size() && b < sorted2.size()) + { + if (sorted1[a] == sorted2[b]) + { + result.pushBack(sorted1[a]); + ++a; + ++b; + } + else if (sorted1[a] > sorted2[b]) + ++b; + else + ++a; + } + } + + PX_FORCE_INLINE bool intersectionOfSortedListsContainsElements(const PxArray& sorted1, const PxArray& sorted2) + { + PxU32 a = 0; + PxU32 b = 0; + while (a < sorted1.size() && b < sorted2.size()) + { + if (sorted1[a] == sorted2[b]) + return true; + else if (sorted1[a] > sorted2[b]) + ++b; + else + ++a; + } + return false; + } + + + class BaseTetAnalyzer + { + public: + virtual PxF64 quality(const PxArray tetIndices) const = 0; + + virtual PxF64 quality(const PxArray tetrahedraToCheck) const = 0; + + virtual bool improved(PxF64 previousQuality, PxF64 newQuality) const = 0; + + virtual ~BaseTetAnalyzer() {} + }; + + class MinimizeMaxAmipsEnergy : public BaseTetAnalyzer + { + const PxArray& points; + const PxArray& tetrahedra; + + public: + MinimizeMaxAmipsEnergy(const PxArray& points_, const PxArray& tetrahedra_) : points(points_), tetrahedra(tetrahedra_) + {} + + PxF64 quality(const PxArray tetIndices) const; + + PxF64 quality(const PxArray tetrahedraToCheck) const; + + bool improved(PxF64 previousQuality, PxF64 newQuality) const; + + virtual ~MinimizeMaxAmipsEnergy() {} + + private: + PX_NOCOPY(MinimizeMaxAmipsEnergy) + }; + + class MaximizeMinTetVolume : public BaseTetAnalyzer + { + const PxArray& points; + const PxArray& tetrahedra; + + public: + MaximizeMinTetVolume(const PxArray& points_, const PxArray& tetrahedra_) : points(points_), tetrahedra(tetrahedra_) + {} + + PxF64 quality(const PxArray tetIndices) const; + + PxF64 quality(const PxArray tetrahedraToCheck) const; + + bool improved(PxF64 previousQuality, PxF64 newQuality) const; + + virtual ~MaximizeMinTetVolume() {} + + private: + PX_NOCOPY(MaximizeMinTetVolume) + }; + + + + //Helper class to extract surface triangles from a tetmesh + struct SortedTriangle + { + public: + PxI32 A; + PxI32 B; + PxI32 C; + bool Flipped; + + PX_FORCE_INLINE SortedTriangle(PxI32 a, PxI32 b, PxI32 c) + { + A = a; B = b; C = c; Flipped = false; + if (A > B) { PxSwap(A, B); Flipped = !Flipped; } + if (B > C) { PxSwap(B, C); Flipped = !Flipped; } + if (A > B) { PxSwap(A, B); Flipped = !Flipped; } + } + }; + + struct TriangleHash + { + PX_FORCE_INLINE std::size_t operator()(const SortedTriangle& k) const + { + return k.A ^ k.B ^ k.C; + } + + PX_FORCE_INLINE bool equal(const SortedTriangle& first, const SortedTriangle& second) const + { + return first.A == second.A && first.B == second.B && first.C == second.C; + } + }; + + + struct RecoverEdgeMemoryCache + { + PxArray facesStart; + PxHashSet tetsDoneStart; + PxArray resultStart; + PxArray facesEnd; + PxHashSet tetsDoneEnd; + PxArray resultEnd; + }; + + class StackMemory + { + public: + + void clear() + { + faces.forceSize_Unsafe(0); + hashSet.clear(); + } + + PxArray faces; + PxHashSet hashSet; + + }; + + //Incremental delaunay tetrahedralizer + class DelaunayTetrahedralizer + { + public: + //The bounds specified must contain all points that will get inserted by calling insertPoints. + DelaunayTetrahedralizer(const Vec3& min, const Vec3& max); + + DelaunayTetrahedralizer(PxArray& points, PxArray& tets); + + void initialize(PxArray& points, PxArray& tets); + + //Inserts a bunch of new points into the tetrahedralization and keeps the delaunay condition satisfied. The new result will + //get stored in the tetrahedra array. Points to insert must already be present in inPoints, the indices of the points to insert + //can be controlled with start and end index (end index is exclusive, start index is inclusive) + void insertPoints(const PxArray& inPoints, PxI32 start, PxI32 end, PxArray& tetrahedra); + + bool insertPoints(const PxArray& inPoints, PxI32 start, PxI32 end); + + void exportTetrahedra(PxArray& tetrahedra); + + bool canCollapseEdge(PxI32 edgeVertexToKeep, PxI32 edgeVertexToRemove, PxF64 volumeChangeThreshold = 0.1, BaseTetAnalyzer* tetAnalyzer = NULL); + bool canCollapseEdge(PxI32 edgeVertexToKeep, PxI32 edgeVertexToRemove, const PxArray& tetsConnectedToA, const PxArray& tetsConnectedToB, + PxF64& qualityAfterCollapse, PxF64 volumeChangeThreshold = 0.1, BaseTetAnalyzer* tetAnalyzer = NULL); + + void collapseEdge(PxI32 edgeVertexToKeep, PxI32 edgeVertexToRemove); + + void collapseEdge(PxI32 edgeVertexAToKeep, PxI32 edgeVertexBToRemove, const PxArray& tetsConnectedToA, const PxArray& tetsConnectedToB); + + void collectTetsConnectedToVertex(PxI32 vertexIndex, PxArray& tetIds); + + void collectTetsConnectedToVertex(PxArray& faces, PxHashSet& tetsDone, PxI32 vertexIndex, PxArray& tetIds); + + void collectTetsConnectedToEdge(PxI32 edgeStart, PxI32 edgeEnd, PxArray& tetIds); + + PX_FORCE_INLINE const Vec3& point(PxI32 index) const { return centeredNormalizedPoints[index]; } + + PX_FORCE_INLINE PxU32 numPoints() const { return centeredNormalizedPoints.size(); } + + PX_FORCE_INLINE PxArray& points() { return centeredNormalizedPoints; } + PX_FORCE_INLINE const PxArray& points() const { return centeredNormalizedPoints; } + + PxU32 addPoint(const Vec3& p) + { + centeredNormalizedPoints.pushBack(p); + vertexToTet.pushBack(-1); + return centeredNormalizedPoints.size() - 1; + } + + PX_FORCE_INLINE const Tetrahedron& tetrahedron(PxI32 index) const { return result[index]; } + + PX_FORCE_INLINE PxU32 numTetrahedra() const { return result.size(); } + + PX_FORCE_INLINE PxArray& tetrahedra() { return result; } + PX_FORCE_INLINE const PxArray& tetrahedra() const { return result; } + + void copyInternalPointsTo(PxArray& points) { points = centeredNormalizedPoints; } + + bool optimizeByFlipping(PxArray& affectedFaces, const BaseTetAnalyzer& qualityAnalyzer); + + void insertPointIntoEdge(PxI32 newPointIndex, PxI32 edgeA, PxI32 edgeB, PxArray& affectedTets, BaseTetAnalyzer* qualityAnalyzer = NULL); + + bool removeEdgeByFlip(PxI32 edgeA, PxI32 edgeB, PxArray& tetIndices, BaseTetAnalyzer* qualityAnalyzer = NULL); + + void addLockedEdges(const PxArray>& triangles); + + void addLockedTriangles(const PxArray>& triangles); + + void clearLockedEdges() { lockedEdges.clear(); } + + void clearLockedTriangles() { lockedTriangles.clear(); } + + bool recoverEdgeByFlip(PxI32 eStart, PxI32 eEnd, RecoverEdgeMemoryCache& cache); + + void generateTetmeshEnforcingEdges(const PxArray& trianglePoints, const PxArray>& triangles, PxArray>& allEdges, + PxArray>& pointToOriginalTriangle, + PxArray& points, PxArray& finalTets); + + private: + PxArray centeredNormalizedPoints; + PxArray neighbors; + PxArray unusedTets; + PxArray vertexToTet; + PxArray result; + PxI32 numAdditionalPointsAtBeginning = 4; + + PxHashSet lockedTriangles; + PxHashSet lockedEdges; + + StackMemory stackMemory; + PX_NOCOPY(DelaunayTetrahedralizer) + }; + + struct EdgeWithLength + { + PxI32 A; + PxI32 B; + PxF64 Length; + + EdgeWithLength(PxI32 a_, PxI32 b_, PxF64 length_) + { + A = a_; + B = b_; + Length = length_; + } + }; + + PX_FORCE_INLINE bool operator <(const EdgeWithLength& lhs, const EdgeWithLength& rhs) + { + return lhs.Length < rhs.Length; + } + + struct SplitEdge + { + PxI32 A; + PxI32 B; + PxF64 Q; + PxF64 L; + bool InteriorEdge; + + SplitEdge(PxI32 a, PxI32 b, PxF64 q, PxF64 l, bool interiorEdge) + { + A = a; + B = b; + Q = q; + L = l; + InteriorEdge = interiorEdge; + } + }; + + PX_FORCE_INLINE bool operator >(const SplitEdge& lhs, const SplitEdge& rhs) + { + if (lhs.Q == rhs.Q) + return lhs.L > rhs.L; + return lhs.Q > rhs.Q; + } + + + bool optimizeByCollapsing(DelaunayTetrahedralizer& del, const PxArray& edges, + PxArray>& pointToOriginalTriangle, PxI32 numFixPoints, BaseTetAnalyzer* qualityAnalyzer = NULL); + + bool optimizeBySwapping(DelaunayTetrahedralizer& del, const PxArray& edges, + const PxArray>& pointToOriginalTriangle, BaseTetAnalyzer* qualityAnalyzer); + + bool optimizeBySplitting(DelaunayTetrahedralizer& del, const PxArray& edges, const PxArray>& pointToOriginalTriangle, + PxI32 maxPointsToInsert = -1, bool sortByQuality = false, BaseTetAnalyzer* qualityAnalyzer = NULL, PxF64 qualityThreshold = 10); + + //Modified tetmesh quality improvement implementation of the method described in https://cs.nyu.edu/~yixinhu/tetwild.pdf Section 3.2 Mesh Improvement + void optimize(DelaunayTetrahedralizer& del, PxArray>& pointToOriginalTriangle, PxI32 numFixPoints, + PxArray& optimizedPoints, PxArray& optimizedTets, PxI32 numPasses = 10); +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp new file mode 100644 index 0000000..d678fff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.cpp @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtFastWindingNumber.h" +#include "foundation/PxSort.h" + +#include "foundation/PxMath.h" + +#include "ExtUtilities.h" + +//The following paper explains all the techniques used in this file +//http://www.dgp.toronto.edu/projects/fast-winding-numbers/fast-winding-numbers-for-soups-and-clouds-siggraph-2018-barill-et-al.pdf + +namespace physx +{ +namespace Ext +{ + PxF64 computeWindingNumber(const PxArray& tree, const Vec3& q, PxF64 beta, const PxHashMap& clusters, + const PxArray& triangles, const PxArray& points) + { + return Gu::computeWindingNumber(tree.begin(), q, beta, clusters, reinterpret_cast(triangles.begin()), points.begin()); + } + + void precomputeClusterInformation(PxArray& tree, const PxArray& triangles, + const PxArray& points, PxHashMap& result, PxI32 rootNodeIndex) + { + Gu::precomputeClusterInformation(tree.begin(), reinterpret_cast(triangles.begin()), triangles.size(), points.begin(), result, rootNodeIndex); + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.h new file mode 100644 index 0000000..688c559 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtFastWindingNumber.h @@ -0,0 +1,53 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_FAST_WINDING_NUMBER_H +#define EXT_FAST_WINDING_NUMBER_H + + +#include "ExtVec3.h" +#include "GuWindingNumberT.h" + +namespace physx +{ +namespace Ext +{ + using Triangle = Gu::IndexedTriangleT; + using Triangle16 = Gu::IndexedTriangleT; + + typedef Gu::ClusterApproximationT ClusterApproximationF64; + typedef Gu::SecondOrderClusterApproximationT SecondOrderClusterApproximationF64; + + PxF64 computeWindingNumber(const PxArray& tree, const Vec3& q, PxF64 beta, const PxHashMap& clusters, + const PxArray& triangles, const PxArray& points); + + void precomputeClusterInformation(PxArray& tree, const PxArray& triangles, + const PxArray& points, PxHashMap& result, PxI32 rootNodeIndex = 0); +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp new file mode 100644 index 0000000..99996b6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.cpp @@ -0,0 +1,196 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "ExtInsideTester.h" +#include "foundation/PxBounds3.h" + +namespace physx +{ + namespace Ext + { + // ------------------------------------------------------------------------ + void InsideTester::init(const PxVec3 *vertices, PxI32 numVertices, const PxI32 *triIndices, PxI32 numTris) + { + PxArray newIds(numVertices, -1); + + mVertices.clear(); + mIndices.clear(); + + for (PxI32 i = 0; i < 3 * numTris; i++) + { + PxI32 id = triIndices[i]; + if (newIds[id] < 0) + { + newIds[id] = PxI32(mVertices.size()); + mVertices.pushBack(vertices[id]); + } + mIndices.pushBack(newIds[id]); + } + + mGrids[0].init(0, mVertices, mIndices); + mGrids[1].init(1, mVertices, mIndices); + mGrids[2].init(2, mVertices, mIndices); + } + + // ------------------------------------------------------------------------ + bool InsideTester::isInside(const PxVec3 &pos) + { + PxI32 vote = 0; + vote += mGrids[0].numInside(pos, mVertices, mIndices); + vote += mGrids[1].numInside(pos, mVertices, mIndices); + vote += mGrids[2].numInside(pos, mVertices, mIndices); + return (vote > 3); + } + + // ------------------------------------------------------------------------ + void InsideTester::Grid2d::init(PxI32 _dim0, const PxArray &vertices, const PxArray &indices) + { + first.clear(); + tris.clear(); + next.clear(); + num1 = num2 = 0; + + this->dim0 = _dim0; + PxI32 dim1 = (_dim0 + 1) % 3; + PxI32 dim2 = (_dim0 + 2) % 3; + + PxI32 numTris = PxI32(indices.size()) / 3; + if (numTris == 0) + return; + + PxBounds3 bounds, triBounds; + bounds.setEmpty(); + PxReal avgSize = 0.0f; + + for (PxI32 i = 0; i < numTris; i++) + { + triBounds.setEmpty(); + triBounds.include(vertices[indices[3 * i]]); + triBounds.include(vertices[indices[3 * i + 1]]); + triBounds.include(vertices[indices[3 * i + 2]]); + triBounds.minimum[dim0] = 0.0f; + triBounds.maximum[dim0] = 0.0f; + avgSize += triBounds.getDimensions().magnitude(); + bounds.include(triBounds); + } + if (bounds.isEmpty()) + return; + + avgSize /= PxReal(numTris); + + orig = bounds.minimum; + spacing = avgSize; + + num1 = PxI32((bounds.maximum[dim1] - orig[dim1]) / spacing) + 2; + num2 = PxI32((bounds.maximum[dim2] - orig[dim2]) / spacing) + 2; + first.clear(); + first.resize(num1 * num2, -1); + + for (PxI32 i = 0; i < numTris; i++) + { + triBounds.setEmpty(); + triBounds.include(vertices[indices[3 * i]] - orig); + triBounds.include(vertices[indices[3 * i + 1]] - orig); + triBounds.include(vertices[indices[3 * i + 2]] - orig); + + PxI32 min1 = PxI32(triBounds.minimum[dim1] / spacing); + PxI32 min2 = PxI32(triBounds.minimum[dim2] / spacing); + PxI32 max1 = PxI32(triBounds.maximum[dim1] / spacing); + PxI32 max2 = PxI32(triBounds.maximum[dim2] / spacing); + for (PxI32 i1 = min1; i1 <= max1; i1++) + { + for (PxI32 i2 = min2; i2 <= max2; i2++) + { + PxI32 nr = i1 * num2 + i2; + next.pushBack(first[nr]); + first[nr] = PxI32(tris.size()); + tris.pushBack(i); + } + } + } + } + + // ------------------------------------------------------------------------ + PxI32 InsideTester::Grid2d::numInside(const PxVec3 &pos, const PxArray &vertices, const PxArray &indices) + { + if (first.empty()) + return 0; + + PxI32 dim1 = (dim0 + 1) % 3; + PxI32 dim2 = (dim0 + 2) % 3; + + PxReal r = 1e-5f; + PxVec3 p = pos; + + p[dim1] = pos[dim1] + rnd.rand(0.0f, r); + p[dim2] = pos[dim2] + rnd.rand(0.0f, r); + + PxI32 i1 = PxI32((p[dim1] - orig[dim1]) / spacing); + PxI32 i2 = PxI32((p[dim2] - orig[dim2]) / spacing); + if (i1 < 0 || i1 >= num1 || i2 < 0 || i2 >= num2) + return false; + + PxI32 count1 = 0; + PxI32 count2 = 0; + + PxI32 nr = first[i1 * num2 + i2]; + while (nr >= 0) + { + PxI32 triNr = tris[nr]; + nr = next[nr]; + + const PxVec3 &p0 = vertices[indices[3 * triNr]]; + const PxVec3 &p1 = vertices[indices[3 * triNr + 1]]; + const PxVec3 &p2 = vertices[indices[3 * triNr + 2]]; + + bool side0 = (p1 - p0).cross(p - p0)[dim0] > 0.0f; + bool side1 = (p2 - p1).cross(p - p1)[dim0] > 0.0f; + bool side2 = (p0 - p2).cross(p - p2)[dim0] > 0.0f; + if (side0 != side1 || side1 != side2) + continue; + + // ray triangle intersection + + PxVec3 n = (p1 - p0).cross(p2 - p0); + if (n[dim0] == 0.0f) + continue; + PxReal t = (p0 - p).dot(n) / n[dim0]; + if (t > 0.0f) + count1++; + else if (t < 0.0f) + count2++; + } + + PxI32 num = 0; + if ((count1 % 2) == 1) + num++; + if ((count2 % 2) == 1) + num++; + return num; + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.h new file mode 100644 index 0000000..be6a78f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtInsideTester.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef EXT_INSIDE_TESTER_H +#define EXT_INSIDE_TESTER_H + +// MM: tester whether a point is inside a triangle mesh +// all faces are projected onto the 3 canonical planes and hashed +// for fast ray mesh intersections + +#include "foundation/PxVec3.h" +#include "foundation/PxArray.h" +#include "foundation/PxQuat.h" +#include "CmRandom.h" + +namespace physx +{ + namespace Ext + { + + // ---------------------------------------------------------- + class InsideTester + { + public: + void init(const PxVec3 *vertices, PxI32 numVertices, const PxI32 *triIndices, PxI32 numTris); + bool isInside(const PxVec3& pos); + + private: + PxArray mVertices; + PxArray mIndices; + + struct Grid2d + { + void init(PxI32 dim0, const PxArray &vertices, const PxArray &indices); + PxI32 numInside(const PxVec3&pos, const PxArray &vertices, const PxArray &indices); + PxI32 dim0; + PxVec3 orig; + PxI32 num1, num2; + float spacing; + PxArray first; + PxArray tris; + PxArray next; + + Cm::RandomR250 rnd = Cm::RandomR250(0); + }; + Grid2d mGrids[3]; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMarchingCubesTable.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMarchingCubesTable.h new file mode 100644 index 0000000..07ea4de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMarchingCubesTable.h @@ -0,0 +1,174 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_MARCHING_CUBES_TABLE_H +#define EXT_MARCHING_CUBES_TABLE_H + +namespace physx +{ + namespace Ext + { + + // point numbering + + // 7-----------6 + // /| /| + // / | / | + // / | / | + // 4-----------5 | + // | | | | + // | 3-------|---2 + // | / | / + // | / | / + // |/ |/ + // 0-----------1 + + // edge numbering + + // *-----6-----* + // /| /| + // 7 | 5 | + // / 11 / 10 + // *-----4-----* | + // | | | | + // | *-----2-|---* + // 8 / 9 / + // | 3 | 1 + // |/ |/ + // *-----0-----* + + + // z + // | y + // | / + // |/ + // 0---- x + + int marchingCubeCorners[8][3] = { {0,0,0}, {1,0,0},{1,1,0},{0,1,0}, {0,0,1}, {1,0,1},{1,1,1},{0,1,1} }; + int marchingCubeEdges[12][2] = { {0,1},{1,2},{2,3},{3,0},{4,5},{5,6},{6,7},{7,4},{0,4},{1,5},{2,6},{3,7} }; + + int firstMarchingCubesId[257] = { + 0, 0, 3, 6, 12, 15, 21, 27, 36, 39, 45, 51, 60, 66, 75, 84, 90, 93, 99, 105, 114, + 120, 129, 138, 150, 156, 165, 174, 186, 195, 207, 219, 228, 231, 237, 243, 252, 258, 267, 276, 288, + 294, 303, 312, 324, 333, 345, 357, 366, 372, 381, 390, 396, 405, 417, 429, 438, 447, 459, 471, 480, + 492, 507, 522, 528, 531, 537, 543, 552, 558, 567, 576, 588, 594, 603, 612, 624, 633, 645, 657, 666, + 672, 681, 690, 702, 711, 723, 735, 750, 759, 771, 783, 798, 810, 825, 840, 852, 858, 867, 876, 888, + 897, 909, 915, 924, 933, 945, 957, 972, 984, 999, 1008, 1014, 1023, 1035, 1047, 1056, 1068, 1083, 1092, 1098, + 1110, 1125, 1140, 1152, 1167, 1173, 1185, 1188, 1191, 1197, 1203, 1212, 1218, 1227, 1236, 1248, 1254, 1263, 1272, 1284, + 1293, 1305, 1317, 1326, 1332, 1341, 1350, 1362, 1371, 1383, 1395, 1410, 1419, 1425, 1437, 1446, 1458, 1467, 1482, 1488, + 1494, 1503, 1512, 1524, 1533, 1545, 1557, 1572, 1581, 1593, 1605, 1620, 1632, 1647, 1662, 1674, 1683, 1695, 1707, 1716, + 1728, 1743, 1758, 1770, 1782, 1791, 1806, 1812, 1827, 1839, 1845, 1848, 1854, 1863, 1872, 1884, 1893, 1905, 1917, 1932, + 1941, 1953, 1965, 1980, 1986, 1995, 2004, 2010, 2019, 2031, 2043, 2058, 2070, 2085, 2100, 2106, 2118, 2127, 2142, 2154, + 2163, 2169, 2181, 2184, 2193, 2205, 2217, 2232, 2244, 2259, 2268, 2280, 2292, 2307, 2322, 2328, 2337, 2349, 2355, 2358, + 2364, 2373, 2382, 2388, 2397, 2409, 2415, 2418, 2427, 2433, 2445, 2448, 2454, 2457, 2460, 2460 }; + + int marchingCubesIds[2460] = { + 0, 8, 3, 0, 1, 9, 1, 8, 3, 9, 8, 1, 1, 2, 10, 0, 8, 3, 1, 2, 10, 9, 2, 10, 0, 2, 9, 2, 8, 3, 2, + 10, 8, 10, 9, 8, 3, 11, 2, 0, 11, 2, 8, 11, 0, 1, 9, 0, 2, 3, 11, 1, 11, 2, 1, 9, 11, 9, 8, 11, 3, + 10, 1, 11, 10, 3, 0, 10, 1, 0, 8, 10, 8, 11, 10, 3, 9, 0, 3, 11, 9, 11, 10, 9, 9, 8, 10, 10, 8, 11, 4, + 7, 8, 4, 3, 0, 7, 3, 4, 0, 1, 9, 8, 4, 7, 4, 1, 9, 4, 7, 1, 7, 3, 1, 1, 2, 10, 8, 4, 7, 3, + 4, 7, 3, 0, 4, 1, 2, 10, 9, 2, 10, 9, 0, 2, 8, 4, 7, 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, 8, + 4, 7, 3, 11, 2, 11, 4, 7, 11, 2, 4, 2, 0, 4, 9, 0, 1, 8, 4, 7, 2, 3, 11, 4, 7, 11, 9, 4, 11, 9, + 11, 2, 9, 2, 1, 3, 10, 1, 3, 11, 10, 7, 8, 4, 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, 4, 7, 8, 9, + 0, 11, 9, 11, 10, 11, 0, 3, 4, 7, 11, 4, 11, 9, 9, 11, 10, 9, 5, 4, 9, 5, 4, 0, 8, 3, 0, 5, 4, 1, + 5, 0, 8, 5, 4, 8, 3, 5, 3, 1, 5, 1, 2, 10, 9, 5, 4, 3, 0, 8, 1, 2, 10, 4, 9, 5, 5, 2, 10, 5, + 4, 2, 4, 0, 2, 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, 9, 5, 4, 2, 3, 11, 0, 11, 2, 0, 8, 11, 4, + 9, 5, 0, 5, 4, 0, 1, 5, 2, 3, 11, 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, 10, 3, 11, 10, 1, 3, 9, + 5, 4, 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, 5, 4, 8, 5, + 8, 10, 10, 8, 11, 9, 7, 8, 5, 7, 9, 9, 3, 0, 9, 5, 3, 5, 7, 3, 0, 7, 8, 0, 1, 7, 1, 5, 7, 1, + 5, 3, 3, 5, 7, 9, 7, 8, 9, 5, 7, 10, 1, 2, 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, 8, 0, 2, 8, + 2, 5, 8, 5, 7, 10, 5, 2, 2, 10, 5, 2, 5, 3, 3, 5, 7, 7, 9, 5, 7, 8, 9, 3, 11, 2, 9, 5, 7, 9, + 7, 2, 9, 2, 0, 2, 7, 11, 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, 11, 2, 1, 11, 1, 7, 7, 1, 5, 9, + 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, 11, 10, 0, 11, + 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, 11, 10, 5, 7, 11, 5, 10, 6, 5, 0, 8, 3, 5, 10, 6, 9, 0, 1, 5, + 10, 6, 1, 8, 3, 1, 9, 8, 5, 10, 6, 1, 6, 5, 2, 6, 1, 1, 6, 5, 1, 2, 6, 3, 0, 8, 9, 6, 5, 9, + 0, 6, 0, 2, 6, 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, 2, 3, 11, 10, 6, 5, 11, 0, 8, 11, 2, 0, 10, + 6, 5, 0, 1, 9, 2, 3, 11, 5, 10, 6, 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, 6, 3, 11, 6, 5, 3, 5, + 1, 3, 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, 6, 5, 9, 6, + 9, 11, 11, 9, 8, 5, 10, 6, 4, 7, 8, 4, 3, 0, 4, 7, 3, 6, 5, 10, 1, 9, 0, 5, 10, 6, 8, 4, 7, 10, + 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, 6, 1, 2, 6, 5, 1, 4, 7, 8, 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, + 4, 7, 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, 3, + 11, 2, 7, 8, 4, 10, 6, 5, 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, + 10, 6, 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, 5, + 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, 6, + 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, 10, 4, 9, 6, 4, 10, 4, 10, 6, 4, 9, 10, 0, 8, 3, 10, 0, 1, 10, + 6, 0, 6, 4, 0, 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, 1, 4, 9, 1, 2, 4, 2, 6, 4, 3, 0, 8, 1, + 2, 9, 2, 4, 9, 2, 6, 4, 0, 2, 4, 4, 2, 6, 8, 3, 2, 8, 2, 4, 4, 2, 6, 10, 4, 9, 10, 6, 4, 11, + 2, 3, 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, 6, 4, 1, 6, + 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, 8, 11, 1, 8, 1, 0, 11, + 6, 1, 9, 1, 4, 6, 4, 1, 3, 11, 6, 3, 6, 0, 0, 6, 4, 6, 4, 8, 11, 6, 8, 7, 10, 6, 7, 8, 10, 8, + 9, 10, 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, 10, 6, 7, 10, + 7, 1, 1, 7, 3, 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, + 3, 9, 7, 8, 0, 7, 0, 6, 6, 0, 2, 7, 3, 2, 6, 7, 2, 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, 2, + 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, 11, + 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, 0, 9, 1, 11, + 6, 7, 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, 7, 11, 6, 7, 6, 11, 3, 0, 8, 11, 7, 6, 0, 1, 9, 11, + 7, 6, 8, 1, 9, 8, 3, 1, 11, 7, 6, 10, 1, 2, 6, 11, 7, 1, 2, 10, 3, 0, 8, 6, 11, 7, 2, 9, 0, 2, + 10, 9, 6, 11, 7, 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, 7, 2, 3, 6, 2, 7, 7, 0, 8, 7, 6, 0, 6, + 2, 0, 2, 7, 6, 2, 3, 7, 0, 1, 9, 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, 10, 7, 6, 10, 1, 7, 1, + 3, 7, 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, 7, 6, 10, 7, + 10, 8, 8, 10, 9, 6, 8, 4, 11, 8, 6, 3, 6, 11, 3, 0, 6, 0, 4, 6, 8, 6, 11, 8, 4, 6, 9, 0, 1, 9, + 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, 6, 8, 4, 6, 11, 8, 2, 10, 1, 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, + 4, 6, 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, 8, + 2, 3, 8, 4, 2, 4, 6, 2, 0, 4, 2, 4, 6, 2, 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, 1, 9, 4, 1, + 4, 2, 2, 4, 6, 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, 10, 1, 0, 10, 0, 6, 6, 0, 4, 4, 6, 3, 4, + 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, 10, 9, 4, 6, 10, 4, 4, 9, 5, 7, 6, 11, 0, 8, 3, 4, 9, 5, 11, + 7, 6, 5, 0, 1, 5, 4, 0, 7, 6, 11, 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, 9, 5, 4, 10, 1, 2, 7, + 6, 11, 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, 3, 4, 8, 3, + 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, 7, 2, 3, 7, 6, 2, 5, 4, 9, 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, + 8, 7, 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, 9, + 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, 4, 0, 10, 4, + 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, 6, 9, 5, 6, 11, 9, 11, + 8, 9, 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, 6, 11, 3, 6, + 3, 5, 5, 3, 1, 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, + 2, 10, 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, 5, + 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, 9, 5, 6, 9, 6, 0, 0, 6, 2, 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, + 8, 2, 6, 2, 8, 1, 5, 6, 2, 1, 6, 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, 10, 1, 0, 10, + 0, 6, 9, 5, 0, 5, 6, 0, 0, 3, 8, 5, 6, 10, 10, 5, 6, 11, 5, 10, 7, 5, 11, 11, 5, 10, 11, 7, 5, 8, + 3, 0, 5, 11, 7, 5, 10, 11, 1, 9, 0, 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, 11, 1, 2, 11, 7, 1, 7, + 5, 1, 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, 7, 5, 2, 7, + 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, 2, 5, 10, 2, 3, 5, 3, 7, 5, 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, + 2, 5, 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, 1, + 3, 5, 3, 7, 5, 0, 8, 7, 0, 7, 1, 1, 7, 5, 9, 0, 3, 9, 3, 5, 5, 3, 7, 9, 8, 7, 5, 9, 7, 5, + 8, 4, 5, 10, 8, 10, 11, 8, 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, + 4, 5, 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, 0, + 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, 9, + 4, 5, 2, 11, 3, 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, 5, 10, 2, 5, 2, 4, 4, 2, 0, 3, 10, 2, 3, + 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, 8, 4, 5, 8, 5, 3, 3, + 5, 1, 0, 4, 5, 1, 0, 5, 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, 9, 4, 5, 4, 11, 7, 4, 9, 11, 9, + 10, 11, 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, 3, 1, 4, 3, + 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, 9, 7, 4, 9, 11, 7, 9, + 1, 11, 2, 11, 1, 0, 8, 3, 11, 7, 4, 11, 4, 2, 2, 4, 0, 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, 2, + 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, 3, 7, 10, 3, + 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, 1, 10, 2, 8, 7, 4, 4, 9, 1, 4, 1, 7, 7, 1, 3, 4, 9, 1, 4, + 1, 7, 0, 8, 1, 8, 7, 1, 4, 0, 3, 7, 4, 3, 4, 8, 7, 9, 10, 8, 10, 11, 8, 3, 0, 9, 3, 9, 11, 11, + 9, 10, 0, 1, 10, 0, 10, 8, 8, 10, 11, 3, 1, 10, 11, 3, 10, 1, 2, 11, 1, 11, 9, 9, 11, 8, 3, 0, 9, 3, + 9, 11, 1, 2, 9, 2, 11, 9, 0, 2, 11, 8, 0, 11, 3, 2, 11, 2, 3, 8, 2, 8, 10, 10, 8, 9, 9, 10, 2, 0, + 9, 2, 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, 1, 10, 2, 1, 3, 8, 9, 1, 8, 0, 9, 1, 0, 3, 8 }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp new file mode 100644 index 0000000..930db67 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.cpp @@ -0,0 +1,679 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtMeshSimplificator.h" +#include "foundation/PxSort.h" + +namespace physx +{ + namespace Ext + { + + // ------------------------------------------------------------------------------------- + MeshSimplificator::MeshSimplificator() + { + currentVertMark = 0; + numMeshTris = 0; + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::findTriNeighbors() + { + PxI32 numTris = PxI32(triIds.size()) / 3; + triNeighbors.clear(); + triNeighbors.resize(3 * numTris, -1); + + struct Edge + { + PX_FORCE_INLINE void init(PxI32 _id0, PxI32 _id1, PxI32 _triNr, PxI32 _edgeNr) + { + this->id0 = PxMin(_id0, _id1); + this->id1 = PxMax(_id0, _id1); + this->triNr = _triNr; + this->edgeNr = _edgeNr; + } + PX_FORCE_INLINE bool operator < (const Edge& e) const + { + return (id0 < e.id0 || (id0 == e.id0 && id1 < e.id1)); + } + PX_FORCE_INLINE bool operator == (const Edge& e) const + { + return id0 == e.id0 && id1 == e.id1; + } + PxI32 id0, id1, triNr, edgeNr; + }; + + PxArray edges(PxI32(triIds.size())); + + for (PxI32 i = 0; i < numTris; i++) + { + for (PxI32 j = 0; j < 3; j++) + { + PxI32 id0 = triIds[3 * i + j]; + PxI32 id1 = triIds[3 * i + (j + 1) % 3]; + edges[3 * i + j].init(id0, id1, i, j); + } + } + PxSort(edges.begin(), edges.size()); + + PxI32 nr = 0; + while (nr < PxI32(edges.size())) + { + Edge& e0 = edges[nr]; + nr++; + while (nr < PxI32(edges.size()) && edges[nr] == e0) + { + Edge& e1 = edges[nr]; + triNeighbors[3 * e0.triNr + e0.edgeNr] = e1.triNr; + triNeighbors[3 * e1.triNr + e1.edgeNr] = e0.triNr; + nr++; + } + } + } + + + // ------------------------------------------------------------------------------------- + bool MeshSimplificator::getAdjTris(PxI32 triNr, PxI32 vertNr, PxI32& valence, bool& open, PxArray* tris) const + { + open = false; + + if (tris) + tris->clear(); + + PxI32 cnt = 0; + valence = 0; + PxI32 nr = triNr; + + // counter clock + do + { + if (tris) + tris->pushBack(nr); + valence++; + if (triIds[3 * nr] == vertNr) + nr = triNeighbors[3 * nr + 2]; + else if (triIds[3 * nr + 1] == vertNr) + nr = triNeighbors[3 * nr]; + else + nr = triNeighbors[3 * nr + 1]; + cnt++; + } + while (nr >= 0 && nr != triNr && cnt < 100); + + if (cnt >= 100) + { + valence = 0; + return false; + } + + cnt = 0; + + if (nr < 0) + { // open: search clockwise too + open = true; + nr = triNr; + do + { + if (nr != triNr) + { + if (tris) + tris->pushBack(nr); + valence++; + } + if (triIds[3 * nr] == vertNr) + nr = triNeighbors[3 * nr]; + else if (triIds[3 * nr + 1] == vertNr) + nr = triNeighbors[3 * nr + 1]; + else + nr = triNeighbors[3 * nr + 2]; + cnt++; + } + while (nr >= 0 && nr != triNr && cnt < 100); + + valence++; // num tris + 1 if open + + if (cnt > 100) + { + valence = 0; + return false; + } + } + + return true; + } + + // ------------------------------------------------------------------------------------- + bool MeshSimplificator::getAdjTris(PxI32 triNr, PxI32 vertNr, PxArray& tris) const + { + PxI32 valence; + bool open; + return getAdjTris(triNr, vertNr, valence, open, &tris); + + } + + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::replaceNeighbor(PxI32 triNr, PxI32 oldNeighbor, PxI32 newNeighbor) + { + if (triNr < 0) + return; + for (PxI32 i = 0; i < 3; i++) + { + if (triNeighbors[3 * triNr + i] == oldNeighbor) + triNeighbors[3 * triNr + i] = newNeighbor; + } + } + + // ------------------------------------------------------------------------------------- + PxI32 MeshSimplificator::getEdgeId(PxI32 triNr, PxI32 edgeNr) + { + PxI32 n = triNeighbors[3 * triNr + edgeNr]; + if (n < 0 || triNr < n) + return 3 * triNr + edgeNr; + else + { + for (PxI32 i = 0; i < 3; i++) + { + if (triNeighbors[3 * n + i] == triNr) + return 3 * n + i; + } + } + return 0; + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::evalEdgeCost(PxI32 triNr, PxI32 edgeNr, PxReal &cost, PxReal &ratio) + { + const PxI32 numSteps = 10; + ratio = -1.0f; + cost = -1.0f; + PxI32 id0 = triIds[3 * triNr + edgeNr]; + PxI32 id1 = triIds[3 * triNr + (edgeNr + 1) % 3]; + + PxReal minCost = FLT_MAX; + PxReal maxCost = -FLT_MAX; + + Quadric q; q = quadrics[id0] + quadrics[id1]; + PxVec3 pos; + + PxReal edgeLength = (vertices[id0] - vertices[id1]).magnitude(); + + for (PxI32 i = 0; i <= numSteps; i++) + { + float r = 1.0f / numSteps * i; + pos = vertices[id0] * (1.0f - r) + vertices[id1] * r; + float c = q.outerProduct(pos); + c += edgeLengthCostWeight * edgeLength; + if (cost < 0.0f || c < cost) + { + cost = c; ratio = r; + } + if (cost > maxCost) + maxCost = cost; + if (cost < minCost) + minCost = cost; + } + + if (maxCost - minCost < flatnessDetectionThreshold) + { + float r = 0.5f; + pos = vertices[id0] * (1.0f - r) + vertices[id1] * r; + cost = q.outerProduct(pos) + edgeLengthCostWeight * edgeLength; + ratio = r; + } + } + + // ------------------------------------------------------------------------------------- + bool MeshSimplificator::collapseEdge(PxI32 triNr, PxI32 edgeNr) + { + if (triIds[3 * triNr] == triIds[3 * triNr + 1]) // the triangle deleted + return false; + + PxI32 id0 = triIds[3 * triNr + edgeNr]; + PxI32 id1 = triIds[3 * triNr + (edgeNr + 1) % 3]; + PxI32 id2 = triIds[3 * triNr + (edgeNr + 2) % 3]; + PxI32 id3 = -1; + + PxI32 n = triNeighbors[3 * triNr + edgeNr]; + PxI32 nEdgeNr = 0; + if (n >= 0) + { + if (triNeighbors[3 * n] == triNr) nEdgeNr = 0; + else if (triNeighbors[3 * n + 1] == triNr) nEdgeNr = 1; + else if (triNeighbors[3 * n + 2] == triNr) nEdgeNr = 2; + id3 = triIds[3 * n + (nEdgeNr + 2) % 3]; + } + + // not legal if there exists id != id0,id1 with (id0,id) and (id1,id) edges + // but (id,id0,id1) is not a triangle + + bool OK = getAdjTris(triNr, id0, adjTris); + currentVertMark++; + for (PxI32 i = 0; i < PxI32(adjTris.size()); i++) + { + PxI32 adj = adjTris[i]; + for (PxI32 j = 0; j < 3; j++) + vertMarks[triIds[3 * adj + j]] = currentVertMark; + } + OK = OK && getAdjTris(triNr, id1, adjTris); + if (!OK) + return false; + for (PxI32 i = 0; i < PxI32(adjTris.size()); i++) + { + PxI32 adj = adjTris[i]; + for (PxI32 j = 0; j < 3; j++) + { + PxI32 id = triIds[3 * adj + j]; + if (vertMarks[id] == currentVertMark && + id != id0 && id != id1 && id != id2 && id != id3) + return false; + } + } + + // new center pos + + float cost, ratio; + evalEdgeCost(triNr, edgeNr, cost, ratio); + PxVec3 newPos = vertices[id0] * (1.0f - ratio) + vertices[id1] * ratio; + + // any triangle flips? + + for (PxI32 side = 0; side < 2; side++) + { + getAdjTris(triNr, side == 0 ? id0 : id1, adjTris); + PxI32 other = side == 0 ? id1 : id0; + for (PxU32 i = 0; i < adjTris.size(); i++) + { + PxI32 adj = adjTris[i]; + PxVec3 p[3], q[3]; + bool deleted = false; + for (PxI32 j = 0; j < 3; j++) + { + PxI32 id = triIds[3 * adj + j]; + if (id == other) + deleted = true; + p[j] = vertices[id]; + q[j] = (id == id0 || id == id1) ? newPos : p[j]; + } + if (!deleted) + { + PxVec3 n0 = (p[1] - p[0]).cross(p[2] - p[0]); + PxVec3 n1 = (q[1] - q[0]).cross(q[2] - q[0]); + if (n0.dot(n1) <= 0.0f) + return false; + } + } + } + + // remove adjacent edges from heap + + for (PxI32 side = 0; side < 2; side++) + { + PxI32 id = side == 0 ? id0 : id1; + getAdjTris(triNr, id, adjTris); + for (PxU32 i = 0; i < adjTris.size(); i++) + { + PxI32 adj = adjTris[i]; + for (PxI32 j = 0; j < 3; j++) + { + PxI32 adj0 = triIds[3 * adj + j]; + PxI32 adj1 = triIds[3 * adj + (j + 1) % 3]; + if (adj0 == id0 || adj0 == id1 || adj1 == id0 || adj1 == id1) + { + PxI32 edgeId = getEdgeId(adj, j); + heap.remove(edgeId); + } + } + } + } + + // move vertex + + if (id0 > id1) { + int id = id0; id0 = id1; id1 = id; + } + + vertices[id0] = newPos; + quadrics[id0] += quadrics[id1]; + + // collapse edge + + getAdjTris(triNr, id1, adjTris); + + for (PxU32 i = 0; i < adjTris.size(); i++) + { + PxI32 adj = adjTris[i]; + for (PxI32 j = 0; j < 3; j++) { + PxI32& id = triIds[3 * adj + j]; + if (id == id1) + id = id0; + } + } + + simplificationMap[id1] = id0; + + // mark triangles as deleted (duplicate indices, can still be rendered) + + triIds[3 * triNr + 2] = triIds[3 * triNr + 1] = triIds[3 * triNr]; + numMeshTris--; + if (n >= 0) + { + triIds[3 * n + 2] = triIds[3 * n + 1] = triIds[3 * n]; + numMeshTris--; + } + + // update neighbors + + PxI32 right = triNeighbors[3 * triNr + (edgeNr + 1) % 3]; + PxI32 left = triNeighbors[3 * triNr + (edgeNr + 2) % 3]; + replaceNeighbor(right, triNr, left); + replaceNeighbor(left, triNr, right); + PxI32 startTriNr = PxMax(right, left); + + if (n >= 0) + { + right = triNeighbors[3 * n + (nEdgeNr + 1) % 3]; + left = triNeighbors[3 * n + (nEdgeNr + 2) % 3]; + replaceNeighbor(right, n, left); + replaceNeighbor(left, n, right); + startTriNr = PxMax(startTriNr, PxMax(right, left)); + } + + // add new edges to heap + + if (startTriNr >= 0) + { + getAdjTris(startTriNr, id0, adjTris); + for (PxU32 i = 0; i < adjTris.size(); i++) + { + PxI32 adj = adjTris[i]; + for (PxI32 j = 0; j < 3; j++) + { + PxI32 adj0 = triIds[3 * adj + j]; + PxI32 adj1 = triIds[3 * adj + (j + 1) % 3]; + if (adj0 == id0 || adj1 == id0) + { + evalEdgeCost(adj, j, cost, ratio); + PxI32 id = getEdgeId(adj, j); + + heap.insert(HeapElem(adj, j, cost), id); + } + } + } + } + return true; + } + +#if PX_LINUX +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmisleading-indentation" +#endif + + + void minMax(const PxArray& points, PxVec3& min, PxVec3& max) + { + min = PxVec3(FLT_MAX, FLT_MAX, FLT_MAX); + max = PxVec3(-FLT_MAX, -FLT_MAX, -FLT_MAX); + + for (PxU32 i = 0; i < points.size(); ++i) + { + const PxVec3& p = points[i]; + if (p.x > max.x) max.x = p.x; if (p.y > max.y) max.y = p.y; if (p.z > max.z) max.z = p.z; + if (p.x < min.x) min.x = p.x; if (p.y < min.y) min.y = p.y; if (p.z < min.z) min.z = p.z; + } + } + +#if PX_LINUX +#pragma GCC diagnostic pop +#endif + + void MeshSimplificator::transformPointsToUnitBox(PxArray& points) + { + PxVec3 min, max; + minMax(points, min, max); + origin = min; + PxVec3 size = max - min; + + scaling = 1.0f / PxMax(PxMax(1e-6f, size.x), PxMax(size.y, size.z)); + + for (PxU32 i = 0; i < points.size(); ++i) + points[i] = (points[i] - min) * scaling; + } + + void MeshSimplificator::transformPointsToOriginalPosition(PxArray& points) + { + PxReal s = 1.0f / scaling; + for (PxU32 i = 0; i < points.size(); ++i) + points[i] = points[i] * s + origin; + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::init(const PxSimpleTriangleMesh& inputMesh, PxReal edgeLengthCostWeight_, PxReal flatnessDetectionThreshold_) + { + edgeLengthCostWeight = edgeLengthCostWeight_; + flatnessDetectionThreshold = flatnessDetectionThreshold_; + + vertices.resize(inputMesh.points.count); + for (PxU32 i = 0; i < inputMesh.points.count; i++) + vertices[i] = inputMesh.points.at(i); + + transformPointsToUnitBox(vertices); + + PxI32 numIndices = 3 * inputMesh.triangles.count; + triIds.resize(numIndices); + + if (inputMesh.flags & PxMeshFlag::e16_BIT_INDICES) + { + for (PxI32 i = 0; i < numIndices; i++) + triIds[i] = PxI32(inputMesh.triangles.at(i)); + } + else + { + for (PxI32 i = 0; i < numIndices; i++) + triIds[i] = PxI32(inputMesh.triangles.at(i)); + } + + init(); + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::init(const PxArray &inputVertices, const PxArray &inputTriIds, PxReal edgeLengthCostWeight_, PxReal flatnessDetectionThreshold_) + { + edgeLengthCostWeight = edgeLengthCostWeight_; + flatnessDetectionThreshold = flatnessDetectionThreshold_; + + vertices = inputVertices; + + transformPointsToUnitBox(vertices); + + triIds.resize(inputTriIds.size()); + for (PxU32 i = 0; i < inputTriIds.size(); i++) + triIds[i] = PxI32(inputTriIds[i]); + + init(); + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::init() + { + vertMarks.clear(); + vertMarks.resize(vertices.size(), 0); + currentVertMark = 0; + + findTriNeighbors(); + + // init vertex quadrics + + quadrics.resize(vertices.size()); + for (PxU32 i = 0; i < vertices.size(); i++) + quadrics[i].zero(); + + Quadric q; + + PxI32 numTris = PxI32(triIds.size()) / 3; + + for (PxI32 i = 0; i < numTris; i++) + { + PxI32 id0 = triIds[3 * i]; + PxI32 id1 = triIds[3 * i + 1]; + PxI32 id2 = triIds[3 * i + 2]; + q.setFromPlane(vertices[id0], vertices[id1], vertices[id2]); + quadrics[id0] += q; + quadrics[id1] += q; + quadrics[id2] += q; + } + + // init heap + + heap.clear(); + + for (PxI32 i = 0; i < numTris; i++) + { + for (PxI32 j = 0; j < 3; j++) + { + PxI32 n = triNeighbors[3 * i + j]; + if (n < 0 || i < n) { + + float cost, ratio; + evalEdgeCost(i, j, cost, ratio); + heap.insert(HeapElem(i, j, cost), getEdgeId(i, j)); + } + } + } + numMeshTris = numTris; + + // init simplification map + + simplificationMap.resize(vertices.size()); + for (PxI32 i = 0; i < PxI32(vertices.size()); i++) + simplificationMap[i] = i; // each vertex is a root + } + + // ------------------------------------------------------------------------------------- + bool MeshSimplificator::step(PxF32 maximalEdgeLength) + { + int heapMinSize = 20; + + if (heap.size() < heapMinSize) + return false; + + while (heap.size() > heapMinSize) + { + HeapElem e = heap.deleteMin(); + + PxI32 id0 = triIds[3 * e.triNr + e.edgeNr]; + PxI32 id1 = triIds[3 * e.triNr + (e.edgeNr + 1) % 3]; + PxF32 length = (vertices[id0] - vertices[id1]).magnitude(); + if (maximalEdgeLength == 0.0f || length < maximalEdgeLength) + { + collapseEdge(e.triNr, e.edgeNr); + return true; + } + } + return false; + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::decimateByRatio(PxF32 relativeOutputMeshSize, PxF32 maximalEdgeLength) + { + relativeOutputMeshSize = PxClamp(relativeOutputMeshSize, 0.1f, 0.99f); + PxI32 numSteps = PxI32(PxFloor(PxF32(heap.size()) * (1.0f - relativeOutputMeshSize))); + for (PxI32 i = 0; i < numSteps; i++) + { + if (!step(maximalEdgeLength)) + break; + } + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::decimateBySize(PxI32 targetTriangleCount, PxF32 maximalEdgeLength) + { + while (numMeshTris > targetTriangleCount) + { + if (!step(maximalEdgeLength)) + break; + } + } + + // ------------------------------------------------------------------------------------- + void MeshSimplificator::readBack(PxArray& outVertices, PxArray& outTriIds, PxArray *vertexMap) + { + outVertices.clear(); + outTriIds.clear(); + PxArray idMap(vertices.size(), -1); + + PxI32 numTris = PxI32(triIds.size()) / 3; + + for (PxI32 i = 0; i < numTris; i++) + { + if (triIds[3 * i] == triIds[3 * i + 1]) // deleted + continue; + + for (PxI32 j = 0; j < 3; j++) + { + PxI32 id = triIds[3 * i + j]; + if (idMap[id] < 0) + { + idMap[id] = outVertices.size(); + outVertices.pushBack(vertices[id]); + } + outTriIds.pushBack(PxU32(idMap[id])); + } + } + + transformPointsToOriginalPosition(outVertices); + + if (vertexMap) + { + for (PxU32 i = 0; i < simplificationMap.size(); ++i) + { + PxI32 id = i; + while (id != simplificationMap[id]) + { + id = simplificationMap[id]; + } + const PxI32 finalLink = id; + id = i; + simplificationMap[i] = finalLink; + while (id != simplificationMap[id]) + { + PxI32 oldId = id; + id = simplificationMap[id]; + simplificationMap[oldId] = finalLink; + } + } + + vertexMap->resize(vertices.size()); + for (PxU32 i = 0; i < simplificationMap.size(); ++i) + { + PxI32 mapped = idMap[simplificationMap[i]]; + (*vertexMap)[i] = mapped; + } + } + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.h new file mode 100644 index 0000000..c397c40 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMeshSimplificator.h @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_MESH_SIMPLIFICATOR_H +#define EXT_MESH_SIMPLIFICATOR_H + + +#include "foundation/PxBounds3.h" +#include "foundation/PxArray.h" +#include "geometry/PxSimpleTriangleMesh.h" + +#include "ExtQuadric.h" +#include "ExtRandomAccessHeap.h" + +// ------------------------------------------------------------------------------ + +// MM: implementation of paper Garland and Heckbert: "Surface Simplification Using Quadric Error Metrics" + +namespace physx +{ + namespace Ext + { + + class MeshSimplificator + { + public: + + MeshSimplificator(); + + void init(const PxSimpleTriangleMesh& inputMesh, PxReal edgeLengthCostWeight_ = 1e-1f, PxReal flatnessDetectionThreshold_ = 1e-2f); + void init(const PxArray &vertices, const PxArray &triIds, PxReal edgeLengthCostWeight_ = 1e-1f, PxReal flatnessDetectionThreshold_ = 1e-2f); + void decimateByRatio(PxF32 relativeOutputMeshSize = 0.5f, PxF32 maximalEdgeLength = 0.0f); + void decimateBySize(PxI32 targetTriangleCount, PxF32 maximalEdgeLength = 0.0f); + void readBack(PxArray& vertices, PxArray& triIds, PxArray *vertexMap = NULL); + + private: + PxArray vertices; + PxArray triIds; + + void init(); + bool step(PxF32 maximalEdgeLength); + bool getAdjTris(PxI32 triNr, PxI32 vertNr, PxI32& valence, bool& open, + PxArray* tris) const; + bool getAdjTris(PxI32 triNr, PxI32 vertNr, PxArray& tris) const; + + void replaceNeighbor(PxI32 triNr, PxI32 oldNeighbor, PxI32 newNeighbor); + PxI32 getEdgeId(PxI32 triNr, PxI32 edgeNr); + bool collapseEdge(PxI32 triNr, PxI32 edgeNr); + void evalEdgeCost(PxI32 triNr, PxI32 edgeNr, float& cost, float& ratio); + void findTriNeighbors(); + + void transformPointsToUnitBox(PxArray& points); + void transformPointsToOriginalPosition(PxArray& points); + + PxI32 numMeshTris; + + PxArray quadrics; + PxArray vertMarks; + PxArray adjTris; + PxI32 currentVertMark; + PxArray triNeighbors; + + //Scale input points into 0...1 unit-box + PxReal scaling; + PxVec3 origin; + + PxReal edgeLengthCostWeight; + PxReal flatnessDetectionThreshold; + + PxArray simplificationMap; + + struct HeapElem + { + HeapElem() : triNr(0), edgeNr(0), cost(0.0f) {} + HeapElem(PxI32 triNr_, PxI32 edgeNr_, float cost_) : + triNr(triNr_), edgeNr(edgeNr_), cost(cost_) {} + + PxI32 triNr, edgeNr; + float cost; + + PX_FORCE_INLINE bool operator < (const HeapElem& e) const + { + return cost < e.cost; + } + }; + + RandomAccessHeap heap; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMultiList.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMultiList.h new file mode 100644 index 0000000..c990fd7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtMultiList.h @@ -0,0 +1,276 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef EXT_MULTI_LIST_H +#define EXT_MULTI_LIST_H + +// MM: Multiple linked lists in a common array with a free list + +#include "foundation/PxArray.h" + +namespace physx +{ + namespace Ext + { + + //----------------------------------------------------------------------------- + template + class MultiList { + public: + MultiList(PxI32 maxId = 0) { + firstFree = -1; + if (maxId > 0) + first.reserve(maxId + 1); + } + void reserve(int maxId) { + first.reserve(maxId + 1); + } + void clear(); + PxI32 add(PxI32 id, const T &item); + bool addUnique(PxI32 id, const T &item); + bool exists(PxI32 id, const T &item) const; + void remove(PxI32 id, const T &item); + void removeAll(PxI32 id); + PxI32 size(PxI32 id) const; + PxI32 getPairNr(PxI32 id, const T &item) const; + + void replace(PxI32 id, const T &before, const T &after); + + void getItems(PxI32 id) const; + mutable PxArray queryItems; + + void initIteration(PxI32 id, PxI32& iterator); + bool iterate(T& item, PxI32& iterator); + + void getPointers(PxI32 id); + mutable PxArray queryPointers; + + private: + PxArray first; + PxArray items; + PxArray next; + PxI32 firstFree; + }; + + //----------------------------------------------------------------------------- + template + void MultiList::clear() + { + first.clear(); + next.clear(); + items.clear(); + queryItems.clear(); + queryPointers.clear(); + firstFree = -1; + } + + //----------------------------------------------------------------------------- + template + PxI32 MultiList::add(PxI32 id, const T &item) + { + if (id >= PxI32(first.size())) + first.resize(id + 1, -1); + PxI32 pos = firstFree; + if (pos >= 0) + firstFree = next[firstFree]; + else + { + pos = PxI32(items.size()); + items.resize(items.size() + 1); + next.resize(items.size() + 1); + } + next[pos] = first[id]; + first[id] = pos; + items[pos] = item; + return pos; + } + + //----------------------------------------------------------------------------- + template + bool MultiList::addUnique(PxI32 id, const T &item) + { + if (exists(id, item)) + return false; + add(id, item); + return true; + } + + //----------------------------------------------------------------------------- + template + bool MultiList::exists(PxI32 id, const T &item) const + { + return getPairNr(id, item) >= 0; + } + + //----------------------------------------------------------------------------- + template + PxI32 MultiList::size(PxI32 id) const + { + if (id >= PxI32(first.size())) + return 0; + + PxI32 num = 0; + PxI32 nr = first[id]; + while (nr >= 0) + { + num++; + nr = next[nr]; + } + return num; + } + + //----------------------------------------------------------------------------- + template + PxI32 MultiList::getPairNr(PxI32 id, const T &item) const + { + if (id < 0 || id >= PxI32(first.size())) + return -1; + PxI32 nr = first[id]; + while (nr >= 0) + { + if (items[nr] == item) + return nr; + nr = next[nr]; + } + return -1; + } + + //----------------------------------------------------------------------------- + template + void MultiList::remove(PxI32 id, const T &itemNr) + { + PxI32 nr = first[id]; + PxI32 prev = -1; + while (nr >= 0 && items[nr] != itemNr) + { + prev = nr; + nr = next[nr]; + } + if (nr < 0) + return; + if (prev >= 0) + next[prev] = next[nr]; + else + first[id] = next[nr]; + next[nr] = firstFree; + firstFree = nr; + } + + //----------------------------------------------------------------------------- + template + void MultiList::replace(PxI32 id, const T &before, const T &after) + { + PxI32 nr = first[id]; + while (nr >= 0) + { + if (items[nr] == before) + items[nr] = after; + nr = next[nr]; + } + } + + //----------------------------------------------------------------------------- + template + void MultiList::removeAll(PxI32 id) + { + if (id >= PxI32(first.size())) + return; + + PxI32 nr = first[id]; + if (nr < 0) + return; + + PxI32 prev = -1; + while (nr >= 0) + { + prev = nr; + nr = next[nr]; + } + next[prev] = firstFree; + firstFree = first[id]; + first[id] = -1; + } + + //----------------------------------------------------------------------------- + template + void MultiList::getItems(PxI32 id) const + { + queryItems.clear(); + if (id >= PxI32(first.size())) + return; + PxI32 nr = first[id]; + while (nr >= 0) + { + queryItems.push_back(items[nr]); + nr = next[nr]; + } + } + + //----------------------------------------------------------------------------- + template + void MultiList::initIteration(PxI32 id, PxI32& iterator) + { + if (id >= PxI32(first.size())) + iterator = -1; + else + iterator = first[id]; + } + + //----------------------------------------------------------------------------- + template + bool MultiList::iterate(T& item, PxI32& iterator) + { + if (iterator >= 0) + { + item = items[iterator]; + iterator = next[iterator]; + return true; + } + return false; + } + + //----------------------------------------------------------------------------- + template + void MultiList::getPointers(PxI32 id) + { + queryPointers.clear(); + if (id >= PxI32(first.size())) + return; + PxI32 nr = first[id]; + while (nr >= 0) + { + queryPointers.push_back(&items[nr]); + nr = next[nr]; + } + } + + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp new file mode 100644 index 0000000..264e520 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.cpp @@ -0,0 +1,732 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "ExtOctreeTetrahedralizer.h" +#include "foundation/PxSort.h" +#include "foundation/PxQuat.h" +#include "CmRandom.h" + +namespace physx +{ + namespace Ext + { + // ------------------------------------------------------------------------------------- + static const PxI32 childRelPos[8][3] = { {0,0,0}, {1,0,0},{0,1,0},{1,1,0}, {0,0,1}, {1,0,1},{0,1,1},{1,1,1} }; + + static const PxI32 cubeCorners[8][3] = { {0,0,0}, {1,0,0},{1,1,0},{0,1,0}, {0,0,1}, {1,0,1},{1,1,1},{0,1,1} }; + //static const PxI32 cubeEdges[12][2] = { {0,1}, {1,2},{2,3},{3,0}, {0,4},{1,5},{2,6},{3,7},{4,5},{5,6},{6,7},{7,4} }; + + static const PxI32 tetFaces[4][3] = { {2,1,0}, {0,1,3}, {1,2,3}, {2,0,3} }; + static const PxI32 cubeTets[6][4] = { {0,1,2,5}, {0,4,5,2}, {2,4,5,6}, {4,7,6,3}, {2,6,3,4}, {0,2,3,4} }; + + static const PxI32 cubeTetNeighbors[6][4] = { {-1,-1,-1,1}, {-1,5,2,0}, {1,4,-1,-1}, + {-1,-1,-1,4}, {-1,2,3,5}, {-1,1,4,-1} }; + + // ------------------------------------------------------------------------------------- + OctreeTetrahedralizer::OctreeTetrahedralizer() + { + clear(); + } + + // ------------------------------------------------------------------------------------- + void OctreeTetrahedralizer::clearTets() + { + tetVerts.clear(); + tetIds.clear(); + firstFreeTet = -1; + currentTetMark = 0; + tetMarks.clear(); + tetNeighbors.clear(); + renderVerts.clear(); + renderTriIds.clear(); + firstABBVert = 0; + } + + // ------------------------------------------------------------------------------------- + void OctreeTetrahedralizer::clear() + { + surfaceVerts.clear(); + surfaceTriIds.clear(); + tetIds.clear(); + tetNeighbors.clear(); + cells.clear(); + clearTets(); + + prevClip = -1.0f; + prevScale = -1.0f; + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::createTree() + { + Bounds3 bounds; + bounds.setEmpty(); + + for (PxI32 i = 0; i < PxI32(surfaceVerts.size()); i++) + { + const PxVec3& v = surfaceVerts[i]; + bounds.include(Vec3(v.x, v.y, v.z)); + } + + bounds.expand(0.01); + Vec3 dims = bounds.getDimensions(); + PxF64 size = PxMax(dims.x, PxMax(dims.y, dims.z)); + + // create root + cells.resize(1); + cells.front().init(); + cells.front().orig = bounds.minimum; + cells.front().size = size; + + cells.front().depth = 0; + + // insert vertices + + PxI32 numVerts = PxI32(surfaceVerts.size()); + + for (PxI32 i = 0; i < numVerts; i++) + { + treeInsertVert(0, i); + } + } + + // ------------------------------------------------------------------------------------- + + PxI32 OctreeTetrahedralizer::Cell::getChildNr(const Vec3& p) + { + if (firstChild < 0) + return -1; + PxI32 nr = 0; + if (p.x > orig.x + 0.5 * size) nr |= 1; + if (p.y > orig.y + 0.5 * size) nr |= 2; + if (p.z > orig.z + 0.5 * size) nr |= 4; + return firstChild + nr; + } + + // ------------------------------------------------------------------------------------- + + void OctreeTetrahedralizer::treeInsertVert(PxI32 cellNr, PxI32 vertNr) + { + // inner node + + if (cells[cellNr].firstChild >= 0) + { + treeInsertVert(cells[cellNr].getChildNr(surfaceVerts[vertNr]), vertNr); + return; + } + + // add + + vertsOfCell.add(cellNr, vertNr); + cells[cellNr].numVerts++; + + if (cells[cellNr].numVerts <= maxVertsPerCell || + cells[cellNr].depth >= maxTreeDepth) + return; + + // split + + PxI32 firstChild = cells.size(); + cells[cellNr].firstChild = firstChild; + cells.resize(cells.size() + 8); + + for (PxI32 i = 0; i < 8; i++) + { + Cell& child = cells[firstChild + i]; + child.init(); + child.depth = cells[cellNr].depth + 1; + child.size = cells[cellNr].size * 0.5; + child.orig = cells[cellNr].orig + Vec3( + childRelPos[i][0] * child.size, + childRelPos[i][1] * child.size, + childRelPos[i][2] * child.size); + } + + PxI32 iterator, id; + vertsOfCell.initIteration(cellNr, iterator); + while (vertsOfCell.iterate(id, iterator)) + treeInsertVert(cells[cellNr].getChildNr(surfaceVerts[id]), id); + + vertsOfCell.removeAll(cellNr); + cells[cellNr].numVerts = 0; + } + + // ----------------------------------------------------------------------------------- + + static Vec3 jitter(const Vec3& p, Cm::RandomR250& random) + { + PxF64 eps = 0.001; + return Vec3( + p.x - eps + 2.0 * eps * PxF64(random.rand(0.0f, 1.0f)), + p.y - eps + 2.0 * eps * PxF64(random.rand(0.0f, 1.0f)), + p.z - eps + 2.0 * eps * PxF64(random.rand(0.0f, 1.0f))); + } + + // ----------------------------------------------------------------------------------- + + void OctreeTetrahedralizer::createTetVerts(bool includeOctreeNodes) + { + tetVerts.clear(); + + insideTester.init(surfaceVerts.begin(), PxI32(surfaceVerts.size()), + surfaceTriIds.begin(), PxI32(surfaceTriIds.size()) / 3); + + for (PxI32 i = 0; i < PxI32(surfaceVerts.size()); i++) + { + const PxVec3& v = surfaceVerts[i]; + tetVerts.pushBack(Vec3(v.x, v.y, v.z)); + } + + if (includeOctreeNodes) + { + + PxArray treeVerts; + + for (PxI32 i = 0; i < PxI32(cells.size()); i++) + { + PxF64 s = cells[i].size; + + for (PxI32 j = 0; j < 8; j++) { + Vec3 p = cells[i].orig + Vec3( + s * cubeCorners[j][0], + s * cubeCorners[j][1], + s * cubeCorners[j][2]); + treeVerts.pushBack(p); + } + } + + // remove duplicates + + PxF64 eps = 1e-8; + + struct Ref + { + PxF64 d; + PxI32 vertNr; + bool operator < (const Ref& r) const + { + return d < r.d; + } + }; + + PxI32 numTreeVerts = PxI32(treeVerts.size()); + + PxArray refs(numTreeVerts); + for (PxI32 i = 0; i < numTreeVerts; i++) + { + Vec3& p = treeVerts[i]; + refs[i].d = p.x + 0.3 * p.y + 0.1 * p.z; + refs[i].vertNr = i; + } + + PxSort(refs.begin(), refs.size()); + PxArray duplicate(numTreeVerts, false); + + PxI32 nr = 0; + Cm::RandomR250 random(0); + while (nr < numTreeVerts) + { + Ref& r = refs[nr]; + nr++; + if (duplicate[r.vertNr]) + continue; + Vec3& p = treeVerts[r.vertNr]; + Vec3 v = jitter(p, random); + + if (insideTester.isInside(PxVec3(PxReal(v.x), PxReal(v.y), PxReal(v.z)))) + tetVerts.pushBack(jitter(p, random)); + + PxI32 i = nr; + while (i < numTreeVerts && fabs(refs[i].d - r.d) < eps) + { + Vec3& q = treeVerts[refs[i].vertNr]; + if ((p - q).magnitude() < eps) + duplicate[refs[i].vertNr] = true; + i++; + } + } + } + } + + // ----------------------------------------------------------------------------------- + Vec3 OctreeTetrahedralizer::getTetCenter(PxI32 tetNr) const + { + return (tetVerts[tetIds[4 * tetNr]] + + tetVerts[tetIds[4 * tetNr + 1]] + + tetVerts[tetIds[4 * tetNr + 2]] + + tetVerts[tetIds[4 * tetNr + 3]]) * 0.25; + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::treeInsertTet(PxI32 tetNr) + { + Vec3 center = getTetCenter(tetNr); + + PxI32 cellNr = 0; + while (cellNr >= 0) + { + Cell& c = cells[cellNr]; + if (c.closestTetNr < 0) + c.closestTetNr = tetNr; + else + { + Vec3 cellCenter = c.orig + Vec3(c.size, c.size, c.size) * 0.5; + Vec3 closest = getTetCenter(c.closestTetNr); + if ((cellCenter - center).magnitudeSquared() < (cellCenter - closest).magnitudeSquared()) + c.closestTetNr = tetNr; + } + cellNr = cells[cellNr].getChildNr(center); + } + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::treeRemoveTet(PxI32 tetNr) + { + Vec3 center = getTetCenter(tetNr); + + PxI32 cellNr = 0; + while (cellNr >= 0) + { + Cell& c = cells[cellNr]; + if (c.closestTetNr == tetNr) + c.closestTetNr = -1; + cellNr = cells[cellNr].getChildNr(center); + } + } + + void resizeFast(PxArray& arr, PxU32 newSize, PxI32 value = 0) + { + if (newSize < arr.size()) + arr.removeRange(newSize, arr.size() - newSize); + else + { + while (arr.size() < newSize) + arr.pushBack(value); + } + } + + // ----------------------------------------------------------------------------------- + PxI32 OctreeTetrahedralizer::getNewTetNr() + { + PxI32 newTetNr; + if (firstFreeTet >= 0) + { + // take from free list + newTetNr = firstFreeTet; + firstFreeTet = tetIds[4 * firstFreeTet]; + } + else + { + // append + newTetNr = PxI32(tetIds.size()) / 4; + resizeFast(tetIds, tetIds.size() + 4); + resizeFast(tetMarks, newTetNr + 1, 0); + resizeFast(tetNeighbors, tetIds.size(), -1); + } + return newTetNr; + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::removeTetNr(PxI32 tetNr) + { + // add to free list + tetIds[4 * tetNr] = firstFreeTet; + tetIds[4 * tetNr + 1] = -1; + tetIds[4 * tetNr + 2] = -1; + tetIds[4 * tetNr + 3] = -1; + firstFreeTet = tetNr; + } + + // ----------------------------------------------------------------------------------- + bool OctreeTetrahedralizer::findSurroundingTet(const Vec3& p, PxI32 startTetNr, PxI32& tetNr) + { + currentTetMark++; + tetNr = startTetNr; + + bool found = false; + + while (!found) + { + if (tetNr < 0 || tetMarks[tetNr] == currentTetMark) // circular, something went wrong + break; + tetMarks[tetNr] = currentTetMark; + + Vec3 c = getTetCenter(tetNr); + + PxI32* ids = &tetIds[4 * tetNr]; + PxF64 minT = DBL_MAX; + PxI32 minFaceNr = -1; + + for (PxI32 i = 0; i < 4; i++) + { + const Vec3& p0 = tetVerts[ids[tetFaces[i][0]]]; + const Vec3& p1 = tetVerts[ids[tetFaces[i][1]]]; + const Vec3& p2 = tetVerts[ids[tetFaces[i][2]]]; + + Vec3 n = (p1 - p0).cross(p2 - p0); + n = n.getNormalized(); + PxF64 hp = (p - p0).dot(n); + PxF64 hc = (c - p0).dot(n); + + PxF64 t = hp - hc; + if (t == 0.0) + continue; + t = -hc / t; // time when c -> p hits the face + if (t >= 0.0 && t < minT) { // in front and new min + minT = t; + minFaceNr = i; + } + } + if (minT >= 1.0) + found = true; + else + tetNr = tetNeighbors[4 * tetNr + minFaceNr]; + } + + return found; + } + + // ----------------------------------------------------------------------------------- + bool OctreeTetrahedralizer::findSurroundingTet(const Vec3& p, PxI32& tetNr) + { + PxI32 startTet = 0; + PxI32 cellNr = 0; + while (cellNr >= 0) + { + if (cells[cellNr].closestTetNr >= 0) + startTet = cells[cellNr].closestTetNr; + cellNr = cells[cellNr].getChildNr(p); + } + + return findSurroundingTet(p, startTet, tetNr); + } + + // ----------------------------------------------------------------------------------- + static Vec3 getCircumCenter(Vec3& p0, Vec3& p1, Vec3& p2, Vec3& p3) + { + Vec3 b = p1 - p0; + Vec3 c = p2 - p0; + Vec3 d = p3 - p0; + PxF64 det = 2.0 * (b.x*(c.y*d.z - c.z*d.y) - b.y*(c.x*d.z - c.z*d.x) + b.z*(c.x*d.y - c.y*d.x)); + if (det == 0.0) + return p0; + else + { + Vec3 v = c.cross(d)*b.dot(b) + d.cross(b)*c.dot(c) + b.cross(c)*d.dot(d); + v /= det; + return p0 + v; + } + } + + + // ----------------------------------------------------------------------------------- + bool OctreeTetrahedralizer::meshInsertTetVert(PxI32 vertNr) + { + const Vec3& p = tetVerts[vertNr]; + PxI32 surroundingTetNr; + if (!findSurroundingTet(p, surroundingTetNr)) + return false; + + // find violating tets + + violatingTets.clear(); + stack.clear(); + currentTetMark++; + stack.pushBack(surroundingTetNr); + + while (!stack.empty()) + { + PxI32 tetNr = stack.back(); + stack.popBack(); + if (tetMarks[tetNr] == currentTetMark) + continue; + tetMarks[tetNr] = currentTetMark; + violatingTets.pushBack(tetNr); + + for (PxI32 i = 0; i < 4; i++) + { + PxI32 n = tetNeighbors[4 * tetNr + i]; + if (n < 0 || tetMarks[n] == currentTetMark) + continue; + + // Delaunay condition test + PxI32* ids = &tetIds[4 * n]; + Vec3 c = getCircumCenter(tetVerts[ids[0]], tetVerts[ids[1]], tetVerts[ids[2]], tetVerts[ids[3]]); + + PxF64 r2 = (tetVerts[ids[0]] - c).magnitudeSquared(); + if ((p - c).magnitudeSquared() < r2) + stack.pushBack(n); + } + } + + // remove old tets, create new ones + + edges.clear(); + Edge e; + + for (PxI32 i = 0; i < PxI32(violatingTets.size()); i++) + { + PxI32 tetNr = violatingTets[i]; + + // copy information before we delete it + PxI32 ids[4], ns[4]; + for (PxI32 j = 0; j < 4; j++) { + ids[j] = tetIds[4 * tetNr + j]; + ns[j] = tetNeighbors[4 * tetNr + j]; + } + + // delete the tetrahedron + treeRemoveTet(tetNr); + removeTetNr(tetNr); + + // visit neighbors + for (PxI32 j = 0; j < 4; j++) { + PxI32 n = ns[j]; + if (n < 0 || tetMarks[n] != currentTetMark) + { + // no neighbor or neighbor is not-violating -> we are facing the border + + // create new tetrahedron + + PxI32 newTetNr = getNewTetNr(); + PxI32 id0 = ids[tetFaces[j][2]]; + PxI32 id1 = ids[tetFaces[j][1]]; + PxI32 id2 = ids[tetFaces[j][0]]; + + tetIds[4 * newTetNr] = id0; + tetIds[4 * newTetNr + 1] = id1; + tetIds[4 * newTetNr + 2] = id2; + tetIds[4 * newTetNr + 3] = vertNr; + + treeInsertTet(newTetNr); + + tetNeighbors[4 * newTetNr] = n; + + if (n >= 0) + { + for (PxI32 k = 0; k < 4; k++) + { + if (tetNeighbors[4 * n + k] == tetNr) + tetNeighbors[4 * n + k] = newTetNr; + } + } + + // will set the neighbors among the new tetrahedra later + + tetNeighbors[4 * newTetNr + 1] = -1; + tetNeighbors[4 * newTetNr + 2] = -1; + tetNeighbors[4 * newTetNr + 3] = -1; + + e.init(id0, id1, newTetNr, 1); edges.pushBack(e); + e.init(id1, id2, newTetNr, 2); edges.pushBack(e); + e.init(id2, id0, newTetNr, 3); edges.pushBack(e); + } + } // next neighbor + } // next violating tetrahedron + + // fix neighbors + + PxSort(edges.begin(), edges.size()); + + PxI32 nr = 0; + while (nr < PxI32(edges.size())) + { + Edge& e0 = edges[nr]; + nr++; + if (nr < PxI32(edges.size()) && edges[nr] == e0) + { + Edge& e1 = edges[nr]; + + tetNeighbors[4 * e0.tetNr + e0.faceNr] = e1.tetNr; + tetNeighbors[4 * e1.tetNr + e1.faceNr] = e0.tetNr; + nr++; + } + } + + return true; + } + + // ----------------------------------------------------------------------------------- + static PxF64 tetQuality(const Vec3& p0, const Vec3& p1, const Vec3& p2, const Vec3& p3) + { + Vec3 d0 = p1 - p0; + Vec3 d1 = p2 - p0; + Vec3 d2 = p3 - p0; + Vec3 d3 = p2 - p1; + Vec3 d4 = p3 - p2; + Vec3 d5 = p1 - p3; + + PxF64 s0 = d0.magnitudeSquared(); + PxF64 s1 = d1.magnitudeSquared(); + PxF64 s2 = d2.magnitudeSquared(); + PxF64 s3 = d3.magnitudeSquared(); + PxF64 s4 = d4.magnitudeSquared(); + PxF64 s5 = d5.magnitudeSquared(); + + PxF64 ms = (s0 + s1 + s2 + s3 + s4 + s5) / 6.0; + PxF64 rms = sqrt(ms); + + static const PxF64 s = 12.0 / sqrt(2.0); + + PxF64 vol = d0.dot(d1.cross(d2)) / 6.0; + return s * vol / (rms * rms * rms); // 1.0 for regular tetrahedron + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::pruneTets() + { + insideTester.init(surfaceVerts.begin(), PxI32(surfaceVerts.size()), + surfaceTriIds.begin(), PxI32(surfaceTriIds.size()) / 3); + + static PxF64 minQuality = 0.01; + + PxI32 numTets = tetIds.size() / 4; + + PxI32 num = 0; + + for (PxI32 i = 0; i < numTets; i++) + { + bool remove = false; + + PxI32* ids = &tetIds[4 * i]; + for (PxI32 j = 0; j < 4; j++) + { + if (ids[j] >= firstABBVert) + remove = true; + } + + if (ids[0] < 0 || ids[1] < 0 || ids[2] < 0 || ids[3] < 0) + remove = true; + + if (!remove) + { + Vec3 c = getTetCenter(i); + if (!insideTester.isInside(PxVec3(PxReal(c.x), PxReal(c.y), PxReal(c.z)))) + remove = true; + + if (tetQuality(tetVerts[ids[0]], tetVerts[ids[1]], + tetVerts[ids[2]], tetVerts[ids[3]]) < minQuality) + continue; + } + + if (remove) + continue; + + for (PxI32 j = 0; j < 4; j++) + tetIds[4 * num + j] = ids[j]; + num++; + } + + tetIds.resize(4 * num); + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::createTetMesh(const PxArray& verts, const PxArray& triIds, + bool includeOctreeNodes, PxI32 _maxVertsPerCell, PxI32 _maxTreeDepth) + { + + this->surfaceVerts = verts; + surfaceTriIds.resize(triIds.size()); + for (PxU32 i = 0; i < triIds.size(); i++) + this->surfaceTriIds[i] = triIds[i]; + this->maxVertsPerCell = _maxVertsPerCell; + this->maxTreeDepth = _maxTreeDepth; + createTree(); + + clearTets(); + + if (cells.empty()) + return; + + createTetVerts(includeOctreeNodes); + if (tetVerts.empty()) + return; + + for (PxI32 i = 0; i < PxI32(cells.size()); i++) + cells[i].closestTetNr = -1; + + // create aabb tets + + Bounds3 bounds; + bounds.setEmpty(); + for (PxI32 i = 0; i < PxI32(tetVerts.size()); i++) + bounds.include(tetVerts[i]); + bounds.expand(bounds.getDimensions().magnitude() * 0.1); + + firstABBVert = PxI32(tetVerts.size()); + Vec3 dims = bounds.getDimensions(); + + for (PxI32 i = 0; i < 8; i++) + { + tetVerts.pushBack(bounds.minimum + Vec3( + cubeCorners[i][0] * dims.x, + cubeCorners[i][1] * dims.y, + cubeCorners[i][2] * dims.z)); + } + + for (PxI32 i = 0; i < 6; i++) + { + for (PxI32 j = 0; j < 4; j++) + { + tetIds.pushBack(firstABBVert + cubeTets[i][j]); + tetNeighbors.pushBack(cubeTetNeighbors[i][j]); + } + treeInsertTet(i); + } + + tetMarks.resize(6, 0); + + for (PxI32 i = 0; i < firstABBVert; i++) + { + meshInsertTetVert(i); + } + + pruneTets(); + + renderTriIds.clear(); + renderVerts.clear(); + } + + // ----------------------------------------------------------------------------------- + void OctreeTetrahedralizer::readBack(PxArray &outputTetVerts, PxArray &outputTetIds) + { + outputTetVerts.resize(tetVerts.size()); + + for (PxU32 i = 0; i < tetVerts.size(); i++) + { + Vec3 &v = tetVerts[i]; + outputTetVerts[i] = PxVec3(PxReal(v.x), PxReal(v.y), PxReal(v.z)); + } + + outputTetIds.resize(tetIds.size()); + + for (PxU32 i = 0; i < tetIds.size(); i++) + outputTetIds[i] = PxU32(tetIds[i]); + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.h new file mode 100644 index 0000000..3d5efd2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtOctreeTetrahedralizer.h @@ -0,0 +1,169 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef EXT_OCTREE_TETRAHEDRALIZER_H +#define EXT_OCTREE_TETRAHEDRALIZER_H + +#include "ExtMultiList.h" +#include "ExtVec3.h" +#include "foundation/PxVec3.h" +#include "ExtInsideTester.h" + +namespace physx +{ + namespace Ext + { + + class InsideTester; + + // ------------------------------------------------------------------------------ + + class OctreeTetrahedralizer + { + public: + OctreeTetrahedralizer(); + + void clear(); + void createTetMesh(const PxArray &verts, const PxArray &triIds, + bool includeOctreeNodes = true, PxI32 maxVertsPerCell = 20, PxI32 maxTreeDepth = 5); + + void readBack(PxArray &tetVertices, PxArray &tetIndices); + + private: + // input mesh + + PxArray surfaceVerts; + PxArray surfaceTriIds; + + // octree + + PxI32 maxVertsPerCell; + PxI32 maxTreeDepth; + + struct Cell + { + void init() + { + firstChild = -1; + orig = Vec3(0.0, 0.0, 0.0); + size = 0.0; + numVerts = 0; + closestTetNr = -1; + depth = 0; + } + + PxI32 getChildNr(const Vec3& p); + + PX_FORCE_INLINE PxI32 getChildNr(const PxVec3& p) + { + return getChildNr(Vec3(p.x, p.y, p.z)); + } + + PxI32 firstChild; + PxI32 firstCellVert; + PxI32 firstCellTet; + Vec3 orig; + double size; + PxI32 numVerts; + PxI32 closestTetNr; + PxI32 depth; + }; + + PxArray cells; + MultiList vertsOfCell; + + // tet mesh + + PxArray tetVerts; + PxArray tetIds; + PxArray tetNeighbors; + PxArray tetMarks; + PxI32 currentTetMark; + PxArray stack; + PxArray violatingTets; + PxI32 firstABBVert; + + struct Edge + { + + PxI32 id0, id1; + PxI32 faceNr, tetNr; + + void init(PxI32 _id0, PxI32 _id1, PxI32 _tetNr, PxI32 _faceNr) + { + this->id0 = _id0 < _id1 ? _id0 : _id1; + this->id1 = _id0 > _id1 ? _id0 : _id1; + this->tetNr = _tetNr; + this->faceNr = _faceNr; + } + + PX_FORCE_INLINE bool operator < (Edge e) const + { + if (id0 < e.id0) return true; + if (id0 > e.id0) return false; + return id1 < e.id1; + } + + PX_FORCE_INLINE bool operator == (Edge e) + { + return id0 == e.id0 && id1 == e.id1; + } + }; + PxArray edges; + + void clearTets(); + void createTree(); + void treeInsertVert(PxI32 cellNr, PxI32 vertNr); + void createTetVerts(bool includeOctreeNodes); + + bool findSurroundingTet(const Vec3& p, PxI32 startTetNr, PxI32& tetNr); + bool findSurroundingTet(const Vec3& p, PxI32& tetNr); + void treeInsertTet(PxI32 tetNr); + void treeRemoveTet(PxI32 tetNr); + + PxI32 firstFreeTet; + PxI32 getNewTetNr(); + void removeTetNr(PxI32 tetNr); + + Vec3 getTetCenter(PxI32 tetNr) const; + bool meshInsertTetVert(PxI32 vertNr); + + InsideTester insideTester; + void pruneTets(); + + mutable float prevClip; + mutable float prevScale; + mutable PxArray renderVerts; + mutable PxArray renderNormals; + mutable PxArray renderTriIds; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtQuadric.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtQuadric.h new file mode 100644 index 0000000..b8fa184 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtQuadric.h @@ -0,0 +1,93 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_QUADRIC_H +#define EXT_QUADRIC_H + +#include "foundation/PxVec3.h" + +// MM: used in ExtMeshSimplificator +// see paper Garland and Heckbert: "Surface Simplification Using Quadric Error Metrics" + +namespace physx +{ + namespace Ext + { + class Quadric { + public: + PX_FORCE_INLINE void zero() + { + a00 = 0.0f; a01 = 0.0f; a02 = 0.0f; a03 = 0.0f; + a11 = 0.0f; a12 = 0.0f; a13 = 0.0f; + a22 = 0.0f; a23 = 0.0f; + a33 = 0.0f; + } + + PX_FORCE_INLINE void setFromPlane(const PxVec3& v0, const PxVec3& v1, const PxVec3& v2) + { + PxVec3 n = (v1 - v0).cross(v2 - v0); n.normalize(); + float d = -n.dot(v0); + a00 = n.x * n.x; a01 = n.x * n.y; a02 = n.x * n.z; a03 = n.x * d; + a11 = n.y * n.y; a12 = n.y * n.z; a13 = n.y * d; + a22 = n.z * n.z; a23 = n.z * d; + a33 = d * d; + } + + PX_FORCE_INLINE Quadric operator +(const Quadric& q) const + { + Quadric sum; + sum.a00 = a00 + q.a00; sum.a01 = a01 + q.a01; sum.a02 = a02 + q.a02; sum.a03 = a03 + q.a03; + sum.a11 = a11 + q.a11; sum.a12 = a12 + q.a12; sum.a13 = a13 + q.a13; + sum.a22 = a22 + q.a22; sum.a23 = a23 + q.a23; + sum.a33 = a33 + q.a33; + return sum; + } + + void operator +=(const Quadric& q) + { + a00 += q.a00; a01 += q.a01; a02 += q.a02; a03 += q.a03; + a11 += q.a11; a12 += q.a12; a13 += q.a13; + a22 += q.a22; a23 += q.a23; + a33 += q.a33; + } + + PxF32 outerProduct(const PxVec3& v) + { + return a00 * v.x * v.x + 2.0f * a01 * v.x * v.y + 2.0f * a02 * v.x * v.z + 2.0f * a03 * v.x + + a11 * v.y * v.y + 2.0f * a12 * v.y * v.z + 2.0f * a13 * v.y + + a22 * v.z * v.z + 2.0f * a23 * v.z + a33; + } + private: + PxF32 a00, a01, a02, a03; + PxF32 a11, a12, a13; + PxF32 a22, a23; + PxF32 a33; + + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRandomAccessHeap.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRandomAccessHeap.h new file mode 100644 index 0000000..5eadb34 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRandomAccessHeap.h @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_RANDOM_ACCESS_HEAP_H +#define EXT_RANDOM_ACCESS_HEAP_H + +#include "foundation/PxArray.h" + +// MM: heap which allows the modification of the priorities of entries stored anywhere in the tree +// for this, every entry gets an id via which it can be accessed + +// used in ExtMeshSimplificator to sort edges w.r.t. their error metric + +// ------------------------------------------------------------------------------ + +namespace physx +{ + namespace Ext + { + + template class RandomAccessHeap + { + public: + RandomAccessHeap() { + heap.resize(1); // dummy such that root is at 1 for faster parent child computation + ids.resize(1); + nextId = 0; + } + + void resizeFast(PxArray& arr, PxU32 newSize, PxI32 value = 0) + { + if (newSize < arr.size()) + arr.removeRange(newSize, arr.size() - newSize); + else + { + while (arr.size() < newSize) + arr.pushBack(value); + } + } + + PxI32 insert(T elem, PxI32 id = -1) // id for ability to alter the entry later or to identify duplicates + { + if (id < 0) { + id = nextId; + nextId++; + } + else if (id >= nextId) + nextId = id + 1; + + if (id >= 0 && id < PxI32(posOfId.size()) && posOfId[id] >= 0) + return id; // already in heap + + heap.pushBack(elem); + ids.pushBack(id); + + if (id >= PxI32(posOfId.size())) + resizeFast(posOfId, id + 1, -1); + + posOfId[id] = heap.size() - 1; + + percolate(PxI32(heap.size()) - 1); + + return id; + } + + bool remove(PxI32 id) + { + PxI32 i = posOfId[id]; + if (i < 0) + return false; + + posOfId[id] = -1; + T prev = heap[i]; + + heap[i] = heap.back(); + heap.popBack(); + ids[i] = ids.back(); + ids.popBack(); + + if (i < PxI32(heap.size())) + { + posOfId[ids[i]] = i; + + if (heap.size() > 1) + { + if (heap[i] < prev) + percolate(i); + else + siftDown(i); + } + } + + return true; + } + + T deleteMin() + { + T min(-1, -1, 0.0f); + + if (heap.size() > 1) + { + min = heap[1]; + posOfId[ids[1]] = -1; + + heap[1] = heap.back(); + heap.popBack(); + ids[1] = ids.back(); + ids.popBack(); + posOfId[ids[1]] = 1; + + siftDown(1); + } + + return min; + } + + void makeHeap(const PxArray &elems) // O(n) instead of inserting one after the other O(n log n) + { + heap.resize(elems.size() + 1); + ids.resize(elems.size() + 1); + posOfId.resize(elems.size()); + + for (PxU32 i = 0; i < elems.size(); i++) + { + heap[i + 1] = elems[i]; + ids[i + 1] = i; + posOfId[ids[i + 1]] = i + 1; + } + + PxI32 n = (heap.size() - 1) >> 1; + for (PxI32 i = n; i >= 1; i--) + siftDown(i); + } + + void clear() + { + heap.capacity() == 0 ? heap.resize(1) : heap.forceSize_Unsafe(1); + ids.capacity() == 0 ? ids.resize(1) : ids.forceSize_Unsafe(1); + posOfId.forceSize_Unsafe(0); + nextId = 0; + } + PX_FORCE_INLINE PxI32 size() { return heap.size() - 1; } + PX_FORCE_INLINE bool empty() { return heap.size() <= 1; } + + private: + void siftDown(PxI32 i) + { + PxI32 n = PxI32(heap.size()) - 1; + PxI32 k = i; + PxI32 j; + do + { + j = k; + if (2 * j < n && heap[2 * j] < heap[k]) + k = 2 * j; + if (2 * j < n && heap[2 * j + 1] < heap[k]) + k = 2 * j + 1; + T temp = heap[j]; heap[j] = heap[k]; heap[k] = temp; + PxI32 id = ids[j]; ids[j] = ids[k]; ids[k] = id; + + posOfId[ids[j]] = j; + posOfId[ids[k]] = k; + + } + while (j != k); + } + + void percolate(PxI32 i) + { + PxI32 k = i; + PxI32 j; + do + { + j = k; + if (j > 1 && !(heap[j >> 1] < heap[k])) + k = j >> 1; + T temp = heap[j]; heap[j] = heap[k]; heap[k] = temp; + PxI32 id = ids[j]; ids[j] = ids[k]; ids[k] = id; + + posOfId[ids[j]] = j; + posOfId[ids[k]] = k; + } + while (j != k); + } + + PxArray heap; + + PxArray ids; + PxArray posOfId; + PxI32 nextId; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp new file mode 100644 index 0000000..269ab75 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.cpp @@ -0,0 +1,654 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtRemesher.h" +#include "ExtBVH.h" +#include "ExtMarchingCubesTable.h" +#include "foundation/PxSort.h" +#include "GuIntersectionTriangleBox.h" +#include "GuBox.h" + +namespace physx +{ + namespace Ext + { + + // ------------------------------------------------------------------------------------- + void Remesher::clear() + { + cells.clear(); + vertices.clear(); + normals.clear(); + triIds.clear(); + triNeighbors.clear(); + } + + #define HASH_SIZE 170111 + + // ------------------------------------------------------------------------------------- + PX_FORCE_INLINE static PxU32 hash(PxI32 xi, PxI32 yi, PxI32 zi) + { + PxU32 h = (xi * 92837111) ^ (yi * 689287499) ^ (zi * 283923481); + return h % HASH_SIZE; + } + + // ------------------------------------------------------------------------------------- + void Remesher::addCell(PxI32 xi, PxI32 yi, PxI32 zi) + { + Cell c; + c.init(xi, yi, zi); + PxU32 h = hash(xi, yi, zi); + c.next = firstCell[h]; + firstCell[h] = PxI32(cells.size()); + cells.pushBack(c); + } + + // ------------------------------------------------------------------------------------- + PxI32 Remesher::getCellNr(PxI32 xi, PxI32 yi, PxI32 zi) const + { + PxU32 h = hash(xi, yi, zi); + PxI32 nr = firstCell[h]; + while (nr >= 0) + { + const Cell& c = cells[nr]; + if (c.xi == xi && c.yi == yi && c.zi == zi) + return nr; + nr = c.next; + } + return -1; + } + + // ------------------------------------------------------------------------------------- + PX_FORCE_INLINE bool Remesher::cellExists(PxI32 xi, PxI32 yi, PxI32 zi) const + { + return getCellNr(xi, yi, zi) >= 0; + } + + + // ------------------------------------------------------------------------------------- + void Remesher::remesh(const PxArray& inputVerts, const PxArray& inputTriIds, + PxI32 resolution, PxArray *vertexMap) + { + clear(); + + PxBounds3 meshBounds; + meshBounds.setEmpty(); + + for (PxI32 i = 0; i < PxI32(inputVerts.size()); i++) + meshBounds.include(inputVerts[i]); + + PxVec3 dims = meshBounds.getDimensions(); + + float spacing = PxMax(dims.x, PxMax(dims.y, dims.z)) / resolution; + + meshBounds.fattenFast(3.0f * spacing); + + PxI32 numTris = PxI32(inputTriIds.size()) / 3; + PxBounds3 triBounds, cellBounds; + Gu::BoxPadded box; + box.rot = PxMat33(PxIdentity); + + firstCell.clear(); + firstCell.resize(HASH_SIZE, -1); + + // create sparse overlapping cells + + for (PxI32 i = 0; i < numTris; i++) + { + const PxVec3& p0 = inputVerts[inputTriIds[3 * i]]; + const PxVec3& p1 = inputVerts[inputTriIds[3 * i + 1]]; + const PxVec3& p2 = inputVerts[inputTriIds[3 * i + 2]]; + + triBounds.setEmpty(); + triBounds.include(p0); + triBounds.include(p1); + triBounds.include(p2); + + PxI32 x0 = PxI32(PxFloor((triBounds.minimum.x - meshBounds.minimum.x) / spacing)); + PxI32 y0 = PxI32(PxFloor((triBounds.minimum.y - meshBounds.minimum.y) / spacing)); + PxI32 z0 = PxI32(PxFloor((triBounds.minimum.z - meshBounds.minimum.z) / spacing)); + + PxI32 x1 = PxI32(PxFloor((triBounds.maximum.x - meshBounds.minimum.x) / spacing)) + 1; + PxI32 y1 = PxI32(PxFloor((triBounds.maximum.y - meshBounds.minimum.y) / spacing)) + 1; + PxI32 z1 = PxI32(PxFloor((triBounds.maximum.z - meshBounds.minimum.z) / spacing)) + 1; + + for (PxI32 xi = x0; xi <= x1; xi++) + { + for (PxI32 yi = y0; yi <= y1; yi++) + { + for (PxI32 zi = z0; zi <= z1; zi++) + { + cellBounds.minimum.x = meshBounds.minimum.x + xi * spacing; + cellBounds.minimum.y = meshBounds.minimum.y + yi * spacing; + cellBounds.minimum.z = meshBounds.minimum.z + zi * spacing; + cellBounds.maximum = cellBounds.minimum + PxVec3(spacing, spacing, spacing); + cellBounds.fattenFast(1e-5f); + + box.center = cellBounds.getCenter(); + box.extents = cellBounds.getExtents(); + + if (!Gu::intersectTriangleBox(box, p0, p1, p2)) + continue; + + if (!cellExists(xi, yi, zi)) + addCell(xi, yi, zi); + } + } + } + } + + // using marching cubes to create boundaries + + vertices.clear(); + cellOfVertex.clear(); + triIds.clear(); + + PxI32 edgeVertId[12]; + PxVec3 cornerPos[8]; + int cornerVoxelNr[8]; + + for (PxI32 i = 0; i < PxI32(cells.size()); i++) + { + Cell& c = cells[i]; + + // we need to handle a 2 x 2 x 2 block of cells to cover the boundary + + for (PxI32 dx = 0; dx < 2; dx++) + { + for (PxI32 dy = 0; dy < 2; dy++) + { + for (PxI32 dz = 0; dz < 2; dz++) + { + PxI32 xi = c.xi + dx; + PxI32 yi = c.yi + dy; + PxI32 zi = c.zi + dz; + + // are we responsible for this cell? + + PxI32 maxCellNr = i; + + for (PxI32 rx = xi - 1; rx <= xi; rx++) + for (PxI32 ry = yi - 1; ry <= yi; ry++) + for (PxI32 rz = zi - 1; rz <= zi; rz++) + maxCellNr = PxMax(maxCellNr, getCellNr(rx, ry, rz)); + + if (maxCellNr != i) + continue; + + PxI32 code = 0; + for (PxI32 j = 0; j < 8; j++) + { + PxI32 mx = xi - 1 + marchingCubeCorners[j][0]; + PxI32 my = yi - 1 + marchingCubeCorners[j][1]; + PxI32 mz = zi - 1 + marchingCubeCorners[j][2]; + cornerVoxelNr[j] = getCellNr(mx, my, mz); + + if (cornerVoxelNr[j] >= 0) + code |= (1 << j); + + cornerPos[j].x = meshBounds.minimum.x + (mx + 0.5f) * spacing; + cornerPos[j].y = meshBounds.minimum.y + (my + 0.5f) * spacing; + cornerPos[j].z = meshBounds.minimum.z + (mz + 0.5f) * spacing; + } + PxI32 first = firstMarchingCubesId[code]; + PxI32 num = (firstMarchingCubesId[code + 1] - first); + + // create vertices and tris + + for (PxI32 j = 0; j < 12; j++) + edgeVertId[j] = -1; + + for (PxI32 j = num - 1; j >= 0; j--) + { + PxI32 edgeId = marchingCubesIds[first + j]; + if (edgeVertId[edgeId] < 0) + { + PxI32 id0 = marchingCubeEdges[edgeId][0]; + PxI32 id1 = marchingCubeEdges[edgeId][1]; + PxVec3& p0 = cornerPos[id0]; + PxVec3& p1 = cornerPos[id1]; + edgeVertId[edgeId] = vertices.size(); + vertices.pushBack((p0 + p1) * 0.5f); + cellOfVertex.pushBack(PxMax(cornerVoxelNr[id0], cornerVoxelNr[id1])); + } + triIds.pushBack(edgeVertId[edgeId]); + } + } + } + } + } + + removeDuplicateVertices(); + pruneInternalSurfaces(); + + project(inputVerts, inputTriIds, 2.0f * spacing, 0.1f * spacing); + + if (vertexMap) + createVertexMap(inputVerts, meshBounds.minimum, spacing, *vertexMap); + + computeNormals(); + } + + // ------------------------------------------------------------------------------------- + void Remesher::removeDuplicateVertices() + { + PxF32 eps = 1e-5f; + + struct Ref + { + PxF32 d; + PxI32 id; + bool operator < (const Ref& r) const + { + return d < r.d; + } + }; + + PxI32 numVerts = PxI32(vertices.size()); + + PxArray refs(numVerts); + for (PxI32 i = 0; i < numVerts; i++) + { + PxVec3& p = vertices[i]; + refs[i].d = p.x + 0.3f * p.y + 0.1f * p.z; + refs[i].id = i; + } + + PxSort(refs.begin(), refs.size()); + + PxArray idMap(vertices.size(), -1); + PxArray oldVerts = vertices; + PxArray oldCellOfVertex = cellOfVertex; + vertices.clear(); + cellOfVertex.clear(); + + PxI32 nr = 0; + while (nr < numVerts) + { + Ref& r = refs[nr]; + nr++; + if (idMap[r.id] >= 0) + continue; + idMap[r.id] = vertices.size(); + vertices.pushBack(oldVerts[r.id]); + cellOfVertex.pushBack(oldCellOfVertex[r.id]); + + PxI32 i = nr; + while (i < numVerts && fabsf(refs[i].d - r.d) < eps) + { + PxI32 id = refs[i].id; + if ((oldVerts[r.id] - oldVerts[id]).magnitudeSquared() < eps * eps) + idMap[id] = idMap[r.id]; + i++; + } + } + + for (PxI32 i = 0; i < PxI32(triIds.size()); i++) + triIds[i] = idMap[triIds[i]]; + } + + // ------------------------------------------------------------------------------------- + void Remesher::findTriNeighbors() + { + PxI32 numTris = PxI32(triIds.size()) / 3; + triNeighbors.clear(); + triNeighbors.resize(3 * numTris, -1); + + struct Edge + { + void init(PxI32 _id0, PxI32 _id1, PxI32 _triNr, PxI32 _edgeNr) + { + this->id0 = PxMin(_id0, _id1); + this->id1 = PxMax(_id0, _id1); + this->triNr = _triNr; + this->edgeNr = _edgeNr; + } + bool operator < (const Edge& e) const + { + if (id0 < e.id0) return true; + if (id0 > e.id0) return false; + return id1 < e.id1; + } + bool operator == (const Edge& e) const + { + return id0 == e.id0 && id1 == e.id1; + } + PxI32 id0, id1, triNr, edgeNr; + }; + + PxArray edges(triIds.size()); + + for (PxI32 i = 0; i < numTris; i++) + { + for (PxI32 j = 0; j < 3; j++) { + PxI32 id0 = triIds[3 * i + j]; + PxI32 id1 = triIds[3 * i + (j + 1) % 3]; + edges[3 * i + j].init(id0, id1, i, j); + } + } + PxSort(edges.begin(), edges.size()); + + PxI32 nr = 0; + while (nr < PxI32(edges.size())) + { + Edge& e0 = edges[nr]; + nr++; + while (nr < PxI32(edges.size()) && edges[nr] == e0) { + Edge& e1 = edges[nr]; + triNeighbors[3 * e0.triNr + e0.edgeNr] = e1.triNr; + triNeighbors[3 * e1.triNr + e1.edgeNr] = e0.triNr; + nr++; + } + } + } + + // ------------------------------------------------------------------------------------- + void Remesher::pruneInternalSurfaces() + { + // flood islands, if the enclosed volume is negative remove it + + findTriNeighbors(); + + PxI32 numTris = PxI32(triIds.size()) / 3; + + PxArray oldTriIds = triIds; + triIds.clear(); + + PxArray visited(numTris, false); + PxArray stack; + + for (PxI32 i = 0; i < numTris; i++) + { + if (visited[i]) + continue; + stack.clear(); + stack.pushBack(i); + PxI32 islandStart = PxI32(triIds.size()); + + float vol = 0.0f; + + while (!stack.empty()) + { + PxI32 triNr = stack.back(); + stack.popBack(); + if (visited[triNr]) + continue; + visited[triNr] = true; + for (PxI32 j = 0; j < 3; j++) + triIds.pushBack(oldTriIds[3 * triNr + j]); + + const PxVec3& p0 = vertices[oldTriIds[3 * triNr]]; + const PxVec3& p1 = vertices[oldTriIds[3 * triNr + 1]]; + const PxVec3& p2 = vertices[oldTriIds[3 * triNr + 2]]; + vol += p0.cross(p1).dot(p2); + + for (PxI32 j = 0; j < 3; j++) + { + PxI32 n = triNeighbors[3 * triNr + j]; + if (n >= 0 && !visited[n]) + stack.pushBack(n); + } + } + + if (vol <= 0.0f) + triIds.resize(islandStart); + } + + // remove unreferenced vertices + + PxArray idMap(vertices.size(), -1); + PxArray oldVerts = vertices; + PxArray oldCellOfVertex = cellOfVertex; + vertices.clear(); + cellOfVertex.clear(); + + for (int i = 0; i < PxI32(triIds.size()); i++) + { + PxI32 id = triIds[i]; + if (idMap[id] < 0) + { + idMap[id] = vertices.size(); + vertices.pushBack(oldVerts[id]); + cellOfVertex.pushBack(oldCellOfVertex[id]); + } + triIds[i] = idMap[id]; + } + } + + // ----------------------------------------------------------------------------------- + static void getClosestPointOnTriangle(const PxVec3& pos, const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, + PxVec3& closest, PxVec3& bary) + { + PxVec3 e0 = p1 - p0; + PxVec3 e1 = p2 - p0; + PxVec3 tmp = p0 - pos; + + float a = e0.dot(e0); + float b = e0.dot(e1); + float c = e1.dot(e1); + float d = e0.dot(tmp); + float e = e1.dot(tmp); + PxVec3 coords, clampedCoords; + coords.x = b * e - c * d; // s * det + coords.y = b * d - a * e; // t * det + coords.z = a * c - b * b; // det + + clampedCoords = PxVec3(PxZero); + if (coords.x <= 0.0f) + { + if (c != 0.0f) + clampedCoords.y = -e / c; + } + else if (coords.y <= 0.0f) + { + if (a != 0.0f) + clampedCoords.x = -d / a; + } + else if (coords.x + coords.y > coords.z) + { + float denominator = a + c - b - b; + float numerator = c + e - b - d; + if (denominator != 0.0f) + { + clampedCoords.x = numerator / denominator; + clampedCoords.y = 1.0f - clampedCoords.x; + } + } + else + { // all inside + if (coords.z != 0.0f) { + clampedCoords.x = coords.x / coords.z; + clampedCoords.y = coords.y / coords.z; + } + } + bary.y = PxMin(PxMax(clampedCoords.x, 0.0f), 1.0f); + bary.z = PxMin(PxMax(clampedCoords.y, 0.0f), 1.0f); + bary.x = 1.0f - bary.y - bary.z; + closest = p0 * bary.x + p1 * bary.y + p2 * bary.z; + } + + // ------------------------------------------------------------------------------------- + void Remesher::project(const PxArray& inputVerts, const PxArray& inputTriIds, + float searchDist, float surfaceDist) + { + // build a bvh for the input mesh + + PxI32 numInputTris = PxI32(inputTriIds.size()) / 3; + + if (numInputTris == 0) + return; + + bvhBounds.resize(numInputTris); + bvhTris.clear(); + + for (PxI32 i = 0; i < numInputTris; i++) { + PxBounds3& b = bvhBounds[i]; + b.setEmpty(); + b.include(inputVerts[inputTriIds[3 * i]]); + b.include(inputVerts[inputTriIds[3 * i + 1]]); + b.include(inputVerts[inputTriIds[3 * i + 2]]); + } + + BVHDesc bvh; + BVHBuilder::build(bvh, &bvhBounds[0], bvhBounds.size()); + + // project vertices to closest point on surface + + PxBounds3 pb; + for (PxI32 i = 0; i < PxI32(vertices.size()); i++) + { + PxVec3& p = vertices[i]; + pb.setEmpty(); + pb.include(p); + pb.fattenFast(searchDist); + bvh.query(pb, bvhTris); + + float minDist2 = PX_MAX_F32; + PxVec3 closest(PxZero); + + for (PxI32 j = 0; j < PxI32(bvhTris.size()); j++) + { + PxI32 triNr = bvhTris[j]; + const PxVec3& p0 = inputVerts[inputTriIds[3 * triNr]]; + const PxVec3& p1 = inputVerts[inputTriIds[3 * triNr + 1]]; + const PxVec3& p2 = inputVerts[inputTriIds[3 * triNr + 2]]; + PxVec3 c, bary; + getClosestPointOnTriangle(p, p0, p1, p2, c, bary); + float dist2 = (c - p).magnitudeSquared(); + if (dist2 < minDist2) { + minDist2 = dist2; + closest = c; + } + } + + if (minDist2 < PX_MAX_F32) { + PxVec3 n = p - closest; + n.normalize(); + p = closest + n * surfaceDist; + } + } + + } + + static const int cellNeighbors[6][3] = { { -1,0,0 }, {1,0,0},{0,-1,0},{0,1,0},{0,0,-1},{0,0,1} }; + + // ------------------------------------------------------------------------------------- + void Remesher::createVertexMap(const PxArray& inputVerts, const PxVec3 &gridOrigin, PxF32 &gridSpacing, + PxArray &vertexMap) + { + PxArray vertexOfCell(cells.size(), -1); + PxArray front[2]; + PxI32 frontNr = 0; + + // compute inverse links + + for (PxI32 i = 0; i < PxI32(vertices.size()); i++) + { + PxI32 cellNr = cellOfVertex[i]; + if (cellNr >= 0) + { + if (vertexOfCell[cellNr] < 0) { + vertexOfCell[cellNr] = i; + front[frontNr].pushBack(cellNr); + } + } + } + + // propagate cell->vertex links through the voxel mesh + + while (!front[frontNr].empty()) + { + front[1 - frontNr].clear(); + + for (PxI32 i = 0; i < PxI32(front[frontNr].size()); i++) + { + int cellNr = front[frontNr][i]; + Cell& c = cells[cellNr]; + for (PxI32 j = 0; j < 6; j++) + { + PxI32 n = getCellNr(c.xi + cellNeighbors[j][0], + c.yi + cellNeighbors[j][1], + c.zi + cellNeighbors[j][2]); + if (n >= 0 && vertexOfCell[n] < 0) { + vertexOfCell[n] = vertexOfCell[cellNr]; + front[1 - frontNr].pushBack(n); + } + } + } + frontNr = 1 - frontNr; + } + + // create the map + + vertexMap.clear(); + vertexMap.resize(inputVerts.size(), 0); + + for (int i = 0; i < PxI32(inputVerts.size()); i++) + { + const PxVec3& p = inputVerts[i]; + PxI32 xi = PxI32(PxFloor((p.x - gridOrigin.x) / gridSpacing)); + PxI32 yi = PxI32(PxFloor((p.y - gridOrigin.y) / gridSpacing)); + PxI32 zi = PxI32(PxFloor((p.z - gridOrigin.z) / gridSpacing)); + + PxI32 cellNr = getCellNr(xi, yi, zi); + vertexMap[i] = cellNr >= 0 ? vertexOfCell[cellNr] : 0; + } + } + + // ------------------------------------------------------------------------------------- + void Remesher::computeNormals() + { + normals.clear(); + normals.resize(vertices.size(), PxVec3(PxZero)); + + for (PxI32 i = 0; i < PxI32(triIds.size()); i += 3) + { + PxI32* ids = &triIds[i]; + + PxVec3& p0 = vertices[ids[0]]; + PxVec3& p1 = vertices[ids[1]]; + PxVec3& p2 = vertices[ids[2]]; + PxVec3 n = (p1 - p0).cross(p2 - p0); + normals[ids[0]] += n; + normals[ids[1]] += n; + normals[ids[2]] += n; + } + + for (PxI32 i = 0; i < PxI32(normals.size()); i++) + normals[i].normalize(); + } + + // ------------------------------------------------------------------------------------- + void Remesher::readBack(PxArray& outputVertices, PxArray& outputTriIds) + { + outputVertices = vertices; + outputTriIds.resize(triIds.size()); + for (PxU32 i = 0; i < triIds.size(); i++) + outputTriIds[i] = PxU32(triIds[i]); + } + } + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.h new file mode 100644 index 0000000..a42206e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtRemesher.h @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#ifndef EXT_REMESHER_H +#define EXT_REMESHER_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxArray.h" + +namespace physx +{ + namespace Ext + { + + // ------------------------------------------------------------------------------ + + class Remesher { + public: + + Remesher() {} + ~Remesher() {} + + void remesh(const PxArray& verts, const PxArray& triIds, PxI32 resolution = 100, PxArray *vertexMap = nullptr); + + void clear(); + void readBack(PxArray& vertices, PxArray& triIds); + + private: + PxArray vertices; + PxArray triIds; + + void addCell(PxI32 xi, PxI32 yi, PxI32 zi); + PxI32 getCellNr(PxI32 xi, PxI32 yi, PxI32 zi) const; + bool cellExists(PxI32 xi, PxI32 yi, PxI32 zi) const; + + void removeDuplicateVertices(); + void pruneInternalSurfaces(); + void computeNormals(); + void findTriNeighbors(); + + void project(const PxArray& inputVerts, const PxArray& inputTriIds, + float searchDist, float surfaceDist); + + void createVertexMap(const PxArray& inputVerts, const PxVec3 &gridOrigin, PxF32 &gridSpacing, + PxArray &vertexMap); + + // ------------------------------------------------------------------------------------- + struct Cell + { + void init(PxI32 _xi, PxI32 _yi, PxI32 _zi) { + this->xi = _xi; this->yi = _yi; this->zi = _zi; + this->next = -1; + } + PxI32 xi, yi, zi; + PxI32 next; + }; + + PxArray cells; + PxArray firstCell; + PxArray normals; + PxArray triNeighbors; + PxArray cellOfVertex; + + PxArray bvhBounds; + PxArray bvhTris; + }; + } +} + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp new file mode 100644 index 0000000..82d39a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.cpp @@ -0,0 +1,802 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtTetSplitting.h" +#include "ExtUtilities.h" +#include "foundation/PxBasicTemplates.h" + +namespace physx +{ +namespace Ext +{ + //Last four bits are used + //Last bit set stands for A + //Second last bit stands for B + //Third last bit stands for C + //Fourth last bit stands for D + + typedef PxU32 TetCorner; + typedef PxU32 TetEdge; + + static const TetCorner None = 0x00000000; + static const TetCorner A = 0x00000001; + static const TetCorner B = 0x00000002; + static const TetCorner C = 0x00000004; + static const TetCorner D = 0x00000008; + + static const TetEdge AB = 0x00000003; + static const TetEdge AC = 0x00000005; + static const TetEdge AD = 0x00000009; + static const TetEdge BC = 0x00000006; + static const TetEdge BD = 0x0000000A; + static const TetEdge CD = 0x0000000C; + + static const TetCorner tetCorners[4] = { A, B, C, D }; + + //Specifies which edges of a tetrahedron should get a point inserted (=split) + struct TetSubdivisionInfo + { + //If an index has value -1 then this means that this edge won't get split + PxI32 ab; + PxI32 ac; + PxI32 ad; + + PxI32 bc; + PxI32 bd; + + PxI32 cd; + + Tetrahedron tet; + PxI32 id; + + PX_FORCE_INLINE TetSubdivisionInfo() : ab(-1), ac(-1), ad(-1), bc(-1), bd(-1), cd(-1), tet(Tetrahedron(-1, -1, -1, -1)), id(-1) {} + + PX_FORCE_INLINE TetSubdivisionInfo(Tetrahedron tet_, PxI32 aBPointInsertIndex, PxI32 aCPointInsertIndex, PxI32 aDPointInsertIndex, + PxI32 bCPointInsertIndex, PxI32 bDPointInsertIndex, PxI32 cDPointInsertIndex, PxI32 id_ = -1) : + ab(aBPointInsertIndex), ac(aCPointInsertIndex), ad(aDPointInsertIndex), bc(bCPointInsertIndex), bd(bDPointInsertIndex), cd(cDPointInsertIndex), tet(tet_), id(id_) + { } + + PX_FORCE_INLINE void swapInternal(TetCorner corner1, TetCorner corner2, TetCorner& cornerToProcess) + { + if (cornerToProcess == corner1) + cornerToProcess = corner2; + else if (cornerToProcess == corner2) + cornerToProcess = corner1; + } + + //Helper method for sorting + template + void swap(T& a, T& b) + { + T tmp = a; + a = b; + b = tmp; + } + + //Helper method for sorting + bool swap(TetCorner corner1, TetCorner corner2, TetCorner& additionalCornerToProcess1, TetCorner& additionalCornerToProcess2) + { + swapInternal(corner1, corner2, additionalCornerToProcess1); + swapInternal(corner1, corner2, additionalCornerToProcess2); + return swap(corner1, corner2); + } + + //Helper method for sorting + bool swap(TetCorner corner1, TetCorner corner2, TetCorner& additionalCornerToProcess) + { + swapInternal(corner1, corner2, additionalCornerToProcess); + return swap(corner1, corner2); + } + + //Helper method for sorting + bool swap(TetCorner corner1, TetCorner corner2) + { + if (corner1 == corner2) + return false; + + if (corner1 > corner2) + { + TetCorner tmp = corner1; + corner1 = corner2; + corner2 = tmp; + } + + if (corner1 == A && corner2 == B) + { + PxSwap(ad, bd); + PxSwap(ac, bc); + PxSwap(tet[0], tet[1]); + } + else if (corner1 == A && corner2 == C) + { + PxSwap(ad, cd); + PxSwap(ab, bc); + PxSwap(tet[0], tet[2]); + } + else if (corner1 == A && corner2 == D) + { + PxSwap(ac, cd); + PxSwap(ab, bd); + PxSwap(tet[0], tet[3]); + } + else if (corner1 == B && corner2 == C) + { + PxSwap(ac, ab); + PxSwap(cd, bd); + PxSwap(tet[1], tet[2]); + } + else if (corner1 == B && corner2 == D) + { + PxSwap(ab, ad); + PxSwap(bc, cd); + PxSwap(tet[1], tet[3]); + } + else if (corner1 == C && corner2 == D) + { + PxSwap(ac, ad); + PxSwap(bc, bd); + PxSwap(tet[2], tet[3]); + } + return true; + } + + //Allows to sort the information such that edges of neighboring tets have the same orientation + PxI32 sort() + { + PxI32 counter = 0; + if (tet[0] > tet[1]) { swap(A, B); ++counter; } + if (tet[0] > tet[2]) { swap(A, C); ++counter; } + if (tet[0] > tet[3]) { swap(A, D); ++counter; } + + if (tet[1] > tet[2]) { swap(B, C); ++counter; } + if (tet[1] > tet[3]) { swap(B, D); ++counter; } + if (tet[2] > tet[3]) { swap(C, D); ++counter; } + return counter; + } + }; + + //Returns true if the edge is adjacent to the specified corner + PX_FORCE_INLINE bool edgeContainsCorner(TetEdge edge, TetCorner corner) + { + return (edge & corner) != 0; + } + + //Returns the common point of two edges, will be None if there is no common point + PX_FORCE_INLINE TetCorner getCommonPoint(TetEdge edge1, TetEdge edge2) + { + return edge1 & edge2; + } + + //Extracts the global indices from a tet given a local edge + Edge getTetEdge(const Tetrahedron& tet, TetEdge edge) + { + switch (edge) + { + case AB: + return Edge(tet[0], tet[1]); + case AC: + return Edge(tet[0], tet[2]); + case AD: + return Edge(tet[0], tet[3]); + case BC: + return Edge(tet[1], tet[2]); + case BD: + return Edge(tet[1], tet[3]); + case CD: + return Edge(tet[2], tet[3]); + } + return Edge(-1, -1); + } + + TetCorner getStart(TetEdge e) + { + switch (e) + { + case AB: + return A; + case AC: + return A; + case AD: + return A; + case BC: + return B; + case BD: + return B; + case CD: + return C; + } + return None; + } + + TetCorner getEnd(TetEdge e) + { + switch (e) + { + case AB: + return B; + case AC: + return C; + case AD: + return D; + case BC: + return C; + case BD: + return D; + case CD: + return D; + } + return None; + } + + PX_FORCE_INLINE TetEdge getOppositeEdge(TetEdge edge) + { + return 0x0000000F ^ edge; + } + + //Finds the index of the first instance of value in list + PxI32 getIndexOfFirstValue(PxI32 list[4], PxI32 value = 0, PxI32 startAt = 0) + { + for (PxI32 i = startAt; i < 4; ++i) + if (list[i] == value) + return i; + return -1; + } + + //Counts how many times every corner is referenced by the specified set of edges - useful for corner classification + void getCornerAccessCounter(TetEdge edges[6], PxI32 edgesLength, PxI32 cornerAccessCounter[4]) + { + for (PxI32 i = 0; i < 4; ++i) + cornerAccessCounter[i] = 0; + + for (PxI32 j = 0; j < edgesLength; ++j) + { + switch (edges[j]) + { + case AB: + ++cornerAccessCounter[0]; + ++cornerAccessCounter[1]; + break; + case AC: + ++cornerAccessCounter[0]; + ++cornerAccessCounter[2]; + break; + case AD: + ++cornerAccessCounter[0]; + ++cornerAccessCounter[3]; + break; + case BC: + ++cornerAccessCounter[1]; + ++cornerAccessCounter[2]; + break; + case BD: + ++cornerAccessCounter[1]; + ++cornerAccessCounter[3]; + break; + case CD: + ++cornerAccessCounter[2]; + ++cornerAccessCounter[3]; + break; + } + } + } + + //Returns the tet's edge that does not contain corner1 and neither corner2 + Edge getRemainingEdge(const Tetrahedron& tet, PxI32 corner1, PxI32 corner2) + { + PxI32 indexer = 0; + Edge result(-1, -1); + for (PxU32 i = 0; i < 4; ++i) + { + if (tet[i] != corner1 && tet[i] != corner2) + { + if (indexer == 0) + result.first = tet[i]; + else if (indexer == 1) + result.second = tet[i]; + ++indexer; + } + } + return result; + } + + PX_FORCE_INLINE TetCorner getOtherCorner(TetEdge edge, TetCorner corner) + { + return edge ^ corner; + } + + PX_FORCE_INLINE Tetrahedron flip(bool doFlip, Tetrahedron t) + { + if (doFlip) PxSwap(t[2], t[3]); + return t; + } + + //Splits all tets according to the specification in tetSubdivisionInfos. The resulting mesh will be watertight if the tetSubdivisionInfos are specified such + //that all tets sharing and edge will get the same point inserted on their corresponding edge + void split(PxArray& tets, const PxArray& points, const PxArray& tetSubdivisionInfos) + { + PxU32 originalNumTets = tets.size(); + for (PxU32 i = 0; i < originalNumTets; ++i) + { + TetSubdivisionInfo info = tetSubdivisionInfos[i]; + PxI32 counter = info.sort(); + + TetEdge splitEdges[6]; + PxI32 splitEdgesLength = 0; + TetEdge nonSplitEdges[6]; + PxI32 nonSplitEdgesLength = 0; + PxI32 insertionIndices[6]; + PxI32 insertionIndicesLength = 0; + if (info.ab >= 0) { splitEdges[splitEdgesLength++] = AB; insertionIndices[insertionIndicesLength++] = info.ab; } + else nonSplitEdges[nonSplitEdgesLength++] = AB; + if (info.ac >= 0) { splitEdges[splitEdgesLength++] = AC; insertionIndices[insertionIndicesLength++] = info.ac; } + else nonSplitEdges[nonSplitEdgesLength++] = AC; + if (info.ad >= 0) { splitEdges[splitEdgesLength++] = AD; insertionIndices[insertionIndicesLength++] = info.ad; } + else nonSplitEdges[nonSplitEdgesLength++] = AD; + + if (info.bc >= 0) { splitEdges[splitEdgesLength++] = BC; insertionIndices[insertionIndicesLength++] = info.bc; } + else nonSplitEdges[nonSplitEdgesLength++] = BC; + if (info.bd >= 0) { splitEdges[splitEdgesLength++] = BD; insertionIndices[insertionIndicesLength++] = info.bd; } + else nonSplitEdges[nonSplitEdgesLength++] = BD; + + if (info.cd >= 0) { splitEdges[splitEdgesLength++] = CD; insertionIndices[insertionIndicesLength++] = info.cd; } + else nonSplitEdges[nonSplitEdgesLength++] = CD; + + //Depending on how many tet edges get a point inserted, a different topology results. + //The created topology will make sure all neighboring tet faces will be tessellated identically to keep the mesh watertight + switch (splitEdgesLength) + { + case 0: + //Nothing to do here + break; + case 1: + { + PxI32 pointIndex = insertionIndices[0]; + Edge splitEdge = getTetEdge(info.tet, splitEdges[0]); + + Edge oppositeEdge = getTetEdge(info.tet, getOppositeEdge(splitEdges[0])); + + tets[i] = Tetrahedron(oppositeEdge.first, oppositeEdge.second, splitEdge.first, pointIndex); + tets.pushBack(Tetrahedron(oppositeEdge.first, oppositeEdge.second, pointIndex, splitEdge.second)); + + break; + } + case 2: + { + TetCorner corner = getCommonPoint(splitEdges[0], splitEdges[1]); + if (corner != None) + { + //edges have a common point + //Rearrange such that common corner is a and first edge is from a to b while second edge is from a to c + TetCorner p1 = getOtherCorner(splitEdges[0], corner); + TetCorner p2 = getOtherCorner(splitEdges[1], corner); + if (info.swap(corner, A, p1, p2)) ++counter; + if (info.swap(p1, B, p2)) ++counter; + if (info.swap(p2, C)) ++counter; + + if (info.tet[1] > info.tet[2]) + { + if (info.swap(B, C)) ++counter; + } + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[0], info.tet[3], info.ab, info.ac)); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.tet[1], info.ab, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.tet[2], info.tet[1], info.ac))); + } + else + { + //Edges don't have a common point (opposite edges) + TetEdge edge1 = splitEdges[0]; + //TetEdge edge2 = splitEdges[1]; + + //Permute the tetrahedron such that edge1 becomes the edge AB + if (info.swap(getStart(edge1), A)) ++counter; + if (info.swap(getEnd(edge1), B)) ++counter; + + if (info.tet[0] > info.tet[1]) + { + if (info.swap(A, B)) ++counter; + } + if (info.tet[2] > info.tet[3]) + { + if (info.swap(C, D)) ++counter; + } + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[0], info.ab, info.tet[2], info.cd)); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.ab, info.cd, info.tet[2]))); + + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ab, info.cd, info.tet[3]))); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.ab, info.tet[3], info.cd))); + } + break; + } + case 3: + { + //There are three sub cases called a, b and c + TetCorner commonPoint01 = getCommonPoint(splitEdges[0], splitEdges[1]); + TetCorner commonPoint02 = getCommonPoint(splitEdges[0], splitEdges[2]); + TetCorner commonPoint12 = getCommonPoint(splitEdges[1], splitEdges[2]); + if (commonPoint01 == None || commonPoint02 == None || commonPoint12 == None) + { + //The three edges form a non closed strip + //The strip's end points are connected by a tet edge - map this edge such that it becomes edge AB + //Then sort AB + + PxI32 cnt[4]; + getCornerAccessCounter(splitEdges, splitEdgesLength, cnt); + + PxI32 index = getIndexOfFirstValue(cnt, 1); + TetCorner refStart = tetCorners[index]; + TetCorner refEnd = tetCorners[getIndexOfFirstValue(cnt, 1, index + 1)]; + + + TetCorner cornerToMapOntoC = None; + if (edgeContainsCorner(splitEdges[0], refEnd)) + { + cornerToMapOntoC = getOtherCorner(splitEdges[0], refEnd); + } + else if (edgeContainsCorner(splitEdges[1], refEnd)) + { + cornerToMapOntoC = getOtherCorner(splitEdges[1], refEnd); + } + else if (edgeContainsCorner(splitEdges[2], refEnd)) + { + cornerToMapOntoC = getOtherCorner(splitEdges[2], refEnd); + } + + if (info.swap(refStart, A, refEnd, cornerToMapOntoC)) ++counter; + if (info.swap(refEnd, B, cornerToMapOntoC)) ++counter; + if (info.swap(cornerToMapOntoC, C)) ++counter; + + if (info.tet[0] > info.tet[1]) + { + if (info.swap(A, B)) ++counter; + if (info.swap(C, D)) ++counter; + } + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[0], info.tet[1], info.bc, info.ad)); + + if (info.tet[0] > info.tet[2]) + { + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.cd, info.ad, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[2], info.ad, info.bc))); + } + else + { + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[2], info.cd, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ad, info.bc, info.cd))); + } + + if (info.tet[1] > info.tet[3]) + { + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.bc, info.ad, info.cd))); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.tet[1], info.ad, info.bc))); + } + else + { + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.tet[3], info.cd, info.ad))); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.bc, info.ad, info.cd))); + } + } + else if (edgeContainsCorner(splitEdges[2], commonPoint01)) + { + //All three edges share one common point + //Permute tetrahedron such that the common tip point is a + if (info.swap(commonPoint01, A)) ++counter; + //Sort the remaining values + if (info.tet[1] > info.tet[2]) + { + if (info.swap(B, C)) ++counter; + } + if (info.tet[2] > info.tet[3]) + { + if (info.swap(C, D)) ++counter; + } + if (info.tet[1] > info.tet[2]) + { + if (info.swap(B, C)) ++counter; + } + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[0], info.ab, info.ac, info.ad)); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.ab, info.ad, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.tet[1], info.ad, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.tet[2], info.ad, info.tet[3]))); + } + else + { + //Edges form a triangle + //Rearrange such that point opposite of triangle loop is point d + //Triangle loop is a, b and c, make sure they're sorted + + if (!(commonPoint01 == A || commonPoint02 == A || commonPoint12 == A)) + { + if (info.swap(A, D)) ++counter; + } + else if (!(commonPoint01 == B || commonPoint02 == B || commonPoint12 == B)) + { + if (info.swap(B, D)) ++counter; + } + else if (!(commonPoint01 == C || commonPoint02 == C || commonPoint12 == C)) + { + if (info.swap(C, D)) ++counter; + } + else if (!(commonPoint01 == D || commonPoint02 == D || commonPoint12 == D)) + { + if (info.swap(D, D)) ++counter; + } + + //Sort a,b and c + if (info.tet[0] > info.tet[1]) + if (info.swap(A, B)) ++counter; + if (info.tet[1] > info.tet[2]) + if (info.swap(B, C)) ++counter; + if (info.tet[0] > info.tet[1]) + if (info.swap(A, B)) ++counter; + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[3], info.ab, info.ac, info.bc)); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.ab, info.ac, info.tet[0]))); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.ab, info.bc, info.tet[1]))); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.ac, info.bc, info.tet[2]))); + } + break; + } + case 4: + { + TetCorner commonPoint = getCommonPoint(nonSplitEdges[0], nonSplitEdges[1]); + + if (commonPoint != None) + { + //Three edges form a triangle and the two edges that are not split share a common point + TetCorner p1 = getOtherCorner(nonSplitEdges[0], commonPoint); + TetCorner p2 = getOtherCorner(nonSplitEdges[1], commonPoint); + + if (info.swap(commonPoint, A, p1, p2)) ++counter; + + if (info.swap(p1, B, p2)) ++counter; + if (info.swap(p2, C)) ++counter; + + if (info.tet[1] > info.tet[2]) + if (info.swap(B, C)) ++counter; + + const bool f = counter % 2 == 0; + + //Tip + tets[i] = flip(f, Tetrahedron(info.tet[3], info.ad, info.bd, info.cd)); + + //Center + tets.pushBack(flip(f, Tetrahedron(info.bd, info.ad, info.bc, info.cd))); + + if (info.tet[0] < info.tet[1] && info.tet[0] < info.tet[2]) + { + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[1], info.bd, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[2], info.bc, info.cd))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.bc, info.bd, info.ad))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.bc, info.ad, info.cd))); + } + else if (info.tet[0] > info.tet[1] && info.tet[0] < info.tet[2]) + { + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[2], info.bc, info.cd))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.bc, info.ad, info.cd))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[1], info.ad, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.bc, info.bd, info.ad))); + } + else + { + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[1], info.ad, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[1], info.bc, info.bd, info.ad))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.tet[0], info.ad, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.bc, info.ad, info.cd))); + } + } + else + { + //All four edges form a loop + TetEdge edge1 = nonSplitEdges[0]; + + //Permute the tetrahedron such that edge1 becomes the edge AB + TetCorner end = getEnd(edge1); + if (info.swap(getStart(edge1), A, end)) ++counter; + if (info.swap(end, B)) ++counter; + + //Sort + if (info.tet[0] > info.tet[1]) + if (info.swap(A, B)) ++counter; + if (info.tet[2] > info.tet[3]) + if (info.swap(C, D)) ++counter; + + const bool f = counter % 2 == 1; + + tets[i] = flip(f, Tetrahedron(info.tet[0], info.tet[1], info.bc, info.bd)); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.tet[3], info.ad, info.bd))); + + PxF64 dist1 = (points[info.ad] - points[info.bc]).magnitudeSquared(); + PxF64 dist2 = (points[info.ac] - points[info.bd]).magnitudeSquared(); + + if (dist1 < dist2) + { + //Diagonal from AD to BC + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ad, info.bc, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ad, info.bd, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.ad, info.ac, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.ad, info.bc, info.bd))); + } + else + { + //Diagonal from AC to BD + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ad, info.bd, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ac, info.bd, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.bc, info.bd, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[2], info.bd, info.ad, info.ac))); + } + } + break; + } + case 5: + { + //There is only one edge that does not get split + + //First create 2 small tetrahedra in every corner that is not an end point of the unsplit edge + TetEdge nonSplitEdge; + if (info.ab < 0) + nonSplitEdge = AB; + else if (info.ac < 0) + nonSplitEdge = AC; + else if (info.ad < 0) + nonSplitEdge = AD; + else if (info.bc < 0) + nonSplitEdge = BC; + else if (info.bd < 0) + nonSplitEdge = BD; + else //if (info.CDPointInsertIndex < 0) + nonSplitEdge = CD; + + TetCorner end = getEnd(nonSplitEdge); + if (info.swap(getStart(nonSplitEdge), A, end)) ++counter; + if (info.swap(end, B)) ++counter; + + if (info.tet[0] > info.tet[1]) + if (info.swap(A, B)) ++counter; + if (info.tet[2] > info.tet[3]) + if (info.swap(C, D)) ++counter; + + const bool f = counter % 2 == 1; + + //Two corner tets at corner C and corner D + tets[i] = flip(f, Tetrahedron(info.tet[2], info.ac, info.bc, info.cd)); + tets.pushBack(flip(f, Tetrahedron(info.tet[3], info.ad, info.cd, info.bd))); + + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.tet[1], info.bc, info.bd))); + + + //There are two possible diagonals -> take the shorter + PxF64 dist1 = (points[info.ac] - points[info.bd]).magnitudeSquared(); + PxF64 dist2 = (points[info.ad] - points[info.bc]).magnitudeSquared(); + if (dist1 < dist2) + { + //Diagonal from AC to BD + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ad, info.bd, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ac, info.bd, info.bc))); + //Tip pyramid + tets.pushBack(flip(f, Tetrahedron(info.cd, info.bc, info.bd, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.cd, info.bd, info.ad, info.ac))); + } + else + { + //Diagonal from AD to BC + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.ac, info.ad, info.bc))); + tets.pushBack(flip(f, Tetrahedron(info.tet[0], info.bd, info.bc, info.ad))); + //Tip pyramid + tets.pushBack(flip(f, Tetrahedron(info.cd, info.bc, info.ad, info.ac))); + tets.pushBack(flip(f, Tetrahedron(info.cd, info.bd, info.ad, info.bc))); + } + break; + } + case 6: + { + //First create a small tetrahedron in every corner + const bool f = counter % 2 == 1; + if (f) + info.swap(A, B); + + tets[i] = Tetrahedron(info.tet[0], info.ab, info.ac, info.ad); + tets.pushBack(Tetrahedron(info.tet[1], info.ab, info.bd, info.bc)); + tets.pushBack(Tetrahedron(info.tet[2], info.ac, info.bc, info.cd)); + tets.pushBack(Tetrahedron(info.tet[3], info.ad, info.cd, info.bd)); + + //Now fill the remaining octahedron in the middle + //An octahedron can be constructed using 4 tetrahedra + //There are three diagonal candidates -> pick the shortest diagonal + PxF64 dist1 = (points[info.ab] - points[info.cd]).magnitudeSquared(); + PxF64 dist2 = (points[info.ac] - points[info.bd]).magnitudeSquared(); + PxF64 dist3 = (points[info.ad] - points[info.bc]).magnitudeSquared(); + + if (dist1 <= dist2 && dist1 <= dist3) + { + tets.pushBack(Tetrahedron(info.ab, info.cd, info.ad, info.bd)); + tets.pushBack(Tetrahedron(info.ab, info.cd, info.bd, info.bc)); + tets.pushBack(Tetrahedron(info.ab, info.cd, info.bc, info.ac)); + tets.pushBack(Tetrahedron(info.ab, info.cd, info.ac, info.ad)); + } + else if (dist2 <= dist1 && dist2 <= dist3) + { + tets.pushBack(Tetrahedron(info.ac, info.bd, info.cd, info.ad)); + tets.pushBack(Tetrahedron(info.ac, info.bd, info.ad, info.ab)); + tets.pushBack(Tetrahedron(info.ac, info.bd, info.ab, info.bc)); + tets.pushBack(Tetrahedron(info.ac, info.bd, info.bc, info.cd)); + } + else + { + tets.pushBack(Tetrahedron(info.ad, info.bc, info.bd, info.ab)); + tets.pushBack(Tetrahedron(info.ad, info.bc, info.cd, info.bd)); + tets.pushBack(Tetrahedron(info.ad, info.bc, info.ac, info.cd)); + tets.pushBack(Tetrahedron(info.ad, info.bc, info.ab, info.ac)); + } + break; + } + } + } + } + + void split(PxArray& tets, const PxArray& points, const PxHashMap& edgesToSplit) + { + PxArray subdivisionInfos; + subdivisionInfos.resize(tets.size()); + for (PxU32 i = 0; i < tets.size(); ++i) + { + const Tetrahedron& tet = tets[i]; + TetSubdivisionInfo info(tet, -1, -1, -1, -1, -1, -1, i); + + if (const PxPair* ptr = edgesToSplit.find(key(tet[0], tet[1]))) + info.ab = ptr->second; + if (const PxPair* ptr = edgesToSplit.find(key(tet[0], tet[2]))) + info.ac = ptr->second; + if (const PxPair* ptr = edgesToSplit.find(key(tet[0], tet[3]))) + info.ad = ptr->second; + + if (const PxPair* ptr = edgesToSplit.find(key(tet[1], tet[2]))) + info.bc = ptr->second; + if (const PxPair* ptr = edgesToSplit.find(key(tet[1], tet[3]))) + info.bd = ptr->second; + + if (const PxPair* ptr = edgesToSplit.find(key(tet[2], tet[3]))) + info.cd = ptr->second; + + subdivisionInfos[i] = info; + } + + split(tets, points, subdivisionInfos); + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.h new file mode 100644 index 0000000..3b23bb7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetSplitting.h @@ -0,0 +1,49 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_TET_SPLITTING_H +#define EXT_TET_SPLITTING_H + +#include "ExtVec3.h" +#include "foundation/PxArray.h" +#include "foundation/PxHashMap.h" +#include "GuTetrahedron.h" + +namespace physx +{ +namespace Ext +{ + using Edge = PxPair; + using Tetrahedron = Gu::TetrahedronT; + + //Splits all edges specified in edgesToSplit. The tets are modified in place. The poitns referenced by index in the key-value pari in + //edgesToSplit must already pe present in the points array. This functions guarantees that the tetmesh will remain watertight. + PX_C_EXPORT void PX_CALL_CONV split(PxArray& tets, const PxArray& points, const PxHashMap& edgesToSplit); +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp new file mode 100644 index 0000000..29114ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.cpp @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ExtTetUnionFind.h" + +namespace physx +{ +namespace Ext +{ + //------------------------------------------------------------------------------------ + void UnionFind::init(PxI32 numSets) + { + mEntries.resize(numSets); + for (PxI32 i = 0; i < numSets; i++) { + Entry &e = mEntries[i]; + e.parent = i; + e.rank = 0; + e.setNr = i; + } + } + + //------------------------------------------------------------------------------------ + PxI32 UnionFind::find(PxI32 x) + { + if (mEntries[x].parent != x) + mEntries[x].parent = find(mEntries[x].parent); + return mEntries[x].parent; + } + + //------------------------------------------------------------------------------------ + void UnionFind::makeSet(PxI32 x, PxI32 y) + { + PxI32 xroot = find(x); + PxI32 yroot = find(y); + if (xroot == yroot) + return; + if (mEntries[xroot].rank < mEntries[yroot].rank) + mEntries[xroot].parent = yroot; + else if (mEntries[xroot].rank > mEntries[yroot].rank) + mEntries[yroot].parent = xroot; + else { + mEntries[yroot].parent = xroot; + mEntries[xroot].rank++; + } + } + + //------------------------------------------------------------------------------------ + PxI32 UnionFind::computeSetNrs() + { + PxArray oldToNew(mEntries.size(), -1); + PxI32 numSets = 0; + + for (PxU32 i = 0; i < mEntries.size(); i++) { + PxI32 nr = find(i); + if (oldToNew[nr] < 0) + oldToNew[nr] = numSets++; + mEntries[i].setNr = oldToNew[nr]; + } + return numSets; + } + + //------------------------------------------------------------------------------------ + PxI32 UnionFind::getSetNr(PxI32 x) + { + return mEntries[x].setNr; + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.h new file mode 100644 index 0000000..0de935c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtTetUnionFind.h @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef UNION_FIND_H +#define UNION_FIND_H + +#include "foundation/PxArray.h" + +namespace physx +{ +namespace Ext +{ + class UnionFind { + public: + UnionFind() {} + UnionFind(PxI32 numSets) { init(numSets); } + + void init(PxI32 numSets); + PxI32 find(PxI32 x); + void makeSet(PxI32 x, PxI32 y); + + PxI32 computeSetNrs(); + PxI32 getSetNr(PxI32 x); + + private: + struct Entry { + PxI32 parent, rank; + PxI32 setNr; + }; + + PxArray mEntries; + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp new file mode 100644 index 0000000..cca0a79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.cpp @@ -0,0 +1,57 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxAssert.h" +#include "ExtUtilities.h" +#include "GuAABBTreeBuildStats.h" +#include "foundation/PxFPU.h" + +namespace physx +{ +namespace Ext +{ + using namespace Gu; + + void buildTree(const PxU32* triangles, const PxU32 numTriangles, const Vec3* points, PxArray& tree, PxF32 enlargement) + { + //Computes a bounding box for every triangle in triangles + AABBTreeBounds boxes; + boxes.init(numTriangles); + for (PxU32 i = 0; i < numTriangles; ++i) + { + const PxU32* tri = &triangles[3 * i]; + PxBounds3 box = PxBounds3::empty(); + box.include(points[tri[0]].toFloat()); + box.include(points[tri[1]].toFloat()); + box.include(points[tri[2]].toFloat()); + box.fattenFast(enlargement); + boxes.getBounds()[i] = box; + } + + Gu::buildAABBTree(numTriangles, boxes, tree); + } +} +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.h new file mode 100644 index 0000000..8ebf70d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtUtilities.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_TET_CPU_BVH_H +#define EXT_TET_CPU_BVH_H + +#include "foundation/PxArray.h" + +#include "foundation/PxBounds3.h" + +#include "GuBVH.h" +#include "GuAABBTree.h" +#include "GuAABBTreeNode.h" +#include "GuAABBTreeBounds.h" +#include "GuAABBTreeQuery.h" +#include "GuTriangle.h" +#include "ExtVec3.h" + +namespace physx +{ +namespace Ext +{ + using Triangle = Gu::IndexedTriangleT; + + //Creates an unique 64bit bit key out of two 32bit values, the key is order independent, useful as hash key for edges + //Use this functions to compute the edge keys used in the edgesToSplit parameter of the split function below. + PX_FORCE_INLINE PxU64 key(PxI32 a, PxI32 b) + { + if (a < b) + return ((PxU64(a)) << 32) | (PxU64(b)); + else + return ((PxU64(b)) << 32) | (PxU64(a)); + } + + void buildTree(const PxU32* triangles, const PxU32 numTriangles, const Vec3* points, PxArray& tree, PxF32 enlargement = 1e-4f); + + //Builds a BVH from a set of triangles + PX_FORCE_INLINE void buildTree(const PxArray& triangles, const PxArray& points, PxArray& tree, PxF32 enlargement = 1e-4f) + { + buildTree(reinterpret_cast(triangles.begin()), triangles.size(), points.begin(), tree, enlargement); + } + + template + void traverseBVH(const PxArray& nodes, T& traversalController, PxI32 rootNodeIndex = 0) + { + traverseBVH(nodes.begin(), traversalController, rootNodeIndex); + } + + class IntersectionCollectingTraversalController + { + PxBounds3 box; + PxArray& candidateTriangleIndices; + + public: + IntersectionCollectingTraversalController(PxArray& candidateTriangleIndices_) : + box(PxBounds3::empty()), candidateTriangleIndices(candidateTriangleIndices_) + { } + + IntersectionCollectingTraversalController(const PxBounds3& box_, PxArray& candidateTriangleIndices_) : + box(box_), candidateTriangleIndices(candidateTriangleIndices_) + { } + + void reset(const PxBounds3& box_) + { + box = box_; + candidateTriangleIndices.clear(); + } + + Gu::TraversalControl::Enum analyze(const Gu::BVHNode& node, PxI32) + { + if (node.isLeaf()) + { + candidateTriangleIndices.pushBack(node.getPrimitiveIndex()); + return Gu::TraversalControl::eDontGoDeeper; + } + + if (node.mBV.intersects(box)) + return Gu::TraversalControl::eGoDeeper; + return Gu::TraversalControl::eDontGoDeeper; + } + private: + PX_NOCOPY(IntersectionCollectingTraversalController) + }; +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVec3.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVec3.h new file mode 100644 index 0000000..9331afc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVec3.h @@ -0,0 +1,208 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef EXT_VEC3_H +#define EXT_VEC3_H + +#include "foundation/PxMath.h" +#include "foundation/PxVec3.h" + +namespace physx +{ + namespace Ext + { + //3D vector class with double precision + class Vec3 + { + public: + PxF64 x; + PxF64 y; + PxF64 z; + + PX_FORCE_INLINE Vec3() : x(0), y(0), z(0) {} + + PX_FORCE_INLINE Vec3(const Vec3 &other) { x = other.x; y = other.y; z = other.z; } + + PX_FORCE_INLINE Vec3(PxF64 x_, PxF64 y_, PxF64 z_) : x(x_), y(y_), z(z_) + {} + + PX_FORCE_INLINE Vec3(PxF32 x_, PxF32 y_, PxF32 z_) : x(PxF64(x_)), y(PxF64(y_)), z(PxF64(z_)) + {} + + PX_FORCE_INLINE void set(PxF64 xCoord, PxF64 yCoord, PxF64 zCoord) + { + x = xCoord; + y = yCoord; + z = zCoord; + } + + PX_FORCE_INLINE PxVec3 toFloat() const + { + return PxVec3(PxF32(x), PxF32(y), PxF32(z)); + } + + PX_FORCE_INLINE Vec3 max(const Vec3& lhs) const + { + return Vec3(PxMax(x, lhs.x), PxMax(y, lhs.y), PxMax(z, lhs.z)); + } + + PX_FORCE_INLINE Vec3 min(const Vec3& lhs) const + { + return Vec3(PxMin(x, lhs.x), PxMin(y, lhs.y), PxMin(z, lhs.z)); + } + + PX_FORCE_INLINE PxF64 magnitudeSquared() const + { + return x * x + y * y + z * z; + } + + PX_FORCE_INLINE PxF64 magnitude() const + { + return PxSqrt(x * x + y * y + z * z); + } + + PX_FORCE_INLINE Vec3 getNormalized() const + { + PxF64 s = magnitudeSquared(); + if (s == 0) + return *this; + s = 1.0 / PxSqrt(s); + return Vec3(s * x, s * y, s * z); + } + + PX_FORCE_INLINE PxF64 dot(const Vec3& rhs) const + { + return x * rhs.x + y * rhs.y + z * rhs.z; + } + + PX_FORCE_INLINE Vec3 cross(const Vec3& v) const + { + return Vec3(y * v.z - z * v.y, z * v.x - x * v.z, x * v.y - y * v.x); + } + + PX_FORCE_INLINE Vec3 operator+(const Vec3& v) const + { + return Vec3(x + v.x, y + v.y, z + v.z); + } + + PX_FORCE_INLINE Vec3 operator-(const Vec3& v) const + { + return Vec3(x - v.x, y - v.y, z - v.z); + } + + PX_FORCE_INLINE Vec3 operator*(const PxF64& v) const + { + return Vec3(x * v, y * v, z * v); + } + + PX_FORCE_INLINE Vec3 operator/(const PxF64& v) const + { + PxF64 inv = 1.0 / v; + return Vec3(x * inv, y * inv, z * inv); + } + + PX_FORCE_INLINE Vec3& operator+=(const Vec3& v) + { + x += v.x; + y += v.y; + z += v.z; + return *this; + } + + PX_FORCE_INLINE Vec3& operator-=(const Vec3& v) + { + x -= v.x; + y -= v.y; + z -= v.z; + return *this; + } + + PX_FORCE_INLINE Vec3& operator*=(PxF64 f) + { + x *= f; + y *= f; + z *= f; + return *this; + } + + PX_FORCE_INLINE Vec3& operator/=(PxF64 f) + { + f = 1.0 / f; + x *= f; + y *= f; + z *= f; + return *this; + } + + PX_FORCE_INLINE PxF64& operator[](PxU32 index) + { + PX_ASSERT(index <= 2); + + return reinterpret_cast(this)[index]; + } + + PX_FORCE_INLINE const PxF64& operator[](PxU32 index) const + { + PX_ASSERT(index <= 2); + + return reinterpret_cast(this)[index]; + } + }; + + // --------------------------------------------------------------------------------- + struct Bounds3 { + Bounds3() {} + Bounds3(const Vec3 &min, const Vec3 &max) : minimum(min), maximum(max) {} + + void setEmpty() { + minimum = Vec3(PX_MAX_F64, PX_MAX_F64, PX_MAX_F64); + maximum = Vec3(-PX_MAX_F64, -PX_MAX_F64, -PX_MAX_F64); + } + + Vec3 getDimensions() const { + return maximum - minimum; + } + + void include(const Vec3 &p) { + minimum = minimum.min(p); + maximum = maximum.max(p); + } + + void include(const Bounds3 &b) { + minimum = minimum.min(b.minimum); + maximum = maximum.max(b.maximum); + } + void expand(double d) { + minimum -= Vec3(d, d, d); + maximum += Vec3(d, d, d); + } + Vec3 minimum, maximum; + }; + } +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp new file mode 100644 index 0000000..836d052 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.cpp @@ -0,0 +1,757 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "ExtVoxelTetrahedralizer.h" +#include "CmRandom.h" +#include "ExtTetUnionFind.h" + +namespace physx +{ + namespace Ext + { + // ------------------------------------------------------------------------------------- + static PxI32 cubeNeighbors[6][3] = { { -1,0,0 }, {1,0,0}, {0,-1,0}, {0,1,0}, {0,0,-1}, {0,0,1} }; + static const PxI32 cubeCorners[8][3] = { {0,0,0}, {1,0,0},{1,1,0},{0,1,0}, {0,0,1}, {1,0,1},{1,1,1},{0,1,1} }; + static const PxI32 cubeFaces[6][4] = { {0,3,7,4},{1,2,6,5},{0,1,5,4},{3,2,6,7},{0,1,2,3},{4,5,6,7} }; + static const PxI32 oppNeighbor[6] = { 1,0,3,2,5,4 }; + + static const PxI32 tetEdges[12][2] = { {0,1},{1,2},{2,0},{0,3},{1,3},{2,3}, {1,0},{2,1},{0,2},{3,0},{3,1},{3,2} }; + + static PxI32 cubeSixTets[6][4] = { + { 0, 4, 5, 7 },{ 1, 5, 6, 7 },{ 1, 0, 5, 7 },{ 1, 2, 3, 6 },{ 3, 1, 6, 7 },{ 0, 1, 3, 7 } }; + + static PxI32 cubeFiveTets[2][5][4] = { + { { 0, 1, 2, 5 },{ 0, 2, 3, 7 },{ 0, 5, 2, 7 },{ 0, 5, 7, 4 },{ 2, 7, 5, 6 } }, + { { 1, 2, 3, 6 },{ 1, 3, 0, 4 },{ 1, 6, 3, 4 },{ 1, 6, 4, 5 },{ 3, 4, 6, 7 } }, + }; + + static PxI32 cubeSixSubdivTets[12][4] = { + {0,4,5,8}, {0,5,1,8}, {3,2,6,8}, {3,6,7,8}, + {0,3,7,8}, {0,7,4,8}, {1,5,6,8}, {1,6,2,8}, + {0,1,3,8}, {1,2,3,8}, {5,4,7,8}, {5,7,6,8} + }; + + static PxI32 cubeFiveSubdivTets[2][12][4] = { + { + {0,1,2,8}, {0,2,3,8}, {4,7,5,8}, {5,7,6,8}, + {0,7,4,8}, {0,3,7,8}, {1,5,2,8}, {2,5,6,8}, + {0,5,1,8}, {0,4,5,8}, {3,2,7,8}, {2,6,7,8} + }, + { + {0,1,3,8}, {1,2,3,8}, {4,7,6,8}, {4,6,5,8}, + {0,3,4,8}, {3,7,4,8}, {1,5,6,8}, {1,6,2,8}, + {0,4,1,8}, {1,4,5,8}, {3,2,6,8}, {3,6,7,8} + } + }; + + static const PxI32 volIdOrder[4][3] = { {1, 3, 2}, {0, 2, 3}, {0, 3, 1}, {0, 1, 2} }; + + // ------------------------------------------------------------------------------------- + static bool boxTriangleIntersection( + PxVec3 p0, PxVec3 p1, PxVec3 p2, PxVec3 center, PxVec3 extents); + static void getClosestPointOnTriangle( + PxVec3 p1, PxVec3 p2, PxVec3 p3, PxVec3 p, PxVec3& closest, PxVec3& bary); + + // ------------------------------------------------------------------------------------- + VoxelTetrahedralizer::VoxelTetrahedralizer() + { + clear(); + } + + // ------------------------------------------------------------------------------------- + void VoxelTetrahedralizer::clear() + { + surfaceVerts.clear(); + surfaceTriIds.clear(); + surfaceBounds.setEmpty(); + + tetVerts.clear(); + origTetVerts.clear(); + isSurfaceVert.clear(); + targetVertPos.clear(); + + tetIds.clear(); + voxels.clear(); + gridOrigin = PxVec3(PxZero); + gridSpacing = 0.0f; + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::readBack(PxArray& _tetVertices, PxArray& _tetIndices) + { + _tetVertices = tetVerts; + _tetIndices.resize(tetIds.size()); + + for (PxU32 i = 0; i < tetIds.size(); i++) + _tetIndices[i] = PxU32(tetIds[i]); + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::createTetMesh(const PxArray& verts, const PxArray& triIds, + PxI32 resolution, PxI32 numRelaxationIters, PxF32 relMinTetVolume) + { + surfaceVerts = verts; + surfaceTriIds.resize(triIds.size()); + for (PxU32 i = 0; i < triIds.size(); i++) + surfaceTriIds[i] = triIds[i]; + + surfaceBounds.setEmpty(); + + for (PxU32 i = 0; i < surfaceVerts.size(); i++) + surfaceBounds.include(surfaceVerts[i]); + + buildBVH(); + + voxelize(resolution); + + bool subdivBorder = true; + int numTetsPerVoxel = 5; // or 6 + + createTets(subdivBorder, numTetsPerVoxel); + + findTargetPositions(0.2f * gridSpacing); + + relax(numRelaxationIters, relMinTetVolume); + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::buildBVH() + { + PxI32 numTris = PxI32(surfaceTriIds.size()) / 3; + + if (numTris == 0) + return; + + PxArray bvhBounds(numTris); + + for (PxI32 i = 0; i < numTris; i++) { + PxBounds3& b = bvhBounds[i]; + b.setEmpty(); + b.include(surfaceVerts[surfaceTriIds[3 * i]]); + b.include(surfaceVerts[surfaceTriIds[3 * i + 1]]); + b.include(surfaceVerts[surfaceTriIds[3 * i + 2]]); + } + + BVHBuilder::build(bvh, &bvhBounds[0], bvhBounds.size()); + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::voxelize(PxU32 resolution) + { + tetIds.clear(); + tetVerts.clear(); + + PxBounds3 meshBounds; + meshBounds.setEmpty(); + + for (PxU32 i = 0; i < surfaceVerts.size(); i++) + meshBounds.include(surfaceVerts[i]); + + gridSpacing = meshBounds.getDimensions().magnitude() / resolution; + meshBounds.fattenSafe(gridSpacing); + gridOrigin = meshBounds.minimum; + + voxels.clear(); + + PxI32 numX = PxI32((meshBounds.maximum.x - meshBounds.minimum.x) / gridSpacing) + 1; + PxI32 numY = PxI32((meshBounds.maximum.y - meshBounds.minimum.y) / gridSpacing) + 1; + PxI32 numZ = PxI32((meshBounds.maximum.z - meshBounds.minimum.z) / gridSpacing) + 1; + PxI32 numCells = numX * numY * numZ; + + PxArray voxelOfCell(numCells, -1); + PxBounds3 voxelBounds, faceBounds; + + // create intersected voxels + + for (PxI32 i = 0; i < numCells; i++) { + PxI32 zi = i % numZ; + PxI32 yi = (i / numZ) % numY; + PxI32 xi = (i / numZ / numY); + + voxelBounds.minimum = meshBounds.minimum + PxVec3(PxF32(xi), PxF32(yi), PxF32(zi)) * gridSpacing; + voxelBounds.maximum = voxelBounds.minimum + PxVec3(gridSpacing); + + bvh.query(voxelBounds, queryTris); + + for (PxU32 j = 0; j < queryTris.size(); j++) { + PxI32 triNr = queryTris[j]; + + const PxVec3& p0 = surfaceVerts[surfaceTriIds[3 * triNr]]; + const PxVec3& p1 = surfaceVerts[surfaceTriIds[3 * triNr + 1]]; + const PxVec3& p2 = surfaceVerts[surfaceTriIds[3 * triNr + 2]]; + + if (boxTriangleIntersection(p0, p1, p2, voxelBounds.getCenter(), voxelBounds.getExtents())) { + // volume + if (voxelOfCell[i] < 0) { + voxelOfCell[i] = voxels.size(); + voxels.resize(voxels.size() + 1); + voxels.back().init(xi, yi, zi); + } + } + } + } + + // flood outside + + PxArray stack; + stack.pushBack(0); + + while (!stack.empty()) { + PxI32 nr = stack.back(); + stack.popBack(); + + if (voxelOfCell[nr] == -1) { + voxelOfCell[nr] = -2; // outside + + PxI32 z0 = nr % numZ; + PxI32 y0 = (nr / numZ) % numY; + PxI32 x0 = (nr / numZ / numY); + + for (PxI32 i = 0; i < 6; i++) { + PxI32 xi = x0 + cubeNeighbors[i][0]; + PxI32 yi = y0 + cubeNeighbors[i][1]; + PxI32 zi = z0 + cubeNeighbors[i][2]; + if (xi >= 0 && xi < numX && yi >= 0 && yi < numY && zi >= 0 && zi < numZ) { + PxI32 adj = (xi * numY + yi) * numZ + zi; + if (voxelOfCell[adj] == -1) + stack.pushBack(adj); + } + } + } + } + + // create voxels for the inside + + for (PxI32 i = 0; i < numCells; i++) { + if (voxelOfCell[i] == -1) { + voxelOfCell[i] = voxels.size(); + voxels.resize(voxels.size() + 1); + PxI32 zi = i % numZ; + PxI32 yi = (i / numZ) % numY; + PxI32 xi = (i / numZ / numY); + voxels.back().init(xi, yi, zi); + voxels.back().inner = true; + } + } + + // find neighbors + + for (PxU32 i = 0; i < voxels.size(); i++) { + Voxel& v = voxels[i]; + + voxelBounds.minimum = meshBounds.minimum + PxVec3(PxF32(v.xi), PxF32(v.yi), PxF32(v.zi)) * gridSpacing; + voxelBounds.maximum = voxelBounds.minimum + PxVec3(gridSpacing); + + for (PxI32 j = 0; j < 6; j++) { + + PxI32 xi = v.xi + cubeNeighbors[j][0]; + PxI32 yi = v.yi + cubeNeighbors[j][1]; + PxI32 zi = v.zi + cubeNeighbors[j][2]; + + if (xi < 0 || xi >= numX || yi < 0 || yi >= numY || zi < 0 || zi >= numZ) + continue; + + PxI32 neighbor = voxelOfCell[(xi * numY + yi) * numZ + zi]; + if (neighbor < 0) + continue; + + if (v.inner || voxels[neighbor].inner) { + v.neighbors[j] = neighbor; + continue; + } + + faceBounds = voxelBounds; + PxF32 eps = 1e-4f; + switch (j) { + case 0: faceBounds.maximum.x = faceBounds.minimum.x + eps; break; + case 1: faceBounds.minimum.x = faceBounds.maximum.x - eps; break; + case 2: faceBounds.maximum.y = faceBounds.minimum.y + eps; break; + case 3: faceBounds.minimum.y = faceBounds.maximum.y - eps; break; + case 4: faceBounds.maximum.z = faceBounds.minimum.z + eps; break; + case 5: faceBounds.minimum.z = faceBounds.maximum.z - eps; break; + } + bvh.query(faceBounds, queryTris); + + bool intersected = false; + + for (PxU32 k = 0; k < queryTris.size(); k++) { + PxI32 triNr = queryTris[k]; + + const PxVec3& p0 = surfaceVerts[surfaceTriIds[3 * triNr]]; + const PxVec3& p1 = surfaceVerts[surfaceTriIds[3 * triNr + 1]]; + const PxVec3& p2 = surfaceVerts[surfaceTriIds[3 * triNr + 2]]; + + if (boxTriangleIntersection(p0, p1, p2, faceBounds.getCenter(), faceBounds.getExtents())) { + intersected = true; + break; + } + } + + if (intersected) + v.neighbors[j] = neighbor; + } + } + } + + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::createUniqueTetVertices() + { + // start with each voxel having its own vertices + + PxArray verts; + for (PxU32 i = 0; i < voxels.size(); i++) { + Voxel& v = voxels[i]; + + for (PxI32 j = 0; j < 8; j++) { + v.ids[j] = verts.size(); + verts.pushBack(gridOrigin + PxVec3( + PxF32(v.xi + cubeCorners[j][0]), + PxF32(v.yi + cubeCorners[j][1]), + PxF32(v.zi + cubeCorners[j][2])) * gridSpacing); + } + } + + // unify vertices + + UnionFind* u = new UnionFind(); + u->init(verts.size()); + + for (PxU32 i = 0; i < voxels.size(); i++) { + Voxel& v0 = voxels[i]; + for (PxI32 j = 0; j < 6; j++) { + PxI32 n = v0.neighbors[j]; + if (n < 0) + continue; + Voxel& v1 = voxels[n]; + + for (PxI32 k = 0; k < 4; k++) { + PxI32 id0 = v0.ids[cubeFaces[j][k]]; + PxI32 id1 = v1.ids[cubeFaces[oppNeighbor[j]][k]]; + u->makeSet(id0, id1); + } + } + } + + u->computeSetNrs(); + + tetVerts.clear(); + + for (PxU32 i = 0; i < voxels.size(); i++) { + Voxel& v = voxels[i]; + + for (PxI32 j = 0; j < 8; j++) { + PxI32 setNr = u->getSetNr(v.ids[j]); + if (PxI32(tetVerts.size()) <= setNr) + tetVerts.resize(setNr + 1, PxVec3(PxZero)); + tetVerts[setNr] = verts[v.ids[j]]; + v.ids[j] = setNr; + } + } + + origTetVerts = tetVerts; + + delete u; + } + + // ------------------------------------------------------------------------------------- + void VoxelTetrahedralizer::findTargetPositions(PxF32 surfaceDist) + { + targetVertPos = tetVerts; + + for (PxU32 i = 0; i < voxels.size(); i++) { + + Voxel& v = voxels[i]; + + PxBounds3 voxelBounds; + voxelBounds.minimum = gridOrigin + PxVec3(PxF32(v.xi), PxF32(v.yi), PxF32(v.zi)) * gridSpacing; + voxelBounds.maximum = voxelBounds.minimum + PxVec3(gridSpacing); + voxelBounds.fattenFast(0.1f * gridSpacing); + bvh.query(voxelBounds, queryTris); + + for (PxI32 j = 0; j < 8; j++) { + PxI32 id = v.ids[j]; + if (!isSurfaceVert[id]) + continue; + + PxVec3& p = tetVerts[id]; + + PxF32 minDist2 = PX_MAX_F32; + PxVec3 closest(PxZero); + + for (PxU32 k = 0; k < queryTris.size(); k++) { + + PxI32 triNr = queryTris[k]; + const PxVec3& p0 = surfaceVerts[surfaceTriIds[3 * triNr]]; + const PxVec3& p1 = surfaceVerts[surfaceTriIds[3 * triNr + 1]]; + const PxVec3& p2 = surfaceVerts[surfaceTriIds[3 * triNr + 2]]; + PxVec3 c, bary; + getClosestPointOnTriangle(p0, p1, p2, p, c, bary); + PxF32 dist2 = (c - p).magnitudeSquared(); + if (dist2 < minDist2) { + minDist2 = dist2; + closest = c; + } + } + if (minDist2 < PX_MAX_F32) { + PxVec3 n = p - closest; + n.normalize(); + targetVertPos[id] = closest + n * surfaceDist; + } + } + } + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::createTets(bool subdivBorder, PxU32 numTetsPerVoxel) + { + if (numTetsPerVoxel < 5 || numTetsPerVoxel > 6) + return; + + createUniqueTetVertices(); + + PxArray prevVoxels; + + PxArray numVertVoxels(tetVerts.size(), 0); + tetIds.clear(); + + for (PxU32 i = 0; i < voxels.size(); i++) { + Voxel& v = voxels[i]; + for (PxI32 j = 0; j < 8; j++) + numVertVoxels[v.ids[j]]++; + + PxI32 parity = (v.xi + v.yi + v.zi) % 2; + + if (v.inner || !subdivBorder) { + if (numTetsPerVoxel == 6) { + for (PxI32 j = 0; j < 6; j++) { + tetIds.pushBack(v.ids[cubeSixTets[j][0]]); + tetIds.pushBack(v.ids[cubeSixTets[j][1]]); + tetIds.pushBack(v.ids[cubeSixTets[j][2]]); + tetIds.pushBack(v.ids[cubeSixTets[j][3]]); + } + } + else if (numTetsPerVoxel == 5) { + for (PxI32 j = 0; j < 5; j++) { + tetIds.pushBack(v.ids[cubeFiveTets[parity][j][0]]); + tetIds.pushBack(v.ids[cubeFiveTets[parity][j][1]]); + tetIds.pushBack(v.ids[cubeFiveTets[parity][j][2]]); + tetIds.pushBack(v.ids[cubeFiveTets[parity][j][3]]); + } + } + } + else { + PxVec3 p(PxZero); + for (PxI32 j = 0; j < 8; j++) + p += tetVerts[v.ids[j]]; + p /= 8.0; + PxI32 newId = tetVerts.size(); + tetVerts.pushBack(p); + origTetVerts.pushBack(p); + numVertVoxels.pushBack(8); + + for (PxI32 j = 0; j < 12; j++) { + + const int* localIds; + if (numTetsPerVoxel == 6) + localIds = cubeSixSubdivTets[j]; + else + localIds = cubeFiveSubdivTets[parity][j]; + + for (PxI32 k = 0; k < 4; k++) { + PxI32 id = localIds[k] < 8 ? v.ids[localIds[k]] : newId; + tetIds.pushBack(id); + } + } + } + } + + isSurfaceVert.resize(tetVerts.size(), false); + for (PxU32 i = 0; i < tetVerts.size(); i++) + isSurfaceVert[i] = numVertVoxels[i] < 8; + + // randomize tets + + PxU32 numTets = tetIds.size() / 4; + + //for (PxU32 i = 0; i < numTets - 1; i++) { + // PxI32 ri = i + rand() % (numTets - i); + // for (PxI32 j = 0; j < 4; j++) { + // PxI32 id = tetIds[4 * i + j]; tetIds[4 * i + j] = tetIds[4 * ri + j]; tetIds[4 * ri + j] = id; + // } + //} + + // edges + + MultiList adjVerts; + edgeIds.clear(); + + adjVerts.clear(); + adjVerts.reserve(tetVerts.size()); + + for (PxU32 i = 0; i < numTets; i++) { + for (PxI32 j = 0; j < 6; j++) { + PxI32 id0 = tetIds[4 * i + tetEdges[j][0]]; + PxI32 id1 = tetIds[4 * i + tetEdges[j][1]]; + + if (!adjVerts.exists(id0, id1)) { + edgeIds.pushBack(id0); + edgeIds.pushBack(id1); + + adjVerts.addUnique(id0, id1); + adjVerts.addUnique(id1, id0); + } + } + } + } + + // ----------------------------------------------------------------------------------- + void VoxelTetrahedralizer::conserveVolume(PxF32 relMinVolume) + { + PxVec3 grads[4]; + PxU32 numTets = tetIds.size() / 4; + + for (PxU32 i = 0; i < numTets; i++) { + PxI32* ids = &tetIds[4 * i]; + + PxF32 w = 0.0f; + + for (PxI32 j = 0; j < 4; j++) { + PxI32 id0 = ids[volIdOrder[j][0]]; + PxI32 id1 = ids[volIdOrder[j][1]]; + PxI32 id2 = ids[volIdOrder[j][2]]; + + grads[j] = (tetVerts[id1] - tetVerts[id0]).cross(tetVerts[id2] - tetVerts[id0]); + w += grads[j].magnitudeSquared(); + } + + if (w == 0.0f) + continue; + + PxVec3& p0 = tetVerts[ids[0]]; + PxF32 V = (tetVerts[ids[1]] - p0).cross(tetVerts[ids[2]] - p0).dot(tetVerts[ids[3]] - p0); + + PxVec3& origP0 = origTetVerts[ids[0]]; + PxF32 origV = (origTetVerts[ids[1]] - origP0).cross(origTetVerts[ids[2]] - origP0).dot(origTetVerts[ids[3]] - origP0); + + PxF32 minV = relMinVolume * origV; + + if (V < minV) { + + PxF32 C = V - minV; + PxF32 lambda = -C / w; + + for (PxI32 j = 0; j < 4; j++) { + tetVerts[ids[j]] += grads[j] * lambda; + } + } + } + } + + // ------------------------------------------------------------------------------------- + void VoxelTetrahedralizer::relax(PxI32 numIters, PxF32 relMinVolume) + { + const PxF32 targetScale = 0.3f; + const PxF32 edgeScale = 0.3f; + + for (PxI32 iter = 0; iter < numIters; iter++) { + PxU32 numVerts = tetVerts.size(); + + for (PxU32 i = 0; i < numVerts; i++) { + if (isSurfaceVert[i]) { + PxVec3 offset = (targetVertPos[i] - tetVerts[i]) * targetScale; + tetVerts[i] += offset; + } + } + + for (PxU32 i = 0; i < edgeIds.size(); i += 2) { + PxI32 id0 = edgeIds[i]; + PxI32 id1 = edgeIds[i + 1]; + PxF32 w0 = isSurfaceVert[id0] ? 0.0f : 1.0f; + PxF32 w1 = isSurfaceVert[id1] ? 0.0f : 1.0f; + PxF32 w = w0 + w1; + if (w == 0.0f) + continue; + PxVec3& p0 = tetVerts[id0]; + PxVec3& p1 = tetVerts[id1]; + + PxVec3 e = (p1 - p0) * edgeScale; + + if (w == 1.0f) + e *= 0.5f; + + p0 += w0 / w * e; + p1 -= w1 / w * e; + } + conserveVolume(relMinVolume); + } + + PxI32 volIters = 2; + + for (PxI32 volIter = 0; volIter < volIters; volIter++) + conserveVolume(relMinVolume); + } + + // ----------------------------------------------------------------------------------- + static PxF32 max3(PxF32 f0, PxF32 f1, PxF32 f2) { + return PxMax(f0, PxMax(f1, f2)); + } + + static PxF32 min3(PxF32 f0, PxF32 f1, PxF32 f2) { + return PxMin(f0, PxMin(f1, f2)); + } + + static PxF32 minMax(PxF32 f0, PxF32 f1, PxF32 f2) { + return PxMax(-max3(f0, f1, f2), min3(f0, f1, f2)); + } + + // ----------------------------------------------------------------------------------- + static bool boxTriangleIntersection( + PxVec3 p0, PxVec3 p1, PxVec3 p2, PxVec3 center, PxVec3 extents) + { + PxVec3 v0 = p0 - center, v1 = p1 - center, v2 = p2 - center; + PxVec3 f0 = p1 - p0, f1 = p2 - p1, f2 = p0 - p2; + PxF32 r; + + PxVec3 n = f0.cross(f1); + PxF32 d = n.dot(v0); + r = extents.x * fabsf(n.x) + extents.y * fabsf(n.y) + extents.z * fabsf(n.z); + if (d > r || d < -r) + return false; + + if (max3(v0.x, v1.x, v2.x) < -extents.x || min3(v0.x, v1.x, v2.x) > extents.x) + return false; + + if (max3(v0.y, v1.y, v2.y) < -extents.y || min3(v0.y, v1.y, v2.y) > extents.y) + return false; + + if (max3(v0.z, v1.z, v2.z) < -extents.z || min3(v0.z, v1.z, v2.z) > extents.z) + return false; + + PxVec3 a00(0.0f, -f0.z, f0.y); + r = extents.y * fabsf(f0.z) + extents.z * fabsf(f0.y); + if (minMax(v0.dot(a00), v1.dot(a00), v2.dot(a00)) > r) + return false; + + PxVec3 a01(0.0f, -f1.z, f1.y); + r = extents.y * fabsf(f1.z) + extents.z * fabsf(f1.y); + if (minMax(v0.dot(a01), v1.dot(a01), v2.dot(a01)) > r) + return false; + + PxVec3 a02(0.0f, -f2.z, f2.y); + r = extents.y * fabsf(f2.z) + extents.z * fabsf(f2.y); + if (minMax(v0.dot(a02), v1.dot(a02), v2.dot(a02)) > r) + return false; + + PxVec3 a10(f0.z, 0.0f, -f0.x); + r = extents.x * fabsf(f0.z) + extents.z * fabsf(f0.x); + if (minMax(v0.dot(a10), v1.dot(a10), v2.dot(a10)) > r) + return false; + + PxVec3 a11(f1.z, 0.0f, -f1.x); + r = extents.x * fabsf(f1.z) + extents.z * fabsf(f1.x); + if (minMax(v0.dot(a11), v1.dot(a11), v2.dot(a11)) > r) + return false; + + PxVec3 a12(f2.z, 0.0f, -f2.x); + r = extents.x * fabsf(f2.z) + extents.z * fabsf(f2.x); + if (minMax(v0.dot(a12), v1.dot(a12), v2.dot(a12)) > r) + return false; + + PxVec3 a20(-f0.y, f0.x, 0.0f); + r = extents.x * fabsf(f0.y) + extents.y * fabsf(f0.x); + if (minMax(v0.dot(a20), v1.dot(a20), v2.dot(a20)) > r) + return false; + + PxVec3 a21(-f1.y, f1.x, 0.0f); + r = extents.x * fabsf(f1.y) + extents.y * fabsf(f1.x); + if (minMax(v0.dot(a21), v1.dot(a21), v2.dot(a21)) > r) + return false; + + PxVec3 a22(-f2.y, f2.x, 0.0f); + r = extents.x * fabsf(f2.y) + extents.y * fabsf(f2.x); + if (minMax(v0.dot(a22), v1.dot(a22), v2.dot(a22)) > r) + return false; + + return true; + } + + // ----------------------------------------------------------------------------------- + static void getClosestPointOnTriangle( + PxVec3 p1, PxVec3 p2, PxVec3 p3, PxVec3 p, PxVec3& closest, PxVec3& bary) + { + PxVec3 e0 = p2 - p1; + PxVec3 e1 = p3 - p1; + PxVec3 tmp = p1 - p; + + PxF32 a = e0.dot(e0); + PxF32 b = e0.dot(e1); + PxF32 c = e1.dot(e1); + PxF32 d = e0.dot(tmp); + PxF32 e = e1.dot(tmp); + PxVec3 coords, clampedCoords; + coords.x = b * e - c * d; // s * det + coords.y = b * d - a * e; // t * det + coords.z = a * c - b * b; // det + + clampedCoords = PxVec3(0.0f, 0.0f, 0.0f); + if (coords.x <= 0.0f) { + if (c != 0.0f) + clampedCoords.y = -e / c; + } + else if (coords.y <= 0.0f) { + if (a != 0.0f) + clampedCoords.x = -d / a; + } + else if (coords.x + coords.y > coords.z) { + PxF32 denominator = a + c - b - b; + PxF32 numerator = c + e - b - d; + if (denominator != 0.0f) { + clampedCoords.x = numerator / denominator; + clampedCoords.y = 1.0f - clampedCoords.x; + } + } + else { // all inside + if (coords.z != 0.0f) { + clampedCoords.x = coords.x / coords.z; + clampedCoords.y = coords.y / coords.z; + } + } + clampedCoords.x = PxMax(clampedCoords.x, 0.0f); + clampedCoords.y = PxMax(clampedCoords.y, 0.0f); + clampedCoords.x = PxMin(clampedCoords.x, 1.0f); + clampedCoords.y = PxMin(clampedCoords.y, 1.0f); + + closest = p1 + e0 * clampedCoords.x + e1 * clampedCoords.y; + + bary.x = 1.0f - clampedCoords.x - clampedCoords.y; + bary.y = clampedCoords.x; + bary.z = clampedCoords.y; + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.h new file mode 100644 index 0000000..cfb2a16 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxextensions/src/tet/ExtVoxelTetrahedralizer.h @@ -0,0 +1,116 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef EXT_VOXEL_TETRAHEDRALIZER_H +#define EXT_VOXEL_TETRAHEDRALIZER_H + +#include "ExtMultiList.h" +#include "ExtBVH.h" +#include "foundation/PxVec3.h" +#include "foundation/PxBounds3.h" + +namespace physx +{ + namespace Ext + { + + // ------------------------------------------------------------------------------ + + class VoxelTetrahedralizer + { + public: + VoxelTetrahedralizer(); + + void clear(); + void createTetMesh(const PxArray& verts, const PxArray& triIds, + PxI32 resolution, PxI32 numRelaxationIters = 5, PxF32 relMinTetVolume = 0.05f); + + void readBack(PxArray& tetVertices, PxArray& tetIndices); + + private: + void voxelize(PxU32 resolution); + void createTets(bool subdivBorder, PxU32 numTetsPerVoxel); + void buildBVH(); + void createUniqueTetVertices(); + void findTargetPositions(PxF32 surfaceDist); + void conserveVolume(PxF32 relMinVolume); + void relax(PxI32 numIters, PxF32 relMinVolume); + + // input mesh + + PxArray surfaceVerts; + PxArray surfaceTriIds; + PxBounds3 surfaceBounds; + + // voxel grid + + struct Voxel { + void init(PxI32 _xi, PxI32 _yi, PxI32 _zi) + { + xi = _xi; yi = _yi; zi = _zi; + for (PxI32 i = 0; i < 6; i++) + neighbors[i] = -1; + for (PxI32 i = 0; i < 8; i++) + ids[i] = -1; + parent = -1; + inner = false; + } + bool isAt(PxI32 _xi, PxI32 _yi, PxI32 _zi) { + return xi == _xi && yi == _yi && zi == _zi; + } + PxI32 xi, yi, zi; + PxI32 neighbors[6]; + PxI32 parent; + PxI32 ids[8]; + bool inner; + }; + + PxVec3 gridOrigin; + PxF32 gridSpacing; + PxArray voxels; + + BVHDesc bvh; + + // tet mesh + + PxArray tetVerts; + PxArray origTetVerts; + PxArray tetIds; + + // relaxation + + PxArray isSurfaceVert; + PxArray targetVertPos; + PxArray queryTris; + PxArray edgeIds; + }; + } +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxgpu/include/PxPhysXGpu.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxgpu/include/PxPhysXGpu.h new file mode 100644 index 0000000..4d4ea0a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxgpu/include/PxPhysXGpu.h @@ -0,0 +1,234 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PHYSX_GPU_H +#define PX_PHYSX_GPU_H + +#include "task/PxTask.h" + +#include "foundation/PxPinnedArray.h" +#include "common/PxPhysXCommonConfig.h" +#include "PxSceneDesc.h" +#include "PxBuffer.h" +#include "cudamanager/PxCudaContextManager.h" + +namespace physx +{ + +class PxFoundation; +class PxCudaContextManagerDesc; +class PxvNphaseImplementationContext; +class PxsContext; +class PxsKernelWranglerManager; +class PxvNphaseImplementationFallback; +struct PxgDynamicsMemoryConfig; +class PxsMemoryManager; +class PxsHeapMemoryAllocatorManager; +class PxsSimulationController; +class PxsSimulationControllerCallback; +class PxDelayLoadHook; +class PxParticleBuffer; +class PxParticleAndDiffuseBuffer; +class PxParticleClothBuffer; +class PxParticleRigidBuffer; + +struct PxvSimStats; + +namespace Bp +{ + class BroadPhase; + class AABBManagerBase; + class BoundsArray; +} + +namespace Dy +{ + class Context; +} + +namespace IG +{ + class IslandSim; + class SimpleIslandManager; +} + +namespace Cm +{ + class FlushPool; +} + +/** +\brief Interface to create and run CUDA enabled PhysX features. + +The methods of this interface are expected not to be called concurrently. +Also they are expected to not be called concurrently with any tasks spawned before the end pipeline ... TODO make clear. +*/ +class PxPhysXGpu +{ +protected: + virtual ~PxPhysXGpu() {} + PxPhysXGpu() {} +public: + + /** + \brief Closes this instance of the interface. + */ + virtual void release() = 0; + + /** + Create GPU user buffers. + */ + virtual PxBuffer* createBuffer(PxU64 byteSize, PxBufferType::Enum bufferType, PxCudaContextManager* cudaContexManager, PxU64* memStat) = 0; + virtual PxBuffer* createBuffer(PxU64 byteSyte, PxBufferType::Enum type, PxCudaContextManager* contextManager, PxU64* memStat, PxsHeapMemoryAllocatorManager* heapMemoryManager, void* stream) = 0; + + virtual PxParticleBuffer* createParticleBuffer(PxU32 maxNumParticles, PxU32 maxVolumes, PxCudaContextManager* cudaContextManager, PxU64* memStat, void (*onParticleBufferRelease)(PxParticleBuffer* buffer)) = 0; + virtual PxParticleClothBuffer* createParticleClothBuffer(PxU32 maxNumParticles, PxU32 maxVolumes, PxU32 maxNumCloths, PxU32 maxNumTriangles, PxU32 maxNumSprings, PxCudaContextManager* cudaContextManager, PxU64* memStat, void (*onParticleBufferRelease)(PxParticleBuffer* buffer)) = 0; + virtual PxParticleRigidBuffer* createParticleRigidBuffer(PxU32 maxNumParticles, PxU32 maxVolumes, PxU32 maxNumRigids, PxCudaContextManager* cudaContextManager, PxU64* memStat, void (*onParticleBufferRelease)(PxParticleBuffer* buffer)) = 0; + virtual PxParticleAndDiffuseBuffer* createParticleAndDiffuseBuffer(PxU32 maxParticles, PxU32 maxVolumes, PxU32 maxDiffuseParticles, PxCudaContextManager* cudaContextManager, PxU64* memStat, void (*onParticleBufferRelease)(PxParticleBuffer* buffer)) = 0; + + virtual void resizeBuffer(PxBuffer* buffer, PxU64 byteSize) = 0; + + /** + Queue user buffer copy command. + */ + virtual void addCopyCommand(PxBuffer& dst, PxBuffer& src, bool flush) = 0; + virtual void addCopyCommand(PxBuffer& dst, PxBuffer& src, PxU32 srcOffset, PxU32 dstOffset, PxU32 size, bool flush) = 0; + + /** + Create GPU memory manager. + */ + virtual PxsMemoryManager* createGpuMemoryManager(PxCudaContextManager* cudaContextManager) = 0; + + virtual PxsHeapMemoryAllocatorManager* createGpuHeapMemoryAllocatorManager( + const PxU32 heapCapacity, + PxsMemoryManager* memoryManager, + const PxU32 gpuComputeVersion) = 0; + + /** + Create GPU kernel wrangler manager. + */ + virtual PxsKernelWranglerManager* createGpuKernelWranglerManager( + PxCudaContextManager* cudaContextManager, + PxErrorCallback& errorCallback, + const PxU32 gpuComputeVersion) = 0; + + /** + Create GPU broadphase. + */ + virtual Bp::BroadPhase* createGpuBroadPhase( + PxsKernelWranglerManager* gpuKernelWrangler, + PxCudaContextManager* cudaContextManager, + const PxU32 gpuComputeVersion, + const PxgDynamicsMemoryConfig& config, + PxsHeapMemoryAllocatorManager* heapMemoryManager, PxU64 contextID) = 0; + + + /** + Create GPU aabb manager. + */ + virtual Bp::AABBManagerBase* createGpuAABBManager( + PxsKernelWranglerManager* gpuKernelWrangler, + PxCudaContextManager* cudaContextManager, + const PxU32 gpuComputeVersion, + const PxgDynamicsMemoryConfig& config, + PxsHeapMemoryAllocatorManager* heapMemoryManager, + Bp::BroadPhase& bp, + Bp::BoundsArray& boundsArray, + PxFloatArrayPinned& contactDistance, + PxU32 maxNbAggregates, PxU32 maxNbShapes, + PxVirtualAllocator& allocator, + PxU64 contextID, + PxPairFilteringMode::Enum kineKineFilteringMode, + PxPairFilteringMode::Enum staticKineFilteringMode) = 0; + + /** + Create GPU narrow phase context. + */ + virtual PxvNphaseImplementationContext* createGpuNphaseImplementationContext(PxsContext& context, + PxsKernelWranglerManager* gpuKernelWrangler, + PxvNphaseImplementationFallback* fallbackForUnsupportedCMs, + const PxgDynamicsMemoryConfig& gpuDynamicsConfig, void* contactStreamBase, void* patchStreamBase, void* forceAndIndiceStreamBase, + PxBoundsArrayPinned& bounds, IG::IslandSim* islandSim, + physx::Dy::Context* dynamicsContext, const PxU32 gpuComputeVersion, PxsHeapMemoryAllocatorManager* heapMemoryManager, + bool useGpuBP) = 0; + + /** + Create GPU simulation controller. + */ + virtual PxsSimulationController* createGpuSimulationController(PxsKernelWranglerManager* gpuWranglerManagers, + PxCudaContextManager* cudaContextManager, + Dy::Context* dynamicContext, PxvNphaseImplementationContext* npContext, Bp::BroadPhase* bp, + const bool useGpuBroadphase, IG::SimpleIslandManager* simpleIslandSim, + PxsSimulationControllerCallback* callback, const PxU32 gpuComputeVersion, PxsHeapMemoryAllocatorManager* heapMemoryManager, + const PxU32 maxSoftBodyContacts, const PxU32 maxFemClothContacts, const PxU32 maxParticleContacts, const PxU32 maxHairContacts) = 0; + + /** + Create GPU dynamics context. + */ + virtual Dy::Context* createGpuDynamicsContext(Cm::FlushPool& taskPool, PxsKernelWranglerManager* gpuKernelWragler, + PxCudaContextManager* cudaContextManager, + const PxgDynamicsMemoryConfig& config, IG::SimpleIslandManager* islandManager, const PxU32 maxNumPartitions, const PxU32 maxNumStaticPartitions, + const bool enableStabilization, const bool useEnhancedDeterminism, const PxReal maxBiasCoefficient, + const PxU32 gpuComputeVersion, PxvSimStats& simStats, PxsHeapMemoryAllocatorManager* heapMemoryManager, + const bool frictionEveryIteration, PxSolverType::Enum solverType, const PxReal lengthScale) = 0; + +}; + +} + +/** +Create PxPhysXGpu interface class. +*/ +PX_C_EXPORT PX_PHYSX_GPU_API physx::PxPhysXGpu* PX_CALL_CONV PxCreatePhysXGpu(); + +/** +Create a cuda context manager. +*/ +PX_C_EXPORT PX_PHYSX_GPU_API physx::PxCudaContextManager* PX_CALL_CONV PxCreateCudaContextManager(physx::PxFoundation& foundation, const physx::PxCudaContextManagerDesc& desc, physx::PxProfilerCallback* profilerCallback = NULL); + +/** +Set profiler callback. +*/ +PX_C_EXPORT PX_PHYSX_GPU_API void PX_CALL_CONV PxSetPhysXGpuProfilerCallback(physx::PxProfilerCallback* profilerCallback); + +/** +Query the device ordinal - depends on control panel settings. +*/ +PX_C_EXPORT PX_PHYSX_GPU_API int PX_CALL_CONV PxGetSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc); + +// Implementation of the corresponding functions from PxGpu.h/cpp in the GPU shared library +PX_C_EXPORT PX_PHYSX_GPU_API void PX_CALL_CONV PxGpuCudaRegisterFunction(int moduleIndex, const char* functionName); +PX_C_EXPORT PX_PHYSX_GPU_API void** PX_CALL_CONV PxGpuCudaRegisterFatBinary(void* fatBin); +#if PX_SUPPORT_GPU_PHYSX +PX_C_EXPORT PX_PHYSX_GPU_API physx::PxKernelIndex* PX_CALL_CONV PxGpuGetCudaFunctionTable(); +PX_C_EXPORT PX_PHYSX_GPU_API physx::PxU32 PX_CALL_CONV PxGpuGetCudaFunctionTableSize(); +PX_C_EXPORT PX_PHYSX_GPU_API void** PX_CALL_CONV PxGpuGetCudaModuleTable(); +PX_C_EXPORT PX_PHYSX_GPU_API physx::PxU32 PX_CALL_CONV PxGpuGetCudaModuleTableSize(); +#endif + +#endif // PX_PHYSX_GPU_H diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataDefineProperties.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataDefineProperties.h new file mode 100644 index 0000000..77325f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataDefineProperties.h @@ -0,0 +1,352 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PVD_META_DATA_DEFINE_PROPERTIES_H +#define PVD_META_DATA_DEFINE_PROPERTIES_H + +#if PX_SUPPORT_PVD + +#include "common/PxCoreUtilityTypes.h" + +#include "PvdMetaDataPropertyVisitor.h" +#include "PxPvdDataStreamHelpers.h" +#include "PxPvdDataStream.h" + +namespace physx +{ +namespace Vd +{ + using namespace physx::pvdsdk; + + template + struct PropertyDefinitionOp + { + void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey ) + { + mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType(), PropertyType::Scalar ); + } + }; + template<> + struct PropertyDefinitionOp + { + void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey ) + { + mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType(), PropertyType::Scalar ); + } + }; +#define DEFINE_PROPERTY_DEFINITION_OP_NOP( type ) \ + template<> struct PropertyDefinitionOp { void defineProperty( PvdPropertyDefinitionHelper&, NamespacedName ){} }; + + //NOP out these two types. + DEFINE_PROPERTY_DEFINITION_OP_NOP( PxStridedData ) + DEFINE_PROPERTY_DEFINITION_OP_NOP( PxBoundedData ) + +#define DEFINE_PROPERTY_DEFINITION_OBJECT_REF( type ) \ + template<> struct PropertyDefinitionOp { \ + void defineProperty( PvdPropertyDefinitionHelper& mHelper, NamespacedName mClassKey) \ + { \ + mHelper.createProperty( mClassKey, "", getPvdNamespacedNameForType(), PropertyType::Scalar ); \ + } \ + }; + + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxTetrahedronMesh* ) + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxTriangleMesh* ) + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH33TriangleMesh* ) + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxBVH34TriangleMesh* ) + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxConvexMesh* ) + DEFINE_PROPERTY_DEFINITION_OBJECT_REF( PxHeightField* ) + + +struct PvdClassInfoDefine +{ + PvdPropertyDefinitionHelper& mHelper; + NamespacedName mClassKey; + + PvdClassInfoDefine( PvdPropertyDefinitionHelper& info, NamespacedName inClassName ) + : mHelper( info ) + , mClassKey( inClassName ) { } + + PvdClassInfoDefine( const PvdClassInfoDefine& other ) + : mHelper( other.mHelper ) + , mClassKey( other.mClassKey ) + { + } + + void defineProperty( NamespacedName inDtype, const char* semantic = "", PropertyType::Enum inPType = PropertyType::Scalar ) + { + mHelper.createProperty( mClassKey, semantic, inDtype, inPType ); + } + + void pushName( const char* inName ) + { + mHelper.pushName( inName ); + } + + void pushBracketedName( const char* inName) + { + mHelper.pushBracketedName( inName ); + } + + void popName() + { + mHelper.popName(); + } + + inline void defineNameValueDefs( const PxU32ToName* theConversions ) + { + while( theConversions->mName != NULL ) + { + mHelper.addNamedValue( theConversions->mName, theConversions->mValue ); + ++theConversions; + } + } + + template + void simpleProperty( PxU32, TAccessorType& /*inProp */) + { + typedef typename TAccessorType::prop_type TPropertyType; + PropertyDefinitionOp().defineProperty( mHelper, mClassKey ); + } + + template + void extendedIndexedProperty( PxU32* key, const TAccessorType& inProp, TInfoType& ) + { + simpleProperty(*key, inProp); + } + + template + static NamespacedName getNameForEnumType() + { + size_t s = sizeof( TDataType ); + switch(s) + { + case 1: return getPvdNamespacedNameForType(); + case 2: return getPvdNamespacedNameForType(); + case 4: return getPvdNamespacedNameForType(); + default: return getPvdNamespacedNameForType(); + } + } + + template + void enumProperty( PxU32 /*key*/, TAccessorType& /*inProp*/, const PxU32ToName* inConversions ) + { + typedef typename TAccessorType::prop_type TPropType; + defineNameValueDefs( inConversions ); + defineProperty( getNameForEnumType(), "Enumeration Value" ); + } + + template + void flagsProperty( PxU32 /*key*/, const TAccessorType& /*inAccessor*/, const PxU32ToName* inConversions ) + { + typedef typename TAccessorType::prop_type TPropType; + defineNameValueDefs( inConversions ); + defineProperty( getNameForEnumType(), "Bitflag" ); + } + + template + void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo ) + { + PxU32 theOffset = inAccessor.mOffset; + inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) ); + inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) ); + } + + template + void bufferCollectionProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo ) + { + complexProperty(key, inAccessor, inInfo); + } + + template + void handleBuffer( const PxBufferPropertyInfo&, TEnableFlag>& inProp ) + { + mHelper.pushName( inProp.mName ); + defineProperty( getPvdNamespacedNameForType(), "", PropertyType::Array ); + mHelper.popName(); + } + + template + void handleCollection( const PxReadOnlyCollectionPropertyInfo& inProp ) + { + mHelper.pushName( inProp.mName ); + defineProperty( getPvdNamespacedNameForType(), "", PropertyType::Array ); + mHelper.popName(); + } + + template + void handleCollection( const PxReadOnlyCollectionPropertyInfo& inProp, const PxU32ToName* inConversions ) + { + mHelper.pushName( inProp.mName ); + defineNameValueDefs( inConversions ); + defineProperty( getNameForEnumType(), "Enumeration Value", PropertyType::Array ); + mHelper.popName(); + } + +private: + PvdClassInfoDefine& operator=(const PvdClassInfoDefine&); +}; + +template +struct SimplePropertyValueStructOp +{ + void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset ) + { + mHelper.addPropertyMessageArg( inOffset ); + } +}; + +#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( type ) \ +template<> struct SimplePropertyValueStructOp { void addPropertyMessageArg( PvdPropertyDefinitionHelper&, PxU32 ){}}; + +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxStridedData ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_OP_NOP( PxBoundedData ) + +#define DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( type ) \ +template<> struct SimplePropertyValueStructOp { \ +void addPropertyMessageArg( PvdPropertyDefinitionHelper& mHelper, PxU32 inOffset ) \ +{ \ + mHelper.addPropertyMessageArg( inOffset ); \ +} \ +}; + +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxTetrahedronMesh* ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxTriangleMesh* ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH33TriangleMesh* ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxBVH34TriangleMesh* ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxConvexMesh* ) +DEFINE_SIMPLE_PROPERTY_VALUE_STRUCT_VOIDPTR_OP( PxHeightField* ) + + +struct PvdClassInfoValueStructDefine +{ +private: + PvdClassInfoValueStructDefine& operator=(const PvdClassInfoValueStructDefine&); +public: + + PvdPropertyDefinitionHelper& mHelper; + + PvdClassInfoValueStructDefine( PvdPropertyDefinitionHelper& info ) + : mHelper( info ) + { } + + PvdClassInfoValueStructDefine( const PvdClassInfoValueStructDefine& other ) + : mHelper( other.mHelper ) + { + } + + void defineValueStructOffset( const ValueStructOffsetRecord& inProp, PxU32 inPropSize ) + { + if( inProp.mHasValidOffset ) + { + switch( inPropSize ) + { + case 8: mHelper.addPropertyMessageArg( inProp.mOffset ); break; + case 4: mHelper.addPropertyMessageArg( inProp.mOffset ); break; + case 2: mHelper.addPropertyMessageArg( inProp.mOffset ); break; + default: + PX_ASSERT(1 == inPropSize); + mHelper.addPropertyMessageArg( inProp.mOffset ); break; + } + } + } + + void pushName( const char* inName ) + { + mHelper.pushName( inName ); + } + + void pushBracketedName( const char* inName) + { + mHelper.pushBracketedName( inName ); + } + + void popName() + { + mHelper.popName(); + } + + template + void bufferCollectionProperty( PxU32* /*key*/, const TAccessorType& /*inAccessor*/, TInfoType& /*inInfo*/ ) + { + //complexProperty(key, inAccessor, inInfo); + } + + template + void simpleProperty( PxU32 /*key*/, TAccessorType& inProp ) + { + typedef typename TAccessorType::prop_type TPropertyType; + if ( inProp.mHasValidOffset ) + { + SimplePropertyValueStructOp().addPropertyMessageArg( mHelper, inProp.mOffset ); + } + } + + template + void enumProperty( PxU32 /*key*/, TAccessorType& inAccessor, const PxU32ToName* /*inConversions */) + { + typedef typename TAccessorType::prop_type TPropType; + defineValueStructOffset( inAccessor, sizeof( TPropType ) ); + } + + template + void flagsProperty( PxU32 /*key*/, const TAccessorType& inAccessor, const PxU32ToName* /*inConversions */) + { + typedef typename TAccessorType::prop_type TPropType; + defineValueStructOffset( inAccessor, sizeof( TPropType ) ); + } + + template + void complexProperty( PxU32* key, const TAccessorType& inAccessor, TInfoType& inInfo ) + { + PxU32 theOffset = inAccessor.mOffset; + inInfo.visitBaseProperties( makePvdPropertyFilter( *this, key, &theOffset ) ); + inInfo.visitInstanceProperties( makePvdPropertyFilter( *this, key, &theOffset ) ); + } + + template + void handleCollection( const PxReadOnlyCollectionPropertyInfo& /*prop*/ ) + { + } + + template + void handleCollection( const PxReadOnlyCollectionPropertyInfo& /*prop*/, const PxU32ToName* /*inConversions */) + { + } + + template + void handleCollection( const PxBufferCollectionPropertyInfo& /*prop*/, const TInfoType& /*inInfo */) + { + } +}; + +} + +} + +#endif +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataExtensions.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataExtensions.h new file mode 100644 index 0000000..41ba345 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataExtensions.h @@ -0,0 +1,317 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_META_DATA_EXTENSIONS_H +#define PX_META_DATA_EXTENSIONS_H +#include "PxMetaDataObjects.h" + +#if PX_SUPPORT_PVD +#include "PxPvdObjectModelBaseTypes.h" + +namespace physx { namespace pvdsdk { + + template<> PX_INLINE NamespacedName getPvdNamespacedNameForType() { return getPvdNamespacedNameForType(); } + template<> PX_INLINE NamespacedName getPvdNamespacedNameForType() { return getPvdNamespacedNameForType(); } + +}} +#endif + +namespace physx +{ +namespace Vd +{ +//Additional properties that exist only in pvd land. +struct PxPvdOnlyProperties +{ + enum Enum + { + FirstProp = PxPropertyInfoName::LastPxPropertyInfoName, + PxScene_Frame, + PxScene_Contacts, + PxScene_SimulateElapsedTime, +#define DEFINE_ENUM_RANGE( stem, count ) \ + stem##Begin, \ + stem##End = stem##Begin + count + + //I can't easily add up the number of required property entries, but it is large due to the below + //geometry count squared properties. Thus I punt and allocate way more than I need right now. + DEFINE_ENUM_RANGE( PxScene_SimulationStatistics, 1000 ), + DEFINE_ENUM_RANGE( PxSceneDesc_Limits, PxPropertyInfoName::PxSceneLimits_PropertiesStop - PxPropertyInfoName::PxSceneLimits_PropertiesStart ), + DEFINE_ENUM_RANGE( PxSimulationStatistics_NumShapes, PxGeometryType::eGEOMETRY_COUNT ), + DEFINE_ENUM_RANGE( PxSimulationStatistics_NumDiscreteContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ), + DEFINE_ENUM_RANGE( PxSimulationStatistics_NumModifiedContactPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ), + DEFINE_ENUM_RANGE( PxSimulationStatistics_NumSweptIntegrationPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ), + DEFINE_ENUM_RANGE( PxSimulationStatistics_NumTriggerPairs, PxGeometryType::eGEOMETRY_COUNT * PxGeometryType::eGEOMETRY_COUNT ), + DEFINE_ENUM_RANGE( PxRigidDynamic_SolverIterationCounts, 2 ), + DEFINE_ENUM_RANGE( PxArticulation_SolverIterationCounts, 2 ), + DEFINE_ENUM_RANGE( PxArticulationJoint_SwingLimit, 2 ), + DEFINE_ENUM_RANGE( PxArticulationJoint_TwistLimit, 2 ), + DEFINE_ENUM_RANGE( PxConvexMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ), + DEFINE_ENUM_RANGE( PxTriangleMeshGeometry_Scale, PxPropertyInfoName::PxMeshScale_PropertiesStop - PxPropertyInfoName::PxMeshScale_PropertiesStart ), + + LastPxPvdOnlyProperty + }; +}; + +template +struct PxBufferPropertyInfo : PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType > +{ + typedef PxReadOnlyPropertyInfo< TKey, TObjectType, TPropertyType > TBaseType; + typedef typename TBaseType::TGetterType TGetterType; + PxBufferPropertyInfo( const char* inName, TGetterType inGetter ) + : TBaseType( inName, inGetter ) + { + } + bool isEnabled( PxU32 inFlags ) const { return (inFlags & TEnableFlag) > 0; } +}; + + +#define DECLARE_BUFFER_PROPERTY( objectType, baseType, propType, propName, fieldName, flagName ) \ +typedef PxBufferPropertyInfo< PxPvdOnlyProperties::baseType##_##propName, objectType, propType, flagName > T##objectType##propName##Base; \ +inline propType get##propName( const objectType* inData ) { return inData->fieldName; } \ +struct baseType##propName##Property : T##objectType##propName##Base \ +{ \ + baseType##propName##Property() : T##objectType##propName##Base( #propName, get##propName ){} \ +}; + +template +struct IndexerToNameMap +{ + PxEnumTraits Converter; +}; + +struct ValueStructOffsetRecord +{ + mutable bool mHasValidOffset; + mutable PxU32 mOffset; + ValueStructOffsetRecord() : mHasValidOffset( false ), mOffset( 0 ) {} + void setupValueStructOffset( PxU32 inValue ) const + { + mHasValidOffset = true; + mOffset = inValue; + } +}; + +template +struct PxPvdReadOnlyPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxReadOnlyPropertyInfo TPropertyInfoType; + typedef TPropertyType prop_type; + + const TPropertyInfoType mProperty; + PxPvdReadOnlyPropertyAccessor( const TPropertyInfoType& inProp ) + : mProperty( inProp ) + { + } + prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); } + +private: + PxPvdReadOnlyPropertyAccessor& operator=(const PxPvdReadOnlyPropertyAccessor&); +}; + +template +struct PxBufferCollectionPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxBufferCollectionPropertyInfo< TKey, TObjectType, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + const TPropertyInfoType& mProperty; + const char* mName; + + PxBufferCollectionPropertyAccessor( const TPropertyInfoType& inProp, const char* inName ) + : mProperty( inProp ) + , mName( inName ) + { + } + + const char* name() const { return mName; } + PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); } + PxU32 get( const TObjectType* inObj, prop_type* buffer, PxU32 inNumItems) const { return mProperty.get( inObj, buffer, inNumItems); } + void set( TObjectType* inObj, prop_type* inBuffer, PxU32 inNumItems ) const { mProperty.set( inObj, inBuffer, inNumItems ); } +}; + +template +struct PxPvdIndexedPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + TIndexType mIndex; + const TPropertyInfoType& mProperty; + PxPvdIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex ) + : mIndex( static_cast( inIndex ) ) + , mProperty( inProp ) + { + } + prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIndex ); } + void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIndex, val ); } + + void operator = (PxPvdIndexedPropertyAccessor&) {} +}; + +template +struct PxPvdExtendedIndexedPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxExtendedIndexedPropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + TIndexType mIndex; + const TPropertyInfoType& mProperty; + PxPvdExtendedIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 inIndex ) + : mIndex( static_cast( inIndex ) ) + , mProperty( inProp ) + { + } + + PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); } + prop_type get( const TObjectType* inObj, TIndexType index ) const { return mProperty.get( inObj, index ); } + void set( TObjectType* inObj, TIndexType index, prop_type val ) const { mProperty.set( inObj, index, val ); } + + void operator = (PxPvdExtendedIndexedPropertyAccessor&) {} +}; + +template +struct PxPvdFixedSizeLookupTablePropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxFixedSizeLookupTablePropertyInfo< TKey, TObjectType, TIndexType, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + TIndexType mIndex; + + const TPropertyInfoType& mProperty; + PxPvdFixedSizeLookupTablePropertyAccessor( const TPropertyInfoType& inProp, const PxU32 inIndex3 ) + : mIndex( static_cast( inIndex3 ) ) + , mProperty( inProp ) + { + } + + PxU32 size( const TObjectType* inObj ) const { return mProperty.size( inObj ); } + prop_type getX( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getX( inObj, index ); } + prop_type getY( const TObjectType* inObj, const TIndexType index ) const { return mProperty.getY( inObj, index ); } + void addPair( TObjectType* inObj, const PxReal x, const PxReal y ) { const_cast(mProperty).addPair( inObj, x, y ); } + void clear( TObjectType* inObj ) { const_cast(mProperty).clear( inObj ); } + void operator = (PxPvdFixedSizeLookupTablePropertyAccessor&) {} +}; + +template +struct PxPvdDualIndexedPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + TIdx0Type mIdx0; + TIdx1Type mIdx1; + const TPropertyInfoType& mProperty; + + PxPvdDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 ) + : mIdx0( static_cast( idx0 ) ) + , mIdx1( static_cast( idx1 ) ) + , mProperty( inProp ) + { + } + prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); } + void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); } + +private: + PxPvdDualIndexedPropertyAccessor& operator = (const PxPvdDualIndexedPropertyAccessor&); +}; + +template +struct PxPvdExtendedDualIndexedPropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxExtendedDualIndexedPropertyInfo< TKey, TObjectType, TIdx0Type, TIdx1Type, TPropertyType > TPropertyInfoType; + typedef TPropertyType prop_type; + TIdx0Type mIdx0; + TIdx1Type mIdx1; + const TPropertyInfoType& mProperty; + + PxPvdExtendedDualIndexedPropertyAccessor( const TPropertyInfoType& inProp, PxU32 idx0, PxU32 idx1 ) + : mIdx0( static_cast( idx0 ) ) + , mIdx1( static_cast( idx1 ) ) + , mProperty( inProp ) + { + } + prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj, mIdx0, mIdx1 ); } + void set( TObjectType* inObj, prop_type val ) const { mProperty.set( inObj, mIdx0, mIdx1, val ); } + +private: + PxPvdExtendedDualIndexedPropertyAccessor& operator = (const PxPvdExtendedDualIndexedPropertyAccessor&); +}; + +template +struct PxPvdRangePropertyAccessor : public ValueStructOffsetRecord +{ + typedef PxRangePropertyInfo TPropertyInfoType; + typedef TPropertyType prop_type; + bool mFirstValue; + const TPropertyInfoType& mProperty; + + PxPvdRangePropertyAccessor( const TPropertyInfoType& inProp, bool inFirstValue ) + : mFirstValue( inFirstValue ) + , mProperty( inProp ) + { + } + + prop_type get( const TObjType* inObj ) const { + prop_type first,second; + mProperty.get( inObj, first, second ); + return mFirstValue ? first : second; + } + void set( TObjType* inObj, prop_type val ) const + { + prop_type first,second; + mProperty.get( inObj, first, second ); + if ( mFirstValue ) mProperty.set( inObj, val, second ); + else mProperty.set( inObj, first, val ); + } + + void operator = (PxPvdRangePropertyAccessor&) {} +}; + + +template +struct IsFlagsType +{ + bool FlagData; +}; + +template +struct IsFlagsType > +{ + const PxU32ToName* FlagData; + IsFlagsType > () : FlagData( PxEnumTraits().NameConversion ) {} +}; + + + +template +struct PvdClassForType +{ + bool Unknown; +}; + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataPropertyVisitor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataPropertyVisitor.h new file mode 100644 index 0000000..3c73260 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PvdMetaDataPropertyVisitor.h @@ -0,0 +1,531 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_META_DATA_PROPERTY_VISITOR_H +#define PX_META_DATA_PROPERTY_VISITOR_H + +#include +#include "PvdMetaDataExtensions.h" +namespace physx +{ + +namespace Vd +{ + +//PVD only deals with read-only properties, indexed, and properties like this by in large. +//so we have a filter that expands properties to a level where we can get to them and expands them into +//named functions that make more sense and are easier to read than operator() +template +struct PvdPropertyFilter +{ + +private: + PvdPropertyFilter& operator=(const PvdPropertyFilter&); + +public: + + TOperatorType mOperator; + PxU32* mKeyOverride; + PxU32* mOffsetOverride; + + PvdPropertyFilter( TOperatorType& inOperator ) + : mOperator( inOperator ) + , mKeyOverride( 0 ) + , mOffsetOverride( 0 ) {} + + PvdPropertyFilter( TOperatorType& inOperator, PxU32* inKeyOverride, PxU32* inOffsetOverride ) + : mOperator( inOperator ) + , mKeyOverride( inKeyOverride ) + , mOffsetOverride( inOffsetOverride ) {} + + PvdPropertyFilter( const PvdPropertyFilter& inOther ) : mOperator( inOther.mOperator ), mKeyOverride( inOther.mKeyOverride ), mOffsetOverride( inOther.mOffsetOverride ) {} + + template + void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, bool) + { + mOperator.simpleProperty(inKey, inAccessor ); + } + + template + void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, bool, bool, const PxU32ToName* inConversions ) + { + mOperator.flagsProperty(inKey, inAccessor, inConversions ); + } + + template + void dispatchAccessor( PxU32 inKey, const TAccessorType& inAccessor, const PxU32ToName* inConversions, bool, bool ) + { + mOperator.enumProperty( inKey, inAccessor, inConversions ); + } + + template + void dispatchAccessor(PxU32, const TAccessorType& inAccessor, bool, const TInfoType* inInfo, bool ) + { + PxU32 rangeStart = TKey; + PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride; + mOperator.complexProperty( &propIdx, inAccessor, *inInfo ); + } + + PxU32 getKeyValue( PxU32 inPropertyKey ) + { + PxU32 retval = inPropertyKey; + if ( mKeyOverride ) + { + retval = *mKeyOverride; + (*mKeyOverride)++; + } + return retval; + } + + + void setupValueStructOffset( const ValueStructOffsetRecord&, bool, PxU32* ) {} + void setupValueStructOffset( const ValueStructOffsetRecord& inAccessor, PxU32 inOffset, PxU32* inAdditionalOffset ) + { + //This allows us to nest properties correctly. + if ( inAdditionalOffset ) inOffset += *inAdditionalOffset; + inAccessor.setupValueStructOffset( inOffset ); + } + + template + void handleAccessor( PxU32 inKey, const TAccessorType& inAccessor ) + { + typedef typename TAccessorType::prop_type TPropertyType; + dispatchAccessor( inKey + , inAccessor + , PxEnumTraits().NameConversion + , PxClassInfoTraits().getInfo() + , IsFlagsType().FlagData ); + } + + + template + void handleAccessor( const TAccessorType& inAccessor ) + { + setupValueStructOffset( inAccessor, PxPropertyToValueStructMemberMap().Offset, mOffsetOverride ); + handleAccessor( getKeyValue( TKey ), inAccessor ); + } + + template + void operator()( const PxReadOnlyPropertyInfo& inProperty, PxU32 ) + { + PxPvdReadOnlyPropertyAccessor< TKey, TObjType, TPropertyType > theAccessor( inProperty ); + mOperator.pushName( inProperty.mName ); + handleAccessor( theAccessor ); + mOperator.popName(); + } + + //We don't handle unbounded indexed properties + template + void indexedProperty( PxU32, const PxIndexedPropertyInfo&, bool, TValueConversionType, const TInfoType& ) {} + + + template + void indexedProperty( PxU32, const PxIndexedPropertyInfo& inProp, const PxU32ToName* theConversions, const PxUnknownClassInfo& ) + { + mOperator.pushName( inProp.mName ); + PxU32 rangeStart = TKey; + PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride; + PxU32 theOffset = 0; + if ( mOffsetOverride ) theOffset = *mOffsetOverride; + + while( theConversions->mName != NULL ) + { + mOperator.pushBracketedName( theConversions->mName ); + PxPvdIndexedPropertyAccessor theAccessor( inProp, theConversions->mValue ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + handleAccessor( propIdx, theAccessor ); + mOperator.popName(); + ++propIdx; + ++theConversions; + theOffset += sizeof( TPropertyType ); + } + mOperator.popName(); + } + + template + void indexedProperty( PxU32, const PxIndexedPropertyInfo& inProp, const PxU32ToName* theConversions, const TInfoType& inInfo ) + { + //ouch, not nice. Indexed complex property. + mOperator.pushName( inProp.mName ); + PxU32 propIdx = TKey; + PxU32 theOffset = 0; + if ( mOffsetOverride ) theOffset = *mOffsetOverride; + + while( theConversions->mName != NULL ) + { + mOperator.pushBracketedName( theConversions->mName ); + PxPvdIndexedPropertyAccessor theAccessor( inProp, theConversions->mValue ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + PX_ASSERT( theAccessor.mHasValidOffset ); + mOperator.complexProperty( &propIdx, theAccessor, inInfo ); + mOperator.popName(); + ++theConversions; + theOffset += sizeof( TPropertyType ); + } + mOperator.popName(); + } + + static char* myStrcat(const char* a,const char * b) + { + size_t len = strlen(a)+strlen(b); + char* result = new char[len+1]; + + strcpy(result,a); + strcat(result,b); + result[len] = 0; + + return result; + } + + template + void handleBufferCollectionProperty(PxU32 , const PxBufferCollectionPropertyInfo& inProp, const TInfoType& inInfo) + { + //append 'Collection' to buffer properties + char* name = myStrcat(inProp.mName, "Collection"); + + mOperator.pushName(name); + PxU32 propIdx = TKey; + PxU32 theOffset = 0; + + PxBufferCollectionPropertyAccessor theAccessor( inProp, inProp.mName ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + + mOperator.bufferCollectionProperty( &propIdx, theAccessor, inInfo ); + mOperator.popName(); + delete []name; + } + + template + void operator()( const PxIndexedPropertyInfo& inProp, PxU32 inIndex ) + { + indexedProperty( inIndex, inProp, IndexerToNameMap().Converter.NameConversion + , PxClassInfoTraits().Info ); + } + + template + void handleExtendedIndexProperty(PxU32 inIndex, const PxExtendedIndexedPropertyInfo& inProp, const TInfoType& inInfo) + { + mOperator.pushName(inProp.mName); + PxU32 propIdx = TKey; + PxU32 theOffset = 0; + + PxPvdExtendedIndexedPropertyAccessor theAccessor( inProp, inIndex ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + + mOperator.extendedIndexedProperty( &propIdx, theAccessor, inInfo ); + mOperator.popName(); + } + + template + void handlePxFixedSizeLookupTableProperty( const PxU32 inIndex, const PxFixedSizeLookupTablePropertyInfo& inProp, const TInfoType& inInfo) + { + mOperator.pushName(inProp.mName); + + PxU32 propIdx = TKey; + PxU32 theOffset = 0; + + PxPvdFixedSizeLookupTablePropertyAccessor theAccessor( inProp, inIndex ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + + mOperator.PxFixedSizeLookupTableProperty( &propIdx, theAccessor, inInfo ); + + mOperator.popName(); + } + + template + void operator()( const PxExtendedIndexedPropertyInfo& inProp, PxU32 inIndex ) + { + handleExtendedIndexProperty( inIndex, inProp, PxClassInfoTraits().Info ); + } + + template + void operator()( const PxFixedSizeLookupTablePropertyInfo& inProp, PxU32 inIndex) + { + handlePxFixedSizeLookupTableProperty(inIndex, inProp, PxClassInfoTraits().Info); + } + + //We don't handle unbounded indexed properties + template + void dualIndexedProperty( PxU32 idx, const PxDualIndexedPropertyInfo&, TNameConv, TNameConv2 ) { PX_UNUSED(idx); } + + template + void dualIndexedProperty( PxU32 /*idx*/, const PxDualIndexedPropertyInfo& inProp, const PxU32ToName* c1, const PxU32ToName* c2 ) + { + mOperator.pushName( inProp.mName ); + PxU32 rangeStart = TKey; + PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride; + PxU32 theOffset = 0; + if ( mOffsetOverride ) theOffset = *mOffsetOverride; + while( c1->mName != NULL ) + { + mOperator.pushBracketedName( c1->mName ); + const PxU32ToName* c2Idx = c2; + while( c2Idx->mName != NULL ) + { + mOperator.pushBracketedName( c2Idx->mName ); + PxPvdDualIndexedPropertyAccessor theAccessor( inProp, c1->mValue, c2Idx->mValue ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + handleAccessor( propIdx, theAccessor ); + mOperator.popName(); + ++propIdx; + ++c2Idx; + theOffset += sizeof( TPropertyType ); + } + mOperator.popName(); + ++c1; + } + mOperator.popName(); + } + + template + void extendedDualIndexedProperty( PxU32 /*idx*/, const PxExtendedDualIndexedPropertyInfo& inProp, PxU32 id0Count, PxU32 id1Count ) + { + mOperator.pushName( inProp.mName ); + PxU32 rangeStart = TKey; + PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride; + PxU32 theOffset = 0; + if ( mOffsetOverride ) theOffset = *mOffsetOverride; + for(PxU32 i = 0; i < id0Count; ++i) + { + char buffer1[32] = { 0 }; + sprintf( buffer1, "eId1_%u", i ); + + mOperator.pushBracketedName( buffer1 ); + for(PxU32 j = 0; j < id1Count; ++j) + { + char buffer2[32] = { 0 }; + sprintf( buffer2, "eId2_%u", j ); + + mOperator.pushBracketedName( buffer2 ); + PxPvdExtendedDualIndexedPropertyAccessor theAccessor( inProp, i, j ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + handleAccessor( propIdx, theAccessor ); + mOperator.popName(); + ++propIdx; + theOffset += sizeof( TPropertyType ); + } + mOperator.popName(); + } + mOperator.popName(); + } + + template + void operator()( const PxDualIndexedPropertyInfo& inProp, PxU32 idx ) + { + dualIndexedProperty( idx, inProp + , IndexerToNameMap().Converter.NameConversion + , IndexerToNameMap().Converter.NameConversion ); + } + + template + void operator()( const PxExtendedDualIndexedPropertyInfo& inProp, PxU32 idx ) + { + extendedDualIndexedProperty( idx, inProp, inProp.mId0Count, inProp.mId1Count ); + } + + template + void operator()( const PxRangePropertyInfo& inProperty, PxU32 /*idx*/) + { + PxU32 rangeStart = TKey; + PxU32& propIdx = mKeyOverride == NULL ? rangeStart : *mKeyOverride; + PxU32 theOffset = 0; + if ( mOffsetOverride ) theOffset = *mOffsetOverride; + + mOperator.pushName( inProperty.mName ); + mOperator.pushName( inProperty.mArg0Name ); + PxPvdRangePropertyAccessor theAccessor( inProperty, true ); + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + handleAccessor( propIdx, theAccessor ); + ++propIdx; + theOffset += sizeof( TPropertyType ); + mOperator.popName(); + mOperator.pushName( inProperty.mArg1Name ); + theAccessor.mFirstValue = false; + setupValueStructOffset( theAccessor, PxPropertyToValueStructMemberMap().Offset, &theOffset ); + handleAccessor( propIdx, theAccessor ); + mOperator.popName(); + mOperator.popName(); + } + + template + void operator()( const PxBufferCollectionPropertyInfo& inProp, PxU32 count ) + { + handleBufferCollectionProperty( count, inProp, PxClassInfoTraits().Info ); + } + + template + void handleBuffer( const PxBufferPropertyInfo& inProp ) + { + mOperator.handleBuffer( inProp ); + } + + template + void operator()( const PxBufferPropertyInfo& inProp, PxU32 ) + { + handleBuffer( inProp ); + } + + template + void operator()( const PxReadOnlyCollectionPropertyInfo& prop, PxU32 ) + { + mOperator.handleCollection( prop ); + } + + template + void operator()( const PxReadOnlyCollectionPropertyInfo& prop, PxU32 ) + { + mOperator.handleCollection( prop ); + } + + template + void operator()( const PxWriteOnlyPropertyInfo&, PxU32 ) {} + + template + void operator()( const PxReadOnlyCollectionPropertyInfo&, PxU32 ) {} + + template + void operator()( const PxReadOnlyFilteredCollectionPropertyInfo&, PxU32 ) {} + + + //We don't deal with these property datatypes. +#define DEFINE_PVD_PROPERTY_NOP(datatype) \ + template \ + void operator()( const PxReadOnlyPropertyInfo& inProperty, PxU32 ){PX_UNUSED(inProperty); } + + DEFINE_PVD_PROPERTY_NOP( const void* ) + DEFINE_PVD_PROPERTY_NOP( void* ) + DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterCallback * ) + DEFINE_PVD_PROPERTY_NOP( physx::PxTaskManager * ) + DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader * ) + DEFINE_PVD_PROPERTY_NOP( PxSimulationFilterShader) + DEFINE_PVD_PROPERTY_NOP( PxContactModifyCallback * ) + DEFINE_PVD_PROPERTY_NOP( PxCCDContactModifyCallback * ) + DEFINE_PVD_PROPERTY_NOP( PxSimulationEventCallback * ) + DEFINE_PVD_PROPERTY_NOP( physx::PxCudaContextManager* ) + DEFINE_PVD_PROPERTY_NOP( physx::PxCpuDispatcher * ) + DEFINE_PVD_PROPERTY_NOP( PxRigidActor ) + DEFINE_PVD_PROPERTY_NOP( const PxRigidActor ) + DEFINE_PVD_PROPERTY_NOP( PxRigidActor& ) + DEFINE_PVD_PROPERTY_NOP( const PxRigidActor& ) + DEFINE_PVD_PROPERTY_NOP( PxScene* ) + DEFINE_PVD_PROPERTY_NOP( PxConstraint ) + DEFINE_PVD_PROPERTY_NOP( PxConstraint* ) + DEFINE_PVD_PROPERTY_NOP( PxConstraint& ) + DEFINE_PVD_PROPERTY_NOP( const PxConstraint& ) + DEFINE_PVD_PROPERTY_NOP( PxAggregate * ) + DEFINE_PVD_PROPERTY_NOP( PxArticulationReducedCoordinate&) + DEFINE_PVD_PROPERTY_NOP( const PxArticulationLink * ) + DEFINE_PVD_PROPERTY_NOP( const PxRigidDynamic * ) + DEFINE_PVD_PROPERTY_NOP( const PxRigidStatic * ) + DEFINE_PVD_PROPERTY_NOP( PxArticulationJointReducedCoordinate * ) + DEFINE_PVD_PROPERTY_NOP( PxBroadPhaseCallback * ) + DEFINE_PVD_PROPERTY_NOP( const PxBroadPhaseRegion * ) + DEFINE_PVD_PROPERTY_NOP( PxU32 * ) +}; + +template +inline PvdPropertyFilter makePvdPropertyFilter( TOperator inOperator ) +{ + return PvdPropertyFilter( inOperator ); +} + +template +inline PvdPropertyFilter makePvdPropertyFilter( TOperator inOperator, PxU32* inKey, PxU32* inOffset ) +{ + return PvdPropertyFilter( inOperator, inKey, inOffset ); +} + +template +inline void visitWithPvdFilter( TOperator inOperator, TFuncType inFuncType ) +{ + PX_UNUSED(inFuncType); + TFuncType( makePvdPropertyFilter( inOperator ) ); +} + +template +inline void visitInstancePvdProperties( TOperator inOperator ) +{ + visitInstanceProperties( makePvdPropertyFilter( inOperator ) ); +} + +template +struct PvdAllPropertyVisitor +{ + TOperator mOperator; + PvdAllPropertyVisitor( TOperator op ) : mOperator( op ) {} + template + bool operator()( const TObjectType* ) { visitInstancePvdProperties( mOperator ); return false; } +}; + + +template +struct PvdAllInfoVisitor +{ + TOperator mOperator; + PvdAllInfoVisitor( TOperator op ) : mOperator( op ) {} + template + void operator()( TInfoType inInfo ) + { + inInfo.template visitType( PvdAllPropertyVisitor( mOperator ) ); + inInfo.visitBases( *this ); + } +}; + + +template +inline void visitAllPvdProperties( TOperator inOperator ) +{ + visitAllProperties( makePvdPropertyFilter( inOperator ) ); +} + + + +template +inline void visitRigidDynamicPerFrameProperties( TOperator inOperator ) +{ + PvdPropertyFilter theFilter( inOperator ); + PxRigidDynamicGeneratedInfo theInfo; + theFilter( theInfo.GlobalPose, 0 ); + theFilter( theInfo.LinearVelocity, 1 ); + theFilter( theInfo.AngularVelocity, 2 ); + theFilter( theInfo.IsSleeping, 3 ); +} + +template +inline void visitArticulationLinkPerFrameProperties( TOperator inOperator ) +{ + PvdPropertyFilter theFilter( inOperator ); + PxArticulationLinkGeneratedInfo theInfo; + theFilter( theInfo.GlobalPose, 0 ); +} + +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h new file mode 100644 index 0000000..b5ecb4c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjectNames.h @@ -0,0 +1,485 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +PxPhysics_PropertiesStart, +PxPhysics_TolerancesScale, +PxPhysics_TriangleMeshes, +PxPhysics_TetrahedronMeshes, +PxPhysics_HeightFields, +PxPhysics_ConvexMeshes, +PxPhysics_BVHs, +PxPhysics_BVHStructures, +PxPhysics_Scenes, +PxPhysics_Shapes, +PxPhysics_Materials, +PxPhysics_FEMSoftBodyMaterials, +PxPhysics_FEMClothMaterials, +PxPhysics_PBDMaterials, +PxPhysics_CustomMaterials, +PxPhysics_PropertiesStop, +PxRefCounted_PropertiesStart, +PxRefCounted_ReferenceCount, +PxRefCounted_PropertiesStop, +PxBaseMaterial_PropertiesStart, +PxBaseMaterial_UserData, +PxBaseMaterial_PropertiesStop, +PxMaterial_PropertiesStart, +PxMaterial_DynamicFriction, +PxMaterial_StaticFriction, +PxMaterial_Restitution, +PxMaterial_Damping, +PxMaterial_Flags, +PxMaterial_FrictionCombineMode, +PxMaterial_RestitutionCombineMode, +PxMaterial_ConcreteTypeName, +PxMaterial_PropertiesStop, +PxFEMMaterial_PropertiesStart, +PxFEMMaterial_YoungsModulus, +PxFEMMaterial_Poissons, +PxFEMMaterial_DynamicFriction, +PxFEMMaterial_PropertiesStop, +PxFEMSoftBodyMaterial_PropertiesStart, +PxFEMSoftBodyMaterial_Damping, +PxFEMSoftBodyMaterial_DampingScale, +PxFEMSoftBodyMaterial_ConcreteTypeName, +PxFEMSoftBodyMaterial_PropertiesStop, +PxParticleMaterial_PropertiesStart, +PxParticleMaterial_Friction, +PxParticleMaterial_Damping, +PxParticleMaterial_Adhesion, +PxParticleMaterial_GravityScale, +PxParticleMaterial_AdhesionRadiusScale, +PxParticleMaterial_PropertiesStop, +PxPBDMaterial_PropertiesStart, +PxPBDMaterial_Viscosity, +PxPBDMaterial_VorticityConfinement, +PxPBDMaterial_SurfaceTension, +PxPBDMaterial_Cohesion, +PxPBDMaterial_Lift, +PxPBDMaterial_Drag, +PxPBDMaterial_CFLCoefficient, +PxPBDMaterial_ParticleFrictionScale, +PxPBDMaterial_ParticleAdhesionScale, +PxPBDMaterial_ConcreteTypeName, +PxPBDMaterial_PropertiesStop, +PxActor_PropertiesStart, +PxActor_Scene, +PxActor_Name, +PxActor_ActorFlags, +PxActor_DominanceGroup, +PxActor_OwnerClient, +PxActor_Aggregate, +PxActor_UserData, +PxActor_PropertiesStop, +PxRigidActor_PropertiesStart, +PxRigidActor_GlobalPose, +PxRigidActor_Shapes, +PxRigidActor_Constraints, +PxRigidActor_PropertiesStop, +PxRigidBody_PropertiesStart, +PxRigidBody_CMassLocalPose, +PxRigidBody_Mass, +PxRigidBody_InvMass, +PxRigidBody_MassSpaceInertiaTensor, +PxRigidBody_MassSpaceInvInertiaTensor, +PxRigidBody_LinearDamping, +PxRigidBody_AngularDamping, +PxRigidBody_MaxLinearVelocity, +PxRigidBody_MaxAngularVelocity, +PxRigidBody_RigidBodyFlags, +PxRigidBody_MinCCDAdvanceCoefficient, +PxRigidBody_MaxDepenetrationVelocity, +PxRigidBody_MaxContactImpulse, +PxRigidBody_ContactSlopCoefficient, +PxRigidBody_PropertiesStop, +PxRigidDynamic_PropertiesStart, +PxRigidDynamic_IsSleeping, +PxRigidDynamic_SleepThreshold, +PxRigidDynamic_StabilizationThreshold, +PxRigidDynamic_RigidDynamicLockFlags, +PxRigidDynamic_LinearVelocity, +PxRigidDynamic_AngularVelocity, +PxRigidDynamic_WakeCounter, +PxRigidDynamic_SolverIterationCounts, +PxRigidDynamic_ContactReportThreshold, +PxRigidDynamic_ConcreteTypeName, +PxRigidDynamic_PropertiesStop, +PxRigidStatic_PropertiesStart, +PxRigidStatic_ConcreteTypeName, +PxRigidStatic_PropertiesStop, +PxArticulationLink_PropertiesStart, +PxArticulationLink_InboundJoint, +PxArticulationLink_InboundJointDof, +PxArticulationLink_LinkIndex, +PxArticulationLink_Children, +PxArticulationLink_CfmScale, +PxArticulationLink_LinearVelocity, +PxArticulationLink_AngularVelocity, +PxArticulationLink_ConcreteTypeName, +PxArticulationLink_PropertiesStop, +PxArticulationJointReducedCoordinate_PropertiesStart, +PxArticulationJointReducedCoordinate_ParentPose, +PxArticulationJointReducedCoordinate_ChildPose, +PxArticulationJointReducedCoordinate_JointType, +PxArticulationJointReducedCoordinate_Motion, +PxArticulationJointReducedCoordinate_LimitParams, +PxArticulationJointReducedCoordinate_DriveParams, +PxArticulationJointReducedCoordinate_Armature, +PxArticulationJointReducedCoordinate_FrictionCoefficient, +PxArticulationJointReducedCoordinate_MaxJointVelocity, +PxArticulationJointReducedCoordinate_JointPosition, +PxArticulationJointReducedCoordinate_JointVelocity, +PxArticulationJointReducedCoordinate_ConcreteTypeName, +PxArticulationJointReducedCoordinate_UserData, +PxArticulationJointReducedCoordinate_PropertiesStop, +PxArticulationReducedCoordinate_PropertiesStart, +PxArticulationReducedCoordinate_Scene, +PxArticulationReducedCoordinate_SolverIterationCounts, +PxArticulationReducedCoordinate_IsSleeping, +PxArticulationReducedCoordinate_SleepThreshold, +PxArticulationReducedCoordinate_StabilizationThreshold, +PxArticulationReducedCoordinate_WakeCounter, +PxArticulationReducedCoordinate_MaxCOMLinearVelocity, +PxArticulationReducedCoordinate_MaxCOMAngularVelocity, +PxArticulationReducedCoordinate_Links, +PxArticulationReducedCoordinate_Name, +PxArticulationReducedCoordinate_Aggregate, +PxArticulationReducedCoordinate_ArticulationFlags, +PxArticulationReducedCoordinate_RootGlobalPose, +PxArticulationReducedCoordinate_RootLinearVelocity, +PxArticulationReducedCoordinate_RootAngularVelocity, +PxArticulationReducedCoordinate_UserData, +PxArticulationReducedCoordinate_PropertiesStop, +PxAggregate_PropertiesStart, +PxAggregate_MaxNbActors, +PxAggregate_MaxNbShapes, +PxAggregate_Actors, +PxAggregate_SelfCollision, +PxAggregate_ConcreteTypeName, +PxAggregate_UserData, +PxAggregate_PropertiesStop, +PxConstraint_PropertiesStart, +PxConstraint_Scene, +PxConstraint_Actors, +PxConstraint_Flags, +PxConstraint_IsValid, +PxConstraint_BreakForce, +PxConstraint_MinResponseThreshold, +PxConstraint_ConcreteTypeName, +PxConstraint_UserData, +PxConstraint_PropertiesStop, +PxShape_PropertiesStart, +PxShape_GeometryType, +PxShape_LocalPose, +PxShape_SimulationFilterData, +PxShape_QueryFilterData, +PxShape_Materials, +PxShape_ContactOffset, +PxShape_RestOffset, +PxShape_DensityForFluid, +PxShape_TorsionalPatchRadius, +PxShape_MinTorsionalPatchRadius, +PxShape_Flags, +PxShape_IsExclusive, +PxShape_Name, +PxShape_ConcreteTypeName, +PxShape_UserData, +PxShape_Geom, +PxShape_PropertiesStop, +PxPruningStructure_PropertiesStart, +PxPruningStructure_RigidActors, +PxPruningStructure_StaticMergeData, +PxPruningStructure_DynamicMergeData, +PxPruningStructure_ConcreteTypeName, +PxPruningStructure_PropertiesStop, +PxTolerancesScale_PropertiesStart, +PxTolerancesScale_IsValid, +PxTolerancesScale_Length, +PxTolerancesScale_Speed, +PxTolerancesScale_PropertiesStop, +PxGeometry_PropertiesStart, +PxGeometry_PropertiesStop, +PxBoxGeometry_PropertiesStart, +PxBoxGeometry_HalfExtents, +PxBoxGeometry_PropertiesStop, +PxCapsuleGeometry_PropertiesStart, +PxCapsuleGeometry_Radius, +PxCapsuleGeometry_HalfHeight, +PxCapsuleGeometry_PropertiesStop, +PxMeshScale_PropertiesStart, +PxMeshScale_Scale, +PxMeshScale_Rotation, +PxMeshScale_PropertiesStop, +PxConvexMeshGeometry_PropertiesStart, +PxConvexMeshGeometry_Scale, +PxConvexMeshGeometry_ConvexMesh, +PxConvexMeshGeometry_MeshFlags, +PxConvexMeshGeometry_PropertiesStop, +PxSphereGeometry_PropertiesStart, +PxSphereGeometry_Radius, +PxSphereGeometry_PropertiesStop, +PxPlaneGeometry_PropertiesStart, +PxPlaneGeometry_PropertiesStop, +PxTriangleMeshGeometry_PropertiesStart, +PxTriangleMeshGeometry_Scale, +PxTriangleMeshGeometry_MeshFlags, +PxTriangleMeshGeometry_TriangleMesh, +PxTriangleMeshGeometry_PropertiesStop, +PxHeightFieldGeometry_PropertiesStart, +PxHeightFieldGeometry_HeightField, +PxHeightFieldGeometry_HeightScale, +PxHeightFieldGeometry_RowScale, +PxHeightFieldGeometry_ColumnScale, +PxHeightFieldGeometry_HeightFieldFlags, +PxHeightFieldGeometry_PropertiesStop, +PxSceneQuerySystemBase_PropertiesStart, +PxSceneQuerySystemBase_DynamicTreeRebuildRateHint, +PxSceneQuerySystemBase_UpdateMode, +PxSceneQuerySystemBase_StaticTimestamp, +PxSceneQuerySystemBase_PropertiesStop, +PxSceneSQSystem_PropertiesStart, +PxSceneSQSystem_SceneQueryUpdateMode, +PxSceneSQSystem_SceneQueryStaticTimestamp, +PxSceneSQSystem_StaticStructure, +PxSceneSQSystem_DynamicStructure, +PxSceneSQSystem_PropertiesStop, +PxScene_PropertiesStart, +PxScene_Flags, +PxScene_Limits, +PxScene_Timestamp, +PxScene_Actors, +PxScene_SoftBodies, +PxScene_Articulations, +PxScene_Constraints, +PxScene_Aggregates, +PxScene_CpuDispatcher, +PxScene_CudaContextManager, +PxScene_SimulationEventCallback, +PxScene_ContactModifyCallback, +PxScene_CCDContactModifyCallback, +PxScene_BroadPhaseCallback, +PxScene_FilterShaderDataSize, +PxScene_FilterShader, +PxScene_FilterCallback, +PxScene_KinematicKinematicFilteringMode, +PxScene_StaticKinematicFilteringMode, +PxScene_Gravity, +PxScene_BounceThresholdVelocity, +PxScene_CCDMaxPasses, +PxScene_CCDMaxSeparation, +PxScene_CCDThreshold, +PxScene_MaxBiasCoefficient, +PxScene_FrictionOffsetThreshold, +PxScene_FrictionCorrelationDistance, +PxScene_FrictionType, +PxScene_SolverType, +PxScene_VisualizationCullingBox, +PxScene_BroadPhaseType, +PxScene_BroadPhaseRegions, +PxScene_TaskManager, +PxScene_NbContactDataBlocks, +PxScene_MaxNbContactDataBlocksUsed, +PxScene_ContactReportStreamBufferSize, +PxScene_SolverBatchSize, +PxScene_SolverArticulationBatchSize, +PxScene_WakeCounterResetValue, +PxScene_GpuDynamicsConfig, +PxScene_UserData, +PxScene_SimulationStatistics, +PxScene_PropertiesStop, +PxTetrahedronMeshGeometry_PropertiesStart, +PxTetrahedronMeshGeometry_TetrahedronMesh, +PxTetrahedronMeshGeometry_PropertiesStop, +PxCustomGeometry_PropertiesStart, +PxCustomGeometry_CustomType, +PxCustomGeometry_PropertiesStop, +PxHeightFieldDesc_PropertiesStart, +PxHeightFieldDesc_NbRows, +PxHeightFieldDesc_NbColumns, +PxHeightFieldDesc_Format, +PxHeightFieldDesc_Samples, +PxHeightFieldDesc_ConvexEdgeThreshold, +PxHeightFieldDesc_Flags, +PxHeightFieldDesc_PropertiesStop, +PxArticulationLimit_PropertiesStart, +PxArticulationLimit_Low, +PxArticulationLimit_High, +PxArticulationLimit_PropertiesStop, +PxArticulationDrive_PropertiesStart, +PxArticulationDrive_Stiffness, +PxArticulationDrive_Damping, +PxArticulationDrive_MaxForce, +PxArticulationDrive_DriveType, +PxArticulationDrive_PropertiesStop, +PxSceneQueryDesc_PropertiesStart, +PxSceneQueryDesc_IsValid, +PxSceneQueryDesc_StaticStructure, +PxSceneQueryDesc_DynamicStructure, +PxSceneQueryDesc_DynamicTreeRebuildRateHint, +PxSceneQueryDesc_DynamicTreeSecondaryPruner, +PxSceneQueryDesc_StaticBVHBuildStrategy, +PxSceneQueryDesc_DynamicBVHBuildStrategy, +PxSceneQueryDesc_StaticNbObjectsPerNode, +PxSceneQueryDesc_DynamicNbObjectsPerNode, +PxSceneQueryDesc_SceneQueryUpdateMode, +PxSceneQueryDesc_PropertiesStop, +PxSceneDesc_PropertiesStart, +PxSceneDesc_ToDefault, +PxSceneDesc_Gravity, +PxSceneDesc_SimulationEventCallback, +PxSceneDesc_ContactModifyCallback, +PxSceneDesc_CcdContactModifyCallback, +PxSceneDesc_FilterShaderData, +PxSceneDesc_FilterShaderDataSize, +PxSceneDesc_FilterShader, +PxSceneDesc_FilterCallback, +PxSceneDesc_KineKineFilteringMode, +PxSceneDesc_StaticKineFilteringMode, +PxSceneDesc_BroadPhaseType, +PxSceneDesc_BroadPhaseCallback, +PxSceneDesc_Limits, +PxSceneDesc_FrictionType, +PxSceneDesc_SolverType, +PxSceneDesc_BounceThresholdVelocity, +PxSceneDesc_FrictionOffsetThreshold, +PxSceneDesc_FrictionCorrelationDistance, +PxSceneDesc_Flags, +PxSceneDesc_CpuDispatcher, +PxSceneDesc_CudaContextManager, +PxSceneDesc_UserData, +PxSceneDesc_SolverBatchSize, +PxSceneDesc_SolverArticulationBatchSize, +PxSceneDesc_NbContactDataBlocks, +PxSceneDesc_MaxNbContactDataBlocks, +PxSceneDesc_MaxBiasCoefficient, +PxSceneDesc_ContactReportStreamBufferSize, +PxSceneDesc_CcdMaxPasses, +PxSceneDesc_CcdThreshold, +PxSceneDesc_CcdMaxSeparation, +PxSceneDesc_WakeCounterResetValue, +PxSceneDesc_SanityBounds, +PxSceneDesc_GpuDynamicsConfig, +PxSceneDesc_GpuMaxNumPartitions, +PxSceneDesc_GpuMaxNumStaticPartitions, +PxSceneDesc_GpuComputeVersion, +PxSceneDesc_ContactPairSlabSize, +PxSceneDesc_PropertiesStop, +PxBroadPhaseDesc_PropertiesStart, +PxBroadPhaseDesc_IsValid, +PxBroadPhaseDesc_MType, +PxBroadPhaseDesc_MContextID, +PxBroadPhaseDesc_MContextManager, +PxBroadPhaseDesc_MFoundLostPairsCapacity, +PxBroadPhaseDesc_MDiscardStaticVsKinematic, +PxBroadPhaseDesc_MDiscardKinematicVsKinematic, +PxBroadPhaseDesc_PropertiesStop, +PxSceneLimits_PropertiesStart, +PxSceneLimits_MaxNbActors, +PxSceneLimits_MaxNbBodies, +PxSceneLimits_MaxNbStaticShapes, +PxSceneLimits_MaxNbDynamicShapes, +PxSceneLimits_MaxNbAggregates, +PxSceneLimits_MaxNbConstraints, +PxSceneLimits_MaxNbRegions, +PxSceneLimits_MaxNbBroadPhaseOverlaps, +PxSceneLimits_PropertiesStop, +PxgDynamicsMemoryConfig_PropertiesStart, +PxgDynamicsMemoryConfig_IsValid, +PxgDynamicsMemoryConfig_TempBufferCapacity, +PxgDynamicsMemoryConfig_MaxRigidContactCount, +PxgDynamicsMemoryConfig_MaxRigidPatchCount, +PxgDynamicsMemoryConfig_HeapCapacity, +PxgDynamicsMemoryConfig_FoundLostPairsCapacity, +PxgDynamicsMemoryConfig_FoundLostAggregatePairsCapacity, +PxgDynamicsMemoryConfig_TotalAggregatePairsCapacity, +PxgDynamicsMemoryConfig_MaxSoftBodyContacts, +PxgDynamicsMemoryConfig_MaxFemClothContacts, +PxgDynamicsMemoryConfig_MaxParticleContacts, +PxgDynamicsMemoryConfig_CollisionStackSize, +PxgDynamicsMemoryConfig_MaxHairContacts, +PxgDynamicsMemoryConfig_PropertiesStop, +PxSimulationStatistics_PropertiesStart, +PxSimulationStatistics_NbActiveConstraints, +PxSimulationStatistics_NbActiveDynamicBodies, +PxSimulationStatistics_NbActiveKinematicBodies, +PxSimulationStatistics_NbStaticBodies, +PxSimulationStatistics_NbDynamicBodies, +PxSimulationStatistics_NbKinematicBodies, +PxSimulationStatistics_NbAggregates, +PxSimulationStatistics_NbArticulations, +PxSimulationStatistics_NbAxisSolverConstraints, +PxSimulationStatistics_CompressedContactSize, +PxSimulationStatistics_RequiredContactConstraintMemory, +PxSimulationStatistics_PeakConstraintMemory, +PxSimulationStatistics_NbDiscreteContactPairsTotal, +PxSimulationStatistics_NbDiscreteContactPairsWithCacheHits, +PxSimulationStatistics_NbDiscreteContactPairsWithContacts, +PxSimulationStatistics_NbNewPairs, +PxSimulationStatistics_NbLostPairs, +PxSimulationStatistics_NbNewTouches, +PxSimulationStatistics_NbLostTouches, +PxSimulationStatistics_NbPartitions, +PxSimulationStatistics_GpuMemParticles, +PxSimulationStatistics_GpuMemSoftBodies, +PxSimulationStatistics_GpuMemFEMCloths, +PxSimulationStatistics_GpuMemHairSystems, +PxSimulationStatistics_GpuMemHeap, +PxSimulationStatistics_GpuMemHeapBroadPhase, +PxSimulationStatistics_GpuMemHeapNarrowPhase, +PxSimulationStatistics_GpuMemHeapSolver, +PxSimulationStatistics_GpuMemHeapArticulation, +PxSimulationStatistics_GpuMemHeapSimulation, +PxSimulationStatistics_GpuMemHeapSimulationArticulation, +PxSimulationStatistics_GpuMemHeapSimulationParticles, +PxSimulationStatistics_GpuMemHeapSimulationSoftBody, +PxSimulationStatistics_GpuMemHeapSimulationFEMCloth, +PxSimulationStatistics_GpuMemHeapSimulationHairSystem, +PxSimulationStatistics_GpuMemHeapParticles, +PxSimulationStatistics_GpuMemHeapSoftBodies, +PxSimulationStatistics_GpuMemHeapFEMCloths, +PxSimulationStatistics_GpuMemHeapHairSystems, +PxSimulationStatistics_GpuMemHeapOther, +PxSimulationStatistics_NbBroadPhaseAdds, +PxSimulationStatistics_NbBroadPhaseRemoves, +PxSimulationStatistics_NbDiscreteContactPairs, +PxSimulationStatistics_NbModifiedContactPairs, +PxSimulationStatistics_NbCCDPairs, +PxSimulationStatistics_NbTriggerPairs, +PxSimulationStatistics_NbShapes, +PxSimulationStatistics_PropertiesStop, + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h new file mode 100644 index 0000000..8019526 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxAutoGeneratedMetaDataObjects.h @@ -0,0 +1,3889 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +#define PX_PROPERTY_INFO_NAME PxPropertyInfoName + static PxU32ToName g_physx__PxShapeFlag__EnumConversion[] = { + { "eSIMULATION_SHAPE", static_cast( physx::PxShapeFlag::eSIMULATION_SHAPE ) }, + { "eSCENE_QUERY_SHAPE", static_cast( physx::PxShapeFlag::eSCENE_QUERY_SHAPE ) }, + { "eTRIGGER_SHAPE", static_cast( physx::PxShapeFlag::eTRIGGER_SHAPE ) }, + { "eVISUALIZATION", static_cast( physx::PxShapeFlag::eVISUALIZATION ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxShapeFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxShapeFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxBufferType__EnumConversion[] = { + { "eHOST", static_cast( physx::PxBufferType::eHOST ) }, + { "eDEVICE", static_cast( physx::PxBufferType::eDEVICE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxBufferType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxBufferType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxPhysics; + struct PxPhysicsGeneratedValues + { + PxTolerancesScale TolerancesScale; + PX_PHYSX_CORE_API PxPhysicsGeneratedValues( const PxPhysics* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPhysics, TolerancesScale, PxPhysicsGeneratedValues) + struct PxPhysicsGeneratedInfo + + { + static const char* getClassName() { return "PxPhysics"; } + PxReadOnlyPropertyInfo TolerancesScale; + PxFactoryCollectionPropertyInfo TriangleMeshes; + PxFactoryCollectionPropertyInfo TetrahedronMeshes; + PxFactoryCollectionPropertyInfo HeightFields; + PxFactoryCollectionPropertyInfo ConvexMeshes; + PxFactoryCollectionPropertyInfo BVHs; + PxFactoryCollectionPropertyInfo BVHStructures; + PxFactoryCollectionPropertyInfo Scenes; + PxReadOnlyCollectionPropertyInfo Shapes; + PxReadOnlyCollectionPropertyInfo Materials; + PxReadOnlyCollectionPropertyInfo FEMSoftBodyMaterials; + PxReadOnlyCollectionPropertyInfo FEMClothMaterials; + PxReadOnlyCollectionPropertyInfo PBDMaterials; + PxFactoryCollectionPropertyInfo CustomMaterials; + + PX_PHYSX_CORE_API PxPhysicsGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 14; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( TolerancesScale, inStartIndex + 0 );; + inOperator( TriangleMeshes, inStartIndex + 1 );; + inOperator( TetrahedronMeshes, inStartIndex + 2 );; + inOperator( HeightFields, inStartIndex + 3 );; + inOperator( ConvexMeshes, inStartIndex + 4 );; + inOperator( BVHs, inStartIndex + 5 );; + inOperator( BVHStructures, inStartIndex + 6 );; + inOperator( Scenes, inStartIndex + 7 );; + inOperator( Shapes, inStartIndex + 8 );; + inOperator( Materials, inStartIndex + 9 );; + inOperator( FEMSoftBodyMaterials, inStartIndex + 10 );; + inOperator( FEMClothMaterials, inStartIndex + 11 );; + inOperator( PBDMaterials, inStartIndex + 12 );; + inOperator( CustomMaterials, inStartIndex + 13 );; + return 14 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxPhysicsGeneratedInfo Info; + const PxPhysicsGeneratedInfo* getInfo() { return &Info; } + }; + + class PxRefCounted; + struct PxRefCountedGeneratedValues + { + PxU32 ReferenceCount; + PX_PHYSX_CORE_API PxRefCountedGeneratedValues( const PxRefCounted* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRefCounted, ReferenceCount, PxRefCountedGeneratedValues) + struct PxRefCountedGeneratedInfo + + { + static const char* getClassName() { return "PxRefCounted"; } + PxReadOnlyPropertyInfo ReferenceCount; + + PX_PHYSX_CORE_API PxRefCountedGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ReferenceCount, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRefCountedGeneratedInfo Info; + const PxRefCountedGeneratedInfo* getInfo() { return &Info; } + }; + + class PxBaseMaterial; + struct PxBaseMaterialGeneratedValues + : PxRefCountedGeneratedValues { + void * UserData; + PX_PHYSX_CORE_API PxBaseMaterialGeneratedValues( const PxBaseMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBaseMaterial, UserData, PxBaseMaterialGeneratedValues) + struct PxBaseMaterialGeneratedInfo + : PxRefCountedGeneratedInfo + { + static const char* getClassName() { return "PxBaseMaterial"; } + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxBaseMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRefCountedGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRefCountedGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRefCountedGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( UserData, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxBaseMaterialGeneratedInfo Info; + const PxBaseMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxMaterialFlag__EnumConversion[] = { + { "eDISABLE_FRICTION", static_cast( physx::PxMaterialFlag::eDISABLE_FRICTION ) }, + { "eDISABLE_STRONG_FRICTION", static_cast( physx::PxMaterialFlag::eDISABLE_STRONG_FRICTION ) }, + { "eIMPROVED_PATCH_FRICTION", static_cast( physx::PxMaterialFlag::eIMPROVED_PATCH_FRICTION ) }, + { "eCOMPLIANT_CONTACT", static_cast( physx::PxMaterialFlag::eCOMPLIANT_CONTACT ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxMaterialFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxMaterialFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxCombineMode__EnumConversion[] = { + { "eAVERAGE", static_cast( physx::PxCombineMode::eAVERAGE ) }, + { "eMIN", static_cast( physx::PxCombineMode::eMIN ) }, + { "eMULTIPLY", static_cast( physx::PxCombineMode::eMULTIPLY ) }, + { "eMAX", static_cast( physx::PxCombineMode::eMAX ) }, + { "eN_VALUES", static_cast( physx::PxCombineMode::eN_VALUES ) }, + { "ePAD_32", static_cast( physx::PxCombineMode::ePAD_32 ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxCombineMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxCombineMode__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxMaterial; + struct PxMaterialGeneratedValues + : PxBaseMaterialGeneratedValues { + PxReal DynamicFriction; + PxReal StaticFriction; + PxReal Restitution; + PxReal Damping; + PxMaterialFlags Flags; + PxCombineMode::Enum FrictionCombineMode; + PxCombineMode::Enum RestitutionCombineMode; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxMaterialGeneratedValues( const PxMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, DynamicFriction, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, StaticFriction, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Restitution, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Damping, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, Flags, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, FrictionCombineMode, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, RestitutionCombineMode, PxMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMaterial, ConcreteTypeName, PxMaterialGeneratedValues) + struct PxMaterialGeneratedInfo + : PxBaseMaterialGeneratedInfo + { + static const char* getClassName() { return "PxMaterial"; } + PxPropertyInfo DynamicFriction; + PxPropertyInfo StaticFriction; + PxPropertyInfo Restitution; + PxPropertyInfo Damping; + PxPropertyInfo Flags; + PxPropertyInfo FrictionCombineMode; + PxPropertyInfo RestitutionCombineMode; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 8; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxBaseMaterialGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DynamicFriction, inStartIndex + 0 );; + inOperator( StaticFriction, inStartIndex + 1 );; + inOperator( Restitution, inStartIndex + 2 );; + inOperator( Damping, inStartIndex + 3 );; + inOperator( Flags, inStartIndex + 4 );; + inOperator( FrictionCombineMode, inStartIndex + 5 );; + inOperator( RestitutionCombineMode, inStartIndex + 6 );; + inOperator( ConcreteTypeName, inStartIndex + 7 );; + return 8 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxMaterialGeneratedInfo Info; + const PxMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + class PxFEMMaterial; + struct PxFEMMaterialGeneratedValues + : PxBaseMaterialGeneratedValues { + PxReal YoungsModulus; + PxReal Poissons; + PxReal DynamicFriction; + PX_PHYSX_CORE_API PxFEMMaterialGeneratedValues( const PxFEMMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, YoungsModulus, PxFEMMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, Poissons, PxFEMMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMMaterial, DynamicFriction, PxFEMMaterialGeneratedValues) + struct PxFEMMaterialGeneratedInfo + : PxBaseMaterialGeneratedInfo + { + static const char* getClassName() { return "PxFEMMaterial"; } + PxPropertyInfo YoungsModulus; + PxPropertyInfo Poissons; + PxPropertyInfo DynamicFriction; + + PX_PHYSX_CORE_API PxFEMMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxBaseMaterialGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( YoungsModulus, inStartIndex + 0 );; + inOperator( Poissons, inStartIndex + 1 );; + inOperator( DynamicFriction, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxFEMMaterialGeneratedInfo Info; + const PxFEMMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + class PxFEMSoftBodyMaterial; + struct PxFEMSoftBodyMaterialGeneratedValues + : PxFEMMaterialGeneratedValues { + PxReal Damping; + PxReal DampingScale; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedValues( const PxFEMSoftBodyMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, Damping, PxFEMSoftBodyMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, DampingScale, PxFEMSoftBodyMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFEMSoftBodyMaterial, ConcreteTypeName, PxFEMSoftBodyMaterialGeneratedValues) + struct PxFEMSoftBodyMaterialGeneratedInfo + : PxFEMMaterialGeneratedInfo + { + static const char* getClassName() { return "PxFEMSoftBodyMaterial"; } + PxPropertyInfo Damping; + PxPropertyInfo DampingScale; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxFEMMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxFEMMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxFEMMaterialGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Damping, inStartIndex + 0 );; + inOperator( DampingScale, inStartIndex + 1 );; + inOperator( ConcreteTypeName, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxFEMSoftBodyMaterialGeneratedInfo Info; + const PxFEMSoftBodyMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + class PxParticleMaterial; + struct PxParticleMaterialGeneratedValues + : PxBaseMaterialGeneratedValues { + PxReal Friction; + PxReal Damping; + PxReal Adhesion; + PxReal GravityScale; + PxReal AdhesionRadiusScale; + PX_PHYSX_CORE_API PxParticleMaterialGeneratedValues( const PxParticleMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Friction, PxParticleMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Damping, PxParticleMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, Adhesion, PxParticleMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, GravityScale, PxParticleMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxParticleMaterial, AdhesionRadiusScale, PxParticleMaterialGeneratedValues) + struct PxParticleMaterialGeneratedInfo + : PxBaseMaterialGeneratedInfo + { + static const char* getClassName() { return "PxParticleMaterial"; } + PxPropertyInfo Friction; + PxPropertyInfo Damping; + PxPropertyInfo Adhesion; + PxPropertyInfo GravityScale; + PxPropertyInfo AdhesionRadiusScale; + + PX_PHYSX_CORE_API PxParticleMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxBaseMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxBaseMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxBaseMaterialGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Friction, inStartIndex + 0 );; + inOperator( Damping, inStartIndex + 1 );; + inOperator( Adhesion, inStartIndex + 2 );; + inOperator( GravityScale, inStartIndex + 3 );; + inOperator( AdhesionRadiusScale, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxParticleMaterialGeneratedInfo Info; + const PxParticleMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + class PxPBDMaterial; + struct PxPBDMaterialGeneratedValues + : PxParticleMaterialGeneratedValues { + PxReal Viscosity; + PxReal VorticityConfinement; + PxReal SurfaceTension; + PxReal Cohesion; + PxReal Lift; + PxReal Drag; + PxReal CFLCoefficient; + PxReal ParticleFrictionScale; + PxReal ParticleAdhesionScale; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxPBDMaterialGeneratedValues( const PxPBDMaterial* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Viscosity, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, VorticityConfinement, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, SurfaceTension, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Cohesion, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Lift, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, Drag, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, CFLCoefficient, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ParticleFrictionScale, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ParticleAdhesionScale, PxPBDMaterialGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPBDMaterial, ConcreteTypeName, PxPBDMaterialGeneratedValues) + struct PxPBDMaterialGeneratedInfo + : PxParticleMaterialGeneratedInfo + { + static const char* getClassName() { return "PxPBDMaterial"; } + PxPropertyInfo Viscosity; + PxPropertyInfo VorticityConfinement; + PxPropertyInfo SurfaceTension; + PxPropertyInfo Cohesion; + PxPropertyInfo Lift; + PxPropertyInfo Drag; + PxPropertyInfo CFLCoefficient; + PxPropertyInfo ParticleFrictionScale; + PxPropertyInfo ParticleAdhesionScale; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxPBDMaterialGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxParticleMaterialGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxParticleMaterialGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 10; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxParticleMaterialGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Viscosity, inStartIndex + 0 );; + inOperator( VorticityConfinement, inStartIndex + 1 );; + inOperator( SurfaceTension, inStartIndex + 2 );; + inOperator( Cohesion, inStartIndex + 3 );; + inOperator( Lift, inStartIndex + 4 );; + inOperator( Drag, inStartIndex + 5 );; + inOperator( CFLCoefficient, inStartIndex + 6 );; + inOperator( ParticleFrictionScale, inStartIndex + 7 );; + inOperator( ParticleAdhesionScale, inStartIndex + 8 );; + inOperator( ConcreteTypeName, inStartIndex + 9 );; + return 10 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxPBDMaterialGeneratedInfo Info; + const PxPBDMaterialGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxActorType__EnumConversion[] = { + { "eRIGID_STATIC", static_cast( physx::PxActorType::eRIGID_STATIC ) }, + { "eRIGID_DYNAMIC", static_cast( physx::PxActorType::eRIGID_DYNAMIC ) }, + { "eARTICULATION_LINK", static_cast( physx::PxActorType::eARTICULATION_LINK ) }, + { "eSOFTBODY", static_cast( physx::PxActorType::eSOFTBODY ) }, + { "eFEMCLOTH", static_cast( physx::PxActorType::eFEMCLOTH ) }, + { "ePBD_PARTICLESYSTEM", static_cast( physx::PxActorType::ePBD_PARTICLESYSTEM ) }, + { "eFLIP_PARTICLESYSTEM", static_cast( physx::PxActorType::eFLIP_PARTICLESYSTEM ) }, + { "eMPM_PARTICLESYSTEM", static_cast( physx::PxActorType::eMPM_PARTICLESYSTEM ) }, + { "eCUSTOM_PARTICLESYSTEM", static_cast( physx::PxActorType::eCUSTOM_PARTICLESYSTEM ) }, + { "eHAIRSYSTEM", static_cast( physx::PxActorType::eHAIRSYSTEM ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxActorType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxActorFlag__EnumConversion[] = { + { "eVISUALIZATION", static_cast( physx::PxActorFlag::eVISUALIZATION ) }, + { "eDISABLE_GRAVITY", static_cast( physx::PxActorFlag::eDISABLE_GRAVITY ) }, + { "eSEND_SLEEP_NOTIFIES", static_cast( physx::PxActorFlag::eSEND_SLEEP_NOTIFIES ) }, + { "eDISABLE_SIMULATION", static_cast( physx::PxActorFlag::eDISABLE_SIMULATION ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxActorFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxActor; + struct PxActorGeneratedValues + { + PxScene * Scene; + const char * Name; + PxActorFlags ActorFlags; + PxDominanceGroup DominanceGroup; + PxClientID OwnerClient; + PxAggregate * Aggregate; + void * UserData; + PX_PHYSX_CORE_API PxActorGeneratedValues( const PxActor* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Scene, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Name, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, ActorFlags, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, DominanceGroup, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, OwnerClient, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, Aggregate, PxActorGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxActor, UserData, PxActorGeneratedValues) + struct PxActorGeneratedInfo + + { + static const char* getClassName() { return "PxActor"; } + PxReadOnlyPropertyInfo Scene; + PxPropertyInfo Name; + PxPropertyInfo ActorFlags; + PxPropertyInfo DominanceGroup; + PxPropertyInfo OwnerClient; + PxReadOnlyPropertyInfo Aggregate; + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxActorGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 7; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scene, inStartIndex + 0 );; + inOperator( Name, inStartIndex + 1 );; + inOperator( ActorFlags, inStartIndex + 2 );; + inOperator( DominanceGroup, inStartIndex + 3 );; + inOperator( OwnerClient, inStartIndex + 4 );; + inOperator( Aggregate, inStartIndex + 5 );; + inOperator( UserData, inStartIndex + 6 );; + return 7 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxActorGeneratedInfo Info; + const PxActorGeneratedInfo* getInfo() { return &Info; } + }; + + class PxRigidActor; + struct PxRigidActorGeneratedValues + : PxActorGeneratedValues { + PxTransform GlobalPose; + PX_PHYSX_CORE_API PxRigidActorGeneratedValues( const PxRigidActor* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidActor, GlobalPose, PxRigidActorGeneratedValues) + struct PxRigidActorGeneratedInfo + : PxActorGeneratedInfo + { + static const char* getClassName() { return "PxRigidActor"; } + PxPropertyInfo GlobalPose; + PxRigidActorShapeCollection Shapes; + PxReadOnlyCollectionPropertyInfo Constraints; + + PX_PHYSX_CORE_API PxRigidActorGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxActorGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( GlobalPose, inStartIndex + 0 );; + inOperator( Shapes, inStartIndex + 1 );; + inOperator( Constraints, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRigidActorGeneratedInfo Info; + const PxRigidActorGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxForceMode__EnumConversion[] = { + { "eFORCE", static_cast( physx::PxForceMode::eFORCE ) }, + { "eIMPULSE", static_cast( physx::PxForceMode::eIMPULSE ) }, + { "eVELOCITY_CHANGE", static_cast( physx::PxForceMode::eVELOCITY_CHANGE ) }, + { "eACCELERATION", static_cast( physx::PxForceMode::eACCELERATION ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxForceMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxForceMode__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxRigidBodyFlag__EnumConversion[] = { + { "eKINEMATIC", static_cast( physx::PxRigidBodyFlag::eKINEMATIC ) }, + { "eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES", static_cast( physx::PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES ) }, + { "eENABLE_CCD", static_cast( physx::PxRigidBodyFlag::eENABLE_CCD ) }, + { "eENABLE_CCD_FRICTION", static_cast( physx::PxRigidBodyFlag::eENABLE_CCD_FRICTION ) }, + { "eENABLE_SPECULATIVE_CCD", static_cast( physx::PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD ) }, + { "eENABLE_POSE_INTEGRATION_PREVIEW", static_cast( physx::PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW ) }, + { "eENABLE_CCD_MAX_CONTACT_IMPULSE", static_cast( physx::PxRigidBodyFlag::eENABLE_CCD_MAX_CONTACT_IMPULSE ) }, + { "eRETAIN_ACCELERATIONS", static_cast( physx::PxRigidBodyFlag::eRETAIN_ACCELERATIONS ) }, + { "eFORCE_KINE_KINE_NOTIFICATIONS", static_cast( physx::PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS ) }, + { "eFORCE_STATIC_KINE_NOTIFICATIONS", static_cast( physx::PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS ) }, + { "eENABLE_GYROSCOPIC_FORCES", static_cast( physx::PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES ) }, + { "eRESERVED", static_cast( physx::PxRigidBodyFlag::eRESERVED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxRigidBodyFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRigidBodyFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxRigidBody; + struct PxRigidBodyGeneratedValues + : PxRigidActorGeneratedValues { + PxTransform CMassLocalPose; + PxReal Mass; + PxReal InvMass; + PxVec3 MassSpaceInertiaTensor; + PxVec3 MassSpaceInvInertiaTensor; + PxReal LinearDamping; + PxReal AngularDamping; + PxReal MaxLinearVelocity; + PxReal MaxAngularVelocity; + PxRigidBodyFlags RigidBodyFlags; + PxReal MinCCDAdvanceCoefficient; + PxReal MaxDepenetrationVelocity; + PxReal MaxContactImpulse; + PxReal ContactSlopCoefficient; + PX_PHYSX_CORE_API PxRigidBodyGeneratedValues( const PxRigidBody* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, CMassLocalPose, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, Mass, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, InvMass, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MassSpaceInertiaTensor, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MassSpaceInvInertiaTensor, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, LinearDamping, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, AngularDamping, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxLinearVelocity, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxAngularVelocity, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, RigidBodyFlags, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MinCCDAdvanceCoefficient, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxDepenetrationVelocity, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, MaxContactImpulse, PxRigidBodyGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidBody, ContactSlopCoefficient, PxRigidBodyGeneratedValues) + struct PxRigidBodyGeneratedInfo + : PxRigidActorGeneratedInfo + { + static const char* getClassName() { return "PxRigidBody"; } + PxPropertyInfo CMassLocalPose; + PxPropertyInfo Mass; + PxReadOnlyPropertyInfo InvMass; + PxPropertyInfo MassSpaceInertiaTensor; + PxReadOnlyPropertyInfo MassSpaceInvInertiaTensor; + PxPropertyInfo LinearDamping; + PxPropertyInfo AngularDamping; + PxPropertyInfo MaxLinearVelocity; + PxPropertyInfo MaxAngularVelocity; + PxPropertyInfo RigidBodyFlags; + PxPropertyInfo MinCCDAdvanceCoefficient; + PxPropertyInfo MaxDepenetrationVelocity; + PxPropertyInfo MaxContactImpulse; + PxPropertyInfo ContactSlopCoefficient; + + PX_PHYSX_CORE_API PxRigidBodyGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRigidActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRigidActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 14; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRigidActorGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( CMassLocalPose, inStartIndex + 0 );; + inOperator( Mass, inStartIndex + 1 );; + inOperator( InvMass, inStartIndex + 2 );; + inOperator( MassSpaceInertiaTensor, inStartIndex + 3 );; + inOperator( MassSpaceInvInertiaTensor, inStartIndex + 4 );; + inOperator( LinearDamping, inStartIndex + 5 );; + inOperator( AngularDamping, inStartIndex + 6 );; + inOperator( MaxLinearVelocity, inStartIndex + 7 );; + inOperator( MaxAngularVelocity, inStartIndex + 8 );; + inOperator( RigidBodyFlags, inStartIndex + 9 );; + inOperator( MinCCDAdvanceCoefficient, inStartIndex + 10 );; + inOperator( MaxDepenetrationVelocity, inStartIndex + 11 );; + inOperator( MaxContactImpulse, inStartIndex + 12 );; + inOperator( ContactSlopCoefficient, inStartIndex + 13 );; + return 14 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRigidBodyGeneratedInfo Info; + const PxRigidBodyGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxRigidDynamicLockFlag__EnumConversion[] = { + { "eLOCK_LINEAR_X", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_X ) }, + { "eLOCK_LINEAR_Y", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y ) }, + { "eLOCK_LINEAR_Z", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_LINEAR_Z ) }, + { "eLOCK_ANGULAR_X", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X ) }, + { "eLOCK_ANGULAR_Y", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y ) }, + { "eLOCK_ANGULAR_Z", static_cast( physx::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxRigidDynamicLockFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRigidDynamicLockFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxRigidDynamic; + struct PxRigidDynamicGeneratedValues + : PxRigidBodyGeneratedValues { + _Bool IsSleeping; + PxReal SleepThreshold; + PxReal StabilizationThreshold; + PxRigidDynamicLockFlags RigidDynamicLockFlags; + PxVec3 LinearVelocity; + PxVec3 AngularVelocity; + PxReal WakeCounter; + PxU32 SolverIterationCounts[2]; + PxReal ContactReportThreshold; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxRigidDynamicGeneratedValues( const PxRigidDynamic* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, IsSleeping, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, SleepThreshold, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, StabilizationThreshold, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, RigidDynamicLockFlags, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, LinearVelocity, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, AngularVelocity, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, WakeCounter, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, SolverIterationCounts, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, ContactReportThreshold, PxRigidDynamicGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidDynamic, ConcreteTypeName, PxRigidDynamicGeneratedValues) + struct PxRigidDynamicGeneratedInfo + : PxRigidBodyGeneratedInfo + { + static const char* getClassName() { return "PxRigidDynamic"; } + PxReadOnlyPropertyInfo IsSleeping; + PxPropertyInfo SleepThreshold; + PxPropertyInfo StabilizationThreshold; + PxPropertyInfo RigidDynamicLockFlags; + PxPropertyInfo LinearVelocity; + PxPropertyInfo AngularVelocity; + PxPropertyInfo WakeCounter; + PxRangePropertyInfo SolverIterationCounts; + PxPropertyInfo ContactReportThreshold; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxRigidDynamicGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRigidBodyGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRigidBodyGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 10; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRigidBodyGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( IsSleeping, inStartIndex + 0 );; + inOperator( SleepThreshold, inStartIndex + 1 );; + inOperator( StabilizationThreshold, inStartIndex + 2 );; + inOperator( RigidDynamicLockFlags, inStartIndex + 3 );; + inOperator( LinearVelocity, inStartIndex + 4 );; + inOperator( AngularVelocity, inStartIndex + 5 );; + inOperator( WakeCounter, inStartIndex + 6 );; + inOperator( SolverIterationCounts, inStartIndex + 7 );; + inOperator( ContactReportThreshold, inStartIndex + 8 );; + inOperator( ConcreteTypeName, inStartIndex + 9 );; + return 10 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRigidDynamicGeneratedInfo Info; + const PxRigidDynamicGeneratedInfo* getInfo() { return &Info; } + }; + + class PxRigidStatic; + struct PxRigidStaticGeneratedValues + : PxRigidActorGeneratedValues { + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxRigidStaticGeneratedValues( const PxRigidStatic* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRigidStatic, ConcreteTypeName, PxRigidStaticGeneratedValues) + struct PxRigidStaticGeneratedInfo + : PxRigidActorGeneratedInfo + { + static const char* getClassName() { return "PxRigidStatic"; } + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxRigidStaticGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRigidActorGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRigidActorGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRigidActorGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ConcreteTypeName, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRigidStaticGeneratedInfo Info; + const PxRigidStaticGeneratedInfo* getInfo() { return &Info; } + }; + + class PxArticulationLink; + struct PxArticulationLinkGeneratedValues + : PxRigidBodyGeneratedValues { + PxArticulationJointReducedCoordinate * InboundJoint; + PxU32 InboundJointDof; + PxU32 LinkIndex; + PxReal CfmScale; + PxVec3 LinearVelocity; + PxVec3 AngularVelocity; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxArticulationLinkGeneratedValues( const PxArticulationLink* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, InboundJoint, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, InboundJointDof, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, LinkIndex, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, CfmScale, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, LinearVelocity, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, AngularVelocity, PxArticulationLinkGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLink, ConcreteTypeName, PxArticulationLinkGeneratedValues) + struct PxArticulationLinkGeneratedInfo + : PxRigidBodyGeneratedInfo + { + static const char* getClassName() { return "PxArticulationLink"; } + PxReadOnlyPropertyInfo InboundJoint; + PxReadOnlyPropertyInfo InboundJointDof; + PxReadOnlyPropertyInfo LinkIndex; + PxReadOnlyCollectionPropertyInfo Children; + PxPropertyInfo CfmScale; + PxReadOnlyPropertyInfo LinearVelocity; + PxReadOnlyPropertyInfo AngularVelocity; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxArticulationLinkGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRigidBodyGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRigidBodyGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 8; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRigidBodyGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( InboundJoint, inStartIndex + 0 );; + inOperator( InboundJointDof, inStartIndex + 1 );; + inOperator( LinkIndex, inStartIndex + 2 );; + inOperator( Children, inStartIndex + 3 );; + inOperator( CfmScale, inStartIndex + 4 );; + inOperator( LinearVelocity, inStartIndex + 5 );; + inOperator( AngularVelocity, inStartIndex + 6 );; + inOperator( ConcreteTypeName, inStartIndex + 7 );; + return 8 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxArticulationLinkGeneratedInfo Info; + const PxArticulationLinkGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxArticulationJointType__EnumConversion[] = { + { "eFIX", static_cast( physx::PxArticulationJointType::eFIX ) }, + { "ePRISMATIC", static_cast( physx::PxArticulationJointType::ePRISMATIC ) }, + { "eREVOLUTE", static_cast( physx::PxArticulationJointType::eREVOLUTE ) }, + { "eREVOLUTE_UNWRAPPED", static_cast( physx::PxArticulationJointType::eREVOLUTE_UNWRAPPED ) }, + { "eSPHERICAL", static_cast( physx::PxArticulationJointType::eSPHERICAL ) }, + { "eUNDEFINED", static_cast( physx::PxArticulationJointType::eUNDEFINED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationJointType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationJointType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxArticulationAxis__EnumConversion[] = { + { "eTWIST", static_cast( physx::PxArticulationAxis::eTWIST ) }, + { "eSWING1", static_cast( physx::PxArticulationAxis::eSWING1 ) }, + { "eSWING2", static_cast( physx::PxArticulationAxis::eSWING2 ) }, + { "eX", static_cast( physx::PxArticulationAxis::eX ) }, + { "eY", static_cast( physx::PxArticulationAxis::eY ) }, + { "eZ", static_cast( physx::PxArticulationAxis::eZ ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationAxis::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationAxis__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxArticulationMotion__EnumConversion[] = { + { "eLOCKED", static_cast( physx::PxArticulationMotion::eLOCKED ) }, + { "eLIMITED", static_cast( physx::PxArticulationMotion::eLIMITED ) }, + { "eFREE", static_cast( physx::PxArticulationMotion::eFREE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationMotion::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationMotion__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxArticulationDriveType__EnumConversion[] = { + { "eFORCE", static_cast( physx::PxArticulationDriveType::eFORCE ) }, + { "eACCELERATION", static_cast( physx::PxArticulationDriveType::eACCELERATION ) }, + { "eTARGET", static_cast( physx::PxArticulationDriveType::eTARGET ) }, + { "eVELOCITY", static_cast( physx::PxArticulationDriveType::eVELOCITY ) }, + { "eNONE", static_cast( physx::PxArticulationDriveType::eNONE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationDriveType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationDriveType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxArticulationJointReducedCoordinate; + struct PxArticulationJointReducedCoordinateGeneratedValues + { + PxTransform ParentPose; + PxTransform ChildPose; + PxArticulationJointType::Enum JointType; + PxArticulationMotion::Enum Motion[physx::PxArticulationAxis::eCOUNT]; + PxArticulationLimit LimitParams[physx::PxArticulationAxis::eCOUNT]; + PxArticulationDrive DriveParams[physx::PxArticulationAxis::eCOUNT]; + PxReal Armature[physx::PxArticulationAxis::eCOUNT]; + PxReal FrictionCoefficient; + PxReal MaxJointVelocity; + PxReal JointPosition[physx::PxArticulationAxis::eCOUNT]; + PxReal JointVelocity[physx::PxArticulationAxis::eCOUNT]; + const char * ConcreteTypeName; + void * UserData; + PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedValues( const PxArticulationJointReducedCoordinate* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ParentPose, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ChildPose, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointType, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, Motion, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, LimitParams, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, DriveParams, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, Armature, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, FrictionCoefficient, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, MaxJointVelocity, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointPosition, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, JointVelocity, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, ConcreteTypeName, PxArticulationJointReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationJointReducedCoordinate, UserData, PxArticulationJointReducedCoordinateGeneratedValues) + struct PxArticulationJointReducedCoordinateGeneratedInfo + + { + static const char* getClassName() { return "PxArticulationJointReducedCoordinate"; } + PxPropertyInfo ParentPose; + PxPropertyInfo ChildPose; + PxPropertyInfo JointType; + PxIndexedPropertyInfo Motion; + PxIndexedPropertyInfo LimitParams; + PxIndexedPropertyInfo DriveParams; + PxIndexedPropertyInfo Armature; + PxPropertyInfo FrictionCoefficient; + PxPropertyInfo MaxJointVelocity; + PxIndexedPropertyInfo JointPosition; + PxIndexedPropertyInfo JointVelocity; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 13; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ParentPose, inStartIndex + 0 );; + inOperator( ChildPose, inStartIndex + 1 );; + inOperator( JointType, inStartIndex + 2 );; + inOperator( Motion, inStartIndex + 3 );; + inOperator( LimitParams, inStartIndex + 4 );; + inOperator( DriveParams, inStartIndex + 5 );; + inOperator( Armature, inStartIndex + 6 );; + inOperator( FrictionCoefficient, inStartIndex + 7 );; + inOperator( MaxJointVelocity, inStartIndex + 8 );; + inOperator( JointPosition, inStartIndex + 9 );; + inOperator( JointVelocity, inStartIndex + 10 );; + inOperator( ConcreteTypeName, inStartIndex + 11 );; + inOperator( UserData, inStartIndex + 12 );; + return 13 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxArticulationJointReducedCoordinateGeneratedInfo Info; + const PxArticulationJointReducedCoordinateGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxArticulationFlag__EnumConversion[] = { + { "eFIX_BASE", static_cast( physx::PxArticulationFlag::eFIX_BASE ) }, + { "eDRIVE_LIMITS_ARE_FORCES", static_cast( physx::PxArticulationFlag::eDRIVE_LIMITS_ARE_FORCES ) }, + { "eDISABLE_SELF_COLLISION", static_cast( physx::PxArticulationFlag::eDISABLE_SELF_COLLISION ) }, + { "eCOMPUTE_JOINT_FORCES", static_cast( physx::PxArticulationFlag::eCOMPUTE_JOINT_FORCES ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxArticulationCacheFlag__EnumConversion[] = { + { "eVELOCITY", static_cast( physx::PxArticulationCacheFlag::eVELOCITY ) }, + { "eACCELERATION", static_cast( physx::PxArticulationCacheFlag::eACCELERATION ) }, + { "ePOSITION", static_cast( physx::PxArticulationCacheFlag::ePOSITION ) }, + { "eFORCE", static_cast( physx::PxArticulationCacheFlag::eFORCE ) }, + { "eLINK_VELOCITY", static_cast( physx::PxArticulationCacheFlag::eLINK_VELOCITY ) }, + { "eLINK_ACCELERATION", static_cast( physx::PxArticulationCacheFlag::eLINK_ACCELERATION ) }, + { "eROOT_TRANSFORM", static_cast( physx::PxArticulationCacheFlag::eROOT_TRANSFORM ) }, + { "eROOT_VELOCITIES", static_cast( physx::PxArticulationCacheFlag::eROOT_VELOCITIES ) }, + { "eSENSOR_FORCES", static_cast( physx::PxArticulationCacheFlag::eSENSOR_FORCES ) }, + { "eJOINT_SOLVER_FORCES", static_cast( physx::PxArticulationCacheFlag::eJOINT_SOLVER_FORCES ) }, + { "eALL", static_cast( physx::PxArticulationCacheFlag::eALL ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationCacheFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationCacheFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxArticulationReducedCoordinate; + struct PxArticulationReducedCoordinateGeneratedValues + { + PxScene * Scene; + PxU32 SolverIterationCounts[2]; + _Bool IsSleeping; + PxReal SleepThreshold; + PxReal StabilizationThreshold; + PxReal WakeCounter; + PxReal MaxCOMLinearVelocity; + PxReal MaxCOMAngularVelocity; + const char * Name; + PxAggregate * Aggregate; + PxArticulationFlags ArticulationFlags; + PxTransform RootGlobalPose; + PxVec3 RootLinearVelocity; + PxVec3 RootAngularVelocity; + void * UserData; + PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedValues( const PxArticulationReducedCoordinate* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Scene, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, SolverIterationCounts, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, IsSleeping, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, SleepThreshold, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, StabilizationThreshold, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, WakeCounter, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, MaxCOMLinearVelocity, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, MaxCOMAngularVelocity, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Name, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, Aggregate, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, ArticulationFlags, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootGlobalPose, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootLinearVelocity, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, RootAngularVelocity, PxArticulationReducedCoordinateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationReducedCoordinate, UserData, PxArticulationReducedCoordinateGeneratedValues) + struct PxArticulationReducedCoordinateGeneratedInfo + + { + static const char* getClassName() { return "PxArticulationReducedCoordinate"; } + PxReadOnlyPropertyInfo Scene; + PxRangePropertyInfo SolverIterationCounts; + PxReadOnlyPropertyInfo IsSleeping; + PxPropertyInfo SleepThreshold; + PxPropertyInfo StabilizationThreshold; + PxPropertyInfo WakeCounter; + PxPropertyInfo MaxCOMLinearVelocity; + PxPropertyInfo MaxCOMAngularVelocity; + PxArticulationLinkCollectionProp Links; + PxPropertyInfo Name; + PxReadOnlyPropertyInfo Aggregate; + PxPropertyInfo ArticulationFlags; + PxPropertyInfo RootGlobalPose; + PxPropertyInfo RootLinearVelocity; + PxPropertyInfo RootAngularVelocity; + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 16; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scene, inStartIndex + 0 );; + inOperator( SolverIterationCounts, inStartIndex + 1 );; + inOperator( IsSleeping, inStartIndex + 2 );; + inOperator( SleepThreshold, inStartIndex + 3 );; + inOperator( StabilizationThreshold, inStartIndex + 4 );; + inOperator( WakeCounter, inStartIndex + 5 );; + inOperator( MaxCOMLinearVelocity, inStartIndex + 6 );; + inOperator( MaxCOMAngularVelocity, inStartIndex + 7 );; + inOperator( Links, inStartIndex + 8 );; + inOperator( Name, inStartIndex + 9 );; + inOperator( Aggregate, inStartIndex + 10 );; + inOperator( ArticulationFlags, inStartIndex + 11 );; + inOperator( RootGlobalPose, inStartIndex + 12 );; + inOperator( RootLinearVelocity, inStartIndex + 13 );; + inOperator( RootAngularVelocity, inStartIndex + 14 );; + inOperator( UserData, inStartIndex + 15 );; + return 16 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxArticulationReducedCoordinateGeneratedInfo Info; + const PxArticulationReducedCoordinateGeneratedInfo* getInfo() { return &Info; } + }; + + class PxAggregate; + struct PxAggregateGeneratedValues + { + PxU32 MaxNbActors; + PxU32 MaxNbShapes; + _Bool SelfCollision; + const char * ConcreteTypeName; + void * UserData; + PX_PHYSX_CORE_API PxAggregateGeneratedValues( const PxAggregate* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, MaxNbActors, PxAggregateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, MaxNbShapes, PxAggregateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, SelfCollision, PxAggregateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, ConcreteTypeName, PxAggregateGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxAggregate, UserData, PxAggregateGeneratedValues) + struct PxAggregateGeneratedInfo + + { + static const char* getClassName() { return "PxAggregate"; } + PxReadOnlyPropertyInfo MaxNbActors; + PxReadOnlyPropertyInfo MaxNbShapes; + PxReadOnlyCollectionPropertyInfo Actors; + PxReadOnlyPropertyInfo SelfCollision; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxAggregateGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 6; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MaxNbActors, inStartIndex + 0 );; + inOperator( MaxNbShapes, inStartIndex + 1 );; + inOperator( Actors, inStartIndex + 2 );; + inOperator( SelfCollision, inStartIndex + 3 );; + inOperator( ConcreteTypeName, inStartIndex + 4 );; + inOperator( UserData, inStartIndex + 5 );; + return 6 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxAggregateGeneratedInfo Info; + const PxAggregateGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxConstraintFlag__EnumConversion[] = { + { "eBROKEN", static_cast( physx::PxConstraintFlag::eBROKEN ) }, + { "ePROJECT_TO_ACTOR0", static_cast( physx::PxConstraintFlag::ePROJECT_TO_ACTOR0 ) }, + { "ePROJECT_TO_ACTOR1", static_cast( physx::PxConstraintFlag::ePROJECT_TO_ACTOR1 ) }, + { "ePROJECTION", static_cast( physx::PxConstraintFlag::ePROJECTION ) }, + { "eCOLLISION_ENABLED", static_cast( physx::PxConstraintFlag::eCOLLISION_ENABLED ) }, + { "eVISUALIZATION", static_cast( physx::PxConstraintFlag::eVISUALIZATION ) }, + { "eDRIVE_LIMITS_ARE_FORCES", static_cast( physx::PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES ) }, + { "eIMPROVED_SLERP", static_cast( physx::PxConstraintFlag::eIMPROVED_SLERP ) }, + { "eDISABLE_PREPROCESSING", static_cast( physx::PxConstraintFlag::eDISABLE_PREPROCESSING ) }, + { "eENABLE_EXTENDED_LIMITS", static_cast( physx::PxConstraintFlag::eENABLE_EXTENDED_LIMITS ) }, + { "eGPU_COMPATIBLE", static_cast( physx::PxConstraintFlag::eGPU_COMPATIBLE ) }, + { "eALWAYS_UPDATE", static_cast( physx::PxConstraintFlag::eALWAYS_UPDATE ) }, + { "eDISABLE_CONSTRAINT", static_cast( physx::PxConstraintFlag::eDISABLE_CONSTRAINT ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxConstraintFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxConstraintFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxConstraint; + struct PxConstraintGeneratedValues + { + PxScene * Scene; + PxRigidActor * Actors[2]; + PxConstraintFlags Flags; + _Bool IsValid; + PxReal BreakForce[2]; + PxReal MinResponseThreshold; + const char * ConcreteTypeName; + void * UserData; + PX_PHYSX_CORE_API PxConstraintGeneratedValues( const PxConstraint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Scene, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Actors, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, Flags, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, IsValid, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, BreakForce, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, MinResponseThreshold, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, ConcreteTypeName, PxConstraintGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConstraint, UserData, PxConstraintGeneratedValues) + struct PxConstraintGeneratedInfo + + { + static const char* getClassName() { return "PxConstraint"; } + PxReadOnlyPropertyInfo Scene; + PxRangePropertyInfo Actors; + PxPropertyInfo Flags; + PxReadOnlyPropertyInfo IsValid; + PxRangePropertyInfo BreakForce; + PxPropertyInfo MinResponseThreshold; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo UserData; + + PX_PHYSX_CORE_API PxConstraintGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 8; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scene, inStartIndex + 0 );; + inOperator( Actors, inStartIndex + 1 );; + inOperator( Flags, inStartIndex + 2 );; + inOperator( IsValid, inStartIndex + 3 );; + inOperator( BreakForce, inStartIndex + 4 );; + inOperator( MinResponseThreshold, inStartIndex + 5 );; + inOperator( ConcreteTypeName, inStartIndex + 6 );; + inOperator( UserData, inStartIndex + 7 );; + return 8 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxConstraintGeneratedInfo Info; + const PxConstraintGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxGeometryType__EnumConversion[] = { + { "eSPHERE", static_cast( physx::PxGeometryType::eSPHERE ) }, + { "ePLANE", static_cast( physx::PxGeometryType::ePLANE ) }, + { "eCAPSULE", static_cast( physx::PxGeometryType::eCAPSULE ) }, + { "eBOX", static_cast( physx::PxGeometryType::eBOX ) }, + { "eCONVEXMESH", static_cast( physx::PxGeometryType::eCONVEXMESH ) }, + { "ePARTICLESYSTEM", static_cast( physx::PxGeometryType::ePARTICLESYSTEM ) }, + { "eTETRAHEDRONMESH", static_cast( physx::PxGeometryType::eTETRAHEDRONMESH ) }, + { "eTRIANGLEMESH", static_cast( physx::PxGeometryType::eTRIANGLEMESH ) }, + { "eHEIGHTFIELD", static_cast( physx::PxGeometryType::eHEIGHTFIELD ) }, + { "eHAIRSYSTEM", static_cast( physx::PxGeometryType::eHAIRSYSTEM ) }, + { "eCUSTOM", static_cast( physx::PxGeometryType::eCUSTOM ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxGeometryType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxGeometryType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxShape; + struct PxShapeGeneratedValues + : PxRefCountedGeneratedValues { + PxGeometryType::Enum GeometryType; + PxTransform LocalPose; + PxFilterData SimulationFilterData; + PxFilterData QueryFilterData; + PxReal ContactOffset; + PxReal RestOffset; + PxReal DensityForFluid; + PxReal TorsionalPatchRadius; + PxReal MinTorsionalPatchRadius; + PxShapeFlags Flags; + _Bool IsExclusive; + const char * Name; + const char * ConcreteTypeName; + void * UserData; + PxGeometryHolder Geom; + PX_PHYSX_CORE_API PxShapeGeneratedValues( const PxShape* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, GeometryType, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, LocalPose, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, SimulationFilterData, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, QueryFilterData, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, ContactOffset, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, RestOffset, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, DensityForFluid, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, TorsionalPatchRadius, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, MinTorsionalPatchRadius, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Flags, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, IsExclusive, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Name, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, ConcreteTypeName, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, UserData, PxShapeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxShape, Geom, PxShapeGeneratedValues) + struct PxShapeGeneratedInfo + : PxRefCountedGeneratedInfo + { + static const char* getClassName() { return "PxShape"; } + PxReadOnlyPropertyInfo GeometryType; + PxPropertyInfo LocalPose; + PxPropertyInfo SimulationFilterData; + PxPropertyInfo QueryFilterData; + PxShapeMaterialsProperty Materials; + PxPropertyInfo ContactOffset; + PxPropertyInfo RestOffset; + PxPropertyInfo DensityForFluid; + PxPropertyInfo TorsionalPatchRadius; + PxPropertyInfo MinTorsionalPatchRadius; + PxPropertyInfo Flags; + PxReadOnlyPropertyInfo IsExclusive; + PxPropertyInfo Name; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo UserData; + PxShapeGeomProperty Geom; + + PX_PHYSX_CORE_API PxShapeGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxRefCountedGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxRefCountedGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 16; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxRefCountedGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( GeometryType, inStartIndex + 0 );; + inOperator( LocalPose, inStartIndex + 1 );; + inOperator( SimulationFilterData, inStartIndex + 2 );; + inOperator( QueryFilterData, inStartIndex + 3 );; + inOperator( Materials, inStartIndex + 4 );; + inOperator( ContactOffset, inStartIndex + 5 );; + inOperator( RestOffset, inStartIndex + 6 );; + inOperator( DensityForFluid, inStartIndex + 7 );; + inOperator( TorsionalPatchRadius, inStartIndex + 8 );; + inOperator( MinTorsionalPatchRadius, inStartIndex + 9 );; + inOperator( Flags, inStartIndex + 10 );; + inOperator( IsExclusive, inStartIndex + 11 );; + inOperator( Name, inStartIndex + 12 );; + inOperator( ConcreteTypeName, inStartIndex + 13 );; + inOperator( UserData, inStartIndex + 14 );; + inOperator( Geom, inStartIndex + 15 );; + return 16 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxShapeGeneratedInfo Info; + const PxShapeGeneratedInfo* getInfo() { return &Info; } + }; + + class PxPruningStructure; + struct PxPruningStructureGeneratedValues + { + const void * StaticMergeData; + const void * DynamicMergeData; + const char * ConcreteTypeName; + PX_PHYSX_CORE_API PxPruningStructureGeneratedValues( const PxPruningStructure* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, StaticMergeData, PxPruningStructureGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, DynamicMergeData, PxPruningStructureGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPruningStructure, ConcreteTypeName, PxPruningStructureGeneratedValues) + struct PxPruningStructureGeneratedInfo + + { + static const char* getClassName() { return "PxPruningStructure"; } + PxReadOnlyCollectionPropertyInfo RigidActors; + PxReadOnlyPropertyInfo StaticMergeData; + PxReadOnlyPropertyInfo DynamicMergeData; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PX_PHYSX_CORE_API PxPruningStructureGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( RigidActors, inStartIndex + 0 );; + inOperator( StaticMergeData, inStartIndex + 1 );; + inOperator( DynamicMergeData, inStartIndex + 2 );; + inOperator( ConcreteTypeName, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxPruningStructureGeneratedInfo Info; + const PxPruningStructureGeneratedInfo* getInfo() { return &Info; } + }; + + class PxTolerancesScale; + struct PxTolerancesScaleGeneratedValues + { + _Bool IsValid; + PxReal Length; + PxReal Speed; + PX_PHYSX_CORE_API PxTolerancesScaleGeneratedValues( const PxTolerancesScale* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, IsValid, PxTolerancesScaleGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, Length, PxTolerancesScaleGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTolerancesScale, Speed, PxTolerancesScaleGeneratedValues) + struct PxTolerancesScaleGeneratedInfo + + { + static const char* getClassName() { return "PxTolerancesScale"; } + PxReadOnlyPropertyInfo IsValid; + PxPropertyInfo Length; + PxPropertyInfo Speed; + + PX_PHYSX_CORE_API PxTolerancesScaleGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( IsValid, inStartIndex + 0 );; + inOperator( Length, inStartIndex + 1 );; + inOperator( Speed, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxTolerancesScaleGeneratedInfo Info; + const PxTolerancesScaleGeneratedInfo* getInfo() { return &Info; } + }; + + class PxGeometry; + struct PxGeometryGeneratedValues + { + PX_PHYSX_CORE_API PxGeometryGeneratedValues( const PxGeometry* inSource ); + }; + struct PxGeometryGeneratedInfo + + { + static const char* getClassName() { return "PxGeometry"; } + + PX_PHYSX_CORE_API PxGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 0; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return 0 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxGeometryGeneratedInfo Info; + const PxGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxBoxGeometry; + struct PxBoxGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxVec3 HalfExtents; + PX_PHYSX_CORE_API PxBoxGeometryGeneratedValues( const PxBoxGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBoxGeometry, HalfExtents, PxBoxGeometryGeneratedValues) + struct PxBoxGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxBoxGeometry"; } + PxPropertyInfo HalfExtents; + + PX_PHYSX_CORE_API PxBoxGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( HalfExtents, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxBoxGeometryGeneratedInfo Info; + const PxBoxGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxCapsuleGeometry; + struct PxCapsuleGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxReal Radius; + PxReal HalfHeight; + PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedValues( const PxCapsuleGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCapsuleGeometry, Radius, PxCapsuleGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCapsuleGeometry, HalfHeight, PxCapsuleGeometryGeneratedValues) + struct PxCapsuleGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxCapsuleGeometry"; } + PxPropertyInfo Radius; + PxPropertyInfo HalfHeight; + + PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Radius, inStartIndex + 0 );; + inOperator( HalfHeight, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxCapsuleGeometryGeneratedInfo Info; + const PxCapsuleGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxMeshScale; + struct PxMeshScaleGeneratedValues + { + PxVec3 Scale; + PxQuat Rotation; + PX_PHYSX_CORE_API PxMeshScaleGeneratedValues( const PxMeshScale* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMeshScale, Scale, PxMeshScaleGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxMeshScale, Rotation, PxMeshScaleGeneratedValues) + struct PxMeshScaleGeneratedInfo + + { + static const char* getClassName() { return "PxMeshScale"; } + PxPropertyInfo Scale; + PxPropertyInfo Rotation; + + PX_PHYSX_CORE_API PxMeshScaleGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scale, inStartIndex + 0 );; + inOperator( Rotation, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxMeshScaleGeneratedInfo Info; + const PxMeshScaleGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxConvexMeshGeometryFlag__EnumConversion[] = { + { "eTIGHT_BOUNDS", static_cast( physx::PxConvexMeshGeometryFlag::eTIGHT_BOUNDS ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxConvexMeshGeometryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxConvexMeshGeometryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxConvexMeshGeometry; + struct PxConvexMeshGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxMeshScale Scale; + PxConvexMesh * ConvexMesh; + PxConvexMeshGeometryFlags MeshFlags; + PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedValues( const PxConvexMeshGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, Scale, PxConvexMeshGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, ConvexMesh, PxConvexMeshGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxConvexMeshGeometry, MeshFlags, PxConvexMeshGeometryGeneratedValues) + struct PxConvexMeshGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxConvexMeshGeometry"; } + PxPropertyInfo Scale; + PxPropertyInfo ConvexMesh; + PxPropertyInfo MeshFlags; + + PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scale, inStartIndex + 0 );; + inOperator( ConvexMesh, inStartIndex + 1 );; + inOperator( MeshFlags, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxConvexMeshGeometryGeneratedInfo Info; + const PxConvexMeshGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxSphereGeometry; + struct PxSphereGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxReal Radius; + PX_PHYSX_CORE_API PxSphereGeometryGeneratedValues( const PxSphereGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphereGeometry, Radius, PxSphereGeometryGeneratedValues) + struct PxSphereGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxSphereGeometry"; } + PxPropertyInfo Radius; + + PX_PHYSX_CORE_API PxSphereGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Radius, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSphereGeometryGeneratedInfo Info; + const PxSphereGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxPlaneGeometry; + struct PxPlaneGeometryGeneratedValues + : PxGeometryGeneratedValues { + PX_PHYSX_CORE_API PxPlaneGeometryGeneratedValues( const PxPlaneGeometry* inSource ); + }; + struct PxPlaneGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxPlaneGeometry"; } + + PX_PHYSX_CORE_API PxPlaneGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 0; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return 0 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxPlaneGeometryGeneratedInfo Info; + const PxPlaneGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxMeshGeometryFlag__EnumConversion[] = { + { "eTIGHT_BOUNDS", static_cast( physx::PxMeshGeometryFlag::eTIGHT_BOUNDS ) }, + { "eDOUBLE_SIDED", static_cast( physx::PxMeshGeometryFlag::eDOUBLE_SIDED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxMeshGeometryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxMeshGeometryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxTriangleMeshGeometry; + struct PxTriangleMeshGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxMeshScale Scale; + PxMeshGeometryFlags MeshFlags; + PxTriangleMesh * TriangleMesh; + PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedValues( const PxTriangleMeshGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, Scale, PxTriangleMeshGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, MeshFlags, PxTriangleMeshGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTriangleMeshGeometry, TriangleMesh, PxTriangleMeshGeometryGeneratedValues) + struct PxTriangleMeshGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxTriangleMeshGeometry"; } + PxPropertyInfo Scale; + PxPropertyInfo MeshFlags; + PxPropertyInfo TriangleMesh; + + PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Scale, inStartIndex + 0 );; + inOperator( MeshFlags, inStartIndex + 1 );; + inOperator( TriangleMesh, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxTriangleMeshGeometryGeneratedInfo Info; + const PxTriangleMeshGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxHeightFieldGeometry; + struct PxHeightFieldGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxHeightField * HeightField; + PxReal HeightScale; + PxReal RowScale; + PxReal ColumnScale; + PxMeshGeometryFlags HeightFieldFlags; + PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedValues( const PxHeightFieldGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightField, PxHeightFieldGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightScale, PxHeightFieldGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, RowScale, PxHeightFieldGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, ColumnScale, PxHeightFieldGeometryGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldGeometry, HeightFieldFlags, PxHeightFieldGeometryGeneratedValues) + struct PxHeightFieldGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxHeightFieldGeometry"; } + PxPropertyInfo HeightField; + PxPropertyInfo HeightScale; + PxPropertyInfo RowScale; + PxPropertyInfo ColumnScale; + PxPropertyInfo HeightFieldFlags; + + PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( HeightField, inStartIndex + 0 );; + inOperator( HeightScale, inStartIndex + 1 );; + inOperator( RowScale, inStartIndex + 2 );; + inOperator( ColumnScale, inStartIndex + 3 );; + inOperator( HeightFieldFlags, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxHeightFieldGeometryGeneratedInfo Info; + const PxHeightFieldGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxSceneQueryUpdateMode__EnumConversion[] = { + { "eBUILD_ENABLED_COMMIT_ENABLED", static_cast( physx::PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_ENABLED ) }, + { "eBUILD_ENABLED_COMMIT_DISABLED", static_cast( physx::PxSceneQueryUpdateMode::eBUILD_ENABLED_COMMIT_DISABLED ) }, + { "eBUILD_DISABLED_COMMIT_DISABLED", static_cast( physx::PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSceneQueryUpdateMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSceneQueryUpdateMode__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxHitFlag__EnumConversion[] = { + { "ePOSITION", static_cast( physx::PxHitFlag::ePOSITION ) }, + { "eNORMAL", static_cast( physx::PxHitFlag::eNORMAL ) }, + { "eUV", static_cast( physx::PxHitFlag::eUV ) }, + { "eASSUME_NO_INITIAL_OVERLAP", static_cast( physx::PxHitFlag::eASSUME_NO_INITIAL_OVERLAP ) }, + { "eANY_HIT", static_cast( physx::PxHitFlag::eANY_HIT ) }, + { "eMESH_MULTIPLE", static_cast( physx::PxHitFlag::eMESH_MULTIPLE ) }, + { "eMESH_ANY", static_cast( physx::PxHitFlag::eMESH_ANY ) }, + { "eMESH_BOTH_SIDES", static_cast( physx::PxHitFlag::eMESH_BOTH_SIDES ) }, + { "ePRECISE_SWEEP", static_cast( physx::PxHitFlag::ePRECISE_SWEEP ) }, + { "eMTD", static_cast( physx::PxHitFlag::eMTD ) }, + { "eFACE_INDEX", static_cast( physx::PxHitFlag::eFACE_INDEX ) }, + { "eDEFAULT", static_cast( physx::PxHitFlag::eDEFAULT ) }, + { "eMODIFIABLE_FLAGS", static_cast( physx::PxHitFlag::eMODIFIABLE_FLAGS ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxHitFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHitFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxGeometryQueryFlag__EnumConversion[] = { + { "eSIMD_GUARD", static_cast( physx::PxGeometryQueryFlag::eSIMD_GUARD ) }, + { "eDEFAULT", static_cast( physx::PxGeometryQueryFlag::eDEFAULT ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxGeometryQueryFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxGeometryQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxSceneQuerySystemBase; + struct PxSceneQuerySystemBaseGeneratedValues + { + PxU32 DynamicTreeRebuildRateHint; + PxSceneQueryUpdateMode::Enum UpdateMode; + PxU32 StaticTimestamp; + PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedValues( const PxSceneQuerySystemBase* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, DynamicTreeRebuildRateHint, PxSceneQuerySystemBaseGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, UpdateMode, PxSceneQuerySystemBaseGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQuerySystemBase, StaticTimestamp, PxSceneQuerySystemBaseGeneratedValues) + struct PxSceneQuerySystemBaseGeneratedInfo + + { + static const char* getClassName() { return "PxSceneQuerySystemBase"; } + PxPropertyInfo DynamicTreeRebuildRateHint; + PxPropertyInfo UpdateMode; + PxReadOnlyPropertyInfo StaticTimestamp; + + PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DynamicTreeRebuildRateHint, inStartIndex + 0 );; + inOperator( UpdateMode, inStartIndex + 1 );; + inOperator( StaticTimestamp, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneQuerySystemBaseGeneratedInfo Info; + const PxSceneQuerySystemBaseGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxPruningStructureType__EnumConversion[] = { + { "eNONE", static_cast( physx::PxPruningStructureType::eNONE ) }, + { "eDYNAMIC_AABB_TREE", static_cast( physx::PxPruningStructureType::eDYNAMIC_AABB_TREE ) }, + { "eSTATIC_AABB_TREE", static_cast( physx::PxPruningStructureType::eSTATIC_AABB_TREE ) }, + { "eLAST", static_cast( physx::PxPruningStructureType::eLAST ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxPruningStructureType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPruningStructureType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxSceneSQSystem; + struct PxSceneSQSystemGeneratedValues + : PxSceneQuerySystemBaseGeneratedValues { + PxSceneQueryUpdateMode::Enum SceneQueryUpdateMode; + PxU32 SceneQueryStaticTimestamp; + PxPruningStructureType::Enum StaticStructure; + PxPruningStructureType::Enum DynamicStructure; + PX_PHYSX_CORE_API PxSceneSQSystemGeneratedValues( const PxSceneSQSystem* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, SceneQueryUpdateMode, PxSceneSQSystemGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, SceneQueryStaticTimestamp, PxSceneSQSystemGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, StaticStructure, PxSceneSQSystemGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneSQSystem, DynamicStructure, PxSceneSQSystemGeneratedValues) + struct PxSceneSQSystemGeneratedInfo + : PxSceneQuerySystemBaseGeneratedInfo + { + static const char* getClassName() { return "PxSceneSQSystem"; } + PxPropertyInfo SceneQueryUpdateMode; + PxReadOnlyPropertyInfo SceneQueryStaticTimestamp; + PxReadOnlyPropertyInfo StaticStructure; + PxReadOnlyPropertyInfo DynamicStructure; + + PX_PHYSX_CORE_API PxSceneSQSystemGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxSceneQuerySystemBaseGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxSceneQuerySystemBaseGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxSceneQuerySystemBaseGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( SceneQueryUpdateMode, inStartIndex + 0 );; + inOperator( SceneQueryStaticTimestamp, inStartIndex + 1 );; + inOperator( StaticStructure, inStartIndex + 2 );; + inOperator( DynamicStructure, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneSQSystemGeneratedInfo Info; + const PxSceneSQSystemGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxSceneFlag__EnumConversion[] = { + { "eENABLE_ACTIVE_ACTORS", static_cast( physx::PxSceneFlag::eENABLE_ACTIVE_ACTORS ) }, + { "eENABLE_CCD", static_cast( physx::PxSceneFlag::eENABLE_CCD ) }, + { "eDISABLE_CCD_RESWEEP", static_cast( physx::PxSceneFlag::eDISABLE_CCD_RESWEEP ) }, + { "eENABLE_PCM", static_cast( physx::PxSceneFlag::eENABLE_PCM ) }, + { "eDISABLE_CONTACT_REPORT_BUFFER_RESIZE", static_cast( physx::PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE ) }, + { "eDISABLE_CONTACT_CACHE", static_cast( physx::PxSceneFlag::eDISABLE_CONTACT_CACHE ) }, + { "eREQUIRE_RW_LOCK", static_cast( physx::PxSceneFlag::eREQUIRE_RW_LOCK ) }, + { "eENABLE_STABILIZATION", static_cast( physx::PxSceneFlag::eENABLE_STABILIZATION ) }, + { "eENABLE_AVERAGE_POINT", static_cast( physx::PxSceneFlag::eENABLE_AVERAGE_POINT ) }, + { "eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS", static_cast( physx::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS ) }, + { "eENABLE_GPU_DYNAMICS", static_cast( physx::PxSceneFlag::eENABLE_GPU_DYNAMICS ) }, + { "eENABLE_ENHANCED_DETERMINISM", static_cast( physx::PxSceneFlag::eENABLE_ENHANCED_DETERMINISM ) }, + { "eENABLE_FRICTION_EVERY_ITERATION", static_cast( physx::PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION ) }, + { "eSUPPRESS_READBACK", static_cast( physx::PxSceneFlag::eSUPPRESS_READBACK ) }, + { "eFORCE_READBACK", static_cast( physx::PxSceneFlag::eFORCE_READBACK ) }, + { "eMUTABLE_FLAGS", static_cast( physx::PxSceneFlag::eMUTABLE_FLAGS ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSceneFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSceneFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxActorTypeFlag__EnumConversion[] = { + { "eRIGID_STATIC", static_cast( physx::PxActorTypeFlag::eRIGID_STATIC ) }, + { "eRIGID_DYNAMIC", static_cast( physx::PxActorTypeFlag::eRIGID_DYNAMIC ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxActorTypeFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorTypeFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxParticleSolverType__EnumConversion[] = { + { "ePBD", static_cast( physx::PxParticleSolverType::ePBD ) }, + { "eFLIP", static_cast( physx::PxParticleSolverType::eFLIP ) }, + { "eMPM", static_cast( physx::PxParticleSolverType::eMPM ) }, + { "eCUSTOM", static_cast( physx::PxParticleSolverType::eCUSTOM ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxParticleSolverType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxParticleSolverType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxPairFilteringMode__EnumConversion[] = { + { "eKEEP", static_cast( physx::PxPairFilteringMode::eKEEP ) }, + { "eSUPPRESS", static_cast( physx::PxPairFilteringMode::eSUPPRESS ) }, + { "eKILL", static_cast( physx::PxPairFilteringMode::eKILL ) }, + { "eDEFAULT", static_cast( physx::PxPairFilteringMode::eDEFAULT ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxPairFilteringMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPairFilteringMode__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxFrictionType__EnumConversion[] = { + { "ePATCH", static_cast( physx::PxFrictionType::ePATCH ) }, + { "eONE_DIRECTIONAL", static_cast( physx::PxFrictionType::eONE_DIRECTIONAL ) }, + { "eTWO_DIRECTIONAL", static_cast( physx::PxFrictionType::eTWO_DIRECTIONAL ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxFrictionType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxFrictionType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxSolverType__EnumConversion[] = { + { "ePGS", static_cast( physx::PxSolverType::ePGS ) }, + { "eTGS", static_cast( physx::PxSolverType::eTGS ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSolverType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSolverType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxVisualizationParameter__EnumConversion[] = { + { "eSCALE", static_cast( physx::PxVisualizationParameter::eSCALE ) }, + { "eWORLD_AXES", static_cast( physx::PxVisualizationParameter::eWORLD_AXES ) }, + { "eBODY_AXES", static_cast( physx::PxVisualizationParameter::eBODY_AXES ) }, + { "eBODY_MASS_AXES", static_cast( physx::PxVisualizationParameter::eBODY_MASS_AXES ) }, + { "eBODY_LIN_VELOCITY", static_cast( physx::PxVisualizationParameter::eBODY_LIN_VELOCITY ) }, + { "eBODY_ANG_VELOCITY", static_cast( physx::PxVisualizationParameter::eBODY_ANG_VELOCITY ) }, + { "eCONTACT_POINT", static_cast( physx::PxVisualizationParameter::eCONTACT_POINT ) }, + { "eCONTACT_NORMAL", static_cast( physx::PxVisualizationParameter::eCONTACT_NORMAL ) }, + { "eCONTACT_ERROR", static_cast( physx::PxVisualizationParameter::eCONTACT_ERROR ) }, + { "eCONTACT_FORCE", static_cast( physx::PxVisualizationParameter::eCONTACT_FORCE ) }, + { "eACTOR_AXES", static_cast( physx::PxVisualizationParameter::eACTOR_AXES ) }, + { "eCOLLISION_AABBS", static_cast( physx::PxVisualizationParameter::eCOLLISION_AABBS ) }, + { "eCOLLISION_SHAPES", static_cast( physx::PxVisualizationParameter::eCOLLISION_SHAPES ) }, + { "eCOLLISION_AXES", static_cast( physx::PxVisualizationParameter::eCOLLISION_AXES ) }, + { "eCOLLISION_COMPOUNDS", static_cast( physx::PxVisualizationParameter::eCOLLISION_COMPOUNDS ) }, + { "eCOLLISION_FNORMALS", static_cast( physx::PxVisualizationParameter::eCOLLISION_FNORMALS ) }, + { "eCOLLISION_EDGES", static_cast( physx::PxVisualizationParameter::eCOLLISION_EDGES ) }, + { "eCOLLISION_STATIC", static_cast( physx::PxVisualizationParameter::eCOLLISION_STATIC ) }, + { "eCOLLISION_DYNAMIC", static_cast( physx::PxVisualizationParameter::eCOLLISION_DYNAMIC ) }, + { "eJOINT_LOCAL_FRAMES", static_cast( physx::PxVisualizationParameter::eJOINT_LOCAL_FRAMES ) }, + { "eJOINT_LIMITS", static_cast( physx::PxVisualizationParameter::eJOINT_LIMITS ) }, + { "eCULL_BOX", static_cast( physx::PxVisualizationParameter::eCULL_BOX ) }, + { "eMBP_REGIONS", static_cast( physx::PxVisualizationParameter::eMBP_REGIONS ) }, + { "eSIMULATION_MESH", static_cast( physx::PxVisualizationParameter::eSIMULATION_MESH ) }, + { "eSDF", static_cast( physx::PxVisualizationParameter::eSDF ) }, + { "eNUM_VALUES", static_cast( physx::PxVisualizationParameter::eNUM_VALUES ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVisualizationParameter::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVisualizationParameter__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxBroadPhaseType__EnumConversion[] = { + { "eSAP", static_cast( physx::PxBroadPhaseType::eSAP ) }, + { "eMBP", static_cast( physx::PxBroadPhaseType::eMBP ) }, + { "eABP", static_cast( physx::PxBroadPhaseType::eABP ) }, + { "ePABP", static_cast( physx::PxBroadPhaseType::ePABP ) }, + { "eGPU", static_cast( physx::PxBroadPhaseType::eGPU ) }, + { "eLAST", static_cast( physx::PxBroadPhaseType::eLAST ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxBroadPhaseType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxBroadPhaseType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxArticulationGpuDataType__EnumConversion[] = { + { "eJOINT_POSITION", static_cast( physx::PxArticulationGpuDataType::eJOINT_POSITION ) }, + { "eJOINT_VELOCITY", static_cast( physx::PxArticulationGpuDataType::eJOINT_VELOCITY ) }, + { "eJOINT_ACCELERATION", static_cast( physx::PxArticulationGpuDataType::eJOINT_ACCELERATION ) }, + { "eJOINT_FORCE", static_cast( physx::PxArticulationGpuDataType::eJOINT_FORCE ) }, + { "eJOINT_SOLVER_FORCE", static_cast( physx::PxArticulationGpuDataType::eJOINT_SOLVER_FORCE ) }, + { "eJOINT_TARGET_VELOCITY", static_cast( physx::PxArticulationGpuDataType::eJOINT_TARGET_VELOCITY ) }, + { "eJOINT_TARGET_POSITION", static_cast( physx::PxArticulationGpuDataType::eJOINT_TARGET_POSITION ) }, + { "eSENSOR_FORCE", static_cast( physx::PxArticulationGpuDataType::eSENSOR_FORCE ) }, + { "eROOT_TRANSFORM", static_cast( physx::PxArticulationGpuDataType::eROOT_TRANSFORM ) }, + { "eROOT_VELOCITY", static_cast( physx::PxArticulationGpuDataType::eROOT_VELOCITY ) }, + { "eLINK_TRANSFORM", static_cast( physx::PxArticulationGpuDataType::eLINK_TRANSFORM ) }, + { "eLINK_VELOCITY", static_cast( physx::PxArticulationGpuDataType::eLINK_VELOCITY ) }, + { "eLINK_FORCE", static_cast( physx::PxArticulationGpuDataType::eLINK_FORCE ) }, + { "eLINK_TORQUE", static_cast( physx::PxArticulationGpuDataType::eLINK_TORQUE ) }, + { "eFIXED_TENDON", static_cast( physx::PxArticulationGpuDataType::eFIXED_TENDON ) }, + { "eFIXED_TENDON_JOINT", static_cast( physx::PxArticulationGpuDataType::eFIXED_TENDON_JOINT ) }, + { "eSPATIAL_TENDON", static_cast( physx::PxArticulationGpuDataType::eSPATIAL_TENDON ) }, + { "eSPATIAL_TENDON_ATTACHMENT", static_cast( physx::PxArticulationGpuDataType::eSPATIAL_TENDON_ATTACHMENT ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxArticulationGpuDataType::Enum > { PxEnumTraits() : NameConversion( g_physx__PxArticulationGpuDataType__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxSoftBodyDataFlag__EnumConversion[] = { + { "eTET_INDICES", static_cast( physx::PxSoftBodyDataFlag::eTET_INDICES ) }, + { "eTET_STRESS", static_cast( physx::PxSoftBodyDataFlag::eTET_STRESS ) }, + { "eTET_STRESSCOEFF", static_cast( physx::PxSoftBodyDataFlag::eTET_STRESSCOEFF ) }, + { "eTET_REST_POSES", static_cast( physx::PxSoftBodyDataFlag::eTET_REST_POSES ) }, + { "eTET_ROTATIONS", static_cast( physx::PxSoftBodyDataFlag::eTET_ROTATIONS ) }, + { "eTET_POSITION_INV_MASS", static_cast( physx::PxSoftBodyDataFlag::eTET_POSITION_INV_MASS ) }, + { "eSIM_TET_INDICES", static_cast( physx::PxSoftBodyDataFlag::eSIM_TET_INDICES ) }, + { "eSIM_VELOCITY_INV_MASS", static_cast( physx::PxSoftBodyDataFlag::eSIM_VELOCITY_INV_MASS ) }, + { "eSIM_POSITION_INV_MASS", static_cast( physx::PxSoftBodyDataFlag::eSIM_POSITION_INV_MASS ) }, + { "eSIM_KINEMATIC_TARGET", static_cast( physx::PxSoftBodyDataFlag::eSIM_KINEMATIC_TARGET ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSoftBodyDataFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSoftBodyDataFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxActorCacheFlag__EnumConversion[] = { + { "eACTOR_DATA", static_cast( physx::PxActorCacheFlag::eACTOR_DATA ) }, + { "eFORCE", static_cast( physx::PxActorCacheFlag::eFORCE ) }, + { "eTORQUE", static_cast( physx::PxActorCacheFlag::eTORQUE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxActorCacheFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxActorCacheFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxScene; + struct PxSceneGeneratedValues + : PxSceneSQSystemGeneratedValues { + PxSceneFlags Flags; + PxSceneLimits Limits; + PxU32 Timestamp; + PxCpuDispatcher * CpuDispatcher; + PxCudaContextManager * CudaContextManager; + PxSimulationEventCallback * SimulationEventCallback; + PxContactModifyCallback * ContactModifyCallback; + PxCCDContactModifyCallback * CCDContactModifyCallback; + PxBroadPhaseCallback * BroadPhaseCallback; + PxU32 FilterShaderDataSize; + PxSimulationFilterShader FilterShader; + PxSimulationFilterCallback * FilterCallback; + PxPairFilteringMode::Enum KinematicKinematicFilteringMode; + PxPairFilteringMode::Enum StaticKinematicFilteringMode; + PxVec3 Gravity; + PxReal BounceThresholdVelocity; + PxU32 CCDMaxPasses; + PxReal CCDMaxSeparation; + PxReal CCDThreshold; + PxReal MaxBiasCoefficient; + PxReal FrictionOffsetThreshold; + PxReal FrictionCorrelationDistance; + PxFrictionType::Enum FrictionType; + PxSolverType::Enum SolverType; + PxBounds3 VisualizationCullingBox; + PxBroadPhaseType::Enum BroadPhaseType; + PxTaskManager * TaskManager; + PxU32 MaxNbContactDataBlocksUsed; + PxU32 ContactReportStreamBufferSize; + PxU32 SolverBatchSize; + PxU32 SolverArticulationBatchSize; + PxReal WakeCounterResetValue; + PxgDynamicsMemoryConfig GpuDynamicsConfig; + void * UserData; + PxSimulationStatistics SimulationStatistics; + PX_PHYSX_CORE_API PxSceneGeneratedValues( const PxScene* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Flags, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Limits, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Timestamp, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CpuDispatcher, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CudaContextManager, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SimulationEventCallback, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, ContactModifyCallback, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDContactModifyCallback, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BroadPhaseCallback, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterShaderDataSize, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterShader, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FilterCallback, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, KinematicKinematicFilteringMode, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, StaticKinematicFilteringMode, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, Gravity, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BounceThresholdVelocity, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDMaxPasses, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDMaxSeparation, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, CCDThreshold, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, MaxBiasCoefficient, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionOffsetThreshold, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionCorrelationDistance, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, FrictionType, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverType, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, VisualizationCullingBox, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, BroadPhaseType, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, TaskManager, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, MaxNbContactDataBlocksUsed, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, ContactReportStreamBufferSize, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverBatchSize, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SolverArticulationBatchSize, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, WakeCounterResetValue, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, GpuDynamicsConfig, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, UserData, PxSceneGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxScene, SimulationStatistics, PxSceneGeneratedValues) + struct PxSceneGeneratedInfo + : PxSceneSQSystemGeneratedInfo + { + static const char* getClassName() { return "PxScene"; } + PxReadOnlyPropertyInfo Flags; + PxPropertyInfo Limits; + PxReadOnlyPropertyInfo Timestamp; + PxReadOnlyFilteredCollectionPropertyInfo Actors; + PxReadOnlyCollectionPropertyInfo SoftBodies; + PxReadOnlyCollectionPropertyInfo Articulations; + PxReadOnlyCollectionPropertyInfo Constraints; + PxReadOnlyCollectionPropertyInfo Aggregates; + PxReadOnlyPropertyInfo CpuDispatcher; + PxReadOnlyPropertyInfo CudaContextManager; + PxPropertyInfo SimulationEventCallback; + PxPropertyInfo ContactModifyCallback; + PxPropertyInfo CCDContactModifyCallback; + PxPropertyInfo BroadPhaseCallback; + PxReadOnlyPropertyInfo FilterShaderDataSize; + PxReadOnlyPropertyInfo FilterShader; + PxReadOnlyPropertyInfo FilterCallback; + PxReadOnlyPropertyInfo KinematicKinematicFilteringMode; + PxReadOnlyPropertyInfo StaticKinematicFilteringMode; + PxPropertyInfo Gravity; + PxPropertyInfo BounceThresholdVelocity; + PxPropertyInfo CCDMaxPasses; + PxPropertyInfo CCDMaxSeparation; + PxPropertyInfo CCDThreshold; + PxPropertyInfo MaxBiasCoefficient; + PxPropertyInfo FrictionOffsetThreshold; + PxPropertyInfo FrictionCorrelationDistance; + PxReadOnlyPropertyInfo FrictionType; + PxReadOnlyPropertyInfo SolverType; + PxPropertyInfo VisualizationCullingBox; + PxReadOnlyPropertyInfo BroadPhaseType; + PxReadOnlyCollectionPropertyInfo BroadPhaseRegions; + PxReadOnlyPropertyInfo TaskManager; + PxWriteOnlyPropertyInfo NbContactDataBlocks; + PxReadOnlyPropertyInfo MaxNbContactDataBlocksUsed; + PxReadOnlyPropertyInfo ContactReportStreamBufferSize; + PxPropertyInfo SolverBatchSize; + PxPropertyInfo SolverArticulationBatchSize; + PxReadOnlyPropertyInfo WakeCounterResetValue; + PxReadOnlyPropertyInfo GpuDynamicsConfig; + PxPropertyInfo UserData; + SimulationStatisticsProperty SimulationStatistics; + + PX_PHYSX_CORE_API PxSceneGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxSceneSQSystemGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxSceneSQSystemGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 42; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxSceneSQSystemGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Flags, inStartIndex + 0 );; + inOperator( Limits, inStartIndex + 1 );; + inOperator( Timestamp, inStartIndex + 2 );; + inOperator( Actors, inStartIndex + 3 );; + inOperator( SoftBodies, inStartIndex + 4 );; + inOperator( Articulations, inStartIndex + 5 );; + inOperator( Constraints, inStartIndex + 6 );; + inOperator( Aggregates, inStartIndex + 7 );; + inOperator( CpuDispatcher, inStartIndex + 8 );; + inOperator( CudaContextManager, inStartIndex + 9 );; + inOperator( SimulationEventCallback, inStartIndex + 10 );; + inOperator( ContactModifyCallback, inStartIndex + 11 );; + inOperator( CCDContactModifyCallback, inStartIndex + 12 );; + inOperator( BroadPhaseCallback, inStartIndex + 13 );; + inOperator( FilterShaderDataSize, inStartIndex + 14 );; + inOperator( FilterShader, inStartIndex + 15 );; + inOperator( FilterCallback, inStartIndex + 16 );; + inOperator( KinematicKinematicFilteringMode, inStartIndex + 17 );; + inOperator( StaticKinematicFilteringMode, inStartIndex + 18 );; + inOperator( Gravity, inStartIndex + 19 );; + inOperator( BounceThresholdVelocity, inStartIndex + 20 );; + inOperator( CCDMaxPasses, inStartIndex + 21 );; + inOperator( CCDMaxSeparation, inStartIndex + 22 );; + inOperator( CCDThreshold, inStartIndex + 23 );; + inOperator( MaxBiasCoefficient, inStartIndex + 24 );; + inOperator( FrictionOffsetThreshold, inStartIndex + 25 );; + inOperator( FrictionCorrelationDistance, inStartIndex + 26 );; + inOperator( FrictionType, inStartIndex + 27 );; + inOperator( SolverType, inStartIndex + 28 );; + inOperator( VisualizationCullingBox, inStartIndex + 29 );; + inOperator( BroadPhaseType, inStartIndex + 30 );; + inOperator( BroadPhaseRegions, inStartIndex + 31 );; + inOperator( TaskManager, inStartIndex + 32 );; + inOperator( NbContactDataBlocks, inStartIndex + 33 );; + inOperator( MaxNbContactDataBlocksUsed, inStartIndex + 34 );; + inOperator( ContactReportStreamBufferSize, inStartIndex + 35 );; + inOperator( SolverBatchSize, inStartIndex + 36 );; + inOperator( SolverArticulationBatchSize, inStartIndex + 37 );; + inOperator( WakeCounterResetValue, inStartIndex + 38 );; + inOperator( GpuDynamicsConfig, inStartIndex + 39 );; + inOperator( UserData, inStartIndex + 40 );; + inOperator( SimulationStatistics, inStartIndex + 41 );; + return 42 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneGeneratedInfo Info; + const PxSceneGeneratedInfo* getInfo() { return &Info; } + }; + + class PxTetrahedronMeshGeometry; + struct PxTetrahedronMeshGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxTetrahedronMesh * TetrahedronMesh; + PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedValues( const PxTetrahedronMeshGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxTetrahedronMeshGeometry, TetrahedronMesh, PxTetrahedronMeshGeometryGeneratedValues) + struct PxTetrahedronMeshGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxTetrahedronMeshGeometry"; } + PxPropertyInfo TetrahedronMesh; + + PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( TetrahedronMesh, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxTetrahedronMeshGeometryGeneratedInfo Info; + const PxTetrahedronMeshGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + class PxCustomGeometry; + struct PxCustomGeometryGeneratedValues + : PxGeometryGeneratedValues { + PxU32 CustomType; + PX_PHYSX_CORE_API PxCustomGeometryGeneratedValues( const PxCustomGeometry* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxCustomGeometry, CustomType, PxCustomGeometryGeneratedValues) + struct PxCustomGeometryGeneratedInfo + : PxGeometryGeneratedInfo + { + static const char* getClassName() { return "PxCustomGeometry"; } + PxCustomGeometryCustomTypeProperty CustomType; + + PX_PHYSX_CORE_API PxCustomGeometryGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxGeometryGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxGeometryGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxGeometryGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( CustomType, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxCustomGeometryGeneratedInfo Info; + const PxCustomGeometryGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxHeightFieldFormat__EnumConversion[] = { + { "eS16_TM", static_cast( physx::PxHeightFieldFormat::eS16_TM ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxHeightFieldFormat::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHeightFieldFormat__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxHeightFieldFlag__EnumConversion[] = { + { "eNO_BOUNDARY_EDGES", static_cast( physx::PxHeightFieldFlag::eNO_BOUNDARY_EDGES ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxHeightFieldFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxHeightFieldFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxHeightFieldDesc; + struct PxHeightFieldDescGeneratedValues + { + PxU32 NbRows; + PxU32 NbColumns; + PxHeightFieldFormat::Enum Format; + PxStridedData Samples; + PxReal ConvexEdgeThreshold; + PxHeightFieldFlags Flags; + PX_PHYSX_CORE_API PxHeightFieldDescGeneratedValues( const PxHeightFieldDesc* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, NbRows, PxHeightFieldDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, NbColumns, PxHeightFieldDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Format, PxHeightFieldDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Samples, PxHeightFieldDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, ConvexEdgeThreshold, PxHeightFieldDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxHeightFieldDesc, Flags, PxHeightFieldDescGeneratedValues) + struct PxHeightFieldDescGeneratedInfo + + { + static const char* getClassName() { return "PxHeightFieldDesc"; } + PxPropertyInfo NbRows; + PxPropertyInfo NbColumns; + PxPropertyInfo Format; + PxPropertyInfo Samples; + PxPropertyInfo ConvexEdgeThreshold; + PxPropertyInfo Flags; + + PX_PHYSX_CORE_API PxHeightFieldDescGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 6; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( NbRows, inStartIndex + 0 );; + inOperator( NbColumns, inStartIndex + 1 );; + inOperator( Format, inStartIndex + 2 );; + inOperator( Samples, inStartIndex + 3 );; + inOperator( ConvexEdgeThreshold, inStartIndex + 4 );; + inOperator( Flags, inStartIndex + 5 );; + return 6 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxHeightFieldDescGeneratedInfo Info; + const PxHeightFieldDescGeneratedInfo* getInfo() { return &Info; } + }; + + struct PxArticulationLimit; + struct PxArticulationLimitGeneratedValues + { + PxReal Low; + PxReal High; + PX_PHYSX_CORE_API PxArticulationLimitGeneratedValues( const PxArticulationLimit* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLimit, Low, PxArticulationLimitGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationLimit, High, PxArticulationLimitGeneratedValues) + struct PxArticulationLimitGeneratedInfo + + { + static const char* getClassName() { return "PxArticulationLimit"; } + PxPropertyInfo Low; + PxPropertyInfo High; + + PX_PHYSX_CORE_API PxArticulationLimitGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Low, inStartIndex + 0 );; + inOperator( High, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxArticulationLimitGeneratedInfo Info; + const PxArticulationLimitGeneratedInfo* getInfo() { return &Info; } + }; + + struct PxArticulationDrive; + struct PxArticulationDriveGeneratedValues + { + PxReal Stiffness; + PxReal Damping; + PxReal MaxForce; + PxArticulationDriveType::Enum DriveType; + PX_PHYSX_CORE_API PxArticulationDriveGeneratedValues( const PxArticulationDrive* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, Stiffness, PxArticulationDriveGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, Damping, PxArticulationDriveGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, MaxForce, PxArticulationDriveGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxArticulationDrive, DriveType, PxArticulationDriveGeneratedValues) + struct PxArticulationDriveGeneratedInfo + + { + static const char* getClassName() { return "PxArticulationDrive"; } + PxPropertyInfo Stiffness; + PxPropertyInfo Damping; + PxPropertyInfo MaxForce; + PxPropertyInfo DriveType; + + PX_PHYSX_CORE_API PxArticulationDriveGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Stiffness, inStartIndex + 0 );; + inOperator( Damping, inStartIndex + 1 );; + inOperator( MaxForce, inStartIndex + 2 );; + inOperator( DriveType, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxArticulationDriveGeneratedInfo Info; + const PxArticulationDriveGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxDynamicTreeSecondaryPruner__EnumConversion[] = { + { "eNONE", static_cast( physx::PxDynamicTreeSecondaryPruner::eNONE ) }, + { "eBUCKET", static_cast( physx::PxDynamicTreeSecondaryPruner::eBUCKET ) }, + { "eINCREMENTAL", static_cast( physx::PxDynamicTreeSecondaryPruner::eINCREMENTAL ) }, + { "eBVH", static_cast( physx::PxDynamicTreeSecondaryPruner::eBVH ) }, + { "eLAST", static_cast( physx::PxDynamicTreeSecondaryPruner::eLAST ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxDynamicTreeSecondaryPruner::Enum > { PxEnumTraits() : NameConversion( g_physx__PxDynamicTreeSecondaryPruner__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxBVHBuildStrategy__EnumConversion[] = { + { "eFAST", static_cast( physx::PxBVHBuildStrategy::eFAST ) }, + { "eDEFAULT", static_cast( physx::PxBVHBuildStrategy::eDEFAULT ) }, + { "eSAH", static_cast( physx::PxBVHBuildStrategy::eSAH ) }, + { "eLAST", static_cast( physx::PxBVHBuildStrategy::eLAST ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxBVHBuildStrategy::Enum > { PxEnumTraits() : NameConversion( g_physx__PxBVHBuildStrategy__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxSceneQueryDesc; + struct PxSceneQueryDescGeneratedValues + { + _Bool IsValid; + PxPruningStructureType::Enum StaticStructure; + PxPruningStructureType::Enum DynamicStructure; + PxU32 DynamicTreeRebuildRateHint; + PxDynamicTreeSecondaryPruner::Enum DynamicTreeSecondaryPruner; + PxBVHBuildStrategy::Enum StaticBVHBuildStrategy; + PxBVHBuildStrategy::Enum DynamicBVHBuildStrategy; + PxU32 StaticNbObjectsPerNode; + PxU32 DynamicNbObjectsPerNode; + PxSceneQueryUpdateMode::Enum SceneQueryUpdateMode; + PX_PHYSX_CORE_API PxSceneQueryDescGeneratedValues( const PxSceneQueryDesc* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, IsValid, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticStructure, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicStructure, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicTreeRebuildRateHint, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicTreeSecondaryPruner, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticBVHBuildStrategy, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicBVHBuildStrategy, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, StaticNbObjectsPerNode, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, DynamicNbObjectsPerNode, PxSceneQueryDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneQueryDesc, SceneQueryUpdateMode, PxSceneQueryDescGeneratedValues) + struct PxSceneQueryDescGeneratedInfo + + { + static const char* getClassName() { return "PxSceneQueryDesc"; } + PxReadOnlyPropertyInfo IsValid; + PxPropertyInfo StaticStructure; + PxPropertyInfo DynamicStructure; + PxPropertyInfo DynamicTreeRebuildRateHint; + PxPropertyInfo DynamicTreeSecondaryPruner; + PxPropertyInfo StaticBVHBuildStrategy; + PxPropertyInfo DynamicBVHBuildStrategy; + PxPropertyInfo StaticNbObjectsPerNode; + PxPropertyInfo DynamicNbObjectsPerNode; + PxPropertyInfo SceneQueryUpdateMode; + + PX_PHYSX_CORE_API PxSceneQueryDescGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 10; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( IsValid, inStartIndex + 0 );; + inOperator( StaticStructure, inStartIndex + 1 );; + inOperator( DynamicStructure, inStartIndex + 2 );; + inOperator( DynamicTreeRebuildRateHint, inStartIndex + 3 );; + inOperator( DynamicTreeSecondaryPruner, inStartIndex + 4 );; + inOperator( StaticBVHBuildStrategy, inStartIndex + 5 );; + inOperator( DynamicBVHBuildStrategy, inStartIndex + 6 );; + inOperator( StaticNbObjectsPerNode, inStartIndex + 7 );; + inOperator( DynamicNbObjectsPerNode, inStartIndex + 8 );; + inOperator( SceneQueryUpdateMode, inStartIndex + 9 );; + return 10 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneQueryDescGeneratedInfo Info; + const PxSceneQueryDescGeneratedInfo* getInfo() { return &Info; } + }; + + class PxSceneDesc; + struct PxSceneDescGeneratedValues + : PxSceneQueryDescGeneratedValues { + PxVec3 Gravity; + PxSimulationEventCallback * SimulationEventCallback; + PxContactModifyCallback * ContactModifyCallback; + PxCCDContactModifyCallback * CcdContactModifyCallback; + const void * FilterShaderData; + PxU32 FilterShaderDataSize; + PxSimulationFilterShader FilterShader; + PxSimulationFilterCallback * FilterCallback; + PxPairFilteringMode::Enum KineKineFilteringMode; + PxPairFilteringMode::Enum StaticKineFilteringMode; + PxBroadPhaseType::Enum BroadPhaseType; + PxBroadPhaseCallback * BroadPhaseCallback; + PxSceneLimits Limits; + PxFrictionType::Enum FrictionType; + PxSolverType::Enum SolverType; + PxReal BounceThresholdVelocity; + PxReal FrictionOffsetThreshold; + PxReal FrictionCorrelationDistance; + PxSceneFlags Flags; + PxCpuDispatcher * CpuDispatcher; + PxCudaContextManager * CudaContextManager; + void * UserData; + PxU32 SolverBatchSize; + PxU32 SolverArticulationBatchSize; + PxU32 NbContactDataBlocks; + PxU32 MaxNbContactDataBlocks; + PxReal MaxBiasCoefficient; + PxU32 ContactReportStreamBufferSize; + PxU32 CcdMaxPasses; + PxReal CcdThreshold; + PxReal CcdMaxSeparation; + PxReal WakeCounterResetValue; + PxBounds3 SanityBounds; + PxgDynamicsMemoryConfig GpuDynamicsConfig; + PxU32 GpuMaxNumPartitions; + PxU32 GpuMaxNumStaticPartitions; + PxU32 GpuComputeVersion; + PxU32 ContactPairSlabSize; + PX_PHYSX_CORE_API PxSceneDescGeneratedValues( const PxSceneDesc* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Gravity, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SimulationEventCallback, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactModifyCallback, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdContactModifyCallback, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShaderData, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShaderDataSize, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterShader, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FilterCallback, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, KineKineFilteringMode, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, StaticKineFilteringMode, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BroadPhaseType, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BroadPhaseCallback, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Limits, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionType, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverType, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, BounceThresholdVelocity, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionOffsetThreshold, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, FrictionCorrelationDistance, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, Flags, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CpuDispatcher, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CudaContextManager, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, UserData, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverBatchSize, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SolverArticulationBatchSize, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, NbContactDataBlocks, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, MaxNbContactDataBlocks, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, MaxBiasCoefficient, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactReportStreamBufferSize, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdMaxPasses, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdThreshold, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, CcdMaxSeparation, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, WakeCounterResetValue, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, SanityBounds, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuDynamicsConfig, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuMaxNumPartitions, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuMaxNumStaticPartitions, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, GpuComputeVersion, PxSceneDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneDesc, ContactPairSlabSize, PxSceneDescGeneratedValues) + struct PxSceneDescGeneratedInfo + : PxSceneQueryDescGeneratedInfo + { + static const char* getClassName() { return "PxSceneDesc"; } + PxWriteOnlyPropertyInfo ToDefault; + PxPropertyInfo Gravity; + PxPropertyInfo SimulationEventCallback; + PxPropertyInfo ContactModifyCallback; + PxPropertyInfo CcdContactModifyCallback; + PxPropertyInfo FilterShaderData; + PxPropertyInfo FilterShaderDataSize; + PxPropertyInfo FilterShader; + PxPropertyInfo FilterCallback; + PxPropertyInfo KineKineFilteringMode; + PxPropertyInfo StaticKineFilteringMode; + PxPropertyInfo BroadPhaseType; + PxPropertyInfo BroadPhaseCallback; + PxPropertyInfo Limits; + PxPropertyInfo FrictionType; + PxPropertyInfo SolverType; + PxPropertyInfo BounceThresholdVelocity; + PxPropertyInfo FrictionOffsetThreshold; + PxPropertyInfo FrictionCorrelationDistance; + PxPropertyInfo Flags; + PxPropertyInfo CpuDispatcher; + PxPropertyInfo CudaContextManager; + PxPropertyInfo UserData; + PxPropertyInfo SolverBatchSize; + PxPropertyInfo SolverArticulationBatchSize; + PxPropertyInfo NbContactDataBlocks; + PxPropertyInfo MaxNbContactDataBlocks; + PxPropertyInfo MaxBiasCoefficient; + PxPropertyInfo ContactReportStreamBufferSize; + PxPropertyInfo CcdMaxPasses; + PxPropertyInfo CcdThreshold; + PxPropertyInfo CcdMaxSeparation; + PxPropertyInfo WakeCounterResetValue; + PxPropertyInfo SanityBounds; + PxPropertyInfo GpuDynamicsConfig; + PxPropertyInfo GpuMaxNumPartitions; + PxPropertyInfo GpuMaxNumStaticPartitions; + PxPropertyInfo GpuComputeVersion; + PxPropertyInfo ContactPairSlabSize; + + PX_PHYSX_CORE_API PxSceneDescGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxSceneQueryDescGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxSceneQueryDescGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 39; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxSceneQueryDescGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ToDefault, inStartIndex + 0 );; + inOperator( Gravity, inStartIndex + 1 );; + inOperator( SimulationEventCallback, inStartIndex + 2 );; + inOperator( ContactModifyCallback, inStartIndex + 3 );; + inOperator( CcdContactModifyCallback, inStartIndex + 4 );; + inOperator( FilterShaderData, inStartIndex + 5 );; + inOperator( FilterShaderDataSize, inStartIndex + 6 );; + inOperator( FilterShader, inStartIndex + 7 );; + inOperator( FilterCallback, inStartIndex + 8 );; + inOperator( KineKineFilteringMode, inStartIndex + 9 );; + inOperator( StaticKineFilteringMode, inStartIndex + 10 );; + inOperator( BroadPhaseType, inStartIndex + 11 );; + inOperator( BroadPhaseCallback, inStartIndex + 12 );; + inOperator( Limits, inStartIndex + 13 );; + inOperator( FrictionType, inStartIndex + 14 );; + inOperator( SolverType, inStartIndex + 15 );; + inOperator( BounceThresholdVelocity, inStartIndex + 16 );; + inOperator( FrictionOffsetThreshold, inStartIndex + 17 );; + inOperator( FrictionCorrelationDistance, inStartIndex + 18 );; + inOperator( Flags, inStartIndex + 19 );; + inOperator( CpuDispatcher, inStartIndex + 20 );; + inOperator( CudaContextManager, inStartIndex + 21 );; + inOperator( UserData, inStartIndex + 22 );; + inOperator( SolverBatchSize, inStartIndex + 23 );; + inOperator( SolverArticulationBatchSize, inStartIndex + 24 );; + inOperator( NbContactDataBlocks, inStartIndex + 25 );; + inOperator( MaxNbContactDataBlocks, inStartIndex + 26 );; + inOperator( MaxBiasCoefficient, inStartIndex + 27 );; + inOperator( ContactReportStreamBufferSize, inStartIndex + 28 );; + inOperator( CcdMaxPasses, inStartIndex + 29 );; + inOperator( CcdThreshold, inStartIndex + 30 );; + inOperator( CcdMaxSeparation, inStartIndex + 31 );; + inOperator( WakeCounterResetValue, inStartIndex + 32 );; + inOperator( SanityBounds, inStartIndex + 33 );; + inOperator( GpuDynamicsConfig, inStartIndex + 34 );; + inOperator( GpuMaxNumPartitions, inStartIndex + 35 );; + inOperator( GpuMaxNumStaticPartitions, inStartIndex + 36 );; + inOperator( GpuComputeVersion, inStartIndex + 37 );; + inOperator( ContactPairSlabSize, inStartIndex + 38 );; + return 39 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneDescGeneratedInfo Info; + const PxSceneDescGeneratedInfo* getInfo() { return &Info; } + }; + + class PxBroadPhaseDesc; + struct PxBroadPhaseDescGeneratedValues + { + _Bool IsValid; + PxBroadPhaseType::Enum MType; + PxU64 MContextID; + PxCudaContextManager * MContextManager; + PxU32 MFoundLostPairsCapacity; + _Bool MDiscardStaticVsKinematic; + _Bool MDiscardKinematicVsKinematic; + PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedValues( const PxBroadPhaseDesc* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, IsValid, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MType, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MContextID, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MContextManager, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MFoundLostPairsCapacity, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MDiscardStaticVsKinematic, PxBroadPhaseDescGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxBroadPhaseDesc, MDiscardKinematicVsKinematic, PxBroadPhaseDescGeneratedValues) + struct PxBroadPhaseDescGeneratedInfo + + { + static const char* getClassName() { return "PxBroadPhaseDesc"; } + PxReadOnlyPropertyInfo IsValid; + PxPropertyInfo MType; + PxPropertyInfo MContextID; + PxPropertyInfo MContextManager; + PxPropertyInfo MFoundLostPairsCapacity; + PxPropertyInfo MDiscardStaticVsKinematic; + PxPropertyInfo MDiscardKinematicVsKinematic; + + PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 7; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( IsValid, inStartIndex + 0 );; + inOperator( MType, inStartIndex + 1 );; + inOperator( MContextID, inStartIndex + 2 );; + inOperator( MContextManager, inStartIndex + 3 );; + inOperator( MFoundLostPairsCapacity, inStartIndex + 4 );; + inOperator( MDiscardStaticVsKinematic, inStartIndex + 5 );; + inOperator( MDiscardKinematicVsKinematic, inStartIndex + 6 );; + return 7 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxBroadPhaseDescGeneratedInfo Info; + const PxBroadPhaseDescGeneratedInfo* getInfo() { return &Info; } + }; + + class PxSceneLimits; + struct PxSceneLimitsGeneratedValues + { + PxU32 MaxNbActors; + PxU32 MaxNbBodies; + PxU32 MaxNbStaticShapes; + PxU32 MaxNbDynamicShapes; + PxU32 MaxNbAggregates; + PxU32 MaxNbConstraints; + PxU32 MaxNbRegions; + PxU32 MaxNbBroadPhaseOverlaps; + PX_PHYSX_CORE_API PxSceneLimitsGeneratedValues( const PxSceneLimits* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbActors, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbBodies, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbStaticShapes, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbDynamicShapes, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbAggregates, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbConstraints, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbRegions, PxSceneLimitsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSceneLimits, MaxNbBroadPhaseOverlaps, PxSceneLimitsGeneratedValues) + struct PxSceneLimitsGeneratedInfo + + { + static const char* getClassName() { return "PxSceneLimits"; } + PxPropertyInfo MaxNbActors; + PxPropertyInfo MaxNbBodies; + PxPropertyInfo MaxNbStaticShapes; + PxPropertyInfo MaxNbDynamicShapes; + PxPropertyInfo MaxNbAggregates; + PxPropertyInfo MaxNbConstraints; + PxPropertyInfo MaxNbRegions; + PxPropertyInfo MaxNbBroadPhaseOverlaps; + + PX_PHYSX_CORE_API PxSceneLimitsGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 8; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MaxNbActors, inStartIndex + 0 );; + inOperator( MaxNbBodies, inStartIndex + 1 );; + inOperator( MaxNbStaticShapes, inStartIndex + 2 );; + inOperator( MaxNbDynamicShapes, inStartIndex + 3 );; + inOperator( MaxNbAggregates, inStartIndex + 4 );; + inOperator( MaxNbConstraints, inStartIndex + 5 );; + inOperator( MaxNbRegions, inStartIndex + 6 );; + inOperator( MaxNbBroadPhaseOverlaps, inStartIndex + 7 );; + return 8 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSceneLimitsGeneratedInfo Info; + const PxSceneLimitsGeneratedInfo* getInfo() { return &Info; } + }; + + struct PxgDynamicsMemoryConfig; + struct PxgDynamicsMemoryConfigGeneratedValues + { + _Bool IsValid; + PxU32 TempBufferCapacity; + PxU32 MaxRigidContactCount; + PxU32 MaxRigidPatchCount; + PxU32 HeapCapacity; + PxU32 FoundLostPairsCapacity; + PxU32 FoundLostAggregatePairsCapacity; + PxU32 TotalAggregatePairsCapacity; + PxU32 MaxSoftBodyContacts; + PxU32 MaxFemClothContacts; + PxU32 MaxParticleContacts; + PxU32 CollisionStackSize; + PxU32 MaxHairContacts; + PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedValues( const PxgDynamicsMemoryConfig* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, IsValid, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, TempBufferCapacity, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxRigidContactCount, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxRigidPatchCount, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, HeapCapacity, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, FoundLostPairsCapacity, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, FoundLostAggregatePairsCapacity, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, TotalAggregatePairsCapacity, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxSoftBodyContacts, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxFemClothContacts, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxParticleContacts, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, CollisionStackSize, PxgDynamicsMemoryConfigGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxgDynamicsMemoryConfig, MaxHairContacts, PxgDynamicsMemoryConfigGeneratedValues) + struct PxgDynamicsMemoryConfigGeneratedInfo + + { + static const char* getClassName() { return "PxgDynamicsMemoryConfig"; } + PxReadOnlyPropertyInfo IsValid; + PxPropertyInfo TempBufferCapacity; + PxPropertyInfo MaxRigidContactCount; + PxPropertyInfo MaxRigidPatchCount; + PxPropertyInfo HeapCapacity; + PxPropertyInfo FoundLostPairsCapacity; + PxPropertyInfo FoundLostAggregatePairsCapacity; + PxPropertyInfo TotalAggregatePairsCapacity; + PxPropertyInfo MaxSoftBodyContacts; + PxPropertyInfo MaxFemClothContacts; + PxPropertyInfo MaxParticleContacts; + PxPropertyInfo CollisionStackSize; + PxPropertyInfo MaxHairContacts; + + PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 13; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( IsValid, inStartIndex + 0 );; + inOperator( TempBufferCapacity, inStartIndex + 1 );; + inOperator( MaxRigidContactCount, inStartIndex + 2 );; + inOperator( MaxRigidPatchCount, inStartIndex + 3 );; + inOperator( HeapCapacity, inStartIndex + 4 );; + inOperator( FoundLostPairsCapacity, inStartIndex + 5 );; + inOperator( FoundLostAggregatePairsCapacity, inStartIndex + 6 );; + inOperator( TotalAggregatePairsCapacity, inStartIndex + 7 );; + inOperator( MaxSoftBodyContacts, inStartIndex + 8 );; + inOperator( MaxFemClothContacts, inStartIndex + 9 );; + inOperator( MaxParticleContacts, inStartIndex + 10 );; + inOperator( CollisionStackSize, inStartIndex + 11 );; + inOperator( MaxHairContacts, inStartIndex + 12 );; + return 13 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxgDynamicsMemoryConfigGeneratedInfo Info; + const PxgDynamicsMemoryConfigGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxSimulationStatistics__RbPairStatsTypeConversion[] = { + { "eDISCRETE_CONTACT_PAIRS", static_cast( physx::PxSimulationStatistics::eDISCRETE_CONTACT_PAIRS ) }, + { "eCCD_PAIRS", static_cast( physx::PxSimulationStatistics::eCCD_PAIRS ) }, + { "eMODIFIED_CONTACT_PAIRS", static_cast( physx::PxSimulationStatistics::eMODIFIED_CONTACT_PAIRS ) }, + { "eTRIGGER_PAIRS", static_cast( physx::PxSimulationStatistics::eTRIGGER_PAIRS ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSimulationStatistics::RbPairStatsType > { PxEnumTraits() : NameConversion( g_physx__PxSimulationStatistics__RbPairStatsTypeConversion ) {} const PxU32ToName* NameConversion; }; + class PxSimulationStatistics; + struct PxSimulationStatisticsGeneratedValues + { + PxU32 NbActiveConstraints; + PxU32 NbActiveDynamicBodies; + PxU32 NbActiveKinematicBodies; + PxU32 NbStaticBodies; + PxU32 NbDynamicBodies; + PxU32 NbKinematicBodies; + PxU32 NbAggregates; + PxU32 NbArticulations; + PxU32 NbAxisSolverConstraints; + PxU32 CompressedContactSize; + PxU32 RequiredContactConstraintMemory; + PxU32 PeakConstraintMemory; + PxU32 NbDiscreteContactPairsTotal; + PxU32 NbDiscreteContactPairsWithCacheHits; + PxU32 NbDiscreteContactPairsWithContacts; + PxU32 NbNewPairs; + PxU32 NbLostPairs; + PxU32 NbNewTouches; + PxU32 NbLostTouches; + PxU32 NbPartitions; + PxU64 GpuMemParticles; + PxU64 GpuMemSoftBodies; + PxU64 GpuMemFEMCloths; + PxU64 GpuMemHairSystems; + PxU64 GpuMemHeap; + PxU64 GpuMemHeapBroadPhase; + PxU64 GpuMemHeapNarrowPhase; + PxU64 GpuMemHeapSolver; + PxU64 GpuMemHeapArticulation; + PxU64 GpuMemHeapSimulation; + PxU64 GpuMemHeapSimulationArticulation; + PxU64 GpuMemHeapSimulationParticles; + PxU64 GpuMemHeapSimulationSoftBody; + PxU64 GpuMemHeapSimulationFEMCloth; + PxU64 GpuMemHeapSimulationHairSystem; + PxU64 GpuMemHeapParticles; + PxU64 GpuMemHeapSoftBodies; + PxU64 GpuMemHeapFEMCloths; + PxU64 GpuMemHeapHairSystems; + PxU64 GpuMemHeapOther; + PxU32 NbBroadPhaseAdds; + PxU32 NbBroadPhaseRemoves; + PxU32 NbDiscreteContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 NbModifiedContactPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 NbCCDPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 NbTriggerPairs[PxGeometryType::eGEOMETRY_COUNT][PxGeometryType::eGEOMETRY_COUNT]; + PxU32 NbShapes[PxGeometryType::eGEOMETRY_COUNT]; + PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedValues( const PxSimulationStatistics* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveConstraints, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveDynamicBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbActiveKinematicBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbStaticBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDynamicBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbKinematicBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbAggregates, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbArticulations, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbAxisSolverConstraints, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, CompressedContactSize, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, RequiredContactConstraintMemory, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, PeakConstraintMemory, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsTotal, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsWithCacheHits, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairsWithContacts, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbNewPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbLostPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbNewTouches, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbLostTouches, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbPartitions, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemParticles, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemSoftBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemFEMCloths, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHairSystems, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeap, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapBroadPhase, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapNarrowPhase, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSolver, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapArticulation, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulation, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationArticulation, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationParticles, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationSoftBody, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationFEMCloth, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSimulationHairSystem, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapParticles, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapSoftBodies, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapFEMCloths, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapHairSystems, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, GpuMemHeapOther, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbBroadPhaseAdds, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbBroadPhaseRemoves, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbDiscreteContactPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbModifiedContactPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbCCDPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbTriggerPairs, PxSimulationStatisticsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSimulationStatistics, NbShapes, PxSimulationStatisticsGeneratedValues) + struct PxSimulationStatisticsGeneratedInfo + + { + static const char* getClassName() { return "PxSimulationStatistics"; } + PxPropertyInfo NbActiveConstraints; + PxPropertyInfo NbActiveDynamicBodies; + PxPropertyInfo NbActiveKinematicBodies; + PxPropertyInfo NbStaticBodies; + PxPropertyInfo NbDynamicBodies; + PxPropertyInfo NbKinematicBodies; + PxPropertyInfo NbAggregates; + PxPropertyInfo NbArticulations; + PxPropertyInfo NbAxisSolverConstraints; + PxPropertyInfo CompressedContactSize; + PxPropertyInfo RequiredContactConstraintMemory; + PxPropertyInfo PeakConstraintMemory; + PxPropertyInfo NbDiscreteContactPairsTotal; + PxPropertyInfo NbDiscreteContactPairsWithCacheHits; + PxPropertyInfo NbDiscreteContactPairsWithContacts; + PxPropertyInfo NbNewPairs; + PxPropertyInfo NbLostPairs; + PxPropertyInfo NbNewTouches; + PxPropertyInfo NbLostTouches; + PxPropertyInfo NbPartitions; + PxPropertyInfo GpuMemParticles; + PxPropertyInfo GpuMemSoftBodies; + PxPropertyInfo GpuMemFEMCloths; + PxPropertyInfo GpuMemHairSystems; + PxPropertyInfo GpuMemHeap; + PxPropertyInfo GpuMemHeapBroadPhase; + PxPropertyInfo GpuMemHeapNarrowPhase; + PxPropertyInfo GpuMemHeapSolver; + PxPropertyInfo GpuMemHeapArticulation; + PxPropertyInfo GpuMemHeapSimulation; + PxPropertyInfo GpuMemHeapSimulationArticulation; + PxPropertyInfo GpuMemHeapSimulationParticles; + PxPropertyInfo GpuMemHeapSimulationSoftBody; + PxPropertyInfo GpuMemHeapSimulationFEMCloth; + PxPropertyInfo GpuMemHeapSimulationHairSystem; + PxPropertyInfo GpuMemHeapParticles; + PxPropertyInfo GpuMemHeapSoftBodies; + PxPropertyInfo GpuMemHeapFEMCloths; + PxPropertyInfo GpuMemHeapHairSystems; + PxPropertyInfo GpuMemHeapOther; + PxPropertyInfo NbBroadPhaseAdds; + PxPropertyInfo NbBroadPhaseRemoves; + NbDiscreteContactPairsProperty NbDiscreteContactPairs; + NbModifiedContactPairsProperty NbModifiedContactPairs; + NbCCDPairsProperty NbCCDPairs; + NbTriggerPairsProperty NbTriggerPairs; + NbShapesProperty NbShapes; + + PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 47; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( NbActiveConstraints, inStartIndex + 0 );; + inOperator( NbActiveDynamicBodies, inStartIndex + 1 );; + inOperator( NbActiveKinematicBodies, inStartIndex + 2 );; + inOperator( NbStaticBodies, inStartIndex + 3 );; + inOperator( NbDynamicBodies, inStartIndex + 4 );; + inOperator( NbKinematicBodies, inStartIndex + 5 );; + inOperator( NbAggregates, inStartIndex + 6 );; + inOperator( NbArticulations, inStartIndex + 7 );; + inOperator( NbAxisSolverConstraints, inStartIndex + 8 );; + inOperator( CompressedContactSize, inStartIndex + 9 );; + inOperator( RequiredContactConstraintMemory, inStartIndex + 10 );; + inOperator( PeakConstraintMemory, inStartIndex + 11 );; + inOperator( NbDiscreteContactPairsTotal, inStartIndex + 12 );; + inOperator( NbDiscreteContactPairsWithCacheHits, inStartIndex + 13 );; + inOperator( NbDiscreteContactPairsWithContacts, inStartIndex + 14 );; + inOperator( NbNewPairs, inStartIndex + 15 );; + inOperator( NbLostPairs, inStartIndex + 16 );; + inOperator( NbNewTouches, inStartIndex + 17 );; + inOperator( NbLostTouches, inStartIndex + 18 );; + inOperator( NbPartitions, inStartIndex + 19 );; + inOperator( GpuMemParticles, inStartIndex + 20 );; + inOperator( GpuMemSoftBodies, inStartIndex + 21 );; + inOperator( GpuMemFEMCloths, inStartIndex + 22 );; + inOperator( GpuMemHairSystems, inStartIndex + 23 );; + inOperator( GpuMemHeap, inStartIndex + 24 );; + inOperator( GpuMemHeapBroadPhase, inStartIndex + 25 );; + inOperator( GpuMemHeapNarrowPhase, inStartIndex + 26 );; + inOperator( GpuMemHeapSolver, inStartIndex + 27 );; + inOperator( GpuMemHeapArticulation, inStartIndex + 28 );; + inOperator( GpuMemHeapSimulation, inStartIndex + 29 );; + inOperator( GpuMemHeapSimulationArticulation, inStartIndex + 30 );; + inOperator( GpuMemHeapSimulationParticles, inStartIndex + 31 );; + inOperator( GpuMemHeapSimulationSoftBody, inStartIndex + 32 );; + inOperator( GpuMemHeapSimulationFEMCloth, inStartIndex + 33 );; + inOperator( GpuMemHeapSimulationHairSystem, inStartIndex + 34 );; + inOperator( GpuMemHeapParticles, inStartIndex + 35 );; + inOperator( GpuMemHeapSoftBodies, inStartIndex + 36 );; + inOperator( GpuMemHeapFEMCloths, inStartIndex + 37 );; + inOperator( GpuMemHeapHairSystems, inStartIndex + 38 );; + inOperator( GpuMemHeapOther, inStartIndex + 39 );; + inOperator( NbBroadPhaseAdds, inStartIndex + 40 );; + inOperator( NbBroadPhaseRemoves, inStartIndex + 41 );; + inOperator( NbDiscreteContactPairs, inStartIndex + 42 );; + inOperator( NbModifiedContactPairs, inStartIndex + 43 );; + inOperator( NbCCDPairs, inStartIndex + 44 );; + inOperator( NbTriggerPairs, inStartIndex + 45 );; + inOperator( NbShapes, inStartIndex + 46 );; + return 47 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSimulationStatisticsGeneratedInfo Info; + const PxSimulationStatisticsGeneratedInfo* getInfo() { return &Info; } + }; + + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON +#undef PX_PROPERTY_INFO_NAME diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCompare.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCompare.h new file mode 100644 index 0000000..79da9ef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCompare.h @@ -0,0 +1,396 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_METADATACOMPARE_H +#define PX_METADATACOMPARE_H +#include "PxMetaDataObjects.h" +#include "foundation/PxInlineArray.h" + +//Implement a basic equality comparison system based on the meta data system. +//if you implement a particular areequal specialized to exactly your type +//before including this file it will be called in preference to the completely +//generic one shown here. + + +//If you don't care about the failure prop name you are welcome to pass in 'null', +template +bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName ); +//We don't have the ability right now to handle these types. +inline bool areEqual( const PxAggregate&, const PxAggregate& ) { return true; } +inline bool areEqual( const PxSimulationFilterShader&, const PxSimulationFilterShader& ) { return true; } +inline bool areEqual( const PxSimulationFilterCallback&, const PxSimulationFilterCallback& ) { return true; } +inline bool areEqual( const PxConvexMesh&, const PxConvexMesh& ) { return true; } +inline bool areEqual( const PxTriangleMesh&, const PxTriangleMesh& ) { return true; } +inline bool areEqual( const PxTetrahedronMesh&, const PxTetrahedronMesh&) { return true; } +inline bool areEqual( const PxParticleSystemGeometry&, const PxParticleSystemGeometry&) { return true; } +inline bool areEqual( const PxBVH33TriangleMesh&, const PxBVH33TriangleMesh& ) { return true; } +inline bool areEqual( const PxBVH34TriangleMesh&, const PxBVH34TriangleMesh& ) { return true; } +inline bool areEqual( const PxHeightField&, const PxHeightField& ) { return true; } +inline bool areEqual( const void* inLhs, const void* inRhs ) { return inLhs == inRhs; } +inline bool areEqual( void* inLhs, void* inRhs ) { return inLhs == inRhs; } + +//Operators are copied, so this object needs to point +//to the important data rather than reference or own it. +template +struct EqualityOp +{ + bool* mVal; + const TBaseObjType* mLhs; + const TBaseObjType* mRhs; + const char** mFailurePropName; + + EqualityOp( bool& inVal, const TBaseObjType& inLhs, const TBaseObjType& inRhs, const char*& inFailurePropName ) + : mVal( &inVal ) + , mLhs( &inLhs ) + , mRhs( &inRhs ) + , mFailurePropName( &inFailurePropName ) + { + } + + bool hasFailed() { return *mVal == false; } + //Ensure failure propagates the result a ways. + void update( bool inResult, const char* inName ) + { + *mVal = *mVal && inResult; + if ( hasFailed() ) + *mFailurePropName = inName; + } + + //ignore any properties pointering back to the scene. + template + void operator()( const PxReadOnlyPropertyInfo & inProp, PxU32 ) {} + + template + void operator()( const PxReadOnlyPropertyInfo & inProp, PxU32 ) {} + + //ignore any properties pointering back to the impl. + template + void operator()(const PxReadOnlyPropertyInfo & inProp, PxU32) {} + + template + void operator()(const PxReadOnlyPropertyInfo & inProp, PxU32) {} + + //ignore all of these properties because they just point back to the 'this' object and cause + //a stack overflow. + + //Children is unnecessary and articulation points back to the source. + void operator()( const PxReadOnlyCollectionPropertyInfo& inProp, PxU32 ) {} + void operator()( const PxReadOnlyCollectionPropertyInfo& inProp, PxU32 ){} + void operator()( const PxReadOnlyCollectionPropertyInfo& inProp, PxU32 ) {} + + template + void operator()( const PxBufferCollectionPropertyInfo & inProp, PxU32 ) + { + + } + + + template + void operator()( const PxReadOnlyPropertyInfo & inProp, PxU32 ) + { + if ( hasFailed() ) + return; + TGetPropType lhs( inProp.get( mLhs ) ); + TGetPropType rhs( inProp.get( mRhs ) ); + update( areEqual( lhs, rhs, NULL ), inProp.mName ); + } + + template + void operator()( const PxRangePropertyInfo & inProp, PxU32 ) + { + if ( hasFailed() ) + return; + TPropType lhsl, lhsr, rhsl, rhsr; + inProp.get( mLhs, lhsl, lhsr ); + inProp.get( mRhs, rhsl, rhsr ); + update( areEqual( lhsl, rhsl, NULL ), inProp.mName ); + update( areEqual( lhsr, rhsr, NULL ), inProp.mName ); + } + + //Indexed properties where we don't know the range of index types are ignored + template + void compareIndex( const PxIndexedPropertyInfo &, bool ) {} + + template + void compareIndex( const PxIndexedPropertyInfo &inProp, const PxU32ToName* inNames ) + { + for ( const PxU32ToName* theName = inNames; + theName->mName != NULL && !hasFailed(); + ++theName ) + { + TIndexType theIndex( static_cast( theName->mValue ) ); + update( areEqual( inProp.get( mLhs, theIndex ), inProp.get( mRhs, theIndex ), NULL ), inProp.mName ); + } + } + + template + void operator()( const PxIndexedPropertyInfo & inProp, PxU32 ) + { + if ( hasFailed() ) + return; + compareIndex( inProp, PxEnumTraits().NameConversion ); + } + + template + void operator()( const PxReadOnlyCollectionPropertyInfo & inProp, PxU32 ) + { + if ( hasFailed() ) + return; + physx::PxInlineArray lhsArray; + physx::PxInlineArray rhsArray; + PxU32 size = inProp.size( mLhs ); + if ( size != inProp.size( mRhs ) ) + update( false, inProp.mName ); + else + { + lhsArray.resize( size ); + rhsArray.resize( size ); + inProp.get( mLhs, lhsArray.begin(), size ); + inProp.get( mRhs, rhsArray.begin(), size ); + for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx ) + update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName ); + } + } + + //Filtered collections where we can't know the range of filter values are ignored. + template + void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >&, bool ) {} + + template + void compare( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, const PxU32ToName* inNames ) + { + //Exaustively compare all items. + physx::PxInlineArray lhsArray; + physx::PxInlineArray rhsArray; + for ( const PxU32ToName* theName = inNames; + theName->mName != NULL && !hasFailed(); + ++theName ) + { + TFilterType theFilter( static_cast( theName->mValue ) ); + PxU32 size = inProp.size( mLhs, theFilter ); + if ( size != inProp.size( mRhs, theFilter ) ) + update( false, inProp.mName ); + else + { + lhsArray.resize( size ); + rhsArray.resize( size ); + inProp.get( mLhs, theFilter, lhsArray.begin(), size ); + inProp.get( mRhs, theFilter, rhsArray.begin(), size ); + for ( PxU32 idx =0; idx < size && !hasFailed(); ++idx ) + update( areEqual( lhsArray[idx], rhsArray[idx], NULL ), inProp.mName ); + } + } + } + + template + void operator()( const PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TFilterType, TCollectionType >& inProp, PxU32 ) + { + if ( hasFailed() ) return; + compare( inProp, PxEnumTraits().NameConversion ); + } + + template + void compareGeometry( const TPropertyType& inProp ) + { + TGeometryType lhs; + TGeometryType rhs; + bool lsuc = inProp.getGeometry( mLhs, lhs ); + bool rsuc = inProp.getGeometry( mRhs, rhs ); + if ( !( lsuc && rsuc ) ) + update( false, inProp.mName ); + else + update( areEqual( lhs, rhs, NULL ), inProp.mName ); + } + + void operator()( const PxShapeGeomProperty& inProp, PxU32 ) + { + if ( hasFailed() ) + return; + PxGeometryType::Enum lhsType( inProp.getGeometryType( mLhs ) ); + PxGeometryType::Enum rhsType( inProp.getGeometryType( mRhs ) ); + if ( lhsType != rhsType ) + update( false, inProp.mName ); + else + { + switch( lhsType ) + { + case PxGeometryType::eSPHERE: compareGeometry(inProp); break; + case PxGeometryType::ePLANE: compareGeometry(inProp); break; + case PxGeometryType::eCAPSULE: compareGeometry(inProp); break; + case PxGeometryType::eBOX: compareGeometry(inProp); break; + case PxGeometryType::eCONVEXMESH: compareGeometry(inProp); break; + case PxGeometryType::eTETRAHEDRONMESH: compareGeometry(inProp); break; + case PxGeometryType::ePARTICLESYSTEM: compareGeometry(inProp); break; + case PxGeometryType::eTRIANGLEMESH: compareGeometry(inProp); break; + case PxGeometryType::eHEIGHTFIELD: compareGeometry(inProp); break; + default: PX_ASSERT( false ); break; + } + } + } +}; + +inline bool areEqual( const char* lhs, const char* rhs, const char**, const PxUnknownClassInfo& ) +{ + if ( lhs && rhs ) return Pxstrcmp( lhs, rhs ) == 0; + if ( lhs || rhs ) return false; + return true; +} + +inline bool areEqual( PxReal inLhs, PxReal inRhs ) +{ + return PxAbs( inLhs - inRhs ) < 1e-5f; +} + +inline bool areEqual( PxVec3& lhs, PxVec3& rhs ) +{ + return areEqual( lhs.x, rhs.x ) + && areEqual( lhs.y, rhs.y ) + && areEqual( lhs.z, rhs.z ); +} + +inline bool areEqual( const PxVec3& lhs, const PxVec3& rhs ) +{ + return areEqual( lhs.x, rhs.x ) + && areEqual( lhs.y, rhs.y ) + && areEqual( lhs.z, rhs.z ); +} + +inline bool areEqual( const PxVec4& lhs, const PxVec4& rhs ) +{ + return areEqual( lhs.x, rhs.x ) + && areEqual( lhs.y, rhs.y ) + && areEqual( lhs.z, rhs.z ) + && areEqual( lhs.w, rhs.w ); +} + +inline bool areEqual( const PxQuat& lhs, const PxQuat& rhs ) +{ + return areEqual( lhs.x, rhs.x ) + && areEqual( lhs.y, rhs.y ) + && areEqual( lhs.z, rhs.z ) + && areEqual( lhs.w, rhs.w ); +} + + +inline bool areEqual( const PxTransform& lhs, const PxTransform& rhs ) +{ + return areEqual(lhs.p, rhs.p) && areEqual(lhs.q, rhs.q); +} + + +inline bool areEqual( const PxBounds3& inLhs, const PxBounds3& inRhs ) +{ + return areEqual(inLhs.minimum,inRhs.minimum) + && areEqual(inLhs.maximum,inRhs.maximum); +} + +inline bool areEqual( const PxMetaDataPlane& lhs, const PxMetaDataPlane& rhs ) +{ + return areEqual( lhs.normal.x, rhs.normal.x ) + && areEqual( lhs.normal.y, rhs.normal.y ) + && areEqual( lhs.normal.z, rhs.normal.z ) + && areEqual( lhs.distance, rhs.distance ); +} + +template +inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs ) +{ + return lhs == rhs; +} + +//If we don't know the class type, we must result in == operator +template +inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char**, const PxUnknownClassInfo& ) +{ + return areEqual( lhs, rhs ); +} + +//If we don't know the class type, we must result in == operator +template +inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, const TTraitsType& ) +{ + const char* theFailureName = NULL; + bool result = true; + static int i = 0; + ++i; + visitAllProperties( EqualityOp( result, lhs, rhs, theFailureName ) ); + if ( outFailurePropName != NULL && theFailureName ) + *outFailurePropName = theFailureName; + return result; +} + + +template +inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, int ) +{ + return areEqual( lhs, rhs, outFailurePropName, PxClassInfoTraits().Info ); +} + +inline bool areEqualPointerCheck( const void* lhs, const void* rhs, const char**, bool ) +{ + return lhs == rhs; +} + +inline bool areEqualPointerCheck( const char* lhs, const char* rhs, const char** outFailurePropName, bool ) +{ + bool bRet = true; + if ( lhs && rhs ) bRet = Pxstrcmp( lhs, rhs ) == 0; + else if ( lhs || rhs ) bRet = false; + + return bRet; +} + +inline bool areEqualPointerCheck( void* lhs, void* rhs, const char**, bool ) +{ + return lhs == rhs; +} + +template +inline bool areEqualPointerCheck( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName, bool ) +{ + if ( lhs && rhs ) + return areEqual( *lhs, *rhs, outFailurePropName ); + if ( lhs || rhs ) + return false; + return true; +} + +template < typename Tp > +struct is_pointer { static const int val = 0; }; + +template < typename Tp > +struct is_pointer { static const bool val = true; }; + + +template +inline bool areEqual( const TBaseObjType& lhs, const TBaseObjType& rhs, const char** outFailurePropName ) +{ + return areEqualPointerCheck( lhs, rhs, outFailurePropName, is_pointer::val ); +} + +#endif \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCppPrefix.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCppPrefix.h new file mode 100644 index 0000000..6ecdcfc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataCppPrefix.h @@ -0,0 +1,36 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_META_DATA_CPP_PREFIX_H +#define PX_META_DATA_CPP_PREFIX_H + +//Header that is only included by the clang-generated cpp files. +//Used to change compilation settings where necessary for only those files. + + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataObjects.h new file mode 100644 index 0000000..7a44519 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/PxMetaDataObjects.h @@ -0,0 +1,683 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_METADATAOBJECTS_H +#define PX_METADATAOBJECTS_H +#include "foundation/PxMemory.h" +#include "foundation/PxPhysicsVersion.h" + +// include the base headers instead of the PxPhysicsAPI.h +//Geometry Library +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMesh.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxGeometry.h" +#include "geometry/PxGeometryHelpers.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxHeightField.h" +#include "geometry/PxHeightFieldDesc.h" +#include "geometry/PxHeightFieldFlag.h" +#include "geometry/PxHeightFieldGeometry.h" +#include "geometry/PxHeightFieldSample.h" +#include "geometry/PxMeshQuery.h" +#include "geometry/PxMeshScale.h" +#include "geometry/PxPlaneGeometry.h" +#include "geometry/PxSimpleTriangleMesh.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxTriangle.h" +#include "geometry/PxTriangleMesh.h" +#include "geometry/PxTriangleMeshGeometry.h" +#include "geometry/PxTetrahedron.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTetrahedronMeshGeometry.h" + +// PhysX Core SDK +#include "PxActor.h" +#include "PxAggregate.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxArticulationJointReducedCoordinate.h" +#include "PxArticulationLink.h" +#include "PxClient.h" +#include "PxConstraint.h" +#include "PxConstraintDesc.h" +#include "PxContact.h" +#include "PxContactModifyCallback.h" +#include "PxDeletionListener.h" +#include "PxFiltering.h" +#include "PxForceMode.h" +#include "PxLockedData.h" +#include "PxMaterial.h" +#include "PxFEMSoftBodyMaterial.h" +#include "PxFEMClothMaterial.h" +#include "PxPBDMaterial.h" +#include "PxFLIPMaterial.h" +#include "PxMPMMaterial.h" +#include "PxPhysics.h" +#include "PxPhysXConfig.h" +#include "PxQueryFiltering.h" +#include "PxQueryReport.h" +#include "PxRigidActor.h" +#include "PxRigidBody.h" +#include "PxRigidDynamic.h" +#include "PxRigidStatic.h" +#include "PxScene.h" +#include "PxSceneDesc.h" +#include "PxSceneLock.h" +#include "PxShape.h" +#include "PxSimulationEventCallback.h" +#include "PxSimulationStatistics.h" +#include "PxVisualizationParameter.h" +#include "PxPruningStructure.h" + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif + +/** \addtogroup physics +@{ +*/ + +namespace physx +{ + +class PxArticulationLink; +class PxArticulationJointReducedCoordinate; + +struct PxPropertyInfoName +{ + enum Enum + { + Unnamed = 0, +#include "PxAutoGeneratedMetaDataObjectNames.h" + LastPxPropertyInfoName + }; +}; + +struct PxU32ToName +{ + const char* mName; + PxU32 mValue; +}; + +struct PxPropertyInfoBase +{ + const char* mName; + PxU32 mKey; + PxPropertyInfoBase( const char* n, PxU32 inKey ) + : mName( n ) + , mKey( inKey ) + { + } +}; + +template +struct PxPropertyInfoParameterizedBase : public PxPropertyInfoBase +{ + PxPropertyInfoParameterizedBase( const char* inName ) + : PxPropertyInfoBase( inName, TKey ) {} +}; + +template +struct PxReadOnlyPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef TPropertyType (*TGetterType)( const TObjType* ); + TGetterType mGetter; + PxReadOnlyPropertyInfo( const char* inName, TGetterType inGetter ) + : PxPropertyInfoParameterizedBase( inName ) + , mGetter( inGetter ) {} + TPropertyType get( const TObjType* inObj ) const { return mGetter( inObj ); } +}; + +template +struct PxWriteOnlyPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef void(*TSetterType)( TObjType*, TPropertyType inArg ); + TSetterType mSetter; + PxWriteOnlyPropertyInfo( const char* inName, TSetterType inSetter ) + : PxPropertyInfoParameterizedBase( inName ) + , mSetter( inSetter ) {} + void set( TObjType* inObj, TPropertyType inArg ) const { mSetter( inObj, inArg ); } +}; + + +//Define the property types on the auto-generated objects. +template +struct PxPropertyInfo : public PxReadOnlyPropertyInfo +{ + typedef typename PxReadOnlyPropertyInfo::TGetterType TGetterType; + typedef void(*TSetterType)( TObjType*, TSetPropType inArg ); + TSetterType mSetter; + + PxPropertyInfo( const char* inName, TSetterType inSetter, TGetterType inGetter ) + : PxReadOnlyPropertyInfo( inName, inGetter ) + , mSetter( inSetter ) {} + void set( TObjType* inObj, TSetPropType inArg ) const { mSetter( inObj, inArg ); } +}; + +template +struct PxRangePropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef void (*TSetterType)( TObjType*,TPropertyType,TPropertyType); + typedef void (*TGetterType)( const TObjType*,TPropertyType&,TPropertyType&); + + const char* mArg0Name; + const char* mArg1Name; + + TSetterType mSetter; + TGetterType mGetter; + + PxRangePropertyInfo( const char* name, const char* arg0Name, const char* arg1Name + , TSetterType setter, TGetterType getter ) + : PxPropertyInfoParameterizedBase( name ) + , mArg0Name( arg0Name ) + , mArg1Name( arg1Name ) + , mSetter( setter ) + , mGetter( getter ) + { + } + void set( TObjType* inObj, TPropertyType arg0, TPropertyType arg1 ) const { mSetter( inObj, arg0, arg1 ); } + void get( const TObjType* inObj, TPropertyType& arg0, TPropertyType& arg1 ) const { mGetter( inObj, arg0, arg1 ); } +}; + +template +struct PxIndexedPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType ); + typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType ); + + TSetterType mSetter; + TGetterType mGetter; + + PxIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter ) + : PxPropertyInfoParameterizedBase( name ) + , mSetter( setter ) + , mGetter( getter ) + { + } + void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); } + TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); } +}; + +template +struct PxExtendedIndexedPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef PxU32 (*TNbObjectsMember)( const TObjType* ); + typedef void (*TSetterType)( TObjType*, TIndexType, TPropertyType ); + typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndexType ); + + TSetterType mSetter; + TGetterType mGetter; + PxU32 mCount; + TNbObjectsMember mNbObjectsMember; + + PxExtendedIndexedPropertyInfo( const char* name, TGetterType getter, TNbObjectsMember inNb, TSetterType setter) + : PxPropertyInfoParameterizedBase( name ) + , mSetter( setter ) + , mGetter( getter ) + , mNbObjectsMember( inNb ) + { + } + + PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } + void set( TObjType* inObj, TIndexType inIndex, TPropertyType arg ) const { mSetter( inObj, inIndex, arg ); } + TPropertyType get( const TObjType* inObj, TIndexType inIndex ) const { return mGetter( inObj, inIndex ); } +}; + +template +struct PxDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType ); + typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type ); + + TSetterType mSetter; + TGetterType mGetter; + + PxDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter ) + : PxPropertyInfoParameterizedBase( name ) + , mSetter( setter ) + , mGetter( getter ) + { + } + void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); } + TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); } +}; + +template +struct PxExtendedDualIndexedPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef void (*TSetterType)( TObjType*, TIndex1Type, TIndex2Type, TPropertyType ); + typedef TPropertyType (*TGetterType)( const TObjType* inObj, TIndex1Type, TIndex2Type ); + + TSetterType mSetter; + TGetterType mGetter; + PxU32 mId0Count; + PxU32 mId1Count; + + PxExtendedDualIndexedPropertyInfo( const char* name, TSetterType setter, TGetterType getter, PxU32 id0Count, PxU32 id1Count ) + : PxPropertyInfoParameterizedBase( name ) + , mSetter( setter ) + , mGetter( getter ) + , mId0Count( id0Count ) + , mId1Count( id1Count ) + { + } + + void set( TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2, TPropertyType arg ) const { mSetter( inObj, inIdx1, inIdx2, arg ); } + TPropertyType get( const TObjType* inObj, TIndex1Type inIdx1, TIndex2Type inIdx2 ) const { return mGetter( inObj, inIdx1, inIdx2 ); } +}; + +template +struct PxBufferCollectionPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef PxU32 (*TNbObjectsMember)( const TObjType* ); + typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 ); + typedef void (*TSetObjectsMember)( TObjType*, TCollectionType*, PxU32 ); + + TGetObjectsMember mGetObjectsMember; + TNbObjectsMember mNbObjectsMember; + TSetObjectsMember mSetObjectsMember; + + PxBufferCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TSetObjectsMember inSet ) + : PxPropertyInfoParameterizedBase( inName ) + , mGetObjectsMember( inGetter ) + , mNbObjectsMember( inNb ) + , mSetObjectsMember( inSet ) + { + } + PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } + PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { return mGetObjectsMember( inObj, inBuffer, inNumItems ); } + void set( TObjType* inObj, TCollectionType* inBuffer, PxU32 inNumItems ) const { mSetObjectsMember( inObj, inBuffer, inNumItems); } +}; + +template +struct PxFixedSizeLookupTablePropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef PxU32 (*TNbObjectsMember)( const TObjType* ); + typedef PxReal (*TGetXMember)( const TObjType*, PxU32 ); + typedef PxReal (*TGetYMember)( const TObjType*, PxU32 ); + typedef void (*TAddPairMember)( TObjType*, PxReal, PxReal ); + typedef void (*TClearMember)( TObjType* ); + + TGetXMember mGetXMember; + TGetYMember mGetYMember; + TNbObjectsMember mNbObjectsMember; + TAddPairMember mAddPairMember; + TClearMember mClearMember; + + PxFixedSizeLookupTablePropertyInfo( const char* inName, TGetXMember inGetterX, TGetYMember inGetterY, TNbObjectsMember inNb, TAddPairMember inAddPair, TClearMember inClear ) + : PxPropertyInfoParameterizedBase( inName ) + , mGetXMember( inGetterX ) + , mGetYMember( inGetterY ) + , mNbObjectsMember( inNb ) + , mAddPairMember( inAddPair ) + , mClearMember( inClear ) + + { + } + PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } + PxReal getX( const TObjType* inObj, const PxU32 index ) const { return mGetXMember( inObj, index ); } + PxReal getY( const TObjType* inObj, const PxU32 index ) const { return mGetYMember( inObj, index ); } + void addPair( TObjType* inObj, const PxReal x, const PxReal y ) { mAddPairMember( inObj, x, y ); } + void clear( TObjType* inObj ) { mClearMember( inObj ); } +}; + +template +struct PxReadOnlyCollectionPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef PxU32 (*TNbObjectsMember)( const TObjType* ); + typedef PxU32 (*TGetObjectsMember)( const TObjType*, TCollectionType*, PxU32 ); + + TGetObjectsMember mGetObjectsMember; + TNbObjectsMember mNbObjectsMember; + + PxReadOnlyCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) + : PxPropertyInfoParameterizedBase( inName ) + , mGetObjectsMember( inGetter ) + , mNbObjectsMember( inNb ) + { + } + PxU32 size( const TObjType* inObj ) const { return mNbObjectsMember( inObj ); } + PxU32 get( const TObjType* inObj, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inBuffer, inBufSize); } +}; + + +template +struct PxReadOnlyFilteredCollectionPropertyInfo : public PxPropertyInfoParameterizedBase +{ + typedef PxU32 (*TNbObjectsMember)( const TObjType*, TFilterType ); + typedef PxU32 (*TGetObjectsMember)( const TObjType*, TFilterType, TCollectionType*, PxU32 ); + + TGetObjectsMember mGetObjectsMember; + TNbObjectsMember mNbObjectsMember; + + PxReadOnlyFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) + : PxPropertyInfoParameterizedBase( inName ) + , mGetObjectsMember( inGetter ) + , mNbObjectsMember( inNb ) + { + } + + PxU32 size( const TObjType* inObj, TFilterType inFilter ) const { return mNbObjectsMember( inObj, inFilter ); } + PxU32 get( const TObjType* inObj, TFilterType inFilter, TCollectionType* inBuffer, PxU32 inBufSize ) const { return mGetObjectsMember( inObj, inFilter, inBuffer, inBufSize); } +}; + +template +struct PxFactoryCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType > +{ + typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember; + typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember; + typedef TCollectionType (*TCreateMember)( TObjType*, TCreateArg ); + + TCreateMember mCreateMember; + PxFactoryCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TCreateMember inMember ) + : PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb ) + , mCreateMember( inMember ) + { + } + TCollectionType create( TObjType* inObj, TCreateArg inArg ) const { return mCreateMember( inObj, inArg ); } +}; + + +template +struct PxCollectionPropertyInfo : public PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType > +{ + typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TGetObjectsMember TGetObjectsMember; + typedef typename PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >::TNbObjectsMember TNbObjectsMember; + typedef void (*TAddMember)(TObjType*, TCollectionType&); + typedef void (*TRemoveMember)(TObjType*, TCollectionType&); + + TAddMember mAddMember; + TRemoveMember mRemoveMember; + + PxCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember ) + : PxReadOnlyCollectionPropertyInfo< TKey, TObjType, TCollectionType >( inName, inGetter, inNb ) + , mAddMember( inMember ) + , mRemoveMember( inRemoveMember ) + { + } + void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); } + void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); } +}; + +template +struct PxFilteredCollectionPropertyInfo : public PxReadOnlyFilteredCollectionPropertyInfo +{ + typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TGetObjectsMember TGetObjectsMember; + typedef typename PxReadOnlyFilteredCollectionPropertyInfo< TKey, TObjType, TCollectionType, TFilterType >::TNbObjectsMember TNbObjectsMember; + typedef void (*TAddMember)(TObjType*, TCollectionType&); + typedef void (*TRemoveMember)(TObjType*, TCollectionType&); + + TAddMember mAddMember; + TRemoveMember mRemoveMember; + + PxFilteredCollectionPropertyInfo( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb, TAddMember inMember, TRemoveMember inRemoveMember ) + : PxReadOnlyFilteredCollectionPropertyInfo( inName, inGetter, inNb ) + , mAddMember( inMember ) + , mRemoveMember( inRemoveMember ) + { + } + void add( TObjType* inObj, TCollectionType& inArg ) const { mAddMember(inObj, inArg ); } + void remove( TObjType* inObj, TCollectionType& inArg ) const { mRemoveMember( inObj, inArg ); } +}; + +//create a default info class for when we can't match +//the type correctly. +struct PxUnknownClassInfo +{ + static const char* getClassName() { return "__unknown_class"; } + template + TReturnType visitType( TOperator ) + { + return TReturnType(); + } + template + void visitBases( TOperator ) + { + } + template + PxU32 visitBaseProperties( TOperator, PxU32 inStartIndex = 0 ) const + { + return inStartIndex; + } + template + PxU32 visitInstanceProperties( TOperator, PxU32 inStartIndex = 0 ) const + { + return inStartIndex; + } +}; + +template +struct PxClassInfoTraits +{ + PxUnknownClassInfo Info; + static bool getInfo() { return false;} +}; + +//move the bool typedef to the global namespace. +typedef bool _Bool; + + +template +struct PxPropertyToValueStructMemberMap +{ + bool Offset; +}; + + +#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \ + template<> struct PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop > \ + { \ + PxU32 Offset; \ + PxPropertyToValueStructMemberMap< PxPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \ + template void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \ + }; + + + +struct PxShapeGeomPropertyHelper +{ + PX_PHYSX_CORE_API PxGeometryType::Enum getGeometryType(const PxShape* inShape) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTetrahedronMeshGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxParticleSystemGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const; + PX_PHYSX_CORE_API bool getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const; +}; + +struct PxShapeGeomProperty : public PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & > + , public PxShapeGeomPropertyHelper +{ + + static void setPxShape_Geom( PxShape* inObj, const PxGeometry& inArg){ inObj->setGeometry( inArg ); } + static PxGeometryHolder getPxShape_Geom( const PxShape* inObj ) { return PxGeometryHolder(inObj->getGeometry()); } + + typedef PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & >::TSetterType TSetterType; + typedef PxGeometryHolder (*TGetterType)( const PxShape* inObj ); + PxShapeGeomProperty( const char* inName="Geometry", TSetterType inSetter=setPxShape_Geom, TGetterType=getPxShape_Geom ) + : PxWriteOnlyPropertyInfo< PxPropertyInfoName::PxShape_Geom, PxShape, const PxGeometry & >( inName, inSetter ) + { + } +}; + +struct PxShapeMaterialsPropertyHelper +{ + PX_PHYSX_CORE_API void setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const; +}; + +struct PxShapeMaterialsProperty : public PxReadOnlyCollectionPropertyInfo + , public PxShapeMaterialsPropertyHelper +{ + typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TGetObjectsMember TGetObjectsMember; + typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxShape_Materials, PxShape, PxMaterial* >::TNbObjectsMember TNbObjectsMember; + PxShapeMaterialsProperty( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) + : PxReadOnlyCollectionPropertyInfo( inName, inGetter, inNb ) + { + } +}; + +typedef PxPropertyInfo PxRigidActorGlobalPosePropertyInfo; + +struct PxRigidActorShapeCollectionHelper +{ + PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const; + PX_PHYSX_CORE_API PxShape* createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials, PxU16 materialCount, PxShapeFlags shapeFlags = PxShapeFlag::eVISUALIZATION | PxShapeFlag::eSCENE_QUERY_SHAPE | PxShapeFlag::eSIMULATION_SHAPE) const; +}; + +struct PxRigidActorShapeCollection : public PxReadOnlyCollectionPropertyInfo + , public PxRigidActorShapeCollectionHelper +{ + typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TGetObjectsMember TGetObjectsMember; + typedef PxReadOnlyCollectionPropertyInfo< PxPropertyInfoName::PxRigidActor_Shapes, PxRigidActor, PxShape* >::TNbObjectsMember TNbObjectsMember; + PxRigidActorShapeCollection( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) + : PxReadOnlyCollectionPropertyInfo( inName, inGetter, inNb ) + { + } +}; + +struct PxArticulationReducedCoordinateLinkCollectionPropHelper +{ + PX_PHYSX_CORE_API PxArticulationLink* createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent, const PxTransform& pose) const; +}; + +struct PxArticulationLinkCollectionProp : public PxReadOnlyCollectionPropertyInfo + , public PxArticulationReducedCoordinateLinkCollectionPropHelper +{ + PxArticulationLinkCollectionProp( const char* inName, TGetObjectsMember inGetter, TNbObjectsMember inNb ) + : PxReadOnlyCollectionPropertyInfo( inName, inGetter, inNb ) + { + } +}; + +template +struct PxEnumTraits { PxEnumTraits() : NameConversion( false ) {} bool NameConversion; }; + +struct NbShapesProperty : public PxIndexedPropertyInfo +{ + PX_PHYSX_CORE_API NbShapesProperty(); +}; + + +struct NbDiscreteContactPairsProperty : public PxDualIndexedPropertyInfo +{ + PX_PHYSX_CORE_API NbDiscreteContactPairsProperty(); +}; +struct NbModifiedContactPairsProperty : public PxDualIndexedPropertyInfo +{ + PX_PHYSX_CORE_API NbModifiedContactPairsProperty(); +}; + +struct NbCCDPairsProperty : public PxDualIndexedPropertyInfo +{ + PX_PHYSX_CORE_API NbCCDPairsProperty(); +}; + +struct NbTriggerPairsProperty : public PxDualIndexedPropertyInfo +{ + PX_PHYSX_CORE_API NbTriggerPairsProperty(); +}; + + +struct SimulationStatisticsProperty : public PxReadOnlyPropertyInfo +{ + PX_PHYSX_CORE_API SimulationStatisticsProperty(); +}; + +struct PxCustomGeometryCustomTypeProperty : public PxReadOnlyPropertyInfo +{ + PX_PHYSX_CORE_API PxCustomGeometryCustomTypeProperty(); +}; + +struct PxMetaDataPlane +{ + PxVec3 normal; + PxReal distance; + PxMetaDataPlane( PxVec3 n = PxVec3( 0, 0, 0 ), PxReal d = 0 ) + : normal( n ) + , distance( d ) + { + } +}; + +#include "PxAutoGeneratedMetaDataObjects.h" + +#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP + +static PxU32ToName g_physx__PxQueryFlag__EnumConversion[] = { + { "eSTATIC", static_cast( PxQueryFlag::eSTATIC ) }, + { "eDYNAMIC", static_cast( PxQueryFlag::eDYNAMIC ) }, + { "ePREFILTER", static_cast( PxQueryFlag::ePREFILTER ) }, + { "ePOSTFILTER", static_cast( PxQueryFlag::ePOSTFILTER ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits { PxEnumTraits() : NameConversion( g_physx__PxQueryFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + + +template +inline PxU32 visitAllProperties( TOperator inOperator ) +{ + PxU32 thePropCount = PxClassInfoTraits().Info.visitBaseProperties( inOperator ); + return PxClassInfoTraits().Info.visitInstanceProperties( inOperator, thePropCount ); +} + +template +inline void visitInstanceProperties( TOperator inOperator ) +{ + PxClassInfoTraits().Info.visitInstanceProperties( inOperator, 0 ); +} + +} + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/RepXMetaDataPropertyVisitor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/RepXMetaDataPropertyVisitor.h new file mode 100644 index 0000000..abff6bb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/include/RepXMetaDataPropertyVisitor.h @@ -0,0 +1,219 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_REPX_META_DATA_PROPERTY_VISITOR_H +#define PX_REPX_META_DATA_PROPERTY_VISITOR_H +#include "PvdMetaDataPropertyVisitor.h" + +namespace physx { + + template + struct PxRepXPropertyAccessor : public Vd::ValueStructOffsetRecord + { + typedef PxPropertyInfo TPropertyInfoType; + typedef TPropertyType prop_type; + + const TPropertyInfoType mProperty; + PxRepXPropertyAccessor( const TPropertyInfoType& inProp ) + : mProperty( inProp ) + { + } + prop_type get( const TObjectType* inObj ) const { return mProperty.get( inObj ); } + void set( TObjectType* inObj, prop_type val ) const { return mProperty.set( inObj, val ); } + + private: + PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&); + }; + + template + struct PxRepXPropertyAccessor : public Vd::ValueStructOffsetRecord + { + typedef PxPropertyInfo TPropertyInfoType; + typedef TPropertyType prop_type; + + const TPropertyInfoType mProperty; + PxRepXPropertyAccessor( const TPropertyInfoType& inProp ) + : mProperty( inProp ) + { + } + prop_type get( const PxRigidDynamic* inObj ) const { return mProperty.get( inObj ); } + void set( PxRigidDynamic* inObj, prop_type val ) const + { + PX_UNUSED(val); + PxRigidBodyFlags flags = inObj->getRigidBodyFlags(); + if( !(flags & PxRigidBodyFlag::eKINEMATIC) ) + return mProperty.set( inObj, val ); + } + private: + PxRepXPropertyAccessor& operator=(const PxRepXPropertyAccessor&); + }; + + typedef PxReadOnlyPropertyInfo TIncomingJointPropType; + + + //RepX cares about fewer property types than PVD does, + //but I want to reuse the accessor architecture as it + //greatly simplifies clients dealing with complex datatypes + template + struct RepXPropertyFilter + { + RepXPropertyFilter &operator=(const RepXPropertyFilter &); + + Vd::PvdPropertyFilter mFilter; + RepXPropertyFilter( TOperatorType op ) : mFilter( op ) {} + RepXPropertyFilter( const RepXPropertyFilter& other ) : mFilter( other.mFilter ) {} + + template + void operator()( const PxReadOnlyPropertyInfo&, PxU32 ) {} //repx ignores read only and write only properties + template + void operator()( const PxWriteOnlyPropertyInfo&, PxU32 ) {} + template + void operator()( const PxReadOnlyCollectionPropertyInfo&, PxU32 ) {} + + template + void operator()( const PxReadOnlyFilteredCollectionPropertyInfo&, PxU32 ) {} + //forward these properties verbatim. + template + void operator()( const PxIndexedPropertyInfo& inProp, PxU32 idx ) + { + mFilter( inProp, idx ); + } + + template + void operator()( const PxFixedSizeLookupTablePropertyInfo& inProp, PxU32 idx ) + { + mFilter( inProp, idx ); + } + + template + void operator()( const PxExtendedIndexedPropertyInfo& inProp, PxU32 idx) + { + mFilter( inProp, idx); + } + + template + void operator()( const PxDualIndexedPropertyInfo& inProp, PxU32 idx ) + { + mFilter( inProp, idx ); + } + + template + void operator()( const PxExtendedDualIndexedPropertyInfo& inProp, PxU32 idx ) + { + mFilter( inProp, idx ); + } + + template + void operator()( const PxRangePropertyInfo& inProp, PxU32 idx ) + { + mFilter( inProp, idx ); + } + + template + void operator()( const PxBufferCollectionPropertyInfo& inProp, PxU32 count ) + { + mFilter( inProp, count ); + } + + template + void operator()( const PxPropertyInfo& prop, PxU32 ) + { + PxRepXPropertyAccessor< TKey, TObjType, TSetPropType, TPropertyType > theAccessor( prop ); + mFilter.mOperator.pushName( prop.mName ); + mFilter.template handleAccessor( theAccessor ); + mFilter.mOperator.popName(); + } + + void operator()(const PxRigidActorGlobalPosePropertyInfo& inProp, PxU32) + { + mFilter.mOperator.pushName(inProp.mName); + mFilter.mOperator.handleRigidActorGlobalPose(inProp); + mFilter.mOperator.popName(); + } + + void operator()( const PxRigidActorShapeCollection& inProp, PxU32 ) + { + mFilter.mOperator.pushName( "Shapes" ); + mFilter.mOperator.handleShapes( inProp ); + mFilter.mOperator.popName(); + } + + void operator()( const PxArticulationLinkCollectionProp& inProp, PxU32 ) + { + mFilter.mOperator.pushName( "Links" ); + mFilter.mOperator.handleArticulationLinks( inProp ); + mFilter.mOperator.popName(); + } + + void operator()( const PxShapeMaterialsProperty& inProp, PxU32 ) + { + mFilter.mOperator.pushName( "Materials" ); + mFilter.mOperator.handleShapeMaterials( inProp ); + mFilter.mOperator.popName(); + } + + void operator()( const TIncomingJointPropType& inProp, PxU32 ) + { + mFilter.mOperator.handleIncomingJoint( inProp ); + } + + void operator()( const PxShapeGeomProperty& inProp, PxU32 ) + { + mFilter.mOperator.handleGeomProperty( inProp ); + } + +#define DEFINE_REPX_PROPERTY_NOP(datatype) \ + template \ + void operator()( const PxPropertyInfo&, PxU32 ){} + + DEFINE_REPX_PROPERTY_NOP( const void* ) + DEFINE_REPX_PROPERTY_NOP( void* ) + DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterCallback * ) + DEFINE_REPX_PROPERTY_NOP( physx::PxTaskManager * ) + DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader * ) + DEFINE_REPX_PROPERTY_NOP( PxSimulationFilterShader) + DEFINE_REPX_PROPERTY_NOP( PxContactModifyCallback * ) + DEFINE_REPX_PROPERTY_NOP( PxCCDContactModifyCallback * ) + DEFINE_REPX_PROPERTY_NOP( PxSimulationEventCallback * ) + DEFINE_REPX_PROPERTY_NOP( physx::PxCudaContextManager* ) + DEFINE_REPX_PROPERTY_NOP( physx::PxCpuDispatcher * ) + DEFINE_REPX_PROPERTY_NOP( PxRigidActor ) + DEFINE_REPX_PROPERTY_NOP( const PxRigidActor ) + DEFINE_REPX_PROPERTY_NOP( PxRigidActor& ) + DEFINE_REPX_PROPERTY_NOP( const PxRigidActor& ) + DEFINE_REPX_PROPERTY_NOP( PxScene* ) + DEFINE_REPX_PROPERTY_NOP( PxAggregate * ) + DEFINE_REPX_PROPERTY_NOP( PxArticulationReducedCoordinate& ) + DEFINE_REPX_PROPERTY_NOP( const PxArticulationLink * ) + DEFINE_REPX_PROPERTY_NOP( const PxRigidDynamic * ) + DEFINE_REPX_PROPERTY_NOP( const PxRigidStatic * ) + DEFINE_REPX_PROPERTY_NOP( PxStridedData ) //These are handled in a custom fasion. + }; +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp new file mode 100644 index 0000000..2e5a9ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxAutoGeneratedMetaDataObjects.cpp @@ -0,0 +1,1666 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#include "foundation/PxPreprocessor.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif +#include "PxMetaDataObjects.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +#include "PxMetaDataCppPrefix.h" +using namespace physx; +const PxTolerancesScale getPxPhysics_TolerancesScale( const PxPhysics* inObj ) { return inObj->getTolerancesScale(); } +PxU32 getPxPhysics_TriangleMeshes( const PxPhysics* inObj, PxTriangleMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getTriangleMeshes( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_TriangleMeshes( const PxPhysics* inObj ) { return inObj->getNbTriangleMeshes( ); } +PxTriangleMesh * createPxPhysics_TriangleMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createTriangleMesh( inCreateParam ); } +PxU32 getPxPhysics_TetrahedronMeshes( const PxPhysics* inObj, PxTetrahedronMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getTetrahedronMeshes( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_TetrahedronMeshes( const PxPhysics* inObj ) { return inObj->getNbTetrahedronMeshes( ); } +PxTetrahedronMesh * createPxPhysics_TetrahedronMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createTetrahedronMesh( inCreateParam ); } +PxU32 getPxPhysics_HeightFields( const PxPhysics* inObj, PxHeightField ** outBuffer, PxU32 inBufSize ) { return inObj->getHeightFields( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_HeightFields( const PxPhysics* inObj ) { return inObj->getNbHeightFields( ); } +PxHeightField * createPxPhysics_HeightFields( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createHeightField( inCreateParam ); } +PxU32 getPxPhysics_ConvexMeshes( const PxPhysics* inObj, PxConvexMesh ** outBuffer, PxU32 inBufSize ) { return inObj->getConvexMeshes( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_ConvexMeshes( const PxPhysics* inObj ) { return inObj->getNbConvexMeshes( ); } +PxConvexMesh * createPxPhysics_ConvexMeshes( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createConvexMesh( inCreateParam ); } +PxU32 getPxPhysics_BVHs( const PxPhysics* inObj, PxBVH ** outBuffer, PxU32 inBufSize ) { return inObj->getBVHs( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_BVHs( const PxPhysics* inObj ) { return inObj->getNbBVHs( ); } +PxBVH * createPxPhysics_BVHs( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createBVH( inCreateParam ); } +PxU32 getPxPhysics_BVHStructures( const PxPhysics* inObj, PxBVHStructure ** outBuffer, PxU32 inBufSize ) { return inObj->getBVHStructures( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_BVHStructures( const PxPhysics* inObj ) { return inObj->getNbBVHStructures( ); } +PxBVHStructure * createPxPhysics_BVHStructures( PxPhysics* inObj, PxInputStream & inCreateParam ){ return inObj->createBVHStructure( inCreateParam ); } +PxU32 getPxPhysics_Scenes( const PxPhysics* inObj, PxScene ** outBuffer, PxU32 inBufSize ) { return inObj->getScenes( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_Scenes( const PxPhysics* inObj ) { return inObj->getNbScenes( ); } +PxScene * createPxPhysics_Scenes( PxPhysics* inObj, const PxSceneDesc & inCreateParam ){ return inObj->createScene( inCreateParam ); } +PxU32 getPxPhysics_Shapes( const PxPhysics* inObj, PxShape ** outBuffer, PxU32 inBufSize ) { return inObj->getShapes( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_Shapes( const PxPhysics* inObj ) { return inObj->getNbShapes( ); } +PxU32 getPxPhysics_Materials( const PxPhysics* inObj, PxMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_Materials( const PxPhysics* inObj ) { return inObj->getNbMaterials( ); } +PxU32 getPxPhysics_FEMSoftBodyMaterials( const PxPhysics* inObj, PxFEMSoftBodyMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getFEMSoftBodyMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_FEMSoftBodyMaterials( const PxPhysics* inObj ) { return inObj->getNbFEMSoftBodyMaterials( ); } +PxU32 getPxPhysics_FEMClothMaterials( const PxPhysics* inObj, PxFEMClothMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getFEMClothMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_FEMClothMaterials( const PxPhysics* inObj ) { return inObj->getNbFEMClothMaterials( ); } +PxU32 getPxPhysics_PBDMaterials( const PxPhysics* inObj, PxPBDMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getPBDMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_PBDMaterials( const PxPhysics* inObj ) { return inObj->getNbPBDMaterials( ); } +PxU32 getPxPhysics_CustomMaterials( const PxPhysics* inObj, PxCustomMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getCustomMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxPhysics_CustomMaterials( const PxPhysics* inObj ) { return inObj->getNbCustomMaterials( ); } +PxCustomMaterial * createPxPhysics_CustomMaterials( PxPhysics* inObj, void * inCreateParam ){ return inObj->createCustomMaterial( inCreateParam ); } +PX_PHYSX_CORE_API PxPhysicsGeneratedInfo::PxPhysicsGeneratedInfo() + : TolerancesScale( "TolerancesScale", getPxPhysics_TolerancesScale) + , TriangleMeshes( "TriangleMeshes", getPxPhysics_TriangleMeshes, getNbPxPhysics_TriangleMeshes, createPxPhysics_TriangleMeshes ) + , TetrahedronMeshes( "TetrahedronMeshes", getPxPhysics_TetrahedronMeshes, getNbPxPhysics_TetrahedronMeshes, createPxPhysics_TetrahedronMeshes ) + , HeightFields( "HeightFields", getPxPhysics_HeightFields, getNbPxPhysics_HeightFields, createPxPhysics_HeightFields ) + , ConvexMeshes( "ConvexMeshes", getPxPhysics_ConvexMeshes, getNbPxPhysics_ConvexMeshes, createPxPhysics_ConvexMeshes ) + , BVHs( "BVHs", getPxPhysics_BVHs, getNbPxPhysics_BVHs, createPxPhysics_BVHs ) + , BVHStructures( "BVHStructures", getPxPhysics_BVHStructures, getNbPxPhysics_BVHStructures, createPxPhysics_BVHStructures ) + , Scenes( "Scenes", getPxPhysics_Scenes, getNbPxPhysics_Scenes, createPxPhysics_Scenes ) + , Shapes( "Shapes", getPxPhysics_Shapes, getNbPxPhysics_Shapes ) + , Materials( "Materials", getPxPhysics_Materials, getNbPxPhysics_Materials ) + , FEMSoftBodyMaterials( "FEMSoftBodyMaterials", getPxPhysics_FEMSoftBodyMaterials, getNbPxPhysics_FEMSoftBodyMaterials ) + , FEMClothMaterials( "FEMClothMaterials", getPxPhysics_FEMClothMaterials, getNbPxPhysics_FEMClothMaterials ) + , PBDMaterials( "PBDMaterials", getPxPhysics_PBDMaterials, getNbPxPhysics_PBDMaterials ) + , CustomMaterials( "CustomMaterials", getPxPhysics_CustomMaterials, getNbPxPhysics_CustomMaterials, createPxPhysics_CustomMaterials ) +{} +PX_PHYSX_CORE_API PxPhysicsGeneratedValues::PxPhysicsGeneratedValues( const PxPhysics* inSource ) + :TolerancesScale( getPxPhysics_TolerancesScale( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxU32 getPxRefCounted_ReferenceCount( const PxRefCounted* inObj ) { return inObj->getReferenceCount(); } +PX_PHYSX_CORE_API PxRefCountedGeneratedInfo::PxRefCountedGeneratedInfo() + : ReferenceCount( "ReferenceCount", getPxRefCounted_ReferenceCount) +{} +PX_PHYSX_CORE_API PxRefCountedGeneratedValues::PxRefCountedGeneratedValues( const PxRefCounted* inSource ) + :ReferenceCount( getPxRefCounted_ReferenceCount( inSource ) ) +{ + PX_UNUSED(inSource); +} +inline void * getPxBaseMaterialUserData( const PxBaseMaterial* inOwner ) { return inOwner->userData; } +inline void setPxBaseMaterialUserData( PxBaseMaterial* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxBaseMaterialGeneratedInfo::PxBaseMaterialGeneratedInfo() + : UserData( "UserData", setPxBaseMaterialUserData, getPxBaseMaterialUserData ) +{} +PX_PHYSX_CORE_API PxBaseMaterialGeneratedValues::PxBaseMaterialGeneratedValues( const PxBaseMaterial* inSource ) + :PxRefCountedGeneratedValues( inSource ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); +} +void setPxMaterial_DynamicFriction( PxMaterial* inObj, PxReal inArg){ inObj->setDynamicFriction( inArg ); } +PxReal getPxMaterial_DynamicFriction( const PxMaterial* inObj ) { return inObj->getDynamicFriction(); } +void setPxMaterial_StaticFriction( PxMaterial* inObj, PxReal inArg){ inObj->setStaticFriction( inArg ); } +PxReal getPxMaterial_StaticFriction( const PxMaterial* inObj ) { return inObj->getStaticFriction(); } +void setPxMaterial_Restitution( PxMaterial* inObj, PxReal inArg){ inObj->setRestitution( inArg ); } +PxReal getPxMaterial_Restitution( const PxMaterial* inObj ) { return inObj->getRestitution(); } +void setPxMaterial_Damping( PxMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); } +PxReal getPxMaterial_Damping( const PxMaterial* inObj ) { return inObj->getDamping(); } +void setPxMaterial_Flags( PxMaterial* inObj, PxMaterialFlags inArg){ inObj->setFlags( inArg ); } +PxMaterialFlags getPxMaterial_Flags( const PxMaterial* inObj ) { return inObj->getFlags(); } +void setPxMaterial_FrictionCombineMode( PxMaterial* inObj, PxCombineMode::Enum inArg){ inObj->setFrictionCombineMode( inArg ); } +PxCombineMode::Enum getPxMaterial_FrictionCombineMode( const PxMaterial* inObj ) { return inObj->getFrictionCombineMode(); } +void setPxMaterial_RestitutionCombineMode( PxMaterial* inObj, PxCombineMode::Enum inArg){ inObj->setRestitutionCombineMode( inArg ); } +PxCombineMode::Enum getPxMaterial_RestitutionCombineMode( const PxMaterial* inObj ) { return inObj->getRestitutionCombineMode(); } +const char * getPxMaterial_ConcreteTypeName( const PxMaterial* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxMaterialGeneratedInfo::PxMaterialGeneratedInfo() + : DynamicFriction( "DynamicFriction", setPxMaterial_DynamicFriction, getPxMaterial_DynamicFriction) + , StaticFriction( "StaticFriction", setPxMaterial_StaticFriction, getPxMaterial_StaticFriction) + , Restitution( "Restitution", setPxMaterial_Restitution, getPxMaterial_Restitution) + , Damping( "Damping", setPxMaterial_Damping, getPxMaterial_Damping) + , Flags( "Flags", setPxMaterial_Flags, getPxMaterial_Flags) + , FrictionCombineMode( "FrictionCombineMode", setPxMaterial_FrictionCombineMode, getPxMaterial_FrictionCombineMode) + , RestitutionCombineMode( "RestitutionCombineMode", setPxMaterial_RestitutionCombineMode, getPxMaterial_RestitutionCombineMode) + , ConcreteTypeName( "ConcreteTypeName", getPxMaterial_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxMaterialGeneratedValues::PxMaterialGeneratedValues( const PxMaterial* inSource ) + :PxBaseMaterialGeneratedValues( inSource ) + ,DynamicFriction( getPxMaterial_DynamicFriction( inSource ) ) + ,StaticFriction( getPxMaterial_StaticFriction( inSource ) ) + ,Restitution( getPxMaterial_Restitution( inSource ) ) + ,Damping( getPxMaterial_Damping( inSource ) ) + ,Flags( getPxMaterial_Flags( inSource ) ) + ,FrictionCombineMode( getPxMaterial_FrictionCombineMode( inSource ) ) + ,RestitutionCombineMode( getPxMaterial_RestitutionCombineMode( inSource ) ) + ,ConcreteTypeName( getPxMaterial_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxFEMMaterial_YoungsModulus( PxFEMMaterial* inObj, PxReal inArg){ inObj->setYoungsModulus( inArg ); } +PxReal getPxFEMMaterial_YoungsModulus( const PxFEMMaterial* inObj ) { return inObj->getYoungsModulus(); } +void setPxFEMMaterial_Poissons( PxFEMMaterial* inObj, PxReal inArg){ inObj->setPoissons( inArg ); } +PxReal getPxFEMMaterial_Poissons( const PxFEMMaterial* inObj ) { return inObj->getPoissons(); } +void setPxFEMMaterial_DynamicFriction( PxFEMMaterial* inObj, PxReal inArg){ inObj->setDynamicFriction( inArg ); } +PxReal getPxFEMMaterial_DynamicFriction( const PxFEMMaterial* inObj ) { return inObj->getDynamicFriction(); } +PX_PHYSX_CORE_API PxFEMMaterialGeneratedInfo::PxFEMMaterialGeneratedInfo() + : YoungsModulus( "YoungsModulus", setPxFEMMaterial_YoungsModulus, getPxFEMMaterial_YoungsModulus) + , Poissons( "Poissons", setPxFEMMaterial_Poissons, getPxFEMMaterial_Poissons) + , DynamicFriction( "DynamicFriction", setPxFEMMaterial_DynamicFriction, getPxFEMMaterial_DynamicFriction) +{} +PX_PHYSX_CORE_API PxFEMMaterialGeneratedValues::PxFEMMaterialGeneratedValues( const PxFEMMaterial* inSource ) + :PxBaseMaterialGeneratedValues( inSource ) + ,YoungsModulus( getPxFEMMaterial_YoungsModulus( inSource ) ) + ,Poissons( getPxFEMMaterial_Poissons( inSource ) ) + ,DynamicFriction( getPxFEMMaterial_DynamicFriction( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxFEMSoftBodyMaterial_Damping( PxFEMSoftBodyMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); } +PxReal getPxFEMSoftBodyMaterial_Damping( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getDamping(); } +void setPxFEMSoftBodyMaterial_DampingScale( PxFEMSoftBodyMaterial* inObj, PxReal inArg){ inObj->setDampingScale( inArg ); } +PxReal getPxFEMSoftBodyMaterial_DampingScale( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getDampingScale(); } +const char * getPxFEMSoftBodyMaterial_ConcreteTypeName( const PxFEMSoftBodyMaterial* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedInfo::PxFEMSoftBodyMaterialGeneratedInfo() + : Damping( "Damping", setPxFEMSoftBodyMaterial_Damping, getPxFEMSoftBodyMaterial_Damping) + , DampingScale( "DampingScale", setPxFEMSoftBodyMaterial_DampingScale, getPxFEMSoftBodyMaterial_DampingScale) + , ConcreteTypeName( "ConcreteTypeName", getPxFEMSoftBodyMaterial_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxFEMSoftBodyMaterialGeneratedValues::PxFEMSoftBodyMaterialGeneratedValues( const PxFEMSoftBodyMaterial* inSource ) + :PxFEMMaterialGeneratedValues( inSource ) + ,Damping( getPxFEMSoftBodyMaterial_Damping( inSource ) ) + ,DampingScale( getPxFEMSoftBodyMaterial_DampingScale( inSource ) ) + ,ConcreteTypeName( getPxFEMSoftBodyMaterial_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxParticleMaterial_Friction( PxParticleMaterial* inObj, PxReal inArg){ inObj->setFriction( inArg ); } +PxReal getPxParticleMaterial_Friction( const PxParticleMaterial* inObj ) { return inObj->getFriction(); } +void setPxParticleMaterial_Damping( PxParticleMaterial* inObj, PxReal inArg){ inObj->setDamping( inArg ); } +PxReal getPxParticleMaterial_Damping( const PxParticleMaterial* inObj ) { return inObj->getDamping(); } +void setPxParticleMaterial_Adhesion( PxParticleMaterial* inObj, PxReal inArg){ inObj->setAdhesion( inArg ); } +PxReal getPxParticleMaterial_Adhesion( const PxParticleMaterial* inObj ) { return inObj->getAdhesion(); } +void setPxParticleMaterial_GravityScale( PxParticleMaterial* inObj, PxReal inArg){ inObj->setGravityScale( inArg ); } +PxReal getPxParticleMaterial_GravityScale( const PxParticleMaterial* inObj ) { return inObj->getGravityScale(); } +void setPxParticleMaterial_AdhesionRadiusScale( PxParticleMaterial* inObj, PxReal inArg){ inObj->setAdhesionRadiusScale( inArg ); } +PxReal getPxParticleMaterial_AdhesionRadiusScale( const PxParticleMaterial* inObj ) { return inObj->getAdhesionRadiusScale(); } +PX_PHYSX_CORE_API PxParticleMaterialGeneratedInfo::PxParticleMaterialGeneratedInfo() + : Friction( "Friction", setPxParticleMaterial_Friction, getPxParticleMaterial_Friction) + , Damping( "Damping", setPxParticleMaterial_Damping, getPxParticleMaterial_Damping) + , Adhesion( "Adhesion", setPxParticleMaterial_Adhesion, getPxParticleMaterial_Adhesion) + , GravityScale( "GravityScale", setPxParticleMaterial_GravityScale, getPxParticleMaterial_GravityScale) + , AdhesionRadiusScale( "AdhesionRadiusScale", setPxParticleMaterial_AdhesionRadiusScale, getPxParticleMaterial_AdhesionRadiusScale) +{} +PX_PHYSX_CORE_API PxParticleMaterialGeneratedValues::PxParticleMaterialGeneratedValues( const PxParticleMaterial* inSource ) + :PxBaseMaterialGeneratedValues( inSource ) + ,Friction( getPxParticleMaterial_Friction( inSource ) ) + ,Damping( getPxParticleMaterial_Damping( inSource ) ) + ,Adhesion( getPxParticleMaterial_Adhesion( inSource ) ) + ,GravityScale( getPxParticleMaterial_GravityScale( inSource ) ) + ,AdhesionRadiusScale( getPxParticleMaterial_AdhesionRadiusScale( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxPBDMaterial_Viscosity( PxPBDMaterial* inObj, PxReal inArg){ inObj->setViscosity( inArg ); } +PxReal getPxPBDMaterial_Viscosity( const PxPBDMaterial* inObj ) { return inObj->getViscosity(); } +void setPxPBDMaterial_VorticityConfinement( PxPBDMaterial* inObj, PxReal inArg){ inObj->setVorticityConfinement( inArg ); } +PxReal getPxPBDMaterial_VorticityConfinement( const PxPBDMaterial* inObj ) { return inObj->getVorticityConfinement(); } +void setPxPBDMaterial_SurfaceTension( PxPBDMaterial* inObj, PxReal inArg){ inObj->setSurfaceTension( inArg ); } +PxReal getPxPBDMaterial_SurfaceTension( const PxPBDMaterial* inObj ) { return inObj->getSurfaceTension(); } +void setPxPBDMaterial_Cohesion( PxPBDMaterial* inObj, PxReal inArg){ inObj->setCohesion( inArg ); } +PxReal getPxPBDMaterial_Cohesion( const PxPBDMaterial* inObj ) { return inObj->getCohesion(); } +void setPxPBDMaterial_Lift( PxPBDMaterial* inObj, PxReal inArg){ inObj->setLift( inArg ); } +PxReal getPxPBDMaterial_Lift( const PxPBDMaterial* inObj ) { return inObj->getLift(); } +void setPxPBDMaterial_Drag( PxPBDMaterial* inObj, PxReal inArg){ inObj->setDrag( inArg ); } +PxReal getPxPBDMaterial_Drag( const PxPBDMaterial* inObj ) { return inObj->getDrag(); } +void setPxPBDMaterial_CFLCoefficient( PxPBDMaterial* inObj, PxReal inArg){ inObj->setCFLCoefficient( inArg ); } +PxReal getPxPBDMaterial_CFLCoefficient( const PxPBDMaterial* inObj ) { return inObj->getCFLCoefficient(); } +void setPxPBDMaterial_ParticleFrictionScale( PxPBDMaterial* inObj, PxReal inArg){ inObj->setParticleFrictionScale( inArg ); } +PxReal getPxPBDMaterial_ParticleFrictionScale( const PxPBDMaterial* inObj ) { return inObj->getParticleFrictionScale(); } +void setPxPBDMaterial_ParticleAdhesionScale( PxPBDMaterial* inObj, PxReal inArg){ inObj->setParticleAdhesionScale( inArg ); } +PxReal getPxPBDMaterial_ParticleAdhesionScale( const PxPBDMaterial* inObj ) { return inObj->getParticleAdhesionScale(); } +const char * getPxPBDMaterial_ConcreteTypeName( const PxPBDMaterial* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxPBDMaterialGeneratedInfo::PxPBDMaterialGeneratedInfo() + : Viscosity( "Viscosity", setPxPBDMaterial_Viscosity, getPxPBDMaterial_Viscosity) + , VorticityConfinement( "VorticityConfinement", setPxPBDMaterial_VorticityConfinement, getPxPBDMaterial_VorticityConfinement) + , SurfaceTension( "SurfaceTension", setPxPBDMaterial_SurfaceTension, getPxPBDMaterial_SurfaceTension) + , Cohesion( "Cohesion", setPxPBDMaterial_Cohesion, getPxPBDMaterial_Cohesion) + , Lift( "Lift", setPxPBDMaterial_Lift, getPxPBDMaterial_Lift) + , Drag( "Drag", setPxPBDMaterial_Drag, getPxPBDMaterial_Drag) + , CFLCoefficient( "CFLCoefficient", setPxPBDMaterial_CFLCoefficient, getPxPBDMaterial_CFLCoefficient) + , ParticleFrictionScale( "ParticleFrictionScale", setPxPBDMaterial_ParticleFrictionScale, getPxPBDMaterial_ParticleFrictionScale) + , ParticleAdhesionScale( "ParticleAdhesionScale", setPxPBDMaterial_ParticleAdhesionScale, getPxPBDMaterial_ParticleAdhesionScale) + , ConcreteTypeName( "ConcreteTypeName", getPxPBDMaterial_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxPBDMaterialGeneratedValues::PxPBDMaterialGeneratedValues( const PxPBDMaterial* inSource ) + :PxParticleMaterialGeneratedValues( inSource ) + ,Viscosity( getPxPBDMaterial_Viscosity( inSource ) ) + ,VorticityConfinement( getPxPBDMaterial_VorticityConfinement( inSource ) ) + ,SurfaceTension( getPxPBDMaterial_SurfaceTension( inSource ) ) + ,Cohesion( getPxPBDMaterial_Cohesion( inSource ) ) + ,Lift( getPxPBDMaterial_Lift( inSource ) ) + ,Drag( getPxPBDMaterial_Drag( inSource ) ) + ,CFLCoefficient( getPxPBDMaterial_CFLCoefficient( inSource ) ) + ,ParticleFrictionScale( getPxPBDMaterial_ParticleFrictionScale( inSource ) ) + ,ParticleAdhesionScale( getPxPBDMaterial_ParticleAdhesionScale( inSource ) ) + ,ConcreteTypeName( getPxPBDMaterial_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxScene * getPxActor_Scene( const PxActor* inObj ) { return inObj->getScene(); } +void setPxActor_Name( PxActor* inObj, const char * inArg){ inObj->setName( inArg ); } +const char * getPxActor_Name( const PxActor* inObj ) { return inObj->getName(); } +void setPxActor_ActorFlags( PxActor* inObj, PxActorFlags inArg){ inObj->setActorFlags( inArg ); } +PxActorFlags getPxActor_ActorFlags( const PxActor* inObj ) { return inObj->getActorFlags(); } +void setPxActor_DominanceGroup( PxActor* inObj, PxDominanceGroup inArg){ inObj->setDominanceGroup( inArg ); } +PxDominanceGroup getPxActor_DominanceGroup( const PxActor* inObj ) { return inObj->getDominanceGroup(); } +void setPxActor_OwnerClient( PxActor* inObj, PxClientID inArg){ inObj->setOwnerClient( inArg ); } +PxClientID getPxActor_OwnerClient( const PxActor* inObj ) { return inObj->getOwnerClient(); } +PxAggregate * getPxActor_Aggregate( const PxActor* inObj ) { return inObj->getAggregate(); } +inline void * getPxActorUserData( const PxActor* inOwner ) { return inOwner->userData; } +inline void setPxActorUserData( PxActor* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxActorGeneratedInfo::PxActorGeneratedInfo() + : Scene( "Scene", getPxActor_Scene) + , Name( "Name", setPxActor_Name, getPxActor_Name) + , ActorFlags( "ActorFlags", setPxActor_ActorFlags, getPxActor_ActorFlags) + , DominanceGroup( "DominanceGroup", setPxActor_DominanceGroup, getPxActor_DominanceGroup) + , OwnerClient( "OwnerClient", setPxActor_OwnerClient, getPxActor_OwnerClient) + , Aggregate( "Aggregate", getPxActor_Aggregate) + , UserData( "UserData", setPxActorUserData, getPxActorUserData ) +{} +PX_PHYSX_CORE_API PxActorGeneratedValues::PxActorGeneratedValues( const PxActor* inSource ) + :Scene( getPxActor_Scene( inSource ) ) + ,Name( getPxActor_Name( inSource ) ) + ,ActorFlags( getPxActor_ActorFlags( inSource ) ) + ,DominanceGroup( getPxActor_DominanceGroup( inSource ) ) + ,OwnerClient( getPxActor_OwnerClient( inSource ) ) + ,Aggregate( getPxActor_Aggregate( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); +} +void setPxRigidActor_GlobalPose( PxRigidActor* inObj, const PxTransform & inArg){ inObj->setGlobalPose( inArg ); } +PxTransform getPxRigidActor_GlobalPose( const PxRigidActor* inObj ) { return inObj->getGlobalPose(); } +PxU32 getPxRigidActor_Shapes( const PxRigidActor* inObj, PxShape ** outBuffer, PxU32 inBufSize ) { return inObj->getShapes( outBuffer, inBufSize ); } +PxU32 getNbPxRigidActor_Shapes( const PxRigidActor* inObj ) { return inObj->getNbShapes( ); } +PxU32 getPxRigidActor_Constraints( const PxRigidActor* inObj, PxConstraint ** outBuffer, PxU32 inBufSize ) { return inObj->getConstraints( outBuffer, inBufSize ); } +PxU32 getNbPxRigidActor_Constraints( const PxRigidActor* inObj ) { return inObj->getNbConstraints( ); } +PX_PHYSX_CORE_API PxRigidActorGeneratedInfo::PxRigidActorGeneratedInfo() + : GlobalPose( "GlobalPose", setPxRigidActor_GlobalPose, getPxRigidActor_GlobalPose) + , Shapes( "Shapes", getPxRigidActor_Shapes, getNbPxRigidActor_Shapes ) + , Constraints( "Constraints", getPxRigidActor_Constraints, getNbPxRigidActor_Constraints ) +{} +PX_PHYSX_CORE_API PxRigidActorGeneratedValues::PxRigidActorGeneratedValues( const PxRigidActor* inSource ) + :PxActorGeneratedValues( inSource ) + ,GlobalPose( getPxRigidActor_GlobalPose( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxRigidBody_CMassLocalPose( PxRigidBody* inObj, const PxTransform & inArg){ inObj->setCMassLocalPose( inArg ); } +PxTransform getPxRigidBody_CMassLocalPose( const PxRigidBody* inObj ) { return inObj->getCMassLocalPose(); } +void setPxRigidBody_Mass( PxRigidBody* inObj, PxReal inArg){ inObj->setMass( inArg ); } +PxReal getPxRigidBody_Mass( const PxRigidBody* inObj ) { return inObj->getMass(); } +PxReal getPxRigidBody_InvMass( const PxRigidBody* inObj ) { return inObj->getInvMass(); } +void setPxRigidBody_MassSpaceInertiaTensor( PxRigidBody* inObj, const PxVec3 & inArg){ inObj->setMassSpaceInertiaTensor( inArg ); } +PxVec3 getPxRigidBody_MassSpaceInertiaTensor( const PxRigidBody* inObj ) { return inObj->getMassSpaceInertiaTensor(); } +PxVec3 getPxRigidBody_MassSpaceInvInertiaTensor( const PxRigidBody* inObj ) { return inObj->getMassSpaceInvInertiaTensor(); } +void setPxRigidBody_LinearDamping( PxRigidBody* inObj, PxReal inArg){ inObj->setLinearDamping( inArg ); } +PxReal getPxRigidBody_LinearDamping( const PxRigidBody* inObj ) { return inObj->getLinearDamping(); } +void setPxRigidBody_AngularDamping( PxRigidBody* inObj, PxReal inArg){ inObj->setAngularDamping( inArg ); } +PxReal getPxRigidBody_AngularDamping( const PxRigidBody* inObj ) { return inObj->getAngularDamping(); } +void setPxRigidBody_MaxLinearVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxLinearVelocity( inArg ); } +PxReal getPxRigidBody_MaxLinearVelocity( const PxRigidBody* inObj ) { return inObj->getMaxLinearVelocity(); } +void setPxRigidBody_MaxAngularVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxAngularVelocity( inArg ); } +PxReal getPxRigidBody_MaxAngularVelocity( const PxRigidBody* inObj ) { return inObj->getMaxAngularVelocity(); } +void setPxRigidBody_RigidBodyFlags( PxRigidBody* inObj, PxRigidBodyFlags inArg){ inObj->setRigidBodyFlags( inArg ); } +PxRigidBodyFlags getPxRigidBody_RigidBodyFlags( const PxRigidBody* inObj ) { return inObj->getRigidBodyFlags(); } +void setPxRigidBody_MinCCDAdvanceCoefficient( PxRigidBody* inObj, PxReal inArg){ inObj->setMinCCDAdvanceCoefficient( inArg ); } +PxReal getPxRigidBody_MinCCDAdvanceCoefficient( const PxRigidBody* inObj ) { return inObj->getMinCCDAdvanceCoefficient(); } +void setPxRigidBody_MaxDepenetrationVelocity( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxDepenetrationVelocity( inArg ); } +PxReal getPxRigidBody_MaxDepenetrationVelocity( const PxRigidBody* inObj ) { return inObj->getMaxDepenetrationVelocity(); } +void setPxRigidBody_MaxContactImpulse( PxRigidBody* inObj, PxReal inArg){ inObj->setMaxContactImpulse( inArg ); } +PxReal getPxRigidBody_MaxContactImpulse( const PxRigidBody* inObj ) { return inObj->getMaxContactImpulse(); } +void setPxRigidBody_ContactSlopCoefficient( PxRigidBody* inObj, PxReal inArg){ inObj->setContactSlopCoefficient( inArg ); } +PxReal getPxRigidBody_ContactSlopCoefficient( const PxRigidBody* inObj ) { return inObj->getContactSlopCoefficient(); } +PX_PHYSX_CORE_API PxRigidBodyGeneratedInfo::PxRigidBodyGeneratedInfo() + : CMassLocalPose( "CMassLocalPose", setPxRigidBody_CMassLocalPose, getPxRigidBody_CMassLocalPose) + , Mass( "Mass", setPxRigidBody_Mass, getPxRigidBody_Mass) + , InvMass( "InvMass", getPxRigidBody_InvMass) + , MassSpaceInertiaTensor( "MassSpaceInertiaTensor", setPxRigidBody_MassSpaceInertiaTensor, getPxRigidBody_MassSpaceInertiaTensor) + , MassSpaceInvInertiaTensor( "MassSpaceInvInertiaTensor", getPxRigidBody_MassSpaceInvInertiaTensor) + , LinearDamping( "LinearDamping", setPxRigidBody_LinearDamping, getPxRigidBody_LinearDamping) + , AngularDamping( "AngularDamping", setPxRigidBody_AngularDamping, getPxRigidBody_AngularDamping) + , MaxLinearVelocity( "MaxLinearVelocity", setPxRigidBody_MaxLinearVelocity, getPxRigidBody_MaxLinearVelocity) + , MaxAngularVelocity( "MaxAngularVelocity", setPxRigidBody_MaxAngularVelocity, getPxRigidBody_MaxAngularVelocity) + , RigidBodyFlags( "RigidBodyFlags", setPxRigidBody_RigidBodyFlags, getPxRigidBody_RigidBodyFlags) + , MinCCDAdvanceCoefficient( "MinCCDAdvanceCoefficient", setPxRigidBody_MinCCDAdvanceCoefficient, getPxRigidBody_MinCCDAdvanceCoefficient) + , MaxDepenetrationVelocity( "MaxDepenetrationVelocity", setPxRigidBody_MaxDepenetrationVelocity, getPxRigidBody_MaxDepenetrationVelocity) + , MaxContactImpulse( "MaxContactImpulse", setPxRigidBody_MaxContactImpulse, getPxRigidBody_MaxContactImpulse) + , ContactSlopCoefficient( "ContactSlopCoefficient", setPxRigidBody_ContactSlopCoefficient, getPxRigidBody_ContactSlopCoefficient) +{} +PX_PHYSX_CORE_API PxRigidBodyGeneratedValues::PxRigidBodyGeneratedValues( const PxRigidBody* inSource ) + :PxRigidActorGeneratedValues( inSource ) + ,CMassLocalPose( getPxRigidBody_CMassLocalPose( inSource ) ) + ,Mass( getPxRigidBody_Mass( inSource ) ) + ,InvMass( getPxRigidBody_InvMass( inSource ) ) + ,MassSpaceInertiaTensor( getPxRigidBody_MassSpaceInertiaTensor( inSource ) ) + ,MassSpaceInvInertiaTensor( getPxRigidBody_MassSpaceInvInertiaTensor( inSource ) ) + ,LinearDamping( getPxRigidBody_LinearDamping( inSource ) ) + ,AngularDamping( getPxRigidBody_AngularDamping( inSource ) ) + ,MaxLinearVelocity( getPxRigidBody_MaxLinearVelocity( inSource ) ) + ,MaxAngularVelocity( getPxRigidBody_MaxAngularVelocity( inSource ) ) + ,RigidBodyFlags( getPxRigidBody_RigidBodyFlags( inSource ) ) + ,MinCCDAdvanceCoefficient( getPxRigidBody_MinCCDAdvanceCoefficient( inSource ) ) + ,MaxDepenetrationVelocity( getPxRigidBody_MaxDepenetrationVelocity( inSource ) ) + ,MaxContactImpulse( getPxRigidBody_MaxContactImpulse( inSource ) ) + ,ContactSlopCoefficient( getPxRigidBody_ContactSlopCoefficient( inSource ) ) +{ + PX_UNUSED(inSource); +} +_Bool getPxRigidDynamic_IsSleeping( const PxRigidDynamic* inObj ) { return inObj->isSleeping(); } +void setPxRigidDynamic_SleepThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setSleepThreshold( inArg ); } +PxReal getPxRigidDynamic_SleepThreshold( const PxRigidDynamic* inObj ) { return inObj->getSleepThreshold(); } +void setPxRigidDynamic_StabilizationThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setStabilizationThreshold( inArg ); } +PxReal getPxRigidDynamic_StabilizationThreshold( const PxRigidDynamic* inObj ) { return inObj->getStabilizationThreshold(); } +void setPxRigidDynamic_RigidDynamicLockFlags( PxRigidDynamic* inObj, PxRigidDynamicLockFlags inArg){ inObj->setRigidDynamicLockFlags( inArg ); } +PxRigidDynamicLockFlags getPxRigidDynamic_RigidDynamicLockFlags( const PxRigidDynamic* inObj ) { return inObj->getRigidDynamicLockFlags(); } +void setPxRigidDynamic_LinearVelocity( PxRigidDynamic* inObj, const PxVec3 & inArg){ inObj->setLinearVelocity( inArg ); } +PxVec3 getPxRigidDynamic_LinearVelocity( const PxRigidDynamic* inObj ) { return inObj->getLinearVelocity(); } +void setPxRigidDynamic_AngularVelocity( PxRigidDynamic* inObj, const PxVec3 & inArg){ inObj->setAngularVelocity( inArg ); } +PxVec3 getPxRigidDynamic_AngularVelocity( const PxRigidDynamic* inObj ) { return inObj->getAngularVelocity(); } +void setPxRigidDynamic_WakeCounter( PxRigidDynamic* inObj, PxReal inArg){ inObj->setWakeCounter( inArg ); } +PxReal getPxRigidDynamic_WakeCounter( const PxRigidDynamic* inObj ) { return inObj->getWakeCounter(); } +void setPxRigidDynamic_SolverIterationCounts( PxRigidDynamic* inObj, PxU32 inArg0, PxU32 inArg1 ) { inObj->setSolverIterationCounts( inArg0, inArg1 ); } +void getPxRigidDynamic_SolverIterationCounts( const PxRigidDynamic* inObj, PxU32& inArg0, PxU32& inArg1 ) { inObj->getSolverIterationCounts( inArg0, inArg1 ); } +void setPxRigidDynamic_ContactReportThreshold( PxRigidDynamic* inObj, PxReal inArg){ inObj->setContactReportThreshold( inArg ); } +PxReal getPxRigidDynamic_ContactReportThreshold( const PxRigidDynamic* inObj ) { return inObj->getContactReportThreshold(); } +const char * getPxRigidDynamic_ConcreteTypeName( const PxRigidDynamic* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxRigidDynamicGeneratedInfo::PxRigidDynamicGeneratedInfo() + : IsSleeping( "IsSleeping", getPxRigidDynamic_IsSleeping) + , SleepThreshold( "SleepThreshold", setPxRigidDynamic_SleepThreshold, getPxRigidDynamic_SleepThreshold) + , StabilizationThreshold( "StabilizationThreshold", setPxRigidDynamic_StabilizationThreshold, getPxRigidDynamic_StabilizationThreshold) + , RigidDynamicLockFlags( "RigidDynamicLockFlags", setPxRigidDynamic_RigidDynamicLockFlags, getPxRigidDynamic_RigidDynamicLockFlags) + , LinearVelocity( "LinearVelocity", setPxRigidDynamic_LinearVelocity, getPxRigidDynamic_LinearVelocity) + , AngularVelocity( "AngularVelocity", setPxRigidDynamic_AngularVelocity, getPxRigidDynamic_AngularVelocity) + , WakeCounter( "WakeCounter", setPxRigidDynamic_WakeCounter, getPxRigidDynamic_WakeCounter) + , SolverIterationCounts( "SolverIterationCounts", "minPositionIters", "minVelocityIters", setPxRigidDynamic_SolverIterationCounts, getPxRigidDynamic_SolverIterationCounts) + , ContactReportThreshold( "ContactReportThreshold", setPxRigidDynamic_ContactReportThreshold, getPxRigidDynamic_ContactReportThreshold) + , ConcreteTypeName( "ConcreteTypeName", getPxRigidDynamic_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxRigidDynamicGeneratedValues::PxRigidDynamicGeneratedValues( const PxRigidDynamic* inSource ) + :PxRigidBodyGeneratedValues( inSource ) + ,IsSleeping( getPxRigidDynamic_IsSleeping( inSource ) ) + ,SleepThreshold( getPxRigidDynamic_SleepThreshold( inSource ) ) + ,StabilizationThreshold( getPxRigidDynamic_StabilizationThreshold( inSource ) ) + ,RigidDynamicLockFlags( getPxRigidDynamic_RigidDynamicLockFlags( inSource ) ) + ,LinearVelocity( getPxRigidDynamic_LinearVelocity( inSource ) ) + ,AngularVelocity( getPxRigidDynamic_AngularVelocity( inSource ) ) + ,WakeCounter( getPxRigidDynamic_WakeCounter( inSource ) ) + ,ContactReportThreshold( getPxRigidDynamic_ContactReportThreshold( inSource ) ) + ,ConcreteTypeName( getPxRigidDynamic_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); + getPxRigidDynamic_SolverIterationCounts( inSource, SolverIterationCounts[0], SolverIterationCounts[1] ); +} +const char * getPxRigidStatic_ConcreteTypeName( const PxRigidStatic* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxRigidStaticGeneratedInfo::PxRigidStaticGeneratedInfo() + : ConcreteTypeName( "ConcreteTypeName", getPxRigidStatic_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxRigidStaticGeneratedValues::PxRigidStaticGeneratedValues( const PxRigidStatic* inSource ) + :PxRigidActorGeneratedValues( inSource ) + ,ConcreteTypeName( getPxRigidStatic_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxArticulationJointReducedCoordinate * getPxArticulationLink_InboundJoint( const PxArticulationLink* inObj ) { return inObj->getInboundJoint(); } +PxU32 getPxArticulationLink_InboundJointDof( const PxArticulationLink* inObj ) { return inObj->getInboundJointDof(); } +PxU32 getPxArticulationLink_LinkIndex( const PxArticulationLink* inObj ) { return inObj->getLinkIndex(); } +PxU32 getPxArticulationLink_Children( const PxArticulationLink* inObj, PxArticulationLink ** outBuffer, PxU32 inBufSize ) { return inObj->getChildren( outBuffer, inBufSize ); } +PxU32 getNbPxArticulationLink_Children( const PxArticulationLink* inObj ) { return inObj->getNbChildren( ); } +void setPxArticulationLink_CfmScale( PxArticulationLink* inObj, const PxReal inArg){ inObj->setCfmScale( inArg ); } +PxReal getPxArticulationLink_CfmScale( const PxArticulationLink* inObj ) { return inObj->getCfmScale(); } +PxVec3 getPxArticulationLink_LinearVelocity( const PxArticulationLink* inObj ) { return inObj->getLinearVelocity(); } +PxVec3 getPxArticulationLink_AngularVelocity( const PxArticulationLink* inObj ) { return inObj->getAngularVelocity(); } +const char * getPxArticulationLink_ConcreteTypeName( const PxArticulationLink* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxArticulationLinkGeneratedInfo::PxArticulationLinkGeneratedInfo() + : InboundJoint( "InboundJoint", getPxArticulationLink_InboundJoint) + , InboundJointDof( "InboundJointDof", getPxArticulationLink_InboundJointDof) + , LinkIndex( "LinkIndex", getPxArticulationLink_LinkIndex) + , Children( "Children", getPxArticulationLink_Children, getNbPxArticulationLink_Children ) + , CfmScale( "CfmScale", setPxArticulationLink_CfmScale, getPxArticulationLink_CfmScale) + , LinearVelocity( "LinearVelocity", getPxArticulationLink_LinearVelocity) + , AngularVelocity( "AngularVelocity", getPxArticulationLink_AngularVelocity) + , ConcreteTypeName( "ConcreteTypeName", getPxArticulationLink_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxArticulationLinkGeneratedValues::PxArticulationLinkGeneratedValues( const PxArticulationLink* inSource ) + :PxRigidBodyGeneratedValues( inSource ) + ,InboundJoint( getPxArticulationLink_InboundJoint( inSource ) ) + ,InboundJointDof( getPxArticulationLink_InboundJointDof( inSource ) ) + ,LinkIndex( getPxArticulationLink_LinkIndex( inSource ) ) + ,CfmScale( getPxArticulationLink_CfmScale( inSource ) ) + ,LinearVelocity( getPxArticulationLink_LinearVelocity( inSource ) ) + ,AngularVelocity( getPxArticulationLink_AngularVelocity( inSource ) ) + ,ConcreteTypeName( getPxArticulationLink_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxArticulationJointReducedCoordinate_ParentPose( PxArticulationJointReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setParentPose( inArg ); } +PxTransform getPxArticulationJointReducedCoordinate_ParentPose( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getParentPose(); } +void setPxArticulationJointReducedCoordinate_ChildPose( PxArticulationJointReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setChildPose( inArg ); } +PxTransform getPxArticulationJointReducedCoordinate_ChildPose( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getChildPose(); } +void setPxArticulationJointReducedCoordinate_JointType( PxArticulationJointReducedCoordinate* inObj, PxArticulationJointType::Enum inArg){ inObj->setJointType( inArg ); } +PxArticulationJointType::Enum getPxArticulationJointReducedCoordinate_JointType( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getJointType(); } +void setPxArticulationJointReducedCoordinate_Motion( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationMotion::Enum inArg ){ inObj->setMotion( inIndex, inArg ); } +PxArticulationMotion::Enum getPxArticulationJointReducedCoordinate_Motion( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getMotion( inIndex ); } +void setPxArticulationJointReducedCoordinate_LimitParams( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationLimit inArg ){ inObj->setLimitParams( inIndex, inArg ); } +PxArticulationLimit getPxArticulationJointReducedCoordinate_LimitParams( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getLimitParams( inIndex ); } +void setPxArticulationJointReducedCoordinate_DriveParams( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxArticulationDrive inArg ){ inObj->setDriveParams( inIndex, inArg ); } +PxArticulationDrive getPxArticulationJointReducedCoordinate_DriveParams( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getDriveParams( inIndex ); } +void setPxArticulationJointReducedCoordinate_Armature( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setArmature( inIndex, inArg ); } +PxReal getPxArticulationJointReducedCoordinate_Armature( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getArmature( inIndex ); } +void setPxArticulationJointReducedCoordinate_FrictionCoefficient( PxArticulationJointReducedCoordinate* inObj, const PxReal inArg){ inObj->setFrictionCoefficient( inArg ); } +PxReal getPxArticulationJointReducedCoordinate_FrictionCoefficient( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getFrictionCoefficient(); } +void setPxArticulationJointReducedCoordinate_MaxJointVelocity( PxArticulationJointReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxJointVelocity( inArg ); } +PxReal getPxArticulationJointReducedCoordinate_MaxJointVelocity( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getMaxJointVelocity(); } +void setPxArticulationJointReducedCoordinate_JointPosition( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setJointPosition( inIndex, inArg ); } +PxReal getPxArticulationJointReducedCoordinate_JointPosition( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getJointPosition( inIndex ); } +void setPxArticulationJointReducedCoordinate_JointVelocity( PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex, PxReal inArg ){ inObj->setJointVelocity( inIndex, inArg ); } +PxReal getPxArticulationJointReducedCoordinate_JointVelocity( const PxArticulationJointReducedCoordinate* inObj, PxArticulationAxis::Enum inIndex ) { return inObj->getJointVelocity( inIndex ); } +const char * getPxArticulationJointReducedCoordinate_ConcreteTypeName( const PxArticulationJointReducedCoordinate* inObj ) { return inObj->getConcreteTypeName(); } +inline void * getPxArticulationJointReducedCoordinateUserData( const PxArticulationJointReducedCoordinate* inOwner ) { return inOwner->userData; } +inline void setPxArticulationJointReducedCoordinateUserData( PxArticulationJointReducedCoordinate* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedInfo::PxArticulationJointReducedCoordinateGeneratedInfo() + : ParentPose( "ParentPose", setPxArticulationJointReducedCoordinate_ParentPose, getPxArticulationJointReducedCoordinate_ParentPose) + , ChildPose( "ChildPose", setPxArticulationJointReducedCoordinate_ChildPose, getPxArticulationJointReducedCoordinate_ChildPose) + , JointType( "JointType", setPxArticulationJointReducedCoordinate_JointType, getPxArticulationJointReducedCoordinate_JointType) + , Motion( "Motion", setPxArticulationJointReducedCoordinate_Motion, getPxArticulationJointReducedCoordinate_Motion) + , LimitParams( "LimitParams", setPxArticulationJointReducedCoordinate_LimitParams, getPxArticulationJointReducedCoordinate_LimitParams) + , DriveParams( "DriveParams", setPxArticulationJointReducedCoordinate_DriveParams, getPxArticulationJointReducedCoordinate_DriveParams) + , Armature( "Armature", setPxArticulationJointReducedCoordinate_Armature, getPxArticulationJointReducedCoordinate_Armature) + , FrictionCoefficient( "FrictionCoefficient", setPxArticulationJointReducedCoordinate_FrictionCoefficient, getPxArticulationJointReducedCoordinate_FrictionCoefficient) + , MaxJointVelocity( "MaxJointVelocity", setPxArticulationJointReducedCoordinate_MaxJointVelocity, getPxArticulationJointReducedCoordinate_MaxJointVelocity) + , JointPosition( "JointPosition", setPxArticulationJointReducedCoordinate_JointPosition, getPxArticulationJointReducedCoordinate_JointPosition) + , JointVelocity( "JointVelocity", setPxArticulationJointReducedCoordinate_JointVelocity, getPxArticulationJointReducedCoordinate_JointVelocity) + , ConcreteTypeName( "ConcreteTypeName", getPxArticulationJointReducedCoordinate_ConcreteTypeName) + , UserData( "UserData", setPxArticulationJointReducedCoordinateUserData, getPxArticulationJointReducedCoordinateUserData ) +{} +PX_PHYSX_CORE_API PxArticulationJointReducedCoordinateGeneratedValues::PxArticulationJointReducedCoordinateGeneratedValues( const PxArticulationJointReducedCoordinate* inSource ) + :ParentPose( getPxArticulationJointReducedCoordinate_ParentPose( inSource ) ) + ,ChildPose( getPxArticulationJointReducedCoordinate_ChildPose( inSource ) ) + ,JointType( getPxArticulationJointReducedCoordinate_JointType( inSource ) ) + ,FrictionCoefficient( getPxArticulationJointReducedCoordinate_FrictionCoefficient( inSource ) ) + ,MaxJointVelocity( getPxArticulationJointReducedCoordinate_MaxJointVelocity( inSource ) ) + ,ConcreteTypeName( getPxArticulationJointReducedCoordinate_ConcreteTypeName( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + Motion[idx] = getPxArticulationJointReducedCoordinate_Motion( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + LimitParams[idx] = getPxArticulationJointReducedCoordinate_LimitParams( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + DriveParams[idx] = getPxArticulationJointReducedCoordinate_DriveParams( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + Armature[idx] = getPxArticulationJointReducedCoordinate_Armature( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + JointPosition[idx] = getPxArticulationJointReducedCoordinate_JointPosition( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxArticulationAxis::eCOUNT ); ++idx ) + JointVelocity[idx] = getPxArticulationJointReducedCoordinate_JointVelocity( inSource, static_cast< PxArticulationAxis::Enum >( idx ) ); +} +PxScene * getPxArticulationReducedCoordinate_Scene( const PxArticulationReducedCoordinate* inObj ) { return inObj->getScene(); } +void setPxArticulationReducedCoordinate_SolverIterationCounts( PxArticulationReducedCoordinate* inObj, PxU32 inArg0, PxU32 inArg1 ) { inObj->setSolverIterationCounts( inArg0, inArg1 ); } +void getPxArticulationReducedCoordinate_SolverIterationCounts( const PxArticulationReducedCoordinate* inObj, PxU32& inArg0, PxU32& inArg1 ) { inObj->getSolverIterationCounts( inArg0, inArg1 ); } +_Bool getPxArticulationReducedCoordinate_IsSleeping( const PxArticulationReducedCoordinate* inObj ) { return inObj->isSleeping(); } +void setPxArticulationReducedCoordinate_SleepThreshold( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setSleepThreshold( inArg ); } +PxReal getPxArticulationReducedCoordinate_SleepThreshold( const PxArticulationReducedCoordinate* inObj ) { return inObj->getSleepThreshold(); } +void setPxArticulationReducedCoordinate_StabilizationThreshold( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setStabilizationThreshold( inArg ); } +PxReal getPxArticulationReducedCoordinate_StabilizationThreshold( const PxArticulationReducedCoordinate* inObj ) { return inObj->getStabilizationThreshold(); } +void setPxArticulationReducedCoordinate_WakeCounter( PxArticulationReducedCoordinate* inObj, PxReal inArg){ inObj->setWakeCounter( inArg ); } +PxReal getPxArticulationReducedCoordinate_WakeCounter( const PxArticulationReducedCoordinate* inObj ) { return inObj->getWakeCounter(); } +void setPxArticulationReducedCoordinate_MaxCOMLinearVelocity( PxArticulationReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxCOMLinearVelocity( inArg ); } +PxReal getPxArticulationReducedCoordinate_MaxCOMLinearVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getMaxCOMLinearVelocity(); } +void setPxArticulationReducedCoordinate_MaxCOMAngularVelocity( PxArticulationReducedCoordinate* inObj, const PxReal inArg){ inObj->setMaxCOMAngularVelocity( inArg ); } +PxReal getPxArticulationReducedCoordinate_MaxCOMAngularVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getMaxCOMAngularVelocity(); } +PxU32 getPxArticulationReducedCoordinate_Links( const PxArticulationReducedCoordinate* inObj, PxArticulationLink ** outBuffer, PxU32 inBufSize ) { return inObj->getLinks( outBuffer, inBufSize ); } +PxU32 getNbPxArticulationReducedCoordinate_Links( const PxArticulationReducedCoordinate* inObj ) { return inObj->getNbLinks( ); } +void setPxArticulationReducedCoordinate_Name( PxArticulationReducedCoordinate* inObj, const char * inArg){ inObj->setName( inArg ); } +const char * getPxArticulationReducedCoordinate_Name( const PxArticulationReducedCoordinate* inObj ) { return inObj->getName(); } +PxAggregate * getPxArticulationReducedCoordinate_Aggregate( const PxArticulationReducedCoordinate* inObj ) { return inObj->getAggregate(); } +void setPxArticulationReducedCoordinate_ArticulationFlags( PxArticulationReducedCoordinate* inObj, PxArticulationFlags inArg){ inObj->setArticulationFlags( inArg ); } +PxArticulationFlags getPxArticulationReducedCoordinate_ArticulationFlags( const PxArticulationReducedCoordinate* inObj ) { return inObj->getArticulationFlags(); } +void setPxArticulationReducedCoordinate_RootGlobalPose( PxArticulationReducedCoordinate* inObj, const PxTransform & inArg){ inObj->setRootGlobalPose( inArg ); } +PxTransform getPxArticulationReducedCoordinate_RootGlobalPose( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootGlobalPose(); } +void setPxArticulationReducedCoordinate_RootLinearVelocity( PxArticulationReducedCoordinate* inObj, const PxVec3 & inArg){ inObj->setRootLinearVelocity( inArg ); } +PxVec3 getPxArticulationReducedCoordinate_RootLinearVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootLinearVelocity(); } +void setPxArticulationReducedCoordinate_RootAngularVelocity( PxArticulationReducedCoordinate* inObj, const PxVec3 & inArg){ inObj->setRootAngularVelocity( inArg ); } +PxVec3 getPxArticulationReducedCoordinate_RootAngularVelocity( const PxArticulationReducedCoordinate* inObj ) { return inObj->getRootAngularVelocity(); } +inline void * getPxArticulationReducedCoordinateUserData( const PxArticulationReducedCoordinate* inOwner ) { return inOwner->userData; } +inline void setPxArticulationReducedCoordinateUserData( PxArticulationReducedCoordinate* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedInfo::PxArticulationReducedCoordinateGeneratedInfo() + : Scene( "Scene", getPxArticulationReducedCoordinate_Scene) + , SolverIterationCounts( "SolverIterationCounts", "minPositionIters", "minVelocityIters", setPxArticulationReducedCoordinate_SolverIterationCounts, getPxArticulationReducedCoordinate_SolverIterationCounts) + , IsSleeping( "IsSleeping", getPxArticulationReducedCoordinate_IsSleeping) + , SleepThreshold( "SleepThreshold", setPxArticulationReducedCoordinate_SleepThreshold, getPxArticulationReducedCoordinate_SleepThreshold) + , StabilizationThreshold( "StabilizationThreshold", setPxArticulationReducedCoordinate_StabilizationThreshold, getPxArticulationReducedCoordinate_StabilizationThreshold) + , WakeCounter( "WakeCounter", setPxArticulationReducedCoordinate_WakeCounter, getPxArticulationReducedCoordinate_WakeCounter) + , MaxCOMLinearVelocity( "MaxCOMLinearVelocity", setPxArticulationReducedCoordinate_MaxCOMLinearVelocity, getPxArticulationReducedCoordinate_MaxCOMLinearVelocity) + , MaxCOMAngularVelocity( "MaxCOMAngularVelocity", setPxArticulationReducedCoordinate_MaxCOMAngularVelocity, getPxArticulationReducedCoordinate_MaxCOMAngularVelocity) + , Links( "Links", getPxArticulationReducedCoordinate_Links, getNbPxArticulationReducedCoordinate_Links ) + , Name( "Name", setPxArticulationReducedCoordinate_Name, getPxArticulationReducedCoordinate_Name) + , Aggregate( "Aggregate", getPxArticulationReducedCoordinate_Aggregate) + , ArticulationFlags( "ArticulationFlags", setPxArticulationReducedCoordinate_ArticulationFlags, getPxArticulationReducedCoordinate_ArticulationFlags) + , RootGlobalPose( "RootGlobalPose", setPxArticulationReducedCoordinate_RootGlobalPose, getPxArticulationReducedCoordinate_RootGlobalPose) + , RootLinearVelocity( "RootLinearVelocity", setPxArticulationReducedCoordinate_RootLinearVelocity, getPxArticulationReducedCoordinate_RootLinearVelocity) + , RootAngularVelocity( "RootAngularVelocity", setPxArticulationReducedCoordinate_RootAngularVelocity, getPxArticulationReducedCoordinate_RootAngularVelocity) + , UserData( "UserData", setPxArticulationReducedCoordinateUserData, getPxArticulationReducedCoordinateUserData ) +{} +PX_PHYSX_CORE_API PxArticulationReducedCoordinateGeneratedValues::PxArticulationReducedCoordinateGeneratedValues( const PxArticulationReducedCoordinate* inSource ) + :Scene( getPxArticulationReducedCoordinate_Scene( inSource ) ) + ,IsSleeping( getPxArticulationReducedCoordinate_IsSleeping( inSource ) ) + ,SleepThreshold( getPxArticulationReducedCoordinate_SleepThreshold( inSource ) ) + ,StabilizationThreshold( getPxArticulationReducedCoordinate_StabilizationThreshold( inSource ) ) + ,WakeCounter( getPxArticulationReducedCoordinate_WakeCounter( inSource ) ) + ,MaxCOMLinearVelocity( getPxArticulationReducedCoordinate_MaxCOMLinearVelocity( inSource ) ) + ,MaxCOMAngularVelocity( getPxArticulationReducedCoordinate_MaxCOMAngularVelocity( inSource ) ) + ,Name( getPxArticulationReducedCoordinate_Name( inSource ) ) + ,Aggregate( getPxArticulationReducedCoordinate_Aggregate( inSource ) ) + ,ArticulationFlags( getPxArticulationReducedCoordinate_ArticulationFlags( inSource ) ) + ,RootGlobalPose( getPxArticulationReducedCoordinate_RootGlobalPose( inSource ) ) + ,RootLinearVelocity( getPxArticulationReducedCoordinate_RootLinearVelocity( inSource ) ) + ,RootAngularVelocity( getPxArticulationReducedCoordinate_RootAngularVelocity( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + getPxArticulationReducedCoordinate_SolverIterationCounts( inSource, SolverIterationCounts[0], SolverIterationCounts[1] ); +} +PxU32 getPxAggregate_MaxNbActors( const PxAggregate* inObj ) { return inObj->getMaxNbActors(); } +PxU32 getPxAggregate_MaxNbShapes( const PxAggregate* inObj ) { return inObj->getMaxNbShapes(); } +PxU32 getPxAggregate_Actors( const PxAggregate* inObj, PxActor ** outBuffer, PxU32 inBufSize ) { return inObj->getActors( outBuffer, inBufSize ); } +PxU32 getNbPxAggregate_Actors( const PxAggregate* inObj ) { return inObj->getNbActors( ); } +_Bool getPxAggregate_SelfCollision( const PxAggregate* inObj ) { return inObj->getSelfCollision(); } +const char * getPxAggregate_ConcreteTypeName( const PxAggregate* inObj ) { return inObj->getConcreteTypeName(); } +inline void * getPxAggregateUserData( const PxAggregate* inOwner ) { return inOwner->userData; } +inline void setPxAggregateUserData( PxAggregate* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxAggregateGeneratedInfo::PxAggregateGeneratedInfo() + : MaxNbActors( "MaxNbActors", getPxAggregate_MaxNbActors) + , MaxNbShapes( "MaxNbShapes", getPxAggregate_MaxNbShapes) + , Actors( "Actors", getPxAggregate_Actors, getNbPxAggregate_Actors ) + , SelfCollision( "SelfCollision", getPxAggregate_SelfCollision) + , ConcreteTypeName( "ConcreteTypeName", getPxAggregate_ConcreteTypeName) + , UserData( "UserData", setPxAggregateUserData, getPxAggregateUserData ) +{} +PX_PHYSX_CORE_API PxAggregateGeneratedValues::PxAggregateGeneratedValues( const PxAggregate* inSource ) + :MaxNbActors( getPxAggregate_MaxNbActors( inSource ) ) + ,MaxNbShapes( getPxAggregate_MaxNbShapes( inSource ) ) + ,SelfCollision( getPxAggregate_SelfCollision( inSource ) ) + ,ConcreteTypeName( getPxAggregate_ConcreteTypeName( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); +} +PxScene * getPxConstraint_Scene( const PxConstraint* inObj ) { return inObj->getScene(); } +void setPxConstraint_Actors( PxConstraint* inObj, PxRigidActor * inArg0, PxRigidActor * inArg1 ) { inObj->setActors( inArg0, inArg1 ); } +void getPxConstraint_Actors( const PxConstraint* inObj, PxRigidActor *& inArg0, PxRigidActor *& inArg1 ) { inObj->getActors( inArg0, inArg1 ); } +void setPxConstraint_Flags( PxConstraint* inObj, PxConstraintFlags inArg){ inObj->setFlags( inArg ); } +PxConstraintFlags getPxConstraint_Flags( const PxConstraint* inObj ) { return inObj->getFlags(); } +_Bool getPxConstraint_IsValid( const PxConstraint* inObj ) { return inObj->isValid(); } +void setPxConstraint_BreakForce( PxConstraint* inObj, PxReal inArg0, PxReal inArg1 ) { inObj->setBreakForce( inArg0, inArg1 ); } +void getPxConstraint_BreakForce( const PxConstraint* inObj, PxReal& inArg0, PxReal& inArg1 ) { inObj->getBreakForce( inArg0, inArg1 ); } +void setPxConstraint_MinResponseThreshold( PxConstraint* inObj, PxReal inArg){ inObj->setMinResponseThreshold( inArg ); } +PxReal getPxConstraint_MinResponseThreshold( const PxConstraint* inObj ) { return inObj->getMinResponseThreshold(); } +const char * getPxConstraint_ConcreteTypeName( const PxConstraint* inObj ) { return inObj->getConcreteTypeName(); } +inline void * getPxConstraintUserData( const PxConstraint* inOwner ) { return inOwner->userData; } +inline void setPxConstraintUserData( PxConstraint* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxConstraintGeneratedInfo::PxConstraintGeneratedInfo() + : Scene( "Scene", getPxConstraint_Scene) + , Actors( "Actors", "actor0", "actor1", setPxConstraint_Actors, getPxConstraint_Actors) + , Flags( "Flags", setPxConstraint_Flags, getPxConstraint_Flags) + , IsValid( "IsValid", getPxConstraint_IsValid) + , BreakForce( "BreakForce", "linear", "angular", setPxConstraint_BreakForce, getPxConstraint_BreakForce) + , MinResponseThreshold( "MinResponseThreshold", setPxConstraint_MinResponseThreshold, getPxConstraint_MinResponseThreshold) + , ConcreteTypeName( "ConcreteTypeName", getPxConstraint_ConcreteTypeName) + , UserData( "UserData", setPxConstraintUserData, getPxConstraintUserData ) +{} +PX_PHYSX_CORE_API PxConstraintGeneratedValues::PxConstraintGeneratedValues( const PxConstraint* inSource ) + :Scene( getPxConstraint_Scene( inSource ) ) + ,Flags( getPxConstraint_Flags( inSource ) ) + ,IsValid( getPxConstraint_IsValid( inSource ) ) + ,MinResponseThreshold( getPxConstraint_MinResponseThreshold( inSource ) ) + ,ConcreteTypeName( getPxConstraint_ConcreteTypeName( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + getPxConstraint_Actors( inSource, Actors[0], Actors[1] ); + getPxConstraint_BreakForce( inSource, BreakForce[0], BreakForce[1] ); +} +PxGeometryType::Enum getPxShape_GeometryType( const PxShape* inObj ) { return inObj->getGeometryType(); } +void setPxShape_LocalPose( PxShape* inObj, const PxTransform & inArg){ inObj->setLocalPose( inArg ); } +PxTransform getPxShape_LocalPose( const PxShape* inObj ) { return inObj->getLocalPose(); } +void setPxShape_SimulationFilterData( PxShape* inObj, const PxFilterData & inArg){ inObj->setSimulationFilterData( inArg ); } +PxFilterData getPxShape_SimulationFilterData( const PxShape* inObj ) { return inObj->getSimulationFilterData(); } +void setPxShape_QueryFilterData( PxShape* inObj, const PxFilterData & inArg){ inObj->setQueryFilterData( inArg ); } +PxFilterData getPxShape_QueryFilterData( const PxShape* inObj ) { return inObj->getQueryFilterData(); } +PxU32 getPxShape_Materials( const PxShape* inObj, PxMaterial ** outBuffer, PxU32 inBufSize ) { return inObj->getMaterials( outBuffer, inBufSize ); } +PxU32 getNbPxShape_Materials( const PxShape* inObj ) { return inObj->getNbMaterials( ); } +void setPxShape_ContactOffset( PxShape* inObj, PxReal inArg){ inObj->setContactOffset( inArg ); } +PxReal getPxShape_ContactOffset( const PxShape* inObj ) { return inObj->getContactOffset(); } +void setPxShape_RestOffset( PxShape* inObj, PxReal inArg){ inObj->setRestOffset( inArg ); } +PxReal getPxShape_RestOffset( const PxShape* inObj ) { return inObj->getRestOffset(); } +void setPxShape_DensityForFluid( PxShape* inObj, PxReal inArg){ inObj->setDensityForFluid( inArg ); } +PxReal getPxShape_DensityForFluid( const PxShape* inObj ) { return inObj->getDensityForFluid(); } +void setPxShape_TorsionalPatchRadius( PxShape* inObj, PxReal inArg){ inObj->setTorsionalPatchRadius( inArg ); } +PxReal getPxShape_TorsionalPatchRadius( const PxShape* inObj ) { return inObj->getTorsionalPatchRadius(); } +void setPxShape_MinTorsionalPatchRadius( PxShape* inObj, PxReal inArg){ inObj->setMinTorsionalPatchRadius( inArg ); } +PxReal getPxShape_MinTorsionalPatchRadius( const PxShape* inObj ) { return inObj->getMinTorsionalPatchRadius(); } +void setPxShape_Flags( PxShape* inObj, PxShapeFlags inArg){ inObj->setFlags( inArg ); } +PxShapeFlags getPxShape_Flags( const PxShape* inObj ) { return inObj->getFlags(); } +_Bool getPxShape_IsExclusive( const PxShape* inObj ) { return inObj->isExclusive(); } +void setPxShape_Name( PxShape* inObj, const char * inArg){ inObj->setName( inArg ); } +const char * getPxShape_Name( const PxShape* inObj ) { return inObj->getName(); } +const char * getPxShape_ConcreteTypeName( const PxShape* inObj ) { return inObj->getConcreteTypeName(); } +inline void * getPxShapeUserData( const PxShape* inOwner ) { return inOwner->userData; } +inline void setPxShapeUserData( PxShape* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxShapeGeneratedInfo::PxShapeGeneratedInfo() + : GeometryType( "GeometryType", getPxShape_GeometryType) + , LocalPose( "LocalPose", setPxShape_LocalPose, getPxShape_LocalPose) + , SimulationFilterData( "SimulationFilterData", setPxShape_SimulationFilterData, getPxShape_SimulationFilterData) + , QueryFilterData( "QueryFilterData", setPxShape_QueryFilterData, getPxShape_QueryFilterData) + , Materials( "Materials", getPxShape_Materials, getNbPxShape_Materials ) + , ContactOffset( "ContactOffset", setPxShape_ContactOffset, getPxShape_ContactOffset) + , RestOffset( "RestOffset", setPxShape_RestOffset, getPxShape_RestOffset) + , DensityForFluid( "DensityForFluid", setPxShape_DensityForFluid, getPxShape_DensityForFluid) + , TorsionalPatchRadius( "TorsionalPatchRadius", setPxShape_TorsionalPatchRadius, getPxShape_TorsionalPatchRadius) + , MinTorsionalPatchRadius( "MinTorsionalPatchRadius", setPxShape_MinTorsionalPatchRadius, getPxShape_MinTorsionalPatchRadius) + , Flags( "Flags", setPxShape_Flags, getPxShape_Flags) + , IsExclusive( "IsExclusive", getPxShape_IsExclusive) + , Name( "Name", setPxShape_Name, getPxShape_Name) + , ConcreteTypeName( "ConcreteTypeName", getPxShape_ConcreteTypeName) + , UserData( "UserData", setPxShapeUserData, getPxShapeUserData ) +{} +PX_PHYSX_CORE_API PxShapeGeneratedValues::PxShapeGeneratedValues( const PxShape* inSource ) + :PxRefCountedGeneratedValues( inSource ) + ,GeometryType( getPxShape_GeometryType( inSource ) ) + ,LocalPose( getPxShape_LocalPose( inSource ) ) + ,SimulationFilterData( getPxShape_SimulationFilterData( inSource ) ) + ,QueryFilterData( getPxShape_QueryFilterData( inSource ) ) + ,ContactOffset( getPxShape_ContactOffset( inSource ) ) + ,RestOffset( getPxShape_RestOffset( inSource ) ) + ,DensityForFluid( getPxShape_DensityForFluid( inSource ) ) + ,TorsionalPatchRadius( getPxShape_TorsionalPatchRadius( inSource ) ) + ,MinTorsionalPatchRadius( getPxShape_MinTorsionalPatchRadius( inSource ) ) + ,Flags( getPxShape_Flags( inSource ) ) + ,IsExclusive( getPxShape_IsExclusive( inSource ) ) + ,Name( getPxShape_Name( inSource ) ) + ,ConcreteTypeName( getPxShape_ConcreteTypeName( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + Geom = PxGeometryHolder(inSource->getGeometry()); +} +PxU32 getPxPruningStructure_RigidActors( const PxPruningStructure* inObj, PxRigidActor ** outBuffer, PxU32 inBufSize ) { return inObj->getRigidActors( outBuffer, inBufSize ); } +PxU32 getNbPxPruningStructure_RigidActors( const PxPruningStructure* inObj ) { return inObj->getNbRigidActors( ); } +const void * getPxPruningStructure_StaticMergeData( const PxPruningStructure* inObj ) { return inObj->getStaticMergeData(); } +const void * getPxPruningStructure_DynamicMergeData( const PxPruningStructure* inObj ) { return inObj->getDynamicMergeData(); } +const char * getPxPruningStructure_ConcreteTypeName( const PxPruningStructure* inObj ) { return inObj->getConcreteTypeName(); } +PX_PHYSX_CORE_API PxPruningStructureGeneratedInfo::PxPruningStructureGeneratedInfo() + : RigidActors( "RigidActors", getPxPruningStructure_RigidActors, getNbPxPruningStructure_RigidActors ) + , StaticMergeData( "StaticMergeData", getPxPruningStructure_StaticMergeData) + , DynamicMergeData( "DynamicMergeData", getPxPruningStructure_DynamicMergeData) + , ConcreteTypeName( "ConcreteTypeName", getPxPruningStructure_ConcreteTypeName) +{} +PX_PHYSX_CORE_API PxPruningStructureGeneratedValues::PxPruningStructureGeneratedValues( const PxPruningStructure* inSource ) + :StaticMergeData( getPxPruningStructure_StaticMergeData( inSource ) ) + ,DynamicMergeData( getPxPruningStructure_DynamicMergeData( inSource ) ) + ,ConcreteTypeName( getPxPruningStructure_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +_Bool getPxTolerancesScale_IsValid( const PxTolerancesScale* inObj ) { return inObj->isValid(); } +inline PxReal getPxTolerancesScaleLength( const PxTolerancesScale* inOwner ) { return inOwner->length; } +inline void setPxTolerancesScaleLength( PxTolerancesScale* inOwner, PxReal inData) { inOwner->length = inData; } +inline PxReal getPxTolerancesScaleSpeed( const PxTolerancesScale* inOwner ) { return inOwner->speed; } +inline void setPxTolerancesScaleSpeed( PxTolerancesScale* inOwner, PxReal inData) { inOwner->speed = inData; } +PX_PHYSX_CORE_API PxTolerancesScaleGeneratedInfo::PxTolerancesScaleGeneratedInfo() + : IsValid( "IsValid", getPxTolerancesScale_IsValid) + , Length( "Length", setPxTolerancesScaleLength, getPxTolerancesScaleLength ) + , Speed( "Speed", setPxTolerancesScaleSpeed, getPxTolerancesScaleSpeed ) +{} +PX_PHYSX_CORE_API PxTolerancesScaleGeneratedValues::PxTolerancesScaleGeneratedValues( const PxTolerancesScale* inSource ) + :IsValid( getPxTolerancesScale_IsValid( inSource ) ) + ,Length( inSource->length ) + ,Speed( inSource->speed ) +{ + PX_UNUSED(inSource); +} +PX_PHYSX_CORE_API PxGeometryGeneratedInfo::PxGeometryGeneratedInfo() +{} +PX_PHYSX_CORE_API PxGeometryGeneratedValues::PxGeometryGeneratedValues( const PxGeometry* inSource ) +{ + PX_UNUSED(inSource); +} +inline PxVec3 getPxBoxGeometryHalfExtents( const PxBoxGeometry* inOwner ) { return inOwner->halfExtents; } +inline void setPxBoxGeometryHalfExtents( PxBoxGeometry* inOwner, PxVec3 inData) { inOwner->halfExtents = inData; } +PX_PHYSX_CORE_API PxBoxGeometryGeneratedInfo::PxBoxGeometryGeneratedInfo() + : HalfExtents( "HalfExtents", setPxBoxGeometryHalfExtents, getPxBoxGeometryHalfExtents ) +{} +PX_PHYSX_CORE_API PxBoxGeometryGeneratedValues::PxBoxGeometryGeneratedValues( const PxBoxGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,HalfExtents( inSource->halfExtents ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxCapsuleGeometryRadius( const PxCapsuleGeometry* inOwner ) { return inOwner->radius; } +inline void setPxCapsuleGeometryRadius( PxCapsuleGeometry* inOwner, PxReal inData) { inOwner->radius = inData; } +inline PxReal getPxCapsuleGeometryHalfHeight( const PxCapsuleGeometry* inOwner ) { return inOwner->halfHeight; } +inline void setPxCapsuleGeometryHalfHeight( PxCapsuleGeometry* inOwner, PxReal inData) { inOwner->halfHeight = inData; } +PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedInfo::PxCapsuleGeometryGeneratedInfo() + : Radius( "Radius", setPxCapsuleGeometryRadius, getPxCapsuleGeometryRadius ) + , HalfHeight( "HalfHeight", setPxCapsuleGeometryHalfHeight, getPxCapsuleGeometryHalfHeight ) +{} +PX_PHYSX_CORE_API PxCapsuleGeometryGeneratedValues::PxCapsuleGeometryGeneratedValues( const PxCapsuleGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,Radius( inSource->radius ) + ,HalfHeight( inSource->halfHeight ) +{ + PX_UNUSED(inSource); +} +inline PxVec3 getPxMeshScaleScale( const PxMeshScale* inOwner ) { return inOwner->scale; } +inline void setPxMeshScaleScale( PxMeshScale* inOwner, PxVec3 inData) { inOwner->scale = inData; } +inline PxQuat getPxMeshScaleRotation( const PxMeshScale* inOwner ) { return inOwner->rotation; } +inline void setPxMeshScaleRotation( PxMeshScale* inOwner, PxQuat inData) { inOwner->rotation = inData; } +PX_PHYSX_CORE_API PxMeshScaleGeneratedInfo::PxMeshScaleGeneratedInfo() + : Scale( "Scale", setPxMeshScaleScale, getPxMeshScaleScale ) + , Rotation( "Rotation", setPxMeshScaleRotation, getPxMeshScaleRotation ) +{} +PX_PHYSX_CORE_API PxMeshScaleGeneratedValues::PxMeshScaleGeneratedValues( const PxMeshScale* inSource ) + :Scale( inSource->scale ) + ,Rotation( inSource->rotation ) +{ + PX_UNUSED(inSource); +} +inline PxMeshScale getPxConvexMeshGeometryScale( const PxConvexMeshGeometry* inOwner ) { return inOwner->scale; } +inline void setPxConvexMeshGeometryScale( PxConvexMeshGeometry* inOwner, PxMeshScale inData) { inOwner->scale = inData; } +inline PxConvexMesh * getPxConvexMeshGeometryConvexMesh( const PxConvexMeshGeometry* inOwner ) { return inOwner->convexMesh; } +inline void setPxConvexMeshGeometryConvexMesh( PxConvexMeshGeometry* inOwner, PxConvexMesh * inData) { inOwner->convexMesh = inData; } +inline PxConvexMeshGeometryFlags getPxConvexMeshGeometryMeshFlags( const PxConvexMeshGeometry* inOwner ) { return inOwner->meshFlags; } +inline void setPxConvexMeshGeometryMeshFlags( PxConvexMeshGeometry* inOwner, PxConvexMeshGeometryFlags inData) { inOwner->meshFlags = inData; } +PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedInfo::PxConvexMeshGeometryGeneratedInfo() + : Scale( "Scale", setPxConvexMeshGeometryScale, getPxConvexMeshGeometryScale ) + , ConvexMesh( "ConvexMesh", setPxConvexMeshGeometryConvexMesh, getPxConvexMeshGeometryConvexMesh ) + , MeshFlags( "MeshFlags", setPxConvexMeshGeometryMeshFlags, getPxConvexMeshGeometryMeshFlags ) +{} +PX_PHYSX_CORE_API PxConvexMeshGeometryGeneratedValues::PxConvexMeshGeometryGeneratedValues( const PxConvexMeshGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,Scale( inSource->scale ) + ,ConvexMesh( inSource->convexMesh ) + ,MeshFlags( inSource->meshFlags ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxSphereGeometryRadius( const PxSphereGeometry* inOwner ) { return inOwner->radius; } +inline void setPxSphereGeometryRadius( PxSphereGeometry* inOwner, PxReal inData) { inOwner->radius = inData; } +PX_PHYSX_CORE_API PxSphereGeometryGeneratedInfo::PxSphereGeometryGeneratedInfo() + : Radius( "Radius", setPxSphereGeometryRadius, getPxSphereGeometryRadius ) +{} +PX_PHYSX_CORE_API PxSphereGeometryGeneratedValues::PxSphereGeometryGeneratedValues( const PxSphereGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,Radius( inSource->radius ) +{ + PX_UNUSED(inSource); +} +PX_PHYSX_CORE_API PxPlaneGeometryGeneratedInfo::PxPlaneGeometryGeneratedInfo() +{} +PX_PHYSX_CORE_API PxPlaneGeometryGeneratedValues::PxPlaneGeometryGeneratedValues( const PxPlaneGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) +{ + PX_UNUSED(inSource); +} +inline PxMeshScale getPxTriangleMeshGeometryScale( const PxTriangleMeshGeometry* inOwner ) { return inOwner->scale; } +inline void setPxTriangleMeshGeometryScale( PxTriangleMeshGeometry* inOwner, PxMeshScale inData) { inOwner->scale = inData; } +inline PxMeshGeometryFlags getPxTriangleMeshGeometryMeshFlags( const PxTriangleMeshGeometry* inOwner ) { return inOwner->meshFlags; } +inline void setPxTriangleMeshGeometryMeshFlags( PxTriangleMeshGeometry* inOwner, PxMeshGeometryFlags inData) { inOwner->meshFlags = inData; } +inline PxTriangleMesh * getPxTriangleMeshGeometryTriangleMesh( const PxTriangleMeshGeometry* inOwner ) { return inOwner->triangleMesh; } +inline void setPxTriangleMeshGeometryTriangleMesh( PxTriangleMeshGeometry* inOwner, PxTriangleMesh * inData) { inOwner->triangleMesh = inData; } +PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedInfo::PxTriangleMeshGeometryGeneratedInfo() + : Scale( "Scale", setPxTriangleMeshGeometryScale, getPxTriangleMeshGeometryScale ) + , MeshFlags( "MeshFlags", setPxTriangleMeshGeometryMeshFlags, getPxTriangleMeshGeometryMeshFlags ) + , TriangleMesh( "TriangleMesh", setPxTriangleMeshGeometryTriangleMesh, getPxTriangleMeshGeometryTriangleMesh ) +{} +PX_PHYSX_CORE_API PxTriangleMeshGeometryGeneratedValues::PxTriangleMeshGeometryGeneratedValues( const PxTriangleMeshGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,Scale( inSource->scale ) + ,MeshFlags( inSource->meshFlags ) + ,TriangleMesh( inSource->triangleMesh ) +{ + PX_UNUSED(inSource); +} +inline PxHeightField * getPxHeightFieldGeometryHeightField( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightField; } +inline void setPxHeightFieldGeometryHeightField( PxHeightFieldGeometry* inOwner, PxHeightField * inData) { inOwner->heightField = inData; } +inline PxReal getPxHeightFieldGeometryHeightScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightScale; } +inline void setPxHeightFieldGeometryHeightScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->heightScale = inData; } +inline PxReal getPxHeightFieldGeometryRowScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->rowScale; } +inline void setPxHeightFieldGeometryRowScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->rowScale = inData; } +inline PxReal getPxHeightFieldGeometryColumnScale( const PxHeightFieldGeometry* inOwner ) { return inOwner->columnScale; } +inline void setPxHeightFieldGeometryColumnScale( PxHeightFieldGeometry* inOwner, PxReal inData) { inOwner->columnScale = inData; } +inline PxMeshGeometryFlags getPxHeightFieldGeometryHeightFieldFlags( const PxHeightFieldGeometry* inOwner ) { return inOwner->heightFieldFlags; } +inline void setPxHeightFieldGeometryHeightFieldFlags( PxHeightFieldGeometry* inOwner, PxMeshGeometryFlags inData) { inOwner->heightFieldFlags = inData; } +PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedInfo::PxHeightFieldGeometryGeneratedInfo() + : HeightField( "HeightField", setPxHeightFieldGeometryHeightField, getPxHeightFieldGeometryHeightField ) + , HeightScale( "HeightScale", setPxHeightFieldGeometryHeightScale, getPxHeightFieldGeometryHeightScale ) + , RowScale( "RowScale", setPxHeightFieldGeometryRowScale, getPxHeightFieldGeometryRowScale ) + , ColumnScale( "ColumnScale", setPxHeightFieldGeometryColumnScale, getPxHeightFieldGeometryColumnScale ) + , HeightFieldFlags( "HeightFieldFlags", setPxHeightFieldGeometryHeightFieldFlags, getPxHeightFieldGeometryHeightFieldFlags ) +{} +PX_PHYSX_CORE_API PxHeightFieldGeometryGeneratedValues::PxHeightFieldGeometryGeneratedValues( const PxHeightFieldGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,HeightField( inSource->heightField ) + ,HeightScale( inSource->heightScale ) + ,RowScale( inSource->rowScale ) + ,ColumnScale( inSource->columnScale ) + ,HeightFieldFlags( inSource->heightFieldFlags ) +{ + PX_UNUSED(inSource); +} +void setPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( PxSceneQuerySystemBase* inObj, PxU32 inArg){ inObj->setDynamicTreeRebuildRateHint( inArg ); } +PxU32 getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( const PxSceneQuerySystemBase* inObj ) { return inObj->getDynamicTreeRebuildRateHint(); } +void setPxSceneQuerySystemBase_UpdateMode( PxSceneQuerySystemBase* inObj, PxSceneQueryUpdateMode::Enum inArg){ inObj->setUpdateMode( inArg ); } +PxSceneQueryUpdateMode::Enum getPxSceneQuerySystemBase_UpdateMode( const PxSceneQuerySystemBase* inObj ) { return inObj->getUpdateMode(); } +PxU32 getPxSceneQuerySystemBase_StaticTimestamp( const PxSceneQuerySystemBase* inObj ) { return inObj->getStaticTimestamp(); } +PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedInfo::PxSceneQuerySystemBaseGeneratedInfo() + : DynamicTreeRebuildRateHint( "DynamicTreeRebuildRateHint", setPxSceneQuerySystemBase_DynamicTreeRebuildRateHint, getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint) + , UpdateMode( "UpdateMode", setPxSceneQuerySystemBase_UpdateMode, getPxSceneQuerySystemBase_UpdateMode) + , StaticTimestamp( "StaticTimestamp", getPxSceneQuerySystemBase_StaticTimestamp) +{} +PX_PHYSX_CORE_API PxSceneQuerySystemBaseGeneratedValues::PxSceneQuerySystemBaseGeneratedValues( const PxSceneQuerySystemBase* inSource ) + :DynamicTreeRebuildRateHint( getPxSceneQuerySystemBase_DynamicTreeRebuildRateHint( inSource ) ) + ,UpdateMode( getPxSceneQuerySystemBase_UpdateMode( inSource ) ) + ,StaticTimestamp( getPxSceneQuerySystemBase_StaticTimestamp( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxSceneSQSystem_SceneQueryUpdateMode( PxSceneSQSystem* inObj, PxSceneQueryUpdateMode::Enum inArg){ inObj->setSceneQueryUpdateMode( inArg ); } +PxSceneQueryUpdateMode::Enum getPxSceneSQSystem_SceneQueryUpdateMode( const PxSceneSQSystem* inObj ) { return inObj->getSceneQueryUpdateMode(); } +PxU32 getPxSceneSQSystem_SceneQueryStaticTimestamp( const PxSceneSQSystem* inObj ) { return inObj->getSceneQueryStaticTimestamp(); } +PxPruningStructureType::Enum getPxSceneSQSystem_StaticStructure( const PxSceneSQSystem* inObj ) { return inObj->getStaticStructure(); } +PxPruningStructureType::Enum getPxSceneSQSystem_DynamicStructure( const PxSceneSQSystem* inObj ) { return inObj->getDynamicStructure(); } +PX_PHYSX_CORE_API PxSceneSQSystemGeneratedInfo::PxSceneSQSystemGeneratedInfo() + : SceneQueryUpdateMode( "SceneQueryUpdateMode", setPxSceneSQSystem_SceneQueryUpdateMode, getPxSceneSQSystem_SceneQueryUpdateMode) + , SceneQueryStaticTimestamp( "SceneQueryStaticTimestamp", getPxSceneSQSystem_SceneQueryStaticTimestamp) + , StaticStructure( "StaticStructure", getPxSceneSQSystem_StaticStructure) + , DynamicStructure( "DynamicStructure", getPxSceneSQSystem_DynamicStructure) +{} +PX_PHYSX_CORE_API PxSceneSQSystemGeneratedValues::PxSceneSQSystemGeneratedValues( const PxSceneSQSystem* inSource ) + :PxSceneQuerySystemBaseGeneratedValues( inSource ) + ,SceneQueryUpdateMode( getPxSceneSQSystem_SceneQueryUpdateMode( inSource ) ) + ,SceneQueryStaticTimestamp( getPxSceneSQSystem_SceneQueryStaticTimestamp( inSource ) ) + ,StaticStructure( getPxSceneSQSystem_StaticStructure( inSource ) ) + ,DynamicStructure( getPxSceneSQSystem_DynamicStructure( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxSceneFlags getPxScene_Flags( const PxScene* inObj ) { return inObj->getFlags(); } +void setPxScene_Limits( PxScene* inObj, const PxSceneLimits & inArg){ inObj->setLimits( inArg ); } +PxSceneLimits getPxScene_Limits( const PxScene* inObj ) { return inObj->getLimits(); } +PxU32 getPxScene_Timestamp( const PxScene* inObj ) { return inObj->getTimestamp(); } +PxU32 getPxScene_Actors( const PxScene* inObj, PxActorTypeFlags inFilter, PxActor ** outBuffer, PxU32 inBufSize ) { return inObj->getActors( inFilter, outBuffer, inBufSize ); } +PxU32 getNbPxScene_Actors( const PxScene* inObj, PxActorTypeFlags inFilter ) { return inObj->getNbActors( inFilter ); } +PxU32 getPxScene_SoftBodies( const PxScene* inObj, PxSoftBody ** outBuffer, PxU32 inBufSize ) { return inObj->getSoftBodies( outBuffer, inBufSize ); } +PxU32 getNbPxScene_SoftBodies( const PxScene* inObj ) { return inObj->getNbSoftBodies( ); } +PxU32 getPxScene_Articulations( const PxScene* inObj, PxArticulationReducedCoordinate ** outBuffer, PxU32 inBufSize ) { return inObj->getArticulations( outBuffer, inBufSize ); } +PxU32 getNbPxScene_Articulations( const PxScene* inObj ) { return inObj->getNbArticulations( ); } +PxU32 getPxScene_Constraints( const PxScene* inObj, PxConstraint ** outBuffer, PxU32 inBufSize ) { return inObj->getConstraints( outBuffer, inBufSize ); } +PxU32 getNbPxScene_Constraints( const PxScene* inObj ) { return inObj->getNbConstraints( ); } +PxU32 getPxScene_Aggregates( const PxScene* inObj, PxAggregate ** outBuffer, PxU32 inBufSize ) { return inObj->getAggregates( outBuffer, inBufSize ); } +PxU32 getNbPxScene_Aggregates( const PxScene* inObj ) { return inObj->getNbAggregates( ); } +PxCpuDispatcher * getPxScene_CpuDispatcher( const PxScene* inObj ) { return inObj->getCpuDispatcher(); } +PxCudaContextManager * getPxScene_CudaContextManager( const PxScene* inObj ) { return inObj->getCudaContextManager(); } +void setPxScene_SimulationEventCallback( PxScene* inObj, PxSimulationEventCallback * inArg){ inObj->setSimulationEventCallback( inArg ); } +PxSimulationEventCallback * getPxScene_SimulationEventCallback( const PxScene* inObj ) { return inObj->getSimulationEventCallback(); } +void setPxScene_ContactModifyCallback( PxScene* inObj, PxContactModifyCallback * inArg){ inObj->setContactModifyCallback( inArg ); } +PxContactModifyCallback * getPxScene_ContactModifyCallback( const PxScene* inObj ) { return inObj->getContactModifyCallback(); } +void setPxScene_CCDContactModifyCallback( PxScene* inObj, PxCCDContactModifyCallback * inArg){ inObj->setCCDContactModifyCallback( inArg ); } +PxCCDContactModifyCallback * getPxScene_CCDContactModifyCallback( const PxScene* inObj ) { return inObj->getCCDContactModifyCallback(); } +void setPxScene_BroadPhaseCallback( PxScene* inObj, PxBroadPhaseCallback * inArg){ inObj->setBroadPhaseCallback( inArg ); } +PxBroadPhaseCallback * getPxScene_BroadPhaseCallback( const PxScene* inObj ) { return inObj->getBroadPhaseCallback(); } +PxU32 getPxScene_FilterShaderDataSize( const PxScene* inObj ) { return inObj->getFilterShaderDataSize(); } +PxSimulationFilterShader getPxScene_FilterShader( const PxScene* inObj ) { return inObj->getFilterShader(); } +PxSimulationFilterCallback * getPxScene_FilterCallback( const PxScene* inObj ) { return inObj->getFilterCallback(); } +PxPairFilteringMode::Enum getPxScene_KinematicKinematicFilteringMode( const PxScene* inObj ) { return inObj->getKinematicKinematicFilteringMode(); } +PxPairFilteringMode::Enum getPxScene_StaticKinematicFilteringMode( const PxScene* inObj ) { return inObj->getStaticKinematicFilteringMode(); } +void setPxScene_Gravity( PxScene* inObj, const PxVec3 & inArg){ inObj->setGravity( inArg ); } +PxVec3 getPxScene_Gravity( const PxScene* inObj ) { return inObj->getGravity(); } +void setPxScene_BounceThresholdVelocity( PxScene* inObj, const PxReal inArg){ inObj->setBounceThresholdVelocity( inArg ); } +PxReal getPxScene_BounceThresholdVelocity( const PxScene* inObj ) { return inObj->getBounceThresholdVelocity(); } +void setPxScene_CCDMaxPasses( PxScene* inObj, PxU32 inArg){ inObj->setCCDMaxPasses( inArg ); } +PxU32 getPxScene_CCDMaxPasses( const PxScene* inObj ) { return inObj->getCCDMaxPasses(); } +void setPxScene_CCDMaxSeparation( PxScene* inObj, const PxReal inArg){ inObj->setCCDMaxSeparation( inArg ); } +PxReal getPxScene_CCDMaxSeparation( const PxScene* inObj ) { return inObj->getCCDMaxSeparation(); } +void setPxScene_CCDThreshold( PxScene* inObj, const PxReal inArg){ inObj->setCCDThreshold( inArg ); } +PxReal getPxScene_CCDThreshold( const PxScene* inObj ) { return inObj->getCCDThreshold(); } +void setPxScene_MaxBiasCoefficient( PxScene* inObj, const PxReal inArg){ inObj->setMaxBiasCoefficient( inArg ); } +PxReal getPxScene_MaxBiasCoefficient( const PxScene* inObj ) { return inObj->getMaxBiasCoefficient(); } +void setPxScene_FrictionOffsetThreshold( PxScene* inObj, const PxReal inArg){ inObj->setFrictionOffsetThreshold( inArg ); } +PxReal getPxScene_FrictionOffsetThreshold( const PxScene* inObj ) { return inObj->getFrictionOffsetThreshold(); } +void setPxScene_FrictionCorrelationDistance( PxScene* inObj, const PxReal inArg){ inObj->setFrictionCorrelationDistance( inArg ); } +PxReal getPxScene_FrictionCorrelationDistance( const PxScene* inObj ) { return inObj->getFrictionCorrelationDistance(); } +PxFrictionType::Enum getPxScene_FrictionType( const PxScene* inObj ) { return inObj->getFrictionType(); } +PxSolverType::Enum getPxScene_SolverType( const PxScene* inObj ) { return inObj->getSolverType(); } +void setPxScene_VisualizationCullingBox( PxScene* inObj, const PxBounds3 & inArg){ inObj->setVisualizationCullingBox( inArg ); } +PxBounds3 getPxScene_VisualizationCullingBox( const PxScene* inObj ) { return inObj->getVisualizationCullingBox(); } +PxBroadPhaseType::Enum getPxScene_BroadPhaseType( const PxScene* inObj ) { return inObj->getBroadPhaseType(); } +PxU32 getPxScene_BroadPhaseRegions( const PxScene* inObj, PxBroadPhaseRegionInfo* outBuffer, PxU32 inBufSize ) { return inObj->getBroadPhaseRegions( outBuffer, inBufSize ); } +PxU32 getNbPxScene_BroadPhaseRegions( const PxScene* inObj ) { return inObj->getNbBroadPhaseRegions( ); } +PxTaskManager * getPxScene_TaskManager( const PxScene* inObj ) { return inObj->getTaskManager(); } +void setPxScene_NbContactDataBlocks( PxScene* inObj, PxU32 inArg){ inObj->setNbContactDataBlocks( inArg ); } +PxU32 getPxScene_MaxNbContactDataBlocksUsed( const PxScene* inObj ) { return inObj->getMaxNbContactDataBlocksUsed(); } +PxU32 getPxScene_ContactReportStreamBufferSize( const PxScene* inObj ) { return inObj->getContactReportStreamBufferSize(); } +void setPxScene_SolverBatchSize( PxScene* inObj, PxU32 inArg){ inObj->setSolverBatchSize( inArg ); } +PxU32 getPxScene_SolverBatchSize( const PxScene* inObj ) { return inObj->getSolverBatchSize(); } +void setPxScene_SolverArticulationBatchSize( PxScene* inObj, PxU32 inArg){ inObj->setSolverArticulationBatchSize( inArg ); } +PxU32 getPxScene_SolverArticulationBatchSize( const PxScene* inObj ) { return inObj->getSolverArticulationBatchSize(); } +PxReal getPxScene_WakeCounterResetValue( const PxScene* inObj ) { return inObj->getWakeCounterResetValue(); } +PxgDynamicsMemoryConfig getPxScene_GpuDynamicsConfig( const PxScene* inObj ) { return inObj->getGpuDynamicsConfig(); } +inline void * getPxSceneUserData( const PxScene* inOwner ) { return inOwner->userData; } +inline void setPxSceneUserData( PxScene* inOwner, void * inData) { inOwner->userData = inData; } +PX_PHYSX_CORE_API PxSceneGeneratedInfo::PxSceneGeneratedInfo() + : Flags( "Flags", getPxScene_Flags) + , Limits( "Limits", setPxScene_Limits, getPxScene_Limits) + , Timestamp( "Timestamp", getPxScene_Timestamp) + , Actors( "Actors", getPxScene_Actors, getNbPxScene_Actors ) + , SoftBodies( "SoftBodies", getPxScene_SoftBodies, getNbPxScene_SoftBodies ) + , Articulations( "Articulations", getPxScene_Articulations, getNbPxScene_Articulations ) + , Constraints( "Constraints", getPxScene_Constraints, getNbPxScene_Constraints ) + , Aggregates( "Aggregates", getPxScene_Aggregates, getNbPxScene_Aggregates ) + , CpuDispatcher( "CpuDispatcher", getPxScene_CpuDispatcher) + , CudaContextManager( "CudaContextManager", getPxScene_CudaContextManager) + , SimulationEventCallback( "SimulationEventCallback", setPxScene_SimulationEventCallback, getPxScene_SimulationEventCallback) + , ContactModifyCallback( "ContactModifyCallback", setPxScene_ContactModifyCallback, getPxScene_ContactModifyCallback) + , CCDContactModifyCallback( "CCDContactModifyCallback", setPxScene_CCDContactModifyCallback, getPxScene_CCDContactModifyCallback) + , BroadPhaseCallback( "BroadPhaseCallback", setPxScene_BroadPhaseCallback, getPxScene_BroadPhaseCallback) + , FilterShaderDataSize( "FilterShaderDataSize", getPxScene_FilterShaderDataSize) + , FilterShader( "FilterShader", getPxScene_FilterShader) + , FilterCallback( "FilterCallback", getPxScene_FilterCallback) + , KinematicKinematicFilteringMode( "KinematicKinematicFilteringMode", getPxScene_KinematicKinematicFilteringMode) + , StaticKinematicFilteringMode( "StaticKinematicFilteringMode", getPxScene_StaticKinematicFilteringMode) + , Gravity( "Gravity", setPxScene_Gravity, getPxScene_Gravity) + , BounceThresholdVelocity( "BounceThresholdVelocity", setPxScene_BounceThresholdVelocity, getPxScene_BounceThresholdVelocity) + , CCDMaxPasses( "CCDMaxPasses", setPxScene_CCDMaxPasses, getPxScene_CCDMaxPasses) + , CCDMaxSeparation( "CCDMaxSeparation", setPxScene_CCDMaxSeparation, getPxScene_CCDMaxSeparation) + , CCDThreshold( "CCDThreshold", setPxScene_CCDThreshold, getPxScene_CCDThreshold) + , MaxBiasCoefficient( "MaxBiasCoefficient", setPxScene_MaxBiasCoefficient, getPxScene_MaxBiasCoefficient) + , FrictionOffsetThreshold( "FrictionOffsetThreshold", setPxScene_FrictionOffsetThreshold, getPxScene_FrictionOffsetThreshold) + , FrictionCorrelationDistance( "FrictionCorrelationDistance", setPxScene_FrictionCorrelationDistance, getPxScene_FrictionCorrelationDistance) + , FrictionType( "FrictionType", getPxScene_FrictionType) + , SolverType( "SolverType", getPxScene_SolverType) + , VisualizationCullingBox( "VisualizationCullingBox", setPxScene_VisualizationCullingBox, getPxScene_VisualizationCullingBox) + , BroadPhaseType( "BroadPhaseType", getPxScene_BroadPhaseType) + , BroadPhaseRegions( "BroadPhaseRegions", getPxScene_BroadPhaseRegions, getNbPxScene_BroadPhaseRegions ) + , TaskManager( "TaskManager", getPxScene_TaskManager) + , NbContactDataBlocks( "NbContactDataBlocks", setPxScene_NbContactDataBlocks) + , MaxNbContactDataBlocksUsed( "MaxNbContactDataBlocksUsed", getPxScene_MaxNbContactDataBlocksUsed) + , ContactReportStreamBufferSize( "ContactReportStreamBufferSize", getPxScene_ContactReportStreamBufferSize) + , SolverBatchSize( "SolverBatchSize", setPxScene_SolverBatchSize, getPxScene_SolverBatchSize) + , SolverArticulationBatchSize( "SolverArticulationBatchSize", setPxScene_SolverArticulationBatchSize, getPxScene_SolverArticulationBatchSize) + , WakeCounterResetValue( "WakeCounterResetValue", getPxScene_WakeCounterResetValue) + , GpuDynamicsConfig( "GpuDynamicsConfig", getPxScene_GpuDynamicsConfig) + , UserData( "UserData", setPxSceneUserData, getPxSceneUserData ) +{} +PX_PHYSX_CORE_API PxSceneGeneratedValues::PxSceneGeneratedValues( const PxScene* inSource ) + :PxSceneSQSystemGeneratedValues( inSource ) + ,Flags( getPxScene_Flags( inSource ) ) + ,Limits( getPxScene_Limits( inSource ) ) + ,Timestamp( getPxScene_Timestamp( inSource ) ) + ,CpuDispatcher( getPxScene_CpuDispatcher( inSource ) ) + ,CudaContextManager( getPxScene_CudaContextManager( inSource ) ) + ,SimulationEventCallback( getPxScene_SimulationEventCallback( inSource ) ) + ,ContactModifyCallback( getPxScene_ContactModifyCallback( inSource ) ) + ,CCDContactModifyCallback( getPxScene_CCDContactModifyCallback( inSource ) ) + ,BroadPhaseCallback( getPxScene_BroadPhaseCallback( inSource ) ) + ,FilterShaderDataSize( getPxScene_FilterShaderDataSize( inSource ) ) + ,FilterShader( getPxScene_FilterShader( inSource ) ) + ,FilterCallback( getPxScene_FilterCallback( inSource ) ) + ,KinematicKinematicFilteringMode( getPxScene_KinematicKinematicFilteringMode( inSource ) ) + ,StaticKinematicFilteringMode( getPxScene_StaticKinematicFilteringMode( inSource ) ) + ,Gravity( getPxScene_Gravity( inSource ) ) + ,BounceThresholdVelocity( getPxScene_BounceThresholdVelocity( inSource ) ) + ,CCDMaxPasses( getPxScene_CCDMaxPasses( inSource ) ) + ,CCDMaxSeparation( getPxScene_CCDMaxSeparation( inSource ) ) + ,CCDThreshold( getPxScene_CCDThreshold( inSource ) ) + ,MaxBiasCoefficient( getPxScene_MaxBiasCoefficient( inSource ) ) + ,FrictionOffsetThreshold( getPxScene_FrictionOffsetThreshold( inSource ) ) + ,FrictionCorrelationDistance( getPxScene_FrictionCorrelationDistance( inSource ) ) + ,FrictionType( getPxScene_FrictionType( inSource ) ) + ,SolverType( getPxScene_SolverType( inSource ) ) + ,VisualizationCullingBox( getPxScene_VisualizationCullingBox( inSource ) ) + ,BroadPhaseType( getPxScene_BroadPhaseType( inSource ) ) + ,TaskManager( getPxScene_TaskManager( inSource ) ) + ,MaxNbContactDataBlocksUsed( getPxScene_MaxNbContactDataBlocksUsed( inSource ) ) + ,ContactReportStreamBufferSize( getPxScene_ContactReportStreamBufferSize( inSource ) ) + ,SolverBatchSize( getPxScene_SolverBatchSize( inSource ) ) + ,SolverArticulationBatchSize( getPxScene_SolverArticulationBatchSize( inSource ) ) + ,WakeCounterResetValue( getPxScene_WakeCounterResetValue( inSource ) ) + ,GpuDynamicsConfig( getPxScene_GpuDynamicsConfig( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + inSource->getSimulationStatistics(SimulationStatistics); +} +inline PxTetrahedronMesh * getPxTetrahedronMeshGeometryTetrahedronMesh( const PxTetrahedronMeshGeometry* inOwner ) { return inOwner->tetrahedronMesh; } +inline void setPxTetrahedronMeshGeometryTetrahedronMesh( PxTetrahedronMeshGeometry* inOwner, PxTetrahedronMesh * inData) { inOwner->tetrahedronMesh = inData; } +PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedInfo::PxTetrahedronMeshGeometryGeneratedInfo() + : TetrahedronMesh( "TetrahedronMesh", setPxTetrahedronMeshGeometryTetrahedronMesh, getPxTetrahedronMeshGeometryTetrahedronMesh ) +{} +PX_PHYSX_CORE_API PxTetrahedronMeshGeometryGeneratedValues::PxTetrahedronMeshGeometryGeneratedValues( const PxTetrahedronMeshGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) + ,TetrahedronMesh( inSource->tetrahedronMesh ) +{ + PX_UNUSED(inSource); +} +PX_PHYSX_CORE_API PxCustomGeometryGeneratedInfo::PxCustomGeometryGeneratedInfo() +{} +PX_PHYSX_CORE_API PxCustomGeometryGeneratedValues::PxCustomGeometryGeneratedValues( const PxCustomGeometry* inSource ) + :PxGeometryGeneratedValues( inSource ) +{ + PX_UNUSED(inSource); + PxCustomGeometryType t = inSource->callbacks->getCustomType(); CustomType = *reinterpret_cast(&t); +} +inline PxU32 getPxHeightFieldDescNbRows( const PxHeightFieldDesc* inOwner ) { return inOwner->nbRows; } +inline void setPxHeightFieldDescNbRows( PxHeightFieldDesc* inOwner, PxU32 inData) { inOwner->nbRows = inData; } +inline PxU32 getPxHeightFieldDescNbColumns( const PxHeightFieldDesc* inOwner ) { return inOwner->nbColumns; } +inline void setPxHeightFieldDescNbColumns( PxHeightFieldDesc* inOwner, PxU32 inData) { inOwner->nbColumns = inData; } +inline PxHeightFieldFormat::Enum getPxHeightFieldDescFormat( const PxHeightFieldDesc* inOwner ) { return inOwner->format; } +inline void setPxHeightFieldDescFormat( PxHeightFieldDesc* inOwner, PxHeightFieldFormat::Enum inData) { inOwner->format = inData; } +inline PxStridedData getPxHeightFieldDescSamples( const PxHeightFieldDesc* inOwner ) { return inOwner->samples; } +inline void setPxHeightFieldDescSamples( PxHeightFieldDesc* inOwner, PxStridedData inData) { inOwner->samples = inData; } +inline PxReal getPxHeightFieldDescConvexEdgeThreshold( const PxHeightFieldDesc* inOwner ) { return inOwner->convexEdgeThreshold; } +inline void setPxHeightFieldDescConvexEdgeThreshold( PxHeightFieldDesc* inOwner, PxReal inData) { inOwner->convexEdgeThreshold = inData; } +inline PxHeightFieldFlags getPxHeightFieldDescFlags( const PxHeightFieldDesc* inOwner ) { return inOwner->flags; } +inline void setPxHeightFieldDescFlags( PxHeightFieldDesc* inOwner, PxHeightFieldFlags inData) { inOwner->flags = inData; } +PX_PHYSX_CORE_API PxHeightFieldDescGeneratedInfo::PxHeightFieldDescGeneratedInfo() + : NbRows( "NbRows", setPxHeightFieldDescNbRows, getPxHeightFieldDescNbRows ) + , NbColumns( "NbColumns", setPxHeightFieldDescNbColumns, getPxHeightFieldDescNbColumns ) + , Format( "Format", setPxHeightFieldDescFormat, getPxHeightFieldDescFormat ) + , Samples( "Samples", setPxHeightFieldDescSamples, getPxHeightFieldDescSamples ) + , ConvexEdgeThreshold( "ConvexEdgeThreshold", setPxHeightFieldDescConvexEdgeThreshold, getPxHeightFieldDescConvexEdgeThreshold ) + , Flags( "Flags", setPxHeightFieldDescFlags, getPxHeightFieldDescFlags ) +{} +PX_PHYSX_CORE_API PxHeightFieldDescGeneratedValues::PxHeightFieldDescGeneratedValues( const PxHeightFieldDesc* inSource ) + :NbRows( inSource->nbRows ) + ,NbColumns( inSource->nbColumns ) + ,Format( inSource->format ) + ,Samples( inSource->samples ) + ,ConvexEdgeThreshold( inSource->convexEdgeThreshold ) + ,Flags( inSource->flags ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxArticulationLimitLow( const PxArticulationLimit* inOwner ) { return inOwner->low; } +inline void setPxArticulationLimitLow( PxArticulationLimit* inOwner, PxReal inData) { inOwner->low = inData; } +inline PxReal getPxArticulationLimitHigh( const PxArticulationLimit* inOwner ) { return inOwner->high; } +inline void setPxArticulationLimitHigh( PxArticulationLimit* inOwner, PxReal inData) { inOwner->high = inData; } +PX_PHYSX_CORE_API PxArticulationLimitGeneratedInfo::PxArticulationLimitGeneratedInfo() + : Low( "Low", setPxArticulationLimitLow, getPxArticulationLimitLow ) + , High( "High", setPxArticulationLimitHigh, getPxArticulationLimitHigh ) +{} +PX_PHYSX_CORE_API PxArticulationLimitGeneratedValues::PxArticulationLimitGeneratedValues( const PxArticulationLimit* inSource ) + :Low( inSource->low ) + ,High( inSource->high ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxArticulationDriveStiffness( const PxArticulationDrive* inOwner ) { return inOwner->stiffness; } +inline void setPxArticulationDriveStiffness( PxArticulationDrive* inOwner, PxReal inData) { inOwner->stiffness = inData; } +inline PxReal getPxArticulationDriveDamping( const PxArticulationDrive* inOwner ) { return inOwner->damping; } +inline void setPxArticulationDriveDamping( PxArticulationDrive* inOwner, PxReal inData) { inOwner->damping = inData; } +inline PxReal getPxArticulationDriveMaxForce( const PxArticulationDrive* inOwner ) { return inOwner->maxForce; } +inline void setPxArticulationDriveMaxForce( PxArticulationDrive* inOwner, PxReal inData) { inOwner->maxForce = inData; } +inline PxArticulationDriveType::Enum getPxArticulationDriveDriveType( const PxArticulationDrive* inOwner ) { return inOwner->driveType; } +inline void setPxArticulationDriveDriveType( PxArticulationDrive* inOwner, PxArticulationDriveType::Enum inData) { inOwner->driveType = inData; } +PX_PHYSX_CORE_API PxArticulationDriveGeneratedInfo::PxArticulationDriveGeneratedInfo() + : Stiffness( "Stiffness", setPxArticulationDriveStiffness, getPxArticulationDriveStiffness ) + , Damping( "Damping", setPxArticulationDriveDamping, getPxArticulationDriveDamping ) + , MaxForce( "MaxForce", setPxArticulationDriveMaxForce, getPxArticulationDriveMaxForce ) + , DriveType( "DriveType", setPxArticulationDriveDriveType, getPxArticulationDriveDriveType ) +{} +PX_PHYSX_CORE_API PxArticulationDriveGeneratedValues::PxArticulationDriveGeneratedValues( const PxArticulationDrive* inSource ) + :Stiffness( inSource->stiffness ) + ,Damping( inSource->damping ) + ,MaxForce( inSource->maxForce ) + ,DriveType( inSource->driveType ) +{ + PX_UNUSED(inSource); +} +_Bool getPxSceneQueryDesc_IsValid( const PxSceneQueryDesc* inObj ) { return inObj->isValid(); } +inline PxPruningStructureType::Enum getPxSceneQueryDescStaticStructure( const PxSceneQueryDesc* inOwner ) { return inOwner->staticStructure; } +inline void setPxSceneQueryDescStaticStructure( PxSceneQueryDesc* inOwner, PxPruningStructureType::Enum inData) { inOwner->staticStructure = inData; } +inline PxPruningStructureType::Enum getPxSceneQueryDescDynamicStructure( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicStructure; } +inline void setPxSceneQueryDescDynamicStructure( PxSceneQueryDesc* inOwner, PxPruningStructureType::Enum inData) { inOwner->dynamicStructure = inData; } +inline PxU32 getPxSceneQueryDescDynamicTreeRebuildRateHint( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicTreeRebuildRateHint; } +inline void setPxSceneQueryDescDynamicTreeRebuildRateHint( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->dynamicTreeRebuildRateHint = inData; } +inline PxDynamicTreeSecondaryPruner::Enum getPxSceneQueryDescDynamicTreeSecondaryPruner( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicTreeSecondaryPruner; } +inline void setPxSceneQueryDescDynamicTreeSecondaryPruner( PxSceneQueryDesc* inOwner, PxDynamicTreeSecondaryPruner::Enum inData) { inOwner->dynamicTreeSecondaryPruner = inData; } +inline PxBVHBuildStrategy::Enum getPxSceneQueryDescStaticBVHBuildStrategy( const PxSceneQueryDesc* inOwner ) { return inOwner->staticBVHBuildStrategy; } +inline void setPxSceneQueryDescStaticBVHBuildStrategy( PxSceneQueryDesc* inOwner, PxBVHBuildStrategy::Enum inData) { inOwner->staticBVHBuildStrategy = inData; } +inline PxBVHBuildStrategy::Enum getPxSceneQueryDescDynamicBVHBuildStrategy( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicBVHBuildStrategy; } +inline void setPxSceneQueryDescDynamicBVHBuildStrategy( PxSceneQueryDesc* inOwner, PxBVHBuildStrategy::Enum inData) { inOwner->dynamicBVHBuildStrategy = inData; } +inline PxU32 getPxSceneQueryDescStaticNbObjectsPerNode( const PxSceneQueryDesc* inOwner ) { return inOwner->staticNbObjectsPerNode; } +inline void setPxSceneQueryDescStaticNbObjectsPerNode( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->staticNbObjectsPerNode = inData; } +inline PxU32 getPxSceneQueryDescDynamicNbObjectsPerNode( const PxSceneQueryDesc* inOwner ) { return inOwner->dynamicNbObjectsPerNode; } +inline void setPxSceneQueryDescDynamicNbObjectsPerNode( PxSceneQueryDesc* inOwner, PxU32 inData) { inOwner->dynamicNbObjectsPerNode = inData; } +inline PxSceneQueryUpdateMode::Enum getPxSceneQueryDescSceneQueryUpdateMode( const PxSceneQueryDesc* inOwner ) { return inOwner->sceneQueryUpdateMode; } +inline void setPxSceneQueryDescSceneQueryUpdateMode( PxSceneQueryDesc* inOwner, PxSceneQueryUpdateMode::Enum inData) { inOwner->sceneQueryUpdateMode = inData; } +PX_PHYSX_CORE_API PxSceneQueryDescGeneratedInfo::PxSceneQueryDescGeneratedInfo() + : IsValid( "IsValid", getPxSceneQueryDesc_IsValid) + , StaticStructure( "StaticStructure", setPxSceneQueryDescStaticStructure, getPxSceneQueryDescStaticStructure ) + , DynamicStructure( "DynamicStructure", setPxSceneQueryDescDynamicStructure, getPxSceneQueryDescDynamicStructure ) + , DynamicTreeRebuildRateHint( "DynamicTreeRebuildRateHint", setPxSceneQueryDescDynamicTreeRebuildRateHint, getPxSceneQueryDescDynamicTreeRebuildRateHint ) + , DynamicTreeSecondaryPruner( "DynamicTreeSecondaryPruner", setPxSceneQueryDescDynamicTreeSecondaryPruner, getPxSceneQueryDescDynamicTreeSecondaryPruner ) + , StaticBVHBuildStrategy( "StaticBVHBuildStrategy", setPxSceneQueryDescStaticBVHBuildStrategy, getPxSceneQueryDescStaticBVHBuildStrategy ) + , DynamicBVHBuildStrategy( "DynamicBVHBuildStrategy", setPxSceneQueryDescDynamicBVHBuildStrategy, getPxSceneQueryDescDynamicBVHBuildStrategy ) + , StaticNbObjectsPerNode( "StaticNbObjectsPerNode", setPxSceneQueryDescStaticNbObjectsPerNode, getPxSceneQueryDescStaticNbObjectsPerNode ) + , DynamicNbObjectsPerNode( "DynamicNbObjectsPerNode", setPxSceneQueryDescDynamicNbObjectsPerNode, getPxSceneQueryDescDynamicNbObjectsPerNode ) + , SceneQueryUpdateMode( "SceneQueryUpdateMode", setPxSceneQueryDescSceneQueryUpdateMode, getPxSceneQueryDescSceneQueryUpdateMode ) +{} +PX_PHYSX_CORE_API PxSceneQueryDescGeneratedValues::PxSceneQueryDescGeneratedValues( const PxSceneQueryDesc* inSource ) + :IsValid( getPxSceneQueryDesc_IsValid( inSource ) ) + ,StaticStructure( inSource->staticStructure ) + ,DynamicStructure( inSource->dynamicStructure ) + ,DynamicTreeRebuildRateHint( inSource->dynamicTreeRebuildRateHint ) + ,DynamicTreeSecondaryPruner( inSource->dynamicTreeSecondaryPruner ) + ,StaticBVHBuildStrategy( inSource->staticBVHBuildStrategy ) + ,DynamicBVHBuildStrategy( inSource->dynamicBVHBuildStrategy ) + ,StaticNbObjectsPerNode( inSource->staticNbObjectsPerNode ) + ,DynamicNbObjectsPerNode( inSource->dynamicNbObjectsPerNode ) + ,SceneQueryUpdateMode( inSource->sceneQueryUpdateMode ) +{ + PX_UNUSED(inSource); +} +void setPxSceneDesc_ToDefault( PxSceneDesc* inObj, const PxTolerancesScale & inArg){ inObj->setToDefault( inArg ); } +inline PxVec3 getPxSceneDescGravity( const PxSceneDesc* inOwner ) { return inOwner->gravity; } +inline void setPxSceneDescGravity( PxSceneDesc* inOwner, PxVec3 inData) { inOwner->gravity = inData; } +inline PxSimulationEventCallback * getPxSceneDescSimulationEventCallback( const PxSceneDesc* inOwner ) { return inOwner->simulationEventCallback; } +inline void setPxSceneDescSimulationEventCallback( PxSceneDesc* inOwner, PxSimulationEventCallback * inData) { inOwner->simulationEventCallback = inData; } +inline PxContactModifyCallback * getPxSceneDescContactModifyCallback( const PxSceneDesc* inOwner ) { return inOwner->contactModifyCallback; } +inline void setPxSceneDescContactModifyCallback( PxSceneDesc* inOwner, PxContactModifyCallback * inData) { inOwner->contactModifyCallback = inData; } +inline PxCCDContactModifyCallback * getPxSceneDescCcdContactModifyCallback( const PxSceneDesc* inOwner ) { return inOwner->ccdContactModifyCallback; } +inline void setPxSceneDescCcdContactModifyCallback( PxSceneDesc* inOwner, PxCCDContactModifyCallback * inData) { inOwner->ccdContactModifyCallback = inData; } +inline const void * getPxSceneDescFilterShaderData( const PxSceneDesc* inOwner ) { return inOwner->filterShaderData; } +inline void setPxSceneDescFilterShaderData( PxSceneDesc* inOwner, const void * inData) { inOwner->filterShaderData = inData; } +inline PxU32 getPxSceneDescFilterShaderDataSize( const PxSceneDesc* inOwner ) { return inOwner->filterShaderDataSize; } +inline void setPxSceneDescFilterShaderDataSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->filterShaderDataSize = inData; } +inline PxSimulationFilterShader getPxSceneDescFilterShader( const PxSceneDesc* inOwner ) { return inOwner->filterShader; } +inline void setPxSceneDescFilterShader( PxSceneDesc* inOwner, PxSimulationFilterShader inData) { inOwner->filterShader = inData; } +inline PxSimulationFilterCallback * getPxSceneDescFilterCallback( const PxSceneDesc* inOwner ) { return inOwner->filterCallback; } +inline void setPxSceneDescFilterCallback( PxSceneDesc* inOwner, PxSimulationFilterCallback * inData) { inOwner->filterCallback = inData; } +inline PxPairFilteringMode::Enum getPxSceneDescKineKineFilteringMode( const PxSceneDesc* inOwner ) { return inOwner->kineKineFilteringMode; } +inline void setPxSceneDescKineKineFilteringMode( PxSceneDesc* inOwner, PxPairFilteringMode::Enum inData) { inOwner->kineKineFilteringMode = inData; } +inline PxPairFilteringMode::Enum getPxSceneDescStaticKineFilteringMode( const PxSceneDesc* inOwner ) { return inOwner->staticKineFilteringMode; } +inline void setPxSceneDescStaticKineFilteringMode( PxSceneDesc* inOwner, PxPairFilteringMode::Enum inData) { inOwner->staticKineFilteringMode = inData; } +inline PxBroadPhaseType::Enum getPxSceneDescBroadPhaseType( const PxSceneDesc* inOwner ) { return inOwner->broadPhaseType; } +inline void setPxSceneDescBroadPhaseType( PxSceneDesc* inOwner, PxBroadPhaseType::Enum inData) { inOwner->broadPhaseType = inData; } +inline PxBroadPhaseCallback * getPxSceneDescBroadPhaseCallback( const PxSceneDesc* inOwner ) { return inOwner->broadPhaseCallback; } +inline void setPxSceneDescBroadPhaseCallback( PxSceneDesc* inOwner, PxBroadPhaseCallback * inData) { inOwner->broadPhaseCallback = inData; } +inline PxSceneLimits getPxSceneDescLimits( const PxSceneDesc* inOwner ) { return inOwner->limits; } +inline void setPxSceneDescLimits( PxSceneDesc* inOwner, PxSceneLimits inData) { inOwner->limits = inData; } +inline PxFrictionType::Enum getPxSceneDescFrictionType( const PxSceneDesc* inOwner ) { return inOwner->frictionType; } +inline void setPxSceneDescFrictionType( PxSceneDesc* inOwner, PxFrictionType::Enum inData) { inOwner->frictionType = inData; } +inline PxSolverType::Enum getPxSceneDescSolverType( const PxSceneDesc* inOwner ) { return inOwner->solverType; } +inline void setPxSceneDescSolverType( PxSceneDesc* inOwner, PxSolverType::Enum inData) { inOwner->solverType = inData; } +inline PxReal getPxSceneDescBounceThresholdVelocity( const PxSceneDesc* inOwner ) { return inOwner->bounceThresholdVelocity; } +inline void setPxSceneDescBounceThresholdVelocity( PxSceneDesc* inOwner, PxReal inData) { inOwner->bounceThresholdVelocity = inData; } +inline PxReal getPxSceneDescFrictionOffsetThreshold( const PxSceneDesc* inOwner ) { return inOwner->frictionOffsetThreshold; } +inline void setPxSceneDescFrictionOffsetThreshold( PxSceneDesc* inOwner, PxReal inData) { inOwner->frictionOffsetThreshold = inData; } +inline PxReal getPxSceneDescFrictionCorrelationDistance( const PxSceneDesc* inOwner ) { return inOwner->frictionCorrelationDistance; } +inline void setPxSceneDescFrictionCorrelationDistance( PxSceneDesc* inOwner, PxReal inData) { inOwner->frictionCorrelationDistance = inData; } +inline PxSceneFlags getPxSceneDescFlags( const PxSceneDesc* inOwner ) { return inOwner->flags; } +inline void setPxSceneDescFlags( PxSceneDesc* inOwner, PxSceneFlags inData) { inOwner->flags = inData; } +inline PxCpuDispatcher * getPxSceneDescCpuDispatcher( const PxSceneDesc* inOwner ) { return inOwner->cpuDispatcher; } +inline void setPxSceneDescCpuDispatcher( PxSceneDesc* inOwner, PxCpuDispatcher * inData) { inOwner->cpuDispatcher = inData; } +inline PxCudaContextManager * getPxSceneDescCudaContextManager( const PxSceneDesc* inOwner ) { return inOwner->cudaContextManager; } +inline void setPxSceneDescCudaContextManager( PxSceneDesc* inOwner, PxCudaContextManager * inData) { inOwner->cudaContextManager = inData; } +inline void * getPxSceneDescUserData( const PxSceneDesc* inOwner ) { return inOwner->userData; } +inline void setPxSceneDescUserData( PxSceneDesc* inOwner, void * inData) { inOwner->userData = inData; } +inline PxU32 getPxSceneDescSolverBatchSize( const PxSceneDesc* inOwner ) { return inOwner->solverBatchSize; } +inline void setPxSceneDescSolverBatchSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->solverBatchSize = inData; } +inline PxU32 getPxSceneDescSolverArticulationBatchSize( const PxSceneDesc* inOwner ) { return inOwner->solverArticulationBatchSize; } +inline void setPxSceneDescSolverArticulationBatchSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->solverArticulationBatchSize = inData; } +inline PxU32 getPxSceneDescNbContactDataBlocks( const PxSceneDesc* inOwner ) { return inOwner->nbContactDataBlocks; } +inline void setPxSceneDescNbContactDataBlocks( PxSceneDesc* inOwner, PxU32 inData) { inOwner->nbContactDataBlocks = inData; } +inline PxU32 getPxSceneDescMaxNbContactDataBlocks( const PxSceneDesc* inOwner ) { return inOwner->maxNbContactDataBlocks; } +inline void setPxSceneDescMaxNbContactDataBlocks( PxSceneDesc* inOwner, PxU32 inData) { inOwner->maxNbContactDataBlocks = inData; } +inline PxReal getPxSceneDescMaxBiasCoefficient( const PxSceneDesc* inOwner ) { return inOwner->maxBiasCoefficient; } +inline void setPxSceneDescMaxBiasCoefficient( PxSceneDesc* inOwner, PxReal inData) { inOwner->maxBiasCoefficient = inData; } +inline PxU32 getPxSceneDescContactReportStreamBufferSize( const PxSceneDesc* inOwner ) { return inOwner->contactReportStreamBufferSize; } +inline void setPxSceneDescContactReportStreamBufferSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->contactReportStreamBufferSize = inData; } +inline PxU32 getPxSceneDescCcdMaxPasses( const PxSceneDesc* inOwner ) { return inOwner->ccdMaxPasses; } +inline void setPxSceneDescCcdMaxPasses( PxSceneDesc* inOwner, PxU32 inData) { inOwner->ccdMaxPasses = inData; } +inline PxReal getPxSceneDescCcdThreshold( const PxSceneDesc* inOwner ) { return inOwner->ccdThreshold; } +inline void setPxSceneDescCcdThreshold( PxSceneDesc* inOwner, PxReal inData) { inOwner->ccdThreshold = inData; } +inline PxReal getPxSceneDescCcdMaxSeparation( const PxSceneDesc* inOwner ) { return inOwner->ccdMaxSeparation; } +inline void setPxSceneDescCcdMaxSeparation( PxSceneDesc* inOwner, PxReal inData) { inOwner->ccdMaxSeparation = inData; } +inline PxReal getPxSceneDescWakeCounterResetValue( const PxSceneDesc* inOwner ) { return inOwner->wakeCounterResetValue; } +inline void setPxSceneDescWakeCounterResetValue( PxSceneDesc* inOwner, PxReal inData) { inOwner->wakeCounterResetValue = inData; } +inline PxBounds3 getPxSceneDescSanityBounds( const PxSceneDesc* inOwner ) { return inOwner->sanityBounds; } +inline void setPxSceneDescSanityBounds( PxSceneDesc* inOwner, PxBounds3 inData) { inOwner->sanityBounds = inData; } +inline PxgDynamicsMemoryConfig getPxSceneDescGpuDynamicsConfig( const PxSceneDesc* inOwner ) { return inOwner->gpuDynamicsConfig; } +inline void setPxSceneDescGpuDynamicsConfig( PxSceneDesc* inOwner, PxgDynamicsMemoryConfig inData) { inOwner->gpuDynamicsConfig = inData; } +inline PxU32 getPxSceneDescGpuMaxNumPartitions( const PxSceneDesc* inOwner ) { return inOwner->gpuMaxNumPartitions; } +inline void setPxSceneDescGpuMaxNumPartitions( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuMaxNumPartitions = inData; } +inline PxU32 getPxSceneDescGpuMaxNumStaticPartitions( const PxSceneDesc* inOwner ) { return inOwner->gpuMaxNumStaticPartitions; } +inline void setPxSceneDescGpuMaxNumStaticPartitions( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuMaxNumStaticPartitions = inData; } +inline PxU32 getPxSceneDescGpuComputeVersion( const PxSceneDesc* inOwner ) { return inOwner->gpuComputeVersion; } +inline void setPxSceneDescGpuComputeVersion( PxSceneDesc* inOwner, PxU32 inData) { inOwner->gpuComputeVersion = inData; } +inline PxU32 getPxSceneDescContactPairSlabSize( const PxSceneDesc* inOwner ) { return inOwner->contactPairSlabSize; } +inline void setPxSceneDescContactPairSlabSize( PxSceneDesc* inOwner, PxU32 inData) { inOwner->contactPairSlabSize = inData; } +PX_PHYSX_CORE_API PxSceneDescGeneratedInfo::PxSceneDescGeneratedInfo() + : ToDefault( "ToDefault", setPxSceneDesc_ToDefault) + , Gravity( "Gravity", setPxSceneDescGravity, getPxSceneDescGravity ) + , SimulationEventCallback( "SimulationEventCallback", setPxSceneDescSimulationEventCallback, getPxSceneDescSimulationEventCallback ) + , ContactModifyCallback( "ContactModifyCallback", setPxSceneDescContactModifyCallback, getPxSceneDescContactModifyCallback ) + , CcdContactModifyCallback( "CcdContactModifyCallback", setPxSceneDescCcdContactModifyCallback, getPxSceneDescCcdContactModifyCallback ) + , FilterShaderData( "FilterShaderData", setPxSceneDescFilterShaderData, getPxSceneDescFilterShaderData ) + , FilterShaderDataSize( "FilterShaderDataSize", setPxSceneDescFilterShaderDataSize, getPxSceneDescFilterShaderDataSize ) + , FilterShader( "FilterShader", setPxSceneDescFilterShader, getPxSceneDescFilterShader ) + , FilterCallback( "FilterCallback", setPxSceneDescFilterCallback, getPxSceneDescFilterCallback ) + , KineKineFilteringMode( "KineKineFilteringMode", setPxSceneDescKineKineFilteringMode, getPxSceneDescKineKineFilteringMode ) + , StaticKineFilteringMode( "StaticKineFilteringMode", setPxSceneDescStaticKineFilteringMode, getPxSceneDescStaticKineFilteringMode ) + , BroadPhaseType( "BroadPhaseType", setPxSceneDescBroadPhaseType, getPxSceneDescBroadPhaseType ) + , BroadPhaseCallback( "BroadPhaseCallback", setPxSceneDescBroadPhaseCallback, getPxSceneDescBroadPhaseCallback ) + , Limits( "Limits", setPxSceneDescLimits, getPxSceneDescLimits ) + , FrictionType( "FrictionType", setPxSceneDescFrictionType, getPxSceneDescFrictionType ) + , SolverType( "SolverType", setPxSceneDescSolverType, getPxSceneDescSolverType ) + , BounceThresholdVelocity( "BounceThresholdVelocity", setPxSceneDescBounceThresholdVelocity, getPxSceneDescBounceThresholdVelocity ) + , FrictionOffsetThreshold( "FrictionOffsetThreshold", setPxSceneDescFrictionOffsetThreshold, getPxSceneDescFrictionOffsetThreshold ) + , FrictionCorrelationDistance( "FrictionCorrelationDistance", setPxSceneDescFrictionCorrelationDistance, getPxSceneDescFrictionCorrelationDistance ) + , Flags( "Flags", setPxSceneDescFlags, getPxSceneDescFlags ) + , CpuDispatcher( "CpuDispatcher", setPxSceneDescCpuDispatcher, getPxSceneDescCpuDispatcher ) + , CudaContextManager( "CudaContextManager", setPxSceneDescCudaContextManager, getPxSceneDescCudaContextManager ) + , UserData( "UserData", setPxSceneDescUserData, getPxSceneDescUserData ) + , SolverBatchSize( "SolverBatchSize", setPxSceneDescSolverBatchSize, getPxSceneDescSolverBatchSize ) + , SolverArticulationBatchSize( "SolverArticulationBatchSize", setPxSceneDescSolverArticulationBatchSize, getPxSceneDescSolverArticulationBatchSize ) + , NbContactDataBlocks( "NbContactDataBlocks", setPxSceneDescNbContactDataBlocks, getPxSceneDescNbContactDataBlocks ) + , MaxNbContactDataBlocks( "MaxNbContactDataBlocks", setPxSceneDescMaxNbContactDataBlocks, getPxSceneDescMaxNbContactDataBlocks ) + , MaxBiasCoefficient( "MaxBiasCoefficient", setPxSceneDescMaxBiasCoefficient, getPxSceneDescMaxBiasCoefficient ) + , ContactReportStreamBufferSize( "ContactReportStreamBufferSize", setPxSceneDescContactReportStreamBufferSize, getPxSceneDescContactReportStreamBufferSize ) + , CcdMaxPasses( "CcdMaxPasses", setPxSceneDescCcdMaxPasses, getPxSceneDescCcdMaxPasses ) + , CcdThreshold( "CcdThreshold", setPxSceneDescCcdThreshold, getPxSceneDescCcdThreshold ) + , CcdMaxSeparation( "CcdMaxSeparation", setPxSceneDescCcdMaxSeparation, getPxSceneDescCcdMaxSeparation ) + , WakeCounterResetValue( "WakeCounterResetValue", setPxSceneDescWakeCounterResetValue, getPxSceneDescWakeCounterResetValue ) + , SanityBounds( "SanityBounds", setPxSceneDescSanityBounds, getPxSceneDescSanityBounds ) + , GpuDynamicsConfig( "GpuDynamicsConfig", setPxSceneDescGpuDynamicsConfig, getPxSceneDescGpuDynamicsConfig ) + , GpuMaxNumPartitions( "GpuMaxNumPartitions", setPxSceneDescGpuMaxNumPartitions, getPxSceneDescGpuMaxNumPartitions ) + , GpuMaxNumStaticPartitions( "GpuMaxNumStaticPartitions", setPxSceneDescGpuMaxNumStaticPartitions, getPxSceneDescGpuMaxNumStaticPartitions ) + , GpuComputeVersion( "GpuComputeVersion", setPxSceneDescGpuComputeVersion, getPxSceneDescGpuComputeVersion ) + , ContactPairSlabSize( "ContactPairSlabSize", setPxSceneDescContactPairSlabSize, getPxSceneDescContactPairSlabSize ) +{} +PX_PHYSX_CORE_API PxSceneDescGeneratedValues::PxSceneDescGeneratedValues( const PxSceneDesc* inSource ) + :PxSceneQueryDescGeneratedValues( inSource ) + ,Gravity( inSource->gravity ) + ,SimulationEventCallback( inSource->simulationEventCallback ) + ,ContactModifyCallback( inSource->contactModifyCallback ) + ,CcdContactModifyCallback( inSource->ccdContactModifyCallback ) + ,FilterShaderData( inSource->filterShaderData ) + ,FilterShaderDataSize( inSource->filterShaderDataSize ) + ,FilterShader( inSource->filterShader ) + ,FilterCallback( inSource->filterCallback ) + ,KineKineFilteringMode( inSource->kineKineFilteringMode ) + ,StaticKineFilteringMode( inSource->staticKineFilteringMode ) + ,BroadPhaseType( inSource->broadPhaseType ) + ,BroadPhaseCallback( inSource->broadPhaseCallback ) + ,Limits( inSource->limits ) + ,FrictionType( inSource->frictionType ) + ,SolverType( inSource->solverType ) + ,BounceThresholdVelocity( inSource->bounceThresholdVelocity ) + ,FrictionOffsetThreshold( inSource->frictionOffsetThreshold ) + ,FrictionCorrelationDistance( inSource->frictionCorrelationDistance ) + ,Flags( inSource->flags ) + ,CpuDispatcher( inSource->cpuDispatcher ) + ,CudaContextManager( inSource->cudaContextManager ) + ,UserData( inSource->userData ) + ,SolverBatchSize( inSource->solverBatchSize ) + ,SolverArticulationBatchSize( inSource->solverArticulationBatchSize ) + ,NbContactDataBlocks( inSource->nbContactDataBlocks ) + ,MaxNbContactDataBlocks( inSource->maxNbContactDataBlocks ) + ,MaxBiasCoefficient( inSource->maxBiasCoefficient ) + ,ContactReportStreamBufferSize( inSource->contactReportStreamBufferSize ) + ,CcdMaxPasses( inSource->ccdMaxPasses ) + ,CcdThreshold( inSource->ccdThreshold ) + ,CcdMaxSeparation( inSource->ccdMaxSeparation ) + ,WakeCounterResetValue( inSource->wakeCounterResetValue ) + ,SanityBounds( inSource->sanityBounds ) + ,GpuDynamicsConfig( inSource->gpuDynamicsConfig ) + ,GpuMaxNumPartitions( inSource->gpuMaxNumPartitions ) + ,GpuMaxNumStaticPartitions( inSource->gpuMaxNumStaticPartitions ) + ,GpuComputeVersion( inSource->gpuComputeVersion ) + ,ContactPairSlabSize( inSource->contactPairSlabSize ) +{ + PX_UNUSED(inSource); +} +_Bool getPxBroadPhaseDesc_IsValid( const PxBroadPhaseDesc* inObj ) { return inObj->isValid(); } +inline PxBroadPhaseType::Enum getPxBroadPhaseDescMType( const PxBroadPhaseDesc* inOwner ) { return inOwner->mType; } +inline void setPxBroadPhaseDescMType( PxBroadPhaseDesc* inOwner, PxBroadPhaseType::Enum inData) { inOwner->mType = inData; } +inline PxU64 getPxBroadPhaseDescMContextID( const PxBroadPhaseDesc* inOwner ) { return inOwner->mContextID; } +inline void setPxBroadPhaseDescMContextID( PxBroadPhaseDesc* inOwner, PxU64 inData) { inOwner->mContextID = inData; } +inline PxCudaContextManager * getPxBroadPhaseDescMContextManager( const PxBroadPhaseDesc* inOwner ) { return inOwner->mContextManager; } +inline void setPxBroadPhaseDescMContextManager( PxBroadPhaseDesc* inOwner, PxCudaContextManager * inData) { inOwner->mContextManager = inData; } +inline PxU32 getPxBroadPhaseDescMFoundLostPairsCapacity( const PxBroadPhaseDesc* inOwner ) { return inOwner->mFoundLostPairsCapacity; } +inline void setPxBroadPhaseDescMFoundLostPairsCapacity( PxBroadPhaseDesc* inOwner, PxU32 inData) { inOwner->mFoundLostPairsCapacity = inData; } +inline _Bool getPxBroadPhaseDescMDiscardStaticVsKinematic( const PxBroadPhaseDesc* inOwner ) { return inOwner->mDiscardStaticVsKinematic; } +inline void setPxBroadPhaseDescMDiscardStaticVsKinematic( PxBroadPhaseDesc* inOwner, _Bool inData) { inOwner->mDiscardStaticVsKinematic = inData; } +inline _Bool getPxBroadPhaseDescMDiscardKinematicVsKinematic( const PxBroadPhaseDesc* inOwner ) { return inOwner->mDiscardKinematicVsKinematic; } +inline void setPxBroadPhaseDescMDiscardKinematicVsKinematic( PxBroadPhaseDesc* inOwner, _Bool inData) { inOwner->mDiscardKinematicVsKinematic = inData; } +PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedInfo::PxBroadPhaseDescGeneratedInfo() + : IsValid( "IsValid", getPxBroadPhaseDesc_IsValid) + , MType( "MType", setPxBroadPhaseDescMType, getPxBroadPhaseDescMType ) + , MContextID( "MContextID", setPxBroadPhaseDescMContextID, getPxBroadPhaseDescMContextID ) + , MContextManager( "MContextManager", setPxBroadPhaseDescMContextManager, getPxBroadPhaseDescMContextManager ) + , MFoundLostPairsCapacity( "MFoundLostPairsCapacity", setPxBroadPhaseDescMFoundLostPairsCapacity, getPxBroadPhaseDescMFoundLostPairsCapacity ) + , MDiscardStaticVsKinematic( "MDiscardStaticVsKinematic", setPxBroadPhaseDescMDiscardStaticVsKinematic, getPxBroadPhaseDescMDiscardStaticVsKinematic ) + , MDiscardKinematicVsKinematic( "MDiscardKinematicVsKinematic", setPxBroadPhaseDescMDiscardKinematicVsKinematic, getPxBroadPhaseDescMDiscardKinematicVsKinematic ) +{} +PX_PHYSX_CORE_API PxBroadPhaseDescGeneratedValues::PxBroadPhaseDescGeneratedValues( const PxBroadPhaseDesc* inSource ) + :IsValid( getPxBroadPhaseDesc_IsValid( inSource ) ) + ,MType( inSource->mType ) + ,MContextID( inSource->mContextID ) + ,MContextManager( inSource->mContextManager ) + ,MFoundLostPairsCapacity( inSource->mFoundLostPairsCapacity ) + ,MDiscardStaticVsKinematic( inSource->mDiscardStaticVsKinematic ) + ,MDiscardKinematicVsKinematic( inSource->mDiscardKinematicVsKinematic ) +{ + PX_UNUSED(inSource); +} +inline PxU32 getPxSceneLimitsMaxNbActors( const PxSceneLimits* inOwner ) { return inOwner->maxNbActors; } +inline void setPxSceneLimitsMaxNbActors( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbActors = inData; } +inline PxU32 getPxSceneLimitsMaxNbBodies( const PxSceneLimits* inOwner ) { return inOwner->maxNbBodies; } +inline void setPxSceneLimitsMaxNbBodies( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbBodies = inData; } +inline PxU32 getPxSceneLimitsMaxNbStaticShapes( const PxSceneLimits* inOwner ) { return inOwner->maxNbStaticShapes; } +inline void setPxSceneLimitsMaxNbStaticShapes( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbStaticShapes = inData; } +inline PxU32 getPxSceneLimitsMaxNbDynamicShapes( const PxSceneLimits* inOwner ) { return inOwner->maxNbDynamicShapes; } +inline void setPxSceneLimitsMaxNbDynamicShapes( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbDynamicShapes = inData; } +inline PxU32 getPxSceneLimitsMaxNbAggregates( const PxSceneLimits* inOwner ) { return inOwner->maxNbAggregates; } +inline void setPxSceneLimitsMaxNbAggregates( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbAggregates = inData; } +inline PxU32 getPxSceneLimitsMaxNbConstraints( const PxSceneLimits* inOwner ) { return inOwner->maxNbConstraints; } +inline void setPxSceneLimitsMaxNbConstraints( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbConstraints = inData; } +inline PxU32 getPxSceneLimitsMaxNbRegions( const PxSceneLimits* inOwner ) { return inOwner->maxNbRegions; } +inline void setPxSceneLimitsMaxNbRegions( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbRegions = inData; } +inline PxU32 getPxSceneLimitsMaxNbBroadPhaseOverlaps( const PxSceneLimits* inOwner ) { return inOwner->maxNbBroadPhaseOverlaps; } +inline void setPxSceneLimitsMaxNbBroadPhaseOverlaps( PxSceneLimits* inOwner, PxU32 inData) { inOwner->maxNbBroadPhaseOverlaps = inData; } +PX_PHYSX_CORE_API PxSceneLimitsGeneratedInfo::PxSceneLimitsGeneratedInfo() + : MaxNbActors( "MaxNbActors", setPxSceneLimitsMaxNbActors, getPxSceneLimitsMaxNbActors ) + , MaxNbBodies( "MaxNbBodies", setPxSceneLimitsMaxNbBodies, getPxSceneLimitsMaxNbBodies ) + , MaxNbStaticShapes( "MaxNbStaticShapes", setPxSceneLimitsMaxNbStaticShapes, getPxSceneLimitsMaxNbStaticShapes ) + , MaxNbDynamicShapes( "MaxNbDynamicShapes", setPxSceneLimitsMaxNbDynamicShapes, getPxSceneLimitsMaxNbDynamicShapes ) + , MaxNbAggregates( "MaxNbAggregates", setPxSceneLimitsMaxNbAggregates, getPxSceneLimitsMaxNbAggregates ) + , MaxNbConstraints( "MaxNbConstraints", setPxSceneLimitsMaxNbConstraints, getPxSceneLimitsMaxNbConstraints ) + , MaxNbRegions( "MaxNbRegions", setPxSceneLimitsMaxNbRegions, getPxSceneLimitsMaxNbRegions ) + , MaxNbBroadPhaseOverlaps( "MaxNbBroadPhaseOverlaps", setPxSceneLimitsMaxNbBroadPhaseOverlaps, getPxSceneLimitsMaxNbBroadPhaseOverlaps ) +{} +PX_PHYSX_CORE_API PxSceneLimitsGeneratedValues::PxSceneLimitsGeneratedValues( const PxSceneLimits* inSource ) + :MaxNbActors( inSource->maxNbActors ) + ,MaxNbBodies( inSource->maxNbBodies ) + ,MaxNbStaticShapes( inSource->maxNbStaticShapes ) + ,MaxNbDynamicShapes( inSource->maxNbDynamicShapes ) + ,MaxNbAggregates( inSource->maxNbAggregates ) + ,MaxNbConstraints( inSource->maxNbConstraints ) + ,MaxNbRegions( inSource->maxNbRegions ) + ,MaxNbBroadPhaseOverlaps( inSource->maxNbBroadPhaseOverlaps ) +{ + PX_UNUSED(inSource); +} +_Bool getPxgDynamicsMemoryConfig_IsValid( const PxgDynamicsMemoryConfig* inObj ) { return inObj->isValid(); } +inline PxU32 getPxgDynamicsMemoryConfigTempBufferCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->tempBufferCapacity; } +inline void setPxgDynamicsMemoryConfigTempBufferCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->tempBufferCapacity = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxRigidContactCount( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxRigidContactCount; } +inline void setPxgDynamicsMemoryConfigMaxRigidContactCount( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxRigidContactCount = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxRigidPatchCount( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxRigidPatchCount; } +inline void setPxgDynamicsMemoryConfigMaxRigidPatchCount( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxRigidPatchCount = inData; } +inline PxU32 getPxgDynamicsMemoryConfigHeapCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->heapCapacity; } +inline void setPxgDynamicsMemoryConfigHeapCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->heapCapacity = inData; } +inline PxU32 getPxgDynamicsMemoryConfigFoundLostPairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->foundLostPairsCapacity; } +inline void setPxgDynamicsMemoryConfigFoundLostPairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->foundLostPairsCapacity = inData; } +inline PxU32 getPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->foundLostAggregatePairsCapacity; } +inline void setPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->foundLostAggregatePairsCapacity = inData; } +inline PxU32 getPxgDynamicsMemoryConfigTotalAggregatePairsCapacity( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->totalAggregatePairsCapacity; } +inline void setPxgDynamicsMemoryConfigTotalAggregatePairsCapacity( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->totalAggregatePairsCapacity = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxSoftBodyContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxSoftBodyContacts; } +inline void setPxgDynamicsMemoryConfigMaxSoftBodyContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxSoftBodyContacts = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxFemClothContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxFemClothContacts; } +inline void setPxgDynamicsMemoryConfigMaxFemClothContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxFemClothContacts = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxParticleContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxParticleContacts; } +inline void setPxgDynamicsMemoryConfigMaxParticleContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxParticleContacts = inData; } +inline PxU32 getPxgDynamicsMemoryConfigCollisionStackSize( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->collisionStackSize; } +inline void setPxgDynamicsMemoryConfigCollisionStackSize( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->collisionStackSize = inData; } +inline PxU32 getPxgDynamicsMemoryConfigMaxHairContacts( const PxgDynamicsMemoryConfig* inOwner ) { return inOwner->maxHairContacts; } +inline void setPxgDynamicsMemoryConfigMaxHairContacts( PxgDynamicsMemoryConfig* inOwner, PxU32 inData) { inOwner->maxHairContacts = inData; } +PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedInfo::PxgDynamicsMemoryConfigGeneratedInfo() + : IsValid( "IsValid", getPxgDynamicsMemoryConfig_IsValid) + , TempBufferCapacity( "TempBufferCapacity", setPxgDynamicsMemoryConfigTempBufferCapacity, getPxgDynamicsMemoryConfigTempBufferCapacity ) + , MaxRigidContactCount( "MaxRigidContactCount", setPxgDynamicsMemoryConfigMaxRigidContactCount, getPxgDynamicsMemoryConfigMaxRigidContactCount ) + , MaxRigidPatchCount( "MaxRigidPatchCount", setPxgDynamicsMemoryConfigMaxRigidPatchCount, getPxgDynamicsMemoryConfigMaxRigidPatchCount ) + , HeapCapacity( "HeapCapacity", setPxgDynamicsMemoryConfigHeapCapacity, getPxgDynamicsMemoryConfigHeapCapacity ) + , FoundLostPairsCapacity( "FoundLostPairsCapacity", setPxgDynamicsMemoryConfigFoundLostPairsCapacity, getPxgDynamicsMemoryConfigFoundLostPairsCapacity ) + , FoundLostAggregatePairsCapacity( "FoundLostAggregatePairsCapacity", setPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity, getPxgDynamicsMemoryConfigFoundLostAggregatePairsCapacity ) + , TotalAggregatePairsCapacity( "TotalAggregatePairsCapacity", setPxgDynamicsMemoryConfigTotalAggregatePairsCapacity, getPxgDynamicsMemoryConfigTotalAggregatePairsCapacity ) + , MaxSoftBodyContacts( "MaxSoftBodyContacts", setPxgDynamicsMemoryConfigMaxSoftBodyContacts, getPxgDynamicsMemoryConfigMaxSoftBodyContacts ) + , MaxFemClothContacts( "MaxFemClothContacts", setPxgDynamicsMemoryConfigMaxFemClothContacts, getPxgDynamicsMemoryConfigMaxFemClothContacts ) + , MaxParticleContacts( "MaxParticleContacts", setPxgDynamicsMemoryConfigMaxParticleContacts, getPxgDynamicsMemoryConfigMaxParticleContacts ) + , CollisionStackSize( "CollisionStackSize", setPxgDynamicsMemoryConfigCollisionStackSize, getPxgDynamicsMemoryConfigCollisionStackSize ) + , MaxHairContacts( "MaxHairContacts", setPxgDynamicsMemoryConfigMaxHairContacts, getPxgDynamicsMemoryConfigMaxHairContacts ) +{} +PX_PHYSX_CORE_API PxgDynamicsMemoryConfigGeneratedValues::PxgDynamicsMemoryConfigGeneratedValues( const PxgDynamicsMemoryConfig* inSource ) + :IsValid( getPxgDynamicsMemoryConfig_IsValid( inSource ) ) + ,TempBufferCapacity( inSource->tempBufferCapacity ) + ,MaxRigidContactCount( inSource->maxRigidContactCount ) + ,MaxRigidPatchCount( inSource->maxRigidPatchCount ) + ,HeapCapacity( inSource->heapCapacity ) + ,FoundLostPairsCapacity( inSource->foundLostPairsCapacity ) + ,FoundLostAggregatePairsCapacity( inSource->foundLostAggregatePairsCapacity ) + ,TotalAggregatePairsCapacity( inSource->totalAggregatePairsCapacity ) + ,MaxSoftBodyContacts( inSource->maxSoftBodyContacts ) + ,MaxFemClothContacts( inSource->maxFemClothContacts ) + ,MaxParticleContacts( inSource->maxParticleContacts ) + ,CollisionStackSize( inSource->collisionStackSize ) + ,MaxHairContacts( inSource->maxHairContacts ) +{ + PX_UNUSED(inSource); +} +inline PxU32 getPxSimulationStatisticsNbActiveConstraints( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveConstraints; } +inline void setPxSimulationStatisticsNbActiveConstraints( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveConstraints = inData; } +inline PxU32 getPxSimulationStatisticsNbActiveDynamicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveDynamicBodies; } +inline void setPxSimulationStatisticsNbActiveDynamicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveDynamicBodies = inData; } +inline PxU32 getPxSimulationStatisticsNbActiveKinematicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbActiveKinematicBodies; } +inline void setPxSimulationStatisticsNbActiveKinematicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbActiveKinematicBodies = inData; } +inline PxU32 getPxSimulationStatisticsNbStaticBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbStaticBodies; } +inline void setPxSimulationStatisticsNbStaticBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbStaticBodies = inData; } +inline PxU32 getPxSimulationStatisticsNbDynamicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbDynamicBodies; } +inline void setPxSimulationStatisticsNbDynamicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDynamicBodies = inData; } +inline PxU32 getPxSimulationStatisticsNbKinematicBodies( const PxSimulationStatistics* inOwner ) { return inOwner->nbKinematicBodies; } +inline void setPxSimulationStatisticsNbKinematicBodies( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbKinematicBodies = inData; } +inline PxU32 getPxSimulationStatisticsNbAggregates( const PxSimulationStatistics* inOwner ) { return inOwner->nbAggregates; } +inline void setPxSimulationStatisticsNbAggregates( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbAggregates = inData; } +inline PxU32 getPxSimulationStatisticsNbArticulations( const PxSimulationStatistics* inOwner ) { return inOwner->nbArticulations; } +inline void setPxSimulationStatisticsNbArticulations( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbArticulations = inData; } +inline PxU32 getPxSimulationStatisticsNbAxisSolverConstraints( const PxSimulationStatistics* inOwner ) { return inOwner->nbAxisSolverConstraints; } +inline void setPxSimulationStatisticsNbAxisSolverConstraints( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbAxisSolverConstraints = inData; } +inline PxU32 getPxSimulationStatisticsCompressedContactSize( const PxSimulationStatistics* inOwner ) { return inOwner->compressedContactSize; } +inline void setPxSimulationStatisticsCompressedContactSize( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->compressedContactSize = inData; } +inline PxU32 getPxSimulationStatisticsRequiredContactConstraintMemory( const PxSimulationStatistics* inOwner ) { return inOwner->requiredContactConstraintMemory; } +inline void setPxSimulationStatisticsRequiredContactConstraintMemory( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->requiredContactConstraintMemory = inData; } +inline PxU32 getPxSimulationStatisticsPeakConstraintMemory( const PxSimulationStatistics* inOwner ) { return inOwner->peakConstraintMemory; } +inline void setPxSimulationStatisticsPeakConstraintMemory( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->peakConstraintMemory = inData; } +inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsTotal( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsTotal; } +inline void setPxSimulationStatisticsNbDiscreteContactPairsTotal( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsTotal = inData; } +inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsWithCacheHits; } +inline void setPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsWithCacheHits = inData; } +inline PxU32 getPxSimulationStatisticsNbDiscreteContactPairsWithContacts( const PxSimulationStatistics* inOwner ) { return inOwner->nbDiscreteContactPairsWithContacts; } +inline void setPxSimulationStatisticsNbDiscreteContactPairsWithContacts( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbDiscreteContactPairsWithContacts = inData; } +inline PxU32 getPxSimulationStatisticsNbNewPairs( const PxSimulationStatistics* inOwner ) { return inOwner->nbNewPairs; } +inline void setPxSimulationStatisticsNbNewPairs( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbNewPairs = inData; } +inline PxU32 getPxSimulationStatisticsNbLostPairs( const PxSimulationStatistics* inOwner ) { return inOwner->nbLostPairs; } +inline void setPxSimulationStatisticsNbLostPairs( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbLostPairs = inData; } +inline PxU32 getPxSimulationStatisticsNbNewTouches( const PxSimulationStatistics* inOwner ) { return inOwner->nbNewTouches; } +inline void setPxSimulationStatisticsNbNewTouches( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbNewTouches = inData; } +inline PxU32 getPxSimulationStatisticsNbLostTouches( const PxSimulationStatistics* inOwner ) { return inOwner->nbLostTouches; } +inline void setPxSimulationStatisticsNbLostTouches( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbLostTouches = inData; } +inline PxU32 getPxSimulationStatisticsNbPartitions( const PxSimulationStatistics* inOwner ) { return inOwner->nbPartitions; } +inline void setPxSimulationStatisticsNbPartitions( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbPartitions = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemParticles; } +inline void setPxSimulationStatisticsGpuMemParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemParticles = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemSoftBodies( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemSoftBodies; } +inline void setPxSimulationStatisticsGpuMemSoftBodies( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemSoftBodies = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemFEMCloths( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemFEMCloths; } +inline void setPxSimulationStatisticsGpuMemFEMCloths( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemFEMCloths = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHairSystems( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHairSystems; } +inline void setPxSimulationStatisticsGpuMemHairSystems( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHairSystems = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeap( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeap; } +inline void setPxSimulationStatisticsGpuMemHeap( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeap = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapBroadPhase( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapBroadPhase; } +inline void setPxSimulationStatisticsGpuMemHeapBroadPhase( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapBroadPhase = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapNarrowPhase( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapNarrowPhase; } +inline void setPxSimulationStatisticsGpuMemHeapNarrowPhase( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapNarrowPhase = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSolver( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSolver; } +inline void setPxSimulationStatisticsGpuMemHeapSolver( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSolver = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapArticulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapArticulation; } +inline void setPxSimulationStatisticsGpuMemHeapArticulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapArticulation = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulation; } +inline void setPxSimulationStatisticsGpuMemHeapSimulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulation = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationArticulation( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationArticulation; } +inline void setPxSimulationStatisticsGpuMemHeapSimulationArticulation( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationArticulation = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationParticles; } +inline void setPxSimulationStatisticsGpuMemHeapSimulationParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationParticles = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationSoftBody( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationSoftBody; } +inline void setPxSimulationStatisticsGpuMemHeapSimulationSoftBody( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationSoftBody = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationFEMCloth( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationFEMCloth; } +inline void setPxSimulationStatisticsGpuMemHeapSimulationFEMCloth( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationFEMCloth = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSimulationHairSystem( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSimulationHairSystem; } +inline void setPxSimulationStatisticsGpuMemHeapSimulationHairSystem( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSimulationHairSystem = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapParticles( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapParticles; } +inline void setPxSimulationStatisticsGpuMemHeapParticles( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapParticles = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapSoftBodies( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapSoftBodies; } +inline void setPxSimulationStatisticsGpuMemHeapSoftBodies( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapSoftBodies = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapFEMCloths( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapFEMCloths; } +inline void setPxSimulationStatisticsGpuMemHeapFEMCloths( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapFEMCloths = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapHairSystems( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapHairSystems; } +inline void setPxSimulationStatisticsGpuMemHeapHairSystems( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapHairSystems = inData; } +inline PxU64 getPxSimulationStatisticsGpuMemHeapOther( const PxSimulationStatistics* inOwner ) { return inOwner->gpuMemHeapOther; } +inline void setPxSimulationStatisticsGpuMemHeapOther( PxSimulationStatistics* inOwner, PxU64 inData) { inOwner->gpuMemHeapOther = inData; } +inline PxU32 getPxSimulationStatisticsNbBroadPhaseAdds( const PxSimulationStatistics* inOwner ) { return inOwner->nbBroadPhaseAdds; } +inline void setPxSimulationStatisticsNbBroadPhaseAdds( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbBroadPhaseAdds = inData; } +inline PxU32 getPxSimulationStatisticsNbBroadPhaseRemoves( const PxSimulationStatistics* inOwner ) { return inOwner->nbBroadPhaseRemoves; } +inline void setPxSimulationStatisticsNbBroadPhaseRemoves( PxSimulationStatistics* inOwner, PxU32 inData) { inOwner->nbBroadPhaseRemoves = inData; } +PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedInfo::PxSimulationStatisticsGeneratedInfo() + : NbActiveConstraints( "NbActiveConstraints", setPxSimulationStatisticsNbActiveConstraints, getPxSimulationStatisticsNbActiveConstraints ) + , NbActiveDynamicBodies( "NbActiveDynamicBodies", setPxSimulationStatisticsNbActiveDynamicBodies, getPxSimulationStatisticsNbActiveDynamicBodies ) + , NbActiveKinematicBodies( "NbActiveKinematicBodies", setPxSimulationStatisticsNbActiveKinematicBodies, getPxSimulationStatisticsNbActiveKinematicBodies ) + , NbStaticBodies( "NbStaticBodies", setPxSimulationStatisticsNbStaticBodies, getPxSimulationStatisticsNbStaticBodies ) + , NbDynamicBodies( "NbDynamicBodies", setPxSimulationStatisticsNbDynamicBodies, getPxSimulationStatisticsNbDynamicBodies ) + , NbKinematicBodies( "NbKinematicBodies", setPxSimulationStatisticsNbKinematicBodies, getPxSimulationStatisticsNbKinematicBodies ) + , NbAggregates( "NbAggregates", setPxSimulationStatisticsNbAggregates, getPxSimulationStatisticsNbAggregates ) + , NbArticulations( "NbArticulations", setPxSimulationStatisticsNbArticulations, getPxSimulationStatisticsNbArticulations ) + , NbAxisSolverConstraints( "NbAxisSolverConstraints", setPxSimulationStatisticsNbAxisSolverConstraints, getPxSimulationStatisticsNbAxisSolverConstraints ) + , CompressedContactSize( "CompressedContactSize", setPxSimulationStatisticsCompressedContactSize, getPxSimulationStatisticsCompressedContactSize ) + , RequiredContactConstraintMemory( "RequiredContactConstraintMemory", setPxSimulationStatisticsRequiredContactConstraintMemory, getPxSimulationStatisticsRequiredContactConstraintMemory ) + , PeakConstraintMemory( "PeakConstraintMemory", setPxSimulationStatisticsPeakConstraintMemory, getPxSimulationStatisticsPeakConstraintMemory ) + , NbDiscreteContactPairsTotal( "NbDiscreteContactPairsTotal", setPxSimulationStatisticsNbDiscreteContactPairsTotal, getPxSimulationStatisticsNbDiscreteContactPairsTotal ) + , NbDiscreteContactPairsWithCacheHits( "NbDiscreteContactPairsWithCacheHits", setPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits, getPxSimulationStatisticsNbDiscreteContactPairsWithCacheHits ) + , NbDiscreteContactPairsWithContacts( "NbDiscreteContactPairsWithContacts", setPxSimulationStatisticsNbDiscreteContactPairsWithContacts, getPxSimulationStatisticsNbDiscreteContactPairsWithContacts ) + , NbNewPairs( "NbNewPairs", setPxSimulationStatisticsNbNewPairs, getPxSimulationStatisticsNbNewPairs ) + , NbLostPairs( "NbLostPairs", setPxSimulationStatisticsNbLostPairs, getPxSimulationStatisticsNbLostPairs ) + , NbNewTouches( "NbNewTouches", setPxSimulationStatisticsNbNewTouches, getPxSimulationStatisticsNbNewTouches ) + , NbLostTouches( "NbLostTouches", setPxSimulationStatisticsNbLostTouches, getPxSimulationStatisticsNbLostTouches ) + , NbPartitions( "NbPartitions", setPxSimulationStatisticsNbPartitions, getPxSimulationStatisticsNbPartitions ) + , GpuMemParticles( "GpuMemParticles", setPxSimulationStatisticsGpuMemParticles, getPxSimulationStatisticsGpuMemParticles ) + , GpuMemSoftBodies( "GpuMemSoftBodies", setPxSimulationStatisticsGpuMemSoftBodies, getPxSimulationStatisticsGpuMemSoftBodies ) + , GpuMemFEMCloths( "GpuMemFEMCloths", setPxSimulationStatisticsGpuMemFEMCloths, getPxSimulationStatisticsGpuMemFEMCloths ) + , GpuMemHairSystems( "GpuMemHairSystems", setPxSimulationStatisticsGpuMemHairSystems, getPxSimulationStatisticsGpuMemHairSystems ) + , GpuMemHeap( "GpuMemHeap", setPxSimulationStatisticsGpuMemHeap, getPxSimulationStatisticsGpuMemHeap ) + , GpuMemHeapBroadPhase( "GpuMemHeapBroadPhase", setPxSimulationStatisticsGpuMemHeapBroadPhase, getPxSimulationStatisticsGpuMemHeapBroadPhase ) + , GpuMemHeapNarrowPhase( "GpuMemHeapNarrowPhase", setPxSimulationStatisticsGpuMemHeapNarrowPhase, getPxSimulationStatisticsGpuMemHeapNarrowPhase ) + , GpuMemHeapSolver( "GpuMemHeapSolver", setPxSimulationStatisticsGpuMemHeapSolver, getPxSimulationStatisticsGpuMemHeapSolver ) + , GpuMemHeapArticulation( "GpuMemHeapArticulation", setPxSimulationStatisticsGpuMemHeapArticulation, getPxSimulationStatisticsGpuMemHeapArticulation ) + , GpuMemHeapSimulation( "GpuMemHeapSimulation", setPxSimulationStatisticsGpuMemHeapSimulation, getPxSimulationStatisticsGpuMemHeapSimulation ) + , GpuMemHeapSimulationArticulation( "GpuMemHeapSimulationArticulation", setPxSimulationStatisticsGpuMemHeapSimulationArticulation, getPxSimulationStatisticsGpuMemHeapSimulationArticulation ) + , GpuMemHeapSimulationParticles( "GpuMemHeapSimulationParticles", setPxSimulationStatisticsGpuMemHeapSimulationParticles, getPxSimulationStatisticsGpuMemHeapSimulationParticles ) + , GpuMemHeapSimulationSoftBody( "GpuMemHeapSimulationSoftBody", setPxSimulationStatisticsGpuMemHeapSimulationSoftBody, getPxSimulationStatisticsGpuMemHeapSimulationSoftBody ) + , GpuMemHeapSimulationFEMCloth( "GpuMemHeapSimulationFEMCloth", setPxSimulationStatisticsGpuMemHeapSimulationFEMCloth, getPxSimulationStatisticsGpuMemHeapSimulationFEMCloth ) + , GpuMemHeapSimulationHairSystem( "GpuMemHeapSimulationHairSystem", setPxSimulationStatisticsGpuMemHeapSimulationHairSystem, getPxSimulationStatisticsGpuMemHeapSimulationHairSystem ) + , GpuMemHeapParticles( "GpuMemHeapParticles", setPxSimulationStatisticsGpuMemHeapParticles, getPxSimulationStatisticsGpuMemHeapParticles ) + , GpuMemHeapSoftBodies( "GpuMemHeapSoftBodies", setPxSimulationStatisticsGpuMemHeapSoftBodies, getPxSimulationStatisticsGpuMemHeapSoftBodies ) + , GpuMemHeapFEMCloths( "GpuMemHeapFEMCloths", setPxSimulationStatisticsGpuMemHeapFEMCloths, getPxSimulationStatisticsGpuMemHeapFEMCloths ) + , GpuMemHeapHairSystems( "GpuMemHeapHairSystems", setPxSimulationStatisticsGpuMemHeapHairSystems, getPxSimulationStatisticsGpuMemHeapHairSystems ) + , GpuMemHeapOther( "GpuMemHeapOther", setPxSimulationStatisticsGpuMemHeapOther, getPxSimulationStatisticsGpuMemHeapOther ) + , NbBroadPhaseAdds( "NbBroadPhaseAdds", setPxSimulationStatisticsNbBroadPhaseAdds, getPxSimulationStatisticsNbBroadPhaseAdds ) + , NbBroadPhaseRemoves( "NbBroadPhaseRemoves", setPxSimulationStatisticsNbBroadPhaseRemoves, getPxSimulationStatisticsNbBroadPhaseRemoves ) +{} +PX_PHYSX_CORE_API PxSimulationStatisticsGeneratedValues::PxSimulationStatisticsGeneratedValues( const PxSimulationStatistics* inSource ) + :NbActiveConstraints( inSource->nbActiveConstraints ) + ,NbActiveDynamicBodies( inSource->nbActiveDynamicBodies ) + ,NbActiveKinematicBodies( inSource->nbActiveKinematicBodies ) + ,NbStaticBodies( inSource->nbStaticBodies ) + ,NbDynamicBodies( inSource->nbDynamicBodies ) + ,NbKinematicBodies( inSource->nbKinematicBodies ) + ,NbAggregates( inSource->nbAggregates ) + ,NbArticulations( inSource->nbArticulations ) + ,NbAxisSolverConstraints( inSource->nbAxisSolverConstraints ) + ,CompressedContactSize( inSource->compressedContactSize ) + ,RequiredContactConstraintMemory( inSource->requiredContactConstraintMemory ) + ,PeakConstraintMemory( inSource->peakConstraintMemory ) + ,NbDiscreteContactPairsTotal( inSource->nbDiscreteContactPairsTotal ) + ,NbDiscreteContactPairsWithCacheHits( inSource->nbDiscreteContactPairsWithCacheHits ) + ,NbDiscreteContactPairsWithContacts( inSource->nbDiscreteContactPairsWithContacts ) + ,NbNewPairs( inSource->nbNewPairs ) + ,NbLostPairs( inSource->nbLostPairs ) + ,NbNewTouches( inSource->nbNewTouches ) + ,NbLostTouches( inSource->nbLostTouches ) + ,NbPartitions( inSource->nbPartitions ) + ,GpuMemParticles( inSource->gpuMemParticles ) + ,GpuMemSoftBodies( inSource->gpuMemSoftBodies ) + ,GpuMemFEMCloths( inSource->gpuMemFEMCloths ) + ,GpuMemHairSystems( inSource->gpuMemHairSystems ) + ,GpuMemHeap( inSource->gpuMemHeap ) + ,GpuMemHeapBroadPhase( inSource->gpuMemHeapBroadPhase ) + ,GpuMemHeapNarrowPhase( inSource->gpuMemHeapNarrowPhase ) + ,GpuMemHeapSolver( inSource->gpuMemHeapSolver ) + ,GpuMemHeapArticulation( inSource->gpuMemHeapArticulation ) + ,GpuMemHeapSimulation( inSource->gpuMemHeapSimulation ) + ,GpuMemHeapSimulationArticulation( inSource->gpuMemHeapSimulationArticulation ) + ,GpuMemHeapSimulationParticles( inSource->gpuMemHeapSimulationParticles ) + ,GpuMemHeapSimulationSoftBody( inSource->gpuMemHeapSimulationSoftBody ) + ,GpuMemHeapSimulationFEMCloth( inSource->gpuMemHeapSimulationFEMCloth ) + ,GpuMemHeapSimulationHairSystem( inSource->gpuMemHeapSimulationHairSystem ) + ,GpuMemHeapParticles( inSource->gpuMemHeapParticles ) + ,GpuMemHeapSoftBodies( inSource->gpuMemHeapSoftBodies ) + ,GpuMemHeapFEMCloths( inSource->gpuMemHeapFEMCloths ) + ,GpuMemHeapHairSystems( inSource->gpuMemHeapHairSystems ) + ,GpuMemHeapOther( inSource->gpuMemHeapOther ) + ,NbBroadPhaseAdds( inSource->nbBroadPhaseAdds ) + ,NbBroadPhaseRemoves( inSource->nbBroadPhaseRemoves ) +{ + PX_UNUSED(inSource); + PxMemCopy( NbDiscreteContactPairs, inSource->nbDiscreteContactPairs, sizeof( NbDiscreteContactPairs ) ); + PxMemCopy( NbModifiedContactPairs, inSource->nbModifiedContactPairs, sizeof( NbModifiedContactPairs ) ); + PxMemCopy( NbCCDPairs, inSource->nbCCDPairs, sizeof( NbCCDPairs ) ); + PxMemCopy( NbTriggerPairs, inSource->nbTriggerPairs, sizeof( NbTriggerPairs ) ); + PxMemCopy( NbShapes, inSource->nbShapes, sizeof( NbShapes ) ); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp new file mode 100644 index 0000000..3b8d119 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/core/src/PxMetaDataObjects.cpp @@ -0,0 +1,155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxUtilities.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxErrors.h" + +#include "PxMetaDataObjects.h" + +using namespace physx; + +PX_PHYSX_CORE_API PxGeometryType::Enum PxShapeGeomPropertyHelper::getGeometryType(const PxShape* inShape) const { return inShape->getGeometryType(); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxBoxGeometry& geometry) const { return inShape->getBoxGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxSphereGeometry& geometry) const { return inShape->getSphereGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxCapsuleGeometry& geometry) const { return inShape->getCapsuleGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxPlaneGeometry& geometry) const { return inShape->getPlaneGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxConvexMeshGeometry& geometry) const { return inShape->getConvexMeshGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxTetrahedronMeshGeometry& geometry) const { return inShape->getTetrahedronMeshGeometry(geometry); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxParticleSystemGeometry& geometry) const { return inShape->getParticleSystemGeometry(geometry); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxTriangleMeshGeometry& geometry) const { return inShape->getTriangleMeshGeometry( geometry ); } +PX_PHYSX_CORE_API bool PxShapeGeomPropertyHelper::getGeometry(const PxShape* inShape, PxHeightFieldGeometry& geometry) const { return inShape->getHeightFieldGeometry( geometry ); } + +PX_PHYSX_CORE_API void PxShapeMaterialsPropertyHelper::setMaterials(PxShape* inShape, PxMaterial*const* materials, PxU16 materialCount) const +{ + inShape->setMaterials( materials, materialCount ); +} + +PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial& material, + PxShapeFlags shapeFlags ) const +{ + PxMaterial* materialPtr = const_cast(&material); + PxShape* shape = PxGetPhysics().createShape(geometry, &materialPtr, 1, true, shapeFlags); + if (shape) + { + inActor->attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor + shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly + } + return shape; +} +PX_PHYSX_CORE_API PxShape* PxRigidActorShapeCollectionHelper::createShape(PxRigidActor* inActor, const PxGeometry& geometry, PxMaterial *const* materials, + PxU16 materialCount, PxShapeFlags shapeFlags ) const +{ + PxShape* shape = PxGetPhysics().createShape(geometry, materials, materialCount, true, shapeFlags); + if (shape) + { + inActor->attachShape(*shape); // attach can fail, if e.g. we try and attach a trimesh simulation shape to a dynamic actor + shape->release(); // if attach fails, we hold the only counted reference, and so this cleans up properly + } + return shape; +} + +PX_PHYSX_CORE_API PxArticulationLink* PxArticulationReducedCoordinateLinkCollectionPropHelper::createLink(PxArticulationReducedCoordinate* inArticulation, PxArticulationLink* parent, + const PxTransform& pose) const +{ + PX_CHECK_AND_RETURN_NULL(pose.isValid(), "PxArticulationReducedCoordinateLinkCollectionPropHelper::createLink pose is not valid."); + return inArticulation->createLink(parent, pose ); +} + + + + +inline void SetNbShape( PxSimulationStatistics* inStats, PxGeometryType::Enum data, PxU32 val ) { inStats->nbShapes[data] = val; } +inline PxU32 GetNbShape( const PxSimulationStatistics* inStats, PxGeometryType::Enum data) { return inStats->nbShapes[data]; } + + +PX_PHYSX_CORE_API NbShapesProperty::NbShapesProperty() + : PxIndexedPropertyInfo ( "NbShapes", SetNbShape, GetNbShape ) +{ +} + + +inline void SetNbDiscreteContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbDiscreteContactPairs[idx1][idx2] = val; } +inline PxU32 GetNbDiscreteContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbDiscreteContactPairs[idx1][idx2]; } +PX_PHYSX_CORE_API NbDiscreteContactPairsProperty::NbDiscreteContactPairsProperty() + : PxDualIndexedPropertyInfo ( "NbDiscreteContactPairs", SetNbDiscreteContactPairs, GetNbDiscreteContactPairs ) +{ +} + +inline void SetNbModifiedContactPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbModifiedContactPairs[idx1][idx2] = val; } +inline PxU32 GetNbModifiedContactPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbModifiedContactPairs[idx1][idx2]; } +PX_PHYSX_CORE_API NbModifiedContactPairsProperty::NbModifiedContactPairsProperty() + : PxDualIndexedPropertyInfo ( "NbModifiedContactPairs", SetNbModifiedContactPairs, GetNbModifiedContactPairs ) +{ +} + +inline void SetNbCCDPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbCCDPairs[idx1][idx2] = val; } +inline PxU32 GetNbCCDPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbCCDPairs[idx1][idx2]; } +PX_PHYSX_CORE_API NbCCDPairsProperty::NbCCDPairsProperty() + : PxDualIndexedPropertyInfo ( "NbCCDPairs", SetNbCCDPairs, GetNbCCDPairs ) +{ +} + +inline void SetNbTriggerPairs( PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2, PxU32 val ) { inStats->nbTriggerPairs[idx1][idx2] = val; } +inline PxU32 GetNbTriggerPairs( const PxSimulationStatistics* inStats, PxGeometryType::Enum idx1, PxGeometryType::Enum idx2 ) { return inStats->nbTriggerPairs[idx1][idx2]; } +PX_PHYSX_CORE_API NbTriggerPairsProperty::NbTriggerPairsProperty() + : PxDualIndexedPropertyInfo ( "NbTriggerPairs", SetNbTriggerPairs, GetNbTriggerPairs ) +{ +} + +inline PxSimulationStatistics GetStats( const PxScene* inScene ) { PxSimulationStatistics stats; inScene->getSimulationStatistics( stats ); return stats; } +PX_PHYSX_CORE_API SimulationStatisticsProperty::SimulationStatisticsProperty() + : PxReadOnlyPropertyInfo( "SimulationStatistics", GetStats ) +{ +} + +inline PxU32 GetCustomType(const PxCustomGeometry* inGeom) { PxCustomGeometryType t = inGeom->callbacks->getCustomType(); return *reinterpret_cast(&t); } +PX_PHYSX_CORE_API PxCustomGeometryCustomTypeProperty::PxCustomGeometryCustomTypeProperty() + : PxReadOnlyPropertyInfo("CustomType", GetCustomType) +{ +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjectNames.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjectNames.h new file mode 100644 index 0000000..3949034 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjectNames.h @@ -0,0 +1,170 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +PxJoint_PropertiesStart, +PxJoint_Actors, +PxJoint_LocalPose, +PxJoint_RelativeTransform, +PxJoint_RelativeLinearVelocity, +PxJoint_RelativeAngularVelocity, +PxJoint_BreakForce, +PxJoint_ConstraintFlags, +PxJoint_InvMassScale0, +PxJoint_InvInertiaScale0, +PxJoint_InvMassScale1, +PxJoint_InvInertiaScale1, +PxJoint_Constraint, +PxJoint_Name, +PxJoint_Scene, +PxJoint_UserData, +PxJoint_PropertiesStop, +PxRackAndPinionJoint_PropertiesStart, +PxRackAndPinionJoint_Ratio, +PxRackAndPinionJoint_ConcreteTypeName, +PxRackAndPinionJoint_PropertiesStop, +PxGearJoint_PropertiesStart, +PxGearJoint_GearRatio, +PxGearJoint_ConcreteTypeName, +PxGearJoint_PropertiesStop, +PxD6Joint_PropertiesStart, +PxD6Joint_Motion, +PxD6Joint_TwistAngle, +PxD6Joint_Twist, +PxD6Joint_SwingYAngle, +PxD6Joint_SwingZAngle, +PxD6Joint_DistanceLimit, +PxD6Joint_LinearLimit, +PxD6Joint_TwistLimit, +PxD6Joint_SwingLimit, +PxD6Joint_PyramidSwingLimit, +PxD6Joint_Drive, +PxD6Joint_DrivePosition, +PxD6Joint_ProjectionLinearTolerance, +PxD6Joint_ProjectionAngularTolerance, +PxD6Joint_ConcreteTypeName, +PxD6Joint_PropertiesStop, +PxDistanceJoint_PropertiesStart, +PxDistanceJoint_Distance, +PxDistanceJoint_MinDistance, +PxDistanceJoint_MaxDistance, +PxDistanceJoint_Tolerance, +PxDistanceJoint_Stiffness, +PxDistanceJoint_Damping, +PxDistanceJoint_ContactDistance, +PxDistanceJoint_DistanceJointFlags, +PxDistanceJoint_ConcreteTypeName, +PxDistanceJoint_PropertiesStop, +PxContactJoint_PropertiesStart, +PxContactJoint_Contact, +PxContactJoint_ContactNormal, +PxContactJoint_Penetration, +PxContactJoint_Restitution, +PxContactJoint_BounceThreshold, +PxContactJoint_ConcreteTypeName, +PxContactJoint_PropertiesStop, +PxFixedJoint_PropertiesStart, +PxFixedJoint_ProjectionLinearTolerance, +PxFixedJoint_ProjectionAngularTolerance, +PxFixedJoint_ConcreteTypeName, +PxFixedJoint_PropertiesStop, +PxPrismaticJoint_PropertiesStart, +PxPrismaticJoint_Position, +PxPrismaticJoint_Velocity, +PxPrismaticJoint_Limit, +PxPrismaticJoint_PrismaticJointFlags, +PxPrismaticJoint_ProjectionLinearTolerance, +PxPrismaticJoint_ProjectionAngularTolerance, +PxPrismaticJoint_ConcreteTypeName, +PxPrismaticJoint_PropertiesStop, +PxRevoluteJoint_PropertiesStart, +PxRevoluteJoint_Angle, +PxRevoluteJoint_Velocity, +PxRevoluteJoint_Limit, +PxRevoluteJoint_DriveVelocity, +PxRevoluteJoint_DriveForceLimit, +PxRevoluteJoint_DriveGearRatio, +PxRevoluteJoint_RevoluteJointFlags, +PxRevoluteJoint_ProjectionLinearTolerance, +PxRevoluteJoint_ProjectionAngularTolerance, +PxRevoluteJoint_ConcreteTypeName, +PxRevoluteJoint_PropertiesStop, +PxSphericalJoint_PropertiesStart, +PxSphericalJoint_LimitCone, +PxSphericalJoint_SwingYAngle, +PxSphericalJoint_SwingZAngle, +PxSphericalJoint_SphericalJointFlags, +PxSphericalJoint_ProjectionLinearTolerance, +PxSphericalJoint_ConcreteTypeName, +PxSphericalJoint_PropertiesStop, +PxJointLimitParameters_PropertiesStart, +PxJointLimitParameters_Restitution, +PxJointLimitParameters_BounceThreshold, +PxJointLimitParameters_Stiffness, +PxJointLimitParameters_Damping, +PxJointLimitParameters_ContactDistance_deprecated, +PxJointLimitParameters_PropertiesStop, +PxJointLinearLimit_PropertiesStart, +PxJointLinearLimit_Value, +PxJointLinearLimit_PropertiesStop, +PxJointLinearLimitPair_PropertiesStart, +PxJointLinearLimitPair_Upper, +PxJointLinearLimitPair_Lower, +PxJointLinearLimitPair_PropertiesStop, +PxJointAngularLimitPair_PropertiesStart, +PxJointAngularLimitPair_Upper, +PxJointAngularLimitPair_Lower, +PxJointAngularLimitPair_PropertiesStop, +PxJointLimitCone_PropertiesStart, +PxJointLimitCone_YAngle, +PxJointLimitCone_ZAngle, +PxJointLimitCone_PropertiesStop, +PxJointLimitPyramid_PropertiesStart, +PxJointLimitPyramid_YAngleMin, +PxJointLimitPyramid_YAngleMax, +PxJointLimitPyramid_ZAngleMin, +PxJointLimitPyramid_ZAngleMax, +PxJointLimitPyramid_PropertiesStop, +PxSpring_PropertiesStart, +PxSpring_Stiffness, +PxSpring_Damping, +PxSpring_PropertiesStop, +PxD6JointDrive_PropertiesStart, +PxD6JointDrive_ForceLimit, +PxD6JointDrive_Flags, +PxD6JointDrive_PropertiesStop, + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjects.h new file mode 100644 index 0000000..3d2b8bb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionAutoGeneratedMetaDataObjects.h @@ -0,0 +1,1344 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +#define PX_PROPERTY_INFO_NAME PxExtensionsPropertyInfoName + static PxU32ToName g_physx__PxJointActorIndex__EnumConversion[] = { + { "eACTOR0", static_cast( physx::PxJointActorIndex::eACTOR0 ) }, + { "eACTOR1", static_cast( physx::PxJointActorIndex::eACTOR1 ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxJointActorIndex::Enum > { PxEnumTraits() : NameConversion( g_physx__PxJointActorIndex__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxJoint; + struct PxJointGeneratedValues + { + PxRigidActor * Actors[2]; + PxTransform LocalPose[physx::PxJointActorIndex::COUNT]; + PxTransform RelativeTransform; + PxVec3 RelativeLinearVelocity; + PxVec3 RelativeAngularVelocity; + PxReal BreakForce[2]; + PxConstraintFlags ConstraintFlags; + PxReal InvMassScale0; + PxReal InvInertiaScale0; + PxReal InvMassScale1; + PxReal InvInertiaScale1; + PxConstraint * Constraint; + const char * Name; + PxScene * Scene; + void * UserData; + PxJointGeneratedValues( const PxJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Actors, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, LocalPose, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeTransform, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeLinearVelocity, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, RelativeAngularVelocity, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, BreakForce, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, ConstraintFlags, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvMassScale0, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvInertiaScale0, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvMassScale1, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, InvInertiaScale1, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Constraint, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Name, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, Scene, PxJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJoint, UserData, PxJointGeneratedValues) + struct PxJointGeneratedInfo + + { + static const char* getClassName() { return "PxJoint"; } + PxRangePropertyInfo Actors; + PxIndexedPropertyInfo LocalPose; + PxReadOnlyPropertyInfo RelativeTransform; + PxReadOnlyPropertyInfo RelativeLinearVelocity; + PxReadOnlyPropertyInfo RelativeAngularVelocity; + PxRangePropertyInfo BreakForce; + PxPropertyInfo ConstraintFlags; + PxPropertyInfo InvMassScale0; + PxPropertyInfo InvInertiaScale0; + PxPropertyInfo InvMassScale1; + PxPropertyInfo InvInertiaScale1; + PxReadOnlyPropertyInfo Constraint; + PxPropertyInfo Name; + PxReadOnlyPropertyInfo Scene; + PxPropertyInfo UserData; + + PxJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 15; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Actors, inStartIndex + 0 );; + inOperator( LocalPose, inStartIndex + 1 );; + inOperator( RelativeTransform, inStartIndex + 2 );; + inOperator( RelativeLinearVelocity, inStartIndex + 3 );; + inOperator( RelativeAngularVelocity, inStartIndex + 4 );; + inOperator( BreakForce, inStartIndex + 5 );; + inOperator( ConstraintFlags, inStartIndex + 6 );; + inOperator( InvMassScale0, inStartIndex + 7 );; + inOperator( InvInertiaScale0, inStartIndex + 8 );; + inOperator( InvMassScale1, inStartIndex + 9 );; + inOperator( InvInertiaScale1, inStartIndex + 10 );; + inOperator( Constraint, inStartIndex + 11 );; + inOperator( Name, inStartIndex + 12 );; + inOperator( Scene, inStartIndex + 13 );; + inOperator( UserData, inStartIndex + 14 );; + return 15 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointGeneratedInfo Info; + const PxJointGeneratedInfo* getInfo() { return &Info; } + }; + + class PxRackAndPinionJoint; + struct PxRackAndPinionJointGeneratedValues + : PxJointGeneratedValues { + float Ratio; + const char * ConcreteTypeName; + PxRackAndPinionJointGeneratedValues( const PxRackAndPinionJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRackAndPinionJoint, Ratio, PxRackAndPinionJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRackAndPinionJoint, ConcreteTypeName, PxRackAndPinionJointGeneratedValues) + struct PxRackAndPinionJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxRackAndPinionJoint"; } + PxPropertyInfo Ratio; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxRackAndPinionJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Ratio, inStartIndex + 0 );; + inOperator( ConcreteTypeName, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRackAndPinionJointGeneratedInfo Info; + const PxRackAndPinionJointGeneratedInfo* getInfo() { return &Info; } + }; + + class PxGearJoint; + struct PxGearJointGeneratedValues + : PxJointGeneratedValues { + float GearRatio; + const char * ConcreteTypeName; + PxGearJointGeneratedValues( const PxGearJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxGearJoint, GearRatio, PxGearJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxGearJoint, ConcreteTypeName, PxGearJointGeneratedValues) + struct PxGearJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxGearJoint"; } + PxPropertyInfo GearRatio; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxGearJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( GearRatio, inStartIndex + 0 );; + inOperator( ConcreteTypeName, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxGearJointGeneratedInfo Info; + const PxGearJointGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxD6Axis__EnumConversion[] = { + { "eX", static_cast( physx::PxD6Axis::eX ) }, + { "eY", static_cast( physx::PxD6Axis::eY ) }, + { "eZ", static_cast( physx::PxD6Axis::eZ ) }, + { "eTWIST", static_cast( physx::PxD6Axis::eTWIST ) }, + { "eSWING1", static_cast( physx::PxD6Axis::eSWING1 ) }, + { "eSWING2", static_cast( physx::PxD6Axis::eSWING2 ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxD6Axis::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Axis__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxD6Motion__EnumConversion[] = { + { "eLOCKED", static_cast( physx::PxD6Motion::eLOCKED ) }, + { "eLIMITED", static_cast( physx::PxD6Motion::eLIMITED ) }, + { "eFREE", static_cast( physx::PxD6Motion::eFREE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxD6Motion::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Motion__EnumConversion ) {} const PxU32ToName* NameConversion; }; + static PxU32ToName g_physx__PxD6Drive__EnumConversion[] = { + { "eX", static_cast( physx::PxD6Drive::eX ) }, + { "eY", static_cast( physx::PxD6Drive::eY ) }, + { "eZ", static_cast( physx::PxD6Drive::eZ ) }, + { "eSWING", static_cast( physx::PxD6Drive::eSWING ) }, + { "eTWIST", static_cast( physx::PxD6Drive::eTWIST ) }, + { "eSLERP", static_cast( physx::PxD6Drive::eSLERP ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxD6Drive::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6Drive__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxD6Joint; + struct PxD6JointGeneratedValues + : PxJointGeneratedValues { + PxD6Motion::Enum Motion[physx::PxD6Axis::eCOUNT]; + PxReal TwistAngle; + PxReal Twist; + PxReal SwingYAngle; + PxReal SwingZAngle; + PxJointLinearLimit DistanceLimit; + PxJointLinearLimit LinearLimit; + PxJointAngularLimitPair TwistLimit; + PxJointLimitCone SwingLimit; + PxJointLimitPyramid PyramidSwingLimit; + PxD6JointDrive Drive[physx::PxD6Drive::eCOUNT]; + PxTransform DrivePosition; + PxReal ProjectionLinearTolerance; + PxReal ProjectionAngularTolerance; + const char * ConcreteTypeName; + PxD6JointGeneratedValues( const PxD6Joint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Motion, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, TwistAngle, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Twist, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingYAngle, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingZAngle, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, DistanceLimit, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, LinearLimit, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, TwistLimit, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, SwingLimit, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, PyramidSwingLimit, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, Drive, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, DrivePosition, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, ProjectionLinearTolerance, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, ProjectionAngularTolerance, PxD6JointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6Joint, ConcreteTypeName, PxD6JointGeneratedValues) + struct PxD6JointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxD6Joint"; } + PxIndexedPropertyInfo Motion; + PxReadOnlyPropertyInfo TwistAngle; + PxReadOnlyPropertyInfo Twist; + PxReadOnlyPropertyInfo SwingYAngle; + PxReadOnlyPropertyInfo SwingZAngle; + PxPropertyInfo DistanceLimit; + PxPropertyInfo LinearLimit; + PxPropertyInfo TwistLimit; + PxPropertyInfo SwingLimit; + PxPropertyInfo PyramidSwingLimit; + PxIndexedPropertyInfo Drive; + PxPropertyInfo DrivePosition; + PxPropertyInfo ProjectionLinearTolerance; + PxPropertyInfo ProjectionAngularTolerance; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxD6JointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 15; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Motion, inStartIndex + 0 );; + inOperator( TwistAngle, inStartIndex + 1 );; + inOperator( Twist, inStartIndex + 2 );; + inOperator( SwingYAngle, inStartIndex + 3 );; + inOperator( SwingZAngle, inStartIndex + 4 );; + inOperator( DistanceLimit, inStartIndex + 5 );; + inOperator( LinearLimit, inStartIndex + 6 );; + inOperator( TwistLimit, inStartIndex + 7 );; + inOperator( SwingLimit, inStartIndex + 8 );; + inOperator( PyramidSwingLimit, inStartIndex + 9 );; + inOperator( Drive, inStartIndex + 10 );; + inOperator( DrivePosition, inStartIndex + 11 );; + inOperator( ProjectionLinearTolerance, inStartIndex + 12 );; + inOperator( ProjectionAngularTolerance, inStartIndex + 13 );; + inOperator( ConcreteTypeName, inStartIndex + 14 );; + return 15 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxD6JointGeneratedInfo Info; + const PxD6JointGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxDistanceJointFlag__EnumConversion[] = { + { "eMAX_DISTANCE_ENABLED", static_cast( physx::PxDistanceJointFlag::eMAX_DISTANCE_ENABLED ) }, + { "eMIN_DISTANCE_ENABLED", static_cast( physx::PxDistanceJointFlag::eMIN_DISTANCE_ENABLED ) }, + { "eSPRING_ENABLED", static_cast( physx::PxDistanceJointFlag::eSPRING_ENABLED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxDistanceJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxDistanceJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxDistanceJoint; + struct PxDistanceJointGeneratedValues + : PxJointGeneratedValues { + PxReal Distance; + PxReal MinDistance; + PxReal MaxDistance; + PxReal Tolerance; + PxReal Stiffness; + PxReal Damping; + PxReal ContactDistance; + PxDistanceJointFlags DistanceJointFlags; + const char * ConcreteTypeName; + PxDistanceJointGeneratedValues( const PxDistanceJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Distance, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, MinDistance, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, MaxDistance, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Tolerance, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Stiffness, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, Damping, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, ContactDistance, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, DistanceJointFlags, PxDistanceJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxDistanceJoint, ConcreteTypeName, PxDistanceJointGeneratedValues) + struct PxDistanceJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxDistanceJoint"; } + PxReadOnlyPropertyInfo Distance; + PxPropertyInfo MinDistance; + PxPropertyInfo MaxDistance; + PxPropertyInfo Tolerance; + PxPropertyInfo Stiffness; + PxPropertyInfo Damping; + PxPropertyInfo ContactDistance; + PxPropertyInfo DistanceJointFlags; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxDistanceJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 9; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Distance, inStartIndex + 0 );; + inOperator( MinDistance, inStartIndex + 1 );; + inOperator( MaxDistance, inStartIndex + 2 );; + inOperator( Tolerance, inStartIndex + 3 );; + inOperator( Stiffness, inStartIndex + 4 );; + inOperator( Damping, inStartIndex + 5 );; + inOperator( ContactDistance, inStartIndex + 6 );; + inOperator( DistanceJointFlags, inStartIndex + 7 );; + inOperator( ConcreteTypeName, inStartIndex + 8 );; + return 9 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxDistanceJointGeneratedInfo Info; + const PxDistanceJointGeneratedInfo* getInfo() { return &Info; } + }; + + class PxContactJoint; + struct PxContactJointGeneratedValues + : PxJointGeneratedValues { + PxVec3 Contact; + PxVec3 ContactNormal; + PxReal Penetration; + PxReal Restitution; + PxReal BounceThreshold; + const char * ConcreteTypeName; + PxContactJointGeneratedValues( const PxContactJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Contact, PxContactJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, ContactNormal, PxContactJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Penetration, PxContactJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, Restitution, PxContactJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, BounceThreshold, PxContactJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxContactJoint, ConcreteTypeName, PxContactJointGeneratedValues) + struct PxContactJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxContactJoint"; } + PxPropertyInfo Contact; + PxPropertyInfo ContactNormal; + PxPropertyInfo Penetration; + PxPropertyInfo Restitution; + PxPropertyInfo BounceThreshold; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxContactJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 6; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Contact, inStartIndex + 0 );; + inOperator( ContactNormal, inStartIndex + 1 );; + inOperator( Penetration, inStartIndex + 2 );; + inOperator( Restitution, inStartIndex + 3 );; + inOperator( BounceThreshold, inStartIndex + 4 );; + inOperator( ConcreteTypeName, inStartIndex + 5 );; + return 6 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxContactJointGeneratedInfo Info; + const PxContactJointGeneratedInfo* getInfo() { return &Info; } + }; + + class PxFixedJoint; + struct PxFixedJointGeneratedValues + : PxJointGeneratedValues { + PxReal ProjectionLinearTolerance; + PxReal ProjectionAngularTolerance; + const char * ConcreteTypeName; + PxFixedJointGeneratedValues( const PxFixedJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFixedJoint, ProjectionLinearTolerance, PxFixedJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFixedJoint, ProjectionAngularTolerance, PxFixedJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxFixedJoint, ConcreteTypeName, PxFixedJointGeneratedValues) + struct PxFixedJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxFixedJoint"; } + PxPropertyInfo ProjectionLinearTolerance; + PxPropertyInfo ProjectionAngularTolerance; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxFixedJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ProjectionLinearTolerance, inStartIndex + 0 );; + inOperator( ProjectionAngularTolerance, inStartIndex + 1 );; + inOperator( ConcreteTypeName, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxFixedJointGeneratedInfo Info; + const PxFixedJointGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxPrismaticJointFlag__EnumConversion[] = { + { "eLIMIT_ENABLED", static_cast( physx::PxPrismaticJointFlag::eLIMIT_ENABLED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxPrismaticJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxPrismaticJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxPrismaticJoint; + struct PxPrismaticJointGeneratedValues + : PxJointGeneratedValues { + PxReal Position; + PxReal Velocity; + PxJointLinearLimitPair Limit; + PxPrismaticJointFlags PrismaticJointFlags; + PxReal ProjectionLinearTolerance; + PxReal ProjectionAngularTolerance; + const char * ConcreteTypeName; + PxPrismaticJointGeneratedValues( const PxPrismaticJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Position, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Velocity, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, Limit, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, PrismaticJointFlags, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, ProjectionLinearTolerance, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, ProjectionAngularTolerance, PxPrismaticJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxPrismaticJoint, ConcreteTypeName, PxPrismaticJointGeneratedValues) + struct PxPrismaticJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxPrismaticJoint"; } + PxReadOnlyPropertyInfo Position; + PxReadOnlyPropertyInfo Velocity; + PxPropertyInfo Limit; + PxPropertyInfo PrismaticJointFlags; + PxPropertyInfo ProjectionLinearTolerance; + PxPropertyInfo ProjectionAngularTolerance; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxPrismaticJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 7; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Position, inStartIndex + 0 );; + inOperator( Velocity, inStartIndex + 1 );; + inOperator( Limit, inStartIndex + 2 );; + inOperator( PrismaticJointFlags, inStartIndex + 3 );; + inOperator( ProjectionLinearTolerance, inStartIndex + 4 );; + inOperator( ProjectionAngularTolerance, inStartIndex + 5 );; + inOperator( ConcreteTypeName, inStartIndex + 6 );; + return 7 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxPrismaticJointGeneratedInfo Info; + const PxPrismaticJointGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxRevoluteJointFlag__EnumConversion[] = { + { "eLIMIT_ENABLED", static_cast( physx::PxRevoluteJointFlag::eLIMIT_ENABLED ) }, + { "eDRIVE_ENABLED", static_cast( physx::PxRevoluteJointFlag::eDRIVE_ENABLED ) }, + { "eDRIVE_FREESPIN", static_cast( physx::PxRevoluteJointFlag::eDRIVE_FREESPIN ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxRevoluteJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxRevoluteJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxRevoluteJoint; + struct PxRevoluteJointGeneratedValues + : PxJointGeneratedValues { + PxReal Angle; + PxReal Velocity; + PxJointAngularLimitPair Limit; + PxReal DriveVelocity; + PxReal DriveForceLimit; + PxReal DriveGearRatio; + PxRevoluteJointFlags RevoluteJointFlags; + PxReal ProjectionLinearTolerance; + PxReal ProjectionAngularTolerance; + const char * ConcreteTypeName; + PxRevoluteJointGeneratedValues( const PxRevoluteJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Angle, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Velocity, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, Limit, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveVelocity, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveForceLimit, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, DriveGearRatio, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, RevoluteJointFlags, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, ProjectionLinearTolerance, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, ProjectionAngularTolerance, PxRevoluteJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxRevoluteJoint, ConcreteTypeName, PxRevoluteJointGeneratedValues) + struct PxRevoluteJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxRevoluteJoint"; } + PxReadOnlyPropertyInfo Angle; + PxReadOnlyPropertyInfo Velocity; + PxPropertyInfo Limit; + PxPropertyInfo DriveVelocity; + PxPropertyInfo DriveForceLimit; + PxPropertyInfo DriveGearRatio; + PxPropertyInfo RevoluteJointFlags; + PxPropertyInfo ProjectionLinearTolerance; + PxPropertyInfo ProjectionAngularTolerance; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxRevoluteJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 10; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Angle, inStartIndex + 0 );; + inOperator( Velocity, inStartIndex + 1 );; + inOperator( Limit, inStartIndex + 2 );; + inOperator( DriveVelocity, inStartIndex + 3 );; + inOperator( DriveForceLimit, inStartIndex + 4 );; + inOperator( DriveGearRatio, inStartIndex + 5 );; + inOperator( RevoluteJointFlags, inStartIndex + 6 );; + inOperator( ProjectionLinearTolerance, inStartIndex + 7 );; + inOperator( ProjectionAngularTolerance, inStartIndex + 8 );; + inOperator( ConcreteTypeName, inStartIndex + 9 );; + return 10 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxRevoluteJointGeneratedInfo Info; + const PxRevoluteJointGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxSphericalJointFlag__EnumConversion[] = { + { "eLIMIT_ENABLED", static_cast( physx::PxSphericalJointFlag::eLIMIT_ENABLED ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxSphericalJointFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxSphericalJointFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxSphericalJoint; + struct PxSphericalJointGeneratedValues + : PxJointGeneratedValues { + PxJointLimitCone LimitCone; + PxReal SwingYAngle; + PxReal SwingZAngle; + PxSphericalJointFlags SphericalJointFlags; + PxReal ProjectionLinearTolerance; + const char * ConcreteTypeName; + PxSphericalJointGeneratedValues( const PxSphericalJoint* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, LimitCone, PxSphericalJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SwingYAngle, PxSphericalJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SwingZAngle, PxSphericalJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, SphericalJointFlags, PxSphericalJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, ProjectionLinearTolerance, PxSphericalJointGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSphericalJoint, ConcreteTypeName, PxSphericalJointGeneratedValues) + struct PxSphericalJointGeneratedInfo + : PxJointGeneratedInfo + { + static const char* getClassName() { return "PxSphericalJoint"; } + PxPropertyInfo LimitCone; + PxReadOnlyPropertyInfo SwingYAngle; + PxReadOnlyPropertyInfo SwingZAngle; + PxPropertyInfo SphericalJointFlags; + PxPropertyInfo ProjectionLinearTolerance; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxSphericalJointGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 6; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( LimitCone, inStartIndex + 0 );; + inOperator( SwingYAngle, inStartIndex + 1 );; + inOperator( SwingZAngle, inStartIndex + 2 );; + inOperator( SphericalJointFlags, inStartIndex + 3 );; + inOperator( ProjectionLinearTolerance, inStartIndex + 4 );; + inOperator( ConcreteTypeName, inStartIndex + 5 );; + return 6 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSphericalJointGeneratedInfo Info; + const PxSphericalJointGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointLimitParameters; + struct PxJointLimitParametersGeneratedValues + { + PxReal Restitution; + PxReal BounceThreshold; + PxReal Stiffness; + PxReal Damping; + PxReal ContactDistance_deprecated; + PxJointLimitParametersGeneratedValues( const PxJointLimitParameters* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Restitution, PxJointLimitParametersGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, BounceThreshold, PxJointLimitParametersGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Stiffness, PxJointLimitParametersGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, Damping, PxJointLimitParametersGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitParameters, ContactDistance_deprecated, PxJointLimitParametersGeneratedValues) + struct PxJointLimitParametersGeneratedInfo + + { + static const char* getClassName() { return "PxJointLimitParameters"; } + PxPropertyInfo Restitution; + PxPropertyInfo BounceThreshold; + PxPropertyInfo Stiffness; + PxPropertyInfo Damping; + PxPropertyInfo ContactDistance_deprecated; + + PxJointLimitParametersGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Restitution, inStartIndex + 0 );; + inOperator( BounceThreshold, inStartIndex + 1 );; + inOperator( Stiffness, inStartIndex + 2 );; + inOperator( Damping, inStartIndex + 3 );; + inOperator( ContactDistance_deprecated, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointLimitParametersGeneratedInfo Info; + const PxJointLimitParametersGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointLinearLimit; + struct PxJointLinearLimitGeneratedValues + : PxJointLimitParametersGeneratedValues { + PxReal Value; + PxJointLinearLimitGeneratedValues( const PxJointLinearLimit* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimit, Value, PxJointLinearLimitGeneratedValues) + struct PxJointLinearLimitGeneratedInfo + : PxJointLimitParametersGeneratedInfo + { + static const char* getClassName() { return "PxJointLinearLimit"; } + PxPropertyInfo Value; + + PxJointLinearLimitGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointLimitParametersGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Value, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointLinearLimitGeneratedInfo Info; + const PxJointLinearLimitGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointLinearLimitPair; + struct PxJointLinearLimitPairGeneratedValues + : PxJointLimitParametersGeneratedValues { + PxReal Upper; + PxReal Lower; + PxJointLinearLimitPairGeneratedValues( const PxJointLinearLimitPair* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimitPair, Upper, PxJointLinearLimitPairGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLinearLimitPair, Lower, PxJointLinearLimitPairGeneratedValues) + struct PxJointLinearLimitPairGeneratedInfo + : PxJointLimitParametersGeneratedInfo + { + static const char* getClassName() { return "PxJointLinearLimitPair"; } + PxPropertyInfo Upper; + PxPropertyInfo Lower; + + PxJointLinearLimitPairGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointLimitParametersGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Upper, inStartIndex + 0 );; + inOperator( Lower, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointLinearLimitPairGeneratedInfo Info; + const PxJointLinearLimitPairGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointAngularLimitPair; + struct PxJointAngularLimitPairGeneratedValues + : PxJointLimitParametersGeneratedValues { + PxReal Upper; + PxReal Lower; + PxJointAngularLimitPairGeneratedValues( const PxJointAngularLimitPair* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointAngularLimitPair, Upper, PxJointAngularLimitPairGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointAngularLimitPair, Lower, PxJointAngularLimitPairGeneratedValues) + struct PxJointAngularLimitPairGeneratedInfo + : PxJointLimitParametersGeneratedInfo + { + static const char* getClassName() { return "PxJointAngularLimitPair"; } + PxPropertyInfo Upper; + PxPropertyInfo Lower; + + PxJointAngularLimitPairGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointLimitParametersGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Upper, inStartIndex + 0 );; + inOperator( Lower, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointAngularLimitPairGeneratedInfo Info; + const PxJointAngularLimitPairGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointLimitCone; + struct PxJointLimitConeGeneratedValues + : PxJointLimitParametersGeneratedValues { + PxReal YAngle; + PxReal ZAngle; + PxJointLimitConeGeneratedValues( const PxJointLimitCone* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitCone, YAngle, PxJointLimitConeGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitCone, ZAngle, PxJointLimitConeGeneratedValues) + struct PxJointLimitConeGeneratedInfo + : PxJointLimitParametersGeneratedInfo + { + static const char* getClassName() { return "PxJointLimitCone"; } + PxPropertyInfo YAngle; + PxPropertyInfo ZAngle; + + PxJointLimitConeGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointLimitParametersGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( YAngle, inStartIndex + 0 );; + inOperator( ZAngle, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointLimitConeGeneratedInfo Info; + const PxJointLimitConeGeneratedInfo* getInfo() { return &Info; } + }; + + class PxJointLimitPyramid; + struct PxJointLimitPyramidGeneratedValues + : PxJointLimitParametersGeneratedValues { + PxReal YAngleMin; + PxReal YAngleMax; + PxReal ZAngleMin; + PxReal ZAngleMax; + PxJointLimitPyramidGeneratedValues( const PxJointLimitPyramid* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, YAngleMin, PxJointLimitPyramidGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, YAngleMax, PxJointLimitPyramidGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, ZAngleMin, PxJointLimitPyramidGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxJointLimitPyramid, ZAngleMax, PxJointLimitPyramidGeneratedValues) + struct PxJointLimitPyramidGeneratedInfo + : PxJointLimitParametersGeneratedInfo + { + static const char* getClassName() { return "PxJointLimitPyramid"; } + PxPropertyInfo YAngleMin; + PxPropertyInfo YAngleMax; + PxPropertyInfo ZAngleMin; + PxPropertyInfo ZAngleMax; + + PxJointLimitPyramidGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxJointLimitParametersGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxJointLimitParametersGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( YAngleMin, inStartIndex + 0 );; + inOperator( YAngleMax, inStartIndex + 1 );; + inOperator( ZAngleMin, inStartIndex + 2 );; + inOperator( ZAngleMax, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxJointLimitPyramidGeneratedInfo Info; + const PxJointLimitPyramidGeneratedInfo* getInfo() { return &Info; } + }; + + class PxSpring; + struct PxSpringGeneratedValues + { + PxReal Stiffness; + PxReal Damping; + PxSpringGeneratedValues( const PxSpring* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSpring, Stiffness, PxSpringGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxSpring, Damping, PxSpringGeneratedValues) + struct PxSpringGeneratedInfo + + { + static const char* getClassName() { return "PxSpring"; } + PxPropertyInfo Stiffness; + PxPropertyInfo Damping; + + PxSpringGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Stiffness, inStartIndex + 0 );; + inOperator( Damping, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxSpringGeneratedInfo Info; + const PxSpringGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxD6JointDriveFlag__EnumConversion[] = { + { "eACCELERATION", static_cast( physx::PxD6JointDriveFlag::eACCELERATION ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxD6JointDriveFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxD6JointDriveFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxD6JointDrive; + struct PxD6JointDriveGeneratedValues + : PxSpringGeneratedValues { + PxReal ForceLimit; + PxD6JointDriveFlags Flags; + PxD6JointDriveGeneratedValues( const PxD6JointDrive* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6JointDrive, ForceLimit, PxD6JointDriveGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxD6JointDrive, Flags, PxD6JointDriveGeneratedValues) + struct PxD6JointDriveGeneratedInfo + : PxSpringGeneratedInfo + { + static const char* getClassName() { return "PxD6JointDrive"; } + PxPropertyInfo ForceLimit; + PxPropertyInfo Flags; + + PxD6JointDriveGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxSpringGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxSpringGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxSpringGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ForceLimit, inStartIndex + 0 );; + inOperator( Flags, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxD6JointDriveGeneratedInfo Info; + const PxD6JointDriveGeneratedInfo* getInfo() { return &Info; } + }; + + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON +#undef PX_PROPERTY_INFO_NAME diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionMetaDataObjects.h new file mode 100644 index 0000000..6b86f0f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/include/PxExtensionMetaDataObjects.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_EXTENSION_METADATAOBJECTS_H +#define PX_EXTENSION_METADATAOBJECTS_H +#include "PxPhysicsAPI.h" +#include "extensions/PxExtensionsAPI.h" +#include "PxMetaDataObjects.h" + +/** \addtogroup physics +@{ +*/ + +namespace physx +{ + +class PxD6Joint; +class PxJointLimitCone; + +struct PxExtensionsPropertyInfoName +{ + enum Enum + { + Unnamed = PxPropertyInfoName::LastPxPropertyInfoName, +#include "PxExtensionAutoGeneratedMetaDataObjectNames.h" + LastPxPropertyInfoName + }; +}; + +#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \ + template<> struct PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop > \ + { \ + PxU32 Offset; \ + PxPropertyToValueStructMemberMap< PxExtensionsPropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \ + template void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \ + }; + +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif +#include "PxExtensionAutoGeneratedMetaDataObjects.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp new file mode 100644 index 0000000..d1c185c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxmetadata/extensions/src/PxExtensionAutoGeneratedMetaDataObjects.cpp @@ -0,0 +1,528 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#include "foundation/PxPreprocessor.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif +#include "PxExtensionMetaDataObjects.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +#include "PxMetaDataCppPrefix.h" +#include "extensions/PxExtensionsAPI.h" +using namespace physx; +void setPxJoint_Actors( PxJoint* inObj, PxRigidActor * inArg0, PxRigidActor * inArg1 ) { inObj->setActors( inArg0, inArg1 ); } +void getPxJoint_Actors( const PxJoint* inObj, PxRigidActor *& inArg0, PxRigidActor *& inArg1 ) { inObj->getActors( inArg0, inArg1 ); } +void setPxJoint_LocalPose( PxJoint* inObj, PxJointActorIndex::Enum inIndex, PxTransform inArg ){ inObj->setLocalPose( inIndex, inArg ); } +PxTransform getPxJoint_LocalPose( const PxJoint* inObj, PxJointActorIndex::Enum inIndex ) { return inObj->getLocalPose( inIndex ); } +PxTransform getPxJoint_RelativeTransform( const PxJoint* inObj ) { return inObj->getRelativeTransform(); } +PxVec3 getPxJoint_RelativeLinearVelocity( const PxJoint* inObj ) { return inObj->getRelativeLinearVelocity(); } +PxVec3 getPxJoint_RelativeAngularVelocity( const PxJoint* inObj ) { return inObj->getRelativeAngularVelocity(); } +void setPxJoint_BreakForce( PxJoint* inObj, PxReal inArg0, PxReal inArg1 ) { inObj->setBreakForce( inArg0, inArg1 ); } +void getPxJoint_BreakForce( const PxJoint* inObj, PxReal& inArg0, PxReal& inArg1 ) { inObj->getBreakForce( inArg0, inArg1 ); } +void setPxJoint_ConstraintFlags( PxJoint* inObj, PxConstraintFlags inArg){ inObj->setConstraintFlags( inArg ); } +PxConstraintFlags getPxJoint_ConstraintFlags( const PxJoint* inObj ) { return inObj->getConstraintFlags(); } +void setPxJoint_InvMassScale0( PxJoint* inObj, PxReal inArg){ inObj->setInvMassScale0( inArg ); } +PxReal getPxJoint_InvMassScale0( const PxJoint* inObj ) { return inObj->getInvMassScale0(); } +void setPxJoint_InvInertiaScale0( PxJoint* inObj, PxReal inArg){ inObj->setInvInertiaScale0( inArg ); } +PxReal getPxJoint_InvInertiaScale0( const PxJoint* inObj ) { return inObj->getInvInertiaScale0(); } +void setPxJoint_InvMassScale1( PxJoint* inObj, PxReal inArg){ inObj->setInvMassScale1( inArg ); } +PxReal getPxJoint_InvMassScale1( const PxJoint* inObj ) { return inObj->getInvMassScale1(); } +void setPxJoint_InvInertiaScale1( PxJoint* inObj, PxReal inArg){ inObj->setInvInertiaScale1( inArg ); } +PxReal getPxJoint_InvInertiaScale1( const PxJoint* inObj ) { return inObj->getInvInertiaScale1(); } +PxConstraint * getPxJoint_Constraint( const PxJoint* inObj ) { return inObj->getConstraint(); } +void setPxJoint_Name( PxJoint* inObj, const char * inArg){ inObj->setName( inArg ); } +const char * getPxJoint_Name( const PxJoint* inObj ) { return inObj->getName(); } +PxScene * getPxJoint_Scene( const PxJoint* inObj ) { return inObj->getScene(); } +inline void * getPxJointUserData( const PxJoint* inOwner ) { return inOwner->userData; } +inline void setPxJointUserData( PxJoint* inOwner, void * inData) { inOwner->userData = inData; } + PxJointGeneratedInfo::PxJointGeneratedInfo() + : Actors( "Actors", "actor0", "actor1", setPxJoint_Actors, getPxJoint_Actors) + , LocalPose( "LocalPose", setPxJoint_LocalPose, getPxJoint_LocalPose) + , RelativeTransform( "RelativeTransform", getPxJoint_RelativeTransform) + , RelativeLinearVelocity( "RelativeLinearVelocity", getPxJoint_RelativeLinearVelocity) + , RelativeAngularVelocity( "RelativeAngularVelocity", getPxJoint_RelativeAngularVelocity) + , BreakForce( "BreakForce", "force", "torque", setPxJoint_BreakForce, getPxJoint_BreakForce) + , ConstraintFlags( "ConstraintFlags", setPxJoint_ConstraintFlags, getPxJoint_ConstraintFlags) + , InvMassScale0( "InvMassScale0", setPxJoint_InvMassScale0, getPxJoint_InvMassScale0) + , InvInertiaScale0( "InvInertiaScale0", setPxJoint_InvInertiaScale0, getPxJoint_InvInertiaScale0) + , InvMassScale1( "InvMassScale1", setPxJoint_InvMassScale1, getPxJoint_InvMassScale1) + , InvInertiaScale1( "InvInertiaScale1", setPxJoint_InvInertiaScale1, getPxJoint_InvInertiaScale1) + , Constraint( "Constraint", getPxJoint_Constraint) + , Name( "Name", setPxJoint_Name, getPxJoint_Name) + , Scene( "Scene", getPxJoint_Scene) + , UserData( "UserData", setPxJointUserData, getPxJointUserData ) +{} + PxJointGeneratedValues::PxJointGeneratedValues( const PxJoint* inSource ) + :RelativeTransform( getPxJoint_RelativeTransform( inSource ) ) + ,RelativeLinearVelocity( getPxJoint_RelativeLinearVelocity( inSource ) ) + ,RelativeAngularVelocity( getPxJoint_RelativeAngularVelocity( inSource ) ) + ,ConstraintFlags( getPxJoint_ConstraintFlags( inSource ) ) + ,InvMassScale0( getPxJoint_InvMassScale0( inSource ) ) + ,InvInertiaScale0( getPxJoint_InvInertiaScale0( inSource ) ) + ,InvMassScale1( getPxJoint_InvMassScale1( inSource ) ) + ,InvInertiaScale1( getPxJoint_InvInertiaScale1( inSource ) ) + ,Constraint( getPxJoint_Constraint( inSource ) ) + ,Name( getPxJoint_Name( inSource ) ) + ,Scene( getPxJoint_Scene( inSource ) ) + ,UserData( inSource->userData ) +{ + PX_UNUSED(inSource); + getPxJoint_Actors( inSource, Actors[0], Actors[1] ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxJointActorIndex::COUNT ); ++idx ) + LocalPose[idx] = getPxJoint_LocalPose( inSource, static_cast< PxJointActorIndex::Enum >( idx ) ); + getPxJoint_BreakForce( inSource, BreakForce[0], BreakForce[1] ); +} +void setPxRackAndPinionJoint_Ratio( PxRackAndPinionJoint* inObj, float inArg){ inObj->setRatio( inArg ); } +float getPxRackAndPinionJoint_Ratio( const PxRackAndPinionJoint* inObj ) { return inObj->getRatio(); } +const char * getPxRackAndPinionJoint_ConcreteTypeName( const PxRackAndPinionJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxRackAndPinionJointGeneratedInfo::PxRackAndPinionJointGeneratedInfo() + : Ratio( "Ratio", setPxRackAndPinionJoint_Ratio, getPxRackAndPinionJoint_Ratio) + , ConcreteTypeName( "ConcreteTypeName", getPxRackAndPinionJoint_ConcreteTypeName) +{} + PxRackAndPinionJointGeneratedValues::PxRackAndPinionJointGeneratedValues( const PxRackAndPinionJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,Ratio( getPxRackAndPinionJoint_Ratio( inSource ) ) + ,ConcreteTypeName( getPxRackAndPinionJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxGearJoint_GearRatio( PxGearJoint* inObj, float inArg){ inObj->setGearRatio( inArg ); } +float getPxGearJoint_GearRatio( const PxGearJoint* inObj ) { return inObj->getGearRatio(); } +const char * getPxGearJoint_ConcreteTypeName( const PxGearJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxGearJointGeneratedInfo::PxGearJointGeneratedInfo() + : GearRatio( "GearRatio", setPxGearJoint_GearRatio, getPxGearJoint_GearRatio) + , ConcreteTypeName( "ConcreteTypeName", getPxGearJoint_ConcreteTypeName) +{} + PxGearJointGeneratedValues::PxGearJointGeneratedValues( const PxGearJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,GearRatio( getPxGearJoint_GearRatio( inSource ) ) + ,ConcreteTypeName( getPxGearJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxD6Joint_Motion( PxD6Joint* inObj, PxD6Axis::Enum inIndex, PxD6Motion::Enum inArg ){ inObj->setMotion( inIndex, inArg ); } +PxD6Motion::Enum getPxD6Joint_Motion( const PxD6Joint* inObj, PxD6Axis::Enum inIndex ) { return inObj->getMotion( inIndex ); } +PxReal getPxD6Joint_TwistAngle( const PxD6Joint* inObj ) { return inObj->getTwistAngle(); } +PxReal getPxD6Joint_Twist( const PxD6Joint* inObj ) { return inObj->getTwist(); } +PxReal getPxD6Joint_SwingYAngle( const PxD6Joint* inObj ) { return inObj->getSwingYAngle(); } +PxReal getPxD6Joint_SwingZAngle( const PxD6Joint* inObj ) { return inObj->getSwingZAngle(); } +void setPxD6Joint_DistanceLimit( PxD6Joint* inObj, const PxJointLinearLimit & inArg){ inObj->setDistanceLimit( inArg ); } +PxJointLinearLimit getPxD6Joint_DistanceLimit( const PxD6Joint* inObj ) { return inObj->getDistanceLimit(); } +void setPxD6Joint_LinearLimit( PxD6Joint* inObj, const PxJointLinearLimit & inArg){ inObj->setLinearLimit( inArg ); } +PxJointLinearLimit getPxD6Joint_LinearLimit( const PxD6Joint* inObj ) { return inObj->getLinearLimit(); } +void setPxD6Joint_TwistLimit( PxD6Joint* inObj, const PxJointAngularLimitPair & inArg){ inObj->setTwistLimit( inArg ); } +PxJointAngularLimitPair getPxD6Joint_TwistLimit( const PxD6Joint* inObj ) { return inObj->getTwistLimit(); } +void setPxD6Joint_SwingLimit( PxD6Joint* inObj, const PxJointLimitCone & inArg){ inObj->setSwingLimit( inArg ); } +PxJointLimitCone getPxD6Joint_SwingLimit( const PxD6Joint* inObj ) { return inObj->getSwingLimit(); } +void setPxD6Joint_PyramidSwingLimit( PxD6Joint* inObj, const PxJointLimitPyramid & inArg){ inObj->setPyramidSwingLimit( inArg ); } +PxJointLimitPyramid getPxD6Joint_PyramidSwingLimit( const PxD6Joint* inObj ) { return inObj->getPyramidSwingLimit(); } +void setPxD6Joint_Drive( PxD6Joint* inObj, PxD6Drive::Enum inIndex, PxD6JointDrive inArg ){ inObj->setDrive( inIndex, inArg ); } +PxD6JointDrive getPxD6Joint_Drive( const PxD6Joint* inObj, PxD6Drive::Enum inIndex ) { return inObj->getDrive( inIndex ); } +void setPxD6Joint_DrivePosition( PxD6Joint* inObj, const PxTransform & inArg){ inObj->setDrivePosition( inArg ); } +PxTransform getPxD6Joint_DrivePosition( const PxD6Joint* inObj ) { return inObj->getDrivePosition(); } +void setPxD6Joint_ProjectionLinearTolerance( PxD6Joint* inObj, PxReal inArg){ inObj->setProjectionLinearTolerance( inArg ); } +PxReal getPxD6Joint_ProjectionLinearTolerance( const PxD6Joint* inObj ) { return inObj->getProjectionLinearTolerance(); } +void setPxD6Joint_ProjectionAngularTolerance( PxD6Joint* inObj, PxReal inArg){ inObj->setProjectionAngularTolerance( inArg ); } +PxReal getPxD6Joint_ProjectionAngularTolerance( const PxD6Joint* inObj ) { return inObj->getProjectionAngularTolerance(); } +const char * getPxD6Joint_ConcreteTypeName( const PxD6Joint* inObj ) { return inObj->getConcreteTypeName(); } + PxD6JointGeneratedInfo::PxD6JointGeneratedInfo() + : Motion( "Motion", setPxD6Joint_Motion, getPxD6Joint_Motion) + , TwistAngle( "TwistAngle", getPxD6Joint_TwistAngle) + , Twist( "Twist", getPxD6Joint_Twist) + , SwingYAngle( "SwingYAngle", getPxD6Joint_SwingYAngle) + , SwingZAngle( "SwingZAngle", getPxD6Joint_SwingZAngle) + , DistanceLimit( "DistanceLimit", setPxD6Joint_DistanceLimit, getPxD6Joint_DistanceLimit) + , LinearLimit( "LinearLimit", setPxD6Joint_LinearLimit, getPxD6Joint_LinearLimit) + , TwistLimit( "TwistLimit", setPxD6Joint_TwistLimit, getPxD6Joint_TwistLimit) + , SwingLimit( "SwingLimit", setPxD6Joint_SwingLimit, getPxD6Joint_SwingLimit) + , PyramidSwingLimit( "PyramidSwingLimit", setPxD6Joint_PyramidSwingLimit, getPxD6Joint_PyramidSwingLimit) + , Drive( "Drive", setPxD6Joint_Drive, getPxD6Joint_Drive) + , DrivePosition( "DrivePosition", setPxD6Joint_DrivePosition, getPxD6Joint_DrivePosition) + , ProjectionLinearTolerance( "ProjectionLinearTolerance", setPxD6Joint_ProjectionLinearTolerance, getPxD6Joint_ProjectionLinearTolerance) + , ProjectionAngularTolerance( "ProjectionAngularTolerance", setPxD6Joint_ProjectionAngularTolerance, getPxD6Joint_ProjectionAngularTolerance) + , ConcreteTypeName( "ConcreteTypeName", getPxD6Joint_ConcreteTypeName) +{} + PxD6JointGeneratedValues::PxD6JointGeneratedValues( const PxD6Joint* inSource ) + :PxJointGeneratedValues( inSource ) + ,TwistAngle( getPxD6Joint_TwistAngle( inSource ) ) + ,Twist( getPxD6Joint_Twist( inSource ) ) + ,SwingYAngle( getPxD6Joint_SwingYAngle( inSource ) ) + ,SwingZAngle( getPxD6Joint_SwingZAngle( inSource ) ) + ,DistanceLimit( getPxD6Joint_DistanceLimit( inSource ) ) + ,LinearLimit( getPxD6Joint_LinearLimit( inSource ) ) + ,TwistLimit( getPxD6Joint_TwistLimit( inSource ) ) + ,SwingLimit( getPxD6Joint_SwingLimit( inSource ) ) + ,PyramidSwingLimit( getPxD6Joint_PyramidSwingLimit( inSource ) ) + ,DrivePosition( getPxD6Joint_DrivePosition( inSource ) ) + ,ProjectionLinearTolerance( getPxD6Joint_ProjectionLinearTolerance( inSource ) ) + ,ProjectionAngularTolerance( getPxD6Joint_ProjectionAngularTolerance( inSource ) ) + ,ConcreteTypeName( getPxD6Joint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); + for ( PxU32 idx = 0; idx < static_cast( physx::PxD6Axis::eCOUNT ); ++idx ) + Motion[idx] = getPxD6Joint_Motion( inSource, static_cast< PxD6Axis::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxD6Drive::eCOUNT ); ++idx ) + Drive[idx] = getPxD6Joint_Drive( inSource, static_cast< PxD6Drive::Enum >( idx ) ); +} +PxReal getPxDistanceJoint_Distance( const PxDistanceJoint* inObj ) { return inObj->getDistance(); } +void setPxDistanceJoint_MinDistance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setMinDistance( inArg ); } +PxReal getPxDistanceJoint_MinDistance( const PxDistanceJoint* inObj ) { return inObj->getMinDistance(); } +void setPxDistanceJoint_MaxDistance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setMaxDistance( inArg ); } +PxReal getPxDistanceJoint_MaxDistance( const PxDistanceJoint* inObj ) { return inObj->getMaxDistance(); } +void setPxDistanceJoint_Tolerance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setTolerance( inArg ); } +PxReal getPxDistanceJoint_Tolerance( const PxDistanceJoint* inObj ) { return inObj->getTolerance(); } +void setPxDistanceJoint_Stiffness( PxDistanceJoint* inObj, PxReal inArg){ inObj->setStiffness( inArg ); } +PxReal getPxDistanceJoint_Stiffness( const PxDistanceJoint* inObj ) { return inObj->getStiffness(); } +void setPxDistanceJoint_Damping( PxDistanceJoint* inObj, PxReal inArg){ inObj->setDamping( inArg ); } +PxReal getPxDistanceJoint_Damping( const PxDistanceJoint* inObj ) { return inObj->getDamping(); } +void setPxDistanceJoint_ContactDistance( PxDistanceJoint* inObj, PxReal inArg){ inObj->setContactDistance( inArg ); } +PxReal getPxDistanceJoint_ContactDistance( const PxDistanceJoint* inObj ) { return inObj->getContactDistance(); } +void setPxDistanceJoint_DistanceJointFlags( PxDistanceJoint* inObj, PxDistanceJointFlags inArg){ inObj->setDistanceJointFlags( inArg ); } +PxDistanceJointFlags getPxDistanceJoint_DistanceJointFlags( const PxDistanceJoint* inObj ) { return inObj->getDistanceJointFlags(); } +const char * getPxDistanceJoint_ConcreteTypeName( const PxDistanceJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxDistanceJointGeneratedInfo::PxDistanceJointGeneratedInfo() + : Distance( "Distance", getPxDistanceJoint_Distance) + , MinDistance( "MinDistance", setPxDistanceJoint_MinDistance, getPxDistanceJoint_MinDistance) + , MaxDistance( "MaxDistance", setPxDistanceJoint_MaxDistance, getPxDistanceJoint_MaxDistance) + , Tolerance( "Tolerance", setPxDistanceJoint_Tolerance, getPxDistanceJoint_Tolerance) + , Stiffness( "Stiffness", setPxDistanceJoint_Stiffness, getPxDistanceJoint_Stiffness) + , Damping( "Damping", setPxDistanceJoint_Damping, getPxDistanceJoint_Damping) + , ContactDistance( "ContactDistance", setPxDistanceJoint_ContactDistance, getPxDistanceJoint_ContactDistance) + , DistanceJointFlags( "DistanceJointFlags", setPxDistanceJoint_DistanceJointFlags, getPxDistanceJoint_DistanceJointFlags) + , ConcreteTypeName( "ConcreteTypeName", getPxDistanceJoint_ConcreteTypeName) +{} + PxDistanceJointGeneratedValues::PxDistanceJointGeneratedValues( const PxDistanceJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,Distance( getPxDistanceJoint_Distance( inSource ) ) + ,MinDistance( getPxDistanceJoint_MinDistance( inSource ) ) + ,MaxDistance( getPxDistanceJoint_MaxDistance( inSource ) ) + ,Tolerance( getPxDistanceJoint_Tolerance( inSource ) ) + ,Stiffness( getPxDistanceJoint_Stiffness( inSource ) ) + ,Damping( getPxDistanceJoint_Damping( inSource ) ) + ,ContactDistance( getPxDistanceJoint_ContactDistance( inSource ) ) + ,DistanceJointFlags( getPxDistanceJoint_DistanceJointFlags( inSource ) ) + ,ConcreteTypeName( getPxDistanceJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxContactJoint_Contact( PxContactJoint* inObj, const PxVec3 & inArg){ inObj->setContact( inArg ); } +PxVec3 getPxContactJoint_Contact( const PxContactJoint* inObj ) { return inObj->getContact(); } +void setPxContactJoint_ContactNormal( PxContactJoint* inObj, const PxVec3 & inArg){ inObj->setContactNormal( inArg ); } +PxVec3 getPxContactJoint_ContactNormal( const PxContactJoint* inObj ) { return inObj->getContactNormal(); } +void setPxContactJoint_Penetration( PxContactJoint* inObj, const PxReal inArg){ inObj->setPenetration( inArg ); } +PxReal getPxContactJoint_Penetration( const PxContactJoint* inObj ) { return inObj->getPenetration(); } +void setPxContactJoint_Restitution( PxContactJoint* inObj, const PxReal inArg){ inObj->setRestitution( inArg ); } +PxReal getPxContactJoint_Restitution( const PxContactJoint* inObj ) { return inObj->getRestitution(); } +void setPxContactJoint_BounceThreshold( PxContactJoint* inObj, const PxReal inArg){ inObj->setBounceThreshold( inArg ); } +PxReal getPxContactJoint_BounceThreshold( const PxContactJoint* inObj ) { return inObj->getBounceThreshold(); } +const char * getPxContactJoint_ConcreteTypeName( const PxContactJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxContactJointGeneratedInfo::PxContactJointGeneratedInfo() + : Contact( "Contact", setPxContactJoint_Contact, getPxContactJoint_Contact) + , ContactNormal( "ContactNormal", setPxContactJoint_ContactNormal, getPxContactJoint_ContactNormal) + , Penetration( "Penetration", setPxContactJoint_Penetration, getPxContactJoint_Penetration) + , Restitution( "Restitution", setPxContactJoint_Restitution, getPxContactJoint_Restitution) + , BounceThreshold( "BounceThreshold", setPxContactJoint_BounceThreshold, getPxContactJoint_BounceThreshold) + , ConcreteTypeName( "ConcreteTypeName", getPxContactJoint_ConcreteTypeName) +{} + PxContactJointGeneratedValues::PxContactJointGeneratedValues( const PxContactJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,Contact( getPxContactJoint_Contact( inSource ) ) + ,ContactNormal( getPxContactJoint_ContactNormal( inSource ) ) + ,Penetration( getPxContactJoint_Penetration( inSource ) ) + ,Restitution( getPxContactJoint_Restitution( inSource ) ) + ,BounceThreshold( getPxContactJoint_BounceThreshold( inSource ) ) + ,ConcreteTypeName( getPxContactJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxFixedJoint_ProjectionLinearTolerance( PxFixedJoint* inObj, PxReal inArg){ inObj->setProjectionLinearTolerance( inArg ); } +PxReal getPxFixedJoint_ProjectionLinearTolerance( const PxFixedJoint* inObj ) { return inObj->getProjectionLinearTolerance(); } +void setPxFixedJoint_ProjectionAngularTolerance( PxFixedJoint* inObj, PxReal inArg){ inObj->setProjectionAngularTolerance( inArg ); } +PxReal getPxFixedJoint_ProjectionAngularTolerance( const PxFixedJoint* inObj ) { return inObj->getProjectionAngularTolerance(); } +const char * getPxFixedJoint_ConcreteTypeName( const PxFixedJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxFixedJointGeneratedInfo::PxFixedJointGeneratedInfo() + : ProjectionLinearTolerance( "ProjectionLinearTolerance", setPxFixedJoint_ProjectionLinearTolerance, getPxFixedJoint_ProjectionLinearTolerance) + , ProjectionAngularTolerance( "ProjectionAngularTolerance", setPxFixedJoint_ProjectionAngularTolerance, getPxFixedJoint_ProjectionAngularTolerance) + , ConcreteTypeName( "ConcreteTypeName", getPxFixedJoint_ConcreteTypeName) +{} + PxFixedJointGeneratedValues::PxFixedJointGeneratedValues( const PxFixedJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,ProjectionLinearTolerance( getPxFixedJoint_ProjectionLinearTolerance( inSource ) ) + ,ProjectionAngularTolerance( getPxFixedJoint_ProjectionAngularTolerance( inSource ) ) + ,ConcreteTypeName( getPxFixedJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxReal getPxPrismaticJoint_Position( const PxPrismaticJoint* inObj ) { return inObj->getPosition(); } +PxReal getPxPrismaticJoint_Velocity( const PxPrismaticJoint* inObj ) { return inObj->getVelocity(); } +void setPxPrismaticJoint_Limit( PxPrismaticJoint* inObj, const PxJointLinearLimitPair & inArg){ inObj->setLimit( inArg ); } +PxJointLinearLimitPair getPxPrismaticJoint_Limit( const PxPrismaticJoint* inObj ) { return inObj->getLimit(); } +void setPxPrismaticJoint_PrismaticJointFlags( PxPrismaticJoint* inObj, PxPrismaticJointFlags inArg){ inObj->setPrismaticJointFlags( inArg ); } +PxPrismaticJointFlags getPxPrismaticJoint_PrismaticJointFlags( const PxPrismaticJoint* inObj ) { return inObj->getPrismaticJointFlags(); } +void setPxPrismaticJoint_ProjectionLinearTolerance( PxPrismaticJoint* inObj, PxReal inArg){ inObj->setProjectionLinearTolerance( inArg ); } +PxReal getPxPrismaticJoint_ProjectionLinearTolerance( const PxPrismaticJoint* inObj ) { return inObj->getProjectionLinearTolerance(); } +void setPxPrismaticJoint_ProjectionAngularTolerance( PxPrismaticJoint* inObj, PxReal inArg){ inObj->setProjectionAngularTolerance( inArg ); } +PxReal getPxPrismaticJoint_ProjectionAngularTolerance( const PxPrismaticJoint* inObj ) { return inObj->getProjectionAngularTolerance(); } +const char * getPxPrismaticJoint_ConcreteTypeName( const PxPrismaticJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxPrismaticJointGeneratedInfo::PxPrismaticJointGeneratedInfo() + : Position( "Position", getPxPrismaticJoint_Position) + , Velocity( "Velocity", getPxPrismaticJoint_Velocity) + , Limit( "Limit", setPxPrismaticJoint_Limit, getPxPrismaticJoint_Limit) + , PrismaticJointFlags( "PrismaticJointFlags", setPxPrismaticJoint_PrismaticJointFlags, getPxPrismaticJoint_PrismaticJointFlags) + , ProjectionLinearTolerance( "ProjectionLinearTolerance", setPxPrismaticJoint_ProjectionLinearTolerance, getPxPrismaticJoint_ProjectionLinearTolerance) + , ProjectionAngularTolerance( "ProjectionAngularTolerance", setPxPrismaticJoint_ProjectionAngularTolerance, getPxPrismaticJoint_ProjectionAngularTolerance) + , ConcreteTypeName( "ConcreteTypeName", getPxPrismaticJoint_ConcreteTypeName) +{} + PxPrismaticJointGeneratedValues::PxPrismaticJointGeneratedValues( const PxPrismaticJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,Position( getPxPrismaticJoint_Position( inSource ) ) + ,Velocity( getPxPrismaticJoint_Velocity( inSource ) ) + ,Limit( getPxPrismaticJoint_Limit( inSource ) ) + ,PrismaticJointFlags( getPxPrismaticJoint_PrismaticJointFlags( inSource ) ) + ,ProjectionLinearTolerance( getPxPrismaticJoint_ProjectionLinearTolerance( inSource ) ) + ,ProjectionAngularTolerance( getPxPrismaticJoint_ProjectionAngularTolerance( inSource ) ) + ,ConcreteTypeName( getPxPrismaticJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxReal getPxRevoluteJoint_Angle( const PxRevoluteJoint* inObj ) { return inObj->getAngle(); } +PxReal getPxRevoluteJoint_Velocity( const PxRevoluteJoint* inObj ) { return inObj->getVelocity(); } +void setPxRevoluteJoint_Limit( PxRevoluteJoint* inObj, const PxJointAngularLimitPair & inArg){ inObj->setLimit( inArg ); } +PxJointAngularLimitPair getPxRevoluteJoint_Limit( const PxRevoluteJoint* inObj ) { return inObj->getLimit(); } +void setPxRevoluteJoint_DriveVelocity( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveVelocity( inArg ); } +PxReal getPxRevoluteJoint_DriveVelocity( const PxRevoluteJoint* inObj ) { return inObj->getDriveVelocity(); } +void setPxRevoluteJoint_DriveForceLimit( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveForceLimit( inArg ); } +PxReal getPxRevoluteJoint_DriveForceLimit( const PxRevoluteJoint* inObj ) { return inObj->getDriveForceLimit(); } +void setPxRevoluteJoint_DriveGearRatio( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setDriveGearRatio( inArg ); } +PxReal getPxRevoluteJoint_DriveGearRatio( const PxRevoluteJoint* inObj ) { return inObj->getDriveGearRatio(); } +void setPxRevoluteJoint_RevoluteJointFlags( PxRevoluteJoint* inObj, PxRevoluteJointFlags inArg){ inObj->setRevoluteJointFlags( inArg ); } +PxRevoluteJointFlags getPxRevoluteJoint_RevoluteJointFlags( const PxRevoluteJoint* inObj ) { return inObj->getRevoluteJointFlags(); } +void setPxRevoluteJoint_ProjectionLinearTolerance( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setProjectionLinearTolerance( inArg ); } +PxReal getPxRevoluteJoint_ProjectionLinearTolerance( const PxRevoluteJoint* inObj ) { return inObj->getProjectionLinearTolerance(); } +void setPxRevoluteJoint_ProjectionAngularTolerance( PxRevoluteJoint* inObj, PxReal inArg){ inObj->setProjectionAngularTolerance( inArg ); } +PxReal getPxRevoluteJoint_ProjectionAngularTolerance( const PxRevoluteJoint* inObj ) { return inObj->getProjectionAngularTolerance(); } +const char * getPxRevoluteJoint_ConcreteTypeName( const PxRevoluteJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxRevoluteJointGeneratedInfo::PxRevoluteJointGeneratedInfo() + : Angle( "Angle", getPxRevoluteJoint_Angle) + , Velocity( "Velocity", getPxRevoluteJoint_Velocity) + , Limit( "Limit", setPxRevoluteJoint_Limit, getPxRevoluteJoint_Limit) + , DriveVelocity( "DriveVelocity", setPxRevoluteJoint_DriveVelocity, getPxRevoluteJoint_DriveVelocity) + , DriveForceLimit( "DriveForceLimit", setPxRevoluteJoint_DriveForceLimit, getPxRevoluteJoint_DriveForceLimit) + , DriveGearRatio( "DriveGearRatio", setPxRevoluteJoint_DriveGearRatio, getPxRevoluteJoint_DriveGearRatio) + , RevoluteJointFlags( "RevoluteJointFlags", setPxRevoluteJoint_RevoluteJointFlags, getPxRevoluteJoint_RevoluteJointFlags) + , ProjectionLinearTolerance( "ProjectionLinearTolerance", setPxRevoluteJoint_ProjectionLinearTolerance, getPxRevoluteJoint_ProjectionLinearTolerance) + , ProjectionAngularTolerance( "ProjectionAngularTolerance", setPxRevoluteJoint_ProjectionAngularTolerance, getPxRevoluteJoint_ProjectionAngularTolerance) + , ConcreteTypeName( "ConcreteTypeName", getPxRevoluteJoint_ConcreteTypeName) +{} + PxRevoluteJointGeneratedValues::PxRevoluteJointGeneratedValues( const PxRevoluteJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,Angle( getPxRevoluteJoint_Angle( inSource ) ) + ,Velocity( getPxRevoluteJoint_Velocity( inSource ) ) + ,Limit( getPxRevoluteJoint_Limit( inSource ) ) + ,DriveVelocity( getPxRevoluteJoint_DriveVelocity( inSource ) ) + ,DriveForceLimit( getPxRevoluteJoint_DriveForceLimit( inSource ) ) + ,DriveGearRatio( getPxRevoluteJoint_DriveGearRatio( inSource ) ) + ,RevoluteJointFlags( getPxRevoluteJoint_RevoluteJointFlags( inSource ) ) + ,ProjectionLinearTolerance( getPxRevoluteJoint_ProjectionLinearTolerance( inSource ) ) + ,ProjectionAngularTolerance( getPxRevoluteJoint_ProjectionAngularTolerance( inSource ) ) + ,ConcreteTypeName( getPxRevoluteJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxSphericalJoint_LimitCone( PxSphericalJoint* inObj, const PxJointLimitCone & inArg){ inObj->setLimitCone( inArg ); } +PxJointLimitCone getPxSphericalJoint_LimitCone( const PxSphericalJoint* inObj ) { return inObj->getLimitCone(); } +PxReal getPxSphericalJoint_SwingYAngle( const PxSphericalJoint* inObj ) { return inObj->getSwingYAngle(); } +PxReal getPxSphericalJoint_SwingZAngle( const PxSphericalJoint* inObj ) { return inObj->getSwingZAngle(); } +void setPxSphericalJoint_SphericalJointFlags( PxSphericalJoint* inObj, PxSphericalJointFlags inArg){ inObj->setSphericalJointFlags( inArg ); } +PxSphericalJointFlags getPxSphericalJoint_SphericalJointFlags( const PxSphericalJoint* inObj ) { return inObj->getSphericalJointFlags(); } +void setPxSphericalJoint_ProjectionLinearTolerance( PxSphericalJoint* inObj, PxReal inArg){ inObj->setProjectionLinearTolerance( inArg ); } +PxReal getPxSphericalJoint_ProjectionLinearTolerance( const PxSphericalJoint* inObj ) { return inObj->getProjectionLinearTolerance(); } +const char * getPxSphericalJoint_ConcreteTypeName( const PxSphericalJoint* inObj ) { return inObj->getConcreteTypeName(); } + PxSphericalJointGeneratedInfo::PxSphericalJointGeneratedInfo() + : LimitCone( "LimitCone", setPxSphericalJoint_LimitCone, getPxSphericalJoint_LimitCone) + , SwingYAngle( "SwingYAngle", getPxSphericalJoint_SwingYAngle) + , SwingZAngle( "SwingZAngle", getPxSphericalJoint_SwingZAngle) + , SphericalJointFlags( "SphericalJointFlags", setPxSphericalJoint_SphericalJointFlags, getPxSphericalJoint_SphericalJointFlags) + , ProjectionLinearTolerance( "ProjectionLinearTolerance", setPxSphericalJoint_ProjectionLinearTolerance, getPxSphericalJoint_ProjectionLinearTolerance) + , ConcreteTypeName( "ConcreteTypeName", getPxSphericalJoint_ConcreteTypeName) +{} + PxSphericalJointGeneratedValues::PxSphericalJointGeneratedValues( const PxSphericalJoint* inSource ) + :PxJointGeneratedValues( inSource ) + ,LimitCone( getPxSphericalJoint_LimitCone( inSource ) ) + ,SwingYAngle( getPxSphericalJoint_SwingYAngle( inSource ) ) + ,SwingZAngle( getPxSphericalJoint_SwingZAngle( inSource ) ) + ,SphericalJointFlags( getPxSphericalJoint_SphericalJointFlags( inSource ) ) + ,ProjectionLinearTolerance( getPxSphericalJoint_ProjectionLinearTolerance( inSource ) ) + ,ConcreteTypeName( getPxSphericalJoint_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointLimitParametersRestitution( const PxJointLimitParameters* inOwner ) { return inOwner->restitution; } +inline void setPxJointLimitParametersRestitution( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->restitution = inData; } +inline PxReal getPxJointLimitParametersBounceThreshold( const PxJointLimitParameters* inOwner ) { return inOwner->bounceThreshold; } +inline void setPxJointLimitParametersBounceThreshold( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->bounceThreshold = inData; } +inline PxReal getPxJointLimitParametersStiffness( const PxJointLimitParameters* inOwner ) { return inOwner->stiffness; } +inline void setPxJointLimitParametersStiffness( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->stiffness = inData; } +inline PxReal getPxJointLimitParametersDamping( const PxJointLimitParameters* inOwner ) { return inOwner->damping; } +inline void setPxJointLimitParametersDamping( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->damping = inData; } +inline PxReal getPxJointLimitParametersContactDistance_deprecated( const PxJointLimitParameters* inOwner ) { return inOwner->contactDistance_deprecated; } +inline void setPxJointLimitParametersContactDistance_deprecated( PxJointLimitParameters* inOwner, PxReal inData) { inOwner->contactDistance_deprecated = inData; } + PxJointLimitParametersGeneratedInfo::PxJointLimitParametersGeneratedInfo() + : Restitution( "Restitution", setPxJointLimitParametersRestitution, getPxJointLimitParametersRestitution ) + , BounceThreshold( "BounceThreshold", setPxJointLimitParametersBounceThreshold, getPxJointLimitParametersBounceThreshold ) + , Stiffness( "Stiffness", setPxJointLimitParametersStiffness, getPxJointLimitParametersStiffness ) + , Damping( "Damping", setPxJointLimitParametersDamping, getPxJointLimitParametersDamping ) + , ContactDistance_deprecated( "ContactDistance_deprecated", setPxJointLimitParametersContactDistance_deprecated, getPxJointLimitParametersContactDistance_deprecated ) +{} + PxJointLimitParametersGeneratedValues::PxJointLimitParametersGeneratedValues( const PxJointLimitParameters* inSource ) + :Restitution( inSource->restitution ) + ,BounceThreshold( inSource->bounceThreshold ) + ,Stiffness( inSource->stiffness ) + ,Damping( inSource->damping ) + ,ContactDistance_deprecated( inSource->contactDistance_deprecated ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointLinearLimitValue( const PxJointLinearLimit* inOwner ) { return inOwner->value; } +inline void setPxJointLinearLimitValue( PxJointLinearLimit* inOwner, PxReal inData) { inOwner->value = inData; } + PxJointLinearLimitGeneratedInfo::PxJointLinearLimitGeneratedInfo() + : Value( "Value", setPxJointLinearLimitValue, getPxJointLinearLimitValue ) +{} + PxJointLinearLimitGeneratedValues::PxJointLinearLimitGeneratedValues( const PxJointLinearLimit* inSource ) + :PxJointLimitParametersGeneratedValues( inSource ) + ,Value( inSource->value ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointLinearLimitPairUpper( const PxJointLinearLimitPair* inOwner ) { return inOwner->upper; } +inline void setPxJointLinearLimitPairUpper( PxJointLinearLimitPair* inOwner, PxReal inData) { inOwner->upper = inData; } +inline PxReal getPxJointLinearLimitPairLower( const PxJointLinearLimitPair* inOwner ) { return inOwner->lower; } +inline void setPxJointLinearLimitPairLower( PxJointLinearLimitPair* inOwner, PxReal inData) { inOwner->lower = inData; } + PxJointLinearLimitPairGeneratedInfo::PxJointLinearLimitPairGeneratedInfo() + : Upper( "Upper", setPxJointLinearLimitPairUpper, getPxJointLinearLimitPairUpper ) + , Lower( "Lower", setPxJointLinearLimitPairLower, getPxJointLinearLimitPairLower ) +{} + PxJointLinearLimitPairGeneratedValues::PxJointLinearLimitPairGeneratedValues( const PxJointLinearLimitPair* inSource ) + :PxJointLimitParametersGeneratedValues( inSource ) + ,Upper( inSource->upper ) + ,Lower( inSource->lower ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointAngularLimitPairUpper( const PxJointAngularLimitPair* inOwner ) { return inOwner->upper; } +inline void setPxJointAngularLimitPairUpper( PxJointAngularLimitPair* inOwner, PxReal inData) { inOwner->upper = inData; } +inline PxReal getPxJointAngularLimitPairLower( const PxJointAngularLimitPair* inOwner ) { return inOwner->lower; } +inline void setPxJointAngularLimitPairLower( PxJointAngularLimitPair* inOwner, PxReal inData) { inOwner->lower = inData; } + PxJointAngularLimitPairGeneratedInfo::PxJointAngularLimitPairGeneratedInfo() + : Upper( "Upper", setPxJointAngularLimitPairUpper, getPxJointAngularLimitPairUpper ) + , Lower( "Lower", setPxJointAngularLimitPairLower, getPxJointAngularLimitPairLower ) +{} + PxJointAngularLimitPairGeneratedValues::PxJointAngularLimitPairGeneratedValues( const PxJointAngularLimitPair* inSource ) + :PxJointLimitParametersGeneratedValues( inSource ) + ,Upper( inSource->upper ) + ,Lower( inSource->lower ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointLimitConeYAngle( const PxJointLimitCone* inOwner ) { return inOwner->yAngle; } +inline void setPxJointLimitConeYAngle( PxJointLimitCone* inOwner, PxReal inData) { inOwner->yAngle = inData; } +inline PxReal getPxJointLimitConeZAngle( const PxJointLimitCone* inOwner ) { return inOwner->zAngle; } +inline void setPxJointLimitConeZAngle( PxJointLimitCone* inOwner, PxReal inData) { inOwner->zAngle = inData; } + PxJointLimitConeGeneratedInfo::PxJointLimitConeGeneratedInfo() + : YAngle( "YAngle", setPxJointLimitConeYAngle, getPxJointLimitConeYAngle ) + , ZAngle( "ZAngle", setPxJointLimitConeZAngle, getPxJointLimitConeZAngle ) +{} + PxJointLimitConeGeneratedValues::PxJointLimitConeGeneratedValues( const PxJointLimitCone* inSource ) + :PxJointLimitParametersGeneratedValues( inSource ) + ,YAngle( inSource->yAngle ) + ,ZAngle( inSource->zAngle ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxJointLimitPyramidYAngleMin( const PxJointLimitPyramid* inOwner ) { return inOwner->yAngleMin; } +inline void setPxJointLimitPyramidYAngleMin( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->yAngleMin = inData; } +inline PxReal getPxJointLimitPyramidYAngleMax( const PxJointLimitPyramid* inOwner ) { return inOwner->yAngleMax; } +inline void setPxJointLimitPyramidYAngleMax( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->yAngleMax = inData; } +inline PxReal getPxJointLimitPyramidZAngleMin( const PxJointLimitPyramid* inOwner ) { return inOwner->zAngleMin; } +inline void setPxJointLimitPyramidZAngleMin( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->zAngleMin = inData; } +inline PxReal getPxJointLimitPyramidZAngleMax( const PxJointLimitPyramid* inOwner ) { return inOwner->zAngleMax; } +inline void setPxJointLimitPyramidZAngleMax( PxJointLimitPyramid* inOwner, PxReal inData) { inOwner->zAngleMax = inData; } + PxJointLimitPyramidGeneratedInfo::PxJointLimitPyramidGeneratedInfo() + : YAngleMin( "YAngleMin", setPxJointLimitPyramidYAngleMin, getPxJointLimitPyramidYAngleMin ) + , YAngleMax( "YAngleMax", setPxJointLimitPyramidYAngleMax, getPxJointLimitPyramidYAngleMax ) + , ZAngleMin( "ZAngleMin", setPxJointLimitPyramidZAngleMin, getPxJointLimitPyramidZAngleMin ) + , ZAngleMax( "ZAngleMax", setPxJointLimitPyramidZAngleMax, getPxJointLimitPyramidZAngleMax ) +{} + PxJointLimitPyramidGeneratedValues::PxJointLimitPyramidGeneratedValues( const PxJointLimitPyramid* inSource ) + :PxJointLimitParametersGeneratedValues( inSource ) + ,YAngleMin( inSource->yAngleMin ) + ,YAngleMax( inSource->yAngleMax ) + ,ZAngleMin( inSource->zAngleMin ) + ,ZAngleMax( inSource->zAngleMax ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxSpringStiffness( const PxSpring* inOwner ) { return inOwner->stiffness; } +inline void setPxSpringStiffness( PxSpring* inOwner, PxReal inData) { inOwner->stiffness = inData; } +inline PxReal getPxSpringDamping( const PxSpring* inOwner ) { return inOwner->damping; } +inline void setPxSpringDamping( PxSpring* inOwner, PxReal inData) { inOwner->damping = inData; } + PxSpringGeneratedInfo::PxSpringGeneratedInfo() + : Stiffness( "Stiffness", setPxSpringStiffness, getPxSpringStiffness ) + , Damping( "Damping", setPxSpringDamping, getPxSpringDamping ) +{} + PxSpringGeneratedValues::PxSpringGeneratedValues( const PxSpring* inSource ) + :Stiffness( inSource->stiffness ) + ,Damping( inSource->damping ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxD6JointDriveForceLimit( const PxD6JointDrive* inOwner ) { return inOwner->forceLimit; } +inline void setPxD6JointDriveForceLimit( PxD6JointDrive* inOwner, PxReal inData) { inOwner->forceLimit = inData; } +inline PxD6JointDriveFlags getPxD6JointDriveFlags( const PxD6JointDrive* inOwner ) { return inOwner->flags; } +inline void setPxD6JointDriveFlags( PxD6JointDrive* inOwner, PxD6JointDriveFlags inData) { inOwner->flags = inData; } + PxD6JointDriveGeneratedInfo::PxD6JointDriveGeneratedInfo() + : ForceLimit( "ForceLimit", setPxD6JointDriveForceLimit, getPxD6JointDriveForceLimit ) + , Flags( "Flags", setPxD6JointDriveFlags, getPxD6JointDriveFlags ) +{} + PxD6JointDriveGeneratedValues::PxD6JointDriveGeneratedValues( const PxD6JointDrive* inSource ) + :PxSpringGeneratedValues( inSource ) + ,ForceLimit( inSource->forceLimit ) + ,Flags( inSource->flags ) +{ + PX_UNUSED(inSource); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp new file mode 100644 index 0000000..a116fc1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleComponents.cpp @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleComponents.h" +#include "foundation/PxBitMap.h" + +namespace physx +{ + +bool PxVehicleChassisData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mMOI.x>0.0f && mMOI.y>0.0f && mMOI.z>0.0f, "Illegal PxVehicleChassisData.mMOI - each element of the chassis moi needs to non-zero", false); + PX_CHECK_AND_RETURN_VAL(mMass>0.0f, "Illegal PxVehicleChassisData.mMass - chassis mass needs to be non-zero", false); + return true; +} + + +bool PxVehicleEngineData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mPeakTorque>0.0f, "PxVehicleEngineData.mPeakTorque must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mMaxOmega>0.0f, "PxVehicleEngineData.mMaxOmega must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mDampingRateFullThrottle>0.0f, "PxVehicleEngineData.mDampingRateFullThrottle must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mDampingRateZeroThrottleClutchEngaged>0.0f, "PxVehicleEngineData.mDampingRateZeroThrottleClutchEngaged must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mDampingRateZeroThrottleClutchDisengaged>0.0f, "PxVehicleEngineData.mDampingRateZeroThrottleClutchDisengaged must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mRecipMOI>0.0f, "PxVehicleEngineData.mRecipMOI must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mRecipMaxOmega>0.0f, "PxVehicleEngineData.mRecipMaxOmega must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/mMaxOmega)-mRecipMaxOmega) <= 0.001f, "PxVehicleEngineData.mMaxOmega and PxVehicleEngineData.mRecipMaxOmega don't match", false); + return true; +} + +bool PxVehicleGearsData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mFinalRatio>0, "PxVehicleGearsData.mFinalRatio must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mNbRatios>=1, "PxVehicleGearsData.mNbRatios must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mSwitchTime>=0.0f, "PxVehicleGearsData.mSwitchTime must be greater than or equal to zero", false); + + PX_CHECK_AND_RETURN_VAL(mRatios[PxVehicleGearsData::eREVERSE]<0.0f, "PxVehicleGearsData.mRatios[PxVehicleGearsData::eREVERSE] must be less than zero", false); + PX_CHECK_AND_RETURN_VAL(mRatios[PxVehicleGearsData::eNEUTRAL]==0.0f, "PxVehicleGearsData.mRatios[PxVehicleGearsData::eNEUTRAL] must be zero", false); + for(PxU32 i=PxVehicleGearsData::eFIRST;i0.0f, "Forward gear ratios must be greater than zero", false); + } + for(PxU32 i=PxVehicleGearsData::eSECOND;i=0.0f, "PxVehicleAutoBoxData.mUpRatios must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mDownRatios[i]>=0.0f, "PxVehicleAutoBoxData.mDownRatios must be greater than or equal to zero", false); + } + return true; +} + +bool PxVehicleDifferential4WData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mFrontRearSplit<=1.0f && mFrontRearSplit>=0.0f, "PxVehicleDifferential4WData.mFrontRearSplit must be in range (0,1)", false); + PX_CHECK_AND_RETURN_VAL(mFrontLeftRightSplit<=1.0f && mFrontLeftRightSplit>=0.0f, "PxVehicleDifferential4WData.mFrontLeftRightSplit must be in range (0,1)", false); + PX_CHECK_AND_RETURN_VAL(mRearLeftRightSplit<=1.0f || mRearLeftRightSplit>=0.0f, "PxVehicleDifferential4WData.mRearLeftRightSplit must be in range (0,1)", false); + PX_CHECK_AND_RETURN_VAL(mCentreBias>=1.0f, "PxVehicleDifferential4WData.mCentreBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(mFrontBias>=1.0f, "PxVehicleDifferential4WData.mFrontBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(mRearBias>=1.0f, "PxVehicleDifferential4WData.mRearBias must be greater than or equal to 1.0f", false); + PX_CHECK_AND_RETURN_VAL(mType> 5); + PxU32 numDrivenWheels=mNbDrivenWheels; + if(drivenState) + { + if(!bitmap.test(wheelId)) + { + numDrivenWheels++; + bitmap.set(wheelId); + mInvNbDrivenWheels=1.0f/(1.0f*numDrivenWheels); + } + } + else if(bitmap.test(wheelId)) + { + numDrivenWheels--; + bitmap.reset(wheelId); + mInvNbDrivenWheels = numDrivenWheels>0.0f ? 1.0f/(1.0f*numDrivenWheels) : 0.0f; + } + mNbDrivenWheels=numDrivenWheels; +} + +bool PxVehicleDifferentialNWData::getIsDrivenWheel(const PxU32 wheelId) const +{ + PxBitMap bitmap; + bitmap.setWords(const_cast(mBitmapBuffer),((PX_MAX_NB_WHEELS + 31) & ~31) >> 5); + return (bitmap.test(wheelId) ? true : false); +} + +PxU32 PxVehicleDifferentialNWData::getDrivenWheelStatus() const +{ + PX_ASSERT(((PX_MAX_NB_WHEELS + 31) & ~31) >> 5 == 1); + return mBitmapBuffer[0]; +} + +void PxVehicleDifferentialNWData::setDrivenWheelStatus(PxU32 status) +{ + PX_ASSERT(((PX_MAX_NB_WHEELS + 31) & ~31) >> 5 == 1); + + PxBitMap bitmap; + bitmap.setWords(&status, 1); + + for(PxU32 i = 0; i < PX_MAX_NB_WHEELS; ++i) + { + setDrivenWheel(i, !!bitmap.test(i)); + } +} + +bool PxVehicleDifferentialNWData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mNbDrivenWheels<=PX_MAX_NB_WHEELS, "PxVehicleDifferentialNWData.mNbDrivenWheels must be in range (0,20)", false); + return true; +} + +bool PxVehicleAckermannGeometryData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mAccuracy>=0.0f && mAccuracy<=1.0f, "PxVehicleAckermannGeometryData.mAccuracy must be in range (0,1)", false); + PX_CHECK_AND_RETURN_VAL(mFrontWidth>0.0f, "PxVehicleAckermannGeometryData.mFrontWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mRearWidth>0.0f, "PxVehicleAckermannGeometryData.mRearWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mAxleSeparation>0.0f, "PxVehicleAckermannGeometryData.mAxleSeparation must be greater than zero", false); + return true; +} + +bool PxVehicleClutchData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mStrength>0, "PxVehicleClutchData.mStrength must be greater than zero", false); + return true; +} + +bool PxVehicleTireLoadFilterData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mMaxNormalisedLoad>=mMinNormalisedLoad, "PxVehicleTireLoadFilterData.mMaxNormalisedLoad must be greater than or equal to PxVehicleTireLoadFilterData.mMinNormalisedLoad", false); + PX_CHECK_AND_RETURN_VAL(mMaxFilteredNormalisedLoad>0, "PxVehicleTireLoadFilterData.mMaxFilteredNormalisedLoad must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/(mMaxNormalisedLoad - mMinNormalisedLoad)) - mDenominator) < 0.001f, "PxVehicleTireLoadFilterData.mMaxFilteredNormalisedLoad, PxVehicleTireLoadFilterData.mMinNormalisedLoad, and PxVehicleTireLoadFilterData.mDenominator don't match", false); + return true; +} + +bool PxVehicleWheelData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mRadius>0.0f, "PxVehicleWheelData.mRadius must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mWidth>0.0f, "PxVehicleWheelData.mWidth must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mMass>0.0f, "PxVehicleWheelData.mMass must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mMOI>0.0f, "PxVehicleWheelData.mMOI must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mDampingRate>0.0f, "PxVehicleWheelData.mDampingRate must be greater than zero", false); + PX_CHECK_AND_RETURN_VAL(mMaxBrakeTorque>=0.0f, "PxVehicleWheelData.mMaxBrakeTorque must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mMaxHandBrakeTorque>=0.0f, "PxVehicleWheelData.mMaxHandBrakeTorque must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mToeAngle<=PxPi, "PxVehicleWheelData.mToeAngle must be less than Pi", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/mRadius) - mRecipRadius) < 0.001f, "PxVehicleWheelData.mRadius and PxVehicleWheelData.mRecipRadius don't match", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/mMOI) - mRecipMOI) < 0.001f, "PxVehicleWheelData.mMOI and PxVehicleWheelData.mRecipMOI don't match", false); + return true; +} + +bool PxVehicleSuspensionData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mSpringStrength>=0.0f, "PxVehicleSuspensionData.mSpringStrength must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mSpringDamperRate>=0.0f, "PxVehicleSuspensionData.mSpringDamperRate must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mMaxCompression>=0.0f, "PxVehicleSuspensionData.mMaxCompression must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mMaxDroop>=0.0f, "PxVehicleSuspensionData.mMaxDroop must be greater than or equal to zero", false); + PX_CHECK_AND_RETURN_VAL(mSprungMass>=0.0f, "PxVehicleSuspensionData.mSprungMass must be greater than or equal to zero", false); + return true; +} + +bool PxVehicleAntiRollBarData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(((mWheel0< PX_MAX_NB_WHEELS) && (mWheel1 < PX_MAX_NB_WHEELS)), "PxVehicleAntiRoll.mWheel0 and PxVehicleAntiRoll.mWheel1 are an illegal pair", false); + PX_CHECK_AND_RETURN_VAL((mWheel0 != mWheel1), "PxVehicleAntiRoll.mWheel0 == PxVehicleAntiRoll.mWheel1", false); + PX_CHECK_AND_RETURN_VAL(mStiffness>=0, "PxVehicleAntiRoll::mStiffness must be greater than or equal to zero", false); + return true; +} + +bool PxVehicleTireData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mFrictionVsSlipGraph[0][0]>=0.0f && mFrictionVsSlipGraph[0][1]>=0.0f, "Illegal values for mFrictionVsSlipGraph[0]", false); + PX_CHECK_AND_RETURN_VAL(mFrictionVsSlipGraph[1][0]>=0.0f && mFrictionVsSlipGraph[1][1]>=0.0f, "Illegal values for mFrictionVsSlipGraph[1]", false); + PX_CHECK_AND_RETURN_VAL(mFrictionVsSlipGraph[2][0]>=0.0f && mFrictionVsSlipGraph[2][1]>=0.0f, "Illegal values for mFrictionVsSlipGraph[2]", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0])) - mFrictionVsSlipGraphRecipx1Minusx0) < 0.001f, "PxVehicleTireData.mFrictionVsSlipGraphRecipx1Minusx0 not set up", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0])) - mFrictionVsSlipGraphRecipx2Minusx1) < 0.001f, "PxVehicleTireData.mFrictionVsSlipGraphRecipx2Minusx1 not set up", false); + return true; +} +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp new file mode 100644 index 0000000..a0bc4f1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDrive.cpp @@ -0,0 +1,212 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleSDK.h" +#include "PxRigidDynamic.h" + +#include "foundation/PxUtilities.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxErrors.h" + +namespace physx +{ + +bool PxVehicleDriveSimData::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mEngine.isValid(), "Invalid PxVehicleCoreSimulationData.mEngine", false); + PX_CHECK_AND_RETURN_VAL(mGears.isValid(), "Invalid PxVehicleCoreSimulationData.mGears", false); + PX_CHECK_AND_RETURN_VAL(mClutch.isValid(), "Invalid PxVehicleCoreSimulationData.mClutch", false); + PX_CHECK_AND_RETURN_VAL(mAutoBox.isValid(), "Invalid PxVehicleCoreSimulationData.mAutoBox", false); + return true; +} + +void PxVehicleDriveSimData::setEngineData(const PxVehicleEngineData& engine) +{ + PX_CHECK_AND_RETURN(engine.mTorqueCurve.getNbDataPairs()>0, "Engine torque curve must specify at least one entry"); + PX_CHECK_AND_RETURN(engine.mPeakTorque>0, "Engine peak torque must be greater than zero"); + PX_CHECK_AND_RETURN(engine.mMaxOmega>0, "Engine max omega must be greater than zero"); + PX_CHECK_AND_RETURN(engine.mDampingRateFullThrottle>=0, "Full throttle damping rate must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(engine.mDampingRateZeroThrottleClutchEngaged>=0, "Zero throttle clutch engaged damping rate must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(engine.mDampingRateZeroThrottleClutchDisengaged>=0, "Zero throttle clutch disengaged damping rate must be greater than or equal to zero"); + + mEngine=engine; + mEngine.mRecipMOI=1.0f/engine.mMOI; + mEngine.mRecipMaxOmega=1.0f/engine.mMaxOmega; +} + +void PxVehicleDriveSimData::setGearsData(const PxVehicleGearsData& gears) +{ + PX_CHECK_AND_RETURN(gears.mRatios[PxVehicleGearsData::eREVERSE]<0, "Reverse gear ratio must be negative"); + PX_CHECK_AND_RETURN(gears.mRatios[PxVehicleGearsData::eNEUTRAL]==0, "Neutral gear ratio must be zero"); + PX_CHECK_AND_RETURN(gears.mRatios[PxVehicleGearsData::eFIRST]>0, "First gear ratio must be positive"); + PX_CHECK_AND_RETURN(PxVehicleGearsData::eSECOND>=gears.mNbRatios || (gears.mRatios[PxVehicleGearsData::eSECOND]>0 && gears.mRatios[PxVehicleGearsData::eSECOND] < gears.mRatios[PxVehicleGearsData::eFIRST]), "Second gear ratio must be positive and less than first gear ratio"); + PX_CHECK_AND_RETURN(PxVehicleGearsData::eTHIRD>=gears.mNbRatios || (gears.mRatios[PxVehicleGearsData::eTHIRD]>0 && gears.mRatios[PxVehicleGearsData::eTHIRD] < gears.mRatios[PxVehicleGearsData::eSECOND]), "Third gear ratio must be positive and less than second gear ratio"); + PX_CHECK_AND_RETURN(PxVehicleGearsData::eFOURTH>=gears.mNbRatios || (gears.mRatios[PxVehicleGearsData::eFOURTH]>0 && gears.mRatios[PxVehicleGearsData::eFOURTH] < gears.mRatios[PxVehicleGearsData::eTHIRD]), "Fourth gear ratio must be positive and less than third gear ratio"); + PX_CHECK_AND_RETURN(PxVehicleGearsData::eFIFTH>=gears.mNbRatios || (gears.mRatios[PxVehicleGearsData::eFIFTH]>0 && gears.mRatios[PxVehicleGearsData::eFIFTH] < gears.mRatios[PxVehicleGearsData::eFOURTH]), "Fifth gear ratio must be positive and less than fourth gear ratio"); + PX_CHECK_AND_RETURN(PxVehicleGearsData::eSIXTH>=gears.mNbRatios || (gears.mRatios[PxVehicleGearsData::eSIXTH]>0 && gears.mRatios[PxVehicleGearsData::eSIXTH] < gears.mRatios[PxVehicleGearsData::eFIFTH]), "Sixth gear ratio must be positive and less than fifth gear ratio"); + PX_CHECK_AND_RETURN(gears.mFinalRatio>0, "Final gear ratio must be greater than zero"); + PX_CHECK_AND_RETURN(gears.mNbRatios>=3, "Number of gear ratios must be at least 3 - we need at least reverse, neutral, and a forward gear"); + + mGears=gears; +} + +void PxVehicleDriveSimData::setClutchData(const PxVehicleClutchData& clutch) +{ + PX_CHECK_AND_RETURN(clutch.mStrength>0, "Clutch strength must be greater than zero"); + PX_CHECK_AND_RETURN(PxVehicleClutchAccuracyMode::eBEST_POSSIBLE==clutch.mAccuracyMode || clutch.mEstimateIterations > 0, "Clutch mEstimateIterations must be greater than zero in eESTIMATE mode."); + + mClutch=clutch; +} + +void PxVehicleDriveSimData::setAutoBoxData(const PxVehicleAutoBoxData& autobox) +{ + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eREVERSE]>=0, "Autobox gearup ratio in reverse must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eNEUTRAL]>=0, "Autobox gearup ratio in neutral must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eFIRST]>=0, "Autobox gearup ratio in first must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eSECOND]>=0, "Autobox gearup ratio in second must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eTHIRD]>=0, "Autobox gearup ratio in third must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eFOURTH]>=0, "Autobox gearup ratio in fourth must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mUpRatios[PxVehicleGearsData::eFIFTH]>=0, "Autobox gearup ratio in fifth must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eREVERSE]>=0, "Autobox geardown ratio in reverse must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eNEUTRAL]>=0, "Autobox geardown ratio in neutral must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eFIRST]>=0, "Autobox geardown ratio in first must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eSECOND]>=0, "Autobox geardown ratio in second must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eTHIRD]>=0, "Autobox geardown ratio in third must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eFOURTH]>=0, "Autobox geardown ratio in fourth must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eFIFTH]>=0, "Autobox geardown ratio in fifth must be greater than zero"); + PX_CHECK_AND_RETURN(autobox.mDownRatios[PxVehicleGearsData::eSIXTH]>=0, "Autobox geardown ratio in fifth must be greater than zero"); + + mAutoBox=autobox; +} + +/////////////////////////////////// + +PxVehicleDriveDynData::PxVehicleDriveDynData() + : mUseAutoGears(false), + mGearUpPressed(false), + mGearDownPressed(false), + mCurrentGear(PxVehicleGearsData::eNEUTRAL), + mTargetGear(PxVehicleGearsData::eNEUTRAL), + mEnginespeed(0.0f), + mGearSwitchTime(0.0f), + mAutoBoxSwitchTime(0.0f) +{ + for(PxU32 i=0;i=-1.01f && analogVal<=1.01f, "PxVehicleDriveDynData::setAnalogInput - analogVal must be in range (-1,1)"); + PX_CHECK_AND_RETURN(type=0 && diff.mFrontRearSplit<=1.0f), "Diff torque split between front and rear must be in range (0,1)"); + PX_CHECK_AND_RETURN(diff.mType!=PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD || (diff.mCentreBias>=1), "Diff centre bias must be greater than or equal to 1"); + PX_CHECK_AND_RETURN((diff.mType!=PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD && diff.mType!=PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD) || (diff.mFrontBias>=1), "Diff front bias must be greater than or equal to 1"); + PX_CHECK_AND_RETURN((diff.mType!=PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD && diff.mType!=PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD) || (diff.mRearBias>=1), "Diff rear bias must be greater than or equal to 1"); + PX_CHECK_AND_RETURN(diff.mType 0, "Illegal ackermannData.mFrontWidth - must be greater than zero"); + PX_CHECK_AND_RETURN(ackermannData.mRearWidth > 0, "Illegal ackermannData.mRearWidth - must be greater than zero"); + PX_CHECK_AND_RETURN(ackermannData.mAxleSeparation > 0, "Illegal ackermannData.mAxleSeparation - must be greater than zero"); + + mAckermannGeometry = ackermannData; +} + +/////////////////////////////////// + +bool PxVehicleDrive4W::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(PxVehicleDrive::isValid(), "invalid PxVehicleDrive", false); + PX_CHECK_AND_RETURN_VAL(mDriveSimData.isValid(), "Invalid PxVehicleNW.mCoreSimData", false); + return true; +} + +PxVehicleDrive4W* PxVehicleDrive4W::allocate(const PxU32 numWheels) +{ + PX_CHECK_AND_RETURN_NULL(numWheels>=4, "PxVehicleDrive4W::allocate - needs to have at least 4 wheels"); + PX_CHECK_AND_RETURN_NULL(gToleranceScaleLength > 0, "PxVehicleDrive4W::allocate - need to call PxInitVehicleSDK"); + + //Compute the bytes needed. + const PxU32 byteSize = sizeof(PxVehicleDrive4W) + PxVehicleDrive::computeByteSize(numWheels); + + //Allocate the memory. + PxVehicleDrive4W* veh = static_cast(PX_ALLOC(byteSize, "PxVehicleDrive4W")); + PxMarkSerializedMemory(veh, byteSize); + PX_PLACEMENT_NEW(veh, PxVehicleDrive4W()); + + //Patch up the pointers. + PxU8* ptr = reinterpret_cast(veh) + sizeof(PxVehicleDrive4W); + ptr=PxVehicleDrive::patchupPointers(numWheels, veh, ptr); + + //Initialise wheels. + veh->init(numWheels); + + //Set the vehicle type. + veh->mType = PxVehicleTypes::eDRIVE4W; + + return veh; +} + +void PxVehicleDrive4W::free() +{ + PxVehicleDrive::free(); +} + +void PxVehicleDrive4W::setup +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, + const PxU32 numNonDrivenWheels) +{ + PX_CHECK_AND_RETURN(driveData.isValid(), "PxVehicleDrive4W::setup - invalid driveData"); + PX_CHECK_AND_RETURN(wheelsData.getNbWheels() >= 4, "PxVehicleDrive4W::setup - needs to have at least 4 wheels"); + + //Set up the wheels. + PxVehicleDrive::setup(physics,vehActor,wheelsData,4,numNonDrivenWheels); + + //Start setting up the drive. + PX_CHECK_MSG(driveData.isValid(), "PxVehicle4WDrive - invalid driveData"); + + //Copy the simulation data. + mDriveSimData = driveData; +} + +PxVehicleDrive4W* PxVehicleDrive4W::create +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, + const PxU32 numNonDrivenWheels) +{ + PxVehicleDrive4W* veh4W=PxVehicleDrive4W::allocate(4+numNonDrivenWheels); + veh4W->setup(physics,vehActor,wheelsData,driveData,numNonDrivenWheels); + return veh4W; +} + + +void PxVehicleDrive4W::setToRestState() +{ + //Set core to rest state. + PxVehicleDrive::setToRestState(); +} +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp new file mode 100644 index 0000000..0d60828 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveNW.cpp @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleDriveNW.h" +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleSDK.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" +#include "PxScene.h" + +#include "PxVehicleSuspWheelTire4.h" +#include "PxVehicleSuspLimitConstraintShader.h" +#include "foundation/PxUtilities.h" +#include "CmUtils.h" + +namespace physx +{ + +extern PxF32 gToleranceScaleLength; + +void PxVehicleDriveSimDataNW::setDiffData(const PxVehicleDifferentialNWData& diff) +{ + PX_CHECK_AND_RETURN(diff.isValid(), "Invalid PxVehicleCoreSimulationData.mDiff"); + mDiff=diff; +} + +bool PxVehicleDriveSimDataNW::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mDiff.isValid(), "Invalid PxVehicleDifferentialNWData", false); + PX_CHECK_AND_RETURN_VAL(PxVehicleDriveSimData::isValid(), "Invalid PxVehicleDriveSimDataNW", false); + return true; +} + +/////////////////////////////////// + +bool PxVehicleDriveNW::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(PxVehicleDrive::isValid(), "invalid PxVehicleDrive", false); + PX_CHECK_AND_RETURN_VAL(mDriveSimData.isValid(), "Invalid PxVehicleNW.mCoreSimData", false); + return true; +} + +PxVehicleDriveNW* PxVehicleDriveNW::allocate(const PxU32 numWheels) +{ + PX_CHECK_AND_RETURN_NULL(numWheels>0, "Cars with zero wheels are illegal"); + PX_CHECK_AND_RETURN_NULL(gToleranceScaleLength > 0, "PxVehicleDriveNW::allocate - need to call PxInitVehicleSDK"); + + //Compute the bytes needed. + const PxU32 byteSize = sizeof(PxVehicleDriveNW) + PxVehicleDrive::computeByteSize(numWheels); + + //Allocate the memory. + PxVehicleDriveNW* veh = static_cast(PX_ALLOC(byteSize, "PxVehicleDriveNW")); + PxMarkSerializedMemory(veh, byteSize); + PX_PLACEMENT_NEW(veh, PxVehicleDriveNW()); + + //Patch up the pointers. + PxU8* ptr = reinterpret_cast(veh) + sizeof(PxVehicleDriveNW); + ptr=PxVehicleDrive::patchupPointers(numWheels, veh, ptr); + + //Initialise + veh->init(numWheels); + + //Set the vehicle type. + veh->mType = PxVehicleTypes::eDRIVENW; + + return veh; +} + +void PxVehicleDriveNW::free() +{ + PxVehicleDrive::free(); +} + +void PxVehicleDriveNW::setup +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData, + const PxU32 numWheels) +{ + PX_CHECK_AND_RETURN(driveData.isValid(), "PxVehicleDriveNW::setup - invalid driveData"); + + //Set up the wheels. + PxVehicleDrive::setup(physics,vehActor,wheelsData,numWheels,0); + + //Start setting up the drive. + PX_CHECK_MSG(driveData.isValid(), "PxVehicleNWDrive - invalid driveData"); + + //Copy the simulation data. + mDriveSimData = driveData; +} + +PxVehicleDriveNW* PxVehicleDriveNW::create +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData, + const PxU32 numWheels) +{ + PxVehicleDriveNW* vehNW=PxVehicleDriveNW::allocate(numWheels); + vehNW->setup(physics,vehActor,wheelsData,driveData,numWheels); + return vehNW; +} + + +void PxVehicleDriveNW::setToRestState() +{ + //Set core to rest state. + PxVehicleDrive::setToRestState(); +} + + + + + + + + + + + + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp new file mode 100644 index 0000000..7a252f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleDriveTank.cpp @@ -0,0 +1,117 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleDriveTank.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleSDK.h" +#include "PxRigidDynamic.h" + +#include "CmUtils.h" + +namespace physx +{ + +extern PxF32 gToleranceScaleLength; + +bool PxVehicleDriveTank::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(PxVehicleDrive::isValid(), "invalid PxVehicleDrive", false); + PX_CHECK_AND_RETURN_VAL(mDriveSimData.isValid(), "Invalid PxVehicleDriveTank.mCoreSimData", false); + return true; +} + +PxVehicleDriveTank* PxVehicleDriveTank::allocate(const PxU32 numWheels) +{ + PX_CHECK_AND_RETURN_NULL(numWheels>0, "Cars with zero wheels are illegal"); + PX_CHECK_AND_RETURN_NULL(0 == (numWheels % 2), "PxVehicleDriveTank::allocate - needs to have even number of wheels"); + PX_CHECK_AND_RETURN_NULL(gToleranceScaleLength > 0, "PxVehicleDriveTank::allocate - need to call PxInitVehicleSDK"); + + //Compute the bytes needed. + const PxU32 byteSize = sizeof(PxVehicleDriveTank) + PxVehicleDrive::computeByteSize(numWheels); + + //Allocate the memory. + PxVehicleDriveTank* veh = static_cast(PX_ALLOC(byteSize, "PxVehicleDriveTank")); + PxMarkSerializedMemory(veh, byteSize); + PX_PLACEMENT_NEW(veh, PxVehicleDriveTank()); + + //Patch up the pointers. + PxU8* ptr = reinterpret_cast(veh) + sizeof(PxVehicleDriveTank); + PxVehicleDrive::patchupPointers(numWheels, veh, ptr); + + //Initialise. + veh->init(numWheels); + + //Set the vehicle type. + veh->mType = PxVehicleTypes::eDRIVETANK; + + //Set the default drive model. + veh->mDriveModel = PxVehicleDriveTankControlModel::eSTANDARD; + + return veh; +} + +void PxVehicleDriveTank::free() +{ + PxVehicleDrive::free(); +} + +void PxVehicleDriveTank::setup +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData, + const PxU32 numDrivenWheels) +{ + PX_CHECK_AND_RETURN(driveData.isValid(), "PxVehicleDriveTank::setup - illegal drive data"); + + //Set up the wheels. + PxVehicleDrive::setup(physics,vehActor,wheelsData,numDrivenWheels,0); + + //Start setting up the drive. + PX_CHECK_MSG(driveData.isValid(), "PxVehicle4WDrive - invalid driveData"); + + //Copy the simulation data. + mDriveSimData = driveData; +} + +PxVehicleDriveTank* PxVehicleDriveTank::create +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData, + const PxU32 numDrivenWheels) +{ + PxVehicleDriveTank* tank=PxVehicleDriveTank::allocate(numDrivenWheels); + tank->setup(physics,vehActor,wheelsData,driveData,numDrivenWheels); + return tank; +} + + +void PxVehicleDriveTank::setToRestState() +{ + //Set core to rest state. + PxVehicleDrive::setToRestState(); +} +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleLinearMath.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleLinearMath.h new file mode 100644 index 0000000..a06b5e4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleLinearMath.h @@ -0,0 +1,432 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_LINEAR_MATH_H +#define PX_VEHICLE_LINEAR_MATH_H +/** \addtogroup vehicle + @{ +*/ + +#include "vehicle/PxVehicleSDK.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +#define MAX_VECTORN_SIZE (PX_MAX_NB_WHEELS+3) + +class VectorN +{ +public: + + VectorN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= MAX_VECTORN_SIZE); + } + ~VectorN() + { + } + + VectorN(const VectorN& src) + { + for(PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + } + + PX_FORCE_INLINE VectorN& operator=(const VectorN& src) + { + for(PxU32 i = 0; i < src.mSize; i++) + { + mValues[i] = src.mValues[i]; + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxF32& operator[] (const PxU32 i) + { + PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE const PxF32& operator[] (const PxU32 i) const + { + PX_ASSERT(i < mSize); + return (mValues[i]); + } + + PX_FORCE_INLINE PxU32 getSize() const {return mSize;} + +private: + + PxF32 mValues[MAX_VECTORN_SIZE]; + PxU32 mSize; +}; + +class MatrixNN +{ +public: + + MatrixNN() + : mSize(0) + { + } + MatrixNN(const PxU32 size) + : mSize(size) + { + PX_ASSERT(mSize <= MAX_VECTORN_SIZE); + } + MatrixNN(const MatrixNN& src) + { + for(PxU32 i = 0; i < src.mSize; i++) + { + for(PxU32 j = 0; j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize=src.mSize; + } + ~MatrixNN() + { + } + + PX_FORCE_INLINE MatrixNN& operator=(const MatrixNN& src) + { + for(PxU32 i = 0;i < src.mSize; i++) + { + for(PxU32 j = 0;j < src.mSize; j++) + { + mValues[i][j] = src.mValues[i][j]; + } + } + mSize = src.mSize; + return *this; + } + + PX_FORCE_INLINE PxF32 get(const PxU32 i, const PxU32 j) const + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + return mValues[i][j]; + } + PX_FORCE_INLINE void set(const PxU32 i, const PxU32 j, const PxF32 val) + { + PX_ASSERT(i < mSize); + PX_ASSERT(j < mSize); + mValues[i][j] = val; + } + + PX_FORCE_INLINE PxU32 getSize() const {return mSize;} + + PX_FORCE_INLINE void setSize(const PxU32 size) + { + PX_ASSERT(size <= MAX_VECTORN_SIZE); + mSize = size; + } + +public: + + PxF32 mValues[MAX_VECTORN_SIZE][MAX_VECTORN_SIZE]; + PxU32 mSize; +}; + + +/* + LUPQ decomposition + + Based upon "Outer Product LU with Complete Pivoting," from Matrix Computations (4th Edition), Golub and Van Loan + + Solve A*x = b using: + + MatrixNNLUSolver solver; + solver.decomposeLU(A); + solver.solve(b, x); +*/ +class MatrixNNLUSolver +{ +private: + + MatrixNN mLU; + PxU32 mP[MAX_VECTORN_SIZE-1]; // Row permutation + PxU32 mQ[MAX_VECTORN_SIZE-1]; // Column permutation + PxF32 mdetM; + +public: + + MatrixNNLUSolver(){} + ~MatrixNNLUSolver(){} + + PxF32 getDet() const {return mdetM;} + + void decomposeLU(const MatrixNN& A) + { + const PxU32 D = A.mSize; + + mLU = A; + + mdetM = 1.0f; + + for (PxU32 k = 0; k < D-1; ++k) + { + PxU32 pivot_row = k; + PxU32 pivot_col = k; + float abs_pivot_elem = 0.0f; + for (PxU32 c = k; c < D; ++c) + { + for (PxU32 r = k; r < D; ++r) + { + const PxF32 abs_elem = PxAbs(mLU.get(r,c)); + if (abs_elem > abs_pivot_elem) + { + abs_pivot_elem = abs_elem; + pivot_row = r; + pivot_col = c; + } + } + } + + mP[k] = pivot_row; + if (pivot_row != k) + { + mdetM = -mdetM; + for (PxU32 c = 0; c < D; ++c) + { + //swap(m_LU(k,c), m_LU(pivot_row,c)); + const PxF32 pivotrowc = mLU.get(pivot_row, c); + mLU.set(pivot_row, c, mLU.get(k, c)); + mLU.set(k, c, pivotrowc); + } + } + + mQ[k] = pivot_col; + if (pivot_col != k) + { + mdetM = -mdetM; + for (PxU32 r = 0; r < D; ++r) + { + //swap(m_LU(r,k), m_LU(r,pivot_col)); + const PxF32 rpivotcol = mLU.get(r, pivot_col); + mLU.set(r,pivot_col, mLU.get(r,k)); + mLU.set(r, k, rpivotcol); + } + } + + mdetM *= mLU.get(k,k); + + if (mLU.get(k,k) != 0.0f) + { + for (PxU32 r = k+1; r < D; ++r) + { + mLU.set(r, k, mLU.get(r,k) / mLU.get(k,k)); + for (PxU32 c = k+1; c < D; ++c) + { + //m_LU(r,c) -= m_LU(r,k)*m_LU(k,c); + const PxF32 rc = mLU.get(r, c); + const PxF32 rk = mLU.get(r, k); + const PxF32 kc = mLU.get(k, c); + mLU.set(r, c, rc - rk*kc); + } + } + } + } + + mdetM *= mLU.get(D-1,D-1); + } + + //Given a matrix A and a vector b find x that satisfies Ax = b, where the matrix A is the matrix that was passed to decomposeLU. + //Returns true if the lu decomposition indicates that the matrix has an inverse and x was successfully computed. + //Returns false if the lu decomposition resulted in zero determinant ie the matrix has no inverse and no solution exists for x. + //Returns false if the size of either b or x doesn't match the size of the matrix passed to decomposeLU. + //If false is returned then each relevant element of x is set to zero. + bool solve(const VectorN& b, VectorN& x) const + { + const PxU32 D = x.getSize(); + + if((b.getSize() != x.getSize()) || (b.getSize() != mLU.getSize()) || (0.0f == mdetM)) + { + for(PxU32 i = 0; i < D; i++) + { + x[i] = 0.0f; + } + return false; + } + + x = b; + + // Perform row permutation to get Pb + for(PxU32 i = 0; i < D-1; ++i) + { + //swap(x(i), x(m_P[i])); + const PxF32 xp = x[mP[i]]; + x[mP[i]] = x[i]; + x[i] = xp; + } + + // Forward substitute to get (L^-1)Pb + for (PxU32 r = 1; r < D; ++r) + { + for (PxU32 i = 0; i < r; ++i) + { + x[r] -= mLU.get(r,i)*x[i]; + } + } + + // Back substitute to get (U^-1)(L^-1)Pb + for (PxU32 r = D; r-- > 0;) + { + for (PxU32 i = r+1; i < D; ++i) + { + x[r] -= mLU.get(r,i)*x[i]; + } + x[r] /= mLU.get(r,r); + } + + // Perform column permutation to get the solution (Q^T)(U^-1)(L^-1)Pb + for (PxU32 i = D-1; i-- > 0;) + { + //swap(x(i), x(m_Q[i])); + const PxF32 xq = x[mQ[i]]; + x[mQ[i]] = x[i]; + x[i] = xq; + } + + return true; + } + +}; + + +class MatrixNGaussSeidelSolver +{ +public: + + void solve(const PxU32 maxIterations, const PxF32 tolerance, const MatrixNN& A, const VectorN& b, VectorN& result) const + { + const PxU32 N = A.getSize(); + + VectorN DInv(N); + PxF32 bLength2 = 0.0f; + for(PxU32 i = 0; i < N; i++) + { + DInv[i] = 1.0f/A.get(i,i); + bLength2 += (b[i] * b[i]); + } + + PxU32 iteration = 0; + PxF32 error = PX_MAX_F32; + while(iteration < maxIterations && tolerance < error) + { + for(PxU32 i = 0; i < N; i++) + { + PxF32 l = 0.0f; + for(PxU32 j = 0; j < i; j++) + { + l += A.get(i,j) * result[j]; + } + + PxF32 u = 0.0f; + for(PxU32 j = i + 1; j < N; j++) + { + u += A.get(i,j) * result[j]; + } + + result[i] = DInv[i] * (b[i] - l - u); + } + + //Compute the error. + PxF32 rLength2 = 0; + for(PxU32 i = 0; i < N; i++) + { + PxF32 e = -b[i]; + for(PxU32 j = 0; j < N; j++) + { + e += A.get(i,j) * result[j]; + } + rLength2 += e * e; + } + error = (rLength2 / (bLength2 + 1e-10f)); + + iteration++; + } + } +}; + +class Matrix33Solver +{ +public: + + bool solve(const MatrixNN& A_, const VectorN& b_, VectorN& result) const + { + const PxF32 a = A_.get(0,0); + const PxF32 b = A_.get(0,1); + const PxF32 c = A_.get(0,2); + + const PxF32 d = A_.get(1,0); + const PxF32 e = A_.get(1,1); + const PxF32 f = A_.get(1,2); + + const PxF32 g = A_.get(2,0); + const PxF32 h = A_.get(2,1); + const PxF32 k = A_.get(2,2); + + const PxF32 detA = a*(e*k - f*h) - b*(k*d - f*g) + c*(d*h - e*g); + if(0.0f == detA) + { + return false; + } + const PxF32 detAInv = 1.0f/detA; + + const PxF32 A = (e*k - f*h); + const PxF32 D = -(b*k - c*h); + const PxF32 G = (b*f - c*e); + const PxF32 B = -(d*k - f*g); + const PxF32 E = (a*k - c*g); + const PxF32 H = -(a*f - c*d); + const PxF32 C = (d*h - e*g); + const PxF32 F = -(a*h - b*g); + const PxF32 K = (a*e - b*d); + + result[0] = detAInv*(A*b_[0] + D*b_[1] + G*b_[2]); + result[1] = detAInv*(B*b_[0] + E*b_[1] + H*b_[2]); + result[2] = detAInv*(C*b_[0] + F*b_[1] + K*b_[2]); + + return true; + } +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp new file mode 100644 index 0000000..49c8bdf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleMetaData.cpp @@ -0,0 +1,542 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxMetaData.h" +#include "vehicle/PxVehicleComponents.h" +#include "vehicle/PxVehicleDrive.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveNW.h" +#include "vehicle/PxVehicleDriveTank.h" + +#include "PxVehicleSuspWheelTire4.h" +#include "PxVehicleSuspLimitConstraintShader.h" + +#include "foundation/PxAllocator.h" + +using namespace physx; + +namespace +{ + typedef PxFixedSizeLookupTable PxVehicleEngineTable; + class ShadowLookupTable : public PxVehicleEngineTable + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowLookupTable) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream_, PxVehicleEngineTable, PxReal, mDataPairs, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, PxVehicleEngineTable, PxU32, mNbDataPairs, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream_, PxVehicleEngineTable, PxU32, mPad, PxMetaDataFlag::ePADDING) + } + }; +} + +static void getBinaryMetaData_PxFixedSizeLookupTable(PxOutputStream& stream) +{ + ShadowLookupTable::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxFixedSizeLookupTable, ShadowLookupTable) +} + +void PxVehicleDriveSimData::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_PxFixedSizeLookupTable(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxVehicleClutchAccuracyMode::Enum, PxU32) + + //PxVehicleEngineData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleEngineData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, ShadowLookupTable, mTorqueCurve, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mMOI, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mPeakTorque, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mMaxOmega, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mDampingRateFullThrottle, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mDampingRateZeroThrottleClutchEngaged, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mDampingRateZeroThrottleClutchDisengaged, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mRecipMOI, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleEngineData, PxReal, mRecipMaxOmega, 0) + + + //PxVehicleGearsData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleGearsData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleGearsData, PxReal, mRatios, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleGearsData, PxReal, mFinalRatio, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleGearsData, PxU32, mNbRatios, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleGearsData, PxReal, mSwitchTime, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleGearsData, PxReal, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleClutchData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleClutchData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleClutchData, PxReal, mStrength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleClutchData, PxVehicleClutchAccuracyMode::Enum, mAccuracyMode, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleClutchData, PxU32, mEstimateIterations, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleClutchData, PxU8, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleAutoBoxData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleAutoBoxData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleAutoBoxData, PxReal, mUpRatios, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleAutoBoxData, PxReal, mDownRatios, 0) + + //PxVehicleDriveSimData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDriveSimData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData, PxVehicleEngineData, mEngine, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData, PxVehicleGearsData, mGears, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData, PxVehicleClutchData, mClutch, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData, PxVehicleAutoBoxData, mAutoBox, 0) +} + +void PxVehicleDrive::getBinaryMetaData(PxOutputStream& stream) +{ + //PxVehicleDriveDynData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDriveDynData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleDriveDynData, PxReal, mControlAnalogVals, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, bool, mUseAutoGears, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, bool, mGearUpPressed, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, bool, mGearDownPressed, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, PxU32, mCurrentGear, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, PxU32, mTargetGear, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, PxReal, mEnginespeed, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, PxReal, mGearSwitchTime, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveDynData, PxReal, mAutoBoxSwitchTime, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleDriveDynData, PxU32, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleDrive + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleDrive) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDrive, PxVehicleWheels) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDrive, PxVehicleDriveDynData, mDriveDynData, 0) +} + +void PxVehicleDriveSimData4W::getBinaryMetaData(PxOutputStream& stream) +{ + //PxVehicleDifferential4WData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDifferential4WData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mFrontRearSplit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mFrontLeftRightSplit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mRearLeftRightSplit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mCentreBias, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mFrontBias, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxReal, mRearBias, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferential4WData, PxU32, mType, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleDifferential4WData, PxReal, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleAckermannGeometryData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleAckermannGeometryData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAckermannGeometryData, PxReal, mAccuracy, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAckermannGeometryData, PxReal, mFrontWidth, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAckermannGeometryData, PxReal, mRearWidth, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAckermannGeometryData, PxReal, mAxleSeparation, 0) + + //PxVehicleDriveSimData4W + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDriveSimData4W) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDriveSimData4W, PxVehicleDriveSimData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData4W, PxVehicleDifferential4WData, mDiff, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimData4W, PxVehicleAckermannGeometryData, mAckermannGeometry, 0) +} + +void PxVehicleDriveSimDataNW::getBinaryMetaData(PxOutputStream& stream) +{ + //PxVehicleDifferentialWData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDifferentialNWData) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleDifferentialNWData, PxU32, mBitmapBuffer, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferentialNWData, PxU32, mNbDrivenWheels, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferentialNWData, PxReal, mInvNbDrivenWheels, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDifferentialNWData, PxU32, mPad, 0) + + //PxVehicleDriveSimDataNW + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleDriveSimDataNW) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDriveSimDataNW, PxVehicleDriveSimData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveSimDataNW, PxVehicleDifferentialNWData, mDiff, 0) +} + +void PxVehicleNoDrive::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleDrive::getBinaryMetaData(stream); + PxVehicleWheels::getBinaryMetaData(stream); + PxVehicleDriveSimData::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleNoDrive) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleNoDrive, PxVehicleWheels) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleNoDrive, PxReal, mSteerAngles, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleNoDrive, PxReal, mDriveTorques, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleNoDrive, PxReal, mBrakeTorques, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleNoDrive, PxU32, mPad, PxMetaDataFlag::ePADDING) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mSteerAngles, mWheelsSimData.mNbWheels4, 0, PX_SERIAL_ALIGN) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mSteerAngles, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mSteerAngles, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mSteerAngles, mWheelsSimData.mNbWheels4, 0, 0) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mDriveTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mDriveTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mDriveTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mDriveTorques, mWheelsSimData.mNbWheels4, 0, 0) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mBrakeTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mBrakeTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mBrakeTorques, mWheelsSimData.mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleNoDrive, PxReal, mBrakeTorques, mWheelsSimData.mNbWheels4, 0, 0) +} + +void PxVehicleNoDrive::exportExtraData(PxSerializationContext& stream) +{ + PxVehicleWheels::exportExtraData(stream); + + PxU32 size = sizeof(PxReal)*4*mWheelsSimData.mNbWheels4; + stream.alignData(); + stream.writeData(mSteerAngles, size); + stream.writeData(mDriveTorques, size); + stream.writeData(mBrakeTorques, size); +} + +void PxVehicleNoDrive::importExtraData(PxDeserializationContext& context) +{ + PxVehicleWheels::importExtraData(context); + + context.alignExtraData(); + mSteerAngles = context.readExtraData(4*mWheelsSimData.mNbWheels4); + mDriveTorques = context.readExtraData(4*mWheelsSimData.mNbWheels4); + mBrakeTorques = context.readExtraData(4*mWheelsSimData.mNbWheels4); +} + +PxVehicleNoDrive* PxVehicleNoDrive::createObject(PxU8*& address, PxDeserializationContext& context) +{ + PxVehicleNoDrive* obj = PX_PLACEMENT_NEW(address, PxVehicleNoDrive(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(PxVehicleNoDrive); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void PxVehicleDrive4W::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleDrive::getBinaryMetaData(stream); + PxVehicleWheels::getBinaryMetaData(stream); + PxVehicleDriveSimData::getBinaryMetaData(stream); + PxVehicleDriveSimData4W::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleDrive4W) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDrive4W, PxVehicleDrive) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDrive4W, PxVehicleDriveSimData4W, mDriveSimData, 0) +} + +PxVehicleDrive4W* PxVehicleDrive4W::createObject(PxU8*& address, PxDeserializationContext& context) +{ + PxVehicleDrive4W* obj = PX_PLACEMENT_NEW(address, PxVehicleDrive4W(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(PxVehicleDrive4W); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void PxVehicleDriveNW::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleDriveSimDataNW::getBinaryMetaData(stream); + + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleDriveNW) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDriveNW, PxVehicleDrive) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveNW, PxVehicleDriveSimDataNW, mDriveSimData, 0) +} + +PxVehicleDriveNW* PxVehicleDriveNW::createObject(PxU8*& address, PxDeserializationContext& context) +{ + PxVehicleDriveNW* obj = PX_PLACEMENT_NEW(address, PxVehicleDriveNW(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(PxVehicleDriveNW); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void PxVehicleDriveTank::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleDriveTank) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleDriveTank, PxVehicleDrive) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveTank, PxVehicleDriveSimData, mDriveSimData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleDriveTank, PxU32, mDriveModel, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleDriveTank, PxU32, mPad, PxMetaDataFlag::ePADDING) +} + +PxVehicleDriveTank* PxVehicleDriveTank::createObject(PxU8*& address, PxDeserializationContext& context) +{ + PxVehicleDriveTank* obj = PX_PLACEMENT_NEW(address, PxVehicleDriveTank(PxBaseFlag::eIS_RELEASABLE)); + address += sizeof(PxVehicleDriveTank); + obj->importExtraData(context); + obj->resolveReferences(context); + return obj; +} + +void PxVehicleWheelsSimData::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleWheels4SimData::getBinaryMetaData(stream); + //PxVehicleTireLoadFilterData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleTireLoadFilterData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireLoadFilterData, PxReal, mMinNormalisedLoad, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireLoadFilterData, PxReal, mMinFilteredNormalisedLoad, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireLoadFilterData, PxReal, mMaxNormalisedLoad, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireLoadFilterData, PxReal, mMaxFilteredNormalisedLoad, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireLoadFilterData, PxReal, mDenominator, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleTireLoadFilterData, PxU32, mPad, PxMetaDataFlag::ePADDING) + + //Add anti-roll here to save us having to add an extra function. + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleAntiRollBarData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAntiRollBarData, PxU32, mWheel0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAntiRollBarData, PxU32, mWheel1, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleAntiRollBarData, PxReal, mStiffness, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleAntiRollBarData, PxU32, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleWheelsSimData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleWheelsSimData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxVehicleTireLoadFilterData, mNormalisedLoadFilter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxVehicleWheels4SimData, mWheels4SimData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mNbWheels4, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mNbActiveWheels, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxVehicleAntiRollBarData, mAntiRollBars, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mNbAntiRollBars4, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mNbActiveAntiRollBars, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mActiveWheelsBitmapBuffer, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxReal, mThresholdLongitudinalSpeed, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mLowForwardSpeedSubStepCount, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mHighForwardSpeedSubStepCount, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mMinLongSlipDenominator, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsSimData, PxU32, mFlags, 0) + +#if PX_P64_FAMILY + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheelsSimData, PxU32, mPad, PxMetaDataFlag::ePADDING) +#endif + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsSimData, PxVehicleWheels4SimData, mWheels4SimData, mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsSimData, PxVehicleAntiRollBarData, mAntiRollBars, mNbAntiRollBars4, 0, 0) +} + +void PxVehicleWheelsDynData::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleWheels4DynData::getBinaryMetaData(stream); + PxVehicleConstraintShader::getBinaryMetaData(stream); + + //PxVehicleTireForceCalculator + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleTireForceCalculator) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireForceCalculator, void*, mShaderData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireForceCalculator, PxU32, mShader, PxMetaDataFlag::ePTR) + +#if !PX_P64_FAMILY + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleTireForceCalculator, PxU32, mPad, PxMetaDataFlag::ePADDING) +#endif + + //PxVehicleWheelsDynData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleWheelsDynData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsDynData, PxVehicleWheels4DynData, mWheels4DynData, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsDynData, PxVehicleTireForceCalculator, mTireForceCalculators, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsDynData, PxU32, mUserDatas, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsDynData, PxU32, mNbWheels4, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelsDynData, PxU32, mNbActiveWheels, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheelsDynData, PxU32, mPad, PxMetaDataFlag::ePADDING) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, PxVehicleWheels4DynData, mWheels4DynData, mNbWheels4, 0, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEM(stream, PxVehicleWheelsDynData, PxVehicleTireForceCalculator, mTireForceCalculators, 0) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mTireForceCalculators, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mTireForceCalculators, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mTireForceCalculators, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mTireForceCalculators, mNbWheels4, PxMetaDataFlag::ePTR, 0) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mUserDatas, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mUserDatas, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mUserDatas, mNbWheels4, PxMetaDataFlag::ePTR, 0) + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, void, mUserDatas, mNbWheels4, PxMetaDataFlag::ePTR, 0) + + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, PxVehicleWheelsDynData, PxVehicleConstraintShader, mWheels4DynData, mNbWheels4, 0, 0) +} + +void PxVehicleWheels::exportExtraData(PxSerializationContext& stream) +{ + PxU32 size = computeByteSize(mWheelsSimData.mNbActiveWheels); + stream.alignData(); + stream.writeData(mWheelsSimData.mWheels4SimData, size); +} + +void PxVehicleWheels::importExtraData(PxDeserializationContext& context) +{ + PxU32 size = computeByteSize(mWheelsSimData.mNbActiveWheels); + PxU8* ptr = context.readExtraData(size); + patchupPointers(mWheelsSimData.mNbActiveWheels, this, ptr); +} + +void PxVehicleWheels::getBinaryMetaData(PxOutputStream& stream) +{ + PxVehicleWheelsSimData::getBinaryMetaData(stream); + PxVehicleWheelsDynData::getBinaryMetaData(stream); + + //PxVehicleWheels + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleWheels) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleWheels, PxBase) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxVehicleWheelsSimData, mWheelsSimData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxVehicleWheelsDynData, mWheelsDynData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxRigidDynamic, mActor, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxU32, mNbNonDrivenWheels, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxU8, mOnConstraintReleaseCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels, PxU8, mType, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels, PxU8, mPad0, PxMetaDataFlag::ePADDING) +} + +void PxVehicleConstraintShader::getBinaryMetaData(PxOutputStream& stream) +{ + //SuspLimitConstraintData + PX_DEF_BIN_METADATA_CLASS(stream, SuspLimitConstraintData) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, SuspLimitConstraintData, PxVec3, mCMOffsets, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, SuspLimitConstraintData, PxVec3, mDirs, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, SuspLimitConstraintData, PxReal, mErrors, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, SuspLimitConstraintData, bool, mActiveFlags, 0) + + //StickyTireConstraintData + PX_DEF_BIN_METADATA_CLASS(stream, StickyTireConstraintData) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, StickyTireConstraintData, PxVec3, mCMOffsets, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, StickyTireConstraintData, PxVec3, mDirs, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, StickyTireConstraintData, PxReal, mTargetSpeeds, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, StickyTireConstraintData, bool, mActiveFlags, 0) + + //VehicleConstraintData + PX_DEF_BIN_METADATA_CLASS(stream, VehicleConstraintData) + PX_DEF_BIN_METADATA_ITEM(stream, VehicleConstraintData, SuspLimitConstraintData, mSuspLimitData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, VehicleConstraintData, StickyTireConstraintData, mStickyTireForwardData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, VehicleConstraintData, StickyTireConstraintData, mStickyTireSideData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, VehicleConstraintData, PxQuat, mCMassRotation, 0) + + //PxVehicleConstraintShader + PX_DEF_BIN_METADATA_VCLASS(stream, PxVehicleConstraintShader) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxVehicleConstraintShader, PxConstraintConnector) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleConstraintShader, VehicleConstraintData, mData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleConstraintShader, PxConstraint, mConstraint, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleConstraintShader, PxVehicleWheels, mVehicle, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleConstraintShader, PxU32, mPad, PxMetaDataFlag::ePADDING) +} + +void PxVehicleWheels4SimData::getBinaryMetaData(PxOutputStream& stream) +{ + //PxVehicleSuspensionData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleSuspensionData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mSpringStrength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mSpringDamperRate, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mMaxCompression, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mMaxDroop, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mSprungMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mCamberAtRest, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mCamberAtMaxCompression, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mCamberAtMaxDroop, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mRecipMaxCompression, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleSuspensionData, PxReal, mRecipMaxDroop, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleSuspensionData, PxU32, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleWheelData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleWheelData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mRadius, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mWidth, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mMOI, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mDampingRate, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mMaxBrakeTorque, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mMaxHandBrakeTorque, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mMaxSteer, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mToeAngle, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mRecipRadius, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheelData, PxReal, mRecipMOI, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheelData, PxReal, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleTireData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleTireData) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mLatStiffX, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mLatStiffY, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mLongitudinalStiffnessPerUnitGravity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mCamberStiffnessPerUnitGravity, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleTireData, PxReal, mFrictionVsSlipGraph, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxU32, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mRecipLongitudinalStiffnessPerUnitGravity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mFrictionVsSlipGraphRecipx1Minusx0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleTireData, PxReal, mFrictionVsSlipGraphRecipx2Minusx1, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleTireData, PxReal, mPad, PxMetaDataFlag::ePADDING) + + //PxVehicleWheels4SimData + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleWheels4SimData) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVehicleSuspensionData, mSuspensions, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVehicleWheelData, mWheels, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVehicleTireData, mTires, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVec3, mSuspDownwardTravelDirections, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVec3, mSuspForceAppPointOffsets, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVec3, mTireForceAppPointOffsets, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxVec3, mWheelCentreOffsets, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxReal, mTireRestLoads, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxReal, mRecipTireRestLoads, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxFilterData, mSqFilterData, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxU8, mWheelShapeMap, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4SimData, PxU32, mPad, PxMetaDataFlag::ePADDING) +} + +/* +void PxVehicleAntiRollBar::getBinaryMetaData(PxOutputStream& stream) +{ +} +*/ + +void PxVehicleWheels4DynData::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxVehicleWheels4DynData) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mWheelSpeeds, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mCorrectedWheelSpeeds, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mWheelRotationAngles, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mTireLowForwardSpeedTimers, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mTireLowSideSpeedTimers, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxU8, mQueryOrCachedHitResults, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mJounces, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxReal, mSteerAngles, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels4DynData, PxVehicleConstraintShader, mVehicleConstraints, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels4DynData, PxRaycastQueryResult, mRaycastResults, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels4DynData, PxSweepQueryResult, mSweepResults, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, PxVehicleWheels4DynData, bool, mHasCachedRaycastHitPlane, 0) +#if PX_P64_FAMILY + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, PxVehicleWheels4DynData, PxU32, mPad, PxMetaDataFlag::ePADDING) +#endif +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp new file mode 100644 index 0000000..a1a6219 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleNoDrive.cpp @@ -0,0 +1,153 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleWheels.h" +#include "PxRigidDynamic.h" +#include "CmUtils.h" + +namespace physx +{ + +extern PxF32 gToleranceScaleLength; + +bool PxVehicleNoDrive::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(PxVehicleWheels::isValid(), "invalid PxVehicleDrive", false); + return true; +} + +PxVehicleNoDrive* PxVehicleNoDrive::allocate(const PxU32 numWheels) +{ + PX_CHECK_AND_RETURN_NULL(numWheels>0, "Cars with zero wheels are illegal"); + PX_CHECK_AND_RETURN_NULL(gToleranceScaleLength > 0, "PxVehicleNoDrive::allocate - need to call PxInitVehicleSDK"); + + //Compute the bytes needed. + const PxU32 numWheels4 = (((numWheels + 3) & ~3) >> 2); + const PxU32 inputByteSize16 = sizeof(PxReal)*numWheels4*4; + const PxU32 byteSize = sizeof(PxVehicleNoDrive) + 3*inputByteSize16 + PxVehicleWheels::computeByteSize(numWheels); + + //Allocate the memory. + PxVehicleNoDrive* veh = static_cast(PX_ALLOC(byteSize, "PxVehicleNoDrive")); + PxMarkSerializedMemory(veh, byteSize); + PX_PLACEMENT_NEW(veh, PxVehicleNoDrive()); + + //Patch up the pointers. + PxU8* ptr = reinterpret_cast(veh) + sizeof(PxVehicleNoDrive); + veh->mSteerAngles = reinterpret_cast(ptr); + ptr += inputByteSize16; + veh->mDriveTorques = reinterpret_cast(ptr); + ptr += inputByteSize16; + veh->mBrakeTorques = reinterpret_cast(ptr); + ptr += inputByteSize16; + ptr = PxVehicleWheels::patchupPointers(numWheels, veh, ptr); + + //Initialise. + PxMemZero(veh->mSteerAngles, inputByteSize16); + PxMemZero(veh->mDriveTorques, inputByteSize16); + PxMemZero(veh->mBrakeTorques, inputByteSize16); + veh->init(numWheels); + + //Set the vehicle type. + veh->mType = PxVehicleTypes::eNODRIVE; + + return veh; +} + +void PxVehicleNoDrive::free() +{ + PxVehicleWheels::free(); +} + +void PxVehicleNoDrive::setup +(PxPhysics* physics, PxRigidDynamic* vehActor, const PxVehicleWheelsSimData& wheelsData) +{ + //Set up the wheels. + PxVehicleWheels::setup(physics,vehActor,wheelsData,0,wheelsData.getNbWheels()); +} + +PxVehicleNoDrive* PxVehicleNoDrive::create +(PxPhysics* physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData) +{ + PxVehicleNoDrive* veh=PxVehicleNoDrive::allocate(wheelsData.getNbWheels()); + veh->setup(physics,vehActor,wheelsData); + return veh; +} + +void PxVehicleNoDrive::setToRestState() +{ + const PxU32 numWheels4 = (((mWheelsSimData.getNbWheels() + 3) & ~3) >> 2); + const PxU32 inputByteSize = sizeof(PxReal)*numWheels4*4; + const PxU32 inputByteSize16 = (inputByteSize + 15) & ~15; + PxMemZero(mSteerAngles, 3*inputByteSize16); + + //Set core to rest state. + PxVehicleWheels::setToRestState(); +} + +void PxVehicleNoDrive::setBrakeTorque(const PxU32 id, const PxReal brakeTorque) +{ + PX_CHECK_AND_RETURN(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::setBrakeTorque - Illegal wheel"); + PX_CHECK_AND_RETURN(brakeTorque>=0, "PxVehicleNoDrive::setBrakeTorque - negative brake torques are illegal"); + mBrakeTorques[id] = brakeTorque; +} + +void PxVehicleNoDrive::setDriveTorque(const PxU32 id, const PxReal driveTorque) +{ + PX_CHECK_AND_RETURN(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::setDriveTorque - Illegal wheel"); + mDriveTorques[id] = driveTorque; +} + +void PxVehicleNoDrive::setSteerAngle(const PxU32 id, const PxReal steerAngle) +{ + PX_CHECK_AND_RETURN(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::setSteerAngle - Illegal wheel"); + mSteerAngles[id] = steerAngle; +} + +PxReal PxVehicleNoDrive::getBrakeTorque(const PxU32 id) const +{ + PX_CHECK_AND_RETURN_VAL(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::getBrakeTorque - Illegal wheel", 0); + return mBrakeTorques[id]; +} + +PxReal PxVehicleNoDrive::getDriveTorque(const PxU32 id) const +{ + PX_CHECK_AND_RETURN_VAL(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::getDriveTorque - Illegal wheel",0); + return mDriveTorques[id]; +} + +PxReal PxVehicleNoDrive::getSteerAngle(const PxU32 id) const +{ + PX_CHECK_AND_RETURN_VAL(id < mWheelsSimData.getNbWheels(), "PxVehicleNoDrive::getSteerAngle - Illegal wheel",0); + return mSteerAngles[id]; +} + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp new file mode 100644 index 0000000..f74afc4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSDK.cpp @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxTolerancesScale.h" +#include "common/PxSerializer.h" +#include "vehicle/PxVehicleSDK.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveTank.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleDriveNW.h" +#include "PxPhysics.h" + +#include "foundation/PxUtilities.h" +#include "PxVehicleMetaDataObjects.h" +#include "PxVehicleSerialization.h" +#include "SnRepXSerializerImpl.h" + +namespace physx +{ + +void setVehicleToleranceScale(const PxTolerancesScale& ts); +void resetVehicleToleranceScale(); +void setSerializationRegistryPtr(const PxSerializationRegistry* sr); +const PxSerializationRegistry* resetSerializationRegistryPtr(); +void setVehicleDefaults(); + +bool PxInitVehicleSDK(PxPhysics& physics, PxSerializationRegistry* sr) +{ + PX_ASSERT(&physics.getFoundation() == &PxGetFoundation()); + PxIncFoundationRefCount(); + setVehicleToleranceScale(physics.getTolerancesScale()); + + setVehicleDefaults(); + + setSerializationRegistryPtr(sr); + if(sr) + { + sr->registerRepXSerializer(PxVehicleConcreteType::eVehicleDrive4W, PX_NEW_REPX_SERIALIZER(PxVehicleRepXSerializer)); + sr->registerRepXSerializer(PxVehicleConcreteType::eVehicleDriveTank, PX_NEW_REPX_SERIALIZER(PxVehicleRepXSerializer)); + sr->registerRepXSerializer(PxVehicleConcreteType::eVehicleDriveNW, PX_NEW_REPX_SERIALIZER(PxVehicleRepXSerializer)); + sr->registerRepXSerializer(PxVehicleConcreteType::eVehicleNoDrive, PX_NEW_REPX_SERIALIZER(PxVehicleRepXSerializer)); + + sr->registerSerializer(PxVehicleConcreteType::eVehicleDrive4W, PX_NEW_SERIALIZER_ADAPTER(PxVehicleDrive4W)); + sr->registerSerializer(PxVehicleConcreteType::eVehicleDriveTank, PX_NEW_SERIALIZER_ADAPTER(PxVehicleDriveTank)); + sr->registerSerializer(PxVehicleConcreteType::eVehicleNoDrive, PX_NEW_SERIALIZER_ADAPTER(PxVehicleNoDrive)); + sr->registerSerializer(PxVehicleConcreteType::eVehicleDriveNW, PX_NEW_SERIALIZER_ADAPTER(PxVehicleDriveNW)); + + sr->registerBinaryMetaDataCallback(PxVehicleDrive4W::getBinaryMetaData); + sr->registerBinaryMetaDataCallback(PxVehicleDriveTank::getBinaryMetaData); + sr->registerBinaryMetaDataCallback(PxVehicleNoDrive::getBinaryMetaData); + sr->registerBinaryMetaDataCallback(PxVehicleDriveNW::getBinaryMetaData); + } + return true; +} + +void PxCloseVehicleSDK(PxSerializationRegistry* sr) +{ + PxDecFoundationRefCount(); + resetVehicleToleranceScale(); + + setVehicleDefaults(); + + if (sr != resetSerializationRegistryPtr()) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxCloseVehicleSDK called with different PxSerializationRegistry instance than PxInitVehicleSDK."); + return; + } + + if(sr) + { + PX_DELETE_SERIALIZER_ADAPTER(sr->unregisterSerializer(PxVehicleConcreteType::eVehicleDrive4W)); + PX_DELETE_SERIALIZER_ADAPTER(sr->unregisterSerializer(PxVehicleConcreteType::eVehicleDriveTank)); + PX_DELETE_SERIALIZER_ADAPTER(sr->unregisterSerializer(PxVehicleConcreteType::eVehicleNoDrive)); + PX_DELETE_SERIALIZER_ADAPTER(sr->unregisterSerializer(PxVehicleConcreteType::eVehicleDriveNW)); + + PX_DELETE_REPX_SERIALIZER(sr->unregisterRepXSerializer(PxVehicleConcreteType::eVehicleDrive4W)); + PX_DELETE_REPX_SERIALIZER(sr->unregisterRepXSerializer(PxVehicleConcreteType::eVehicleDriveTank)); + PX_DELETE_REPX_SERIALIZER(sr->unregisterRepXSerializer(PxVehicleConcreteType::eVehicleNoDrive)); + PX_DELETE_REPX_SERIALIZER(sr->unregisterRepXSerializer(PxVehicleConcreteType::eVehicleDriveNW)); + } +} +///////////////////////// + + + + +}//physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp new file mode 100644 index 0000000..7abbd4f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.cpp @@ -0,0 +1,203 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxBase.h" +#include "common/PxCollection.h" +#include "extensions/PxRepXSimpleType.h" + +#include "PxVehicleMetaDataObjects.h" +#include "PxVehicleSerialization.h" +#include "PxVehicleSuspWheelTire4.h" +#include "PxVehicleSuspLimitConstraintShader.h" +#include "SnRepXSerializerImpl.h" +#include "foundation/PxFPU.h" + + +namespace physx +{ + using namespace Sn; + + template + inline void* createVehicle( PxPhysics& physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, const PxVehicleDriveSimDataNW& driveDataNW, + const PxU32 numWheels, const PxU32 numNonDrivenWheels) + { + PX_UNUSED(physics); + PX_UNUSED(vehActor); + PX_UNUSED(wheelsData); + PX_UNUSED(driveData); + PX_UNUSED(driveDataNW); + PX_UNUSED(numWheels); + PX_UNUSED(numNonDrivenWheels); + return NULL; + } + + template<> + inline void* createVehicle(PxPhysics& physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, const PxVehicleDriveSimDataNW& /*driveDataNW*/, + const PxU32 numWheels, const PxU32 numNonDrivenWheels) + { + PxVehicleDrive4W* vehDrive4W = PxVehicleDrive4W::allocate(numWheels); + vehDrive4W->setup(&physics, vehActor->is(), wheelsData, driveData, numNonDrivenWheels); + return vehDrive4W; + } + + template<> + inline void* createVehicle(PxPhysics& physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData, const PxVehicleDriveSimDataNW& /*driveDataNW*/, + const PxU32 numWheels, const PxU32 numNonDrivenWheels) + { + PxVehicleDriveTank* tank = PxVehicleDriveTank::allocate(numWheels); + tank->setup(&physics, vehActor->is(), wheelsData, driveData, numWheels - numNonDrivenWheels); + return tank; + } + + template<> + inline void* createVehicle(PxPhysics& physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& /*driveData*/, const PxVehicleDriveSimDataNW& driveDataNW, + const PxU32 numWheels, const PxU32 numNonDrivenWheels) + { + PxVehicleDriveNW* vehDriveNW = PxVehicleDriveNW::allocate(numWheels); + vehDriveNW->setup(&physics, vehActor->is(), wheelsData, driveDataNW, numWheels - numNonDrivenWheels); + return vehDriveNW; + } + + template<> + inline void* createVehicle(PxPhysics& physics, PxRigidDynamic* vehActor, + const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& /*driveData*/, const PxVehicleDriveSimDataNW& /*driveDataNW*/, + const PxU32 numWheels, const PxU32 /*numNonDrivenWheels*/) + { + PxVehicleNoDrive* vehNoDrive = PxVehicleNoDrive::allocate(numWheels); + vehNoDrive->setup(&physics, vehActor->is(), wheelsData); + return vehNoDrive; + } + + template + PxRepXObject PxVehicleRepXSerializer::fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ) + { + PxRigidActor* vehActor = NULL; + readReference( inReader, *inCollection, "PxRigidDynamicRef", vehActor ); + if ( vehActor == NULL ) + return PxRepXObject(); + + PxU32 numWheels = 0; + readProperty( inReader, "NumWheels", numWheels ); + if( numWheels == 0) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, + "PxSerialization::createCollectionFromXml: PxVehicleRepXSerializer: Xml field NumWheels is zero!"); + return PxRepXObject(); + } + + PxU32 numNonDrivenWheels = 0; + readProperty( inReader, "NumNonDrivenWheels", numNonDrivenWheels ); + + //change to numwheel + PxVehicleWheelsSimData* wheelsSimData=PxVehicleWheelsSimData::allocate(numWheels); + { + inReader.pushCurrentContext(); + if ( inReader.gotoChild( "MWheelsSimData" ) ) + { + readAllProperties( inArgs, inReader, wheelsSimData, inAllocator, *inCollection ); + } + + inReader.popCurrentContext(); + } + + PxVehicleDriveSimData4W driveSimData; + { + inReader.pushCurrentContext(); + if ( inReader.gotoChild( "MDriveSimData" ) ) + { + readAllProperties( inArgs, inReader, &driveSimData, inAllocator, *inCollection ); + } + + inReader.popCurrentContext(); + } + + PxVehicleDriveSimDataNW nmSimData; + { + inReader.pushCurrentContext(); + if ( inReader.gotoChild( "MDriveSimDataNW" ) ) + { + readAllProperties( inArgs, inReader, &driveSimData, inAllocator, *inCollection ); + } + inReader.popCurrentContext(); + } + TVehicleType* drive = static_cast(createVehicle(inArgs.physics, vehActor->is(), *wheelsSimData, driveSimData, nmSimData, numWheels, numNonDrivenWheels)); + readAllProperties( inArgs, inReader, drive, inAllocator, *inCollection ); + + PxVehicleWheels4DynData* wheel4DynData = drive->mWheelsDynData.getWheel4DynData(); + PX_ASSERT( wheel4DynData ); + for(PxU32 i=0;igetNbWheels4();i++) + { + PxConstraint* constraint = wheel4DynData[i].getVehicletConstraintShader().getPxConstraint(); + if( constraint ) + inCollection->add(*constraint); + } + + if( wheelsSimData ) + wheelsSimData->free(); + + return PxCreateRepXObject(drive); + } + + template + void PxVehicleRepXSerializer::objectToFileImpl( const TVehicleType* drive, PxCollection* inCollection, XmlWriter& inWriter, MemoryBuffer& inTempBuffer, PxRepXInstantiationArgs& /*inArgs*/ ) + { + PX_SIMD_GUARD; // denorm exception triggered in PxVehicleGearsDataGeneratedInfo::visitInstanceProperties on osx + writeReference( inWriter, *inCollection, "PxRigidDynamicRef", drive->getRigidDynamicActor() ); + writeProperty( inWriter, *inCollection, inTempBuffer, "NumWheels", drive->mWheelsSimData.getNbWheels() ); + writeProperty( inWriter, *inCollection, inTempBuffer, "NumNonDrivenWheels", drive->getNbNonDrivenWheels()); + writeAllProperties( drive, inWriter, inTempBuffer, *inCollection ); + } + + PxVehicleNoDrive::PxVehicleNoDrive() + : PxVehicleWheels(PxVehicleConcreteType::eVehicleNoDrive, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + {} + + PxVehicleDrive4W::PxVehicleDrive4W() + : PxVehicleDrive(PxVehicleConcreteType::eVehicleDrive4W, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + {} + + PxVehicleDriveNW::PxVehicleDriveNW() + : PxVehicleDrive(PxVehicleConcreteType::eVehicleDriveNW, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + {} + + PxVehicleDriveTank::PxVehicleDriveTank() + : PxVehicleDrive(PxVehicleConcreteType::eVehicleDriveTank, PxBaseFlag::eOWNS_MEMORY | PxBaseFlag::eIS_RELEASABLE) + , mDriveModel(PxVehicleDriveTankControlModel::eSTANDARD) + {} + + // explicit template instantiations + template struct PxVehicleRepXSerializer; + template struct PxVehicleRepXSerializer; + template struct PxVehicleRepXSerializer; + template struct PxVehicleRepXSerializer; + +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.h new file mode 100644 index 0000000..046045e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSerialization.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_SERIALIZATION_H +#define PX_VEHICLE_SERIALIZATION_H + +#include "extensions/PxRepXSimpleType.h" +#include "SnRepXSerializerImpl.h" + +namespace physx +{ + class PxRepXSerializer; + class PxSerializationRegistry; + class XmlReader; + class XmlMemoryAllocator; + class XmlWriter; + class MemoryBuffer; + + PX_DEFINE_TYPEINFO(PxVehicleNoDrive, PxVehicleConcreteType::eVehicleNoDrive) + PX_DEFINE_TYPEINFO(PxVehicleDrive4W, PxVehicleConcreteType::eVehicleDrive4W) + PX_DEFINE_TYPEINFO(PxVehicleDriveNW, PxVehicleConcreteType::eVehicleDriveNW) + PX_DEFINE_TYPEINFO(PxVehicleDriveTank, PxVehicleConcreteType::eVehicleDriveTank) + + template + struct PxVehicleRepXSerializer : public RepXSerializerImpl + { + PxVehicleRepXSerializer( PxAllocatorCallback& inCallback ) : RepXSerializerImpl( inCallback ) {} + virtual PxRepXObject fileToObject( XmlReader& inReader, XmlMemoryAllocator& inAllocator, PxRepXInstantiationArgs& inArgs, PxCollection* inCollection ); + virtual void objectToFileImpl( const TVehicleType* , PxCollection* , XmlWriter& , MemoryBuffer& , PxRepXInstantiationArgs& ); + virtual TVehicleType* allocateObject( PxRepXInstantiationArgs& ) { return NULL; } + }; + +#if PX_SUPPORT_EXTERN_TEMPLATE + // explicit template instantiation declarations + extern template struct PxVehicleRepXSerializer; + extern template struct PxVehicleRepXSerializer; + extern template struct PxVehicleRepXSerializer; + extern template struct PxVehicleRepXSerializer; +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspLimitConstraintShader.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspLimitConstraintShader.h new file mode 100644 index 0000000..761be68 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspLimitConstraintShader.h @@ -0,0 +1,314 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_SUSP_LIMIT_CONSTRAINT_SHADER_H +#define PX_VEHICLE_SUSP_LIMIT_CONSTRAINT_SHADER_H +/** \addtogroup vehicle + @{ +*/ + +#include "foundation/PxTransform.h" +#include "extensions/PxConstraintExt.h" +#include "PxConstraintDesc.h" +#include "PxConstraint.h" +#include "vehicle/PxVehicleWheels.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxVehicleConstraintShader : public PxConstraintConnector +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleWheels; + + PxVehicleConstraintShader(PxVehicleWheels* vehicle, PxConstraint* constraint = NULL) + : mConstraint(constraint), + mVehicle(vehicle) + { + } + PxVehicleConstraintShader(){} + ~PxVehicleConstraintShader() + { + } + + static void getBinaryMetaData(PxOutputStream& stream); + + void release() + { + if(mConstraint) + { + mConstraint->release(); + } + } + + virtual void onComShift(PxU32 actor) { PX_UNUSED(actor); } + + virtual void onOriginShift(const PxVec3& shift) { PX_UNUSED(shift); } + + virtual void* prepareData() + { + return &mData; + } + + virtual bool updatePvdProperties(pvdsdk::PvdDataStream& pvdConnection, + const PxConstraint* c, + PxPvdUpdateType::Enum updateType) const { PX_UNUSED(c); PX_UNUSED(updateType); PX_UNUSED(&pvdConnection); return true;} + + virtual void updateOmniPvdProperties() const { } + + virtual void onConstraintRelease() + { + mVehicle->onConstraintRelease(); + } + + virtual void* getExternalReference(PxU32& typeID) { typeID = PxConstraintExtIDs::eVEHICLE_SUSP_LIMIT_DEPRECATED; return this; } + virtual PxBase* getSerializable() { return NULL; } + + //TAG:solverprepshader + static PxU32 vehicleSuspLimitConstraintSolverPrep( + Px1DConstraint* constraints, + PxVec3p& body0WorldOffset, + PxU32 maxConstraints, + PxConstraintInvMassScale&, + const void* constantBlock, + const PxTransform& bodyAToWorld, + const PxTransform& bodyBToWorld, + bool, + PxVec3p& cA2w, PxVec3p& cB2w + ) + { + PX_UNUSED(maxConstraints); + PX_UNUSED(body0WorldOffset); + PX_UNUSED(bodyBToWorld); + PX_ASSERT(bodyAToWorld.isValid()); PX_ASSERT(bodyBToWorld.isValid()); + + const VehicleConstraintData* data = static_cast(constantBlock); + PxU32 numActive=0; + const PxQuat bodyRotation = bodyAToWorld.q * data->mCMassRotation.getConjugate(); + + //KS - the TGS solver will use raXn to try to add to the angular part of the linear constraints. + //We overcome this by setting the ra and rb offsets to be 0. + cA2w = bodyAToWorld.p; + cB2w = bodyBToWorld.p; + + //Susp limit constraints. + for(PxU32 i=0;i<4;i++) + { + if(data->mSuspLimitData.mActiveFlags[i]) + { + Px1DConstraint& p=constraints[numActive]; + p.linear0 = bodyRotation.rotate(data->mSuspLimitData.mDirs[i]); + p.angular0 = bodyRotation.rotate(data->mSuspLimitData.mCMOffsets[i].cross(data->mSuspLimitData.mDirs[i])); + p.geometricError=data->mSuspLimitData.mErrors[i]; + p.linear1=PxVec3(0); + p.angular1=PxVec3(0); + p.minImpulse=-FLT_MAX; + p.maxImpulse=0; + p.velocityTarget=0; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + numActive++; + } + } + + //Sticky tire friction constraints. + for(PxU32 i=0;i<4;i++) + { + if(data->mStickyTireForwardData.mActiveFlags[i]) + { + Px1DConstraint& p=constraints[numActive]; + p.linear0=data->mStickyTireForwardData.mDirs[i]; + p.angular0=data->mStickyTireForwardData.mCMOffsets[i].cross(data->mStickyTireForwardData.mDirs[i]); + p.geometricError=0.0f; + p.linear1=PxVec3(0); + p.angular1=PxVec3(0); + p.minImpulse=-FLT_MAX; + p.maxImpulse=FLT_MAX; + p.velocityTarget=data->mStickyTireForwardData.mTargetSpeeds[i]; + p.mods.spring.damping = 1000.0f; + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + numActive++; + } + } + + //Sticky tire friction constraints. + for(PxU32 i=0;i<4;i++) + { + if(data->mStickyTireSideData.mActiveFlags[i]) + { + Px1DConstraint& p=constraints[numActive]; + p.linear0=data->mStickyTireSideData.mDirs[i]; + p.angular0=data->mStickyTireSideData.mCMOffsets[i].cross(data->mStickyTireSideData.mDirs[i]); + p.geometricError=0.0f; + p.linear1=PxVec3(0); + p.angular1=PxVec3(0); + p.minImpulse=-FLT_MAX; + p.maxImpulse=FLT_MAX; + p.velocityTarget=data->mStickyTireSideData.mTargetSpeeds[i]; + p.mods.spring.damping = 1000.0f; + p.flags = Px1DConstraintFlag::eSPRING | Px1DConstraintFlag::eACCELERATION_SPRING; + p.flags |= Px1DConstraintFlag::eANGULAR_CONSTRAINT; + numActive++; + } + } + + + return numActive; + } + + static void visualiseConstraint(PxConstraintVisualizer &viz, + const void* constantBlock, + const PxTransform& body0Transform, + const PxTransform& body1Transform, + PxU32 flags){ PX_UNUSED(&viz); PX_UNUSED(constantBlock); PX_UNUSED(body0Transform); + PX_UNUSED(body1Transform); PX_UNUSED(flags); + PX_ASSERT(body0Transform.isValid()); PX_ASSERT(body1Transform.isValid()); } + +public: + + struct SuspLimitConstraintData + { + PxVec3 mCMOffsets[4]; + PxVec3 mDirs[4]; + PxReal mErrors[4]; + bool mActiveFlags[4]; + }; + struct StickyTireConstraintData + { + PxVec3 mCMOffsets[4]; + PxVec3 mDirs[4]; + PxReal mTargetSpeeds[4]; + bool mActiveFlags[4]; + }; + + struct VehicleConstraintData + { + SuspLimitConstraintData mSuspLimitData; + StickyTireConstraintData mStickyTireForwardData; + StickyTireConstraintData mStickyTireSideData; + PxQuat mCMassRotation; + }; + VehicleConstraintData mData; + + PxConstraint* mConstraint; + + PX_INLINE void setPxConstraint(PxConstraint* pxConstraint) + { + mConstraint = pxConstraint; + } + + PX_INLINE PxConstraint* getPxConstraint() + { + return mConstraint; + } + + PxConstraintConnector* getConnector() + { + return this; + } + + virtual PxConstraintSolverPrep getPrep() const { return vehicleSuspLimitConstraintSolverPrep; } + virtual const void* getConstantBlock() const { return &mData; } + +private: + + PxVehicleWheels* mVehicle; + +#if !PX_P64_FAMILY + PxU32 mPad[2]; +#else + PxU32 mPad[1]; +#endif +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleConstraintShader)& 0x0f)); + + +/** +\brief Default implementation of PxVehicleComputeTireForce +@see PxVehicleComputeTireForce, PxVehicleTireForceCalculator +*/ +void PxVehicleComputeTireForceDefault + (const void* shaderData, + const PxF32 tireFriction, + const PxF32 longSlip, const PxF32 latSlip, const PxF32 camber, + const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, + const PxF32 restTireLoad, const PxF32 normalisedTireLoad, const PxF32 tireLoad, + const PxF32 gravity, const PxF32 recipGravity, + PxF32& wheelTorque, PxF32& tireLongForceMag, PxF32& tireLatForceMag, PxF32& tireAlignMoment); + + +/** +\brief Structure containing shader data for each tire of a vehicle and a shader function that computes individual tire forces +*/ +class PxVehicleTireForceCalculator +{ +public: + + PxVehicleTireForceCalculator() + : mShader(PxVehicleComputeTireForceDefault) + { + } + + /** + \brief Array of shader data - one data entry per tire. + Default values are pointers to PxVehicleTireData (stored in PxVehicleWheelsSimData) and are set in PxVehicleDriveTank::setup or PxVehicleDrive4W::setup + @see PxVehicleComputeTireForce, PxVehicleComputeTireForceDefault, PxVehicleWheelsSimData, PxVehicleDriveTank::setup, PxVehicleDrive4W::setup + */ + const void** mShaderData; + + /** + \brief Shader function. + Default value is PxVehicleComputeTireForceDefault and is set in PxVehicleDriveTank::setup or PxVehicleDrive4W::setup + @see PxVehicleComputeTireForce, PxVehicleComputeTireForceDefault, PxVehicleWheelsSimData, PxVehicleDriveTank::setup, PxVehicleDrive4W::setup + */ + PxVehicleComputeTireForce mShader; + +#if !PX_P64_FAMILY + PxU32 mPad[2]; +#endif +}; + +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTireForceCalculator) & 15)); + + +#if !PX_DOXYGEN +} // namespace physx +#endif + + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp new file mode 100644 index 0000000..af1e441 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.cpp @@ -0,0 +1,189 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxVehicleSuspWheelTire4.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxErrors.h" + +namespace physx +{ + +PxVehicleWheels4SimData::PxVehicleWheels4SimData() +{ + for(PxU32 i=0;i<4;i++) + { + mSuspDownwardTravelDirections[i]=PxVec3(0,0,0); //Must be filled out + mSuspForceAppPointOffsets[i]=PxVec3(0,0,0); //Must be filled out + mTireForceAppPointOffsets[i]=PxVec3(0,0,0); //Must be filled out + mWheelCentreOffsets[i]=PxVec3(0,0,0); //Must be filled out + + mTireRestLoads[i]=20.0f + 1500.0f; + mRecipTireRestLoads[i]=1.0f/mTireRestLoads[i]; + } +} + +bool PxVehicleWheels4SimData::isValid(const PxU32 id) const +{ + PX_ASSERT(id<4); + PX_CHECK_AND_RETURN_VAL(mSuspensions[id].isValid(), "Invalid PxVehicleSuspWheelTire4SimulationData.mSuspensions", false); + PX_CHECK_AND_RETURN_VAL(mWheels[id].isValid(), "Invalid PxVehicleSuspWheelTire4SimulationData.mWheels", false); + PX_CHECK_AND_RETURN_VAL(mTires[id].isValid(), "Invalid PxVehicleSuspWheelTire4SimulationData.mTires", false); + PX_CHECK_AND_RETURN_VAL(mSuspDownwardTravelDirections[id].magnitude()>=0.999f && mSuspDownwardTravelDirections[id].magnitude()<=1.001f, "Invalid PxVehicleSuspWheelTire4SimulationData.mSuspDownwardTravelDirections", false); + PX_CHECK_AND_RETURN_VAL(mSuspForceAppPointOffsets[id].magnitude()!=0.0f, "Invalid PxVehicleSuspWheelTire4SimulationData.mSuspForceAppPointOffsets.mSuspForceAppPointOffsets", false); + PX_CHECK_AND_RETURN_VAL(mTireForceAppPointOffsets[id].magnitude()!=0.0f, "Invalid PxVehicleSuspWheelTire4SimulationData.mTireForceAppPointOffsets.mTireForceAppPointOffsets", false); + PX_CHECK_AND_RETURN_VAL(mWheelCentreOffsets[id].magnitude()!=0.0f, "Invalid PxVehicleSuspWheelTire4SimulationData.mWheelCentreOffsets.mWheelCentreOffsets", false); + PX_CHECK_AND_RETURN_VAL(mTireRestLoads[id]>0.0f, "Invalid PxVehicleSuspWheelTire4SimulationData.mTireRestLoads", false); + PX_CHECK_AND_RETURN_VAL(PxAbs((1.0f/mTireRestLoads[id]) - mRecipTireRestLoads[id]) <= 0.001f, "Invalid PxVehicleSuspWheelTire4SimulationData.mRecipTireRestLoads", false); + PX_UNUSED(id); + return true; +} + +void PxVehicleWheels4SimData::setSuspensionData(const PxU32 id, const PxVehicleSuspensionData& susp) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal suspension id"); + PX_CHECK_AND_RETURN(susp.mSpringStrength>0, "Susp spring strength must be greater than zero"); + PX_CHECK_AND_RETURN(susp.mSpringDamperRate>=0, "Susp spring damper rate must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(susp.mMaxCompression>=0, "Susp max compression must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(susp.mMaxDroop>=0, "Susp max droop must be greater than or equal to zero"); + PX_CHECK_AND_RETURN(susp.mMaxDroop>0 || susp.mMaxCompression>0, "Either one of max droop or max compression must be greater than zero"); + PX_CHECK_AND_RETURN(susp.mSprungMass>0, "Susp spring mass must be greater than zero"); + + mSuspensions[id]=susp; + mSuspensions[id].mRecipMaxCompression = 1.0f/((susp.mMaxCompression > 0.0f) ? susp.mMaxCompression : 1.0f); + mSuspensions[id].mRecipMaxDroop = 1.0f/((susp.mMaxDroop > 0.0f) ? susp.mMaxDroop : 1.0f); + + mTireRestLoads[id]=mWheels[id].mMass+mSuspensions[id].mSprungMass; + mRecipTireRestLoads[id]=1.0f/mTireRestLoads[id]; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setWheelData(const PxU32 id, const PxVehicleWheelData& wheel) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal wheel id"); + PX_CHECK_AND_RETURN(wheel.mRadius>0, "Wheel radius must be greater than zero"); + PX_CHECK_AND_RETURN(wheel.mMaxBrakeTorque>=0, "Wheel brake torque must be zero or be a positive value"); + PX_CHECK_AND_RETURN(wheel.mMaxHandBrakeTorque>=0, "Wheel handbrake torque must be zero or be a positive value"); + PX_CHECK_AND_RETURN(PxAbs(wheel.mMaxSteer)0, "Wheel mass must be greater than zero"); + PX_CHECK_AND_RETURN(wheel.mMOI>0, "Wheel moi must be greater than zero"); + PX_CHECK_AND_RETURN(wheel.mToeAngle>-PxHalfPi && wheel.mToeAngle0, "Wheel width must be greater than zero"); + PX_CHECK_AND_RETURN(wheel.mDampingRate>=0, "Wheel damping rate must be greater than or equal to zero"); + + mWheels[id]=wheel; + mWheels[id].mRecipRadius=1.0f/mWheels[id].mRadius; + mWheels[id].mRecipMOI=1.0f/mWheels[id].mMOI; + + mTireRestLoads[id]=mWheels[id].mMass+mSuspensions[id].mSprungMass; + mRecipTireRestLoads[id]=1.0f/mTireRestLoads[id]; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setTireData(const PxU32 id, const PxVehicleTireData& tire) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal tire id"); + PX_CHECK_AND_RETURN(tire.mLatStiffX>0, "Tire mLatStiffX must greater than zero"); + PX_CHECK_AND_RETURN(tire.mLatStiffY>0, "Tire mLatStiffY must greater than zero"); + PX_CHECK_AND_RETURN(tire.mLongitudinalStiffnessPerUnitGravity>0, "Tire longitudinal stiffness must greater than zero"); + PX_CHECK_AND_RETURN(tire.mCamberStiffnessPerUnitGravity>=0, "Tire camber stiffness must greater than or equal to zero"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[0][0]==0, "mFrictionVsSlipGraph[0][0] must be zero"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[0][1]>0, "mFrictionVsSlipGraph[0][1] must be greater than zero"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[1][0]>0, "mFrictionVsSlipGraph[1][0] must be greater than zero"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[1][1]>=tire.mFrictionVsSlipGraph[0][1], "mFrictionVsSlipGraph[1][1] must be greater than mFrictionVsSlipGraph[0][1]"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[2][0]> tire.mFrictionVsSlipGraph[1][0], "mFrictionVsSlipGraph[2][0] must be greater than mFrictionVsSlipGraph[1][0]"); + PX_CHECK_AND_RETURN(tire.mFrictionVsSlipGraph[2][1]<=tire.mFrictionVsSlipGraph[1][1], "mFrictionVsSlipGraph[2][1] must be less than or equal to mFrictionVsSlipGraph[1][1]"); + + mTires[id]=tire; + mTires[id].mRecipLongitudinalStiffnessPerUnitGravity=1.0f/mTires[id].mLongitudinalStiffnessPerUnitGravity; + mTires[id].mFrictionVsSlipGraphRecipx1Minusx0=1.0f/(mTires[id].mFrictionVsSlipGraph[1][0]-mTires[id].mFrictionVsSlipGraph[0][0]); + mTires[id].mFrictionVsSlipGraphRecipx2Minusx1=1.0f/(mTires[id].mFrictionVsSlipGraph[2][0]-mTires[id].mFrictionVsSlipGraph[1][0]); +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setSuspTravelDirection(const PxU32 id, const PxVec3& dir) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal suspension id"); + PX_CHECK_AND_RETURN(dir.magnitude()>0.999f && dir.magnitude()<1.0001f, "Suspension travel dir must be unit vector"); + + mSuspDownwardTravelDirections[id]=dir; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setSuspForceAppPointOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal suspension id"); + PX_CHECK_AND_RETURN(offset.magnitude()>0, "Susp force app point must be offset from centre of mass"); + + mSuspForceAppPointOffsets[id]=offset; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setTireForceAppPointOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal tire id"); + PX_CHECK_AND_RETURN(offset.magnitude()>0, "Tire force app point must be offset from centre of mass"); + + mTireForceAppPointOffsets[id]=offset; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setWheelCentreOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal wheel id"); + PX_CHECK_AND_RETURN(offset.magnitude()>0, "Tire force app point must be offset from centre of mass"); + + mWheelCentreOffsets[id]=offset; +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setWheelShapeMapping(const PxU32 id, const PxI32 shapeId) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal wheel id"); + PX_CHECK_AND_RETURN((-1==shapeId) || (PxU32(shapeId) < PX_MAX_U8), "Illegal shapeId: must be -1 or less than PX_MAX_U8"); + mWheelShapeMap[id] = PxTo8(-1!=shapeId ? shapeId : PX_MAX_U8); +} + +///////////////////////////// + +void PxVehicleWheels4SimData::setSceneQueryFilterData(const PxU32 id, const PxFilterData& sqFilterData) +{ + PX_CHECK_AND_RETURN(id<4, "Illegal wheel id"); + mSqFilterData[id]=sqFilterData; +} + + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.h new file mode 100644 index 0000000..38d6a8f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleSuspWheelTire4.h @@ -0,0 +1,420 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_SUSP_WHEEL_TIRE4_H +#define PX_VEHICLE_SUSP_WHEEL_TIRE4_H +/** \addtogroup vehicle + @{ +*/ + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxVec3.h" +#include "foundation/PxVec4.h" +#include "foundation/PxTransform.h" +#include "foundation/PxIO.h" +#include "geometry/PxGeometryHelpers.h" +#include "vehicle/PxVehicleComponents.h" +#include "PxVehicleSuspLimitConstraintShader.h" +#include "extensions/PxSceneQueryExt.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxMaterial; +class PxShape; + +class PxVehicleWheels4SimData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + PxVehicleWheels4SimData(); + + bool isValid(const PxU32 id) const; + + static void getBinaryMetaData(PxOutputStream& stream); + +public: + + PX_FORCE_INLINE const PxVehicleSuspensionData& getSuspensionData(const PxU32 id) const {return mSuspensions[id];} + PX_FORCE_INLINE const PxVehicleWheelData& getWheelData(const PxU32 id) const {return mWheels[id];} + PX_FORCE_INLINE const PxVehicleTireData& getTireData(const PxU32 id) const {return mTires[id];} + PX_FORCE_INLINE const PxVec3& getSuspTravelDirection(const PxU32 id) const {return mSuspDownwardTravelDirections[id];} + PX_FORCE_INLINE const PxVec3& getSuspForceAppPointOffset(const PxU32 id) const {return mSuspForceAppPointOffsets[id];} + PX_FORCE_INLINE const PxVec3& getTireForceAppPointOffset(const PxU32 id) const {return mTireForceAppPointOffsets[id];} + PX_FORCE_INLINE const PxVec3& getWheelCentreOffset(const PxU32 id) const {return mWheelCentreOffsets[id];} + PX_FORCE_INLINE PxI32 getWheelShapeMapping(const PxU32 id) const {return (PX_MAX_U8 != mWheelShapeMap[id]) ? mWheelShapeMap[id] : -1;} + PX_FORCE_INLINE const PxFilterData& getSceneQueryFilterData(const PxU32 id) const {return mSqFilterData[id];} + PX_FORCE_INLINE const PxReal* getTireRestLoadsArray() const {return mTireRestLoads;} + PX_FORCE_INLINE const PxReal* getRecipTireRestLoadsArray() const {return mRecipTireRestLoads;} + + void setSuspensionData (const PxU32 id, const PxVehicleSuspensionData& susp); + void setWheelData (const PxU32 id, const PxVehicleWheelData& susp); + void setTireData (const PxU32 id, const PxVehicleTireData& tire); + void setSuspTravelDirection (const PxU32 id, const PxVec3& dir); + void setSuspForceAppPointOffset (const PxU32 id, const PxVec3& offset); + void setTireForceAppPointOffset (const PxU32 id, const PxVec3& offset); + void setWheelCentreOffset (const PxU32 id, const PxVec3& offset); + void setWheelShapeMapping (const PxU32 id, const PxI32 shapeId); + void setSceneQueryFilterData (const PxU32 id, const PxFilterData& sqFilterData); + +private: + + /** + \brief Suspension simulation data + @see setSuspensionData, getSuspensionData + */ + PxVehicleSuspensionData mSuspensions[4]; + + /** + \brief Wheel simulation data + @see setWheelData, getWheelData + */ + PxVehicleWheelData mWheels[4]; + + /** + \brief Tire simulation data + @see setTireData, getTireData + */ + PxVehicleTireData mTires[4]; + + /** + \brief Direction of suspension travel, pointing downwards. + */ + PxVec3 mSuspDownwardTravelDirections[4]; + + /** + \brief Application point of suspension force specified as an offset from the rigid body centre of mass. + */ + PxVec3 mSuspForceAppPointOffsets[4]; //Offset from cm + + /** + \brief Application point of tire forces specified as an offset from the rigid body centre of mass. + */ + PxVec3 mTireForceAppPointOffsets[4]; //Offset from cm + + /** + \brief Position of wheel center specified as an offset from the rigid body centre of mass. + */ + PxVec3 mWheelCentreOffsets[4]; //Offset from cm + + /** + \brief Normalized tire load on each tire (load/rest load) at zero suspension jounce under gravity. + */ + PxReal mTireRestLoads[4]; + + /** + \brief Reciprocal normalized tire load on each tire at zero suspension jounce under gravity. + */ + PxReal mRecipTireRestLoads[4]; + + /** + \brief Scene query filter data used by each suspension line. + Anything relating to the actor belongs in PxVehicleWheels. + */ + PxFilterData mSqFilterData[4]; + + /** + \brief Mapping between wheel id and shape id. + The PxShape that corresponds to the ith wheel can be found with + If mWheelShapeMap[i]<0 then the wheel has no corresponding shape. + Otherwise, the shape corresponds to: + PxShape* shapeBuffer[1]; + mActor->getShapes(shapeBuffer,1,mWheelShapeMap[i]); + Anything relating to the actor belongs in PxVehicleWheels. + */ + PxU8 mWheelShapeMap[4]; + + PxU32 mPad[3]; +}; +PX_COMPILE_TIME_ASSERT(0 == (sizeof(PxVehicleWheels4SimData) & 15)); + +class PxVehicleWheels4DynData +{ +//= ATTENTION! ===================================================================================== +// Changing the data layout of this class breaks the binary serialization format. See comments for +// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData +// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION +// accordingly. +//================================================================================================== +public: + + friend class PxVehicleUpdate; + + PxVehicleWheels4DynData() + : mRaycastResults(NULL), + mSweepResults(NULL) + { + setToRestState(); + } + ~PxVehicleWheels4DynData() + { + } + + bool isValid() const {return true;} + + static void getBinaryMetaData(PxOutputStream& stream); + + void setToRestState() + { + for(PxU32 i=0;i<4;i++) + { + mWheelSpeeds[i] = 0.0f; + mCorrectedWheelSpeeds[i] = 0.0f; + mWheelRotationAngles[i] = 0.0f; + mTireLowForwardSpeedTimers[i] = 0.0f; + mTireLowSideSpeedTimers[i] = 0.0f; + mJounces[i] = PX_MAX_F32; + mSteerAngles[i] = 0.0f; + mVehicleConstraints->mData.mStickyTireForwardData.mActiveFlags[i] = false; + mVehicleConstraints->mData.mStickyTireSideData.mActiveFlags[i] = false; + mVehicleConstraints->mData.mSuspLimitData.mActiveFlags[i] = false; + } + PxMemZero(mQueryOrCachedHitResults, sizeof(SuspLineSweep)); + + mRaycastResults = NULL; + mSweepResults = NULL; + mHasCachedRaycastHitPlane = false; + } + + void setInternalDynamicsToZero() + { + for(PxU32 i=0;i<4;i++) + { + mWheelSpeeds[i] = 0.0f; + mCorrectedWheelSpeeds[i] = 0.0f; + mJounces[i] = PX_MAX_F32; //Ensure that the jounce speed is zero when the car wakes up again. + mSteerAngles[i] = 0.0f; + } + } + + void setTireContacts(const PxU32* cachedHitCounts, const PxPlane* cachedHitPlanes, const PxF32* cachedFrictionMultipliers, const PxTireContactIntersectionMethod::Enum* cachedQueryTypes) + { + mHasCachedRaycastHitPlane = true; + mRaycastResults = NULL; + mSweepResults = NULL; + + PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult* cachedRaycastHitResults = + reinterpret_cast(mQueryOrCachedHitResults); + + for (PxU32 i = 0; i < 4; i++) + { + cachedRaycastHitResults->mCounts[i] = PxU16(cachedHitCounts[i]); + cachedRaycastHitResults->mPlanes[i] = cachedHitPlanes[i]; + cachedRaycastHitResults->mDistances[i] = 1.0f; + cachedRaycastHitResults->mFrictionMultipliers[i] = cachedFrictionMultipliers[i]; + cachedRaycastHitResults->mQueryTypes[i] = ((cachedQueryTypes[i] == PxTireContactIntersectionMethod::eRAY) ? 0 : 1); + } + } + + /** + \brief Rotation speeds of wheels + @see PxVehicle4WSetToRestState, PxVehicle4WGetWheelRotationSpeed, PxVehicle4WGetEngineRotationSpeed + */ + PxReal mWheelSpeeds[4]; + + /** + \brief Rotation speeds of wheels used to update the wheel rotation angles. + */ + PxReal mCorrectedWheelSpeeds[4]; + + /** + \brief Reported rotation angle about rolling axis. + @see PxVehicle4WSetToRestState, PxVehicle4WGetWheelRotationAngle + */ + PxReal mWheelRotationAngles[4]; + + /** + \brief Timers used to trigger sticky friction to hold the car perfectly at rest. + \note Used only internally. + */ + PxReal mTireLowForwardSpeedTimers[4]; + + /** + \brief Timers used to trigger sticky friction to hold the car perfectly at rest. + \note Used only internally. + */ + PxReal mTireLowSideSpeedTimers[4]; + + /** + \brief Previous suspension jounce. + \note Used only internally to compute the jounce speed by comparing cached jounce and latest jounce. + */ + PxReal mJounces[4]; + + /** + \brief Previous steer angle + \note Used only internally to compute the rotation of the sweep pose. + */ + PxReal mSteerAngles[4]; + + struct SuspLineSweep + { + /** + \brief Geometry suspension line sweep used in most recent scene query. + @see PxVehicleSuspensionSweeps + */ + PxGeometryHolder mGometries[4]; + + /** + \brief Start poses of suspension line sweep used in most recent scene query. + @see PxVehicleSuspensionSweeps + */ + PxTransform mStartPose[4]; + + /** + \brief Directions of suspension line sweeps used in most recent scene query. + @see PxVehicleSuspensionSweeps + */ + PxVec3 mDirs[4]; + + /** + \brief Lengths of suspension line sweeps used in most recent scene query. + @see PxVehicleSuspensionSweeps + */ + PxReal mLengths[4]; + }; + + struct SuspLineRaycast + { + /** + \brief Start point of suspension line raycasts used in most recent scene query. + @see PxVehicleSuspensionRaycasts + */ + PxVec3 mStarts[4]; + + /** + \brief Directions of suspension line raycasts used in most recent scene query. + @see PxVehicleSuspensionRaycasts + */ + PxVec3 mDirs[4]; + + /** + \brief Lengths of suspension line raycasts used in most recent scene query. + @see PxVehicleSuspensionRaycasts + */ + PxReal mLengths[4]; + + PxU32 mPad[16]; + }; + + struct CachedSuspLineSceneQuerytHitResult + { + /** + \brief Cached raycast hit planes. These are the planes found from the last scene queries. + @see PxVehicleSuspensionRaycasts, PxVehicleSuspensionSweeps + */ + PxPlane mPlanes[4]; + + /** + \brief Cached friction. + @see PxVehicleSuspensionRaycasts, PxVehicleSuspensionSweeps + */ + PxF32 mFrictionMultipliers[4]; + + /** + \brief Cached raycast hit distance. These are the hit distances found from the last scene queries. + */ + PxF32 mDistances[4]; + + /** + \brief Cached raycast hit counts. These are the hit counts found from the last scene queries. + @see PxVehicleSuspensionRaycasts, , PxVehicleSuspensionSweeps + */ + PxU16 mCounts[4]; + + /** + \brief Store 0 if cached results are from raycasts, store 1 if cached results are from sweeps. + */ + PxU16 mQueryTypes[4]; + + PxU32 mPad1[16]; + }; + + /** + \brief We either have a fresh raycast that was just performed or a cached raycast result that will be used if no raycast was just performed. + */ + PxU8 mQueryOrCachedHitResults[sizeof(SuspLineSweep)]; + + /** + \brief Used only internally. + */ + void setVehicleConstraintShader(PxVehicleConstraintShader* shader) {mVehicleConstraints=shader;} + PxVehicleConstraintShader& getVehicletConstraintShader() const {return *mVehicleConstraints;} + +private: + + //Susp limits and sticky tire friction for all wheels. + PxVehicleConstraintShader* mVehicleConstraints; + +public: + + /** + \brief Set by PxVehicleSuspensionRaycasts + @see PxVehicleSuspensionRaycasts + */ + const PxRaycastBuffer* mRaycastResults; + + /** + \brief Set by PxVehicleSuspensionSweeps + @see PxVehicleSuspensionSweeps + */ + const PxSweepBuffer* mSweepResults; + + /** + \brief Set true if a raycast hit plane has been recorded and cached. + This requires a raycast to be performed and then followed by PxVehicleUpdates + at least once. Reset to false in setToRestState. + */ + bool mHasCachedRaycastHitPlane; + + +#if PX_P64_FAMILY + PxU32 mPad[12]; +#endif +}; +PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheels4DynData) & 15)); +PX_COMPILE_TIME_ASSERT((0 == (sizeof(PxVehicleWheels4DynData::SuspLineSweep) & 0x0f))); +PX_COMPILE_TIME_ASSERT(sizeof(PxVehicleWheels4DynData::SuspLineRaycast) <= sizeof(PxVehicleWheels4DynData::SuspLineSweep)); +PX_COMPILE_TIME_ASSERT(sizeof(PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult) <= sizeof(PxVehicleWheels4DynData::SuspLineSweep)); + +#if !PX_DOXYGEN +} // namespace physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp new file mode 100644 index 0000000..2a2b6d8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleTireFriction.cpp @@ -0,0 +1,402 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleTireFriction.h" + +#include "foundation/PxMemory.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxIO.h" +#include "foundation/PxBitMap.h" +#include "common/PxCollection.h" + +#include "PxMaterial.h" + +namespace physx +{ + +PX_FORCE_INLINE PxU32 computeByteSize(const PxU32 maxNbTireTypes, const PxU32 maxNbSurfaceTypes) +{ + PxU32 byteSize = ((sizeof(PxU32)*(maxNbTireTypes*maxNbSurfaceTypes) + 15) & ~15); + byteSize += ((sizeof(PxMaterial*)*maxNbSurfaceTypes + 15) & ~15); + byteSize += ((sizeof(PxVehicleDrivableSurfaceType)*maxNbSurfaceTypes + 15) & ~15); + byteSize += ((sizeof(PxSerialObjectId)*maxNbSurfaceTypes + 15) & ~15); + byteSize += ((sizeof(PxVehicleDrivableSurfaceToTireFrictionPairs) + 15) & ~ 15); + return byteSize; +} + +PxVehicleDrivableSurfaceToTireFrictionPairs* PxVehicleDrivableSurfaceToTireFrictionPairs::allocate +(const PxU32 maxNbTireTypes, const PxU32 maxNbSurfaceTypes) +{ + PX_CHECK_AND_RETURN_VAL(maxNbSurfaceTypes <= eMAX_NB_SURFACE_TYPES, "maxNbSurfaceTypes must be less than eMAX_NB_SURFACE_TYPES", NULL); + + PxU32 byteSize = computeByteSize(maxNbTireTypes, maxNbSurfaceTypes); + PxU8* ptr = static_cast(PX_ALLOC(byteSize, "PxVehicleDrivableSurfaceToTireFrictionPairs")); + PxMemSet(ptr, 0, byteSize); + PxVehicleDrivableSurfaceToTireFrictionPairs* pairs = reinterpret_cast(ptr); + + pairs->mPairs = NULL; + pairs->mDrivableSurfaceMaterials = NULL; + pairs->mDrivableSurfaceTypes = NULL; + pairs->mMaterialSerialIds = NULL; + pairs->mNbTireTypes = 0; + pairs->mMaxNbTireTypes = maxNbTireTypes; + pairs->mNbSurfaceTypes = 0; + pairs->mMaxNbSurfaceTypes = maxNbSurfaceTypes; + + return pairs; +} + +void PxVehicleDrivableSurfaceToTireFrictionPairs::setup +(const PxU32 numTireTypes, const PxU32 numSurfaceTypes, const PxMaterial** drivableSurfaceMaterials, const PxVehicleDrivableSurfaceType* drivableSurfaceTypes) +{ + PX_CHECK_AND_RETURN(numTireTypes <= mMaxNbTireTypes, "numTireTypes must be less than mMaxNumSurfaceTypes"); + PX_CHECK_AND_RETURN(numSurfaceTypes <= mMaxNbSurfaceTypes, "numSurfaceTypes must be less than mMaxNumSurfaceTypes"); + + PxU8* ptr = reinterpret_cast(this); + + const PxU32 maxNbTireTypes = mMaxNbTireTypes; + const PxU32 maxNbSurfaceTypes = mMaxNbSurfaceTypes; + PxU32 byteSize = computeByteSize(mMaxNbTireTypes, mMaxNbSurfaceTypes); + PxMemSet(ptr, 0, byteSize); + mMaxNbTireTypes = maxNbTireTypes; + mMaxNbSurfaceTypes = maxNbSurfaceTypes; + + PxVehicleDrivableSurfaceToTireFrictionPairs* pairs = reinterpret_cast(ptr); + ptr += ((sizeof(PxVehicleDrivableSurfaceToTireFrictionPairs) + 15) & ~ 15); + + mPairs = reinterpret_cast(ptr); + ptr += ((sizeof(PxU32)*(numTireTypes*numSurfaceTypes) + 15) & ~15); + mDrivableSurfaceMaterials = reinterpret_cast(ptr); + ptr += ((sizeof(PxMaterial*)*numSurfaceTypes + 15) & ~15); + mDrivableSurfaceTypes = reinterpret_cast(ptr); + ptr += ((sizeof(PxVehicleDrivableSurfaceType)*numSurfaceTypes +15) & ~15); + mMaterialSerialIds = reinterpret_cast(ptr); + ptr += ((sizeof(PxSerialObjectId)*numSurfaceTypes + 15) & ~15); + + for(PxU32 i=0;imNbTireTypes=numTireTypes; + pairs->mNbSurfaceTypes=numSurfaceTypes; +} + +void PxVehicleDrivableSurfaceToTireFrictionPairs::release() +{ + PX_FREE_THIS; +} + +void PxVehicleDrivableSurfaceToTireFrictionPairs::setTypePairFriction(const PxU32 surfaceType, const PxU32 tireType, const PxReal value) +{ + PX_CHECK_AND_RETURN(tireType 0) + { + //Compute the number of bits to right-shift that gives the maximum number of unique hashes. + //Keep searching until we find either a set of completely unique hashes or a peak count of unique hashes. + PxU32 prevShift = 0; + PxU32 shift = 2; + PxU32 prevNumUniqueHashes = 0; + PxU32 currNumUniqueHashes = 0; + while (((currNumUniqueHashes = computeNumUniqueHashes(shift)) > prevNumUniqueHashes) && currNumUniqueHashes != mNbEntries) + { + prevNumUniqueHashes = currNumUniqueHashes; + prevShift = shift; + shift = (shift << 1); + } + if (currNumUniqueHashes != mNbEntries) + { + //Stopped searching because we have gone past the peak number of unqiue hashes. + mShift = prevShift; + } + else + { + //Stopped searching because we found a unique hash for each key. + mShift = shift; + } + + //Compute the hash values with the optimum shift. + for (PxU32 i = 0; i < mNbEntries; i++) + { + const PxMaterial* const material = mMaterials[i]; + const PxU32 hash = computeHash(material, mShift); + if (PX_MAX_U32 == mHeadIds[hash]) + { + mNextIds[i] = PX_MAX_U32; + mHeadIds[hash] = i; + } + else + { + mNextIds[i] = mHeadIds[hash]; + mHeadIds[hash] = i; + } + } + } + } + ~VehicleSurfaceTypeHashTable() + { + } + + PX_FORCE_INLINE PxU32 get(const PxMaterial* const key) const + { + PX_ASSERT(key); + const PxU32 hash = computeHash(key, mShift); + PxU32 id = mHeadIds[hash]; + while (PX_MAX_U32 != id) + { + const PxMaterial* const mat = mMaterials[id]; + if (key == mat) + { + return mDrivableSurfaceTypes[id].mType; + } + id = mNextIds[id]; + } + + return 0; + } + +private: + + PxU32 mNbEntries; + const PxMaterial* const* mMaterials; + const PxVehicleDrivableSurfaceType* mDrivableSurfaceTypes; + + static PX_FORCE_INLINE PxU32 computeHash(const PxMaterial* const key, const PxU32 shift) + { + const uintptr_t ptr = ((uintptr_t(key)) >> shift); + const uintptr_t hash = (ptr & (eHASH_SIZE - 1)); + return PxU32(hash); + } + + PxU32 computeNumUniqueHashes(const PxU32 shift) const + { + PxU32 words[eHASH_SIZE >> 5]; + PxU8* bitmapBuffer[sizeof(PxBitMap)]; + PxBitMap* bitmap = reinterpret_cast(bitmapBuffer); + bitmap->setWords(words, eHASH_SIZE >> 5); + + PxU32 numUniqueHashes = 0; + PxMemZero(words, sizeof(PxU32)*(eHASH_SIZE >> 5)); + for (PxU32 i = 0; i < mNbEntries; i++) + { + const PxMaterial* const material = mMaterials[i]; + const PxU32 hash = computeHash(material, shift); + if (!bitmap->test(hash)) + { + bitmap->set(hash); + numUniqueHashes++; + } + } + return numUniqueHashes; + } + + enum + { + eHASH_SIZE = PxVehicleDrivableSurfaceToTireFrictionPairs::eMAX_NB_SURFACE_TYPES + }; + PxU32 mHeadIds[eHASH_SIZE]; + enum + { + eMAX_NB_KEYS = PxVehicleDrivableSurfaceToTireFrictionPairs::eMAX_NB_SURFACE_TYPES + }; + PxU32 mNextIds[eMAX_NB_KEYS]; + + PxU32 mShift; +}; + +PxU32 PxVehicleDrivableSurfaceToTireFrictionPairs::getSurfaceType(const PxMaterial& surfaceMaterial) const +{ + const VehicleSurfaceTypeHashTable surfaceTypeHashTable(*this); + const PxU32 surfaceType = surfaceTypeHashTable.get(&surfaceMaterial); + return surfaceType; +} + +PxReal PxVehicleDrivableSurfaceToTireFrictionPairs::getTypePairFriction(const PxMaterial& surfaceMaterial, const PxU32 tireType) const +{ + const PxU32 surfaceType = getSurfaceType(surfaceMaterial); + return getTypePairFriction(surfaceType, tireType); +} + +#if PX_CHECKED +bool isLegalCollectionWithNullArray(PxCollection* collection, const PxSerialObjectId* materialIds, const PxMaterial** materials, const PxU32 nbMaterials) +{ + if (!materialIds) + { + for (PxU32 i = 0; i < nbMaterials; i++) + { + const PxMaterial* material = materials[i]; + if (0 == collection->getId(*material)) + { + return false; + } + } + } + return true; +} + +bool isLegalCollection(PxCollection* collection, const PxSerialObjectId* materialIds, const PxMaterial** materials, const PxU32 nbMaterials) +{ + if(materialIds) + { + for (PxU32 i = 0; i < nbMaterials; i++) + { + const PxMaterial* material = materials[i]; + if (0 == collection->getId(*material)) + { + //Material has not yet been assigned an id. + //Make sure materialId is free. + if(collection->find(materialIds[i])) + { + return false; + } + } + } + } + return true; +} +#endif + +void PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary +(const PxVehicleDrivableSurfaceToTireFrictionPairs& frictionTable, + const PxSerialObjectId* materialIds, const PxU32 nbMaterialIds, + PxCollection* collection, PxOutputStream& stream) +{ + PX_CHECK_AND_RETURN(!materialIds || nbMaterialIds >= frictionTable.mNbSurfaceTypes, "PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary - insufficient nbMaterialIds"); + PX_CHECK_AND_RETURN(isLegalCollectionWithNullArray(collection, materialIds, frictionTable.mDrivableSurfaceMaterials, frictionTable.mNbSurfaceTypes), "PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary - material ids not configured"); + PX_CHECK_AND_RETURN(isLegalCollection(collection, materialIds, frictionTable.mDrivableSurfaceMaterials, frictionTable.mNbSurfaceTypes), "PxVehicleDrivableSurfaceToTireFrictionPairs::serializeToBinary - material id already in use"); + PX_UNUSED(nbMaterialIds); + + for (PxU32 i = 0; i < frictionTable.mNbSurfaceTypes; i++) + { + const PxMaterial* material = frictionTable.mDrivableSurfaceMaterials[i]; + const PxSerialObjectId id = collection->getId(*material); + if(0 == id) + { + collection->add(*const_cast(material), materialIds[i]); + const_cast(frictionTable).mMaterialSerialIds[i] = materialIds[i]; + } + else + { + const_cast(frictionTable).mMaterialSerialIds[i] = collection->getId(*material); + } + } + + stream.write(&frictionTable, computeByteSize(frictionTable.mMaxNbTireTypes, frictionTable.mMaxNbSurfaceTypes)); + + for (PxU32 i = 0; i < frictionTable.mNbSurfaceTypes; i++) + { + const_cast(frictionTable).mMaterialSerialIds[i] = 0; + } +} + +PxVehicleDrivableSurfaceToTireFrictionPairs* PxVehicleDrivableSurfaceToTireFrictionPairs::deserializeFromBinary(const PxCollection& collection, void* buffer) +{ + PxVehicleDrivableSurfaceToTireFrictionPairs* fricTable = reinterpret_cast(buffer); + + //Patch up pointers. + { + PxU8* ptr = reinterpret_cast(fricTable); + ptr += ((sizeof(PxVehicleDrivableSurfaceToTireFrictionPairs) + 15) & ~15); + fricTable->mPairs = reinterpret_cast(ptr); + ptr += ((sizeof(PxU32) * (fricTable->mNbTireTypes * fricTable->mNbSurfaceTypes) + 15) & ~15); + fricTable->mDrivableSurfaceMaterials = reinterpret_cast(ptr); + ptr += ((sizeof(PxMaterial*) * fricTable->mNbSurfaceTypes + 15) & ~15); + fricTable->mDrivableSurfaceTypes = reinterpret_cast(ptr); + ptr += ((sizeof(PxVehicleDrivableSurfaceType) * fricTable->mNbSurfaceTypes + 15) & ~15); + fricTable->mMaterialSerialIds = reinterpret_cast(ptr); + ptr += ((sizeof(PxSerialObjectId) * fricTable->mNbSurfaceTypes + 15) & ~15); + } + + //Set the material pointers in order. + for (PxU32 i = 0; i < fricTable->mNbSurfaceTypes; i++) + { + const PxSerialObjectId id = fricTable->mMaterialSerialIds[i]; + const PxBase* base = collection.find(id); + const PxMaterial* material = base->is(); + fricTable->mDrivableSurfaceMaterials[i] = material; + } + + return fricTable; +} + +}//physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp new file mode 100644 index 0000000..179ca64 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleUpdate.cpp @@ -0,0 +1,7515 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxQuat.h" +#include "foundation/PxBitMap.h" +#include "common/PxProfileZone.h" +#include "common/PxTolerancesScale.h" +#include "vehicle/PxVehicleUpdate.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveNW.h" +#include "vehicle/PxVehicleDriveTank.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleUtil.h" +#include "vehicle/PxVehicleUtilTelemetry.h" +#include "extensions/PxRigidBodyExt.h" +#include "extensions/PxSceneQueryExt.h" +#include "PxShape.h" +#include "PxRigidDynamic.h" +#include "PxMaterial.h" +#include "PxContactModifyCallback.h" +#include "PxScene.h" + +#include "PxVehicleSuspLimitConstraintShader.h" +#include "PxVehicleSuspWheelTire4.h" +#include "PxVehicleLinearMath.h" + +#include "foundation/PxUtilities.h" +#include "foundation/PxFPU.h" +#include "CmUtils.h" + +using namespace physx; +using namespace Cm; + +//TODO: lsd - handle case where wheels are spinning in different directions. +//TODO: ackermann - use faster approximate functions for PxTan/PxATan because the results don't need to be too accurate here. +//TODO: tire lat slip - do we really use PxAbs(vz) as denominator, that's not in the paper? +//TODO: toe vs jounce table. +//TODO: pneumatic trail. +//TODO: we probably need to have a graphics jounce and a physics jounce and +//TODO: expose sticky friction values in api. +//TODO: blend the graphics jounce towards the physics jounce to avoid graphical pops at kerbs etc. +//TODO: better graph of friction vs slip. Need to account for negative slip and positive slip differences. + +namespace physx +{ + +//////////////////////////////////////////////////////////////////////////// +//Implementation of public api function PxVehicleSetBasisVectors +//////////////////////////////////////////////////////////////////////////// + +static PxVehicleContext gVehicleContextDefault; + +void PxVehicleSetBasisVectors(const PxVec3& up, const PxVec3& forward) +{ + gVehicleContextDefault.upAxis = up; + gVehicleContextDefault.forwardAxis = forward; + gVehicleContextDefault.computeSideAxis(); +} + +//////////////////////////////////////////////////////////////////////////// +//Implementation of public api function PxVehicleSetUpdateMode +//////////////////////////////////////////////////////////////////////////// + +void PxVehicleSetUpdateMode(PxVehicleUpdateMode::Enum vehicleUpdateMode) +{ + gVehicleContextDefault.updateMode = vehicleUpdateMode; +} + +//////////////////////////////////////////////////////////////////////////// +//Implementation of public api function PxVehicleSetSweepHitRejectionAngles +//////////////////////////////////////////////////////////////////////////// + +void PxVehicleSetSweepHitRejectionAngles(const PxF32 pointRejectAngle, const PxF32 normalRejectAngle) +{ + PX_CHECK_AND_RETURN(pointRejectAngle > 0.0f && pointRejectAngle < PxPi, "PxVehicleSetSweepHitRejectionAngles - pointRejectAngle must be in range (0, Pi)"); + PX_CHECK_AND_RETURN(normalRejectAngle > 0.0f && normalRejectAngle < PxPi, "PxVehicleSetSweepHitRejectionAngles - normalRejectAngle must be in range (0, Pi)"); + gVehicleContextDefault.pointRejectAngleThresholdCosine = PxCos(pointRejectAngle); + gVehicleContextDefault.normalRejectAngleThresholdCosine = PxCos(normalRejectAngle); +} + +//////////////////////////////////////////////////////////////////////////// +//Implementation of public api function PxVehicleSetSweepHitRejectionAngles +//////////////////////////////////////////////////////////////////////////// + +void PxVehicleSetMaxHitActorAcceleration(const PxF32 maxHitActorAcceleration) +{ + PX_CHECK_AND_RETURN(maxHitActorAcceleration >= 0.0f, "PxVehicleSetMaxHitActorAcceleration - maxHitActorAcceleration must be greater than or equal to zero"); + gVehicleContextDefault.maxHitActorAcceleration = maxHitActorAcceleration; +} + +//////////////////////////////////////////////////////////////////////////// +//Implementation of public api function PxVehicleGetDefaultContext +//////////////////////////////////////////////////////////////////////////// + +const PxVehicleContext& PxVehicleGetDefaultContext() +{ + return gVehicleContextDefault; +} + +//////////////////////////////////////////////////////////////////////////// +//Set all defaults from PxVehicleInitSDK +//////////////////////////////////////////////////////////////////////////// + +void setVehicleDefaults() +{ + gVehicleContextDefault.setToDefault(); +} + +//////////////////////////////////////////////////////////////////////////// +//Called from PxVehicleInitSDK/PxCloseVehicleSDK +//////////////////////////////////////////////////////////////////////////// + +//*********************** + +PxF32 gThresholdForwardSpeedForWheelAngleIntegration=0; +PxF32 gRecipThresholdForwardSpeedForWheelAngleIntegration=0; +PxF32 gMinLatSpeedForTireModel=0; +PxF32 gStickyTireFrictionThresholdSpeed=0; +PxF32 gToleranceScaleLength=0; +PxF32 gMinimumSlipThreshold=0; + +void setVehicleToleranceScale(const PxTolerancesScale& ts) +{ + gThresholdForwardSpeedForWheelAngleIntegration=5.0f*ts.length; + gRecipThresholdForwardSpeedForWheelAngleIntegration=1.0f/gThresholdForwardSpeedForWheelAngleIntegration; + + gMinLatSpeedForTireModel=1.0f*ts.length; + + gStickyTireFrictionThresholdSpeed=0.2f*ts.length; + + gToleranceScaleLength=ts.length; + + gMinimumSlipThreshold = 1e-5f; +} + +void resetVehicleToleranceScale() +{ + gThresholdForwardSpeedForWheelAngleIntegration=0; + gRecipThresholdForwardSpeedForWheelAngleIntegration=0; + + gMinLatSpeedForTireModel=0; + + gStickyTireFrictionThresholdSpeed=0; + + gToleranceScaleLength=0; + + gMinimumSlipThreshold=0; +} + +//*********************** + +const PxSerializationRegistry* gSerializationRegistry=NULL; + +void setSerializationRegistryPtr(const PxSerializationRegistry* sr) +{ + gSerializationRegistry = sr; +} + +const PxSerializationRegistry* resetSerializationRegistryPtr() +{ + const PxSerializationRegistry* tmp = gSerializationRegistry; + gSerializationRegistry = NULL; + return tmp; +} + +//////////////////////////////////////////////////////////////////////////// +//Global values used to trigger and control sticky tire friction constraints. +//////////////////////////////////////////////////////////////////////////// + +const PxF32 gStickyTireFrictionForwardDamping=0.01f; +const PxF32 gStickyTireFrictionSideDamping=0.1f; +const PxF32 gLowForwardSpeedThresholdTime=1.0f; +const PxF32 gLowSideSpeedThresholdTime=1.0f; + +//////////////////////////////////////////////////////////////////////////// +//Global values used to control max iteration count if estimate mode is chosen +//////////////////////////////////////////////////////////////////////////// + +const PxF32 gSolverTolerance = 1e-10f; + +//////////////////////////////////////////////////////////////////////////// +//Compute the sprung masses that satisfy the centre of mass and sprung mass coords. +//////////////////////////////////////////////////////////////////////////// + +#define DETERMINANT_THRESHOLD (1e-6f) + +void computeSprungMasses(const PxU32 numSprungMasses, const PxVec3* sprungMassCoordinates, const PxVec3& centreOfMass, const PxReal totalMass, const PxU32 gravityDirection, PxReal* sprungMasses) +{ +#if PX_CHECKED + PX_CHECK_AND_RETURN(numSprungMasses > 0, "PxVehicleComputeSprungMasses: numSprungMasses must be greater than zero"); + PX_CHECK_AND_RETURN(numSprungMasses <= PX_MAX_NB_WHEELS, "PxVehicleComputeSprungMasses: numSprungMasses must be less than or equal to 20"); + for(PxU32 i=0;i 0.0f, "PxVehicleComputeSprungMasses: totalMass must be greater than zero"); + PX_CHECK_AND_RETURN(gravityDirection<=2, "PxVehicleComputeSprungMasses: gravityDirection must be 0 or 1 or 2"); + PX_CHECK_AND_RETURN(sprungMasses, "PxVehicleComputeSprungMasses: sprungMasses must be a non-null pointer"); +#endif + + if(1==numSprungMasses) + { + sprungMasses[0]=totalMass; + } + else if(2==numSprungMasses) + { + PxVec3 v=sprungMassCoordinates[0]; + v[gravityDirection]=0; + PxVec3 w=sprungMassCoordinates[1]-sprungMassCoordinates[0]; + w[gravityDirection]=0; + w.normalize(); + + PxVec3 cm=centreOfMass; + cm[gravityDirection]=0; + PxF32 t=w.dot(cm-v); + PxVec3 p=v+w*t; + + PxVec3 x0=sprungMassCoordinates[0]; + x0[gravityDirection]=0; + PxVec3 x1=sprungMassCoordinates[1]; + x1[gravityDirection]=0; + const PxF32 r0=(x0-p).dot(w); + const PxF32 r1=(x1-p).dot(w); + + PX_CHECK_AND_RETURN(PxAbs(r0-r1) > DETERMINANT_THRESHOLD, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); + + const PxF32 m0=totalMass*r1/(r1-r0); + const PxF32 m1=totalMass-m0; + + sprungMasses[0]=m0; + sprungMasses[1]=m1; + } + else if(3==numSprungMasses) + { + const PxU32 d0=(gravityDirection+1)%3; + const PxU32 d1=(gravityDirection+2)%3; + + MatrixNN A(3); + VectorN b(3); + A.set(0,0,sprungMassCoordinates[0][d0]); + A.set(0,1,sprungMassCoordinates[1][d0]); + A.set(0,2,sprungMassCoordinates[2][d0]); + A.set(1,0,sprungMassCoordinates[0][d1]); + A.set(1,1,sprungMassCoordinates[1][d1]); + A.set(1,2,sprungMassCoordinates[2][d1]); + A.set(2,0,1.f); + A.set(2,1,1.f); + A.set(2,2,1.f); + b[0]=totalMass*centreOfMass[d0]; + b[1]=totalMass*centreOfMass[d1]; + b[2]=totalMass; + + VectorN result(3); + MatrixNNLUSolver solver; + solver.decomposeLU(A); + PX_CHECK_AND_RETURN(PxAbs(solver.getDet()) > DETERMINANT_THRESHOLD, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); + solver.solve(b,result); + + sprungMasses[0]=result[0]; + sprungMasses[1]=result[1]; + sprungMasses[2]=result[2]; + } + else if(numSprungMasses>=4) + { + const PxU32 d0=(gravityDirection+1)%3; + const PxU32 d1=(gravityDirection+2)%3; + + const PxF32 mbar = totalMass/(numSprungMasses*1.0f); + + //See http://en.wikipedia.org/wiki/Lagrange_multiplier + //particularly the section on multiple constraints. + + //3 Constraint equations. + //g0 = sum_ xi*mi=xcm + //g1 = sum_ zi*mi=zcm + //g2 = sum_ mi = totalMass + //Minimisation function to achieve solution with minimum mass variance. + //f = sum_ (mi - mave)^2 + //Lagrange terms (N equations, N+3 unknowns) + //2*mi - xi*lambda0 - zi*lambda1 - 1*lambda2 = 2*mave + + MatrixNN A(numSprungMasses+3); + VectorN b(numSprungMasses+3); + + //g0, g1, g2 + for(PxU32 i=0;i DETERMINANT_THRESHOLD, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); + + for(PxU32 i=0;i= 0, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); + cm += sprungMassCoordinates[i]*sprungMasses[i]; + m += sprungMasses[i]; + } + cm *= (1.0f/totalMass); + PX_CHECK_AND_RETURN((PxAbs(totalMass - m)/totalMass) < 1e-3f, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); + PxVec3 diff = cm - centreOfMass; + diff[gravityDirection]=0; + const PxF32 diffMag = diff.magnitude(); + PX_CHECK_AND_RETURN(numSprungMasses <=2 || diffMag < 1e-3f, "PxVehicleComputeSprungMasses: Unable to determine sprung masses. Please check the values in sprungMassCoordinates."); +#endif +} + +//////////////////////////////////////////////////////////////////////////// +//Work out if all wheels are in the air. +//////////////////////////////////////////////////////////////////////////// + +bool PxVehicleIsInAir(const PxVehicleWheelQueryResult& vehWheelQueryResults) +{ + if(!vehWheelQueryResults.wheelQueryResults) + { + return true; + } + + for(PxU32 i=0;igetGlobalPose(); + vehWheelTransform = contactModifyPair.transform[0]; + isOtherDynamic = contactModifyPair.actor[1] && contactModifyPair.actor[1]->is(); + } + else + { + PX_ASSERT(contactModifyPair.actor[1] == vehActor); + normalMultiplier = -1.0f; + targetVelMultiplier = -1.0f; + vehActorTransform = contactModifyPair.actor[1]->getGlobalPose(); + vehWheelTransform = contactModifyPair.transform[1]; + isOtherDynamic = contactModifyPair.actor[0] && contactModifyPair.actor[0]->is(); + } + + //Compute the "right" vector of the transform. + const PxVec3 right = vehWheelTransform.q.rotate(context.sideAxis); + + //The wheel transform includes rotation about the rolling axis. + //We want to compute the wheel transform at zero wheel rotation angle. + PxTransform correctedWheelShapeTransform; + { + const PxF32 wheelRotationAngle = vehicle.mWheelsDynData.getWheelRotationAngle(wheelId); + const PxQuat wheelRotateQuat(-wheelRotationAngle, right); + correctedWheelShapeTransform = PxTransform(vehWheelTransform.p, wheelRotateQuat*vehWheelTransform.q); + } + + //Construct a plane for the wheel + const PxPlane wheelPlane(correctedWheelShapeTransform.p, right); + + //Compute the suspension travel vector. + const PxVec3 suspTravelDir = correctedWheelShapeTransform.rotate(vehicle.mWheelsSimData.getSuspTravelDirection(wheelId)); + + //Get the wheel centre. + const PxVec3 wheelCentre = correctedWheelShapeTransform.p; + + //Test each point. + PxContactSet& contactSet = contactModifyPair.contacts; + const PxU32 numContacts = contactSet.size(); + for(PxU32 i = 0; i < numContacts; i++) + { + //Get the next contact point to analyse. + const PxVec3& contactPoint = contactSet.getPoint(i); + bool ignorePoint = false; + + //Project the contact point on to the wheel plane. + const PxF32 distanceToPlane = wheelPlane.n.dot(contactPoint) + wheelPlane.d; + const PxVec3 contactPointOnPlane = contactPoint - wheelPlane.n*distanceToPlane; + + //Construct a vector from the wheel centre to the contact point on the plane. + PxVec3 dir = contactPointOnPlane - wheelCentre; + const PxF32 effectiveRadius = dir.normalize(); + + if(!ignorePoint && rejectPoints) + { + //Work out the dot product of the suspension direction and the direction from wheel centre to contact point. + const PxF32 dotProduct = dir.dot(suspTravelDir); + if (dotProduct > context.pointRejectAngleThresholdCosine) + { + ignorePoint = true; + numIgnoredContacts++; + contactSet.ignore(i); + } + } + + //Ignore contact normals that are near the raycast direction. + if(!ignorePoint && rejectNormals) + { + const PxVec3& contactNormal = contactSet.getNormal(i) * normalMultiplier; + const PxF32 dotProduct = -(contactNormal.dot(suspTravelDir)); + if(dotProduct > context.normalRejectAngleThresholdCosine) + { + ignorePoint = true; + numIgnoredContacts++; + contactSet.ignore(i); + } + } + + //For points that remain we want to modify the contact speed to account for the spinning wheel. + //We also want the applied impulse to go through the suspension geometry so we set the contact point to be the suspension force + //application point. + if(!ignorePoint) + { + //Compute the tangent velocity. + //Retain only the component that lies perpendicular to the contact normal. + const PxF32 wheelRotationSpeed = vehicle.mWheelsDynData.getWheelRotationSpeed(wheelId); + const PxVec3 tangentVelocityDir = right.cross(dir); + PxVec3 tangentVelocity = tangentVelocityDir*(effectiveRadius*wheelRotationSpeed); + tangentVelocity -= contactSet.getNormal(i)*(tangentVelocity.dot(contactSet.getNormal(i))); + + //We want to add velocity in the opposite direction to the tangent velocity. + const PxVec3 targetTangentVelocity = -wheelTangentVelocityMultiplier*tangentVelocity; + + //Relative velocity is computed from actor0 - actor1 + //If vehicle is actor 0 we want to add to the target velocity: targetVelocity = [(vel0 + targetTangentVelocity) - vel1] = vel0 - vel1 + targetTangentVelocity + //If vehicle is actor 1 we want to subtract from the target velocity: targetVelocity = [vel0 - (vel1 + targetTangentVelocity)] = vel0 - vel1 - targetTangentVelocity + const PxVec3 targetVelocity = targetTangentVelocity*targetVelMultiplier; + + //Add the target velocity. + contactSet.setTargetVelocity(i, targetVelocity); + + //Set the max impulse that can be applied. + //Only apply this if the wheel has hit a dynamic. + if (isOtherDynamic) + { + contactSet.setMaxImpulse(i, maxImpulse); + } + + //Set the contact point to be the suspension force application point because all forces applied through the wheel go through the suspension geometry. + const PxVec3 suspAppPoint = vehActorTransform.transform(vehActor->getCMassLocalPose().p + vehicle.mWheelsSimData.getSuspForceAppPointOffset(wheelId)); + contactSet.setPoint(i, suspAppPoint); + } + } + + return numIgnoredContacts; +} + +//////////////////////////////////////////////////////////////////////////// +//Enable a 4W vehicle in either tadpole or delta configuration. +//////////////////////////////////////////////////////////////////////////// + +void computeDirection(const PxVec3& up, const PxVec3& right, + PxU32& rightDirection, PxU32& upDirection) +{ + //Work out the up and right vectors. + rightDirection = 0xffffffff; + if(right == PxVec3(1.f,0,0) || right == PxVec3(-1.f,0,0)) + { + rightDirection = 0; + } + else if(right == PxVec3(0,1.f,0) || right == PxVec3(0,-1.f,0)) + { + rightDirection = 1; + } + else if(right == PxVec3(0,0,1.f) || right == PxVec3(0,0,-1.f)) + { + rightDirection = 2; + } + upDirection = 0xffffffff; + if(up == PxVec3(1.f,0,0) || up == PxVec3(-1.f,0,0)) + { + upDirection = 0; + } + else if(up == PxVec3(0,1.f,0) || up == PxVec3(0,-1.f,0)) + { + upDirection = 1; + } + else if(up == PxVec3(0,0,1.f) || up == PxVec3(0,0,-1.f)) + { + upDirection = 2; + } +} + +void enable3WMode(const PxU32 rightDirection, const PxU32 upDirection, const bool removeFrontWheel, PxVehicleWheelsSimData& wheelsSimData, PxVehicleWheelsDynData& wheelsDynData, PxVehicleDriveSimData4W& driveSimData) +{ + PX_ASSERT(rightDirection < 3); + PX_ASSERT(upDirection < 3); + + const PxU32 wheelToRemove = removeFrontWheel ? PxVehicleDrive4WWheelOrder::eFRONT_LEFT : PxVehicleDrive4WWheelOrder::eREAR_LEFT; + const PxU32 wheelToModify = removeFrontWheel ? PxVehicleDrive4WWheelOrder::eFRONT_RIGHT : PxVehicleDrive4WWheelOrder::eREAR_RIGHT; + + //Disable the wheel. + wheelsSimData.disableWheel(wheelToRemove); + + //Make sure the wheel's corresponding PxShape does not get posed again. + wheelsSimData.setWheelShapeMapping(wheelToRemove, -1); + + //Set the angular speed to 0.0f + wheelsDynData.setWheelRotationSpeed(wheelToRemove, 0.0f); + + //Disable Ackermann steering. + //If the front wheel is to be removed and the front wheels can steer then disable Ackermann correction. + //If the rear wheel is to be removed and the rear wheels can steer then disable Ackermann correction. + if(removeFrontWheel && + (wheelsSimData.getWheelData(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT).mMaxSteer!=0.0f || + wheelsSimData.getWheelData(PxVehicleDrive4WWheelOrder::eFRONT_LEFT).mMaxSteer!=0.0f)) + { + PxVehicleAckermannGeometryData ackermannData=driveSimData.getAckermannGeometryData(); + ackermannData.mAccuracy=0.0f; + driveSimData.setAckermannGeometryData(ackermannData); + } + if(!removeFrontWheel && + (wheelsSimData.getWheelData(PxVehicleDrive4WWheelOrder::eREAR_RIGHT).mMaxSteer!=0.0f || + wheelsSimData.getWheelData(PxVehicleDrive4WWheelOrder::eREAR_LEFT).mMaxSteer!=0.0f)) + { + PxVehicleAckermannGeometryData ackermannData=driveSimData.getAckermannGeometryData(); + ackermannData.mAccuracy=0.0f; + driveSimData.setAckermannGeometryData(ackermannData); + } + + //We need to set up the differential to make sure that no drive torque is delivered to the disabled wheel. + PxVehicleDifferential4WData diffData =driveSimData.getDiffData(); + if(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT==wheelToModify) + { + diffData.mFrontBias=PX_MAX_F32; + diffData.mFrontLeftRightSplit=0.0f; + } + else + { + diffData.mRearBias=PX_MAX_F32; + diffData.mRearLeftRightSplit=0.0f; + } + driveSimData.setDiffData(diffData); + + //Now reposition the disabled wheel so that it lies at the center of its axle. + //The following assumes that the front and rear axles lie along the x-axis. + { + PxVec3 wheelCentreOffset=wheelsSimData.getWheelCentreOffset(wheelToModify); + wheelCentreOffset[rightDirection]=0.0f; + wheelsSimData.setWheelCentreOffset(wheelToModify,wheelCentreOffset); + + PxVec3 suspOffset=wheelsSimData.getSuspForceAppPointOffset(wheelToModify); + suspOffset[rightDirection]=0; + wheelsSimData.setSuspForceAppPointOffset(wheelToModify,suspOffset); + + PxVec3 tireOffset=wheelsSimData.getTireForceAppPointOffset(wheelToModify); + tireOffset[rightDirection]=0; + wheelsSimData.setTireForceAppPointOffset(wheelToModify,tireOffset); + } + + //Redistribute the mass supported by 4 wheels among the 3 remaining enabled wheels. + //Compute the total mass supported by all 4 wheels. + const PxF32 totalMass = + wheelsSimData.getSuspensionData(PxVehicleDrive4WWheelOrder::eFRONT_LEFT).mSprungMass + + wheelsSimData.getSuspensionData(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT).mSprungMass + + wheelsSimData.getSuspensionData(PxVehicleDrive4WWheelOrder::eREAR_LEFT).mSprungMass + + wheelsSimData.getSuspensionData(PxVehicleDrive4WWheelOrder::eREAR_RIGHT).mSprungMass; + //Get the wheel cm offsets of the 3 enabled wheels. + PxVec3 cmOffsets[3]= + { + wheelsSimData.getWheelCentreOffset((wheelToRemove+1) % 4), + wheelsSimData.getWheelCentreOffset((wheelToRemove+2) % 4), + wheelsSimData.getWheelCentreOffset((wheelToRemove+3) % 4), + }; + //Re-compute the sprung masses. + PxF32 sprungMasses[3]; + computeSprungMasses(3, cmOffsets, PxVec3(0,0,0), totalMass, upDirection, sprungMasses); + + //Now set the new sprung masses. + //Do this in a way that preserves the natural frequency and damping ratio of the spring. + for(PxU32 i=0;i<3;i++) + { + PxVehicleSuspensionData suspData = wheelsSimData.getSuspensionData((wheelToRemove+1+i) % 4); + + const PxF32 oldSprungMass = suspData.mSprungMass; + const PxF32 oldStrength = suspData.mSpringStrength; + const PxF32 oldDampingRate = suspData.mSpringDamperRate; + const PxF32 oldNaturalFrequency = PxSqrt(oldStrength/oldSprungMass); + + const PxF32 newSprungMass = sprungMasses[i]; + const PxF32 newStrength = oldNaturalFrequency*oldNaturalFrequency*newSprungMass; + const PxF32 newDampingRate = oldDampingRate; + + suspData.mSprungMass = newSprungMass; + suspData.mSpringStrength = newStrength; + suspData.mSpringDamperRate = newDampingRate; + wheelsSimData.setSuspensionData((wheelToRemove+1+i) % 4, suspData); + } +} + + +//////////////////////////////////////////////////////////////////////////// +//Maximum number of allowed blocks of 4 wheels +//////////////////////////////////////////////////////////////////////////// + +#define PX_MAX_NB_SUSPWHEELTIRE4 (PX_MAX_NB_WHEELS >>2) + + +//////////////////////////////////////////////////////////////////////////// +//Pointers to telemetry data. +//Set to NULL if no telemetry data is to be recorded during a vehicle update. +//Functions used throughout vehicle update to record specific vehicle data. +//////////////////////////////////////////////////////////////////////////// + +#if PX_DEBUG_VEHICLE_ON + +struct VehicleTelemetryDataContext +{ + PxF32 wheelGraphData[PX_MAX_NB_WHEELS][PxVehicleWheelGraphChannel::eMAX_NB_WHEEL_CHANNELS]; + PxF32 engineGraphData[PxVehicleDriveGraphChannel::eMAX_NB_DRIVE_CHANNELS]; + PxVec3 suspForceAppPoints[PX_MAX_NB_WHEELS]; + PxVec3 tireForceAppPoints[PX_MAX_NB_WHEELS]; +}; + +PX_FORCE_INLINE void updateGraphDataInternalWheelDynamics(const PxU32 startIndex, const PxF32* carWheelSpeeds, + PxF32 carWheelGraphData[][PxVehicleWheelGraphChannel::eMAX_NB_WHEEL_CHANNELS]) +{ + //Grab the internal rotation speeds for graphing before we update them. + for(PxU32 i=0;i<4;i++) + { + PX_ASSERT((startIndex+i) < PX_MAX_NB_WHEELS); + PX_ASSERT(carWheelGraphData[startIndex+i]); + carWheelGraphData[startIndex+i][PxVehicleWheelGraphChannel::eWHEEL_OMEGA]=carWheelSpeeds[i]; + } +} + +PX_FORCE_INLINE void updateGraphDataInternalEngineDynamics(const PxF32 carEngineSpeed, PxF32* carEngineGraphData) +{ + carEngineGraphData[PxVehicleDriveGraphChannel::eENGINE_REVS]=carEngineSpeed; +} + +PX_FORCE_INLINE void updateGraphDataControlInputs(const PxF32 accel, const PxF32 brake, const PxF32 handbrake, const PxF32 steerLeft, const PxF32 steerRight, + PxF32* carEngineGraphData) +{ + carEngineGraphData[PxVehicleDriveGraphChannel::eACCEL_CONTROL]=accel; + carEngineGraphData[PxVehicleDriveGraphChannel::eBRAKE_CONTROL]=brake; + carEngineGraphData[PxVehicleDriveGraphChannel::eHANDBRAKE_CONTROL]=handbrake; + carEngineGraphData[PxVehicleDriveGraphChannel::eSTEER_LEFT_CONTROL]=steerLeft; + carEngineGraphData[PxVehicleDriveGraphChannel::eSTEER_RIGHT_CONTROL]=steerRight; +} +PX_FORCE_INLINE void updateGraphDataGearRatio(const PxF32 G, PxF32* carEngineGraphData) +{ + carEngineGraphData[PxVehicleDriveGraphChannel::eGEAR_RATIO]=G; +} +PX_FORCE_INLINE void updateGraphDataEngineDriveTorque(const PxF32 engineDriveTorque, PxF32* carEngineGraphData) +{ + carEngineGraphData[PxVehicleDriveGraphChannel::eENGINE_DRIVE_TORQUE]=engineDriveTorque; +} +PX_FORCE_INLINE void updateGraphDataClutchSlip(const PxF32* wheelSpeeds, const PxF32* aveWheelSpeedContributions, const PxF32 engineSpeed, const PxF32 G, + PxF32* carEngineGraphData) +{ + PxF32 averageWheelSpeed=0; + for(PxU32 i=0;i<4;i++) + { + averageWheelSpeed+=wheelSpeeds[i]*aveWheelSpeedContributions[i]; + } + averageWheelSpeed*=G; + carEngineGraphData[PxVehicleDriveGraphChannel::eCLUTCH_SLIP]=averageWheelSpeed-engineSpeed; +} +PX_FORCE_INLINE void updateGraphDataClutchSlipNW(const PxU32 numWheels4, const PxVehicleWheels4DynData* wheelsDynData, const PxF32* aveWheelSpeedContributions, const PxF32 engineSpeed, const PxF32 G, + PxF32* carEngineGraphData) +{ + PxF32 averageWheelSpeed=0; + for(PxU32 i=0;i autoBoxLatencyTime) + { + //Work out if the autobox wants to switch up or down. + const PxF32 normalisedEngineOmega=vehDynData.getEngineRotationSpeed()*vehCoreSimData.getEngineData().getRecipMaxOmega(); + const PxVehicleAutoBoxData& autoBoxData=vehCoreSimData.getAutoBoxData(); + + bool gearUp=false; + if(normalisedEngineOmega > autoBoxData.mUpRatios[currentGear] && PxVehicleGearsData::eREVERSE!=currentGear) + { + //If revs too high and not in reverse and not undergoing a gear change then switch up. + gearUp=true; + } + + bool gearDown=false; + if(normalisedEngineOmega < autoBoxData.mDownRatios[currentGear] && currentGear > PxVehicleGearsData::eFIRST) + { + //If revs too low and in gear greater than first and not undergoing a gear change then change down. + gearDown=true; + } + + //Start the gear change and reset the time since the last autobox gear change. + if(gearUp || gearDown) + { + vehDynData.setGearUp(gearUp); + vehDynData.setGearDown(gearDown); + vehDynData.setAutoBoxSwitchTime(0.f); + } + } + else + { + autoBoxSwitchTime+=timestep; + vehDynData.setAutoBoxSwitchTime(autoBoxSwitchTime); + } + + return autoboxCompensatedAnalogAccel; +} + + +//////////////////////////////////////////////////////////////////////////// +//Process gear changes. +//If target gear not equal to current gear then a gear change needs to start. +//The gear change process begins by switching immediately in neutral and +//staying there for a specified time. The process ends by setting current +//gear equal to target gear when the gear switch time has passed. +//This can be bypassed by always forcing target gear = current gear and then +//externally managing gear changes prior to calling PxVehicleUpdates. +//////////////////////////////////////////////////////////////////////////// + +void processGears(const PxF32 timestep, const PxVehicleGearsData& gears, PxVehicleDriveDynData& car) +{ + //const PxVehicleGearsData& gears=car.mVehicleSimData.getGearsData(); + + //Process the gears. + if(car.getGearUp() && gears.mNbRatios-1!=car.getCurrentGear() && car.getCurrentGear()==car.getTargetGear()) + { + //Car wants to go up a gear and can go up a gear and not already undergoing a gear change. + if(PxVehicleGearsData::eREVERSE==car.getCurrentGear()) + { + //In reverse so switch to first through neutral. + car.setGearSwitchTime(0); + car.setTargetGear(PxVehicleGearsData::eFIRST); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + else if(PxVehicleGearsData::eNEUTRAL==car.getCurrentGear()) + { + //In neutral so switch to first and stay in neutral. + car.setGearSwitchTime(0); + car.setTargetGear(PxVehicleGearsData::eFIRST); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + else + { + //Switch up a gear through neutral. + car.setGearSwitchTime(0); + car.setTargetGear(car.getCurrentGear() + 1); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + } + if(car.getGearDown() && PxVehicleGearsData::eREVERSE!=car.getCurrentGear() && car.getCurrentGear()==car.getTargetGear()) + { + //Car wants to go down a gear and can go down a gear and not already undergoing a gear change + if(PxVehicleGearsData::eFIRST==car.getCurrentGear()) + { + //In first so switch to reverse through neutral. + car.setGearSwitchTime(0); + car.setTargetGear(PxVehicleGearsData::eREVERSE); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + else if(PxVehicleGearsData::eNEUTRAL==car.getCurrentGear()) + { + //In neutral so switch to reverse and stay in neutral. + car.setGearSwitchTime(0); + car.setTargetGear(PxVehicleGearsData::eREVERSE); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + else + { + //Switch down a gear through neutral. + car.setGearSwitchTime(0); + car.setTargetGear(car.getCurrentGear() - 1); + car.setCurrentGear(PxVehicleGearsData::eNEUTRAL); + } + } + if(car.getCurrentGear()!=car.getTargetGear()) + { + if(car.getGearSwitchTime()>gears.mSwitchTime) + { + car.setCurrentGear(car.getTargetGear()); + car.setGearSwitchTime(0); + car.setGearDown(false); + car.setGearUp(false); + } + else + { + car.setGearSwitchTime(car.getGearSwitchTime() + timestep); + } + } +} + +//////////////////////////////////////////////////////////////////////////// +//Helper functions to compute +//1. the gear ratio from the current gear. +//2. the drive torque from the state of the accelerator pedal and torque curve of available torque against engine speed. +//3. engine damping rate (a blend between a rate when not accelerating and a rate when fully accelerating). +//4. clutch strength (rate at which clutch will regulate difference between engine and averaged wheel speed). +//////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE PxF32 computeGearRatio(const PxVehicleGearsData& gearsData, const PxU32 currentGear) +{ + const PxF32 gearRatio=gearsData.mRatios[currentGear]*gearsData.mFinalRatio; + return gearRatio; +} + +PX_FORCE_INLINE PxF32 computeEngineDriveTorque(const PxVehicleEngineData& engineData, const PxF32 omega, const PxF32 accel) +{ + const PxF32 engineDriveTorque=accel*engineData.mPeakTorque*engineData.mTorqueCurve.getYVal(omega*engineData.getRecipMaxOmega()); + return engineDriveTorque; +} + +PX_FORCE_INLINE PxF32 computeEngineDampingRate(const PxVehicleEngineData& engineData, const PxU32 gear, const PxF32 accel) +{ + const PxF32 fullThrottleDamping = engineData.mDampingRateFullThrottle; + const PxF32 zeroThrottleDamping = (PxVehicleGearsData::eNEUTRAL!=gear) ? engineData.mDampingRateZeroThrottleClutchEngaged : engineData.mDampingRateZeroThrottleClutchDisengaged; + const PxF32 engineDamping = zeroThrottleDamping + (fullThrottleDamping-zeroThrottleDamping)*accel; + return engineDamping; +} + +PX_FORCE_INLINE PxF32 computeClutchStrength(const PxVehicleClutchData& clutchData, const PxU32 currentGear) +{ + return ((PxVehicleGearsData::eNEUTRAL!=currentGear) ? clutchData.mStrength : 0.0f); +} + + +//////////////////////////////////////////////////////////////////////////// +//Limited slip differential. +//Split the available drive torque as a fraction of the total between up to 4 driven wheels. +//Compute the fraction that each wheel contributes to the averages wheel speed at the clutch. +//////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE void splitTorque +(const PxF32 w1, const PxF32 w2, const PxF32 diffBias, const PxF32 defaultSplitRatio, + PxF32* t1, PxF32* t2) +{ + PX_ASSERT(computeSign(w1)==computeSign(w2) && 0.0f!=computeSign(w1)); + const PxF32 w1Abs=PxAbs(w1); + const PxF32 w2Abs=PxAbs(w2); + const PxF32 omegaMax=PxMax(w1Abs,w2Abs); + const PxF32 omegaMin=PxMin(w1Abs,w2Abs); + const PxF32 delta=omegaMax-diffBias*omegaMin; + const PxF32 deltaTorque=physx::intrinsics::fsel(delta, delta/omegaMax , 0.0f); + const PxF32 f1=physx::intrinsics::fsel(w1Abs-w2Abs, defaultSplitRatio*(1.0f-deltaTorque), defaultSplitRatio*(1.0f+deltaTorque)); + const PxF32 f2=physx::intrinsics::fsel(w1Abs-w2Abs, (1.0f-defaultSplitRatio)*(1.0f+deltaTorque), (1.0f-defaultSplitRatio)*(1.0f-deltaTorque)); + const PxF32 denom=1.0f/(f1+f2); + *t1=f1*denom; + *t2=f2*denom; + PX_ASSERT((*t1 + *t2) >=0.999f && (*t1 + *t2) <=1.001f); +} + +PX_FORCE_INLINE void computeDiffTorqueRatios +(const PxVehicleDifferential4WData& diffData, const PxF32 handbrake, const PxF32* PX_RESTRICT wheelOmegas, PxF32* PX_RESTRICT diffTorqueRatios) +{ + //If the handbrake is on only deliver torque to the front wheels. + PxU32 type=diffData.mType; + if(handbrake>0) + { + switch(diffData.mType) + { + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD: + type=PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_4WD: + type=PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_REARWD: + case PxVehicleDifferential4WData::eMAX_NB_DIFF_TYPES: + break; + } + } + + const PxF32 wfl=wheelOmegas[PxVehicleDrive4WWheelOrder::eFRONT_LEFT]; + const PxF32 wfr=wheelOmegas[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT]; + const PxF32 wrl=wheelOmegas[PxVehicleDrive4WWheelOrder::eREAR_LEFT]; + const PxF32 wrr=wheelOmegas[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]; + + const PxF32 centreBias=diffData.mCentreBias; + const PxF32 frontBias=diffData.mFrontBias; + const PxF32 rearBias=diffData.mRearBias; + + const PxF32 frontRearSplit=diffData.mFrontRearSplit; + const PxF32 frontLeftRightSplit=diffData.mFrontLeftRightSplit; + const PxF32 rearLeftRightSplit=diffData.mRearLeftRightSplit; + + const PxF32 oneMinusFrontRearSplit=1.0f-diffData.mFrontRearSplit; + const PxF32 oneMinusFrontLeftRightSplit=1.0f-diffData.mFrontLeftRightSplit; + const PxF32 oneMinusRearLeftRightSplit=1.0f-diffData.mRearLeftRightSplit; + + const PxF32 swfl=computeSign(wfl); + + //Split a torque of 1 between front and rear. + //Then split that torque between left and right. + PxF32 torqueFrontLeft=0; + PxF32 torqueFrontRight=0; + PxF32 torqueRearLeft=0; + PxF32 torqueRearRight=0; + switch(type) + { + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD: + if(0.0f!=swfl && swfl==computeSign(wfr) && swfl==computeSign(wrl) && swfl==computeSign(wrr)) + { + PxF32 torqueFront,torqueRear; + const PxF32 omegaFront=PxAbs(wfl+wfr); + const PxF32 omegaRear=PxAbs(wrl+wrr); + splitTorque(omegaFront,omegaRear,centreBias,frontRearSplit,&torqueFront,&torqueRear); + splitTorque(wfl,wfr,frontBias,frontLeftRightSplit,&torqueFrontLeft,&torqueFrontRight); + splitTorque(wrl,wrr,rearBias,rearLeftRightSplit,&torqueRearLeft,&torqueRearRight); + torqueFrontLeft*=torqueFront; + torqueFrontRight*=torqueFront; + torqueRearLeft*=torqueRear; + torqueRearRight*=torqueRear; + } + else + { + //TODO: need to handle this case. + torqueFrontLeft=frontRearSplit*frontLeftRightSplit; + torqueFrontRight=frontRearSplit*oneMinusFrontLeftRightSplit; + torqueRearLeft=oneMinusFrontRearSplit*rearLeftRightSplit; + torqueRearRight=oneMinusFrontRearSplit*oneMinusRearLeftRightSplit; + } + break; + + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD: + if(0.0f!=swfl && swfl==computeSign(wfr)) + { + splitTorque(wfl,wfr,frontBias,frontLeftRightSplit,&torqueFrontLeft,&torqueFrontRight); + } + else + { + torqueFrontLeft=frontLeftRightSplit; + torqueFrontRight=oneMinusFrontLeftRightSplit; + } + break; + + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD: + + if(0.0f!=computeSign(wrl) && computeSign(wrl)==computeSign(wrr)) + { + splitTorque(wrl,wrr,rearBias,rearLeftRightSplit,&torqueRearLeft,&torqueRearRight); + } + else + { + torqueRearLeft=rearLeftRightSplit; + torqueRearRight=oneMinusRearLeftRightSplit; + } + break; + + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_4WD: + torqueFrontLeft=frontRearSplit*frontLeftRightSplit; + torqueFrontRight=frontRearSplit*oneMinusFrontLeftRightSplit; + torqueRearLeft=oneMinusFrontRearSplit*rearLeftRightSplit; + torqueRearRight=oneMinusFrontRearSplit*oneMinusRearLeftRightSplit; + break; + + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD: + torqueFrontLeft=frontLeftRightSplit; + torqueFrontRight=oneMinusFrontLeftRightSplit; + break; + + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_REARWD: + torqueRearLeft=rearLeftRightSplit; + torqueRearRight=oneMinusRearLeftRightSplit; + break; + + default: + PX_ASSERT(false); + break; + } + + diffTorqueRatios[PxVehicleDrive4WWheelOrder::eFRONT_LEFT]=torqueFrontLeft; + diffTorqueRatios[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT]=torqueFrontRight; + diffTorqueRatios[PxVehicleDrive4WWheelOrder::eREAR_LEFT]=torqueRearLeft; + diffTorqueRatios[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]=torqueRearRight; + + PX_ASSERT(((torqueFrontLeft+torqueFrontRight+torqueRearLeft+torqueRearRight) >= 0.999f) && ((torqueFrontLeft+torqueFrontRight+torqueRearLeft+torqueRearRight) <= 1.001f)); +} + +PX_FORCE_INLINE void computeDiffAveWheelSpeedContributions +(const PxVehicleDifferential4WData& diffData, const PxF32 handbrake, PxF32* PX_RESTRICT diffAveWheelSpeedContributions) +{ + PxU32 type=diffData.mType; + + //If the handbrake is on only deliver torque to the front wheels. + if(handbrake>0) + { + switch(diffData.mType) + { + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD: + type=PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_4WD: + type=PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_REARWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD: + case PxVehicleDifferential4WData::eMAX_NB_DIFF_TYPES: + break; + } + } + + const PxF32 frontRearSplit=diffData.mFrontRearSplit; + const PxF32 frontLeftRightSplit=diffData.mFrontLeftRightSplit; + const PxF32 rearLeftRightSplit=diffData.mRearLeftRightSplit; + + const PxF32 oneMinusFrontRearSplit=1.0f-diffData.mFrontRearSplit; + const PxF32 oneMinusFrontLeftRightSplit=1.0f-diffData.mFrontLeftRightSplit; + const PxF32 oneMinusRearLeftRightSplit=1.0f-diffData.mRearLeftRightSplit; + + switch(type) + { + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_4WD: + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_LEFT]=frontRearSplit*frontLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT]=frontRearSplit*oneMinusFrontLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_LEFT]=oneMinusFrontRearSplit*rearLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]=oneMinusFrontRearSplit*oneMinusRearLeftRightSplit; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD: + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_LEFT]=frontLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT]=oneMinusFrontLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_LEFT]=0.0f; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]=0.0f; + break; + case PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD: + case PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_REARWD: + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_LEFT]=0.0f; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT]=0.0f; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_LEFT]=rearLeftRightSplit; + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]=oneMinusRearLeftRightSplit; + break; + default: + PX_ASSERT(false); + break; + } + + PX_ASSERT((diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_LEFT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_LEFT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]) >= 0.999f && + (diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_LEFT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eFRONT_RIGHT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_LEFT] + + diffAveWheelSpeedContributions[PxVehicleDrive4WWheelOrder::eREAR_RIGHT]) <= 1.001f); +} + + +/////////////////////////////////////////////////////// +//Tank differential +/////////////////////////////////////////////////////// + +void computeTankDiff +(const PxF32 thrustLeft, const PxF32 thrustRight, + const PxU32 numActiveWheels, const bool* activeWheelStates, + PxF32* aveWheelSpeedContributions, PxF32* diffTorqueRatios, PxF32* wheelGearings) +{ + const PxF32 thrustLeftAbs=PxAbs(thrustLeft); + const PxF32 thrustRightAbs=PxAbs(thrustRight); + + //Work out now many left wheels are enabled. + PxF32 numLeftWheels=0.0f; + for(PxU32 i=0;i 0 ? 1.0f/numLeftWheels : 0.0f; + + //Work out now many right wheels are enabled. + PxF32 numRightWheels=0.0f; + for(PxU32 i=1;i 0 ? 1.0f/numRightWheels : 0.0f; + + //Split the diff torque between left and right. + PxF32 diffTorqueRatioLeft=0.5f; + PxF32 diffTorqueRatioRight=0.5f; + if((thrustLeftAbs + thrustRightAbs) > 1e-3f) + { + const PxF32 thrustDiff = 0.5f*(thrustLeftAbs - thrustRightAbs)/(thrustLeftAbs + thrustRightAbs); + diffTorqueRatioLeft += thrustDiff; + diffTorqueRatioRight -= thrustDiff; + + } + diffTorqueRatioLeft *= invNumEnabledWheelsLeft; + diffTorqueRatioRight *= invNumEnabledWheelsRight; + + //Compute the per wheel gearing. + PxF32 wheelGearingLeft=1.0f; + PxF32 wheelGearingRight=1.0f; + if((thrustLeftAbs + thrustRightAbs) > 1e-3f) + { + wheelGearingLeft=computeSign(thrustLeft); + wheelGearingRight=computeSign(thrustRight); + } + + //Compute the contribution of each wheel to the average speed at the clutch. + const PxF32 aveWheelSpeedContributionLeft = 0.5f*invNumEnabledWheelsLeft; + const PxF32 aveWheelSpeedContributionRight = 0.5f*invNumEnabledWheelsRight; + + //Set all the left wheels. + for(PxU32 i=0;i=-1.01f && steer<=1.01f); + PX_ASSERT(steerGain> 5); + + if(bm.test(startId + 0)) + { + activeStates[0]=true; + } + if(bm.test(startId + 1)) + { + activeStates[1]=true; + } + if(bm.test(startId + 2)) + { + activeStates[2]=true; + } + if(bm.test(startId + 3)) + { + activeStates[3]=true; + } +} + + +//////////////////////////////////////////////////////////////////////////// +//Compute the brake and handbrake torques for different vehicle types. +//Also compute a boolean for each tire to know if the brake is applied or not. +//Can't use a single function for all types because not all vehicle types have +//handbrakes and the brake control mechanism is different for different vehicle +//types. +//////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE void computeNoDriveBrakeTorques +(const PxVehicleWheelData* PX_RESTRICT wheelDatas, const PxF32* PX_RESTRICT wheelOmegas, const PxF32* PX_RESTRICT rawBrakeTroques, + PxF32* PX_RESTRICT brakeTorques, bool* PX_RESTRICT isBrakeApplied) +{ + PX_UNUSED(wheelDatas); + + const PxF32 sign0=computeSign(wheelOmegas[0]); + brakeTorques[0]=(-sign0*rawBrakeTroques[0]); + isBrakeApplied[0]=(rawBrakeTroques[0]!=0); + + const PxF32 sign1=computeSign(wheelOmegas[1]); + brakeTorques[1]=(-sign1*rawBrakeTroques[1]); + isBrakeApplied[1]=(rawBrakeTroques[1]!=0); + + const PxF32 sign2=computeSign(wheelOmegas[2]); + brakeTorques[2]=(-sign2*rawBrakeTroques[2]); + isBrakeApplied[2]=(rawBrakeTroques[2]!=0); + + const PxF32 sign3=computeSign(wheelOmegas[3]); + brakeTorques[3]=(-sign3*rawBrakeTroques[3]); + isBrakeApplied[3]=(rawBrakeTroques[3]!=0); +} + +PX_FORCE_INLINE void computeBrakeAndHandBrakeTorques +(const PxVehicleWheelData* PX_RESTRICT wheelDatas, const PxF32* PX_RESTRICT wheelOmegas, const PxF32 brake, const PxF32 handbrake, + PxF32* PX_RESTRICT brakeTorques, bool* isBrakeApplied) +{ + //At zero speed offer no brake torque allowed. + + const PxF32 sign0=computeSign(wheelOmegas[0]); + brakeTorques[0]=(-brake*sign0*wheelDatas[0].mMaxBrakeTorque-handbrake*sign0*wheelDatas[0].mMaxHandBrakeTorque); + isBrakeApplied[0]=((brake*wheelDatas[0].mMaxBrakeTorque+handbrake*wheelDatas[0].mMaxHandBrakeTorque)!=0); + + const PxF32 sign1=computeSign(wheelOmegas[1]); + brakeTorques[1]=(-brake*sign1*wheelDatas[1].mMaxBrakeTorque-handbrake*sign1*wheelDatas[1].mMaxHandBrakeTorque); + isBrakeApplied[1]=((brake*wheelDatas[1].mMaxBrakeTorque+handbrake*wheelDatas[1].mMaxHandBrakeTorque)!=0); + + const PxF32 sign2=computeSign(wheelOmegas[2]); + brakeTorques[2]=(-brake*sign2*wheelDatas[2].mMaxBrakeTorque-handbrake*sign2*wheelDatas[2].mMaxHandBrakeTorque); + isBrakeApplied[2]=((brake*wheelDatas[2].mMaxBrakeTorque+handbrake*wheelDatas[2].mMaxHandBrakeTorque)!=0); + + const PxF32 sign3=computeSign(wheelOmegas[3]); + brakeTorques[3]=(-brake*sign3*wheelDatas[3].mMaxBrakeTorque-handbrake*sign3*wheelDatas[3].mMaxHandBrakeTorque); + isBrakeApplied[3]=((brake*wheelDatas[3].mMaxBrakeTorque+handbrake*wheelDatas[3].mMaxHandBrakeTorque)!=0); +} + +PX_FORCE_INLINE void computeTankBrakeTorques +(const PxVehicleWheelData* PX_RESTRICT wheelDatas, const PxF32* PX_RESTRICT wheelOmegas, const PxF32 brakeLeft, const PxF32 brakeRight, + PxF32* PX_RESTRICT brakeTorques, bool* isBrakeApplied) +{ + //At zero speed offer no brake torque allowed. + + const PxF32 sign0=computeSign(wheelOmegas[0]); + brakeTorques[0]=(-brakeLeft*sign0*wheelDatas[0].mMaxBrakeTorque); + isBrakeApplied[0]=((brakeLeft*wheelDatas[0].mMaxBrakeTorque)!=0); + + const PxF32 sign1=computeSign(wheelOmegas[1]); + brakeTorques[1]=(-brakeRight*sign1*wheelDatas[1].mMaxBrakeTorque); + isBrakeApplied[1]=((brakeRight*wheelDatas[1].mMaxBrakeTorque)!=0); + + const PxF32 sign2=computeSign(wheelOmegas[2]); + brakeTorques[2]=(-brakeLeft*sign2*wheelDatas[2].mMaxBrakeTorque); + isBrakeApplied[2]=((brakeLeft*wheelDatas[2].mMaxBrakeTorque)!=0); + + const PxF32 sign3=computeSign(wheelOmegas[3]); + brakeTorques[3]=(-brakeRight*sign3*wheelDatas[3].mMaxBrakeTorque); + isBrakeApplied[3]=((brakeRight*wheelDatas[3].mMaxBrakeTorque)!=0); +} + + +//////////////////////////////////////////////////////////////////////////// +//Functions to compute inputs to tire force calculation. +//1. Filter the normalised tire load to smooth any spikes in load. +//2. Compute the tire lat and long directions in the ground plane. +//3. Compute the tire lat and long slips. +//4. Compute the friction from a graph of friction vs slip. +//////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE PxF32 computeFilteredNormalisedTireLoad(const PxVehicleTireLoadFilterData& filterData, const PxF32 normalisedLoad) +{ + if(normalisedLoad <= filterData.mMinNormalisedLoad) + { + return filterData.mMinFilteredNormalisedLoad; + } + else if(normalisedLoad >= filterData.mMaxNormalisedLoad) + { + return filterData.mMaxFilteredNormalisedLoad; + } + else + { + const PxF32 x=normalisedLoad; + const PxF32 xmin=filterData.mMinNormalisedLoad; + const PxF32 ymin=filterData.mMinFilteredNormalisedLoad; + const PxF32 ymax=filterData.mMaxFilteredNormalisedLoad; + const PxF32 recipXmaxMinusXMin=filterData.getDenominator(); + return (ymin + (x-xmin)*(ymax-ymin)*recipXmaxMinusXMin); + } +} + +PX_FORCE_INLINE void computeTireDirs(const PxVec3& chassisLatDir, const PxVec3& hitNorm, const PxF32 wheelSteerAngle, PxVec3& tireLongDir, PxVec3& tireLatDir) +{ + PX_ASSERT(chassisLatDir.magnitude()>0.999f && chassisLatDir.magnitude()<1.001f); + PX_ASSERT(hitNorm.magnitude()>0.999f && hitNorm.magnitude()<1.001f); + + //Compute the tire axes in the ground plane. + PxVec3 tzRaw=chassisLatDir.cross(hitNorm); + PxVec3 txRaw=hitNorm.cross(tzRaw); + tzRaw.normalize(); + txRaw.normalize(); + //Rotate the tire using the steer angle. + const PxF32 cosWheelSteer=PxCos(wheelSteerAngle); + const PxF32 sinWheelSteer=PxSin(wheelSteerAngle); + const PxVec3 tz=tzRaw*cosWheelSteer + txRaw*sinWheelSteer; + const PxVec3 tx=txRaw*cosWheelSteer - tzRaw*sinWheelSteer; + tireLongDir=tz; + tireLatDir=tx; +} + +PX_FORCE_INLINE void computeTireSlips +(const PxF32 longSpeed, const PxF32 latSpeed, const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 maxDenominator, + const bool isAccelApplied, const bool isBrakeApplied, + const bool isTank, + PxF32& longSlip, PxF32& latSlip) +{ + PX_ASSERT(maxDenominator>=0.0f); + + const PxF32 longSpeedAbs=PxAbs(longSpeed); + const PxF32 wheelSpeed=wheelOmega*wheelRadius; + const PxF32 wheelSpeedAbs=PxAbs(wheelSpeed); + + //Lateral slip is easy. + latSlip = PxAtan(latSpeed/(longSpeedAbs+gMinLatSpeedForTireModel));//TODO: do we really use PxAbs(vz) as denominator? + + //If nothing is moving just avoid a divide by zero and set the long slip to zero. + if(longSpeed==0 && wheelOmega==0) + { + longSlip=0.0f; + return; + } + + //Longitudinal slip is a bit harder because we can end up wtih zero on the denominator. + if(isTank) + { + if(isBrakeApplied || isAccelApplied) + { + //Wheel experiencing an applied torque. + //Use the raw denominator value plus an offset to avoid anything approaching a divide by zero. + //When accelerating from rest the small denominator will generate really quite large + //slip values, which will, in turn, generate large longitudinal forces. With large + //time-steps this might lead to a temporary oscillation in longSlip direction and an + //oscillation in wheel speed direction. The amplitude of the oscillation should be low + //unless the timestep is really large. + //There's not really an obvious solution to this without setting the denominator offset higher + //(or decreasing the timestep). Setting the denominator higher affects handling everywhere so + //settling for a potential temporary oscillation is probably the least worst compromise. + //Note that we always use longSpeedAbs as denominator because in order to turn on the spot the + //tank needs to get strong longitudinal force when it isn't moving but the wheels are slipping. + longSlip = (wheelSpeed - longSpeed)/(longSpeedAbs + 0.1f*gToleranceScaleLength); + } + else + { + //Wheel not experiencing an applied torque. + //If the denominator becomes too small then the longSlip becomes large and the longitudinal force + //can overshoot zero at large timesteps. This can be really noticeable so it's harder to justify + //not taking action. Further, the car isn't being actually driven so there is a strong case to fiddle + //with the denominator because it doesn't really affect active handling. + //Don't let the denominator fall below a user-specified value. This can be tuned upwards until the + //oscillation in the sign of longSlip disappears. + longSlip = (wheelSpeed - longSpeed)/(PxMax(maxDenominator, PxMax(longSpeedAbs,wheelSpeedAbs))); + } + } + else + { + if(isBrakeApplied || isAccelApplied) + { + //Wheel experiencing an applied torque. + //Use the raw denominator value plus an offset to avoid anything approaching a divide by zero. + //When accelerating from rest the small denominator will generate really quite large + //slip values, which will, in turn, generate large longitudinal forces. With large + //time-steps this might lead to a temporary oscillation in longSlip direction and an + //oscillation in wheel speed direction. The amplitude of the oscillation should be low + //unless the timestep is really large. + //There's not really an obvious solution to this without setting the denominator offset higher + //(or decreasing the timestep). Setting the denominator higher affects handling everywhere so + //settling for a potential temporary oscillation is probably the least worst compromise. + longSlip = (wheelSpeed - longSpeed)/(PxMax(longSpeedAbs,wheelSpeedAbs)+0.1f*gToleranceScaleLength); + } + else + { + //Wheel not experiencing an applied torque. + //If the denominator becomes too small then the longSlip becomes large and the longitudinal force + //can overshoot zero at large timesteps. This can be really noticeable so it's harder to justify + //not taking action. Further, the car isn't being actually driven so there is a strong case to fiddle + //with the denominator because it doesn't really affect active handling. + //Don't let the denominator fall below a user-specified value. This can be tuned upwards until the + //oscillation in the sign of longSlip disappears. + longSlip = (wheelSpeed - longSpeed)/(PxMax(maxDenominator,PxMax(longSpeedAbs,wheelSpeedAbs))); + } + } +} + +PX_FORCE_INLINE void computeTireFriction(const PxVehicleTireData& tireData, const PxF32 longSlip, const PxF32 frictionMultiplier, PxF32& friction) +{ + const PxF32 x0=tireData.mFrictionVsSlipGraph[0][0]; + const PxF32 y0=tireData.mFrictionVsSlipGraph[0][1]; + const PxF32 x1=tireData.mFrictionVsSlipGraph[1][0]; + const PxF32 y1=tireData.mFrictionVsSlipGraph[1][1]; + const PxF32 x2=tireData.mFrictionVsSlipGraph[2][0]; + const PxF32 y2=tireData.mFrictionVsSlipGraph[2][1]; + const PxF32 recipx1Minusx0=tireData.getFrictionVsSlipGraphRecipx1Minusx0(); + const PxF32 recipx2Minusx1=tireData.getFrictionVsSlipGraphRecipx2Minusx1(); + const PxF32 longSlipAbs=PxAbs(longSlip); + PxF32 mu; + if(longSlipAbs=0); + friction=mu*frictionMultiplier; +} + +//////////////////////////////////////////////////////////////////////////// +//Sticky tire constraints. +//Increment a timer each update that a tire has a very low longitudinal speed. +//Activate a sticky constraint when the tire has had an unbroken low long speed +//for at least a threshold time. +//The longer the sticky constraint is active, the slower the target constraint speed +//along the long dir. Quickly tends towards zero. +//When the sticky constraint is activated set the long slip to zero and let +//the sticky constraint take over. +//////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE void updateLowForwardSpeedTimer +(const PxF32 longSpeed, const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, const bool isIntentionToAccelerate, + const PxF32 timestep, PxF32& lowForwardSpeedTime) +{ + PX_UNUSED(wheelRadius); + PX_UNUSED(recipWheelRadius); + + //If the tire is rotating slowly and the forward speed is slow then increment the slow forward speed timer. + //If the intention of the driver is to accelerate the vehicle then reset the timer because the intention has been signalled NOT to bring + //the wheel to rest. + PxF32 longSpeedAbs=PxAbs(longSpeed); + if((longSpeedAbsgLowForwardSpeedThresholdTime) + { + stickyTireActiveFlag=true; + stickyTireTargetSpeed=longSpeed*gStickyTireFrictionForwardDamping; + } +} + +PX_FORCE_INLINE void activateStickyFrictionSideConstraint +(const PxF32 latSpeed, const PxF32 lowSpeedForwardTimer, const PxF32 lowSideSpeedTimer, const bool isIntentionToAccelerate, + bool& stickyTireActiveFlag, PxF32& stickyTireTargetSpeed) +{ + PX_UNUSED(latSpeed); + PX_UNUSED(isIntentionToAccelerate); + + //Setup the sticky friction constraint to bring the vehicle to rest at the tire contact point. + //Only do this if we can guarantee that the intention is to bring the car to rest (no accel pedal applied). + //Smoothly reduce error to zero to avoid bringing car immediately to rest. This avoids graphical glitchiness. + //We're going to replace the lateral tire force with the sticky friction so set the lat slip to zero to ensure zero lat force. + //Apply sticky friction to this tire if + //(1) the low forward speed timer is > 0. + //(2) the accumulated time of low forward speed is greater than a threshold. + stickyTireActiveFlag=false; + stickyTireTargetSpeed=0.0f; + if((lowSpeedForwardTimer > 0) && lowSideSpeedTimer>gLowSideSpeedThresholdTime) + { + stickyTireActiveFlag=true; + stickyTireTargetSpeed=latSpeed*gStickyTireFrictionSideDamping; + } +} + + + +//////////////////////////////////////////////////////////////////////////// +//Default tire force shader function. +//Taken from Michigan tire model. +//Computes tire long and lat forces plus the aligning moment arising from +//the lat force and the torque to apply back to the wheel arising from the +//long force (application of Newton's 3rd law). +//////////////////////////////////////////////////////////////////////////// + + +#define ONE_TWENTYSEVENTH 0.037037f +#define ONE_THIRD 0.33333f +PX_FORCE_INLINE PxF32 smoothingFunction1(const PxF32 K) +{ + //Equation 20 in CarSimEd manual Appendix F. + //Looks a bit like a curve of sqrt(x) for 0=0.0f); + return PxMin(1.0f, K - ONE_THIRD*K*K + ONE_TWENTYSEVENTH*K*K*K); +} +PX_FORCE_INLINE PxF32 smoothingFunction2(const PxF32 K) +{ + //Equation 21 in CarSimEd manual Appendix F. + //Rises to a peak at K=0.75 and falls back to zero by K=3 + PX_ASSERT(K>=0.0f); + return (K - K*K + ONE_THIRD*K*K*K - ONE_TWENTYSEVENTH*K*K*K*K); +} + +void PxVehicleComputeTireForceDefault +(const void* tireShaderData, + const PxF32 tireFriction, + const PxF32 longSlipUnClamped, const PxF32 latSlipUnClamped, const PxF32 camberUnclamped, + const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, + const PxF32 restTireLoad, const PxF32 normalisedTireLoad, const PxF32 tireLoad, + const PxF32 gravity, const PxF32 recipGravity, + PxF32& wheelTorque, PxF32& tireLongForceMag, PxF32& tireLatForceMag, PxF32& tireAlignMoment) +{ + PX_UNUSED(wheelOmega); + PX_UNUSED(recipWheelRadius); + + const PxVehicleTireData& tireData=*reinterpret_cast(tireShaderData); + + PX_ASSERT(tireFriction>0); + PX_ASSERT(tireLoad>0); + + wheelTorque=0.0f; + tireLongForceMag=0.0f; + tireLatForceMag=0.0f; + tireAlignMoment=0.0f; + + //Clamp the slips to a minimum value. + const PxF32 latSlip = PxAbs(latSlipUnClamped) >= gMinimumSlipThreshold ? latSlipUnClamped : 0.0f; + const PxF32 longSlip = PxAbs(longSlipUnClamped) >= gMinimumSlipThreshold ? longSlipUnClamped : 0.0f; + const PxF32 camber = PxAbs(camberUnclamped) >= gMinimumSlipThreshold ? camberUnclamped : 0.0f; + + //If long slip/lat slip/camber are all zero than there will be zero tire force. + if((0==latSlip)&&(0==longSlip)&&(0==camber)) + { + return; + } + + //Compute the lateral stiffness + const PxF32 latStiff=restTireLoad*tireData.mLatStiffY*smoothingFunction1(normalisedTireLoad*3.0f/tireData.mLatStiffX); + + //Get the longitudinal stiffness + const PxF32 longStiff=tireData.mLongitudinalStiffnessPerUnitGravity*gravity; + const PxF32 recipLongStiff=tireData.getRecipLongitudinalStiffnessPerUnitGravity()*recipGravity; + + //Get the camber stiffness. + const PxF32 camberStiff=tireData.mCamberStiffnessPerUnitGravity*gravity; + + //Carry on and compute the forces. + const PxF32 TEff = PxTan(latSlip - camber*camberStiff/latStiff); + const PxF32 K = PxSqrt(latStiff*TEff*latStiff*TEff + longStiff*longSlip*longStiff*longSlip) /(tireFriction*tireLoad); + //const PxF32 KAbs=PxAbs(K); + PxF32 FBar = smoothingFunction1(K);//K - ONE_THIRD*PxAbs(K)*K + ONE_TWENTYSEVENTH*K*K*K; + PxF32 MBar = smoothingFunction2(K); //K - KAbs*K + ONE_THIRD*K*K*K - ONE_TWENTYSEVENTH*KAbs*K*K*K; + //Mbar = PxMin(Mbar, 1.0f); + PxF32 nu=1; + if(K <= 2.0f*PxPi) + { + const PxF32 latOverlLong=latStiff*recipLongStiff; + nu = 0.5f*(1.0f + latOverlLong - (1.0f - latOverlLong)*PxCos(K*0.5f)); + } + const PxF32 FZero = tireFriction*tireLoad / (PxSqrt(longSlip*longSlip + nu*TEff*nu*TEff)); + const PxF32 fz = longSlip*FBar*FZero; + const PxF32 fx = -nu*TEff*FBar*FZero; + //TODO: pneumatic trail. + const PxF32 pneumaticTrail=1.0f; + const PxF32 fMy= nu * pneumaticTrail * TEff * MBar * FZero; + + //We can add the torque to the wheel. + wheelTorque=-fz*wheelRadius; + tireLongForceMag=fz; + tireLatForceMag=fx; + tireAlignMoment=fMy; +} + +//////////////////////////////////////////////////////////////////////////// +//Compute the suspension line raycast start point and direction. +//////////////////////////////////////////////////////////////////////////// + +static PX_INLINE void computeSuspensionRaycast +(const PxTransform& carChassisTrnsfm, const PxVec3& bodySpaceWheelCentreOffset, const PxVec3& bodySpaceSuspTravelDir, const PxF32 radius, const PxF32 maxBounce, + PxVec3& suspLineStart, PxVec3& suspLineDir) +{ + //Direction of raycast. + suspLineDir=carChassisTrnsfm.rotate(bodySpaceSuspTravelDir); + + //Position at top of wheel at maximum compression. + suspLineStart=carChassisTrnsfm.transform(bodySpaceWheelCentreOffset); + suspLineStart-=suspLineDir*(radius+maxBounce); +} + +static PX_INLINE void computeSuspensionSweep +(const PxTransform& carChassisTrnsfm, + const PxQuat& wheelLocalPoseRotation, + const PxVec3& bodySpaceWheelCentreOffset, const PxVec3& bodySpaceSuspTravelDir, const PxF32 radius, const PxF32 maxBounce, + PxTransform& suspStartPose, PxVec3& suspLineDir) +{ + //Direction of raycast. + suspLineDir=carChassisTrnsfm.rotate(bodySpaceSuspTravelDir); + + //Position of wheel at maximum compression. + suspStartPose.p = carChassisTrnsfm.transform(bodySpaceWheelCentreOffset); + suspStartPose.p -= suspLineDir*(radius + maxBounce); + + //Rotation in world frame. + suspStartPose.q = carChassisTrnsfm.q*wheelLocalPoseRotation; +} + +//////////////////////////////////////////////////////////////////////////// +//Functions required to intersect the wheel with the hit plane +//We support raycasts and sweeps. +//////////////////////////////////////////////////////////////////////////// + +static bool intersectRayPlane +(const PxTransform& carChassisTrnsfm, + const PxVec3& bodySpaceWheelCentreOffset, const PxVec3& bodySpaceSuspTravelDir, + const PxF32 width, const PxF32 radius, const PxF32 maxCompression, + const PxPlane& hitPlane, + PxF32& jounce, PxVec3& wheelBottomPos) +{ + PX_UNUSED(width); + + //Compute the raycast start pos and direction. + PxVec3 v, w; + computeSuspensionRaycast(carChassisTrnsfm, bodySpaceWheelCentreOffset, bodySpaceSuspTravelDir, radius, maxCompression, v, w); + + //If the raycast starts inside the hit plane then return false + if((hitPlane.n.dot(v) + hitPlane.d) < 0.0f) + { + return false; + } + + //Store a point through the centre of the wheel. + //We'll use this later to compute a position at the bottom of the wheel. + const PxVec3 pos = v; + + //Remove this code because we handle tire width with sweeps now. + //Work out if the inner or outer disc is deeper in the plane. + //const PxVec3 latDir = carChassisTrnsfm.rotate(gRight); + //const PxF32 signDot = computeSign(hitNorm.dot(latDir)); + //v -= latDir*(signDot*0.5f*width); + + //Work out the point on the susp line that touches the intersection plane. + //n.(v+wt)+d=0 where n,d describe the plane; v,w describe the susp ray; t is the point on the susp line. + //t=-(n.v + d)/n.w + const PxF32 hitD = hitPlane.d; + + const PxVec3 n = hitPlane.n; + const PxF32 d = hitD; + const PxF32 T=-(n.dot(v) + d)/(n.dot(w)); + + //The rest pos of the susp line is 2*radius + maxBounce. + const PxF32 restT = 2.0f*radius+maxCompression; + + //Compute the spring compression ie the difference between T and restT. + //+ve means that the spring is compressed + //-ve means that the spring is elongated. + jounce = restT-T; + + //Compute the bottom of the wheel. + //Always choose a point through the centre of the wheel. + wheelBottomPos = pos + w*(restT - jounce); + + return true; +} + +static bool intersectPlanes(const PxPlane& a, const PxPlane& b, PxVec3& v, PxVec3& w) +{ + const PxF32 n1x = a.n.x; + const PxF32 n1y = a.n.y; + const PxF32 n1z = a.n.z; + const PxF32 n1d = a.d; + + const PxF32 n2x = b.n.x; + const PxF32 n2y = b.n.y; + const PxF32 n2z = b.n.z; + const PxF32 n2d = b.d; + + PxF32 dx = (n1y * n2z) - (n1z * n2y); + PxF32 dy = (n1z * n2x) - (n1x * n2z); + PxF32 dz = (n1x * n2y) - (n1y * n2x); + + const PxF32 dx2 = dx * dx; + const PxF32 dy2 = dy * dy; + const PxF32 dz2 = dz * dz; + + PxF32 px, py, pz; + bool success = true; + if ((dz2 > dy2) && (dz2 > dx2) && (dz2 > 0)) + { + px = ((n1y * n2d) - (n2y * n1d)) / dz; + py = ((n2x * n1d) - (n1x * n2d)) / dz; + pz = 0; + } + else if ((dy2 > dx2) && (dy2 > 0)) + { + px = -((n1z * n2d) - (n2z * n1d)) / dy; + py = 0; + pz = -((n2x * n1d) - (n1x * n2d)) / dy; + } + else if (dx2 > 0) + { + px = 0; + py = ((n1z * n2d) - (n2z * n1d)) / dx; + pz = ((n2y * n1d) - (n1y * n2d)) / dx; + } + else + { + px=0; + py=0; + pz=0; + success=false; + } + + const PxF32 ld = PxSqrt(dx2 + dy2 + dz2); + + dx /= ld; + dy /= ld; + dz /= ld; + + w = PxVec3(dx,dy,dz); + v = PxVec3(px,py,pz); + + return success; +} + +static bool intersectCylinderPlane +(const PxTransform& wheelPoseAtZeroJounce, const PxVec3 suspDir, + const PxF32 width, const PxF32 radius, const PxF32 maxCompression, + const PxPlane& hitPlane, + const PxVec3& sideAxis, + const bool rejectFromThresholds, + const PxF32 pointRejectAngleThresholdCosine, + const PxF32 normalRejectAngleThresholdCosine, + PxF32& jounce, PxVec3& wheelBottomPos, + const PxVec3& contactPt, float hitDist, bool useDirectSweepResults) +{ + //Reject based on the contact normal. + if(rejectFromThresholds) + { + if(suspDir.dot(-hitPlane.n) < normalRejectAngleThresholdCosine) + return false; + } + + //Construct the wheel plane that contains the wheel disc. + const PxPlane wheelPlane(wheelPoseAtZeroJounce.p, wheelPoseAtZeroJounce.rotate(sideAxis)); + + if(useDirectSweepResults) + { + // PT: this codepath fixes PX-2184 / PX-2170 / PX-2297 + // We start from the results we want to obtain, i.e. the data provided by the sweeps: + jounce = maxCompression + radius - hitDist; + wheelBottomPos = wheelPlane.project(contactPt); + + // PT: and then we re-derive other variables from them, to do the culling. + // This is only needed for touching hits. + if(rejectFromThresholds) + { + // Derive t & pos from above data + const PxF32 t = -jounce; // From "jounce = -t;" in original codepath + const PxVec3 pos = wheelBottomPos - suspDir*t; // From "wheelBottomPos = pos + suspDir*t;" in original codepath + + //If the sweep started inside the hit plane then return false + const PxVec3 startPos = pos - suspDir*(radius + maxCompression); + if(hitPlane.n.dot(startPos) + hitPlane.d < 0.0f) + return false; + + // PT: derive dir from "const PxVec3 pos = wheelPoseAtZeroJounce.p + dir*radius;" in original codepath. + // We need a normalized dir though so we skip the division by radius. + PxVec3 dir = (pos - wheelPoseAtZeroJounce.p); + dir.normalize(); + + //Now work out if we accept the hit. + //Compare dir with the suspension direction. + if(suspDir.dot(dir) < pointRejectAngleThresholdCosine) + return false; + } + } + else + { + //Intersect the plane of the wheel with the hit plane. + //This generates an intersection edge. + PxVec3 intersectionEdgeV, intersectionEdgeW; + const bool intersectPlaneSuccess = intersectPlanes(wheelPlane, hitPlane, intersectionEdgeV, intersectionEdgeW); + if(!intersectPlaneSuccess) + { + jounce = 0.0f; + wheelBottomPos = PxVec3(0,0,0); + return false; + } + + //Compute the position on the intersection edge that is closest to the wheel centre. + PxVec3 closestPointOnIntersectionEdge; + { + const PxVec3& p = wheelPoseAtZeroJounce.p; + const PxVec3& w = intersectionEdgeW; + const PxVec3& v = intersectionEdgeV; + const PxF32 t = (p - v).dot(w); + closestPointOnIntersectionEdge = v + w*t; + } + + //Compute the vector that joins the wheel centre to the intersection edge; + PxVec3 dir; + { + const PxF32 wheelCentreD = hitPlane.n.dot(wheelPoseAtZeroJounce.p) + hitPlane.d; + dir = ((wheelCentreD >= 0) ? closestPointOnIntersectionEdge - wheelPoseAtZeroJounce.p : wheelPoseAtZeroJounce.p - closestPointOnIntersectionEdge); + dir.normalize(); + } + + //Now work out if we accept the hit. + //Compare dir with the suspension direction. + if(rejectFromThresholds) + { + if(suspDir.dot(dir) < pointRejectAngleThresholdCosine) + return false; + } + + //Compute the point on the disc diameter that will be the closest to the hit plane or the deepest inside the hit plane. + const PxVec3 pos = wheelPoseAtZeroJounce.p + dir*radius; + + //If the sweep started inside the hit plane then return false + const PxVec3 startPos = pos - suspDir*(radius + maxCompression); + if(hitPlane.n.dot(startPos) + hitPlane.d < 0.0f) + return false; + + //Now compute the maximum depth of the inside and outside discs against the plane. + PxF32 depth; + { + const PxVec3 latDir = wheelPoseAtZeroJounce.rotate(sideAxis); + const PxF32 signDot = computeSign(hitPlane.n.dot(latDir)); + const PxVec3 deepestPos = pos - latDir*(signDot*0.5f*width); + depth = hitPlane.n.dot(deepestPos) + hitPlane.d; + } + + //How far along the susp dir do we have to move to place the wheel exactly on the plane. + const PxF32 t = -depth/(hitPlane.n.dot(suspDir)); + + //+ve means that the spring is compressed + //-ve means that the spring is elongated. + jounce = -t; + + //Compute a point at the bottom of the wheel that is at the centre. + wheelBottomPos = pos + suspDir*t; + } + return true; +} + +static bool intersectCylinderPlane +(const PxTransform& carChassisTrnsfm, + const PxQuat& wheelLocalPoseRotation, + const PxVec3& bodySpaceWheelCentreOffset, const PxVec3& bodySpaceSuspTravelDir, const PxF32 width, const PxF32 radius, const PxF32 maxCompression, + const PxPlane& hitPlane, + const PxVec3& sideAxis, + const bool rejectFromThresholds, + const PxF32 pointRejectAngleThresholdCosine, + const PxF32 normalRejectAngleThresholdCosine, + PxF32& jounce, PxVec3& wheelBottomPos, + const PxVec3& contactPt, float hitDist, bool useDirectSweepResults) +{ + //Compute the pose of the wheel + PxTransform wheelPostsAtZeroJounce; + PxVec3 suspDir; + computeSuspensionSweep( + carChassisTrnsfm, + wheelLocalPoseRotation, + bodySpaceWheelCentreOffset, bodySpaceSuspTravelDir, 0.0f, 0.0f, + wheelPostsAtZeroJounce, suspDir); + + //Perform the intersection. + return intersectCylinderPlane + (wheelPostsAtZeroJounce, suspDir, + width, radius, maxCompression, + hitPlane, + sideAxis, + rejectFromThresholds, pointRejectAngleThresholdCosine, normalRejectAngleThresholdCosine, + jounce, wheelBottomPos, contactPt, hitDist, useDirectSweepResults); +} + +//////////////////////////////////////////////////////////////////////////// +//Structures used to process blocks of 4 wheels: process the raycast result, +//compute the suspension and tire force, store a number of report variables +//such as tire slip, hit shape, hit material, friction etc. +//////////////////////////////////////////////////////////////////////////// + +class PxVehicleTireForceCalculator4 +{ +public: + + const void* mShaderData[4]; + PxVehicleComputeTireForce mShader; +private: +}; + +//This data structure is passed to processSuspTireWheels +//and represents the data that is logically constant across all sub-steps of each dt update. +struct ProcessSuspWheelTireConstData +{ + //We are integrating dt over N sub-steps. + //timeFraction is 1/N. + PxF32 timeFraction; + //We are integrating dt over N sub-steps. + //subTimeStep is dt/N. + PxF32 subTimeStep; + PxF32 recipSubTimeStep; + + //Gravitational acceleration vector + PxVec3 gravity; + //Length of gravitational acceleration vector (saves a square root each time we need it) + PxF32 gravityMagnitude; + //Reciprocal length of gravitational acceleration vector (saves a square root and divide each time we need it). + PxF32 recipGravityMagnitude; + + //True for tanks, false for all other vehicle types. + //Used when computing the longitudinal and lateral slips. + bool isTank; + + //Minimum denominator allowed in longitudinal slip computation. + PxF32 minLongSlipDenominator; + + //Pointer to physx actor that represents the vehicle. + const PxRigidDynamic* vehActor; + + //Pointer to table of friction values for each combination of material and tire type. + const PxVehicleDrivableSurfaceToTireFrictionPairs* frictionPairs; + + //Flags related to wheel simulation (see PxVehicleWheelsSimFlags) + PxU32 wheelsSimFlags; +}; + +//This data structure is passed to processSuspTireWheels +//and represents the data that is physically constant across each sub-steps of each dt update. +struct ProcessSuspWheelTireInputData +{ +public: + + //True if the driver intends to pass drive torque to any wheel of the vehicle, + //even if none of the wheels in the block of 4 wheels processed in processSuspTireWheels are given drive torque. + //False if the driver does not intend the vehicle to accelerate. + //If the player intends to accelerate then no wheel will be given a sticky tire constraint. + //This data is actually logically constant. + bool isIntentionToAccelerate; + + //True if a wheel has a non-zero diff torque, false if a wheel has zero diff torque. + //This data is actually logically constant. + const bool* isAccelApplied; + + //True if a wheel has a non-zero brake torque, false if a wheel has zero brake torque. + //This data is actually logically constant. + const bool* isBrakeApplied; + + //Steer angles of each wheel in radians. + //This data is actually logically constant. + const PxF32* steerAngles; + + //True if the wheel is not disabled, false if wheel is disabled. + //This data is actually logically constant. + bool* activeWheelStates; + + //Properties of the rigid body - transform. + //This data is actually logically constant. + PxTransform carChassisTrnsfm; + //Properties of the rigid body - linear velocity. + //This data is actually logically constant. + PxVec3 carChassisLinVel; + //Properties of the rigid body - angular velocity + //This data is actually logically constant. + PxVec3 carChassisAngVel; + + //Properties of the wheel shapes at the last sweep. + const PxQuat* wheelLocalPoseRotations; + + //Simulation data for the 4 wheels being processed in processSuspTireWheels + //This data is actually logically constant. + const PxVehicleWheels4SimData* vehWheels4SimData; + + //Dynamics data for the 4 wheels being processed in processSuspTireWheels + //This data is a mixture of logically and physically constant. + //We could update some of the data in vehWheels4DynData in processSuspTireWheels + //but we choose to do it after. By specifying the non-constant data members explicitly + //in ProcessSuspWheelTireOutputData we are able to more easily keep a track of the + //constant and non-constant data members. After processSuspTireWheels is complete + //we explicitly transfer the updated data in ProcessSuspWheelTireOutputData to vehWheels4DynData. + //Examples are low long and lat forward speed timers. + const PxVehicleWheels4DynData* vehWheels4DynData; + + //Shaders to calculate the tire forces. + //This data is actually logically constant. + const PxVehicleTireForceCalculator4* vehWheels4TireForceCalculator; + + //Filter function to filter tire load. + //This data is actually logically constant. + const PxVehicleTireLoadFilterData* vehWheels4TireLoadFilterData; + + //How many of the 4 wheels are real wheels (eg a 6-wheeled car has a + //block of 4 wheels then a 2nd block of 4 wheels with only 2 active wheels) + //This data is actually logically constant. + PxU32 numActiveWheels; +}; + +struct ProcessSuspWheelTireOutputData +{ +public: + + ProcessSuspWheelTireOutputData() + { + PxMemZero(this, sizeof(ProcessSuspWheelTireOutputData)); + for(PxU32 i=0;i<4;i++) + { + isInAir[i]=true; + tireSurfaceTypes[i]=PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN); + } + } + + + //////////////////////////////////////////////////////////////////////////////////////////// + //The following data is stored so that it may be later passed to PxVehicleWheelQueryResult + ///////////////////////////////////////////////////////////////////////////////////////////// + + //Raycast start [most recent raycast start coord or (0,0,0) if using a cached raycast] + PxVec3 suspLineStarts[4]; + //Raycast start [most recent raycast direction or (0,0,0) if using a cached raycast] + PxVec3 suspLineDirs[4]; + //Raycast start [most recent raycast length or 0 if using a cached raycast] + PxF32 suspLineLengths[4]; + //False if wheel cannot touch the ground. + bool isInAir[4]; + //Actor hit by most recent raycast, NULL if using a cached raycast. + PxActor* tireContactActors[4]; + //Shape hit by most recent raycast, NULL if using a cached raycast. + PxShape* tireContactShapes[4]; + //Material hit by most recent raycast, NULL if using a cached raycast. + PxMaterial* tireSurfaceMaterials[4]; + //Surface type of material hit by most recent raycast, eSURFACE_TYPE_UNKNOWN if using a cached raycast. + PxU32 tireSurfaceTypes[4]; + //Contact point of raycast against either fresh contact plane from fresh raycast or cached contact plane. + PxVec3 tireContactPoints[4]; + //Contact normal of raycast against either fresh contact plane from fresh raycast or cached contact plane. + PxVec3 tireContactNormals[4]; + //Friction experienced by tire (value from friction table for surface/tire type combos multiplied by friction vs slip graph) + PxF32 frictions[4]; + //Jounce experienced by suspension against fresh or cached contact plane. + PxF32 jounces[4]; + //Suspension force to be applied to rigid body. + PxF32 suspensionSpringForces[4]; + //Longitudinal direction of tire in the ground contact plane. + PxVec3 tireLongitudinalDirs[4]; + //Lateral direction of tire in the ground contact plane. + PxVec3 tireLateralDirs[4]; + //Longitudinal slip. + PxF32 longSlips[4]; + //Lateral slip. + PxF32 latSlips[4]; + + //Forward speed of rigid body along tire longitudinal direction at tire base. + //Used later to blend the integrated wheel rotation angle between rolling speed and computed speed + //when the wheel rotation speeds become unreliable at low forward speeds. + PxF32 forwardSpeeds[4]; + + //Torque to be applied to wheel as 1d rigid body. Taken from the longitudinal tire force. + //(Newton's 3rd law means the longitudinal tire force must have an equal and opposite force). + //(The lateral tire force is assumed to be absorbed by the suspension geometry). + PxF32 tireTorques[4]; + + //Force to be applied to rigid body (accumulated across all 4 wheels/tires/suspensions). + PxVec3 chassisForce; + //Torque to be applied to rigid body (accumulated across all 4 wheels/tires/suspensions). + PxVec3 chassisTorque; + + //Updated time spend at low forward speed. + //Needs copied back to vehWheels4DynData + PxF32 newLowForwardSpeedTimers[4]; + //Updated time spend at low lateral speed. + //Needs copied back to vehWheels4DynData + PxF32 newLowSideSpeedTimers[4]; + + //Constraint data for sticky tire constraints and suspension limit constraints. + //Needs copied back to vehWheels4DynData + PxVehicleConstraintShader::VehicleConstraintData vehConstraintData; + + //Store the details of the raycast hit results so that they may be re-used + //next update in the event that no raycast is performed. + //If no raycast was performed then the cached values are just re-copied here + //so that they can be recycled without having to do further tests on whether + //raycasts were performed or not. + //Needs copied back to vehWheels4DynData after the last call to processSuspTireWheels. + //The union of cached hit data and susp raycast data means we don't want to overwrite the + //raycast data until we don't need it any more. + PxU32 cachedHitCounts[4]; + PxPlane cachedHitPlanes[4]; + PxF32 cachedHitDistances[4]; + PxF32 cachedFrictionMultipliers[4]; + PxU16 cachedHitQueryTypes[4]; + + //Store the details of the force applied to any dynamic actor hit by wheel raycasts. + PxRigidDynamic* hitActors[4]; + PxVec3 hitActorForces[4]; + PxVec3 hitActorForcePositions[4]; +}; + + + +//////////////////////////////////////////////////////////////////////////// +//Monster function to +//1. compute the tire/susp forces +//2. compute the torque to apply to the 1D rigid body wheel arising from the long tire force +//3. process the sticky tire friction constraints +// (monitor and increment the low long + lat speed timers, compute data for the sticky tire constraint if necessary) +//4. process the suspension limit constraints +// (monitor the suspension jounce versus the suspension travel limit, compute the data for the suspension limit constraint if necessary). +//5. record the contact plane so that it may be re-used in future updates in the absence of fresh raycasts. +//6. record telemetry data (if necessary) and record data for reporting such as hit material, hit normal etc. +//////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct LocalHitData + { + template + void setFrom(const T& hit) + { + actor = hit.actor; + shape = hit.shape; + position = hit.position; + normal = hit.normal; + distance = hit.distance; + faceIndex = hit.faceIndex; + } + + PxRigidActor* actor; + PxShape* shape; + PxVec3 position; + PxVec3 normal; + PxF32 distance; + PxU32 faceIndex; + }; +} + +static void storeHit +(const ProcessSuspWheelTireConstData& constData, const ProcessSuspWheelTireInputData& inputData, + const PxU16 hitQueryType, + const LocalHitData& hit, const PxPlane& hitPlane, + const PxU32 i, + PxU32* hitCounts4, + PxF32* hitDistances4, + PxPlane* hitPlanes4, + PxF32* hitFrictionMultipliers4, + PxU16* hitQueryTypes4, + PxShape** hitContactShapes4, + PxRigidActor** hitContactActors4, + PxMaterial** hitContactMaterials4, + PxU32* hitSurfaceTypes4, + PxVec3* hitContactPoints4, + PxVec3* hitContactNormals4, + PxU32* cachedHitCounts, + PxPlane* cachedHitPlanes, + PxF32* cachedHitDistances, + PxF32* cachedFrictionMultipliers, + PxU16* cachedHitQueryTypes) +{ + //Hit count. + hitCounts4[i] = 1; + + //Hit distance. + hitDistances4[i] = hit.distance; + + //Hit plane. + hitPlanes4[i] = hitPlane; + + //Hit friction. + PxMaterial* material = NULL; + { + //Only get the material if the raycast started outside the hit shape. + PxBaseMaterial* baseMaterial = (hit.distance != 0.0f) ? hit.shape->getMaterialFromInternalFaceIndex(hit.faceIndex) : NULL; + PX_ASSERT(!baseMaterial || baseMaterial->getConcreteType()==PxConcreteType::eMATERIAL); + material = static_cast(baseMaterial); + } + const PxVehicleDrivableSurfaceToTireFrictionPairs* PX_RESTRICT frictionPairs = constData.frictionPairs; + const PxU32 surfaceType = material ? frictionPairs->getSurfaceType(*material) : 0; + const PxVehicleTireData& tire = inputData.vehWheels4SimData->getTireData(i); + const PxU32 tireType = tire.mType; + const PxF32 frictionMultiplier = frictionPairs->getTypePairFriction(surfaceType, tireType); + PX_ASSERT(frictionMultiplier >= 0); + hitFrictionMultipliers4[i] = frictionMultiplier; + + //Hit type. + hitQueryTypes4[i] = hitQueryType; + + //Hit report. + hitContactShapes4[i] = hit.shape; + hitContactActors4[i] = hit.actor; + hitContactMaterials4[i] = material; + hitSurfaceTypes4[i] = surfaceType; + hitContactPoints4[i] = hit.position; + hitContactNormals4[i] = hit.normal; + + //When we're finished here we need to copy this back to the vehicle. + cachedHitCounts[i] = 1; + cachedHitPlanes[i] = hitPlane; + cachedHitDistances[i] = hit.distance; + cachedFrictionMultipliers[i] = frictionMultiplier; + cachedHitQueryTypes[i] = hitQueryType; +} + +static PX_FORCE_INLINE PxBatchQueryStatus::Enum getStatus(const PxSweepBuffer& r) +{ + return (0xffffffff == r.nbTouches) ? PxBatchQueryStatus::ePENDING : (0xffffffff == r.maxNbTouches ? PxBatchQueryStatus::eOVERFLOW : PxBatchQueryStatus::eSUCCESS); +} + +static void processSuspTireWheels +(const PxU32 startWheelIndex, + const ProcessSuspWheelTireConstData& constData, const ProcessSuspWheelTireInputData& inputData, + const PxVec3& sideAxis, + const PxF32 pointRejectAngleThresholdCosine, + const PxF32 normalRejectAngleThresholdCosine, + const PxF32 maxHitActorAcceleration, + ProcessSuspWheelTireOutputData& outputData, + VehicleTelemetryDataContext* vehTelemetryDataContext) +{ +#if !PX_DEBUG_VEHICLE_ON + PX_UNUSED(startWheelIndex); + PX_UNUSED(vehTelemetryDataContext); +#endif + + PX_SIMD_GUARD; //tzRaw.normalize(); in computeTireDirs threw a denorm exception on osx + +#if PX_DEBUG_VEHICLE_ON + PX_ASSERT(0==(startWheelIndex & 3)); +#endif + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eJOUNCE, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eSUSPFORCE, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eTIRELOAD, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eNORMALIZED_TIRELOAD, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eNORM_TIRE_LONG_FORCE, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eNORM_TIRE_LAT_FORCE, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eTIRE_LONG_SLIP, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eTIRE_LAT_SLIP, vehTelemetryDataContext->wheelGraphData); + zeroGraphDataWheels(startWheelIndex,PxVehicleWheelGraphChannel::eTIRE_FRICTION, vehTelemetryDataContext->wheelGraphData); + } +#endif + + //Unpack the logically constant data. + const PxVec3& gravity=constData.gravity; + const PxF32 timeFraction=constData.timeFraction; + const PxF32 timeStep=constData.subTimeStep; + const PxF32 recipTimeStep=constData.recipSubTimeStep; + const PxF32 recipGravityMagnitude=constData.recipGravityMagnitude; + const PxF32 gravityMagnitude=constData.gravityMagnitude; + const bool isTank=constData.isTank; + const PxF32 minLongSlipDenominator=constData.minLongSlipDenominator; + const PxU32 wheelsSimFlags = constData.wheelsSimFlags; + + //Unpack the input data (physically constant data). + const PxVehicleWheels4SimData& wheelsSimData=*inputData.vehWheels4SimData; + const PxVehicleWheels4DynData& wheelsDynData=*inputData.vehWheels4DynData; + const PxVehicleTireForceCalculator4& tireForceCalculator=*inputData.vehWheels4TireForceCalculator; + const PxVehicleTireLoadFilterData& tireLoadFilterData=*inputData.vehWheels4TireLoadFilterData; + //More constant data describing the 4 wheels under consideration. + const PxF32* PX_RESTRICT tireRestLoads=wheelsSimData.getTireRestLoadsArray(); + const PxF32* PX_RESTRICT recipTireRestLoads=wheelsSimData.getRecipTireRestLoadsArray(); + //Compute the right direction for later. + const PxTransform& carChassisTrnsfm=inputData.carChassisTrnsfm; + const PxVec3 latDir=inputData.carChassisTrnsfm.rotate(sideAxis); + //Unpack the linear and angular velocity of the rigid body. + const PxVec3& carChassisLinVel=inputData.carChassisLinVel; + const PxVec3& carChassisAngVel=inputData.carChassisAngVel; + //Wheel local poses + const PxQuat* PX_RESTRICT wheelLocalPoseRotations = inputData.wheelLocalPoseRotations; + //Inputs (accel, steer, brake). + const bool isIntentionToAccelerate=inputData.isIntentionToAccelerate; + const PxF32* steerAngles=inputData.steerAngles; + const bool* isBrakeApplied=inputData.isBrakeApplied; + const bool* isAccelApplied=inputData.isAccelApplied; + //Disabled/enabled wheel states. + const bool* activeWheelStates=inputData.activeWheelStates; + //Current low forward/side speed timers. Note that the updated timers + //are stored in newLowForwardSpeedTimers and newLowSideSpeedTimers. + const PxF32* PX_RESTRICT lowForwardSpeedTimers=wheelsDynData.mTireLowForwardSpeedTimers; + const PxF32* PX_RESTRICT lowSideSpeedTimers=wheelsDynData.mTireLowSideSpeedTimers; + //Susp jounces and speeds from previous call to processSuspTireWheels. + const PxF32* PX_RESTRICT prevJounces=wheelsDynData.mJounces; + + //Unpack the output data (the data we are going to compute). + //Start with the data stored for reporting to PxVehicleWheelQueryResult. + //PxVec3* suspLineStarts=outputData.suspLineStarts; + //PxVec3* suspLineDirs=outputData.suspLineDirs; + //PxF32* suspLineLengths=outputData.suspLineLengths; + bool* isInAirs=outputData.isInAir; + PxActor** tireContactActors=outputData.tireContactActors; + PxShape** tireContactShapes=outputData.tireContactShapes; + PxMaterial** tireSurfaceMaterials=outputData.tireSurfaceMaterials; + PxU32* tireSurfaceTypes=outputData.tireSurfaceTypes; + PxVec3* tireContactPoints=outputData.tireContactPoints; + PxVec3* tireContactNormals=outputData.tireContactNormals; + PxF32* frictions=outputData.frictions; + PxF32* jounces=outputData.jounces; + PxF32* suspensionSpringForces=outputData.suspensionSpringForces; + PxVec3* tireLongitudinalDirs=outputData.tireLongitudinalDirs; + PxVec3* tireLateralDirs=outputData.tireLateralDirs; + PxF32* longSlips=outputData.longSlips; + PxF32* latSlips=outputData.latSlips; + //Now unpack the forward speeds that are used later to blend the integrated wheel + //rotation angle between rolling speed and computed speed when the wheel rotation + //speeds become unreliable at low forward speeds. + PxF32* forwardSpeeds=outputData.forwardSpeeds; + //Unpack the real outputs of this function (wheel torques to apply to 1d rigid body wheel and forces/torques + //to apply to 3d rigid body chassis). + PxF32* tireTorques=outputData.tireTorques; + PxVec3& chassisForce=outputData.chassisForce; + PxVec3& chassisTorque=outputData.chassisTorque; + //Unpack the low speed timers that will be computed. + PxF32* newLowForwardSpeedTimers=outputData.newLowForwardSpeedTimers; + PxF32* newLowSideSpeedTimers=outputData.newLowSideSpeedTimers; + //Unpack the constraint data for suspensions limit and sticky tire constraints. + //Susp limits. + bool* suspLimitActiveFlags=outputData.vehConstraintData.mSuspLimitData.mActiveFlags; + PxVec3* suspLimitDirs=outputData.vehConstraintData.mSuspLimitData.mDirs; + PxVec3* suspLimitCMOffsets=outputData.vehConstraintData.mSuspLimitData.mCMOffsets; + PxF32* suspLimitErrors=outputData.vehConstraintData.mSuspLimitData.mErrors; + //Longitudinal sticky tires. + bool* stickyTireForwardActiveFlags=outputData.vehConstraintData.mStickyTireForwardData.mActiveFlags; + PxVec3* stickyTireForwardDirs=outputData.vehConstraintData.mStickyTireForwardData.mDirs; + PxVec3* stickyTireForwardCMOffsets=outputData.vehConstraintData.mStickyTireForwardData.mCMOffsets; + PxF32* stickyTireForwardTargetSpeeds=outputData.vehConstraintData.mStickyTireForwardData.mTargetSpeeds; + //Lateral sticky tires. + bool* stickyTireSideActiveFlags=outputData.vehConstraintData.mStickyTireSideData.mActiveFlags; + PxVec3* stickyTireSideDirs=outputData.vehConstraintData.mStickyTireSideData.mDirs; + PxVec3* stickyTireSideCMOffsets=outputData.vehConstraintData.mStickyTireSideData.mCMOffsets; + PxF32* stickyTireSideTargetSpeeds=outputData.vehConstraintData.mStickyTireSideData.mTargetSpeeds; + //Hit data. Store the contact data so it can be reused. + PxU32* cachedHitCounts=outputData.cachedHitCounts; + PxPlane* cachedHitPlanes=outputData.cachedHitPlanes; + PxF32* cachedHitDistances=outputData.cachedHitDistances; + PxF32* cachedFrictionMultipliers=outputData.cachedFrictionMultipliers; + PxU16* cachedHitQueryTypes=outputData.cachedHitQueryTypes; + //Hit actor data. + PxRigidDynamic** hitActors=outputData.hitActors; + PxVec3* hitActorForces=outputData.hitActorForces; + PxVec3* hitActorForcePositions=outputData.hitActorForcePositions; + + //Set the cmass rotation straight away (we might need this, we might not but we don't know that yet so just set it). + outputData.vehConstraintData.mCMassRotation = constData.vehActor->getCMassLocalPose().q; + + //Compute all the hit data (counts, distances, planes, frictions, actors, shapes, materials etc etc). + //If we just did a raycast/sweep then we need to compute all this from the hit reports. + //If we are using cached raycast/sweep results then just copy the cached hit result data. + PxU32 hitCounts4[4]; + PxF32 hitDistances4[4]; + PxPlane hitPlanes4[4]; + PxF32 hitFrictionMultipliers4[4]; + PxU16 hitQueryTypes4[4]; + PxShape* hitContactShapes4[4]; + PxRigidActor* hitContactActors4[4]; + PxMaterial* hitContactMaterials4[4]; + PxU32 hitSurfaceTypes4[4]; + PxVec3 hitContactPoints4[4]; + PxVec3 hitContactNormals4[4]; + const PxRaycastBuffer* PX_RESTRICT raycastResults=inputData.vehWheels4DynData->mRaycastResults; + const PxSweepBuffer* PX_RESTRICT sweepResults=inputData.vehWheels4DynData->mSweepResults; + if(raycastResults || sweepResults) + { + const PxU16 queryType = raycastResults ? 0u : 1u; + + //If we have a blocking hit then always take that. + //If we don't have a blocking hit then search for the "best" hit from all the touches. + for(PxU32 i=0;i bestTouchDistance) + { + storeHit(constData, inputData, + queryType, + hit, hitPlane, + i, + hitCounts4, + hitDistances4, + hitPlanes4, + hitFrictionMultipliers4, + hitQueryTypes4, + hitContactShapes4, + hitContactActors4, + hitContactMaterials4, + hitSurfaceTypes4, + hitContactPoints4, + hitContactNormals4, + cachedHitCounts, + cachedHitPlanes, + cachedHitDistances, + cachedFrictionMultipliers, + cachedHitQueryTypes); + + bestTouchDistance = dx; + + hitCount = 1; + } + } + } + } + + if(0 == hitCount) + { + hitCounts4[i]=0; + hitDistances4[i]=0; + hitPlanes4[i]=PxPlane(PxVec3(0,0,0),0); + hitFrictionMultipliers4[i]=0; + hitQueryTypes4[i]=0u; + hitContactShapes4[i]=NULL; + hitContactActors4[i]=NULL; + hitContactMaterials4[i]=NULL; + hitSurfaceTypes4[i]=PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN); + hitContactPoints4[i]=PxVec3(0,0,0); + hitContactNormals4[i]=PxVec3(0,0,0); + + //When we're finished here we need to copy this back to the vehicle. + cachedHitCounts[i]=0; + cachedHitPlanes[i]= PxPlane(PxVec3(0,0,0),0); + cachedHitDistances[i]=0; + cachedFrictionMultipliers[i]=0; + cachedHitQueryTypes[i] = 0u; + } + } + } + else + { + //If we have no sq results then we must have a cached raycast hit result. + const PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult& cachedHitResult = + reinterpret_cast(inputData.vehWheels4DynData->mQueryOrCachedHitResults); + + for(PxU32 i=0;iwheelGraphData); +#endif + + //Reset the jounce to max droop. + //This will get updated as we learn more about the suspension and tire. + PxF32 jounce=-susp.mMaxDroop; + jounces[i]=jounce; + + //Deactivate the sticky tire and susp limit constraint. + //These will get updated as we learn more about the suspension and tire. + suspLimitActiveFlags[i]=false; + suspLimitErrors[i]=0.0f; + stickyTireForwardActiveFlags[i]=false; + stickyTireForwardTargetSpeeds[i]=0; + stickyTireSideActiveFlags[i]=false; + stickyTireSideTargetSpeeds[i]=0; + + //The vehicle is in the air until we know otherwise. + isInAirs[i]=true; + + //If there has been a hit then compute the suspension force and tire load. + //Ignore the hit if the raycast starts inside the hit shape (eg wheel completely underneath surface of a heightfield). + const bool activeWheelState=activeWheelStates[i]; + const PxU32 numHits=hitCounts4[i]; + const PxVec3 hitNorm(hitPlanes4[i].n); + const PxVec3 w = carChassisTrnsfm.q.rotate(bodySpaceSuspTravelDir); + if(activeWheelState && numHits > 0 && hitDistances4[i] != 0.0f && hitNorm.dot(w) < 0.0f) + { + //Get the friction multiplier from the combination of surface type and tire type. + const PxF32 frictionMultiplier=hitFrictionMultipliers4[i]; + PX_ASSERT(frictionMultiplier>=0); + + PxF32 dx; + PxVec3 wheelBottomPos; + bool successIntersection = true; + if(0 == hitQueryTypes4[i]) + { + successIntersection = intersectRayPlane + (carChassisTrnsfm, + bodySpaceWheelCentreOffset, bodySpaceSuspTravelDir, wheel.mWidth, wheel.mRadius, susp.mMaxCompression, + hitPlanes4[i], + dx, wheelBottomPos); + } + else + { + const bool useDirectSweepResults = (wheelsSimFlags & PxVehicleWheelsSimFlag::eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST)!=0; + + PX_ASSERT(1 == hitQueryTypes4[i]); + successIntersection = intersectCylinderPlane + (carChassisTrnsfm, + wheelLocalPoseRotations[i], + bodySpaceWheelCentreOffset, bodySpaceSuspTravelDir, wheel.mWidth, wheel.mRadius, susp.mMaxCompression, + hitPlanes4[i], + sideAxis, + false, 0.0f, 0.0f, + dx, wheelBottomPos, hitContactPoints4[i], hitDistances4[i], useDirectSweepResults); + } + + //If the spring is elongated past its max droop then the wheel isn't touching the ground. + //In this case the spring offers zero force and provides no support for the chassis/sprung mass. + //Only carry on computing the spring force if the wheel is touching the ground. + PX_ASSERT(susp.mMaxCompression>=0); + PX_ASSERT(susp.mMaxDroop>=0); + if(dx > -susp.mMaxDroop && successIntersection) + { + //We can record the hit shape, hit actor, hit material, hit surface type, hit point, and hit normal now because we've got a hit. + tireContactShapes[i]=hitContactShapes4[i]; + tireContactActors[i]=hitContactActors4[i]; + tireSurfaceMaterials[i]=hitContactMaterials4[i]; + tireSurfaceTypes[i]=hitSurfaceTypes4[i]; + tireContactPoints[i]=hitContactPoints4[i]; + tireContactNormals[i]=hitContactNormals4[i]; + + //Clamp the spring compression so that it is never greater than the max bounce. + //Apply the susp limit constraint if the spring compression is greater than the max bounce. + suspLimitErrors[i] = (w.dot(hitNorm))*(-dx + susp.mMaxCompression); + suspLimitActiveFlags[i] = (dx > susp.mMaxCompression); + suspLimitCMOffsets[i] = bodySpaceWheelCentreOffset; + suspLimitDirs[i] = bodySpaceSuspTravelDir; + jounce=PxMin(dx,susp.mMaxCompression); + + //Store the jounce (having a local copy avoids lhs). + jounces[i]=jounce; + + //Store the jounce in the graph. +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataSuspJounce(startWheelIndex, i,jounce, vehTelemetryDataContext->wheelGraphData); +#endif + + //Compute the speed of the rigid body along the suspension travel dir at the + //bottom of the wheel. + const PxVec3 r=wheelBottomPos-carChassisTrnsfm.p; + PxVec3 wheelBottomVel=carChassisLinVel; + wheelBottomVel+=carChassisAngVel.cross(r); + + //Modify the relative velocity at the wheel contact point if the hit actor is a dynamic. + PxRigidDynamic* dynamicHitActor=NULL; + PxVec3 hitActorVelocity(0,0,0); + if(hitContactActors4[i] && ((dynamicHitActor = hitContactActors4[i]->is()) != NULL)) + { + hitActorVelocity = PxRigidBodyExt::getVelocityAtPos(*dynamicHitActor,wheelBottomPos); + wheelBottomVel -= hitActorVelocity; + } + + //Get the speed of the jounce. + PxF32 jounceSpeed; + PxF32 previousJounce; + if (PX_MAX_F32 != prevJounces[i]) + { + jounceSpeed = (jounce - prevJounces[i])*recipTimeStep; + previousJounce = prevJounces[i]; + } + else + { + jounceSpeed = 0.0f; + previousJounce = jounce; + } + + const PxF32 gravitySuspDir = gravity.dot(w); + bool computeSuspensionForce = true; + if ((wheelsSimFlags & PxVehicleWheelsSimFlag::eLIMIT_SUSPENSION_EXPANSION_VELOCITY) && (jounceSpeed < 0.0f) && (jounce <= 0.0f)) + { + //Suspension is expanding and not compressed (the latter helps to avoid the suspension not being able to carry the sprung mass + //when many substeps are used because the expected velocity from the suspension spring might always be slightly below the velocity + //needed to reach the new jounce). + + //Check if the suspension can expand fast enough to keep pushing the wheel to the ground. + + const PxF32 distToMaxDroop = previousJounce + susp.mMaxDroop; // signs chosen to point along the suspension travel direction + //The vehicle is considered to be in air until the suspension expands to the ground, thus the max droop is used + //as the rest length of the spring. + + //Without the suspension elongating, the wheel would end up in the air. Compute the force that pushes the + //wheel towards the ground. Note that gravity is ignored here as it applies to chassis and wheel equally. + //Furthermore, the suspension start point (sprung mass) and the wheel are assumed to move with roughly the + //same velocity, hence, damping is ignored too. + const PxF32 springForceAlongSuspDir = distToMaxDroop * susp.mSpringStrength; + + const PxF32 suspDirVelWheel = ((springForceAlongSuspDir / wheel.mMass) + gravitySuspDir) * timeStep; + + if (jounceSpeed < (-suspDirVelWheel)) + { + //The suspension can not push the wheel fast enough onto the ground, so the vehicle will leave the ground. + //Hence, no spring forces should get applied. + //note: could consider applying -springForceAlongSuspDir to the chassis but this is not done in the other + // scenarios where the vehicle is in the air either. + + computeSuspensionForce = false; + jounce = PxMin(previousJounce - (suspDirVelWheel * timeStep), susp.mMaxCompression); + } + } + + if (computeSuspensionForce) + { + //We know that the vehicle is not in the air. + isInAirs[i]=false; + + //Decompose gravity into a term along w and a term perpendicular to w + //gravity = w*alpha + T*beta + //where T is a unit vector perpendicular to w; alpha and beta are scalars. + //The vector w*alpha*mass is the component of gravitational force that acts along the spring direction. + //The vector T*beta*mass is the component of gravitational force that will be resisted by the spring + //because the spring only supports a single degree of freedom along w. + //We only really need to know T*beta so don't bother calculating T or beta. + const PxF32 alpha = PxMax(0.0f, gravitySuspDir); + const PxVec3 TTimesBeta = (0.0f != alpha) ? gravity - w*alpha : PxVec3(0,0,0); + //Compute the magnitude of the force along w. + PxF32 suspensionForceW = + PxMax(0.0f, + susp.mSprungMass*alpha + //force to support sprung mass at zero jounce + susp.mSpringStrength*jounce); //linear spring + suspensionForceW += jounceSpeed * susp.mSpringDamperRate; //damping + + //Compute the total force acting on the suspension. + //Remember that the spring force acts along -w. + //Remember to account for the term perpendicular to w and that it acts along -TTimesBeta + PxF32 suspensionForceMag; + if(wheelsSimFlags & PxVehicleWheelsSimFlag::eDISABLE_SUSPENSION_FORCE_PROJECTION) + suspensionForceMag = suspensionForceW - hitNorm.dot(TTimesBeta*susp.mSprungMass); + else + suspensionForceMag = hitNorm.dot(-w*suspensionForceW - TTimesBeta*susp.mSprungMass); + + //Apply the opposite force to the hit object. + //Clamp suspensionForceMag if required. + if (dynamicHitActor && !(dynamicHitActor->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC)) + { + const PxF32 dynamicActorInvMass = dynamicHitActor->getInvMass(); + const PxF32 dynamicActorMass = dynamicHitActor->getMass(); + const PxF32 forceSign = computeSign(suspensionForceMag); + const PxF32 forceMag = PxAbs(suspensionForceMag); + const PxF32 clampedAccelMag = PxMin(forceMag*dynamicActorInvMass, maxHitActorAcceleration); + const PxF32 clampedForceMag = clampedAccelMag*dynamicActorMass*forceSign; + PX_ASSERT(clampedForceMag*suspensionForceMag >= 0.0f); + + suspensionForceMag = clampedForceMag; + + hitActors[i] = dynamicHitActor; + hitActorForces[i] = hitNorm*(-clampedForceMag*timeFraction); + hitActorForcePositions[i] = hitContactPoints4[i]; + } + + //Store the spring force now (having a local copy avoids lhs). + suspensionSpringForces[i] = suspensionForceMag; + + //Store the spring force in the graph. +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataSuspForce(startWheelIndex, i, suspensionForceMag, vehTelemetryDataContext->wheelGraphData); +#endif + + //Suspension force can be computed now. + const PxVec3 suspensionForce = hitNorm*suspensionForceMag; + + //Torque from spring force. + const PxVec3 suspForceCMOffset = carChassisTrnsfm.rotate(wheelsSimData.getSuspForceAppPointOffset(i)); + const PxVec3 suspensionTorque = suspForceCMOffset.cross(suspensionForce); + + //Add the suspension force/torque to the chassis force/torque. + chassisForce+=suspensionForce; + chassisTorque+=suspensionTorque; + + //Now compute the tire load. + const PxF32 tireLoad = suspensionForceMag; + + //Normalize the tire load + //Now work out the normalized tire load. + const PxF32 normalisedTireLoad=tireLoad*recipGravityMagnitude*recipTireRestLoads[i]; + //Filter the normalized tire load and compute the filtered tire load too. + const PxF32 filteredNormalisedTireLoad=computeFilteredNormalisedTireLoad(tireLoadFilterData,normalisedTireLoad); + const PxF32 filteredTireLoad=filteredNormalisedTireLoad*gravityMagnitude*tireRestLoads[i]; + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + updateGraphDataTireLoad(startWheelIndex,i,filteredTireLoad, vehTelemetryDataContext->wheelGraphData); + updateGraphDataNormTireLoad(startWheelIndex,i,filteredNormalisedTireLoad, vehTelemetryDataContext->wheelGraphData); + } +#endif + + //Compute the lateral and longitudinal tire axes in the ground plane. + PxVec3 tireLongDir; + PxVec3 tireLatDir; + computeTireDirs(latDir,hitNorm,steerAngles[i],tireLongDir,tireLatDir); + + //Store the tire long and lat dirs now (having a local copy avoids lhs). + tireLongitudinalDirs[i]= tireLongDir; + tireLateralDirs[i]=tireLatDir; + + //Now compute the speeds along each of the tire axes. + const PxF32 tireLongSpeed=wheelBottomVel.dot(tireLongDir); + const PxF32 tireLatSpeed=wheelBottomVel.dot(tireLatDir); + + //Store the forward speed (having a local copy avoids lhs). + forwardSpeeds[i]=tireLongSpeed; + + //Now compute the slips along each axes. + const bool hasAccel=isAccelApplied[i]; + const bool hasBrake=isBrakeApplied[i]; + const PxF32 wheelOmega=wheelsDynData.mWheelSpeeds[i]; + const PxF32 wheelRadius=wheel.mRadius; + PxF32 longSlip; + PxF32 latSlip; + computeTireSlips + (tireLongSpeed,tireLatSpeed,wheelOmega,wheelRadius,minLongSlipDenominator, + hasAccel,hasBrake, + isTank, + longSlip,latSlip); + + //Store the lat and long slip (having local copies avoids lhs). + longSlips[i]=longSlip; + latSlips[i]=latSlip; + + //Camber angle. + PxF32 camber=susp.mCamberAtRest; + if(jounce>0) + { + camber += jounce*susp.mCamberAtMaxCompression*susp.getRecipMaxCompression(); + } + else + { + camber -= jounce*susp.mCamberAtMaxDroop*susp.getRecipMaxDroop(); + } + + //Compute the friction that will be experienced by the tire. + PxF32 friction; + computeTireFriction(tire,longSlip,frictionMultiplier,friction); + + //Store the friction (having a local copy avoids lhs). + frictions[i]=friction; + + if(filteredTireLoad*frictionMultiplier>0) + { + //Either tire forces or sticky tire friction constraint will be applied here. + const PxVec3 tireForceCMOffset = carChassisTrnsfm.rotate(wheelsSimData.getTireForceAppPointOffset(i)); + + PxF32 newLowForwardSpeedTimer; + { + //check the accel value here + //Update low forward speed timer. + const PxF32 recipWheelRadius=wheel.getRecipRadius(); + newLowForwardSpeedTimer=newLowForwardSpeedTimers[i]; + updateLowForwardSpeedTimer(tireLongSpeed,wheelOmega,wheelRadius,recipWheelRadius,isIntentionToAccelerate,timeStep,newLowForwardSpeedTimer); + + //Activate sticky tire forward friction constraint if required. + //If sticky tire friction is active then set the longitudinal slip to zero because + //the sticky tire constraint will take care of the longitudinal component of motion. + bool stickyTireForwardActiveFlag=false; + PxF32 stickyTireForwardTargetSpeed=0.0f; + activateStickyFrictionForwardConstraint(tireLongSpeed,wheelOmega,newLowForwardSpeedTimer,isIntentionToAccelerate,stickyTireForwardActiveFlag,stickyTireForwardTargetSpeed); + stickyTireForwardTargetSpeed += hitActorVelocity.dot(tireLongDir); + + //Store the sticky tire data (having local copies avoids lhs). + newLowForwardSpeedTimers[i] = newLowForwardSpeedTimer; + stickyTireForwardActiveFlags[i]=stickyTireForwardActiveFlag; + stickyTireForwardTargetSpeeds[i]=stickyTireForwardTargetSpeed; + stickyTireForwardDirs[i]=tireLongDir; + stickyTireForwardCMOffsets[i]=tireForceCMOffset; + + //Deactivate the long slip if sticky tire constraint is active. + longSlip=(!stickyTireForwardActiveFlag ? longSlip : 0.0f); + + //Store the long slip (having local copies avoids lhs). + longSlips[i]=longSlip; + } + + PxF32 newLowSideSpeedTimer; + { + //check the accel value here + //Update low side speed timer. + newLowSideSpeedTimer=newLowSideSpeedTimers[i]; + updateLowSideSpeedTimer(tireLatSpeed,isIntentionToAccelerate,timeStep,newLowSideSpeedTimer); + + //Activate sticky tire side friction constraint if required. + //If sticky tire friction is active then set the lateral slip to zero because + //the sticky tire constraint will take care of the lateral component of motion. + bool stickyTireSideActiveFlag=false; + PxF32 stickyTireSideTargetSpeed=0.0f; + activateStickyFrictionSideConstraint(tireLatSpeed,newLowForwardSpeedTimer,newLowSideSpeedTimer,isIntentionToAccelerate,stickyTireSideActiveFlag,stickyTireSideTargetSpeed); + stickyTireSideTargetSpeed += hitActorVelocity.dot(tireLatDir); + + //Store the sticky tire data (having local copies avoids lhs). + newLowSideSpeedTimers[i] = newLowSideSpeedTimer; + stickyTireSideActiveFlags[i]=stickyTireSideActiveFlag; + stickyTireSideTargetSpeeds[i]=stickyTireSideTargetSpeed; + stickyTireSideDirs[i]=tireLatDir; + stickyTireSideCMOffsets[i]=tireForceCMOffset; + + //Deactivate the lat slip if sticky tire constraint is active. + latSlip=(!stickyTireSideActiveFlag ? latSlip : 0.0f); + + //Store the long slip (having local copies avoids lhs). + latSlips[i]=latSlip; + } + + //Compute the various tire torques. + PxF32 wheelTorque=0; + PxF32 tireLongForceMag=0; + PxF32 tireLatForceMag=0; + PxF32 tireAlignMoment=0; + const PxF32 restTireLoad=gravityMagnitude*tireRestLoads[i]; + const PxF32 recipWheelRadius=wheel.getRecipRadius(); + tireForceCalculator.mShader( + tireForceCalculator.mShaderData[i], + friction, + longSlip,latSlip,camber, + wheelOmega,wheelRadius,recipWheelRadius, + restTireLoad,filteredNormalisedTireLoad,filteredTireLoad, + gravityMagnitude, recipGravityMagnitude, + wheelTorque,tireLongForceMag,tireLatForceMag,tireAlignMoment); + + //Store the tire torque ((having a local copy avoids lhs). + tireTorques[i]=wheelTorque; + + //Apply the torque to the chassis. + //Compute the tire force to apply to the chassis. + const PxVec3 tireLongForce=tireLongDir*tireLongForceMag; + const PxVec3 tireLatForce=tireLatDir*tireLatForceMag; + const PxVec3 tireForce=tireLongForce+tireLatForce; + //Compute the torque to apply to the chassis. + const PxVec3 tireTorque=tireForceCMOffset.cross(tireForce); + //Add all the forces/torques together. + chassisForce+=tireForce; + chassisTorque+=tireTorque; + + //Graph all the data we just computed. +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + vehTelemetryDataContext->tireForceAppPoints[i] = carChassisTrnsfm.p + tireForceCMOffset; + vehTelemetryDataContext->suspForceAppPoints[i] = carChassisTrnsfm.p + suspForceCMOffset; + + updateGraphDataNormLongTireForce(startWheelIndex, i, PxAbs(tireLongForceMag)*normalisedTireLoad/tireLoad, vehTelemetryDataContext->wheelGraphData); + updateGraphDataNormLatTireForce(startWheelIndex, i, PxAbs(tireLatForceMag)*normalisedTireLoad/tireLoad, vehTelemetryDataContext->wheelGraphData); + updateGraphDataNormTireAligningMoment(startWheelIndex, i, tireAlignMoment*normalisedTireLoad/tireLoad, vehTelemetryDataContext->wheelGraphData); + updateGraphDataLongTireSlip(startWheelIndex, i,longSlips[i], vehTelemetryDataContext->wheelGraphData); + updateGraphDataLatTireSlip(startWheelIndex, i,latSlips[i], vehTelemetryDataContext->wheelGraphData); + updateGraphDataTireFriction(startWheelIndex, i,frictions[i], vehTelemetryDataContext->wheelGraphData); + } +#endif + }//filteredTireLoad*frictionMultiplier>0 + }//if(computeSuspensionForce) + }//if(dx > -susp.mMaxCompression) + }//if(numHits>0) + }//i +} + + +void procesAntiRollSuspension +(const PxVehicleWheelsSimData& wheelsSimData, + const PxTransform& carChassisTransform, const PxWheelQueryResult* wheelQueryResults, + PxVec3& chassisTorque) +{ + const PxU32 numAntiRollBars = wheelsSimData.getNbAntiRollBars(); + for(PxU32 i = 0; i < numAntiRollBars; i++) + { + const PxVehicleAntiRollBarData& antiRoll = wheelsSimData.getAntiRollBarData(i); + const PxU32 w0 = antiRoll.mWheel0; + const PxU32 w1 = antiRoll.mWheel1; + + //At least one wheel must be on the ground for the anti-roll to work. + const bool w0InAir = wheelQueryResults[w0].isInAir; + const bool w1InAir = wheelQueryResults[w1].isInAir; + if(!w0InAir || !w1InAir) + { + //Compute the difference in jounce and compute the force. + const PxF32 w0Jounce = wheelQueryResults[w0].suspJounce; + const PxF32 w1Jounce = wheelQueryResults[w1].suspJounce; + const PxF32 antiRollForceMag = (w0Jounce - w1Jounce)*antiRoll.mStiffness; + + //Apply the antiRollForce postiviely to wheel0, negatively to wheel 1 + PxU32 wheelIds[2] = {0xffffffff, 0xffffffff}; + PxF32 antiRollForceMags[2]; + PxU32 numWheelIds = 0; + if(!w0InAir) + { + wheelIds[numWheelIds] = w0; + antiRollForceMags[numWheelIds] = -antiRollForceMag; + numWheelIds++; + } + if(!w1InAir) + { + wheelIds[numWheelIds] = w1; + antiRollForceMags[numWheelIds] = +antiRollForceMag; + numWheelIds++; + } + + for(PxU32 j = 0; j < numWheelIds; j++) + { + const PxU32 wheelId = wheelIds[j]; + + //Force + const PxVec3 suspDir = carChassisTransform.q.rotate(wheelsSimData.getSuspTravelDirection(wheelId)); + const PxVec3 antiRollForce = suspDir*antiRollForceMags[j]; + //Torque + const PxVec3 r = carChassisTransform.q.rotate(wheelsSimData.getSuspForceAppPointOffset(wheelId)); + const PxVec3 antiRollTorque = r.cross(antiRollForce); + chassisTorque += antiRollTorque; + } + } + } +} + + + +//////////////////////////////////////////////////////////////////////////// +//Set the low long speed timers computed in processSuspTireWheels +//Call immediately after completing processSuspTireWheels. +//////////////////////////////////////////////////////////////////////////// + +void updateLowSpeedTimers(const PxF32* PX_RESTRICT newLowSpeedTimers, PxF32* PX_RESTRICT lowSpeedTimers) +{ + for(PxU32 i=0;i<4;i++) + { + lowSpeedTimers[i]=(newLowSpeedTimers[i]!=lowSpeedTimers[i] ? newLowSpeedTimers[i] : 0.0f); + } +} + +//////////////////////////////////////////////////////////////////////////// +//Set the jounce values computed in processSuspTireWheels +//Call immediately after completing processSuspTireWheels. +//////////////////////////////////////////////////////////////////////////// +void updateJounces(const PxF32* PX_RESTRICT jounces, PxF32* PX_RESTRICT prevJounces) +{ + for(PxU32 i=0;i<4;i++) + { + prevJounces[i] = jounces[i]; + } +} + +void updateSteers(const PxF32* PX_RESTRICT steerAngles, PxF32* PX_RESTRICT prevSteers) +{ + for (PxU32 i = 0; i < 4; i++) + { + prevSteers[i] = steerAngles[i]; + } +} + +/////////////////////////////////////////////////////////////////////////////// +//Set the hit plane, hit distance and hit friction multplier computed in processSuspTireWheels +//Call immediately after completing processSuspTireWheels. +//////////////////////////////////////////////////////////////////////////// + +void updateCachedHitData +(const PxU32* PX_RESTRICT cachedHitCounts, const PxPlane* PX_RESTRICT cachedHitPlanes, const PxF32* PX_RESTRICT cachedHitDistances, const PxF32* PX_RESTRICT cachedFrictionMultipliers, const PxU16* cachedQueryTypes, + PxVehicleWheels4DynData* wheels4DynData) +{ + if(wheels4DynData->mRaycastResults || wheels4DynData->mSweepResults) + { + wheels4DynData->mHasCachedRaycastHitPlane = true; + } + + PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult* cachedRaycastHitResults = + reinterpret_cast(wheels4DynData->mQueryOrCachedHitResults); + + + for(PxU32 i=0;i<4;i++) + { + cachedRaycastHitResults->mCounts[i]=PxTo16(cachedHitCounts[i]); + cachedRaycastHitResults->mPlanes[i]=cachedHitPlanes[i]; + cachedRaycastHitResults->mDistances[i]=cachedHitDistances[i]; + cachedRaycastHitResults->mFrictionMultipliers[i]=cachedFrictionMultipliers[i]; + cachedRaycastHitResults->mQueryTypes[i] = cachedQueryTypes[i]; + } +} + + + +//////////////////////////////////////////////////////////////////////////// +//Solve the system of engine speed + wheel rotation speeds using an implicit integrator. +//The following functions only compute the speed of wheels connected to the diff. +//Worth going to the length of the implicit integrator because after gear changes +//the difference in speed at the clutch can be hard to integrate. +//Separate functions for 4W, NW and tank because the differential works in slightly +//different ways. With driveNW we end up with (N+1)*(N+1) problem, with drive4W we end up +//with 5*5 and with tanks we end up with just 3*3. Tanks use the method of least squares +//to apply the rule that all left/right wheels have the same speed. +//Remember that the following functions don't integrate wheels not connected to the diff +//so these need integrated separately. +//////////////////////////////////////////////////////////////////////////// + +#if PX_CHECKED +bool isValid(const MatrixNN& A, const VectorN& b, const VectorN& result) +{ + PX_ASSERT(A.getSize()==b.getSize()); + PX_ASSERT(A.getSize()==result.getSize()); + const PxU32 size=A.getSize(); + + //r=A*result-b + VectorN r(size); + for(PxU32 i=0;i 0, false if brakeTorques[i]==0 + const bool* isBrakeApplied; + + //Tire torques to apply to each 1d rigid body wheel. + const PxF32* tireTorques; + + //Sim and dyn data. + PxU32 numWheels4; + PxU32 numActiveWheels; + const PxVehicleWheels4SimData* wheels4SimData; + const PxVehicleDriveSimData* driveSimData; +}; + +struct ImplicitSolverOutput +{ + PxVehicleWheels4DynData* wheelsDynData; + PxVehicleDriveDynData* driveDynData; +}; + +void solveDrive4WInternaDynamicsEnginePlusDrivenWheels +(const ImplicitSolverInput& input, ImplicitSolverOutput* output) +{ + const PxF32 subTimestep = input.subTimeStep; + const PxF32 K = input.K; + const PxF32 G = input.G; + const PxVehicleClutchAccuracyMode::Enum accuracyMode = input.accuracyMode; + const PxU32 maxIterations = input.maxNumIterations; + const PxF32 engineDriveTorque = input.engineDriveTorque; + const PxF32 engineDampingRate = input.engineDampingRate; + const PxF32* PX_RESTRICT diffTorqueRatios = input.diffTorqueRatios; + const PxF32* PX_RESTRICT aveWheelSpeedContributions = input.aveWheelSpeedContributions; + const PxF32* PX_RESTRICT brakeTorques = input.brakeTorques; + const bool* PX_RESTRICT isBrakeApplied = input.isBrakeApplied; + const PxF32* PX_RESTRICT tireTorques = input.tireTorques; + const PxVehicleWheels4SimData& wheels4SimData = *input.wheels4SimData; + const PxVehicleDriveSimData4W& driveSimData = *static_cast(input.driveSimData); + + PxVehicleDriveDynData* driveDynData = output->driveDynData; + PxVehicleWheels4DynData* wheels4DynData = output->wheelsDynData; + + const PxF32 KG=K*G; + const PxF32 KGG=K*G*G; + + MatrixNN A(4+1); + VectorN b(4+1); + VectorN result(4+1); + + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + + const PxF32* PX_RESTRICT wheelSpeeds=wheels4DynData->mWheelSpeeds; + const PxF32 engineOmega=driveDynData->getEngineRotationSpeed(); + + // + //torque at clutch: + //tc = K*{G*[alpha0*w0 + alpha1*w1 + alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng} + //where + //(i) G is the gearing ratio, + //(ii) alphai is the fractional contribution of the ith wheel to the average wheel speed at the clutch (alpha(i) is zero for undriven wheels) + //(iii) wi is the angular speed of the ith wheel + //(iv) K is the clutch strength + //(v) wEng is the angular speed of the engine + + //torque applied to ith wheel is + //ti = G*gammai*tc + bt(i) + tt(i) + //where + //gammai is the fractional proportion of the clutch torque that the differential delivers to the ith wheel + //bt(i) is the brake torque applied to the ith wheel + //tt(i) is the tire torque applied to the ith wheel + + //acceleration applied to ith wheel is + //ai = G*gammai*K*{G*[alpha0*w0 + alpha1*w1 alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng}/Ii + (bt(i) + tt(i))/Ii + //wheer Ii is the moi of the ith wheel + + //express ai as + //ai = [wi(t+dt) - wi(t)]/dt + //and rearrange + //wi(t+dt) - wi(t)] = dt*G*gammai*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1)(t+dt)] - wEng(t+dt)}/Ii + dt*(bt(i) + tt(i))/Ii + + //Do the same for tEng (torque applied to engine) + //tEng = -tc + engineDriveTorque + //where engineDriveTorque is the drive torque applied to the engine + //Assuming the engine has unit mass then + //wEng(t+dt) -wEng(t) = -dt*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1(t+dt))] - wEng(t+dt)}/Ieng + dt*engineDriveTorque]/IEng + + //Introduce the vector w=(w0,w1,w2....w(N-1), wEng) + //and re-express as a matrix after collecting all unknowns at (t+dt) and knowns at time t. + //A*w(t+dt)=b(t); + + //Wheels. + { + for(PxU32 i=0;i<4;i++) + { + const PxF32 dt=subTimestep*wheels4SimData.getWheelData(i).getRecipMOI(); + const PxF32 R=diffTorqueRatios[i]; + const PxF32 dtKGGR=dt*KGG*R; + A.set(i,0,dtKGGR*aveWheelSpeedContributions[0]); + A.set(i,1,dtKGGR*aveWheelSpeedContributions[1]); + A.set(i,2,dtKGGR*aveWheelSpeedContributions[2]); + A.set(i,3,dtKGGR*aveWheelSpeedContributions[3]); + A.set(i,i,1.0f+dtKGGR*aveWheelSpeedContributions[i]+dt*wheels4SimData.getWheelData(i).mDampingRate); + A.set(i,4,-dt*KG*R); + b[i] = wheelSpeeds[i] + dt*(brakeTorques[i]+tireTorques[i]); + result[i] = wheelSpeeds[i]; + } + } + + //Engine. + { + const PxF32 dt=subTimestep*driveSimData.getEngineData().getRecipMOI(); + const PxF32 dtKG=dt*K*G; + A.set(4,0,-dtKG*aveWheelSpeedContributions[0]); + A.set(4,1,-dtKG*aveWheelSpeedContributions[1]); + A.set(4,2,-dtKG*aveWheelSpeedContributions[2]); + A.set(4,3,-dtKG*aveWheelSpeedContributions[3]); + A.set(4,4,1.0f + dt*(K+engineDampingRate)); + b[4] = engineOmega + dt*engineDriveTorque; + result[4] = engineOmega; + } + + //Solve Aw=b + if(PxVehicleClutchAccuracyMode::eBEST_POSSIBLE == accuracyMode) + { + MatrixNNLUSolver solver; + solver.decomposeLU(A); + solver.solve(b,result); + PX_WARN_ONCE_IF(!isValid(A,b,result), "Unable to compute new PxVehicleDrive4W internal rotation speeds. Please check vehicle sim data, especially clutch strength; engine moi and damping; wheel moi and damping"); + } + else + { + MatrixNGaussSeidelSolver solver; + solver.solve(maxIterations, gSolverTolerance, A, b, result); + } + + //Check for sanity in the resultant internal rotation speeds. + //If the brakes are on and the wheels have switched direction then lock them at zero. + //A consequence of this quick fix is that locked wheels remain locked until the brake is entirely released. + //This isn't strictly mathematically or physically correct - a more accurate solution would either formulate the + //brake as a lcp problem or repeatedly solve with constraints that locked wheels remain at zero rotation speed. + //The physically correct solution will certainly be more expensive so let's live with the restriction that + //locked wheels remain locked until the brake is released. + //newOmega=result[i], oldOmega=wheelSpeeds[i], if newOmega*oldOmega<=0 and isBrakeApplied then lock wheel. + result[0]=(isBrakeApplied[0] && (wheelSpeeds[0]*result[0]<=0)) ? 0.0f : result[0]; + result[1]=(isBrakeApplied[1] && (wheelSpeeds[1]*result[1]<=0)) ? 0.0f : result[1]; + result[2]=(isBrakeApplied[2] && (wheelSpeeds[2]*result[2]<=0)) ? 0.0f : result[2]; + result[3]=(isBrakeApplied[3] && (wheelSpeeds[3]*result[3]<=0)) ? 0.0f : result[3]; + //Clamp the engine revs. + //Again, this is not physically or mathematically correct but the loss in behaviour will be hard to notice. + //The alternative would be to add constraints to the solver, which would be much more expensive. + result[4]=PxClamp(result[4],0.0f,engineData.mMaxOmega); + + //Copy back to the car's internal rotation speeds. + wheels4DynData->mWheelSpeeds[0]=result[0]; + wheels4DynData->mWheelSpeeds[1]=result[1]; + wheels4DynData->mWheelSpeeds[2]=result[2]; + wheels4DynData->mWheelSpeeds[3]=result[3]; + driveDynData->setEngineRotationSpeed(result[4]); +} + +void solveDriveNWInternalDynamicsEnginePlusDrivenWheels +(const ImplicitSolverInput& input, ImplicitSolverOutput* output) +{ + const PxF32 subTimestep = input.subTimeStep; + //const PxF32 brake = input.brake; + //const PxF32 handbrake = input.handBrake; + const PxF32 K = input.K; + const PxF32 G = input.G; + const PxVehicleClutchAccuracyMode::Enum accuracyMode = input.accuracyMode; + const PxU32 maxIterations = input.maxNumIterations; + const PxF32 engineDriveTorque = input.engineDriveTorque; + const PxF32 engineDampingRate = input.engineDampingRate; + const PxF32* PX_RESTRICT diffTorqueRatios = input.diffTorqueRatios; + const PxF32* PX_RESTRICT aveWheelSpeedContributions = input.aveWheelSpeedContributions; + const PxF32* PX_RESTRICT brakeTorques = input.brakeTorques; + const bool* PX_RESTRICT isBrakeApplied = input.isBrakeApplied; + const PxF32* PX_RESTRICT tireTorques = input.tireTorques; + //const PxU32 numWheels4 = input.numWheels4; + const PxU32 numActiveWheels = input.numActiveWheels; + const PxVehicleWheels4SimData* PX_RESTRICT wheels4SimDatas = input.wheels4SimData; + const PxVehicleDriveSimDataNW& driveSimData = *static_cast(input.driveSimData); + + PxVehicleDriveDynData* driveDynData = output->driveDynData; + PxVehicleWheels4DynData* wheels4DynDatas = output->wheelsDynData; + + const PxF32 KG=K*G; + const PxF32 KGG=K*G*G; + + MatrixNN A(numActiveWheels+1); + VectorN b(numActiveWheels+1); + VectorN result(numActiveWheels+1); + + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + const PxF32 engineOmega=driveDynData->getEngineRotationSpeed(); + + // + //torque at clutch: + //tc = K*{G*[alpha0*w0 + alpha1*w1 + alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng} + //where + //(i) G is the gearing ratio, + //(ii) alphai is the fractional contribution of the ith wheel to the average wheel speed at the clutch (alpha(i) is zero for undriven wheels) + //(iii) wi is the angular speed of the ith wheel + //(iv) K is the clutch strength + //(v) wEng is the angular speed of the engine + + //torque applied to ith wheel is + //ti = G*gammai*tc + bt(i) + tt(i) + //where + //gammai is the fractional proportion of the clutch torque that the differential delivers to the ith wheel + //bt(i) is the brake torque applied to the ith wheel + //tt(i) is the tire torque applied to the ith wheel + + //acceleration applied to ith wheel is + //ai = G*gammai*K*{G*[alpha0*w0 + alpha1*w1 alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng}/Ii + (bt(i) + tt(i))/Ii + //wheer Ii is the moi of the ith wheel. + + //express ai as + //ai = [wi(t+dt) - wi(t)]/dt + //and rearrange + //wi(t+dt) - wi(t)] = dt*G*gammai*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1)(t+dt)] - wEng(t+dt)}/Ii + dt*(bt(i) + tt(i))/Ii + + //Do the same for tEng (torque applied to engine) + //tEng = -tc + engineDriveTorque + //where engineDriveTorque is the drive torque applied to the engine + //Assuming the engine has unit mass then + //wEng(t+dt) -wEng(t) = -dt*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1(t+dt))] - wEng(t+dt)}/Ieng + dt*engineDriveTorque/Ieng + + //Introduce the vector w=(w0,w1,w2....w(N-1), wEng) + //and re-express as a matrix after collecting all unknowns at (t+dt) and knowns at time t. + //A*w(t+dt)=b(t); + + //Wheels. + for(PxU32 i=0;i>2].getWheelData(i&3).getRecipMOI(); + const PxF32 R=diffTorqueRatios[i]; + const PxF32 dtKGGR=dt*KGG*R; + + for(PxU32 j=0;j>2].getWheelData(i&3).mDampingRate); + A.set(i,numActiveWheels,-dt*KG*R); + b[i] = wheels4DynDatas[i>>2].mWheelSpeeds[i&3] + dt*(brakeTorques[i]+tireTorques[i]); + result[i] = wheels4DynDatas[i>>2].mWheelSpeeds[i&3]; + } + + //Engine. + { + const PxF32 dt=subTimestep*driveSimData.getEngineData().getRecipMOI(); + const PxF32 dtKG=dt*K*G; + for(PxU32 i=0;i>2].mWheelSpeeds[i&3]*result[i]<=0)) ? 0.0f : result[i]; + } + //Clamp the engine revs. + //Again, this is not physically or mathematically correct but the loss in behaviour will be hard to notice. + result[numActiveWheels]=PxClamp(result[numActiveWheels],0.0f,engineData.mMaxOmega); + + //Copy back to the car's internal rotation speeds. + for(PxU32 i=0;i>2].mWheelSpeeds[i&3]=result[i]; + } + driveDynData->setEngineRotationSpeed(result[numActiveWheels]); +} + + +void solveTankInternaDynamicsEnginePlusDrivenWheels +(const ImplicitSolverInput& input, const bool* PX_RESTRICT activeWheelStates, const PxF32* PX_RESTRICT wheelGearings, ImplicitSolverOutput* output) +{ + PX_SIMD_GUARD; // denormal exception triggered at oldOmega*newOmega on osx + const PxF32 subTimestep = input.subTimeStep; + const PxF32 K = input.K; + const PxF32 G = input.G; + const PxF32 engineDriveTorque = input.engineDriveTorque; + const PxF32 engineDampingRate = input.engineDampingRate; + const PxF32* PX_RESTRICT diffTorqueRatios = input.diffTorqueRatios; + const PxF32* PX_RESTRICT aveWheelSpeedContributions = input.aveWheelSpeedContributions; + const PxF32* PX_RESTRICT brakeTorques = input.brakeTorques; + const bool* PX_RESTRICT isBrakeApplied = input.isBrakeApplied; + const PxF32* PX_RESTRICT tireTorques = input.tireTorques; + const PxU32 numWheels4 = input.numWheels4; + const PxU32 numActiveWheels = input.numActiveWheels; + const PxVehicleWheels4SimData* PX_RESTRICT wheels4SimDatas = input.wheels4SimData; + const PxVehicleDriveSimData& driveSimData = *input.driveSimData; + + PxVehicleWheels4DynData* PX_RESTRICT wheels4DynDatas = output->wheelsDynData; + PxVehicleDriveDynData* driveDynData = output->driveDynData; + + const PxF32 KG=K*G; + const PxF32 KGG=K*G*G; + + //Rearrange data in a single array rather than scattered in blocks of 4. + //This makes it easier later on. + PxF32 recipMOI[PX_MAX_NB_WHEELS]; + PxF32 dampingRates[PX_MAX_NB_WHEELS]; + PxF32 wheelSpeeds[PX_MAX_NB_WHEELS]; + PxF32 wheelRecipRadii[PX_MAX_NB_WHEELS]; + + for(PxU32 i=0;igetEngineRotationSpeed(); + + const PxF32 dt=subTimestep*driveSimData.getEngineData().getRecipMOI(); + const PxF32 dtKG=dt*K*G; + for(PxU32 i=0;isetEngineRotationSpeed(newEngineOmega); +} + +//////////////////////////////////////////////////////////////////////////// +//Integrate wheel rotation speeds of wheels not connected to the differential. +//Obviously, no wheels in a PxVehicleNoDrive are connected to a diff so all require +//direct integration. +//Only the first 4 wheels of a PxVehicleDrive4W are connected to the diff so +//any extra wheels need direct integration. +//All tank wheels are connected to the diff so none need integrated in a separate pass. +//What about undriven wheels in a PxVehicleDriveNW? This vehicle type treats all +//wheels as being connected to the diff but sets the diff contribution to zero for +//all undriven wheels. No wheels from a PxVehicleNW need integrated in a separate pass. +//////////////////////////////////////////////////////////////////////////// + +void integrateNoDriveWheelSpeeds +(const PxF32 subTimestep, + const PxF32* PX_RESTRICT brakeTorques, const bool* PX_RESTRICT isBrakeApplied, const PxF32* driveTorques, const PxF32* PX_RESTRICT tireTorques, const PxF32* PX_RESTRICT dampingRates, + const PxVehicleWheels4SimData& vehSuspWheelTire4SimData, PxVehicleWheels4DynData& vehSuspWheelTire4) +{ + //w(t+dt) = w(t) + (1/inertia)*(brakeTorque + driveTorque + tireTorque)*dt - (1/inertia)*damping*w(t)*dt ) (1) + //Apply implicit trick and rearrange. + //w(t+dt)[1 + (1/inertia)*damping*dt] = w(t) + (1/inertia)*(brakeTorque + driveTorque + tireTorque)*dt (2) + + //Introduce (1/inertia)*dt to avoid duplication in (2) + PxF32 subTimeSteps[4] = + { + subTimestep*vehSuspWheelTire4SimData.getWheelData(0).getRecipMOI(), + subTimestep*vehSuspWheelTire4SimData.getWheelData(1).getRecipMOI(), + subTimestep*vehSuspWheelTire4SimData.getWheelData(2).getRecipMOI(), + subTimestep*vehSuspWheelTire4SimData.getWheelData(3).getRecipMOI() + }; + + //Integrate. + //w += torque*dt/inertia - damping*dt*w + //Use implicit integrate trick and rearrange + //w(t+dt) = [w(t) + torque*dt/inertia]/[1 + damping*dt] + const PxF32* PX_RESTRICT wheelSpeeds=vehSuspWheelTire4.mWheelSpeeds; + PxF32 result[4]= + { + (wheelSpeeds[0] + subTimeSteps[0]*(tireTorques[0] + driveTorques[0] + brakeTorques[0]))/(1.0f + dampingRates[0]*subTimeSteps[0]), + (wheelSpeeds[1] + subTimeSteps[1]*(tireTorques[1] + driveTorques[1] + brakeTorques[1]))/(1.0f + dampingRates[1]*subTimeSteps[1]), + (wheelSpeeds[2] + subTimeSteps[2]*(tireTorques[2] + driveTorques[2] + brakeTorques[2]))/(1.0f + dampingRates[2]*subTimeSteps[2]), + (wheelSpeeds[3] + subTimeSteps[3]*(tireTorques[3] + driveTorques[3] + brakeTorques[3]))/(1.0f + dampingRates[3]*subTimeSteps[3]), + }; + + //Check for sanity in the resultant internal rotation speeds. + //If the brakes are on and the wheels have switched direction then lock them at zero. + //newOmega=result[i], oldOmega=wheelSpeeds[i], if newOmega*oldOmega<=0 and isBrakeApplied then lock wheel. + result[0]=(isBrakeApplied[0] && (wheelSpeeds[0]*result[0]<=0)) ? 0.0f : result[0]; + result[1]=(isBrakeApplied[1] && (wheelSpeeds[1]*result[1]<=0)) ? 0.0f : result[1]; + result[2]=(isBrakeApplied[2] && (wheelSpeeds[2]*result[2]<=0)) ? 0.0f : result[2]; + result[3]=(isBrakeApplied[3] && (wheelSpeeds[3]*result[3]<=0)) ? 0.0f : result[3]; + + //Copy back to the car's internal rotation speeds. + vehSuspWheelTire4.mWheelSpeeds[0]=result[0]; + vehSuspWheelTire4.mWheelSpeeds[1]=result[1]; + vehSuspWheelTire4.mWheelSpeeds[2]=result[2]; + vehSuspWheelTire4.mWheelSpeeds[3]=result[3]; +} + +void integrateUndriveWheelRotationSpeeds +(const PxF32 subTimestep, + const PxF32 brake, const PxF32 handbrake, const PxF32* PX_RESTRICT tireTorques, const PxF32* PX_RESTRICT brakeTorques, + const PxVehicleWheels4SimData& vehSuspWheelTire4SimData, PxVehicleWheels4DynData& vehSuspWheelTire4) +{ + for(PxU32 i=0;i<4;i++) + { + //Compute the new angular speed of the wheel. + const PxF32 oldOmega=vehSuspWheelTire4.mWheelSpeeds[i]; + const PxF32 dtI = subTimestep*vehSuspWheelTire4SimData.getWheelData(i).getRecipMOI(); + const PxF32 gamma = vehSuspWheelTire4SimData.getWheelData(i).mDampingRate; + const PxF32 newOmega=(oldOmega+dtI*(tireTorques[i]+brakeTorques[i]))/(1.0f + gamma*dtI); + + //Has the brake been applied? It's hard to tell from brakeTorques[j] because that + //will be zero if the wheel is locked. Work it out from the brake and handbrake data. + const PxF32 brakeGain=vehSuspWheelTire4SimData.getWheelData(i).mMaxBrakeTorque; + const PxF32 handbrakeGain=vehSuspWheelTire4SimData.getWheelData(i).mMaxHandBrakeTorque; + + //Work out if the wheel should be locked. + const bool brakeApplied=((brake*brakeGain + handbrake*handbrakeGain)!=0.0f); + const bool wheelReversed=(oldOmega*newOmega <=0); + const bool wheelLocked=(brakeApplied && wheelReversed); + + //Lock the wheel or apply its new angular speed. + if(!wheelLocked) + { + vehSuspWheelTire4.mWheelSpeeds[i]=newOmega; + } + else + { + vehSuspWheelTire4.mWheelSpeeds[i]=0.0f; + } + } +} + + +//////////////////////////////////////////////////////////////////////////// +//Pose the wheels. +//First integrate the wheel rotation angles and clamp them to a range (-10*pi, 10*pi) +//PxVehicleNoDrive has a different way of telling if a wheel is driven by a drive torque so has a separate function. +//Use the wheel steer/rotation/camber angle and suspension jounce to compute the local transform of each wheel. +//////////////////////////////////////////////////////////////////////////// + +void integrateWheelRotationAngles +(const PxF32 timestep, + const PxF32 K, const PxF32 G, const PxF32 engineDriveTorque, + const PxF32* PX_RESTRICT jounces, const PxF32* PX_RESTRICT diffTorqueRatios, const PxF32* PX_RESTRICT forwardSpeeds, const bool* isBrakeApplied, + const PxVehicleDriveSimData& vehCoreSimData, const PxVehicleWheels4SimData& vehSuspWheelTire4SimData, + PxVehicleDriveDynData& vehCore, PxVehicleWheels4DynData& vehSuspWheelTire4) +{ + PX_SIMD_GUARD; //denorm exception on newRotAngle=wheelRotationAngles[j]+wheelOmega*timestep; on osx + + PX_UNUSED(vehCore); + PX_UNUSED(vehCoreSimData); + + const PxF32 KG=K*G; + + PxF32* PX_RESTRICT wheelSpeeds=vehSuspWheelTire4.mWheelSpeeds; + PxF32* PX_RESTRICT wheelRotationAngles=vehSuspWheelTire4.mWheelRotationAngles; + PxF32* PX_RESTRICT correctedWheelSpeeds = vehSuspWheelTire4.mCorrectedWheelSpeeds; + + for(PxU32 j=0;j<4;j++) + { + //At low vehicle forward speeds we have some numerical difficulties getting the + //wheel rotation speeds to be correct due to the tire model's difficulties at low vz. + //The solution is to blend between the rolling speed at the wheel and the wheel's actual rotation speed. + //If the wheel is + //(i) in the air or, + //(ii) under braking torque or, + //(iii) driven by the engine through the gears and diff + //then always use the wheel's actual rotation speed. + //Just to be clear, this means we will blend when the wheel + //(i) is on the ground and + //(ii) has no brake applied and + //(iii) has no drive torque applied from the clutch and + //(iv) is at low forward speed + PxF32 wheelOmega=wheelSpeeds[j]; + if(jounces[j] > -vehSuspWheelTire4SimData.getSuspensionData(j).mMaxDroop && //(i) wheel touching ground + false==isBrakeApplied[j] && //(ii) no brake applied + 0.0f==diffTorqueRatios[j]*KG*engineDriveTorque && //(iii) no drive torque applied + PxAbs(forwardSpeeds[j]) -vehSuspWheelTire4SimData.getSuspensionData(j).mMaxDroop && //(i) wheel touching ground + false==isBrakeApplied[j] && //(ii) no brake applied + 0.0f==driveTorques[j] && //(iii) no drive torque applied + PxAbs(forwardSpeeds[j]) 0.0f) + { + camberAngle += jounce*suspData.mCamberAtMaxCompression*suspData.getRecipMaxCompression(); + } + else + { + camberAngle -= jounce*suspData.mCamberAtMaxDroop*suspData.getRecipMaxDroop(); + } + const PxQuat quat(steerAngle, upAxis); + const PxQuat quat2(camberAngle, quat.rotate(forwardAxis)); + const PxQuat quat3 = quat2*quat; + const PxQuat quat4(rotationAngle, quat3.rotate(sideAxis)); + const PxQuat result = quat4*quat3; + return result; +} + +void computeWheelLocalPoses +(const PxVehicleWheels4SimData& wheelsSimData, + const PxVehicleWheels4DynData& wheelsDynData, + const PxWheelQueryResult* wheelQueryResults, + const PxU32 numWheelsToPose, + const PxTransform& vehChassisCMLocalPose, + const PxVec3& upAxis, + const PxVec3& sideAxis, + const PxVec3& forwardAxis, + PxTransform* localPoses) +{ + const PxF32* PX_RESTRICT rotAngles=wheelsDynData.mWheelRotationAngles; + const PxVec3 cmOffset=vehChassisCMLocalPose.p; + for(PxU32 i=0;igetShapes(shapeBuffer,128,0); + + for(PxU32 i=0;igetShapes(shapeBuffer2,1,PxU32(shapeIndex)); + currShape = shapeBuffer2[0]; + } + PX_ASSERT(currShape); + currShape->setLocalPose(localPoses[i]); + } + } +} + + + +//////////////////////////////////////////////////////////////////////////// +//Update each vehicle type with a special function +//////////////////////////////////////////////////////////////////////////// + +class PxVehicleUpdate +{ +public: + +#if PX_DEBUG_VEHICLE_ON + static void updateSingleVehicleAndStoreTelemetryData( + const PxF32 timestep, const PxVec3& gravity, const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, + PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleTelemetryData& telemetryData, + PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxVehicleContext&); +#endif + + static void update( + const PxF32 timestep, const PxVec3& gravity, const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, + const PxU32 numVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* wheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, + VehicleTelemetryDataContext* vehicleTelemetryDataContext, const PxVehicleContext&); + + static void updatePost( + const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 numVehicles, PxVehicleWheels** vehicles, + const PxVehicleContext&); + + static void suspensionRaycasts( + PxBatchQueryExt* batchQuery, + const PxU32 numVehicles, PxVehicleWheels** vehicles, + const bool* vehiclesToRaycast, const PxQueryFlags queryFlags); + + static void suspensionSweeps( + PxBatchQueryExt* batchQuery, + const PxU32 numVehicles, PxVehicleWheels** vehicles, + const PxU16 nbHitsPerQuery, + const bool* vehiclesToRaycast, + const PxF32 sweepWidthScale, const PxF32 sweepRadiusScale, const PxF32 sweepInflation, const PxQueryFlags queryFlags, + const PxVec3& upAxis, const PxVec3& forwardAxis, const PxVec3& sideAxis); + + static void updateDrive4W( + const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleDrive4W* vehDrive4W, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext*, const PxVehicleContext&); + + static void updateDriveNW( + const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleDriveNW* vehDriveNW, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext*, const PxVehicleContext&); + + static void updateTank( + const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleDriveTank* vehDriveTank, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext*, const PxVehicleContext&); + + static void updateNoDrive( + const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleNoDrive* vehDriveTank, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext*, const PxVehicleContext&); + + static PxU32 computeNumberOfSubsteps(const PxVehicleWheelsSimData& wheelsSimData, const PxVec3& linVel, const PxTransform& globalPose, const PxVec3& forward) + { + const PxVec3 z=globalPose.q.rotate(forward); + const PxF32 vz=PxAbs(linVel.dot(z)); + const PxF32 thresholdVz=wheelsSimData.mThresholdLongitudinalSpeed; + const PxU32 lowCount=wheelsSimData.mLowForwardSpeedSubStepCount; + const PxU32 highCount=wheelsSimData.mHighForwardSpeedSubStepCount; + const PxU32 count=(vz> 2; + PxVehicleWheels4DynData* wheels4 = wheels.getWheel4DynData(); + for(PxU32 i = 0; i < nbWheels4; i++) + { + wheels4[i].setInternalDynamicsToZero(); + } + } + + PX_INLINE static void setInternalDynamicsToZero(PxVehicleDriveDynData& drive) + { + drive.setEngineRotationSpeed(0.0f); + } + + PX_INLINE static void setInternalDynamicsToZero(PxVehicleNoDrive* veh) + { + setInternalDynamicsToZero(veh->mWheelsDynData); + } + + PX_INLINE static void setInternalDynamicsToZero(PxVehicleDrive4W* veh) + { + setInternalDynamicsToZero(veh->mWheelsDynData); + setInternalDynamicsToZero(veh->mDriveDynData); + } + + PX_INLINE static void setInternalDynamicsToZero(PxVehicleDriveNW* veh) + { + veh->mDriveDynData.setEngineRotationSpeed(0.0f); + setInternalDynamicsToZero(veh->mWheelsDynData); + setInternalDynamicsToZero(veh->mDriveDynData); + } + + PX_INLINE static void setInternalDynamicsToZero(PxVehicleDriveTank* veh) + { + setInternalDynamicsToZero(veh->mWheelsDynData); + setInternalDynamicsToZero(veh->mDriveDynData); + } + + + PX_INLINE static bool isOnDynamicActor(const PxVehicleWheelsSimData& wheelsSimData, const PxVehicleWheelsDynData& wheelsDynData) + { + const PxU32 numWheels4 = wheelsSimData.mNbWheels4; + const PxVehicleWheels4DynData* PX_RESTRICT wheels4DynDatas = wheelsDynData.mWheels4DynData; + + for(PxU32 i=0;iis()) + return true; + } + } + } + + return false; + } + + PX_INLINE static void storeRaycasts(const PxVehicleWheels4DynData& dynData, PxWheelQueryResult* wheelQueryResults) + { + if(dynData.mRaycastResults) + { + for(PxU32 i=0;i<4;i++) + { + const PxVehicleWheels4DynData::SuspLineRaycast& raycast = + reinterpret_cast(dynData.mQueryOrCachedHitResults); + + wheelQueryResults[i].suspLineStart=raycast.mStarts[i]; + wheelQueryResults[i].suspLineDir=raycast.mDirs[i]; + wheelQueryResults[i].suspLineLength=raycast.mLengths[i]; + } + } + else if(dynData.mSweepResults) + { + for(PxU32 i=0;i<4;i++) + { + const PxVehicleWheels4DynData::SuspLineSweep& sweep = + reinterpret_cast(dynData.mQueryOrCachedHitResults); + + wheelQueryResults[i].suspLineStart=sweep.mStartPose[i].p; + wheelQueryResults[i].suspLineDir=sweep.mDirs[i]; + wheelQueryResults[i].suspLineLength=sweep.mLengths[i]; + } + } + else + { + for(PxU32 i=0;i<4;i++) + { + wheelQueryResults[i].suspLineStart=PxVec3(0,0,0); + wheelQueryResults[i].suspLineDir=PxVec3(0,0,0); + wheelQueryResults[i].suspLineLength=0; + } + } + } + + PX_INLINE static void storeSuspWheelTireResults + (const ProcessSuspWheelTireOutputData& outputData, const PxF32* steerAngles, PxWheelQueryResult* wheelQueryResults, const PxU32 numWheels) + { + for(PxU32 i=0;imDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL]>-0.01f && + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL]<1.01f, + "Illegal vehicle control value - accel must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE]>-0.01f && + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE]<1.01f, + "Illegal vehicle control value - brake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE]>-0.01f && + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE]<1.01f, + "Illegal vehicle control value - handbrake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT]>-1.01f && + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT]<1.01f, + "Illegal vehicle control value - left steer must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT]>-1.01f && + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT]<1.01f, + "Illegal vehicle control value - right steer must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + PxAbs(vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT]- + vehDrive4W->mDriveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT])<1.01f, + "Illegal vehicle control value - right steer value minus left steer value must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + !(vehDrive4W->getRigidDynamicActor()->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), + "Attempting to update a drive4W with a kinematic actor - this isn't allowed"); + PX_CHECK_AND_RETURN( + NULL==vehWheelQueryResults || vehWheelQueryResults->nbWheelQueryResults >= vehDrive4W->mWheelsSimData.getNbWheels(), + "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle"); + PX_CHECK_AND_RETURN( + NULL==vehConcurrentUpdates || vehConcurrentUpdates->nbConcurrentWheelUpdates >= vehDrive4W->mWheelsSimData.getNbWheels(), + "vehConcurrentUpdates->nbConcurrentWheelUpdates must always be greater than or equal to number of wheels in corresponding vehicle"); + +#if PX_CHECKED + { + //Check that the sense of left/right and forward/rear is true. + const PxVec3 fl=vehDrive4W->mWheelsSimData.mWheels4SimData[0].getWheelCentreOffset(PxVehicleDrive4WWheelOrder::eFRONT_LEFT); + const PxVec3 fr=vehDrive4W->mWheelsSimData.mWheels4SimData[0].getWheelCentreOffset(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT); + const PxVec3 rl=vehDrive4W->mWheelsSimData.mWheels4SimData[0].getWheelCentreOffset(PxVehicleDrive4WWheelOrder::eREAR_LEFT); + const PxVec3 rr=vehDrive4W->mWheelsSimData.mWheels4SimData[0].getWheelCentreOffset(PxVehicleDrive4WWheelOrder::eREAR_RIGHT); + const PxVec3 right=context.sideAxis; + const PxF32 s0=computeSign((fr-fl).dot(right)); + const PxF32 s1=computeSign((rr-rl).dot(right)); + PX_CHECK_AND_RETURN(0==s0 || 0==s1 || s0==s1, "PxVehicle4W does not obey the rule that the eFRONT_RIGHT/eREAR_RIGHT wheels are to the right of the eFRONT_LEFT/eREAR_LEFT wheels"); + } +#endif + + END_TIMER(TIMER_ADMIN); + START_TIMER(TIMER_GRAPHS); + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + for(PxU32 i=0;imWheelsSimData.mNbWheels4;i++) + { + updateGraphDataInternalWheelDynamics(4*i,vehDrive4W->mWheelsDynData.mWheels4DynData[i].mWheelSpeeds, vehTelemetryDataContext->wheelGraphData); + } + updateGraphDataInternalEngineDynamics(vehDrive4W->mDriveDynData.getEngineRotationSpeed(), vehTelemetryDataContext->engineGraphData); + } +#endif + + END_TIMER(TIMER_GRAPHS); + START_TIMER(TIMER_ADMIN); + + //Unpack the vehicle. + //Unpack the 4W simulation and instanced dynamics components. + const PxVehicleWheels4SimData* wheels4SimDatas=vehDrive4W->mWheelsSimData.mWheels4SimData; + const PxVehicleTireLoadFilterData& tireLoadFilterData=vehDrive4W->mWheelsSimData.mNormalisedLoadFilter; + PxVehicleWheels4DynData* wheels4DynDatas=vehDrive4W->mWheelsDynData.mWheels4DynData; + const PxU32 numWheels4=vehDrive4W->mWheelsSimData.mNbWheels4; + const PxU32 numActiveWheels=vehDrive4W->mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=4-(4*numWheels4 - numActiveWheels); + const PxVehicleDriveSimData4W driveSimData=vehDrive4W->mDriveSimData; + PxVehicleDriveDynData& driveDynData=vehDrive4W->mDriveDynData; + PxRigidDynamic* vehActor=vehDrive4W->mActor; + + //We need to store that data we are going to write to actors so we can do this at the end in one go with fewer write locks. + PxVehicleWheelConcurrentUpdateData wheelConcurrentUpdates[PX_MAX_NB_WHEELS]; + PxVehicleConcurrentUpdateData vehicleConcurrentUpdates; + vehicleConcurrentUpdates.nbConcurrentWheelUpdates = numActiveWheels; + vehicleConcurrentUpdates.concurrentWheelUpdates = wheelConcurrentUpdates; + + //Test if a non-zero drive torque was applied or if a non-zero steer angle was applied. + bool finiteInputApplied=false; + if(0!=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT) || + 0!=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT) || + 0!=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL) || + driveDynData.getGearDown() || driveDynData.getGearUp()) + { + finiteInputApplied=true; + } + + //Awake or sleep. + if(vehActor->getScene() && vehActor->isSleeping()) //Support case where actor is not in a scene and constraints get solved via immediate mode + { + if(finiteInputApplied) + { + //Driving inputs so we need the actor to start moving. + vehicleConcurrentUpdates.wakeup = true; + } + else if(isOnDynamicActor(vehDrive4W->mWheelsSimData, vehDrive4W->mWheelsDynData)) + { + //Driving on dynamic so we need to keep moving. + vehicleConcurrentUpdates.wakeup = true; + } + else + { + //No driving inputs and the actor is asleep. + //Set internal dynamics to zero. + setInternalDynamicsToZero(vehDrive4W); + if(vehConcurrentUpdates) vehConcurrentUpdates->staySleeping = true; + return; + } + } + + //In each block of 4 wheels record how many wheels are active. + PxU32 numActiveWheelsPerBlock4[PX_MAX_NB_SUSPWHEELTIRE4]={0,0,0,0,0}; + numActiveWheelsPerBlock4[0]=PxMin(numActiveWheels,PxU32(4)); + for(PxU32 i=1;imWheelsDynData.mTireForceCalculators->mShaderData[4*i+0]; + tires4ForceCalculators[i].mShaderData[1]=vehDrive4W->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+1]; + tires4ForceCalculators[i].mShaderData[2]=vehDrive4W->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+2]; + tires4ForceCalculators[i].mShaderData[3]=vehDrive4W->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+3]; + tires4ForceCalculators[i].mShader=vehDrive4W->mWheelsDynData.mTireForceCalculators->mShader; + } + + //Mark the constraints as dirty to force them to be updated in the sdk. + for(PxU32 i=0;imarkDirty(); + } + + //We need to store data to pose the wheels at the end. + PxWheelQueryResult wheelQueryResults[PX_MAX_NB_WHEELS]; + + END_TIMER(TIMER_ADMIN); + START_TIMER(TIMER_COMPONENTS_UPDATE); + + //Center of mass local pose. + PxTransform carChassisCMLocalPose; + //Compute the transform of the center of mass. + PxTransform origCarChassisTransform; + PxTransform carChassisTransform; + //Inverse mass and inertia to apply the tire/suspension forces as impulses. + PxF32 inverseChassisMass; + PxVec3 inverseInertia; + //Linear and angular velocity. + PxVec3 carChassisLinVel; + PxVec3 carChassisAngVel; + { + carChassisCMLocalPose = vehActor->getCMassLocalPose(); + carChassisCMLocalPose.q = PxQuat(PxIdentity); + origCarChassisTransform = vehActor->getGlobalPose().transform(carChassisCMLocalPose); + carChassisTransform = origCarChassisTransform; + const PxF32 chassisMass = vehActor->getMass(); + inverseChassisMass = 1.0f/chassisMass; + inverseInertia = vehActor->getMassSpaceInvInertiaTensor(); + carChassisLinVel = vehActor->getLinearVelocity(); + carChassisAngVel = vehActor->getAngularVelocity(); + } + + //Update the auto-box and decide whether to change gear up or down. + PxF32 autoboxCompensatedAnalogAccel = driveDynData.mControlAnalogVals[PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL]; + if(driveDynData.getUseAutoGears()) + { + autoboxCompensatedAnalogAccel = processAutoBox(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL,timestep,driveSimData,driveDynData); + } + + //Process gear-up/gear-down commands. + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + processGears(timestep,gearsData,driveDynData); + } + + //Clutch strength; + PxF32 K; + { + const PxVehicleClutchData& clutchData=driveSimData.getClutchData(); + const PxU32 currentGear=driveDynData.getCurrentGear(); + K=computeClutchStrength(clutchData, currentGear); + } + + //Clutch accuracy + PxVehicleClutchAccuracyMode::Enum clutchAccuracyMode; + PxU32 clutchMaxIterations; + { + const PxVehicleClutchData& clutchData=driveSimData.getClutchData(); + clutchAccuracyMode = clutchData.mAccuracyMode; + clutchMaxIterations = clutchData.mEstimateIterations; + } + + //Gear ratio. + PxF32 G; + PxU32 currentGear; + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + currentGear=driveDynData.getCurrentGear(); + G=computeGearRatio(gearsData,currentGear); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataGearRatio(G, vehTelemetryDataContext->engineGraphData); +#endif + } + + //Retrieve control values from vehicle controls. + PxF32 accel,brake,handbrake,steerLeft,steerRight; + PxF32 steer; + bool isIntentionToAccelerate; + { + getVehicle4WControlValues(driveDynData,accel,brake,handbrake,steerLeft,steerRight); + steer=steerRight-steerLeft; + accel=autoboxCompensatedAnalogAccel; + isIntentionToAccelerate = (accel>0.0f && 0.0f==brake && 0.0f==handbrake && PxVehicleGearsData::eNEUTRAL != currentGear); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataControlInputs(accel,brake,handbrake,steerLeft,steerRight, vehTelemetryDataContext->engineGraphData); +#endif + } + + //Active wheels (wheels which have not been disabled). + bool activeWheelStates[4]={false,false,false,false}; + { + computeWheelActiveStates(4*0, vehDrive4W->mWheelsSimData.mActiveWheelsBitmapBuffer, activeWheelStates); + } + + //Get the drive wheels (the first 4 wheels are the drive wheels). + const PxVehicleWheels4SimData& wheels4SimData=wheels4SimDatas[0]; + PxVehicleWheels4DynData& wheels4DynData=wheels4DynDatas[0]; + const PxVehicleTireForceCalculator4& tires4ForceCalculator=tires4ForceCalculators[0]; + + //Contribution of each driven wheel to average wheel speed at clutch. + //With 4 driven wheels the average wheel speed at clutch is + //wAve = alpha0*w0 + alpha1*w1 + alpha2*w2 + alpha3*w3. + //This next bit of code computes alpha0,alpha1,alpha2,alpha3. + //For rear wheel drive alpha0=alpha1=0 + //For front wheel drive alpha2=alpha3=0 + PxF32 aveWheelSpeedContributions[4]={0.0f,0.0f,0.0f,0.0f}; + { + const PxVehicleDifferential4WData& diffData=driveSimData.getDiffData(); + computeDiffAveWheelSpeedContributions(diffData,handbrake,aveWheelSpeedContributions); + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataClutchSlip(wheels4DynData.mWheelSpeeds,aveWheelSpeedContributions,driveDynData.getEngineRotationSpeed(),G, vehTelemetryDataContext->engineGraphData); +#endif + + PX_CHECK_AND_RETURN( + (activeWheelStates[0] || 0.0f==aveWheelSpeedContributions[0]) && + (activeWheelStates[1] || 0.0f==aveWheelSpeedContributions[1]) && + (activeWheelStates[2] || 0.0f==aveWheelSpeedContributions[2]) && + (activeWheelStates[3] || 0.0f==aveWheelSpeedContributions[3]), + "PxVehicleDifferential4WData must be configured so that no torque is delivered to a disabled wheel"); + } + + //Compute a per-wheel accelerator pedal value. + bool isAccelApplied[4]={false,false,false,false}; + if(isIntentionToAccelerate) + { + PX_ASSERT(accel>0); + computeIsAccelApplied(aveWheelSpeedContributions, isAccelApplied); + } + + //Ackermann-corrected steering angles for 1st block of 4 wheels. + //http://en.wikipedia.org/wiki/Ackermann_steering_geometry + PxF32 steerAngles[PX_MAX_NB_WHEELS]; + PxMemZero(steerAngles, sizeof(steerAngles)); + { + computeAckermannCorrectedSteerAngles(driveSimData,wheels4SimData,steer,steerAngles); + } + //All other wheels need a steer angle too. + for(PxU32 i = 1; i < numWheels4; i++) + { + for(PxU32 j = 0; j < 4; j++) + { + const PxF32 steerAngle = wheels4SimDatas[i].getWheelData(j).mToeAngle; + steerAngles[4*i + j] = steerAngle; + } + } + + //Get the local rotations of the wheel shapes with the latest steer. + //These should be very close to the poses at the most recent scene query. + PxQuat wheelLocalPoseRotations[PX_MAX_NB_WHEELS]; + computeWheelLocalPoseRotations(wheels4DynDatas, wheels4SimDatas, numWheels4, context, steerAngles, wheelLocalPoseRotations); + + END_TIMER(TIMER_COMPONENTS_UPDATE); + START_TIMER(TIMER_ADMIN); + + //Store the susp line raycast data. + for(PxU32 i=0;imWheelsSimData,carChassisLinVel,carChassisTransform, + context.forwardAxis); + const PxF32 timeFraction=1.0f/(1.0f*numSubSteps); + const PxF32 subTimestep=timestep*timeFraction; + const PxF32 recipSubTimeStep=1.0f/subTimestep; + const PxF32 recipTimestep=1.0f/timestep; + const PxF32 minLongSlipDenominator=vehDrive4W->mWheelsSimData.mMinLongSlipDenominator; + ProcessSuspWheelTireConstData constData={timeFraction, subTimestep, recipSubTimeStep, gravity, gravityMagnitude, recipGravityMagnitude, false, minLongSlipDenominator, + vehActor, &drivableSurfaceToTireFrictionPairs, vehDrive4W->mWheelsSimData.mFlags}; + + END_TIMER(TIMER_ADMIN); + + for(PxU32 k=0;k(inputData.vehWheels4DynData->mTireLowForwardSpeedTimers)); + updateLowSpeedTimers(outputData.newLowSideSpeedTimers, const_cast(inputData.vehWheels4DynData->mTireLowSideSpeedTimers)); + updateJounces(outputData.jounces, const_cast(inputData.vehWheels4DynData->mJounces)); + updateSteers(steerAngles, const_cast(inputData.vehWheels4DynData->mSteerAngles)); + if((numSubSteps-1) == k) + { + updateCachedHitData(outputData.cachedHitCounts, outputData.cachedHitPlanes, outputData.cachedHitDistances, outputData.cachedFrictionMultipliers, outputData.cachedHitQueryTypes, &wheels4DynData); + } + chassisForce+=outputData.chassisForce; + chassisTorque+=outputData.chassisTorque; + if(0 == k) + { + wheels4DynData.mVehicleConstraints->mData=outputData.vehConstraintData; + } + storeSuspWheelTireResults(outputData, inputData.steerAngles, &wheelQueryResults[4*0], numActiveWheelsPerBlock4[0]); + storeHitActorForces(outputData, &vehicleConcurrentUpdates.concurrentWheelUpdates[4*0], numActiveWheelsPerBlock4[0]); + + END_TIMER(TIMER_WHEELS); + START_TIMER(TIMER_INTERNAL_DYNAMICS_SOLVER); + + //Diff torque ratios needed (how we split the torque between the drive wheels). + //The sum of the torque ratios is always 1.0f. + //The drive torque delivered to each wheel is the total available drive torque multiplied by the + //diff torque ratio for each wheel. + PxF32 diffTorqueRatios[4]={0.0f,0.0f,0.0f,0.0f}; + computeDiffTorqueRatios(driveSimData.getDiffData(),handbrake,wheels4DynData.mWheelSpeeds,diffTorqueRatios); + + PX_CHECK_AND_RETURN( + (activeWheelStates[0] || 0.0f==diffTorqueRatios[0]) && + (activeWheelStates[1] || 0.0f==diffTorqueRatios[1]) && + (activeWheelStates[2] || 0.0f==diffTorqueRatios[2]) && + (activeWheelStates[3] || 0.0f==diffTorqueRatios[3]), + "PxVehicleDifferential4WData must be configured so that no torque is delivered to a disabled wheel"); + + PxF32 engineDriveTorque; + { + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + const PxF32 engineOmega=driveDynData.getEngineRotationSpeed(); + engineDriveTorque=computeEngineDriveTorque(engineData,engineOmega,accel); + #if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataEngineDriveTorque(engineDriveTorque, vehTelemetryDataContext->engineGraphData); + #endif + } + + PxF32 engineDampingRate; + { + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + engineDampingRate=computeEngineDampingRate(engineData,currentGear,accel); + } + + //Update the wheel and engine speeds - 5x5 matrix coupling engine and wheels. + ImplicitSolverInput implicitSolverInput= + { + subTimestep, + brake, handbrake, + K, G, + clutchAccuracyMode, clutchMaxIterations, + engineDriveTorque, engineDampingRate, + diffTorqueRatios, aveWheelSpeedContributions, + brakeTorques, isBrakeApplied, outputData.tireTorques, + 1, 4, + &wheels4SimData, &driveSimData + }; + ImplicitSolverOutput implicitSolverOutput= + { + &wheels4DynData, &driveDynData + }; + solveDrive4WInternaDynamicsEnginePlusDrivenWheels(implicitSolverInput, &implicitSolverOutput); + + END_TIMER(TIMER_INTERNAL_DYNAMICS_SOLVER); + START_TIMER(TIMER_POSTUPDATE1); + + //Integrate wheel rotation angle (theta += omega*dt) + integrateWheelRotationAngles + (subTimestep, + K,G,engineDriveTorque, + outputData.jounces,diffTorqueRatios,outputData.forwardSpeeds,isBrakeApplied, + driveSimData,wheels4SimData, + driveDynData,wheels4DynData); + } + + END_TIMER(TIMER_POSTUPDATE1); + + ////////////////////////////////////////////////////////////////////////// + //susp and tire forces from extra wheels (non-driven wheels) + ////////////////////////////////////////////////////////////////////////// + for(PxU32 j=1;jmWheelsSimData.mActiveWheelsBitmapBuffer, extraWheelActiveStates); + + ProcessSuspWheelTireInputData extraInputData= + { + isIntentionToAccelerate, extraIsAccelApplied, extraIsBrakeApplied, extraWheelSteerAngles, extraWheelActiveStates, + carChassisTransform, carChassisLinVel, carChassisAngVel, + &wheelLocalPoseRotations[j], &wheels4SimDatas[j], &wheels4DynDatas[j], &tires4ForceCalculators[j], &tireLoadFilterData, numActiveWheelsPerBlock4[j], + }; + ProcessSuspWheelTireOutputData extraOutputData; + processSuspTireWheels(4*j, constData, extraInputData, context.sideAxis, + context.pointRejectAngleThresholdCosine, context.normalRejectAngleThresholdCosine, + context.maxHitActorAcceleration, + extraOutputData, vehTelemetryDataContext); + updateLowSpeedTimers(extraOutputData.newLowForwardSpeedTimers, const_cast(extraInputData.vehWheels4DynData->mTireLowForwardSpeedTimers)); + updateLowSpeedTimers(extraOutputData.newLowSideSpeedTimers, const_cast(extraInputData.vehWheels4DynData->mTireLowSideSpeedTimers)); + updateJounces(extraOutputData.jounces, const_cast(extraInputData.vehWheels4DynData->mJounces)); + updateSteers(extraWheelSteerAngles, const_cast(extraInputData.vehWheels4DynData->mSteerAngles)); + if((numSubSteps-1) == k) + { + updateCachedHitData(extraOutputData.cachedHitCounts, extraOutputData.cachedHitPlanes, extraOutputData.cachedHitDistances, extraOutputData.cachedFrictionMultipliers, extraOutputData.cachedHitQueryTypes, &wheels4DynDatas[j]); + } + chassisForce+=extraOutputData.chassisForce; + chassisTorque+=extraOutputData.chassisTorque; + if(0 == k) + { + wheels4DynDatas[j].mVehicleConstraints->mData=extraOutputData.vehConstraintData; + } + storeSuspWheelTireResults(extraOutputData, extraInputData.steerAngles, &wheelQueryResults[4*j], numActiveWheelsPerBlock4[j]); + storeHitActorForces(extraOutputData, &vehicleConcurrentUpdates.concurrentWheelUpdates[4*j], numActiveWheelsPerBlock4[j]); + + //Integrate the tire torques (omega += (tireTorque + brakeTorque)*dt) + integrateUndriveWheelRotationSpeeds(subTimestep, brake, handbrake, extraOutputData.tireTorques, extraWheelBrakeTorques, wheels4SimDatas[j], wheels4DynDatas[j]); + + //Integrate wheel rotation angle (theta += omega*dt) + integrateWheelRotationAngles + (subTimestep, + 0,0,0, + extraOutputData.jounces,extraWheelsDiffTorqueRatios,extraOutputData.forwardSpeeds,extraIsBrakeApplied, + driveSimData,wheels4SimDatas[j], + driveDynData,wheels4DynDatas[j]); + } + + START_TIMER(TIMER_POSTUPDATE2); + + //Apply the anti-roll suspension. + procesAntiRollSuspension(vehDrive4W->mWheelsSimData, carChassisTransform, wheelQueryResults, chassisTorque); + + //Integrate one sustep. + integrateBody(inverseChassisMass, inverseInertia ,chassisForce, chassisTorque, subTimestep, carChassisLinVel, carChassisAngVel, carChassisTransform); + + END_TIMER(TIMER_POSTUPDATE2); + } + + START_TIMER(TIMER_POSTUPDATE3); + + //Set the new chassis linear/angular velocity. + if(context.updateMode == PxVehicleUpdateMode::eVELOCITY_CHANGE) + { + vehicleConcurrentUpdates.linearMomentumChange = carChassisLinVel; + vehicleConcurrentUpdates.angularMomentumChange = carChassisAngVel; + } + else + { + //integration steps are: + //v = v0 + a*dt (1) + //x = x0 + v*dt (2) + //Sub (2) into (1. + //x = x0 + v0*dt + a*dt*dt; + //Rearrange for a + //a = (x -x0 - v0*dt)/(dt*dt) = [(x-x0)/dt - v0/dt] + //Rearrange again with v = (x-x0)/dt + //a = (v - v0)/dt + vehicleConcurrentUpdates.linearMomentumChange = (carChassisLinVel-carChassisLinVelOrig)*recipTimestep;; + vehicleConcurrentUpdates.angularMomentumChange = (carChassisAngVel-carChassisAngVelOrig)*recipTimestep;; + } + + //Compute and pose the wheels from jounces, rotations angles, and steer angles. + PxTransform localPoses0[4] = {PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity)}; + computeWheelLocalPoses(wheels4SimDatas[0],wheels4DynDatas[0],&wheelQueryResults[4*0],numActiveWheelsPerBlock4[0],carChassisCMLocalPose, + context.upAxis, context.sideAxis, context.forwardAxis, localPoses0); + //Copy the poses to the wheelQueryResults + wheelQueryResults[4*0 + 0].localPose = localPoses0[0]; + wheelQueryResults[4*0 + 1].localPose = localPoses0[1]; + wheelQueryResults[4*0 + 2].localPose = localPoses0[2]; + wheelQueryResults[4*0 + 3].localPose = localPoses0[3]; + //Copy the poses to the concurrent update data. + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 0].localPose = localPoses0[0]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 1].localPose = localPoses0[1]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 2].localPose = localPoses0[2]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 3].localPose = localPoses0[3]; + for(PxU32 i=1;iwheelQueryResults) + { + PxMemCopy(vehWheelQueryResults->wheelQueryResults, wheelQueryResults, sizeof(PxWheelQueryResult)*numActiveWheels); + } + + if(vehConcurrentUpdates) + { + //Copy across to input data structure so that writes can be applied later. + PxMemCopy(vehConcurrentUpdates->concurrentWheelUpdates, vehicleConcurrentUpdates.concurrentWheelUpdates, sizeof(PxVehicleWheelConcurrentUpdateData)*numActiveWheels); + vehConcurrentUpdates->linearMomentumChange = vehicleConcurrentUpdates.linearMomentumChange; + vehConcurrentUpdates->angularMomentumChange = vehicleConcurrentUpdates.angularMomentumChange; + vehConcurrentUpdates->staySleeping = vehicleConcurrentUpdates.staySleeping; + vehConcurrentUpdates->wakeup = vehicleConcurrentUpdates.wakeup; + } + else + { + //Apply the writes immediately. + PxVehicleWheels* vehWheels[1]={vehDrive4W}; + PxVehicleUpdate::updatePost(&vehicleConcurrentUpdates, 1, vehWheels, context); + } + + END_TIMER(TIMER_POSTUPDATE3); +} + +void PxVehicleUpdate::updateDriveNW +(const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleDriveNW* vehDriveNW, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext* vehTelemetryDataContext, const PxVehicleContext& context) +{ +#if !PX_DEBUG_VEHICLE_ON + PX_UNUSED(vehTelemetryDataContext); +#endif + + PX_SIMD_GUARD; // denorm exception triggered in transformInertiaTensor() on osx + + START_TIMER(TIMER_ADMIN); + + PX_CHECK_AND_RETURN( + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL]>-0.01f && + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL]<1.01f, + "Illegal vehicle control value - accel must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_BRAKE]>-0.01f && + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_BRAKE]<1.01f, + "Illegal vehicle control value - brake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_HANDBRAKE]>-0.01f && + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_HANDBRAKE]<1.01f, + "Illegal vehicle control value - handbrake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT]>-1.01f && + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT]<1.01f, + "Illegal vehicle control value - left steer must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]>-1.01f && + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]<1.01f, + "Illegal vehicle control value - right steer must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + PxAbs(vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]- + vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT])<1.01f, + "Illegal vehicle control value - right steer value minus left steer value must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + !(vehDriveNW->getRigidDynamicActor()->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), + "Attempting to update a drive4W with a kinematic actor - this isn't allowed"); + PX_CHECK_AND_RETURN( + NULL==vehWheelQueryResults || vehWheelQueryResults->nbWheelQueryResults >= vehDriveNW->mWheelsSimData.getNbWheels(), + "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle"); + +#if PX_CHECKED + for(PxU32 i=0;imWheelsSimData.getNbWheels();i++) + { + PX_CHECK_AND_RETURN(!vehDriveNW->mWheelsSimData.getIsWheelDisabled(i) || !vehDriveNW->mDriveSimData.getDiffData().getIsDrivenWheel(i), + "PxVehicleDifferentialNWData must be configured so that no torque is delivered to a disabled wheel"); + } +#endif + + END_TIMER(TIMER_ADMIN); + START_TIMER(TIMER_GRAPHS); + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + for(PxU32 i=0;imWheelsSimData.mNbWheels4;i++) + { + updateGraphDataInternalWheelDynamics(4*i,vehDriveNW->mWheelsDynData.mWheels4DynData[i].mWheelSpeeds, vehTelemetryDataContext->wheelGraphData); + } + updateGraphDataInternalEngineDynamics(vehDriveNW->mDriveDynData.getEngineRotationSpeed(), vehTelemetryDataContext->engineGraphData); + } +#endif + + END_TIMER(TIMER_GRAPHS); + START_TIMER(TIMER_ADMIN); + + //Unpack the vehicle. + //Unpack the NW simulation and instanced dynamics components. + const PxVehicleWheels4SimData* wheels4SimDatas=vehDriveNW->mWheelsSimData.mWheels4SimData; + const PxVehicleTireLoadFilterData& tireLoadFilterData=vehDriveNW->mWheelsSimData.mNormalisedLoadFilter; + PxVehicleWheels4DynData* wheels4DynDatas=vehDriveNW->mWheelsDynData.mWheels4DynData; + const PxU32 numWheels4=vehDriveNW->mWheelsSimData.mNbWheels4; + const PxU32 numActiveWheels=vehDriveNW->mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=4-(4*numWheels4 - numActiveWheels); + const PxVehicleDriveSimDataNW driveSimData=vehDriveNW->mDriveSimData; + PxVehicleDriveDynData& driveDynData=vehDriveNW->mDriveDynData; + PxRigidDynamic* vehActor=vehDriveNW->mActor; + + //We need to store that data we are going to write to actors so we can do this at the end in one go with fewer write locks. + PxVehicleWheelConcurrentUpdateData wheelConcurrentUpdates[PX_MAX_NB_WHEELS]; + PxVehicleConcurrentUpdateData vehicleConcurrentUpdates; + vehicleConcurrentUpdates.nbConcurrentWheelUpdates = numActiveWheels; + vehicleConcurrentUpdates.concurrentWheelUpdates = wheelConcurrentUpdates; + + //In each block of 4 wheels record how many wheels are active. + PxU32 numActiveWheelsPerBlock4[PX_MAX_NB_SUSPWHEELTIRE4]={0,0,0,0,0}; + numActiveWheelsPerBlock4[0]=PxMin(numActiveWheels,PxU32(4)); + for(PxU32 i=1;igetScene() && vehActor->isSleeping()) //Support case where actor is not in a scene and constraints get solved via immediate mode + { + if(finiteInputApplied) + { + //Driving inputs so we need the actor to start moving. + vehicleConcurrentUpdates.wakeup = true; + } + else if(isOnDynamicActor(vehDriveNW->mWheelsSimData, vehDriveNW->mWheelsDynData)) + { + //Driving on dynamic so we need to keep moving. + vehicleConcurrentUpdates.wakeup = true; + } + else + { + //No driving inputs and the actor is asleep. + //Set internal dynamics to sleep. + setInternalDynamicsToZero(vehDriveNW); + if(vehConcurrentUpdates) vehConcurrentUpdates->staySleeping = true; + return; + } + } + } + + //Organise the shader data in blocks of 4. + PxVehicleTireForceCalculator4 tires4ForceCalculators[PX_MAX_NB_SUSPWHEELTIRE4]; + for(PxU32 i=0;imWheelsDynData.mTireForceCalculators->mShaderData[4*i+0]; + tires4ForceCalculators[i].mShaderData[1]=vehDriveNW->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+1]; + tires4ForceCalculators[i].mShaderData[2]=vehDriveNW->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+2]; + tires4ForceCalculators[i].mShaderData[3]=vehDriveNW->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+3]; + tires4ForceCalculators[i].mShader=vehDriveNW->mWheelsDynData.mTireForceCalculators->mShader; + } + + //Mark the constraints as dirty to force them to be updated in the sdk. + for(PxU32 i=0;imarkDirty(); + } + + //Need to store report data to pose the wheels. + PxWheelQueryResult wheelQueryResults[PX_MAX_NB_WHEELS]; + + END_TIMER(TIMER_ADMIN); + START_TIMER(TIMER_COMPONENTS_UPDATE); + + //Center of mass local pose. + PxTransform carChassisCMLocalPose; + //Compute the transform of the center of mass. + PxTransform origCarChassisTransform; + PxTransform carChassisTransform; + //Inverse mass and inertia to apply the tire/suspension forces as impulses. + PxF32 inverseChassisMass; + PxVec3 inverseInertia; + //Linear and angular velocity. + PxVec3 carChassisLinVel; + PxVec3 carChassisAngVel; + { + carChassisCMLocalPose = vehActor->getCMassLocalPose(); + carChassisCMLocalPose.q = PxQuat(PxIdentity); + origCarChassisTransform = vehActor->getGlobalPose().transform(carChassisCMLocalPose); + carChassisTransform = origCarChassisTransform; + const PxF32 chassisMass = vehActor->getMass(); + inverseChassisMass = 1.0f/chassisMass; + inverseInertia = vehActor->getMassSpaceInvInertiaTensor(); + carChassisLinVel = vehActor->getLinearVelocity(); + carChassisAngVel = vehActor->getAngularVelocity(); + } + + + + //Update the auto-box and decide whether to change gear up or down. + PxF32 autoboxCompensatedAnalogAccel = driveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL]; + if(driveDynData.getUseAutoGears()) + { + autoboxCompensatedAnalogAccel = processAutoBox(PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL,timestep,driveSimData,driveDynData); + } + + //Process gear-up/gear-down commands. + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + processGears(timestep,gearsData,driveDynData); + } + + //Clutch strength. + PxF32 K; + { + const PxVehicleClutchData& clutchData=driveSimData.getClutchData(); + const PxU32 currentGear=driveDynData.getCurrentGear(); + K=computeClutchStrength(clutchData, currentGear); + } + + //Clutch accuracy. + PxVehicleClutchAccuracyMode::Enum clutchAccuracyMode; + PxU32 clutchMaxIterations; + { + const PxVehicleClutchData& clutchData=driveSimData.getClutchData(); + clutchAccuracyMode=clutchData.mAccuracyMode; + clutchMaxIterations=clutchData.mEstimateIterations; + } + + //Gear ratio. + PxF32 G; + PxU32 currentGear; + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + currentGear=driveDynData.getCurrentGear(); + G=computeGearRatio(gearsData,currentGear); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataGearRatio(G, vehTelemetryDataContext->engineGraphData); +#endif + } + + //Retrieve control values from vehicle controls. + PxF32 accel,brake,handbrake,steerLeft,steerRight; + PxF32 steer; + bool isIntentionToAccelerate; + { + getVehicleNWControlValues(driveDynData,accel,brake,handbrake,steerLeft,steerRight); + steer=steerRight-steerLeft; + accel=autoboxCompensatedAnalogAccel; + isIntentionToAccelerate = (accel>0.0f && 0.0f==brake && 0.0f==handbrake && PxVehicleGearsData::eNEUTRAL != currentGear); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataControlInputs(accel,brake,handbrake,steerLeft,steerRight, vehTelemetryDataContext->engineGraphData); +#endif + } + + //Compute the wheels that are disabled or enabled. + bool activeWheelStates[PX_MAX_NB_WHEELS]; + PxMemSet(activeWheelStates, 0, sizeof(bool)*PX_MAX_NB_WHEELS); + for(PxU32 i=0;imWheelsSimData.mActiveWheelsBitmapBuffer, &activeWheelStates[4*i]); + } + + //Contribution of each driven wheel to average wheel speed at clutch. + //For NW drive equal torque split is supported. + const PxVehicleDifferentialNWData diffData=driveSimData.getDiffData(); + const PxF32 invNumDrivenWheels=diffData.mInvNbDrivenWheels; + PxF32 aveWheelSpeedContributions[PX_MAX_NB_WHEELS]; + PxMemSet(aveWheelSpeedContributions, 0, sizeof(PxF32)*PX_MAX_NB_WHEELS); + for(PxU32 i=0;iengineGraphData); +#endif + + //Compute a per-wheel accelerator pedal value. + bool isAccelApplied[PX_MAX_NB_WHEELS]; + PxMemSet(isAccelApplied, 0, sizeof(bool)*PX_MAX_NB_WHEELS); + if(isIntentionToAccelerate) + { + PX_ASSERT(accel>0); + for(PxU32 i=0;imWheelsSimData.getWheelData(i); + const PxF32 steerGain=wheelData.mMaxSteer; + const PxF32 toe=wheelData.mToeAngle; + steerAngles[i]=steerGain*steer + toe; + } + + //Diff torque ratios needed (how we split the torque between the drive wheels). + //The sum of the torque ratios is always 1.0f. + //The drive torque delivered to each wheel is the total available drive torque multiplied by the + //diff torque ratio for each wheel. + PxF32 diffTorqueRatios[PX_MAX_NB_WHEELS]; + PxMemSet(diffTorqueRatios, 0, sizeof(PxF32)*PX_MAX_NB_WHEELS); + for(PxU32 i=0;imWheelsSimData,carChassisLinVel,carChassisTransform, + context.forwardAxis); + const PxF32 timeFraction=1.0f/(1.0f*numSubSteps); + const PxF32 subTimestep=timestep*timeFraction; + const PxF32 recipSubTimeStep=1.0f/subTimestep; + const PxF32 recipTimestep=1.0f/timestep; + const PxF32 minLongSlipDenominator=vehDriveNW->mWheelsSimData.mMinLongSlipDenominator; + ProcessSuspWheelTireConstData constData={timeFraction, subTimestep, recipSubTimeStep, gravity, gravityMagnitude, recipGravityMagnitude, false, minLongSlipDenominator, + vehActor, &drivableSurfaceToTireFrictionPairs, vehDriveNW->mWheelsSimData.mFlags}; + + END_TIMER(TIMER_ADMIN); + + for(PxU32 k=0;k(inputData.vehWheels4DynData->mTireLowForwardSpeedTimers)); + updateLowSpeedTimers(outputData[i].newLowSideSpeedTimers, const_cast(inputData.vehWheels4DynData->mTireLowSideSpeedTimers)); + updateJounces(outputData[i].jounces, const_cast(inputData.vehWheels4DynData->mJounces)); + updateSteers(&steerAngles[4*i], const_cast(inputData.vehWheels4DynData->mSteerAngles)); + if((numSubSteps-1) == k) + { + updateCachedHitData(outputData[i].cachedHitCounts, outputData[i].cachedHitPlanes, outputData[i].cachedHitDistances, outputData[i].cachedFrictionMultipliers, outputData[i].cachedHitQueryTypes, &wheels4DynDatas[i]); + } + chassisForce+=outputData[i].chassisForce; + chassisTorque+=outputData[i].chassisTorque; + if(0 == k) + { + wheels4DynDatas[i].mVehicleConstraints->mData=outputData[i].vehConstraintData; + } + storeSuspWheelTireResults(outputData[i], inputData.steerAngles, &wheelQueryResults[4*i], numActiveWheelsPerBlock4[i]); + storeHitActorForces(outputData[i], &vehicleConcurrentUpdates.concurrentWheelUpdates[4*i], numActiveWheelsPerBlock4[i]); + } + + //Store the tire torques in a single array. + PxF32 tireTorques[PX_MAX_NB_WHEELS]; + for(PxU32 i=0;iengineGraphData); +#endif + } + + PxF32 engineDampingRate; + { + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + engineDampingRate=computeEngineDampingRate(engineData,currentGear,accel); + } + + //Update the wheel and engine speeds - (N+1)*(N+1) matrix coupling engine and wheels. + ImplicitSolverInput implicitSolverInput= + { + subTimestep, + brake, handbrake, + K, G, + clutchAccuracyMode, clutchMaxIterations, + engineDriveTorque, engineDampingRate, + diffTorqueRatios, aveWheelSpeedContributions, + brakeTorques, isBrakeApplied, tireTorques, + numWheels4, numActiveWheels, + wheels4SimDatas, &driveSimData + }; + ImplicitSolverOutput implicitSolverOutput= + { + wheels4DynDatas, &driveDynData + }; + solveDriveNWInternalDynamicsEnginePlusDrivenWheels(implicitSolverInput, &implicitSolverOutput); + + END_TIMER(TIMER_INTERNAL_DYNAMICS_SOLVER); + START_TIMER(TIMER_POSTUPDATE1); + + //Integrate wheel rotation angle (theta += omega*dt) + for(PxU32 i=0;imWheelsSimData, carChassisTransform, wheelQueryResults, chassisTorque); + + //Integrate the chassis velocity by applying the accumulated force and torque. + integrateBody(inverseChassisMass, inverseInertia, chassisForce, chassisTorque, subTimestep, carChassisLinVel, carChassisAngVel, carChassisTransform); + + END_TIMER(TIMER_POSTUPDATE2); + } + + //Set the new chassis linear/angular velocity. + if(context.updateMode == PxVehicleUpdateMode::eVELOCITY_CHANGE) + { + vehicleConcurrentUpdates.linearMomentumChange = carChassisLinVel; + vehicleConcurrentUpdates.angularMomentumChange = carChassisAngVel; + } + else + { + //integration steps are: + //v = v0 + a*dt (1) + //x = x0 + v*dt (2) + //Sub (2) into (1. + //x = x0 + v0*dt + a*dt*dt; + //Rearrange for a + //a = (x -x0 - v0*dt)/(dt*dt) = [(x-x0)/dt - v0/dt] + //Rearrange again with v = (x-x0)/dt + //a = (v - v0)/dt + vehicleConcurrentUpdates.linearMomentumChange = (carChassisLinVel-carChassisLinVelOrig)*recipTimestep; + vehicleConcurrentUpdates.angularMomentumChange = (carChassisAngVel-carChassisAngVelOrig)*recipTimestep; + } + + START_TIMER(TIMER_POSTUPDATE3); + + //Pose the wheels from jounces, rotations angles, and steer angles. + PxTransform localPoses0[4] = {PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity)}; + computeWheelLocalPoses(wheels4SimDatas[0],wheels4DynDatas[0],&wheelQueryResults[4*0],numActiveWheelsPerBlock4[0],carChassisCMLocalPose, + context.upAxis, context.sideAxis, context.forwardAxis, localPoses0); + wheelQueryResults[4*0 + 0].localPose = localPoses0[0]; + wheelQueryResults[4*0 + 1].localPose = localPoses0[1]; + wheelQueryResults[4*0 + 2].localPose = localPoses0[2]; + wheelQueryResults[4*0 + 3].localPose = localPoses0[3]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 0].localPose = localPoses0[0]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 1].localPose = localPoses0[1]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 2].localPose = localPoses0[2]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 3].localPose = localPoses0[3]; + for(PxU32 i=1;iwheelQueryResults) + { + PxMemCopy(vehWheelQueryResults->wheelQueryResults, wheelQueryResults, sizeof(PxWheelQueryResult)*numActiveWheels); + } + + if(vehConcurrentUpdates) + { + //Copy across to input data structure so that writes can be applied later. + PxMemCopy(vehConcurrentUpdates->concurrentWheelUpdates, vehicleConcurrentUpdates.concurrentWheelUpdates, sizeof(PxVehicleWheelConcurrentUpdateData)*numActiveWheels); + vehConcurrentUpdates->linearMomentumChange = vehicleConcurrentUpdates.linearMomentumChange; + vehConcurrentUpdates->angularMomentumChange = vehicleConcurrentUpdates.angularMomentumChange; + vehConcurrentUpdates->staySleeping = vehicleConcurrentUpdates.staySleeping; + vehConcurrentUpdates->wakeup = vehicleConcurrentUpdates.wakeup; + } + else + { + //Apply the writes immediately. + PxVehicleWheels* vehWheels[1]={vehDriveNW}; + PxVehicleUpdate::updatePost(&vehicleConcurrentUpdates, 1, vehWheels, context); + } + + END_TIMER(TIMER_POSTUPDATE3); +} + +void PxVehicleUpdate::updateTank +(const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleDriveTank* vehDriveTank, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext* vehTelemetryDataContext, const PxVehicleContext& context) +{ +#if !PX_DEBUG_VEHICLE_ON + PX_UNUSED(vehTelemetryDataContext); +#endif + + PX_SIMD_GUARD; // denorm exception in transformInertiaTensor() + + PX_CHECK_AND_RETURN( + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL]>-0.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL]<1.01f, + "Illegal tank control value - accel must be in range (0,1)" ); + PX_CHECK_AND_RETURN( + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT]>-0.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT]<1.01f, + "Illegal tank control value - left brake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT]>-0.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT]<1.01f, + "Illegal tank control right value - right brake must be in range (0,1)"); + PX_CHECK_AND_RETURN( + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]>-1.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]<1.01f, + "Illegal tank control value - left thrust must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]>-1.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]<1.01f, + "Illegal tank control value - right thrust must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + PxVehicleDriveTankControlModel::eSPECIAL==vehDriveTank->mDriveModel || + (vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]>-0.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]<1.01f), + "Illegal tank control value - left thrust must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + PxVehicleDriveTankControlModel::eSPECIAL==vehDriveTank->mDriveModel || + (vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]>-0.01f && + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]<1.01f), + "Illegal tank control value - right thrust must be in range (-1,1)"); + PX_CHECK_AND_RETURN( + PxVehicleDriveTankControlModel::eSPECIAL==vehDriveTank->mDriveModel || + 0.0f== + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]* + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT], + "Illegal tank control value - thrust left and brake left simultaneously non-zero in standard drive mode"); + PX_CHECK_AND_RETURN( + PxVehicleDriveTankControlModel::eSPECIAL==vehDriveTank->mDriveModel || + 0.0f== + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]* + vehDriveTank->mDriveDynData.mControlAnalogVals[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT], + "Illegal tank control value - thrust right and brake right simultaneously non-zero in standard drive mode"); + PX_CHECK_AND_RETURN( + !(vehDriveTank->getRigidDynamicActor()->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), + "Attempting to update a tank with a kinematic actor - this isn't allowed"); + PX_CHECK_AND_RETURN( + NULL==vehWheelQueryResults || vehWheelQueryResults->nbWheelQueryResults >= vehDriveTank->mWheelsSimData.getNbWheels(), + "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle"); + +#if PX_CHECKED + { + PxVec3 fl=vehDriveTank->mWheelsSimData.getWheelCentreOffset(PxVehicleDriveTankWheelOrder::eFRONT_LEFT); + PxVec3 fr=vehDriveTank->mWheelsSimData.getWheelCentreOffset(PxVehicleDriveTankWheelOrder::eFRONT_RIGHT); + const PxVec3 right=context.sideAxis; + const PxF32 s0=computeSign((fr-fl).dot(right)); + for(PxU32 i=PxVehicleDriveTankWheelOrder::e1ST_FROM_FRONT_LEFT;imWheelsSimData.getNbWheels();i+=2) + { + PxVec3 rl=vehDriveTank->mWheelsSimData.getWheelCentreOffset(i); + PxVec3 rr=vehDriveTank->mWheelsSimData.getWheelCentreOffset(i+1); + const PxF32 t0=computeSign((rr-rl).dot(right)); + PX_CHECK_AND_RETURN(s0==t0 || 0==s0 || 0==t0, "Tank wheels must be ordered with odd wheels on one side and even wheels on the other side"); + } + } +#endif + + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + for(PxU32 i=0;imWheelsSimData.mNbWheels4;i++) + { + updateGraphDataInternalWheelDynamics(4*i,vehDriveTank->mWheelsDynData.mWheels4DynData[i].mWheelSpeeds, vehTelemetryDataContext->wheelGraphData); + } + updateGraphDataInternalEngineDynamics(vehDriveTank->mDriveDynData.getEngineRotationSpeed(), vehTelemetryDataContext->engineGraphData); + } +#endif + + //Unpack the tank simulation and instanced dynamics components. + const PxVehicleWheels4SimData* wheels4SimDatas=vehDriveTank->mWheelsSimData.mWheels4SimData; + const PxVehicleTireLoadFilterData& tireLoadFilterData=vehDriveTank->mWheelsSimData.mNormalisedLoadFilter; + PxVehicleWheels4DynData* wheels4DynDatas=vehDriveTank->mWheelsDynData.mWheels4DynData; + const PxU32 numWheels4=vehDriveTank->mWheelsSimData.mNbWheels4; + const PxU32 numActiveWheels=vehDriveTank->mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=4-(4*numWheels4-numActiveWheels); + const PxVehicleDriveSimData driveSimData=vehDriveTank->mDriveSimData; + PxVehicleDriveDynData& driveDynData=vehDriveTank->mDriveDynData; + PxRigidDynamic* vehActor=vehDriveTank->mActor; + + //We need to store that data we are going to write to actors so we can do this at the end in one go with fewer write locks. + PxVehicleWheelConcurrentUpdateData wheelConcurrentUpdates[PX_MAX_NB_WHEELS]; + PxVehicleConcurrentUpdateData vehicleConcurrentUpdates; + vehicleConcurrentUpdates.nbConcurrentWheelUpdates = numActiveWheels; + vehicleConcurrentUpdates.concurrentWheelUpdates = wheelConcurrentUpdates; + + //Test if a non-zero drive torque was applied or if a non-zero steer angle was applied. + bool finiteInputApplied=false; + if(0!=driveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT) || + 0!=driveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT) || + 0!=driveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL) || + driveDynData.getGearDown() || driveDynData.getGearUp()) + { + finiteInputApplied=true; + } + + //Awake or sleep. + { + if(vehActor->getScene() && vehActor->isSleeping()) //Support case where actor is not in a scene and constraints get solved via immediate mode + { + if(finiteInputApplied) + { + //Driving inputs so we need the actor to start moving. + vehicleConcurrentUpdates.wakeup = true; + } + else if(isOnDynamicActor(vehDriveTank->mWheelsSimData, vehDriveTank->mWheelsDynData)) + { + //Driving on dynamic so we need to keep moving. + vehicleConcurrentUpdates.wakeup = true; + } + else + { + //No driving inputs and the actor is asleep. + //Set internal dynamics to sleep. + setInternalDynamicsToZero(vehDriveTank); + if(vehConcurrentUpdates) vehConcurrentUpdates->staySleeping = true; + return; + } + } + } + + //In each block of 4 wheels record how many wheels are active. + PxU32 numActiveWheelsPerBlock4[PX_MAX_NB_SUSPWHEELTIRE4]={0,0,0,0,0}; + numActiveWheelsPerBlock4[0]=PxMin(numActiveWheels,PxU32(4)); + for(PxU32 i=1;imWheelsDynData.mTireForceCalculators->mShaderData[4*i+0]; + tires4ForceCalculators[i].mShaderData[1]=vehDriveTank->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+1]; + tires4ForceCalculators[i].mShaderData[2]=vehDriveTank->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+2]; + tires4ForceCalculators[i].mShaderData[3]=vehDriveTank->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+3]; + tires4ForceCalculators[i].mShader=vehDriveTank->mWheelsDynData.mTireForceCalculators->mShader; + } + + //Mark the suspension/tire constraints as dirty to force them to be updated in the sdk. + for(PxU32 i=0;imarkDirty(); + } + + //Need to store report data to pose the wheels. + PxWheelQueryResult wheelQueryResults[PX_MAX_NB_WHEELS]; + + + //Center of mass local pose. + PxTransform carChassisCMLocalPose; + //Compute the transform of the center of mass. + PxTransform origCarChassisTransform; + PxTransform carChassisTransform; + //Inverse mass and inertia to apply the tire/suspension forces as impulses. + PxF32 inverseChassisMass; + PxVec3 inverseInertia; + //Linear and angular velocity. + PxVec3 carChassisLinVel; + PxVec3 carChassisAngVel; + { + carChassisCMLocalPose = vehActor->getCMassLocalPose(); + carChassisCMLocalPose.q = PxQuat(PxIdentity); + origCarChassisTransform = vehActor->getGlobalPose().transform(carChassisCMLocalPose); + carChassisTransform = origCarChassisTransform; + const PxF32 chassisMass = vehActor->getMass(); + inverseChassisMass = 1.0f/chassisMass; + inverseInertia = vehActor->getMassSpaceInvInertiaTensor(); + carChassisLinVel = vehActor->getLinearVelocity(); + carChassisAngVel = vehActor->getAngularVelocity(); + } + + + + //Retrieve control values from vehicle controls. + PxF32 accel,brakeLeft,brakeRight,thrustLeft,thrustRight; + { + getTankControlValues(driveDynData,accel,brakeLeft,brakeRight,thrustLeft,thrustRight); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataControlInputs(accel,brakeLeft,brakeRight,thrustLeft,thrustRight, vehTelemetryDataContext->engineGraphData); +#endif + } + + //Update the auto-box and decide whether to change gear up or down. + //If the tank is supposed to turn sharply don't process the auto-box. + bool useAutoGears; + if(vehDriveTank->getDriveModel()==PxVehicleDriveTankControlModel::eSPECIAL) + { + useAutoGears = driveDynData.getUseAutoGears() ? ((((thrustRight*thrustLeft) >= 0.0f) || (0.0f==thrustLeft && 0.0f==thrustRight)) ? true : false) : false; + } + else + { + useAutoGears = driveDynData.getUseAutoGears() ? (thrustRight*brakeLeft>0 || thrustLeft*brakeRight>0 ? false : true) : false; + } + if(useAutoGears) + { + processAutoBox(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL,timestep,driveSimData,driveDynData); + } + + //Process gear-up/gear-down commands. + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + processGears(timestep,gearsData,driveDynData); + } + + //Clutch strength; + PxF32 K; + { + const PxVehicleClutchData& clutchData=driveSimData.getClutchData(); + const PxU32 currentGear=driveDynData.getCurrentGear(); + K=computeClutchStrength(clutchData, currentGear); + } + + //Gear ratio. + PxF32 G; + PxU32 currentGear; + { + const PxVehicleGearsData& gearsData=driveSimData.getGearsData(); + currentGear=driveDynData.getCurrentGear(); + G=computeGearRatio(gearsData,currentGear); +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + updateGraphDataGearRatio(G, vehTelemetryDataContext->engineGraphData); +#endif + } + + bool isIntentionToAccelerate; + { + const PxF32 thrustLeftAbs=PxAbs(thrustLeft); + const PxF32 thrustRightAbs=PxAbs(thrustRight); + isIntentionToAccelerate = (accel*(thrustLeftAbs+thrustRightAbs)>0 && PxVehicleGearsData::eNEUTRAL != currentGear); + } + + + //Compute the wheels that are enabled/disabled. + bool activeWheelStates[PX_MAX_NB_WHEELS]; + PxMemZero(activeWheelStates, sizeof(bool)*PX_MAX_NB_WHEELS); + for(PxU32 i=0;imWheelsSimData.mActiveWheelsBitmapBuffer, &activeWheelStates[4*i]); + } + + //Set up contribution of each wheel to the average wheel speed at the clutch + //Set up the torque ratio delivered by the diff to each wheel. + //Set the sign of the gearing applied to the left and right wheels. + PxF32 aveWheelSpeedContributions[PX_MAX_NB_WHEELS]; + PxF32 diffTorqueRatios[PX_MAX_NB_WHEELS]; + PxF32 wheelGearings[PX_MAX_NB_WHEELS]; + PxMemZero(aveWheelSpeedContributions, sizeof(PxF32)*PX_MAX_NB_WHEELS); + PxMemZero(diffTorqueRatios, sizeof(PxF32)*PX_MAX_NB_WHEELS); + PxMemZero(wheelGearings, sizeof(PxF32)*PX_MAX_NB_WHEELS); + computeTankDiff + (thrustLeft, thrustRight, + numActiveWheels, activeWheelStates, + aveWheelSpeedContributions, diffTorqueRatios, wheelGearings); + + //Compute an accelerator pedal value per wheel. + bool isAccelApplied[PX_MAX_NB_WHEELS]; + PxMemZero(isAccelApplied, sizeof(bool)*PX_MAX_NB_WHEELS); + if(isIntentionToAccelerate) + { + PX_ASSERT(accel>0); + for(PxU32 i=0;iengineGraphData); +#endif + + //Ackermann-corrected steer angles + //For tanks this is always zero because they turn by torque delivery rather than a steering mechanism. + PxF32 steerAngles[PX_MAX_NB_WHEELS]; + PxMemZero(steerAngles, sizeof(PxF32)*PX_MAX_NB_WHEELS); + + //Store the susp line raycast data. + for(PxU32 i=0;imWheelsSimData,carChassisLinVel,carChassisTransform, + context.forwardAxis); + const PxF32 timeFraction=1.0f/(1.0f*numSubSteps); + const PxF32 subTimestep=timestep*timeFraction; + const PxF32 recipSubTimeStep=1.0f/subTimestep; + const PxF32 recipTimestep=1.0f/timestep; + const PxF32 minLongSlipDenominator=vehDriveTank->mWheelsSimData.mMinLongSlipDenominator; + ProcessSuspWheelTireConstData constData={timeFraction, subTimestep, recipSubTimeStep, gravity, gravityMagnitude, recipGravityMagnitude, true, minLongSlipDenominator, + vehActor, &drivableSurfaceToTireFrictionPairs, vehDriveTank->mWheelsSimData.mFlags}; + + for(PxU32 k=0;k(inputData.vehWheels4DynData->mTireLowForwardSpeedTimers)); + updateLowSpeedTimers(outputData[i].newLowSideSpeedTimers, const_cast(inputData.vehWheels4DynData->mTireLowSideSpeedTimers)); + updateJounces(outputData[i].jounces, const_cast(inputData.vehWheels4DynData->mJounces)); + updateSteers(&steerAngles[i*4], const_cast(inputData.vehWheels4DynData->mSteerAngles)); + if((numSubSteps-1) == k) + { + updateCachedHitData(outputData[i].cachedHitCounts, outputData[i].cachedHitPlanes, outputData[i].cachedHitDistances, outputData[i].cachedFrictionMultipliers, outputData[i].cachedHitQueryTypes, &wheels4DynDatas[i]); + } + chassisForce+=outputData[i].chassisForce; + chassisTorque+=outputData[i].chassisTorque; + if(0 == k) + { + wheels4DynDatas[i].mVehicleConstraints->mData=outputData[i].vehConstraintData; + } + storeSuspWheelTireResults(outputData[i], inputData.steerAngles, &wheelQueryResults[4*i], numActiveWheelsPerBlock4[i]); + storeHitActorForces(outputData[i], &vehicleConcurrentUpdates.concurrentWheelUpdates[4*i], numActiveWheelsPerBlock4[i]); + } + + //Copy the tire torques to a single array. + PxF32 tireTorques[PX_MAX_NB_WHEELS]; + for(PxU32 i=0;iengineGraphData); +#endif + } + + PxF32 engineDampingRate; + { + const PxVehicleEngineData& engineData=driveSimData.getEngineData(); + engineDampingRate=computeEngineDampingRate(engineData,currentGear,accel); + } + + //Update the wheel and engine speeds - 5x5 matrix coupling engine and wheels. + ImplicitSolverInput implicitSolverInput = + { + subTimestep, + 0.0f, 0.0f, + K, G, + PxVehicleClutchAccuracyMode::eBEST_POSSIBLE, 0, + engineDriveTorque, engineDampingRate, + diffTorqueRatios, aveWheelSpeedContributions, + brakeTorques, isBrakeApplied, tireTorques, + numWheels4, numActiveWheels, + wheels4SimDatas, &driveSimData + }; + ImplicitSolverOutput implicitSolverOutput = + { + wheels4DynDatas, &driveDynData + }; + solveTankInternaDynamicsEnginePlusDrivenWheels(implicitSolverInput, activeWheelStates, wheelGearings, &implicitSolverOutput); + + //Integrate wheel rotation angle (theta += omega*dt) + for(PxU32 i=0;imWheelsSimData, carChassisTransform, wheelQueryResults, chassisTorque); + + //Integrate the chassis velocity by applying the accumulated force and torque. + integrateBody(inverseChassisMass, inverseInertia, chassisForce, chassisTorque, subTimestep, carChassisLinVel, carChassisAngVel, carChassisTransform); + } + + //Set the new chassis linear/angular velocity. + if(context.updateMode == PxVehicleUpdateMode::eVELOCITY_CHANGE) + { + vehicleConcurrentUpdates.linearMomentumChange = carChassisLinVel; + vehicleConcurrentUpdates.angularMomentumChange = carChassisAngVel; + } + else + { + //integration steps are: + //v = v0 + a*dt (1) + //x = x0 + v*dt (2) + //Sub (2) into (1. + //x = x0 + v0*dt + a*dt*dt; + //Rearrange for a + //a = (x -x0 - v0*dt)/(dt*dt) = [(x-x0)/dt - v0/dt] + //Rearrange again with v = (x-x0)/dt + //a = (v - v0)/dt + vehicleConcurrentUpdates.linearMomentumChange = (carChassisLinVel-carChassisLinVelOrig)*recipTimestep; + vehicleConcurrentUpdates.angularMomentumChange = (carChassisAngVel-carChassisAngVelOrig)*recipTimestep; + } + + //Pose the wheels from jounces, rotations angles, and steer angles. + PxTransform localPoses0[4] = {PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity)}; + computeWheelLocalPoses(wheels4SimDatas[0],wheels4DynDatas[0],&wheelQueryResults[4*0],numActiveWheelsPerBlock4[0],carChassisCMLocalPose, + context.upAxis, context.sideAxis, context.forwardAxis, localPoses0); + wheelQueryResults[4*0 + 0].localPose = localPoses0[0]; + wheelQueryResults[4*0 + 1].localPose = localPoses0[1]; + wheelQueryResults[4*0 + 2].localPose = localPoses0[2]; + wheelQueryResults[4*0 + 3].localPose = localPoses0[3]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 0].localPose = localPoses0[0]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 1].localPose = localPoses0[1]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 2].localPose = localPoses0[2]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 3].localPose = localPoses0[3]; + for(PxU32 i=1;iwheelQueryResults) + { + PxMemCopy(vehWheelQueryResults->wheelQueryResults, wheelQueryResults, sizeof(PxWheelQueryResult)*numActiveWheels); + } + + if(vehConcurrentUpdates) + { + //Copy across to input data structure so that writes can be applied later. + PxMemCopy(vehConcurrentUpdates->concurrentWheelUpdates, vehicleConcurrentUpdates.concurrentWheelUpdates, sizeof(PxVehicleWheelConcurrentUpdateData)*numActiveWheels); + vehConcurrentUpdates->linearMomentumChange = vehicleConcurrentUpdates.linearMomentumChange; + vehConcurrentUpdates->angularMomentumChange = vehicleConcurrentUpdates.angularMomentumChange; + vehConcurrentUpdates->staySleeping = vehicleConcurrentUpdates.staySleeping; + vehConcurrentUpdates->wakeup = vehicleConcurrentUpdates.wakeup; + } + else + { + //Apply the writes immediately. + PxVehicleWheels* vehWheels[1]={vehDriveTank}; + PxVehicleUpdate::updatePost(&vehicleConcurrentUpdates, 1, vehWheels, context); + } +} + +void PxVehicleUpdate::updateNoDrive +(const PxF32 timestep, + const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude, + const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs, + PxVehicleNoDrive* vehNoDrive, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates, + VehicleTelemetryDataContext* vehTelemetryDataContext, const PxVehicleContext& context) +{ +#if !PX_DEBUG_VEHICLE_ON + PX_UNUSED(vehTelemetryDataContext); +#endif + + PX_SIMD_GUARD; // denorm exception in transformInertiaTensor() on osx + + PX_CHECK_AND_RETURN( + !(vehNoDrive->getRigidDynamicActor()->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), + "Attempting to update a PxVehicleNoDrive with a kinematic actor - this isn't allowed"); + + PX_CHECK_AND_RETURN( + NULL==vehWheelQueryResults || vehWheelQueryResults->nbWheelQueryResults >= vehNoDrive->mWheelsSimData.getNbWheels(), + "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle"); + +#if PX_CHECKED + for(PxU32 i=0;imWheelsSimData.getNbWheels();i++) + { + PX_CHECK_AND_RETURN( + !vehNoDrive->mWheelsSimData.getIsWheelDisabled(i) || 0==vehNoDrive->getDriveTorque(i), + "Disabled wheels should have zero drive torque applied to them."); + } +#endif + +#if PX_DEBUG_VEHICLE_ON + if (vehTelemetryDataContext) + { + for(PxU32 i=0;imWheelsSimData.mNbWheels4;i++) + { + updateGraphDataInternalWheelDynamics(4*i,vehNoDrive->mWheelsDynData.mWheels4DynData[i].mWheelSpeeds, vehTelemetryDataContext->wheelGraphData); + } + } +#endif + + //Unpack the tank simulation and instanced dynamics components. + const PxVehicleWheels4SimData* wheels4SimDatas=vehNoDrive->mWheelsSimData.mWheels4SimData; + const PxVehicleTireLoadFilterData& tireLoadFilterData=vehNoDrive->mWheelsSimData.mNormalisedLoadFilter; + PxVehicleWheels4DynData* wheels4DynDatas=vehNoDrive->mWheelsDynData.mWheels4DynData; + const PxU32 numWheels4=vehNoDrive->mWheelsSimData.mNbWheels4; + const PxU32 numActiveWheels=vehNoDrive->mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=4-(4*numWheels4-numActiveWheels); + PxRigidDynamic* vehActor=vehNoDrive->mActor; + + //We need to store that data we are going to write to actors so we can do this at the end in one go with fewer write locks. + PxVehicleWheelConcurrentUpdateData wheelConcurrentUpdates[PX_MAX_NB_WHEELS]; + PxVehicleConcurrentUpdateData vehicleConcurrentUpdates; + vehicleConcurrentUpdates.nbConcurrentWheelUpdates = numActiveWheels; + vehicleConcurrentUpdates.concurrentWheelUpdates = wheelConcurrentUpdates; + + //Test if a non-zero drive torque was applied or if a non-zero steer angle was applied. + bool finiteInputApplied=false; + for(PxU32 i=0;igetDriveTorque(i) != 0.0f) + { + finiteInputApplied=true; + break; + } + if(vehNoDrive->getSteerAngle(i)!=0.0f) + { + finiteInputApplied=true; + break; + } + } + + //Wake or sleep. + { + if(vehActor->getScene() && vehActor->isSleeping()) //Support case where actor is not in a scene and constraints get solved via immediate mode + { + if(finiteInputApplied) + { + //Driving inputs so we need the actor to start moving. + vehicleConcurrentUpdates.wakeup = true; + } + else if(isOnDynamicActor(vehNoDrive->mWheelsSimData, vehNoDrive->mWheelsDynData)) + { + //Driving on dynamic so we need to keep moving. + vehicleConcurrentUpdates.wakeup = true; + } + else + { + //No driving inputs and the actor is asleep. + //Set internal dynamics to sleep. + setInternalDynamicsToZero(vehNoDrive); + if(vehConcurrentUpdates) vehConcurrentUpdates->staySleeping = true; + return; + } + } + } + + //In each block of 4 wheels record how many wheels are active. + PxU32 numActiveWheelsPerBlock4[PX_MAX_NB_SUSPWHEELTIRE4]={0,0,0,0,0}; + numActiveWheelsPerBlock4[0]=PxMin(numActiveWheels,PxU32(4)); + for(PxU32 i=1;imWheelsDynData.mTireForceCalculators->mShaderData[4*i+0]; + tires4ForceCalculators[i].mShaderData[1]=vehNoDrive->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+1]; + tires4ForceCalculators[i].mShaderData[2]=vehNoDrive->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+2]; + tires4ForceCalculators[i].mShaderData[3]=vehNoDrive->mWheelsDynData.mTireForceCalculators->mShaderData[4*i+3]; + tires4ForceCalculators[i].mShader=vehNoDrive->mWheelsDynData.mTireForceCalculators->mShader; + } + + //Mark the suspension/tire constraints as dirty to force them to be updated in the sdk. + for(PxU32 i=0;imarkDirty(); + } + + //Need to store report data to pose the wheels. + PxWheelQueryResult wheelQueryResults[PX_MAX_NB_WHEELS]; + + //Center of mass local pose. + PxTransform carChassisCMLocalPose; + //Compute the transform of the center of mass. + PxTransform origCarChassisTransform; + PxTransform carChassisTransform; + //Inverse mass and inertia to apply the tire/suspension forces as impulses. + PxF32 inverseChassisMass; + PxVec3 inverseInertia; + //Linear and angular velocity. + PxVec3 carChassisLinVel; + PxVec3 carChassisAngVel; + { + carChassisCMLocalPose = vehActor->getCMassLocalPose(); + carChassisCMLocalPose.q = PxQuat(PxIdentity); + origCarChassisTransform = vehActor->getGlobalPose().transform(carChassisCMLocalPose); + carChassisTransform = origCarChassisTransform; + const PxF32 chassisMass = vehActor->getMass(); + inverseChassisMass = 1.0f/chassisMass; + inverseInertia = vehActor->getMassSpaceInvInertiaTensor(); + carChassisLinVel = vehActor->getLinearVelocity(); + carChassisAngVel = vehActor->getAngularVelocity(); + } + + //Get the local rotations of the wheel shapes with the latest steer. + //These should be very close to the poses at the most recent scene query. + PxQuat wheelLocalPoseRotations[PX_MAX_NB_WHEELS]; + computeWheelLocalPoseRotations(wheels4DynDatas, wheels4SimDatas, numWheels4, context, vehNoDrive->mSteerAngles, wheelLocalPoseRotations); + + PxF32 maxAccel=0; + PxF32 maxBrake=0; + for(PxU32 i=0;imDriveTorques[i]), maxAccel); + maxBrake = PxMax(PxAbs(vehNoDrive->mBrakeTorques[i]), maxBrake); + } + const bool isIntentionToAccelerate = (maxAccel>0.0f && 0.0f==maxBrake); + + //Store the susp line raycast data. + for(PxU32 i=0;imWheelsSimData,carChassisLinVel,carChassisTransform, + context.forwardAxis); + const PxF32 timeFraction=1.0f/(1.0f*numSubSteps); + const PxF32 subTimestep=timestep*timeFraction; + const PxF32 recipSubTimeStep=1.0f/subTimestep; + const PxF32 recipTimestep=1.0f/timestep; + const PxF32 minLongSlipDenominator=vehNoDrive->mWheelsSimData.mMinLongSlipDenominator; + ProcessSuspWheelTireConstData constData={timeFraction, subTimestep, recipSubTimeStep, gravity, gravityMagnitude, recipGravityMagnitude, false, minLongSlipDenominator, + vehActor, &drivableSurfaceToTireFrictionPairs, vehNoDrive->mWheelsSimData.mFlags}; + + for(PxU32 k=0;kmBrakeTorques[4*i]; + const PxF32* PX_RESTRICT rawSteerAngles=&vehNoDrive->mSteerAngles[4*i]; + const PxF32* PX_RESTRICT rawDriveTorques=&vehNoDrive->mDriveTorques[4*i]; + + //Work out which wheels are enabled. + bool activeWheelStates[4]={false,false,false,false}; + computeWheelActiveStates(4*i, vehNoDrive->mWheelsSimData.mActiveWheelsBitmapBuffer, activeWheelStates); + + const PxVehicleWheels4SimData& wheels4SimData=wheels4SimDatas[i]; + PxVehicleWheels4DynData& wheels4DynData=wheels4DynDatas[i]; + + //Compute the brake torques. + PxF32 brakeTorques[4]={0.0f,0.0f,0.0f,0.0f}; + bool isBrakeApplied[4]={false,false,false,false}; + computeNoDriveBrakeTorques + (wheels4SimData.mWheels,wheels4DynData.mWheelSpeeds,rawBrakeTorques, + brakeTorques,isBrakeApplied); + + //Compute the per wheel accel pedal values. + bool isAccelApplied[4]={false,false,false,false}; + if(isIntentionToAccelerate) + { + computeIsAccelApplied(rawDriveTorques, isAccelApplied); + } + + //Compute jounces, slips, tire forces, suspension forces etc. + ProcessSuspWheelTireInputData inputData= + { + isIntentionToAccelerate, isAccelApplied, isBrakeApplied, rawSteerAngles, activeWheelStates, + carChassisTransform, carChassisLinVel, carChassisAngVel, + &wheelLocalPoseRotations[i], &wheels4SimData, &wheels4DynData, &tires4ForceCalculators[i], &tireLoadFilterData, numActiveWheelsPerBlock4[i] + }; + ProcessSuspWheelTireOutputData outputData; + processSuspTireWheels(4*i, constData, inputData, context.sideAxis, + context.pointRejectAngleThresholdCosine, context.normalRejectAngleThresholdCosine, + context.maxHitActorAcceleration, + outputData, vehTelemetryDataContext); + updateLowSpeedTimers(outputData.newLowForwardSpeedTimers, const_cast(inputData.vehWheels4DynData->mTireLowForwardSpeedTimers)); + updateLowSpeedTimers(outputData.newLowSideSpeedTimers, const_cast(inputData.vehWheels4DynData->mTireLowSideSpeedTimers)); + updateJounces(outputData.jounces, const_cast(inputData.vehWheels4DynData->mJounces)); + updateSteers(rawSteerAngles, const_cast(inputData.vehWheels4DynData->mSteerAngles)); + + if((numSubSteps-1) == k) + { + updateCachedHitData(outputData.cachedHitCounts, outputData.cachedHitPlanes, outputData.cachedHitDistances, outputData.cachedFrictionMultipliers, outputData.cachedHitQueryTypes, &wheels4DynData); + } + chassisForce+=outputData.chassisForce; + chassisTorque+=outputData.chassisTorque; + if(0 == k) + { + wheels4DynDatas[i].mVehicleConstraints->mData=outputData.vehConstraintData; + } + storeSuspWheelTireResults(outputData, inputData.steerAngles, &wheelQueryResults[4*i], numActiveWheelsPerBlock4[i]); + storeHitActorForces(outputData, &vehicleConcurrentUpdates.concurrentWheelUpdates[4*i], numActiveWheelsPerBlock4[i]); + + //Integrate wheel speeds. + const PxF32 wheelDampingRates[4]= + { + wheels4SimData.getWheelData(0).mDampingRate, + wheels4SimData.getWheelData(1).mDampingRate, + wheels4SimData.getWheelData(2).mDampingRate, + wheels4SimData.getWheelData(3).mDampingRate + }; + integrateNoDriveWheelSpeeds( + subTimestep, + brakeTorques,isBrakeApplied,rawDriveTorques,outputData.tireTorques,wheelDampingRates, + wheels4SimData,wheels4DynData); + + integrateNoDriveWheelRotationAngles( + subTimestep, + rawDriveTorques, + outputData.jounces, outputData.forwardSpeeds, isBrakeApplied, + wheels4SimData, + wheels4DynData); + } + + //Apply the anti-roll suspension. + procesAntiRollSuspension(vehNoDrive->mWheelsSimData, carChassisTransform, wheelQueryResults, chassisTorque); + + //Integrate the chassis velocity by applying the accumulated force and torque. + integrateBody(inverseChassisMass, inverseInertia, chassisForce, chassisTorque, subTimestep, carChassisLinVel, carChassisAngVel, carChassisTransform); + } + + //Set the new chassis linear/angular velocity. + if(context.updateMode == PxVehicleUpdateMode::eVELOCITY_CHANGE) + { + vehicleConcurrentUpdates.linearMomentumChange = carChassisLinVel; + vehicleConcurrentUpdates.angularMomentumChange = carChassisAngVel; + } + else + { + //integration steps are: + //v = v0 + a*dt (1) + //x = x0 + v*dt (2) + //Sub (2) into (1. + //x = x0 + v0*dt + a*dt*dt; + //Rearrange for a + //a = (x -x0 - v0*dt)/(dt*dt) = [(x-x0)/dt - v0/dt] + //Rearrange again with v = (x-x0)/dt + //a = (v - v0)/dt + vehicleConcurrentUpdates.linearMomentumChange = (carChassisLinVel-carChassisLinVelOrig)*recipTimestep; + vehicleConcurrentUpdates.angularMomentumChange = (carChassisAngVel-carChassisAngVelOrig)*recipTimestep; + } + + //Pose the wheels from jounces, rotations angles, and steer angles. + PxTransform localPoses0[4] = {PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity), PxTransform(PxIdentity)}; + computeWheelLocalPoses(wheels4SimDatas[0],wheels4DynDatas[0],&wheelQueryResults[4*0],numActiveWheelsPerBlock4[0],carChassisCMLocalPose, + context.upAxis, context.sideAxis, context.forwardAxis, localPoses0); + wheelQueryResults[4*0 + 0].localPose = localPoses0[0]; + wheelQueryResults[4*0 + 1].localPose = localPoses0[1]; + wheelQueryResults[4*0 + 2].localPose = localPoses0[2]; + wheelQueryResults[4*0 + 3].localPose = localPoses0[3]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 0].localPose = localPoses0[0]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 1].localPose = localPoses0[1]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 2].localPose = localPoses0[2]; + vehicleConcurrentUpdates.concurrentWheelUpdates[4*0 + 3].localPose = localPoses0[3]; + for(PxU32 i=1;iwheelQueryResults) + { + PxMemCopy(vehWheelQueryResults->wheelQueryResults, wheelQueryResults, sizeof(PxWheelQueryResult)*numActiveWheels); + } + + if(vehConcurrentUpdates) + { + //Copy across to input data structure so that writes can be applied later. + PxMemCopy(vehConcurrentUpdates->concurrentWheelUpdates, vehicleConcurrentUpdates.concurrentWheelUpdates, sizeof(PxVehicleWheelConcurrentUpdateData)*numActiveWheels); + vehConcurrentUpdates->linearMomentumChange = vehicleConcurrentUpdates.linearMomentumChange; + vehConcurrentUpdates->angularMomentumChange = vehicleConcurrentUpdates.angularMomentumChange; + vehConcurrentUpdates->staySleeping = vehicleConcurrentUpdates.staySleeping; + vehConcurrentUpdates->wakeup = vehicleConcurrentUpdates.wakeup; + } + else + { + //Apply the writes immediately. + PxVehicleWheels* vehWheels[1]={vehNoDrive}; + PxVehicleUpdate::updatePost(&vehicleConcurrentUpdates, 1, vehWheels, context); + } +} + + +void PxVehicleUpdate::shiftOrigin(const PxVec3& shift, const PxU32 numVehicles, PxVehicleWheels** vehicles) +{ + for(PxU32 i=0; i < numVehicles; i++) + { + //Get the current car. + PxVehicleWheels& veh = *vehicles[i]; + PxVehicleWheels4DynData* PX_RESTRICT wheels4DynData=veh.mWheelsDynData.mWheels4DynData; + const PxU32 numWheels4=veh.mWheelsSimData.mNbWheels4; + + //Blocks of 4 wheels. + for(PxU32 j=0; j < numWheels4; j++) + { + bool activeWheelStates[4]={false,false,false,false}; + computeWheelActiveStates(4*j, veh.mWheelsSimData.mActiveWheelsBitmapBuffer, activeWheelStates); + + if (wheels4DynData[j].mRaycastResults) // this is set when a query has been scheduled + { + PxVehicleWheels4DynData::SuspLineRaycast& raycast = + reinterpret_cast(wheels4DynData[j].mQueryOrCachedHitResults); + + for(PxU32 k=0; k < 4; k++) + { + if (activeWheelStates[k]) + { + raycast.mStarts[k] -= shift; + + if (wheels4DynData[j].mRaycastResults[k].hasBlock) + const_cast(wheels4DynData[j].mRaycastResults[k].block.position) -= shift; + } + } + } + else if(wheels4DynData[i].mSweepResults) + { + PxVehicleWheels4DynData::SuspLineSweep& sweep = + reinterpret_cast(wheels4DynData[j].mQueryOrCachedHitResults); + + for(PxU32 k=0; k < 4; k++) + { + if (activeWheelStates[k]) + { + sweep.mStartPose[k].p -= shift; + + if (wheels4DynData[j].mSweepResults[k].hasBlock) + const_cast(wheels4DynData[j].mSweepResults[k].block.position) -= shift; + } + } + } + } + } +} + +}//namespace physx + +#if PX_DEBUG_VEHICLE_ON + +///////////////////////////////////////////////////////////////////////////////// +//Update a single vehicle of any type and record the associated telemetry data. +///////////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE void PxVehicleUpdate::updateSingleVehicleAndStoreTelemetryData +(const PxF32 timestep, const PxVec3& gravity, const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs, + PxVehicleWheels* vehWheels, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleTelemetryData& telemetryData, + PxVehicleConcurrentUpdateData* vehConcurrentUpdates, const PxVehicleContext& context) +{ + START_TIMER(TIMER_ALL); + + PX_CHECK_MSG(vehWheels->mWheelsSimData.getNbWheels()==telemetryData.getNbWheelGraphs(), "vehicle and telemetry data need to have the same number of wheels"); + + VehicleTelemetryDataContext vehicleTelemetryDataContext; + PxMemZero(vehicleTelemetryDataContext.wheelGraphData, sizeof(vehicleTelemetryDataContext.wheelGraphData)); + PxMemZero(vehicleTelemetryDataContext.engineGraphData, sizeof(vehicleTelemetryDataContext.engineGraphData)); + PxMemZero(vehicleTelemetryDataContext.suspForceAppPoints, sizeof(vehicleTelemetryDataContext.suspForceAppPoints)); + PxMemZero(vehicleTelemetryDataContext.tireForceAppPoints, sizeof(vehicleTelemetryDataContext.tireForceAppPoints)); + + update(timestep, gravity, vehicleDrivableSurfaceToTireFrictionPairs, 1, &vehWheels, vehWheelQueryResults, vehConcurrentUpdates, + &vehicleTelemetryDataContext, context); + + for(PxU32 i=0;imWheelsSimData.mNbActiveWheels;i++) + { + telemetryData.mWheelGraphs[i].updateTimeSlice(vehicleTelemetryDataContext.wheelGraphData[i]); + telemetryData.mSuspforceAppPoints[i]=vehicleTelemetryDataContext.suspForceAppPoints[i]; + telemetryData.mTireforceAppPoints[i]=vehicleTelemetryDataContext.tireForceAppPoints[i]; + } + telemetryData.mEngineGraph->updateTimeSlice(vehicleTelemetryDataContext.engineGraphData); + + END_TIMER(TIMER_ALL); + +#if PX_VEHICLE_PROFILE + + gTimerCount++; + if(10==gTimerCount) + { + + /* + printf("%f %f %f %f %f %f %f %f %f\n", + localTimers[TIMER_ADMIN]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_GRAPHS]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_COMPONENTS_UPDATE]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_WHEELS]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_INTERNAL_DYNAMICS_SOLVER]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_POSTUPDATE1]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_POSTUPDATE2]/(1.0f*localTimers[TIMER_ALL]), + localTimers[TIMER_POSTUPDATE3]/(1.0f*localTimers[TIMER_ALL]), + floatTimeIn10sOfNs); + */ + + printf("%f %f %f %f %f %f \n", + getTimerFraction(TIMER_WHEELS), + getTimerFraction(TIMER_INTERNAL_DYNAMICS_SOLVER), + getTimerFraction(TIMER_POSTUPDATE2), + getTimerFraction(TIMER_POSTUPDATE3), + getTimerInMilliseconds(TIMER_ALL), + getTimerInMilliseconds(TIMER_RAYCASTS)); + + gTimerCount=0; + for(PxU32 i=0;i0, "gravity vector must have non-zero length"); + PX_CHECK_AND_RETURN(timestep>0, "timestep must be greater than zero"); + PX_CHECK_AND_RETURN(gThresholdForwardSpeedForWheelAngleIntegration>0, "PxInitVehicleSDK needs to be called before ever calling PxVehicleUpdates or PxVehicleUpdateSingleVehicleAndStoreTelemetryData"); + +#if PX_CHECKED + for(PxU32 i=0;imWheelsSimData.mNbWheels4;j++) + { + PX_CHECK_MSG( + vehWheels->mWheelsDynData.mWheels4DynData[j].mRaycastResults || + vehWheels->mWheelsDynData.mWheels4DynData[j].mSweepResults || + vehWheels->mWheelsDynData.mWheels4DynData[0].mHasCachedRaycastHitPlane || + (vehWheels->mWheelsSimData.getIsWheelDisabled(4*j+0) && + vehWheels->mWheelsSimData.getIsWheelDisabled(4*j+1) && + vehWheels->mWheelsSimData.getIsWheelDisabled(4*j+2) && + vehWheels->mWheelsSimData.getIsWheelDisabled(4*j+3)), + "Need to call PxVehicleSuspensionRaycasts or PxVehicleSuspensionSweeps at least once before trying to update"); + } + for(PxU32 j=0;jmWheelsSimData.mNbActiveWheels;j++) + { + PX_CHECK_MSG(vehWheels->mWheelsDynData.mTireForceCalculators->mShaderData[j], "Need to set non-null tire force shader data ptr"); + } + PX_CHECK_MSG(vehWheels->mWheelsDynData.mTireForceCalculators->mShader, "Need to set non-null tire force shader function"); + + PX_CHECK_AND_RETURN(NULL==vehicleWheelQueryResults || vehicleWheelQueryResults[i].nbWheelQueryResults >= vehicles[i]->mWheelsSimData.getNbWheels(), + "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle"); + + for(PxU32 j=0;jmWheelsSimData.mNbActiveWheels;j++) + { + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(j) || -1==vehWheels->mWheelsSimData.getWheelShapeMapping(j), + "Disabled wheels must not be associated with a PxShape: use setWheelShapeMapping to remove the association"); + + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(j) || 0==vehWheels->mWheelsDynData.getWheelRotationSpeed(j), + "Disabled wheels must have zero rotation speed: use setWheelRotationSpeed to set the wheel to zero rotation speed"); + } + + PX_CHECK_AND_RETURN(!vehicleConcurrentUpdates || (vehicleConcurrentUpdates[i].concurrentWheelUpdates && vehicleConcurrentUpdates[i].nbConcurrentWheelUpdates >= vehicles[i]->mWheelsSimData.getNbWheels()), + "vehicleConcurrentUpdates is illegally configured with either null pointers or with insufficient memory for successful concurrent updates."); + + for(PxU32 j=0; j < vehWheels->mWheelsSimData.mNbActiveAntiRollBars; j++) + { + const PxVehicleAntiRollBarData antiRoll = vehWheels->mWheelsSimData.getAntiRollBarData(j); + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(antiRoll.mWheel0), "Wheel0 of antiroll bar is disabled. This is not supported."); + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(antiRoll.mWheel1), "Wheel1 of antiroll bar is disabled. This is not supported."); + } + } +#endif + + const PxF32 gravityMagnitude=gravity.magnitude(); + const PxF32 recipGravityMagnitude=1.0f/gravityMagnitude; + + for(PxU32 i=0;imType) + { + case PxVehicleTypes::eDRIVE4W: + { + PxVehicleDrive4W* vehDrive4W=static_cast(vehWheels); + + PxVehicleUpdate::updateDrive4W( + timestep, + gravity,gravityMagnitude,recipGravityMagnitude, + vehicleDrivableSurfaceToTireFrictionPairs, + vehDrive4W, vehWheelQueryResults, vehConcurrentUpdateData, vehicleTelemetryDataContext, + context); + } + break; + + case PxVehicleTypes::eDRIVENW: + { + PxVehicleDriveNW* vehDriveNW=static_cast(vehWheels); + + PxVehicleUpdate::updateDriveNW( + timestep, + gravity,gravityMagnitude,recipGravityMagnitude, + vehicleDrivableSurfaceToTireFrictionPairs, + vehDriveNW, vehWheelQueryResults, vehConcurrentUpdateData, vehicleTelemetryDataContext, + context); + } + break; + + case PxVehicleTypes::eDRIVETANK: + { + PxVehicleDriveTank* vehDriveTank=static_cast(vehWheels); + + PxVehicleUpdate::updateTank( + timestep, + gravity,gravityMagnitude,recipGravityMagnitude, + vehicleDrivableSurfaceToTireFrictionPairs, + vehDriveTank, vehWheelQueryResults, vehConcurrentUpdateData, vehicleTelemetryDataContext, + context); + } + break; + + case PxVehicleTypes::eNODRIVE: + { + PxVehicleNoDrive* vehDriveNoDrive=static_cast(vehWheels); + + PxVehicleUpdate::updateNoDrive( + timestep, + gravity,gravityMagnitude,recipGravityMagnitude, + vehicleDrivableSurfaceToTireFrictionPairs, + vehDriveNoDrive, vehWheelQueryResults, vehConcurrentUpdateData, vehicleTelemetryDataContext, + context); + } + break; + + default: + PX_CHECK_MSG(false, "update - unsupported vehicle type"); + break; + } + } +} + + +void PxVehicleUpdate::updatePost +(const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 numVehicles, PxVehicleWheels** vehicles, + const PxVehicleContext& context) +{ + PX_PROFILE_ZONE("PxVehicleUpdates::ePROFILE_POSTUPDATES",0); + + PX_CHECK_AND_RETURN(vehicleConcurrentUpdates, "vehicleConcurrentUpdates must be non-null."); + +#if PX_CHECKED + for(PxU32 i=0;imWheelsSimData.mNbActiveWheels;j++) + { + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(j) || -1==vehWheels->mWheelsSimData.getWheelShapeMapping(j), + "Disabled wheels must not be associated with a PxShape: use setWheelShapeMapping to remove the association"); + + PX_CHECK_AND_RETURN(!vehWheels->mWheelsSimData.getIsWheelDisabled(j) || 0==vehWheels->mWheelsDynData.getWheelRotationSpeed(j), + "Disabled wheels must have zero rotation speed: use setWheelRotationSpeed to set the wheel to zero rotation speed"); + + PX_CHECK_AND_RETURN(vehicleConcurrentUpdates[i].concurrentWheelUpdates && vehicleConcurrentUpdates[i].nbConcurrentWheelUpdates >= vehWheels->mWheelsSimData.getNbWheels(), + "vehicleConcurrentUpdates is illegally configured with either null pointers or insufficient memory for successful concurrent vehicle updates."); + } + } +#endif + + for(PxU32 i=0;igetRigidDynamicActor(); + + //Get the concurrent update data for the ith vehicle. + //This contains the data that couldn't get updated concurrently and now must be + //set sequentially. + const PxVehicleConcurrentUpdateData& vehicleConcurrentUpdate = vehicleConcurrentUpdates[i]; + + //Test if the actor is to remain sleeping. + //If the actor is to remain sleeping then do nothing. + if(!vehicleConcurrentUpdate.staySleeping) + { + //Wake the vehicle's actor up as required. + if(vehicleConcurrentUpdate.wakeup && vehActor->getScene()) //Support case where actor is not in a scene and constraints get solved via immediate mode + { + vehActor->wakeUp(); + } + + //Apply momentum changes to vehicle's actor + if(context.updateMode == PxVehicleUpdateMode::eVELOCITY_CHANGE) + { + vehActor->setLinearVelocity(vehicleConcurrentUpdate.linearMomentumChange, false); + vehActor->setAngularVelocity(vehicleConcurrentUpdate.angularMomentumChange, false); + } + else + { + vehActor->addForce(vehicleConcurrentUpdate.linearMomentumChange, PxForceMode::eACCELERATION, false); + vehActor->addTorque(vehicleConcurrentUpdate.angularMomentumChange, PxForceMode::eACCELERATION, false); + } + + //In each block of 4 wheels record how many wheels are active. + const PxU32 numActiveWheels=vehWheels->mWheelsSimData.mNbActiveWheels; + const PxU32 numWheels4 = vehWheels->mWheelsSimData.getNbWheels4(); + const PxU32 numActiveWheelsInLast4=4-(4*numWheels4 - numActiveWheels); + PxU32 numActiveWheelsPerBlock4[PX_MAX_NB_SUSPWHEELTIRE4]={0,0,0,0,0}; + numActiveWheelsPerBlock4[0]=PxMin(numActiveWheels,PxU32(4)); + for(PxU32 j=1;jmWheelsSimData.mWheels4SimData[j],localPoses,numActiveWheelsPerBlock4[j],vehActor); + } + + //Apply forces to dynamic actors hit by the wheels. + for(PxU32 j=0;jgetCMassLocalPose(); + massXform.q = PxQuat(PxIdentity); + PxTransform carChassisTrnsfm = vehActor->getGlobalPose().transform(massXform); + + //Add a raycast for each wheel. + for(PxU32 j=0;j=0); + PX_ASSERT(maxDroop>=0); + + if(!activeWheelStates[j]) + { + //For disabled wheels just issue a raycast of almost zero length. + //This should be very cheap and ought to hit nothing. + bodySpaceWheelCentreOffset=PxVec3(0,0,0); + maxDroop=1e-5f*gToleranceScaleLength; + maxBounce=1e-5f*gToleranceScaleLength; + radius=1e-5f*gToleranceScaleLength; + } + + PxVec3 suspLineStart; + PxVec3 suspLineDir; + computeSuspensionRaycast(carChassisTrnsfm,bodySpaceWheelCentreOffset,bodySpaceSuspTravelDir,radius,maxBounce,suspLineStart,suspLineDir); + + //Total length from top of wheel at max compression to bottom of wheel at max droop. + PxF32 suspLineLength=radius + maxBounce + maxDroop + radius; + //Add another radius on for good measure. + suspLineLength+=radius; + + //Store the susp line ray for later use. + PxVehicleWheels4DynData::SuspLineRaycast& raycast = + reinterpret_cast(wheels4DynData.mQueryOrCachedHitResults); + raycast.mStarts[j]=suspLineStart; + raycast.mDirs[j]=suspLineDir; + raycast.mLengths[j]=suspLineLength; + + //Add the raycast to the scene query. + const PxRaycastBuffer* raycastBuffer = batchQuery->raycast( + suspLineStart, suspLineDir, suspLineLength, 0, + PxHitFlag::ePOSITION|PxHitFlag::eNORMAL|PxHitFlag::eUV, carFilterData[j]); + + if(0 == j) + buffer4 = raycastBuffer; + + if (!raycastBuffer) + return buffer4 = NULL; + } + + return buffer4; +} + +void PxVehicleUpdate::suspensionRaycasts(PxBatchQueryExt* batchQuery, const PxU32 numVehicles, PxVehicleWheels** vehicles, const bool* vehiclesToRaycast, const PxQueryFlags queryFlags) +{ + START_TIMER(TIMER_RAYCASTS); + + //Work out the rays for the suspension line raycasts and perform all the raycasts. + for(PxU32 i=0;i> 2); + const PxU32 numActiveWheels=veh.mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=numActiveWheels-4*numWheels4; + PxRigidDynamic* vehActor=veh.mActor; + + //Set the results pointer and start the raycasts. + PX_ASSERT(numActiveWheelsInLast4<4); + + //Blocks of 4 wheels. + for(PxU32 j=0;j0) + { + const PxU32 j=numWheels4; + + bool activeWheelStates[4]={false,false,false,false}; + computeWheelActiveStates(4*j, veh.mWheelsSimData.mActiveWheelsBitmapBuffer, activeWheelStates); + + wheels4DynData[j].mRaycastResults=NULL; + wheels4DynData[j].mSweepResults=NULL; + + if(!vehiclesToRaycast || vehiclesToRaycast[i]) + { + PxQueryFilterData carFilterData[4]; + + if (0 < numActiveWheelsInLast4) + carFilterData[0] = PxQueryFilterData(wheels4SimData[j].getSceneQueryFilterData(0), queryFlags); + if (1 < numActiveWheelsInLast4) + carFilterData[1] = PxQueryFilterData(wheels4SimData[j].getSceneQueryFilterData(1), queryFlags); + if (2 < numActiveWheelsInLast4) + carFilterData[2] = PxQueryFilterData(wheels4SimData[j].getSceneQueryFilterData(2), queryFlags); + + const PxRaycastBuffer* buffer = vehicleWheels4SuspensionRaycasts(batchQuery,wheels4SimData[j],wheels4DynData[j],carFilterData,activeWheelStates,numActiveWheelsInLast4,vehActor); + PX_CHECK_MSG(buffer, "PxVehicleUpdate::suspensionRaycasts - PxVehicleBatchUpdate raycast buffers not large enough to perform raycast."); + wheels4DynData[j].mRaycastResults = buffer; + } + } + } + + batchQuery->execute(); + + END_TIMER(TIMER_RAYCASTS); +} + +void physx::PxVehicleSuspensionRaycasts(PxBatchQueryExt* batchQuery, const PxU32 numVehicles, PxVehicleWheels** vehicles, const bool* vehiclesToRaycast, const PxQueryFlags queryFlags) +{ + PX_PROFILE_ZONE("PxVehicleSuspensionRaycasts::ePROFILE_RAYCASTS",0); + PxVehicleUpdate::suspensionRaycasts(batchQuery, numVehicles, vehicles, vehiclesToRaycast, queryFlags); +} + +static const PxSweepBuffer* vehicleWheels4SuspensionSweeps +(PxBatchQueryExt* batchQuery, + const PxVehicleWheels4SimData& wheels4SimData, PxVehicleWheels4DynData& wheels4DynData, + const PxQueryFilterData* carFilterData, const bool* activeWheelStates, const PxU32 numActiveWheels, + const PxU16 nbHitsPerQuery, + const PxI32* wheelShapeIds, + PxRigidDynamic* vehActor, + const PxF32 sweepWidthScale, const PxF32 sweepRadiusScale, const PxF32 sweepInflation, + const PxVec3& upAxis, const PxVec3& forwardAxis, const PxVec3& sideAxis) +{ + PX_UNUSED(sweepWidthScale); + PX_UNUSED(sweepRadiusScale); + + //Get the transform of the chassis. + PxTransform carChassisTrnsfm=vehActor->getGlobalPose().transform(vehActor->getCMassLocalPose()); + + const PxSweepBuffer* buffer4 = NULL; + + //Add a raycast for each wheel. + for(PxU32 j=0;jgetShapes(&wheelShape, 1, PxU32(wheelShapeIds[j])); + + PxGeometryHolder suspGeometry; + if (PxGeometryType::eCONVEXMESH == wheelShape->getGeometryType()) + { + PxConvexMeshGeometry convMeshGeom; + wheelShape->getConvexMeshGeometry(convMeshGeom); + convMeshGeom.scale.scale = convMeshGeom.scale.scale.multiply( + PxVec3( + PxAbs(sideAxis.x*sweepWidthScale + (upAxis.x + forwardAxis.x)*sweepRadiusScale), + PxAbs(sideAxis.y*sweepWidthScale + (upAxis.y + forwardAxis.y)*sweepRadiusScale), + PxAbs(sideAxis.z*sweepWidthScale + (upAxis.z + forwardAxis.z)*sweepRadiusScale)) + ); + suspGeometry.storeAny(convMeshGeom); + } + else if (PxGeometryType::eCAPSULE == wheelShape->getGeometryType()) + { + PxCapsuleGeometry capsuleGeom; + wheelShape->getCapsuleGeometry(capsuleGeom); + capsuleGeom.halfHeight *= sweepWidthScale; + capsuleGeom.radius *= sweepRadiusScale; + suspGeometry.storeAny(capsuleGeom); + } + else + { + PX_ASSERT(PxGeometryType::eSPHERE == wheelShape->getGeometryType()); + PxSphereGeometry sphereGeom; + wheelShape->getSphereGeometry(sphereGeom); + sphereGeom.radius *= sweepRadiusScale; + suspGeometry.storeAny(sphereGeom); + } + + const float jounce = wheels4DynData.mJounces[j] != PX_MAX_F32 ? wheels4DynData.mJounces[j] : 0.0f; + const float steerAngle = wheels4DynData.mSteerAngles[j]; + const PxVehicleSuspensionData& suspData = wheels4SimData.getSuspensionData(j); + const PxQuat wheelLocalPoseRotation = computeWheelLocalQuat(forwardAxis, sideAxis, upAxis, jounce, suspData, 0.0f, steerAngle); + + const PxVec3& bodySpaceSuspTravelDir = wheels4SimData.getSuspTravelDirection(j); + PxVec3 bodySpaceWheelCentreOffset = wheels4SimData.getWheelCentreOffset(j); + PxF32 maxDroop = susp.mMaxDroop; + PxF32 maxBounce = susp.mMaxCompression; + PxF32 radius = wheel.mRadius; + PX_ASSERT(maxBounce >= 0); + PX_ASSERT(maxDroop >= 0); + + if(!activeWheelStates[j]) + { + //For disabled wheels just issue a raycast of almost zero length. + //This should be very cheap and ought to hit nothing. + bodySpaceWheelCentreOffset = PxVec3(0,0,0); + maxDroop = 1e-5f*gToleranceScaleLength; + maxBounce = 1e-5f*gToleranceScaleLength; + radius = 1e-5f*gToleranceScaleLength; + } + + PxTransform suspPoseStart; + PxVec3 suspLineDir; + computeSuspensionSweep( + carChassisTrnsfm, + wheelLocalPoseRotation, + bodySpaceWheelCentreOffset, bodySpaceSuspTravelDir, radius, maxBounce, + suspPoseStart, suspLineDir); + const PxF32 suspLineLength = radius + maxBounce + maxDroop + radius; + + //Store the susp line ray for later use. + PxVehicleWheels4DynData::SuspLineSweep& sweep = + reinterpret_cast(wheels4DynData.mQueryOrCachedHitResults); + sweep.mStartPose[j] = suspPoseStart; + sweep.mDirs[j] = suspLineDir; + sweep.mLengths[j] = suspLineLength; + sweep.mGometries[j] = suspGeometry; + + //Add the raycast to the scene query. + const PxSweepBuffer* buffer = batchQuery->sweep(sweep.mGometries[j].any(), + suspPoseStart, suspLineDir, suspLineLength, nbHitsPerQuery, + PxHitFlag::ePOSITION|PxHitFlag::eNORMAL|PxHitFlag::eUV, + carFilterData[j], NULL, sweepInflation); + + if(0 == j) + buffer4 = buffer; + + if(!buffer) + buffer4 = NULL; + } + + return buffer4; +} + +void PxVehicleUpdate::suspensionSweeps +(PxBatchQueryExt* batchQuery, + const PxU32 numVehicles, PxVehicleWheels** vehicles, + const PxU16 nbHitsPerQuery, + const bool* vehiclesToSweep, + const PxF32 sweepWidthScale, const PxF32 sweepRadiusScale, const PxF32 sweepInflation, const PxQueryFlags queryFlags, + const PxVec3& upAxis, const PxVec3& forwardAxis, const PxVec3& sideAxis) +{ + PX_CHECK_MSG(sweepWidthScale > 0.0f, "PxVehicleUpdate::suspensionSweeps - sweepWidthScale must be greater than 0.0"); + PX_CHECK_MSG(sweepRadiusScale > 0.0f, "PxVehicleUpdate::suspensionSweeps - sweepRadiusScale must be greater than 0.0"); + + START_TIMER(TIMER_SWEEPS); + + //Work out the rays for the suspension line raycasts and perform all the raycasts. + for(PxU32 i=0;i> 2); + const PxU32 numActiveWheels=veh.mWheelsSimData.mNbActiveWheels; + const PxU32 numActiveWheelsInLast4=numActiveWheels-4*numWheels4; + PxRigidDynamic* vehActor=veh.mActor; + + //Set the results pointer and start the raycasts. + PX_ASSERT(numActiveWheelsInLast4<4); + + //Get the shape ids for the wheels. + PxI32 wheelShapeIds[PX_MAX_NB_WHEELS]; + PxMemSet(wheelShapeIds, 0xff, sizeof(PxI32)*PX_MAX_NB_WHEELS); + for(PxU32 j = 0; j < veh.mWheelsSimData.getNbWheels(); j++) + { + PX_CHECK_AND_RETURN(veh.mWheelsSimData.getWheelShapeMapping(j) != -1, "PxVehicleUpdate::suspensionSweeps - trying to sweep a shape that doesn't exist."); + wheelShapeIds[j] = veh.mWheelsSimData.getWheelShapeMapping(j); + } + + //Blocks of 4 wheels. + for(PxU32 j=0;j0) + { + const PxU32 j=numWheels4; + + bool activeWheelStates[4]={false,false,false,false}; + computeWheelActiveStates(4*j, veh.mWheelsSimData.mActiveWheelsBitmapBuffer, activeWheelStates); + + const PxI32* wheelShapeIds4 = wheelShapeIds + 4*j; + + wheels4DynData[j].mRaycastResults=NULL; + wheels4DynData[j].mSweepResults=NULL; + + if(!vehiclesToSweep || vehiclesToSweep[i]) + { + PxQueryFilterData carFilterData[4]; + if(0execute(); + + END_TIMER(TIMER_SWEEPS); +} + +namespace physx +{ + void PxVehicleSuspensionSweeps + (PxBatchQueryExt* batchQuery, + const PxU32 nbVehicles, PxVehicleWheels** vehicles, + const PxU16 nbHitsPerQuery, + const bool* vehiclesToSweep, + const PxF32 sweepWidthScale, const PxF32 sweepRadiusScale, const PxF32 sweepInflation, + const PxQueryFlags queryFlags, const PxVehicleContext& context) + { + PX_PROFILE_ZONE("PxVehicleSuspensionSweeps::ePROFILE_SWEEPS",0); + PX_CHECK_AND_RETURN(context.isValid(), "PxVehicleSuspensionSweeps: provided PxVehicleContext is not valid"); + PxVehicleUpdate::suspensionSweeps(batchQuery, nbVehicles, vehicles, nbHitsPerQuery, vehiclesToSweep, + sweepWidthScale, sweepRadiusScale, sweepInflation, queryFlags, context.upAxis, context.forwardAxis, context.sideAxis); + } +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp new file mode 100644 index 0000000..a7538e7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/PxVehicleWheels.cpp @@ -0,0 +1,949 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleWheels.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxIntrinsics.h" +#include "PxRigidDynamic.h" +#include "PxShape.h" +#include "PxPhysics.h" + +#include "PxVehicleSuspWheelTire4.h" +#include "PxVehicleSuspLimitConstraintShader.h" +#include "foundation/PxUtilities.h" + +namespace physx +{ + +PxF32 gThresholdLongSpeed=5.0f; +PxU32 gLowLongSpeedSubstepCount=3; +PxU32 gHighLongSpeedSubstepCount=1; +PxF32 gMinLongSlipDenominator=4.0f; + +extern PxF32 gToleranceScaleLength; + + +PxU32 PxVehicleWheelsSimData::computeByteSize(const PxU32 numWheels) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + const PxU32 byteSize = sizeof(PxVehicleWheels4SimData)*numWheels4 + sizeof(PxVehicleAntiRollBarData)*2*numWheels4; + return byteSize; +} + +PxU8* PxVehicleWheelsSimData::patchUpPointers(const PxU32 numWheels, PxVehicleWheelsSimData* simData, PxU8* ptrIn) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + PxU8* ptr = ptrIn; + simData->mWheels4SimData = reinterpret_cast(ptr); + ptr += sizeof(PxVehicleWheels4SimData)*numWheels4; + simData->mAntiRollBars = reinterpret_cast(ptr); + ptr += sizeof(PxVehicleAntiRollBarData)*numWheels4*2; + PX_ASSERT((ptrIn + computeByteSize(numWheels)) == ptr); + return ptr; +} + +PxVehicleWheelsSimData::PxVehicleWheelsSimData(const PxU32 numWheels) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + + //Set numWheels + mNbWheels4 = numWheels4; + mNbActiveWheels = numWheels; + + //Set numAntiRollBars to zero. + mNbAntiRollBars4 = 2*numWheels4; + mNbActiveAntiRollBars = 0; + + //Placement new for wheels4 + for(PxU32 i=0;i> 5)); + for(PxU32 i=0;i(PX_ALLOC(byteSize, "PxVehicleWheelsSimData")); + + //Patchup pointers + PxU8* ptr = ptrStart; + PxVehicleWheelsSimData* simData = reinterpret_cast(ptr); + ptr += sizeof(PxVehicleWheelsSimData); + ptr = patchUpPointers(numWheels, simData, ptr); + PX_ASSERT((ptrStart+ byteSize) == ptr); + + //Constructor. + PX_PLACEMENT_NEW(simData, PxVehicleWheelsSimData(numWheels)); + + //Finished. + return simData; +} + +void PxVehicleWheelsSimData::setChassisMass(const PxF32 chassisMass) +{ + + //Target spring natural frequency = 9.66 + //Target spring damping ratio = 0.62 + const PxF32 mult=1.0f/(1.0f*mNbActiveWheels); + const PxF32 sprungMass=chassisMass*mult; + const PxF32 w0=9.66f; + const PxF32 r=0.62f; + for(PxU32 i=0;i> 5)); + + return *this; +} + +void PxVehicleWheelsSimData::copy(const PxVehicleWheelsSimData& src, const PxU32 srcWheel, const PxU32 wheel) +{ + PX_CHECK_AND_RETURN(srcWheel < src.mNbActiveWheels, "Illegal src wheel"); + PX_CHECK_AND_RETURN(wheel < mNbActiveWheels, "Illegal target wheel"); + + setSuspensionData(wheel,src.getSuspensionData(srcWheel)); + setWheelData(wheel,src.getWheelData(srcWheel)); + setTireData(wheel,src.getTireData(srcWheel)); + setSuspTravelDirection(wheel,src.getSuspTravelDirection(srcWheel)); + setSuspForceAppPointOffset(wheel,src.getSuspForceAppPointOffset(srcWheel)); + setTireForceAppPointOffset(wheel,src.getTireForceAppPointOffset(srcWheel)); + setWheelCentreOffset(wheel,src.getWheelCentreOffset(srcWheel)); + setWheelShapeMapping(wheel, src.getWheelShapeMapping(srcWheel)); + setSceneQueryFilterData(wheel, src.getSceneQueryFilterData(srcWheel)); + if(src.getIsWheelDisabled(srcWheel)) + disableWheel(wheel); + else + enableWheel(wheel); +} + +bool PxVehicleWheelsSimData::isValid() const +{ + for(PxU32 i=0;i> 5); + bm.reset(wheel); +} + +void PxVehicleWheelsSimData::enableWheel(const PxU32 wheel) +{ + PX_CHECK_AND_RETURN(wheel < 4*mNbWheels4, "PxVehicleWheelsSimData::disableWheel - Illegal wheel"); + + PxBitMap bm; + bm.setWords(mActiveWheelsBitmapBuffer, ((PX_MAX_NB_WHEELS + 31) & ~31) >> 5); + bm.set(wheel); +} + +bool PxVehicleWheelsSimData::getIsWheelDisabled(const PxU32 wheel) const +{ + PX_CHECK_AND_RETURN_VAL(wheel < 4*mNbWheels4, "PxVehicleWheelsSimData::getIsWheelDisabled - Illegal wheel", false); + PxBitMap bm; + bm.setWords(const_cast(mActiveWheelsBitmapBuffer), ((PX_MAX_NB_WHEELS + 31) & ~31) >> 5); + return (bm.test(wheel) ? false : true); +} + +const PxVehicleSuspensionData& PxVehicleWheelsSimData::getSuspensionData(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getSuspensionData - Illegal wheel"); + return mWheels4SimData[id>>2].getSuspensionData(id & 3); +} + +const PxVehicleWheelData& PxVehicleWheelsSimData::getWheelData(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getWheelData - Illegal wheel"); + return mWheels4SimData[id>>2].getWheelData(id & 3); +} + +const PxVehicleTireData& PxVehicleWheelsSimData::getTireData(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getTireData - Illegal wheel"); + return mWheels4SimData[id>>2].getTireData(id & 3); +} + +const PxVec3& PxVehicleWheelsSimData::getSuspTravelDirection(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getSuspTravelDirection - Illegal wheel"); + return mWheels4SimData[id>>2].getSuspTravelDirection(id & 3); +} + +const PxVec3& PxVehicleWheelsSimData::getSuspForceAppPointOffset(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getSuspForceAppPointOffset - Illegal wheel"); + return mWheels4SimData[id>>2].getSuspForceAppPointOffset(id & 3); +} + +const PxVec3& PxVehicleWheelsSimData::getTireForceAppPointOffset(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getTireForceAppPointOffset - Illegal wheel"); + return mWheels4SimData[id>>2].getTireForceAppPointOffset(id & 3); +} + +const PxVec3& PxVehicleWheelsSimData::getWheelCentreOffset(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getWheelCentreOffset - Illegal wheel"); + return mWheels4SimData[id>>2].getWheelCentreOffset(id & 3); +} + +PxI32 PxVehicleWheelsSimData::getWheelShapeMapping(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getWheelShapeMapping - Illegal wheel"); + return mWheels4SimData[id>>2].getWheelShapeMapping(id & 3); +} + +const PxFilterData& PxVehicleWheelsSimData::getSceneQueryFilterData(const PxU32 id) const +{ + PX_CHECK_MSG(id < 4*mNbWheels4, "PxVehicleWheelsSimData::getSceneQueryFilterData - Illegal wheel"); + return mWheels4SimData[id>>2].getSceneQueryFilterData(id & 3); +} + +const PxVehicleAntiRollBarData& PxVehicleWheelsSimData::getAntiRollBarData(const PxU32 antiRollId) const +{ + PX_CHECK_MSG(antiRollId < mNbActiveAntiRollBars, "PxVehicleWheelsSimData::getAntiRollBarData - Illegal anti-roll bar"); + return mAntiRollBars[antiRollId]; +} + +void PxVehicleWheelsSimData::setSuspensionData(const PxU32 id, const PxVehicleSuspensionData& susp) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setSuspensionData - Illegal wheel"); + mWheels4SimData[id>>2].setSuspensionData(id & 3, susp); +} + +void PxVehicleWheelsSimData::setWheelData(const PxU32 id, const PxVehicleWheelData& wheel) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setWheelData - Illegal wheel"); + mWheels4SimData[id>>2].setWheelData(id & 3, wheel); +} + +void PxVehicleWheelsSimData::setTireData(const PxU32 id, const PxVehicleTireData& tire) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setTireData - Illegal wheel"); + mWheels4SimData[id>>2].setTireData(id & 3, tire); +} + +void PxVehicleWheelsSimData::setSuspTravelDirection(const PxU32 id, const PxVec3& dir) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setSuspTravelDirection - Illegal wheel"); + mWheels4SimData[id>>2].setSuspTravelDirection(id & 3, dir); +} + +void PxVehicleWheelsSimData::setSuspForceAppPointOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setSuspForceAppPointOffset - Illegal wheel"); + mWheels4SimData[id>>2].setSuspForceAppPointOffset(id & 3, offset); +} + +void PxVehicleWheelsSimData::setTireForceAppPointOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setTireForceAppPointOffset - Illegal wheel"); + mWheels4SimData[id>>2].setTireForceAppPointOffset(id & 3, offset); +} + +void PxVehicleWheelsSimData::setWheelCentreOffset(const PxU32 id, const PxVec3& offset) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setWheelCentreOffset - Illegal wheel"); + mWheels4SimData[id>>2].setWheelCentreOffset(id & 3, offset); +} + +void PxVehicleWheelsSimData::setWheelShapeMapping(const PxU32 id, const PxI32 shapeId) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setWheelShapeMapping - Illegal wheel"); + mWheels4SimData[id>>2].setWheelShapeMapping(id & 3, shapeId); +} + +void PxVehicleWheelsSimData::setSceneQueryFilterData(const PxU32 id, const PxFilterData& sqFilterData) +{ + PX_CHECK_AND_RETURN(id < 4*mNbWheels4, "PxVehicleWheelsSimData::setSceneQueryFilterData - Illegal wheel"); + mWheels4SimData[id>>2].setSceneQueryFilterData(id & 3, sqFilterData); +} + +void PxVehicleWheelsSimData::setTireLoadFilterData(const PxVehicleTireLoadFilterData& tireLoadFilter) +{ + PX_CHECK_AND_RETURN(tireLoadFilter.mMaxNormalisedLoad>tireLoadFilter.mMinNormalisedLoad, "Illegal graph points"); + PX_CHECK_AND_RETURN(tireLoadFilter.mMaxFilteredNormalisedLoad>0, "Max filtered load must be greater than zero"); + mNormalisedLoadFilter=tireLoadFilter; + mNormalisedLoadFilter.mDenominator=1.0f/(mNormalisedLoadFilter.mMaxNormalisedLoad-mNormalisedLoadFilter.mMinNormalisedLoad); +} + +PxU32 PxVehicleWheelsSimData::addAntiRollBarData(const PxVehicleAntiRollBarData& antiRollBar) +{ + PX_CHECK_AND_RETURN_VAL(antiRollBar.isValid(), "Illegal antiRollBar", 0xffffffff) + PX_CHECK_AND_RETURN_VAL(antiRollBar.mWheel0 < mNbActiveWheels, "Illegal wheel0", 0xffffffff); + PX_CHECK_AND_RETURN_VAL(antiRollBar.mWheel1 < mNbActiveWheels, "Illegal wheel1", 0xffffffff); + + //If the anti-roll pair already exists then modify it. + for(PxU32 i = 0; i < mNbActiveAntiRollBars; i++) + { + if( ((mAntiRollBars[i].mWheel0 == antiRollBar.mWheel0) && (mAntiRollBars[i].mWheel1 == antiRollBar.mWheel1)) || + ((mAntiRollBars[i].mWheel1 == antiRollBar.mWheel0) && (mAntiRollBars[i].mWheel0 == antiRollBar.mWheel1)) ) + { + mAntiRollBars[i].mStiffness = antiRollBar.mStiffness; + return i; + } + } + + //Check we have space for an extra anti-roll bar. + PX_CHECK_AND_RETURN_VAL(mNbActiveAntiRollBars < 2*mNbWheels4, "The buffer of anti-roll bars is full", 0xffffffff); + + //Add a new anti-roll bar. + const PxU32 id = mNbActiveAntiRollBars; + mAntiRollBars[mNbActiveAntiRollBars] = antiRollBar; + mNbActiveAntiRollBars++; + + //Finished. + return id; +} + +//Only used for serialization. +void PxVehicleWheelsSimData::setAntiRollBarData(const PxU32 id, const PxVehicleAntiRollBarData& antiRoll) +{ + PX_UNUSED(id); + addAntiRollBarData(antiRoll); +} + +void PxVehicleWheelsSimData::setSubStepCount(const PxReal thresholdLongitudinalSpeed, const PxU32 lowForwardSpeedSubStepCount, const PxU32 highForwardSpeedSubStepCount) +{ + PX_CHECK_AND_RETURN(thresholdLongitudinalSpeed>=0, "thresholdLongitudinalSpeed must be greater than or equal to zero."); + PX_CHECK_AND_RETURN(lowForwardSpeedSubStepCount>0, "lowForwardSpeedSubStepCount must be greater than zero."); + PX_CHECK_AND_RETURN(highForwardSpeedSubStepCount>0, "highForwardSpeedSubStepCount must be greater than zero."); + + mThresholdLongitudinalSpeed=thresholdLongitudinalSpeed; + mLowForwardSpeedSubStepCount=lowForwardSpeedSubStepCount; + mHighForwardSpeedSubStepCount=highForwardSpeedSubStepCount; +} + +void PxVehicleWheelsSimData::setMinLongSlipDenominator(const PxReal minLongSlipDenominator) +{ + PX_CHECK_AND_RETURN(minLongSlipDenominator>0, "minLongSlipDenominator must be greater than or equal to zero."); + mMinLongSlipDenominator=minLongSlipDenominator; +} + +void PxVehicleWheelsSimData::setFlags(PxVehicleWheelsSimFlags flags) +{ + mFlags = flags; +} + +PxVehicleWheelsSimFlags PxVehicleWheelsSimData::getFlags() const +{ + return PxVehicleWheelsSimFlags(mFlags); +} + + + +///////////////////////////// + +PxU32 PxVehicleWheelsDynData::computeByteSize(const PxU32 numWheels) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + const PxU32 byteSize = + sizeof(PxVehicleWheels4DynData)*numWheels4 + + sizeof(PxVehicleTireForceCalculator) + sizeof(void*)*4*numWheels4 + + sizeof(void*)*4*numWheels4 + + sizeof(PxVehicleConstraintShader)*numWheels4; + return byteSize; +} + +PxU8* PxVehicleWheelsDynData::patchUpPointers(const PxU32 numWheels, PxVehicleWheelsDynData* dynData, PxU8* ptrIn) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + PxU8* ptr = ptrIn; + dynData->mWheels4DynData = reinterpret_cast(ptr); + ptr += sizeof(PxVehicleWheels4DynData)*numWheels4; + dynData->mTireForceCalculators = reinterpret_cast(ptr); + ptr += sizeof(PxVehicleTireForceCalculator); + dynData->mTireForceCalculators->mShaderData = reinterpret_cast(ptr); + ptr += sizeof(void*)*4*numWheels4; + dynData->mUserDatas = reinterpret_cast(ptr); + ptr += sizeof(void*)*4*numWheels4; + for(PxU32 i=0;imWheels4DynData[i].setVehicleConstraintShader(shader); + ptr += sizeof(PxVehicleConstraintShader); + } + + PX_ASSERT((ptrIn + computeByteSize(numWheels)) == ptr); + return ptr; +} + +PxVehicleWheelsDynData::PxVehicleWheelsDynData(const PxU32 numWheels) +{ + const PxU32 numWheels4 =(((numWheels + 3) & ~3) >> 2); + + mNbWheels4=numWheels4; + mNbActiveWheels=numWheels; + + //Placement new for wheels4 + for(PxU32 i=0;imShaderData[i]=NULL; + } + PX_PLACEMENT_NEW(mTireForceCalculators, PxVehicleTireForceCalculator); + + //Initialise user data + for(PxU32 i=0;i<4*numWheels4;i++) + { + mUserDatas[i]=NULL; + } +} + +bool PxVehicleWheelsDynData::isValid() const +{ + for(PxU32 i=0;imShader=tireForceShaderFn; +} + +void PxVehicleWheelsDynData::setTireForceShaderData(const PxU32 tireId, const void* tireForceShaderData) +{ + PX_CHECK_AND_RETURN(tireId < mNbActiveWheels, "PxVehicleWheelsDynData::setTireForceShaderData - Illegal tire"); + mTireForceCalculators->mShaderData[tireId]=tireForceShaderData; +} + +const void* PxVehicleWheelsDynData::getTireForceShaderData(const PxU32 tireId) const +{ + PX_CHECK_AND_RETURN_VAL(tireId < mNbActiveWheels, "PxVehicleWheelsDynData::getTireForceShaderData - Illegal tire", NULL); + return mTireForceCalculators->mShaderData[tireId]; +} + +void PxVehicleWheelsDynData::setWheelRotationSpeed(const PxU32 wheelIdx, const PxReal speed) +{ + PX_CHECK_AND_RETURN(wheelIdx < mNbActiveWheels, "PxVehicleWheelsDynData::setWheelRotationSpeed - Illegal wheel"); + PxVehicleWheels4DynData& suspWheelTire4=mWheels4DynData[(wheelIdx>>2)]; + suspWheelTire4.mWheelSpeeds[wheelIdx & 3] = speed; + suspWheelTire4.mCorrectedWheelSpeeds[wheelIdx & 3] = speed; +} + +PxReal PxVehicleWheelsDynData::getWheelRotationSpeed(const PxU32 wheelIdx) const +{ + PX_CHECK_AND_RETURN_VAL(wheelIdx < mNbActiveWheels, "PxVehicleWheelsDynData::getWheelRotationSpeed - Illegal wheel", 0.0f); + const PxVehicleWheels4DynData& suspWheelTire4=mWheels4DynData[(wheelIdx>>2)]; + return suspWheelTire4.mCorrectedWheelSpeeds[wheelIdx & 3]; +} + +void PxVehicleWheelsDynData::setWheelRotationAngle(const PxU32 wheelIdx, const PxReal angle) +{ + PX_CHECK_AND_RETURN(wheelIdx < mNbActiveWheels, "PxVehicleWheelsDynData::setWheelRotationAngle - Illegal wheel"); + PxVehicleWheels4DynData& suspWheelTire4=mWheels4DynData[(wheelIdx>>2)]; + suspWheelTire4.mWheelRotationAngles[wheelIdx & 3] = angle; +} + +PxReal PxVehicleWheelsDynData::getWheelRotationAngle(const PxU32 wheelIdx) const +{ + PX_CHECK_AND_RETURN_VAL(wheelIdx < mNbActiveWheels, "PxVehicleWheelsDynData::getWheelRotationAngle - Illegal wheel", 0.0f); + const PxVehicleWheels4DynData& suspWheelTire4=mWheels4DynData[(wheelIdx>>2)]; + return suspWheelTire4.mWheelRotationAngles[wheelIdx & 3]; +} + +#if PX_CHECKED +bool legalNumHits(const PxU32* nbHits, const PxU32 nbWheels) +{ + for(PxU32 i = 0; i < nbWheels; i++) + { + if(nbHits[i] !=0 && nbHits[i] != 1) + return false; + } + return true; +} + +bool legalHitPlanes(const PxPlane* hitPlanes, const PxU32 nbWheels) +{ + for (PxU32 i = 0; i < nbWheels; i++) + { + if(PxAbs(1.0f - hitPlanes[i].n.magnitude()) >= 1e-3f) + return false; + } + return true; +} + +bool legalHitFrictions(const PxReal* hitFrictions, const PxU32 nbWheels) +{ + for (PxU32 i = 0; i < nbWheels; i++) + { + if(hitFrictions[i] < 0.0f) + return false; + } + return true; +} + +#endif + +void PxVehicleWheelsDynData::setTireContacts(const PxU32* nbHits, const PxPlane* hitPlanes, const PxReal* hitFrictions, const PxTireContactIntersectionMethod::Enum* queryTypes, const PxU32 nbWheels) +{ + PX_CHECK_AND_RETURN(nbWheels <= PX_MAX_NB_WHEELS, "PxVehicleWheelsDynData::setTireContacts - nbWheels must be <= PX_MAX_NB_WHEELS"); + PX_CHECK_AND_RETURN(nbWheels >= mNbActiveWheels, "PxVehicleWheelsDynData::setTireContacts - nbWheels must be >= nbWheels"); + PX_CHECK_AND_RETURN(legalNumHits(nbHits, nbWheels), "PxVehicleWheelsDynData::setTireContacts - nbHits[i] must be 0 or 1"); + PX_CHECK_AND_RETURN(legalHitPlanes(hitPlanes, nbWheels), "PxVehicleWheelsDynData::setTireContacts - hitPlanes[i] must have a unit normal"); + PX_CHECK_AND_RETURN(legalHitFrictions(hitFrictions, nbWheels), "PxVehicleWheelsDynData::setTireContacts - hitFrictions[i] must be >= 0.0f"); + + PxU32 hits[PX_MAX_NB_WHEELS]; + PxPlane planes[PX_MAX_NB_WHEELS]; + PxReal frictions[PX_MAX_NB_WHEELS]; + PxTireContactIntersectionMethod types[PX_MAX_NB_WHEELS]; + PxMemCopy(hits, nbHits, sizeof(PxU32)*nbWheels); + PxMemCopy(planes, hitPlanes, sizeof(PxPlane)*nbWheels); + PxMemCopy(frictions, hitFrictions, sizeof(PxReal)*nbWheels); + PxMemCopy(types, queryTypes, sizeof(PxTireContactIntersectionMethod)*nbWheels); + for (PxU32 i = 0; i < mNbWheels4; i++) + { + mWheels4DynData[i].setTireContacts(hits + 4 * i, planes + 4 * i, frictions + 4 * i, queryTypes + 4 * i); + } +} + +void PxVehicleWheels::setToRestState() +{ + //Set the rigid body to rest and clear all the accumulated forces and impulses. + if(!(mActor->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC)) + { + mActor->setLinearVelocity(PxVec3(0,0,0)); + mActor->setAngularVelocity(PxVec3(0,0,0)); + + //Support case where actor is not in a scene and constraints get solved via immediate mode + if (mActor->getScene()) + { + mActor->clearForce(PxForceMode::eACCELERATION); + mActor->clearForce(PxForceMode::eVELOCITY_CHANGE); + mActor->clearTorque(PxForceMode::eACCELERATION); + mActor->clearTorque(PxForceMode::eVELOCITY_CHANGE); + } + } + + //Set the wheels to rest state. + mWheelsDynData.setToRestState(); +} + +bool PxVehicleWheels::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mWheelsSimData.isValid(), "invalid mWheelsSimData", false); + PX_CHECK_AND_RETURN_VAL(mWheelsDynData.isValid(), "invalid mWheelsDynData", false); + return true; +} + +PxU32 PxVehicleWheels::computeByteSize(const PxU32 numWheels) +{ + const PxU32 byteSize = + PxVehicleWheelsSimData::computeByteSize(numWheels) + + PxVehicleWheelsDynData::computeByteSize(numWheels); + return byteSize; +} + +PxU8* PxVehicleWheels::patchupPointers(const PxU32 numWheels, PxVehicleWheels* vehWheels, PxU8* ptrIn) +{ + PxU8* ptr = ptrIn; + ptr = PxVehicleWheelsSimData::patchUpPointers(numWheels, &vehWheels->mWheelsSimData, ptr); + ptr = PxVehicleWheelsDynData::patchUpPointers(numWheels, &vehWheels->mWheelsDynData, ptr); + PX_ASSERT((ptrIn + computeByteSize(numWheels)) == ptr); + return ptr; +} + +void PxVehicleWheels::init(const PxU32 numWheels) +{ + PX_PLACEMENT_NEW(&mWheelsSimData, PxVehicleWheelsSimData(numWheels)); + PX_PLACEMENT_NEW(&mWheelsDynData, PxVehicleWheelsDynData(numWheels)); + + for(PxU32 i = 0; i < mWheelsSimData.mNbWheels4; i++) + { + PX_PLACEMENT_NEW(&mWheelsDynData.mWheels4DynData[i].getVehicletConstraintShader(), PxVehicleConstraintShader(this)); + } + + mOnConstraintReleaseCounter = PxTo8(mWheelsSimData.mNbWheels4); +} + +void PxVehicleWheels::free() +{ + PX_CHECK_AND_RETURN(mWheelsSimData.mNbWheels4>0, "Cars with zero wheels are illegal"); + + const PxU32 numSuspWheelTire4 = mWheelsSimData.mNbWheels4; + + for(PxU32 i=0;igetMass()-totalSprungMass)/vehActor->getMass()) < 0.01f, "Sum of suspension sprung masses doesn't match actor mass"); + } +#endif + + //Copy the simulation data. + mWheelsSimData=wheelsData; + + //Set the actor pointer. + mActor=vehActor; + + //Set all the sq result ptrs to null. + const PxU32 numSuspWheelTire4=wheelsData.mNbWheels4; + for(PxU32 i=0;icreateConstraint(vehActor, NULL, shader, t, sizeof(PxVehicleConstraintShader::VehicleConstraintData)); + shader.mConstraint->markDirty(); + } + + //Set up the shader data ptrs. + for(PxU32 i=0;igetNbShapes(), "Illegal wheel shape mapping, shape does not exist on actor"); + + //Compute the shape local pose + const PxTransform chassisCMOffset=mActor->getCMassLocalPose(); + PxTransform wheelOffset=chassisCMOffset; + wheelOffset.p+=mWheelsSimData.getWheelCentreOffset(i); + //Pose the shape. + PxShape* shapeBuffer[1]; + mActor->getShapes(shapeBuffer,1,PxU32(shapeId)); + shapeBuffer[0]->setLocalPose(wheelOffset); + } + } +} + +void PxVehicleWheels::requiresObjects(PxProcessPxBaseCallback& c) +{ + c.process(*mActor); + + for(PxU32 i=0;i(old); + new_nx->setConstraintFunctions(*connector, shaders); + return new_nx; +} + +void PxVehicleWheels::resolveReferences(PxDeserializationContext& context) +{ + context.translatePxBase(mActor); + + for(PxU32 i=0;igetGlobalPose().transform(mActor->getCMassLocalPose()); + return mActor->getLinearVelocity().dot(vehicleChassisTrnsfm.q.rotate(forwardAxis)); +} + +PxReal PxVehicleWheels::computeSidewaysSpeed(const PxVec3& sideAxis) const +{ + const PxTransform vehicleChassisTrnsfm=mActor->getGlobalPose().transform(mActor->getCMassLocalPose()); + return mActor->getLinearVelocity().dot(vehicleChassisTrnsfm.q.rotate(sideAxis)); +} + +//////////////////////////////////////////////////////////////////////////// + +void PxVehicleWheelsDynData::setUserData(const PxU32 tireIdx, void* userData) +{ + PX_CHECK_AND_RETURN(tireIdx < mNbActiveWheels, "PxVehicleWheelsDynData::setUserData - Illegal wheel"); + mUserDatas[tireIdx]=userData; +} + +void* PxVehicleWheelsDynData::getUserData(const PxU32 tireIdx) const +{ + PX_CHECK_AND_RETURN_VAL(tireIdx < mNbActiveWheels, "PxVehicleWheelsDynData::setUserData - Illegal wheel", NULL); + return mUserDatas[tireIdx]; +} + + +//////////////////////////////////////////////////////////////////////////// + +void PxVehicleWheelsDynData::copy(const PxVehicleWheelsDynData& src, const PxU32 srcWheel, const PxU32 trgWheel) +{ + PX_CHECK_AND_RETURN(srcWheel < src.mNbActiveWheels, "PxVehicleWheelsDynData::copy - Illegal src wheel"); + PX_CHECK_AND_RETURN(trgWheel < mNbActiveWheels, "PxVehicleWheelsDynData::copy - Illegal trg wheel"); + + const PxVehicleWheels4DynData& src4 = src.mWheels4DynData[(srcWheel>>2)]; + PxVehicleWheels4DynData& trg4 = mWheels4DynData[(trgWheel>>2)]; + + trg4.mWheelSpeeds[trgWheel & 3] = src4.mWheelSpeeds[srcWheel & 3]; + trg4.mCorrectedWheelSpeeds[trgWheel & 3] = src4.mCorrectedWheelSpeeds[srcWheel & 3]; + trg4.mTireLowForwardSpeedTimers[trgWheel & 3] = src4.mTireLowForwardSpeedTimers[srcWheel & 3]; + trg4.mTireLowSideSpeedTimers[trgWheel & 3] = src4.mTireLowSideSpeedTimers[srcWheel & 3]; + trg4.mWheelRotationAngles[trgWheel & 3] = src4.mWheelRotationAngles[srcWheel & 3]; + + if(src4.mRaycastResults) + { + const PxVehicleWheels4DynData::SuspLineRaycast& suspLineRaycastSrc = reinterpret_cast(src4.mQueryOrCachedHitResults); + PxVehicleWheels4DynData::SuspLineRaycast& suspLineRaycastTrg = reinterpret_cast(trg4.mQueryOrCachedHitResults); + + suspLineRaycastTrg.mStarts[trgWheel & 3] = suspLineRaycastSrc.mStarts[srcWheel & 3]; + suspLineRaycastTrg.mDirs[trgWheel & 3] = suspLineRaycastSrc.mDirs[srcWheel & 3]; + suspLineRaycastTrg.mLengths[trgWheel & 3] = suspLineRaycastSrc.mLengths[srcWheel & 3]; + } + else if(src4.mSweepResults) + { + const PxVehicleWheels4DynData::SuspLineSweep& suspLineSweepSrc = reinterpret_cast(src4.mQueryOrCachedHitResults); + PxVehicleWheels4DynData::SuspLineSweep& suspLineSweepTrg = reinterpret_cast(trg4.mQueryOrCachedHitResults); + + suspLineSweepTrg.mStartPose[trgWheel & 3] = suspLineSweepSrc.mStartPose[srcWheel & 3]; + suspLineSweepTrg.mDirs[trgWheel & 3] = suspLineSweepSrc.mDirs[srcWheel & 3]; + suspLineSweepTrg.mLengths[trgWheel & 3] = suspLineSweepSrc.mLengths[srcWheel & 3]; + } + else + { + const PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult& cachedHitResultSrc = reinterpret_cast(src4.mQueryOrCachedHitResults); + PxVehicleWheels4DynData::CachedSuspLineSceneQuerytHitResult& cachedHitResultTrg = reinterpret_cast(trg4.mQueryOrCachedHitResults); + + cachedHitResultTrg.mPlanes[trgWheel & 3] = cachedHitResultSrc.mPlanes[srcWheel & 3]; + cachedHitResultTrg.mFrictionMultipliers[trgWheel & 3] = cachedHitResultSrc.mFrictionMultipliers[srcWheel & 3]; + cachedHitResultTrg.mCounts[trgWheel & 3] = cachedHitResultSrc.mCounts[srcWheel & 3]; + cachedHitResultTrg.mDistances[trgWheel & 3] = cachedHitResultSrc.mDistances[srcWheel & 3]; + } +} + +PxU32 PxVehicleWheelsDynData::getConstraints(PxConstraint** userBuffer, PxU32 bufferSize, PxU32 startIndex) const +{ + const PxU32 remainder = PxU32(PxMax(PxI32(mNbWheels4 - startIndex), 0)); + const PxU32 writeCount = PxMin(remainder, bufferSize); + PxVehicleWheels4DynData* wheels4DynData = mWheels4DynData + startIndex; + for (PxU32 i = 0; i < writeCount; i++) + { + userBuffer[i] = wheels4DynData->getVehicletConstraintShader().getPxConstraint(); + wheels4DynData++; + } + return writeCount; +} + + +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp new file mode 100644 index 0000000..6c17529 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilControl.cpp @@ -0,0 +1,470 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleUtilControl.h" +#include "vehicle/PxVehicleDrive4W.h" + +#include "foundation/PxUtilities.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxErrors.h" + +namespace physx +{ + +#if PX_CHECKED +void testValidAnalogValue(const PxF32 actualValue, const PxF32 minVal, const PxF32 maxVal, const char* errorString) +{ + const PxF32 tolerance = 1e-2f; + PX_CHECK_MSG((actualValue > (minVal - tolerance)) && (actualValue < (maxVal + tolerance)), errorString); +} +#endif + + +PxF32 processDigitalValue +(const PxU32 inputType, + const PxVehicleKeySmoothingData& keySmoothing, const bool digitalValue, + const PxF32 timestep, + const PxF32 analogVal) +{ + PxF32 newAnalogVal=analogVal; + if(digitalValue) + { + newAnalogVal+=keySmoothing.mRiseRates[inputType]*timestep; + } + else + { + newAnalogVal-=keySmoothing.mFallRates[inputType]*timestep; + } + + return PxClamp(newAnalogVal,0.0f,1.0f); +} + +static void PxVehicleDriveSmoothDigitalRawInputsAndSetAnalogInputs +(const PxVehicleKeySmoothingData& keySmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxF32 timestep, const bool isVehicleInAir, + const PxVehicleWheels& vehicle, PxVehicleDriveDynData& driveDynData, const PxVehicleSteerFilter& steerFilter, + const PxVec3& forwardAxis) +{ + const bool gearup=rawInputData.getGearUp(); + const bool geardown=rawInputData.getGearDown(); + driveDynData.setGearDown(geardown); + driveDynData.setGearUp(gearup); + + const PxF32 accel=processDigitalValue(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL,keySmoothing,rawInputData.getDigitalAccel(),timestep,driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL)); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL,accel); + + const PxF32 brake=processDigitalValue(PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE,keySmoothing,rawInputData.getDigitalBrake(),timestep,driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE)); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE,brake); + + const PxF32 handbrake=processDigitalValue(PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE,keySmoothing,rawInputData.getDigitalHandbrake(),timestep,driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE)); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE,handbrake); + + PxF32 steerLeft=processDigitalValue(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT,keySmoothing,rawInputData.getDigitalSteerLeft(),timestep,driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT)); + PxF32 steerRight=processDigitalValue(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT,keySmoothing,rawInputData.getDigitalSteerRight(),timestep,driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT)); + const PxF32 vz=vehicle.computeForwardSpeed(forwardAxis); + const PxF32 vzAbs=PxAbs(vz); + const PxF32 maxSteer = steerFilter.computeMaxSteer(isVehicleInAir, steerVsForwardSpeedTable, vzAbs, timestep); + + const PxF32 steer=PxAbs(steerRight-steerLeft); + if(steer>maxSteer) + { + const PxF32 k=maxSteer/steer; + steerLeft*=k; + steerRight*=k; + } + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT, steerLeft); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT, steerRight); +} + +////////////////////////////////// + +//process value in range(0,1) +PX_FORCE_INLINE PxF32 processPositiveAnalogValue +(const PxF32 riseRate, const PxF32 fallRate, + const PxF32 currentVal, const PxF32 targetVal, + const PxF32 timestep) +{ + PX_ASSERT(targetVal>=-0.01f && targetVal<=1.01f); + PxF32 val; + if(currentVal0) + { + val=currentVal-fallRate*timestep; + val=PxMax(val,0.0f); + } + else if(currentVal<0) + { + val=currentVal+fallRate*timestep; + val=PxMin(val,0.0f); + } + } + else + { + if(currentVal < targetVal) + { + if(currentVal<0) + { + val=currentVal + fallRate*timestep; + val=PxMin(val,targetVal); + } + else + { + val=currentVal + riseRate*timestep; + val=PxMin(val,targetVal); + } + } + else + { + if(currentVal>0) + { + val=currentVal - fallRate*timestep; + val=PxMax(val,targetVal); + } + else + { + val=currentVal - riseRate*timestep; + val=PxMax(val,targetVal); + } + } + } + return val; +} + +static void PxVehicleDriveSmoothAnalogRawInputsAndSetAnalogInputs +(const PxVehiclePadSmoothingData& padSmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxF32 timestep, const bool isVehicleInAir, + const PxVehicleWheels& vehicle, PxVehicleDriveDynData& driveDynData, const PxVehicleSteerFilter& steerFilter, + const PxVec3& forwardAxis) +{ + //gearup/geardown + const bool gearup=rawInputData.getGearUp(); + const bool geardown=rawInputData.getGearDown(); + driveDynData.setGearUp(gearup); + driveDynData.setGearDown(geardown); + + //Update analog inputs for focus vehicle. + + //Process the accel. + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL]; + const PxF32 currentVal=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL); + const PxF32 targetVal=rawInputData.getAnalogAccel(); + const PxF32 accel=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_ACCEL, accel); + } + + //Process the brake + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE]; + const PxF32 currentVal=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE); + const PxF32 targetVal=rawInputData.getAnalogBrake(); + const PxF32 brake=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_BRAKE, brake); + } + + //Process the handbrake. + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE]; + const PxF32 currentVal=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE); + const PxF32 targetVal=rawInputData.getAnalogHandbrake(); + const PxF32 handbrake=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_HANDBRAKE, handbrake); + } + + //Process the steer + { + const PxF32 vz=vehicle.computeForwardSpeed(forwardAxis); + const PxF32 vzAbs=PxAbs(vz); + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT]; + const PxF32 currentVal=driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT)-driveDynData.getAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT); + const PxF32 maxSteer = steerFilter.computeMaxSteer(isVehicleInAir, steerVsForwardSpeedTable, vzAbs, timestep); + const PxF32 targetVal=rawInputData.getAnalogSteer()*maxSteer; + const PxF32 steer=processAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_LEFT, 0.0f); + driveDynData.setAnalogInput(PxVehicleDrive4WControl::eANALOG_INPUT_STEER_RIGHT, steer); + } +} + + +//////////////// + +void PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs +(const PxVehicleKeySmoothingData& keySmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxF32 timestep, const bool isVehicleInAir, + PxVehicleDrive4W& focusVehicle, const PxVehicleSteerFilter& steerFilter, const PxVec3& forwardAxis) +{ + PxVehicleDriveSmoothDigitalRawInputsAndSetAnalogInputs + (keySmoothing, steerVsForwardSpeedTable, rawInputData, timestep, isVehicleInAir, focusVehicle, focusVehicle.mDriveDynData, steerFilter, + forwardAxis); +} + +void PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs +(const PxVehiclePadSmoothingData& padSmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDrive4WRawInputData& rawInputData, const PxF32 timestep, const bool isVehicleInAir, + PxVehicleDrive4W& focusVehicle, const PxVehicleSteerFilter& steerFilter, const PxVec3& forwardAxis) +{ + PxVehicleDriveSmoothAnalogRawInputsAndSetAnalogInputs + (padSmoothing,steerVsForwardSpeedTable,rawInputData,timestep,isVehicleInAir,focusVehicle,focusVehicle.mDriveDynData, steerFilter, + forwardAxis); +} + +//////////////// + +void PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs +(const PxVehicleKeySmoothingData& keySmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDriveNWRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDriveNW& focusVehicle, const PxVehicleSteerFilter& steerFilter, const PxVec3& forwardAxis) +{ + PxVehicleDriveSmoothDigitalRawInputsAndSetAnalogInputs + (keySmoothing,steerVsForwardSpeedTable,rawInputData,timestep,isVehicleInAir,focusVehicle,focusVehicle.mDriveDynData, steerFilter, + forwardAxis); +} + +void PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs +(const PxVehiclePadSmoothingData& padSmoothing, const PxFixedSizeLookupTable<8>& steerVsForwardSpeedTable, + const PxVehicleDriveNWRawInputData& rawInputData, const PxReal timestep, const bool isVehicleInAir, + PxVehicleDriveNW& focusVehicle, const PxVehicleSteerFilter& steerFilter, const PxVec3& forwardAxis) +{ + PxVehicleDriveSmoothAnalogRawInputsAndSetAnalogInputs + (padSmoothing,steerVsForwardSpeedTable,rawInputData,timestep,isVehicleInAir,focusVehicle,focusVehicle.mDriveDynData, steerFilter, + forwardAxis); +} + +//////////////// + +void PxVehicleDriveTankSmoothAnalogRawInputsAndSetAnalogInputs +(const PxVehiclePadSmoothingData& padSmoothing, + const PxVehicleDriveTankRawInputData& rawInputData, + const PxReal timestep, + PxVehicleDriveTank& focusVehicle) +{ + //Process the gearup/geardown buttons. + const bool gearup=rawInputData.getGearUp(); + const bool geardown=rawInputData.getGearDown(); + focusVehicle.mDriveDynData.setGearUp(gearup); + focusVehicle.mDriveDynData.setGearDown(geardown); + + //Process the accel. + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL); + const PxF32 targetVal=rawInputData.getAnalogAccel(); + const PxF32 accel=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL, accel); + } + + PX_ASSERT(focusVehicle.getDriveModel()==rawInputData.getDriveModel()); + switch(rawInputData.getDriveModel()) + { + case PxVehicleDriveTankControlModel::eSPECIAL: + { + //Process the left brake. + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT); + const PxF32 targetVal=rawInputData.getAnalogLeftBrake(); + const PxF32 accel=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, accel); + } + + //Process the right brake. + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT); + const PxF32 targetVal=rawInputData.getAnalogRightBrake(); + const PxF32 accel=processPositiveAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, accel); + } + + //Left thrust + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT); + const PxF32 targetVal=rawInputData.getAnalogLeftThrust(); + const PxF32 val=processAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, val); + } + + //Right thrust + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT); + const PxF32 targetVal=rawInputData.getAnalogRightThrust(); + const PxF32 val=processAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, val); + } + } + break; + + case PxVehicleDriveTankControlModel::eSTANDARD: + { + //Right thrust + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT); + const PxF32 targetVal=rawInputData.getAnalogRightThrust()-rawInputData.getAnalogRightBrake(); + const PxF32 val=processAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + if(val>0) + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, val); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, 0.0f); + } + else + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, 0.0f); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, -val); + } + } + + //Left thrust + { + const PxF32 riseRate=padSmoothing.mRiseRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]; + const PxF32 fallRate=padSmoothing.mFallRates[PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT]; + const PxF32 currentVal=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT); + const PxF32 targetVal=rawInputData.getAnalogLeftThrust()-rawInputData.getAnalogLeftBrake(); + const PxF32 val=processAnalogValue(riseRate,fallRate,currentVal,targetVal,timestep); + if(val>0) + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, val); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, 0.0f); + } + else + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, 0.0f); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, -val); + } + } + } + break; + } +} + +void PxVehicleDriveTankSmoothDigitalRawInputsAndSetAnalogInputs +(const PxVehicleKeySmoothingData& keySmoothing, + const PxVehicleDriveTankRawInputData& rawInputData, + const PxF32 timestep, + PxVehicleDriveTank& focusVehicle) +{ + PxF32 val; + val=processDigitalValue(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL,keySmoothing,rawInputData.getDigitalAccel(),timestep,focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL)); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_ACCEL, val); + val=processDigitalValue(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT,keySmoothing,rawInputData.getDigitalLeftThrust(),timestep,focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT)); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, val); + val=processDigitalValue(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT,keySmoothing,rawInputData.getDigitalRightThrust(),timestep,focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT)); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, val); + val=processDigitalValue(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT,keySmoothing,rawInputData.getDigitalLeftBrake(),timestep,focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT)); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, val); + val=processDigitalValue(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT,keySmoothing,rawInputData.getDigitalRightBrake(),timestep,focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT)); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, val); + + //Update digital inputs for focus vehicle. + focusVehicle.mDriveDynData.setGearUp(rawInputData.getGearUp()); + focusVehicle.mDriveDynData.setGearDown(rawInputData.getGearDown()); + + switch(rawInputData.getDriveModel()) + { + case PxVehicleDriveTankControlModel::eSPECIAL: + { + const PxF32 thrustL=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, thrustL); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, 0.0f); + + const PxF32 thrustR=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, thrustR); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, 0.0f); + } + break; + case PxVehicleDriveTankControlModel::eSTANDARD: + { + const PxF32 thrustL=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT); + if(thrustL>0) + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, thrustL); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, 0.0f); + } + else + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_LEFT, 0.0f); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_LEFT, -thrustL); + } + + const PxF32 thrustR=focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT)-focusVehicle.mDriveDynData.getAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT); + if(thrustR>0) + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, thrustR); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, 0.0f); + } + else + { + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_THRUST_RIGHT, 0.0f); + focusVehicle.mDriveDynData.setAnalogInput(PxVehicleDriveTankControl::eANALOG_INPUT_BRAKE_RIGHT, -thrustR); + } + } + break; + } + +} + + + +} //physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp new file mode 100644 index 0000000..e157837 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilSetup.cpp @@ -0,0 +1,249 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMath.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxErrors.h" +#include "vehicle/PxVehicleUtilSetup.h" +#include "vehicle/PxVehicleDrive4W.h" +#include "vehicle/PxVehicleDriveNW.h" +#include "vehicle/PxVehicleDriveTank.h" +#include "vehicle/PxVehicleNoDrive.h" +#include "vehicle/PxVehicleWheels.h" +#include "vehicle/PxVehicleUtil.h" +#include "vehicle/PxVehicleUpdate.h" + +namespace physx +{ + +void enable3WMode(const PxU32 rightDirection, const PxU32 upDirection, const bool removeFrontWheel, PxVehicleWheelsSimData& wheelsSimData, PxVehicleWheelsDynData& wheelsDynData, PxVehicleDriveSimData4W& driveSimData); + +void computeDirection(const PxVec3& up, const PxVec3& right, PxU32& rightDirection, PxU32& upDirection); + +void PxVehicle4WEnable3WTadpoleMode(PxVehicleWheelsSimData& wheelsSimData, PxVehicleWheelsDynData& wheelsDynData, PxVehicleDriveSimData4W& driveSimData, + const PxVehicleContext& context) +{ + PX_CHECK_AND_RETURN + (!wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eFRONT_LEFT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eREAR_LEFT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eREAR_RIGHT), "PxVehicle4WEnable3WTadpoleMode requires no wheels to be disabled"); + PX_CHECK_AND_RETURN(context.isValid(), "PxVehicle4WEnable3WTadpoleMode: provided PxVehicleContext is not valid"); + + PxU32 rightDirection=0xffffffff; + PxU32 upDirection=0xffffffff; + computeDirection(context.upAxis, context.sideAxis, rightDirection, upDirection); + PX_CHECK_AND_RETURN(rightDirection<3 && upDirection<3, "PxVehicle4WEnable3WTadpoleMode requires the vectors set in PxVehicleSetBasisVectors to be axis-aligned"); + + enable3WMode(rightDirection, upDirection, false, wheelsSimData, wheelsDynData, driveSimData); +} + +void PxVehicle4WEnable3WDeltaMode(PxVehicleWheelsSimData& wheelsSimData, PxVehicleWheelsDynData& wheelsDynData, PxVehicleDriveSimData4W& driveSimData, + const PxVehicleContext& context) +{ + PX_CHECK_AND_RETURN + (!wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eFRONT_LEFT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eFRONT_RIGHT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eREAR_LEFT) && + !wheelsSimData.getIsWheelDisabled(PxVehicleDrive4WWheelOrder::eREAR_RIGHT), "PxVehicle4WEnable3WDeltaMode requires no wheels to be disabled"); + PX_CHECK_AND_RETURN(context.isValid(), "PxVehicle4WEnable3WDeltaMode: provided PxVehicleContext is not valid"); + + PxU32 rightDirection=0xffffffff; + PxU32 upDirection=0xffffffff; + computeDirection(context.upAxis, context.sideAxis, rightDirection, upDirection); + PX_CHECK_AND_RETURN(rightDirection<3 && upDirection<3, "PxVehicle4WEnable3WTadpoleMode requires the vectors set in PxVehicleSetBasisVectors to be axis-aligned"); + + enable3WMode(rightDirection, upDirection, true, wheelsSimData, wheelsDynData, driveSimData); +} + +void computeSprungMasses(const PxU32 numSprungMasses, const PxVec3* sprungMassCoordinates, const PxVec3& centreOfMass, const PxReal totalMass, const PxU32 gravityDirection, PxReal* sprungMasses); + +void PxVehicleComputeSprungMasses(const PxU32 numSprungMasses, const PxVec3* sprungMassCoordinates, const PxVec3& centreOfMass, const PxReal totalMass, const PxU32 gravityDirection, PxReal* sprungMasses) +{ + computeSprungMasses(numSprungMasses, sprungMassCoordinates, centreOfMass, totalMass, gravityDirection, sprungMasses); +} + +void PxVehicleCopyDynamicsData(const PxVehicleCopyDynamicsMap& wheelMap, const PxVehicleWheels& src, PxVehicleWheels* trg) +{ + PX_CHECK_AND_RETURN(trg, "PxVehicleCopyDynamicsData requires that trg is a valid vehicle pointer"); + + PX_CHECK_AND_RETURN(src.getVehicleType() == trg->getVehicleType(), "PxVehicleCopyDynamicsData requires that both src and trg are the same type of vehicle"); + +#if PX_CHECKED + { + const PxU32 numWheelsSrc = src.mWheelsSimData.getNbWheels(); + const PxU32 numWheelsTrg = trg->mWheelsSimData.getNbWheels(); + PxU8 copiedWheelsSrc[PX_MAX_NB_WHEELS]; + PxMemZero(copiedWheelsSrc, sizeof(PxU8) * PX_MAX_NB_WHEELS); + PxU8 setWheelsTrg[PX_MAX_NB_WHEELS]; + PxMemZero(setWheelsTrg, sizeof(PxU8) * PX_MAX_NB_WHEELS); + for(PxU32 i = 0; i < PxMin(numWheelsSrc, numWheelsTrg); i++) + { + const PxU32 srcWheelId = wheelMap.sourceWheelIds[i]; + PX_CHECK_AND_RETURN(srcWheelId < numWheelsSrc, "PxVehicleCopyDynamicsData - wheelMap contains illegal source wheel id"); + PX_CHECK_AND_RETURN(0 == copiedWheelsSrc[srcWheelId], "PxVehicleCopyDynamicsData - wheelMap contains illegal source wheel id"); + copiedWheelsSrc[srcWheelId] = 1; + + const PxU32 trgWheelId = wheelMap.targetWheelIds[i]; + PX_CHECK_AND_RETURN(trgWheelId < numWheelsTrg, "PxVehicleCopyDynamicsData - wheelMap contains illegal target wheel id"); + PX_CHECK_AND_RETURN(0 == setWheelsTrg[trgWheelId], "PxVehicleCopyDynamicsData - wheelMap contains illegal target wheel id"); + setWheelsTrg[trgWheelId]=1; + } + } +#endif + + + const PxU32 numWheelsSrc = src.mWheelsSimData.getNbWheels(); + const PxU32 numWheelsTrg = trg->mWheelsSimData.getNbWheels(); + + //Set all dynamics data on the target to zero. + //Be aware that setToRestState sets the rigid body to + //rest so set the momentum back after calling setToRestState. + PxRigidDynamic* actorTrg = trg->getRigidDynamicActor(); + PxVec3 linVel = actorTrg->getLinearVelocity(); + PxVec3 angVel = actorTrg->getAngularVelocity(); + switch(src.getVehicleType()) + { + case PxVehicleTypes::eDRIVE4W: + static_cast(trg)->setToRestState(); + break; + case PxVehicleTypes::eDRIVENW: + static_cast(trg)->setToRestState(); + break; + case PxVehicleTypes::eDRIVETANK: + static_cast(trg)->setToRestState(); + break; + case PxVehicleTypes::eNODRIVE: + static_cast(trg)->setToRestState(); + break; + default: + break; + } + actorTrg->setLinearVelocity(linVel); + actorTrg->setAngularVelocity(angVel); + + + //Keep a track of the wheels on trg that have their dynamics data set as a copy from src. + PxU8 setWheelsTrg[PX_MAX_NB_WHEELS]; + PxMemZero(setWheelsTrg, sizeof(PxU8) * PX_MAX_NB_WHEELS); + + //Keep a track of the average wheel rotation speed of all enabled wheels on src. + PxU32 numEnabledWheelsSrc = 0; + PxF32 accumulatedWheelRotationSpeedSrc = 0.0f; + + //Copy wheel dynamics data from src wheels to trg wheels. + //Track the target wheels that have been given dynamics data from src wheels. + //Compute the accumulated wheel rotation speed of all enabled src wheels. + const PxU32 numMappedWheels = PxMin(numWheelsSrc, numWheelsTrg); + for(PxU32 i = 0; i < numMappedWheels; i++) + { + const PxU32 srcWheelId = wheelMap.sourceWheelIds[i]; + const PxU32 trgWheelId = wheelMap.targetWheelIds[i]; + + trg->mWheelsDynData.copy(src.mWheelsDynData, srcWheelId, trgWheelId); + + setWheelsTrg[trgWheelId] = 1; + + if(!src.mWheelsSimData.getIsWheelDisabled(srcWheelId)) + { + numEnabledWheelsSrc++; + accumulatedWheelRotationSpeedSrc += src.mWheelsDynData.getWheelRotationSpeed(srcWheelId); + } + } + + //Compute the average wheel rotation speed of src. + PxF32 averageWheelRotationSpeedSrc = 0; + if(numEnabledWheelsSrc > 0) + { + averageWheelRotationSpeedSrc = (accumulatedWheelRotationSpeedSrc/ (1.0f * numEnabledWheelsSrc)); + } + + //For wheels on trg that have not had their dynamics data copied from src just set + //their wheel rotation speed to the average wheel rotation speed. + for(PxU32 i = 0; i < numWheelsTrg; i++) + { + if(0 == setWheelsTrg[i] && !trg->mWheelsSimData.getIsWheelDisabled(i)) + { + trg->mWheelsDynData.setWheelRotationSpeed(i, averageWheelRotationSpeedSrc); + } + } + + //Copy the engine rotation speed/gear states/autobox states/etc. + switch(src.getVehicleType()) + { + case PxVehicleTypes::eDRIVE4W: + case PxVehicleTypes::eDRIVENW: + case PxVehicleTypes::eDRIVETANK: + { + const PxVehicleDriveDynData& driveDynDataSrc = static_cast(src).mDriveDynData; + PxVehicleDriveDynData* driveDynDataTrg = &static_cast(trg)->mDriveDynData; + *driveDynDataTrg = driveDynDataSrc; + } + break; + default: + break; + } +} + +bool areEqual(const PxQuat& q0, const PxQuat& q1) +{ + return ((q0.x == q1.x) && (q0.y == q1.y) && (q0.z == q1.z) && (q0.w == q1.w)); +} + +void PxVehicleUpdateCMassLocalPose(const PxTransform& oldCMassLocalPose, const PxTransform& newCMassLocalPose, const PxU32 gravityDirection, PxVehicleWheels* vehicle) +{ + PX_CHECK_AND_RETURN(areEqual(PxQuat(PxIdentity), oldCMassLocalPose.q), "Only center of mass poses with identity rotation are supported"); + PX_CHECK_AND_RETURN(areEqual(PxQuat(PxIdentity), newCMassLocalPose.q), "Only center of mass poses with identity rotation are supported"); + PX_CHECK_AND_RETURN(0==gravityDirection || 1==gravityDirection || 2==gravityDirection, "gravityDirection must be 0 or 1 or 2."); + + //Update the offsets from the rigid body center of mass. + PxVec3 wheelCenterCMOffsets[PX_MAX_NB_WHEELS]; + const PxU32 nbWheels = vehicle->mWheelsSimData.getNbWheels(); + for(PxU32 i = 0; i < nbWheels; i++) + { + wheelCenterCMOffsets[i] = vehicle->mWheelsSimData.getWheelCentreOffset(i) + oldCMassLocalPose.p - newCMassLocalPose.p; + vehicle->mWheelsSimData.setWheelCentreOffset(i, vehicle->mWheelsSimData.getWheelCentreOffset(i) + oldCMassLocalPose.p - newCMassLocalPose.p); + vehicle->mWheelsSimData.setSuspForceAppPointOffset(i, vehicle->mWheelsSimData.getSuspForceAppPointOffset(i) + oldCMassLocalPose.p - newCMassLocalPose.p); + vehicle->mWheelsSimData.setTireForceAppPointOffset(i, vehicle->mWheelsSimData.getTireForceAppPointOffset(i) + oldCMassLocalPose.p - newCMassLocalPose.p); + } + + //Now update the sprung masses. + PxF32 sprungMasses[PX_MAX_NB_WHEELS]; + PxVehicleComputeSprungMasses(nbWheels, wheelCenterCMOffsets, PxVec3(0,0,0), vehicle->getRigidDynamicActor()->getMass(), gravityDirection, sprungMasses); + for(PxU32 i = 0; i < nbWheels; i++) + { + PxVehicleSuspensionData suspData = vehicle->mWheelsSimData.getSuspensionData(i); + const PxF32 massRatio = sprungMasses[i]/suspData.mSprungMass; + suspData.mSprungMass = sprungMasses[i]; + suspData.mSpringStrength *= massRatio; + suspData.mSpringDamperRate *= massRatio; + vehicle->mWheelsSimData.setSuspensionData(i, suspData); + } +} + +}//physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp new file mode 100644 index 0000000..c5ef1b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/VehicleUtilTelemetry.cpp @@ -0,0 +1,588 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle/PxVehicleUtilTelemetry.h" +#include "foundation/PxUtilities.h" +#include "foundation/PxErrors.h" +#include "foundation/PxFoundation.h" +#include "foundation/PxAllocator.h" +#include "stdio.h" + +namespace physx +{ + +#if PX_DEBUG_VEHICLE_ON + +PxVehicleGraphDesc::PxVehicleGraphDesc() +: mPosX(PX_MAX_F32), + mPosY(PX_MAX_F32), + mSizeX(PX_MAX_F32), + mSizeY(PX_MAX_F32), + mBackgroundColor(PxVec3(PX_MAX_F32,PX_MAX_F32,PX_MAX_F32)), + mAlpha(PX_MAX_F32) +{ +} + +bool PxVehicleGraphDesc::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mPosX != PX_MAX_F32, "PxVehicleGraphDesc.mPosX must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mPosY != PX_MAX_F32, "PxVehicleGraphDesc.mPosY must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mSizeX != PX_MAX_F32, "PxVehicleGraphDesc.mSizeX must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mSizeY != PX_MAX_F32, "PxVehicleGraphDesc.mSizeY must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mBackgroundColor.x != PX_MAX_F32 && mBackgroundColor.y != PX_MAX_F32 && mBackgroundColor.z != PX_MAX_F32, "PxVehicleGraphDesc.mBackgroundColor must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mAlpha != PX_MAX_F32, "PxVehicleGraphDesc.mAlpha must be initialised", false); + return true; +} + +PxVehicleGraphChannelDesc::PxVehicleGraphChannelDesc() +: mMinY(PX_MAX_F32), + mMaxY(PX_MAX_F32), + mMidY(PX_MAX_F32), + mColorLow(PxVec3(PX_MAX_F32,PX_MAX_F32,PX_MAX_F32)), + mColorHigh(PxVec3(PX_MAX_F32,PX_MAX_F32,PX_MAX_F32)), + mTitle(NULL) +{ +} + +bool PxVehicleGraphChannelDesc::isValid() const +{ + PX_CHECK_AND_RETURN_VAL(mMinY != PX_MAX_F32, "PxVehicleGraphChannelDesc.mMinY must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mMaxY != PX_MAX_F32, "PxVehicleGraphChannelDesc.mMaxY must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mMidY != PX_MAX_F32, "PxVehicleGraphChannelDesc.mMidY must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mColorLow.x != PX_MAX_F32 && mColorLow.y != PX_MAX_F32 && mColorLow.z != PX_MAX_F32, "PxVehicleGraphChannelDesc.mColorLow must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mColorHigh.x != PX_MAX_F32 && mColorHigh.y != PX_MAX_F32 && mColorHigh.z != PX_MAX_F32, "PxVehicleGraphChannelDesc.mColorHigh must be initialised", false); + PX_CHECK_AND_RETURN_VAL(mTitle, "PxVehicleGraphChannelDesc.mTitle must be initialised", false); + return true; +} + +PxVehicleGraph::PxVehicleGraph() +{ + mBackgroundMinX=0; + mBackgroundMaxX=0; + mBackgroundMinY=0; + mBackgroundMaxY=0; + mSampleTide=0; + mBackgroundColor=PxVec3(255.f,255.f,255.f); + mBackgroundAlpha=1.0f; + for(PxU32 i=0;i= size_t(PxVehicleDriveGraphChannel::eMAX_NB_DRIVE_CHANNELS) && size_t(PxVehicleGraph::eMAX_NB_CHANNELS) >= size_t(PxVehicleWheelGraphChannel::eMAX_NB_WHEEL_CHANNELS)); +} + +PxVehicleGraph::~PxVehicleGraph() +{ +} + +void PxVehicleGraph::setup(const PxVehicleGraphDesc& desc, const PxVehicleGraphType::Enum graphType) +{ + mBackgroundMinX = (desc.mPosX - 0.5f*desc.mSizeX); + mBackgroundMaxX = (desc.mPosX + 0.5f*desc.mSizeX); + mBackgroundMinY = (desc.mPosY - 0.5f*desc.mSizeY); + mBackgroundMaxY = (desc.mPosY + 0.5f*desc.mSizeY); + + mBackgroundColor=desc.mBackgroundColor; + mBackgroundAlpha=desc.mAlpha; + + mNbChannels = (PxVehicleGraphType::eWHEEL==graphType) ? PxU32(PxVehicleWheelGraphChannel::eMAX_NB_WHEEL_CHANNELS) : PxU32(PxVehicleDriveGraphChannel::eMAX_NB_DRIVE_CHANNELS); +} + +void PxVehicleGraph::setChannel(PxVehicleGraphChannelDesc& desc, const PxU32 channel) +{ + PX_ASSERT(channel(PX_ALLOC(size, "PxVehicleNWTelemetryData")); + + //Patch up the pointers. + PxU8* ptr = reinterpret_cast(vehTelData) + sizeof(PxVehicleTelemetryData); + vehTelData->mEngineGraph = reinterpret_cast(ptr); + PX_PLACEMENT_NEW(vehTelData->mEngineGraph, PxVehicleGraph()); + ptr += sizeof(PxVehicleGraph); + vehTelData->mWheelGraphs = reinterpret_cast(ptr); + for(PxU32 i=0;imWheelGraphs[i], PxVehicleGraph()); + } + ptr += sizeof(PxVehicleGraph)*numWheels; + vehTelData->mSuspforceAppPoints = reinterpret_cast(ptr); + ptr += sizeof(PxVec3)*numWheels; + vehTelData->mTireforceAppPoints = reinterpret_cast(ptr); + ptr += sizeof(PxVec3)*numWheels; + + //Set the number of wheels in each structure that needs it. + vehTelData->mNbActiveWheels=numWheels; + + //Finished. + return vehTelData; +} + +void PxVehicleTelemetryData::free() +{ + PX_FREE_THIS; +} + +void physx::PxVehicleTelemetryData::setup +(const PxF32 graphSizeX, const PxF32 graphSizeY, +const PxF32 engineGraphPosX, const PxF32 engineGraphPosY, +const PxF32* const wheelGraphPosX, const PxF32* const wheelGraphPosY, +const PxVec3& backgroundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow) +{ + mEngineGraph->setupEngineGraph + (graphSizeX, graphSizeY, engineGraphPosX, engineGraphPosY, + backgroundColor, lineColorHigh, lineColorLow); + + const PxU32 numActiveWheels=mNbActiveWheels; + for(PxU32 k=0;kclearRecordedChannelData(); + + const PxU32 numActiveWheels=mNbActiveWheels; + for(PxU32 k=0;k or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +PxVehicleChassisData_PropertiesStart, +PxVehicleChassisData_MMOI, +PxVehicleChassisData_MMass, +PxVehicleChassisData_MCMOffset, +PxVehicleChassisData_PropertiesStop, +PxVehicleEngineData_PropertiesStart, +PxVehicleEngineData_RecipMOI, +PxVehicleEngineData_RecipMaxOmega, +PxVehicleEngineData_MTorqueCurve, +PxVehicleEngineData_MMOI, +PxVehicleEngineData_MPeakTorque, +PxVehicleEngineData_MMaxOmega, +PxVehicleEngineData_MDampingRateFullThrottle, +PxVehicleEngineData_MDampingRateZeroThrottleClutchEngaged, +PxVehicleEngineData_MDampingRateZeroThrottleClutchDisengaged, +PxVehicleEngineData_PropertiesStop, +PxVehicleGearsData_PropertiesStart, +PxVehicleGearsData_GearRatio, +PxVehicleGearsData_MFinalRatio, +PxVehicleGearsData_MNbRatios, +PxVehicleGearsData_MSwitchTime, +PxVehicleGearsData_PropertiesStop, +PxVehicleAutoBoxData_PropertiesStart, +PxVehicleAutoBoxData_Latency, +PxVehicleAutoBoxData_UpRatios, +PxVehicleAutoBoxData_DownRatios, +PxVehicleAutoBoxData_PropertiesStop, +PxVehicleDifferential4WData_PropertiesStart, +PxVehicleDifferential4WData_MFrontRearSplit, +PxVehicleDifferential4WData_MFrontLeftRightSplit, +PxVehicleDifferential4WData_MRearLeftRightSplit, +PxVehicleDifferential4WData_MCentreBias, +PxVehicleDifferential4WData_MFrontBias, +PxVehicleDifferential4WData_MRearBias, +PxVehicleDifferential4WData_MType, +PxVehicleDifferential4WData_PropertiesStop, +PxVehicleDifferentialNWData_PropertiesStart, +PxVehicleDifferentialNWData_DrivenWheelStatus, +PxVehicleDifferentialNWData_PropertiesStop, +PxVehicleAckermannGeometryData_PropertiesStart, +PxVehicleAckermannGeometryData_MAccuracy, +PxVehicleAckermannGeometryData_MFrontWidth, +PxVehicleAckermannGeometryData_MRearWidth, +PxVehicleAckermannGeometryData_MAxleSeparation, +PxVehicleAckermannGeometryData_PropertiesStop, +PxVehicleClutchData_PropertiesStart, +PxVehicleClutchData_MStrength, +PxVehicleClutchData_MAccuracyMode, +PxVehicleClutchData_MEstimateIterations, +PxVehicleClutchData_PropertiesStop, +PxVehicleTireLoadFilterData_PropertiesStart, +PxVehicleTireLoadFilterData_Denominator, +PxVehicleTireLoadFilterData_MMinNormalisedLoad, +PxVehicleTireLoadFilterData_MMinFilteredNormalisedLoad, +PxVehicleTireLoadFilterData_MMaxNormalisedLoad, +PxVehicleTireLoadFilterData_MMaxFilteredNormalisedLoad, +PxVehicleTireLoadFilterData_PropertiesStop, +PxVehicleWheelData_PropertiesStart, +PxVehicleWheelData_RecipRadius, +PxVehicleWheelData_RecipMOI, +PxVehicleWheelData_MRadius, +PxVehicleWheelData_MWidth, +PxVehicleWheelData_MMass, +PxVehicleWheelData_MMOI, +PxVehicleWheelData_MDampingRate, +PxVehicleWheelData_MMaxBrakeTorque, +PxVehicleWheelData_MMaxHandBrakeTorque, +PxVehicleWheelData_MMaxSteer, +PxVehicleWheelData_MToeAngle, +PxVehicleWheelData_PropertiesStop, +PxVehicleSuspensionData_PropertiesStart, +PxVehicleSuspensionData_RecipMaxCompression, +PxVehicleSuspensionData_RecipMaxDroop, +PxVehicleSuspensionData_MassAndPreserveNaturalFrequency, +PxVehicleSuspensionData_MSpringStrength, +PxVehicleSuspensionData_MSpringDamperRate, +PxVehicleSuspensionData_MMaxCompression, +PxVehicleSuspensionData_MMaxDroop, +PxVehicleSuspensionData_MSprungMass, +PxVehicleSuspensionData_MCamberAtRest, +PxVehicleSuspensionData_MCamberAtMaxCompression, +PxVehicleSuspensionData_MCamberAtMaxDroop, +PxVehicleSuspensionData_PropertiesStop, +PxVehicleAntiRollBarData_PropertiesStart, +PxVehicleAntiRollBarData_MWheel0, +PxVehicleAntiRollBarData_MWheel1, +PxVehicleAntiRollBarData_MStiffness, +PxVehicleAntiRollBarData_PropertiesStop, +PxVehicleTireData_PropertiesStart, +PxVehicleTireData_RecipLongitudinalStiffnessPerUnitGravity, +PxVehicleTireData_FrictionVsSlipGraphRecipx1Minusx0, +PxVehicleTireData_FrictionVsSlipGraphRecipx2Minusx1, +PxVehicleTireData_MLatStiffX, +PxVehicleTireData_MLatStiffY, +PxVehicleTireData_MLongitudinalStiffnessPerUnitGravity, +PxVehicleTireData_MCamberStiffnessPerUnitGravity, +PxVehicleTireData_MType, +PxVehicleTireData_MFrictionVsSlipGraph, +PxVehicleTireData_PropertiesStop, +PxVehicleWheels4SimData_PropertiesStart, +PxVehicleWheels4SimData_TireRestLoadsArray, +PxVehicleWheels4SimData_RecipTireRestLoadsArray, +PxVehicleWheels4SimData_PropertiesStop, +PxVehicleWheelsSimData_PropertiesStart, +PxVehicleWheelsSimData_ChassisMass, +PxVehicleWheelsSimData_SuspensionData, +PxVehicleWheelsSimData_WheelData, +PxVehicleWheelsSimData_TireData, +PxVehicleWheelsSimData_SuspTravelDirection, +PxVehicleWheelsSimData_SuspForceAppPointOffset, +PxVehicleWheelsSimData_TireForceAppPointOffset, +PxVehicleWheelsSimData_WheelCentreOffset, +PxVehicleWheelsSimData_WheelShapeMapping, +PxVehicleWheelsSimData_SceneQueryFilterData, +PxVehicleWheelsSimData_AntiRollBarData, +PxVehicleWheelsSimData_TireLoadFilterData, +PxVehicleWheelsSimData_MinLongSlipDenominator, +PxVehicleWheelsSimData_Flags, +PxVehicleWheelsSimData_ThresholdLongSpeed, +PxVehicleWheelsSimData_LowForwardSpeedSubStepCount, +PxVehicleWheelsSimData_HighForwardSpeedSubStepCount, +PxVehicleWheelsSimData_WheelEnabledState, +PxVehicleWheelsSimData_PropertiesStop, +PxVehicleWheelsDynData_PropertiesStart, +PxVehicleWheelsDynData_TireForceShaderFunction, +PxVehicleWheelsDynData_WheelRotationSpeed, +PxVehicleWheelsDynData_WheelRotationAngle, +PxVehicleWheelsDynData_Wheel4DynData, +PxVehicleWheelsDynData_Constraints, +PxVehicleWheelsDynData_PropertiesStop, +PxVehicleWheels_PropertiesStart, +PxVehicleWheels_VehicleType, +PxVehicleWheels_RigidDynamicActor, +PxVehicleWheels_ConcreteTypeName, +PxVehicleWheels_MWheelsSimData, +PxVehicleWheels_MWheelsDynData, +PxVehicleWheels_PropertiesStop, +PxVehicleDriveDynData_PropertiesStart, +PxVehicleDriveDynData_AnalogInput, +PxVehicleDriveDynData_GearUp, +PxVehicleDriveDynData_GearDown, +PxVehicleDriveDynData_UseAutoGears, +PxVehicleDriveDynData_CurrentGear, +PxVehicleDriveDynData_TargetGear, +PxVehicleDriveDynData_EngineRotationSpeed, +PxVehicleDriveDynData_GearChange, +PxVehicleDriveDynData_GearSwitchTime, +PxVehicleDriveDynData_AutoBoxSwitchTime, +PxVehicleDriveDynData_MUseAutoGears, +PxVehicleDriveDynData_MGearUpPressed, +PxVehicleDriveDynData_MGearDownPressed, +PxVehicleDriveDynData_MCurrentGear, +PxVehicleDriveDynData_MTargetGear, +PxVehicleDriveDynData_MEnginespeed, +PxVehicleDriveDynData_MGearSwitchTime, +PxVehicleDriveDynData_MAutoBoxSwitchTime, +PxVehicleDriveDynData_PropertiesStop, +PxVehicleDriveSimData_PropertiesStart, +PxVehicleDriveSimData_EngineData, +PxVehicleDriveSimData_GearsData, +PxVehicleDriveSimData_ClutchData, +PxVehicleDriveSimData_AutoBoxData, +PxVehicleDriveSimData_PropertiesStop, +PxVehicleDriveSimData4W_PropertiesStart, +PxVehicleDriveSimData4W_DiffData, +PxVehicleDriveSimData4W_AckermannGeometryData, +PxVehicleDriveSimData4W_PropertiesStop, +PxVehicleDrive_PropertiesStart, +PxVehicleDrive_ConcreteTypeName, +PxVehicleDrive_MDriveDynData, +PxVehicleDrive_PropertiesStop, +PxVehicleDrive4W_PropertiesStart, +PxVehicleDrive4W_ConcreteTypeName, +PxVehicleDrive4W_MDriveSimData, +PxVehicleDrive4W_PropertiesStop, +PxVehicleDriveTank_PropertiesStart, +PxVehicleDriveTank_DriveModel, +PxVehicleDriveTank_ConcreteTypeName, +PxVehicleDriveTank_MDriveSimData, +PxVehicleDriveTank_PropertiesStop, +PxVehicleDriveSimDataNW_PropertiesStart, +PxVehicleDriveSimDataNW_DiffData, +PxVehicleDriveSimDataNW_PropertiesStop, +PxVehicleDriveNW_PropertiesStart, +PxVehicleDriveNW_ConcreteTypeName, +PxVehicleDriveNW_MDriveSimData, +PxVehicleDriveNW_PropertiesStop, +PxVehicleNoDrive_PropertiesStart, +PxVehicleNoDrive_BrakeTorque, +PxVehicleNoDrive_DriveTorque, +PxVehicleNoDrive_SteerAngle, +PxVehicleNoDrive_ConcreteTypeName, +PxVehicleNoDrive_PropertiesStop, + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleAutoGeneratedMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleAutoGeneratedMetaDataObjects.h new file mode 100644 index 0000000..4950fca --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleAutoGeneratedMetaDataObjects.h @@ -0,0 +1,1811 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +#define PX_PROPERTY_INFO_NAME PxVehiclePropertyInfoName + class PxVehicleChassisData; + struct PxVehicleChassisDataGeneratedValues + { + PxVec3 MMOI; + PxReal MMass; + PxVec3 MCMOffset; + PxVehicleChassisDataGeneratedValues( const PxVehicleChassisData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleChassisData, MMOI, PxVehicleChassisDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleChassisData, MMass, PxVehicleChassisDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleChassisData, MCMOffset, PxVehicleChassisDataGeneratedValues) + struct PxVehicleChassisDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleChassisData"; } + PxPropertyInfo MMOI; + PxPropertyInfo MMass; + PxPropertyInfo MCMOffset; + + PxVehicleChassisDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MMOI, inStartIndex + 0 );; + inOperator( MMass, inStartIndex + 1 );; + inOperator( MCMOffset, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleChassisDataGeneratedInfo Info; + const PxVehicleChassisDataGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxEMPTYConversion[] = { + { "PxEmpty", static_cast( physx::PxEmpty ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< const physx::PxEMPTY > { PxEnumTraits() : NameConversion( g_physx__PxEMPTYConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleEngineData; + struct PxVehicleEngineDataGeneratedValues + { + PxReal RecipMOI; + PxReal RecipMaxOmega; + PxReal MMOI; + PxReal MPeakTorque; + PxReal MMaxOmega; + PxReal MDampingRateFullThrottle; + PxReal MDampingRateZeroThrottleClutchEngaged; + PxReal MDampingRateZeroThrottleClutchDisengaged; + PxVehicleEngineDataGeneratedValues( const PxVehicleEngineData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, RecipMOI, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, RecipMaxOmega, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MMOI, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MPeakTorque, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MMaxOmega, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MDampingRateFullThrottle, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MDampingRateZeroThrottleClutchEngaged, PxVehicleEngineDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleEngineData, MDampingRateZeroThrottleClutchDisengaged, PxVehicleEngineDataGeneratedValues) + struct PxVehicleEngineDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleEngineData"; } + PxReadOnlyPropertyInfo RecipMOI; + PxReadOnlyPropertyInfo RecipMaxOmega; + MTorqueCurveProperty MTorqueCurve; + PxPropertyInfo MMOI; + PxPropertyInfo MPeakTorque; + PxPropertyInfo MMaxOmega; + PxPropertyInfo MDampingRateFullThrottle; + PxPropertyInfo MDampingRateZeroThrottleClutchEngaged; + PxPropertyInfo MDampingRateZeroThrottleClutchDisengaged; + + PxVehicleEngineDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 9; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( RecipMOI, inStartIndex + 0 );; + inOperator( RecipMaxOmega, inStartIndex + 1 );; + inOperator( MTorqueCurve, inStartIndex + 2 );; + inOperator( MMOI, inStartIndex + 3 );; + inOperator( MPeakTorque, inStartIndex + 4 );; + inOperator( MMaxOmega, inStartIndex + 5 );; + inOperator( MDampingRateFullThrottle, inStartIndex + 6 );; + inOperator( MDampingRateZeroThrottleClutchEngaged, inStartIndex + 7 );; + inOperator( MDampingRateZeroThrottleClutchDisengaged, inStartIndex + 8 );; + return 9 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleEngineDataGeneratedInfo Info; + const PxVehicleEngineDataGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxVehicleGearsData__EnumConversion[] = { + { "eREVERSE", static_cast( physx::PxVehicleGearsData::eREVERSE ) }, + { "eNEUTRAL", static_cast( physx::PxVehicleGearsData::eNEUTRAL ) }, + { "eFIRST", static_cast( physx::PxVehicleGearsData::eFIRST ) }, + { "eSECOND", static_cast( physx::PxVehicleGearsData::eSECOND ) }, + { "eTHIRD", static_cast( physx::PxVehicleGearsData::eTHIRD ) }, + { "eFOURTH", static_cast( physx::PxVehicleGearsData::eFOURTH ) }, + { "eFIFTH", static_cast( physx::PxVehicleGearsData::eFIFTH ) }, + { "eSIXTH", static_cast( physx::PxVehicleGearsData::eSIXTH ) }, + { "eSEVENTH", static_cast( physx::PxVehicleGearsData::eSEVENTH ) }, + { "eEIGHTH", static_cast( physx::PxVehicleGearsData::eEIGHTH ) }, + { "eNINTH", static_cast( physx::PxVehicleGearsData::eNINTH ) }, + { "eTENTH", static_cast( physx::PxVehicleGearsData::eTENTH ) }, + { "eELEVENTH", static_cast( physx::PxVehicleGearsData::eELEVENTH ) }, + { "eTWELFTH", static_cast( physx::PxVehicleGearsData::eTWELFTH ) }, + { "eTHIRTEENTH", static_cast( physx::PxVehicleGearsData::eTHIRTEENTH ) }, + { "eFOURTEENTH", static_cast( physx::PxVehicleGearsData::eFOURTEENTH ) }, + { "eFIFTEENTH", static_cast( physx::PxVehicleGearsData::eFIFTEENTH ) }, + { "eSIXTEENTH", static_cast( physx::PxVehicleGearsData::eSIXTEENTH ) }, + { "eSEVENTEENTH", static_cast( physx::PxVehicleGearsData::eSEVENTEENTH ) }, + { "eEIGHTEENTH", static_cast( physx::PxVehicleGearsData::eEIGHTEENTH ) }, + { "eNINETEENTH", static_cast( physx::PxVehicleGearsData::eNINETEENTH ) }, + { "eTWENTIETH", static_cast( physx::PxVehicleGearsData::eTWENTIETH ) }, + { "eTWENTYFIRST", static_cast( physx::PxVehicleGearsData::eTWENTYFIRST ) }, + { "eTWENTYSECOND", static_cast( physx::PxVehicleGearsData::eTWENTYSECOND ) }, + { "eTWENTYTHIRD", static_cast( physx::PxVehicleGearsData::eTWENTYTHIRD ) }, + { "eTWENTYFOURTH", static_cast( physx::PxVehicleGearsData::eTWENTYFOURTH ) }, + { "eTWENTYFIFTH", static_cast( physx::PxVehicleGearsData::eTWENTYFIFTH ) }, + { "eTWENTYSIXTH", static_cast( physx::PxVehicleGearsData::eTWENTYSIXTH ) }, + { "eTWENTYSEVENTH", static_cast( physx::PxVehicleGearsData::eTWENTYSEVENTH ) }, + { "eTWENTYEIGHTH", static_cast( physx::PxVehicleGearsData::eTWENTYEIGHTH ) }, + { "eTWENTYNINTH", static_cast( physx::PxVehicleGearsData::eTWENTYNINTH ) }, + { "eTHIRTIETH", static_cast( physx::PxVehicleGearsData::eTHIRTIETH ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVehicleGearsData::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVehicleGearsData__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleGearsData; + struct PxVehicleGearsDataGeneratedValues + { + PxReal GearRatio[physx::PxVehicleGearsData::eGEARSRATIO_COUNT]; + PxReal MFinalRatio; + PxU32 MNbRatios; + PxReal MSwitchTime; + PxVehicleGearsDataGeneratedValues( const PxVehicleGearsData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleGearsData, GearRatio, PxVehicleGearsDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleGearsData, MFinalRatio, PxVehicleGearsDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleGearsData, MNbRatios, PxVehicleGearsDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleGearsData, MSwitchTime, PxVehicleGearsDataGeneratedValues) + struct PxVehicleGearsDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleGearsData"; } + PxIndexedPropertyInfo GearRatio; + PxPropertyInfo MFinalRatio; + PxPropertyInfo MNbRatios; + PxPropertyInfo MSwitchTime; + + PxVehicleGearsDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( GearRatio, inStartIndex + 0 );; + inOperator( MFinalRatio, inStartIndex + 1 );; + inOperator( MNbRatios, inStartIndex + 2 );; + inOperator( MSwitchTime, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleGearsDataGeneratedInfo Info; + const PxVehicleGearsDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleAutoBoxData; + struct PxVehicleAutoBoxDataGeneratedValues + { + PxReal Latency; + PxReal UpRatios[physx::PxVehicleGearsData::eGEARSRATIO_COUNT]; + PxReal DownRatios[physx::PxVehicleGearsData::eGEARSRATIO_COUNT]; + PxVehicleAutoBoxDataGeneratedValues( const PxVehicleAutoBoxData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAutoBoxData, Latency, PxVehicleAutoBoxDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAutoBoxData, UpRatios, PxVehicleAutoBoxDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAutoBoxData, DownRatios, PxVehicleAutoBoxDataGeneratedValues) + struct PxVehicleAutoBoxDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleAutoBoxData"; } + PxPropertyInfo Latency; + PxIndexedPropertyInfo UpRatios; + PxIndexedPropertyInfo DownRatios; + + PxVehicleAutoBoxDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Latency, inStartIndex + 0 );; + inOperator( UpRatios, inStartIndex + 1 );; + inOperator( DownRatios, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleAutoBoxDataGeneratedInfo Info; + const PxVehicleAutoBoxDataGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxVehicleDifferential4WData__EnumConversion[] = { + { "eDIFF_TYPE_LS_4WD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD ) }, + { "eDIFF_TYPE_LS_FRONTWD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_LS_FRONTWD ) }, + { "eDIFF_TYPE_LS_REARWD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_LS_REARWD ) }, + { "eDIFF_TYPE_OPEN_4WD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_4WD ) }, + { "eDIFF_TYPE_OPEN_FRONTWD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_FRONTWD ) }, + { "eDIFF_TYPE_OPEN_REARWD", static_cast( physx::PxVehicleDifferential4WData::eDIFF_TYPE_OPEN_REARWD ) }, + { "eMAX_NB_DIFF_TYPES", static_cast( physx::PxVehicleDifferential4WData::eMAX_NB_DIFF_TYPES ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVehicleDifferential4WData::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVehicleDifferential4WData__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleDifferential4WData; + struct PxVehicleDifferential4WDataGeneratedValues + { + PxReal MFrontRearSplit; + PxReal MFrontLeftRightSplit; + PxReal MRearLeftRightSplit; + PxReal MCentreBias; + PxReal MFrontBias; + PxReal MRearBias; + PxVehicleDifferential4WData::Enum MType; + PxVehicleDifferential4WDataGeneratedValues( const PxVehicleDifferential4WData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MFrontRearSplit, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MFrontLeftRightSplit, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MRearLeftRightSplit, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MCentreBias, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MFrontBias, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MRearBias, PxVehicleDifferential4WDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferential4WData, MType, PxVehicleDifferential4WDataGeneratedValues) + struct PxVehicleDifferential4WDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleDifferential4WData"; } + PxPropertyInfo MFrontRearSplit; + PxPropertyInfo MFrontLeftRightSplit; + PxPropertyInfo MRearLeftRightSplit; + PxPropertyInfo MCentreBias; + PxPropertyInfo MFrontBias; + PxPropertyInfo MRearBias; + PxPropertyInfo MType; + + PxVehicleDifferential4WDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 7; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MFrontRearSplit, inStartIndex + 0 );; + inOperator( MFrontLeftRightSplit, inStartIndex + 1 );; + inOperator( MRearLeftRightSplit, inStartIndex + 2 );; + inOperator( MCentreBias, inStartIndex + 3 );; + inOperator( MFrontBias, inStartIndex + 4 );; + inOperator( MRearBias, inStartIndex + 5 );; + inOperator( MType, inStartIndex + 6 );; + return 7 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDifferential4WDataGeneratedInfo Info; + const PxVehicleDifferential4WDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDifferentialNWData; + struct PxVehicleDifferentialNWDataGeneratedValues + { + PxU32 DrivenWheelStatus; + PxVehicleDifferentialNWDataGeneratedValues( const PxVehicleDifferentialNWData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDifferentialNWData, DrivenWheelStatus, PxVehicleDifferentialNWDataGeneratedValues) + struct PxVehicleDifferentialNWDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleDifferentialNWData"; } + PxPropertyInfo DrivenWheelStatus; + + PxVehicleDifferentialNWDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DrivenWheelStatus, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDifferentialNWDataGeneratedInfo Info; + const PxVehicleDifferentialNWDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleAckermannGeometryData; + struct PxVehicleAckermannGeometryDataGeneratedValues + { + PxReal MAccuracy; + PxReal MFrontWidth; + PxReal MRearWidth; + PxReal MAxleSeparation; + PxVehicleAckermannGeometryDataGeneratedValues( const PxVehicleAckermannGeometryData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAckermannGeometryData, MAccuracy, PxVehicleAckermannGeometryDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAckermannGeometryData, MFrontWidth, PxVehicleAckermannGeometryDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAckermannGeometryData, MRearWidth, PxVehicleAckermannGeometryDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAckermannGeometryData, MAxleSeparation, PxVehicleAckermannGeometryDataGeneratedValues) + struct PxVehicleAckermannGeometryDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleAckermannGeometryData"; } + PxPropertyInfo MAccuracy; + PxPropertyInfo MFrontWidth; + PxPropertyInfo MRearWidth; + PxPropertyInfo MAxleSeparation; + + PxVehicleAckermannGeometryDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MAccuracy, inStartIndex + 0 );; + inOperator( MFrontWidth, inStartIndex + 1 );; + inOperator( MRearWidth, inStartIndex + 2 );; + inOperator( MAxleSeparation, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleAckermannGeometryDataGeneratedInfo Info; + const PxVehicleAckermannGeometryDataGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxVehicleClutchAccuracyMode__EnumConversion[] = { + { "eESTIMATE", static_cast( physx::PxVehicleClutchAccuracyMode::eESTIMATE ) }, + { "eBEST_POSSIBLE", static_cast( physx::PxVehicleClutchAccuracyMode::eBEST_POSSIBLE ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVehicleClutchAccuracyMode::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVehicleClutchAccuracyMode__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleClutchData; + struct PxVehicleClutchDataGeneratedValues + { + PxReal MStrength; + PxVehicleClutchAccuracyMode::Enum MAccuracyMode; + PxU32 MEstimateIterations; + PxVehicleClutchDataGeneratedValues( const PxVehicleClutchData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleClutchData, MStrength, PxVehicleClutchDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleClutchData, MAccuracyMode, PxVehicleClutchDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleClutchData, MEstimateIterations, PxVehicleClutchDataGeneratedValues) + struct PxVehicleClutchDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleClutchData"; } + PxPropertyInfo MStrength; + PxPropertyInfo MAccuracyMode; + PxPropertyInfo MEstimateIterations; + + PxVehicleClutchDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MStrength, inStartIndex + 0 );; + inOperator( MAccuracyMode, inStartIndex + 1 );; + inOperator( MEstimateIterations, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleClutchDataGeneratedInfo Info; + const PxVehicleClutchDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleTireLoadFilterData; + struct PxVehicleTireLoadFilterDataGeneratedValues + { + PxReal Denominator; + PxReal MMinNormalisedLoad; + PxReal MMinFilteredNormalisedLoad; + PxReal MMaxNormalisedLoad; + PxReal MMaxFilteredNormalisedLoad; + PxVehicleTireLoadFilterDataGeneratedValues( const PxVehicleTireLoadFilterData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireLoadFilterData, Denominator, PxVehicleTireLoadFilterDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireLoadFilterData, MMinNormalisedLoad, PxVehicleTireLoadFilterDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireLoadFilterData, MMinFilteredNormalisedLoad, PxVehicleTireLoadFilterDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireLoadFilterData, MMaxNormalisedLoad, PxVehicleTireLoadFilterDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireLoadFilterData, MMaxFilteredNormalisedLoad, PxVehicleTireLoadFilterDataGeneratedValues) + struct PxVehicleTireLoadFilterDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleTireLoadFilterData"; } + PxReadOnlyPropertyInfo Denominator; + PxPropertyInfo MMinNormalisedLoad; + PxPropertyInfo MMinFilteredNormalisedLoad; + PxPropertyInfo MMaxNormalisedLoad; + PxPropertyInfo MMaxFilteredNormalisedLoad; + + PxVehicleTireLoadFilterDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( Denominator, inStartIndex + 0 );; + inOperator( MMinNormalisedLoad, inStartIndex + 1 );; + inOperator( MMinFilteredNormalisedLoad, inStartIndex + 2 );; + inOperator( MMaxNormalisedLoad, inStartIndex + 3 );; + inOperator( MMaxFilteredNormalisedLoad, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleTireLoadFilterDataGeneratedInfo Info; + const PxVehicleTireLoadFilterDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleWheelData; + struct PxVehicleWheelDataGeneratedValues + { + PxReal RecipRadius; + PxReal RecipMOI; + PxReal MRadius; + PxReal MWidth; + PxReal MMass; + PxReal MMOI; + PxReal MDampingRate; + PxReal MMaxBrakeTorque; + PxReal MMaxHandBrakeTorque; + PxReal MMaxSteer; + PxReal MToeAngle; + PxVehicleWheelDataGeneratedValues( const PxVehicleWheelData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, RecipRadius, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, RecipMOI, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MRadius, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MWidth, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MMass, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MMOI, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MDampingRate, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MMaxBrakeTorque, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MMaxHandBrakeTorque, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MMaxSteer, PxVehicleWheelDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelData, MToeAngle, PxVehicleWheelDataGeneratedValues) + struct PxVehicleWheelDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleWheelData"; } + PxReadOnlyPropertyInfo RecipRadius; + PxReadOnlyPropertyInfo RecipMOI; + PxPropertyInfo MRadius; + PxPropertyInfo MWidth; + PxPropertyInfo MMass; + PxPropertyInfo MMOI; + PxPropertyInfo MDampingRate; + PxPropertyInfo MMaxBrakeTorque; + PxPropertyInfo MMaxHandBrakeTorque; + PxPropertyInfo MMaxSteer; + PxPropertyInfo MToeAngle; + + PxVehicleWheelDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 11; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( RecipRadius, inStartIndex + 0 );; + inOperator( RecipMOI, inStartIndex + 1 );; + inOperator( MRadius, inStartIndex + 2 );; + inOperator( MWidth, inStartIndex + 3 );; + inOperator( MMass, inStartIndex + 4 );; + inOperator( MMOI, inStartIndex + 5 );; + inOperator( MDampingRate, inStartIndex + 6 );; + inOperator( MMaxBrakeTorque, inStartIndex + 7 );; + inOperator( MMaxHandBrakeTorque, inStartIndex + 8 );; + inOperator( MMaxSteer, inStartIndex + 9 );; + inOperator( MToeAngle, inStartIndex + 10 );; + return 11 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleWheelDataGeneratedInfo Info; + const PxVehicleWheelDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleSuspensionData; + struct PxVehicleSuspensionDataGeneratedValues + { + PxReal RecipMaxCompression; + PxReal RecipMaxDroop; + PxReal MSpringStrength; + PxReal MSpringDamperRate; + PxReal MMaxCompression; + PxReal MMaxDroop; + PxReal MSprungMass; + PxReal MCamberAtRest; + PxReal MCamberAtMaxCompression; + PxReal MCamberAtMaxDroop; + PxVehicleSuspensionDataGeneratedValues( const PxVehicleSuspensionData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, RecipMaxCompression, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, RecipMaxDroop, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MSpringStrength, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MSpringDamperRate, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MMaxCompression, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MMaxDroop, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MSprungMass, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MCamberAtRest, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MCamberAtMaxCompression, PxVehicleSuspensionDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleSuspensionData, MCamberAtMaxDroop, PxVehicleSuspensionDataGeneratedValues) + struct PxVehicleSuspensionDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleSuspensionData"; } + PxReadOnlyPropertyInfo RecipMaxCompression; + PxReadOnlyPropertyInfo RecipMaxDroop; + PxWriteOnlyPropertyInfo MassAndPreserveNaturalFrequency; + PxPropertyInfo MSpringStrength; + PxPropertyInfo MSpringDamperRate; + PxPropertyInfo MMaxCompression; + PxPropertyInfo MMaxDroop; + PxPropertyInfo MSprungMass; + PxPropertyInfo MCamberAtRest; + PxPropertyInfo MCamberAtMaxCompression; + PxPropertyInfo MCamberAtMaxDroop; + + PxVehicleSuspensionDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 11; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( RecipMaxCompression, inStartIndex + 0 );; + inOperator( RecipMaxDroop, inStartIndex + 1 );; + inOperator( MassAndPreserveNaturalFrequency, inStartIndex + 2 );; + inOperator( MSpringStrength, inStartIndex + 3 );; + inOperator( MSpringDamperRate, inStartIndex + 4 );; + inOperator( MMaxCompression, inStartIndex + 5 );; + inOperator( MMaxDroop, inStartIndex + 6 );; + inOperator( MSprungMass, inStartIndex + 7 );; + inOperator( MCamberAtRest, inStartIndex + 8 );; + inOperator( MCamberAtMaxCompression, inStartIndex + 9 );; + inOperator( MCamberAtMaxDroop, inStartIndex + 10 );; + return 11 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleSuspensionDataGeneratedInfo Info; + const PxVehicleSuspensionDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleAntiRollBarData; + struct PxVehicleAntiRollBarDataGeneratedValues + { + PxU32 MWheel0; + PxU32 MWheel1; + PxF32 MStiffness; + PxVehicleAntiRollBarDataGeneratedValues( const PxVehicleAntiRollBarData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAntiRollBarData, MWheel0, PxVehicleAntiRollBarDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAntiRollBarData, MWheel1, PxVehicleAntiRollBarDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleAntiRollBarData, MStiffness, PxVehicleAntiRollBarDataGeneratedValues) + struct PxVehicleAntiRollBarDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleAntiRollBarData"; } + PxPropertyInfo MWheel0; + PxPropertyInfo MWheel1; + PxPropertyInfo MStiffness; + + PxVehicleAntiRollBarDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( MWheel0, inStartIndex + 0 );; + inOperator( MWheel1, inStartIndex + 1 );; + inOperator( MStiffness, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleAntiRollBarDataGeneratedInfo Info; + const PxVehicleAntiRollBarDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleTireData; + struct PxVehicleTireDataGeneratedValues + { + PxReal RecipLongitudinalStiffnessPerUnitGravity; + PxReal FrictionVsSlipGraphRecipx1Minusx0; + PxReal FrictionVsSlipGraphRecipx2Minusx1; + PxReal MLatStiffX; + PxReal MLatStiffY; + PxReal MLongitudinalStiffnessPerUnitGravity; + PxReal MCamberStiffnessPerUnitGravity; + PxU32 MType; + PxReal MFrictionVsSlipGraph[3][2]; + PxVehicleTireDataGeneratedValues( const PxVehicleTireData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, RecipLongitudinalStiffnessPerUnitGravity, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, FrictionVsSlipGraphRecipx1Minusx0, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, FrictionVsSlipGraphRecipx2Minusx1, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MLatStiffX, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MLatStiffY, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MLongitudinalStiffnessPerUnitGravity, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MCamberStiffnessPerUnitGravity, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MType, PxVehicleTireDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleTireData, MFrictionVsSlipGraph, PxVehicleTireDataGeneratedValues) + struct PxVehicleTireDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleTireData"; } + PxReadOnlyPropertyInfo RecipLongitudinalStiffnessPerUnitGravity; + PxReadOnlyPropertyInfo FrictionVsSlipGraphRecipx1Minusx0; + PxReadOnlyPropertyInfo FrictionVsSlipGraphRecipx2Minusx1; + PxPropertyInfo MLatStiffX; + PxPropertyInfo MLatStiffY; + PxPropertyInfo MLongitudinalStiffnessPerUnitGravity; + PxPropertyInfo MCamberStiffnessPerUnitGravity; + PxPropertyInfo MType; + MFrictionVsSlipGraphProperty MFrictionVsSlipGraph; + + PxVehicleTireDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 9; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( RecipLongitudinalStiffnessPerUnitGravity, inStartIndex + 0 );; + inOperator( FrictionVsSlipGraphRecipx1Minusx0, inStartIndex + 1 );; + inOperator( FrictionVsSlipGraphRecipx2Minusx1, inStartIndex + 2 );; + inOperator( MLatStiffX, inStartIndex + 3 );; + inOperator( MLatStiffY, inStartIndex + 4 );; + inOperator( MLongitudinalStiffnessPerUnitGravity, inStartIndex + 5 );; + inOperator( MCamberStiffnessPerUnitGravity, inStartIndex + 6 );; + inOperator( MType, inStartIndex + 7 );; + inOperator( MFrictionVsSlipGraph, inStartIndex + 8 );; + return 9 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleTireDataGeneratedInfo Info; + const PxVehicleTireDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleWheels4SimData; + struct PxVehicleWheels4SimDataGeneratedValues + { + const PxReal * TireRestLoadsArray; + const PxReal * RecipTireRestLoadsArray; + PxVehicleWheels4SimDataGeneratedValues( const PxVehicleWheels4SimData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels4SimData, TireRestLoadsArray, PxVehicleWheels4SimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels4SimData, RecipTireRestLoadsArray, PxVehicleWheels4SimDataGeneratedValues) + struct PxVehicleWheels4SimDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleWheels4SimData"; } + PxReadOnlyPropertyInfo TireRestLoadsArray; + PxReadOnlyPropertyInfo RecipTireRestLoadsArray; + + PxVehicleWheels4SimDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( TireRestLoadsArray, inStartIndex + 0 );; + inOperator( RecipTireRestLoadsArray, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleWheels4SimDataGeneratedInfo Info; + const PxVehicleWheels4SimDataGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxVehicleWheelsSimFlag__EnumConversion[] = { + { "eLIMIT_SUSPENSION_EXPANSION_VELOCITY", static_cast( physx::PxVehicleWheelsSimFlag::eLIMIT_SUSPENSION_EXPANSION_VELOCITY ) }, + { "eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST", static_cast( physx::PxVehicleWheelsSimFlag::eDISABLE_INTERNAL_CYLINDER_PLANE_INTERSECTION_TEST ) }, + { "eDISABLE_SUSPENSION_FORCE_PROJECTION", static_cast( physx::PxVehicleWheelsSimFlag::eDISABLE_SUSPENSION_FORCE_PROJECTION ) }, + { "eDISABLE_SPRUNG_MASS_SUM_CHECK", static_cast( physx::PxVehicleWheelsSimFlag::eDISABLE_SPRUNG_MASS_SUM_CHECK ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVehicleWheelsSimFlag::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVehicleWheelsSimFlag__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleWheelsSimData; + struct PxVehicleWheelsSimDataGeneratedValues + { + PxVehicleTireLoadFilterData TireLoadFilterData; + PxF32 MinLongSlipDenominator; + PxVehicleWheelsSimFlags Flags; + PxF32 ThresholdLongSpeed; + PxU32 LowForwardSpeedSubStepCount; + PxU32 HighForwardSpeedSubStepCount; + PxVehicleWheelsSimDataGeneratedValues( const PxVehicleWheelsSimData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, TireLoadFilterData, PxVehicleWheelsSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, MinLongSlipDenominator, PxVehicleWheelsSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, Flags, PxVehicleWheelsSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, ThresholdLongSpeed, PxVehicleWheelsSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, LowForwardSpeedSubStepCount, PxVehicleWheelsSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsSimData, HighForwardSpeedSubStepCount, PxVehicleWheelsSimDataGeneratedValues) + struct PxVehicleWheelsSimDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleWheelsSimData"; } + PxWriteOnlyPropertyInfo ChassisMass; + PxExtendedIndexedPropertyInfo SuspensionData; + PxExtendedIndexedPropertyInfo WheelData; + PxExtendedIndexedPropertyInfo TireData; + PxExtendedIndexedPropertyInfo SuspTravelDirection; + PxExtendedIndexedPropertyInfo SuspForceAppPointOffset; + PxExtendedIndexedPropertyInfo TireForceAppPointOffset; + PxExtendedIndexedPropertyInfo WheelCentreOffset; + PxExtendedIndexedPropertyInfo WheelShapeMapping; + PxExtendedIndexedPropertyInfo SceneQueryFilterData; + PxExtendedIndexedPropertyInfo AntiRollBarData; + PxPropertyInfo TireLoadFilterData; + PxPropertyInfo MinLongSlipDenominator; + PxPropertyInfo Flags; + PxPropertyInfo ThresholdLongSpeed; + PxPropertyInfo LowForwardSpeedSubStepCount; + PxPropertyInfo HighForwardSpeedSubStepCount; + PxExtendedIndexedPropertyInfo WheelEnabledState; + + PxVehicleWheelsSimDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 18; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ChassisMass, inStartIndex + 0 );; + inOperator( SuspensionData, inStartIndex + 1 );; + inOperator( WheelData, inStartIndex + 2 );; + inOperator( TireData, inStartIndex + 3 );; + inOperator( SuspTravelDirection, inStartIndex + 4 );; + inOperator( SuspForceAppPointOffset, inStartIndex + 5 );; + inOperator( TireForceAppPointOffset, inStartIndex + 6 );; + inOperator( WheelCentreOffset, inStartIndex + 7 );; + inOperator( WheelShapeMapping, inStartIndex + 8 );; + inOperator( SceneQueryFilterData, inStartIndex + 9 );; + inOperator( AntiRollBarData, inStartIndex + 10 );; + inOperator( TireLoadFilterData, inStartIndex + 11 );; + inOperator( MinLongSlipDenominator, inStartIndex + 12 );; + inOperator( Flags, inStartIndex + 13 );; + inOperator( ThresholdLongSpeed, inStartIndex + 14 );; + inOperator( LowForwardSpeedSubStepCount, inStartIndex + 15 );; + inOperator( HighForwardSpeedSubStepCount, inStartIndex + 16 );; + inOperator( WheelEnabledState, inStartIndex + 17 );; + return 18 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleWheelsSimDataGeneratedInfo Info; + const PxVehicleWheelsSimDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleWheelsDynData; + struct PxVehicleWheelsDynDataGeneratedValues + { + PxVehicleWheels4DynData * Wheel4DynData; + PxVehicleWheelsDynDataGeneratedValues( const PxVehicleWheelsDynData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheelsDynData, Wheel4DynData, PxVehicleWheelsDynDataGeneratedValues) + struct PxVehicleWheelsDynDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleWheelsDynData"; } + PxWriteOnlyPropertyInfo TireForceShaderFunction; + PxExtendedIndexedPropertyInfo WheelRotationSpeed; + PxExtendedIndexedPropertyInfo WheelRotationAngle; + PxReadOnlyPropertyInfo Wheel4DynData; + PxReadOnlyCollectionPropertyInfo Constraints; + + PxVehicleWheelsDynDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( TireForceShaderFunction, inStartIndex + 0 );; + inOperator( WheelRotationSpeed, inStartIndex + 1 );; + inOperator( WheelRotationAngle, inStartIndex + 2 );; + inOperator( Wheel4DynData, inStartIndex + 3 );; + inOperator( Constraints, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleWheelsDynDataGeneratedInfo Info; + const PxVehicleWheelsDynDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleWheels; + struct PxVehicleWheelsGeneratedValues + { + PxU32 VehicleType; + const PxRigidDynamic * RigidDynamicActor; + const char * ConcreteTypeName; + PxVehicleWheelsSimData MWheelsSimData; + PxVehicleWheelsDynData MWheelsDynData; + PxVehicleWheelsGeneratedValues( const PxVehicleWheels* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels, VehicleType, PxVehicleWheelsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels, RigidDynamicActor, PxVehicleWheelsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels, ConcreteTypeName, PxVehicleWheelsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels, MWheelsSimData, PxVehicleWheelsGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleWheels, MWheelsDynData, PxVehicleWheelsGeneratedValues) + struct PxVehicleWheelsGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleWheels"; } + PxReadOnlyPropertyInfo VehicleType; + PxReadOnlyPropertyInfo RigidDynamicActor; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo MWheelsSimData; + PxPropertyInfo MWheelsDynData; + + PxVehicleWheelsGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 5; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( VehicleType, inStartIndex + 0 );; + inOperator( RigidDynamicActor, inStartIndex + 1 );; + inOperator( ConcreteTypeName, inStartIndex + 2 );; + inOperator( MWheelsSimData, inStartIndex + 3 );; + inOperator( MWheelsDynData, inStartIndex + 4 );; + return 5 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleWheelsGeneratedInfo Info; + const PxVehicleWheelsGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDriveDynData; + struct PxVehicleDriveDynDataGeneratedValues + { + _Bool GearUp; + _Bool GearDown; + _Bool UseAutoGears; + PxU32 CurrentGear; + PxU32 TargetGear; + PxReal EngineRotationSpeed; + PxU32 GearChange; + PxReal GearSwitchTime; + PxReal AutoBoxSwitchTime; + _Bool MUseAutoGears; + _Bool MGearUpPressed; + _Bool MGearDownPressed; + PxU32 MCurrentGear; + PxU32 MTargetGear; + PxReal MEnginespeed; + PxReal MGearSwitchTime; + PxReal MAutoBoxSwitchTime; + PxVehicleDriveDynDataGeneratedValues( const PxVehicleDriveDynData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, GearUp, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, GearDown, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, UseAutoGears, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, CurrentGear, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, TargetGear, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, EngineRotationSpeed, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, GearChange, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, GearSwitchTime, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, AutoBoxSwitchTime, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MUseAutoGears, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MGearUpPressed, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MGearDownPressed, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MCurrentGear, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MTargetGear, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MEnginespeed, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MGearSwitchTime, PxVehicleDriveDynDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveDynData, MAutoBoxSwitchTime, PxVehicleDriveDynDataGeneratedValues) + struct PxVehicleDriveDynDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleDriveDynData"; } + PxExtendedIndexedPropertyInfo AnalogInput; + PxPropertyInfo GearUp; + PxPropertyInfo GearDown; + PxPropertyInfo UseAutoGears; + PxPropertyInfo CurrentGear; + PxPropertyInfo TargetGear; + PxPropertyInfo EngineRotationSpeed; + PxPropertyInfo GearChange; + PxPropertyInfo GearSwitchTime; + PxPropertyInfo AutoBoxSwitchTime; + PxPropertyInfo MUseAutoGears; + PxPropertyInfo MGearUpPressed; + PxPropertyInfo MGearDownPressed; + PxPropertyInfo MCurrentGear; + PxPropertyInfo MTargetGear; + PxPropertyInfo MEnginespeed; + PxPropertyInfo MGearSwitchTime; + PxPropertyInfo MAutoBoxSwitchTime; + + PxVehicleDriveDynDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 18; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( AnalogInput, inStartIndex + 0 );; + inOperator( GearUp, inStartIndex + 1 );; + inOperator( GearDown, inStartIndex + 2 );; + inOperator( UseAutoGears, inStartIndex + 3 );; + inOperator( CurrentGear, inStartIndex + 4 );; + inOperator( TargetGear, inStartIndex + 5 );; + inOperator( EngineRotationSpeed, inStartIndex + 6 );; + inOperator( GearChange, inStartIndex + 7 );; + inOperator( GearSwitchTime, inStartIndex + 8 );; + inOperator( AutoBoxSwitchTime, inStartIndex + 9 );; + inOperator( MUseAutoGears, inStartIndex + 10 );; + inOperator( MGearUpPressed, inStartIndex + 11 );; + inOperator( MGearDownPressed, inStartIndex + 12 );; + inOperator( MCurrentGear, inStartIndex + 13 );; + inOperator( MTargetGear, inStartIndex + 14 );; + inOperator( MEnginespeed, inStartIndex + 15 );; + inOperator( MGearSwitchTime, inStartIndex + 16 );; + inOperator( MAutoBoxSwitchTime, inStartIndex + 17 );; + return 18 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveDynDataGeneratedInfo Info; + const PxVehicleDriveDynDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDriveSimData; + struct PxVehicleDriveSimDataGeneratedValues + { + PxVehicleEngineData EngineData; + PxVehicleGearsData GearsData; + PxVehicleClutchData ClutchData; + PxVehicleAutoBoxData AutoBoxData; + PxVehicleDriveSimDataGeneratedValues( const PxVehicleDriveSimData* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData, EngineData, PxVehicleDriveSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData, GearsData, PxVehicleDriveSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData, ClutchData, PxVehicleDriveSimDataGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData, AutoBoxData, PxVehicleDriveSimDataGeneratedValues) + struct PxVehicleDriveSimDataGeneratedInfo + + { + static const char* getClassName() { return "PxVehicleDriveSimData"; } + PxPropertyInfo EngineData; + PxPropertyInfo GearsData; + PxPropertyInfo ClutchData; + PxPropertyInfo AutoBoxData; + + PxVehicleDriveSimDataGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( EngineData, inStartIndex + 0 );; + inOperator( GearsData, inStartIndex + 1 );; + inOperator( ClutchData, inStartIndex + 2 );; + inOperator( AutoBoxData, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveSimDataGeneratedInfo Info; + const PxVehicleDriveSimDataGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDriveSimData4W; + struct PxVehicleDriveSimData4WGeneratedValues + : PxVehicleDriveSimDataGeneratedValues { + PxVehicleDifferential4WData DiffData; + PxVehicleAckermannGeometryData AckermannGeometryData; + PxVehicleDriveSimData4WGeneratedValues( const PxVehicleDriveSimData4W* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData4W, DiffData, PxVehicleDriveSimData4WGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimData4W, AckermannGeometryData, PxVehicleDriveSimData4WGeneratedValues) + struct PxVehicleDriveSimData4WGeneratedInfo + : PxVehicleDriveSimDataGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDriveSimData4W"; } + PxPropertyInfo DiffData; + PxPropertyInfo AckermannGeometryData; + + PxVehicleDriveSimData4WGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleDriveSimDataGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleDriveSimDataGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleDriveSimDataGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DiffData, inStartIndex + 0 );; + inOperator( AckermannGeometryData, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveSimData4WGeneratedInfo Info; + const PxVehicleDriveSimData4WGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDrive; + struct PxVehicleDriveGeneratedValues + : PxVehicleWheelsGeneratedValues { + const char * ConcreteTypeName; + PxVehicleDriveDynData MDriveDynData; + PxVehicleDriveGeneratedValues( const PxVehicleDrive* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDrive, ConcreteTypeName, PxVehicleDriveGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDrive, MDriveDynData, PxVehicleDriveGeneratedValues) + struct PxVehicleDriveGeneratedInfo + : PxVehicleWheelsGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDrive"; } + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo MDriveDynData; + + PxVehicleDriveGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleWheelsGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleWheelsGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleWheelsGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ConcreteTypeName, inStartIndex + 0 );; + inOperator( MDriveDynData, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveGeneratedInfo Info; + const PxVehicleDriveGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDrive4W; + struct PxVehicleDrive4WGeneratedValues + : PxVehicleDriveGeneratedValues { + const char * ConcreteTypeName; + PxVehicleDriveSimData4W MDriveSimData; + PxVehicleDrive4WGeneratedValues( const PxVehicleDrive4W* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDrive4W, ConcreteTypeName, PxVehicleDrive4WGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDrive4W, MDriveSimData, PxVehicleDrive4WGeneratedValues) + struct PxVehicleDrive4WGeneratedInfo + : PxVehicleDriveGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDrive4W"; } + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo MDriveSimData; + + PxVehicleDrive4WGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleDriveGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleDriveGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleDriveGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ConcreteTypeName, inStartIndex + 0 );; + inOperator( MDriveSimData, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDrive4WGeneratedInfo Info; + const PxVehicleDrive4WGeneratedInfo* getInfo() { return &Info; } + }; + + static PxU32ToName g_physx__PxVehicleDriveTankControlModel__EnumConversion[] = { + { "eSTANDARD", static_cast( physx::PxVehicleDriveTankControlModel::eSTANDARD ) }, + { "eSPECIAL", static_cast( physx::PxVehicleDriveTankControlModel::eSPECIAL ) }, + { NULL, 0 } + }; + +template<> struct PxEnumTraits< physx::PxVehicleDriveTankControlModel::Enum > { PxEnumTraits() : NameConversion( g_physx__PxVehicleDriveTankControlModel__EnumConversion ) {} const PxU32ToName* NameConversion; }; + class PxVehicleDriveTank; + struct PxVehicleDriveTankGeneratedValues + : PxVehicleDriveGeneratedValues { + PxVehicleDriveTankControlModel::Enum DriveModel; + const char * ConcreteTypeName; + PxVehicleDriveSimData MDriveSimData; + PxVehicleDriveTankGeneratedValues( const PxVehicleDriveTank* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveTank, DriveModel, PxVehicleDriveTankGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveTank, ConcreteTypeName, PxVehicleDriveTankGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveTank, MDriveSimData, PxVehicleDriveTankGeneratedValues) + struct PxVehicleDriveTankGeneratedInfo + : PxVehicleDriveGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDriveTank"; } + PxPropertyInfo DriveModel; + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo MDriveSimData; + + PxVehicleDriveTankGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleDriveGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleDriveGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 3; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleDriveGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DriveModel, inStartIndex + 0 );; + inOperator( ConcreteTypeName, inStartIndex + 1 );; + inOperator( MDriveSimData, inStartIndex + 2 );; + return 3 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveTankGeneratedInfo Info; + const PxVehicleDriveTankGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDriveSimDataNW; + struct PxVehicleDriveSimDataNWGeneratedValues + : PxVehicleDriveSimDataGeneratedValues { + PxVehicleDifferentialNWData DiffData; + PxVehicleDriveSimDataNWGeneratedValues( const PxVehicleDriveSimDataNW* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveSimDataNW, DiffData, PxVehicleDriveSimDataNWGeneratedValues) + struct PxVehicleDriveSimDataNWGeneratedInfo + : PxVehicleDriveSimDataGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDriveSimDataNW"; } + PxPropertyInfo DiffData; + + PxVehicleDriveSimDataNWGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleDriveSimDataGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleDriveSimDataGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 1; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleDriveSimDataGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( DiffData, inStartIndex + 0 );; + return 1 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveSimDataNWGeneratedInfo Info; + const PxVehicleDriveSimDataNWGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleDriveNW; + struct PxVehicleDriveNWGeneratedValues + : PxVehicleDriveGeneratedValues { + const char * ConcreteTypeName; + PxVehicleDriveSimDataNW MDriveSimData; + PxVehicleDriveNWGeneratedValues( const PxVehicleDriveNW* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveNW, ConcreteTypeName, PxVehicleDriveNWGeneratedValues) + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleDriveNW, MDriveSimData, PxVehicleDriveNWGeneratedValues) + struct PxVehicleDriveNWGeneratedInfo + : PxVehicleDriveGeneratedInfo + { + static const char* getClassName() { return "PxVehicleDriveNW"; } + PxReadOnlyPropertyInfo ConcreteTypeName; + PxPropertyInfo MDriveSimData; + + PxVehicleDriveNWGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleDriveGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleDriveGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 2; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleDriveGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( ConcreteTypeName, inStartIndex + 0 );; + inOperator( MDriveSimData, inStartIndex + 1 );; + return 2 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleDriveNWGeneratedInfo Info; + const PxVehicleDriveNWGeneratedInfo* getInfo() { return &Info; } + }; + + class PxVehicleNoDrive; + struct PxVehicleNoDriveGeneratedValues + : PxVehicleWheelsGeneratedValues { + const char * ConcreteTypeName; + PxVehicleNoDriveGeneratedValues( const PxVehicleNoDrive* inSource ); + }; + DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( PxVehicleNoDrive, ConcreteTypeName, PxVehicleNoDriveGeneratedValues) + struct PxVehicleNoDriveGeneratedInfo + : PxVehicleWheelsGeneratedInfo + { + static const char* getClassName() { return "PxVehicleNoDrive"; } + PxExtendedIndexedPropertyInfo BrakeTorque; + PxExtendedIndexedPropertyInfo DriveTorque; + PxExtendedIndexedPropertyInfo SteerAngle; + PxReadOnlyPropertyInfo ConcreteTypeName; + + PxVehicleNoDriveGeneratedInfo(); + template + TReturnType visitType( TOperator inOperator ) const + { + return inOperator( reinterpret_cast(NULL) ); + } + template + void visitBases( TOperator inOperator ) + { + PX_UNUSED(inOperator); + inOperator( *static_cast( this ) ); + } + template + PxU32 visitBaseProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inStartIndex = PxVehicleWheelsGeneratedInfo::visitBaseProperties( inOperator, inStartIndex ); + inStartIndex = PxVehicleWheelsGeneratedInfo::visitInstanceProperties( inOperator, inStartIndex ); + return inStartIndex; + } + static PxU32 instancePropertyCount() { return 4; } + static PxU32 totalPropertyCount() { return instancePropertyCount() + + PxVehicleWheelsGeneratedInfo::totalPropertyCount(); } + template + PxU32 visitInstanceProperties( TOperator inOperator, PxU32 inStartIndex = 0 ) const + { + PX_UNUSED(inOperator); + PX_UNUSED(inStartIndex); + inOperator( BrakeTorque, inStartIndex + 0 );; + inOperator( DriveTorque, inStartIndex + 1 );; + inOperator( SteerAngle, inStartIndex + 2 );; + inOperator( ConcreteTypeName, inStartIndex + 3 );; + return 4 + inStartIndex; + } + }; + template<> struct PxClassInfoTraits + { + PxVehicleNoDriveGeneratedInfo Info; + const PxVehicleNoDriveGeneratedInfo* getInfo() { return &Info; } + }; + + + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON +#undef PX_PROPERTY_INFO_NAME diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h new file mode 100644 index 0000000..4beb1e9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/include/PxVehicleMetaDataObjects.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_VEHICLE_META_DATA_OBJECTS_H +#define PX_VEHICLE_META_DATA_OBJECTS_H + +#include "PxPhysicsAPI.h" +#include "extensions/PxExtensionsAPI.h" +#include "PxMetaDataObjects.h" +#include "PxExtensionMetaDataObjects.h" + +/** \addtogroup physics +@{ +*/ + +namespace physx +{ + +struct PxVehiclePropertyInfoName +{ + enum Enum + { + Unnamed = PxExtensionsPropertyInfoName::LastPxPropertyInfoName, +#include "PxVehicleAutoGeneratedMetaDataObjectNames.h" + LastPxPropertyInfoName + }; +}; + +#define DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP( type, prop, valueStruct ) \ + template<> struct PxPropertyToValueStructMemberMap< PxVehiclePropertyInfoName::type##_##prop > \ + { \ + PxU32 Offset; \ + PxPropertyToValueStructMemberMap< PxVehiclePropertyInfoName::type##_##prop >() : Offset( PX_OFFSET_OF_RT( valueStruct, prop ) ) {} \ + template void visitProp( TOperator inOperator, valueStruct& inStruct ) { inOperator( inStruct.prop ); } \ + }; + +struct MFrictionVsSlipGraphProperty : public PxExtendedDualIndexedPropertyInfo +{ + PX_PHYSX_CORE_API MFrictionVsSlipGraphProperty(); +}; + +struct MTorqueCurveProperty : public PxFixedSizeLookupTablePropertyInfo +{ + PX_PHYSX_CORE_API MTorqueCurveProperty(); +}; + +#if PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#if __has_warning("-Wshadow-field") +#pragma clang diagnostic ignored "-Wshadow-field" +#endif +#endif +#include "PxVehicleAutoGeneratedMetaDataObjects.h" +#if PX_CLANG +#pragma clang diagnostic pop +#endif + +#undef DEFINE_PROPERTY_TO_VALUE_STRUCT_MAP + +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp new file mode 100644 index 0000000..577dcfc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleAutoGeneratedMetaDataObjects.cpp @@ -0,0 +1,742 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// This code is auto-generated by the PhysX Clang metadata generator. Do not edit or be +// prepared for your edits to be quietly ignored next time the clang metadata generator is +// run. You can find the most recent version of clang metadata generator by contacting +// Chris Nuernberger or Dilip or Adam. +// The source code for the generate was at one time checked into: +// physx/PhysXMetaDataGenerator/llvm/tools/clang/lib/Frontend/PhysXMetaDataAction.cpp +#include "foundation/PxPreprocessor.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-identifier" +#endif +#include "PxVehicleMetaDataObjects.h" +#if PX_LINUX && PX_CLANG +#pragma clang diagnostic pop +#endif + +#include "PxMetaDataCppPrefix.h" +#include "PxVehicleSuspWheelTire4.h" +using namespace physx; +inline PxVec3 getPxVehicleChassisDataMMOI( const PxVehicleChassisData* inOwner ) { return inOwner->mMOI; } +inline void setPxVehicleChassisDataMMOI( PxVehicleChassisData* inOwner, PxVec3 inData) { inOwner->mMOI = inData; } +inline PxReal getPxVehicleChassisDataMMass( const PxVehicleChassisData* inOwner ) { return inOwner->mMass; } +inline void setPxVehicleChassisDataMMass( PxVehicleChassisData* inOwner, PxReal inData) { inOwner->mMass = inData; } +inline PxVec3 getPxVehicleChassisDataMCMOffset( const PxVehicleChassisData* inOwner ) { return inOwner->mCMOffset; } +inline void setPxVehicleChassisDataMCMOffset( PxVehicleChassisData* inOwner, PxVec3 inData) { inOwner->mCMOffset = inData; } + PxVehicleChassisDataGeneratedInfo::PxVehicleChassisDataGeneratedInfo() + : MMOI( "MMOI", setPxVehicleChassisDataMMOI, getPxVehicleChassisDataMMOI ) + , MMass( "MMass", setPxVehicleChassisDataMMass, getPxVehicleChassisDataMMass ) + , MCMOffset( "MCMOffset", setPxVehicleChassisDataMCMOffset, getPxVehicleChassisDataMCMOffset ) +{} + PxVehicleChassisDataGeneratedValues::PxVehicleChassisDataGeneratedValues( const PxVehicleChassisData* inSource ) + :MMOI( inSource->mMOI ) + ,MMass( inSource->mMass ) + ,MCMOffset( inSource->mCMOffset ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleEngineData_RecipMOI( const PxVehicleEngineData* inObj ) { return inObj->getRecipMOI(); } +PxReal getPxVehicleEngineData_RecipMaxOmega( const PxVehicleEngineData* inObj ) { return inObj->getRecipMaxOmega(); } +inline PxReal getPxVehicleEngineDataMMOI( const PxVehicleEngineData* inOwner ) { return inOwner->mMOI; } +inline void setPxVehicleEngineDataMMOI( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mMOI = inData; } +inline PxReal getPxVehicleEngineDataMPeakTorque( const PxVehicleEngineData* inOwner ) { return inOwner->mPeakTorque; } +inline void setPxVehicleEngineDataMPeakTorque( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mPeakTorque = inData; } +inline PxReal getPxVehicleEngineDataMMaxOmega( const PxVehicleEngineData* inOwner ) { return inOwner->mMaxOmega; } +inline void setPxVehicleEngineDataMMaxOmega( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mMaxOmega = inData; } +inline PxReal getPxVehicleEngineDataMDampingRateFullThrottle( const PxVehicleEngineData* inOwner ) { return inOwner->mDampingRateFullThrottle; } +inline void setPxVehicleEngineDataMDampingRateFullThrottle( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mDampingRateFullThrottle = inData; } +inline PxReal getPxVehicleEngineDataMDampingRateZeroThrottleClutchEngaged( const PxVehicleEngineData* inOwner ) { return inOwner->mDampingRateZeroThrottleClutchEngaged; } +inline void setPxVehicleEngineDataMDampingRateZeroThrottleClutchEngaged( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mDampingRateZeroThrottleClutchEngaged = inData; } +inline PxReal getPxVehicleEngineDataMDampingRateZeroThrottleClutchDisengaged( const PxVehicleEngineData* inOwner ) { return inOwner->mDampingRateZeroThrottleClutchDisengaged; } +inline void setPxVehicleEngineDataMDampingRateZeroThrottleClutchDisengaged( PxVehicleEngineData* inOwner, PxReal inData) { inOwner->mDampingRateZeroThrottleClutchDisengaged = inData; } + PxVehicleEngineDataGeneratedInfo::PxVehicleEngineDataGeneratedInfo() + : RecipMOI( "RecipMOI", getPxVehicleEngineData_RecipMOI) + , RecipMaxOmega( "RecipMaxOmega", getPxVehicleEngineData_RecipMaxOmega) + , MMOI( "MMOI", setPxVehicleEngineDataMMOI, getPxVehicleEngineDataMMOI ) + , MPeakTorque( "MPeakTorque", setPxVehicleEngineDataMPeakTorque, getPxVehicleEngineDataMPeakTorque ) + , MMaxOmega( "MMaxOmega", setPxVehicleEngineDataMMaxOmega, getPxVehicleEngineDataMMaxOmega ) + , MDampingRateFullThrottle( "MDampingRateFullThrottle", setPxVehicleEngineDataMDampingRateFullThrottle, getPxVehicleEngineDataMDampingRateFullThrottle ) + , MDampingRateZeroThrottleClutchEngaged( "MDampingRateZeroThrottleClutchEngaged", setPxVehicleEngineDataMDampingRateZeroThrottleClutchEngaged, getPxVehicleEngineDataMDampingRateZeroThrottleClutchEngaged ) + , MDampingRateZeroThrottleClutchDisengaged( "MDampingRateZeroThrottleClutchDisengaged", setPxVehicleEngineDataMDampingRateZeroThrottleClutchDisengaged, getPxVehicleEngineDataMDampingRateZeroThrottleClutchDisengaged ) +{} + PxVehicleEngineDataGeneratedValues::PxVehicleEngineDataGeneratedValues( const PxVehicleEngineData* inSource ) + :RecipMOI( getPxVehicleEngineData_RecipMOI( inSource ) ) + ,RecipMaxOmega( getPxVehicleEngineData_RecipMaxOmega( inSource ) ) + ,MMOI( inSource->mMOI ) + ,MPeakTorque( inSource->mPeakTorque ) + ,MMaxOmega( inSource->mMaxOmega ) + ,MDampingRateFullThrottle( inSource->mDampingRateFullThrottle ) + ,MDampingRateZeroThrottleClutchEngaged( inSource->mDampingRateZeroThrottleClutchEngaged ) + ,MDampingRateZeroThrottleClutchDisengaged( inSource->mDampingRateZeroThrottleClutchDisengaged ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleGearsData_GearRatio( PxVehicleGearsData* inObj, PxVehicleGearsData::Enum inIndex, PxReal inArg ){ inObj->setGearRatio( inIndex, inArg ); } +PxReal getPxVehicleGearsData_GearRatio( const PxVehicleGearsData* inObj, PxVehicleGearsData::Enum inIndex ) { return inObj->getGearRatio( inIndex ); } +inline PxReal getPxVehicleGearsDataMFinalRatio( const PxVehicleGearsData* inOwner ) { return inOwner->mFinalRatio; } +inline void setPxVehicleGearsDataMFinalRatio( PxVehicleGearsData* inOwner, PxReal inData) { inOwner->mFinalRatio = inData; } +inline PxU32 getPxVehicleGearsDataMNbRatios( const PxVehicleGearsData* inOwner ) { return inOwner->mNbRatios; } +inline void setPxVehicleGearsDataMNbRatios( PxVehicleGearsData* inOwner, PxU32 inData) { inOwner->mNbRatios = inData; } +inline PxReal getPxVehicleGearsDataMSwitchTime( const PxVehicleGearsData* inOwner ) { return inOwner->mSwitchTime; } +inline void setPxVehicleGearsDataMSwitchTime( PxVehicleGearsData* inOwner, PxReal inData) { inOwner->mSwitchTime = inData; } + PxVehicleGearsDataGeneratedInfo::PxVehicleGearsDataGeneratedInfo() + : GearRatio( "GearRatio", setPxVehicleGearsData_GearRatio, getPxVehicleGearsData_GearRatio) + , MFinalRatio( "MFinalRatio", setPxVehicleGearsDataMFinalRatio, getPxVehicleGearsDataMFinalRatio ) + , MNbRatios( "MNbRatios", setPxVehicleGearsDataMNbRatios, getPxVehicleGearsDataMNbRatios ) + , MSwitchTime( "MSwitchTime", setPxVehicleGearsDataMSwitchTime, getPxVehicleGearsDataMSwitchTime ) +{} + PxVehicleGearsDataGeneratedValues::PxVehicleGearsDataGeneratedValues( const PxVehicleGearsData* inSource ) + :MFinalRatio( inSource->mFinalRatio ) + ,MNbRatios( inSource->mNbRatios ) + ,MSwitchTime( inSource->mSwitchTime ) +{ + PX_UNUSED(inSource); + for ( PxU32 idx = 0; idx < static_cast( physx::PxVehicleGearsData::eGEARSRATIO_COUNT ); ++idx ) + GearRatio[idx] = getPxVehicleGearsData_GearRatio( inSource, static_cast< PxVehicleGearsData::Enum >( idx ) ); +} +void setPxVehicleAutoBoxData_Latency( PxVehicleAutoBoxData* inObj, const PxReal inArg){ inObj->setLatency( inArg ); } +PxReal getPxVehicleAutoBoxData_Latency( const PxVehicleAutoBoxData* inObj ) { return inObj->getLatency(); } +void setPxVehicleAutoBoxData_UpRatios( PxVehicleAutoBoxData* inObj, PxVehicleGearsData::Enum inIndex, PxReal inArg ){ inObj->setUpRatios( inIndex, inArg ); } +PxReal getPxVehicleAutoBoxData_UpRatios( const PxVehicleAutoBoxData* inObj, PxVehicleGearsData::Enum inIndex ) { return inObj->getUpRatios( inIndex ); } +void setPxVehicleAutoBoxData_DownRatios( PxVehicleAutoBoxData* inObj, PxVehicleGearsData::Enum inIndex, PxReal inArg ){ inObj->setDownRatios( inIndex, inArg ); } +PxReal getPxVehicleAutoBoxData_DownRatios( const PxVehicleAutoBoxData* inObj, PxVehicleGearsData::Enum inIndex ) { return inObj->getDownRatios( inIndex ); } + PxVehicleAutoBoxDataGeneratedInfo::PxVehicleAutoBoxDataGeneratedInfo() + : Latency( "Latency", setPxVehicleAutoBoxData_Latency, getPxVehicleAutoBoxData_Latency) + , UpRatios( "UpRatios", setPxVehicleAutoBoxData_UpRatios, getPxVehicleAutoBoxData_UpRatios) + , DownRatios( "DownRatios", setPxVehicleAutoBoxData_DownRatios, getPxVehicleAutoBoxData_DownRatios) +{} + PxVehicleAutoBoxDataGeneratedValues::PxVehicleAutoBoxDataGeneratedValues( const PxVehicleAutoBoxData* inSource ) + :Latency( getPxVehicleAutoBoxData_Latency( inSource ) ) +{ + PX_UNUSED(inSource); + for ( PxU32 idx = 0; idx < static_cast( physx::PxVehicleGearsData::eGEARSRATIO_COUNT ); ++idx ) + UpRatios[idx] = getPxVehicleAutoBoxData_UpRatios( inSource, static_cast< PxVehicleGearsData::Enum >( idx ) ); + for ( PxU32 idx = 0; idx < static_cast( physx::PxVehicleGearsData::eGEARSRATIO_COUNT ); ++idx ) + DownRatios[idx] = getPxVehicleAutoBoxData_DownRatios( inSource, static_cast< PxVehicleGearsData::Enum >( idx ) ); +} +inline PxReal getPxVehicleDifferential4WDataMFrontRearSplit( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mFrontRearSplit; } +inline void setPxVehicleDifferential4WDataMFrontRearSplit( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mFrontRearSplit = inData; } +inline PxReal getPxVehicleDifferential4WDataMFrontLeftRightSplit( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mFrontLeftRightSplit; } +inline void setPxVehicleDifferential4WDataMFrontLeftRightSplit( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mFrontLeftRightSplit = inData; } +inline PxReal getPxVehicleDifferential4WDataMRearLeftRightSplit( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mRearLeftRightSplit; } +inline void setPxVehicleDifferential4WDataMRearLeftRightSplit( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mRearLeftRightSplit = inData; } +inline PxReal getPxVehicleDifferential4WDataMCentreBias( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mCentreBias; } +inline void setPxVehicleDifferential4WDataMCentreBias( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mCentreBias = inData; } +inline PxReal getPxVehicleDifferential4WDataMFrontBias( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mFrontBias; } +inline void setPxVehicleDifferential4WDataMFrontBias( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mFrontBias = inData; } +inline PxReal getPxVehicleDifferential4WDataMRearBias( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mRearBias; } +inline void setPxVehicleDifferential4WDataMRearBias( PxVehicleDifferential4WData* inOwner, PxReal inData) { inOwner->mRearBias = inData; } +inline PxVehicleDifferential4WData::Enum getPxVehicleDifferential4WDataMType( const PxVehicleDifferential4WData* inOwner ) { return inOwner->mType; } +inline void setPxVehicleDifferential4WDataMType( PxVehicleDifferential4WData* inOwner, PxVehicleDifferential4WData::Enum inData) { inOwner->mType = inData; } + PxVehicleDifferential4WDataGeneratedInfo::PxVehicleDifferential4WDataGeneratedInfo() + : MFrontRearSplit( "MFrontRearSplit", setPxVehicleDifferential4WDataMFrontRearSplit, getPxVehicleDifferential4WDataMFrontRearSplit ) + , MFrontLeftRightSplit( "MFrontLeftRightSplit", setPxVehicleDifferential4WDataMFrontLeftRightSplit, getPxVehicleDifferential4WDataMFrontLeftRightSplit ) + , MRearLeftRightSplit( "MRearLeftRightSplit", setPxVehicleDifferential4WDataMRearLeftRightSplit, getPxVehicleDifferential4WDataMRearLeftRightSplit ) + , MCentreBias( "MCentreBias", setPxVehicleDifferential4WDataMCentreBias, getPxVehicleDifferential4WDataMCentreBias ) + , MFrontBias( "MFrontBias", setPxVehicleDifferential4WDataMFrontBias, getPxVehicleDifferential4WDataMFrontBias ) + , MRearBias( "MRearBias", setPxVehicleDifferential4WDataMRearBias, getPxVehicleDifferential4WDataMRearBias ) + , MType( "MType", setPxVehicleDifferential4WDataMType, getPxVehicleDifferential4WDataMType ) +{} + PxVehicleDifferential4WDataGeneratedValues::PxVehicleDifferential4WDataGeneratedValues( const PxVehicleDifferential4WData* inSource ) + :MFrontRearSplit( inSource->mFrontRearSplit ) + ,MFrontLeftRightSplit( inSource->mFrontLeftRightSplit ) + ,MRearLeftRightSplit( inSource->mRearLeftRightSplit ) + ,MCentreBias( inSource->mCentreBias ) + ,MFrontBias( inSource->mFrontBias ) + ,MRearBias( inSource->mRearBias ) + ,MType( inSource->mType ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleDifferentialNWData_DrivenWheelStatus( PxVehicleDifferentialNWData* inObj, PxU32 inArg){ inObj->setDrivenWheelStatus( inArg ); } +PxU32 getPxVehicleDifferentialNWData_DrivenWheelStatus( const PxVehicleDifferentialNWData* inObj ) { return inObj->getDrivenWheelStatus(); } + PxVehicleDifferentialNWDataGeneratedInfo::PxVehicleDifferentialNWDataGeneratedInfo() + : DrivenWheelStatus( "DrivenWheelStatus", setPxVehicleDifferentialNWData_DrivenWheelStatus, getPxVehicleDifferentialNWData_DrivenWheelStatus) +{} + PxVehicleDifferentialNWDataGeneratedValues::PxVehicleDifferentialNWDataGeneratedValues( const PxVehicleDifferentialNWData* inSource ) + :DrivenWheelStatus( getPxVehicleDifferentialNWData_DrivenWheelStatus( inSource ) ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxVehicleAckermannGeometryDataMAccuracy( const PxVehicleAckermannGeometryData* inOwner ) { return inOwner->mAccuracy; } +inline void setPxVehicleAckermannGeometryDataMAccuracy( PxVehicleAckermannGeometryData* inOwner, PxReal inData) { inOwner->mAccuracy = inData; } +inline PxReal getPxVehicleAckermannGeometryDataMFrontWidth( const PxVehicleAckermannGeometryData* inOwner ) { return inOwner->mFrontWidth; } +inline void setPxVehicleAckermannGeometryDataMFrontWidth( PxVehicleAckermannGeometryData* inOwner, PxReal inData) { inOwner->mFrontWidth = inData; } +inline PxReal getPxVehicleAckermannGeometryDataMRearWidth( const PxVehicleAckermannGeometryData* inOwner ) { return inOwner->mRearWidth; } +inline void setPxVehicleAckermannGeometryDataMRearWidth( PxVehicleAckermannGeometryData* inOwner, PxReal inData) { inOwner->mRearWidth = inData; } +inline PxReal getPxVehicleAckermannGeometryDataMAxleSeparation( const PxVehicleAckermannGeometryData* inOwner ) { return inOwner->mAxleSeparation; } +inline void setPxVehicleAckermannGeometryDataMAxleSeparation( PxVehicleAckermannGeometryData* inOwner, PxReal inData) { inOwner->mAxleSeparation = inData; } + PxVehicleAckermannGeometryDataGeneratedInfo::PxVehicleAckermannGeometryDataGeneratedInfo() + : MAccuracy( "MAccuracy", setPxVehicleAckermannGeometryDataMAccuracy, getPxVehicleAckermannGeometryDataMAccuracy ) + , MFrontWidth( "MFrontWidth", setPxVehicleAckermannGeometryDataMFrontWidth, getPxVehicleAckermannGeometryDataMFrontWidth ) + , MRearWidth( "MRearWidth", setPxVehicleAckermannGeometryDataMRearWidth, getPxVehicleAckermannGeometryDataMRearWidth ) + , MAxleSeparation( "MAxleSeparation", setPxVehicleAckermannGeometryDataMAxleSeparation, getPxVehicleAckermannGeometryDataMAxleSeparation ) +{} + PxVehicleAckermannGeometryDataGeneratedValues::PxVehicleAckermannGeometryDataGeneratedValues( const PxVehicleAckermannGeometryData* inSource ) + :MAccuracy( inSource->mAccuracy ) + ,MFrontWidth( inSource->mFrontWidth ) + ,MRearWidth( inSource->mRearWidth ) + ,MAxleSeparation( inSource->mAxleSeparation ) +{ + PX_UNUSED(inSource); +} +inline PxReal getPxVehicleClutchDataMStrength( const PxVehicleClutchData* inOwner ) { return inOwner->mStrength; } +inline void setPxVehicleClutchDataMStrength( PxVehicleClutchData* inOwner, PxReal inData) { inOwner->mStrength = inData; } +inline PxVehicleClutchAccuracyMode::Enum getPxVehicleClutchDataMAccuracyMode( const PxVehicleClutchData* inOwner ) { return inOwner->mAccuracyMode; } +inline void setPxVehicleClutchDataMAccuracyMode( PxVehicleClutchData* inOwner, PxVehicleClutchAccuracyMode::Enum inData) { inOwner->mAccuracyMode = inData; } +inline PxU32 getPxVehicleClutchDataMEstimateIterations( const PxVehicleClutchData* inOwner ) { return inOwner->mEstimateIterations; } +inline void setPxVehicleClutchDataMEstimateIterations( PxVehicleClutchData* inOwner, PxU32 inData) { inOwner->mEstimateIterations = inData; } + PxVehicleClutchDataGeneratedInfo::PxVehicleClutchDataGeneratedInfo() + : MStrength( "MStrength", setPxVehicleClutchDataMStrength, getPxVehicleClutchDataMStrength ) + , MAccuracyMode( "MAccuracyMode", setPxVehicleClutchDataMAccuracyMode, getPxVehicleClutchDataMAccuracyMode ) + , MEstimateIterations( "MEstimateIterations", setPxVehicleClutchDataMEstimateIterations, getPxVehicleClutchDataMEstimateIterations ) +{} + PxVehicleClutchDataGeneratedValues::PxVehicleClutchDataGeneratedValues( const PxVehicleClutchData* inSource ) + :MStrength( inSource->mStrength ) + ,MAccuracyMode( inSource->mAccuracyMode ) + ,MEstimateIterations( inSource->mEstimateIterations ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleTireLoadFilterData_Denominator( const PxVehicleTireLoadFilterData* inObj ) { return inObj->getDenominator(); } +inline PxReal getPxVehicleTireLoadFilterDataMMinNormalisedLoad( const PxVehicleTireLoadFilterData* inOwner ) { return inOwner->mMinNormalisedLoad; } +inline void setPxVehicleTireLoadFilterDataMMinNormalisedLoad( PxVehicleTireLoadFilterData* inOwner, PxReal inData) { inOwner->mMinNormalisedLoad = inData; } +inline PxReal getPxVehicleTireLoadFilterDataMMinFilteredNormalisedLoad( const PxVehicleTireLoadFilterData* inOwner ) { return inOwner->mMinFilteredNormalisedLoad; } +inline void setPxVehicleTireLoadFilterDataMMinFilteredNormalisedLoad( PxVehicleTireLoadFilterData* inOwner, PxReal inData) { inOwner->mMinFilteredNormalisedLoad = inData; } +inline PxReal getPxVehicleTireLoadFilterDataMMaxNormalisedLoad( const PxVehicleTireLoadFilterData* inOwner ) { return inOwner->mMaxNormalisedLoad; } +inline void setPxVehicleTireLoadFilterDataMMaxNormalisedLoad( PxVehicleTireLoadFilterData* inOwner, PxReal inData) { inOwner->mMaxNormalisedLoad = inData; } +inline PxReal getPxVehicleTireLoadFilterDataMMaxFilteredNormalisedLoad( const PxVehicleTireLoadFilterData* inOwner ) { return inOwner->mMaxFilteredNormalisedLoad; } +inline void setPxVehicleTireLoadFilterDataMMaxFilteredNormalisedLoad( PxVehicleTireLoadFilterData* inOwner, PxReal inData) { inOwner->mMaxFilteredNormalisedLoad = inData; } + PxVehicleTireLoadFilterDataGeneratedInfo::PxVehicleTireLoadFilterDataGeneratedInfo() + : Denominator( "Denominator", getPxVehicleTireLoadFilterData_Denominator) + , MMinNormalisedLoad( "MMinNormalisedLoad", setPxVehicleTireLoadFilterDataMMinNormalisedLoad, getPxVehicleTireLoadFilterDataMMinNormalisedLoad ) + , MMinFilteredNormalisedLoad( "MMinFilteredNormalisedLoad", setPxVehicleTireLoadFilterDataMMinFilteredNormalisedLoad, getPxVehicleTireLoadFilterDataMMinFilteredNormalisedLoad ) + , MMaxNormalisedLoad( "MMaxNormalisedLoad", setPxVehicleTireLoadFilterDataMMaxNormalisedLoad, getPxVehicleTireLoadFilterDataMMaxNormalisedLoad ) + , MMaxFilteredNormalisedLoad( "MMaxFilteredNormalisedLoad", setPxVehicleTireLoadFilterDataMMaxFilteredNormalisedLoad, getPxVehicleTireLoadFilterDataMMaxFilteredNormalisedLoad ) +{} + PxVehicleTireLoadFilterDataGeneratedValues::PxVehicleTireLoadFilterDataGeneratedValues( const PxVehicleTireLoadFilterData* inSource ) + :Denominator( getPxVehicleTireLoadFilterData_Denominator( inSource ) ) + ,MMinNormalisedLoad( inSource->mMinNormalisedLoad ) + ,MMinFilteredNormalisedLoad( inSource->mMinFilteredNormalisedLoad ) + ,MMaxNormalisedLoad( inSource->mMaxNormalisedLoad ) + ,MMaxFilteredNormalisedLoad( inSource->mMaxFilteredNormalisedLoad ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleWheelData_RecipRadius( const PxVehicleWheelData* inObj ) { return inObj->getRecipRadius(); } +PxReal getPxVehicleWheelData_RecipMOI( const PxVehicleWheelData* inObj ) { return inObj->getRecipMOI(); } +inline PxReal getPxVehicleWheelDataMRadius( const PxVehicleWheelData* inOwner ) { return inOwner->mRadius; } +inline void setPxVehicleWheelDataMRadius( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mRadius = inData; } +inline PxReal getPxVehicleWheelDataMWidth( const PxVehicleWheelData* inOwner ) { return inOwner->mWidth; } +inline void setPxVehicleWheelDataMWidth( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mWidth = inData; } +inline PxReal getPxVehicleWheelDataMMass( const PxVehicleWheelData* inOwner ) { return inOwner->mMass; } +inline void setPxVehicleWheelDataMMass( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mMass = inData; } +inline PxReal getPxVehicleWheelDataMMOI( const PxVehicleWheelData* inOwner ) { return inOwner->mMOI; } +inline void setPxVehicleWheelDataMMOI( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mMOI = inData; } +inline PxReal getPxVehicleWheelDataMDampingRate( const PxVehicleWheelData* inOwner ) { return inOwner->mDampingRate; } +inline void setPxVehicleWheelDataMDampingRate( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mDampingRate = inData; } +inline PxReal getPxVehicleWheelDataMMaxBrakeTorque( const PxVehicleWheelData* inOwner ) { return inOwner->mMaxBrakeTorque; } +inline void setPxVehicleWheelDataMMaxBrakeTorque( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mMaxBrakeTorque = inData; } +inline PxReal getPxVehicleWheelDataMMaxHandBrakeTorque( const PxVehicleWheelData* inOwner ) { return inOwner->mMaxHandBrakeTorque; } +inline void setPxVehicleWheelDataMMaxHandBrakeTorque( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mMaxHandBrakeTorque = inData; } +inline PxReal getPxVehicleWheelDataMMaxSteer( const PxVehicleWheelData* inOwner ) { return inOwner->mMaxSteer; } +inline void setPxVehicleWheelDataMMaxSteer( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mMaxSteer = inData; } +inline PxReal getPxVehicleWheelDataMToeAngle( const PxVehicleWheelData* inOwner ) { return inOwner->mToeAngle; } +inline void setPxVehicleWheelDataMToeAngle( PxVehicleWheelData* inOwner, PxReal inData) { inOwner->mToeAngle = inData; } + PxVehicleWheelDataGeneratedInfo::PxVehicleWheelDataGeneratedInfo() + : RecipRadius( "RecipRadius", getPxVehicleWheelData_RecipRadius) + , RecipMOI( "RecipMOI", getPxVehicleWheelData_RecipMOI) + , MRadius( "MRadius", setPxVehicleWheelDataMRadius, getPxVehicleWheelDataMRadius ) + , MWidth( "MWidth", setPxVehicleWheelDataMWidth, getPxVehicleWheelDataMWidth ) + , MMass( "MMass", setPxVehicleWheelDataMMass, getPxVehicleWheelDataMMass ) + , MMOI( "MMOI", setPxVehicleWheelDataMMOI, getPxVehicleWheelDataMMOI ) + , MDampingRate( "MDampingRate", setPxVehicleWheelDataMDampingRate, getPxVehicleWheelDataMDampingRate ) + , MMaxBrakeTorque( "MMaxBrakeTorque", setPxVehicleWheelDataMMaxBrakeTorque, getPxVehicleWheelDataMMaxBrakeTorque ) + , MMaxHandBrakeTorque( "MMaxHandBrakeTorque", setPxVehicleWheelDataMMaxHandBrakeTorque, getPxVehicleWheelDataMMaxHandBrakeTorque ) + , MMaxSteer( "MMaxSteer", setPxVehicleWheelDataMMaxSteer, getPxVehicleWheelDataMMaxSteer ) + , MToeAngle( "MToeAngle", setPxVehicleWheelDataMToeAngle, getPxVehicleWheelDataMToeAngle ) +{} + PxVehicleWheelDataGeneratedValues::PxVehicleWheelDataGeneratedValues( const PxVehicleWheelData* inSource ) + :RecipRadius( getPxVehicleWheelData_RecipRadius( inSource ) ) + ,RecipMOI( getPxVehicleWheelData_RecipMOI( inSource ) ) + ,MRadius( inSource->mRadius ) + ,MWidth( inSource->mWidth ) + ,MMass( inSource->mMass ) + ,MMOI( inSource->mMOI ) + ,MDampingRate( inSource->mDampingRate ) + ,MMaxBrakeTorque( inSource->mMaxBrakeTorque ) + ,MMaxHandBrakeTorque( inSource->mMaxHandBrakeTorque ) + ,MMaxSteer( inSource->mMaxSteer ) + ,MToeAngle( inSource->mToeAngle ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleSuspensionData_RecipMaxCompression( const PxVehicleSuspensionData* inObj ) { return inObj->getRecipMaxCompression(); } +PxReal getPxVehicleSuspensionData_RecipMaxDroop( const PxVehicleSuspensionData* inObj ) { return inObj->getRecipMaxDroop(); } +void setPxVehicleSuspensionData_MassAndPreserveNaturalFrequency( PxVehicleSuspensionData* inObj, const PxReal inArg){ inObj->setMassAndPreserveNaturalFrequency( inArg ); } +inline PxReal getPxVehicleSuspensionDataMSpringStrength( const PxVehicleSuspensionData* inOwner ) { return inOwner->mSpringStrength; } +inline void setPxVehicleSuspensionDataMSpringStrength( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mSpringStrength = inData; } +inline PxReal getPxVehicleSuspensionDataMSpringDamperRate( const PxVehicleSuspensionData* inOwner ) { return inOwner->mSpringDamperRate; } +inline void setPxVehicleSuspensionDataMSpringDamperRate( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mSpringDamperRate = inData; } +inline PxReal getPxVehicleSuspensionDataMMaxCompression( const PxVehicleSuspensionData* inOwner ) { return inOwner->mMaxCompression; } +inline void setPxVehicleSuspensionDataMMaxCompression( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mMaxCompression = inData; } +inline PxReal getPxVehicleSuspensionDataMMaxDroop( const PxVehicleSuspensionData* inOwner ) { return inOwner->mMaxDroop; } +inline void setPxVehicleSuspensionDataMMaxDroop( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mMaxDroop = inData; } +inline PxReal getPxVehicleSuspensionDataMSprungMass( const PxVehicleSuspensionData* inOwner ) { return inOwner->mSprungMass; } +inline void setPxVehicleSuspensionDataMSprungMass( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mSprungMass = inData; } +inline PxReal getPxVehicleSuspensionDataMCamberAtRest( const PxVehicleSuspensionData* inOwner ) { return inOwner->mCamberAtRest; } +inline void setPxVehicleSuspensionDataMCamberAtRest( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mCamberAtRest = inData; } +inline PxReal getPxVehicleSuspensionDataMCamberAtMaxCompression( const PxVehicleSuspensionData* inOwner ) { return inOwner->mCamberAtMaxCompression; } +inline void setPxVehicleSuspensionDataMCamberAtMaxCompression( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mCamberAtMaxCompression = inData; } +inline PxReal getPxVehicleSuspensionDataMCamberAtMaxDroop( const PxVehicleSuspensionData* inOwner ) { return inOwner->mCamberAtMaxDroop; } +inline void setPxVehicleSuspensionDataMCamberAtMaxDroop( PxVehicleSuspensionData* inOwner, PxReal inData) { inOwner->mCamberAtMaxDroop = inData; } + PxVehicleSuspensionDataGeneratedInfo::PxVehicleSuspensionDataGeneratedInfo() + : RecipMaxCompression( "RecipMaxCompression", getPxVehicleSuspensionData_RecipMaxCompression) + , RecipMaxDroop( "RecipMaxDroop", getPxVehicleSuspensionData_RecipMaxDroop) + , MassAndPreserveNaturalFrequency( "MassAndPreserveNaturalFrequency", setPxVehicleSuspensionData_MassAndPreserveNaturalFrequency) + , MSpringStrength( "MSpringStrength", setPxVehicleSuspensionDataMSpringStrength, getPxVehicleSuspensionDataMSpringStrength ) + , MSpringDamperRate( "MSpringDamperRate", setPxVehicleSuspensionDataMSpringDamperRate, getPxVehicleSuspensionDataMSpringDamperRate ) + , MMaxCompression( "MMaxCompression", setPxVehicleSuspensionDataMMaxCompression, getPxVehicleSuspensionDataMMaxCompression ) + , MMaxDroop( "MMaxDroop", setPxVehicleSuspensionDataMMaxDroop, getPxVehicleSuspensionDataMMaxDroop ) + , MSprungMass( "MSprungMass", setPxVehicleSuspensionDataMSprungMass, getPxVehicleSuspensionDataMSprungMass ) + , MCamberAtRest( "MCamberAtRest", setPxVehicleSuspensionDataMCamberAtRest, getPxVehicleSuspensionDataMCamberAtRest ) + , MCamberAtMaxCompression( "MCamberAtMaxCompression", setPxVehicleSuspensionDataMCamberAtMaxCompression, getPxVehicleSuspensionDataMCamberAtMaxCompression ) + , MCamberAtMaxDroop( "MCamberAtMaxDroop", setPxVehicleSuspensionDataMCamberAtMaxDroop, getPxVehicleSuspensionDataMCamberAtMaxDroop ) +{} + PxVehicleSuspensionDataGeneratedValues::PxVehicleSuspensionDataGeneratedValues( const PxVehicleSuspensionData* inSource ) + :RecipMaxCompression( getPxVehicleSuspensionData_RecipMaxCompression( inSource ) ) + ,RecipMaxDroop( getPxVehicleSuspensionData_RecipMaxDroop( inSource ) ) + ,MSpringStrength( inSource->mSpringStrength ) + ,MSpringDamperRate( inSource->mSpringDamperRate ) + ,MMaxCompression( inSource->mMaxCompression ) + ,MMaxDroop( inSource->mMaxDroop ) + ,MSprungMass( inSource->mSprungMass ) + ,MCamberAtRest( inSource->mCamberAtRest ) + ,MCamberAtMaxCompression( inSource->mCamberAtMaxCompression ) + ,MCamberAtMaxDroop( inSource->mCamberAtMaxDroop ) +{ + PX_UNUSED(inSource); +} +inline PxU32 getPxVehicleAntiRollBarDataMWheel0( const PxVehicleAntiRollBarData* inOwner ) { return inOwner->mWheel0; } +inline void setPxVehicleAntiRollBarDataMWheel0( PxVehicleAntiRollBarData* inOwner, PxU32 inData) { inOwner->mWheel0 = inData; } +inline PxU32 getPxVehicleAntiRollBarDataMWheel1( const PxVehicleAntiRollBarData* inOwner ) { return inOwner->mWheel1; } +inline void setPxVehicleAntiRollBarDataMWheel1( PxVehicleAntiRollBarData* inOwner, PxU32 inData) { inOwner->mWheel1 = inData; } +inline PxF32 getPxVehicleAntiRollBarDataMStiffness( const PxVehicleAntiRollBarData* inOwner ) { return inOwner->mStiffness; } +inline void setPxVehicleAntiRollBarDataMStiffness( PxVehicleAntiRollBarData* inOwner, PxF32 inData) { inOwner->mStiffness = inData; } + PxVehicleAntiRollBarDataGeneratedInfo::PxVehicleAntiRollBarDataGeneratedInfo() + : MWheel0( "MWheel0", setPxVehicleAntiRollBarDataMWheel0, getPxVehicleAntiRollBarDataMWheel0 ) + , MWheel1( "MWheel1", setPxVehicleAntiRollBarDataMWheel1, getPxVehicleAntiRollBarDataMWheel1 ) + , MStiffness( "MStiffness", setPxVehicleAntiRollBarDataMStiffness, getPxVehicleAntiRollBarDataMStiffness ) +{} + PxVehicleAntiRollBarDataGeneratedValues::PxVehicleAntiRollBarDataGeneratedValues( const PxVehicleAntiRollBarData* inSource ) + :MWheel0( inSource->mWheel0 ) + ,MWheel1( inSource->mWheel1 ) + ,MStiffness( inSource->mStiffness ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleTireData_RecipLongitudinalStiffnessPerUnitGravity( const PxVehicleTireData* inObj ) { return inObj->getRecipLongitudinalStiffnessPerUnitGravity(); } +PxReal getPxVehicleTireData_FrictionVsSlipGraphRecipx1Minusx0( const PxVehicleTireData* inObj ) { return inObj->getFrictionVsSlipGraphRecipx1Minusx0(); } +PxReal getPxVehicleTireData_FrictionVsSlipGraphRecipx2Minusx1( const PxVehicleTireData* inObj ) { return inObj->getFrictionVsSlipGraphRecipx2Minusx1(); } +inline PxReal getPxVehicleTireDataMLatStiffX( const PxVehicleTireData* inOwner ) { return inOwner->mLatStiffX; } +inline void setPxVehicleTireDataMLatStiffX( PxVehicleTireData* inOwner, PxReal inData) { inOwner->mLatStiffX = inData; } +inline PxReal getPxVehicleTireDataMLatStiffY( const PxVehicleTireData* inOwner ) { return inOwner->mLatStiffY; } +inline void setPxVehicleTireDataMLatStiffY( PxVehicleTireData* inOwner, PxReal inData) { inOwner->mLatStiffY = inData; } +inline PxReal getPxVehicleTireDataMLongitudinalStiffnessPerUnitGravity( const PxVehicleTireData* inOwner ) { return inOwner->mLongitudinalStiffnessPerUnitGravity; } +inline void setPxVehicleTireDataMLongitudinalStiffnessPerUnitGravity( PxVehicleTireData* inOwner, PxReal inData) { inOwner->mLongitudinalStiffnessPerUnitGravity = inData; } +inline PxReal getPxVehicleTireDataMCamberStiffnessPerUnitGravity( const PxVehicleTireData* inOwner ) { return inOwner->mCamberStiffnessPerUnitGravity; } +inline void setPxVehicleTireDataMCamberStiffnessPerUnitGravity( PxVehicleTireData* inOwner, PxReal inData) { inOwner->mCamberStiffnessPerUnitGravity = inData; } +inline PxU32 getPxVehicleTireDataMType( const PxVehicleTireData* inOwner ) { return inOwner->mType; } +inline void setPxVehicleTireDataMType( PxVehicleTireData* inOwner, PxU32 inData) { inOwner->mType = inData; } + PxVehicleTireDataGeneratedInfo::PxVehicleTireDataGeneratedInfo() + : RecipLongitudinalStiffnessPerUnitGravity( "RecipLongitudinalStiffnessPerUnitGravity", getPxVehicleTireData_RecipLongitudinalStiffnessPerUnitGravity) + , FrictionVsSlipGraphRecipx1Minusx0( "FrictionVsSlipGraphRecipx1Minusx0", getPxVehicleTireData_FrictionVsSlipGraphRecipx1Minusx0) + , FrictionVsSlipGraphRecipx2Minusx1( "FrictionVsSlipGraphRecipx2Minusx1", getPxVehicleTireData_FrictionVsSlipGraphRecipx2Minusx1) + , MLatStiffX( "MLatStiffX", setPxVehicleTireDataMLatStiffX, getPxVehicleTireDataMLatStiffX ) + , MLatStiffY( "MLatStiffY", setPxVehicleTireDataMLatStiffY, getPxVehicleTireDataMLatStiffY ) + , MLongitudinalStiffnessPerUnitGravity( "MLongitudinalStiffnessPerUnitGravity", setPxVehicleTireDataMLongitudinalStiffnessPerUnitGravity, getPxVehicleTireDataMLongitudinalStiffnessPerUnitGravity ) + , MCamberStiffnessPerUnitGravity( "MCamberStiffnessPerUnitGravity", setPxVehicleTireDataMCamberStiffnessPerUnitGravity, getPxVehicleTireDataMCamberStiffnessPerUnitGravity ) + , MType( "MType", setPxVehicleTireDataMType, getPxVehicleTireDataMType ) +{} + PxVehicleTireDataGeneratedValues::PxVehicleTireDataGeneratedValues( const PxVehicleTireData* inSource ) + :RecipLongitudinalStiffnessPerUnitGravity( getPxVehicleTireData_RecipLongitudinalStiffnessPerUnitGravity( inSource ) ) + ,FrictionVsSlipGraphRecipx1Minusx0( getPxVehicleTireData_FrictionVsSlipGraphRecipx1Minusx0( inSource ) ) + ,FrictionVsSlipGraphRecipx2Minusx1( getPxVehicleTireData_FrictionVsSlipGraphRecipx2Minusx1( inSource ) ) + ,MLatStiffX( inSource->mLatStiffX ) + ,MLatStiffY( inSource->mLatStiffY ) + ,MLongitudinalStiffnessPerUnitGravity( inSource->mLongitudinalStiffnessPerUnitGravity ) + ,MCamberStiffnessPerUnitGravity( inSource->mCamberStiffnessPerUnitGravity ) + ,MType( inSource->mType ) +{ + PX_UNUSED(inSource); + PxMemCopy( MFrictionVsSlipGraph, inSource->mFrictionVsSlipGraph, sizeof( MFrictionVsSlipGraph ) ); +} +const PxReal * getPxVehicleWheels4SimData_TireRestLoadsArray( const PxVehicleWheels4SimData* inObj ) { return inObj->getTireRestLoadsArray(); } +const PxReal * getPxVehicleWheels4SimData_RecipTireRestLoadsArray( const PxVehicleWheels4SimData* inObj ) { return inObj->getRecipTireRestLoadsArray(); } + PxVehicleWheels4SimDataGeneratedInfo::PxVehicleWheels4SimDataGeneratedInfo() + : TireRestLoadsArray( "TireRestLoadsArray", getPxVehicleWheels4SimData_TireRestLoadsArray) + , RecipTireRestLoadsArray( "RecipTireRestLoadsArray", getPxVehicleWheels4SimData_RecipTireRestLoadsArray) +{} + PxVehicleWheels4SimDataGeneratedValues::PxVehicleWheels4SimDataGeneratedValues( const PxVehicleWheels4SimData* inSource ) + :TireRestLoadsArray( getPxVehicleWheels4SimData_TireRestLoadsArray( inSource ) ) + ,RecipTireRestLoadsArray( getPxVehicleWheels4SimData_RecipTireRestLoadsArray( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleWheelsSimData_ChassisMass( PxVehicleWheelsSimData* inObj, const PxF32 inArg){ inObj->setChassisMass( inArg ); } +PxVehicleSuspensionData getPxVehicleWheelsSimData_SuspensionData( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getSuspensionData( index ); } +PxU32 getNbPxVehicleWheelsSimData_SuspensionData( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbSuspensionData( ); } +void setPxVehicleWheelsSimData_SuspensionData( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVehicleSuspensionData inValue ){ inObj->setSuspensionData( inIndex, inValue ); } +PxVehicleWheelData getPxVehicleWheelsSimData_WheelData( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getWheelData( index ); } +PxU32 getNbPxVehicleWheelsSimData_WheelData( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbWheelData( ); } +void setPxVehicleWheelsSimData_WheelData( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVehicleWheelData inValue ){ inObj->setWheelData( inIndex, inValue ); } +PxVehicleTireData getPxVehicleWheelsSimData_TireData( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getTireData( index ); } +PxU32 getNbPxVehicleWheelsSimData_TireData( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbTireData( ); } +void setPxVehicleWheelsSimData_TireData( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVehicleTireData inValue ){ inObj->setTireData( inIndex, inValue ); } +PxVec3 getPxVehicleWheelsSimData_SuspTravelDirection( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getSuspTravelDirection( index ); } +PxU32 getNbPxVehicleWheelsSimData_SuspTravelDirection( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbSuspTravelDirection( ); } +void setPxVehicleWheelsSimData_SuspTravelDirection( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVec3 inValue ){ inObj->setSuspTravelDirection( inIndex, inValue ); } +PxVec3 getPxVehicleWheelsSimData_SuspForceAppPointOffset( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getSuspForceAppPointOffset( index ); } +PxU32 getNbPxVehicleWheelsSimData_SuspForceAppPointOffset( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbSuspForceAppPointOffset( ); } +void setPxVehicleWheelsSimData_SuspForceAppPointOffset( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVec3 inValue ){ inObj->setSuspForceAppPointOffset( inIndex, inValue ); } +PxVec3 getPxVehicleWheelsSimData_TireForceAppPointOffset( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getTireForceAppPointOffset( index ); } +PxU32 getNbPxVehicleWheelsSimData_TireForceAppPointOffset( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbTireForceAppPointOffset( ); } +void setPxVehicleWheelsSimData_TireForceAppPointOffset( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVec3 inValue ){ inObj->setTireForceAppPointOffset( inIndex, inValue ); } +PxVec3 getPxVehicleWheelsSimData_WheelCentreOffset( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getWheelCentreOffset( index ); } +PxU32 getNbPxVehicleWheelsSimData_WheelCentreOffset( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbWheelCentreOffset( ); } +void setPxVehicleWheelsSimData_WheelCentreOffset( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVec3 inValue ){ inObj->setWheelCentreOffset( inIndex, inValue ); } +PxI32 getPxVehicleWheelsSimData_WheelShapeMapping( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getWheelShapeMapping( index ); } +PxU32 getNbPxVehicleWheelsSimData_WheelShapeMapping( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbWheelShapeMapping( ); } +void setPxVehicleWheelsSimData_WheelShapeMapping( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxI32 inValue ){ inObj->setWheelShapeMapping( inIndex, inValue ); } +PxFilterData getPxVehicleWheelsSimData_SceneQueryFilterData( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getSceneQueryFilterData( index ); } +PxU32 getNbPxVehicleWheelsSimData_SceneQueryFilterData( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbSceneQueryFilterData( ); } +void setPxVehicleWheelsSimData_SceneQueryFilterData( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxFilterData inValue ){ inObj->setSceneQueryFilterData( inIndex, inValue ); } +PxVehicleAntiRollBarData getPxVehicleWheelsSimData_AntiRollBarData( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getAntiRollBarData( index ); } +PxU32 getNbPxVehicleWheelsSimData_AntiRollBarData( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbAntiRollBarData( ); } +void setPxVehicleWheelsSimData_AntiRollBarData( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, PxVehicleAntiRollBarData inValue ){ inObj->setAntiRollBarData( inIndex, inValue ); } +void setPxVehicleWheelsSimData_TireLoadFilterData( PxVehicleWheelsSimData* inObj, const PxVehicleTireLoadFilterData & inArg){ inObj->setTireLoadFilterData( inArg ); } +PxVehicleTireLoadFilterData getPxVehicleWheelsSimData_TireLoadFilterData( const PxVehicleWheelsSimData* inObj ) { return inObj->getTireLoadFilterData(); } +void setPxVehicleWheelsSimData_MinLongSlipDenominator( PxVehicleWheelsSimData* inObj, const PxReal inArg){ inObj->setMinLongSlipDenominator( inArg ); } +PxF32 getPxVehicleWheelsSimData_MinLongSlipDenominator( const PxVehicleWheelsSimData* inObj ) { return inObj->getMinLongSlipDenominator(); } +void setPxVehicleWheelsSimData_Flags( PxVehicleWheelsSimData* inObj, PxVehicleWheelsSimFlags inArg){ inObj->setFlags( inArg ); } +PxVehicleWheelsSimFlags getPxVehicleWheelsSimData_Flags( const PxVehicleWheelsSimData* inObj ) { return inObj->getFlags(); } +void setPxVehicleWheelsSimData_ThresholdLongSpeed( PxVehicleWheelsSimData* inObj, const PxF32 inArg){ inObj->setThresholdLongSpeed( inArg ); } +PxF32 getPxVehicleWheelsSimData_ThresholdLongSpeed( const PxVehicleWheelsSimData* inObj ) { return inObj->getThresholdLongSpeed(); } +void setPxVehicleWheelsSimData_LowForwardSpeedSubStepCount( PxVehicleWheelsSimData* inObj, const PxU32 inArg){ inObj->setLowForwardSpeedSubStepCount( inArg ); } +PxU32 getPxVehicleWheelsSimData_LowForwardSpeedSubStepCount( const PxVehicleWheelsSimData* inObj ) { return inObj->getLowForwardSpeedSubStepCount(); } +void setPxVehicleWheelsSimData_HighForwardSpeedSubStepCount( PxVehicleWheelsSimData* inObj, const PxU32 inArg){ inObj->setHighForwardSpeedSubStepCount( inArg ); } +PxU32 getPxVehicleWheelsSimData_HighForwardSpeedSubStepCount( const PxVehicleWheelsSimData* inObj ) { return inObj->getHighForwardSpeedSubStepCount(); } +_Bool getPxVehicleWheelsSimData_WheelEnabledState( const PxVehicleWheelsSimData* inObj, const PxU32 index ) { return inObj->getWheelEnabledState( index ); } +PxU32 getNbPxVehicleWheelsSimData_WheelEnabledState( const PxVehicleWheelsSimData* inObj ) { return inObj->getNbWheelEnabledState( ); } +void setPxVehicleWheelsSimData_WheelEnabledState( PxVehicleWheelsSimData* inObj, const PxU32 inIndex, _Bool inValue ){ inObj->setWheelEnabledState( inIndex, inValue ); } + PxVehicleWheelsSimDataGeneratedInfo::PxVehicleWheelsSimDataGeneratedInfo() + : ChassisMass( "ChassisMass", setPxVehicleWheelsSimData_ChassisMass) + , SuspensionData( "SuspensionData", getPxVehicleWheelsSimData_SuspensionData, getNbPxVehicleWheelsSimData_SuspensionData, setPxVehicleWheelsSimData_SuspensionData ) + , WheelData( "WheelData", getPxVehicleWheelsSimData_WheelData, getNbPxVehicleWheelsSimData_WheelData, setPxVehicleWheelsSimData_WheelData ) + , TireData( "TireData", getPxVehicleWheelsSimData_TireData, getNbPxVehicleWheelsSimData_TireData, setPxVehicleWheelsSimData_TireData ) + , SuspTravelDirection( "SuspTravelDirection", getPxVehicleWheelsSimData_SuspTravelDirection, getNbPxVehicleWheelsSimData_SuspTravelDirection, setPxVehicleWheelsSimData_SuspTravelDirection ) + , SuspForceAppPointOffset( "SuspForceAppPointOffset", getPxVehicleWheelsSimData_SuspForceAppPointOffset, getNbPxVehicleWheelsSimData_SuspForceAppPointOffset, setPxVehicleWheelsSimData_SuspForceAppPointOffset ) + , TireForceAppPointOffset( "TireForceAppPointOffset", getPxVehicleWheelsSimData_TireForceAppPointOffset, getNbPxVehicleWheelsSimData_TireForceAppPointOffset, setPxVehicleWheelsSimData_TireForceAppPointOffset ) + , WheelCentreOffset( "WheelCentreOffset", getPxVehicleWheelsSimData_WheelCentreOffset, getNbPxVehicleWheelsSimData_WheelCentreOffset, setPxVehicleWheelsSimData_WheelCentreOffset ) + , WheelShapeMapping( "WheelShapeMapping", getPxVehicleWheelsSimData_WheelShapeMapping, getNbPxVehicleWheelsSimData_WheelShapeMapping, setPxVehicleWheelsSimData_WheelShapeMapping ) + , SceneQueryFilterData( "SceneQueryFilterData", getPxVehicleWheelsSimData_SceneQueryFilterData, getNbPxVehicleWheelsSimData_SceneQueryFilterData, setPxVehicleWheelsSimData_SceneQueryFilterData ) + , AntiRollBarData( "AntiRollBarData", getPxVehicleWheelsSimData_AntiRollBarData, getNbPxVehicleWheelsSimData_AntiRollBarData, setPxVehicleWheelsSimData_AntiRollBarData ) + , TireLoadFilterData( "TireLoadFilterData", setPxVehicleWheelsSimData_TireLoadFilterData, getPxVehicleWheelsSimData_TireLoadFilterData) + , MinLongSlipDenominator( "MinLongSlipDenominator", setPxVehicleWheelsSimData_MinLongSlipDenominator, getPxVehicleWheelsSimData_MinLongSlipDenominator) + , Flags( "Flags", setPxVehicleWheelsSimData_Flags, getPxVehicleWheelsSimData_Flags) + , ThresholdLongSpeed( "ThresholdLongSpeed", setPxVehicleWheelsSimData_ThresholdLongSpeed, getPxVehicleWheelsSimData_ThresholdLongSpeed) + , LowForwardSpeedSubStepCount( "LowForwardSpeedSubStepCount", setPxVehicleWheelsSimData_LowForwardSpeedSubStepCount, getPxVehicleWheelsSimData_LowForwardSpeedSubStepCount) + , HighForwardSpeedSubStepCount( "HighForwardSpeedSubStepCount", setPxVehicleWheelsSimData_HighForwardSpeedSubStepCount, getPxVehicleWheelsSimData_HighForwardSpeedSubStepCount) + , WheelEnabledState( "WheelEnabledState", getPxVehicleWheelsSimData_WheelEnabledState, getNbPxVehicleWheelsSimData_WheelEnabledState, setPxVehicleWheelsSimData_WheelEnabledState ) +{} + PxVehicleWheelsSimDataGeneratedValues::PxVehicleWheelsSimDataGeneratedValues( const PxVehicleWheelsSimData* inSource ) + :TireLoadFilterData( getPxVehicleWheelsSimData_TireLoadFilterData( inSource ) ) + ,MinLongSlipDenominator( getPxVehicleWheelsSimData_MinLongSlipDenominator( inSource ) ) + ,Flags( getPxVehicleWheelsSimData_Flags( inSource ) ) + ,ThresholdLongSpeed( getPxVehicleWheelsSimData_ThresholdLongSpeed( inSource ) ) + ,LowForwardSpeedSubStepCount( getPxVehicleWheelsSimData_LowForwardSpeedSubStepCount( inSource ) ) + ,HighForwardSpeedSubStepCount( getPxVehicleWheelsSimData_HighForwardSpeedSubStepCount( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleWheelsDynData_TireForceShaderFunction( PxVehicleWheelsDynData* inObj, PxVehicleComputeTireForce inArg){ inObj->setTireForceShaderFunction( inArg ); } +PxReal getPxVehicleWheelsDynData_WheelRotationSpeed( const PxVehicleWheelsDynData* inObj, const PxU32 index ) { return inObj->getWheelRotationSpeed( index ); } +PxU32 getNbPxVehicleWheelsDynData_WheelRotationSpeed( const PxVehicleWheelsDynData* inObj ) { return inObj->getNbWheelRotationSpeed( ); } +void setPxVehicleWheelsDynData_WheelRotationSpeed( PxVehicleWheelsDynData* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setWheelRotationSpeed( inIndex, inValue ); } +PxReal getPxVehicleWheelsDynData_WheelRotationAngle( const PxVehicleWheelsDynData* inObj, const PxU32 index ) { return inObj->getWheelRotationAngle( index ); } +PxU32 getNbPxVehicleWheelsDynData_WheelRotationAngle( const PxVehicleWheelsDynData* inObj ) { return inObj->getNbWheelRotationAngle( ); } +void setPxVehicleWheelsDynData_WheelRotationAngle( PxVehicleWheelsDynData* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setWheelRotationAngle( inIndex, inValue ); } +PxVehicleWheels4DynData * getPxVehicleWheelsDynData_Wheel4DynData( const PxVehicleWheelsDynData* inObj ) { return inObj->getWheel4DynData(); } +PxU32 getPxVehicleWheelsDynData_Constraints( const PxVehicleWheelsDynData* inObj, PxConstraint ** outBuffer, PxU32 inBufSize ) { return inObj->getConstraints( outBuffer, inBufSize ); } +PxU32 getNbPxVehicleWheelsDynData_Constraints( const PxVehicleWheelsDynData* inObj ) { return inObj->getNbConstraints( ); } + PxVehicleWheelsDynDataGeneratedInfo::PxVehicleWheelsDynDataGeneratedInfo() + : TireForceShaderFunction( "TireForceShaderFunction", setPxVehicleWheelsDynData_TireForceShaderFunction) + , WheelRotationSpeed( "WheelRotationSpeed", getPxVehicleWheelsDynData_WheelRotationSpeed, getNbPxVehicleWheelsDynData_WheelRotationSpeed, setPxVehicleWheelsDynData_WheelRotationSpeed ) + , WheelRotationAngle( "WheelRotationAngle", getPxVehicleWheelsDynData_WheelRotationAngle, getNbPxVehicleWheelsDynData_WheelRotationAngle, setPxVehicleWheelsDynData_WheelRotationAngle ) + , Wheel4DynData( "Wheel4DynData", getPxVehicleWheelsDynData_Wheel4DynData) + , Constraints( "Constraints", getPxVehicleWheelsDynData_Constraints, getNbPxVehicleWheelsDynData_Constraints ) +{} + PxVehicleWheelsDynDataGeneratedValues::PxVehicleWheelsDynDataGeneratedValues( const PxVehicleWheelsDynData* inSource ) + :Wheel4DynData( getPxVehicleWheelsDynData_Wheel4DynData( inSource ) ) +{ + PX_UNUSED(inSource); +} +PxU32 getPxVehicleWheels_VehicleType( const PxVehicleWheels* inObj ) { return inObj->getVehicleType(); } +const PxRigidDynamic * getPxVehicleWheels_RigidDynamicActor( const PxVehicleWheels* inObj ) { return inObj->getRigidDynamicActor(); } +const char * getPxVehicleWheels_ConcreteTypeName( const PxVehicleWheels* inObj ) { return inObj->getConcreteTypeName(); } +inline PxVehicleWheelsSimData getPxVehicleWheelsMWheelsSimData( const PxVehicleWheels* inOwner ) { return inOwner->mWheelsSimData; } +inline void setPxVehicleWheelsMWheelsSimData( PxVehicleWheels* inOwner, PxVehicleWheelsSimData inData) { inOwner->mWheelsSimData = inData; } +inline PxVehicleWheelsDynData getPxVehicleWheelsMWheelsDynData( const PxVehicleWheels* inOwner ) { return inOwner->mWheelsDynData; } +inline void setPxVehicleWheelsMWheelsDynData( PxVehicleWheels* inOwner, PxVehicleWheelsDynData inData) { inOwner->mWheelsDynData = inData; } + PxVehicleWheelsGeneratedInfo::PxVehicleWheelsGeneratedInfo() + : VehicleType( "VehicleType", getPxVehicleWheels_VehicleType) + , RigidDynamicActor( "RigidDynamicActor", getPxVehicleWheels_RigidDynamicActor) + , ConcreteTypeName( "ConcreteTypeName", getPxVehicleWheels_ConcreteTypeName) + , MWheelsSimData( "MWheelsSimData", setPxVehicleWheelsMWheelsSimData, getPxVehicleWheelsMWheelsSimData ) + , MWheelsDynData( "MWheelsDynData", setPxVehicleWheelsMWheelsDynData, getPxVehicleWheelsMWheelsDynData ) +{} + PxVehicleWheelsGeneratedValues::PxVehicleWheelsGeneratedValues( const PxVehicleWheels* inSource ) + :VehicleType( getPxVehicleWheels_VehicleType( inSource ) ) + ,RigidDynamicActor( getPxVehicleWheels_RigidDynamicActor( inSource ) ) + ,ConcreteTypeName( getPxVehicleWheels_ConcreteTypeName( inSource ) ) + ,MWheelsSimData( inSource->mWheelsSimData ) + ,MWheelsDynData( inSource->mWheelsDynData ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleDriveDynData_AnalogInput( const PxVehicleDriveDynData* inObj, const PxU32 index ) { return inObj->getAnalogInput( index ); } +PxU32 getNbPxVehicleDriveDynData_AnalogInput( const PxVehicleDriveDynData* inObj ) { return inObj->getNbAnalogInput( ); } +void setPxVehicleDriveDynData_AnalogInput( PxVehicleDriveDynData* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setAnalogInput( inIndex, inValue ); } +void setPxVehicleDriveDynData_GearUp( PxVehicleDriveDynData* inObj, const _Bool inArg){ inObj->setGearUp( inArg ); } +_Bool getPxVehicleDriveDynData_GearUp( const PxVehicleDriveDynData* inObj ) { return inObj->getGearUp(); } +void setPxVehicleDriveDynData_GearDown( PxVehicleDriveDynData* inObj, const _Bool inArg){ inObj->setGearDown( inArg ); } +_Bool getPxVehicleDriveDynData_GearDown( const PxVehicleDriveDynData* inObj ) { return inObj->getGearDown(); } +void setPxVehicleDriveDynData_UseAutoGears( PxVehicleDriveDynData* inObj, const _Bool inArg){ inObj->setUseAutoGears( inArg ); } +_Bool getPxVehicleDriveDynData_UseAutoGears( const PxVehicleDriveDynData* inObj ) { return inObj->getUseAutoGears(); } +void setPxVehicleDriveDynData_CurrentGear( PxVehicleDriveDynData* inObj, PxU32 inArg){ inObj->setCurrentGear( inArg ); } +PxU32 getPxVehicleDriveDynData_CurrentGear( const PxVehicleDriveDynData* inObj ) { return inObj->getCurrentGear(); } +void setPxVehicleDriveDynData_TargetGear( PxVehicleDriveDynData* inObj, PxU32 inArg){ inObj->setTargetGear( inArg ); } +PxU32 getPxVehicleDriveDynData_TargetGear( const PxVehicleDriveDynData* inObj ) { return inObj->getTargetGear(); } +void setPxVehicleDriveDynData_EngineRotationSpeed( PxVehicleDriveDynData* inObj, const PxF32 inArg){ inObj->setEngineRotationSpeed( inArg ); } +PxReal getPxVehicleDriveDynData_EngineRotationSpeed( const PxVehicleDriveDynData* inObj ) { return inObj->getEngineRotationSpeed(); } +void setPxVehicleDriveDynData_GearChange( PxVehicleDriveDynData* inObj, const PxU32 inArg){ inObj->setGearChange( inArg ); } +PxU32 getPxVehicleDriveDynData_GearChange( const PxVehicleDriveDynData* inObj ) { return inObj->getGearChange(); } +void setPxVehicleDriveDynData_GearSwitchTime( PxVehicleDriveDynData* inObj, const PxReal inArg){ inObj->setGearSwitchTime( inArg ); } +PxReal getPxVehicleDriveDynData_GearSwitchTime( const PxVehicleDriveDynData* inObj ) { return inObj->getGearSwitchTime(); } +void setPxVehicleDriveDynData_AutoBoxSwitchTime( PxVehicleDriveDynData* inObj, const PxReal inArg){ inObj->setAutoBoxSwitchTime( inArg ); } +PxReal getPxVehicleDriveDynData_AutoBoxSwitchTime( const PxVehicleDriveDynData* inObj ) { return inObj->getAutoBoxSwitchTime(); } +inline _Bool getPxVehicleDriveDynDataMUseAutoGears( const PxVehicleDriveDynData* inOwner ) { return inOwner->mUseAutoGears; } +inline void setPxVehicleDriveDynDataMUseAutoGears( PxVehicleDriveDynData* inOwner, _Bool inData) { inOwner->mUseAutoGears = inData; } +inline _Bool getPxVehicleDriveDynDataMGearUpPressed( const PxVehicleDriveDynData* inOwner ) { return inOwner->mGearUpPressed; } +inline void setPxVehicleDriveDynDataMGearUpPressed( PxVehicleDriveDynData* inOwner, _Bool inData) { inOwner->mGearUpPressed = inData; } +inline _Bool getPxVehicleDriveDynDataMGearDownPressed( const PxVehicleDriveDynData* inOwner ) { return inOwner->mGearDownPressed; } +inline void setPxVehicleDriveDynDataMGearDownPressed( PxVehicleDriveDynData* inOwner, _Bool inData) { inOwner->mGearDownPressed = inData; } +inline PxU32 getPxVehicleDriveDynDataMCurrentGear( const PxVehicleDriveDynData* inOwner ) { return inOwner->mCurrentGear; } +inline void setPxVehicleDriveDynDataMCurrentGear( PxVehicleDriveDynData* inOwner, PxU32 inData) { inOwner->mCurrentGear = inData; } +inline PxU32 getPxVehicleDriveDynDataMTargetGear( const PxVehicleDriveDynData* inOwner ) { return inOwner->mTargetGear; } +inline void setPxVehicleDriveDynDataMTargetGear( PxVehicleDriveDynData* inOwner, PxU32 inData) { inOwner->mTargetGear = inData; } +inline PxReal getPxVehicleDriveDynDataMEnginespeed( const PxVehicleDriveDynData* inOwner ) { return inOwner->mEnginespeed; } +inline void setPxVehicleDriveDynDataMEnginespeed( PxVehicleDriveDynData* inOwner, PxReal inData) { inOwner->mEnginespeed = inData; } +inline PxReal getPxVehicleDriveDynDataMGearSwitchTime( const PxVehicleDriveDynData* inOwner ) { return inOwner->mGearSwitchTime; } +inline void setPxVehicleDriveDynDataMGearSwitchTime( PxVehicleDriveDynData* inOwner, PxReal inData) { inOwner->mGearSwitchTime = inData; } +inline PxReal getPxVehicleDriveDynDataMAutoBoxSwitchTime( const PxVehicleDriveDynData* inOwner ) { return inOwner->mAutoBoxSwitchTime; } +inline void setPxVehicleDriveDynDataMAutoBoxSwitchTime( PxVehicleDriveDynData* inOwner, PxReal inData) { inOwner->mAutoBoxSwitchTime = inData; } + PxVehicleDriveDynDataGeneratedInfo::PxVehicleDriveDynDataGeneratedInfo() + : AnalogInput( "AnalogInput", getPxVehicleDriveDynData_AnalogInput, getNbPxVehicleDriveDynData_AnalogInput, setPxVehicleDriveDynData_AnalogInput ) + , GearUp( "GearUp", setPxVehicleDriveDynData_GearUp, getPxVehicleDriveDynData_GearUp) + , GearDown( "GearDown", setPxVehicleDriveDynData_GearDown, getPxVehicleDriveDynData_GearDown) + , UseAutoGears( "UseAutoGears", setPxVehicleDriveDynData_UseAutoGears, getPxVehicleDriveDynData_UseAutoGears) + , CurrentGear( "CurrentGear", setPxVehicleDriveDynData_CurrentGear, getPxVehicleDriveDynData_CurrentGear) + , TargetGear( "TargetGear", setPxVehicleDriveDynData_TargetGear, getPxVehicleDriveDynData_TargetGear) + , EngineRotationSpeed( "EngineRotationSpeed", setPxVehicleDriveDynData_EngineRotationSpeed, getPxVehicleDriveDynData_EngineRotationSpeed) + , GearChange( "GearChange", setPxVehicleDriveDynData_GearChange, getPxVehicleDriveDynData_GearChange) + , GearSwitchTime( "GearSwitchTime", setPxVehicleDriveDynData_GearSwitchTime, getPxVehicleDriveDynData_GearSwitchTime) + , AutoBoxSwitchTime( "AutoBoxSwitchTime", setPxVehicleDriveDynData_AutoBoxSwitchTime, getPxVehicleDriveDynData_AutoBoxSwitchTime) + , MUseAutoGears( "MUseAutoGears", setPxVehicleDriveDynDataMUseAutoGears, getPxVehicleDriveDynDataMUseAutoGears ) + , MGearUpPressed( "MGearUpPressed", setPxVehicleDriveDynDataMGearUpPressed, getPxVehicleDriveDynDataMGearUpPressed ) + , MGearDownPressed( "MGearDownPressed", setPxVehicleDriveDynDataMGearDownPressed, getPxVehicleDriveDynDataMGearDownPressed ) + , MCurrentGear( "MCurrentGear", setPxVehicleDriveDynDataMCurrentGear, getPxVehicleDriveDynDataMCurrentGear ) + , MTargetGear( "MTargetGear", setPxVehicleDriveDynDataMTargetGear, getPxVehicleDriveDynDataMTargetGear ) + , MEnginespeed( "MEnginespeed", setPxVehicleDriveDynDataMEnginespeed, getPxVehicleDriveDynDataMEnginespeed ) + , MGearSwitchTime( "MGearSwitchTime", setPxVehicleDriveDynDataMGearSwitchTime, getPxVehicleDriveDynDataMGearSwitchTime ) + , MAutoBoxSwitchTime( "MAutoBoxSwitchTime", setPxVehicleDriveDynDataMAutoBoxSwitchTime, getPxVehicleDriveDynDataMAutoBoxSwitchTime ) +{} + PxVehicleDriveDynDataGeneratedValues::PxVehicleDriveDynDataGeneratedValues( const PxVehicleDriveDynData* inSource ) + :GearUp( getPxVehicleDriveDynData_GearUp( inSource ) ) + ,GearDown( getPxVehicleDriveDynData_GearDown( inSource ) ) + ,UseAutoGears( getPxVehicleDriveDynData_UseAutoGears( inSource ) ) + ,CurrentGear( getPxVehicleDriveDynData_CurrentGear( inSource ) ) + ,TargetGear( getPxVehicleDriveDynData_TargetGear( inSource ) ) + ,EngineRotationSpeed( getPxVehicleDriveDynData_EngineRotationSpeed( inSource ) ) + ,GearChange( getPxVehicleDriveDynData_GearChange( inSource ) ) + ,GearSwitchTime( getPxVehicleDriveDynData_GearSwitchTime( inSource ) ) + ,AutoBoxSwitchTime( getPxVehicleDriveDynData_AutoBoxSwitchTime( inSource ) ) + ,MUseAutoGears( inSource->mUseAutoGears ) + ,MGearUpPressed( inSource->mGearUpPressed ) + ,MGearDownPressed( inSource->mGearDownPressed ) + ,MCurrentGear( inSource->mCurrentGear ) + ,MTargetGear( inSource->mTargetGear ) + ,MEnginespeed( inSource->mEnginespeed ) + ,MGearSwitchTime( inSource->mGearSwitchTime ) + ,MAutoBoxSwitchTime( inSource->mAutoBoxSwitchTime ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleDriveSimData_EngineData( PxVehicleDriveSimData* inObj, const PxVehicleEngineData & inArg){ inObj->setEngineData( inArg ); } +PxVehicleEngineData getPxVehicleDriveSimData_EngineData( const PxVehicleDriveSimData* inObj ) { return inObj->getEngineData(); } +void setPxVehicleDriveSimData_GearsData( PxVehicleDriveSimData* inObj, const PxVehicleGearsData & inArg){ inObj->setGearsData( inArg ); } +PxVehicleGearsData getPxVehicleDriveSimData_GearsData( const PxVehicleDriveSimData* inObj ) { return inObj->getGearsData(); } +void setPxVehicleDriveSimData_ClutchData( PxVehicleDriveSimData* inObj, const PxVehicleClutchData & inArg){ inObj->setClutchData( inArg ); } +PxVehicleClutchData getPxVehicleDriveSimData_ClutchData( const PxVehicleDriveSimData* inObj ) { return inObj->getClutchData(); } +void setPxVehicleDriveSimData_AutoBoxData( PxVehicleDriveSimData* inObj, const PxVehicleAutoBoxData & inArg){ inObj->setAutoBoxData( inArg ); } +PxVehicleAutoBoxData getPxVehicleDriveSimData_AutoBoxData( const PxVehicleDriveSimData* inObj ) { return inObj->getAutoBoxData(); } + PxVehicleDriveSimDataGeneratedInfo::PxVehicleDriveSimDataGeneratedInfo() + : EngineData( "EngineData", setPxVehicleDriveSimData_EngineData, getPxVehicleDriveSimData_EngineData) + , GearsData( "GearsData", setPxVehicleDriveSimData_GearsData, getPxVehicleDriveSimData_GearsData) + , ClutchData( "ClutchData", setPxVehicleDriveSimData_ClutchData, getPxVehicleDriveSimData_ClutchData) + , AutoBoxData( "AutoBoxData", setPxVehicleDriveSimData_AutoBoxData, getPxVehicleDriveSimData_AutoBoxData) +{} + PxVehicleDriveSimDataGeneratedValues::PxVehicleDriveSimDataGeneratedValues( const PxVehicleDriveSimData* inSource ) + :EngineData( getPxVehicleDriveSimData_EngineData( inSource ) ) + ,GearsData( getPxVehicleDriveSimData_GearsData( inSource ) ) + ,ClutchData( getPxVehicleDriveSimData_ClutchData( inSource ) ) + ,AutoBoxData( getPxVehicleDriveSimData_AutoBoxData( inSource ) ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleDriveSimData4W_DiffData( PxVehicleDriveSimData4W* inObj, const PxVehicleDifferential4WData & inArg){ inObj->setDiffData( inArg ); } +PxVehicleDifferential4WData getPxVehicleDriveSimData4W_DiffData( const PxVehicleDriveSimData4W* inObj ) { return inObj->getDiffData(); } +void setPxVehicleDriveSimData4W_AckermannGeometryData( PxVehicleDriveSimData4W* inObj, const PxVehicleAckermannGeometryData & inArg){ inObj->setAckermannGeometryData( inArg ); } +PxVehicleAckermannGeometryData getPxVehicleDriveSimData4W_AckermannGeometryData( const PxVehicleDriveSimData4W* inObj ) { return inObj->getAckermannGeometryData(); } + PxVehicleDriveSimData4WGeneratedInfo::PxVehicleDriveSimData4WGeneratedInfo() + : DiffData( "DiffData", setPxVehicleDriveSimData4W_DiffData, getPxVehicleDriveSimData4W_DiffData) + , AckermannGeometryData( "AckermannGeometryData", setPxVehicleDriveSimData4W_AckermannGeometryData, getPxVehicleDriveSimData4W_AckermannGeometryData) +{} + PxVehicleDriveSimData4WGeneratedValues::PxVehicleDriveSimData4WGeneratedValues( const PxVehicleDriveSimData4W* inSource ) + :PxVehicleDriveSimDataGeneratedValues( inSource ) + ,DiffData( getPxVehicleDriveSimData4W_DiffData( inSource ) ) + ,AckermannGeometryData( getPxVehicleDriveSimData4W_AckermannGeometryData( inSource ) ) +{ + PX_UNUSED(inSource); +} +const char * getPxVehicleDrive_ConcreteTypeName( const PxVehicleDrive* inObj ) { return inObj->getConcreteTypeName(); } +inline PxVehicleDriveDynData getPxVehicleDriveMDriveDynData( const PxVehicleDrive* inOwner ) { return inOwner->mDriveDynData; } +inline void setPxVehicleDriveMDriveDynData( PxVehicleDrive* inOwner, PxVehicleDriveDynData inData) { inOwner->mDriveDynData = inData; } + PxVehicleDriveGeneratedInfo::PxVehicleDriveGeneratedInfo() + : ConcreteTypeName( "ConcreteTypeName", getPxVehicleDrive_ConcreteTypeName) + , MDriveDynData( "MDriveDynData", setPxVehicleDriveMDriveDynData, getPxVehicleDriveMDriveDynData ) +{} + PxVehicleDriveGeneratedValues::PxVehicleDriveGeneratedValues( const PxVehicleDrive* inSource ) + :PxVehicleWheelsGeneratedValues( inSource ) + ,ConcreteTypeName( getPxVehicleDrive_ConcreteTypeName( inSource ) ) + ,MDriveDynData( inSource->mDriveDynData ) +{ + PX_UNUSED(inSource); +} +const char * getPxVehicleDrive4W_ConcreteTypeName( const PxVehicleDrive4W* inObj ) { return inObj->getConcreteTypeName(); } +inline PxVehicleDriveSimData4W getPxVehicleDrive4WMDriveSimData( const PxVehicleDrive4W* inOwner ) { return inOwner->mDriveSimData; } +inline void setPxVehicleDrive4WMDriveSimData( PxVehicleDrive4W* inOwner, PxVehicleDriveSimData4W inData) { inOwner->mDriveSimData = inData; } + PxVehicleDrive4WGeneratedInfo::PxVehicleDrive4WGeneratedInfo() + : ConcreteTypeName( "ConcreteTypeName", getPxVehicleDrive4W_ConcreteTypeName) + , MDriveSimData( "MDriveSimData", setPxVehicleDrive4WMDriveSimData, getPxVehicleDrive4WMDriveSimData ) +{} + PxVehicleDrive4WGeneratedValues::PxVehicleDrive4WGeneratedValues( const PxVehicleDrive4W* inSource ) + :PxVehicleDriveGeneratedValues( inSource ) + ,ConcreteTypeName( getPxVehicleDrive4W_ConcreteTypeName( inSource ) ) + ,MDriveSimData( inSource->mDriveSimData ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleDriveTank_DriveModel( PxVehicleDriveTank* inObj, const PxVehicleDriveTankControlModel::Enum inArg){ inObj->setDriveModel( inArg ); } +PxVehicleDriveTankControlModel::Enum getPxVehicleDriveTank_DriveModel( const PxVehicleDriveTank* inObj ) { return inObj->getDriveModel(); } +const char * getPxVehicleDriveTank_ConcreteTypeName( const PxVehicleDriveTank* inObj ) { return inObj->getConcreteTypeName(); } +inline PxVehicleDriveSimData getPxVehicleDriveTankMDriveSimData( const PxVehicleDriveTank* inOwner ) { return inOwner->mDriveSimData; } +inline void setPxVehicleDriveTankMDriveSimData( PxVehicleDriveTank* inOwner, PxVehicleDriveSimData inData) { inOwner->mDriveSimData = inData; } + PxVehicleDriveTankGeneratedInfo::PxVehicleDriveTankGeneratedInfo() + : DriveModel( "DriveModel", setPxVehicleDriveTank_DriveModel, getPxVehicleDriveTank_DriveModel) + , ConcreteTypeName( "ConcreteTypeName", getPxVehicleDriveTank_ConcreteTypeName) + , MDriveSimData( "MDriveSimData", setPxVehicleDriveTankMDriveSimData, getPxVehicleDriveTankMDriveSimData ) +{} + PxVehicleDriveTankGeneratedValues::PxVehicleDriveTankGeneratedValues( const PxVehicleDriveTank* inSource ) + :PxVehicleDriveGeneratedValues( inSource ) + ,DriveModel( getPxVehicleDriveTank_DriveModel( inSource ) ) + ,ConcreteTypeName( getPxVehicleDriveTank_ConcreteTypeName( inSource ) ) + ,MDriveSimData( inSource->mDriveSimData ) +{ + PX_UNUSED(inSource); +} +void setPxVehicleDriveSimDataNW_DiffData( PxVehicleDriveSimDataNW* inObj, const PxVehicleDifferentialNWData & inArg){ inObj->setDiffData( inArg ); } +PxVehicleDifferentialNWData getPxVehicleDriveSimDataNW_DiffData( const PxVehicleDriveSimDataNW* inObj ) { return inObj->getDiffData(); } + PxVehicleDriveSimDataNWGeneratedInfo::PxVehicleDriveSimDataNWGeneratedInfo() + : DiffData( "DiffData", setPxVehicleDriveSimDataNW_DiffData, getPxVehicleDriveSimDataNW_DiffData) +{} + PxVehicleDriveSimDataNWGeneratedValues::PxVehicleDriveSimDataNWGeneratedValues( const PxVehicleDriveSimDataNW* inSource ) + :PxVehicleDriveSimDataGeneratedValues( inSource ) + ,DiffData( getPxVehicleDriveSimDataNW_DiffData( inSource ) ) +{ + PX_UNUSED(inSource); +} +const char * getPxVehicleDriveNW_ConcreteTypeName( const PxVehicleDriveNW* inObj ) { return inObj->getConcreteTypeName(); } +inline PxVehicleDriveSimDataNW getPxVehicleDriveNWMDriveSimData( const PxVehicleDriveNW* inOwner ) { return inOwner->mDriveSimData; } +inline void setPxVehicleDriveNWMDriveSimData( PxVehicleDriveNW* inOwner, PxVehicleDriveSimDataNW inData) { inOwner->mDriveSimData = inData; } + PxVehicleDriveNWGeneratedInfo::PxVehicleDriveNWGeneratedInfo() + : ConcreteTypeName( "ConcreteTypeName", getPxVehicleDriveNW_ConcreteTypeName) + , MDriveSimData( "MDriveSimData", setPxVehicleDriveNWMDriveSimData, getPxVehicleDriveNWMDriveSimData ) +{} + PxVehicleDriveNWGeneratedValues::PxVehicleDriveNWGeneratedValues( const PxVehicleDriveNW* inSource ) + :PxVehicleDriveGeneratedValues( inSource ) + ,ConcreteTypeName( getPxVehicleDriveNW_ConcreteTypeName( inSource ) ) + ,MDriveSimData( inSource->mDriveSimData ) +{ + PX_UNUSED(inSource); +} +PxReal getPxVehicleNoDrive_BrakeTorque( const PxVehicleNoDrive* inObj, const PxU32 index ) { return inObj->getBrakeTorque( index ); } +PxU32 getNbPxVehicleNoDrive_BrakeTorque( const PxVehicleNoDrive* inObj ) { return inObj->getNbBrakeTorque( ); } +void setPxVehicleNoDrive_BrakeTorque( PxVehicleNoDrive* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setBrakeTorque( inIndex, inValue ); } +PxReal getPxVehicleNoDrive_DriveTorque( const PxVehicleNoDrive* inObj, const PxU32 index ) { return inObj->getDriveTorque( index ); } +PxU32 getNbPxVehicleNoDrive_DriveTorque( const PxVehicleNoDrive* inObj ) { return inObj->getNbDriveTorque( ); } +void setPxVehicleNoDrive_DriveTorque( PxVehicleNoDrive* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setDriveTorque( inIndex, inValue ); } +PxReal getPxVehicleNoDrive_SteerAngle( const PxVehicleNoDrive* inObj, const PxU32 index ) { return inObj->getSteerAngle( index ); } +PxU32 getNbPxVehicleNoDrive_SteerAngle( const PxVehicleNoDrive* inObj ) { return inObj->getNbSteerAngle( ); } +void setPxVehicleNoDrive_SteerAngle( PxVehicleNoDrive* inObj, const PxU32 inIndex, PxReal inValue ){ inObj->setSteerAngle( inIndex, inValue ); } +const char * getPxVehicleNoDrive_ConcreteTypeName( const PxVehicleNoDrive* inObj ) { return inObj->getConcreteTypeName(); } + PxVehicleNoDriveGeneratedInfo::PxVehicleNoDriveGeneratedInfo() + : BrakeTorque( "BrakeTorque", getPxVehicleNoDrive_BrakeTorque, getNbPxVehicleNoDrive_BrakeTorque, setPxVehicleNoDrive_BrakeTorque ) + , DriveTorque( "DriveTorque", getPxVehicleNoDrive_DriveTorque, getNbPxVehicleNoDrive_DriveTorque, setPxVehicleNoDrive_DriveTorque ) + , SteerAngle( "SteerAngle", getPxVehicleNoDrive_SteerAngle, getNbPxVehicleNoDrive_SteerAngle, setPxVehicleNoDrive_SteerAngle ) + , ConcreteTypeName( "ConcreteTypeName", getPxVehicleNoDrive_ConcreteTypeName) +{} + PxVehicleNoDriveGeneratedValues::PxVehicleNoDriveGeneratedValues( const PxVehicleNoDrive* inSource ) + :PxVehicleWheelsGeneratedValues( inSource ) + ,ConcreteTypeName( getPxVehicleNoDrive_ConcreteTypeName( inSource ) ) +{ + PX_UNUSED(inSource); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp new file mode 100644 index 0000000..4fdfdaa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle/src/physxmetadata/src/PxVehicleMetaDataObjects.cpp @@ -0,0 +1,85 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPhysicsAPI.h" +#include "extensions/PxExtensionsAPI.h" +#include "PxVehicleMetaDataObjects.h" +#include "PxExtensionMetaDataObjects.h" + +namespace physx +{ + inline void SetMFrictionVsSlipGraph( PxVehicleTireData* inTireData, PxU32 idx1, PxU32 idx2, PxReal val ) { inTireData->mFrictionVsSlipGraph[idx1][idx2] = val; } + inline PxReal GetMFrictionVsSlipGraph( const PxVehicleTireData* inTireData, PxU32 idx1, PxU32 idx2 ) + { + return inTireData->mFrictionVsSlipGraph[idx1][idx2]; + } + PX_PHYSX_CORE_API MFrictionVsSlipGraphProperty::MFrictionVsSlipGraphProperty() + : PxExtendedDualIndexedPropertyInfo ( "MFrictionVsSlipGraph", SetMFrictionVsSlipGraph, GetMFrictionVsSlipGraph, 3, 2 ) + { + + } + + inline PxU32 GetNbWheels( const PxVehicleWheels* inStats ) { return inStats->mWheelsSimData.getNbWheels(); } + + inline PxU32 GetNbTorqueCurvePair( const PxVehicleEngineData* inStats ) { return inStats->mTorqueCurve.getNbDataPairs(); } + + + inline PxReal getXTorqueCurvePair( const PxVehicleEngineData* inStats, PxU32 index) + { + return inStats->mTorqueCurve.getX(index); + } + inline PxReal getYTorqueCurvePair( const PxVehicleEngineData* inStats, PxU32 index) + { + return inStats->mTorqueCurve.getY(index); + } + + void addTorqueCurvePair(PxVehicleEngineData* inStats, const PxReal x, const PxReal y) + { + inStats->mTorqueCurve.addPair(x, y); + } + + void clearTorqueCurvePair(PxVehicleEngineData* inStats) + { + inStats->mTorqueCurve.clear(); + } + + PX_PHYSX_CORE_API MTorqueCurveProperty::MTorqueCurveProperty() + : PxFixedSizeLookupTablePropertyInfo("MTorqueCurve", getXTorqueCurvePair, getYTorqueCurvePair, GetNbTorqueCurvePair, addTorqueCurvePair, clearTorqueCurvePair) + { + } + + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/commands/VhCommandHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/commands/VhCommandHelpers.cpp new file mode 100644 index 0000000..432dfe9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/commands/VhCommandHelpers.cpp @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/commands/PxVehicleCommandParams.h" +#include "vehicle2/commands/PxVehicleCommandHelpers.h" + +namespace physx +{ +namespace vehicle2 +{ +static float interpolate(const PxReal* speedVals, const PxReal* torqueVals, const PxU16 nb, const PxReal speed) +{ + if (1 == nb) + { + return torqueVals[0]; + } + else + { + const PxReal smallestSpeed = speedVals[0]; + const PxReal largestSpeed = speedVals[nb - 1]; + if (smallestSpeed >= speed) + { + return torqueVals[0]; + } + else if (largestSpeed <= speed) + { + return torqueVals[nb - 1]; + } + else + { + PxU16 speedId = 0; + while ((speedVals[speedId] < speed) && (speedId < nb)) + speedId++; + + // Make sure that we stay in range. + PxU16 speedLowerId = speedId - 1; + PxU16 speeddUpperId = speedId; + if (nb == speedId) + speeddUpperId = nb - 1; + if (0 == speedId) + speedLowerId = 0; + + return torqueVals[speedLowerId] + (speed - speedVals[speedLowerId]) * (torqueVals[speeddUpperId] - torqueVals[speedLowerId]) / (speedVals[speeddUpperId] - speedVals[speedLowerId]); + } + } +} + +PxReal PxVehicleNonLinearResponseCompute +(const PxReal commandValue, const PxReal speed, const PxU32 wheelId, const PxVehicleCommandResponseParams& responseParams) +{ + const PxU16 nbResponsesAtSpeeds = responseParams.nonlinearResponse.nbSpeedResponses; + if (0 == nbResponsesAtSpeeds) + { + //Empty response table. + //Use linear interpolation. + return PxVehicleLinearResponseCompute(commandValue, wheelId, responseParams); + } + + const PxReal* commandValues = responseParams.nonlinearResponse.commandValues; + const PxU16* speedResponsesPerCommandValue = responseParams.nonlinearResponse.speedResponsesPerCommandValue; + const PxU16* nbSpeedResponsesPerCommandValue = responseParams.nonlinearResponse.nbSpeedRenponsesPerCommandValue; + const PxU16 nbCommandValues = responseParams.nonlinearResponse.nbCommandValues; + const PxReal* speedResponses = responseParams.nonlinearResponse.speedResponses; + + PxReal normalisedResponse = 0.0f; + if ((1 == nbCommandValues) || (commandValues[0] >= commandValue)) + { + //Input command value less than the smallest value in the response table or + //there is just a single command value in the response table. + //No need to interpolate response of two command values. + const PxReal* speeds = speedResponses + 2*speedResponsesPerCommandValue[0]; + const PxReal* torques = speeds + nbSpeedResponsesPerCommandValue[0]; + const PxU16 nb = nbSpeedResponsesPerCommandValue[0]; + normalisedResponse = interpolate(speeds, torques, nb, speed); + } + else if (commandValues[nbCommandValues - 1] <= commandValue) + { + //Input command value greater than the largest value in the response table. + //No need to interpolate response of two command values. + const PxReal* speeds = speedResponses + 2*speedResponsesPerCommandValue[nbCommandValues - 1]; + const PxReal* torques = speeds + nbSpeedResponsesPerCommandValue[nbCommandValues - 1]; + const PxU16 nb = nbSpeedResponsesPerCommandValue[nbCommandValues - 1]; + normalisedResponse = interpolate(speeds, torques, nb, speed); + } + else + { + // Find the id of the command value that is immediately above the input command + PxU16 commandId = 0; + while ((commandValues[commandId] < commandValue) && (commandId < nbCommandValues)) + { + commandId++; + } + + // Make sure that we stay in range. + PxU16 commandLowerId = commandId - 1; + PxU16 commandUpperId = commandId; + if (nbCommandValues == commandId) + commandUpperId = nbCommandValues - 1; + if (0 == commandId) + commandLowerId = 0; + + if (commandUpperId != commandLowerId) + { + float zLower; + { + const PxReal* speeds = speedResponses + 2*speedResponsesPerCommandValue[commandLowerId]; + const PxReal* torques = speeds + nbSpeedResponsesPerCommandValue[commandLowerId]; + const PxU16 nb = nbSpeedResponsesPerCommandValue[commandLowerId]; + zLower = interpolate(speeds, torques, nb, speed); + } + float zUpper; + { + const PxReal* speeds = speedResponses + 2*speedResponsesPerCommandValue[commandUpperId]; + const PxReal* torques = speeds + nbSpeedResponsesPerCommandValue[commandUpperId]; + const PxU16 nb = nbSpeedResponsesPerCommandValue[commandUpperId]; + zUpper = interpolate(speeds, torques, nb, speed); + } + const PxReal commandUpper = commandValues[commandUpperId]; + const PxReal commandLower = commandValues[commandLowerId]; + normalisedResponse = zLower + (commandValue - commandLower) * (zUpper - zLower) / (commandUpper - commandLower); + } + else + { + const PxReal* speeds = speedResponses + 2*speedResponsesPerCommandValue[commandUpperId]; + const PxReal* torques = speeds + nbSpeedResponsesPerCommandValue[commandUpperId]; + const PxU16 nb = nbSpeedResponsesPerCommandValue[commandUpperId]; + normalisedResponse = interpolate(speeds, torques, nb, speed); + } + } + + return PxVehicleLinearResponseCompute(normalisedResponse, wheelId, responseParams); +} + +} // namespace vehicle2 +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainFunctions.cpp new file mode 100644 index 0000000..50bedc6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainFunctions.cpp @@ -0,0 +1,976 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleMaths.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainFunctions.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h" + +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +namespace physx +{ +namespace vehicle2 +{ + +void PxVehicleDirectDriveThrottleCommandResponseUpdate +(const PxReal throttle, const PxVehicleDirectDriveTransmissionCommandState& transmissionCommands, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleDirectDriveThrottleCommandResponseParams& responseParams, + PxReal& throttleResponse) +{ + //The gearing decides how we will multiply the response. + PxF32 gearMultiplier = 0.0f; + switch (transmissionCommands.gear) + { + case PxVehicleDirectDriveTransmissionCommandState::eREVERSE: + gearMultiplier = -1.0f; + break; + case PxVehicleDirectDriveTransmissionCommandState::eNEUTRAL: + gearMultiplier = 0.0f; + break; + case PxVehicleDirectDriveTransmissionCommandState::eFORWARD: + gearMultiplier = 1.0f; + break; + } + throttleResponse = gearMultiplier * PxVehicleNonLinearResponseCompute(throttle, longitudinalSpeed, wheelId, responseParams); +} + +void PxVehicleDirectDriveActuationStateUpdate +(const PxReal brakeTorque, const PxReal driveTorque, + PxVehicleWheelActuationState& actState) +{ + PxMemZero(&actState, sizeof(PxVehicleWheelActuationState)); + actState.isBrakeApplied = (brakeTorque != 0.0f); + actState.isDriveApplied = (driveTorque != 0.0f); +} + +void PxVehicleDirectDriveUpdate +(const PxVehicleWheelParams& whlParams, + const PxVehicleWheelActuationState& actState, + const PxReal brkTorque, const PxReal drvTorque, const PxVehicleTireForce& trForce, + const PxF32 dt, + PxVehicleWheelRigidBody1dState& whlState) +{ + + //w(t+dt) = w(t) + (1/inertia)*(brakeTorque + driveTorque + tireTorque)*dt - (1/inertia)*damping*w(t)*dt ) (1) + //Apply implicit trick and rearrange. + //w(t+dt)[1 + (1/inertia)*damping*dt] = w(t) + (1/inertia)*(brakeTorque + driveTorque + tireTorque)*dt (2) + const PxF32 wheelRotSpeed = whlState.rotationSpeed; + const PxF32 dtOverMOI = dt/whlParams.moi; + const PxF32 tireTorque = trForce.wheelTorque; + const PxF32 brakeTorque = -brkTorque*PxVehicleComputeSign(wheelRotSpeed); + const PxF32 driveTorque = drvTorque; + const PxF32 wheelDampingRate = whlParams.dampingRate; + + //Integrate the wheel rotation speed. + const PxF32 newRotSpeedNoBrakelock = (wheelRotSpeed + dtOverMOI*(tireTorque + driveTorque + brakeTorque)) / (1.0f + wheelDampingRate*dtOverMOI); + //If the brake is applied and the sign flipped then lock the brake. + const bool isBrakeApplied = actState.isBrakeApplied; + const PxF32 newRotSpeedWithBrakelock = (isBrakeApplied && ((wheelRotSpeed*newRotSpeedNoBrakelock) <= 0)) ? 0.0f : newRotSpeedNoBrakelock; + + whlState.rotationSpeed = newRotSpeedWithBrakelock; +} + +void PxVehicleDifferentialStateUpdate +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelStates, + PxVehicleDifferentialState& diffState) +{ + diffState.setToDefault(); + + //4 wheels are connected. + diffState.connectedWheels[0] = diffParams.frontWheelIds[0]; + diffState.connectedWheels[1] = diffParams.frontWheelIds[1]; + diffState.connectedWheels[2] = diffParams.rearWheelIds[0]; + diffState.connectedWheels[3] = diffParams.rearWheelIds[1]; + diffState.nbConnectedWheels = 4; + + //Compute the contributions to average speed and ratios of available torque. + PxVehicleLegacyDifferentialWheelSpeedContributionsCompute(diffParams, PxVehicleLimits::eMAX_NB_WHEELS, + diffState.aveWheelSpeedContributionAllWheels); + + PxVehicleLegacyDifferentialTorqueRatiosCompute(diffParams, wheelStates, PxVehicleLimits::eMAX_NB_WHEELS, + diffState.torqueRatiosAllWheels); +} + +PX_FORCE_INLINE PxF32 computeTargetRatio +(const PxF32 target, const PxF32 dt, const PxF32 strength, const PxF32 ratio) +{ + const PxF32 targ = (PX_VEHICLE_FOUR_WHEEL_DIFFERENTIAL_MAXIMUM_STRENGTH == strength) ? target : PxMax(target, ratio - strength * dt); + return targ; +} + +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleFourWheelDriveDifferentialParams& diffParams, + const PxVehicleArrayData& wheelStates, + const PxReal dt, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState) +{ + diffState.setToDefault(); + wheelConstraintGroupState.setToDefault(); + + PxU32 nbConnectedWheels = 0; + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + if (diffParams.torqueRatios[wheelId] != 0.0f) + { + diffState.connectedWheels[nbConnectedWheels] = wheelId; + diffState.aveWheelSpeedContributionAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + diffState.torqueRatiosAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + nbConnectedWheels++; + } + } + diffState.nbConnectedWheels = nbConnectedWheels; + + if (0.0f == diffParams.frontBias && 0.0f == diffParams.rearBias && 0.0f == diffParams.centerBias) + return; + + if (0.0f == diffParams.rate) + return; + + bool frontBiasBreached = false; + PxF32 Rf = 0.0f; + PxF32 Tf = 0.0f; + { + const PxF32 bias = diffParams.frontBias; + if (bias >= 1.0f) + { + const PxU32 wheel0 = diffParams.frontWheelIds[0]; + const PxU32 wheel1 = diffParams.frontWheelIds[1]; + const PxReal w0 = wheelStates[wheel0].rotationSpeed; + const PxReal w1 = wheelStates[wheel1].rotationSpeed; + const PxReal aw0 = PxAbs(w0); + const PxReal aw1 = PxAbs(w1); + const PxReal sw0 = PxVehicleComputeSign(w0); + const PxReal sw1 = PxVehicleComputeSign(w1); + if ((w0 != 0.0f) && (sw0 == sw1)) + { + const PxF32 ratio = PxMax(aw0, aw1) / PxMin(aw0, aw1); + frontBiasBreached = (ratio > bias); + //const PxF32 target = diffParams.frontTarget + (1.0f - diffParams.strength) * (ratio - diffParams.frontTarget); + const PxF32 target = computeTargetRatio(diffParams.frontTarget, dt, diffParams.rate, ratio); + Tf = (aw0 > aw1) ? 1.0f / target : target; + Rf = aw1 / aw0; + } + } + } + + bool rearBiasBreached = false; + PxF32 Rr = 0.0f; + PxF32 Tr = 0.0f; + { + const PxF32 bias = diffParams.rearBias; + if (bias >= 1.0f) + { + const PxU32 wheel2 = diffParams.rearWheelIds[0]; + const PxU32 wheel3 = diffParams.rearWheelIds[1]; + const PxReal w2 = wheelStates[wheel2].rotationSpeed; + const PxReal w3 = wheelStates[wheel3].rotationSpeed; + const PxReal aw2 = PxAbs(w2); + const PxReal aw3 = PxAbs(w3); + const PxReal sw2 = PxVehicleComputeSign(w2); + const PxReal sw3 = PxVehicleComputeSign(w3); + if ((w2 != 0.0f) && (sw2 == sw3)) + { + const PxF32 ratio = PxMax(aw2, aw3) / PxMin(aw2, aw3); + rearBiasBreached = (ratio > bias); + //const PxF32 target = diffParams.rearTarget + (1.0f - diffParams.strength) * (ratio - diffParams.rearTarget); + const PxF32 target = computeTargetRatio(diffParams.rearTarget, dt, diffParams.rate, ratio); + Tr = (aw2 > aw3) ? 1.0f / target : target; + Rr = aw3 / aw2; + } + } + } + + bool centreBiasBrached = false; + //PxF32 Rc = 0.0f; + PxF32 Tc = 0.0f; + { + const PxF32 bias = diffParams.centerBias; + if(bias >= 1.0f) + { + const PxU32 wheel0 = diffParams.frontWheelIds[0]; + const PxU32 wheel1 = diffParams.frontWheelIds[1]; + const PxU32 wheel2 = diffParams.rearWheelIds[0]; + const PxU32 wheel3 = diffParams.rearWheelIds[1]; + const PxReal w0 = wheelStates[wheel0].rotationSpeed; + const PxReal w1 = wheelStates[wheel1].rotationSpeed; + const PxReal w2 = wheelStates[wheel2].rotationSpeed; + const PxReal w3 = wheelStates[wheel3].rotationSpeed; + const PxReal aw0 = PxAbs(w0); + const PxReal aw1 = PxAbs(w1); + const PxReal aw2 = PxAbs(w2); + const PxReal aw3 = PxAbs(w3); + const PxReal sw0 = PxVehicleComputeSign(w0); + const PxReal sw1 = PxVehicleComputeSign(w1); + const PxReal sw2 = PxVehicleComputeSign(w2); + const PxReal sw3 = PxVehicleComputeSign(w3); + if ((w0 != 0.0f) && (sw0 == sw1) && (sw0 == sw2) && (sw0 == sw3)) + { + const PxF32 ratio = PxMax(aw0 + aw1, aw2 + aw3) / PxMin(aw0 + aw1, aw2 + aw3); + centreBiasBrached = (ratio > bias); + //const PxF32 target = diffParams.centerTarget + (1.0f - diffParams.strength) * (ratio - diffParams.centerTarget); + const PxF32 target = computeTargetRatio(diffParams.centerTarget, dt, diffParams.rate, ratio); + Tc = ((aw0 + aw1) > (aw2 + aw3)) ? 1.0f / target : target; + //Rc = (aw2 + aw3) / (aw0 + aw1); + } + } + } + + if (centreBiasBrached) + { + PxF32 f = 0.0f; + PxF32 r = 0.0f; + if (frontBiasBreached && rearBiasBreached) + { + f = Tf; + r = Tr; + } + else if (frontBiasBreached) + { + f = Tf; + r = Rr; + } + else if (rearBiasBreached) + { + f = Rf; + r = Tr; + } + else + { + f = Rf; + r = Rr; + } + + const PxU32 wheel0 = diffParams.frontWheelIds[0]; + const PxU32 wheel1 = diffParams.frontWheelIds[1]; + const PxU32 wheel2 = diffParams.rearWheelIds[0]; + const PxU32 wheel3 = diffParams.rearWheelIds[1]; + const PxU32 wheelIds[4] = { wheel0, wheel1, wheel2, wheel3 }; + const PxF32 constraintMultipliers[4] = { 1.0f, f, Tc*(1 + f) / (1 + r), r*Tc*(1 + f) / (1 + r) }; + wheelConstraintGroupState.addConstraintGroup(4, wheelIds, constraintMultipliers); + } + else + { + if (frontBiasBreached) + { + const PxU32* wheelIds = diffParams.frontWheelIds; + const PxF32 constraintMultipliers[2] = { 1.0f, Tf }; + wheelConstraintGroupState.addConstraintGroup(2, wheelIds, constraintMultipliers); + } + + if (rearBiasBreached) + { + const PxU32* wheelIds = diffParams.rearWheelIds; + const PxF32 constraintMultipliers[2] = { 1.0f, Tr }; + wheelConstraintGroupState.addConstraintGroup(2, wheelIds, constraintMultipliers); + } + } +} + +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleMultiWheelDriveDifferentialParams& diffParams, + PxVehicleDifferentialState& diffState) +{ + diffState.setToDefault(); + + PxU32 nbConnectedWheels = 0; + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + if (diffParams.torqueRatios[wheelId] != 0.0f) + { + diffState.connectedWheels[nbConnectedWheels] = wheelId; + diffState.aveWheelSpeedContributionAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + diffState.torqueRatiosAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + nbConnectedWheels++; + } + } + diffState.nbConnectedWheels = nbConnectedWheels; +} + +void PxVehicleDifferentialStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, const PxVehicleTankDriveDifferentialParams& diffParams, + const PxReal thrust0, PxReal thrust1, + PxVehicleDifferentialState& diffState, PxVehicleWheelConstraintGroupState& wheelConstraintGroupState) +{ + diffState.setToDefault(); + wheelConstraintGroupState.setToDefault(); + + //Store the tank track id for each wheel. + //Store the thrust controller id for each wheel. + //Store 0xffffffff for wheels not in a tank track. + PxU32 tankTrackIds[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemSet(tankTrackIds, 0xff, sizeof(tankTrackIds)); + PxU32 thrustControllerIds[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemSet(thrustControllerIds, 0xff, sizeof(thrustControllerIds)); + for (PxU32 i = 0; i < diffParams.getNbTracks(); i++) + { + const PxU32 thrustControllerIndex = diffParams.getThrustControllerIndex(i); + for (PxU32 j = 0; j < diffParams.getNbWheelsInTrack(i); j++) + { + const PxU32 wheelId = diffParams.getWheelInTrack(j, i); + tankTrackIds[wheelId] = i; + thrustControllerIds[wheelId] = thrustControllerIndex; + } + } + + //Treat every wheel connected to a tank track as connected to the differential but with zero torque split. + //If a wheel is not connected to the differential but is connected to a tank track then we treat that as a connected wheel with + //zero drive torque applied. + //We do this because we need to treat these wheels as being coupled to other wheels in the linear equations that solve engine+wheels + PxU32 nbConnectedWheels = 0; + const PxReal thrusts[2] = { thrust0, thrust1 }; + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + const PxU32 tankTrackId = tankTrackIds[wheelId]; + if (diffParams.torqueRatios[wheelId] != 0.0f && 0xffffffff != tankTrackId) + { + //Wheel connected to diff and in a tank track. + //Modify the default torque split using the relevant thrust. + const PxU32 thrustId = thrustControllerIds[wheelId]; + const PxF32 torqueSplitMultiplier = thrusts[thrustId]; + diffState.aveWheelSpeedContributionAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + diffState.torqueRatiosAllWheels[wheelId] = diffParams.torqueRatios[wheelId] * torqueSplitMultiplier; + diffState.connectedWheels[nbConnectedWheels] = wheelId; + nbConnectedWheels++; + } + else if (diffParams.torqueRatios[wheelId] != 0.0f) + { + //Wheel connected to diff but not in a tank track. + //Use the default torque split. + diffState.aveWheelSpeedContributionAllWheels[wheelId] = diffParams.aveWheelSpeedRatios[wheelId]; + diffState.torqueRatiosAllWheels[wheelId] = diffParams.torqueRatios[wheelId]; + diffState.connectedWheels[nbConnectedWheels] = wheelId; + nbConnectedWheels++; + } + else if (0xffffffff != tankTrackId) + { + //Wheel not connected to diff but is in a tank track. + //Zero torque split. + diffState.aveWheelSpeedContributionAllWheels[wheelId] = 0.0f; + diffState.torqueRatiosAllWheels[wheelId] = 0.0f; + diffState.connectedWheels[nbConnectedWheels] = wheelId; + nbConnectedWheels++; + } + } + diffState.nbConnectedWheels = nbConnectedWheels; + + //Add each tank track as a constraint group. + for (PxU32 i = 0; i < diffParams.getNbTracks(); i++) + { + const PxU32 nbWheelsInTrack = diffParams.getNbWheelsInTrack(i); + if (nbWheelsInTrack >= 2) + { + const PxU32* wheelsInTrack = diffParams.wheelIdsInTrackOrder + diffParams.trackToWheelIds[i]; + + PxF32 multipliers[PxVehicleLimits::eMAX_NB_WHEELS]; + + const PxU32 wheelId0 = wheelsInTrack[0]; + const PxF32 wheelRadius0 = wheelParams[wheelId0].radius; + + //for (PxU32 j = 0; j < 1; j++) + { + //j = 0 is a special case with multiplier = 1.0 + multipliers[0] = 1.0f; + } + for (PxU32 j = 1; j < nbWheelsInTrack; j++) + { + const PxU32 wheelIdJ = wheelsInTrack[j]; + const PxF32 wheelRadiusJ = wheelParams[wheelIdJ].radius; + multipliers[j] = wheelRadius0 / wheelRadiusJ; + } + + wheelConstraintGroupState.addConstraintGroup(nbWheelsInTrack, wheelsInTrack, multipliers); + } + } +} + +void PxVehicleEngineDriveActuationStateUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState, + const PxVehicleGearboxState& gearboxState, const PxVehicleDifferentialState& diffState, const PxVehicleClutchCommandResponseState& clutchResponseState, + PxVehicleArrayData& actuationStates) +{ + //Which wheels receive drive torque from the engine? + const PxF32* diffTorqueRatios = diffState.torqueRatiosAllWheels; + + //Work out the clutch strength. + //If the cutch strength is zero then none of the wheels receive drive torque from the engine. + const PxF32 K = PxVehicleClutchStrengthCompute(clutchResponseState, gearboxParams, gearboxState); + + //Work out the applied throttle + const PxF32 appliedThrottle = throttleResponseState.commandResponse; + + //Ready to set the boolean actuation state that is used to compute the tire slips. + //(Note: for a tire under drive or brake torque we compute the slip with a smaller denominator to accentuate the applied torque). + //(Note: for a tire that is not under drive or brake torque we compute the sip with a larger denominator to smooth the vehicle slowing down). + for(PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + + //Reset the actuation states. + PxVehicleWheelActuationState& actState = actuationStates[wheelId]; + PxMemZero(&actState, sizeof(PxVehicleWheelActuationState)); + + const PxF32 brakeTorque = brakeResponseStates[wheelId]; + const PxF32 diffTorqueRatio = diffTorqueRatios[wheelId]; + const bool isIntentionToAccelerate = (0.0f == brakeTorque) && (K != 0.0f) && (diffTorqueRatio != 0.0f) && (appliedThrottle != 0.0f); + actState.isDriveApplied = isIntentionToAccelerate; + actState.isBrakeApplied = (brakeTorque!= 0.0f); + } +} + +void PxVehicleGearCommandResponseUpdate +(const PxU32 targetGearCommand, + const PxVehicleGearboxParams& gearboxParams, + PxVehicleGearboxState& gearboxState) +{ + //Check that we're not halfway through a gear change and we need to execute a change of gear. + //If we are halfway through a gear change then we cannot execute another until the first is complete. + //Check that the command stays in a legal gear range. + if ((gearboxState.currentGear == gearboxState.targetGear) && (targetGearCommand != gearboxState.currentGear) && (targetGearCommand < gearboxParams.nbRatios)) + { + //We're not executing a gear change and we need to start one. + //Start the gear change by + //a)setting the target gear. + //b)putting vehicle in neutral + //c)set the switch time to PX_VEHICLE_GEAR_SWITCH_INITIATED to flag that we just started a gear change. + gearboxState.currentGear = gearboxParams.neutralGear; + gearboxState.targetGear = targetGearCommand; + gearboxState.gearSwitchTime = PX_VEHICLE_GEAR_SWITCH_INITIATED; + } +} + +void PxVehicleAutoBoxUpdate +(const PxVehicleEngineParams& engineParams, const PxVehicleGearboxParams& gearboxParams, const PxVehicleAutoboxParams& autoboxParams, + const PxVehicleEngineState& engineState, const PxVehicleGearboxState& gearboxState, + const PxReal dt, + PxU32& targetGearCommand, PxVehicleAutoboxState& autoboxState, + PxReal& throttle) +{ + if(targetGearCommand != PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR) + { + autoboxState.activeAutoboxGearShift = false; + autoboxState.timeSinceLastShift = PX_VEHICLE_UNSPECIFIED_TIME_SINCE_LAST_SHIFT; + return; + } + + //Current and target gear allow us to determine if a gear change is underway. + const PxU32 currentGear = gearboxState.currentGear; + const PxU32 targetGear = gearboxState.targetGear; + + //Set to current target gear in case no gear change will be initiated. + targetGearCommand = targetGear; + + //If the autobox triggered a gear change and the gear change is complete then + //reset the corresponding flag. + if(autoboxState.activeAutoboxGearShift && (currentGear == targetGear)) + { + autoboxState.activeAutoboxGearShift = false; + } + + //If the autobox triggered a gear change and the gear change is incomplete then + //turn off the throttle pedal. This happens in autoboxes + //to stop the driver revving the engine then damaging the + //clutch when the clutch re-engages at the end of the gear change. + if(autoboxState.activeAutoboxGearShift && (currentGear != targetGear)) + { + throttle = 0.0f; + } + + //Only process the autobox if no gear change is underway and the time passed since + //the last autobox gear change is greater than the autobox latency. + if (targetGear == currentGear) + { + const PxF32 autoBoxSwitchTime = autoboxState.timeSinceLastShift; + const PxF32 autoBoxLatencyTime = autoboxParams.latency; + + if ((currentGear <= gearboxParams.neutralGear) && ((gearboxParams.neutralGear + 1) < gearboxParams.nbRatios)) + { + // eAUTOMATIC_GEAR has been set while in neutral or one of the reverse gears + // => switch to first + targetGearCommand = gearboxParams.neutralGear + 1; + throttle = 0.0f; + autoboxState.timeSinceLastShift = 0.0f; + autoboxState.activeAutoboxGearShift = true; + } + else if (autoBoxSwitchTime > autoBoxLatencyTime) + { + const PxF32 normalisedEngineOmega = engineState.rotationSpeed/engineParams.maxOmega; + const PxU32 neutralGear = gearboxParams.neutralGear; + const PxU32 nbGears = gearboxParams.nbRatios; + const PxF32 upRatio = autoboxParams.upRatios[currentGear]; + const PxF32 downRatio = autoboxParams.downRatios[currentGear]; + + //If revs too high and not in reverse/neutral and there is a higher gear then switch up. + //Note: never switch up from neutral to first + //Note: never switch up from reverse to neutral + //Note: never switch up from one reverse gear to another reverse gear. + PX_ASSERT(currentGear > neutralGear); + if ((normalisedEngineOmega > upRatio) && ((currentGear + 1) < nbGears)) + { + targetGearCommand = currentGear + 1; + throttle = 0.0f; + autoboxState.timeSinceLastShift = 0.0f; + autoboxState.activeAutoboxGearShift = true; + } + + //If revs too low and in gear higher than first then switch down. + //Note: never switch from forward to neutral + //Note: never switch from neutral to reverse + //Note: never switch from reverse gear to reverse gear. + if ((normalisedEngineOmega < downRatio) && (currentGear > (neutralGear + 1))) + { + targetGearCommand = currentGear - 1; + throttle = 0.0f; + autoboxState.timeSinceLastShift = 0.0f; + autoboxState.activeAutoboxGearShift = true; + } + } + else + { + autoboxState.timeSinceLastShift += dt; + } + } + else + { + autoboxState.timeSinceLastShift += dt; + } +} + +void PxVehicleGearboxUpdate(const PxVehicleGearboxParams& gearboxParams, const PxF32 dt, PxVehicleGearboxState& gearboxState) +{ + if(gearboxState.targetGear != gearboxState.currentGear) + { + //If we just started a gear change then set the timer to zero. + //This replicates legacy behaviour. + if(gearboxState.gearSwitchTime == PX_VEHICLE_GEAR_SWITCH_INITIATED) + gearboxState.gearSwitchTime = 0.0f; + else + gearboxState.gearSwitchTime += dt; + + //If we've exceed the switch time then switch to the target gear + //and reset the timer. + if (gearboxState.gearSwitchTime > gearboxParams.switchTime) + { + gearboxState.currentGear = gearboxState.targetGear; + gearboxState.gearSwitchTime = PX_VEHICLE_NO_GEAR_SWITCH_PENDING; + } + } +} + + +void countConnectedWheelsNotInConstraintGroup +(const PxU32* connectedWheelIds, const PxU32 nbConnectedWheelIds, const PxVehicleWheelConstraintGroupState& constraintGroups, + PxU32 connectedWheelsNotInConstraintGroup[PxVehicleLimits::eMAX_NB_WHEELS], PxU32& nbConnectedWheelsNotInConstraintGroup) +{ + //Record the constraint group for each wheel. + //0xffffffff is reserved for a wheel not in a constraint group. + PxU32 wheelConstraintGroupIds[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemSet(wheelConstraintGroupIds, 0xffffffff, sizeof(wheelConstraintGroupIds)); + for (PxU32 i = 0; i < constraintGroups.getNbConstraintGroups(); i++) + { + for (PxU32 j = 0; j < constraintGroups.getNbWheelsInConstraintGroup(i); j++) + { + const PxU32 wheelId = constraintGroups.getWheelInConstraintGroup(j, i); + wheelConstraintGroupIds[wheelId] = i; + } + } + + //Iterate over all connected wheels and count the number not in a group. + for (PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + const PxU32 wheelId = connectedWheelIds[i]; + const PxU32 constraintGroupId = wheelConstraintGroupIds[wheelId]; + if (0xffffffff == constraintGroupId) + { + connectedWheelsNotInConstraintGroup[nbConnectedWheelsNotInConstraintGroup] = wheelId; + nbConnectedWheelsNotInConstraintGroup++; + } + } +} + +void PxVehicleEngineDrivetrainUpdate +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleEngineParams& engineParams, const PxVehicleClutchParams& clutchParams, const PxVehicleGearboxParams& gearboxParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& actuationStates, + const PxVehicleArrayData& tireForces, + const PxVehicleGearboxState& gearboxState, + const PxVehicleEngineDriveThrottleCommandResponseState& throttleCommandResponseState, const PxVehicleClutchCommandResponseState& clutchCommandResponseState, + const PxVehicleDifferentialState& diffState, const PxVehicleWheelConstraintGroupState* constraintGroupState, + const PxReal DT, + PxVehicleArrayData& wheelRigidbody1dStates, + PxVehicleEngineState& engineState, + PxVehicleClutchSlipState& clutchState) +{ + const PxF32 K = PxVehicleClutchStrengthCompute(clutchCommandResponseState, gearboxParams, gearboxState); + const PxF32 G = PxVehicleGearRatioCompute(gearboxParams, gearboxState); + const PxF32 engineDriveTorque = PxVehicleEngineDriveTorqueCompute(engineParams, engineState, throttleCommandResponseState); + const PxF32 engineDampingRate = PxVehicleEngineDampingRateCompute(engineParams, gearboxParams, gearboxState, clutchCommandResponseState, throttleCommandResponseState); + + //Arrange wheel parameters in they order they appear in the connected wheel list. + const PxU32* connectedWheelIds = diffState.connectedWheels; + const PxU32 nbConnectedWheelIds = diffState.nbConnectedWheels; + PxU32 wheelIdToConnectedWheelId[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelDiffTorqueRatios[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelGearings[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelAveWheelSpeedContributions[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelMois[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelRotSpeeds[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelBrakeTorques[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelTireTorques[PxVehicleLimits::eMAX_NB_WHEELS]; + PxF32 connectedWheelDampingRates[PxVehicleLimits::eMAX_NB_WHEELS]; + bool connectedWheelIsBrakeApplied[PxVehicleLimits::eMAX_NB_WHEELS]; + //PxF32 connectedWheelRadii[PxVehicleLimits::eMAX_NB_WHEELS]; + for(PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + const PxU32 wheelId = connectedWheelIds[i]; + wheelIdToConnectedWheelId[wheelId] = i; + connectedWheelDiffTorqueRatios[i] = PxAbs(diffState.torqueRatiosAllWheels[wheelId]); + connectedWheelGearings[i] = PxVehicleComputeSign(diffState.torqueRatiosAllWheels[wheelId]); + connectedWheelAveWheelSpeedContributions[i] = diffState.aveWheelSpeedContributionAllWheels[wheelId]; + connectedWheelMois[i] = wheelParams[wheelId].moi; + connectedWheelRotSpeeds[i] = wheelRigidbody1dStates[wheelId].rotationSpeed; + connectedWheelBrakeTorques[i] = -PxVehicleComputeSign(wheelRigidbody1dStates[wheelId].rotationSpeed)*brakeResponseStates[wheelId]; + connectedWheelTireTorques[i] = tireForces[wheelId].wheelTorque; + connectedWheelDampingRates[i] = wheelParams[wheelId].dampingRate; + connectedWheelIsBrakeApplied[i] = actuationStates[wheelId].isBrakeApplied; + //connectedWheelRadii[i] = wheelParams[wheelId].radius; + }; + + //Compute the clutch slip + clutchState.setToDefault(); + PxF32 clutchSlip = 0; + { + PxF32 averageWheelSpeed = 0; + for (PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + averageWheelSpeed += connectedWheelRotSpeeds[i] * connectedWheelAveWheelSpeedContributions[i]; + } + clutchSlip = G*averageWheelSpeed - engineState.rotationSpeed; + } + clutchState.clutchSlip = clutchSlip; + + // + //torque at clutch: + //tc = K*{G*[alpha0*w0 + alpha1*w1 + alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng} + //where + //(i) G is the gearing ratio, + //(ii) alphai is the fractional contribution of the ith wheel to the average wheel speed at the clutch (alpha(i) is zero for undriven wheels) + //(iii) wi is the angular speed of the ith wheel + //(iv) K is the clutch strength + //(v) wEng is the angular speed of the engine + + //torque applied to ith wheel is + //ti = G*gammai*tc + bt(i) + tt(i) + //where + //gammai is the fractional proportion of the clutch torque that the differential delivers to the ith wheel + //bt(i) is the brake torque applied to the ith wheel + //tt(i) is the tire torque applied to the ith wheel + + //acceleration applied to ith wheel is + //ai = G*gammai*K*{G*[alpha0*w0 + alpha1*w1 alpha2*w2 + ..... alpha(N-1)*w(N-1)] - wEng}/Ii + (bt(i) + tt(i))/Ii + //wheer Ii is the moi of the ith wheel + + //express ai as + //ai = [wi(t+dt) - wi(t)]/dt + //and rearrange + //wi(t+dt) - wi(t)] = dt*G*gammai*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1)(t+dt)] - wEng(t+dt)}/Ii + dt*(bt(i) + tt(i))/Ii + + //Do the same for tEng (torque applied to engine) + //tEng = -tc + engineDriveTorque + //where engineDriveTorque is the drive torque applied to the engine + //Assuming the engine has unit mass then + //wEng(t+dt) -wEng(t) = -dt*K*{G*[alpha0*w0(t+dt) + alpha1*w1(t+dt) + alpha2*w2(t+dt) + ..... alpha(N-1)*w(N-1(t+dt))] - wEng(t+dt)}/Ieng + dt*engineDriveTorque]/IEng + + //Introduce the vector w=(w0,w1,w2....w(N-1), wEng) + //and re-express as a matrix after collecting all unknowns at (t+dt) and knowns at time t. + //A*w(t+dt)=b(t); + + PxVehicleMatrixNN M(nbConnectedWheelIds + 1); + PxVehicleVectorN b(nbConnectedWheelIds + 1); + PxVehicleVectorN result(nbConnectedWheelIds + 1); + + const PxF32 KG = K * G; + const PxF32 KGG = K * G*G; + + //Wheels + { + for (PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + const PxF32 dt = DT / connectedWheelMois[i]; + const PxF32 R = connectedWheelDiffTorqueRatios[i]; + const PxF32 g = connectedWheelGearings[i]; + const PxF32 dtKGGRg = dt * KGG*R*g; + + for(PxU32 j = 0; j < nbConnectedWheelIds; j++) + { + M.set(i, j, dtKGGRg*connectedWheelAveWheelSpeedContributions[j]*connectedWheelGearings[j]); + } + M.set(i, i, 1.0f + dtKGGRg*connectedWheelAveWheelSpeedContributions[i]*connectedWheelGearings[i] + dt * connectedWheelDampingRates[i]); + M.set(i, nbConnectedWheelIds, -dt*KG*R*g); + b[i] = connectedWheelRotSpeeds[i] + dt * (connectedWheelBrakeTorques[i] + connectedWheelTireTorques[i]); + result[i] = connectedWheelRotSpeeds[i]; + } + } + + //Engine. + { + const PxF32 dt = DT / engineParams.moi; + const PxF32 dtKG = dt*K*G; + for(PxU32 j = 0; j < nbConnectedWheelIds; j++) + { + M.set(nbConnectedWheelIds, j, -dtKG * connectedWheelAveWheelSpeedContributions[j]* connectedWheelGearings[j]); + } + M.set(nbConnectedWheelIds, nbConnectedWheelIds, 1.0f + dt * (K + engineDampingRate)); + b[nbConnectedWheelIds] = engineState.rotationSpeed + dt * engineDriveTorque; + result[nbConnectedWheelIds] = engineState.rotationSpeed; + } + + if (constraintGroupState && constraintGroupState->getNbConstraintGroups() > 0) + { + const PxU32 nbConstraintGroups = constraintGroupState->getNbConstraintGroups(); + + //Count the wheels not in a constraint group. + PxU32 connectedWheelsNotInConstraintGroup[PxVehicleLimits::eMAX_NB_WHEELS]; + PxU32 nbConnectedWheelsNotInConstraintGroup = 0; + countConnectedWheelsNotInConstraintGroup( + connectedWheelIds, nbConnectedWheelIds, *constraintGroupState, + connectedWheelsNotInConstraintGroup, nbConnectedWheelsNotInConstraintGroup); + + //After applying constraint groups: + // number of columns remains nbConnectedWheelIds + 1 + // each row will be of length nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups + 1 + PxVehicleMatrixNN A(nbConnectedWheelIds + 1); + for (PxU32 i = 0; i < nbConnectedWheelIds + 1; i++) + { + //1 entry for each wheel not in a constraint group. + for (PxU32 j = 0; j < nbConnectedWheelsNotInConstraintGroup; j++) + { + const PxU32 wheelId = connectedWheelsNotInConstraintGroup[j]; + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + const PxF32 MIJ = M.get(i, connectedWheelId); + A.set(i, j, MIJ); + } + + //1 entry for each constraint group. + for (PxU32 j = nbConnectedWheelsNotInConstraintGroup; j < nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups; j++) + { + const PxU32 constraintGroupId = (j - nbConnectedWheelsNotInConstraintGroup); + + PxF32 sum = 0.0f; + //for (PxU32 k = 0; k < 1; k++) + { + //k = 0 is a special case with multiplier = 1.0. + const PxU32 wheelId = constraintGroupState->getWheelInConstraintGroup(0, constraintGroupId); + const PxF32 multiplier = 1.0f; + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + const PxF32 MIK = M.get(i, connectedWheelId); + sum += MIK * multiplier; + } + for (PxU32 k = 1; k < constraintGroupState->getNbWheelsInConstraintGroup(constraintGroupId); k++) + { + const PxU32 wheelId = constraintGroupState->getWheelInConstraintGroup(k, constraintGroupId); + const PxF32 multiplier = constraintGroupState->getMultiplierInConstraintGroup(k, constraintGroupId); + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + const PxF32 MIK = M.get(i, connectedWheelId); + sum += MIK*multiplier; + } + A.set(i, j, sum); + } + + //1 entry for the engine. + { + const PxF32 MIJ = M.get(i, nbConnectedWheelIds); + A.set(i, nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups, MIJ); + } + } + + const PxU32 N = (nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups + 1); + //Compute A^T * A + PxVehicleMatrixNN ATA(N); + for (PxU32 i = 0; i < N; i++) + { + for (PxU32 j = 0; j < N; j++) + { + PxF32 sum = 0.0f; + for (PxU32 k = 0; k < nbConnectedWheelIds + 1; k++) + { + sum += A.get(k, i)*A.get(k, j); + } + ATA.set(i, j, sum); + } + } + + //Compute A^T*b; + PxVehicleVectorN ATb(N); + for (PxU32 i = 0; i < N; i++) + { + PxF32 sum = 0; + for (PxU32 j = 0; j < nbConnectedWheelIds + 1; j++) + { + sum += A.get(j, i)*b[j]; + } + ATb[i] = sum; + } + + //Solve it. + PxVehicleMatrixNNLUSolver solver; + PxVehicleVectorN result2(N); + solver.decomposeLU(ATA); + solver.solve(ATb, result2); + + //Map from result2 back to result. + for (PxU32 j = 0; j < nbConnectedWheelsNotInConstraintGroup; j++) + { + const PxU32 wheelId = connectedWheelsNotInConstraintGroup[j]; + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + result[connectedWheelId] = result2[j]; + } + for (PxU32 j = nbConnectedWheelsNotInConstraintGroup; j < nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups; j++) + { + const PxU32 constraintGroupId = (j - nbConnectedWheelsNotInConstraintGroup); + //for (PxU32 k = 0; k < 1; k++) + { + //k = 0 is a special case with multiplier = 1.0 + const PxU32 wheelId = constraintGroupState->getWheelInConstraintGroup(0, constraintGroupId); + const PxF32 multiplier = 1.0f; + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + result[connectedWheelId] = multiplier * result2[j]; + } + for (PxU32 k = 1; k < constraintGroupState->getNbWheelsInConstraintGroup(constraintGroupId); k++) + { + const PxU32 wheelId = constraintGroupState->getWheelInConstraintGroup(k, constraintGroupId); + const PxF32 multiplier = constraintGroupState->getMultiplierInConstraintGroup(k, constraintGroupId); + const PxU32 connectedWheelId = wheelIdToConnectedWheelId[wheelId]; + result[connectedWheelId] = multiplier * result2[j]; + } + } + { + result[nbConnectedWheelIds] = result2[nbConnectedWheelsNotInConstraintGroup + nbConstraintGroups]; + } + } + else if (PxVehicleClutchAccuracyMode::eBEST_POSSIBLE == clutchParams.accuracyMode) + { + //Solve Aw=b + PxVehicleMatrixNNLUSolver solver; + solver.decomposeLU(M); + solver.solve(b, result); + //PX_WARN_ONCE_IF(!isValid(A, b, result), "Unable to compute new PxVehicleDrive4W internal rotation speeds. Please check vehicle sim data, especially clutch strength; engine moi and damping; wheel moi and damping"); + } + else + { + PxVehicleMatrixNGaussSeidelSolver solver; + solver.solve(clutchParams.estimateIterations, 1e-10f, M, b, result); + } + + //Check for sanity in the resultant internal rotation speeds. + //If the brakes are on and the wheels have switched direction then lock them at zero. + //A consequence of this quick fix is that locked wheels remain locked until the brake is entirely released. + //This isn't strictly mathematically or physically correct - a more accurate solution would either formulate the + //brake as a lcp problem or repeatedly solve with constraints that locked wheels remain at zero rotation speed. + //The physically correct solution will certainly be more expensive so let's live with the restriction that + //locked wheels remain locked until the brake is released. + //newOmega=result[i], oldOmega=wheelSpeeds[i], if newOmega*oldOmega<=0 and isBrakeApplied then lock wheel. + for(PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + result[i] = (connectedWheelIsBrakeApplied[i] && (connectedWheelRotSpeeds[i] * result[i] <= 0)) ? 0.0f : result[i]; + } + //Clamp the engine revs. + //Again, this is not physically or mathematically correct but the loss in behaviour will be hard to notice. + //The alternative would be to add constraints to the solver, which would be much more expensive. + result[nbConnectedWheelIds] = PxClamp(result[nbConnectedWheelIds], engineParams.idleOmega, engineParams.maxOmega); + + //Copy back to the car's internal rotation speeds. + for (PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + const PxU32 wheelId = connectedWheelIds[i]; + wheelRigidbody1dStates[wheelId].rotationSpeed = result[i]; + } + engineState.rotationSpeed = result[nbConnectedWheelIds]; + + //Update the undriven wheels. + bool isDrivenWheel[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemZero(isDrivenWheel, sizeof(isDrivenWheel)); + for(PxU32 i = 0; i < nbConnectedWheelIds; i++) + { + const PxU32 wheelId = connectedWheelIds[i]; + isDrivenWheel[wheelId] = true; + } + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + if (!isDrivenWheel[wheelId]) + { + PxVehicleDirectDriveUpdate( + wheelParams[wheelId], + actuationStates[wheelId], + brakeResponseStates[wheelId], 0.0f, + tireForces[wheelId], DT, wheelRigidbody1dStates[wheelId]); + } + } +} + +void PxVehicleClutchCommandResponseLinearUpdate +(const PxReal clutchCommand, + const PxVehicleClutchCommandResponseParams& clutchResponseParams, + PxVehicleClutchCommandResponseState& clutchResponse) +{ + clutchResponse.normalisedCommandResponse = (1.0f - clutchCommand); + clutchResponse.commandResponse = (1.0f - clutchCommand)*clutchResponseParams.maxResponse; +} + +void PxVehicleEngineDriveThrottleCommandResponseLinearUpdate +(const PxVehicleCommandState& commands, + PxVehicleEngineDriveThrottleCommandResponseState& throttleResponse) +{ + throttleResponse.commandResponse = commands.throttle; +} + + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainHelpers.cpp new file mode 100644 index 0000000..38287b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/drivetrain/VhDrivetrainHelpers.cpp @@ -0,0 +1,439 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleFunctions.h" +#include "vehicle2/PxVehicleMaths.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainHelpers.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" + +#include "vehicle2/wheel/PxVehicleWheelStates.h" + + +namespace physx +{ +namespace vehicle2 +{ + +void PxVehicleMatrixNNLUSolver::decomposeLU(const PxVehicleMatrixNN& A) +{ + const PxU32 D = A.mSize; + + mLU = A; + + mDetM = 1.0f; + + for (PxU32 k = 0; k < D - 1; ++k) + { + PxU32 pivot_row = k; + PxU32 pivot_col = k; + float abs_pivot_elem = 0.0f; + for (PxU32 c = k; c < D; ++c) + { + for (PxU32 r = k; r < D; ++r) + { + const PxF32 abs_elem = PxAbs(mLU.get(r, c)); + if (abs_elem > abs_pivot_elem) + { + abs_pivot_elem = abs_elem; + pivot_row = r; + pivot_col = c; + } + } + } + + mP[k] = pivot_row; + if (pivot_row != k) + { + mDetM = -mDetM; + for (PxU32 c = 0; c < D; ++c) + { + //swap(m_LU(k,c), m_LU(pivot_row,c)); + const PxF32 pivotrowc = mLU.get(pivot_row, c); + mLU.set(pivot_row, c, mLU.get(k, c)); + mLU.set(k, c, pivotrowc); + } + } + + mQ[k] = pivot_col; + if (pivot_col != k) + { + mDetM = -mDetM; + for (PxU32 r = 0; r < D; ++r) + { + //swap(m_LU(r,k), m_LU(r,pivot_col)); + const PxF32 rpivotcol = mLU.get(r, pivot_col); + mLU.set(r, pivot_col, mLU.get(r, k)); + mLU.set(r, k, rpivotcol); + } + } + + mDetM *= mLU.get(k, k); + + if (mLU.get(k, k) != 0.0f) + { + for (PxU32 r = k + 1; r < D; ++r) + { + mLU.set(r, k, mLU.get(r, k) / mLU.get(k, k)); + for (PxU32 c = k + 1; c < D; ++c) + { + //m_LU(r,c) -= m_LU(r,k)*m_LU(k,c); + const PxF32 rc = mLU.get(r, c); + const PxF32 rk = mLU.get(r, k); + const PxF32 kc = mLU.get(k, c); + mLU.set(r, c, rc - rk * kc); + } + } + } + } + + mDetM *= mLU.get(D - 1, D - 1); +} + +bool PxVehicleMatrixNNLUSolver::solve(const PxVehicleVectorN& b, PxVehicleVectorN& x) const +{ + const PxU32 D = x.getSize(); + + if ((b.getSize() != x.getSize()) || (b.getSize() != mLU.getSize()) || (0.0f == mDetM)) + { + for (PxU32 i = 0; i < D; i++) + { + x[i] = 0.0f; + } + return false; + } + + x = b; + + // Perform row permutation to get Pb + for (PxU32 i = 0; i < D - 1; ++i) + { + //swap(x(i), x(m_P[i])); + const PxF32 xp = x[mP[i]]; + x[mP[i]] = x[i]; + x[i] = xp; + } + + // Forward substitute to get (L^-1)Pb + for (PxU32 r = 1; r < D; ++r) + { + for (PxU32 i = 0; i < r; ++i) + { + x[r] -= mLU.get(r, i)*x[i]; + } + } + + // Back substitute to get (U^-1)(L^-1)Pb + for (PxU32 r = D; r-- > 0;) + { + for (PxU32 i = r + 1; i < D; ++i) + { + x[r] -= mLU.get(r, i)*x[i]; + } + x[r] /= mLU.get(r, r); + } + + // Perform column permutation to get the solution (Q^T)(U^-1)(L^-1)Pb + for (PxU32 i = D - 1; i-- > 0;) + { + //swap(x(i), x(m_Q[i])); + const PxF32 xq = x[mQ[i]]; + x[mQ[i]] = x[i]; + x[i] = xq; + } + + return true; +} + +void PxVehicleMatrixNGaussSeidelSolver::solve(const PxU32 maxIterations, const PxF32 tolerance, const PxVehicleMatrixNN& A, const PxVehicleVectorN& b, PxVehicleVectorN& result) const +{ + const PxU32 N = A.getSize(); + + PxVehicleVectorN DInv(N); + PxF32 bLength2 = 0.0f; + for (PxU32 i = 0; i < N; i++) + { + DInv[i] = 1.0f / A.get(i, i); + bLength2 += (b[i] * b[i]); + } + + PxU32 iteration = 0; + PxF32 error = PX_MAX_F32; + while (iteration < maxIterations && tolerance < error) + { + for (PxU32 i = 0; i < N; i++) + { + PxF32 l = 0.0f; + for (PxU32 j = 0; j < i; j++) + { + l += A.get(i, j) * result[j]; + } + + PxF32 u = 0.0f; + for (PxU32 j = i + 1; j < N; j++) + { + u += A.get(i, j) * result[j]; + } + + result[i] = DInv[i] * (b[i] - l - u); + } + + //Compute the error. + PxF32 rLength2 = 0; + for (PxU32 i = 0; i < N; i++) + { + PxF32 e = -b[i]; + for (PxU32 j = 0; j < N; j++) + { + e += A.get(i, j) * result[j]; + } + rLength2 += e * e; + } + error = (rLength2 / (bLength2 + 1e-10f)); + + iteration++; + } +} + +bool PxVehicleMatrix33Solver::solve(const PxVehicleMatrixNN& A_, const PxVehicleVectorN& b_, PxVehicleVectorN& result) const +{ + const PxF32 a = A_.get(0, 0); + const PxF32 b = A_.get(0, 1); + const PxF32 c = A_.get(0, 2); + + const PxF32 d = A_.get(1, 0); + const PxF32 e = A_.get(1, 1); + const PxF32 f = A_.get(1, 2); + + const PxF32 g = A_.get(2, 0); + const PxF32 h = A_.get(2, 1); + const PxF32 k = A_.get(2, 2); + + const PxF32 detA = a * (e*k - f * h) - b * (k*d - f * g) + c * (d*h - e * g); + if (0.0f == detA) + { + return false; + } + const PxF32 detAInv = 1.0f / detA; + + const PxF32 A = (e*k - f * h); + const PxF32 D = -(b*k - c * h); + const PxF32 G = (b*f - c * e); + const PxF32 B = -(d*k - f * g); + const PxF32 E = (a*k - c * g); + const PxF32 H = -(a*f - c * d); + const PxF32 C = (d*h - e * g); + const PxF32 F = -(a*h - b * g); + const PxF32 K = (a*e - b * d); + + result[0] = detAInv * (A*b_[0] + D * b_[1] + G * b_[2]); + result[1] = detAInv * (B*b_[0] + E * b_[1] + H * b_[2]); + result[2] = detAInv * (C*b_[0] + F * b_[1] + K * b_[2]); + + return true; +} + +void PxVehicleLegacyDifferentialWheelSpeedContributionsCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxU32 nbWheels, PxReal* diffAveWheelSpeedContributions) +{ + PxMemZero(diffAveWheelSpeedContributions, sizeof(PxReal) * nbWheels); + + const PxU32 wheelIds[4] = + { + diffParams.frontWheelIds[0], + diffParams.frontWheelIds[1], + diffParams.rearWheelIds[0], + diffParams.rearWheelIds[1], + }; + + const PxF32 frontRearSplit = diffParams.frontRearSplit; + const PxF32 frontNegPosSplit = diffParams.frontNegPosSplit; + const PxF32 rearNegPosSplit = diffParams.rearNegPosSplit; + + const PxF32 oneMinusFrontRearSplit = 1.0f - diffParams.frontRearSplit; + const PxF32 oneMinusFrontNegPosSplit = 1.0f - diffParams.frontNegPosSplit; + const PxF32 oneMinusRearNegPosSplit = 1.0f - diffParams.rearNegPosSplit; + + switch (diffParams.type) + { + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_4WD: + diffAveWheelSpeedContributions[wheelIds[0]] = frontRearSplit * frontNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[1]] = frontRearSplit * oneMinusFrontNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[2]] = oneMinusFrontRearSplit * rearNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[3]] = oneMinusFrontRearSplit * oneMinusRearNegPosSplit; + break; + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_FRONTWD: + diffAveWheelSpeedContributions[wheelIds[0]] = frontNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[1]] = oneMinusFrontNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[2]] = 0.0f; + diffAveWheelSpeedContributions[wheelIds[3]] = 0.0f; + break; + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_REARWD: + diffAveWheelSpeedContributions[wheelIds[0]] = 0.0f; + diffAveWheelSpeedContributions[wheelIds[1]] = 0.0f; + diffAveWheelSpeedContributions[wheelIds[2]] = rearNegPosSplit; + diffAveWheelSpeedContributions[wheelIds[3]] = oneMinusRearNegPosSplit; + break; + default: + PX_ASSERT(false); + break; + } + + PX_ASSERT( + ((diffAveWheelSpeedContributions[wheelIds[0]] + diffAveWheelSpeedContributions[wheelIds[1]] + diffAveWheelSpeedContributions[wheelIds[2]] + diffAveWheelSpeedContributions[wheelIds[3]]) >= 0.999f) && + ((diffAveWheelSpeedContributions[wheelIds[0]] + diffAveWheelSpeedContributions[wheelIds[1]] + diffAveWheelSpeedContributions[wheelIds[2]] + diffAveWheelSpeedContributions[wheelIds[3]]) <= 1.001f)); +} + +PX_FORCE_INLINE void splitTorque +(const PxF32 w1, const PxF32 w2, const PxF32 diffBias, const PxF32 defaultSplitRatio, + PxF32* t1, PxF32* t2) +{ + PX_ASSERT(PxVehicleComputeSign(w1) == PxVehicleComputeSign(w2) && 0.0f != PxVehicleComputeSign(w1)); + const PxF32 w1Abs = PxAbs(w1); + const PxF32 w2Abs = PxAbs(w2); + const PxF32 omegaMax = PxMax(w1Abs, w2Abs); + const PxF32 omegaMin = PxMin(w1Abs, w2Abs); + const PxF32 delta = omegaMax - diffBias * omegaMin; + const PxF32 deltaTorque = physx::intrinsics::fsel(delta, delta / omegaMax, 0.0f); + const PxF32 f1 = physx::intrinsics::fsel(w1Abs - w2Abs, defaultSplitRatio*(1.0f - deltaTorque), defaultSplitRatio*(1.0f + deltaTorque)); + const PxF32 f2 = physx::intrinsics::fsel(w1Abs - w2Abs, (1.0f - defaultSplitRatio)*(1.0f + deltaTorque), (1.0f - defaultSplitRatio)*(1.0f - deltaTorque)); + const PxF32 denom = 1.0f / (f1 + f2); + *t1 = f1 * denom; + *t2 = f2 * denom; + PX_ASSERT((*t1 + *t2) >= 0.999f && (*t1 + *t2) <= 1.001f); +} + +void PxVehicleLegacyDifferentialTorqueRatiosCompute +(const PxVehicleFourWheelDriveDifferentialLegacyParams& diffParams, + const PxVehicleArrayData& wheelOmegas, + const PxU32 nbWheels, PxReal* diffTorqueRatios) +{ + PxMemZero(diffTorqueRatios, sizeof(PxReal) * nbWheels); + + const PxU32 wheelIds[4] = + { + diffParams.frontWheelIds[0], + diffParams.frontWheelIds[1], + diffParams.rearWheelIds[0], + diffParams.rearWheelIds[1], + }; + + const PxF32 wfl = wheelOmegas[wheelIds[0]].rotationSpeed; + const PxF32 wfr = wheelOmegas[wheelIds[1]].rotationSpeed; + const PxF32 wrl = wheelOmegas[wheelIds[2]].rotationSpeed; + const PxF32 wrr = wheelOmegas[wheelIds[3]].rotationSpeed; + + const PxF32 centreBias = diffParams.centerBias; + const PxF32 frontBias = diffParams.frontBias; + const PxF32 rearBias = diffParams.rearBias; + + const PxF32 frontRearSplit = diffParams.frontRearSplit; + const PxF32 frontLeftRightSplit = diffParams.frontNegPosSplit; + const PxF32 rearLeftRightSplit = diffParams.rearNegPosSplit; + + const PxF32 oneMinusFrontRearSplit = 1.0f - diffParams.frontRearSplit; + const PxF32 oneMinusFrontLeftRightSplit = 1.0f - diffParams.frontNegPosSplit; + const PxF32 oneMinusRearLeftRightSplit = 1.0f - diffParams.rearNegPosSplit; + + const PxF32 swfl = PxVehicleComputeSign(wfl); + + //Split a torque of 1 between front and rear. + //Then split that torque between left and right. + PxF32 torqueFrontLeft = 0; + PxF32 torqueFrontRight = 0; + PxF32 torqueRearLeft = 0; + PxF32 torqueRearRight = 0; + switch (diffParams.type) + { + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_4WD: + if (0.0f != swfl && swfl == PxVehicleComputeSign(wfr) && swfl == PxVehicleComputeSign(wrl) && swfl == PxVehicleComputeSign(wrr)) + { + PxF32 torqueFront, torqueRear; + const PxF32 omegaFront = PxAbs(wfl + wfr); + const PxF32 omegaRear = PxAbs(wrl + wrr); + splitTorque(omegaFront, omegaRear, centreBias, frontRearSplit, &torqueFront, &torqueRear); + splitTorque(wfl, wfr, frontBias, frontLeftRightSplit, &torqueFrontLeft, &torqueFrontRight); + splitTorque(wrl, wrr, rearBias, rearLeftRightSplit, &torqueRearLeft, &torqueRearRight); + torqueFrontLeft *= torqueFront; + torqueFrontRight *= torqueFront; + torqueRearLeft *= torqueRear; + torqueRearRight *= torqueRear; + } + else + { + torqueFrontLeft = frontRearSplit * frontLeftRightSplit; + torqueFrontRight = frontRearSplit * oneMinusFrontLeftRightSplit; + torqueRearLeft = oneMinusFrontRearSplit * rearLeftRightSplit; + torqueRearRight = oneMinusFrontRearSplit * oneMinusRearLeftRightSplit; + } + break; + + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_FRONTWD: + if (0.0f != swfl && swfl == PxVehicleComputeSign(wfr)) + { + splitTorque(wfl, wfr, frontBias, frontLeftRightSplit, &torqueFrontLeft, &torqueFrontRight); + } + else + { + torqueFrontLeft = frontLeftRightSplit; + torqueFrontRight = oneMinusFrontLeftRightSplit; + } + break; + + case PxVehicleFourWheelDriveDifferentialLegacyParams::eDIFF_TYPE_LS_REARWD: + + if (0.0f != PxVehicleComputeSign(wrl) && PxVehicleComputeSign(wrl) == PxVehicleComputeSign(wrr)) + { + splitTorque(wrl, wrr, rearBias, rearLeftRightSplit, &torqueRearLeft, &torqueRearRight); + } + else + { + torqueRearLeft = rearLeftRightSplit; + torqueRearRight = oneMinusRearLeftRightSplit; + } + break; + + default: + PX_ASSERT(false); + break; + } + + diffTorqueRatios[wheelIds[0]] = torqueFrontLeft; + diffTorqueRatios[wheelIds[1]] = torqueFrontRight; + diffTorqueRatios[wheelIds[2]] = torqueRearLeft; + diffTorqueRatios[wheelIds[3]] = torqueRearRight; + + PX_ASSERT(((torqueFrontLeft + torqueFrontRight + torqueRearLeft + torqueRearRight) >= 0.999f) && ((torqueFrontLeft + torqueFrontRight + torqueRearLeft + torqueRearRight) <= 1.001f)); +} + + +} //namespace vehicle2 +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorFunctions.cpp new file mode 100644 index 0000000..0d87cf2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorFunctions.cpp @@ -0,0 +1,348 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandStates.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/physxActor/PxVehiclePhysXActorFunctions.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +#include "PxRigidDynamic.h" +#include "PxArticulationLink.h" +#include "PxArticulationReducedCoordinate.h" + +namespace physx +{ +namespace vehicle2 +{ + +void PxVehiclePhysxActorWakeup( + const PxVehicleCommandState& commands, + const PxVehicleEngineDriveTransmissionCommandState* transmissionCommands, + const PxVehicleGearboxParams* gearParams, + const PxVehicleGearboxState* gearState, + PxRigidBody& physxActor, + PxVehiclePhysXSteerState& physxSteerState) +{ + PX_CHECK_AND_RETURN(!(physxActor.getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehiclePhysxActorWakeup: physxActor is kinematic. This is not supported"); + + PxRigidDynamic* rd = physxActor.is(); + PxArticulationLink* link = physxActor.is(); + bool intentToChangeState = ((commands.throttle != 0.0f) || ((PX_VEHICLE_UNSPECIFIED_STEER_STATE != physxSteerState.previousSteerCommand) && (commands.steer != physxSteerState.previousSteerCommand))); + if (!intentToChangeState && transmissionCommands) + { + PX_ASSERT(gearParams); + PX_ASSERT(gearState); + + // Manual gear switch (includes going from neutral or reverse to automatic) + intentToChangeState = (gearState->currentGear == gearState->targetGear) && + (((transmissionCommands->targetGear != PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR) && (gearState->targetGear != transmissionCommands->targetGear)) || + ((transmissionCommands->targetGear == PxVehicleEngineDriveTransmissionCommandState::eAUTOMATIC_GEAR) && (gearState->currentGear <= gearParams->neutralGear))); + } + + if(rd && rd->isSleeping() && intentToChangeState) + { + rd->wakeUp(); + } + else if(link && link->getArticulation().isSleeping() && intentToChangeState) + { + link->getArticulation().wakeUp(); + } + + physxSteerState.previousSteerCommand = commands.steer; +} + +bool PxVehiclePhysxActorSleepCheck +(const PxVehicleAxleDescription& axleDescription, + const PxRigidBody& physxActor, + const PxVehicleEngineParams* engineParams, + PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraints& physxConstraints, + PxVehicleArrayData& wheelRigidBody1dStates, + PxVehicleEngineState* engineState) +{ + PX_CHECK_AND_RETURN_VAL(!(physxActor.getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehiclePhysxActorSleepCheck: physxActor is kinematic. This is not supported", false); + + const PxRigidDynamic* rd = physxActor.is(); + const PxArticulationLink* link = physxActor.is(); + + bool isSleeping = false; + if (rd && rd->isSleeping()) + { + isSleeping = true; + } + else if (link && link->getArticulation().isSleeping()) + { + isSleeping = true; + } + + if (isSleeping) + { + // note: pose is not copied as isSleeping() implies that pose was not changed by the + // simulation step (see docu). If a user explicitly calls putToSleep or manually + // changes pose, it will only get reflected in the vehicle rigid body state once + // the body wakes up. + + rigidBodyState.linearVelocity = PxVec3(PxZero); + rigidBodyState.angularVelocity = PxVec3(PxZero); + rigidBodyState.previousLinearVelocity = PxVec3(PxZero); + rigidBodyState.previousAngularVelocity = PxVec3(PxZero); + + bool markConstraintsDirty = false; + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + PxVehicleWheelRigidBody1dState& wheelState = wheelRigidBody1dStates[wheelId]; + wheelState.rotationSpeed = 0.0f; + wheelState.correctedRotationSpeed = 0.0f; + + // disable constraints if there are active ones. The idea is that if something + // is crashing into a sleeping vehicle and waking it up, then the vehicle should + // be able to move if the impact was large enough. Thus, there is also no logic + // to reset the sticky tire timers, for example. If the impact was small, the + // constraints should potentially kick in again in the subsequent sim step. + PxVehiclePhysXConstraintState& constraintState = physxConstraints.constraintStates[wheelId]; + if (constraintState.tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] || + constraintState.tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL] || + constraintState.suspActiveStatus) + { + constraintState.tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] = false; + constraintState.tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL] = false; + constraintState.suspActiveStatus = false; + + markConstraintsDirty = true; + } + } + + if (markConstraintsDirty) + PxVehicleConstraintsDirtyStateUpdate(physxConstraints); + + if (engineState) + { + PX_ASSERT(engineParams); + engineState->rotationSpeed = engineParams->idleOmega; + } + } + + return isSleeping; +} + +PX_FORCE_INLINE static void setWakeCounter(const PxReal wakeCounter, PxRigidDynamic* rd, PxArticulationLink* link) +{ + if (rd && (!(rd->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + rd->setWakeCounter(wakeCounter); + } + else if (link) + { + link->getArticulation().setWakeCounter(wakeCounter); + } +} + +void PxVehiclePhysxActorKeepAwakeCheck +(const PxVehicleAxleDescription& axleDescription, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxReal wakeCounterThreshold, + const PxReal wakeCounterResetValue, + const PxVehicleGearboxState* gearState, + PxRigidBody& physxActor) +{ + PX_CHECK_AND_RETURN(!(physxActor.getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehiclePhysxActorKeepAwakeCheck: physxActor is kinematic. This is not supported"); + + PxRigidDynamic* rd = physxActor.is(); + PxArticulationLink* link = physxActor.is(); + + PxReal wakeCounter = PX_MAX_REAL; + if (rd) + { + wakeCounter = rd->getWakeCounter(); + } + else if (link) + { + wakeCounter = link->getArticulation().getWakeCounter(); + } + + if (wakeCounter < wakeCounterThreshold) + { + if (gearState && (gearState->currentGear != gearState->targetGear)) + { + setWakeCounter(wakeCounterResetValue, rd, link); + + return; + } + + for (PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + const PxVehicleWheelParams& wheelParam = wheelParams[wheelId]; + const PxVehicleWheelRigidBody1dState& wheelState = wheelRigidBody1dStates[wheelId]; + + // note: the translational part of the energy is ignored here as this is mainly for + // scenarios where there is almost no translation but the wheels are spinning + + const PxReal normalizedEnergy = (0.5f * wheelState.correctedRotationSpeed * wheelState.correctedRotationSpeed * + wheelParam.moi) / wheelParam.mass; + + PxReal sleepThreshold = PX_MAX_REAL; + if (rd) + { + sleepThreshold = rd->getSleepThreshold(); + } + else if (link) + { + sleepThreshold = link->getArticulation().getSleepThreshold(); + } + + if (normalizedEnergy > sleepThreshold) + { + setWakeCounter(wakeCounterResetValue, rd, link); + return; + } + } + } +} + +void PxVehicleReadRigidBodyStateFromPhysXActor +(const PxRigidBody& physxActor, + PxVehicleRigidBodyState& rigidBodyState) +{ + PX_CHECK_AND_RETURN(!(physxActor.getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehicleReadRigidBodyStateFromPhysXActor: physxActor is kinematic. This is not supported"); + + const PxRigidDynamic* rd = physxActor.is(); + const PxArticulationLink* link = physxActor.is(); + PX_ASSERT(rd || link); + + if(rd) + { + rigidBodyState.pose = physxActor.getGlobalPose()*physxActor.getCMassLocalPose(); + rigidBodyState.angularVelocity = rd->getAngularVelocity(); + rigidBodyState.linearVelocity = rd->getLinearVelocity(); + } + else + { + rigidBodyState.pose = physxActor.getGlobalPose()*physxActor.getCMassLocalPose(); + rigidBodyState.angularVelocity = link->getAngularVelocity(); + rigidBodyState.linearVelocity = link->getLinearVelocity(); + } + rigidBodyState.previousLinearVelocity = rigidBodyState.linearVelocity; + rigidBodyState.previousAngularVelocity = rigidBodyState.angularVelocity; +} + +void PxVehicleWriteWheelLocalPoseToPhysXWheelShape +(const PxTransform& wheelLocalPose, const PxTransform& wheelShapeLocalPose, PxShape* shape) +{ + if(!shape) + return; + + PxRigidActor* ra = shape->getActor(); + if(!ra) + return; + + PxRigidBody* rb = ra->is(); + if(!rb) + return; + + PX_CHECK_AND_RETURN(!(rb->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehicleWriteWheelLocalPoseToPhysXWheelShape: shape is attached to a kinematic actor. This is not supported"); + + //Local pose in actor frame. + const PxTransform& localPoseCMassFrame = wheelLocalPose*wheelShapeLocalPose; + const PxTransform cmassLocalPose = rb->getCMassLocalPose(); + const PxTransform localPoseActorFrame = cmassLocalPose * localPoseCMassFrame; + + //Apply the local pose to the shape. + shape->setLocalPose(localPoseActorFrame); +} + +void PxVehicleWriteRigidBodyStateToPhysXActor +(const PxVehiclePhysXActorUpdateMode::Enum updateMode, + const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, + PxRigidBody& rb) +{ + PX_CHECK_AND_RETURN(!(rb.getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC), "PxVehicleWriteRigidBodyStateToPhysXActor: physxActor is kinematic. This is not supported"); + + PxRigidDynamic* rd = rb.is(); + PxArticulationLink* link = rb.is(); + PX_ASSERT(rd || link); + + if(rb.getScene() && // check for scene to support immediate mode style vehicles + ((rd && rd->isSleeping()) || (link && link->getArticulation().isSleeping()))) + { + // note: sort of a safety mechanism to be able to keep running the full vehicle pipeline + // even if the physx actor fell asleep. Without it, the vehicle state can drift from + // physx actor state in the course of multiple simulation steps up to the point + // where the physx actor suddenly wakes up. + return; + } + + switch (updateMode) + { + case PxVehiclePhysXActorUpdateMode::eAPPLY_VELOCITY: + { + PX_ASSERT(rd); + rd->setLinearVelocity(rigidBodyState.linearVelocity, false); + rd->setAngularVelocity(rigidBodyState.angularVelocity, false); + } + break; + case PxVehiclePhysXActorUpdateMode::eAPPLY_ACCELERATION: + { + const PxVec3 linAccel = (rigidBodyState.linearVelocity - rigidBodyState.previousLinearVelocity)/dt; + const PxVec3 angAccel = (rigidBodyState.angularVelocity - rigidBodyState.previousAngularVelocity)/dt; + if (rd) + { + rd->addForce(linAccel, PxForceMode::eACCELERATION, false); + rd->addTorque(angAccel, PxForceMode::eACCELERATION, false); + } + else + { + PX_ASSERT(link); + link->addForce(linAccel, PxForceMode::eACCELERATION, false); + link->addTorque(angAccel, PxForceMode::eACCELERATION, false); + } + } + break; + default: + break; + } +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorHelpers.cpp new file mode 100644 index 0000000..b63053e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxActor/VhPhysXActorHelpers.cpp @@ -0,0 +1,189 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" + +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" + +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" +#include "vehicle2/physxActor/PxVehiclePhysXActorHelpers.h" + +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +#include "cooking/PxCooking.h" +#include "PxPhysics.h" +#include "PxRigidDynamic.h" +#include "PxArticulationReducedCoordinate.h" +#include "PxArticulationLink.h" +#include "PxScene.h" +#include "extensions/PxDefaultStreams.h" + + +namespace physx +{ +namespace vehicle2 +{ + +void createShapes( + const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxRigidBody* rd, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor) +{ + //Create a shape for the vehicle body. + { + PxShape* shape = physics.createShape(rigidActorShapeParams.geometry, rigidActorShapeParams.material, true); + shape->setLocalPose(rigidActorShapeParams.localPose); + shape->setFlags(rigidActorShapeParams.flags); + shape->setSimulationFilterData(rigidActorShapeParams.simulationFilterData); + shape->setQueryFilterData(rigidActorShapeParams.queryFilterData); + rd->attachShape(*shape); + shape->release(); + } + + //Create shapes for wheels. + for (PxU32 i = 0; i < wheelParams.axleDescription.nbWheels; i++) + { + const PxU32 wheelId = wheelParams.axleDescription.wheelIdsInAxleOrder[i]; + const PxF32 radius = wheelParams.wheelParams[wheelId].radius; + const PxF32 halfWidth = wheelParams.wheelParams[wheelId].halfWidth; + + PxVec3 verts[32]; + for (PxU32 k = 0; k < 16; k++) + { + const PxF32 lng = radius * PxCos(k*2.0f*PxPi / 16.0f); + const PxF32 lat = halfWidth; + const PxF32 vrt = radius * PxSin(k*2.0f*PxPi / 16.0f); + + const PxVec3 pos0 = vehicleFrame.getFrame()*PxVec3(lng, lat, vrt); + const PxVec3 pos1 = vehicleFrame.getFrame()*PxVec3(lng, -lat, vrt); + verts[2 * k + 0] = pos0; + verts[2 * k + 1] = pos1; + } + + // Create descriptor for convex mesh + PxConvexMeshDesc convexDesc; + convexDesc.points.count = 32; + convexDesc.points.stride = sizeof(PxVec3); + convexDesc.points.data = verts; + convexDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + + PxConvexMesh* convexMesh = NULL; + PxDefaultMemoryOutputStream buf; + if (PxCookConvexMesh(params, convexDesc, buf)) + { + PxDefaultMemoryInputData id(buf.getData(), buf.getSize()); + convexMesh = physics.createConvexMesh(id); + } + + PxConvexMeshGeometry convexMeshGeom(convexMesh); + PxShape* wheelShape = physics.createShape(convexMeshGeom, wheelShapeParams.material, true); + wheelShape->setFlags(wheelShapeParams.flags); + wheelShape->setSimulationFilterData(wheelShapeParams.simulationFilterData); + wheelShape->setQueryFilterData(wheelShapeParams.queryFilterData); + + rd->attachShape(*wheelShape); + wheelShape->release(); + convexMesh->release(); + + vehiclePhysXActor.wheelShapes[wheelId] = wheelShape; + } +} + +void PxVehiclePhysXActorCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor) +{ + PxRigidDynamic* rd = physics.createRigidDynamic(PxTransform(PxIdentity)); + vehiclePhysXActor.rigidBody = rd; + PxVehiclePhysXActorConfigure(rigidActorParams, rigidActorCmassLocalPose, *rd); + createShapes(vehicleFrame, rigidActorShapeParams, wheelParams, wheelShapeParams, rd, physics, params, vehiclePhysXActor); +} + +void PxVehiclePhysXActorConfigure +(const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + PxRigidBody& rigidBody) +{ + rigidBody.setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, false); + rigidBody.setCMassLocalPose(rigidActorCmassLocalPose); + rigidBody.setMass(rigidActorParams.rigidBodyParams.mass); + rigidBody.setMassSpaceInertiaTensor(rigidActorParams.rigidBodyParams.moi); + rigidBody.setActorFlag(PxActorFlag::eDISABLE_GRAVITY, true); + rigidBody.setName(rigidActorParams.physxActorName); +} + +void PxVehiclePhysXArticulationLinkCreate +(const PxVehicleFrame& vehicleFrame, + const PxVehiclePhysXRigidActorParams& rigidActorParams, const PxTransform& rigidActorCmassLocalPose, + const PxVehiclePhysXRigidActorShapeParams& rigidActorShapeParams, + const PxVehiclePhysXWheelParams& wheelParams, const PxVehiclePhysXWheelShapeParams& wheelShapeParams, + PxPhysics& physics, const PxCookingParams& params, + PxVehiclePhysXActor& vehiclePhysXActor) +{ + PxArticulationReducedCoordinate* art = physics.createArticulationReducedCoordinate(); + PxArticulationLink* link = art->createLink(NULL, PxTransform(PxIdentity)); + vehiclePhysXActor.rigidBody = link; + PxVehiclePhysXActorConfigure(rigidActorParams, rigidActorCmassLocalPose, *link); + createShapes(vehicleFrame, rigidActorShapeParams, wheelParams, wheelShapeParams, link, physics, params, vehiclePhysXActor); +} + +void PxVehiclePhysXActorDestroy +(PxVehiclePhysXActor& vehiclePhysXActor) +{ + PxRigidDynamic* rd = vehiclePhysXActor.rigidBody->is(); + PxArticulationLink* link = vehiclePhysXActor.rigidBody->is(); + if(rd) + { + rd->release(); + vehiclePhysXActor.rigidBody = NULL; + } + else if(link) + { + PxArticulationReducedCoordinate& articulation = link->getArticulation(); + PxScene* scene = articulation.getScene(); + if(scene) + { + scene->removeArticulation(articulation); + } + link->release(); + articulation.release(); + vehiclePhysXActor.rigidBody = NULL; + } +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintFunctions.cpp new file mode 100644 index 0000000..64199c3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintFunctions.cpp @@ -0,0 +1,161 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintFunctions.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" + +namespace physx +{ +namespace vehicle2 +{ + + +PX_FORCE_INLINE PxVec3 computeAngular +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionComplianceState& suspComplianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& direction) +{ + const PxVec3 cmOffset = rigidBodyState.pose.rotate(suspParams.suspensionAttachment.transform(suspComplianceState.tireForceAppPoint)); + const PxVec3 angular = cmOffset.cross(direction); + // note: not normalized on purpose. The angular component should hold the raw cross product as that + // is needed for the type of constraint we want to set up (see vehicleConstraintSolverPrep). + return angular; +} + +PX_FORCE_INLINE PxVec3 computeTireAngular +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionComplianceState& suspComplianceState, const PxVehicleTireDirectionState& trDirState, const PxVehicleRigidBodyState& rigidBodyState, +const PxVehicleTireDirectionModes::Enum direction) +{ + return computeAngular(suspParams, suspComplianceState, rigidBodyState, trDirState.directions[direction]); +} + +PX_FORCE_INLINE PxVec3 computeSuspAngular +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionComplianceState& suspComplianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& direction) +{ + return computeAngular(suspParams, suspComplianceState, rigidBodyState, direction); +} + +void PxVehiclePhysXConstraintStatesUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxVehiclePhysXSuspensionLimitConstraintParams& suspensionLimitParams, + const PxVehicleSuspensionState& suspState, const PxVehicleSuspensionComplianceState& suspComplianceState, + const PxVec3& groundPlaneNormal, + const PxReal tireStickyDampingLong, const PxReal tireStickyDampingLat, + const PxVehicleTireDirectionState& trDirState, const PxVehicleTireStickyState& trStickyState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehiclePhysXConstraintState& cnstrtState) +{ + cnstrtState.setToDefault(); + + //Sticky tire longitudinal + { + const bool isActive = trStickyState.activeStatus[PxVehicleTireDirectionModes::eLONGITUDINAL]; + cnstrtState.tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] = isActive; + if (isActive) + { + cnstrtState.tireLinears[PxVehicleTireDirectionModes::eLONGITUDINAL] = trDirState.directions[PxVehicleTireDirectionModes::eLONGITUDINAL]; + cnstrtState.tireAngulars[PxVehicleTireDirectionModes::eLONGITUDINAL] = computeTireAngular(suspParams, suspComplianceState, trDirState, rigidBodyState, PxVehicleTireDirectionModes::eLONGITUDINAL); + cnstrtState.tireDamping[PxVehicleTireDirectionModes::eLONGITUDINAL] = tireStickyDampingLong; + } + } + + //Sticky tire lateral + { + const bool isActive = trStickyState.activeStatus[PxVehicleTireDirectionModes::eLATERAL]; + cnstrtState.tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL] = isActive; + if (isActive) + { + cnstrtState.tireLinears[PxVehicleTireDirectionModes::eLATERAL] = trDirState.directions[PxVehicleTireDirectionModes::eLATERAL]; + cnstrtState.tireAngulars[PxVehicleTireDirectionModes::eLATERAL] = computeTireAngular(suspParams, suspComplianceState, trDirState, rigidBodyState, PxVehicleTireDirectionModes::eLATERAL); + cnstrtState.tireDamping[PxVehicleTireDirectionModes::eLATERAL] = tireStickyDampingLat; + } + } + + //Suspension limit + { + if (suspState.separation >= 0.0f || PxVehiclePhysXSuspensionLimitConstraintParams::eNONE == suspensionLimitParams.directionForSuspensionLimitConstraint) + { + cnstrtState.suspActiveStatus = false; + } + else + { + // To maintain the wheel on the ground plane, the suspension is required to compress beyond the suspension compression limit + // or expand beyond maximum droop (for example, top of wheel being in collision with something). + // We manage the compression up to the limit with a suspension force. + // Everything beyond the limits is managed with an impulse applied to the rigid body via a constraint. + // The constraint attempts to resolve the geometric error declared in the separation state. + // We have two choices: + // 1) apply the impulse along the suspension dir (more like the effect of a bump stop spring) + // 2) apply the impulse along the ground normal (more like the effect of a real tire's contact wtih the ground). + if (PxVehiclePhysXSuspensionLimitConstraintParams::eROAD_GEOMETRY_NORMAL == suspensionLimitParams.directionForSuspensionLimitConstraint) + { + cnstrtState.suspActiveStatus = true; + cnstrtState.suspGeometricError = suspState.separation; + cnstrtState.suspLinear = groundPlaneNormal; + cnstrtState.suspAngular = computeSuspAngular(suspParams, suspComplianceState, rigidBodyState, groundPlaneNormal); + cnstrtState.restitution = suspensionLimitParams.restitution; + } + else + { + const PxVec3 suspDirWorldFrame = rigidBodyState.pose.rotate(suspParams.suspensionTravelDir); + const PxF32 projection = groundPlaneNormal.dot(suspDirWorldFrame); + if (projection != 0.0f) + { + cnstrtState.suspActiveStatus = true; + cnstrtState.suspGeometricError = suspState.separation; + const PxVec3 suspLinear = suspDirWorldFrame * PxSign(projection); + cnstrtState.suspLinear = suspLinear; + cnstrtState.suspAngular = computeSuspAngular(suspParams, suspComplianceState, rigidBodyState, suspLinear); + cnstrtState.restitution = suspensionLimitParams.restitution; + } + else + { + cnstrtState.suspActiveStatus = false; + } + } + } + } +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintHelpers.cpp new file mode 100644 index 0000000..9dd633b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxConstraints/VhPhysXConstraintHelpers.cpp @@ -0,0 +1,113 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAllocator.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintHelpers.h" + +#include "vehicle2/physxActor/PxVehiclePhysXActorStates.h" + +#include "PxConstraintDesc.h" +#include "PxConstraint.h" +#include "PxPhysics.h" +#include "PxRigidDynamic.h" +#include "PxArticulationLink.h" + +namespace physx +{ +namespace vehicle2 +{ +PxConstraintShaderTable gVehicleConstraintTable = +{ + vehicleConstraintSolverPrep, + 0, + visualiseVehicleConstraint, + PxConstraintFlag::Enum(0) +}; + +void PxVehicleConstraintsCreate( + const PxVehicleAxleDescription& axleDescription, + PxPhysics& physics, PxRigidBody& physxActor, + PxVehiclePhysXConstraints& vehicleConstraints) +{ + vehicleConstraints.setToDefault(); + + //Each PxConstraint has a limit of 12 1d constraints. + //Each wheel has longitudinal, lateral and suspension limit degrees of freedom. + //This sums up to 3 dofs per wheel and 12 dofs per 4 wheels. + //4 wheels therefore equals 1 PxConstraint + //Iterate over each block of 4 wheels and create a PxConstraints for each block of 4. + PxU32 constraintIndex = 0; + for(PxU32 i = 0; i < axleDescription.getNbWheels(); i+= PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT) + { + void* memory = PX_ALLOC(sizeof(PxVehicleConstraintConnector), PxVehicleConstraintConnector); + PxVehicleConstraintConnector* pxConnector = PX_PLACEMENT_NEW(memory, PxVehicleConstraintConnector)(vehicleConstraints.constraintStates + i); + PxConstraint* pxConstraint = physics.createConstraint(&physxActor, NULL, *pxConnector, gVehicleConstraintTable, sizeof(PxVehiclePhysXConstraintState)*PxVehiclePhysXConstraintLimits::eNB_WHEELS_PER_PXCONSTRAINT); + vehicleConstraints.constraints[constraintIndex] = pxConstraint; + vehicleConstraints.constraintConnectors[constraintIndex] = pxConnector; + constraintIndex++; + } +} + +void PxVehicleConstraintsDirtyStateUpdate +(PxVehiclePhysXConstraints& vehicleConstraints) +{ + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE; i++) + { + if (vehicleConstraints.constraints[i]) + { + vehicleConstraints.constraints[i]->markDirty(); + } + } +} + +void PxVehicleConstraintsDestroy( + PxVehiclePhysXConstraints& vehicleConstraints) +{ + for (PxU32 i = 0; i < PxVehiclePhysXConstraintLimits::eNB_CONSTRAINTS_PER_VEHICLE; i++) + { + if (vehicleConstraints.constraints[i]) + { + vehicleConstraints.constraints[i]->release(); + vehicleConstraints.constraints[i] = NULL; + } + + if (vehicleConstraints.constraintConnectors[i]) + { + vehicleConstraints.constraintConnectors[i]->~PxVehicleConstraintConnector(); + PX_FREE(vehicleConstraints.constraintConnectors[i]); + vehicleConstraints.constraintConnectors[i] = NULL; + } + } +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryFunctions.cpp new file mode 100644 index 0000000..d4fcf1f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryFunctions.cpp @@ -0,0 +1,229 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryFunctions.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" + +#include "extensions/PxRigidBodyExt.h" + +#include "PxScene.h" +#include "PxShape.h" +#include "PxRigidActor.h" +#include "PxMaterial.h" +#include "geometry/PxMeshScale.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxGeometryQuery.h" + +namespace physx +{ +namespace vehicle2 +{ + +PX_FORCE_INLINE PxF32 computeMaterialFriction(const PxShape* hitShape, const PxU32 hitFaceIndex, + const PxVehiclePhysXMaterialFrictionParams& materialFrictionParams, PxMaterial*& hitMaterial) +{ + PxBaseMaterial* baseMaterial = hitShape->getMaterialFromInternalFaceIndex(hitFaceIndex); + PX_ASSERT(!baseMaterial || baseMaterial->getConcreteType()==PxConcreteType::eMATERIAL); + hitMaterial = static_cast(baseMaterial); + PxReal hitFriction = materialFrictionParams.defaultFriction; + for(PxU32 i = 0; i < materialFrictionParams.nbMaterialFrictions; i++) + { + if(materialFrictionParams.materialFrictions[i].material == hitMaterial) + { + hitFriction = materialFrictionParams.materialFrictions[i].friction; + break; + } + } + return hitFriction; +} + +PX_FORCE_INLINE PxVec3 computeVelocity(const PxRigidActor& actor, const PxVec3& hitPoint) +{ + return actor.is() ? PxRigidBodyExt::getVelocityAtPos(*actor.is(), hitPoint) : PxVec3(PxZero); +} + +template +PX_FORCE_INLINE void copyHitInfo(const THitBuffer& hitBuffer, PxMaterial* hitMaterial, + PxVehiclePhysXRoadGeometryQueryState& physxRoadGeometryState) +{ + physxRoadGeometryState.actor = hitBuffer.actor; + physxRoadGeometryState.shape = hitBuffer.shape; + physxRoadGeometryState.material = hitMaterial; + physxRoadGeometryState.hitPosition = hitBuffer.position; +} + +void PxVehiclePhysXRoadGeometryQueryUpdate +(const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspParams, + const PxVehiclePhysXRoadGeometryQueryParams& roadGeomParams, const PxVehiclePhysXMaterialFrictionParams& materialFrictionParams, + const PxF32 steerAngle, const PxVehicleRigidBodyState& rigidBodyState, + const PxScene& scene, const PxConvexMesh* unitCylinderSweepMesh, + const PxVehicleFrame& frame, + PxVehicleRoadGeometryState& roadGeomState, + PxVehiclePhysXRoadGeometryQueryState* physxRoadGeometryState) +{ + if(PxVehiclePhysXRoadGeometryQueryType::eRAYCAST == roadGeomParams.roadGeometryQueryType) + { + //Assume no hits until we know otherwise. + roadGeomState.setToDefault(); + + //Compute the start pos, dir and length of raycast. + PxVec3 v, w; + PxF32 dist; + PxVehicleComputeSuspensionRaycast(frame, wheelParams, suspParams, steerAngle, rigidBodyState.pose, v, w, dist); + + //Perform the raycast. + PxRaycastBuffer buff; + scene.raycast(v, w, dist, buff, PxHitFlag::eDEFAULT, roadGeomParams.filterData, roadGeomParams.filterCallback); + + //Process the raycast result. + if(buff.hasBlock && buff.block.distance != 0.0f) + { + const PxPlane hitPlane(v + w * buff.block.distance, buff.block.normal); + roadGeomState.plane = hitPlane; + roadGeomState.hitState = true; + PxMaterial* hitMaterial; + roadGeomState.friction = computeMaterialFriction(buff.block.shape, buff.block.faceIndex, materialFrictionParams, + hitMaterial); + roadGeomState.velocity = computeVelocity(*buff.block.actor, buff.block.position); + + if (physxRoadGeometryState) + { + copyHitInfo(buff.block, hitMaterial, *physxRoadGeometryState); + } + } + else + { + if (physxRoadGeometryState) + physxRoadGeometryState->setToDefault(); + } + } + else if(PxVehiclePhysXRoadGeometryQueryType::eSWEEP == roadGeomParams.roadGeometryQueryType) + { + PX_ASSERT(unitCylinderSweepMesh); + + //Assume no hits until we know otherwise. + roadGeomState.setToDefault(); + + //Compute the start pose, dir and length of sweep. + PxTransform T; + PxVec3 w; + PxF32 dist; + PxVehicleComputeSuspensionSweep(frame, suspParams, steerAngle, rigidBodyState.pose, T, w, dist); + + //Scale the unit cylinder. + const PxVec3 scale = PxVehicleComputeTranslation(frame, wheelParams.radius, wheelParams.halfWidth, wheelParams.radius).abs(); + const PxMeshScale meshScale(scale, PxQuat(PxIdentity)); + const PxConvexMeshGeometry convMeshGeom(const_cast(unitCylinderSweepMesh), meshScale); + + //Perform the sweep. + PxSweepBuffer buff; + scene.sweep(convMeshGeom, T, w, dist, buff, PxHitFlag::eDEFAULT | PxHitFlag::eMTD, roadGeomParams.filterData, roadGeomParams.filterCallback); + + //Process the sweep result. + if (buff.hasBlock && buff.block.distance > 0.0f) + { + //Sweep started outside scene geometry. + const PxPlane hitPlane(buff.block.position, buff.block.normal); + roadGeomState.plane = hitPlane; + roadGeomState.hitState = true; + PxMaterial* hitMaterial; + roadGeomState.friction = computeMaterialFriction(buff.block.shape, buff.block.faceIndex, materialFrictionParams, + hitMaterial); + roadGeomState.velocity = computeVelocity(*buff.block.actor, buff.block.position); + + if (physxRoadGeometryState) + { + copyHitInfo(buff.block, hitMaterial, *physxRoadGeometryState); + } + } + else if (buff.hasBlock && buff.block.distance < 0.0f) + { + //The sweep started inside scene geometry. + //We want to have another go but this time starting outside the hit geometry because this is the most reliable + //way to get a hit plane. + //-buff.block.distance is the distance we need to move along buff.block.normal to be outside the hit geometry. + //Note that buff.block.distance can be a vanishingly small number. Moving along the normal by a vanishingly + //small number might not push us out of overlap due to numeric precision of the overlap test. + //We want to move a numerically significant distance to guarantee that we change the overlap status + //at the start pose of the sweep. + //We achieve this by choosing a minimum translation that is numerically significant. + //Any number will do but we choose the wheel radius because this ought to be a numerically significant value. + //We're only sweeping against the hit shape and not against the scene + //so we don't risk hitting other stuff by moving a numerically significant distance. + const PxVec3 unitDir = -buff.block.normal; + const PxF32 maxDist = PxMax(wheelParams.radius, -buff.block.distance); + const PxGeometry& geom0 = convMeshGeom; + const PxTransform pose0(T.p + buff.block.normal*(maxDist*1.01f), T.q); + const PxGeometry& geom1 = buff.block.shape->getGeometry(); + const PxTransform pose1 = buff.block.actor->getGlobalPose()*buff.block.shape->getLocalPose(); + PxGeomSweepHit buff2; + const bool b2 = PxGeometryQuery::sweep( + unitDir, maxDist*1.02f, + geom0, pose0, geom1, pose1, buff2, PxHitFlag::eDEFAULT | PxHitFlag::eMTD); + + if (b2 && buff2.distance > 0.0f) + { + //Sweep started outside scene geometry. + const PxPlane hitPlane(buff2.position, buff2.normal); + roadGeomState.plane = hitPlane; + roadGeomState.hitState = true; + PxMaterial* hitMaterial; + roadGeomState.friction = computeMaterialFriction(buff.block.shape, buff.block.faceIndex, materialFrictionParams, + hitMaterial); + roadGeomState.velocity = computeVelocity(*buff.block.actor, buff.block.position); + + if (physxRoadGeometryState) + { + copyHitInfo(buff.block, hitMaterial, *physxRoadGeometryState); + } + } + else + { + if (physxRoadGeometryState) + physxRoadGeometryState->setToDefault(); + } + } + else + { + if (physxRoadGeometryState) + physxRoadGeometryState->setToDefault(); + } + } + +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryHelpers.cpp new file mode 100644 index 0000000..1ebdfe9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/physxRoadGeometry/VhPhysXRoadGeometryHelpers.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryHelpers.h" + +#include "cooking/PxConvexMeshDesc.h" +#include "cooking/PxCooking.h" +#include "extensions/PxDefaultStreams.h" +#include "PxPhysics.h" + +namespace physx +{ +namespace vehicle2 +{ + +PxConvexMesh* PxVehicleUnitCylinderSweepMeshCreate +(const PxVehicleFrame& runtimeFrame, PxPhysics& physics, const PxCookingParams& params) +{ + const PxMat33 mat33 = runtimeFrame.getFrame(); + const PxQuat frame(mat33); + const PxReal radius = 1.0f; + const PxReal halfWidth = 1.0f; + + #define NB_CIRCUMFERENCE_POINTS 64 + PxVec3 points[2 * NB_CIRCUMFERENCE_POINTS]; + for (PxU32 i = 0; i < NB_CIRCUMFERENCE_POINTS; i++) + { + const PxF32 cosTheta = PxCos(i * PxPi * 2.0f / float(NB_CIRCUMFERENCE_POINTS)); + const PxF32 sinTheta = PxSin(i * PxPi * 2.0f / float(NB_CIRCUMFERENCE_POINTS)); + const PxF32 x = radius * cosTheta; + const PxF32 z = radius * sinTheta; + points[2 * i + 0] = frame.rotate(PxVec3(x, -halfWidth, z)); + points[2 * i + 1] = frame.rotate(PxVec3(x, +halfWidth, z)); + } + + // Create descriptor for convex mesh + PxConvexMeshDesc convexDesc; + convexDesc.points.count = sizeof(points)/sizeof(PxVec3); + convexDesc.points.stride = sizeof(PxVec3); + convexDesc.points.data = points; + convexDesc.flags = PxConvexFlag::eCOMPUTE_CONVEX; + + PxConvexMesh* convexMesh = NULL; + PxDefaultMemoryOutputStream buf; + if (PxCookConvexMesh(params, convexDesc, buf)) + { + PxDefaultMemoryInputData id(buf.getData(), buf.getSize()); + convexMesh = physics.createConvexMesh(id); + } + + return convexMesh; +} + +void PxVehicleUnitCylinderSweepMeshDestroy(PxConvexMesh* mesh) +{ + mesh->release(); +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdAttributeHandles.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdAttributeHandles.h new file mode 100644 index 0000000..52703c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdAttributeHandles.h @@ -0,0 +1,168 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +#include "vehicle2/pvd/PxVehiclePvdHelpers.h" +#include "VhPvdWriter.h" + +/** \addtogroup vehicle2 + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehiclePvdAttributeHandles +{ +#if PX_SUPPORT_OMNI_PVD + + ///////////////////// + //RIGID BODY + ///////////////////////// + + RigidBodyParams rigidBodyParams; + RigidBodyState rigidBodyState; + + ///////////////////////// + //SUSP STATE CALC PARAMS + ///////////////////////// + + SuspStateCalcParams suspStateCalcParams; + + ///////////////////////// + //CONTROL ATTRIBUTES + ///////////////////////// + + WheelResponseParams brakeCommandResponseParams; + WheelResponseParams steerCommandResponseParams; + WheelResponseStates brakeCommandResponseStates; + WheelResponseStates steerCommandResponseStates; + + ///////////////////////////////// + //WHEEL ATTACHMENT ATTRIBUTES + ///////////////////////////////// + + WheelParams wheelParams; + WheelActuationState wheelActuationState; + WheelRigidBody1dState wheelRigidBody1dState; + WheelLocalPoseState wheelLocalPoseState; + RoadGeometryState roadGeomState; + SuspParams suspParams; + SuspCompParams suspCompParams; + SuspForceParams suspForceParams; + SuspState suspState; + SuspCompState suspCompState; + SuspForce suspForce; + TireParams tireParams; + TireDirectionState tireDirectionState; + TireSpeedState tireSpeedState; + TireSlipState tireSlipState; + TireStickyState tireStickyState; + TireGripState tireGripState; + TireCamberState tireCamberState; + TireForce tireForce; + WheelAttachment wheelAttachment; + + /////////////////////// + //ANTIROLL BARS + /////////////////////// + + AntiRollParams antiRollParams; + AntiRollForce antiRollForce; + + /////////////////////////////////// + //DIRECT DRIVETRAIN + /////////////////////////////////// + + DirectDriveCommandState directDriveCommandState; + DirectDriveTransmissionCommandState directDriveTransmissionCommandState; + WheelResponseParams directDriveThrottleCommandResponseParams; + DirectDriveThrottleResponseState directDriveThrottleCommandResponseState; + DirectDrivetrain directDrivetrain; + + ////////////////////////////////// + //ENGINE DRIVETRAIN ATTRIBUTES + ////////////////////////////////// + + EngineDriveCommandState engineDriveCommandState; + EngineDriveTransmissionCommandState engineDriveTransmissionCommandState; + ClutchResponseParams clutchCommandResponseParams; + ClutchParams clutchParams; + EngineParams engineParams; + GearboxParams gearboxParams; + AutoboxParams autoboxParams; + MultiWheelDiffParams multiwheelDiffParams; + FourWheelDiffParams fourwheelDiffParams; + ClutchResponseState clutchResponseState; + ThrottleResponseState throttleResponseState; + EngineState engineState; + GearboxState gearboxState; + AutoboxState autoboxState; + DiffState diffState; + ClutchSlipState clutchSlipState; + EngineDrivetrain engineDrivetrain; + + ////////////////////////////////////// + //PHYSX WHEEL ATTACHMENT INTEGRATION + ////////////////////////////////////// + + PhysXSuspensionLimitConstraintParams physxSuspLimitConstraintParams; + PhysXWheelShape physxWheelShape; + PhysXRoadGeomState physxRoadGeomState; + PhysXConstraintState physxConstraintState; + PhysXMaterialFriction physxMaterialFriction; + PhysXWheelAttachment physxWheelAttachment; + + //////////////////// + //PHYSX RIGID ACTOR + //////////////////// + + PhysXRoadGeometryQueryParams physxRoadGeometryQueryParams; + PhysXRigidActor physxRigidActor; + + ////////////////////////////////// + //VEHICLE ATTRIBUTES + ////////////////////////////////// + + Vehicle vehicle; + +#endif + +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdFunctions.cpp new file mode 100644 index 0000000..c2b7414 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdFunctions.cpp @@ -0,0 +1,1770 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "VhPvdAttributeHandles.h" +#include "VhPvdObjectHandles.h" +#include "VhPvdWriter.h" + +#include "vehicle2/pvd/PxVehiclePvdFunctions.h" + +#include "foundation/PxAllocatorCallback.h" + +#include +#include + +namespace physx +{ +namespace vehicle2 +{ + +#if PX_SUPPORT_OMNI_PVD + +PX_FORCE_INLINE void createPvdObject +(OmniPvdWriter* omniWriter, OmniPvdContextHandle contextHandle, +OmniPvdClassHandle classHandle, OmniPvdObjectHandle objectHandle, const char* objectName) +{ + omniWriter->createObject(contextHandle, classHandle, objectHandle, objectName); +} + +PX_FORCE_INLINE void writeObjectHandleAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, + OmniPvdObjectHandle val) +{ + PX_ASSERT(oh); + PX_ASSERT(ah); + if(val) + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(OmniPvdObjectHandle)); +} + +PX_FORCE_INLINE void addObjectHandleToSet +(OmniPvdWriter* ow, OmniPvdContextHandle ch, OmniPvdObjectHandle setOwnerOH, OmniPvdAttributeHandle setAH, OmniPvdObjectHandle ohToAdd) +{ + PX_ASSERT(setOwnerOH); + PX_ASSERT(setAH); + if(ohToAdd) + ow->addToSetAttributeShallow(ch, setOwnerOH, setAH, reinterpret_cast(&ohToAdd), sizeof(OmniPvdObjectHandle)); +} + +PX_FORCE_INLINE void appendWithInt(char* buffer, PxU32 number) +{ + char num[8]; + sprintf(num, "%d", number); + strcat(buffer, num); +} + +PX_FORCE_INLINE void createVehicleObject +(const PxVehiclePvdAttributeHandles& attributeHandles, + PxVehiclePvdObjectHandles* objectHandles, OmniPvdWriter* omniWriter) +{ + // Register the top-level vehicle object if this hasn't already been done. + if(0 == objectHandles->vehicleOH) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle vehicleOH = reinterpret_cast(&objectHandles->vehicleOH); + createPvdObject(omniWriter, objectHandles->contextHandle, attributeHandles.vehicle.CH, vehicleOH, "Vehicle"); + objectHandles->vehicleOH = vehicleOH; + } +} + + +///////////////////////////////// +//RIGID BODY +///////////////////////////////// + +void PxVehiclePvdRigidBodyRegister +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdRigidBodyRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + if(rbodyParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->rigidBodyParamsOH); + createPvdObject(ow, ch, ah.rigidBodyParams.CH, oh, "RigidBodyParams"); + objHands->rigidBodyParamsOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.rigidBodyParamsAH, oh); + } + + if(rbodyState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->rigidBodyStateOH); + createPvdObject(ow, ch, ah.rigidBodyState.CH, oh, "RigidBodyState"); + objHands->rigidBodyStateOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.rigidBodyStateAH, oh); + } +} + +void PxVehiclePvdRigidBodyWrite +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdRigidBodyWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + if(oh.rigidBodyParamsOH && rbodyParams) + { + writeRigidBodyParams(*rbodyParams, oh.rigidBodyParamsOH, ah.rigidBodyParams, ow, ch); + } + + if(oh.rigidBodyStateOH && rbodyState) + { + writeRigidBodyState(*rbodyState, oh.rigidBodyStateOH, ah.rigidBodyState, ow, ch); + } +} + +////////////////////////////// +//SUSP STATE CALC PARAMS +////////////////////////////// + +void PxVehiclePvdSuspensionStateCalculationParamsRegister +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdSuspensionStateCalculationParamsRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + if(suspStateCalcParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspStateCalcParamsOH); + createPvdObject(ow, ch, ah.suspStateCalcParams.CH, oh, "SuspStateCalcParams"); + objHands->suspStateCalcParamsOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.suspStateCalcParamsAH, oh); + } +} + +void PxVehiclePvdSuspensionStateCalculationParamsWrite +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* omniWriter) +{ + PX_CHECK_AND_RETURN(omniWriter, "PxVehiclePvdSuspensionStateCalculationParamsWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + if(oh.suspStateCalcParamsOH && suspStateCalcParams) + { + writeSuspStateCalcParams(*suspStateCalcParams, oh.suspStateCalcParamsOH, ah.suspStateCalcParams, omniWriter, oh.contextHandle); + } +} + +///////////////////////////// +//COMMAND RESPONSE PARAMS +///////////////////////////// + +void PxVehiclePvdCommandResponseRegister +(const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdCommandResponseRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_CHECK_AND_RETURN( + brakeResponseParams.size <= 2, + "PxVehiclePvdCommandResponseRegister : brakeResponseParams.size must have less than or equal to 2"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + for(PxU32 i = 0; i < brakeResponseParams.size; i++) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->brakeResponseParamOHs[i]); + char objectName[32] = "BrakeComandResponseParams"; + appendWithInt(objectName, i); + createPvdObject(ow, ch, ah.brakeCommandResponseParams.CH, oh, objectName); + objHands->brakeResponseParamOHs[i] = oh; + + addObjectHandleToSet(ow, ch, objHands->vehicleOH, ah.vehicle.brakeResponseParamsSetAH, oh); + } + + if(steerResponseParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->steerResponseParamsOH); + const char objectName[32] = "SteerCommandResponseParams"; + createPvdObject(ow, ch, ah.steerCommandResponseParams.CH, oh, objectName); + objHands->steerResponseParamsOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.steerResponseParamsAH, oh); + } + + if(!brakeResponseStates.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->brakeResponseStateOH); + const char objectName[32] = "BrakeCommandResponseStates"; + createPvdObject(ow, ch, ah.brakeCommandResponseStates.CH, oh, objectName); + objHands->brakeResponseStateOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.brakeResponseStatesAH, oh); + } + + if(!steerResponseStates.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->steerResponseStateOH); + const char objectName[32] = "SteerCommandResponseStates"; + createPvdObject(ow, ch, ah.steerCommandResponseStates.CH, oh, objectName); + objHands->steerResponseStateOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.steerResponseStatesAH, oh); + } +} + +void PxVehiclePvdCommandResponseWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdCommandResponseWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_CHECK_AND_RETURN( + brakeResponseParams.size <= 2, + "PxVehiclePvdCommandResponseWrite : brakeResponseParams.size must have less than or equal to 2"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + for(PxU32 i = 0; i < brakeResponseParams.size; i++) + { + if(oh.brakeResponseParamOHs[i]) + { + writeBrakeResponseParams( + axleDesc, brakeResponseParams[i], + oh.brakeResponseParamOHs[i], ah.brakeCommandResponseParams, ow, ch); + } + } + if(oh.steerResponseParamsOH && steerResponseParams) + { + writeSteerResponseParams( + axleDesc, *steerResponseParams, + oh.steerResponseParamsOH, ah.steerCommandResponseParams, ow, ch); + } + + if(oh.brakeResponseStateOH && !brakeResponseStates.isEmpty()) + { + writeBrakeResponseStates(axleDesc, brakeResponseStates, oh.brakeResponseStateOH, ah.brakeCommandResponseStates, ow, ch); + } + + if(oh.steerResponseStateOH && !steerResponseStates.isEmpty()) + { + writeSteerResponseStates(axleDesc, steerResponseStates, oh.steerResponseStateOH, ah.steerCommandResponseStates, ow, ch); + } +} + +void PxVehiclePvdWheelAttachmentsRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdWheelAttachmentsRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + // Register the wheel attachments + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + PX_CHECK_AND_RETURN( + wheelId < objHands->nbWheels, + "PxVehiclePvdWheelAttachmentsRegister - axleDesc.axleToWheelIds[i] must be less than the value of the nbWheels argument in the function PxVehiclePvdObjectCreate()"); + + if(!wheelParams.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->wheelParamsOHs[wheelId]); + char objectName[32] = "WheelParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.wheelParams.CH, oh, objectName); + objHands->wheelParamsOHs[wheelId] = oh; + } + + if(!wheelActuationStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->wheelActuationStateOHs[wheelId]); + char objectName[32] = "WheelActuationState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.wheelActuationState.CH, oh, objectName); + objHands->wheelActuationStateOHs[wheelId] = oh; + } + + if(!wheelRigidBody1dStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->wheelRigidBody1dStateOHs[wheelId]); + char objectName[32] = "WheelRigidBody1dState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.wheelRigidBody1dState.CH, oh, objectName); + objHands->wheelRigidBody1dStateOHs[wheelId] = oh; + } + + + if(!wheelLocalPoses.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->wheelLocalPoseStateOHs[wheelId]); + char objectName[32] = "WheelLocalPoseState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.wheelLocalPoseState.CH, oh, objectName); + objHands->wheelLocalPoseStateOHs[wheelId] = oh; + } + + if(!roadGeometryStates.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->roadGeomStateOHs[wheelId]); + char objectName[32] = "RoadGeometryState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.roadGeomState.CH, oh, objectName); + objHands->roadGeomStateOHs[wheelId] = oh; + } + + if(!suspParams.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspParamsOHs[wheelId]); + char objectName[32] = "SuspParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspParams.CH, oh, objectName); + objHands->suspParamsOHs[wheelId] = oh; + } + + if(!suspCompParams.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspCompParamsOHs[wheelId]); + char objectName[32] = "SuspCompParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspCompParams.CH, oh, objectName); + objHands->suspCompParamsOHs[wheelId] = oh; + } + + if(!suspForceParams.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspForceParamsOHs[wheelId]); + char objectName[32] = "SuspForceParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspForceParams.CH, oh, objectName); + objHands->suspForceParamsOHs[wheelId] = oh; + } + + if(!suspStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspStateOHs[wheelId]); + char objectName[32] = "SuspState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspState.CH, oh, objectName); + objHands->suspStateOHs[wheelId] = oh; + } + + if(!suspCompStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspCompStateOHs[wheelId]); + char objectName[32] = "SuspComplianceState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspCompState.CH, oh, objectName); + objHands->suspCompStateOHs[wheelId] = oh; + } + + if(!suspForces.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->suspForceOHs[wheelId]); + char objectName[32] = "SuspForce"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.suspForce.CH, oh, objectName); + objHands->suspForceOHs[wheelId] = oh; + } + + if(!tireForceParams.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireParamsOHs[wheelId]); + char objectName[32] = "TireParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireParams.CH, oh, objectName); + objHands->tireParamsOHs[wheelId] = oh; + } + + if(!tireDirectionStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireDirectionStateOHs[wheelId]); + char objectName[32] = "TireDirectionState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireDirectionState.CH, oh, objectName); + objHands->tireDirectionStateOHs[wheelId] = oh; + } + + if(!tireSpeedStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireSpeedStateOHs[wheelId]); + char objectName[32] = "TireSpeedState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireSpeedState.CH, oh, objectName); + objHands->tireSpeedStateOHs[wheelId] = oh; + } + + if(!tireSlipStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireSlipStateOHs[wheelId]); + char objectName[32] = "TireSlipState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireSlipState.CH, oh, objectName); + objHands->tireSlipStateOHs[wheelId] = oh; + } + + if(!tireStickyStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireStickyStateOHs[wheelId]); + char objectName[32] = "TireStickyState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireStickyState.CH, oh, objectName); + objHands->tireStickyStateOHs[wheelId] = oh; + } + + if(!tireGripStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireGripStateOHs[wheelId]); + char objectName[32] = "TireGripState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireGripState.CH, oh, objectName); + objHands->tireGripStateOHs[wheelId] = oh; + } + + if(!tireCamberStates.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireCamberStateOHs[wheelId]); + char objectName[32] = "TireCamberState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireCamberState.CH, oh, objectName); + objHands->tireCamberStateOHs[wheelId] = oh; + } + + if(!tireForces.isEmpty()) + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->tireForceOHs[wheelId]); + char objectName[32] = "TireForce"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.tireForce.CH, oh, objectName); + objHands->tireForceOHs[wheelId] = oh; + } + + { + //Get a unique id from a memory adress in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->wheelAttachmentOHs[wheelId]); + char objectName[32] = "WheelAttachment"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.wheelAttachment.CH, oh, objectName); + objHands->wheelAttachmentOHs[wheelId] = oh; + + // Point the wheel attachment object at the wheel params, susp state, tire force etc objects. + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.wheelParamsAH, objHands->wheelParamsOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.wheelActuationStateAH, objHands->wheelActuationStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.wheelRigidBody1dStateAH, objHands->wheelRigidBody1dStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.wheelLocalPoseStateAH, objHands->wheelLocalPoseStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.roadGeomStateAH, objHands->roadGeomStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspParamsAH, objHands->suspParamsOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspCompParamsAH, objHands->suspCompParamsOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspForceParamsAH, objHands->suspForceParamsOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspStateAH, objHands->suspStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspCompStateAH, objHands->suspCompStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.suspForceAH, objHands->suspForceOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireParamsAH, objHands->tireParamsOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireDirectionStateAH, objHands->tireDirectionStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireSpeedStateAH, objHands->tireSpeedStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireSlipStateAH, objHands->tireSlipStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireStickyStateAH, objHands->tireStickyStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireGripStateAH, objHands->tireGripStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireCamberStateAH, objHands->tireCamberStateOHs[wheelId]); + writeObjectHandleAttribute( + ow, ch, oh, ah.wheelAttachment.tireForceAH, objHands->tireForceOHs[wheelId]); + + //Point the vehicle object at the wheel attachment object. + addObjectHandleToSet(ow, ch, objHands->vehicleOH, ah.vehicle.wheelAttachmentSetAH, oh); + } + } +} + +void PxVehiclePvdWheelAttachmentsWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspComplianceParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdWheelAttachmentsWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + PX_CHECK_AND_RETURN( + wheelId < oh.nbWheels, + "PxVehiclePvdWheelAttachmentsRegister - axleDesc.axleToWheelIds[i] must be less than the value of the nbWheels argument in the function PxVehiclePvdObjectCreate()"); + + if(oh.wheelParamsOHs[wheelId] && !wheelParams.isEmpty()) + { + writeWheelParams(wheelParams[wheelId], oh.wheelParamsOHs[wheelId], ah.wheelParams, ow, ch); + } + + if(oh.wheelActuationStateOHs[wheelId] && !wheelActuationStates.isEmpty()) + { + writeWheelActuationState(wheelActuationStates[wheelId], oh.wheelActuationStateOHs[wheelId], ah.wheelActuationState, ow, ch); + } + + if(oh.wheelRigidBody1dStateOHs[wheelId] && !wheelRigidBody1dStates.isEmpty()) + { + writeWheelRigidBody1dState(wheelRigidBody1dStates[wheelId], oh.wheelRigidBody1dStateOHs[wheelId], ah.wheelRigidBody1dState, ow, ch); + } + + if(oh.wheelLocalPoseStateOHs[wheelId] && !wheelLocalPoses.isEmpty()) + { + writeWheelLocalPoseState(wheelLocalPoses[wheelId], oh.wheelLocalPoseStateOHs[wheelId], ah.wheelLocalPoseState, ow, ch); + } + + if(oh.roadGeomStateOHs[wheelId] && !roadGeometryStates.isEmpty()) + { + writeRoadGeomState(roadGeometryStates[wheelId], oh.roadGeomStateOHs[wheelId], ah.roadGeomState, ow, ch); + } + + if(oh.suspParamsOHs[wheelId] && !suspParams.isEmpty()) + { + writeSuspParams(suspParams[wheelId], oh.suspParamsOHs[wheelId], ah.suspParams, ow, ch); + } + + if(oh.suspCompParamsOHs[wheelId] && !suspComplianceParams.isEmpty()) + { + writeSuspComplianceParams(suspComplianceParams[wheelId], oh.suspCompParamsOHs[wheelId], ah.suspCompParams, ow, ch); + } + + if(oh.suspForceParamsOHs[wheelId] && !suspForceParams.isEmpty()) + { + writeSuspForceParams(suspForceParams[wheelId], oh.suspForceParamsOHs[wheelId], ah.suspForceParams, ow, ch); + } + + if(oh.suspStateOHs[wheelId] && !suspStates.isEmpty()) + { + writeSuspState(suspStates[wheelId], oh.suspStateOHs[wheelId], ah.suspState, ow, ch); + } + + if(oh.suspCompStateOHs[wheelId] && !suspCompStates.isEmpty()) + { + writeSuspComplianceState(suspCompStates[wheelId], oh.suspCompStateOHs[wheelId], ah.suspCompState, ow, ch); + } + + if(oh.suspForceOHs[wheelId] && !suspForces.isEmpty()) + { + writeSuspForce(suspForces[wheelId], oh.suspForceOHs[wheelId], ah.suspForce, ow, ch); + } + + if(oh.tireParamsOHs[wheelId] && !tireForceParams.isEmpty()) + { + writeTireParams(tireForceParams[wheelId], oh.tireParamsOHs[wheelId], ah.tireParams, ow, ch); + } + + if(oh.tireDirectionStateOHs[wheelId] && !tireDirectionStates.isEmpty()) + { + writeTireDirectionState(tireDirectionStates[wheelId], oh.tireDirectionStateOHs[wheelId], ah.tireDirectionState, ow, ch); + } + + if(oh.tireSpeedStateOHs[wheelId] && !tireSpeedStates.isEmpty()) + { + writeTireSpeedState(tireSpeedStates[wheelId], oh.tireSpeedStateOHs[wheelId], ah.tireSpeedState, ow, ch); + } + + if(oh.tireSlipStateOHs[wheelId] && !tireSlipStates.isEmpty()) + { + writeTireSlipState(tireSlipStates[wheelId], oh.tireSlipStateOHs[wheelId], ah.tireSlipState, ow, ch); + } + + if(oh.tireStickyStateOHs[wheelId] && !tireStickyStates.isEmpty()) + { + writeTireStickyState(tireStickyStates[wheelId], oh.tireStickyStateOHs[wheelId], ah.tireStickyState, ow, ch); + } + + if(oh.tireGripStateOHs[wheelId] && !tireGripStates.isEmpty()) + { + writeTireGripState(tireGripStates[wheelId], oh.tireGripStateOHs[wheelId], ah.tireGripState, ow, ch); + } + + if(oh.tireCamberStateOHs[wheelId] && !tireCamberStates.isEmpty()) + { + writeTireCamberState(tireCamberStates[wheelId], oh.tireCamberStateOHs[wheelId], ah.tireCamberState, ow, ch); + } + + if(oh.tireForceOHs[wheelId] && !tireForces.isEmpty()) + { + writeTireForce(tireForces[wheelId], oh.tireForceOHs[wheelId], ah.tireForce, ow, ch); + } + } +} + +void PxVehiclePvdDirectDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdDirectDrivetrainRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + if(commandState) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->directDriveCommandStateOH); + createPvdObject(ow, ch, ah.directDriveCommandState.CH, oh, "DirectDriveCommandState"); + objHands->directDriveCommandStateOH = oh; + } + + if(transmissionState) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->directDriveTransmissionCommandStateOH); + createPvdObject(ow, ch, ah.directDriveTransmissionCommandState.CH, oh, "DirectDriveTransmissionCommandState"); + objHands->directDriveTransmissionCommandStateOH = oh; + } + + if(directDriveThrottleResponseParams) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->directDriveThrottleResponseParamsOH); + createPvdObject(ow, ch, ah.directDriveThrottleCommandResponseParams.CH, oh, "DirectDriveThrottleResponseParams"); + objHands->directDriveThrottleResponseParamsOH = oh; + } + + if(!directDriveThrottleResponseState.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->directDriveThrottleResponseStateOH); + createPvdObject(ow, ch, ah.directDriveThrottleCommandResponseState.CH, oh, "DirectDriveThrottleResponseState"); + objHands->directDriveThrottleResponseStateOH = oh; + } + + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->directDrivetrainOH); + createPvdObject(ow, ch, ah.directDrivetrain.CH, oh, "DirectDrivetrain"); + objHands->directDrivetrainOH = oh; + + writeObjectHandleAttribute( + ow, ch, oh, ah.directDrivetrain.commandStateAH, objHands->directDriveCommandStateOH); + writeObjectHandleAttribute( + ow, ch, oh, ah.directDrivetrain.throttleResponseParamsAH, objHands->directDriveThrottleResponseParamsOH); + writeObjectHandleAttribute( + ow, ch, oh, ah.directDrivetrain.throttleResponseStateAH, objHands->directDriveThrottleResponseStateOH); + + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.directDrivetrainAH, oh); + } +} + +void PxVehiclePvdDirectDrivetrainWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdDirectDrivetrainWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + if(oh.directDriveCommandStateOH && commandState) + { + writeDirectDriveCommandState(*commandState, oh.directDriveCommandStateOH, ah.directDriveCommandState, ow, ch); + } + + if(oh.directDriveTransmissionCommandStateOH && transmissionState) + { + writeDirectDriveTransmissionCommandState(*transmissionState, oh.directDriveTransmissionCommandStateOH, ah.directDriveTransmissionCommandState, ow, ch); + } + + if(oh.directDriveThrottleResponseParamsOH) + { + writeDirectDriveThrottleResponseParams(axleDesc, *directDriveThrottleResponseParams, oh.directDriveThrottleResponseParamsOH, ah.directDriveThrottleCommandResponseParams, ow, ch); + } + + if(oh.directDriveThrottleResponseStateOH && !directDriveThrottleResponseState.isEmpty()) + { + writeDirectDriveThrottleResponseState(axleDesc, directDriveThrottleResponseState, oh.directDriveThrottleResponseStateOH, ah.directDriveThrottleCommandResponseState, ow, ch); + } +} + +void PxVehiclePvdEngineDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParms, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffPrams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdEngineDrivetrainRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + if(commandState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineDriveCommandStateOH); + createPvdObject(ow, ch, ah.engineDriveCommandState.CH, oh, "EngineDriveCommandState"); + objHands->engineDriveCommandStateOH = oh; + } + + if(transmissionCommandState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineDriveTransmissionCommandStateOH); + createPvdObject(ow, ch, ah.engineDriveTransmissionCommandState.CH, oh, "EngineDriveTransmissionCommandState"); + objHands->engineDriveTransmissionCommandStateOH = oh; + } + + if(clutchResponseParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->clutchResponseParamsOH); + createPvdObject(ow, ch, ah.clutchCommandResponseParams.CH, oh, "ClutchResponseParams"); + objHands->clutchResponseParamsOH = oh; + } + + if(clutchParms) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->clutchParamsOH); + createPvdObject(ow, ch, ah.clutchParams.CH, oh, "ClutchParams"); + objHands->clutchParamsOH = oh; + } + + if(engineParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineParamsOH); + createPvdObject(ow, ch, ah.engineParams.CH, oh, "EngineParams"); + objHands->engineParamsOH = oh; + } + + if(gearboxParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->gearboxParamsOH); + createPvdObject(ow, ch, ah.gearboxParams.CH, oh, "GearboxParams"); + objHands->gearboxParamsOH = oh; + } + + if(autoboxParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->autoboxParamsOH); + createPvdObject(ow, objHands->contextHandle, ah.autoboxParams.CH, oh, "AutoboxParams"); + objHands->autoboxParamsOH = oh; + } + + if(multiWheelDiffParams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->multiWheelDiffParamsOH); + createPvdObject(ow, ch, ah.multiwheelDiffParams.CH, oh, "MultiWheelDiffParams"); + objHands->multiWheelDiffParamsOH = oh; + } + + if(fourWheelDiffPrams) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->fourWheelDiffParamsOH); + createPvdObject(ow, ch, ah.fourwheelDiffParams.CH, oh, "FourWheelDiffParams"); + objHands->fourWheelDiffParamsOH = oh; + } + + if(clutchResponseState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->clutchResponseStateOH); + createPvdObject(ow, ch, ah.clutchResponseState.CH, oh, "ClutchResponseState"); + objHands->clutchResponseStateOH = oh; + } + + if(throttleResponseState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineDriveThrottleResponseStateOH); + createPvdObject(ow, ch, ah.throttleResponseState.CH, oh, "ThrottleResponseState"); + objHands->engineDriveThrottleResponseStateOH = oh; + } + + if(engineState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineStateOH); + createPvdObject(ow, ch, ah.engineState.CH, oh, "EngineState"); + objHands->engineStateOH = oh; + } + + if(gearboxState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->gearboxStateOH); + createPvdObject(ow, ch, ah.gearboxState.CH, oh, "GearboxState"); + objHands->gearboxStateOH = oh; + } + + if(autoboxState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->autoboxStateOH); + createPvdObject(ow, ch, ah.autoboxState.CH, oh, "AutoboxState"); + objHands->autoboxStateOH = oh; + } + + if(diffState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->diffStateOH); + createPvdObject(ow, ch, ah.diffState.CH, oh, "DiffState"); + objHands->diffStateOH = oh; + } + + if(clutchSlipState) + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->clutchSlipStateOH); + createPvdObject(ow, ch, ah.clutchSlipState.CH, oh, "ClutchSlipState"); + objHands->clutchSlipStateOH = oh; + } + + //Engine drivetrain + { + //Get a unique id from a memory address in objectHandles. + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->engineDrivetrainOH); + createPvdObject(ow, ch, ah.engineDrivetrain.CH, oh, "EngineDrivetrain"); + objHands->engineDrivetrainOH = oh; + + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.commandStateAH, objHands->engineDriveCommandStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.clutchResponseParamsAH, objHands->clutchResponseParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.clutchParamsAH, objHands->clutchParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.engineParamsAH, objHands->engineParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.gearboxParamsAH, objHands->gearboxParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.autoboxParamsAH, objHands->autoboxParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.multiWheelDiffParamsAH, objHands->multiWheelDiffParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.fourWheelDiffParamsAH, objHands->fourWheelDiffParamsOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.clutchResponseStateAH, objHands->clutchResponseStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.throttleResponseStateAH, objHands->engineDriveThrottleResponseStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.engineStateAH, objHands->engineStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.gearboxStateAH, objHands->gearboxStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.autoboxStateAH, objHands->autoboxStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.diffStateAH, objHands->diffStateOH); + writeObjectHandleAttribute(ow, ch, oh, ah.engineDrivetrain.clutchSlipStateAH, objHands->clutchSlipStateOH); + + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.engineDriveTrainAH, oh); + } +} + +void PxVehiclePvdEngineDrivetrainWrite +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParms, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffParams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* omniWriter) +{ + PX_CHECK_AND_RETURN(omniWriter, "PxVehiclePvdEngineDrivetrainWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + if(oh.engineDriveCommandStateOH && commandState) + { + writeEngineDriveCommandState(*commandState, oh.engineDriveCommandStateOH, ah.engineDriveCommandState, omniWriter, ch); + } + + if(oh.engineDriveTransmissionCommandStateOH && transmissionCommandState) + { + writeEngineDriveTransmissionCommandState(*transmissionCommandState, oh.engineDriveTransmissionCommandStateOH, ah.engineDriveTransmissionCommandState, omniWriter, ch); + } + + if(oh.clutchResponseParamsOH && clutchResponseParams) + { + writeClutchResponseParams(*clutchResponseParams, oh.clutchResponseParamsOH, ah.clutchCommandResponseParams, omniWriter, ch); + } + + if(oh.clutchParamsOH && clutchParms) + { + writeClutchParams(*clutchParms, oh.clutchParamsOH, ah.clutchParams, omniWriter, ch); + } + + if(oh.engineParamsOH && engineParams) + { + writeEngineParams(*engineParams, oh.engineParamsOH, ah.engineParams, omniWriter, ch); + } + + if(oh.gearboxParamsOH && gearboxParams) + { + writeGearboxParams(*gearboxParams, oh.gearboxParamsOH, ah.gearboxParams, omniWriter, ch); + } + + if(oh.autoboxParamsOH && autoboxParams) + { + writeAutoboxParams(*autoboxParams, oh.autoboxParamsOH, ah.autoboxParams, omniWriter, ch); + } + + if(oh.multiWheelDiffParamsOH && multiWheelDiffParams) + { + writeMultiWheelDiffParams(*multiWheelDiffParams, oh.multiWheelDiffParamsOH, ah.multiwheelDiffParams, omniWriter, ch); + } + + if(oh.fourWheelDiffParamsOH && fourWheelDiffParams) + { + writeFourWheelDiffParams(*fourWheelDiffParams, oh.fourWheelDiffParamsOH, ah.fourwheelDiffParams, omniWriter, ch); + } + + if(oh.clutchResponseStateOH && clutchResponseState) + { + writeClutchResponseState(*clutchResponseState, oh.clutchResponseStateOH, ah.clutchResponseState, omniWriter, ch); + } + + if(oh.engineDriveThrottleResponseStateOH && throttleResponseState) + { + writeThrottleResponseState(*throttleResponseState, oh.engineDriveThrottleResponseStateOH, ah.throttleResponseState, omniWriter, ch); + } + + if(oh.engineStateOH && engineState) + { + writeEngineState(*engineState, oh.engineStateOH, ah.engineState, omniWriter, ch); + } + + if(oh.gearboxStateOH && gearboxState) + { + writeGearboxState(*gearboxState, oh.gearboxStateOH, ah.gearboxState, omniWriter, ch); + } + + if(oh.autoboxStateOH && autoboxState) + { + writeAutoboxState(*autoboxState, oh.autoboxStateOH, ah.autoboxState, omniWriter, ch); + } + + if(oh.diffStateOH && diffState) + { + writeDiffState(*diffState, oh.diffStateOH, ah.diffState, omniWriter, ch); + } + + if(oh.clutchSlipStateOH && clutchSlipState) + { + writeClutchSlipState(*clutchSlipState, oh.clutchSlipStateOH, ah.clutchSlipState, omniWriter, ch); + } +} + +void PxVehiclePvdAntiRollsRegister +(const PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque* antiRollTorque, +const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdAntiRollsRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_CHECK_AND_RETURN( + antiRollForceParams.size <= objHands->nbAntirolls, + "PxVehiclePvdAntiRollsRegister - antiRollForceParams.size must be less than or equal to vallue of nbAntirolls argument in the function PxVehiclePvdObjectCreate"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + // Register the antiroll params. + for(PxU32 i = 0; i < antiRollForceParams.size; i++) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->antiRollParamOHs[i]); + char objectName[32] = "AntiRollParams"; + appendWithInt(objectName, i); + createPvdObject(ow, ch, ah.antiRollParams.CH, oh, objectName); + objHands->antiRollParamOHs[i] = oh; + addObjectHandleToSet(ow, ch, objHands->vehicleOH, ah.vehicle.antiRollSetAH, oh); + } + + // Register the antiroll force. + if(antiRollTorque) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->antiRollTorqueOH); + const char objectName[32] = "AntiRollTorque"; + createPvdObject(ow, ch, ah.antiRollForce.CH, oh, objectName); + objHands->antiRollTorqueOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.antiRollForceAH, oh); + } +} + +void PxVehiclePvdAntiRollsWrite +(const PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdAntiRollsWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_CHECK_AND_RETURN( + antiRollForceParams.size <= oh.nbAntirolls, + "PxVehiclePvdAntiRollsWrite - antiRollForceParams.size must be less than or equal to vallue of nbAntirolls argument in the function PxVehiclePvdObjectCreate"); + + const OmniPvdContextHandle ch = oh.contextHandle; + + for(PxU32 i = 0; i < antiRollForceParams.size; i++) + { + if(oh.antiRollParamOHs[i] && !antiRollForceParams.isEmpty()) + { + writeAntiRollParams(antiRollForceParams[i], oh.antiRollParamOHs[i], ah.antiRollParams, ow, ch); + } + } + + if(oh.antiRollTorqueOH && antiRollTorque) + { + writeAntiRollForce(*antiRollTorque, oh.antiRollTorqueOH, ah.antiRollForce, ow, ch); + } +} + +void PxVehiclePvdPhysXWheelAttachmentRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdPhysXWheelAttachmentRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_UNUSED(physxMaterialFrictionParams); + PX_UNUSED(physxRoadGeomState); + PX_UNUSED(physxConstraintStates); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + // Register the wheel attachments + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + PX_CHECK_AND_RETURN( + wheelId < objHands->nbWheels, + "PxVehiclePvdPhysXWheelAttachmentRegister - axleDesc.axleToWheelIds[i] must be less than the value of the nbWheels argument in the function PxVehiclePvdObjectCreate()"); + + if(!physxSuspLimitConstraintParams.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxConstraintParamOHs[wheelId]); + char objectName[32] = "PhysXSuspLimtConstraintParams"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.physxSuspLimitConstraintParams.CH, oh, objectName); + objHands->physxConstraintParamOHs[wheelId] = oh; + } + + if(physxActor && physxActor->wheelShapes[wheelId]) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxWheelShapeOHs[wheelId]); + char objectName[32] = "PhysXWheelShape"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.physxWheelShape.CH, oh, objectName); + objHands->physxWheelShapeOHs[wheelId] = oh; + } + + if(!physxConstraintStates.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxConstraintStateOHs[wheelId]); + char objectName[32] = "PhysXConstraintState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.physxConstraintState.CH, oh, objectName); + objHands->physxConstraintStateOHs[wheelId] = oh; + + } + + if(!physxRoadGeomState.isEmpty()) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxRoadGeomStateOHs[wheelId]); + char objectName[32] = "PhysXRoadGeomState"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.physxRoadGeomState.CH, oh, objectName); + objHands->physxRoadGeomStateOHs[wheelId] = oh; + } + + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxWheelAttachmentOHs[wheelId]); + char objectName[32] = "PhysxWheelAttachment"; + appendWithInt(objectName, wheelId); + createPvdObject(ow, ch, ah.physxWheelAttachment.CH, oh, objectName); + objHands->physxWheelAttachmentOHs[wheelId] = oh; + + writeObjectHandleAttribute(ow, ch, oh, ah.physxWheelAttachment.physxConstraintParamsAH, objHands->physxConstraintParamOHs[wheelId]); + writeObjectHandleAttribute(ow, ch, oh, ah.physxWheelAttachment.physxWeelShapeAH, objHands->physxWheelShapeOHs[wheelId]); + writeObjectHandleAttribute(ow, ch, oh, ah.physxWheelAttachment.physxRoadGeometryStateAH, objHands->physxRoadGeomStateOHs[wheelId]); + writeObjectHandleAttribute(ow, ch, oh, ah.physxWheelAttachment.physxConstraintStateAH, objHands->physxConstraintStateOHs[wheelId]); + + addObjectHandleToSet(ow, ch, objHands->vehicleOH, ah.vehicle.physxWheelAttachmentSetAH, oh); + } + + if(!physxMaterialFrictionParams.isEmpty()) + { + for(PxU32 j = 0; j < objHands->nbPhysXMaterialFrictions; j++) + { + const PxU32 id = wheelId*objHands->nbPhysXMaterialFrictions + j; + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxMaterialFrictionOHs[id]); + char objectName[32] = "PhysxMaterialFriction"; + appendWithInt(objectName, wheelId); + strcat(objectName, "_"); + appendWithInt(objectName, j); + createPvdObject(ow, ch, ah.physxMaterialFriction.CH, oh, objectName); + objHands->physxMaterialFrictionOHs[id] = oh; + addObjectHandleToSet(ow, ch, objHands->physxWheelAttachmentOHs[wheelId], ah.physxWheelAttachment.physxMaterialFrictionSetAH, oh); + } + } + } + + if(physxRoadGeomQryParams) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxRoadGeomQueryParamOH); + char objectName[32] = "PhysxRoadGeomQryParams"; + createPvdObject(ow, ch, ah.physxRoadGeometryQueryParams.CH, oh, objectName); + objHands->physxRoadGeomQueryParamOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.physxRoadGeometryQueryParamsAH, oh); + } +} + +void PxVehiclePvdPhysXWheelAttachmentWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams, + const PxVehicleArrayData& physxRoadGeomStates, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdPhysXWheelAttachmentWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + PX_UNUSED(physxMaterialFrictionParams); + PX_UNUSED(physxRoadGeomStates); + PX_UNUSED(physxConstraintStates); + + const OmniPvdContextHandle ch = oh.contextHandle; + + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + + PX_CHECK_AND_RETURN( + wheelId < oh.nbWheels, + "PxVehiclePvdPhysXWheelAttachmentRegister - axleDesc.axleToWheelIds[i] must be less than the value of the nbWheels argument in the function PxVehiclePvdObjectCreate()"); + + if(oh.physxConstraintParamOHs[wheelId] && !physxSuspLimitConstraintParams.isEmpty()) + { + writePhysXSuspLimitConstraintParams(physxSuspLimitConstraintParams[wheelId], oh.physxConstraintParamOHs[wheelId], ah.physxSuspLimitConstraintParams, ow, ch); + } + + if(oh.physxWheelShapeOHs[wheelId] && physxActor) + { + writePhysXWheelShape(physxActor->wheelShapes[wheelId], oh.physxWheelShapeOHs[wheelId], ah.physxWheelShape, ow, ch); + } + + if(oh.physxRoadGeomStateOHs[wheelId] && !physxRoadGeomStates.isEmpty()) + { + writePhysXRoadGeomState(physxRoadGeomStates[wheelId], oh.physxRoadGeomStateOHs[wheelId], ah.physxRoadGeomState, ow, ch); + } + + if(oh.physxConstraintStateOHs[wheelId] && !physxConstraintStates.isEmpty()) + { + writePhysXConstraintState(physxConstraintStates[wheelId], oh.physxConstraintStateOHs[wheelId], ah.physxConstraintState, ow, ch); + } + + if(!physxMaterialFrictionParams.isEmpty()) + { + for(PxU32 j = 0; j < physxMaterialFrictionParams[wheelId].nbMaterialFrictions; j++) + { + const PxU32 id = wheelId*oh.nbPhysXMaterialFrictions + j; + if(oh.physxMaterialFrictionOHs[id]) + { + const PxVehiclePhysXMaterialFriction& m = physxMaterialFrictionParams[wheelId].materialFrictions[j]; + writePhysXMaterialFriction(m, oh.physxMaterialFrictionOHs[id], ah.physxMaterialFriction, ow, ch); + } + } + for(PxU32 j = physxMaterialFrictionParams[wheelId].nbMaterialFrictions; j < oh.nbPhysXMaterialFrictions; j++) + { + const PxU32 id = wheelId*oh.nbPhysXMaterialFrictions + j; + if(oh.physxMaterialFrictionOHs[id]) + { + PxVehiclePhysXMaterialFriction m; + m.friction = -1.0f; + m.material = NULL; + writePhysXMaterialFriction(m, oh.physxMaterialFrictionOHs[id], ah.physxMaterialFriction, ow, ch); + } + } + } + } + + if(oh.physxRoadGeomQueryParamOH && physxRoadGeomQryParams) + { + writePhysXRoadGeometryQueryParams(*physxRoadGeomQryParams, oh.physxRoadGeomQueryParamOH, ah.physxRoadGeometryQueryParams, ow, ch); + } +} + +void PxVehiclePvdPhysXRigidActorRegister +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdPhysXRigidActorRegister: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + // Register the top-level vehicle object if this hasn't already been done. + createVehicleObject(ah, objHands, ow); + + const OmniPvdContextHandle ch = objHands->contextHandle; + + if(physxActor && physxActor->rigidBody) + { + const OmniPvdObjectHandle oh = reinterpret_cast(&objHands->physxRigidActorOH); + createPvdObject(ow, ch, ah.physxRigidActor.CH, oh, "PhysXRigidActor"); + objHands->physxRigidActorOH = oh; + writeObjectHandleAttribute(ow, ch, objHands->vehicleOH, ah.vehicle.physxRigidActorAH, oh); + } +} + +void PxVehiclePvdPhysXRigidActorWrite +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdPhysXRigidActorWrite: omniWriter must be a pointer to a valid OmniPvdWriter intance"); + + if(oh.physxRigidActorOH && physxActor) + { + writePhysXRigidActor(physxActor->rigidBody, oh.physxRigidActorOH, ah.physxRigidActor, ow, oh.contextHandle); + } +} + +#else //PX_SUPPORT_OMNI_PVD + +void PxVehiclePvdRigidBodyRegister +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(rbodyParams); + PX_UNUSED(rbodyState); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdRigidBodyWrite +(const PxVehicleRigidBodyParams* rbodyParams, const PxVehicleRigidBodyState* rbodyState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(rbodyParams); + PX_UNUSED(rbodyState); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdSuspensionStateCalculationParamsRegister +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(suspStateCalcParams); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdSuspensionStateCalculationParamsWrite +(const PxVehicleSuspensionStateCalculationParams* suspStateCalcParams, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(suspStateCalcParams); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdCommandResponseRegister +(const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(steerResponseParams); + PX_UNUSED(brakeResponseParams); + PX_UNUSED(steerResponseStates); + PX_UNUSED(brakeResponseStates); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdCommandResponseWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSizedArrayData& brakeResponseParams, + const PxVehicleSteerCommandResponseParams* steerResponseParams, + const PxVehicleArrayData& brakeResponseStates, + const PxVehicleArrayData& steerResponseStates, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(steerResponseParams); + PX_UNUSED(brakeResponseParams); + PX_UNUSED(steerResponseStates); + PX_UNUSED(brakeResponseStates); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdWheelAttachmentsRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspCompParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(wheelParams); + PX_UNUSED(wheelActuationStates); + PX_UNUSED(wheelRigidBody1dStates); + PX_UNUSED(wheelLocalPoses); + PX_UNUSED(roadGeometryStates); + PX_UNUSED(suspParams); + PX_UNUSED(suspCompParams); + PX_UNUSED(suspForceParams); + PX_UNUSED(suspStates); + PX_UNUSED(suspCompStates); + PX_UNUSED(suspForces); + PX_UNUSED(tireForceParams); + PX_UNUSED(tireDirectionStates); + PX_UNUSED(tireSpeedStates); + PX_UNUSED(tireSlipStates); + PX_UNUSED(tireStickyStates); + PX_UNUSED(tireGripStates); + PX_UNUSED(tireCamberStates); + PX_UNUSED(tireForces); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdWheelAttachmentsWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& wheelParams, + const PxVehicleArrayData& wheelActuationStates, + const PxVehicleArrayData& wheelRigidBody1dStates, + const PxVehicleArrayData& wheelLocalPoses, + const PxVehicleArrayData& roadGeometryStates, + const PxVehicleArrayData& suspParams, + const PxVehicleArrayData& suspComplianceParams, + const PxVehicleArrayData& suspForceParams, + const PxVehicleArrayData& suspStates, + const PxVehicleArrayData& suspCompStates, + const PxVehicleArrayData& suspForces, + const PxVehicleArrayData& tireForceParams, + const PxVehicleArrayData& tireDirectionStates, + const PxVehicleArrayData& tireSpeedStates, + const PxVehicleArrayData& tireSlipStates, + const PxVehicleArrayData& tireStickyStates, + const PxVehicleArrayData& tireGripStates, + const PxVehicleArrayData& tireCamberStates, + const PxVehicleArrayData& tireForces, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(wheelParams); + PX_UNUSED(wheelActuationStates); + PX_UNUSED(wheelRigidBody1dStates); + PX_UNUSED(wheelLocalPoses); + PX_UNUSED(roadGeometryStates); + PX_UNUSED(suspParams); + PX_UNUSED(suspComplianceParams); + PX_UNUSED(suspForceParams); + PX_UNUSED(suspStates); + PX_UNUSED(suspCompStates); + PX_UNUSED(suspForces); + PX_UNUSED(tireForceParams); + PX_UNUSED(tireDirectionStates); + PX_UNUSED(tireSpeedStates); + PX_UNUSED(tireSlipStates); + PX_UNUSED(tireStickyStates); + PX_UNUSED(tireGripStates); + PX_UNUSED(tireCamberStates); + PX_UNUSED(tireForces); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdDirectDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(commandState); + PX_UNUSED(transmissionState); + PX_UNUSED(directDriveThrottleResponseParams); + PX_UNUSED(directDriveThrottleResponseState); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdDirectDrivetrainWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleCommandState* commandState, const PxVehicleDirectDriveTransmissionCommandState* transmissionState, + const PxVehicleDirectDriveThrottleCommandResponseParams* directDriveThrottleResponseParams, + const PxVehicleArrayData& directDriveThrottleResponseState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(commandState); + PX_UNUSED(transmissionState); + PX_UNUSED(directDriveThrottleResponseParams); + PX_UNUSED(directDriveThrottleResponseState); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdEngineDrivetrainRegister +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParms, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffPrams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(commandState); + PX_UNUSED(transmissionCommandState); + PX_UNUSED(clutchResponseParams); + PX_UNUSED(clutchParms); + PX_UNUSED(engineParams); + PX_UNUSED(gearboxParams); + PX_UNUSED(autoboxParams); + PX_UNUSED(multiWheelDiffParams); + PX_UNUSED(fourWheelDiffPrams); + PX_UNUSED(clutchResponseState); + PX_UNUSED(throttleResponseState); + PX_UNUSED(engineState); + PX_UNUSED(gearboxState); + PX_UNUSED(autoboxState); + PX_UNUSED(diffState); + PX_UNUSED(clutchSlipState); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdEngineDrivetrainWrite +(const PxVehicleCommandState* commandState, const PxVehicleEngineDriveTransmissionCommandState* transmissionCommandState, + const PxVehicleClutchCommandResponseParams* clutchResponseParams, + const PxVehicleClutchParams* clutchParms, + const PxVehicleEngineParams* engineParams, + const PxVehicleGearboxParams* gearboxParams, + const PxVehicleAutoboxParams* autoboxParams, + const PxVehicleMultiWheelDriveDifferentialParams* multiWheelDiffParams, + const PxVehicleFourWheelDriveDifferentialParams* fourWheelDiffParams, + const PxVehicleClutchCommandResponseState* clutchResponseState, + const PxVehicleEngineDriveThrottleCommandResponseState* throttleResponseState, + const PxVehicleEngineState* engineState, + const PxVehicleGearboxState* gearboxState, + const PxVehicleAutoboxState* autoboxState, + const PxVehicleDifferentialState* diffState, + const PxVehicleClutchSlipState* clutchSlipState, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* omniWriter) +{ + PX_UNUSED(commandState); + PX_UNUSED(transmissionCommandState); + PX_UNUSED(clutchResponseParams); + PX_UNUSED(clutchParms); + PX_UNUSED(engineParams); + PX_UNUSED(gearboxParams); + PX_UNUSED(autoboxParams); + PX_UNUSED(multiWheelDiffParams); + PX_UNUSED(fourWheelDiffParams); + PX_UNUSED(clutchResponseState); + PX_UNUSED(throttleResponseState); + PX_UNUSED(engineState); + PX_UNUSED(gearboxState); + PX_UNUSED(autoboxState); + PX_UNUSED(diffState); + PX_UNUSED(clutchSlipState); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(omniWriter); +} + +void PxVehiclePvdAntiRollsRegister +(const PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque* antiRollTorque, +const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(antiRollForceParams); + PX_UNUSED(antiRollTorque); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdAntiRollsWrite +(const PxVehicleSizedArrayData& antiRollForceParams, + const PxVehicleAntiRollTorque* antiRollTorque, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(antiRollForceParams); + PX_UNUSED(antiRollTorque); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdPhysXWheelAttachmentRegister +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams, + const PxVehicleArrayData& physxRoadGeomState, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(physxSuspLimitConstraintParams); + PX_UNUSED(physxMaterialFrictionParams); + PX_UNUSED(physxActor); + PX_UNUSED(physxRoadGeomQryParams); + PX_UNUSED(physxRoadGeomState); + PX_UNUSED(physxConstraintStates); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdPhysXWheelAttachmentWrite +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& physxSuspLimitConstraintParams, + const PxVehicleArrayData& physxMaterialFrictionParams, + const PxVehiclePhysXActor* physxActor, const PxVehiclePhysXRoadGeometryQueryParams* physxRoadGeomQryParams, + const PxVehicleArrayData& physxRoadGeomStates, + const PxVehicleArrayData& physxConstraintStates, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(axleDesc); + PX_UNUSED(physxSuspLimitConstraintParams); + PX_UNUSED(physxMaterialFrictionParams); + PX_UNUSED(physxActor); + PX_UNUSED(physxRoadGeomQryParams); + PX_UNUSED(physxRoadGeomStates); + PX_UNUSED(physxConstraintStates); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +void PxVehiclePvdPhysXRigidActorRegister +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& ah, + PxVehiclePvdObjectHandles* objHands, OmniPvdWriter* ow) +{ + PX_UNUSED(physxActor); + PX_UNUSED(ah); + PX_UNUSED(objHands); + PX_UNUSED(ow); +} + +void PxVehiclePvdPhysXRigidActorWrite +(const PxVehiclePhysXActor* physxActor, + const PxVehiclePvdAttributeHandles& ah, + const PxVehiclePvdObjectHandles& oh, OmniPvdWriter* ow) +{ + PX_UNUSED(physxActor); + PX_UNUSED(ah); + PX_UNUSED(oh); + PX_UNUSED(ow); +} + +#endif + +} // namespace vehicle2 +} // namespace physx + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdHelpers.cpp new file mode 100644 index 0000000..7180504 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdHelpers.cpp @@ -0,0 +1,463 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/pvd/PxVehiclePvdHelpers.h" +#include "foundation/PxAllocatorCallback.h" +#include "VhPvdAttributeHandles.h" +#include "VhPvdObjectHandles.h" + +namespace physx +{ +namespace vehicle2 +{ + +#if PX_SUPPORT_OMNI_PVD + +/////////////////////////////// +//ATTRIBUTE REGISTRATION +/////////////////////////////// + +PxVehiclePvdAttributeHandles* PxVehiclePvdAttributesCreate(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter) +{ + PX_CHECK_AND_RETURN_NULL(omniWriter, "PxVehiclePvdAttributesCreate: omniWriter must be a pointer to a valid OmniPvdWriter instance"); + + PxVehiclePvdAttributeHandles* attributeHandles = + reinterpret_cast( + allocator.allocate(sizeof(PxVehiclePvdAttributeHandles), "PxVehiclePvdAttributeHandles", __FILE__, __LINE__)); + PxMemZero(attributeHandles, sizeof(PxVehiclePvdAttributeHandles)); + + //Rigid body + attributeHandles->rigidBodyParams = registerRigidBodyParams(omniWriter); + attributeHandles->rigidBodyState = registerRigidBodyState(omniWriter); + + //Susp state calc params. + attributeHandles->suspStateCalcParams = registerSuspStateCalcParams(omniWriter); + + //Controls + attributeHandles->steerCommandResponseParams = registerSteerResponseParams(omniWriter); + attributeHandles->brakeCommandResponseParams = registerBrakeResponseParams(omniWriter); + attributeHandles->steerCommandResponseStates = registerSteerResponseStates(omniWriter); + attributeHandles->brakeCommandResponseStates = registerBrakeResponseStates(omniWriter); + + //Wheel attachment + attributeHandles->wheelParams = registerWheelParams(omniWriter); + attributeHandles->wheelActuationState = registerWheelActuationState(omniWriter); + attributeHandles->wheelRigidBody1dState = registerWheelRigidBody1dState(omniWriter); + attributeHandles->wheelLocalPoseState = registerWheelLocalPoseState(omniWriter); + attributeHandles->roadGeomState = registerRoadGeomState(omniWriter); + attributeHandles->suspParams = registerSuspParams(omniWriter); + attributeHandles->suspCompParams = registerSuspComplianceParams(omniWriter); + attributeHandles->suspForceParams = registerSuspForceParams(omniWriter); + attributeHandles->suspState = registerSuspState(omniWriter); + attributeHandles->suspCompState = registerSuspComplianceState(omniWriter); + attributeHandles->suspForce = registerSuspForce(omniWriter); + attributeHandles->tireParams = registerTireParams(omniWriter); + attributeHandles->tireDirectionState = registerTireDirectionState(omniWriter); + attributeHandles->tireSpeedState = registerTireSpeedState(omniWriter); + attributeHandles->tireSlipState = registerTireSlipState(omniWriter); + attributeHandles->tireStickyState = registerTireStickyState(omniWriter); + attributeHandles->tireGripState = registerTireGripState(omniWriter); + attributeHandles->tireCamberState = registerTireCamberState(omniWriter); + attributeHandles->tireForce = registerTireForce(omniWriter); + attributeHandles->wheelAttachment = registerWheelAttachment(omniWriter); + + //Antiroll + attributeHandles->antiRollParams = registerAntiRollParams(omniWriter); + attributeHandles->antiRollForce = registerAntiRollForce(omniWriter); + + //Direct drivetrain + attributeHandles->directDriveThrottleCommandResponseParams = registerDirectDriveThrottleResponseParams(omniWriter); + attributeHandles->directDriveCommandState = registerDirectDriveCommandState(omniWriter); + attributeHandles->directDriveTransmissionCommandState = registerDirectDriveTransmissionCommandState(omniWriter); + attributeHandles->directDriveThrottleCommandResponseState = registerDirectDriveThrottleResponseState(omniWriter); + attributeHandles->directDrivetrain = registerDirectDrivetrain(omniWriter); + + //Engine drivetrain + attributeHandles->engineDriveCommandState = registerEngineDriveCommandState(omniWriter); + attributeHandles->engineDriveTransmissionCommandState = registerEngineDriveTransmissionCommandState(omniWriter); + attributeHandles->clutchCommandResponseParams = registerClutchResponseParams(omniWriter); + attributeHandles->clutchParams = registerClutchParams(omniWriter); + attributeHandles->engineParams = registerEngineParams(omniWriter); + attributeHandles->gearboxParams = registerGearboxParams(omniWriter); + attributeHandles->autoboxParams = registerAutoboxParams(omniWriter); + attributeHandles->multiwheelDiffParams = registerMultiWheelDiffParams(omniWriter); + attributeHandles->fourwheelDiffParams = registerFourWheelDiffParams(omniWriter); + attributeHandles->clutchResponseState = registerClutchResponseState(omniWriter); + attributeHandles->throttleResponseState = registerThrottleResponseState(omniWriter); + attributeHandles->engineState = registerEngineState(omniWriter); + attributeHandles->gearboxState = registerGearboxState(omniWriter); + attributeHandles->autoboxState = registerAutoboxState(omniWriter); + attributeHandles->diffState = registerDiffState(omniWriter); + attributeHandles->clutchSlipState = registerClutchSlipState(omniWriter); + attributeHandles->engineDrivetrain = registerEngineDrivetrain(omniWriter); + + //Physx wheel attachment + attributeHandles->physxSuspLimitConstraintParams = registerSuspLimitConstraintParams(omniWriter); + attributeHandles->physxWheelShape = registerPhysXWheelShape(omniWriter); + attributeHandles->physxRoadGeomState = registerPhysXRoadGeomState(omniWriter); + attributeHandles->physxConstraintState = registerPhysXConstraintState(omniWriter); + attributeHandles->physxWheelAttachment = registerPhysXWheelAttachment(omniWriter); + attributeHandles->physxMaterialFriction = registerPhysXMaterialFriction(omniWriter); + + //Physx rigid actor + attributeHandles->physxRoadGeometryQueryParams = registerPhysXRoadGeometryQueryParams(omniWriter); + attributeHandles->physxRigidActor = registerPhysXRigidActor(omniWriter); + + //Vehicle + attributeHandles->vehicle = registerVehicle(omniWriter); + + return attributeHandles; +} + +/////////////////////////////// +//ATTRIBUTE DESTRUCTION +/////////////////////////////// + +void PxVehiclePvdAttributesRelease(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter, PxVehiclePvdAttributeHandles* attributeHandles) +{ + PX_CHECK_AND_RETURN(omniWriter, "PxVehiclePvdAttributesRelease: omniWriter must be a pointer to a valid OmniPvdWriter instance"); + PX_CHECK_AND_RETURN(attributeHandles, "PxVehiclePvdAttributesRelease: attributeHandles must be a pointer to a valid PxVehiclePvdAttributeHandles instance"); + PX_UNUSED(omniWriter); + allocator.deallocate(attributeHandles); +} + +//////////////////////////////////////// +//OBJECT REGISTRATION +//////////////////////////////////////// + +PxVehiclePvdObjectHandles* PxVehiclePvdObjectCreate +(const PxU32 nbWheels, const PxU32 nbAntirolls, const PxU32 maxNbPhysXMaterialFrictions, + const OmniPvdContextHandle contextHandle, const PxVehiclePvdAttributeHandles& attributeHandles, OmniPvdWriter* omniWriter, + PxAllocatorCallback& allocator) +{ + PX_CHECK_AND_RETURN_NULL(omniWriter, "PxVehiclePvdObjectCreate: omniWriter must be a pointer to a valid OmniPvdWriter instance"); + + PX_UNUSED(omniWriter); + PX_UNUSED(attributeHandles); + + const PxU32 byteSize = + sizeof(PxVehiclePvdObjectHandles) + + sizeof(OmniPvdObjectHandle)*nbWheels*( + 1 + //OmniPvdObjectHandle* wheelAttachmentOHs; + 1 + //OmniPvdObjectHandle* wheelParamsOHs; + 1 + //OmniPvdObjectHandle* wheelActuationStateOHs; + 1 + //OmniPvdObjectHandle* wheelRigidBody1dStateOHs; + 1 + //OmniPvdObjectHandle* wheelLocalPoseStateOHs; + 1 + //OmniPvdObjectHandle* roadGeomStateOHs; + 1 + //OmniPvdObjectHandle* suspParamsOHs; + 1 + //OmniPvdObjectHandle* suspCompParamsOHs; + 1 + //OmniPvdObjectHandle* suspForceParamsOHs; + 1 + //OmniPvdObjectHandle* suspStateOHs; + 1 + //OmniPvdObjectHandle* suspCompStateOHs; + 1 + //OmniPvdObjectHandle* suspForceOHs; + 1 + //OmniPvdObjectHandle* tireParamsOHs; + 1 + //OmniPvdObjectHandle* tireDirectionStateOHs; + 1 + //OmniPvdObjectHandle* tireSpeedStateOHs; + 1 + //OmniPvdObjectHandle* tireSlipStateOHs; + 1 + //OmniPvdObjectHandle* tireStickyStateOHs; + 1 + //OmniPvdObjectHandle* tireGripStateOHs; + 1 + //OmniPvdObjectHandle* tireCamberStateOHs; + 1 + //OmniPvdObjectHandle* tireForceOHs; + 1 + //OmniPvdObjectHandle* physxWheelAttachmentOHs; + 1 + //OmniPvdObjectHandle* physxWheelShapeOHs; + 1 + //OmniPvdObjectHandle* physxConstraintParamOHs; + 1 + //OmniPvdObjectHandle* physxConstraintStateOHs; + 1 + //OmniPvdObjectHandle* physxRoadGeomStateOHs; + 1 + //OmniPvdObjectHandle* physxMaterialFrictionSetOHs; + maxNbPhysXMaterialFrictions) + //OmniPvdObjectHandle* physxMaterialFrictionOHs; + sizeof(OmniPvdObjectHandle)*nbAntirolls*( + 1); //OmniPvdObjectHandle* antiRollParamOHs + + + PxU8* buffer = reinterpret_cast(allocator.allocate(byteSize, "PxVehiclePvdObjectHandles", __FILE__, __LINE__)); +#if PX_ENABLE_ASSERTS + PxU8* start = buffer; +#endif + PxMemZero(buffer, byteSize); + + PxVehiclePvdObjectHandles* objectHandles = reinterpret_cast(buffer); + buffer += sizeof(PxVehiclePvdObjectHandles); + + if(nbWheels != 0) + { + objectHandles->wheelAttachmentOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->wheelParamsOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->wheelActuationStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->wheelRigidBody1dStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->wheelLocalPoseStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->roadGeomStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspParamsOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspCompParamsOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspForceParamsOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspCompStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->suspForceOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireParamsOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireDirectionStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireSpeedStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireSlipStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireStickyStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireGripStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireCamberStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->tireForceOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxWheelAttachmentOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxConstraintParamOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxWheelShapeOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxConstraintStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxRoadGeomStateOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + if(maxNbPhysXMaterialFrictions != 0) + { + objectHandles->physxMaterialFrictionSetOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels; + objectHandles->physxMaterialFrictionOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbWheels*maxNbPhysXMaterialFrictions; + } + } + + if(nbAntirolls != 0) + { + objectHandles->antiRollParamOHs = reinterpret_cast(buffer); + buffer += sizeof(OmniPvdObjectHandle)*nbAntirolls; + } + + objectHandles->nbWheels = nbWheels; + objectHandles->nbPhysXMaterialFrictions = maxNbPhysXMaterialFrictions; + objectHandles->nbAntirolls = nbAntirolls; + + objectHandles->contextHandle = contextHandle; + + PX_ASSERT((start + byteSize) == buffer); + + return objectHandles; +} + +//////////////////////////////////// +//OBJECT DESTRUCTION +//////////////////////////////////// + +PX_FORCE_INLINE void destroyObject +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle oh) +{ + if(oh != 0) + omniWriter->destroyObject(ch, oh); +} + +PX_FORCE_INLINE void removeFromSet +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle setOwnerOH, OmniPvdAttributeHandle setAH, OmniPvdObjectHandle ohToRemove) +{ + if(ohToRemove != 0 && setOwnerOH != 0) + omniWriter->removeFromSetAttributeShallow(ch, setOwnerOH, setAH, reinterpret_cast(&ohToRemove), sizeof(OmniPvdObjectHandle)); +} + +void PxVehiclePvdObjectRelease +(const PxVehiclePvdAttributeHandles& ah, + OmniPvdWriter* ow, PxAllocatorCallback& allocator, PxVehiclePvdObjectHandles* oh) +{ + PX_CHECK_AND_RETURN(ow, "PxVehiclePvdObjectRelease: omniWriter must be a pointer to a valid OmniPvdWriter instance"); + PX_CHECK_AND_RETURN(oh, "PxVehiclePvdObjectRelease: objectHandles must be a pointer to a valid PxVehiclePvdObjectHandles instance"); + + const OmniPvdContextHandle ch = oh->contextHandle; + + //rigid body + destroyObject(ow, ch, oh->rigidBodyParamsOH); + destroyObject(ow, ch, oh->rigidBodyStateOH); + + //susp state calc params + destroyObject(ow, ch, oh->suspStateCalcParamsOH); + + //controls + for(PxU32 i = 0; i < 2; i++) + { + removeFromSet(ow, ch, oh->vehicleOH, ah.vehicle.brakeResponseParamsSetAH, oh->brakeResponseParamOHs[i]); + destroyObject(ow, ch, oh->brakeResponseParamOHs[i]); + } + destroyObject(ow, ch, oh->steerResponseParamsOH); + destroyObject(ow, ch, oh->brakeResponseStateOH); + destroyObject(ow, ch, oh->steerResponseStateOH); + + //Wheel attachments + for(PxU32 i = 0; i < oh->nbWheels; i++) + { + destroyObject(ow, ch, oh->wheelParamsOHs[i]); + destroyObject(ow, ch, oh->wheelActuationStateOHs[i]); + destroyObject(ow, ch, oh->wheelRigidBody1dStateOHs[i]); + destroyObject(ow, ch, oh->wheelLocalPoseStateOHs[i]); + destroyObject(ow, ch, oh->suspParamsOHs[i]); + destroyObject(ow, ch, oh->suspCompParamsOHs[i]); + destroyObject(ow, ch, oh->suspForceParamsOHs[i]); + destroyObject(ow, ch, oh->suspStateOHs[i]); + destroyObject(ow, ch, oh->suspCompStateOHs[i]); + destroyObject(ow, ch, oh->suspForceOHs[i]); + destroyObject(ow, ch, oh->tireParamsOHs[i]); + destroyObject(ow, ch, oh->tireDirectionStateOHs[i]); + destroyObject(ow, ch, oh->tireSpeedStateOHs[i]); + destroyObject(ow, ch, oh->tireSlipStateOHs[i]); + destroyObject(ow, ch, oh->tireStickyStateOHs[i]); + destroyObject(ow, ch, oh->tireGripStateOHs[i]); + destroyObject(ow, ch, oh->tireCamberStateOHs[i]); + destroyObject(ow, ch, oh->tireForceOHs[i]); + removeFromSet(ow, oh->vehicleOH, ch, ah.vehicle.wheelAttachmentSetAH, oh->wheelAttachmentOHs[i]); + destroyObject(ow, ch, oh->wheelAttachmentOHs[i]); + } + + //Antiroll + for(PxU32 i = 0; i < oh->nbAntirolls; i++) + { + removeFromSet(ow, ch, oh->vehicleOH, ah.vehicle.antiRollSetAH, oh->antiRollParamOHs[i]); + destroyObject(ow, ch, oh->antiRollParamOHs[i]); + } + destroyObject(ow, ch, oh->antiRollTorqueOH); + + //direct drive + destroyObject(ow, ch, oh->directDriveCommandStateOH); + destroyObject(ow, ch, oh->directDriveTransmissionCommandStateOH); + destroyObject(ow, ch, oh->directDriveThrottleResponseParamsOH); + destroyObject(ow, ch, oh->directDriveThrottleResponseStateOH); + destroyObject(ow, ch, oh->directDrivetrainOH); + + //engine drive + destroyObject(ow, ch, oh->engineDriveCommandStateOH); + destroyObject(ow, ch, oh->engineDriveTransmissionCommandStateOH); + destroyObject(ow, ch, oh->clutchResponseParamsOH); + destroyObject(ow, ch, oh->clutchParamsOH); + destroyObject(ow, ch, oh->engineParamsOH); + destroyObject(ow, ch, oh->gearboxParamsOH); + destroyObject(ow, ch, oh->autoboxParamsOH); + destroyObject(ow, ch, oh->multiWheelDiffParamsOH); + destroyObject(ow, ch, oh->fourWheelDiffParamsOH); + destroyObject(ow, ch, oh->clutchResponseStateOH); + destroyObject(ow, ch, oh->engineDriveThrottleResponseStateOH); + destroyObject(ow, ch, oh->engineStateOH); + destroyObject(ow, ch, oh->gearboxStateOH); + destroyObject(ow, ch, oh->autoboxStateOH); + destroyObject(ow, ch, oh->diffStateOH); + destroyObject(ow, ch, oh->clutchSlipStateOH); + destroyObject(ow, ch, oh->engineDrivetrainOH); + + //PhysX Wheel attachments + for(PxU32 i = 0; i < oh->nbWheels; i++) + { + destroyObject(ow, ch, oh->physxConstraintParamOHs[i]); + destroyObject(ow, ch, oh->physxWheelShapeOHs[i]); + destroyObject(ow, ch, oh->physxRoadGeomStateOHs[i]); + destroyObject(ow, ch, oh->physxConstraintStateOHs[i]); + for(PxU32 j = 0; j < oh->nbPhysXMaterialFrictions; j++) + { + const PxU32 id = i*oh->nbPhysXMaterialFrictions + j; + removeFromSet(ow, ch, + oh->physxWheelAttachmentOHs[i], ah.physxWheelAttachment.physxMaterialFrictionSetAH, + oh->physxMaterialFrictionOHs[id]); + destroyObject(ow, ch, oh->physxMaterialFrictionOHs[id]); + } + removeFromSet(ow, ch, oh->vehicleOH, ah.vehicle.physxWheelAttachmentSetAH, oh->physxWheelAttachmentOHs[i]); + destroyObject(ow, ch, oh->physxWheelAttachmentOHs[i]); + } + + //Physx rigid actor + destroyObject(ow, ch, oh->physxRoadGeomQueryParamOH); + destroyObject(ow, ch, oh->physxRigidActorOH); + + //Free the memory. + allocator.deallocate(oh); +} + +#else //#if PX_SUPPORT_OMNI_PVD + +PxVehiclePvdAttributeHandles* PxVehiclePvdAttributesCreate(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter) +{ + PX_UNUSED(allocator); + PX_UNUSED(omniWriter); + return NULL; +} + +void PxVehiclePvdAttributesRelease(PxAllocatorCallback& allocator, OmniPvdWriter* omniWriter, PxVehiclePvdAttributeHandles* attributeHandles) +{ + PX_UNUSED(allocator); + PX_UNUSED(omniWriter); + PX_UNUSED(attributeHandles); +} + +PxVehiclePvdObjectHandles* PxVehiclePvdObjectCreate +(const PxU32 nbWheels, const PxU32 nbAntirolls, const PxU32 maxNbPhysXMaterialFrictions, + const PxU64 contextHandle, const PxVehiclePvdAttributeHandles& attributeHandles, OmniPvdWriter* omniWriter, + PxAllocatorCallback& allocator) +{ + PX_UNUSED(nbWheels); + PX_UNUSED(nbAntirolls); + PX_UNUSED(maxNbPhysXMaterialFrictions); + PX_UNUSED(contextHandle); + PX_UNUSED(attributeHandles); + PX_UNUSED(omniWriter); + PX_UNUSED(allocator); + return NULL; +} + +void PxVehiclePvdObjectRelease +(const PxVehiclePvdAttributeHandles& ah, + OmniPvdWriter* ow, PxAllocatorCallback& allocator, PxVehiclePvdObjectHandles* oh) +{ + PX_UNUSED(ah); + PX_UNUSED(ow); + PX_UNUSED(allocator); + PX_UNUSED(oh); +} + +#endif //#if PX_SUPPORT_OMNI_PVD + + +} // namespace vehicle2 +} // namespace physx + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdObjectHandles.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdObjectHandles.h new file mode 100644 index 0000000..cfc9848 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdObjectHandles.h @@ -0,0 +1,137 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +#include "vehicle2/PxVehicleLimits.h" +#if PX_SUPPORT_OMNI_PVD +#include "OmniPvdWriter.h" +#endif +#include "foundation/PxMemory.h" + +/** \addtogroup vehicle2 + @{ +*/ + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +struct PxVehiclePvdObjectHandles +{ +#if PX_SUPPORT_OMNI_PVD + + OmniPvdObjectHandle vehicleOH; + + OmniPvdObjectHandle rigidBodyParamsOH; + OmniPvdObjectHandle rigidBodyStateOH; + + OmniPvdObjectHandle suspStateCalcParamsOH; + + OmniPvdObjectHandle brakeResponseParamOHs[2]; + OmniPvdObjectHandle steerResponseParamsOH; + OmniPvdObjectHandle brakeResponseStateOH; + OmniPvdObjectHandle steerResponseStateOH; + + OmniPvdObjectHandle directDriveCommandStateOH; + OmniPvdObjectHandle directDriveTransmissionCommandStateOH; + OmniPvdObjectHandle directDriveThrottleResponseParamsOH; + OmniPvdObjectHandle directDriveThrottleResponseStateOH; + OmniPvdObjectHandle directDrivetrainOH; + + OmniPvdObjectHandle engineDriveCommandStateOH; + OmniPvdObjectHandle engineDriveTransmissionCommandStateOH; + OmniPvdObjectHandle clutchResponseParamsOH; + OmniPvdObjectHandle clutchParamsOH; + OmniPvdObjectHandle engineParamsOH; + OmniPvdObjectHandle gearboxParamsOH; + OmniPvdObjectHandle autoboxParamsOH; + OmniPvdObjectHandle multiWheelDiffParamsOH; + OmniPvdObjectHandle fourWheelDiffParamsOH; + OmniPvdObjectHandle clutchResponseStateOH; + OmniPvdObjectHandle engineDriveThrottleResponseStateOH; + OmniPvdObjectHandle engineStateOH; + OmniPvdObjectHandle gearboxStateOH; + OmniPvdObjectHandle autoboxStateOH; + OmniPvdObjectHandle diffStateOH; + OmniPvdObjectHandle clutchSlipStateOH; + OmniPvdObjectHandle engineDrivetrainOH; + + OmniPvdObjectHandle* wheelAttachmentOHs; + OmniPvdObjectHandle* wheelParamsOHs; + OmniPvdObjectHandle* wheelActuationStateOHs; + OmniPvdObjectHandle* wheelRigidBody1dStateOHs; + OmniPvdObjectHandle* wheelLocalPoseStateOHs; + OmniPvdObjectHandle* roadGeomStateOHs; + OmniPvdObjectHandle* suspParamsOHs; + OmniPvdObjectHandle* suspCompParamsOHs; + OmniPvdObjectHandle* suspForceParamsOHs; + OmniPvdObjectHandle* suspStateOHs; + OmniPvdObjectHandle* suspCompStateOHs; + OmniPvdObjectHandle* suspForceOHs; + OmniPvdObjectHandle* tireParamsOHs; + OmniPvdObjectHandle* tireDirectionStateOHs; + OmniPvdObjectHandle* tireSpeedStateOHs; + OmniPvdObjectHandle* tireSlipStateOHs; + OmniPvdObjectHandle* tireStickyStateOHs; + OmniPvdObjectHandle* tireGripStateOHs; + OmniPvdObjectHandle* tireCamberStateOHs; + OmniPvdObjectHandle* tireForceOHs; + + OmniPvdObjectHandle* physxWheelAttachmentOHs; + OmniPvdObjectHandle* physxWheelShapeOHs; + OmniPvdObjectHandle* physxConstraintParamOHs; + OmniPvdObjectHandle* physxConstraintStateOHs; + OmniPvdObjectHandle* physxRoadGeomStateOHs; + OmniPvdObjectHandle* physxMaterialFrictionSetOHs; + OmniPvdObjectHandle* physxMaterialFrictionOHs; + + OmniPvdObjectHandle physxRoadGeomQueryParamOH; + OmniPvdObjectHandle physxRigidActorOH; + + OmniPvdObjectHandle* antiRollParamOHs; + OmniPvdObjectHandle antiRollTorqueOH; + + PxU32 nbWheels; + PxU32 nbPhysXMaterialFrictions; + PxU32 nbAntirolls; + + OmniPvdContextHandle contextHandle; + +#endif //PX_SUPPORT_OMNI_PVD +}; + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.cpp new file mode 100644 index 0000000..2f3214d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.cpp @@ -0,0 +1,1629 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "VhPvdWriter.h" + +namespace physx +{ +namespace vehicle2 +{ + +#if PX_SUPPORT_OMNI_PVD + +PX_FORCE_INLINE void writeFloatAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, float val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(float)); +} + +PX_FORCE_INLINE void writeFloatArrayAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const float* val, const PxU32 nbVals) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(val), sizeof(float) * nbVals); +} + +PX_FORCE_INLINE void writeUInt32ArrayAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const uint32_t* val, const PxU32 nbVals) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(val), sizeof(uint32_t) * nbVals); +} + + +PX_FORCE_INLINE void writeVec3Attribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const PxVec3& val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(PxVec3)); +} + +PX_FORCE_INLINE void writePlaneAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const PxPlane& val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(PxPlane)); +} + + +PX_FORCE_INLINE void writeQuatAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const PxQuat& val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(PxQuat)); +} + +PX_FORCE_INLINE void writeUInt8Attribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, uint8_t val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(uint8_t)); +} + +PX_FORCE_INLINE void writeUInt32Attribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, uint32_t val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(uint32_t)); +} + +PX_FORCE_INLINE void writeFlagAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, uint32_t val) +{ + writeUInt32Attribute(omniWriter, ch, oh, ah, val); +} + +PX_FORCE_INLINE void writeLookupTableAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, PxVehicleFixedSizeLookupTable val) +{ + float buffer[6] = { -1.0f, 0.0f, -1.0f, 0.0f, -1.0f, 0.0f }; + for(PxU32 i = 0; i < val.nbDataPairs; i++) + { + buffer[2 * i + 0] = val.xVals[i]; + buffer[2 * i + 1] = val.yVals[i]; + } + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(buffer), sizeof(buffer)); +} + +PX_FORCE_INLINE void writeLookupTableAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, PxVehicleFixedSizeLookupTable val) +{ + float buffer[12] = { -1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f }; + for(PxU32 i = 0; i < val.nbDataPairs; i++) + { + buffer[4 * i + 0] = val.xVals[i]; + buffer[4 * i + 1] = val.yVals[i].x; + buffer[4 * i + 2] = val.yVals[i].y; + buffer[4 * i + 3] = val.yVals[i].z; + } + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(buffer), sizeof(buffer)); +} + +void writePtrAttribute +(OmniPvdWriter* omniWriter, OmniPvdContextHandle ch, + OmniPvdObjectHandle oh, OmniPvdAttributeHandle ah, const void* val) +{ + omniWriter->setAttributeShallow(ch, oh, ah, reinterpret_cast(&val), sizeof(val)); +} + +//////////////////////////////// +//RIGID BODY +//////////////////////////////// + +RigidBodyParams registerRigidBodyParams(OmniPvdWriter* omniWriter) +{ + RigidBodyParams r; + r.CH = omniWriter->registerClass("RigidBodyParams"); + r.massAH = omniWriter->registerAttribute(r.CH, "mass", OmniPvdDataTypeEnum::eFLOAT32, 1); + r.moiAH = omniWriter->registerAttribute(r.CH, "moi", OmniPvdDataTypeEnum::eFLOAT32, 3); + return r; +} + +void writeRigidBodyParams +(const PxVehicleRigidBodyParams& rbodyParams, + const OmniPvdObjectHandle oh, const RigidBodyParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.massAH, rbodyParams.mass); + writeVec3Attribute(omniWriter, ch, oh, ah.moiAH, rbodyParams.moi); +} + +RigidBodyState registerRigidBodyState(OmniPvdWriter* omniWriter) +{ + RigidBodyState r; + r.CH = omniWriter->registerClass("RigidBodyState"); + r.posAH = omniWriter->registerAttribute(r.CH, "pos", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.quatAH = omniWriter->registerAttribute(r.CH, "quat", OmniPvdDataTypeEnum::eFLOAT32, 4); + r.linearVelocityAH = omniWriter->registerAttribute(r.CH, "linvel", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.angularVelocityAH = omniWriter->registerAttribute(r.CH, "angvel", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.previousLinearVelocityAH = omniWriter->registerAttribute(r.CH, "prevLinvel", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.previousAngularVelocityAH = omniWriter->registerAttribute(r.CH, "prevAngvel", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.externalForceAH = omniWriter->registerAttribute(r.CH, "extForce", OmniPvdDataTypeEnum::eFLOAT32, 3); + r.externalTorqueAH = omniWriter->registerAttribute(r.CH, "extTorque", OmniPvdDataTypeEnum::eFLOAT32, 3); + return r; +} + +void writeRigidBodyState +(const PxVehicleRigidBodyState& rbodyState, + const OmniPvdObjectHandle oh, const RigidBodyState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.posAH, rbodyState.pose.p); + writeQuatAttribute(omniWriter, ch, oh, ah.quatAH, rbodyState.pose.q); + writeVec3Attribute(omniWriter, ch, oh, ah.linearVelocityAH, rbodyState.linearVelocity); + writeVec3Attribute(omniWriter, ch, oh, ah.angularVelocityAH, rbodyState.angularVelocity); + writeVec3Attribute(omniWriter, ch, oh, ah.previousLinearVelocityAH, rbodyState.previousLinearVelocity); + writeVec3Attribute(omniWriter, ch, oh, ah.previousAngularVelocityAH, rbodyState.previousAngularVelocity); + writeVec3Attribute(omniWriter, ch, oh, ah.externalForceAH, rbodyState.externalForce); + writeVec3Attribute(omniWriter, ch, oh, ah.externalTorqueAH, rbodyState.externalTorque); +} + + + + +///////////////////////////////// +//CONTROLS +///////////////////////////////// + +WheelResponseParams registerWheelResponseParams(const char* name, OmniPvdWriter* omniWriter) +{ + WheelResponseParams w; + w.CH = omniWriter->registerClass(name); + w.maxResponseAH = omniWriter->registerAttribute(w.CH, "maxResponse", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.responseMultipliers0To3AH = omniWriter->registerAttribute(w.CH, "wheelMultipliers0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseMultipliers4To7AH = omniWriter->registerAttribute(w.CH, "wheelMultipliers4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseMultipliers8To11AH = omniWriter->registerAttribute(w.CH, "wheelMultipliers8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseMultipliers12To15AH = omniWriter->registerAttribute(w.CH, "wheelMultipliers12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseMultipliers16To19AH = omniWriter->registerAttribute(w.CH, "wheelMultipliers16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + return w; +} + +WheelResponseParams registerSteerResponseParams(OmniPvdWriter* omniWriter) +{ + return registerWheelResponseParams("SteerResponseParams", omniWriter); +} + +WheelResponseParams registerBrakeResponseParams(OmniPvdWriter* omniWriter) +{ + return registerWheelResponseParams("BrakeResponseParams", omniWriter); +} + +WheelResponseStates registerWheelResponseStates(const char* name, OmniPvdWriter* omniWriter) +{ + WheelResponseStates w; + w.CH = omniWriter->registerClass(name); + w.responseStates0To3AH = omniWriter->registerAttribute(w.CH, "wheelStates0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseStates4To7AH = omniWriter->registerAttribute(w.CH, "wheelStatess4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseStates8To11AH = omniWriter->registerAttribute(w.CH, "wheelStates8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseStates12To15AH = omniWriter->registerAttribute(w.CH, "wheelStates12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + w.responseStates16To19AH = omniWriter->registerAttribute(w.CH, "wheelStates16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + return w; +} + +WheelResponseStates registerSteerResponseStates(OmniPvdWriter* omniWriter) +{ + return registerWheelResponseStates("SteerResponseState", omniWriter); +} + +WheelResponseStates registerBrakeResponseStates(OmniPvdWriter* omniWriter) +{ + return registerWheelResponseStates("BrakeResponseState", omniWriter); +} + +void writeWheelResponseParams +(const PxVehicleAxleDescription& axleDesc, const PxVehicleCommandResponseParams& responseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.maxResponseAH, responseParams.maxResponse); + + float responseMultipliers[PxVehicleLimits::eMAX_NB_WHEELS]; + for(PxU32 i = 0; i < PxVehicleLimits::eMAX_NB_WHEELS; i++) + { + responseMultipliers[i] = PX_MAX_F32; + } + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + responseMultipliers[wheelId] = responseParams.wheelResponseMultipliers[wheelId]; + } + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseMultipliers0To3AH, responseMultipliers + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseMultipliers4To7AH, responseMultipliers + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseMultipliers8To11AH, responseMultipliers + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseMultipliers12To15AH, responseMultipliers + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseMultipliers16To19AH, responseMultipliers + 16, 4); +} + +void writeSteerResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSteerCommandResponseParams& steerResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeWheelResponseParams(axleDesc, steerResponseParams, oh, ah, omniWriter, ch); +} + +void writeBrakeResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleBrakeCommandResponseParams& brakeResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeWheelResponseParams(axleDesc, brakeResponseParams, oh, ah, omniWriter, ch); +} + +void writeWheelResponseStates +(const PxVehicleAxleDescription& axleDesc, const PxVehicleArrayData& responseState, + const OmniPvdObjectHandle oh, const WheelResponseStates& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + float responseStates[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemZero(responseStates, sizeof(responseStates)); + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + responseStates[wheelId] = responseState[wheelId]; + } + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseStates0To3AH, responseStates + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseStates4To7AH, responseStates + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseStates8To11AH, responseStates + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseStates12To15AH, responseStates + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.responseStates16To19AH, responseStates + 16, 4); +} + +void writeSteerResponseStates +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& steerResponseStates, + const OmniPvdObjectHandle oh, const WheelResponseStates& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeWheelResponseStates(axleDesc, steerResponseStates, oh, ah, omniWriter, ch); +} + +void writeBrakeResponseStates +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& brakeResponseStates, + const OmniPvdObjectHandle oh, const WheelResponseStates& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeWheelResponseStates(axleDesc, brakeResponseStates, oh, ah, omniWriter, ch); +} + + +void writeClutchResponseParams +(const PxVehicleClutchCommandResponseParams& clutchResponseParams, + const OmniPvdObjectHandle oh, const ClutchResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.maxResponseAH, clutchResponseParams.maxResponse); +} + +////////////////////////////// +//WHEEL ATTACHMENTS +////////////////////////////// + +WheelParams registerWheelParams(OmniPvdWriter* omniWriter) +{ + WheelParams w; + w.CH = omniWriter->registerClass("WheelParams"); + w.wheelRadiusAH = omniWriter->registerAttribute(w.CH, "radius", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.halfWidthAH = omniWriter->registerAttribute(w.CH, "halfWidth", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.massAH = omniWriter->registerAttribute(w.CH, "mass", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.moiAH = omniWriter->registerAttribute(w.CH, "moi", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.dampingRateAH = omniWriter->registerAttribute(w.CH, "dampingRate", OmniPvdDataTypeEnum::eFLOAT32, 1); + return w; +} + +void writeWheelParams +(const PxVehicleWheelParams& params, + const OmniPvdObjectHandle oh, const WheelParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.dampingRateAH, params.dampingRate); + writeFloatAttribute(omniWriter, ch, oh, ah.halfWidthAH, params.halfWidth); + writeFloatAttribute(omniWriter, ch, oh, ah.massAH, params.mass); + writeFloatAttribute(omniWriter, ch, oh, ah.moiAH, params.moi); + writeFloatAttribute(omniWriter, ch, oh, ah.wheelRadiusAH, params.radius); +} + +WheelActuationState registerWheelActuationState(OmniPvdWriter* omniWriter) +{ + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("WheelStateBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + + WheelActuationState w; + w.CH = omniWriter->registerClass("WheelActuationState"); + w.isBrakeAppliedAH = omniWriter->registerFlagsAttribute(w.CH, boolAsEnum.CH, "isBrakeApplied"); + w.isDriveAppliedAH = omniWriter->registerFlagsAttribute(w.CH, boolAsEnum.CH, "isDriveApplied"); + + return w; +} + +void writeWheelActuationState +(const PxVehicleWheelActuationState& actState, + const OmniPvdObjectHandle oh, const WheelActuationState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.isBrakeAppliedAH, actState.isBrakeApplied ? 1 : 0); + writeFlagAttribute(omniWriter, ch, oh, ah.isDriveAppliedAH, actState.isDriveApplied ? 1 : 0); +} + +WheelRigidBody1dState registerWheelRigidBody1dState(OmniPvdWriter* omniWriter) +{ + WheelRigidBody1dState w; + w.CH = omniWriter->registerClass("WheelRigidBodyState"); + w.rotationSpeedAH = omniWriter->registerAttribute(w.CH, "rotationSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.correctedRotationSpeedAH = omniWriter->registerAttribute(w.CH, "correctedRotationSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + w.rotationAngleAH = omniWriter->registerAttribute(w.CH, "rotationAngle", OmniPvdDataTypeEnum::eFLOAT32, 1); + return w; +} + +void writeWheelRigidBody1dState +(const PxVehicleWheelRigidBody1dState& rigidBodyState, + const OmniPvdObjectHandle oh, const WheelRigidBody1dState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.rotationSpeedAH, rigidBodyState.rotationSpeed); + writeFloatAttribute(omniWriter, ch, oh, ah.correctedRotationSpeedAH, rigidBodyState.correctedRotationSpeed); + writeFloatAttribute(omniWriter, ch, oh, ah.rotationAngleAH, rigidBodyState.rotationAngle); +} + +WheelLocalPoseState registerWheelLocalPoseState(OmniPvdWriter* omniWriter) +{ + WheelLocalPoseState w; + w.CH = omniWriter->registerClass("WheelLocalPoseState"); + w.posAH = omniWriter->registerAttribute(w.CH, "posInRbodyFrame", OmniPvdDataTypeEnum::eFLOAT32, 3); + w.quatAH = omniWriter->registerAttribute(w.CH, "quatInRbodyFrame", OmniPvdDataTypeEnum::eFLOAT32, 4); + return w; +} + +void writeWheelLocalPoseState +(const PxVehicleWheelLocalPose& pose, + const OmniPvdObjectHandle oh, const WheelLocalPoseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.posAH, pose.localPose.p); + writeQuatAttribute(omniWriter, ch, oh, ah.quatAH, pose.localPose.q); +} + +RoadGeometryState registerRoadGeomState(OmniPvdWriter* omniWriter) +{ + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("RoadGeomStateBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + RoadGeometryState r; + r.CH = omniWriter->registerClass("RoadGeometryState"); + r.planeAH = omniWriter->registerAttribute(r.CH, "plane", OmniPvdDataTypeEnum::eFLOAT32, 4); + r.frictionAH = omniWriter->registerAttribute(r.CH, "friction", OmniPvdDataTypeEnum::eFLOAT32, 1); + r.hitStateAH = omniWriter->registerFlagsAttribute(r.CH, boolAsEnum.CH, "hitState"); + r.velocityAH = omniWriter->registerAttribute(r.CH, "hitVelocity", OmniPvdDataTypeEnum::eFLOAT32, 3); + return r; +} + +void writeRoadGeomState +(const PxVehicleRoadGeometryState& roadGeometryState, + const OmniPvdObjectHandle oh, const RoadGeometryState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writePlaneAttribute(omniWriter, ch, oh, ah.planeAH, roadGeometryState.plane); + writeFloatAttribute(omniWriter, ch, oh, ah.frictionAH, roadGeometryState.friction); + writeFlagAttribute(omniWriter, ch, oh, ah.hitStateAH, roadGeometryState.hitState); + writeVec3Attribute(omniWriter, ch, oh, ah.velocityAH, roadGeometryState.velocity); +} + +SuspParams registerSuspParams(OmniPvdWriter* omniWriter) +{ + SuspParams s; + s.CH = omniWriter->registerClass("SuspensionParams"); + s.suspAttachmentPosAH = omniWriter->registerAttribute(s.CH, "suspAttachmentPos", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.suspAttachmentQuatAH = omniWriter->registerAttribute(s.CH, "suspAttachmentQuat", OmniPvdDataTypeEnum::eFLOAT32, 4); + s.suspDirAH = omniWriter->registerAttribute(s.CH, "suspDir", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.suspTravleDistAH = omniWriter->registerAttribute(s.CH, "suspTravelDist", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.wheelAttachmentPosAH = omniWriter->registerAttribute(s.CH, "wheelAttachmentPos", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.wheelAttachmentQuatAH = omniWriter->registerAttribute(s.CH, "wheelAttachmentQuat", OmniPvdDataTypeEnum::eFLOAT32, 3); + return s; +} + +void writeSuspParams +(const PxVehicleSuspensionParams& suspParams, + const OmniPvdObjectHandle oh, const SuspParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.suspAttachmentPosAH, suspParams.suspensionAttachment.p); + writeQuatAttribute(omniWriter, ch, oh, ah.suspAttachmentQuatAH, suspParams.suspensionAttachment.q); + writeVec3Attribute(omniWriter, ch, oh, ah.suspDirAH, suspParams.suspensionTravelDir); + writeFloatAttribute(omniWriter, ch, oh, ah.suspTravleDistAH, suspParams.suspensionTravelDist); + writeVec3Attribute(omniWriter, ch, oh, ah.wheelAttachmentPosAH, suspParams.wheelAttachment.p); + writeQuatAttribute(omniWriter, ch, oh, ah.wheelAttachmentQuatAH, suspParams.wheelAttachment.q); +} + + +SuspCompParams registerSuspComplianceParams(OmniPvdWriter* omniWriter) +{ + SuspCompParams s; + s.CH = omniWriter->registerClass("SuspensionComplianceParams"); + s.toeAngleAH = omniWriter->registerAttribute(s.CH, "toeAngle", OmniPvdDataTypeEnum::eFLOAT32, 6); + s.camberAngleAH = omniWriter->registerAttribute(s.CH, "camberAngle", OmniPvdDataTypeEnum::eFLOAT32, 6); + s.suspForceAppPointAH = omniWriter->registerAttribute(s.CH, "suspForceAppPoint", OmniPvdDataTypeEnum::eFLOAT32, 12); + s.tireForceAppPointAH = omniWriter->registerAttribute(s.CH, "tireForceAppPoint", OmniPvdDataTypeEnum::eFLOAT32, 12); + return s; +} + +void writeSuspComplianceParams +(const PxVehicleSuspensionComplianceParams& compParams, + const OmniPvdObjectHandle oh, const SuspCompParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeLookupTableAttribute(omniWriter, ch, oh, ah.camberAngleAH, compParams.wheelCamberAngle); + writeLookupTableAttribute(omniWriter, ch, oh, ah.toeAngleAH, compParams.wheelToeAngle); + writeLookupTableAttribute(omniWriter, ch, oh, ah.suspForceAppPointAH, compParams.suspForceAppPoint); + writeLookupTableAttribute(omniWriter, ch, oh, ah.tireForceAppPointAH, compParams.tireForceAppPoint); +} + +SuspForceParams registerSuspForceParams(OmniPvdWriter* omniWriter) +{ + SuspForceParams s; + s.CH = omniWriter->registerClass("SuspensionForceParams"); + s.stiffnessAH = omniWriter->registerAttribute(s.CH, "stiffness", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.dampingAH = omniWriter->registerAttribute(s.CH, "damping", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.sprungMassAH = omniWriter->registerAttribute(s.CH, "sprungMass", OmniPvdDataTypeEnum::eFLOAT32, 1); + return s; +} + +void writeSuspForceParams +(const PxVehicleSuspensionForceParams& forceParams, + const OmniPvdObjectHandle oh, const SuspForceParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.dampingAH, forceParams.damping); + writeFloatAttribute(omniWriter, ch, oh, ah.sprungMassAH, forceParams.sprungMass); + writeFloatAttribute(omniWriter, ch, oh, ah.stiffnessAH, forceParams.stiffness); +} + +SuspState registerSuspState(OmniPvdWriter* omniWriter) +{ + SuspState s; + s.CH = omniWriter->registerClass("SuspensionState"); + s.jounceAH = omniWriter->registerAttribute(s.CH, "jounce", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.jounceSpeedAH = omniWriter->registerAttribute(s.CH, "jounceSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.separationAH = omniWriter->registerAttribute(s.CH, "separation", OmniPvdDataTypeEnum::eFLOAT32, 1); + return s; +} + +void writeSuspState +(const PxVehicleSuspensionState& suspState, + const OmniPvdObjectHandle oh, const SuspState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.jounceAH, suspState.jounce); + writeFloatAttribute(omniWriter, ch, oh, ah.jounceSpeedAH, suspState.jounceSpeed); + writeFloatAttribute(omniWriter, ch, oh, ah.separationAH, suspState.separation); +} + +SuspCompState registerSuspComplianceState(OmniPvdWriter* omniWriter) +{ + SuspCompState s; + s.CH = omniWriter->registerClass("SuspensionComplianceState"); + s.toeAH = omniWriter->registerAttribute(s.CH, "toe", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.camberAH = omniWriter->registerAttribute(s.CH, "camber", OmniPvdDataTypeEnum::eFLOAT32, 1); + s.tireForceAppPointAH = omniWriter->registerAttribute(s.CH, "tireForceAppPoint", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.suspForceAppPointAH = omniWriter->registerAttribute(s.CH, "suspForceAppPoint", OmniPvdDataTypeEnum::eFLOAT32, 3); + return s; +} + +void writeSuspComplianceState +(const PxVehicleSuspensionComplianceState& suspCompState, + const OmniPvdObjectHandle oh, const SuspCompState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.camberAH, suspCompState.camber); + writeFloatAttribute(omniWriter, ch, oh, ah.toeAH, suspCompState.toe); + writeVec3Attribute(omniWriter, ch, oh, ah.suspForceAppPointAH, suspCompState.suspForceAppPoint); + writeVec3Attribute(omniWriter, ch, oh, ah.tireForceAppPointAH, suspCompState.tireForceAppPoint); +} + +SuspForce registerSuspForce(OmniPvdWriter* omniWriter) +{ + SuspForce s; + s.CH = omniWriter->registerClass("SuspensionForce"); + s.forceAH = omniWriter->registerAttribute(s.CH, "force", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.torqueAH = omniWriter->registerAttribute(s.CH, "torque", OmniPvdDataTypeEnum::eFLOAT32, 3); + s.normalForceAH = omniWriter->registerAttribute(s.CH, "normalForce", OmniPvdDataTypeEnum::eFLOAT32, 3); + return s; +} + +void writeSuspForce +(const PxVehicleSuspensionForce& suspForce, + const OmniPvdObjectHandle oh, const SuspForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.forceAH, suspForce.force); + writeVec3Attribute(omniWriter, ch, oh, ah.torqueAH, suspForce.torque); + writeFloatAttribute(omniWriter, ch, oh, ah.normalForceAH, suspForce.normalForce); +} + +TireParams registerTireParams(OmniPvdWriter* omniWriter) +{ + TireParams t; + t.CH = omniWriter->registerClass("TireParams"); + t.latStiffXAH = omniWriter->registerAttribute(t.CH, "latStiffX", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.latStiffYAH = omniWriter->registerAttribute(t.CH, "latStiffY", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.longStiffAH = omniWriter->registerAttribute(t.CH, "longStiff", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.camberStiffAH = omniWriter->registerAttribute(t.CH, "camberStiff", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.frictionVsSlipAH = omniWriter->registerAttribute(t.CH, "frictionVsSlip", OmniPvdDataTypeEnum::eFLOAT32, 6); + t.restLoadAH = omniWriter->registerAttribute(t.CH, "restLoad", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.loadFilterAH = omniWriter->registerAttribute(t.CH, "loadFilter", OmniPvdDataTypeEnum::eFLOAT32, 4); + return t; +} + +void writeTireParams +(const PxVehicleTireForceParams& tireParams, + const OmniPvdObjectHandle oh, const TireParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.latStiffXAH, tireParams.latStiffX); + writeFloatAttribute(omniWriter, ch, oh, ah.latStiffYAH, tireParams.latStiffY); + writeFloatAttribute(omniWriter, ch, oh, ah.longStiffAH, tireParams.longStiff); + writeFloatAttribute(omniWriter, ch, oh, ah.camberStiffAH, tireParams.camberStiff); + writeFloatAttribute(omniWriter, ch, oh, ah.restLoadAH, tireParams.restLoad); + const float fricVsSlip[6] = + { + tireParams.frictionVsSlip[0][0], tireParams.frictionVsSlip[0][1], tireParams.frictionVsSlip[1][0], + tireParams.frictionVsSlip[1][1], tireParams.frictionVsSlip[2][0], tireParams.frictionVsSlip[2][1], + }; + writeFloatArrayAttribute(omniWriter, ch, oh, ah.frictionVsSlipAH, fricVsSlip, 6); + const float loadFilter[4] = + { + tireParams.loadFilter[0][0], tireParams.loadFilter[0][1], + tireParams.loadFilter[1][0], tireParams.loadFilter[1][1] + }; + writeFloatArrayAttribute(omniWriter, ch, oh, ah.loadFilterAH, loadFilter, 4); +} + +TireDirectionState registerTireDirectionState(OmniPvdWriter* omniWriter) +{ + TireDirectionState t; + t.CH = omniWriter->registerClass("TireDirectionState"); + t.lngDirectionAH = omniWriter->registerAttribute(t.CH, "lngDir", OmniPvdDataTypeEnum::eFLOAT32, 3); + t.latDirectionAH = omniWriter->registerAttribute(t.CH, "latDir", OmniPvdDataTypeEnum::eFLOAT32, 3); + return t; +} + +void writeTireDirectionState +(const PxVehicleTireDirectionState& tireDirState, + const OmniPvdObjectHandle oh, const TireDirectionState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.lngDirectionAH, tireDirState.directions[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.latDirectionAH, tireDirState.directions[PxVehicleTireDirectionModes::eLATERAL]); +} + +TireSpeedState registerTireSpeedState(OmniPvdWriter* omniWriter) +{ + TireSpeedState t; + t.CH = omniWriter->registerClass("TireSpeedState"); + t.lngSpeedAH = omniWriter->registerAttribute(t.CH, "lngSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.latSpeedAH = omniWriter->registerAttribute(t.CH, "latSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + return t; +} + +void writeTireSpeedState +(const PxVehicleTireSpeedState& tireSpeedState, + const OmniPvdObjectHandle oh, const TireSpeedState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.lngSpeedAH, tireSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.latSpeedAH, tireSpeedState.speedStates[PxVehicleTireDirectionModes::eLATERAL]); +} + +TireSlipState registerTireSlipState(OmniPvdWriter* omniWriter) +{ + TireSlipState t; + t.CH = omniWriter->registerClass("TireSlipState"); + t.lngSlipAH = omniWriter->registerAttribute(t.CH, "lngSlip", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.latSlipAH = omniWriter->registerAttribute(t.CH, "latSlip", OmniPvdDataTypeEnum::eFLOAT32, 1); + return t; +} + +void writeTireSlipState +(const PxVehicleTireSlipState& tireSlipState, + const OmniPvdObjectHandle oh, const TireSlipState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.lngSlipAH, tireSlipState.slips[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.latSlipAH, tireSlipState.slips[PxVehicleTireDirectionModes::eLATERAL]); +} + +TireStickyState registerTireStickyState(OmniPvdWriter* omniWriter) +{ + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("StickyTireBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + TireStickyState t; + t.CH = omniWriter->registerClass("TireStickyState"); + t.lngStickyStateTimer = omniWriter->registerAttribute(t.CH, "lngStickyTimer", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.lngStickyStateStatus = omniWriter->registerFlagsAttribute(t.CH, boolAsEnum.CH, "lngStickyStatus"); + t.latStickyStateTimer = omniWriter->registerAttribute(t.CH, "latStickyTimer", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.latStickyStateStatus = omniWriter->registerFlagsAttribute(t.CH, boolAsEnum.CH, "latStickyStatus"); + return t; +} + +void writeTireStickyState +(const PxVehicleTireStickyState& tireStickyState, + const OmniPvdObjectHandle oh, const TireStickyState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.latStickyStateStatus, tireStickyState.activeStatus[PxVehicleTireDirectionModes::eLATERAL] ? 1 : 0); + writeFlagAttribute(omniWriter, ch, oh, ah.lngStickyStateStatus, tireStickyState.activeStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] ? 1 : 0); + writeFloatAttribute(omniWriter, ch, oh, ah.latStickyStateTimer, tireStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLATERAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.lngStickyStateTimer, tireStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLONGITUDINAL]); +} + +TireGripState registerTireGripState(OmniPvdWriter* omniWriter) +{ + TireGripState t; + t.CH = omniWriter->registerClass("TireGripState"); + t.loadAH = omniWriter->registerAttribute(t.CH, "load", OmniPvdDataTypeEnum::eFLOAT32, 1); + t.frictionAH = omniWriter->registerAttribute(t.CH, "friction", OmniPvdDataTypeEnum::eFLOAT32, 1); + return t; +} + +void writeTireGripState +(const PxVehicleTireGripState& tireGripState, + const OmniPvdObjectHandle oh, const TireGripState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.frictionAH, tireGripState.friction); + writeFloatAttribute(omniWriter, ch, oh, ah.loadAH, tireGripState.load); +} + +TireCamberState registerTireCamberState(OmniPvdWriter* omniWriter) +{ + TireCamberState t; + t.CH = omniWriter->registerClass("TireCamberState"); + t.camberAngleAH = omniWriter->registerAttribute(t.CH, "camberAngle", OmniPvdDataTypeEnum::eFLOAT32, 1); + return t; +} + +void writeTireCamberState +(const PxVehicleTireCamberAngleState& tireCamberState, + const OmniPvdObjectHandle oh, const TireCamberState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.camberAngleAH, tireCamberState.camberAngle); +} + +TireForce registerTireForce(OmniPvdWriter* omniWriter) +{ + TireForce t; + t.CH = omniWriter->registerClass("TireForce"); + + t.lngForceAH = omniWriter->registerAttribute(t.CH, "lngForce", OmniPvdDataTypeEnum::eFLOAT32, 3); + t.lngTorqueAH = omniWriter->registerAttribute(t.CH, "lngTorque", OmniPvdDataTypeEnum::eFLOAT32, 3); + + t.latForceAH = omniWriter->registerAttribute(t.CH, "latForce", OmniPvdDataTypeEnum::eFLOAT32, 3); + t.latTorqueAH = omniWriter->registerAttribute(t.CH, "latTorque", OmniPvdDataTypeEnum::eFLOAT32, 3); + + t.aligningMomentAH = omniWriter->registerAttribute(t.CH, "aligningMoment", OmniPvdDataTypeEnum::eFLOAT32, 3); + t.wheelTorqueAH = omniWriter->registerAttribute(t.CH, "wheelTorque", OmniPvdDataTypeEnum::eFLOAT32, 3); + + return t; +} + +void writeTireForce +(const PxVehicleTireForce& tireForce, + const OmniPvdObjectHandle oh, const TireForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.lngForceAH, tireForce.forces[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.lngTorqueAH, tireForce.torques[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.latForceAH, tireForce.forces[PxVehicleTireDirectionModes::eLATERAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.latTorqueAH, tireForce.torques[PxVehicleTireDirectionModes::eLATERAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.aligningMomentAH, tireForce.aligningMoment); + writeFloatAttribute(omniWriter, ch, oh, ah.wheelTorqueAH, tireForce.wheelTorque); +} + +WheelAttachment registerWheelAttachment(OmniPvdWriter* omniWriter) +{ + WheelAttachment w; + w.CH = omniWriter->registerClass("WheelAttachment"); + w.wheelParamsAH = omniWriter->registerAttribute(w.CH, "wheelParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.wheelActuationStateAH = omniWriter->registerAttribute(w.CH, "wheelActuationState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.wheelRigidBody1dStateAH = omniWriter->registerAttribute(w.CH, "wheelRigidBody1dState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.wheelLocalPoseStateAH = omniWriter->registerAttribute(w.CH, "wheelLocalPosetate", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.roadGeomStateAH = omniWriter->registerAttribute(w.CH, "roadGeomState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspParamsAH = omniWriter->registerAttribute(w.CH, "suspParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspCompParamsAH = omniWriter->registerAttribute(w.CH, "suspComplianceParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspForceParamsAH = omniWriter->registerAttribute(w.CH, "suspForceParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspStateAH = omniWriter->registerAttribute(w.CH, "suspState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspCompStateAH = omniWriter->registerAttribute(w.CH, "suspComplianceState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.suspForceAH = omniWriter->registerAttribute(w.CH, "suspForce", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireParamsAH = omniWriter->registerAttribute(w.CH, "tireParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireDirectionStateAH = omniWriter->registerAttribute(w.CH, "tireDirectionState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireSpeedStateAH = omniWriter->registerAttribute(w.CH, "tireSpeedState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireSlipStateAH = omniWriter->registerAttribute(w.CH, "tireSlipState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireStickyStateAH = omniWriter->registerAttribute(w.CH, "tireStickyState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireGripStateAH = omniWriter->registerAttribute(w.CH, "tireGripState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireCamberStateAH = omniWriter->registerAttribute(w.CH, "tireCamberState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.tireForceAH = omniWriter->registerAttribute(w.CH, "tireForce", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return w; +} + +////////////////////////// +//ANTIROLL +////////////////////////// + +AntiRollParams registerAntiRollParams(OmniPvdWriter* omniWriter) +{ + AntiRollParams a; + a.CH = omniWriter->registerClass("AntiRollParams"); + a.wheel0AH = omniWriter->registerAttribute(a.CH, "wheel0", OmniPvdDataTypeEnum::eUINT32, 1); + a.wheel1AH = omniWriter->registerAttribute(a.CH, "wheel1", OmniPvdDataTypeEnum::eUINT32, 1); + a.stiffnessAH = omniWriter->registerAttribute(a.CH, "stiffness", OmniPvdDataTypeEnum::eFLOAT32, 1); + return a; +} + +void writeAntiRollParams +(const PxVehicleAntiRollForceParams& antiRollParams, + const OmniPvdObjectHandle oh, const AntiRollParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeUInt32Attribute(omniWriter, ch, oh, ah.wheel0AH, antiRollParams.wheel0); + writeUInt32Attribute(omniWriter, ch, oh, ah.wheel1AH, antiRollParams.wheel1); + writeFloatAttribute(omniWriter, ch, oh, ah.stiffnessAH, antiRollParams.stiffness); +} + +AntiRollForce registerAntiRollForce(OmniPvdWriter* omniWriter) +{ + AntiRollForce a; + a.CH = omniWriter->registerClass("AntiRollForce"); + a.torqueAH = omniWriter->registerAttribute(a.CH, "torque", OmniPvdDataTypeEnum::eFLOAT32, 3); + return a; +} + +void writeAntiRollForce +(const PxVehicleAntiRollTorque& antiRollForce, + const OmniPvdObjectHandle oh, const AntiRollForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.torqueAH, antiRollForce.antiRollTorque); +} + + +////////////////////////////////// +//SUSPENSION STATE CALCULATION +////////////////////////////////// + +SuspStateCalcParams registerSuspStateCalcParams(OmniPvdWriter* omniWriter) +{ + struct SuspJounceCalcType + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle raycastAH; + OmniPvdAttributeHandle sweepAH; + OmniPvdAttributeHandle noneAH; + }; + SuspJounceCalcType jounceCalcType; + jounceCalcType.CH = omniWriter->registerClass("SuspJounceCalculationType"); + jounceCalcType.raycastAH = omniWriter->registerEnumValue(jounceCalcType.CH, "raycast", PxVehicleSuspensionJounceCalculationType::eRAYCAST); + jounceCalcType.sweepAH = omniWriter->registerEnumValue(jounceCalcType.CH, "sweep", PxVehicleSuspensionJounceCalculationType::eSWEEP); + jounceCalcType.noneAH = omniWriter->registerEnumValue(jounceCalcType.CH, "none", PxVehicleSuspensionJounceCalculationType::eMAX_NB); + + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("SuspStateCalcParamsBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + SuspStateCalcParams s; + s.CH = omniWriter->registerClass("SuspStateCalculationParams"); + s.calcTypeAH = omniWriter->registerFlagsAttribute(s.CH, jounceCalcType.CH, "suspJounceCalculationType"); + s.limitExpansionValAH = omniWriter->registerFlagsAttribute(s.CH, boolAsEnum.CH, "limitSuspensionExpansionVelocity"); + return s; +} + +void writeSuspStateCalcParams +(const PxVehicleSuspensionStateCalculationParams& suspStateCalcParams, + const OmniPvdObjectHandle oh, const SuspStateCalcParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.limitExpansionValAH, suspStateCalcParams.limitSuspensionExpansionVelocity ? 1 : 0); + writeFlagAttribute(omniWriter, ch, oh, ah.calcTypeAH, suspStateCalcParams.suspensionJounceCalculationType); +} + +////////////////////////////////////// +//DIRECT DRIVETRAIN +////////////////////////////////////// + +DirectDriveCommandState registerDirectDriveCommandState(OmniPvdWriter* omniWriter) +{ + DirectDriveCommandState c; + c.CH = omniWriter->registerClass("DirectDriveCommandState"); + c.brakesAH= omniWriter->registerAttribute(c.CH, "brakes", OmniPvdDataTypeEnum::eFLOAT32, 2); + c.throttleAH= omniWriter->registerAttribute(c.CH, "throttle", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.steerAH= omniWriter->registerAttribute(c.CH, "steer", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +void writeDirectDriveCommandState +(const PxVehicleCommandState& commands, + const OmniPvdObjectHandle oh, const DirectDriveCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + float brakes[2]; + for(PxU32 i = 0; i < commands.nbBrakes; i++) + { + brakes[i] = commands.brakes[i]; + } + for(PxU32 i = commands.nbBrakes; i < 2; i++) + { + brakes[i] = PX_MAX_F32; + } + writeFloatArrayAttribute(omniWriter, ch, oh, ah.brakesAH, brakes, 2); + writeFloatAttribute(omniWriter, ch, oh, ah.throttleAH, commands.throttle); + writeFloatAttribute(omniWriter, ch, oh, ah.steerAH, commands.steer); +} + +DirectDriveTransmissionCommandState registerDirectDriveTransmissionCommandState(OmniPvdWriter* omniWriter) +{ + struct DirectDriveGear + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle reverse; + OmniPvdAttributeHandle neutral; + OmniPvdAttributeHandle forward; + }; + + DirectDriveGear g; + g.CH = omniWriter->registerClass("DirectDriveGear"); + g.reverse = omniWriter->registerEnumValue(g.CH, "reverse", PxVehicleDirectDriveTransmissionCommandState::eREVERSE); + g.neutral = omniWriter->registerEnumValue(g.CH, "neutral", PxVehicleDirectDriveTransmissionCommandState::eNEUTRAL); + g.forward = omniWriter->registerEnumValue(g.CH, "forward", PxVehicleDirectDriveTransmissionCommandState::eFORWARD); + + DirectDriveTransmissionCommandState c; + c.CH = omniWriter->registerClass("DirectDriveTransmissionCommandState"); + c.gearAH = omniWriter->registerFlagsAttribute(c.CH, g.CH, "gear"); + return c; +} + +void writeDirectDriveTransmissionCommandState +(const PxVehicleDirectDriveTransmissionCommandState& transmission, + const OmniPvdObjectHandle oh, const DirectDriveTransmissionCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.gearAH, transmission.gear); +} + +WheelResponseParams registerDirectDriveThrottleResponseParams(OmniPvdWriter* omniWriter) +{ + return registerWheelResponseParams("DirectDriveThrottleResponseParams", omniWriter); +} + +void writeDirectDriveThrottleResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleDirectDriveThrottleCommandResponseParams& directDriveThrottleResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeWheelResponseParams(axleDesc, directDriveThrottleResponseParams, oh, ah, omniWriter, ch); +} + +DirectDriveThrottleResponseState registerDirectDriveThrottleResponseState(OmniPvdWriter* omniWriter) +{ + DirectDriveThrottleResponseState d; + d.CH = omniWriter->registerClass("DirectDriveThrottleResponseState"); + d.states0To3AH = omniWriter->registerAttribute(d.CH, "responseState0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.states4To7AH = omniWriter->registerAttribute(d.CH, "responseState4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.states8To11AH = omniWriter->registerAttribute(d.CH, "responseState8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.states12To15AH = omniWriter->registerAttribute(d.CH, "responseState12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.states16To19AH = omniWriter->registerAttribute(d.CH, "responseState16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + return d; +} + +void writeDirectDriveThrottleResponseState +(const PxVehicleAxleDescription& axleDesc, const PxVehicleArrayData& throttleResponseState, + const OmniPvdObjectHandle oh, const DirectDriveThrottleResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + //States are always in setToDefault() state as default. + PxF32 states[PxVehicleLimits::eMAX_NB_WHEELS]; + PxMemZero(states, sizeof(states)); + + if(!throttleResponseState.isEmpty()) + { + for(PxU32 i = 0; i < axleDesc.nbWheels; i++) + { + const PxU32 wheelId = axleDesc.wheelIdsInAxleOrder[i]; + states[wheelId] = throttleResponseState[wheelId]; + } + } + + writeFloatArrayAttribute(omniWriter, ch, oh, ah.states0To3AH, states + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.states4To7AH, states + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.states8To11AH, states + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.states12To15AH, states + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.states16To19AH, states + 16, 4); +} + +DirectDrivetrain registerDirectDrivetrain(OmniPvdWriter* omniWriter) +{ + DirectDrivetrain d; + d.CH = omniWriter->registerClass("DirectDrivetrain"); + d.throttleResponseParamsAH = omniWriter->registerAttribute(d.CH, "throttleResponseParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + d.commandStateAH = omniWriter->registerAttribute(d.CH, "directDriveCommandState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + d.throttleResponseStateAH = omniWriter->registerAttribute(d.CH, "throttleResponseState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return d; +} + + +////////////////////////////// +//ENGINE DRIVETRAIN +////////////////////////////// + +EngineDriveCommandState registerEngineDriveCommandState(OmniPvdWriter* omniWriter) +{ + EngineDriveCommandState c; + c.CH = omniWriter->registerClass("EngineDriveCommandState"); + c.brakes= omniWriter->registerAttribute(c.CH, "brakes", OmniPvdDataTypeEnum::eFLOAT32, 2); + c.throttle= omniWriter->registerAttribute(c.CH, "throttle", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.steer= omniWriter->registerAttribute(c.CH, "steer", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + + +void writeEngineDriveCommandState +(const PxVehicleCommandState& commands, + const OmniPvdObjectHandle oh, const EngineDriveCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + float brakes[2]; + for(PxU32 i = 0; i < commands.nbBrakes; i++) + { + brakes[i] = commands.brakes[i]; + } + for(PxU32 i = commands.nbBrakes; i < 2; i++) + { + brakes[i] = PX_MAX_F32; + } + writeFloatArrayAttribute(omniWriter, ch, oh, ah.brakes, brakes, 2); + writeFloatAttribute(omniWriter, ch, oh, ah.throttle, commands.throttle); + writeFloatAttribute(omniWriter, ch, oh, ah.steer, commands.steer); +} + +EngineDriveTransmissionCommandState registerEngineDriveTransmissionCommandState(OmniPvdWriter* omniWriter) +{ + EngineDriveTransmissionCommandState c; + c.CH = omniWriter->registerClass("EngineDriveTranmissionCommandState"); + c.gearAH = omniWriter->registerAttribute(c.CH, "targetGear", OmniPvdDataTypeEnum::eUINT32, 1); + c.clutchAH = omniWriter->registerAttribute(c.CH, "clutch", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +void writeEngineDriveTransmissionCommandState +(const PxVehicleEngineDriveTransmissionCommandState& transmission, + const OmniPvdObjectHandle oh, const EngineDriveTransmissionCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeUInt32Attribute(omniWriter, ch, oh, ah.gearAH, transmission.targetGear); + writeFloatAttribute(omniWriter, ch, oh, ah.clutchAH, transmission.clutch); +} + +ClutchResponseParams registerClutchResponseParams(OmniPvdWriter* omniWriter) +{ + ClutchResponseParams c; + c.CH = omniWriter->registerClass("ClutchResponseParams"); + c.maxResponseAH = omniWriter->registerAttribute(c.CH, "MaxResponse", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +ClutchParams registerClutchParams(OmniPvdWriter* omniWriter) +{ + struct VehicleClutchAccuracyMode + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle estimateAH; + OmniPvdAttributeHandle bestPossibleAH; + }; + VehicleClutchAccuracyMode mode; + mode.CH = omniWriter->registerClass("ClutchAccuracyMode"); + mode.estimateAH = omniWriter->registerEnumValue(mode.CH, "estimate", PxVehicleClutchAccuracyMode::eESTIMATE); + mode.bestPossibleAH = omniWriter->registerEnumValue(mode.CH, "bestPossible", PxVehicleClutchAccuracyMode::eBEST_POSSIBLE); + + ClutchParams v; + v.CH = omniWriter->registerClass("ClutchParams"); + v.accuracyAH = omniWriter->registerFlagsAttribute(v.CH, mode.CH, "accuracyMode"); + v.iterationsAH = omniWriter->registerAttribute(v.CH, "iterations", OmniPvdDataTypeEnum::eUINT32, 1); + return v; +} + +void writeClutchParams +(const PxVehicleClutchParams& clutchParams, + const OmniPvdObjectHandle oh, const ClutchParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.accuracyAH, clutchParams.accuracyMode); + writeUInt32Attribute(omniWriter, ch, oh, ah.iterationsAH, clutchParams.estimateIterations); +} + +EngineParams registerEngineParams(OmniPvdWriter* omniWriter) +{ + EngineParams e; + e.CH = omniWriter->registerClass("EngineParams"); + e.torqueCurveAH = omniWriter->registerAttribute(e.CH, "torqueCurve", OmniPvdDataTypeEnum::eFLOAT32, PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES*2); + e.peakTorqueAH = omniWriter->registerAttribute(e.CH, "peakTorque", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.moiAH = omniWriter->registerAttribute(e.CH, "moi", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.idleOmegaAH = omniWriter->registerAttribute(e.CH, "idleOmega", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.maxOmegaAH = omniWriter->registerAttribute(e.CH, "maxOmega", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.dampingRateFullThrottleAH = omniWriter->registerAttribute(e.CH, "dampingRateFullThrottleAH", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.dampingRateZeroThrottleClutchDisengagedAH = omniWriter->registerAttribute(e.CH, "dampingRateZeroThrottleClutchDisengaged", OmniPvdDataTypeEnum::eFLOAT32, 1); + e.dampingRateZeroThrottleClutchEngagedAH = omniWriter->registerAttribute(e.CH, "dampingRateZeroThrottleClutchEngaged", OmniPvdDataTypeEnum::eFLOAT32, 1); + return e; +} + +void writeEngineParams +(const PxVehicleEngineParams& engineParams, + const OmniPvdObjectHandle oh, const EngineParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + float torqueCurve[PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES*2]; + for(PxU32 i = 0; i < engineParams.torqueCurve.nbDataPairs; i++) + { + torqueCurve[2*i + 0] = engineParams.torqueCurve.xVals[i]; + torqueCurve[2*i + 1] = engineParams.torqueCurve.yVals[i]; + } + for(PxU32 i = engineParams.torqueCurve.nbDataPairs; i < PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES; i++) + { + torqueCurve[2*i + 0] = PX_MAX_F32; + torqueCurve[2*i + 1] = PX_MAX_F32; + } + + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueCurveAH, torqueCurve, PxVehicleEngineParams::eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES*2); + writeFloatAttribute(omniWriter, ch, oh, ah.peakTorqueAH, engineParams.peakTorque); + writeFloatAttribute(omniWriter, ch, oh, ah.moiAH, engineParams.moi); + writeFloatAttribute(omniWriter, ch, oh, ah.idleOmegaAH, engineParams.idleOmega); + writeFloatAttribute(omniWriter, ch, oh, ah.maxOmegaAH, engineParams.maxOmega); + writeFloatAttribute(omniWriter, ch, oh, ah.dampingRateFullThrottleAH, engineParams.dampingRateFullThrottle); + writeFloatAttribute(omniWriter, ch, oh, ah.dampingRateZeroThrottleClutchDisengagedAH, engineParams.dampingRateZeroThrottleClutchDisengaged); + writeFloatAttribute(omniWriter, ch, oh, ah.dampingRateZeroThrottleClutchEngagedAH, engineParams.dampingRateZeroThrottleClutchEngaged); +} + +GearboxParams registerGearboxParams(OmniPvdWriter* omniWriter) +{ + GearboxParams g; + g.CH = omniWriter->registerClass("GearboxParams"); + g.ratiosAH = omniWriter->registerAttribute(g.CH, "ratios", OmniPvdDataTypeEnum::eFLOAT32, PxVehicleGearboxParams::eMAX_NB_GEARS); + g.nbRatiosAH = omniWriter->registerAttribute(g.CH, "nbRatios", OmniPvdDataTypeEnum::eUINT32, 1); + g.neutralGearAH = omniWriter->registerAttribute(g.CH, "neutralGear", OmniPvdDataTypeEnum::eUINT32, 1); + g.finalRatioAH = omniWriter->registerAttribute(g.CH, "finalRatio", OmniPvdDataTypeEnum::eFLOAT32, 1); + g.switchTimeAH = omniWriter->registerAttribute(g.CH, "switchTime", OmniPvdDataTypeEnum::eFLOAT32, 1); + return g; +} + +void writeGearboxParams +(const PxVehicleGearboxParams& gearboxParams, + const OmniPvdObjectHandle oh, const GearboxParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + float ratios[PxVehicleGearboxParams::eMAX_NB_GEARS]; + PxMemCopy(ratios, gearboxParams.ratios, sizeof(float)*gearboxParams.nbRatios); + for(PxU32 i = gearboxParams.nbRatios; i < PxVehicleGearboxParams::eMAX_NB_GEARS; i++) + { + ratios[i] = PX_MAX_F32; + } + writeFloatArrayAttribute(omniWriter, ch, oh, ah.ratiosAH, ratios, PxVehicleGearboxParams::eMAX_NB_GEARS); + writeUInt32Attribute(omniWriter, ch, oh, ah.nbRatiosAH, gearboxParams.nbRatios); + writeUInt32Attribute(omniWriter, ch, oh, ah.neutralGearAH, gearboxParams.neutralGear); + writeFloatAttribute(omniWriter, ch, oh, ah.finalRatioAH, gearboxParams.finalRatio); + writeFloatAttribute(omniWriter, ch, oh, ah.switchTimeAH, gearboxParams.switchTime); +} + +AutoboxParams registerAutoboxParams(OmniPvdWriter* omniWriter) +{ + AutoboxParams a; + a.CH = omniWriter->registerClass("AutoboxParams"); + a.upRatiosAH = omniWriter->registerAttribute(a.CH, "upRatios", OmniPvdDataTypeEnum::eFLOAT32, PxVehicleGearboxParams::eMAX_NB_GEARS); + a.downRatiosAH = omniWriter->registerAttribute(a.CH, "downRatios", OmniPvdDataTypeEnum::eFLOAT32, PxVehicleGearboxParams::eMAX_NB_GEARS); + a.latencyAH = omniWriter->registerAttribute(a.CH, "latency", OmniPvdDataTypeEnum::eFLOAT32, 1); + return a; +} + +void writeAutoboxParams +(const PxVehicleAutoboxParams& autoboxParams, + const OmniPvdObjectHandle oh, const AutoboxParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatArrayAttribute(omniWriter, ch, oh, ah.upRatiosAH, autoboxParams.upRatios, PxVehicleGearboxParams::eMAX_NB_GEARS); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.downRatiosAH, autoboxParams.downRatios, PxVehicleGearboxParams::eMAX_NB_GEARS); + writeFloatAttribute(omniWriter, ch, oh, ah.latencyAH, autoboxParams.latency); +} + +MultiWheelDiffParams registerMultiWheelDiffParams(const char* name, OmniPvdWriter* omniWriter) +{ + MultiWheelDiffParams m; + m.CH = omniWriter->registerClass(name); + m.torqueRatios0To3AH = omniWriter->registerAttribute(m.CH, "torqueRatios0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.torqueRatios4To7AH = omniWriter->registerAttribute(m.CH, "torqueRatios4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.torqueRatios8To11AH = omniWriter->registerAttribute(m.CH, "torqueRatios8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.torqueRatios12To15AH = omniWriter->registerAttribute(m.CH, "torqueRatios12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.torqueRatios16To19AH = omniWriter->registerAttribute(m.CH, "torqueRatios16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.aveWheelSpeedRatios0To3AH = omniWriter->registerAttribute(m.CH, "aveWheelSpeedRatios0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.aveWheelSpeedRatios4To7AH = omniWriter->registerAttribute(m.CH, "aveWheelSpeedRatios4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.aveWheelSpeedRatios8To11AH = omniWriter->registerAttribute(m.CH, "aveWheelSpeedRatios8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.aveWheelSpeedRatios12To15AH = omniWriter->registerAttribute(m.CH, "aveWheelSpeedRatios12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + m.aveWheelSpeedRatios16To19AH = omniWriter->registerAttribute(m.CH, "aveWheelSpeedRatios16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + return m; +} + +MultiWheelDiffParams registerMultiWheelDiffParams(OmniPvdWriter* omniWriter) +{ + return registerMultiWheelDiffParams("MultiWheelDiffParams", omniWriter); +} + +FourWheelDiffParams registerFourWheelDiffParams(OmniPvdWriter* omniWriter) +{ + FourWheelDiffParams m; + static_cast(m) = registerMultiWheelDiffParams("FourWheelDiffParams", omniWriter); + m.frontBiasAH = omniWriter->registerAttribute(m.CH, "frontBias", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.frontTargetAH = omniWriter->registerAttribute(m.CH, "frontTarget", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.rearBiasAH = omniWriter->registerAttribute(m.CH, "rearBias", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.rearTargetAH = omniWriter->registerAttribute(m.CH, "rearTarget", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.centreBiasAH = omniWriter->registerAttribute(m.CH, "centerBias", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.centreTargetAH = omniWriter->registerAttribute(m.CH, "centerTarget", OmniPvdDataTypeEnum::eFLOAT32, 1); + m.frontWheelsAH = omniWriter->registerAttribute(m.CH, "frontWheels", OmniPvdDataTypeEnum::eUINT32, 2); + m.rearWheelsAH = omniWriter->registerAttribute(m.CH, "rearWheels", OmniPvdDataTypeEnum::eUINT32, 2); + return m; +} + +void writeMultiWheelDiffParams +(const PxVehicleMultiWheelDriveDifferentialParams& diffParams, + const OmniPvdObjectHandle oh, const MultiWheelDiffParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios0To3AH, diffParams.aveWheelSpeedRatios + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios4To7AH, diffParams.aveWheelSpeedRatios + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios8To11AH, diffParams.aveWheelSpeedRatios + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios12To15AH, diffParams.aveWheelSpeedRatios + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios16To19AH, diffParams.aveWheelSpeedRatios + 16, 4); + + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios0To3AH, diffParams.torqueRatios + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios4To7AH, diffParams.torqueRatios + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios8To11AH, diffParams.torqueRatios + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios12To15AH, diffParams.torqueRatios + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios16To19AH, diffParams.torqueRatios + 16, 4); +} + +void writeFourWheelDiffParams +(const PxVehicleFourWheelDriveDifferentialParams& diffParams, + const OmniPvdObjectHandle oh, const FourWheelDiffParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeMultiWheelDiffParams(diffParams, oh, ah, omniWriter, ch); + writeFloatAttribute(omniWriter, ch, oh, ah.frontBiasAH, diffParams.frontBias); + writeFloatAttribute(omniWriter, ch, oh, ah.frontTargetAH, diffParams.frontTarget); + writeFloatAttribute(omniWriter, ch, oh, ah.rearBiasAH, diffParams.rearBias); + writeFloatAttribute(omniWriter, ch, oh, ah.rearTargetAH, diffParams.rearTarget); + writeFloatAttribute(omniWriter, ch, oh, ah.centreBiasAH, diffParams.centerBias); + writeFloatAttribute(omniWriter, ch, oh, ah.centreTargetAH, diffParams.centerTarget); + writeUInt32ArrayAttribute(omniWriter, ch, oh, ah.frontWheelsAH, diffParams.frontWheelIds, 2); + writeUInt32ArrayAttribute(omniWriter, ch, oh, ah.rearWheelsAH, diffParams.rearWheelIds, 2); +} + +ClutchResponseState registerClutchResponseState(OmniPvdWriter* omniWriter) +{ + ClutchResponseState c; + c.CH = omniWriter->registerClass("ClutchResponseState"); + c.normalisedResponseAH = omniWriter->registerAttribute(c.CH, "normalisedResponse", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.responseAH = omniWriter->registerAttribute(c.CH, "response", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +void writeClutchResponseState +(const PxVehicleClutchCommandResponseState& clutchResponseState, + const OmniPvdObjectHandle oh, const ClutchResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.normalisedResponseAH, clutchResponseState.normalisedCommandResponse); + writeFloatAttribute(omniWriter, ch, oh, ah.responseAH, clutchResponseState.commandResponse); +} + +ThrottleResponseState registerThrottleResponseState(OmniPvdWriter* omniWriter) +{ + ThrottleResponseState t; + t.CH = omniWriter->registerClass("ThrottleResponseState"); + t.responseAH = omniWriter->registerAttribute(t.CH, "response", OmniPvdDataTypeEnum::eFLOAT32, 1); + return t; +} + +void writeThrottleResponseState +(const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState, + const OmniPvdObjectHandle oh, const ThrottleResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.responseAH, throttleResponseState.commandResponse); +} + +EngineState registerEngineState(OmniPvdWriter* omniWriter) +{ + EngineState e; + e.CH = omniWriter->registerClass("EngineState"); + e.rotationSpeedAH = omniWriter->registerAttribute(e.CH, "rotationSpeed", OmniPvdDataTypeEnum::eFLOAT32, 1); + return e; +} + +void writeEngineState +(const PxVehicleEngineState& engineState, + const OmniPvdObjectHandle oh, const EngineState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.rotationSpeedAH, engineState.rotationSpeed); +} + +GearboxState registerGearboxState(OmniPvdWriter* omniWriter) +{ + GearboxState g; + g.CH = omniWriter->registerClass("GearboxState"); + g.currentGearAH = omniWriter->registerAttribute(g.CH, "currentGear", OmniPvdDataTypeEnum::eUINT32, 1); + g.targetGearAH = omniWriter->registerAttribute(g.CH, "targetGear", OmniPvdDataTypeEnum::eUINT32, 1); + g.switchTimeAH = omniWriter->registerAttribute(g.CH, "switchTime", OmniPvdDataTypeEnum::eFLOAT32, 1); + return g; +} + +void writeGearboxState +(const PxVehicleGearboxState& gearboxState, + const OmniPvdObjectHandle oh, const GearboxState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeUInt32Attribute(omniWriter, ch, oh, ah.currentGearAH, gearboxState.currentGear); + writeUInt32Attribute(omniWriter, ch, oh, ah.targetGearAH, gearboxState.targetGear); + writeFloatAttribute(omniWriter, ch, oh, ah.switchTimeAH, gearboxState.gearSwitchTime); +} + +AutoboxState registerAutoboxState(OmniPvdWriter* omniWriter) +{ + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("AutoboxStateBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + AutoboxState a; + a.CH = omniWriter->registerClass("GearboxState"); + a.timeSinceLastShiftAH = omniWriter->registerAttribute(a.CH, "timeSinceLastShift", OmniPvdDataTypeEnum::eFLOAT32, 1); + a.activeAutoboxGearShiftAH = omniWriter->registerFlagsAttribute(a.CH, boolAsEnum.CH, "activeAutoboxShift"); + return a; +} + +void writeAutoboxState +(const PxVehicleAutoboxState& autoboxState, + const OmniPvdObjectHandle oh, const AutoboxState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.timeSinceLastShiftAH, autoboxState.timeSinceLastShift); + writeFlagAttribute(omniWriter, ch, oh, ah.activeAutoboxGearShiftAH, autoboxState.activeAutoboxGearShift ? 1: 0); +} + +DiffState registerDiffState(OmniPvdWriter* omniWriter) +{ + DiffState d; + d.CH = omniWriter->registerClass("DifferentialState"); + d.torqueRatios0To3AH = omniWriter->registerAttribute(d.CH, "torqueRatios0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.torqueRatios4To7AH = omniWriter->registerAttribute(d.CH, "torqueRatios4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.torqueRatios8To11AH = omniWriter->registerAttribute(d.CH, "torqueRatios8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.torqueRatios12To15AH = omniWriter->registerAttribute(d.CH, "torqueRatios12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.torqueRatios16To19AH = omniWriter->registerAttribute(d.CH, "torqueRatios16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.aveWheelSpeedRatios0To3AH = omniWriter->registerAttribute(d.CH, "aveWheelSpeedRatios0To3", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.aveWheelSpeedRatios4To7AH = omniWriter->registerAttribute(d.CH, "aveWheelSpeedRatios4To7", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.aveWheelSpeedRatios8To11AH = omniWriter->registerAttribute(d.CH, "aveWheelSpeedRatios8To11", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.aveWheelSpeedRatios12To15AH = omniWriter->registerAttribute(d.CH, "aveWheelSpeedRatios12To15", OmniPvdDataTypeEnum::eFLOAT32, 4); + d.aveWheelSpeedRatios16To19AH = omniWriter->registerAttribute(d.CH, "aveWheelSpeedRatios16To19", OmniPvdDataTypeEnum::eFLOAT32, 4); + return d; +} + +void writeDiffState +(const PxVehicleDifferentialState& diffState, + const OmniPvdObjectHandle oh, const DiffState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios0To3AH, diffState.aveWheelSpeedContributionAllWheels + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios4To7AH, diffState.aveWheelSpeedContributionAllWheels + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios8To11AH, diffState.aveWheelSpeedContributionAllWheels + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios12To15AH, diffState.aveWheelSpeedContributionAllWheels + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.aveWheelSpeedRatios16To19AH, diffState.aveWheelSpeedContributionAllWheels + 16, 4); + + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios0To3AH, diffState.torqueRatiosAllWheels + 0, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios4To7AH, diffState.torqueRatiosAllWheels + 4, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios8To11AH, diffState.torqueRatiosAllWheels + 8, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios12To15AH, diffState.torqueRatiosAllWheels + 12, 4); + writeFloatArrayAttribute(omniWriter, ch, oh, ah.torqueRatios16To19AH, diffState.torqueRatiosAllWheels + 16, 4); +} + +ClutchSlipState registerClutchSlipState(OmniPvdWriter* omniWriter) +{ + ClutchSlipState c; + c.CH = omniWriter->registerClass("ClutchSlipState"); + c.slipAH = omniWriter->registerAttribute(c.CH, "clutchSlip", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +void writeClutchSlipState +(const PxVehicleClutchSlipState& clutchSlipState, + const OmniPvdObjectHandle oh, const ClutchSlipState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.slipAH, clutchSlipState.clutchSlip); +} + +EngineDrivetrain registerEngineDrivetrain(OmniPvdWriter* omniWriter) +{ + EngineDrivetrain e; + e.CH = omniWriter->registerClass("EngineDrivetrain"); + e.commandStateAH = omniWriter->registerAttribute(e.CH, "engineDriveCommandState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.transmissionCommandStateAH = omniWriter->registerAttribute(e.CH, "engineDriveTransmissionCommandState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.clutchResponseParamsAH = omniWriter->registerAttribute(e.CH, "clutchResponseParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.clutchParamsAH = omniWriter->registerAttribute(e.CH, "elutchParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.engineParamsAH = omniWriter->registerAttribute(e.CH, "engineParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.gearboxParamsAH = omniWriter->registerAttribute(e.CH, "gearboxParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.autoboxParamsAH = omniWriter->registerAttribute(e.CH, "autoboxParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.multiWheelDiffParamsAH = omniWriter->registerAttribute(e.CH, "multiWheelDiffParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.fourWheelDiffParamsAH = omniWriter->registerAttribute(e.CH, "fourWheelDiffParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.clutchResponseStateAH= omniWriter->registerAttribute(e.CH, "clutchResponseState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.throttleResponseStateAH= omniWriter->registerAttribute(e.CH, "throttleResponseState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.engineStateAH = omniWriter->registerAttribute(e.CH, "engineState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.gearboxStateAH = omniWriter->registerAttribute(e.CH, "gearboxState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.autoboxStateAH = omniWriter->registerAttribute(e.CH, "autoboxState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.diffStateAH = omniWriter->registerAttribute(e.CH, "diffState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + e.clutchSlipStateAH = omniWriter->registerAttribute(e.CH, "clutchSlipState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return e; +} + + +//////////////////////////// +//PHYSX WHEEL ATTACHMENT +//////////////////////////// + +PhysXSuspensionLimitConstraintParams registerSuspLimitConstraintParams(OmniPvdWriter* omniWriter) +{ + struct DirSpecifier + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle suspensionAH; + OmniPvdAttributeHandle geomNormalAH; + OmniPvdAttributeHandle noneAH; + }; + DirSpecifier s; + s.CH = omniWriter->registerClass("DirectionSpecifier"); + s.suspensionAH = omniWriter->registerEnumValue(s.CH, "suspensionDir", + PxVehiclePhysXSuspensionLimitConstraintParams::DirectionSpecifier::eSUSPENSION); + s.geomNormalAH = omniWriter->registerEnumValue(s.CH, "geomNormalDir", + PxVehiclePhysXSuspensionLimitConstraintParams::DirectionSpecifier::eROAD_GEOMETRY_NORMAL); + s.noneAH = omniWriter->registerEnumValue(s.CH, "geomNormalDir", + PxVehiclePhysXSuspensionLimitConstraintParams::DirectionSpecifier::eNONE); + + PhysXSuspensionLimitConstraintParams c; + c.CH = omniWriter->registerClass("PhysXSuspLimitConstraintParams"); + c.restitutionAH = omniWriter->registerAttribute(c.CH, "restitution", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.directionForSuspensionLimitConstraintAH = omniWriter->registerFlagsAttribute(c.CH, s.CH, "directionMode"); + return c; +} + +void writePhysXSuspLimitConstraintParams +(const PxVehiclePhysXSuspensionLimitConstraintParams& params, + const OmniPvdObjectHandle oh, const PhysXSuspensionLimitConstraintParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.directionForSuspensionLimitConstraintAH, params.directionForSuspensionLimitConstraint); + writeFloatAttribute(omniWriter, ch, oh, ah.restitutionAH, params.restitution); +} + + +PhysXWheelShape registerPhysXWheelShape(OmniPvdWriter* omniWriter) +{ + PhysXWheelShape w; + w.CH = omniWriter->registerClass("PhysXWheelShape"); + w.shapePtrAH = omniWriter->registerAttribute(w.CH, "pxShapePtr", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return w; +} + +void writePhysXWheelShape +(const PxShape* wheelShape, + const OmniPvdObjectHandle oh, const PhysXWheelShape& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writePtrAttribute(omniWriter, ch, oh, ah.shapePtrAH, wheelShape); +} + +PhysXRoadGeomState registerPhysXRoadGeomState(OmniPvdWriter* omniWriter) +{ + PhysXRoadGeomState g; + g.CH = omniWriter->registerClass("PhysXRoadGeomState"); + g.hitPositionAH = omniWriter->registerAttribute(g.CH, "hitPosition", OmniPvdDataTypeEnum::eFLOAT32, 3); + g.hitActorPtrAH = omniWriter->registerAttribute(g.CH, "PxActor", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + g.hitShapePtrAH = omniWriter->registerAttribute(g.CH, "PxShape", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + g.hitMaterialPtrAH = omniWriter->registerAttribute(g.CH, "PxMaterial", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return g; +} + +void writePhysXRoadGeomState +(const PxVehiclePhysXRoadGeometryQueryState& roadGeomState, +const OmniPvdObjectHandle oh, const PhysXRoadGeomState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeVec3Attribute(omniWriter, ch, oh, ah.hitPositionAH, roadGeomState.hitPosition); + writePtrAttribute(omniWriter, ch, oh, ah.hitActorPtrAH, roadGeomState.actor); + writePtrAttribute(omniWriter, ch, oh, ah.hitMaterialPtrAH, roadGeomState.material); + writePtrAttribute(omniWriter, ch, oh, ah.hitShapePtrAH, roadGeomState.shape); +} + +PhysXConstraintState registerPhysXConstraintState(OmniPvdWriter* omniWriter) +{ + struct BoolAsEnum + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle falseAH; + OmniPvdAttributeHandle trueAH; + }; + BoolAsEnum boolAsEnum; + boolAsEnum.CH = omniWriter->registerClass("PhysXConstraintStateBool"); + boolAsEnum.falseAH = omniWriter->registerEnumValue(boolAsEnum.CH, "False", 0); + boolAsEnum.trueAH = omniWriter->registerEnumValue(boolAsEnum.CH, "True", 1); + + PhysXConstraintState c; + c.CH = omniWriter->registerClass("PhysXConstraintState"); + c.tireLongActiveStatusAH = omniWriter->registerFlagsAttribute(c.CH, boolAsEnum.CH, "tireLongitudinalActiveStatus"); + c.tireLongLinearAH = omniWriter->registerAttribute(c.CH, "tireLongitudinalLinear", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.tireLongAngularAH = omniWriter->registerAttribute(c.CH, "tireLongitudinalAngular", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.tireLongDampingAH = omniWriter->registerAttribute(c.CH, "tireLongitudinalDamping", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.tireLatActiveStatusAH = omniWriter->registerFlagsAttribute(c.CH, boolAsEnum.CH, "tireLateralActiveStatus"); + c.tireLatLinearAH = omniWriter->registerAttribute(c.CH, "tireLateralLinear", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.tireLatAngularAH = omniWriter->registerAttribute(c.CH, "tireLateralAngular", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.tireLatDampingAH = omniWriter->registerAttribute(c.CH, "tireLateralDamping", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.suspActiveStatusAH = omniWriter->registerFlagsAttribute(c.CH, boolAsEnum.CH, "suspActiveStatus"); + c.suspLinearAH = omniWriter->registerAttribute(c.CH, "suspLinear", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.suspAngularAH = omniWriter->registerAttribute(c.CH, "suspAngular", OmniPvdDataTypeEnum::eFLOAT32, 3); + c.suspRestitutionAH = omniWriter->registerAttribute(c.CH, "suspRestitution", OmniPvdDataTypeEnum::eFLOAT32, 1); + c.suspGeometricErrorAH = omniWriter->registerAttribute(c.CH, "suspGeometricError", OmniPvdDataTypeEnum::eFLOAT32, 1); + return c; +} + +void writePhysXConstraintState +(const PxVehiclePhysXConstraintState& roadGeomState, + const OmniPvdObjectHandle oh, const PhysXConstraintState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.suspActiveStatusAH, roadGeomState.suspActiveStatus ? 1 : 0); + writeVec3Attribute(omniWriter, ch, oh, ah.suspLinearAH, roadGeomState.suspLinear); + writeVec3Attribute(omniWriter, ch, oh, ah.suspAngularAH, roadGeomState.suspAngular); + writeFloatAttribute(omniWriter, ch, oh, ah.suspGeometricErrorAH, roadGeomState.suspGeometricError); + writeFloatAttribute(omniWriter, ch, oh, ah.suspRestitutionAH, roadGeomState.restitution); + + writeFlagAttribute(omniWriter, ch, oh, ah.tireLongActiveStatusAH, roadGeomState.tireActiveStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] ? 1 : 0); + writeVec3Attribute(omniWriter, ch, oh, ah.tireLongLinearAH, roadGeomState.tireLinears[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.tireLongAngularAH, roadGeomState.tireAngulars[PxVehicleTireDirectionModes::eLONGITUDINAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.tireLongDampingAH, roadGeomState.tireDamping[PxVehicleTireDirectionModes::eLONGITUDINAL]); + + writeFlagAttribute(omniWriter, ch, oh, ah.tireLatActiveStatusAH, roadGeomState.tireActiveStatus[PxVehicleTireDirectionModes::eLATERAL] ? 1 : 0); + writeVec3Attribute(omniWriter, ch, oh, ah.tireLatLinearAH, roadGeomState.tireLinears[PxVehicleTireDirectionModes::eLATERAL]); + writeVec3Attribute(omniWriter, ch, oh, ah.tireLatAngularAH, roadGeomState.tireAngulars[PxVehicleTireDirectionModes::eLATERAL]); + writeFloatAttribute(omniWriter, ch, oh, ah.tireLatDampingAH, roadGeomState.tireDamping[PxVehicleTireDirectionModes::eLATERAL]); +} + +PhysXMaterialFriction registerPhysXMaterialFriction(OmniPvdWriter* omniWriter) +{ + PhysXMaterialFriction f; + f.CH = omniWriter->registerClass("PhysXMaterialFriction"); + f.frictionAH = omniWriter->registerAttribute(f.CH, "friction", OmniPvdDataTypeEnum::eFLOAT32, 1); + f.materialPtrAH = omniWriter->registerAttribute(f.CH, "material", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return f; +} + +void writePhysXMaterialFriction +(const PxVehiclePhysXMaterialFriction& materialFriction, + const OmniPvdObjectHandle oh, const PhysXMaterialFriction& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFloatAttribute(omniWriter, ch, oh, ah.frictionAH, materialFriction.friction); + writePtrAttribute(omniWriter, ch, oh, ah.materialPtrAH, materialFriction.material); +} + +PhysXWheelAttachment registerPhysXWheelAttachment(OmniPvdWriter* omniWriter) +{ + PhysXWheelAttachment w; + w.CH = omniWriter->registerClass("PhysXWheelAttachment"); + w.physxConstraintParamsAH = omniWriter->registerAttribute(w.CH, "physxConstraintParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.physxConstraintStateAH = omniWriter->registerAttribute(w.CH, "physxConstraintState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.physxWeelShapeAH = omniWriter->registerAttribute(w.CH, "physxWheelShape", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.physxRoadGeometryStateAH = omniWriter->registerAttribute(w.CH, "physxRoadGeomState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + w.physxMaterialFrictionSetAH = omniWriter->registerSetAttribute(w.CH, "physXMaterialFrictions", OmniPvdDataTypeEnum::eOBJECT_HANDLE); + return w; +} + +////////////////////////// +//PHYSX RIGID ACTOR +////////////////////////// + +PhysXRigidActor registerPhysXRigidActor(OmniPvdWriter* omniWriter) +{ + PhysXRigidActor a; + a.CH = omniWriter->registerClass("PhysXRigidActor"); + a.rigidActorAH = omniWriter->registerAttribute(a.CH, "rigidActor", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + return a; +} + +void writePhysXRigidActor +(const PxRigidActor* actor, + const OmniPvdObjectHandle oh, const PhysXRigidActor& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writePtrAttribute(omniWriter, ch, oh, ah.rigidActorAH, actor); +} + +PhysXRoadGeometryQueryParams registerPhysXRoadGeometryQueryParams(OmniPvdWriter* omniWriter) +{ + struct Type + { + OmniPvdClassHandle CH; + OmniPvdAttributeHandle raycastAH; + OmniPvdAttributeHandle sweepAH; + OmniPvdAttributeHandle noneAH; + }; + Type type; + type.CH = omniWriter->registerClass("PhysXRoadGeometryQueryTpe"); + type.raycastAH = omniWriter->registerEnumValue(type.CH, "raycast", PxVehicleSuspensionJounceCalculationType::eRAYCAST); + type.sweepAH = omniWriter->registerEnumValue(type.CH, "sweep", PxVehicleSuspensionJounceCalculationType::eSWEEP); + type.noneAH = omniWriter->registerEnumValue(type.CH, "none", PxVehicleSuspensionJounceCalculationType::eMAX_NB); + + PhysXRoadGeometryQueryParams a; + a.CH = omniWriter->registerClass("PhysXRoadGeomQueryParams"); + a.queryTypeAH = omniWriter->registerFlagsAttribute(a.CH, type.CH, "physxQueryType"); + return a; +} + +void writePhysXRoadGeometryQueryParams +(const PxVehiclePhysXRoadGeometryQueryParams& actor, + const OmniPvdObjectHandle oh, const PhysXRoadGeometryQueryParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch) +{ + writeFlagAttribute(omniWriter, ch, oh, ah.queryTypeAH, actor.roadGeometryQueryType); +} + + +////////////////////// +//VEHICLE +////////////////////// + +Vehicle registerVehicle(OmniPvdWriter* omniWriter) +{ + Vehicle v; + v.CH = omniWriter->registerClass("Vehicle"); + + v.rigidBodyParamsAH = omniWriter->registerAttribute(v.CH, "rigidBodyParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + v.rigidBodyStateAH = omniWriter->registerAttribute(v.CH, "rigidBodyState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + v.suspStateCalcParamsAH = omniWriter->registerAttribute(v.CH, "suspStateCalcParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + v.wheelAttachmentSetAH = omniWriter->registerSetAttribute(v.CH, "wheelAttachmentSet", OmniPvdDataTypeEnum::eOBJECT_HANDLE); + + v.antiRollSetAH = omniWriter->registerSetAttribute(v.CH, "antiRollSet", OmniPvdDataTypeEnum::eOBJECT_HANDLE); + v.antiRollForceAH = omniWriter->registerAttribute(v.CH, "antiRollForce", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + v.brakeResponseParamsSetAH = omniWriter->registerSetAttribute(v.CH, "brakeResponseParamsSet", OmniPvdDataTypeEnum::eOBJECT_HANDLE); + v.steerResponseParamsAH = omniWriter->registerAttribute(v.CH, "steerResponseParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + v.brakeResponseStatesAH = omniWriter->registerAttribute(v.CH, "brakeResponseState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + v.steerResponseParamsAH = omniWriter->registerAttribute(v.CH, "steerResponseState", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + v.directDrivetrainAH = omniWriter->registerAttribute(v.CH, "directDrivetrain", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + v.engineDriveTrainAH = omniWriter->registerAttribute(v.CH, "engineDrivetrain", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + v.physxWheelAttachmentSetAH = omniWriter->registerSetAttribute(v.CH, "physXheelAttachmentSet", OmniPvdDataTypeEnum::eOBJECT_HANDLE); + + v.physxRoadGeometryQueryParamsAH = omniWriter->registerAttribute(v.CH, "physxRoadGeomQryParams", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + v.physxRigidActorAH = omniWriter->registerAttribute(v.CH, "physxRigidActor", OmniPvdDataTypeEnum::eOBJECT_HANDLE, 1); + + return v; +} + +#endif //PX_SUPPORT_OMNI_PVD + +} // namespace vehicle2 +} // namespace physx + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.h b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.h new file mode 100644 index 0000000..b998edc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/pvd/VhPvdWriter.h @@ -0,0 +1,963 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#pragma once + +#include "vehicle2/braking/PxVehicleBrakingParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainParams.h" +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintParams.h" +#include "vehicle2/physxConstraints/PxVehiclePhysXConstraintStates.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryParams.h" +#include "vehicle2/physxRoadGeometry/PxVehiclePhysXRoadGeometryState.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/steering/PxVehicleSteeringParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" +#include "vehicle2/tire/PxVehicleTireParams.h" +#include "vehicle2/tire/PxVehicleTireStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" + +#if PX_SUPPORT_OMNI_PVD +#include "OmniPvdWriter.h" +#endif + +/** \addtogroup vehicle2 + @{ +*/ + +#if PX_SUPPORT_OMNI_PVD + +#if !PX_DOXYGEN +namespace physx +{ +namespace vehicle2 +{ +#endif + +/////////////////////////////// +//RIGID BODY +/////////////////////////////// + +struct RigidBodyParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle moiAH; + OmniPvdAttributeHandle massAH; +}; + +struct RigidBodyState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle posAH; + OmniPvdAttributeHandle quatAH; + OmniPvdAttributeHandle linearVelocityAH; + OmniPvdAttributeHandle angularVelocityAH; + OmniPvdAttributeHandle previousLinearVelocityAH; + OmniPvdAttributeHandle previousAngularVelocityAH; + OmniPvdAttributeHandle externalForceAH; + OmniPvdAttributeHandle externalTorqueAH; +}; + +RigidBodyParams registerRigidBodyParams(OmniPvdWriter* omniWriter); +RigidBodyState registerRigidBodyState(OmniPvdWriter* omniWriter); + +void writeRigidBodyParams +(const PxVehicleRigidBodyParams& rbodyParams, + const OmniPvdObjectHandle oh, const RigidBodyParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeRigidBodyState +(const PxVehicleRigidBodyState& rbodyParams, + const OmniPvdObjectHandle oh, const RigidBodyState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + + +///////////////////////////////// +//CONTROL +///////////////////////////////// + +struct WheelResponseParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle responseMultipliers0To3AH; + OmniPvdAttributeHandle responseMultipliers4To7AH; + OmniPvdAttributeHandle responseMultipliers8To11AH; + OmniPvdAttributeHandle responseMultipliers12To15AH; + OmniPvdAttributeHandle responseMultipliers16To19AH; + OmniPvdAttributeHandle maxResponseAH; +}; + +struct WheelResponseStates +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle responseStates0To3AH; + OmniPvdAttributeHandle responseStates4To7AH; + OmniPvdAttributeHandle responseStates8To11AH; + OmniPvdAttributeHandle responseStates12To15AH; + OmniPvdAttributeHandle responseStates16To19AH; +}; + + + +WheelResponseParams registerSteerResponseParams(OmniPvdWriter* omniWriter); +WheelResponseParams registerBrakeResponseParams(OmniPvdWriter* omniWriter); +WheelResponseStates registerSteerResponseStates(OmniPvdWriter* omniWriter); +WheelResponseStates registerBrakeResponseStates(OmniPvdWriter* omniWriter); + +void writeSteerResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleSteerCommandResponseParams& steerResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeBrakeResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleBrakeCommandResponseParams& brakeResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSteerResponseStates +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& steerResponseStates, + const OmniPvdObjectHandle oh, const WheelResponseStates& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeBrakeResponseStates +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleArrayData& brakeResponseStates, + const OmniPvdObjectHandle oh, const WheelResponseStates& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +///////////////////////////////////////////// +//WHEEL ATTACHMENTS +///////////////////////////////////////////// + +struct WheelParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle wheelRadiusAH; + OmniPvdAttributeHandle halfWidthAH; + OmniPvdAttributeHandle massAH; + OmniPvdAttributeHandle moiAH; + OmniPvdAttributeHandle dampingRateAH; +}; + +struct WheelActuationState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle isBrakeAppliedAH; + OmniPvdAttributeHandle isDriveAppliedAH; +}; + +struct WheelRigidBody1dState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle rotationSpeedAH; + OmniPvdAttributeHandle correctedRotationSpeedAH; + OmniPvdAttributeHandle rotationAngleAH; +}; + +struct WheelLocalPoseState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle posAH; + OmniPvdAttributeHandle quatAH; +}; + +struct RoadGeometryState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle planeAH; + OmniPvdAttributeHandle frictionAH; + OmniPvdAttributeHandle velocityAH; + OmniPvdAttributeHandle hitStateAH; +}; + +struct SuspParams +{ + OmniPvdClassHandle CH; + + OmniPvdAttributeHandle suspAttachmentPosAH; + OmniPvdAttributeHandle suspAttachmentQuatAH; + OmniPvdAttributeHandle suspDirAH; + OmniPvdAttributeHandle suspTravleDistAH; + OmniPvdAttributeHandle wheelAttachmentPosAH; + OmniPvdAttributeHandle wheelAttachmentQuatAH; +}; + +struct SuspCompParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle toeAngleAH; + OmniPvdAttributeHandle camberAngleAH; + OmniPvdAttributeHandle suspForceAppPointAH; + OmniPvdAttributeHandle tireForceAppPointAH; +}; + +struct SuspForceParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle stiffnessAH; + OmniPvdAttributeHandle dampingAH; + OmniPvdAttributeHandle sprungMassAH; +}; + +struct SuspState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle jounceAH; + OmniPvdAttributeHandle jounceSpeedAH; + OmniPvdAttributeHandle separationAH; +}; + +struct SuspCompState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle toeAH; + OmniPvdAttributeHandle camberAH; + OmniPvdAttributeHandle tireForceAppPointAH; + OmniPvdAttributeHandle suspForceAppPointAH; +}; + +struct SuspForce +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle forceAH; + OmniPvdAttributeHandle torqueAH; + OmniPvdAttributeHandle normalForceAH; +}; + +struct TireParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle latStiffXAH; + OmniPvdAttributeHandle latStiffYAH; + OmniPvdAttributeHandle longStiffAH; + OmniPvdAttributeHandle camberStiffAH; + OmniPvdAttributeHandle frictionVsSlipAH; + OmniPvdAttributeHandle restLoadAH; + OmniPvdAttributeHandle loadFilterAH; +}; + +struct TireDirectionState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle lngDirectionAH; + OmniPvdAttributeHandle latDirectionAH; +}; + +struct TireSpeedState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle lngSpeedAH; + OmniPvdAttributeHandle latSpeedAH; + +}; + +struct TireSlipState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle lngSlipAH; + OmniPvdAttributeHandle latSlipAH; +}; + +struct TireGripState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle loadAH; + OmniPvdAttributeHandle frictionAH; +}; + +struct TireCamberState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle camberAngleAH; +}; + +struct TireStickyState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle lngStickyStateTimer; + OmniPvdAttributeHandle lngStickyStateStatus; + OmniPvdAttributeHandle latStickyStateTimer; + OmniPvdAttributeHandle latStickyStateStatus; +}; + +struct TireForce +{ + OmniPvdClassHandle CH; + + OmniPvdAttributeHandle lngForceAH; + OmniPvdAttributeHandle lngTorqueAH; + + OmniPvdAttributeHandle latForceAH; + OmniPvdAttributeHandle latTorqueAH; + + OmniPvdAttributeHandle aligningMomentAH; + OmniPvdAttributeHandle wheelTorqueAH; +}; + +struct WheelAttachment +{ + OmniPvdClassHandle CH; + + OmniPvdAttributeHandle wheelParamsAH; + OmniPvdAttributeHandle wheelActuationStateAH; + OmniPvdAttributeHandle wheelRigidBody1dStateAH; + OmniPvdAttributeHandle wheelLocalPoseStateAH; + + OmniPvdAttributeHandle roadGeomStateAH; + + OmniPvdAttributeHandle suspParamsAH; + OmniPvdAttributeHandle suspCompParamsAH; + OmniPvdAttributeHandle suspForceParamsAH; + OmniPvdAttributeHandle suspStateAH; + OmniPvdAttributeHandle suspCompStateAH; + OmniPvdAttributeHandle suspForceAH; + + OmniPvdAttributeHandle tireParamsAH; + OmniPvdAttributeHandle tireDirectionStateAH; + OmniPvdAttributeHandle tireSpeedStateAH; + OmniPvdAttributeHandle tireSlipStateAH; + OmniPvdAttributeHandle tireStickyStateAH; + OmniPvdAttributeHandle tireGripStateAH; + OmniPvdAttributeHandle tireCamberStateAH; + OmniPvdAttributeHandle tireForceAH; +}; + +WheelParams registerWheelParams(OmniPvdWriter* omniWriter); +WheelActuationState registerWheelActuationState(OmniPvdWriter* omniWriter); +WheelRigidBody1dState registerWheelRigidBody1dState(OmniPvdWriter* omniWriter); +WheelLocalPoseState registerWheelLocalPoseState(OmniPvdWriter* omniWriter); +RoadGeometryState registerRoadGeomState(OmniPvdWriter* omniWriter); +SuspParams registerSuspParams(OmniPvdWriter* omniWriter); +SuspCompParams registerSuspComplianceParams(OmniPvdWriter* omniWriter); +SuspForceParams registerSuspForceParams(OmniPvdWriter* omniWriter); +SuspState registerSuspState(OmniPvdWriter* omniWriter); +SuspCompState registerSuspComplianceState(OmniPvdWriter* omniWriter); +SuspForce registerSuspForce(OmniPvdWriter* omniWriter); +TireParams registerTireParams(OmniPvdWriter* omniWriter); +TireDirectionState registerTireDirectionState(OmniPvdWriter* omniWriter); +TireSpeedState registerTireSpeedState(OmniPvdWriter* omniWriter); +TireSlipState registerTireSlipState(OmniPvdWriter* omniWriter); +TireStickyState registerTireStickyState(OmniPvdWriter* omniWriter); +TireGripState registerTireGripState(OmniPvdWriter* omniWriter); +TireCamberState registerTireCamberState(OmniPvdWriter* omniWriter); +TireForce registerTireForce(OmniPvdWriter* omniWriter); +WheelAttachment registerWheelAttachment(OmniPvdWriter* omniWriter); + +void writeWheelParams +(const PxVehicleWheelParams& params, + const OmniPvdObjectHandle oh, const WheelParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeWheelActuationState +(const PxVehicleWheelActuationState& actState, + const OmniPvdObjectHandle oh, const WheelActuationState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeWheelRigidBody1dState +(const PxVehicleWheelRigidBody1dState& rigidBodyState, + const OmniPvdObjectHandle oh, const WheelRigidBody1dState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeWheelLocalPoseState +(const PxVehicleWheelLocalPose& pose, + const OmniPvdObjectHandle oh, const WheelLocalPoseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeRoadGeomState +(const PxVehicleRoadGeometryState& roadGeometryState, + const OmniPvdObjectHandle oh, const RoadGeometryState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspParams +(const PxVehicleSuspensionParams& suspParams, + const OmniPvdObjectHandle oh, const SuspParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspComplianceParams +(const PxVehicleSuspensionComplianceParams& compParams, + const OmniPvdObjectHandle oh, const SuspCompParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspForceParams +(const PxVehicleSuspensionForceParams& forceParams, + const OmniPvdObjectHandle oh, const SuspForceParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspState +(const PxVehicleSuspensionState& suspState, + const OmniPvdObjectHandle oh, const SuspState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspComplianceState +(const PxVehicleSuspensionComplianceState& suspCompState, + const OmniPvdObjectHandle oh, const SuspCompState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeSuspForce +(const PxVehicleSuspensionForce& suspForce, + const OmniPvdObjectHandle oh, const SuspForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireParams +(const PxVehicleTireForceParams& tireParams, + const OmniPvdObjectHandle oh, const TireParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireDirectionState +(const PxVehicleTireDirectionState& tireDirState, + const OmniPvdObjectHandle oh, const TireDirectionState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireSpeedState +(const PxVehicleTireSpeedState& tireSpeedState, + const OmniPvdObjectHandle oh, const TireSpeedState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireSlipState +(const PxVehicleTireSlipState& tireSlipState, + const OmniPvdObjectHandle oh, const TireSlipState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireStickyState +(const PxVehicleTireStickyState& tireStickyState, + const OmniPvdObjectHandle oh, const TireStickyState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireGripState +(const PxVehicleTireGripState& tireGripState, + const OmniPvdObjectHandle oh, const TireGripState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireCamberState +(const PxVehicleTireCamberAngleState& tireCamberState, + const OmniPvdObjectHandle oh, const TireCamberState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeTireForce +(const PxVehicleTireForce& tireForce, + const OmniPvdObjectHandle oh, const TireForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +///////////////////////////////////////// +//ANTIROLL +///////////////////////////////////////// + +struct AntiRollParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle wheel0AH; + OmniPvdAttributeHandle wheel1AH; + OmniPvdAttributeHandle stiffnessAH; +}; + +struct AntiRollForce +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle torqueAH; +}; + +AntiRollParams registerAntiRollParams(OmniPvdWriter* omniWriter); +AntiRollForce registerAntiRollForce(OmniPvdWriter* omniWriter); + +void writeAntiRollParams +(const PxVehicleAntiRollForceParams& antiRollParams, + const OmniPvdObjectHandle oh, const AntiRollParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeAntiRollForce +(const PxVehicleAntiRollTorque& antiRollForce, + const OmniPvdObjectHandle oh, const AntiRollForce& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +//////////////////////////////////////// +//SUSPENSION STATE CALCULATION +//////////////////////////////////////// + +struct SuspStateCalcParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle calcTypeAH; + OmniPvdAttributeHandle limitExpansionValAH; +}; + +SuspStateCalcParams registerSuspStateCalcParams(OmniPvdWriter* omniWriter); + +void writeSuspStateCalcParams +(const PxVehicleSuspensionStateCalculationParams& suspStateCalcParams, + const OmniPvdObjectHandle oh, const SuspStateCalcParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +///////////////////////////////////////// +//DIRECT DRIVETRAIN +//////////////////////////////////////// + +struct DirectDriveCommandState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle brakesAH; + OmniPvdAttributeHandle throttleAH; + OmniPvdAttributeHandle steerAH; +}; + +struct DirectDriveTransmissionCommandState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle gearAH; +}; + +struct DirectDriveThrottleResponseState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle states0To3AH; + OmniPvdAttributeHandle states4To7AH; + OmniPvdAttributeHandle states8To11AH; + OmniPvdAttributeHandle states12To15AH; + OmniPvdAttributeHandle states16To19AH; +}; + +struct DirectDrivetrain +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle throttleResponseParamsAH; + OmniPvdAttributeHandle commandStateAH; + OmniPvdAttributeHandle throttleResponseStateAH; +}; + +WheelResponseParams registerDirectDriveThrottleResponseParams(OmniPvdWriter* omniWriter); +DirectDriveCommandState registerDirectDriveCommandState(OmniPvdWriter* omniWriter); +DirectDriveTransmissionCommandState registerDirectDriveTransmissionCommandState(OmniPvdWriter* omniWriter); +DirectDriveThrottleResponseState registerDirectDriveThrottleResponseState(OmniPvdWriter* omniWriter); +DirectDrivetrain registerDirectDrivetrain(OmniPvdWriter* omniWriter); + +void writeDirectDriveThrottleResponseParams +(const PxVehicleAxleDescription& axleDesc, + const PxVehicleDirectDriveThrottleCommandResponseParams& directDriveThrottleResponseParams, + const OmniPvdObjectHandle oh, const WheelResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeDirectDriveCommandState +(const PxVehicleCommandState& commands, + const OmniPvdObjectHandle oh, const DirectDriveCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeDirectDriveTransmissionCommandState +(const PxVehicleDirectDriveTransmissionCommandState& transmission, + const OmniPvdObjectHandle oh, const DirectDriveTransmissionCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeDirectDriveThrottleResponseState +(const PxVehicleAxleDescription& axleDesc, const PxVehicleArrayData& throttleResponseState, + const OmniPvdObjectHandle oh, const DirectDriveThrottleResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + + +///////////////////////////////////////// +//ENGINE DRIVETRAIN +//////////////////////////////////////// + +struct EngineDriveCommandState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle brakes; + OmniPvdAttributeHandle throttle; + OmniPvdAttributeHandle steer; +}; + +struct EngineDriveTransmissionCommandState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle gearAH; + OmniPvdAttributeHandle clutchAH; +}; + +struct ClutchResponseParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle maxResponseAH; +}; + +struct ClutchParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle accuracyAH; + OmniPvdAttributeHandle iterationsAH; +}; + +struct EngineParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle torqueCurveAH; + OmniPvdAttributeHandle moiAH; + OmniPvdAttributeHandle peakTorqueAH; + OmniPvdAttributeHandle idleOmegaAH; + OmniPvdAttributeHandle maxOmegaAH; + OmniPvdAttributeHandle dampingRateFullThrottleAH; + OmniPvdAttributeHandle dampingRateZeroThrottleClutchEngagedAH; + OmniPvdAttributeHandle dampingRateZeroThrottleClutchDisengagedAH; +}; + +struct GearboxParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle ratiosAH; + OmniPvdAttributeHandle nbRatiosAH; + OmniPvdAttributeHandle neutralGearAH; + OmniPvdAttributeHandle finalRatioAH; + OmniPvdAttributeHandle switchTimeAH; +}; + +struct AutoboxParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle upRatiosAH; + OmniPvdAttributeHandle downRatiosAH; + OmniPvdAttributeHandle latencyAH; +}; + +struct MultiWheelDiffParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle torqueRatios0To3AH; + OmniPvdAttributeHandle torqueRatios4To7AH; + OmniPvdAttributeHandle torqueRatios8To11AH; + OmniPvdAttributeHandle torqueRatios12To15AH; + OmniPvdAttributeHandle torqueRatios16To19AH; + OmniPvdAttributeHandle aveWheelSpeedRatios0To3AH; + OmniPvdAttributeHandle aveWheelSpeedRatios4To7AH; + OmniPvdAttributeHandle aveWheelSpeedRatios8To11AH; + OmniPvdAttributeHandle aveWheelSpeedRatios12To15AH; + OmniPvdAttributeHandle aveWheelSpeedRatios16To19AH; +}; + +struct FourWheelDiffParams : public MultiWheelDiffParams +{ + OmniPvdAttributeHandle frontWheelsAH; + OmniPvdAttributeHandle rearWheelsAH; + OmniPvdAttributeHandle frontBiasAH; + OmniPvdAttributeHandle frontTargetAH; + OmniPvdAttributeHandle rearBiasAH; + OmniPvdAttributeHandle rearTargetAH; + OmniPvdAttributeHandle centreBiasAH; + OmniPvdAttributeHandle centreTargetAH; +}; + +struct ClutchResponseState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle normalisedResponseAH; + OmniPvdAttributeHandle responseAH; +}; + +struct ThrottleResponseState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle responseAH; +}; + +struct EngineState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle rotationSpeedAH; +}; + +struct GearboxState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle currentGearAH; + OmniPvdAttributeHandle targetGearAH; + OmniPvdAttributeHandle switchTimeAH; +}; + +struct AutoboxState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle timeSinceLastShiftAH; + OmniPvdAttributeHandle activeAutoboxGearShiftAH; +}; + +struct DiffState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle torqueRatios0To3AH; + OmniPvdAttributeHandle torqueRatios4To7AH; + OmniPvdAttributeHandle torqueRatios8To11AH; + OmniPvdAttributeHandle torqueRatios12To15AH; + OmniPvdAttributeHandle torqueRatios16To19AH; + OmniPvdAttributeHandle aveWheelSpeedRatios0To3AH; + OmniPvdAttributeHandle aveWheelSpeedRatios4To7AH; + OmniPvdAttributeHandle aveWheelSpeedRatios8To11AH; + OmniPvdAttributeHandle aveWheelSpeedRatios12To15AH; + OmniPvdAttributeHandle aveWheelSpeedRatios16To19AH; +}; + +struct ClutchSlipState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle slipAH; +}; + +struct EngineDrivetrain +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle commandStateAH; + OmniPvdAttributeHandle transmissionCommandStateAH; + OmniPvdAttributeHandle clutchResponseParamsAH; + OmniPvdAttributeHandle clutchParamsAH; + OmniPvdAttributeHandle engineParamsAH; + OmniPvdAttributeHandle gearboxParamsAH; + OmniPvdAttributeHandle autoboxParamsAH; + OmniPvdAttributeHandle multiWheelDiffParamsAH; + OmniPvdAttributeHandle fourWheelDiffParamsAH; + OmniPvdAttributeHandle clutchResponseStateAH; + OmniPvdAttributeHandle throttleResponseStateAH; + OmniPvdAttributeHandle engineStateAH; + OmniPvdAttributeHandle gearboxStateAH; + OmniPvdAttributeHandle autoboxStateAH; + OmniPvdAttributeHandle diffStateAH; + OmniPvdAttributeHandle clutchSlipStateAH; +}; + +EngineDriveCommandState registerEngineDriveCommandState(OmniPvdWriter* omniWriter); +EngineDriveTransmissionCommandState registerEngineDriveTransmissionCommandState(OmniPvdWriter* omniWriter); +ClutchResponseParams registerClutchResponseParams(OmniPvdWriter* omniWriter); +ClutchParams registerClutchParams(OmniPvdWriter* omniWriter); +EngineParams registerEngineParams(OmniPvdWriter* omniWriter); +GearboxParams registerGearboxParams(OmniPvdWriter* omniWriter); +AutoboxParams registerAutoboxParams(OmniPvdWriter* omniWriter); +MultiWheelDiffParams registerMultiWheelDiffParams(OmniPvdWriter* omniWriter); +FourWheelDiffParams registerFourWheelDiffParams(OmniPvdWriter* omniWriter); +//TankDiffParams registerTankDiffParams(OmniPvdWriter* omniWriter); +ClutchResponseState registerClutchResponseState(OmniPvdWriter* omniWriter); +ThrottleResponseState registerThrottleResponseState(OmniPvdWriter* omniWriter); +EngineState registerEngineState(OmniPvdWriter* omniWriter); +GearboxState registerGearboxState(OmniPvdWriter* omniWriter); +AutoboxState registerAutoboxState(OmniPvdWriter* omniWriter); +DiffState registerDiffState(OmniPvdWriter* omniWriter); +ClutchSlipState registerClutchSlipState(OmniPvdWriter* omniWriter); +EngineDrivetrain registerEngineDrivetrain(OmniPvdWriter* omniWriter); + +void writeEngineDriveCommandState +(const PxVehicleCommandState& commandState, + const OmniPvdObjectHandle oh, const EngineDriveCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeEngineDriveTransmissionCommandState +(const PxVehicleEngineDriveTransmissionCommandState& transmission, + const OmniPvdObjectHandle oh, const EngineDriveTransmissionCommandState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeClutchResponseParams +(const PxVehicleClutchCommandResponseParams& clutchResponseParams, + const OmniPvdObjectHandle oh, const ClutchResponseParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeClutchParams +(const PxVehicleClutchParams& clutchParams, + const OmniPvdObjectHandle oh, const ClutchParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeEngineParams +(const PxVehicleEngineParams& engineParams, + const OmniPvdObjectHandle oh, const EngineParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeGearboxParams +(const PxVehicleGearboxParams& gearboxParams, + const OmniPvdObjectHandle oh, const GearboxParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeAutoboxParams +(const PxVehicleAutoboxParams& gearboxParams, + const OmniPvdObjectHandle oh, const AutoboxParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeMultiWheelDiffParams +(const PxVehicleMultiWheelDriveDifferentialParams& diffParams, + const OmniPvdObjectHandle oh, const MultiWheelDiffParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeFourWheelDiffParams +(const PxVehicleFourWheelDriveDifferentialParams& diffParams, + const OmniPvdObjectHandle oh, const FourWheelDiffParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeClutchResponseState +(const PxVehicleClutchCommandResponseState& clutchResponseState, + const OmniPvdObjectHandle oh, const ClutchResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeThrottleResponseState +(const PxVehicleEngineDriveThrottleCommandResponseState& throttleResponseState, + const OmniPvdObjectHandle oh, const ThrottleResponseState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeEngineState +(const PxVehicleEngineState& engineState, + const OmniPvdObjectHandle oh, const EngineState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeGearboxState +(const PxVehicleGearboxState& gearboxState, + const OmniPvdObjectHandle oh, const GearboxState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeAutoboxState +(const PxVehicleAutoboxState& gearboxState, + const OmniPvdObjectHandle oh, const AutoboxState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeDiffState +(const PxVehicleDifferentialState& diffState, + const OmniPvdObjectHandle oh, const DiffState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writeClutchSlipState +(const PxVehicleClutchSlipState& clutchSlipState, + const OmniPvdObjectHandle oh, const ClutchSlipState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +/////////////////////////////// +//WHEEL ATTACHMENT PHYSX INTEGRATION +/////////////////////////////// + +struct PhysXSuspensionLimitConstraintParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle restitutionAH; + OmniPvdAttributeHandle directionForSuspensionLimitConstraintAH; +}; + +struct PhysXWheelShape +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle shapePtrAH; +}; + +struct PhysXRoadGeomState +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle hitActorPtrAH; + OmniPvdAttributeHandle hitShapePtrAH; + OmniPvdAttributeHandle hitMaterialPtrAH; + OmniPvdAttributeHandle hitPositionAH; +}; + +struct PhysXConstraintState +{ + OmniPvdClassHandle CH; + + OmniPvdAttributeHandle tireLongActiveStatusAH; + OmniPvdAttributeHandle tireLongLinearAH; + OmniPvdAttributeHandle tireLongAngularAH; + OmniPvdAttributeHandle tireLongDampingAH; + + OmniPvdAttributeHandle tireLatActiveStatusAH; + OmniPvdAttributeHandle tireLatLinearAH; + OmniPvdAttributeHandle tireLatAngularAH; + OmniPvdAttributeHandle tireLatDampingAH; + + OmniPvdAttributeHandle suspActiveStatusAH; + OmniPvdAttributeHandle suspLinearAH; + OmniPvdAttributeHandle suspAngularAH; + OmniPvdAttributeHandle suspGeometricErrorAH; + OmniPvdAttributeHandle suspRestitutionAH; +}; + +struct PhysXWheelAttachment +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle physxWeelShapeAH; + OmniPvdAttributeHandle physxConstraintParamsAH; + OmniPvdAttributeHandle physxRoadGeometryStateAH; + OmniPvdAttributeHandle physxConstraintStateAH; + OmniPvdAttributeHandle physxMaterialFrictionSetAH; +}; + +struct PhysXMaterialFriction +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle frictionAH; + OmniPvdAttributeHandle materialPtrAH; +}; + +PhysXSuspensionLimitConstraintParams registerSuspLimitConstraintParams(OmniPvdWriter* omniWriter); +PhysXWheelShape registerPhysXWheelShape(OmniPvdWriter* omniWriter); +PhysXRoadGeomState registerPhysXRoadGeomState(OmniPvdWriter* omniWriter); +PhysXConstraintState registerPhysXConstraintState(OmniPvdWriter* omniWriter); +PhysXWheelAttachment registerPhysXWheelAttachment(OmniPvdWriter* omniWriter); +PhysXMaterialFriction registerPhysXMaterialFriction(OmniPvdWriter* omniWriter); + +void writePhysXSuspLimitConstraintParams +(const PxVehiclePhysXSuspensionLimitConstraintParams& params, + const OmniPvdObjectHandle oh, const PhysXSuspensionLimitConstraintParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writePhysXWheelShape +(const PxShape* wheelShape, + const OmniPvdObjectHandle oh, const PhysXWheelShape& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writePhysXRoadGeomState +(const PxVehiclePhysXRoadGeometryQueryState& roadGeomState, +const OmniPvdObjectHandle oh, const PhysXRoadGeomState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writePhysXConstraintState +(const PxVehiclePhysXConstraintState& roadGeomState, + const OmniPvdObjectHandle oh, const PhysXConstraintState& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writePhysXMaterialFriction +(const PxVehiclePhysXMaterialFriction& materialFriction, + const OmniPvdObjectHandle oh, const PhysXMaterialFriction& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +////////////////////////////// +//PHYSX RIGID ACTOR +////////////////////////////// + +struct PhysXRoadGeometryQueryParams +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle queryTypeAH; +}; + +struct PhysXRigidActor +{ + OmniPvdClassHandle CH; + OmniPvdAttributeHandle rigidActorAH; +}; + + +PhysXRoadGeometryQueryParams registerPhysXRoadGeometryQueryParams(OmniPvdWriter* omniWriter); +PhysXRigidActor registerPhysXRigidActor(OmniPvdWriter* omniWriter); + +void writePhysXRigidActor +(const PxRigidActor* actor, + const OmniPvdObjectHandle oh, const PhysXRigidActor& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +void writePhysXRoadGeometryQueryParams +(const PxVehiclePhysXRoadGeometryQueryParams& actor, + const OmniPvdObjectHandle oh, const PhysXRoadGeometryQueryParams& ah, OmniPvdWriter* omniWriter, OmniPvdContextHandle ch); + +////////////////////////////// +//VEHICLE +////////////////////////////// + +struct Vehicle +{ + OmniPvdClassHandle CH; + + OmniPvdAttributeHandle rigidBodyParamsAH; + OmniPvdAttributeHandle rigidBodyStateAH; + + OmniPvdAttributeHandle suspStateCalcParamsAH; + + OmniPvdAttributeHandle brakeResponseParamsSetAH; + OmniPvdAttributeHandle steerResponseParamsAH; + OmniPvdAttributeHandle brakeResponseStatesAH; + OmniPvdAttributeHandle steerResponseStatesAH; + + OmniPvdAttributeHandle wheelAttachmentSetAH; + + OmniPvdAttributeHandle antiRollSetAH; + OmniPvdAttributeHandle antiRollForceAH; + + OmniPvdAttributeHandle directDrivetrainAH; + OmniPvdAttributeHandle engineDriveTrainAH; + + OmniPvdAttributeHandle physxWheelAttachmentSetAH; + + OmniPvdAttributeHandle physxRoadGeometryQueryParamsAH; + OmniPvdAttributeHandle physxRigidActorAH; +}; + +Vehicle registerVehicle(OmniPvdWriter* omniWriter); + + +#if !PX_DOXYGEN +} // namespace vehicle2 +} // namespace physx +#endif + +#endif //PX_SUPPORT_OMNI_PVD + +/** @} */ diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/rigidBody/VhRigidBodyFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/rigidBody/VhRigidBodyFunctions.cpp new file mode 100644 index 0000000..ef614db --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/rigidBody/VhRigidBodyFunctions.cpp @@ -0,0 +1,150 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMat33.h" +#include "foundation/PxTransform.h" + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyFunctions.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" +#include "vehicle2/rigidBody/PxVehicleRigidBodyParams.h" + +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "vehicle2/tire/PxVehicleTireStates.h" + +namespace physx +{ +namespace vehicle2 +{ + +PX_FORCE_INLINE void transformInertiaTensor(const PxVec3& invD, const PxMat33& M, PxMat33& mIInv) +{ + const float axx = invD.x*M(0, 0), axy = invD.x*M(1, 0), axz = invD.x*M(2, 0); + const float byx = invD.y*M(0, 1), byy = invD.y*M(1, 1), byz = invD.y*M(2, 1); + const float czx = invD.z*M(0, 2), czy = invD.z*M(1, 2), czz = invD.z*M(2, 2); + + mIInv(0, 0) = axx * M(0, 0) + byx * M(0, 1) + czx * M(0, 2); + mIInv(1, 1) = axy * M(1, 0) + byy * M(1, 1) + czy * M(1, 2); + mIInv(2, 2) = axz * M(2, 0) + byz * M(2, 1) + czz * M(2, 2); + + mIInv(0, 1) = mIInv(1, 0) = axx * M(1, 0) + byx * M(1, 1) + czx * M(1, 2); + mIInv(0, 2) = mIInv(2, 0) = axx * M(2, 0) + byx * M(2, 1) + czx * M(2, 2); + mIInv(1, 2) = mIInv(2, 1) = axy * M(2, 0) + byy * M(2, 1) + czy * M(2, 2); +} + +PX_FORCE_INLINE void integrateBody +(const PxF32 mass, const PxVec3& moi, const PxVec3& force, const PxVec3& torque, const PxF32 dt, + PxVec3& linvel, PxVec3& angvel, PxTransform& t) +{ + const PxF32 inverseMass = 1.0f/mass; + const PxVec3 inverseMOI(1.0f/moi.x, 1.0f/moi.y, 1.0f/moi.z); + + //Integrate linear velocity. + linvel += force * (inverseMass*dt); + + //Integrate angular velocity. + PxMat33 inverseInertia; + transformInertiaTensor(inverseMOI, PxMat33(t.q), inverseInertia); + angvel += inverseInertia * (torque*dt); + + //Integrate position. + t.p += linvel * dt; + + //Integrate quaternion. + PxQuat wq(angvel.x, angvel.y, angvel.z, 0.0f); + PxQuat q = t.q; + PxQuat qdot = wq * q*(dt*0.5f); + q += qdot; + q.normalize(); + t.q = q; +} + +void PxVehicleRigidBodyUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleRigidBodyParams& rigidBodyParams, + const PxVehicleArrayData& suspensionForces, + const PxVehicleArrayData& tireForces, + const PxVehicleAntiRollTorque* antiRollTorque, + const PxReal dt, const PxVec3& gravity, + PxVehicleRigidBodyState& rigidBodyState) +{ + //Sum all the forces and torques. + const PxU32 nbAxles = axleDescription.getNbAxles(); + PxVec3 force(PxZero); + PxVec3 torque(PxZero); + for (PxU32 i = 0; i < nbAxles; i++) + { + PxVec3 axleSuspForce(PxZero); + PxVec3 axleTireLongForce(PxZero); + PxVec3 axleTireLatForce(PxZero); + PxVec3 axleSuspTorque(PxZero); + PxVec3 axleTireLongTorque(PxZero); + PxVec3 axleTireLatTorque(PxZero); + for (PxU32 j = 0; j < axleDescription.getNbWheelsOnAxle(i); j++) + { + const PxU32 wheelId = axleDescription.getWheelOnAxle(j, i); + const PxVehicleSuspensionForce& suspForce = suspensionForces[wheelId]; + const PxVehicleTireForce& tireForce = tireForces[wheelId]; + axleSuspForce += suspForce.force; + axleTireLongForce += tireForce.forces[PxVehicleTireDirectionModes::eLONGITUDINAL]; + axleTireLatForce += tireForce.forces[PxVehicleTireDirectionModes::eLATERAL]; + axleSuspTorque += suspForce.torque; + axleTireLongTorque += tireForce.torques[PxVehicleTireDirectionModes::eLONGITUDINAL]; + axleTireLatTorque += tireForce.torques[PxVehicleTireDirectionModes::eLATERAL]; + } + const PxVec3 axleForce = axleSuspForce + axleTireLongForce + axleTireLatForce; + const PxVec3 axleTorque = axleSuspTorque + axleTireLongTorque + axleTireLatTorque; + force += axleForce; + torque += axleTorque; + } + force += gravity * rigidBodyParams.mass; + force += rigidBodyState.externalForce; + torque += rigidBodyState.externalTorque; + torque += (antiRollTorque ? antiRollTorque->antiRollTorque : PxVec3(PxZero)); + + //Rigid body params. + const PxF32 mass = rigidBodyParams.mass; + const PxVec3& moi = rigidBodyParams.moi; + + //Perform the integration. + PxTransform& t = rigidBodyState.pose; + PxVec3& linvel = rigidBodyState.linearVelocity; + PxVec3& angvel = rigidBodyState.angularVelocity; + integrateBody( + mass, moi, + force, torque, dt, + linvel, angvel, t); + + //Reset the accumulated external forces after using them. + rigidBodyState.externalForce = PxVec3(PxZero); + rigidBodyState.externalTorque = PxVec3(PxZero); +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/steering/VhSteeringFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/steering/VhSteeringFunctions.cpp new file mode 100644 index 0000000..5d6faee --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/steering/VhSteeringFunctions.cpp @@ -0,0 +1,95 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/commands/PxVehicleCommandHelpers.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/steering/PxVehicleSteeringParams.h" + +namespace physx +{ +namespace vehicle2 +{ + +void PxVehicleSteerCommandResponseUpdate +(const PxReal steer, const PxReal longitudinalSpeed, + const PxU32 wheelId, const PxVehicleSteerCommandResponseParams& responseParams, + PxReal& steerResponse) +{ + steerResponse = PxVehicleNonLinearResponseCompute(steer, longitudinalSpeed, wheelId, responseParams); +} + +void PxVehicleAckermannSteerUpdate +(const PxReal steer, + const PxVehicleSteerCommandResponseParams& steerResponseParams, const PxVehicleSizedArrayData& ackermannParams, + PxVehicleArrayData& steerResponseStates) +{ + for (PxU32 i = 0; i < ackermannParams.size; i++) + { + const PxVehicleAckermannParams& ackParams = ackermannParams[i]; + if (ackParams.strength > 0.0f) + { + //Axle yaw is the average of the two wheels. + const PxF32 axleYaw = + (PxVehicleLinearResponseCompute(steer, ackParams.wheelIds[0], steerResponseParams) + + PxVehicleLinearResponseCompute(steer, ackParams.wheelIds[1], steerResponseParams))*0.5f; + if (axleYaw != 0.0f) + { + //Work out the ackermann steer for +ve steer then swap and negate the steer angles if the steer is -ve. + + //Uncorrected yaw angle. + //One of the wheels will adopt this angle. + //The other will be corrected. + const PxF32 posWheelYaw = PxAbs(axleYaw); + + //Work out the yaw of the other wheel. + PxF32 negWheelCorrectedYaw; + { + const PxF32 dz = ackParams.wheelBase; + const PxF32 dx = ackParams.trackWidth + ackParams.wheelBase / PxTan(posWheelYaw); + const PxF32 negWheelPerfectYaw = PxAtan(dz / dx); + negWheelCorrectedYaw = posWheelYaw + ackParams.strength*(negWheelPerfectYaw - posWheelYaw); + } + + //Now assign axleYaw and negWheelCorrectedYaw to the correct wheels with the correct signs. + const PxF32 negWheelFinalYaw = intrinsics::fsel(axleYaw, negWheelCorrectedYaw, -posWheelYaw); + const PxF32 posWheelFinalYaw = intrinsics::fsel(axleYaw, posWheelYaw, -negWheelCorrectedYaw); + + //Apply the per axle distributions to each wheel on the axle that is affected by this Ackermann correction. + steerResponseStates[ackParams.wheelIds[0]] = negWheelFinalYaw; + steerResponseStates[ackParams.wheelIds[1]] = posWheelFinalYaw; + } + } + } +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionFunctions.cpp new file mode 100644 index 0000000..f9732ec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionFunctions.cpp @@ -0,0 +1,711 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/suspension/PxVehicleSuspensionParams.h" +#include "vehicle2/suspension/PxVehicleSuspensionFunctions.h" +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" + +namespace physx +{ +namespace vehicle2 +{ + +#define VH_SUSPENSION_NO_INTERSECTION_MARKER FLT_MIN + +PX_FORCE_INLINE void computeJounceAndSeparation(const PxF32 depth, const PxF32 suspDirDotPlaneNormal, + const PxF32 suspTravelDist, const PxF32 previousJounce, + PxF32& jounce, PxF32& separation) +{ + if (suspDirDotPlaneNormal != 0.0f) + { + if (depth <= 0.0f) + { + //There is overlap at max droop + + const PxF32 suspDeltaToDepthZero = depth / suspDirDotPlaneNormal; + + if ((suspDeltaToDepthZero > 0.0f) && (suspDeltaToDepthZero <= suspTravelDist)) + { + //The wheel can be placed on the plane for a jounce between max droop and max compression. + jounce = suspDeltaToDepthZero; + separation = 0.0f; + } + else + { + if (suspDeltaToDepthZero > suspTravelDist) + { + //There is overlap even at max compression. Compute the depth at max + //compression. + jounce = suspTravelDist; + separation = (depth * (suspDeltaToDepthZero - suspTravelDist)) / suspDeltaToDepthZero; + } + else + { + PX_ASSERT(suspDeltaToDepthZero <= 0.0f); + + //There is overlap at max droop and in addition, the suspension would have to expand + //beyond max droop to move out of plane contact. This scenario can be reached, for + //example, if a car rolls over or if something touches a wheel from "above". + jounce = 0.0f; + separation = depth; + } + } + } + else + { + //At max droop there is no overlap => let the suspension fully expand. + //Note that this check is important because without it, you can get unexpected + //behavior like the wheel compressing just so that it touches the plane again. + + jounce = 0.0f; + separation = VH_SUSPENSION_NO_INTERSECTION_MARKER; + } + } + else + { + //The suspension direction and hit normal are perpendicular, thus no change to + //suspension jounce will change the distance to the plane. + + if (depth >= 0.0f) + { + jounce = 0.0f; + separation = VH_SUSPENSION_NO_INTERSECTION_MARKER; + } + else + { + jounce = (previousJounce != PX_VEHICLE_UNSPECIFIED_JOUNCE) ? previousJounce : suspTravelDist; + separation = depth; + // note: since The suspension direction and hit normal are perpendicular, the + // depth will be the same for all jounce values + } + } +} + +PX_FORCE_INLINE void intersectRayPlane +(const PxVehicleFrame& frame, const PxVehicleWheelParams& wheelParams, const PxVehicleSuspensionParams& suspParams, + const PxF32 steerAngle, const PxVehicleRoadGeometryState& roadGeomState, const PxVehicleRigidBodyState& rigidBodyState, + const PxF32 previousJounce, + PxVec3& suspDir, PxF32& jounce, PxF32& separation) +{ + //Compute the position on the wheel surface along the suspension direction that is closest to + //the plane (for the purpose of computing the separation from the plane). The wheel center position + //is chosen at max droop (zero jounce). + PxVehicleSuspensionState suspState; + suspState.setToDefault(0.0f); + const PxTransform wheelPose = PxVehicleComputeWheelPose(frame, suspParams, suspState, 0.0f, 0.0f, steerAngle, + rigidBodyState.pose, 0.0f); + + suspDir = PxVehicleComputeSuspensionDirection(suspParams, rigidBodyState.pose); + const PxPlane& hitPlane = roadGeomState.plane; + const PxF32 suspDirDotPlaneNormal = suspDir.dot(hitPlane.n); + + PxVec3 wheelRefPoint; + if (suspDirDotPlaneNormal < 0.0f) + { + wheelRefPoint = wheelPose.p + (suspDir * wheelParams.radius); + //The "wheel bottom" has to be placed on the plane to resolve collision + } + else if (suspDirDotPlaneNormal > 0.0f) + { + wheelRefPoint = wheelPose.p - (suspDir * wheelParams.radius); + //The "wheel top" has to be placed on the plane to resolve collision + } + else + { + //The hit normal and susp dir are prependicular + //-> any point along the suspension direction will do to compute the depth + wheelRefPoint = wheelPose.p; + } + + //Compute the penetration depth of the reference point with respect to the plane + const PxF32 depth = hitPlane.n.dot(wheelRefPoint) + hitPlane.d; + + //How far along the susp dir do we have to move to place the wheel exactly on the plane. + computeJounceAndSeparation(depth, suspDirDotPlaneNormal, suspParams.suspensionTravelDist, previousJounce, + jounce, separation); +} + +PX_FORCE_INLINE bool intersectPlanes(const PxPlane& a, const PxPlane& b, PxVec3& v, PxVec3& w) +{ + const PxF32 n1x = a.n.x; + const PxF32 n1y = a.n.y; + const PxF32 n1z = a.n.z; + const PxF32 n1d = a.d; + + const PxF32 n2x = b.n.x; + const PxF32 n2y = b.n.y; + const PxF32 n2z = b.n.z; + const PxF32 n2d = b.d; + + PxF32 dx = (n1y * n2z) - (n1z * n2y); + PxF32 dy = (n1z * n2x) - (n1x * n2z); + PxF32 dz = (n1x * n2y) - (n1y * n2x); + + const PxF32 dx2 = dx * dx; + const PxF32 dy2 = dy * dy; + const PxF32 dz2 = dz * dz; + + PxF32 px, py, pz; + if ((dz2 > dy2) && (dz2 > dx2) && (dz2 > 0)) + { + px = ((n1y * n2d) - (n2y * n1d)) / dz; + py = ((n2x * n1d) - (n1x * n2d)) / dz; + pz = 0; + } + else if ((dy2 > dx2) && (dy2 > 0)) + { + px = -((n1z * n2d) - (n2z * n1d)) / dy; + py = 0; + pz = -((n2x * n1d) - (n1x * n2d)) / dy; + } + else if (dx2 > 0) + { + px = 0; + py = ((n1z * n2d) - (n2z * n1d)) / dx; + pz = ((n2y * n1d) - (n1y * n2d)) / dx; + } + else + { + px = 0; + py = 0; + pz = 0; + return false; + } + + const PxF32 ld = PxSqrt(dx2 + dy2 + dz2); + + dx /= ld; + dy /= ld; + dz /= ld; + + w = PxVec3(dx, dy, dz); + v = PxVec3(px, py, pz); + + return true; +} + + +// This method computes how much a wheel cylinder object at max droop (fully elongated suspension) +// has to be pushed along the suspension direction to end up just touching the plane provided in +// the road geometry state. +// +// output: +// suspDir: suspension direction in the world frame +// jounce: the suspension jounce. +// jounce=0 the wheel is at max droop +// jounce>0 the suspension is compressed by length jounce (up to max compression = suspensionTravelDist) +// +// The jounce value will be set to 0 (in the case of no overlap) or to the previous jounce +// (in the case of overlap) for the following special cases: +// - the plane normal and the wheel lateral axis are parallel +// - the plane normal and the suspension direction are perpendicular +// separation: 0 if the suspension can move between max droop and max compression to place +// the wheel on the ground. +// A negative value denotes by how much the wheel cylinder penetrates (along the hit +// plane normal) into the ground for the computed jounce. +// A positive value denotes that the wheel does not touch the ground. +// +PX_FORCE_INLINE void intersectCylinderPlane +(const PxVehicleFrame& frame, + const PxVehicleWheelParams& whlParams, const PxVehicleSuspensionParams& suspParams, + const PxF32 steerAngle, const PxVehicleRoadGeometryState& roadGeomState, const PxVehicleRigidBodyState& rigidBodyState, + const PxF32 previousJounce, + PxVec3& suspDir, PxF32& jounce, PxF32& separation) +{ + const PxPlane& hitPlane = roadGeomState.plane; + const PxF32 radius = whlParams.radius; + const PxF32 halfWidth = whlParams.halfWidth; + + //Compute the wheel pose at zero jounce ie at max droop. + PxTransform wheelPoseAtZeroJounce; + { + PxTransform start; + PxF32 dist; + PxVehicleComputeSuspensionSweep(frame, suspParams, steerAngle, rigidBodyState.pose, start, suspDir, dist); + wheelPoseAtZeroJounce = PxTransform(start.p + suspDir*dist, start.q); + } + + //Compute the plane of the wheel. + PxPlane wheelPlane; + { + wheelPlane = PxPlane(wheelPoseAtZeroJounce.p, wheelPoseAtZeroJounce.rotate(frame.getLatAxis())); + } + + //Intersect the plane of the wheel with the hit plane. + //This generates an intersection edge. + PxVec3 intersectionEdgeV, intersectionEdgeW; + const bool intersectPlaneSuccess = intersectPlanes(wheelPlane, hitPlane, intersectionEdgeV, intersectionEdgeW); + + PxF32 depth; + if (intersectPlaneSuccess) + { + //Compute the position on the intersection edge that is closest to the wheel centre. + PxVec3 closestPointOnIntersectionEdge; + { + const PxVec3& p = wheelPoseAtZeroJounce.p; + const PxVec3& dir = intersectionEdgeW; + const PxVec3& v = intersectionEdgeV; + const PxF32 t = (p - v).dot(dir); + closestPointOnIntersectionEdge = v + dir * t; + } + + //Compute the vector that joins the wheel centre to the intersection edge; + PxVec3 dir; + { + const PxF32 wheelCentreD = hitPlane.n.dot(wheelPoseAtZeroJounce.p) + hitPlane.d; + dir = ((wheelCentreD >= 0) ? closestPointOnIntersectionEdge - wheelPoseAtZeroJounce.p : wheelPoseAtZeroJounce.p - closestPointOnIntersectionEdge); + dir.normalize(); + } + + //Compute the point on the disc diameter that will be the closest to the hit plane or the deepest inside the hit plane. + const PxVec3 pos = wheelPoseAtZeroJounce.p + dir*radius; + + //Now compute the maximum depth of the inside and outside discs against the plane. + { + const PxVec3& latDir = wheelPlane.n; + const PxF32 signDot = PxVehicleComputeSign(hitPlane.n.dot(latDir)); + const PxVec3 deepestPos = pos - latDir * (signDot*halfWidth); + depth = hitPlane.n.dot(deepestPos) + hitPlane.d; + } + } + else + { + //The hit plane normal and the wheel lateral axis are parallel + + //Now compute the maximum depth of the inside and outside discs against the plane. + const PxVec3& latDir = wheelPlane.n; + const PxF32 signDot = PxVehicleComputeSign(hitPlane.n.dot(latDir)); + depth = hitPlane.d - halfWidth - (signDot*wheelPlane.d); + + // examples: + // halfWidth = 0.5 + // + // wheelPlane.d hitplane.d depth + //============================================= + // -3 -> -3.5 -> -1 + // 3 <- -3.5 -> -1 + // + // -3 -> 3.5 <- 0 + // 3 <- 3.5 <- 0 + // + } + + //How far along the susp dir do we have to move to place the wheel exactly on the plane. + const PxF32 suspDirDotPlaneNormal = hitPlane.n.dot(suspDir); + computeJounceAndSeparation(depth, suspDirDotPlaneNormal, suspParams.suspensionTravelDist, previousJounce, + jounce, separation); +} + +static void limitSuspensionExpansionVelocity +(const PxReal jounceSpeed, const PxReal previousJounceSpeed, const PxReal previousJounce, + const PxReal suspStiffness, const PxReal suspDamping, + const PxVec3& suspDirWorld, const PxReal wheelMass, + const PxReal dt, const PxVec3& gravity, + PxVehicleSuspensionState& suspState) +{ + PX_ASSERT(jounceSpeed < 0.0f); // don't call this method if the suspension is not expanding + + // The suspension is expanding. Check if the suspension can expand fast enough to actually reach the + // target jounce within the given time step. + + // Without the suspension elongating, the wheel would end up in the air. Compute the suspension force + // that pushes the wheel towards the ground. Note that gravity is ignored here as it applies to sprung + // mass and wheel equally. + const PxReal springForceAlongSuspDir = (previousJounce * suspStiffness); + const PxReal suspDirVelSpring = (springForceAlongSuspDir / wheelMass) * dt; + const PxReal dampingForceAlongSuspDir = (previousJounceSpeed * suspDamping); // note: negative jounce speed = expanding + const PxReal suspDirVelDamping = (dampingForceAlongSuspDir / wheelMass) * dt; + PxReal suspDirVel = suspDirVelSpring - previousJounceSpeed; + // add damping part but such that it does not flip the velocity sign (covering case of + // crazily high damping values) + const PxReal suspDirVelTmp = suspDirVel + suspDirVelDamping; + if (suspDirVel >= 0.0f) + suspDirVel = PxMax(0.0f, suspDirVelTmp); + else + suspDirVel = PxMin(0.0f, suspDirVelTmp); + + const PxReal gravitySuspDir = gravity.dot(suspDirWorld); + + const PxReal suspDirVelWheel = suspDirVel + (gravitySuspDir * dt); + // gravity is considered too as it affects the wheel and can close the distance to the ground + // too. External forces acting on the sprung mass are ignored as those propagate through the + // suspension to the wheel. + + if (jounceSpeed < (-suspDirVelWheel)) + { + // The suspension can not expand fast enough to place the wheel on the ground. As a result, + // the scenario is interpreted as if there was no hit and the wheels end up in air. The + // jounce is adjusted based on the clamped velocity to not have it snap to 0 immediately. + // note: could consider applying the suspension force to the sprung mass too but the complexity + // seems high enough already. + + const PxReal expansionDelta = suspDirVel * dt; + const PxReal clampedJounce = previousJounce - expansionDelta; + + PX_ASSERT(clampedJounce >= 0.0f); + // No need to cover the case of a negative jounce as the input jounce speed is expected to make + // sure that no negative jounce would result (and the speed considered here is smaller than the + // non-clamped input jounce speed). + + if (suspState.separation >= 0.0f) // do not adjust separation if ground penetration was detected + { + suspState.separation = clampedJounce - suspState.jounce; + } + suspState.jounce = clampedJounce; + suspState.jounceSpeed = -suspDirVel; + } +} + +void PxVehicleSuspensionStateUpdate +(const PxVehicleWheelParams& whlParams, const PxVehicleSuspensionParams& suspParams, const PxVehicleSuspensionStateCalculationParams& suspStateCalcParams, + const PxReal suspStiffness, const PxReal suspDamping, + const PxF32 steerAngle, const PxVehicleRoadGeometryState& roadGeomState, const PxVehicleRigidBodyState& rigidBodyState, + const PxReal dt, const PxVehicleFrame& frame, const PxVec3& gravity, + PxVehicleSuspensionState& suspState) +{ + const PxReal prevJounce = suspState.jounce; + const PxReal prevJounceSpeed = suspState.jounceSpeed; + + suspState.setToDefault(0.0f, VH_SUSPENSION_NO_INTERSECTION_MARKER); + + if(!roadGeomState.hitState) + { + if (suspStateCalcParams.limitSuspensionExpansionVelocity && (prevJounce != PX_VEHICLE_UNSPECIFIED_JOUNCE)) + { + if (prevJounce > 0.0f) + { + PX_ASSERT(suspState.jounce == 0.0f); // the expectation is that setToDefault() above does this + const PxReal jounceSpeed = (-prevJounce) / dt; + const PxVec3 suspDirWorld = PxVehicleComputeSuspensionDirection(suspParams, rigidBodyState.pose); + limitSuspensionExpansionVelocity(jounceSpeed, prevJounceSpeed, prevJounce, + suspStiffness, suspDamping, suspDirWorld, whlParams.mass, dt, gravity, + suspState); + } + } + + return; + } + + PxVec3 suspDir; + PxF32 currJounce; + PxF32 separation; + switch(suspStateCalcParams.suspensionJounceCalculationType) + { + case PxVehicleSuspensionJounceCalculationType::eRAYCAST: + { + //Compute the distance along the suspension direction that places the wheel on the ground plane. + intersectRayPlane(frame, whlParams, suspParams, steerAngle, roadGeomState, rigidBodyState, + prevJounce, + suspDir, currJounce, separation); + } + break; + case PxVehicleSuspensionJounceCalculationType::eSWEEP: + { + //Compute the distance along the suspension direction that places the wheel on the ground plane. + intersectCylinderPlane(frame, whlParams, suspParams, steerAngle, roadGeomState, rigidBodyState, + prevJounce, + suspDir, currJounce, separation); + } + break; + default: + { + PX_ASSERT(false); + currJounce = 0.0f; + separation = VH_SUSPENSION_NO_INTERSECTION_MARKER; + } + break; + } + + suspState.jounce = currJounce; + suspState.jounceSpeed = (PX_VEHICLE_UNSPECIFIED_JOUNCE != prevJounce) ? (currJounce - prevJounce) / dt : 0.0f; + suspState.separation = separation; + + if (suspStateCalcParams.limitSuspensionExpansionVelocity && (suspState.jounceSpeed < 0.0f)) + { + limitSuspensionExpansionVelocity(suspState.jounceSpeed, prevJounceSpeed, prevJounce, + suspStiffness, suspDamping, suspDir, whlParams.mass, dt, gravity, + suspState); + } +} + +void PxVehicleSuspensionComplianceUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionComplianceParams& compParams, + const PxVehicleSuspensionState& suspState, + PxVehicleSuspensionComplianceState& compState) +{ + compState.setToDefault(); + + //Compliance is normalised in range (0,1) with: + //0 being fully elongated (ie jounce = 0) + //1 being fully compressed (ie jounce = maxTravelDist) + const PxF32 jounce = suspState.jounce; + const PxF32 maxTravelDist = suspParams.suspensionTravelDist; + const PxF32 r = jounce/maxTravelDist; + + //Camber and toe relative the wheel reference pose. + { + compState.camber = compParams.wheelCamberAngle.interpolate(r); + compState.toe = compParams.wheelToeAngle.interpolate(r); + } + + //Tire force application point as an offset from wheel reference pose. + { + compState.tireForceAppPoint = compParams.tireForceAppPoint.interpolate(r); + } + + //Susp force application point as an offset from wheel reference pose. + { + compState.suspForceAppPoint = compParams.suspForceAppPoint.interpolate(r); + } +} + +PX_FORCE_INLINE void setSuspensionForceAndTorque +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleRoadGeometryState& roadGeomState, const PxVehicleSuspensionComplianceState& suspComplianceState, const PxVehicleRigidBodyState& rigidBodyState, + const PxF32 suspForceMagnitude, const PxF32 normalForceMagnitude, + PxVehicleSuspensionForce& suspForce) +{ + const PxVec3 r = rigidBodyState.pose.rotate(suspParams.suspensionAttachment.transform(suspComplianceState.suspForceAppPoint)); + const PxVec3 f = roadGeomState.plane.n*suspForceMagnitude; + suspForce.force = f; + suspForce.torque = r.cross(f); + suspForce.normalForce = normalForceMagnitude; +} + +void PxVehicleSuspensionForceUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionForceParams& suspForceParams, + const PxVehicleRoadGeometryState& roadGeom, const PxVehicleSuspensionState& suspState, + const PxVehicleSuspensionComplianceState& compState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, const PxReal vehicleMass, + PxVehicleSuspensionForce& suspForces) +{ + suspForces.setToDefault(); + + //If there are no road geom hits then carry on with zero force. + if (!roadGeom.hitState) + return; + + //If the wheel cannot touch the ground then carry on with zero force. + if (!PxVehicleIsWheelOnGround(suspState)) + return; + + //For the following computations, the external force Fe acting on the suspension + //is seen as the sum of two forces Fe0 and Fe1. Fe0 acts along the suspension + //direction while Fe1 is the part perpendicular to Fe0. The suspension spring + //force Fs0 works against Fe0, while the suspension "collision" force Fs1 works + //against Fe1 (can be seen as a force that is trying to push the suspension + //into the ground in a direction where the spring can not do anything against + //it because it's perpendicular to the spring direction). + //For the system to be at rest, we require Fs0 = -Fe0 and Fs1 = -Fe1 + //The forces Fe0 and Fe1 can each be split further into parts that act along + //the ground patch normal and parts that act parallel to the ground patch. + //Fs0 and Fs1 work against the former as the ground prevents the suspension + //from penetrating. However, to work against the latter, friction would have + //to be considered. The current model does not do this (or rather: it is the + //tire model that deals with forces parallel to the ground patch). As a result, + //only the force parts of Fs0 and Fs1 perpendicular to the ground patch are + //considered here. Furthermore, Fs1 is set to zero, if the external force is + //not pushing the suspension towards the ground patch (imagine a vehicle with + //a "tilted" suspension direction "driving" up a wall. No "collision" force + //should be added in such a scenario). + + PxF32 suspForceMagnitude = 0.0f; + { + const PxF32 jounce = suspState.jounce; + const PxF32 stiffness = suspForceParams.stiffness; + const PxF32 jounceSpeed = suspState.jounceSpeed; + const PxF32 damping = suspForceParams.damping; + + const PxVec3 suspDirWorld = PxVehicleComputeSuspensionDirection(suspParams, rigidBodyState.pose); + const PxVec3 suspSpringForce = suspDirWorld * (-(jounce*stiffness + jounceSpeed*damping)); + const PxF32 suspSpringForceProjected = roadGeom.plane.n.dot(suspSpringForce); + suspForceMagnitude = suspSpringForceProjected; + + const PxVec3 comToSuspWorld = rigidBodyState.pose.rotate(suspParams.suspensionAttachment.p); + const PxVec3 externalForceLin = (gravity * vehicleMass) + rigidBodyState.externalForce; + + const PxReal comToSuspDistSqr = comToSuspWorld.magnitudeSquared(); + PxVec3 externalForceAng; + if (comToSuspDistSqr > 0.0f) + { + // t = r x F + // t x r = (r x F) x r = -[r x (r x F)] = -[((r o F) * r) - ((r o r) * F)] + // r and F perpendicular (r o F = 0) => = (r o r) * F = |r|^2 * F + + externalForceAng = (rigidBodyState.externalTorque.cross(comToSuspWorld)) / comToSuspDistSqr; + } + else + externalForceAng = PxVec3(PxZero); + + const PxVec3 externalForce = externalForceLin + externalForceAng; + + const PxVec3 externalForceSusp = externalForce * (suspForceParams.sprungMass / vehicleMass); + if (roadGeom.plane.n.dot(externalForceSusp) < 0.0f) + { + const PxF32 suspDirExternalForceMagn = suspDirWorld.dot(externalForceSusp); + const PxVec3 collisionForce = externalForceSusp - (suspDirWorld * suspDirExternalForceMagn); + const PxF32 suspCollisionForceProjected = -roadGeom.plane.n.dot(collisionForce); + suspForceMagnitude += suspCollisionForceProjected; + } + } + + setSuspensionForceAndTorque(suspParams, roadGeom, compState, rigidBodyState, suspForceMagnitude, suspForceMagnitude, suspForces); +} + +void PxVehicleSuspensionLegacyForceUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxVehicleSuspensionForceLegacyParams& suspForceParamsLegacy, + const PxVehicleRoadGeometryState& roadGeomState, const PxVehicleSuspensionState& suspState, + const PxVehicleSuspensionComplianceState& compState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVec3& gravity, + PxVehicleSuspensionForce& suspForces) +{ + suspForces.setToDefault(); + + //If there are no road geom hits then carry on with zero force. + if (!roadGeomState.hitState) + return; + + //If the wheel cannot touch the ground then carry on with zero force. + if (!PxVehicleIsWheelOnGround(suspState)) + return; + + PxF32 suspForceMagnitude = 0.0f; + { + //Get the params for the legacy model. + //const PxF32 restDistance = suspForceParamsLegacy.restDistance; + const PxF32 sprungMass = suspForceParamsLegacy.sprungMass; + const PxF32 restDistance = suspForceParamsLegacy.restDistance; + + //Get the non-legacy params. + const PxF32 stiffness = suspForceParamsLegacy.stiffness; + const PxF32 damperRate = suspForceParamsLegacy.damping; + const PxF32 maxTravelDist = suspParams.suspensionTravelDist; + + //Suspension state. + const PxF32 jounce = suspState.jounce; + const PxF32 jounceSpeed = suspState.jounceSpeed; + + //Decompose gravity into a term along w and a term perpendicular to w + //gravity = w*alpha + T*beta + //where T is a unit vector perpendicular to w; alpha and beta are scalars. + //The vector w*alpha*mass is the component of gravitational force that acts along the spring direction. + //The vector T*beta*mass is the component of gravitational force that will be resisted by the spring + //because the spring only supports a single degree of freedom along w. + //We only really need to know T*beta so don't bother calculating T or beta. + const PxVec3 w = PxVehicleComputeSuspensionDirection(suspParams, rigidBodyState.pose); + + const PxF32 gravitySuspDir = gravity.dot(w); + const PxF32 alpha = PxMax(0.0f, gravitySuspDir); + const PxVec3 TTimesBeta = (0.0f != alpha) ? gravity - w * alpha : PxVec3(0, 0, 0); + //Compute the magnitude of the force along w. + PxF32 suspensionForceW = + PxMax(0.0f, + sprungMass*alpha + //force to support sprung mass at zero jounce + stiffness*(jounce + restDistance - maxTravelDist)); //linear spring + suspensionForceW += jounceSpeed * damperRate; //damping + + //Compute the total force acting on the suspension. + //Remember that the spring force acts along -w. + //Remember to account for the term perpendicular to w and that it acts along -TTimesBeta + suspForceMagnitude = roadGeomState.plane.n.dot(-w * suspensionForceW - TTimesBeta * sprungMass); + + } + + setSuspensionForceAndTorque(suspParams, roadGeomState, compState, rigidBodyState, suspForceMagnitude, suspForceMagnitude, suspForces); +} + +void PxVehicleAntiRollForceUpdate +(const PxVehicleArrayData& suspensionParams, + const PxVehicleSizedArrayData& antiRollParams, + const PxVehicleArrayData& suspensionStates, + const PxVehicleArrayData& complianceStates, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleAntiRollTorque& antiRollTorque) +{ + antiRollTorque.setToDefault(); + + for (PxU32 i = 0; i < antiRollParams.size; i++) + { + if (antiRollParams[i].stiffness != 0.0f) + { + const PxU32 w0 = antiRollParams[i].wheel0; + const PxU32 w1 = antiRollParams[i].wheel1; + + const bool w0InAir = (0.0f == suspensionStates[w0].jounce); + const bool w1InAir = (0.0f == suspensionStates[w1].jounce); + + if (!w0InAir || !w1InAir) + { + //Compute the difference in jounce and compute the force. + const PxF32 w0Jounce = suspensionStates[w0].jounce; + const PxF32 w1Jounce = suspensionStates[w1].jounce; + const PxF32 antiRollForceMag = (w0Jounce - w1Jounce) * antiRollParams[i].stiffness; + + //Apply the antiRollForce postiviely to wheel0, negatively to wheel 1 + PxU32 wheelIds[2] = { 0xffffffff, 0xffffffff }; + PxF32 antiRollForceMags[2]; + PxU32 numWheelIds = 0; + if (!w0InAir) + { + wheelIds[numWheelIds] = w0; + antiRollForceMags[numWheelIds] = -antiRollForceMag; + numWheelIds++; + } + if (!w1InAir) + { + wheelIds[numWheelIds] = w1; + antiRollForceMags[numWheelIds] = +antiRollForceMag; + numWheelIds++; + } + + for (PxU32 j = 0; j < numWheelIds; j++) + { + const PxU32 wheelId = wheelIds[j]; + const PxVec3& antiRollForceDir = suspensionParams[wheelId].suspensionTravelDir; + const PxVec3 antiRollForce = antiRollForceDir * antiRollForceMags[j]; + const PxVec3 r = suspensionParams[wheelId].suspensionAttachment.transform(complianceStates[wheelId].suspForceAppPoint); + antiRollTorque.antiRollTorque += rigidBodyState.pose.rotate(r.cross(antiRollForce)); + } + } + } + } +} + + + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionHelpers.cpp new file mode 100644 index 0000000..930cf85 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/suspension/VhSuspensionHelpers.cpp @@ -0,0 +1,214 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" +#include "vehicle2/PxVehicleMaths.h" +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" + +namespace physx +{ +namespace vehicle2 +{ +#define DETERMINANT_THRESHOLD (1e-6f) + + bool PxVehicleComputeSprungMasses(const PxU32 numSprungMasses, const PxVec3* sprungMassCoordinates, const PxReal totalMass, const PxVehicleAxes::Enum gravityDir, PxReal* sprungMasses) + { + if (numSprungMasses < 1) + return false; + + if (numSprungMasses > PxVehicleLimits::eMAX_NB_WHEELS) + return false; + + if (totalMass <= 0.0f) + return false; + + if (!sprungMassCoordinates || !sprungMasses) + return false; + + const PxVec3 centreOfMass(PxZero); + + PxU32 gravityDirection = 0xffffffff; + switch (gravityDir) + { + case PxVehicleAxes::eNegX: + case PxVehicleAxes::ePosX: + gravityDirection = 0; + break; + case PxVehicleAxes::eNegY: + case PxVehicleAxes::ePosY: + gravityDirection = 1; + break; + case PxVehicleAxes::eNegZ: + case PxVehicleAxes::ePosZ: + gravityDirection = 2; + break; + default: + PX_ASSERT(false); + break; + } + + if (1 == numSprungMasses) + { + sprungMasses[0] = totalMass; + } + else if (2 == numSprungMasses) + { + PxVec3 v = sprungMassCoordinates[0]; + v[gravityDirection] = 0; + PxVec3 w = sprungMassCoordinates[1] - sprungMassCoordinates[0]; + w[gravityDirection] = 0; + w.normalize(); + + PxVec3 cm = centreOfMass; + cm[gravityDirection] = 0; + PxF32 t = w.dot(cm - v); + PxVec3 p = v + w * t; + + PxVec3 x0 = sprungMassCoordinates[0]; + x0[gravityDirection] = 0; + PxVec3 x1 = sprungMassCoordinates[1]; + x1[gravityDirection] = 0; + const PxF32 r0 = (x0 - p).dot(w); + const PxF32 r1 = (x1 - p).dot(w); + + if (PxAbs(r0 - r1) <= DETERMINANT_THRESHOLD) + return false; + + const PxF32 m0 = totalMass * r1 / (r1 - r0); + const PxF32 m1 = totalMass - m0; + + sprungMasses[0] = m0; + sprungMasses[1] = m1; + } + else if (3 == numSprungMasses) + { + const PxU32 d0 = (gravityDirection + 1) % 3; + const PxU32 d1 = (gravityDirection + 2) % 3; + + PxVehicleMatrixNN A(3); + PxVehicleVectorN b(3); + A.set(0, 0, sprungMassCoordinates[0][d0]); + A.set(0, 1, sprungMassCoordinates[1][d0]); + A.set(0, 2, sprungMassCoordinates[2][d0]); + A.set(1, 0, sprungMassCoordinates[0][d1]); + A.set(1, 1, sprungMassCoordinates[1][d1]); + A.set(1, 2, sprungMassCoordinates[2][d1]); + A.set(2, 0, 1.f); + A.set(2, 1, 1.f); + A.set(2, 2, 1.f); + b[0] = totalMass * centreOfMass[d0]; + b[1] = totalMass * centreOfMass[d1]; + b[2] = totalMass; + + PxVehicleVectorN result(3); + PxVehicleMatrixNNLUSolver solver; + solver.decomposeLU(A); + if (PxAbs(solver.getDet()) <= DETERMINANT_THRESHOLD) + return false; + solver.solve(b, result); + + sprungMasses[0] = result[0]; + sprungMasses[1] = result[1]; + sprungMasses[2] = result[2]; + } + else if (numSprungMasses >= 4) + { + const PxU32 d0 = (gravityDirection + 1) % 3; + const PxU32 d1 = (gravityDirection + 2) % 3; + + const PxF32 mbar = totalMass / (numSprungMasses*1.0f); + + //See http://en.wikipedia.org/wiki/Lagrange_multiplier + //particularly the section on multiple constraints. + + //3 Constraint equations. + //g0 = sum_ xi*mi=xcm + //g1 = sum_ zi*mi=zcm + //g2 = sum_ mi = totalMass + //Minimisation function to achieve solution with minimum mass variance. + //f = sum_ (mi - mave)^2 + //Lagrange terms (N equations, N+3 unknowns) + //2*mi - xi*lambda0 - zi*lambda1 - 1*lambda2 = 2*mave + + PxVehicleMatrixNN A(numSprungMasses + 3); + PxVehicleVectorN b(numSprungMasses + 3); + + //g0, g1, g2 + for (PxU32 i = 0; i < numSprungMasses; i++) + { + A.set(0, i, sprungMassCoordinates[i][d0]); //g0 + A.set(1, i, sprungMassCoordinates[i][d1]); //g1 + A.set(2, i, 1.0f); //g2 + } + for (PxU32 i = numSprungMasses; i < numSprungMasses + 3; i++) + { + A.set(0, i, 0); //g0 independent of lambda0,lambda1,lambda2 + A.set(1, i, 0); //g1 independent of lambda0,lambda1,lambda2 + A.set(2, i, 0); //g2 independent of lambda0,lambda1,lambda2 + } + b[0] = totalMass * (centreOfMass[d0]); //g0 + b[1] = totalMass * (centreOfMass[d1]); //g1 + b[2] = totalMass; //g2 + + //Lagrange terms. + for (PxU32 i = 0; i < numSprungMasses; i++) + { + //Off-diagonal terms from the derivative of f + for (PxU32 j = 0; j < numSprungMasses; j++) + { + A.set(i + 3, j, 0); + } + //Diagonal term from the derivative of f + A.set(i + 3, i, 2.f); + + //Derivative of g + A.set(i + 3, numSprungMasses + 0, sprungMassCoordinates[i][d0]); + A.set(i + 3, numSprungMasses + 1, sprungMassCoordinates[i][d1]); + A.set(i + 3, numSprungMasses + 2, 1.0f); + + //rhs. + b[i + 3] = 2 * mbar; + } + + //Solve Ax=b + PxVehicleVectorN result(numSprungMasses + 3); + PxVehicleMatrixNNLUSolver solver; + solver.decomposeLU(A); + solver.solve(b, result); + if (PxAbs(solver.getDet()) <= DETERMINANT_THRESHOLD) + return false; + for (PxU32 i = 0; i < numSprungMasses; i++) + { + sprungMasses[i] = result[i]; + } + } + + return true; + } +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireFunctions.cpp new file mode 100644 index 0000000..f2a5ae3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireFunctions.cpp @@ -0,0 +1,725 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/drivetrain/PxVehicleDrivetrainStates.h" + +#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h" + +#include "vehicle2/roadGeometry/PxVehicleRoadGeometryState.h" + +#include "vehicle2/suspension/PxVehicleSuspensionHelpers.h" + +#include "vehicle2/tire/PxVehicleTireFunctions.h" +#include "vehicle2/tire/PxVehicleTireParams.h" + +#include "vehicle2/wheel/PxVehicleWheelHelpers.h" + +namespace physx +{ +namespace vehicle2 +{ + +PX_FORCE_INLINE PxF32 computeFilteredNormalisedTireLoad +(const PxF32 xmin, const PxF32 ymin, const PxF32 xmax, const PxF32 ymax, const PxF32 x) +{ + if (x <= xmin) + { + return ymin; + } + else if (x >= xmax) + { + return ymax; + } + else + { + return (ymin + (x - xmin)*(ymax - ymin)/ (xmax - xmin)); + } +} + +void PxVehicleTireDirsLegacyUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& rdGeomState, const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& trSlipDirs) +{ + trSlipDirs.setToDefault(); + + //If there are no hits we'll have no ground plane. + if (!rdGeomState.hitState) + return; + + + //Compute wheel orientation with zero compliance, zero steer and zero + //rotation. Ignore rotation because it plays no role due to radial + //symmetry of wheel. Steer will be applied to the pose so we can + //ignore when computing the orientation. Compliance ought to be applied but + //we're not doing this in legacy code. + const PxQuat wheelOrientation = PxVehicleComputeWheelOrientation(frame, suspParams, 0.0f, 0.0f, 0.0f, + rigidBodyState.pose.q, 0.0f); + + //We need lateral dir and hit norm to project wheel into ground plane. + const PxVec3 latDir = wheelOrientation.rotate(frame.getLatAxis()); + const PxVec3& hitNorm = rdGeomState.plane.n; + + //Compute the tire axes in the ground plane. + PxVec3 tLongRaw = latDir.cross(hitNorm); + PxVec3 tLatRaw = hitNorm.cross(tLongRaw); + tLongRaw.normalize(); + tLatRaw.normalize(); + + //Rotate the tire using the steer angle. + const PxF32 yawAngle = steerAngle; + const PxF32 cosWheelSteer = PxCos(yawAngle); + const PxF32 sinWheelSteer = PxSin(yawAngle); + const PxVec3 tLong = tLongRaw * cosWheelSteer + tLatRaw * sinWheelSteer; + const PxVec3 tLat = tLatRaw * cosWheelSteer - tLongRaw * sinWheelSteer; + + trSlipDirs.directions[PxVehicleTireDirectionModes::eLATERAL] = tLat; + trSlipDirs.directions[PxVehicleTireDirectionModes::eLONGITUDINAL] = tLong; +} + +void PxVehicleTireDirsUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& rdGeomState, const PxVehicleSuspensionComplianceState& compState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireDirectionState& trSlipDirs) +{ + trSlipDirs.setToDefault(); + + //If there are no hits we'll have no ground plane. + if (!rdGeomState.hitState) + return; + + //Compute the wheel quaternion in the world frame. + //Ignore rotation because it plays no role due to radial symmetry of wheel. + const PxQuat wheelOrientation = PxVehicleComputeWheelOrientation(frame, suspParams, compState.camber, compState.toe, steerAngle, + rigidBodyState.pose.q, 0.0f); + + //We need lateral dir and hit norm to project wheel into ground plane. + const PxVec3 latDir = wheelOrientation.rotate(frame.getLatAxis()); + const PxVec3& hitNorm = rdGeomState.plane.n; + + //Compute the tire axes in the ground plane. + PxVec3 lng = latDir.cross(hitNorm); + PxVec3 lat = hitNorm.cross(lng); + lng.normalize(); + lat.normalize(); + + //Set the direction vectors. + trSlipDirs.directions[PxVehicleTireDirectionModes::eLATERAL] = lat; + trSlipDirs.directions[PxVehicleTireDirectionModes::eLONGITUDINAL] = lng; +} + +PX_FORCE_INLINE PxF32 computeLateralSlip +(const PxF32 lngSpeed, const PxF32 latSpeed, const PxF32 minLatSlipDenominator) +{ + const PxF32 latSlip = PxAtan(latSpeed / (PxAbs(lngSpeed) + minLatSlipDenominator)); + return latSlip; +} + +PX_FORCE_INLINE PxF32 computeLongitudionalSlip +(const bool useLegacyLongSlipCalculation, + const PxF32 longSpeed, + const PxF32 wheelOmega, const PxF32 wheelRadius, + const PxF32 minPassiveLongSlipDenominator, const PxF32 minActiveLongSlipDenominator, + const bool isAccelApplied, const bool isBrakeApplied) +{ + const PxF32 longSpeedAbs = PxAbs(longSpeed); + const PxF32 wheelSpeed = wheelOmega * wheelRadius; + const PxF32 wheelSpeedAbs = PxAbs(wheelSpeed); + + PxF32 lngSlip = 0.0f; + + //If nothing is moving just avoid a divide by zero and set the long slip to zero. + if (longSpeed == 0 && wheelOmega == 0) + { + lngSlip = 0.0f; + } + else + { + if (isBrakeApplied || isAccelApplied) + { + //Wheel experiencing an applied torque. + //Use the raw denominator value plus an offset to avoid anything approaching a divide by zero. + //When accelerating from rest the small denominator will generate really quite large + //slip values, which will, in turn, generate large longitudinal forces. With large + //time-steps this might lead to a temporary oscillation in longSlip direction and an + //oscillation in wheel speed direction. The amplitude of the oscillation should be low + //unless the timestep is really large. + //There's not really an obvious solution to this without setting the denominator offset higher + //(or decreasing the timestep). Setting the denominator higher affects handling everywhere so + //settling for a potential temporary oscillation is probably the least worst compromise. + if (useLegacyLongSlipCalculation) + { + lngSlip = (wheelSpeed - longSpeed) / (PxMax(longSpeedAbs, wheelSpeedAbs) + minActiveLongSlipDenominator); + } + else + { + lngSlip = (wheelSpeed - longSpeed) / (longSpeedAbs + minActiveLongSlipDenominator); + } + } + else + { + //Wheel not experiencing an applied torque. + //If the denominator becomes too small then the longSlip becomes large and the longitudinal force + //can overshoot zero at large timesteps. This can be really noticeable so it's harder to justify + //not taking action. Further, the car isn't being actually driven so there is a strong case to fiddle + //with the denominator because it doesn't really affect active handling. + //Don't let the denominator fall below a user-specified value. This can be tuned upwards until the + //oscillation in the sign of longSlip disappears. + if (useLegacyLongSlipCalculation) + { + lngSlip = (wheelSpeed - longSpeed) / (PxMax(minPassiveLongSlipDenominator, PxMax(longSpeedAbs, wheelSpeedAbs))); + } + else + { + lngSlip = (wheelSpeed - longSpeed) / (longSpeedAbs + minPassiveLongSlipDenominator); + } + } + } + return lngSlip; +} + +void PxVehicleTireSlipSpeedsUpdate +(const PxVehicleWheelParams& whlParams, const PxVehicleSuspensionParams& suspParams, + const PxF32 steerAngle, const PxVehicleSuspensionState& suspStates, const PxVehicleTireDirectionState& trSlipDirs, + const PxVehicleRigidBodyState& rigidBodyState, const PxVehicleRoadGeometryState& roadGeometryState, + const PxVehicleFrame& frame, + PxVehicleTireSpeedState& trSpeedState) +{ + trSpeedState.setToDefault(); + + //Compute the position of the bottom of the wheel (placed on the ground plane). + PxVec3 wheelBottomPos; + { + PxVec3 v,w; + PxF32 dist; + PxVehicleComputeSuspensionRaycast(frame, whlParams, suspParams, steerAngle, rigidBodyState.pose, v, w, dist); + wheelBottomPos = v + w*(dist - suspStates.jounce); + } + + //Compute the rigid body velocity at the bottom of the wheel (placed on the ground plane). + PxVec3 wheelBottomVel; + { + const PxVec3 r = wheelBottomPos - rigidBodyState.pose.p; + wheelBottomVel = rigidBodyState.linearVelocity + rigidBodyState.angularVelocity.cross(r) - roadGeometryState.velocity; + } + + //Comput the velocities along lateral and longitudinal tire directions. + trSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL] = wheelBottomVel.dot(trSlipDirs.directions[PxVehicleTireDirectionModes::eLONGITUDINAL]); + trSpeedState.speedStates[PxVehicleTireDirectionModes::eLATERAL] = wheelBottomVel.dot(trSlipDirs.directions[PxVehicleTireDirectionModes::eLATERAL]); +} + + +void vehicleTireSlipsUpdate +(const PxVehicleWheelParams& whlParams, + const PxVehicleTireSlipParams& trSlipParams, const bool useLegacyLongSlipCalculation, + const PxVehicleWheelActuationState& actState, PxVehicleTireSpeedState& trSpeedState, const PxVehicleWheelRigidBody1dState& whlRigidBody1dState, + PxVehicleTireSlipState& trSlipState) +{ + trSlipState.setToDefault(); + + PxF32 latSlip = 0.0f; + { + const PxF32 lngSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL]; + const PxF32 latSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLATERAL]; + const PxF32 minLatSlipDenominator = trSlipParams.minLatSlipDenominator; + latSlip = computeLateralSlip(lngSpeed, latSpeed, minLatSlipDenominator); + } + + PxF32 lngSlip = 0.0f; + { + const PxF32 lngSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL]; + const PxF32 wheelRotSpeed = whlRigidBody1dState.rotationSpeed; + const PxF32 wheelRadius = whlParams.radius; + const PxF32 minPassiveLngSlipDenominator = trSlipParams.minPassiveLongSlipDenominator; + const PxF32 minActiveLngSlipDenominator = trSlipParams.minActiveLongSlipDenominator; + const bool isBrakeApplied = actState.isBrakeApplied; + const bool isAccelApplied = actState.isDriveApplied; + lngSlip = computeLongitudionalSlip( + useLegacyLongSlipCalculation, + lngSpeed, wheelRotSpeed, wheelRadius, + minPassiveLngSlipDenominator, minActiveLngSlipDenominator, + isAccelApplied, isBrakeApplied); + } + + trSlipState.slips[PxVehicleTireDirectionModes::eLATERAL] = latSlip; + trSlipState.slips[PxVehicleTireDirectionModes::eLONGITUDINAL] = lngSlip; +} + +void PxVehicleTireSlipsUpdate +(const PxVehicleWheelParams& whlParams, + const PxVehicleTireSlipParams& trSlipParams, + const PxVehicleWheelActuationState& actState, PxVehicleTireSpeedState& trSpeedState, const PxVehicleWheelRigidBody1dState& whlRigidBody1dState, + PxVehicleTireSlipState& trSlipState) +{ + vehicleTireSlipsUpdate( + whlParams, trSlipParams, false, + actState, trSpeedState, whlRigidBody1dState, + trSlipState); +} + +void PxVehicleTireSlipsLegacyUpdate +(const PxVehicleWheelParams& whlParams, + const PxVehicleTireSlipParams& trSlipParams, + const PxVehicleWheelActuationState& actState, PxVehicleTireSpeedState& trSpeedState, const PxVehicleWheelRigidBody1dState& whlRigidBody1dState, + PxVehicleTireSlipState& trSlipState) +{ + vehicleTireSlipsUpdate( + whlParams, trSlipParams, true, + actState, trSpeedState, whlRigidBody1dState, + trSlipState); + +} + +void PxVehicleTireCamberAnglesUpdate +(const PxVehicleSuspensionParams& suspParams, + const PxReal steerAngle, const PxVehicleRoadGeometryState& rdGeomState, const PxVehicleSuspensionComplianceState& compState, + const PxVehicleRigidBodyState& rigidBodyState, + const PxVehicleFrame& frame, + PxVehicleTireCamberAngleState& trCamberAngleState) +{ + trCamberAngleState.setToDefault(); + + //If there are no hits then carry on with zero camber. + if (!rdGeomState.hitState) + return; + + //Compute the wheel quaternion in the world frame. + //Ignore rotation due to radial symmetry. + const PxQuat wheelOrientation = PxVehicleComputeWheelOrientation(frame, suspParams, compState.camber, compState.toe, steerAngle, + rigidBodyState.pose.q, 0.0f); + + //Compute the axes of the wheel. + const PxVec3 latDir = wheelOrientation.rotate(frame.getLatAxis()); + const PxVec3 lngDir = wheelOrientation.rotate(frame.getLngAxis()); + + //Project normal into lateral/vertical plane. + //Start with: + //n = lat*alpha + lng*beta + vrt*delta + //Want to work out + //T = n - lng*beta + // = n - lng*(n.dot(lng)) + //Don't forget to normalise T. + //For the angle theta to look for we have: + //T.vrtDir = cos(theta) + //However, the cosine destroys the sign of the angle, thus we + //use: + //T.latDir = cos(pi/2 - theta) = sin(theta) (latDir and vrtDir are perpendicular) + const PxVec3& hitNorm = rdGeomState.plane.n; + const PxF32 beta = hitNorm.dot(lngDir); + PxVec3 T = hitNorm - lngDir * beta; + T.normalize(); + const PxF32 sinTheta = T.dot(latDir); + const PxF32 theta = PxAsin(sinTheta); + trCamberAngleState.camberAngle = theta; +} + +PX_FORCE_INLINE PxF32 updateLowLngSpeedTimer +(const PxF32 lngSpeed, const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 lngThresholdSpeed, + const bool isIntentionToAccelerate, const PxF32 dt, const PxF32 lowLngSpeedTime) +{ + //If the tire is rotating slowly and the longitudinal speed is slow then increment the slow longitudinal speed timer. + //If the intention of the driver is to accelerate the vehicle then reset the timer because the intention has been signalled NOT to bring + //the wheel to rest. + PxF32 newLowSpeedTime = 0.0f; + if ((PxAbs(lngSpeed) < lngThresholdSpeed) && (PxAbs(wheelOmega*wheelRadius) < lngThresholdSpeed) && !isIntentionToAccelerate) + { + newLowSpeedTime = lowLngSpeedTime + dt; + } + else + { + newLowSpeedTime = 0; + } + return newLowSpeedTime; +} + +PX_FORCE_INLINE void activateStickyFrictionLngConstraint +(const PxF32 longSpeed, const PxF32 wheelOmega, const PxF32 lowLngSpeedTime, const bool isIntentionToBrake, + const PxF32 thresholdSpeed, const PxF32 thresholdTime, + bool& stickyTireActiveFlag) +{ + //Setup the sticky friction constraint to bring the vehicle to rest at the tire contact point. + //The idea here is to resolve the singularity of the tire long slip at low vz by replacing the long force with a velocity constraint. + //Only do this if we can guarantee that the intention is to bring the car to rest (no accel pedal applied). + //We're going to replace the longitudinal tire force with the sticky friction so set the long slip to zero to ensure zero long force. + //Apply sticky friction to this tire if + //(1) the wheel is locked (this means the brake/handbrake must be on) and the longitudinal speed at the tire contact point is vanishingly small and + // the drive of vehicle has no intention to accelerate the vehicle. + //(2) the accumulated time of low longitudinal speed is greater than a threshold. + stickyTireActiveFlag = false; + if (((PxAbs(longSpeed) < thresholdSpeed) && (0.0f == wheelOmega) && isIntentionToBrake) || (lowLngSpeedTime > thresholdTime)) + { + stickyTireActiveFlag = true; + } +} + +PX_FORCE_INLINE PxF32 updateLowLatSpeedTimer +(const PxF32 latSpeed, const bool isIntentionToAccelerate, const PxF32 timestep, const PxF32 thresholdSpeed, const PxF32 lowSpeedTime) +{ + //If the lateral speed is slow then increment the slow lateral speed timer. + //If the intention of the driver is to accelerate the vehicle then reset the timer because the intention has been signalled NOT to bring + //the wheel to rest. + PxF32 newLowSpeedTime = lowSpeedTime; + if ((PxAbs(latSpeed) < thresholdSpeed) && !isIntentionToAccelerate) + { + newLowSpeedTime += timestep; + } + else + { + newLowSpeedTime = 0; + } + return newLowSpeedTime; +} + +PX_FORCE_INLINE void activateStickyFrictionLatConstraint +(const bool lowSpeedLngTimerActive, + const PxF32 lowLatSpeedTimer, const PxF32 thresholdTime, + bool& stickyTireActiveFlag) +{ + //Setup the sticky friction constraint to bring the vehicle to rest at the tire contact point. + //Only do this if we can guarantee that the intention is to bring the car to rest (no accel pedal applied). + //We're going to replace the lateral tire force with the sticky friction so set the lat slip to zero to ensure zero lat force. + //Apply sticky friction to this tire if + //(1) the low longitudinal speed timer is > 0. + //(2) the accumulated time of low longitudinal speed is greater than a threshold. + stickyTireActiveFlag = false; + if (lowSpeedLngTimerActive && (lowLatSpeedTimer > thresholdTime)) + { + stickyTireActiveFlag = true; + } +} + +void PxVehicleTireStickyStateUpdate +(const PxVehicleAxleDescription& axleDescription, const PxVehicleWheelParams& whlParams, + const PxVehicleTireStickyParams& trStickyParams, + const PxVehicleArrayData& actuationStates, + const PxVehicleTireGripState& trGripState, const PxVehicleTireSpeedState& trSpeedState, const PxVehicleWheelRigidBody1dState& whlState, + const PxReal dt, + PxVehicleTireStickyState& trStickyState) +{ + trStickyState.activeStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] = false; + trStickyState.activeStatus[PxVehicleTireDirectionModes::eLATERAL] = false; + + //Only process sticky state if tire can generate force. + const PxF32 load = trGripState.load; + const PxF32 friction = trGripState.friction; + if(0 == load*friction) + { + trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLONGITUDINAL] = 0.0f; + trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLATERAL] = 0.0f; + return; + } + + //Work out if any wheel is to have a drive applied to it. + bool isIntentionToAccelerate = false; + bool isIntentionToBrake = false; + for(PxU32 i = 0; i < axleDescription.nbWheels; i++) + { + const PxU32 wheelId = axleDescription.wheelIdsInAxleOrder[i]; + if(actuationStates[wheelId].isDriveApplied) + isIntentionToAccelerate = true; + if (actuationStates[wheelId].isBrakeApplied) + isIntentionToBrake = true; + } + + //Long sticky state. + bool lngTimerActive = false; + { + const PxF32 lngSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL]; + const PxF32 wheelOmega = whlState.rotationSpeed; + const PxF32 wheelRadius = whlParams.radius; + const PxF32 lngThresholdSpeed = trStickyParams.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdSpeed; + const PxF32 lngLowSpeedTime = trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLONGITUDINAL]; + + const PxF32 newLowLngSpeedTime = updateLowLngSpeedTimer( + lngSpeed, wheelOmega, wheelRadius, lngThresholdSpeed, + isIntentionToAccelerate, + dt, lngLowSpeedTime); + lngTimerActive = (newLowLngSpeedTime > 0); + + bool lngActiveState = false; + const PxF32 lngThresholdTime = trStickyParams.stickyParams[PxVehicleTireDirectionModes::eLONGITUDINAL].thresholdTime; + activateStickyFrictionLngConstraint( + lngSpeed, wheelOmega, newLowLngSpeedTime, isIntentionToBrake, + lngThresholdSpeed, lngThresholdTime, + lngActiveState); + + trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLONGITUDINAL] = newLowLngSpeedTime; + trStickyState.activeStatus[PxVehicleTireDirectionModes::eLONGITUDINAL] = lngActiveState; + } + + //Lateral sticky state + { + const PxF32 latSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLATERAL]; + const PxF32 latThresholdSpeed = trStickyParams.stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdSpeed; + const PxF32 latLowSpeedTime = trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLATERAL]; + const PxF32 latNewLowSpeedTime = updateLowLatSpeedTimer(latSpeed, isIntentionToAccelerate, dt, latThresholdSpeed, latLowSpeedTime); + + bool latActiveState = false; + const PxF32 latThresholdTime = trStickyParams.stickyParams[PxVehicleTireDirectionModes::eLATERAL].thresholdTime; + activateStickyFrictionLatConstraint(lngTimerActive, latNewLowSpeedTime, latThresholdTime, + latActiveState); + + trStickyState.lowSpeedTime[PxVehicleTireDirectionModes::eLATERAL] = latNewLowSpeedTime; + trStickyState.activeStatus[PxVehicleTireDirectionModes::eLATERAL] = latActiveState; + } +} + +PX_FORCE_INLINE PxF32 computeTireLoad +(const PxVehicleTireForceParams& trForceParams, const PxVehicleSuspensionForce& suspForce) +{ + //Compute the normalised load. + const PxF32 rawLoad = suspForce.normalForce; + const PxF32 restLoad = trForceParams.restLoad; + const PxF32 normalisedLoad = rawLoad / restLoad; + + //Get the load filter params. + const PxF32 minNormalisedLoad = trForceParams.loadFilter[0][0]; + const PxF32 minFilteredNormalisedLoad = trForceParams.loadFilter[0][1]; + const PxF32 maxNormalisedLoad = trForceParams.loadFilter[1][0]; + const PxF32 maxFilteredNormalisedLoad = trForceParams.loadFilter[1][1]; + + //Compute the filtered load. + const PxF32 filteredNormalisedLoad = computeFilteredNormalisedTireLoad(minNormalisedLoad, minFilteredNormalisedLoad, maxNormalisedLoad, maxFilteredNormalisedLoad, normalisedLoad); + const PxF32 filteredLoad = restLoad * filteredNormalisedLoad; + + //Set the load after applying the filter. + return filteredLoad; +} + +PX_FORCE_INLINE PxF32 computeTireFriction +(const PxVehicleTireForceParams& trForceParams, + const PxVehicleRoadGeometryState& rdGeomState, const PxVehicleTireSlipState& tireSlipState) +{ + //Interpolate the friction using the long slip value. + const PxF32 x0 = trForceParams.frictionVsSlip[0][0]; + const PxF32 y0 = trForceParams.frictionVsSlip[0][1]; + const PxF32 x1 = trForceParams.frictionVsSlip[1][0]; + const PxF32 y1 = trForceParams.frictionVsSlip[1][1]; + const PxF32 x2 = trForceParams.frictionVsSlip[2][0]; + const PxF32 y2 = trForceParams.frictionVsSlip[2][1]; + const PxF32 longSlipAbs = PxAbs(tireSlipState.slips[PxVehicleTireDirectionModes::eLONGITUDINAL]); + PxF32 mu; + if (longSlipAbs < x1) + { + mu = y0 + (y1 - y0)*(longSlipAbs - x0) / (x1 - x0); + } + else if (longSlipAbs < x2) + { + mu = y1 + (y2 - y1)*(longSlipAbs - x1) / (x2 - x1); + } + else + { + mu = y2; + } + PX_ASSERT(mu >= 0); + + const PxF32 tireFriction = rdGeomState.friction*mu; + return tireFriction; +} + +void PxVehicleTireGripUpdate +(const PxVehicleTireForceParams& trForceParams, + const PxVehicleRoadGeometryState& rdGeomState, const PxVehicleSuspensionState& suspState, const PxVehicleSuspensionForce& suspForce, + const PxVehicleTireSlipState& trSlipState, + PxVehicleTireGripState& trGripState) +{ + trGripState.setToDefault(); + + //If there are no road hits then carry on with zero grip state. + if (!rdGeomState.hitState) + return; + + //If the wheel is not touching the ground then carry on with zero grip state. + if (!PxVehicleIsWheelOnGround(suspState)) + return; + + //Compute load and friction. + trGripState.load = computeTireLoad(trForceParams, suspForce); + trGripState.friction = computeTireFriction(trForceParams, rdGeomState, trSlipState); +} + +void PxVehicleTireSlipsAccountingForStickyStatesUpdate +(const PxVehicleTireStickyState& trStickyState, + PxVehicleTireSlipState& trSlipState) +{ + if(trStickyState.activeStatus[PxVehicleTireDirectionModes::eLATERAL]) + trSlipState.slips[PxVehicleTireDirectionModes::eLATERAL] = 0.f; + if (trStickyState.activeStatus[PxVehicleTireDirectionModes::eLONGITUDINAL]) + trSlipState.slips[PxVehicleTireDirectionModes::eLONGITUDINAL] = 0.f; +} + + +//////////////////////////////////////////////////////////////////////////// +//Default tire force shader function. +//Taken from Michigan tire model. +//Computes tire long and lat forces plus the aligning moment arising from +//the lat force and the torque to apply back to the wheel arising from the +//long force (application of Newton's 3rd law). +//////////////////////////////////////////////////////////////////////////// + + +#define ONE_TWENTYSEVENTH 0.037037f +#define ONE_THIRD 0.33333f +PX_FORCE_INLINE PxF32 smoothingFunction1(const PxF32 K) +{ + //Equation 20 in CarSimEd manual Appendix F. + //Looks a bit like a curve of sqrt(x) for 0= 0.0f); + return PxMin(1.0f, K - ONE_THIRD * K*K + ONE_TWENTYSEVENTH * K*K*K); +} +PX_FORCE_INLINE PxF32 smoothingFunction2(const PxF32 K) +{ + //Equation 21 in CarSimEd manual Appendix F. + //Rises to a peak at K=0.75 and falls back to zero by K=3 + PX_ASSERT(K >= 0.0f); + return (K - K * K + ONE_THIRD * K*K*K - ONE_TWENTYSEVENTH * K*K*K*K); +} + +void computeTireForceMichiganModel +(const PxVehicleTireForceParams& tireData, + const PxF32 tireFriction, + const PxF32 longSlipUnClamped, const PxF32 latSlipUnClamped, const PxF32 camberUnclamped, + const PxF32 wheelRadius, + const PxF32 tireLoad, + PxF32& wheelTorque, PxF32& tireLongForceMag, PxF32& tireLatForceMag, PxF32& tireAlignMoment) +{ + PX_ASSERT(tireFriction > 0); + PX_ASSERT(tireLoad > 0); + + wheelTorque = 0.0f; + tireLongForceMag = 0.0f; + tireLatForceMag = 0.0f; + tireAlignMoment = 0.0f; + + //Clamp the slips to a minimum value. + const PxF32 minimumSlipThreshold = 1e-5f; + const PxF32 latSlip = PxAbs(latSlipUnClamped) >= minimumSlipThreshold ? latSlipUnClamped : 0.0f; + const PxF32 longSlip = PxAbs(longSlipUnClamped) >= minimumSlipThreshold ? longSlipUnClamped : 0.0f; + const PxF32 camber = PxAbs(camberUnclamped) >= minimumSlipThreshold ? camberUnclamped : 0.0f; + + //Normalise the tire load. + const PxF32 restTireLoad = tireData.restLoad; + const PxF32 normalisedTireLoad = tireLoad/ restTireLoad; + + //Compute the lateral stiffness + const PxF32 latStiff = (0.0f == tireData.latStiffX) ? tireData.latStiffY : tireData.latStiffY*smoothingFunction1(normalisedTireLoad*3.0f / tireData.latStiffX); + + //Get the longitudinal stiffness + const PxF32 longStiff = tireData.longStiff; + + //Get the camber stiffness. + const PxF32 camberStiff = tireData.camberStiff; + + //If long slip/lat slip/camber are all zero than there will be zero tire force. + if ((0 == latSlip*latStiff) && (0 == longSlip*longStiff) && (0 == camber*camberStiff)) + { + return; + } + + //Carry on and compute the forces. + const PxF32 TEff = PxTan(latSlip + (camber * camberStiff / latStiff)); // "+" because we define camber stiffness as a positive value + const PxF32 K = PxSqrt(latStiff*TEff*latStiff*TEff + longStiff * longSlip*longStiff*longSlip) / (tireFriction*tireLoad); + //const PxF32 KAbs=PxAbs(K); + PxF32 FBar = smoothingFunction1(K);//K - ONE_THIRD*PxAbs(K)*K + ONE_TWENTYSEVENTH*K*K*K; + PxF32 MBar = smoothingFunction2(K); //K - KAbs*K + ONE_THIRD*K*K*K - ONE_TWENTYSEVENTH*KAbs*K*K*K; + //Mbar = PxMin(Mbar, 1.0f); + PxF32 nu = 1; + if (K <= 2.0f*PxPi) + { + const PxF32 latOverlLong = latStiff/longStiff; + nu = 0.5f*(1.0f + latOverlLong - (1.0f - latOverlLong)*PxCos(K*0.5f)); + } + const PxF32 FZero = tireFriction * tireLoad / (PxSqrt(longSlip*longSlip + nu * TEff*nu*TEff)); + const PxF32 fz = longSlip * FBar*FZero; + const PxF32 fx = -nu * TEff*FBar*FZero; + //TODO: pneumatic trail. + const PxF32 pneumaticTrail = 1.0f; + const PxF32 fMy = nu * pneumaticTrail * TEff * MBar * FZero; + + //We can add the torque to the wheel. + wheelTorque = -fz * wheelRadius; + tireLongForceMag = fz; + tireLatForceMag = fx; + tireAlignMoment = fMy; +} + +void PxVehicleTireForcesUpdate +(const PxVehicleWheelParams& whlParams, const PxVehicleSuspensionParams& suspParams, + const PxVehicleTireForceParams& trForceParams, + const PxVehicleSuspensionComplianceState& compState, + const PxVehicleTireGripState& trGripState, const PxVehicleTireDirectionState& trDirectionState, + const PxVehicleTireSlipState& trSlipState, const PxVehicleTireCamberAngleState& cmbAngleState, + const PxVehicleRigidBodyState& rigidBodyState, + PxVehicleTireForce& trForce) +{ + trForce.setToDefault(); + + //If the tire can generate no force then carry on with zero force. + if(0 == trGripState.friction*trGripState.load) + return; + + PxF32 wheelTorque = 0; + PxF32 tireLongForceMag = 0; + PxF32 tireLatForceMag = 0; + PxF32 tireAlignMoment = 0; + + const PxF32 friction = trGripState.friction; + const PxF32 tireLoad = trGripState.load; + const PxF32 lngSlip = trSlipState.slips[PxVehicleTireDirectionModes::eLONGITUDINAL]; + const PxF32 latSlip = trSlipState.slips[PxVehicleTireDirectionModes::eLATERAL]; + const PxF32 camber = cmbAngleState.camberAngle; + const PxF32 wheelRadius = whlParams.radius; + computeTireForceMichiganModel(trForceParams, friction, lngSlip, latSlip, camber, wheelRadius, tireLoad, + wheelTorque, tireLongForceMag, tireLatForceMag, tireAlignMoment); + + //Compute the forces. + const PxVec3 tireLongForce = trDirectionState.directions[PxVehicleTireDirectionModes::eLONGITUDINAL]*tireLongForceMag; + const PxVec3 tireLatForce = trDirectionState.directions[PxVehicleTireDirectionModes::eLATERAL]*tireLatForceMag; + + //Compute the torques. + const PxVec3 r = rigidBodyState.pose.rotate(suspParams.suspensionAttachment.transform(compState.tireForceAppPoint)); + const PxVec3 tireLongTorque = r.cross(tireLongForce); + const PxVec3 tireLatTorque = r.cross(tireLatForce); + + //Set the torques. + trForce.forces[PxVehicleTireDirectionModes::eLONGITUDINAL] = tireLongForce; + trForce.torques[PxVehicleTireDirectionModes::eLONGITUDINAL] = tireLongTorque; + trForce.forces[PxVehicleTireDirectionModes::eLATERAL] = tireLatForce; + trForce.torques[PxVehicleTireDirectionModes::eLATERAL] = tireLatTorque; + trForce.aligningMoment = tireAlignMoment; + trForce.wheelTorque = wheelTorque; +} + +} //namespace vehicle2 +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireHelpers.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireHelpers.cpp new file mode 100644 index 0000000..3f77183 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/tire/VhTireHelpers.cpp @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/tire/PxVehicleTireHelpers.h" + +namespace physx +{ +namespace vehicle2 +{ + +bool PxVehicleAccelerationIntentCompute +(const PxVehicleAxleDescription& driveVehicleAxleDesc, const PxVehicleArrayData& driveVehicleActuationStates) +{ + bool isIntentionToAccelerate = false; + for (PxU32 i = 0; i < driveVehicleAxleDesc.nbWheels; i++) + { + const PxU32 wheelId = driveVehicleAxleDesc.wheelIdsInAxleOrder[i]; + isIntentionToAccelerate = !isIntentionToAccelerate ? driveVehicleActuationStates[wheelId].isDriveApplied : isIntentionToAccelerate; + } + return isIntentionToAccelerate; +} + +void PxVehicleTireStickyStateReset +(const bool intentionToAccelerate, + const PxVehicleAxleDescription& towedVehicleAxleDesc, + PxVehicleArrayData& towedVehicleStickyState) +{ + if (!intentionToAccelerate) + return; + + for (PxU32 i = 0; i < towedVehicleAxleDesc.nbWheels; i++) + { + const PxU32 wheelId = towedVehicleAxleDesc.wheelIdsInAxleOrder[i]; + towedVehicleStickyState[wheelId].setToDefault(); + } +} + +} //namespace vehicle2 +} //namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/wheel/VhWheelFunctions.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/wheel/VhWheelFunctions.cpp new file mode 100644 index 0000000..651f3d1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/physxvehicle2/src/wheel/VhWheelFunctions.cpp @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "vehicle2/PxVehicleParams.h" + +#include "vehicle2/suspension/PxVehicleSuspensionStates.h" + +#include "vehicle2/tire/PxVehicleTireStates.h" + +#include "vehicle2/wheel/PxVehicleWheelFunctions.h" +#include "vehicle2/wheel/PxVehicleWheelStates.h" +#include "vehicle2/wheel/PxVehicleWheelParams.h" + +namespace physx +{ +namespace vehicle2 +{ + +void PxVehicleWheelRotationAngleUpdate +(const PxVehicleWheelParams& whlParams, + const PxVehicleWheelActuationState& actState, const PxVehicleSuspensionState& suspState, const PxVehicleTireSpeedState& trSpeedState, + const PxReal thresholdForwardSpeedForWheelAngleIntegration, const PxReal dt, + PxVehicleWheelRigidBody1dState& whlRigidBody1dState) +{ + //At low vehicle forward speeds we have some numerical difficulties getting the + //wheel rotation speeds to be correct due to the tire model's difficulties at low vz. + //The solution is to blend between the rolling speed at the wheel and the wheel's actual rotation speed. + //If the wheel is + //(i) in the air or, + //(ii) under braking torque or, + //(iii) driven by a drive torque + //then always use the wheel's actual rotation speed. + //Just to be clear, this means we will blend when the wheel + //(i) is on the ground and + //(ii) has no brake applied and + //(iii) has no drive torque and + //(iv) is at low forward speed + const PxF32 jounce = suspState.jounce; + const bool isBrakeApplied = actState.isBrakeApplied; + const bool isDriveApplied = actState.isDriveApplied; + const PxF32 lngSpeed = trSpeedState.speedStates[PxVehicleTireDirectionModes::eLONGITUDINAL]; + PxF32 wheelOmega = whlRigidBody1dState.rotationSpeed; + if (jounce > 0 && //(i) wheel touching ground + !isBrakeApplied && //(ii) no brake applied + !isDriveApplied && //(iii) no drive torque applied + PxAbs(lngSpeed < thresholdForwardSpeedForWheelAngleIntegration)) //(iv) low speed + { + const PxF32 wheelRadius = whlParams.radius; + const PxF32 alpha = PxAbs(lngSpeed) / thresholdForwardSpeedForWheelAngleIntegration; + wheelOmega = (lngSpeed/wheelRadius)*(1.0f - alpha) + wheelOmega * alpha; + } + + whlRigidBody1dState.correctedRotationSpeed = wheelOmega; + + //Integrate angle. + PxF32 newRotAngle = whlRigidBody1dState.rotationAngle + wheelOmega * dt; + + //Clamp in range (-2*Pi,2*Pi) + newRotAngle = newRotAngle - (PxI32(newRotAngle / PxTwoPi) * PxTwoPi); + + //Set the angle. + whlRigidBody1dState.rotationAngle = newRotAngle; +} + +} //namespace vehicle2 +} //namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PsPvd.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PsPvd.h new file mode 100644 index 0000000..6f2a050 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PsPvd.h @@ -0,0 +1,83 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PS_PVD_H +#define PS_PVD_H + +/** \addtogroup pvd +@{ +*/ +#include "pvd/PxPvd.h" +#include "foundation/PxBroadcast.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPvdTransport; + +#if !PX_DOXYGEN +namespace pvdsdk +{ +#endif + +class PvdDataStream; +class PvdClient; +class PvdOMMetaDataProvider; + +// PsPvd is used for advanced user, it support custom pvd client API +class PsPvd : public physx::PxPvd, public PxAllocationListener +{ + public: + virtual void addClient(PvdClient* client) = 0; + virtual void removeClient(PvdClient* client) = 0; + + virtual bool registerObject(const void* inItem) = 0; + virtual bool unRegisterObject(const void* inItem) = 0; + + //AllocationListener + void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory) = 0; + void onDeallocation(void* addr) = 0; + + virtual PvdOMMetaDataProvider& getMetaDataProvider() = 0; + + virtual uint64_t getNextStreamId() = 0; + // Call to flush events to PVD + virtual void flush() = 0; + +}; + +#if !PX_DOXYGEN +} // namespace pvdsdk +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxProfileAllocatorWrapper.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxProfileAllocatorWrapper.h new file mode 100644 index 0000000..e26181b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxProfileAllocatorWrapper.h @@ -0,0 +1,229 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_ALLOCATOR_WRAPPER_H +#define PX_PROFILE_ALLOCATOR_WRAPPER_H + +#include "foundation/PxPreprocessor.h" +#include "foundation/PxAllocatorCallback.h" +#include "foundation/PxErrorCallback.h" +#include "foundation/PxAssert.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" + +namespace physx { namespace profile { + + /** + \brief Helper struct to encapsulate the user allocator callback + Useful for array and hash templates + */ + struct PxProfileAllocatorWrapper + { + PxAllocatorCallback* mUserAllocator; + + PxProfileAllocatorWrapper( PxAllocatorCallback& inUserAllocator ) + : mUserAllocator( &inUserAllocator ) + { + } + + PxProfileAllocatorWrapper( PxAllocatorCallback* inUserAllocator ) + : mUserAllocator( inUserAllocator ) + { + } + + PxAllocatorCallback& getAllocator() const + { + PX_ASSERT( NULL != mUserAllocator ); + return *mUserAllocator; + } + }; + + /** + \brief Helper class to encapsulate the reflection allocator + */ + template + class PxProfileWrapperReflectionAllocator + { + static const char* getName() + { +#if PX_LINUX || PX_OSX || PX_EMSCRIPTEN || PX_SWITCH + return __PRETTY_FUNCTION__; +#else + return typeid(T).name(); +#endif + } + PxProfileAllocatorWrapper* mWrapper; + + public: + PxProfileWrapperReflectionAllocator(PxProfileAllocatorWrapper& inWrapper) : mWrapper( &inWrapper ) {} + PxProfileWrapperReflectionAllocator( const PxProfileWrapperReflectionAllocator& inOther ) + : mWrapper( inOther.mWrapper ) + { + } + PxProfileWrapperReflectionAllocator& operator=( const PxProfileWrapperReflectionAllocator& inOther ) + { + mWrapper = inOther.mWrapper; + return *this; + } + PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); } + void* allocate(size_t size, const char* filename, int line) + { +#if PX_CHECKED // checked and debug builds + if(!size) + return 0; + return getAllocator().allocate(size, getName(), filename, line); +#else + return getAllocator().allocate(size, "", filename, line); +#endif + } + void deallocate(void* ptr) + { + if(ptr) + getAllocator().deallocate(ptr); + } + }; + + /** + \brief Helper class to encapsulate the named allocator + */ + struct PxProfileWrapperNamedAllocator + { + PxProfileAllocatorWrapper* mWrapper; + const char* mAllocationName; + PxProfileWrapperNamedAllocator(PxProfileAllocatorWrapper& inWrapper, const char* inAllocationName) + : mWrapper( &inWrapper ) + , mAllocationName( inAllocationName ) + {} + PxProfileWrapperNamedAllocator( const PxProfileWrapperNamedAllocator& inOther ) + : mWrapper( inOther.mWrapper ) + , mAllocationName( inOther.mAllocationName ) + { + } + PxProfileWrapperNamedAllocator& operator=( const PxProfileWrapperNamedAllocator& inOther ) + { + mWrapper = inOther.mWrapper; + mAllocationName = inOther.mAllocationName; + return *this; + } + PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); } + void* allocate(size_t size, const char* filename, int line) + { + if(!size) + return 0; + return getAllocator().allocate(size, mAllocationName, filename, line); + } + void deallocate(void* ptr) + { + if(ptr) + getAllocator().deallocate(ptr); + } + }; + + /** + \brief Helper struct to encapsulate the array + */ + template + struct PxProfileArray : public PxArray > + { + typedef PxProfileWrapperReflectionAllocator TAllocatorType; + + PxProfileArray( PxProfileAllocatorWrapper& inWrapper ) + : PxArray( TAllocatorType( inWrapper ) ) + { + } + + PxProfileArray( const PxProfileArray< T >& inOther ) + : PxArray( inOther, inOther ) + { + } + }; + + /** + \brief Helper struct to encapsulate the array + */ + template > + struct PxProfileHashMap : public PxHashMap > + { + typedef PxHashMap > THashMapType; + typedef PxProfileWrapperReflectionAllocator TAllocatorType; + PxProfileHashMap( PxProfileAllocatorWrapper& inWrapper ) + : THashMapType( TAllocatorType( inWrapper ) ) + { + } + }; + + /** + \brief Helper function to encapsulate the profile allocation + */ + template + inline TDataType* PxProfileAllocate( PxAllocatorCallback* inAllocator, const char* file, int inLine ) + { + PxProfileAllocatorWrapper wrapper( inAllocator ); + typedef PxProfileWrapperReflectionAllocator< TDataType > TAllocator; + TAllocator theAllocator( wrapper ); + return reinterpret_cast( theAllocator.allocate( sizeof( TDataType ), file, inLine ) ); + } + + /** + \brief Helper function to encapsulate the profile allocation + */ + template + inline TDataType* PxProfileAllocate( PxAllocatorCallback& inAllocator, const char* file, int inLine ) + { + return PxProfileAllocate( &inAllocator, file, inLine ); + } + + /** + \brief Helper function to encapsulate the profile deallocation + */ + template + inline void PxProfileDeleteAndDeallocate( PxProfileAllocatorWrapper& inAllocator, TDataType* inDType ) + { + PX_ASSERT(inDType); + PxAllocatorCallback& allocator( inAllocator.getAllocator() ); + inDType->~TDataType(); + allocator.deallocate( inDType ); + } + + /** + \brief Helper function to encapsulate the profile deallocation + */ + template + inline void PxProfileDeleteAndDeallocate( PxAllocatorCallback& inAllocator, TDataType* inDType ) + { + PxProfileAllocatorWrapper wrapper( &inAllocator ); + PxProfileDeleteAndDeallocate( wrapper, inDType ); + } + +} } + +#define PX_PROFILE_NEW( allocator, dtype ) new (physx::profile::PxProfileAllocate( allocator, __FILE__, __LINE__ )) dtype +#define PX_PROFILE_DELETE( allocator, obj ) physx::profile::PxProfileDeleteAndDeallocate( allocator, obj ); + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdClient.h new file mode 100644 index 0000000..e71b124 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdClient.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_CLIENT_H +#define PX_PVD_CLIENT_H + +/** \addtogroup pvd +@{ +*/ +#include "foundation/PxFlags.h" +#include "foundation/PxVec3.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif + +class PvdDataStream; +class PvdUserRenderer; + +/** +\brief PvdClient is the per-client connection to PVD. +It provides callback when PVD is connected/disconnted. +It provides access to the internal object so that advanced users can create extension client. +*/ +class PvdClient +{ + public: + virtual PvdDataStream* getDataStream() = 0; + + virtual bool isConnected() const = 0; + virtual void onPvdConnected() = 0; + virtual void onPvdDisconnected() = 0; + virtual void flush() = 0; + + protected: + virtual ~PvdClient() + { + } +}; + +#if !PX_DOXYGEN +} // namespace pvdsdk +} // namespace physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStream.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStream.h new file mode 100644 index 0000000..2aa4dab --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStream.h @@ -0,0 +1,273 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_DATA_STREAM_H +#define PX_PVD_DATA_STREAM_H + +/** \addtogroup pvd +@{ +*/ +#include "pvd/PxPvd.h" +#include "PxPvdErrorCodes.h" +#include "PxPvdObjectModelBaseTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif + +class PvdPropertyDefinitionHelper; + +class PvdMetaDataStream +{ + protected: + virtual ~PvdMetaDataStream() + { + } + + public: + virtual PvdError createClass(const NamespacedName& nm) = 0; + template + PvdError createClass() + { + return createClass(getPvdNamespacedNameForType()); + } + + virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0; + template + PvdError deriveClass() + { + return deriveClass(getPvdNamespacedNameForType(), getPvdNamespacedNameForType()); + } + + virtual bool isClassExist(const NamespacedName& nm) = 0; + template + bool isClassExist() + { + return isClassExist(getPvdNamespacedNameForType()); + } + + virtual PvdError createProperty(const NamespacedName& clsName, const char* name, const char* semantic, + const NamespacedName& dtypeName, PropertyType::Enum propertyType, + DataRef values = DataRef()) = 0; + template + PvdError createProperty(String name, String semantic = "", PropertyType::Enum propertyType = PropertyType::Scalar, + DataRef values = DataRef()) + { + return createProperty(getPvdNamespacedNameForType(), name, semantic, + getPvdNamespacedNameForType(), propertyType, values); + } + + virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, + DataRef entries, uint32_t messageSizeInBytes) = 0; + + template + PvdError createPropertyMessage(DataRef entries) + { + return createPropertyMessage(getPvdNamespacedNameForType(), getPvdNamespacedNameForType(), + entries, sizeof(TMsgType)); + } +}; + +class PvdInstanceDataStream +{ + protected: + virtual ~PvdInstanceDataStream() + { + } + + public: + virtual PvdError createInstance(const NamespacedName& cls, const void* instance) = 0; + + template + PvdError createInstance(const TDataType* inst) + { + return createInstance(getPvdNamespacedNameForType(), inst); + } + virtual bool isInstanceValid(const void* instance) = 0; + + // If the property will fit or is already completely in memory + virtual PvdError setPropertyValue(const void* instance, String name, DataRef data, + const NamespacedName& incomingTypeName) = 0; + template + PvdError setPropertyValue(const void* instance, String name, const TDataType& value) + { + const uint8_t* dataStart = reinterpret_cast(&value); + return setPropertyValue(instance, name, DataRef(dataStart, dataStart + sizeof(TDataType)), + getPvdNamespacedNameForType()); + } + + template + PvdError setPropertyValue(const void* instance, String name, const TDataType* value, uint32_t numItems) + { + const uint8_t* dataStart = reinterpret_cast(value); + return setPropertyValue(instance, name, + DataRef(dataStart, dataStart + sizeof(TDataType) * numItems), + getPvdNamespacedNameForType()); + } + + // Else if the property is very large (contact reports) you can send it in chunks. + virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) = 0; + + template + PvdError beginSetPropertyValue(const void* instance, String name) + { + return beginSetPropertyValue(instance, name, getPvdNamespacedNameForType()); + } + virtual PvdError appendPropertyValueData(DataRef data) = 0; + + template + PvdError appendPropertyValueData(const TDataType* value, uint32_t numItems) + { + const uint8_t* dataStart = reinterpret_cast(value); + return appendPropertyValueData(DataRef(dataStart, dataStart + numItems * sizeof(TDataType))); + } + + virtual PvdError endSetPropertyValue() = 0; + + // Set a set of properties to various values on an object. + + virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName, + DataRef data) = 0; + + template + PvdError setPropertyMessage(const void* instance, const TDataType& value) + { + const uint8_t* dataStart = reinterpret_cast(&value); + return setPropertyMessage(instance, getPvdNamespacedNameForType(), + DataRef(dataStart, sizeof(TDataType))); + } + // If you need to send of lot of identical messages, this avoids a hashtable lookup per message. + virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) = 0; + + template + PvdError beginPropertyMessageGroup() + { + return beginPropertyMessageGroup(getPvdNamespacedNameForType()); + } + virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef data) = 0; + + template + PvdError sendPropertyMessageFromGroup(const void* instance, const TDataType& value) + { + const uint8_t* dataStart = reinterpret_cast(&value); + return sendPropertyMessageFromGroup(instance, DataRef(dataStart, sizeof(TDataType))); + } + + virtual PvdError endPropertyMessageGroup() = 0; + + // These functions ensure the target array doesn't contain duplicates + virtual PvdError pushBackObjectRef(const void* instId, String propName, const void* objRef) = 0; + virtual PvdError removeObjectRef(const void* instId, String propName, const void* objRef) = 0; + + // Instance elimination. + virtual PvdError destroyInstance(const void* key) = 0; + + // Profiling hooks + virtual PvdError beginSection(const void* instance, String name) = 0; + virtual PvdError endSection(const void* instance, String name) = 0; + + // Origin Shift + virtual PvdError originShift(const void* scene, PxVec3 shift) = 0; + + public: + /*For some cases, pvd command cannot be run immediately. For example, when create joints, while the actors may still + *pending for insert, the joints update commands can be run deffered. + */ + class PvdCommand + { + public: + // Assigned is needed for copying + PvdCommand(const PvdCommand&) + { + } + PvdCommand& operator=(const PvdCommand&) + { + return *this; + } + + public: + PvdCommand() + { + } + virtual ~PvdCommand() + { + } + + // Not pure virtual so can have default PvdCommand obj + virtual bool canRun(PvdInstanceDataStream&) + { + return false; + } + virtual void run(PvdInstanceDataStream&) + { + } + }; + + // PVD SDK provide this helper function to allocate cmd's memory and release them at after flush the command queue + virtual void* allocateMemForCmd(uint32_t length) = 0; + + // PVD will call the destructor of PvdCommand object at the end fo flushPvdCommand + virtual void pushPvdCommand(PvdCommand& cmd) = 0; + virtual void flushPvdCommand() = 0; +}; + +class PvdDataStream : public PvdInstanceDataStream, public PvdMetaDataStream +{ + protected: + virtual ~PvdDataStream() + { + } + + public: + virtual void release() = 0; + virtual bool isConnected() = 0; + + virtual void addProfileZone(void* zone, const char* name) = 0; + virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) = 0; + + virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() = 0; + + virtual void setIsTopLevelUIElement(const void* instance, bool topLevel) = 0; + virtual void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) = 0; + virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0; + +/** + \brief Create a new PvdDataStream. + \param pvd A pointer to a valid PxPvd instance. This must be non-null. +*/ + static PvdDataStream* create(PxPvd* pvd); +}; +#if !PX_DOXYGEN +} // pvdsdk +} // physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStreamHelpers.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStreamHelpers.h new file mode 100644 index 0000000..b11ac32 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdDataStreamHelpers.h @@ -0,0 +1,121 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_DATA_STREAM_HELPERS_H +#define PX_PVD_DATA_STREAM_HELPERS_H + +/** \addtogroup pvd +@{ +*/ +#include "PxPvdObjectModelBaseTypes.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif + +class PvdPropertyDefinitionHelper +{ + protected: + virtual ~PvdPropertyDefinitionHelper() + { + } + + public: + /** + Push a name c such that it appends such as a.b.c. + */ + virtual void pushName(const char* inName, const char* inAppendStr = ".") = 0; + /** + Push a name c such that it appends like a.b[c] + */ + virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") = 0; + /** + * Pop the current name + */ + virtual void popName() = 0; + + virtual void clearNameStack() = 0; + /** + * Get the current name at the top of the name stack. + * Would return "a.b.c" or "a.b[c]" in the above examples. + */ + virtual const char* getTopName() = 0; + + virtual void addNamedValue(const char* name, uint32_t value) = 0; + virtual void clearNamedValues() = 0; + virtual DataRef getNamedValues() = 0; + + /** + * Define a property using the top of the name stack and the passed-in semantic + */ + virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName, + PropertyType::Enum propType = PropertyType::Scalar) = 0; + + template + void createProperty(const char* inSemantic = "", PropertyType::Enum propType = PropertyType::Scalar) + { + createProperty(getPvdNamespacedNameForType(), inSemantic, getPvdNamespacedNameForType(), + propType); + } + + // The datatype used for instances needs to be pointer unless you actually have pvdsdk::InstanceId members on your + // value structs. + virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) = 0; + + template + void addPropertyMessageArg(uint32_t offset) + { + addPropertyMessageArg(getPvdNamespacedNameForType(), offset, static_cast(sizeof(TDataType))); + } + virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName, + uint32_t inStructSizeInBytes) = 0; + template + void addPropertyMessage() + { + addPropertyMessage(getPvdNamespacedNameForType(), getPvdNamespacedNameForType(), + static_cast(sizeof(TMsgType))); + } + virtual void clearPropertyMessageArgs() = 0; + + void clearBufferedData() + { + clearNameStack(); + clearPropertyMessageArgs(); + clearNamedValues(); + } +}; + +#if !PX_DOXYGEN +} // pvdsdk +} // physx +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdErrorCodes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdErrorCodes.h new file mode 100644 index 0000000..6d7f706 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdErrorCodes.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_ERROR_CODES_H +#define PX_PVD_ERROR_CODES_H + +/** \addtogroup pvd +@{ +*/ + +#include "foundation/Px.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif + +struct PvdErrorType +{ + enum Enum + { + Success = 0, + NetworkError, + ArgumentError, + Disconnect, + InternalProblem + }; +}; + +typedef PvdErrorType::Enum PvdError; + +#if !PX_DOXYGEN +} +} +#endif +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdObjectModelBaseTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdObjectModelBaseTypes.h new file mode 100644 index 0000000..0c2479f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdObjectModelBaseTypes.h @@ -0,0 +1,428 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_OBJECT_MODEL_BASE_TYPES_H +#define PX_PVD_OBJECT_MODEL_BASE_TYPES_H + +/** \addtogroup pvd +@{ +*/ +#include "foundation/PxAssert.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif + +using namespace physx; + +inline const char* nonNull(const char* str) +{ + return str ? str : ""; +} +// strcmp will crash if passed a null string, however, +// so we need to make sure that doesn't happen. We do that +// by equating NULL and the empty string, "". +inline bool safeStrEq(const char* lhs, const char* rhs) +{ + return ::strcmp(nonNull(lhs), nonNull(rhs)) == 0; +} + +// Does this string have useful information in it. +inline bool isMeaningful(const char* str) +{ + return *(nonNull(str)) > 0; +} + +inline uint32_t safeStrLen(const char* str) +{ + str = nonNull(str); + return static_cast(strlen(str)); +} + +struct ObjectRef +{ + int32_t mInstanceId; + + ObjectRef(int32_t iid = -1) : mInstanceId(iid) + { + } + operator int32_t() const + { + return mInstanceId; + } + bool hasValue() const + { + return mInstanceId > 0; + } +}; + +struct U32Array4 +{ + uint32_t mD0; + uint32_t mD1; + uint32_t mD2; + uint32_t mD3; + U32Array4(uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3) : mD0(d0), mD1(d1), mD2(d2), mD3(d3) + { + } + U32Array4() : mD0(0), mD1(0), mD2(0), mD3(0) + { + } +}; + +typedef bool PvdBool; +typedef const char* String; +typedef void* VoidPtr; +typedef double PvdF64; +typedef float PvdF32; +typedef int64_t PvdI64; +typedef uint64_t PvdU64; +typedef int32_t PvdI32; +typedef uint32_t PvdU32; +typedef int16_t PvdI16; +typedef uint16_t PvdU16; +typedef int8_t PvdI8; +typedef uint8_t PvdU8; + +struct PvdColor +{ + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t a; + PvdColor(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) : r(_r), g(_g), b(_b), a(_a) + { + } + PvdColor() : r(0), g(0), b(0), a(255) + { + } + PvdColor(uint32_t abgr) + { + uint8_t* valPtr = reinterpret_cast(&abgr); + r = valPtr[0]; + g = valPtr[1]; + b = valPtr[2]; + a = valPtr[3]; + } +}; + +struct StringHandle +{ + uint32_t mHandle; + StringHandle(uint32_t val = 0) : mHandle(val) + { + } + operator uint32_t() const + { + return mHandle; + } +}; + +#define DECLARE_TYPES \ +DECLARE_BASE_PVD_TYPE(PvdI8) \ +DECLARE_BASE_PVD_TYPE(PvdU8) \ +DECLARE_BASE_PVD_TYPE(PvdI16) \ +DECLARE_BASE_PVD_TYPE(PvdU16) \ +DECLARE_BASE_PVD_TYPE(PvdI32) \ +DECLARE_BASE_PVD_TYPE(PvdU32) \ +DECLARE_BASE_PVD_TYPE(PvdI64) \ +DECLARE_BASE_PVD_TYPE(PvdU64) \ +DECLARE_BASE_PVD_TYPE(PvdF32) \ +DECLARE_BASE_PVD_TYPE(PvdF64) \ +DECLARE_BASE_PVD_TYPE(PvdBool) \ +DECLARE_BASE_PVD_TYPE(PvdColor) \ +DECLARE_BASE_PVD_TYPE(String) \ +DECLARE_BASE_PVD_TYPE(StringHandle) \ +DECLARE_BASE_PVD_TYPE(ObjectRef) \ +DECLARE_BASE_PVD_TYPE(VoidPtr) \ +DECLARE_BASE_PVD_TYPE(PxVec2) \ +DECLARE_BASE_PVD_TYPE(PxVec3) \ +DECLARE_BASE_PVD_TYPE(PxVec4) \ +DECLARE_BASE_PVD_TYPE(PxBounds3) \ +DECLARE_BASE_PVD_TYPE(PxQuat) \ +DECLARE_BASE_PVD_TYPE(PxTransform) \ +DECLARE_BASE_PVD_TYPE(PxMat33) \ +DECLARE_BASE_PVD_TYPE(PxMat44) \ +DECLARE_BASE_PVD_TYPE(U32Array4) + +struct PvdBaseType +{ + enum Enum + { + None = 0, + InternalStart = 1, + InternalStop = 64, +#define DECLARE_BASE_PVD_TYPE(type) type, + DECLARE_TYPES + Last +#undef DECLARE_BASE_PVD_TYPE + }; +}; +struct NamespacedName +{ + String mNamespace; + String mName; + NamespacedName(String ns, String nm) : mNamespace(ns), mName(nm) + { + } + NamespacedName(String nm = "") : mNamespace(""), mName(nm) + { + } + bool operator==(const NamespacedName& other) const + { + return safeStrEq(mNamespace, other.mNamespace) && safeStrEq(mName, other.mName); + } +}; + +struct NamedValue +{ + String mName; + uint32_t mValue; + NamedValue(String nm = "", uint32_t val = 0) : mName(nm), mValue(val) + { + } +}; + +template +struct BaseDataTypeToTypeMap +{ + bool compile_error; +}; +template +struct BaseTypeToDataTypeMap +{ + bool compile_error; +}; + +// Users can extend this mapping with new datatypes. +template +struct PvdDataTypeToNamespacedNameMap +{ + bool Name; +}; +// This mapping tells you the what class id to use for the base datatypes +// +#define DECLARE_BASE_PVD_TYPE(type) \ + template <> \ + struct BaseDataTypeToTypeMap \ + { \ + enum Enum \ + { \ + BaseTypeEnum = PvdBaseType::type \ + }; \ + }; \ + template <> \ + struct BaseDataTypeToTypeMap \ + { \ + enum Enum \ + { \ + BaseTypeEnum = PvdBaseType::type \ + }; \ + }; \ + template <> \ + struct BaseTypeToDataTypeMap \ + { \ + typedef type TDataType; \ + }; \ + template <> \ + struct PvdDataTypeToNamespacedNameMap \ + { \ + NamespacedName Name; \ + PvdDataTypeToNamespacedNameMap() : Name("physx3", #type) \ + { \ + } \ + }; \ + template <> \ + struct PvdDataTypeToNamespacedNameMap \ + { \ + NamespacedName Name; \ + PvdDataTypeToNamespacedNameMap() : Name("physx3", #type) \ + { \ + } \ + }; + +DECLARE_TYPES +#undef DECLARE_BASE_PVD_TYPE + +template +inline int32_t getPvdTypeForType() +{ + return static_cast(BaseDataTypeToTypeMap::BaseTypeEnum); +} +template +inline NamespacedName getPvdNamespacedNameForType() +{ + return PvdDataTypeToNamespacedNameMap().Name; +} + +#define DEFINE_PVD_TYPE_NAME_MAP(type, ns, name) \ + template <> \ + struct PvdDataTypeToNamespacedNameMap \ + { \ + NamespacedName Name; \ + PvdDataTypeToNamespacedNameMap() : Name(ns, name) \ + { \ + } \ + }; + +#define DEFINE_PVD_TYPE_ALIAS(newType, oldType) \ + template <> \ + struct PvdDataTypeToNamespacedNameMap \ + { \ + NamespacedName Name; \ + PvdDataTypeToNamespacedNameMap() : Name(PvdDataTypeToNamespacedNameMap().Name) \ + { \ + } \ + }; + +DEFINE_PVD_TYPE_ALIAS(const void*, void*) + +struct ArrayData +{ + uint8_t* mBegin; + uint8_t* mEnd; + uint8_t* mCapacity; //>= stop + ArrayData(uint8_t* beg = NULL, uint8_t* end = NULL, uint8_t* cap = NULL) : mBegin(beg), mEnd(end), mCapacity(cap) + { + } + uint8_t* begin() + { + return mBegin; + } + uint8_t* end() + { + return mEnd; + } + uint32_t byteCapacity() + { + return static_cast(mCapacity - mBegin); + } + uint32_t byteSize() const + { + return static_cast(mEnd - mBegin); + } // in bytes + uint32_t numberOfItems(uint32_t objectByteSize) + { + if(objectByteSize) + return byteSize() / objectByteSize; + return 0; + } + + void forgetData() + { + mBegin = mEnd = mCapacity = 0; + } +}; + +template +class DataRef +{ + const T* mBegin; + const T* mEnd; + + public: + DataRef(const T* b, uint32_t count) : mBegin(b), mEnd(b + count) + { + } + DataRef(const T* b = NULL, const T* e = NULL) : mBegin(b), mEnd(e) + { + } + DataRef(const DataRef& o) : mBegin(o.mBegin), mEnd(o.mEnd) + { + } + DataRef& operator=(const DataRef& o) + { + mBegin = o.mBegin; + mEnd = o.mEnd; + return *this; + } + uint32_t size() const + { + return static_cast(mEnd - mBegin); + } + const T* begin() const + { + return mBegin; + } + const T* end() const + { + return mEnd; + } + const T& operator[](uint32_t idx) const + { + PX_ASSERT(idx < size()); + return mBegin[idx]; + } + const T& back() const + { + PX_ASSERT(mEnd > mBegin); + return *(mEnd - 1); + } +}; + +struct PropertyType +{ + enum Enum + { + Unknown = 0, + Scalar, + Array + }; +}; + +// argument to the create property message function +struct PropertyMessageArg +{ + String mPropertyName; + NamespacedName mDatatypeName; + // where in the message this property starts. + uint32_t mMessageOffset; + // size of this entry object + uint32_t mByteSize; + + PropertyMessageArg(String propName, NamespacedName dtype, uint32_t msgOffset, uint32_t byteSize) + : mPropertyName(propName), mDatatypeName(dtype), mMessageOffset(msgOffset), mByteSize(byteSize) + { + } + PropertyMessageArg() : mPropertyName(""), mMessageOffset(0), mByteSize(0) + { + } +}; + +class PvdUserRenderer; +DEFINE_PVD_TYPE_NAME_MAP(PvdUserRenderer, "_debugger_", "PvdUserRenderer") + +#if !PX_DOXYGEN +} +} +#endif + +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdUserRenderer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdUserRenderer.h new file mode 100644 index 0000000..ae390a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/include/PxPvdUserRenderer.h @@ -0,0 +1,108 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_USER_RENDERER_H +#define PX_PVD_USER_RENDERER_H + +/** \addtogroup pvd +@{ +*/ +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "common/PxRenderBuffer.h" +#include "pvd/PxPvd.h" + +#include "PxPvdDataStream.h" +#include "foundation/PxUserAllocated.h" + +#if !PX_DOXYGEN +namespace physx +{ +#endif + +class PxPvd; + +#if !PX_DOXYGEN +namespace pvdsdk +{ +#endif + +class RendererEventClient; + +class PvdUserRenderer : public PxUserAllocated +{ + protected: + virtual ~PvdUserRenderer() + { + } + + public: + virtual void release() = 0; + virtual void setClient(RendererEventClient* client) = 0; + + // Instance to associate the further rendering with. + virtual void setInstanceId(const void* instanceId) = 0; + // Draw these points associated with this instance + virtual void drawPoints(const PxDebugPoint* points, uint32_t count) = 0; + // Draw these lines associated with this instance + virtual void drawLines(const PxDebugLine* lines, uint32_t count) = 0; + // Draw these triangles associated with this instance + virtual void drawTriangles(const PxDebugTriangle* triangles, uint32_t count) = 0; + // Draw this text associated with this instance + virtual void drawText(const PxDebugText& text) = 0; + + // Draw SDK debug render + virtual void drawRenderbuffer(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData, + uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount) = 0; + + // Constraint visualization routines + virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) = 0; + virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value, bool active) = 0; + virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper, bool active) = 0; + virtual void visualizeLimitCone(const PxTransform& t, float tanQSwingY, float tanQSwingZ, bool active) = 0; + virtual void visualizeDoubleCone(const PxTransform& t, float angle, bool active) = 0; + + // Clear the immedate buffer. + virtual void flushRenderEvents() = 0; + + static PvdUserRenderer* create(uint32_t bufferSize = 0x2000); +}; + +class RendererEventClient +{ + public: + virtual ~RendererEventClient(){} + + virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) = 0; +}; + +#if !PX_DOXYGEN +} +} +#endif +/** @} */ +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProvider.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProvider.h new file mode 100644 index 0000000..fdc8411 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProvider.h @@ -0,0 +1,58 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_CONTEXT_PROVIDER_H +#define PX_PROFILE_CONTEXT_PROVIDER_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + + struct PxProfileEventExecutionContext + { + uint32_t mThreadId; + uint8_t mCpuId; + uint8_t mThreadPriority; + + PxProfileEventExecutionContext( uint32_t inThreadId = 0, uint8_t inThreadPriority = 2 /*eThreadPriorityNormal*/, uint8_t inCpuId = 0 ) + : mThreadId( inThreadId ) + , mCpuId( inCpuId ) + , mThreadPriority( inThreadPriority ) + { + } + + bool operator==( const PxProfileEventExecutionContext& inOther ) const + { + return mThreadId == inOther.mThreadId + && mCpuId == inOther.mCpuId + && mThreadPriority == inOther.mThreadPriority; + } + }; + +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProviderImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProviderImpl.h new file mode 100644 index 0000000..2272b95 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileContextProviderImpl.h @@ -0,0 +1,52 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_CONTEXT_PROVIDER_IMPL_H +#define PX_PROFILE_CONTEXT_PROVIDER_IMPL_H + +#include "PxProfileContextProvider.h" + +#include "foundation/PxThread.h" + +namespace physx { namespace profile { + + struct PxDefaultContextProvider + { + PxProfileEventExecutionContext getExecutionContext() + { + PxThread::Id theId( PxThread::getId() ); + return PxProfileEventExecutionContext( static_cast( theId ), static_cast( PxThreadPriority::eNORMAL ), 0 ); + } + + uint32_t getThreadId() + { + return static_cast( PxThread::getId() ); + } + }; +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataBuffer.h new file mode 100644 index 0000000..48a9877 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataBuffer.h @@ -0,0 +1,165 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_DATA_BUFFER_H +#define PX_PROFILE_DATA_BUFFER_H + +#include "PxProfileAllocatorWrapper.h" +#include "PxProfileMemoryBuffer.h" +#include "PxProfileEventBufferClient.h" + +namespace physx { namespace profile { + + template + class DataBuffer //base class for buffers that cache data and then dump the data to clients. + { + public: + typedef TMutex TMutexType; + typedef TScopedLock TScopedLockType; + typedef PxProfileWrapperNamedAllocator TU8AllocatorType; + + typedef MemoryBuffer TMemoryBufferType; + typedef PxProfileArray TBufferClientArray; + + protected: + + PxProfileAllocatorWrapper mWrapper; + TMemoryBufferType mDataArray; + TBufferClientArray mBufferClients; + uint32_t mBufferFullAmount; + EventContextInformation mEventContextInformation; + TMutexType* mBufferMutex; + volatile bool mHasClients; + EventSerializer mSerializer; + + public: + + DataBuffer( PxAllocatorCallback* inFoundation + , uint32_t inBufferFullAmount + , TMutexType* inBufferMutex + , const char* inAllocationName ) + : mWrapper( inFoundation ) + , mDataArray( TU8AllocatorType( mWrapper, inAllocationName ) ) + , mBufferClients( mWrapper ) + , mBufferFullAmount( inBufferFullAmount ) + , mBufferMutex( inBufferMutex ) + , mHasClients( false ) + , mSerializer( &mDataArray ) + { + //The data array is never resized really. We ensure + //it is bigger than it will ever need to be. + mDataArray.reserve( inBufferFullAmount + 68 ); + } + + virtual ~DataBuffer() + { + while(mBufferClients.size() ) + { + removeClient( *mBufferClients[0] ); + } + } + + PxProfileAllocatorWrapper& getWrapper() { return mWrapper; } + TMutexType* getBufferMutex() { return mBufferMutex; } + void setBufferMutex(TMutexType* mutex) { mBufferMutex = mutex; } + + void addClient( PxProfileEventBufferClient& inClient ) + { + TScopedLockType lock( mBufferMutex ); + mBufferClients.pushBack( &inClient ); + mHasClients = true; + } + + void removeClient( PxProfileEventBufferClient& inClient ) + { + TScopedLockType lock( mBufferMutex ); + for ( uint32_t idx =0; idx < mBufferClients.size(); ++idx ) + { + if (mBufferClients[idx] == &inClient ) + { + inClient.handleClientRemoved(); + mBufferClients.replaceWithLast( idx ); + break; + } + } + mHasClients = mBufferClients.size() != 0; + } + + + bool hasClients() const + { + return mHasClients; + } + + virtual void flushEvents() + { + TScopedLockType lock(mBufferMutex); + const uint8_t* theData = mDataArray.begin(); + uint32_t theDataSize = mDataArray.size(); + sendDataToClients(theData, theDataSize); + mDataArray.clear(); + clearCachedData(); + } + + //Used for chaining together event buffers. + virtual void handleBufferFlush( const uint8_t* inData, uint32_t inDataSize ) + { + TScopedLockType lock( mBufferMutex ); + if ( inData && inDataSize ) + { + clearCachedData(); + if ( mDataArray.size() + inDataSize >= mBufferFullAmount ) + flushEvents(); + if ( inDataSize >= mBufferFullAmount ) + sendDataToClients( inData, inDataSize ); + else + mDataArray.write( inData, inDataSize ); + } + } + + protected: + virtual void clearCachedData() + { + } + + private: + + void sendDataToClients( const uint8_t* inData, uint32_t inDataSize ) + { + uint32_t clientCount = mBufferClients.size(); + for( uint32_t idx =0; idx < clientCount; ++idx ) + mBufferClients[idx]->handleBufferFlush( inData, inDataSize ); + } + + }; + +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataParsing.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataParsing.h new file mode 100644 index 0000000..c9bd238 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileDataParsing.h @@ -0,0 +1,217 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_DATA_PARSING_H +#define PX_PROFILE_DATA_PARSING_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + + //Converts datatypes without using type punning. + struct BlockParserDataConverter + { + union + { + uint8_t mU8[8]; + uint16_t mU16[4]; + uint32_t mU32[2]; + uint64_t mU64[1]; + + int8_t mI8[8]; + int16_t mI16[4]; + int32_t mI32[2]; + int64_t mI64[1]; + + + float mF32[2]; + double mF64[1]; + }; + + template inline TDataType convert() { PX_ASSERT( false ); return TDataType(); } + + template + inline void convert( const TDataType& ) {} + }; + + template<> inline uint8_t BlockParserDataConverter::convert() { return mU8[0]; } + template<> inline uint16_t BlockParserDataConverter::convert() { return mU16[0]; } + template<> inline uint32_t BlockParserDataConverter::convert() { return mU32[0]; } + template<> inline uint64_t BlockParserDataConverter::convert() { return mU64[0]; } + template<> inline int8_t BlockParserDataConverter::convert() { return mI8[0]; } + template<> inline int16_t BlockParserDataConverter::convert() { return mI16[0]; } + template<> inline int32_t BlockParserDataConverter::convert() { return mI32[0]; } + template<> inline int64_t BlockParserDataConverter::convert() { return mI64[0]; } + template<> inline float BlockParserDataConverter::convert() { return mF32[0]; } + template<> inline double BlockParserDataConverter::convert() { return mF64[0]; } + + template<> inline void BlockParserDataConverter::convert( const uint8_t& inData ) { mU8[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const uint16_t& inData ) { mU16[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const uint32_t& inData ) { mU32[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const uint64_t& inData ) { mU64[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const int8_t& inData ) { mI8[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const int16_t& inData ) { mI16[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const int32_t& inData ) { mI32[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const int64_t& inData ) { mI64[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const float& inData ) { mF32[0] = inData; } + template<> inline void BlockParserDataConverter::convert( const double& inData ) { mF64[0] = inData; } + + + //Handles various details around parsing blocks of uint8_t data. + struct BlockParseFunctions + { + template + static inline void swapBytes( uint8_t* inData ) + { + for ( uint32_t idx = 0; idx < ByteCount/2; ++idx ) + { + uint32_t endIdx = ByteCount-idx-1; + uint8_t theTemp = inData[idx]; + inData[idx] = inData[endIdx]; + inData[endIdx] = theTemp; + } + } + + static inline bool checkLength( const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength ) + { + return static_cast(inStop - inStart) >= inLength; + } + //warning work-around + template + static inline T val(T v) {return v;} + + template + static inline bool parse( const uint8_t*& inStart, const uint8_t* inStop, TDataType& outData ) + { + if ( checkLength( inStart, inStop, sizeof( TDataType ) ) ) + { + BlockParserDataConverter theConverter; + for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx ) + theConverter.mU8[idx] = inStart[idx]; + if ( val(DoSwapBytes)) + swapBytes( theConverter.mU8 ); + outData = theConverter.convert(); + inStart += sizeof( TDataType ); + return true; + } + return false; + } + + template + static inline bool parseBlock( const uint8_t*& inStart, const uint8_t* inStop, TDataType* outData, uint32_t inNumItems ) + { + uint32_t desired = sizeof(TDataType)*inNumItems; + if ( checkLength( inStart, inStop, desired ) ) + { + if ( val(DoSwapBytes) ) + { + for ( uint32_t item = 0; item < inNumItems; ++item ) + { + BlockParserDataConverter theConverter; + for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx ) + theConverter.mU8[idx] = inStart[idx]; + swapBytes( theConverter.mU8 ); + outData[item] = theConverter.convert(); + inStart += sizeof(TDataType); + } + } + else + { + uint8_t* target = reinterpret_cast(outData); + memmove( target, inStart, desired ); + inStart += desired; + } + return true; + } + return false; + } + + //In-place byte swapping block + template + static inline bool parseBlock( uint8_t*& inStart, const uint8_t* inStop, uint32_t inNumItems ) + { + uint32_t desired = sizeof(TDataType)*inNumItems; + if ( checkLength( inStart, inStop, desired ) ) + { + if ( val(DoSwapBytes) ) + { + for ( uint32_t item = 0; item < inNumItems; ++item, inStart += sizeof( TDataType ) ) + swapBytes( inStart ); //In-place swap. + } + else + inStart += sizeof( TDataType ) * inNumItems; + return true; + } + return false; + } + }; + + //Wraps the begin/end keeping track of them. + template + struct BlockParser + { + const uint8_t* mBegin; + const uint8_t* mEnd; + BlockParser( const uint8_t* inBegin=NULL, const uint8_t* inEnd=NULL ) + : mBegin( inBegin ) + , mEnd( inEnd ) + { + } + inline bool hasMoreData() const { return mBegin != mEnd; } + inline bool checkLength( uint32_t inLength ) { return BlockParseFunctions::checkLength( mBegin, mEnd, inLength ); } + + template + inline bool read( TDataType& outDatatype ) { return BlockParseFunctions::parse( mBegin, mEnd, outDatatype ); } + + template + inline bool readBlock( TDataType* outDataPtr, uint32_t inNumItems ) { return BlockParseFunctions::parseBlock( mBegin, mEnd, outDataPtr, inNumItems ); } + + template + inline bool readBlock( uint32_t inNumItems ) + { + uint8_t* theTempPtr = const_cast(mBegin); + bool retval = BlockParseFunctions::parseBlock( theTempPtr, mEnd, inNumItems ); + mBegin = theTempPtr; + return retval; + } + + uint32_t amountLeft() const { return static_cast( mEnd - mBegin ); } + }; + + //Reads the data without checking for error conditions + template + inline TDataType blockParserRead( TBlockParserType& inType ) + { + TDataType retval; + inType.read( retval ); + return retval; + } +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBuffer.h new file mode 100644 index 0000000..735daa3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBuffer.h @@ -0,0 +1,266 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_EVENT_BUFFER_H +#define PX_PROFILE_EVENT_BUFFER_H + +#include "PxProfileEvents.h" +#include "PxProfileEventSerialization.h" +#include "PxProfileDataBuffer.h" +#include "PxProfileContextProvider.h" + +#include "foundation/PxTime.h" + +namespace physx { namespace profile { + + /** + * An event buffer maintains an in-memory buffer of events. When this buffer is full + * it sends to buffer to all handlers registered and resets the buffer. + * + * It is parameterized in four ways. The first is a context provider that provides + * both thread id and context id. + * + * The second is the mutex (which may be null) and a scoped locking mechanism. Thus the buffer + * may be used in a multithreaded context but clients of the buffer don't pay for this if they + * don't intend to use it this way. + * + * Finally the buffer may use an event filtering mechanism. This mechanism needs one function, + * namely isEventEnabled( uint8_t subsystem, uint8_t eventId ). + * + * All of these systems can be parameterized at compile time leading to an event buffer + * that should be as fast as possible given the constraints. + * + * Buffers may be chained together as this buffer has a handleBufferFlush method that + * will grab the mutex and add the data to this event buffer. + * + * Overall, lets look at the PhysX SDK an how all the pieces fit together. + * The SDK should have a mutex-protected event buffer where actual devs or users of PhysX + * can register handlers. This buffer has slow but correct implementations of the + * context provider interface. + * + * The SDK object should also have a concrete event filter which was used in the + * construction of the event buffer and which it exposes through opaque interfaces. + * + * The SDK should protect its event buffer and its event filter from multithreaded + * access and thus this provides the safest and slowest way to log events and to + * enable/disable events. + * + * Each scene should also have a concrete event filter. This filter is updated from + * the SDK event filter (in a mutex protected way) every frame. Thus scenes can change + * their event filtering on a frame-by-frame basis. It means that tasks running + * under the scene don't need a mutex when accessing the filter. + * + * Furthermore the scene should have an event buffer that always sets the context id + * on each event to the scene. This allows PVD and other systems to correlate events + * to scenes. Scenes should provide access only to a relative event sending system + * that looks up thread id upon each event but uses the scene id. + * + * The SDK's event buffer should be setup as an EventBufferClient for each scene's + * event buffer. Thus the SDK should expose an EventBufferClient interface that + * any client can use. + * + * For extremely *extremely* performance sensitive areas we should create a specialized + * per-scene, per-thread event buffer that is set on the task for these occasions. This buffer + * uses a trivial event context setup with the scene's context id and the thread id. It should + * share the scene's concrete event filter and it should have absolutely no locking. It should + * empty into the scene's event buffer which in some cases should empty into the SDK's event buffer + * which when full will push events all the way out of the system. The task should *always* flush + * the event buffer (if it has one) when it is finished; nothing else will work reliably. + * + * If the per-scene,per-thread event buffer is correctly parameterized and fully defined adding + * a new event should be an inline operation requiring no mutex grabs in the common case. I don't + * believe you can get faster event production than this; the events are as small as possible (all + * relative events) and they are all produced inline resulting in one 4 byte header and one + * 8 byte timestamp per event. Reducing the memory pressure in this way reduces the communication + * overhead, the mutex grabs, basically everything that makes profiling expensive at the cost + * of a per-scene,per-thread event buffer (which could easily be reduced to a per-thread event + * buffer. + */ + template + class EventBuffer : public DataBuffer + { + public: + typedef DataBuffer TBaseType; + typedef TContextProvider TContextProviderType; + typedef TEventFilter TEventFilterType; + typedef typename TBaseType::TMutexType TMutexType; + typedef typename TBaseType::TScopedLockType TScopedLockType; + typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; + typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; + typedef typename TBaseType::TBufferClientArray TBufferClientArray; + + private: + EventContextInformation mEventContextInformation; + uint64_t mLastTimestamp; + TContextProvider mContextProvider; + TEventFilterType mEventFilter; + + public: + EventBuffer(PxAllocatorCallback* inFoundation + , uint32_t inBufferFullAmount + , const TContextProvider& inProvider + , TMutexType* inBufferMutex + , const TEventFilterType& inEventFilter ) + : TBaseType( inFoundation, inBufferFullAmount, inBufferMutex, "struct physx::profile::ProfileEvent" ) + , mLastTimestamp( 0 ) + , mContextProvider( inProvider ) + , mEventFilter( inEventFilter ) + { + memset(&mEventContextInformation,0,sizeof(EventContextInformation)); + } + + TContextProvider& getContextProvider() { return mContextProvider; } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) + { + TScopedLockType lock(TBaseType::mBufferMutex); + if ( mEventFilter.isEventEnabled( inId ) ) + { + StartEvent theEvent; + theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp ); + doAddProfileEvent( inId, theEvent ); + } + } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId) + { + PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() ); + startEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast(ctx.mThreadPriority), PxTime::getCurrentCounterValue() ); + } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) + { + startEvent( inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue() ); + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) + { + TScopedLockType lock(TBaseType::mBufferMutex); + if ( mEventFilter.isEventEnabled( inId ) ) + { + StopEvent theEvent; + theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp ); + doAddProfileEvent( inId, theEvent ); + } + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId) + { + PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() ); + stopEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast(ctx.mThreadPriority), PxTime::getCurrentCounterValue() ); + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) + { + stopEvent( inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue() ); + } + + inline void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) + { + eventValue( inId, mContextProvider.getThreadId(), contextId, inValue ); + } + + inline void eventValue( uint16_t inId, uint32_t threadId, uint64_t contextId, int64_t inValue ) + { + TScopedLockType lock( TBaseType::mBufferMutex ); + EventValue theEvent; + theEvent.init( inValue, contextId, threadId ); + EventHeader theHeader( static_cast( getEventType() ), inId ); + //set the header relative timestamp; + EventValue& theType( theEvent ); + theType.setupHeader( theHeader ); + sendEvent( theHeader, theType ); + } + + void flushProfileEvents() + { + TBaseType::flushEvents(); + } + + void release() + { + PX_PROFILE_DELETE( TBaseType::mWrapper.mUserFoundation, this ); + } + protected: + //Clears the cache meaning event compression + //starts over again. + //only called when the buffer mutex is held + void clearCachedData() + { + mEventContextInformation.setToDefault(); + mLastTimestamp = 0; + } + + template + PX_FORCE_INLINE void doAddProfileEvent(uint16_t eventId, const TProfileEventType& inType) + { + TScopedLockType lock(TBaseType::mBufferMutex); + if (mEventContextInformation == inType.mContextInformation) + doAddEvent(static_cast(inType.getRelativeEventType()), eventId, inType.getRelativeEvent()); + else + { + mEventContextInformation = inType.mContextInformation; + doAddEvent( static_cast( getEventType() ), eventId, inType ); + } + } + + template + PX_FORCE_INLINE void doAddEvent(uint8_t inEventType, uint16_t eventId, const TDataType& inType) + { + EventHeader theHeader( inEventType, eventId ); + //set the header relative timestamp; + TDataType& theType( const_cast( inType ) ); + uint64_t currentTs = inType.getTimestamp(); + theType.setupHeader(theHeader, mLastTimestamp); + mLastTimestamp = currentTs; + sendEvent( theHeader, theType ); + } + + template + PX_FORCE_INLINE void sendEvent( EventHeader& inHeader, TDataType& inType ) + { + uint32_t sizeToWrite = sizeof(inHeader) + inType.getEventSize(inHeader); + PX_UNUSED(sizeToWrite); + + uint32_t writtenSize = inHeader.streamify( TBaseType::mSerializer ); + writtenSize += inType.streamify(TBaseType::mSerializer, inHeader); + + PX_ASSERT(writtenSize == sizeToWrite); + + if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount ) + flushProfileEvents(); + + } + + }; +}} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferAtomic.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferAtomic.h new file mode 100644 index 0000000..71a6dce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferAtomic.h @@ -0,0 +1,316 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_EVENT_BUFFER_ATOMIC_H +#define PX_PROFILE_EVENT_BUFFER_ATOMIC_H + +#include "PxProfileEvents.h" +#include "PxProfileEventSerialization.h" +#include "PxProfileDataBuffer.h" + +#include "foundation/PxArray.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxAlloca.h" +#include "foundation/PxTime.h" + + +namespace physx { + namespace profile { + + static const uint32_t LOCAL_BUFFER_SIZE = 512; + + /** + * An event buffer maintains an in-memory buffer of events. When this buffer is full + * it sends to buffer to all handlers registered and resets the buffer. + * + * It is parameterized in four ways. The first is a context provider that provides + * both thread id and context id. + * + * The second is the mutex (which may be null) and a scoped locking mechanism. Thus the buffer + * may be used in a multithreaded context but clients of the buffer don't pay for this if they + * don't intend to use it this way. + * + * Finally the buffer may use an event filtering mechanism. This mechanism needs one function, + * namely isEventEnabled( uint8_t subsystem, uint8_t eventId ). + * + * All of these systems can be parameterized at compile time leading to an event buffer + * that should be as fast as possible given the constraints. + * + * Buffers may be chained together as this buffer has a handleBufferFlush method that + * will grab the mutex and add the data to this event buffer. + * + * Overall, lets look at the PhysX SDK an how all the pieces fit together. + * The SDK should have a mutex-protected event buffer where actual devs or users of PhysX + * can register handlers. This buffer has slow but correct implementations of the + * context provider interface. + * + * The SDK object should also have a concrete event filter which was used in the + * construction of the event buffer and which it exposes through opaque interfaces. + * + * The SDK should protect its event buffer and its event filter from multithreaded + * access and thus this provides the safest and slowest way to log events and to + * enable/disable events. + * + * Each scene should also have a concrete event filter. This filter is updated from + * the SDK event filter (in a mutex protected way) every frame. Thus scenes can change + * their event filtering on a frame-by-frame basis. It means that tasks running + * under the scene don't need a mutex when accessing the filter. + * + * Furthermore the scene should have an event buffer that always sets the context id + * on each event to the scene. This allows PVD and other systems to correlate events + * to scenes. Scenes should provide access only to a relative event sending system + * that looks up thread id upon each event but uses the scene id. + * + * The SDK's event buffer should be setup as an EventBufferClient for each scene's + * event buffer. Thus the SDK should expose an EventBufferClient interface that + * any client can use. + * + * For extremely *extremely* performance sensitive areas we should create a specialized + * per-scene, per-thread event buffer that is set on the task for these occasions. This buffer + * uses a trivial event context setup with the scene's context id and the thread id. It should + * share the scene's concrete event filter and it should have absolutely no locking. It should + * empty into the scene's event buffer which in some cases should empty into the SDK's event buffer + * which when full will push events all the way out of the system. The task should *always* flush + * the event buffer (if it has one) when it is finished; nothing else will work reliably. + * + * If the per-scene,per-thread event buffer is correctly parameterized and fully defined adding + * a new event should be an inline operation requiring no mutex grabs in the common case. I don't + * believe you can get faster event production than this; the events are as small as possible (all + * relative events) and they are all produced inline resulting in one 4 byte header and one + * 8 byte timestamp per event. Reducing the memory pressure in this way reduces the communication + * overhead, the mutex grabs, basically everything that makes profiling expensive at the cost + * of a per-scene,per-thread event buffer (which could easily be reduced to a per-thread event + * buffer. + */ + template + class EventBufferAtomic : public DataBuffer < TMutex, TScopedLock > + { + public: + typedef DataBuffer TBaseType; + typedef TContextProvider TContextProviderType; + typedef TEventFilter TEventFilterType; + typedef typename TBaseType::TMutexType TMutexType; + typedef typename TBaseType::TScopedLockType TScopedLockType; + typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; + typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; + typedef typename TBaseType::TBufferClientArray TBufferClientArray; + + private: + TContextProvider mContextProvider; + TEventFilterType mEventFilter; + volatile int32_t mReserved; + volatile int32_t mWritten; + + public: + EventBufferAtomic(PxAllocatorCallback* inFoundation + , uint32_t inBufferFullAmount + , const TContextProvider& inProvider + , TMutexType* inBufferMutex + , const TEventFilterType& inEventFilter) + : TBaseType(inFoundation, inBufferFullAmount, inBufferMutex, "struct physx::profile::ProfileEvent") + , mContextProvider(inProvider) + , mEventFilter(inEventFilter) + , mReserved(0) + , mWritten(0) + { + } + + TContextProvider& getContextProvider() { return mContextProvider; } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) + { + if (mEventFilter.isEventEnabled(inId)) + { + StartEvent theEvent; + theEvent.init(threadId, contextId, cpuId, threadPriority, inTimestamp); + doAddProfileEvent(inId, theEvent); + } + } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId) + { + PxProfileEventExecutionContext ctx(mContextProvider.getExecutionContext()); + startEvent(inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast(ctx.mThreadPriority), PxTime::getCurrentCounterValue()); + } + + PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) + { + startEvent(inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue()); + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) + { + if (mEventFilter.isEventEnabled(inId)) + { + StopEvent theEvent; + theEvent.init(threadId, contextId, cpuId, threadPriority, inTimestamp); + doAddProfileEvent(inId, theEvent); + } + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId) + { + PxProfileEventExecutionContext ctx(mContextProvider.getExecutionContext()); + stopEvent(inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast(ctx.mThreadPriority), PxTime::getCurrentCounterValue()); + } + + PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) + { + stopEvent(inId, threadId, contextId, 0, 0, PxTime::getCurrentCounterValue()); + } + + inline void eventValue(uint16_t inId, uint64_t contextId, int64_t inValue) + { + eventValue(inId, mContextProvider.getThreadId(), contextId, inValue); + } + + inline void eventValue(uint16_t inId, uint32_t threadId, uint64_t contextId, int64_t inValue) + { + EventValue theEvent; + theEvent.init(inValue, contextId, threadId); + EventHeader theHeader(static_cast(getEventType()), inId); + //set the header relative timestamp; + EventValue& theType(theEvent); + theType.setupHeader(theHeader); + + int32_t sizeToWrite = int32_t(sizeof(theHeader) + theType.getEventSize(theHeader)); + int32_t reserved = PxAtomicAdd(&mReserved, sizeToWrite); + sendEvent(theHeader, theType, reserved, sizeToWrite); + } + + void flushProfileEvents(int32_t reserved = -1) + { + TScopedLockType lock(TBaseType::mBufferMutex); + + // set the buffer full to lock additional writes + int32_t reservedOld = PxAtomicExchange(&mReserved, int32_t(TBaseType::mBufferFullAmount + 1)); + if (reserved == -1) + reserved = reservedOld; + + // spin till we have written all the data + while (reserved > mWritten) + { + } + + // check if we have written all data + PX_ASSERT(reserved == mWritten); + + // set the correct size of the serialization data buffer + TBaseType::mSerializer.mArray->setEnd(TBaseType::mSerializer.mArray->begin() + mWritten); + + // flush events + TBaseType::flushEvents(); + + // write master timestamp and set reserved/written to start writing to buffer again + mWritten = 0; + mReserved = 0; + } + + void release() + { + PX_PROFILE_DELETE(TBaseType::mWrapper.mUserFoundation, this); + } + protected: + //Clears the cache meaning event compression + //starts over again. + //only called when the buffer mutex is held + void clearCachedData() + { + } + + template + PX_FORCE_INLINE void doAddProfileEvent(uint16_t eventId, const TProfileEventType& inType) + { + doAddEvent(static_cast(getEventType()), eventId, inType); + } + + template + PX_FORCE_INLINE void doAddEvent(uint8_t inEventType, uint16_t eventId, const TDataType& inType) + { + EventHeader theHeader(inEventType, eventId); + TDataType& theType(const_cast(inType)); + theType.setupHeader(theHeader, 0); + + const int32_t sizeToWrite = int32_t(sizeof(theHeader) + theType.getEventSize(theHeader)); + + int32_t reserved = PxAtomicAdd(&mReserved, sizeToWrite); + sendEvent(theHeader, theType, reserved, sizeToWrite); + } + + template + PX_FORCE_INLINE void sendEvent(EventHeader& inHeader, TDataType& inType, int32_t reserved, int32_t sizeToWrite) + { + // if we don't fit to the buffer, we wait till it is flushed + if (reserved - sizeToWrite >= int32_t(TBaseType::mBufferFullAmount)) + { + while (reserved - sizeToWrite >= int32_t(TBaseType::mBufferFullAmount)) + { + // I32 overflow + if (mReserved < int32_t(TBaseType::mBufferFullAmount)) + { + reserved = PxAtomicAdd(&mReserved, sizeToWrite); + } + } + } + + int32_t writeIndex = reserved - sizeToWrite; + uint32_t writtenSize = 0; + + PX_ASSERT(writeIndex >= 0); + + PX_ALLOCA(tempBuffer, uint8_t, sizeToWrite); + TempMemoryBuffer memoryBuffer(tempBuffer, sizeToWrite); + EventSerializer eventSerializer(&memoryBuffer); + + writtenSize = inHeader.streamify(eventSerializer); + writtenSize += inType.streamify(eventSerializer, inHeader); + + TBaseType::mSerializer.mArray->reserve(writeIndex + writtenSize); + TBaseType::mSerializer.mArray->write(&tempBuffer[0], writtenSize, writeIndex); + + PX_ASSERT(writtenSize == uint32_t(sizeToWrite)); + PxAtomicAdd(&mWritten, sizeToWrite); + + if (reserved >= int32_t(TBaseType::mBufferFullAmount)) + { + TScopedLockType lock(TBaseType::mBufferMutex); + // we flush the buffer if its full and we did not flushed him in the meantime + if(mReserved >= reserved) + flushProfileEvents(reserved); + } + } + + }; + } +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClient.h new file mode 100644 index 0000000..cb75125 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClient.h @@ -0,0 +1,80 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_BUFFER_CLIENT_H +#define PX_PROFILE_EVENT_BUFFER_CLIENT_H + +#include "PxProfileEventNames.h" + +namespace physx { namespace profile { + + /** + \brief Client handles the data when an event buffer flushes. This data + can be parsed (PxProfileEventHandler.h) as a binary set of events. + */ + class PxProfileEventBufferClient + { + protected: + virtual ~PxProfileEventBufferClient(){} + public: + /** + \brief Callback when the event buffer is full. This data is serialized profile events + and can be read back using: PxProfileEventHandler::parseEventBuffer. + + \param inData Provided buffer data. + \param inLength Data length. + + @see PxProfileEventHandler::parseEventBuffer. + */ + virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) = 0; + + /** + \brief Happens if something removes all the clients from the manager. + */ + virtual void handleClientRemoved() = 0; + }; + + /** + \brief Client handles new profile event add. + */ + class PxProfileZoneClient : public PxProfileEventBufferClient + { + protected: + virtual ~PxProfileZoneClient(){} + public: + /** + \brief Callback when new profile event is added. + + \param inName Added profile event name. + */ + virtual void handleEventAdded( const PxProfileEventName& inName ) = 0; + }; + +} } + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClientManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClientManager.h new file mode 100644 index 0000000..b7b7087 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventBufferClientManager.h @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_BUFFER_CLIENT_MANAGER_H +#define PX_PROFILE_EVENT_BUFFER_CLIENT_MANAGER_H + +#include "PxProfileEventBufferClient.h" + +namespace physx { namespace profile { + + /** + \brief Manager keep collections of PxProfileEventBufferClient clients. + + @see PxProfileEventBufferClient + */ + class PxProfileEventBufferClientManager + { + protected: + virtual ~PxProfileEventBufferClientManager(){} + public: + /** + \brief Adds new client. + \param inClient Client to add. + */ + virtual void addClient( PxProfileEventBufferClient& inClient ) = 0; + + /** + \brief Removes a client. + \param inClient Client to remove. + */ + virtual void removeClient( PxProfileEventBufferClient& inClient ) = 0; + + /** + \brief Check if manager has clients. + \return True if manager has added clients. + */ + virtual bool hasClients() const = 0; + }; + + /** + \brief Manager keep collections of PxProfileZoneClient clients. + + @see PxProfileZoneClient + */ + class PxProfileZoneClientManager + { + protected: + virtual ~PxProfileZoneClientManager(){} + public: + /** + \brief Adds new client. + \param inClient Client to add. + */ + virtual void addClient( PxProfileZoneClient& inClient ) = 0; + + /** + \brief Removes a client. + \param inClient Client to remove. + */ + virtual void removeClient( PxProfileZoneClient& inClient ) = 0; + + /** + \brief Check if manager has clients. + \return True if manager has added clients. + */ + virtual bool hasClients() const = 0; + }; +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventId.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventId.h new file mode 100644 index 0000000..ce8c190 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventId.h @@ -0,0 +1,64 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_ID_H +#define PX_PROFILE_EVENT_ID_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + /** + \brief A event id structure. Optionally includes information about + if the event was enabled at compile time. + */ + struct PxProfileEventId + { + uint16_t eventId; + mutable bool compileTimeEnabled; + + /** + \brief Profile event id constructor. + \param inId Profile event id. + \param inCompileTimeEnabled Compile time enabled. + */ + PxProfileEventId( uint16_t inId = 0, bool inCompileTimeEnabled = true ) + : eventId( inId ) + , compileTimeEnabled( inCompileTimeEnabled ) + { + } + + operator uint16_t () const { return eventId; } + + bool operator==( const PxProfileEventId& inOther ) const + { + return eventId == inOther.eventId; + } + }; + +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp new file mode 100644 index 0000000..037ffbb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventImpl.cpp @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "PxProfileEventBuffer.h" +#include "PxProfileZoneImpl.h" +#include "PxProfileZoneManagerImpl.h" +#include "PxProfileMemoryEventBuffer.h" +#include "foundation/PxUserAllocated.h" + +namespace physx { namespace profile { + + struct PxProfileNameProviderForward + { + PxProfileNames mNames; + PxProfileNameProviderForward( PxProfileNames inNames ) + : mNames( inNames ) + { + } + PxProfileNames getProfileNames() const { return mNames; } + }; + + PxProfileZone& PxProfileZone::createProfileZone( PxAllocatorCallback* inAllocator, const char* inSDKName, PxProfileNames inNames, uint32_t inEventBufferByteSize ) + { + typedef ZoneImpl TSDKType; + return *PX_PROFILE_NEW( inAllocator, TSDKType ) ( inAllocator, inSDKName, inEventBufferByteSize, PxProfileNameProviderForward( inNames ) ); + } + + PxProfileZoneManager& PxProfileZoneManager::createProfileZoneManager(PxAllocatorCallback* inAllocator ) + { + return *PX_PROFILE_NEW( inAllocator, ZoneManagerImpl ) ( inAllocator ); + } + + PxProfileMemoryEventBuffer& PxProfileMemoryEventBuffer::createMemoryEventBuffer( PxAllocatorCallback& inAllocator, uint32_t inBufferSize ) + { + return *PX_PROFILE_NEW( &inAllocator, PxProfileMemoryEventBufferImpl )( inAllocator, inBufferSize ); + } + +} } + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventMutex.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventMutex.h new file mode 100644 index 0000000..580f063 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventMutex.h @@ -0,0 +1,62 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_MUTEX_H +#define PX_PROFILE_EVENT_MUTEX_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + + /** + * Mutex interface that hides implementation around lock and unlock. + * The event system locks the mutex for every interaction. + */ + class PxProfileEventMutex + { + protected: + virtual ~PxProfileEventMutex(){} + public: + virtual void lock() = 0; + virtual void unlock() = 0; + }; + + /** + * Take any mutex type that implements lock and unlock and make an EventMutex out of it. + */ + template + struct PxProfileEventMutexImpl : public PxProfileEventMutex + { + TMutexType* mMutex; + PxProfileEventMutexImpl( TMutexType* inMtx ) : mMutex( inMtx ) {} + virtual void lock() { mMutex->lock(); } + virtual void unlock() { mMutex->unlock(); } + }; + +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventNames.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventNames.h new file mode 100644 index 0000000..808d571 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventNames.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_NAMES_H +#define PX_PROFILE_EVENT_NAMES_H + +#include "PxProfileEventId.h" + +namespace physx { namespace profile { + + /** + \brief Mapping from event id to name. + */ + struct PxProfileEventName + { + const char* name; + PxProfileEventId eventId; + + /** + \brief Default constructor. + \param inName Profile event name. + \param inId Profile event id. + */ + PxProfileEventName( const char* inName, PxProfileEventId inId ) : name( inName ), eventId( inId ) {} + }; + + /** + \brief Aggregator of event id -> name mappings + */ + struct PxProfileNames + { + /** + \brief Default constructor that doesn't point to any names. + \param inEventCount Number of provided events. + \param inSubsystems Event names array. + */ + PxProfileNames( uint32_t inEventCount = 0, const PxProfileEventName* inSubsystems = NULL ) + : eventCount( inEventCount ) + , events( inSubsystems ) + { + } + + uint32_t eventCount; + const PxProfileEventName* events; + }; + + /** + \brief Provides a mapping from event ID -> name. + */ + class PxProfileNameProvider + { + public: + /** + \brief Returns profile event names. + \return Profile event names. + */ + virtual PxProfileNames getProfileNames() const = 0; + + protected: + virtual ~PxProfileNameProvider(){} + PxProfileNameProvider& operator=(const PxProfileNameProvider&) { return *this; } + }; +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSender.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSender.h new file mode 100644 index 0000000..f546667 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSender.h @@ -0,0 +1,111 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENT_SENDER_H +#define PX_PROFILE_EVENT_SENDER_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + + /** + \brief Tagging interface to indicate an object that is capable of flushing a profile + event stream at a certain point. + */ + class PxProfileEventFlusher + { + protected: + virtual ~PxProfileEventFlusher(){} + public: + /** + \brief Flush profile events. Sends the profile event buffer to hooked clients. + */ + virtual void flushProfileEvents() = 0; + }; + + /** + \brief Sends the full events where the caller must provide the context and thread id. + */ + class PxProfileEventSender + { + protected: + virtual ~PxProfileEventSender(){} + public: + + /** + \brief Use this as a thread id for events that start on one thread and end on another + */ + static const uint32_t CrossThreadId = 99999789; + + /** + \brief Send a start profile event, optionally with a context. Events are sorted by thread + and context in the client side. + \param inId Profile event id. + \param contextId Context id. + */ + virtual void startEvent( uint16_t inId, uint64_t contextId) = 0; + /** + \brief Send a stop profile event, optionally with a context. Events are sorted by thread + and context in the client side. + \param inId Profile event id. + \param contextId Context id. + */ + virtual void stopEvent( uint16_t inId, uint64_t contextId) = 0; + + /** + \brief Send a start profile event, optionally with a context. Events are sorted by thread + and context in the client side. + \param inId Profile event id. + \param contextId Context id. + \param threadId Thread id. + */ + virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId) = 0; + /** + \brief Send a stop profile event, optionally with a context. Events are sorted by thread + and context in the client side. + \param inId Profile event id. + \param contextId Context id. + \param threadId Thread id. + */ + virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId ) = 0; + + virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop) = 0; + + /** + \brief Set an specific events value. This is different than the profiling value + for the event; it is a value recorded and kept around without a timestamp associated + with it. This value is displayed when the event itself is processed. + \param inId Profile event id. + \param contextId Context id. + \param inValue Value to set for the event. + */ + virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) = 0; + }; + +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSerialization.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSerialization.h new file mode 100644 index 0000000..703ad52 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEventSerialization.h @@ -0,0 +1,256 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_EVENT_SERIALIZATION_H +#define PX_PROFILE_EVENT_SERIALIZATION_H + +#include "PxProfileDataParsing.h" +#include "PxProfileEvents.h" + +namespace physx { namespace profile { + + /** + * Array type must be a pxu8 container. Templated so that this object can write + * to different collections. + */ + + template + struct EventSerializer + { + TArrayType* mArray; + EventSerializer( TArrayType* inA ) : mArray( inA ) {} + + template + uint32_t streamify( const char*, const TDataType& inType ) + { + return mArray->write( inType ); + } + + uint32_t streamify( const char*, const char*& inType ) + { + PX_ASSERT( inType != NULL ); + uint32_t len( static_cast( strlen( inType ) ) ); + ++len; //include the null terminator + uint32_t writtenSize = 0; + writtenSize = mArray->write(len); + writtenSize += mArray->write(inType, len); + return writtenSize; + } + + uint32_t streamify( const char*, const uint8_t* inData, uint32_t len ) + { + uint32_t writtenSize = mArray->write(len); + if ( len ) + writtenSize += mArray->write(inData, len); + return writtenSize; + } + + uint32_t streamify( const char* nm, const uint64_t& inType, EventStreamCompressionFlags::Enum inFlags ) + { + uint32_t writtenSize = 0; + switch( inFlags ) + { + case EventStreamCompressionFlags::U8: + writtenSize = streamify(nm, static_cast(inType)); + break; + case EventStreamCompressionFlags::U16: + writtenSize = streamify(nm, static_cast(inType)); + break; + case EventStreamCompressionFlags::U32: + writtenSize = streamify(nm, static_cast(inType)); + break; + case EventStreamCompressionFlags::U64: + writtenSize = streamify(nm, inType); + break; + } + return writtenSize; + } + + uint32_t streamify( const char* nm, const uint32_t& inType, EventStreamCompressionFlags::Enum inFlags ) + { + uint32_t writtenSize = 0; + switch( inFlags ) + { + case EventStreamCompressionFlags::U8: + writtenSize = streamify(nm, static_cast(inType)); + break; + case EventStreamCompressionFlags::U16: + writtenSize = streamify(nm, static_cast(inType)); + break; + case EventStreamCompressionFlags::U32: + case EventStreamCompressionFlags::U64: + writtenSize = streamify(nm, inType); + break; + } + return writtenSize; + } + }; + + /** + * The event deserializes takes a buffer implements the streamify functions + * by setting the passed in data to the data in the buffer. + */ + template + struct EventDeserializer + { + const uint8_t* mData; + uint32_t mLength; + bool mFail; + + EventDeserializer( const uint8_t* inData, uint32_t inLength ) + : mData( inData ) + , mLength( inLength ) + , mFail( false ) + { + if ( mData == NULL ) + mLength = 0; + } + + bool val() { return TSwapBytes; } + + uint32_t streamify( const char* , uint8_t& inType ) + { + uint8_t* theData = reinterpret_cast( &inType ); //type punned pointer... + if ( mFail || sizeof( inType ) > mLength ) + { + PX_ASSERT( false ); + mFail = true; + } + else + { + for( uint32_t idx = 0; idx < sizeof( uint8_t ); ++idx, ++mData, --mLength ) + theData[idx] = *mData; + } + return 0; + } + + //default streamify reads things natively as bytes. + template + uint32_t streamify( const char* , TDataType& inType ) + { + uint8_t* theData = reinterpret_cast( &inType ); //type punned pointer... + if ( mFail || sizeof( inType ) > mLength ) + { + PX_ASSERT( false ); + mFail = true; + } + else + { + for( uint32_t idx = 0; idx < sizeof( TDataType ); ++idx, ++mData, --mLength ) + theData[idx] = *mData; + bool temp = val(); + if ( temp ) + BlockParseFunctions::swapBytes( theData ); + } + return 0; + } + + uint32_t streamify( const char*, const char*& inType ) + { + uint32_t theLen; + streamify( "", theLen ); + theLen = PxMin( theLen, mLength ); + inType = reinterpret_cast( mData ); + mData += theLen; + mLength -= theLen; + return 0; + } + + uint32_t streamify( const char*, const uint8_t*& inData, uint32_t& len ) + { + uint32_t theLen; + streamify( "", theLen ); + theLen = PxMin( theLen, mLength ); + len = theLen; + inData = reinterpret_cast( mData ); + mData += theLen; + mLength -= theLen; + return 0; + } + + uint32_t streamify( const char* nm, uint64_t& inType, EventStreamCompressionFlags::Enum inFlags ) + { + switch( inFlags ) + { + case EventStreamCompressionFlags::U8: + { + uint8_t val=0; + streamify( nm, val ); + inType = val; + } + break; + case EventStreamCompressionFlags::U16: + { + uint16_t val; + streamify( nm, val ); + inType = val; + } + break; + case EventStreamCompressionFlags::U32: + { + uint32_t val; + streamify( nm, val ); + inType = val; + } + break; + case EventStreamCompressionFlags::U64: + streamify( nm, inType ); + break; + } + return 0; + } + + uint32_t streamify( const char* nm, uint32_t& inType, EventStreamCompressionFlags::Enum inFlags ) + { + switch( inFlags ) + { + case EventStreamCompressionFlags::U8: + { + uint8_t val=0; + streamify( nm, val ); + inType = val; + } + break; + case EventStreamCompressionFlags::U16: + { + uint16_t val=0; + streamify( nm, val ); + inType = val; + } + break; + case EventStreamCompressionFlags::U32: + case EventStreamCompressionFlags::U64: + streamify( nm, inType ); + break; + } + return 0; + } + }; +}} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEvents.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEvents.h new file mode 100644 index 0000000..eee5503 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileEvents.h @@ -0,0 +1,705 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_EVENTS_H +#define PX_PROFILE_EVENTS_H + +#include "foundation/PxMath.h" +#include "foundation/PxAssert.h" + +#include "PxProfileEventId.h" + + +#define PX_PROFILE_UNION_1(a) physx::profile::TUnion +#define PX_PROFILE_UNION_2(a,b) physx::profile::TUnion +#define PX_PROFILE_UNION_3(a,b,c) physx::profile::TUnion +#define PX_PROFILE_UNION_4(a,b,c,d) physx::profile::TUnion +#define PX_PROFILE_UNION_5(a,b,c,d,e) physx::profile::TUnion +#define PX_PROFILE_UNION_6(a,b,c,d,e,f) physx::profile::TUnion +#define PX_PROFILE_UNION_7(a,b,c,d,e,f,g) physx::profile::TUnion +#define PX_PROFILE_UNION_8(a,b,c,d,e,f,g,h) physx::profile::TUnion +#define PX_PROFILE_UNION_9(a,b,c,d,e,f,g,h,i) physx::profile::TUnion + +namespace physx { namespace profile { + + struct Empty {}; + + template struct Type2Type {}; + + template + union TUnion + { + typedef U Head; + typedef V Tail; + + Head head; + Tail tail; + + template + void init(const TDataType& inData) + { + toType(Type2Type()).init(inData); + } + + template + PX_FORCE_INLINE TDataType& toType(const Type2Type& outData) { return tail.toType(outData); } + + PX_FORCE_INLINE Head& toType(const Type2Type&) { return head; } + + template + PX_FORCE_INLINE const TDataType& toType(const Type2Type& outData) const { return tail.toType(outData); } + + PX_FORCE_INLINE const Head& toType(const Type2Type&) const { return head; } + }; + + struct EventTypes + { + enum Enum + { + Unknown = 0, + StartEvent, + StopEvent, + RelativeStartEvent, //reuses context,id from the earlier event. + RelativeStopEvent, //reuses context,id from the earlier event. + EventValue, + CUDAProfileBuffer //obsolete, placeholder to skip data from PhysX SDKs < 3.4 + }; + }; + + struct EventStreamCompressionFlags + { + enum Enum + { + U8 = 0, + U16 = 1, + U32 = 2, + U64 = 3, + CompressionMask = 3 + }; + }; + +#if PX_APPLE_FAMILY +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wimplicit-fallthrough" +#endif + + //Find the smallest value that will represent the incoming value without loss. + //We can enlarge the current compression value, but we can't make is smaller. + //In this way, we can use this function to find the smallest compression setting + //that will work for a set of values. + inline EventStreamCompressionFlags::Enum findCompressionValue( uint64_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 ) + { + PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) && + (inCurrentCompressionValue <= EventStreamCompressionFlags::U64), + "Invalid inCurrentCompressionValue in profile::findCompressionValue"); + + //Fallthrough is intentional + switch( inCurrentCompressionValue ) + { + case EventStreamCompressionFlags::U8: + if ( inValue <= UINT8_MAX ) + return EventStreamCompressionFlags::U8; + case EventStreamCompressionFlags::U16: + if ( inValue <= UINT16_MAX ) + return EventStreamCompressionFlags::U16; + case EventStreamCompressionFlags::U32: + if ( inValue <= UINT32_MAX ) + return EventStreamCompressionFlags::U32; + case EventStreamCompressionFlags::U64: + break; + } + return EventStreamCompressionFlags::U64; + } + + //Find the smallest value that will represent the incoming value without loss. + //We can enlarge the current compression value, but we can't make is smaller. + //In this way, we can use this function to find the smallest compression setting + //that will work for a set of values. + inline EventStreamCompressionFlags::Enum findCompressionValue( uint32_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 ) + { + PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) && + (inCurrentCompressionValue <= EventStreamCompressionFlags::U64), + "Invalid inCurrentCompressionValue in profile::findCompressionValue"); + + //Fallthrough is intentional + switch( inCurrentCompressionValue ) + { + case EventStreamCompressionFlags::U8: + if ( inValue <= UINT8_MAX ) + return EventStreamCompressionFlags::U8; + case EventStreamCompressionFlags::U16: + if ( inValue <= UINT16_MAX ) + return EventStreamCompressionFlags::U16; + case EventStreamCompressionFlags::U32: + case EventStreamCompressionFlags::U64: + break; + } + return EventStreamCompressionFlags::U32; + } + +#if PX_APPLE_FAMILY +#pragma clang diagnostic pop +#endif + + //Event header is 32 bytes and precedes all events. + struct EventHeader + { + uint8_t mEventType; //Used to parse the correct event out of the stream + uint8_t mStreamOptions; //Timestamp compression, etc. + uint16_t mEventId; //16 bit per-event-system event id + EventHeader( uint8_t type = 0, uint16_t id = 0 ) + : mEventType( type ) + , mStreamOptions( uint8_t(-1) ) + , mEventId( id ) + { + } + + EventHeader( EventTypes::Enum type, uint16_t id ) + : mEventType( static_cast( type ) ) + , mStreamOptions( uint8_t(-1) ) + , mEventId( id ) + { + } + + EventStreamCompressionFlags::Enum getTimestampCompressionFlags() const + { + return static_cast ( mStreamOptions & EventStreamCompressionFlags::CompressionMask ); + } + + uint64_t compressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp ) + { + mStreamOptions = EventStreamCompressionFlags::U64; + uint64_t retval = inCurrentTimestamp; + if ( inLastTimestamp ) + { + retval = inCurrentTimestamp - inLastTimestamp; + EventStreamCompressionFlags::Enum compressionValue = findCompressionValue( retval ); + mStreamOptions = static_cast( compressionValue ); + if ( compressionValue == EventStreamCompressionFlags::U64 ) + retval = inCurrentTimestamp; //just send the timestamp as is. + } + return retval; + } + + uint64_t uncompressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp ) const + { + if ( getTimestampCompressionFlags() != EventStreamCompressionFlags::U64 ) + return inLastTimestamp + inCurrentTimestamp; + return inCurrentTimestamp; + } + + void setContextIdCompressionFlags( uint64_t inContextId ) + { + uint8_t options = static_cast( findCompressionValue( inContextId ) ); + mStreamOptions = uint8_t(mStreamOptions | options << 2); + } + + EventStreamCompressionFlags::Enum getContextIdCompressionFlags() const + { + return static_cast< EventStreamCompressionFlags::Enum >( ( mStreamOptions >> 2 ) & EventStreamCompressionFlags::CompressionMask ); + } + + bool operator==( const EventHeader& inOther ) const + { + return mEventType == inOther.mEventType + && mStreamOptions == inOther.mStreamOptions + && mEventId == inOther.mEventId; + } + + template + inline uint32_t streamify( TStreamType& inStream ) + { + uint32_t writtenSize = inStream.streamify( "EventType", mEventType ); + writtenSize += inStream.streamify("StreamOptions", mStreamOptions); //Timestamp compression, etc. + writtenSize += inStream.streamify("EventId", mEventId); //16 bit per-event-system event id + return writtenSize; + } + + + }; + + //Declaration of type level getEventType function that maps enumeration event types to datatypes + template + inline EventTypes::Enum getEventType() { PX_ASSERT( false ); return EventTypes::Unknown; } + + //Relative profile event means this event is sharing the context and thread id + //with the event before it. + struct RelativeProfileEvent + { + uint64_t mTensOfNanoSeconds; //timestamp is in tensOfNanonseconds + void init( uint64_t inTs ) { mTensOfNanoSeconds = inTs; } + void init( const RelativeProfileEvent& inData ) { mTensOfNanoSeconds = inData.mTensOfNanoSeconds; } + bool operator==( const RelativeProfileEvent& other ) const + { + return mTensOfNanoSeconds == other.mTensOfNanoSeconds; + } + template + uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) + { + return inStream.streamify( "TensOfNanoSeconds", mTensOfNanoSeconds, inHeader.getTimestampCompressionFlags() ); + } + uint64_t getTimestamp() const { return mTensOfNanoSeconds; } + void setTimestamp( uint64_t inTs ) { mTensOfNanoSeconds = inTs; } + void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp ) + { + mTensOfNanoSeconds = inHeader.compressTimestamp( inLastTimestamp, mTensOfNanoSeconds ); + } + + uint32_t getEventSize(const EventHeader& inHeader) + { + uint32_t size = 0; + switch (inHeader.getTimestampCompressionFlags()) + { + case EventStreamCompressionFlags::U8: + size = 1; + break; + case EventStreamCompressionFlags::U16: + size = 2; + break; + case EventStreamCompressionFlags::U32: + size = 4; + break; + case EventStreamCompressionFlags::U64: + size = 8; + break; + } + return size; + } + }; + + //Start version of the relative event. + struct RelativeStartEvent : public RelativeProfileEvent + { + void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); } + void init( const RelativeStartEvent& inData ) { RelativeProfileEvent::init( inData ); } + template + void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const + { + inHdlr->onStartEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds ); + } + }; + + template<> inline EventTypes::Enum getEventType() { return EventTypes::RelativeStartEvent; } + + //Stop version of relative event. + struct RelativeStopEvent : public RelativeProfileEvent + { + void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); } + void init( const RelativeStopEvent& inData ) { RelativeProfileEvent::init( inData ); } + template + void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const + { + inHdlr->onStopEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds ); + } + }; + + template<> inline EventTypes::Enum getEventType() { return EventTypes::RelativeStopEvent; } + + struct EventContextInformation + { + uint64_t mContextId; + uint32_t mThreadId; //Thread this event was taken from + uint8_t mThreadPriority; + uint8_t mCpuId; + + void init( uint32_t inThreadId = UINT32_MAX + , uint64_t inContextId = (uint64_t(-1)) + , uint8_t inPriority = UINT8_MAX + , uint8_t inCpuId = UINT8_MAX ) + { + mContextId = inContextId; + mThreadId = inThreadId; + mThreadPriority = inPriority; + mCpuId = inCpuId; + } + + void init( const EventContextInformation& inData ) + { + mContextId = inData.mContextId; + mThreadId = inData.mThreadId; + mThreadPriority = inData.mThreadPriority; + mCpuId = inData.mCpuId; + } + + template + uint32_t streamify( TStreamType& inStream, EventStreamCompressionFlags::Enum inContextIdFlags ) + { + uint32_t writtenSize = inStream.streamify( "ThreadId", mThreadId ); + writtenSize += inStream.streamify("ContextId", mContextId, inContextIdFlags); + writtenSize += inStream.streamify("ThreadPriority", mThreadPriority); + writtenSize += inStream.streamify("CpuId", mCpuId); + return writtenSize; + } + + bool operator==( const EventContextInformation& other ) const + { + return mThreadId == other.mThreadId + && mContextId == other.mContextId + && mThreadPriority == other.mThreadPriority + && mCpuId == other.mCpuId; + } + + void setToDefault() + { + *this = EventContextInformation(); + } + }; + + //Profile event contains all the data required to tell the profile what is going + //on. + struct ProfileEvent + { + EventContextInformation mContextInformation; + RelativeProfileEvent mTimeData; //timestamp in seconds. + void init( uint32_t inThreadId, uint64_t inContextId, uint8_t inCpuId, uint8_t inPriority, uint64_t inTs ) + { + mContextInformation.init( inThreadId, inContextId, inPriority, inCpuId ); + mTimeData.init( inTs ); + } + + void init( const ProfileEvent& inData ) + { + mContextInformation.init( inData.mContextInformation ); + mTimeData.init( inData.mTimeData ); + } + + bool operator==( const ProfileEvent& other ) const + { + return mContextInformation == other.mContextInformation + && mTimeData == other.mTimeData; + } + + template + uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) + { + uint32_t writtenSize = mContextInformation.streamify(inStream, inHeader.getContextIdCompressionFlags()); + writtenSize += mTimeData.streamify(inStream, inHeader); + return writtenSize; + } + + uint32_t getEventSize(const EventHeader& inHeader) + { + uint32_t eventSize = 0; + // time is stored depending on the conpress flag mTimeData.streamify(inStream, inHeader); + switch (inHeader.getTimestampCompressionFlags()) + { + case EventStreamCompressionFlags::U8: + eventSize++; + break; + case EventStreamCompressionFlags::U16: + eventSize += 2; + break; + case EventStreamCompressionFlags::U32: + eventSize += 4; + break; + case EventStreamCompressionFlags::U64: + eventSize += 8; + break; + } + + // context information + // mContextInformation.streamify( inStream, inHeader.getContextIdCompressionFlags() ); + eventSize += 6; // uint32_t mThreadId; uint8_t mThreadPriority; uint8_t mCpuId; + switch (inHeader.getContextIdCompressionFlags()) + { + case EventStreamCompressionFlags::U8: + eventSize++; + break; + case EventStreamCompressionFlags::U16: + eventSize += 2; + break; + case EventStreamCompressionFlags::U32: + eventSize += 4; + break; + case EventStreamCompressionFlags::U64: + eventSize += 8; + break; + } + + return eventSize; + } + + uint64_t getTimestamp() const { return mTimeData.getTimestamp(); } + void setTimestamp( uint64_t inTs ) { mTimeData.setTimestamp( inTs ); } + + void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp ) + { + mTimeData.setupHeader( inHeader, inLastTimestamp ); + inHeader.setContextIdCompressionFlags( mContextInformation.mContextId ); + } + }; + + //profile start event starts the profile session. + struct StartEvent : public ProfileEvent + { + void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 ) + { + ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds ); + } + void init( const StartEvent& inData ) + { + ProfileEvent::init( inData ); + } + + RelativeStartEvent getRelativeEvent() const { RelativeStartEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; } + EventTypes::Enum getRelativeEventType() const { return getEventType(); } + }; + + template<> inline EventTypes::Enum getEventType() { return EventTypes::StartEvent; } + + //Profile stop event stops the profile session. + struct StopEvent : public ProfileEvent + { + void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 ) + { + ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds ); + } + void init( const StopEvent& inData ) + { + ProfileEvent::init( inData ); + } + RelativeStopEvent getRelativeEvent() const { RelativeStopEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; } + EventTypes::Enum getRelativeEventType() const { return getEventType(); } + }; + + template<> inline EventTypes::Enum getEventType() { return EventTypes::StopEvent; } + + struct EventValue + { + uint64_t mValue; + uint64_t mContextId; + uint32_t mThreadId; + void init( int64_t inValue = 0, uint64_t inContextId = 0, uint32_t inThreadId = 0 ) + { + mValue = static_cast( inValue ); + mContextId = inContextId; + mThreadId = inThreadId; + } + + void init( const EventValue& inData ) + { + mValue = inData.mValue; + mContextId = inData.mContextId; + mThreadId = inData.mThreadId; + } + + int64_t getValue() const { return static_cast( mValue ); } + + void setupHeader( EventHeader& inHeader ) + { + mValue = inHeader.compressTimestamp( 0, mValue ); + inHeader.setContextIdCompressionFlags( mContextId ); + } + + template + uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) + { + uint32_t writtenSize = inStream.streamify("Value", mValue, inHeader.getTimestampCompressionFlags()); + writtenSize += inStream.streamify("ContextId", mContextId, inHeader.getContextIdCompressionFlags()); + writtenSize += inStream.streamify("ThreadId", mThreadId); + return writtenSize; + } + + uint32_t getEventSize(const EventHeader& inHeader) + { + uint32_t eventSize = 0; + // value + switch (inHeader.getTimestampCompressionFlags()) + { + case EventStreamCompressionFlags::U8: + eventSize++; + break; + case EventStreamCompressionFlags::U16: + eventSize += 2; + break; + case EventStreamCompressionFlags::U32: + eventSize += 4; + break; + case EventStreamCompressionFlags::U64: + eventSize += 8; + break; + } + + // context information + switch (inHeader.getContextIdCompressionFlags()) + { + case EventStreamCompressionFlags::U8: + eventSize++; + break; + case EventStreamCompressionFlags::U16: + eventSize += 2; + break; + case EventStreamCompressionFlags::U32: + eventSize += 4; + break; + case EventStreamCompressionFlags::U64: + eventSize += 8; + break; + } + + eventSize += 4; // uint32_t mThreadId; + + return eventSize; + } + + bool operator==( const EventValue& other ) const + { + return mValue == other.mValue + && mContextId == other.mContextId + && mThreadId == other.mThreadId; + } + + template + void handle( THandlerType* inHdlr, uint16_t eventId ) const + { + inHdlr->onEventValue( PxProfileEventId( eventId ), mThreadId, mContextId, getValue() ); + } + + }; + template<> inline EventTypes::Enum getEventType() { return EventTypes::EventValue; } + + //obsolete, placeholder to skip data from PhysX SDKs < 3.4 + struct CUDAProfileBuffer + { + uint64_t mTimestamp; + float mTimespan; + const uint8_t* mCudaData; + uint32_t mBufLen; + uint32_t mVersion; + + template + uint32_t streamify( TStreamType& inStream, const EventHeader& ) + { + uint32_t writtenSize = inStream.streamify("Timestamp", mTimestamp); + writtenSize += inStream.streamify("Timespan", mTimespan); + writtenSize += inStream.streamify("CudaData", mCudaData, mBufLen); + writtenSize += inStream.streamify("BufLen", mBufLen); + writtenSize += inStream.streamify("Version", mVersion); + return writtenSize; + } + + bool operator==( const CUDAProfileBuffer& other ) const + { + return mTimestamp == other.mTimestamp + && mTimespan == other.mTimespan + && mBufLen == other.mBufLen + && memcmp( mCudaData, other.mCudaData, mBufLen ) == 0 + && mVersion == other.mVersion; + } + }; + + template<> inline EventTypes::Enum getEventType() { return EventTypes::CUDAProfileBuffer; } + + //Provides a generic equal operation for event data objects. + template + struct EventDataEqualOperator + { + TEventData mData; + EventDataEqualOperator( const TEventData& inD ) : mData( inD ) {} + template bool operator()( const TDataType& inRhs ) const { return mData.toType( Type2Type() ) == inRhs; } + bool operator()() const { return false; } + }; + + /** + * Generic event container that combines and even header with the generic event data type. + * Provides unsafe and typesafe access to the event data. + */ + class Event + { + public: + typedef PX_PROFILE_UNION_7(StartEvent, StopEvent, RelativeStartEvent, RelativeStopEvent, EventValue, CUDAProfileBuffer, uint8_t) EventData; + + private: + EventHeader mHeader; + EventData mData; + public: + Event() {} + + template + Event( EventHeader inHeader, const TDataType& inData ) + : mHeader( inHeader ) + { + mData.init(inData); + } + + template + Event( uint16_t eventId, const TDataType& inData ) + : mHeader( getEventType(), eventId ) + { + mData.init(inData); + } + const EventHeader& getHeader() const { return mHeader; } + const EventData& getData() const { return mData; } + + template + const TDataType& getValue() const { PX_ASSERT( mHeader.mEventType == getEventType() ); return mData.toType(); } + + template + TDataType& getValue() { PX_ASSERT( mHeader.mEventType == getEventType() ); return mData.toType(); } + + template + inline TRetVal visit( TOperator inOp ) const; + + bool operator==( const Event& inOther ) const + { + if ( !(mHeader == inOther.mHeader ) ) return false; + if ( mHeader.mEventType ) + return inOther.visit( EventDataEqualOperator( mData ) ); + return true; + } + }; + + //Combining the above union type with an event type means that an object can get the exact + //data out of the union. Using this function means that all callsites will be forced to + //deal with the newer datatypes and that the switch statement only exists in once place. + //Implements conversion from enum -> datatype + template + TRetVal visit( EventTypes::Enum inEventType, const Event::EventData& inData, TOperator inOperator ) + { + switch( inEventType ) + { + case EventTypes::StartEvent: return inOperator( inData.toType( Type2Type() ) ); + case EventTypes::StopEvent: return inOperator( inData.toType( Type2Type() ) ); + case EventTypes::RelativeStartEvent: return inOperator( inData.toType( Type2Type() ) ); + case EventTypes::RelativeStopEvent: return inOperator( inData.toType( Type2Type() ) ); + case EventTypes::EventValue: return inOperator( inData.toType( Type2Type() ) ); + //obsolete, placeholder to skip data from PhysX SDKs < 3.4 + case EventTypes::CUDAProfileBuffer: return inOperator( inData.toType( Type2Type() ) ); + case EventTypes::Unknown: break; + } + uint8_t type = static_cast( inEventType ); + return inOperator( type ); + } + + template + inline TRetVal Event::visit( TOperator inOp ) const + { + return physx::profile::visit( static_cast(mHeader.mEventType), mData, inOp ); + } +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemory.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemory.h new file mode 100644 index 0000000..44f9a7c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemory.h @@ -0,0 +1,90 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_MEMORY_H +#define PX_PROFILE_MEMORY_H + +#include "PxProfileEventBufferClientManager.h" +#include "PxProfileEventSender.h" +#include "foundation/PxBroadcast.h" + +namespace physx { namespace profile { + + /** + \brief Record events so a late-connecting client knows about + all outstanding allocations + */ + class PxProfileMemoryEventRecorder : public PxAllocationListener + { + protected: + virtual ~PxProfileMemoryEventRecorder(){} + public: + /** + \brief Set the allocation listener + \param inListener Allocation listener. + */ + virtual void setListener(PxAllocationListener* inListener) = 0; + /** + \brief Release the instance. + */ + virtual void release() = 0; + }; + + /** + \brief Stores memory events into the memory buffer. + */ + class PxProfileMemoryEventBuffer + : public PxAllocationListener //add a new event to the buffer + , public PxProfileEventBufferClientManager //add clients to handle the serialized memory events + , public PxProfileEventFlusher //flush the buffer + { + protected: + virtual ~PxProfileMemoryEventBuffer(){} + public: + + /** + \brief Release the instance. + */ + virtual void release() = 0; + + /** + \brief Create a non-mutex-protected event buffer. + \param inAllocator Allocation callback. + \param inBufferSize Internal buffer size. + */ + static PxProfileMemoryEventBuffer& createMemoryEventBuffer(PxAllocatorCallback& inAllocator, uint32_t inBufferSize = 0x1000); + }; + + + +} } // namespace physx + + +#endif + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryBuffer.h new file mode 100644 index 0000000..42db705 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryBuffer.h @@ -0,0 +1,190 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_MEMORY_BUFFER_H +#define PX_PROFILE_MEMORY_BUFFER_H + +#include "foundation/PxAllocator.h" +#include "foundation/PxMemory.h" + +namespace physx { namespace profile { + + template::Type > + class MemoryBuffer : public TAllocator + { + uint8_t* mBegin; + uint8_t* mEnd; + uint8_t* mCapacityEnd; + + public: + MemoryBuffer( const TAllocator& inAlloc = TAllocator() ) : TAllocator( inAlloc ), mBegin( 0 ), mEnd( 0 ), mCapacityEnd( 0 ) {} + ~MemoryBuffer() + { + if ( mBegin ) TAllocator::deallocate( mBegin ); + } + uint32_t size() const { return static_cast( mEnd - mBegin ); } + uint32_t capacity() const { return static_cast( mCapacityEnd - mBegin ); } + uint8_t* begin() { return mBegin; } + uint8_t* end() { return mEnd; } + void setEnd(uint8_t* nEnd) { mEnd = nEnd; } + const uint8_t* begin() const { return mBegin; } + const uint8_t* end() const { return mEnd; } + void clear() { mEnd = mBegin; } + uint32_t write( uint8_t inValue ) + { + growBuf( 1 ); + *mEnd = inValue; + ++mEnd; + return 1; + } + + template + uint32_t write( const TDataType& inValue ) + { + uint32_t writtenSize = sizeof(TDataType); + growBuf(writtenSize); + const uint8_t* __restrict readPtr = reinterpret_cast< const uint8_t* >( &inValue ); + uint8_t* __restrict writePtr = mEnd; + for ( uint32_t idx = 0; idx < sizeof(TDataType); ++idx ) writePtr[idx] = readPtr[idx]; + mEnd += writtenSize; + return writtenSize; + } + + template + uint32_t write( const TDataType* inValue, uint32_t inLength ) + { + if ( inValue && inLength ) + { + uint32_t writeSize = inLength * sizeof( TDataType ); + growBuf( writeSize ); + PxMemCopy( mBegin + size(), inValue, writeSize ); + mEnd += writeSize; + return writeSize; + } + return 0; + } + + // used by atomic write. Store the data and write the end afterwards + // we dont check the buffer size, it should not resize on the fly + template + uint32_t write(const TDataType* inValue, uint32_t inLength, int32_t index) + { + if (inValue && inLength) + { + uint32_t writeSize = inLength * sizeof(TDataType); + PX_ASSERT(mBegin + index + writeSize < mCapacityEnd); + PxMemCopy(mBegin + index, inValue, writeSize); + return writeSize; + } + return 0; + } + + void growBuf( uint32_t inAmount ) + { + uint32_t newSize = size() + inAmount; + reserve( newSize ); + } + void resize( uint32_t inAmount ) + { + reserve( inAmount ); + mEnd = mBegin + inAmount; + } + void reserve( uint32_t newSize ) + { + uint32_t currentSize = size(); + if ( newSize >= capacity() ) + { + const uint32_t allocSize = mBegin ? newSize * 2 : newSize; + + uint8_t* newData = static_cast(TAllocator::allocate(allocSize, __FILE__, __LINE__)); + memset(newData, 0xf,allocSize); + if ( mBegin ) + { + PxMemCopy( newData, mBegin, currentSize ); + TAllocator::deallocate( mBegin ); + } + mBegin = newData; + mEnd = mBegin + currentSize; + mCapacityEnd = mBegin + allocSize; + } + } + }; + + + class TempMemoryBuffer + { + uint8_t* mBegin; + uint8_t* mEnd; + uint8_t* mCapacityEnd; + + public: + TempMemoryBuffer(uint8_t* data, int32_t size) : mBegin(data), mEnd(data), mCapacityEnd(data + size) {} + ~TempMemoryBuffer() + { + } + uint32_t size() const { return static_cast(mEnd - mBegin); } + uint32_t capacity() const { return static_cast(mCapacityEnd - mBegin); } + const uint8_t* begin() { return mBegin; } + uint8_t* end() { return mEnd; } + const uint8_t* begin() const { return mBegin; } + const uint8_t* end() const { return mEnd; } + uint32_t write(uint8_t inValue) + { + *mEnd = inValue; + ++mEnd; + return 1; + } + + template + uint32_t write(const TDataType& inValue) + { + uint32_t writtenSize = sizeof(TDataType); + const uint8_t* __restrict readPtr = reinterpret_cast(&inValue); + uint8_t* __restrict writePtr = mEnd; + for (uint32_t idx = 0; idx < sizeof(TDataType); ++idx) writePtr[idx] = readPtr[idx]; + mEnd += writtenSize; + return writtenSize; + } + + template + uint32_t write(const TDataType* inValue, uint32_t inLength) + { + if (inValue && inLength) + { + uint32_t writeSize = inLength * sizeof(TDataType); + PxMemCopy(mBegin + size(), inValue, writeSize); + mEnd += writeSize; + return writeSize; + } + return 0; + } + }; + +}} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEventBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEventBuffer.h new file mode 100644 index 0000000..1390718 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEventBuffer.h @@ -0,0 +1,156 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_MEMORY_EVENT_BUFFER_H +#define PX_PROFILE_MEMORY_EVENT_BUFFER_H + +#include "PxProfileDataBuffer.h" +#include "PxProfileMemoryEvents.h" +#include "PxProfileMemory.h" +#include "PxProfileScopedMutexLock.h" +#include "PxProfileAllocatorWrapper.h" +#include "PxProfileEventMutex.h" + +#include "foundation/PxHash.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxUserAllocated.h" + +namespace physx { namespace profile { + + template + class MemoryEventBuffer : public DataBuffer + { + public: + typedef DataBuffer TBaseType; + typedef typename TBaseType::TMutexType TMutexType; + typedef typename TBaseType::TScopedLockType TScopedLockType; + typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; + typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; + typedef typename TBaseType::TBufferClientArray TBufferClientArray; + typedef PxHashMap, TU8AllocatorType> TCharPtrToHandleMap; + + protected: + TCharPtrToHandleMap mStringTable; + + public: + + MemoryEventBuffer( PxAllocatorCallback& cback + , uint32_t inBufferFullAmount + , TMutexType* inBufferMutex ) + : TBaseType( &cback, inBufferFullAmount, inBufferMutex, "struct physx::profile::MemoryEvent" ) + , mStringTable( TU8AllocatorType( TBaseType::getWrapper(), "MemoryEventStringBuffer" ) ) + { + } + + uint32_t getHandle( const char* inData ) + { + if ( inData == NULL ) inData = ""; + const typename TCharPtrToHandleMap::Entry* result( mStringTable.find( inData ) ); + if ( result ) + return result->second; + uint32_t hdl = mStringTable.size() + 1; + mStringTable.insert( inData, hdl ); + StringTableEvent theEvent; + theEvent.init( inData, hdl ); + sendEvent( theEvent ); + return hdl; + } + + void onAllocation( size_t inSize, const char* inType, const char* inFile, uint32_t inLine, uint64_t addr ) + { + if ( addr == 0 ) + return; + uint32_t typeHdl( getHandle( inType ) ); + uint32_t fileHdl( getHandle( inFile ) ); + AllocationEvent theEvent; + theEvent.init( inSize, typeHdl, fileHdl, inLine, addr ); + sendEvent( theEvent ); + } + + void onDeallocation( uint64_t addr ) + { + if ( addr == 0 ) + return; + DeallocationEvent theEvent; + theEvent.init( addr ); + sendEvent( theEvent ); + } + + void flushProfileEvents() + { + TBaseType::flushEvents(); + } + + protected: + + template + void sendEvent( TDataType inType ) + { + MemoryEventHeader theHeader( getMemoryEventType() ); + inType.setup( theHeader ); + theHeader.streamify( TBaseType::mSerializer ); + inType.streamify( TBaseType::mSerializer, theHeader ); + if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount ) + flushProfileEvents(); + } + }; + + class PxProfileMemoryEventBufferImpl : public PxUserAllocated + , public PxProfileMemoryEventBuffer + { + typedef MemoryEventBuffer TMemoryBufferType; + TMemoryBufferType mBuffer; + + public: + PxProfileMemoryEventBufferImpl( PxAllocatorCallback& alloc, uint32_t inBufferFullAmount ) + : mBuffer( alloc, inBufferFullAmount, NULL ) + { + } + + virtual void onAllocation( size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory ) + { + mBuffer.onAllocation( size, typeName, filename, uint32_t(line), static_cast(reinterpret_cast(allocatedMemory)) ); + } + virtual void onDeallocation( void* allocatedMemory ) + { + mBuffer.onDeallocation(static_cast(reinterpret_cast(allocatedMemory)) ); + } + + virtual void addClient( PxProfileEventBufferClient& inClient ) { mBuffer.addClient( inClient ); } + virtual void removeClient( PxProfileEventBufferClient& inClient ) { mBuffer.removeClient( inClient ); } + virtual bool hasClients() const { return mBuffer.hasClients(); } + + virtual void flushProfileEvents() { mBuffer.flushProfileEvents(); } + + virtual void release(){ PX_PROFILE_DELETE( mBuffer.getWrapper().getAllocator(), this ); } + }; +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEvents.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEvents.h new file mode 100644 index 0000000..26e846b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileMemoryEvents.h @@ -0,0 +1,410 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_MEMORY_EVENTS_H +#define PX_PROFILE_MEMORY_EVENTS_H + +#include "PxProfileEvents.h" + +//Memory events define their own event stream + +namespace physx { namespace profile { + struct MemoryEventTypes + { + enum Enum + { + Unknown = 0, + StringTableEvent, //introduce a new mapping of const char* -> integer + AllocationEvent, + DeallocationEvent, + FullAllocationEvent + }; + }; + + template + inline unsigned char convertToNBits( TDataType inType ) + { + uint8_t conversion = static_cast( inType ); + PX_ASSERT( conversion < (1 << numBits) ); + return conversion; + } + + template + inline unsigned char convertToTwoBits( TDataType inType ) + { + return convertToNBits<2>( inType ); + } + + template + inline unsigned char convertToFourBits( TDataType inType ) + { + return convertToNBits<4>( inType ); + } + + inline EventStreamCompressionFlags::Enum fromNumber( uint8_t inNum ) { return static_cast( inNum ); } + + template + inline void compileCheckSize() + { + PX_COMPILE_TIME_ASSERT( lhs <= rhs ); + } + + //Used for predictable bit fields. + template + struct BitMaskSetter + { + //Create a mask that masks out the orginal value shift into place + static TDataType createOffsetMask() { return TDataType(createMask() << TOffset); } + //Create a mask of TNumBits number of tis + static TDataType createMask() { return static_cast((1 << TNumBits) - 1); } + void setValue( TDataType& inCurrent, TInputType inData ) + { + PX_ASSERT( inData < ( 1 << TNumBits ) ); + + //Create a mask to remove the current value. + TDataType theMask = TDataType(~(createOffsetMask())); + //Clear out current value. + inCurrent = TDataType(inCurrent & theMask); + //Create the new value. + TDataType theAddition = static_cast( inData << TOffset ); + //or it into the existing value. + inCurrent = TDataType(inCurrent | theAddition); + } + + TInputType getValue( TDataType inCurrent ) + { + return static_cast( ( inCurrent >> TOffset ) & createMask() ); + } + }; + + + struct MemoryEventHeader + { + uint16_t mValue; + + typedef BitMaskSetter TTypeBitmask; + typedef BitMaskSetter TAddrCompressBitmask; + typedef BitMaskSetter TTypeCompressBitmask; + typedef BitMaskSetter TFnameCompressBitmask; + typedef BitMaskSetter TSizeCompressBitmask; + typedef BitMaskSetter TLineCompressBitmask; + + //That leaves size as the only thing not compressed usually. + + MemoryEventHeader( MemoryEventTypes::Enum inType = MemoryEventTypes::Unknown ) + : mValue( 0 ) + { + uint8_t defaultCompression( convertToTwoBits( EventStreamCompressionFlags::U64 ) ); + TTypeBitmask().setValue( mValue, convertToFourBits( inType ) ); + TAddrCompressBitmask().setValue( mValue, defaultCompression ); + TTypeCompressBitmask().setValue( mValue, defaultCompression ); + TFnameCompressBitmask().setValue( mValue, defaultCompression ); + TSizeCompressBitmask().setValue( mValue, defaultCompression ); + TLineCompressBitmask().setValue( mValue, defaultCompression ); + } + + MemoryEventTypes::Enum getType() const { return static_cast( TTypeBitmask().getValue( mValue ) ); } + +#define DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( name ) \ + void set##name( EventStreamCompressionFlags::Enum inEnum ) { T##name##Bitmask().setValue( mValue, convertToTwoBits( inEnum ) ); } \ + EventStreamCompressionFlags::Enum get##name() const { return fromNumber( T##name##Bitmask().getValue( mValue ) ); } + + DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( AddrCompress ) + DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( TypeCompress ) + DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( FnameCompress ) + DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( SizeCompress ) + DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( LineCompress ) + +#undef DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR + + bool operator==( const MemoryEventHeader& inOther ) const + { + return mValue == inOther.mValue; + } + template + void streamify( TStreamType& inStream ) + { + inStream.streamify( "Header", mValue ); + } + }; + + //Declaration of type level getMemoryEventType function that maps enumeration event types to datatypes + template + inline MemoryEventTypes::Enum getMemoryEventType() { PX_ASSERT( false ); return MemoryEventTypes::Unknown; } + + inline bool safeStrEq( const char* lhs, const char* rhs ) + { + if ( lhs == rhs ) + return true; + //If they aren't equal, and one of them is null, + //then they can't be equal. + //This is assuming that the null char* is not equal to + //the empty "" char*. + if ( !lhs || !rhs ) + return false; + + return ::strcmp( lhs, rhs ) == 0; + } + + struct StringTableEvent + { + const char* mString; + uint32_t mHandle; + + void init( const char* inStr = "", uint32_t inHdl = 0 ) + { + mString = inStr; + mHandle = inHdl; + } + + void init( const StringTableEvent& inData ) + { + mString = inData.mString; + mHandle = inData.mHandle; + } + + bool operator==( const StringTableEvent& inOther ) const + { + return mHandle == inOther.mHandle + && safeStrEq( mString, inOther.mString ); + } + + void setup( MemoryEventHeader& ) const {} + + template + void streamify( TStreamType& inStream, const MemoryEventHeader& ) + { + inStream.streamify( "String", mString ); + inStream.streamify( "Handle", mHandle ); + } + }; + template<> inline MemoryEventTypes::Enum getMemoryEventType() { return MemoryEventTypes::StringTableEvent; } + + struct MemoryEventData + { + uint64_t mAddress; + void init( uint64_t addr ) + { + mAddress = addr; + } + + void init( const MemoryEventData& inData) + { + mAddress = inData.mAddress; + } + + bool operator==( const MemoryEventData& inOther ) const + { + return mAddress == inOther.mAddress; + } + + void setup( MemoryEventHeader& inHeader ) const + { + inHeader.setAddrCompress( findCompressionValue( mAddress ) ); + } + + template + void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader ) + { + inStream.streamify( "Address", mAddress, inHeader.getAddrCompress() ); + } + }; + + struct AllocationEvent : public MemoryEventData + { + uint32_t mSize; + uint32_t mType; + uint32_t mFile; + uint32_t mLine; + void init( size_t size = 0, uint32_t type = 0, uint32_t file = 0, uint32_t line = 0, uint64_t addr = 0 ) + { + MemoryEventData::init( addr ); + mSize = static_cast( size ); + mType = type; + mFile = file; + mLine = line; + } + + void init( const AllocationEvent& inData ) + { + MemoryEventData::init( inData ); + mSize = inData.mSize; + mType = inData.mType; + mFile = inData.mFile; + mLine = inData.mLine; + } + + bool operator==( const AllocationEvent& inOther ) const + { + return MemoryEventData::operator==( inOther ) + && mSize == inOther.mSize + && mType == inOther.mType + && mFile == inOther.mFile + && mLine == inOther.mLine; + } + + void setup( MemoryEventHeader& inHeader ) const + { + inHeader.setTypeCompress( findCompressionValue( mType ) ); + inHeader.setFnameCompress( findCompressionValue( mFile ) ); + inHeader.setSizeCompress( findCompressionValue( mSize ) ); + inHeader.setLineCompress( findCompressionValue( mLine ) ); + MemoryEventData::setup( inHeader ); + } + + template + void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader ) + { + inStream.streamify( "Size", mSize, inHeader.getSizeCompress() ); + inStream.streamify( "Type", mType, inHeader.getTypeCompress() ); + inStream.streamify( "File", mFile, inHeader.getFnameCompress() ); + inStream.streamify( "Line", mLine, inHeader.getLineCompress() ); + MemoryEventData::streamify( inStream, inHeader ); + } + }; + template<> inline MemoryEventTypes::Enum getMemoryEventType() { return MemoryEventTypes::AllocationEvent; } + + + struct FullAllocationEvent : public MemoryEventData + { + size_t mSize; + const char* mType; + const char* mFile; + uint32_t mLine; + void init( size_t size, const char* type, const char* file, uint32_t line, uint64_t addr ) + { + MemoryEventData::init( addr ); + mSize = size; + mType = type; + mFile = file; + mLine = line; + } + + void init( const FullAllocationEvent& inData ) + { + MemoryEventData::init( inData ); + mSize = inData.mSize; + mType = inData.mType; + mFile = inData.mFile; + mLine = inData.mLine; + } + + bool operator==( const FullAllocationEvent& inOther ) const + { + return MemoryEventData::operator==( inOther ) + && mSize == inOther.mSize + && safeStrEq( mType, inOther.mType ) + && safeStrEq( mFile, inOther.mFile ) + && mLine == inOther.mLine; + } + + void setup( MemoryEventHeader& ) const {} + }; + + template<> inline MemoryEventTypes::Enum getMemoryEventType() { return MemoryEventTypes::FullAllocationEvent; } + + struct DeallocationEvent : public MemoryEventData + { + void init( uint64_t addr = 0 ) { MemoryEventData::init( addr ); } + void init( const DeallocationEvent& inData ) { MemoryEventData::init( inData ); } + }; + + template<> inline MemoryEventTypes::Enum getMemoryEventType() { return MemoryEventTypes::DeallocationEvent; } + + class MemoryEvent + { + public: + typedef PX_PROFILE_UNION_5(StringTableEvent, AllocationEvent, DeallocationEvent, FullAllocationEvent, uint8_t) EventData; + + private: + MemoryEventHeader mHeader; + EventData mData; + public: + + MemoryEvent() {} + MemoryEvent( MemoryEventHeader inHeader, const EventData& inData = EventData() ) + : mHeader( inHeader ) + , mData( inData ) + { + } + + template + MemoryEvent( const TDataType& inType ) + : mHeader( getMemoryEventType() ) + , mData( inType ) + { + //set the appropriate compression bits. + inType.setup( mHeader ); + } + const MemoryEventHeader& getHeader() const { return mHeader; } + const EventData& getData() const { return mData; } + + template + const TDataType& getValue() const { PX_ASSERT( mHeader.getType() == getMemoryEventType() ); return mData.toType(); } + + template + TDataType& getValue() { PX_ASSERT( mHeader.getType() == getMemoryEventType() ); return mData.toType(); } + + template + inline TRetVal visit( TOperator inOp ) const; + + bool operator==( const MemoryEvent& inOther ) const + { + if ( !(mHeader == inOther.mHeader ) ) return false; + if ( mHeader.getType() ) + return inOther.visit( EventDataEqualOperator( mData ) ); + return true; + } + }; + + template + inline TRetVal visit( MemoryEventTypes::Enum inEventType, const MemoryEvent::EventData& inData, TOperator inOperator ) + { + switch( inEventType ) + { + case MemoryEventTypes::StringTableEvent: return inOperator( inData.toType( Type2Type() ) ); + case MemoryEventTypes::AllocationEvent: return inOperator( inData.toType( Type2Type() ) ); + case MemoryEventTypes::DeallocationEvent: return inOperator( inData.toType( Type2Type() ) ); + case MemoryEventTypes::FullAllocationEvent: return inOperator( inData.toType( Type2Type() ) ); + case MemoryEventTypes::Unknown: return inOperator( static_cast( inEventType ) ); + } + return TRetVal(); + } + + template + inline TRetVal MemoryEvent::visit( TOperator inOp ) const + { + return physx::profile::visit( mHeader.getType(), mData, inOp ); + } +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedEvent.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedEvent.h new file mode 100644 index 0000000..0f92544 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedEvent.h @@ -0,0 +1,107 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_SCOPED_EVENT_H +#define PX_PROFILE_SCOPED_EVENT_H + +#include "PxProfileEventId.h" +#include "PxProfileCompileTimeEventFilter.h" + +namespace physx { namespace profile { + + /** + \brief Template version of startEvent, called directly on provided profile buffer. + + \param inBuffer Profile event buffer. + \param inId Profile event id. + \param inContext Profile event context. + */ + template + inline void startEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) + { + if ( TEnabled && inBuffer ) inBuffer->startEvent( inId, inContext ); + } + + /** + \brief Template version of stopEvent, called directly on provided profile buffer. + + \param inBuffer Profile event buffer. + \param inId Profile event id. + \param inContext Profile event context. + */ + template + inline void stopEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) + { + if ( TEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext ); + } + + /** + \brief Template version of startEvent, called directly on provided profile buffer. + + \param inEnabled If profile event is enabled. + \param inBuffer Profile event buffer. + \param inId Profile event id. + \param inContext Profile event context. + */ + template + inline void startEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) + { + if ( inEnabled && inBuffer ) inBuffer->startEvent( inId, inContext ); + } + + /** + \brief Template version of stopEvent, called directly on provided profile buffer. + + \param inEnabled If profile event is enabled. + \param inBuffer Profile event buffer. + \param inId Profile event id. + \param inContext Profile event context. + */ + template + inline void stopEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) + { + if ( inEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext ); + } + + /** + \brief Template version of eventValue, called directly on provided profile buffer. + + \param inEnabled If profile event is enabled. + \param inBuffer Profile event buffer. + \param inId Profile event id. + \param inContext Profile event context. + \param inValue Event value. + */ + template + inline void eventValue( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext, int64_t inValue ) + { + if ( inEnabled && inBuffer ) inBuffer->eventValue( inId, inContext, inValue ); + } + +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedMutexLock.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedMutexLock.h new file mode 100644 index 0000000..2bf4844 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileScopedMutexLock.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_SCOPED_MUTEX_LOCK_H +#define PX_PROFILE_SCOPED_MUTEX_LOCK_H + +#include "foundation/Px.h" + +namespace physx { namespace profile { + + /** + * Generic class to wrap any mutex type that has lock and unlock methods + */ + template + struct ScopedLockImpl + { + TMutexType* mMutex; + ScopedLockImpl( TMutexType* inM ) : mMutex( inM ) + { + if ( mMutex ) mMutex->lock(); + } + ~ScopedLockImpl() + { + if ( mMutex ) mMutex->unlock(); + } + }; + + /** + * Null locking system that does nothing. + */ + struct NullLock + { + template NullLock( TDataType*) {} + }; +}} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneImpl.h new file mode 100644 index 0000000..b7322de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneImpl.h @@ -0,0 +1,314 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_ZONE_IMPL_H +#define PX_PROFILE_ZONE_IMPL_H + +#include "PxPvdProfileZone.h" +#include "PxProfileZoneManager.h" +#include "PxProfileContextProviderImpl.h" +#include "PxProfileScopedMutexLock.h" +#include "PxProfileEventBufferAtomic.h" +#include "foundation/PxMutex.h" + +namespace physx { namespace profile { + + /** + \brief Simple event filter that enables all events. + */ + struct PxProfileNullEventFilter + { + void setEventEnabled( const PxProfileEventId&, bool) { PX_ASSERT(false); } + bool isEventEnabled( const PxProfileEventId&) const { return true; } + }; + + typedef PxMutexT > TZoneMutexType; + typedef ScopedLockImpl TZoneLockType; + typedef EventBuffer< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType; + //typedef EventBufferAtomic< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType; + + template + class ZoneImpl : TZoneEventBufferType //private inheritance intended + , public PxProfileZone + , public PxProfileEventBufferClient + { + typedef PxMutexT > TMutexType; + typedef PxProfileHashMap TNameToEvtIndexMap; + //ensure we don't reuse event ids. + typedef PxProfileHashMap TEvtIdToNameMap; + typedef TMutexType::ScopedLock TLockType; + + + const char* mName; + mutable TMutexType mMutex; + PxProfileArray mEventNames; + // to avoid locking, read-only and read-write map exist + TNameToEvtIndexMap mNameToEvtIndexMapR; + TNameToEvtIndexMap mNameToEvtIndexMapRW; + //ensure we don't reuse event ids. + TEvtIdToNameMap mEvtIdToNameMap; + + PxProfileZoneManager* mProfileZoneManager; + + PxProfileArray mZoneClients; + volatile bool mEventsActive; + + PX_NOCOPY(ZoneImpl) + public: + ZoneImpl( PxAllocatorCallback* inAllocator, const char* inName, uint32_t bufferSize = 0x10000 /*64k*/, const TNameProvider& inProvider = TNameProvider() ) + : TZoneEventBufferType( inAllocator, bufferSize, PxDefaultContextProvider(), NULL, PxProfileNullEventFilter() ) + , mName( inName ) + , mMutex( PxProfileWrapperReflectionAllocator( mWrapper ) ) + , mEventNames( mWrapper ) + , mNameToEvtIndexMapR( mWrapper ) + , mNameToEvtIndexMapRW( mWrapper ) + , mEvtIdToNameMap( mWrapper ) + , mProfileZoneManager( NULL ) + , mZoneClients( mWrapper ) + , mEventsActive( false ) + { + TZoneEventBufferType::setBufferMutex( &mMutex ); + //Initialize the event name structure with existing names from the name provider. + PxProfileNames theNames( inProvider.getProfileNames() ); + for ( uint32_t idx = 0; idx < theNames.eventCount; ++idx ) + { + const PxProfileEventName& theName (theNames.events[idx]); + doAddName( theName.name, theName.eventId.eventId, theName.eventId.compileTimeEnabled ); + } + TZoneEventBufferType::addClient( *this ); + } + + virtual ~ZoneImpl() { + if ( mProfileZoneManager != NULL ) + mProfileZoneManager->removeProfileZone( *this ); + mProfileZoneManager = NULL; + TZoneEventBufferType::removeClient( *this ); + } + + void doAddName( const char* inName, uint16_t inEventId, bool inCompileTimeEnabled ) + { + TLockType theLocker( mMutex ); + mEvtIdToNameMap.insert( inEventId, inName ); + uint32_t idx = static_cast( mEventNames.size() ); + mNameToEvtIndexMapRW.insert( inName, idx ); + mEventNames.pushBack( PxProfileEventName( inName, PxProfileEventId( inEventId, inCompileTimeEnabled ) ) ); + } + + virtual void flushEventIdNameMap() + { + // copy the RW map into R map + if (mNameToEvtIndexMapRW.size()) + { + for (TNameToEvtIndexMap::Iterator iter = mNameToEvtIndexMapRW.getIterator(); !iter.done(); ++iter) + { + mNameToEvtIndexMapR.insert(iter->first, iter->second); + } + mNameToEvtIndexMapRW.clear(); + } + } + + virtual uint16_t getEventIdForName( const char* inName ) + { + return getEventIdsForNames( &inName, 1 ); + } + + virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen ) + { + if ( inLen == 0 ) + return 0; + + // search the read-only map first + const TNameToEvtIndexMap::Entry* theEntry( mNameToEvtIndexMapR.find( inNames[0] ) ); + if ( theEntry ) + return mEventNames[theEntry->second].eventId; + + TLockType theLocker(mMutex); + + const TNameToEvtIndexMap::Entry* theReEntry(mNameToEvtIndexMapRW.find(inNames[0])); + if (theReEntry) + return mEventNames[theReEntry->second].eventId; + + //Else git R dun. + uint16_t nameSize = static_cast( mEventNames.size() ); + //We don't allow 0 as an event id. + uint16_t eventId = nameSize; + //Find a contiguous set of unique event ids + bool foundAnEventId = false; + do + { + foundAnEventId = false; + ++eventId; + for ( uint16_t idx = 0; idx < inLen && foundAnEventId == false; ++idx ) + foundAnEventId = mEvtIdToNameMap.find( uint16_t(eventId + idx) ) != NULL; + } + while( foundAnEventId ); + + uint32_t clientCount = mZoneClients.size(); + for ( uint16_t nameIdx = 0; nameIdx < inLen; ++nameIdx ) + { + uint16_t newId = uint16_t(eventId + nameIdx); + doAddName( inNames[nameIdx], newId, true ); + for( uint32_t clientIdx =0; clientIdx < clientCount; ++clientIdx ) + mZoneClients[clientIdx]->handleEventAdded( PxProfileEventName( inNames[nameIdx], PxProfileEventId( newId ) ) ); + } + + return eventId; + } + + virtual void setProfileZoneManager(PxProfileZoneManager* inMgr) + { + mProfileZoneManager = inMgr; + } + + virtual PxProfileZoneManager* getProfileZoneManager() + { + return mProfileZoneManager; + } + + + + const char* getName() { return mName; } + + PxProfileEventBufferClient* getEventBufferClient() { return this; } + + //SDK implementation + + void addClient( PxProfileZoneClient& inClient ) + { + TLockType lock( mMutex ); + mZoneClients.pushBack( &inClient ); + mEventsActive = true; + } + + void removeClient( PxProfileZoneClient& inClient ) + { + TLockType lock( mMutex ); + for ( uint32_t idx =0; idx < mZoneClients.size(); ++idx ) + { + if (mZoneClients[idx] == &inClient ) + { + inClient.handleClientRemoved(); + mZoneClients.replaceWithLast( idx ); + break; + } + } + mEventsActive = mZoneClients.size() != 0; + } + + virtual bool hasClients() const + { + return mEventsActive; + } + + virtual PxProfileNames getProfileNames() const + { + TLockType theLocker( mMutex ); + const PxProfileEventName* theNames = mEventNames.begin(); + uint32_t theEventCount = uint32_t(mEventNames.size()); + return PxProfileNames( theEventCount, theNames ); + } + + virtual void release() + { + PX_PROFILE_DELETE( mWrapper.getAllocator(), this ); + } + + //Implementation chaining the buffer flush to our clients + virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) + { + TLockType theLocker( mMutex ); + + uint32_t clientCount = mZoneClients.size(); + for( uint32_t idx =0; idx < clientCount; ++idx ) + mZoneClients[idx]->handleBufferFlush( inData, inLength ); + } + //Happens if something removes all the clients from the manager. + virtual void handleClientRemoved() {} + + //Send a profile event, optionally with a context. Events are sorted by thread + //and context in the client side. + virtual void startEvent( uint16_t inId, uint64_t contextId) + { + if( mEventsActive ) + { + TZoneEventBufferType::startEvent( inId, contextId ); + } + } + virtual void stopEvent( uint16_t inId, uint64_t contextId) + { + if( mEventsActive ) + { + TZoneEventBufferType::stopEvent( inId, contextId ); + } + } + + virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId) + { + if( mEventsActive ) + { + TZoneEventBufferType::startEvent( inId, contextId, threadId ); + } + } + virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId ) + { + if( mEventsActive ) + { + TZoneEventBufferType::stopEvent( inId, contextId, threadId ); + } + } + + virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop) + { + if (mEventsActive) + { + TZoneEventBufferType::startEvent(inId, threadId, contextId, 0, 0, start); + TZoneEventBufferType::stopEvent(inId, threadId, contextId, 0, 0, stop); + } + } + + /** + * Set an specific events value. This is different than the profiling value + * for the event; it is a value recorded and kept around without a timestamp associated + * with it. This value is displayed when the event itself is processed. + */ + virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) + { + if( mEventsActive ) + { + TZoneEventBufferType::eventValue( inId, contextId, inValue ); + } + } + virtual void flushProfileEvents() + { + TZoneEventBufferType::flushProfileEvents(); + } + }; + +}} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManager.h new file mode 100644 index 0000000..5d6260d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManager.h @@ -0,0 +1,155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PROFILE_ZONE_MANAGER_H +#define PX_PROFILE_ZONE_MANAGER_H + +#include "PxProfileEventSender.h" +#include "PxProfileEventNames.h" + +namespace physx { + + class PxAllocatorCallback; + + namespace profile { + + class PxProfileZone; + class PxProfileNameProvider; + + /** + \brief Profile zone handler for zone add/remove notification. + */ + class PxProfileZoneHandler + { + protected: + virtual ~PxProfileZoneHandler(){} + public: + /** + \brief On zone added notification + + \note Not a threadsafe call; handlers are expected to be able to handle + this from any thread. + + \param inSDK Added zone. + */ + virtual void onZoneAdded( PxProfileZone& inSDK ) = 0; + /** + \brief On zone removed notification + + \note Not a threadsafe call; handlers are expected to be able to handle + this from any thread. + + \param inSDK removed zone. + */ + virtual void onZoneRemoved( PxProfileZone& inSDK ) = 0; + }; + + /** + \brief The profiling system was setup in the expectation that there would be several + systems that each had its own island of profile information. PhysX, client code, + and APEX would be the first examples of these. Each one of these islands is represented + by a profile zone. + + The Manager is a singleton-like object where all these different systems can be registered + so that clients of the profiling system can have one point to capture *all* profiling events. + + Flushing the manager implies that you want to loop through all the profile zones and flush + each one. + + @see PxProfileEventFlusher + */ + class PxProfileZoneManager + : public PxProfileEventFlusher //Tell all SDK's to flush their queue of profile events. + { + protected: + virtual ~PxProfileZoneManager(){} + public: + /** + \brief Add new profile zone for the manager. + \note Threadsafe call, can be done from any thread. Handlers that are already connected + will get a new callback on the current thread. + + \param inSDK Profile zone to add. + */ + virtual void addProfileZone( PxProfileZone& inSDK ) = 0; + /** + \brief Removes profile zone from the manager. + \note Threadsafe call, can be done from any thread. Handlers that are already connected + will get a new callback on the current thread. + + \param inSDK Profile zone to remove. + */ + virtual void removeProfileZone( PxProfileZone& inSDK ) = 0; + + /** + \brief Add profile zone handler callback for the profile zone notifications. + + \note Threadsafe call. The new handler will immediately be notified about all + known SDKs. + + \param inHandler Profile zone handler to add. + */ + virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0; + /** + \brief Removes profile zone handler callback for the profile zone notifications. + + \note Threadsafe call. The new handler will immediately be notified about all + known SDKs. + + \param inHandler Profile zone handler to remove. + */ + virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0; + + + /** + \brief Create a new profile zone. This means you don't need access to a PxFoundation to + create your profile zone object, and your object is automatically registered with + the profile zone manager. + + You still need to release your object when you are finished with it. + \param inSDKName Name of the SDK object. + \param inNames Option set of event id to name mappings. + \param inEventBufferByteSize rough maximum size of the event buffer. May exceed this size + by sizeof one event. When full an immediate call to all listeners is made. + */ + virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x4000 /*16k*/ ) = 0; + + /** + \brief Releases the profile manager instance. + */ + virtual void release() = 0; + + /** + \brief Create the profile zone manager. + \param inAllocatorCallback Allocator callback. + */ + static PxProfileZoneManager& createProfileZoneManager(PxAllocatorCallback* inAllocatorCallback ); + }; + +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManagerImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManagerImpl.h new file mode 100644 index 0000000..a1f22d0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxProfileZoneManagerImpl.h @@ -0,0 +1,172 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PROFILE_ZONE_MANAGER_IMPL_H +#define PX_PROFILE_ZONE_MANAGER_IMPL_H + +#include "PxProfileZoneManager.h" +#include "PxProfileScopedMutexLock.h" +#include "PxPvdProfileZone.h" +#include "PxProfileAllocatorWrapper.h" + +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" + +namespace physx { namespace profile { + + struct NullEventNameProvider : public PxProfileNameProvider + { + virtual PxProfileNames getProfileNames() const { return PxProfileNames( 0, 0 ); } + }; + + class ZoneManagerImpl : public PxProfileZoneManager + { + typedef ScopedLockImpl TScopedLockType; + PxProfileAllocatorWrapper mWrapper; + PxProfileArray mZones; + PxProfileArray mHandlers; + PxMutex mMutex; + + ZoneManagerImpl( const ZoneManagerImpl& inOther ); + ZoneManagerImpl& operator=( const ZoneManagerImpl& inOther ); + + public: + + ZoneManagerImpl(PxAllocatorCallback* inFoundation) + : mWrapper( inFoundation ) + , mZones( mWrapper ) + , mHandlers( mWrapper ) + {} + + virtual ~ZoneManagerImpl() + { + //This assert would mean that a profile zone is outliving us. + //This will cause a crash when the profile zone is released. + PX_ASSERT( mZones.size() == 0 ); + while( mZones.size() ) + removeProfileZone( *mZones.back() ); + } + + virtual void addProfileZone( PxProfileZone& inSDK ) + { + TScopedLockType lock( &mMutex ); + + if ( inSDK.getProfileZoneManager() != NULL ) + { + if ( inSDK.getProfileZoneManager() == this ) + return; + else //there must be two managers in the system somehow. + { + PX_ASSERT( false ); + inSDK.getProfileZoneManager()->removeProfileZone( inSDK ); + } + } + mZones.pushBack( &inSDK ); + inSDK.setProfileZoneManager( this ); + for ( uint32_t idx =0; idx < mHandlers.size(); ++idx ) + mHandlers[idx]->onZoneAdded( inSDK ); + } + + virtual void removeProfileZone( PxProfileZone& inSDK ) + { + TScopedLockType lock( &mMutex ); + if ( inSDK.getProfileZoneManager() == NULL ) + return; + + else if ( inSDK.getProfileZoneManager() != this ) + { + PX_ASSERT( false ); + inSDK.getProfileZoneManager()->removeProfileZone( inSDK ); + return; + } + + inSDK.setProfileZoneManager( NULL ); + for ( uint32_t idx = 0; idx < mZones.size(); ++idx ) + { + if ( mZones[idx] == &inSDK ) + { + for ( uint32_t handler =0; handler < mHandlers.size(); ++handler ) + mHandlers[handler]->onZoneRemoved( inSDK ); + mZones.replaceWithLast( idx ); + } + } + } + + virtual void flushProfileEvents() + { + uint32_t sdkCount = mZones.size(); + for ( uint32_t idx = 0; idx < sdkCount; ++idx ) + mZones[idx]->flushProfileEvents(); + } + + virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler ) + { + TScopedLockType lock( &mMutex ); + mHandlers.pushBack( &inHandler ); + for ( uint32_t idx = 0; idx < mZones.size(); ++idx ) + inHandler.onZoneAdded( *mZones[idx] ); + } + + virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler ) + { + TScopedLockType lock( &mMutex ); + for( uint32_t idx = 0; idx < mZones.size(); ++idx ) + inHandler.onZoneRemoved( *mZones[idx] ); + for( uint32_t idx = 0; idx < mHandlers.size(); ++idx ) + { + if ( mHandlers[idx] == &inHandler ) + mHandlers.replaceWithLast( idx ); + } + } + + virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNameProvider* inProvider, uint32_t inEventBufferByteSize ) + { + NullEventNameProvider nullProvider; + if ( inProvider == NULL ) + inProvider = &nullProvider; + return createProfileZone( inSDKName, inProvider->getProfileNames(), inEventBufferByteSize ); + } + + + virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames, uint32_t inEventBufferByteSize ) + { + PxProfileZone& retval( PxProfileZone::createProfileZone( &mWrapper.getAllocator(), inSDKName, inNames, inEventBufferByteSize ) ); + addProfileZone( retval ); + return retval; + } + + virtual void release() + { + PX_PROFILE_DELETE( mWrapper.getAllocator(), this ); + } + }; +} } + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp new file mode 100644 index 0000000..ea7e750 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvd.cpp @@ -0,0 +1,45 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdImpl.h" +namespace physx +{ +namespace pvdsdk +{ +ForwardingAllocator gForwardingAllocator; +PxAllocatorCallback* gPvdAllocatorCallback = &gForwardingAllocator; +} // namespace pvdsdk + +PxPvd* PxCreatePvd(PxFoundation& foundation) +{ + pvdsdk::gPvdAllocatorCallback = &foundation.getAllocatorCallback(); + pvdsdk::PvdImpl::initialize(); + return pvdsdk::PvdImpl::getInstance(); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdBits.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdBits.h new file mode 100644 index 0000000..20940f4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdBits.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_BITS_H +#define PX_PVD_BITS_H + +#include "PxPvdObjectModelBaseTypes.h" + +namespace physx +{ +namespace pvdsdk +{ + +// Marshallers cannot assume src is aligned, but they can assume dest is aligned. +typedef void (*TSingleMarshaller)(const uint8_t* src, uint8_t* dest); +typedef void (*TBlockMarshaller)(const uint8_t* src, uint8_t* dest, uint32_t numItems); + +template +static inline void doSwapBytes(uint8_t* __restrict inData) +{ + for(uint32_t idx = 0; idx < ByteCount / 2; ++idx) + { + uint32_t endIdx = ByteCount - idx - 1; + uint8_t theTemp = inData[idx]; + inData[idx] = inData[endIdx]; + inData[endIdx] = theTemp; + } +} + +template +static inline void doSwapBytes(uint8_t* __restrict inData, uint32_t itemCount) +{ + uint8_t* end = inData + itemCount * ByteCount; + for(; inData < end; inData += ByteCount) + doSwapBytes(inData); +} + +static inline void swapBytes(uint8_t* __restrict dataPtr, uint32_t numBytes, uint32_t itemWidth) +{ + uint32_t numItems = numBytes / itemWidth; + switch(itemWidth) + { + case 1: + break; + case 2: + doSwapBytes<2>(dataPtr, numItems); + break; + case 4: + doSwapBytes<4>(dataPtr, numItems); + break; + case 8: + doSwapBytes<8>(dataPtr, numItems); + break; + case 16: + doSwapBytes<16>(dataPtr, numItems); + break; + default: + PX_ASSERT(false); + break; + } +} + +static inline void swapBytes(uint8_t&) +{ +} +static inline void swapBytes(int8_t&) +{ +} +static inline void swapBytes(uint16_t& inData) +{ + doSwapBytes<2>(reinterpret_cast(&inData)); +} +static inline void swapBytes(int16_t& inData) +{ + doSwapBytes<2>(reinterpret_cast(&inData)); +} +static inline void swapBytes(uint32_t& inData) +{ + doSwapBytes<4>(reinterpret_cast(&inData)); +} +static inline void swapBytes(int32_t& inData) +{ + doSwapBytes<4>(reinterpret_cast(&inData)); +} +static inline void swapBytes(float& inData) +{ + doSwapBytes<4>(reinterpret_cast(&inData)); +} +static inline void swapBytes(uint64_t& inData) +{ + doSwapBytes<8>(reinterpret_cast(&inData)); +} +static inline void swapBytes(int64_t& inData) +{ + doSwapBytes<8>(reinterpret_cast(&inData)); +} +static inline void swapBytes(double& inData) +{ + doSwapBytes<8>(reinterpret_cast(&inData)); +} + +static inline bool checkLength(const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength) +{ + return static_cast(inStop - inStart) >= inLength; +} +} +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdByteStreams.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdByteStreams.h new file mode 100644 index 0000000..a5d6c5b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdByteStreams.h @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_BYTE_STREAMS_H +#define PX_PVD_BYTE_STREAMS_H + +#include "PxPvdObjectModelBaseTypes.h" + +namespace physx +{ +namespace pvdsdk +{ + +static inline uint32_t strLen(const char* inStr) +{ + uint32_t len = 0; + if(inStr) + { + while(*inStr) + { + ++len; + ++inStr; + } + } + return len; +} + +class PvdInputStream +{ + protected: + virtual ~PvdInputStream() + { + } + + public: + // Return false if you can't write the number of bytes requested + // But make an absolute best effort to read the data... + virtual bool read(uint8_t* buffer, uint32_t& len) = 0; + + template + bool read(TDataType* buffer, uint32_t numItems) + { + uint32_t expected = numItems; + uint32_t amountToRead = numItems * sizeof(TDataType); + read(reinterpret_cast(buffer), amountToRead); + numItems = amountToRead / sizeof(TDataType); + PX_ASSERT(numItems == expected); + return expected == numItems; + } + + template + PvdInputStream& operator>>(TDataType& data) + { + uint32_t dataSize = static_cast(sizeof(TDataType)); + bool success = read(reinterpret_cast(&data), dataSize); + // PX_ASSERT( success ); + // PX_ASSERT( dataSize == sizeof( data ) ); + (void)success; + return *this; + } +}; + +class PvdOutputStream +{ + protected: + virtual ~PvdOutputStream() + { + } + + public: + // Return false if you can't write the number of bytes requested + // But make an absolute best effort to write the data... + virtual bool write(const uint8_t* buffer, uint32_t len) = 0; + virtual bool directCopy(PvdInputStream& inStream, uint32_t len) = 0; + + template + bool write(const TDataType* buffer, uint32_t numItems) + { + return write(reinterpret_cast(buffer), numItems * sizeof(TDataType)); + } + + template + PvdOutputStream& operator<<(const TDataType& data) + { + bool success = write(reinterpret_cast(&data), sizeof(data)); + PX_ASSERT(success); + (void)success; + return *this; + } + + PvdOutputStream& operator<<(const char* inString) + { + if(inString && *inString) + { + uint32_t len(strLen(inString)); + write(inString, len); + } + return *this; + } +}; +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEventSink.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEventSink.h new file mode 100644 index 0000000..4500dfa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEventSink.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_COMM_STREAM_EVENT_SINK_H +#define PX_PVD_COMM_STREAM_EVENT_SINK_H + +#include "PxPvdObjectModelBaseTypes.h" +#include "PxPvdCommStreamEvents.h" +#include "PxPvdCommStreamTypes.h" + +namespace physx +{ +namespace pvdsdk +{ + +class PvdCommStreamEventSink +{ + public: + template + static void writeStreamEvent(const EventSerializeable& evt, PvdCommStreamEventTypes::Enum evtType, TStreamType& stream) + { + EventStreamifier streamifier_concrete(stream); + PvdEventSerializer& streamifier(streamifier_concrete); + streamifier.streamify(evtType); + const_cast(evt).serialize(streamifier); + } +}; + +} // pvd +} // physx +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEvents.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEvents.h new file mode 100644 index 0000000..bf29cef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamEvents.h @@ -0,0 +1,987 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_COMM_STREAM_EVENTS_H +#define PX_PVD_COMM_STREAM_EVENTS_H + +#include "foundation/PxVec3.h" +#include "foundation/PxFlags.h" +#include "foundation/PxTime.h" + +#include "PxPvdObjectModelBaseTypes.h" + +namespace physx +{ +namespace pvdsdk +{ + +struct CommStreamFlagTypes +{ + enum Enum + { + Is64BitPtr = 1 + }; +}; + +typedef PxFlags CommStreamFlags; + +template +struct PvdCommVariableSizedEventCheck +{ + bool variable_size_check; +}; + +// Pick out the events that are possibly very large. +// This helps us keep our buffers close to the size the user requested. +#define DECLARE_TYPE_VARIABLE_SIZED(type) \ + template <> \ + struct PvdCommVariableSizedEventCheck \ + { \ + uint32_t variable_size_check; \ + }; + +struct NameHandleValue; +struct StreamPropMessageArg; +struct StringHandleEvent; +struct CreateClass; +struct DeriveClass; +struct CreateProperty; +struct CreatePropertyMessage; +struct CreateInstance; +struct SetPropertyValue; +struct BeginSetPropertyValue; +struct AppendPropertyValueData; +struct EndSetPropertyValue; +struct SetPropertyMessage; +struct BeginPropertyMessageGroup; +struct SendPropertyMessageFromGroup; +struct EndPropertyMessageGroup; +struct CreateDestroyInstanceProperty; +struct PushBackObjectRef; +struct RemoveObjectRef; +struct BeginSection; +struct EndSection; +struct SetPickable; +struct SetColor; +struct SetIsTopLevel; +struct SetCamera; +struct AddProfileZone; +struct AddProfileZoneEvent; +struct StreamEndEvent; +struct ErrorMessage; +struct OriginShift; +struct DestroyInstance; + +#define DECLARE_COMM_STREAM_EVENTS \ + \ +DECLARE_PVD_COMM_STREAM_EVENT(StringHandleEvent) \ +DECLARE_PVD_COMM_STREAM_EVENT(CreateClass) \ +DECLARE_PVD_COMM_STREAM_EVENT(DeriveClass) \ +DECLARE_PVD_COMM_STREAM_EVENT(CreateProperty) \ +DECLARE_PVD_COMM_STREAM_EVENT(CreatePropertyMessage) \ +DECLARE_PVD_COMM_STREAM_EVENT(CreateInstance) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyValue) \ +DECLARE_PVD_COMM_STREAM_EVENT(BeginSetPropertyValue) \ +DECLARE_PVD_COMM_STREAM_EVENT(AppendPropertyValueData) \ +DECLARE_PVD_COMM_STREAM_EVENT(EndSetPropertyValue) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyMessage) \ +DECLARE_PVD_COMM_STREAM_EVENT(BeginPropertyMessageGroup) \ +DECLARE_PVD_COMM_STREAM_EVENT(SendPropertyMessageFromGroup) \ +DECLARE_PVD_COMM_STREAM_EVENT(EndPropertyMessageGroup) \ +DECLARE_PVD_COMM_STREAM_EVENT(DestroyInstance) \ +DECLARE_PVD_COMM_STREAM_EVENT(PushBackObjectRef) \ +DECLARE_PVD_COMM_STREAM_EVENT(RemoveObjectRef) \ +DECLARE_PVD_COMM_STREAM_EVENT(BeginSection) \ +DECLARE_PVD_COMM_STREAM_EVENT(EndSection) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetPickable) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetColor) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetIsTopLevel) \ +DECLARE_PVD_COMM_STREAM_EVENT(SetCamera) \ +DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZone) \ +DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZoneEvent) \ +DECLARE_PVD_COMM_STREAM_EVENT(StreamEndEvent) \ +DECLARE_PVD_COMM_STREAM_EVENT(ErrorMessage) \ +DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(OriginShift) + +struct PvdCommStreamEventTypes +{ + enum Enum + { + Unknown = 0, +#define DECLARE_PVD_COMM_STREAM_EVENT(x) x, +#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) x + DECLARE_COMM_STREAM_EVENTS +#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA +#undef DECLARE_PVD_COMM_STREAM_EVENT + , Last + }; +}; + +template +struct DatatypeToCommEventType +{ + bool compile_error; +}; +template +struct CommEventTypeToDatatype +{ + bool compile_error; +}; + +#define DECLARE_PVD_COMM_STREAM_EVENT(x) \ + template <> \ + struct DatatypeToCommEventType \ + { \ + enum Enum \ + { \ + EEventTypeMap = PvdCommStreamEventTypes::x \ + }; \ + }; \ + template <> \ + struct CommEventTypeToDatatype \ + { \ + typedef x TEventType; \ + }; +#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) \ + \ +template<> struct DatatypeToCommEventType \ + { \ + enum Enum \ + { \ + EEventTypeMap = PvdCommStreamEventTypes::x \ + }; \ + }; \ + \ +template<> struct CommEventTypeToDatatype \ + { \ + typedef x TEventType; \ + }; + +DECLARE_COMM_STREAM_EVENTS +#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA +#undef DECLARE_PVD_COMM_STREAM_EVENT + +template +PvdCommStreamEventTypes::Enum getCommStreamEventType() +{ + return static_cast(DatatypeToCommEventType::EEventTypeMap); +} + +struct StreamNamespacedName +{ + StringHandle mNamespace; // StringHandle handles + StringHandle mName; + StreamNamespacedName(StringHandle ns = 0, StringHandle nm = 0) : mNamespace(ns), mName(nm) + { + } +}; + +class EventSerializeable; + +class PvdEventSerializer +{ + protected: + virtual ~PvdEventSerializer() + { + } + + public: + virtual void streamify(uint8_t& val) = 0; + virtual void streamify(uint16_t& val) = 0; + virtual void streamify(uint32_t& val) = 0; + virtual void streamify(float& val) = 0; + virtual void streamify(uint64_t& val) = 0; + virtual void streamify(String& val) = 0; + virtual void streamify(DataRef& data) = 0; + virtual void streamify(DataRef& data) = 0; + virtual void streamify(DataRef& data) = 0; + virtual void streamify(DataRef& data) = 0; + + void streamify(StringHandle& hdl) + { + streamify(hdl.mHandle); + } + void streamify(CommStreamFlags& flags) + { + uint32_t val(flags); + streamify(val); + flags = CommStreamFlags(val); + } + + void streamify(PvdCommStreamEventTypes::Enum& val) + { + uint8_t detyped = static_cast(val); + streamify(detyped); + val = static_cast(detyped); + } + void streamify(PropertyType::Enum& val) + { + uint8_t detyped = static_cast(val); + streamify(detyped); + val = static_cast(detyped); + } + + void streamify(bool& val) + { + uint8_t detyped = uint8_t(val ? 1 : 0); + streamify(detyped); + val = detyped ? true : false; + } + + void streamify(StreamNamespacedName& name) + { + streamify(name.mNamespace); + streamify(name.mName); + } + + void streamify(PvdColor& color) + { + streamify(color.r); + streamify(color.g); + streamify(color.b); + streamify(color.a); + } + + void streamify(PxVec3& vec) + { + streamify(vec.x); + streamify(vec.y); + streamify(vec.z); + } + + static uint32_t measure(const EventSerializeable& evt); +}; + +class EventSerializeable +{ + protected: + virtual ~EventSerializeable() + { + } + + public: + virtual void serialize(PvdEventSerializer& serializer) = 0; +}; + +/** Numbers generated from random.org +129919156 17973702 401496246 144984007 336950759 +907025328 837150850 679717896 601529147 269478202 +*/ +struct StreamInitialization : public EventSerializeable +{ + static uint32_t getStreamId() + { + return 837150850; + } + static uint32_t getStreamVersion() + { + return 1; + } + + uint32_t mStreamId; + uint32_t mStreamVersion; + uint64_t mTimestampNumerator; + uint64_t mTimestampDenominator; + CommStreamFlags mStreamFlags; + StreamInitialization() + : mStreamId(getStreamId()) + , mStreamVersion(getStreamVersion()) + , mTimestampNumerator(physx::PxTime::getCounterFrequency().mNumerator * 10) + , mTimestampDenominator(physx::PxTime::getCounterFrequency().mDenominator) + , mStreamFlags(sizeof(void*) == 4 ? 0 : 1) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mStreamId); + s.streamify(mStreamVersion); + s.streamify(mTimestampNumerator); + s.streamify(mTimestampDenominator); + s.streamify(mStreamFlags); + } +}; + +struct EventGroup : public EventSerializeable +{ + uint32_t mDataSize; // in bytes, data directly follows this header + uint32_t mNumEvents; + uint64_t mStreamId; + uint64_t mTimestamp; + + EventGroup(uint32_t dataSize = 0, uint32_t numEvents = 0, uint64_t streamId = 0, uint64_t ts = 0) + : mDataSize(dataSize), mNumEvents(numEvents), mStreamId(streamId), mTimestamp(ts) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mDataSize); + s.streamify(mNumEvents); + s.streamify(mStreamId); + s.streamify(mTimestamp); + } +}; + +struct StringHandleEvent : public EventSerializeable +{ + String mString; + uint32_t mHandle; + StringHandleEvent(String str, uint32_t hdl) : mString(str), mHandle(hdl) + { + } + StringHandleEvent() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mString); + s.streamify(mHandle); + } +}; + +DECLARE_TYPE_VARIABLE_SIZED(StringHandleEvent) + +typedef uint64_t Timestamp; + +struct CreateClass : public EventSerializeable +{ + StreamNamespacedName mName; + CreateClass(StreamNamespacedName nm) : mName(nm) + { + } + CreateClass() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mName); + } +}; + +struct DeriveClass : public EventSerializeable +{ + StreamNamespacedName mParent; + StreamNamespacedName mChild; + + DeriveClass(StreamNamespacedName p, StreamNamespacedName c) : mParent(p), mChild(c) + { + } + DeriveClass() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mParent); + s.streamify(mChild); + } +}; + +struct NameHandleValue : public EventSerializeable +{ + StringHandle mName; + uint32_t mValue; + NameHandleValue(StringHandle name, uint32_t val) : mName(name), mValue(val) + { + } + NameHandleValue() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mName); + s.streamify(mValue); + } +}; +/*virtual PvdError createProperty( StreamNamespacedName clsName, StringHandle name, StringHandle semantic + , StreamNamespacedName dtypeName, PropertyType::Enum propertyType + , DataRef values = DataRef() ) = 0; */ +struct CreateProperty : public EventSerializeable +{ + StreamNamespacedName mClass; + StringHandle mName; + StringHandle mSemantic; + StreamNamespacedName mDatatypeName; + PropertyType::Enum mPropertyType; + DataRef mValues; + + CreateProperty(StreamNamespacedName cls, StringHandle name, StringHandle semantic, StreamNamespacedName dtypeName, + PropertyType::Enum ptype, DataRef values) + : mClass(cls), mName(name), mSemantic(semantic), mDatatypeName(dtypeName), mPropertyType(ptype), mValues(values) + { + } + CreateProperty() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mClass); + s.streamify(mName); + s.streamify(mSemantic); + s.streamify(mDatatypeName); + s.streamify(mPropertyType); + s.streamify(mValues); + } +}; + +struct StreamPropMessageArg : public EventSerializeable +{ + StringHandle mPropertyName; + StreamNamespacedName mDatatypeName; + uint32_t mMessageOffset; + uint32_t mByteSize; + StreamPropMessageArg(StringHandle pname, StreamNamespacedName dtypeName, uint32_t offset, uint32_t byteSize) + : mPropertyName(pname), mDatatypeName(dtypeName), mMessageOffset(offset), mByteSize(byteSize) + { + } + + StreamPropMessageArg() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mPropertyName); + s.streamify(mDatatypeName); + s.streamify(mMessageOffset); + s.streamify(mByteSize); + } +}; + +/* + virtual PvdError createPropertyMessage( StreamNamespacedName cls, StreamNamespacedName msgName + , DataRef entries, uint32_t messageSizeInBytes ) = + 0;*/ +struct CreatePropertyMessage : public EventSerializeable +{ + StreamNamespacedName mClass; + StreamNamespacedName mMessageName; + DataRef mMessageEntries; + uint32_t mMessageByteSize; + + CreatePropertyMessage(StreamNamespacedName cls, StreamNamespacedName msgName, DataRef propArg, + uint32_t messageByteSize) + : mClass(cls), mMessageName(msgName), mMessageEntries(propArg), mMessageByteSize(messageByteSize) + { + } + CreatePropertyMessage() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mClass); + s.streamify(mMessageName); + s.streamify(mMessageEntries); + s.streamify(mMessageByteSize); + } +}; + +/**Changing immediate data on instances*/ + +// virtual PvdError createInstance( StreamNamespacedName cls, uint64_t instance ) = 0; +struct CreateInstance : public EventSerializeable +{ + StreamNamespacedName mClass; + uint64_t mInstanceId; + + CreateInstance(StreamNamespacedName cls, uint64_t streamId) : mClass(cls), mInstanceId(streamId) + { + } + CreateInstance() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mClass); + s.streamify(mInstanceId); + } +}; + +// virtual PvdError setPropertyValue( uint64_t instance, StringHandle name, DataRef data, +// StreamNamespacedName incomingTypeName ) = 0; +struct SetPropertyValue : public EventSerializeable +{ + uint64_t mInstanceId; + StringHandle mPropertyName; + DataRef mData; + StreamNamespacedName mIncomingTypeName; + uint32_t mNumItems; + + SetPropertyValue(uint64_t instance, StringHandle name, DataRef data, + StreamNamespacedName incomingTypeName, uint32_t numItems) + : mInstanceId(instance), mPropertyName(name), mData(data), mIncomingTypeName(incomingTypeName), mNumItems(numItems) + { + } + + SetPropertyValue() + { + } + + void serializeBeginning(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mPropertyName); + s.streamify(mIncomingTypeName); + s.streamify(mNumItems); + } + + void serialize(PvdEventSerializer& s) + { + serializeBeginning(s); + s.streamify(mData); + } +}; + +DECLARE_TYPE_VARIABLE_SIZED(SetPropertyValue) + +struct BeginSetPropertyValue : public EventSerializeable +{ + uint64_t mInstanceId; + StringHandle mPropertyName; + StreamNamespacedName mIncomingTypeName; + + BeginSetPropertyValue(uint64_t instance, StringHandle name, StreamNamespacedName incomingTypeName) + : mInstanceId(instance), mPropertyName(name), mIncomingTypeName(incomingTypeName) + { + } + BeginSetPropertyValue() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mPropertyName); + s.streamify(mIncomingTypeName); + } +}; + +// virtual PvdError appendPropertyValueData( DataRef data ) = 0; +struct AppendPropertyValueData : public EventSerializeable +{ + DataRef mData; + uint32_t mNumItems; + AppendPropertyValueData(DataRef data, uint32_t numItems) : mData(data), mNumItems(numItems) + { + } + AppendPropertyValueData() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mData); + s.streamify(mNumItems); + } +}; + +DECLARE_TYPE_VARIABLE_SIZED(AppendPropertyValueData) + +// virtual PvdError endSetPropertyValue() = 0; +struct EndSetPropertyValue : public EventSerializeable +{ + EndSetPropertyValue() + { + } + + void serialize(PvdEventSerializer&) + { + } +}; + +// virtual PvdError setPropertyMessage( uint64_t instance, StreamNamespacedName msgName, DataRef data ) = +// 0; +struct SetPropertyMessage : public EventSerializeable +{ + uint64_t mInstanceId; + StreamNamespacedName mMessageName; + DataRef mData; + + SetPropertyMessage(uint64_t instance, StreamNamespacedName msgName, DataRef data) + : mInstanceId(instance), mMessageName(msgName), mData(data) + { + } + + SetPropertyMessage() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mMessageName); + s.streamify(mData); + } +}; + +DECLARE_TYPE_VARIABLE_SIZED(SetPropertyMessage) + +// virtual PvdError beginPropertyMessageGroup( StreamNamespacedName msgName ) = 0; +struct BeginPropertyMessageGroup : public EventSerializeable +{ + StreamNamespacedName mMsgName; + BeginPropertyMessageGroup(StreamNamespacedName msgName) : mMsgName(msgName) + { + } + BeginPropertyMessageGroup() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mMsgName); + } +}; + +// virtual PvdError sendPropertyMessageFromGroup( uint64_t instance, DataRef data ) = 0; +struct SendPropertyMessageFromGroup : public EventSerializeable +{ + uint64_t mInstance; + DataRef mData; + + SendPropertyMessageFromGroup(uint64_t instance, DataRef data) : mInstance(instance), mData(data) + { + } + SendPropertyMessageFromGroup() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstance); + s.streamify(mData); + } +}; + +DECLARE_TYPE_VARIABLE_SIZED(SendPropertyMessageFromGroup) + +// virtual PvdError endPropertyMessageGroup() = 0; +struct EndPropertyMessageGroup : public EventSerializeable +{ + EndPropertyMessageGroup() + { + } + + void serialize(PvdEventSerializer&) + { + } +}; + +struct PushBackObjectRef : public EventSerializeable +{ + uint64_t mInstanceId; + StringHandle mProperty; + uint64_t mObjectRef; + + PushBackObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef) + : mInstanceId(instId), mProperty(prop), mObjectRef(objRef) + { + } + + PushBackObjectRef() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mProperty); + s.streamify(mObjectRef); + } +}; + +struct RemoveObjectRef : public EventSerializeable +{ + uint64_t mInstanceId; + StringHandle mProperty; + uint64_t mObjectRef; + + RemoveObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef) + : mInstanceId(instId), mProperty(prop), mObjectRef(objRef) + { + } + + RemoveObjectRef() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mProperty); + s.streamify(mObjectRef); + } +}; + +// virtual PvdError destroyInstance( uint64_t key ) = 0; +struct DestroyInstance : public EventSerializeable +{ + uint64_t mInstanceId; + DestroyInstance(uint64_t instance) : mInstanceId(instance) + { + } + DestroyInstance() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + } +}; + +// virtual PvdError beginSection( uint64_t sectionId, StringHandle name ) = 0; +struct BeginSection : public EventSerializeable +{ + uint64_t mSectionId; + StringHandle mName; + Timestamp mTimestamp; + BeginSection(uint64_t sectionId, StringHandle name, uint64_t timestamp) + : mSectionId(sectionId), mName(name), mTimestamp(timestamp) + { + } + BeginSection() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mSectionId); + s.streamify(mName); + s.streamify(mTimestamp); + } +}; +// virtual PvdError endSection( uint64_t sectionId, StringHandle name ) = 0; +struct EndSection : public EventSerializeable +{ + uint64_t mSectionId; + StringHandle mName; + Timestamp mTimestamp; + EndSection(uint64_t sectionId, StringHandle name, uint64_t timestamp) + : mSectionId(sectionId), mName(name), mTimestamp(timestamp) + { + } + EndSection() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mSectionId); + s.streamify(mName); + s.streamify(mTimestamp); + } +}; + +// virtual void setPickable( void* instance, bool pickable ) = 0; +struct SetPickable : public EventSerializeable +{ + uint64_t mInstanceId; + bool mPickable; + SetPickable(uint64_t instId, bool pick) : mInstanceId(instId), mPickable(pick) + { + } + SetPickable() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mPickable); + } +}; +// virtual void setColor( void* instance, const PvdColor& color ) = 0; +struct SetColor : public EventSerializeable +{ + uint64_t mInstanceId; + PvdColor mColor; + SetColor(uint64_t instId, PvdColor color) : mInstanceId(instId), mColor(color) + { + } + SetColor() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mColor); + } +}; + +// virtual void setColor( void* instance, const PvdColor& color ) = 0; +struct SetIsTopLevel : public EventSerializeable +{ + uint64_t mInstanceId; + bool mIsTopLevel; + + SetIsTopLevel(uint64_t instId, bool topLevel) : mInstanceId(instId), mIsTopLevel(topLevel) + { + } + SetIsTopLevel() : mIsTopLevel(false) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mIsTopLevel); + } +}; + +struct SetCamera : public EventSerializeable +{ + String mName; + PxVec3 mPosition; + PxVec3 mUp; + PxVec3 mTarget; + SetCamera(String name, const PxVec3& pos, const PxVec3& up, const PxVec3& target) + : mName(name), mPosition(pos), mUp(up), mTarget(target) + { + } + SetCamera() : mName(NULL) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mName); + s.streamify(mPosition); + s.streamify(mUp); + s.streamify(mTarget); + } +}; + +struct ErrorMessage : public EventSerializeable +{ + uint32_t mCode; + String mMessage; + String mFile; + uint32_t mLine; + + ErrorMessage(uint32_t code, String message, String file, uint32_t line) + : mCode(code), mMessage(message), mFile(file), mLine(line) + { + } + + ErrorMessage() : mMessage(NULL), mFile(NULL) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mCode); + s.streamify(mMessage); + s.streamify(mFile); + s.streamify(mLine); + } +}; + +struct AddProfileZone : public EventSerializeable +{ + uint64_t mInstanceId; + String mName; + AddProfileZone(uint64_t iid, String nm) : mInstanceId(iid), mName(nm) + { + } + AddProfileZone() : mName(NULL) + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mName); + } +}; + +struct AddProfileZoneEvent : public EventSerializeable +{ + uint64_t mInstanceId; + String mName; + uint16_t mEventId; + bool mCompileTimeEnabled; + AddProfileZoneEvent(uint64_t iid, String nm, uint16_t eid, bool cte) + : mInstanceId(iid), mName(nm), mEventId(eid), mCompileTimeEnabled(cte) + { + } + AddProfileZoneEvent() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mName); + s.streamify(mEventId); + s.streamify(mCompileTimeEnabled); + } +}; + +struct StreamEndEvent : public EventSerializeable +{ + String mName; + StreamEndEvent() : mName("StreamEnd") + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mName); + } +}; + +struct OriginShift : public EventSerializeable +{ + uint64_t mInstanceId; + PxVec3 mShift; + + OriginShift(uint64_t iid, const PxVec3& shift) : mInstanceId(iid), mShift(shift) + { + } + OriginShift() + { + } + + void serialize(PvdEventSerializer& s) + { + s.streamify(mInstanceId); + s.streamify(mShift); + } +}; +} // pvdsdk +} // physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamTypes.h new file mode 100644 index 0000000..4001c0e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdCommStreamTypes.h @@ -0,0 +1,229 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_COMM_STREAM_TYPES_H +#define PX_PVD_COMM_STREAM_TYPES_H + +#include "foundation/PxErrorCallback.h" +#include "common/PxRenderBuffer.h" +#include "pvd/PxPvdTransport.h" + +#include "PxPvdObjectModelBaseTypes.h" +#include "PxPvdCommStreamEvents.h" +#include "PxPvdDataStream.h" +#include "foundation/PxMutex.h" + +namespace physx +{ +namespace profile +{ +class PxProfileZone; +class PxProfileMemoryEventBuffer; +} +namespace pvdsdk +{ +struct PvdErrorMessage; +class PvdObjectModelMetaData; + +DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileZone, "_debugger_", "PxProfileZone") +DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileMemoryEventBuffer, "_debugger_", "PxProfileMemoryEventBuffer") +DEFINE_PVD_TYPE_NAME_MAP(PvdErrorMessage, "_debugger_", "PvdErrorMessage") +// All event streams are on the 'events' property of objects of these types +static inline NamespacedName getMemoryEventTotalsClassName() +{ + return NamespacedName("_debugger", "MemoryEventTotals"); +} + +class PvdOMMetaDataProvider +{ + protected: + virtual ~PvdOMMetaDataProvider() + { + } + + public: + virtual void addRef() = 0; + virtual void release() = 0; + virtual PvdObjectModelMetaData& lock() = 0; + virtual void unlock() = 0; + virtual bool createInstance(const NamespacedName& clsName, const void* instance) = 0; + virtual bool isInstanceValid(const void* instance) = 0; + virtual void destroyInstance(const void* instance) = 0; + virtual int32_t getInstanceClassType(const void* instance) = 0; +}; + +class PvdCommStreamEmbeddedTypes +{ + public: + static const char* getProfileEventStreamSemantic() + { + return "profile event stream"; + } + static const char* getMemoryEventStreamSemantic() + { + return "memory event stream"; + } + static const char* getRendererEventStreamSemantic() + { + return "render event stream"; + } +}; + +class PvdCommStreamEventBufferClient; + +template +struct EventStreamifier : public PvdEventSerializer +{ + TStreamType& mBuffer; + EventStreamifier(TStreamType& buf) : mBuffer(buf) + { + } + + template + void write(const TDataType& type) + { + mBuffer.write(reinterpret_cast(&type), sizeof(TDataType)); + } + template + void write(const TDataType* type, uint32_t count) + { + mBuffer.write(reinterpret_cast(type), count * sizeof(TDataType)); + } + + void writeRef(DataRef data) + { + uint32_t amount = static_cast(data.size()); + write(amount); + write(data.begin(), amount); + } + void writeRef(DataRef data) + { + uint32_t amount = static_cast(data.size()); + write(amount); + write(data.begin(), amount); + } + template + void writeRef(DataRef data) + { + uint32_t amount = static_cast(data.size()); + write(amount); + for(uint32_t idx = 0; idx < amount; ++idx) + { + TDataType& dtype(const_cast(data[idx])); + dtype.serialize(*this); + } + } + + virtual void streamify(uint16_t& val) + { + write(val); + } + virtual void streamify(uint8_t& val) + { + write(val); + } + virtual void streamify(uint32_t& val) + { + write(val); + } + virtual void streamify(float& val) + { + write(val); + } + virtual void streamify(uint64_t& val) + { + write(val); + } + virtual void streamify(PxDebugText& val) + { + write(val.color); + write(val.position); + write(val.size); + streamify(val.string); + } + + virtual void streamify(String& val) + { + uint32_t len = 0; + String temp = nonNull(val); + if(*temp) + len = static_cast(strlen(temp) + 1); + write(len); + write(val, len); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + + private: + EventStreamifier& operator=(const EventStreamifier&); +}; + +struct MeasureStream +{ + uint32_t mSize; + MeasureStream() : mSize(0) + { + } + template + void write(const TDataType& val) + { + mSize += sizeof(val); + } + template + void write(const TDataType*, uint32_t count) + { + mSize += sizeof(TDataType) * count; + } +}; + +struct DataStreamState +{ + enum Enum + { + Open, + SetPropertyValue, + PropertyMessageGroup + }; +}; + +} // pvdsdk +} // physx +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp new file mode 100644 index 0000000..81d2e7f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDataStream.cpp @@ -0,0 +1,862 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxAssert.h" +#include "PxPvdCommStreamEventSink.h" +#include "PxPvdDataStreamHelpers.h" +#include "PxPvdObjectModelInternalTypes.h" +#include "PxPvdImpl.h" + +using namespace physx; +using namespace physx::pvdsdk; + +namespace +{ + +struct ScopedMetaData +{ + PvdOMMetaDataProvider& mProvider; + PvdObjectModelMetaData& mMeta; + ScopedMetaData(PvdOMMetaDataProvider& provider) : mProvider(provider), mMeta(provider.lock()) + { + } + ~ScopedMetaData() + { + mProvider.unlock(); + } + PvdObjectModelMetaData* operator->() + { + return &mMeta; + } + + private: + ScopedMetaData& operator=(const ScopedMetaData&); +}; + +struct PropertyDefinitionHelper : public PvdPropertyDefinitionHelper +{ + PvdDataStream* mStream; + PvdOMMetaDataProvider& mProvider; + PxArray mNameBuffer; + PxArray mNameStack; + PxArray mNamedValues; + PxArray mPropertyMessageArgs; + + PropertyDefinitionHelper(PvdOMMetaDataProvider& provider) + : mStream(NULL) + , mProvider(provider) + , mNameBuffer("PropertyDefinitionHelper::mNameBuffer") + , mNameStack("PropertyDefinitionHelper::mNameStack") + , mNamedValues("PropertyDefinitionHelper::mNamedValues") + , mPropertyMessageArgs("PropertyDefinitionHelper::mPropertyMessageArgs") + { + } + void setStream(PvdDataStream* stream) + { + mStream = stream; + } + + inline void appendStrToBuffer(const char* str) + { + if(str == NULL) + return; + size_t strLen = strlen(str); + size_t endBufOffset = mNameBuffer.size(); + size_t resizeLen = endBufOffset; + // account for null + if(mNameBuffer.empty()) + resizeLen += 1; + else + endBufOffset -= 1; + + mNameBuffer.resize(static_cast(resizeLen + strLen)); + char* endPtr = mNameBuffer.begin() + endBufOffset; + PxMemCopy(endPtr, str, static_cast(strLen)); + } + + virtual void pushName(const char* nm, const char* appender = ".") + { + size_t nameBufLen = mNameBuffer.size(); + mNameStack.pushBack(static_cast(nameBufLen)); + if(mNameBuffer.empty() == false) + appendStrToBuffer(appender); + appendStrToBuffer(nm); + mNameBuffer.back() = 0; + } + + virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") + { + size_t nameBufLen = mNameBuffer.size(); + mNameStack.pushBack(static_cast(nameBufLen)); + appendStrToBuffer(leftBracket); + appendStrToBuffer(inName); + appendStrToBuffer(rightBracket); + mNameBuffer.back() = 0; + } + + virtual void popName() + { + if(mNameStack.empty()) + return; + mNameBuffer.resize(static_cast(mNameStack.back())); + mNameStack.popBack(); + if(mNameBuffer.empty() == false) + mNameBuffer.back() = 0; + } + + virtual const char* getTopName() + { + if(mNameBuffer.size()) + return mNameBuffer.begin(); + return ""; + } + virtual void clearNameStack() + { + mNameBuffer.clear(); + mNameStack.clear(); + } + + virtual void addNamedValue(const char* name, uint32_t value) + { + mNamedValues.pushBack(NamedValue(name, value)); + } + virtual void clearNamedValues() + { + mNamedValues.clear(); + } + + virtual DataRef getNamedValues() + { + return DataRef(mNamedValues.begin(), mNamedValues.size()); + } + + virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName, + PropertyType::Enum propType) + { + mStream->createProperty(clsName, getTopName(), inSemantic, dtypeName, propType, getNamedValues()); + clearNamedValues(); + } + const char* registerStr(const char* str) + { + ScopedMetaData scopedProvider(mProvider); + return scopedProvider->getStringTable().registerStr(str); + } + virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) + { + mPropertyMessageArgs.pushBack(PropertyMessageArg(registerStr(getTopName()), inDatatype, inOffset, inSize)); + } + virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName, + uint32_t inStructSizeInBytes) + { + if(mPropertyMessageArgs.empty()) + { + PX_ASSERT(false); + return; + } + mStream->createPropertyMessage( + clsName, msgName, DataRef(mPropertyMessageArgs.begin(), mPropertyMessageArgs.size()), + inStructSizeInBytes); + } + virtual void clearPropertyMessageArgs() + { + mPropertyMessageArgs.clear(); + } + + private: + PropertyDefinitionHelper& operator=(const PropertyDefinitionHelper&); +}; + +class PvdMemPool +{ + // Link List + PxArray mMemBuffer; + uint32_t mLength; + uint32_t mBufIndex; + + // 4k for one page + static const int BUFFER_LENGTH = 4096; + PX_NOCOPY(PvdMemPool) + public: + PvdMemPool(const char* bufDataName) : mMemBuffer(bufDataName), mLength(0), mBufIndex(0) + { + grow(); + } + + ~PvdMemPool() + { + for(uint32_t i = 0; i < mMemBuffer.size(); i++) + { + PX_FREE(mMemBuffer[i]); + } + } + + void grow() + { + if(mBufIndex + 1 < mMemBuffer.size()) + { + mBufIndex++; + } + else + { + uint8_t* Buf = reinterpret_cast(PX_ALLOC(BUFFER_LENGTH, "PvdMemPool::mMemBuffer.buf")); + mMemBuffer.pushBack(Buf); + mBufIndex = mMemBuffer.size() - 1; + } + mLength = 0; + } + + void* allocate(uint32_t length) + { + if(length > uint32_t(BUFFER_LENGTH)) + return NULL; + + if(length + mLength > uint32_t(BUFFER_LENGTH)) + grow(); + + void* mem = reinterpret_cast(&mMemBuffer[mBufIndex][mLength]); + mLength += length; + return mem; + } + + void clear() + { + mLength = 0; + mBufIndex = 0; + } +}; +struct PvdOutStream : public PvdDataStream, public PxUserAllocated +{ + PxHashMap mStringHashMap; + PvdOMMetaDataProvider& mMetaDataProvider; + PxArray mTempBuffer; + PropertyDefinitionHelper mPropertyDefinitionHelper; + DataStreamState::Enum mStreamState; + + ClassDescription mSPVClass; + PropertyMessageDescription mMessageDesc; + // Set property value and SetPropertyMessage calls require + // us to write the data out to a separate buffer + // when strings are involved. + ForwardingMemoryBuffer mSPVBuffer; + uint32_t mEventCount; + uint32_t mPropertyMessageSize; + bool mConnected; + uint64_t mStreamId; + PxArray mPvdCommandArray; + PvdMemPool mPvdCommandPool; + PxPvdTransport& mTransport; + + PvdOutStream(PxPvdTransport& transport, PvdOMMetaDataProvider& provider, uint64_t streamId) + : mStringHashMap("PvdOutStream::mStringHashMap") + , mMetaDataProvider(provider) + , mTempBuffer("PvdOutStream::mTempBuffer") + , mPropertyDefinitionHelper(mMetaDataProvider) + , mStreamState(DataStreamState::Open) + , mSPVBuffer("PvdCommStreamBufferedEventSink::mSPVBuffer") + , mEventCount(0) + , mPropertyMessageSize(0) + , mConnected(true) + , mStreamId(streamId) + , mPvdCommandArray("PvdCommStreamBufferedEventSink::mPvdCommandArray") + , mPvdCommandPool("PvdCommStreamBufferedEventSink::mPvdCommandPool") + , mTransport(transport) + { + mPropertyDefinitionHelper.setStream(this); + } + virtual ~PvdOutStream() + { + } + + virtual void release() + { + PVD_DELETE(this); + } + + StringHandle toStream(String nm) + { + if(nm == NULL || *nm == 0) + return 0; + const PxHashMap::Entry* entry(mStringHashMap.find(nm)); + if(entry) + return entry->second; + ScopedMetaData meta(mMetaDataProvider); + StringHandle hdl = meta->getStringTable().strToHandle(nm); + nm = meta->getStringTable().handleToStr(hdl); + handlePvdEvent(StringHandleEvent(nm, hdl)); + mStringHashMap.insert(nm, hdl); + return hdl; + } + + StreamNamespacedName toStream(const NamespacedName& nm) + { + return StreamNamespacedName(toStream(nm.mNamespace), toStream(nm.mName)); + } + + bool isClassExist(const NamespacedName& nm) + { + ScopedMetaData meta(mMetaDataProvider); + return meta->findClass(nm).hasValue(); + } + + bool createMetaClass(const NamespacedName& nm) + { + ScopedMetaData meta(mMetaDataProvider); + meta->getOrCreateClass(nm); + return true; + } + + bool deriveMetaClass(const NamespacedName& parent, const NamespacedName& child) + { + ScopedMetaData meta(mMetaDataProvider); + return meta->deriveClass(parent, child); + } + +// You will notice that some functions are #pragma'd out throughout this file. +// This is because they are only called from asserts which means they aren't +// called in release. This causes warnings when building using snc which break +// the build. +#if PX_DEBUG + + bool propertyExists(const NamespacedName& nm, String pname) + { + ScopedMetaData meta(mMetaDataProvider); + return meta->findProperty(nm, pname).hasValue(); + } + +#endif + + PvdError boolToError(bool val) + { + if(val) + return PvdErrorType::Success; + return PvdErrorType::NetworkError; + } + + // PvdMetaDataStream + virtual PvdError createClass(const NamespacedName& nm) + { + PX_ASSERT(mStreamState == DataStreamState::Open); +#if PX_DEBUG + PX_ASSERT(isClassExist(nm) == false); +#endif + createMetaClass(nm); + return boolToError(handlePvdEvent(CreateClass(toStream(nm)))); + } + + virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) + { + PX_ASSERT(mStreamState == DataStreamState::Open); +#if PX_DEBUG + PX_ASSERT(isClassExist(parent)); + PX_ASSERT(isClassExist(child)); +#endif + deriveMetaClass(parent, child); + return boolToError(handlePvdEvent(DeriveClass(toStream(parent), toStream(child)))); + } + + template + TDataType* allocTemp(uint32_t numItems) + { + uint32_t desiredBytes = numItems * sizeof(TDataType); + if(desiredBytes > mTempBuffer.size()) + mTempBuffer.resize(desiredBytes); + TDataType* retval = reinterpret_cast(mTempBuffer.begin()); + if(numItems) + { + PVD_FOREACH(idx, numItems) new (retval + idx) TDataType(); + } + return retval; + } + +#if PX_DEBUG + + // Property datatypes need to be uniform. + // At this point, the data stream cannot handle properties that + // A struct with a float member and a char member would work. + // A struct with a float member and a long member would work (more efficiently). + bool isValidPropertyDatatype(const NamespacedName& dtypeName) + { + ScopedMetaData meta(mMetaDataProvider); + ClassDescription clsDesc(meta->findClass(dtypeName)); + return clsDesc.mRequiresDestruction == false; + } + +#endif + + NamespacedName createMetaProperty(const NamespacedName& clsName, String name, String semantic, + const NamespacedName& dtypeName, PropertyType::Enum propertyType) + { + ScopedMetaData meta(mMetaDataProvider); + int32_t dtypeType = meta->findClass(dtypeName)->mClassId; + NamespacedName typeName = dtypeName; + if(dtypeType == getPvdTypeForType()) + { + dtypeType = getPvdTypeForType(); + typeName = getPvdNamespacedNameForType(); + } + Option propOpt = + meta->createProperty(meta->findClass(clsName)->mClassId, name, semantic, dtypeType, propertyType); + PX_ASSERT(propOpt.hasValue()); + PX_UNUSED(propOpt); + return typeName; + } + + virtual PvdError createProperty(const NamespacedName& clsName, String name, String semantic, + const NamespacedName& incomingDtypeName, PropertyType::Enum propertyType, + DataRef values) + { + PX_ASSERT(mStreamState == DataStreamState::Open); +#if PX_DEBUG + PX_ASSERT(isClassExist(clsName)); + PX_ASSERT(propertyExists(clsName, name) == false); +#endif + NamespacedName dtypeName(incomingDtypeName); + if(safeStrEq(dtypeName.mName, "VoidPtr")) + dtypeName.mName = "ObjectRef"; +#if PX_DEBUG + PX_ASSERT(isClassExist(dtypeName)); + PX_ASSERT(isValidPropertyDatatype(dtypeName)); +#endif + NamespacedName typeName = createMetaProperty(clsName, name, semantic, dtypeName, propertyType); + // Can't have arrays of strings or arrays of string handles due to the difficulty + // of quickly dealing with them on the network receiving side. + if(propertyType == PropertyType::Array && safeStrEq(typeName.mName, "StringHandle")) + { + PX_ASSERT(false); + return PvdErrorType::ArgumentError; + } + uint32_t numItems = values.size(); + NameHandleValue* streamValues = allocTemp(numItems); + PVD_FOREACH(idx, numItems) + streamValues[idx] = NameHandleValue(toStream(values[idx].mName), values[idx].mValue); + CreateProperty evt(toStream(clsName), toStream(name), toStream(semantic), toStream(typeName), propertyType, + DataRef(streamValues, numItems)); + return boolToError(handlePvdEvent(evt)); + } + + bool createMetaPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, + DataRef entries, uint32_t messageSizeInBytes) + { + ScopedMetaData meta(mMetaDataProvider); + return meta->createPropertyMessage(cls, msgName, entries, messageSizeInBytes).hasValue(); + } +#if PX_DEBUG + + bool messageExists(const NamespacedName& msgName) + { + ScopedMetaData meta(mMetaDataProvider); + return meta->findPropertyMessage(msgName).hasValue(); + } + +#endif + + virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, + DataRef entries, uint32_t messageSizeInBytes) + { + PX_ASSERT(mStreamState == DataStreamState::Open); +#if PX_DEBUG + PX_ASSERT(isClassExist(cls)); + PX_ASSERT(messageExists(msgName) == false); +#endif + createMetaPropertyMessage(cls, msgName, entries, messageSizeInBytes); + uint32_t numItems = entries.size(); + StreamPropMessageArg* streamValues = allocTemp(numItems); + PVD_FOREACH(idx, numItems) + streamValues[idx] = + StreamPropMessageArg(toStream(entries[idx].mPropertyName), toStream(entries[idx].mDatatypeName), + entries[idx].mMessageOffset, entries[idx].mByteSize); + CreatePropertyMessage evt(toStream(cls), toStream(msgName), + DataRef(streamValues, numItems), messageSizeInBytes); + return boolToError(handlePvdEvent(evt)); + } + + uint64_t toStream(const void* instance) + { + return PVD_POINTER_TO_U64(instance); + } + virtual PvdError createInstance(const NamespacedName& cls, const void* instance) + { + PX_ASSERT(isInstanceValid(instance) == false); + PX_ASSERT(mStreamState == DataStreamState::Open); + bool success = mMetaDataProvider.createInstance(cls, instance); + PX_ASSERT(success); + (void)success; + return boolToError(handlePvdEvent(CreateInstance(toStream(cls), toStream(instance)))); + } + + virtual bool isInstanceValid(const void* instance) + { + return mMetaDataProvider.isInstanceValid(instance); + } + +#if PX_DEBUG + + // If the property will fit or is already completely in memory + bool checkPropertyType(const void* instance, String name, const NamespacedName& incomingType) + { + int32_t instType = mMetaDataProvider.getInstanceClassType(instance); + ScopedMetaData meta(mMetaDataProvider); + Option prop = meta->findProperty(instType, name); + if(prop.hasValue() == false) + return false; + int32_t propType = prop->mDatatype; + int32_t incomingTypeId = meta->findClass(incomingType)->mClassId; + if(incomingTypeId != getPvdTypeForType()) + { + MarshalQueryResult result = meta->checkMarshalling(incomingTypeId, propType); + bool possible = result.needsMarshalling == false || result.canMarshal; + return possible; + } + else + { + if(propType != getPvdTypeForType()) + return false; + } + return true; + } + +#endif + + DataRef bufferPropertyValue(ClassDescriptionSizeInfo info, DataRef data) + { + uint32_t realSize = info.mByteSize; + uint32_t numItems = data.size() / realSize; + if(info.mPtrOffsets.size() != 0) + { + mSPVBuffer.clear(); + PVD_FOREACH(item, numItems) + { + const uint8_t* itemPtr = data.begin() + item * realSize; + mSPVBuffer.write(itemPtr, realSize); + PVD_FOREACH(stringIdx, info.mPtrOffsets.size()) + { + PtrOffset offset(info.mPtrOffsets[stringIdx]); + if(offset.mOffsetType == PtrOffsetType::VoidPtrOffset) + continue; + const char* strPtr; + physx::intrinsics::memCopy(&strPtr, itemPtr + offset.mOffset, sizeof(char*)); + strPtr = nonNull(strPtr); + uint32_t len = safeStrLen(strPtr) + 1; + mSPVBuffer.write(strPtr, len); + } + } + data = DataRef(mSPVBuffer.begin(), mSPVBuffer.size()); + } + return data; + } + + virtual PvdError setPropertyValue(const void* instance, String name, DataRef data, + const NamespacedName& incomingTypeName) + { + + PX_ASSERT(isInstanceValid(instance)); +#if PX_DEBUG + PX_ASSERT(isClassExist(incomingTypeName)); +#endif + PX_ASSERT(mStreamState == DataStreamState::Open); + ClassDescription clsDesc; + { + ScopedMetaData meta(mMetaDataProvider); + clsDesc = meta->findClass(incomingTypeName); + } + uint32_t realSize = clsDesc.getNativeSize(); + uint32_t numItems = data.size() / realSize; + data = bufferPropertyValue(clsDesc.getNativeSizeInfo(), data); + SetPropertyValue evt(toStream(instance), toStream(name), data, toStream(incomingTypeName), numItems); + return boolToError(handlePvdEvent(evt)); + } + + // Else if the property is very large (contact reports) you can send it in chunks. + virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) + { + PX_ASSERT(isInstanceValid(instance)); +#if PX_DEBUG + PX_ASSERT(isClassExist(incomingTypeName)); + PX_ASSERT(checkPropertyType(instance, name, incomingTypeName)); +#endif + PX_ASSERT(mStreamState == DataStreamState::Open); + mStreamState = DataStreamState::SetPropertyValue; + { + ScopedMetaData meta(mMetaDataProvider); + mSPVClass = meta->findClass(incomingTypeName); + } + BeginSetPropertyValue evt(toStream(instance), toStream(name), toStream(incomingTypeName)); + return boolToError(handlePvdEvent(evt)); + } + + virtual PvdError appendPropertyValueData(DataRef data) + { + uint32_t realSize = mSPVClass.getNativeSize(); + uint32_t numItems = data.size() / realSize; + data = bufferPropertyValue(mSPVClass.getNativeSizeInfo(), data); + PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue); + return boolToError(handlePvdEvent(AppendPropertyValueData(data, numItems))); + } + virtual PvdError endSetPropertyValue() + { + PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue); + mStreamState = DataStreamState::Open; + return boolToError(handlePvdEvent(EndSetPropertyValue())); + } + +#if PX_DEBUG + + bool checkPropertyMessage(const void* instance, const NamespacedName& msgName) + { + int32_t clsId = mMetaDataProvider.getInstanceClassType(instance); + ScopedMetaData meta(mMetaDataProvider); + PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); + bool retval = meta->isDerivedFrom(clsId, desc.mClassId); + return retval; + } + +#endif + + DataRef bufferPropertyMessage(const PropertyMessageDescription& desc, DataRef data) + { + if(desc.mStringOffsets.size()) + { + mSPVBuffer.clear(); + mSPVBuffer.write(data.begin(), data.size()); + PVD_FOREACH(idx, desc.mStringOffsets.size()) + { + const char* strPtr; + physx::intrinsics::memCopy(&strPtr, data.begin() + desc.mStringOffsets[idx], sizeof(char*)); + strPtr = nonNull(strPtr); + uint32_t len = safeStrLen(strPtr) + 1; + mSPVBuffer.write(strPtr, len); + } + data = DataRef(mSPVBuffer.begin(), mSPVBuffer.end()); + } + return data; + } + + virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName, DataRef data) + { + ScopedMetaData meta(mMetaDataProvider); + PX_ASSERT(isInstanceValid(instance)); +#if PX_DEBUG + PX_ASSERT(messageExists(msgName)); + PX_ASSERT(checkPropertyMessage(instance, msgName)); +#endif + PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); + if(data.size() < desc.mMessageByteSize) + { + PX_ASSERT(false); + return PvdErrorType::ArgumentError; + } + data = bufferPropertyMessage(desc, data); + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent(SetPropertyMessage(toStream(instance), toStream(msgName), data))); + } + +#if PX_DEBUG + + bool checkBeginPropertyMessageGroup(const NamespacedName& msgName) + { + ScopedMetaData meta(mMetaDataProvider); + PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); + return desc.mStringOffsets.size() == 0; + } + +#endif + // If you need to send of lot of identical messages, this avoids a hashtable lookup per message. + virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) + { +#if PX_DEBUG + PX_ASSERT(messageExists(msgName)); + PX_ASSERT(checkBeginPropertyMessageGroup(msgName)); +#endif + PX_ASSERT(mStreamState == DataStreamState::Open); + mStreamState = DataStreamState::PropertyMessageGroup; + ScopedMetaData meta(mMetaDataProvider); + mMessageDesc = meta->findPropertyMessage(msgName); + return boolToError(handlePvdEvent(BeginPropertyMessageGroup(toStream(msgName)))); + } + + virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef data) + { + PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup); + PX_ASSERT(isInstanceValid(instance)); +#if PX_DEBUG + PX_ASSERT(checkPropertyMessage(instance, mMessageDesc.mMessageName)); +#endif + if(mMessageDesc.mMessageByteSize != data.size()) + { + PX_ASSERT(false); + return PvdErrorType::ArgumentError; + } + if(data.size() < mMessageDesc.mMessageByteSize) + return PvdErrorType::ArgumentError; + data = bufferPropertyMessage(mMessageDesc, data); + return boolToError(handlePvdEvent(SendPropertyMessageFromGroup(toStream(instance), data))); + } + virtual PvdError endPropertyMessageGroup() + { + PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup); + mStreamState = DataStreamState::Open; + return boolToError(handlePvdEvent(EndPropertyMessageGroup())); + } + virtual PvdError pushBackObjectRef(const void* instance, String propName, const void* data) + { + PX_ASSERT(isInstanceValid(instance)); + PX_ASSERT(isInstanceValid(data)); + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent(PushBackObjectRef(toStream(instance), toStream(propName), toStream(data)))); + } + virtual PvdError removeObjectRef(const void* instance, String propName, const void* data) + { + PX_ASSERT(isInstanceValid(instance)); + PX_ASSERT(isInstanceValid(data)); + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent(RemoveObjectRef(toStream(instance), toStream(propName), toStream(data)))); + } + // Instance elimination. + virtual PvdError destroyInstance(const void* instance) + { + PX_ASSERT(isInstanceValid(instance)); + PX_ASSERT(mStreamState == DataStreamState::Open); + mMetaDataProvider.destroyInstance(instance); + return boolToError(handlePvdEvent(DestroyInstance(toStream(instance)))); + } + + // Profiling hooks + virtual PvdError beginSection(const void* instance, String name) + { + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent( + BeginSection(toStream(instance), toStream(name), PxTime::getCurrentCounterValue()))); + } + + virtual PvdError endSection(const void* instance, String name) + { + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent( + EndSection(toStream(instance), toStream(name), PxTime::getCurrentCounterValue()))); + } + + virtual PvdError originShift(const void* scene, PxVec3 shift) + { + PX_ASSERT(mStreamState == DataStreamState::Open); + return boolToError(handlePvdEvent(OriginShift(toStream(scene), shift))); + } + + virtual void addProfileZone(void* zone, const char* name) + { + handlePvdEvent(AddProfileZone(toStream(zone), name)); + } + virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) + { + handlePvdEvent(AddProfileZoneEvent(toStream(zone), name, eventId, compileTimeEnabled)); + } + + // add a variable sized event + void addEvent(const EventSerializeable& evt, PvdCommStreamEventTypes::Enum evtType) + { + MeasureStream measure; + PvdCommStreamEventSink::writeStreamEvent(evt, evtType, measure); + EventGroup evtGroup(measure.mSize, 1, mStreamId, PxTime::getCurrentCounterValue()); + EventStreamifier streamifier(mTransport.lock()); + evtGroup.serialize(streamifier); + PvdCommStreamEventSink::writeStreamEvent(evt, evtType, mTransport); + mTransport.unlock(); + } + + void setIsTopLevelUIElement(const void* instance, bool topLevel) + { + addEvent(SetIsTopLevel(static_cast(reinterpret_cast(instance)), topLevel), + getCommStreamEventType()); + } + + void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) + { + addEvent(ErrorMessage(code, message, file, line), getCommStreamEventType()); + } + + void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) + { + addEvent(SetCamera(name, origin, up, target), getCommStreamEventType()); + } + + template + bool handlePvdEvent(const TEventType& evt) + { + addEvent(evt, getCommStreamEventType()); + return mConnected; + } + + virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() + { + mPropertyDefinitionHelper.clearBufferedData(); + return mPropertyDefinitionHelper; + } + + virtual bool isConnected() + { + return mConnected; + } + + virtual void* allocateMemForCmd(uint32_t length) + { + return mPvdCommandPool.allocate(length); + } + + virtual void pushPvdCommand(PvdCommand& cmd) + { + mPvdCommandArray.pushBack(&cmd); + } + + virtual void flushPvdCommand() + { + uint32_t cmdQueueSize = mPvdCommandArray.size(); + for(uint32_t i = 0; i < cmdQueueSize; i++) + { + if(mPvdCommandArray[i]) + { + // if(mPvdCommandArray[i]->canRun(*this)) + mPvdCommandArray[i]->run(*this); + mPvdCommandArray[i]->~PvdCommand(); + } + } + mPvdCommandArray.clear(); + mPvdCommandPool.clear(); + } + + PX_NOCOPY(PvdOutStream) +}; +} + +PvdDataStream* PvdDataStream::create(PxPvd* pvd) +{ + if(pvd == NULL) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PvdDataStream::create - pvd must be non-NULL!"); + return NULL; + } + + PvdImpl* pvdImpl = static_cast(pvd); + return PVD_NEW(PvdOutStream)(*pvdImpl->getTransport(), pvdImpl->getMetaDataProvider(), pvdImpl->getNextStreamId()); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp new file mode 100644 index 0000000..fdacf78 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.cpp @@ -0,0 +1,217 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdDefaultFileTransport.h" + +namespace physx +{ +namespace pvdsdk +{ + +PvdDefaultFileTransport::PvdDefaultFileTransport(const char* name) : mConnected(false), mWrittenData(0), mLocked(false) +{ + mFileBuffer = PX_NEW(PsFileBuffer)(name, PxFileBuf::OPEN_WRITE_ONLY); +} + +PvdDefaultFileTransport::~PvdDefaultFileTransport() +{ +} + +bool PvdDefaultFileTransport::connect() +{ + PX_ASSERT(mFileBuffer); + mConnected = mFileBuffer->isOpen(); + return mConnected; +} + +void PvdDefaultFileTransport::disconnect() +{ + mConnected = false; +} + +bool PvdDefaultFileTransport::isConnected() +{ + return mConnected; +} + +bool PvdDefaultFileTransport::write(const uint8_t* inBytes, uint32_t inLength) +{ + PX_ASSERT(mLocked); + PX_ASSERT(mFileBuffer); + if (mConnected) + { + uint32_t len = mFileBuffer->write(inBytes, inLength); + mWrittenData += len; + return len == inLength; + } + else + return false; +} + +PxPvdTransport& PvdDefaultFileTransport::lock() +{ + mMutex.lock(); + PX_ASSERT(!mLocked); + mLocked = true; + return *this; +} + +void PvdDefaultFileTransport::unlock() +{ + PX_ASSERT(mLocked); + mLocked = false; + mMutex.unlock(); +} + +void PvdDefaultFileTransport::flush() +{ +} + +uint64_t PvdDefaultFileTransport::getWrittenDataSize() +{ + return mWrittenData; +} + +void PvdDefaultFileTransport::release() +{ + if (mFileBuffer) + { + mFileBuffer->close(); + delete mFileBuffer; + } + mFileBuffer = NULL; + PX_DELETE_THIS; +} + +class NullFileTransport : public physx::PxPvdTransport, public physx::PxUserAllocated +{ + PX_NOCOPY(NullFileTransport) + public: + NullFileTransport(); + virtual ~NullFileTransport(); + + virtual bool connect(); + virtual void disconnect(); + virtual bool isConnected(); + + virtual bool write(const uint8_t* inBytes, uint32_t inLength); + + virtual PxPvdTransport& lock(); + virtual void unlock(); + + virtual void flush(); + + virtual uint64_t getWrittenDataSize(); + + virtual void release(); + + private: + bool mConnected; + uint64_t mWrittenData; + physx::PxMutex mMutex; + bool mLocked; // for debug, remove it when finished +}; + +NullFileTransport::NullFileTransport() : mConnected(false), mWrittenData(0), mLocked(false) +{ +} + +NullFileTransport::~NullFileTransport() +{ +} + +bool NullFileTransport::connect() +{ + mConnected = true; + return true; +} + +void NullFileTransport::disconnect() +{ + mConnected = false; +} + +bool NullFileTransport::isConnected() +{ + return mConnected; +} + +bool NullFileTransport::write(const uint8_t* /*inBytes*/, uint32_t inLength) +{ + PX_ASSERT(mLocked); + if(mConnected) + { + uint32_t len = inLength; + mWrittenData += len; + return len == inLength; + } + else + return false; +} + +PxPvdTransport& NullFileTransport::lock() +{ + mMutex.lock(); + PX_ASSERT(!mLocked); + mLocked = true; + return *this; +} + +void NullFileTransport::unlock() +{ + PX_ASSERT(mLocked); + mLocked = false; + mMutex.unlock(); +} + +void NullFileTransport::flush() +{ +} + +uint64_t NullFileTransport::getWrittenDataSize() +{ + return mWrittenData; +} + +void NullFileTransport::release() +{ + PX_DELETE_THIS; +} + +} // namespace pvdsdk + +PxPvdTransport* PxDefaultPvdFileTransportCreate(const char* name) +{ + if(name) + return PX_NEW(pvdsdk::PvdDefaultFileTransport)(name); + else + return PX_NEW(pvdsdk::NullFileTransport)(); +} + +} // namespace physx + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.h new file mode 100644 index 0000000..880da79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultFileTransport.h @@ -0,0 +1,77 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_DEFAULT_FILE_TRANSPORT_H +#define PX_PVD_DEFAULT_FILE_TRANSPORT_H + +#include "pvd/PxPvdTransport.h" + +#include "foundation/PxUserAllocated.h" +#include "PsFileBuffer.h" +#include "foundation/PxMutex.h" + +namespace physx +{ +namespace pvdsdk +{ + +class PvdDefaultFileTransport : public physx::PxPvdTransport, public physx::PxUserAllocated +{ + PX_NOCOPY(PvdDefaultFileTransport) + public: + PvdDefaultFileTransport(const char* name); + virtual ~PvdDefaultFileTransport(); + + virtual bool connect(); + virtual void disconnect(); + virtual bool isConnected(); + + virtual bool write(const uint8_t* inBytes, uint32_t inLength); + + virtual PxPvdTransport& lock(); + virtual void unlock(); + + virtual void flush(); + + virtual uint64_t getWrittenDataSize(); + + virtual void release(); + + private: + physx::PsFileBuffer* mFileBuffer; + bool mConnected; + uint64_t mWrittenData; + physx::PxMutex mMutex; + bool mLocked; // for debug, remove it when finished +}; + +} // pvdsdk +} // physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp new file mode 100644 index 0000000..c5ad908 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.cpp @@ -0,0 +1,133 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdDefaultSocketTransport.h" + +namespace physx +{ +namespace pvdsdk +{ +PvdDefaultSocketTransport::PvdDefaultSocketTransport(const char* host, int port, unsigned int timeoutInMilliseconds) +: mHost(host), mPort(uint16_t(port)), mTimeout(timeoutInMilliseconds), mConnected(false), mWrittenData(0) +{ +} + +PvdDefaultSocketTransport::~PvdDefaultSocketTransport() +{ +} + +bool PvdDefaultSocketTransport::connect() +{ + if(mConnected) + return true; + + if(mSocket.connect(mHost, mPort, mTimeout)) + { + mSocket.setBlocking(true); + mConnected = true; + } + return mConnected; +} + +void PvdDefaultSocketTransport::disconnect() +{ + mSocket.flush(); + mSocket.disconnect(); + mConnected = false; +} + +bool PvdDefaultSocketTransport::isConnected() +{ + return mSocket.isConnected(); +} + +bool PvdDefaultSocketTransport::write(const uint8_t* inBytes, uint32_t inLength) +{ + if(mConnected) + { + if(inLength == 0) + return true; + + uint32_t amountWritten = 0; + uint32_t totalWritten = 0; + do + { + // Sockets don't have to write as much as requested, so we need + // to wrap this call in a do/while loop. + // If they don't write any bytes then we consider them disconnected. + amountWritten = mSocket.write(inBytes, inLength); + inLength -= amountWritten; + inBytes += amountWritten; + totalWritten += amountWritten; + } while(inLength && amountWritten); + + if(amountWritten == 0) + return false; + + mWrittenData += totalWritten; + + return true; + } + else + return false; +} + +PxPvdTransport& PvdDefaultSocketTransport::lock() +{ + mMutex.lock(); + return *this; +} + +void PvdDefaultSocketTransport::unlock() +{ + mMutex.unlock(); +} + +void PvdDefaultSocketTransport::flush() +{ + mSocket.flush(); +} + +uint64_t PvdDefaultSocketTransport::getWrittenDataSize() +{ + return mWrittenData; +} + +void PvdDefaultSocketTransport::release() +{ + PX_DELETE_THIS; +} + +} // namespace pvdsdk + +PxPvdTransport* PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds) +{ + return PX_NEW(pvdsdk::PvdDefaultSocketTransport)(host, port, timeoutInMilliseconds); +} + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.h new file mode 100644 index 0000000..09932a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdDefaultSocketTransport.h @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_DEFAULT_SOCKET_TRANSPORT_H +#define PX_PVD_DEFAULT_SOCKET_TRANSPORT_H + +#include "pvd/PxPvdTransport.h" + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxSocket.h" +#include "foundation/PxMutex.h" + +namespace physx +{ +namespace pvdsdk +{ +class PvdDefaultSocketTransport : public PxPvdTransport, public PxUserAllocated +{ + PX_NOCOPY(PvdDefaultSocketTransport) + public: + PvdDefaultSocketTransport(const char* host, int port, unsigned int timeoutInMilliseconds); + virtual ~PvdDefaultSocketTransport(); + + virtual bool connect(); + virtual void disconnect(); + virtual bool isConnected(); + + virtual bool write(const uint8_t* inBytes, uint32_t inLength); + + virtual void flush(); + + virtual PxPvdTransport& lock(); + virtual void unlock(); + + virtual uint64_t getWrittenDataSize(); + + virtual void release(); + + private: + PxSocket mSocket; + const char* mHost; + uint16_t mPort; + unsigned int mTimeout; + bool mConnected; + uint64_t mWrittenData; + PxMutex mMutex; + bool mlocked; +}; + +} // pvdsdk +} // physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdFoundation.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdFoundation.h new file mode 100644 index 0000000..f75c94c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdFoundation.h @@ -0,0 +1,315 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_FOUNDATION_H +#define PX_PVD_FOUNDATION_H + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" +#include "foundation/PxBounds3.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" +#include "foundation/PxString.h" +#include "foundation/PxPool.h" +#include "PxPvdObjectModelBaseTypes.h" + +namespace physx +{ +namespace pvdsdk +{ + +extern PxAllocatorCallback* gPvdAllocatorCallback; + +class ForwardingAllocator : public PxAllocatorCallback +{ + void* allocate(size_t size, const char* typeName, const char* filename, int line) + { + return PxGetBroadcastAllocator()->allocate(size, typeName, filename, line); + } + void deallocate(void* ptr) + { + PxGetBroadcastAllocator()->deallocate(ptr); + } +}; + +class RawMemoryBuffer +{ + uint8_t* mBegin; + uint8_t* mEnd; + uint8_t* mCapacityEnd; + const char* mBufDataName; + + public: + RawMemoryBuffer(const char* name) : mBegin(0), mEnd(0), mCapacityEnd(0),mBufDataName(name) + { + PX_UNUSED(mBufDataName); + } + ~RawMemoryBuffer() + { + PX_FREE(mBegin); + } + uint32_t size() const + { + return static_cast(mEnd - mBegin); + } + uint32_t capacity() const + { + return static_cast(mCapacityEnd - mBegin); + } + uint8_t* begin() + { + return mBegin; + } + uint8_t* end() + { + return mEnd; + } + const uint8_t* begin() const + { + return mBegin; + } + const uint8_t* end() const + { + return mEnd; + } + void clear() + { + mEnd = mBegin; + } + const char* cStr() + { + if(mEnd && (*mEnd != 0)) + write(0); + return reinterpret_cast(mBegin); + } + uint32_t write(uint8_t inValue) + { + *growBuf(1) = inValue; + return 1; + } + + template + uint32_t write(const TDataType& inValue) + { + const uint8_t* __restrict readPtr = reinterpret_cast(&inValue); + uint8_t* __restrict writePtr = growBuf(sizeof(TDataType)); + for(uint32_t idx = 0; idx < sizeof(TDataType); ++idx) + writePtr[idx] = readPtr[idx]; + return sizeof(TDataType); + } + + template + uint32_t write(const TDataType* inValue, uint32_t inLength) + { + uint32_t writeSize = inLength * sizeof(TDataType); + if(inValue && inLength) + { + physx::intrinsics::memCopy(growBuf(writeSize), inValue, writeSize); + } + if(inLength && !inValue) + { + PX_ASSERT(false); + // You can't not write something, because that will cause + // the receiving end to crash. + for(uint32_t idx = 0; idx < writeSize; ++idx) + write(0); + } + return writeSize; + } + + uint8_t* growBuf(uint32_t inAmount) + { + uint32_t offset = size(); + uint32_t newSize = offset + inAmount; + reserve(newSize); + mEnd += inAmount; + return mBegin + offset; + } + void writeZeros(uint32_t inAmount) + { + uint32_t offset = size(); + growBuf(inAmount); + physx::intrinsics::memZero(begin() + offset, inAmount); + } + void reserve(uint32_t newSize) + { + uint32_t currentSize = size(); + if(newSize && newSize >= capacity()) + { + uint32_t newDataSize = newSize > 4096 ? newSize + (newSize >> 2) : newSize*2; + uint8_t* newData = static_cast(PX_ALLOC(newDataSize, mBufDataName)); + if(mBegin) + { + physx::intrinsics::memCopy(newData, mBegin, currentSize); + PX_FREE(mBegin); + } + mBegin = newData; + mEnd = mBegin + currentSize; + mCapacityEnd = mBegin + newDataSize; + } + } +}; + +struct ForwardingMemoryBuffer : public RawMemoryBuffer +{ + ForwardingMemoryBuffer(const char* bufDataName) : RawMemoryBuffer(bufDataName) + { + } + + ForwardingMemoryBuffer& operator<<(const char* inString) + { + if(inString && *inString) + { + uint32_t len = static_cast(strlen(inString)); + write(inString, len); + } + return *this; + } + + template + inline ForwardingMemoryBuffer& toStream(const char* inFormat, const TDataType inData) + { + char buffer[128] = { 0 }; + Pxsnprintf(buffer, 128, inFormat, inData); + *this << buffer; + return *this; + } + + inline ForwardingMemoryBuffer& operator<<(bool inData) + { + *this << (inData ? "true" : "false"); + return *this; + } + inline ForwardingMemoryBuffer& operator<<(int32_t inData) + { + return toStream("%d", inData); + } + inline ForwardingMemoryBuffer& operator<<(uint16_t inData) + { + return toStream("%u", uint32_t(inData)); + } + inline ForwardingMemoryBuffer& operator<<(uint8_t inData) + { + return toStream("%u", uint32_t(inData)); + } + inline ForwardingMemoryBuffer& operator<<(char inData) + { + return toStream("%c", inData); + } + inline ForwardingMemoryBuffer& operator<<(uint32_t inData) + { + return toStream("%u", inData); + } + inline ForwardingMemoryBuffer& operator<<(uint64_t inData) + { + return toStream("%I64u", inData); + } + inline ForwardingMemoryBuffer& operator<<(int64_t inData) + { + return toStream("%I64d", inData); + } + inline ForwardingMemoryBuffer& operator<<(const void* inData) + { + return *this << static_cast(reinterpret_cast(inData)); + } + inline ForwardingMemoryBuffer& operator<<(float inData) + { + return toStream("%g", double(inData)); + } + inline ForwardingMemoryBuffer& operator<<(double inData) + { + return toStream("%g", inData); + } + inline ForwardingMemoryBuffer& operator<<(const PxVec3& inData) + { + *this << inData[0]; + *this << " "; + *this << inData[1]; + *this << " "; + *this << inData[2]; + return *this; + } + + inline ForwardingMemoryBuffer& operator<<(const PxQuat& inData) + { + *this << inData.x; + *this << " "; + *this << inData.y; + *this << " "; + *this << inData.z; + *this << " "; + *this << inData.w; + return *this; + } + + inline ForwardingMemoryBuffer& operator<<(const PxTransform& inData) + { + *this << inData.q; + *this << " "; + *this << inData.p; + return *this; + } + + inline ForwardingMemoryBuffer& operator<<(const PxBounds3& inData) + { + *this << inData.minimum; + *this << " "; + *this << inData.maximum; + return *this; + } + +}; + +template +inline void* PvdAllocate(const char* typeName, const char* file, int line) +{ + PX_ASSERT(gPvdAllocatorCallback); + return gPvdAllocatorCallback->allocate(sizeof(TDataType), typeName, file, line); +} + +template +inline void PvdDeleteAndDeallocate(TDataType* inDType) +{ + PX_ASSERT(gPvdAllocatorCallback); + if(inDType) + { + inDType->~TDataType(); + gPvdAllocatorCallback->deallocate(inDType); + } +} +} +} + +#define PVD_NEW(dtype) new (PvdAllocate(#dtype, __FILE__, __LINE__)) dtype +#define PVD_DELETE(obj) PvdDeleteAndDeallocate(obj); +//#define PVD_NEW(dtype) PX_NEW(dtype) +//#define PVD_DELETE(obj) PX_DELETE(obj) +#define PVD_FOREACH(varname, stop) for(uint32_t varname = 0; varname < stop; ++varname) +#define PVD_POINTER_TO_U64(ptr) static_cast(reinterpret_cast(ptr)) + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp new file mode 100644 index 0000000..a511989 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.cpp @@ -0,0 +1,412 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdImpl.h" +#include "PxPvdMemClient.h" +#include "PxPvdProfileZoneClient.h" +#include "PxPvdProfileZone.h" + + +#if PX_SUPPORT_GPU_PHYSX +#include "gpu/PxGpu.h" +#endif + +#if PX_NVTX +#include "nvToolsExt.h" +#endif + +namespace +{ + const char* gSdkName = "PhysXSDK"; +} + +namespace physx +{ +namespace pvdsdk +{ + +class CmEventNameProvider : public physx::profile::PxProfileNameProvider +{ +public: + physx::profile::PxProfileNames getProfileNames() const + { + physx::profile::PxProfileNames ret; + ret.eventCount = 0; + return ret; + } +}; + +CmEventNameProvider gProfileNameProvider; + +void initializeModelTypes(PvdDataStream& stream) +{ + stream.createClass(); + stream.createProperty( + "events", PvdCommStreamEmbeddedTypes::getProfileEventStreamSemantic(), PropertyType::Array); + + stream.createClass(); + stream.createProperty( + "events", PvdCommStreamEmbeddedTypes::getMemoryEventStreamSemantic(), PropertyType::Array); + + stream.createClass(); + stream.createProperty( + "events", PvdCommStreamEmbeddedTypes::getRendererEventStreamSemantic(), PropertyType::Array); +} + +PvdImpl* PvdImpl::sInstance = NULL; +uint32_t PvdImpl::sRefCount = 0; + +PvdImpl::PvdImpl() +: mPvdTransport(NULL) +, mSharedMetaProvider(NULL) +, mMemClient(NULL) +, mIsConnected(false) +, mGPUProfilingWasConnected(false) +, mIsNVTXSupportEnabled(true) +, mNVTXContext(0) +, mNextStreamId(1) +, mProfileClient(NULL) +, mProfileZone(NULL) +{ + mProfileZoneManager = &physx::profile::PxProfileZoneManager::createProfileZoneManager(PxGetBroadcastAllocator()); + mProfileClient = PVD_NEW(PvdProfileZoneClient)(*this); +} + +PvdImpl::~PvdImpl() +{ + if((mFlags & PxPvdInstrumentationFlag::ePROFILE) ) + { + PxSetProfilerCallback(NULL); +#if PX_SUPPORT_GPU_PHYSX + if (mGPUProfilingWasConnected) + { + PxSetPhysXGpuProfilerCallback(NULL); + } +#endif + } + + disconnect(); + + if ( mProfileZoneManager ) + { + mProfileZoneManager->release(); + mProfileZoneManager = NULL; + } + + PVD_DELETE(mProfileClient); + mProfileClient = NULL; +} + +bool PvdImpl::connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) +{ + if(mIsConnected) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxPvd::connect - recall connect! Should call disconnect before re-connect."); + return false; + } + + mFlags = flags; + mPvdTransport = &transport; + + mIsConnected = mPvdTransport->connect(); + + if(mIsConnected) + { + mSharedMetaProvider = PVD_NEW(MetaDataProvider); + sendTransportInitialization(); + + PvdDataStream* stream = PvdDataStream::create(this); + initializeModelTypes(*stream); + stream->release(); + + if(mFlags & PxPvdInstrumentationFlag::eMEMORY) + { + mMemClient = PVD_NEW(PvdMemClient)(*this); + mPvdClients.pushBack(mMemClient); + } + + if((mFlags & PxPvdInstrumentationFlag::ePROFILE) && mProfileZoneManager) + { + mPvdClients.pushBack(mProfileClient); + mProfileZone = &physx::profile::PxProfileZone::createProfileZone(PxGetBroadcastAllocator(),gSdkName,gProfileNameProvider.getProfileNames()); + } + + for(uint32_t i = 0; i < mPvdClients.size(); i++) + mPvdClients[i]->onPvdConnected(); + + if (mProfileZone) + { + mProfileZoneManager->addProfileZoneHandler(*mProfileClient); + mProfileZoneManager->addProfileZone( *mProfileZone ); + } + + if ((mFlags & PxPvdInstrumentationFlag::ePROFILE)) + { + PxSetProfilerCallback(this); +#if PX_SUPPORT_GPU_PHYSX + PxSetPhysXGpuProfilerCallback(this); + mGPUProfilingWasConnected = true; +#endif + } + } + return mIsConnected; +} + +void PvdImpl::disconnect() +{ + if(mProfileZone) + { + mProfileZoneManager->removeProfileZoneHandler(*mProfileClient); + mProfileZoneManager->removeProfileZone( *mProfileZone ); + mProfileZone->release(); + mProfileZone=NULL; + removeClient(mProfileClient); + } + + if(mIsConnected) + { + for(uint32_t i = 0; i < mPvdClients.size(); i++) + mPvdClients[i]->onPvdDisconnected(); + + if(mMemClient) + { + removeClient(mMemClient); + PvdMemClient* tmp = mMemClient; //avoid tracking deallocation itsself + mMemClient = NULL; + PVD_DELETE(tmp); + } + + mSharedMetaProvider->release(); + mPvdTransport->disconnect(); + mObjectRegistrar.clear(); + mIsConnected = false; + } +} + +void PvdImpl::flush() +{ + for(uint32_t i = 0; i < mPvdClients.size(); i++) + mPvdClients[i]->flush(); + if ( mProfileZone ) + { + mProfileZone->flushEventIdNameMap(); + mProfileZone->flushProfileEvents(); + } +} + +bool PvdImpl::isConnected(bool useCachedStatus) +{ + if(mPvdTransport) + return useCachedStatus ? mIsConnected : mPvdTransport->isConnected(); + else + return false; +} + +PxPvdTransport* PvdImpl::getTransport() +{ + return mPvdTransport; +} + +PxPvdInstrumentationFlags PvdImpl::getInstrumentationFlags() +{ + return mFlags; +} + +void PvdImpl::sendTransportInitialization() +{ + StreamInitialization init; + EventStreamifier stream(mPvdTransport->lock()); + init.serialize(stream); + mPvdTransport->unlock(); +} + +void PvdImpl::addClient(PvdClient* client) +{ + PX_ASSERT(client); + for(uint32_t i = 0; i < mPvdClients.size(); i++) + { + if(client == mPvdClients[i]) + return; + } + mPvdClients.pushBack(client); + if(mIsConnected) + { + client->onPvdConnected(); + } +} + +void PvdImpl::removeClient(PvdClient* client) +{ + for(uint32_t i = 0; i < mPvdClients.size(); i++) + { + if(client == mPvdClients[i]) + { + client->onPvdDisconnected(); + mPvdClients.remove(i); + } + } +} + +void PvdImpl::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr) +{ + if(mMemClient) + mMemClient->onAllocation(inSize, inType, inFile, inLine, inAddr); +} + +void PvdImpl::onDeallocation(void* inAddr) +{ + if(mMemClient) + mMemClient->onDeallocation(inAddr); +} + +PvdOMMetaDataProvider& PvdImpl::getMetaDataProvider() +{ + return *mSharedMetaProvider; +} + +bool PvdImpl::registerObject(const void* inItem) +{ + return mObjectRegistrar.addItem(inItem); +} + + +bool PvdImpl::unRegisterObject(const void* inItem) +{ + return mObjectRegistrar.decItem(inItem); +} + +uint64_t PvdImpl::getNextStreamId() +{ + uint64_t retval = ++mNextStreamId; + return retval; +} + +bool PvdImpl::initialize() +{ + if(0 == sRefCount) + { + sInstance = PVD_NEW(PvdImpl)(); + } + ++sRefCount; + return !!sInstance; +} + +void PvdImpl::release() +{ + if(sRefCount > 0) + { + if(--sRefCount) + return; + + PVD_DELETE(sInstance); + sInstance = NULL; + } +} + +PvdImpl* PvdImpl::getInstance() +{ + return sInstance; +} + + +/************************************************************************************************************************** +Instrumented profiling events +***************************************************************************************************************************/ + +static const uint32_t CrossThreadId = 99999789; + +void* PvdImpl::zoneStart(const char* eventName, bool detached, uint64_t contextId) +{ + if(mProfileZone) + { + const uint16_t id = mProfileZone->getEventIdForName(eventName); + if(detached) + mProfileZone->startEvent(id, contextId, CrossThreadId); + else + mProfileZone->startEvent(id, contextId); + } +#if PX_NVTX + if(mIsNVTXSupportEnabled) + { + if(detached) + { + // TODO : Need to use the nvtxRangeStart API for cross thread events + nvtxEventAttributes_t eventAttrib; + memset(&eventAttrib, 0, sizeof(eventAttrib)); + eventAttrib.version = NVTX_VERSION; + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; + eventAttrib.colorType = NVTX_COLOR_ARGB; + eventAttrib.color = 0xFF00FF00; + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; + eventAttrib.message.ascii = eventName; + nvtxMarkEx(&eventAttrib); + } + else + { + nvtxRangePush(eventName); + } + } +#endif + return NULL; +} + +void PvdImpl::zoneEnd(void* /*profilerData*/, const char* eventName, bool detached, uint64_t contextId) +{ + if(mProfileZone) + { + const uint16_t id = mProfileZone->getEventIdForName(eventName); + if(detached) + mProfileZone->stopEvent(id, contextId, CrossThreadId); + else + mProfileZone->stopEvent(id, contextId); + } +#if PX_NVTX + if(mIsNVTXSupportEnabled) + { + if(detached) + { + nvtxEventAttributes_t eventAttrib; + memset(&eventAttrib, 0, sizeof(eventAttrib)); + eventAttrib.version = NVTX_VERSION; + eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; + eventAttrib.colorType = NVTX_COLOR_ARGB; + eventAttrib.color = 0xFFFF0000; + eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; + eventAttrib.message.ascii = eventName; + nvtxMarkEx(&eventAttrib); + } + else + { + nvtxRangePop(); + } + } +#endif +} +} // pvd + +} // physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.h new file mode 100644 index 0000000..2c95338 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdImpl.h @@ -0,0 +1,222 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_IMPL_H +#define PX_PVD_IMPL_H + +#include "foundation/PxProfiler.h" + +#include "foundation/PxAllocator.h" +#include "PsPvd.h" +#include "foundation/PxArray.h" +#include "foundation/PxMutex.h" +#include "PxPvdCommStreamTypes.h" +#include "PxPvdFoundation.h" +#include "PxPvdObjectModelMetaData.h" +#include "PxPvdObjectRegistrar.h" + +namespace physx +{ + +namespace profile +{ + class PxProfileZoneManager; +} + +namespace pvdsdk +{ +class PvdMemClient; +class PvdProfileZoneClient; + +struct MetaDataProvider : public PvdOMMetaDataProvider, public PxUserAllocated +{ + typedef PxMutex::ScopedLock TScopedLockType; + typedef PxHashMap TInstTypeMap; + PvdObjectModelMetaData& mMetaData; + PxMutex mMutex; + uint32_t mRefCount; + TInstTypeMap mTypeMap; + + MetaDataProvider() + : mMetaData(PvdObjectModelMetaData::create()), mRefCount(0), mTypeMap("MetaDataProvider::mTypeMap") + { + mMetaData.addRef(); + } + virtual ~MetaDataProvider() + { + mMetaData.release(); + } + + virtual void addRef() + { + TScopedLockType locker(mMutex); + ++mRefCount; + } + virtual void release() + { + { + TScopedLockType locker(mMutex); + if(mRefCount) + --mRefCount; + } + if(!mRefCount) + PVD_DELETE(this); + } + virtual PvdObjectModelMetaData& lock() + { + mMutex.lock(); + return mMetaData; + } + virtual void unlock() + { + mMutex.unlock(); + } + + virtual bool createInstance(const NamespacedName& clsName, const void* instance) + { + TScopedLockType locker(mMutex); + Option cls(mMetaData.findClass(clsName)); + if(cls.hasValue() == false) + return false; + int32_t instType = cls->mClassId; + mTypeMap.insert(instance, instType); + return true; + } + virtual bool isInstanceValid(const void* instance) + { + TScopedLockType locker(mMutex); + ClassDescription classDesc; + bool retval = mTypeMap.find(instance) != NULL; +#if PX_DEBUG + if(retval) + classDesc = mMetaData.getClass(mTypeMap.find(instance)->second); +#endif + return retval; + } + virtual void destroyInstance(const void* instance) + { + { + TScopedLockType locker(mMutex); + mTypeMap.erase(instance); + } + } + virtual int32_t getInstanceClassType(const void* instance) + { + TScopedLockType locker(mMutex); + const TInstTypeMap::Entry* entry = mTypeMap.find(instance); + if(entry) + return entry->second; + return -1; + } + + private: + MetaDataProvider& operator=(const MetaDataProvider&); + MetaDataProvider(const MetaDataProvider&); +}; + +////////////////////////////////////////////////////////////////////////// +/*! +PvdImpl is the realization of PxPvd. +It implements the interface methods and provides richer functionality for advanced users or internal clients (such as +PhysX or APEX), including handler notification for clients. +*/ +////////////////////////////////////////////////////////////////////////// +class PvdImpl : public PsPvd, public PxUserAllocated +{ + PX_NOCOPY(PvdImpl) + + typedef PxMutex::ScopedLock TScopedLockType; + typedef void (PvdImpl::*TAllocationHandler)(size_t size, const char* typeName, const char* filename, int line, + void* allocatedMemory); + typedef void (PvdImpl::*TDeallocationHandler)(void* allocatedMemory); + + public: + PvdImpl(); + virtual ~PvdImpl(); + void release(); + + bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags); + void disconnect(); + bool isConnected(bool useCachedStatus = true); + void flush(); + + PxPvdTransport* getTransport(); + PxPvdInstrumentationFlags getInstrumentationFlags(); + + void addClient(PvdClient* client); + void removeClient(PvdClient* client); + + PvdOMMetaDataProvider& getMetaDataProvider(); + + bool registerObject(const void* inItem); + bool unRegisterObject(const void* inItem); + + //AllocationListener + void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); + void onDeallocation(void* addr); + + uint64_t getNextStreamId(); + + static bool initialize(); + static PvdImpl* getInstance(); + + // Profiling + + virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId); + + virtual void zoneEnd(void* profilerData, const char *eventName, bool detached, uint64_t contextId); + + private: + void sendTransportInitialization(); + + PxPvdTransport* mPvdTransport; + physx::PxArray mPvdClients; + + MetaDataProvider* mSharedMetaProvider; // shared between clients + ObjectRegistrar mObjectRegistrar; + + PvdMemClient* mMemClient; + + PxPvdInstrumentationFlags mFlags; + bool mIsConnected; + bool mGPUProfilingWasConnected; + bool mIsNVTXSupportEnabled; + uint32_t mNVTXContext; + uint64_t mNextStreamId; + physx::profile::PxProfileZoneManager*mProfileZoneManager; + PvdProfileZoneClient* mProfileClient; + physx::profile::PxProfileZone* mProfileZone; + static PvdImpl* sInstance; + static uint32_t sRefCount; +}; + +} // namespace pvdsdk +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdInternalByteStreams.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdInternalByteStreams.h new file mode 100644 index 0000000..35b0450 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdInternalByteStreams.h @@ -0,0 +1,99 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_INTERNAL_BYTE_STREAMS_H +#define PX_PVD_INTERNAL_BYTE_STREAMS_H + +#include "PxPvdByteStreams.h" +#include "PxPvdFoundation.h" + +namespace physx +{ +namespace pvdsdk +{ +struct MemPvdInputStream : public PvdInputStream +{ + const uint8_t* mBegin; + const uint8_t* mEnd; + bool mGood; + + MemPvdInputStream(const uint8_t* beg = NULL, const uint8_t* end = NULL) + { + mBegin = beg; + mEnd = end; + mGood = true; + } + + uint32_t size() const + { + return mGood ? static_cast(mEnd - mBegin) : 0; + } + bool isGood() const + { + return mGood; + } + + void setup(uint8_t* start, uint8_t* stop) + { + mBegin = start; + mEnd = stop; + } + + void nocopyRead(uint8_t*& buffer, uint32_t& len) + { + if(len == 0 || mGood == false) + { + len = 0; + buffer = NULL; + return; + } + uint32_t original = len; + len = PxMin(len, size()); + if(mGood && len != original) + mGood = false; + buffer = const_cast(mBegin); + mBegin += len; + } + + virtual bool read(uint8_t* buffer, uint32_t& len) + { + if(len == 0) + return true; + uint32_t original = len; + len = PxMin(len, size()); + + physx::intrinsics::memCopy(buffer, mBegin, len); + mBegin += len; + if(len < original) + physx::intrinsics::memZero(buffer + len, original - len); + mGood = mGood && len == original; + return mGood; + } +}; +} +} +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMarshalling.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMarshalling.h new file mode 100644 index 0000000..0ef5373 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMarshalling.h @@ -0,0 +1,220 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_MARSHALLING_H +#define PX_PVD_MARSHALLING_H + +#include "foundation/PxMathIntrinsics.h" + +#include "PxPvdObjectModelBaseTypes.h" +#include "PxPvdBits.h" + +namespace physx +{ +namespace pvdsdk +{ + +// Define marshalling + +template +struct PvdMarshalling +{ + bool canMarshal; + PvdMarshalling() : canMarshal(false) + { + } +}; + +template +static inline void marshalSingleT(const uint8_t* srcData, uint8_t* destData) +{ + smtype incoming; + + physx::intrinsics::memCopy(&incoming, srcData, sizeof(smtype)); + lgtype outgoing = static_cast(incoming); + physx::intrinsics::memCopy(destData, &outgoing, sizeof(lgtype)); +} + +template +static inline void marshalBlockT(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) +{ + for(const uint8_t* item = srcData, *end = srcData + numBytes; item < end; + item += sizeof(smtype), destData += sizeof(lgtype)) + marshalSingleT(item, destData); +} + +#define PVD_TYPE_MARSHALLER(smtype, lgtype) \ + template <> \ + struct PvdMarshalling \ + { \ + uint32_t canMarshal; \ + static void marshalSingle(const uint8_t* srcData, uint8_t* destData) \ + { \ + marshalSingleT(srcData, destData); \ + } \ + static void marshalBlock(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) \ + { \ + marshalBlockT(srcData, destData, numBytes); \ + } \ + }; + +// define marshalling tables. +PVD_TYPE_MARSHALLER(int8_t, int16_t) +PVD_TYPE_MARSHALLER(int8_t, uint16_t) +PVD_TYPE_MARSHALLER(int8_t, int32_t) +PVD_TYPE_MARSHALLER(int8_t, uint32_t) +PVD_TYPE_MARSHALLER(int8_t, int64_t) +PVD_TYPE_MARSHALLER(int8_t, uint64_t) +PVD_TYPE_MARSHALLER(int8_t, PvdF32) +PVD_TYPE_MARSHALLER(int8_t, PvdF64) + +PVD_TYPE_MARSHALLER(uint8_t, int16_t) +PVD_TYPE_MARSHALLER(uint8_t, uint16_t) +PVD_TYPE_MARSHALLER(uint8_t, int32_t) +PVD_TYPE_MARSHALLER(uint8_t, uint32_t) +PVD_TYPE_MARSHALLER(uint8_t, int64_t) +PVD_TYPE_MARSHALLER(uint8_t, uint64_t) +PVD_TYPE_MARSHALLER(uint8_t, PvdF32) +PVD_TYPE_MARSHALLER(uint8_t, PvdF64) + +PVD_TYPE_MARSHALLER(int16_t, int32_t) +PVD_TYPE_MARSHALLER(int16_t, uint32_t) +PVD_TYPE_MARSHALLER(int16_t, int64_t) +PVD_TYPE_MARSHALLER(int16_t, uint64_t) +PVD_TYPE_MARSHALLER(int16_t, PvdF32) +PVD_TYPE_MARSHALLER(int16_t, PvdF64) + +PVD_TYPE_MARSHALLER(uint16_t, int32_t) +PVD_TYPE_MARSHALLER(uint16_t, uint32_t) +PVD_TYPE_MARSHALLER(uint16_t, int64_t) +PVD_TYPE_MARSHALLER(uint16_t, uint64_t) +PVD_TYPE_MARSHALLER(uint16_t, PvdF32) +PVD_TYPE_MARSHALLER(uint16_t, PvdF64) + +PVD_TYPE_MARSHALLER(int32_t, int64_t) +PVD_TYPE_MARSHALLER(int32_t, uint64_t) +PVD_TYPE_MARSHALLER(int32_t, PvdF64) +PVD_TYPE_MARSHALLER(int32_t, PvdF32) + +PVD_TYPE_MARSHALLER(uint32_t, int64_t) +PVD_TYPE_MARSHALLER(uint32_t, uint64_t) +PVD_TYPE_MARSHALLER(uint32_t, PvdF64) +PVD_TYPE_MARSHALLER(uint32_t, PvdF32) + +PVD_TYPE_MARSHALLER(PvdF32, PvdF64) +PVD_TYPE_MARSHALLER(PvdF32, uint32_t) +PVD_TYPE_MARSHALLER(PvdF32, int32_t) + +PVD_TYPE_MARSHALLER(uint64_t, PvdF64) +PVD_TYPE_MARSHALLER(int64_t, PvdF64) +PVD_TYPE_MARSHALLER(PvdF64, uint64_t) +PVD_TYPE_MARSHALLER(PvdF64, int64_t) + +template +static inline bool getMarshalOperators(TSingleMarshaller&, TBlockMarshaller&, TMarshaller&, bool) +{ + return false; +} + +template +static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, TMarshaller&, uint32_t) +{ + single = TMarshaller::marshalSingle; + block = TMarshaller::marshalBlock; + return true; +} + +template +static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block) +{ + single = NULL; + block = NULL; + PvdMarshalling marshaller = PvdMarshalling(); + return getMarshalOperators(single, block, marshaller, marshaller.canMarshal); +} + +template +static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t lgtypeId) +{ + switch(lgtypeId) + { + case PvdBaseType::PvdI8: // int8_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdU8: // uint8_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdI16: // int16_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdU16: // uint16_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdI32: // int32_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdU32: // uint32_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdI64: // int64_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdU64: // uint64_t: + return getMarshalOperators(single, block); + case PvdBaseType::PvdF32: + return getMarshalOperators(single, block); + case PvdBaseType::PvdF64: + return getMarshalOperators(single, block); + } + return false; +} + +static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t smtypeId, + int32_t lgtypeId) +{ + switch(smtypeId) + { + case PvdBaseType::PvdI8: // int8_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdU8: // uint8_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdI16: // int16_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdU16: // uint16_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdI32: // int32_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdU32: // uint32_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdI64: // int64_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdU64: // uint64_t: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdF32: + return getMarshalOperators(single, block, lgtypeId); + case PvdBaseType::PvdF64: + return getMarshalOperators(single, block, lgtypeId); + } + return false; +} +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp new file mode 100644 index 0000000..189235c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.cpp @@ -0,0 +1,119 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdImpl.h" +#include "PxPvdMemClient.h" + +namespace physx +{ +namespace pvdsdk +{ + +PvdMemClient::PvdMemClient(PvdImpl& pvd) +: mSDKPvd(pvd) +, mPvdDataStream(NULL) +, mIsConnected(false) +, mMemEventBuffer(profile::PxProfileMemoryEventBuffer::createMemoryEventBuffer(*gPvdAllocatorCallback)) +{ +} + +PvdMemClient::~PvdMemClient() +{ + mSDKPvd.removeClient(this); + if(mMemEventBuffer.hasClients()) + mPvdDataStream->destroyInstance(&mMemEventBuffer); + mMemEventBuffer.release(); +} + +PvdDataStream* PvdMemClient::getDataStream() +{ + return mPvdDataStream; +} + +bool PvdMemClient::isConnected() const +{ + return mIsConnected; +} + +void PvdMemClient::onPvdConnected() +{ + if(mIsConnected) + return; + mIsConnected = true; + + mPvdDataStream = PvdDataStream::create(&mSDKPvd); + mPvdDataStream->createInstance(&mMemEventBuffer); + mMemEventBuffer.addClient(*this); +} + +void PvdMemClient::onPvdDisconnected() +{ + if(!mIsConnected) + return; + mIsConnected = false; + + flush(); + + mMemEventBuffer.removeClient(*this); + mPvdDataStream->release(); + mPvdDataStream = NULL; +} + +void PvdMemClient::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr) +{ + mMutex.lock(); + mMemEventBuffer.onAllocation(inSize, inType, inFile, inLine, inAddr); + mMutex.unlock(); +} + +void PvdMemClient::onDeallocation(void* inAddr) +{ + mMutex.lock(); + mMemEventBuffer.onDeallocation(inAddr); + mMutex.unlock(); +} + +void PvdMemClient::flush() +{ + mMutex.lock(); + mMemEventBuffer.flushProfileEvents(); + mMutex.unlock(); +} + +void PvdMemClient::handleBufferFlush(const uint8_t* inData, uint32_t inLength) +{ + if(mPvdDataStream) + mPvdDataStream->setPropertyValue(&mMemEventBuffer, "events", inData, inLength); +} + +void PvdMemClient::handleClientRemoved() +{ +} + +} // pvd +} // physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.h new file mode 100644 index 0000000..3f7e2c5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdMemClient.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_MEM_CLIENT_H +#define PX_PVD_MEM_CLIENT_H + +#include "PxPvdClient.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxMutex.h" +#include "foundation/PxBroadcast.h" +#include "PxProfileEventBufferClient.h" +#include "PxProfileMemory.h" + +namespace physx +{ +class PvdDataStream; + +namespace pvdsdk +{ +class PvdImpl; +class PvdMemClient : public PvdClient, + public profile::PxProfileEventBufferClient, + public PxUserAllocated +{ + PX_NOCOPY(PvdMemClient) + public: + PvdMemClient(PvdImpl& pvd); + virtual ~PvdMemClient(); + + bool isConnected() const; + void onPvdConnected(); + void onPvdDisconnected(); + void flush(); + + PvdDataStream* getDataStream(); + void sendMemEvents(); + + // memory event + void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); + void onDeallocation(void* addr); + + private: + PvdImpl& mSDKPvd; + PvdDataStream* mPvdDataStream; + bool mIsConnected; + + // mem profile + PxMutex mMutex; // mem onallocation can called from different threads + profile::PxProfileMemoryEventBuffer& mMemEventBuffer; + void handleBufferFlush(const uint8_t* inData, uint32_t inLength); + void handleClientRemoved(); +}; + +} // namespace pvdsdk +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypeDefs.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypeDefs.h new file mode 100644 index 0000000..3154e17 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypeDefs.h @@ -0,0 +1,31 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +DECLARE_INTERNAL_PVD_TYPE(ArrayData) + +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypes.h new file mode 100644 index 0000000..96bb844 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelInternalTypes.h @@ -0,0 +1,153 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_OBJECT_MODEL_INTERNAL_TYPES_H +#define PX_PVD_OBJECT_MODEL_INTERNAL_TYPES_H + +#include "foundation/PxMemory.h" +#include "PxPvdObjectModelBaseTypes.h" +#include "foundation/PxArray.h" +#include "PxPvdFoundation.h" + +namespace physx +{ +namespace pvdsdk +{ + +struct PvdInternalType +{ + enum Enum + { + None = 0, +#define DECLARE_INTERNAL_PVD_TYPE(type) type, +#include "PxPvdObjectModelInternalTypeDefs.h" + Last +#undef DECLARE_INTERNAL_PVD_TYPE + }; +}; + +PX_COMPILE_TIME_ASSERT(uint32_t(PvdInternalType::Last) <= uint32_t(PvdBaseType::InternalStop)); + +template +struct DataTypeToPvdTypeMap +{ + bool compile_error; +}; +template +struct PvdTypeToDataTypeMap +{ + bool compile_error; +}; + +#define DECLARE_INTERNAL_PVD_TYPE(type) \ + template <> \ + struct DataTypeToPvdTypeMap \ + { \ + enum Enum \ + { \ + BaseTypeEnum = PvdInternalType::type \ + }; \ + }; \ + template <> \ + struct PvdTypeToDataTypeMap \ + { \ + typedef type TDataType; \ + }; \ + template <> \ + struct PvdDataTypeToNamespacedNameMap \ + { \ + NamespacedName Name; \ + PvdDataTypeToNamespacedNameMap() : Name("physx3_debugger_internal", #type) \ + { \ + } \ + }; +#include "PxPvdObjectModelInternalTypeDefs.h" +#undef DECLARE_INTERNAL_PVD_TYPE + +template +DataRef toDataRef(const PxArray& data) +{ + return DataRef(data.begin(), data.end()); +} + +static inline bool safeStrEq(const DataRef& lhs, const DataRef& rhs) +{ + uint32_t count = lhs.size(); + if(count != rhs.size()) + return false; + for(uint32_t idx = 0; idx < count; ++idx) + if(!safeStrEq(lhs[idx], rhs[idx])) + return false; + return true; +} + +static inline char* copyStr(const char* str) +{ + str = nonNull(str); + uint32_t len = static_cast(strlen(str)); + char* newData = reinterpret_cast(PX_ALLOC(len + 1, "string")); + PxMemCopy(newData, str, len); + newData[len] = 0; + return newData; +} + +// Used for predictable bit fields. +template +struct BitMaskSetter +{ + // Create a mask that masks out the orginal value shift into place + static TDataType createOffsetMask() + { + return createMask() << TOffset; + } + // Create a mask of TNumBits number of tis + static TDataType createMask() + { + return static_cast((1 << TNumBits) - 1); + } + void setValue(TDataType& inCurrent, TInputType inData) + { + PX_ASSERT(inData < (1 << TNumBits)); + + // Create a mask to remove the current value. + TDataType theMask = ~(createOffsetMask()); + // Clear out current value. + inCurrent = inCurrent & theMask; + // Create the new value. + TDataType theAddition = reinterpret_cast(inData << TOffset); + // or it into the existing value. + inCurrent = inCurrent | theAddition; + } + + TInputType getValue(TDataType inCurrent) + { + return static_cast((inCurrent >> TOffset) & createMask()); + } +}; + +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp new file mode 100644 index 0000000..dd79a19 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.cpp @@ -0,0 +1,1501 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "PxPvdObjectModelInternalTypes.h" +#include "PxPvdObjectModelMetaData.h" +#include "PxPvdInternalByteStreams.h" +#include "PxPvdMarshalling.h" + +using namespace physx; +using namespace pvdsdk; + +namespace +{ + +struct PropDescImpl : public PropertyDescription, public PxUserAllocated +{ + PxArray mValueNames; + PropDescImpl(const PropertyDescription& inBase, StringTable& table) + : PropertyDescription(inBase), mValueNames("NamedValue") + { + mName = table.registerStr(mName); + } + PropDescImpl() : mValueNames("NamedValue") + { + } + + template + void serialize(TSerializer& serializer) + { + serializer.streamify(mOwnerClassName); + serializer.streamify(mOwnerClassId); + serializer.streamify(mSemantic); + serializer.streamify(mDatatype); + serializer.streamify(mDatatypeName); + serializer.streamify(mPropertyType); + serializer.streamify(mPropertyId); + serializer.streamify(m32BitOffset); + serializer.streamify(m64BitOffset); + serializer.streamify(mValueNames); + serializer.streamify(mName); + } +}; + +struct ClassDescImpl : public ClassDescription, public PxUserAllocated +{ + PxArray mPropImps; + PxArray m32OffsetArray; + PxArray m64OffsetArray; + ClassDescImpl(const ClassDescription& inBase) + : ClassDescription(inBase) + , mPropImps("PropDescImpl*") + , m32OffsetArray("ClassDescImpl::m32OffsetArray") + , m64OffsetArray("ClassDescImpl::m64OffsetArray") + { + PVD_FOREACH(idx, get32BitSizeInfo().mPtrOffsets.size()) + m32OffsetArray.pushBack(get32BitSizeInfo().mPtrOffsets[idx]); + PVD_FOREACH(idx, get64BitSizeInfo().mPtrOffsets.size()) + m64OffsetArray.pushBack(get64BitSizeInfo().mPtrOffsets[idx]); + } + ClassDescImpl() + : mPropImps("PropDescImpl*") + , m32OffsetArray("ClassDescImpl::m32OffsetArray") + , m64OffsetArray("ClassDescImpl::m64OffsetArray") + { + } + PropDescImpl* findProperty(String name) + { + PVD_FOREACH(idx, mPropImps.size()) + { + if(safeStrEq(mPropImps[idx]->mName, name)) + return mPropImps[idx]; + } + return NULL; + } + void addProperty(PropDescImpl* prop) + { + mPropImps.pushBack(prop); + } + + void addPtrOffset(PtrOffsetType::Enum type, uint32_t offset32, uint32_t offset64) + { + m32OffsetArray.pushBack(PtrOffset(type, offset32)); + m64OffsetArray.pushBack(PtrOffset(type, offset64)); + get32BitSizeInfo().mPtrOffsets = DataRef(m32OffsetArray.begin(), m32OffsetArray.end()); + get64BitSizeInfo().mPtrOffsets = DataRef(m64OffsetArray.begin(), m64OffsetArray.end()); + } + + template + void serialize(TSerializer& serializer) + { + serializer.streamify(mName); + serializer.streamify(mClassId); + serializer.streamify(mBaseClass); + serializer.streamify(mPackedUniformWidth); + serializer.streamify(mPackedClassType); + serializer.streamify(mLocked); + serializer.streamify(mRequiresDestruction); + serializer.streamify(get32BitSize()); + serializer.streamify(get32BitSizeInfo().mDataByteSize); + serializer.streamify(get32BitSizeInfo().mAlignment); + serializer.streamify(get64BitSize()); + serializer.streamify(get64BitSizeInfo().mDataByteSize); + serializer.streamify(get64BitSizeInfo().mAlignment); + serializer.streamifyLinks(mPropImps); + serializer.streamify(m32OffsetArray); + serializer.streamify(m64OffsetArray); + get32BitSizeInfo().mPtrOffsets = DataRef(m32OffsetArray.begin(), m32OffsetArray.end()); + get64BitSizeInfo().mPtrOffsets = DataRef(m64OffsetArray.begin(), m64OffsetArray.end()); + } +}; + +class StringTableImpl : public StringTable, public PxUserAllocated +{ + PxHashMap mStrings; + uint32_t mNextStrHandle; + PxHashMap mHandleToStr; + PxHashMap mStrToHandle; + + public: + StringTableImpl() + : mStrings("StringTableImpl::mStrings") + , mNextStrHandle(1) + , mHandleToStr("StringTableImpl::mHandleToStr") + , mStrToHandle("StringTableImpl::mStrToHandle") + { + } + uint32_t nextHandleValue() + { + return mNextStrHandle++; + } + virtual ~StringTableImpl() + { + for(PxHashMap::Iterator iter = mStrings.getIterator(); !iter.done(); ++iter) + PX_FREE(iter->second); + mStrings.clear(); + } + virtual uint32_t getNbStrs() + { + return mStrings.size(); + } + virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0) + { + startIdx = PxMin(getNbStrs(), startIdx); + uint32_t numStrs(PxMin(getNbStrs() - startIdx, bufLen)); + PxHashMap::Iterator iter(mStrings.getIterator()); + for(uint32_t idx = 0; idx < startIdx; ++idx, ++iter) + ; + for(uint32_t idx = 0; idx < numStrs && !iter.done(); ++idx, ++iter) + outStrs[idx] = iter->second; + return numStrs; + } + void addStringHandle(char* str, uint32_t hdl) + { + mHandleToStr.insert(hdl, str); + mStrToHandle.insert(str, hdl); + } + + uint32_t addStringHandle(char* str) + { + uint32_t theNewHandle = nextHandleValue(); + addStringHandle(str, theNewHandle); + return theNewHandle; + } + const char* doRegisterStr(const char* str, bool& outAdded) + { + PX_ASSERT(isMeaningful(str)); + const PxHashMap::Entry* entry(mStrings.find(str)); + if(entry == NULL) + { + outAdded = true; + char* retval(copyStr(str)); + mStrings.insert(retval, retval); + return retval; + } + return entry->second; + } + virtual const char* registerStr(const char* str, bool& outAdded) + { + outAdded = false; + if(isMeaningful(str) == false) + return ""; + const char* retval = doRegisterStr(str, outAdded); + if(outAdded) + addStringHandle(const_cast(retval)); + return retval; + } + + NamespacedName registerName(const NamespacedName& nm) + { + return NamespacedName(registerStr(nm.mNamespace), registerStr(nm.mName)); + } + const char* registerStr(const char* str) + { + bool ignored; + return registerStr(str, ignored); + } + + virtual StringHandle strToHandle(const char* str) + { + if(isMeaningful(str) == false) + return 0; + const PxHashMap::Entry* entry(mStrToHandle.find(str)); + if(entry) + return entry->second; + bool added = false; + const char* registeredStr = doRegisterStr(str, added); + uint32_t theNewHandle = addStringHandle(const_cast(registeredStr)); + PX_ASSERT(mStrToHandle.find(str)); + PX_ASSERT(added); + return theNewHandle; + } + + virtual const char* handleToStr(uint32_t hdl) + { + if(hdl == 0) + return ""; + const PxHashMap::Entry* entry(mHandleToStr.find(hdl)); + if(entry) + return entry->second; + // unregistered handle... + return ""; + } + + void write(PvdOutputStream& stream) + { + uint32_t numStrs = static_cast(mHandleToStr.size()); + stream << numStrs; + stream << mNextStrHandle; + for(PxHashMap::Iterator iter = mHandleToStr.getIterator(); !iter.done(); ++iter) + { + stream << iter->first; + uint32_t len = static_cast(strlen(iter->second) + 1); + stream << len; + stream.write(reinterpret_cast(iter->second), len); + } + } + + template + void read(TReader& stream) + { + mHandleToStr.clear(); + mStrToHandle.clear(); + uint32_t numStrs; + stream >> numStrs; + stream >> mNextStrHandle; + PxArray readBuffer("StringTable::read::readBuffer"); + uint32_t bufSize = 0; + for(uint32_t idx = 0; idx < numStrs; ++idx) + { + uint32_t handleValue; + uint32_t bufLen; + stream >> handleValue; + stream >> bufLen; + if(bufSize < bufLen) + readBuffer.resize(bufLen); + bufSize = PxMax(bufSize, bufLen); + stream.read(readBuffer.begin(), bufLen); + bool ignored; + const char* newStr = doRegisterStr(reinterpret_cast(readBuffer.begin()), ignored); + addStringHandle(const_cast(newStr), handleValue); + } + } + + virtual void release() + { + PVD_DELETE(this); + } + + private: + StringTableImpl& operator=(const StringTableImpl&); +}; + +struct NamespacedNameHasher +{ + uint32_t operator()(const NamespacedName& nm) + { + return PxHash()(nm.mNamespace) ^ PxHash()(nm.mName); + } + bool equal(const NamespacedName& lhs, const NamespacedName& rhs) + { + return safeStrEq(lhs.mNamespace, rhs.mNamespace) && safeStrEq(lhs.mName, rhs.mName); + } +}; + +struct ClassPropertyName +{ + NamespacedName mName; + String mPropName; + ClassPropertyName(const NamespacedName& name = NamespacedName(), String propName = "") + : mName(name), mPropName(propName) + { + } +}; + +struct ClassPropertyNameHasher +{ + uint32_t operator()(const ClassPropertyName& nm) + { + return NamespacedNameHasher()(nm.mName) ^ PxHash()(nm.mPropName); + } + bool equal(const ClassPropertyName& lhs, const ClassPropertyName& rhs) + { + return NamespacedNameHasher().equal(lhs.mName, rhs.mName) && safeStrEq(lhs.mPropName, rhs.mPropName); + } +}; + +struct PropertyMessageEntryImpl : public PropertyMessageEntry +{ + PropertyMessageEntryImpl(const PropertyMessageEntry& data) : PropertyMessageEntry(data) + { + } + PropertyMessageEntryImpl() + { + } + template + void serialize(TSerializerType& serializer) + { + serializer.streamify(mDatatypeName); + serializer.streamify(mDatatypeId); + serializer.streamify(mMessageOffset); + serializer.streamify(mByteSize); + serializer.streamify(mDestByteSize); + serializer.streamify(mProperty); + } +}; + +struct PropertyMessageDescriptionImpl : public PropertyMessageDescription, public PxUserAllocated +{ + PxArray mEntryImpls; + PxArray mEntries; + PxArray mStringOffsetArray; + PropertyMessageDescriptionImpl(const PropertyMessageDescription& data) + : PropertyMessageDescription(data) + , mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls") + , mEntries("PropertyMessageDescriptionImpl::mEntries") + , mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets") + { + } + PropertyMessageDescriptionImpl() + : mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls") + , mEntries("PropertyMessageDescriptionImpl::mEntries") + , mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets") + { + } + + ~PropertyMessageDescriptionImpl() + { + } + + void addEntry(const PropertyMessageEntryImpl& entry) + { + mEntryImpls.pushBack(entry); + mEntries.pushBack(entry); + mProperties = DataRef(mEntries.begin(), mEntries.end()); + } + + template + void serialize(TSerializerType& serializer) + { + serializer.streamify(mClassName); + serializer.streamify(mClassId); // No other class has this id, it is DB-unique + serializer.streamify(mMessageName); + serializer.streamify(mMessageId); + serializer.streamify(mMessageByteSize); + serializer.streamify(mEntryImpls); + serializer.streamify(mStringOffsetArray); + if(mEntries.size() != mEntryImpls.size()) + { + mEntries.clear(); + uint32_t numEntries = static_cast(mEntryImpls.size()); + for(uint32_t idx = 0; idx < numEntries; ++idx) + mEntries.pushBack(mEntryImpls[idx]); + } + mProperties = DataRef(mEntries.begin(), mEntries.end()); + mStringOffsets = DataRef(mStringOffsetArray.begin(), mStringOffsetArray.end()); + } + + private: + PropertyMessageDescriptionImpl& operator=(const PropertyMessageDescriptionImpl&); +}; + +struct PvdObjectModelMetaDataImpl : public PvdObjectModelMetaData, public PxUserAllocated +{ + typedef PxHashMap TNameToClassMap; + typedef PxHashMap TNameToPropMap; + typedef PxHashMap TNameToPropertyMessageMap; + + TNameToClassMap mNameToClasses; + TNameToPropMap mNameToProperties; + PxArray mClasses; + PxArray mProperties; + StringTableImpl* mStringTable; + TNameToPropertyMessageMap mPropertyMessageMap; + PxArray mPropertyMessages; + int32_t mNextClassId; + uint32_t mRefCount; + + PvdObjectModelMetaDataImpl() + : mNameToClasses("NamespacedName->ClassDescImpl*") + , mNameToProperties("ClassPropertyName->PropDescImpl*") + , mClasses("ClassDescImpl*") + , mProperties("PropDescImpl*") + , mStringTable(PVD_NEW(StringTableImpl)()) + , mPropertyMessageMap("PropertyMessageMap") + , mPropertyMessages("PvdObjectModelMetaDataImpl::mPropertyMessages") + , mNextClassId(1) + , mRefCount(0) + { + } + + private: + PvdObjectModelMetaDataImpl& operator=(const PvdObjectModelMetaDataImpl&); + + public: + int32_t nextClassId() + { + return mNextClassId++; + } + void initialize() + { + // Create the default classes. + { + ClassDescImpl& aryData = getOrCreateClassImpl(getPvdNamespacedNameForType(), + DataTypeToPvdTypeMap::BaseTypeEnum); + aryData.get32BitSize() = sizeof(ArrayData); + aryData.get32BitSizeInfo().mAlignment = sizeof(void*); + aryData.get64BitSize() = sizeof(ArrayData); + aryData.get64BitSizeInfo().mAlignment = sizeof(void*); + aryData.mLocked = true; + } +#define CREATE_BASIC_PVD_CLASS(type) \ + { \ + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); \ + cls.get32BitSize() = sizeof(type); \ + cls.get32BitSizeInfo().mAlignment = sizeof(type); \ + cls.get64BitSize() = sizeof(type); \ + cls.get64BitSizeInfo().mAlignment = sizeof(type); \ + cls.mLocked = true; \ + cls.mPackedUniformWidth = sizeof(type); \ + cls.mPackedClassType = getPvdTypeForType(); \ + } + CREATE_BASIC_PVD_CLASS(int8_t) + CREATE_BASIC_PVD_CLASS(uint8_t) + CREATE_BASIC_PVD_CLASS(bool) + CREATE_BASIC_PVD_CLASS(int16_t) + CREATE_BASIC_PVD_CLASS(uint16_t) + CREATE_BASIC_PVD_CLASS(int32_t) + CREATE_BASIC_PVD_CLASS(uint32_t) + // CREATE_BASIC_PVD_CLASS(uint32_t) + CREATE_BASIC_PVD_CLASS(int64_t) + CREATE_BASIC_PVD_CLASS(uint64_t) + CREATE_BASIC_PVD_CLASS(float) + CREATE_BASIC_PVD_CLASS(double) +#undef CREATE_BASIC_PVD_CLASS + +#define CREATE_PTR_TYPE_PVD_CLASS(type, ptrType) \ + { \ + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); \ + cls.get32BitSize() = 4; \ + cls.get32BitSizeInfo().mAlignment = 4; \ + cls.get64BitSize() = 8; \ + cls.get64BitSizeInfo().mAlignment = 8; \ + cls.mLocked = true; \ + cls.addPtrOffset(PtrOffsetType::ptrType, 0, 0); \ + } + + CREATE_PTR_TYPE_PVD_CLASS(String, StringOffset) + CREATE_PTR_TYPE_PVD_CLASS(VoidPtr, VoidPtrOffset) + CREATE_PTR_TYPE_PVD_CLASS(StringHandle, StringOffset) + CREATE_PTR_TYPE_PVD_CLASS(ObjectRef, VoidPtrOffset) + +#undef CREATE_64BIT_ADJUST_PVD_CLASS + + int32_t fltClassType = getPvdTypeForType(); + int32_t u32ClassType = getPvdTypeForType(); + int32_t v3ClassType = getPvdTypeForType(); + int32_t v4ClassType = getPvdTypeForType(); + int32_t qtClassType = getPvdTypeForType(); + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "r", "", getPvdTypeForType(), PropertyType::Scalar); + createProperty(cls.mClassId, "g", "", getPvdTypeForType(), PropertyType::Scalar); + createProperty(cls.mClassId, "b", "", getPvdTypeForType(), PropertyType::Scalar); + createProperty(cls.mClassId, "a", "", getPvdTypeForType(), PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 1); + PX_ASSERT(cls.get32BitSize() == 4); + PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 1); + PX_ASSERT(cls.get64BitSize() == 4); + PX_ASSERT(cls.mPackedUniformWidth == 1); + PX_ASSERT(cls.mPackedClassType == getPvdTypeForType()); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 8); + PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get64BitSize() == 8); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + { + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 12); + PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get64BitSize() == 12); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + { + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 16); + PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get64BitSize() == 16); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 16); + PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get64BitSize() == 16); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "minimum", "", v3ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "maximum", "", v3ClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 24); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "q", "", qtClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "p", "", v3ClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 28); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "column0", "", v3ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "column1", "", v3ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "column2", "", v3ClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 36); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "column0", "", v4ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "column1", "", v4ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "column2", "", v4ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "column3", "", v4ClassType, PropertyType::Scalar); + PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); + PX_ASSERT(cls.get32BitSize() == 64); + PX_ASSERT(cls.mPackedUniformWidth == 4); + PX_ASSERT(cls.mPackedClassType == fltClassType); + cls.mLocked = true; + } + + { + ClassDescImpl& cls = + getOrCreateClassImpl(getPvdNamespacedNameForType(), getPvdTypeForType()); + createProperty(cls.mClassId, "d0", "", u32ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "d1", "", u32ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "d2", "", u32ClassType, PropertyType::Scalar); + createProperty(cls.mClassId, "d3", "", u32ClassType, PropertyType::Scalar); + cls.mLocked = true; + } + } + virtual ~PvdObjectModelMetaDataImpl() + { + mStringTable->release(); + PVD_FOREACH(idx, mClasses.size()) + { + if(mClasses[idx] != NULL) + PVD_DELETE(mClasses[idx]); + } + mClasses.clear(); + PVD_FOREACH(idx, mProperties.size()) PVD_DELETE(mProperties[idx]); + mProperties.clear(); + PVD_FOREACH(idx, mPropertyMessages.size()) PVD_DELETE(mPropertyMessages[idx]); + mPropertyMessages.clear(); + } + + ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm, int32_t idx) + { + ClassDescImpl* impl(getClassImpl(idx)); + if(impl) + return *impl; + NamespacedName safeName(mStringTable->registerStr(nm.mNamespace), mStringTable->registerStr(nm.mName)); + while(idx >= int32_t(mClasses.size())) + mClasses.pushBack(NULL); + mClasses[uint32_t(idx)] = PVD_NEW(ClassDescImpl)(ClassDescription(safeName, idx)); + mNameToClasses.insert(nm, mClasses[uint32_t(idx)]); + mNextClassId = PxMax(mNextClassId, idx + 1); + return *mClasses[uint32_t(idx)]; + } + + ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm) + { + ClassDescImpl* retval = findClassImpl(nm); + if(retval) + return *retval; + return getOrCreateClassImpl(nm, nextClassId()); + } + virtual ClassDescription getOrCreateClass(const NamespacedName& nm) + { + return getOrCreateClassImpl(nm); + } + // get or create parent, lock parent. deriveFrom getOrCreatechild. + virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child) + { + ClassDescImpl& p(getOrCreateClassImpl(parent)); + ClassDescImpl& c(getOrCreateClassImpl(child)); + + if(c.mBaseClass >= 0) + { + PX_ASSERT(c.mBaseClass == p.mClassId); + return false; + } + p.mLocked = true; + c.mBaseClass = p.mClassId; + c.get32BitSizeInfo() = p.get32BitSizeInfo(); + c.get64BitSizeInfo() = p.get64BitSizeInfo(); + c.mPackedClassType = p.mPackedClassType; + c.mPackedUniformWidth = p.mPackedUniformWidth; + c.mRequiresDestruction = p.mRequiresDestruction; + c.m32OffsetArray = p.m32OffsetArray; + c.m64OffsetArray = p.m64OffsetArray; + // Add all the parent propertes to this class in the global name map. + for(ClassDescImpl* parent0 = &p; parent0 != NULL; parent0 = getClassImpl(parent0->mBaseClass)) + { + PVD_FOREACH(idx, parent0->mPropImps.size()) + mNameToProperties.insert(ClassPropertyName(c.mName, parent0->mPropImps[idx]->mName), parent0->mPropImps[idx]); + + if(parent0->mBaseClass < 0) + break; + } + + return true; + } + ClassDescImpl* findClassImpl(const NamespacedName& nm) const + { + const TNameToClassMap::Entry* entry(mNameToClasses.find(nm)); + if(entry) + return entry->second; + return NULL; + } + virtual Option findClass(const NamespacedName& nm) const + { + ClassDescImpl* retval = findClassImpl(nm); + if(retval) + return *retval; + return Option(); + } + + ClassDescImpl* getClassImpl(int32_t classId) const + { + if(classId < 0) + return NULL; + uint32_t idx = uint32_t(classId); + if(idx < mClasses.size()) + return mClasses[idx]; + return NULL; + } + + virtual Option getClass(int32_t classId) const + { + ClassDescImpl* impl(getClassImpl(classId)); + if(impl) + return *impl; + return None(); + } + + virtual ClassDescription* getClassPtr(int32_t classId) const + { + return getClassImpl(classId); + } + + virtual Option getParentClass(int32_t classId) const + { + ClassDescImpl* impl(getClassImpl(classId)); + if(impl == NULL) + return None(); + return getClass(impl->mBaseClass); + } + + virtual void lockClass(int32_t classId) + { + ClassDescImpl* impl(getClassImpl(classId)); + PX_ASSERT(impl); + if(impl) + impl->mLocked = true; + } + virtual uint32_t getNbClasses() const + { + uint32_t total = 0; + PVD_FOREACH(idx, mClasses.size()) if(mClasses[idx])++ total; + return total; + } + + virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const + { + uint32_t classCount(getNbClasses()); + startIndex = PxMin(classCount, startIndex); + uint32_t retAmount = PxMin(requestCount, classCount - startIndex); + + uint32_t idx = 0; + while(startIndex) + { + if(mClasses[idx] != NULL) + --startIndex; + ++idx; + } + + uint32_t inserted = 0; + uint32_t classesSize = static_cast(mClasses.size()); + while(inserted < retAmount && idx < classesSize) + { + if(mClasses[idx] != NULL) + { + outClasses[inserted] = *mClasses[idx]; + ++inserted; + } + ++idx; + } + return inserted; + } + + uint32_t updateByteSizeAndGetPropertyAlignment(ClassDescriptionSizeInfo& dest, const ClassDescriptionSizeInfo& src) + { + uint32_t alignment = src.mAlignment; + dest.mAlignment = PxMax(dest.mAlignment, alignment); + uint32_t offset = align(dest.mDataByteSize, alignment); + dest.mDataByteSize = offset + src.mByteSize; + dest.mByteSize = align(dest.mDataByteSize, dest.mAlignment); + return offset; + } + + void transferPtrOffsets(ClassDescriptionSizeInfo& destInfo, PxArray& destArray, + const PxArray& src, uint32_t offset) + { + PVD_FOREACH(idx, src.size()) + destArray.pushBack(PtrOffset(src[idx].mOffsetType, src[idx].mOffset + offset)); + destInfo.mPtrOffsets = DataRef(destArray.begin(), destArray.end()); + } + + virtual Option createProperty(int32_t classId, String name, String semantic, int32_t datatype, + PropertyType::Enum propertyType) + { + ClassDescImpl* cls(getClassImpl(classId)); + PX_ASSERT(cls); + if(!cls) + return None(); + if(cls->mLocked) + { + PX_ASSERT(false); + return None(); + } + PropDescImpl* impl(cls->findProperty(name)); + // duplicate property definition + if(impl) + { + PX_ASSERT(false); + return None(); + } + if(datatype == getPvdTypeForType()) + { + PX_ASSERT(false); + return None(); + } + // The datatype for this property has not been declared. + ClassDescImpl* propDType(getClassImpl(datatype)); + PX_ASSERT(propDType); + if(!propDType) + return None(); + NamespacedName propClsName(propDType->mName); + int32_t propPackedWidth = propDType->mPackedUniformWidth; + int32_t propPackedType = propDType->mPackedClassType; + // The implications of properties being complex types aren't major + //*until* you start trying to undue a property event that set values + // of those complex types. Then things just get too complex. + if(propDType->mRequiresDestruction) + { + PX_ASSERT(false); + return None(); + } + bool requiresDestruction = propDType->mRequiresDestruction || cls->mRequiresDestruction; + + if(propertyType == PropertyType::Array) + { + int32_t tempId = DataTypeToPvdTypeMap::BaseTypeEnum; + propDType = getClassImpl(tempId); + PX_ASSERT(propDType); + if(!propDType) + return None(); + requiresDestruction = true; + } + uint32_t offset32 = updateByteSizeAndGetPropertyAlignment(cls->get32BitSizeInfo(), propDType->get32BitSizeInfo()); + uint32_t offset64 = updateByteSizeAndGetPropertyAlignment(cls->get64BitSizeInfo(), propDType->get64BitSizeInfo()); + transferPtrOffsets(cls->get32BitSizeInfo(), cls->m32OffsetArray, propDType->m32OffsetArray, offset32); + transferPtrOffsets(cls->get64BitSizeInfo(), cls->m64OffsetArray, propDType->m64OffsetArray, offset64); + propDType->mLocked = true; // Can't add members to the property type. + cls->mRequiresDestruction = requiresDestruction; + int32_t propId = int32_t(mProperties.size()); + PropertyDescription newDesc(cls->mName, cls->mClassId, name, semantic, datatype, propClsName, propertyType, + propId, offset32, offset64); + mProperties.pushBack(PVD_NEW(PropDescImpl)(newDesc, *mStringTable)); + mNameToProperties.insert(ClassPropertyName(cls->mName, mProperties.back()->mName), mProperties.back()); + cls->addProperty(mProperties.back()); + bool firstProp = cls->mPropImps.size() == 1; + + if(firstProp) + { + cls->mPackedUniformWidth = propPackedWidth; + cls->mPackedClassType = propPackedType; + } + else + { + bool packed = (propPackedWidth > 0) && (cls->get32BitSizeInfo().mDataByteSize % propPackedWidth) == 0; + if(cls->mPackedClassType >= 0) // maybe uncheck packed class type + { + if(propPackedType < 0 || cls->mPackedClassType != propPackedType + // Object refs require conversion from stream to db id + || + datatype == getPvdTypeForType() + // Strings also require conversion from stream to db id. + || + datatype == getPvdTypeForType() || packed == false) + cls->mPackedClassType = -1; + } + if(cls->mPackedUniformWidth >= 0) // maybe uncheck packed class width + { + if(propPackedWidth < 0 || cls->mPackedUniformWidth != propPackedWidth + // object refs, because they require special treatment during parsing, + // cannot be packed + || + datatype == getPvdTypeForType() + // Likewise, string handles are special because the data needs to be sent *after* + // the + || + datatype == getPvdTypeForType() || packed == false) + cls->mPackedUniformWidth = -1; // invalid packed width. + } + } + return *mProperties.back(); + } + + PropDescImpl* findPropImpl(const NamespacedName& clsName, String prop) const + { + const TNameToPropMap::Entry* entry = mNameToProperties.find(ClassPropertyName(clsName, prop)); + if(entry) + return entry->second; + return NULL; + } + virtual Option findProperty(const NamespacedName& cls, String propName) const + { + PropDescImpl* prop(findPropImpl(cls, propName)); + if(prop) + return *prop; + return None(); + } + + virtual Option findProperty(int32_t clsId, String propName) const + { + ClassDescImpl* cls(getClassImpl(clsId)); + PX_ASSERT(cls); + if(!cls) + return None(); + PropDescImpl* prop(findPropImpl(cls->mName, propName)); + if(prop) + return *prop; + return None(); + } + + PropDescImpl* getPropertyImpl(int32_t propId) const + { + PX_ASSERT(propId >= 0); + if(propId < 0) + return NULL; + uint32_t val = uint32_t(propId); + if(val >= mProperties.size()) + { + PX_ASSERT(false); + return NULL; + } + return mProperties[val]; + } + + virtual Option getProperty(int32_t propId) const + { + PropDescImpl* impl(getPropertyImpl(propId)); + if(impl) + return *impl; + return None(); + } + + virtual void setNamedPropertyValues(DataRef values, int32_t propId) + { + PropDescImpl* impl(getPropertyImpl(propId)); + if(impl) + { + impl->mValueNames.resize(values.size()); + PVD_FOREACH(idx, values.size()) impl->mValueNames[idx] = values[idx]; + } + } + + virtual DataRef getNamedPropertyValues(int32_t propId) const + { + PropDescImpl* impl(getPropertyImpl(propId)); + if(impl) + { + return toDataRef(impl->mValueNames); + } + return DataRef(); + } + + virtual uint32_t getNbProperties(int32_t classId) const + { + uint32_t retval = 0; + for(ClassDescImpl* impl(getClassImpl(classId)); impl; impl = getClassImpl(impl->mBaseClass)) + { + retval += impl->mPropImps.size(); + if(impl->mBaseClass < 0) + break; + } + return retval; + } + + // Properties need to be returned in base class order, so this requires a recursive function. + uint32_t getPropertiesImpl(int32_t classId, PropertyDescription*& outBuffer, uint32_t& numItems, + uint32_t& startIdx) const + { + ClassDescImpl* impl = getClassImpl(classId); + if(impl) + { + uint32_t retval = 0; + if(impl->mBaseClass >= 0) + retval = getPropertiesImpl(impl->mBaseClass, outBuffer, numItems, startIdx); + + uint32_t localStart = PxMin(impl->mPropImps.size(), startIdx); + uint32_t localNumItems = PxMin(numItems, impl->mPropImps.size() - localStart); + PVD_FOREACH(idx, localNumItems) + { + outBuffer[idx] = *impl->mPropImps[localStart + idx]; + } + + startIdx -= localStart; + numItems -= localNumItems; + outBuffer += localNumItems; + return retval + localNumItems; + } + return 0; + } + + virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t numItems, + uint32_t startIdx) const + { + return getPropertiesImpl(classId, outBuffer, numItems, startIdx); + } + + virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const + { + Option propTypeOpt(getClass(dstClsId)); + if(propTypeOpt.hasValue() == false) + { + PX_ASSERT(false); + return MarshalQueryResult(); + } + const ClassDescription& propType(propTypeOpt); + + Option incomingTypeOpt(getClass(srcClsId)); + if(incomingTypeOpt.hasValue() == false) + { + PX_ASSERT(false); + return MarshalQueryResult(); + } + const ClassDescription& incomingType(incomingTypeOpt); + // Can only marshal simple things at this point in time. + bool needsMarshalling = false; + bool canMarshal = false; + TSingleMarshaller single = NULL; + TBlockMarshaller block = NULL; + if(incomingType.mClassId != propType.mClassId) + { + // Check that marshalling is even possible. + if((incomingType.mPackedUniformWidth >= 0 && propType.mPackedUniformWidth >= 0) == false) + { + PX_ASSERT(false); + return MarshalQueryResult(); + } + + int32_t srcType = incomingType.mPackedClassType; + int32_t dstType = propType.mPackedClassType; + + int32_t srcWidth = incomingType.mPackedUniformWidth; + int32_t dstWidth = propType.mPackedUniformWidth; + canMarshal = getMarshalOperators(single, block, srcType, dstType); + if(srcWidth == dstWidth) + needsMarshalling = canMarshal; // If the types are the same width, we assume we can convert between some + // of them seamlessly (uint16_t, int16_t) + else + { + needsMarshalling = true; + // If we can't marshall and we have to then we can't set the property value. + // This indicates that the src and dest are different properties and we don't + // know how to convert between them. + if(!canMarshal) + { + PX_ASSERT(false); + return MarshalQueryResult(); + } + } + } + return MarshalQueryResult(srcClsId, dstClsId, canMarshal, needsMarshalling, block); + } + + PropertyMessageDescriptionImpl* findPropertyMessageImpl(const NamespacedName& messageName) const + { + const TNameToPropertyMessageMap::Entry* entry = mPropertyMessageMap.find(messageName); + if(entry) + return entry->second; + return NULL; + } + + PropertyMessageDescriptionImpl* getPropertyMessageImpl(int32_t msg) const + { + int32_t msgCount = int32_t(mPropertyMessages.size()); + if(msg >= 0 && msg < msgCount) + return mPropertyMessages[uint32_t(msg)]; + return NULL; + } + + virtual Option createPropertyMessage(const NamespacedName& clsName, + const NamespacedName& messageName, + DataRef entries, + uint32_t messageSize) + { + PropertyMessageDescriptionImpl* existing(findPropertyMessageImpl(messageName)); + if(existing) + { + PX_ASSERT(false); + return None(); + } + ClassDescImpl* cls = findClassImpl(clsName); + PX_ASSERT(cls); + if(!cls) + return None(); + int32_t msgId = int32_t(mPropertyMessages.size()); + PropertyMessageDescriptionImpl* newMessage = PVD_NEW(PropertyMessageDescriptionImpl)( + PropertyMessageDescription(mStringTable->registerName(clsName), cls->mClassId, + mStringTable->registerName(messageName), msgId, messageSize)); + uint32_t calculatedSize = 0; + PVD_FOREACH(idx, entries.size()) + { + PropertyMessageArg entry(entries[idx]); + ClassDescImpl* dtypeCls = findClassImpl(entry.mDatatypeName); + if(dtypeCls == NULL) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + ClassDescriptionSizeInfo dtypeInfo(dtypeCls->get32BitSizeInfo()); + uint32_t incomingSize = dtypeInfo.mByteSize; + if(entry.mByteSize < incomingSize) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + + calculatedSize = PxMax(calculatedSize, entry.mMessageOffset + entry.mByteSize); + if(calculatedSize > messageSize) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + + Option propName(findProperty(cls->mClassId, entry.mPropertyName)); + if(propName.hasValue() == false) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + + Option propCls(getClass(propName.getValue().mDatatype)); + if(propCls.hasValue() == false) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + + PropertyMessageEntryImpl newEntry(PropertyMessageEntry( + propName, dtypeCls->mName, dtypeCls->mClassId, entry.mMessageOffset, incomingSize, dtypeInfo.mByteSize)); + newMessage->addEntry(newEntry); + + if(newEntry.mDatatypeId == getPvdTypeForType()) + newMessage->mStringOffsetArray.pushBack(entry.mMessageOffset); + + // property messages cannot be marshalled at this time. + if(newEntry.mDatatypeId != getPvdTypeForType() && newEntry.mDatatypeId != getPvdTypeForType()) + { + MarshalQueryResult marshalInfo = checkMarshalling(newEntry.mDatatypeId, newEntry.mProperty.mDatatype); + if(marshalInfo.needsMarshalling) + { + PX_ASSERT(false); + goto DestroyNewMessage; + } + } + } + + if(newMessage) + { + newMessage->mStringOffsets = + DataRef(newMessage->mStringOffsetArray.begin(), newMessage->mStringOffsetArray.end()); + mPropertyMessages.pushBack(newMessage); + mPropertyMessageMap.insert(messageName, newMessage); + return *newMessage; + } + + DestroyNewMessage: + if(newMessage) + PVD_DELETE(newMessage); + + return None(); + } + virtual Option findPropertyMessage(const NamespacedName& msgName) const + { + PropertyMessageDescriptionImpl* desc(findPropertyMessageImpl(msgName)); + if(desc) + return *desc; + return None(); + } + + virtual Option getPropertyMessage(int32_t msgId) const + { + PropertyMessageDescriptionImpl* desc(getPropertyMessageImpl(msgId)); + if(desc) + return *desc; + return None(); + } + + virtual uint32_t getNbPropertyMessages() const + { + return mPropertyMessages.size(); + } + + virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen, uint32_t startIdx = 0) const + { + startIdx = PxMin(startIdx, getNbPropertyMessages()); + bufLen = PxMin(bufLen, getNbPropertyMessages() - startIdx); + PVD_FOREACH(idx, bufLen) msgBuf[idx] = *mPropertyMessages[idx + startIdx]; + return bufLen; + } + + struct MetaDataWriter + { + const PvdObjectModelMetaDataImpl& mMetaData; + PvdOutputStream& mStream; + MetaDataWriter(const PvdObjectModelMetaDataImpl& meta, PvdOutputStream& stream) + : mMetaData(meta), mStream(stream) + { + } + + void streamify(NamespacedName& type) + { + mStream << mMetaData.mStringTable->strToHandle(type.mNamespace); + mStream << mMetaData.mStringTable->strToHandle(type.mName); + } + void streamify(String& type) + { + mStream << mMetaData.mStringTable->strToHandle(type); + } + void streamify(int32_t& type) + { + mStream << type; + } + void streamify(uint32_t& type) + { + mStream << type; + } + void streamify(uint8_t type) + { + mStream << type; + } + void streamify(bool type) + { + streamify( uint8_t(type)); + } + void streamify(PropertyType::Enum type) + { + uint32_t val = static_cast(type); + mStream << val; + } + void streamify(NamedValue& type) + { + streamify(type.mValue); + streamify(type.mName); + } + void streamifyLinks(PropDescImpl* prop) + { + streamify(prop->mPropertyId); + } + void streamify(PropertyDescription& prop) + { + streamify(prop.mPropertyId); + } + void streamify(PropertyMessageEntryImpl& prop) + { + prop.serialize(*this); + } + void streamify(PtrOffset& off) + { + uint32_t type = off.mOffsetType; + mStream << type; + mStream << off.mOffset; + } + template + void streamify(TDataType* type) + { + int32_t existMarker = type ? 1 : 0; + mStream << existMarker; + if(type) + type->serialize(*this); + } + template + void streamify(const PxArray& type) + { + mStream << static_cast(type.size()); + PVD_FOREACH(idx, type.size()) streamify(const_cast(type[idx])); + } + template + void streamifyLinks(const PxArray& type) + { + mStream << static_cast(type.size()); + PVD_FOREACH(idx, type.size()) streamifyLinks(const_cast(type[idx])); + } + + private: + MetaDataWriter& operator=(const MetaDataWriter&); + }; + + template + struct MetaDataReader + { + PvdObjectModelMetaDataImpl& mMetaData; + TStreamType& mStream; + MetaDataReader(PvdObjectModelMetaDataImpl& meta, TStreamType& stream) : mMetaData(meta), mStream(stream) + { + } + + void streamify(NamespacedName& type) + { + streamify(type.mNamespace); + streamify(type.mName); + } + + void streamify(String& type) + { + uint32_t handle; + mStream >> handle; + type = mMetaData.mStringTable->handleToStr(handle); + } + void streamify(int32_t& type) + { + mStream >> type; + } + void streamify(uint32_t& type) + { + mStream >> type; + } + void streamify(bool& type) + { + uint8_t data; + mStream >> data; + type = data ? true : false; + } + + void streamify(PropertyType::Enum& type) + { + uint32_t val; + mStream >> val; + type = static_cast(val); + } + void streamify(NamedValue& type) + { + streamify(type.mValue); + streamify(type.mName); + } + void streamify(PropertyMessageEntryImpl& type) + { + type.serialize(*this); + } + void streamify(PtrOffset& off) + { + uint32_t type; + mStream >> type; + mStream >> off.mOffset; + off.mOffsetType = static_cast(type); + } + void streamifyLinks(PropDescImpl*& prop) + { + int32_t propId; + streamify(propId); + prop = mMetaData.getPropertyImpl(propId); + } + void streamify(PropertyDescription& prop) + { + streamify(prop.mPropertyId); + prop = mMetaData.getProperty(prop.mPropertyId); + } + template + void streamify(TDataType*& type) + { + uint32_t existMarker; + mStream >> existMarker; + if(existMarker) + { + TDataType* newType = PVD_NEW(TDataType)(); + newType->serialize(*this); + type = newType; + } + else + type = NULL; + } + template + void streamify(PxArray& type) + { + uint32_t typeSize; + mStream >> typeSize; + type.resize(typeSize); + PVD_FOREACH(idx, type.size()) streamify(type[idx]); + } + template + void streamifyLinks(PxArray& type) + { + uint32_t typeSize; + mStream >> typeSize; + type.resize(typeSize); + PVD_FOREACH(idx, type.size()) streamifyLinks(type[idx]); + } + + private: + MetaDataReader& operator=(const MetaDataReader&); + }; + + virtual void write(PvdOutputStream& stream) const + { + stream << getCurrentPvdObjectModelVersion(); + stream << mNextClassId; + mStringTable->write(stream); + MetaDataWriter writer(*this, stream); + writer.streamify(mProperties); + writer.streamify(mClasses); + writer.streamify(mPropertyMessages); + } + + template + void read(TReaderType& stream) + { + uint32_t version; + stream >> version; + stream >> mNextClassId; + mStringTable->read(stream); + MetaDataReader reader(*this, stream); + reader.streamify(mProperties); + reader.streamify(mClasses); + reader.streamify(mPropertyMessages); + + mNameToClasses.clear(); + mNameToProperties.clear(); + mPropertyMessageMap.clear(); + PVD_FOREACH(i, mClasses.size()) + { + ClassDescImpl* cls(mClasses[i]); + if(cls == NULL) + continue; + mNameToClasses.insert(cls->mName, mClasses[i]); + uint32_t propCount = getNbProperties(cls->mClassId); + PropertyDescription descs[16]; + uint32_t offset = 0; + for(uint32_t idx = 0; idx < propCount; idx = offset) + { + uint32_t numProps = getProperties(cls->mClassId, descs, 16, offset); + offset += numProps; + for(uint32_t propIdx = 0; propIdx < numProps; ++propIdx) + { + PropDescImpl* prop = getPropertyImpl(descs[propIdx].mPropertyId); + if(prop) + mNameToProperties.insert(ClassPropertyName(cls->mName, prop->mName), prop); + } + } + } + PVD_FOREACH(idx, mPropertyMessages.size()) + mPropertyMessageMap.insert(mPropertyMessages[idx]->mMessageName, mPropertyMessages[idx]); + } + + virtual StringTable& getStringTable() const + { + return *mStringTable; + } + virtual void addRef() + { + ++mRefCount; + } + virtual void release() + { + if(mRefCount) + --mRefCount; + if(!mRefCount) + PVD_DELETE(this); + } +}; +} + +uint32_t PvdObjectModelMetaData::getCurrentPvdObjectModelVersion() +{ + return 1; +} + +PvdObjectModelMetaData& PvdObjectModelMetaData::create() +{ + PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)()); + retval.initialize(); + return retval; +} + +PvdObjectModelMetaData& PvdObjectModelMetaData::create(PvdInputStream& stream) +{ + PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)()); + retval.read(stream); + return retval; +} + +StringTable& StringTable::create() +{ + return *PVD_NEW(StringTableImpl)(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.h new file mode 100644 index 0000000..843fb7c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectModelMetaData.h @@ -0,0 +1,481 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_OBJECT_MODEL_METADATA_H +#define PX_PVD_OBJECT_MODEL_METADATA_H + +#include "foundation/PxAssert.h" +#include "PxPvdObjectModelBaseTypes.h" +#include "PxPvdBits.h" + +namespace physx +{ +namespace pvdsdk +{ + +class PvdInputStream; +class PvdOutputStream; + +struct PropertyDescription +{ + NamespacedName mOwnerClassName; + int32_t mOwnerClassId; + String mName; + String mSemantic; + // The datatype this property corresponds to. + int32_t mDatatype; + // The name of the datatype + NamespacedName mDatatypeName; + // Scalar or array. + PropertyType::Enum mPropertyType; + // No other property under any class has this id, it is DB-unique. + int32_t mPropertyId; + // Offset in bytes into the object's data section where this property starts. + uint32_t m32BitOffset; + // Offset in bytes into the object's data section where this property starts. + uint32_t m64BitOffset; + + PropertyDescription(const NamespacedName& clsName, int32_t classId, String name, String semantic, int32_t datatype, + const NamespacedName& datatypeName, PropertyType::Enum propType, int32_t propId, + uint32_t offset32, uint32_t offset64) + : mOwnerClassName(clsName) + , mOwnerClassId(classId) + , mName(name) + , mSemantic(semantic) + , mDatatype(datatype) + , mDatatypeName(datatypeName) + , mPropertyType(propType) + , mPropertyId(propId) + , m32BitOffset(offset32) + , m64BitOffset(offset64) + { + } + PropertyDescription() + : mOwnerClassId(-1) + , mName("") + , mSemantic("") + , mDatatype(-1) + , mPropertyType(PropertyType::Unknown) + , mPropertyId(-1) + , m32BitOffset(0) + , m64BitOffset(0) + + { + } + + virtual ~PropertyDescription() + { + } +}; + +struct PtrOffsetType +{ + enum Enum + { + UnknownOffset, + VoidPtrOffset, + StringOffset + }; +}; + +struct PtrOffset +{ + PtrOffsetType::Enum mOffsetType; + uint32_t mOffset; + PtrOffset(PtrOffsetType::Enum type, uint32_t offset) : mOffsetType(type), mOffset(offset) + { + } + PtrOffset() : mOffsetType(PtrOffsetType::UnknownOffset), mOffset(0) + { + } +}; + +inline uint32_t align(uint32_t offset, uint32_t alignment) +{ + uint32_t startOffset = offset; + uint32_t alignmentMask = ~(alignment - 1); + offset = (offset + alignment - 1) & alignmentMask; + PX_ASSERT(offset >= startOffset && (offset % alignment) == 0); + (void)startOffset; + return offset; +} + +struct ClassDescriptionSizeInfo +{ + // The size of the data section of this object, padded to alignment. + uint32_t mByteSize; + // The last data member goes to here. + uint32_t mDataByteSize; + // Alignment in bytes of the data section of this object. + uint32_t mAlignment; + // the offsets of string handles in the binary value of this class + DataRef mPtrOffsets; + ClassDescriptionSizeInfo() : mByteSize(0), mDataByteSize(0), mAlignment(0) + { + } +}; + +struct ClassDescription +{ + NamespacedName mName; + // No other class has this id, it is DB-unique + int32_t mClassId; + // Only single derivation supported. + int32_t mBaseClass; + // If this class has properties that are of uniform type, then we note that. + // This means that when deserialization an array of these objects we can just use + // single function to endian convert the entire mess at once. + int32_t mPackedUniformWidth; + // If this class is composed uniformly of members of a given type + // Or all of its properties are composed uniformly of members of + // a give ntype, then this class's packed type is that type. + // PxTransform's packed type would be float. + int32_t mPackedClassType; + // 0: 32Bit 1: 64Bit + ClassDescriptionSizeInfo mSizeInfo[2]; + // No further property additions allowed. + bool mLocked; + // True when this datatype has an array on it that needs to be + // separately deleted. + bool mRequiresDestruction; + + ClassDescription(NamespacedName name, int32_t id) + : mName(name) + , mClassId(id) + , mBaseClass(-1) + , mPackedUniformWidth(-1) + , mPackedClassType(-1) + , mLocked(false) + , mRequiresDestruction(false) + { + } + ClassDescription() + : mClassId(-1), mBaseClass(-1), mPackedUniformWidth(-1), mPackedClassType(-1), mLocked(false), mRequiresDestruction(false) + { + } + virtual ~ClassDescription() + { + } + + ClassDescriptionSizeInfo& get32BitSizeInfo() + { + return mSizeInfo[0]; + } + ClassDescriptionSizeInfo& get64BitSizeInfo() + { + return mSizeInfo[1]; + } + uint32_t& get32BitSize() + { + return get32BitSizeInfo().mByteSize; + } + uint32_t& get64BitSize() + { + return get64BitSizeInfo().mByteSize; + } + + uint32_t get32BitSize() const + { + return mSizeInfo[0].mByteSize; + } + const ClassDescriptionSizeInfo& getNativeSizeInfo() const + { + return mSizeInfo[(sizeof(void*) >> 2) - 1]; + } + uint32_t getNativeSize() const + { + return getNativeSizeInfo().mByteSize; + } +}; + +struct MarshalQueryResult +{ + int32_t srcType; + int32_t dstType; + // If canMarshal != needsMarshalling we have a problem. + bool canMarshal; + bool needsMarshalling; + // Non null if marshalling is possible. + TBlockMarshaller marshaller; + MarshalQueryResult(int32_t _srcType = -1, int32_t _dstType = -1, bool _canMarshal = false, bool _needs = false, + TBlockMarshaller _m = NULL) + : srcType(_srcType), dstType(_dstType), canMarshal(_canMarshal), needsMarshalling(_needs), marshaller(_m) + { + } +}; + +struct PropertyMessageEntry +{ + PropertyDescription mProperty; + NamespacedName mDatatypeName; + // datatype of the data in the message. + int32_t mDatatypeId; + // where in the message this property starts. + uint32_t mMessageOffset; + // size of this entry object + uint32_t mByteSize; + + // If the chain of properties doesn't have any array properties this indicates the + uint32_t mDestByteSize; + + PropertyMessageEntry(PropertyDescription propName, NamespacedName dtypeName, int32_t dtype, uint32_t messageOff, + uint32_t byteSize, uint32_t destByteSize) + : mProperty(propName) + , mDatatypeName(dtypeName) + , mDatatypeId(dtype) + , mMessageOffset(messageOff) + , mByteSize(byteSize) + , mDestByteSize(destByteSize) + { + } + PropertyMessageEntry() : mDatatypeId(-1), mMessageOffset(0), mByteSize(0), mDestByteSize(0) + { + } +}; + +// Create a struct that defines a subset of the properties on an object. +struct PropertyMessageDescription +{ + NamespacedName mClassName; + // No other class has this id, it is DB-unique + int32_t mClassId; + NamespacedName mMessageName; + int32_t mMessageId; + DataRef mProperties; + uint32_t mMessageByteSize; + // Offsets into the property message where const char* items are. + DataRef mStringOffsets; + PropertyMessageDescription(const NamespacedName& nm, int32_t clsId, const NamespacedName& msgName, int32_t msgId, + uint32_t msgSize) + : mClassName(nm), mClassId(clsId), mMessageName(msgName), mMessageId(msgId), mMessageByteSize(msgSize) + { + } + PropertyMessageDescription() : mClassId(-1), mMessageId(-1), mMessageByteSize(0) + { + } + virtual ~PropertyMessageDescription() + { + } +}; + +class StringTable +{ + protected: + virtual ~StringTable() + { + } + + public: + virtual uint32_t getNbStrs() = 0; + virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0) = 0; + virtual const char* registerStr(const char* str, bool& outAdded) = 0; + const char* registerStr(const char* str) + { + bool ignored; + return registerStr(str, ignored); + } + virtual StringHandle strToHandle(const char* str) = 0; + virtual const char* handleToStr(uint32_t hdl) = 0; + virtual void release() = 0; + + static StringTable& create(); +}; + +struct None +{ +}; + +template +class Option +{ + T mValue; + bool mHasValue; + + public: + Option(const T& val) : mValue(val), mHasValue(true) + { + } + Option(None nothing = None()) : mHasValue(false) + { + (void)nothing; + } + Option(const Option& other) : mValue(other.mValue), mHasValue(other.mHasValue) + { + } + Option& operator=(const Option& other) + { + mValue = other.mValue; + mHasValue = other.mHasValue; + return *this; + } + bool hasValue() const + { + return mHasValue; + } + const T& getValue() const + { + PX_ASSERT(hasValue()); + return mValue; + } + T& getValue() + { + PX_ASSERT(hasValue()); + return mValue; + } + operator const T&() const + { + return getValue(); + } + operator T&() + { + return getValue(); + } + T* operator->() + { + return &getValue(); + } + const T* operator->() const + { + return &getValue(); + } +}; + +/** + * Create new classes and add properties to some existing ones. + * The default classes are created already, the simple types + * along with the basic math types. + * (uint8_t, int8_t, etc ) + * (PxVec3, PxQuat, PxTransform, PxMat33, PxMat34, PxMat44) + */ +class PvdObjectModelMetaData +{ + protected: + virtual ~PvdObjectModelMetaData() + { + } + + public: + virtual ClassDescription getOrCreateClass(const NamespacedName& nm) = 0; + // get or create parent, lock parent. deriveFrom getOrCreatechild. + virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0; + virtual Option findClass(const NamespacedName& nm) const = 0; + template + Option findClass() + { + return findClass(getPvdNamespacedNameForType()); + } + virtual Option getClass(int32_t classId) const = 0; + virtual ClassDescription* getClassPtr(int32_t classId) const = 0; + + virtual Option getParentClass(int32_t classId) const = 0; + bool isDerivedFrom(int32_t classId, int32_t parentClass) const + { + if(classId == parentClass) + return true; + ClassDescription* p = getClassPtr(getClassPtr(classId)->mBaseClass); + while(p != NULL) + { + if(p->mClassId == parentClass) + return true; + p = getClassPtr(p->mBaseClass); + } + return false; + } + + virtual void lockClass(int32_t classId) = 0; + + virtual uint32_t getNbClasses() const = 0; + virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const = 0; + + // Create a nested property. + // This way you can have obj.p.x without explicity defining the class p. + virtual Option createProperty(int32_t classId, String name, String semantic, int32_t datatype, + PropertyType::Enum propertyType = PropertyType::Scalar) = 0; + Option createProperty(NamespacedName clsId, String name, String semantic, NamespacedName dtype, + PropertyType::Enum propertyType = PropertyType::Scalar) + { + return createProperty(findClass(clsId)->mClassId, name, semantic, findClass(dtype)->mClassId, propertyType); + } + Option createProperty(NamespacedName clsId, String name, NamespacedName dtype, + PropertyType::Enum propertyType = PropertyType::Scalar) + { + return createProperty(findClass(clsId)->mClassId, name, "", findClass(dtype)->mClassId, propertyType); + } + Option createProperty(int32_t clsId, String name, int32_t dtype, + PropertyType::Enum propertyType = PropertyType::Scalar) + { + return createProperty(clsId, name, "", dtype, propertyType); + } + template + Option createProperty(int32_t clsId, String name, String semantic = "", + PropertyType::Enum propertyType = PropertyType::Scalar) + { + return createProperty(clsId, name, semantic, getPvdNamespacedNameForType(), propertyType); + } + virtual Option findProperty(const NamespacedName& cls, String prop) const = 0; + virtual Option findProperty(int32_t clsId, String prop) const = 0; + virtual Option getProperty(int32_t propId) const = 0; + virtual void setNamedPropertyValues(DataRef values, int32_t propId) = 0; + // for enumerations and flags. + virtual DataRef getNamedPropertyValues(int32_t propId) const = 0; + + virtual uint32_t getNbProperties(int32_t classId) const = 0; + virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t bufCount, + uint32_t startIdx = 0) const = 0; + + // Does one cls id differ marshalling to another and if so return the functions to do it. + virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const = 0; + + // messages and classes are stored in separate maps, so a property message can have the same name as a class. + virtual Option createPropertyMessage(const NamespacedName& cls, + const NamespacedName& msgName, + DataRef entries, + uint32_t messageSize) = 0; + virtual Option findPropertyMessage(const NamespacedName& msgName) const = 0; + virtual Option getPropertyMessage(int32_t msgId) const = 0; + + virtual uint32_t getNbPropertyMessages() const = 0; + virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen, + uint32_t startIdx = 0) const = 0; + + virtual StringTable& getStringTable() const = 0; + + virtual void write(PvdOutputStream& stream) const = 0; + void save(PvdOutputStream& stream) const + { + write(stream); + } + + virtual void addRef() = 0; + virtual void release() = 0; + + static uint32_t getCurrentPvdObjectModelVersion(); + static PvdObjectModelMetaData& create(); + static PvdObjectModelMetaData& create(PvdInputStream& stream); +}; +} +} +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp new file mode 100644 index 0000000..46615ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.cpp @@ -0,0 +1,79 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdObjectRegistrar.h" + +namespace physx +{ +namespace pvdsdk +{ + +bool ObjectRegistrar::addItem(const void* inItem) +{ + physx::PxMutex::ScopedLock lock(mRefCountMapLock); + + if(mRefCountMap.find(inItem)) + { + uint32_t& counter = mRefCountMap[inItem]; + counter++; + return false; + } + else + { + mRefCountMap.insert(inItem, 1); + return true; + } +} + +bool ObjectRegistrar::decItem(const void* inItem) +{ + physx::PxMutex::ScopedLock lock(mRefCountMapLock); + const physx::PxHashMap::Entry* entry = mRefCountMap.find(inItem); + if(entry) + { + uint32_t& retval(const_cast(entry->second)); + if(retval) + --retval; + uint32_t theValue = retval; + if(theValue == 0) + { + mRefCountMap.erase(inItem); + return true; + } + } + return false; +} + +void ObjectRegistrar::clear() +{ + physx::PxMutex::ScopedLock lock(mRefCountMapLock); + mRefCountMap.clear(); +} + +} // pvdsdk +} // physx diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.h new file mode 100644 index 0000000..19c7c31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdObjectRegistrar.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_OBJECT_REGISTRAR_H +#define PX_PVD_OBJECT_REGISTRAR_H + +/** \addtogroup pvd +@{ +*/ + +#include "foundation/PxHashMap.h" +#include "foundation/PxMutex.h" + +#if !PX_DOXYGEN +namespace physx +{ +namespace pvdsdk +{ +#endif +class ObjectRegistrar +{ + PX_NOCOPY(ObjectRegistrar) + public: + ObjectRegistrar() + { + } + virtual ~ObjectRegistrar() + { + } + + bool addItem(const void* inItem); + bool decItem(const void* inItem); + void clear(); + + private: + physx::PxHashMap mRefCountMap; + physx::PxMutex mRefCountMapLock; +}; +#if !PX_DOXYGEN +} // pvdsdk +} // physx +#endif + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZone.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZone.h new file mode 100644 index 0000000..8c9ea85 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZone.h @@ -0,0 +1,142 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_PROFILE_ZONE_H +#define PX_PVD_PROFILE_ZONE_H + +#include "foundation/PxPreprocessor.h" + +#include "PxProfileEventBufferClientManager.h" +#include "PxProfileEventNames.h" +#include "PxProfileEventSender.h" + +namespace physx { + class PxAllocatorCallback; + + namespace profile { + + class PxProfileZoneManager; + + /** + \brief The profiling system was setup in the expectation that there would be several + systems that each had its own island of profile information. PhysX, client code, + and APEX would be the first examples of these. Each one of these islands is represented + by a profile zone. + + A profile zone combines a name, a place where all the events coming from its interface + can flushed, and a mapping from event number to full event name. + + It also provides a top level filtering service where profile events + can be filtered by event id. + + The profile zone implements a system where if there is no one + listening to events it doesn't provide a mechanism to send them. In this way + the event system is short circuited when there aren't any clients. + + All functions on this interface should be considered threadsafe. + + @see PxProfileZoneClientManager, PxProfileNameProvider, PxProfileEventSender, PxProfileEventFlusher + */ + class PxProfileZone : public PxProfileZoneClientManager + , public PxProfileNameProvider + , public PxProfileEventSender + , public PxProfileEventFlusher + { + protected: + virtual ~PxProfileZone(){} + public: + /** + \brief Get profile zone name. + \return Zone name. + */ + virtual const char* getName() = 0; + /** + \brief Release the profile zone. + */ + virtual void release() = 0; + + /** + \brief Set profile zone manager for the zone. + \param inMgr Profile zone manager. + */ + virtual void setProfileZoneManager(PxProfileZoneManager* inMgr) = 0; + /** + \brief Get profile zone manager for the zone. + \return Profile zone manager. + */ + virtual PxProfileZoneManager* getProfileZoneManager() = 0; + + /** + \brief Get or create a new event id for a given name. + If you pass in a previously defined event name (including one returned) + from the name provider) you will just get the same event id back. + \param inName Profile event name. + */ + virtual uint16_t getEventIdForName( const char* inName ) = 0; + + /** + \brief Specifies that it is a safe point to flush read-write name map into + read-only map. Make sure getEventIdForName is not called from a different thread. + */ + virtual void flushEventIdNameMap() = 0; + + /** + \brief Reserve a contiguous set of profile event ids for a set of names. + + This function does not do any meaningful error checking other than to ensure + that if it does generate new ids they are contiguous. If the first name is already + registered, that is the ID that will be returned regardless of what other + names are registered. Thus either use this function alone (without the above + function) or don't use it. + If you register "one","two","three" and the function returns an id of 4, then + "one" is mapped to 4, "two" is mapped to 5, and "three" is mapped to 6. + + \param inNames set of names to register. + \param inLen Length of the name list. + + \return The first id associated with the first name. The rest of the names + will be associated with monotonically incrementing uint16_t values from the first + id. + */ + virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen ) = 0; + + /** + \brief Create a new profile zone. + + \param inAllocator memory allocation is controlled through the foundation if one is passed in. + \param inSDKName Name of the profile zone; useful for clients to understand where events came from. + \param inNames Mapping from event id -> event name. + \param inEventBufferByteSize Size of the canonical event buffer. This does not need to be a large number + as profile events are fairly small individually. + \return a profile zone implementation. + */ + static PxProfileZone& createProfileZone(PxAllocatorCallback* inAllocator, const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x10000 /*64k*/); + + }; +} } + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp new file mode 100644 index 0000000..9843213 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.cpp @@ -0,0 +1,160 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "PxPvdImpl.h" +#include "PxPvdProfileZoneClient.h" +#include "PxPvdProfileZone.h" + +namespace physx +{ +namespace pvdsdk +{ +struct ProfileZoneClient : public profile::PxProfileZoneClient, public PxUserAllocated +{ + profile::PxProfileZone& mZone; + PvdDataStream& mStream; + + ProfileZoneClient(profile::PxProfileZone& zone, PvdDataStream& stream) : mZone(zone), mStream(stream) + { + } + + ~ProfileZoneClient() + { + mZone.removeClient(*this); + } + + virtual void createInstance() + { + mStream.addProfileZone(&mZone, mZone.getName()); + mStream.createInstance(&mZone); + mZone.addClient(*this); + profile::PxProfileNames names(mZone.getProfileNames()); + PVD_FOREACH(idx, names.eventCount) + { + handleEventAdded(names.events[idx]); + } + } + + virtual void handleEventAdded(const profile::PxProfileEventName& inName) + { + mStream.addProfileZoneEvent(&mZone, inName.name, inName.eventId.eventId, inName.eventId.compileTimeEnabled); + } + + virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) + { + mStream.setPropertyValue(&mZone, "events", inData, inLength); + } + + virtual void handleClientRemoved() + { + mStream.destroyInstance(&mZone); + } + + private: + ProfileZoneClient& operator=(const ProfileZoneClient&); +}; +} +} + +using namespace physx; +using namespace pvdsdk; + +PvdProfileZoneClient::PvdProfileZoneClient(PvdImpl& pvd) : mSDKPvd(pvd), mPvdDataStream(NULL), mIsConnected(false) +{ +} + +PvdProfileZoneClient::~PvdProfileZoneClient() +{ + mSDKPvd.removeClient(this); + // all zones should removed + PX_ASSERT(mProfileZoneClients.size() == 0); +} + +PvdDataStream* PvdProfileZoneClient::getDataStream() +{ + return mPvdDataStream; +} + +bool PvdProfileZoneClient::isConnected() const +{ + return mIsConnected; +} + +void PvdProfileZoneClient::onPvdConnected() +{ + if(mIsConnected) + return; + mIsConnected = true; + + mPvdDataStream = PvdDataStream::create(&mSDKPvd); + +} + +void PvdProfileZoneClient::onPvdDisconnected() +{ + if(!mIsConnected) + return; + + mIsConnected = false; + flush(); + + mPvdDataStream->release(); + mPvdDataStream = NULL; +} + +void PvdProfileZoneClient::flush() +{ + PVD_FOREACH(idx, mProfileZoneClients.size()) + mProfileZoneClients[idx]->mZone.flushProfileEvents(); +} + +void PvdProfileZoneClient::onZoneAdded(profile::PxProfileZone& zone) +{ + PX_ASSERT(mIsConnected); + ProfileZoneClient* client = PVD_NEW(ProfileZoneClient)(zone, *mPvdDataStream); + mMutex.lock(); + client->createInstance(); + mProfileZoneClients.pushBack(client); + mMutex.unlock(); +} + +void PvdProfileZoneClient::onZoneRemoved(profile::PxProfileZone& zone) +{ + for(uint32_t i = 0; i < mProfileZoneClients.size(); i++) + { + if(&zone == &mProfileZoneClients[i]->mZone) + { + mMutex.lock(); + ProfileZoneClient* client = mProfileZoneClients[i]; + mProfileZoneClients.replaceWithLast(i); + PVD_DELETE(client); + mMutex.unlock(); + return; + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.h new file mode 100644 index 0000000..499ba00 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdProfileZoneClient.h @@ -0,0 +1,76 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PX_PVD_PROFILE_ZONE_CLIENT_H +#define PX_PVD_PROFILE_ZONE_CLIENT_H + +#include "PxPvdClient.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxMutex.h" +#include "PxProfileZoneManager.h" + +namespace physx +{ +namespace pvdsdk +{ +class PvdImpl; +class PvdDataStream; + +struct ProfileZoneClient; + +class PvdProfileZoneClient : public PvdClient, public profile::PxProfileZoneHandler, public PxUserAllocated +{ + PX_NOCOPY(PvdProfileZoneClient) + public: + PvdProfileZoneClient(PvdImpl& pvd); + virtual ~PvdProfileZoneClient(); + + bool isConnected() const; + void onPvdConnected(); + void onPvdDisconnected(); + void flush(); + + PvdDataStream* getDataStream(); + + // PxProfileZoneHandler + void onZoneAdded(profile::PxProfileZone& inSDK); + void onZoneRemoved(profile::PxProfileZone& inSDK); + + private: + PxMutex mMutex; // zoneAdded can called from different threads + PvdImpl& mSDKPvd; + PvdDataStream* mPvdDataStream; + physx::PxArray mProfileZoneClients; + bool mIsConnected; +}; + +} // namespace pvdsdk +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderImpl.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderImpl.h new file mode 100644 index 0000000..592ee40 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderImpl.h @@ -0,0 +1,385 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PVD_USER_RENDER_IMPL_H +#define PX_PVD_USER_RENDER_IMPL_H + +#include "PxPvdUserRenderer.h" + +namespace physx +{ +namespace pvdsdk +{ + +struct PvdUserRenderTypes +{ + enum Enum + { + Unknown = 0, +#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) type, +#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA(type) type +#include "PxPvdUserRenderTypes.h" +#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA +#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE + }; +}; + +class RenderSerializer +{ + protected: + virtual ~RenderSerializer() + { + } + + public: + virtual void streamify(uint64_t& val) = 0; + virtual void streamify(float& val) = 0; + virtual void streamify(uint32_t& val) = 0; + virtual void streamify(uint8_t& val) = 0; + virtual void streamify(DataRef& val) = 0; + virtual void streamify(DataRef& val) = 0; + virtual void streamify(DataRef& val) = 0; + virtual void streamify(DataRef& val) = 0; + virtual void streamify(PxDebugText& val) = 0; + virtual bool isGood() = 0; + virtual uint32_t hasData() = 0; + + void streamify(PvdUserRenderTypes::Enum& val) + { + uint8_t data = static_cast(val); + streamify(data); + val = static_cast(data); + } + void streamify(PxVec3& val) + { + streamify(val[0]); + streamify(val[1]); + streamify(val[2]); + } + + void streamify(PvdColor& val) + { + streamify(val.r); + streamify(val.g); + streamify(val.b); + streamify(val.a); + } + void streamify(PxTransform& val) + { + streamify(val.q.x); + streamify(val.q.y); + streamify(val.q.z); + streamify(val.q.w); + streamify(val.p.x); + streamify(val.p.y); + streamify(val.p.z); + } + void streamify(bool& val) + { + uint8_t tempVal = uint8_t(val ? 1 : 0); + streamify(tempVal); + val = tempVal ? true : false; + } +}; + +template +struct BulkRenderEvent +{ + DataRef mData; + BulkRenderEvent(const TBulkRenderType* data, uint32_t count) : mData(data, count) + { + } + BulkRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(mData); + } +}; +struct SetInstanceIdRenderEvent +{ + uint64_t mInstanceId; + SetInstanceIdRenderEvent(uint64_t iid) : mInstanceId(iid) + { + } + SetInstanceIdRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(mInstanceId); + } +}; +struct PointsRenderEvent : BulkRenderEvent +{ + PointsRenderEvent(const PxDebugPoint* data, uint32_t count) : BulkRenderEvent(data, count) + { + } + PointsRenderEvent() + { + } +}; +struct LinesRenderEvent : BulkRenderEvent +{ + LinesRenderEvent(const PxDebugLine* data, uint32_t count) : BulkRenderEvent(data, count) + { + } + LinesRenderEvent() + { + } +}; +struct TrianglesRenderEvent : BulkRenderEvent +{ + TrianglesRenderEvent(const PxDebugTriangle* data, uint32_t count) : BulkRenderEvent(data, count) + { + } + TrianglesRenderEvent() + { + } +}; +struct DebugRenderEvent +{ + DataRef mPointData; + DataRef mLineData; + DataRef mTriangleData; + DebugRenderEvent(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData, + uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount) + : mPointData(pointData, pointCount), mLineData(lineData, lineCount), mTriangleData(triangleData, triangleCount) + { + } + + DebugRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(mPointData); + serializer.streamify(mLineData); + serializer.streamify(mTriangleData); + } +}; + +struct TextRenderEvent +{ + PxDebugText mText; + TextRenderEvent(const PxDebugText& text) + { + mText.color = text.color; + mText.position = text.position; + mText.size = text.size; + mText.string = text.string; + } + TextRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(mText); + } +}; + +struct JointFramesRenderEvent +{ + PxTransform parent; + PxTransform child; + JointFramesRenderEvent(const PxTransform& p, const PxTransform& c) : parent(p), child(c) + { + } + JointFramesRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(parent); + serializer.streamify(child); + } +}; +struct LinearLimitRenderEvent +{ + PxTransform t0; + PxTransform t1; + float value; + bool active; + LinearLimitRenderEvent(const PxTransform& _t0, const PxTransform& _t1, float _value, bool _active) + : t0(_t0), t1(_t1), value(_value), active(_active) + { + } + LinearLimitRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(t0); + serializer.streamify(t1); + serializer.streamify(value); + serializer.streamify(active); + } +}; +struct AngularLimitRenderEvent +{ + PxTransform t0; + float lower; + float upper; + bool active; + AngularLimitRenderEvent(const PxTransform& _t0, float _lower, float _upper, bool _active) + : t0(_t0), lower(_lower), upper(_upper), active(_active) + { + } + AngularLimitRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(t0); + serializer.streamify(lower); + serializer.streamify(upper); + serializer.streamify(active); + } +}; +struct LimitConeRenderEvent +{ + PxTransform t; + float ySwing; + float zSwing; + bool active; + LimitConeRenderEvent(const PxTransform& _t, float _ySwing, float _zSwing, bool _active) + : t(_t), ySwing(_ySwing), zSwing(_zSwing), active(_active) + { + } + LimitConeRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(t); + serializer.streamify(ySwing); + serializer.streamify(zSwing); + serializer.streamify(active); + } +}; +struct DoubleConeRenderEvent +{ + PxTransform t; + float angle; + bool active; + DoubleConeRenderEvent(const PxTransform& _t, float _angle, bool _active) : t(_t), angle(_angle), active(_active) + { + } + DoubleConeRenderEvent() + { + } + void serialize(RenderSerializer& serializer) + { + serializer.streamify(t); + serializer.streamify(angle); + serializer.streamify(active); + } +}; + +template +struct RenderSerializerMap +{ + void serialize(RenderSerializer& s, TDataType& d) + { + d.serialize(s); + } +}; +template <> +struct RenderSerializerMap +{ + void serialize(RenderSerializer& s, uint8_t& d) + { + s.streamify(d); + } +}; + +template <> +struct RenderSerializerMap +{ + void serialize(RenderSerializer& s, PxDebugPoint& d) + { + s.streamify(d.pos); + s.streamify(d.color); + } +}; + +template <> +struct RenderSerializerMap +{ + void serialize(RenderSerializer& s, PxDebugLine& d) + { + s.streamify(d.pos0); + s.streamify(d.color0); + s.streamify(d.pos1); + s.streamify(d.color1); + } +}; + +template <> +struct RenderSerializerMap +{ + void serialize(RenderSerializer& s, PxDebugTriangle& d) + { + s.streamify(d.pos0); + s.streamify(d.color0); + s.streamify(d.pos1); + s.streamify(d.color1); + s.streamify(d.pos2); + s.streamify(d.color2); + } +}; + +template +struct PvdTypeToRenderType +{ + bool compile_error; +}; + +#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) \ + template <> \ + struct PvdTypeToRenderType \ + { \ + enum Enum \ + { \ + EnumVal = PvdUserRenderTypes::type \ + }; \ + }; + +#include "PxPvdUserRenderTypes.h" +#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE + +template +PvdUserRenderTypes::Enum getPvdRenderTypeFromType() +{ + return static_cast(PvdTypeToRenderType::EnumVal); +} + +} +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderTypes.h b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderTypes.h new file mode 100644 index 0000000..da602de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderTypes.h @@ -0,0 +1,45 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON + +#ifndef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA +#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA DECLARE_PVD_IMMEDIATE_RENDER_TYPE +#endif + +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(SetInstanceId) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Points) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Lines) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Triangles) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(JointFrames) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(LinearLimit) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(AngularLimit) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(LimitCone) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(DoubleCone) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Text) +DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA(Debug) + +#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA +#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp new file mode 100644 index 0000000..0cf9811 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/pvd/src/PxPvdUserRenderer.cpp @@ -0,0 +1,404 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "PxPvdUserRenderImpl.h" +#include "PxPvdInternalByteStreams.h" +#include "PxPvdBits.h" +#include + +using namespace physx; +using namespace physx::pvdsdk; + +namespace +{ + +template +struct RenderWriter : public RenderSerializer +{ + TStreamType& mStream; + RenderWriter(TStreamType& stream) : mStream(stream) + { + } + template + void write(const TDataType* val, uint32_t count) + { + uint32_t numBytes = count * sizeof(TDataType); + mStream.write(reinterpret_cast(val), numBytes); + } + template + void write(const TDataType& val) + { + write(&val, 1); + } + + template + void writeRef(DataRef& val) + { + uint32_t amount = val.size(); + write(amount); + if(amount) + write(val.begin(), amount); + } + + virtual void streamify(uint64_t& val) + { + write(val); + } + virtual void streamify(uint32_t& val) + { + write(val); + } + virtual void streamify(float& val) + { + write(val); + } + virtual void streamify(uint8_t& val) + { + write(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + + virtual void streamify(PxDebugText& val) + { + write(val.color); + write(val.position); + write(val.size); + + uint32_t amount = static_cast(strlen(val.string)) + 1; + write(amount); + if(amount) + write(val.string, amount); + } + + virtual void streamify(DataRef& val) + { + writeRef(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + virtual void streamify(DataRef& val) + { + writeRef(val); + } + + virtual uint32_t hasData() + { + return false; + } + virtual bool isGood() + { + return true; + } + + private: + RenderWriter& operator=(const RenderWriter&); +}; + +struct UserRenderer : public PvdUserRenderer +{ + ForwardingMemoryBuffer mBuffer; + uint32_t mBufferCapacity; + RendererEventClient* mClient; + + UserRenderer(uint32_t bufferFullAmount) + : mBuffer("UserRenderBuffer"), mBufferCapacity(bufferFullAmount), mClient(NULL) + { + } + virtual ~UserRenderer() + { + } + virtual void release() + { + PVD_DELETE(this); + } + + template + void handleEvent(TEventType evt) + { + RenderWriter _writer(mBuffer); + RenderSerializer& writer(_writer); + + PvdUserRenderTypes::Enum evtType(getPvdRenderTypeFromType()); + writer.streamify(evtType); + evt.serialize(writer); + if(mBuffer.size() >= mBufferCapacity) + flushRenderEvents(); + } + virtual void setInstanceId(const void* iid) + { + handleEvent(SetInstanceIdRenderEvent(PVD_POINTER_TO_U64(iid))); + } + // Draw these points associated with this instance + virtual void drawPoints(const PxDebugPoint* points, uint32_t count) + { + handleEvent(PointsRenderEvent(points, count)); + } + // Draw these lines associated with this instance + virtual void drawLines(const PxDebugLine* lines, uint32_t count) + { + handleEvent(LinesRenderEvent(lines, count)); + } + // Draw these triangles associated with this instance + virtual void drawTriangles(const PxDebugTriangle* triangles, uint32_t count) + { + handleEvent(TrianglesRenderEvent(triangles, count)); + } + + virtual void drawText(const PxDebugText& text) + { + handleEvent(TextRenderEvent(text)); + } + + virtual void drawRenderbuffer(const PxDebugPoint* pointData, uint32_t pointCount, const PxDebugLine* lineData, + uint32_t lineCount, const PxDebugTriangle* triangleData, uint32_t triangleCount) + { + handleEvent(DebugRenderEvent(pointData, pointCount, lineData, lineCount, triangleData, triangleCount)); + } + + // Constraint visualization routines + virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) + { + handleEvent(JointFramesRenderEvent(parent, child)); + } + virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value, bool active) + { + handleEvent(LinearLimitRenderEvent(t0, t1, value, active)); + } + virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper, bool active) + { + handleEvent(AngularLimitRenderEvent(t0, lower, upper, active)); + } + virtual void visualizeLimitCone(const PxTransform& t, float tanQSwingY, float tanQSwingZ, bool active) + { + handleEvent(LimitConeRenderEvent(t, tanQSwingY, tanQSwingZ, active)); + } + virtual void visualizeDoubleCone(const PxTransform& t, float angle, bool active) + { + handleEvent(DoubleConeRenderEvent(t, angle, active)); + } + // Clear the immedate buffer. + virtual void flushRenderEvents() + { + if(mClient) + mClient->handleBufferFlush(mBuffer.begin(), mBuffer.size()); + mBuffer.clear(); + } + + virtual void setClient(RendererEventClient* client) + { + mClient = client; + } + + private: + UserRenderer& operator=(const UserRenderer&); +}; + +template +struct RenderReader : public RenderSerializer +{ + MemPvdInputStream mStream; + ForwardingMemoryBuffer& mBuffer; + + RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf) + { + } + void setData(DataRef data) + { + mStream.setup(const_cast(data.begin()), const_cast(data.end())); + } + virtual void streamify(uint32_t& val) + { + mStream >> val; + } + virtual void streamify(uint64_t& val) + { + mStream >> val; + } + virtual void streamify(float& val) + { + mStream >> val; + } + virtual void streamify(uint8_t& val) + { + mStream >> val; + } + template + void readRef(DataRef& val) + { + uint32_t count; + mStream >> count; + uint32_t numBytes = sizeof(TDataType) * count; + + TDataType* dataPtr = reinterpret_cast(mBuffer.growBuf(numBytes)); + mStream.read(reinterpret_cast(dataPtr), numBytes); + val = DataRef(dataPtr, count); + } + + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(PxDebugText& val) + { + mStream >> val.color; + mStream >> val.position; + mStream >> val.size; + + uint32_t len = 0; + mStream >> len; + + uint8_t* dataPtr = mBuffer.growBuf(len); + mStream.read(dataPtr, len); + val.string = reinterpret_cast(dataPtr); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual bool isGood() + { + return mStream.isGood(); + } + virtual uint32_t hasData() + { + return uint32_t(mStream.size() > 0); + } + + private: + RenderReader& operator=(const RenderReader&); +}; + +template <> +struct RenderReader : public RenderSerializer +{ + MemPvdInputStream mStream; + ForwardingMemoryBuffer& mBuffer; + RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf) + { + } + void setData(DataRef data) + { + mStream.setup(const_cast(data.begin()), const_cast(data.end())); + } + + template + void read(TDataType& val) + { + mStream >> val; + swapBytes(val); + } + virtual void streamify(uint64_t& val) + { + read(val); + } + virtual void streamify(uint32_t& val) + { + read(val); + } + virtual void streamify(float& val) + { + read(val); + } + virtual void streamify(uint8_t& val) + { + read(val); + } + template + void readRef(DataRef& val) + { + uint32_t count; + mStream >> count; + swapBytes(count); + uint32_t numBytes = sizeof(TDataType) * count; + + TDataType* dataPtr = reinterpret_cast(mBuffer.growBuf(numBytes)); + PVD_FOREACH(idx, count) + RenderSerializerMap().serialize(*this, dataPtr[idx]); + val = DataRef(dataPtr, count); + } + + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual void streamify(PxDebugText& val) + { + mStream >> val.color; + mStream >> val.position; + mStream >> val.size; + + uint32_t len = 0; + mStream >> len; + + uint8_t* dataPtr = mBuffer.growBuf(len); + mStream.read(dataPtr, len); + val.string = reinterpret_cast(dataPtr); + } + virtual void streamify(DataRef& val) + { + readRef(val); + } + virtual bool isGood() + { + return mStream.isGood(); + } + virtual uint32_t hasData() + { + return uint32_t(mStream.size() > 0); + } + + private: + RenderReader& operator=(const RenderReader&); +}; + +} + +PvdUserRenderer* PvdUserRenderer::create(uint32_t bufferSize) +{ + return PVD_NEW(UserRenderer)(bufferSize); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqFactory.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqFactory.h new file mode 100644 index 0000000..938f64a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqFactory.h @@ -0,0 +1,46 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_FACTORY_H +#define SQ_FACTORY_H + +#include "foundation/PxSimpleTypes.h" +#include "GuFactory.h" +#include "SqTypedef.h" + +namespace physx +{ +namespace Sq +{ + class CompoundPruner; + + CompoundPruner* createCompoundPruner(PxU64 contextID); +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqManager.h new file mode 100644 index 0000000..97d13b0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqManager.h @@ -0,0 +1,197 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_MANAGER_H +#define SQ_MANAGER_H + +// PT: SQ-API LEVEL 2 (Level 1 = SqPruner.h) +// PT: this file is part of a "high-level" set of files within Sq. The SqPruner API doesn't rely on them. +// PT: this should really be at Np level but moving it to Sq allows us to share it. + +#include "common/PxPhysXCommonConfig.h" + +#include "foundation/PxBitMap.h" +#include "foundation/PxArray.h" +#include "SqPruner.h" +#include "geometry/PxGeometryHelpers.h" + +namespace physx +{ +namespace Sq +{ + // PrunerManager-level adapter + class Adapter + { + public: + Adapter() {} + virtual ~Adapter() {} + + // Retrieves the PxGeometry associated with a given PrunerPayload. This will be called by + // the PrunerManager class when computing bounds. + virtual const PxGeometry& getGeometry(const Gu::PrunerPayload& payload) const = 0; + }; + + // PT: extended pruner structure. We might want to move the additional data to the pruner itself later. + struct PrunerExt : public PxUserAllocated + { +// private: + PrunerExt(); + ~PrunerExt(); + + void init(Gu::Pruner* pruner); + void flushMemory(); + void preallocate(PxU32 nbShapes); + + void addToDirtyList(Gu::PrunerHandle handle, bool dynamic, const PxTransform& transform); + void removeFromDirtyList(Gu::PrunerHandle handle); + bool processDirtyList(PxU32 index, const Adapter& adapter, float inflation); +// void growDirtyList(Gu::PrunerHandle handle); + + PX_FORCE_INLINE Gu::Pruner* pruner() { return mPruner; } + PX_FORCE_INLINE const Gu::Pruner* pruner() const { return mPruner; } + + Gu::Pruner* mPruner; + PxBitMap mDirtyMap; + PxArray mDirtyList; + bool mDirtyStatic; // true if dirty list contains a static + + PX_NOCOPY(PrunerExt) + + friend class PrunerManager; + }; +} +} + +#include "foundation/PxHashSet.h" +namespace physx +{ +namespace Sq +{ + class CompoundPruner; + typedef PxPair CompoundPair; + typedef PxCoalescedHashSet CompoundPrunerSet; + // AB: extended compound pruner structure, buffers compound shape changes and flushes them. + struct CompoundPrunerExt : public PxUserAllocated + { +// private: + CompoundPrunerExt(); + ~CompoundPrunerExt(); + + void flushMemory(); + void preallocate(PxU32 nbShapes); + void flushShapes(const Adapter& adapter, float inflation); + void addToDirtyList(PrunerCompoundId compoundId, Gu::PrunerHandle handle, const PxTransform& transform); + void removeFromDirtyList(PrunerCompoundId compoundId, Gu::PrunerHandle handle); + + PX_FORCE_INLINE const CompoundPruner* pruner() const { return mPruner; } + PX_FORCE_INLINE CompoundPruner* pruner() { return mPruner; } + + CompoundPruner* mPruner; + CompoundPrunerSet mDirtyList; + + PX_NOCOPY(CompoundPrunerExt) + + friend class PrunerManager; + }; +} +} + +#include "foundation/PxMutex.h" +#include "SqPrunerData.h" + +namespace physx +{ +class PxRenderOutput; +class PxBVH; +class PxSceneLimits; // PT: TODO: decouple from PxSceneLimits + +namespace Sq +{ + class PrunerManager : public PxUserAllocated + { + public: + PrunerManager(PxU64 contextID, Gu::Pruner* staticPruner, Gu::Pruner* dynamicPruner, + PxU32 dynamicTreeRebuildRateHint, float inflation, + const PxSceneLimits& limits, const Adapter& adapter); + ~PrunerManager(); + + PrunerData addPrunerShape(const Gu::PrunerPayload& payload, bool dynamic, PrunerCompoundId compoundId, const PxBounds3& bounds, const PxTransform& transform, bool hasPruningStructure=false); + void addCompoundShape(const PxBVH& bvh, PrunerCompoundId compoundId, const PxTransform& compoundTransform, PrunerData* prunerData, const Gu::PrunerPayload* payloads, const PxTransform* transforms, bool isDynamic); + void markForUpdate(PrunerCompoundId compoundId, PrunerData s, const PxTransform& transform); + void removePrunerShape(PrunerCompoundId compoundId, PrunerData shapeData, Gu::PrunerPayloadRemovalCallback* removalCallback); + + PX_FORCE_INLINE const Gu::Pruner* getPruner(PruningIndex::Enum index) const { return mPrunerExt[index].mPruner; } + PX_FORCE_INLINE Gu::Pruner* getPruner(PruningIndex::Enum index) { return mPrunerExt[index].mPruner; } + PX_FORCE_INLINE const CompoundPruner* getCompoundPruner() const { return mCompoundPrunerExt.mPruner; } + PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } + + void preallocate(PxU32 prunerIndex, PxU32 nbShapes); + + void setDynamicTreeRebuildRateHint(PxU32 dynTreeRebuildRateHint); + PX_FORCE_INLINE PxU32 getDynamicTreeRebuildRateHint() const { return mRebuildRateHint; } + + void flushUpdates(); + void forceRebuildDynamicTree(PxU32 prunerIndex); + + void updateCompoundActor(PrunerCompoundId compoundId, const PxTransform& compoundTransform); + void removeCompoundActor(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback* removalCallback); + + void* prepareSceneQueriesUpdate(PruningIndex::Enum index); + void sceneQueryBuildStep(void* handle); + + void sync(const Gu::PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices); + void afterSync(bool buildStep, bool commit); + void shiftOrigin(const PxVec3& shift); + void visualize(PxU32 prunerIndex, PxRenderOutput& out) const; + + void flushMemory(); + PX_FORCE_INLINE PxU32 getStaticTimestamp() const { return mStaticTimestamp; } + PX_FORCE_INLINE const Adapter& getAdapter() const { return mAdapter; } + private: + const Adapter& mAdapter; + PrunerExt mPrunerExt[PruningIndex::eCOUNT]; + CompoundPrunerExt mCompoundPrunerExt; + + const PxU64 mContextID; + PxU32 mStaticTimestamp; + PxU32 mRebuildRateHint; + const float mInflation; // SQ_PRUNER_EPSILON + + PxMutex mSQLock; // to make sure only one query updates the dirty pruner structure if multiple queries run in parallel + + volatile bool mPrunerNeedsUpdating; + + void flushShapes(); + PX_FORCE_INLINE void invalidateStaticTimestamp() { mStaticTimestamp++; } + + PX_NOCOPY(PrunerManager) + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPruner.h new file mode 100644 index 0000000..1722255 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPruner.h @@ -0,0 +1,188 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_PRUNER_H +#define SQ_PRUNER_H + +#include "foundation/PxBounds3.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxFlags.h" +#include "GuPruner.h" +#include "SqTypedef.h" + +namespace physx +{ +namespace Gu +{ + class BVH; +} +namespace Sq +{ + +/** +\brief Compound-pruner-specific flags for scene queries. +*/ +struct PxCompoundPrunerQueryFlag +{ + enum Enum + { + eSTATIC = (1<<0), //!< Traverse static compounds + eDYNAMIC = (1<<1), //!< Traverse dynamic compounds + }; +}; + +/** +\brief Flags typedef for the set of bits defined in PxCompoundPrunerQueryFlag. +*/ +typedef PxFlags PxCompoundPrunerQueryFlags; +PX_FLAGS_OPERATORS(PxCompoundPrunerQueryFlag::Enum,PxU32) + +struct CompoundPrunerRaycastCallback +{ + CompoundPrunerRaycastCallback() {} + virtual ~CompoundPrunerRaycastCallback() {} + + virtual bool invoke(PxReal& distance, PxU32 primIndex, const Gu::PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) = 0; +}; + +struct CompoundPrunerOverlapCallback +{ + CompoundPrunerOverlapCallback() {} + virtual ~CompoundPrunerOverlapCallback() {} + + virtual bool invoke(PxU32 primIndex, const Gu::PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) = 0; +}; + +////////////////////////////////////////////////////////////////////////// +/** +* Pruner holding compound objects +*/ +////////////////////////////////////////////////////////////////////////// +class CompoundPruner : public Gu::BasePruner +{ + public: + virtual ~CompoundPruner() {} + + /** + \brief Adds compound to the pruner. + \param results [out] an array for resulting handles + \param bvh [in] BVH + \param compoundId [in] compound id + \param transform [in] compound transform + \param data [in] an array of object data + + \return true if success, false if internal allocation failed. The first failing add results in a INVALID_PRUNERHANDLE. + + Handles are usable as indices. Each handle is either be a recycled handle returned by the client via removeObjects(), + or a fresh handle that is either zero, or one greater than the last fresh handle returned. + */ + virtual bool addCompound(Gu::PrunerHandle* results, const Gu::BVH& bvh, PrunerCompoundId compoundId, const PxTransform& transform, bool isDynamic, const Gu::PrunerPayload* data, const PxTransform* transforms) = 0; + + /** + Removes compound from the pruner. + \param compoundId [in] compound to remove + */ + virtual bool removeCompound(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback* removalCallback) = 0; + + /** + Updates compound object + \param compoundId [in] compound to update + \param transform [in] compound transformation + */ + virtual bool updateCompound(PrunerCompoundId compoundId, const PxTransform& transform) = 0; + + /** + Updates object after manually updating their bounds via "getPayload" calls. + \param compoundId [in] compound that the object belongs to + \param handle [in] the object to update + */ + virtual void updateObjectAfterManualBoundsUpdates(PrunerCompoundId compoundId, const Gu::PrunerHandle handle) = 0; + + /** + Removes object from compound pruner. + \param compoundId [in] compound that the object belongs to + \param handle [in] the object to remove + */ + virtual void removeObject(PrunerCompoundId compoundId, const Gu::PrunerHandle handle, Gu::PrunerPayloadRemovalCallback* removalCallback) = 0; + + /** + \brief Adds object to the pruner. + \param compoundId [in] compound that the object belongs to + \param result [out] an array for resulting handles + \param bounds [in] an array of bounds. These bounds are used as-is so they should be pre-inflated if inflation is needed. + \param userData [in] an array of object data + + \return true if success, false if internal allocation failed. The first failing add results in a INVALID_PRUNERHANDLE. + */ + virtual bool addObject(PrunerCompoundId compoundId, Gu::PrunerHandle& result, const PxBounds3& bounds, const Gu::PrunerPayload userData, const PxTransform& transform) = 0; + + /** + * Query functions + * + * Note: return value may disappear if PrunerCallback contains the necessary information + * currently it is still used for the dynamic pruner internally (to decide if added objects must be queried) + */ + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const = 0; + virtual bool overlap(const Gu::ShapeData& queryVolume, CompoundPrunerOverlapCallback&, PxCompoundPrunerQueryFlags flags) const = 0; + virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const = 0; + + /** + \brief Retrieves the object's payload and data associated with the handle. + + This function returns the payload associated with a given handle. Additionally it can return the + destination addresses for the object's bounds & transform. The user can then write the new bounds + and transform there, before eventually calling updateObjects(). + + \param[in] handle Object handle (initially returned by addObjects()) + \param[in] compoundId The compound id + \param[out] data Optional location where to store the internal data associated with the payload. + + \return The payload associated with the given handle. + */ + virtual const Gu::PrunerPayload& getPayloadData(Gu::PrunerHandle handle, PrunerCompoundId compoundId, Gu::PrunerPayloadData* data) const = 0; + + /** + \brief Preallocate space + + \param[in] nbEntries The number of entries to preallocate space for + */ + virtual void preallocate(PxU32 nbEntries) = 0; + + // PT: beware, shape transform + virtual bool setTransform(Gu::PrunerHandle handle, PrunerCompoundId compoundId, const PxTransform& transform) = 0; + + // PT: beware, actor transform + virtual const PxTransform& getTransform(PrunerCompoundId compoundId) const = 0; + + virtual void visualizeEx(PxRenderOutput& out, PxU32 color, bool drawStatic, bool drawDynamic) const = 0; +}; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPrunerData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPrunerData.h new file mode 100644 index 0000000..eb112ed --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqPrunerData.h @@ -0,0 +1,63 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_PRUNER_DATA_H +#define SQ_PRUNER_DATA_H + +/** \addtogroup physics +@{ */ + +#include "SqTypedef.h" + +// PT: SQ-API LEVEL 2 (Level 1 = SqPruner.h) +// PT: this file is part of a "high-level" set of files within Sq. The SqPruner API doesn't rely on them. +// PT: this should really be at Np level but moving it to Sq allows us to share it. + +namespace physx +{ +namespace Sq +{ + struct PruningIndex + { + enum Enum + { + eSTATIC = 0, // PT: must match PX_SCENE_PRUNER_STATIC + eDYNAMIC = 1, // PT: must match PX_SCENE_PRUNER_DYNAMIC + + eCOUNT = 2 + }; + }; + + PX_FORCE_INLINE PrunerData createPrunerData(PxU32 index, Gu::PrunerHandle h) { return PrunerData((h << 1) | index); } + PX_FORCE_INLINE PxU32 getPrunerIndex(PrunerData data) { return PxU32(data & 1); } + PX_FORCE_INLINE Gu::PrunerHandle getPrunerHandle(PrunerData data) { return Gu::PrunerHandle(data >> 1); } +} +} + +/** @} */ +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqQuery.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqQuery.h new file mode 100644 index 0000000..89fffdc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqQuery.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_QUERY_H +#define SQ_QUERY_H + +// PT: SQ-API LEVEL 3 (Level 1 = SqPruner.h, Level 2 = SqManager/SqPrunerData) +// PT: this file is part of a "high-level" set of files within Sq. The SqPruner API doesn't rely on them. +// PT: this should really be at Np level but moving it to Sq allows us to share it. + +#include "foundation/PxSimpleTypes.h" +#include "geometry/PxGeometryQueryFlags.h" + +#include "SqManager.h" +#include "PxQueryReport.h" +#include "GuCachedFuncs.h" + +namespace physx +{ +class PxGeometry; +struct PxQueryFilterData; +struct PxFilterData; +class PxQueryFilterCallback; + +namespace Sq +{ + struct MultiQueryInput; + + class PVDCapture + { + public: + PVDCapture() {} + virtual ~PVDCapture() {} + + virtual bool transmitSceneQueries() = 0; + + virtual void raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal distance, const PxRaycastHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) = 0; + virtual void sweep(const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, PxReal distance, const PxSweepHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData, bool multipleHits) = 0; + virtual void overlap(const PxGeometry& geometry, const PxTransform& pose, const PxOverlapHit* hit, PxU32 hitsNum, const PxQueryFilterData& filterData) = 0; + }; + + // SceneQueries-level adapter. Augments the PrunerManager-level adapter with functions needed to perform queries. + class QueryAdapter : public Adapter + { + public: + QueryAdapter() {} + virtual ~QueryAdapter() {} + + // PT: TODO: decouple from PxQueryCache? + virtual Gu::PrunerHandle findPrunerHandle(const PxQueryCache& cache, PrunerCompoundId& compoundId, PxU32& prunerIndex) const = 0; + + // PT: TODO: return reference? but this version is at least consistent with getActorShape + virtual void getFilterData(const Gu::PrunerPayload& payload, PxFilterData& filterData) const = 0; + virtual void getActorShape(const Gu::PrunerPayload& payload, PxActorShape& actorShape) const = 0; + }; + +} + + class SceneQueries + { + PX_NOCOPY(SceneQueries) + public: + SceneQueries(Sq::PVDCapture* pvd, PxU64 contextID, Gu::Pruner* staticPruner, Gu::Pruner* dynamicPruner, + PxU32 dynamicTreeRebuildRateHint, float inflation, + const PxSceneLimits& limits, const Sq::QueryAdapter& adapter); + ~SceneQueries(); + + PX_FORCE_INLINE Sq::PrunerManager& getPrunerManagerFast() { return mSQManager; } + PX_FORCE_INLINE const Sq::PrunerManager& getPrunerManagerFast() const { return mSQManager; } + + template + bool multiQuery( + const Sq::MultiQueryInput& in, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryCache* cache, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const; + + bool _raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, // Ray data + PxRaycastCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + + bool _sweep( + const PxGeometry& geometry, const PxTransform& pose, // GeomObject data + const PxVec3& unitDir, const PxReal distance, // Ray data + PxSweepCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const; + + bool _overlap( + const PxGeometry& geometry, const PxTransform& transform, // GeomObject data + PxOverlapCallback& hitCall, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const; + + PX_FORCE_INLINE PxU64 getContextId() const { return mSQManager.getContextId(); } + Sq::PrunerManager mSQManager; + public: + Gu::CachedFuncs mCachedFuncs; + + Sq::PVDCapture* mPVD; + }; + +#if PX_SUPPORT_EXTERN_TEMPLATE + //explicit template instantiation declaration + extern template + bool SceneQueries::multiQuery(const Sq::MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + + extern template + bool SceneQueries::multiQuery(const Sq::MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + + extern template + bool SceneQueries::multiQuery(const Sq::MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +#endif + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqTypedef.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqTypedef.h new file mode 100644 index 0000000..a0fc58f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/include/SqTypedef.h @@ -0,0 +1,47 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_TYPEDEF_H +#define SQ_TYPEDEF_H + +#include "foundation/PxSimpleTypes.h" +#include "GuPrunerTypedef.h" + +namespace physx +{ +namespace Sq +{ + typedef PxU32 PrunerCompoundId; + static const PrunerCompoundId INVALID_COMPOUND_ID = 0xffffffff; + + typedef PxU32 PrunerData; + #define SQ_INVALID_PRUNER_DATA 0xffffffff +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp new file mode 100644 index 0000000..350508a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.cpp @@ -0,0 +1,786 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "SqCompoundPruner.h" +#include "GuSqInternal.h" +#include "GuIncrementalAABBTree.h" +#include "GuPruningPool.h" +#include "GuAABBTreeQuery.h" +#include "GuAABBTreeNode.h" +#include "GuSphere.h" +#include "GuBox.h" +#include "GuCapsule.h" +#include "GuBVH.h" +#include "GuQuery.h" +#include "GuInternal.h" +#include "common/PxRenderBuffer.h" +#include "common/PxRenderOutput.h" +#include "CmVisualization.h" + +using namespace physx; +using namespace Gu; +using namespace Sq; + +// PT: TODO: this is copied from SqBounds.h, should be either moved to Gu and shared or passed as a user parameter + #define SQ_PRUNER_EPSILON 0.005f + #define SQ_PRUNER_INFLATION (1.0f + SQ_PRUNER_EPSILON) // pruner test shape inflation (not narrow phase shape) + +#define PARANOIA_CHECKS 0 + +/////////////////////////////////////////////////////////////////////////////////////////////// + +BVHCompoundPruner::BVHCompoundPruner(PxU64 contextID) : mCompoundTreePool(contextID), mDrawStatic(false), mDrawDynamic(false) +{ + preallocate(32); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +BVHCompoundPruner::~BVHCompoundPruner() +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::addCompound(PrunerHandle* results, const BVH& bvh, PrunerCompoundId compoundId, const PxTransform& transform, bool isDynamic, const PrunerPayload* data, const PxTransform* transforms) +{ + PX_ASSERT(bvh.getNbBounds()); + + const PxBounds3 compoundBounds = PxBounds3::transformFast(transform, bvh.getNodes()->mBV); + const PoolIndex poolIndex = mCompoundTreePool.addCompound(results, bvh, compoundBounds, transform, isDynamic, data, transforms); + + mChangedLeaves.clear(); + IncrementalAABBTreeNode* node = mMainTree.insert(poolIndex, mCompoundTreePool.getCurrentCompoundBounds(), mChangedLeaves); + updateMapping(poolIndex, node); + + mActorPoolMap[compoundId] = poolIndex; + mPoolActorMap[poolIndex] = compoundId; + +#if PARANOIA_CHECKS + test(); +#endif + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::updateMapping(const PoolIndex poolIndex, IncrementalAABBTreeNode* node) +{ + // resize mapping if needed + if(mMainTreeUpdateMap.size() <= poolIndex) + { + const PxU32 resizeSize = mMainTreeUpdateMap.size() * 2; + mMainTreeUpdateMap.resize(resizeSize); + mPoolActorMap.resize(resizeSize); + } + + // if a node was split we need to update the node indices and also the sibling indices + if(!mChangedLeaves.empty()) + { + if(node && node->isLeaf()) + { + for(PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + mMainTreeUpdateMap[node->getPrimitives(NULL)[j]] = node; + } + } + + for(PxU32 i = 0; i < mChangedLeaves.size(); i++) + { + IncrementalAABBTreeNode* changedNode = mChangedLeaves[i]; + PX_ASSERT(changedNode->isLeaf()); + + for(PxU32 j = 0; j < changedNode->getNbPrimitives(); j++) + { + mMainTreeUpdateMap[changedNode->getPrimitives(NULL)[j]] = changedNode; + } + } + } + else + { + mMainTreeUpdateMap[poolIndex] = node; + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::removeCompound(PrunerCompoundId compoundId, PrunerPayloadRemovalCallback* removalCallback) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + + bool isDynamic = false; + + if(poolIndexEntry) + { + const PoolIndex poolIndex = poolIndexEntry->second; + + CompoundTree& compoundTree = mCompoundTreePool.getCompoundTrees()[poolIndex]; + isDynamic = compoundTree.mFlags & PxCompoundPrunerQueryFlag::eDYNAMIC; + + const PoolIndex poolRelocatedLastIndex = mCompoundTreePool.removeCompound(poolIndex, removalCallback); + + IncrementalAABBTreeNode* node = mMainTree.remove(mMainTreeUpdateMap[poolIndex], poolIndex, mCompoundTreePool.getCurrentCompoundBounds()); + // if node moved to its parent + if(node && node->isLeaf()) + { + for (PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + mMainTreeUpdateMap[index] = node; + } + } + + // fix indices if we made a swap + if(poolRelocatedLastIndex != poolIndex) + { + mMainTreeUpdateMap[poolIndex] = mMainTreeUpdateMap[poolRelocatedLastIndex]; + mMainTree.fixupTreeIndices(mMainTreeUpdateMap[poolIndex], poolRelocatedLastIndex, poolIndex); + + mActorPoolMap[mPoolActorMap[poolRelocatedLastIndex]] = poolIndex; + mPoolActorMap[poolIndex] = mPoolActorMap[poolRelocatedLastIndex]; + } + + mActorPoolMap.erase(compoundId); + } + +#if PARANOIA_CHECKS + test(); +#endif + + return isDynamic; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::updateCompound(PrunerCompoundId compoundId, const PxTransform& transform) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + + bool isDynamic = false; + + if(poolIndexEntry) + { + const PxU32 poolIndex = poolIndexEntry->second; + + CompoundTree& compoundTree = mCompoundTreePool.getCompoundTrees()[poolIndex]; + isDynamic = compoundTree.mFlags & PxCompoundPrunerQueryFlag::eDYNAMIC; + + compoundTree.mGlobalPose = transform; + + PxBounds3 localBounds; + const IncrementalAABBTreeNode* node = compoundTree.mTree->getNodes(); + V4StoreU(node->mBVMin, &localBounds.minimum.x); + PX_ALIGN(16, PxVec4) max4; + V4StoreA(node->mBVMax, &max4.x); + localBounds.maximum = PxVec3(max4.x, max4.y, max4.z); + + const PxBounds3 compoundBounds = PxBounds3::transformFast(transform, localBounds); + mCompoundTreePool.getCurrentCompoundBounds()[poolIndex] = compoundBounds; + mChangedLeaves.clear(); + IncrementalAABBTreeNode* mainTreeNode = mMainTree.update(mMainTreeUpdateMap[poolIndex], poolIndex, mCompoundTreePool.getCurrentCompoundBounds(), mChangedLeaves); + // we removed node during update, need to update the mapping + updateMapping(poolIndex, mainTreeNode); + } + +#if PARANOIA_CHECKS + test(); +#endif + + return isDynamic; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::test() +{ + if(mMainTree.getNodes()) + { + for(PxU32 i = 0; i < mCompoundTreePool.getNbObjects(); i++) + { + mMainTree.checkTreeLeaf(mMainTreeUpdateMap[i], i); + } + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::release() +{ +} + +////////////////////////////////////////////////////////////////////////// +// Queries implementation +////////////////////////////////////////////////////////////////////////// + +namespace +{ + struct CompoundCallbackRaycastAdapter + { + PX_FORCE_INLINE CompoundCallbackRaycastAdapter(CompoundPrunerRaycastCallback& pcb, const CompoundTree& tree) : mCallback(pcb), mTree(tree) {} + + PX_FORCE_INLINE bool invoke(PxReal& distance, PxU32 primIndex) + { + return mCallback.invoke(distance, primIndex, mTree.mPruningPool->getObjects(), mTree.mPruningPool->getTransforms(), &mTree.mGlobalPose); + } + + CompoundPrunerRaycastCallback& mCallback; + const CompoundTree& mTree; + PX_NOCOPY(CompoundCallbackRaycastAdapter) + }; + + struct CompoundCallbackOverlapAdapter + { + PX_FORCE_INLINE CompoundCallbackOverlapAdapter(CompoundPrunerOverlapCallback& pcb, const CompoundTree& tree) : mCallback(pcb), mTree(tree) {} + + PX_FORCE_INLINE bool invoke(PxU32 primIndex) + { + return mCallback.invoke(primIndex, mTree.mPruningPool->getObjects(), mTree.mPruningPool->getTransforms(), &mTree.mGlobalPose); + } + + CompoundPrunerOverlapCallback& mCallback; + const CompoundTree& mTree; + PX_NOCOPY(CompoundCallbackOverlapAdapter) + }; +} + +template +struct MainTreeCompoundPrunerCallback +{ + MainTreeCompoundPrunerCallback(PrunerCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : mPrunerCallback(prunerCallback), mQueryFlags(flags), mCompoundTrees(compoundTrees) + { + } + + virtual ~MainTreeCompoundPrunerCallback() {} + + PX_FORCE_INLINE bool filtering(const CompoundTree& compoundTree) const + { + if(!(compoundTree.mFlags & mQueryFlags) || !compoundTree.mTree->getNodes()) + return true; + return false; + } + + protected: + PrunerCallback& mPrunerCallback; + const PxCompoundPrunerQueryFlags mQueryFlags; + const CompoundTree* mCompoundTrees; + + PX_NOCOPY(MainTreeCompoundPrunerCallback) +}; + +// Raycast/sweeps callback for main AABB tree +template +struct MainTreeRaycastCompoundPrunerCallback : MainTreeCompoundPrunerCallback +{ + MainTreeRaycastCompoundPrunerCallback(const PxVec3& origin, const PxVec3& unitDir, const PxVec3& extent, CompoundPrunerRaycastCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeCompoundPrunerCallback(prunerCallback, flags, compoundTrees), mOrigin(origin), mUnitDir(unitDir), mExtent(extent) + { + } + + virtual ~MainTreeRaycastCompoundPrunerCallback() {} + + bool invoke(PxReal& distance, PxU32 primIndex) + { + const CompoundTree& compoundTree = mCompoundTrees[primIndex]; + + if(filtering(compoundTree)) + return true; + + // transfer to actor local space + const PxVec3 localOrigin = compoundTree.mGlobalPose.transformInv(mOrigin); + const PxVec3 localDir = compoundTree.mGlobalPose.q.rotateInv(mUnitDir); + PxVec3 localExtent = mExtent; + + if(tInflate) + { + const PxBounds3 wBounds = PxBounds3::centerExtents(mOrigin, mExtent); + const PxBounds3 localBounds = PxBounds3::transformSafe(compoundTree.mGlobalPose.getInverse(), wBounds); + localExtent = localBounds.getExtents(); + } + + // raycast the merged tree + CompoundCallbackRaycastAdapter pcb(mPrunerCallback, compoundTree); + return AABBTreeRaycast() + (compoundTree.mPruningPool->getCurrentAABBTreeBounds(), *compoundTree.mTree, localOrigin, localDir, distance, localExtent, pcb); + } + + PX_NOCOPY(MainTreeRaycastCompoundPrunerCallback) + +private: + const PxVec3& mOrigin; + const PxVec3& mUnitDir; + const PxVec3& mExtent; +}; + +////////////////////////////////////////////////////////////////////////// +// raycast against the compound pruner +bool BVHCompoundPruner::raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback& prunerCallback, PxCompoundPrunerQueryFlags flags) const +{ + bool again = true; + + // search the main tree if there are nodes + if(mMainTree.getNodes()) + { + const PxVec3 extent(0.0f); + // main tree callback + MainTreeRaycastCompoundPrunerCallback pcb(origin, unitDir, extent, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + // traverse the main tree + again = AABBTreeRaycast >() + (mCompoundTreePool.getCurrentAABBTreeBounds(), mMainTree, origin, unitDir, inOutDistance, extent, pcb); + } + + return again; +} + +////////////////////////////////////////////////////////////////////////// +// overlap main tree callback +// A.B. templated version is complicated due to test transformations, will do a callback per primitive +struct MainTreeOverlapCompoundPrunerCallback : MainTreeCompoundPrunerCallback +{ + MainTreeOverlapCompoundPrunerCallback(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeCompoundPrunerCallback(prunerCallback, flags, compoundTrees), mQueryVolume(queryVolume) + { + } + + virtual ~MainTreeOverlapCompoundPrunerCallback() {} + + PX_NOCOPY(MainTreeOverlapCompoundPrunerCallback) + +protected: + const ShapeData& mQueryVolume; +}; + +// OBB +struct MainTreeOBBOverlapCompoundPrunerCallback : public MainTreeOverlapCompoundPrunerCallback +{ + MainTreeOBBOverlapCompoundPrunerCallback(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeOverlapCompoundPrunerCallback(queryVolume, prunerCallback, flags, compoundTrees) {} + + bool invoke(PxU32 primIndex) + { + const CompoundTree& compoundTree = mCompoundTrees[primIndex]; + + if(filtering(compoundTree)) + return true; + + const PxVec3 localPos = compoundTree.mGlobalPose.transformInv(mQueryVolume.getPrunerWorldPos()); + const PxMat33 transfMat(compoundTree.mGlobalPose.q); + const PxMat33 localRot = transfMat.getTranspose()*mQueryVolume.getPrunerWorldRot33(); + + const OBBAABBTest localTest(localPos, localRot, mQueryVolume.getPrunerBoxGeomExtentsInflated()); + // overlap the compound local tree + CompoundCallbackOverlapAdapter pcb(mPrunerCallback, compoundTree); + return AABBTreeOverlap() + (compoundTree.mPruningPool->getCurrentAABBTreeBounds(), *compoundTree.mTree, localTest, pcb); + } + + PX_NOCOPY(MainTreeOBBOverlapCompoundPrunerCallback) +}; + +// AABB +struct MainTreeAABBOverlapCompoundPrunerCallback : public MainTreeOverlapCompoundPrunerCallback +{ + MainTreeAABBOverlapCompoundPrunerCallback(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeOverlapCompoundPrunerCallback(queryVolume, prunerCallback, flags, compoundTrees) {} + + bool invoke(PxU32 primIndex) + { + const CompoundTree& compoundTree = mCompoundTrees[primIndex]; + + if(filtering(compoundTree)) + return true; + + const PxVec3 localPos = compoundTree.mGlobalPose.transformInv(mQueryVolume.getPrunerWorldPos()); + const PxMat33 transfMat(compoundTree.mGlobalPose.q); + const PxMat33 localRot = transfMat.getTranspose()*mQueryVolume.getPrunerWorldRot33(); + + // A.B. we dont have the AABB in local space, either we test OBB local space or + // we retest the AABB with the worldSpace AABB of the local tree??? + const OBBAABBTest localTest(localPos, localRot, mQueryVolume.getPrunerBoxGeomExtentsInflated()); + // overlap the compound local tree + CompoundCallbackOverlapAdapter pcb(mPrunerCallback, compoundTree); + return AABBTreeOverlap() + (compoundTree.mPruningPool->getCurrentAABBTreeBounds(), *compoundTree.mTree, localTest, pcb); + } + + PX_NOCOPY(MainTreeAABBOverlapCompoundPrunerCallback) +}; + +// Capsule +struct MainTreeCapsuleOverlapCompoundPrunerCallback : public MainTreeOverlapCompoundPrunerCallback +{ + MainTreeCapsuleOverlapCompoundPrunerCallback(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeOverlapCompoundPrunerCallback(queryVolume, prunerCallback, flags, compoundTrees) {} + + bool invoke(PxU32 primIndex) + { + const CompoundTree& compoundTree = mCompoundTrees[primIndex]; + + if(filtering(compoundTree)) + return true; + + const PxMat33 transfMat(compoundTree.mGlobalPose.q); + const Capsule& capsule = mQueryVolume.getGuCapsule(); + const CapsuleAABBTest localTest( + compoundTree.mGlobalPose.transformInv(capsule.p1), + transfMat.getTranspose()*mQueryVolume.getPrunerWorldRot33().column0, + mQueryVolume.getCapsuleHalfHeight()*2.0f, PxVec3(capsule.radius*SQ_PRUNER_INFLATION)); + + // overlap the compound local tree + CompoundCallbackOverlapAdapter pcb(mPrunerCallback, compoundTree); + return AABBTreeOverlap() + (compoundTree.mPruningPool->getCurrentAABBTreeBounds(), *compoundTree.mTree, localTest, pcb); + } + + PX_NOCOPY(MainTreeCapsuleOverlapCompoundPrunerCallback) +}; + +// Sphere +struct MainTreeSphereOverlapCompoundPrunerCallback : public MainTreeOverlapCompoundPrunerCallback +{ + MainTreeSphereOverlapCompoundPrunerCallback(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags, const CompoundTree* compoundTrees) + : MainTreeOverlapCompoundPrunerCallback(queryVolume, prunerCallback, flags, compoundTrees) {} + + bool invoke(PxU32 primIndex) + { + const CompoundTree& compoundTree = mCompoundTrees[primIndex]; + + if(filtering(compoundTree)) + return true; + + const Sphere& sphere = mQueryVolume.getGuSphere(); + const SphereAABBTest localTest(compoundTree.mGlobalPose.transformInv(sphere.center), sphere.radius); + + // overlap the compound local tree + CompoundCallbackOverlapAdapter pcb(mPrunerCallback, compoundTree); + return AABBTreeOverlap() + (compoundTree.mPruningPool->getCurrentAABBTreeBounds(), *compoundTree.mTree, localTest, pcb); + } + + PX_NOCOPY(MainTreeSphereOverlapCompoundPrunerCallback) +}; + + +////////////////////////////////////////////////////////////////////////// +// overlap implementation +bool BVHCompoundPruner::overlap(const ShapeData& queryVolume, CompoundPrunerOverlapCallback& prunerCallback, PxCompoundPrunerQueryFlags flags) const +{ + if(!mMainTree.getNodes()) + return true; + + bool again = true; + + const Gu::AABBTreeBounds& bounds = mCompoundTreePool.getCurrentAABBTreeBounds(); + + switch (queryVolume.getType()) + { + case PxGeometryType::eBOX: + { + if(queryVolume.isOBB()) + { + const DefaultOBBAABBTest test(queryVolume); + MainTreeOBBOverlapCompoundPrunerCallback pcb(queryVolume, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeOverlap()(bounds, mMainTree, test, pcb); + } + else + { + const DefaultAABBAABBTest test(queryVolume); + MainTreeAABBOverlapCompoundPrunerCallback pcb(queryVolume, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeOverlap()(bounds, mMainTree, test, pcb); + } + } + break; + case PxGeometryType::eCAPSULE: + { + const DefaultCapsuleAABBTest test(queryVolume, SQ_PRUNER_INFLATION); + MainTreeCapsuleOverlapCompoundPrunerCallback pcb(queryVolume, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeOverlap()(bounds, mMainTree, test, pcb); + } + break; + case PxGeometryType::eSPHERE: + { + const DefaultSphereAABBTest test(queryVolume); + MainTreeSphereOverlapCompoundPrunerCallback pcb(queryVolume, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeOverlap()(bounds, mMainTree, test, pcb); + } + break; + case PxGeometryType::eCONVEXMESH: + { + const DefaultOBBAABBTest test(queryVolume); + MainTreeOBBOverlapCompoundPrunerCallback pcb(queryVolume, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeOverlap()(bounds, mMainTree, test, pcb); + } + break; + default: + PX_ALWAYS_ASSERT_MESSAGE("unsupported overlap query volume geometry type"); + } + + return again; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::sweep(const ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback& prunerCallback, PxCompoundPrunerQueryFlags flags) const +{ + bool again = true; + + if(mMainTree.getNodes()) + { + const PxBounds3& aabb = queryVolume.getPrunerInflatedWorldAABB(); + const PxVec3 extents = aabb.getExtents(); + const PxVec3 center = aabb.getCenter(); + MainTreeRaycastCompoundPrunerCallback pcb(center, unitDir, extents, prunerCallback, flags, mCompoundTreePool.getCompoundTrees()); + again = AABBTreeRaycast >() + (mCompoundTreePool.getCurrentAABBTreeBounds(), mMainTree, center, unitDir, inOutDistance, extents, pcb); + } + return again; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +const PrunerPayload& BVHCompoundPruner::getPayloadData(PrunerHandle handle, PrunerCompoundId compoundId, PrunerPayloadData* data) const +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + + return mCompoundTreePool.getCompoundTrees()[poolIndexEntry->second].mPruningPool->getPayloadData(handle, data); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::preallocate(PxU32 nbEntries) +{ + mCompoundTreePool.preallocate(nbEntries); + mMainTreeUpdateMap.resizeUninitialized(nbEntries); + mPoolActorMap.resizeUninitialized(nbEntries); + mChangedLeaves.reserve(nbEntries); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::setTransform(PrunerHandle handle, PrunerCompoundId compoundId, const PxTransform& transform) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + + return mCompoundTreePool.getCompoundTrees()[poolIndexEntry->second].mPruningPool->setTransform(handle, transform); +} + +const PxTransform& BVHCompoundPruner::getTransform(PrunerCompoundId compoundId) const +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + + return mCompoundTreePool.getCompoundTrees()[poolIndexEntry->second].mGlobalPose; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::updateObjectAfterManualBoundsUpdates(PrunerCompoundId compoundId, const PrunerHandle handle) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + if(!poolIndexEntry) + return; + + mCompoundTreePool.getCompoundTrees()[poolIndexEntry->second].updateObjectAfterManualBoundsUpdates(handle); + + const PxU32 poolIndex = poolIndexEntry->second; + updateMainTreeNode(poolIndex); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::removeObject(PrunerCompoundId compoundId, const PrunerHandle handle, PrunerPayloadRemovalCallback* removalCallback) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + if(!poolIndexEntry) + return; + + const PxU32 poolIndex = poolIndexEntry->second; + + mCompoundTreePool.getCompoundTrees()[poolIndex].removeObject(handle, removalCallback); + + // edge case, we removed all objects for the compound tree, we need to remove it now completely + if(!mCompoundTreePool.getCompoundTrees()[poolIndex].mTree->getNodes()) + removeCompound(compoundId, removalCallback); + else + updateMainTreeNode(poolIndex); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool BVHCompoundPruner::addObject(PrunerCompoundId compoundId, PrunerHandle& result, const PxBounds3& bounds, const PrunerPayload userData, const PxTransform& transform) +{ + const ActorIdPoolIndexMap::Entry* poolIndexEntry = mActorPoolMap.find(compoundId); + PX_ASSERT(poolIndexEntry); + if(!poolIndexEntry) + return false; + + mCompoundTreePool.getCompoundTrees()[poolIndexEntry->second].addObject(result, bounds, userData, transform); + + const PxU32 poolIndex = poolIndexEntry->second; + updateMainTreeNode(poolIndex); + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::updateMainTreeNode(PoolIndex poolIndex) +{ + PxBounds3 localBounds; + const IncrementalAABBTreeNode* node = mCompoundTreePool.getCompoundTrees()[poolIndex].mTree->getNodes(); + V4StoreU(node->mBVMin, &localBounds.minimum.x); + PX_ALIGN(16, PxVec4) max4; + V4StoreA(node->mBVMax, &max4.x); + localBounds.maximum = PxVec3(max4.x, max4.y, max4.z); + const PxBounds3 compoundBounds = PxBounds3::transformFast(mCompoundTreePool.getCompoundTrees()[poolIndex].mGlobalPose, localBounds); + mCompoundTreePool.getCurrentCompoundBounds()[poolIndex] = compoundBounds; + + mChangedLeaves.clear(); + IncrementalAABBTreeNode* mainTreeNode = mMainTree.update(mMainTreeUpdateMap[poolIndex], poolIndex, mCompoundTreePool.getCurrentCompoundBounds(), mChangedLeaves); + // we removed node during update, need to update the mapping + updateMapping(poolIndex, mainTreeNode); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void BVHCompoundPruner::shiftOrigin(const PxVec3& shift) +{ + mCompoundTreePool.shiftOrigin(shift); + + mMainTree.shiftOrigin(shift); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +namespace +{ + class CompoundTreeVizCb : public DebugVizCallback + { + PX_NOCOPY(CompoundTreeVizCb) + public: + + CompoundTreeVizCb(PxRenderOutput& out, const CompoundTree& tree) : + mOut (out), + mPose (tree.mGlobalPose) + { + } + + virtual bool visualizeNode(const IncrementalAABBTreeNode& /*node*/, const PxBounds3& bounds) + { + if(0) + { + Cm::renderOutputDebugBox(mOut, PxBounds3::transformSafe(mPose, bounds)); + } + else + { + PxVec3 pts[8]; + computeBoxPoints(bounds, pts); + for(PxU32 i=0;i<8;i++) + pts[i] = mPose.transform(pts[i]); + + const PxU8* edges = getBoxEdges(); + for(PxU32 i=0;i<12;i++) + { + const PxVec3& p0 = pts[*edges++]; + const PxVec3& p1 = pts[*edges++]; + mOut.outputSegment(p0, p1); + } + } + return true; + } + + PxRenderOutput& mOut; + const PxTransform& mPose; + }; + + class CompoundPrunerDebugVizCb : public DebugVizCallback + { + PX_NOCOPY(CompoundPrunerDebugVizCb) + public: + + CompoundPrunerDebugVizCb(PxRenderOutput& out, const CompoundTree* trees, bool debugStatic, bool debugDynamic) : + mOut (out), + mTrees (trees), + mDebugVizStatic (debugStatic), + mDebugVizDynamic(debugDynamic) + {} + + virtual bool visualizeNode(const IncrementalAABBTreeNode& node, const PxBounds3& /*bounds*/) + { + if(node.isLeaf()) + { + PxU32 nbPrims = node.getNbPrimitives(); + const PxU32* prims = node.getPrimitives(NULL); + while(nbPrims--) + { + const CompoundTree& compoundTree = mTrees[*prims++]; + + const bool isDynamic = compoundTree.mFlags & PxCompoundPrunerQueryFlag::eDYNAMIC; + + if((mDebugVizDynamic && isDynamic) || (mDebugVizStatic && !isDynamic)) + { + const PxU32 color = isDynamic ? SQ_DEBUG_VIZ_DYNAMIC_COLOR : SQ_DEBUG_VIZ_STATIC_COLOR; + CompoundTreeVizCb leafCB(mOut, compoundTree); + visualizeTree(mOut, color, compoundTree.mTree, &leafCB); + mOut << SQ_DEBUG_VIZ_COMPOUND_COLOR; + } + } + } + return false; + } + + PxRenderOutput& mOut; + const CompoundTree* mTrees; + const bool mDebugVizStatic; + const bool mDebugVizDynamic; + }; +} + +void BVHCompoundPruner::visualize(PxRenderOutput& out, PxU32 primaryColor, PxU32 /*secondaryColor*/) const +{ + if(mDrawStatic || mDrawDynamic) + { + CompoundPrunerDebugVizCb cb(out, mCompoundTreePool.getCompoundTrees(), mDrawStatic, mDrawDynamic); + visualizeTree(out, primaryColor, &mMainTree, &cb); + } +} + +void BVHCompoundPruner::visualizeEx(PxRenderOutput& out, PxU32 color, bool drawStatic, bool drawDynamic) const +{ + mDrawStatic = drawStatic; + mDrawDynamic = drawDynamic; + visualize(out, color, color); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.h new file mode 100644 index 0000000..8e130ae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruner.h @@ -0,0 +1,102 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_COMPOUND_PRUNER_H +#define SQ_COMPOUND_PRUNER_H + +#include "SqCompoundPruningPool.h" +#include "GuSqInternal.h" +#include "GuPrunerMergeData.h" +#include "GuIncrementalAABBTree.h" +#include "GuPruningPool.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxArray.h" + +namespace physx +{ +namespace Sq +{ + /////////////////////////////////////////////////////////////////////////////////////////////// + + typedef PxHashMap ActorIdPoolIndexMap; + typedef PxArray PoolIndexActorIdMap; + + /////////////////////////////////////////////////////////////////////////////////////////////// + + class BVHCompoundPruner : public CompoundPruner + { + public: + BVHCompoundPruner(PxU64 contextID); + virtual ~BVHCompoundPruner(); + + void release(); + + // BasePruner + DECLARE_BASE_PRUNER_API + //~BasePruner + + // CompoundPruner + // compound level + virtual bool addCompound(Gu::PrunerHandle* results, const Gu::BVH& bvh, PrunerCompoundId compoundId, const PxTransform& transform, bool isDynamic, const Gu::PrunerPayload* data, const PxTransform* transforms); + virtual bool removeCompound(PrunerCompoundId compoundId, Gu::PrunerPayloadRemovalCallback* removalCallback); + virtual bool updateCompound(PrunerCompoundId compoundId, const PxTransform& transform); + // object level + virtual void updateObjectAfterManualBoundsUpdates(PrunerCompoundId compoundId, const Gu::PrunerHandle handle); + virtual void removeObject(PrunerCompoundId compoundId, const Gu::PrunerHandle handle, Gu::PrunerPayloadRemovalCallback* removalCallback); + virtual bool addObject(PrunerCompoundId compoundId, Gu::PrunerHandle& result, const PxBounds3& bounds, const Gu::PrunerPayload userData, const PxTransform& transform); + //queries + virtual bool raycast(const PxVec3& origin, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const; + virtual bool overlap(const Gu::ShapeData& queryVolume, CompoundPrunerOverlapCallback&, PxCompoundPrunerQueryFlags flags) const; + virtual bool sweep(const Gu::ShapeData& queryVolume, const PxVec3& unitDir, PxReal& inOutDistance, CompoundPrunerRaycastCallback&, PxCompoundPrunerQueryFlags flags) const; + virtual const Gu::PrunerPayload& getPayloadData(Gu::PrunerHandle handle, PrunerCompoundId compoundId, Gu::PrunerPayloadData* data) const; + virtual void preallocate(PxU32 nbEntries); + virtual bool setTransform(Gu::PrunerHandle handle, PrunerCompoundId compoundId, const PxTransform& transform); + virtual const PxTransform& getTransform(PrunerCompoundId compoundId) const; + virtual void visualizeEx(PxRenderOutput& out, PxU32 color, bool drawStatic, bool drawDynamic) const; + // ~CompoundPruner + + private: + void updateMapping(const Gu::PoolIndex poolIndex, Gu::IncrementalAABBTreeNode* node); + void updateMainTreeNode(Gu::PoolIndex index); + + void test(); + + Gu::IncrementalAABBTree mMainTree; + UpdateMap mMainTreeUpdateMap; + + CompoundTreePool mCompoundTreePool; + ActorIdPoolIndexMap mActorPoolMap; + PoolIndexActorIdMap mPoolActorMap; + Gu::NodeList mChangedLeaves; + mutable bool mDrawStatic; + mutable bool mDrawDynamic; + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp new file mode 100644 index 0000000..bac3c63 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.cpp @@ -0,0 +1,271 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxAllocator.h" +#include "SqCompoundPruningPool.h" +#include "GuPruningPool.h" +#include "GuAABBTree.h" +#include "GuBVH.h" + +using namespace physx; +using namespace Cm; +using namespace Gu; +using namespace Sq; + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void CompoundTree::updateObjectAfterManualBoundsUpdates(PrunerHandle handle) +{ + const PxBounds3* newBounds = mPruningPool->getCurrentWorldBoxes(); + const PoolIndex poolIndex = mPruningPool->getIndex(handle); + NodeList changedLeaves; + changedLeaves.reserve(8); + IncrementalAABBTreeNode* node = mTree->update((*mUpdateMap)[poolIndex], poolIndex, newBounds, changedLeaves); + // we removed node during update, need to update the mapping + updateMapping(poolIndex, node, changedLeaves); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void CompoundTree::removeObject(PrunerHandle handle, PrunerPayloadRemovalCallback* removalCallback) +{ + const PoolIndex poolIndex = mPruningPool->getIndex(handle); // save the pool index for removed object + const PoolIndex poolRelocatedLastIndex = mPruningPool->removeObject(handle, removalCallback); // save the lastIndex returned by removeObject + + IncrementalAABBTreeNode* node = mTree->remove((*mUpdateMap)[poolIndex], poolIndex, mPruningPool->getCurrentWorldBoxes()); + // if node moved to its parent + if (node && node->isLeaf()) + { + for (PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + (*mUpdateMap)[index] = node; + } + } + + (*mUpdateMap)[poolIndex] = (*mUpdateMap)[poolRelocatedLastIndex]; + // fix indices if we made a swap + if(poolRelocatedLastIndex != poolIndex) + mTree->fixupTreeIndices((*mUpdateMap)[poolIndex], poolRelocatedLastIndex, poolIndex); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool CompoundTree::addObject(PrunerHandle& result, const PxBounds3& bounds, const PrunerPayload& data, const PxTransform& transform) +{ + mPruningPool->addObjects(&result, &bounds, &data, &transform, 1); + if (mPruningPool->mMaxNbObjects > mUpdateMap->size()) + mUpdateMap->resize(mPruningPool->mMaxNbObjects); + + const PoolIndex poolIndex = mPruningPool->getIndex(result); + NodeList changedLeaves; + changedLeaves.reserve(8); + IncrementalAABBTreeNode* node = mTree->insert(poolIndex, mPruningPool->getCurrentWorldBoxes(), changedLeaves); + updateMapping(poolIndex, node, changedLeaves); + + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void CompoundTree::updateMapping(const PoolIndex poolIndex, IncrementalAABBTreeNode* node, const NodeList& changedLeaves) +{ + // if a node was split we need to update the node indices and also the sibling indices + if(!changedLeaves.empty()) + { + if(node && node->isLeaf()) + { + for(PxU32 j = 0; j < node->getNbPrimitives(); j++) + { + const PoolIndex index = node->getPrimitives(NULL)[j]; + (*mUpdateMap)[index] = node; + } + } + + for(PxU32 i = 0; i < changedLeaves.size(); i++) + { + IncrementalAABBTreeNode* changedNode = changedLeaves[i]; + PX_ASSERT(changedNode->isLeaf()); + + for(PxU32 j = 0; j < changedNode->getNbPrimitives(); j++) + { + const PoolIndex index = changedNode->getPrimitives(NULL)[j]; + (*mUpdateMap)[index] = changedNode; + } + } + } + else + { + (*mUpdateMap)[poolIndex] = node; + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +CompoundTreePool::CompoundTreePool(PxU64 contextID) : + mNbObjects (0), + mMaxNbObjects (0), + mCompoundTrees (NULL), + mContextID (contextID) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +CompoundTreePool::~CompoundTreePool() +{ + PX_FREE(mCompoundTrees); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +bool CompoundTreePool::resize(PxU32 newCapacity) +{ + mCompoundBounds.resize(newCapacity, mNbObjects); + + CompoundTree* newTrees = PX_ALLOCATE(CompoundTree, newCapacity, "IncrementalTrees*"); + if(!newTrees) + return false; + + // memzero, we need to set the pointers in the compound tree to NULL + PxMemZero(newTrees, sizeof(CompoundTree)*newCapacity); + if(mCompoundTrees) + PxMemCopy(newTrees, mCompoundTrees, mNbObjects*sizeof(CompoundTree)); + mMaxNbObjects = newCapacity; + PX_FREE(mCompoundTrees); + mCompoundTrees = newTrees; + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void CompoundTreePool::preallocate(PxU32 newCapacity) +{ + if(newCapacity>mMaxNbObjects) + resize(newCapacity); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +void CompoundTreePool::shiftOrigin(const PxVec3& shift) +{ + PxBounds3* bounds = mCompoundBounds.getBounds(); + for(PxU32 i=0; i < mNbObjects; i++) + { + bounds[i].minimum -= shift; + bounds[i].maximum -= shift; + + mCompoundTrees[i].mGlobalPose.p -= shift; + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +PoolIndex CompoundTreePool::addCompound(PrunerHandle* results, const BVH& bvh, const PxBounds3& compoundBounds, const PxTransform& transform, bool isDynamic, const PrunerPayload* data, const PxTransform* transforms) +{ + if(mNbObjects==mMaxNbObjects) // increase the capacity on overflow + { + if(!resize(PxMax(mMaxNbObjects*2, 32))) + { + // pool can return an invalid handle if memory alloc fails + PxGetFoundation().error(PxErrorCode::eOUT_OF_MEMORY, __FILE__, __LINE__, "CompoundTreePool::addCompound memory allocation in resize failed."); + return INVALID_PRUNERHANDLE; + } + } + PX_ASSERT(mNbObjects!=mMaxNbObjects); + + const PoolIndex index = mNbObjects++; + + mCompoundBounds.getBounds()[index] = compoundBounds; + + const PxU32 nbObjects = bvh.getNbBounds(); + + CompoundTree& tree = mCompoundTrees[index]; + PX_ASSERT(tree.mPruningPool == NULL); + PX_ASSERT(tree.mTree == NULL); + PX_ASSERT(tree.mUpdateMap == NULL); + + tree.mGlobalPose = transform; + tree.mFlags = isDynamic ? PxCompoundPrunerQueryFlag::eDYNAMIC : PxCompoundPrunerQueryFlag::eSTATIC; + + // prepare the pruning pool + PruningPool* pool = PX_NEW(PruningPool)(mContextID, TRANSFORM_CACHE_LOCAL); + pool->preallocate(nbObjects); + pool->addObjects(results, bvh.getBounds(), data, transforms, nbObjects); + tree.mPruningPool = pool; + + // prepare update map + UpdateMap* map = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(UpdateMap), "Update map"), UpdateMap); + map->resizeUninitialized(nbObjects); + tree.mUpdateMap = map; + + IncrementalAABBTree* iTree = PX_NEW(IncrementalAABBTree); + iTree->copy(bvh, *map); + tree.mTree = iTree; + + return index; +} + +/////////////////////////////////////////////////////////////////////////////////////////////// + +PoolIndex CompoundTreePool::removeCompound(PoolIndex indexOfRemovedObject, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_ASSERT(mNbObjects); + + // release the tree + PX_DELETE(mCompoundTrees[indexOfRemovedObject].mTree); + + mCompoundTrees[indexOfRemovedObject].mUpdateMap->clear(); + mCompoundTrees[indexOfRemovedObject].mUpdateMap->~PxArray(); + PX_FREE(mCompoundTrees[indexOfRemovedObject].mUpdateMap); + + if(removalCallback) + { + const PruningPool* pool = mCompoundTrees[indexOfRemovedObject].mPruningPool; + removalCallback->invoke(pool->getNbActiveObjects(), pool->getObjects()); + } + + PX_DELETE(mCompoundTrees[indexOfRemovedObject].mPruningPool); + + const PoolIndex indexOfLastObject = --mNbObjects; // swap the object at last index with index + if(indexOfLastObject!=indexOfRemovedObject) + { + // PT: move last object's data to recycled spot (from removed object) + + // PT: the last object has moved so we need to handle the mappings for this object + mCompoundBounds.getBounds() [indexOfRemovedObject] = mCompoundBounds.getBounds() [indexOfLastObject]; + mCompoundTrees [indexOfRemovedObject] = mCompoundTrees [indexOfLastObject]; + + mCompoundTrees [indexOfLastObject].mPruningPool = NULL; + mCompoundTrees [indexOfLastObject].mUpdateMap = NULL; + mCompoundTrees [indexOfLastObject].mTree = NULL; + } + + return indexOfLastObject; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.h b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.h new file mode 100644 index 0000000..83b9a6e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqCompoundPruningPool.h @@ -0,0 +1,112 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SQ_COMPOUND_PRUNING_POOL_H +#define SQ_COMPOUND_PRUNING_POOL_H + +#include "SqPruner.h" +#include "foundation/PxArray.h" +#include "GuPrunerMergeData.h" +#include "GuIncrementalAABBTree.h" +#include "GuAABBTreeBounds.h" + +namespace physx +{ +namespace Gu +{ + class PruningPool; +} + +namespace Sq +{ + + /////////////////////////////////////////////////////////////////////////////////////////////// + + typedef PxArray UpdateMap; + + /////////////////////////////////////////////////////////////////////////////////////////////// + + class CompoundTree + { + public: + void updateObjectAfterManualBoundsUpdates(Gu::PrunerHandle handle); + void removeObject(Gu::PrunerHandle handle, Gu::PrunerPayloadRemovalCallback* removalCallback); + bool addObject(Gu::PrunerHandle& result, const PxBounds3& bounds, const Gu::PrunerPayload& data, const PxTransform& transform); + + private: + void updateMapping(const Gu::PoolIndex poolIndex, Gu::IncrementalAABBTreeNode* node, const Gu::NodeList& changedLeaves); + + public: + Gu::IncrementalAABBTree* mTree; + Gu::PruningPool* mPruningPool; + UpdateMap* mUpdateMap; + PxTransform mGlobalPose; + PxCompoundPrunerQueryFlags mFlags; + }; + + /////////////////////////////////////////////////////////////////////////////////////////////// + + class CompoundTreePool + { + public: + CompoundTreePool(PxU64 contextID); + ~CompoundTreePool(); + + void preallocate(PxU32 newCapacity); + + Gu::PoolIndex addCompound(Gu::PrunerHandle* results, const Gu::BVH& bvh, const PxBounds3& compoundBounds, const PxTransform& transform, bool isDynamic, const Gu::PrunerPayload* data, const PxTransform* transforms); + Gu::PoolIndex removeCompound(Gu::PoolIndex index, Gu::PrunerPayloadRemovalCallback* removalCallback); + + void shiftOrigin(const PxVec3& shift); + + PX_FORCE_INLINE const Gu::AABBTreeBounds& getCurrentAABBTreeBounds() const { return mCompoundBounds; } + PX_FORCE_INLINE const PxBounds3* getCurrentCompoundBounds() const { return mCompoundBounds.getBounds(); } + PX_FORCE_INLINE PxBounds3* getCurrentCompoundBounds() { return mCompoundBounds.getBounds(); } + + PX_FORCE_INLINE const CompoundTree* getCompoundTrees() const { return mCompoundTrees; } + PX_FORCE_INLINE CompoundTree* getCompoundTrees() { return mCompoundTrees; } + + PX_FORCE_INLINE PxU32 getNbObjects() const { return mNbObjects; } + + private: + bool resize(PxU32 newCapacity); + + PxU32 mNbObjects; //!< Current number of objects + PxU32 mMaxNbObjects; //!< Max. number of objects (capacity for mWorldBoxes, mObjects) + + //!< these arrays are parallel + Gu::AABBTreeBounds mCompoundBounds; //!< List of compound world boxes, stores mNbObjects, capacity=mMaxNbObjects + CompoundTree* mCompoundTrees; + + PxU64 mContextID; + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp new file mode 100644 index 0000000..b030bae --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqFactory.cpp @@ -0,0 +1,39 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "SqFactory.h" +#include "SqCompoundPruner.h" + +using namespace physx; +using namespace Sq; + +CompoundPruner* physx::Sq::createCompoundPruner(PxU64 contextID) +{ + return PX_NEW(BVHCompoundPruner)(contextID); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp new file mode 100644 index 0000000..4f34cb0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqManager.cpp @@ -0,0 +1,577 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// PT: SQ-API LEVEL 2 (Level 1 = SqPruner.h) +// PT: this file is part of a "high-level" set of files within Sq. The SqPruner API doesn't rely on them. +// PT: this should really be at Np level but moving it to Sq allows us to share it. + +#include "SqManager.h" +#include "GuSqInternal.h" +#include "GuBounds.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +PrunerExt::PrunerExt() : mPruner(NULL), mDirtyList("SQmDirtyList"), mDirtyStatic(false) +{ +} + +PrunerExt::~PrunerExt() +{ + PX_DELETE(mPruner); +} + +void PrunerExt::init(Pruner* pruner) +{ + mPruner = pruner; +} + +void PrunerExt::preallocate(PxU32 nbShapes) +{ +// if(nbShapes > mDirtyMap.size()) +// mDirtyMap.resize(nbShapes); + + if(mPruner) + mPruner->preallocate(nbShapes); +} + +void PrunerExt::flushMemory() +{ + if(!mDirtyList.size()) + mDirtyList.reset(); + + // PT: TODO: flush bitmap here + + // PT: TODO: flush pruner here? +} + +void PrunerExt::addToDirtyList(PrunerHandle handle, bool dynamic, const PxTransform& transform) +{ + if(mPruner) + mPruner->setTransform(handle, transform); + + PxBitMap& dirtyMap = mDirtyMap; + { + if(dirtyMap.size() <= handle) + { + PxU32 size = PxMax(dirtyMap.size()*2, 1024); + const PxU32 minSize = handle+1; + if(minSize>size) + size = minSize*2; + dirtyMap.resize(size); + PX_ASSERT(handlegetPayloadData(handle, &ppd); + + computeBounds(*ppd.mBounds, adapter.getGeometry(pp), *ppd.mTransform, 0.0f, inflation); + } + // PT: batch update happens after the loop instead of once per loop iteration + mPruner->updateObjects(prunerHandles, numDirtyList); + mDirtyList.clear(); + + const bool ret = mDirtyStatic; + mDirtyStatic = false; + return ret; +} + +// PT: TODO: re-inline this +/*void PrunerExt::growDirtyList(PrunerHandle handle) +{ + // pruners must either provide indices in order or reuse existing indices, so this 'if' is enough to ensure we have space for the new handle + // PT: TODO: fix this. There is just no need for any of it. The pruning pool itself could support the feature for free, similar to what we do + // in MBP. There would be no need for the bitmap or the dirty list array. However doing this through the virtual interface would be clumsy, + // adding the cost of virtual calls for very cheap & simple operations. It would be a lot easier to drop it and go back to what we had before. + + PxBitMap& dirtyMap = mDirtyMap; + if(dirtyMap.size() <= handle) + dirtyMap.resize(PxMax(dirtyMap.size() * 2, 1024)); + PX_ASSERT(handle mDirtyList.size()) +// mDirtyList.reserve(nbShapes); + + if(mPruner) + mPruner->preallocate(nbShapes); +} + +void CompoundPrunerExt::flushMemory() +{ + if(!mDirtyList.size()) + mDirtyList.clear(); +} + +void CompoundPrunerExt::flushShapes(const Adapter& adapter, float inflation) +{ + const PxU32 numDirtyList = mDirtyList.size(); + if(!numDirtyList) + return; + + const CompoundPair* const compoundPairs = mDirtyList.getEntries(); + + for(PxU32 i=0; igetPayloadData(handle, compoundId, &ppd); + + computeBounds(*ppd.mBounds, adapter.getGeometry(pp), *ppd.mTransform, 0.0f, inflation); + + // A.B. not very effective, we might do better here + mPruner->updateObjectAfterManualBoundsUpdates(compoundId, handle); + } + + mDirtyList.clear(); +} + +void CompoundPrunerExt::addToDirtyList(PrunerCompoundId compoundId, PrunerHandle handle, const PxTransform& transform) +{ + if(mPruner) + mPruner->setTransform(handle, compoundId, transform); + + mDirtyList.insert(CompoundPair(compoundId, handle)); +} + +void CompoundPrunerExt::removeFromDirtyList(PrunerCompoundId compoundId, PrunerHandle handle) +{ + mDirtyList.erase(CompoundPair(compoundId, handle)); +} + +/////////////////////////////////////////////////////////////////////////////// + +#include "SqFactory.h" +#include "common/PxProfileZone.h" +#include "common/PxRenderBuffer.h" +#include "GuBVH.h" +#include "foundation/PxAlloca.h" +#include "PxSceneDesc.h" // PT: for PxSceneLimits TODO: remove + +namespace +{ + enum PxScenePrunerIndex + { + PX_SCENE_PRUNER_STATIC = 0, + PX_SCENE_PRUNER_DYNAMIC = 1, + PX_SCENE_COMPOUND_PRUNER = 0xffffffff, + }; +} + +PrunerManager::PrunerManager( PxU64 contextID, Pruner* staticPruner, Pruner* dynamicPruner, + PxU32 dynamicTreeRebuildRateHint, float inflation, + const PxSceneLimits& limits, const Adapter& adapter) : + mAdapter (adapter), + mContextID (contextID), + mStaticTimestamp (0), + mInflation (inflation) +{ + mPrunerExt[PruningIndex::eSTATIC].init(staticPruner); + mPrunerExt[PruningIndex::eDYNAMIC].init(dynamicPruner); + + setDynamicTreeRebuildRateHint(dynamicTreeRebuildRateHint); + + mCompoundPrunerExt.mPruner = createCompoundPruner(contextID); + + preallocate(PruningIndex::eSTATIC, limits.maxNbStaticShapes); + preallocate(PruningIndex::eDYNAMIC, limits.maxNbDynamicShapes); + preallocate(PxU32(PX_SCENE_COMPOUND_PRUNER), 32); + + mPrunerNeedsUpdating = false; +} + +PrunerManager::~PrunerManager() +{ +} + +void PrunerManager::preallocate(PxU32 prunerIndex, PxU32 nbShapes) +{ + if(prunerIndex==PruningIndex::eSTATIC) + mPrunerExt[PruningIndex::eSTATIC].preallocate(nbShapes); + else if(prunerIndex==PruningIndex::eDYNAMIC) + mPrunerExt[PruningIndex::eDYNAMIC].preallocate(nbShapes); + else if(prunerIndex==PX_SCENE_COMPOUND_PRUNER) + mCompoundPrunerExt.preallocate(nbShapes); +} + +void PrunerManager::flushMemory() +{ + for(PxU32 i=0;iaddObjects(&handle, &bounds, &payload, &transform, 1, hasPruningStructure); + //mPrunerExt[index].growDirtyList(handle); + } + else + { + PX_ASSERT(mCompoundPrunerExt.pruner()); + mCompoundPrunerExt.pruner()->addObject(compoundId, handle, bounds, payload, transform); + } + + return createPrunerData(index, handle); +} + +void PrunerManager::removePrunerShape(PrunerCompoundId compoundId, PrunerData data, PrunerPayloadRemovalCallback* removalCallback) +{ + mPrunerNeedsUpdating = true; + const PxU32 index = getPrunerIndex(data); + const PrunerHandle handle = getPrunerHandle(data); + + if(!index) + invalidateStaticTimestamp(); + + if(compoundId == INVALID_COMPOUND_ID) + { + PX_ASSERT(mPrunerExt[index].pruner()); + + mPrunerExt[index].removeFromDirtyList(handle); + mPrunerExt[index].pruner()->removeObjects(&handle, 1, removalCallback); + } + else + { + mCompoundPrunerExt.removeFromDirtyList(compoundId, handle); + mCompoundPrunerExt.pruner()->removeObject(compoundId, handle, removalCallback); + } +} + +void PrunerManager::markForUpdate(PrunerCompoundId compoundId, PrunerData data, const PxTransform& transform) +{ + mPrunerNeedsUpdating = true; + const PxU32 index = getPrunerIndex(data); + const PrunerHandle handle = getPrunerHandle(data); + + if(!index) + invalidateStaticTimestamp(); + + if(compoundId == INVALID_COMPOUND_ID) + // PT: TODO: at this point do we still need a dirty list? we could just update the bounds directly? + mPrunerExt[index].addToDirtyList(handle, index!=0, transform); + else + mCompoundPrunerExt.addToDirtyList(compoundId, handle, transform); +} + +void PrunerManager::setDynamicTreeRebuildRateHint(PxU32 rebuildRateHint) +{ + mRebuildRateHint = rebuildRateHint; + + for(PxU32 i=0;iisDynamic()) + static_cast(pruner)->setRebuildRateHint(rebuildRateHint); + } +} + +void PrunerManager::afterSync(bool buildStep, bool commit) +{ + PX_PROFILE_ZONE("Sim.sceneQueryBuildStep", mContextID); + + if(!buildStep && !commit) + { + mPrunerNeedsUpdating = true; + return; + } + + // flush user modified objects + flushShapes(); + + for(PxU32 i=0; iisDynamic()) + static_cast(pruner)->buildStep(true); + + if(commit) + pruner->commit(); + } + } + + mPrunerNeedsUpdating = !commit; +} + +void PrunerManager::flushShapes() +{ + PX_PROFILE_ZONE("SceneQuery.flushShapes", mContextID); + + // must already have acquired writer lock here + + const float inflation = 1.0f + mInflation; + + bool mustInvalidateStaticTimestamp = false; + for(PxU32 i=0; icommit(); + + PxMemoryBarrier(); + mPrunerNeedsUpdating = false; + } + mSQLock.unlock(); + } +} + +void PrunerManager::forceRebuildDynamicTree(PxU32 prunerIndex) +{ + PX_PROFILE_ZONE("SceneQuery.forceDynamicTreeRebuild", mContextID); + + PxMutex::ScopedLock lock(mSQLock); + Pruner* pruner = mPrunerExt[prunerIndex].pruner(); + if(pruner && pruner->isDynamic()) + { + static_cast(pruner)->purge(); + static_cast(pruner)->commit(); + } +} + +void* PrunerManager::prepareSceneQueriesUpdate(PruningIndex::Enum index) +{ + bool retVal = false; + Pruner* pruner = mPrunerExt[index].pruner(); + if(pruner && pruner->isDynamic()) + retVal = static_cast(pruner)->prepareBuild(); + + return retVal ? pruner : NULL; +} + +void PrunerManager::sceneQueryBuildStep(void* handle) +{ + PX_PROFILE_ZONE("SceneQuery.sceneQueryBuildStep", mContextID); + + Pruner* pruner = reinterpret_cast(handle); + if(pruner && pruner->isDynamic()) + { + const bool buildFinished = static_cast(pruner)->buildStep(false); + if(buildFinished) + mPrunerNeedsUpdating = true; + } +} + +// PT: TODO: revisit this. Perhaps it should be the user's responsibility to call the pruner's +// visualize functions directly, when & how he wants. +void PrunerManager::visualize(PxU32 prunerIndex, PxRenderOutput& out) const +{ + if(prunerIndex==PX_SCENE_PRUNER_STATIC) + { + if(getPruner(PruningIndex::eSTATIC)) + getPruner(PruningIndex::eSTATIC)->visualize(out, SQ_DEBUG_VIZ_STATIC_COLOR, SQ_DEBUG_VIZ_STATIC_COLOR2); + } + else if(prunerIndex==PX_SCENE_PRUNER_DYNAMIC) + { + if(getPruner(PruningIndex::eDYNAMIC)) + getPruner(PruningIndex::eDYNAMIC)->visualize(out, SQ_DEBUG_VIZ_DYNAMIC_COLOR, SQ_DEBUG_VIZ_DYNAMIC_COLOR2); + } + else if(prunerIndex==PX_SCENE_COMPOUND_PRUNER) + { + const CompoundPruner* cp = mCompoundPrunerExt.pruner(); + if(cp) + cp->visualizeEx(out, SQ_DEBUG_VIZ_COMPOUND_COLOR, true, true); + } +} + +void PrunerManager::shiftOrigin(const PxVec3& shift) +{ + for(PxU32 i=0; ishiftOrigin(shift); + + mCompoundPrunerExt.pruner()->shiftOrigin(shift); +} + +void PrunerManager::addCompoundShape(const PxBVH& pxbvh, PrunerCompoundId compoundId, const PxTransform& compoundTransform, PrunerData* prunerData, const PrunerPayload* payloads, const PxTransform* transforms, bool isDynamic) +{ + const BVH& bvh = static_cast(pxbvh); + const PxU32 nbShapes = bvh.Gu::BVH::getNbBounds(); + + PX_ALLOCA(res, PrunerHandle, nbShapes); + + PX_ASSERT(mCompoundPrunerExt.mPruner); + mCompoundPrunerExt.mPruner->addCompound(res, bvh, compoundId, compoundTransform, isDynamic, payloads, transforms); + const PxU32 index = PxU32(isDynamic); + if(!index) + invalidateStaticTimestamp(); + + for(PxU32 i = 0; i < nbShapes; i++) + prunerData[i] = createPrunerData(index, res[i]); +} + +void PrunerManager::updateCompoundActor(PrunerCompoundId compoundId, const PxTransform& compoundTransform) +{ + PX_ASSERT(mCompoundPrunerExt.mPruner); + const bool isDynamic = mCompoundPrunerExt.mPruner->updateCompound(compoundId, compoundTransform); + if(!isDynamic) + invalidateStaticTimestamp(); +} + +void PrunerManager::removeCompoundActor(PrunerCompoundId compoundId, PrunerPayloadRemovalCallback* removalCallback) +{ + PX_ASSERT(mCompoundPrunerExt.mPruner); + const bool isDynamic = mCompoundPrunerExt.mPruner->removeCompound(compoundId, removalCallback); + if(!isDynamic) + invalidateStaticTimestamp(); +} + +void PrunerManager::sync(const PrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) +{ + if(!count) + return; + + Pruner* dynamicPruner = getPruner(PruningIndex::eDYNAMIC); + if(!dynamicPruner) + return; + + PxU32 startIndex = 0; + PxU32 numIndices = count; + + // if shape sim map is not empty, parse the indices and skip update for the dirty one + if(ignoredIndices.count()) + { + // PT: I think this codepath was used with SCB / buffered changes, but it's not needed anymore + numIndices = 0; + + for(PxU32 i=0; iupdateObjects(handles + startIndex, numIndices, mInflation, boundsIndices + startIndex, bounds, transforms); + numIndices = 0; + startIndex = i + 1; + } + else + numIndices++; + } + // PT: we fallback to the next line on purpose - no "else" + } + + dynamicPruner->updateObjects(handles + startIndex, numIndices, mInflation, boundsIndices + startIndex, bounds, transforms); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp new file mode 100644 index 0000000..c88c658 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/scenequery/src/SqQuery.cpp @@ -0,0 +1,1052 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +// PT: SQ-API LEVEL 3 (Level 1 = SqPruner.h, Level 2 = SqManager/SqPrunerData) +// PT: this file is part of a "high-level" set of files within Sq. The SqPruner API doesn't rely on them. +// PT: this should really be at Np level but moving it to Sq allows us to share it. + +#include "SqQuery.h" + +using namespace physx; +using namespace Sq; + +#include "common/PxProfileZone.h" +#include "foundation/PxFPU.h" +#include "GuBounds.h" +#include "GuIntersectionRayBox.h" +#include "GuIntersectionRay.h" +#include "geometry/PxGeometryQuery.h" +#include "geometry/PxSphereGeometry.h" +#include "geometry/PxBoxGeometry.h" +#include "geometry/PxCapsuleGeometry.h" +#include "geometry/PxConvexMeshGeometry.h" +#include "geometry/PxTriangleMeshGeometry.h" + +#include "PxQueryFiltering.h" + +using namespace physx; +using namespace Sq; +using namespace Gu; + +// compiling for a windows target with clang will completely fail due to errors +// 1. physx/include/foundation/PxFlags.h(81,29): note: candidate constructor not viable: no known conversion from 'const __restrict physx::PxHitFlags' (aka 'const __restrict PxFlags') to 'physx::PxHitFlag::Enum' for 1st argument +// PX_CUDA_CALLABLE PX_INLINE PxFlags(enumtype e); +#if PX_WINDOWS_FAMILY && !PX_CLANG + #define PX_MSVC_RESTRICT PX_RESTRICT +#else + #define PX_MSVC_RESTRICT +#endif + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE void copy(PxRaycastHit* PX_RESTRICT dest, const PxRaycastHit* PX_RESTRICT src) +{ + dest->faceIndex = src->faceIndex; + dest->flags = src->flags; + dest->position = src->position; + dest->normal = src->normal; + dest->distance = src->distance; + dest->u = src->u; + dest->v = src->v; + dest->actor = src->actor; + dest->shape = src->shape; +} + +static PX_FORCE_INLINE void copy(PxSweepHit* PX_RESTRICT dest, const PxSweepHit* PX_RESTRICT src) +{ + dest->faceIndex = src->faceIndex; + dest->flags = src->flags; + dest->position = src->position; + dest->normal = src->normal; + dest->distance = src->distance; + dest->actor = src->actor; + dest->shape = src->shape; +} + +static PX_FORCE_INLINE void copy(PxOverlapHit* PX_RESTRICT dest, const PxOverlapHit* PX_RESTRICT src) +{ + dest->faceIndex = src->faceIndex; + dest->actor = src->actor; + dest->shape = src->shape; +} + +// these partial template specializations are used to generalize the query code to be reused for all permutations of +// hit type=(raycast, overlap, sweep) x query type=(ANY, SINGLE, MULTIPLE) +template struct HitTypeSupport { enum { IsRaycast = 0, IsSweep = 0, IsOverlap = 0 }; }; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 1, IsSweep = 0, IsOverlap = 0 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit& hit) { return static_cast(hit).distance; } +}; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 0, IsSweep = 1, IsOverlap = 0 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit& hit) { return static_cast(hit).distance; } +}; +template <> struct HitTypeSupport +{ + enum { IsRaycast = 0, IsSweep = 0, IsOverlap = 1 }; + static PX_FORCE_INLINE PxReal getDistance(const PxQueryHit&) { return -1.0f; } +}; + +#define HITDIST(hit) HitTypeSupport::getDistance(hit) + +template +static PxU32 clipHitsToNewMaxDist(HitType* ppuHits, PxU32 count, PxReal newMaxDist) +{ + PxU32 i=0; + while(i!=count) + { + if(HITDIST(ppuHits[i]) > newMaxDist) + ppuHits[i] = ppuHits[--count]; + else + i++; + } + return count; +} + +namespace physx +{ + namespace Sq + { + struct MultiQueryInput + { + const PxVec3* rayOrigin; // only valid for raycasts + const PxVec3* unitDir; // only valid for raycasts and sweeps + PxReal maxDistance; // only valid for raycasts and sweeps + const PxGeometry* geometry; // only valid for overlaps and sweeps + const PxTransform* pose; // only valid for overlaps and sweeps + PxReal inflation; // only valid for sweeps + + // Raycast constructor + MultiQueryInput(const PxVec3& aRayOrigin, const PxVec3& aUnitDir, PxReal aMaxDist) + { + rayOrigin = &aRayOrigin; + unitDir = &aUnitDir; + maxDistance = aMaxDist; + geometry = NULL; + pose = NULL; + inflation = 0.0f; + } + + // Overlap constructor + MultiQueryInput(const PxGeometry* aGeometry, const PxTransform* aPose) + { + geometry = aGeometry; + pose = aPose; + inflation = 0.0f; + rayOrigin = unitDir = NULL; + } + + // Sweep constructor + MultiQueryInput( + const PxGeometry* aGeometry, const PxTransform* aPose, + const PxVec3& aUnitDir, const PxReal aMaxDist, const PxReal aInflation) + { + rayOrigin = NULL; + maxDistance = aMaxDist; + unitDir = &aUnitDir; + geometry = aGeometry; + pose = aPose; + inflation = aInflation; + } + + PX_FORCE_INLINE const PxVec3& getDir() const { PX_ASSERT(unitDir); return *unitDir; } + PX_FORCE_INLINE const PxVec3& getOrigin() const { PX_ASSERT(rayOrigin); return *rayOrigin; } + }; + + } +} + +// performs a single geometry query for any HitType (PxSweepHit, PxOverlapHit, PxRaycastHit) +template +struct GeomQueryAny +{ + static PX_FORCE_INLINE PxU32 geomHit( + const CachedFuncs& funcs, const MultiQueryInput& input, const Gu::ShapeData& sd, + const PxGeometry& sceneGeom, const PxTransform& pose, PxHitFlags hitFlags, + PxU32 maxHits, HitType* hits, const PxReal shrunkMaxDistance, const PxBounds3* precomputedBounds, + PxQueryThreadContext* context) + { + using namespace Gu; + + const PxGeometry& geom0 = *input.geometry; + const PxTransform& pose0 = *input.pose; + const PxGeometry& geom1 = sceneGeom; + const PxTransform& pose1 = pose; + + // Handle raycasts + if(HitTypeSupport::IsRaycast) + { + // the test for mesh AABB is archived in //sw/physx/dev/apokrovsky/graveyard/sqMeshAABBTest.cpp + // TODO: investigate performance impact (see US12801) + PX_CHECK_AND_RETURN_VAL(input.getDir().isFinite(), "PxScene::raycast(): rayDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(input.getOrigin().isFinite(), "PxScene::raycast(): rayOrigin is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(pose1.isValid(), "PxScene::raycast(): pose is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(shrunkMaxDistance >= 0.0f, "PxScene::raycast(): maxDist is negative.", 0); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(shrunkMaxDistance), "PxScene::raycast(): maxDist is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(PxAbs(input.getDir().magnitudeSquared()-1)<1e-4f, + "PxScene::raycast(): ray direction must be unit vector.", 0); + + // PT: TODO: investigate perf difference + const RaycastFunc func = funcs.mCachedRaycastFuncs[geom1.getType()]; + return func(geom1, pose1, input.getOrigin(), input.getDir(), shrunkMaxDistance, + hitFlags, maxHits, reinterpret_cast(hits), sizeof(PxRaycastHit), context); + } + // Handle sweeps + else if(HitTypeSupport::IsSweep) + { + PX_ASSERT(precomputedBounds != NULL); + // b0 = query shape bounds + // b1 = scene shape bounds + // AP: Here we clip the sweep to bounds with sum of extents. This is needed for GJK stability. + // because sweep is equivalent to a raycast vs a scene shape with inflated bounds. + // This also may (or may not) provide an optimization for meshes because top level of rtree has multiple boxes + // and there is no bounds test for the whole mesh elsewhere + PxBounds3 b0 = *precomputedBounds, b1; + // compute the scene geometry bounds + // PT: TODO: avoid recomputing the bounds here + Gu::computeBounds(b1, sceneGeom, pose, 0.0f, 1.0f); + const PxVec3 combExt = (b0.getExtents() + b1.getExtents())*1.01f; + + PxF32 tnear, tfar; + if(!intersectRayAABB2(-combExt, combExt, b0.getCenter() - b1.getCenter(), input.getDir(), shrunkMaxDistance, tnear, tfar)) // returns (tneartfar) // this second test is needed because shrunkMaxDistance can be 0 for 0 length sweep + return 0; + PX_ASSERT(input.getDir().isNormalized()); + // tfar is now the t where the ray exits the AABB. input.getDir() is normalized + + const PxVec3& unitDir = input.getDir(); + PxSweepHit& sweepHit = reinterpret_cast(hits[0]); + + // if we don't start inside the AABB box, offset the start pos, because of precision issues with large maxDist + const bool offsetPos = (tnear > GU_RAY_SURFACE_OFFSET); + const PxReal offset = offsetPos ? (tnear - GU_RAY_SURFACE_OFFSET) : 0.0f; + const PxVec3 offsetVec(offsetPos ? (unitDir*offset) : PxVec3(0.0f)); + // we move the geometry we sweep against, so that we avoid the Gu::Capsule/Box recomputation + const PxTransform pose1Offset(pose1.p - offsetVec, pose1.q); + + const PxReal distance = PxMin(tfar, shrunkMaxDistance) - offset; + const PxReal inflation = input.inflation; + PX_CHECK_AND_RETURN_VAL(pose0.isValid(), "PxScene::sweep(): pose0 is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(pose1Offset.isValid(), "PxScene::sweep(): pose1 is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(unitDir.isFinite(), "PxScene::sweep(): unitDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(PxIsFinite(distance), "PxScene::sweep(): distance is not valid.", 0); + PX_CHECK_AND_RETURN_VAL((distance >= 0.0f && !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP)) || distance > 0.0f, + "PxScene::sweep(): sweep distance must be >=0 or >0 with eASSUME_NO_INITIAL_OVERLAP.", 0); + + PxU32 retVal = 0; + const GeomSweepFuncs& sf = funcs.mCachedSweepFuncs; + switch(geom0.getType()) + { + case PxGeometryType::eSPHERE: + { + const PxSphereGeometry& sphereGeom = static_cast(geom0); + const PxCapsuleGeometry capsuleGeom(sphereGeom.radius, 0.0f); + const Capsule worldCapsule(pose0.p, pose0.p, sphereGeom.radius); // AP: precompute? + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, capsuleGeom, pose0, worldCapsule, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eCAPSULE: + { + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepCapsuleFunc func = precise ? sf.preciseCapsuleMap[geom1.getType()] : sf.capsuleMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, static_cast(geom0), pose0, sd.getGuCapsule(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eBOX: + { + const bool precise = hitFlags & PxHitFlag::ePRECISE_SWEEP; + const SweepBoxFunc func = precise ? sf.preciseBoxMap[geom1.getType()] : sf.boxMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, static_cast(geom0), pose0, sd.getGuBox(), unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + const PxConvexMeshGeometry& convexGeom = static_cast(geom0); + const SweepConvexFunc func = sf.convexMap[geom1.getType()]; + retVal = PxU32(func(geom1, pose1Offset, convexGeom, pose0, unitDir, distance, sweepHit, hitFlags, inflation, context)); + } + break; + default: + outputError(__LINE__, "PxScene::sweep(): first geometry object parameter must be sphere, capsule, box or convex geometry."); + break; + } + if (retVal) + { + // we need to offset the distance back + sweepHit.distance += offset; + // we need to offset the hit position back as we moved the geometry we sweep against + sweepHit.position += offsetVec; + } + return retVal; + } + // Handle overlaps + else if(HitTypeSupport::IsOverlap) + { + const GeomOverlapTable* overlapFuncs = funcs.mCachedOverlapFuncs; + return PxU32(Gu::overlap(geom0, pose0, geom1, pose1, overlapFuncs, context)); + } + else + { + PX_ALWAYS_ASSERT_MESSAGE("Unexpected template expansion in GeomQueryAny::geomHit"); + return 0; + } + } +}; + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE bool applyFilterEquation(const QueryAdapter& adapter, const PrunerPayload& payload, const PxFilterData& queryFd) +{ + // if the filterData field is non-zero, and the bitwise-AND value of filterData AND the shape's + // queryFilterData is zero, the shape is skipped. + if(queryFd.word0 | queryFd.word1 | queryFd.word2 | queryFd.word3) + { + // PT: TODO: revisit this, there's an obvious LHS here otherwise + // We could maybe make this more flexible and let the user do the filtering +// const PxFilterData& objFd = adapter.getFilterData(payload); + PxFilterData objFd; + adapter.getFilterData(payload, objFd); + + const PxU32 keep = (queryFd.word0 & objFd.word0) | (queryFd.word1 & objFd.word1) | (queryFd.word2 & objFd.word2) | (queryFd.word3 & objFd.word3); + if(!keep) + return false; + } + return true; +} + +static PX_FORCE_INLINE bool applyAllPreFiltersSQ( + const QueryAdapter& adapter, const PrunerPayload& payload, const PxActorShape& as, PxQueryHitType::Enum& shapeHitType, const PxQueryFlags& inFilterFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + PxHitFlags& queryFlags/*, PxU32 maxNbTouches*/) +{ + if(!(filterData.flags & PxQueryFlag::eBATCH_QUERY_LEGACY_BEHAVIOUR) && !applyFilterEquation(adapter, payload, filterData.data)) + return false; + + if((inFilterFlags & PxQueryFlag::ePREFILTER) && (filterCall)) + { + PxHitFlags outQueryFlags = queryFlags; + + if(filterCall) + shapeHitType = filterCall->preFilter(filterData.data, as.shape, as.actor, outQueryFlags); + + // AP: at this point the callback might return eTOUCH but the touch buffer can be empty, the hit will be discarded + //PX_CHECK_MSG(hitType == PxQueryHitType::eTOUCH ? maxNbTouches > 0 : true, + // "SceneQuery: preFilter returned eTOUCH but empty touch buffer was provided, hit discarded."); + + queryFlags = (queryFlags & ~PxHitFlag::eMODIFIABLE_FLAGS) | (outQueryFlags & PxHitFlag::eMODIFIABLE_FLAGS); + + if(shapeHitType == PxQueryHitType::eNONE) + return false; + } + // test passed, continue to return as; + return true; +} + +static PX_NOINLINE void computeCompoundShapeTransform(PxTransform* PX_RESTRICT transform, const PxTransform* PX_RESTRICT compoundPose, const PxTransform* PX_RESTRICT transforms, PxU32 primIndex) +{ + *transform = (*compoundPose) * transforms[primIndex]; +} + +// struct to access protected data members in the public PxHitCallback API +template +struct MultiQueryCallback : public PrunerRaycastCallback, public PrunerOverlapCallback, public CompoundPrunerRaycastCallback, public CompoundPrunerOverlapCallback +{ + const SceneQueries& mScene; + const MultiQueryInput& mInput; + PxHitCallback& mHitCall; + const PxHitFlags mHitFlags; + const PxQueryFilterData& mFilterData; + PxQueryFilterCallback* mFilterCall; + PxReal mShrunkDistance; + const PxHitFlags mMeshAnyHitFlags; + bool mReportTouchesAgain; + bool mFarBlockFound; // this is to prevent repeated searches for far block + const bool mNoBlock; + const bool mAnyHit; + + // The reason we need these bounds is because we need to know combined(inflated shape) bounds to clip the sweep path + // to be tolerable by GJK precision issues. This test is done for (queryShape vs touchedShapes) + // So it makes sense to cache the bounds for sweep query shape, otherwise we'd have to recompute them every time + // Currently only used for sweeps. + const PxBounds3* mQueryShapeBounds; + const ShapeData* mShapeData; + PxTransform mCompoundShapeTransform; + + MultiQueryCallback( + const SceneQueries& scene, const MultiQueryInput& input, bool anyHit, PxHitCallback& hitCall, PxHitFlags hitFlags, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, PxReal shrunkDistance) : + mScene (scene), + mInput (input), + mHitCall (hitCall), + mHitFlags (hitFlags), + mFilterData (filterData), + mFilterCall (filterCall), + mShrunkDistance (shrunkDistance), + mMeshAnyHitFlags ((hitFlags.isSet(PxHitFlag::eMESH_ANY) || anyHit) ? PxHitFlag::eMESH_ANY : PxHitFlag::Enum(0)), + mReportTouchesAgain (true), + mFarBlockFound (filterData.flags & PxQueryFlag::eNO_BLOCK), + mNoBlock (filterData.flags & PxQueryFlag::eNO_BLOCK), + mAnyHit (anyHit), + mQueryShapeBounds (NULL), + mShapeData (NULL) + { + } + + bool processTouchHit(const HitType& hit, PxReal& aDist) PX_MSVC_RESTRICT + { + // -------------------------- handle eTOUCH hits --------------------------------- + // for qType=multiple, store the hit. For other qTypes ignore it. + // <= is important for initially overlapping sweeps + #if PX_CHECKED + if(mHitCall.maxNbTouches == 0 && !mFilterData.flags.isSet(PxQueryFlag::eRESERVED)) + // issue a warning if eTOUCH was returned by the prefilter, we have 0 touch buffer and not a batch query + // not doing for BQ because the touches buffer can be overflown and thats ok by spec + // eRESERVED to avoid a warning from nested callback (closest blocking hit recursive search) + outputError(__LINE__, "User filter returned PxQueryHitType::eTOUCH but the touches buffer was empty. Hit was discarded."); + #endif + + if(mHitCall.maxNbTouches && mReportTouchesAgain && HITDIST(hit) <= mShrunkDistance) + { + // Buffer full: need to find the closest blocking hit, clip touch hits and flush the buffer + if(mHitCall.nbTouches == mHitCall.maxNbTouches) + { + // issue a second nested query just looking for the closest blocking hit + // could do better perf-wise by saving traversal state (start looking for blocking from this point) + // but this is not a perf critical case because users can provide a bigger buffer + // that covers non-degenerate cases + // far block search doesn't apply to overlaps because overlaps don't work with blocking hits + if(HitTypeSupport::IsOverlap == 0) + { + // AP: the use of eRESERVED is a bit tricky, see other comments containing #LABEL1 + PxQueryFilterData fd1 = mFilterData; fd1.flags |= PxQueryFlag::eRESERVED; + PxHitBuffer buf1; // create a temp callback buffer for a single blocking hit + if(!mFarBlockFound && mHitCall.maxNbTouches > 0 && mScene.SceneQueries::multiQuery(mInput, buf1, mHitFlags, NULL, fd1, mFilterCall)) + { + mHitCall.block = buf1.block; + mHitCall.hasBlock = true; + mHitCall.nbTouches = + clipHitsToNewMaxDist(mHitCall.touches, mHitCall.nbTouches, HITDIST(buf1.block)); + mShrunkDistance = HITDIST(buf1.block); + aDist = mShrunkDistance; + } + mFarBlockFound = true; + } + if(mHitCall.nbTouches == mHitCall.maxNbTouches) + { + mReportTouchesAgain = mHitCall.processTouches(mHitCall.touches, mHitCall.nbTouches); + if(!mReportTouchesAgain) + return false; // optimization - buffer is full + else + mHitCall.nbTouches = 0; // reset nbTouches so we can continue accumulating again + } + } + + //if(hitCall.nbTouches < hitCall.maxNbTouches) // can be true if maxNbTouches is 0 + mHitCall.touches[mHitCall.nbTouches++] = hit; + } // if(hitCall.maxNbTouches && reportTouchesAgain && HITDIST(hit) <= shrunkDistance) + + return true; + } + + template // is this call coming as a callback from the pruner or a single item cached callback? + bool _invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) PX_MSVC_RESTRICT + { + PX_ASSERT(payloads); + const PrunerPayload& payload = payloads[primIndex]; + const QueryAdapter& adapter = static_cast(mScene.mSQManager.getAdapter()); + + PxActorShape actorShape; + adapter.getActorShape(payload, actorShape); + + const PxQueryFlags filterFlags = mFilterData.flags; + + // for no filter callback, default to eTOUCH for MULTIPLE, eBLOCK otherwise + // also always treat as eBLOCK if currently tested shape is cached + // Using eRESERVED flag as a special condition to default to eTOUCH hits while only looking for a single blocking hit + // from a nested query (see other comments containing #LABEL1) + PxQueryHitType::Enum shapeHitType = + ((mHitCall.maxNbTouches || (mFilterData.flags & PxQueryFlag::eRESERVED)) && !isCached) + ? PxQueryHitType::eTOUCH + : PxQueryHitType::eBLOCK; + + // apply pre-filter + PxHitFlags filteredHitFlags = mHitFlags; + if(!isCached) // don't run filters on single item cache + { + if(!applyAllPreFiltersSQ(adapter, payload, actorShape, shapeHitType/*in&out*/, filterFlags, mFilterData, mFilterCall, filteredHitFlags/*, mHitCall.maxNbTouches*/)) + return true; // skip this shape from reporting if prefilter said to do so + +// if(shapeHitType == PxQueryHitType::eNONE) +// return true; + } + + const PxGeometry& shapeGeom = adapter.getGeometry(payload); + + PX_ASSERT(transforms); + const PxTransform* shapeTransform; + if(!compoundPose) + { + shapeTransform = transforms + primIndex; + } + else + { + computeCompoundShapeTransform(&mCompoundShapeTransform, compoundPose, transforms, primIndex); + shapeTransform = &mCompoundShapeTransform; + } + + const PxU32 tempCount = 1; + HitType tempBuf[tempCount]; + + // Here we decide whether to use the user provided buffer in place or a local stack buffer + // see if we have more room left in the callback results buffer than in the parent stack buffer + // if so get subHits in-place in the hit buffer instead of the parent stack buffer + // nbTouches is the number of accumulated touch hits so far + // maxNbTouches is the size of the user buffer + PxU32 maxSubHits1; + HitType* subHits1; + if(mHitCall.nbTouches >= mHitCall.maxNbTouches) + // if there's no room left in the user buffer, use a stack buffer + { + // tried using 64 here - causes check stack code to get generated on xbox, perhaps because of guard page + // need this buffer in case the input buffer is full but we still want to correctly merge results from later hits + maxSubHits1 = tempCount; + subHits1 = reinterpret_cast(tempBuf); + } + else + { + maxSubHits1 = mHitCall.maxNbTouches - mHitCall.nbTouches; // how much room is left in the user buffer + subHits1 = mHitCall.touches + mHitCall.nbTouches; // pointer to the first free hit in the user buffer + } + + // call the geometry specific intersection template + const PxU32 nbSubHits = GeomQueryAny::geomHit( + mScene.mCachedFuncs, mInput, *mShapeData, shapeGeom, + *shapeTransform, filteredHitFlags | mMeshAnyHitFlags, + maxSubHits1, subHits1, mShrunkDistance, mQueryShapeBounds, &mHitCall); + + // ------------------------- iterate over geometry subhits ----------------------------------- + for (PxU32 iSubHit = 0; iSubHit < nbSubHits; iSubHit++) + { + HitType& hit = subHits1[iSubHit]; + hit.actor = actorShape.actor; + hit.shape = actorShape.shape; + + // some additional processing only for sweep hits with initial overlap + if(HitTypeSupport::IsSweep && HITDIST(hit) == 0.0f && !(filteredHitFlags & PxHitFlag::eMTD)) + // PT: necessary as some leaf routines are called with reversed params, thus writing +unitDir there. + // AP: apparently still necessary to also do in Gu because Gu can be used standalone (without SQ) + reinterpret_cast(hit).normal = -mInput.getDir(); + + // start out with hitType for this cached shape set to a pre-filtered hit type + PxQueryHitType::Enum hitType = shapeHitType; + + // run the post-filter if specified in filterFlags and filterCall is non-NULL + if(!isCached && mFilterCall && (filterFlags & PxQueryFlag::ePOSTFILTER)) + { + //if(mFilterCall) + hitType = mFilterCall->postFilter(mFilterData.data, hit, hit.shape, hit.actor); + } + + // early out on any hit if eANY_HIT was specified, regardless of hit type + if(mAnyHit && hitType != PxQueryHitType::eNONE) + { + // block or touch qualifies for qType=ANY type hit => return it as blocking according to spec. Ignore eNONE. + //mHitCall.block = hit; + copy(&mHitCall.block, &hit); + mHitCall.hasBlock = true; + return false; // found a hit for ANY qType, can early exit now + } + + if(mNoBlock) + hitType = PxQueryHitType::eTOUCH; + + PX_WARN_ONCE_IF(HitTypeSupport::IsOverlap && hitType == PxQueryHitType::eBLOCK, + "eBLOCK returned from user filter for overlap() query. This may cause undesired behavior. " + "Consider using PxQueryFlag::eNO_BLOCK for overlap queries."); + + if(hitType == PxQueryHitType::eTOUCH) + { + if(!processTouchHit(hit, aDist)) + return false; + } // if(hitType == PxQueryHitType::eTOUCH) + else if(hitType == PxQueryHitType::eBLOCK) + { + // -------------------------- handle eBLOCK hits ---------------------------------- + // only eBLOCK qualifies as a closest hit candidate => compare against best distance and store + // <= is needed for eTOUCH hits to be recorded correctly vs same eBLOCK distance for overlaps + if(HITDIST(hit) <= mShrunkDistance) + { + if(HitTypeSupport::IsOverlap == 0) + { + mShrunkDistance = HITDIST(hit); + aDist = mShrunkDistance; + } + //mHitCall.block = hit; + copy(&mHitCall.block, &hit); + mHitCall.hasBlock = true; + } + } // if(hitType == eBLOCK) + else { + PX_ASSERT(hitType == PxQueryHitType::eNONE); + } + } // for iSubHit + return true; + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + return _invoke(aDist, primIndex, payloads, transforms, NULL); + } + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms) + { + float unused = 0.0f; + return _invoke(unused, primIndex, payloads, transforms, NULL); + } + + virtual bool invoke(PxReal& aDist, PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) + { + return _invoke(aDist, primIndex, payloads, transforms, compoundPose); + } + + virtual bool invoke(PxU32 primIndex, const PrunerPayload* payloads, const PxTransform* transforms, const PxTransform* compoundPose) + { + float unused = 0.0f; + return _invoke(unused, primIndex, payloads, transforms, compoundPose); + } + +private: + MultiQueryCallback& operator=(const MultiQueryCallback&); +}; + +//======================================================================================================================== +#if PX_SUPPORT_PVD +template +struct CapturePvdOnReturn : public PxHitCallback +{ + // copy the arguments of multiQuery into a struct, this is strictly for PVD recording + const SceneQueries* mSQ; + const MultiQueryInput& mInput; + const PxQueryFilterData& mFilterData; + PxArray mAllHits; + PxHitCallback& mParentCallback; + + CapturePvdOnReturn( + const SceneQueries* sq, const MultiQueryInput& input, + const PxQueryFilterData& filterData, + PxHitCallback& parentCallback) : + PxHitCallback (parentCallback.touches, parentCallback.maxNbTouches), + mSQ (sq), + mInput (input), + mFilterData (filterData), + mParentCallback (parentCallback) + {} + + virtual PxAgain processTouches(const HitType* hits, PxU32 nbHits) + { + const PxAgain again = mParentCallback.processTouches(hits, nbHits); + for(PxU32 i=0; imPVD; + if(!pvd || !pvd->transmitSceneQueries()) + return; + + if(mParentCallback.nbTouches) + { + for(PxU32 i = 0; i < mParentCallback.nbTouches; i++) + mAllHits.pushBack(mParentCallback.touches[i]); + } + + if(mParentCallback.hasBlock) + mAllHits.pushBack(mParentCallback.block); + + // PT: TODO: why do we need reinterpret_casts below? + if(HitTypeSupport::IsRaycast) + pvd->raycast(mInput.getOrigin(), mInput.getDir(), mInput.maxDistance, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData, this->maxNbTouches!=0); + else if(HitTypeSupport::IsOverlap) + pvd->overlap(*mInput.geometry, *mInput.pose, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData); + else if(HitTypeSupport::IsSweep) + pvd->sweep (*mInput.geometry, *mInput.pose, mInput.getDir(), mInput.maxDistance, reinterpret_cast(mAllHits.begin()), mAllHits.size(), mFilterData, this->maxNbTouches!=0); + } + +private: + CapturePvdOnReturn& operator=(const CapturePvdOnReturn&); +}; +#endif // PX_SUPPORT_PVD + +//======================================================================================================================== +template +struct IssueCallbacksOnReturn +{ + PxHitCallback& hits; + bool again; // query was stopped by previous processTouches. This means that nbTouches is still non-zero + // but we don't need to issue processTouches again + PX_FORCE_INLINE IssueCallbacksOnReturn(PxHitCallback& aHits) : hits(aHits) + { + again = true; + } + + ~IssueCallbacksOnReturn() + { + if(again) + // only issue processTouches if query wasn't stopped + // this is because nbTouches doesn't get reset to 0 in this case (according to spec) + // and the touches in touches array were already processed by the callback + { + if(hits.hasBlock && hits.nbTouches) + hits.nbTouches = clipHitsToNewMaxDist(hits.touches, hits.nbTouches, HITDIST(hits.block)); + if(hits.nbTouches) + { + bool again_ = hits.processTouches(hits.touches, hits.nbTouches); + if(again_) + hits.nbTouches = 0; + } + } + hits.finalizeQuery(); + } + +private: + IssueCallbacksOnReturn& operator=(const IssueCallbacksOnReturn&); +}; + +#undef HITDIST + +//======================================================================================================================== + +template +static bool doQueryVsCached(const PrunerHandle cacheData, PxU32 prunerIndex, const PrunerCompoundId cachedCompoundId, const PrunerManager& manager, MultiQueryCallback& pcb, const MultiQueryInput& input); + +static PX_FORCE_INLINE PxCompoundPrunerQueryFlags convertFlags(PxQueryFlags inFlags) +{ + PxCompoundPrunerQueryFlags outFlags(0); + if(inFlags.isSet(PxQueryFlag::eSTATIC)) + outFlags.raise(PxCompoundPrunerQueryFlag::eSTATIC); + if(inFlags.isSet(PxQueryFlag::eDYNAMIC)) + outFlags.raise(PxCompoundPrunerQueryFlag::eDYNAMIC); + return outFlags; +} + +// PT: TODO: revisit error messages without breaking UTs +template +bool SceneQueries::multiQuery( + const MultiQueryInput& input, PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryCache* cache, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall) const +{ + const bool anyHit = (filterData.flags & PxQueryFlag::eANY_HIT) == PxQueryFlag::eANY_HIT; + + if(HitTypeSupport::IsRaycast == 0) + { + PX_CHECK_AND_RETURN_VAL(input.pose != NULL, "NpSceneQueries::overlap/sweep pose is NULL.", 0); + PX_CHECK_AND_RETURN_VAL(input.pose->isValid(), "NpSceneQueries::overlap/sweep pose is not valid.", 0); + } + else + { + PX_CHECK_AND_RETURN_VAL(input.getOrigin().isFinite(), "NpSceneQueries::raycast pose is not valid.", 0); + } + + if(HitTypeSupport::IsOverlap == 0) + { + PX_CHECK_AND_RETURN_VAL(input.getDir().isFinite(), "NpSceneQueries multiQuery input check: unitDir is not valid.", 0); + PX_CHECK_AND_RETURN_VAL(input.getDir().isNormalized(), "NpSceneQueries multiQuery input check: direction must be normalized", 0); + } + + if(HitTypeSupport::IsRaycast) + { + PX_CHECK_AND_RETURN_VAL(input.maxDistance > 0.0f, "NpSceneQueries::multiQuery input check: distance cannot be negative or zero", 0); + } + + if(HitTypeSupport::IsOverlap && !anyHit) + { + PX_CHECK_AND_RETURN_VAL(hits.maxNbTouches > 0, "PxScene::overlap() calls without eANY_HIT flag require a touch hit buffer for return results.", 0); + } + + if(HitTypeSupport::IsSweep) + { + PX_CHECK_AND_RETURN_VAL(input.maxDistance >= 0.0f, "NpSceneQueries multiQuery input check: distance cannot be negative", 0); + PX_CHECK_AND_RETURN_VAL(input.maxDistance != 0.0f || !(hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP), + "NpSceneQueries multiQuery input check: zero-length sweep only valid without the PxHitFlag::eASSUME_NO_INITIAL_OVERLAP flag", 0); + } + + PX_CHECK_MSG(!cache || (cache && cache->shape && cache->actor), "Raycast cache specified but shape or actor pointer is NULL!"); + PrunerCompoundId cachedCompoundId = INVALID_COMPOUND_ID; + // PT: this is similar to the code in the SqRefFinder so we could share that code maybe. But here we later retrieve the payload from the PrunerData, + // i.e. we basically go back to the same pointers we started from. I suppose it's to make sure they get properly invalidated when an object is deleted etc, + // but we could still probably find a more efficient way to do that here. Isn't it exactly why we had the Signature class initially? + // + // how can this work anyway? if the actor has been deleted the lookup won't work either => doc says it's up to users to manage that.... + PxU32 prunerIndex = 0xffffffff; + const PrunerHandle cacheData = cache ? static_cast(mSQManager.getAdapter()).findPrunerHandle(*cache, cachedCompoundId, prunerIndex) : INVALID_PRUNERHANDLE; + + // this function is logically const for the SDK user, as flushUpdates() will not have an API-visible effect on this object + // internally however, flushUpdates() changes the states of the Pruners in mSQManager + // because here is the only place we need this, const_cast instead of making SQM mutable + const_cast(this)->mSQManager.flushUpdates(); + +#if PX_SUPPORT_PVD + CapturePvdOnReturn pvdCapture(this, input, filterData, hits); +#endif + + IssueCallbacksOnReturn cbr(hits); // destructor will execute callbacks on return from this function + hits.hasBlock = false; + hits.nbTouches = 0; + + PxReal shrunkDistance = HitTypeSupport::IsOverlap ? PX_MAX_REAL : input.maxDistance; // can be progressively shrunk as we go over the list of shapes + if(HitTypeSupport::IsSweep) + shrunkDistance = PxMin(shrunkDistance, PX_MAX_SWEEP_DISTANCE); + + MultiQueryCallback pcb(*this, input, anyHit, hits, hitFlags, filterData, filterCall, shrunkDistance); + + if(cacheData!=INVALID_PRUNERHANDLE && hits.maxNbTouches == 0) // don't use cache for queries that can return touch hits + { + if(!doQueryVsCached(cacheData, prunerIndex, cachedCompoundId, mSQManager, pcb, input)) + return hits.hasAnyHits(); + } + + const Pruner* staticPruner = mSQManager.getPruner(PruningIndex::eSTATIC); + const Pruner* dynamicPruner = mSQManager.getPruner(PruningIndex::eDYNAMIC); + const CompoundPruner* compoundPruner = mSQManager.getCompoundPruner(); + + const PxU32 doStatics = staticPruner && (filterData.flags & PxQueryFlag::eSTATIC); + const PxU32 doDynamics = dynamicPruner && (filterData.flags & PxQueryFlag::eDYNAMIC); + + const PxCompoundPrunerQueryFlags compoundPrunerQueryFlags = convertFlags(filterData.flags); + + if(HitTypeSupport::IsRaycast) + { + bool again = doStatics ? staticPruner->raycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, pcb) : true; + if(!again) + return hits.hasAnyHits(); + + if(doDynamics) + again = dynamicPruner->raycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, pcb); + + if(again && compoundPruner) + again = compoundPruner->raycast(input.getOrigin(), input.getDir(), pcb.mShrunkDistance, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + else if(HitTypeSupport::IsOverlap) + { + PX_ASSERT(input.geometry); + + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mShapeData = &sd; + bool again = doStatics ? staticPruner->overlap(sd, pcb) : true; + if(!again) // && (filterData.flags & PxQueryFlag::eANY_HIT)) + return hits.hasAnyHits(); + + if(doDynamics) + again = dynamicPruner->overlap(sd, pcb); + + if(again && compoundPruner) + again = compoundPruner->overlap(sd, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } + else + { + PX_ASSERT(HitTypeSupport::IsSweep); + PX_ASSERT(input.geometry); + + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mQueryShapeBounds = &sd.getPrunerInflatedWorldAABB(); + pcb.mShapeData = &sd; + bool again = doStatics ? staticPruner->sweep(sd, input.getDir(), pcb.mShrunkDistance, pcb) : true; + if(!again) + return hits.hasAnyHits(); + + if(doDynamics) + again = dynamicPruner->sweep(sd, input.getDir(), pcb.mShrunkDistance, pcb); + + if(again && compoundPruner) + again = compoundPruner->sweep(sd, input.getDir(), pcb.mShrunkDistance, pcb, compoundPrunerQueryFlags); + + cbr.again = again; // update the status to avoid duplicate processTouches() + return hits.hasAnyHits(); + } +} + +//explicit template instantiation +template bool SceneQueries::multiQuery(const MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +template bool SceneQueries::multiQuery(const MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; +template bool SceneQueries::multiQuery(const MultiQueryInput&, PxHitCallback&, PxHitFlags, const PxQueryCache*, const PxQueryFilterData&, PxQueryFilterCallback*) const; + +/////////////////////////////////////////////////////////////////////////////// + +bool SceneQueries::_raycast( + const PxVec3& origin, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.raycast", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + MultiQueryInput input(origin, unitDir, distance); + return multiQuery(input, hits, hitFlags, cache, filterData, filterCall); +} + +////////////////////////////////////////////////////////////////////////// + +bool SceneQueries::_overlap( + const PxGeometry& geometry, const PxTransform& pose, PxOverlapCallback& hits, + const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.overlap", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + + MultiQueryInput input(&geometry, &pose); + return multiQuery(input, hits, PxHitFlags(), cache, filterData, filterCall); +} + +/////////////////////////////////////////////////////////////////////////////// + +bool SceneQueries::_sweep( + const PxGeometry& geometry, const PxTransform& pose, const PxVec3& unitDir, const PxReal distance, + PxHitCallback& hits, PxHitFlags hitFlags, const PxQueryFilterData& filterData, PxQueryFilterCallback* filterCall, + const PxQueryCache* cache, const PxReal inflation, PxGeometryQueryFlags flags) const +{ + PX_PROFILE_ZONE("SceneQuery.sweep", getContextId()); + PX_SIMD_GUARD_CNDT(flags & PxGeometryQueryFlag::eSIMD_GUARD) + +#if PX_CHECKED + if(!PxGeometryQuery::isValid(geometry)) + return outputError(__LINE__, "Provided geometry is not valid"); +#endif + + if((hitFlags & PxHitFlag::ePRECISE_SWEEP) && (hitFlags & PxHitFlag::eMTD)) + { + outputError(__LINE__, " Precise sweep doesn't support MTD. Perform MTD with default sweep"); + hitFlags &= ~PxHitFlag::ePRECISE_SWEEP; + } + + if((hitFlags & PxHitFlag::eASSUME_NO_INITIAL_OVERLAP) && (hitFlags & PxHitFlag::eMTD)) + { + outputError(__LINE__, " eMTD cannot be used in conjunction with eASSUME_NO_INITIAL_OVERLAP. eASSUME_NO_INITIAL_OVERLAP will be ignored"); + hitFlags &= ~PxHitFlag::eASSUME_NO_INITIAL_OVERLAP; + } + + PxReal realInflation = inflation; + if((hitFlags & PxHitFlag::ePRECISE_SWEEP)&& inflation > 0.f) + { + realInflation = 0.f; + outputError(__LINE__, " Precise sweep doesn't support inflation, inflation will be overwritten to be zero"); + } + MultiQueryInput input(&geometry, &pose, unitDir, distance, realInflation); + return multiQuery(input, hits, hitFlags, cache, filterData, filterCall); +} + +/////////////////////////////////////////////////////////////////////////////// + +template +static bool doQueryVsCached(const PrunerHandle handle, PxU32 prunerIndex, const PrunerCompoundId cachedCompoundId, const PrunerManager& manager, MultiQueryCallback& pcb, const MultiQueryInput& input) +{ + // this block is only executed for single shape cache + const PrunerPayload* payloads; + const PxTransform* compoundPosePtr; + + PxTransform* transform; + PxTransform compoundPose; + if(cachedCompoundId == INVALID_COMPOUND_ID) + { + const Pruner* pruner = manager.getPruner(PruningIndex::Enum(prunerIndex)); + PX_ASSERT(pruner); + + PrunerPayloadData ppd; + const PrunerPayload& cachedPayload = pruner->getPayloadData(handle, &ppd); + + payloads = &cachedPayload; + compoundPosePtr = NULL; + transform = ppd.mTransform; + } + else + { + const CompoundPruner* pruner = manager.getCompoundPruner(); + PX_ASSERT(pruner); + + PrunerPayloadData ppd; + const PrunerPayload& cachedPayload = pruner->getPayloadData(handle, cachedCompoundId, &ppd); + + compoundPose = pruner->getTransform(cachedCompoundId); + + payloads = &cachedPayload; + compoundPosePtr = &compoundPose; + transform = ppd.mTransform; + } + PxReal dummyDist; + + bool againAfterCache; + if(HitTypeSupport::IsSweep) + { + // AP: for sweeps we cache the bounds because we need to know them for the test to clip the sweep to bounds + // otherwise GJK becomes unstable. The bounds can be used multiple times so this is an optimization. + const ShapeData sd(*input.geometry, *input.pose, input.inflation); + pcb.mQueryShapeBounds = &sd.getPrunerInflatedWorldAABB(); + pcb.mShapeData = &sd; +// againAfterCache = pcb.invoke(dummyDist, 0); + againAfterCache = pcb.template _invoke(dummyDist, 0, payloads, transform, compoundPosePtr); + pcb.mShapeData = NULL; + } else +// againAfterCache = pcb.invoke(dummyDist, 0); + againAfterCache = pcb.template _invoke(dummyDist, 0, payloads, transform, compoundPosePtr); + + return againAfterCache; +} + +/////////////////////////////////////////////////////////////////////////////// + +SceneQueries::SceneQueries( PVDCapture* pvd, PxU64 contextID, Pruner* staticPruner, Pruner* dynamicPruner, + PxU32 dynamicTreeRebuildRateHint, float inflation, + const PxSceneLimits& limits, const QueryAdapter& adapter) : + mSQManager (contextID, staticPruner, dynamicPruner, dynamicTreeRebuildRateHint, inflation, limits, adapter), + mPVD (pvd) +{ +} + +SceneQueries::~SceneQueries() +{ +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScActorCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScActorCore.h new file mode 100644 index 0000000..5f3202f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScActorCore.h @@ -0,0 +1,131 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ACTOR_CORE_H +#define SC_ACTOR_CORE_H + +#include "common/PxMetaData.h" +#include "PxActor.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + +class PxActor; + +namespace Sc +{ + + class Scene; + class ActorSim; + + class ActorCore : public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + ActorCore(const PxEMPTY) : mSim(NULL), mActorFlags(PxEmpty) + { + } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ActorCore(PxActorType::Enum actorType, PxU8 actorFlags, + PxClientID owner, PxDominanceGroup dominanceGroup); + /*virtual*/ ~ActorCore(); + + PX_FORCE_INLINE ActorSim* getSim() const { return mSim; } + PX_FORCE_INLINE void setSim(ActorSim* sim) + { + PX_ASSERT((sim==NULL) ^ (mSim==NULL)); + mSim = sim; + } + + PX_FORCE_INLINE PxActorFlags getActorFlags() const { return mActorFlags; } + void setActorFlags(PxActorFlags af); + + PX_FORCE_INLINE PxDominanceGroup getDominanceGroup() const + { + return PxDominanceGroup(mDominanceGroup); + } + void setDominanceGroup(PxDominanceGroup g); + + PX_FORCE_INLINE void setOwnerClient(PxClientID inId) + { + const PxU32 aggid = mAggregateIDOwnerClient & 0x00ffffff; + mAggregateIDOwnerClient = (PxU32(inId)<<24) | aggid; + } + PX_FORCE_INLINE PxClientID getOwnerClient() const + { + return mAggregateIDOwnerClient>>24; + } + + PX_FORCE_INLINE PxActorType::Enum getActorCoreType() const { return PxActorType::Enum(mActorType); } + + void reinsertShapes(); + + PX_FORCE_INLINE void setAggregateID(PxU32 id) + { + PX_ASSERT(id==0xffffffff || id<(1<<24)); + const PxU32 ownerClient = mAggregateIDOwnerClient & 0xff000000; + mAggregateIDOwnerClient = (id & 0x00ffffff) | ownerClient; + } + PX_FORCE_INLINE PxU32 getAggregateID() const + { + const PxU32 id = mAggregateIDOwnerClient & 0x00ffffff; + return id == 0x00ffffff ? PX_INVALID_U32 : id; + } + //virtual PxActor* getPxActor() const = 0; + //virtual PxIntBool isFrozen() const { return IntTrue; }; + + private: + ActorSim* mSim; // + PxU32 mAggregateIDOwnerClient; // PxClientID (8bit) | aggregate ID (24bit) + // PT: TODO: the remaining members could be packed into just a 16bit mask + PxActorFlags mActorFlags; // PxActor's flags (PxU8) => only 4 bits used + PxU8 mActorType; // Actor type (8 bits, but 3 would be enough) + PxU8 mDominanceGroup; // Dominance group (8 bits, but 5 would be enough because "must be < 32") + }; + +#if PX_P64_FAMILY + PX_COMPILE_TIME_ASSERT(sizeof(Sc::ActorCore)==16); +#else + PX_COMPILE_TIME_ASSERT(sizeof(Sc::ActorCore)==12); +#endif + +} // namespace Sc + +} + +////////////////////////////////////////////////////////////////////////// + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h new file mode 100644 index 0000000..f98dc91 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationAttachmentCore.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef SC_ATTACHMENT_CORE_H +#define SC_ATTACHMENT_CORE_H + +#include "foundation/PxVec3.h" + +namespace physx +{ +namespace Sc +{ + class ArticulationAttachmentCore + { + public: + +// PX_SERIALIZATION + ArticulationAttachmentCore(const PxEMPTY) : mTendonSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + ArticulationAttachmentCore() : mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f) + { + + } + + PxVec3 mRelativeOffset; //relative offset to the link(in link space) + ArticulationAttachmentCore* mParent; + PxReal mLowLimit; + PxReal mHighLimit; + PxReal mRestLength; + PxReal mCoefficient; + PxU32 mLLLinkIndex; + PxU32 mAttachmentIndex; + Sc::ArticulationSpatialTendonSim* mTendonSim; + + }; +}//namespace Sc +}//namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationCore.h new file mode 100644 index 0000000..04a14df --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationCore.h @@ -0,0 +1,180 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_CORE_H +#define SC_ARTICULATION_CORE_H + +#include "ScActorCore.h" +#include "DyFeatherstoneArticulation.h" + +namespace physx +{ + +class PxvArticulation; + +class PxNodeIndex; + +namespace Sc +{ + //typedef Dy::FsData ArticulationDriveCache; + + class ArticulationSim; + class BodyCore; + class BodySim; + class ArticulationJointCore; + + class ArticulationCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + +// PX_SERIALIZATION + public: + ArticulationCore(const PxEMPTY) : mSim(NULL), mCore(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ArticulationCore(); + ~ArticulationCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + PX_FORCE_INLINE PxReal getSleepThreshold() const { return mCore.sleepThreshold; } + PX_FORCE_INLINE void setSleepThreshold(const PxReal v) { mCore.sleepThreshold = v; } + + PX_FORCE_INLINE PxReal getFreezeThreshold() const { return mCore.freezeThreshold; } + PX_FORCE_INLINE void setFreezeThreshold(const PxReal v) { mCore.freezeThreshold = v; } + + PX_FORCE_INLINE PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; } + PX_FORCE_INLINE void setSolverIterationCounts(PxU16 c) { mCore.solverIterationCounts = c; } + + PX_FORCE_INLINE PxReal getWakeCounter() const { return mCore.wakeCounter; } + PX_FORCE_INLINE void setWakeCounterInternal(const PxReal v) { mCore.wakeCounter = v; } + void setWakeCounter(const PxReal v); + + PX_FORCE_INLINE PxReal getMaxLinearVelocity() const { return mCore.maxLinearVelocity; } + void setMaxLinearVelocity(const PxReal max); + + PX_FORCE_INLINE PxReal getMaxAngularVelocity() const { return mCore.maxAngularVelocity; } + void setMaxAngularVelocity(const PxReal max); + + bool isSleeping() const; + void wakeUp(PxReal wakeCounter); + void putToSleep(); + + //--------------------------------------------------------------------------------- + // external reduced coordinate API + //--------------------------------------------------------------------------------- + void setArticulationFlags(PxArticulationFlags flags); + PxArticulationFlags getArticulationFlags() const { return mCore.flags; } + + PxU32 getDofs() const; + + PxArticulationCache* createCache() const; + + PxU32 getCacheDataSize() const; + + void zeroCache(PxArticulationCache& cache) const; + + bool applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag)const; + + void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const; + + void packJointData(const PxReal* maximum, PxReal* reduced) const; + + void unpackJointData(const PxReal* reduced, PxReal* maximum) const; + + void commonInit() const; + + void computeGeneralizedGravityForce(PxArticulationCache& cache) const; + + void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const; + + void computeGeneralizedExternalForce(PxArticulationCache& cache) const; + + void computeJointAcceleration(PxArticulationCache& cache) const; + + void computeJointForce(PxArticulationCache& cache) const; + + + void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const; + + void computeCoefficientMatrix(PxArticulationCache& cache) const; + + bool computeLambda(PxArticulationCache& cache, PxArticulationCache& rollBackCache, const PxReal* const jointTorque, const PxVec3 gravity, const PxU32 maxIter) const; + + void computeGeneralizedMassMatrix(PxArticulationCache& cache) const; + + PxU32 getCoefficientMatrixSize() const; + + PxSpatialVelocity getLinkAcceleration(const PxU32 linkId) const; + + PxU32 getGpuArticulationIndex() const; + + void updateKinematic(PxArticulationKinematicFlags flags); + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + public: + PX_FORCE_INLINE void setSim(ArticulationSim* sim) + { + PX_ASSERT((sim==0) ^ (mSim == 0)); + mSim = sim; + } + PX_FORCE_INLINE ArticulationSim* getSim() const { return mSim; } + + PX_FORCE_INLINE Dy::ArticulationCore& getCore() { return mCore; } + + static PX_FORCE_INLINE ArticulationCore& getArticulationCore(ArticulationCore& core) + { + const size_t offset = PX_OFFSET_OF(ArticulationCore, mCore); + return *reinterpret_cast(reinterpret_cast(&core) - offset); + } + + PxNodeIndex getIslandNodeIndex() const; + + void setGlobalPose(); + + private: + ArticulationSim* mSim; + Dy::ArticulationCore mCore; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationJointCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationJointCore.h new file mode 100644 index 0000000..8acec0d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationJointCore.h @@ -0,0 +1,152 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_JOINT_CORE_H +#define SC_ARTICULATION_JOINT_CORE_H + +#include "foundation/PxTransform.h" +#include "common/PxMetaData.h" +#include "foundation/PxUserAllocated.h" +#include "DyVArticulation.h" + +namespace physx +{ +namespace Sc +{ + class BodyCore; + class ArticulationJointSim; + class ArticulationCore; + + class ArticulationJointDesc + { + public: + BodyCore* parent; + BodyCore* child; + PxTransform parentPose; + PxTransform childPose; + }; + + class ArticulationJointCore : public PxUserAllocated + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + public: +// PX_SERIALIZATION + ArticulationJointCore(const PxEMPTY) : mCore(PxEmpty), mSim(NULL) {} + void preExportDataReset() { mCore.jointDirtyFlag = Dy::ArticulationJointCoreDirtyFlag::eALL; } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ArticulationJointCore(const PxTransform& parentFrame, const PxTransform& childFrame); + ~ArticulationJointCore(); + + //Those methods are not allowed while the articulation are in the scene + PX_FORCE_INLINE const PxTransform& getParentPose() const { return mCore.parentPose; } + void setParentPose(const PxTransform&); + + PX_FORCE_INLINE const PxTransform& getChildPose() const { return mCore.childPose; } + void setChildPose(const PxTransform&); + + //Those functions doesn't change the articulation configuration so the application is allowed to change those value in run-time + PX_FORCE_INLINE PxArticulationLimit getLimit(PxArticulationAxis::Enum axis) const { return mCore.limits[axis]; } + void setLimit(PxArticulationAxis::Enum axis, const PxArticulationLimit& limit); + + PX_FORCE_INLINE PxArticulationDrive getDrive(PxArticulationAxis::Enum axis) const { return mCore.drives[axis]; } + void setDrive(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive); + + void setTargetP(PxArticulationAxis::Enum axis, PxReal targetP); + PX_FORCE_INLINE PxReal getTargetP(PxArticulationAxis::Enum axis) const { return mCore.targetP[axis]; } + + void setTargetV(PxArticulationAxis::Enum axis, PxReal targetV); + PX_FORCE_INLINE PxReal getTargetV(PxArticulationAxis::Enum axis) const { return mCore.targetV[axis]; } + + void setArmature(PxArticulationAxis::Enum axis, PxReal armature); + PX_FORCE_INLINE PxReal getArmature(PxArticulationAxis::Enum axis) const { return mCore.armature[axis]; } + + void setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos); + PxReal getJointPosition(PxArticulationAxis::Enum axis) const; + + void setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel); + PxReal getJointVelocity(PxArticulationAxis::Enum axis) const; + + // PT: TODO: don't we need to set ArticulationJointCoreDirtyFlag::eMOTION here? + PX_FORCE_INLINE void setMotion(PxArticulationAxis::Enum axis, PxArticulationMotion::Enum motion) { mCore.motion[axis] = PxU8(motion); } + PX_FORCE_INLINE PxArticulationMotion::Enum getMotion(PxArticulationAxis::Enum axis) const { return PxArticulationMotion::Enum(mCore.motion[axis]); } + + PX_FORCE_INLINE void setJointType(PxArticulationJointType::Enum type) { mCore.initJointType(type); } + PX_FORCE_INLINE PxArticulationJointType::Enum getJointType() const { return PxArticulationJointType::Enum(mCore.jointType); } + + PX_FORCE_INLINE void setFrictionCoefficient(const PxReal coefficient) { mCore.initFrictionCoefficient(coefficient); } + PX_FORCE_INLINE PxReal getFrictionCoefficient() const { return mCore.frictionCoefficient; } + + PX_FORCE_INLINE void setMaxJointVelocity(const PxReal maxJointV) { mCore.initMaxJointVelocity(maxJointV); } + PX_FORCE_INLINE PxReal getMaxJointVelocity() const { return mCore.maxJointVelocity; } + + PX_FORCE_INLINE ArticulationJointSim* getSim() const { return mSim; } + PX_FORCE_INLINE void setSim(ArticulationJointSim* sim) + { + PX_ASSERT((sim==0) ^ (mSim == 0)); + mSim = sim; + } + + PX_FORCE_INLINE Dy::ArticulationJointCore& getCore() { return mCore; } + + PX_FORCE_INLINE void setArticulation(ArticulationCore* articulation) { mArticulation = articulation; } + PX_FORCE_INLINE const ArticulationCore* getArticulation() const { return mArticulation; } + + PX_FORCE_INLINE void setRoot(PxArticulationJointReducedCoordinate* base) { mRootType = base; } + PX_FORCE_INLINE PxArticulationJointReducedCoordinate* getRoot() const { return mRootType; } + + PX_FORCE_INLINE void setLLIndex(const PxU32 llLinkIndex) { mLLLinkIndex = llLinkIndex; } + private: + void setSimDirty(); + PX_FORCE_INLINE void setDirty(Dy::ArticulationJointCoreDirtyFlag::Enum dirtyFlag) + { + mCore.jointDirtyFlag |= dirtyFlag; + setSimDirty(); + } + + Dy::ArticulationJointCore mCore; + ArticulationJointSim* mSim; + ArticulationCore* mArticulation; + PxArticulationJointReducedCoordinate* mRootType; + PxU32 mLLLinkIndex; +#if PX_P64_FAMILY + PxU32 pad; +#endif + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationSensor.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationSensor.h new file mode 100644 index 0000000..9a37a79 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationSensor.h @@ -0,0 +1,71 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_SENSOR_CORE +#define SC_ARTICULATION_SENSOR_CORE + +#include "foundation/PxVec3.h" +#include "foundation/PxTransform.h" + +namespace physx +{ +namespace Sc +{ + +class ArticulationCore; +class ArticulationSensorSim; + +class ArticulationSensorCore +{ +public: + +// PX_SERIALIZATION + ArticulationSensorCore(const PxEMPTY) :mSim(NULL) {} + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + + ArticulationSensorCore(){} + + PX_FORCE_INLINE void setSim(ArticulationSensorSim* sim) + { + PX_ASSERT((sim == 0) ^ (mSim == 0)); + mSim = sim; + } + + PX_FORCE_INLINE ArticulationSensorSim* getSim() const { return mSim; } + + ArticulationSensorSim* mSim; + PxTransform mRelativePose; + PxU16 mFlags; +}; +}//namespace Sc +}//namespace physx + +#endif //SC_ARTICULATION_SENSOR_CORE + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonCore.h new file mode 100644 index 0000000..7722edf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonCore.h @@ -0,0 +1,150 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_PHYSICS_SCP_ARTICULATION_TENDON_CORE +#define PX_PHYSICS_SCP_ARTICULATION_TENDON_CORE + +#include "DyArticulationTendon.h" + +namespace physx +{ +namespace Sc +{ + class ArticulationSpatialTendonSim; + class ArticulationFixedTendonSim; + + class ArticulationTendonCore + { + public: + +// PX_SERIALIZATION + ArticulationTendonCore(const PxEMPTY) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + ArticulationTendonCore() : mStiffness(0.f), mDamping(0.f), mOffset(0.f), mLimitStiffness(0.f) + { + + } + PxReal mStiffness; + PxReal mDamping; + PxReal mOffset; + PxReal mLimitStiffness; + }; + + class ArticulationSpatialTendonCore : public ArticulationTendonCore + { + public: + +// PX_SERIALIZATION + ArticulationSpatialTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + + ArticulationSpatialTendonCore() : ArticulationTendonCore() { mSim = NULL; } + ~ArticulationSpatialTendonCore() {} + + void setStiffness(const PxReal stiffness); + PxReal getStiffness() const; + + void setDamping(const PxReal damping); + PxReal getDamping() const; + + void setLimitStiffness(const PxReal stiffness); + PxReal getLimitStiffness() const; + + void setOffset(const PxReal offset); + PxReal getOffset() const; + + + PX_FORCE_INLINE void setSim(ArticulationSpatialTendonSim* sim) + { + PX_ASSERT((sim == 0) ^ (mSim == 0)); + mSim = sim; + } + + PX_FORCE_INLINE ArticulationSpatialTendonSim* getSim() const { return mSim; } + + + ArticulationSpatialTendonSim* mSim; + }; + + class ArticulationFixedTendonCore : public ArticulationTendonCore + { + public: + // PX_SERIALIZATION + ArticulationFixedTendonCore(const PxEMPTY) : ArticulationTendonCore(PxEmpty), mSim(NULL) {} + void preExportDataReset() {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + ArticulationFixedTendonCore() : ArticulationTendonCore(), mLowLimit(PX_MAX_F32), mHighLimit(-PX_MAX_F32), mRestLength(0.f) + { mSim = NULL; } + ~ArticulationFixedTendonCore() {} + + void setStiffness(const PxReal stiffness); + PxReal getStiffness() const; + + void setDamping(const PxReal damping); + PxReal getDamping() const; + + void setLimitStiffness(const PxReal stiffness); + PxReal getLimitStiffness() const; + + + void setOffset(const PxReal offset); + PxReal getOffset() const; + + void setSpringRestLength(const PxReal restLength); + PxReal getSpringRestLength() const; + + void setLimitRange(const PxReal lowLimit, const PxReal highLimit); + void getLimitRange(PxReal& lowLimit, PxReal& highLimit) const; + + PX_FORCE_INLINE void setSim(ArticulationFixedTendonSim* sim) + { + PX_ASSERT((sim == 0) ^ (mSim == 0)); + mSim = sim; + } + PX_FORCE_INLINE ArticulationFixedTendonSim* getSim() const { return mSim; } + + PxReal mLowLimit; + PxReal mHighLimit; + PxReal mRestLength; + + ArticulationFixedTendonSim* mSim; + }; + + +}//namespace Sc +} //namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h new file mode 100644 index 0000000..a37a55c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScArticulationTendonJointCore.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef SC_TENDON_JOINT_CORE_H +#define SC_TENDON_JOINT_CORE_H + +#include "foundation/PxVec3.h" +#include "solver/PxSolverDefs.h" + +namespace physx +{ + namespace Sc + { + class ArticulationFixedTendonSim; + + class ArticulationTendonJointCore + { + public: + + // PX_SERIALIZATION + ArticulationTendonJointCore(const PxEMPTY) : mTendonSim(NULL) {} + void preExportDataReset() { } + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + + ArticulationTendonJointCore() + { + coefficient = PX_MAX_F32; + recipCoefficient = PX_MAX_F32; + } + + PX_FORCE_INLINE PxArticulationAxis::Enum getAxis() + { + return axis; + } + + PX_FORCE_INLINE void getCoefficient(PxArticulationAxis::Enum& axis_, PxReal& coefficient_, PxReal& recipCoefficient_) const + { + axis_ = axis; + coefficient_ = coefficient; + recipCoefficient_ = recipCoefficient; + } + + void setCoefficient(PxArticulationAxis::Enum axis_, const PxReal coefficient_, const PxReal recipCoefficient_); + + + PxArticulationAxis::Enum axis; + PxReal coefficient; + PxReal recipCoefficient; + PxU32 mLLLinkIndex; + ArticulationTendonJointCore* mParent; + PxU32 mLLTendonJointIndex; + Sc::ArticulationFixedTendonSim* mTendonSim; + }; + }//namespace Sc +}//namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScBodyCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScBodyCore.h new file mode 100644 index 0000000..b23a44a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScBodyCore.h @@ -0,0 +1,196 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_BODY_CORE_H +#define SC_BODY_CORE_H + +#include "foundation/PxTransform.h" +#include "ScRigidCore.h" +#include "PxRigidDynamic.h" +#include "PxvDynamics.h" +#include "PxvConfig.h" +#include "foundation/PxPool.h" + +namespace physx +{ +class PxRigidBodyDesc; + +namespace Sc +{ + class BodySim; + struct SimStateData; + + class BodyCore : public RigidCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + public: +// PX_SERIALIZATION + BodyCore(const PxEMPTY) : RigidCore(PxEmpty), mCore(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + void restoreDynamicData(); + +//~PX_SERIALIZATION + BodyCore(PxActorType::Enum type, const PxTransform& bodyPose); + ~BodyCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + PX_FORCE_INLINE const PxTransform& getBody2World() const { return mCore.body2World; } + void setBody2World(const PxTransform& p); + + PX_FORCE_INLINE const PxVec3& getLinearVelocity() const { return mCore.linearVelocity; } + void setLinearVelocity(const PxVec3& v, bool skipBodySimUpdate=false); + + PX_FORCE_INLINE const PxVec3& getAngularVelocity() const { return mCore.angularVelocity; } + void setAngularVelocity(const PxVec3& v, bool skipBodySimUpdate=false); + + PX_FORCE_INLINE PxReal getCfmScale() const { return mCore.cfmScale; } + void setCfmScale(PxReal d); + + PX_FORCE_INLINE void updateVelocities(const PxVec3& linearVelModPerStep, const PxVec3& angularVelModPerStep) + { + mCore.linearVelocity += linearVelModPerStep; + mCore.angularVelocity += angularVelModPerStep; + } + + PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return mCore.getBody2Actor(); } + void setBody2Actor(const PxTransform& p); + + void addSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc); + void setSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc); + void clearSpatialAcceleration(bool force, bool torque); + void addSpatialVelocity(PxPool* simStateDataPool, const PxVec3* linVelDelta, const PxVec3* angVelDelta); + void clearSpatialVelocity(bool force, bool torque); + + PX_FORCE_INLINE PxReal getMaxPenetrationBias() const { return mCore.maxPenBias; } + PX_FORCE_INLINE void setMaxPenetrationBias(PxReal p) { mCore.maxPenBias = p; } + + PxReal getInverseMass() const; + void setInverseMass(PxReal m); + const PxVec3& getInverseInertia() const; + void setInverseInertia(const PxVec3& i); + + PxReal getLinearDamping() const; + void setLinearDamping(PxReal d); + + PxReal getAngularDamping() const; + void setAngularDamping(PxReal d); + + PX_FORCE_INLINE PxRigidBodyFlags getFlags() const { return mCore.mFlags; } + void setFlags(PxPool* simStateDataPool, PxRigidBodyFlags f); + + PX_FORCE_INLINE PxRigidDynamicLockFlags getRigidDynamicLockFlags() const { return mCore.lockFlags; } + + PX_FORCE_INLINE void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) { mCore.lockFlags = flags; } + + PX_FORCE_INLINE PxReal getSleepThreshold() const { return mCore.sleepThreshold; } + void setSleepThreshold(PxReal t); + + PX_FORCE_INLINE PxReal getFreezeThreshold() const { return mCore.freezeThreshold; } + void setFreezeThreshold(PxReal t); + + PX_FORCE_INLINE PxReal getMaxContactImpulse() const { return mCore.maxContactImpulse; } + void setMaxContactImpulse(PxReal m); + + PX_FORCE_INLINE PxReal getOffsetSlop() const { return mCore.offsetSlop; } + void setOffsetSlop(PxReal slop); + + PxNodeIndex getInternalIslandNodeIndex() const; + + PX_FORCE_INLINE PxReal getWakeCounter() const { return mCore.wakeCounter; } + void setWakeCounter(PxReal wakeCounter, bool forceWakeUp=false); + + bool isSleeping() const; + PX_FORCE_INLINE void wakeUp(PxReal wakeCounter) { setWakeCounter(wakeCounter, true); } + void putToSleep(); + + PxReal getMaxAngVelSq() const; + void setMaxAngVelSq(PxReal v); + + PxReal getMaxLinVelSq() const; + void setMaxLinVelSq(PxReal v); + + PX_FORCE_INLINE PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; } + void setSolverIterationCounts(PxU16 c); + + bool getKinematicTarget(PxTransform& p) const; + bool getHasValidKinematicTarget() const; + void setKinematicTarget(const PxTransform& p, PxReal wakeCounter); + void invalidateKinematicTarget(); + + PX_FORCE_INLINE PxReal getContactReportThreshold() const { return mCore.contactReportThreshold; } + void setContactReportThreshold(PxReal t) { mCore.contactReportThreshold = t; } + + void onOriginShift(const PxVec3& shift); + + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + + PX_FORCE_INLINE void setLinearVelocityInternal(const PxVec3& v) { mCore.linearVelocity = v; } + PX_FORCE_INLINE void setAngularVelocityInternal(const PxVec3& v) { mCore.angularVelocity = v; } + PX_FORCE_INLINE void setWakeCounterFromSim(PxReal c) { mCore.wakeCounter = c; } + + BodySim* getSim() const; + + PX_FORCE_INLINE PxsBodyCore& getCore() { return mCore; } + PX_FORCE_INLINE const PxsBodyCore& getCore() const { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(BodyCore, mCore); } + + PX_FORCE_INLINE PxReal getCCDAdvanceCoefficient() const { return mCore.ccdAdvanceCoefficient; } + PX_FORCE_INLINE void setCCDAdvanceCoefficient(PxReal c) { mCore.ccdAdvanceCoefficient = c; } + + void onRemoveKinematicFromScene(); + + PxIntBool isFrozen() const; + + static PX_FORCE_INLINE BodyCore& getCore(PxsBodyCore& core) + { + return *reinterpret_cast(reinterpret_cast(&core) - getCoreOffset()); + } + + void setKinematicLink(const bool value); + private: + PX_ALIGN_PREFIX(16) PxsBodyCore mCore PX_ALIGN_SUFFIX(16); + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScConstraintCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScConstraintCore.h new file mode 100644 index 0000000..a964327 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScConstraintCore.h @@ -0,0 +1,129 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_CORE_H +#define SC_CONSTRAINT_CORE_H + +#include "PxConstraint.h" + +namespace physx +{ + class PxsSimulationController; +namespace Sc +{ + class ConstraintSim; + class RigidCore; + + class ConstraintCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + ConstraintCore(const PxEMPTY) : mFlags(PxEmpty), mConnector(NULL), mSim(NULL) {} + PX_FORCE_INLINE void setConstraintFunctions(PxConstraintConnector& n, const PxConstraintShaderTable& shaders) + { + mConnector = &n; + mSolverPrep = shaders.solverPrep; + mProject = shaders.project; + mVisualize = shaders.visualize; + } + static void getBinaryMetaData(PxOutputStream& stream); +//~PX_SERIALIZATION + ConstraintCore(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize); + ~ConstraintCore() {} + + void setBodies(RigidCore* r0v, RigidCore* r1v); + + PxConstraint* getPxConstraint(); + const PxConstraint* getPxConstraint() const; + PX_FORCE_INLINE PxConstraintConnector* getPxConnector() const { return mConnector; } + + PX_FORCE_INLINE PxConstraintFlags getFlags() const { return mFlags; } + void setFlags(PxConstraintFlags flags); + + void getForce(PxVec3& force, PxVec3& torque) const; + + void setBreakForce(PxReal linear, PxReal angular); + PX_FORCE_INLINE void getBreakForce(PxReal& linear, PxReal& angular) const + { + linear = mLinearBreakForce; + angular = mAngularBreakForce; + } + + void setMinResponseThreshold(PxReal threshold); + PX_FORCE_INLINE PxReal getMinResponseThreshold() const { return mMinResponseThreshold; } + + void breakApart(); + + PX_FORCE_INLINE PxConstraintVisualize getVisualize() const { return mVisualize; } + PX_FORCE_INLINE PxConstraintProject getProject() const { return mProject; } + PX_FORCE_INLINE PxConstraintSolverPrep getSolverPrep() const { return mSolverPrep; } + PX_FORCE_INLINE PxU32 getConstantBlockSize() const { return mDataSize; } + + PX_FORCE_INLINE void setSim(ConstraintSim* sim) + { + PX_ASSERT((sim==0) ^ (mSim == 0)); + mSim = sim; + } + PX_FORCE_INLINE ConstraintSim* getSim() const { return mSim; } + + PX_FORCE_INLINE bool isDirty() const { return mIsDirty ? true : false; } + PX_FORCE_INLINE void setDirty() { mIsDirty = 1; } + PX_FORCE_INLINE void clearDirty() { mIsDirty = 0; } + + private: + PxConstraintFlags mFlags; + //In order to support O(1) insert/remove mIsDirty really wants to be an index into NpScene's dirty joint array + PxU8 mIsDirty; + PxU8 mPadding; + + PxVec3 mAppliedForce; + PxVec3 mAppliedTorque; + + PxConstraintConnector* mConnector; + PxConstraintProject mProject; + PxConstraintSolverPrep mSolverPrep; + PxConstraintVisualize mVisualize; + PxU32 mDataSize; + PxReal mLinearBreakForce; + PxReal mAngularBreakForce; + PxReal mMinResponseThreshold; + + ConstraintSim* mSim; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScFEMClothCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScFEMClothCore.h new file mode 100644 index 0000000..98dc6d4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScFEMClothCore.h @@ -0,0 +1,185 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#ifndef PX_PHYSICS_SCP_FEMCLOTH_CORE +#define PX_PHYSICS_SCP_FEMCLOTH_CORE + +#include "foundation/PxPreprocessor.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFEMCloth.h" +#endif +#include "PxFEMParameter.h" +#include "../../lowleveldynamics/include/DyFEMClothCore.h" +#include "foundation/PxAssert.h" +#include "ScActorCore.h" +#include "ScShapeCore.h" +#include "PxFiltering.h" +#include "ScRigidCore.h" //KS - required for ShapeChangeNotifyFlags. Ideally, we should move that to a separate shared file +#include "PxConeLimitedConstraint.h" + +namespace physx +{ + namespace Sc + { + class FEMClothSim; + //class BodyCore; + + class FEMClothCore : public ActorCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + + // PX_SERIALIZATION + public: + FEMClothCore(const PxEMPTY) : ActorCore(PxEmpty) {} + //static void getBinaryMetaData(PxOutputStream& stream); + + //~PX_SERIALIZATION + FEMClothCore(); + ~FEMClothCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + //void commit(PxBuffer& positionInvMassBuf, const PxTransform& transform, const PxReal density, const PxReal scale, const PxReal maxInvMass); + + PxFEMParameters getParameter() const; + void setParameter(const PxFEMParameters& paramters); + + void addRigidFilter(Sc::BodyCore* core, PxU32 vertId); + void removeRigidFilter(Sc::BodyCore* core, PxU32 vertId); + + PxU32 addRigidAttachment(Sc::BodyCore* core, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeRigidAttachment(Sc::BodyCore* core, PxU32 handle); + + void addTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx); + void removeTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx); + + PxU32 addTriRigidAttachment(Sc::BodyCore* core, PxU32 triIdx, const PxVec4& barycentric, + const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeTriRigidAttachment(Sc::BodyCore* core, PxU32 handle); + + void addClothFilter(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx, PxU32 triIdx); + void removeClothFilter(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx0, PxU32 triIdx); + + PxU32 addClothAttachment(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx, + const PxVec4& triBarycentric); + void removeClothAttachment(Sc::FEMClothCore* otherCore, PxU32 handle); + + void setDrag(const PxReal v) { mCore.drag = v; } + PxReal getDrag() const { return mCore.drag; } + + void setLift(const PxReal v) { mCore.lift = v; } + PxReal getLift() const { return mCore.lift; } + + void setWind(const PxVec3& wind) { mCore.wind = wind; } + PxVec3 getWind() const { return mCore.wind; } + + void setAirDensity(const float airDensity) { mCore.airDensity = airDensity; } + PxReal getAirDensity() const { return mCore.airDensity; } + + void setBendingScales(const PxReal* const bendingScales, PxU32 nbElements); + const PxReal* getBendingScales() const; + PxU32 getNbBendingScales() const { return mCore.mBendingScales.size(); } + + void setMaxVelocity(const float maxVelocity) { mCore.maxVelocity = maxVelocity; } + PxReal getMaxVelocity() const { return mCore.maxVelocity; } + + void setBendingActivationAngle(const PxReal angle) { mCore.mBendingActivationAngle = angle; } + PxReal getBendingActivationAngle() const { return mCore.mBendingActivationAngle; } + + void setNbCollisionPairUpdatesPerTimestep(const PxU32 frequency) { mCore.NbCollisionPairUpdatesPerTimestep = frequency; } + PxU32 getNbCollisionPairUpdatesPerTimestep() const { return mCore.NbCollisionPairUpdatesPerTimestep; } + + void setNbCollisionSubsteps(const PxU32 frequency) { mCore.nbCollisionSubsteps = frequency; } + PxU32 getNbCollisionSubsteps() const { return mCore.nbCollisionSubsteps; } + + PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; } + void setSolverIterationCounts(PxU16 c); + PxActor* getPxActor() const; + + void attachShapeCore(ShapeCore* shapeCore); + + PxReal getWakeCounter() const; + void setWakeCounter(const PxReal v); + void setWakeCounterInternal(const PxReal v); + + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + public: + + FEMClothSim* getSim() const; + + PX_FORCE_INLINE const Dy::FEMClothCore& getCore() const { return mCore; } + + PX_FORCE_INLINE Dy::FEMClothCore& getCore() { return mCore; } + + static PX_FORCE_INLINE FEMClothCore& getFEMClothCore(FEMClothCore& core) + { + size_t offset = PX_OFFSET_OF_RT(FEMClothCore, mCore); + return *reinterpret_cast(reinterpret_cast(&core) - offset); + } + + void setSimulationFilterData(const PxFilterData& data); + + PxFilterData getSimulationFilterData() const; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxFEMClothFlags getFlags() const { return mCore.mFlags; } + + void setFlags(PxFEMClothFlags flags) { mCore.mFlags = flags; } +#endif + + PxReal getRestVolumeScale() const { return mCore.mRestVolumeScale; } + + void setRestVolumeScale(PxReal scale) { mCore.mRestVolumeScale = scale; } + + PX_FORCE_INLINE PxU64& getGpuMemStat() { return mGpuMemStat; } + + void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags); + + private: + Dy::FEMClothCore mCore; + PxFilterData mFilterData; + PxU64 mGpuMemStat; + }; + + } // namespace Sc +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScHairSystemCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScHairSystemCore.h new file mode 100644 index 0000000..ab5c51d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScHairSystemCore.h @@ -0,0 +1,109 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_HAIR_SYSTEM_CORE_H +#define SC_HAIR_SYSTEM_CORE_H + +#include "PxHairSystemFlag.h" +#include "DyHairSystemCore.h" +#include "ScHairSystemShapeCore.h" + +#include "foundation/PxAssert.h" +#include "ScActorCore.h" + +namespace physx +{ + namespace Sc + { + class HairSystemSim; + class BodyCore; + + class HairSystemCore : public ActorCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + // PX_SERIALIZATION + public: + HairSystemCore(const PxEMPTY) : ActorCore(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + HairSystemCore(); + ~HairSystemCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + void setMaterial(const PxU16 handle); + void clearMaterials(); + + PxReal getContactOffset() const; + void setContactOffset(PxReal v); + + PxReal getSleepThreshold() const { return mShapeCore.getLLCore().mSleepThreshold; } + void setSleepThreshold(const PxReal v); + + PxU16 getSolverIterationCounts() const { return mShapeCore.getLLCore().mSolverIterationCounts; } + void setSolverIterationCounts(PxU16 c); + + PxReal getWakeCounter() const { return mShapeCore.getLLCore().mWakeCounter; } + void setWakeCounter(const PxReal v); + + bool isSleeping() const; + void wakeUp(PxReal wakeCounter); + void putToSleep(); + + PxActor* getPxActor() const; + + void addRigidAttachment(const Sc::BodyCore* core); + void removeRigidAttachment(const Sc::BodyCore* core); + + + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + public: + + HairSystemSim* getSim() const; + + PX_FORCE_INLINE const HairSystemShapeCore& getShapeCore() const { return mShapeCore; } + PX_FORCE_INLINE HairSystemShapeCore& getShapeCore() { return mShapeCore; } + + PxHairSystemFlags getFlags() const { return PxHairSystemFlags(mShapeCore.getLLCore().mParams.mFlags); } + + void setFlags(PxHairSystemFlags flags); + + private: + HairSystemShapeCore mShapeCore; + }; + } // namespace Sc +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScIterators.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScIterators.h new file mode 100644 index 0000000..cb52d83 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScIterators.h @@ -0,0 +1,112 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ITERATORS_H +#define SC_ITERATORS_H + +#include "foundation/PxVec3.h" +#include "PxContact.h" + +namespace physx +{ +class PxShape; +class PxsContactManagerOutputIterator; + +namespace Sc +{ + class ShapeSimBase; + class Interaction; + class ActorSim; + + struct Contact + { + Contact() + : normal(0.0f) + , point(0.0f) + , separation(0.0f) + , normalForce(0.0f) + {} + + PxVec3 normal; + PxVec3 point; + PxShape* shape0; + PxShape* shape1; + PxReal separation; + PxReal normalForce; + PxU32 faceIndex0; // these are the external indices + PxU32 faceIndex1; + bool normalForceAvailable; + }; + + class ContactIterator + { + public: + + class Pair + { + public: + Pair() : mIter(NULL, NULL, NULL, 0, 0) {} + Pair(const void*& contactPatches, const void*& contactPoints, const PxU32 /*contactDataSize*/, const PxReal*& forces, PxU32 numContacts, PxU32 numPatches, ShapeSimBase& shape0, ShapeSimBase& shape1, ActorSim* actor0, ActorSim* actor1); + Contact* getNextContact(); + PxActor* getActor0() { return mActor0; } + PxActor* getActor1() { return mActor1; } + + private: + PxU32 mIndex; + PxU32 mNumContacts; + PxContactStreamIterator mIter; + const PxReal* mForces; + Contact mCurrentContact; + PxActor* mActor0; + PxActor* mActor1; + }; + + ContactIterator() {} + explicit ContactIterator(Interaction** first, Interaction** last, PxsContactManagerOutputIterator& outputs): mCurrent(first), mLast(last), mOffset(0), mOutputs(&outputs) + { + if (!mCurrent) + { + mLast = NULL; + } + } + Pair* getNextPair(); + private: + Interaction** mCurrent; + Interaction** mLast; + Pair mCurrentPair; + PxU32 mOffset; + PxsContactManagerOutputIterator* mOutputs; + + private: + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScParticleSystemCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScParticleSystemCore.h new file mode 100644 index 0000000..f9c0517 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScParticleSystemCore.h @@ -0,0 +1,186 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_PARTICLESYSTEM_CORE_H +#define SC_PARTICLESYSTEM_CORE_H + +#include "PxParticleSystem.h" +#include "foundation/PxAssert.h" +#include "ScActorCore.h" +#include "ScShapeCore.h" +#include "PxFiltering.h" +#include "DyParticleSystem.h" +#include "ScParticleSystemShapeCore.h" + + +namespace physx +{ + + + namespace Sc + { + class ParticleSystemSim; + class BodyCore; + + class ParticleSystemCore : public ActorCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + + // PX_SERIALIZATION + public: + ParticleSystemCore(const PxEMPTY) : ActorCore(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + ParticleSystemCore(PxActorType::Enum actorType); + ~ParticleSystemCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + + PxReal getSleepThreshold() const; + void setSleepThreshold(const PxReal v); + + PxReal getRestOffset() const; + void setRestOffset(const PxReal v); + + PxReal getContactOffset() const; + void setContactOffset(const PxReal v); + + PxReal getParticleContactOffset() const; + void setParticleContactOffset(const PxReal v); + + PxReal getSolidRestOffset() const; + void setSolidRestOffset(const PxReal v); + + PxReal getFluidRestOffset() const; + void setFluidRestOffset(const PxReal v); + + PxReal getMaxDepenetrationVelocity() const; + void setMaxDepenetrationVelocity(const PxReal v); + + PxReal getMaxVelocity() const; + void setMaxVelocity(const PxReal v); + + PxParticleSystemCallback* getParticleSystemCallback() const; + void setParticleSystemCallback(PxParticleSystemCallback* callback); + + PxCustomParticleSystemSolverCallback* getParticleSystemSolverCallback() const; + void setParticleSystemSolverCallback(PxCustomParticleSystemSolverCallback* callback); + + PxReal getFluidBoundaryDensityScale() const; + void setFluidBoundaryDensityScale(const PxReal v); + + PxU32 getGridSizeX() const; + void setGridSizeX(const PxU32 v); + + PxU32 getGridSizeY() const; + void setGridSizeY(const PxU32 v); + + PxU32 getGridSizeZ() const; + void setGridSizeZ(const PxU32 v); + + PxU16 getSolverIterationCounts() const { return mShapeCore.getLLCore().solverIterationCounts; } + void setSolverIterationCounts(PxU16 c); + + + PxReal getWakeCounter() const; + void setWakeCounter(const PxReal v); + void setWakeCounterInternal(const PxReal v); + + bool isSleeping() const; + void wakeUp(PxReal wakeCounter); + void putToSleep(); + + PxActor* getPxActor() const; + + // TOFIX + void enableCCD(const bool enable); + + PxParticleFlags getFlags() const { return mShapeCore.getLLCore().mFlags; } + + //void setFlags(PxParticleFlags flags) { mShapeCore.getLLCore().mFlags = flags; } + void setFlags(PxParticleFlags flags); + + void setWind(const PxVec3& wind) {mShapeCore.getLLCore().mWind = wind;} + + PxVec3 getWind() const { return mShapeCore.getLLCore().mWind; } + + void setSolverType(const PxParticleSolverType::Enum solverType) { mShapeCore.getLLCore().solverType = solverType; } + PxParticleSolverType::Enum getSolverType() const { return mShapeCore.getLLCore().solverType; } + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + PxSparseGridParams getSparseGridParams() const { return mShapeCore.getLLCore().sparseGridParams; } + void setSparseGridParams(const PxSparseGridParams& params) { mShapeCore.getLLCore().sparseGridParams = params; } + + PxFLIPParams getFLIPParams() const { return mShapeCore.getLLCore().flipParams; } + void setFLIPParams(const PxFLIPParams& params) { mShapeCore.getLLCore().flipParams = params; } + + PxMPMParams getMPMParams() const { return mShapeCore.getLLCore().mpmParams; } + void setMPMParams(const PxMPMParams& params) { mShapeCore.getLLCore().mpmParams = params; } +#endif + + void addRigidAttachment(Sc::BodyCore* core); + + void removeRigidAttachment(Sc::BodyCore* core); + + void setPeriodicBoundary(const PxVec3& boundary) { mShapeCore.setPeriodicBoundary(boundary); } + + PxVec3 getPeriodicBoundary() const { return mShapeCore.getPeriodicBoundary(); } + + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + public: + ParticleSystemSim* getSim() const; + + PX_FORCE_INLINE const ParticleSystemShapeCore& getShapeCore() const { return mShapeCore; } + PX_FORCE_INLINE ParticleSystemShapeCore& getShapeCore() { return mShapeCore; } + + void setDirty(const bool dirty); + + private: + //ParticleSystemSim* mSim; + ParticleSystemShapeCore mShapeCore; + + }; + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScPhysics.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScPhysics.h new file mode 100644 index 0000000..d755bdb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScPhysics.h @@ -0,0 +1,130 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_PHYSICS_H +#define SC_PHYSICS_H + +#include "PxPhysics.h" +#include "PxScene.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBasicTemplates.h" +#include "PxActor.h" + +namespace physx +{ + +class PxMaterial; +class PxTolerancesScale; +struct PxvOffsetTable; + +#if PX_SUPPORT_GPU_PHYSX +class PxPhysXGpu; +#endif + +namespace Sc +{ + class Scene; + class StaticCore; + class RigidCore; + class BodyCore; + class ArticulationCore; + class ArticulationJointCore; + class ConstraintCore; + class ShapeCore; + + struct OffsetTable + { + PX_FORCE_INLINE OffsetTable() {} + + PX_FORCE_INLINE PxShape* convertScShape2Px(ShapeCore* sc) const { return PxPointerOffset(sc, scShape2Px); } + PX_FORCE_INLINE const PxShape* convertScShape2Px(const ShapeCore* sc) const { return PxPointerOffset(sc, scShape2Px); } + + PX_FORCE_INLINE PxConstraint* convertScConstraint2Px(ConstraintCore* sc) const { return PxPointerOffset(sc, scConstraint2Px); } + PX_FORCE_INLINE const PxConstraint* convertScConstraint2Px(const ConstraintCore* sc) const { return PxPointerOffset(sc, scConstraint2Px); } + + PX_FORCE_INLINE PxArticulationReducedCoordinate* convertScArticulation2Px(ArticulationCore* sc) const + { + return PxPointerOffset(sc, scArticulationRC2Px); + } + + PX_FORCE_INLINE const PxArticulationReducedCoordinate* convertScArticulation2Px(const ArticulationCore* sc) const + { + return PxPointerOffset(sc, scArticulationRC2Px); + } + + PX_FORCE_INLINE PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(ArticulationJointCore* sc) const + { + return PxPointerOffset(sc, scArticulationJointRC2Px); + } + + PX_FORCE_INLINE const PxArticulationJointReducedCoordinate* convertScArticulationJoint2Px(const ArticulationJointCore* sc) const + { + return PxPointerOffset(sc, scArticulationJointRC2Px); + } + + ptrdiff_t scRigidStatic2PxActor; + ptrdiff_t scRigidDynamic2PxActor; + ptrdiff_t scArticulationLink2PxActor; + ptrdiff_t scSoftBody2PxActor; + ptrdiff_t scPBDParticleSystem2PxActor; + ptrdiff_t scFLIPParticleSystem2PxActor; + ptrdiff_t scMPMParticleSystem2PxActor; + ptrdiff_t scCustomParticleSystem2PxActor; + ptrdiff_t scHairSystem2PxActor; + ptrdiff_t scShape2Px; + ptrdiff_t scArticulationRC2Px; + ptrdiff_t scArticulationJointRC2Px; + ptrdiff_t scConstraint2Px; + + ptrdiff_t scCore2PxActor[PxActorType::eACTOR_COUNT]; + }; + extern OffsetTable gOffsetTable; + + class Physics : public PxUserAllocated + { + public: + PX_FORCE_INLINE static Physics& getInstance() { return *mInstance; } + + Physics(const PxTolerancesScale&, const PxvOffsetTable& pxvOffsetTable); + ~Physics(); + + PX_FORCE_INLINE const PxTolerancesScale& getTolerancesScale() const { return mScale; } + + private: + PxTolerancesScale mScale; + static Physics* mInstance; + + public: + static const PxReal sWakeCounterOnCreation; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScRigidCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScRigidCore.h new file mode 100644 index 0000000..731db15 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScRigidCore.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_RIGID_CORE_H +#define SC_RIGID_CORE_H + +#include "ScActorCore.h" +#include "ScPhysics.h" +#include "PxvDynamics.h" +#include "PxShape.h" + +namespace physx +{ +namespace Sc +{ + class RigidSim; + class ShapeCore; + + struct ShapeChangeNotifyFlag + { + enum Enum + { + eGEOMETRY = 1<<0, + eMATERIAL = 1<<1, + eSHAPE2BODY = 1<<2, + eFILTERDATA = 1<<3, + eCONTACTOFFSET = 1<<4, + eRESTOFFSET = 1<<5, + eRESET_FILTERING = 1<<6 + }; + }; + typedef PxFlags ShapeChangeNotifyFlags; + PX_FLAGS_OPERATORS(ShapeChangeNotifyFlag::Enum,PxU32) + + class RigidCore : public ActorCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + + PX_FORCE_INLINE PxActor* getPxActor() const + { + return PxPointerOffset(const_cast(this), gOffsetTable.scCore2PxActor[getActorCoreType()]); + } + + void addShapeToScene(ShapeCore& shape); + void removeShapeFromScene(ShapeCore& shape, bool wakeOnLostTouch); + void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags); + void onShapeFlagsChange(ShapeCore& shape, PxShapeFlags oldShapeFlags); + void unregisterShapeFromNphase(ShapeCore& shapeCore); + void registerShapeInNphase(ShapeCore& shapeCore); + + RigidSim* getSim() const; + + PxU32 getRigidID() const; + static void getBinaryMetaData(PxOutputStream& stream); + protected: + RigidCore(const PxEMPTY) : ActorCore(PxEmpty) {} + RigidCore(PxActorType::Enum type); + ~RigidCore(); + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScScene.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScScene.h new file mode 100644 index 0000000..4708319 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScScene.h @@ -0,0 +1,1245 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SCENE_H +#define SC_SCENE_H + +#include "PxPhysXConfig.h" +#include "PxScene.h" +#include "PxSceneDesc.h" +#include "PxSimulationEventCallback.h" +#include "foundation/PxPool.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "CmTask.h" +#include "CmFlushPool.h" +#include "CmPreallocatingPool.h" +#include "foundation/PxBitMap.h" +#include "ScIterators.h" +#include "PxsMaterialManager.h" +#include "PxvManager.h" +#include "ScBodyCore.h" +#include "PxAggregate.h" +#include "PxsContext.h" +#include "PxsIslandSim.h" +#include "GuPrunerTypedef.h" + +#define PX_MAX_DOMINANCE_GROUP 32 + +class OverlapFilterTask; + +namespace physx +{ + class NpShape; + +// PT: TODO: move INVALID_FILTER_PAIR_INDEX out of public API +struct PxFilterInfo +{ + PX_FORCE_INLINE PxFilterInfo() : filterFlags(0), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {} + PX_FORCE_INLINE PxFilterInfo(PxFilterFlags filterFlags_) : filterFlags(filterFlags_), pairFlags(0), filterPairIndex(INVALID_FILTER_PAIR_INDEX) {} + + PxFilterFlags filterFlags; + PxPairFlags pairFlags; + PxU32 filterPairIndex; +}; + +struct PxTriggerPair; + +class PxsIslandManager; +class PxsSimulationController; +class PxsSimulationControllerCallback; +class PxsMemoryManager; + +struct PxConeLimitedConstraint; + +#if PX_SUPPORT_GPU_PHYSX +class PxsKernelWranglerManager; +class PxsHeapMemoryAllocatorManager; +#endif + +namespace IG +{ + class SimpleIslandManager; + class NodeIndex; + typedef PxU32 EdgeIndex; +} + +class PxsCCDContext; + +namespace Cm +{ + class IDPool; +} + +namespace Bp +{ + class AABBManagerBase; + class BroadPhase; + class BoundsArray; +} + +namespace Dy +{ + class FeatherstoneArticulation; + class Context; +#if PX_SUPPORT_GPU_PHYSX + class SoftBody; + class FEMCloth; + class ParticleSystem; + class HairSystem; +#endif +} + +namespace Sc +{ + class ActorSim; + class ElementSim; + class Interaction; + + class ShapeCore; + class RigidCore; + class StaticCore; + class ConstraintCore; + class ArticulationCore; + class ArticulationJointCore; + class ArticulationSpatialTendonCore; + class ArticulationFixedTendonCore; + class ArticulationSensorCore; + class LLArticulationPool; + class LLArticulationRCPool; + class LLSoftBodyPool; + class LLFEMClothPool; + class LLParticleSystemPool; + class LLHairSystemPool; + + class BodyCore; + class SoftBodyCore; + class FEMClothCore; + class ParticleSystemCore; + class HairSystemCore; + + class NPhaseCore; + class ConstraintInteraction; + + class BodySim; + class ShapeSim; + class RigidSim; + class StaticSim; + class ConstraintSim; + struct ConstraintGroupNode; + class ConstraintProjectionManager; + struct TriggerPairExtraData; + class ObjectIDTracker; + class ActorPairReport; + class ContactStreamManager; + class SqBoundsManager; + class ShapeInteraction; + class ElementInteractionMarker; + class ArticulationSim; + class SoftBodySim; + class FEMClothSim; + class ParticleSystemSim; + class HairSystemSim; + + class SimStats; + + struct SimStateData; + + struct BatchInsertionState + { + BodySim* bodySim; + StaticSim*staticSim; + ShapeSim* shapeSim; + ptrdiff_t staticActorOffset; + ptrdiff_t staticShapeTableOffset; + ptrdiff_t dynamicActorOffset; + ptrdiff_t dynamicShapeTableOffset; + ptrdiff_t shapeOffset; + }; + + struct BatchRemoveState + { + PxInlineArray bufferedShapes; + PxInlineArray removedShapes; + }; + + struct InteractionType + { + enum Enum + { + eOVERLAP = 0, // corresponds to ShapeInteraction + eTRIGGER, // corresponds to TriggerInteraction + eMARKER, // corresponds to ElementInteractionMarker + eTRACKED_IN_SCENE_COUNT, // not a real type, interactions above this limit are tracked in the scene + eCONSTRAINTSHADER, // corresponds to ConstraintInteraction + eARTICULATION, // corresponds to ArticulationJointSim + + eINVALID + }; + }; + + struct SceneInternalFlag + { + enum Enum + { + eSCENE_SIP_STATES_DIRTY_DOMINANCE = (1<<1), + eSCENE_SIP_STATES_DIRTY_VISUALIZATION = (1<<2), + eSCENE_DEFAULT = 0 + }; + }; + + struct SimulationStage + { + enum Enum + { + eCOMPLETE, + eCOLLIDE, + eFETCHCOLLIDE, + eADVANCE, + eFETCHRESULT + }; + }; + + struct SqBoundsSync; + struct SqRefFinder; + + struct ParticleOrSoftBodyRigidInteraction + { + IG::EdgeIndex mIndex; + PxU32 mCount; + + ParticleOrSoftBodyRigidInteraction() : mCount(0) {} + }; + + class Scene : public PxUserAllocated + { + struct SimpleBodyPair + { + ActorSim* body1; + ActorSim* body2; + PxU32 body1ID; + PxU32 body2ID; + }; + + PX_NOCOPY(Scene) + + //--------------------------------------------------------------------------------- + // External interface + //--------------------------------------------------------------------------------- + public: + void release(); + + PX_FORCE_INLINE void setGravity(const PxVec3& g) { mGravity = g; mBodyGravityDirty = true; } + PX_FORCE_INLINE PxVec3 getGravity() const { return mGravity; } + PX_FORCE_INLINE void setElapsedTime(const PxReal t) { mDt = t; mOneOverDt = t > 0.0f ? 1.0f/t : 0.0f; } + + void setBounceThresholdVelocity(const PxReal t); + PxReal getBounceThresholdVelocity() const; + + void setPublicFlags(PxSceneFlags flags); + PX_FORCE_INLINE PxSceneFlags getPublicFlags() const { return mPublicFlags; } + PX_FORCE_INLINE PxSceneFlags getFlags() const { return mPublicFlags; } + + PxSolverType::Enum getSolverType() const; + + void setFrictionType(PxFrictionType::Enum model); + PxFrictionType::Enum getFrictionType() const; + PX_FORCE_INLINE void setPCM(bool enabled) { mLLContext->setPCM(enabled); } + PX_FORCE_INLINE void setContactCache(bool enabled) { mLLContext->setContactCache(enabled); } + + void addStatic(StaticCore&, NpShape*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds); + void removeStatic(StaticCore&, PxInlineArray& removedShapes, bool wakeOnLostTouch); + + void addBody(BodyCore&, NpShape*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* uninflatedBounds, bool compound); + void removeBody(BodyCore&, PxInlineArray& removedShapes, bool wakeOnLostTouch); + + // Batch insertion API. + // the bounds generated here are the uninflated bounds for the shapes, *if* they are trigger or sim shapes. + // It's up to the caller to ensure the bounds array is big enough. + // Some care is required in handling these since sim and SQ tweak the bounds in slightly different ways. + + void startBatchInsertion(BatchInsertionState&); + void addStatic(PxActor* actor, BatchInsertionState&, PxBounds3* outBounds); + void addBody(PxActor* actor, BatchInsertionState&, PxBounds3* outBounds, bool compound); + void finishBatchInsertion(BatchInsertionState&); + + // Batch remove helpers + PX_FORCE_INLINE void setBatchRemove(BatchRemoveState* bs) { mBatchRemoveState = bs; } + PX_FORCE_INLINE BatchRemoveState* getBatchRemove() const { return mBatchRemoveState; } + + void addConstraint(ConstraintCore&, RigidCore*, RigidCore*); + void removeConstraint(ConstraintCore&); + + void addSoftBody(SoftBodyCore&); + void removeSoftBody(SoftBodyCore&); + + void addFEMCloth(FEMClothCore&); + void removeFEMCloth(FEMClothCore&); + + void addParticleSystem(ParticleSystemCore&); + void removeParticleSystem(ParticleSystemCore&); + + void addHairSystem(HairSystemCore&); + void removeHairSystem(HairSystemCore&); + + void addArticulation(ArticulationCore&, BodyCore& root); + void removeArticulation(ArticulationCore&); + + void addArticulationJoint(ArticulationJointCore&, BodyCore& parent, BodyCore& child); + void removeArticulationJoint(ArticulationJointCore&); + + void addArticulationTendon(ArticulationSpatialTendonCore&); + void removeArticulationTendon(ArticulationSpatialTendonCore&); + + void addArticulationTendon(ArticulationFixedTendonCore&); + void removeArticulationTendon(ArticulationFixedTendonCore&); + + void addArticulationSensor(ArticulationSensorCore&); + void removeArticulationSensor(ArticulationSensorCore&); + + void addArticulationSimControl(ArticulationCore& core); + void removeArticulationSimControl(ArticulationCore& core); + void addSoftBodySimControl(SoftBodyCore& core); + void removeSoftBodySimControl(SoftBodyCore& core); + void addFEMClothSimControl(FEMClothCore& core); + void removeFEMClothSimControl(FEMClothCore& core); + void addParticleSystemSimControl(ParticleSystemCore& core); + void removeParticleSystemSimControl(ParticleSystemCore& core); + void addHairSystemSimControl(HairSystemCore& core); + void removeHairSystemSimControl(HairSystemCore& core); + + void updateBodySim(BodySim& sim); + + PX_FORCE_INLINE PxU32 getNbArticulations() const { return mArticulations.size(); } + PX_FORCE_INLINE ArticulationCore* const* getArticulations() { return mArticulations.getEntries(); } + +#if PX_SUPPORT_GPU_PHYSX + PX_FORCE_INLINE PxU32 getNbSoftBodies() const { return mSoftBodies.size(); } + PX_FORCE_INLINE SoftBodyCore* const* getSoftBodies() { return mSoftBodies.getEntries(); } + + PX_FORCE_INLINE PxU32 getNbFEMCloths() const { return mFEMCloths.size(); } + PX_FORCE_INLINE FEMClothCore* const* getFEMCloths() { return mFEMCloths.getEntries(); } + + PX_FORCE_INLINE PxU32 getNbParticleSystems() const { return mParticleSystems.size(); } + PX_FORCE_INLINE ParticleSystemCore* const* getParticleSystems() { return mParticleSystems.getEntries(); } + + PX_FORCE_INLINE PxU32 getNbHairSystems() const { return mHairSystems.size(); } + PX_FORCE_INLINE HairSystemCore* const* getHairSystems() { return mHairSystems.getEntries(); } +#endif + + PX_FORCE_INLINE PxU32 getNbConstraints() const { return mConstraints.size(); } + PX_FORCE_INLINE ConstraintCore*const* getConstraints() const { return mConstraints.getEntries(); } + PX_FORCE_INLINE ConstraintCore*const* getConstraints() { return mConstraints.getEntries(); } + + void initContactsIterator(ContactIterator&, PxsContactManagerOutputIterator&); + + // Simulation events + void setSimulationEventCallback(PxSimulationEventCallback* callback); + PxSimulationEventCallback* getSimulationEventCallback() const; + + // Contact modification + PX_FORCE_INLINE void setContactModifyCallback(PxContactModifyCallback* callback) { mLLContext->setContactModifyCallback(callback); } + PX_FORCE_INLINE PxContactModifyCallback* getContactModifyCallback() const { return mLLContext->getContactModifyCallback(); } + + void setCCDContactModifyCallback(PxCCDContactModifyCallback* callback); + PxCCDContactModifyCallback* getCCDContactModifyCallback() const; + + void setCCDMaxPasses(PxU32 ccdMaxPasses); + PxU32 getCCDMaxPasses() const; + + void setCCDThreshold(PxReal t); + PxReal getCCDThreshold() const; + + // Broad-phase callback + PX_FORCE_INLINE void setBroadPhaseCallback(PxBroadPhaseCallback* callback) { mBroadPhaseCallback = callback; } + PX_FORCE_INLINE PxBroadPhaseCallback* getBroadPhaseCallback() const { return mBroadPhaseCallback; } + + // Broad-phase management + void finishBroadPhase(PxBaseTask* continuation); + void finishBroadPhaseStage2(const PxU32 ccdPass); + void preallocateContactManagers(PxBaseTask* continuation); + + void islandInsertion(PxBaseTask* continuation); + void registerContactManagers(PxBaseTask* continuation); + void registerInteractions(PxBaseTask* continuation); + void registerSceneInteractions(PxBaseTask* continuation); + + void secondPassNarrowPhase(PxBaseTask* continuation); + + // Groups + void setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance); + PxDominanceGroupPair getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const; + + void setSolverBatchSize(PxU32 solverBatchSize); + PxU32 getSolverBatchSize() const; + + void setSolverArticBatchSize(PxU32 solverBatchSize); + PxU32 getSolverArticBatchSize() const; + + void setDynamicsDirty(); + + PX_FORCE_INLINE void setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value) + { + mVisualizationParameterChanged = true; + mLLContext->setVisualizationParameter(param, value); + } + + PX_FORCE_INLINE PxReal getVisualizationParameter(PxVisualizationParameter::Enum param) const { return mLLContext->getVisualizationParameter(param); } + PX_FORCE_INLINE void setVisualizationCullingBox(const PxBounds3& box) { mLLContext->setVisualizationCullingBox(box); } + PX_FORCE_INLINE const PxBounds3& getVisualizationCullingBox() const { return mLLContext->getVisualizationCullingBox(); } + PX_FORCE_INLINE PxReal getVisualizationScale() const { return mLLContext->getRenderScale(); } + + // Run + void simulate(PxReal timeStep, PxBaseTask* continuation); + void advance(PxReal timeStep, PxBaseTask* continuation); + void collide(PxReal timeStep, PxBaseTask* continuation); + void endSimulation(); + void flush(bool sendPendingReports); + void fireBrokenConstraintCallbacks(); + void fireTriggerCallbacks(); + void fireQueuedContactCallbacks(); + void fireOnAdvanceCallback(); + + const PxArray& + getQueuedContactPairHeaders(); + + bool fireOutOfBoundsCallbacks(); + void prepareOutOfBoundsCallbacks(); + void postCallbacksPreSync(); + void postReportsCleanup(); + void fireCallbacksPostSync(); + void syncSceneQueryBounds(SqBoundsSync& sync, SqRefFinder& finder); + + PxU32 getDefaultContactReportStreamBufferSize() const; + + void setCCDMaxSeparation(PxReal separation); + PxReal getCCDMaxSeparation() const; + void setMaxBiasCoefficient(PxReal coeff); + PxReal getMaxBiasCoefficient() const; + void setFrictionOffsetThreshold(PxReal t); + PxReal getFrictionOffsetThreshold() const; + void setFrictionCorrelationDistance(PxReal t); + PxReal getFrictionCorrelationDistance() const; + + PX_FORCE_INLINE void setLimits(const PxSceneLimits& limits) { mLimits = limits; } + PX_FORCE_INLINE const PxSceneLimits& getLimits() const { return mLimits; } + + void visualizeStartStep(); + PX_FORCE_INLINE PxRenderBuffer& getRenderBuffer() { return mLLContext->getRenderBuffer(); } + + void setNbContactDataBlocks(PxU32 blockCount); + PxU32 getNbContactDataBlocksUsed() const; + PxU32 getMaxNbContactDataBlocksUsed() const; + PxU32 getMaxNbConstraintDataBlocksUsed() const; + + void setMaxArticulationLinks(const PxU32 maxLinks) { mMaxNbArticulationLinks = maxLinks; } + PxU32 getMaxArticulationLinks() const { return mMaxNbArticulationLinks; } + + void setScratchBlock(void* addr, PxU32 size); + +// PX_ENABLE_SIM_STATS + void getStats(PxSimulationStatistics& stats) const; + PX_FORCE_INLINE SimStats& getStatsInternal() { return *mStats; } +// PX_ENABLE_SIM_STATS + + void buildActiveActors(); + void buildActiveAndFrozenActors(); + PxActor** getActiveActors(PxU32& nbActorsOut); + void setActiveActors(PxActor** actors, PxU32 nbActors); + + PxActor** getActiveSoftBodyActors(PxU32& nbActorsOut); + void setActiveSoftBodyActors(PxActor** actors, PxU32 nbActors); + + //PxActor** getActiveFEMClothActors(PxU32& nbActorsOut); + //void setActiveFEMClothActors(PxActor** actors, PxU32 nbActors); + + PxActor** getFrozenActors(PxU32& nbActorsOut); + + void finalizeContactStreamAndCreateHeader(PxContactPairHeader& header, + const ActorPairReport& aPair, + ContactStreamManager& cs, PxU32 removedShapeTestMask); + + PxTaskManager* getTaskManagerPtr() const { return mTaskManager; } + PxCudaContextManager* getCudaContextManager() const { return mCudaContextManager; } + + void shiftOrigin(const PxVec3& shift); + + PX_FORCE_INLINE PxPool* getSimStateDataPool() { return mSimStateDataPool; } + + PX_FORCE_INLINE bool isCollisionPhaseActive() const { return mIsCollisionPhaseActive; } + PX_FORCE_INLINE void setCollisionPhaseToActive() { PX_ASSERT(!mIsCollisionPhaseActive); mIsCollisionPhaseActive = true; } + PX_FORCE_INLINE void setCollisionPhaseToInactive() { PX_ASSERT(mIsCollisionPhaseActive); mIsCollisionPhaseActive = false; } + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + //internal public methods: + public: + Scene(const PxSceneDesc& desc, PxU64 contextID); + ~Scene() {} //use release() plz. + + void preAllocate(PxU32 nbStatics, PxU32 nbBodies, PxU32 nbStaticShapes, PxU32 nbDynamicShapes); + + PX_FORCE_INLINE PxsContext* getLowLevelContext() { return mLLContext; } + PX_FORCE_INLINE const PxsContext* getLowLevelContext() const { return mLLContext; } + + PX_FORCE_INLINE Dy::Context* getDynamicsContext() { return mDynamicsContext; } + PX_FORCE_INLINE const Dy::Context* getDynamicsContext() const { return mDynamicsContext; } + + PX_FORCE_INLINE PxsSimulationController* getSimulationController() { return mSimulationController; } + PX_FORCE_INLINE const PxsSimulationController* getSimulationController() const { return mSimulationController; } + + PX_FORCE_INLINE Bp::AABBManagerBase* getAABBManager() { return mAABBManager; } + PX_FORCE_INLINE const Bp::AABBManagerBase* getAABBManager() const { return mAABBManager; } + PX_FORCE_INLINE PxArray& getCcdBodies() { return mCcdBodies; } + + PX_FORCE_INLINE IG::SimpleIslandManager* getSimpleIslandManager() { return mSimpleIslandManager; } + PX_FORCE_INLINE const IG::SimpleIslandManager* getSimpleIslandManager() const { return mSimpleIslandManager; } + + PX_FORCE_INLINE SimulationStage::Enum getSimulationStage() const { return mSimulationStage; } + PX_FORCE_INLINE void setSimulationStage(SimulationStage::Enum stage) { mSimulationStage = stage; } + + void addShape_(RigidSim&, ShapeCore&); + void removeShape_(ShapeSim&, bool wakeOnLostTouch); + + void registerShapeInNphase(RigidCore* rigidCore, const ShapeCore& shapeCore, const PxU32 transformCacheID); + void unregisterShapeFromNphase(const ShapeCore& shapeCore, const PxU32 transformCacheID); + + void notifyNphaseOnUpdateShapeMaterial(const ShapeCore& shapeCore); + + // Get an array of the active actors. + PX_FORCE_INLINE BodyCore*const* getActiveBodiesArray() const { return mActiveBodies.begin(); } + PX_FORCE_INLINE PxU32 getNumActiveBodies() const { return mActiveBodies.size(); } + +#if PX_SUPPORT_GPU_PHYSX + PX_FORCE_INLINE SoftBodyCore*const* getActiveSoftBodiesArray() const { return mActiveSoftBodies.begin(); } + PX_FORCE_INLINE PxU32 getNumActiveSoftBodies() const { return mActiveSoftBodies.size(); } + + PX_FORCE_INLINE FEMClothCore*const* getActiveFEMClothsArray() const { return mActiveFEMCloths.begin(); } + PX_FORCE_INLINE PxU32 getNumActiveFEMCloths() const { return mActiveFEMCloths.size(); } + + PX_FORCE_INLINE HairSystemCore*const* getActiveHairSystemsArray() const { return mActiveHairSystems.begin(); } + PX_FORCE_INLINE PxU32 getNumActiveHairSystems() const { return mActiveHairSystems.size(); } +#endif + + PX_FORCE_INLINE BodyCore*const* getActiveCompoundBodiesArray() const { return mActiveCompoundBodies.begin(); } + PX_FORCE_INLINE PxU32 getNumActiveCompoundBodies() const { return mActiveCompoundBodies.size(); } + + PX_FORCE_INLINE PxU32 getNbInteractions(InteractionType::Enum type) const { return mInteractions[type].size(); } + PX_FORCE_INLINE PxU32 getNbActiveInteractions(InteractionType::Enum type) const { return mActiveInteractionCount[type]; } + // Get all interactions of a certain type + PX_FORCE_INLINE Interaction** getInteractions(InteractionType::Enum type) { return mInteractions[type].begin(); } + PX_FORCE_INLINE Interaction** getActiveInteractions(InteractionType::Enum type) { return mInteractions[type].begin(); } + + void registerInteraction(Interaction* interaction, bool active); + void unregisterInteraction(Interaction* interaction); + + void notifyInteractionActivated(Interaction* interaction); + void notifyInteractionDeactivated(Interaction* interaction); + + // for pool management of interaction arrays, a major cause of dynamic allocation + void** allocatePointerBlock(PxU32 size); + void deallocatePointerBlock(void**, PxU32 size); + private: + // Get the number of active one-way dominator actors + PX_FORCE_INLINE PxU32 getActiveKinematicBodiesCount() const { return mActiveKinematicBodyCount; } + + // Get an iterator to the active one-way dominator actors + PX_FORCE_INLINE BodyCore*const* getActiveKinematicBodies() const { return mActiveBodies.begin(); } + + // Get the number of active non-kinematic actors + PX_FORCE_INLINE PxU32 getActiveDynamicBodiesCount() const { return mActiveBodies.size() - mActiveKinematicBodyCount; } + + // Get the active non-kinematic actors + PX_FORCE_INLINE BodyCore*const* getActiveDynamicBodies() const { return mActiveBodies.begin() + mActiveKinematicBodyCount; } + +#if PX_SUPPORT_GPU_PHYSX + // Get the active soft body actors + PX_FORCE_INLINE SoftBodyCore*const* getActiveSoftBodies() const { return mActiveSoftBodies.begin(); } + + // Get the active FEM-cloth actors + PX_FORCE_INLINE FEMClothCore*const* getActiveFEMCloths() const { return mActiveFEMCloths.begin(); } +#endif + + void swapInteractionArrayIndices(PxU32 id1, PxU32 id2, InteractionType::Enum type); + public: + PxReal getLengthScale() const; + + PX_FORCE_INLINE PxBitMap& getDirtyShapeSimMap() { return mDirtyShapeSimMap; } + + void addDirtyArticulationSim(ArticulationSim* artiSim); + void removeDirtyArticulationSim(ArticulationSim* artiSim); + + void addToActiveList(ActorSim& actor); + void removeFromActiveList(ActorSim& actor); + void removeFromActiveCompoundBodyList(BodySim& actor); + void swapInActiveBodyList(BodySim& body); // call when an active body gets switched from dynamic to kinematic or vice versa + + void addBrokenConstraint(ConstraintCore*); + void addActiveBreakableConstraint(ConstraintSim*, ConstraintInteraction*); + void removeActiveBreakableConstraint(ConstraintSim*); + //the Actor should register its top level shapes with these. + void removeBody(BodySim&); + + void raiseSceneFlag(SceneInternalFlag::Enum flag) { mInternalFlags |= flag; } + + //lists of actors woken up or put to sleep last simulate + void onBodyWakeUp(BodySim* body); + void onBodySleep(BodySim* body); + + PX_FORCE_INLINE bool isValid() const { return (mLLContext != NULL); } + + void addToLostTouchList(ActorSim& body1, ActorSim& body2); + + PxU32 createAggregate(void* userData, PxU32 maxNumShapes, PxAggregateFilterHint filterHint); + + void deleteAggregate(PxU32 id); + + Dy::FeatherstoneArticulation* createLLArticulation(ArticulationSim* sim); + void destroyLLArticulation(Dy::FeatherstoneArticulation&); + +#if PX_SUPPORT_GPU_PHYSX + Dy::SoftBody* createLLSoftBody(SoftBodySim* sim); + void destroyLLSoftBody(Dy::SoftBody& softBody); + + Dy::FEMCloth* createLLFEMCloth(FEMClothSim* sim); + void destroyLLFEMCloth(Dy::FEMCloth& femCloth); + + Dy::ParticleSystem* createLLParticleSystem(ParticleSystemSim* sim); + void destroyLLParticleSystem(Dy::ParticleSystem& softBody); + + Dy::HairSystem* createLLHairSystem(HairSystemSim* sim); + void destroyLLHairSystem(Dy::HairSystem& hairSystem); +#endif + + PX_FORCE_INLINE PxPool* getConstraintInteractionPool() const { return mConstraintInteractionPool; } + public: + PX_FORCE_INLINE const PxsMaterialManager& getMaterialManager() const { return mMaterialManager; } + PX_FORCE_INLINE PxsMaterialManager& getMaterialManager() { return mMaterialManager; } +#if PX_SUPPORT_GPU_PHYSX + PX_FORCE_INLINE const PxsFEMMaterialManager& getFEMMaterialManager() const { return mFEMMaterialManager; } + PX_FORCE_INLINE PxsFEMMaterialManager& getFEMMaterialManager() { return mFEMMaterialManager; } + + PX_FORCE_INLINE const PxsFEMClothMaterialManager& getFEMClothMaterialManager() const { return mFEMClothMaterialManager; } + PX_FORCE_INLINE PxsFEMClothMaterialManager& getFEMClothMaterialManager() { return mFEMClothMaterialManager; } + + PX_FORCE_INLINE const PxsPBDMaterialManager& getPBDMaterialManager() const { return mPBDMaterialManager; } + PX_FORCE_INLINE PxsPBDMaterialManager& getPBDMaterialManager() { return mPBDMaterialManager; } + + PX_FORCE_INLINE const PxsFLIPMaterialManager& getFLIPMaterialManager() const { return mFLIPMaterialManager; } + PX_FORCE_INLINE PxsFLIPMaterialManager& getFLIPMaterialManager() { return mFLIPMaterialManager; } + + PX_FORCE_INLINE const PxsMPMMaterialManager& getMPMMaterialManager() const { return mMPMMaterialManager; } + PX_FORCE_INLINE PxsMPMMaterialManager& getMPMMaterialManager() { return mMPMMaterialManager; } + + PX_FORCE_INLINE const PxsCustomMaterialManager& getCustomMaterialManager() const { return mCustomMaterialManager; } + PX_FORCE_INLINE PxsCustomMaterialManager& getCustomMaterialManager() { return mCustomMaterialManager; } +#endif + // Collision filtering + void setFilterShaderData(const void* data, PxU32 dataSize); + PX_FORCE_INLINE const void* getFilterShaderDataFast() const { return mFilterShaderData; } + PX_FORCE_INLINE PxU32 getFilterShaderDataSizeFast() const { return mFilterShaderDataSize; } + PX_FORCE_INLINE PxSimulationFilterShader getFilterShaderFast() const { return mFilterShader; } + PX_FORCE_INLINE PxSimulationFilterCallback* getFilterCallbackFast() const { return mFilterCallback; } + PX_FORCE_INLINE PxPairFilteringMode::Enum getKineKineFilteringMode() const { return mKineKineFilteringMode; } + PX_FORCE_INLINE PxPairFilteringMode::Enum getStaticKineFilteringMode() const { return mStaticKineFilteringMode; } + + PX_FORCE_INLINE PxU32 getTimeStamp() const { return mTimeStamp; } + PX_FORCE_INLINE PxU32 getReportShapePairTimeStamp() const { return mReportShapePairTimeStamp; } + + PX_FORCE_INLINE PxReal getOneOverDt() const { return mOneOverDt; } + PX_FORCE_INLINE PxReal getDt() const { return mDt; } + + PX_FORCE_INLINE const PxVec3& getGravityFast() const { return mGravity; } + PX_FORCE_INLINE bool readFlag(SceneInternalFlag::Enum flag) const { return (mInternalFlags & flag) != 0; } + PX_FORCE_INLINE bool readPublicFlag(PxSceneFlag::Enum flag) const { return (mPublicFlags & flag); } + + PX_FORCE_INLINE NPhaseCore* getNPhaseCore() const { return mNPhaseCore; } + + void checkConstraintBreakage(); + + PX_FORCE_INLINE PxArray& + getTriggerBufferExtraData() { return *mTriggerBufferExtraData; } + PX_FORCE_INLINE PxArray& getTriggerBufferAPI() { return mTriggerBufferAPI; } + void reserveTriggerReportBufferSpace(const PxU32 pairCount, PxTriggerPair*& triggerPairBuffer, TriggerPairExtraData*& triggerPairExtraBuffer); + + PX_FORCE_INLINE ObjectIDTracker& getActorIDTracker() { return *mActorIDTracker; } + + PX_FORCE_INLINE void markReleasedBodyIDForLostTouch(PxU32 id) { mLostTouchPairsDeletedBodyIDs.growAndSet(id); } + void resizeReleasedBodyIDMaps(PxU32 maxActors, PxU32 numActors); + + PX_FORCE_INLINE StaticSim& getStaticAnchor() { return *mStaticAnchor; } + + PX_FORCE_INLINE ConstraintProjectionManager& getProjectionManager() { return *mProjectionManager; } + + PX_FORCE_INLINE Bp::BoundsArray& getBoundsArray() const { return *mBoundsArray; } + PX_FORCE_INLINE void updateContactDistance(PxU32 idx, PxReal distance) { (*mContactDistance)[idx] = distance; mHasContactDistanceChanged = true; } + PX_FORCE_INLINE SqBoundsManager& getSqBoundsManager() const { return *mSqBoundsManager; } + + PX_FORCE_INLINE BodyCore* const* getSleepBodiesArray(PxU32& count) { count = mSleepBodies.size(); return mSleepBodies.getEntries(); } + + PX_FORCE_INLINE SoftBodyCore* const* getSleepSoftBodiesArray(PxU32& count) { count = mSleepSoftBodies.size(); return mSleepSoftBodies.getEntries(); } + + PX_FORCE_INLINE PxTaskManager& getTaskManager() const { PX_ASSERT(mTaskManager); return *mTaskManager; } + + Cm::FlushPool* getFlushPool(); + + PX_FORCE_INLINE bool getStabilizationEnabled() const { return mEnableStabilization; } + + PX_FORCE_INLINE void setPostSolverVelocityNeeded() { mContactReportsNeedPostSolverVelocity = true; } + + PX_FORCE_INLINE ObjectIDTracker& getConstraintIDTracker() { return *mConstraintIDTracker; } + PX_FORCE_INLINE ObjectIDTracker& getElementIDPool() { return *mElementIDPool; } + PX_FORCE_INLINE PxBitMap& getVelocityModifyMap() { return mVelocityModifyMap; } + + void* allocateConstraintBlock(PxU32 size); + void deallocateConstraintBlock(void* addr, PxU32 size); + + void stepSetupCollide(PxBaseTask* continuation);//This is very important to guarantee thread safty in the collide + PX_FORCE_INLINE void addToPosePreviewList(BodySim& b) { PX_ASSERT(!mPosePreviewBodies.contains(&b)); mPosePreviewBodies.insert(&b); } + PX_FORCE_INLINE void removeFromPosePreviewList(BodySim& b) { PX_ASSERT(mPosePreviewBodies.contains(&b)); mPosePreviewBodies.erase(&b); } +#if PX_DEBUG + PX_FORCE_INLINE bool isInPosePreviewList(BodySim& b) const { return mPosePreviewBodies.contains(&b); } +#endif + + PX_FORCE_INLINE void setSpeculativeCCDRigidBody(const PxU32 index) { mSpeculativeCCDRigidBodyBitMap.growAndSet(index); } + PX_FORCE_INLINE void resetSpeculativeCCDRigidBody(const PxU32 index) { if(index < mSpeculativeCCDRigidBodyBitMap.size()) mSpeculativeCCDRigidBodyBitMap.reset(index); } + + PX_FORCE_INLINE void setSpeculativeCCDArticulationLink(const PxU32 index) { mSpeculativeCDDArticulationBitMap.growAndSet(index); } + PX_FORCE_INLINE void resetSpeculativeCCDArticulationLink(const PxU32 index) { if(index < mSpeculativeCDDArticulationBitMap.size()) mSpeculativeCDDArticulationBitMap.reset(index); } + + PX_FORCE_INLINE PxU64 getContextId() const { return mContextId; } + PX_FORCE_INLINE bool isUsingGpuDynamicsOrBp() const { return mUseGpuBp || mUseGpuDynamics; } + PX_FORCE_INLINE bool isUsingGpuDynamicsAndBp() const { return mUseGpuBp && mUseGpuDynamics; } + PX_FORCE_INLINE bool isUsingGpuDynamics() const { return mUseGpuDynamics; } + PX_FORCE_INLINE bool isUsingGpuBp() const { return mUseGpuBp; } + + // statistics counters increase/decrease + PX_FORCE_INLINE void increaseNumKinematicsCounter() { mNbRigidKinematic++; } + PX_FORCE_INLINE void decreaseNumKinematicsCounter() { mNbRigidKinematic--; } + PX_FORCE_INLINE void increaseNumDynamicsCounter() { mNbRigidDynamics++; } + PX_FORCE_INLINE void decreaseNumDynamicsCounter() { mNbRigidDynamics--; } + + void addParticleFilter(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId); + void removeParticleFilter(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId); + + PxU32 addParticleAttachment(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentric); + void removeParticleAttachment(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 handle); + + void addRigidFilter(BodyCore* core, SoftBodySim& sim, PxU32 vertId); + void removeRigidFilter(BodyCore* core, SoftBodySim& sim, PxU32 vertId); + + PxU32 addRigidAttachment(BodyCore* core, SoftBodySim& sim, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeRigidAttachment(BodyCore* core, SoftBodySim& sim, PxU32 handle); + + void addTetRigidFilter(BodyCore* core, SoftBodySim& sim, PxU32 tetIdx); + void removeTetRigidFilter(BodyCore* core, SoftBodySim& sim, PxU32 tetIdx); + + PxU32 addTetRigidAttachment(BodyCore* core, SoftBodySim& sim, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + + void addSoftBodyFilter(SoftBodyCore& core, PxU32 tetIdx0, SoftBodySim& sim, PxU32 tetIdx1); + void removeSoftBodyFilter(SoftBodyCore& core, PxU32 tetIdx0, SoftBodySim& sim, PxU32 tetIdx1); + void addSoftBodyFilters(SoftBodyCore& core, SoftBodySim& sim, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + void removeSoftBodyFilters(SoftBodyCore& core, SoftBodySim& sim, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + + PxU32 addSoftBodyAttachment(SoftBodyCore& core, PxU32 tetIdx0, const PxVec4& triBarycentric0, SoftBodySim& sim, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint); + void removeSoftBodyAttachment(SoftBodyCore& core, SoftBodySim& sim, PxU32 handle); + + void addClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, Sc::SoftBodySim& sim, PxU32 tetIdx); + void removeClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, Sc::SoftBodySim& sim, PxU32 tetIdx); + + PxU32 addClothAttachment(FEMClothCore& core, PxU32 triIdx, const PxVec4& triBarycentric, SoftBodySim& sim, PxU32 tetIdx, const PxVec4& tetBarycentric, + PxConeLimitedConstraint* constraint); + void removeClothAttachment(FEMClothCore& core, SoftBodySim& sim, PxU32 handle); + + void addRigidFilter(BodyCore* core, FEMClothSim& sim, PxU32 vertId); + void removeRigidFilter(BodyCore* core, FEMClothSim& sim, PxU32 vertId); + + PxU32 addRigidAttachment(BodyCore* core, FEMClothSim& sim, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeRigidAttachment(BodyCore* core, FEMClothSim& sim, PxU32 handle); + + void addClothFilter(FEMClothCore& core0, PxU32 triIdx0, Sc::FEMClothSim& sim1, PxU32 triIdx1); + void removeClothFilter(FEMClothCore& core, PxU32 triIdx0, FEMClothSim& sim1, PxU32 triIdx1); + + PxU32 addTriClothAttachment(FEMClothCore& core0, PxU32 triIdx0, const PxVec4& barycentric0, Sc::FEMClothSim& sim1, PxU32 triIdx1, const PxVec4& barycentric1); + void removeTriClothAttachment(FEMClothCore& core, FEMClothSim& sim1, PxU32 handle); + + void addTriRigidFilter(BodyCore* core, FEMClothSim& sim, PxU32 triIdx); + void removeTriRigidFilter(BodyCore* core, FEMClothSim& sim, PxU32 triIdx); + + PxU32 addTriRigidAttachment(BodyCore* core, FEMClothSim& sim, PxU32 triIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeTriRigidAttachment(BodyCore* core, FEMClothSim& sim, PxU32 handle); + + void addRigidAttachment(BodyCore* core, ParticleSystemSim& sim); + void removeRigidAttachment(BodyCore* core, ParticleSystemSim& sim); + + void addRigidAttachment(const BodyCore* core, const HairSystemSim& sim); + void removeRigidAttachment(const BodyCore* core, const HairSystemSim& sim); + + ConstraintCore* findConstraintCore(const ActorSim* sim0, const ActorSim* sim1); + + //internal private methods: + private: + void activateEdgesInternal(const IG::EdgeIndex* activatingEdges, const PxU32 nbActivatingEdges); + void releaseConstraints(bool endOfScene); + PX_INLINE void clearBrokenConstraintBuffer(); + + ///////////////////////////////////////////////////////////// + + void prepareCollide(); + + void collideStep(PxBaseTask* continuation); + void advanceStep(PxBaseTask* continuation); + + // subroutines of collideStep/solveStep: + void kinematicsSetup(PxBaseTask* continuation); + void stepSetupSolve(PxBaseTask* continuation); + //void stepSetupSimulate(); + + void fetchPatchEvents(PxBaseTask*); + void processNarrowPhaseTouchEvents(); + void processNarrowPhaseTouchEventsStage2(PxBaseTask*); + void setEdgesConnected(PxBaseTask*); + void processNarrowPhaseLostTouchEvents(PxBaseTask*); + void processNarrowPhaseLostTouchEventsIslands(PxBaseTask*); + void processLostTouchPairs(); + void integrateKinematicPose(); + void updateKinematicCached(PxBaseTask* task); + + void beforeSolver(PxBaseTask* continuation); + void checkForceThresholdContactEvents(const PxU32 ccdPass); + void endStep(); + private: + void putObjectsToSleep(PxU32 infoFlag); + void wakeObjectsUp(PxU32 infoFlag); + + void collectPostSolverVelocitiesBeforeCCD(); + + void clearSleepWakeBodies(void); + PX_INLINE void cleanUpSleepBodies(); + PX_INLINE void cleanUpWokenBodies(); + PX_INLINE void cleanUpSleepOrWokenBodies(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker); + +#if PX_SUPPORT_GPU_PHYSX + // PT: TODO: why inline these ones? + PX_INLINE void cleanUpSleepSoftBodies(); + PX_INLINE void cleanUpWokenSoftBodies(); + PX_INLINE void cleanUpSleepOrWokenSoftBodies(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker); + + PX_INLINE void cleanUpSleepHairSystems(); + PX_INLINE void cleanUpWokenHairSystems(); + PX_INLINE void cleanUpSleepOrWokenHairSystems(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker); +#endif + + //internal variables: + private: + // Material manager + PX_ALIGN(16, PxsMaterialManager mMaterialManager); +#if PX_SUPPORT_GPU_PHYSX + PX_ALIGN(16, PxsFEMMaterialManager mFEMMaterialManager); + + PX_ALIGN(16, PxsFEMClothMaterialManager mFEMClothMaterialManager); + + PX_ALIGN(16, PxsPBDMaterialManager mPBDMaterialManager); + + PX_ALIGN(16, PxsFLIPMaterialManager mFLIPMaterialManager); + + PX_ALIGN(16, PxsMPMMaterialManager mMPMMaterialManager); + + PX_ALIGN(16, PxsCustomMaterialManager mCustomMaterialManager); +#endif + PxU64 mContextId; + + PxArray mActiveBodies; // Sorted: kinematic before dynamic + PxU32 mActiveKinematicBodyCount; // Number of active kinematics. This is also the index in mActiveBodies where the active dynamic bodies start. + PxU32 mActiveDynamicBodyCount; // Number of active dynamics. This is also the index in mActiveBodies where the active soft bodies start. + PxArray mActiveCompoundBodies; + + BodyCore** mActiveKinematicsCopy; + PxU32 mActiveKinematicsCopyCapacity; + +#if PX_SUPPORT_GPU_PHYSX + PxArray mActiveSoftBodies; + PxArray mActiveFEMCloths; + PxArray mActiveParticleSystems; + PxArray mActiveHairSystems; +#endif + PxArray mInteractions[InteractionType::eTRACKED_IN_SCENE_COUNT]; + PxU32 mActiveInteractionCount[InteractionType::eTRACKED_IN_SCENE_COUNT]; // Interactions with id < activeInteractionCount are active + + template + struct Block + { + PxU8 mem[sizeof(T)*size]; + Block() {} // get around VS warning C4345, otherwise useless + }; + + typedef Block PointerBlock8; + typedef Block PointerBlock16; + typedef Block PointerBlock32; + + PxPool mPointerBlock8Pool; + PxPool mPointerBlock16Pool; + PxPool mPointerBlock32Pool; + + PxsContext* mLLContext; + + Bp::AABBManagerBase* mAABBManager; + PxsCCDContext* mCCDContext; + PxI32 mNumFastMovingShapes; + PxU32 mCCDPass; + + //PxsIslandManager* mIslandManager; + + IG::SimpleIslandManager* mSimpleIslandManager; + + Dy::Context* mDynamicsContext; + + + PxsMemoryManager* mMemoryManager; + +#if PX_SUPPORT_GPU_PHYSX + PxsKernelWranglerManager* mGpuWranglerManagers; + PxsHeapMemoryAllocatorManager* mHeapMemoryAllocationManager; +#endif + + PxsSimulationController* mSimulationController; + + PxsSimulationControllerCallback* mSimulationControllerCallback; + + PxSceneLimits mLimits; + + PxVec3 mGravity; //!< Gravity vector + PxU32 mBodyGravityDirty; // Set to true before body->updateForces() when the mGravity has changed + + PxArray + mQueuedContactPairHeaders; + //time: + //constants set with setTiming(): + PxReal mDt; //delta time for current step. + PxReal mOneOverDt; //inverse of dt. + //stepping / counters: + PxU32 mTimeStamp; //Counts number of steps. + PxU32 mReportShapePairTimeStamp; //Timestamp for refreshing the shape pair report structure. Updated before delayed shape/actor deletion and before CCD passes. + //containers: + // Those ones contain shape ptrs from Actor, i.e. compound level, not subparts + + PxCoalescedHashSet mConstraints; + + ConstraintProjectionManager* mProjectionManager; + Bp::BoundsArray* mBoundsArray; + PxFloatArrayPinned* mContactDistance; + bool mHasContactDistanceChanged; + SqBoundsManager* mSqBoundsManager; + + PxArray mCcdBodies; + PxArray mProjectedBodies; + PxArray mTriggerBufferAPI; + PxArray* mTriggerBufferExtraData; + + PxCoalescedHashSet mArticulations; + PxCoalescedHashSet mDirtyArticulationSims; + +#if PX_SUPPORT_GPU_PHYSX + PxCoalescedHashSet mSoftBodies; + PxCoalescedHashSet mFEMCloths; + PxCoalescedHashSet mParticleSystems; + PxCoalescedHashSet mHairSystems; +#endif + PxArray mBrokenConstraints; + PxCoalescedHashSet mActiveBreakableConstraints; + + // pools for joint buffers + // Fixed joint is 92 bytes, D6 is 364 bytes right now. So these three pools cover all the internal cases + typedef Block MemBlock128; + typedef Block MemBlock256; + typedef Block MemBlock384; + + PxPool2 mMemBlock128Pool; + PxPool2 mMemBlock256Pool; + PxPool2 mMemBlock384Pool; + + // broad phase data: + NPhaseCore* mNPhaseCore; + + // Collision filtering + void* mFilterShaderData; + PxU32 mFilterShaderDataSize; + PxU32 mFilterShaderDataCapacity; + PxSimulationFilterShader mFilterShader; + PxSimulationFilterCallback* mFilterCallback; + + const PxPairFilteringMode::Enum mKineKineFilteringMode; + const PxPairFilteringMode::Enum mStaticKineFilteringMode; + + PxCoalescedHashSet mSleepBodies; + PxCoalescedHashSet mWokeBodies; + + PxCoalescedHashSet mSleepSoftBodies; + PxCoalescedHashSet mWokeSoftBodies; + PxCoalescedHashSet mSleepHairSystems; + PxCoalescedHashSet mWokeHairSystems; + bool mWokeBodyListValid; + bool mSleepBodyListValid; + bool mWokeSoftBodyListValid; + bool mSleepSoftBodyListValid; + bool mWokeHairSystemListValid; + bool mSleepHairSystemListValid; + const bool mEnableStabilization; + + PxArray mActiveActors; + PxArray mFrozenActors; + +#if PX_SUPPORT_GPU_PHYSX + PxArray mActiveSoftBodyActors; + PxArray mActiveFEMClothActors; + PxArray mActiveHairSystemActors; +#endif + PxArray mClientPosePreviewBodies; // buffer for bodies that requested early report of the integrated pose (eENABLE_POSE_INTEGRATION_PREVIEW). + // This buffer gets exposed to users. Is officially accessible from PxSimulationEventCallback::onAdvance() + // until the next simulate()/advance(). + PxArray mClientPosePreviewBuffer; // buffer of newly integrated poses for the bodies that requested a preview. This buffer gets exposed + // to users. + + PxSimulationEventCallback* mSimulationEventCallback; + PxBroadPhaseCallback* mBroadPhaseCallback; + + SimStats* mStats; + PxU32 mInternalFlags; //!< Combination of ::SceneFlag + PxSceneFlags mPublicFlags; //copy of PxSceneDesc::flags, of type PxSceneFlag + + ObjectIDTracker* mConstraintIDTracker; + ObjectIDTracker* mActorIDTracker; + ObjectIDTracker* mElementIDPool; + + StaticSim* mStaticAnchor; + + Cm::PreallocatingPool* mShapeSimPool; + Cm::PreallocatingPool* mStaticSimPool; + Cm::PreallocatingPool* mBodySimPool; + PxPool* mConstraintSimPool; + LLArticulationRCPool* mLLArticulationRCPool; +#if PX_SUPPORT_GPU_PHYSX + LLSoftBodyPool* mLLSoftBodyPool; + LLFEMClothPool* mLLFEMClothPool; + LLParticleSystemPool* mLLParticleSystemPool; + LLHairSystemPool* mLLHairSystemPool; +#endif + PxHashMap, ParticleOrSoftBodyRigidInteraction> mParticleOrSoftBodyRigidInteractionMap; + + PxHashMap, ConstraintCore*> mConstraintMap; + + PxPool* mConstraintInteractionPool; + + PxPool* mSimStateDataPool; + + BatchRemoveState* mBatchRemoveState; + + PxArray mLostTouchPairs; + PxBitMap mLostTouchPairsDeletedBodyIDs; // Need to know which bodies have been deleted when processing the lost touch pair list. + // Can't use the existing rigid object ID tracker class since this map needs to be cleared at + // another point in time. + PxBitMap mVelocityModifyMap; + + PxArray mTouchFoundEvents; + PxArray mTouchLostEvents; + + PxArray mOutOfBoundsIDs; + + PxBitMap mDirtyShapeSimMap; + + PxU32 mDominanceBitMatrix[PX_MAX_DOMINANCE_GROUP]; + + bool mVisualizationParameterChanged; + + PxU32 mMaxNbArticulationLinks; + + // statics: + PxU32 mNbRigidStatics; + PxU32 mNbRigidDynamics; + PxU32 mNbRigidKinematic; + PxU32 mNbGeometries[PxGeometryType::eGEOMETRY_COUNT]; + + //IG::Node::eTYPE_COUNT + PxU32 mNumDeactivatingNodes[IG::Node::eTYPE_COUNT]; + + // task decomposition + void broadPhase(PxBaseTask* continuation); + void broadPhaseFirstPass(PxBaseTask* continuation); + void broadPhaseSecondPass(PxBaseTask* continuation); + void updateBroadPhase(PxBaseTask* continuation); + void preIntegrate(PxBaseTask* continuation); + void postBroadPhase(PxBaseTask* continuation); + void postBroadPhaseContinuation(PxBaseTask* continuation); + void preRigidBodyNarrowPhase(PxBaseTask* continuation); + void postBroadPhaseStage2(PxBaseTask* continuation); + void postBroadPhaseStage3(PxBaseTask* continuation); + void updateBoundsAndShapes(PxBaseTask* continuation); + void rigidBodyNarrowPhase(PxBaseTask* continuation); + void unblockNarrowPhase(PxBaseTask* continuation); + void islandGen(PxBaseTask* continuation); + void processLostSolverPatches(PxBaseTask* continuation); + void processFoundSolverPatches(PxBaseTask* continuation); + void postIslandGen(PxBaseTask* continuation); + //void processTriggerInteractions(PxBaseTask* continuation); + void solver(PxBaseTask* continuation); + void updateBodies(PxBaseTask* continuation); + void updateShapes(PxBaseTask* continuation); + void updateSimulationController(PxBaseTask* continuation); + void updateDynamics(PxBaseTask* continuation); + void processLostContacts(PxBaseTask*); + void processLostContacts2(PxBaseTask*); + void processLostContacts3(PxBaseTask*); + void destroyManagers(PxBaseTask*); + void lostTouchReports(PxBaseTask*); + void unregisterInteractions(PxBaseTask*); + void postThirdPassIslandGen(PxBaseTask*); + void postSolver(PxBaseTask* continuation); + void constraintProjection(PxBaseTask* continuation); + void afterIntegration(PxBaseTask* continuation); // performs sleep check, for instance + void postCCDPass(PxBaseTask* continuation); + void ccdBroadPhaseAABB(PxBaseTask* continuation); + void ccdBroadPhase(PxBaseTask* continuation); + void updateCCDMultiPass(PxBaseTask* continuation); + void updateCCDSinglePass(PxBaseTask* continuation); + void updateCCDSinglePassStage2(PxBaseTask* continuation); + void updateCCDSinglePassStage3(PxBaseTask* continuation); + void finalizationPhase(PxBaseTask* continuation); + + void postNarrowPhase(PxBaseTask* continuation); + + void addShapes(NpShape*const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& sim, PxBounds3* outBounds); + void removeShapes(RigidSim& , PxInlineArray& , PxInlineArray&, bool wakeOnLostTouch); + + private: + void addShapes(NpShape*const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& sim, ShapeSim*& prefetchedShapeSim, PxBounds3* outBounds); + void updateContactDistances(PxBaseTask* continuation); + + Cm::DelegateTask mSecondPassNarrowPhase; + Cm::DelegateFanoutTask mPostNarrowPhase; + Cm::DelegateFanoutTask mFinalizationPhase; + Cm::DelegateTask mUpdateCCDMultiPass; + + //multi-pass ccd stuff + PxArray > mUpdateCCDSinglePass; + PxArray > mUpdateCCDSinglePass2; + PxArray > mUpdateCCDSinglePass3; + PxArray > mCCDBroadPhaseAABB; + PxArray > mCCDBroadPhase; + PxArray > mPostCCDPass; + + Cm::DelegateTask mAfterIntegration; + Cm::DelegateTask mConstraintProjection; + Cm::DelegateTask mPostSolver; + Cm::DelegateTask mSolver; + Cm::DelegateTask mUpdateBodies; + Cm::DelegateTask mUpdateShapes; + Cm::DelegateTask mUpdateSimulationController; + Cm::DelegateTask mUpdateDynamics; + Cm::DelegateTask mProcessLostContactsTask; + Cm::DelegateTask mProcessLostContactsTask2; + Cm::DelegateTask mProcessLostContactsTask3; + Cm::DelegateTask mDestroyManagersTask; + Cm::DelegateTask mLostTouchReportsTask; + Cm::DelegateTask mUnregisterInteractionsTask; + Cm::DelegateTask mProcessNarrowPhaseLostTouchTasks; + Cm::DelegateTask mProcessNPLostTouchEvents; + Cm::DelegateTask mPostThirdPassIslandGenTask; + Cm::DelegateTask mPostIslandGen; + Cm::DelegateTask mIslandGen; + Cm::DelegateTask mPreRigidBodyNarrowPhase; + Cm::DelegateTask mSetEdgesConnectedTask; + Cm::DelegateTask mFetchPatchEventsTask; + Cm::DelegateTask mProcessLostPatchesTask; + Cm::DelegateTask mProcessFoundPatchesTask; + Cm::DelegateFanoutTask mUpdateBoundAndShapeTask; + Cm::DelegateTask mRigidBodyNarrowPhase; + Cm::DelegateTask mRigidBodyNPhaseUnlock; + Cm::DelegateTask mPostBroadPhase; + Cm::DelegateTask mPostBroadPhaseCont; + Cm::DelegateTask mPostBroadPhase2; + Cm::DelegateFanoutTask mPostBroadPhase3; + Cm::DelegateTask mPreallocateContactManagers; + Cm::DelegateTask mIslandInsertion; + Cm::DelegateTask mRegisterContactManagers; + Cm::DelegateTask mRegisterInteractions; + Cm::DelegateTask mRegisterSceneInteractions; + Cm::DelegateTask mBroadPhase; + Cm::DelegateTask mAdvanceStep; + Cm::DelegateTask mCollideStep; + Cm::DelegateTask mBpFirstPass; + Cm::DelegateTask mBpSecondPass; + Cm::DelegateTask mBpUpdate; + Cm::DelegateTask mPreIntegrate; + + Cm::FlushPool mTaskPool; + PxTaskManager* mTaskManager; + PxCudaContextManager* mCudaContextManager; + + bool mContactReportsNeedPostSolverVelocity; + bool mUseGpuDynamics; + bool mUseGpuBp; + bool mCCDBp; + + SimulationStage::Enum mSimulationStage; + + ConstraintGroupNode** mTmpConstraintGroupRootBuffer; // temporary list of constraint group roots, used for constraint projection + + PxCoalescedHashSet mPosePreviewBodies; // list of bodies that requested early report of the integrated pose (eENABLE_POSE_INTEGRATION_PREVIEW). + + PxArray mPreallocatedContactManagers; + PxArray mPreallocatedShapeInteractions; + PxArray mPreallocatedInteractionMarkers; + + OverlapFilterTask* mOverlapFilterTaskHead; + PxArray mFilterInfo; + PxBitMap mSpeculativeCCDRigidBodyBitMap; + PxBitMap mSpeculativeCDDArticulationBitMap; + + bool mIsCollisionPhaseActive; + // Set to true as long as collision phase is active (used as an indicator that it is OK to read object pose, + // velocity etc. compared to the solver phase where these properties might get written to). + + public: + // For OmniPVD. To notify NpScene that actor's sleeping state has changed. + typedef void(*SleepingStateChangedCallback)(PxActor*, bool); + SleepingStateChangedCallback mOnSleepingStateChanged; + }; + + bool activateInteraction(Interaction* interaction, void* data); + void activateInteractions(Sc::ActorSim& actorSim); + void deactivateInteractions(Sc::ActorSim& actorSim); + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScShapeCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScShapeCore.h new file mode 100644 index 0000000..6eff5b4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScShapeCore.h @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SHAPE_CORE_H +#define SC_SHAPE_CORE_H + +#include "foundation/PxUtilities.h" +#include "PxvGeometry.h" +#include "PxFiltering.h" +#include "PxShape.h" + +namespace physx +{ +class PxShape; + +namespace Sc +{ + class ShapeSim; + + class ShapeCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: +// PX_SERIALIZATION + ShapeCore(const PxEMPTY); + void exportExtraData(PxSerializationContext& stream); + void importExtraData(PxDeserializationContext& context); + void resolveReferences(PxDeserializationContext& context); + static void getBinaryMetaData(PxOutputStream& stream); + void resolveMaterialReference(PxU32 materialTableIndex, PxU16 materialIndex); +//~PX_SERIALIZATION + ShapeCore(const PxGeometry& geometry, PxShapeFlags shapeFlags, + const PxU16* materialIndices, PxU16 materialCount, bool isExclusive, + PxShapeCoreFlag::Enum softOrClothFlags = PxShapeCoreFlag::Enum(0)); + + ~ShapeCore(); + + PX_FORCE_INLINE PxGeometryType::Enum getGeometryType() const { return mCore.mGeometry.getType(); } + PxShape* getPxShape(); + const PxShape* getPxShape() const; + + PX_FORCE_INLINE const GeometryUnion& getGeometryUnion() const { return mCore.mGeometry; } + PX_FORCE_INLINE const PxGeometry& getGeometry() const { return mCore.mGeometry.getGeometry(); } + void setGeometry(const PxGeometry& geom); + + PxU16 getNbMaterialIndices() const; + const PxU16* getMaterialIndices() const; + void setMaterialIndices(const PxU16* materialIndices, PxU16 materialIndexCount); + + PX_FORCE_INLINE const PxTransform& getShape2Actor() const { return mCore.getTransform(); } + PX_FORCE_INLINE void setShape2Actor(const PxTransform& s2b) { mCore.setTransform(s2b); } + + PX_FORCE_INLINE const PxFilterData& getSimulationFilterData() const { return mSimulationFilterData; } + PX_FORCE_INLINE void setSimulationFilterData(const PxFilterData& data) { mSimulationFilterData = data; } + + PX_FORCE_INLINE PxReal getContactOffset() const { return mCore.mContactOffset; } + void setContactOffset(PxReal offset); + + PX_FORCE_INLINE PxReal getRestOffset() const { return mCore.mRestOffset; } + PX_FORCE_INLINE void setRestOffset(PxReal offset) { mCore.mRestOffset = offset; } + + PX_FORCE_INLINE PxReal getDensityForFluid() const { return mCore.getDensityForFluid(); } + PX_FORCE_INLINE void setDensityForFluid(PxReal densityForFluid) { mCore.setDensityForFluid(densityForFluid); } + + PX_FORCE_INLINE PxReal getTorsionalPatchRadius() const { return mCore.mTorsionalRadius; } + PX_FORCE_INLINE void setTorsionalPatchRadius(PxReal tpr) { mCore.mTorsionalRadius = tpr; } + + PX_FORCE_INLINE PxReal getMinTorsionalPatchRadius() const {return mCore.mMinTorsionalPatchRadius; } + PX_FORCE_INLINE void setMinTorsionalPatchRadius(PxReal radius) { mCore.mMinTorsionalPatchRadius = radius; } + + PX_FORCE_INLINE PxShapeFlags getFlags() const { return PxShapeFlags(mCore.mShapeFlags); } + PX_FORCE_INLINE void setFlags(PxShapeFlags f) { mCore.mShapeFlags = f; } + + PX_FORCE_INLINE const PxsShapeCore& getCore() const { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF(ShapeCore, mCore); } + static PX_FORCE_INLINE ShapeCore& getCore(PxsShapeCore& core) + { + return *reinterpret_cast(reinterpret_cast(&core) - getCoreOffset()); + } + + PX_FORCE_INLINE ShapeSim* getSim() const + { + return reinterpret_cast(size_t(mSimAndIsExclusive) & ~1); + } + PX_FORCE_INLINE void setSim(ShapeSim* sim) + { + PX_ASSERT((NULL == mSimAndIsExclusive) || (1 == size_t(mSimAndIsExclusive))); + PX_ASSERT(0 == (size_t(sim) & 1)); + mSimAndIsExclusive = mSimAndIsExclusive ? reinterpret_cast(size_t(sim) | size_t(mSimAndIsExclusive)) : mSimAndIsExclusive; + } + PX_FORCE_INLINE void clearSim() + { + mSimAndIsExclusive = reinterpret_cast(size_t(mSimAndIsExclusive) & 1); + } + +#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux + protected: +#endif + PxFilterData mSimulationFilterData; // Simulation filter data + PxsShapeCore PX_ALIGN(16, mCore); + ShapeSim* mSimAndIsExclusive; +#if PX_WINDOWS_FAMILY // PT: to avoid "error: offset of on non-standard-layout type" on Linux + public: +#endif + const char* mName; // PT: moved here from NpShape to fill padding bytes + }; + +} // namespace Sc + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSoftBodyCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSoftBodyCore.h new file mode 100644 index 0000000..d2c47f4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSoftBodyCore.h @@ -0,0 +1,188 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SOFT_BODY_CORE_H +#define SC_SOFT_BODY_CORE_H + +#include "PxSoftBody.h" +#include "DySoftBodyCore.h" +#include "foundation/PxAssert.h" +#include "ScActorCore.h" +#include "ScShapeCore.h" +#include "PxFiltering.h" +#include "ScRigidCore.h" //KS - needed for ShapeChangeNotifyFlags. Move to a shared header + + +namespace physx +{ + + + namespace Sc + { + class SoftBodySim; + class BodyCore; + class FEMClothCore; + class ParticleSystemCore; + + class SoftBodyCore : public ActorCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + + // PX_SERIALIZATION + public: + SoftBodyCore(const PxEMPTY) : ActorCore(PxEmpty){} + static void getBinaryMetaData(PxOutputStream& stream); + //~PX_SERIALIZATION + SoftBodyCore(); + ~SoftBodyCore(); + + //--------------------------------------------------------------------------------- + // External API + //--------------------------------------------------------------------------------- + + void setMaterial(const PxU16 handle); + void clearMaterials(); + + + PxFEMParameters getParameter() const; + void setParameter(const PxFEMParameters paramters); + + + PxReal getSleepThreshold() const; + void setSleepThreshold(const PxReal v); + + PxReal getFreezeThreshold() const; + void setFreezeThreshold(const PxReal v); + + PxU16 getSolverIterationCounts() const { return mCore.solverIterationCounts; } + void setSolverIterationCounts(PxU16 c); + + PxReal getWakeCounter() const; + void setWakeCounter(const PxReal v); + void setWakeCounterInternal(const PxReal v); + + bool isSleeping() const; + void wakeUp(PxReal wakeCounter); + void putToSleep(); + + PxActor* getPxActor() const; + + void attachShapeCore(ShapeCore* shapeCore); + void attachSimulationMesh(PxTetrahedronMesh* simulationMesh, PxSoftBodyAuxData* simulationState); + + void addParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId); + void removeParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId); + + PxU32 addParticleAttachment(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentric); + void removeParticleAttachment(Sc::ParticleSystemCore* core, PxU32 handle); + + void addRigidFilter(Sc::BodyCore* core, PxU32 vertId); + void removeRigidFilter(Sc::BodyCore* core, PxU32 vertId); + + PxU32 addRigidAttachment(Sc::BodyCore* core, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint); + void removeRigidAttachment(Sc::BodyCore* core, PxU32 handle); + + + void addTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx); + void removeTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx); + + PxU32 addTetRigidAttachment(Sc::BodyCore* core, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint); + + void addSoftBodyFilter(Sc::SoftBodyCore& core, PxU32 tetIdx0, PxU32 tetIdx1); + void removeSoftBodyFilter(Sc::SoftBodyCore& core, PxU32 tetIdx0, PxU32 tetIdx1); + void addSoftBodyFilters(Sc::SoftBodyCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + void removeSoftBodyFilters(Sc::SoftBodyCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize); + + PxU32 addSoftBodyAttachment(Sc::SoftBodyCore& core, PxU32 tetIdx0, const PxVec4& triBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint); + void removeSoftBodyAttachment(Sc::SoftBodyCore& core, PxU32 handle); + + void addClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, PxU32 tetIdx); + void removeClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, PxU32 tetIdx); + + PxU32 addClothAttachment(Sc::FEMClothCore& core, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint); + void removeClothAttachment(Sc::FEMClothCore& core, PxU32 handle); + + PxU32 getGpuSoftBodyIndex(); + //--------------------------------------------------------------------------------- + // Internal API + //--------------------------------------------------------------------------------- + public: + + SoftBodySim* getSim() const; + + PX_FORCE_INLINE const Dy::SoftBodyCore& getCore() const { return mCore; } + + PX_FORCE_INLINE Dy::SoftBodyCore& getCore() { return mCore; } + + static PX_FORCE_INLINE SoftBodyCore& getSoftBodyCore(SoftBodyCore& core) + { + size_t offset = PX_OFFSET_OF_RT(SoftBodyCore, mCore); + return *reinterpret_cast(reinterpret_cast(&core) - offset); + } + + void setSimulationFilterData(const PxFilterData& data); + + PxFilterData getSimulationFilterData() const; + + PxSoftBodyFlags getFlags() const { return mCore.mFlags; } + + void setFlags(PxSoftBodyFlags flags); + + PX_FORCE_INLINE PxReal getMaxPenetrationBias() const { return mCore.maxPenBias; } + PX_FORCE_INLINE void setMaxPenetrationBias(PxReal p) { mCore.maxPenBias = p; } + + PX_FORCE_INLINE PxU64& getGpuMemStat() { return mGpuMemStat; } + + void onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags); + + private: + Dy::SoftBodyCore mCore; + PxFilterData mFilterData; + PxU64 mGpuMemStat; + + + }; + + + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSqBoundsSync.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSqBoundsSync.h new file mode 100644 index 0000000..05eebf9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScSqBoundsSync.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SQ_BOUNDS_SYNC_H +#define SC_SQ_BOUNDS_SYNC_H + +#include "foundation/PxSimpleTypes.h" +#include "foundation/PxBitMap.h" + +#include "PxSceneQuerySystem.h" + +namespace physx +{ + class PxBounds3; + class PxRigidBody; + class PxShape; + + typedef PxSQPrunerHandle ScPrunerHandle; + +namespace Sc +{ + // PT: TODO: revisit the need for a virtual interface + struct SqRefFinder + { + virtual ScPrunerHandle find(const PxRigidBody* body, const PxShape* shape, PxU32& prunerIndex) = 0; + + virtual ~SqRefFinder() {} + }; + + // PT: TODO: revisit the need for a virtual interface + struct SqBoundsSync + { + virtual void sync(PxU32 prunerIndex, const ScPrunerHandle* handles, const PxU32* boundsIndices, const PxBounds3* bounds, const PxTransform32* transforms, PxU32 count, const PxBitMap& ignoredIndices) = 0; + + virtual ~SqBoundsSync() {} + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScStaticCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScStaticCore.h new file mode 100644 index 0000000..9804a33 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/include/ScStaticCore.h @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_STATIC_CORE_H +#define SC_STATIC_CORE_H + +#include "ScRigidCore.h" +#include "PxvDynamics.h" + +namespace physx +{ +namespace Sc +{ + + class StaticSim; + + class StaticCore: public RigidCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + StaticCore(const PxTransform& actor2World): RigidCore(PxActorType::eRIGID_STATIC) + { + mCore.body2World = actor2World; + mCore.mFlags = PxRigidBodyFlags(); + } + + PX_FORCE_INLINE const PxTransform& getActor2World() const { return mCore.body2World; } + void setActor2World(const PxTransform& actor2World); + + PX_FORCE_INLINE PxsRigidCore& getCore() { return mCore; } + static PX_FORCE_INLINE size_t getCoreOffset() { return PX_OFFSET_OF_RT(StaticCore, mCore);} + + StaticCore(const PxEMPTY) : RigidCore(PxEmpty), mCore(PxEmpty) {} + static void getBinaryMetaData(PxOutputStream& stream); + + StaticSim* getSim() const; + + PX_FORCE_INLINE void onOriginShift(const PxVec3& shift) { mCore.body2World.p -= shift; } + + private: + PxsRigidCore mCore; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp new file mode 100644 index 0000000..ac063f3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorCore.cpp @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScActorCore.h" +#include "ScActorSim.h" +#include "ScShapeCore.h" +#include "ScShapeSim.h" +#include "ScBodySim.h" + +using namespace physx; + +Sc::ActorCore::ActorCore(PxActorType::Enum actorType, PxU8 actorFlags, PxClientID owner, PxDominanceGroup dominanceGroup) : + mSim (NULL), + mAggregateIDOwnerClient ((PxU32(owner)<<24)|0x00ffffff), + mActorFlags (actorFlags), + mActorType (PxU8(actorType)), + mDominanceGroup (dominanceGroup) +{ + PX_ASSERT((actorType & 0xff) == actorType); +} + +Sc::ActorCore::~ActorCore() +{ +} + +void Sc::ActorCore::setActorFlags(PxActorFlags af) +{ + const PxActorFlags old = mActorFlags; + if(af!=old) + { + mActorFlags = af; + + if(mSim) + mSim->postActorFlagChange(old, af); + } +} + +void Sc::ActorCore::setDominanceGroup(PxDominanceGroup g) +{ + PX_ASSERT(g<128); + mDominanceGroup = g; + if(mSim) + { + //force all related interactions to refresh, so they fetch new dominance values. + mSim->setActorsInteractionsDirty(InteractionDirtyFlag::eDOMINANCE, NULL, InteractionFlag::eRB_ELEMENT); + } +} + +void Sc::ActorCore::reinsertShapes() +{ + PX_ASSERT(mSim); + if(!mSim) + return; + + PxU32 nbElems = mSim->getNbElements(); + ElementSim** elems = mSim->getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->reinsertBroadPhase(); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorPair.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorPair.h new file mode 100644 index 0000000..886f652 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorPair.h @@ -0,0 +1,227 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ACTOR_PAIR_H +#define SC_ACTOR_PAIR_H + +#include "ScRigidSim.h" +#include "ScContactStream.h" +#include "ScNPhaseCore.h" +#if PX_SUPPORT_GPU_PHYSX +#include "ScSoftBodySim.h" +#endif + + +namespace physx +{ +namespace Sc +{ + class ActorPairContactReportData + { + public: + ActorPairContactReportData() : + mStrmResetStamp (0xffffffff), + mActorAID (0xffffffff), + mActorBID (0xffffffff), + mPxActorA (NULL), + mPxActorB (NULL) + {} + + ContactStreamManager mContactStreamManager; + PxU32 mStrmResetStamp; + PxU32 mActorAID; + PxU32 mActorBID; + PxActor* mPxActorA; + PxActor* mPxActorB; + }; + + /** + \brief Class shared by all shape interactions for a pair of actors. + + This base class is used if no shape pair of an actor pair has contact reports requested. + */ + class ActorPair + { + public: + + enum ActorPairFlags + { + eIS_REPORT_PAIR = (1<<0), + eNEXT_FREE = (1<<1) + }; + + PX_FORCE_INLINE ActorPair() : mInternalFlags(0), mTouchCount(0), mRefCount(0) {} + PX_FORCE_INLINE ~ActorPair() {} + + PX_FORCE_INLINE PxIntBool isReportPair() const { return (mInternalFlags & eIS_REPORT_PAIR); } + + PX_FORCE_INLINE void incTouchCount() { mTouchCount++; PX_ASSERT(mTouchCount); } + PX_FORCE_INLINE void decTouchCount() { PX_ASSERT(mTouchCount); mTouchCount--; } + PX_FORCE_INLINE PxU32 getTouchCount() const { return mTouchCount; } + + PX_FORCE_INLINE void incRefCount() { ++mRefCount; PX_ASSERT(mRefCount>0); } + PX_FORCE_INLINE PxU32 decRefCount() { PX_ASSERT(mRefCount>0); return --mRefCount; } + PX_FORCE_INLINE PxU32 getRefCount() const { return mRefCount; } + + private: + ActorPair& operator=(const ActorPair&); + + protected: + PxU16 mInternalFlags; + PxU16 mTouchCount; + PxU16 mRefCount; + PxU16 mPad; // instances of this class are stored in a pool which needs an item size of at least size_t + }; + + /** + \brief Class shared by all shape interactions for a pair of actors if contact reports are requested. + + This class is used if at least one shape pair of an actor pair has contact reports requested. + + \note If a pair of actors had contact reports requested for some of the shape interactions but all of them switch to not wanting contact reports + any longer, then the ActorPairReport instance is kept being used and won't get replaced by a simpler ActorPair instance. + */ + class ActorPairReport : public ActorPair + { + public: + + enum ActorPairReportFlags + { + eIS_IN_CONTACT_REPORT_ACTOR_PAIR_SET = ActorPair::eNEXT_FREE // PT: whether the pair is already stored in the 'ContactReportActorPairSet' or not + }; + + PX_FORCE_INLINE ActorPairReport(ActorSim&, ActorSim&); + PX_FORCE_INLINE ~ActorPairReport(); + + PX_INLINE ContactStreamManager& createContactStreamManager(NPhaseCore&); + PX_FORCE_INLINE ContactStreamManager& getContactStreamManager() const { PX_ASSERT(mReportData); return mReportData->mContactStreamManager; } + PX_FORCE_INLINE ActorSim& getActorA() const { return mActorA; } + PX_FORCE_INLINE ActorSim& getActorB() const { return mActorB; } + PX_INLINE PxU32 getActorAID() const { PX_ASSERT(mReportData); return mReportData->mActorAID; } + PX_INLINE PxU32 getActorBID() const { PX_ASSERT(mReportData); return mReportData->mActorBID; } + PX_INLINE PxActor* getPxActorA() const { PX_ASSERT(mReportData); return mReportData->mPxActorA; } + PX_INLINE PxActor* getPxActorB() const { PX_ASSERT(mReportData); return mReportData->mPxActorB; } + PX_INLINE bool streamResetStamp(PxU32 cmpStamp); + + PX_FORCE_INLINE PxU16 isInContactReportActorPairSet() const { return PxU16(mInternalFlags & eIS_IN_CONTACT_REPORT_ACTOR_PAIR_SET); } + PX_FORCE_INLINE void setInContactReportActorPairSet() { mInternalFlags |= eIS_IN_CONTACT_REPORT_ACTOR_PAIR_SET; } + PX_FORCE_INLINE void clearInContactReportActorPairSet() { mInternalFlags &= ~eIS_IN_CONTACT_REPORT_ACTOR_PAIR_SET; } + + PX_FORCE_INLINE void createContactReportData(NPhaseCore&); + PX_FORCE_INLINE void releaseContactReportData(NPhaseCore&); + + PX_FORCE_INLINE void convert(ActorPair& aPair) { PX_ASSERT(!aPair.isReportPair()); mTouchCount = PxU16(aPair.getTouchCount()); mRefCount = PxU16(aPair.getRefCount()); } + + PX_FORCE_INLINE static ActorPairReport& cast(ActorPair& aPair) { PX_ASSERT(aPair.isReportPair()); return static_cast(aPair); } + + private: + ActorPairReport& operator=(const ActorPairReport&); + + ActorSim& mActorA; + ActorSim& mActorB; + + ActorPairContactReportData* mReportData; + }; + +} // namespace Sc + +PX_FORCE_INLINE Sc::ActorPairReport::ActorPairReport(ActorSim& actor0, ActorSim& actor1) : ActorPair(), +mActorA (actor0), +mActorB (actor1), +mReportData (NULL) +{ + PX_ASSERT(mInternalFlags == 0); + mInternalFlags = ActorPair::eIS_REPORT_PAIR; +} + +PX_FORCE_INLINE Sc::ActorPairReport::~ActorPairReport() +{ + PX_ASSERT(mReportData == NULL); +} + +PX_INLINE bool Sc::ActorPairReport::streamResetStamp(PxU32 cmpStamp) +{ + PX_ASSERT(mReportData); + const bool ret = (cmpStamp != mReportData->mStrmResetStamp); + mReportData->mStrmResetStamp = cmpStamp; + return ret; +} + +PX_INLINE Sc::ContactStreamManager& Sc::ActorPairReport::createContactStreamManager(NPhaseCore& npCore) +{ + // Lazy create report data + if(!mReportData) + createContactReportData(npCore); + + return mReportData->mContactStreamManager; +} + +PX_FORCE_INLINE void Sc::ActorPairReport::createContactReportData(NPhaseCore& npCore) +{ + PX_ASSERT(!mReportData); + Sc::ActorPairContactReportData* reportData = npCore.createActorPairContactReportData(); + mReportData = reportData; + + if(reportData) + { + const ActorCore& actorCoreA = mActorA.getActorCore(); + const ActorCore& actorCoreB = mActorB.getActorCore(); + + reportData->mActorAID = mActorA.getActorID(); + reportData->mActorBID = mActorB.getActorID(); + +#if PX_SUPPORT_GPU_PHYSX + if (mActorA.getActorType() == PxActorType::eSOFTBODY) + reportData->mPxActorA = static_cast(actorCoreA).getPxActor(); + else +#endif + reportData->mPxActorA = static_cast(actorCoreA).getPxActor(); + +#if PX_SUPPORT_GPU_PHYSX + if (mActorA.getActorType() == PxActorType::eSOFTBODY) + reportData->mPxActorB = static_cast(actorCoreB).getPxActor(); + else +#endif + reportData->mPxActorB = static_cast(actorCoreB).getPxActor(); + } +} + +PX_FORCE_INLINE void Sc::ActorPairReport::releaseContactReportData(NPhaseCore& npCore) +{ + // Can't take the NPhaseCore (scene) reference from the actors since they're already gone on scene release + + if(mReportData) + { + npCore.releaseActorPairContactReportData(mReportData); + mReportData = NULL; + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp new file mode 100644 index 0000000..8f6977c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.cpp @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScActorSim.h" +#include "ScActorCore.h" +#include "ScElementSim.h" +#include "ScScene.h" +#include "ScInteraction.h" + +using namespace physx; + +Sc::ActorSim::ActorSim(Scene& scene, ActorCore& core) : + mScene (scene), + mCore (core), + mActiveListIndex(SC_NOT_IN_SCENE_INDEX), + mActiveCompoundListIndex(SC_NOT_IN_SCENE_INDEX), + mNodeIndex (PX_INVALID_NODE), + mInternalFlags (0) +{ + core.setSim(this); + mId = scene.getActorIDTracker().createID(); +} + +Sc::ActorSim::~ActorSim() +{ + mInteractions.releaseMem(*this); + + mScene.getActorIDTracker().releaseID(mId); +} + +void Sc::ActorSim::registerInteractionInActor(Interaction* interaction) +{ + const PxU32 id = mInteractions.size(); + mInteractions.pushBack(interaction, *this); + interaction->setActorId(this, id); +} + +void Sc::ActorSim::unregisterInteractionFromActor(Interaction* interaction) +{ + const PxU32 i = interaction->getActorId(this); + PX_ASSERT(i < mInteractions.size()); + mInteractions.replaceWithLast(i); + if (isetActorId(this, i); +} + +// PT: TODO: refactor with Sc::ParticlePacketShape::reallocInteractions - sschirm: particles are gone +void Sc::ActorSim::reallocInteractions(Sc::Interaction**& mem, PxU32& capacity, PxU32 size, PxU32 requiredMinCapacity) +{ + Interaction** newMem; + PxU32 newCapacity; + + if(requiredMinCapacity==0) + { + newCapacity = 0; + newMem = 0; + } + else if(requiredMinCapacity<=INLINE_INTERACTION_CAPACITY) + { + newCapacity = INLINE_INTERACTION_CAPACITY; + newMem = mInlineInteractionMem; + } + else + { + newCapacity = PxNextPowerOfTwo(requiredMinCapacity-1); + newMem = reinterpret_cast(mScene.allocatePointerBlock(newCapacity)); + } + + PX_ASSERT(newCapacity >= requiredMinCapacity && requiredMinCapacity>=size); + + if(mem) + { + PxMemCopy(newMem, mem, size*sizeof(Interaction*)); + + if(mem!=mInlineInteractionMem) + mScene.deallocatePointerBlock(reinterpret_cast(mem), capacity); + } + + capacity = newCapacity; + mem = newMem; +} + +void Sc::ActorSim::setActorsInteractionsDirty(InteractionDirtyFlag::Enum flag, const ActorSim* other, PxU8 interactionFlag) +{ + PxU32 size = getActorInteractionCount(); + Interaction** interactions = getActorInteractions(); + while(size--) + { + Interaction* interaction = *interactions++; + if((!other || other == &interaction->getActorSim0() || other == &interaction->getActorSim1()) && (interaction->readInteractionFlag(interactionFlag))) + interaction->setDirty(flag); + } +} + +void Sc::ActorSim::setActive(bool active, PxU32 infoFlag) +{ + PX_ASSERT(!active || isDynamicRigid()); // Currently there should be no need to activate an actor that does not take part in island generation + + const PxU32 asPartOfCreation = infoFlag & ActorSim::AS_PART_OF_CREATION; + if (asPartOfCreation || isActive() != active) + { + PX_ASSERT(!asPartOfCreation || (getActorInteractionCount() == 0)); // On creation or destruction there should be no interactions + + if (active) + { + if (!asPartOfCreation) + { + // Inactive => Active + getScene().addToActiveList(*this); + } + + activate(); + + PX_ASSERT(asPartOfCreation || isActive()); + } + else + { + if (!asPartOfCreation) + { + // Active => Inactive + getScene().removeFromActiveList(*this); + } + + deactivate(); + + PX_ASSERT(asPartOfCreation || (!isActive())); + } + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.h new file mode 100644 index 0000000..7f113c0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScActorSim.h @@ -0,0 +1,219 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ACTOR_SIM_H +#define SC_ACTOR_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "CmPtrTable.h" +#include "CmUtils.h" +#include "PxActor.h" +#include "ScInteractionFlags.h" +#include "ScActorCore.h" +#include "PxsSimpleIslandManager.h" + +namespace physx +{ + +class PxActor; + +namespace Sc +{ + +#define SC_NOT_IN_SCENE_INDEX 0xffffffff // the body is not in the scene yet +#define SC_NOT_IN_ACTIVE_LIST_INDEX 0xfffffffe // the body is in the scene but not in the active list + + static const PxReal ScInternalWakeCounterResetValue = 20.0f*0.02f; + + class Interaction; + class ElementSim; + + class ShapeManager : public PxUserAllocated + { + public: + + ShapeManager() {} + ~ShapeManager() {} + + PX_FORCE_INLINE PxU32 getNbElements() const + { + return mShapes.getCount(); + } + PX_FORCE_INLINE ElementSim** getElements() + { + return reinterpret_cast(mShapes.getPtrs()); + } + PX_FORCE_INLINE ElementSim*const* getElements() const + { + return reinterpret_cast(mShapes.getPtrs()); + } + // void onElementAttach(ElementSim& element); + void onElementDetach(ElementSim& element); + + Cm::PtrTable mShapes; + }; + + + class ActorSim : public ShapeManager + { + friend class Scene; // the scene is allowed to set the scene array index + friend class Interaction; + PX_NOCOPY(ActorSim) + + public: + enum ActivityChangeInfoFlag + { + AS_PART_OF_CREATION = (1 << 0), + AS_PART_OF_ISLAND_GEN = (1 << 1) + }; + + enum InternalFlags + { + //BF_DISABLE_GRAVITY = 1 << 0, // Don't apply the scene's gravity + + BF_HAS_STATIC_TOUCH = 1 << 1, // Set when a body is part of an island with static contacts. Needed to be able to recalculate adaptive force if this changes + BF_KINEMATIC_MOVED = 1 << 2, // Set when the kinematic was moved + + BF_ON_DEATHROW = 1 << 3, // Set when the body is destroyed + + BF_IS_IN_SLEEP_LIST = 1 << 4, // Set when the body is added to the list of bodies which were put to sleep + BF_IS_IN_WAKEUP_LIST = 1 << 5, // Set when the body is added to the list of bodies which were woken up + BF_SLEEP_NOTIFY = 1 << 6, // A sleep notification should be sent for this body (and not a wakeup event, even if the body is part of the woken list as well) + BF_WAKEUP_NOTIFY = 1 << 7, // A wake up notification should be sent for this body (and not a sleep event, even if the body is part of the sleep list as well) + + BF_HAS_CONSTRAINTS = 1 << 8, // Set if the body has one or more constraints + BF_KINEMATIC_SETTLING = 1 << 9, // Set when the body was moved kinematically last frame + BF_KINEMATIC_SETTLING_2 = 1 << 10, + BF_KINEMATIC_MOVE_FLAGS = BF_KINEMATIC_MOVED | BF_KINEMATIC_SETTLING | BF_KINEMATIC_SETTLING_2, //Used to clear kinematic masks in 1 call + BF_KINEMATIC_SURFACE_VELOCITY = 1 << 11, //Set when the application calls setKinematicVelocity. Actor remains awake until application calls clearKinematicVelocity. + BF_IS_COMPOUND_RIGID = 1 << 12, // Set when the body is a compound actor, we dont want to set the sq bounds + + // PT: WARNING: flags stored on 16-bits now. + }; + + ActorSim(Scene&, ActorCore&); + virtual ~ActorSim(); + + // Get the scene the actor resides in + PX_FORCE_INLINE Scene& getScene() const { return mScene; } + + // Get the number of interactions connected to the actor + PX_FORCE_INLINE PxU32 getActorInteractionCount() const { return mInteractions.size(); } + + // Get an iterator to the interactions connected to the actor + PX_FORCE_INLINE Interaction** getActorInteractions() const { return mInteractions.begin(); } + + // Get the type ID of the actor + PX_FORCE_INLINE PxActorType::Enum getActorType() const { return mCore.getActorCoreType(); } + + // Returns true if the actor is a dynamic rigid body (including articulation links) + PX_FORCE_INLINE bool isDynamicRigid() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::eRIGID_DYNAMIC || type == PxActorType::eARTICULATION_LINK; } + PX_FORCE_INLINE bool isSoftBody() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::eSOFTBODY; } + PX_FORCE_INLINE bool isFEMCloth() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::eFEMCLOTH; } + PX_FORCE_INLINE bool isParticleSystem() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::ePBD_PARTICLESYSTEM || type == PxActorType::eFLIP_PARTICLESYSTEM || type == PxActorType::eMPM_PARTICLESYSTEM || type == PxActorType::eCUSTOM_PARTICLESYSTEM; } + PX_FORCE_INLINE bool isHairSystem() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::eHAIRSYSTEM; } + PX_FORCE_INLINE bool isNonRigid() const { const PxActorType::Enum type = getActorType(); return type!=PxActorType::eRIGID_STATIC && type!=PxActorType::eRIGID_DYNAMIC && type!=PxActorType::eARTICULATION_LINK; } + PX_FORCE_INLINE bool isStaticRigid() const { const PxActorType::Enum type = getActorType(); return type == PxActorType::eRIGID_STATIC; } + + virtual void postActorFlagChange(PxU32, PxU32) {} + + void setActorsInteractionsDirty(InteractionDirtyFlag::Enum flag, const ActorSim* other, PxU8 interactionFlag); + + PX_FORCE_INLINE ActorCore& getActorCore() const { return mCore; } + + PX_FORCE_INLINE bool isActive() const { return (mActiveListIndex < SC_NOT_IN_ACTIVE_LIST_INDEX); } + void setActive(bool active, PxU32 infoFlag = 0); // see ActivityChangeInfoFlag + + PX_FORCE_INLINE PxU32 getActiveListIndex() const { return mActiveListIndex; } // if the body is active, the index is smaller than SC_NOT_IN_ACTIVE_LIST_INDEX + PX_FORCE_INLINE void setActiveListIndex(PxU32 index) { mActiveListIndex = index; } + + PX_FORCE_INLINE PxU32 getActiveCompoundListIndex() const { return mActiveCompoundListIndex; } // if the body is active and is compound, the index is smaller than SC_NOT_IN_ACTIVE_LIST_INDEX + PX_FORCE_INLINE void setActiveCompoundListIndex(PxU32 index) { mActiveCompoundListIndex = index; } + + PX_FORCE_INLINE PxNodeIndex getNodeIndex() const { return mNodeIndex; } + + PX_FORCE_INLINE PxU32 getActorID() const { return mId; } + + PX_FORCE_INLINE PxU16 getInternalFlag() const { return mInternalFlags; } + PX_FORCE_INLINE PxU16 readInternalFlag(InternalFlags flag) const { return PxU16(mInternalFlags & flag); } + PX_FORCE_INLINE void raiseInternalFlag(InternalFlags flag) { mInternalFlags |= flag; } + PX_FORCE_INLINE void clearInternalFlag(InternalFlags flag) { mInternalFlags &= ~flag; } + + virtual PxActor* getPxActor() const = 0; + + //This can all be removed and functionality can be subsumed by the island system, removing the need for this + //virtual call and any associated work + virtual void registerCountedInteraction() {} + virtual void unregisterCountedInteraction() {} + virtual PxU32 getNumCountedInteractions() const { return 0; } + + virtual void activate() {} + virtual void deactivate() {} + virtual void internalWakeUp(PxReal wakeCounterValue = ScInternalWakeCounterResetValue) { PX_UNUSED(wakeCounterValue); } + + private: + //These are called from interaction creation/destruction + void registerInteractionInActor(Interaction* interaction); + void unregisterInteractionFromActor(Interaction* interaction); + + void reallocInteractions(Sc::Interaction**& mem, PxU32& capacity, PxU32 size, PxU32 requiredMinCapacity); + protected: + // dsequeira: interaction arrays are a major cause of small allocations, so we don't want to delegate them to the heap allocator + // it's not clear this inline array is really needed, we should take it out and see whether the cache perf is worse + + static const PxU32 INLINE_INTERACTION_CAPACITY = 4; + Interaction* mInlineInteractionMem[INLINE_INTERACTION_CAPACITY]; + + Cm::OwnedArray + mInteractions; + + Scene& mScene; + + ActorCore& mCore; + + //--------------------------------------------------------------------------------- + // Sleeping + //--------------------------------------------------------------------------------- + PxU32 mActiveListIndex; // Used by Scene to track active bodies + PxU32 mActiveCompoundListIndex; // Used by Scene to track active compound bodies + + //--------------------------------------------------------------------------------- + // Island manager + //--------------------------------------------------------------------------------- + PxNodeIndex mNodeIndex; + + PxU32 mId; + + PxU16 mInternalFlags; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp new file mode 100644 index 0000000..67d7ccb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationCore.cpp @@ -0,0 +1,284 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "ScArticulationCore.h" + +#include "ScPhysics.h" +#include "ScBodyCore.h" +#include "ScBodySim.h" +#include "ScArticulationSim.h" + +using namespace physx; + +Sc::ArticulationCore::ArticulationCore() : + mSim(NULL) +{ + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + + mCore.solverIterationCounts = 1<<8 | 4; + mCore.sleepThreshold = 5e-5f * scale.speed * scale.speed; + mCore.freezeThreshold = 5e-6f * scale.speed * scale.speed; + mCore.wakeCounter = Physics::sWakeCounterOnCreation; + mCore.gpuRemapIndex = 0xffffffff; + mCore.maxLinearVelocity = 1e+6f; + mCore.maxAngularVelocity = 1e+6f; +} + +Sc::ArticulationCore::~ArticulationCore() +{ +} + +//-------------------------------------------------------------- +// +// ArticulationCore interface implementation +// +//-------------------------------------------------------------- + +void Sc::ArticulationCore::setWakeCounter(const PxReal v) +{ + mCore.wakeCounter = v; + + if (mSim) + { + mSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_WAKECOUNTER); + } + +#ifdef _DEBUG + if(mSim) + mSim->debugCheckWakeCounterOfLinks(v); +#endif +} + +void Sc::ArticulationCore::setMaxLinearVelocity(const PxReal v) +{ + mCore.maxLinearVelocity = v; + + if (mSim) + { + mSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_VELOCITY_LIMITS); + } +} + +void Sc::ArticulationCore::setMaxAngularVelocity(const PxReal v) +{ + mCore.maxAngularVelocity = v; + + if (mSim) + { + mSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_VELOCITY_LIMITS); + } +} + +bool Sc::ArticulationCore::isSleeping() const +{ + return mSim ? mSim->isSleeping() : (mCore.wakeCounter == 0.0f); +} + +void Sc::ArticulationCore::wakeUp(PxReal wakeCounter) +{ + mCore.wakeCounter = wakeCounter; + + if (mSim) + { + Dy::FeatherstoneArticulation* arti = static_cast(mSim->getLowLevelArticulation()); + arti->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_WAKECOUNTER); + } + +#ifdef _DEBUG + if(mSim) + mSim->debugCheckSleepStateOfLinks(false); +#endif +} + +void Sc::ArticulationCore::putToSleep() +{ + mCore.wakeCounter = 0.0f; + + if (mSim) + { + Dy::FeatherstoneArticulation* arti = static_cast(mSim->getLowLevelArticulation()); + arti->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_WAKECOUNTER); + } + +#ifdef _DEBUG + if(mSim) + mSim->debugCheckSleepStateOfLinks(true); +#endif +} + +void Sc::ArticulationCore::setArticulationFlags(PxArticulationFlags flags) +{ + mCore.flags = flags; + if (mSim) + { + const bool isKinematicLink = flags & PxArticulationFlag::eFIX_BASE; + mSim->setKinematicLink(isKinematicLink); + } +} + +PxU32 Sc::ArticulationCore::getDofs() const +{ + return mSim ? mSim->getDofs() : 0xFFFFFFFFu; +} + +PxArticulationCache* Sc::ArticulationCore::createCache() const +{ + return mSim ? mSim->createCache() : NULL; +} + +PxU32 Sc::ArticulationCore::getCacheDataSize() const +{ + return mSim ? mSim->getCacheDataSize() : 0xFFFFFFFFu; +} + +void Sc::ArticulationCore::zeroCache(PxArticulationCache& cache) const +{ + if(mSim) + mSim->zeroCache(cache); +} + +bool Sc::ArticulationCore::applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const +{ + if(mSim) + return mSim->applyCache(cache, flag); + return false; +} + +void Sc::ArticulationCore::copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const +{ + if(mSim) + mSim->copyInternalStateToCache(cache, flag); +} + + +void Sc::ArticulationCore::packJointData(const PxReal* maximum, PxReal* reduced) const +{ + if(mSim) + mSim->packJointData(maximum, reduced); +} + +void Sc::ArticulationCore::unpackJointData(const PxReal* reduced, PxReal* maximum) const +{ + if(mSim) + mSim->unpackJointData(reduced, maximum); +} + +void Sc::ArticulationCore::commonInit() const +{ + if(mSim) + mSim->commonInit(); +} + +void Sc::ArticulationCore::computeGeneralizedGravityForce(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeGeneralizedGravityForce(cache); +} + +void Sc::ArticulationCore::computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeCoriolisAndCentrifugalForce(cache); +} + +void Sc::ArticulationCore::computeGeneralizedExternalForce(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeGeneralizedExternalForce(cache); +} + +void Sc::ArticulationCore::computeJointAcceleration(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeJointAcceleration(cache); +} + +void Sc::ArticulationCore::computeJointForce(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeJointForce(cache); +} + +void Sc::ArticulationCore::computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) const +{ + if(mSim) + mSim->computeDenseJacobian(cache, nRows, nCols); +} + +void Sc::ArticulationCore::computeCoefficientMatrix(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeCoefficientMatrix(cache); +} + +bool Sc::ArticulationCore::computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, const PxReal* const jointTorque, const PxVec3 gravity, const PxU32 maxIter) const +{ + return mSim ? mSim->computeLambda(cache, initialState, jointTorque, gravity, maxIter) : false; +} + +void Sc::ArticulationCore::computeGeneralizedMassMatrix(PxArticulationCache& cache) const +{ + if(mSim) + mSim->computeGeneralizedMassMatrix(cache); +} + +PxU32 Sc::ArticulationCore::getCoefficientMatrixSize() const +{ + return mSim ? mSim->getCoefficientMatrixSize() : 0xFFFFFFFFu; +} + +PxSpatialVelocity Sc::ArticulationCore::getLinkAcceleration(const PxU32 linkId) const +{ + return mSim ? mSim->getLinkAcceleration(linkId) : PxSpatialVelocity(); +} + +PxU32 Sc::ArticulationCore::getGpuArticulationIndex() const +{ + return mSim ? mCore.gpuRemapIndex : 0xffffffff; +} + +void Sc::ArticulationCore::updateKinematic(PxArticulationKinematicFlags flags) +{ + PX_ASSERT(mSim); + + if (mSim) + mSim->updateKinematic(flags); + +} + +PxNodeIndex Sc::ArticulationCore::getIslandNodeIndex() const +{ + return mSim ? mSim->getIslandNodeIndex() : PxNodeIndex(PX_INVALID_NODE); +} + +void Sc::ArticulationCore::setGlobalPose() +{ + if(mSim) + mSim->setGlobalPose(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp new file mode 100644 index 0000000..f02cb7a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointCore.cpp @@ -0,0 +1,263 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationJointCore.h" +#include "ScArticulationCore.h" +#include "ScArticulationSim.h" +#include "ScArticulationJointSim.h" +#include "ScBodyCore.h" +#include "ScPhysics.h" + +using namespace physx; + +Sc::ArticulationJointCore::ArticulationJointCore(const PxTransform& parentFrame, const PxTransform& childFrame) : + mCore (parentFrame, childFrame), + mSim (NULL), + mArticulation (NULL), + mRootType (NULL), + mLLLinkIndex (0xffffffff) +{ +} + +Sc::ArticulationJointCore::~ArticulationJointCore() +{ + PX_ASSERT(getSim() == 0); +} + +void Sc::ArticulationJointCore::setSimDirty() +{ + Sc::ArticulationJointSim* sim = getSim(); + if(sim) + sim->setDirty(); +} + +void Sc::ArticulationJointCore::setParentPose(const PxTransform& t) +{ + mCore.parentPose = t; + setDirty(Dy::ArticulationJointCoreDirtyFlag::eFRAME); +} + +void Sc::ArticulationJointCore::setChildPose(const PxTransform& t) +{ + mCore.childPose = t; + setDirty(Dy::ArticulationJointCoreDirtyFlag::eFRAME); +} + +void Sc::ArticulationJointCore::setTargetP(PxArticulationAxis::Enum axis, PxReal targetP) +{ + mCore.targetP[axis] = targetP; + + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim) + { + Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + Dy::ArticulationData& data = llarticulation->getArticulationData(); + //Dy::ArticulationJointCoreData* jointData = data.getJointData(); + //Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + Dy::ArticulationJointTargetData* targetData = data.getJointTranData(); + Dy::ArticulationJointTargetData& targetDatum = targetData[mLLLinkIndex]; + + PxReal* jointTargetPositions = targetDatum.targetJointPosition; + + const PxU32 dofId = mCore.invDofIds[axis]; + if (dofId != 0xff) + { + jointTargetPositions[dofId] = targetP; + + setDirty(Dy::ArticulationJointCoreDirtyFlag::eTARGETPOSE); + } + } +} + +void Sc::ArticulationJointCore::setTargetV(PxArticulationAxis::Enum axis, PxReal targetV) +{ + mCore.targetV[axis] = targetV; + + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + Dy::ArticulationData& data = llarticulation->getArticulationData(); + //Dy::ArticulationJointCoreData* jointData = data.getJointData(); + //Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + Dy::ArticulationJointTargetData* targetData = data.getJointTranData(); + Dy::ArticulationJointTargetData& targetDatum = targetData[mLLLinkIndex]; + + PxReal* jointTargetVelocities = targetDatum.targetJointVelocity; + + const PxU32 dofId = mCore.invDofIds[axis]; + if (dofId != 0xff) + { + jointTargetVelocities[dofId] = targetV; + + setDirty(Dy::ArticulationJointCoreDirtyFlag::eTARGETVELOCITY); + } + } +} + +void Sc::ArticulationJointCore::setArmature(PxArticulationAxis::Enum axis, PxReal armature) +{ + mCore.armature[axis] = armature; + + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + Dy::ArticulationData& data = llarticulation->getArticulationData(); + + Dy::ArticulationJointTargetData* targetData = data.getJointTranData(); + Dy::ArticulationJointTargetData& targetDatum = targetData[mLLLinkIndex]; + + PxReal* jArmatures = targetDatum.armature; + + const PxU32 dofId = mCore.invDofIds[axis]; + if (dofId != 0xff) + { + jArmatures[dofId] = armature; + + setDirty(Dy::ArticulationJointCoreDirtyFlag::eARMATURE); + } + } +} + +void Sc::ArticulationJointCore::setJointPosition(PxArticulationAxis::Enum axis, const PxReal jointPos) +{ + mCore.jointPos[axis] = jointPos; + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + Dy::ArticulationData& data = llarticulation->getArticulationData(); + Dy::ArticulationJointCoreData* jointData = data.getJointData(); + Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + PxReal* jointPositions = data.getJointPositions(); + PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + const PxU32 dofId = mCore.invDofIds[axis]; + + if (dofId != 0xff) + { + jPosition[dofId] = jointPos; + + ////replace with update kinematics + //llarticulation->teleportLinks(data); + //llarticulation->computeLinkVelocities(data); + + //artiSim->setJointPosition(axis, jointPos); + setDirty(Dy::ArticulationJointCoreDirtyFlag::eJOINT_POS); + } + } +} + +PxReal Sc::ArticulationJointCore::getJointPosition(PxArticulationAxis::Enum axis) const +{ + PxReal jointPos = mCore.jointPos[axis]; + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + const Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + const Dy::ArticulationData& data = llarticulation->getArticulationData(); + const Dy::ArticulationJointCoreData* jointData = data.getJointData(); + const Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + const PxReal* jointPositions = data.getJointPositions(); + const PxReal* jPosition = &jointPositions[jointDatum.jointOffset]; + + const PxU32 dofId = mCore.invDofIds[axis]; + + if(dofId != 0xff) + jointPos = jPosition[dofId]; + } + + return jointPos; +} + +void Sc::ArticulationJointCore::setJointVelocity(PxArticulationAxis::Enum axis, const PxReal jointVel) +{ + mCore.jointVel[axis] = jointVel; + + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + Dy::ArticulationData& data = llarticulation->getArticulationData(); + Dy::ArticulationJointCoreData* jointData = data.getJointData(); + Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + PxReal* jointVelocities = data.getJointVelocities(); + PxReal* jVelocity = &jointVelocities[jointDatum.jointOffset]; + + const PxU32 dofId = mCore.invDofIds[axis]; + if (dofId != 0xff) + { + jVelocity[dofId] = jointVel; + + //llarticulation->computeLinkVelocities(data); + + setDirty(Dy::ArticulationJointCoreDirtyFlag::eJOINT_VEL); + } + } +} + +PxReal Sc::ArticulationJointCore::getJointVelocity(PxArticulationAxis::Enum axis) const +{ + PxReal jointVel = mCore.jointVel[axis]; + ArticulationSim* artiSim = mArticulation->getSim(); + if (artiSim && artiSim->getLLArticulationInitialized()) + { + const Dy::FeatherstoneArticulation* llarticulation = artiSim->getLowLevelArticulation(); + const Dy::ArticulationData& data = llarticulation->getArticulationData(); + const Dy::ArticulationJointCoreData* jointData = data.getJointData(); + const Dy::ArticulationJointCoreData& jointDatum = jointData[mLLLinkIndex]; + + const PxReal* jointVelocities = data.getJointVelocities(); + const PxReal* jVelocities = &jointVelocities[jointDatum.jointOffset]; + + const PxU32 dofId = mCore.invDofIds[axis]; + if (dofId != 0xff) + jointVel = jVelocities[dofId]; + } + + return jointVel; +} + +void Sc::ArticulationJointCore::setLimit(PxArticulationAxis::Enum axis, const PxArticulationLimit& limit) +{ + mCore.initLimit(axis, limit); + + setDirty(Dy::ArticulationJointCoreDirtyFlag::eLIMIT); +} + +void Sc::ArticulationJointCore::setDrive(PxArticulationAxis::Enum axis, const PxArticulationDrive& drive) +{ + mCore.initDrive(axis, drive); + setDirty(Dy::ArticulationJointCoreDirtyFlag::eDRIVE); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp new file mode 100644 index 0000000..141f414 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.cpp @@ -0,0 +1,94 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationJointSim.h" +#include "ScArticulationJointCore.h" +#include "ScBodySim.h" +#include "ScScene.h" +#include "PxsRigidBody.h" +#include "ScArticulationSim.h" +#include "PxsSimpleIslandManager.h" + +using namespace physx; + +Sc::ArticulationJointSim::ArticulationJointSim(ArticulationJointCore& joint, ActorSim& parent, ActorSim& child) : + Interaction (parent, child, InteractionType::eARTICULATION, 0), + mCore (joint) +{ + registerInActors(); + + BodySim& childBody = static_cast(child), + & parentBody = static_cast(parent); + + parentBody.getArticulation()->addBody(childBody, &parentBody, this); + + mCore.setSim(this); +} + +Sc::ArticulationJointSim::~ArticulationJointSim() +{ + // articulation interactions do not make use of the dirty flags yet. If they did, a setClean(true) has to be introduced here. + PX_ASSERT(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)); + PX_ASSERT(!getDirtyFlags()); + + unregisterFromActors(); + + mCore.setSim(NULL); +} + +Sc::BodySim& Sc::ArticulationJointSim::getParent() const +{ + return static_cast(getActorSim0()); +} + +Sc::BodySim& Sc::ArticulationJointSim::getChild() const +{ + return static_cast(getActorSim1()); +} + +bool Sc::ArticulationJointSim::onActivate_(void*) +{ + if(!(getParent().isActive() && getChild().isActive())) + return false; + + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; +} + +bool Sc::ArticulationJointSim::onDeactivate_() +{ + clearInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; +} + +void Sc::ArticulationJointSim::setDirty() +{ + Dy::ArticulationJointCore& llCore = mCore.getCore(); + ArticulationSim* sim = mCore.getArticulation()->getSim(); + sim->setJointDirty(llCore); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.h new file mode 100644 index 0000000..2569795 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationJointSim.h @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_JOINT_SIM_H +#define SC_ARTICULATION_JOINT_SIM_H + +#include "ScInteraction.h" + +namespace physx +{ +namespace Sc +{ + class ArticulationJointCore; + class BodySim; + + class ArticulationJointSim : public Interaction + { + ArticulationJointSim& operator=(const ArticulationJointSim &); + + public: + ArticulationJointSim(ArticulationJointCore& joint, ActorSim& parent, ActorSim& child); + ~ArticulationJointSim(); + + bool onActivate_(void*); + bool onDeactivate_(); + + PX_FORCE_INLINE ArticulationJointCore& getCore() const { return mCore; } + + BodySim& getParent() const; + BodySim& getChild() const; + + void setDirty(); + + //--------------------------------------------------------------------------------- + // Low Level data access + //--------------------------------------------------------------------------------- + private: + ArticulationJointCore& mCore; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp new file mode 100644 index 0000000..67adb00 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationSensorSim.h" +#include "ScArticulationSensor.h" +#include "PxArticulationReducedCoordinate.h" +#include "ScArticulationSim.h" +#include "PxArticulationReducedCoordinate.h" + +namespace physx +{ + + Sc::ArticulationSensorSim::ArticulationSensorSim(ArticulationSensorCore& sensorCore, Scene& scene) : + mScene(scene), mCore(sensorCore), + mLLIndex(0xffffffff) + { + sensorCore.setSim(this); + mLLSensor.mRelativePose = sensorCore.mRelativePose; + mLLSensor.mFlags = sensorCore.mFlags; + } + + Sc::ArticulationSensorSim::~ArticulationSensorSim() + { + mCore.setSim(NULL); + } + + const PxSpatialForce& Sc::ArticulationSensorSim::getForces() const + { + return mArticulationSim->getSensorForce(mLLIndex); + } + + void Sc::ArticulationSensorSim::setRelativePose(const PxTransform& relativePose) + { + mLLSensor.mRelativePose = relativePose; + + mArticulationSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_SENSOR); + } + + void Sc::ArticulationSensorSim::setFlag(const PxU16 flag) + { + mLLSensor.mFlags = flag; + mArticulationSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_SENSOR); + + } + + +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.h new file mode 100644 index 0000000..576dec5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSensorSim.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_SENSOR_SIM_H +#define SC_ARTICULATION_SENSOR_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "PxArticulationReducedCoordinate.h" +#include "DyFeatherstoneArticulation.h" + +namespace physx +{ +namespace Sc +{ +class Scene; +class ArticulationSensorCore; +class ArticulationCore; +class ArticulationSim; + +class ArticulationSensorSim : public PxUserAllocated +{ + + PX_NOCOPY(ArticulationSensorSim) + + +public: + ArticulationSensorSim(Sc::ArticulationSensorCore& core, Sc::Scene& scene); + + ~ArticulationSensorSim(); + + const PxSpatialForce& getForces() const; + + void setRelativePose(const PxTransform& relativePose); + void setFlag(PxU16 flag); + + PX_FORCE_INLINE Sc::Scene& getScene() { return mScene; } + PX_FORCE_INLINE const Sc::Scene& getScene() const { return mScene; } + + PX_FORCE_INLINE void setLowLevelIndex(const PxU32 llIndex) { mLLIndex = llIndex;} + PX_FORCE_INLINE PxU32 getLowLevelIndex() const { return mLLIndex; } + + + PX_FORCE_INLINE Sc::ArticulationSensorCore& getCore() { return mCore; } + PX_FORCE_INLINE const Sc::ArticulationSensorCore& getCore() const { return mCore; } + + PX_FORCE_INLINE Dy::ArticulationSensor& getLLSensor() { return mLLSensor; } + + + Sc::Scene& mScene; + Sc::ArticulationSensorCore& mCore; + Sc::ArticulationSim* mArticulationSim; + Dy::ArticulationSensor mLLSensor; + PxU32 mLLIndex; +}; + +} +} + +#endif //SC_ARTICULATION_SENSOR_SIM_H + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp new file mode 100644 index 0000000..dbe1047 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.cpp @@ -0,0 +1,883 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationSim.h" +#include "ScArticulationCore.h" +#include "ScArticulationJointSim.h" +#include "ScArticulationJointCore.h" +#include "ScBodySim.h" +#include "ScConstraintSim.h" +#include "ScArticulationTendonSim.h" +#include "ScArticulationSensorSim.h" +#include "ScArticulationSensor.h" +#include "ScScene.h" + +#include "DyConstraint.h" +#include "DyFeatherstoneArticulation.h" +#include "PxsContext.h" +#include "CmSpatialVector.h" +#include "foundation/PxVecMath.h" +#include "PxsSimpleIslandManager.h" +#include "ScShapeSim.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace physx::Dy; + +Sc::ArticulationSim::ArticulationSim(ArticulationCore& core, Scene& scene, BodyCore& root) : + mLLArticulation (NULL), + mScene (scene), + mCore (core), + mLinks ("ScArticulationSim::links"), + mBodies ("ScArticulationSim::bodies"), + mJoints ("ScArticulationSim::joints"), + mMaxDepth (0), + mIsLLArticultionInitialized(false) +{ + mLinks.reserve(16); + mJoints.reserve(16); + mBodies.reserve(16); + + mLLArticulation = mScene.createLLArticulation(this); + + mIslandNodeIndex = scene.getSimpleIslandManager()->addArticulation(this, mLLArticulation, false); + + if(!mLLArticulation) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Articulation: could not allocate low-level resources."); + return; + } + + PX_ASSERT(root.getSim()); + + addBody(*root.getSim(), NULL, NULL); + + mCore.setSim(this); + + mLLArticulation->setDyContext(mScene.getDynamicsContext()); + mLLArticulation->getSolverDesc().initData(&core.getCore(), NULL); + + //mLLArticulation->onUpdateSolverDesc(); +} + +Sc::ArticulationSim::~ArticulationSim() +{ + if (!mLLArticulation) + return; + + mScene.destroyLLArticulation(*mLLArticulation); + + mScene.getSimpleIslandManager()->removeNode(mIslandNodeIndex); + + mCore.setSim(NULL); +} + +PxU32 Sc::ArticulationSim::findBodyIndex(BodySim& body) const +{ + for(PxU32 i=0; igetBody(0); + BodySim* bodySim1 = constraintSim->getBody(1); + + ArticulationLoopConstraint lConstraint; + if (bodySim0) + lConstraint.linkIndex0 = findBodyIndex(*bodySim0); + else + lConstraint.linkIndex0 = 0x80000000; + + if(bodySim1) + lConstraint.linkIndex1 = findBodyIndex(*bodySim1); + else + lConstraint.linkIndex1 = 0x80000000; + + lConstraint.constraint = &constraintSim->getLowLevelConstraint(); + + mLoopConstraints.pushBack(lConstraint); +} + +void Sc::ArticulationSim::removeLoopConstraint(ConstraintSim* constraintSim) +{ + Dy::Constraint* constraint = &constraintSim->getLowLevelConstraint(); + + const PxU32 size = mLoopConstraints.size(); + PxU32 index = 0; + while (index < size && mLoopConstraints[index].constraint != constraint) + ++index; + + if (index != size) + mLoopConstraints.replaceWithLast(index); +} + +void Sc::ArticulationSim::updateCached(PxBitMapPinned* shapeChangedMap) +{ + for(PxU32 i=0; iupdateCached(shapeChangedMap); +} + +void Sc::ArticulationSim::markShapesUpdated(PxBitMapPinned* shapeChangedMap) +{ + for (PxU32 a = 0; a < mBodies.size(); ++a) + { + PxU32 nbElems = mBodies[a]->getNbElements(); + ElementSim** elems = mBodies[a]->getElements(); + while (nbElems--) + { + ShapeSim* sim = static_cast(*elems++); + if (sim->isInBroadPhase()) + shapeChangedMap->growAndSet(sim->getElementID()); + } + } +} + +void Sc::ArticulationSim::addBody(BodySim& body, BodySim* parent, ArticulationJointSim* joint) +{ + mBodies.pushBack(&body); + mJoints.pushBack(joint); + mLLArticulation->addBody(); + + const PxU32 index = mLinks.size(); + + PX_ASSERT((((index==0) && (joint == 0)) && (parent == 0)) || + (((index!=0) && joint) && (parent && (parent->getArticulation() == this)))); + + ArticulationLink& link = mLinks.insert(); + + link.bodyCore = &body.getBodyCore().getCore(); + link.children = 0; + link.mPathToRootStartIndex = 0; + link.mPathToRootCount = 0; + link.mChildrenStartIndex = 0xffffffff; + link.mNumChildren = 0; + bool shouldSleep; + bool currentlyAsleep; + const bool bodyReadyForSleep = body.checkSleepReadinessBesidesWakeCounter(); + const PxReal wakeCounter = getCore().getWakeCounter(); + + if(parent) + { + currentlyAsleep = !mBodies[0]->isActive(); + shouldSleep = currentlyAsleep && bodyReadyForSleep; + + PxU32 parentIndex = findBodyIndex(*parent); + link.parent = parentIndex; + ArticulationLink& parentLink = mLinks[parentIndex]; + link.pathToRoot = parentLink.pathToRoot | ArticulationBitField(1)<getCore().getCore(); + parentLink.children |= ArticulationBitField(1)<internalWakeUpArticulationLink(wakeCounter); + } + + body.setArticulation(this, wakeCounter, shouldSleep, index); +} + +void Sc::ArticulationSim::removeBody(BodySim& body) +{ + for (PxU32 i = 0; i < mBodies.size(); ++i) + { + if (mBodies[i] == &body) + { + mBodies.replaceWithLast(i); + mJoints.replaceWithLast(i); + break; + } + } + +} + + +void Sc::ArticulationSim::addTendon(ArticulationSpatialTendonSim* tendonSim) +{ + tendonSim->mArtiSim = this; + + const PxU32 index = mSpatialTendons.size(); + Dy::ArticulationSpatialTendon& llTendon = tendonSim->mLLTendon; + llTendon.setTendonIndex(index); + mSpatialTendons.pushBack(&llTendon); + + //mSpatialTendons.pushBack(&tendonSim->mLLTendon); +} + +void Sc::ArticulationSim::addTendon(ArticulationFixedTendonSim* tendonSim) +{ + tendonSim->mArtiSim = this; + + const PxU32 index = mFixedTendons.size(); + Dy::ArticulationFixedTendon& llTendon = tendonSim->mLLTendon; + llTendon.setTendonIndex(index); + mFixedTendons.pushBack(&llTendon); +} + + +void Sc::ArticulationSim::addSensor(ArticulationSensorSim* sensorSim, const PxU32 linkID) +{ + const PxU32 index = mSensors.size(); + sensorSim->setLowLevelIndex(index); + sensorSim->mArticulationSim = this; + + Dy::ArticulationSensor& llSensor = sensorSim->getLLSensor(); + llSensor.mLinkID = PxU16(linkID); + mSensors.pushBack(&llSensor); + mSensorForces.insert(); + mSensorForces.back().force = PxVec3(0.f); + mSensorForces.back().torque = PxVec3(0.f); +} + +void Sc::ArticulationSim::createLLStructure() +{ + if(!mBodies.size()) + return; + + mLLArticulation->setupLinks(mLinks.size(), const_cast(mLinks.begin())); + + mLLArticulation->assignTendons(mSpatialTendons.size(), const_cast(mSpatialTendons.begin())); + + mLLArticulation->assignTendons(mFixedTendons.size(), const_cast(mFixedTendons.begin())); + + mLLArticulation->assignSensors(mSensors.size(), const_cast(mSensors.begin()), const_cast(mSensorForces.begin())); + + mIsLLArticultionInitialized = true; + +} + +void Sc::ArticulationSim::initializeConfiguration() +{ + Dy::ArticulationData& data = mLLArticulation->getArticulationData(); + mLLArticulation->jcalc(data); + + Dy::ArticulationLink* links = data.getLinks(); + Dy::ArticulationJointCoreData* jointData = data.getJointData(); + const PxU32 linkCount = data.getLinkCount(); + + PxReal* jointVelocites = data.getJointVelocities(); + PxReal* jointPositions = data.getJointPositions(); + + for (PxU32 linkID = 1; linkID < linkCount; ++linkID) + { + Dy::ArticulationLink& link = links[linkID]; + + Dy::ArticulationJointCore* joint = link.inboundJoint; + Dy::ArticulationJointCoreData& jointDatum = jointData[linkID]; + + PxReal* jPositions = &jointPositions[jointDatum.jointOffset]; + PxReal* jVelocites = &jointVelocites[jointDatum.jointOffset]; + for (PxU8 i = 0; i < jointDatum.dof; ++i) + { + const PxU32 dofId = joint->dofIds[i]; + jPositions[i] = joint->jointPos[dofId]; + jVelocites[i] = joint->jointVel[dofId]; + } + } + + mLLArticulation->initPathToRoot(); +} + +void Sc::ArticulationSim::updateKinematic(PxArticulationKinematicFlags flags) +{ + Dy::ArticulationData& data = mLLArticulation->getArticulationData(); + + if ((flags & PxArticulationKinematicFlag::ePOSITION)) + { + mLLArticulation->raiseGPUDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_POSITIONS); + mLLArticulation->teleportLinks(data); + } + + if ((flags & PxArticulationKinematicFlag::ePOSITION) || + (flags & PxArticulationKinematicFlag::eVELOCITY)) + { + mLLArticulation->raiseGPUDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_VELOCITIES); + mLLArticulation->computeLinkVelocities(data); + } +} + +void Sc::ArticulationSim::copyJointStatus(const PxU32 linkID) +{ + Dy::ArticulationData& data = mLLArticulation->getArticulationData(); + Dy::ArticulationLink* links = data.getLinks(); + Dy::ArticulationJointCoreData* jointData = data.getJointData(); + + Dy::ArticulationLink& link = links[linkID]; + Dy::ArticulationJointCore* joint = link.inboundJoint; + Dy::ArticulationJointCoreData& jointDatum = jointData[linkID]; + + PxReal* jointVelocites = data.getJointVelocities(); + PxReal* jointPositions = data.getJointPositions(); + + PxReal* jVelocities = &jointVelocites[jointDatum.jointOffset]; + PxReal* jPositions = &jointPositions[jointDatum.jointOffset]; + + for(PxU8 i = 0; i < jointDatum.dof; ++i) + { + const PxU32 dofId = joint->dofIds[i]; + joint->jointPos[dofId] = jPositions[i]; + joint->jointVel[dofId] = jVelocities[i]; + } + +} + +void Sc::ArticulationSim::updateCCDLinks(PxArray& sims) +{ + + for (PxU32 a = 0; a < mBodies.size(); ++a) + { + if (mBodies[a]->getLowLevelBody().getCore().mFlags & PxRigidBodyFlag::eENABLE_CCD) + { + sims.pushBack(mBodies[a]); + } + } +} + +void Sc::ArticulationSim::putToSleep() +{ + for (PxU32 i = 0; i < mLinks.size(); i++) + { + BodySim* bodySim = mBodies[i]; + PxsRigidBody& rigid = bodySim->getLowLevelBody(); + + PxsBodyCore& bodyCore = bodySim->getBodyCore().getCore(); + + //rigid.setPose(rigid.getLastCCDTransform()); + + //KS - the IG deactivates bodies in parallel with the solver. It appears that under certain circumstances, the solver's integration (which performs + //sleep checks) could decide that the body is no longer a candidate for sleeping on the same frame that the island gen decides to deactivate the island + //that the body is contained in. This is a rare occurrence but the behavior we want to emulate is that of IG running before solver so we should therefore + //permit the IG to make the authoritative decision over whether the body should be active or inactive. + bodyCore.wakeCounter = 0.0f; + bodyCore.linearVelocity = PxVec3(0.0f); + bodyCore.angularVelocity = PxVec3(0.0f); + + rigid.clearAllFrameFlags(); + + //Force update + } + mScene.getSimulationController()->updateArticulation(mLLArticulation, mIslandNodeIndex); +} + +void Sc::ArticulationSim::sleepCheck(PxReal dt) +{ + if(!mBodies.size()) + return; + +#if PX_CHECKED + { + PxReal maxTimer = 0.0f, minTimer = PX_MAX_F32; + bool allActive = true, noneActive = true; + PX_UNUSED(allActive); + PX_UNUSED(noneActive); + for(PxU32 i=0;igetBodyCore().getWakeCounter(); + maxTimer = PxMax(maxTimer, timer); + minTimer = PxMin(minTimer, timer); + bool active = mBodies[i]->isActive(); + allActive &= active; + noneActive &= !active; + } + // either all links are asleep, or no links are asleep + PX_ASSERT(maxTimer==0 || minTimer!=0); + PX_ASSERT(allActive || noneActive); + } + +#endif + + if(!mBodies[0]->isActive()) + return; + + const PxReal sleepThreshold = getCore().getCore().sleepThreshold; + + PxReal maxTimer = 0.0f , minTimer = PX_MAX_F32; + + for(PxU32 i=0;igetMotionVelocity(i); + PxReal timer = mBodies[i]->updateWakeCounter(dt, sleepThreshold, motionVelocity); + maxTimer = PxMax(maxTimer, timer); + minTimer = PxMin(minTimer, timer); + } + + mCore.setWakeCounterInternal(maxTimer); + + if(maxTimer != 0.0f) + { + if(minTimer == 0.0f) + { + // make sure nothing goes to sleep unless everything does + for(PxU32 i=0;igetBodyCore().setWakeCounterFromSim(PxMax(1e-6f, mBodies[i]->getBodyCore().getWakeCounter())); + } + return; + } + + for(PxU32 i=0;inotifyReadyForSleeping(); + mBodies[i]->resetSleepFilter(); + } + + mScene.getSimpleIslandManager()->deactivateNode(mIslandNodeIndex); +} + +bool Sc::ArticulationSim::isSleeping() const +{ + return (mBodies.size() > 0) ? (!mBodies[0]->isActive()) : true; +} + +void Sc::ArticulationSim::internalWakeUp(PxReal wakeCounter) +{ + if(mCore.getWakeCounter() < wakeCounter) + { + mCore.setWakeCounterInternal(wakeCounter); + for(PxU32 i=0;iinternalWakeUpArticulationLink(wakeCounter); + } +} + +void Sc::ArticulationSim::setActive(const bool b, const PxU32 infoFlag) +{ + const PxReal wakeCounter = mCore.getWakeCounter(); + for(PxU32 i=0;igetBodyCore().setWakeCounterFromSim(wakeCounter); + mBodies[i]->setActive(b, infoFlag); + } +} + +void Sc::ArticulationSim::updateForces(PxReal dt, bool notify) +{ + PxU32 count = 0; + + for(PxU32 i=0;iupdateForces(dt, NULL, NULL, count, &mLLArticulation->getSolverDesc().acceleration[i]); + } + if(notify) + mScene.getSimulationController()->updateArticulationExtAccel(mLLArticulation, mIslandNodeIndex); +} + +void Sc::ArticulationSim::clearAcceleration(PxReal dt) +{ + PxU32 count = 0; + + for (PxU32 i = 0; i < mBodies.size(); i++) + { + if (i + 1 < mBodies.size()) + { + PxPrefetchLine(mBodies[i + 1], 128); + PxPrefetchLine(mBodies[i + 1], 256); + } + + + const bool accDirty = mBodies[i]->readVelocityModFlag(VMF_ACC_DIRTY); + + if (!accDirty) + { + mLLArticulation->getSolverDesc().acceleration[i].linear = PxVec3(0.f); + mLLArticulation->getSolverDesc().acceleration[i].angular = PxVec3(0.f); + } + else + mBodies[i]->updateForces(dt, NULL, NULL, count, &mLLArticulation->getSolverDesc().acceleration[i]); + + } + + mScene.getSimulationController()->updateArticulationExtAccel(mLLArticulation, mIslandNodeIndex); +} + +void Sc::ArticulationSim::saveLastCCDTransform() +{ + for(PxU32 i=0;igetLowLevelBody().saveLastCCDTransform(); + } +} + +void Sc::ArticulationSim::setKinematicLink(const bool value) +{ + const PxU32 linkCount = mLinks.size(); + + if (linkCount > 0) + { + mLinks[0].bodyCore->kinematicLink = PxU8(value); + } +} + +PxU32 Sc::ArticulationSim::getDofs() const +{ + return mLLArticulation->getDofs(); +} + +PxU32 Sc::ArticulationSim::getDof(const PxU32 linkID) const +{ + return mLLArticulation->getDof(linkID); +} + +PX_COMPILE_TIME_ASSERT(sizeof(Cm::SpatialVector)==sizeof(PxSpatialForce)); +PxArticulationCache* Sc::ArticulationSim::createCache() +{ + const PxU32 totalSize = getCacheDataSize() + sizeof(PxArticulationCache); + + const PxU32 totalDofs = mLLArticulation->getDofs(); + const PxU32 linkCount = mLinks.size(); + const PxU32 sensorCount = mSensors.size(); + + PxU8* tCache = reinterpret_cast(PX_ALLOC(totalSize, "Articulation cache")); + PxMemZero(tCache, totalSize); + + PxArticulationCache* cache = reinterpret_cast(tCache); + + PxU32 offset = sizeof(PxArticulationCache); + cache->externalForces = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialForce) * linkCount; + cache->sensorForces = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialForce) * sensorCount; + + cache->denseJacobian = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * (6 + totalDofs) * (linkCount * 6); //size of dense jacobian assuming free floating base link. + + cache->massMatrix = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs * totalDofs; + + cache->jointVelocity = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointAcceleration = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointPosition = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointForce = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->jointSolverForces = reinterpret_cast(tCache + offset); + offset += sizeof(PxReal) * totalDofs; + + cache->linkVelocity = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialVelocity) * linkCount; + + cache->linkAcceleration = reinterpret_cast(tCache + offset); + offset += sizeof(PxSpatialVelocity) * linkCount; + + cache->rootLinkData = reinterpret_cast(tCache + offset); + + cache->coefficientMatrix = NULL; + cache->lambda =NULL; + + const PxU32 scratchMemorySize = getScratchMemorySize(); + void* scratchMemory = PX_ALLOC(scratchMemorySize, "Cache scratch memory"); + cache->scratchMemory = scratchMemory; + + PxcScratchAllocator* sa = PX_NEW(PxcScratchAllocator); + sa->setBlock(scratchMemory, scratchMemorySize); + cache->scratchAllocator = sa; + + return cache; +} + +PxU32 Sc::ArticulationSim::getCacheDataSize() const +{ + const PxU32 totalDofs = mLLArticulation->getDofs(); + const PxU32 linkCount = mLinks.size(); + const PxU32 sensorCount = mSensors.size(); + const PxU32 totalSize = + sizeof(PxSpatialForce) * linkCount //external force + + sizeof(PxSpatialForce) * sensorCount //sensors + + sizeof(PxReal) * (6 + totalDofs) * (linkCount * 6) //Free floating base dofs = 6 + totalDofs, and each link (incl. base) velocity has 6 elements + + sizeof(PxReal) * totalDofs * totalDofs //mass matrix + + sizeof(PxReal) * totalDofs * 5 //jointVelocity, jointAcceleration, jointPosition, joint force, joint constraint force + + sizeof(PxSpatialVelocity) * linkCount * 2 //link velocity, link acceleration + + sizeof(PxArticulationRootLinkData); //root link data + + return totalSize; +} + +PxU32 Sc::ArticulationSim::getScratchMemorySize() const +{ + const PxU32 totalDofs = mLLArticulation->getDofs(); + const PxU32 linkCount = mLinks.size(); + + PxU32 totalSize = + sizeof(Cm::SpatialVectorF) * linkCount * 5 //motionVelocity, motionAccelerations, coriolisVectors, spatialZAVectors, externalAccels; + + sizeof(Dy::SpatialMatrix) * linkCount //compositeSpatialInertias; + + sizeof(PxReal) * totalDofs * 5; //jointVelocity, jointAcceleration, jointForces, jointPositions, jointFrictionForces + + totalSize = (totalSize+15)&~15; + + return totalSize; +} + +void Sc::ArticulationSim::zeroCache(PxArticulationCache& cache) const +{ + const PxU32 cacheDataSize = getCacheDataSize(); + + PxMemZero(cache.externalForces, cacheDataSize); +} + +//copy external data to internal data +bool Sc::ArticulationSim::applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const +{ + //checkResize(); + bool shouldWake = false; + if (mLLArticulation->applyCache(cache, flag, shouldWake)) + { + mScene.getSimulationController()->updateArticulation(mLLArticulation, mIslandNodeIndex); + } + return shouldWake; +} + +//copy internal data to external data +void Sc::ArticulationSim::copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const +{ + mLLArticulation->copyInternalStateToCache(cache, flag); +} + + +void Sc::ArticulationSim::packJointData(const PxReal* maximum, PxReal* reduced) const +{ + mLLArticulation->packJointData(maximum, reduced); +} + +void Sc::ArticulationSim::unpackJointData(const PxReal* reduced, PxReal* maximum) const +{ + mLLArticulation->unpackJointData(reduced, maximum); +} + +void Sc::ArticulationSim::commonInit() +{ + mLLArticulation->initializeCommonData(); +} + +void Sc::ArticulationSim::computeGeneralizedGravityForce(PxArticulationCache& cache) +{ + mLLArticulation->getGeneralizedGravityForce(mScene.getGravityFast(), cache); +} + +void Sc::ArticulationSim::computeCoriolisAndCentrifugalForce(PxArticulationCache& cache) +{ + mLLArticulation->getCoriolisAndCentrifugalForce(cache); +} + +void Sc::ArticulationSim::computeGeneralizedExternalForce(PxArticulationCache& cache) +{ + mLLArticulation->getGeneralizedExternalForce(cache); +} + +void Sc::ArticulationSim::computeJointAcceleration(PxArticulationCache& cache) +{ + mLLArticulation->getJointAcceleration(mScene.getGravityFast(), cache); +} + +void Sc::ArticulationSim::computeJointForce(PxArticulationCache& cache) +{ + mLLArticulation->getJointForce(cache); +} + +void Sc::ArticulationSim::computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols) +{ + mLLArticulation->getDenseJacobian(cache, nRows, nCols); +} + +void Sc::ArticulationSim::computeCoefficientMatrix(PxArticulationCache& cache) +{ + mLLArticulation->getCoefficientMatrixWithLoopJoints(mLoopConstraints.begin(), mLoopConstraints.size(), cache); +} + +bool Sc::ArticulationSim::computeLambda(PxArticulationCache& cache, PxArticulationCache& initialState, + const PxReal* const jointTorque, const PxVec3 gravity, const PxU32 maxIter) +{ + const PxReal invLengthScale = 1.f / mScene.getLengthScale(); + return mLLArticulation->getLambda(mLoopConstraints.begin(), mLoopConstraints.size(), cache, initialState, jointTorque, gravity, maxIter, invLengthScale); +} + +void Sc::ArticulationSim::computeGeneralizedMassMatrix(PxArticulationCache& cache) +{ + mLLArticulation->getGeneralizedMassMatrixCRB(cache); + + /*const PxU32 totalDofs = mLLArticulation->getDofs(); + + PxReal* massMatrix = reinterpret_cast(PX_ALLOC(sizeof(PxReal) * totalDofs * totalDofs, "MassMatrix")); + PxMemCopy(massMatrix, cache.massMatrix, sizeof(PxReal)*totalDofs * totalDofs); + + mLLArticulation->getGeneralizedMassMatrix(cache); + + PxReal* massMatrix1 = cache.massMatrix; + for (PxU32 i = 0; i < totalDofs; ++i) + { + PxReal* row = &massMatrix1[i * totalDofs]; + + for (PxU32 j = 0; j < totalDofs; ++j) + { + const PxReal dif = row[j] - massMatrix[j*totalDofs + i]; + PX_ASSERT (PxAbs(dif) < 2e-4f) + } + } + + PX_FREE(massMatrix);*/ +} + +PxU32 Sc::ArticulationSim::getCoefficientMatrixSize() const +{ + const PxU32 size = mLoopConstraints.size(); + const PxU32 totalDofs = mLLArticulation->getDofs(); + return size * totalDofs; +} + +void Sc::ArticulationSim::setRootLinearVelocity(const PxVec3& velocity) +{ + mLLArticulation->setRootLinearVelocity(velocity); +} + +void Sc::ArticulationSim::setRootAngularVelocity(const PxVec3& velocity) +{ + mLLArticulation->setRootAngularVelocity(velocity); +} + +PxSpatialVelocity Sc::ArticulationSim::getLinkVelocity(const PxU32 linkId) const +{ + Cm::SpatialVector vel = mLLArticulation->getLinkScalarVelocity(linkId); + return reinterpret_cast(vel); +} + +PxSpatialVelocity Sc::ArticulationSim::getLinkAcceleration(const PxU32 linkId) const +{ + Cm::SpatialVector accel = mLLArticulation->getMotionAcceleration(linkId); + return reinterpret_cast(accel); +} + +// This method allows user teleport the root links and the articulation +//system update all other links pose +void Sc::ArticulationSim::setGlobalPose() +{ + mLLArticulation->teleportRootLink(); +} + +void Sc::ArticulationSim::setJointDirty(Dy::ArticulationJointCore& jointCore) +{ + PX_UNUSED(jointCore); + mScene.getSimulationController()->updateArticulationJoint(mLLArticulation, mIslandNodeIndex); +} + +void Sc::ArticulationSim::setArticulationDirty(PxU32 flag) +{ + Dy::FeatherstoneArticulation* featherstoneArtic = static_cast(mLLArticulation); + featherstoneArtic->raiseGPUDirtyFlag(Dy::ArticulationDirtyFlag::Enum(flag)); + mScene.getSimulationController()->updateArticulation(mLLArticulation, mIslandNodeIndex); +} + +void Sc::ArticulationSim::debugCheckWakeCounterOfLinks(PxReal wakeCounter) const +{ + PX_UNUSED(wakeCounter); + +#ifdef _DEBUG + // make sure the links are in sync with the articulation + for(PxU32 i=0; i < mBodies.size(); i++) + { + PX_ASSERT(mBodies[i]->getBodyCore().getWakeCounter() == wakeCounter); + } +#endif +} + +void Sc::ArticulationSim::debugCheckSleepStateOfLinks(bool isSleeping) const +{ + PX_UNUSED(isSleeping); + +#ifdef _DEBUG + // make sure the links are in sync with the articulation + for(PxU32 i=0; i < mBodies.size(); i++) + { + if (isSleeping) + { + PX_ASSERT(!mBodies[i]->isActive()); + PX_ASSERT(mBodies[i]->getBodyCore().getWakeCounter() == 0.0f); + PX_ASSERT(mBodies[i]->checkSleepReadinessBesidesWakeCounter()); + } + else + PX_ASSERT(mBodies[i]->isActive()); + } +#endif +} + +PxU32 Sc::ArticulationSim::getRootActorIndex() const +{ + return mBodies[0]->getActorID(); +} + +const PxSpatialForce& Sc::ArticulationSim::getSensorForce(const PxU32 lowLevelIndex) const +{ + return mSensorForces[lowLevelIndex]; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.h new file mode 100644 index 0000000..1fa16dc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationSim.h @@ -0,0 +1,235 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_SIM_H +#define SC_ARTICULATION_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "ScArticulationCore.h" +#include "PxsSimpleIslandManager.h" +#include "DyArticulationTendon.h" + +namespace physx +{ +namespace Bp +{ + class BoundsArray; +} + +namespace Sc +{ + class BodySim; + class ArticulationJointSim; + class ArticulationSpatialTendonSim; + class ArticulationFixedTendonSim; + class ArticulationSensorSim; + class ArticulationCore; + class Scene; + class ConstraintSim; + + struct ArticulationSimDirtyFlag + { + enum Enum + { + eNONE = 0, + eUPDATE = 1 << 0 + }; + }; + + typedef PxFlags ArticulationSimDirtyFlags; + + + class ArticulationSim : public PxUserAllocated + { + public: + ArticulationSim(ArticulationCore& core, + Scene& scene, + BodyCore& root); + + ~ArticulationSim(); + + PX_FORCE_INLINE Dy::FeatherstoneArticulation* getLowLevelArticulation() const { return mLLArticulation; } + PX_FORCE_INLINE ArticulationCore& getCore() const { return mCore; } + + //we don't need removeBody method anymore because when the articulation is removed from the scene, the articulation sim will + //get completely distroy and when we re-add the articulation to the scene, all the data will get recomputed + void addBody(BodySim& body, + BodySim* parent, + ArticulationJointSim* joint); + + void removeBody(BodySim& body); + + + //we don't need removeTendon method anymore because when the articulation is removed from the scene, the articulation sim will + //get completely distroy and when we re-add the articulation to the scene, all the data will get recomputed + void addTendon(ArticulationSpatialTendonSim*); + + //we don't need removeTendon method anymore because when the articulation is removed from the scene, the articulation sim will + //get completely distroy and when we re-add the articulation to the scene, all the data will get recomputed + void addTendon(ArticulationFixedTendonSim*); + + //we don't need removeSensor method anymore because when the articulation is removed from the scene, the articulation sim will + //get completely distroy and when we re-add the articulation to the scene, all the data will get recomputed + void addSensor(ArticulationSensorSim* sensor, const PxU32 linkID); + + void createLLStructure(); // resize LL memory if necessary + void initializeConfiguration(); + void debugCheckWakeCounterOfLinks(PxReal wakeCounter) const; + void debugCheckSleepStateOfLinks(bool isSleeping) const; + + bool isSleeping() const; + void internalWakeUp(PxReal wakeCounter); // called when sim sets sleep timer + void sleepCheck(PxReal dt); + void putToSleep(); + void updateCCDLinks(PxArray& sims); + void updateCached(PxBitMapPinned* shapehapeChangedMap); + void markShapesUpdated(PxBitMapPinned* shapeChangedMap); + void updateContactDistance(PxReal* contactDistance, const PxReal dt, const Bp::BoundsArray& boundsArray); + + void setActive(const bool b, const PxU32 infoFlag=0); + + void updateForces(PxReal dt, bool notify = true); + void saveLastCCDTransform(); + + void clearAcceleration(PxReal dt); + + + void setKinematicLink(const bool value); + //external reduced coordinate implementation + PxU32 getDofs() const; + + //This function return the dof of the inbound joint, which belong to a link with corresponding linkID + PxU32 getDof(const PxU32 linkID) const; + + PxArticulationCache* createCache(); + + PxU32 getCacheDataSize() const; + + PxU32 getScratchMemorySize() const; + + void zeroCache(PxArticulationCache&) const; + + bool applyCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const; + + void copyInternalStateToCache(PxArticulationCache& cache, const PxArticulationCacheFlags flag) const; + + void packJointData(const PxReal* maximum, PxReal* reduced) const; + + void unpackJointData(const PxReal* reduced, PxReal* maximum) const; + + void commonInit(); + + void computeGeneralizedGravityForce(PxArticulationCache& cache); + + void computeCoriolisAndCentrifugalForce(PxArticulationCache& cache); + + void computeGeneralizedExternalForce(PxArticulationCache& cache); + + void computeJointAcceleration(PxArticulationCache& cache); + + void computeJointForce(PxArticulationCache& cache); + + void computeKinematicJacobian(const PxU32 linkID, PxArticulationCache& cache); + + void computeDenseJacobian(PxArticulationCache& cache, PxU32& nRows, PxU32& nCols); + + void computeCoefficientMatrix(PxArticulationCache& cache); + + bool computeLambda(PxArticulationCache& cache, PxArticulationCache& rollBackCache, const PxReal* jointTorque, const PxVec3 gravity, const PxU32 maxIter); + + void computeGeneralizedMassMatrix(PxArticulationCache& cache); + + PxU32 getCoefficientMatrixSize() const; + + void setRootLinearVelocity(const PxVec3& velocity); + void setRootAngularVelocity(const PxVec3& velocity); + PxSpatialVelocity getLinkVelocity(const PxU32 linkId) const; + + PxSpatialVelocity getLinkAcceleration(const PxU32 linkId) const; + + + //internal method implementation + PX_FORCE_INLINE PxNodeIndex getIslandNodeIndex() const { return mIslandNodeIndex; } + + void setGlobalPose(); + + PxU32 findBodyIndex(BodySim &body) const; + + void setJointDirty(Dy::ArticulationJointCore& jointCore); + + void addLoopConstraint(ConstraintSim* constraint); + void removeLoopConstraint(ConstraintSim* constraint); + + PX_FORCE_INLINE PxU32 getMaxDepth() { return mMaxDepth; } + + void setArticulationDirty(PxU32 flag); + + PX_FORCE_INLINE void setDirtyFlag(ArticulationSimDirtyFlag::Enum flag) { mDirtyFlags = flag; } + PX_FORCE_INLINE ArticulationSimDirtyFlags getDirtyFlag() const { return mDirtyFlags; } + + PX_FORCE_INLINE const Dy::ArticulationLink& getLink(const PxU32 linkId) const { return mLinks[linkId]; } + + PxU32 getRootActorIndex() const; + const PxSpatialForce& getSensorForce(const PxU32 lowLevelIndex) const; + + + + void updateKinematic(PxArticulationKinematicFlags flags); + + void copyJointStatus(const PxU32 linkIndex); + + PX_FORCE_INLINE void getLLArticulationInitialized(bool val) { mIsLLArticultionInitialized = val; } + PX_FORCE_INLINE bool getLLArticulationInitialized() { return mIsLLArticultionInitialized; } + private: + ArticulationSim& operator=(const ArticulationSim&); + + Dy::FeatherstoneArticulation* mLLArticulation; + Scene& mScene; + ArticulationCore& mCore; + PxArray mLinks; + PxArray mBodies; + PxArray mJoints; + PxArray mSpatialTendons; + PxArray mFixedTendons; + PxArray mSensors; + PxArray mSensorForces; + + + PxNodeIndex mIslandNodeIndex; + PxArray mLoopConstraints; + PxU32 mMaxDepth; + bool mIsLLArticultionInitialized; + ArticulationSimDirtyFlags mDirtyFlags; + + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp new file mode 100644 index 0000000..7e5df5f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonCore.cpp @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationTendonCore.h" +#include "ScArticulationTendonSim.h" + +using namespace physx; + +void Sc::ArticulationSpatialTendonCore::setStiffness(const PxReal stiffness) +{ + mStiffness = stiffness; + + if (mSim) + mSim->setStiffness(stiffness); +} + +PxReal Sc::ArticulationSpatialTendonCore::getStiffness() const +{ + return mStiffness; +} + +void Sc::ArticulationSpatialTendonCore::setDamping(const PxReal damping) +{ + mDamping = damping; + + if (mSim) + mSim->setDamping(damping); +} + +PxReal Sc::ArticulationSpatialTendonCore::getDamping() const +{ + return mDamping; +} + +void Sc::ArticulationSpatialTendonCore::setLimitStiffness(const PxReal stiffness) +{ + mLimitStiffness = stiffness; + + if (mSim) + mSim->setLimitStiffness(stiffness); +} + +PxReal Sc::ArticulationSpatialTendonCore::getLimitStiffness() const +{ + return mLimitStiffness; +} + +void Sc::ArticulationSpatialTendonCore::setOffset(const PxReal offset) +{ + mOffset = offset; + + if (mSim) + mSim->setOffset(offset); +} + +PxReal Sc::ArticulationSpatialTendonCore::getOffset() const +{ + return mOffset; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::ArticulationFixedTendonCore::setStiffness(const PxReal stiffness) +{ + mStiffness = stiffness; + + if (mSim) + mSim->setStiffness(stiffness); +} + +PxReal Sc::ArticulationFixedTendonCore::getStiffness() const +{ + return mStiffness; +} + +void Sc::ArticulationFixedTendonCore::setDamping(const PxReal damping) +{ + mDamping = damping; + + if (mSim) + mSim->setDamping(damping); +} + +PxReal Sc::ArticulationFixedTendonCore::getDamping() const +{ + return mDamping; +} + +void Sc::ArticulationFixedTendonCore::setLimitStiffness(const PxReal stiffness) +{ + mLimitStiffness = stiffness; + if (mSim) + mSim->setLimitStiffness(stiffness); +} + +PxReal Sc::ArticulationFixedTendonCore::getLimitStiffness() const +{ + return mLimitStiffness; +} + +void Sc::ArticulationFixedTendonCore::setSpringRestLength(const PxReal restLength) +{ + mRestLength = restLength; + if (mSim) + mSim->setSpringRestLength(restLength); +} + +PxReal Sc::ArticulationFixedTendonCore::getSpringRestLength() const +{ + return mRestLength; +} + +void Sc::ArticulationFixedTendonCore::setLimitRange(const PxReal lowLimit, const PxReal highLimit) +{ + mLowLimit = lowLimit; + mHighLimit = highLimit; + + if (mSim) + mSim->setLimitRange(lowLimit, highLimit); +} + +void Sc::ArticulationFixedTendonCore::getLimitRange(PxReal& lowLimit, PxReal& highLimit) const +{ + lowLimit = mLowLimit; + highLimit = mHighLimit; +} + +void Sc::ArticulationFixedTendonCore::setOffset(const PxReal offset) +{ + mOffset = offset; + if (mSim) + mSim->setOffset(offset); +} + +PxReal Sc::ArticulationFixedTendonCore::getOffset() const +{ + return mOffset; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp new file mode 100644 index 0000000..f38892c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonJointCore.cpp @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationTendonJointCore.h" +#include "ScArticulationTendonSim.h" + +using namespace physx; + +void Sc::ArticulationTendonJointCore::setCoefficient(PxArticulationAxis::Enum axis_, const PxReal coefficient_, const PxReal recipCoefficient_) +{ + axis = axis_; + coefficient = coefficient_; + recipCoefficient = recipCoefficient_; + + if (mTendonSim) + { + mTendonSim->setTendonJointCoefficient(*this, axis_, coefficient, recipCoefficient); + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp new file mode 100644 index 0000000..1113a0a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.cpp @@ -0,0 +1,373 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScArticulationTendonSim.h" +#include "ScArticulationTendonCore.h" +#include "ScArticulationAttachmentCore.h" +#include "ScArticulationTendonJointCore.h" +#include "ScArticulationJointCore.h" +#include "ScScene.h" +#include "DyArticulationTendon.h" +#include "ScArticulationSim.h" + + +using namespace physx; + +Sc::ArticulationSpatialTendonSim::ArticulationSpatialTendonSim(ArticulationSpatialTendonCore& tendon, Scene& scene) : + mTendonCore(tendon), mScene(scene) +{ + mTendonCore.setSim(this); + mLLTendon.mStiffness = tendon.mStiffness; + mLLTendon.mDamping = tendon.mDamping; + mLLTendon.mOffset = tendon.mOffset; + mLLTendon.mLimitStiffness = tendon.mLimitStiffness; +} + + +Sc::ArticulationSpatialTendonSim::~ArticulationSpatialTendonSim() +{ + mTendonCore.setSim(NULL); +} + + +void Sc::ArticulationSpatialTendonSim::setStiffness(const PxReal stiffness) +{ + mLLTendon.mStiffness = stiffness; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON); +} + +PxReal Sc::ArticulationSpatialTendonSim::getStiffness() const +{ + return mLLTendon.mStiffness; +} + +void Sc::ArticulationSpatialTendonSim::setDamping(const PxReal damping) +{ + mLLTendon.mDamping = damping; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON); +} + +PxReal Sc::ArticulationSpatialTendonSim::getDamping() const +{ + return mLLTendon.mDamping; +} + +void Sc::ArticulationSpatialTendonSim::setLimitStiffness(const PxReal stiffness) +{ + mLLTendon.mLimitStiffness = stiffness; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationSpatialTendonSim::getLimitStiffness() const +{ + return mLLTendon.mLimitStiffness; +} + +void Sc::ArticulationSpatialTendonSim::setOffset(const PxReal offset) +{ + mLLTendon.mOffset = offset; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON); +} + +PxReal Sc::ArticulationSpatialTendonSim::getOffset() const +{ + return mLLTendon.mOffset; +} + + +void Sc::ArticulationSpatialTendonSim::setAttachmentCoefficient(ArticulationAttachmentCore& core, const PxReal coefficient) +{ + const PxU32 index = core.mAttachmentIndex; + + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + + attachment.coefficient = coefficient; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON_ATTACHMENT); +} + +void Sc::ArticulationSpatialTendonSim::setAttachmentRelativeOffset(ArticulationAttachmentCore& core, const PxVec3& offset) +{ + const PxU32 index = core.mAttachmentIndex; + + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + + attachment.relativeOffset = offset; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON_ATTACHMENT); +} + +void Sc::ArticulationSpatialTendonSim::setAttachmentLimits(ArticulationAttachmentCore& core, const PxReal lowLimit, const PxReal highLimit) +{ + const PxU32 index = core.mAttachmentIndex; + + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + + attachment.lowLimit = lowLimit; + attachment.highLimit = highLimit; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON_ATTACHMENT); +} + +void Sc::ArticulationSpatialTendonSim::setAttachmentRestLength(ArticulationAttachmentCore& core, const PxReal restLength) +{ + const PxU32 index = core.mAttachmentIndex; + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + attachment.restLength = restLength; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_SPATIAL_TENDON_ATTACHMENT); + +} + + +void Sc::ArticulationSpatialTendonSim::addAttachment(ArticulationAttachmentCore& core) +{ + + const PxU32 index = mLLTendon.getNewID(); + + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + + attachment.relativeOffset = core.mRelativeOffset; + attachment.linkInd = PxU16(core.mLLLinkIndex); + attachment.lowLimit = core.mLowLimit; + attachment.highLimit = core.mHighLimit; + attachment.coefficient = core.mCoefficient; + attachment.myInd = index; + attachment.children = 0; + attachment.childCount = 0; + attachment.restLength = core.mRestLength; + + core.mAttachmentIndex = index; + core.mTendonSim = this; + + if (core.mParent) + { + const PxU32 parentIndex = core.mParent->mAttachmentIndex; + attachment.parent = parentIndex; + mLLTendon.getAttachment(parentIndex).children |= Dy::ArticulationAttachmentBitField(1) << index; + mLLTendon.getAttachment(parentIndex).childCount++; + } + else + { + attachment.parent = DY_ARTICULATION_ATTACHMENT_NONE; + } + +} + +void Sc::ArticulationSpatialTendonSim::removeAttachment(ArticulationAttachmentCore& core) +{ + const PxU32 index = core.mAttachmentIndex; + + Dy::ArticulationAttachment& attachment = mLLTendon.getAttachment(index); + + PX_ASSERT(attachment.childCount == 0); + + if (attachment.parent != DY_ARTICULATION_ATTACHMENT_NONE) + { + Dy::ArticulationAttachment& parent = mLLTendon.getAttachment(attachment.parent); + parent.children &= ~(Dy::ArticulationAttachmentBitField(1) << index); + parent.childCount--; + } + + mLLTendon.freeID(index); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::ArticulationFixedTendonSim::ArticulationFixedTendonSim(ArticulationFixedTendonCore& tendon, Scene& scene) : + mTendonCore(tendon), mScene(scene) +{ + mTendonCore.setSim(this); + mLLTendon.mStiffness = tendon.mStiffness; + mLLTendon.mDamping = tendon.mDamping; + mLLTendon.mOffset = tendon.mOffset; + mLLTendon.mLimitStiffness = tendon.mLimitStiffness; + mLLTendon.mLowLimit = tendon.mLowLimit; + mLLTendon.mHighLimit = tendon.mHighLimit; + mLLTendon.mRestLength = tendon.mRestLength; +} + +Sc::ArticulationFixedTendonSim::~ArticulationFixedTendonSim() +{ + mTendonCore.setSim(NULL); +} + +void Sc::ArticulationFixedTendonSim::setStiffness(const PxReal stiffness) +{ + mLLTendon.mStiffness = stiffness; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationFixedTendonSim::getStiffness() const +{ + return mLLTendon.mStiffness; +} + +void Sc::ArticulationFixedTendonSim::setDamping(const PxReal damping) +{ + mLLTendon.mDamping = damping; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationFixedTendonSim::getDamping() const +{ + return mLLTendon.mDamping; +} + +void Sc::ArticulationFixedTendonSim::setLimitStiffness(const PxReal stiffness) +{ + mLLTendon.mLimitStiffness = stiffness; + + Dy::FeatherstoneArticulation* llArticulation = static_cast(mArtiSim->getLowLevelArticulation()); + llArticulation->setGpuDirtyFlag(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationFixedTendonSim::getLimitStiffness() const +{ + return mLLTendon.mLimitStiffness; +} + +void Sc::ArticulationFixedTendonSim::setOffset(const PxReal offset) +{ + mLLTendon.mOffset = offset; + + mArtiSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationFixedTendonSim::getOffset() const +{ + return mLLTendon.mOffset; +} + +void Sc::ArticulationFixedTendonSim::setSpringRestLength(const PxReal restLength) +{ + mLLTendon.mRestLength = restLength; + + mArtiSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +PxReal Sc::ArticulationFixedTendonSim::getSpringRestLength() const +{ + return mLLTendon.mRestLength; +} + + +void Sc::ArticulationFixedTendonSim::setLimitRange(const PxReal lowLimit, const PxReal highLimit) +{ + mLLTendon.mLowLimit = lowLimit; + mLLTendon.mHighLimit = highLimit; + + mArtiSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON); +} + +void Sc::ArticulationFixedTendonSim::getLimitRange(PxReal& lowLimit, PxReal& highLimit) const +{ + lowLimit = mLLTendon.mLowLimit; + highLimit = mLLTendon.mHighLimit; +} + +void Sc::ArticulationFixedTendonSim::addTendonJoint(ArticulationTendonJointCore& tendonJointCore) +{ + + const PxU32 jointIndex = mLLTendon.getNewID(); + + Dy::ArticulationTendonJoint& tendonJoint = mLLTendon.getTendonJoint(jointIndex); + + tendonJoint.axis = PxU16(tendonJointCore.axis); + tendonJoint.coefficient = tendonJointCore.coefficient; + tendonJoint.recipCoefficient = tendonJointCore.recipCoefficient; + tendonJoint.linkInd = PxU16(tendonJointCore.mLLLinkIndex); + tendonJoint.children = 0; + tendonJoint.childCount = 0; + + tendonJointCore.mLLTendonJointIndex = jointIndex; + //tendonJointCore.mLLTendonJoint = &tendonJoint; + tendonJointCore.mTendonSim = this; + + if (tendonJointCore.mParent) + { + const PxU32 parentIndex = tendonJointCore.mParent->mLLTendonJointIndex; + tendonJoint.parent = parentIndex; + mLLTendon.getTendonJoint(parentIndex).children |= Dy::ArticulationAttachmentBitField(1) << jointIndex; + mLLTendon.getTendonJoint(parentIndex).childCount++; + } + else + { + tendonJoint.parent = DY_ARTICULATION_ATTACHMENT_NONE; + } + +} + +void Sc::ArticulationFixedTendonSim::removeTendonJoint(ArticulationTendonJointCore& core) +{ + const PxU32 index = core.mLLTendonJointIndex; + + Dy::ArticulationTendonJoint& tendonJoint = mLLTendon.getTendonJoint(index); + + PX_ASSERT(tendonJoint.childCount == 0); + + if (tendonJoint.parent != DY_ARTICULATION_ATTACHMENT_NONE) + { + Dy::ArticulationTendonJoint& parent = mLLTendon.getTendonJoint(tendonJoint.parent); + parent.children &= ~(Dy::ArticulationAttachmentBitField(1) << index); + parent.childCount--; + } + + mLLTendon.freeID(index); +} + +void Sc::ArticulationFixedTendonSim::setTendonJointCoefficient(ArticulationTendonJointCore& core, const PxArticulationAxis::Enum axis, const float coefficient, const float recipCoefficient) +{ + const PxU32 index = core.mLLTendonJointIndex; + + Dy::ArticulationTendonJoint& tendonJoint = mLLTendon.getTendonJoint(index); + tendonJoint.axis = PxU16(axis); + tendonJoint.coefficient = coefficient; + tendonJoint.recipCoefficient = recipCoefficient; + + mArtiSim->setArticulationDirty(Dy::ArticulationDirtyFlag::eDIRTY_FIXED_TENDON_JOINT); + +} + + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.h new file mode 100644 index 0000000..31cd8e7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScArticulationTendonSim.h @@ -0,0 +1,123 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ARTICULATION_TENDON_SIM_H +#define SC_ARTICULATION_TENDON_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "DyArticulationTendon.h" + +namespace physx +{ +namespace Sc +{ + + class ArticulationFixedTendonCore; + class ArticulationTendonJointCore; + class ArticulationSpatialTendonCore; + class ArticulationAttachmentCore; + class Scene; + class ArticulationJointCore; + class ArticulationSim; + + class ArticulationSpatialTendonSim : public PxUserAllocated + { + PX_NOCOPY(ArticulationSpatialTendonSim) + public: + ArticulationSpatialTendonSim(ArticulationSpatialTendonCore& tendon, Scene& scene); + + virtual ~ArticulationSpatialTendonSim(); + + void setStiffness(const PxReal stiffness); + PxReal getStiffness() const; + + void setDamping(const PxReal damping); + PxReal getDamping() const; + + void setLimitStiffness(const PxReal stiffness); + PxReal getLimitStiffness() const; + + void setOffset(const PxReal offset); + PxReal getOffset() const; + + + void setAttachmentCoefficient(ArticulationAttachmentCore& core, const PxReal coefficient); + void setAttachmentRelativeOffset(ArticulationAttachmentCore& core, const PxVec3& offset); + void setAttachmentLimits(ArticulationAttachmentCore& core, const PxReal lowLimit, const PxReal highLimit); + void setAttachmentRestLength(ArticulationAttachmentCore& core, const PxReal restLength); + void addAttachment(ArticulationAttachmentCore& core); + void removeAttachment(ArticulationAttachmentCore& core); + + Dy::ArticulationSpatialTendon mLLTendon; + ArticulationSpatialTendonCore& mTendonCore; + + ArticulationSim* mArtiSim; + Scene& mScene; + + }; + + class ArticulationFixedTendonSim : public PxUserAllocated + { + PX_NOCOPY(ArticulationFixedTendonSim) + public: + ArticulationFixedTendonSim(ArticulationFixedTendonCore& tendon, Scene& scene); + + virtual ~ArticulationFixedTendonSim(); + + void setStiffness(const PxReal stiffness); + PxReal getStiffness() const; + + void setDamping(const PxReal damping); + PxReal getDamping() const; + + void setLimitStiffness(const PxReal stiffness); + PxReal getLimitStiffness() const; + + void setOffset(const PxReal offset); + PxReal getOffset() const; + + void setSpringRestLength(const PxReal restLength); + PxReal getSpringRestLength() const; + + void setLimitRange(const PxReal lowLimit, const PxReal highLimit); + void getLimitRange(PxReal& lowLimit, PxReal& highLimit) const; + + void addTendonJoint(ArticulationTendonJointCore& tendonJointCore); + void removeTendonJoint(ArticulationTendonJointCore& core); + + void setTendonJointCoefficient(ArticulationTendonJointCore& core, const PxArticulationAxis::Enum axis, const float coefficient, const float recipCoefficient); + + Dy::ArticulationFixedTendon mLLTendon; + ArticulationFixedTendonCore& mTendonCore; + + ArticulationSim* mArtiSim; + Scene& mScene; + }; +}//namespace Sc +}//namespace physx +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp new file mode 100644 index 0000000..8d3e554 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodyCore.cpp @@ -0,0 +1,621 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScBodyCore.h" +#include "ScBodySim.h" +#include "ScPhysics.h" +#include "ScScene.h" +#include "PxsSimulationController.h" +#include "ScArticulationSim.h" + +using namespace physx; + +static void updateBodySim(Sc::BodyCore& bodyCore) +{ + Sc::BodySim* bodySim = bodyCore.getSim(); + if(bodySim) + bodySim->getScene().updateBodySim(*bodySim); +} + +Sc::BodyCore::BodyCore(PxActorType::Enum type, const PxTransform& bodyPose) : RigidCore(type) +{ + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + + const bool isDynamic = type == PxActorType::eRIGID_DYNAMIC; + const float linearDamping = isDynamic ? 0.0f : 0.05f; + const float maxLinearVelocitySq = isDynamic ? 1e32f /*PX_MAX_F32*/ : 100.f * 100.f * scale.length * scale.length; + const float maxAngularVelocitySq = isDynamic ? 100.0f * 100.0f : 50.0f * 50.0f; + + mCore.init(bodyPose, PxVec3(1.0f), 1.0f, Sc::Physics::sWakeCounterOnCreation, scale.speed, linearDamping, 0.05f, maxLinearVelocitySq, maxAngularVelocitySq, + type); +} + +Sc::BodyCore::~BodyCore() +{ + PX_ASSERT(getSim() == 0); +} + +Sc::BodySim* Sc::BodyCore::getSim() const +{ + return static_cast(Sc::ActorCore::getSim()); +} + +void Sc::BodyCore::restoreDynamicData() +{ + BodySim* sim = getSim(); + PX_ASSERT(sim); + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PxsBodyCore& core = getCore(); + simStateRestoreBodyProperties(simStateData, core); +} + +//-------------------------------------------------------------- +// +// BodyCore interface implementation +// +//-------------------------------------------------------------- + +void Sc::BodyCore::setBody2World(const PxTransform& p) +{ + mCore.body2World = p; + PX_ASSERT(p.p.isFinite()); + PX_ASSERT(p.q.isFinite()); + + BodySim* sim = getSim(); + if(sim) + { + sim->postBody2WorldChange(); + sim->getScene().updateBodySim(*sim); + } +} + +void Sc::BodyCore::setLinearVelocity(const PxVec3& v, bool skipBodySimUpdate) +{ + mCore.linearVelocity = v; + + PX_ASSERT(!skipBodySimUpdate || (getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + if(!skipBodySimUpdate) + updateBodySim(*this); +} + +void Sc::BodyCore::setAngularVelocity(const PxVec3& v, bool skipBodySimUpdate) +{ + mCore.angularVelocity = v; + + PX_ASSERT(!skipBodySimUpdate || (getFlags() & PxRigidBodyFlag::eKINEMATIC)); + + if(!skipBodySimUpdate) + updateBodySim(*this); +} + +void Sc::BodyCore::setCfmScale(PxReal cfmScale) +{ + mCore.cfmScale = cfmScale; + + updateBodySim(*this); +} + +void Sc::BodyCore::setBody2Actor(const PxTransform& p) +{ + PX_ASSERT(p.p.isFinite()); + PX_ASSERT(p.q.isFinite()); + + mCore.setBody2Actor(p); + + BodySim* sim = getSim(); + if(sim) + { + sim->notifyShapesOfTransformChange(); + sim->getScene().updateBodySim(*sim); + } +} + +void Sc::BodyCore::addSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc) +{ + BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->addSpatialAcceleration(simStateDataPool, linAcc, angAcc); +} + +void Sc::BodyCore::setSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc) +{ + BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->setSpatialAcceleration(simStateDataPool, linAcc, angAcc); +} + +void Sc::BodyCore::clearSpatialAcceleration(bool force, bool torque) +{ + PX_ASSERT(force || torque); + BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->clearSpatialAcceleration(force, torque); +} + +void Sc::BodyCore::addSpatialVelocity(PxPool* simStateDataPool, const PxVec3* linVelDelta, const PxVec3* angVelDelta) +{ + BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->addSpatialVelocity(simStateDataPool, linVelDelta, angVelDelta); +} + +void Sc::BodyCore::clearSpatialVelocity(bool force, bool torque) +{ + PX_ASSERT(force || torque); + BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->clearSpatialVelocity(force, torque); +} + +PxReal Sc::BodyCore::getInverseMass() const +{ + BodySim* sim = getSim(); + if(!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.inverseMass; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return simStateData->getKinematicData()->backupInvMass; + } +} + +void Sc::BodyCore::setInverseMass(PxReal m) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.inverseMass = m; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupInvMass = m; + } +} + +const PxVec3& Sc::BodyCore::getInverseInertia() const +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.inverseInertia; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return (simStateData->getKinematicData()->backupInverseInertia); + } +} + +void Sc::BodyCore::setInverseInertia(const PxVec3& i) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.inverseInertia = i; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupInverseInertia = i; + } +} + +PxReal Sc::BodyCore::getLinearDamping() const +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.linearDamping; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return (simStateData->getKinematicData()->backupLinearDamping); + } +} + +void Sc::BodyCore::setLinearDamping(PxReal d) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.linearDamping = d; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupLinearDamping = d; + } +} + +PxReal Sc::BodyCore::getAngularDamping() const +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.angularDamping; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return (simStateData->getKinematicData()->backupAngularDamping); + } +} + +void Sc::BodyCore::setAngularDamping(PxReal v) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.angularDamping = v; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupAngularDamping = v; + } +} + +PxReal Sc::BodyCore::getMaxAngVelSq() const +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.maxAngularVelocitySq; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return (simStateData->getKinematicData()->backupMaxAngVelSq); + } +} + +void Sc::BodyCore::setMaxAngVelSq(PxReal v) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.maxAngularVelocitySq = v; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupMaxAngVelSq = v; + } +} + +PxReal Sc::BodyCore::getMaxLinVelSq() const +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + return mCore.maxLinearVelocitySq; + } + else + { + const SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + return (simStateData->getKinematicData()->backupMaxLinVelSq); + } +} + +void Sc::BodyCore::setMaxLinVelSq(PxReal v) +{ + BodySim* sim = getSim(); + if (!sim || (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))) + { + mCore.maxLinearVelocitySq = v; + updateBodySim(*this); + } + else + { + SimStateData* simStateData = sim->getSimStateData(true); + PX_ASSERT(simStateData); + PX_ASSERT(simStateData->getKinematicData()); + simStateData->getKinematicData()->backupMaxLinVelSq = v; + } +} + +void Sc::BodyCore::setFlags(PxPool* simStateDataPool, PxRigidBodyFlags f) +{ + const PxRigidBodyFlags old = mCore.mFlags; + if(f != old) + { + const PxU32 wasKinematic = old & PxRigidBodyFlag::eKINEMATIC; + const PxU32 isKinematic = f & PxRigidBodyFlag::eKINEMATIC; + const bool switchToKinematic = ((!wasKinematic) && isKinematic); + const bool switchToDynamic = (wasKinematic && (!isKinematic)); + + mCore.mFlags = f; + BodySim* sim = getSim(); + if (sim) + { + PX_ASSERT(simStateDataPool); + + const PxU32 posePreviewFlag = f & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW; + if(PxU32(old & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) != posePreviewFlag) + sim->postPosePreviewChange(posePreviewFlag); + + // for those who might wonder about the complexity here: + // our current behavior is that you are not allowed to set a kinematic target unless the object is in a scene. + // Thus, the kinematic data should only be created/destroyed when we know for sure that we are in a scene. + + if(switchToKinematic) + { + sim->switchToKinematic(simStateDataPool); + } + else if(switchToDynamic) + { + sim->switchToDynamic(simStateDataPool); + } + + const PxU32 wasSpeculativeCCD = old & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD; + const PxU32 isSpeculativeCCD = f & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD; + + if(wasSpeculativeCCD ^ isSpeculativeCCD) + { + if(wasSpeculativeCCD) + { + if(sim->isArticulationLink()) + sim->getScene().resetSpeculativeCCDArticulationLink(sim->getNodeIndex().index()); + else + sim->getScene().resetSpeculativeCCDRigidBody(sim->getNodeIndex().index()); + + sim->getLowLevelBody().mInternalFlags &= (~PxsRigidBody::eSPECULATIVE_CCD); + } + else + { + //Kinematic body switch puts the body to sleep, so we do not mark the speculative CCD bitmap for this actor to true in this case. + if (!switchToKinematic) + { + if (sim->isArticulationLink()) + sim->getScene().setSpeculativeCCDArticulationLink(sim->getNodeIndex().index()); + else + sim->getScene().setSpeculativeCCDRigidBody(sim->getNodeIndex().index()); + } + + sim->getLowLevelBody().mInternalFlags |= (PxsRigidBody::eSPECULATIVE_CCD); + } + } + + const PxU32 wasIntegrateGyroscopic = old & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES; + const PxU32 isIntegrateGyroscopic = f & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES; + if (wasIntegrateGyroscopic ^ isIntegrateGyroscopic) + { + if(wasIntegrateGyroscopic) + sim->getLowLevelBody().mInternalFlags &= (PxsRigidBody::eENABLE_GYROSCROPIC); + else + sim->getLowLevelBody().mInternalFlags |= (PxsRigidBody::eENABLE_GYROSCROPIC); + } + + const PxU32 wasRetainAccel = old & PxRigidBodyFlag::eRETAIN_ACCELERATIONS; + const PxU32 isRetainAccel = f & PxRigidBodyFlag::eRETAIN_ACCELERATIONS; + + if (wasRetainAccel ^ isRetainAccel) + { + if (wasRetainAccel) + sim->getLowLevelBody().mInternalFlags &= (PxsRigidBody::eRETAIN_ACCELERATION); + else + sim->getLowLevelBody().mInternalFlags |= (PxsRigidBody::eRETAIN_ACCELERATION); + } + + //Force flag change through... + sim->getScene().updateBodySim(*sim); + + } + + if(switchToKinematic) + putToSleep(); + + if(sim) + { + const PxRigidBodyFlags ktFlags(PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES | PxRigidBodyFlag::eKINEMATIC); + const bool hadKt = (old & ktFlags) == ktFlags; + const bool hasKt = (f & ktFlags) == ktFlags; + if(hasKt && !hadKt) + sim->destroySqBounds(); + else if(hadKt && !hasKt) + sim->createSqBounds(); + } + } +} + +void Sc::BodyCore::setMaxContactImpulse(PxReal m) +{ + mCore.maxContactImpulse = m; + updateBodySim(*this); +} + +void Sc::BodyCore::setOffsetSlop(PxReal slop) +{ + mCore.offsetSlop = slop; + updateBodySim(*this); +} + +PxNodeIndex Sc::BodyCore::getInternalIslandNodeIndex() const +{ + BodySim* sim = getSim(); + return sim ? sim->getNodeIndex() : PxNodeIndex(PX_INVALID_NODE); +} + +void Sc::BodyCore::setWakeCounter(PxReal wakeCounter, bool forceWakeUp) +{ + mCore.wakeCounter = wakeCounter; + BodySim* sim = getSim(); + if(sim) + { + //wake counter change, we need to trigger dma pxgbodysim data again + sim->getScene().updateBodySim(*sim); + if ((wakeCounter > 0.0f) || forceWakeUp) + sim->wakeUp(); + sim->postSetWakeCounter(wakeCounter, forceWakeUp); + } +} + +void Sc::BodyCore::setSleepThreshold(PxReal t) +{ + mCore.sleepThreshold = t; + updateBodySim(*this); +} + +void Sc::BodyCore::setFreezeThreshold(PxReal t) +{ + mCore.freezeThreshold = t; + updateBodySim(*this); +} + +bool Sc::BodyCore::isSleeping() const +{ + BodySim* sim = getSim(); + return sim ? !sim->isActive() : true; +} + +void Sc::BodyCore::putToSleep() +{ + mCore.linearVelocity = PxVec3(0.0f); + mCore.angularVelocity = PxVec3(0.0f); + + // important to clear all values before setting the wake counter because the values decide + // whether an object is ready to go to sleep or not. + setWakeCounter(0.0f); + + BodySim* sim = getSim(); + if(sim) + sim->putToSleep(); +} + +void Sc::BodyCore::onOriginShift(const PxVec3& shift) +{ + mCore.body2World.p -= shift; + + BodySim* b = getSim(); + if(b) + b->onOriginShift(shift, getFlags() & PxRigidBodyFlag::eKINEMATIC); // BodySim might not exist if actor has simulation disabled (PxActorFlag::eDISABLE_SIMULATION) +} + +// PT: TODO: why do we test againt NULL everywhere but not in 'isFrozen' ? +PxIntBool Sc::BodyCore::isFrozen() const +{ + return getSim()->isFrozen(); +} + +void Sc::BodyCore::setSolverIterationCounts(PxU16 c) +{ + mCore.solverIterationCounts = c; + Sc::BodySim* sim = getSim(); + if (sim) + { + sim->getLowLevelBody().solverIterationCounts = c; + sim->getScene().setDynamicsDirty(); + } +} + +/////////////////////////////////////////////////////////////////////////////// + +bool Sc::BodyCore::getKinematicTarget(PxTransform& p) const +{ + PX_ASSERT(mCore.mFlags & PxRigidBodyFlag::eKINEMATIC); + const BodySim* sim = getSim(); + return (sim && simStateGetKinematicTarget(sim->getSimStateData_Unchecked(), p)); +} + +bool Sc::BodyCore::getHasValidKinematicTarget() const +{ + //The use pattern for this is that we should only look for kinematic data if we know it is kinematic. + //We might look for velmod data even if it is kinematic. + BodySim* sim = getSim(); + return (sim && simStateGetHasValidKinematicTarget(sim->getSimStateData_Unchecked())); +} + +void Sc::BodyCore::setKinematicTarget(const PxTransform& p, PxReal wakeCounter) +{ + PX_ASSERT(mCore.mFlags & PxRigidBodyFlag::eKINEMATIC); + Sc::BodySim* sim = getSim(); + PX_ASSERT(sim); + sim->setKinematicTarget(p); + wakeUp(wakeCounter); +} + +void Sc::BodyCore::invalidateKinematicTarget() +{ + Sc::BodySim* sim = getSim(); + PX_ASSERT(sim); + simStateInvalidateKinematicTarget(sim->getSimStateData_Unchecked()); +} + +void Sc::BodyCore::setKinematicLink(const bool value) +{ + BodySim* sim = getSim(); + + if (sim) + sim->getLowLevelBody().mCore->kinematicLink = PxU8(value); +} + +void Sc::BodyCore::onRemoveKinematicFromScene() +{ + PX_ASSERT(mCore.mFlags & PxRigidBodyFlag::eKINEMATIC); + PX_ASSERT(getSim() && getSim()->checkSimStateKinematicStatus(true)); + + // make sure that a kinematic which is not part of a scene is in the expected state + mCore.wakeCounter = 0.0f; + mCore.linearVelocity = PxVec3(0.0f); + mCore.angularVelocity = PxVec3(0.0f); +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp new file mode 100644 index 0000000..d895d10 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.cpp @@ -0,0 +1,984 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScBodySim.h" +#include "ScShapeSim.h" +#include "ScScene.h" +#include "ScArticulationSim.h" +#include "PxsContext.h" +#include "PxsSimpleIslandManager.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace physx::Dy; +using namespace Sc; + +#define PX_FREEZE_INTERVAL 1.5f +#define PX_FREE_EXIT_THRESHOLD 4.f +#define PX_FREEZE_TOLERANCE 0.25f + +#define PX_SLEEP_DAMPING 0.5f +#define PX_FREEZE_SCALE 0.9f + +BodySim::BodySim(Scene& scene, BodyCore& core, bool compound) : + RigidSim (scene, core), + mLLBody (&core.getCore(), PX_FREEZE_INTERVAL), + mSimStateData (NULL), + mVelModState (VMF_GRAVITY_DIRTY), + mArticulation (NULL), + mConstraintGroup (NULL) +{ + core.getCore().numCountedInteractions = 0; + core.getCore().disableGravity = core.getActorFlags() & PxActorFlag::eDISABLE_GRAVITY; + if(core.getFlags() & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + mLLBody.mInternalFlags |= PxsRigidBody::eSPECULATIVE_CCD; + + if (core.getFlags() & PxRigidBodyFlag::eENABLE_GYROSCOPIC_FORCES) + mLLBody.mInternalFlags |= PxsRigidBody::eENABLE_GYROSCROPIC; + + if (core.getFlags() & PxRigidBodyFlag::eRETAIN_ACCELERATIONS) + mLLBody.mInternalFlags |= PxsRigidBody::eRETAIN_ACCELERATION; + + // PT: don't read the core ptr we just wrote, use input param + // PT: at time of writing we get a big L2 here because even though bodycore has been prefetched, the wake counter is 160 bytes away + const bool isAwake = (core.getWakeCounter() > 0) || + (!core.getLinearVelocity().isZero()) || + (!core.getAngularVelocity().isZero()); + + const bool isKine = isKinematic(); + + IG::SimpleIslandManager* simpleIslandManager = scene.getSimpleIslandManager(); + if (!isArticulationLink()) + { + mNodeIndex = simpleIslandManager->addRigidBody(&mLLBody, isKine, isAwake); + } + else + { + if(mArticulation) + { + PxU32 linkIndex = mArticulation->findBodyIndex(*this); + PxNodeIndex index = mArticulation->getIslandNodeIndex(); + mNodeIndex.setIndices(index.index(), linkIndex); + } + } + + PX_ASSERT(mActiveListIndex == SC_NOT_IN_SCENE_INDEX); + + // A.B. need to set the compound rigid flag early enough, so that we add the rigid into + // active list and do not create the shape bounds + if(compound) + raiseInternalFlag(BF_IS_COMPOUND_RIGID); + + setActive(isAwake, ActorSim::AS_PART_OF_CREATION); + + if (isAwake) + { + scene.addToActiveList(*this); + PX_ASSERT(isActive()); + } + else + { + mActiveListIndex = SC_NOT_IN_ACTIVE_LIST_INDEX; + mActiveCompoundListIndex = SC_NOT_IN_ACTIVE_LIST_INDEX; + PX_ASSERT(!isActive()); + + simpleIslandManager->deactivateNode(mNodeIndex); + } + + if (isKine) + { + initKinematicStateBase(core, true); + setupSimStateData(scene.getSimStateDataPool(), true); + notifyPutToSleep(); // sleep state of kinematics is fully controlled by the simulation controller not the island manager + } +} + +BodySim::~BodySim() +{ + Scene& scene = getScene(); + const bool active = isActive(); + + tearDownSimStateData(scene.getSimStateDataPool(), isKinematic() ? true : false); + PX_ASSERT(!mSimStateData); + + PX_ASSERT(!readInternalFlag(BF_ON_DEATHROW)); // Before 3.0 it could happen that destroy could get called twice. Assert to make sure this is fixed. + raiseInternalFlag(BF_ON_DEATHROW); + + scene.removeBody(*this); + PX_ASSERT(!getConstraintGroup()); // Removing from scene should erase constraint group node if it existed + + + //Articulations are represented by a single node, so they must only be removed by the articulation and not the links! + if(mArticulation == NULL && mNodeIndex.articulationLinkId() == 0) //If it wasn't an articulation link, then we can remove it + scene.getSimpleIslandManager()->removeNode(mNodeIndex); + + PX_ASSERT(mActiveListIndex != SC_NOT_IN_SCENE_INDEX); + + if (active) + scene.removeFromActiveList(*this); + + mActiveListIndex = SC_NOT_IN_SCENE_INDEX; + mActiveCompoundListIndex = SC_NOT_IN_SCENE_INDEX; + + mCore.setSim(NULL); +} + +void BodySim::updateCached(PxBitMapPinned* shapeChangedMap) +{ + if(!(mLLBody.mInternalFlags & PxsRigidBody::eFROZEN)) + { + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->updateCached(0, shapeChangedMap); + } + } +} + +void BodySim::updateCached(PxsTransformCache& transformCache, Bp::BoundsArray& boundsArray) +{ + PX_ASSERT(!(mLLBody.mInternalFlags & PxsRigidBody::eFROZEN)); // PT: should not be called otherwise + + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->updateCached(transformCache, boundsArray); + } +} + +//-------------------------------------------------------------- +// +// BodyCore interface implementation +// +//-------------------------------------------------------------- + +bool BodySim::setupSimStateData(PxPool* simStateDataPool, const bool isKinematic) +{ + SimStateData* data = mSimStateData; + if (!data) + { + data = simStateDataPool->construct(); + if (!data) + return false; + } + + if (isKinematic) + { + PX_ASSERT(!mSimStateData || !mSimStateData->isKine()); + + PX_PLACEMENT_NEW(data, SimStateData(SimStateData::eKine)); + Kinematic* kine = data->getKinematicData(); + kine->targetValid = 0; + simStateBackupAndClearBodyProperties(data, getBodyCore().getCore()); + } + else + { + PX_ASSERT(!mSimStateData || !mSimStateData->isVelMod()); + + PX_PLACEMENT_NEW(data, SimStateData(SimStateData::eVelMod)); + VelocityMod* velmod = data->getVelocityModData(); + velmod->clear(); + } + mSimStateData = data; + return true; +} + +void BodySim::tearDownSimStateData(PxPool* simStateDataPool, const bool isKinematic) +{ + PX_ASSERT(!mSimStateData || mSimStateData->isKine() == isKinematic); + + if (mSimStateData) + { + if (isKinematic) + simStateRestoreBodyProperties(mSimStateData, getBodyCore().getCore()); + + simStateDataPool->destroy(mSimStateData); + mSimStateData = NULL; + } +} + +void BodySim::switchToKinematic(PxPool* simStateDataPool) +{ + setupSimStateData(simStateDataPool, true); + postSwitchToKinematic(); + getScene().setDynamicsDirty(); +} + +void BodySim::switchToDynamic(PxPool* simStateDataPool) +{ + tearDownSimStateData(simStateDataPool, true); + postSwitchToDynamic(); + getScene().setDynamicsDirty(); +} + +void BodySim::setKinematicTarget(const PxTransform& p) +{ + PX_ASSERT(getSimStateData(true)); + PX_ASSERT(getSimStateData(true)->isKine()); + simStateSetKinematicTarget(getSimStateData_Unchecked(), p); + PX_ASSERT(getSimStateData(true)->getKinematicData()->targetValid); + + raiseInternalFlag(BF_KINEMATIC_MOVED); // Important to set this here already because trigger interactions need to have this information when being activated. + clearInternalFlag(BF_KINEMATIC_SURFACE_VELOCITY); +} + +void BodySim::addSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc) +{ + notifyAddSpatialAcceleration(); + + if (!mSimStateData || !mSimStateData->isVelMod()) + setupSimStateData(simStateDataPool, false); + + VelocityMod* velmod = mSimStateData->getVelocityModData(); + if (linAcc) velmod->accumulateLinearVelModPerSec(*linAcc); + if (angAcc) velmod->accumulateAngularVelModPerSec(*angAcc); +} + +void BodySim::setSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc) +{ + notifyAddSpatialAcceleration(); + + if (!mSimStateData || !mSimStateData->isVelMod()) + setupSimStateData(simStateDataPool, false); + + VelocityMod* velmod = mSimStateData->getVelocityModData(); + if (linAcc) velmod->setLinearVelModPerSec(*linAcc); + if (angAcc) velmod->setAngularVelModPerSec(*angAcc); +} + +void BodySim::clearSpatialAcceleration(bool force, bool torque) +{ + PX_ASSERT(force || torque); + + notifyClearSpatialAcceleration(); + + if (mSimStateData) + { + PX_ASSERT(mSimStateData->isVelMod()); + VelocityMod* velmod = mSimStateData->getVelocityModData(); + if (force) + velmod->clearLinearVelModPerSec(); + if (torque) + velmod->clearAngularVelModPerSec(); + } +} + +void BodySim::addSpatialVelocity(PxPool* simStateDataPool, const PxVec3* linVelDelta, const PxVec3* angVelDelta) +{ + notifyAddSpatialVelocity(); + + if (!mSimStateData || !mSimStateData->isVelMod()) + setupSimStateData(simStateDataPool, false); + + VelocityMod* velmod = mSimStateData->getVelocityModData(); + if (linVelDelta) + velmod->accumulateLinearVelModPerStep(*linVelDelta); + if (angVelDelta) + velmod->accumulateAngularVelModPerStep(*angVelDelta); +} + +void BodySim::clearSpatialVelocity(bool force, bool torque) +{ + PX_ASSERT(force || torque); + + notifyClearSpatialVelocity(); + + if (mSimStateData) + { + PX_ASSERT(mSimStateData->isVelMod()); + VelocityMod* velmod = mSimStateData->getVelocityModData(); + if (force) + velmod->clearLinearVelModPerStep(); + if (torque) + velmod->clearAngularVelModPerStep(); + } +} + +void BodySim::raiseVelocityModFlagAndNotify(VelocityModFlags flag) +{ + //The dirty flag is stored separately in the BodySim so that we query the dirty flag before going to + //the expense of querying the simStateData for the velmod values. + raiseVelocityModFlag(flag); + + if (!isArticulationLink()) + getScene().getVelocityModifyMap().growAndSet(getNodeIndex().index()); + else + getScene().addDirtyArticulationSim(getArticulation()); +} + +void BodySim::postActorFlagChange(PxU32 oldFlags, PxU32 newFlags) +{ + // PT: don't convert to bool if not needed + const PxU32 wasWeightless = oldFlags & PxActorFlag::eDISABLE_GRAVITY; + const PxU32 isWeightless = newFlags & PxActorFlag::eDISABLE_GRAVITY; + + if (isWeightless != wasWeightless) + { + if (mVelModState == 0) + raiseVelocityModFlag(VMF_GRAVITY_DIRTY); + + getBodyCore().getCore().disableGravity = isWeightless!=0; + } +} + +void BodySim::postBody2WorldChange() +{ + mLLBody.saveLastCCDTransform(); + notifyShapesOfTransformChange(); +} + +void BodySim::postSetWakeCounter(PxReal t, bool forceWakeUp) +{ + if ((t > 0.0f) || forceWakeUp) + notifyNotReadyForSleeping(); + else + { + const bool readyForSleep = checkSleepReadinessBesidesWakeCounter(); + if (readyForSleep) + notifyReadyForSleeping(); + } +} + +static void updateBPGroup(ActorSim* sim) +{ + PxU32 nbElems = sim->getNbElements(); + ElementSim** elems = sim->getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->updateBPGroup(); + } +} + +void BodySim::postSwitchToKinematic() +{ + initKinematicStateBase(getBodyCore(), false); + + // - interactions need to get refiltered to make sure that kinematic-kinematic and kinematic-static pairs get suppressed + // - unlike postSwitchToDynamic(), constraint interactions are not marked dirty here because a transition to kinematic will put the object asleep which in turn + // triggers onDeactivate_() on the constraint pairs that are active. If such pairs get deactivated, they will get removed from the list of active breakable + // constraints automatically. + setActorsInteractionsDirty(InteractionDirtyFlag::eBODY_KINEMATIC, NULL, InteractionFlag::eFILTERABLE); + + getScene().getSimpleIslandManager()->setKinematic(mNodeIndex); + + updateBPGroup(this); +} + +void BodySim::postSwitchToDynamic() +{ + mScene.getSimpleIslandManager()->setDynamic(mNodeIndex); + + setForcesToDefaults(true); + + if(getConstraintGroup()) + getConstraintGroup()->markForProjectionTreeRebuild(mScene.getProjectionManager()); + + // - interactions need to get refiltered to make sure that former kinematic-kinematic and kinematic-static pairs get enabled + // - switching from kinematic to dynamic does not change the sleep state of the body. The constraint interactions are marked dirty + // to check later whether they need to be activated plus potentially tracked for constraint break testing. This special treatment + // is necessary because constraints between two kinematic bodies are considered inactive, no matter whether one of the kinematics + // is active (has a target) or not. + setActorsInteractionsDirty(InteractionDirtyFlag::eBODY_KINEMATIC, NULL, InteractionFlag::eFILTERABLE | InteractionFlag::eCONSTRAINT); + + clearInternalFlag(BF_KINEMATIC_MOVE_FLAGS); + + if(isActive()) + mScene.swapInActiveBodyList(*this); + + // + updateBPGroup(this); +} + +void BodySim::postPosePreviewChange(const PxU32 posePreviewFlag) +{ + if (isActive()) + { + if (posePreviewFlag & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) + getScene().addToPosePreviewList(*this); + else + getScene().removeFromPosePreviewList(*this); + } + else + PX_ASSERT(!getScene().isInPosePreviewList(*this)); +} + +//-------------------------------------------------------------- +// +// Sleeping +// +//-------------------------------------------------------------- + +void BodySim::activate() +{ + // Activate body + { + PX_ASSERT((!isKinematic()) || notInScene() || readInternalFlag(InternalFlags(BF_KINEMATIC_MOVED | BF_KINEMATIC_SURFACE_VELOCITY))); // kinematics should only get activated when a target is set. + // exception: object gets newly added, then the state change will happen later + if(!isArticulationLink()) + { + mLLBody.mInternalFlags &= (~PxsRigidBody::eFROZEN); + // Put in list of activated bodies. The list gets cleared at the end of a sim step after the sleep callbacks have been fired. + getScene().onBodyWakeUp(this); + } + + BodyCore& core = getBodyCore(); + if(core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) + { + PX_ASSERT(!getScene().isInPosePreviewList(*this)); + getScene().addToPosePreviewList(*this); + } + createSqBounds(); + } + + activateInteractions(*this); + + //set speculative CCD bit map if speculative CCD flag is on + { + BodyCore& core = getBodyCore(); + if (core.getFlags() & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + { + if (isArticulationLink()) + { + if (getNodeIndex().isValid()) + getScene().setSpeculativeCCDArticulationLink(getNodeIndex().index()); + } + else + getScene().setSpeculativeCCDRigidBody(getNodeIndex().index()); + } + } +} + +void BodySim::deactivate() +{ + deactivateInteractions(*this); + + // Deactivate body + { + PX_ASSERT((!isKinematic()) || notInScene() || !readInternalFlag(BF_KINEMATIC_MOVED)); // kinematics should only get deactivated when no target is set. + // exception: object gets newly added, then the state change will happen later + BodyCore& core = getBodyCore(); + if(!readInternalFlag(BF_ON_DEATHROW)) + { + // Set velocity to 0. + // Note: this is also fine if the method gets called because the user puts something to sleep (this behavior is documented in the API) + PX_ASSERT(core.getWakeCounter() == 0.0f); + const PxVec3 zero(0.0f); + core.setLinearVelocityInternal(zero); + core.setAngularVelocityInternal(zero); + + setForcesToDefaults(!core.getCore().disableGravity); + } + + if(!isArticulationLink()) // Articulations have their own sleep logic. + getScene().onBodySleep(this); + + if(core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) + { + PX_ASSERT(getScene().isInPosePreviewList(*this)); + getScene().removeFromPosePreviewList(*this); + } + destroySqBounds(); + } + + // reset speculative CCD bit map if speculative CCD flag is on + { + BodyCore& core = getBodyCore(); + if (core.getFlags() & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + { + if (isArticulationLink()) + { + if (getNodeIndex().isValid()) + getScene().resetSpeculativeCCDArticulationLink(getNodeIndex().index()); + } + else + getScene().resetSpeculativeCCDRigidBody(getNodeIndex().index()); + } + } +} + + +void BodySim::wakeUp() +{ + setActive(true); + notifyWakeUp(); +} + +void BodySim::putToSleep() +{ + PX_ASSERT(getBodyCore().getWakeCounter() == 0.0f); + PX_ASSERT(getBodyCore().getLinearVelocity().isZero()); + PX_ASSERT(getBodyCore().getAngularVelocity().isZero()); + + notifyClearSpatialAcceleration(); + notifyClearSpatialVelocity(); + simStateClearVelMod(getSimStateData_Unchecked()); + + setActive(false); + notifyPutToSleep(); +} + +void BodySim::internalWakeUp(PxReal wakeCounterValue) +{ + if(mArticulation) + mArticulation->internalWakeUp(wakeCounterValue); + else + internalWakeUpBase(wakeCounterValue); +} + +void BodySim::internalWakeUpArticulationLink(PxReal wakeCounterValue) +{ + PX_ASSERT(mArticulation); + internalWakeUpBase(wakeCounterValue); +} + +void BodySim::internalWakeUpBase(PxReal wakeCounterValue) //this one can only increase the wake counter, not decrease it, so it can't be used to put things to sleep! +{ + if ((!isKinematic()) && (getBodyCore().getWakeCounter() < wakeCounterValue)) + { + PX_ASSERT(wakeCounterValue > 0.0f); + getBodyCore().setWakeCounterFromSim(wakeCounterValue); + + //we need to update the gpu body sim because we reset the wake counter for the body core + mScene.updateBodySim(*this); + setActive(true); + notifyWakeUp(); + + if(0) // PT: commented-out for PX-2197 + mLLBody.mInternalFlags &= (~PxsRigidBody::eFROZEN); + } +} + +void BodySim::notifyReadyForSleeping() +{ + if(mArticulation == NULL) + getScene().getSimpleIslandManager()->deactivateNode(mNodeIndex); +} + +void BodySim::notifyNotReadyForSleeping() +{ + getScene().getSimpleIslandManager()->activateNode(mNodeIndex); +} + +void BodySim::notifyWakeUp() +{ + getScene().getSimpleIslandManager()->activateNode(mNodeIndex); +} + +void BodySim::notifyPutToSleep() +{ + getScene().getSimpleIslandManager()->putNodeToSleep(mNodeIndex); +} + +void BodySim::resetSleepFilter() +{ + mLLBody.sleepAngVelAcc = PxVec3(0.0f); + mLLBody.sleepLinVelAcc = PxVec3(0.0f); +} + +//This function will be called by CPU sleepCheck code +PxReal BodySim::updateWakeCounter(PxReal dt, PxReal energyThreshold, const Cm::SpatialVector& motionVelocity) +{ + // update the body's sleep state and + BodyCore& core = getBodyCore(); + + const PxReal wakeCounterResetTime = ScInternalWakeCounterResetValue; + + PxReal wc = core.getWakeCounter(); + + { + PxVec3 bcSleepLinVelAcc = mLLBody.sleepLinVelAcc; + PxVec3 bcSleepAngVelAcc = mLLBody.sleepAngVelAcc; + + if(wc < wakeCounterResetTime * 0.5f || wc < dt) + { + const PxTransform& body2World = getBody2World(); + + // calculate normalized energy: kinetic energy divided by mass + const PxVec3 t = core.getInverseInertia(); + const PxVec3 inertia(t.x > 0.0f ? 1.0f/t.x : 1.0f, t.y > 0.0f ? 1.0f/t.y : 1.0f, t.z > 0.0f ? 1.0f/t.z : 1.0f); + + PxVec3 sleepLinVelAcc = motionVelocity.linear; + PxVec3 sleepAngVelAcc = body2World.q.rotateInv(motionVelocity.angular); + + bcSleepLinVelAcc += sleepLinVelAcc; + bcSleepAngVelAcc += sleepAngVelAcc; + + PxReal invMass = core.getInverseMass(); + if(invMass == 0.0f) + invMass = 1.0f; + + const PxReal angular = bcSleepAngVelAcc.multiply(bcSleepAngVelAcc).dot(inertia) * invMass; + const PxReal linear = bcSleepLinVelAcc.magnitudeSquared(); + const PxReal normalizedEnergy = 0.5f * (angular + linear); + + // scale threshold by cluster factor (more contacts => higher sleep threshold) + const PxReal clusterFactor = PxReal(1 + getNumCountedInteractions()); + const PxReal threshold = clusterFactor*energyThreshold; + + if (normalizedEnergy >= threshold) + { + PX_ASSERT(isActive()); + resetSleepFilter(); + const float factor = threshold == 0.0f ? 2.0f : PxMin(normalizedEnergy/threshold, 2.0f); + PxReal oldWc = wc; + wc = factor * 0.5f * wakeCounterResetTime + dt * (clusterFactor - 1.0f); + core.setWakeCounterFromSim(wc); + if (oldWc == 0.0f) // for the case where a sleeping body got activated by the system (not the user) AND got processed by the solver as well + notifyNotReadyForSleeping(); + + return wc; + } + } + + mLLBody.sleepLinVelAcc = bcSleepLinVelAcc; + mLLBody.sleepAngVelAcc = bcSleepAngVelAcc; + } + + wc = PxMax(wc-dt, 0.0f); + core.setWakeCounterFromSim(wc); + return wc; +} + +//-------------------------------------------------------------- +// +// Kinematics +// +//-------------------------------------------------------------- + +PX_FORCE_INLINE void BodySim::initKinematicStateBase(BodyCore&, bool asPartOfCreation) +{ + PX_ASSERT(!readInternalFlag(BF_KINEMATIC_MOVED)); + + if (!asPartOfCreation && isActive()) + getScene().swapInActiveBodyList(*this); + + //mLLBody.setAccelerationV(Cm::SpatialVector::zero()); + + // Need to be before setting setRigidBodyFlag::KINEMATIC + + if (getConstraintGroup()) + getConstraintGroup()->markForProjectionTreeRebuild(getScene().getProjectionManager()); +} + +void BodySim::calculateKinematicVelocity(PxReal oneOverDt) +{ + PX_ASSERT(isKinematic()); + + /*------------------------------------------------\ + | kinematic bodies are moved directly by the user and are not influenced by external forces + | we simply determine the distance moved since the last simulation frame and + | assign the appropriate delta to the velocity. This vel will be used to shove dynamic + | objects in the solver. + | We have to do this like so in a delayed way, because when the user sets the target pos the dt is not + | yet known. + \------------------------------------------------*/ + PX_ASSERT(isActive()); + + BodyCore& core = getBodyCore(); + + if (readInternalFlag(BF_KINEMATIC_MOVED)) + { + clearInternalFlag(InternalFlags(BF_KINEMATIC_SETTLING | BF_KINEMATIC_SETTLING_2)); + const SimStateData* kData = getSimStateData(true); + PX_ASSERT(kData); + PX_ASSERT(kData->isKine()); + PX_ASSERT(kData->getKinematicData()->targetValid); + PxVec3 linVelLL, angVelLL; + const PxTransform targetPose = kData->getKinematicData()->targetPose; + const PxTransform& currBody2World = getBody2World(); + + //the kinematic target pose is now the target of the body (CoM) and not the actor. + + PxVec3 deltaPos = targetPose.p; + deltaPos -= currBody2World.p; + linVelLL = deltaPos * oneOverDt; + + PxQuat q = targetPose.q * currBody2World.q.getConjugate(); + + if (q.w < 0) //shortest angle. + q = -q; + + PxReal angle; + PxVec3 axis; + q.toRadiansAndUnitAxis(angle, axis); + angVelLL = axis * angle * oneOverDt; + + core.getCore().linearVelocity = linVelLL; + core.getCore().angularVelocity = angVelLL; + + // Moving a kinematic should trigger a wakeUp call on a higher level. + PX_ASSERT(core.getWakeCounter()>0); + PX_ASSERT(isActive()); + + } + else if (!readInternalFlag(BF_KINEMATIC_SURFACE_VELOCITY)) + { + core.setLinearVelocity(PxVec3(0.0f), true); + core.setAngularVelocity(PxVec3(0.0f), true); + } +} + +void BodySim::updateKinematicPose() +{ + /*------------------------------------------------\ + | kinematic bodies are moved directly by the user and are not influenced by external forces + | we simply determine the distance moved since the last simulation frame and + | assign the appropriate delta to the velocity. This vel will be used to shove dynamic + | objects in the solver. + | We have to do this like so in a delayed way, because when the user sets the target pos the dt is not + | yet known. + \------------------------------------------------*/ + + PX_ASSERT(isKinematic()); + PX_ASSERT(isActive()); + + if (readInternalFlag(BF_KINEMATIC_MOVED)) + { + clearInternalFlag(InternalFlags(BF_KINEMATIC_SETTLING | BF_KINEMATIC_SETTLING_2)); + const SimStateData* kData = getSimStateData(true); + PX_ASSERT(kData); + PX_ASSERT(kData->isKine()); + PX_ASSERT(kData->getKinematicData()->targetValid); + + const PxTransform targetPose = kData->getKinematicData()->targetPose; + getBodyCore().getCore().body2World = targetPose; + } +} + +bool BodySim::deactivateKinematic() +{ + BodyCore& core = getBodyCore(); + if(readInternalFlag(BF_KINEMATIC_SETTLING_2)) + { + clearInternalFlag(BF_KINEMATIC_SETTLING_2); + core.setWakeCounterFromSim(0); // For sleeping objects the wake counter must be 0. This needs to hold for kinematics too. + notifyReadyForSleeping(); + notifyPutToSleep(); + setActive(false); + return true; + } + else if (readInternalFlag(BF_KINEMATIC_SETTLING)) + { + clearInternalFlag(BF_KINEMATIC_SETTLING); + raiseInternalFlag(BF_KINEMATIC_SETTLING_2); + } + else if (!readInternalFlag(BF_KINEMATIC_SURFACE_VELOCITY)) + { + clearInternalFlag(BF_KINEMATIC_MOVED); + raiseInternalFlag(BF_KINEMATIC_SETTLING); + } + return false; +} + +//-------------------------------------------------------------- +// +// Miscellaneous +// +//-------------------------------------------------------------- + +void BodySim::updateForces(PxReal dt, PxsRigidBody** updatedBodySims, PxU32* updatedBodyNodeIndices, PxU32& index, Cm::SpatialVector* acceleration) +{ + PxVec3 linVelDt(0.0f), angVelDt(0.0f); + + const bool accDirty = readVelocityModFlag(VMF_ACC_DIRTY); + const bool velDirty = readVelocityModFlag(VMF_VEL_DIRTY); + + SimStateData* simStateData = NULL; + + //if we change the logic like this, which means we don't need to have two seperate variables in the pxgbodysim to represent linAcc and angAcc. However, this + //means angAcc will be always 0 + if( (accDirty || velDirty) && ((simStateData = getSimStateData(false)) != NULL) ) + { + VelocityMod* velmod = simStateData->getVelocityModData(); + + //we don't have support for articulation yet + if (updatedBodySims) + { + updatedBodySims[index] = &getLowLevelBody(); + updatedBodyNodeIndices[index++] = getNodeIndex().index(); + } + + if(velDirty) + { + linVelDt = velmod->getLinearVelModPerStep(); + angVelDt = velmod->getAngularVelModPerStep(); + } + + if (accDirty) + { + linVelDt += velmod->getLinearVelModPerSec()*dt; + angVelDt += velmod->getAngularVelModPerSec()*dt; + } + + if (acceleration) + { + const PxReal invDt = 1.f / dt; + acceleration->linear = linVelDt * invDt; + acceleration->angular = angVelDt * invDt; + } + else + { + getBodyCore().updateVelocities(linVelDt, angVelDt); + } + } + + setForcesToDefaults(readVelocityModFlag(VMF_ACC_DIRTY)); +} + +void BodySim::onConstraintDetach() +{ + PX_ASSERT(readInternalFlag(BF_HAS_CONSTRAINTS)); + + PxU32 size = getActorInteractionCount(); + Interaction** interactions = getActorInteractions(); + unregisterCountedInteraction(); + + while(size--) + { + const Interaction* interaction = *interactions++; + if(interaction->getType() == InteractionType::eCONSTRAINTSHADER) + return; + } + + clearInternalFlag(BF_HAS_CONSTRAINTS); // There are no other constraint interactions left +} + +void BodySim::setArticulation(ArticulationSim* a, PxReal wakeCounter, bool asleep, PxU32 bodyIndex) +{ + mArticulation = a; + if(a) + { + PxNodeIndex index = mArticulation->getIslandNodeIndex(); + mNodeIndex.setIndices(index.index(), bodyIndex); + getBodyCore().setWakeCounterFromSim(wakeCounter); + + if (getFlagsFast() & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + getScene().setSpeculativeCCDArticulationLink(mNodeIndex.index()); + + //Articulations defer registering their shapes with the nphaseContext until the IG node index is known. + { + ElementSim** current = getElements(); + PxU32 nbElements = getNbElements(); + while (nbElements--) + { + ShapeSim* sim = static_cast(*current++); + getScene().getLowLevelContext()->getNphaseImplementationContext()->registerShape(mNodeIndex, sim->getCore().getCore(), sim->getElementID(), sim->getActor().getPxActor()); + } + } + + //Force node index into LL shapes + setBodyNodeIndex(mNodeIndex); + + if (a->getCore().getArticulationFlags() & PxArticulationFlag::eDISABLE_SELF_COLLISION) + { + //We need to reset the group IDs for all shapes in this body... + ElementSim** current = getElements(); + PxU32 nbElements = getNbElements(); + + Bp::AABBManagerBase* aabbMgr = getScene().getAABBManager(); + + Bp::FilterGroup::Enum rootGroup = Bp::getFilterGroup(false, a->getRootActorIndex(), false); + + while (nbElements--) + { + ShapeSim* sim = static_cast(*current++); + aabbMgr->setBPGroup(sim->getElementID(), rootGroup); + } + } + + if (!asleep) + { + setActive(true); + notifyWakeUp(); + } + else + { + notifyReadyForSleeping(); + notifyPutToSleep(); + setActive(false); + } + } + else + { + //Setting a 1 in the articulation ID to avoid returning the node Index to the node index + //manager + mNodeIndex.setIndices(PX_INVALID_NODE, 1); + } +} + +void BodySim::createSqBounds() +{ + if(!isActive() || usingSqKinematicTarget() || readInternalFlag(BF_IS_COMPOUND_RIGID)) + return; + + PX_ASSERT(!isFrozen()); + + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->createSqBounds(); + } +} + +void BodySim::destroySqBounds() +{ + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* current = static_cast(*elems++); + current->destroySqBounds(); + } +} + +void BodySim::freezeTransforms(PxBitMapPinned* shapeChangedMap) +{ + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* sim = static_cast(*elems++); + sim->updateCached(PxsTransformFlag::eFROZEN, shapeChangedMap); + sim->destroySqBounds(); + } +} + +void BodySim::disableCompound() +{ + if(isActive()) + getScene().removeFromActiveCompoundBodyList(*this); + clearInternalFlag(BF_IS_COMPOUND_RIGID); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.h new file mode 100644 index 0000000..d008410 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScBodySim.h @@ -0,0 +1,350 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_BODYSIM_H +#define SC_BODYSIM_H + +#include "foundation/PxUtilities.h" +#include "foundation/PxIntrinsics.h" +#include "ScRigidSim.h" +#include "PxvDynamics.h" +#include "ScBodyCore.h" +#include "ScSimStateData.h" +#include "ScConstraintGroupNode.h" +#include "PxRigidDynamic.h" +#include "PxsRigidBody.h" + +namespace physx +{ +namespace Bp +{ + class BoundsArray; +} + class PxsTransformCache; +namespace Sc +{ + class Scene; + class ArticulationSim; + +#if PX_VC + #pragma warning(push) + #pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value. +#endif + + class BodySim : public RigidSim + { + public: + //enum InternalFlags + //{ + // //BF_DISABLE_GRAVITY = 1 << 0, // Don't apply the scene's gravity + + // BF_HAS_STATIC_TOUCH = 1 << 1, // Set when a body is part of an island with static contacts. Needed to be able to recalculate adaptive force if this changes + // BF_KINEMATIC_MOVED = 1 << 2, // Set when the kinematic was moved + + // BF_ON_DEATHROW = 1 << 3, // Set when the body is destroyed + + // BF_IS_IN_SLEEP_LIST = 1 << 4, // Set when the body is added to the list of bodies which were put to sleep + // BF_IS_IN_WAKEUP_LIST = 1 << 5, // Set when the body is added to the list of bodies which were woken up + // BF_SLEEP_NOTIFY = 1 << 6, // A sleep notification should be sent for this body (and not a wakeup event, even if the body is part of the woken list as well) + // BF_WAKEUP_NOTIFY = 1 << 7, // A wake up notification should be sent for this body (and not a sleep event, even if the body is part of the sleep list as well) + + // BF_HAS_CONSTRAINTS = 1 << 8, // Set if the body has one or more constraints + // BF_KINEMATIC_SETTLING = 1 << 9, // Set when the body was moved kinematically last frame + // BF_KINEMATIC_SETTLING_2 = 1 << 10, + // BF_KINEMATIC_MOVE_FLAGS = BF_KINEMATIC_MOVED | BF_KINEMATIC_SETTLING | BF_KINEMATIC_SETTLING_2, //Used to clear kinematic masks in 1 call + // BF_KINEMATIC_SURFACE_VELOCITY = 1 << 11, //Set when the application calls setKinematicVelocity. Actor remains awake until application calls clearKinematicVelocity. + // BF_IS_COMPOUND_RIGID = 1 << 12 // Set when the body is a compound actor, we dont want to set the sq bounds + + // // PT: WARNING: flags stored on 16-bits now. + //}; + + public: + BodySim(Scene&, BodyCore&, bool); + virtual ~BodySim(); + + private: + bool setupSimStateData(PxPool* simStateDataPool, const bool isKinematic); + void tearDownSimStateData(PxPool* simStateDataPool, const bool isKinematic); + public: + void switchToKinematic(PxPool* simStateDataPool); + void switchToDynamic(PxPool* simStateDataPool); + + private: + void postSwitchToKinematic(); + void postSwitchToDynamic(); + public: + PX_FORCE_INLINE const SimStateData* getSimStateData(bool isKinematic) const { return (mSimStateData && (checkSimStateKinematicStatus(isKinematic)) ? mSimStateData : NULL); } + PX_FORCE_INLINE SimStateData* getSimStateData(bool isKinematic) { return (mSimStateData && (checkSimStateKinematicStatus(isKinematic)) ? mSimStateData : NULL); } + PX_FORCE_INLINE SimStateData* getSimStateData_Unchecked() const { return mSimStateData; } + PX_FORCE_INLINE bool checkSimStateKinematicStatus(const bool isKinematic) const + { + PX_ASSERT(mSimStateData); + return mSimStateData->isKine() == isKinematic; + } + + void setKinematicTarget(const PxTransform& p); + + void addSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc); + void setSpatialAcceleration(PxPool* simStateDataPool, const PxVec3* linAcc, const PxVec3* angAcc); + void clearSpatialAcceleration(bool force, bool torque); + void addSpatialVelocity(PxPool* simStateDataPool, const PxVec3* linVelDelta, const PxVec3* angVelDelta); + void clearSpatialVelocity(bool force, bool torque); + private: + void raiseVelocityModFlagAndNotify(VelocityModFlags flag); + PX_FORCE_INLINE void notifyAddSpatialAcceleration() { raiseVelocityModFlagAndNotify(VMF_ACC_DIRTY); } + PX_FORCE_INLINE void notifyClearSpatialAcceleration() { raiseVelocityModFlagAndNotify(VMF_ACC_DIRTY); } + PX_FORCE_INLINE void notifyAddSpatialVelocity() { raiseVelocityModFlagAndNotify(VMF_VEL_DIRTY); } + PX_FORCE_INLINE void notifyClearSpatialVelocity() { raiseVelocityModFlagAndNotify(VMF_VEL_DIRTY); } + public: + void updateCached(PxBitMapPinned* shapeChangedMap); + void updateCached(PxsTransformCache& transformCache, Bp::BoundsArray& boundsArray); + void updateContactDistance(PxReal* contactDistance, const PxReal dt, const Bp::BoundsArray& boundsArray); + + // hooks for actions in body core when it's attached to a sim object. Generally + // we get called after the attribute changed. + + virtual void postActorFlagChange(PxU32 oldFlags, PxU32 newFlags); + void postBody2WorldChange(); + void postSetWakeCounter(PxReal t, bool forceWakeUp); + void postPosePreviewChange(const PxU32 posePreviewFlag); // called when PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW changes + + PX_FORCE_INLINE const PxTransform& getBody2World() const { return getBodyCore().getCore().body2World; } + PX_FORCE_INLINE const PxTransform& getBody2Actor() const { return getBodyCore().getCore().getBody2Actor(); } + PX_FORCE_INLINE const PxsRigidBody& getLowLevelBody() const { return mLLBody; } + PX_FORCE_INLINE PxsRigidBody& getLowLevelBody() { return mLLBody; } + void wakeUp(); // note: for user API call purposes only, i.e., use from BodyCore. For simulation internal purposes there is internalWakeUp(). + void putToSleep(); + + void disableCompound(); + + static PxU32 getRigidBodyOffset() { return PxU32(PX_OFFSET_OF_RT(BodySim, mLLBody));} + + virtual void activate(); + virtual void deactivate(); + + //--------------------------------------------------------------------------------- + // Constraint projection + //--------------------------------------------------------------------------------- + PX_FORCE_INLINE ConstraintGroupNode* getConstraintGroup() { return mConstraintGroup; } + PX_FORCE_INLINE void setConstraintGroup(ConstraintGroupNode* node) { mConstraintGroup = node; } + + //// A list of active projection trees in the scene might be better + //PX_FORCE_INLINE void projectPose() { PX_ASSERT(mConstraintGroup); ConstraintGroupNode::projectPose(*mConstraintGroup); } + + //--------------------------------------------------------------------------------- + // Kinematics + //--------------------------------------------------------------------------------- + PX_FORCE_INLINE bool isKinematic() const { return getBodyCore().getFlags() & PxRigidBodyFlag::eKINEMATIC; } + PX_FORCE_INLINE bool isArticulationLink() const { return getActorType() == PxActorType::eARTICULATION_LINK; } + PX_FORCE_INLINE bool hasForcedKinematicNotif() const + { + return getBodyCore().getFlags() & (PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS|PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS); + } + void calculateKinematicVelocity(PxReal oneOverDt); + void updateKinematicPose(); + bool deactivateKinematic(); + private: + PX_FORCE_INLINE void initKinematicStateBase(BodyCore&, bool asPartOfCreation); + + //--------------------------------------------------------------------------------- + // Sleeping + //--------------------------------------------------------------------------------- + public: + virtual void internalWakeUp(PxReal wakeCounterValue); + void internalWakeUpArticulationLink(PxReal wakeCounterValue); // called by ArticulationSim to wake up this link + + PxReal updateWakeCounter(PxReal dt, PxReal energyThreshold, const Cm::SpatialVector& motionVelocity); + + void resetSleepFilter(); + void notifyReadyForSleeping(); // inform the sleep island generation system that the body is ready for sleeping + void notifyNotReadyForSleeping(); // inform the sleep island generation system that the body is not ready for sleeping + PX_FORCE_INLINE bool checkSleepReadinessBesidesWakeCounter(); // for API triggered changes to test sleep readiness + + virtual void registerCountedInteraction() { mLLBody.getCore().numCountedInteractions++; PX_ASSERT(mLLBody.getCore().numCountedInteractions); } + virtual void unregisterCountedInteraction() { PX_ASSERT(mLLBody.getCore().numCountedInteractions); mLLBody.getCore().numCountedInteractions--; } + virtual PxU32 getNumCountedInteractions() const { return mLLBody.getCore().numCountedInteractions; } + + PX_FORCE_INLINE PxIntBool isFrozen() const { return PxIntBool(mLLBody.mInternalFlags & PxsRigidBody::eFROZEN); } + private: + PX_FORCE_INLINE void notifyWakeUp(); // inform the sleep island generation system that the object got woken up + PX_FORCE_INLINE void notifyPutToSleep(); // inform the sleep island generation system that the object was put to sleep + PX_FORCE_INLINE void internalWakeUpBase(PxReal wakeCounterValue); + + //--------------------------------------------------------------------------------- + // External velocity changes + //--------------------------------------------------------------------------------- + public: + void updateForces(PxReal dt, PxsRigidBody** updatedBodySims, PxU32* updatedBodyNodeIndices, + PxU32& index, Cm::SpatialVector* acceleration); + + PX_FORCE_INLINE bool readVelocityModFlag(VelocityModFlags f) { return (mVelModState & f) != 0; } + private: + PX_FORCE_INLINE void raiseVelocityModFlag(VelocityModFlags f) { mVelModState |= f; } + PX_FORCE_INLINE void clearVelocityModFlag(VelocityModFlags f) { mVelModState &= ~f; } + + PX_FORCE_INLINE void setForcesToDefaults(bool enableGravity); + + //--------------------------------------------------------------------------------- + // Miscellaneous + //--------------------------------------------------------------------------------- + public: + /* PX_FORCE_INLINE PxU16 getInternalFlag() const { return mInternalFlags; } + PX_FORCE_INLINE PxU16 readInternalFlag(InternalFlags flag) const { return PxU16(mInternalFlags & flag); } + PX_FORCE_INLINE void raiseInternalFlag(InternalFlags flag) { mInternalFlags |= flag; } + PX_FORCE_INLINE void clearInternalFlag(InternalFlags flag) { mInternalFlags &= ~flag; }*/ + PX_FORCE_INLINE PxU32 getFlagsFast() const { return getBodyCore().getFlags(); } + + PX_FORCE_INLINE BodyCore& getBodyCore() const { return static_cast(getRigidCore()); } + + PX_INLINE ArticulationSim* getArticulation() const { return mArticulation; } + void setArticulation(ArticulationSim* a, PxReal wakeCounter, bool asleep, PxU32 bodyIndex); + + //PX_FORCE_INLINE IG::NodeIndex getNodeIndex() const { return mNodeIndex; } + + PX_FORCE_INLINE void onConstraintAttach() { raiseInternalFlag(BF_HAS_CONSTRAINTS); registerCountedInteraction(); } + void onConstraintDetach(); + + PX_FORCE_INLINE void onOriginShift(const PxVec3& shift, const bool isKinematic) + { + PX_ASSERT(!mSimStateData || checkSimStateKinematicStatus(isKinematic)); + mLLBody.mLastTransform.p -= shift; + if (mSimStateData && isKinematic && mSimStateData->getKinematicData()->targetValid) + mSimStateData->getKinematicData()->targetPose.p -= shift; + } + + PX_FORCE_INLINE bool notInScene() const { return mActiveListIndex == SC_NOT_IN_SCENE_INDEX; } + + PX_FORCE_INLINE bool usingSqKinematicTarget() const + { + const PxU32 ktFlags(PxRigidBodyFlag::eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES | PxRigidBodyFlag::eKINEMATIC); + return (getFlagsFast()&ktFlags) == ktFlags; + } + + PX_FORCE_INLINE PxU32 getNbShapes() const { return mShapes.getCount(); } + + void createSqBounds(); + void destroySqBounds(); + void freezeTransforms(PxBitMapPinned* shapeChangedMap); + void invalidateSqBounds(); + private: + //--------------------------------------------------------------------------------- + // Base body + //--------------------------------------------------------------------------------- + PxsRigidBody mLLBody; + + //--------------------------------------------------------------------------------- + // Island manager + //--------------------------------------------------------------------------------- + // IG::NodeIndex mNodeIndex; + + //--------------------------------------------------------------------------------- + // External velocity changes + //--------------------------------------------------------------------------------- + // VelocityMod data allocated on the fly when the user applies velocity changes + // which need to be accumulated. + // VelMod dirty flags stored in BodySim so we can save ourselves the expense of looking at + // the separate velmod data if no forces have been set. + //PxU16 mInternalFlags; + SimStateData* mSimStateData; + PxU8 mVelModState; + + //--------------------------------------------------------------------------------- + // Articulation + //--------------------------------------------------------------------------------- + ArticulationSim* mArticulation; // NULL if not in an articulation + + //--------------------------------------------------------------------------------- + // Joints & joint groups + //--------------------------------------------------------------------------------- + + // This is a tree data structure that gives us the projection order of joints in which this body is the tree root. + // note: the link of the root body is not necces. the root link due to the re-rooting of the articulation! + ConstraintGroupNode* mConstraintGroup; + }; + +#if PX_VC + #pragma warning(pop) +#endif + +} // namespace Sc + +PX_FORCE_INLINE void Sc::BodySim::setForcesToDefaults(bool enableGravity) +{ + if (!(mLLBody.mCore->mFlags & PxRigidBodyFlag::eRETAIN_ACCELERATIONS)) + { + SimStateData* simStateData = getSimStateData(false); + if(simStateData) + { + VelocityMod* velmod = simStateData->getVelocityModData(); + velmod->clear(); + } + + if (enableGravity) + mVelModState = VMF_GRAVITY_DIRTY; // We want to keep the gravity flag to make sure the acceleration gets changed to gravity-only + // in the next step (unless the application adds new forces of course) + else + mVelModState = 0; + } + else + { + SimStateData* simStateData = getSimStateData(false); + if (simStateData) + { + VelocityMod* velmod = simStateData->getVelocityModData(); + velmod->clearPerStep(); + } + + mVelModState &= (~(VMF_VEL_DIRTY)); + } +} + +PX_FORCE_INLINE bool Sc::BodySim::checkSleepReadinessBesidesWakeCounter() +{ + const BodyCore& bodyCore = getBodyCore(); + const SimStateData* simStateData = getSimStateData(false); + const VelocityMod* velmod = simStateData ? simStateData->getVelocityModData() : NULL; + + bool readyForSleep = bodyCore.getLinearVelocity().isZero() && bodyCore.getAngularVelocity().isZero(); + if (readVelocityModFlag(VMF_ACC_DIRTY)) + { + readyForSleep = readyForSleep && (!velmod || velmod->getLinearVelModPerSec().isZero()); + readyForSleep = readyForSleep && (!velmod || velmod->getAngularVelModPerSec().isZero()); + } + if (readVelocityModFlag(VMF_VEL_DIRTY)) + { + readyForSleep = readyForSleep && (!velmod || velmod->getLinearVelModPerStep().isZero()); + readyForSleep = readyForSleep && (!velmod || velmod->getAngularVelModPerStep().isZero()); + } + + return readyForSleep; +} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp new file mode 100644 index 0000000..6065595 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScCCD.cpp @@ -0,0 +1,218 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "common/PxProfileZone.h" +#include "ScBodySim.h" +#include "ScShapeSim.h" +#include "ScArticulationSim.h" +#include "ScScene.h" + +using namespace physx; +using namespace Sc; + +// PT: TODO: consider using a non-member function for this one +void BodySim::updateContactDistance(PxReal* contactDistance, const PxReal dt, const Bp::BoundsArray& boundsArray) +{ + const PxsRigidBody& llBody = getLowLevelBody(); + + const PxRigidBodyFlags flags = llBody.getCore().mFlags; + + if((flags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) && !(llBody.mInternalFlags & PxsRigidBody::eFROZEN)) + { + // PT: if both CCD flags are enabled we're in "hybrid mode" and we only use speculative contacts for the angular part + const PxReal linearInflation = (flags & PxRigidBodyFlag::eENABLE_CCD) ? 0.0f : llBody.getLinearVelocity().magnitude() * dt; + + const float angVelMagTimesDt = llBody.getAngularVelocity().magnitude() * dt; + + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while(nbElems--) + { + ShapeSim* current = static_cast(*elems++); + + const PxU32 index = current->getElementID(); + + const PxBounds3& bounds = boundsArray.getBounds(index); + + const PxReal radius = bounds.getExtents().magnitude(); + + //Heuristic for angular velocity... + const PxReal angularInflation = angVelMagTimesDt * radius; + + contactDistance[index] = linearInflation + current->getContactOffset() + angularInflation; + } + } +} + +// PT: TODO: merge this with task code +void Sc::ArticulationSim::updateContactDistance(PxReal* contactDistance, const PxReal dt, const Bp::BoundsArray& boundsArray) +{ + const PxU32 size = mBodies.size(); + for(PxU32 i=0; iupdateContactDistance(contactDistance, dt, boundsArray); +} + +class SpeculativeCCDBaseTask : public Cm::Task +{ + PX_NOCOPY(SpeculativeCCDBaseTask) + public: + const Bp::BoundsArray& mBoundsArray; + PxReal* mContactDistances; + const PxReal mDt; + + SpeculativeCCDBaseTask(PxU64 contextID, const Bp::BoundsArray& boundsArray, PxReal* contactDistances, const PxReal dt) : + Cm::Task (contextID), + mBoundsArray (boundsArray), + mContactDistances (contactDistances), + mDt (dt) + {} +}; + +class SpeculativeCCDContactDistanceUpdateTask : public SpeculativeCCDBaseTask +{ +public: + static const PxU32 MaxBodies = 128; + BodySim* mBodySims[MaxBodies]; + PxU32 mNbBodies; + + SpeculativeCCDContactDistanceUpdateTask(PxU64 contextID, PxReal* contactDistances, const PxReal dt, const Bp::BoundsArray& boundsArray) : + SpeculativeCCDBaseTask (contextID, boundsArray, contactDistances, dt), + mNbBodies (0) + {} + + virtual void runInternal() + { + const PxU32 nb = mNbBodies; + for(PxU32 i=0; iupdateContactDistance(mContactDistances, mDt, mBoundsArray); + } + + virtual const char* getName() const { return "SpeculativeCCDContactDistanceUpdateTask"; } + +private: + PX_NOCOPY(SpeculativeCCDContactDistanceUpdateTask) +}; + +class SpeculativeCCDContactDistanceArticulationUpdateTask : public SpeculativeCCDBaseTask +{ +public: + ArticulationSim* mArticulation; + + SpeculativeCCDContactDistanceArticulationUpdateTask(PxU64 contextID, PxReal* contactDistances, const PxReal dt, const Bp::BoundsArray& boundsArray, ArticulationSim* sim) : + SpeculativeCCDBaseTask (contextID, boundsArray, contactDistances, dt), + mArticulation (sim) + {} + + virtual void runInternal() + { + mArticulation->updateContactDistance(mContactDistances, mDt, mBoundsArray); + } + + virtual const char* getName() const { return "SpeculativeCCDContactDistanceArticulationUpdateTask"; } + +private: + PX_NOCOPY(SpeculativeCCDContactDistanceArticulationUpdateTask) +}; + +static PX_FORCE_INLINE void startTask(Cm::Task* task, PxBaseTask* continuation) +{ + task->setContinuation(continuation); + task->removeReference(); +} + +void Sc::Scene::updateContactDistances(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Scene.updateContactDistances", getContextId()); + + Cm::FlushPool& pool = mLLContext->getTaskPool(); + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + PxU32 index; + bool hasContactDistanceChanged = mHasContactDistanceChanged; + + //calculate contact distance for speculative CCD shapes + { + PxBitMap::Iterator speculativeCCDIter(mSpeculativeCCDRigidBodyBitMap); + + SpeculativeCCDContactDistanceUpdateTask* ccdTask = PX_PLACEMENT_NEW(pool.allocate(sizeof(SpeculativeCCDContactDistanceUpdateTask)), SpeculativeCCDContactDistanceUpdateTask)(getContextId(), mContactDistance->begin(), mDt, *mBoundsArray); + + PxBitMapPinned& changedMap = mAABBManager->getChangedAABBMgActorHandleMap(); + + const size_t bodyOffset = PX_OFFSET_OF_RT(BodySim, getLowLevelBody()); + + while((index = speculativeCCDIter.getNext()) != PxBitMap::Iterator::DONE) + { + PxsRigidBody* rigidBody = islandSim.getRigidBody(PxNodeIndex(index)); + BodySim* bodySim = reinterpret_cast(reinterpret_cast(rigidBody)-bodyOffset); + if (bodySim) + { + hasContactDistanceChanged = true; + ccdTask->mBodySims[ccdTask->mNbBodies++] = bodySim; + + // PT: ### changedMap pattern #1 + // PT: TODO: isn't there a problem here? The task function will only touch the shapes whose body has the + // speculative flag and isn't frozen, but here we mark all shapes as changed no matter what. + PxU32 nbElems = bodySim->getNbElements(); + ElementSim** elems = bodySim->getElements(); + while(nbElems--) + { + ShapeSim* sim = static_cast(*elems++); + if(sim->getFlags() & PxShapeFlag::eSIMULATION_SHAPE) + changedMap.growAndSet(sim->getElementID()); + } + + if(ccdTask->mNbBodies == SpeculativeCCDContactDistanceUpdateTask::MaxBodies) + { + startTask(ccdTask, continuation); + ccdTask = PX_PLACEMENT_NEW(pool.allocate(sizeof(SpeculativeCCDContactDistanceUpdateTask)), SpeculativeCCDContactDistanceUpdateTask)(getContextId(), mContactDistance->begin(), mDt, *mBoundsArray); + } + } + } + + if(ccdTask->mNbBodies) + startTask(ccdTask, continuation); + } + + //calculate contact distance for articulation links + { + SpeculativeCCDContactDistanceArticulationUpdateTask* articulationUpdateTask = NULL; + + PxBitMap::Iterator articulateCCDIter(mSpeculativeCDDArticulationBitMap); + while((index = articulateCCDIter.getNext()) != PxBitMap::Iterator::DONE) + { + ArticulationSim* articulationSim = islandSim.getArticulationSim(PxNodeIndex(index)); + if(articulationSim) + { + hasContactDistanceChanged = true; + articulationUpdateTask = PX_PLACEMENT_NEW(pool.allocate(sizeof(SpeculativeCCDContactDistanceArticulationUpdateTask)), SpeculativeCCDContactDistanceArticulationUpdateTask)(getContextId(), mContactDistance->begin(), mDt, *mBoundsArray, articulationSim); + startTask(articulationUpdateTask, continuation); + } + } + } + + mHasContactDistanceChanged = hasContactDistanceChanged; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp new file mode 100644 index 0000000..b5294af --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintCore.cpp @@ -0,0 +1,115 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScConstraintCore.h" +#include "ScPhysics.h" +#include "ScConstraintSim.h" + +using namespace physx; + +Sc::ConstraintCore::ConstraintCore(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) : + mFlags (PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES), + mIsDirty (1), + mAppliedForce (PxVec3(0.0f)), + mAppliedTorque (PxVec3(0.0f)), + mConnector (&connector), + mProject (shaders.project), + mSolverPrep (shaders.solverPrep), + mVisualize (shaders.visualize), + mDataSize (dataSize), + mLinearBreakForce (PX_MAX_F32), + mAngularBreakForce (PX_MAX_F32), + mMinResponseThreshold (0.0f), + mSim (NULL) +{ +} + +void Sc::ConstraintCore::setFlags(PxConstraintFlags flags) +{ + PxConstraintFlags old = mFlags; + flags = flags | (old & PxConstraintFlag::eGPU_COMPATIBLE); + if(flags != old) + { + mFlags = flags; + if(mSim) + mSim->postFlagChange(old, flags); + } +} + +void Sc::ConstraintCore::getForce(PxVec3& force, PxVec3& torque) const +{ + if(!mSim) + { + force = PxVec3(0.0f); + torque = PxVec3(0.0f); + } + else + mSim->getForce(force, torque); +} + +void Sc::ConstraintCore::setBodies(RigidCore* r0v, RigidCore* r1v) +{ + if(mSim) + mSim->setBodies(r0v, r1v); +} + +void Sc::ConstraintCore::setBreakForce(PxReal linear, PxReal angular) +{ + mLinearBreakForce = linear; + mAngularBreakForce = angular; + + if(mSim) + mSim->setBreakForceLL(linear, angular); +} + +void Sc::ConstraintCore::setMinResponseThreshold(PxReal threshold) +{ + mMinResponseThreshold = threshold; + + if(mSim) + mSim->setMinResponseThresholdLL(threshold); +} + +PxConstraint* Sc::ConstraintCore::getPxConstraint() +{ + return gOffsetTable.convertScConstraint2Px(this); +} + +const PxConstraint* Sc::ConstraintCore::getPxConstraint() const +{ + return gOffsetTable.convertScConstraint2Px(this); +} + +void Sc::ConstraintCore::breakApart() +{ + // TODO: probably want to do something with the interaction here + // as well as remove the constraint from LL. + + mFlags |= PxConstraintFlag::eBROKEN; +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp new file mode 100644 index 0000000..68598c2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.cpp @@ -0,0 +1,136 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "ScConstraintGroupNode.h" +#include "ScConstraintProjectionManager.h" +#include "ScBodySim.h" +#include "ScConstraintSim.h" +#include "ScConstraintInteraction.h" + +using namespace physx; + +Sc::ConstraintGroupNode::ConstraintGroupNode(BodySim& b) : + body(&b), + parent(this), + tail(this), + rank(0), + next(NULL), + + projectionFirstRoot(NULL), + projectionNextRoot(NULL), + projectionParent(NULL), + projectionFirstChild(NULL), + projectionNextSibling(NULL), + projectionConstraint(NULL), + + flags(0) +{ +} + + +// +// Implementation of FIND of +// UNION-FIND algo. +// +Sc::ConstraintGroupNode& Sc::ConstraintGroupNode::getRoot() +{ + PX_ASSERT(parent); + + ConstraintGroupNode* root = parent; + + if (root->parent == root) + return *root; + else + { + PxU32 nbHops = 1; + root = root->parent; + + while(root != root->parent) + { + root = root->parent; + nbHops++; + } + + // Write root to all nodes on the path + ConstraintGroupNode* curr = this; + while(nbHops) + { + ConstraintGroupNode* n = curr->parent; + curr->parent = root; + curr = n; + nbHops--; + } + + return *root; + } +} + + +void Sc::ConstraintGroupNode::markForProjectionTreeRebuild(ConstraintProjectionManager& cpManager) +{ + ConstraintGroupNode& root = getRoot(); + if (!root.readFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE)) + { + cpManager.addToPendingTreeUpdates(root); + } +} + + +void Sc::ConstraintGroupNode::initProjectionData(ConstraintGroupNode* parent_, ConstraintSim* c) +{ + projectionConstraint = c; + + //add us to parent's child list: + if (parent_) + { + projectionNextSibling = parent_->projectionFirstChild; + parent_->projectionFirstChild = this; + + projectionParent = parent_; + } +} + + +void Sc::ConstraintGroupNode::clearProjectionData() +{ + projectionFirstRoot = NULL; + projectionNextRoot = NULL; + projectionParent = NULL; + projectionFirstChild = NULL; + projectionNextSibling = NULL; + projectionConstraint = NULL; +} + + +void Sc::ConstraintGroupNode::projectPose(ConstraintGroupNode& node, PxArray& projectedBodies) +{ + PX_ASSERT(node.hasProjectionTreeRoot()); + + Sc::ConstraintProjectionTree::projectPose(node, projectedBodies); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.h new file mode 100644 index 0000000..ba755a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintGroupNode.h @@ -0,0 +1,176 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_GROUP_NODE_H +#define SC_CONSTRAINT_GROUP_NODE_H + +#include "ScConstraintProjectionTree.h" +#include "foundation/PxUtilities.h" // for PxTo8() + +namespace physx +{ +namespace Sc +{ + class ConstraintSim; + class BodySim; + class ConstraintProjectionManager; + + // A 'simulation island' of constraints. Created by a union-find algorithm every time a new constraint is added to any of the involved bodies. + struct ConstraintGroupNode : public PxUserAllocated + { + enum StateFlags + { + eDISCOVERED = 1 << 0, // Used during projection tree generation to mark processed nodes. + eIN_PROJECTION_PASS_LIST = 1 << 1, // Temporarily used to avoid duplicate entries in the list of nodes that should project the pose after the solver + ePENDING_TREE_UPDATE = 1 << 2, // Marks the constraint groups that need their projection trees updated. Must only be set on the root group node. + eNEXT_FREE_SHIFT = 3, + eNEXT_FREE = 1 << eNEXT_FREE_SHIFT + }; + + // these flags should give a rough hint how many projecting constraints to expect in the constraint group. This will be used for + // load balancing when running projection in parallel. The intervals were chosen somewhat arbitrarily but the general motivation was + // to cover very simple constraint setups, simple ragdolls, complex ragdolls and very complex projection setups. Note that the load + // balancing is not waterproof since at the end it is the projection shader from the external constraint implementer (for example, a joint) + // which decides based on some thresholds whether projection runs or not. + enum ProjectionCountHintFlags + { + e1_TO_4 = eNEXT_FREE, + e5_TO_16 = eNEXT_FREE << 1, + e17_TO_64 = eNEXT_FREE << 2, + e65_TO_INF = eNEXT_FREE << 3, + eCLEAR_MASK = ~(0xffffffff << eNEXT_FREE_SHIFT) + }; + + ConstraintGroupNode(BodySim& b); + ~ConstraintGroupNode() + { + PX_ASSERT(!readFlag(ePENDING_TREE_UPDATE)); + PX_ASSERT(projectionFirstRoot == NULL); + } + + PX_FORCE_INLINE void raiseFlag(StateFlags f) { flags |= f; } + PX_FORCE_INLINE void clearFlag(StateFlags f) { flags &= ~f; } + PX_FORCE_INLINE bool readFlag(StateFlags f) const { return (flags & f) != 0; } + PX_FORCE_INLINE PxU32 getProjectionCountHint() const; + PX_FORCE_INLINE void setProjectionCountHint(PxU32 constraintsToProjectCount); + + ConstraintGroupNode& getRoot(); + + PX_FORCE_INLINE void buildProjectionTrees(); //build the projection trees for a constraint group. + void markForProjectionTreeRebuild(ConstraintProjectionManager&); + PX_FORCE_INLINE void purgeProjectionTrees(); + PX_FORCE_INLINE bool hasProjectionTreeRoot() { return projectionFirstRoot != NULL; } + PX_FORCE_INLINE void setProjectionTreeRoot(ConstraintGroupNode* root) { projectionFirstRoot = root; } + + void initProjectionData(ConstraintGroupNode* parent, ConstraintSim* c); + void clearProjectionData(); + + static void projectPose(ConstraintGroupNode& root, PxArray& projectedBodies); + + + BodySim* body; //the owner body of this node + + //tree for union/find: + ConstraintGroupNode* parent; + ConstraintGroupNode* tail; //only valid if this is root of group, points to LList tail node. + PxU32 rank; //rank counter for union/find. Initially zero. Is number of hops from root to furthest leaf in tree. This is just a hint to create more balanced trees. + + //linked list for traversal: + ConstraintGroupNode* next; //next in list, NULL at tail. + + //projection tree information + ConstraintGroupNode* projectionFirstRoot; //pointer to first projection tree root node. Only set for constraint group roots + ConstraintGroupNode* projectionNextRoot; //pointer to next projection root node. Only set for constraint group roots + //a constraint group can consist of multiple projection trees if kinematics are involved! Because a kinematic doesn't split + //the constraint group as a static anchor does. + ConstraintGroupNode* projectionParent; //node to project to + ConstraintGroupNode* projectionFirstChild; //first node which gets projected to this one + ConstraintGroupNode* projectionNextSibling; //the next sibling which gets projected to the same node as this one. NULL if projectionParent is NULL. + ConstraintSim* projectionConstraint; //the constraint to project (constraint to projection parent) + + private: + PxU8 flags; + }; + +} // namespace Sc + + +PX_FORCE_INLINE PxU32 Sc::ConstraintGroupNode::getProjectionCountHint() const +{ + // return the mean of the upper and lower bound + + if (flags & ConstraintGroupNode::e65_TO_INF) + return 128; + else if (flags & ConstraintGroupNode::e17_TO_64) + return 40; + else if (flags & ConstraintGroupNode::e5_TO_16) + return 10; + else if (flags & ConstraintGroupNode::e1_TO_4) + return 2; + + return 0; +} + + +PX_FORCE_INLINE void Sc::ConstraintGroupNode::setProjectionCountHint(PxU32 constraintsToProjectCount) +{ + PxU8 tmpFlags = flags; + tmpFlags &= PxU8(ConstraintGroupNode::eCLEAR_MASK); + + if (constraintsToProjectCount >= 65) + tmpFlags |= ConstraintGroupNode::e65_TO_INF; + else if (constraintsToProjectCount >= 17) + tmpFlags |= ConstraintGroupNode::e17_TO_64; + else if (constraintsToProjectCount >= 5) + tmpFlags |= ConstraintGroupNode::e5_TO_16; + else if (constraintsToProjectCount >= 1) + tmpFlags |= ConstraintGroupNode::e1_TO_4; + + flags = tmpFlags; +} + + +PX_FORCE_INLINE void Sc::ConstraintGroupNode::buildProjectionTrees() +{ + PX_ASSERT(this == parent); // Only call for group roots + PX_ASSERT(!hasProjectionTreeRoot()); + + ConstraintProjectionTree::buildProjectionTrees(*this); +} + + +PX_FORCE_INLINE void Sc::ConstraintGroupNode::purgeProjectionTrees() +{ + PX_ASSERT(this == parent); // Only call for group roots + PX_ASSERT(hasProjectionTreeRoot()); + ConstraintProjectionTree::purgeProjectionTrees(*this); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp new file mode 100644 index 0000000..cf51bdf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.cpp @@ -0,0 +1,168 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScConstraintInteraction.h" +#include "ScConstraintSim.h" +#include "ScBodySim.h" +#include "ScScene.h" +#include "PxsRigidBody.h" +#include "PxsSimpleIslandManager.h" + +using namespace physx; +using namespace Sc; + +ConstraintInteraction::ConstraintInteraction(ConstraintSim* constraint, RigidSim& r0, RigidSim& r1) : + Interaction (r0, r1, InteractionType::eCONSTRAINTSHADER, InteractionFlag::eCONSTRAINT), + mConstraint (constraint) +{ + registerInActors(); + + BodySim* b0 = mConstraint->getBody(0); + BodySim* b1 = mConstraint->getBody(1); + + if(b0) + b0->onConstraintAttach(); + if(b1) + b1->onConstraintAttach(); + + IG::SimpleIslandManager* simpleIslandManager = getScene().getSimpleIslandManager(); + mEdgeIndex = simpleIslandManager->addConstraint(&mConstraint->getLowLevelConstraint(), b0 ? b0->getNodeIndex() : PxNodeIndex(), b1 ? b1->getNodeIndex() : PxNodeIndex(), this); +} + +ConstraintInteraction::~ConstraintInteraction() +{ + PX_ASSERT(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)); + PX_ASSERT(!getDirtyFlags()); + PX_ASSERT(!mConstraint->readFlag(ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED)); +} + +static PX_FORCE_INLINE void removeFromActiveBreakableList(ConstraintSim* constraint, Scene& s) +{ + if(constraint->readFlag(ConstraintSim::eBREAKABLE | ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED) == (ConstraintSim::eBREAKABLE | ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED)) + s.removeActiveBreakableConstraint(constraint); +} + +void ConstraintInteraction::destroy() +{ + setClean(true); // removes the pair from the dirty interaction list etc. + + Scene& scene = getScene(); + + removeFromActiveBreakableList(mConstraint, scene); + + if(mEdgeIndex != IG_INVALID_EDGE) + scene.getSimpleIslandManager()->removeConnection(mEdgeIndex); + mEdgeIndex = IG_INVALID_EDGE; + + unregisterFromActors(); + + BodySim* b0 = mConstraint->getBody(0); + BodySim* b1 = mConstraint->getBody(1); + + if(b0) + b0->onConstraintDetach(); // Note: Has to be done AFTER the interaction has unregistered from the actors + if(b1) + b1->onConstraintDetach(); // Note: Has to be done AFTER the interaction has unregistered from the actors + + clearInteractionFlag(InteractionFlag::eIS_ACTIVE); // ensures that broken constraints do not go into the list of active breakable constraints anymore +} + +void ConstraintInteraction::updateState() +{ + PX_ASSERT(!mConstraint->isBroken()); + PX_ASSERT(getDirtyFlags() & InteractionDirtyFlag::eBODY_KINEMATIC); // at the moment this should be the only reason for this method being called + + // at least one of the bodies got switched from kinematic to dynamic. This will not have changed the sleep state of the interactions, so the + // constraint interactions are just marked dirty and processed as part of the dirty interaction update system. + // + // -> need to check whether to activate the constraint and whether constraint break testing + // is now necessary + // + // the transition from dynamic to kinematic will always trigger an onDeactivate_() (because the body gets deactivated) + // and thus there is no need to consider that case here. + // + + onActivate_(NULL); // note: this will not activate if the necessary conditions are not met, so it can be called even if the pair has been deactivated again before the + // simulation step started +} + +bool ConstraintInteraction::onActivate_(void*) +{ + PX_ASSERT(!mConstraint->isBroken()); + + BodySim* b0 = mConstraint->getBody(0); + BodySim* b1 = mConstraint->getBody(1); + + const bool b0Vote = !b0 || b0->isActive(); + const bool b1Vote = !b1 || b1->isActive(); + + const bool b0Dynamic = b0 && (!b0->isKinematic()); + const bool b1Dynamic = b1 && (!b1->isKinematic()); + + // + // note: constraints between kinematics and kinematics/statics are always inactive and must not be activated + // + if((b0Vote || b1Vote) && (b0Dynamic || b1Dynamic)) + { + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + + if(mConstraint->readFlag(ConstraintSim::eBREAKABLE | ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED) == ConstraintSim::eBREAKABLE) + getScene().addActiveBreakableConstraint(mConstraint, this); + + return true; + } + else + return false; +} + +bool ConstraintInteraction::onDeactivate_() +{ + const BodySim* b0 = mConstraint->getBody(0); + const BodySim* b1 = mConstraint->getBody(1); + + const bool b0Dynamic = b0 && (!b0->isKinematic()); + const bool b1Dynamic = b1 && (!b1->isKinematic()); + + PX_ASSERT( (!b0 && b1 && !b1->isActive()) || + (!b1 && b0 && !b0->isActive()) || + ((b0 && b1 && (!b0->isActive() || !b1->isActive()))) ); + + // + // note: constraints between kinematics and kinematics/statics should always get deactivated + // + if(((!b0 || !b0->isActive()) && (!b1 || !b1->isActive())) || (!b0Dynamic && !b1Dynamic)) + { + removeFromActiveBreakableList(mConstraint, getScene()); + + clearInteractionFlag(InteractionFlag::eIS_ACTIVE); + + return true; + } + else + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.h new file mode 100644 index 0000000..fcafc56 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintInteraction.h @@ -0,0 +1,65 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_INTERACTION_H +#define SC_CONSTRAINT_INTERACTION_H + +#include "ScInteraction.h" + +namespace physx +{ +namespace Sc +{ + class ConstraintSim; + class RigidSim; + + class ConstraintInteraction : public Interaction + { + public: + ConstraintInteraction(ConstraintSim* shader, RigidSim& r0, RigidSim& r1); + ~ConstraintInteraction(); + + bool onActivate_(void* data); + bool onDeactivate_(); + + void updateState(); + void destroy(); // disables the interaction and unregisters from the system. Does NOT delete the object. This is used on destruction but also when a constraint breaks. + + PX_FORCE_INLINE ConstraintSim* getConstraint() { return mConstraint; } + PX_FORCE_INLINE PxU32 getEdgeIndex() const { return mEdgeIndex; } + + private: + ConstraintSim* mConstraint; + PxU32 mEdgeIndex; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp new file mode 100644 index 0000000..c81d495 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.cpp @@ -0,0 +1,504 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "PxcScratchAllocator.h" +#include "ScConstraintProjectionManager.h" +#include "ScBodySim.h" +#include "ScConstraintSim.h" +#include "ScConstraintInteraction.h" + +using namespace physx; + + +namespace physx +{ +namespace Sc +{ + +template +class ScratchAllocatorList +{ +private: + struct ElementBlock + { + PX_FORCE_INLINE ElementBlock() {} + PX_FORCE_INLINE void init(PxU32 countAtStart) { next = NULL; count = countAtStart; } + + ElementBlock* next; + PxU32 count; + T elements[elementsPerBlock]; + }; + + PX_FORCE_INLINE const ScratchAllocatorList& operator=(const ScratchAllocatorList&) {} + + +public: + class Iterator + { + friend class ScratchAllocatorList; + + public: + T const* getNext() + { + if (mCurrentBlock) + { + if (mIndex < mCurrentBlock->count) + { + return &mCurrentBlock->elements[mIndex++]; + } + else + { + if (mCurrentBlock->next) + { + PX_ASSERT(mCurrentBlock->count == elementsPerBlock); + mCurrentBlock = mCurrentBlock->next; + PX_ASSERT(mCurrentBlock->count > 0); + + mIndex = 1; + return &mCurrentBlock->elements[0]; + } + else + return NULL; + } + } + else + return NULL; + } + + private: + Iterator(const ElementBlock* startBlock) : mCurrentBlock(startBlock), mIndex(0) {} + + private: + const ElementBlock* mCurrentBlock; + PxU32 mIndex; + }; + + PX_FORCE_INLINE ScratchAllocatorList(PxcScratchAllocator& scratchAllocator) : mScratchAllocator(scratchAllocator) + { + mFirstBlock = reinterpret_cast(scratchAllocator.alloc(sizeof(ElementBlock), true)); + if (mFirstBlock) + mFirstBlock->init(0); + + mCurrentBlock = mFirstBlock; + } + + PX_FORCE_INLINE ~ScratchAllocatorList() + { + freeMemory(); + } + + PX_FORCE_INLINE bool add(const T& element) + { + if (mCurrentBlock) + { + if (mCurrentBlock->count < elementsPerBlock) + { + mCurrentBlock->elements[mCurrentBlock->count] = element; + mCurrentBlock->count++; + return true; + } + else + { + PX_ASSERT(mCurrentBlock->next == NULL); + PX_ASSERT(mCurrentBlock->count == elementsPerBlock); + + ElementBlock* newBlock = reinterpret_cast(mScratchAllocator.alloc(sizeof(ElementBlock), true)); + if (newBlock) + { + newBlock->init(1); + newBlock->elements[0] = element; + mCurrentBlock->next = newBlock; + mCurrentBlock = newBlock; + return true; + } + else + return false; + } + } + else + return false; + } + + PX_FORCE_INLINE Iterator getIterator() const + { + return Iterator(mFirstBlock); + } + + PX_FORCE_INLINE void freeMemory() + { + ElementBlock* block = mFirstBlock; + + while(block) + { + ElementBlock* blockToFree = block; + block = block->next; + + mScratchAllocator.free(blockToFree); + } + } + + +private: + PxcScratchAllocator& mScratchAllocator; + ElementBlock* mFirstBlock; + ElementBlock* mCurrentBlock; +}; + +} +} + + +Sc::ConstraintProjectionManager::ConstraintProjectionManager() : + mNodePool("projectionNodePool") +{ +} + + +void Sc::ConstraintProjectionManager::addToPendingGroupUpdates(Sc::ConstraintSim& s) +{ + PX_ASSERT(!s.readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)); + bool isNew = mPendingGroupUpdates.insert(&s); + PX_UNUSED(isNew); + PX_ASSERT(isNew); + + s.setFlag(ConstraintSim::ePENDING_GROUP_UPDATE); +} + + +void Sc::ConstraintProjectionManager::removeFromPendingGroupUpdates(Sc::ConstraintSim& s) +{ + PX_ASSERT(s.readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)); + bool didExist = mPendingGroupUpdates.erase(&s); + PX_UNUSED(didExist); + PX_ASSERT(didExist); + + s.clearFlag(ConstraintSim::ePENDING_GROUP_UPDATE); +} + + +void Sc::ConstraintProjectionManager::addToPendingTreeUpdates(ConstraintGroupNode& n) +{ + PX_ASSERT(&n == &n.getRoot()); + PX_ASSERT(!n.readFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE)); + bool isNew = mPendingTreeUpdates.insert(&n); + PX_UNUSED(isNew); + PX_ASSERT(isNew); + + n.raiseFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE); +} + + +void Sc::ConstraintProjectionManager::removeFromPendingTreeUpdates(ConstraintGroupNode& n) +{ + PX_ASSERT(&n == &n.getRoot()); + PX_ASSERT(n.readFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE)); + bool didExist = mPendingTreeUpdates.erase(&n); + PX_UNUSED(didExist); + PX_ASSERT(didExist); + + n.clearFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE); +} + + +PX_INLINE Sc::ConstraintGroupNode* Sc::ConstraintProjectionManager::createGroupNode(BodySim& b) +{ + ConstraintGroupNode* n = mNodePool.construct(b); + b.setConstraintGroup(n); + return n; +} + + +// +// Implementation of UNION of +// UNION-FIND algo. +// It also updates the group traversal +// linked list. +// +void Sc::ConstraintProjectionManager::groupUnion(ConstraintGroupNode& root0, ConstraintGroupNode& root1) +{ + // Should only get called for the roots + PX_ASSERT(&root0 == root0.parent); + PX_ASSERT(&root1 == root1.parent); + + if (&root0 != &root1) //different groups? If not, its already merged. + { + //UNION(this, other); //union-find algo unites groups. + ConstraintGroupNode* newRoot; + ConstraintGroupNode* otherRoot; + if (root0.rank > root1.rank) + { + //hisGroup appended to mygroup. + newRoot = &root0; + otherRoot = &root1; + } + else + { + //myGroup appended to hisGroup. + newRoot = &root1; + otherRoot = &root0; + //there is a chance that the two ranks were equal, in which case the tree depth just increased. + root1.rank++; + } + + PX_ASSERT(newRoot->parent == newRoot); + otherRoot->parent = newRoot; + + //update traversal linked list: + newRoot->tail->next = otherRoot; + newRoot->tail = otherRoot->tail; + } +} + + +// +// Add a body to a constraint projection group. +// +void Sc::ConstraintProjectionManager::addToGroup(BodySim& b, BodySim* other, ConstraintSim& c) +{ + // If both bodies of the constraint are defined, we want to fetch the reference to the group root + // from body 0 by default (allows to avoid checking both) + PX_ASSERT(&b == c.getBody(0) || (c.getBody(0) == NULL && &b == c.getBody(1))); + PX_UNUSED(c); + + ConstraintGroupNode* myRoot; + if (!b.getConstraintGroup()) + myRoot = createGroupNode(b); + else + { + myRoot = &b.getConstraintGroup()->getRoot(); + if (myRoot->hasProjectionTreeRoot()) + myRoot->purgeProjectionTrees(); // If a new constraint gets added to a constraint group, projection trees need to be recreated + } + + if (other) + { + ConstraintGroupNode* otherRoot; + if (!other->getConstraintGroup()) + otherRoot = createGroupNode(*other); + else + { + otherRoot = &other->getConstraintGroup()->getRoot(); + if (otherRoot->hasProjectionTreeRoot()) + otherRoot->purgeProjectionTrees(); // If a new constraint gets added to a constraint group, projection trees need to be recreated + } + + //merge the two groups, if disjoint. + groupUnion(*myRoot, *otherRoot); + } +} + + +// +// Add all projection constraints connected to the specified body to the pending update list but +// ignore the specified constraint. +// +void Sc::ConstraintProjectionManager::markConnectedConstraintsForUpdate(BodySim& b, ConstraintSim* c) +{ + PxU32 size = b.getActorInteractionCount(); + Interaction** interactions = b.getActorInteractions(); + while(size--) + { + Interaction* interaction = *interactions++; + if (interaction->getType() == InteractionType::eCONSTRAINTSHADER) + { + ConstraintSim* ct = static_cast(interaction)->getConstraint(); + + if ((ct != c) && ct->needsProjection() && (!ct->readFlag(ConstraintSim::ePENDING_GROUP_UPDATE))) + { + //mark constraint for pending update: + addToPendingGroupUpdates(*ct); + } + } + } +} + + +// +// Add all constraints connected to the specified body to an array but +// ignore the specified constraint. +// +PX_FORCE_INLINE static void dumpConnectedConstraints(Sc::BodySim& b, Sc::ConstraintSim* c, Sc::ScratchAllocatorList& constraintList) +{ + PxU32 size = b.getActorInteractionCount(); + Sc::Interaction** interactions = b.getActorInteractions(); + while(size--) + { + Sc::Interaction* interaction = *interactions++; + if (interaction->getType() == Sc::InteractionType::eCONSTRAINTSHADER) + { + Sc::ConstraintSim* ct = static_cast(interaction)->getConstraint(); + + if ((ct != c) && (!ct->readFlag(Sc::ConstraintSim::ePENDING_GROUP_UPDATE))) + { + bool success = constraintList.add(ct); + PX_UNUSED(success); + PX_ASSERT(success); + } + } + } +} + + +PX_FORCE_INLINE void Sc::ConstraintProjectionManager::processConstraintForGroupBuilding(ConstraintSim* c, ScratchAllocatorList& constraintList) +{ + c->clearFlag(ConstraintSim::ePENDING_GROUP_UPDATE); + + // Find all constraints connected to the two bodies of the dirty constraint. + // - Constraints to static anchors are ignored (note: kinematics can't be ignored because they might get switched to dynamics any time which + // does trigger a projection tree rebuild but not a constraint tree rebuild + // - Already processed bodies are ignored as well + BodySim* b0 = c->getBody(0); + if (b0 && !b0->getConstraintGroup()) + { + dumpConnectedConstraints(*b0, c, constraintList); + } + BodySim* b1 = c->getBody(1); + if (b1 && !b1->getConstraintGroup()) + { + dumpConnectedConstraints(*b1, c, constraintList); + } + + BodySim* b = c->getAnyBody(); + PX_ASSERT(b); + + addToGroup(*b, c->getOtherBody(b), *c); //this will eventually merge some body's constraint groups. +} + + +void Sc::ConstraintProjectionManager::processPendingUpdates(PxcScratchAllocator& scratchAllocator) +{ + // + // if there are dirty projection trees, then rebuild them + // + const PxU32 nbProjectionTreesToUpdate = mPendingTreeUpdates.size(); + if (nbProjectionTreesToUpdate) + { + ConstraintGroupNode* const* projectionTreesToUpdate = mPendingTreeUpdates.getEntries(); + for(PxU32 i=0; i < nbProjectionTreesToUpdate; i++) + { + ConstraintGroupNode* n = projectionTreesToUpdate[i]; + + PX_ASSERT(n == &n->getRoot()); // only root nodes should be in that list + PX_ASSERT(n->readFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE)); + + n->clearFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE); + + // note: it is valid to get here and not have a projection root. This is the case if all nodes of a constraint graph are kinematic + // at some point (hence no projection root) and later some of those get switched to dynamic. + if (n->hasProjectionTreeRoot()) + n->purgeProjectionTrees(); + n->buildProjectionTrees(); + } + + mPendingTreeUpdates.clear(); + } + + // + // if there are new/dirty constraints, update groups + // + const PxU32 nbProjectionConstraintsToUpdate = mPendingGroupUpdates.size(); + + if (nbProjectionConstraintsToUpdate) + { + ScratchAllocatorList nonProjectionConstraintList(scratchAllocator); + + ConstraintSim* const* projectionConstraintsToUpdate = mPendingGroupUpdates.getEntries(); + +#if PX_DEBUG + // At the beginning the list should only contain constraints with projection. + // Further below other constraints, connected to the constraints with projection, will be added too. + for(PxU32 i=0; i < nbProjectionConstraintsToUpdate; i++) + { + PX_ASSERT(projectionConstraintsToUpdate[i]->needsProjection()); + } +#endif + for(PxU32 i=0; i < nbProjectionConstraintsToUpdate; i++) + { + processConstraintForGroupBuilding(projectionConstraintsToUpdate[i], nonProjectionConstraintList); + } + + ScratchAllocatorList::Iterator iter = nonProjectionConstraintList.getIterator(); + ConstraintSim* const* nextConstraint = iter.getNext(); + while(nextConstraint) + { + processConstraintForGroupBuilding(*nextConstraint, nonProjectionConstraintList); + + nextConstraint = iter.getNext(); + } + + // Now find all the newly made groups and build projection trees. + // Don't need to iterate over the additionally constraints since the roots are supposed to be + // fetchable from any node. + for (PxU32 i=0; i < nbProjectionConstraintsToUpdate; i++) + { + ConstraintSim* c = projectionConstraintsToUpdate[i]; + BodySim* b = c->getAnyBody(); + PX_ASSERT(b); + PX_ASSERT(b->getConstraintGroup()); + + ConstraintGroupNode& root = b->getConstraintGroup()->getRoot(); + if (!root.hasProjectionTreeRoot()) // Build projection tree only once + root.buildProjectionTrees(); + } + + mPendingGroupUpdates.clear(); + } +} + + +// +// Called if a body or a constraint gets deleted. All projecting constraints of the +// group (except the deleted one) are moved to the dirty list and all group nodes are destroyed. +// +void Sc::ConstraintProjectionManager::invalidateGroup(ConstraintGroupNode& node, ConstraintSim* deletedConstraint) +{ + ConstraintGroupNode* n = &node.getRoot(); + + if (n->readFlag(ConstraintGroupNode::ePENDING_TREE_UPDATE)) + { + removeFromPendingTreeUpdates(*n); + } + + while (n) //go through nodes in constraint group + { + markConnectedConstraintsForUpdate(*n->body, deletedConstraint); + + //destroy the body's constraint group information + + ConstraintGroupNode* next = n->next; //save next node ptr before we destroy it! + + BodySim* b = n->body; + b->setConstraintGroup(NULL); + if (n->hasProjectionTreeRoot()) + n->purgeProjectionTrees(); + mNodePool.destroy(n); + + n = next; + } +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.h new file mode 100644 index 0000000..387a127 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionManager.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_PROJECTION_MANAGER_H +#define SC_CONSTRAINT_PROJECTION_MANAGER_H + +#include "foundation/PxPool.h" +#include "foundation/PxHashSet.h" +#include "ScConstraintGroupNode.h" + +namespace physx +{ + class PxcScratchAllocator; + +namespace Sc +{ + class ConstraintSim; + class BodySim; + template class ScratchAllocatorList; + + class ConstraintProjectionManager : public PxUserAllocated + { + public: + ConstraintProjectionManager(); + ~ConstraintProjectionManager() {} + + void addToPendingGroupUpdates(ConstraintSim& s); + void removeFromPendingGroupUpdates(ConstraintSim& s); + + void addToPendingTreeUpdates(ConstraintGroupNode& n); + void removeFromPendingTreeUpdates(ConstraintGroupNode& n); + + void processPendingUpdates(PxcScratchAllocator&); + void invalidateGroup(ConstraintGroupNode& node, ConstraintSim* constraintDeleted); + + private: + PX_INLINE Sc::ConstraintGroupNode* createGroupNode(BodySim& b); + + void addToGroup(BodySim& b, BodySim* other, ConstraintSim& c); + void groupUnion(ConstraintGroupNode& root0, ConstraintGroupNode& root1); + void markConnectedConstraintsForUpdate(BodySim& b, ConstraintSim* c); + PX_FORCE_INLINE void processConstraintForGroupBuilding(ConstraintSim* c, ScratchAllocatorList&); + + + private: + PxPool mNodePool; + PxCoalescedHashSet mPendingGroupUpdates; //list of constraints for which constraint projection groups need to be generated/updated + PxCoalescedHashSet mPendingTreeUpdates; //list of constraint groups that need their projection trees rebuilt. Note: non of the + //constraints in those groups are allowed to be in mPendingGroupUpdates at the same time + //because a group update will automatically trigger tree rebuilds. + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp new file mode 100644 index 0000000..4e3ebd2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.cpp @@ -0,0 +1,565 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "ScConstraintProjectionTree.h" +#include "ScScene.h" +#include "ScBodySim.h" +#include "ScConstraintCore.h" +#include "ScConstraintSim.h" +#include "ScConstraintInteraction.h" + +#include "foundation/PxBasicTemplates.h" +#include "foundation/PxSort.h" +#include "foundation/PxArray.h" + +using namespace physx; + +//------------------------------------------------------------------------------------------ +// +// The projection tree related code +// +// Projection trees are built out of a constraint group/graph. The constraint group just tracks +// the constraint connectivity while the projection trees define the projection root and +// the projection order. +// A constraint group can contain multiple projection trees. +// +//------------------------------------------------------------------------------------------ + +class Sc::BodyRank +{ +public: + PX_INLINE bool operator>(const BodyRank & b) const + { + return rank > b.rank; + } + + Sc::ConstraintGroupNode* startingNode; + Sc::ConstraintSim* constraintToFixedAnchor; + PxU32 rank; + + // + // The following weights are defined to fulfill the projection priorities described further below + // + static const PxU32 sOneWayProjection = PxU32(1 << 31); + static const PxU32 sAttachedToStatic = (1 << 30); + static const PxU32 sAttachedToKinematic = (1 << 29); + static const PxU32 sAllDominantDynamic = (1 << 28); // if for a dynamic body all connections with projection, are one-way towards the body + static const PxU32 sDominantDynamic = (1 << 27); // almost the same as above but there is at least one two-way projection + static const PxU32 sAttachedToDynamic = 1; + static const PxU32 sPrimaryTreeRootMinRank = sOneWayProjection | sAllDominantDynamic; +}; + + +PX_INLINE bool isFixedBody(const Sc::BodySim* b) +{ + return (!b || (b->isKinematic())); +} + + +void Sc::ConstraintProjectionTree::getConstraintStatus(const ConstraintSim& c, const BodySim* b, BodySim*& otherBody, PxU32& projectToBody, PxU32& projectToOtherBody) +{ + const PxU32 isBroken = c.isBroken() ? 0 : 0xffffffff; + const PxU32 projFlags = c.getCore().getFlags() & PxConstraintFlag::ePROJECTION; + + if (b == c.getBody(0)) + { + projectToBody = isBroken & (projFlags & PxConstraintFlag::ePROJECT_TO_ACTOR0); + projectToOtherBody = isBroken & (projFlags & PxConstraintFlag::ePROJECT_TO_ACTOR1); + + otherBody = c.getBody(1); + } + else + { + projectToBody = isBroken & (projFlags & PxConstraintFlag::ePROJECT_TO_ACTOR1); + projectToOtherBody = isBroken & (projFlags & PxConstraintFlag::ePROJECT_TO_ACTOR0); + + otherBody = c.getBody(0); + } +} + + +void Sc::ConstraintProjectionTree::rankConstraint(ConstraintSim& c, BodyRank& br, PxU32& dominanceTracking, PxU32& constraintsToProjectCount) +{ + PxU32 projectToBody, projectToOtherBody; + BodySim* otherB; + getConstraintStatus(c, br.startingNode->body, otherB, projectToBody, projectToOtherBody); + + if (isFixedBody(otherB)) // joint to fixed anchor + { + PxU32 rank; + if (projectToOtherBody) + { + dominanceTracking = 0; // makes sure that the flags below will never get raised again for the body + br.rank &= ~(BodyRank::sAllDominantDynamic | BodyRank::sDominantDynamic); + rank = BodyRank::sOneWayProjection; //we should prefer picking projected constraints as the root over non-projected ones. + constraintsToProjectCount++; + } + else + rank = 0; + + if (!otherB) + rank |= BodyRank::sAttachedToStatic; + else + { + PX_ASSERT(otherB->isKinematic()); + rank |= BodyRank::sAttachedToKinematic; + } + + // the highest ranked fixed anchor constraint should get tracked + if ((!br.constraintToFixedAnchor) || (rank > br.rank)) + br.constraintToFixedAnchor = &c; + + br.rank |= rank; + } + else + { + if (projectToBody && projectToOtherBody) + { + dominanceTracking &= ~BodyRank::sAllDominantDynamic; // makes sure that from now on this will never get raised again for the body + br.rank &= ~BodyRank::sAllDominantDynamic; + constraintsToProjectCount++; + } + else if (projectToOtherBody) + { + dominanceTracking &= ~(BodyRank::sAllDominantDynamic | BodyRank::sDominantDynamic); // makes sure that from now on these will never get raised again for the body + br.rank &= ~(BodyRank::sAllDominantDynamic | BodyRank::sDominantDynamic); + constraintsToProjectCount++; + } + else if (projectToBody) + { + br.rank |= BodyRank::sOneWayProjection | (dominanceTracking & (BodyRank::sAllDominantDynamic | BodyRank::sDominantDynamic)); + constraintsToProjectCount++; + } + + br.rank += BodyRank::sAttachedToDynamic; + } +} + + +/* +the goal here is to take the constraint group whose root is passed, and create one or more projection trees. + +At the moment, the group has to be acyclic and have at most 1 constraint with the ground to be accepted +without being broken up into multiple trees. + +We 'flood fill' the constraint graph several times, starting at bodies where projection trees can be rooted. +Projection tree roots are always dynamic bodies which either need to get projected to a fixed anchor directly +or have projecting constraints between dynamics some way along the tree branches. Static and kinematic actors +are never roots and will not be explicitly part of any tree (but a tree root can project to at most one such fixed node). + +The algo looks like this: + +for all bodies +mark body as undiscovered +rank this body + +The rank of a body depends on the constraints it's connected to. It defines the projection priority which +should be (highest first): +- dynamic attached to static/world with projection +- dynamic attached to kinematic with projection +- all dominant dynamic (has projecting constraints and all of them are one-way towards this dynamic) +---- all the ones above are guaranteed tree roots +- dominant dynamic (same as above but there is at least one projecting two-way constraint as well) +- partially dominant dynamic (has at least one projecting one-way constraints towards this dynamic and at least one projecting one-way constraints towards an other body) +- dynamic attached to static/world without projection +- dynamic attached to kinematic without projection +- dynamic with or without two-way projecting constraints to other dynamics (among these, the one with the highest connectivity count wins) + +for the first three priority types sorted according to rank: +create a projection tree root and grow the tree one connectivity layer at a time + +do the same for dominant dynamic bodies that have not been visited/discovered yet + +for all remaining bodies sorted according to rank: +if the body still hasn't been visited/discovered start a projection tree there and build the whole tree in one go +before moving to the next potential root. +*/ +void Sc::ConstraintProjectionTree::buildProjectionTrees(ConstraintGroupNode& root) +{ + PX_ASSERT(&root == root.parent); + PX_ASSERT(!root.hasProjectionTreeRoot()); + + PxInlineArray bodyRankArray; + BodyRank br; + PxU32 constraintsToProjectCount = 0; + ConstraintGroupNode* node0 = &root; + while (node0) //for all nodes in group + { + PX_ASSERT(node0->body); + if (!node0->body->isKinematic()) + { + node0->clearFlag(ConstraintGroupNode::eDISCOVERED); + + //rank + br.startingNode = node0; + br.rank = 0; + br.constraintToFixedAnchor = 0; + PxU32 dominanceTracking = BodyRank::sAllDominantDynamic | BodyRank::sDominantDynamic; + + //go through all constraints connected to body + PxU32 size = node0->body->getActorInteractionCount(); + Sc::Interaction** interactions = node0->body->getActorInteractions(); + while(size--) + { + Interaction* interaction = *interactions++; + if (interaction->getType() == InteractionType::eCONSTRAINTSHADER) + { + ConstraintSim* c = static_cast(interaction)->getConstraint(); + rankConstraint(*c, br, dominanceTracking, constraintsToProjectCount); + } + } + + PX_ASSERT(br.rank); //if it has no constraints then why is it in the constraint group? + + if (br.rank >= BodyRank::sPrimaryTreeRootMinRank) + node0->raiseFlag(ConstraintGroupNode::eDISCOVERED); // we create a tree for each node attached to a fixed anchor, or a node which is an all dominating dynamic + // -> make sure they do not include each other + + bodyRankArray.pushBack(br); + } + else + node0->raiseFlag(ConstraintGroupNode::eDISCOVERED); // a kinematic does not get projected, it might only get projected to and it is never part of a tree. + + node0 = node0->next; + } + + root.setProjectionCountHint(constraintsToProjectCount); + + if (bodyRankArray.size()) // all of the bodies might have been switched to kinematic in which case there will be no ranked body + { + //sort bodyRankArray + + PxSort(&bodyRankArray.front(), bodyRankArray.size(), PxGreater()); + + ConstraintGroupNode** nodeQueue = PX_ALLOCATE(ConstraintGroupNode*, bodyRankArray.size(), "ProjectionNodeQueue"); + if (nodeQueue) + { + //build the projectionTree + + ConstraintGroupNode* firstProjectionTreeRoot = NULL; + + //go through it in sorted order + + // + // bodies attached to fixed anchors with projecting constraints or all dominant rigid dynamics should get processed first. + // For each of those we create a projection tree for sure, by extending one connectivity level from the root at a time. + // This way we make sure that scenarios like a bridge that is attached to fixed anchors at both ends breaks in the middle + // and not at one of the fixed anchors. + // + // this gets repeated for dominant dynamics. The reason for this is to cover cases where a dominant dynamic is connected to + // a higher ranked node by a chain of two-way constraints. In such a case the two-way constraint should project the dominant + // dynamic towards the higher ranked node and not start a tree on its own. + // + PxU32 brIdx = 0; + PxU32 stopIdx = bodyRankArray.size(); + PxU32 skipCount = 0; + PxU32 ranksToProcess = BodyRank::sPrimaryTreeRootMinRank; + ConstraintGroupNode** nodeQueueEnd; + ConstraintGroupNode** nodeQueueCurrent; + for(PxU32 i=0; i < 2; i++) + { + nodeQueueEnd = nodeQueue; + while((brIdx < stopIdx) && (bodyRankArray[brIdx].rank >= ranksToProcess)) + { + BodyRank& bRank = bodyRankArray[brIdx]; + PX_ASSERT((brIdx == 0) || (bRank.rank <= bodyRankArray[brIdx-1].rank)); + + ConstraintGroupNode& node = *bRank.startingNode; + PX_ASSERT(node.readFlag(ConstraintGroupNode::eDISCOVERED)); + + node.initProjectionData(NULL, bRank.constraintToFixedAnchor); + + if (bRank.rank & (BodyRank::sAttachedToStatic | BodyRank::sAttachedToKinematic)) + { + // for static/kinematic attached, the current node is already a child, so we must not traverse the neighborhood yet + // but rather add the current node to the queue. + PX_ASSERT(bRank.constraintToFixedAnchor); + *nodeQueueEnd = &node; + nodeQueueEnd++; + } + else + { + PX_ASSERT(!bRank.constraintToFixedAnchor); + PxU32 addedNodeCount = projectionTreeBuildStep(node, bRank.constraintToFixedAnchor, nodeQueueEnd); + nodeQueueEnd += addedNodeCount; + } + + node.projectionNextRoot = firstProjectionTreeRoot; + firstProjectionTreeRoot = &node; + + brIdx++; + } + + // first neighbor connectivity level has been pushed to a queue for all chosen tree roots. Now extend the trees one level at a time. + nodeQueueCurrent = nodeQueue; + while(nodeQueueCurrent != nodeQueueEnd) + { + ConstraintGroupNode* node = *nodeQueueCurrent; + PX_ASSERT(node->readFlag(ConstraintGroupNode::eDISCOVERED)); + nodeQueueCurrent++; + + PxU32 addedNodeCount = projectionTreeBuildStep(*node, node->projectionConstraint, nodeQueueEnd); + nodeQueueEnd += addedNodeCount; + } + + brIdx += skipCount; + skipCount = 0; + + // find dominant dynamics that have not been discovered yet and arrange them in a consecutive block + ranksToProcess = BodyRank::sOneWayProjection | BodyRank::sDominantDynamic; + stopIdx = brIdx; + PxU32 k = brIdx; + while((k < bodyRankArray.size()) && (bodyRankArray[k].rank >= ranksToProcess)) + { + ConstraintGroupNode* node = bodyRankArray[k].startingNode; + if (!node->readFlag(ConstraintGroupNode::eDISCOVERED)) + { + node->raiseFlag(ConstraintGroupNode::eDISCOVERED); + bodyRankArray[stopIdx] = bodyRankArray[k]; + stopIdx++; + } + else + skipCount++; + + k++; + } + } + + // + // for every body that has not been discovered yet, we build a tree. Here we do not advance one connectivity level + // at a time because there should be no fight over the nodes among equal roots anymore (or rather no fight that could + // break one-way projection in an unfair way). + // + PX_ASSERT((brIdx == 0) || (brIdx == bodyRankArray.size()) || (bodyRankArray[brIdx].rank < bodyRankArray[brIdx-1].rank)); + for(PxU32 i=brIdx; i < bodyRankArray.size(); i++) + { + nodeQueueEnd = nodeQueue; + + BodyRank& bRank = bodyRankArray[i]; + PX_ASSERT((i == brIdx) || (bRank.rank <= bodyRankArray[i-1].rank)); +#ifdef _DEBUG + if (bRank.rank & (BodyRank::sAttachedToStatic | BodyRank::sAttachedToKinematic)) + { PX_ASSERT(bRank.constraintToFixedAnchor); } + else + { PX_ASSERT(!bRank.constraintToFixedAnchor); } +#endif + + ConstraintGroupNode& node = *bRank.startingNode; + if (!node.readFlag(ConstraintGroupNode::eDISCOVERED)) + { + node.raiseFlag(ConstraintGroupNode::eDISCOVERED); + + PxU32 addedNodeCount = projectionTreeBuildStep(node, bRank.constraintToFixedAnchor, nodeQueueEnd); + nodeQueueEnd += addedNodeCount; + + nodeQueueCurrent = nodeQueue; + while(nodeQueueCurrent != nodeQueueEnd) + { + ConstraintGroupNode* n = *nodeQueueCurrent; + PX_ASSERT(n->readFlag(ConstraintGroupNode::eDISCOVERED)); + PX_ASSERT(n->projectionConstraint); + nodeQueueCurrent++; + + PxU32 nodeCount = projectionTreeBuildStep(*n, n->projectionConstraint, nodeQueueEnd); + nodeQueueEnd += nodeCount; + } + + node.projectionNextRoot = firstProjectionTreeRoot; + firstProjectionTreeRoot = &node; + } + } + + root.setProjectionTreeRoot(firstProjectionTreeRoot); + + PX_FREE(nodeQueue); + } + else + PxGetFoundation().error(PxErrorCode::eOUT_OF_MEMORY, __FILE__, __LINE__, "Allocating projection node queue failed!"); + } +} + + +PxU32 Sc::ConstraintProjectionTree::projectionTreeBuildStep(ConstraintGroupNode& node, ConstraintSim* cToParent, ConstraintGroupNode** nodeQueue) +{ + PX_ASSERT(node.readFlag(ConstraintGroupNode::eDISCOVERED)); + + PxU32 nodeQueueFillCount = 0; + + //go through all constraints attached to the body. + BodySim* body = node.body; + PxU32 size = body->getActorInteractionCount(); + Sc::Interaction** interactions = body->getActorInteractions(); + while(size--) + { + Interaction* interaction = *interactions++; + if (interaction->getType() == InteractionType::eCONSTRAINTSHADER) + { + ConstraintSim* c = static_cast(interaction)->getConstraint(); + + if (c != cToParent) //don't go back along the edge we came from (not really necessary I guess since the ConstraintGroupNode::eDISCOVERED marker should solve this) + { + PxU32 projectToBody, projectToOtherBody; + BodySim* neighbor; + getConstraintStatus(*c, body, neighbor, projectToBody, projectToOtherBody); + + if(!isFixedBody(neighbor) && (!projectToOtherBody || projectToBody)) //just ignore the eventual constraint with environment over here. Body might be attached to multiple fixed anchors. + //Also make sure to ignore one-way projection that goes the opposite way. + { + ConstraintGroupNode* neighborNode = neighbor->getConstraintGroup(); + PX_ASSERT(neighborNode); + + if (!neighborNode->readFlag(ConstraintGroupNode::eDISCOVERED)) + { + *nodeQueue = neighborNode; + + neighborNode->initProjectionData(&node, c); + neighborNode->raiseFlag(ConstraintGroupNode::eDISCOVERED); //flag body nodes that we process so we can detect loops + + nodeQueueFillCount++; + nodeQueue++; + } + } + } + } + } + + return nodeQueueFillCount; +} + + +void Sc::ConstraintProjectionTree::purgeProjectionTrees(ConstraintGroupNode& root) +{ + PX_ASSERT(&root == root.parent); + PX_ASSERT(root.hasProjectionTreeRoot()); + + // CA: New code (non recursive: recursive calls can cause stack overflow with huge trees) + ConstraintGroupNode* projRoot = root.projectionFirstRoot; + do + { + ConstraintGroupNode* currentNode = projRoot; + projRoot = projRoot->projectionNextRoot; // need to do it here because the info might get cleared below + + do + { + // Go down the tree until we find a leaf + if (currentNode->projectionFirstChild) + { + currentNode = currentNode->projectionFirstChild; + continue; + } + + // Delete current node and go to next sibling or parent + ConstraintGroupNode* nodeToDelete = currentNode; + ConstraintGroupNode* parent = currentNode->projectionParent; + currentNode = currentNode->projectionNextSibling; + + // Mark parent as leaf + if (nodeToDelete->projectionParent) + nodeToDelete->projectionParent->projectionFirstChild = NULL; + + // Clear projection info + nodeToDelete->clearProjectionData(); + + if (currentNode != NULL) + continue; + + // No more siblings jump back to parent + currentNode = parent; + + } while (currentNode != NULL); + + } while (projRoot != NULL); + + root.projectionFirstRoot = NULL; // it can happen that the constraint graph root is not part of a projection tree (if it is a kinematic, for example) but it still points to the + // first projection tree root and that needs to get cleaned up as well. + PX_ASSERT(!root.projectionNextRoot); + PX_ASSERT(!root.projectionParent); + PX_ASSERT(!root.projectionFirstChild); + PX_ASSERT(!root.projectionNextSibling); + PX_ASSERT(!root.projectionConstraint); +} + + +void Sc::ConstraintProjectionTree::projectPoseForTree(ConstraintGroupNode& node, PxArray& projectedBodies) +{ + // create a dummy node to keep the loops compact while covering the special case of the first node + PX_ASSERT(node.body); + ConstraintGroupNode dummyNode(*node.body); + dummyNode.projectionNextSibling = &node; + ConstraintGroupNode* currentNode = &dummyNode; + + // non recursive: recursive calls can cause stack overflow with huge trees + do + { + ConstraintGroupNode* nextSiblingNode = currentNode->projectionNextSibling; + + while (nextSiblingNode) + { + currentNode = nextSiblingNode; + ConstraintGroupNode* nextChildNode = currentNode; + + do + { + currentNode = nextChildNode; + + //----------------------------------------------------------------------------- + ConstraintSim* c = currentNode->projectionConstraint; + + if (c && c->hasDynamicBody() && c->needsProjection()) + { + c->projectPose(currentNode->body, projectedBodies); + } + //----------------------------------------------------------------------------- + + nextChildNode = currentNode->projectionFirstChild; + + } while (nextChildNode); + + nextSiblingNode = currentNode->projectionNextSibling; + } + + currentNode = currentNode->projectionParent; + + } while (currentNode != NULL); +} + + +void Sc::ConstraintProjectionTree::projectPose(ConstraintGroupNode& root, PxArray& projectedBodies) +{ + PX_ASSERT(&root == root.parent); + PX_ASSERT(root.hasProjectionTreeRoot()); + + ConstraintGroupNode* projRoot = root.projectionFirstRoot; + do + { + projectPoseForTree(*projRoot, projectedBodies); + projRoot = projRoot->projectionNextRoot; + + } while (projRoot != NULL); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.h new file mode 100644 index 0000000..d592c05 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintProjectionTree.h @@ -0,0 +1,72 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_PROJECTION_TREE_H +#define SC_CONSTRAINT_PROJECTION_TREE_H + +#include "foundation/PxArray.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Sc +{ + struct ConstraintGroupNode; + class ConstraintSim; + class BodySim; + class BodyRank; + + class ConstraintProjectionTree + { + /** + This class serves both the static administration of an articulation and the actual articulation itself. + An Articulation object holds several articulation root nodes which make up a simulation island that + is further connected with lagrange joints. + */ + public: + ConstraintProjectionTree() {} + ~ConstraintProjectionTree() {} + + static void buildProjectionTrees(ConstraintGroupNode& root); + static void purgeProjectionTrees(ConstraintGroupNode& root); + + static void projectPose(ConstraintGroupNode& root, PxArray& projectedBodies); + + private: + static PxU32 projectionTreeBuildStep(ConstraintGroupNode& node, ConstraintSim* cToParent, ConstraintGroupNode** nodeStack); + + static void getConstraintStatus(const ConstraintSim& c, const BodySim* b, BodySim*& otherBody, PxU32& projectToBody, PxU32& projectToOtherBody); + static void rankConstraint(ConstraintSim&, BodyRank&, PxU32& dominanceTracking, PxU32& constraintsToProjectCount); + static void projectPoseForTree(ConstraintGroupNode& node, PxArray& projectedBodies); + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp new file mode 100644 index 0000000..cba1741 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.cpp @@ -0,0 +1,475 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScConstraintProjectionManager.h" +#include "ScBodySim.h" +#include "ScStaticSim.h" +#include "ScConstraintCore.h" +#include "ScConstraintSim.h" +#include "ScConstraintInteraction.h" +#include "ScElementSimInteraction.h" +#include "CmVisualization.h" +#include "DyContext.h" + +using namespace physx; + +PX_FORCE_INLINE void invalidateConstraintGroupsOnAdd(Sc::ConstraintProjectionManager& cpm, Sc::BodySim* b0, Sc::BodySim* b1, Sc::ConstraintSim& constraint) +{ + // constraint groups get built by starting from dirty constraints that need projection. If a non-projecting constraint gets added + // we need to restart the whole process (we do not want to track dirty non-projecting constraints because of a scenario where + // all constraints of a group get switched to non-projecting which should kill the group and not rebuild a new one). + if (b0 && b0->getConstraintGroup()) + cpm.invalidateGroup(*b0->getConstraintGroup(), &constraint); + if (b1 && b1->getConstraintGroup()) + cpm.invalidateGroup(*b1->getConstraintGroup(), &constraint); +} + +Sc::ConstraintSim::ConstraintSim(ConstraintCore& core, RigidCore* r0, RigidCore* r1, Scene& scene) : + mScene (scene), + mCore (core), + mInteraction(NULL), + mFlags (0) +{ + mBodies[0] = (r0 && (r0->getActorCoreType() != PxActorType::eRIGID_STATIC)) ? static_cast(r0->getSim()) : 0; + mBodies[1] = (r1 && (r1->getActorCoreType() != PxActorType::eRIGID_STATIC)) ? static_cast(r1->getSim()) : 0; + + mLowLevelConstraint.index = scene.getConstraintIDTracker().createID(); + PxPinnedArray& writeBackPool = scene.getDynamicsContext()->getConstraintWriteBackPool(); + if (mLowLevelConstraint.index >= writeBackPool.capacity()) + { + writeBackPool.reserve(writeBackPool.capacity() * 2); + } + + writeBackPool.resize(PxMax(writeBackPool.size(), mLowLevelConstraint.index + 1)); + writeBackPool[mLowLevelConstraint.index].initialize(); + + if (!createLLConstraint()) + return; + + PxReal linBreakForce, angBreakForce; + core.getBreakForce(linBreakForce, angBreakForce); + if ((linBreakForce < PX_MAX_F32) || (angBreakForce < PX_MAX_F32)) + setFlag(eBREAKABLE); + + core.setSim(this); + + ConstraintProjectionManager& cpm = scene.getProjectionManager(); + if (!needsProjection()) + invalidateConstraintGroupsOnAdd(cpm, mBodies[0], mBodies[1], *this); + else + cpm.addToPendingGroupUpdates(*this); + + ConstraintSim* cs = this; // to make the Wii U compiler happy + mInteraction = mScene.getConstraintInteractionPool()->construct(cs, + r0 ? *r0->getSim() : scene.getStaticAnchor(), + r1 ? *r1->getSim() : scene.getStaticAnchor()); + + PX_ASSERT(!mInteraction->isRegistered()); // constraint interactions must not register in the scene, there is a list of Sc::ConstraintSim instead +} + +Sc::ConstraintSim::~ConstraintSim() +{ + PX_ASSERT(mInteraction); // This is fine now, a body which gets removed from the scene removes all constraints automatically + PX_ASSERT(!mInteraction->isRegistered()); // constraint interactions must not register in the scene, there is a list of Sc::ConstraintSim instead + + if (readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)) + mScene.getProjectionManager().removeFromPendingGroupUpdates(*this); + + if (!isBroken()) + mInteraction->destroy(); + + mScene.getConstraintIDTracker().releaseID(mLowLevelConstraint.index); + mScene.getConstraintInteractionPool()->destroy(mInteraction); + + destroyLLConstraint(); + + mCore.setSim(NULL); +} + +bool Sc::ConstraintSim::createLLConstraint() +{ + Dy::Constraint& llc = mLowLevelConstraint; + ConstraintCore& core = getCore(); + PxU32 constantBlockSize = core.getConstantBlockSize(); + + void* constantBlock = mScene.allocateConstraintBlock(constantBlockSize); + if(!constantBlock) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, "Constraint: could not allocate low-level resources."); + return false; + } + + //Ensure the constant block isn't just random data because some functions may attempt to use it before it is + //setup. Specifically pvd visualization of joints + //-CN + + PxMemZero( constantBlock, constantBlockSize); + + core.getBreakForce(llc.linBreakForce, llc.angBreakForce); + llc.flags = core.getFlags(); + llc.constantBlockSize = PxU16(constantBlockSize); + + llc.solverPrep = core.getSolverPrep(); + llc.project = core.getProject(); + llc.constantBlock = constantBlock; + + //llc.index = mLowLevelConstraint.index; + llc.body0 = mBodies[0] ? &mBodies[0]->getLowLevelBody() : 0; + llc.body1 = mBodies[1] ? &mBodies[1]->getLowLevelBody() : 0; + llc.bodyCore0 = mBodies[0] ? &llc.body0->getCore() : NULL; + llc.bodyCore1 = mBodies[1] ? &llc.body1->getCore() : NULL; + + llc.minResponseThreshold = core.getMinResponseThreshold(); + + return true; +} + +void Sc::ConstraintSim::destroyLLConstraint() +{ + if(mLowLevelConstraint.constantBlock) + { + mScene.deallocateConstraintBlock(mLowLevelConstraint.constantBlock, + mLowLevelConstraint.constantBlockSize); + } +} + +void Sc::ConstraintSim::setBodies(RigidCore* r0, RigidCore* r1) +{ + PX_ASSERT(mInteraction); + + BodySim* b = getConstraintGroupBody(); + if(b) + mScene.getProjectionManager().invalidateGroup(*b->getConstraintGroup(), this); + + if(!isBroken()) + mInteraction->destroy(); + + mScene.getConstraintInteractionPool()->destroy(mInteraction); + mInteraction = NULL; + + BodySim* b0 = (r0 && (r0->getActorCoreType() != PxActorType::eRIGID_STATIC)) ? static_cast(r0->getSim()) : 0; + BodySim* b1 = (r1 && (r1->getActorCoreType() != PxActorType::eRIGID_STATIC)) ? static_cast(r1->getSim()) : 0; + + ConstraintProjectionManager& cpm = mScene.getProjectionManager(); + PxConstraintFlags::InternalType projectionNeeded = getCore().getFlags() & PxConstraintFlag::ePROJECTION; // can not use "needsProjection()" because that takes into account whether the constraint is broken + if (!projectionNeeded) + invalidateConstraintGroupsOnAdd(cpm, b0, b1, *this); + else if (!readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)) + cpm.addToPendingGroupUpdates(*this); + + Dy::Constraint& c = mLowLevelConstraint; + + c.body0 = b0 ? &b0->getLowLevelBody() : NULL; + c.body1 = b1 ? &b1->getLowLevelBody() : NULL; + + c.bodyCore0 = c.body0 ? &c.body0->getCore() : NULL; + c.bodyCore1 = c.body1 ? &c.body1->getCore() : NULL; + + mBodies[0] = b0; + mBodies[1] = b1; + + ConstraintSim* cs = this; // to make the Wii U compiler happy + mInteraction = mScene.getConstraintInteractionPool()->construct(cs, + r0 ? *r0->getSim() : mScene.getStaticAnchor(), + r1 ? *r1->getSim() : mScene.getStaticAnchor()); +} + +void Sc::ConstraintSim::checkMaxForceExceeded() +{ + PX_ASSERT(readFlag(eCHECK_MAX_FORCE_EXCEEDED)); + + Dy::ConstraintWriteback& solverOutput = mScene.getDynamicsContext()->getConstraintWriteBackPool()[mLowLevelConstraint.index]; + if(solverOutput.broken) + { + setFlag(ConstraintSim::eBROKEN); + mScene.addBrokenConstraint(&mCore); + mCore.breakApart(); + mInteraction->destroy(); + + // update related SIPs + { + ActorSim& a0 = mInteraction->getActorSim0(); + ActorSim& a1 = mInteraction->getActorSim1(); + ActorSim& actor = (a0.getActorInteractionCount()< a1.getActorInteractionCount()) ? a0 : a1; + + actor.setActorsInteractionsDirty(InteractionDirtyFlag::eFILTER_STATE, NULL, InteractionFlag::eRB_ELEMENT); + // because broken constraints can re-enable contact response between the two bodies + } + + PX_ASSERT(!readFlag(eCHECK_MAX_FORCE_EXCEEDED)); + } +} + +void Sc::ConstraintSim::getForce(PxVec3& lin, PxVec3& ang) +{ + const PxReal recipDt = mScene.getOneOverDt(); + Dy::ConstraintWriteback& solverOutput= mScene.getDynamicsContext()->getConstraintWriteBackPool()[mLowLevelConstraint.index]; + lin = solverOutput.linearImpulse * recipDt; + ang = solverOutput.angularImpulse * recipDt; +} + +void Sc::ConstraintSim::setBreakForceLL(PxReal linear, PxReal angular) +{ + PxU8 wasBreakable = readFlag(eBREAKABLE); + PxU8 isBreakable; + if ((linear < PX_MAX_F32) || (angular < PX_MAX_F32)) + isBreakable = eBREAKABLE; + else + isBreakable = 0; + + if (isBreakable != wasBreakable) + { + if (isBreakable) + { + PX_ASSERT(!readFlag(eCHECK_MAX_FORCE_EXCEEDED)); + setFlag(eBREAKABLE); + if (mInteraction->readInteractionFlag(InteractionFlag::eIS_ACTIVE)) + mScene.addActiveBreakableConstraint(this, mInteraction); + } + else + { + if (readFlag(eCHECK_MAX_FORCE_EXCEEDED)) + mScene.removeActiveBreakableConstraint(this); + clearFlag(eBREAKABLE); + } + } + + mLowLevelConstraint.linBreakForce = linear; + mLowLevelConstraint.angBreakForce = angular; +} + +void Sc::ConstraintSim::postFlagChange(PxConstraintFlags oldFlags, PxConstraintFlags newFlags) +{ + mLowLevelConstraint.flags = newFlags; + + // PT: don't convert to bool if not needed + const PxU32 hadProjection = (oldFlags & PxConstraintFlag::ePROJECTION); + const PxU32 needsProjection = (newFlags & PxConstraintFlag::ePROJECTION); + + if(needsProjection && !hadProjection) + { + PX_ASSERT(!readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)); // Non-projecting constrainst should not be part of the update list + + Sc::BodySim* b0 = getBody(0); + Sc::BodySim* b1 = getBody(1); + if ((!b0 || b0->getConstraintGroup()) && (!b1 || b1->getConstraintGroup())) + { + // Already part of a constraint group but not as a projection constraint -> re-generate projection tree + PX_ASSERT(b0 != NULL || b1 != NULL); + if (b0) + b0->getConstraintGroup()->markForProjectionTreeRebuild(mScene.getProjectionManager()); + else + b1->getConstraintGroup()->markForProjectionTreeRebuild(mScene.getProjectionManager()); + } + else + { + // Not part of a constraint group yet + mScene.getProjectionManager().addToPendingGroupUpdates(*this); + } + } + else if(!needsProjection && hadProjection) + { + if (!readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)) + { + Sc::BodySim* b = getConstraintGroupBody(); + if (b) + { + PX_ASSERT(b->getConstraintGroup()); + mScene.getProjectionManager().invalidateGroup(*b->getConstraintGroup(), NULL); + } + // This is conservative but it could be the case that this constraint with projection was the only + // one in the group and thus the whole group must be killed. If we had a counter for the number of + // projecting constraints per group, we could just update the projection tree if the counter was + // larger than 1. But switching the projection flag does not seem likely anyway. + } + else + mScene.getProjectionManager().removeFromPendingGroupUpdates(*this); // Was part of a group which got invalidated + + PX_ASSERT(!readFlag(ConstraintSim::ePENDING_GROUP_UPDATE)); // make sure the expected post-condition is met for all paths + } +} + +Sc::RigidSim& Sc::ConstraintSim::getRigid(PxU32 i) +{ + PX_ASSERT(mInteraction); + + if (i == 0) + return static_cast(mInteraction->getActorSim0()); + else + return static_cast(mInteraction->getActorSim1()); +} + +bool Sc::ConstraintSim::hasDynamicBody() +{ + return (mBodies[0] && (!mBodies[0]->isKinematic())) || (mBodies[1] && (!mBodies[1]->isKinematic())); +} + +static void constrainMotion(PxsRigidBody* body, PxTransform& targetPose) +{ + //Now constraint deltaPos and deltaRot + const PxU32 lockFlags = body->mCore->lockFlags; + + if (lockFlags) + { + const PxTransform& currBody2World = body->mCore->body2World; + + PxVec3 deltaPos = targetPose.p - currBody2World.p; + + PxQuat deltaQ = targetPose.q * currBody2World.q.getConjugate(); + + if (deltaQ.w < 0) //shortest angle. + deltaQ = -deltaQ; + + PxReal angle; + PxVec3 axis; + deltaQ.toRadiansAndUnitAxis(angle, axis); + PxVec3 deltaRot = axis * angle; + + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) + deltaPos.x = 0.0f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Y) + deltaPos.y = 0.0f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_Z) + deltaPos.z = 0.0f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_X) + deltaRot.x = 0.0f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Y) + deltaRot.y = 0.0f; + if (lockFlags & PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z) + deltaRot.z = 0.0f; + + targetPose.p = currBody2World.p + deltaPos; + + PxReal w2 = deltaRot.magnitudeSquared(); + if (w2 != 0.0f) + { + PxReal w = PxSqrt(w2); + + const PxReal v = w * 0.5f; + PxReal s, q; + PxSinCos(v, s, q); + s /= w; + + const PxVec3 pqr = deltaRot * s; + const PxQuat quatVel(pqr.x, pqr.y, pqr.z, 0); + PxQuat result = quatVel * currBody2World.q; + + result += currBody2World.q * q; + + targetPose.q = result.getNormalized(); + } + else + { + targetPose.q = currBody2World.q; + } + } +} + +void Sc::ConstraintSim::projectPose(BodySim* childBody, PxArray& projectedBodies) +{ +#if PX_DEBUG + // We expect bodies in low level constraints to have same order as high level counterpart + PxsRigidBody* b0 = mLowLevelConstraint.body0; + PxsRigidBody* b1 = mLowLevelConstraint.body1; + PX_ASSERT( (childBody == getBody(0) && &childBody->getLowLevelBody() == b0) || + (childBody == getBody(1) && &childBody->getLowLevelBody() == b1) ); +#endif + + Dy::Constraint& constraint = getLowLevelConstraint(); + bool projectToBody0 = childBody == getBody(1); + + PxsRigidBody* body0 = constraint.body0, + * body1 = constraint.body1; + + PxTransform body0ToWorld = body0 ? body0->getPose() : PxTransform(PxIdentity); + PxTransform body1ToWorld = body1 ? body1->getPose() : PxTransform(PxIdentity); + + (*constraint.project)(constraint.constantBlock, body0ToWorld, body1ToWorld, projectToBody0); + + if(projectToBody0) + { + PX_ASSERT(body1); + //Constrain new pose to valid world motion + constrainMotion(body1, body1ToWorld); + body1->setPose(body1ToWorld); + projectedBodies.pushBack(getBody(1)); + } + else + { + PX_ASSERT(body0); + //Constrain new pose to valid world motion + constrainMotion(body0, body0ToWorld); + body0->setPose(body0ToWorld); + projectedBodies.pushBack(getBody(0)); + } +} + +bool Sc::ConstraintSim::needsProjection() +{ + const Dy::ConstraintWriteback& solverOutput = mScene.getDynamicsContext()->getConstraintWriteBackPool()[mLowLevelConstraint.index]; + return (getCore().getFlags() & PxConstraintFlag::ePROJECTION ) && !solverOutput.broken; +} + +PX_INLINE Sc::BodySim* Sc::ConstraintSim::getConstraintGroupBody() +{ + BodySim* b = NULL; + if (mBodies[0] && mBodies[0]->getConstraintGroup()) + b = mBodies[0]; + else if (mBodies[1] && mBodies[1]->getConstraintGroup()) + b = mBodies[1]; + + return b; +} + +void Sc::ConstraintSim::visualize(PxRenderBuffer& output) +{ + if(!(getCore().getFlags() & PxConstraintFlag::eVISUALIZATION)) + return; + + PxsRigidBody* b0 = mLowLevelConstraint.body0; + PxsRigidBody* b1 = mLowLevelConstraint.body1; + + const PxTransform idt(PxIdentity); + const PxTransform& t0 = b0 ? b0->getPose() : idt; + const PxTransform& t1 = b1 ? b1->getPose() : idt; + + const PxReal frameScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LOCAL_FRAMES); + const PxReal limitScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LIMITS); + + PxRenderOutput renderOut(output); + Cm::ConstraintImmediateVisualizer viz(frameScale, limitScale, renderOut); + + PxU32 flags = 0; + if(frameScale!=0.0f) + flags |= PxConstraintVisualizationFlag::eLOCAL_FRAMES; + if(limitScale!=0.0f) + flags |= PxConstraintVisualizationFlag::eLIMITS; + + mCore.getVisualize()(viz, mLowLevelConstraint.constantBlock, t0, t1, flags); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.h new file mode 100644 index 0000000..6f20e1e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScConstraintSim.h @@ -0,0 +1,125 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONSTRAINT_SIM_H +#define SC_CONSTRAINT_SIM_H + +#include "foundation/PxArray.h" +#include "PxSimulationEventCallback.h" +#include "DyConstraint.h" + +namespace physx +{ +namespace Sc +{ + class Scene; + class ConstraintInteraction; + class ConstraintCore; + class RigidCore; + class BodySim; + class RigidSim; + + class ConstraintSim : public PxUserAllocated + { + public: + enum Enum + { + ePENDING_GROUP_UPDATE = (1<<0), // For constraint projection an island of the bodies connected by constraints is generated. + // Schedule generation/update of the island this constraint is a part of. + eBREAKABLE = (1<<1), // The constraint can break + eCHECK_MAX_FORCE_EXCEEDED = (1<<2), // This constraint will get tested for breakage at the end of the sim step + eBROKEN = (1<<3) + }; + ConstraintSim(ConstraintCore& core, + RigidCore* r0, + RigidCore* r1, + Scene& scene); + + ~ConstraintSim(); + + void setBodies(RigidCore* r0, RigidCore* r1); + + void checkMaxForceExceeded(); + + void setBreakForceLL(PxReal linear, PxReal angular); + PX_FORCE_INLINE void setMinResponseThresholdLL(PxReal threshold) { mLowLevelConstraint.minResponseThreshold = threshold; } + PX_FORCE_INLINE const void* getConstantsLL() const { return mLowLevelConstraint.constantBlock; } + + void postFlagChange(PxConstraintFlags oldFlags, PxConstraintFlags newFlags); + + PX_FORCE_INLINE const Dy::Constraint& getLowLevelConstraint() const { return mLowLevelConstraint; } + PX_FORCE_INLINE Dy::Constraint& getLowLevelConstraint() { return mLowLevelConstraint; } + PX_FORCE_INLINE ConstraintCore& getCore() const { return mCore; } + PX_FORCE_INLINE BodySim* getBody(PxU32 i) const // for static actors or world attached constraints NULL is returned + { + return mBodies[i]; + } + + RigidSim& getRigid(PxU32 i); + + void getForce(PxVec3& force, PxVec3& torque); + + PX_FORCE_INLINE PxU8 readFlag(PxU8 flag) const { return PxU8(mFlags & flag); } + PX_FORCE_INLINE void setFlag(PxU8 flag) { mFlags |= flag; } + PX_FORCE_INLINE void clearFlag(PxU8 flag) { mFlags &= ~flag; } + PX_FORCE_INLINE PxU32 isBroken() const { return PxU32(mFlags) & ConstraintSim::eBROKEN; } + + PX_FORCE_INLINE const ConstraintInteraction* getInteraction() const { return mInteraction; } + + //------------------------------------ Projection trees ----------------------------------------- + private: + PX_INLINE BodySim* getConstraintGroupBody(); + + public: + bool hasDynamicBody(); + + void projectPose(BodySim* childBody, PxArray& projectedBodies); + PX_FORCE_INLINE BodySim* getOtherBody(BodySim* b) { return (b == mBodies[0]) ? mBodies[1] : mBodies[0]; } + PX_FORCE_INLINE BodySim* getAnyBody() { return mBodies[0] ? mBodies[0] : mBodies[1]; } + + bool needsProjection(); + //----------------------------------------------------------------------------------------------- + + void visualize(PxRenderBuffer &out); + private: + ConstraintSim& operator=(const ConstraintSim&); + bool createLLConstraint(); + void destroyLLConstraint(); + private: + Dy::Constraint mLowLevelConstraint; + Scene& mScene; + ConstraintCore& mCore; + ConstraintInteraction* mInteraction; + BodySim* mBodies[2]; + PxU8 mFlags; + }; +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactReportBuffer.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactReportBuffer.h new file mode 100644 index 0000000..7fea420 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactReportBuffer.h @@ -0,0 +1,173 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONTACT_REPORT_BUFFER_H +#define SC_CONTACT_REPORT_BUFFER_H + +#include "foundation/Px.h" +#include "common/PxProfileZone.h" + +namespace physx +{ + namespace Sc + { + class ContactReportBuffer + { + public: + PX_FORCE_INLINE ContactReportBuffer(PxU32 initialSize, bool noResizeAllowed) + : mBuffer(NULL) + ,mCurrentBufferIndex(0) + ,mCurrentBufferSize(initialSize) + ,mDefaultBufferSize(initialSize) + ,mLastBufferIndex(0) + ,mAllocationLocked(noResizeAllowed) + { + mBuffer = allocateBuffer(initialSize); + PX_ASSERT(mBuffer); + } + + ~ContactReportBuffer() + { + PX_FREE(mBuffer); + } + + PX_FORCE_INLINE void reset(); + PX_FORCE_INLINE void flush(); + + PX_FORCE_INLINE PxU8* allocateNotThreadSafe(PxU32 size, PxU32& index, PxU32 alignment= 16); + PX_FORCE_INLINE PxU8* reallocateNotThreadSafe(PxU32 size, PxU32& index, PxU32 alignment= 16, PxU32 lastIndex = 0xFFFFFFFF); + PX_FORCE_INLINE PxU8* getData(const PxU32& index) const { return mBuffer+index; } + + PX_FORCE_INLINE PxU32 getDefaultBufferSize() const {return mDefaultBufferSize;} + + private: + PX_FORCE_INLINE PxU8* allocateBuffer(PxU32 size); + + private: + PxU8* mBuffer; + PxU32 mCurrentBufferIndex; + PxU32 mCurrentBufferSize; + PxU32 mDefaultBufferSize; + PxU32 mLastBufferIndex; + bool mAllocationLocked; + }; + + } // namespace Sc + + ////////////////////////////////////////////////////////////////////////// + + PX_FORCE_INLINE void Sc::ContactReportBuffer::reset() + { + mCurrentBufferIndex = 0; + mLastBufferIndex = 0xFFFFFFFF; + } + + ////////////////////////////////////////////////////////////////////////// + + void Sc::ContactReportBuffer::flush() + { + mCurrentBufferIndex = 0; + mLastBufferIndex = 0xFFFFFFFF; + + if(mCurrentBufferSize != mDefaultBufferSize) + { + PX_FREE(mBuffer); + + mBuffer = allocateBuffer(mDefaultBufferSize); + PX_ASSERT(mBuffer); + + mCurrentBufferSize = mDefaultBufferSize; + } + } + + ////////////////////////////////////////////////////////////////////////// + + PxU8* Sc::ContactReportBuffer::allocateNotThreadSafe(PxU32 size, PxU32& index ,PxU32 alignment/* =16 */) + { + PX_ASSERT(PxIsPowerOfTwo(alignment)); + + // padding for alignment + PxU32 pad = ((mCurrentBufferIndex+alignment-1)&~(alignment-1)) - mCurrentBufferIndex; + + index = mCurrentBufferIndex + pad; + + if (index + size > mCurrentBufferSize) + { + PX_PROFILE_ZONE("ContactReportBuffer::Resize", 0); + if(mAllocationLocked) + return NULL; + + PxU32 oldBufferSize = mCurrentBufferSize; + while(index + size > mCurrentBufferSize) + { + mCurrentBufferSize *= 2; + } + + PxU8* tempBuffer = allocateBuffer(mCurrentBufferSize); + + PxMemCopy(tempBuffer,mBuffer,oldBufferSize); + + PX_FREE(mBuffer); + + mBuffer = tempBuffer; + } + + + PxU8* ptr = mBuffer + index; + mLastBufferIndex = index; + PX_ASSERT((size_t(ptr)&(alignment-1)) == 0); + mCurrentBufferIndex += size + pad; + return ptr; + } + + ////////////////////////////////////////////////////////////////////////// + + PxU8* Sc::ContactReportBuffer::reallocateNotThreadSafe(PxU32 size, PxU32& index ,PxU32 alignment/* =16 */, PxU32 lastIndex) + { + if(lastIndex != mLastBufferIndex) + { + return allocateNotThreadSafe(size,index,alignment); + } + else + { + mCurrentBufferIndex = mLastBufferIndex; + return allocateNotThreadSafe(size,index,alignment); + } + } + + ////////////////////////////////////////////////////////////////////////// + + PX_FORCE_INLINE PxU8* Sc::ContactReportBuffer::allocateBuffer(PxU32 size) + { + return (static_cast(PX_ALLOC(size, "ContactReportBuffer"))); + } + +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactStream.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactStream.h new file mode 100644 index 0000000..e1887fc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScContactStream.h @@ -0,0 +1,400 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_CONTACT_STREAM_H +#define SC_CONTACT_STREAM_H + +#include "foundation/Px.h" +#include "PxSimulationEventCallback.h" +#include "ScObjectIDTracker.h" +#include "ScRigidSim.h" +#include "ScStaticSim.h" +#include "ScBodySim.h" + +namespace physx +{ + class PxShape; + +namespace Sc +{ + class ActorPair; + + + // Internal counterpart of PxContactPair + struct ContactShapePair + { + public: + PxShape* shapes[2]; + const PxU8* contactPatches; + const PxU8* contactPoints; + const PxReal* contactForces; + PxU32 requiredBufferSize; + PxU8 contactCount; + PxU8 patchCount; + PxU16 constraintStreamSize; + PxU16 flags; + PxU16 events; + PxU32 shapeID[2]; + //26 (or 38 on 64bit) + }; + PX_COMPILE_TIME_ASSERT(sizeof(ContactShapePair) == sizeof(PxContactPair)); + + struct ContactStreamManagerFlag + { + enum Enum + { + /** + \brief Need to test stream for shapes that were removed from the actor/scene + + Usually this is the case when a shape gets removed from the scene, however, other operations that remove the + broadphase volume of a pair object have to be considered as well since the shape might get removed later after such an + operation. The scenarios to consider are: + + \li shape gets removed (this includes raising PxActorFlag::eDISABLE_SIMULATION) + \li shape switches to eSCENE_QUERY_SHAPE only + \li shape switches to eTRIGGER_SHAPE + \li resetFiltering() + \li actor gets removed from an aggregate + + */ + eTEST_FOR_REMOVED_SHAPES = (1<<0), + + /** + \brief Invalid stream memory not allocated + */ + eINVALID_STREAM = (1<<1), + + /** + \brief Incomplete stream will be reported + */ + eINCOMPLETE_STREAM = (1<<2), + + /** + \brief The stream contains extra data with PxContactPairVelocity items where the post solver velocity needs to get written to. + Only valid for discrete collision (in CCD the post response velocity is available immediately). + */ + eNEEDS_POST_SOLVER_VELOCITY = (1<<3), + + /** + \brief Marker for the next available free flag + */ + eNEXT_FREE_FLAG = (1<<4) + }; + }; + + struct ContactStreamHeader + { + PxU16 contactPass; // marker for extra data to know when a new collison pass started (discrete collision -> CCD pass 1 -> CCD pass 2 -> ...) + PxU16 pad; // to keep the stream 4byte aligned + }; + + /** + \brief Contact report logic and data management. + + The internal contact report stream has the following format: + + ContactStreamHeader | PxContactPairIndex0 | (PxContactPairPose0, PxContactPairVelocity0) | ... | PxContactPairIndexN | (PxContactPairPoseN, PxContactPairVelocityN) | (unused memory up to maxExtraDataSize ) | + PxContactPair0 | ... | PxContactPairM | (unsued pairs up to maxPairCount) + */ + class ContactStreamManager + { + public: + PX_FORCE_INLINE ContactStreamManager() : maxPairCount(0), flags_and_maxExtraDataBlocks(0) {} + PX_FORCE_INLINE ~ContactStreamManager() {} + + PX_FORCE_INLINE void reset(); + + PX_FORCE_INLINE PxU16 getFlags() const; + PX_FORCE_INLINE void raiseFlags(PxU16 flags); + PX_FORCE_INLINE void clearFlags(PxU16 flags); + + PX_FORCE_INLINE PxU32 getMaxExtraDataSize() const; + PX_FORCE_INLINE void setMaxExtraDataSize(PxU32 size); // size in bytes (will translate into blocks internally) + + PX_FORCE_INLINE Sc::ContactShapePair* getShapePairs(PxU8* contactReportPairData) const; + + PX_FORCE_INLINE static void convertDeletedShapesInContactStream(ContactShapePair*, PxU32 pairCount, const ObjectIDTracker&); + + PX_FORCE_INLINE static PxU32 computeExtraDataBlockCount(PxU32 extraDataSize); + PX_FORCE_INLINE static PxU32 computeExtraDataBlockSize(PxU32 extraDataSize); + PX_FORCE_INLINE static PxU16 computeContactReportExtraDataSize(PxU32 extraDataFlags, bool addHeader); + PX_FORCE_INLINE static void fillInContactReportExtraData(PxContactPairVelocity*, PxU32 index, const ActorSim&, bool isCCDPass); + PX_FORCE_INLINE static void fillInContactReportExtraData(PxContactPairPose*, PxU32 index, const ActorSim&, bool isCCDPass, const bool useCurrentTransform); + PX_FORCE_INLINE void fillInContactReportExtraData(PxU8* stream, PxU32 extraDataFlags, const ActorSim&, const ActorSim&, PxU32 ccdPass, const bool useCurrentTransform, PxU32 pairIndex, PxU32 sizeOffset); + PX_FORCE_INLINE void setContactReportPostSolverVelocity(PxU8* stream, const ActorSim&, const ActorSim&); + + PxU32 bufferIndex; // marks the start of the shape pair stream of the actor pair (byte offset with respect to global contact buffer stream) + PxU16 maxPairCount; // used to reserve the same amount of memory as in the last frame (as an initial guess) + PxU16 currentPairCount; // number of shape pairs stored in the buffer + PxU16 extraDataSize; // size of the extra data section in the stream + private: + PxU16 flags_and_maxExtraDataBlocks; // used to reserve the same amount of memory as in the last frame (as an initial guess) + + public: + static const PxU32 sExtraDataBlockSizePow2 = 4; // extra data gets allocated as a multiple of 2^sExtraDataBlockSizePow2 to keep memory low of this struct. + static const PxU32 sFlagMask = (ContactStreamManagerFlag::eNEXT_FREE_FLAG - 1); + static const PxU32 sMaxExtraDataShift = 4; // shift necessary to extract the maximum number of blocks allocated for extra data + + PX_COMPILE_TIME_ASSERT(ContactStreamManagerFlag::eNEXT_FREE_FLAG == (1 << sMaxExtraDataShift)); + }; + +} // namespace Sc + + +PX_FORCE_INLINE void Sc::ContactStreamManager::reset() +{ + currentPairCount = 0; + extraDataSize = 0; + flags_and_maxExtraDataBlocks &= ~sFlagMask; +} + + +PX_FORCE_INLINE PxU16 Sc::ContactStreamManager::getFlags() const +{ + return (flags_and_maxExtraDataBlocks & sFlagMask); +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::raiseFlags(PxU16 flags) +{ + PX_ASSERT(flags < ContactStreamManagerFlag::eNEXT_FREE_FLAG); + + flags_and_maxExtraDataBlocks |= flags; +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::clearFlags(PxU16 flags) +{ + PX_ASSERT(flags < ContactStreamManagerFlag::eNEXT_FREE_FLAG); + + PxU16 tmpFlags = getFlags(); + tmpFlags &= ~flags; + flags_and_maxExtraDataBlocks &= ~sFlagMask; + raiseFlags(tmpFlags); +} + + +PX_FORCE_INLINE PxU32 Sc::ContactStreamManager::getMaxExtraDataSize() const +{ + return PxU32((flags_and_maxExtraDataBlocks >> sMaxExtraDataShift) << sExtraDataBlockSizePow2); +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::setMaxExtraDataSize(PxU32 size) +{ + PxU32 nbBlocks = computeExtraDataBlockCount(size); + flags_and_maxExtraDataBlocks = PxTo16((flags_and_maxExtraDataBlocks & sFlagMask) | (nbBlocks << sMaxExtraDataShift)); +} + + +PX_FORCE_INLINE Sc::ContactShapePair* Sc::ContactStreamManager::getShapePairs(PxU8* contactReportPairData) const +{ + return reinterpret_cast(contactReportPairData + getMaxExtraDataSize()); +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::convertDeletedShapesInContactStream(ContactShapePair* shapePairs, PxU32 pairCount, const ObjectIDTracker& tracker) +{ + for(PxU32 i=0; i < pairCount; i++) + { + ContactShapePair& csp = shapePairs[i]; + + PxU32 shape0ID = csp.shapeID[0]; + PxU32 shape1ID = csp.shapeID[1]; + + PxU16 flags = csp.flags; + PX_COMPILE_TIME_ASSERT(sizeof(flags) == sizeof((reinterpret_cast(0))->flags)); + + if (tracker.isDeletedID(shape0ID)) + flags |= PxContactPairFlag::eREMOVED_SHAPE_0; + if (tracker.isDeletedID(shape1ID)) + flags |= PxContactPairFlag::eREMOVED_SHAPE_1; + + csp.flags = flags; + } +} + + +PX_FORCE_INLINE PxU32 Sc::ContactStreamManager::computeExtraDataBlockCount(PxU32 extraDataSize_) +{ + PxU32 nbBlocks; + if (extraDataSize_ & ((1 << sExtraDataBlockSizePow2) - 1)) // not a multiple of block size -> need one block more + nbBlocks = (extraDataSize_ >> sExtraDataBlockSizePow2) + 1; + else + nbBlocks = (extraDataSize_ >> sExtraDataBlockSizePow2); + + return nbBlocks; +} + + +PX_FORCE_INLINE PxU32 Sc::ContactStreamManager::computeExtraDataBlockSize(PxU32 extraDataSize_) +{ + return (computeExtraDataBlockCount(extraDataSize_) << sExtraDataBlockSizePow2); +} + + +PX_FORCE_INLINE PxU16 Sc::ContactStreamManager::computeContactReportExtraDataSize(PxU32 extraDataFlags, bool addHeader) +{ + PX_ASSERT(extraDataFlags); + + PxU16 extraDataSize_ = sizeof(PxContactPairIndex); + if (extraDataFlags & PxPairFlag::ePRE_SOLVER_VELOCITY) + extraDataSize_ += sizeof(PxContactPairVelocity); + if (extraDataFlags & PxPairFlag::ePOST_SOLVER_VELOCITY) + extraDataSize_ += sizeof(PxContactPairVelocity); + if (extraDataFlags & PxPairFlag::eCONTACT_EVENT_POSE) + extraDataSize_ += sizeof(PxContactPairPose); + if (addHeader) + extraDataSize_ += sizeof(ContactStreamHeader); + return extraDataSize_; +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::fillInContactReportExtraData(PxContactPairVelocity* cpVel, PxU32 index, const ActorSim& rs, bool isCCDPass) +{ + if (rs.getActorType() != PxActorType::eRIGID_STATIC) + { + const BodySim& bs = static_cast(rs); + if ((!isCCDPass) || (cpVel->type == PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY)) + { + const BodyCore& bc = bs.getBodyCore(); + cpVel->linearVelocity[index] = bc.getLinearVelocity(); + cpVel->angularVelocity[index] = bc.getAngularVelocity(); + } + else + { + PX_ASSERT(cpVel->type == PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY); + const Cm::SpatialVector& vel = bs.getLowLevelBody().getPreSolverVelocities(); + cpVel->linearVelocity[index] = vel.linear; + cpVel->angularVelocity[index] = vel.angular; + } + } + else + { + cpVel->linearVelocity[index] = PxVec3(0.0f); + cpVel->angularVelocity[index] = PxVec3(0.0f); + } +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::fillInContactReportExtraData(PxContactPairPose* cpPose, PxU32 index, const ActorSim& rs, bool isCCDPass, const bool useCurrentTransform) +{ + if(rs.getActorType() != PxActorType::eRIGID_STATIC) + { + const BodySim& bs = static_cast(rs); + const BodyCore& bc = bs.getBodyCore(); + const PxTransform& src = (!isCCDPass && useCurrentTransform) ? bc.getBody2World() : bs.getLowLevelBody().getLastCCDTransform(); + cpPose->globalPose[index] = src * bc.getBody2Actor().getInverse(); + } + else + { + const StaticSim& ss = static_cast(rs); + const StaticCore& sc = ss.getStaticCore(); + cpPose->globalPose[index] = sc.getActor2World(); + } +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::fillInContactReportExtraData(PxU8* stream, PxU32 extraDataFlags, const ActorSim& rs0, const ActorSim& rs1, PxU32 ccdPass, const bool useCurrentTransform, + PxU32 pairIndex, PxU32 sizeOffset) +{ + ContactStreamHeader* strHeader = reinterpret_cast(stream); + strHeader->contactPass = PxTo16(ccdPass); + + stream += sizeOffset; + PxU8* edStream = stream; + bool isCCDPass = (ccdPass != 0); + + { + PxContactPairIndex* cpIndex = reinterpret_cast(edStream); + cpIndex->type = PxContactPairExtraDataType::eCONTACT_PAIR_INDEX; + cpIndex->index = PxTo16(pairIndex); + edStream += sizeof(PxContactPairIndex); + + PX_ASSERT(edStream <= reinterpret_cast(getShapePairs(stream))); + } + + // Important: make sure this one is the first after the PxContactPairIndex item for discrete contacts as it needs to get filled in before the reports get sent + // (post solver velocity is not available when it gets created) + if (extraDataFlags & PxPairFlag::ePOST_SOLVER_VELOCITY) + { + PxContactPairVelocity* cpVel = reinterpret_cast(edStream); + cpVel->type = PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY; + edStream += sizeof(PxContactPairVelocity); + + if (!isCCDPass) + raiseFlags(ContactStreamManagerFlag::eNEEDS_POST_SOLVER_VELOCITY); // don't know the post solver velocity yet + else + { + ContactStreamManager::fillInContactReportExtraData(cpVel, 0, rs0, true); + ContactStreamManager::fillInContactReportExtraData(cpVel, 1, rs1, true); + } + + PX_ASSERT(edStream <= reinterpret_cast(getShapePairs(stream))); + } + if (extraDataFlags & PxPairFlag::ePRE_SOLVER_VELOCITY) + { + PxContactPairVelocity* cpVel = reinterpret_cast(edStream); + cpVel->type = PxContactPairExtraDataType::ePRE_SOLVER_VELOCITY; + ContactStreamManager::fillInContactReportExtraData(cpVel, 0, rs0, isCCDPass); + ContactStreamManager::fillInContactReportExtraData(cpVel, 1, rs1, isCCDPass); + edStream += sizeof(PxContactPairVelocity); + + PX_ASSERT(edStream <= reinterpret_cast(getShapePairs(stream))); + } + if (extraDataFlags & PxPairFlag::eCONTACT_EVENT_POSE) + { + PxContactPairPose* cpPose = reinterpret_cast(edStream); + cpPose->type = PxContactPairExtraDataType::eCONTACT_EVENT_POSE; + ContactStreamManager::fillInContactReportExtraData(cpPose, 0, rs0, isCCDPass, useCurrentTransform); + ContactStreamManager::fillInContactReportExtraData(cpPose, 1, rs1, isCCDPass, useCurrentTransform); + edStream += sizeof(PxContactPairPose); + + PX_ASSERT(edStream <= reinterpret_cast(getShapePairs(stream))); + } + + extraDataSize = PxTo16(sizeOffset + PxU32(edStream - stream)); +} + + +PX_FORCE_INLINE void Sc::ContactStreamManager::setContactReportPostSolverVelocity(PxU8* stream, const ActorSim& rs0, const ActorSim& rs1) +{ + PX_ASSERT(extraDataSize > (sizeof(ContactStreamHeader) + sizeof(PxContactPairIndex))); + PxContactPairVelocity* cpVel = reinterpret_cast(stream + sizeof(ContactStreamHeader) + sizeof(PxContactPairIndex)); + PX_ASSERT(cpVel->type == PxContactPairExtraDataType::ePOST_SOLVER_VELOCITY); + + fillInContactReportExtraData(cpVel, 0, rs0, false); + fillInContactReportExtraData(cpVel, 1, rs1, false); + + clearFlags(ContactStreamManagerFlag::eNEEDS_POST_SOLVER_VELOCITY); +} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp new file mode 100644 index 0000000..8752aa3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.cpp @@ -0,0 +1,44 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScElementInteractionMarker.h" +#include "ScNPhaseCore.h" + +using namespace physx; + +Sc::ElementInteractionMarker::~ElementInteractionMarker() +{ + if(isRegistered()) + { + Scene& scene = getScene(); + scene.unregisterInteraction(this); + scene.getNPhaseCore()->unregisterInteraction(this); + } + unregisterFromActors(); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.h new file mode 100644 index 0000000..ef1df77 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementInteractionMarker.h @@ -0,0 +1,68 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ELEMENT_INTERACTION_MARKER_H +#define SC_ELEMENT_INTERACTION_MARKER_H + +#include "ScElementSimInteraction.h" +#include "ScNPhaseCore.h" + +namespace physx +{ +namespace Sc +{ + class ElementInteractionMarker : public ElementSimInteraction + { + public: + PX_INLINE ElementInteractionMarker(ElementSim& element0, ElementSim& element1, bool createParallel/* = false*/); + ~ElementInteractionMarker(); + + bool onActivate_(void*) { return false; } + bool onDeactivate_() { return true; } + }; + +} // namespace Sc + + +PX_INLINE Sc::ElementInteractionMarker::ElementInteractionMarker(ElementSim& element0, ElementSim& element1, bool createParallel) : + ElementSimInteraction(element0, element1, InteractionType::eMARKER, InteractionFlag::eRB_ELEMENT|InteractionFlag::eFILTERABLE) +{ + if(!createParallel) + { + bool active = registerInActors(); + PX_UNUSED(active); + PX_ASSERT(!active); + getScene().registerInteraction(this, false); + getScene().getNPhaseCore()->registerInteraction(this); + } +} + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp new file mode 100644 index 0000000..34280bf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.cpp @@ -0,0 +1,187 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScElementSim.h" +#include "ScElementSimInteraction.h" +#include "ScSimStats.h" + +using namespace physx; +using namespace Sc; + +static PX_FORCE_INLINE bool interactionHasElement(const Interaction* it, const ElementSim* elem) +{ + if(it->readInteractionFlag(InteractionFlag::eRB_ELEMENT)) + { + PX_ASSERT( (it->getType() == InteractionType::eMARKER) || + (it->getType() == InteractionType::eOVERLAP) || + (it->getType() == InteractionType::eTRIGGER) ); + + const ElementSimInteraction* ei = static_cast(it); + if((&ei->getElement0() == elem) || (&ei->getElement1() == elem)) + return true; + } + return false; +} + +Sc::ElementSimInteraction* Sc::ElementSim::ElementInteractionIterator::getNext() +{ + while(mInteractions!=mInteractionsLast) + { + Interaction* it = *mInteractions++; + if(interactionHasElement(it, mElement)) + return static_cast(it); + } + return NULL; +} + +Sc::ElementSimInteraction* Sc::ElementSim::ElementInteractionReverseIterator::getNext() +{ + while(mInteractions!=mInteractionsLast) + { + Interaction* it = *--mInteractionsLast; + if(interactionHasElement(it, mElement)) + return static_cast(it); + } + return NULL; +} + +namespace +{ + class ElemSimPtrTableStorageManager : public Cm::PtrTableStorageManager, public PxUserAllocated + { + PX_NOCOPY(ElemSimPtrTableStorageManager) + + public: + ElemSimPtrTableStorageManager() {} + ~ElemSimPtrTableStorageManager() {} + + // PtrTableStorageManager + virtual void** allocate(PxU32 capacity) + { + return PX_ALLOCATE(void*, capacity, "CmPtrTable pointer array"); + } + + virtual void deallocate(void** addr, PxU32 /*capacity*/) + { + PX_FREE(addr); + } + + virtual bool canReuse(PxU32 /*originalCapacity*/, PxU32 /*newCapacity*/) + { + return false; + } + //~PtrTableStorageManager + }; + ElemSimPtrTableStorageManager gElemSimTableStorageManager; +} + +static PX_FORCE_INLINE void onElementAttach(ElementSim& element, ShapeManager& manager) +{ + PX_ASSERT(element.mShapeArrayIndex == 0xffffffff); + element.mShapeArrayIndex = manager.mShapes.getCount(); + manager.mShapes.add(&element, gElemSimTableStorageManager); +} + +void Sc::ShapeManager::onElementDetach(ElementSim& element) +{ + const PxU32 index = element.mShapeArrayIndex; + PX_ASSERT(index != 0xffffffff); + PX_ASSERT(mShapes.getCount()); + void** ptrs = mShapes.getPtrs(); + PX_ASSERT(reinterpret_cast(ptrs[index]) == &element); + + const PxU32 last = mShapes.getCount() - 1; + if (index != last) + { + ElementSim* moved = reinterpret_cast(ptrs[last]); + PX_ASSERT(moved->mShapeArrayIndex == last); + moved->mShapeArrayIndex = index; + } + mShapes.replaceWithLast(index, gElemSimTableStorageManager); + element.mShapeArrayIndex = 0xffffffff; +} + +Sc::ElementSim::ElementSim(ActorSim& actor) : + mActor (actor), + mInBroadPhase (false), + mShapeArrayIndex(0xffffffff) +{ + initID(); + + onElementAttach(*this, actor); +} + +Sc::ElementSim::~ElementSim() +{ + PX_ASSERT(!mInBroadPhase); + releaseID(); + mActor.onElementDetach(*this); +} + +void Sc::ElementSim::setElementInteractionsDirty(InteractionDirtyFlag::Enum flag, PxU8 interactionFlag) +{ + ElementSim::ElementInteractionIterator iter = getElemInteractions(); + ElementSimInteraction* interaction = iter.getNext(); + while(interaction) + { + if(interaction->readInteractionFlag(interactionFlag)) + interaction->setDirty(flag); + + interaction = iter.getNext(); + } +} + +void Sc::ElementSim::addToAABBMgr(PxReal contactDistance, Bp::FilterGroup::Enum group, Bp::ElementType::Enum type) +{ + Sc::Scene& scene = getScene(); + if(!scene.getAABBManager()->addBounds(mElementID, contactDistance, group, this, mActor.getActorCore().getAggregateID(), type)) + return; + + mInBroadPhase = true; +#if PX_ENABLE_SIM_STATS + scene.getStatsInternal().incBroadphaseAdds(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + +bool Sc::ElementSim::removeFromAABBMgr() +{ + PX_ASSERT(mInBroadPhase); + Sc::Scene& scene = getScene(); + bool res = scene.getAABBManager()->removeBounds(mElementID); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndReset(mElementID); + + mInBroadPhase = false; +#if PX_ENABLE_SIM_STATS + scene.getStatsInternal().incBroadphaseRemoves(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + return res; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.h new file mode 100644 index 0000000..39ce0c3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSim.h @@ -0,0 +1,132 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ELEMENT_SIM_H +#define SC_ELEMENT_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "PxFiltering.h" +#include "PxvConfig.h" +#include "ScActorSim.h" +#include "ScInteraction.h" +#include "BpAABBManager.h" +#include "ScObjectIDTracker.h" + +namespace physx +{ +namespace Sc +{ + class ElementSimInteraction; + + /* + A ElementSim is a part of a ActorSim. It contributes to the activation framework by adding its + interactions to the actor. */ + class ElementSim : public PxUserAllocated + { + PX_NOCOPY(ElementSim) + + public: + class ElementInteractionIterator + { + public: + PX_FORCE_INLINE ElementInteractionIterator(const ElementSim& e, PxU32 nbInteractions, Interaction** interactions) : + mInteractions(interactions), mInteractionsLast(interactions + nbInteractions), mElement(&e) {} + ElementSimInteraction* getNext(); + + private: + Interaction** mInteractions; + Interaction** mInteractionsLast; + const ElementSim* mElement; + }; + + class ElementInteractionReverseIterator + { + public: + PX_FORCE_INLINE ElementInteractionReverseIterator(const ElementSim& e, PxU32 nbInteractions, Interaction** interactions) : + mInteractions(interactions), mInteractionsLast(interactions + nbInteractions), mElement(&e) {} + ElementSimInteraction* getNext(); + + private: + Interaction** mInteractions; + Interaction** mInteractionsLast; + const ElementSim* mElement; + }; + + ElementSim(ActorSim& actor); + protected: + ~ElementSim(); + public: + + // Get an iterator to the interactions connected to the element + PX_FORCE_INLINE ElementInteractionIterator getElemInteractions() const { return ElementInteractionIterator(*this, mActor.getActorInteractionCount(), mActor.getActorInteractions()); } + PX_FORCE_INLINE ElementInteractionReverseIterator getElemInteractionsReverse() const { return ElementInteractionReverseIterator(*this, mActor.getActorInteractionCount(), mActor.getActorInteractions()); } + + PX_FORCE_INLINE ActorSim& getActor() const { return mActor; } + + PX_FORCE_INLINE Scene& getScene() const { return mActor.getScene(); } + + PX_FORCE_INLINE PxU32 getElementID() const { return mElementID; } + PX_FORCE_INLINE bool isInBroadPhase() const { return mInBroadPhase; } + + //PX_FORCE_INLINE Bp::ElementType::Enum getElementType() const { return mType; } + + void addToAABBMgr(PxReal contactDistance, Bp::FilterGroup::Enum group, Bp::ElementType::Enum type); + bool removeFromAABBMgr(); + + void setElementInteractionsDirty(InteractionDirtyFlag::Enum flag, PxU8 interactionFlag); + + PX_FORCE_INLINE void initID() + { + Scene& scene = getScene(); + mElementID = scene.getElementIDPool().createID(); + scene.getBoundsArray().initEntry(mElementID); + } + + PX_FORCE_INLINE void releaseID() + { + getScene().getElementIDPool().releaseID(mElementID); + } + protected: + ActorSim& mActor; + + PxU32 mElementID : 31; + PxU32 mInBroadPhase : 1; + //Bp::ElementType::Enum mType; + public: + PxU32 mShapeArrayIndex; + }; + + PX_FORCE_INLINE void setFilterObjectAttributeType(PxFilterObjectAttributes& attr, PxFilterObjectType::Enum type) + { + PX_ASSERT((attr & (PxFilterObjectType::eMAX_TYPE_COUNT-1)) == 0); + attr |= type; + } +} // namespace Sc +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSimInteraction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSimInteraction.h new file mode 100644 index 0000000..2edb190 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScElementSimInteraction.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_ELEMENT_SIM_INTERACTION_H +#define SC_ELEMENT_SIM_INTERACTION_H + +#include "ScInteraction.h" +#include "ScElementSim.h" + +namespace physx +{ +namespace Sc +{ + class ElementSimInteraction : public Interaction + { + public: + PX_FORCE_INLINE ElementSim& getElement0() const { return mElement0; } + PX_FORCE_INLINE ElementSim& getElement1() const { return mElement1; } + + PX_FORCE_INLINE void setFilterPairIndex(PxU32 filterPairIndex) { mFilterPairIndex = filterPairIndex; } + PX_FORCE_INLINE PxU32 getFilterPairIndex() const { return mFilterPairIndex; } + + protected: + PX_INLINE ElementSimInteraction(ElementSim& element0, ElementSim& element1, InteractionType::Enum type, PxU8 flags); + ~ElementSimInteraction() {} + + ElementSimInteraction& operator=(const ElementSimInteraction&); + + ElementSim& mElement0; + ElementSim& mElement1; + PxU32 mFilterPairIndex; + PxU32 mFlags; // PT: moved there in padding bytes, from ShapeInteraction + }; + +} // namespace Sc + +////////////////////////////////////////////////////////////////////////// + +PX_INLINE Sc::ElementSimInteraction::ElementSimInteraction(ElementSim& element0, ElementSim& element1, InteractionType::Enum type, PxU8 flags) : + Interaction (element0.getActor(), element1.getActor(), type, flags), + mElement0 (element0), + mElement1 (element1), + mFilterPairIndex(INVALID_FILTER_PAIR_INDEX) +{ +} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp new file mode 100644 index 0000000..337c1bc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothCore.cpp @@ -0,0 +1,306 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScFEMClothCore.h" + +#include "ScPhysics.h" +#include "ScFEMClothSim.h" +#include "DyFEMCloth.h" +#include "GuTetrahedronMesh.h" +#include "GuBV4.h" +#include "geometry/PxTetrahedronMesh.h" + +using namespace physx; + +Sc::FEMClothCore::FEMClothCore() : + ActorCore(PxActorType::eFEMCLOTH, PxActorFlag::eVISUALIZATION, PX_DEFAULT_CLIENT, 0), + mGpuMemStat(0) +{ + mCore.solverIterationCounts = (1 << 8) | 4; + mCore.dirty = true; +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + mCore.mFlags = PxFEMClothFlags(0); +#endif + + mCore.mClothPositionInvMass = NULL; + mCore.mClothVelocity = NULL; + mCore.mClothRestPosition = NULL; + mCore.wakeCounter = Physics::sWakeCounterOnCreation; +} + +Sc::FEMClothCore::~FEMClothCore() +{ + if (mCore.mClothPositionInvMass) + mCore.mClothPositionInvMass->release(); + + if (mCore.mClothVelocity) + mCore.mClothVelocity->release(); + + if (mCore.mClothRestPosition) + mCore.mClothRestPosition->release(); + +} + +PxFEMParameters Sc::FEMClothCore::getParameter() const +{ +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + return mCore.parameters; +#else + return PxFEMParameters(); +#endif +} + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +void Sc::FEMClothCore::setParameter(const PxFEMParameters& parameter) +{ + mCore.parameters = parameter; + mCore.dirty = true; +} +#else +void Sc::FEMClothCore::setParameter(const PxFEMParameters&) +{ + mCore.dirty = true; +} +#endif + +void Sc::FEMClothCore::addRigidFilter(Sc::BodyCore* core, PxU32 vertId) +{ + Sc::FEMClothSim* sim = getSim(); + + if (sim) + sim->getScene().addRigidFilter(core, *sim, vertId); + +} + +void Sc::FEMClothCore::removeRigidFilter(Sc::BodyCore* core, PxU32 vertId) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + sim->getScene().removeRigidFilter(core, *sim, vertId); +} + + +PxU32 Sc::FEMClothCore::addRigidAttachment(Sc::BodyCore* core, PxU32 particleId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* params) +{ + Sc::FEMClothSim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + { + handle = sim->getScene().addRigidAttachment(core, *sim, particleId, actorSpacePose, params); + + } + + return handle; +} + +void Sc::FEMClothCore::removeRigidAttachment(Sc::BodyCore* core, PxU32 handle) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + { + sim->getScene().removeRigidAttachment(core, *sim, handle); + setWakeCounter(ScInternalWakeCounterResetValue); + } +} + +void Sc::FEMClothCore::addTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx) +{ + Sc::FEMClothSim* sim = getSim(); + + if (sim) + sim->getScene().addTriRigidFilter(core, *sim, triIdx); + +} + +void Sc::FEMClothCore::removeTriRigidFilter(Sc::BodyCore* core, PxU32 triIdx) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + sim->getScene().removeTriRigidFilter(core, *sim, triIdx); +} + + +PxU32 Sc::FEMClothCore::addTriRigidAttachment(Sc::BodyCore* core, PxU32 triIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) +{ + Sc::FEMClothSim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addTriRigidAttachment(core, *sim, triIdx, barycentric, actorSpacePose, constraint); + + return handle; +} + +void Sc::FEMClothCore::removeTriRigidAttachment(Sc::BodyCore* core, PxU32 handle) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + { + sim->getScene().removeTriRigidAttachment(core, *sim, handle); + setWakeCounter(ScInternalWakeCounterResetValue); + } +} + +void Sc::FEMClothCore::addClothFilter(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx, PxU32 triIdx) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + sim->getScene().addClothFilter(*otherCore, otherTriIdx, *sim, triIdx); +} + +void Sc::FEMClothCore::removeClothFilter(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx, PxU32 triIdx) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + sim->getScene().removeClothFilter(*otherCore, otherTriIdx, *sim, triIdx); +} + +PxU32 Sc::FEMClothCore::addClothAttachment(Sc::FEMClothCore* otherCore, PxU32 otherTriIdx, const PxVec4& otherTriBarycentric, PxU32 triIdx, const PxVec4& triBarycentric) +{ + Sc::FEMClothSim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addTriClothAttachment(*otherCore, otherTriIdx, otherTriBarycentric, *sim, triIdx, triBarycentric); + + return handle; +} + +void Sc::FEMClothCore::removeClothAttachment(Sc::FEMClothCore* otherCore, PxU32 handle) +{ + Sc::FEMClothSim* sim = getSim(); + setWakeCounter(ScInternalWakeCounterResetValue); + otherCore->setWakeCounter(ScInternalWakeCounterResetValue); + if (sim) + sim->getScene().removeTriClothAttachment(*otherCore, *sim, handle); +} + +void Sc::FEMClothCore::setBendingScales(const PxReal* const bendingScales, PxU32 nbElements) +{ + mCore.mBendingScales.assign(bendingScales, bendingScales + nbElements); + mCore.dirty = true; +} + +const PxReal* Sc::FEMClothCore::getBendingScales() const +{ + return mCore.mBendingScales.empty() ? NULL : mCore.mBendingScales.begin(); +} + +void Sc::FEMClothCore::setSolverIterationCounts(const PxU16 c) +{ + mCore.solverIterationCounts = c; + mCore.dirty = true; +} + +PxActor* Sc::FEMClothCore::getPxActor() const +{ + return PxPointerOffset(const_cast(this), gOffsetTable.scCore2PxActor[getActorCoreType()]); +} + +void Sc::FEMClothCore::attachShapeCore(ShapeCore* shapeCore) +{ + Sc::FEMClothSim* sim = getSim(); + if (sim) + sim->attachShapeCore(shapeCore); +} + +PxReal Sc::FEMClothCore::getWakeCounter() const +{ + return mCore.wakeCounter; +} + +void Sc::FEMClothCore::setWakeCounter(const PxReal v) +{ + mCore.wakeCounter = v; + mCore.dirty = true; + + Sc::FEMClothSim* sim = getSim(); + if (sim) + { + sim->onSetWakeCounter(); + } + +} + +void Sc::FEMClothCore::setWakeCounterInternal(const PxReal v) +{ + mCore.wakeCounter = v; + mCore.dirty = true; + + Sc::FEMClothSim* sim = getSim(); + if (sim) + { + sim->onSetWakeCounter(); + } +} + + +Sc::FEMClothSim* Sc::FEMClothCore::getSim() const +{ + return static_cast(ActorCore::getSim()); +} + +void Sc::FEMClothCore::setSimulationFilterData(const PxFilterData& data) +{ + mFilterData = data; +} + +PxFilterData Sc::FEMClothCore::getSimulationFilterData() const +{ + return mFilterData; +} + + +void Sc::FEMClothCore::onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags) +{ + PX_UNUSED(shape); + FEMClothSim* sim = getSim(); + if (!sim) + return; + FEMClothShapeSim& s = sim->getShapeSim(); + + if (notifyFlags & ShapeChangeNotifyFlag::eGEOMETRY) + s.onVolumeOrTransformChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eMATERIAL) + s.onMaterialChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eRESET_FILTERING) + s.onResetFiltering(); + if (notifyFlags & ShapeChangeNotifyFlag::eSHAPE2BODY) + s.onVolumeOrTransformChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eFILTERDATA) + s.onFilterDataChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eCONTACTOFFSET) + s.onContactOffsetChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eRESTOFFSET) + s.onRestOffsetChange(); +} + +#endif //PX_SUPPORT_GPU_PHYSX + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp new file mode 100644 index 0000000..d088126 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.cpp @@ -0,0 +1,167 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScFEMClothShapeSim.h" + +#include "ScNPhaseCore.h" +#include "ScScene.h" + +#include "ScFEMClothSim.h" +#include "PxsContext.h" +#include "BpAABBManager.h" +#include "ScSqBoundsManager.h" +#include "geometry/PxTetrahedronMesh.h" +#include "geometry/PxTriangleMesh.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::FEMClothShapeSim::FEMClothShapeSim(FEMClothSim& FEMCloth) : + ShapeSimBase(FEMCloth, NULL), + initialTransform(PxVec3(0, 0, 0)), + initialScale(1.0f) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::FEMClothShapeSim::~FEMClothShapeSim() +{ + if (isInBroadPhase()) + destroyLowLevelVolume(); + + PX_ASSERT(!isInBroadPhase()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void Sc::FEMClothShapeSim::attachShapeCore(const Sc::ShapeCore* shapeCore) +{ + setCore(shapeCore); + createLowLevelVolume(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::FEMClothShapeSim::getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const +{ + filterAttr = 0; + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eFEMCLOTH); + filterData = getBodySim().getCore().getSimulationFilterData(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::FEMClothShapeSim::updateBounds() +{ + Scene& scene = getScene(); + + PxBounds3 worldBounds = getWorldBounds(); + worldBounds.fattenSafe(getContactOffset()); // fatten for fast moving colliders + scene.getBoundsArray().setBounds(worldBounds, getElementID()); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); +} + +void Sc::FEMClothShapeSim::updateBoundsInAABBMgr() +{ + Scene& scene = getScene(); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); + scene.getAABBManager()->setGPUStateChanged(); +} + +PxBounds3 Sc::FEMClothShapeSim::getBounds() const +{ + PxBounds3 bounds = getScene().getBoundsArray().getBounds(getElementID()); + return bounds; + +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::FEMClothShapeSim::createLowLevelVolume() +{ + PX_ASSERT(getWorldBounds().isFinite()); + + const PxU32 index = getElementID(); + + getScene().getBoundsArray().setBounds(getWorldBounds(), index); + + { + const PxU32 group = Bp::FilterGroup::eDYNAMICS_BASE + getActor().getActorID(); + const PxU32 type = Bp::FilterType::FEMCLOTH; + addToAABBMgr(getCore().getContactOffset(), Bp::FilterGroup::Enum((group << BP_FILTERING_TYPE_SHIFT_BIT) | type), Bp::ElementType::eSHAPE); + } + + // PT: TODO: what's the difference between "getContactOffset()" and "getCore().getContactOffset()" above? + getScene().updateContactDistance(index, getContactOffset()); + + PxsTransformCache& cache = getScene().getLowLevelContext()->getTransformCache(); + cache.initEntry(index); + + PxTransform idt(PxIdentity); + + cache.setTransformCache(idt, 0, index); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::FEMClothShapeSim::destroyLowLevelVolume() +{ + if (!isInBroadPhase()) + return; + + Sc::Scene& scene = getScene(); + PxsContactManagerOutputIterator outputs = scene.getLowLevelContext()->getNphaseImplementationContext()->getContactManagerOutputs(); + scene.getNPhaseCore()->onVolumeRemoved(this, 0, outputs); + removeFromAABBMgr(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +PxBounds3 Sc::FEMClothShapeSim::getWorldBounds() const +{ + const PxTriangleMeshGeometry& triGeom = static_cast(getCore().getGeometry()); + PxTriangleMesh* triMesh = triGeom.triangleMesh; + + // PT: are you sure you want to go through the Px API here? + PxBounds3 bounds = triMesh->getLocalBounds(); + + bounds.minimum *= initialScale; + bounds.maximum *= initialScale; + bounds = PxBounds3::transformFast(initialTransform, bounds); + + return bounds; +} + +Sc::FEMClothSim& Sc::FEMClothShapeSim::getBodySim() const +{ + return static_cast(getActor()); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.h new file mode 100644 index 0000000..2355372 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothShapeSim.h @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PHYSICS_FEMCLOTH_SHAPE_SIM +#define PX_PHYSICS_FEMCLOTH_SHAPE_SIM + +#include "PxPhysXConfig.h" + +#include "ScElementSim.h" +#include "ScShapeSimBase.h" + + +namespace physx +{ + namespace Sc + { + class FEMClothSim; + + class FEMClothShapeSim : public ShapeSimBase + { + PxTransform initialTransform; + PxReal initialScale; + + FEMClothShapeSim& operator=(const FEMClothShapeSim &); + + public: + FEMClothShapeSim(FEMClothSim& FEMCloth); + virtual ~FEMClothShapeSim(); + + PX_FORCE_INLINE void setInitialTransform(const PxTransform& transform, PxReal scale) + { + initialTransform = transform; + initialScale = scale; + //The base class constructor ensures that getElementID() points to a valid entry in the bounds array + getScene().getBoundsArray().setBounds(getWorldBounds(), getElementID()); + } + + void attachShapeCore(const ShapeCore* core); + // ElementSim implementation + virtual void getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const; + // ~ElementSim + + PxBounds3 getWorldBounds() const; + + //PX_FORCE_INLINE FEMClothSim& getBodySim() const { return static_cast(getActor()); } + FEMClothSim& getBodySim() const; + + void updateBounds(); + void updateBoundsInAABBMgr(); + + PxBounds3 getBounds() const; + + void createLowLevelVolume(); + void destroyLowLevelVolume(); + }; + } // namespace Sc +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp new file mode 100644 index 0000000..eff0c83 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.cpp @@ -0,0 +1,134 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScFEMClothSim.h" +#include "ScFEMClothCore.h" +#include "ScScene.h" + +#include "ScInteraction.h" // to be deleted +#include "PxsSimulationController.h" + +using namespace physx; +using namespace physx::Dy; + + +Sc::FEMClothSim::FEMClothSim(FEMClothCore& core, Scene& scene) : + ActorSim(scene, core), + mShapeSim(*this), + mNumCountedInteractions(0) +{ + mLLFEMCloth = scene.createLLFEMCloth(this); + + mNodeIndex = scene.getSimpleIslandManager()->addFEMCloth(mLLFEMCloth, false); + + scene.getSimpleIslandManager()->activateNode(mNodeIndex); + + mLLFEMCloth->setElementId(mShapeSim.getElementID()); +} + +Sc::FEMClothSim::~FEMClothSim() +{ + if (!mLLFEMCloth) + return; + + mScene.destroyLLFEMCloth(*mLLFEMCloth); + + mScene.getSimpleIslandManager()->removeNode(mNodeIndex); + + mCore.setSim(NULL); +} + +void Sc::FEMClothSim::updateBounds() +{ + mShapeSim.updateBounds(); +} + +void Sc::FEMClothSim::updateBoundsInAABBMgr() +{ + mShapeSim.updateBoundsInAABBMgr(); +} + +PxBounds3 Sc::FEMClothSim::getBounds() const +{ + return mShapeSim.getBounds(); +} + +bool Sc::FEMClothSim::isSleeping() const +{ + IG::IslandSim& sim = mScene.getSimpleIslandManager()->getAccurateIslandSim(); + return sim.getActiveNodeIndex(mNodeIndex) == PX_INVALID_NODE; +} + +void Sc::FEMClothSim::setActive(const bool b, const PxU32 infoFlag) +{ + PX_UNUSED(infoFlag); + if (b) + { + activate(); + } + else + { + deactivate(); + } +} + +void Sc::FEMClothSim::onSetWakeCounter() +{ + getScene().getSimulationController()->setClothWakeCounter(mLLFEMCloth); + if (mLLFEMCloth->getCore().wakeCounter > 0.f) + getScene().getSimpleIslandManager()->activateNode(mNodeIndex); + else + getScene().getSimpleIslandManager()->deactivateNode(mNodeIndex); +} + +void Sc::FEMClothSim::attachShapeCore(ShapeCore* core) +{ + mShapeSim.attachShapeCore(core); + + PxsShapeCore* shapeCore = const_cast(&core->getCore()); + mLLFEMCloth->setShapeCore(shapeCore); +} + + +void Sc::FEMClothSim::activate() +{ + mScene.getSimulationController()->activateCloth(mLLFEMCloth); + + activateInteractions(*this); +} + +void Sc::FEMClothSim::deactivate() +{ + mScene.getSimulationController()->deactivateCloth(mLLFEMCloth); + + deactivateInteractions(*this); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.h new file mode 100644 index 0000000..c9636b1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScFEMClothSim.h @@ -0,0 +1,89 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef PX_PHYSICS_FEMCLOTH_SIM +#define PX_PHYSICS_FEMCLOTH_SIM + +#include "foundation/PxUserAllocated.h" +#include "DyFEMCloth.h" +#include "ScFEMClothCore.h" +#include "ScFEMClothShapeSim.h" +#include "ScActorSim.h" // to be deleted + +namespace physx +{ + namespace Sc + { + class Scene; + class FEMClothSim : public ActorSim + { + public: + FEMClothSim(FEMClothCore& core, Scene& scene); + + ~FEMClothSim(); + + PX_INLINE Dy::FEMCloth* getLowLevelFEMCloth() const { return mLLFEMCloth; } + PX_INLINE FEMClothCore& getCore() const { return static_cast(mCore); } + virtual PxActor* getPxActor() const { return getCore().getPxActor(); } + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + bool isSleeping() const; + PX_FORCE_INLINE bool isActive() const { return !isSleeping(); } + + void setActive(const bool b, const PxU32 infoFlag = 0); + + void onSetWakeCounter(); + + void attachShapeCore(ShapeCore* core); + + virtual void registerCountedInteraction() { mNumCountedInteractions++; } + virtual void unregisterCountedInteraction() { mNumCountedInteractions--; } + virtual PxU32 getNumCountedInteractions() const { return mNumCountedInteractions; } + + virtual void activate(); + virtual void deactivate(); + + FEMClothShapeSim& getShapeSim() { return mShapeSim; } + + private: + //FEMClothSim& operator=(const FEMClothSim&); + + Dy::FEMCloth* mLLFEMCloth; + + FEMClothShapeSim mShapeSim; + + PxU32 mNumCountedInteractions; + PxU32 mIslandNodeIndex; + + }; + + } // namespace Sc +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp new file mode 100644 index 0000000..6217b1a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemCore.cpp @@ -0,0 +1,154 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScHairSystemCore.h" +#include "ScHairSystemSim.h" +#include "ScPhysics.h" +#include "DyHairSystem.h" + +namespace physx +{ + namespace Sc + { + HairSystemCore::HairSystemCore() : + ActorCore(PxActorType::eHAIRSYSTEM, PxActorFlag::eVISUALIZATION, PX_DEFAULT_CLIENT, 0) + { + } + + HairSystemCore::~HairSystemCore() + { + } + + void HairSystemCore::setMaterial(const PxU16 handle) + { + mShapeCore.getLLCore().setMaterial(handle); + } + + void HairSystemCore::clearMaterials() + { + mShapeCore.getLLCore().clearMaterials(); + } + + void HairSystemCore::setSleepThreshold(const PxReal v) + { + mShapeCore.getLLCore().mSleepThreshold = v; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void HairSystemCore::setSolverIterationCounts(const PxU16 c) + { + mShapeCore.getLLCore().mSolverIterationCounts = c; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void HairSystemCore::setWakeCounter(const PxReal v) + { + mShapeCore.getLLCore().mWakeCounter = v; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + + HairSystemSim* sim = getSim(); + if (sim) + { + sim->onSetWakeCounter(); + } + } + + bool HairSystemCore::isSleeping() const + { + HairSystemSim* sim = getSim(); + return sim ? sim->isSleeping() : (mShapeCore.getLLCore().mWakeCounter == 0.0f); + } + + void HairSystemCore::wakeUp(PxReal wakeCounter) + { + mShapeCore.getLLCore().mWakeCounter = wakeCounter; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + void HairSystemCore::putToSleep() + { + mShapeCore.getLLCore().mWakeCounter = 0.0f; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + PxActor* HairSystemCore::getPxActor() const + { + return PxPointerOffset(const_cast(this), gOffsetTable.scCore2PxActor[getActorCoreType()]); + } + + HairSystemSim* HairSystemCore::getSim() const + { + return static_cast(ActorCore::getSim()); + } + + PxReal Sc::HairSystemCore::getContactOffset() const + { + return mShapeCore.getContactOffset(); + } + + void Sc::HairSystemCore::setContactOffset(PxReal v) + { + mShapeCore.setContactOffset(v); + Sc::HairSystemSim* sim = getSim(); + if (sim) + { + sim->getScene().updateContactDistance(sim->getShapeSim().getElementID(), v); + } + } + + void Sc::HairSystemCore::addRigidAttachment(const Sc::BodyCore* core) + { + const Sc::HairSystemSim* sim = getSim(); + if (sim) + { + sim->getScene().addRigidAttachment(core, *sim); + } + } + + void Sc::HairSystemCore::removeRigidAttachment(const Sc::BodyCore* core) + { + const Sc::HairSystemSim* sim = getSim(); + if (sim) + { + sim->getScene().removeRigidAttachment(core, *sim); + } + } + + void Sc::HairSystemCore::setFlags(PxHairSystemFlags flags) + { + mShapeCore.getLLCore().mParams.mFlags = flags; + mShapeCore.getLLCore().mDirtyFlags |= Dy::HairSystemDirtyFlag::ePARAMETERS; + } + + + } // namespace Sc +} // namespace physx + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp new file mode 100644 index 0000000..9457dc5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.cpp @@ -0,0 +1,145 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "foundation/PxErrorCallback.h" +#include "ScHairSystemShapeCore.h" +#include "ScHairSystemShapeSim.h" +#include "ScPhysics.h" +#include "PxvGlobals.h" +#include "PxPhysXGpu.h" + +using namespace physx; +using namespace Sc; + +namespace physx +{ +namespace Sc +{ + + HairSystemShapeCore::HairSystemShapeCore() + : ShapeCore(PxEmpty) + , mGpuMemStat(0) + { + mSimulationFilterData = PxFilterData(); + + mCore = PxsShapeCore(); + + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + mCore.setTransform(PxTransform(PxIdentity)); + mCore.mContactOffset = 0.0f; + mCore.mShapeFlags = 0; + + mCore.mMinTorsionalPatchRadius = 0.f; + mCore.mTorsionalRadius = 0.f; + + mLLCore.mSleepThreshold = 5e-5f * scale.speed * scale.speed; + mLLCore.mWakeCounter = Physics::sWakeCounterOnCreation; + mLLCore.mSolverIterationCounts = 8; + mLLCore.mDirtyFlags = PX_MAX_U32; + mLLCore.mParams.mFlags = PxHairSystemFlags(0); + + // parameters + mLLCore.mParams.mShapeCompliance = PxVec2(-1.0f); + + mLLCore.mNumVertices = 0; + mLLCore.mNumStrands = 0; + + // must be powers of two + mLLCore.mParams.mGridSize[0] = 32; + mLLCore.mParams.mGridSize[1] = 64; + mLLCore.mParams.mGridSize[2] = 32; + + mLLCore.mParams.mSegmentLength = 0.1f; + mLLCore.mParams.mSegmentRadius = 0.02f; + + mLLCore.mParams.mInterHairRepulsion = 0.0f; + mLLCore.mParams.mInterHairVelocityDamping = 0.03f; + mLLCore.mParams.mFrictionCoeff = 0.0f; + mLLCore.mParams.mBendingCompliance = -1.0f; + mLLCore.mParams.mTwistingCompliance = -1.0f; + mLLCore.mParams.mSelfCollisionContactDist = 1.5f; + mLLCore.mParams.mSelfCollisionRelaxation = 0.7f; + mLLCore.mParams.mLraRelaxation = 1.0f; + mLLCore.mParams.mShapeMatchingCompliance = -1.0f; + mLLCore.mParams.mShapeMatchingBeta = 0.0f; + mLLCore.mParams.mShapeMatchingNumVertsPerGroup = 10; + mLLCore.mParams.mShapeMatchingNumVertsOverlap = 5; + + mLLCore.mBendingRestAngles = NULL; + + mLLCore.mWind = PxVec4(0.0f); + + mLLCore.mPositionInvMass = NULL; + mLLCore.mVelocity = NULL; + + mLLCore.mStrandPastEndIndicesGpuSim = NULL; + mLLCore.mPositionInvMassGpuSim = NULL; + mLLCore.mTwistingRestPositionsGpuSim = NULL; + mLLCore.mRestPositions = NULL; + mLLCore.mRestPositionsTransform = NULL; + mLLCore.mRestPositionBodyNodeIdx = PxNodeIndex().getInd(); + + mLLCore.mRigidAttachments = NULL; + mLLCore.mNumRigidAttachments = 0; + + mLLCore.mLodLevel = 0; + mLLCore.mLodNumLevels = 0; + mLLCore.mLodProportionOfStrands = NULL; + mLLCore.mLodProportionOfVertices = NULL; +} + +// PX_SERIALIZATION +HairSystemShapeCore::HairSystemShapeCore(const PxEMPTY) + : ShapeCore(PxEmpty) +{ +} + +HairSystemShapeCore::~HairSystemShapeCore() +{ + releaseBuffers(); +} + +void HairSystemShapeCore::createBuffers(PxCudaContextManager* cudaContextManager) +{ + mCudaContextManager = cudaContextManager; + + // nothing else to do at the moment +} + +void HairSystemShapeCore::releaseBuffers() +{ + // nothing to do at the moment +} + +} // namespace Sc +} // namespace physx + +#endif // PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.h new file mode 100644 index 0000000..02e7041 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeCore.h @@ -0,0 +1,75 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_HAIRSYSTEM_SHAPECORE_H +#define SC_HAIRSYSTEM_SHAPECORE_H + +#include "foundation/PxUserAllocated.h" +#include "DyHairSystemCore.h" +#include "ScShapeCore.h" +#include "PxShape.h" + +namespace physx +{ + class PxCudaContextManager; + + namespace Sc + { + + class HairSystemShapeCore : public Sc::ShapeCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + HairSystemShapeCore(const PxEMPTY); + //~PX_SERIALIZATION + + HairSystemShapeCore(); + ~HairSystemShapeCore(); + + PX_FORCE_INLINE const Dy::HairSystemCore& getLLCore() const { return mLLCore; } + PX_FORCE_INLINE Dy::HairSystemCore& getLLCore() { return mLLCore; } + + void createBuffers(PxCudaContextManager* cudaContextManager); + void releaseBuffers(); + + PxU64& getGpuMemStat() { return mGpuMemStat; } + + private: + Dy::HairSystemCore mLLCore; + PxU64 mGpuMemStat; + PxCudaContextManager* mCudaContextManager; + }; + + } // namespace Sc +} // namespace physx + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp new file mode 100644 index 0000000..feb8964 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.cpp @@ -0,0 +1,144 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScHairSystemShapeSim.h" +#include "ScNPhaseCore.h" +#include "ScHairSystemSim.h" +#include "PxsContext.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::HairSystemShapeSim::HairSystemShapeSim(HairSystemSim& hairSystemSim, const HairSystemShapeCore* core) : + ShapeSimBase(hairSystemSim, core) +{ + createLowLevelVolume(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::HairSystemShapeSim::~HairSystemShapeSim() +{ + if (isInBroadPhase()) + destroyLowLevelVolume(); + + PX_ASSERT(!isInBroadPhase()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::HairSystemShapeSim::getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const +{ + filterAttr = 0; + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eHAIRSYSTEM); + filterData = getBodySim().getCore().getShapeCore().getSimulationFilterData(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::HairSystemShapeSim::updateBounds() +{ + Scene& scene = getScene(); + + PxBounds3 worldBounds = PxBounds3(PxVec3(0.f), PxVec3(0.f)); + const PxReal contactOffset = getBodySim().getCore().getContactOffset(); + worldBounds.fattenSafe(contactOffset); // fatten for fast moving colliders + scene.getBoundsArray().setBounds(worldBounds, getElementID()); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::HairSystemShapeSim::updateBoundsInAABBMgr() +{ + //we are updating the bound in GPU so we just need to set the actor handle in CPU to make sure + //the GPU BP will process the vertices + Scene& scene = getScene(); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); + scene.getAABBManager()->setGPUStateChanged(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxBounds3 Sc::HairSystemShapeSim::getBounds() const +{ + PxBounds3 bounds = getScene().getBoundsArray().getBounds(getElementID()); + return bounds; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::HairSystemShapeSim::createLowLevelVolume() +{ + // PX_ASSERT(getWorldBounds().isFinite()); + + const PxU32 index = getElementID(); + + getScene().getBoundsArray().setBounds(PxBounds3(PxVec3(0.f), PxVec3(0.f)), index); + + { + const PxU32 group = Bp::FilterGroup::eDYNAMICS_BASE + getActor().getActorID(); + const PxU32 type = Bp::FilterType::HAIRSYSTEM; + addToAABBMgr(getCore().getContactOffset(), Bp::FilterGroup::Enum((group << BP_FILTERING_TYPE_SHIFT_BIT) | type), Bp::ElementType::eSHAPE); + } + + // PT: TODO: what's the difference between "getContactOffset()" and "getCore().getContactOffset()" above? + getScene().updateContactDistance(index, getContactOffset()); + + PxsTransformCache& cache = getScene().getLowLevelContext()->getTransformCache(); + cache.initEntry(index); + + PxTransform idt(PxIdentity); + + cache.setTransformCache(idt, 0, index); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::HairSystemShapeSim::destroyLowLevelVolume() +{ + if (!isInBroadPhase()) + return; + + Sc::Scene& scene = getScene(); + PxsContactManagerOutputIterator outputs = scene.getLowLevelContext()->getNphaseImplementationContext()->getContactManagerOutputs(); + scene.getNPhaseCore()->onVolumeRemoved(this, 0, outputs); + removeFromAABBMgr(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::HairSystemSim& Sc::HairSystemShapeSim::getBodySim() const +{ + return static_cast(getActor()); +} + +#endif // PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.h new file mode 100644 index 0000000..9577ba2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemShapeSim.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_HAIRSYSTEM_SHAPE_SIM_H +#define SC_HAIRSYSTEM_SHAPE_SIM_H + +#include "PxPhysXConfig.h" +#include "ScElementSim.h" +#include "ScShapeSimBase.h" + + +namespace physx +{ + namespace Sc + { + class HairSystemSim; + class HairSystemShapeCore; + + /** + A collision detection primitive for the hair system. + */ + class HairSystemShapeSim : public ShapeSimBase + { + HairSystemShapeSim& operator=(const HairSystemShapeSim &); + public: + HairSystemShapeSim(HairSystemSim& hairSystem, const HairSystemShapeCore* core); + virtual ~HairSystemShapeSim(); + + // ElementSim implementation + virtual void getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const; + // ~ElementSim + + HairSystemSim& getBodySim() const; + + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + void createLowLevelVolume(); + void destroyLowLevelVolume(); + + }; + + } // namespace Sc + +} + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp new file mode 100644 index 0000000..7625405 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.cpp @@ -0,0 +1,126 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScHairSystemSim.h" +#include "ScHairSystemCore.h" +#include "ScHairSystemShapeCore.h" +#include "ScScene.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace physx::Dy; + +Sc::HairSystemSim::HairSystemSim(HairSystemCore& core, Scene& scene) : + ActorSim(scene, core), + mShapeSim(*this, &core.getShapeCore()), + mNumCountedInteractions(0) +{ + mLLHairSystem = scene.createLLHairSystem(this); + + mNodeIndex = scene.getSimpleIslandManager()->addHairSystem(mLLHairSystem, false); + scene.getSimpleIslandManager()->activateNode(mNodeIndex); + + mLLHairSystem->setElementId(mShapeSim.getElementID()); + + PxHairSystemGeometry geometry; + core.getShapeCore().setGeometry(geometry); + PxsShapeCore* shapeCore = const_cast(&core.getShapeCore().getCore()); + mLLHairSystem->setShapeCore(shapeCore); +} + +Sc::HairSystemSim::~HairSystemSim() +{ + if (!mLLHairSystem) { + return; + } + + mScene.destroyLLHairSystem(*mLLHairSystem); + mScene.getSimpleIslandManager()->removeNode(mNodeIndex); + mCore.setSim(NULL); +} + +void Sc::HairSystemSim::updateBounds() +{ + mShapeSim.updateBounds(); +} + +void Sc::HairSystemSim::updateBoundsInAABBMgr() +{ + mShapeSim.updateBoundsInAABBMgr(); +} + +PxBounds3 Sc::HairSystemSim::getBounds() const +{ + return mShapeSim.getBounds(); +} + + +bool Sc::HairSystemSim::isSleeping() const +{ + IG::IslandSim& sim = mScene.getSimpleIslandManager()->getAccurateIslandSim(); + return sim.getActiveNodeIndex(mNodeIndex) == PX_INVALID_NODE; +} + +void Sc::HairSystemSim::setActive(const bool b, const PxU32 /*infoFlag*/) +{ + if (b) + { + getScene().getSimulationController()->activateHairSystem(mLLHairSystem); + } + else + { + getScene().getSimulationController()->deactivateHairSystem(mLLHairSystem); + } +} + +void Sc::HairSystemSim::onSetWakeCounter() +{ + getScene().getSimulationController()->setHairSystemWakeCounter(mLLHairSystem); + if (mLLHairSystem->getCore().mWakeCounter > 0.0f) { + getScene().getSimpleIslandManager()->activateNode(mNodeIndex); + } + else + { + getScene().getSimpleIslandManager()->deactivateNode(mNodeIndex); + } +} + +void Sc::HairSystemSim::activate() +{ + activateInteractions(*this); +} + +void Sc::HairSystemSim::deactivate() +{ + deactivateInteractions(*this); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.h new file mode 100644 index 0000000..98301fb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScHairSystemSim.h @@ -0,0 +1,84 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_HAIR_SYSTEM_SIM_H +#define SC_HAIR_SYSTEM_SIM_H + +#include "DyHairSystem.h" +#include "ScHairSystemCore.h" +#include "ScHairSystemShapeSim.h" +#include "ScActorSim.h" + +namespace physx +{ + namespace Sc + { + class Scene; + + class HairSystemSim : public ActorSim + { + public: + HairSystemSim(HairSystemCore& core, Scene& scene); + ~HairSystemSim(); + + PX_INLINE Dy::HairSystem* getLowLevelHairSystem() const { return mLLHairSystem; } + PX_INLINE HairSystemCore& getCore() const { return static_cast(mCore); } + + virtual PxActor* getPxActor() const { return getCore().getPxActor(); } + + PxBounds3 getBounds() const; + void updateBounds(); + void updateBoundsInAABBMgr(); + + bool isSleeping() const; + bool isActive() const { return !isSleeping(); } + + void setActive(const bool b, const PxU32 infoFlag = 0); + + void onSetWakeCounter(); + + virtual void registerCountedInteraction() { mNumCountedInteractions++; } + virtual void unregisterCountedInteraction() { mNumCountedInteractions--; } + virtual PxU32 getNumCountedInteractions() const { return mNumCountedInteractions; } + + virtual void activate(); + virtual void deactivate(); + + HairSystemShapeSim& getShapeSim() { return mShapeSim; } + + private: + //HairSystemSim& operator=(const HairSystemSim&); + + Dy::HairSystem* mLLHairSystem; + HairSystemShapeSim mShapeSim; + + PxU32 mNumCountedInteractions; + }; + } // namespace Sc +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp new file mode 100644 index 0000000..caa138d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.cpp @@ -0,0 +1,70 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/Px.h" + +#include "ScInteraction.h" +#include "ScNPhaseCore.h" + +using namespace physx; + +Sc::Interaction::Interaction(ActorSim& actor0, ActorSim& actor1, InteractionType::Enum type, PxU8 flags) : + mActor0 (actor0), + mActor1 (actor1), + mSceneId (PX_INVALID_INTERACTION_SCENE_ID), + mActorId0 (PX_INVALID_INTERACTION_ACTOR_ID), + mActorId1 (PX_INVALID_INTERACTION_ACTOR_ID), + mInteractionType (PxTo8(type)), + mInteractionFlags (flags), + mDirtyFlags (0) +{ + PX_ASSERT_WITH_MESSAGE(&actor0.getScene() == &actor1.getScene(),"Cannot create an interaction between actors belonging to different scenes."); + PX_ASSERT(PxU32(type)<256); // PT: type is now stored on a byte +} + +void Sc::Interaction::addToDirtyList() +{ + getActorSim0().getScene().getNPhaseCore()->addToDirtyInteractionList(this); +} + +void Sc::Interaction::removeFromDirtyList() +{ + getActorSim0().getScene().getNPhaseCore()->removeFromDirtyInteractionList(this); +} + +void Sc::Interaction::setClean(bool removeFromList) +{ + if (readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)) + { + if (removeFromList) // if we process all dirty interactions anyway, then we can just clear the list at the end and save the work here. + removeFromDirtyList(); + clearInteractionFlag(InteractionFlag::eIN_DIRTY_LIST); + } + + mDirtyFlags = 0; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.h new file mode 100644 index 0000000..27a3165 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteraction.h @@ -0,0 +1,207 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_INTERACTION_H +#define SC_INTERACTION_H + +#include "foundation/Px.h" +#include "ScInteractionFlags.h" +#include "ScScene.h" +#include "ScActorSim.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxUtilities.h" + +namespace physx +{ +#define PX_INVALID_INTERACTION_ACTOR_ID 0xffffffff +#define PX_INVALID_INTERACTION_SCENE_ID 0xffffffff + +namespace Sc +{ + // Interactions are used for connecting actors into activation groups. An interaction always connects exactly two actors. + // An interaction is implicitly active if at least one of the two actors it connects is active. + + class Interaction : public PxUserAllocated + { + PX_NOCOPY(Interaction) + + protected: + Interaction(ActorSim& actor0, ActorSim& actor1, InteractionType::Enum interactionType, PxU8 flags); + ~Interaction() { PX_ASSERT(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)); } + public: + // Interactions automatically register themselves in the actors here + PX_FORCE_INLINE bool registerInActors(void* data = NULL); + + // Interactions automatically unregister themselves from the actors here + PX_FORCE_INLINE void unregisterFromActors(); + + PX_FORCE_INLINE ActorSim& getActorSim0() const { return mActor0; } + PX_FORCE_INLINE ActorSim& getActorSim1() const { return mActor1; } + + PX_FORCE_INLINE Scene& getScene() const { return mActor0.getScene(); } + + PX_FORCE_INLINE InteractionType::Enum getType() const { return InteractionType::Enum(mInteractionType); } + + PX_FORCE_INLINE PxU8 readInteractionFlag(PxU8 flag) const { return PxU8(mInteractionFlags & flag); } + PX_FORCE_INLINE void raiseInteractionFlag(InteractionFlag::Enum flag) { mInteractionFlags |= flag; } + PX_FORCE_INLINE void clearInteractionFlag(InteractionFlag::Enum flag) { mInteractionFlags &= ~flag; } + + /** + \brief Mark the interaction as dirty. This will put the interaction into a list that is processed once per simulation step. + + @see InteractionDirtyFlag + */ + PX_FORCE_INLINE void setDirty(PxU32 dirtyFlags); + + /** + \brief Clear all flags that mark the interaction as dirty and optionally remove the interaction from the list of dirty interactions. + + @see InteractionDirtyFlag + */ + /*PX_FORCE_INLINE*/ void setClean(bool removeFromList); + + PX_FORCE_INLINE PxIntBool needsRefiltering() const { return (getDirtyFlags() & InteractionDirtyFlag::eFILTER_STATE); } + + PX_FORCE_INLINE PxIntBool isElementInteraction() const; + + // Called when an interaction is activated or created. + // Return true if activation should proceed else return false (for example: joint interaction between two kinematics should not get activated) +// virtual bool onActivate_(void* data) = 0; + + // Called when an interaction is deactivated. + // Return true if deactivation should proceed else return false (for example: joint interaction between two kinematics can ignore deactivation because it always is deactivated) +// virtual bool onDeactivate_() = 0; + + PX_FORCE_INLINE void setInteractionId(PxU32 id) { mSceneId = id; } + PX_FORCE_INLINE PxU32 getInteractionId() const { return mSceneId; } + PX_FORCE_INLINE bool isRegistered() const { return mSceneId != PX_INVALID_INTERACTION_SCENE_ID; } + + PX_FORCE_INLINE void setActorId(ActorSim* actor, PxU32 id); + PX_FORCE_INLINE PxU32 getActorId(const ActorSim* actor) const; + + PX_FORCE_INLINE PxU8 getDirtyFlags() const { return mDirtyFlags; } + + private: + void addToDirtyList(); + void removeFromDirtyList(); + + ActorSim& mActor0; + ActorSim& mActor1; + + // PT: TODO: merge the 6bits of the 3 PxU8s in the top bits of the 3 PxU32s + PxU32 mSceneId; // PT: TODO: merge this with mInteractionType + + // PT: TODO: are those IDs even worth caching? Since the number of interactions per actor is (or should be) small, + // we could just do a linear search and save memory here... + PxU32 mActorId0; // PT: id of this interaction within mActor0's mInteractions array + PxU32 mActorId1; // PT: id of this interaction within mActor1's mInteractions array + protected: + const PxU8 mInteractionType; // PT: stored on a byte to save space, should be InteractionType enum, 5/6 bits needed here + PxU8 mInteractionFlags; // PT: 6 bits needed here, see InteractionFlag enum + PxU8 mDirtyFlags; // PT: 6 bits needed here, see InteractionDirtyFlag enum + PxU8 mPadding8; + }; + +} // namespace Sc + +////////////////////////////////////////////////////////////////////////// + +PX_FORCE_INLINE bool Sc::Interaction::registerInActors(void* data) +{ + bool active = activateInteraction(this, data); + + mActor0.registerInteractionInActor(this); + mActor1.registerInteractionInActor(this); + + return active; +} + +PX_FORCE_INLINE void Sc::Interaction::unregisterFromActors() +{ + mActor0.unregisterInteractionFromActor(this); + mActor1.unregisterInteractionFromActor(this); +} + +PX_FORCE_INLINE void Sc::Interaction::setActorId(ActorSim* actor, PxU32 id) +{ + PX_ASSERT(id != PX_INVALID_INTERACTION_ACTOR_ID); + PX_ASSERT(&mActor0 == actor || &mActor1 == actor); + if(&mActor0 == actor) + mActorId0 = id; + else + mActorId1 = id; +} + +PX_FORCE_INLINE PxU32 Sc::Interaction::getActorId(const ActorSim* actor) const +{ + PX_ASSERT(&mActor0 == actor || &mActor1 == actor); + return &mActor0 == actor ? mActorId0 : mActorId1; +} + +PX_FORCE_INLINE PxIntBool Sc::Interaction::isElementInteraction() const +{ + const PxIntBool res = readInteractionFlag(InteractionFlag::eRB_ELEMENT); + PX_ASSERT( (res && + ((getType() == InteractionType::eOVERLAP) || + (getType() == InteractionType::eTRIGGER) || + (getType() == InteractionType::eMARKER))) || + (!res && + ((getType() == InteractionType::eCONSTRAINTSHADER) || + (getType() == InteractionType::eARTICULATION)))); + + return res; +} + +PX_FORCE_INLINE void Sc::Interaction::setDirty(PxU32 dirtyFlags) +{ + PX_ASSERT(getType() != InteractionType::eARTICULATION); + + mDirtyFlags |= PxTo8(dirtyFlags); + if(!readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)) + { + addToDirtyList(); + raiseInteractionFlag(InteractionFlag::eIN_DIRTY_LIST); + } +} + +//PX_FORCE_INLINE void Sc::Interaction::setClean(bool removeFromList) +//{ +// if (readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)) +// { +// if (removeFromList) // if we process all dirty interactions anyway, then we can just clear the list at the end and save the work here. +// removeFromDirtyList(); +// clearInteractionFlag(InteractionFlag::eIN_DIRTY_LIST); +// } +// +// mDirtyFlags = 0; +//} + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteractionFlags.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteractionFlags.h new file mode 100644 index 0000000..1d00344 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScInteractionFlags.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_INTERACTION_FLAGS_H +#define SC_INTERACTION_FLAGS_H + +#include "foundation/Px.h" + +namespace physx +{ + +namespace Sc +{ + struct InteractionFlag // PT: TODO: use PxFlags + { + enum Enum + { + eRB_ELEMENT = (1 << 0), // Interactions between rigid body shapes + eCONSTRAINT = (1 << 1), + eFILTERABLE = (1 << 2), // Interactions that go through the filter code + eIN_DIRTY_LIST = (1 << 3), // The interaction is in the dirty list + eIS_FILTER_PAIR = (1 << 4), // The interaction is tracked by the filter callback mechanism + eIS_ACTIVE = (1 << 5) + }; + }; + + struct InteractionDirtyFlag + { + enum Enum + { + eFILTER_STATE = (1 << 0), // All changes filtering related + eMATERIAL = (1 << 1), + eBODY_KINEMATIC = (1 << 2) | eFILTER_STATE, // A transition between dynamic and kinematic (and vice versa) require a refiltering + eDOMINANCE = (1 << 3), + eREST_OFFSET = (1 << 4), + eVISUALIZATION = (1 << 5) + }; + }; + + +} // namespace Sc + + +} // namespace physx + + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp new file mode 100644 index 0000000..c2674c3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScIterators.cpp @@ -0,0 +1,107 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "ScIterators.h" +#include "ScBodySim.h" +#include "ScShapeSim.h" +#include "ScShapeInteraction.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////// + +Sc::ContactIterator::Pair::Pair(const void*& contactPatches, const void*& contactPoints, PxU32 /*contactDataSize*/, const PxReal*& forces, PxU32 numContacts, PxU32 numPatches, + ShapeSimBase& shape0, ShapeSimBase& shape1, ActorSim* actor0, ActorSim* actor1) +: mIndex(0) +, mNumContacts(numContacts) +, mIter(reinterpret_cast(contactPatches), reinterpret_cast(contactPoints), reinterpret_cast(forces + numContacts), numPatches, numContacts) +, mForces(forces) +, mActor0(actor0->getPxActor()) +, mActor1(actor1->getPxActor()) +{ + mCurrentContact.shape0 = shape0.getPxShape(); + mCurrentContact.shape1 = shape1.getPxShape(); + mCurrentContact.normalForceAvailable = (forces != NULL); +} + +Sc::ContactIterator::Pair* Sc::ContactIterator::getNextPair() +{ + PX_ASSERT(mCurrent || (mCurrent == mLast)); + if(mCurrent < mLast) + { + ShapeInteraction* si = static_cast(*mCurrent); + + const void* contactPatches = NULL; + const void* contactPoints = NULL; + PxU32 contactDataSize = 0; + const PxReal* forces = NULL; + PxU32 numContacts = 0; + PxU32 numPatches = 0; + + PxU32 nextOffset = si->getContactPointData(contactPatches, contactPoints, contactDataSize, numContacts, numPatches, forces, mOffset, *mOutputs); + + if (nextOffset == mOffset) + ++mCurrent; + else + mOffset = nextOffset; + + mCurrentPair = Pair(contactPatches, contactPoints, contactDataSize, forces, numContacts, numPatches, si->getShape0(), si->getShape1(), &si->getActorSim0(), &si->getActorSim1()); + return &mCurrentPair; + } + else + return NULL; +} + +Sc::Contact* Sc::ContactIterator::Pair::getNextContact() +{ + if(mIndex < mNumContacts) + { + if(!mIter.hasNextContact()) + { + if(!mIter.hasNextPatch()) + return NULL; + mIter.nextPatch(); + } + PX_ASSERT(mIter.hasNextContact()); + mIter.nextContact(); + + mCurrentContact.normal = mIter.getContactNormal(); + mCurrentContact.point = mIter.getContactPoint(); + mCurrentContact.separation = mIter.getSeparation(); + mCurrentContact.normalForce = mForces ? mForces[mIndex] : 0; + mCurrentContact.faceIndex0 = mIter.getFaceIndex0(); + mCurrentContact.faceIndex1 = mIter.getFaceIndex1(); + + mIndex++; + return &mCurrentContact; + } + return NULL; +} + +/////////////////////////////////////////////////////////////////////////////// diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp new file mode 100644 index 0000000..a4c0fb3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScMetaData.cpp @@ -0,0 +1,625 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxIO.h" +#include "ScActorCore.h" +#include "ScActorSim.h" +#include "ScBodyCore.h" +#include "ScStaticCore.h" +#include "ScConstraintCore.h" +#include "ScShapeCore.h" +#include "ScArticulationCore.h" +#include "ScArticulationJointCore.h" +#include "ScArticulationSensor.h" +#include "ScArticulationTendonCore.h" +#include "ScArticulationAttachmentCore.h" +#include "ScArticulationTendonJointCore.h" + +using namespace physx; +using namespace Cm; +using namespace Sc; + +/////////////////////////////////////////////////////////////////////////////// + +template class PxMetaDataArray : public physx::PxArray +{ +public: + static PX_FORCE_INLINE physx::PxU32 getDataOffset() { return PX_OFFSET_OF(PxMetaDataArray, mData); } + static PX_FORCE_INLINE physx::PxU32 getDataSize() { return PX_SIZE_OF(PxMetaDataArray, mData); } + static PX_FORCE_INLINE physx::PxU32 getSizeOffset() { return PX_OFFSET_OF(PxMetaDataArray, mSize); } + static PX_FORCE_INLINE physx::PxU32 getSizeSize() { return PX_SIZE_OF(PxMetaDataArray, mSize); } + static PX_FORCE_INLINE physx::PxU32 getCapacityOffset() { return PX_OFFSET_OF(PxMetaDataArray, mCapacity); } + static PX_FORCE_INLINE physx::PxU32 getCapacitySize() { return PX_SIZE_OF(PxMetaDataArray, mCapacity); } +}; + +void Sc::ActorCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxActorFlags, PxU8) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxDominanceGroup, PxU8) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxClientID, PxU8) + + PX_DEF_BIN_METADATA_CLASS(stream, Sc::ActorCore) + + PX_DEF_BIN_METADATA_ITEM(stream, Sc::ActorCore, ActorSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, Sc::ActorCore, PxU32, mAggregateIDOwnerClient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sc::ActorCore, PxActorFlags, mActorFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sc::ActorCore, PxU8, mActorType, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Sc::ActorCore, PxU8, mDominanceGroup, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PxsRigidCore(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxsRigidCore) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxTransform, body2World, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxRigidBodyFlags, mFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxU16, solverIterationCounts, 0) +} + +namespace +{ + class ShadowPxsBodyCore : public PxsBodyCore + { + public: + static void getBinaryMetaData(PxOutputStream& stream) + { + PX_DEF_BIN_METADATA_CLASS(stream, ShadowPxsBodyCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, ShadowPxsBodyCore, PxsRigidCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxTransform, body2Actor, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, ccdAdvanceCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxVec3, linearVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, maxPenBias, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxVec3, angularVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, contactReportThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, maxAngularVelocitySq, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, maxLinearVelocitySq, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, linearDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, angularDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxVec3, inverseInertia, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, inverseMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, maxContactImpulse, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, sleepThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, freezeThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, wakeCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, solverWakeCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxU32, numCountedInteractions, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxReal, offsetSlop, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxU8, isFastMoving, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxU8, disableGravity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxU8, lockFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsBodyCore, PxU8, kinematicLink, 0) + } + }; +} + +static void getBinaryMetaData_PxsBodyCore(PxOutputStream& stream) +{ + getBinaryMetaData_PxsRigidCore(stream); + +/* PX_DEF_BIN_METADATA_CLASS(stream, PxsBodyCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, PxsBodyCore, PxsRigidCore) + + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxTransform, body2Actor, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, ccdAdvanceCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxVec3, linearVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, maxPenBias, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxVec3, angularVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, contactReportThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, maxAngularVelocitySq, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, maxLinearVelocitySq, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, linearDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, angularDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxVec3, inverseInertia, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, inverseMass, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, maxContactImpulse, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, sleepThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, freezeThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, wakeCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxReal, solverWakeCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxsBodyCore, PxU32, numCountedInteractions, 0)*/ + + ShadowPxsBodyCore::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxsBodyCore, ShadowPxsBodyCore) +} + +/* +We need to fix the header deps by moving the API out of PhysXCore and into its own dir where other code can get to it. +[25.08.2010 18:34:57] Dilip Sequeira: In the meantime, I think it's Ok to include PxSDK.h, but you're right, we need to be very careful about include deps in that direction. +[25.08.2010 18:38:15] Dilip Sequeira: On the memory thing... PxsBodyCore has 28 bytes of padding at the end, for no reason. In addition, it has two words of padding after the velocity fields, to facilitate SIMD loads. But in fact, Vec3FromVec4 is fast enough such that unless you were using it in an inner loop (which we never are with PxsBodyCore) that padding isn't worth it. +[25.08.2010 18:38:58] Dilip Sequeira: So, we should drop the end-padding, and move the damping values to replace the velocity padding. This probably requires a bit of fixup in the places where we do SIMD writes to the velocity. +[25.08.2010 18:39:18] Dilip Sequeira: Then we're down to 92 bytes of data, and 4 bytes of padding I think. +[25.08.2010 18:50:41] Dilip Sequeira: The reason we don't want to put the sleep data there explicitly is that it isn't LL data so I'd rather not have it in an LL interface struct. +[25.08.2010 19:04:53] Gordon Yeoman nvidia: simd loads are faster when they are 16-byte aligned. I think the padding might be to ensure the second vector is also 16-byte aligned. We could drop the second 4-byte pad but dropping the 1st 4-byte pad will likely have performance implications. +[25.08.2010 19:06:22] Dilip Sequeira: We should still align the vec3s, as now - but we shouldn't use padding to do it, since there are a boatload of scalar data fields floating around in that struct too. +*/ +void Sc::BodyCore::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_PxsBodyCore(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxRigidBodyFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, Sc::BodyCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, Sc::BodyCore, Sc::RigidCore) + + PX_DEF_BIN_METADATA_ITEM(stream, Sc::BodyCore, PxsBodyCore, mCore, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +void Sc::ConstraintCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxConstraintFlags, PxU16) + + PX_DEF_BIN_METADATA_CLASS(stream, ConstraintCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxConstraintFlags, mFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxU8, mIsDirty, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, ConstraintCore, PxU8, mPadding, PxMetaDataFlag::ePADDING) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxVec3, mAppliedForce, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxVec3, mAppliedTorque, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxConstraintConnector, mConnector, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxConstraintProject, mProject, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxConstraintSolverPrep, mSolverPrep, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxConstraintVisualize, mVisualize, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxU32, mDataSize, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxReal, mLinearBreakForce, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxReal, mAngularBreakForce, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, PxReal, mMinResponseThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ConstraintCore, ConstraintSim, mSim, PxMetaDataFlag::ePTR) +} + +/////////////////////////////////////////////////////////////////////////////// + +void Sc::RigidCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, Sc::RigidCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, Sc::RigidCore, Sc::ActorCore) +} + +/////////////////////////////////////////////////////////////////////////////// + +void Sc::StaticCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, Sc::StaticCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, Sc::StaticCore, Sc::RigidCore) + + PX_DEF_BIN_METADATA_ITEM(stream, Sc::StaticCore, PxsRigidCore, mCore, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_PxFilterData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxFilterData) + + PX_DEF_BIN_METADATA_ITEM(stream, PxFilterData, PxU32, word0, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxFilterData, PxU32, word1, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxFilterData, PxU32, word2, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxFilterData, PxU32, word3, 0) +} + +namespace +{ + class ShadowPxsShapeCore : public PxsShapeCore + { + public: + static void getBinaryMetaData(PxOutputStream& stream) + { + PX_DEF_BIN_METADATA_CLASS(stream, ShadowPxsShapeCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxTransform, mTransform, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, GeometryUnion, mGeometry, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxReal, mContactOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxShapeFlags, mShapeFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxShapeCoreFlags, mShapeCoreFlags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxU16, mMaterialIndex, PxMetaDataFlag::eHANDLE) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxReal, mRestOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxReal, mTorsionalRadius, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShadowPxsShapeCore, PxReal, mMinTorsionalPatchRadius, 0) + } + }; +} + +static void getBinaryMetaData_PxsShapeCore(PxOutputStream& stream) +{ + ShadowPxsShapeCore::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxsShapeCore, ShadowPxsShapeCore) +} + +void Sc::ShapeCore::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_PxFilterData(stream); + getBinaryMetaData_PxsShapeCore(stream); + + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxShapeFlags, PxU8) + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxShapeCoreFlags, PxU8) + + PX_DEF_BIN_METADATA_CLASS(stream, ShapeCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ShapeCore, PxFilterData, mSimulationFilterData, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShapeCore, PxsShapeCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ShapeCore, ShapeSim, mSimAndIsExclusive, PxMetaDataFlag::ePTR) + + PX_DEF_BIN_METADATA_ITEM(stream, ShapeCore, char, mName, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_EXTRA_NAME(stream, ShapeCore, mName, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_ArticulationCore(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, Dy::ArticulationCore) + + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxArticulationFlags, PxU8) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxU16, solverIterationCounts, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxArticulationFlags, flags, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, sleepThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, freezeThreshold, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, wakeCounter, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, gpuRemapIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, maxLinearVelocity, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationCore, PxReal, maxAngularVelocity, 0) +} + +void Sc::ArticulationCore::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_ArticulationCore(stream); + + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationCore, ArticulationSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationCore, Dy::ArticulationCore, mCore, 0) +} + +void Sc::ArticulationSensorCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationSensorCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, ArticulationSensorSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, PxTransform, mRelativePose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSensorCore, PxU16, mFlags, 0) +} + +void Sc::ArticulationAttachmentCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationAttachmentCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxVec3, mRelativeOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, ArticulationAttachmentCore, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mLowLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mHighLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mRestLength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxReal, mCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxU32, mLLLinkIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, PxU32, mAttachmentIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationAttachmentCore, ArticulationSpatialTendonSim, mTendonSim, PxMetaDataFlag::ePTR) +} + +void Sc::ArticulationTendonCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationTendonCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mStiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mDamping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mOffset, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonCore, PxReal, mLimitStiffness, 0) +} + +void Sc::ArticulationSpatialTendonCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationSpatialTendonCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, ArticulationSpatialTendonCore, ArticulationTendonCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationSpatialTendonCore, ArticulationSpatialTendonSim, mSim, PxMetaDataFlag::ePTR) +} + +void Sc::ArticulationFixedTendonCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationFixedTendonCore) + PX_DEF_BIN_METADATA_BASE_CLASS(stream, ArticulationFixedTendonCore, ArticulationTendonCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mLowLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mHighLimit, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, PxReal, mRestLength, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationFixedTendonCore, ArticulationFixedTendonSim, mSim, PxMetaDataFlag::ePTR) +} + +void Sc::ArticulationTendonJointCore::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxArticulationAxis, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationTendonJointCore) + + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxArticulationAxis, axis, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxReal, coefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxReal, recipCoefficient, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxU32, mLLLinkIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, ArticulationTendonJointCore, mParent, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, PxU32, mLLTendonJointIndex, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationTendonJointCore, ArticulationFixedTendonSim, mTendonSim, PxMetaDataFlag::ePTR) +} + +/////////////////////////////////////////////////////////////////////////////// + +static void getBinaryMetaData_ArticulationLimit(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, PxArticulationLimit) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationLimit, PxReal, low, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationLimit, PxReal, high, 0) +} + +static void getBinaryMetaData_ArticulationDrive(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxArticulationDriveType::Enum, PxU32) + + PX_DEF_BIN_METADATA_CLASS(stream, PxArticulationDrive) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationDrive, PxReal, stiffness, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationDrive, PxReal, damping, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationDrive, PxReal, maxForce, 0) + PX_DEF_BIN_METADATA_ITEM(stream, PxArticulationDrive, PxArticulationDriveType::Enum, driveType, 0) +} + +static void getBinaryMetaData_ArticulationJointCore(PxOutputStream& stream) +{ + getBinaryMetaData_ArticulationLimit(stream); + getBinaryMetaData_ArticulationDrive(stream); + + PX_DEF_BIN_METADATA_CLASS(stream, Dy::ArticulationJointCore) + + PX_DEF_BIN_METADATA_TYPEDEF(stream, ArticulationJointCoreDirtyFlags, PxU8) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxTransform, parentPose, 0) + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxTransform, childPose, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxArticulationLimit, limits, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxArticulationDrive, drives, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxReal, targetP, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxReal, targetV, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxReal, armature, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxReal, jointPos, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxReal, jointVel, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxReal, frictionCoefficient, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxU8, dofIds, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxU8, motion, 0) + + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream, Dy::ArticulationJointCore, PxU8, invDofIds, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxReal, maxJointVelocity, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, ArticulationJointCoreDirtyFlags, jointDirtyFlag, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxU32, jointOffset, 0) + + PX_DEF_BIN_METADATA_ITEM(stream, Dy::ArticulationJointCore, PxU8, jointType, 0) +} + +// +//static void getBinaryMetaData_ArticulationJointCore(PxOutputStream& stream) +//{ +// getBinaryMetaData_ArticulationJointCoreBase(stream); +// PX_DEF_BIN_METADATA_CLASS(stream, Dy::ArticulationJointCore) +// PX_DEF_BIN_METADATA_BASE_CLASS(stream, Dy::ArticulationJointCore, Dy::ArticulationJointCoreBase) +//} + +void Sc::ArticulationJointCore::getBinaryMetaData(PxOutputStream& stream) +{ + getBinaryMetaData_ArticulationJointCore(stream); + PX_DEF_BIN_METADATA_CLASS(stream, ArticulationJointCore) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationJointCore, ArticulationJointSim, mSim, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationJointCore, Dy::ArticulationJointCore, mCore, 0) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationJointCore, Dy::ArticulationCore, mArticulation, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationJointCore, PxArticulationJointReducedCoordinate, mRootType, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, ArticulationJointCore, PxU32, mLLLinkIndex, 0) +} + +/////////////////////////////////////////////////////////////////////////////// + +/* +#define PX_DEF_BIN_METADATA_ARRAY(stream, Class, type, array) \ +{ PxMetaDataEntry tmp = {"void", #array".mData", PxU32(PX_OFFSET_OF(Class, array)) + PxMetaDataArray::getDataOffset(), PxMetaDataArray::getDataSize(), 1, 0, PxMetaDataFlag::ePTR, 0}; PX_STORE_METADATA(stream, tmp); } \ +{ PxMetaDataEntry tmp = {"PxU32", #array".mSize", PxU32(PX_OFFSET_OF(Class, array)) + PxMetaDataArray::getSizeOffset(), PxMetaDataArray::getSizeSize(), 1, 0, 0, 0}; PX_STORE_METADATA(stream, tmp); } \ +{ PxMetaDataEntry tmp = {"PxU32", #array".mCapacity", PxU32(PX_OFFSET_OF(Class, array)) + PxMetaDataArray::getCapacityOffset(), PxMetaDataArray::getCapacitySize(), 1, 0, PxMetaDataFlag::eCOUNT_MASK_MSB, 0}; PX_STORE_METADATA(stream, tmp); } \ +{ PxMetaDataEntry tmp = {#type, 0, PxU32(PX_OFFSET_OF(Class, array)) + PxMetaDataArray::getSizeOffset(), PxMetaDataArray::getSizeSize(), 0, 0, PxMetaDataFlag::eEXTRA_DATA, 0}; PX_STORE_METADATA(stream, tmp); } +*/ + +/////////////////////////////////////////////////////////////////////////////// + +void MaterialIndicesStruct::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_CLASS(stream, MaterialIndicesStruct) + PX_DEF_BIN_METADATA_ITEM(stream, MaterialIndicesStruct, PxU16, indices, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream, MaterialIndicesStruct, PxU16, numIndices, 0) + PX_DEF_BIN_METADATA_ITEM(stream, MaterialIndicesStruct, PxU16, pad, PxMetaDataFlag::ePADDING) + PX_DEF_BIN_METADATA_ITEM(stream, MaterialIndicesStruct, PxU32, gpuRemapId, 0) + + //------ Extra-data ------ + // indices + PX_DEF_BIN_METADATA_EXTRA_ITEMS(stream, MaterialIndicesStruct, PxU16, indices, numIndices, PxMetaDataFlag::eHANDLE, PX_SERIAL_ALIGN) +} + +/////////////////////////////////////////////////////////////////////////////// + +void GeometryUnion::getBinaryMetaData(PxOutputStream& stream) +{ + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxGeometryType::Enum, PxU32) + + // The various PxGeometry classes are all public, so I can't really put the meta-data function in there. And then + // I can't access their protected members. So we use the same trick as for the ShapeContainer + class ShadowConvexMeshGeometry : public PxConvexMeshGeometryLL + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_TYPEDEF(stream_, PxConvexMeshGeometryFlags, PxU8) + + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowConvexMeshGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, PxMeshScale, scale, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, PxConvexMesh, convexMesh, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, PxConvexMeshGeometryFlags, meshFlags, 0) + PX_DEF_BIN_METADATA_ITEMS(stream_, ShadowConvexMeshGeometry, PxU8, paddingFromFlags, PxMetaDataFlag::ePADDING, 3) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowConvexMeshGeometry, bool, gpuCompatible, 0) + } + }; + ShadowConvexMeshGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxConvexMeshGeometryLL, ShadowConvexMeshGeometry) + + ///////////////// + + class ShadowTriangleMeshGeometry : public PxTriangleMeshGeometryLL + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_TYPEDEF(stream_, PxMeshGeometryFlags, PxU8) + + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowTriangleMeshGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, PxMeshScale, scale, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, PxMeshGeometryFlags, meshFlags, 0) + PX_DEF_BIN_METADATA_ITEMS(stream_, ShadowTriangleMeshGeometry, PxU8, paddingFromFlags, PxMetaDataFlag::ePADDING, 3) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, PxTriangleMesh, triangleMesh, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowTriangleMeshGeometry, MaterialIndicesStruct, materialsLL, 0) + } + }; + ShadowTriangleMeshGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream,PxTriangleMeshGeometryLL, ShadowTriangleMeshGeometry) + + ///////////////// + + class ShadowHeightFieldGeometry : public PxHeightFieldGeometryLL + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowHeightFieldGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxHeightField, heightField, PxMetaDataFlag::ePTR) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxReal, heightScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxReal, rowScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxReal, columnScale, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, PxMeshGeometryFlags, heightFieldFlags, 0) + PX_DEF_BIN_METADATA_ITEMS_AUTO(stream_, ShadowHeightFieldGeometry, PxU8, paddingFromFlags, PxMetaDataFlag::ePADDING) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowHeightFieldGeometry, MaterialIndicesStruct, materialsLL, 0) + } + }; + ShadowHeightFieldGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream,PxHeightFieldGeometryLL, ShadowHeightFieldGeometry) + + ///////////////// + + class ShadowPlaneGeometry : public PxPlaneGeometry + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowPlaneGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowPlaneGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowPlaneGeometry, float, mTypePadding, 0) + } + }; + ShadowPlaneGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream,PxPlaneGeometry, ShadowPlaneGeometry) + + ///////////////// + + class ShadowSphereGeometry : public PxSphereGeometry + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowSphereGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowSphereGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowSphereGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowSphereGeometry, PxReal, radius, 0) + } + }; + ShadowSphereGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxSphereGeometry, ShadowSphereGeometry) + + ///////////////// + + class ShadowCapsuleGeometry : public PxCapsuleGeometry + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowCapsuleGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowCapsuleGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowCapsuleGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowCapsuleGeometry, PxReal, radius, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowCapsuleGeometry, PxReal, halfHeight, 0) + } + }; + ShadowCapsuleGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxCapsuleGeometry, ShadowCapsuleGeometry) + + ///////////////// + + class ShadowBoxGeometry : public PxBoxGeometry + { + public: + static void getBinaryMetaData(PxOutputStream& stream_) + { + PX_DEF_BIN_METADATA_CLASS(stream_, ShadowBoxGeometry) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBoxGeometry, PxGeometryType::Enum, mType, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBoxGeometry, float, mTypePadding, 0) + PX_DEF_BIN_METADATA_ITEM(stream_, ShadowBoxGeometry, PxVec3, halfExtents, 0) + } + }; + ShadowBoxGeometry::getBinaryMetaData(stream); + PX_DEF_BIN_METADATA_TYPEDEF(stream, PxBoxGeometry, ShadowBoxGeometry) + + /* + - geom union offset & size + - control type offset & size + - type-to-class mapping + */ + + PX_DEF_BIN_METADATA_CLASS(stream, GeometryUnion) + + PX_DEF_BIN_METADATA_UNION(stream, GeometryUnion, mGeometry) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxSphereGeometry, PxGeometryType::eSPHERE) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxPlaneGeometry, PxGeometryType::ePLANE) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxCapsuleGeometry, PxGeometryType::eCAPSULE) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxBoxGeometry, PxGeometryType::eBOX) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxConvexMeshGeometryLL, PxGeometryType::eCONVEXMESH) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxTriangleMeshGeometryLL,PxGeometryType::eTRIANGLEMESH) + PX_DEF_BIN_METADATA_UNION_TYPE(stream, GeometryUnion, PxHeightFieldGeometryLL, PxGeometryType::eHEIGHTFIELD) +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp new file mode 100644 index 0000000..2bfbb85 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.cpp @@ -0,0 +1,2234 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScNPhaseCore.h" +#include "ScShapeInteraction.h" +#include "ScTriggerInteraction.h" +#include "ScElementInteractionMarker.h" +#include "ScConstraintInteraction.h" +#include "ScConstraintSim.h" +#include "ScConstraintCore.h" +#include "ScSimStats.h" +#include "ScObjectIDTracker.h" +#include "ScSimStats.h" + +#include "foundation/PxThread.h" +#include "BpBroadPhase.h" +#include "common/PxProfileZone.h" +#include "ScSoftBodyShapeSim.h" +#include "ScParticleSystemShapeSim.h" +#include "ScArticulationSim.h" + +using namespace physx; +using namespace Sc; +using namespace Gu; + +/////////////////////////////////////////////////////////////////////////////// + +PX_IMPLEMENT_OUTPUT_ERROR + +/////////////////////////////////////////////////////////////////////////////// + +class Sc::FilterPairManager : public PxUserAllocated +{ + PX_NOCOPY(FilterPairManager) +public: + FilterPairManager() + : mPairs("FilterPairManager Array") + , mFree(INVALID_FILTER_PAIR_INDEX) + {} + + PxU32 acquireIndex() + { + PxU32 index; + if(mFree == INVALID_FILTER_PAIR_INDEX) + { + index = mPairs.size(); + mPairs.pushBack(NULL); + } + else + { + index = PxU32(mFree); + mFree = reinterpret_cast(mPairs[index]); + mPairs[index] = NULL; + } + return index; + } + + void releaseIndex(PxU32 index) + { + mPairs[index] = reinterpret_cast(mFree); + mFree = index; + } + + void setPair(PxU32 index, Sc::ElementSimInteraction* ptr) + { + mPairs[index] = ptr; + } + + Sc::ElementSimInteraction* operator[](PxU32 index) + { + return mPairs[index]; + } + + PxU32 findIndex(Sc::ElementSimInteraction* ptr) + { + return ptr->getFilterPairIndex(); + } + +private: + PxArray mPairs; + uintptr_t mFree; +}; + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE PxU32 hasTriggerFlags(PxShapeFlags flags) { return PxU32(flags) & PxU32(PxShapeFlag::eTRIGGER_SHAPE); } +static void getFilterInfo_ShapeSim(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData, const Sc::ShapeSim& shape) +{ + filterAttr = hasTriggerFlags(shape.getCore().getFlags()) ? PxFilterObjectFlag::eTRIGGER : PxFilterObjectFlag::Enum(0); + + BodySim* b = shape.getBodySim(); + if(b) + { + if(!b->isArticulationLink()) + { + if(b->isKinematic()) + filterAttr |= PxFilterObjectFlag::eKINEMATIC; + + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eRIGID_DYNAMIC); + } + else + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eARTICULATION); + } + else + { + // For softbody and particle system, the bodySim is set to null + if (shape.getActor().isSoftBody()) + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eSOFTBODY); + else if (shape.getActor().isParticleSystem()) + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::ePARTICLESYSTEM); + else if (shape.getActor().isHairSystem()) + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eHAIRSYSTEM); + else + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eRIGID_STATIC); + } + + filterData = shape.getCore().getSimulationFilterData(); +} + +static PX_FORCE_INLINE void getFilterInfo(PxFilterData& fd, PxFilterObjectAttributes& fa, const ElementSim& e) +{ + getFilterInfo_ShapeSim(fa, fd, static_cast(e)); +} + +static void getFilterInfo(PxFilterData& fd0, PxFilterData& fd1, PxFilterObjectAttributes& fa0, PxFilterObjectAttributes& fa1, const ElementSim& e0, const ElementSim& e1) +{ + getFilterInfo(fd0, fa0, e0); + getFilterInfo(fd1, fa1, e1); +} + +static PX_INLINE void callPairLost(Scene& scene, const ElementSim& e0, const ElementSim& e1, PxU32 pairID, bool objVolumeRemoved) +{ + PxFilterData fd0(PxEmpty), fd1(PxEmpty); + PxFilterObjectAttributes fa0, fa1; + getFilterInfo(fd0, fd1, fa0, fa1, e0, e1); + + scene.getFilterCallbackFast()->pairLost(pairID, fa0, fd0, fa1, fd1, objVolumeRemoved); +} + +// Filtering + +static PX_INLINE void checkFilterFlags(PxFilterFlags& filterFlags) +{ + if((filterFlags & (PxFilterFlag::eKILL | PxFilterFlag::eSUPPRESS)) == (PxFilterFlag::eKILL | PxFilterFlag::eSUPPRESS)) + { +#if PX_CHECKED + outputError(__LINE__, "Filtering: eKILL and eSUPPRESS must not be set simultaneously. eSUPPRESS will be used."); +#endif + filterFlags.clear(PxFilterFlag::eKILL); + } +} + +static PX_FORCE_INLINE PxPairFlags checkRbPairFlags(const ShapeSimBase& s0, const ShapeSimBase& s1, PxPairFlags pairFlags) +{ +#if PX_CHECKED + // we want to avoid to run contact generation for pairs that should not get resolved or have no contact/trigger reports + if (!(PxU32(pairFlags) & (PxPairFlag::eSOLVE_CONTACT | ShapeInteraction::CONTACT_REPORT_EVENTS))) + outputError(__LINE__, "Filtering: Pair with no contact/trigger reports detected, nor is PxPairFlag::eSOLVE_CONTACT set. It is recommended to suppress/kill such pairs for performance reasons."); + else if(!(pairFlags & (PxPairFlag::eDETECT_DISCRETE_CONTACT | PxPairFlag::eDETECT_CCD_CONTACT))) + outputError(__LINE__, "Filtering: Pair did not request either eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT. It is recommended to suppress/kill such pairs for performance reasons."); + + if(((s0.getFlags() & PxShapeFlag::eTRIGGER_SHAPE)!=0 || (s1.getFlags() & PxShapeFlag::eTRIGGER_SHAPE)!=0) && + (pairFlags & PxPairFlag::eTRIGGER_DEFAULT) && (pairFlags & PxPairFlag::eDETECT_CCD_CONTACT)) + outputError(__LINE__, "Filtering: CCD isn't supported on Triggers yet"); +#else + PX_UNUSED(s0); + PX_UNUSED(s1); +#endif + return pairFlags; +} + +static PX_INLINE PxPairFlags checkRbPairFlags( const ShapeSimBase& s0, const ShapeSimBase& s1, + const ActorSim& bs0, const ActorSim& bs1, + PxPairFlags pairFlags, PxFilterFlags filterFlags, + bool isNonRigid) +{ + if(filterFlags & (PxFilterFlag::eSUPPRESS | PxFilterFlag::eKILL)) + return pairFlags; + + if (bs0.isDynamicRigid() && static_cast(bs0).isKinematic() && + bs1.isDynamicRigid() && static_cast(bs1).isKinematic() && + (pairFlags & PxPairFlag::eSOLVE_CONTACT)) + { +#if PX_CHECKED + outputError(__LINE__, "Filtering: Resolving contacts between two kinematic objects is invalid. Contacts will not get resolved."); +#endif + pairFlags.clear(PxPairFlag::eSOLVE_CONTACT); + } + + if (isNonRigid && (pairFlags & PxPairFlag::eDETECT_CCD_CONTACT)) + pairFlags.clear(PxPairFlag::eDETECT_CCD_CONTACT); + + return checkRbPairFlags(s0, s1, pairFlags); +} + +// PT: version specialized for ShapeSim/ShapeSim +static PX_INLINE PxPairFlags checkRbPairFlags( const ShapeSimBase& s0, const ShapeSimBase& s1, + bool kine0, bool kine1, + PxPairFlags pairFlags, PxFilterFlags filterFlags, + bool isNonRigid) +{ + if(filterFlags & (PxFilterFlag::eSUPPRESS | PxFilterFlag::eKILL)) + return pairFlags; + + if(kine0 && kine1 && (pairFlags & PxPairFlag::eSOLVE_CONTACT)) + { +#if PX_CHECKED + outputError(__LINE__, "Filtering: Resolving contacts between two kinematic objects is invalid. Contacts will not get resolved."); +#endif + pairFlags.clear(PxPairFlag::eSOLVE_CONTACT); + } + + if (pairFlags & PxPairFlag::eDETECT_CCD_CONTACT && isNonRigid) + { + pairFlags.clear(PxPairFlag::eDETECT_CCD_CONTACT); + } + + return checkRbPairFlags(s0, s1, pairFlags); +} + +static PX_FORCE_INLINE void fetchActorAndShape(const ElementSim& e, PxActor*& a, PxShape*& s) +{ + const ShapeSimBase& sim = static_cast(e); + a = sim.getActor().getPxActor(); + + PxActorType::Enum type = sim.getActor().getActorType(); + if (type == PxActorType::ePBD_PARTICLESYSTEM || + type == PxActorType::eFLIP_PARTICLESYSTEM || + type == PxActorType::eMPM_PARTICLESYSTEM || + type == PxActorType::eCUSTOM_PARTICLESYSTEM) + s = NULL; // Particle system does not have a valid shape so set it to null + else + s = sim.getPxShape(); +} + +static void runFilter(PxFilterInfo& filterInfo, const FilteringContext& context, const ElementSim& e0, const ElementSim& e1, PxU32 filterPairIndex, bool doCallbacks) +{ + PxFilterData fd0(PxEmpty), fd1(PxEmpty); + PxFilterObjectAttributes fa0, fa1; + getFilterInfo(fd0, fd1, fa0, fa1, e0, e1); + + // Run filter shader + filterInfo.filterFlags = context.mFilterShader(fa0, fd0, fa1, fd1, filterInfo.pairFlags, context.mFilterShaderData, context.mFilterShaderDataSize); + + if(filterInfo.filterFlags & PxFilterFlag::eCALLBACK) + { + if(context.mFilterCallback) + { + if(!doCallbacks) + { + return; + } + else + { + if(filterPairIndex == INVALID_FILTER_PAIR_INDEX) + filterPairIndex = context.mFilterPairManager->acquireIndex(); + // If a FilterPair is provided, then we use it, else we create a new one + // (A FilterPair is provided in the case for a pairLost()-pairFound() sequence after refiltering) + + PxActor* a0, *a1; + PxShape* s0, *s1; + fetchActorAndShape(e0, a0, s0); + fetchActorAndShape(e1, a1, s1); + + filterInfo.filterFlags = context.mFilterCallback->pairFound(filterPairIndex, fa0, fd0, a0, s0, fa1, fd1, a1, s1, filterInfo.pairFlags); + filterInfo.filterPairIndex = filterPairIndex; + } + } + else + { + filterInfo.filterFlags.clear(PxFilterFlag::eNOTIFY); + outputError(__LINE__, "Filtering: eCALLBACK set but no filter callback defined."); + } + } + + checkFilterFlags(filterInfo.filterFlags); + + if(filterPairIndex!=INVALID_FILTER_PAIR_INDEX && ((filterInfo.filterFlags & PxFilterFlag::eKILL) || ((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) != PxFilterFlag::eNOTIFY))) + { + if((filterInfo.filterFlags & PxFilterFlag::eKILL) && ((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) == PxFilterFlag::eNOTIFY)) + context.mFilterCallback->pairLost(filterPairIndex, fa0, fd0, fa1, fd1, false); + + if((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) != PxFilterFlag::eNOTIFY) + { + // No notification, hence we don't need to treat it as a filter callback pair anymore. + // Make sure that eCALLBACK gets removed as well + filterInfo.filterFlags.clear(PxFilterFlag::eNOTIFY); + } + + context.mFilterPairManager->releaseIndex(filterPairIndex); + filterInfo.filterPairIndex = INVALID_FILTER_PAIR_INDEX; + } + + // Sanity checks + PX_ASSERT( (filterInfo.filterFlags != PxFilterFlag::eKILL) || + ((filterInfo.filterFlags == PxFilterFlag::eKILL) && (filterInfo.filterPairIndex == INVALID_FILTER_PAIR_INDEX)) ); + PX_ASSERT( ((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) != PxFilterFlag::eNOTIFY) || + (((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) == PxFilterFlag::eNOTIFY) && filterInfo.filterPairIndex!=INVALID_FILTER_PAIR_INDEX) ); +} + +// PT: version specialized for ShapeSim/ShapeSim +static PX_FORCE_INLINE void runFilterShapeSim(PxFilterInfo& filterInfo, const FilteringContext& context, const ShapeSimBase& e0, const ShapeSimBase& e1, const PxFilterObjectAttributes fa0, const PxFilterObjectAttributes fa1) +{ + // Run filter shader + { + const PxFilterData fd0 = e0.getCore().getSimulationFilterData(); + const PxFilterData fd1 = e1.getCore().getSimulationFilterData(); + filterInfo.filterFlags = context.mFilterShader(fa0, fd0, fa1, fd1, filterInfo.pairFlags, context.mFilterShaderData, context.mFilterShaderDataSize); + } + + if(filterInfo.filterFlags & PxFilterFlag::eCALLBACK) + { + if(context.mFilterCallback) + { + return; + } + else + { + filterInfo.filterFlags.clear(PxFilterFlag::eNOTIFY); + outputError(__LINE__, "Filtering: eCALLBACK set but no filter callback defined."); + } + } + + checkFilterFlags(filterInfo.filterFlags); + + // Sanity checks + PX_ASSERT( (filterInfo.filterFlags != PxFilterFlag::eKILL) || + ((filterInfo.filterFlags == PxFilterFlag::eKILL) && (filterInfo.filterPairIndex == INVALID_FILTER_PAIR_INDEX)) ); + PX_ASSERT( ((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) != PxFilterFlag::eNOTIFY) || + (((filterInfo.filterFlags & PxFilterFlag::eNOTIFY) == PxFilterFlag::eNOTIFY) && filterInfo.filterPairIndex!=INVALID_FILTER_PAIR_INDEX) ); +} + +// helper method for some cleanup code that is used multiple times for early outs in case a rigid body collision pair gets filtered out due to some hardwired filter criteria +static PX_FORCE_INLINE PxFilterInfo filterOutRbCollisionPair(FilterPairManager* filterPairManager, PxU32 filterPairIndex, const PxFilterFlags filterFlags) +{ + if(filterPairIndex!=INVALID_FILTER_PAIR_INDEX) + filterPairManager->releaseIndex(filterPairIndex); + + return PxFilterInfo(filterFlags); +} + +PxFilterInfo Sc::filterRbCollisionPairSecondStage(const FilteringContext& context, const ShapeSimBase& s0, const ShapeSimBase& s1, const ActorSim& b0, const ActorSim& b1, PxU32 filterPairIndex, bool runCallbacks, + bool isNonRigid) +{ + PxFilterInfo filterInfo; + + runFilter(filterInfo, context, s0, s1, filterPairIndex, runCallbacks); + + if(runCallbacks || (!(filterInfo.filterFlags & PxFilterFlag::eCALLBACK))) + filterInfo.pairFlags = checkRbPairFlags(s0, s1, b0, b1, filterInfo.pairFlags, filterInfo.filterFlags, isNonRigid); + + return filterInfo; +} + +// PT: version specialized for ShapeSim/ShapeSim +static PX_FORCE_INLINE PxFilterInfo filterRbCollisionPairSecondStage(const FilteringContext& context, const ShapeSimBase& s0, const ShapeSimBase& s1, bool kine0, bool kine1, const PxFilterObjectAttributes fa0, const PxFilterObjectAttributes fa1, + bool isNonRigid) +{ + PxFilterInfo filterInfo; + runFilterShapeSim(filterInfo, context, s0, s1, fa0, fa1); + + if(!(filterInfo.filterFlags & PxFilterFlag::eCALLBACK)) + filterInfo.pairFlags = checkRbPairFlags(s0, s1, kine0, kine1, filterInfo.pairFlags, filterInfo.filterFlags, isNonRigid); + + return filterInfo; +} + +static bool filterArticulationLinks(const ActorSim& rbActor0, const ActorSim& rbActor1) +{ + { + //It's the same articulation, so we can filter based on flags... + const BodySim& bs0 = static_cast(rbActor0); + const BodySim& bs1 = static_cast(rbActor1); + + const ArticulationSim* articulationSim0 = bs0.getArticulation(); + const ArticulationSim* articulationSim1 = bs1.getArticulation(); + if (articulationSim0 == articulationSim1) + { + if (articulationSim0->getCore().getArticulationFlags() & PxArticulationFlag::eDISABLE_SELF_COLLISION) + return true; + + //check to see if one link is the parent of the other link, if so disable collision + PxU32 linkId0 = bs0.getNodeIndex().articulationLinkId(); + PxU32 linkId1 = bs1.getNodeIndex().articulationLinkId(); + + + const Dy::ArticulationLink& link0 = articulationSim0->getLink(linkId0); + const Dy::ArticulationLink& link1 = articulationSim1->getLink(linkId1); + + if (linkId1 < linkId0) + return link0.parent == linkId1; + + return link1.parent == linkId0; + } + } + + return false; +} + +static bool filterJointedBodies2(const ActorSim& actor, const ActorSim& other) +{ + if(!actor.isDynamicRigid()) + return false; + + ConstraintCore* core = actor.getScene().findConstraintCore(&actor, &other); + + if(core) + return !(core->getFlags() & PxConstraintFlag::eCOLLISION_ENABLED); + return false; + + /*const Sc::ActorSim* actorToMatch; + PxU32 size; + Interaction** interactions; + + if(actor.getActorInteractionCount() <= other.getActorInteractionCount()) + { + size = actor.getActorInteractionCount(); + interactions = actor.getActorInteractions(); + actorToMatch = &other; + } + else + { + size = other.getActorInteractionCount(); + interactions = other.getActorInteractions(); + actorToMatch = &actor; + } + + while(size--) + { + Interaction* interaction = *interactions++; + if(interaction->getType() == InteractionType::eCONSTRAINTSHADER) + { + ConstraintInteraction* csi = static_cast(interaction); + if((&csi->getActorSim0() == actorToMatch) || (&csi->getActorSim1() == actorToMatch)) + return !(csi->getConstraint()->getCore().getFlags() & PxConstraintFlag::eCOLLISION_ENABLED); + } + } + return false;*/ +} + +static PX_FORCE_INLINE bool filterJointedBodies(const ActorSim& rbActor0, const ActorSim& rbActor1) +{ + // If the bodies of the shape pair are connected by a joint, we need to check whether this connection disables the collision. + // Note: As an optimization, the dynamic bodies have a flag which specifies whether they have any constraints at all. That works + // because a constraint has at least one dynamic body and an interaction is tracked by both objects. + + if(rbActor0.isDynamicRigid()) + return filterJointedBodies2(rbActor0, rbActor1); + return filterJointedBodies2(rbActor1, rbActor0); +} + +static PX_FORCE_INLINE bool hasForceNotifEnabled(const BodySim* bs, PxRigidBodyFlag::Enum flag) +{ + if(!bs) + return false; + + const PxsRigidCore& core = bs->getBodyCore().getCore(); + return core.mFlags.isSet(flag); +} + +static PX_FORCE_INLINE bool validateSuppress(const BodySim* b0, const BodySim* b1, PxRigidBodyFlag::Enum flag) +{ + if(hasForceNotifEnabled(b0, flag)) + return false; + + if(hasForceNotifEnabled(b1, flag)) + return false; + + return true; +} + +static PX_FORCE_INLINE bool filterKinematics(const BodySim* b0, const BodySim* b1, bool kine0, bool kine1, + const PxPairFilteringMode::Enum kineKineFilteringMode, const PxPairFilteringMode::Enum staticKineFilteringMode) +{ + const bool kinematicPair = kine0 | kine1; + if(kinematicPair) + { + if(staticKineFilteringMode != PxPairFilteringMode::eKEEP) + { + if(!b0 || !b1) + return validateSuppress(b0, b1, PxRigidBodyFlag::eFORCE_STATIC_KINE_NOTIFICATIONS); + } + + if(kineKineFilteringMode != PxPairFilteringMode::eKEEP) + { + if(kine0 && kine1) + return validateSuppress(b0, b1, PxRigidBodyFlag::eFORCE_KINE_KINE_NOTIFICATIONS); + } + } + return false; +} + +static const BodySim* isKinematic(const ActorSim& actorSim, bool& kine) +{ + if(actorSim.isDynamicRigid()) + { + const BodySim* bs = static_cast(&actorSim); + kine = bs->isKinematic(); + return bs; + } + else + { + kine = false; + return NULL; + } +} + +static PxFilterInfo filterRbCollisionPair(const FilteringContext& context, const ShapeSimBase& s0, const ShapeSimBase& s1, PxU32 filterPairIndex, bool& isTriggerPair, bool runCallbacks) +{ + const ActorSim& b0 = s0.getActor(); + const ActorSim& b1 = s1.getActor(); + + const PxU32 trigger0 = s0.getFlags() & PxShapeFlag::eTRIGGER_SHAPE; + const PxU32 trigger1 = s1.getFlags() & PxShapeFlag::eTRIGGER_SHAPE; + isTriggerPair = (trigger0 | trigger1)!=0; + + bool isNonRigid = false; + + if(isTriggerPair) + { + if(trigger0 && trigger1) // trigger-trigger pairs are not supported + return filterOutRbCollisionPair(context.mFilterPairManager, filterPairIndex, PxFilterFlag::eKILL); + } + else + { + bool kine0, kine1; + const BodySim* bs0 = isKinematic(b0, kine0); + const BodySim* bs1 = isKinematic(b1, kine1); + + isNonRigid = b0.isNonRigid() || b1.isNonRigid(); + + if(!isNonRigid && filterKinematics(bs0, bs1, kine0, kine1, context.mKineKineFilteringMode, context.mStaticKineFilteringMode)) + return filterOutRbCollisionPair(context.mFilterPairManager, filterPairIndex, PxFilterFlag::eSUPPRESS); + + if(filterJointedBodies(b0, b1)) + return filterOutRbCollisionPair(context.mFilterPairManager, filterPairIndex, PxFilterFlag::eSUPPRESS); + + if((b0.getActorType() == PxActorType::eARTICULATION_LINK) && (b1.getActorType() == PxActorType::eARTICULATION_LINK)) + { + if(filterArticulationLinks(b0, b1)) + return filterOutRbCollisionPair(context.mFilterPairManager, filterPairIndex, PxFilterFlag::eKILL); + } + } + return filterRbCollisionPairSecondStage(context, s0, s1, b0, b1, filterPairIndex, runCallbacks, isNonRigid); +} + +// PT: indexed by PxActorType +static const PxU32 gTypeData[] = { + PxFilterObjectType::eRIGID_STATIC<<1, + (PxFilterObjectType::eRIGID_DYNAMIC<<1)|1, + (PxFilterObjectType::eARTICULATION<<1)|1, + (PxFilterObjectType::eSOFTBODY<<1)|1, + (PxFilterObjectType::eFEMCLOTH << 1) | 1, + (PxFilterObjectType::ePARTICLESYSTEM<<1)|1, //PBD + (PxFilterObjectType::ePARTICLESYSTEM<<1)|1, //FLIP + (PxFilterObjectType::ePARTICLESYSTEM<<1)|1, //MPM + (PxFilterObjectType::ePARTICLESYSTEM<<1)|1, //Custom + (PxFilterObjectType::eHAIRSYSTEM<<1)|1, +}; + +static PX_FORCE_INLINE bool isParticleSystem(const PxActorType::Enum actorType) +{ + return actorType == PxActorType::ePBD_PARTICLESYSTEM || actorType == PxActorType::eFLIP_PARTICLESYSTEM + || actorType == PxActorType::eMPM_PARTICLESYSTEM || actorType == PxActorType::eCUSTOM_PARTICLESYSTEM; +} + +// PT: version specialized for ShapeSim/ShapeSim (no triggers) +static PX_FORCE_INLINE PxFilterInfo filterRbCollisionPair(const FilteringContext& context, const ShapeSimBase& s0, const ShapeSimBase& s1) +{ + const ActorSim& rbActor0 = s0.getActor(); + const PxActorType::Enum actorType0 = rbActor0.getActorType(); + const PxU32 typeData0 = gTypeData[actorType0]; + PxFilterObjectAttributes filterAttr0 = typeData0>>1; + bool kine0 = false; + bool isNonRigid = false; + const BodySim* bs0 = NULL; + if (rbActor0.isDynamicRigid()) + { + bs0 = static_cast(&rbActor0); + kine0 = bs0->isKinematic(); + filterAttr0 |= kine0 ? PxFilterObjectFlag::eKINEMATIC : 0; + } + else if (rbActor0.isNonRigid()) + { + isNonRigid = true; + } + + const ActorSim& rbActor1 = s1.getActor(); + const PxActorType::Enum actorType1 = rbActor1.getActorType(); + const PxU32 typeData1 = gTypeData[actorType1]; + PxFilterObjectAttributes filterAttr1 = typeData1 >> 1; + bool kine1 = false; + const BodySim* bs1 = NULL; + if (rbActor1.isDynamicRigid()) + { + bs1 = static_cast(&rbActor1); + kine1 = bs1->isKinematic(); + filterAttr0 |= kine1 ? PxFilterObjectFlag::eKINEMATIC : 0; + } + else if (rbActor1.isNonRigid()) + { + isNonRigid = true; + } + + PX_ASSERT(!(s0.getFlags() & PxShapeFlag::eTRIGGER_SHAPE)); + PX_ASSERT(!(s1.getFlags() & PxShapeFlag::eTRIGGER_SHAPE)); + + if (!isNonRigid && filterKinematics(bs0, bs1, kine0, kine1, context.mKineKineFilteringMode, context.mStaticKineFilteringMode)) + return PxFilterInfo(PxFilterFlag::eSUPPRESS); + + if(filterJointedBodies(rbActor0, rbActor1)) + return PxFilterInfo(PxFilterFlag::eSUPPRESS); + + if(isParticleSystem(actorType0) && isParticleSystem(actorType1)) + return PxFilterInfo(PxFilterFlag::eKILL); + + if(actorType0 == PxActorType::eHAIRSYSTEM && actorType1 == PxActorType::eHAIRSYSTEM) + return PxFilterInfo(PxFilterFlag::eKILL); + + + if ((actorType0 == PxActorType::eARTICULATION_LINK) ^ (actorType1 == PxActorType::eARTICULATION_LINK)) + { + if(actorType0 == PxActorType::eARTICULATION_LINK) + { + const BodySim& b0 = static_cast(rbActor0); + const PxU8 kinematicLink = b0.getLowLevelBody().mCore->kinematicLink; + const bool isStaticOrKinematic = (actorType1 == PxActorType::eRIGID_STATIC) || kine1; + if (kinematicLink && isStaticOrKinematic) + return PxFilterInfo(PxFilterFlag::eSUPPRESS); + } + + if (actorType1 == PxActorType::eARTICULATION_LINK) + { + const BodySim& b1 = static_cast(rbActor1); + const PxU8 kinematicLink = b1.getLowLevelBody().mCore->kinematicLink; + const bool isStaticOrKinematic = (actorType0 == PxActorType::eRIGID_STATIC) || kine0; + if (kinematicLink && isStaticOrKinematic) + return PxFilterInfo(PxFilterFlag::eSUPPRESS); + } + } + + if((actorType0 == PxActorType::eARTICULATION_LINK) && (actorType1 == PxActorType::eARTICULATION_LINK)) + { + const BodySim& b0 = static_cast(rbActor0); + const BodySim& b1 = static_cast(rbActor1); + const PxU8 kinematicLink0 = b0.getLowLevelBody().mCore->kinematicLink; + const PxU8 kinematicLink1 = b1.getLowLevelBody().mCore->kinematicLink; + if (kinematicLink0 && kinematicLink1) + return PxFilterInfo(PxFilterFlag::eSUPPRESS); + + if(filterArticulationLinks(rbActor0, rbActor1)) + return PxFilterInfo(PxFilterFlag::eKILL); + } + + return filterRbCollisionPairSecondStage(context, s0, s1, kine0, kine1, filterAttr0, filterAttr1, isNonRigid); +} + +void NPhaseCore::runOverlapFilters( PxU32 nbToProcess, const Bp::AABBOverlap* PX_RESTRICT pairs, PxFilterInfo* PX_RESTRICT filterInfo, + PxU32& nbToKeep_, PxU32& nbToSuppress_, PxU32& nbToCallback_, PxU32* PX_RESTRICT keepMap, PxU32* PX_RESTRICT callbackMap) +{ + PxU32 nbToKeep = 0; + PxU32 nbToSuppress = 0; + PxU32 nbToCallback = 0; + + const FilteringContext context(mOwnerScene, mFilterPairManager); + + for(PxU32 i=0; i(pair.mUserData0); + ElementSim* e1 = reinterpret_cast(pair.mUserData1); + + PX_ASSERT(e0); + PX_ASSERT(e1); + + // PT: a bit of defensive coding added for OM-74224. In theory this should not be needed, as the broadphase is not + // supposed to return null pointers here. But there seems to be an issue somewhere, most probably in the GPU BP kernels, + // and this is an attempt at preventing a crash. We could/should remove this eventually. + if(!e0 || !e1) + { + PxGetFoundation().error(PxErrorCode::eINTERNAL_ERROR, PX_FL, "NPhaseCore::runOverlapFilters: found null elements!"); + continue; + } + + PX_ASSERT(!findInteraction(e0, e1)); + + ShapeSimBase* s0 = static_cast(e0); + ShapeSimBase* s1 = static_cast(e1); + PX_ASSERT(&s0->getActor() != &s1->getActor()); // No actor internal interactions + + filterInfo[i] = filterRbCollisionPair(context, *s0, *s1); + + const PxFilterFlags filterFlags = filterInfo[i].filterFlags; + + if(!(filterFlags & PxFilterFlag::eKILL)) + { + if(filterFlags & PxFilterFlag::eCALLBACK) + { + nbToCallback++; + callbackMap[i / 32] |= (1 << (i & 31)); + } + else + { + if(!(filterFlags & PxFilterFlag::eSUPPRESS)) + nbToKeep++; + else + nbToSuppress++; + keepMap[i / 32] |= (1 << (i & 31)); + } + } + } + + nbToKeep_ = nbToKeep; + nbToSuppress_ = nbToSuppress; + nbToCallback_ = nbToCallback; +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +NPhaseCore::NPhaseCore(Scene& scene, const PxSceneDesc& sceneDesc) : + mOwnerScene (scene), + mContactReportActorPairSet ("contactReportPairSet"), + mPersistentContactEventPairList ("persistentContactEventPairs"), + mNextFramePersistentContactEventPairIndex (0), + mForceThresholdContactEventPairList ("forceThresholdContactEventPairs"), + mContactReportBuffer (sceneDesc.contactReportStreamBufferSize, (sceneDesc.flags & PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE)), + mActorPairPool ("actorPairPool"), + mActorPairReportPool ("actorPairReportPool"), + mShapeInteractionPool (PxAllocatorTraits::Type("shapeInteractionPool"), 4096), + mTriggerInteractionPool ("triggerInteractionPool"), + mActorPairContactReportDataPool ("actorPairContactReportPool"), + mInteractionMarkerPool ("interactionMarkerPool") + ,mMergeProcessedTriggerInteractions (scene.getContextId(), this, "ScNPhaseCore.mergeProcessedTriggerInteractions") + ,mTmpTriggerProcessingBlock (NULL) + ,mTriggerPairsToDeactivateCount (0) +{ + mFilterPairManager = PX_NEW(FilterPairManager); +} + +NPhaseCore::~NPhaseCore() +{ + // Clear pending actor pairs (waiting on contact report callback) + clearContactReportActorPairs(false); + PX_DELETE(mFilterPairManager); +} + +PxU32 NPhaseCore::getDefaultContactReportStreamBufferSize() const +{ + return mContactReportBuffer.getDefaultBufferSize(); +} + +ElementSimInteraction* NPhaseCore::findInteraction(ElementSim* _element0, ElementSim* _element1) +{ + const PxHashMap::Entry* pair = mElementSimMap.find(ElementSimKey(_element0, _element1)); + return pair ? pair->second : NULL; +} + +void NPhaseCore::onTriggerOverlapCreated(const Bp::AABBOverlap* PX_RESTRICT pairs, PxU32 pairCount) +{ + for(PxU32 i=0; i(pairs[i].mUserData0); + ElementSim* volume1 = reinterpret_cast(pairs[i].mUserData1); + PX_ASSERT(!findInteraction(volume0, volume1)); + + ShapeSimBase* shapeHi = static_cast(volume1); + ShapeSimBase* shapeLo = static_cast(volume0); + + // No actor internal interactions + PX_ASSERT(&shapeHi->getActor() != &shapeLo->getActor()); + + // PT: this case is only for triggers these days + PX_ASSERT((shapeLo->getFlags() & PxShapeFlag::eTRIGGER_SHAPE) || (shapeHi->getFlags() & PxShapeFlag::eTRIGGER_SHAPE)); + + createTriggerElementInteraction(*shapeHi, *shapeLo); + } +} + +void NPhaseCore::reserveInteraction(PxU32 nbNewInteractions) +{ + if ((mElementSimMap.size() + nbNewInteractions) > mElementSimMap.capacity()) + { + PX_PROFILE_ZONE("Reserve", 0); + PxU32 newSize = PxMax(mElementSimMap.size() + nbNewInteractions, mElementSimMap.capacity()); + mElementSimMap.reserve(newSize); + } +} + +void NPhaseCore::registerInteraction(ElementSimInteraction* interaction) +{ + mElementSimMap.insert(ElementSimKey(&interaction->getElement0(), &interaction->getElement1()), interaction); +} + +void NPhaseCore::unregisterInteraction(ElementSimInteraction* interaction) +{ + mElementSimMap.erase(ElementSimKey(&interaction->getElement0(), &interaction->getElement1())); +} + +ElementSimInteraction* NPhaseCore::onOverlapRemovedStage1(ElementSim* volume0, ElementSim* volume1) +{ + return findInteraction(volume0, volume1); +} + +void NPhaseCore::onOverlapRemoved(ElementSim* volume0, ElementSim* volume1, const PxU32 ccdPass, void* elemSim, PxsContactManagerOutputIterator& outputs) +{ + ElementSim* elementHi = volume1; + ElementSim* elementLo = volume0; + // No actor internal interactions + PX_ASSERT(&elementHi->getActor() != &elementLo->getActor()); + + // PT: TODO: get rid of 'findInteraction', cf US10491 + ElementSimInteraction* interaction = elemSim ? reinterpret_cast(elemSim) : findInteraction(elementHi, elementLo); + // MS: The check below is necessary since at the moment LowLevel broadphase still tracks + // killed pairs and hence reports lost overlaps + if(interaction) + { + PxU32 flags = PxU32(PairReleaseFlag::eWAKE_ON_LOST_TOUCH); + PX_ASSERT(interaction->isElementInteraction()); + releaseElementPair(static_cast(interaction), flags, NULL, ccdPass, true, outputs); + } +} + +// MS: TODO: optimize this for the actor release case? +void NPhaseCore::onVolumeRemoved(ElementSim* volume, PxU32 flags, PxsContactManagerOutputIterator& outputs) +{ + const PxU32 ccdPass = 0; + + flags |= PairReleaseFlag::eRUN_LOST_TOUCH_LOGIC; + + // Release interactions + // IMPORTANT: Iterate from the back of the list to the front as we release interactions which + // triggers a replace with last + ElementSim::ElementInteractionReverseIterator iter = volume->getElemInteractionsReverse(); + ElementSimInteraction* interaction = iter.getNext(); + while(interaction) + { + PX_ASSERT( (interaction->getType() == InteractionType::eMARKER) || + (interaction->getType() == InteractionType::eOVERLAP) || + (interaction->getType() == InteractionType::eTRIGGER) ); + + releaseElementPair(interaction, flags, volume, ccdPass, true, outputs); + + interaction = iter.getNext(); + } +} + +ElementSimInteraction* NPhaseCore::createRbElementInteraction(const PxFilterInfo& finfo, ShapeSimBase& s0, ShapeSimBase& s1, PxsContactManager* contactManager, ShapeInteraction* shapeInteraction, + ElementInteractionMarker* interactionMarker, bool isTriggerPair) +{ + ElementSimInteraction* pair = NULL; + + if((finfo.filterFlags & PxFilterFlag::eSUPPRESS) == false) + { + if(!isTriggerPair) + { + PX_ASSERT(contactManager); + PX_ASSERT(shapeInteraction); + pair = createShapeInteraction(s0, s1, finfo.pairFlags, contactManager, shapeInteraction); + } + else + { + pair = createTriggerInteraction(s0, s1, finfo.pairFlags); + } + } + else + pair = createElementInteractionMarker(s0, s1, interactionMarker); + + if(finfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX) + { + // Mark the pair as a filter callback pair + pair->raiseInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); + + // Filter callback pair: Set the link to the interaction + mFilterPairManager->setPair(finfo.filterPairIndex, pair); + pair->setFilterPairIndex(finfo.filterPairIndex); + } + + return pair; +} + +ElementSimInteraction* NPhaseCore::createTriggerElementInteraction(ShapeSimBase& s0, ShapeSimBase& s1) +{ + PX_ASSERT((s0.getFlags() & PxShapeFlag::eTRIGGER_SHAPE) || (s1.getFlags() & PxShapeFlag::eTRIGGER_SHAPE)); + + const FilteringContext context(mOwnerScene, mFilterPairManager); + + bool isTriggerPair; + const PxFilterInfo finfo = filterRbCollisionPair(context, s0, s1, INVALID_FILTER_PAIR_INDEX, isTriggerPair, false); + PX_ASSERT(isTriggerPair); + + if(finfo.filterFlags & PxFilterFlag::eKILL) + { + PX_ASSERT(finfo.filterPairIndex == INVALID_FILTER_PAIR_INDEX); // No filter callback pair info for killed pairs + return NULL; + } + + return createRbElementInteraction(finfo, s0, s1, NULL, NULL, NULL, isTriggerPair); +} + +void NPhaseCore::managerNewTouch(ShapeInteraction& interaction) +{ + //(1) if the pair hasn't already been assigned, look it up! + + ActorPair* actorPair = interaction.getActorPair(); + + if(!actorPair) + { + ShapeSim& s0 = static_cast(interaction.getElement0()); + ShapeSim& s1 = static_cast(interaction.getElement1()); + actorPair = findActorPair(&s0, &s1, interaction.isReportPair()); + actorPair->incRefCount(); //It's being referenced by a new pair... + interaction.setActorPair(*actorPair); + } +} + +ShapeInteraction* NPhaseCore::createShapeInteraction(ShapeSimBase& s0, ShapeSimBase& s1, PxPairFlags pairFlags, PxsContactManager* contactManager, ShapeInteraction* shapeInteraction) +{ + ShapeSimBase* _s0 = &s0; + ShapeSimBase* _s1 = &s1; + + /* + This tries to ensure that if one of the bodies is static or kinematic, it will be body B + There is a further optimization to force all pairs that share the same bodies to have + the same body ordering. This reduces the number of required partitions in the parallel solver. + Sorting rules are: + If bodyA is static, swap + If bodyA is rigidDynamic and bodyB is articulation, swap + If bodyA is in an earlier BP group than bodyB, swap + */ + { + ActorSim& rs0 = s0.getActor(); + ActorSim& rs1 = s1.getActor(); + + const PxActorType::Enum actorType0 = rs0.getActorType(); + const PxActorType::Enum actorType1 = rs1.getActorType(); + + bool articulationLinkSwap = false; + if (actorType0 == PxActorType::eARTICULATION_LINK && actorType1 == PxActorType::eARTICULATION_LINK) + { + BodySim& bodySim0 = static_cast(rs0); + + const PxU8 kinematicLink0 = bodySim0.getLowLevelBody().mCore->kinematicLink; + + if (kinematicLink0) + { + articulationLinkSwap = true; + } + } + + bool actorAKinematic = actorType0 == PxActorType::eRIGID_DYNAMIC && static_cast(rs0).isKinematic(); + bool actorBKinematic = actorType1 == PxActorType::eRIGID_DYNAMIC && static_cast(rs1).isKinematic(); + + + if( actorType0 == PxActorType::eRIGID_STATIC + || (actorType1 == PxActorType::eRIGID_DYNAMIC && actorType0 == PxActorType::eARTICULATION_LINK) + || articulationLinkSwap + || (isParticleSystem(actorType0) && actorType1 != PxActorType::eRIGID_STATIC) + || ((actorType0 == PxActorType::eRIGID_DYNAMIC && actorType1 == PxActorType::eRIGID_DYNAMIC) && actorAKinematic) + || (actorType0 == actorType1 && rs0.getActorID() < rs1.getActorID() && !actorBKinematic)) + PxSwap(_s0, _s1); + } + + ShapeInteraction* si = shapeInteraction ? shapeInteraction : mShapeInteractionPool.allocate(); + PX_PLACEMENT_NEW(si, ShapeInteraction)(*_s0, *_s1, pairFlags, contactManager); + + PX_ASSERT(si->mReportPairIndex == INVALID_REPORT_PAIR_ID); + + return si; +} + +TriggerInteraction* NPhaseCore::createTriggerInteraction(ShapeSimBase& s0, ShapeSimBase& s1, PxPairFlags triggerFlags) +{ + ShapeSimBase* triggerShape; + ShapeSimBase* otherShape; + + if(s1.getFlags() & PxShapeFlag::eTRIGGER_SHAPE) + { + triggerShape = &s1; + otherShape = &s0; + } + else + { + triggerShape = &s0; + otherShape = &s1; + } + TriggerInteraction* pair = mTriggerInteractionPool.construct(*triggerShape, *otherShape); + pair->setTriggerFlags(triggerFlags); + return pair; +} + +ElementInteractionMarker* NPhaseCore::createElementInteractionMarker(ElementSim& e0, ElementSim& e1, ElementInteractionMarker* interactionMarker) +{ + ElementInteractionMarker* pair = interactionMarker ? interactionMarker : mInteractionMarkerPool.allocate(); + PX_PLACEMENT_NEW(pair, ElementInteractionMarker)(e0, e1, interactionMarker != NULL); + return pair; +} + +ElementSimInteraction* NPhaseCore::refilterInteraction(ElementSimInteraction* pair, const PxFilterInfo* filterInfo, bool removeFromDirtyList, PxsContactManagerOutputIterator& outputs) +{ + const InteractionType::Enum oldType = pair->getType(); + + switch (oldType) + { + case InteractionType::eTRIGGER: + case InteractionType::eMARKER: + case InteractionType::eOVERLAP: + { + ShapeSimBase& s0 = static_cast(pair->getElement0()); + ShapeSimBase& s1 = static_cast(pair->getElement1()); + + PxFilterInfo finfo; + if(filterInfo) + { + // The filter changes are provided by an outside source (the user filter callback) + + finfo = *filterInfo; + PX_ASSERT(finfo.filterPairIndex!=INVALID_FILTER_PAIR_INDEX); + + if((finfo.filterFlags & PxFilterFlag::eKILL) && + ((finfo.filterFlags & PxFilterFlag::eNOTIFY) == PxFilterFlag::eNOTIFY) ) + { + callPairLost(mOwnerScene, pair->getElement0(), pair->getElement1(), finfo.filterPairIndex, false); + mFilterPairManager->releaseIndex(finfo.filterPairIndex); + finfo.filterPairIndex = INVALID_FILTER_PAIR_INDEX; + } + + ActorSim& bs0 = s0.getActor(); + ActorSim& bs1 = s1.getActor(); + finfo.pairFlags = checkRbPairFlags(s0, s1, bs0, bs1, finfo.pairFlags, finfo.filterFlags, s0.getActor().isNonRigid() || s1.getActor().isNonRigid()); + } + else + { + PxU32 filterPairIndex = INVALID_FILTER_PAIR_INDEX; + if(pair->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)) + { + filterPairIndex = mFilterPairManager->findIndex(pair); + PX_ASSERT(filterPairIndex!=INVALID_FILTER_PAIR_INDEX); + + callPairLost(mOwnerScene, pair->getElement0(), pair->getElement1(), filterPairIndex, false); + } + + const FilteringContext context(mOwnerScene, mFilterPairManager); + + bool isTriggerPair; + finfo = filterRbCollisionPair(context, s0, s1, filterPairIndex, isTriggerPair, true); + PX_UNUSED(isTriggerPair); + } + + if(pair->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR) && + ((finfo.filterFlags & PxFilterFlag::eNOTIFY) != PxFilterFlag::eNOTIFY) ) + { + // The pair was a filter callback pair but not any longer + pair->clearInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); + + if(finfo.filterPairIndex!=INVALID_FILTER_PAIR_INDEX) + { + mFilterPairManager->releaseIndex(finfo.filterPairIndex); + finfo.filterPairIndex = INVALID_FILTER_PAIR_INDEX; + } + } + + struct Local + { + static InteractionType::Enum getRbElementInteractionType(const ShapeSimBase* primitive0, const ShapeSimBase* primitive1, PxFilterFlags filterFlag) + { + if(filterFlag & PxFilterFlag::eKILL) + return InteractionType::eINVALID; + + if(filterFlag & PxFilterFlag::eSUPPRESS) + return InteractionType::eMARKER; + + if(primitive0->getFlags() & PxShapeFlag::eTRIGGER_SHAPE + || primitive1->getFlags() & PxShapeFlag::eTRIGGER_SHAPE) + return InteractionType::eTRIGGER; + + PX_ASSERT( (primitive0->getGeometryType() != PxGeometryType::eTRIANGLEMESH) || + (primitive1->getGeometryType() != PxGeometryType::eTRIANGLEMESH)); + + return InteractionType::eOVERLAP; + } + }; + + const InteractionType::Enum newType = Local::getRbElementInteractionType(&s0, &s1, finfo.filterFlags); + if(pair->getType() != newType) //Only convert interaction type if the type has changed + { + return convert(pair, newType, finfo, removeFromDirtyList, outputs); + } + else + { + //The pair flags might have changed, we need to forward the new ones + if(oldType == InteractionType::eOVERLAP) + { + ShapeInteraction* si = static_cast(pair); + + const PxU32 newPairFlags = finfo.pairFlags; + const PxU32 oldPairFlags = si->getPairFlags(); + PX_ASSERT((newPairFlags & ShapeInteraction::PAIR_FLAGS_MASK) == newPairFlags); + PX_ASSERT((oldPairFlags & ShapeInteraction::PAIR_FLAGS_MASK) == oldPairFlags); + + if(newPairFlags != oldPairFlags) + { + if(!(oldPairFlags & ShapeInteraction::CONTACT_REPORT_EVENTS) && (newPairFlags & ShapeInteraction::CONTACT_REPORT_EVENTS) && (si->getActorPair() == NULL || !si->getActorPair()->isReportPair())) + { + // for this actor pair there was no shape pair that requested contact reports but now there is one + // -> all the existing shape pairs need to get re-adjusted to point to an ActorPairReport instance instead. + ActorPair* actorPair = findActorPair(&s0, &s1, PxIntTrue); + if (si->getActorPair() == NULL) + { + actorPair->incRefCount(); + si->setActorPair(*actorPair); + } + } + + if(si->readFlag(ShapeInteraction::IN_PERSISTENT_EVENT_LIST) && (!(newPairFlags & PxPairFlag::eNOTIFY_TOUCH_PERSISTS))) + { + // the new report pair flags don't require persistent checks anymore -> remove from persistent list + // Note: The pair might get added to the force threshold list later + if(si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)) + removeFromPersistentContactEventPairs(si); + else + si->clearFlag(ShapeInteraction::WAS_IN_PERSISTENT_EVENT_LIST); + } + + if(newPairFlags & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS) + { + PX_ASSERT((si->mReportPairIndex == INVALID_REPORT_PAIR_ID) || (!si->readFlag(ShapeInteraction::WAS_IN_PERSISTENT_EVENT_LIST))); + + if(si->mReportPairIndex == INVALID_REPORT_PAIR_ID && si->readInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + PX_ASSERT(!si->readFlag(ShapeInteraction::WAS_IN_PERSISTENT_EVENT_LIST)); // sanity check: an active pair should never have this flag set + + if(si->hasTouch()) + addToForceThresholdContactEventPairs(si); + } + } + else if((oldPairFlags & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS)) + { + // no force threshold events needed any longer -> clear flags + si->clearFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_FLAGS); + + if(si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)) + removeFromForceThresholdContactEventPairs(si); + } + } + si->setPairFlags(finfo.pairFlags); + } + else if(oldType == InteractionType::eTRIGGER) + static_cast(pair)->setTriggerFlags(finfo.pairFlags); + + return pair; + } + } + case InteractionType::eCONSTRAINTSHADER: + case InteractionType::eARTICULATION: + case InteractionType::eTRACKED_IN_SCENE_COUNT: + case InteractionType::eINVALID: + PX_ASSERT(0); + break; + } + return NULL; +} + +ActorPair* NPhaseCore::findActorPair(ShapeSimBase* s0, ShapeSimBase* s1, PxIntBool isReportPair) +{ + PX_ASSERT(!(s0->getFlags() & PxShapeFlag::eTRIGGER_SHAPE) + && !(s1->getFlags() & PxShapeFlag::eTRIGGER_SHAPE)); + // This method is only for the case where a ShapeInteraction is going to be created. + // Else we might create an ActorPair that does not get referenced and causes a mem leak. + + BodyPairKey key; + + ActorSim* aLess = &s0->getActor(); + ActorSim* aMore = &s1->getActor(); + + if(aLess->getActorID() > aMore->getActorID()) + PxSwap(aLess, aMore); + + key.mSim0 = aLess->getActorID(); + key.mSim1 = aMore->getActorID(); + + ActorPair*& actorPair = mActorPairMap[key]; + + if(actorPair == NULL) + { + if(!isReportPair) + actorPair = mActorPairPool.construct(); + else + actorPair = mActorPairReportPool.construct(s0->getActor(), s1->getActor()); + } + + PxIntBool actorPairHasReports = actorPair->isReportPair(); + + if(!isReportPair || actorPairHasReports) + return actorPair; + else + { + PxU32 size = aLess->getActorInteractionCount(); + Interaction** interactions = aLess->getActorInteractions(); + + ActorPairReport* actorPairReport = mActorPairReportPool.construct(s0->getActor(), s1->getActor()); + actorPairReport->convert(*actorPair); + + while(size--) + { + Interaction* interaction = *interactions++; + if((&interaction->getActorSim0() == aMore) || (&interaction->getActorSim1() == aMore)) + { + PX_ASSERT(((&interaction->getActorSim0() == aLess) || (&interaction->getActorSim1() == aLess))); + + if(interaction->getType() == InteractionType::eOVERLAP) + { + ShapeInteraction* si = static_cast(interaction); + if(si->getActorPair() != NULL) + si->setActorPair(*actorPairReport); + } + } + } + actorPair = actorPairReport; + } + return actorPair; +} + +PX_FORCE_INLINE void NPhaseCore::destroyActorPairReport(ActorPairReport& aPair) +{ + PX_ASSERT(aPair.isReportPair()); + + aPair.releaseContactReportData(*this); + mActorPairReportPool.destroy(&aPair); +} + +ElementSimInteraction* NPhaseCore::convert(ElementSimInteraction* pair, InteractionType::Enum newType, PxFilterInfo& filterInfo, bool removeFromDirtyList, + PxsContactManagerOutputIterator& outputs) +{ + PX_ASSERT(newType != pair->getType()); + + ElementSim& elementA = pair->getElement0(); + ElementSim& elementB = pair->getElement1(); + + // Wake up the actors of the pair + if((pair->getActorSim0().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast(pair->getActorSim0()).isActive())) + pair->getActorSim0().internalWakeUp(); + if((pair->getActorSim1().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast(pair->getActorSim1()).isActive())) + pair->getActorSim1().internalWakeUp(); + + // Since the FilterPair struct might have been re-used in the newly created interaction, we need to clear + // the filter pair marker of the old interaction to avoid that the FilterPair gets deleted by the releaseElementPair() + // call that follows. + pair->clearInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); + + // PT: we need to unregister the old interaction *before* creating the new one, because Sc::NPhaseCore::registerInteraction will use + // ElementSim pointers which are the same for both. Since "releaseElementPair" will call the unregister function from + // the element's dtor, we don't need to do it explicitly here. Just release the object. + releaseElementPair(pair, PairReleaseFlag::eWAKE_ON_LOST_TOUCH | PairReleaseFlag::eRUN_LOST_TOUCH_LOGIC, NULL, 0, removeFromDirtyList, outputs); + + ElementSimInteraction* result = NULL; + switch(newType) + { + case InteractionType::eINVALID: + // This means the pair should get killed + break; + case InteractionType::eMARKER: + { + result = createElementInteractionMarker(elementA, elementB, NULL); + break; + } + case InteractionType::eOVERLAP: + { + result = createShapeInteraction(static_cast(elementA), static_cast(elementB), filterInfo.pairFlags, NULL, NULL); + break; + } + case InteractionType::eTRIGGER: + { + result = createTriggerInteraction(static_cast(elementA), static_cast(elementB), filterInfo.pairFlags); + break; + } + case InteractionType::eCONSTRAINTSHADER: + case InteractionType::eARTICULATION: + case InteractionType::eTRACKED_IN_SCENE_COUNT: + PX_ASSERT(0); + break; + }; + + if(filterInfo.filterPairIndex != INVALID_FILTER_PAIR_INDEX) + { + PX_ASSERT(result); + // If a filter callback pair is going to get killed, then the FilterPair struct should already have + // been deleted. + + // Mark the new interaction as a filter callback pair + result->raiseInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); + + mFilterPairManager->setPair(filterInfo.filterPairIndex, result); + result->setFilterPairIndex(filterInfo.filterPairIndex); + } + return result; +} + +namespace physx +{ +namespace Sc +{ +static bool findTriggerContacts(TriggerInteraction* tri, bool toBeDeleted, bool volumeRemoved, + PxTriggerPair& triggerPair, TriggerPairExtraData& triggerPairExtra, + SimStats::TriggerPairCountsNonVolatile& triggerPairStats, + const PxsTransformCache& transformCache) +{ + ShapeSimBase& s0 = tri->getTriggerShape(); + ShapeSimBase& s1 = tri->getOtherShape(); + + const PxPairFlags pairFlags = tri->getTriggerFlags(); + PxPairFlags pairEvent; + + bool overlap; + PxU8 testForRemovedShapes = 0; + if(toBeDeleted) + { + // The trigger interaction is to lie down in its tomb, hence we know that the overlap is gone. + // What remains is to check whether the interaction was deleted because of a shape removal in + // which case we need to later check for removed shapes. + + overlap = false; + + if(volumeRemoved) + { + // Note: only the first removed volume can be detected when the trigger interaction is deleted but at a later point the second volume might get removed too. + testForRemovedShapes = TriggerPairFlag::eTEST_FOR_REMOVED_SHAPES; + } + } + else + { +#if PX_ENABLE_SIM_STATS + PX_ASSERT(s0.getGeometryType() < PxGeometryType::eCONVEXMESH+1); // The first has to be the trigger shape + triggerPairStats[s0.getGeometryType()][s1.getGeometryType()]++; +#else + PX_UNUSED(triggerPairStats); + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + ShapeSimBase* primitive0 = &s0; + ShapeSimBase* primitive1 = &s1; + + PX_ASSERT(primitive0->getFlags() & PxShapeFlag::eTRIGGER_SHAPE + || primitive1->getFlags() & PxShapeFlag::eTRIGGER_SHAPE); + + // Reorder them if needed + if(primitive0->getGeometryType() > primitive1->getGeometryType()) + PxSwap(primitive0, primitive1); + + const Gu::GeomOverlapFunc overlapFunc = + Gu::getOverlapFuncTable()[primitive0->getGeometryType()][primitive1->getGeometryType()]; + + const PxU32 elementID0 = primitive0->getElementID(); + const PxU32 elementID1 = primitive1->getElementID(); + + const PxTransform& globalPose0 = transformCache.getTransformCache(elementID0).transform; + + const PxTransform& globalPose1 = transformCache.getTransformCache(elementID1).transform; + + PX_ASSERT(overlapFunc); + overlap = overlapFunc( primitive0->getCore().getGeometry(), globalPose0, + primitive1->getCore().getGeometry(), globalPose1, + &tri->getTriggerCache(), UNUSED_OVERLAP_THREAD_CONTEXT); + } + + const bool hadOverlap = tri->lastFrameHadContacts(); + if(hadOverlap) + { + if(!overlap) + pairEvent = PxPairFlag::eNOTIFY_TOUCH_LOST; + } + else + { + if(overlap) + pairEvent = PxPairFlag::eNOTIFY_TOUCH_FOUND; + } + tri->updateLastFrameHadContacts(overlap); + + const PxPairFlags triggeredFlags = pairEvent & pairFlags; + if(triggeredFlags) + { + triggerPair.triggerShape = s0.getPxShape(); + triggerPair.otherShape = s1.getPxShape(); + triggerPair.status = PxPairFlag::Enum(PxU32(pairEvent)); + triggerPair.flags = PxTriggerPairFlags(testForRemovedShapes); + + const ActorCore& actorCore0 = s0.getActor().getActorCore(); + const ActorCore& actorCore1 = s1.getActor().getActorCore(); + +#if PX_SUPPORT_GPU_PHYSX + if (actorCore0.getActorCoreType() == PxActorType::eSOFTBODY) + triggerPair.triggerActor = static_cast(actorCore0).getPxActor(); + else +#endif + triggerPair.triggerActor = static_cast(actorCore0).getPxActor(); + +#if PX_SUPPORT_GPU_PHYSX + if (actorCore0.getActorCoreType() == PxActorType::eSOFTBODY) + triggerPair.otherActor = static_cast(actorCore1).getPxActor(); + else +#endif + triggerPair.otherActor = static_cast(actorCore1).getPxActor(); + + + triggerPairExtra = TriggerPairExtraData(s0.getElementID(), s1.getElementID(), + actorCore0.getOwnerClient(), actorCore1.getOwnerClient()); + return true; + } + return false; +} + +class TriggerContactTask : public Cm::Task +{ +private: + TriggerContactTask& operator = (const TriggerContactTask&); + +public: + TriggerContactTask(Interaction* const* triggerPairs, PxU32 triggerPairCount, PxMutex& lock, + TriggerInteraction** pairsToDeactivate, volatile PxI32& pairsToDeactivateCount, + Scene& scene, PxsTransformCache& transformCache): + Cm::Task(scene.getContextId()), + mTriggerPairs(triggerPairs), + mTriggerPairCount(triggerPairCount), + mLock(lock), + mPairsToDeactivate(pairsToDeactivate), + mPairsToDeactivateCount(pairsToDeactivateCount), + mScene(scene), + mTransformCache(transformCache) + { + } + + virtual void runInternal() + { + SimStats::TriggerPairCountsNonVolatile triggerPairStats; +#if PX_ENABLE_SIM_STATS + PxMemZero(&triggerPairStats, sizeof(SimStats::TriggerPairCountsNonVolatile)); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + PxTriggerPair triggerPair[sTriggerPairsPerTask]; + TriggerPairExtraData triggerPairExtra[sTriggerPairsPerTask]; + PxU32 triggerReportItemCount = 0; + + TriggerInteraction* deactivatePairs[sTriggerPairsPerTask]; + PxI32 deactivatePairCount = 0; + + + for(PxU32 i=0; i < mTriggerPairCount; i++) + { + TriggerInteraction* tri = static_cast(mTriggerPairs[i]); + + PX_ASSERT(tri->readInteractionFlag(InteractionFlag::eIS_ACTIVE)); + + if(findTriggerContacts(tri, false, false, triggerPair[triggerReportItemCount], + triggerPairExtra[triggerReportItemCount], triggerPairStats, mTransformCache)) + triggerReportItemCount++; + + if(!(tri->readFlag(TriggerInteraction::PROCESS_THIS_FRAME))) + { + // active trigger pairs for which overlap tests were not forced should remain in the active list + // to catch transitions between overlap and no overlap + continue; + } + else + { + tri->clearFlag(TriggerInteraction::PROCESS_THIS_FRAME); + + // explicitly scheduled overlap test is done (after object creation, teleport, ...). Check if trigger pair should remain active or not. + + if(!tri->onActivate_(0)) + { + PX_ASSERT(tri->readInteractionFlag(InteractionFlag::eIS_ACTIVE)); + // Why is the assert enough? + // Once an explicit overlap test is scheduled, the interaction can not get deactivated anymore until it got processed. + + tri->clearInteractionFlag(InteractionFlag::eIS_ACTIVE); + deactivatePairs[deactivatePairCount] = tri; + deactivatePairCount++; + } + } + } + + if(triggerReportItemCount) + { + PxTriggerPair* triggerPairBuffer; + TriggerPairExtraData* triggerPairExtraBuffer; + + { + PxMutex::ScopedLock lock(mLock); + + mScene.reserveTriggerReportBufferSpace(triggerReportItemCount, triggerPairBuffer, triggerPairExtraBuffer); + + PxMemCopy(triggerPairBuffer, triggerPair, sizeof(PxTriggerPair) * triggerReportItemCount); + PxMemCopy(triggerPairExtraBuffer, triggerPairExtra, sizeof(TriggerPairExtraData) * triggerReportItemCount); + } + } + + if(deactivatePairCount) + { + PxI32 newSize = PxAtomicAdd(&mPairsToDeactivateCount, deactivatePairCount); + PxMemCopy(mPairsToDeactivate + newSize - deactivatePairCount, deactivatePairs, sizeof(TriggerInteraction*) * deactivatePairCount); + } + +#if PX_ENABLE_SIM_STATS + SimStats& simStats = mScene.getStatsInternal(); + for(PxU32 i=0; i < PxGeometryType::eCONVEXMESH+1; i++) + { + for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++) + { + if(triggerPairStats[i][j] != 0) + PxAtomicAdd(&simStats.numTriggerPairs[i][j], triggerPairStats[i][j]); + } + } +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + } + + virtual const char* getName() const + { + return "ScNPhaseCore.triggerInteractionWork"; + } + +public: + static const PxU32 sTriggerPairsPerTask = 64; + +private: + Interaction* const* mTriggerPairs; + const PxU32 mTriggerPairCount; + PxMutex& mLock; + TriggerInteraction** mPairsToDeactivate; + volatile PxI32& mPairsToDeactivateCount; + Scene& mScene; + PxsTransformCache& mTransformCache; +}; + +} // namespace Sc +} // namespace physx + +void NPhaseCore::processTriggerInteractions(PxBaseTask* continuation) +{ + PX_ASSERT(!mTmpTriggerProcessingBlock); + PX_ASSERT(mTriggerPairsToDeactivateCount == 0); + + Scene& scene = mOwnerScene; + + // Triggers + Interaction** triggerInteractions = mOwnerScene.getActiveInteractions(InteractionType::eTRIGGER); + const PxU32 pairCount = mOwnerScene.getNbActiveInteractions(InteractionType::eTRIGGER); + + if(pairCount > 0) + { + const PxU32 taskCountWithoutRemainder = pairCount / TriggerContactTask::sTriggerPairsPerTask; + const PxU32 maxTaskCount = taskCountWithoutRemainder + 1; + const PxU32 pairPtrSize = pairCount * sizeof(TriggerInteraction*); + const PxU32 memBlockSize = pairPtrSize + (maxTaskCount * sizeof(TriggerContactTask)); + void* triggerProcessingBlock = scene.getLowLevelContext()->getScratchAllocator().alloc(memBlockSize, true); + if(triggerProcessingBlock) + { + const bool hasMultipleThreads = scene.getTaskManager().getCpuDispatcher()->getWorkerCount() > 1; + const bool moreThanOneBatch = pairCount > TriggerContactTask::sTriggerPairsPerTask; + const bool scheduleTasks = hasMultipleThreads && moreThanOneBatch; + // when running on a single thread, the task system seems to cause the main overhead (locking and atomic operations + // seemed less of an issue). Hence, the tasks get run directly in that case. Same if there is only one batch. + + mTmpTriggerProcessingBlock = triggerProcessingBlock; // note: gets released in the continuation task + if(scheduleTasks) + mMergeProcessedTriggerInteractions.setContinuation(continuation); + + TriggerInteraction** triggerPairsToDeactivateWriteBack = reinterpret_cast(triggerProcessingBlock); + TriggerContactTask* triggerContactTaskBuffer = reinterpret_cast(reinterpret_cast(triggerProcessingBlock) + pairPtrSize); + PxsTransformCache& transformCache = mOwnerScene.getLowLevelContext()->getTransformCache(); + + PxU32 remainder = pairCount; + while(remainder) + { + const PxU32 nb = remainder > TriggerContactTask::sTriggerPairsPerTask ? TriggerContactTask::sTriggerPairsPerTask : remainder; + remainder -= nb; + + TriggerContactTask* task = triggerContactTaskBuffer; + task = PX_PLACEMENT_NEW(task, TriggerContactTask( triggerInteractions, nb, mTriggerWriteBackLock, + triggerPairsToDeactivateWriteBack, mTriggerPairsToDeactivateCount, scene, transformCache)); + if(scheduleTasks) + { + task->setContinuation(&mMergeProcessedTriggerInteractions); + task->removeReference(); + } + else + task->runInternal(); + + triggerContactTaskBuffer++; + triggerInteractions += nb; + } + + if(scheduleTasks) + mMergeProcessedTriggerInteractions.removeReference(); + else + mMergeProcessedTriggerInteractions.runInternal(); + } + else + { + outputError(__LINE__, "Temporary memory for trigger pair processing could not be allocated. Trigger overlap tests will not take place."); + } + } +} + +void NPhaseCore::mergeProcessedTriggerInteractions(PxBaseTask*) +{ + if(mTmpTriggerProcessingBlock) + { + // deactivate pairs that do not need trigger checks any longer (until woken up again) + TriggerInteraction** triggerPairsToDeactivate = reinterpret_cast(mTmpTriggerProcessingBlock); + for(PxI32 i=0; i < mTriggerPairsToDeactivateCount; i++) + { + mOwnerScene.notifyInteractionDeactivated(triggerPairsToDeactivate[i]); + } + mTriggerPairsToDeactivateCount = 0; + + mOwnerScene.getLowLevelContext()->getScratchAllocator().free(mTmpTriggerProcessingBlock); + mTmpTriggerProcessingBlock = NULL; + } +} + +void NPhaseCore::visualize(PxRenderOutput& renderOut, PxsContactManagerOutputIterator& outputs) +{ + // PT: put common reads here to avoid doing them for each interaction + + const PxReal scale = mOwnerScene.getVisualizationScale(); + if(scale == 0.0f) + return; + + const PxReal param_contactForce = mOwnerScene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_FORCE); + const PxReal param_contactNormal = mOwnerScene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_NORMAL); + const PxReal param_contactError = mOwnerScene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_ERROR); + const PxReal param_contactPoint = mOwnerScene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_POINT); + + if(param_contactForce==0.0f && param_contactNormal==0.0f && param_contactError==0.0f && param_contactPoint==0.0f) + return; + + Interaction** interactions = mOwnerScene.getActiveInteractions(InteractionType::eOVERLAP); + PxU32 nbActiveInteractions = mOwnerScene.getNbActiveInteractions(InteractionType::eOVERLAP); + while(nbActiveInteractions--) + static_cast(*interactions++)->visualize( renderOut, outputs, + scale, param_contactForce, param_contactNormal, param_contactError, param_contactPoint); +} + +#ifdef REMOVED +class ProcessPersistentContactTask : public Cm::Task +{ + Sc::NPhaseCore& mCore; + ContactReportBuffer& mBuffer; + PxMutex& mMutex; + ShapeInteraction*const* mPersistentEventPairs; + PxU32 mNbPersistentEventPairs; + PxsContactManagerOutputIterator mOutputs; + PX_NOCOPY(ProcessPersistentContactTask) +public: + + ProcessPersistentContactTask(Sc::NPhaseCore& core, ContactReportBuffer& buffer, PxMutex& mutex, ShapeInteraction*const* persistentEventPairs, + PxU32 nbPersistentEventPairs, PxsContactManagerOutputIterator& outputs) : Cm::Task(0), mCore(core), mBuffer(buffer), mMutex(mutex), + mPersistentEventPairs(persistentEventPairs), mNbPersistentEventPairs(nbPersistentEventPairs), mOutputs(outputs) + { + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("ProcessPersistentContactTask", mCore.getScene().getContextId()); + PxU32 size = mNbPersistentEventPairs; + ShapeInteraction*const* persistentEventPairs = mPersistentEventPairs; + while (size--) + { + ShapeInteraction* pair = *persistentEventPairs++; + if (size) + { + if (size > 1) + { + if (size > 2) + { + ShapeInteraction* nextPair = *(persistentEventPairs + 2); + prefetchLine(nextPair); + } + + ShapeInteraction* nextPair = *(persistentEventPairs + 1); + ActorPair* aPair = nextPair->getActorPair(); + prefetchLine(aPair); + + prefetchLine(&nextPair->getShape0()); + prefetchLine(&nextPair->getShape1()); + } + ShapeInteraction* nextPair = *(persistentEventPairs); + prefetchLine(&nextPair->getShape0().getActor()); + prefetchLine(&nextPair->getShape1().getActor()); + } + + PX_ASSERT(pair->hasTouch()); + PX_ASSERT(pair->isReportPair()); + + const PxU32 pairFlags = pair->getPairFlags(); + if ((pairFlags & PxU32(PxPairFlag::eNOTIFY_TOUCH_PERSISTS | PxPairFlag::eDETECT_DISCRETE_CONTACT)) == PxU32(PxPairFlag::eNOTIFY_TOUCH_PERSISTS | PxPairFlag::eDETECT_DISCRETE_CONTACT)) + { + // do not process the pair if only eDETECT_CCD_CONTACT is enabled because at this point CCD did not run yet. Plus the current CCD implementation can not reliably provide eNOTIFY_TOUCH_PERSISTS events + // for performance reasons. + //KS - filter based on edge activity! + + const ActorSim& bodySim0 = pair->getShape0().getActor(); + const ActorSim& bodySim1 = pair->getShape1().getActor(); + + if (bodySim0.isActive() || (!bodySim1.isStaticRigid() && bodySim1.isActive())) + pair->processUserNotificationAsync(PxPairFlag::eNOTIFY_TOUCH_PERSISTS, 0, false, 0, false, mOutputs/*, &alloc*/); + } + } + } + + virtual const char* getName() const + { + return "ScNPhaseCore.ProcessPersistentContactTask"; + } + +}; +#endif + +void NPhaseCore::processPersistentContactEvents(PxsContactManagerOutputIterator& outputs, PxBaseTask* continuation) +{ + PX_UNUSED(continuation); + PX_UNUSED(outputs); + PX_PROFILE_ZONE("Sc::NPhaseCore::processPersistentContactEvents", mOwnerScene.getContextId()); + + // Go through ShapeInteractions which requested persistent contact event reports. This is necessary since there are no low level events for persistent contact. + ShapeInteraction*const* persistentEventPairs = getCurrentPersistentContactEventPairs(); + PxU32 size = getCurrentPersistentContactEventPairCount(); + while (size--) + { + ShapeInteraction* pair = *persistentEventPairs++; + if (size) + { + ShapeInteraction* nextPair = *persistentEventPairs; + PxPrefetchLine(nextPair); + } + + ActorPair* aPair = pair->getActorPair(); + PxPrefetchLine(aPair); + + PX_ASSERT(pair->hasTouch()); + PX_ASSERT(pair->isReportPair()); + + const PxU32 pairFlags = pair->getPairFlags(); + if ((pairFlags & PxU32(PxPairFlag::eNOTIFY_TOUCH_PERSISTS | PxPairFlag::eDETECT_DISCRETE_CONTACT)) == PxU32(PxPairFlag::eNOTIFY_TOUCH_PERSISTS | PxPairFlag::eDETECT_DISCRETE_CONTACT)) + { + // do not process the pair if only eDETECT_CCD_CONTACT is enabled because at this point CCD did not run yet. Plus the current CCD implementation can not reliably provide eNOTIFY_TOUCH_PERSISTS events + // for performance reasons. + //KS - filter based on edge activity! + + const ActorSim& actorSim0= pair->getShape0().getActor(); + const ActorSim& actorSim1 = pair->getShape1().getActor(); + + if (actorSim0.isActive() || ((!actorSim1.isStaticRigid()) && actorSim1.isActive())) + pair->processUserNotification(PxPairFlag::eNOTIFY_TOUCH_PERSISTS, 0, false, 0, false, outputs); + } + } +} + +void NPhaseCore::fireCustomFilteringCallbacks(PxsContactManagerOutputIterator& outputs) +{ + PX_PROFILE_ZONE("Sim.fireCustomFilteringCallbacks", mOwnerScene.getContextId()); + + PxSimulationFilterCallback* callback = mOwnerScene.getFilterCallbackFast(); + + if(callback) + { + // Ask user for pair filter status changes + PxU32 pairID; + PxFilterFlags filterFlags; + PxPairFlags pairFlags; + while(callback->statusChange(pairID, pairFlags, filterFlags)) + { + ElementSimInteraction* ei = (*mFilterPairManager)[pairID]; + + PX_ASSERT(ei); + // Check if the user tries to update a pair even though he deleted it earlier in the same frame + + checkFilterFlags(filterFlags); + + PX_ASSERT(ei->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)); + + PxFilterInfo finfo; + finfo.filterFlags = filterFlags; + finfo.pairFlags = pairFlags; + finfo.filterPairIndex = pairID; + + ElementSimInteraction* refInt = refilterInteraction(ei, &finfo, true, outputs); + + // this gets called at the end of the simulation -> there should be no dirty interactions around + PX_ASSERT(!refInt->readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)); + PX_ASSERT(!refInt->getDirtyFlags()); + + if((refInt == ei) && (refInt->getType() == InteractionType::eOVERLAP)) // No interaction conversion happened, the pairFlags were just updated + static_cast(refInt)->updateState(InteractionDirtyFlag::eFILTER_STATE); + } + } +} + +void NPhaseCore::addToDirtyInteractionList(Interaction* pair) +{ + mDirtyInteractions.insert(pair); +} + +void NPhaseCore::removeFromDirtyInteractionList(Interaction* pair) +{ + PX_ASSERT(mDirtyInteractions.contains(pair)); + + mDirtyInteractions.erase(pair); +} + +void NPhaseCore::updateDirtyInteractions(PxsContactManagerOutputIterator& outputs) +{ + // The sleeping SIs will be updated on activation + // clow: Sleeping SIs are not awaken for visualization updates + const bool dirtyDominance = mOwnerScene.readFlag(SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE); + const bool dirtyVisualization = mOwnerScene.readFlag(SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_VISUALIZATION); + if(dirtyDominance || dirtyVisualization) + { + // Update all interactions. + + const PxU8 mask = PxTo8((dirtyDominance ? InteractionDirtyFlag::eDOMINANCE : 0) | (dirtyVisualization ? InteractionDirtyFlag::eVISUALIZATION : 0)); + + Interaction** it = mOwnerScene.getInteractions(InteractionType::eOVERLAP); + PxU32 size = mOwnerScene.getNbInteractions(InteractionType::eOVERLAP); + while(size--) + { + Interaction* pair = *it++; + + PX_ASSERT(pair->getType() == InteractionType::eOVERLAP); + + if(!pair->readInteractionFlag(InteractionFlag::eIN_DIRTY_LIST)) + { + PX_ASSERT(!pair->getDirtyFlags()); + static_cast(pair)->updateState(mask); + } + else + pair->setDirty(mask); // the pair will get processed further below anyway, so just mark the flags dirty + } + } + + // Update all interactions in the dirty list + const PxU32 dirtyItcCount = mDirtyInteractions.size(); + Interaction* const* dirtyInteractions = mDirtyInteractions.getEntries(); + for(PxU32 i = 0; i < dirtyItcCount; i++) + { + Interaction* refInt = dirtyInteractions[i]; + Interaction* interaction = refInt; + + if(interaction->isElementInteraction() && interaction->needsRefiltering()) + { + ElementSimInteraction* pair = static_cast(interaction); + + refInt = refilterInteraction(pair, NULL, false, outputs); + } + + if(interaction == refInt) // Refiltering might convert the pair to another type and kill the old one. In that case we don't want to update the new pair since it has been updated on creation. + { + const InteractionType::Enum iType = interaction->getType(); + if (iType == InteractionType::eOVERLAP) + static_cast(interaction)->updateState(0); + else if (iType == InteractionType::eCONSTRAINTSHADER) + static_cast(interaction)->updateState(); + + interaction->setClean(false); // false because the dirty interactions list gets cleard further below + } + } + + mDirtyInteractions.clear(); +} + +void NPhaseCore::releaseElementPair(ElementSimInteraction* pair, PxU32 flags, ElementSim* removedElement, const PxU32 ccdPass, bool removeFromDirtyList, + PxsContactManagerOutputIterator& outputs) +{ + pair->setClean(removeFromDirtyList); // Removes the pair from the dirty interaction list etc. + + if(pair->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)) + { + // Check if this is a filter callback pair + const PxU32 filterPairIndex = mFilterPairManager->findIndex(pair); + PX_ASSERT(filterPairIndex!=INVALID_FILTER_PAIR_INDEX); + + callPairLost(mOwnerScene, pair->getElement0(), pair->getElement1(), filterPairIndex, (removedElement != NULL)); + + mFilterPairManager->releaseIndex(filterPairIndex); + } + + switch(pair->getType()) + { + case InteractionType::eTRIGGER: + { + PxsTransformCache& transformCache = mOwnerScene.getLowLevelContext()->getTransformCache(); + TriggerInteraction* tri = static_cast(pair); + PxTriggerPair triggerPair; + TriggerPairExtraData triggerPairExtra; + if (findTriggerContacts(tri, true, (removedElement != NULL), + triggerPair, triggerPairExtra, + const_cast(mOwnerScene.getStatsInternal().numTriggerPairs), + transformCache)) + // cast away volatile-ness (this is fine since the method does not run in parallel) + { + mOwnerScene.getTriggerBufferAPI().pushBack(triggerPair); + mOwnerScene.getTriggerBufferExtraData().pushBack(triggerPairExtra); + } + mTriggerInteractionPool.destroy(tri); + } + break; + case InteractionType::eMARKER: + { + ElementInteractionMarker* interactionMarker = static_cast(pair); + mInteractionMarkerPool.destroy(interactionMarker); + } + break; + case InteractionType::eOVERLAP: + { + ShapeInteraction* si = static_cast(pair); + if(flags & PairReleaseFlag::eRUN_LOST_TOUCH_LOGIC) + lostTouchReports(si, flags, removedElement, ccdPass, outputs); + + mShapeInteractionPool.destroy(si); + } + break; + case InteractionType::eCONSTRAINTSHADER: + case InteractionType::eARTICULATION: + case InteractionType::eTRACKED_IN_SCENE_COUNT: + case InteractionType::eINVALID: + PX_ASSERT(0); + return; + } +} + +void NPhaseCore::lostTouchReports(ShapeInteraction* si, PxU32 flags, ElementSim* removedElement, PxU32 ccdPass, + PxsContactManagerOutputIterator& outputs) +{ + if(si->hasTouch()) + { + if(si->isReportPair()) + si->sendLostTouchReport((removedElement != NULL), ccdPass, outputs); + + si->adjustCountersOnLostTouch(); + } + + ActorPair* aPair = si->getActorPair(); + if(aPair && aPair->decRefCount() == 0) + { + RigidSim* sim0 = static_cast(&si->getActorSim0()); + RigidSim* sim1 = static_cast(&si->getActorSim1()); + + BodyPairKey pair; + + if(sim0->getActorID() > sim1->getActorID()) + PxSwap(sim0, sim1); + + pair.mSim0 = sim0->getActorID(); + pair.mSim1 = sim1->getActorID(); + + mActorPairMap.erase(pair); + + if(!aPair->isReportPair()) + { + mActorPairPool.destroy(aPair); + } + else + { + ActorPairReport& apr = ActorPairReport::cast(*aPair); + destroyActorPairReport(apr); + } + } + si->clearActorPair(); + + if(si->hasTouch() || (!si->hasKnownTouchState())) + { + ActorSim& b0 = si->getShape0().getActor(); + ActorSim& b1 = si->getShape1().getActor(); + + if(flags & PairReleaseFlag::eWAKE_ON_LOST_TOUCH) + { + // we rely on shape pair ordering here, where the first body is never static + // (see createShapeInteraction()) + PX_ASSERT(!b0.isStaticRigid()); + + if (removedElement == NULL) + { + if (b1.isStaticRigid()) // no check for b0 being static, see assert further above + { + // given wake-on-lost-touch has been requested: + // if one is static, we wake up the other immediately + + b0.internalWakeUp(); + } + else if(!si->readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) + { + mOwnerScene.addToLostTouchList(b0, b1); + } + } + else + { + // given wake-on-lost-touch has been requested: + // if an element (broadphase volume) has been removed, we wake the other actor up + + PX_ASSERT((removedElement == &si->getShape0()) || (removedElement == &si->getShape1())); + + if (&si->getShape0() == removedElement) + { + if (!b1.isStaticRigid()) + b1.internalWakeUp(); + } + else + b0.internalWakeUp(); // no check for b0 being non-static, see assert further above + } + } + } +} + +void NPhaseCore::clearContactReportActorPairs(bool shrinkToZero) +{ + for(PxU32 i=0; i < mContactReportActorPairSet.size(); i++) + { + //TODO: prefetch? + ActorPairReport* aPair = mContactReportActorPairSet[i]; + const PxU32 refCount = aPair->getRefCount(); + PX_ASSERT(aPair->isInContactReportActorPairSet()); + PX_ASSERT(refCount > 0); + aPair->decRefCount(); // Reference held by contact callback + if(refCount > 1) + { + aPair->clearInContactReportActorPairSet(); + } + else + { + BodyPairKey pair; + PxU32 actorAID = aPair->getActorAID(); + PxU32 actorBID = aPair->getActorBID(); + pair.mSim0 = PxMin(actorAID, actorBID); + pair.mSim1 = PxMax(actorAID, actorBID); + + mActorPairMap.erase(pair); + destroyActorPairReport(*aPair); + } + } + + if(!shrinkToZero) + mContactReportActorPairSet.clear(); + else + mContactReportActorPairSet.reset(); +} + +void NPhaseCore::addToPersistentContactEventPairs(ShapeInteraction* si) +{ + // Pairs which request events which do not get triggered by the sdk and thus need to be tested actively every frame. + PX_ASSERT(si->getPairFlags() & (PxPairFlag::eNOTIFY_TOUCH_PERSISTS | ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS)); + PX_ASSERT(si->mReportPairIndex == INVALID_REPORT_PAIR_ID); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + PX_ASSERT(si->hasTouch()); // only pairs which can from now on lose or keep contact should be in this list + + si->raiseFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST); + if(mPersistentContactEventPairList.size() == mNextFramePersistentContactEventPairIndex) + { + si->mReportPairIndex = mPersistentContactEventPairList.size(); + mPersistentContactEventPairList.pushBack(si); + } + else + { + //swap with first entry that will be active next frame + ShapeInteraction* firstDelayedSi = mPersistentContactEventPairList[mNextFramePersistentContactEventPairIndex]; + firstDelayedSi->mReportPairIndex = mPersistentContactEventPairList.size(); + mPersistentContactEventPairList.pushBack(firstDelayedSi); + si->mReportPairIndex = mNextFramePersistentContactEventPairIndex; + mPersistentContactEventPairList[mNextFramePersistentContactEventPairIndex] = si; + } + + mNextFramePersistentContactEventPairIndex++; +} + +void NPhaseCore::addToPersistentContactEventPairsDelayed(ShapeInteraction* si) +{ + // Pairs which request events which do not get triggered by the sdk and thus need to be tested actively every frame. + PX_ASSERT(si->getPairFlags() & (PxPairFlag::eNOTIFY_TOUCH_PERSISTS | ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS)); + PX_ASSERT(si->mReportPairIndex == INVALID_REPORT_PAIR_ID); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + PX_ASSERT(si->hasTouch()); // only pairs which can from now on lose or keep contact should be in this list + + si->raiseFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST); + si->mReportPairIndex = mPersistentContactEventPairList.size(); + mPersistentContactEventPairList.pushBack(si); +} + +void NPhaseCore::removeFromPersistentContactEventPairs(ShapeInteraction* si) +{ + PX_ASSERT(si->getPairFlags() & (PxPairFlag::eNOTIFY_TOUCH_PERSISTS | ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS)); + PX_ASSERT(si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + PX_ASSERT(si->hasTouch()); // only pairs which could lose or keep contact should be in this list + + PxU32 index = si->mReportPairIndex; + PX_ASSERT(index != INVALID_REPORT_PAIR_ID); + + if(index < mNextFramePersistentContactEventPairIndex) + { + const PxU32 replaceIdx = mNextFramePersistentContactEventPairIndex - 1; + + if((mNextFramePersistentContactEventPairIndex < mPersistentContactEventPairList.size()) && (index != replaceIdx)) + { + // keep next frame persistent pairs at the back of the list + ShapeInteraction* tmp = mPersistentContactEventPairList[replaceIdx]; + mPersistentContactEventPairList[index] = tmp; + tmp->mReportPairIndex = index; + index = replaceIdx; + } + + mNextFramePersistentContactEventPairIndex--; + } + + si->clearFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST); + si->mReportPairIndex = INVALID_REPORT_PAIR_ID; + mPersistentContactEventPairList.replaceWithLast(index); + if(index < mPersistentContactEventPairList.size()) // Only adjust the index if the removed SIP was not at the end of the list + mPersistentContactEventPairList[index]->mReportPairIndex = index; +} + +void NPhaseCore::addToForceThresholdContactEventPairs(ShapeInteraction* si) +{ + PX_ASSERT(si->getPairFlags() & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS); + PX_ASSERT(si->mReportPairIndex == INVALID_REPORT_PAIR_ID); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + PX_ASSERT(si->hasTouch()); + + si->raiseFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST); + si->mReportPairIndex = mForceThresholdContactEventPairList.size(); + mForceThresholdContactEventPairList.pushBack(si); +} + +void NPhaseCore::removeFromForceThresholdContactEventPairs(ShapeInteraction* si) +{ + PX_ASSERT(si->getPairFlags() & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS); + PX_ASSERT(si->readFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + PX_ASSERT(!si->readFlag(ShapeInteraction::IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(si->hasTouch()); + + const PxU32 index = si->mReportPairIndex; + PX_ASSERT(index != INVALID_REPORT_PAIR_ID); + + si->clearFlag(ShapeInteraction::IS_IN_FORCE_THRESHOLD_EVENT_LIST); + si->mReportPairIndex = INVALID_REPORT_PAIR_ID; + mForceThresholdContactEventPairList.replaceWithLast(index); + if(index < mForceThresholdContactEventPairList.size()) // Only adjust the index if the removed SIP was not at the end of the list + mForceThresholdContactEventPairList[index]->mReportPairIndex = index; +} + +PxU8* NPhaseCore::reserveContactReportPairData(PxU32 pairCount, PxU32 extraDataSize, PxU32& bufferIndex, + ContactReportAllocationManager* alloc) +{ + extraDataSize = ContactStreamManager::computeExtraDataBlockSize(extraDataSize); + return alloc ? alloc->allocate(extraDataSize + (pairCount * sizeof(ContactShapePair)), bufferIndex) : mContactReportBuffer.allocateNotThreadSafe(extraDataSize + (pairCount * sizeof(ContactShapePair)), bufferIndex); +} + +PxU8* NPhaseCore::resizeContactReportPairData(PxU32 pairCount, PxU32 extraDataSize, ContactStreamManager& csm) +{ + PX_ASSERT((pairCount > csm.maxPairCount) || (extraDataSize > csm.getMaxExtraDataSize())); + PX_ASSERT((csm.currentPairCount == csm.maxPairCount) || (extraDataSize > csm.getMaxExtraDataSize())); + PX_ASSERT(extraDataSize >= csm.getMaxExtraDataSize()); // we do not support stealing memory from the extra data part when the memory for pair info runs out + + PxU32 bufferIndex; + PxPrefetch(mContactReportBuffer.getData(csm.bufferIndex)); + + extraDataSize = ContactStreamManager::computeExtraDataBlockSize(extraDataSize); + PxU8* stream = mContactReportBuffer.reallocateNotThreadSafe(extraDataSize + (pairCount * sizeof(ContactShapePair)), bufferIndex, 16, csm.bufferIndex); + PxU8* oldStream = mContactReportBuffer.getData(csm.bufferIndex); + if(stream) + { + const PxU32 maxExtraDataSize = csm.getMaxExtraDataSize(); + if(csm.bufferIndex != bufferIndex) + { + if(extraDataSize <= maxExtraDataSize) + PxMemCopy(stream, oldStream, maxExtraDataSize + (csm.currentPairCount * sizeof(ContactShapePair))); + else + { + PxMemCopy(stream, oldStream, csm.extraDataSize); + PxMemCopy(stream + extraDataSize, oldStream + maxExtraDataSize, csm.currentPairCount * sizeof(ContactShapePair)); + } + csm.bufferIndex = bufferIndex; + } + else if(extraDataSize > maxExtraDataSize) + PxMemMove(stream + extraDataSize, oldStream + maxExtraDataSize, csm.currentPairCount * sizeof(ContactShapePair)); + + if(pairCount > csm.maxPairCount) + csm.maxPairCount = PxTo16(pairCount); + if(extraDataSize > maxExtraDataSize) + csm.setMaxExtraDataSize(extraDataSize); + } + return stream; +} + +ActorPairContactReportData* NPhaseCore::createActorPairContactReportData() +{ + PxMutex::ScopedLock lock(mReportAllocLock); + return mActorPairContactReportDataPool.construct(); +} + +void NPhaseCore::releaseActorPairContactReportData(ActorPairContactReportData* data) +{ + mActorPairContactReportDataPool.destroy(data); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.h new file mode 100644 index 0000000..e5272b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScNPhaseCore.h @@ -0,0 +1,399 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_NPHASE_CORE_H +#define SC_NPHASE_CORE_H + +#include "common/PxRenderOutput.h" +#include "foundation/PxHash.h" +#include "foundation/PxUserAllocated.h" +#include "foundation/PxHashSet.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxMutex.h" +#include "foundation/PxAtomic.h" +#include "PxPhysXConfig.h" + +#include "foundation/PxPool.h" + +#include "PxSimulationEventCallback.h" +#include "ScTriggerPairs.h" +#include "ScScene.h" +#include "ScContactReportBuffer.h" + + + +namespace physx +{ +namespace Bp +{ + struct AABBOverlap; + struct BroadPhasePair; +} + +namespace Sc +{ + class ActorSim; + class ElementSim; + class ShapeSimBase; + + class Interaction; + class ElementSimInteraction; + class ElementInteractionMarker; + class TriggerInteraction; + + class ShapeInteraction; + class ActorPair; + class ActorPairReport; + + class ActorPairContactReportData; + struct ContactShapePair; + + class NPhaseContext; + class ContactStreamManager; + + struct FilterPair; + class FilterPairManager; + + class ActorSim; + + struct PairReleaseFlag + { + enum Enum + { + eRUN_LOST_TOUCH_LOGIC = (1 << 0), // run the lost-touch-logic for a pair that gets removed. + eWAKE_ON_LOST_TOUCH = (1 << 1) // a pair that lost touch should check whether the actors should get woken up + }; + }; + + /* + Description: NPhaseCore encapsulates the near phase processing to allow multiple implementations(eg threading and non + threaded). + + The broadphase inserts shape pairs into the NPhaseCore, which are then processed into contact point streams. + Pairs can then be processed into AxisConstraints by the GroupSolveCore. + */ + + struct BodyPairKey + { + PxU32 mSim0; + PxU32 mSim1; + + PX_FORCE_INLINE bool operator == (const BodyPairKey& pair) const { return mSim0 == pair.mSim0 && mSim1 == pair.mSim1; } + }; + + PX_INLINE PxU32 PxComputeHash(const BodyPairKey& key) + { + const PxU32 add0 = key.mSim0; + const PxU32 add1 = key.mSim1; + + const PxU32 base = PxU32((add0 & 0xFFFF) | (add1 << 16)); + + return physx::PxComputeHash(base); + } + + struct ElementSimKey + { + ElementSim* mSim0, *mSim1; + + ElementSimKey() : mSim0(NULL), mSim1(NULL) + {} + + ElementSimKey(ElementSim* sim0, ElementSim* sim1) + { + if(sim0 > sim1) + PxSwap(sim0, sim1); + mSim0 = sim0; + mSim1 = sim1; + } + + PX_FORCE_INLINE bool operator == (const ElementSimKey& pair) const { return mSim0 == pair.mSim0 && mSim1 == pair.mSim1; } + }; + + PX_INLINE PxU32 PxComputeHash(const ElementSimKey& key) + { + PxU32 add0 = (size_t(key.mSim0)) & 0xFFFFFFFF; + PxU32 add1 = (size_t(key.mSim1)) & 0xFFFFFFFF; + + //Clear the lower 2 bits, they will be 0s anyway + add0 = add0 >> 2; + add1 = add1 >> 2; + + const PxU32 base = PxU32((add0 & 0xFFFF) | (add1 << 16)); + + return physx::PxComputeHash(base); + } + + class ContactReportAllocationManager + { + PxU8* mBuffer; + PxU32 mBufferSize; + PxU32 mCurrentBufferIndex; + PxU32 mCurrentOffset; + ContactReportBuffer& mReportBuffer; + PxMutex& mMutex; + const PxU32 mBuferBlockSize; + PX_NOCOPY(ContactReportAllocationManager) + public: + + ContactReportAllocationManager(ContactReportBuffer& buffer, PxMutex& mutex, const PxU32 bufferBlockSize = 16384) : mBuffer(NULL), mBufferSize(0), mCurrentBufferIndex(0), + mCurrentOffset(0), mReportBuffer(buffer), mMutex(mutex), mBuferBlockSize(bufferBlockSize) + { + } + + PxU8* allocate(const PxU32 size, PxU32& index, PxU32 alignment = 16u) + { + //(1) fix up offsets... + PxU32 pad = ((mCurrentBufferIndex + alignment - 1)&~(alignment - 1)) - mCurrentBufferIndex; + PxU32 currOffset = mCurrentOffset + pad; + + if ((currOffset + size) > mBufferSize) + { + const PxU32 allocSize = PxMax(size, mBuferBlockSize); + + mMutex.lock(); + mBuffer = mReportBuffer.allocateNotThreadSafe(allocSize, mCurrentBufferIndex, alignment); + mCurrentOffset = currOffset = 0; + mBufferSize = allocSize; + mMutex.unlock(); + } + + PxU8* ret = mBuffer + currOffset; + index = mCurrentBufferIndex + currOffset; + mCurrentOffset = currOffset + size; + return ret; + } + }; + + class NPhaseCore : public PxUserAllocated + { + PX_NOCOPY(NPhaseCore) + + public: + NPhaseCore(Scene& scene, const PxSceneDesc& desc); + ~NPhaseCore(); + + void onTriggerOverlapCreated(const Bp::AABBOverlap* PX_RESTRICT pairs, PxU32 pairCount); + + void runOverlapFilters( PxU32 nbToProcess, const Bp::AABBOverlap* PX_RESTRICT pairs, PxFilterInfo* PX_RESTRICT filterInfo, + PxU32& nbToKeep, PxU32& nbToSuppress, PxU32& nbToCallback, PxU32* PX_RESTRICT keepMap, PxU32* PX_RESTRICT callbackMap); + + ElementSimInteraction* onOverlapRemovedStage1(ElementSim* volume0, ElementSim* volume1); + void onOverlapRemoved(ElementSim* volume0, ElementSim* volume1, const PxU32 ccdPass, void* elemSim, PxsContactManagerOutputIterator& outputs); + void onVolumeRemoved(ElementSim* volume, PxU32 flags, PxsContactManagerOutputIterator& outputs); + + void managerNewTouch(Sc::ShapeInteraction& interaction); + + PxU32 getDefaultContactReportStreamBufferSize() const; + + void fireCustomFilteringCallbacks(PxsContactManagerOutputIterator& outputs); + + void addToDirtyInteractionList(Interaction* interaction); + void removeFromDirtyInteractionList(Interaction* interaction); + void updateDirtyInteractions(PxsContactManagerOutputIterator& outputs); + + /* + Description: Perform trigger overlap tests. + */ + void processTriggerInteractions(PxBaseTask* continuation); + + /* + Description: Gather results from trigger overlap tests and clean up. + */ + void mergeProcessedTriggerInteractions(PxBaseTask* continuation); + + /* + Description: Check candidates for persistent touch contact events and create those events if necessary. + */ + void processPersistentContactEvents(PxsContactManagerOutputIterator& outputs, PxBaseTask* continuation); + + /* + Description: Displays visualizations associated with the near phase. + */ + void visualize(PxRenderOutput& out, PxsContactManagerOutputIterator& outputs); + + PX_FORCE_INLINE Scene& getScene() const { return mOwnerScene; } + + PX_FORCE_INLINE void addToContactReportActorPairSet(ActorPairReport* pair) { mContactReportActorPairSet.pushBack(pair); } + void clearContactReportActorPairs(bool shrinkToZero); + PX_FORCE_INLINE PxU32 getNbContactReportActorPairs() const { return mContactReportActorPairSet.size(); } + PX_FORCE_INLINE ActorPairReport* const* getContactReportActorPairs() const { return mContactReportActorPairSet.begin(); } + + void addToPersistentContactEventPairs(ShapeInteraction*); + void addToPersistentContactEventPairsDelayed(ShapeInteraction*); + void removeFromPersistentContactEventPairs(ShapeInteraction*); + + + PX_FORCE_INLINE PxU32 getCurrentPersistentContactEventPairCount() const { return mNextFramePersistentContactEventPairIndex; } + PX_FORCE_INLINE ShapeInteraction* const* getCurrentPersistentContactEventPairs() const { return mPersistentContactEventPairList.begin(); } + PX_FORCE_INLINE PxU32 getAllPersistentContactEventPairCount() const { return mPersistentContactEventPairList.size(); } + PX_FORCE_INLINE ShapeInteraction* const* getAllPersistentContactEventPairs() const { return mPersistentContactEventPairList.begin(); } + PX_FORCE_INLINE void preparePersistentContactEventListForNextFrame(); + + void addToForceThresholdContactEventPairs(ShapeInteraction*); + void removeFromForceThresholdContactEventPairs(ShapeInteraction*); + + + PX_FORCE_INLINE PxU32 getForceThresholdContactEventPairCount() const { return mForceThresholdContactEventPairList.size(); } + PX_FORCE_INLINE ShapeInteraction* const* getForceThresholdContactEventPairs() const { return mForceThresholdContactEventPairList.begin(); } + + PX_FORCE_INLINE PxU8* getContactReportPairData(const PxU32& bufferIndex) const { return mContactReportBuffer.getData(bufferIndex); } + PxU8* reserveContactReportPairData(PxU32 pairCount, PxU32 extraDataSize, PxU32& bufferIndex, ContactReportAllocationManager* alloc = NULL); + PxU8* resizeContactReportPairData(PxU32 pairCount, PxU32 extraDataSize, Sc::ContactStreamManager& csm); + PX_FORCE_INLINE void clearContactReportStream() { mContactReportBuffer.reset(); } // Do not free memory at all + PX_FORCE_INLINE void freeContactReportStreamMemory() { mContactReportBuffer.flush(); } + + ActorPairContactReportData* createActorPairContactReportData(); + void releaseActorPairContactReportData(ActorPairContactReportData* data); + + void reserveInteraction(PxU32 nbNewInteractions); + void registerInteraction(ElementSimInteraction* interaction); + void unregisterInteraction(ElementSimInteraction* interaction); + + ElementSimInteraction* createRbElementInteraction(const PxFilterInfo& fInfo, ShapeSimBase& s0, ShapeSimBase& s1, PxsContactManager* contactManager, Sc::ShapeInteraction* shapeInteraction, + Sc::ElementInteractionMarker* interactionMarker, bool isTriggerPair); + + void lockReports() { mReportAllocLock.lock(); } + void unlockReports() { mReportAllocLock.unlock(); } + + + private: + ElementSimInteraction* createTriggerElementInteraction(ShapeSimBase& s0, ShapeSimBase& s1); + + // + // removedElement: points to the removed element (that is, the BP volume wrapper), if a pair gets removed or loses touch due to a removed element. + // NULL if not triggered by a removed element. + // + void releaseElementPair(ElementSimInteraction* pair, PxU32 flags, ElementSim* removedElement, const PxU32 ccdPass, bool removeFromDirtyList, PxsContactManagerOutputIterator& outputs); + void lostTouchReports(ShapeInteraction* pair, PxU32 flags, ElementSim* removedElement, const PxU32 ccdPass, PxsContactManagerOutputIterator& outputs); + + ShapeInteraction* createShapeInteraction(ShapeSimBase& s0, ShapeSimBase& s1, PxPairFlags pairFlags, PxsContactManager* contactManager, Sc::ShapeInteraction* shapeInteraction); + TriggerInteraction* createTriggerInteraction(ShapeSimBase& s0, ShapeSimBase& s1, PxPairFlags triggerFlags); + ElementInteractionMarker* createElementInteractionMarker(ElementSim& e0, ElementSim& e1, ElementInteractionMarker* marker); + + //------------- Filtering ------------- + + ElementSimInteraction* refilterInteraction(ElementSimInteraction* pair, const PxFilterInfo* filterInfo, bool removeFromDirtyList, PxsContactManagerOutputIterator& outputs); + //------------------------------------- + + ElementSimInteraction* convert(ElementSimInteraction* pair, InteractionType::Enum type, PxFilterInfo& filterInfo, bool removeFromDirtyList, PxsContactManagerOutputIterator& outputs); + + ActorPair* findActorPair(ShapeSimBase* s0, ShapeSimBase* s1, PxIntBool isReportPair); + PX_FORCE_INLINE void destroyActorPairReport(ActorPairReport&); + + Sc::ElementSimInteraction* findInteraction(ElementSim* _element0, ElementSim* _element1); + + // Pooling + Scene& mOwnerScene; + + PxArray mContactReportActorPairSet; + PxArray mPersistentContactEventPairList; // Pairs which request events which do not get triggered by the sdk and thus need to be tested actively every frame. + // May also contain force threshold event pairs (see mForceThresholdContactEventPairList) + // This list is split in two, the elements in front are for the current frame, the elements at the + // back will get added next frame. + + + PxU32 mNextFramePersistentContactEventPairIndex; // start index of the pairs which need to get added to the persistent list for next frame + + PxArray mForceThresholdContactEventPairList; // Pairs which request force threshold contact events. A pair is only in this list if it does have contact. + // Note: If a pair additionally requests PxPairFlag::eNOTIFY_TOUCH_PERSISTS events, then it + // goes into mPersistentContactEventPairList instead. This allows to share the list index. + + + // + // data layout: + // ContactActorPair0_ExtraData, ContactShapePair0_0, ContactShapePair0_1, ... ContactShapePair0_N, + // ContactActorPair1_ExtraData, ContactShapePair1_0, ... + // + ContactReportBuffer mContactReportBuffer; // Shape pair information for contact reports + + PxCoalescedHashSet mDirtyInteractions; + FilterPairManager* mFilterPairManager; + + // Pools + PxPool mActorPairPool; + PxPool mActorPairReportPool; + PxPool mShapeInteractionPool; + PxPool mTriggerInteractionPool; + PxPool mActorPairContactReportDataPool; + PxPool mInteractionMarkerPool; + + Cm::DelegateTask mMergeProcessedTriggerInteractions; + void* mTmpTriggerProcessingBlock; // temporary memory block to process trigger pairs in parallel + PxMutex mTriggerWriteBackLock; + volatile PxI32 mTriggerPairsToDeactivateCount; + PxHashMap mActorPairMap; + + PxHashMap mElementSimMap; + + PxMutex mBufferAllocLock; + PxMutex mReportAllocLock; + + friend class Sc::Scene; + friend class Sc::ShapeInteraction; + }; + + struct FilteringContext + { + PX_NOCOPY(FilteringContext) + public: + FilteringContext(const Sc::Scene& scene, FilterPairManager* filterPairManager) : + mFilterShader (scene.getFilterShaderFast()), + mFilterShaderData (scene.getFilterShaderDataFast()), + mFilterShaderDataSize (scene.getFilterShaderDataSizeFast()), + mFilterCallback (scene.getFilterCallbackFast()), + mFilterPairManager (filterPairManager), + mKineKineFilteringMode (scene.getKineKineFilteringMode()), + mStaticKineFilteringMode(scene.getStaticKineFilteringMode()) + { + } + + PxSimulationFilterShader mFilterShader; + const void* mFilterShaderData; + PxU32 mFilterShaderDataSize; + PxSimulationFilterCallback* mFilterCallback; + FilterPairManager* mFilterPairManager; + const PxPairFilteringMode::Enum mKineKineFilteringMode; + const PxPairFilteringMode::Enum mStaticKineFilteringMode; + }; + + // helper function to run the filter logic after some hardwired filter criteria have been passed successfully + PxFilterInfo filterRbCollisionPairSecondStage(const FilteringContext& context, const ShapeSimBase& s0, const ShapeSimBase& s1, const Sc::ActorSim& b0, const Sc::ActorSim& b1, PxU32 filterPairIndex, bool runCallbacks, + bool isNonRigid); + +} // namespace Sc + + +PX_FORCE_INLINE void Sc::NPhaseCore::preparePersistentContactEventListForNextFrame() +{ + // reports have been processed -> "activate" next frame candidates for persistent contact events + mNextFramePersistentContactEventPairIndex = mPersistentContactEventPairList.size(); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScObjectIDTracker.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScObjectIDTracker.h new file mode 100644 index 0000000..d57c821 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScObjectIDTracker.h @@ -0,0 +1,96 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_OBJECT_ID_TRACKER_H +#define SC_OBJECT_ID_TRACKER_H + +#include "CmIDPool.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ +namespace Sc +{ + // PT: TODO: this has no direct dependency on "Sc". It should really be a "Cm" class. + class ObjectIDTracker : public PxUserAllocated + { + PX_NOCOPY(ObjectIDTracker) + public: + ObjectIDTracker() : mPendingReleasedIDs("objectIDTrackerIDs") {} + + PX_INLINE PxU32 createID() { return mIDPool.getNewID(); } + PX_INLINE void releaseID(PxU32 id) + { + markIDAsDeleted(id); + mPendingReleasedIDs.pushBack(id); + } + PX_INLINE PxIntBool isDeletedID(PxU32 id) const { return mDeletedIDsMap.boundedTest(id); } + PX_FORCE_INLINE PxU32 getDeletedIDCount() const { return mPendingReleasedIDs.size(); } + PX_INLINE void clearDeletedIDMap() { mDeletedIDsMap.clear(); } + PX_INLINE void resizeDeletedIDMap(PxU32 id, PxU32 numIds) + { + mDeletedIDsMap.resize(id); + mPendingReleasedIDs.reserve(numIds); + } + PX_INLINE void processPendingReleases() + { + for(PxU32 i=0; i < mPendingReleasedIDs.size(); i++) + { + mIDPool.freeID(mPendingReleasedIDs[i]); + } + mPendingReleasedIDs.clear(); + } + PX_INLINE void reset() + { + processPendingReleases(); + mPendingReleasedIDs.reset(); + + // Don't free stuff in IDPool, we still need the list of free IDs + + // And it does not seem worth freeing the memory of the bitmap + } + + PX_INLINE PxU32 getMaxID() + { + return mIDPool.getMaxID(); + } + private: + PX_INLINE void markIDAsDeleted(PxU32 id) { PX_ASSERT(!isDeletedID(id)); mDeletedIDsMap.growAndSet(id); } + + + private: + Cm::IDPool mIDPool; + PxBitMap mDeletedIDsMap; + PxArray mPendingReleasedIDs; // Buffer for released IDs to make sure newly created objects do not re-use these IDs immediately + }; + +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp new file mode 100644 index 0000000..6fe9596 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemCore.cpp @@ -0,0 +1,287 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScParticleSystemCore.h" + +#include "ScPhysics.h" +#include "ScParticleSystemSim.h" +#include "DyParticleSystem.h" +#include "PxvGlobals.h" +#include "PxPhysXGpu.h" + +using namespace physx; + +Sc::ParticleSystemCore::ParticleSystemCore(PxActorType::Enum actorType) : + ActorCore(actorType, PxActorFlag::eVISUALIZATION, PX_DEFAULT_CLIENT, 0) +{ +} + +Sc::ParticleSystemCore::~ParticleSystemCore() +{ +} + +Sc::ParticleSystemSim* Sc::ParticleSystemCore::getSim() const +{ + return static_cast(ActorCore::getSim()); +} + +PxReal Sc::ParticleSystemCore::getSleepThreshold() const +{ + return mShapeCore.getLLCore().sleepThreshold;//mCore.sleepThreshold; +} + +void Sc::ParticleSystemCore::setSleepThreshold(const PxReal v) +{ + mShapeCore.getLLCore().sleepThreshold = v; +} + +PxReal Sc::ParticleSystemCore::getRestOffset() const +{ + return mShapeCore.getLLCore().restOffset; +} + +void Sc::ParticleSystemCore::setRestOffset(const PxReal v) +{ + mShapeCore.getLLCore().restOffset = v; +} + +PxReal Sc::ParticleSystemCore::getContactOffset() const +{ + return mShapeCore.getContactOffset(); +} + +void Sc::ParticleSystemCore::setContactOffset(const PxReal v) +{ + mShapeCore.setContactOffset(v); + + Sc::ParticleSystemSim* sim = getSim(); + if (sim) + { + sim->getScene().updateContactDistance(sim->getShapeSim().getElementID(), v); + } +} + +PxReal Sc::ParticleSystemCore::getParticleContactOffset() const +{ + return mShapeCore.getLLCore().particleContactOffset; +} + +void Sc::ParticleSystemCore::setParticleContactOffset(const PxReal v) +{ + mShapeCore.getLLCore().particleContactOffset = v; +} + +PxReal Sc::ParticleSystemCore::getSolidRestOffset() const +{ + return mShapeCore.getLLCore().solidRestOffset; +} + +void Sc::ParticleSystemCore::setSolidRestOffset(const PxReal v) +{ + mShapeCore.getLLCore().solidRestOffset = v; +} + +PxReal Sc::ParticleSystemCore::getFluidRestOffset() const +{ + return mShapeCore.getLLCore().fluidRestOffset; +} + +void Sc::ParticleSystemCore::setFluidRestOffset(const PxReal v) +{ + mShapeCore.getLLCore().fluidRestOffset = v; +} + +void Sc::ParticleSystemCore::setMaxDepenetrationVelocity(const PxReal v) +{ + mShapeCore.getLLCore().maxDepenetrationVelocity = v; +} + +PxReal Sc::ParticleSystemCore::getMaxDepenetrationVelocity() const +{ + return mShapeCore.getLLCore().maxDepenetrationVelocity; +} + +void Sc::ParticleSystemCore::setMaxVelocity(const PxReal v) +{ + mShapeCore.getLLCore().maxVelocity = v; +} + +PxReal Sc::ParticleSystemCore::getMaxVelocity() const +{ + return mShapeCore.getLLCore().maxVelocity; +} + +PxParticleSystemCallback* Sc::ParticleSystemCore::getParticleSystemCallback() const +{ + return mShapeCore.getLLCore().mCallback; +} + +void Sc::ParticleSystemCore::setParticleSystemCallback(PxParticleSystemCallback* callback) +{ + mShapeCore.getLLCore().mCallback = callback; +} + +PxCustomParticleSystemSolverCallback* Sc::ParticleSystemCore::getParticleSystemSolverCallback() const +{ + return mShapeCore.getLLCore().mSolverCallback; +} +void Sc::ParticleSystemCore::setParticleSystemSolverCallback(PxCustomParticleSystemSolverCallback* callback) +{ + mShapeCore.getLLCore().mSolverCallback = callback; +} + +PxReal Sc::ParticleSystemCore::getFluidBoundaryDensityScale() const +{ + return mShapeCore.getLLCore().fluidBoundaryDensityScale; +} + +void Sc::ParticleSystemCore::setFluidBoundaryDensityScale(const PxReal v) +{ + mShapeCore.getLLCore().fluidBoundaryDensityScale = v; +} + +PxU32 Sc::ParticleSystemCore::getGridSizeX() const +{ + return mShapeCore.getLLCore().gridSizeX; +} + +void Sc::ParticleSystemCore::setGridSizeX(const PxU32 v) +{ + mShapeCore.getLLCore().gridSizeX = v; +} + +PxU32 Sc::ParticleSystemCore::getGridSizeY() const +{ + return mShapeCore.getLLCore().gridSizeY; +} + +void Sc::ParticleSystemCore::setGridSizeY(const PxU32 v) +{ + mShapeCore.getLLCore().gridSizeY = v; +} + +PxU32 Sc::ParticleSystemCore::getGridSizeZ() const +{ + return mShapeCore.getLLCore().gridSizeZ; +} + +void Sc::ParticleSystemCore::setGridSizeZ(const PxU32 v) +{ + mShapeCore.getLLCore().gridSizeZ = v; +} + +void Sc::ParticleSystemCore::setSolverIterationCounts(PxU16 c) +{ + mShapeCore.getLLCore().solverIterationCounts = c; +} + + +PxReal Sc::ParticleSystemCore::getWakeCounter() const +{ + return mShapeCore.getLLCore().wakeCounter; +} + +void Sc::ParticleSystemCore::setWakeCounter(const PxReal v) +{ + mShapeCore.getLLCore().wakeCounter = v; +} + +void Sc::ParticleSystemCore::setWakeCounterInternal(const PxReal v) +{ + mShapeCore.getLLCore().wakeCounter = v; +} + +bool Sc::ParticleSystemCore::isSleeping() const +{ + Sc::ParticleSystemSim* sim = getSim(); + return sim ? sim->isSleeping() : (mShapeCore.getLLCore().wakeCounter == 0.0f); +} + +void Sc::ParticleSystemCore::wakeUp(PxReal wakeCounter) +{ + mShapeCore.getLLCore().wakeCounter = wakeCounter; +} + +void Sc::ParticleSystemCore::putToSleep() +{ + mShapeCore.getLLCore().wakeCounter = 0.0f; +} + +PxActor* Sc::ParticleSystemCore::getPxActor() const +{ + return PxPointerOffset(const_cast(this), gOffsetTable.scCore2PxActor[getActorCoreType()]); +} + +// TOFIX +void Sc::ParticleSystemCore::enableCCD(const bool enable) +{ + mShapeCore.getLLCore().enableCCD = enable; +} + + +void Sc::ParticleSystemCore::addRigidAttachment(Sc::BodyCore* core) +{ + Sc::ParticleSystemSim* sim = getSim(); + if(sim) + sim->getScene().addRigidAttachment(core, *sim); +} + +void Sc::ParticleSystemCore::removeRigidAttachment(Sc::BodyCore* core) +{ + Sc::ParticleSystemSim* sim = getSim(); + if (sim) + sim->getScene().removeRigidAttachment(core, *sim); +} + +void Sc::ParticleSystemCore::setFlags(PxParticleFlags flags) +{ + Sc::ParticleSystemSim* sim = getSim(); + PxParticleFlags oldFlags = mShapeCore.getLLCore().mFlags; + mShapeCore.getLLCore().mFlags = flags; + + if (sim) + { + bool wasRigidCollisionDisabled = oldFlags & PxParticleFlag::eDISABLE_RIGID_COLLISION; + bool isRigidCollisionDisabled = flags & PxParticleFlag::eDISABLE_RIGID_COLLISION; + + if (wasRigidCollisionDisabled ^ isRigidCollisionDisabled) + { + if (wasRigidCollisionDisabled) + sim->getShapeSim().createLowLevelVolume(); + else + sim->getShapeSim().destroyLowLevelVolume(); + + } + } + + +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp new file mode 100644 index 0000000..963b916 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.cpp @@ -0,0 +1,140 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "foundation/PxErrorCallback.h" +#include "ScParticleSystemShapeCore.h" +#include "ScParticleSystemShapeSim.h" +#include "ScPhysics.h" +#include "PxvGlobals.h" +#include "PxPhysXGpu.h" +#include "cudamanager/PxCudaContextManager.h" +#include "CmVisualization.h" + +using namespace physx; +using namespace Sc; + + +ParticleSystemShapeCore::ParticleSystemShapeCore() + : ShapeCore(PxEmpty) + , mGpuMemStat(0) +{ + mSimulationFilterData = PxFilterData(); + mCore = PxsShapeCore(); + + mCore.mShapeCoreFlags |= PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY; + + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + mCore.setTransform(PxTransform(PxIdentity)); + mCore.mContactOffset = 0.01f * scale.length; + mCore.mShapeFlags = 0; + mCore.mMaterialIndex = 0; + + mCore.mMinTorsionalPatchRadius = 0.f; + mCore.mTorsionalRadius = 0.f; + + mLLCore.sleepThreshold = 5e-5f * scale.speed * scale.speed; + mLLCore.wakeCounter = Physics::sWakeCounterOnCreation; + mLLCore.freezeThreshold = 5e-6f * scale.speed * scale.speed; + + //TODO, make this dependend on scale? + //also set contact offset accordingly + mLLCore.restOffset = 0.1f; + const PxReal contactOffset = mLLCore.restOffset + 0.001f; + setContactOffset(contactOffset); + + mLLCore.particleContactOffset = contactOffset; + mLLCore.solidRestOffset = mLLCore.restOffset; + mLLCore.fluidRestOffset = mLLCore.restOffset * 0.6f; + + mLLCore.particleContactOffset_prev = FLT_MIN; + mLLCore.fluidRestOffset_prev = FLT_MIN; + + mLLCore.fluidBoundaryDensityScale = 0.0f; + + mLLCore.gridSizeX = 128; + mLLCore.gridSizeY = 128; + mLLCore.gridSizeZ = 128; + + mLLCore.mFlags = PxParticleFlags(0); + + mLLCore.solverIterationCounts = (1 << 8) | 4; + + mLLCore.mWind = PxVec3(0.f); + mLLCore.periodicBoundary = PxVec3(0.f); + + //mLLCore.mNumUpdateSprings = 0; + + mLLCore.solverType = PxParticleSolverType::ePBD; + + // Sparse grid specific + mLLCore.sparseGridParams.setToDefault(); + mLLCore.sparseGridParams.gridSpacing = 2.0f * mLLCore.particleContactOffset; + +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION + // FLIP specific + mLLCore.flipParams.setToDefault(); + + // MPM specific + mLLCore.mpmParams.setToDefault(); +#endif +} + + +// PX_SERIALIZATION +ParticleSystemShapeCore::ParticleSystemShapeCore(const PxEMPTY) + : ShapeCore(PxEmpty) +{ +} + +ParticleSystemShapeCore::~ParticleSystemShapeCore() +{ +} + +void ParticleSystemShapeCore::addParticleBuffer(PxParticleBuffer* particleBuffer) +{ + mLLCore.addParticleBuffer(particleBuffer); +} + +void ParticleSystemShapeCore::removeParticleBuffer(PxParticleBuffer* particleBuffer) +{ + mLLCore.removeParticleBuffer(particleBuffer); +} + +void ParticleSystemShapeCore::initializeLLCoreData(PxU32 maxNeighborhood) +{ + const PxTolerancesScale& scale = Sc::Physics::getInstance().getTolerancesScale(); + + mLLCore.mMaxNeighborhood = maxNeighborhood; + + mLLCore.maxDepenetrationVelocity = 50.f * scale.length; + mLLCore.maxVelocity = 1e+6f; +} + +#endif // PX_SUPPORT_GPU_PHYSX + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.h new file mode 100644 index 0000000..fa41bbc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeCore.h @@ -0,0 +1,87 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_PARTICLESYSTEM_SHAPECORE_H +#define SC_PARTICLESYSTEM_SHAPECORE_H + +#include "foundation/PxUserAllocated.h" +#include "PxvGeometry.h" +#include "foundation/PxUtilities.h" +#include "PxFiltering.h" +#include "PxShape.h" +#include "ScShapeCore.h" +#include "DyParticleSystemCore.h" +#include "common/PxRenderOutput.h" + +namespace physx +{ + namespace Sc + { + class Scene; + class ParticleSystemCore; + class ParticleSystemSim; + + class ParticleSystemShapeCore : public Sc::ShapeCore + { + //= ATTENTION! ===================================================================================== + // Changing the data layout of this class breaks the binary serialization format. See comments for + // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData + // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION + // accordingly. + //================================================================================================== + public: + // PX_SERIALIZATION + ParticleSystemShapeCore(const PxEMPTY); + //~PX_SERIALIZATION + + ParticleSystemShapeCore(); + ~ParticleSystemShapeCore(); + + PX_FORCE_INLINE const Dy::ParticleSystemCore& getLLCore() const { return mLLCore; } + + PX_FORCE_INLINE Dy::ParticleSystemCore& getLLCore() { return mLLCore; } + + void initializeLLCoreData( PxU32 maxNeighborhood); + + void addParticleBuffer(PxParticleBuffer* particleBuffer); + void removeParticleBuffer(PxParticleBuffer* particleBuffer); + + void setPeriodicBoundary(const PxVec3& boundary) { mLLCore.periodicBoundary = boundary; } + PxVec3 getPeriodicBoundary() const { return mLLCore.periodicBoundary; } + + PxU64 getGpuMemStat() { return mGpuMemStat; } + + protected: + Dy::ParticleSystemCore mLLCore; + PxU64 mGpuMemStat; + }; + + } // namespace Sc + + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp new file mode 100644 index 0000000..3b1ae81 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.cpp @@ -0,0 +1,155 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScParticleSystemShapeSim.h" +#include "ScNPhaseCore.h" +#include "ScParticleSystemSim.h" +#include "PxsContext.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::ParticleSystemShapeSim::ParticleSystemShapeSim(ParticleSystemSim& particleSim, const ParticleSystemShapeCore* core) : + ShapeSimBase(particleSim, core) +{ + mLLShape.mBodySimIndex_GPU = PxNodeIndex(PX_INVALID_NODE); + mLLShape.mElementIndex_GPU = PX_INVALID_U32; + + createLowLevelVolume(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::ParticleSystemShapeSim::~ParticleSystemShapeSim() +{ + if (isInBroadPhase()) + destroyLowLevelVolume(); + + PX_ASSERT(!isInBroadPhase()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::ParticleSystemShapeSim::getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const +{ + filterAttr = 0; + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::ePARTICLESYSTEM); + filterData = getBodySim().getCore().getShapeCore().getSimulationFilterData(); +} + +void Sc::ParticleSystemShapeSim::updateBounds() +{ + Scene& scene = getScene(); + + PxBounds3 worldBounds = PxBounds3(PxVec3(0.f), PxVec3(0.f)); + const PxReal contactOffset = getBodySim().getCore().getContactOffset(); + worldBounds.fattenSafe(contactOffset); // fatten for fast moving colliders + scene.getBoundsArray().setBounds(worldBounds, getElementID()); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::ParticleSystemShapeSim::updateBoundsInAABBMgr() +{ + //we are updating the bound in GPU so we just need to set the actor handle in CPU to make sure + //the GPU BP will process the particles + + if (!(static_cast(getActor()).getCore().getFlags() & PxParticleFlag::eDISABLE_RIGID_COLLISION)) + { + Scene& scene = getScene(); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); + scene.getAABBManager()->setGPUStateChanged(); + } +} + +PxBounds3 Sc::ParticleSystemShapeSim::getBounds() const +{ + PxBounds3 bounds = getScene().getBoundsArray().getBounds(getElementID()); + return bounds; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void Sc::ParticleSystemShapeSim::createLowLevelVolume() +{ + //PX_ASSERT(getWorldBounds().isFinite()); + + const PxU32 index = getElementID(); + + + if (!(static_cast(getActor()).getCore().getFlags() & PxParticleFlag::eDISABLE_RIGID_COLLISION)) + { + getScene().getBoundsArray().setBounds(PxBounds3(PxVec3(PX_MAX_BOUNDS_EXTENTS), PxVec3(-PX_MAX_BOUNDS_EXTENTS)), index); + mInBroadPhase = true; + } + else + getScene().getAABBManager()->reserveSpaceForBounds(index); + + { + const PxU32 group = Bp::FilterGroup::ePARTICLES; + const PxU32 type = Bp::FilterType::PARTICLESYSTEM; + const PxReal contactOffset = getBodySim().getCore().getContactOffset(); + addToAABBMgr(contactOffset, Bp::FilterGroup::Enum((group << BP_FILTERING_TYPE_SHIFT_BIT) | type), Bp::ElementType::eSHAPE); + } + + // PT: TODO: what's the difference between "getContactOffset()" and "getBodySim().getCore().getContactOffset()" above? + getScene().updateContactDistance(index, getContactOffset()); + + PxsTransformCache& cache = getScene().getLowLevelContext()->getTransformCache(); + cache.initEntry(index); + + PxTransform idt(PxIdentity); + + cache.setTransformCache(idt, 0, index); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::ParticleSystemShapeSim::destroyLowLevelVolume() +{ + if (!isInBroadPhase()) + return; + + Sc::Scene& scene = getScene(); + PxsContactManagerOutputIterator outputs = scene.getLowLevelContext()->getNphaseImplementationContext()->getContactManagerOutputs(); + scene.getNPhaseCore()->onVolumeRemoved(this, 0, outputs); + removeFromAABBMgr(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::ParticleSystemSim& Sc::ParticleSystemShapeSim::getBodySim() const +{ + return static_cast(getActor()); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.h new file mode 100644 index 0000000..7212d58 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemShapeSim.h @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_PARTICLESYSTEM_SHAPE_SIM_H +#define SC_PARTICLESYSTEM_SHAPE_SIM_H + +#include "PxPhysXConfig.h" + +#include "ScElementSim.h" +#include "ScShapeSimBase.h" + + +namespace physx +{ + namespace Sc + { + class ParticleSystemSim; + class ParticleSystemShapeCore; + + /** + A collision detection primitive for soft body. + */ + class ParticleSystemShapeSim : public ShapeSimBase + { + ParticleSystemShapeSim& operator=(const ParticleSystemShapeSim &); + public: + ParticleSystemShapeSim(ParticleSystemSim& particleSystem, const ParticleSystemShapeCore* core); + virtual ~ParticleSystemShapeSim(); + + // ElementSim implementation + virtual void getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const; + // ~ElementSim + + ParticleSystemSim& getBodySim() const; + + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + void createLowLevelVolume(); + void destroyLowLevelVolume(); + + }; + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp new file mode 100644 index 0000000..08baaeb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.cpp @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScParticleSystemSim.h" +#include "ScParticleSystemCore.h" +#include "ScScene.h" + +using namespace physx; +using namespace physx::Dy; + + +Sc::ParticleSystemSim::ParticleSystemSim(ParticleSystemCore& core, Scene& scene) : + ActorSim(scene, core), + mShapeSim(*this, &core.getShapeCore()), + mNumCountedInteractions(0) +{ + + mLLParticleSystem = scene.createLLParticleSystem(this); + + mNodeIndex = scene.getSimpleIslandManager()->addParticleSystem(mLLParticleSystem, false); + + scene.getSimpleIslandManager()->activateNode(mNodeIndex); + + + //mCore.setSim(this); + + mLLParticleSystem->setElementId(mShapeSim.getElementID()); + + PxParticleSystemGeometry geometry; + geometry.mSolverType = core.getSolverType(); + + core.getShapeCore().setGeometry(geometry); + + PxsShapeCore* shapeCore = const_cast(&core.getShapeCore().getCore()); + mLLParticleSystem->setShapeCore(shapeCore); +} + +Sc::ParticleSystemSim::~ParticleSystemSim() +{ + if (!mLLParticleSystem) + return; + + mScene.destroyLLParticleSystem(*mLLParticleSystem); + + mScene.getSimpleIslandManager()->removeNode(mNodeIndex); + + mCore.setSim(NULL); +} + +void Sc::ParticleSystemSim::updateBounds() +{ + mShapeSim.updateBounds(); +} + +void Sc::ParticleSystemSim::updateBoundsInAABBMgr() +{ + mShapeSim.updateBoundsInAABBMgr(); +} + +PxBounds3 Sc::ParticleSystemSim::getBounds() const +{ + return mShapeSim.getBounds(); +} + +bool Sc::ParticleSystemSim::isSleeping() const +{ + return false; +} + +void Sc::ParticleSystemSim::sleepCheck(PxReal dt) +{ + PX_UNUSED(dt); +} + +void Sc::ParticleSystemSim::setActive(const bool b, const PxU32 infoFlag) +{ + PX_UNUSED(b); + PX_UNUSED(infoFlag); +} + +void Sc::ParticleSystemSim::activate() +{ + activateInteractions(*this); +} + +void Sc::ParticleSystemSim::deactivate() +{ + deactivateInteractions(*this); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.h new file mode 100644 index 0000000..ace0669 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScParticleSystemSim.h @@ -0,0 +1,88 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_PARTICLESYSTEM_SIM_H +#define SC_PARTICLESYSTEM_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "ScActorSim.h" +#include "ScParticleSystemCore.h" +#include "ScParticleSystemShapeSim.h" + +namespace physx +{ + namespace Sc + { + class Scene; + + class ParticleSystemSim : public ActorSim + { + public: + ParticleSystemSim(ParticleSystemCore& core, Scene& scene); + + ~ParticleSystemSim(); + + PX_INLINE Dy::ParticleSystem* getLowLevelParticleSystem() const { return mLLParticleSystem; } + PX_INLINE ParticleSystemCore& getCore() const { return static_cast(mCore); } + + virtual PxActor* getPxActor() const { return getCore().getPxActor(); } + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + bool isSleeping() const; + bool isActive() const { return true; } + void sleepCheck(PxReal dt); + + void setActive(const bool b, const PxU32 infoFlag = 0); + + const ParticleSystemShapeSim& getShapeSim() const { return mShapeSim; } + ParticleSystemShapeSim& getShapeSim() { return mShapeSim; } + + virtual void registerCountedInteraction() { mNumCountedInteractions++; } + virtual void unregisterCountedInteraction() { mNumCountedInteractions--; } + virtual PxU32 getNumCountedInteractions() const { return mNumCountedInteractions; } + + virtual void activate(); + virtual void deactivate(); + + private: + ParticleSystemSim & operator=(const ParticleSystemSim&); + + Dy::ParticleSystem* mLLParticleSystem; + + ParticleSystemShapeSim mShapeSim; + + PxU32 mNumCountedInteractions; + + }; + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp new file mode 100644 index 0000000..7794d47 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScPhysics.cpp @@ -0,0 +1,59 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "common/PxTolerancesScale.h" + +#include "ScPhysics.h" +#include "ScScene.h" +#include "PxvGlobals.h" + +using namespace physx; + +Sc::Physics* Sc::Physics::mInstance = NULL; +const PxReal Sc::Physics::sWakeCounterOnCreation = 20.0f*0.02f; + +namespace physx +{ + namespace Sc + { + OffsetTable gOffsetTable; + } +} + +Sc::Physics::Physics(const PxTolerancesScale& scale, const PxvOffsetTable& pxvOffsetTable) : mScale(scale) +{ + mInstance = this; + PxvInit(pxvOffsetTable); +} + +Sc::Physics::~Physics() +{ + PxvTerm(); + mInstance = NULL; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp new file mode 100644 index 0000000..66d9b4e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidCore.cpp @@ -0,0 +1,151 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScRigidCore.h" +#include "ScStaticCore.h" +#include "ScRigidSim.h" +#include "ScShapeSim.h" +#include "ScScene.h" + +using namespace physx; +using namespace Sc; + +static ShapeSim& getSimForShape(const ShapeCore& core, const ActorSim& actorSim) +{ + if(core.getSim()) + { + //Exclusive shape. + return *core.getSim(); + } + + //Must be a shared shape. + //Search backwards to emulate the behaviour of the previous linked list. + PxU32 nbElems = actorSim.getNbElements(); + ElementSim*const* elems = actorSim.getElements() + (nbElems - 1); + while (nbElems--) + { + ShapeSim* sim = static_cast(*elems--); + if (&sim->getCore() == &core) + return *sim; + } + + PX_ASSERT(0); // should never fail + return *reinterpret_cast(1); +} + +RigidCore::RigidCore(const PxActorType::Enum type) +: ActorCore(type, PxActorFlag::eVISUALIZATION, PX_DEFAULT_CLIENT, 0) +{ +} + +RigidCore::~RigidCore() +{ +} + +void RigidCore::addShapeToScene(ShapeCore& shapeCore) +{ + RigidSim* sim = getSim(); + PX_ASSERT(sim); + if(!sim) + return; + sim->getScene().addShape_(*sim, shapeCore); +} + +void RigidCore::removeShapeFromScene(ShapeCore& shapeCore, bool wakeOnLostTouch) +{ + RigidSim* sim = getSim(); + if(!sim) + return; + ShapeSim& s = getSimForShape(shapeCore, *sim); + sim->getScene().removeShape_(s, wakeOnLostTouch); +} + +void RigidCore::unregisterShapeFromNphase(Sc::ShapeCore& shapeCore) +{ + RigidSim* sim = getSim(); + if (!sim) + return; + ShapeSim& s = getSimForShape(shapeCore, *sim); + s.getScene().unregisterShapeFromNphase(shapeCore, s.getElementID()); +} + +void RigidCore::registerShapeInNphase(Sc::ShapeCore& shapeCore) +{ + RigidSim* sim = getSim(); + if (!sim) + return; + ShapeSim& s = getSimForShape(shapeCore, *sim); + s.getScene().registerShapeInNphase(this, shapeCore, s.getElementID()); +} + +void RigidCore::onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags) +{ + RigidSim* sim = getSim(); + if(!sim) + return; + ShapeSim& s = getSimForShape(shape, *sim); + + if(notifyFlags & ShapeChangeNotifyFlag::eGEOMETRY) + s.onVolumeOrTransformChange(); + if(notifyFlags & ShapeChangeNotifyFlag::eMATERIAL) + s.onMaterialChange(); + if(notifyFlags & ShapeChangeNotifyFlag::eRESET_FILTERING) + s.onResetFiltering(); + if(notifyFlags & ShapeChangeNotifyFlag::eSHAPE2BODY) + s.onVolumeOrTransformChange(); + if(notifyFlags & ShapeChangeNotifyFlag::eFILTERDATA) + s.onFilterDataChange(); + if(notifyFlags & ShapeChangeNotifyFlag::eCONTACTOFFSET) + s.onContactOffsetChange(); + if(notifyFlags & ShapeChangeNotifyFlag::eRESTOFFSET) + s.onRestOffsetChange(); +} + +void RigidCore::onShapeFlagsChange(ShapeCore& shape, PxShapeFlags oldShapeFlags) +{ + // DS: We pass flags to avoid searching multiple times or exposing RigidSim outside SC. + //If we start hitting this a lot we should do it + // a different way, but shape modification after insertion is rare. + + RigidSim* sim = getSim(); + if(!sim) + return; + ShapeSim& s = getSimForShape(shape, *sim); + s.onFlagChange(oldShapeFlags); +} + +RigidSim* RigidCore::getSim() const +{ + return static_cast(ActorCore::getSim()); +} + +PxU32 RigidCore::getRigidID() const +{ + return static_cast(ActorCore::getSim())->getActorID(); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp new file mode 100644 index 0000000..35d5ed3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.cpp @@ -0,0 +1,82 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScScene.h" +#include "ScRigidSim.h" +#include "ScShapeSim.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace Sc; + +/* + PT: + + The BP group ID comes from a Cm::IDPool, and ActorSim is the only class releasing the ID. + + The rigid tracker ID comes from a Cm::IDPool internal to an ObjectIDTracker, and ActorSim + is the only class using it. + + Thus we should: + - promote the BP group ID stuff to a "tracker" object + - use the BP group ID as a rigid ID +*/ + +RigidSim::RigidSim(Scene& scene, RigidCore& core) : ActorSim(scene, core) +{ +} + +RigidSim::~RigidSim() +{ +} + +void notifyActorInteractionsOfTransformChange(ActorSim& actor); +void RigidSim::notifyShapesOfTransformChange() +{ + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* sim = static_cast(*elems++); + sim->markBoundsForUpdate(); + } + + notifyActorInteractionsOfTransformChange(*this); +} + +void RigidSim::setBodyNodeIndex(const PxNodeIndex nodeIndex) +{ + PxU32 nbElems = getNbElements(); + ElementSim** elems = getElements(); + while (nbElems--) + { + ShapeSim* sim = static_cast(*elems++); + getScene().getSimulationController()->updateShape(sim->getLLShapeSim(), nodeIndex); + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.h new file mode 100644 index 0000000..cd3e3a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScRigidSim.h @@ -0,0 +1,60 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_RIGID_SIM_H +#define SC_RIGID_SIM_H + +#include "ScActorSim.h" +#include "ScRigidCore.h" + +namespace physx +{ +namespace Sc +{ + class Scene; + + class RigidSim : public ActorSim + { + public: + RigidSim(Scene&, RigidCore&); + virtual ~RigidSim(); + + PX_FORCE_INLINE RigidCore& getRigidCore() const { return static_cast(mCore); } + + void notifyShapesOfTransformChange(); + + void setBodyNodeIndex(const PxNodeIndex nodeIndex); + + virtual PxActor* getPxActor() const { return getRigidCore().getPxActor(); } + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp new file mode 100644 index 0000000..c09cd99 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScScene.cpp @@ -0,0 +1,7929 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#define NOMINMAX + +#include "common/PxProfileZone.h" +#include "foundation/PxTime.h" +#include "ScPhysics.h" +#include "ScScene.h" +#include "BpAABBManager.h" +#include "BpBroadPhase.h" +#include "ScStaticSim.h" +#include "ScConstraintSim.h" +#include "ScConstraintProjectionManager.h" +#include "ScConstraintCore.h" +#include "ScArticulationCore.h" +#include "ScArticulationJointCore.h" +#include "ScArticulationTendonCore.h" +#include "ScArticulationSensor.h" +#include "ScArticulationSim.h" +#include "ScArticulationJointSim.h" +#include "foundation/PxTime.h" +#include "ScArticulationTendonSim.h" +#include "ScArticulationSensorSim.h" +#include "ScConstraintInteraction.h" +#include "ScTriggerInteraction.h" +#include "ScSimStats.h" +#include "ScTriggerPairs.h" +#include "ScObjectIDTracker.h" +#include "PxvManager.h" +#include "PxvGlobals.h" +#include "DyContext.h" +#include "PxsCCD.h" +#include "PxsSimpleIslandManager.h" +#include "ScSimulationController.h" +#include "ScSqBoundsManager.h" +#include "ScElementSim.h" + +#if defined(__APPLE__) && defined(__POWERPC__) +#include +#endif + +#if PX_SUPPORT_GPU_PHYSX +#include "PxPhysXGpu.h" +#include "PxsKernelWrangler.h" +#include "PxsHeapMemoryAllocator.h" +#include "cudamanager/PxCudaContextManager.h" +#endif + +#include "PxsMemoryManager.h" + +//////////// + +#include "PxvNphaseImplementationContext.h" +#include "ScShapeInteraction.h" +#include "ScElementInteractionMarker.h" +#include "PxsContext.h" + +#include "PxRigidDynamic.h" + +#include "PxvDynamics.h" +#include "DyFeatherstoneArticulation.h" + +#if PX_SUPPORT_GPU_PHYSX +#include "PxSoftBody.h" +#include "ScSoftBodySim.h" +#include "DySoftBody.h" +#if PX_ENABLE_FEATURES_UNDER_CONSTRUCTION +#include "PxFEMCloth.h" +#include "PxHairSystem.h" +#endif +#include "ScFEMClothSim.h" +#include "DyFEMCloth.h" +#include "ScParticleSystemSim.h" +#include "DyParticleSystem.h" +#include "ScHairSystemSim.h" +#include "DyHairSystem.h" +#endif + +#include "CmPtrTable.h" +#include "CmTransformUtils.h" + +using namespace physx; +using namespace physx::Cm; +using namespace physx::Dy; + +PX_IMPLEMENT_OUTPUT_ERROR + +namespace physx { +namespace Sc { + +class LLArticulationRCPool : public PxPool > +{ +public: + LLArticulationRCPool() {} +}; + +#if PX_SUPPORT_GPU_PHYSX + class LLSoftBodyPool : public PxPool > + { + public: + LLSoftBodyPool() {} + }; + + class LLFEMClothPool : public PxPool > + { + public: + LLFEMClothPool() {} + }; + + class LLParticleSystemPool : public PxPool > + { + public: + LLParticleSystemPool() {} + }; + + class LLHairSystemPool : public PxPool > + { + public: + LLHairSystemPool() {} + }; +#endif + +static const char* sFilterShaderDataMemAllocId = "SceneDesc filterShaderData"; + +}} + +void PxcClearContactCacheStats(); +void PxcDisplayContactCacheStats(); + +class ScAfterIntegrationTask : public Cm::Task +{ +public: + static const PxU32 MaxTasks = 256; +private: + const PxNodeIndex* const mIndices; + const PxU32 mNumBodies; + PxsContext* mContext; + Context* mDynamicsContext; + PxsTransformCache& mCache; + Sc::Scene& mScene; + +public: + + ScAfterIntegrationTask(const PxNodeIndex* const indices, PxU32 numBodies, PxsContext* context, Context* dynamicsContext, PxsTransformCache& cache, Sc::Scene& scene) : + Cm::Task (scene.getContextId()), + mIndices (indices), + mNumBodies (numBodies), + mContext (context), + mDynamicsContext(dynamicsContext), + mCache (cache), + mScene (scene) + { + } + + virtual void runInternal() + { + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + Sc::BodySim* bpUpdates[MaxTasks]; + Sc::BodySim* ccdBodies[MaxTasks]; + Sc::BodySim* activateBodies[MaxTasks]; + Sc::BodySim* deactivateBodies[MaxTasks]; + PxU32 nbBpUpdates = 0, nbCcdBodies = 0; + + IG::SimpleIslandManager& manager = *mScene.getSimpleIslandManager(); + const IG::IslandSim& islandSim = manager.getAccurateIslandSim(); + Bp::BoundsArray& boundsArray = mScene.getBoundsArray(); + + Sc::BodySim* frozen[MaxTasks], * unfrozen[MaxTasks]; + PxU32 nbFrozen = 0, nbUnfrozen = 0; + PxU32 nbActivated = 0, nbDeactivated = 0; + + for(PxU32 i = 0; i < mNumBodies; i++) + { + PxsRigidBody* rigid = islandSim.getRigidBody(mIndices[i]); + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(rigid) - rigidBodyOffset); + //This move to PxgPostSolveWorkerTask for the gpu dynamic + //bodySim->sleepCheck(mDt, mOneOverDt, mEnableStabilization); + + PxsBodyCore& bodyCore = bodySim->getBodyCore().getCore(); + //If we got in this code, then this is an active object this frame. The solver computed the new wakeCounter and we + //commit it at this stage. We need to do it this way to avoid a race condition between the solver and the island gen, where + //the island gen may have deactivated a body while the solver decided to change its wake counter. + bodyCore.wakeCounter = bodyCore.solverWakeCounter; + PxsRigidBody& llBody = bodySim->getLowLevelBody(); + + const PxIntBool isFrozen = bodySim->isFrozen(); + if(!isFrozen) + { + bpUpdates[nbBpUpdates++] = bodySim; + + // PT: TODO: remove duplicate "isFrozen" test inside updateCached +// bodySim->updateCached(NULL); + bodySim->updateCached(mCache, boundsArray); + } + + if(llBody.isFreezeThisFrame() && isFrozen) + frozen[nbFrozen++] = bodySim; + else if(llBody.isUnfreezeThisFrame()) + unfrozen[nbUnfrozen++] = bodySim; + + if(bodyCore.mFlags & PxRigidBodyFlag::eENABLE_CCD) + ccdBodies[nbCcdBodies++] = bodySim; + + if(llBody.isActivateThisFrame()) + { + PX_ASSERT(!llBody.isDeactivateThisFrame()); + activateBodies[nbActivated++] = bodySim; + } + else if(llBody.isDeactivateThisFrame()) + { + deactivateBodies[nbDeactivated++] = bodySim; + } + llBody.clearAllFrameFlags(); + } + if(nbBpUpdates) + { + mCache.setChangedState(); + boundsArray.setChangedState(); + } + + if(nbBpUpdates>0 || nbFrozen > 0 || nbCcdBodies>0 || nbActivated>0 || nbDeactivated>0) + { + //Write active bodies to changed actor map + mContext->getLock().lock(); + PxBitMapPinned& changedAABBMgrHandles = mScene.getAABBManager()->getChangedAABBMgActorHandleMap(); + + for(PxU32 i = 0; i < nbBpUpdates; i++) + { + // PT: ### changedMap pattern #1 + PxU32 nbElems = bpUpdates[i]->getNbElements(); + Sc::ElementSim** elems = bpUpdates[i]->getElements(); + while (nbElems--) + { + Sc::ShapeSim* sim = static_cast(*elems++); + // PT: TODO: what's the difference between this test and "isInBroadphase" as used in bodySim->updateCached ? + // PT: Also, shouldn't it be "isInAABBManager" rather than BP ? + if (sim->getFlags()&PxU32(PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE)) // TODO: need trigger shape here? + changedAABBMgrHandles.growAndSet(sim->getElementID()); + } + } + + PxArray& sceneCcdBodies = mScene.getCcdBodies(); + for (PxU32 i = 0; i < nbCcdBodies; i++) + sceneCcdBodies.pushBack(ccdBodies[i]); + + for(PxU32 i=0;iisFrozen()); + frozen[i]->freezeTransforms(&changedAABBMgrHandles); + } + + for(PxU32 i=0;iisFrozen()); + unfrozen[i]->createSqBounds(); + } + + for(PxU32 i = 0; i < nbActivated; ++i) + activateBodies[i]->notifyNotReadyForSleeping(); + + for(PxU32 i = 0; i < nbDeactivated; ++i) + deactivateBodies[i]->notifyReadyForSleeping(); + + mContext->getLock().unlock(); + } + } + + virtual const char* getName() const + { + return "ScScene.afterIntegrationTask"; + } + +private: + PX_NOCOPY(ScAfterIntegrationTask) +}; + +static const bool gUseNewTaskAllocationScheme = false; + +class ScSimulationControllerCallback : public PxsSimulationControllerCallback +{ + Sc::Scene* mScene; +public: + + ScSimulationControllerCallback(Sc::Scene* scene) : mScene(scene) + { + } + + virtual void updateScBodyAndShapeSim(PxBaseTask* continuation) + { + PxsContext* contextLL = mScene->getLowLevelContext(); + IG::SimpleIslandManager* islandManager = mScene->getSimpleIslandManager(); + Dy::Context* dynamicContext = mScene->getDynamicsContext(); + + Cm::FlushPool& flushPool = contextLL->getTaskPool(); + + const PxU32 MaxBodiesPerTask = ScAfterIntegrationTask::MaxTasks; + + PxsTransformCache& cache = contextLL->getTransformCache(); + + const IG::IslandSim& islandSim = islandManager->getAccurateIslandSim(); + + /*const*/ PxU32 numBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + const PxNodeIndex*const nodeIndices = islandSim.getActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + if(!gUseNewTaskAllocationScheme) + { + PxU32 nbShapes = 0; + PxU32 startIdx = 0; + for (PxU32 i = 0; i < numBodies; i++) + { + if (nbShapes >= MaxBodiesPerTask) + { + ScAfterIntegrationTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScAfterIntegrationTask)), ScAfterIntegrationTask(nodeIndices + startIdx, i - startIdx, + contextLL, dynamicContext, cache, *mScene)); + task->setContinuation(continuation); + task->removeReference(); + startIdx = i; + nbShapes = 0; + } + PxsRigidBody* rigid = islandSim.getRigidBody(nodeIndices[i]); + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(rigid) - rigidBodyOffset); + nbShapes += PxMax(1u, bodySim->getNbShapes()); //Always add at least 1 shape in, even if the body has zero shapes because there is still some per-body overhead + } + + if (nbShapes) + { + ScAfterIntegrationTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScAfterIntegrationTask)), ScAfterIntegrationTask(nodeIndices + startIdx, numBodies - startIdx, + contextLL, dynamicContext, cache, *mScene)); + task->setContinuation(continuation); + task->removeReference(); + } + } + else + { + // PT: + const PxU32 numCpuTasks = continuation->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + PxU32 nbPerTask; + if(numCpuTasks) + nbPerTask = numBodies > numCpuTasks ? numBodies / numCpuTasks : numBodies; + else + nbPerTask = numBodies; + + // PT: we need to respect that limit even with a single thread, because of hardcoded buffer limits in ScAfterIntegrationTask. + if(nbPerTask>MaxBodiesPerTask) + nbPerTask = MaxBodiesPerTask; + + PxU32 start = 0; + while(numBodies) + { + const PxU32 nb = numBodies < nbPerTask ? numBodies : nbPerTask; + + ScAfterIntegrationTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScAfterIntegrationTask)), ScAfterIntegrationTask(nodeIndices+start, nb, + contextLL, dynamicContext, cache, *mScene)); + + start += nb; + numBodies -= nb; + + task->setContinuation(continuation); + task->removeReference(); + } + } + } + + virtual PxU32 getNbCcdBodies() + { + return mScene->getCcdBodies().size(); + } +}; + +class PxgUpdateBodyAndShapeStatusTask : public Cm::Task +{ +public: + static const PxU32 MaxTasks = 2048; +private: + const PxNodeIndex* const mNodeIndices; + const PxU32 mNumBodies; + Sc::Scene& mScene; + void** mRigidBodyLL; + PxU32* mActivatedBodies; + PxU32* mDeactivatedBodies; + PxI32& mCCDBodyWriteIndex; + +public: + + PxgUpdateBodyAndShapeStatusTask(const PxNodeIndex* const indices, PxU32 numBodies, void** rigidBodyLL, PxU32* activatedBodies, PxU32* deactivatedBodies, Sc::Scene& scene, PxI32& ccdBodyWriteIndex) : + Cm::Task (scene.getContextId()), + mNodeIndices (indices), + mNumBodies (numBodies), + mScene (scene), + mRigidBodyLL (rigidBodyLL), + mActivatedBodies (activatedBodies), + mDeactivatedBodies (deactivatedBodies), + mCCDBodyWriteIndex (ccdBodyWriteIndex) + { + } + + virtual void runInternal() + { + IG::SimpleIslandManager& islandManager = *mScene.getSimpleIslandManager(); + const IG::IslandSim& islandSim = islandManager.getAccurateIslandSim(); + + PxU32 nbCcdBodies = 0; + + PxArray& sceneCcdBodies = mScene.getCcdBodies(); + Sc::BodySim* ccdBodies[MaxTasks]; + + const size_t bodyOffset = PX_OFFSET_OF_RT(Sc::BodySim, getLowLevelBody()); + + for(PxU32 i=0; i(mRigidBodyLL[nodeIndex]); + + PxsBodyCore* bodyCore = &rigidLL->getCore(); + bodyCore->wakeCounter = bodyCore->solverWakeCounter; + //we can set the frozen/unfrozen flag in GPU, but we have copied the internalflags + //from the solverbodysleepdata to pxsbodycore, so we just need to clear the frozen flag in here + rigidLL->clearAllFrameFlags(); + + PX_ASSERT(mActivatedBodies[nodeIndex] <= 1); + PX_ASSERT(mDeactivatedBodies[nodeIndex] <= 1); + if(mActivatedBodies[nodeIndex]) + { + PX_ASSERT(bodyCore->wakeCounter > 0.0f); + islandManager.activateNode(mNodeIndices[i]); + } + else if(mDeactivatedBodies[nodeIndex]) + { + //KS - the CPU code can reset the wake counter due to lost touches in parallel with the solver, so we need to verify + //that the wakeCounter is still 0 before deactivating the node + if (bodyCore->wakeCounter == 0.0f) + { + islandManager.deactivateNode(mNodeIndices[i]); + } + } + + if (bodyCore->mFlags & PxRigidBodyFlag::eENABLE_CCD) + { + PxsRigidBody* rigidBody = islandSim.getRigidBody(mNodeIndices[i]); + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(rigidBody) - bodyOffset); + ccdBodies[nbCcdBodies++] = bodySim; + } + } + if(nbCcdBodies > 0) + { + PxI32 startIndex = PxAtomicAdd(&mCCDBodyWriteIndex, PxI32(nbCcdBodies)) - PxI32(nbCcdBodies); + for(PxU32 a = 0; a < nbCcdBodies; ++a) + { + sceneCcdBodies[startIndex + a] = ccdBodies[a]; + } + } + } + + virtual const char* getName() const + { + return "ScScene.PxgUpdateBodyAndShapeStatusTask"; + } + +private: + PX_NOCOPY(PxgUpdateBodyAndShapeStatusTask) +}; + +class PxgSimulationControllerCallback : public PxsSimulationControllerCallback +{ + Sc::Scene* mScene; + PxI32 mCcdBodyWriteIndex; + +public: + PxgSimulationControllerCallback(Sc::Scene* scene) : mScene(scene), mCcdBodyWriteIndex(0) + { + } + + virtual void updateScBodyAndShapeSim(PxBaseTask* continuation) + { + IG::SimpleIslandManager* islandManager = mScene->getSimpleIslandManager(); + PxsSimulationController* simulationController = mScene->getSimulationController(); + PxsContext* contextLL = mScene->getLowLevelContext(); + IG::IslandSim& islandSim = islandManager->getAccurateIslandSim(); + const PxU32 numBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + const PxNodeIndex*const nodeIndices = islandSim.getActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + PxU32* activatedBodies = simulationController->getActiveBodies(); + PxU32* deactivatedBodies = simulationController->getDeactiveBodies(); + + //PxsRigidBody** rigidBodyLL = simulationController->getRigidBodies(); + void** rigidBodyLL = simulationController->getRigidBodies(); + + Cm::FlushPool& flushPool = contextLL->getTaskPool(); + + PxArray& ccdBodies = mScene->getCcdBodies(); + ccdBodies.forceSize_Unsafe(0); + ccdBodies.reserve(numBodies); + ccdBodies.forceSize_Unsafe(numBodies); + + mCcdBodyWriteIndex = 0; + + for(PxU32 i = 0; i < numBodies; i+=PxgUpdateBodyAndShapeStatusTask::MaxTasks) + { + PxgUpdateBodyAndShapeStatusTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(PxgUpdateBodyAndShapeStatusTask)), PxgUpdateBodyAndShapeStatusTask(nodeIndices + i, + PxMin(PxgUpdateBodyAndShapeStatusTask::MaxTasks, numBodies - i), rigidBodyLL, activatedBodies, deactivatedBodies, *mScene, mCcdBodyWriteIndex)); + task->setContinuation(continuation); + task->removeReference(); + } + + PxU32* unfrozenShapeIndices = simulationController->getUnfrozenShapes(); + PxU32* frozenShapeIndices = simulationController->getFrozenShapes(); + const PxU32 nbFrozenShapes = simulationController->getNbFrozenShapes(); + const PxU32 nbUnfrozenShapes = simulationController->getNbUnfrozenShapes(); + + PxsShapeSim** shapeSimsLL = simulationController->getShapeSims(); + + const size_t shapeOffset = PX_OFFSET_OF_RT(Sc::ShapeSim, getLLShapeSim()); + + for(PxU32 i=0; i(reinterpret_cast(shapeLL) - shapeOffset); + shape->destroySqBounds(); + } + + for(PxU32 i=0; i(reinterpret_cast(shapeLL) - shapeOffset); + shape->createSqBounds(); + } + + +#if PX_SUPPORT_GPU_PHYSX + if (simulationController->hasFEMCloth()) + { + + //KS - technically, there's a race condition calling activateNode/deactivateNode, but we know that it is + //safe because these deactivate/activate calls came from the solver. This means that we know that the + //actors are active currently, so at most we are just clearing/setting the ready for sleeping flag. + //None of the more complex logic that touching shared state will be executed. + const PxU32 nbActivatedCloth = simulationController->getNbActivatedFEMCloth(); + Dy::FEMCloth** activatedCloths = simulationController->getActivatedFEMCloths(); + + for (PxU32 i = 0; i < nbActivatedCloth; ++i) + { + PxNodeIndex nodeIndex = activatedCloths[i]->getFEMClothSim()->getNodeIndex(); + + islandManager->activateNode(nodeIndex); + } + + const PxU32 nbDeactivatedCloth = simulationController->getNbDeactivatedFEMCloth(); + Dy::FEMCloth** deactivatedCloths = simulationController->getDeactivatedFEMCloths(); + + for (PxU32 i = 0; i < nbDeactivatedCloth; ++i) + { + PxNodeIndex nodeIndex = deactivatedCloths[i]->getFEMClothSim()->getNodeIndex(); + + islandManager->deactivateNode(nodeIndex); + } + } + + if (simulationController->hasSoftBodies()) + { + + //KS - technically, there's a race condition calling activateNode/deactivateNode, but we know that it is + //safe because these deactivate/activate calls came from the solver. This means that we know that the + //actors are active currently, so at most we are just clearing/setting the ready for sleeping flag. + //None of the more complex logic that touching shared state will be executed. + + const PxU32 nbDeactivatedSB = simulationController->getNbDeactivatedSoftbodies(); + Dy::SoftBody** deactivatedSB = simulationController->getDeactivatedSoftbodies(); + + for (PxU32 i = 0; i < nbDeactivatedSB; ++i) + { + PxNodeIndex nodeIndex = deactivatedSB[i]->getSoftBodySim()->getNodeIndex(); + + islandManager->deactivateNode(nodeIndex); + } + + const PxU32 nbActivatedSB = simulationController->getNbActivatedSoftbodies(); + Dy::SoftBody** activatedSB = simulationController->getActivatedSoftbodies(); + + for (PxU32 i = 0; i < nbActivatedSB; ++i) + { + PxNodeIndex nodeIndex = activatedSB[i]->getSoftBodySim()->getNodeIndex(); + + islandManager->activateNode(nodeIndex); + } + } + + if (simulationController->hasHairSystems()) + { + // comment from KS regarding race condition applies here, too + const PxU32 nbDeactivatedHS = simulationController->getNbDeactivatedHairSystems(); + Dy::HairSystem** deactivatedHS = simulationController->getDeactivatedHairSystems(); + for (PxU32 i = 0; i < nbDeactivatedHS; ++i) + { + PxNodeIndex nodeIndex = deactivatedHS[i]->getHairSystemSim()->getNodeIndex(); + islandManager->deactivateNode(nodeIndex); + } + + const PxU32 nbActivatedHS = simulationController->getNbActivatedHairSystems(); + Dy::HairSystem** activatedHS = simulationController->getActivatedHairSystems(); + for (PxU32 i = 0; i < nbActivatedHS; ++i) + { + PxNodeIndex nodeIndex = activatedHS[i]->getHairSystemSim()->getNodeIndex(); + islandManager->activateNode(nodeIndex); + } + } +#endif + + } + + virtual PxU32 getNbCcdBodies() + { + return PxU32(mCcdBodyWriteIndex); + } +}; + +static Bp::AABBManagerBase* createAABBManagerCPU(const PxSceneDesc& desc, Bp::BroadPhase* broadPhase, Bp::BoundsArray* boundsArray, PxFloatArrayPinned* contactDistances, PxVirtualAllocator& allocator, PxU64 contextID) +{ + return PX_NEW(Bp::AABBManager)(*broadPhase, *boundsArray, *contactDistances, + desc.limits.maxNbAggregates, desc.limits.maxNbStaticShapes + desc.limits.maxNbDynamicShapes, allocator, contextID, + desc.kineKineFilteringMode, desc.staticKineFilteringMode); +} + +#if PX_SUPPORT_GPU_PHYSX +static Bp::AABBManagerBase* createAABBManagerGPU(PxsKernelWranglerManager* kernelWrangler, PxCudaContextManager* cudaContextManager, PxsHeapMemoryAllocatorManager* heapMemoryAllocationManager, + const PxSceneDesc& desc, Bp::BroadPhase* broadPhase, Bp::BoundsArray* boundsArray, PxFloatArrayPinned* contactDistances, PxVirtualAllocator& allocator, PxU64 contextID) +{ + return PxvGetPhysXGpu(true)->createGpuAABBManager( + kernelWrangler, + cudaContextManager, + desc.gpuComputeVersion, + desc.gpuDynamicsConfig, + heapMemoryAllocationManager, + *broadPhase, *boundsArray, *contactDistances, + desc.limits.maxNbAggregates, desc.limits.maxNbStaticShapes + desc.limits.maxNbDynamicShapes, allocator, contextID, + desc.kineKineFilteringMode, desc.staticKineFilteringMode); +} +#endif + +Sc::Scene::Scene(const PxSceneDesc& desc, PxU64 contextID) : + mContextId (contextID), + mActiveBodies ("sceneActiveBodies"), + mActiveKinematicBodyCount (0), + mActiveDynamicBodyCount (0), + mActiveKinematicsCopy (NULL), + mActiveKinematicsCopyCapacity (0), + mPointerBlock8Pool ("scenePointerBlock8Pool"), + mPointerBlock16Pool ("scenePointerBlock16Pool"), + mPointerBlock32Pool ("scenePointerBlock32Pool"), + mLLContext (NULL), + mAABBManager (NULL), + mCCDContext (NULL), + mNumFastMovingShapes (0), + mCCDPass (0), + mSimpleIslandManager (NULL), + mDynamicsContext (NULL), + mMemoryManager (NULL), +#if PX_SUPPORT_GPU_PHYSX + mGpuWranglerManagers (NULL), + mHeapMemoryAllocationManager (NULL), +#endif + mSimulationController (NULL), + mSimulationControllerCallback (NULL), + mGravity (PxVec3(0.0f)), + mBodyGravityDirty (true), + mDt (0), + mOneOverDt (0), + mTimeStamp (1), // PT: has to start to 1 to fix determinism bug. I don't know why yet but it works. + mReportShapePairTimeStamp (0), + mTriggerBufferAPI ("sceneTriggerBufferAPI"), + mArticulations ("sceneArticulations"), +#if PX_SUPPORT_GPU_PHYSX + mSoftBodies ("sceneSoftBodies"), + mFEMCloths ("sceneFEMCloths"), + mParticleSystems ("sceneParticleSystems"), + mHairSystems ("sceneHairSystems"), +#endif + mBrokenConstraints ("sceneBrokenConstraints"), + mActiveBreakableConstraints ("sceneActiveBreakableConstraints"), + mMemBlock128Pool ("PxsContext ConstraintBlock128Pool"), + mMemBlock256Pool ("PxsContext ConstraintBlock256Pool"), + mMemBlock384Pool ("PxsContext ConstraintBlock384Pool"), + mNPhaseCore (NULL), + mKineKineFilteringMode (desc.kineKineFilteringMode), + mStaticKineFilteringMode (desc.staticKineFilteringMode), + mSleepBodies ("sceneSleepBodies"), + mWokeBodies ("sceneWokeBodies"), + mEnableStabilization (desc.flags & PxSceneFlag::eENABLE_STABILIZATION), + mActiveActors ("clientActiveActors"), + mFrozenActors ("clientFrozenActors"), + mClientPosePreviewBodies ("clientPosePreviewBodies"), + mClientPosePreviewBuffer ("clientPosePreviewBuffer"), + mSimulationEventCallback (NULL), + mBroadPhaseCallback (NULL), + mInternalFlags (SceneInternalFlag::eSCENE_DEFAULT), + mPublicFlags (desc.flags), + mStaticAnchor (NULL), + mBatchRemoveState (NULL), + mLostTouchPairs ("sceneLostTouchPairs"), + mOutOfBoundsIDs ("sceneOutOfBoundsIds"), + mVisualizationParameterChanged (false), + mMaxNbArticulationLinks (0), + mNbRigidStatics (0), + mNbRigidDynamics (0), + mNbRigidKinematic (0), + mSecondPassNarrowPhase (contextID, this, "ScScene.secondPassNarrowPhase"), + mPostNarrowPhase (contextID, this, "ScScene.postNarrowPhase"), + mFinalizationPhase (contextID, this, "ScScene.finalizationPhase"), + mUpdateCCDMultiPass (contextID, this, "ScScene.updateCCDMultiPass"), + mAfterIntegration (contextID, this, "ScScene.afterIntegration"), + mConstraintProjection (contextID, this, "ScScene.constraintProjection"), + mPostSolver (contextID, this, "ScScene.postSolver"), + mSolver (contextID, this, "ScScene.rigidBodySolver"), + mUpdateBodies (contextID, this, "ScScene.updateBodies"), + mUpdateShapes (contextID, this, "ScScene.updateShapes"), + mUpdateSimulationController (contextID, this, "ScScene.updateSimulationController"), + mUpdateDynamics (contextID, this, "ScScene.updateDynamics"), + mProcessLostContactsTask (contextID, this, "ScScene.processLostContact"), + mProcessLostContactsTask2 (contextID, this, "ScScene.processLostContact2"), + mProcessLostContactsTask3 (contextID, this, "ScScene.processLostContact3"), + mDestroyManagersTask (contextID, this, "ScScene.destroyManagers"), + mLostTouchReportsTask (contextID, this, "ScScene.lostTouchReports"), + mUnregisterInteractionsTask (contextID, this, "ScScene.unregisterInteractions"), + mProcessNarrowPhaseLostTouchTasks(contextID, this, "ScScene.processNpLostTouchTask"), + mProcessNPLostTouchEvents (contextID, this, "ScScene.processNPLostTouchEvents"), + mPostThirdPassIslandGenTask (contextID, this, "ScScene.postThirdPassIslandGenTask"), + mPostIslandGen (contextID, this, "ScScene.postIslandGen"), + mIslandGen (contextID, this, "ScScene.islandGen"), + mPreRigidBodyNarrowPhase (contextID, this, "ScScene.preRigidBodyNarrowPhase"), + mSetEdgesConnectedTask (contextID, this, "ScScene.setEdgesConnectedTask"), + mFetchPatchEventsTask (contextID, this, "ScScene.fetchPatchEventsTask"), + mProcessLostPatchesTask (contextID, this, "ScScene.processLostSolverPatchesTask"), + mProcessFoundPatchesTask (contextID, this, "ScScene.processFoundSolverPatchesTask"), + mUpdateBoundAndShapeTask (contextID, this, "ScScene.updateBoundsAndShapesTask"), + mRigidBodyNarrowPhase (contextID, this, "ScScene.rigidBodyNarrowPhase"), + mRigidBodyNPhaseUnlock (contextID, this, "ScScene.unblockNarrowPhase"), + mPostBroadPhase (contextID, this, "ScScene.postBroadPhase"), + mPostBroadPhaseCont (contextID, this, "ScScene.postBroadPhaseCont"), + mPostBroadPhase2 (contextID, this, "ScScene.postBroadPhase2"), + mPostBroadPhase3 (contextID, this, "ScScene.postBroadPhase3"), + mPreallocateContactManagers (contextID, this, "ScScene.preallocateContactManagers"), + mIslandInsertion (contextID, this, "ScScene.islandInsertion"), + mRegisterContactManagers (contextID, this, "ScScene.registerContactManagers"), + mRegisterInteractions (contextID, this, "ScScene.registerInteractions"), + mRegisterSceneInteractions (contextID, this, "ScScene.registerSceneInteractions"), + mBroadPhase (contextID, this, "ScScene.broadPhase"), + mAdvanceStep (contextID, this, "ScScene.advanceStep"), + mCollideStep (contextID, this, "ScScene.collideStep"), + mBpFirstPass (contextID, this, "ScScene.broadPhaseFirstPass"), + mBpSecondPass (contextID, this, "ScScene.broadPhaseSecondPass"), + mBpUpdate (contextID, this, "ScScene.updateBroadPhase"), + mPreIntegrate (contextID, this, "ScScene.preIntegrate"), + mTaskPool (16384), + mTaskManager (NULL), + mCudaContextManager (desc.cudaContextManager), + mContactReportsNeedPostSolverVelocity(false), + mUseGpuDynamics(false), + mUseGpuBp (false), + mCCDBp (false), + mSimulationStage (SimulationStage::eCOMPLETE), + mTmpConstraintGroupRootBuffer (NULL), + mPosePreviewBodies ("scenePosePreviewBodies"), + mOverlapFilterTaskHead (NULL), + mIsCollisionPhaseActive (false), + mOnSleepingStateChanged (NULL) +{ + for(PxU32 type = 0; type < InteractionType::eTRACKED_IN_SCENE_COUNT; ++type) + mInteractions[type].reserve(64); + + for (int i=0; i < InteractionType::eTRACKED_IN_SCENE_COUNT; ++i) + mActiveInteractionCount[i] = 0; + + mStats = PX_NEW(SimStats); + mConstraintIDTracker = PX_NEW(ObjectIDTracker); + mActorIDTracker = PX_NEW(ObjectIDTracker); + mElementIDPool = PX_NEW(ObjectIDTracker); + + mTriggerBufferExtraData = reinterpret_cast(PX_ALLOC(sizeof(TriggerBufferExtraData), "ScScene::TriggerBufferExtraData")); + PX_PLACEMENT_NEW(mTriggerBufferExtraData, TriggerBufferExtraData("ScScene::TriggerPairExtraData")); + + mStaticSimPool = PX_NEW(PreallocatingPool)(64, "StaticSim"); + mBodySimPool = PX_NEW(PreallocatingPool)(64, "BodySim"); + mShapeSimPool = PX_NEW(PreallocatingPool)(64, "ShapeSim"); + mConstraintSimPool = PX_NEW(PxPool)("ScScene::ConstraintSim"); + mConstraintInteractionPool = PX_NEW(PxPool)("ScScene::ConstraintInteraction"); + mLLArticulationRCPool = PX_NEW(LLArticulationRCPool); +#if PX_SUPPORT_GPU_PHYSX + mLLSoftBodyPool = PX_NEW(LLSoftBodyPool); + mLLFEMClothPool = PX_NEW(LLFEMClothPool); + mLLParticleSystemPool = PX_NEW(LLParticleSystemPool); + mLLHairSystemPool = PX_NEW(LLHairSystemPool); +#endif + mSimStateDataPool = PX_NEW(PxPool)("ScScene::SimStateData"); + + mProjectionManager = PX_NEW(ConstraintProjectionManager)(); + + mSqBoundsManager = PX_NEW(SqBoundsManager); + + mTaskManager = physx::PxTaskManager::createTaskManager(*PxGetErrorCallback(), desc.cpuDispatcher); + + for(PxU32 i=0; i(__LINE__, "GPU solver pipeline failed, switching to software"); + else if(mCudaContextManager->supportsArchSM30()) + useGpuDynamics = true; + } + + if(desc.broadPhaseType == PxBroadPhaseType::eGPU) + { + if(!mCudaContextManager) + outputError(__LINE__, "GPU Bp pipeline failed, switching to software"); + else if(mCudaContextManager->supportsArchSM30()) + useGpuBroadphase = true; + } +#endif + + mUseGpuDynamics = useGpuDynamics; + mUseGpuBp = useGpuBroadphase; + + mLLContext = PX_NEW(PxsContext)(desc, mTaskManager, mTaskPool, mCudaContextManager, desc.contactPairSlabSize, contextID); + + if (mLLContext == 0) + { + outputError(__LINE__, "Failed to create context!"); + return; + } + mLLContext->setMaterialManager(&getMaterialManager()); + +#if PX_SUPPORT_GPU_PHYSX + if (useGpuBroadphase || useGpuDynamics) + { + PxPhysXGpu* physxGpu = PxvGetPhysXGpu(true); + + // PT: this creates a PxgMemoryManager, whose host memory allocator is a PxgCudaHostMemoryAllocatorCallback + mMemoryManager = physxGpu->createGpuMemoryManager(mLLContext->getCudaContextManager()); + mGpuWranglerManagers = physxGpu->createGpuKernelWranglerManager(mLLContext->getCudaContextManager(), *PxGetErrorCallback(), desc.gpuComputeVersion); + // PT: this creates a PxgHeapMemoryAllocatorManager + mHeapMemoryAllocationManager = physxGpu->createGpuHeapMemoryAllocatorManager(desc.gpuDynamicsConfig.heapCapacity, mMemoryManager, desc.gpuComputeVersion); + } + else +#endif + { + // PT: this creates a PxsDefaultMemoryManager + mMemoryManager = createDefaultMemoryManager(); + } + + Bp::BroadPhase* broadPhase = NULL; + + //Note: broadphase should be independent of AABBManager. MBP uses it to call getBPBounds but it has + //already been passed all bounds in BroadPhase::update() so should use that instead. + // PT: above comment is obsolete: MBP now doesn't call getBPBounds anymore (except in commented out code) + // and it is instead the GPU broadphase which is not independent from the GPU AABB manager....... + if(!useGpuBroadphase) + { + PxBroadPhaseType::Enum broadPhaseType = desc.broadPhaseType; + + if (broadPhaseType == PxBroadPhaseType::eGPU) + broadPhaseType = PxBroadPhaseType::eABP; + + broadPhase = Bp::BroadPhase::create( + broadPhaseType, + desc.limits.maxNbRegions, + desc.limits.maxNbBroadPhaseOverlaps, + desc.limits.maxNbStaticShapes, + desc.limits.maxNbDynamicShapes, + contextID); + } +#if PX_SUPPORT_GPU_PHYSX + else + { + broadPhase = PxvGetPhysXGpu(true)->createGpuBroadPhase( mGpuWranglerManagers, mLLContext->getCudaContextManager(), + desc.gpuComputeVersion, desc.gpuDynamicsConfig, + mHeapMemoryAllocationManager, contextID); + } +#endif + + //create allocator + PxVirtualAllocatorCallback* allocatorCallback = mMemoryManager->getHostMemoryAllocator(); + PxVirtualAllocator allocator(allocatorCallback); + + mBoundsArray = PX_NEW(Bp::BoundsArray)(allocator); + mContactDistance = PX_PLACEMENT_NEW(PX_ALLOC(sizeof(PxFloatArrayPinned), "ContactDistance"), PxFloatArrayPinned)(allocator); + mHasContactDistanceChanged = false; + + const bool useEnhancedDeterminism = mPublicFlags & PxSceneFlag::eENABLE_ENHANCED_DETERMINISM; + + mSimpleIslandManager = PX_NEW(IG::SimpleIslandManager)(useEnhancedDeterminism, contextID); + + if (!useGpuDynamics) + { + if (desc.solverType == PxSolverType::ePGS) + { + mDynamicsContext = createDynamicsContext + (&mLLContext->getNpMemBlockPool(), mLLContext->getScratchAllocator(), + mLLContext->getTaskPool(), mLLContext->getSimStats(), &mLLContext->getTaskManager(), allocatorCallback, &getMaterialManager(), + mSimpleIslandManager, contextID, mEnableStabilization, useEnhancedDeterminism, desc.maxBiasCoefficient, + !!(desc.flags & PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION), desc.getTolerancesScale().length); + } + else + { + mDynamicsContext = createTGSDynamicsContext + (&mLLContext->getNpMemBlockPool(), mLLContext->getScratchAllocator(), + mLLContext->getTaskPool(), mLLContext->getSimStats(), &mLLContext->getTaskManager(), allocatorCallback, &getMaterialManager(), + mSimpleIslandManager, contextID, mEnableStabilization, useEnhancedDeterminism, + desc.getTolerancesScale().length); + } + + mLLContext->setNphaseImplementationContext(createNphaseImplementationContext(*mLLContext, &mSimpleIslandManager->getAccurateIslandSim(), allocatorCallback)); + + mSimulationControllerCallback = PX_NEW(ScSimulationControllerCallback)(this); + mSimulationController = PX_NEW(SimulationController)(mSimulationControllerCallback); + + if (!useGpuBroadphase) + mAABBManager = createAABBManagerCPU(desc, broadPhase, mBoundsArray, mContactDistance, allocator, contextID); +#if PX_SUPPORT_GPU_PHYSX + else + mAABBManager = createAABBManagerGPU(mGpuWranglerManagers, mLLContext->getCudaContextManager(), mHeapMemoryAllocationManager, desc, broadPhase, mBoundsArray, mContactDistance, allocator, contextID); +#endif + } + else + { +#if PX_SUPPORT_GPU_PHYSX + mDynamicsContext = PxvGetPhysXGpu(true)->createGpuDynamicsContext(mLLContext->getTaskPool(), mGpuWranglerManagers, mLLContext->getCudaContextManager(), + desc.gpuDynamicsConfig, mSimpleIslandManager, desc.gpuMaxNumPartitions, desc.gpuMaxNumStaticPartitions, mEnableStabilization, useEnhancedDeterminism, desc.maxBiasCoefficient, desc.gpuComputeVersion, mLLContext->getSimStats(), + mHeapMemoryAllocationManager, !!(desc.flags & PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION), desc.solverType, desc.getTolerancesScale().length); + + void* contactStreamBase = NULL; + void* patchStreamBase = NULL; + void* forceAndIndiceStreamBase = NULL; + + mDynamicsContext->getDataStreamBase(contactStreamBase, patchStreamBase, forceAndIndiceStreamBase); + + PxvNphaseImplementationContextUsableAsFallback* cpuNphaseImplementation = createNphaseImplementationContext(*mLLContext, &mSimpleIslandManager->getAccurateIslandSim(), allocatorCallback); + mLLContext->setNphaseFallbackImplementationContext(cpuNphaseImplementation); + + PxvNphaseImplementationContext* gpuNphaseImplementation = PxvGetPhysXGpu(true)->createGpuNphaseImplementationContext(*mLLContext, mGpuWranglerManagers, cpuNphaseImplementation, desc.gpuDynamicsConfig, contactStreamBase, patchStreamBase, + forceAndIndiceStreamBase, getBoundsArray().getBounds(), &mSimpleIslandManager->getAccurateIslandSim(), mDynamicsContext, desc.gpuComputeVersion, mHeapMemoryAllocationManager, useGpuBroadphase); + + mSimulationControllerCallback = PX_NEW(PxgSimulationControllerCallback)(this); + + mSimulationController = PxvGetPhysXGpu(true)->createGpuSimulationController(mGpuWranglerManagers, mLLContext->getCudaContextManager(), + mDynamicsContext, gpuNphaseImplementation, broadPhase, useGpuBroadphase, mSimpleIslandManager, mSimulationControllerCallback, desc.gpuComputeVersion, mHeapMemoryAllocationManager, + desc.gpuDynamicsConfig.maxSoftBodyContacts, desc.gpuDynamicsConfig.maxFemClothContacts, desc.gpuDynamicsConfig.maxParticleContacts, desc.gpuDynamicsConfig.maxHairContacts); + + mSimulationController->setBounds(mBoundsArray); + mDynamicsContext->setSimulationController(mSimulationController); + + mLLContext->setNphaseImplementationContext(gpuNphaseImplementation); + + mLLContext->mContactStreamPool = &mDynamicsContext->getContactStreamPool(); + mLLContext->mPatchStreamPool = &mDynamicsContext->getPatchStreamPool(); + mLLContext->mForceAndIndiceStreamPool = &mDynamicsContext->getForceStreamPool(); + + // PT: TODO: what's the difference between this allocator and "allocator" above? + PxVirtualAllocator tAllocator(mHeapMemoryAllocationManager->mMappedMemoryAllocators, PxsHeapStats::eBROADPHASE); + + if (!useGpuBroadphase) + // PT: TODO: we're using a CUDA allocator in the CPU broadphase, and a different allocator for the bounds array? + mAABBManager = createAABBManagerCPU(desc, broadPhase, mBoundsArray, mContactDistance, tAllocator, contextID); + else + mAABBManager = createAABBManagerGPU(mGpuWranglerManagers, mLLContext->getCudaContextManager(), mHeapMemoryAllocationManager, desc, broadPhase, mBoundsArray, mContactDistance, tAllocator, contextID); +#endif + } + + bool suppressReadback = mPublicFlags & PxSceneFlag::eSUPPRESS_READBACK; + bool forceReadback = mPublicFlags & PxSceneFlag::eFORCE_READBACK; + + if(suppressReadback && forceReadback) + suppressReadback = false; + + mDynamicsContext->setSuppressReadback(suppressReadback); + + //Construct the bitmap of updated actors required as input to the broadphase update + if(desc.limits.maxNbBodies) + { + // PT: TODO: revisit this. Why do we handle the added/removed and updated bitmaps entirely differently, in different places? And what is this weird formula here? + mAABBManager->getChangedAABBMgActorHandleMap().resize((2*desc.limits.maxNbBodies + 256) & ~255); + } + + //mLLContext->createTransformCache(mDynamicsContext->getAllocatorCallback()); + + mLLContext->createTransformCache(*allocatorCallback); + mLLContext->setContactDistance(mContactDistance); + + mCCDContext = PX_NEW(PxsCCDContext)(mLLContext, mDynamicsContext->getThresholdStream(), *mLLContext->getNphaseImplementationContext(), desc.ccdThreshold); + + setSolverBatchSize(desc.solverBatchSize); + setSolverArticBatchSize(desc.solverArticulationBatchSize); + mDynamicsContext->setFrictionOffsetThreshold(desc.frictionOffsetThreshold); + mDynamicsContext->setCCDSeparationThreshold(desc.ccdMaxSeparation); + mDynamicsContext->setCorrelationDistance(desc.frictionCorrelationDistance); + + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + mLLContext->setMeshContactMargin(0.01f * scale.length); + mLLContext->setToleranceLength(scale.length); + + // the original descriptor uses + // bounce iff impact velocity > threshold + // but LL use + // bounce iff separation velocity < -threshold + // hence we negate here. + + mDynamicsContext->setBounceThreshold(-desc.bounceThresholdVelocity); + + StaticCore* anchorCore = PX_NEW(StaticCore)(PxTransform(PxIdentity)); + + mStaticAnchor = mStaticSimPool->construct(*this, *anchorCore); + + mNPhaseCore = PX_NEW(NPhaseCore)(*this, desc); + + // Init dominance matrix + { + //init all dominance pairs such that: + //if g1 == g2, then (1.0f, 1.0f) is returned + //if g1 < g2, then (0.0f, 1.0f) is returned + //if g1 > g2, then (1.0f, 0.0f) is returned + + PxU32 mask = ~PxU32(1); + for (unsigned i = 0; i < PX_MAX_DOMINANCE_GROUP; ++i, mask <<= 1) + mDominanceBitMatrix[i] = ~mask; + } + +// DeterminismDebugger::begin(); + + mWokeBodyListValid = true; + mSleepBodyListValid = true; + + mWokeSoftBodyListValid = true; + mSleepSoftBodyListValid = true; + + mWokeHairSystemListValid = true; + mSleepHairSystemListValid = true; + + //load from desc: + setLimits(desc.limits); + + // Create broad phase + setBroadPhaseCallback(desc.broadPhaseCallback); + + setGravity(desc.gravity); + + setFrictionType(desc.frictionType); + + setPCM(desc.flags & PxSceneFlag::eENABLE_PCM); + + setContactCache(!(desc.flags & PxSceneFlag::eDISABLE_CONTACT_CACHE)); + setSimulationEventCallback(desc.simulationEventCallback); + setContactModifyCallback(desc.contactModifyCallback); + setCCDContactModifyCallback(desc.ccdContactModifyCallback); + setCCDMaxPasses(desc.ccdMaxPasses); + PX_ASSERT(mNPhaseCore); // refactor paranoia + + PX_ASSERT( ((desc.filterShaderData) && (desc.filterShaderDataSize > 0)) || + (!(desc.filterShaderData) && (desc.filterShaderDataSize == 0)) ); + if (desc.filterShaderData) + { + mFilterShaderData = PX_ALLOC(desc.filterShaderDataSize, sFilterShaderDataMemAllocId); + PxMemCopy(mFilterShaderData, desc.filterShaderData, desc.filterShaderDataSize); + mFilterShaderDataSize = desc.filterShaderDataSize; + mFilterShaderDataCapacity = desc.filterShaderDataSize; + } + else + { + mFilterShaderData = NULL; + mFilterShaderDataSize = 0; + mFilterShaderDataCapacity = 0; + } + mFilterShader = desc.filterShader; + mFilterCallback = desc.filterCallback; +} + +void Sc::Scene::release() +{ + // TODO: PT: check virtual stuff + + mTimeStamp++; + + //collisionSpace.purgeAllPairs(); + + //purgePairs(); + //releaseTagData(); + + // We know release all the shapes before the collision space + //collisionSpace.deleteAllShapes(); + + //collisionSpace.release(); + + //DeterminismDebugger::end(); + + PX_FREE(mActiveKinematicsCopy); + + ///clear broken constraint list: + clearBrokenConstraintBuffer(); + + PX_DELETE(mNPhaseCore); + + PX_FREE(mFilterShaderData); + + if (mStaticAnchor) + { + StaticCore& core = mStaticAnchor->getStaticCore(); + mStaticSimPool->destroy(mStaticAnchor); + delete &core; + } + + // Free object IDs and the deleted object id map + postReportsCleanup(); + + //before the task manager + if (mLLContext) + { + if(mLLContext->getNphaseFallbackImplementationContext()) + { + mLLContext->getNphaseFallbackImplementationContext()->destroy(); + mLLContext->setNphaseFallbackImplementationContext(NULL); + } + + if(mLLContext->getNphaseImplementationContext()) + { + mLLContext->getNphaseImplementationContext()->destroy(); + mLLContext->setNphaseImplementationContext(NULL); + } + } + + PX_DELETE(mProjectionManager); + PX_DELETE(mSqBoundsManager); + PX_DELETE(mBoundsArray); + + PX_DELETE(mConstraintInteractionPool); + PX_DELETE(mConstraintSimPool); + PX_DELETE(mSimStateDataPool); + PX_DELETE(mStaticSimPool); + PX_DELETE(mShapeSimPool); + PX_DELETE(mBodySimPool); + PX_DELETE(mLLArticulationRCPool); +#if PX_SUPPORT_GPU_PHYSX + PX_DELETE(mLLSoftBodyPool); + PX_DELETE(mLLFEMClothPool); + PX_DELETE(mLLParticleSystemPool); + PX_DELETE(mLLHairSystemPool); +#endif + mTriggerBufferExtraData->~TriggerBufferExtraData(); + PX_FREE(mTriggerBufferExtraData); + + PX_DELETE(mElementIDPool); + PX_DELETE(mActorIDTracker); + PX_DELETE(mConstraintIDTracker); + PX_DELETE(mStats); + + Bp::BroadPhase* broadPhase = mAABBManager->getBroadPhase(); + mAABBManager->destroy(); + PX_RELEASE(broadPhase); + + PX_DELETE(mSimulationControllerCallback); + PX_DELETE(mSimulationController); + + mDynamicsContext->destroy(); + + PX_DELETE(mCCDContext); + + PX_DELETE(mSimpleIslandManager); + +#if PX_SUPPORT_GPU_PHYSX + PX_DELETE(mGpuWranglerManagers); + PX_DELETE(mHeapMemoryAllocationManager); +#endif + + PX_RELEASE(mTaskManager); + PX_DELETE(mLLContext); + + mContactDistance->~PxArray(); + PX_FREE(mContactDistance); + + PX_DELETE(mMemoryManager); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::preAllocate(PxU32 nbStatics, PxU32 nbBodies, PxU32 nbStaticShapes, PxU32 nbDynamicShapes) +{ + // PT: TODO: this is only used for my addActors benchmark for now. Pre-allocate more arrays here. + + mActiveBodies.reserve(PxMax(64,nbBodies)); + + mStaticSimPool->preAllocate(nbStatics); + + mBodySimPool->preAllocate(nbBodies); + + mShapeSimPool->preAllocate(nbStaticShapes + nbDynamicShapes); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::addDirtyArticulationSim(Sc::ArticulationSim* artiSim) +{ + artiSim->setDirtyFlag(ArticulationSimDirtyFlag::eUPDATE); + mDirtyArticulationSims.insert(artiSim); +} + +void Sc::Scene::removeDirtyArticulationSim(Sc::ArticulationSim* artiSim) +{ + artiSim->setDirtyFlag(ArticulationSimDirtyFlag::eNONE); + mDirtyArticulationSims.erase(artiSim); +} + +void Sc::Scene::addToActiveList(ActorSim& actorSim) +{ + PX_ASSERT(actorSim.getActiveListIndex() >= SC_NOT_IN_ACTIVE_LIST_INDEX); + + ActorCore* appendedActorCore = &actorSim.getActorCore(); + + if (actorSim.isDynamicRigid()) + { + // Sort: kinematic before dynamic + const PxU32 size = mActiveBodies.size(); + PxU32 incomingBodyActiveListIndex = size; // PT: by default we append the incoming body at the end of the current array. + + BodySim& bodySim = static_cast(actorSim); + if (bodySim.isKinematic()) // PT: Except if incoming body is kinematic, in which case: + { + const PxU32 nbKinematics = mActiveKinematicBodyCount++; // PT: - we increase their number + if (nbKinematics != size) // PT: - if there's at least one dynamic in the array... + { + PX_ASSERT(appendedActorCore != mActiveBodies[nbKinematics]); + appendedActorCore = mActiveBodies[nbKinematics]; // PT: ...then we grab the first dynamic after the kinematics... + appendedActorCore->getSim()->setActiveListIndex(size); // PT: ...and we move that one back to the end of the array... + + mActiveBodies[nbKinematics] = static_cast(&actorSim.getActorCore()); // PT: ...while the incoming kine replaces the dynamic we moved out. + incomingBodyActiveListIndex = nbKinematics; // PT: ...thus the incoming kine's index is the prev #kines. + } + } + + // for active compound rigids add to separate array, so we dont have to traverse all active actors + if (bodySim.readInternalFlag(BodySim::BF_IS_COMPOUND_RIGID)) + { + PX_ASSERT(actorSim.getActiveCompoundListIndex() >= SC_NOT_IN_ACTIVE_LIST_INDEX); + const PxU32 compoundIndex = mActiveCompoundBodies.size(); + mActiveCompoundBodies.pushBack(static_cast(appendedActorCore)); + actorSim.setActiveCompoundListIndex(compoundIndex); + } + + actorSim.setActiveListIndex(incomingBodyActiveListIndex); // PT: will be 'size' or 'nbKinematics', 'dynamicIndex' + mActiveBodies.pushBack(static_cast(appendedActorCore)); // PT: will be the incoming object or the first dynamic we moved out. + } +#if PX_SUPPORT_GPU_PHYSX + else if (actorSim.isSoftBody()) + { + PxU32 activeListIndex = mActiveSoftBodies.size(); + actorSim.setActiveListIndex(activeListIndex); + mActiveSoftBodies.pushBack(static_cast(appendedActorCore)); + } + else if (actorSim.isFEMCloth()) + { + PxU32 activeListIndex = mActiveFEMCloths.size(); + actorSim.setActiveListIndex(activeListIndex); + mActiveFEMCloths.pushBack(static_cast(appendedActorCore)); + } + else if (actorSim.isParticleSystem()) + { + PxU32 activeListIndex = mActiveParticleSystems.size(); + actorSim.setActiveListIndex(activeListIndex); + mActiveParticleSystems.pushBack(static_cast(appendedActorCore)); + } + else if (actorSim.isHairSystem()) + { + PxU32 activeListIndex = mActiveHairSystems.size(); + actorSim.setActiveListIndex(activeListIndex); + mActiveHairSystems.pushBack(static_cast(appendedActorCore)); + } +#endif +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +static void removeFromActiveCompoundBodyList(Sc::ActorSim& actorSim, PxArray& activeCompoundBodies) +{ + const PxU32 removedCompoundIndex = actorSim.getActiveCompoundListIndex(); + PX_ASSERT(removedCompoundIndex < SC_NOT_IN_ACTIVE_LIST_INDEX); + actorSim.setActiveCompoundListIndex(SC_NOT_IN_ACTIVE_LIST_INDEX); + + const PxU32 newCompoundSize = activeCompoundBodies.size() - 1; + + if(removedCompoundIndex != newCompoundSize) + { + Sc::BodyCore* lastBody = activeCompoundBodies[newCompoundSize]; + activeCompoundBodies[removedCompoundIndex] = lastBody; + lastBody->getSim()->setActiveCompoundListIndex(removedCompoundIndex); + } + activeCompoundBodies.forceSize_Unsafe(newCompoundSize); +} + +void Sc::Scene::removeFromActiveCompoundBodyList(BodySim& body) +{ + ::removeFromActiveCompoundBodyList(body, mActiveCompoundBodies); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::removeFromActiveList(ActorSim& actorSim) +{ + PxU32 removedActiveIndex = actorSim.getActiveListIndex(); + PX_ASSERT(removedActiveIndex < SC_NOT_IN_ACTIVE_LIST_INDEX); + actorSim.setActiveListIndex(SC_NOT_IN_ACTIVE_LIST_INDEX); + + if (actorSim.isDynamicRigid()) + { + PX_ASSERT(mActiveBodies[removedActiveIndex] == &actorSim.getActorCore()); + + const PxU32 newSize = mActiveBodies.size() - 1; + + BodySim& bodySim = static_cast(actorSim); + + // Sort: kinematic before dynamic, + if (removedActiveIndex < mActiveKinematicBodyCount) // PT: same as 'body.isKinematic()' but without accessing the Core data + { + PX_ASSERT(mActiveKinematicBodyCount); + PX_ASSERT(bodySim.isKinematic()); + const PxU32 swapIndex = --mActiveKinematicBodyCount; + if (newSize != swapIndex // PT: equal if the array only contains kinematics + && removedActiveIndex < swapIndex) // PT: i.e. "if we don't remove the last kinematic" + { + BodyCore* swapBody = mActiveBodies[swapIndex]; + swapBody->getSim()->setActiveListIndex(removedActiveIndex); + mActiveBodies[removedActiveIndex] = swapBody; + removedActiveIndex = swapIndex; + } + } + + // for active compound rigids add to separate array, so we dont have to traverse all active actors + // A.B. TODO we should handle kinematic switch, no need to hold kinematic rigids in compound list + if(bodySim.readInternalFlag(BodySim::BF_IS_COMPOUND_RIGID)) + ::removeFromActiveCompoundBodyList(actorSim, mActiveCompoundBodies); + + if (removedActiveIndex != newSize) + { + Sc::BodyCore* lastBody = mActiveBodies[newSize]; + mActiveBodies[removedActiveIndex] = lastBody; + lastBody->getSim()->setActiveListIndex(removedActiveIndex); + } + mActiveBodies.forceSize_Unsafe(newSize); + } +#if PX_SUPPORT_GPU_PHYSX + else if(actorSim.isSoftBody()) + { + const PxU32 newSoftBodySize = mActiveSoftBodies.size() - 1; + + if (removedActiveIndex != newSoftBodySize) + { + Sc::SoftBodyCore* lastBody = mActiveSoftBodies[newSoftBodySize]; + mActiveSoftBodies[removedActiveIndex] = lastBody; + lastBody->getSim()->setActiveListIndex(removedActiveIndex); + } + mActiveSoftBodies.forceSize_Unsafe(newSoftBodySize); + } + else if (actorSim.isFEMCloth()) + { + const PxU32 newFEMClothSize = mActiveFEMCloths.size() - 1; + + if (removedActiveIndex != newFEMClothSize) + { + Sc::FEMClothCore* lastBody = mActiveFEMCloths[newFEMClothSize]; + mActiveFEMCloths[removedActiveIndex] = lastBody; + lastBody->getSim()->setActiveListIndex(removedActiveIndex); + } + mActiveFEMCloths.forceSize_Unsafe(newFEMClothSize); + } + else if (actorSim.isParticleSystem()) + { + + const PxU32 newParticleSystemSize = mActiveParticleSystems.size() - 1; + + if (removedActiveIndex != newParticleSystemSize) + { + Sc::ParticleSystemCore* lastBody = mActiveParticleSystems[newParticleSystemSize]; + mActiveParticleSystems[removedActiveIndex] = lastBody; + lastBody->getSim()->setActiveListIndex(removedActiveIndex); + } + mActiveParticleSystems.forceSize_Unsafe(newParticleSystemSize); + + } + else if (actorSim.isHairSystem()) + { + const PxU32 newHairSystemSize = mActiveHairSystems.size() - 1; + + if (removedActiveIndex != newHairSystemSize) + { + Sc::HairSystemCore* lastHairSystem = mActiveHairSystems[newHairSystemSize]; + mActiveHairSystems[removedActiveIndex] = lastHairSystem; + lastHairSystem->getSim()->setActiveListIndex(removedActiveIndex); + } + mActiveHairSystems.forceSize_Unsafe(newHairSystemSize); + } +#endif +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::swapInActiveBodyList(BodySim& body) +{ + PX_ASSERT(!body.isStaticRigid() && !body.isSoftBody() && !body.isFEMCloth() && !body.isParticleSystem() && !body.isHairSystem()); + const PxU32 activeListIndex = body.getActiveListIndex(); + PX_ASSERT(activeListIndex < SC_NOT_IN_ACTIVE_LIST_INDEX); + + PxU32 swapIndex; + PxU32 newActiveKinematicBodyCount; + if(activeListIndex < mActiveKinematicBodyCount) + { + // kinematic -> dynamic + PX_ASSERT(!body.isKinematic()); // the corresponding flag gets switched before this call + PX_ASSERT(mActiveKinematicBodyCount > 0); // there has to be at least one kinematic body + + swapIndex = mActiveKinematicBodyCount - 1; + newActiveKinematicBodyCount = swapIndex; + } + else + { + // dynamic -> kinematic + PX_ASSERT(body.isKinematic()); // the corresponding flag gets switched before this call + PX_ASSERT(mActiveKinematicBodyCount < mActiveBodies.size()); // there has to be at least one dynamic body + + swapIndex = mActiveKinematicBodyCount; + newActiveKinematicBodyCount = swapIndex + 1; + } + + BodyCore*& swapBodyRef = mActiveBodies[swapIndex]; + body.setActiveListIndex(swapIndex); + BodyCore* swapBody = swapBodyRef; + swapBodyRef = &body.getBodyCore(); + + swapBody->getSim()->setActiveListIndex(activeListIndex); + mActiveBodies[activeListIndex] = swapBody; + + mActiveKinematicBodyCount = newActiveKinematicBodyCount; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::registerInteraction(Interaction* interaction, bool active) +{ + const InteractionType::Enum type = interaction->getType(); + const PxU32 sceneArrayIndex = mInteractions[type].size(); + interaction->setInteractionId(sceneArrayIndex); + + mInteractions[type].pushBack(interaction); + if (active) + { + if (sceneArrayIndex > mActiveInteractionCount[type]) + swapInteractionArrayIndices(sceneArrayIndex, mActiveInteractionCount[type], type); + mActiveInteractionCount[type]++; + } +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::unregisterInteraction(Interaction* interaction) +{ + const InteractionType::Enum type = interaction->getType(); + const PxU32 sceneArrayIndex = interaction->getInteractionId(); + PX_ASSERT(sceneArrayIndex != PX_INVALID_INTERACTION_SCENE_ID); +// if(sceneArrayIndex==PX_INVALID_INTERACTION_SCENE_ID) +// return; + mInteractions[type].replaceWithLast(sceneArrayIndex); + interaction->setInteractionId(PX_INVALID_INTERACTION_SCENE_ID); + if (sceneArrayIndexsetInteractionId(sceneArrayIndex); + if (sceneArrayIndex& interArray = mInteractions[type]; + Interaction* interaction1 = interArray[id1]; + Interaction* interaction2 = interArray[id2]; + interArray[id1] = interaction2; + interArray[id2] = interaction1; + interaction1->setInteractionId(id2); + interaction2->setInteractionId(id1); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +PxReal Sc::Scene::getLengthScale() const +{ + return mDynamicsContext->getLengthScale(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::notifyInteractionActivated(Interaction* interaction) +{ + PX_ASSERT((interaction->getType() == InteractionType::eOVERLAP) || (interaction->getType() == InteractionType::eTRIGGER)); + PX_ASSERT(interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE)); + PX_ASSERT(interaction->getInteractionId() != PX_INVALID_INTERACTION_SCENE_ID); + + const InteractionType::Enum type = interaction->getType(); + + PX_ASSERT(interaction->getInteractionId() >= mActiveInteractionCount[type]); + + if (mActiveInteractionCount[type] < mInteractions[type].size()) + swapInteractionArrayIndices(mActiveInteractionCount[type], interaction->getInteractionId(), type); + mActiveInteractionCount[type]++; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::notifyInteractionDeactivated(Interaction* interaction) +{ + PX_ASSERT((interaction->getType() == InteractionType::eOVERLAP) || (interaction->getType() == InteractionType::eTRIGGER)); + PX_ASSERT(!interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE)); + PX_ASSERT(interaction->getInteractionId() != PX_INVALID_INTERACTION_SCENE_ID); + + const InteractionType::Enum type = interaction->getType(); + PX_ASSERT(interaction->getInteractionId() < mActiveInteractionCount[type]); + + if (mActiveInteractionCount[type] > 1) + swapInteractionArrayIndices(mActiveInteractionCount[type]-1, interaction->getInteractionId(), type); + mActiveInteractionCount[type]--; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void** Sc::Scene::allocatePointerBlock(PxU32 size) +{ + PX_ASSERT(size>32 || size == 32 || size == 16 || size == 8); + void* ptr; + if(size==8) + ptr = mPointerBlock8Pool.construct(); + else if(size == 16) + ptr = mPointerBlock16Pool.construct(); + else if(size == 32) + ptr = mPointerBlock32Pool.construct(); + else + ptr = PX_ALLOC(size * sizeof(void*), "void*"); + + return reinterpret_cast(ptr); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::deallocatePointerBlock(void** block, PxU32 size) +{ + PX_ASSERT(size>32 || size == 32 || size == 16 || size == 8); + if(size==8) + mPointerBlock8Pool.destroy(reinterpret_cast(block)); + else if(size == 16) + mPointerBlock16Pool.destroy(reinterpret_cast(block)); + else if(size == 32) + mPointerBlock32Pool.destroy(reinterpret_cast(block)); + else + PX_FREE(block); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::setFilterShaderData(const void* data, PxU32 dataSize) +{ + PX_UNUSED(sFilterShaderDataMemAllocId); + + if (data) + { + PX_ASSERT(dataSize > 0); + + void* buffer; + + if (dataSize <= mFilterShaderDataCapacity) + buffer = mFilterShaderData; + else + { + buffer = PX_ALLOC(dataSize, sFilterShaderDataMemAllocId); + if (buffer) + { + mFilterShaderDataCapacity = dataSize; + PX_FREE(mFilterShaderData); + } + else + { + outputError(__LINE__, "Failed to allocate memory for filter shader data!"); + return; + } + } + + PxMemCopy(buffer, data, dataSize); + mFilterShaderData = buffer; + mFilterShaderDataSize = dataSize; + } + else + { + PX_ASSERT(dataSize == 0); + + PX_FREE(mFilterShaderData); + mFilterShaderDataSize = 0; + mFilterShaderDataCapacity = 0; + } +} + +void Sc::Scene::setPublicFlags(PxSceneFlags flags) +{ + mPublicFlags = flags; + mDynamicsContext->setSuppressReadback(flags & PxSceneFlag::eSUPPRESS_READBACK); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::Scene::prepareCollide() +{ + mReportShapePairTimeStamp++; // deleted actors/shapes should get separate pair entries in contact reports + mContactReportsNeedPostSolverVelocity = false; + + getRenderBuffer().clear(); + + // Clear broken constraint list: + clearBrokenConstraintBuffer(); + + // Update from visualization parameters + if(mVisualizationParameterChanged) + { + mVisualizationParameterChanged = false; + + // Update SIPs if visualization is enabled + if( getVisualizationParameter(PxVisualizationParameter::eCONTACT_POINT) || getVisualizationParameter(PxVisualizationParameter::eCONTACT_NORMAL) || + getVisualizationParameter(PxVisualizationParameter::eCONTACT_ERROR) || getVisualizationParameter(PxVisualizationParameter::eCONTACT_FORCE)) + mInternalFlags |= SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_VISUALIZATION; + } + + visualizeStartStep(); + + PxcClearContactCacheStats(); +} + +void Sc::Scene::simulate(PxReal timeStep, PxBaseTask* continuation) +{ + if(timeStep != 0.0f) + { + mDt = timeStep; + mOneOverDt = 0.0f < mDt ? 1.0f/mDt : 0.0f; + mDynamicsContext->setDt(mDt); + + mAdvanceStep.setContinuation(continuation); + + prepareCollide(); + stepSetupCollide(&mAdvanceStep); + + mCollideStep.setContinuation(&mAdvanceStep); + + mAdvanceStep.removeReference(); + mCollideStep.removeReference(); + } +} + +void Sc::Scene::advance(PxReal timeStep, PxBaseTask* continuation) +{ + if(timeStep != 0.0f) + { + mDt = timeStep; + mOneOverDt = 0.0f < mDt ? 1.0f/mDt : 0.0f; + + mAdvanceStep.setContinuation(continuation); + + stepSetupSolve(&mAdvanceStep); + + mAdvanceStep.removeReference(); + } +} + +void Sc::Scene::setBounceThresholdVelocity(const PxReal t) +{ + mDynamicsContext->setBounceThreshold(-t); +} + +PxReal Sc::Scene::getBounceThresholdVelocity() const +{ + return -mDynamicsContext->getBounceThreshold(); +} + +void Sc::Scene::collide(PxReal timeStep, PxBaseTask* continuation) +{ + mDt = timeStep; + + prepareCollide(); + stepSetupCollide(continuation); + + mLLContext->beginUpdate(); + + mCollideStep.setContinuation(continuation); + mCollideStep.removeReference(); +} + +PxSolverType::Enum Sc::Scene::getSolverType() const +{ + return mDynamicsContext->getSolverType(); +} + +void Sc::Scene::setFrictionType(PxFrictionType::Enum model) +{ + mDynamicsContext->setFrictionType(model); +} + +PxFrictionType::Enum Sc::Scene::getFrictionType() const +{ + return mDynamicsContext->getFrictionType(); +} + +void Sc::Scene::endSimulation() +{ + // Handle user contact filtering + // Note: Do this before the contact callbacks get fired since the filter callback might + // trigger contact reports (touch lost due to re-filtering) + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + mNPhaseCore->fireCustomFilteringCallbacks(outputs); + + mNPhaseCore->preparePersistentContactEventListForNextFrame(); + + mSimulationController->releaseDeferredArticulationIds(); + +#if PX_SUPPORT_GPU_PHYSX + mSimulationController->releaseDeferredSoftBodyIds(); + + mSimulationController->releaseDeferredFEMClothIds(); + + mSimulationController->releaseDeferredParticleSystemIds(); + + mSimulationController->releaseDeferredHairSystemIds(); + + mAABBManager->releaseDeferredAggregateIds(); +#endif + + endStep(); // - Update time stamps + + PxcDisplayContactCacheStats(); +} + +void Sc::Scene::flush(bool sendPendingReports) +{ + if (sendPendingReports) + { + fireQueuedContactCallbacks(); + mNPhaseCore->clearContactReportStream(); + mNPhaseCore->clearContactReportActorPairs(true); + + fireTriggerCallbacks(); + } + else + { + mNPhaseCore->clearContactReportActorPairs(true); // To clear the actor pair set + } + postReportsCleanup(); + mNPhaseCore->freeContactReportStreamMemory(); + + mTriggerBufferAPI.reset(); + mTriggerBufferExtraData->reset(); + + clearBrokenConstraintBuffer(); + mBrokenConstraints.reset(); + + clearSleepWakeBodies(); //!!! If we send out these reports on flush then this would not be necessary + + mActorIDTracker->reset(); + mElementIDPool->reset(); + + processLostTouchPairs(); // Processes the lost touch bodies + PX_ASSERT(mLostTouchPairs.size() == 0); + mLostTouchPairs.reset(); + // Does not seem worth deleting the bitmap for the lost touch pair list + + mActiveBodies.shrink(); + + for(PxU32 i=0; i < InteractionType::eTRACKED_IN_SCENE_COUNT; i++) + { + mInteractions[i].shrink(); + } + + //!!! TODO: look into retrieving memory from the NPhaseCore & Broadphase class (all the pools in there etc.) + + mLLContext->getNpMemBlockPool().releaseUnusedBlocks(); +} + +// User callbacks + +void Sc::Scene::setSimulationEventCallback(PxSimulationEventCallback* callback) +{ + if(!mSimulationEventCallback && callback) + { + // if there was no callback before, the sleeping bodies have to be prepared for potential notification events (no shortcut possible anymore) + BodyCore* const* sleepingBodies = mSleepBodies.getEntries(); + for (PxU32 i = 0; i < mSleepBodies.size(); i++) + { + sleepingBodies[i]->getSim()->raiseInternalFlag(BodySim::BF_SLEEP_NOTIFY); + } + +#if PX_SUPPORT_GPU_PHYSX + SoftBodyCore* const* sleepingSoftBodies = mSleepSoftBodies.getEntries(); + for (PxU32 i = 0; i < mSleepSoftBodies.size(); i++) + { + sleepingSoftBodies[i]->getSim()->raiseInternalFlag(BodySim::BF_SLEEP_NOTIFY); + } + + //FEMClothCore* const* sleepingFEMCloths = mSleepFEMCloths.getEntries(); + //for (PxU32 i = 0; i < mSleepFEMCloths.size(); i++) + //{ + // sleepingFEMCloths[i]->getSim()->raiseInternalFlag(BodySim::BF_SLEEP_NOTIFY); + //} + + HairSystemCore* const* sleepingHairSystems = mSleepHairSystems.getEntries(); + for (PxU32 i = 0; i < mSleepHairSystems.size(); i++) + { + sleepingHairSystems[i]->getSim()->raiseInternalFlag(BodySim::BF_SLEEP_NOTIFY); + } +#endif + } + + mSimulationEventCallback = callback; +} + +PxSimulationEventCallback* Sc::Scene::getSimulationEventCallback() const +{ + return mSimulationEventCallback; +} + +//CCD +void Sc::Scene::setCCDContactModifyCallback(PxCCDContactModifyCallback* callback) +{ + mCCDContext->setCCDContactModifyCallback(callback); +} + +//CCD +PxCCDContactModifyCallback* Sc::Scene::getCCDContactModifyCallback() const +{ + return mCCDContext->getCCDContactModifyCallback(); +} + +//CCD +void Sc::Scene::setCCDMaxPasses(PxU32 ccdMaxPasses) +{ + mCCDContext->setCCDMaxPasses(ccdMaxPasses); +} + +//CCD +PxU32 Sc::Scene::getCCDMaxPasses() const +{ + return mCCDContext->getCCDMaxPasses(); +} + +//CCD +void Sc::Scene::setCCDThreshold(PxReal t) +{ + mCCDContext->setCCDThreshold(t); +} + +//CCD +PxReal Sc::Scene::getCCDThreshold() const +{ + return mCCDContext->getCCDThreshold(); +} + +void Sc::Scene::removeBody(BodySim& body) //this also notifies any connected joints! +{ + ConstraintGroupNode* node = body.getConstraintGroup(); + if (node) + { + //invalidate the constraint group: + //this adds all constraints of the group to the dirty list such that groups get re-generated next frame + getProjectionManager().invalidateGroup(*node, NULL); + } + + BodyCore& core = body.getBodyCore(); + + // Remove from sleepBodies array + mSleepBodies.erase(&core); + PX_ASSERT(!mSleepBodies.contains(&core)); + + // Remove from wokeBodies array + mWokeBodies.erase(&core); + PX_ASSERT(!mWokeBodies.contains(&core)); + + if (body.isActive() && (core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW)) + removeFromPosePreviewList(body); + else + PX_ASSERT(!isInPosePreviewList(body)); + + markReleasedBodyIDForLostTouch(body.getActorID()); +} + +void Sc::Scene::addConstraint(ConstraintCore& constraint, RigidCore* body0, RigidCore* body1) +{ + ConstraintSim* sim = mConstraintSimPool->construct(constraint, body0, body1, *this); + PX_UNUSED(sim); + + PxNodeIndex nodeIndex0, nodeIndex1; + + ActorSim* sim0 = NULL; + ActorSim* sim1 = NULL; + + if (body0) + { + sim0 = body0->getSim(); + nodeIndex0 = sim0->getNodeIndex(); + } + if (body1) + { + sim1 = body1->getSim(); + nodeIndex1 = sim1->getNodeIndex(); + } + + if (nodeIndex1 < nodeIndex0) + PxSwap(sim0, sim1); + + mConstraintMap.insert(PxPair(sim0, sim1), &constraint); + + mConstraints.insert(&constraint); +} + +void Sc::Scene::removeConstraint(ConstraintCore& constraint) +{ + ConstraintSim* cSim = constraint.getSim(); + + if (cSim) + { + { + PxNodeIndex nodeIndex0, nodeIndex1; + + const ConstraintInteraction* interaction = cSim->getInteraction(); + + Sc::ActorSim* bSim = &interaction->getActorSim0(); + Sc::ActorSim* bSim1 = &interaction->getActorSim1(); + + if (bSim) + nodeIndex0 = bSim->getNodeIndex(); + if (bSim1) + nodeIndex1 = bSim1->getNodeIndex(); + + if (nodeIndex1 < nodeIndex0) + PxSwap(bSim, bSim1); + + mConstraintMap.erase(PxPair(bSim, bSim1)); + } + + BodySim* b = cSim->getAnyBody(); + ConstraintGroupNode* n = b->getConstraintGroup(); + + if (n) + getProjectionManager().invalidateGroup(*n, cSim); + mConstraintSimPool->destroy(cSim); + } + + mConstraints.erase(&constraint); +} + +#if PX_SUPPORT_GPU_PHYSX +void Sc::Scene::addSoftBody(SoftBodyCore& softBody) +{ + SoftBodySim* sim = PX_NEW(SoftBodySim)(softBody, *this); + + if (sim && (sim->getLowLevelSoftBody() == NULL)) + { + PX_DELETE(sim); + return; + } + + mSoftBodies.insert(&softBody); + mStats->gpuMemSizeSoftBodies += softBody.getGpuMemStat(); +} + +void Sc::Scene::removeSoftBody(SoftBodyCore& softBody) +{ + SoftBodySim* a = softBody.getSim(); + PX_DELETE(a); + mSoftBodies.erase(&softBody); + mStats->gpuMemSizeSoftBodies -= softBody.getGpuMemStat(); +} + +void Sc::Scene::addFEMCloth(FEMClothCore& femCloth) +{ + FEMClothSim* sim = PX_NEW(FEMClothSim)(femCloth, *this); + + if (sim && (sim->getLowLevelFEMCloth() == NULL)) + { + PX_DELETE(sim); + return; + } + + mFEMCloths.insert(&femCloth); + mStats->gpuMemSizeFEMCloths += femCloth.getGpuMemStat(); +} + +void Sc::Scene::removeFEMCloth(FEMClothCore& femCloth) +{ + FEMClothSim* a = femCloth.getSim(); + PX_DELETE(a); + mFEMCloths.erase(&femCloth); + mStats->gpuMemSizeFEMCloths -= femCloth.getGpuMemStat(); +} + +void Sc::Scene::addParticleSystem(ParticleSystemCore& particleSystem) +{ + ParticleSystemSim* sim = PX_NEW(ParticleSystemSim)(particleSystem, *this); + + Dy::ParticleSystem* dyParticleSystem = sim->getLowLevelParticleSystem(); + + if (sim && (dyParticleSystem == NULL)) + { + PX_DELETE(sim); + return; + } + + mParticleSystems.insert(&particleSystem); + mStats->gpuMemSizeParticles += particleSystem.getShapeCore().getGpuMemStat(); +} + +void Sc::Scene::removeParticleSystem(ParticleSystemCore& particleSystem) +{ + ParticleSystemSim* a = particleSystem.getSim(); + PX_DELETE(a); + mParticleSystems.erase(&particleSystem); + mStats->gpuMemSizeParticles -= particleSystem.getShapeCore().getGpuMemStat(); +} + +void Sc::Scene::addHairSystem(HairSystemCore& hairSystem) +{ + HairSystemSim* sim = PX_NEW(HairSystemSim)(hairSystem, *this); + + if (sim && (sim->getLowLevelHairSystem() == NULL)) + { + PX_DELETE(sim); + return; + } + + mHairSystems.insert(&hairSystem); + mStats->gpuMemSizeHairSystems += hairSystem.getShapeCore().getGpuMemStat(); +} + +void Sc::Scene::removeHairSystem(HairSystemCore& hairSystem) +{ + HairSystemSim* sim = hairSystem.getSim(); + PX_DELETE(sim); + mHairSystems.erase(&hairSystem); + mStats->gpuMemSizeHairSystems -= hairSystem.getShapeCore().getGpuMemStat(); +} +#endif + +void Sc::Scene::addArticulation(ArticulationCore& articulation, BodyCore& root) +{ + ArticulationSim* sim = PX_NEW(ArticulationSim)(articulation, *this, root); + + if (sim && (sim->getLowLevelArticulation() == NULL)) + { + PX_DELETE(sim); + return; + } + mArticulations.insert(&articulation); + + addDirtyArticulationSim(sim); +} + +void Sc::Scene::removeArticulation(ArticulationCore& articulation) +{ + ArticulationSim* a = articulation.getSim(); + + Sc::ArticulationSimDirtyFlags dirtyFlags = a->getDirtyFlag(); + const bool isDirty = (dirtyFlags & Sc::ArticulationSimDirtyFlag::eUPDATE); + if(isDirty) + removeDirtyArticulationSim(a); + + PX_DELETE(a); + mArticulations.erase(&articulation); +} + +void Sc::Scene::addArticulationJoint(ArticulationJointCore& joint, BodyCore& parent, BodyCore& child) +{ + ArticulationJointSim* sim = PX_NEW(ArticulationJointSim)(joint, *parent.getSim(), *child.getSim()); + PX_UNUSED(sim); +} + +void Sc::Scene::removeArticulationJoint(ArticulationJointCore& joint) +{ + ArticulationJointSim* sim = joint.getSim(); + PX_DELETE(sim); +} + +void Sc::Scene::addArticulationTendon(ArticulationSpatialTendonCore& tendon) +{ + ArticulationSpatialTendonSim* sim = PX_NEW(ArticulationSpatialTendonSim)(tendon, *this); + + PX_UNUSED(sim); +} + +void Sc::Scene::removeArticulationTendon(ArticulationSpatialTendonCore& tendon) +{ + ArticulationSpatialTendonSim* sim = tendon.getSim(); + PX_DELETE(sim); +} + +void Sc::Scene::addArticulationTendon(ArticulationFixedTendonCore& tendon) +{ + ArticulationFixedTendonSim* sim = PX_NEW(ArticulationFixedTendonSim)(tendon, *this); + + PX_UNUSED(sim); +} + +void Sc::Scene::removeArticulationTendon(ArticulationFixedTendonCore& tendon) +{ + ArticulationFixedTendonSim* sim = tendon.getSim(); + PX_DELETE(sim); +} + +void Sc::Scene::addArticulationSensor(ArticulationSensorCore& sensor) +{ + ArticulationSensorSim* sim = PX_NEW(ArticulationSensorSim)(sensor, *this); + PX_UNUSED(sim); +} + +void Sc::Scene::removeArticulationSensor(ArticulationSensorCore& sensor) +{ + ArticulationSensorSim* sim = sensor.getSim(); + PX_DELETE(sim); +} + +void Sc::Scene::addArticulationSimControl(Sc::ArticulationCore& core) +{ + Sc::ArticulationSim* sim = core.getSim(); + if (sim) + mSimulationController->addArticulation(sim->getLowLevelArticulation(), sim->getIslandNodeIndex()); +} + +void Sc::Scene::removeArticulationSimControl(Sc::ArticulationCore& core) +{ + Sc::ArticulationSim* sim = core.getSim(); + if (sim) + mSimulationController->releaseArticulation(sim->getLowLevelArticulation(), sim->getIslandNodeIndex()); +} + +#if PX_SUPPORT_GPU_PHYSX +void Sc::Scene::addSoftBodySimControl(Sc::SoftBodyCore& core) +{ + Sc::SoftBodySim* sim = core.getSim(); + + if (sim) + { + mSimulationController->addSoftBody(sim->getLowLevelSoftBody(), sim->getNodeIndex()); + + mLLContext->getNphaseImplementationContext()->registerShape(sim->getNodeIndex(), sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID(), sim->getPxActor()); + } +} + +void Sc::Scene::removeSoftBodySimControl(Sc::SoftBodyCore& core) +{ + Sc::SoftBodySim* sim = core.getSim(); + + if (sim) + { + mLLContext->getNphaseImplementationContext()->unregisterShape(sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID()); + mSimulationController->releaseSoftBody(sim->getLowLevelSoftBody()); + } +} + +void Sc::Scene::addFEMClothSimControl(Sc::FEMClothCore& core) +{ + Sc::FEMClothSim* sim = core.getSim(); + + if (sim) + { + mSimulationController->addFEMCloth(sim->getLowLevelFEMCloth(), sim->getNodeIndex()); + + mLLContext->getNphaseImplementationContext()->registerShape(sim->getNodeIndex(), sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID(), sim->getPxActor(), true); + } +} + +void Sc::Scene::removeFEMClothSimControl(Sc::FEMClothCore& core) +{ + Sc::FEMClothSim* sim = core.getSim(); + + if (sim) + { + mLLContext->getNphaseImplementationContext()->unregisterShape(sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID(), true); + mSimulationController->releaseFEMCloth(sim->getLowLevelFEMCloth()); + } +} + +void Sc::Scene::addParticleFilter(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId) +{ + mSimulationController->addParticleFilter(sim.getLowLevelSoftBody(), core->getSim()->getLowLevelParticleSystem(), + particleId, userBufferId, tetId); +} + +void Sc::Scene::removeParticleFilter(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId) +{ + mSimulationController->removeParticleFilter(sim.getLowLevelSoftBody(), core->getSim()->getLowLevelParticleSystem(), particleId, userBufferId, tetId); +} + +PxU32 Sc::Scene::addParticleAttachment(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentric) +{ + PxNodeIndex nodeIndex = core->getSim()->getNodeIndex(); + + PxU32 handle = mSimulationController->addParticleAttachment(sim.getLowLevelSoftBody(), core->getSim()->getLowLevelParticleSystem(), + particleId, userBufferId, tetId, barycentric, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eSOFT_BODY_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eSOFT_BODY_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::removeParticleAttachment(Sc::ParticleSystemCore* core, SoftBodySim& sim, PxU32 handle) +{ + PxNodeIndex nodeIndex = core->getSim()->getNodeIndex(); + + mSimulationController->removeParticleAttachment(sim.getLowLevelSoftBody(), handle); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addRigidFilter(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 vertId) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->addRigidFilter(sim.getLowLevelSoftBody(), sim.getNodeIndex(), + nodeIndex, vertId); +} + +void Sc::Scene::removeRigidFilter(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 vertId) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeRigidFilter(sim.getLowLevelSoftBody(), nodeIndex, vertId); +} + +PxU32 Sc::Scene::addRigidAttachment(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 vertId, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint) +{ + PxNodeIndex nodeIndex; + PxsRigidBody* body = NULL; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + body = &core->getSim()->getLowLevelBody(); + } + + PxU32 handle = mSimulationController->addRigidAttachment(sim.getLowLevelSoftBody(), sim.getNodeIndex(), body, + nodeIndex, vertId, actorSpacePose, constraint, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eSOFT_BODY_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eSOFT_BODY_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::removeRigidAttachment(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 handle) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeRigidAttachment(sim.getLowLevelSoftBody(), handle); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addTetRigidFilter(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 tetIdx) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->addTetRigidFilter(sim.getLowLevelSoftBody(), nodeIndex, tetIdx); +} + +void Sc::Scene::removeTetRigidFilter(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 tetIdx) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + mSimulationController->removeTetRigidFilter(sim.getLowLevelSoftBody(), nodeIndex, tetIdx); +} + +PxU32 Sc::Scene::addTetRigidAttachment(Sc::BodyCore* core, Sc::SoftBodySim& sim, PxU32 tetIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, + PxConeLimitedConstraint* constraint) +{ + PxNodeIndex nodeIndex; + PxsRigidBody* body = NULL; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + body = &core->getSim()->getLowLevelBody(); + } + + PxU32 handle = mSimulationController->addTetRigidAttachment(sim.getLowLevelSoftBody(), body, nodeIndex, + tetIdx, barycentric, actorSpacePose, constraint, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eSOFT_BODY_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eSOFT_BODY_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::addSoftBodyFilter(SoftBodyCore& core, PxU32 tetIdx0, SoftBodySim& sim, PxU32 tetIdx1) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + + mSimulationController->addSoftBodyFilter(bSim.getLowLevelSoftBody(), sim.getLowLevelSoftBody(), tetIdx0, tetIdx1); +} + +void Sc::Scene::removeSoftBodyFilter(SoftBodyCore& core, PxU32 tetIdx0, SoftBodySim& sim, PxU32 tetIdx1) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + mSimulationController->removeSoftBodyFilter(bSim.getLowLevelSoftBody(), sim.getLowLevelSoftBody(), tetIdx0, tetIdx1); +} + +void Sc::Scene::addSoftBodyFilters(SoftBodyCore& core, SoftBodySim& sim, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + + mSimulationController->addSoftBodyFilters(bSim.getLowLevelSoftBody(), sim.getLowLevelSoftBody(), tetIndices0, tetIndices1, tetIndicesSize); +} + +void Sc::Scene::removeSoftBodyFilters(SoftBodyCore& core, SoftBodySim& sim, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + mSimulationController->removeSoftBodyFilters(bSim.getLowLevelSoftBody(), sim.getLowLevelSoftBody(), tetIndices0, tetIndices1, tetIndicesSize); +} + +PxU32 Sc::Scene::addSoftBodyAttachment(SoftBodyCore& core, PxU32 tetIdx0, const PxVec4& tetBarycentric0, Sc::SoftBodySim& sim, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + + PxU32 handle = mSimulationController->addSoftBodyAttachment(bSim.getLowLevelSoftBody(), sim.getLowLevelSoftBody(), tetIdx0, tetIdx1, + tetBarycentric0, tetBarycentric1, constraint, sim.isActive() || bSim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), bSim.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), bSim.getNodeIndex(), NULL, IG::Edge::eSOFT_BODY_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eSOFT_BODY_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + + return handle; +} + +void Sc::Scene::removeSoftBodyAttachment(SoftBodyCore& core, Sc::SoftBodySim& sim, PxU32 handle) +{ + Sc::SoftBodySim& bSim = *core.getSim(); + mSimulationController->removeSoftBodyAttachment(bSim.getLowLevelSoftBody(), handle); + + PxPair pair(sim.getNodeIndex().index(), bSim.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, Sc::SoftBodySim& sim, PxU32 tetIdx) +{ + Sc::FEMClothSim& bSim = *core.getSim(); + + mSimulationController->addClothFilter(sim.getLowLevelSoftBody(), bSim.getLowLevelFEMCloth(), triIdx,tetIdx); +} + +void Sc::Scene::removeClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, Sc::SoftBodySim& sim, PxU32 tetIdx) +{ + Sc::FEMClothSim& bSim = *core.getSim(); + mSimulationController->removeClothFilter(sim.getLowLevelSoftBody(), bSim.getLowLevelFEMCloth(), triIdx, tetIdx); +} + +PxU32 Sc::Scene::addClothAttachment(Sc::FEMClothCore& core, PxU32 triIdx, const PxVec4& triBarycentric, Sc::SoftBodySim& sim, PxU32 tetIdx, + const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint) +{ + Sc::FEMClothSim& bSim = *core.getSim(); + + PxU32 handle = mSimulationController->addClothAttachment(sim.getLowLevelSoftBody(), bSim.getLowLevelFEMCloth(), triIdx, triBarycentric, + tetIdx, tetBarycentric, constraint, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), bSim.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), bSim.getNodeIndex(), NULL, IG::Edge::eFEM_CLOTH_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eFEM_CLOTH_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + + return handle; +} + +void Sc::Scene::removeClothAttachment(Sc::FEMClothCore& core, Sc::SoftBodySim& sim, PxU32 handle) +{ + PX_UNUSED(core); + Sc::FEMClothSim& bSim = *core.getSim(); + mSimulationController->removeClothAttachment(sim.getLowLevelSoftBody(), handle); + + PxPair pair(sim.getNodeIndex().index(), bSim.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addRigidFilter(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 vertId) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->addRigidFilter(sim.getLowLevelFEMCloth(), nodeIndex, vertId); +} + +void Sc::Scene::removeRigidFilter(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 vertId) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeRigidFilter(sim.getLowLevelFEMCloth(), nodeIndex, vertId); +} + +PxU32 Sc::Scene::addRigidAttachment(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 vertId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) +{ + PxNodeIndex nodeIndex; + PxsRigidBody* body = NULL; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + body = &core->getSim()->getLowLevelBody(); + } + + PxU32 handle = mSimulationController->addRigidAttachment(sim.getLowLevelFEMCloth(), sim.getNodeIndex(), body, nodeIndex, + vertId, actorSpacePose, constraint, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eFEM_CLOTH_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eFEM_CLOTH_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::removeRigidAttachment(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 handle) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeRigidAttachment(sim.getLowLevelFEMCloth(), handle); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addTriRigidFilter(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 triIdx) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->addTriRigidFilter(sim.getLowLevelFEMCloth(), nodeIndex, triIdx); +} + +void Sc::Scene::removeTriRigidFilter(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 triIdx) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeTriRigidFilter(sim.getLowLevelFEMCloth(), nodeIndex, triIdx); +} + +PxU32 Sc::Scene::addTriRigidAttachment(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 triIdx, const PxVec4& barycentric, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) +{ + PxNodeIndex nodeIndex; + PxsRigidBody* body = NULL; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + body = &core->getSim()->getLowLevelBody(); + } + + PxU32 handle = mSimulationController->addTriRigidAttachment(sim.getLowLevelFEMCloth(), body, nodeIndex, + triIdx, barycentric, actorSpacePose, constraint, sim.isActive()); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eFEM_CLOTH_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eFEM_CLOTH_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::removeTriRigidAttachment(Sc::BodyCore* core, Sc::FEMClothSim& sim, PxU32 handle) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + mSimulationController->removeTriRigidAttachment(sim.getLowLevelFEMCloth(), handle); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addClothFilter(FEMClothCore& core0, PxU32 triIdx0, Sc::FEMClothSim& sim1, PxU32 triIdx1) +{ + Sc::FEMClothSim& sim0 = *core0.getSim(); + + mSimulationController->addClothFilter(sim0.getLowLevelFEMCloth(), sim1.getLowLevelFEMCloth(), triIdx0, triIdx1); +} + +void Sc::Scene::removeClothFilter(FEMClothCore& core, PxU32 triIdx0, FEMClothSim& sim1, PxU32 triIdx1) +{ + Sc::FEMClothSim& sim0 = *core.getSim(); + mSimulationController->removeClothFilter(sim0.getLowLevelFEMCloth(), sim1.getLowLevelFEMCloth(), triIdx0, triIdx1); +} + +PxU32 Sc::Scene::addTriClothAttachment(FEMClothCore& core, PxU32 triIdx0, const PxVec4& barycentric0, Sc::FEMClothSim& sim1, PxU32 triIdx1, const PxVec4& barycentric1) +{ + Sc::FEMClothSim& sim0 = *core.getSim(); + + PxU32 handle = mSimulationController->addTriClothAttachment(sim0.getLowLevelFEMCloth(), sim1.getLowLevelFEMCloth(), triIdx0, triIdx1, + barycentric0, barycentric1, sim1.isActive() || sim0.isActive()); + + //return handle; + + PxPair pair(sim0.getNodeIndex().index(), sim1.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim0.getNodeIndex(), sim1.getNodeIndex(), NULL, IG::Edge::eFEM_CLOTH_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eFEM_CLOTH_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; + return handle; +} + +void Sc::Scene::removeTriClothAttachment(FEMClothCore& core, FEMClothSim& sim1, PxU32 handle) +{ + Sc::FEMClothSim& sim0 = *core.getSim(); + mSimulationController->removeTriClothAttachment(sim0.getLowLevelFEMCloth(), handle); + + PxPair pair(sim0.getNodeIndex().index(), sim1.getNodeIndex().index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addParticleSystemSimControl(Sc::ParticleSystemCore& core) +{ + Sc::ParticleSystemSim* sim = core.getSim(); + + if (sim) + { + mSimulationController->addParticleSystem(sim->getLowLevelParticleSystem(), sim->getNodeIndex(), core.getSolverType()); + + mLLContext->getNphaseImplementationContext()->registerShape(sim->getNodeIndex(), sim->getCore().getShapeCore().getCore(), sim->getLowLevelParticleSystem()->getElementId(), sim->getPxActor()); + } +} + +void Sc::Scene::removeParticleSystemSimControl(Sc::ParticleSystemCore& core) +{ + Sc::ParticleSystemSim* sim = core.getSim(); + + if (sim) + { + mLLContext->getNphaseImplementationContext()->unregisterShape(sim->getCore().getShapeCore().getCore(), sim->getShapeSim().getElementID()); + mSimulationController->releaseParticleSystem(sim->getLowLevelParticleSystem(), core.getSolverType()); + } +} + + +void Sc::Scene::addRigidAttachment(Sc::BodyCore* core, Sc::ParticleSystemSim& sim) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::ePARTICLE_SYSTEM_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::ePARTICLE_SYSTEM_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; +} + +void Sc::Scene::removeRigidAttachment(Sc::BodyCore* core, Sc::ParticleSystemSim& sim) +{ + PxNodeIndex nodeIndex; + if (core) + nodeIndex = core->getSim()->getNodeIndex(); + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + interaction.mCount--; + if (interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } +} + +void Sc::Scene::addHairSystemSimControl(Sc::HairSystemCore& core) +{ + Sc::HairSystemSim* sim = core.getSim(); + + if (sim) + { + mSimulationController->addHairSystem(sim->getLowLevelHairSystem(), sim->getNodeIndex()); + mLLContext->getNphaseImplementationContext()->registerShape(sim->getNodeIndex(), sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID(), sim->getPxActor()); + } +} + +void Sc::Scene::removeHairSystemSimControl(Sc::HairSystemCore& core) +{ + Sc::HairSystemSim* sim = core.getSim(); + + if (sim) + { + mLLContext->getNphaseImplementationContext()->unregisterShape(sim->getShapeSim().getCore().getCore(), sim->getShapeSim().getElementID()); + mSimulationController->releaseHairSystem(sim->getLowLevelHairSystem()); + } +} + +void Sc::Scene::addRigidAttachment(const Sc::BodyCore* core, const Sc::HairSystemSim& sim) +{ + PxNodeIndex nodeIndex; + + if (core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + + if (interaction.mCount == 0) + { + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(NULL, sim.getNodeIndex(), nodeIndex, NULL, IG::Edge::eHAIR_SYSTEM_CONTACT); + mSimpleIslandManager->setEdgeConnected(edgeIdx, IG::Edge::eHAIR_SYSTEM_CONTACT); + interaction.mIndex = edgeIdx; + } + interaction.mCount++; +} + +void Sc::Scene::removeRigidAttachment(const Sc::BodyCore* core, const Sc::HairSystemSim& sim) +{ + PxNodeIndex nodeIndex; + + if(core) + { + nodeIndex = core->getSim()->getNodeIndex(); + } + + PxPair pair(sim.getNodeIndex().index(), nodeIndex.index()); + if(mParticleOrSoftBodyRigidInteractionMap.find(pair)) // find returns pointer to const so we cannot use it directly + { + ParticleOrSoftBodyRigidInteraction& interaction = mParticleOrSoftBodyRigidInteractionMap[pair]; + PX_ASSERT(interaction.mCount > 0); + interaction.mCount--; + if(interaction.mCount == 0) + { + mSimpleIslandManager->removeConnection(interaction.mIndex); + mParticleOrSoftBodyRigidInteractionMap.erase(pair); + } + } +} +#endif + +void Sc::Scene::addBrokenConstraint(Sc::ConstraintCore* c) +{ + PX_ASSERT(mBrokenConstraints.find(c) == mBrokenConstraints.end()); + mBrokenConstraints.pushBack(c); +} + +void Sc::Scene::addActiveBreakableConstraint(Sc::ConstraintSim* c, Sc::ConstraintInteraction* ci) +{ + PX_ASSERT(ci && ci->readInteractionFlag(InteractionFlag::eIS_ACTIVE)); + PX_UNUSED(ci); + PX_ASSERT(!mActiveBreakableConstraints.contains(c)); + PX_ASSERT(!c->isBroken()); + mActiveBreakableConstraints.insert(c); + c->setFlag(ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED); +} + +void Sc::Scene::removeActiveBreakableConstraint(Sc::ConstraintSim* c) +{ + const bool exists = mActiveBreakableConstraints.erase(c); + PX_ASSERT(exists); + PX_UNUSED(exists); + c->clearFlag(ConstraintSim::eCHECK_MAX_FORCE_EXCEEDED); +} + +void* Sc::Scene::allocateConstraintBlock(PxU32 size) +{ + if(size<=128) + return mMemBlock128Pool.construct(); + else if(size<=256) + return mMemBlock256Pool.construct(); + else if(size<=384) + return mMemBlock384Pool.construct(); + else + return PX_ALLOC(size, "ConstraintBlock"); +} + +void Sc::Scene::deallocateConstraintBlock(void* ptr, PxU32 size) +{ + if(size<=128) + mMemBlock128Pool.destroy(reinterpret_cast(ptr)); + else if(size<=256) + mMemBlock256Pool.destroy(reinterpret_cast(ptr)); + else if(size<=384) + mMemBlock384Pool.destroy(reinterpret_cast(ptr)); + else + PX_FREE(ptr); +} + +/*-------------------------------*\ +| Adam's explanation of the RB solver: +| This is a novel idea of mine, +| a combination of ideas on +| Milenkovic's Optimization +| Based Animation, and Trinkle's +| time stepping schemes. +| +| A time step goes like this: +| +| Taking no substeps: +| 0) Compute contact points. +| 1) Update external forces. This may include friction. +| 2) Integrate external forces to current velocities. +| 3) Solve for impulses at contacts which will prevent +| interpenetration at next timestep given some +| velocity integration scheme. +| 4) Use the integration scheme on velocity to +| reach the next state. Here we should not have any +| interpenetration at the old contacts, but perhaps +| at new contacts. If interpenetrating at new contacts, +| just add these to the contact list; no need to repeat +| the time step, because the scheme will get rid of the +| penetration by the next step. +| +| +| Advantages: +| + Large steps, LOD realism. +| + very simple. +| +\*-------------------------------*/ + +void Sc::Scene::advanceStep(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.solveQueueTasks", getContextId()); + + if (mDt != 0.0f) + { + mFinalizationPhase.addDependent(*continuation); + mFinalizationPhase.removeReference(); + + if (mPublicFlags & PxSceneFlag::eENABLE_CCD) + { + mUpdateCCDMultiPass.setContinuation(&mFinalizationPhase); + mAfterIntegration.setContinuation(&mUpdateCCDMultiPass); + mUpdateCCDMultiPass.removeReference(); + } + else + { + mAfterIntegration.setContinuation(&mFinalizationPhase); + } + + mPostSolver.setContinuation(&mAfterIntegration); + mUpdateSimulationController.setContinuation(&mPostSolver); + mUpdateDynamics.setContinuation(&mUpdateSimulationController); + mUpdateBodies.setContinuation(&mUpdateDynamics); + mSolver.setContinuation(&mUpdateBodies); + mPostIslandGen.setContinuation(&mSolver); + mIslandGen.setContinuation(&mPostIslandGen); + mPostNarrowPhase.addDependent(mIslandGen); + mPostNarrowPhase.removeReference(); + + mSecondPassNarrowPhase.setContinuation(&mPostNarrowPhase); + + mFinalizationPhase.removeReference(); + mAfterIntegration.removeReference(); + mPostSolver.removeReference(); + mUpdateSimulationController.removeReference(); + mUpdateDynamics.removeReference(); + mUpdateBodies.removeReference(); + mSolver.removeReference(); + mPostIslandGen.removeReference(); + mIslandGen.removeReference(); + mPostNarrowPhase.removeReference(); + mSecondPassNarrowPhase.removeReference(); + } +} + +void Sc::Scene::collideStep(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.collideQueueTasks", getContextId()); + PX_PROFILE_START_CROSSTHREAD("Basic.collision", getContextId()); + + mStats->simStart(); + mLLContext->beginUpdate(); + + mSimulationController->flushInsertions(); + + mPostNarrowPhase.setTaskManager(*continuation->getTaskManager()); + mPostNarrowPhase.addReference(); + + mFinalizationPhase.setTaskManager(*continuation->getTaskManager()); + mFinalizationPhase.addReference(); + + mRigidBodyNarrowPhase.setContinuation(continuation); + mPreRigidBodyNarrowPhase.setContinuation(&mRigidBodyNarrowPhase); + mUpdateShapes.setContinuation(&mPreRigidBodyNarrowPhase); + + mRigidBodyNarrowPhase.removeReference(); + mPreRigidBodyNarrowPhase.removeReference(); + mUpdateShapes.removeReference(); +} + +void Sc::Scene::broadPhase(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Basic.broadPhase", getContextId()); + + mProcessLostPatchesTask.setContinuation(&mPostNarrowPhase); + mProcessLostPatchesTask.removeReference(); + +#if PX_SUPPORT_GPU_PHYSX + //update soft bodies world bound + Sc::SoftBodyCore* const* softBodies = mSoftBodies.getEntries(); + PxU32 size = mSoftBodies.size(); + if (mUseGpuBp) + { + for (PxU32 i = 0; i < size; ++i) + { + softBodies[i]->getSim()->updateBoundsInAABBMgr(); + } + } + else + { + for (PxU32 i = 0; i < size; ++i) + { + softBodies[i]->getSim()->updateBounds(); + } + } + + // update FEM-cloth world bound + Sc::FEMClothCore* const* femCloths = mFEMCloths.getEntries(); + size = mFEMCloths.size(); + if (mUseGpuBp) + { + for (PxU32 i = 0; i < size; ++i) + { + femCloths[i]->getSim()->updateBoundsInAABBMgr(); + } + } + else + { + for (PxU32 i = 0; i < size; ++i) + { + femCloths[i]->getSim()->updateBounds(); + } + } + + //upate the actor handle of particle system in AABB manager + Sc::ParticleSystemCore* const* particleSystems = mParticleSystems.getEntries(); + + size = mParticleSystems.size(); + if (mUseGpuBp) + { + for (PxU32 i = 0; i < size; ++i) + particleSystems[i]->getSim()->updateBoundsInAABBMgr(); + } + else + { + for (PxU32 i = 0; i < size; ++i) + particleSystems[i]->getSim()->updateBounds(); + } + + //update hair system world bound + Sc::HairSystemCore* const* hairSystems = mHairSystems.getEntries(); + PxU32 nHairSystems = mHairSystems.size(); + if (mUseGpuBp) + { + for (PxU32 i = 0; i < nHairSystems; ++i) + { + hairSystems[i]->getSim()->updateBoundsInAABBMgr(); + } + } + else + { + for (PxU32 i = 0; i < nHairSystems; ++i) + { + hairSystems[i]->getSim()->updateBounds(); + } + } + +#endif + + mCCDBp = false; + + mBpSecondPass.setContinuation(continuation); + mBpFirstPass.setContinuation(&mBpSecondPass); + + mBpSecondPass.removeReference(); + mBpFirstPass.removeReference(); +} + +void Sc::Scene::broadPhaseFirstPass(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Basic.broadPhaseFirstPass", getContextId()); + + const PxU32 numCpuTasks = continuation->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + mAABBManager->updateBPFirstPass(numCpuTasks, mLLContext->getTaskPool(), mHasContactDistanceChanged, continuation); + + PxU32 maxAABBHandles = PxMax(mAABBManager->getChangedAABBMgActorHandleMap().getWordCount() * 32, getElementIDPool().getMaxID()); + + mSimulationController->mergeChangedAABBMgHandle(maxAABBHandles, mPublicFlags & PxSceneFlag::eSUPPRESS_READBACK); +} + +void Sc::Scene::broadPhaseSecondPass(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Basic.broadPhaseSecondPass", getContextId()); + + mBpUpdate.setContinuation(continuation); + mPreIntegrate.setContinuation(&mBpUpdate); + + mPreIntegrate.removeReference(); + mBpUpdate.removeReference(); +} + +void Sc::Scene::preIntegrate(PxBaseTask* continuation) +{ + if (!mCCDBp && isUsingGpuDynamicsOrBp()) + mSimulationController->preIntegrateAndUpdateBound(continuation, mGravity, mDt); +} + +void Sc::Scene::updateBroadPhase(PxBaseTask* continuation) +{ + PxBaseTask* rigidBodyNPhaseUnlock = mCCDPass ? NULL : &mRigidBodyNPhaseUnlock; + + const PxU32 numCpuTasks = continuation->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + mAABBManager->updateBPSecondPass(numCpuTasks, &mLLContext->getScratchAllocator(), continuation); + + // PT: decoupling: I moved this back from updateBPSecondPass + //if this is mCCDPass, narrowPhaseUnlockTask will be NULL + if(rigidBodyNPhaseUnlock) + rigidBodyNPhaseUnlock->removeReference(); + + if(!mCCDBp && isUsingGpuDynamicsOrBp()) + mSimulationController->updateParticleSystemsAndSoftBodies(); +} + +void Sc::Scene::postBroadPhase(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Basic.postBroadPhase", getContextId()); + + //Notify narrow phase that broad phase has completed + mLLContext->getNphaseImplementationContext()->postBroadPhaseUpdateContactManager(continuation); + mAABBManager->postBroadPhase(continuation, *getFlushPool()); +} + +void Sc::Scene::postBroadPhaseContinuation(PxBaseTask* continuation) +{ + mAABBManager->getChangedAABBMgActorHandleMap().clear(); + + // - Finishes broadphase update + // - Adds new interactions (and thereby contact managers if needed) + finishBroadPhase(continuation); +} + +void Sc::Scene::postBroadPhaseStage2(PxBaseTask* continuation) +{ + // - Wakes actors that lost touch if appropriate + processLostTouchPairs(); + //Release unused Cms back to the pool (later, this needs to be done in a thread-safe way from multiple worker threads + mIslandInsertion.setContinuation(continuation); + mRegisterContactManagers.setContinuation(continuation); + mRegisterInteractions.setContinuation(continuation); + mRegisterSceneInteractions.setContinuation(continuation); + mIslandInsertion.removeReference(); + mRegisterContactManagers.removeReference(); + mRegisterInteractions.removeReference(); + mRegisterSceneInteractions.removeReference(); + + { + PX_PROFILE_ZONE("Sim.processNewOverlaps.release", getContextId()); + for (PxU32 a = 0; a < mPreallocatedContactManagers.size(); ++a) + { + if ((size_t(mPreallocatedContactManagers[a]) & 1) == 0) + mLLContext->getContactManagerPool().put(mPreallocatedContactManagers[a]); + } + + for (PxU32 a = 0; a < mPreallocatedShapeInteractions.size(); ++a) + { + if ((size_t(mPreallocatedShapeInteractions[a]) & 1) == 0) + mNPhaseCore->mShapeInteractionPool.deallocate(mPreallocatedShapeInteractions[a]); + } + + for (PxU32 a = 0; a < mPreallocatedInteractionMarkers.size(); ++a) + { + if ((size_t(mPreallocatedInteractionMarkers[a]) & 1) == 0) + mNPhaseCore->mInteractionMarkerPool.deallocate(mPreallocatedInteractionMarkers[a]); + } + } +} + +void Sc::Scene::postBroadPhaseStage3(PxBaseTask* /*continuation*/) +{ + finishBroadPhaseStage2(0); + + PX_PROFILE_STOP_CROSSTHREAD("Basic.postBroadPhase", getContextId()); + PX_PROFILE_STOP_CROSSTHREAD("Basic.broadPhase", getContextId()); +} + +class DirtyShapeUpdatesTask : public Cm::Task +{ +public: + static const PxU32 MaxShapes = 256; + + PxsTransformCache& mCache; + Bp::BoundsArray& mBoundsArray; + Sc::ShapeSim* mShapes[MaxShapes]; + PxU32 mNbShapes; + + DirtyShapeUpdatesTask(PxU64 contextID, PxsTransformCache& cache, Bp::BoundsArray& boundsArray) : + Cm::Task (contextID), + mCache (cache), + mBoundsArray(boundsArray), + mNbShapes (0) + { + } + + virtual void runInternal() + { + for (PxU32 a = 0; a < mNbShapes; ++a) + { + mShapes[a]->updateCached(mCache, mBoundsArray); + } + } + + virtual const char* getName() const { return "DirtyShapeUpdatesTask"; } + +private: + PX_NOCOPY(DirtyShapeUpdatesTask) +}; + +void Sc::Scene::preRigidBodyNarrowPhase(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Scene.preNarrowPhase", getContextId()); + + updateContactDistances(continuation); + + //Process dirty shapeSims... + PxBitMap::Iterator dirtyShapeIter(mDirtyShapeSimMap); + + PxsTransformCache& cache = mLLContext->getTransformCache(); + Bp::BoundsArray& boundsArray = mAABBManager->getBoundsArray(); + + Cm::FlushPool& pool = mLLContext->getTaskPool(); + PxBitMapPinned& changedMap = mAABBManager->getChangedAABBMgActorHandleMap(); + + DirtyShapeUpdatesTask* task = PX_PLACEMENT_NEW(pool.allocate(sizeof(DirtyShapeUpdatesTask)), DirtyShapeUpdatesTask)(getContextId(), cache, boundsArray); + + bool hasDirtyShapes = false; + PxU32 index; + while ((index = dirtyShapeIter.getNext()) != PxBitMap::Iterator::DONE) + { + Sc::ShapeSim* shapeSim = reinterpret_cast(mAABBManager->getUserData(index)); + if (shapeSim) + { + hasDirtyShapes = true; + changedMap.growAndSet(index); + task->mShapes[task->mNbShapes++] = shapeSim; + if (task->mNbShapes == DirtyShapeUpdatesTask::MaxShapes) + { + task->setContinuation(continuation); + task->removeReference(); + task = PX_PLACEMENT_NEW(pool.allocate(sizeof(DirtyShapeUpdatesTask)), DirtyShapeUpdatesTask)(getContextId(), cache, boundsArray); + } + } + } + + if (hasDirtyShapes) + { + //Setting the boundsArray and transform cache as dirty so that they get DMAd to GPU if GPU dynamics and BP are being used respectively. + //These bits are no longer set when we update the cached state for actors due to an optimization avoiding setting these dirty bits multiple times. + getBoundsArray().setChangedState(); + getLowLevelContext()->getTransformCache().setChangedState(); + } + + if (task->mNbShapes != 0) + { + task->setContinuation(continuation); + task->removeReference(); + } + + mDirtyShapeSimMap.clear(); +} + +void Sc::Scene::updateBoundsAndShapes(PxBaseTask* /*continuation*/) +{ + //if the scene isn't use gpu dynamic and gpu broad phase and the user raise suppress readback flag, + //the sdk will refuse to create the scene. + const bool useDirectGpuApi = mPublicFlags & PxSceneFlag::eSUPPRESS_READBACK; + mSimulationController->updateBoundsAndShapes(*mAABBManager, mUseGpuBp, useDirectGpuApi); +} + +void Sc::Scene::rigidBodyNarrowPhase(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Basic.narrowPhase", getContextId()); + + mCCDPass = 0; + + mPostBroadPhase3.addDependent(*continuation); + mPostBroadPhase2.setContinuation(&mPostBroadPhase3); + mPostBroadPhaseCont.setContinuation(&mPostBroadPhase2); + mPostBroadPhase.setContinuation(&mPostBroadPhaseCont); + mBroadPhase.setContinuation(&mPostBroadPhase); + + mRigidBodyNPhaseUnlock.setContinuation(continuation); + mRigidBodyNPhaseUnlock.addReference(); + + mUpdateBoundAndShapeTask.addDependent(mBroadPhase); + + mLLContext->resetThreadContexts(); + + mLLContext->updateContactManager(mDt, mBoundsArray->hasChanged(), mHasContactDistanceChanged, continuation, + &mRigidBodyNPhaseUnlock, &mUpdateBoundAndShapeTask); // Starts update of contact managers + + mPostBroadPhase3.removeReference(); + mPostBroadPhase2.removeReference(); + mPostBroadPhaseCont.removeReference(); + mPostBroadPhase.removeReference(); + mBroadPhase.removeReference(); + + mUpdateBoundAndShapeTask.removeReference(); +} + +void Sc::Scene::unblockNarrowPhase(PxBaseTask*) +{ + /*if (!mCCDBp && mUseGpuRigidBodies) + mSimulationController->updateParticleSystemsAndSoftBodies();*/ + // + mLLContext->getNphaseImplementationContext()->startNarrowPhaseTasks(); +} + +void Sc::Scene::postNarrowPhase(PxBaseTask* /*continuation*/) +{ + setCollisionPhaseToInactive(); + + mHasContactDistanceChanged = false; + mLLContext->fetchUpdateContactManager(); //Sync on contact gen results! + + if (!mCCDBp && isUsingGpuDynamicsOrBp()) + { + mSimulationController->sortContacts(); + } + + releaseConstraints(false); + + PX_PROFILE_STOP_CROSSTHREAD("Basic.narrowPhase", getContextId()); + PX_PROFILE_STOP_CROSSTHREAD("Basic.collision", getContextId()); +} + +void Sc::Scene::fetchPatchEvents(PxBaseTask*) +{ + //PxU32 foundPatchCount, lostPatchCount; + + //{ + // PX_PROFILE_ZONE("Sim.preIslandGen.managerPatchEvents", getContextId()); + // mLLContext->getManagerPatchEventCount(foundPatchCount, lostPatchCount); + + // //mLLContext->fillManagerPatchChangedEvents(mFoundPatchManagers.begin(), foundPatchCount, mLostPatchManagers.begin(), lostPatchCount); + //} +} + +void Sc::Scene::processNarrowPhaseTouchEvents() +{ + PX_PROFILE_ZONE("Sim.preIslandGen", getContextId()); + + PxsContext* context = mLLContext; + + // Update touch states from LL + PxU32 newTouchCount, lostTouchCount; + PxU32 ccdTouchCount = 0; + { + PX_PROFILE_ZONE("Sim.preIslandGen.managerTouchEvents", getContextId()); + context->getManagerTouchEventCount(reinterpret_cast(&newTouchCount), reinterpret_cast(&lostTouchCount), NULL); + //PX_ALLOCA(newTouches, PxvContactManagerTouchEvent, newTouchCount); + //PX_ALLOCA(lostTouches, PxvContactManagerTouchEvent, lostTouchCount); + + mTouchFoundEvents.forceSize_Unsafe(0); + mTouchFoundEvents.reserve(newTouchCount); + mTouchFoundEvents.forceSize_Unsafe(newTouchCount); + + mTouchLostEvents.forceSize_Unsafe(0); + mTouchLostEvents.reserve(lostTouchCount); + mTouchLostEvents.forceSize_Unsafe(lostTouchCount); + + context->fillManagerTouchEvents(mTouchFoundEvents.begin(), reinterpret_cast(newTouchCount), mTouchLostEvents.begin(), + reinterpret_cast(lostTouchCount), NULL, reinterpret_cast(ccdTouchCount)); + + mTouchFoundEvents.forceSize_Unsafe(newTouchCount); + mTouchLostEvents.forceSize_Unsafe(lostTouchCount); + } + + context->getSimStats().mNbNewTouches = newTouchCount; + context->getSimStats().mNbLostTouches = lostTouchCount; +} + +static PX_FORCE_INLINE Sc::ShapeInteraction* getSI(PxvContactManagerTouchEvent& evt) +{ + return reinterpret_cast(evt.getCMTouchEventUserData()); +} + +class InteractionNewTouchTask : public Cm::Task +{ + PxvContactManagerTouchEvent* mEvents; + const PxU32 mNbEvents; + PxsContactManagerOutputIterator mOutputs; + Sc::NPhaseCore* mNphaseCore; + +public: + InteractionNewTouchTask(PxU64 contextID, PxvContactManagerTouchEvent* events, PxU32 nbEvents, PxsContactManagerOutputIterator& outputs, Sc::NPhaseCore* nPhaseCore) : + Cm::Task (contextID), + mEvents (events), + mNbEvents (nbEvents), + mOutputs (outputs), + mNphaseCore (nPhaseCore) + { + } + + virtual const char* getName() const + { + return "InteractionNewTouchTask"; + } + + void hackInContinuation(PxBaseTask* cont) + { + PX_ASSERT(mCont == NULL); + mCont = cont; + if (mCont) + mCont->addReference(); + } + + virtual void runInternal() + { + mNphaseCore->lockReports(); + for (PxU32 i = 0; i < mNbEvents; ++i) + { + Sc::ShapeInteraction* si = getSI(mEvents[i]); + PX_ASSERT(si); + mNphaseCore->managerNewTouch(*si); + si->managerNewTouch(0, true, mOutputs); + } + mNphaseCore->unlockReports(); + } +private: + PX_NOCOPY(InteractionNewTouchTask) +}; + +void Sc::Scene::processNarrowPhaseTouchEventsStage2(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::processNarrowPhaseTouchEventsStage2", getContextId()); + mLLContext->getNphaseImplementationContext()->waitForContactsReady(); + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + const PxU32 newTouchCount = mTouchFoundEvents.size(); + + { + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + InteractionNewTouchTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(InteractionNewTouchTask)), InteractionNewTouchTask)(getContextId(), mTouchFoundEvents.begin(), newTouchCount, outputs, mNPhaseCore); + task->setContinuation(continuation); + task->removeReference(); + } + + /*{ + PX_PROFILE_ZONE("Sim.preIslandGen.newTouchesInteraction", getContextId()); + for (PxU32 i = 0; i < newTouchCount; ++i) + { + ShapeInteraction* si = reinterpret_cast(mTouchFoundEvents[i].userData); + PX_ASSERT(si); + mNPhaseCore->managerNewTouch(*si); + si->managerNewTouch(0, true, outputs, useAdaptiveForce); + } + }*/ + +} + +void Sc::Scene::setEdgesConnected(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sim.preIslandGen.islandTouches", getContextId()); + { + PX_PROFILE_ZONE("Sim.preIslandGen.setEdgesConnected", getContextId()); + const PxU32 newTouchCount = mTouchFoundEvents.size(); + for(PxU32 i = 0; i < newTouchCount; ++i) + { + ShapeInteraction* si = getSI(mTouchFoundEvents[i]); + if(!si->readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) + mSimpleIslandManager->setEdgeConnected(si->getEdgeIndex(), IG::Edge::eCONTACT_MANAGER); + } + } + + mSimpleIslandManager->secondPassIslandGen(); + + wakeObjectsUp(ActorSim::AS_PART_OF_ISLAND_GEN); +} + +void Sc::Scene::processNarrowPhaseLostTouchEventsIslands(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sc::Scene.islandLostTouches", getContextId()); + const PxU32 count = mTouchLostEvents.size(); + for(PxU32 i=0; i setEdgeDisconnected(si->getEdgeIndex()); + } +} + +void Sc::Scene::processNarrowPhaseLostTouchEvents(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sc::Scene.processNarrowPhaseLostTouchEvents", getContextId()); + mLLContext->getNphaseImplementationContext()->waitForContactsReady(); + PxsContactManagerOutputIterator outputs = this->mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + const PxU32 count = mTouchLostEvents.size(); + for(PxU32 i=0; imanagerLostTouch(0, true, outputs) && !si->readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) + addToLostTouchList(si->getShape0().getActor(), si->getShape1().getActor()); + } +} + +void Sc::Scene::processLostSolverPatches(PxBaseTask* /*continuation*/) +{ + PxvNphaseImplementationContext* nphase = mLLContext->getNphaseImplementationContext(); + mDynamicsContext->processLostPatches(*mSimpleIslandManager, nphase->getFoundPatchManagers(), nphase->getNbFoundPatchManagers(), nphase->getFoundPatchOutputCounts()); +} + +void Sc::Scene::processFoundSolverPatches(PxBaseTask* /*continuation*/) +{ + PxvNphaseImplementationContext* nphase = mLLContext->getNphaseImplementationContext(); + mDynamicsContext->processFoundPatches(*mSimpleIslandManager, nphase->getFoundPatchManagers(), nphase->getNbFoundPatchManagers(), nphase->getFoundPatchOutputCounts()); +} + +void Sc::Scene::islandGen(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::islandGen", getContextId()); +// PX_PROFILE_START_CROSSTHREAD("Basic.rigidBodySolver", getContextId()); + + //mLLContext->runModifiableContactManagers(); //KS - moved here so that we can get up-to-date touch found/lost events in IG + + /*mProcessLostPatchesTask.setContinuation(&mUpdateDynamics); + mProcessLostPatchesTask.removeReference();*/ + //mFetchPatchEventsTask.setContinuation(&mProcessLostPatchesTask); + + //mFetchPatchEventsTask.removeReference(); + processNarrowPhaseTouchEvents(); + + mProcessFoundPatchesTask.setContinuation(continuation); + mProcessFoundPatchesTask.removeReference(); + + processNarrowPhaseTouchEventsStage2(&mPostSolver); +} + +void Sc::Scene::putObjectsToSleep(PxU32 infoFlag) +{ + PX_PROFILE_ZONE("Sc::Scene::putObjectsToSleep", getContextId()); + const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + //Set to sleep all bodies that were in awake islands that have just been put to sleep. + const PxU32 nbBodiesToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); + const PxNodeIndex*const bodyIndices = islandSim.getNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); + + PxU32 nbBodiesDeactivated = 0; + for(PxU32 i=0;i(reinterpret_cast(rigidBody) - Sc::BodySim::getRigidBodyOffset()); + bodySim->setActive(false, infoFlag); + nbBodiesDeactivated++; + } + } + + const PxU32 nbArticulationsToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eARTICULATION_TYPE); + const PxNodeIndex*const articIndices = islandSim.getNodesToDeactivate(IG::Node::eARTICULATION_TYPE); + + for(PxU32 i=0;isetActive(false, infoFlag); + nbBodiesDeactivated++; + } + } + +#if PX_SUPPORT_GPU_PHYSX + const PxU32 nbSoftBodiesToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eSOFTBODY_TYPE); + const PxNodeIndex*const softBodiesIndices = islandSim.getNodesToDeactivate(IG::Node::eSOFTBODY_TYPE); + + for (PxU32 i = 0; igetSoftBodySim(); + if (softBodySim && !islandSim.getNode(softBodiesIndices[i]).isActive()) + { + softBodySim->setActive(false, infoFlag); + nbBodiesDeactivated++; + } + } + + const PxU32 nbFemClothesToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eFEMCLOTH_TYPE); + const PxNodeIndex*const femClothesIndices = islandSim.getNodesToDeactivate(IG::Node::eFEMCLOTH_TYPE); + + for (PxU32 i = 0; i < nbFemClothesToSleep; i++) + { + Sc::FEMClothSim* femClothSim = islandSim.getLLFEMCloth(femClothesIndices[i])->getFEMClothSim(); + if (femClothSim && !islandSim.getNode(femClothesIndices[i]).isActive()) + { + femClothSim->setActive(false, infoFlag); + nbBodiesDeactivated++; + } + } + + const PxU32 nbHairSystemsToSleep = islandSim.getNbNodesToDeactivate(IG::Node::eHAIRSYSTEM_TYPE); + const PxNodeIndex*const hairSystemIndices = islandSim.getNodesToDeactivate(IG::Node::eHAIRSYSTEM_TYPE); + + for (PxU32 i = 0; i < nbHairSystemsToSleep; i++) + { + Sc::HairSystemSim* hairSystemSim = islandSim.getLLHairSystem(hairSystemIndices[i])->getHairSystemSim(); + if (hairSystemSim && !islandSim.getNode(hairSystemIndices[i]).isActive()) + { + hairSystemSim->setActive(false, infoFlag); + nbBodiesDeactivated++; + } + } +#endif + + if (nbBodiesDeactivated != 0) + mDynamicsContext->setStateDirty(true); +} + +void Sc::Scene::wakeObjectsUp(PxU32 infoFlag) +{ + //Wake up all bodies that were in sleeping islands that have just been hit by a moving object. + + const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + const PxU32 nbBodiesToWake = islandSim.getNbNodesToActivate(IG::Node::eRIGID_BODY_TYPE); + const PxNodeIndex*const bodyIndices = islandSim.getNodesToActivate(IG::Node::eRIGID_BODY_TYPE); + + PxU32 nbBodiesWoken = 0; + for(PxU32 i=0;i(reinterpret_cast(rigidBody) - Sc::BodySim::getRigidBodyOffset()); + bodySim->setActive(true, infoFlag); + nbBodiesWoken++; + } + } + + const PxU32 nbArticulationsToWake = islandSim.getNbNodesToActivate(IG::Node::eARTICULATION_TYPE); + const PxNodeIndex*const articIndices = islandSim.getNodesToActivate(IG::Node::eARTICULATION_TYPE); + + for(PxU32 i=0;isetActive(true, infoFlag); + nbBodiesWoken++; + } + } + +#if PX_SUPPORT_GPU_PHYSX + const PxU32 nbSoftBodyToWake = islandSim.getNbNodesToActivate(IG::Node::eSOFTBODY_TYPE); + const PxNodeIndex*const softBodyIndices = islandSim.getNodesToActivate(IG::Node::eSOFTBODY_TYPE); + + for (PxU32 i = 0; igetSoftBodySim(); + if (softBodySim && islandSim.getNode(softBodyIndices[i]).isActive()) + { + softBodySim->setActive(true, infoFlag); + nbBodiesWoken++; + } + } + + const PxU32 nbFEMClothToWake = islandSim.getNbNodesToActivate(IG::Node::eFEMCLOTH_TYPE); + const PxNodeIndex*const femClothIndices = islandSim.getNodesToActivate(IG::Node::eFEMCLOTH_TYPE); + + for (PxU32 i = 0; i < nbFEMClothToWake; i++) + { + Sc::FEMClothSim* femClothSim = islandSim.getLLFEMCloth(femClothIndices[i])->getFEMClothSim(); + if (femClothSim && islandSim.getNode(femClothIndices[i]).isActive()) + { + femClothSim->setActive(true, infoFlag); + nbBodiesWoken++; + } + } + + const PxU32 nbHairSystemsToWake = islandSim.getNbNodesToActivate(IG::Node::eHAIRSYSTEM_TYPE); + const PxNodeIndex*const hairSystemIndices = islandSim.getNodesToActivate(IG::Node::eHAIRSYSTEM_TYPE); + + for (PxU32 i = 0; i < nbHairSystemsToWake; i++) + { + Sc::HairSystemSim* hairSystemSim = islandSim.getLLHairSystem(hairSystemIndices[i])->getHairSystemSim(); + if (hairSystemSim && islandSim.getNode(hairSystemIndices[i]).isActive()) + { + hairSystemSim->setActive(true, infoFlag); + nbBodiesWoken++; + } + } +#endif + + if(nbBodiesWoken != 0) + mDynamicsContext->setStateDirty(true); +} + +void Sc::Scene::postIslandGen(PxBaseTask* continuationTask) +{ + PX_PROFILE_ZONE("Sim.postIslandGen", getContextId()); + + mSetEdgesConnectedTask.setContinuation(continuationTask); + mSetEdgesConnectedTask.removeReference(); + + // - Performs collision detection for trigger interactions + mNPhaseCore->processTriggerInteractions(continuationTask); +} + +void Sc::Scene::solver(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Basic.rigidBodySolver", getContextId()); + //Update forces per body in parallel. This can overlap with the other work in this phase. + beforeSolver(continuation); + + PX_PROFILE_ZONE("Sim.postNarrowPhaseSecondPass", getContextId()); + //Narrowphase is completely finished so the streams can be swapped. + mLLContext->swapStreams(); + + //PxsContactManagerOutputIterator outputs = this->mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + //mNPhaseCore->processPersistentContactEvents(outputs, continuation); +} + +void Sc::Scene::updateBodies(PxBaseTask* continuation) +{ + PX_UNUSED(continuation); + + //dma bodies and articulation data to gpu + mSimulationController->updateBodies(continuation); +} + +void Sc::Scene::updateShapes(PxBaseTask* continuation) +{ + //dma shapes data to gpu + mSimulationController->updateShapes(continuation); +} + +Cm::FlushPool* Sc::Scene::getFlushPool() +{ + return &mLLContext->getTaskPool(); +} + +bool Sc::activateInteraction(Sc::Interaction* interaction, void* data) +{ + switch(interaction->getType()) + { + case InteractionType::eOVERLAP: + return static_cast(interaction)->onActivate_(data); + + case InteractionType::eTRIGGER: + return static_cast(interaction)->onActivate_(data); + + case InteractionType::eMARKER: + return static_cast(interaction)->onActivate_(data); + + case InteractionType::eCONSTRAINTSHADER: + return static_cast(interaction)->onActivate_(data); + + case InteractionType::eARTICULATION: + return static_cast(interaction)->onActivate_(data); + + case InteractionType::eTRACKED_IN_SCENE_COUNT: + case InteractionType::eINVALID: + PX_ASSERT(0); + break; + } + return false; +} + +static bool deactivateInteraction(Sc::Interaction* interaction, const Sc::InteractionType::Enum type) +{ + using namespace Sc; + + switch(type) + { + case InteractionType::eOVERLAP: + return static_cast(interaction)->onDeactivate_(); + + case InteractionType::eTRIGGER: + return static_cast(interaction)->onDeactivate_(); + + case InteractionType::eMARKER: + return static_cast(interaction)->onDeactivate_(); + + case InteractionType::eCONSTRAINTSHADER: + return static_cast(interaction)->onDeactivate_(); + + case InteractionType::eARTICULATION: + return static_cast(interaction)->onDeactivate_(); + + case InteractionType::eTRACKED_IN_SCENE_COUNT: + case InteractionType::eINVALID: + PX_ASSERT(0); + break; + } + return false; +} + +void Sc::Scene::postThirdPassIslandGen(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::postThirdPassIslandGen", getContextId()); + putObjectsToSleep(ActorSim::AS_PART_OF_ISLAND_GEN); + + { + PX_PROFILE_ZONE("Sc::Scene::putInteractionsToSleep", getContextId()); + const IG::IslandSim& islandSim = mSimpleIslandManager->getSpeculativeIslandSim(); + + //KS - only deactivate contact managers based on speculative state to trigger contact gen. When the actors were deactivated based on accurate state + //joints should have been deactivated. + + const PxU32 NbTypes = 5; + const IG::Edge::EdgeType types[NbTypes] = { + IG::Edge::eCONTACT_MANAGER, + IG::Edge::eSOFT_BODY_CONTACT, + IG::Edge::eFEM_CLOTH_CONTACT, + IG::Edge::ePARTICLE_SYSTEM_CONTACT, + IG::Edge::eHAIR_SYSTEM_CONTACT }; + + for(PxU32 t = 0; t < NbTypes; ++t) + { + const PxU32 nbDeactivatingEdges = islandSim.getNbDeactivatingEdges(types[t]); + const IG::EdgeIndex* deactivatingEdgeIds = islandSim.getDeactivatingEdges(types[t]); + + for(PxU32 i = 0; i < nbDeactivatingEdges; ++i) + { + Sc::Interaction* interaction = mSimpleIslandManager->getInteraction(deactivatingEdgeIds[i]); + + if(interaction && interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + if(!islandSim.getEdge(deactivatingEdgeIds[i]).isActive()) + { + const InteractionType::Enum type = interaction->getType(); + const bool proceed = deactivateInteraction(interaction, type); + if(proceed && (type < InteractionType::eTRACKED_IN_SCENE_COUNT)) + notifyInteractionDeactivated(interaction); + } + } + } + } + } + + PxvNphaseImplementationContext* implCtx = mLLContext->getNphaseImplementationContext(); + implCtx->waitForContactsReady(); + PxsContactManagerOutputIterator outputs = implCtx->getContactManagerOutputs(); + mNPhaseCore->processPersistentContactEvents(outputs, continuation); +} + +void Sc::Scene::processLostContacts(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::processLostContacts", getContextId()); + mProcessNarrowPhaseLostTouchTasks.setContinuation(continuation); + mProcessNarrowPhaseLostTouchTasks.removeReference(); + + //mLostTouchReportsTask.setContinuation(&mProcessLostContactsTask3); + mProcessNPLostTouchEvents.setContinuation(continuation); + mProcessNPLostTouchEvents.removeReference(); + + { + PX_PROFILE_ZONE("Sim.findInteractionsPtrs", getContextId()); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + ElementSim* volume0 = reinterpret_cast(p->mUserData0); + ElementSim* volume1 = reinterpret_cast(p->mUserData1); + p->mPairUserData = mNPhaseCore->onOverlapRemovedStage1(volume0, volume1); + p++; + } + } +} + +void Sc::Scene::lostTouchReports(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sim.lostTouchReports", getContextId()); + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + + mNPhaseCore->lockReports(); + + { + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + if(p->mPairUserData) + { + Sc::ElementSimInteraction* elemInteraction = reinterpret_cast(p->mPairUserData); + if(elemInteraction->getType() == Sc::InteractionType::eOVERLAP) + mNPhaseCore->lostTouchReports(static_cast(elemInteraction), PxU32(PairReleaseFlag::eWAKE_ON_LOST_TOUCH), NULL, 0, outputs); + } + p++; + } + } + mNPhaseCore->unlockReports(); +} + +void Sc::Scene::unregisterInteractions(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sim.unregisterInteractions", getContextId()); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + + { + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + if(p->mPairUserData) + { + Sc::ElementSimInteraction* elemInteraction = reinterpret_cast(p->mPairUserData); + if(elemInteraction->getType() == Sc::InteractionType::eOVERLAP || elemInteraction->getType() == Sc::InteractionType::eMARKER) + { + unregisterInteraction(elemInteraction); + mNPhaseCore->unregisterInteraction(elemInteraction); + } + } + p++; + } + } +} + +void Sc::Scene::destroyManagers(PxBaseTask*) +{ + PX_PROFILE_ZONE("Sim.destroyManagers", getContextId()); + + mPostThirdPassIslandGenTask.setContinuation(mProcessLostContactsTask3.getContinuation()); + + mSimpleIslandManager->thirdPassIslandGen(&mPostThirdPassIslandGenTask); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + if(p->mPairUserData) + { + Sc::ElementSimInteraction* elemInteraction = reinterpret_cast(p->mPairUserData); + if(elemInteraction->getType() == Sc::InteractionType::eOVERLAP) + { + Sc::ShapeInteraction* si = static_cast(elemInteraction); + if(si->getContactManager()) + si->destroyManager(); + } + } + p++; + } +} + +void Sc::Scene::processLostContacts2(PxBaseTask* continuation) +{ + mDestroyManagersTask.setContinuation(continuation); + mLostTouchReportsTask.setContinuation(&mDestroyManagersTask); + mLostTouchReportsTask.removeReference(); + + mUnregisterInteractionsTask.setContinuation(continuation); + mUnregisterInteractionsTask.removeReference(); + + { + PX_PROFILE_ZONE("Sim.clearIslandData", getContextId()); +// PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + { + Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + Sc::ElementSimInteraction* pair = reinterpret_cast(p->mPairUserData); + if(pair) + { + if(pair->getType() == InteractionType::eOVERLAP) + { + ShapeInteraction* si = static_cast(pair); + si->clearIslandGenData(); + } + } + p++; + } + } + } + + mDestroyManagersTask.removeReference(); +} + +void Sc::Scene::processLostContacts3(PxBaseTask* /*continuation*/) +{ + { + PX_PROFILE_ZONE("Sim.processLostOverlapsStage2", getContextId()); + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + PxU32 destroyedOverlapCount; + + { + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + ElementSim* volume0 = reinterpret_cast(p->mUserData0); + ElementSim* volume1 = reinterpret_cast(p->mUserData1); + + mNPhaseCore->onOverlapRemoved(volume0, volume1, false, p->mPairUserData, outputs); + p++; + } + } + + { + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eTRIGGER, destroyedOverlapCount); + while(destroyedOverlapCount--) + { + ElementSim* volume0 = reinterpret_cast(p->mUserData0); + ElementSim* volume1 = reinterpret_cast(p->mUserData1); + + mNPhaseCore->onOverlapRemoved(volume0, volume1, false, NULL, outputs); + p++; + } + } + + aabbMgr->freeBuffers(); + } + + mPostThirdPassIslandGenTask.removeReference(); +} + +//This is called after solver finish +void Sc::Scene::updateSimulationController(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateSimulationController", getContextId()); + + PxsTransformCache& cache = getLowLevelContext()->getTransformCache(); + Bp::BoundsArray& boundArray = getBoundsArray(); + + PxBitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); + + mSimulationController->gpuDmabackData(cache, boundArray, changedAABBMgrActorHandles, mPublicFlags & PxSceneFlag::eSUPPRESS_READBACK); + + //for pxgdynamicscontext: copy solver body data to body core + { + PX_PROFILE_ZONE("Sim.updateBodyCore", getContextId()); + mDynamicsContext->updateBodyCore(continuation); + } + //mSimulationController->update(cache, boundArray, changedAABBMgrActorHandles); + + /*mProcessLostPatchesTask.setContinuation(&mFinalizationPhase); + mProcessLostPatchesTask.removeReference();*/ +} + +void Sc::Scene::updateDynamics(PxBaseTask* continuation) +{ + //Allow processLostContactsTask to run until after 2nd pass of solver completes (update bodies, run sleeping logic etc.) + mProcessLostContactsTask3.setContinuation(static_cast(continuation)->getContinuation()); + mProcessLostContactsTask2.setContinuation(&mProcessLostContactsTask3); + mProcessLostContactsTask.setContinuation(&mProcessLostContactsTask2); + + ////dma bodies and shapes data to gpu + //mSimulationController->updateBodiesAndShapes(); + + mLLContext->getNpMemBlockPool().acquireConstraintMemory(); + + PX_PROFILE_START_CROSSTHREAD("Basic.dynamics", getContextId()); + PxU32 maxPatchCount = mLLContext->getMaxPatchCount(); + + mAABBManager->reallocateChangedAABBMgActorHandleMap(getElementIDPool().getMaxID()); + + //mNPhaseCore->processPersistentContactEvents(outputs, continuation); + + PxvNphaseImplementationContext* nphase = mLLContext->getNphaseImplementationContext(); + + mDynamicsContext->update(*mSimpleIslandManager, continuation, &mProcessLostContactsTask, + nphase, maxPatchCount, mMaxNbArticulationLinks, mDt, mGravity, mAABBManager->getChangedAABBMgActorHandleMap()); + + mSimpleIslandManager->clearDestroyedEdges(); + + mProcessLostContactsTask3.removeReference(); + mProcessLostContactsTask2.removeReference(); + mProcessLostContactsTask.removeReference(); +} + +//CCD +void Sc::Scene::updateCCDMultiPass(PxBaseTask* parentContinuation) +{ + getCcdBodies().forceSize_Unsafe(mSimulationControllerCallback->getNbCcdBodies()); + + // second run of the broadphase for making sure objects we have integrated did not tunnel. + if(mPublicFlags & PxSceneFlag::eENABLE_CCD) + { + if (mContactReportsNeedPostSolverVelocity) + { + // the CCD code will overwrite the post solver body velocities, hence, we need to extract the info + // first if any CCD enabled pair requested it. + collectPostSolverVelocitiesBeforeCCD(); + } + + //We use 2 CCD task chains to be able to chain together an arbitrary number of ccd passes + if(mPostCCDPass.size() != 2) + { + mPostCCDPass.clear(); + mUpdateCCDSinglePass.clear(); + mCCDBroadPhase.clear(); + mCCDBroadPhaseAABB.clear(); + mPostCCDPass.reserve(2); + mUpdateCCDSinglePass.reserve(2); + mUpdateCCDSinglePass2.reserve(2); + mUpdateCCDSinglePass3.reserve(2); + mCCDBroadPhase.reserve(2); + mCCDBroadPhaseAABB.reserve(2); + for (int j = 0; j < 2; j++) + { + mPostCCDPass.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.postCCDPass")); + mUpdateCCDSinglePass.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.updateCCDSinglePass")); + mUpdateCCDSinglePass2.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.updateCCDSinglePassStage2")); + mUpdateCCDSinglePass3.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.updateCCDSinglePassStage3")); + mCCDBroadPhase.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.ccdBroadPhase")); + mCCDBroadPhaseAABB.pushBack(Cm::DelegateTask(getContextId(), this, "ScScene.ccdBroadPhaseAABB")); + } + } + + //reset thread context in a place we know all tasks possibly accessing it, are in sync with. (see US6664) + mLLContext->resetThreadContexts(); + + mCCDContext->updateCCDBegin(); + + mCCDBroadPhase[0].setContinuation(parentContinuation); + mCCDBroadPhaseAABB[0].setContinuation(&mCCDBroadPhase[0]); + mCCDBroadPhase[0].removeReference(); + mCCDBroadPhaseAABB[0].removeReference(); + } +} + +//CCD +class UpdateCCDBoundsTask : public Cm::Task +{ + Bp::BoundsArray* mBoundArray; + PxsTransformCache* mTransformCache; + Sc::BodySim** mBodySims; + PxU32 mNbToProcess; + PxI32* mNumFastMovingShapes; + +public: + + static const PxU32 MaxPerTask = 256; + + UpdateCCDBoundsTask(PxU64 contextID, Bp::BoundsArray* boundsArray, PxsTransformCache* transformCache, Sc::BodySim** bodySims, PxU32 nbToProcess, PxI32* numFastMovingShapes) : + Cm::Task (contextID), + mBoundArray (boundsArray), + mTransformCache (transformCache), + mBodySims (bodySims), + mNbToProcess (nbToProcess), + mNumFastMovingShapes(numFastMovingShapes) + { + } + + virtual const char* getName() const { return "UpdateCCDBoundsTask";} + + PxIntBool updateSweptBounds(Sc::ShapeSim* sim, Sc::BodySim* body) + { + PX_ASSERT(body==sim->getBodySim()); + + const PxU32 elementID = sim->getElementID(); + + const Sc::ShapeCore& shapeCore = sim->getCore(); + const PxTransform& endPose = mTransformCache->getTransformCache(elementID).transform; + + const PxGeometry& shapeGeom = shapeCore.getGeometry(); + + const PxsRigidBody& rigidBody = body->getLowLevelBody(); + const PxsBodyCore& bodyCore = body->getBodyCore().getCore(); + PX_ALIGN(16, PxTransform shape2World); + Cm::getDynamicGlobalPoseAligned(rigidBody.mLastTransform, shapeCore.getShape2Actor(), bodyCore.getBody2Actor(), shape2World); + + const float ccdThreshold = computeCCDThreshold(shapeGeom); + PxBounds3 bounds = Gu::computeBounds(shapeGeom, endPose); + PxIntBool isFastMoving; + if(1) + { + // PT: this alternative implementation avoids computing the start bounds for slow moving objects. + isFastMoving = (shape2World.p - endPose.p).magnitudeSquared() >= ccdThreshold * ccdThreshold ? 1 : 0; + if (isFastMoving) + { + const PxBounds3 startBounds = Gu::computeBounds(shapeGeom, shape2World); + bounds.include(startBounds); + } + } + else + { + const PxBounds3 startBounds = Gu::computeBounds(shapeGeom, shape2World); + + isFastMoving = (startBounds.getCenter() - bounds.getCenter()).magnitudeSquared() >= ccdThreshold * ccdThreshold ? 1 : 0; + + if(isFastMoving) + bounds.include(startBounds); + } + + PX_ASSERT(bounds.minimum.x <= bounds.maximum.x + && bounds.minimum.y <= bounds.maximum.y + && bounds.minimum.z <= bounds.maximum.z); + + mBoundArray->setBounds(bounds, elementID); + + return isFastMoving; + } + + virtual void runInternal() + { + PxU32 activeShapes = 0; + const PxU32 nb = mNbToProcess; + for(PxU32 i=0; i(*elems++); + if(sim->getFlags() & PxU32(PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE)) + { + const PxIntBool fastMovingShape = updateSweptBounds(sim, &bodySim); + activeShapes += fastMovingShape; + + isFastMoving = isFastMoving | fastMovingShape; + } + } + + bodySim.getLowLevelBody().getCore().isFastMoving = isFastMoving!=0; + } + + PxAtomicAdd(mNumFastMovingShapes, PxI32(activeShapes)); + } +}; + +//CCD +void Sc::Scene::ccdBroadPhaseAABB(PxBaseTask* continuation) +{ + PX_PROFILE_START_CROSSTHREAD("Sim.ccdBroadPhaseComplete", getContextId()); + PX_PROFILE_ZONE("Sim.ccdBroadPhaseAABB", getContextId()); + PX_UNUSED(continuation); + + PxU32 currentPass = mCCDContext->getCurrentCCDPass(); + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + mNumFastMovingShapes = 0; + + //If we are on the 1st pass or we had some sweep hits previous CCD pass, we need to run CCD again + if( currentPass == 0 || mCCDContext->getNumSweepHits()) + { + PxsTransformCache& transformCache = getLowLevelContext()->getTransformCache(); + for (PxU32 i = 0; i < mCcdBodies.size(); i+= UpdateCCDBoundsTask::MaxPerTask) + { + const PxU32 nbToProcess = PxMin(UpdateCCDBoundsTask::MaxPerTask, mCcdBodies.size() - i); + UpdateCCDBoundsTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(UpdateCCDBoundsTask)), UpdateCCDBoundsTask)(getContextId(), mBoundsArray, &transformCache, &mCcdBodies[i], nbToProcess, &mNumFastMovingShapes); + task->setContinuation(continuation); + task->removeReference(); + } + } +} + +//CCD +void Sc::Scene::ccdBroadPhase(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.ccdBroadPhase", getContextId()); + + PxU32 currentPass = mCCDContext->getCurrentCCDPass(); + const PxU32 ccdMaxPasses = mCCDContext->getCCDMaxPasses(); + mCCDPass = currentPass+1; + + //If we are on the 1st pass or we had some sweep hits previous CCD pass, we need to run CCD again + if( (currentPass == 0 || mCCDContext->getNumSweepHits()) && mNumFastMovingShapes != 0) + { + const PxU32 currIndex = currentPass & 1; + const PxU32 nextIndex = 1 - currIndex; + //Initialize the CCD task chain unless this is the final pass + if(currentPass != (ccdMaxPasses - 1)) + { + mCCDBroadPhase[nextIndex].setContinuation(continuation); + mCCDBroadPhaseAABB[nextIndex].setContinuation(&mCCDBroadPhase[nextIndex]); + } + mPostCCDPass[currIndex].setContinuation(currentPass == ccdMaxPasses-1 ? continuation : &mCCDBroadPhaseAABB[nextIndex]); + mUpdateCCDSinglePass3[currIndex].setContinuation(&mPostCCDPass[currIndex]); + mUpdateCCDSinglePass2[currIndex].setContinuation(&mUpdateCCDSinglePass3[currIndex]); + mUpdateCCDSinglePass[currIndex].setContinuation(&mUpdateCCDSinglePass2[currIndex]); + + //Do the actual broad phase + PxBaseTask* continuationTask = &mUpdateCCDSinglePass[currIndex]; +// const PxU32 numCpuTasks = continuationTask->getTaskManager()->getCpuDispatcher()->getWorkerCount(); + + mCCDBp = true; + + mBpSecondPass.setContinuation(continuationTask); + mBpFirstPass.setContinuation(&mBpSecondPass); + + mBpSecondPass.removeReference(); + mBpFirstPass.removeReference(); + + //mAABBManager->updateAABBsAndBP(numCpuTasks, mLLContext->getTaskPool(), &mLLContext->getScratchAllocator(), false, continuationTask, NULL); + + //Allow the CCD task chain to continue + mPostCCDPass[currIndex].removeReference(); + mUpdateCCDSinglePass3[currIndex].removeReference(); + mUpdateCCDSinglePass2[currIndex].removeReference(); + mUpdateCCDSinglePass[currIndex].removeReference(); + if(currentPass != (ccdMaxPasses - 1)) + { + mCCDBroadPhase[nextIndex].removeReference(); + mCCDBroadPhaseAABB[nextIndex].removeReference(); + } + } + else if (currentPass == 0) + { + PX_PROFILE_STOP_CROSSTHREAD("Sim.ccdBroadPhaseComplete", getContextId()); + mCCDContext->resetContactManagers(); + } +} + +//CCD +void Sc::Scene::updateCCDSinglePass(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateCCDSinglePass", getContextId()); + mReportShapePairTimeStamp++; // This will makes sure that new report pairs will get created instead of re-using the existing ones. + + mAABBManager->postBroadPhase(NULL, *getFlushPool()); + finishBroadPhase(continuation); + + const PxU32 currentPass = mCCDContext->getCurrentCCDPass() + 1; // 0 is reserved for discrete collision phase + if(currentPass == 1) // reset the handle map so we only update CCD objects from here on + { + PxBitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); + //changedAABBMgrActorHandles.clear(); + for(PxU32 i = 0; i < mCcdBodies.size();i++) + { + // PT: ### changedMap pattern #1 + PxU32 nbElems = mCcdBodies[i]->getNbElements(); + Sc::ElementSim** elems = mCcdBodies[i]->getElements(); + while (nbElems--) + { + Sc::ShapeSim* sim = static_cast(*elems++); + if (sim->getFlags()&PxU32(PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE)) // TODO: need trigger shape here? + changedAABBMgrActorHandles.growAndSet(sim->getElementID()); + } + } + } +} + +//CCD +void Sc::Scene::updateCCDSinglePassStage2(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateCCDSinglePassStage2", getContextId()); + postBroadPhaseStage2(continuation); +} + +//CCD +void Sc::Scene::updateCCDSinglePassStage3(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateCCDSinglePassStage3", getContextId()); + mReportShapePairTimeStamp++; // This will makes sure that new report pairs will get created instead of re-using the existing ones. + + const PxU32 currentPass = mCCDContext->getCurrentCCDPass() + 1; // 0 is reserved for discrete collision phase + finishBroadPhaseStage2(currentPass); + PX_PROFILE_STOP_CROSSTHREAD("Sim.ccdBroadPhaseComplete", getContextId()); + + //reset thread context in a place we know all tasks possibly accessing it, are in sync with. (see US6664) + mLLContext->resetThreadContexts(); + + mCCDContext->updateCCD(mDt, continuation, mSimpleIslandManager->getAccurateIslandSim(), (mPublicFlags & PxSceneFlag::eDISABLE_CCD_RESWEEP), mNumFastMovingShapes); +} + +class ScKinematicPoseUpdateTask : public Cm::Task +{ + Sc::BodyCore*const* mKinematics; + PxU32 mNbKinematics; + +public: + static const PxU32 NbKinematicsPerTask = 1024; + + ScKinematicPoseUpdateTask(Sc::BodyCore*const* kinematics, PxU32 nbKinematics, PxU64 contextID) : + Cm::Task(contextID), mKinematics(kinematics), mNbKinematics(nbKinematics) + { + } + + virtual void runInternal() + { + for (PxU32 a = 0; a < mNbKinematics; ++a) + { + if ((a + 16) < mNbKinematics) + { + PxPrefetchLine(static_cast(mKinematics[a + 16])); + + if ((a + 4) < mNbKinematics) + { + PxPrefetchLine(static_cast(mKinematics[a + 4])->getSim()); + PxPrefetchLine(static_cast(mKinematics[a + 4])->getSim()->getSimStateData_Unchecked()); + } + } + Sc::BodyCore* b = static_cast(mKinematics[a]); + PX_ASSERT(b->getSim()->isKinematic()); + PX_ASSERT(b->getSim()->isActive()); + b->getSim()->updateKinematicPose(); + } + } + + virtual const char* getName() const + { + return "ScScene.ScKinematicPoseUpdateTask"; + } +}; + +void Sc::Scene::integrateKinematicPose() +{ + PX_PROFILE_ZONE("Sim.integrateKinematicPose", getContextId()); + + const PxU32 nbKinematics = getActiveKinematicBodiesCount(); + BodyCore*const* kinematics = getActiveKinematicBodies(); + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + for(PxU32 i=0; isetContinuation(&mConstraintProjection); + task->removeReference(); + } +} + +class ScKinematicShapeUpdateTask : public Cm::Task +{ + Sc::BodyCore*const* mKinematics; + PxU32 mNbKinematics; + PxsTransformCache& mCache; + Bp::BoundsArray& mBoundsArray; + + PX_NOCOPY(ScKinematicShapeUpdateTask) + +public: + static const PxU32 NbKinematicsShapesPerTask = 1024; + + ScKinematicShapeUpdateTask(Sc::BodyCore*const* kinematics, PxU32 nbKinematics, PxsTransformCache& cache, Bp::BoundsArray& boundsArray, PxU64 contextID) : + Cm::Task(contextID), mKinematics(kinematics), mNbKinematics(nbKinematics), mCache(cache), mBoundsArray(boundsArray) + { + } + + virtual void runInternal() + { + for (PxU32 a = 0; a < mNbKinematics; ++a) + { + Sc::BodyCore* b = static_cast(mKinematics[a]); + PX_ASSERT(b->getSim()->isKinematic()); + PX_ASSERT(b->getSim()->isActive()); + + b->getSim()->updateCached(mCache, mBoundsArray); + } + } + + virtual const char* getName() const + { + return "ScScene.KinematicShapeUpdateTask"; + } +}; + +void Sc::Scene::updateKinematicCached(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateKinematicCached", getContextId()); + + const PxU32 nbKinematics = getActiveKinematicBodiesCount(); + BodyCore*const* kinematics = getActiveKinematicBodies(); + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + PxU32 startIndex = 0; + PxU32 nbShapes = 0; + + { + PX_PROFILE_ZONE("ShapeUpdate", getContextId()); + for(PxU32 i=0; i(kinematics[i])->getSim(); + PX_ASSERT(sim->isKinematic()); + PX_ASSERT(sim->isActive()); + + nbShapes += sim->getNbShapes(); + + if (nbShapes >= ScKinematicShapeUpdateTask::NbKinematicsShapesPerTask) + { + ScKinematicShapeUpdateTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScKinematicShapeUpdateTask)), ScKinematicShapeUpdateTask) + (kinematics + startIndex, (i + 1) - startIndex, mLLContext->getTransformCache(), *mBoundsArray, mContextId); + + task->setContinuation(continuation); + task->removeReference(); + startIndex = i + 1; + nbShapes = 0; + } + } + + if(nbShapes) + { + ScKinematicShapeUpdateTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScKinematicShapeUpdateTask)), ScKinematicShapeUpdateTask) + (kinematics + startIndex, nbKinematics - startIndex, mLLContext->getTransformCache(), *mBoundsArray, mContextId); + + task->setContinuation(continuation); + task->removeReference(); + } + } + + if(nbKinematics) + { + PxBitMapPinned& changedAABBMap = mAABBManager->getChangedAABBMgActorHandleMap(); + mLLContext->getTransformCache().setChangedState(); + mBoundsArray->setChangedState(); + for (PxU32 i = 0; i < nbKinematics; ++i) + { + Sc::BodySim* bodySim = static_cast(kinematics[i])->getSim(); + + if ((i+16) < nbKinematics) + { + PxPrefetchLine(kinematics[i + 16]); + if ((i + 8) < nbKinematics) + { + PxPrefetchLine(kinematics[i + 8]->getSim()); + } + } + + // PT: ### changedMap pattern #1 + PxU32 nbElems = bodySim->getNbElements(); + Sc::ElementSim** elems = bodySim->getElements(); + while (nbElems--) + { + Sc::ShapeSim* sim = static_cast(*elems++); + //KS - TODO - can we parallelize this? The problem with parallelizing is that it's a bit operation, + //so we would either need to use atomic operations or have some high-level concept that guarantees + //that threads don't write to the same word in the map simultaneously + if (sim->getFlags()&PxU32(PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE)) + { + changedAABBMap.set(sim->getElementID()); + } + } + + mSimulationController->updateDynamic(NULL, bodySim->getNodeIndex()); + } + } +} + +class ConstraintProjectionTask : public Cm::Task +{ +private: + PX_NOCOPY(ConstraintProjectionTask) + +public: + ConstraintProjectionTask(Sc::ConstraintGroupNode* const* projectionRoots, PxU32 projectionRootCount, PxArray& projectedBodies, PxsContext* llContext) : + Cm::Task (llContext->getContextId()), + mProjectionRoots (projectionRoots), + mProjectionRootCount(projectionRootCount), + mProjectedBodies (projectedBodies), + mLLContext (llContext) + { + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("ConstraintProjection", mContextID); + PxcNpThreadContext* context = mLLContext->getNpThreadContext(); + PxArray& tempArray = context->mBodySimPool; + tempArray.forceSize_Unsafe(0); + for(PxU32 i=0; i < mProjectionRootCount; i++) + { + PX_ASSERT(mProjectionRoots[i]->hasProjectionTreeRoot()); // else, it must not be in the projection root list + Sc::ConstraintGroupNode::projectPose(*mProjectionRoots[i], tempArray); + mProjectionRoots[i]->clearFlag(Sc::ConstraintGroupNode::eIN_PROJECTION_PASS_LIST); + } + + if (tempArray.size() > 0) + { + mLLContext->getLock().lock(); + for (PxU32 a = 0; a < tempArray.size(); ++a) + mProjectedBodies.pushBack(tempArray[a]); + mLLContext->getLock().unlock(); + } + + mLLContext->putNpThreadContext(context); + } + + virtual const char* getName() const + { + return "ScScene.constraintProjectionWork"; + } + +public: + static const PxU32 sProjectingConstraintsPerTask = 256; // just a guideline, will not match exactly most of the time + +private: + Sc::ConstraintGroupNode* const* mProjectionRoots; + const PxU32 mProjectionRootCount; + PxArray& mProjectedBodies; + PxsContext* mLLContext; +}; + +void Sc::Scene::constraintProjection(PxBaseTask* continuation) +{ + if(mConstraints.size() == 0) + return; + PxU32 constraintGroupRootCount = 0; + //BodyCore*const* activeBodies = getActiveBodiesArray(); + //PxU32 activeBodyCount = getNumActiveBodies(); + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + PxU32 activeBodyCount = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + const PxNodeIndex* activeNodeIds = islandSim.getActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + PX_ASSERT(!mTmpConstraintGroupRootBuffer); + PxU32 index = 0; + + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + if(activeBodyCount) + { + mTmpConstraintGroupRootBuffer = reinterpret_cast(mLLContext->getScratchAllocator().alloc(sizeof(ConstraintGroupNode*) * activeBodyCount, true)); + if(mTmpConstraintGroupRootBuffer) + { + while(activeBodyCount--) + { + PxsRigidBody* rBody = islandSim.getRigidBody(activeNodeIds[index++]); + + Sc::BodySim* sim = reinterpret_cast(reinterpret_cast(rBody) - rigidBodyOffset); + //This move to PxgPostSolveWorkerTask for the gpu dynamic + //bodySim->sleepCheck(mDt, mOneOverDt, mEnableStabilization); + + if(sim->getConstraintGroup()) + { + ConstraintGroupNode& root = sim->getConstraintGroup()->getRoot(); + if(!root.readFlag(ConstraintGroupNode::eIN_PROJECTION_PASS_LIST) && root.hasProjectionTreeRoot()) + { + mTmpConstraintGroupRootBuffer[constraintGroupRootCount++] = &root; + root.raiseFlag(ConstraintGroupNode::eIN_PROJECTION_PASS_LIST); + } + } + } + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + PxU32 constraintsToProjectCount = 0; + PxU32 startIndex = 0; + for(PxU32 i=0; i < constraintGroupRootCount; i++) + { + ConstraintGroupNode* root = mTmpConstraintGroupRootBuffer[i]; + + constraintsToProjectCount += root->getProjectionCountHint(); // for load balancing + if (constraintsToProjectCount >= ConstraintProjectionTask::sProjectingConstraintsPerTask) + { + ConstraintProjectionTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ConstraintProjectionTask)), + ConstraintProjectionTask(mTmpConstraintGroupRootBuffer + startIndex, i - startIndex + 1, mProjectedBodies, mLLContext)); + task->setContinuation(continuation); + task->removeReference(); + + constraintsToProjectCount = 0; + startIndex = i + 1; + } + } + + if (constraintsToProjectCount) + { + PX_ASSERT(startIndex < constraintGroupRootCount); + + ConstraintProjectionTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ConstraintProjectionTask)), + ConstraintProjectionTask(mTmpConstraintGroupRootBuffer + startIndex, constraintGroupRootCount - startIndex, mProjectedBodies, mLLContext)); + task->setContinuation(continuation); + task->removeReference(); + } + } + else + { + outputError(__LINE__, "List for collecting constraint projection roots could not be allocated. No projection will take place."); + } + } +} + +void Sc::Scene::postSolver(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::postSolver", getContextId()); + PxcNpMemBlockPool& blockPool = mLLContext->getNpMemBlockPool(); + + //Merge... + mDynamicsContext->mergeResults(); + blockPool.releaseConstraintMemory(); + //Swap friction! + blockPool.swapFrictionStreams(); + + mCcdBodies.clear(); + mProjectedBodies.clear(); + +#if PX_ENABLE_SIM_STATS + mLLContext->getSimStats().mPeakConstraintBlockAllocations = blockPool.getPeakConstraintBlockCount(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif + + mConstraintProjection.setContinuation(continuation); + + integrateKinematicPose(); + + mConstraintProjection.removeReference(); + + PxU32 size = mDirtyArticulationSims.size(); + Sc::ArticulationSim* const* articSims = mDirtyArticulationSims.getEntries(); + //clear the acceleration term for articulation if the application raised PxForceMode::eIMPULSE in addForce function. This change + //will make sure articulation and rigid body behave the same + for (PxU32 i = 0; i < size; ++i) + { + Sc::ArticulationSim* PX_RESTRICT articSim = articSims[i]; + articSim->clearAcceleration(mDt); + } + + //clear the dirty articulation list + mDirtyArticulationSims.clear(); + + //afterIntegration(continuation); +} + +//CCD +void Sc::Scene::postCCDPass(PxBaseTask* /*continuation*/) +{ + // - Performs sleep check + // - Updates touch flags + + PxU32 currentPass = mCCDContext->getCurrentCCDPass(); + PX_ASSERT(currentPass > 0); // to make sure changes to the CCD pass counting get noticed. For contact reports, 0 means discrete collision phase. + + int newTouchCount, lostTouchCount, ccdTouchCount; + mLLContext->getManagerTouchEventCount(&newTouchCount, &lostTouchCount, &ccdTouchCount); + PX_ALLOCA(newTouches, PxvContactManagerTouchEvent, newTouchCount); + PX_ALLOCA(lostTouches, PxvContactManagerTouchEvent, lostTouchCount); + PX_ALLOCA(ccdTouches, PxvContactManagerTouchEvent, ccdTouchCount); + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + // Note: For contact notifications it is important that the new touch pairs get processed before the lost touch pairs. + // This allows to know for sure if a pair of actors lost all touch (see eACTOR_PAIR_LOST_TOUCH). + mLLContext->fillManagerTouchEvents(newTouches, newTouchCount, lostTouches, lostTouchCount, ccdTouches, ccdTouchCount); + for(PxI32 i=0; imanagerNewTouch(*si); + si->managerNewTouch(currentPass, true, outputs); + if (!si->readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) + { + mSimpleIslandManager->setEdgeConnected(si->getEdgeIndex(), IG::Edge::eCONTACT_MANAGER); + } + } + for(PxI32 i=0; imanagerLostTouch(currentPass, true, outputs) && !si->readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) + addToLostTouchList(si->getShape0().getActor(), si->getShape1().getActor()); + + mSimpleIslandManager->setEdgeDisconnected(si->getEdgeIndex()); + } + for(PxI32 i=0; isendCCDRetouch(currentPass, outputs); + } + checkForceThresholdContactEvents(currentPass); + { + PxBitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); + + for (PxU32 i = 0, s = mCcdBodies.size(); i < s; i++) + { + BodySim*const body = mCcdBodies[i]; + if(i+8 < s) + PxPrefetch(mCcdBodies[i+8], 512); + + PX_ASSERT(body->getBody2World().p.isFinite()); + PX_ASSERT(body->getBody2World().q.isFinite()); + + body->updateCached(&changedAABBMgrActorHandles); + } + + ArticulationCore* const* articList = mArticulations.getEntries(); + for(PxU32 i=0;igetSim()->updateCached(&changedAABBMgrActorHandles); + } +} + +void Sc::Scene::finalizationPhase(PxBaseTask* /*continuation*/) +{ + PX_PROFILE_ZONE("Sim.sceneFinalization", getContextId()); + + if (mCCDContext) + { + //KS - force simulation controller to update any bodies updated by the CCD. When running GPU simulation, this would be required + //to ensure that cached body states are updated + const PxU32 nbUpdatedBodies = mCCDContext->getNumUpdatedBodies(); + PxsRigidBody*const* updatedBodies = mCCDContext->getUpdatedBodies(); + + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + for (PxU32 a = 0; a < nbUpdatedBodies; ++a) + { + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(updatedBodies[a]) - rigidBodyOffset); + updateBodySim(*bodySim); + } + + mCCDContext->clearUpdatedBodies(); + } + + if (mTmpConstraintGroupRootBuffer) + { + mLLContext->getScratchAllocator().free(mTmpConstraintGroupRootBuffer); + mTmpConstraintGroupRootBuffer = NULL; + } + + fireOnAdvanceCallback(); // placed here because it needs to be done after sleep check and after potential CCD passes + + checkConstraintBreakage(); // Performs breakage tests on breakable constraints + + PX_PROFILE_STOP_CROSSTHREAD("Basic.rigidBodySolver", getContextId()); + + mTaskPool.clear(); + + mReportShapePairTimeStamp++; // important to do this before fetchResults() is called to make sure that delayed deleted actors/shapes get + // separate pair entries in contact reports +} + +void Sc::Scene::postReportsCleanup() +{ + mElementIDPool->processPendingReleases(); + mElementIDPool->clearDeletedIDMap(); + + mActorIDTracker->processPendingReleases(); + mActorIDTracker->clearDeletedIDMap(); + + mConstraintIDTracker->processPendingReleases(); + mConstraintIDTracker->clearDeletedIDMap(); + + mSimulationController->flush(); +} + +PX_COMPILE_TIME_ASSERT(sizeof(PxTransform32)==sizeof(PxsCachedTransform)); + +// PT: TODO: move this out of Sc? this is only called by Np +void Sc::Scene::syncSceneQueryBounds(SqBoundsSync& sync, SqRefFinder& finder) +{ + const PxsTransformCache& cache = mLLContext->getTransformCache(); + + mSqBoundsManager->syncBounds(sync, finder, mBoundsArray->begin(), reinterpret_cast(cache.getTransforms()), getContextId(), mDirtyShapeSimMap); +} + +class ScKinematicUpdateTask : public Cm::Task +{ + Sc::BodyCore*const* mKinematics; + const PxU32 mNbKinematics; + const PxReal mOneOverDt; + + PX_NOCOPY(ScKinematicUpdateTask) +public: + + static const PxU32 NbKinematicsPerTask = 1024; + + ScKinematicUpdateTask(Sc::BodyCore*const* kinematics, PxU32 nbKinematics, PxReal oneOverDt, PxU64 contextID) : + Cm::Task(contextID), mKinematics(kinematics), mNbKinematics(nbKinematics), mOneOverDt(oneOverDt) + { + } + + virtual void runInternal() + { + Sc::BodyCore*const* kinematics = mKinematics; + PxU32 nb = mNbKinematics; + const float oneOverDt = mOneOverDt; + + while(nb--) + { + Sc::BodyCore* b = *kinematics++; + PX_ASSERT(b->getSim()->isKinematic()); + PX_ASSERT(b->getSim()->isActive()); + + b->getSim()->calculateKinematicVelocity(oneOverDt); + } + } + + virtual const char* getName() const + { + return "ScScene.KinematicUpdateTask"; + } +}; + +void Sc::Scene::kinematicsSetup(PxBaseTask* continuation) +{ + const PxU32 nbKinematics = getActiveKinematicBodiesCount(); + if(!nbKinematics) + return; + + BodyCore*const* kinematics = getActiveKinematicBodies(); + + // PT: create a copy of active bodies for the taks to operate on while the main array is + // potentially resized by operations running in parallel. + if(mActiveKinematicsCopyCapacitygetTaskPool(); + + // PT: TODO: better load balancing? This will be single threaded for less than 1K kinematics + for(PxU32 i = 0; i < nbKinematics; i += ScKinematicUpdateTask::NbKinematicsPerTask) + { + ScKinematicUpdateTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScKinematicUpdateTask)), ScKinematicUpdateTask) + (kinematics + i, PxMin(ScKinematicUpdateTask::NbKinematicsPerTask, nbKinematics - i), mOneOverDt, mContextId); + + task->setContinuation(continuation); + task->removeReference(); + } + + if((mPublicFlags & PxSceneFlag::eENABLE_GPU_DYNAMICS)) + { + // PT: running this serially for now because it's unsafe: mNPhaseCore->updateDirtyInteractions() (called after this) + // can also call mSimulationController.updateDynamic() via BodySim::internalWakeUpBase + PxU32 nb = nbKinematics; + while(nb--) + { + Sc::BodyCore* b = *kinematics++; + Sc::BodySim* bodySim = b->getSim(); + PX_ASSERT(!bodySim->getArticulation()); + mSimulationController->updateDynamic(NULL, bodySim->getNodeIndex()); + } + } +} + +//stepSetup is called in solve, but not collide +void Sc::Scene::stepSetupSolve(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.stepSetupSolve", getContextId()); + + kinematicsSetup(continuation); +} + +void Sc::Scene::stepSetupCollide(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.stepSetupCollide", getContextId()); + + { + PX_PROFILE_ZONE("Sim.projectionTreeUpdates", getContextId()); + mProjectionManager->processPendingUpdates(mLLContext->getScratchAllocator()); + } + + kinematicsSetup(continuation); + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + // Update all dirty interactions + mNPhaseCore->updateDirtyInteractions(outputs); + mInternalFlags &= ~(SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE | SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_VISUALIZATION); +} + +void Sc::Scene::processLostTouchPairs() +{ + PX_PROFILE_ZONE("Sc::Scene::processLostTouchPairs", getContextId()); + for (PxU32 i=0; iinternalWakeUp(); + if (!deletedBody2) + mLostTouchPairs[i].body2->internalWakeUp(); + continue; + } + + // If both are sleeping, we let them sleep + // (for example, two sleeping objects touch and the user teleports one (without waking it up)) + if (!mLostTouchPairs[i].body1->isActive() && + !mLostTouchPairs[i].body2->isActive()) + { + continue; + } + + // If only one has fallen asleep, we wake them both + if (!mLostTouchPairs[i].body1->isActive() || + !mLostTouchPairs[i].body2->isActive()) + { + mLostTouchPairs[i].body1->internalWakeUp(); + mLostTouchPairs[i].body2->internalWakeUp(); + } + } + + mLostTouchPairs.clear(); + mLostTouchPairsDeletedBodyIDs.clear(); +} + +class ScBeforeSolverTask : public Cm::Task +{ +public: + static const PxU32 MaxBodiesPerTask = 256; + PxNodeIndex mBodies[MaxBodiesPerTask]; + PxU32 mNumBodies; + const PxReal mDt; + IG::SimpleIslandManager* mIslandManager; + PxsSimulationController* mSimulationController; + +public: + + ScBeforeSolverTask(PxReal dt, IG::SimpleIslandManager* islandManager, PxsSimulationController* simulationController, PxU64 contextID) : + Cm::Task (contextID), + mDt (dt), + mIslandManager (islandManager), + mSimulationController (simulationController) + { + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("Sim.ScBeforeSolverTask", mContextID); + const IG::IslandSim& islandSim = mIslandManager->getAccurateIslandSim(); + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + PxsRigidBody* updatedBodySims[MaxBodiesPerTask]; + PxU32 updatedBodyNodeIndices[MaxBodiesPerTask]; + PxU32 nbUpdatedBodySims = 0; + + PxU32 nb = mNumBodies; + const PxNodeIndex* bodies = mBodies; + while(nb--) + { + const PxNodeIndex index = *bodies++; + + if(islandSim.getActiveNodeIndex(index) != PX_INVALID_NODE) + { + if (islandSim.getNode(index).mType == IG::Node::eRIGID_BODY_TYPE) + { + PxsRigidBody* body = islandSim.getRigidBody(index); + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(body) - rigidBodyOffset); + bodySim->updateForces(mDt, updatedBodySims, updatedBodyNodeIndices, nbUpdatedBodySims, NULL); + } + } + } + + if(nbUpdatedBodySims) + mSimulationController->updateBodies(updatedBodySims, updatedBodyNodeIndices, nbUpdatedBodySims); + } + + virtual const char* getName() const + { + return "ScScene.beforeSolver"; + } + +private: + PX_NOCOPY(ScBeforeSolverTask) +}; + +class ScArticBeforeSolverCCDTask : public Cm::Task +{ +public: + const PxNodeIndex* const mArticIndices; + const PxU32 mNumArticulations; + const PxReal mDt; + IG::SimpleIslandManager* mIslandManager; + +public: + + ScArticBeforeSolverCCDTask(const PxNodeIndex* const articIndices, PxU32 nbArtics, PxReal dt, IG::SimpleIslandManager* islandManager, PxU64 contextID) : + Cm::Task(contextID), + mArticIndices(articIndices), + mNumArticulations(nbArtics), + mDt(dt), + mIslandManager(islandManager) + { + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("Sim.ScArticBeforeSolverCCDTask", mContextID); + const IG::IslandSim& islandSim = mIslandManager->getAccurateIslandSim(); + + for (PxU32 a = 0; a < mNumArticulations; ++a) + { + Sc::ArticulationSim* articSim = islandSim.getArticulationSim(mArticIndices[a]); + + articSim->saveLastCCDTransform(); + } + } + + virtual const char* getName() const + { + return "ScScene.ScArticBeforeSolverCCDTask"; + } + +private: + PX_NOCOPY(ScArticBeforeSolverCCDTask) +}; + +class ScArticBeforeSolverTask : public Cm::Task +{ +public: + Sc::ArticulationSim* const* mArticSims; + const PxU32 mNumArticulations; + const PxReal mDt; + IG::SimpleIslandManager* mIslandManager; + +public: + + ScArticBeforeSolverTask(Sc::ArticulationSim* const* articSims, PxU32 nbArtics, PxReal dt, IG::SimpleIslandManager* islandManager, PxU64 contextID) : + Cm::Task(contextID), + mArticSims(articSims), + mNumArticulations(nbArtics), + mDt(dt), + mIslandManager(islandManager) + { + } + + virtual void runInternal() + { + PX_PROFILE_ZONE("Sim.ScArticBeforeSolverTask", mContextID); + //const IG::IslandSim& islandSim = mIslandManager->getAccurateIslandSim(); + + for (PxU32 a = 0; a < mNumArticulations; ++a) + { + Sc::ArticulationSim* PX_RESTRICT articSim = mArticSims[a]; + //articSim->checkResize(); + articSim->updateForces(mDt, false); + articSim->setDirtyFlag(Sc::ArticulationSimDirtyFlag::eNONE); + } + } + + virtual const char* getName() const + { + return "ScScene.ScArticBeforeSolverTask"; + } + +private: + PX_NOCOPY(ScArticBeforeSolverTask) +}; + +void Sc::Scene::beforeSolver(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sim.updateForces", getContextId()); + + // Note: For contact notifications it is important that force threshold checks are done after new/lost touches have been processed + // because pairs might get added to the list processed below + + // Atoms that passed contact force threshold + ThresholdStream& thresholdStream = mDynamicsContext->getThresholdStream(); + thresholdStream.clear(); + + const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + const PxU32 nbActiveBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE); + + mNumDeactivatingNodes[IG::Node::eRIGID_BODY_TYPE] = 0;//islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); + mNumDeactivatingNodes[IG::Node::eARTICULATION_TYPE] = 0;//islandSim.getNbNodesToDeactivate(IG::Node::eARTICULATION_TYPE); + mNumDeactivatingNodes[IG::Node::eSOFTBODY_TYPE] = 0; + mNumDeactivatingNodes[IG::Node::eFEMCLOTH_TYPE] = 0; + mNumDeactivatingNodes[IG::Node::ePARTICLESYSTEM_TYPE] = 0; + mNumDeactivatingNodes[IG::Node::eHAIRSYSTEM_TYPE] = 0; + + const PxU32 MaxBodiesPerTask = ScBeforeSolverTask::MaxBodiesPerTask; + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + mSimulationController->reserve(nbActiveBodies); + + { + PxBitMap::Iterator iter(mVelocityModifyMap); + + for (PxU32 i = iter.getNext(); i != PxBitMap::Iterator::DONE; /*i = iter.getNext()*/) + { + ScBeforeSolverTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScBeforeSolverTask)), ScBeforeSolverTask(mDt, mSimpleIslandManager, mSimulationController, getContextId())); + PxU32 count = 0; + for (; count < MaxBodiesPerTask && i != PxBitMap::Iterator::DONE; i = iter.getNext()) + { + PxsRigidBody* body = islandSim.getRigidBody(PxNodeIndex(i)); + bool retainsAccelerations = false; + if (body) + { + task->mBodies[count++] = PxNodeIndex(i); + + retainsAccelerations = (body->mCore->mFlags & PxRigidBodyFlag::eRETAIN_ACCELERATIONS); + } + + if(!retainsAccelerations) + { + mVelocityModifyMap.reset(i); + } + } + task->mNumBodies = count; + task->setContinuation(continuation); + task->removeReference(); + } + } + + const PxU32 nbArticsPerTask = 32; + + const PxU32 nbDirtyArticulations = mDirtyArticulationSims.size(); + Sc::ArticulationSim* const* artiSim = mDirtyArticulationSims.getEntries(); + for (PxU32 a = 0; a < nbDirtyArticulations; a += nbArticsPerTask) + { + const PxU32 nbToProcess = PxMin(PxU32(nbDirtyArticulations - a), nbArticsPerTask); + + ScArticBeforeSolverTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScArticBeforeSolverTask)), ScArticBeforeSolverTask(artiSim + a, nbToProcess, + mDt, mSimpleIslandManager, getContextId())); + + task->setContinuation(continuation); + task->removeReference(); + } + + //if the scene has ccd flag on, we should call ScArticBeforeSolverCCDTask to copy the last transform to the current transform + if (mPublicFlags & PxSceneFlag::eENABLE_CCD) + { + //CCD + const PxU32 nbActiveArticulations = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE); + const PxNodeIndex* const articIndices = islandSim.getActiveNodes(IG::Node::eARTICULATION_TYPE); + + for (PxU32 a = 0; a < nbActiveArticulations; a += nbArticsPerTask) + { + const PxU32 nbToProcess = PxMin(PxU32(nbActiveArticulations - a), nbArticsPerTask); + ScArticBeforeSolverCCDTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScArticBeforeSolverCCDTask)), ScArticBeforeSolverCCDTask(articIndices + a, nbToProcess, + mDt, mSimpleIslandManager, getContextId())); + + task->setContinuation(continuation); + task->removeReference(); + } + } + + for (PxU32 a = 0; a < nbDirtyArticulations; a++) + { + mSimulationController->updateArticulationExtAccel(artiSim[a]->getLowLevelArticulation(), artiSim[a]->getIslandNodeIndex()); + } + + mBodyGravityDirty = false; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +class UpdateProjectedPoseTask : public Cm::Task +{ + Sc::BodySim** mProjectedBodies; + const PxU32 mNbBodiesToProcess; + + PX_NOCOPY(UpdateProjectedPoseTask) +public: + + UpdateProjectedPoseTask(PxU64 contextID, Sc::BodySim** projectedBodies, PxU32 nbBodiesToProcess) : + Cm::Task (contextID), + mProjectedBodies (projectedBodies), + mNbBodiesToProcess (nbBodiesToProcess) + { + } + + virtual void runInternal() + { + for (PxU32 a = 0; a < mNbBodiesToProcess; ++a) + { + mProjectedBodies[a]->updateCached(NULL); + } + } + + virtual const char* getName() const + { + return "ScScene.UpdateProjectedPoseTask"; + } +}; + +void Sc::Scene::afterIntegration(PxBaseTask* continuation) +{ + PX_PROFILE_ZONE("Sc::Scene::afterIntegration", getContextId()); + mLLContext->getTransformCache().resetChangedState(); //Reset the changed state. If anything outside of the GPU kernels updates any shape's transforms, this will be raised again + getBoundsArray().resetChangedState(); + + PxsTransformCache& cache = getLowLevelContext()->getTransformCache(); + Bp::BoundsArray& boundArray = getBoundsArray(); + + { + PX_PROFILE_ZONE("AfterIntegration::lockStage", getContextId()); + mLLContext->getLock().lock(); + + { + PX_PROFILE_ZONE("SimController", getContextId()); + mSimulationController->updateScBodyAndShapeSim(cache, boundArray, continuation); + } + + const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); + + const PxU32 numBodiesToDeactivate = islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); + + const PxNodeIndex*const deactivatingIndices = islandSim.getNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); + + PxU32 previousNumBodiesToDeactivate = mNumDeactivatingNodes[IG::Node::eRIGID_BODY_TYPE]; + + { + PxBitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); + PX_PROFILE_ZONE("AfterIntegration::deactivateStage", getContextId()); + for (PxU32 i = previousNumBodiesToDeactivate; i < numBodiesToDeactivate; i++) + { + PxsRigidBody* rigid = islandSim.getRigidBody(deactivatingIndices[i]); + Sc::BodySim* bodySim = reinterpret_cast(reinterpret_cast(rigid) - rigidBodyOffset); + //we need to set the rigid body back to the previous pose for the deactivated objects. This emulates the previous behavior where island gen ran before the solver, ensuring + //that bodies that should be deactivated this frame never reach the solver. We now run the solver in parallel with island gen, so objects that should be deactivated this frame + //still reach the solver and are integrated. However, on the frame when they should be deactivated, we roll back to their state at the beginning of the frame to ensure that the + //user perceives the same behavior as before. + + PxsBodyCore& bodyCore = bodySim->getBodyCore().getCore(); + + //if(!islandSim.getNode(bodySim->getNodeIndex()).isActive()) + rigid->setPose(rigid->getLastCCDTransform()); + + bodySim->updateCached(&changedAABBMgrActorHandles); + updateBodySim(*bodySim); + + //solver is running in parallel with IG(so solver might solving the body which IG identify as deactivatedNodes). After we moved sleepCheck into the solver after integration, sleepChecks + //might have processed bodies that are now considered deactivated. This could have resulted in either freezing or unfreezing one of these bodies this frame, so we need to process those + //events to ensure that the SqManager's bounds arrays are consistently maintained. Also, we need to clear the frame flags for these bodies. + + if (rigid->isFreezeThisFrame()) + bodySim->freezeTransforms(&mAABBManager->getChangedAABBMgActorHandleMap()); + + //KS - the IG deactivates bodies in parallel with the solver. It appears that under certain circumstances, the solver's integration (which performs + //sleep checks) could decide that the body is no longer a candidate for sleeping on the same frame that the island gen decides to deactivate the island + //that the body is contained in. This is a rare occurrence but the behavior we want to emulate is that of IG running before solver so we should therefore + //permit the IG to make the authoritative decision over whether the body should be active or inactive. + bodyCore.wakeCounter = 0.0f; + bodyCore.linearVelocity = PxVec3(0.0f); + bodyCore.angularVelocity = PxVec3(0.0f); + + rigid->clearAllFrameFlags(); + } + } + + const PxU32 maxBodiesPerTask = 256; + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + { + PX_PROFILE_ZONE("AfterIntegration::dispatchTasks", getContextId()); + for (PxU32 a = 0; a < mProjectedBodies.size(); a += maxBodiesPerTask) + { + UpdateProjectedPoseTask* task = + PX_PLACEMENT_NEW(flushPool.allocate(sizeof(UpdateProjectedPoseTask)), UpdateProjectedPoseTask)(getContextId(), &mProjectedBodies[a], PxMin(maxBodiesPerTask, mProjectedBodies.size() - a)); + task->setContinuation(continuation); + task->removeReference(); + } + } + + { + PxBitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); + PX_PROFILE_ZONE("AfterIntegration::growAndSet", getContextId()); + for (PxU32 a = 0; a < mProjectedBodies.size(); ++a) + { + if (!mProjectedBodies[a]->isFrozen()) + { + // PT: ### changedMap pattern #1 + PxU32 nbElems = mProjectedBodies[a]->getNbElements(); + Sc::ElementSim** elems = mProjectedBodies[a]->getElements(); + while (nbElems--) + { + Sc::ShapeSim* sim = static_cast(*elems++); + if (sim->isInBroadPhase()) + changedAABBMgrActorHandles.growAndSet(sim->getElementID()); + } + } + } + } + { + PX_PROFILE_ZONE("AfterIntegration::managerAndDynamic", getContextId()); + const PxU32 unrollSize = 256; + for (PxU32 a = 0; a < mProjectedBodies.size(); a += unrollSize) + { + PxsRigidBody* tempBodies[unrollSize]; + PxU32 nodeIds[unrollSize]; + const PxU32 nbToProcess = PxMin(unrollSize, mProjectedBodies.size() - a); + for (PxU32 i = 0; i < nbToProcess; ++i) + { + tempBodies[i] = &mProjectedBodies[a + i]->getLowLevelBody(); + nodeIds[i] = mProjectedBodies[a + i]->getNodeIndex().index(); + } + //KS - it seems that grabbing the CUDA context/releasing it is expensive so we should minimize how + //frequently we do that. Batch processing like this helps + mSimulationController->updateBodies(tempBodies, nodeIds, nbToProcess); + } + } + + updateKinematicCached(continuation); + + mLLContext->getLock().unlock(); + } + + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + const PxU32 nbActiveArticulations = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE); + + if(nbActiveArticulations) + { + mSimulationController->updateArticulationAfterIntegration(mLLContext, mAABBManager, mCcdBodies, continuation, islandSim, mDt); + } + + const PxU32 numArticsToDeactivate = islandSim.getNbNodesToDeactivate(IG::Node::eARTICULATION_TYPE); + + const PxNodeIndex*const deactivatingArticIndices = islandSim.getNodesToDeactivate(IG::Node::eARTICULATION_TYPE); + + PxU32 previousNumArticsToDeactivate = mNumDeactivatingNodes[IG::Node::eARTICULATION_TYPE]; + + for (PxU32 i = previousNumArticsToDeactivate; i < numArticsToDeactivate; ++i) + { + Sc::ArticulationSim* artic = islandSim.getArticulationSim(deactivatingArticIndices[i]); + + artic->putToSleep(); + } + + //PxU32 previousNumClothToDeactivate = mNumDeactivatingNodes[IG::Node::eFEMCLOTH_TYPE]; + //const PxU32 numClothToDeactivate = islandSim.getNbNodesToDeactivate(IG::Node::eFEMCLOTH_TYPE); + //const IG::NodeIndex*const deactivatingClothIndices = islandSim.getNodesToDeactivate(IG::Node::eFEMCLOTH_TYPE); + + //for (PxU32 i = previousNumClothToDeactivate; i < numClothToDeactivate; ++i) + //{ + // FEMCloth* cloth = islandSim.getLLFEMCloth(deactivatingClothIndices[i]); + // mSimulationController->deactivateCloth(cloth); + //} + + //PxU32 previousNumSoftBodiesToDeactivate = mNumDeactivatingNodes[IG::Node::eSOFTBODY_TYPE]; + //const PxU32 numSoftBodiesToDeactivate = islandSim.getNbNodesToDeactivate(IG::Node::eSOFTBODY_TYPE); + //const IG::NodeIndex*const deactivatingSoftBodiesIndices = islandSim.getNodesToDeactivate(IG::Node::eSOFTBODY_TYPE); + + //for (PxU32 i = previousNumSoftBodiesToDeactivate; i < numSoftBodiesToDeactivate; ++i) + //{ + // Dy::SoftBody* softbody = islandSim.getLLSoftBody(deactivatingSoftBodiesIndices[i]); + // printf("after Integration: Deactivating soft body %i\n", softbody->getGpuRemapId()); + // //mSimulationController->deactivateSoftbody(softbody); + // softbody->getSoftBodySim()->setActive(false, 0); + //} + + PX_PROFILE_STOP_CROSSTHREAD("Basic.dynamics", getContextId()); + + checkForceThresholdContactEvents(0); +} + +void Sc::Scene::checkForceThresholdContactEvents(const PxU32 ccdPass) +{ + PX_PROFILE_ZONE("Sim.checkForceThresholdContactEvents", getContextId()); + + // Note: For contact notifications it is important that force threshold checks are done after new/lost touches have been processed + // because pairs might get added to the list processed below + + // Bodies that passed contact force threshold + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + ThresholdStream& thresholdStream = mDynamicsContext->getForceChangedThresholdStream(); + + const PxU32 nbThresholdElements = thresholdStream.size(); + + for (PxU32 i = 0; i< nbThresholdElements; ++i) + { + ThresholdStreamElement& elem = thresholdStream[i]; + ShapeInteraction* si = elem.shapeInteraction; + + //If there is a shapeInteraction and the shapeInteraction points to a contactManager (i.e. the CM was not destroyed in parallel with the solver) + if (si != NULL) + { + PxU32 pairFlags = si->getPairFlags(); + if (pairFlags & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS) + { + si->swapAndClearForceThresholdExceeded(); + + if (elem.accumulatedForce > elem.threshold * mDt) + { + si->raiseFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_NOW); + + PX_ASSERT(si->hasTouch()); + + //If the accumulatedForce is large than the threshold in the current frame and the accumulatedForce is less than the threshold in the previous frame, + //and the user request notify for found event, we will raise eNOTIFY_THRESHOLD_FORCE_FOUND + if ((!si->readFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_BEFORE)) && (pairFlags & PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND)) + { + si->processUserNotification(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND, 0, false, ccdPass, false, outputs); + } + else if (si->readFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_BEFORE) && (pairFlags & PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS)) + { + si->processUserNotification(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS, 0, false, ccdPass, false, outputs); + } + } + else + { + //If the accumulatedForce is less than the threshold in the current frame and the accumulatedForce is large than the threshold in the previous frame, + //and the user request notify for found event, we will raise eNOTIFY_THRESHOLD_FORCE_LOST + if (si->readFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_BEFORE) && (pairFlags & PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST)) + { + si->processUserNotification(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST, 0, false, ccdPass, false, outputs); + } + } + } + } + } +} + +void Sc::Scene::endStep() +{ + mTimeStamp++; +// INVALID_SLEEP_COUNTER is 0xffffffff. Therefore the last bit is masked. Look at Body::isForcedToSleep() for example. +// if(timeStamp==PX_INVALID_U32) timeStamp = 0; // Reserve INVALID_ID for something else + mTimeStamp &= 0x7fffffff; + + mReportShapePairTimeStamp++; // to make sure that deleted shapes/actors after fetchResults() create new report pairs +} + +void Sc::Scene::resizeReleasedBodyIDMaps(PxU32 maxActors, PxU32 numActors) +{ + mLostTouchPairsDeletedBodyIDs.resize(maxActors); + mActorIDTracker->resizeDeletedIDMap(maxActors,numActors); + mElementIDPool->resizeDeletedIDMap(maxActors,numActors); +} + +/** +Render objects before simulation starts +*/ +void Sc::Scene::visualizeStartStep() +{ + PX_PROFILE_ZONE("Sim.visualizeStartStep", getContextId()); + +#if PX_ENABLE_DEBUG_VISUALIZATION + if(!getVisualizationScale()) + { + // make sure visualization inside simulate was skipped + PX_ASSERT(getRenderBuffer().empty()); + return; // early out if visualization scale is 0 + } + + PxRenderOutput out(getRenderBuffer()); + + if(getVisualizationParameter(PxVisualizationParameter::eCOLLISION_COMPOUNDS)) + mAABBManager->visualize(out); + + // Visualize joints + Sc::ConstraintCore*const * constraints = mConstraints.getEntries(); + for(PxU32 i=0, size = mConstraints.size();igetSim()->visualize(getRenderBuffer()); + + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + mNPhaseCore->visualize(out, outputs); +#else + PX_CATCH_UNDEFINED_ENABLE_DEBUG_VISUALIZATION +#endif +} + +//CCD +void Sc::Scene::collectPostSolverVelocitiesBeforeCCD() +{ + if (mContactReportsNeedPostSolverVelocity) + { + ActorPairReport*const* actorPairs = mNPhaseCore->getContactReportActorPairs(); + PxU32 nbActorPairs = mNPhaseCore->getNbContactReportActorPairs(); + for(PxU32 i=0; i < nbActorPairs; i++) + { + if (i < (nbActorPairs - 1)) + PxPrefetchLine(actorPairs[i+1]); + + ActorPairReport* aPair = actorPairs[i]; + + ContactStreamManager& cs = aPair->getContactStreamManager(); + + PxU32 streamManagerFlag = cs.getFlags(); + if(streamManagerFlag & ContactStreamManagerFlag::eINVALID_STREAM) + continue; + + PxU8* stream = mNPhaseCore->getContactReportPairData(cs.bufferIndex); + + if(i + 1 < nbActorPairs) + PxPrefetch(&(actorPairs[i+1]->getContactStreamManager())); + + if (!cs.extraDataSize) + continue; + else if (streamManagerFlag & ContactStreamManagerFlag::eNEEDS_POST_SOLVER_VELOCITY) + cs.setContactReportPostSolverVelocity(stream, aPair->getActorA(), aPair->getActorB()); + } + } +} + +void Sc::Scene::finalizeContactStreamAndCreateHeader(PxContactPairHeader& header, const ActorPairReport& aPair, ContactStreamManager& cs, PxU32 removedShapeTestMask) +{ + PxU8* stream = mNPhaseCore->getContactReportPairData(cs.bufferIndex); + PxU32 streamManagerFlag = cs.getFlags(); + ContactShapePair* contactPairs = cs.getShapePairs(stream); + const PxU16 nbShapePairs = cs.currentPairCount; + PX_ASSERT(nbShapePairs > 0); + + if (streamManagerFlag & removedShapeTestMask) + { + // At least one shape of this actor pair has been deleted. Need to traverse the contact buffer, + // find the pairs which contain deleted shapes and set the flags accordingly. + + ContactStreamManager::convertDeletedShapesInContactStream(contactPairs, nbShapePairs, getElementIDPool()); + } + PX_ASSERT(contactPairs); + + ObjectIDTracker& ActorIDTracker = getActorIDTracker(); + header.actors[0] = aPair.getPxActorA(); + header.actors[1] = aPair.getPxActorB(); + PxU16 headerFlags = 0; + if (ActorIDTracker.isDeletedID(aPair.getActorAID())) + headerFlags |= PxContactPairHeaderFlag::eREMOVED_ACTOR_0; + if (ActorIDTracker.isDeletedID(aPair.getActorBID())) + headerFlags |= PxContactPairHeaderFlag::eREMOVED_ACTOR_1; + header.flags = PxContactPairHeaderFlags(headerFlags); + header.pairs = reinterpret_cast(contactPairs); + header.nbPairs = nbShapePairs; + + PxU16 extraDataSize = cs.extraDataSize; + if (!extraDataSize) + header.extraDataStream = NULL; + else + { + PX_ASSERT(extraDataSize >= sizeof(ContactStreamHeader)); + extraDataSize -= sizeof(ContactStreamHeader); + header.extraDataStream = stream + sizeof(ContactStreamHeader); + + if (streamManagerFlag & ContactStreamManagerFlag::eNEEDS_POST_SOLVER_VELOCITY) + { + PX_ASSERT(!(headerFlags & PxTo16(PxContactPairHeaderFlag::eREMOVED_ACTOR_0 | PxContactPairHeaderFlag::eREMOVED_ACTOR_1))); + cs.setContactReportPostSolverVelocity(stream, aPair.getActorA(), aPair.getActorB()); + } + } + header.extraDataStreamSize = extraDataSize; +} + +const PxArray& Sc::Scene::getQueuedContactPairHeaders() +{ + const PxU32 removedShapeTestMask = PxU32(ContactStreamManagerFlag::eTEST_FOR_REMOVED_SHAPES); + + ActorPairReport*const* actorPairs = mNPhaseCore->getContactReportActorPairs(); + PxU32 nbActorPairs = mNPhaseCore->getNbContactReportActorPairs(); + mQueuedContactPairHeaders.reserve(nbActorPairs); + mQueuedContactPairHeaders.clear(); + + for (PxU32 i = 0; i < nbActorPairs; i++) + { + if (i < (nbActorPairs - 1)) + PxPrefetchLine(actorPairs[i + 1]); + + ActorPairReport* aPair = actorPairs[i]; + ContactStreamManager& cs = aPair->getContactStreamManager(); + if (cs.getFlags() & ContactStreamManagerFlag::eINVALID_STREAM) + continue; + + if (i + 1 < nbActorPairs) + PxPrefetch(&(actorPairs[i + 1]->getContactStreamManager())); + + PxContactPairHeader &pairHeader = mQueuedContactPairHeaders.insert(); + finalizeContactStreamAndCreateHeader(pairHeader, *aPair, cs, removedShapeTestMask); + + cs.maxPairCount = cs.currentPairCount; + cs.setMaxExtraDataSize(cs.extraDataSize); + } + + return mQueuedContactPairHeaders; +} + +/* +Threading: called in the context of the user thread, but only after the physics thread has finished its run +*/ +void Sc::Scene::fireQueuedContactCallbacks() +{ + if(mSimulationEventCallback) + { + const PxU32 removedShapeTestMask = PxU32(ContactStreamManagerFlag::eTEST_FOR_REMOVED_SHAPES); + + ActorPairReport*const* actorPairs = mNPhaseCore->getContactReportActorPairs(); + PxU32 nbActorPairs = mNPhaseCore->getNbContactReportActorPairs(); + for(PxU32 i=0; i < nbActorPairs; i++) + { + if (i < (nbActorPairs - 1)) + PxPrefetchLine(actorPairs[i+1]); + + ActorPairReport* aPair = actorPairs[i]; + ContactStreamManager* cs = &aPair->getContactStreamManager(); + if (cs == NULL || cs->getFlags() & ContactStreamManagerFlag::eINVALID_STREAM) + continue; + + if (i + 1 < nbActorPairs) + PxPrefetch(&(actorPairs[i+1]->getContactStreamManager())); + + PxContactPairHeader pairHeader; + finalizeContactStreamAndCreateHeader(pairHeader, *aPair, *cs, removedShapeTestMask); + + mSimulationEventCallback->onContact(pairHeader, pairHeader.pairs, pairHeader.nbPairs); + + // estimates for next frame + cs->maxPairCount = cs->currentPairCount; + cs->setMaxExtraDataSize(cs->extraDataSize); + } + } +} + +PX_FORCE_INLINE void markDeletedShapes(Sc::ObjectIDTracker& idTracker, Sc::TriggerPairExtraData& tped, PxTriggerPair& pair) +{ + PxTriggerPairFlags::InternalType flags = 0; + if (idTracker.isDeletedID(tped.shape0ID)) + flags |= PxTriggerPairFlag::eREMOVED_SHAPE_TRIGGER; + if (idTracker.isDeletedID(tped.shape1ID)) + flags |= PxTriggerPairFlag::eREMOVED_SHAPE_OTHER; + + pair.flags = PxTriggerPairFlags(flags); +} + +void Sc::Scene::fireTriggerCallbacks() +{ + // triggers + const PxU32 nbTriggerPairs = mTriggerBufferAPI.size(); + PX_ASSERT(nbTriggerPairs == mTriggerBufferExtraData->size()); + if(nbTriggerPairs) + { + // cases to take into account: + // - no simulation/trigger shape has been removed -> no need to test shape references for removed shapes + // - simulation/trigger shapes have been removed -> test the events that have + // a marker for removed shapes set + // + const bool hasRemovedShapes = mElementIDPool->getDeletedIDCount() > 0; + + if(mSimulationEventCallback) + { + if (!hasRemovedShapes) + mSimulationEventCallback->onTrigger(mTriggerBufferAPI.begin(), nbTriggerPairs); + else + { + for(PxU32 i = 0; i < nbTriggerPairs; i++) + { + PxTriggerPair& triggerPair = mTriggerBufferAPI[i]; + + if ((PxTriggerPairFlags::InternalType(triggerPair.flags) & TriggerPairFlag::eTEST_FOR_REMOVED_SHAPES)) + markDeletedShapes(*mElementIDPool, (*mTriggerBufferExtraData)[i], triggerPair); + } + + mSimulationEventCallback->onTrigger(mTriggerBufferAPI.begin(), nbTriggerPairs); + } + } + } + + // PT: clear the buffer **even when there's no simulationEventCallback**. + mTriggerBufferAPI.clear(); + mTriggerBufferExtraData->clear(); +} + +void Sc::Scene::fireBrokenConstraintCallbacks() +{ + if(!mSimulationEventCallback) + return; + + const PxU32 count = mBrokenConstraints.size(); + for(PxU32 i=0;igetSim()); + + PxU32 typeID = 0xffffffff; + void* externalRef = c->getPxConnector()->getExternalReference(typeID); + PX_CHECK_MSG(typeID != 0xffffffff, "onConstraintBreak: Invalid constraint type ID."); + + PxConstraintInfo constraintInfo(c->getPxConstraint(), externalRef, typeID); + mSimulationEventCallback->onConstraintBreak(&constraintInfo, 1); + } +} + +/* +Threading: called in the context of the user thread, but only after the physics thread has finished its run +*/ +void Sc::Scene::fireCallbacksPostSync() +{ + // + // Fire sleep & woken callbacks + // + + // A body should be either in the sleep or the woken list. If it is in both, remove it from the list it was + // least recently added to. + + if(!mSleepBodyListValid) + cleanUpSleepBodies(); + + if(!mWokeBodyListValid) + cleanUpWokenBodies(); + +#if PX_SUPPORT_GPU_PHYSX + if (!mSleepSoftBodyListValid) + cleanUpSleepSoftBodies(); + + if (!mWokeBodyListValid) + cleanUpWokenSoftBodies(); + + if (!mSleepHairSystemListValid) + cleanUpSleepHairSystems(); + + if (!mWokeHairSystemListValid) // TODO(jcarius) should this be mWokeBodyListValid? + cleanUpWokenHairSystems(); +#endif + + if(mSimulationEventCallback || mOnSleepingStateChanged) + { + // allocate temporary data + const PxU32 nbSleep = mSleepBodies.size(); + const PxU32 nbWoken = mWokeBodies.size(); +#if PX_SUPPORT_GPU_PHYSX + const PxU32 nbHairSystemSleep = mSleepHairSystems.size(); + const PxU32 nbHairSystemWoken = mWokeHairSystems.size(); + const PxU32 nbSoftBodySleep = mSleepSoftBodies.size(); + const PxU32 nbSoftBodyWoken = mWokeSoftBodies.size(); + const PxU32 arrSize = PxMax(PxMax(nbSleep, nbWoken), PxMax(nbSoftBodySleep, nbHairSystemSleep)); +#else + const PxU32 arrSize = PxMax(nbSleep, nbWoken); +#endif + PxActor** actors = arrSize ? reinterpret_cast(PX_ALLOC(arrSize*sizeof(PxActor*), "PxActor*")) : NULL; + if(actors) + { + if(nbSleep) + { + PxU32 destSlot = 0; + BodyCore* const* sleepingBodies = mSleepBodies.getEntries(); + for(PxU32 i=0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), true); + } + + if(destSlot && mSimulationEventCallback) + mSimulationEventCallback->onSleep(actors, destSlot); + + //if (PX_DBG_IS_CONNECTED()) + //{ + // for (PxU32 i = 0; i < nbSleep; ++i) + // { + // BodyCore* body = mSleepBodies[i]; + // PX_ASSERT(body->getActorType() == PxActorType::eRIGID_DYNAMIC); + // } + //} + } + +#if PX_SUPPORT_GPU_PHYSX + //ML: need to create and API for the onSleep for softbody + if (nbSoftBodySleep) + { + PxU32 destSlot = 0; + SoftBodyCore* const* sleepingSoftBodies = mSleepSoftBodies.getEntries(); + for (PxU32 i = 0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), true); + } + + if (destSlot && mSimulationEventCallback) + mSimulationEventCallback->onSleep(actors, destSlot); + } + + if (nbHairSystemSleep) + { + PxU32 destSlot = 0; + HairSystemCore* const* sleepingHairSystems = mSleepHairSystems.getEntries(); + for (PxU32 i = 0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), true); + } + + if (destSlot && mSimulationEventCallback) + mSimulationEventCallback->onSleep(actors, destSlot); + } +#endif + + // do the same thing for bodies that have just woken up + + if(nbWoken) + { + PxU32 destSlot = 0; + BodyCore* const* wokenBodies = mWokeBodies.getEntries(); + for(PxU32 i=0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), false); + } + + if(destSlot && mSimulationEventCallback) + mSimulationEventCallback->onWake(actors, destSlot); + } + +#if PX_SUPPORT_GPU_PHYSX + //ML: need to create an API for woken soft body + if (nbSoftBodyWoken) + { + PxU32 destSlot = 0; + SoftBodyCore* const* wokenSoftBodies = mWokeSoftBodies.getEntries(); + for (PxU32 i = 0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), false); + } + + if (destSlot && mSimulationEventCallback) + mSimulationEventCallback->onWake(actors, destSlot); + } + + if (nbHairSystemWoken) + { + PxU32 destSlot = 0; + HairSystemCore* const* wokenHairSystems = mWokeHairSystems.getEntries(); + for (PxU32 i = 0; igetActorFlags() & PxActorFlag::eSEND_SLEEP_NOTIFIES) + actors[destSlot++] = body->getPxActor(); + if (mOnSleepingStateChanged) + mOnSleepingStateChanged(body->getPxActor(), false); + } + + if (destSlot && mSimulationEventCallback) + mSimulationEventCallback->onWake(actors, destSlot); + } +#endif + PX_FREE(actors); + } + } + + clearSleepWakeBodies(); +} + +void Sc::Scene::prepareOutOfBoundsCallbacks() +{ + PxU32 nbOut0; + void** outObjects = mAABBManager->getOutOfBoundsObjects(nbOut0); + + mOutOfBoundsIDs.clear(); + for(PxU32 i=0;i(outObjects[i]); + + Sc::ShapeSim* sim = static_cast(volume); + PxU32 id = sim->getElementID(); + mOutOfBoundsIDs.pushBack(id); + } +} + +bool Sc::Scene::fireOutOfBoundsCallbacks() +{ + bool outputWarning = false; + + // Actors + { + PxU32 nbOut0; + void** outObjects = mAABBManager->getOutOfBoundsObjects(nbOut0); + + const ObjectIDTracker& tracker = getElementIDPool(); + + PxBroadPhaseCallback* cb = mBroadPhaseCallback; + for(PxU32 i=0;i(outObjects[i]); + + Sc::ShapeSim* sim = static_cast(volume); + if(tracker.isDeletedID(mOutOfBoundsIDs[i])) + continue; + + if(cb) + { + ActorSim& actor = volume->getActor(); + RigidSim& rigidSim = static_cast(actor); + PxActor* pxActor = rigidSim.getPxActor(); + PxShape* px = sim->getPxShape(); + cb->onObjectOutOfBounds(*px, *pxActor); + } + else + { + outputWarning = true; + } + } + mAABBManager->clearOutOfBoundsObjects(); + } + + return outputWarning; +} + +void Sc::Scene::fireOnAdvanceCallback() +{ + if(!mSimulationEventCallback) + return; + + const PxU32 nbPosePreviews = mPosePreviewBodies.size(); + if(!nbPosePreviews) + return; + + mClientPosePreviewBodies.clear(); + mClientPosePreviewBodies.reserve(nbPosePreviews); + + mClientPosePreviewBuffer.clear(); + mClientPosePreviewBuffer.reserve(nbPosePreviews); + + const BodySim*const* PX_RESTRICT posePreviewBodies = mPosePreviewBodies.getEntries(); + for(PxU32 i=0; i(b.getPxActor())); + mClientPosePreviewBuffer.pushBack(c.body2World * c.getBody2Actor().getInverse()); + } + } + + const PxU32 bodyCount = mClientPosePreviewBodies.size(); + if(bodyCount) + mSimulationEventCallback->onAdvance(mClientPosePreviewBodies.begin(), mClientPosePreviewBuffer.begin(), bodyCount); +} + +void Sc::Scene::postCallbacksPreSync() +{ + PX_PROFILE_ZONE("Sim.postCallbackPreSync", mContextId); + // clear contact stream data + mNPhaseCore->clearContactReportStream(); + mNPhaseCore->clearContactReportActorPairs(false); + + // Put/prepare kinematics to/for sleep and invalidate target pose + // note: this needs to get done after the contact callbacks because + // the target might get read there. + // + PxU32 nbKinematics = getActiveKinematicBodiesCount(); + BodyCore*const* kinematics = getActiveKinematicBodies(); + + //KS - this method must run over the kinematic actors in reverse. + while(nbKinematics--) + { + if(nbKinematics > 16) + { + PxPrefetchLine(static_cast(kinematics[nbKinematics-16])); + } + if (nbKinematics > 4) + { + PxPrefetchLine((static_cast(kinematics[nbKinematics - 4]))->getSim()); + PxPrefetchLine((static_cast(kinematics[nbKinematics - 4]))->getSim()->getSimStateData_Unchecked()); + } + + BodyCore* b = static_cast(kinematics[nbKinematics]); + //kinematics++; + PX_ASSERT(b->getSim()->isKinematic()); + PX_ASSERT(b->getSim()->isActive()); + + b->invalidateKinematicTarget(); + b->getSim()->deactivateKinematic(); + } + + releaseConstraints(true); //release constraint blocks at the end of the frame, so user can retrieve the blocks +} + +void Sc::Scene::setNbContactDataBlocks(PxU32 numBlocks) +{ + mLLContext->getNpMemBlockPool().setBlockCount(numBlocks); +} + +PxU32 Sc::Scene::getNbContactDataBlocksUsed() const +{ + return mLLContext->getNpMemBlockPool().getUsedBlockCount(); +} + +PxU32 Sc::Scene::getMaxNbContactDataBlocksUsed() const +{ + return mLLContext->getNpMemBlockPool().getMaxUsedBlockCount(); +} + +PxU32 Sc::Scene::getMaxNbConstraintDataBlocksUsed() const +{ + return mLLContext->getNpMemBlockPool().getPeakConstraintBlockCount(); +} + +void Sc::Scene::setScratchBlock(void* addr, PxU32 size) +{ + return mLLContext->setScratchBlock(addr, size); +} + +void Sc::Scene::checkConstraintBreakage() +{ + PX_PROFILE_ZONE("Sim.checkConstraintBreakage", getContextId()); + + PxU32 count = mActiveBreakableConstraints.size(); + ConstraintSim* const* constraints = mActiveBreakableConstraints.getEntries(); + while(count) + { + count--; + constraints[count]->checkMaxForceExceeded(); // start from the back because broken constraints get removed from the list + } +} + +void Sc::Scene::getStats(PxSimulationStatistics& s) const +{ + mStats->readOut(s, mLLContext->getSimStats()); + s.nbStaticBodies = mNbRigidStatics; + s.nbDynamicBodies = mNbRigidDynamics; + s.nbKinematicBodies = mNbRigidKinematic; + s.nbArticulations = mArticulations.size(); + + s.nbAggregates = mAABBManager->getNbActiveAggregates(); + for(PxU32 i=0; igetDeviceMemorySize(); + + const PxsHeapStats& deviceHeapStats = mHeapMemoryAllocationManager->getDeviceHeapStats(); + s.gpuMemHeapBroadPhase = deviceHeapStats.stats[PxsHeapStats::eBROADPHASE]; + s.gpuMemHeapNarrowPhase = deviceHeapStats.stats[PxsHeapStats::eNARROWPHASE]; + s.gpuMemHeapSolver = deviceHeapStats.stats[PxsHeapStats::eSOLVER]; + s.gpuMemHeapArticulation = deviceHeapStats.stats[PxsHeapStats::eARTICULATION]; + s.gpuMemHeapSimulation = deviceHeapStats.stats[PxsHeapStats::eSIMULATION]; + s.gpuMemHeapSimulationArticulation = deviceHeapStats.stats[PxsHeapStats::eSIMULATION_ARTICULATION]; + s.gpuMemHeapSimulationParticles = deviceHeapStats.stats[PxsHeapStats::eSIMULATION_PARTICLES]; + s.gpuMemHeapSimulationSoftBody = deviceHeapStats.stats[PxsHeapStats::eSIMULATION_SOFTBODY]; + s.gpuMemHeapSimulationFEMCloth = deviceHeapStats.stats[PxsHeapStats::eSIMULATION_FEMCLOTH]; + s.gpuMemHeapSimulationHairSystem = deviceHeapStats.stats[PxsHeapStats::eSIMULATION_HAIRSYSTEM]; + s.gpuMemHeapParticles = deviceHeapStats.stats[PxsHeapStats::eSHARED_PARTICLES]; + s.gpuMemHeapFEMCloths = deviceHeapStats.stats[PxsHeapStats::eSHARED_FEMCLOTH]; + s.gpuMemHeapSoftBodies = deviceHeapStats.stats[PxsHeapStats::eSHARED_SOFTBODY]; + s.gpuMemHeapHairSystems = deviceHeapStats.stats[PxsHeapStats::eSHARED_HAIRSYSTEM]; + s.gpuMemHeapOther = deviceHeapStats.stats[PxsHeapStats::eOTHER]; + } + else +#endif + { + s.gpuMemHeap = 0; + s.gpuMemParticles = 0; + s.gpuMemSoftBodies = 0; + s.gpuMemFEMCloths = 0; + s.gpuMemHairSystems = 0; + s.gpuMemHeapBroadPhase = 0; + s.gpuMemHeapNarrowPhase = 0; + s.gpuMemHeapSolver = 0; + s.gpuMemHeapArticulation = 0; + s.gpuMemHeapSimulation = 0; + s.gpuMemHeapSimulationArticulation = 0; + s.gpuMemHeapSimulationParticles = 0; + s.gpuMemHeapSimulationSoftBody = 0; + s.gpuMemHeapSimulationFEMCloth = 0; + s.gpuMemHeapSimulationHairSystem = 0; + s.gpuMemHeapParticles = 0; + s.gpuMemHeapSoftBodies = 0; + s.gpuMemHeapFEMCloths = 0; + s.gpuMemHeapHairSystems = 0; + s.gpuMemHeapOther = 0; + } +} + +void Sc::Scene::addShapes(NpShape *const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& bodySim, PxBounds3* outBounds) +{ + const PxNodeIndex nodeIndex = bodySim.getNodeIndex(); + + PxvNphaseImplementationContext* context = mLLContext->getNphaseImplementationContext(); + + for(PxU32 i=0;i(size_t(shapes[i])+ptrOffset); + + //PxBounds3* target = uninflatedBounds ? uninflatedBounds + i : uninflatedBounds; + //mShapeSimPool->construct(sim, sc, llBody, target); + + ShapeSim* shapeSim = mShapeSimPool->construct(bodySim, sc); + mNbGeometries[sc.getGeometryType()]++; + + mSimulationController->addShape(&shapeSim->getLLShapeSim(), shapeSim->getElementID()); + + if (outBounds) + outBounds[i] = mBoundsArray->getBounds(shapeSim->getElementID()); + + //I register the shape if its either not an articulation link or if the nodeIndex has already been + //assigned. On insertion, the articulation will not have this nodeIndex correctly assigned at this stage + if (bodySim.getActorType() != PxActorType::eARTICULATION_LINK || !nodeIndex.isStaticBody()) + context->registerShape(nodeIndex, sc.getCore(), shapeSim->getElementID(), bodySim.getPxActor()); + } +} + +void Sc::Scene::removeShapes(Sc::RigidSim& sim, PxInlineArray& shapesBuffer , PxInlineArray& removedShapes, bool wakeOnLostTouch) +{ + PxU32 nbElems = sim.getNbElements(); + Sc::ElementSim** elems = sim.getElements(); + while (nbElems--) + { + Sc::ShapeSim* s = static_cast(*elems++); + // can do two 2x the allocs in the worst case, but actors with >64 shapes are not common + shapesBuffer.pushBack(s); + removedShapes.pushBack(&s->getCore()); + } + + for(PxU32 i=0;iconstruct(*this, ro); + + mNbRigidStatics++; + addShapes(shapes, nbShapes, shapePtrOffset, *sim, uninflatedBounds); +} + +void Sc::Scene::removeStatic(StaticCore& ro, PxInlineArray& removedShapes, bool wakeOnLostTouch) +{ + PX_ASSERT(ro.getActorCoreType() == PxActorType::eRIGID_STATIC); + + StaticSim* sim = ro.getSim(); + if(sim) + { + if(mBatchRemoveState) + { + removeShapes(*sim, mBatchRemoveState->bufferedShapes ,removedShapes, wakeOnLostTouch); + } + else + { + PxInlineArray shapesBuffer; + removeShapes(*sim, shapesBuffer ,removedShapes, wakeOnLostTouch); + } + mStaticSimPool->destroy(static_cast(ro.getSim())); + mNbRigidStatics--; + } +} + +void Sc::Scene::setDynamicsDirty() +{ + mDynamicsContext->setStateDirty(true); +} + +void Sc::Scene::addBody(BodyCore& body, NpShape*const *shapes, PxU32 nbShapes, size_t shapePtrOffset, PxBounds3* outBounds, bool compound) +{ + // sim objects do all the necessary work of adding themselves to broad phase, + // activation, registering with the interaction system, etc + + BodySim* sim = mBodySimPool->construct(*this, body, compound); + + const bool isArticulationLink = sim->isArticulationLink(); + + if (sim->getLowLevelBody().mCore->mFlags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD && sim->isActive()) + { + if (isArticulationLink) + { + if (sim->getNodeIndex().isValid()) + mSpeculativeCDDArticulationBitMap.growAndSet(sim->getNodeIndex().index()); + } + else + mSpeculativeCCDRigidBodyBitMap.growAndSet(sim->getNodeIndex().index()); + } + //if rigid body is articulation link, the node index will be invalid. We should add the link to the scene after we add the + //articulation for gpu + if(sim->getNodeIndex().isValid()) + mSimulationController->addDynamic(&sim->getLowLevelBody(), sim->getNodeIndex()); + if(sim->getSimStateData(true) && sim->getSimStateData(true)->isKine()) + mNbRigidKinematic++; + else + mNbRigidDynamics++; + addShapes(shapes, nbShapes, shapePtrOffset, *sim, outBounds); + + mDynamicsContext->setStateDirty(true); +} + +void Sc::Scene::removeBody(BodyCore& body, PxInlineArray& removedShapes, bool wakeOnLostTouch) +{ + BodySim *sim = body.getSim(); + if(sim) + { + if(mBatchRemoveState) + { + removeShapes(*sim, mBatchRemoveState->bufferedShapes ,removedShapes, wakeOnLostTouch); + } + else + { + PxInlineArray shapesBuffer; + removeShapes(*sim,shapesBuffer, removedShapes, wakeOnLostTouch); + } + + if (!sim->isArticulationLink()) + { + //clear bit map + if (sim->getLowLevelBody().mCore->mFlags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + sim->getScene().resetSpeculativeCCDRigidBody(sim->getNodeIndex().index()); + } + else + { + sim->getArticulation()->removeBody(*sim); + } + if(sim->getSimStateData(true) && sim->getSimStateData(true)->isKine()) + { + body.onRemoveKinematicFromScene(); + + mNbRigidKinematic--; + } + else + mNbRigidDynamics--; + mBodySimPool->destroy(sim); + + mDynamicsContext->setStateDirty(true); + } +} + +// PT: TODO: refactor with addShapes +void Sc::Scene::addShape_(RigidSim& owner, ShapeCore& shapeCore) +{ + ShapeSim* sim = mShapeSimPool->construct(owner, shapeCore); + mNbGeometries[shapeCore.getGeometryType()]++; + + //register shape + mSimulationController->addShape(&sim->getLLShapeSim(), sim->getElementID()); + + registerShapeInNphase(&owner.getRigidCore(), shapeCore, sim->getElementID()); +} + +// PT: TODO: refactor with removeShapes +void Sc::Scene::removeShape_(ShapeSim& shape, bool wakeOnLostTouch) +{ + //BodySim* body = shape.getBodySim(); + //if(body) + // body->postShapeDetach(); + + unregisterShapeFromNphase(shape.getCore(), shape.getElementID()); + + mSimulationController->removeShape(shape.getElementID()); + + mNbGeometries[shape.getCore().getGeometryType()]--; + shape.removeFromBroadPhase(wakeOnLostTouch); + mShapeSimPool->destroy(&shape); +} + +void Sc::Scene::registerShapeInNphase(Sc::RigidCore* rigidCore, const ShapeCore& shape, const PxU32 transformCacheID) +{ + RigidSim* sim = rigidCore->getSim(); + if(sim) + mLLContext->getNphaseImplementationContext()->registerShape(sim->getNodeIndex(), shape.getCore(), transformCacheID, sim->getPxActor()); +} + +void Sc::Scene::unregisterShapeFromNphase(const ShapeCore& shape, const PxU32 transformCacheID) +{ + mLLContext->getNphaseImplementationContext()->unregisterShape(shape.getCore(), transformCacheID); +} + +void Sc::Scene::notifyNphaseOnUpdateShapeMaterial(const ShapeCore& shapeCore) +{ + mLLContext->getNphaseImplementationContext()->updateShapeMaterial(shapeCore.getCore()); +} + +void Sc::Scene::startBatchInsertion(BatchInsertionState&state) +{ + state.shapeSim = mShapeSimPool->allocateAndPrefetch(); + state.staticSim = mStaticSimPool->allocateAndPrefetch(); + state.bodySim = mBodySimPool->allocateAndPrefetch(); +} + +void Sc::Scene::addShapes(NpShape*const* shapes, PxU32 nbShapes, size_t ptrOffset, RigidSim& rigidSim, ShapeSim*& prefetchedShapeSim, PxBounds3* outBounds) +{ + for(PxU32 i=0;iallocateAndPrefetch(); + ShapeCore& sc = *PxPointerOffset(shapes[i], ptrdiff_t(ptrOffset)); + PX_PLACEMENT_NEW(prefetchedShapeSim, ShapeSim(rigidSim, sc)); + const PxU32 elementID = prefetchedShapeSim->getElementID(); + + outBounds[i] = mBoundsArray->getBounds(elementID); + + mSimulationController->addShape(&prefetchedShapeSim->getLLShapeSim(), elementID); + mLLContext->getNphaseImplementationContext()->registerShape(rigidSim.getNodeIndex(), sc.getCore(), elementID, rigidSim.getPxActor()); + + prefetchedShapeSim = nextShapeSim; + mNbGeometries[sc.getGeometryType()]++; + } +} + +void Sc::Scene::addStatic(PxActor* actor, BatchInsertionState& s, PxBounds3* outBounds) +{ + // static core has been prefetched by caller + Sc::StaticSim* sim = s.staticSim; // static core has been prefetched by the caller + + const Cm::PtrTable* shapeTable = PxPointerOffset(actor, s.staticShapeTableOffset); + void*const* shapes = shapeTable->getPtrs(); + + mStaticSimPool->construct(sim, *this, *PxPointerOffset(actor, s.staticActorOffset)); + s.staticSim = mStaticSimPool->allocateAndPrefetch(); + + addShapes(reinterpret_cast(shapes), shapeTable->getCount(), size_t(s.shapeOffset), *sim, s.shapeSim, outBounds); + mNbRigidStatics++; +} + +void Sc::Scene::addBody(PxActor* actor, BatchInsertionState& s, PxBounds3* outBounds, bool compound) +{ + Sc::BodySim* sim = s.bodySim; // body core has been prefetched by the caller + + const Cm::PtrTable* shapeTable = PxPointerOffset(actor, s.dynamicShapeTableOffset); + void*const* shapes = shapeTable->getPtrs(); + + Sc::BodyCore* bodyCore = PxPointerOffset(actor, s.dynamicActorOffset); + mBodySimPool->construct(sim, *this, *bodyCore, compound); + s.bodySim = mBodySimPool->allocateAndPrefetch(); + + if(sim->getLowLevelBody().mCore->mFlags & PxRigidBodyFlag::eENABLE_SPECULATIVE_CCD) + { + if(sim->isArticulationLink()) + mSpeculativeCDDArticulationBitMap.growAndSet(sim->getNodeIndex().index()); + else + mSpeculativeCCDRigidBodyBitMap.growAndSet(sim->getNodeIndex().index()); + } + + if(sim->getNodeIndex().isValid()) + mSimulationController->addDynamic(&sim->getLowLevelBody(), sim->getNodeIndex()); + + addShapes(reinterpret_cast(shapes), shapeTable->getCount(), size_t(s.shapeOffset), *sim, s.shapeSim, outBounds); + + const SimStateData* simStateData = bodyCore->getSim()->getSimStateData(true); + if(simStateData && simStateData->isKine()) + mNbRigidKinematic++; + else + mNbRigidDynamics++; + + mDynamicsContext->setStateDirty(true); +} + +void Sc::Scene::finishBatchInsertion(BatchInsertionState& state) +{ + // a little bit lazy - we could deal with the last one in the batch specially to avoid overallocating by one. + + mStaticSimPool->releasePreallocated(static_cast(state.staticSim)); + mBodySimPool->releasePreallocated(static_cast(state.bodySim)); + mShapeSimPool->releasePreallocated(state.shapeSim); +} + +// PT: TODO: why is this in Sc? +void Sc::Scene::initContactsIterator(ContactIterator& contactIterator, PxsContactManagerOutputIterator& outputs) +{ + outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + Interaction** first = mInteractions[Sc::InteractionType::eOVERLAP].begin(); + contactIterator = ContactIterator(first, first + mActiveInteractionCount[Sc::InteractionType::eOVERLAP], outputs); +} + +void Sc::Scene::setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance) +{ + struct { + void operator()(PxU32& bits, PxDominanceGroup shift, PxReal weight) + { + if(weight != PxReal(0)) + bits |= (PxU32(1) << shift); + else + bits &= ~(PxU32(1) << shift); + } + } bitsetter; + + bitsetter(mDominanceBitMatrix[group1], group2, dominance.dominance0); + bitsetter(mDominanceBitMatrix[group2], group1, dominance.dominance1); + + mInternalFlags |= SceneInternalFlag::eSCENE_SIP_STATES_DIRTY_DOMINANCE; //force an update on all interactions on matrix change -- very expensive but we have no choice!! +} + +PxDominanceGroupPair Sc::Scene::getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const +{ + const PxU8 dom0 = PxU8((mDominanceBitMatrix[group1]>>group2) & 0x1 ? 1u : 0u); + const PxU8 dom1 = PxU8((mDominanceBitMatrix[group2]>>group1) & 0x1 ? 1u : 0u); + return PxDominanceGroupPair(dom0, dom1); +} + +void Sc::Scene::setSolverBatchSize(PxU32 solverBatchSize) +{ + mDynamicsContext->setSolverBatchSize(solverBatchSize); +} + +PxU32 Sc::Scene::getSolverBatchSize() const +{ + return mDynamicsContext->getSolverBatchSize(); +} + +void Sc::Scene::setSolverArticBatchSize(PxU32 solverBatchSize) +{ + mDynamicsContext->setSolverArticBatchSize(solverBatchSize); +} + +PxU32 Sc::Scene::getSolverArticBatchSize() const +{ + return mDynamicsContext->getSolverArticBatchSize(); +} + +void Sc::Scene::setCCDMaxSeparation(PxReal separation) +{ + mDynamicsContext->setCCDSeparationThreshold(separation); +} + +PxReal Sc::Scene::getCCDMaxSeparation() const +{ + return mDynamicsContext->getCCDSeparationThreshold(); +} + +void Sc::Scene::setMaxBiasCoefficient(PxReal coeff) +{ + mDynamicsContext->setMaxBiasCoefficient(coeff); +} + +PxReal Sc::Scene::getMaxBiasCoefficient() const +{ + return mDynamicsContext->getMaxBiasCoefficient(); +} + +void Sc::Scene::setFrictionOffsetThreshold(PxReal t) +{ + mDynamicsContext->setFrictionOffsetThreshold(t); +} + +PxReal Sc::Scene::getFrictionOffsetThreshold() const +{ + return mDynamicsContext->getFrictionOffsetThreshold(); +} + +void Sc::Scene::setFrictionCorrelationDistance(PxReal t) +{ + mDynamicsContext->setCorrelationDistance(t); +} + +PxReal Sc::Scene::getFrictionCorrelationDistance() const +{ + return mDynamicsContext->getCorrelationDistance(); +} + +PxU32 Sc::Scene::getDefaultContactReportStreamBufferSize() const +{ + return mNPhaseCore->getDefaultContactReportStreamBufferSize(); +} + +void Sc::Scene::buildActiveActors() +{ + { + PxU32 numActiveBodies = 0; + BodyCore*const* PX_RESTRICT activeBodies; + if (!(getPublicFlags() & PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS)) + { + numActiveBodies = getNumActiveBodies(); + activeBodies = getActiveBodiesArray(); + } + else + { + numActiveBodies = getActiveDynamicBodiesCount(); + activeBodies = getActiveDynamicBodies(); + } + + mActiveActors.clear(); + + for (PxU32 i = 0; i < numActiveBodies; i++) + { + if (!activeBodies[i]->isFrozen()) + { + PxRigidActor* ra = static_cast(activeBodies[i]->getPxActor()); + PX_ASSERT(ra); + mActiveActors.pushBack(ra); + } + } + } + +#if PX_SUPPORT_GPU_PHYSX + { + PxU32 numActiveSoftBodies = getNumActiveSoftBodies(); + SoftBodyCore*const* PX_RESTRICT activeSoftBodies = getActiveSoftBodiesArray(); + + mActiveSoftBodyActors.clear(); + + for (PxU32 i = 0; i < numActiveSoftBodies; i++) + { + PxActor* ra = activeSoftBodies[i]->getPxActor(); + mActiveSoftBodyActors.pushBack(ra); + } + } + { + PxU32 numActiveHairSystems = getNumActiveHairSystems(); + HairSystemCore*const* PX_RESTRICT activeHairSystems = getActiveHairSystemsArray(); + + mActiveHairSystemActors.clear(); + + for (PxU32 i = 0; i < numActiveHairSystems; i++) + { + PxActor* ra = activeHairSystems[i]->getPxActor(); + mActiveHairSystemActors.pushBack(ra); + } + } + +#endif +} + +// PT: TODO: unify buildActiveActors & buildActiveAndFrozenActors +void Sc::Scene::buildActiveAndFrozenActors() +{ + { + PxU32 numActiveBodies = 0; + BodyCore*const* PX_RESTRICT activeBodies; + if (!(getPublicFlags() & PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS)) + { + numActiveBodies = getNumActiveBodies(); + activeBodies = getActiveBodiesArray(); + } + else + { + numActiveBodies = getActiveDynamicBodiesCount(); + activeBodies = getActiveDynamicBodies(); + } + + mActiveActors.clear(); + mFrozenActors.clear(); + + for (PxU32 i = 0; i < numActiveBodies; i++) + { + PxRigidActor* ra = static_cast(activeBodies[i]->getPxActor()); + PX_ASSERT(ra); + + if (!activeBodies[i]->isFrozen()) + mActiveActors.pushBack(ra); + else + mFrozenActors.pushBack(ra); + } + } + +#if PX_SUPPORT_GPU_PHYSX + { + PxU32 numActiveSoftBodies = getNumActiveSoftBodies(); + SoftBodyCore*const* PX_RESTRICT activeSoftBodies = getActiveSoftBodiesArray(); + + mActiveSoftBodyActors.clear(); + + for (PxU32 i = 0; i < numActiveSoftBodies; i++) + { + PxActor* ra = activeSoftBodies[i]->getPxActor(); + mActiveActors.pushBack(ra); + } + } + { + PxU32 numActiveHairSystems = getNumActiveHairSystems(); + HairSystemCore*const* PX_RESTRICT activeHairSystems = getActiveHairSystemsArray(); + + mActiveHairSystemActors.clear(); + + for (PxU32 i = 0; i < numActiveHairSystems; i++) + { + PxActor* ra = activeHairSystems[i]->getPxActor(); + mActiveHairSystemActors.pushBack(ra); + } + } +#endif +} + +PxActor** Sc::Scene::getActiveActors(PxU32& nbActorsOut) +{ + nbActorsOut = mActiveActors.size(); + + if(!nbActorsOut) + return NULL; + + return mActiveActors.begin(); +} + +void Sc::Scene::setActiveActors(PxActor** actors, PxU32 nbActors) +{ + mActiveActors.forceSize_Unsafe(0); + mActiveActors.resize(nbActors); + PxMemCopy(mActiveActors.begin(), actors, sizeof(PxActor*) * nbActors); +} + +#if PX_SUPPORT_GPU_PHYSX +PxActor** Sc::Scene::getActiveSoftBodyActors(PxU32& nbActorsOut) +{ + nbActorsOut = mActiveSoftBodyActors.size(); + + if (!nbActorsOut) + return NULL; + + return mActiveSoftBodyActors.begin(); +} + +void Sc::Scene::setActiveSoftBodyActors(PxActor** actors, PxU32 nbActors) +{ + mActiveSoftBodyActors.forceSize_Unsafe(0); + mActiveSoftBodyActors.resize(nbActors); + PxMemCopy(mActiveSoftBodyActors.begin(), actors, sizeof(PxActor*) * nbActors); +} + +//PxActor** Sc::Scene::getActiveFEMClothActors(PxU32& nbActorsOut) +//{ +// nbActorsOut = mActiveFEMClothActors.size(); +// +// if (!nbActorsOut) +// return NULL; +// +// return mActiveFEMClothActors.begin(); +//} +// +//void Sc::Scene::setActiveFEMClothActors(PxActor** actors, PxU32 nbActors) +//{ +// mActiveFEMClothActors.forceSize_Unsafe(0); +// mActiveFEMClothActors.resize(nbActors); +// PxMemCopy(mActiveFEMClothActors.begin(), actors, sizeof(PxActor*) * nbActors); +//} +#endif + +PxActor** Sc::Scene::getFrozenActors(PxU32& nbActorsOut) +{ + nbActorsOut = mFrozenActors.size(); + + if(!nbActorsOut) + return NULL; + + return mFrozenActors.begin(); +} + +void Sc::Scene::reserveTriggerReportBufferSpace(const PxU32 pairCount, PxTriggerPair*& triggerPairBuffer, TriggerPairExtraData*& triggerPairExtraBuffer) +{ + const PxU32 oldSize = mTriggerBufferAPI.size(); + const PxU32 newSize = oldSize + pairCount; + const PxU32 newCapacity = PxU32(newSize * 1.5f); + mTriggerBufferAPI.reserve(newCapacity); + mTriggerBufferAPI.forceSize_Unsafe(newSize); + triggerPairBuffer = mTriggerBufferAPI.begin() + oldSize; + + PX_ASSERT(oldSize == mTriggerBufferExtraData->size()); + mTriggerBufferExtraData->reserve(newCapacity); + mTriggerBufferExtraData->forceSize_Unsafe(newSize); + triggerPairExtraBuffer = mTriggerBufferExtraData->begin() + oldSize; +} + +void Sc::Scene::clearSleepWakeBodies(void) +{ + // PT: TODO: refactor/templatize all that stuff + + // Clear sleep/woken marker flags + BodyCore* const* sleepingBodies = mSleepBodies.getEntries(); + for(PxU32 i=0; i < mSleepBodies.size(); i++) + { + ActorSim* body = sleepingBodies[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(ActorSim::BF_WAKEUP_NOTIFY)); + body->clearInternalFlag(ActorSim::BF_SLEEP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(ActorSim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(ActorSim::BF_IS_IN_WAKEUP_LIST); + } + +#if PX_SUPPORT_GPU_PHYSX + SoftBodyCore* const* sleepingSoftBodies = mSleepSoftBodies.getEntries(); + for (PxU32 i = 0; i < mSleepSoftBodies.size(); i++) + { + ActorSim* body = sleepingSoftBodies[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(ActorSim::BF_WAKEUP_NOTIFY)); + body->clearInternalFlag(ActorSim::BF_SLEEP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(ActorSim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(ActorSim::BF_IS_IN_WAKEUP_LIST); + } + + HairSystemCore* const* sleepingHairSystems = mSleepHairSystems.getEntries(); + for (PxU32 i = 0; i < mSleepHairSystems.size(); i++) + { + ActorSim* body = sleepingHairSystems[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(ActorSim::BF_WAKEUP_NOTIFY)); + body->clearInternalFlag(ActorSim::BF_SLEEP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(ActorSim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(ActorSim::BF_IS_IN_WAKEUP_LIST); + } +#endif + + BodyCore* const* wokenBodies = mWokeBodies.getEntries(); + for(PxU32 i=0; i < mWokeBodies.size(); i++) + { + BodySim* body = wokenBodies[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(BodySim::BF_SLEEP_NOTIFY)); + body->clearInternalFlag(BodySim::BF_WAKEUP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(BodySim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST); + } + +#if PX_SUPPORT_GPU_PHYSX + SoftBodyCore* const* wokenSoftBodies = mWokeSoftBodies.getEntries(); + for (PxU32 i = 0; i < mWokeSoftBodies.size(); i++) + { + SoftBodySim* body = wokenSoftBodies[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(BodySim::BF_SLEEP_NOTIFY)); + body->clearInternalFlag(BodySim::BF_WAKEUP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(BodySim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST); + } + + HairSystemCore* const* wokenHairSystems = mWokeHairSystems.getEntries(); + for (PxU32 i = 0; i < mWokeHairSystems.size(); i++) + { + HairSystemSim* body = wokenHairSystems[i]->getSim(); + + PX_ASSERT(!body->readInternalFlag(BodySim::BF_SLEEP_NOTIFY)); + body->clearInternalFlag(BodySim::BF_WAKEUP_NOTIFY); + + // A body can be in both lists depending on the sequence of events + body->clearInternalFlag(BodySim::BF_IS_IN_SLEEP_LIST); + body->clearInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST); + } +#endif + + mSleepBodies.clear(); + mWokeBodies.clear(); + mWokeBodyListValid = true; + mSleepBodyListValid = true; + + // PT: TODO: why aren't these inside PX_SUPPORT_GPU_PHYSX? + mSleepSoftBodies.clear(); + mWokeSoftBodies.clear(); + mWokeSoftBodyListValid = true; + mSleepSoftBodyListValid = true; + + // PT: TODO: why aren't these inside PX_SUPPORT_GPU_PHYSX? + mSleepHairSystems.clear(); + mWokeHairSystems.clear(); + mWokeHairSystemListValid = true; + mSleepHairSystemListValid = true; +} + +void Sc::Scene::onBodySleep(BodySim* body) +{ + if (!mSimulationEventCallback && !mOnSleepingStateChanged) + return; + + if (body->readInternalFlag(ActorSim::BF_WAKEUP_NOTIFY)) + { + PX_ASSERT(!body->readInternalFlag(ActorSim::BF_SLEEP_NOTIFY)); + + // Body is in the list of woken bodies, hence, mark this list as dirty such that it gets cleaned up before + // being sent to the user + body->clearInternalFlag(ActorSim::BF_WAKEUP_NOTIFY); + mWokeBodyListValid = false; + } + + body->raiseInternalFlag(ActorSim::BF_SLEEP_NOTIFY); + + // Avoid multiple insertion (the user can do multiple transitions between asleep and awake) + if (!body->readInternalFlag(ActorSim::BF_IS_IN_SLEEP_LIST)) + { + PX_ASSERT(!mSleepBodies.contains(&body->getBodyCore())); + mSleepBodies.insert(&body->getBodyCore()); + body->raiseInternalFlag(ActorSim::BF_IS_IN_SLEEP_LIST); + } +} + +void Sc::Scene::onBodyWakeUp(BodySim* body) +{ + if(!mSimulationEventCallback && !mOnSleepingStateChanged) + return; + + if (body->readInternalFlag(BodySim::BF_SLEEP_NOTIFY)) + { + PX_ASSERT(!body->readInternalFlag(BodySim::BF_WAKEUP_NOTIFY)); + + // Body is in the list of sleeping bodies, hence, mark this list as dirty such it gets cleaned up before + // being sent to the user + body->clearInternalFlag(BodySim::BF_SLEEP_NOTIFY); + mSleepBodyListValid = false; + } + + body->raiseInternalFlag(BodySim::BF_WAKEUP_NOTIFY); + + // Avoid multiple insertion (the user can do multiple transitions between asleep and awake) + if (!body->readInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST)) + { + PX_ASSERT(!mWokeBodies.contains(&body->getBodyCore())); + mWokeBodies.insert(&body->getBodyCore()); + body->raiseInternalFlag(BodySim::BF_IS_IN_WAKEUP_LIST); + } +} + +PX_INLINE void Sc::Scene::cleanUpSleepBodies() +{ + BodyCore* const* bodyArray = mSleepBodies.getEntries(); + PxU32 bodyCount = mSleepBodies.size(); + + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + while (bodyCount--) + { + ActorSim* actor = bodyArray[bodyCount]->getSim(); + BodySim* body = static_cast(actor); + + if (body->readInternalFlag(static_cast(ActorSim::BF_WAKEUP_NOTIFY))) + { + body->clearInternalFlag(static_cast(ActorSim::BF_IS_IN_WAKEUP_LIST)); + mSleepBodies.erase(bodyArray[bodyCount]); + } + else if (islandSim.getNode(body->getNodeIndex()).isActive()) + { + //This body is still active in the island simulation, so the request to deactivate the actor by the application must have failed. Recover by undoing this + mSleepBodies.erase(bodyArray[bodyCount]); + actor->internalWakeUp(); + + } + } + + mSleepBodyListValid = true; +} + +PX_INLINE void Sc::Scene::cleanUpWokenBodies() +{ + cleanUpSleepOrWokenBodies(mWokeBodies, BodySim::BF_SLEEP_NOTIFY, mWokeBodyListValid); +} + +PX_INLINE void Sc::Scene::cleanUpSleepOrWokenBodies(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker) +{ + // With our current logic it can happen that a body is added to the sleep as well as the woken body list in the + // same frame. + // + // Examples: + // - Kinematic is created (added to woken list) but has not target (-> deactivation -> added to sleep list) + // - Dynamic is created (added to woken list) but is forced to sleep by user (-> deactivation -> added to sleep list) + // + // This code traverses the sleep/woken body list and removes bodies which have been initially added to the given + // list but do not belong to it anymore. + + BodyCore* const* bodyArray = bodyList.getEntries(); + PxU32 bodyCount = bodyList.size(); + while (bodyCount--) + { + BodySim* body = bodyArray[bodyCount]->getSim(); + + if (body->readInternalFlag(static_cast(removeFlag))) + bodyList.erase(bodyArray[bodyCount]); + } + + validMarker = true; +} + +#if PX_SUPPORT_GPU_PHYSX +void Sc::Scene::cleanUpSleepHairSystems() +{ + HairSystemCore* const* hairSystemArray = mSleepHairSystems.getEntries(); + PxU32 bodyCount = mSleepBodies.size(); + + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + while (bodyCount--) + { + + HairSystemSim* hairSystem = hairSystemArray[bodyCount]->getSim(); + + if (hairSystem->readInternalFlag(static_cast(ActorSim::BF_WAKEUP_NOTIFY))) + { + hairSystem->clearInternalFlag(static_cast(ActorSim::BF_IS_IN_WAKEUP_LIST)); + mSleepHairSystems.erase(hairSystemArray[bodyCount]); + } + else if (islandSim.getNode(hairSystem->getNodeIndex()).isActive()) + { + //This hairSystem is still active in the island simulation, so the request to deactivate the actor by the application must have failed. Recover by undoing this + mSleepHairSystems.erase(hairSystemArray[bodyCount]); + hairSystem->internalWakeUp(); + } + } + mSleepBodyListValid = true; +} + +void Sc::Scene::cleanUpWokenHairSystems() +{ + cleanUpSleepOrWokenHairSystems(mWokeHairSystems, BodySim::BF_SLEEP_NOTIFY, mWokeHairSystemListValid); +} + +void Sc::Scene::cleanUpSleepOrWokenHairSystems(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker) +{ + HairSystemCore* const* hairSystemArray = bodyList.getEntries(); + PxU32 bodyCount = bodyList.size(); + while (bodyCount--) + { + HairSystemSim* hairSystem = hairSystemArray[bodyCount]->getSim(); + + if (hairSystem->readInternalFlag(static_cast(removeFlag))) + bodyList.erase(hairSystemArray[bodyCount]); + } + + validMarker = true; +} + +PX_INLINE void Sc::Scene::cleanUpSleepSoftBodies() +{ + SoftBodyCore* const* bodyArray = mSleepSoftBodies.getEntries(); + PxU32 bodyCount = mSleepBodies.size(); + + IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); + + while (bodyCount--) + { + SoftBodySim* body = bodyArray[bodyCount]->getSim(); + + if (body->readInternalFlag(static_cast(ActorSim::BF_WAKEUP_NOTIFY))) + { + body->clearInternalFlag(static_cast(ActorSim::BF_IS_IN_WAKEUP_LIST)); + mSleepSoftBodies.erase(bodyArray[bodyCount]); + } + else if (islandSim.getNode(body->getNodeIndex()).isActive()) + { + //This body is still active in the island simulation, so the request to deactivate the actor by the application must have failed. Recover by undoing this + mSleepSoftBodies.erase(bodyArray[bodyCount]); + body->internalWakeUp(); + } + } + + mSleepBodyListValid = true; +} + +PX_INLINE void Sc::Scene::cleanUpWokenSoftBodies() +{ + cleanUpSleepOrWokenSoftBodies(mWokeSoftBodies, BodySim::BF_SLEEP_NOTIFY, mWokeSoftBodyListValid); +} + +PX_INLINE void Sc::Scene::cleanUpSleepOrWokenSoftBodies(PxCoalescedHashSet& bodyList, PxU32 removeFlag, bool& validMarker) +{ + // With our current logic it can happen that a body is added to the sleep as well as the woken body list in the + // same frame. + // + // Examples: + // - Kinematic is created (added to woken list) but has not target (-> deactivation -> added to sleep list) + // - Dynamic is created (added to woken list) but is forced to sleep by user (-> deactivation -> added to sleep list) + // + // This code traverses the sleep/woken body list and removes bodies which have been initially added to the given + // list but do not belong to it anymore. + + SoftBodyCore* const* bodyArray = bodyList.getEntries(); + PxU32 bodyCount = bodyList.size(); + while (bodyCount--) + { + SoftBodySim* body = bodyArray[bodyCount]->getSim(); + + if (body->readInternalFlag(static_cast(removeFlag))) + bodyList.erase(bodyArray[bodyCount]); + } + + validMarker = true; +} +#endif //PX_SUPPORT_GPU_PHYSX + +void Sc::Scene::releaseConstraints(bool endOfScene) +{ + PX_ASSERT(mLLContext); + + if(getStabilizationEnabled()) + { + //If stabilization is enabled, we're caching contacts for next frame + if(!endOfScene) + { + //So we only clear memory (flip buffers) when not at the end-of-scene. + //This means we clear after narrow phase completed so we can + //release the previous frame's contact buffers before we enter the solve phase. + mLLContext->getNpMemBlockPool().releaseContacts(); + } + } + else if(endOfScene) + { + //We now have a double-buffered pool of mem blocks so we must + //release both pools (which actually triggers the memory used this + //frame to be released + mLLContext->getNpMemBlockPool().releaseContacts(); + mLLContext->getNpMemBlockPool().releaseContacts(); + } +} + +PX_INLINE void Sc::Scene::clearBrokenConstraintBuffer() +{ + mBrokenConstraints.clear(); +} + +void Sc::Scene::addToLostTouchList(ActorSim& body1, ActorSim& body2) +{ + PX_ASSERT(!body1.isStaticRigid()); + PX_ASSERT(!body2.isStaticRigid()); + SimpleBodyPair p = { &body1, &body2, body1.getActorID(), body2.getActorID() }; + mLostTouchPairs.pushBack(p); +} + +FeatherstoneArticulation* Sc::Scene::createLLArticulation(Sc::ArticulationSim* sim) +{ + return mLLArticulationRCPool->construct(sim); +} + +void Sc::Scene::destroyLLArticulation(FeatherstoneArticulation& articulation) +{ + mLLArticulationRCPool->destroy(static_cast(&articulation)); +} + +#if PX_SUPPORT_GPU_PHYSX + +Dy::SoftBody* Sc::Scene::createLLSoftBody(Sc::SoftBodySim* sim) +{ + return mLLSoftBodyPool->construct(sim, sim->getCore().getCore()); +} + +void Sc::Scene::destroyLLSoftBody(Dy::SoftBody& softBody) +{ + mLLSoftBodyPool->destroy(&softBody); +} + +Dy::FEMCloth* Sc::Scene::createLLFEMCloth(Sc::FEMClothSim* sim) +{ + return mLLFEMClothPool->construct(sim, sim->getCore().getCore()); +} + +void Sc::Scene::destroyLLFEMCloth(Dy::FEMCloth& femCloth) +{ + mLLFEMClothPool->destroy(&femCloth); +} + +Dy::ParticleSystem* Sc::Scene::createLLParticleSystem(Sc::ParticleSystemSim* sim) +{ + return mLLParticleSystemPool->construct(sim->getCore().getShapeCore().getLLCore()); +} + +void Sc::Scene::destroyLLParticleSystem(Dy::ParticleSystem& particleSystem) +{ + return mLLParticleSystemPool->destroy(&particleSystem); +} + +Dy::HairSystem* Sc::Scene::createLLHairSystem(Sc::HairSystemSim* sim) +{ + return mLLHairSystemPool->construct(sim, sim->getCore().getShapeCore().getLLCore()); +} + +void Sc::Scene::destroyLLHairSystem(Dy::HairSystem& hairSystem) +{ + mLLHairSystemPool->destroy(&hairSystem); +} + +#endif //PX_SUPPORT_GPU_PHYSX + +PxU32 Sc::Scene::createAggregate(void* userData, PxU32 maxNumShapes, PxAggregateFilterHint filterHint) +{ + const physx::Bp::BoundsIndex index = getElementIDPool().createID(); + mBoundsArray->initEntry(index); + mLLContext->getNphaseImplementationContext()->registerAggregate(index); +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + return mAABBManager->createAggregate(index, Bp::FilterGroup::eINVALID, userData, maxNumShapes, filterHint); +#else + // PT: TODO: ideally a static compound would have a static group + const PxU32 rigidId = getRigidIDTracker().createID(); + const Bp::FilterGroup::Enum bpGroup = Bp::FilterGroup::Enum(rigidId + Bp::FilterGroup::eDYNAMICS_BASE); + return mAABBManager->createAggregate(index, bpGroup, userData, selfCollisions); +#endif +} + +void Sc::Scene::deleteAggregate(PxU32 id) +{ + Bp::BoundsIndex index; + Bp::FilterGroup::Enum bpGroup; +#ifdef BP_USE_AGGREGATE_GROUP_TAIL + if(mAABBManager->destroyAggregate(index, bpGroup, id)) + { + getElementIDPool().releaseID(index); + } +#else + if(mAABBManager->destroyAggregate(index, bpGroup, id)) + { + getElementIDPool().releaseID(index); + + // PT: this is clumsy.... + const PxU32 rigidId = PxU32(bpGroup) - Bp::FilterGroup::eDYNAMICS_BASE; + getRigidIDTracker().releaseID(rigidId); + } +#endif +} + +void Sc::Scene::shiftOrigin(const PxVec3& shift) +{ + // adjust low level context + mLLContext->shiftOrigin(shift); + + // adjust bounds array + mBoundsArray->shiftOrigin(shift); + + // adjust broadphase + mAABBManager->shiftOrigin(shift); + + // adjust constraints + ConstraintCore*const * constraints = mConstraints.getEntries(); + for(PxU32 i=0, size = mConstraints.size(); i < size; i++) + constraints[i]->getPxConnector()->onOriginShift(shift); +} + +/////////////////////////////////////////////////////////////////////////////// + +static PX_FORCE_INLINE bool isParticleSystem(const PxActorType::Enum actorType) +{ + return actorType == PxActorType::ePBD_PARTICLESYSTEM || actorType == PxActorType::eFLIP_PARTICLESYSTEM + || actorType == PxActorType::eMPM_PARTICLESYSTEM || actorType == PxActorType::eCUSTOM_PARTICLESYSTEM; +} + +void Sc::Scene::islandInsertion(PxBaseTask* /*continuation*/) +{ + { + PX_PROFILE_ZONE("Sim.processNewOverlaps.islandInsertion", getContextId()); + + const PxU32 nbShapeIdxCreated = mPreallocatedShapeInteractions.size(); + for (PxU32 a = 0; a < nbShapeIdxCreated; ++a) + { + size_t address = size_t(mPreallocatedShapeInteractions[a]); + if (address & 1) + { + ShapeInteraction* interaction = reinterpret_cast(address&size_t(~1)); + + PxsContactManager* contactManager = const_cast(interaction->getContactManager()); + + Sc::ActorSim& bs0 = interaction->getShape0().getActor(); + Sc::ActorSim& bs1 = interaction->getShape1().getActor(); + + PxActorType::Enum actorTypeLargest = PxMax(bs0.getActorType(), bs1.getActorType()); + + PxNodeIndex nodeIndexB; + if (!bs1.isStaticRigid()) + nodeIndexB = bs1.getNodeIndex(); + + IG::Edge::EdgeType type = IG::Edge::eCONTACT_MANAGER; + if(actorTypeLargest == PxActorType::eSOFTBODY) + type = IG::Edge::eSOFT_BODY_CONTACT; + else if (actorTypeLargest == PxActorType::eFEMCLOTH) + type = IG::Edge::eFEM_CLOTH_CONTACT; + else if(isParticleSystem(actorTypeLargest)) + type = IG::Edge::ePARTICLE_SYSTEM_CONTACT; + else if (actorTypeLargest == PxActorType::eHAIRSYSTEM) + type = IG::Edge::eHAIR_SYSTEM_CONTACT; + + IG::EdgeIndex edgeIdx = mSimpleIslandManager->addContactManager(contactManager, bs0.getNodeIndex(), nodeIndexB, interaction, type); + + interaction->mEdgeIndex = edgeIdx; + + if (contactManager) + contactManager->getWorkUnit().mEdgeIndex = edgeIdx; + + //If it is a soft body or particle overlap, treat it as a contact for now (we can hook up touch found/lost events later maybe) + if (actorTypeLargest > PxActorType::eARTICULATION_LINK) + mSimpleIslandManager->setEdgeConnected(edgeIdx, type); + } + } + + // - Wakes actors that lost touch if appropriate + //processLostTouchPairs(); + + if(mCCDPass == 0) + { + mSimpleIslandManager->firstPassIslandGen(); + } + } +} + +void Sc::Scene::registerContactManagers(PxBaseTask* /*continuation*/) +{ + { + PxvNphaseImplementationContext* nphaseContext = mLLContext->getNphaseImplementationContext(); + nphaseContext->lock(); + PX_PROFILE_ZONE("Sim.processNewOverlaps.registerCms", getContextId()); + //nphaseContext->registerContactManagers(mPreallocatedContactManagers.begin(), mPreallocatedContactManagers.size(), mLLContext->getContactManagerPool().getMaxUsedIndex()); + const PxU32 nbCmsCreated = mPreallocatedContactManagers.size(); + for (PxU32 a = 0; a < nbCmsCreated; ++a) + { + size_t address = size_t(mPreallocatedContactManagers[a]); + if (address & 1) + { + PxsContactManager* cm = reinterpret_cast(address&size_t(~1)); + size_t address2 = size_t(mPreallocatedShapeInteractions[a]); + ShapeInteraction* interaction = reinterpret_cast(address2&size_t(~1)); + nphaseContext->registerContactManager(cm, interaction, 0, 0); + } + } + nphaseContext->unlock(); + } +} + +void Sc::Scene::registerInteractions(PxBaseTask* /*continuation*/) +{ + { + PX_PROFILE_ZONE("Sim.processNewOverlaps.registerInteractions", getContextId()); + const PxU32 nbShapeIdxCreated = mPreallocatedShapeInteractions.size(); + for (PxU32 a = 0; a < nbShapeIdxCreated; ++a) + { + size_t address = size_t(mPreallocatedShapeInteractions[a]); + if (address & 1) + { + ShapeInteraction* interaction = reinterpret_cast(address&size_t(~1)); + + ActorSim& actorSim0 = interaction->getActorSim0(); + ActorSim& actorSim1 = interaction->getActorSim1(); + actorSim0.registerInteractionInActor(interaction); + actorSim1.registerInteractionInActor(interaction); + + /*Sc::BodySim* bs0 = actorSim0.isDynamicRigid() ? static_cast(&actorSim0) : NULL; + Sc::BodySim* bs1 = actorSim1.isDynamicRigid() ? static_cast(&actorSim1) : NULL;*/ + + if (actorSim0.isDynamicRigid()) + { + Sc::BodySim* bs0 = static_cast(&actorSim0); + bs0->registerCountedInteraction(); + } + + if (actorSim1.isDynamicRigid()) + { + Sc::BodySim* bs1 = static_cast(&actorSim1); + bs1->registerCountedInteraction(); + } + } + } + + const PxU32 nbMarkersCreated = mPreallocatedInteractionMarkers.size(); + for (PxU32 a = 0; a < nbMarkersCreated; ++a) + { + size_t address = size_t(mPreallocatedInteractionMarkers[a]); + if (address & 1) + { + ElementInteractionMarker* interaction = reinterpret_cast(address&size_t(~1)); + interaction->registerInActors(NULL); + } + } + } +} + +void Sc::Scene::registerSceneInteractions(PxBaseTask* /*continuation*/) +{ + PX_PROFILE_ZONE("Sim.processNewOverlaps.registerInteractionsScene", getContextId()); + const PxU32 nbShapeIdxCreated = mPreallocatedShapeInteractions.size(); + for (PxU32 a = 0; a < nbShapeIdxCreated; ++a) + { + size_t address = size_t(mPreallocatedShapeInteractions[a]); + if (address & 1) + { + ShapeInteraction* interaction = reinterpret_cast(address&size_t(~1)); + registerInteraction(interaction, interaction->getContactManager() != NULL); + mNPhaseCore->registerInteraction(interaction); + + const PxsContactManager* cm = interaction->getContactManager(); + if(cm) + mLLContext->setActiveContactManager(cm, cm->getCCD()); + } + } + + const PxU32 nbInteractionMarkers = mPreallocatedInteractionMarkers.size(); + for (PxU32 a = 0; a < nbInteractionMarkers; ++a) + { + size_t address = size_t(mPreallocatedInteractionMarkers[a]); + if (address & 1) + { + ElementInteractionMarker* interaction = reinterpret_cast(address&size_t(~1)); + registerInteraction(interaction, false); + mNPhaseCore->registerInteraction(interaction); + } + } +} + +class OverlapFilterTask : public Cm::Task +{ +public: + static const PxU32 MaxPairs = 512; + Sc::NPhaseCore* mNPhaseCore; + const Bp::AABBOverlap* mPairs; + + PxU32 mNbToProcess; + + PxU32 mKeepMap[MaxPairs/32]; + PxU32 mCallbackMap[MaxPairs/32]; + + PxFilterInfo* mFinfo; + + PxU32 mNbToKeep; + PxU32 mNbToSuppress; + PxU32 mNbToCallback; + + OverlapFilterTask* mNext; + + OverlapFilterTask(PxU64 contextID, Sc::NPhaseCore* nPhaseCore, PxFilterInfo* fInfo, const Bp::AABBOverlap* pairs, const PxU32 nbToProcess) : + Cm::Task (contextID), + mNPhaseCore (nPhaseCore), + mPairs (pairs), + mNbToProcess (nbToProcess), + mFinfo (fInfo), + mNbToKeep (0), + mNbToSuppress (0), + mNbToCallback (0), + mNext (NULL) + { + PxMemZero(mKeepMap, sizeof(mKeepMap)); + PxMemZero(mCallbackMap, sizeof(mCallbackMap)); + } + + virtual void runInternal() + { + mNPhaseCore->runOverlapFilters( mNbToProcess, mPairs, mFinfo, mNbToKeep, mNbToSuppress, mNbToCallback, mKeepMap, mCallbackMap); + } + + virtual const char* getName() const { return "OverlapFilterTask"; } +}; + +class OnOverlapCreatedTask : public Cm::Task +{ +public: + Sc::NPhaseCore* mNPhaseCore; + const Bp::AABBOverlap* mPairs; + const PxFilterInfo* mFinfo; + PxsContactManager** mContactManagers; + Sc::ShapeInteraction** mShapeInteractions; + Sc::ElementInteractionMarker** mInteractionMarkers; + PxU32 mNbToProcess; + + OnOverlapCreatedTask(PxU64 contextID, Sc::NPhaseCore* nPhaseCore, const Bp::AABBOverlap* pairs, const PxFilterInfo* fInfo, PxsContactManager** contactManagers, Sc::ShapeInteraction** shapeInteractions, Sc::ElementInteractionMarker** interactionMarkers, + PxU32 nbToProcess) : + Cm::Task (contextID), + mNPhaseCore (nPhaseCore), + mPairs (pairs), + mFinfo (fInfo), + mContactManagers (contactManagers), + mShapeInteractions (shapeInteractions), + mInteractionMarkers (interactionMarkers), + mNbToProcess (nbToProcess) + { + } + + virtual void runInternal() + { + PxsContactManager** currentCm = mContactManagers; + Sc::ShapeInteraction** currentSI = mShapeInteractions; + Sc::ElementInteractionMarker** currentEI = mInteractionMarkers; + + for(PxU32 i=0; i(pair.mUserData1); + Sc::ShapeSimBase* s1 = reinterpret_cast(pair.mUserData0); + + Sc::ElementSimInteraction* interaction = mNPhaseCore->createRbElementInteraction(mFinfo[i], *s0, *s1, *currentCm, *currentSI, *currentEI, 0); + if(interaction) + { + if(interaction->getType() == Sc::InteractionType::eOVERLAP) + { + *currentSI = reinterpret_cast(size_t(*currentSI) | 1); + currentSI++; + + if(static_cast(interaction)->getContactManager()) + { + *currentCm = reinterpret_cast(size_t(*currentCm) | 1); + currentCm++; + } + } + else if(interaction->getType() == Sc::InteractionType::eMARKER) + { + *currentEI = reinterpret_cast(size_t(*currentEI) | 1); + currentEI++; + } + } + } + } + + virtual const char* getName() const { return "OnOverlapCreatedTask"; } +}; + +void Sc::Scene::finishBroadPhase(PxBaseTask* continuation) +{ + PX_UNUSED(continuation); + PX_PROFILE_ZONE("Sc::Scene::finishBroadPhase", getContextId()); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + + { + PX_PROFILE_ZONE("Sim.processNewOverlaps", getContextId()); + + { + //KS - these functions call "registerInActors", while OverlapFilterTask reads the list of interactions + //in an actor. This could lead to a race condition and a crash if they occur at the same time, so we + //serialize these operations + PX_PROFILE_ZONE("Sim.processNewOverlaps.createOverlapsNoShapeInteractions", getContextId()); + { + PxU32 createdOverlapCount; + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getCreatedOverlaps(Bp::ElementType::eTRIGGER, createdOverlapCount); + + mLLContext->getSimStats().mNbNewPairs += createdOverlapCount; + mNPhaseCore->onTriggerOverlapCreated(p, createdOverlapCount); + } + } + + { + PxU32 createdOverlapCount; + const Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getCreatedOverlaps(Bp::ElementType::eSHAPE, createdOverlapCount); + { + //We allocate at least 1 element in this array to ensure that the onOverlapCreated functions don't go bang! + mPreallocatedContactManagers.reserve(1); + mPreallocatedShapeInteractions.reserve(1); + mPreallocatedInteractionMarkers.reserve(1); + + mPreallocatedContactManagers.forceSize_Unsafe(1); + mPreallocatedShapeInteractions.forceSize_Unsafe(1); + mPreallocatedInteractionMarkers.forceSize_Unsafe(1); + } + + mLLContext->getSimStats().mNbNewPairs += createdOverlapCount; + + mPreallocateContactManagers.setContinuation(continuation); + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + mFilterInfo.forceSize_Unsafe(0); + mFilterInfo.reserve(createdOverlapCount); + mFilterInfo.forceSize_Unsafe(createdOverlapCount); + + const PxU32 nbPairsPerTask = OverlapFilterTask::MaxPairs; + mOverlapFilterTaskHead = NULL; + OverlapFilterTask* previousTask = NULL; + for(PxU32 a=0; asetContinuation(&mPreallocateContactManagers); + task->removeReference(); + + if(previousTask) + previousTask->mNext = task; + else + mOverlapFilterTaskHead = task; + + previousTask = task; + } + } + + mPreallocateContactManagers.removeReference(); + } +} + +void Sc::Scene::preallocateContactManagers(PxBaseTask* continuation) +{ + //Iterate over all filter tasks and work out how many pairs we need... + + PxU32 createdOverlapCount = 0; + + PxU32 totalCreatedPairs = 0; + PxU32 totalSuppressPairs = 0; + + PxU32 overlapCount; + Bp::AABBOverlap* PX_RESTRICT p = mAABBManager->getCreatedOverlaps(Bp::ElementType::eSHAPE, overlapCount); + PxFilterInfo* fInfo = mFilterInfo.begin(); + + OverlapFilterTask* task = mOverlapFilterTaskHead; + while(task) + { + if(task->mNbToCallback) + { + //Iterate and process callbacks. Refilter then increment the results, setting the appropriate settings + const FilteringContext context(*this, mNPhaseCore->mFilterPairManager); + + for(PxU32 w = 0; w < (OverlapFilterTask::MaxPairs / 32); ++w) + { + for(PxU32 b = task->mCallbackMap[w]; b; b &= b - 1) + { + const PxU32 index = (w << 5) + PxLowestSetBit(b); + const Bp::AABBOverlap& pair = task->mPairs[index]; + Sc::ShapeSim* s0 = reinterpret_cast(pair.mUserData0); + Sc::ShapeSim* s1 = reinterpret_cast(pair.mUserData1); + + bool isNonRigid = s0->getActor().isNonRigid() || s1->getActor().isNonRigid(); + + + const PxFilterInfo finfo = filterRbCollisionPairSecondStage(context, *s0, *s1, s0->getActor(), s1->getActor(), INVALID_FILTER_PAIR_INDEX, true, isNonRigid); + + task->mFinfo[index] = finfo; + + if(!(finfo.filterFlags & PxFilterFlag::eKILL)) + { + if((finfo.filterFlags & PxFilterFlag::eSUPPRESS) == false) + task->mNbToKeep++; + else + task->mNbToSuppress++; + task->mKeepMap[index / 32] |= (1 << (index & 31)); + } + } + } + } + + totalCreatedPairs += task->mNbToKeep; + totalSuppressPairs += task->mNbToSuppress; + task = task->mNext; + } + + { + //We allocate at least 1 element in this array to ensure that the onOverlapCreated functions don't go bang! + mPreallocatedContactManagers.forceSize_Unsafe(0); + mPreallocatedShapeInteractions.forceSize_Unsafe(0); + mPreallocatedInteractionMarkers.forceSize_Unsafe(0); + + mPreallocatedContactManagers.reserve(totalCreatedPairs+1); + mPreallocatedShapeInteractions.reserve(totalCreatedPairs+1); + mPreallocatedInteractionMarkers.reserve(totalSuppressPairs+1); + + mPreallocatedContactManagers.forceSize_Unsafe(totalCreatedPairs); + mPreallocatedShapeInteractions.forceSize_Unsafe(totalCreatedPairs); + mPreallocatedInteractionMarkers.forceSize_Unsafe(totalSuppressPairs); + } + + const PxU32 nbPairsPerTask = 256; + PxsContactManager** cms = mPreallocatedContactManagers.begin(); + Sc::ShapeInteraction** shapeInter = mPreallocatedShapeInteractions.begin(); + Sc::ElementInteractionMarker** markerIter = mPreallocatedInteractionMarkers.begin(); + + Cm::FlushPool& flushPool = mLLContext->getTaskPool(); + + struct Local + { + static void processBatch(const PxU32 createdCurrIdx, PxU32& createdStartIdx, const PxU32 suppressedCurrIdx, PxU32& suppressedStartIdx, const PxU32 batchSize, + PxsContext* const context, NPhaseCore* const core, OnOverlapCreatedTask* const createTask, PxBaseTask* const continuation_, + PxsContactManager** const cms_, Sc::ShapeInteraction** const shapeInter_, Sc::ElementInteractionMarker** const markerIter_) + { + const PxU32 nbToCreate = createdCurrIdx - createdStartIdx; + const PxU32 nbToSuppress = suppressedCurrIdx - suppressedStartIdx; + + { + context->getContactManagerPool().preallocate(nbToCreate, cms_ + createdStartIdx); + } + + { + for (PxU32 i = 0; i < nbToCreate; ++i) + shapeInter_[createdStartIdx + i] = core->mShapeInteractionPool.allocate(); + } + { + for (PxU32 i = 0; i < nbToSuppress; ++i) + markerIter_[suppressedStartIdx + i] = core->mInteractionMarkerPool.allocate(); + } + + createdStartIdx = createdCurrIdx; + suppressedStartIdx = suppressedCurrIdx; + + createTask->mNbToProcess = batchSize; + createTask->setContinuation(continuation_); + createTask->removeReference(); + } + }; + + // PT: TODO: why do we create the task immediately? Why not create it only when a batch is full? + OnOverlapCreatedTask* createTask = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(OnOverlapCreatedTask)), OnOverlapCreatedTask)(getContextId(), mNPhaseCore, p, fInfo, cms, shapeInter, markerIter, 0); + + PxU32 batchSize = 0; + PxU32 suppressedStartIdx = 0; + PxU32 createdStartIdx = 0; + PxU32 suppressedCurrIdx = 0; + PxU32 createdCurrIdx = 0; + PxU32 currentReadIdx = 0; + + task = mOverlapFilterTaskHead; + while(task) + { + if(task->mNbToKeep || task->mNbToSuppress) + { + for(PxU32 w = 0; w < (OverlapFilterTask::MaxPairs/32); ++w) + { + for(PxU32 b = task->mKeepMap[w]; b; b &= b-1) + { + const PxU32 index = (w<<5) + PxLowestSetBit(b); + + if(createdOverlapCount < (index + currentReadIdx)) + { + p[createdOverlapCount] = task->mPairs[index]; + fInfo[createdOverlapCount] = task->mFinfo[index]; + } + createdOverlapCount++; + batchSize++; + } + } + + suppressedCurrIdx += task->mNbToSuppress; + createdCurrIdx += task->mNbToKeep; + + if(batchSize >= nbPairsPerTask) + { + Local::processBatch(createdCurrIdx, createdStartIdx, suppressedCurrIdx, suppressedStartIdx, batchSize, mLLContext, mNPhaseCore, createTask, continuation, cms, shapeInter, markerIter); + + createTask = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(OnOverlapCreatedTask)), OnOverlapCreatedTask)(getContextId(), mNPhaseCore, p + createdOverlapCount, + fInfo + createdOverlapCount, cms + createdStartIdx, shapeInter + createdStartIdx, markerIter + suppressedStartIdx, 0); + + batchSize = 0; + } + } + currentReadIdx += OverlapFilterTask::MaxPairs; + task = task->mNext; + } + + if(batchSize) + Local::processBatch(createdCurrIdx, createdStartIdx, suppressedCurrIdx, suppressedStartIdx, batchSize, mLLContext, mNPhaseCore, createTask, continuation, cms, shapeInter, markerIter); +} + +void Sc::Scene::finishBroadPhaseStage2(const PxU32 ccdPass) +{ + PX_PROFILE_ZONE("Sc::Scene::finishBroadPhase2", getContextId()); + + Bp::AABBManagerBase* aabbMgr = mAABBManager; + + for(PxU32 i=0; igetDestroyedOverlaps(Bp::ElementType::Enum(i), destroyedOverlapCount); + mLLContext->getSimStats().mNbLostPairs += destroyedOverlapCount; + } + + //KS - we need to defer processing lost overlaps until later! + if (ccdPass) + { + PX_PROFILE_ZONE("Sim.processLostOverlaps", getContextId()); + PxsContactManagerOutputIterator outputs = mLLContext->getNphaseImplementationContext()->getContactManagerOutputs(); + + PxU32 destroyedOverlapCount; + + { + Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eSHAPE, destroyedOverlapCount); + + while(destroyedOverlapCount--) + { + ElementSim* volume0 = reinterpret_cast(p->mUserData0); + ElementSim* volume1 = reinterpret_cast(p->mUserData1); + + //KS - this is a bit ugly. We split the "onOverlapRemoved" for shape interactions to parallelize it and that means + //that we have to call each of the individual stages of the remove here. + + //First, we have to get the interaction pointer... + Sc::ElementSimInteraction* interaction = mNPhaseCore->onOverlapRemovedStage1(volume0, volume1); + p->mPairUserData = interaction; + if(interaction) + { + if(interaction->getType() == Sc::InteractionType::eOVERLAP || interaction->getType() == Sc::InteractionType::eMARKER) + { + //If it's a standard "overlap" interaction, we have to send a lost touch report, unregister it, and destroy its manager and island gen data. + if(interaction->getType() == Sc::InteractionType::eOVERLAP) + { + Sc::ShapeInteraction* si = static_cast(interaction); + mNPhaseCore->lostTouchReports(si, PxU32(PairReleaseFlag::eWAKE_ON_LOST_TOUCH), NULL, 0, outputs); + + //We must check to see if we have a contact manager here. There is an edge case where actors could be put to + //sleep after discrete simulation, prior to CCD, causing their contactManager() to be destroyed. If their bounds + //also ceased overlapping, then this code will try to destroy the manager again. + if(si->getContactManager()) + si->destroyManager(); + si->clearIslandGenData(); + } + + unregisterInteraction(interaction); + mNPhaseCore->unregisterInteraction(interaction); + } + + //Then call "onOverlapRemoved" to actually free the interaction + mNPhaseCore->onOverlapRemoved(volume0, volume1, ccdPass, interaction, outputs); + } + p++; + } + } + + { + Bp::AABBOverlap* PX_RESTRICT p = aabbMgr->getDestroyedOverlaps(Bp::ElementType::eTRIGGER, destroyedOverlapCount); + + while(destroyedOverlapCount--) + { + ElementSim* volume0 = reinterpret_cast(p->mUserData0); + ElementSim* volume1 = reinterpret_cast(p->mUserData1); + + p->mPairUserData = NULL; + + //KS - this is a bit ugly. + mNPhaseCore->onOverlapRemoved(volume0, volume1, ccdPass, NULL, outputs); + p++; + } + } + } + + // - Wakes actors that lost touch if appropriate + processLostTouchPairs(); + + if (ccdPass) + aabbMgr->freeBuffers(); +} + +void Sc::Scene::activateEdgesInternal(const IG::EdgeIndex* activatingEdges, const PxU32 nbActivatingEdges) +{ + const IG::IslandSim& speculativeSim = mSimpleIslandManager->getSpeculativeIslandSim(); + for (PxU32 i = 0; i < nbActivatingEdges; ++i) + { + Sc::Interaction* interaction = mSimpleIslandManager->getInteraction(activatingEdges[i]); + + if (interaction && !interaction->readInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + if (speculativeSim.getEdge(activatingEdges[i]).isActive()) + { + const bool proceed = activateInteraction(interaction, NULL); + + if (proceed && (interaction->getType() < InteractionType::eTRACKED_IN_SCENE_COUNT)) + notifyInteractionActivated(interaction); + } + } + } +} + +void Sc::Scene::secondPassNarrowPhase(PxBaseTask* /*continuation*/) +{ + { + PX_PROFILE_ZONE("Sim.postIslandGen", getContextId()); + mSimpleIslandManager->additionalSpeculativeActivation(); + // wake interactions + { + PX_PROFILE_ZONE("ScScene.wakeInteractions", getContextId()); + const IG::IslandSim& speculativeSim = mSimpleIslandManager->getSpeculativeIslandSim(); + + //KS - only wake contact managers based on speculative state to trigger contact gen. Waking actors based on accurate state + //should activate and joints. + { + //Wake speculatively based on rigid contacts, soft contacts and particle contacts + activateEdgesInternal(speculativeSim.getActivatedEdges(IG::Edge::eCONTACT_MANAGER), speculativeSim.getNbActivatedEdges(IG::Edge::eCONTACT_MANAGER)); + activateEdgesInternal(speculativeSim.getActivatedEdges(IG::Edge::eSOFT_BODY_CONTACT), speculativeSim.getNbActivatedEdges(IG::Edge::eSOFT_BODY_CONTACT)); + activateEdgesInternal(speculativeSim.getActivatedEdges(IG::Edge::eFEM_CLOTH_CONTACT), speculativeSim.getNbActivatedEdges(IG::Edge::eFEM_CLOTH_CONTACT)); + activateEdgesInternal(speculativeSim.getActivatedEdges(IG::Edge::ePARTICLE_SYSTEM_CONTACT), speculativeSim.getNbActivatedEdges(IG::Edge::ePARTICLE_SYSTEM_CONTACT)); + activateEdgesInternal(speculativeSim.getActivatedEdges(IG::Edge::eHAIR_SYSTEM_CONTACT), speculativeSim.getNbActivatedEdges(IG::Edge::eHAIR_SYSTEM_CONTACT)); + } + } + } + mLLContext->secondPassUpdateContactManager(mDt, &mPostNarrowPhase); // Starts update of contact managers +} + +//~BROADPHASE + +void Sc::activateInteractions(Sc::ActorSim& actorSim) +{ + using namespace Sc; + + const PxU32 nbInteractions = actorSim.getActorInteractionCount(); + if(!nbInteractions) + return; + + Interaction** interactions = actorSim.getActorInteractions(); + Scene& scene = actorSim.getScene(); + + for(PxU32 i=0; ireadInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + const InteractionType::Enum type = interaction->getType(); + const bool isNotIGControlled = type != InteractionType::eOVERLAP && type != InteractionType::eMARKER; + + if((isNotIGControlled)) + { + const bool proceed = activateInteraction(interaction, NULL); + if(proceed && (type < InteractionType::eTRACKED_IN_SCENE_COUNT)) + scene.notifyInteractionActivated(interaction); + } + } + } +} + +void Sc::deactivateInteractions(Sc::ActorSim& actorSim) +{ + using namespace Sc; + + const PxU32 nbInteractions = actorSim.getActorInteractionCount(); + if(!nbInteractions) + return; + + Interaction** interactions = actorSim.getActorInteractions(); + Scene& scene = actorSim.getScene(); + + for(PxU32 i=0; ireadInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + const InteractionType::Enum type = interaction->getType(); + const bool isNotIGControlled = type != InteractionType::eOVERLAP && type != InteractionType::eMARKER; + if(isNotIGControlled) + { + const bool proceed = deactivateInteraction(interaction, type); + if(proceed && (type < InteractionType::eTRACKED_IN_SCENE_COUNT)) + scene.notifyInteractionDeactivated(interaction); + } + } + } +} + +Sc::ConstraintCore* Sc::Scene::findConstraintCore(const Sc::ActorSim* sim0, const Sc::ActorSim* sim1) +{ + const PxNodeIndex ind0 = sim0->getNodeIndex(); + const PxNodeIndex ind1 = sim1->getNodeIndex(); + + if(ind1 < ind0) + PxSwap(sim0, sim1); + + const PxHashMap, Sc::ConstraintCore*>::Entry* entry = mConstraintMap.find(PxPair(sim0, sim1)); + return entry ? entry->second : NULL; +} + +void Sc::Scene::updateBodySim(Sc::BodySim& bodySim) +{ + Dy::FeatherstoneArticulation* arti = NULL; + Sc::ArticulationSim* artiSim = bodySim.getArticulation(); + if (artiSim) + arti = artiSim->getLowLevelArticulation(); + mSimulationController->updateDynamic(arti, bodySim.getNodeIndex()); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp new file mode 100644 index 0000000..ede428e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeCore.cpp @@ -0,0 +1,406 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxErrorCallback.h" +#include "ScShapeSim.h" +#include "ScPhysics.h" +#include "GuConvexMesh.h" +#include "GuTriangleMesh.h" +#include "GuHeightField.h" +#include "GuTetrahedronMesh.h" + +using namespace physx; +using namespace Gu; +using namespace Cm; +using namespace Sc; + +static PX_FORCE_INLINE Gu::ConvexMesh& getConvexMesh(PxConvexMesh* pxcm) +{ + return *static_cast(pxcm); +} + +// PT: TODO: optimize all these data copies +void GeometryUnion::set(const PxGeometry& g) +{ + // PT: preserve this field that can be used by higher-level code to store useful data + const float saved = reinterpret_cast(mGeometry).mTypePadding; + + switch(g.getType()) + { + case PxGeometryType::eBOX: + { + reinterpret_cast(mGeometry) = static_cast(g); + } + break; + + case PxGeometryType::eCAPSULE: + { + reinterpret_cast(mGeometry) = static_cast(g); + } + break; + + case PxGeometryType::eSPHERE: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).halfHeight = 0.0f; //AM: make sphere geometry also castable as a zero height capsule. + } + break; + + case PxGeometryType::ePLANE: + { + reinterpret_cast(mGeometry) = static_cast(g); + } + break; + + case PxGeometryType::eCONVEXMESH: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).gpuCompatible = ::getConvexMesh(get().convexMesh).isGpuCompatible(); + } + break; + + case PxGeometryType::ePARTICLESYSTEM: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).materialsLL = MaterialIndicesStruct(); + } + break; + + case PxGeometryType::eTRIANGLEMESH: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).materialsLL = MaterialIndicesStruct(); + } + break; + + case PxGeometryType::eTETRAHEDRONMESH: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).materialsLL = MaterialIndicesStruct(); + } + break; + + case PxGeometryType::eHEIGHTFIELD: + { + reinterpret_cast(mGeometry) = static_cast(g); + reinterpret_cast(mGeometry).materialsLL = MaterialIndicesStruct(); + } + break; + + case PxGeometryType::eHAIRSYSTEM: + { + reinterpret_cast(mGeometry) = static_cast(g); + } + break; + + case PxGeometryType::eCUSTOM: + { + reinterpret_cast(mGeometry) = static_cast(g); + } + break; + + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + PX_ALWAYS_ASSERT_MESSAGE("geometry type not handled"); + break; + } + + reinterpret_cast(mGeometry).mTypePadding = saved; +} + +static PxConvexMeshGeometryLL extendForLL(const PxConvexMeshGeometry& hlGeom) +{ + PxConvexMeshGeometryLL llGeom; + static_cast(llGeom) = hlGeom; + + llGeom.gpuCompatible = hlGeom.convexMesh->isGpuCompatible(); + + return llGeom; +} + +static PxTriangleMeshGeometryLL extendForLL(const PxTriangleMeshGeometry& hlGeom) +{ + PxTriangleMeshGeometryLL llGeom; + static_cast(llGeom) = hlGeom; + + llGeom.materialsLL = static_cast(hlGeom).materialsLL; + + return llGeom; +} + +static PxHeightFieldGeometryLL extendForLL(const PxHeightFieldGeometry& hlGeom) +{ + PxHeightFieldGeometryLL llGeom; + static_cast(llGeom) = hlGeom; + + llGeom.materialsLL = static_cast(hlGeom).materialsLL; + + return llGeom; +} + +ShapeCore::ShapeCore(const PxGeometry& geometry, PxShapeFlags shapeFlags, const PxU16* materialIndices, PxU16 materialCount, bool isExclusive, + PxShapeCoreFlag::Enum softOrClothFlags) : + mSimAndIsExclusive (NULL) +{ + mCore.mShapeCoreFlags |= PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY; + if(isExclusive) + mCore.mShapeCoreFlags |= PxShapeCoreFlag::eIS_EXCLUSIVE; + + mCore.mShapeCoreFlags |= softOrClothFlags; + + PX_ASSERT(materialCount > 0); + + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + mCore.mGeometry.set(geometry); + mCore.setTransform(PxTransform(PxIdentity)); + mCore.mContactOffset = 0.02f * scale.length; + mCore.mRestOffset = 0.0f; + mCore.mTorsionalRadius = 0.0f; + mCore.mMinTorsionalPatchRadius = 0.0f; + mCore.mShapeFlags = shapeFlags; + + mSimAndIsExclusive = reinterpret_cast(size_t(isExclusive ? 1 : 0)); + + setMaterialIndices(materialIndices, materialCount); +} + +// PX_SERIALIZATION +ShapeCore::ShapeCore(const PxEMPTY) : + mSimulationFilterData (PxEmpty), + mCore (PxEmpty), + mSimAndIsExclusive (NULL) +{ + mCore.mShapeCoreFlags.clear(PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY); +} +//~PX_SERIALIZATION + +static PX_FORCE_INLINE const MaterialIndicesStruct* getMaterials(const GeometryUnion& gu) +{ + const PxGeometryType::Enum type = gu.getType(); + if(type == PxGeometryType::eTRIANGLEMESH) + return &gu.get().materialsLL; + else if(type == PxGeometryType::eHEIGHTFIELD) + return &gu.get().materialsLL; + else if(type == PxGeometryType::eTETRAHEDRONMESH) + return &gu.get().materialsLL; + else if(type == PxGeometryType::ePARTICLESYSTEM) + return &gu.get().materialsLL; + else + return NULL; +} + +ShapeCore::~ShapeCore() +{ + if(mCore.mShapeCoreFlags.isSet(PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY)) + { + MaterialIndicesStruct* materialsLL = const_cast(getMaterials(mCore.mGeometry)); + if(materialsLL) + materialsLL->deallocate(); + } +} + +PxU16 Sc::ShapeCore::getNbMaterialIndices() const +{ + const MaterialIndicesStruct* materialsLL = getMaterials(mCore.mGeometry); + return materialsLL ? materialsLL->numIndices : 1; +} + +const PxU16* Sc::ShapeCore::getMaterialIndices() const +{ + const MaterialIndicesStruct* materialsLL = getMaterials(mCore.mGeometry); + return materialsLL ? materialsLL->indices : &mCore.mMaterialIndex; +} + +PX_FORCE_INLINE void setMaterialsHelper(MaterialIndicesStruct& materials, const PxU16* materialIndices, PxU16 materialIndexCount, PxShapeCoreFlags& shapeCoreFlags) +{ + if(materials.numIndices < materialIndexCount) + { + if(materials.indices && shapeCoreFlags.isSet(PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY)) + materials.deallocate(); + materials.allocate(materialIndexCount); + shapeCoreFlags |= PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY; + } + PxMemCopy(materials.indices, materialIndices, sizeof(PxU16)*materialIndexCount); + materials.numIndices = materialIndexCount; +} + +void ShapeCore::setMaterialIndices(const PxU16* materialIndices, PxU16 materialIndexCount) +{ + mCore.mMaterialIndex = materialIndices[0]; + + MaterialIndicesStruct* materialsLL = const_cast(getMaterials(mCore.mGeometry)); + if(materialsLL) + setMaterialsHelper(*materialsLL, materialIndices, materialIndexCount, mCore.mShapeCoreFlags); +} + +void ShapeCore::setGeometry(const PxGeometry& geom) +{ + const PxGeometryType::Enum newGeomType = geom.getType(); + + // copy material related data to restore it after the new geometry has been set + MaterialIndicesStruct materials; + PX_ASSERT(materials.numIndices == 0); + + const MaterialIndicesStruct* materialsLL = getMaterials(mCore.mGeometry); + if(materialsLL) + materials = *materialsLL; + + mCore.mGeometry.set(geom); + + if((newGeomType == PxGeometryType::eTRIANGLEMESH) || (newGeomType == PxGeometryType::eHEIGHTFIELD) + || (newGeomType == PxGeometryType::eTETRAHEDRONMESH)|| (newGeomType == PxGeometryType::ePARTICLESYSTEM)) + { + MaterialIndicesStruct* newMaterials = const_cast(getMaterials(mCore.mGeometry)); + PX_ASSERT(newMaterials); + + if(materials.numIndices != 0) // old type was mesh type + *newMaterials = materials; + else + { // old type was non-mesh type + newMaterials->allocate(1); + *newMaterials->indices = mCore.mMaterialIndex; + mCore.mShapeCoreFlags |= PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY; + } + } + else if((materials.numIndices != 0) && mCore.mShapeCoreFlags.isSet(PxShapeCoreFlag::eOWNS_MATERIAL_IDX_MEMORY)) + { + // geometry changed to non-mesh type + materials.deallocate(); + } +} + +PxShape* ShapeCore::getPxShape() +{ + return Sc::gOffsetTable.convertScShape2Px(this); +} + +const PxShape* ShapeCore::getPxShape() const +{ + return Sc::gOffsetTable.convertScShape2Px(this); +} + +void ShapeCore::setContactOffset(const PxReal offset) +{ + mCore.mContactOffset = offset; + + ShapeSim* sim = getSim(); + + if (sim) + { + sim->getScene().updateContactDistance(sim->getElementID(), offset); + } +} + +// PX_SERIALIZATION + +PX_FORCE_INLINE void exportExtraDataMaterials(PxSerializationContext& stream, const MaterialIndicesStruct& materials) +{ + stream.alignData(PX_SERIAL_ALIGN); + stream.writeData(materials.indices, sizeof(PxU16)*materials.numIndices); +} + +void ShapeCore::exportExtraData(PxSerializationContext& stream) +{ + const MaterialIndicesStruct* materialsLL = getMaterials(mCore.mGeometry); + if(materialsLL) + exportExtraDataMaterials(stream, *materialsLL); +} + +void ShapeCore::importExtraData(PxDeserializationContext& context) +{ + MaterialIndicesStruct* materialsLL = const_cast(getMaterials(mCore.mGeometry)); + if(materialsLL) + materialsLL->indices = context.readExtraData(materialsLL->numIndices); +} + +void ShapeCore::resolveMaterialReference(PxU32 materialTableIndex, PxU16 materialIndex) +{ + if(materialTableIndex == 0) + mCore.mMaterialIndex = materialIndex; + + MaterialIndicesStruct* materialsLL = const_cast(getMaterials(mCore.mGeometry)); + if(materialsLL) + materialsLL->indices[materialTableIndex] = materialIndex; +} + +void ShapeCore::resolveReferences(PxDeserializationContext& context) +{ + // Resolve geometry pointers if needed + PxGeometry& geom = const_cast(mCore.mGeometry.getGeometry()); + + switch(geom.getType()) + { + case PxGeometryType::eCONVEXMESH: + { + PxConvexMeshGeometryLL& convexGeom = static_cast(geom); + context.translatePxBase(convexGeom.convexMesh); + + // update the hullData pointer + static_cast(geom) = extendForLL(convexGeom); + } + break; + + case PxGeometryType::eHEIGHTFIELD: + { + PxHeightFieldGeometryLL& hfGeom = static_cast(geom); + context.translatePxBase(hfGeom.heightField); + + // update hf pointers + static_cast(geom) = extendForLL(hfGeom); + } + break; + + case PxGeometryType::eTRIANGLEMESH: + { + PxTriangleMeshGeometryLL& meshGeom = static_cast(geom); + context.translatePxBase(meshGeom.triangleMesh); + + // update mesh pointers + static_cast(geom) = extendForLL(meshGeom); + } + break; + case PxGeometryType::eTETRAHEDRONMESH: + case PxGeometryType::ePARTICLESYSTEM: + case PxGeometryType::eHAIRSYSTEM: + case PxGeometryType::eCUSTOM: + { + // implement + PX_ASSERT(0); + } + break; + case PxGeometryType::eSPHERE: + case PxGeometryType::ePLANE: + case PxGeometryType::eCAPSULE: + case PxGeometryType::eBOX: + case PxGeometryType::eGEOMETRY_COUNT: + case PxGeometryType::eINVALID: + break; + } +} + +//~PX_SERIALIZATION diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp new file mode 100644 index 0000000..350d196 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.cpp @@ -0,0 +1,1200 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScShapeInteraction.h" +#if PX_SUPPORT_GPU_PHYSX +#include "ScParticleSystemSim.h" +#endif + +using namespace physx; + +static PX_FORCE_INLINE bool isParticleSystem(const PxActorType::Enum actorType) +{ + return actorType == PxActorType::ePBD_PARTICLESYSTEM || actorType == PxActorType::eFLIP_PARTICLESYSTEM + || actorType == PxActorType::eMPM_PARTICLESYSTEM || actorType == PxActorType::eCUSTOM_PARTICLESYSTEM; +} + +Sc::ShapeInteraction::ShapeInteraction(ShapeSimBase& s1, ShapeSimBase& s2, PxPairFlags pairFlags, PxsContactManager* contactManager) : + ElementSimInteraction (s1, s2, InteractionType::eOVERLAP, InteractionFlag::eRB_ELEMENT|InteractionFlag::eFILTERABLE), + mActorPair (NULL), + mManager (NULL), + mContactReportStamp (PX_INVALID_U32), + mReportPairIndex (INVALID_REPORT_PAIR_ID), + mEdgeIndex (IG_INVALID_EDGE), + mReportStreamIndex (0) +{ + mFlags = 0; + + // The PxPairFlags get stored in the SipFlag, make sure any changes get noticed + PX_COMPILE_TIME_ASSERT(PxPairFlag::eSOLVE_CONTACT == (1<<0)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eMODIFY_CONTACTS == (1<<1)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_FOUND == (1<<2)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_PERSISTS == (1<<3)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_LOST == (1<<4)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_CCD == (1<<5)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND == (1<<6)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS == (1<<7)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST == (1<<8)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_CONTACT_POINTS == (1<<9)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eDETECT_DISCRETE_CONTACT == (1<<10)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eDETECT_CCD_CONTACT == (1<<11)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::ePRE_SOLVER_VELOCITY == (1<<12)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::ePOST_SOLVER_VELOCITY == (1<<13)); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eCONTACT_EVENT_POSE == (1<<14)); + PX_COMPILE_TIME_ASSERT((PAIR_FLAGS_MASK & PxPairFlag::eSOLVE_CONTACT) == PxPairFlag::eSOLVE_CONTACT); + PX_COMPILE_TIME_ASSERT((PxPairFlag::eSOLVE_CONTACT | PAIR_FLAGS_MASK) == PAIR_FLAGS_MASK); + PX_COMPILE_TIME_ASSERT((PAIR_FLAGS_MASK & PxPairFlag::eCONTACT_EVENT_POSE) == PxPairFlag::eCONTACT_EVENT_POSE); + PX_COMPILE_TIME_ASSERT((PxPairFlag::eCONTACT_EVENT_POSE | PAIR_FLAGS_MASK) == PAIR_FLAGS_MASK); + + setPairFlags(pairFlags); + + //Add a fresh edge to the island manager. + Scene& scene = getScene(); + //Sc::BodySim* bs0 = getShape0().getBodySim(); + //Sc::BodySim* bs1 = getShape1().getBodySim(); + + Sc::ActorSim& bs0 = getShape0().getActor(); + Sc::ActorSim& bs1 = getShape1().getActor(); + + updateFlags(scene, bs0, bs1, pairFlags); + + if(contactManager == NULL) + { + PxNodeIndex indexA, indexB; + //if(bs0) // the first shape always belongs to a dynamic body (we assert for this above) + { + indexA = bs0.getNodeIndex(); + bs0.registerCountedInteraction(); + } + if(!bs1.isStaticRigid()) + { + indexB = bs1.getNodeIndex(); + bs1.registerCountedInteraction(); + } + + IG::SimpleIslandManager* simpleIslandManager = scene.getSimpleIslandManager(); + + PxActorType::Enum actorTypeLargest = PxMax(bs0.getActorType(), bs1.getActorType()); + + IG::Edge::EdgeType type = IG::Edge::eCONTACT_MANAGER; + if (actorTypeLargest == PxActorType::eSOFTBODY) + type = IG::Edge::eSOFT_BODY_CONTACT; + if (actorTypeLargest == PxActorType::eFEMCLOTH) + type = IG::Edge::eFEM_CLOTH_CONTACT; + else if (isParticleSystem(actorTypeLargest)) + type = IG::Edge::ePARTICLE_SYSTEM_CONTACT; + else if (actorTypeLargest == PxActorType::eHAIRSYSTEM) + type = IG::Edge::eHAIR_SYSTEM_CONTACT; + + mEdgeIndex = simpleIslandManager->addContactManager(NULL, indexA, indexB, this, type); + + const bool active = registerInActors(contactManager); // this will call onActivate_() on the interaction + scene.getNPhaseCore()->registerInteraction(this); + scene.registerInteraction(this, active); + + //If it is a soft body or particle overlap, treat it as a contact for now (we can hook up touch found/lost events later maybe) + if (actorTypeLargest > PxActorType::eARTICULATION_LINK) + simpleIslandManager->setEdgeConnected(mEdgeIndex, type); + } + else + { + onActivate_(contactManager); + } +} + +Sc::ShapeInteraction::~ShapeInteraction() +{ + Sc::ActorSim* body0 = &getShape0().getActor(); + Sc::ActorSim* body1 = &getShape1().getActor(); + + body0->unregisterCountedInteraction(); + if (body1) + body1->unregisterCountedInteraction(); + + if(mManager) + destroyManager(); + + if(mEdgeIndex != IG_INVALID_EDGE) + { + Scene& scene = getScene(); + + scene.getSimpleIslandManager()->removeConnection(mEdgeIndex); + mEdgeIndex = IG_INVALID_EDGE; + + scene.unregisterInteraction(this); + scene.getNPhaseCore()->unregisterInteraction(this); + } + + // This will remove the interaction from the actors list, which will prevent + // update calls to this actor because of Body::wakeUp below. + unregisterFromActors(); + + if(mReportPairIndex != INVALID_REPORT_PAIR_ID) + removeFromReportPairList(); +} + +void Sc::ShapeInteraction::clearIslandGenData() +{ + if(mEdgeIndex != IG_INVALID_EDGE) + { + Scene& scene = getScene(); + scene.getSimpleIslandManager()->removeConnection(mEdgeIndex); + mEdgeIndex = IG_INVALID_EDGE; + } +} + +void Sc::ShapeInteraction::visualize(PxRenderOutput& out, PxsContactManagerOutputIterator& outputs, + float scale, float param_contactForce, float param_contactNormal, float param_contactError, float param_contactPoint) +{ + if(mManager) // sleeping pairs have no contact points -> do not visualize + { + Sc::ActorSim* actorSim0 = &getShape0().getActor(); + Sc::ActorSim* actorSim1 = &getShape1().getActor(); + if(!actorSim0->isNonRigid() && !actorSim1->isNonRigid()) + { + PxU32 offset; + PxU32 nextOffset = 0; + do + { + const void* contactPatches; + const void* contactPoints; + PxU32 contactDataSize; + PxU32 contactPointCount; + PxU32 contactPatchCount; + const PxReal* impulses; + + offset = nextOffset; + nextOffset = getContactPointData(contactPatches, contactPoints, contactDataSize, contactPointCount, contactPatchCount, impulses, offset, outputs); + + const PxU32* faceIndices = reinterpret_cast(impulses + contactPointCount); + PxContactStreamIterator iter(reinterpret_cast(contactPatches), reinterpret_cast(contactPoints), faceIndices, contactPatchCount, contactPointCount); + + PxU32 i = 0; + while(iter.hasNextPatch()) + { + iter.nextPatch(); + while(iter.hasNextContact()) + { + iter.nextContact(); + + if((param_contactForce != 0.0f) && impulses) + { + out << PxU32(PxDebugColor::eARGB_RED); + out.outputSegment(iter.getContactPoint(), iter.getContactPoint() + iter.getContactNormal() * (scale * param_contactForce * impulses[i])); + } + else if(param_contactNormal != 0.0f) + { + out << PxU32(PxDebugColor::eARGB_BLUE); + out.outputSegment(iter.getContactPoint(), iter.getContactPoint() + iter.getContactNormal() * (scale * param_contactNormal)); + } + else if(param_contactError != 0.0f) + { + out << PxU32(PxDebugColor::eARGB_YELLOW); + out.outputSegment(iter.getContactPoint(), iter.getContactPoint() + iter.getContactNormal() * PxAbs(scale * param_contactError * PxMin(0.f, iter.getSeparation()))); + } + + if(param_contactPoint != 0.0f) + { + const PxReal s = scale * 0.1f; + const PxVec3& point = iter.getContactPoint(); + + //if (0) //temp debug to see identical contacts + // point.x += scale * 0.01f * (contactPointCount - i + 1); + + out << PxU32(PxDebugColor::eARGB_RED); + out.outputSegment(point + PxVec3(-s, 0, 0), point + PxVec3(s, 0, 0)); + out.outputSegment(point + PxVec3(0, -s, 0), point + PxVec3(0, s, 0)); + out.outputSegment(point + PxVec3(0, 0, -s), point + PxVec3(0, 0, s)); + } + i++; + } + } + } while (nextOffset != offset); + } + } +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::processReportPairOnActivate() +{ + PX_ASSERT(isReportPair()); + PX_ASSERT(mReportPairIndex == INVALID_REPORT_PAIR_ID); + + if(readFlag(WAS_IN_PERSISTENT_EVENT_LIST)) + { + getScene().getNPhaseCore()->addToPersistentContactEventPairs(this); + mFlags &= ~WAS_IN_PERSISTENT_EVENT_LIST; + } +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::processReportPairOnDeactivate() +{ + PX_ASSERT(isReportPair()); + PX_ASSERT(mReportPairIndex != INVALID_REPORT_PAIR_ID); + PX_COMPILE_TIME_ASSERT(IS_IN_PERSISTENT_EVENT_LIST == (WAS_IN_PERSISTENT_EVENT_LIST >> 1)); + PX_ASSERT(!(readFlag(WAS_IN_PERSISTENT_EVENT_LIST))); + + const PxU32 wasInPersList = (mFlags & IS_IN_PERSISTENT_EVENT_LIST) << 1; + mFlags |= wasInPersList; + + removeFromReportPairList(); +} + +void Sc::ShapeInteraction::setContactReportPostSolverVelocity(ContactStreamManager& cs) +{ + Scene& scene = getScene(); + NPhaseCore* npcore = scene.getNPhaseCore(); + PxU8* stream = npcore->getContactReportPairData(cs.bufferIndex); + + ActorPairReport& apr = getActorPairReport(); + cs.setContactReportPostSolverVelocity(stream, apr.getActorA(), apr.getActorB()); +} + +void Sc::ShapeInteraction::resetManagerCachedState() const +{ + if(mManager) + { + Sc::Scene& scene = getScene(); + PxvNphaseImplementationContext* nphaseImplementationContext = scene.getLowLevelContext()->getNphaseImplementationContext(); + PX_ASSERT(nphaseImplementationContext); + + mManager->resetCachedState(); + nphaseImplementationContext->refreshContactManager(mManager); + } +} + +/* + This method can be called from various stages in the pipeline, some of which operate before the actor has advanced its pose and some after it has advanced its pose. + Discrete touch found events operate before the pose has been updated. This is because we are using the found event to active the bodies before solve so that we can just + solve the activated bodies. + Lost touch events occur after the pose has been updated. +*/ +void Sc::ShapeInteraction::processUserNotificationSync() +{ + PX_ASSERT(hasTouch()); + + if(mManager) + PxPrefetchLine(mManager); + + // make sure shape A and shape B are the same way round as the actors (in compounds they may be swapped) + // TODO: make "unswapped" a SIP flag and set it in updateState() + if(!mActorPair) + return; + + NPhaseCore* npcore = getScene().getNPhaseCore(); + + ActorPairReport& aPairReport = getActorPairReport(); + + if(!aPairReport.isInContactReportActorPairSet()) + { + aPairReport.setInContactReportActorPairSet(); + npcore->addToContactReportActorPairSet(&aPairReport); + aPairReport.incRefCount(); + } + + aPairReport.createContactStreamManager(*npcore); +} + +void Sc::ShapeInteraction::processUserNotificationAsync(PxU32 contactEvent, PxU16 infoFlags, bool touchLost, + const PxU32 ccdPass, const bool useCurrentTransform, PxsContactManagerOutputIterator& outputs, ContactReportAllocationManager* alloc) +{ + contactEvent = (!ccdPass) ? contactEvent : (contactEvent | PxPairFlag::eNOTIFY_TOUCH_CCD); + + if(!mActorPair) + return; + + ActorPairReport& aPairReport = getActorPairReport(); + Scene& scene = getScene(); + NPhaseCore* npcore = scene.getNPhaseCore(); + ContactStreamManager& cs = aPairReport.createContactStreamManager(*npcore); + // Prepare user notification + const PxU32 timeStamp = scene.getTimeStamp(); + const PxU32 shapePairTimeStamp = scene.getReportShapePairTimeStamp(); + + const PxU32 pairFlags = getPairFlags(); + PX_ASSERT(pairFlags & contactEvent); + + const PxU32 extraDataFlags = pairFlags & CONTACT_REPORT_EXTRA_DATA; + + PxU8* stream = NULL; + ContactShapePair* pairStream = NULL; + + const bool unswapped = &aPairReport.getActorA() == &getShape0().getActor(); + const Sc::ShapeSimBase& shapeA = unswapped ? getShape0() : getShape1(); + const Sc::ShapeSimBase& shapeB = unswapped ? getShape1() : getShape0(); + + if(aPairReport.streamResetStamp(timeStamp)) + { + PX_ASSERT(mContactReportStamp != shapePairTimeStamp); // actor pair and shape pair timestamps must both be out of sync in this case + + PxU16 maxCount; + if(cs.maxPairCount != 0) + maxCount = cs.maxPairCount; // use value from previous report + else + { + // TODO: Use some kind of heuristic + maxCount = 2; + cs.maxPairCount = maxCount; + } + + PxU32 maxExtraDataSize; + if(!extraDataFlags || touchLost) + { + maxExtraDataSize = 0; + cs.setMaxExtraDataSize(maxExtraDataSize); + } + else + { + PxU32 currentMaxExtraDataSize = cs.getMaxExtraDataSize(); + maxExtraDataSize = ContactStreamManager::computeContactReportExtraDataSize(extraDataFlags, true); + PX_ASSERT(maxExtraDataSize > 0); + if(maxExtraDataSize <= currentMaxExtraDataSize) + maxExtraDataSize = currentMaxExtraDataSize; // use value from previous report + else + cs.setMaxExtraDataSize(maxExtraDataSize); + } + + stream = npcore->reserveContactReportPairData(maxCount, maxExtraDataSize, cs.bufferIndex, alloc); + + if(!maxExtraDataSize) // this is the usual case, so set it first for branch prediction + cs.reset(); + else if(stream) + { + cs.reset(); + PX_ASSERT(extraDataFlags); + PX_ASSERT(!touchLost); + + cs.fillInContactReportExtraData(stream, extraDataFlags, aPairReport.getActorA(), aPairReport.getActorB(), ccdPass, useCurrentTransform, 0, sizeof(ContactStreamHeader)); + if((extraDataFlags & PxPairFlag::ePOST_SOLVER_VELOCITY) && (pairFlags & PxPairFlag::eDETECT_CCD_CONTACT)) + scene.setPostSolverVelocityNeeded(); + } + } + else + { + const PxU32 currentPairCount = cs.currentPairCount; + if(currentPairCount != 0) + { + PxU8* tmpStreamPtr = npcore->getContactReportPairData(cs.bufferIndex); + if(!extraDataFlags) + stream = tmpStreamPtr; // this is the usual case, so set it first for branch prediction + else + { + if(!touchLost) + { + // - the first few shape pair events might not request extra data + // - the events so far were due to touch lost + // - multiple reports due to CCD multiple passes + // Hence, the extra data has to be created/extended now. + // + const PxU16 oldExtraDataSize = cs.extraDataSize; + PxI32 lastContactPass; + if(oldExtraDataSize) + { + ContactStreamHeader* strHeader = reinterpret_cast(tmpStreamPtr); + lastContactPass = strHeader->contactPass; + } + else + lastContactPass = -1; + + if(PxI32(ccdPass) > lastContactPass) // do not send extra data mulitple times for the same contact pass + { + const PxU16 extraDataSize = PxU16(oldExtraDataSize + ContactStreamManager::computeContactReportExtraDataSize(extraDataFlags, (oldExtraDataSize == 0))); + PxU8* strPtr; + if (extraDataSize <= cs.getMaxExtraDataSize()) + strPtr = tmpStreamPtr; + else + strPtr = npcore->resizeContactReportPairData(currentPairCount < cs.maxPairCount ? cs.maxPairCount : PxU32(cs.maxPairCount+1), extraDataSize, cs); + // the check for max pair count is there to avoid another potential allocation further below + + if(strPtr) + { + stream = strPtr; + PxU32 sizeOffset; + if(oldExtraDataSize) + sizeOffset = oldExtraDataSize; + else + sizeOffset = sizeof(ContactStreamHeader); + cs.fillInContactReportExtraData(strPtr, extraDataFlags, aPairReport.getActorA(), aPairReport.getActorB(), ccdPass, useCurrentTransform, currentPairCount, sizeOffset); + if((extraDataFlags & PxPairFlag::ePOST_SOLVER_VELOCITY) && (pairFlags & PxPairFlag::eDETECT_CCD_CONTACT)) + scene.setPostSolverVelocityNeeded(); + } + else + { + stream = tmpStreamPtr; + cs.raiseFlags(ContactStreamManagerFlag::eINCOMPLETE_STREAM); + } + } + else + stream = tmpStreamPtr; + } + else + stream = tmpStreamPtr; + } + } + } + + if(stream) + pairStream = cs.getShapePairs(stream); + else + { + cs.raiseFlags(ContactStreamManagerFlag::eINVALID_STREAM); + return; + } + + ContactShapePair* cp; + if(mContactReportStamp != shapePairTimeStamp) + { + // this shape pair is not in the contact notification stream yet + + if(cs.currentPairCount < cs.maxPairCount) + cp = pairStream + cs.currentPairCount; + else + { + const PxU32 newSize = PxU32(cs.currentPairCount + (cs.currentPairCount >> 1) + 1); + stream = npcore->resizeContactReportPairData(newSize, cs.getMaxExtraDataSize(), cs); + if(stream) + { + pairStream = cs.getShapePairs(stream); + cp = pairStream + cs.currentPairCount; + } + else + { + cs.raiseFlags(ContactStreamManagerFlag::eINCOMPLETE_STREAM); + return; + } + } + + //!!! why is alignment important here? Looks almost like some refactor nonsense + PX_ASSERT(0==(reinterpret_cast(stream) & 0x0f)); // check 16Byte alignment + + mReportStreamIndex = cs.currentPairCount; + cp->shapes[0] = shapeA.getPxShape(); + cp->shapes[1] = shapeB.getPxShape(); + cp->contactPatches = NULL; + cp->contactPoints = NULL; + cp->contactForces = NULL; + cp->contactCount = 0; + cp->patchCount = 0; + cp->constraintStreamSize = 0; + cp->requiredBufferSize = 0; + cp->flags = infoFlags; + PX_ASSERT(contactEvent <= 0xffff); + cp->events = PxU16(contactEvent); + cp->shapeID[0] = shapeA.getElementID(); + cp->shapeID[1] = shapeB.getElementID(); + + cs.currentPairCount++; + + mContactReportStamp = shapePairTimeStamp; + } + else + { + // this shape pair is in the contact notification stream already but there is a second event (can happen with force threshold reports, for example). + + PX_ASSERT(mReportStreamIndex < cs.currentPairCount); + cp = &pairStream[mReportStreamIndex]; + cp->events |= contactEvent; + if(touchLost && cp->events & PxPairFlag::eNOTIFY_TOUCH_PERSISTS) + cp->events &= PxU16(~PxPairFlag::eNOTIFY_TOUCH_PERSISTS); + cp->flags |= infoFlags; + } + + if((getPairFlags() & PxPairFlag::eNOTIFY_CONTACT_POINTS) && mManager && (!cp->contactPatches) && !(contactEvent & PxU32(PxPairFlag::eNOTIFY_TOUCH_LOST | PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST))) + { + const PxcNpWorkUnit& workUnit = mManager->getWorkUnit(); + PxsContactManagerOutput* output = NULL; + if(workUnit.mNpIndex & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK) + output = &getScene().getLowLevelContext()->getNphaseImplementationContext()->getNewContactManagerOutput(workUnit.mNpIndex); + else + output = &outputs.getContactManager(workUnit.mNpIndex); + + const PxsCCDContactHeader* ccdContactData = reinterpret_cast(workUnit.ccdContacts); + + const bool isCCDPass = (ccdPass != 0); + if((output->nbPatches && !isCCDPass) || (ccdContactData && (!ccdContactData->isFromPreviousPass) && isCCDPass)) + { + const PxU8* contactPatchData; + const PxU8* contactPointData; + PxU32 cDataSize; + PxU32 alignedContactDataSize; + const PxReal* impulses; + + PxU32 nbPoints = output->nbContacts; + PxU32 contactPatchCount = output->nbPatches; + + if(!isCCDPass) + { + PX_ASSERT(0==(reinterpret_cast(output->contactPatches) & 0x0f)); // check 16Byte alignment + contactPatchData = output->contactPatches; + contactPointData = output->contactPoints; + cDataSize = sizeof(PxContactPatch)*output->nbPatches + sizeof(PxContact)*output->nbContacts; + alignedContactDataSize = (cDataSize + 0xf) & 0xfffffff0; + impulses = output->contactForces; + } + else + { + PX_ASSERT(0==(reinterpret_cast(ccdContactData) & 0x0f)); // check 16Byte alignment + contactPatchData = reinterpret_cast(ccdContactData) + sizeof(PxsCCDContactHeader); + contactPointData = contactPatchData + sizeof(PxContactPatch); + cDataSize = ccdContactData->contactStreamSize - sizeof(PxsCCDContactHeader); + PxU32 tmpAlignedSize = (ccdContactData->contactStreamSize + 0xf) & 0xfffffff0; + alignedContactDataSize = tmpAlignedSize - sizeof(PxsCCDContactHeader); + impulses = reinterpret_cast(contactPatchData + alignedContactDataSize); + nbPoints = 1; + contactPatchCount = 1; + } + + infoFlags = cp->flags; + infoFlags |= unswapped ? 0 : PxContactPairFlag::eINTERNAL_CONTACTS_ARE_FLIPPED; + + //PX_ASSERT(0==(reinterpret_cast(impulses) & 0x0f)); + + const PxU32 impulseSize = impulses ? (nbPoints * sizeof(PxReal)) : 0; + if(impulseSize) + infoFlags |= PxContactPairFlag::eINTERNAL_HAS_IMPULSES; + cp->contactPatches = contactPatchData; + cp->contactPoints = contactPointData; + cp->contactCount = PxTo8(nbPoints); + cp->patchCount = PxTo8(contactPatchCount); + cp->constraintStreamSize = PxTo16(cDataSize); + cp->requiredBufferSize = alignedContactDataSize + impulseSize; + cp->contactForces = impulses; + + cp->flags = infoFlags; + } + } +} + +void Sc::ShapeInteraction::processUserNotification(PxU32 contactEvent, PxU16 infoFlags, bool touchLost, const PxU32 ccdPass, const bool useCurrentTransform, PxsContactManagerOutputIterator& outputs) +{ + processUserNotificationSync(); + processUserNotificationAsync(contactEvent, infoFlags, touchLost, ccdPass, useCurrentTransform, outputs); +} + +PxU32 Sc::ShapeInteraction::getContactPointData(const void*& contactPatches, const void*& contactPoints, PxU32& contactDataSize, PxU32& contactPointCount, PxU32& numPatches, const PxReal*& impulses, PxU32 startOffset, + PxsContactManagerOutputIterator& outputs) +{ + // Process LL generated contacts + if(mManager != NULL) + { + const PxcNpWorkUnit& workUnit = mManager->getWorkUnit(); + + PxsContactManagerOutput* output = NULL; + + if(workUnit.mNpIndex & PxsContactManagerBase::NEW_CONTACT_MANAGER_MASK) + output = &getScene().getLowLevelContext()->getNphaseImplementationContext()->getNewContactManagerOutput(workUnit.mNpIndex); + else + output = &outputs.getContactManager(workUnit.mNpIndex); + + /*const void* dcdContactPatches; + const void* dcdContactPoints; + PxU32 dcdContactPatchCount; + const PxReal* dcdImpulses; + const PxsCCDContactHeader* ccdContactStream; + PxU32 dcdContactCount = mManager->getContactPointData(dcdContactPatches, dcdContactPoints, dcdContactPatchCount, dcdImpulses, ccdContactStream); + + PX_ASSERT(((dcdContactCount == 0) && (!ccdContactStream)) || ((dcdContactCount > 0) && hasTouch()) || (ccdContactStream && hasCCDTouch()));*/ + + const PxsCCDContactHeader* ccdContactStream = reinterpret_cast(workUnit.ccdContacts); + + PxU32 idx = 0; + if(output->nbContacts) + { + if(startOffset == 0) + { + contactPatches = output->contactPatches; + contactPoints = output->contactPoints; + contactDataSize = sizeof(PxContactPatch) * output->nbPatches + sizeof(PxContact) * output->nbContacts; + contactPointCount = output->nbContacts; + numPatches = output->nbPatches; + impulses = output->contactForces; + + if(!ccdContactStream) + return startOffset; + else + return (startOffset + 1); + } + + idx++; + } + + while(ccdContactStream) + { + if(startOffset == idx) + { + const PxU8* stream = reinterpret_cast(ccdContactStream); + PxU16 streamSize = ccdContactStream->contactStreamSize; + contactPatches = stream + sizeof(PxsCCDContactHeader); + contactPoints = stream + sizeof(PxsCCDContactHeader) + sizeof(PxContactPatch); + contactDataSize = streamSize - sizeof(PxsCCDContactHeader); + contactPointCount = 1; + numPatches = 1; + impulses = reinterpret_cast(stream + ((streamSize + 0xf) & 0xfffffff0)); + + if(!ccdContactStream->nextStream) + return startOffset; + else + return (startOffset + 1); + } + + idx++; + ccdContactStream = ccdContactStream->nextStream; + } + } + + contactPatches = NULL; + contactPoints = NULL; + contactDataSize = 0; + contactPointCount = 0; + numPatches = 0; + impulses = NULL; + return startOffset; +} + +// Note that LL will not send end touch events for managers that are destroyed while having contact +void Sc::ShapeInteraction::managerNewTouch(const PxU32 ccdPass, bool adjustCounters, PxsContactManagerOutputIterator& outputs) +{ + if(readFlag(HAS_TOUCH)) + return; // Do not count the touch twice (for instance when recreating a manager with touch) + // We have contact this frame + setHasTouch(); + + if(adjustCounters) + adjustCountersOnNewTouch(); + + if(!isReportPair()) + return; + else + { + PX_ASSERT(hasTouch()); + PX_ASSERT(!readFlag(IS_IN_PERSISTENT_EVENT_LIST)); + PX_ASSERT(!readFlag(IS_IN_FORCE_THRESHOLD_EVENT_LIST)); + + const PxU32 pairFlags = getPairFlags(); + if(pairFlags & PxPairFlag::eNOTIFY_TOUCH_FOUND) + { + PxU16 infoFlag = 0; + if(mActorPair->getTouchCount() == 1) // this code assumes that the actor pair touch count does get incremented beforehand + { + infoFlag = PxContactPairFlag::eACTOR_PAIR_HAS_FIRST_TOUCH; + } + + processUserNotification(PxPairFlag::eNOTIFY_TOUCH_FOUND, infoFlag, false, ccdPass, true, outputs); + } + + if(pairFlags & PxPairFlag::eNOTIFY_TOUCH_PERSISTS) + { + getScene().getNPhaseCore()->addToPersistentContactEventPairsDelayed(this); // to make sure that from now on, the pairs are tested for persistent contact events + } + else if(pairFlags & ShapeInteraction::CONTACT_FORCE_THRESHOLD_PAIRS) + { + // new touch -> need to start checking for force threshold events + // Note: this code assumes that it runs before the pairs get tested for force threshold exceeded + getScene().getNPhaseCore()->addToForceThresholdContactEventPairs(this); + } + } +} + + +bool Sc::ShapeInteraction::managerLostTouch(const PxU32 ccdPass, bool adjustCounters, PxsContactManagerOutputIterator& outputs) +{ + if(!readFlag(HAS_TOUCH)) + return false; + + // We do not have LL contacts this frame and also we lost LL contact this frame + + if(!isReportPair()) + { + setHasNoTouch(); + } + else + { + PX_ASSERT(hasTouch()); + + sendLostTouchReport(false, ccdPass, outputs); + + if(readFlag(IS_IN_CONTACT_EVENT_LIST)) + { + // don't need to worry about persistent/force-threshold contact events until next new touch + + if(readFlag(IS_IN_FORCE_THRESHOLD_EVENT_LIST)) + { + getScene().getNPhaseCore()->removeFromForceThresholdContactEventPairs(this); + } + else + { + PX_ASSERT(readFlag(IS_IN_PERSISTENT_EVENT_LIST)); + getScene().getNPhaseCore()->removeFromPersistentContactEventPairs(this); + } + + clearFlag(FORCE_THRESHOLD_EXCEEDED_FLAGS); + } + + setHasNoTouch(); + } + + ActorSim& body0 = getShape0().getActor(); + ActorSim& body1 = getShape1().getActor(); + + if(adjustCounters) + adjustCountersOnLostTouch(); + + if(body1.isStaticRigid()) + { + body0.internalWakeUp(); + return false; + } + return true; +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::updateFlags(const Sc::Scene& scene, const Sc::ActorSim& bs0, const Sc::ActorSim& bs1, const PxU32 pairFlags) +{ + // the first shape always belongs to a dynamic body/ a soft body + + bool enabled = true; + if (bs0.isDynamicRigid()) + { + const Sc::BodySim& body0 = static_cast(bs0); + enabled = !body0.isKinematic(); + } + + if (bs1.isDynamicRigid()) + { + const Sc::BodySim& body1 = static_cast(bs1); + enabled |= !body1.isKinematic(); + } + + // Check if collision response is disabled + enabled = enabled && (pairFlags & PxPairFlag::eSOLVE_CONTACT); + setFlag(CONTACTS_RESPONSE_DISABLED, !enabled); + + // Check if contact points needed + setFlag(CONTACTS_COLLECT_POINTS, ( (pairFlags & PxPairFlag::eNOTIFY_CONTACT_POINTS) || + (pairFlags & PxPairFlag::eMODIFY_CONTACTS) || + scene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_POINT) || + scene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_NORMAL) || + scene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_ERROR) || + scene.getVisualizationParameter(PxVisualizationParameter::eCONTACT_FORCE)) ); +} + +PX_INLINE PxReal ScGetRestOffset(const Sc::ShapeSimBase& shapeSim) +{ +#if PX_SUPPORT_GPU_PHYSX + if (shapeSim.getActor().isParticleSystem()) + return static_cast(shapeSim.getActor()).getCore().getRestOffset(); +#endif + return shapeSim.getRestOffset(); +} + +void Sc::ShapeInteraction::updateState(const PxU8 externalDirtyFlags) +{ + const PxU32 oldContactState = getManagerContactState(); + + const PxU8 dirtyFlags = PxU8(getDirtyFlags() | externalDirtyFlags); + const PxU32 pairFlags = getPairFlags(); + Scene& scene = getScene(); + IG::SimpleIslandManager* islandManager = scene.getSimpleIslandManager(); + + if(dirtyFlags & (InteractionDirtyFlag::eFILTER_STATE | InteractionDirtyFlag::eVISUALIZATION)) + { + Sc::ActorSim& bs0 = getShape0().getActor(); + Sc::ActorSim& bs1 = getShape1().getActor(); + + PxIntBool wasDisabled = readFlag(CONTACTS_RESPONSE_DISABLED); + + updateFlags(scene, bs0, bs1, pairFlags); + + PxIntBool isDisabled = readFlag(CONTACTS_RESPONSE_DISABLED); + + if(!wasDisabled && isDisabled) + { + islandManager->setEdgeDisconnected(mEdgeIndex); + } + else if(wasDisabled && !isDisabled) + { + if(readFlag(ShapeInteraction::HAS_TOUCH)) + islandManager->setEdgeConnected(mEdgeIndex, IG::Edge::eCONTACT_MANAGER); + } + } + + const PxU32 newContactState = getManagerContactState(); + const bool recreateManager = (oldContactState != newContactState); + + // No use in updating manager properties if the manager is going to be re-created or does not exist yet + if((!recreateManager) && (mManager != 0)) + { + ShapeSimBase& shapeSim0 = getShape0(); + ShapeSimBase& shapeSim1 = getShape1(); + + // Update dominance + if(dirtyFlags & InteractionDirtyFlag::eDOMINANCE) + { + Sc::ActorSim& bs0 = shapeSim0.getActor(); + Sc::ActorSim& bs1 = shapeSim1.getActor(); + + // Static actors are in dominance group zero and must remain there + const PxDominanceGroup dom0 = bs0.getActorCore().getDominanceGroup(); + const PxDominanceGroup dom1 = !bs1.isStaticRigid() ? bs1.getActorCore().getDominanceGroup() : PxDominanceGroup(0); + + const PxDominanceGroupPair cdom = getScene().getDominanceGroupPair(dom0, dom1); + mManager->setDominance0(cdom.dominance0); + mManager->setDominance1(cdom.dominance1); + } + + if (dirtyFlags & InteractionDirtyFlag::eBODY_KINEMATIC) + { + //Kinematic flags changed - clear flag for kinematic on the pair + Sc::ActorSim& bs1 = shapeSim1.getActor(); + if (bs1.isDynamicRigid()) + { + if (static_cast(bs1).isKinematic()) + mManager->getWorkUnit().flags |= PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR; + else + mManager->getWorkUnit().flags &= (~PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR); + } + } + + // Update skin width + if(dirtyFlags & InteractionDirtyFlag::eREST_OFFSET) + mManager->setRestDistance(ScGetRestOffset(shapeSim0) + ScGetRestOffset(shapeSim1)); + + //we may want to only write these if they have changed, the set code is a bit painful for the integration flags because of bit unpacking + packing. + mManager->setCCD((getPairFlags() & PxPairFlag::eDETECT_CCD_CONTACT) != 0); + + if(dirtyFlags) + resetManagerCachedState(); // this flushes changes through to the GPU + } + else if (readInteractionFlag(InteractionFlag::eIS_ACTIVE)) // only re-create the manager if the pair is active + { + PX_ASSERT(mManager); // if the pair is active, there has to be a manager + + if (dirtyFlags & InteractionDirtyFlag::eBODY_KINEMATIC) + { + //Kinematic->dynamic transition + const IG::IslandSim& islandSim = getScene().getSimpleIslandManager()->getSpeculativeIslandSim(); + + // + //check whether active in the speculative sim! + const ActorSim& bodySim0 = getShape0().getActor(); + const ActorSim& bodySim1 = getShape1().getActor(); + + if (!islandSim.getNode(bodySim0.getNodeIndex()).isActiveOrActivating() && + (bodySim1.isStaticRigid() || !islandSim.getNode(bodySim1.getNodeIndex()).isActiveOrActivating())) + { + onDeactivate_(); + scene.notifyInteractionDeactivated(this); + } + else + { + //Else we are allowed to be active, so recreate + if (mEdgeIndex != IG_INVALID_EDGE) + islandManager->clearEdgeRigidCM(mEdgeIndex); + destroyManager(); + createManager(NULL); + } + } + else + { + PX_ASSERT(activeManagerAllowed()); + + // A) This is a newly created pair + // + // B) The contact notification or processing state has changed. + // All existing managers need to be deleted and recreated with the correct flag set + // These flags can only be set at creation in LL + //KS - added this code here because it is no longer done in destroyManager() - a side-effect of the parallelization of the interaction management code + if (mEdgeIndex != IG_INVALID_EDGE) + islandManager->clearEdgeRigidCM(mEdgeIndex); + destroyManager(); + createManager(NULL); + } + } +} + +bool Sc::ShapeInteraction::onActivate_(void* contactManager) +{ + if(isReportPair()) + { + // for pairs that go through a second island pass, there is the possibility that they get put to sleep again after the second pass. + // So we do not want to check for re-insertion into the persistent report pair list yet. + processReportPairOnActivate(); + } + + if(updateManager(contactManager)) + { + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; + } + else + return false; +} + +bool Sc::ShapeInteraction::onDeactivate_() +{ + PX_ASSERT(!getShape0().getActor().isStaticRigid() || !getShape1().getActor().isStaticRigid()); + + const ActorSim& bodySim0 = getShape0().getActor(); + const ActorSim& bodySim1 = getShape1().getActor(); + + PX_ASSERT( (bodySim0.isStaticRigid() && !bodySim1.isStaticRigid() && !bodySim1.isActive()) || + (bodySim1.isStaticRigid() && !bodySim0.isStaticRigid() && !bodySim0.isActive()) || + ((!bodySim0.isStaticRigid() && !bodySim1.isStaticRigid() && (!bodySim0.isActive() || !bodySim1.isActive()))) ); + + if((!bodySim0.isActive()) && (bodySim1.isStaticRigid() || !bodySim1.isActive())) + { + if(mReportPairIndex != INVALID_REPORT_PAIR_ID) + processReportPairOnDeactivate(); + + PX_ASSERT((mManager->getTouchStatus() > 0) == (hasTouch() > 0)); + + Scene& scene = getScene(); + IG::SimpleIslandManager* islandManager = scene.getSimpleIslandManager(); + if(mManager) + { + if((!readFlag(TOUCH_KNOWN)) && mManager->touchStatusKnown() && (!mManager->getTouchStatus())) + { + // for pairs that are inserted asleep, we do not know the touch state. If they run through narrowphase and a touch is found, + // then a managerNewTouch() call will inform this object about the found touch. However, if narrowphase detects that there + // is no touch, this object will not be informed about it. The low level manager will always know though. Now, before destroying + // the pair manager, we need to record "does not have touch" state if available. + raiseFlag(HAS_NO_TOUCH); + } + + destroyManager(); + if(mEdgeIndex != IG_INVALID_EDGE) + islandManager->clearEdgeRigidCM(mEdgeIndex); + } + islandManager->deactivateEdge(mEdgeIndex); + + // + // We distinguish two scenarios here: + // + // A) island generation deactivates objects: + // -> the deactivated body was active + // -> narrowphase ran on this pair + // -> the touch status is known + // -> touch: the objects of the pair are in the same island + // -> no touch: the objects of the pair are in different islands + // + // As a consequence, the edge state is not changed. The assumption is that anything that could break the touch status + // from here on will have to mark the edges connected (for example if the object gets moved). + // + // B) user deactivates objects: + // -> the touch status might not be known (for example, the pose gets integrated after the solver which might cause a change + // in touch status. If the object gets put to sleep after that, we have to be conservative and mark the edge connected. + // other example: an active object gets moved by the user and then deactivated). + // + + clearInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; + } + else + { + return false; + } +} + +void Sc::ShapeInteraction::createManager(void* contactManager) +{ + //PX_PROFILE_ZONE("ShapeInteraction.createManager", 0); + + Sc::Scene& scene = getScene(); + + const PxU32 pairFlags = getPairFlags(); + + const int disableCCDContact = !(pairFlags & PxPairFlag::eDETECT_CCD_CONTACT); + + PxsContactManager* manager = scene.getLowLevelContext()->createContactManager(reinterpret_cast(contactManager), !disableCCDContact); + PxcNpWorkUnit& mNpUnit = manager->getWorkUnit(); + + // Check if contact generation callback has been ordered on the pair + int contactChangeable = 0; + if(pairFlags & PxPairFlag::eMODIFY_CONTACTS) + contactChangeable = 1; + + ShapeSimBase& shapeSim0 = getShape0(); + ShapeSimBase& shapeSim1 = getShape1(); + + const PxActorType::Enum type0 = shapeSim0.getActor().getActorType(); + const PxActorType::Enum type1 = shapeSim1.getActor().getActorType(); + + const int disableResponse = readFlag(CONTACTS_RESPONSE_DISABLED) ? 1 : 0; + const int disableDiscreteContact = !(pairFlags & PxPairFlag::eDETECT_DISCRETE_CONTACT); + const int reportContactInfo = readFlag(CONTACTS_COLLECT_POINTS); + const int hasForceThreshold = !disableResponse && (pairFlags & CONTACT_FORCE_THRESHOLD_PAIRS); + int touching; + if(readFlag(TOUCH_KNOWN)) + touching = readFlag(HAS_TOUCH) ? 1 : -1; + else + touching = 0; + + // Static actors are in dominance group zero and must remain there + + Sc::ActorSim& bs0 = shapeSim0.getActor(); + Sc::ActorSim& bs1 = shapeSim1.getActor(); + + const PxDominanceGroup dom0 = bs0.getActorCore().getDominanceGroup(); + const PxDominanceGroup dom1 = bs1.isStaticRigid() ? PxDominanceGroup(0) : bs1.getActorCore().getDominanceGroup(); + + const bool kinematicActor = bs1.isDynamicRigid() ? static_cast(bs1).isKinematic() : false; + + const PxDominanceGroupPair cdom = scene.getDominanceGroupPair(dom0, dom1); + + /*const PxI32 hasArticulations= (type0 == PxActorType::eARTICULATION_LINK) | (type1 == PxActorType::eARTICULATION_LINK)<<1; + const PxI32 hasDynamics = (type0 != PxActorType::eRIGID_STATIC) | (type1 != PxActorType::eRIGID_STATIC)<<1;*/ + + const PxsShapeCore* shapeCore0 = &shapeSim0.getCore().getCore(); + const PxsShapeCore* shapeCore1 = &shapeSim1.getCore().getCore(); + + //Initialize the manager.... + + manager->mRigidBody0 = bs0.isDynamicRigid() ? &static_cast(bs0).getLowLevelBody() : NULL; + manager->mRigidBody1 = bs1.isDynamicRigid() ? &static_cast(bs1).getLowLevelBody() : NULL; + manager->mShapeInteraction = this; + mNpUnit.shapeCore0 = shapeCore0; + mNpUnit.shapeCore1 = shapeCore1; + + PX_ASSERT(shapeCore0->getTransform().isValid() && shapeCore1->getTransform().isValid()); + + mNpUnit.rigidCore0 = !bs0.isNonRigid() ? &static_cast(shapeSim0).getPxsRigidCore() : NULL; + mNpUnit.rigidCore1 = !bs1.isNonRigid() ? &static_cast(shapeSim1).getPxsRigidCore() : NULL; + + mNpUnit.restDistance = ScGetRestOffset(shapeSim0) + ScGetRestOffset(shapeSim1); + mNpUnit.dominance0 = cdom.dominance0; + mNpUnit.dominance1 = cdom.dominance1; + mNpUnit.geomType0 = PxU8(shapeCore0->mGeometry.getType()); + mNpUnit.geomType1 = PxU8(shapeCore1->mGeometry.getType()); + mNpUnit.mTransformCache0 = shapeSim0.getTransformCacheID(); + mNpUnit.mTransformCache1 = shapeSim1.getTransformCacheID(); + + mNpUnit.mTorsionalPatchRadius = PxMax(shapeSim0.getTorsionalPatchRadius(),shapeSim1.getTorsionalPatchRadius()); + mNpUnit.mMinTorsionalPatchRadius = PxMax(shapeSim0.getMinTorsionalPatchRadius(), shapeSim1.getMinTorsionalPatchRadius()); + + PxReal slop0 = manager->mRigidBody0 ? manager->mRigidBody0->getCore().offsetSlop : 0.f; + PxReal slop1 = manager->mRigidBody1 ? manager->mRigidBody1->getCore().offsetSlop : 0.f; + mNpUnit.mOffsetSlop = PxMax(slop0, slop1); + + PxU16 wuflags = 0; + + if(type0 == PxActorType::eARTICULATION_LINK) + wuflags |= PxcNpWorkUnitFlag::eARTICULATION_BODY0; + + if(type1 == PxActorType::eARTICULATION_LINK) + wuflags |= PxcNpWorkUnitFlag::eARTICULATION_BODY1; + + if(type0 == PxActorType::eRIGID_DYNAMIC) + wuflags |= PxcNpWorkUnitFlag::eDYNAMIC_BODY0; + + if(type1 == PxActorType::eRIGID_DYNAMIC) + wuflags |= PxcNpWorkUnitFlag::eDYNAMIC_BODY1; + + if (type0 == PxActorType::eSOFTBODY) + wuflags |= PxcNpWorkUnitFlag::eSOFT_BODY; + + if (type1 == PxActorType::eSOFTBODY) + wuflags |= PxcNpWorkUnitFlag::eSOFT_BODY; + + if(!disableResponse && !contactChangeable) + wuflags |= PxcNpWorkUnitFlag::eOUTPUT_CONSTRAINTS; + + if(!disableDiscreteContact) + wuflags |= PxcNpWorkUnitFlag::eDETECT_DISCRETE_CONTACT; + if(kinematicActor) + wuflags |= PxcNpWorkUnitFlag::eHAS_KINEMATIC_ACTOR; + + if(disableResponse) + wuflags |= PxcNpWorkUnitFlag::eDISABLE_RESPONSE; + if(!disableCCDContact) + wuflags |= PxcNpWorkUnitFlag::eDETECT_CCD_CONTACTS; + + // this is just the user req: contact reports can also be generated by body thresholding + if(reportContactInfo || contactChangeable) + wuflags |= PxcNpWorkUnitFlag::eOUTPUT_CONTACTS; + + if(hasForceThreshold) + wuflags |= PxcNpWorkUnitFlag::eFORCE_THRESHOLD; + + if(contactChangeable) + wuflags |= PxcNpWorkUnitFlag::eMODIFIABLE_CONTACT; + + mNpUnit.flags = wuflags; + + manager->mFlags = PxU32(contactChangeable ? PxsContactManager::PXS_CM_CHANGEABLE : 0) | PxU32(disableCCDContact ? 0 : PxsContactManager::PXS_CM_CCD_LINEAR); + + //manager->mUserData = this; + + mNpUnit.mNpIndex = 0xFFffFFff; + + mManager = manager; + + PxU8 statusFlags = 0; + + if(touching > 0) + statusFlags |= PxcNpWorkUnitStatusFlag::eHAS_TOUCH; + else if (touching < 0) + statusFlags |= PxcNpWorkUnitStatusFlag::eHAS_NO_TOUCH; + + mNpUnit.statusFlags = statusFlags; + + //KS - do not register the CMs here if contactManager isn't null. This implies this is a newly-found pair so we'll do that addition outside in parallel + + if(contactManager == NULL) + { + scene.getSimpleIslandManager()->setEdgeRigidCM(mEdgeIndex, mManager); + PxvNphaseImplementationContext* nphaseImplementationContext = scene.getLowLevelContext()->getNphaseImplementationContext(); + PX_ASSERT(nphaseImplementationContext); + nphaseImplementationContext->registerContactManager(mManager, this, touching, 0); + } +} + +void Sc::ShapeInteraction::onShapeChangeWhileSleeping(bool shapeOfDynamicChanged) +{ + // if an operation that can break touch status occurs, all deactivated pairs need to set the sleep island edge + // to connected to make sure that potentially joined islands get detected once parts of the island wake up. + // Active interactions can be ignored because the edges of those will be marked connected on deactivation. + if(!mManager) + { + Scene& scene = getScene(); + + //soft body/dynamic before static + ActorSim& body0 = getShape0().getActor(); + + if(shapeOfDynamicChanged && !readFlag(TOUCH_KNOWN)) + { + // conservative approach: if a pair was added asleep, and a body/shape gets moved, we want to check next frame + // whether the other body should get woken up. The motivation behind this is to get a similar behavior as in + // the case where the objects fell asleep rather than have been added asleep (in that case the object will be + // woken up with one frame delay). + + ActorSim& body1 = getShape1().getActor(); + + if(body1.isDynamicRigid() && !readFlag(ShapeInteraction::CONTACTS_RESPONSE_DISABLED)) // the first shape always belongs to a dynamic body, hence no need to test body0 + scene.addToLostTouchList(body0, body1); // note: this will cause duplicate entries if the pair loses AABB overlap the next frame + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.h new file mode 100644 index 0000000..f643829 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeInteraction.h @@ -0,0 +1,354 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SHAPE_INTERACTION_H +#define SC_SHAPE_INTERACTION_H + +#include "ScElementSimInteraction.h" +#include "ScShapeSim.h" +#include "ScActorPair.h" +#include "ScScene.h" +#include "ScBodySim.h" +#include "PxsContactManager.h" +#include "PxsContext.h" +#include "PxsSimpleIslandManager.h" + +#define INVALID_REPORT_PAIR_ID 0xffffffff + +namespace physx +{ +class PxsContactManagerOutputIterator; +namespace Sc +{ + class ContactReportAllocationManager; + /* + Description: A ShapeInteraction represents a pair of objects which _may_ have contacts. Created by the broadphase + and processed by the NPhaseCore. + */ + class ShapeInteraction : public ElementSimInteraction + { + friend class NPhaseCore; + ShapeInteraction& operator=(const ShapeInteraction&); + public: + enum SiFlag + { + PAIR_FLAGS_MASK = (PxPairFlag::eNEXT_FREE - 1), // Bits where the PxPairFlags get stored + NEXT_FREE = ((PAIR_FLAGS_MASK << 1) & ~PAIR_FLAGS_MASK), + + HAS_TOUCH = (NEXT_FREE << 0), // Tracks the last know touch state + HAS_NO_TOUCH = (NEXT_FREE << 1), // Tracks the last know touch state + TOUCH_KNOWN = (HAS_TOUCH | HAS_NO_TOUCH), // If none of these flags is set, the touch state is not known (for example, this is true for pairs that never ran narrowphase + + CONTACTS_COLLECT_POINTS = (NEXT_FREE << 2), // The user wants to get the contact points (includes debug rendering) + CONTACTS_RESPONSE_DISABLED = (NEXT_FREE << 3), // Collision response disabled (either by the user through PxPairFlag::eSOLVE_CONTACT or because the pair has two kinematics) + + CONTACT_FORCE_THRESHOLD_PAIRS = PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND) | PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS) | PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST), + CONTACT_REPORT_EVENTS = PxU32(PxPairFlag::eNOTIFY_TOUCH_FOUND) | PxU32(PxPairFlag::eNOTIFY_TOUCH_PERSISTS) | PxU32(PxPairFlag::eNOTIFY_TOUCH_LOST) | + PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_FOUND) | PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_PERSISTS) | PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST), + CONTACT_REPORT_EXTRA_DATA = PxU32(PxPairFlag::ePRE_SOLVER_VELOCITY) | PxU32(PxPairFlag::ePOST_SOLVER_VELOCITY) | PxU32(PxPairFlag::eCONTACT_EVENT_POSE), + + FORCE_THRESHOLD_EXCEEDED_NOW = (NEXT_FREE << 4), + FORCE_THRESHOLD_EXCEEDED_BEFORE = (NEXT_FREE << 5), + FORCE_THRESHOLD_EXCEEDED_FLAGS = FORCE_THRESHOLD_EXCEEDED_NOW | FORCE_THRESHOLD_EXCEEDED_BEFORE, + + IS_IN_PERSISTENT_EVENT_LIST = (NEXT_FREE << 6), // The pair is in the list of persistent contact events + WAS_IN_PERSISTENT_EVENT_LIST = (NEXT_FREE << 7), // The pair is inactive but used to be in the list of persistent contact events + IN_PERSISTENT_EVENT_LIST = IS_IN_PERSISTENT_EVENT_LIST | WAS_IN_PERSISTENT_EVENT_LIST, + IS_IN_FORCE_THRESHOLD_EVENT_LIST= (NEXT_FREE << 8), // The pair is in the list of force threshold contact events + IS_IN_CONTACT_EVENT_LIST = IS_IN_PERSISTENT_EVENT_LIST | IS_IN_FORCE_THRESHOLD_EVENT_LIST, + + LL_MANAGER_RECREATE_EVENT = CONTACT_REPORT_EVENTS | CONTACTS_COLLECT_POINTS | + CONTACTS_RESPONSE_DISABLED | PxU32(PxPairFlag::eMODIFY_CONTACTS) + }; + ShapeInteraction(ShapeSimBase& s1, ShapeSimBase& s2, PxPairFlags pairFlags, PxsContactManager* contactManager); + ~ShapeInteraction(); + + // Submits to contact stream + void processUserNotification(PxU32 contactEvent, PxU16 infoFlags, bool touchLost, const PxU32 ccdPass, const bool useCurrentTransform, + PxsContactManagerOutputIterator& outputs); // ccdPass is 0 for discrete collision and then 1,2,... for the CCD passes + + void processUserNotificationSync(); + + void processUserNotificationAsync(PxU32 contactEvent, PxU16 infoFlags, bool touchLost, const PxU32 ccdPass, const bool useCurrentTransform, + PxsContactManagerOutputIterator& outputs, ContactReportAllocationManager* alloc = NULL); // ccdPass is 0 for discrete collision and then 1,2,... for the CCD passes + + void visualize( PxRenderOutput&, PxsContactManagerOutputIterator&, + float scale, float param_contactForce, float param_contactNormal, float param_contactError, float param_contactPoint + ); + + PxU32 getContactPointData(const void*& contactPatches, const void*& contactPoints, PxU32& contactDataSize, PxU32& contactPointCount, PxU32& patchCount, const PxReal*& impulses, PxU32 startOffset, PxsContactManagerOutputIterator& outputs); + + bool managerLostTouch(const PxU32 ccdPass, bool adjustCounters, PxsContactManagerOutputIterator& outputs); + void managerNewTouch(const PxU32 ccdPass, bool adjustCounters, PxsContactManagerOutputIterator& outputs); + + PX_FORCE_INLINE void adjustCountersOnLostTouch(); + PX_FORCE_INLINE void adjustCountersOnNewTouch(); + + PX_FORCE_INLINE void sendCCDRetouch(const PxU32 ccdPass, PxsContactManagerOutputIterator& outputs); + void setContactReportPostSolverVelocity(ContactStreamManager& cs); + PX_FORCE_INLINE void sendLostTouchReport(bool shapeVolumeRemoved, const PxU32 ccdPass, PxsContactManagerOutputIterator& ouptuts); + void resetManagerCachedState() const; + + PX_FORCE_INLINE ActorPair* getActorPair() const { return mActorPair; } + PX_FORCE_INLINE void setActorPair(ActorPair& aPair) { mActorPair = &aPair; } + PX_FORCE_INLINE void clearActorPair() { mActorPair = NULL; } + PX_FORCE_INLINE ActorPairReport& getActorPairReport() const { return ActorPairReport::cast(*mActorPair); } + PX_INLINE PxIntBool isReportPair() const { /*PX_ASSERT(!(PxIntBool(getPairFlags() & CONTACT_REPORT_EVENTS)) || mActorPair->isReportPair());*/ return PxIntBool(getPairFlags() & CONTACT_REPORT_EVENTS); } + PX_INLINE PxIntBool hasTouch() const { return readFlag(HAS_TOUCH); } + PX_INLINE PxIntBool hasCCDTouch() const { PX_ASSERT(mManager); return mManager->getHadCCDContact(); } + PX_INLINE void swapAndClearForceThresholdExceeded(); + + PX_FORCE_INLINE void raiseFlag(SiFlag flag) { mFlags |= flag; } + PX_FORCE_INLINE PxIntBool readFlag(SiFlag flag) const { return PxIntBool(mFlags & flag); } + PX_FORCE_INLINE PxU32 getPairFlags() const; + + PX_FORCE_INLINE void removeFromReportPairList(); + + void onShapeChangeWhileSleeping(bool shapeOfDynamicChanged); + + PX_FORCE_INLINE PxIntBool hasKnownTouchState() const; + + bool onActivate_(void* data); + bool onDeactivate_(); + + void updateState(const PxU8 externalDirtyFlags); + + const PxsContactManager* getContactManager() const { return mManager; } + + void clearIslandGenData(); + + PX_FORCE_INLINE PxU32 getEdgeIndex() const { return mEdgeIndex; } + + PX_FORCE_INLINE Sc::ShapeSimBase& getShape0() const { return static_cast(getElement0()); } + PX_FORCE_INLINE Sc::ShapeSimBase& getShape1() const { return static_cast(getElement1()); } + + private: + ActorPair* mActorPair; + PxsContactManager* mManager; + PxU32 mContactReportStamp; + PxU32 mReportPairIndex; // Owned by NPhaseCore for its report pair list + PxU32 mEdgeIndex; + PxU16 mReportStreamIndex; // position of this pair in the contact report stream + + void createManager(void* contactManager); + PX_INLINE bool updateManager(void* contactManager); + PX_INLINE void destroyManager(); + PX_FORCE_INLINE bool activeManagerAllowed() const; + PX_FORCE_INLINE PxU32 getManagerContactState() const { return mFlags & LL_MANAGER_RECREATE_EVENT; } + + PX_FORCE_INLINE void clearFlag(SiFlag flag) { mFlags &= ~flag; } + PX_INLINE void setFlag(SiFlag flag, bool value) + { + if (value) + raiseFlag(flag); + else + clearFlag(flag); + } + PX_FORCE_INLINE void setHasTouch() { clearFlag(HAS_NO_TOUCH); raiseFlag(HAS_TOUCH); } + PX_FORCE_INLINE void setHasNoTouch() { clearFlag(HAS_TOUCH); raiseFlag(HAS_NO_TOUCH); } + + PX_FORCE_INLINE void setPairFlags(PxPairFlags flags); + + PX_FORCE_INLINE void processReportPairOnActivate(); + PX_FORCE_INLINE void processReportPairOnDeactivate(); + + // Certain SiFlag cache properties of the pair. If these properties change then the flags have to be updated. + // For example: is collision enabled for this pair? are contact points requested for this pair? + PX_FORCE_INLINE void updateFlags(const Sc::Scene&, const Sc::ActorSim&, const Sc::ActorSim&, const PxU32 pairFlags); + + friend class Sc::Scene; + }; + +} // namespace Sc + +// PT: TODO: is there a reason for force-inlining all that stuff? + +PX_FORCE_INLINE void Sc::ShapeInteraction::sendLostTouchReport(bool shapeVolumeRemoved, const PxU32 ccdPass, PxsContactManagerOutputIterator& outputs) +{ + PX_ASSERT(hasTouch()); + PX_ASSERT(isReportPair()); + + const PxU32 pairFlags = getPairFlags(); + const PxU32 notifyTouchLost = pairFlags & PxU32(PxPairFlag::eNOTIFY_TOUCH_LOST); + const PxIntBool thresholdExceeded = readFlag(ShapeInteraction::FORCE_THRESHOLD_EXCEEDED_NOW); + const PxU32 notifyThresholdLost = thresholdExceeded ? (pairFlags & PxU32(PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST)) : 0; + if(!notifyTouchLost && !notifyThresholdLost) + return; + + PxU16 infoFlag = 0; + if (mActorPair->getTouchCount() == 1) // this code assumes that the actor pair touch count does get decremented afterwards + { + infoFlag |= PxContactPairFlag::eACTOR_PAIR_LOST_TOUCH; + } + + //Lost touch is processed after solver, so we should use the previous transform to update the pose for objects if user request eCONTACT_EVENT_POSE + const bool useCurrentTransform = false; + + const PxU32 triggeredFlags = notifyTouchLost | notifyThresholdLost; + PX_ASSERT(triggeredFlags); + processUserNotification(triggeredFlags, infoFlag, true, ccdPass, useCurrentTransform, outputs); + + if(shapeVolumeRemoved) + { + ActorPairReport& apr = getActorPairReport(); + ContactStreamManager& cs = apr.getContactStreamManager(); + cs.raiseFlags(ContactStreamManagerFlag::eTEST_FOR_REMOVED_SHAPES); + } +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::setPairFlags(PxPairFlags flags) +{ + PX_ASSERT(PxU32(flags) < PxPairFlag::eNEXT_FREE); // to find out if a new PxPairFlag has been added after eLAST instead of in front + + PxU32 newFlags = mFlags; + PxU32 fl = PxU32(flags) & PAIR_FLAGS_MASK; + newFlags &= (~PAIR_FLAGS_MASK); // clear old flags + newFlags |= fl; + + mFlags = newFlags; +} + +// PT: returning PxU32 instead of PxPairFlags to remove LHS. Please do not undo this. +PX_FORCE_INLINE PxU32 Sc::ShapeInteraction::getPairFlags() const +{ + return (mFlags & PAIR_FLAGS_MASK); +} + +PX_INLINE void Sc::ShapeInteraction::swapAndClearForceThresholdExceeded() +{ + PxU32 flags = mFlags; + + PX_COMPILE_TIME_ASSERT(FORCE_THRESHOLD_EXCEEDED_NOW == (FORCE_THRESHOLD_EXCEEDED_BEFORE >> 1)); + + PxU32 nowToBefore = (flags & FORCE_THRESHOLD_EXCEEDED_NOW) << 1; + flags &= ~(FORCE_THRESHOLD_EXCEEDED_NOW | FORCE_THRESHOLD_EXCEEDED_BEFORE); + flags |= nowToBefore; + + mFlags = flags; +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::removeFromReportPairList() +{ + // this method should only get called if the pair is in the list for + // persistent or force based contact reports + PX_ASSERT(mReportPairIndex != INVALID_REPORT_PAIR_ID); + PX_ASSERT(readFlag(IS_IN_CONTACT_EVENT_LIST)); + + Scene& scene = getScene(); + + if (readFlag(IS_IN_FORCE_THRESHOLD_EVENT_LIST)) + scene.getNPhaseCore()->removeFromForceThresholdContactEventPairs(this); + else + { + PX_ASSERT(readFlag(IS_IN_PERSISTENT_EVENT_LIST)); + scene.getNPhaseCore()->removeFromPersistentContactEventPairs(this); + } +} + +PX_INLINE bool Sc::ShapeInteraction::updateManager(void* contactManager) +{ + if (activeManagerAllowed()) + { + if (mManager == 0) + createManager(contactManager); + + return (mManager != NULL); // creation might fail (pool reached limit, mem allocation failed etc.) + } + else + return false; +} + +PX_INLINE void Sc::ShapeInteraction::destroyManager() +{ + PX_ASSERT(mManager); + + Scene& scene = getScene(); + + PxvNphaseImplementationContext* nphaseImplementationContext = scene.getLowLevelContext()->getNphaseImplementationContext(); + PX_ASSERT(nphaseImplementationContext); + nphaseImplementationContext->unregisterContactManager(mManager); + + /*if (mEdgeIndex != IG_INVALID_EDGE) + scene.getSimpleIslandManager()->clearEdgeRigidCM(mEdgeIndex);*/ + scene.getLowLevelContext()->destroyContactManager(mManager); + mManager = 0; +} + +PX_FORCE_INLINE bool Sc::ShapeInteraction::activeManagerAllowed() const +{ + ShapeSimBase& shape0 = getShape0(); + ShapeSimBase& shape1 = getShape1(); + + ActorSim& bodySim0 = shape0.getActor(); + ActorSim& bodySim1 = shape1.getActor(); + + // the first shape always belongs to a dynamic body or soft body + PX_ASSERT(bodySim0.isDynamicRigid() || bodySim0.isSoftBody() || bodySim0.isFEMCloth() || bodySim0.isParticleSystem() || bodySim0.isHairSystem()); + + const IG::IslandSim& islandSim = getScene().getSimpleIslandManager()->getSpeculativeIslandSim(); + + //check whether active in the speculative sim! + + return (islandSim.getNode(bodySim0.getNodeIndex()).isActive() || + (!bodySim1.isStaticRigid() && islandSim.getNode(bodySim1.getNodeIndex()).isActive())); +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::sendCCDRetouch(const PxU32 ccdPass, PxsContactManagerOutputIterator& outputs) +{ + const PxU32 pairFlags = getPairFlags(); + if (pairFlags & PxPairFlag::eNOTIFY_TOUCH_CCD) + processUserNotification(PxPairFlag::eNOTIFY_TOUCH_CCD, 0, false, ccdPass, false, outputs); +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::adjustCountersOnLostTouch() +{ + PX_ASSERT(mActorPair->getTouchCount()); + + mActorPair->decTouchCount(); +} + +PX_FORCE_INLINE void Sc::ShapeInteraction::adjustCountersOnNewTouch() +{ + mActorPair->incTouchCount(); +} + +PX_FORCE_INLINE PxIntBool Sc::ShapeInteraction::hasKnownTouchState() const +{ + // For a pair where the bodies were added asleep, the touch state is not known until narrowphase runs on the pair for the first time. + // If such a pair looses AABB overlap before, the conservative approach is to wake the bodies up. This method provides an indicator that + // this is such a pair. Note: this might also wake up objects that do not touch but that's the price to pay (unless we want to run + // overlap tests on such pairs). + if (mManager) + return mManager->touchStatusKnown(); + else + return readFlag(TOUCH_KNOWN); +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp new file mode 100644 index 0000000..088f382 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.cpp @@ -0,0 +1,73 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScBodySim.h" +#include "ScStaticSim.h" +#include "ScScene.h" +#include "ScElementSimInteraction.h" +#include "ScShapeInteraction.h" +#include "ScTriggerInteraction.h" +#include "ScSimStats.h" +#include "ScObjectIDTracker.h" +#include "GuHeightFieldUtil.h" +#include "GuTriangleMesh.h" +#include "GuConvexMeshData.h" +#include "GuHeightField.h" +#include "PxsContext.h" +#include "PxsTransformCache.h" +#include "CmTransformUtils.h" +#include "GuBounds.h" +#include "PxsRigidBody.h" +#include "ScSqBoundsManager.h" +#include "PxsSimulationController.h" +#include "common/PxProfileZone.h" +#include "ScArticulationSim.h" + +using namespace physx; +using namespace Gu; +using namespace Sc; + +void resetElementID(Scene& scene, ShapeSimBase& shapeSim); + +ShapeSim::ShapeSim(RigidSim& owner, ShapeCore& core) : + ShapeSimBase(owner, &core) +{ + // sizeof(ShapeSim) = 40 bytes + + initSubsystemsDependingOnElementID(); + + core.setSim(this); +} + +ShapeSim::~ShapeSim() +{ + const_cast(&getCore())->clearSim(); + Scene& scScene = getScene(); + resetElementID(scScene, *this); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.h new file mode 100644 index 0000000..87809a6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSim.h @@ -0,0 +1,78 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SHAPE_SIM_H +#define SC_SHAPE_SIM_H + +#include "ScElementSim.h" +#include "ScShapeCore.h" +#include "ScRigidSim.h" +#include "PxsShapeSim.h" +#include "ScShapeSimBase.h" + +namespace physx +{ + class PxsTransformCache; + +/** Simulation object corresponding to a shape core object. This object is created when + a ShapeCore object is added to the simulation, and destroyed when it is removed +*/ + +struct PxsRigidCore; + +namespace Sc +{ + class RigidSim; + class ShapeCore; + class BodySim; + + class ShapeSim : public ShapeSimBase + { + ShapeSim &operator=(const ShapeSim &); + public: + + // passing in a pointer for the shape to output its bounds allows us not to have to compute them twice. + // A neater way to do this would be to ask the AABB Manager for the bounds after the shape has been + // constructed, but there is currently no spec for what the AABBMgr is allowed to do with the bounds, + // hence better not to assume anything. + + ShapeSim(RigidSim&, ShapeCore& core); + ~ShapeSim(); + private: + }; + +#if !PX_P64_FAMILY +// PX_COMPILE_TIME_ASSERT(32==sizeof(Sc::ShapeSim)); // after removing bounds from shapes +// PX_COMPILE_TIME_ASSERT((sizeof(Sc::ShapeSim) % 16) == 0); // aligned mem bounds are better for prefetching +#endif + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp new file mode 100644 index 0000000..c503422 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.cpp @@ -0,0 +1,436 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "ScShapeSimBase.h" +#include "ScSqBoundsManager.h" +#include "ScTriggerInteraction.h" +#include "ScSimulationController.h" +#include "CmTransformUtils.h" +#include "ScShapeInteraction.h" + +using namespace physx; +using namespace Sc; + +// PT: keep local functions in cpp, no need to pollute the header. Don't force conversions to bool if not necessary. +static PX_FORCE_INLINE PxU32 hasTriggerFlags(PxShapeFlags flags) { return PxU32(flags) & PxU32(PxShapeFlag::eTRIGGER_SHAPE); } + +void resetElementID(Scene& scene, ShapeSimBase& shapeSim) +{ + PX_ASSERT(!shapeSim.isInBroadPhase()); + + // scene.getDirtyShapeSimMap().reset(shapeSim.getElementID()); + scene.getDirtyShapeSimMap().boundedReset(shapeSim.getElementID()); + + if (shapeSim.getSqBoundsId() != PX_INVALID_U32) + shapeSim.destroySqBounds(); +} + +PX_INLINE Bp::FilterGroup::Enum getBPGroup(const ShapeSimBase& shapeSim) +{ + + const BodySim* bs = shapeSim.getBodySim(); + + const RigidSim& rbSim = shapeSim.getRbSim(); + + bool isKinematic = bs ? bs->isKinematic() : false; + + if (isKinematic && bs->hasForcedKinematicNotif()) + isKinematic = false; + + return Bp::getFilterGroup(rbSim.getActorType() == PxActorType::eRIGID_STATIC, rbSim.getActorID(), isKinematic); +} + + +void ShapeSimBase::onFilterDataChange() +{ + setElementInteractionsDirty(InteractionDirtyFlag::eFILTER_STATE, InteractionFlag::eFILTERABLE); +} + +void ShapeSimBase::onResetFiltering() +{ + if (isInBroadPhase()) + reinsertBroadPhase(); +} + +void ShapeSimBase::onMaterialChange() +{ + setElementInteractionsDirty(InteractionDirtyFlag::eMATERIAL, InteractionFlag::eRB_ELEMENT); +} + +void ShapeSimBase::onRestOffsetChange() +{ + setElementInteractionsDirty(InteractionDirtyFlag::eREST_OFFSET, InteractionFlag::eRB_ELEMENT); +} + +void ShapeSimBase::onContactOffsetChange() +{ + if (isInBroadPhase()) + getScene().getAABBManager()->setContactDistance(getElementID(), getCore().getContactOffset()); +} + +void ShapeSimBase::removeFromBroadPhase(bool wakeOnLostTouch) +{ + if (isInBroadPhase()) + internalRemoveFromBroadPhase(wakeOnLostTouch); +} + +void ShapeSimBase::reinsertBroadPhase() +{ + bool wasPendingInsert = false; + if (isInBroadPhase()) + { + wasPendingInsert = internalRemoveFromBroadPhase(); + } + // internalAddToBroadPhase(); + + Scene& scene = getScene(); + + // Scene::removeShape + { + //unregisterShapeFromNphase(shape.getCore()); + + // PT: "getID" is const but the addShape call used LLShape, which uses elementID, so.... + scene.getSimulationController()->removeShape(getElementID()); + + scene.unregisterShapeFromNphase(getCore(), getElementID()); + } + + // Call ShapeSim dtor + { + resetElementID(scene, *this); + } + + // Call ElementSim dtor - only required if this shape was not pending insert (otherwise the elementID is fine to keep) + if (!wasPendingInsert) + { + { + releaseID(); + } + + // Call ElementSim ctor + { + initID(); + } + } + + // Call ShapeSim ctor + { + initSubsystemsDependingOnElementID(); + } + + // Scene::addShape + { + scene.getSimulationController()->addShape(&getLLShapeSim(), getElementID()); + + // PT: TODO: anything else needed here? + scene.registerShapeInNphase(&getRbSim().getRigidCore(), getCore(), getElementID()); + } +} + +PX_FORCE_INLINE void ShapeSimBase::internalAddToBroadPhase() +{ + PX_ASSERT(!isInBroadPhase()); + + addToAABBMgr(getCore().getContactOffset(), getBPGroup(*this), (getCore().getCore().mShapeFlags & PxShapeFlag::eTRIGGER_SHAPE) ? Bp::ElementType::eTRIGGER : Bp::ElementType::eSHAPE); +} + +PX_FORCE_INLINE bool ShapeSimBase::internalRemoveFromBroadPhase(bool wakeOnLostTouch) +{ + PX_ASSERT(isInBroadPhase()); + bool res = removeFromAABBMgr(); + + Scene& scene = getScene(); + PxsContactManagerOutputIterator outputs = scene.getLowLevelContext()->getNphaseImplementationContext()->getContactManagerOutputs(); + scene.getNPhaseCore()->onVolumeRemoved(this, wakeOnLostTouch ? PxU32(PairReleaseFlag::eWAKE_ON_LOST_TOUCH) : 0, outputs); + return res; +} + +void ShapeSimBase::initSubsystemsDependingOnElementID() +{ + Scene& scScene = getScene(); + + Bp::BoundsArray& boundsArray = scScene.getBoundsArray(); + const PxU32 index = getElementID(); + + PX_ALIGN(16, PxTransform absPos); + getAbsPoseAligned(&absPos); + + PxsTransformCache& cache = scScene.getLowLevelContext()->getTransformCache(); + cache.initEntry(index); + cache.setTransformCache(absPos, 0, index); + + boundsArray.updateBounds(absPos, getCore().getGeometryUnion().getGeometry(), index); + + { + PX_PROFILE_ZONE("API.simAddShapeToBroadPhase", scScene.getContextId()); + if (isBroadPhase(getCore().getFlags())) + internalAddToBroadPhase(); + else + scScene.getAABBManager()->reserveSpaceForBounds(index); + scScene.updateContactDistance(index, getContactOffset()); + } + + // if(scScene.getDirtyShapeSimMap().size() <= index) + // scScene.getDirtyShapeSimMap().resize(PxMax(index+1, (scScene.getDirtyShapeSimMap().size()+1) * 2u)); + + RigidSim& owner = getRbSim(); + if (owner.isDynamicRigid() && static_cast(owner).isActive()) + createSqBounds(); + + // Init LL shape + { + mLLShape.mElementIndex_GPU = index; + mLLShape.mShapeCore = const_cast(&getCore().getCore()); + + if (owner.getActorType() == PxActorType::eRIGID_STATIC) + { + mLLShape.mBodySimIndex_GPU = PxNodeIndex(PX_INVALID_NODE); + } + else + { + BodySim& bodySim = static_cast(getActor()); + mLLShape.mBodySimIndex_GPU = bodySim.getNodeIndex(); + //mLLShape.mLocalBound = computeBounds(mCore.getGeometry(), PxTransform(PxIdentity)); + } + } +} + +void ShapeSimBase::getAbsPoseAligned(PxTransform* PX_RESTRICT globalPose) const +{ + // PT: TODO: simplify dynamic case when shape2Actor = idt + + const PxsShapeCore& shapeCore = getCore().getCore(); + + const PxTransform& shape2Actor = shapeCore.getTransform(); + const PxTransform* actor2World = NULL; + if (getActor().getActorType() == PxActorType::eRIGID_STATIC) + { + PxsRigidCore& core = static_cast(getActor()).getStaticCore().getCore(); + + if (shapeCore.mShapeCoreFlags.isSet(PxShapeCoreFlag::eIDT_TRANSFORM)) + { + PX_ASSERT(shape2Actor.p.isZero() && shape2Actor.q.isIdentity()); + *globalPose = core.body2World; + return; + } + + actor2World = &core.body2World; + } + else + { + PxsBodyCore& core = static_cast(getActor()).getBodyCore().getCore(); + if (!core.hasIdtBody2Actor()) + { + Cm::getDynamicGlobalPoseAligned(core.body2World, shape2Actor, core.getBody2Actor(), *globalPose); + return; + } + actor2World = &core.body2World; + } + Cm::getStaticGlobalPoseAligned(*actor2World, shape2Actor, *globalPose); +} + +void ShapeSimBase::onFlagChange(PxShapeFlags oldFlags) +{ + const PxShapeFlags newFlags = getCore().getFlags(); + + const bool oldBp = isBroadPhase(oldFlags) != 0; + const bool newBp = isBroadPhase(newFlags) != 0; + + // Change of collision shape flags requires removal/add to broadphase + if (oldBp != newBp) + { + if (!oldBp && newBp) + { + // A.B. if a trigger was removed and inserted within the same frame we need to reinsert + if (hasTriggerFlags(newFlags) && getScene().getAABBManager()->isMarkedForRemove(getElementID())) + reinsertBroadPhase(); + else + internalAddToBroadPhase(); + } + else + internalRemoveFromBroadPhase(); + } + else + { + const bool wasTrigger = hasTriggerFlags(oldFlags) != 0; + const bool isTrigger = hasTriggerFlags(newFlags) != 0; + if (wasTrigger != isTrigger) + reinsertBroadPhase(); // re-insertion is necessary because trigger pairs get killed + } + + const PxShapeFlags hadSq = oldFlags & PxShapeFlag::eSCENE_QUERY_SHAPE; + const PxShapeFlags hasSq = newFlags & PxShapeFlag::eSCENE_QUERY_SHAPE; + if (hasSq && !hadSq) + { + BodySim* body = getBodySim(); + if (body && body->isActive()) + createSqBounds(); + } + else if (hadSq && !hasSq) + destroySqBounds(); + + getScene().getSimulationController()->reinsertShape(&getLLShapeSim(), getElementID()); +} + +BodySim* ShapeSimBase::getBodySim() const +{ + ActorSim& a = getActor(); + return a.isDynamicRigid() ? static_cast(&a) : NULL; +} + +PxsRigidCore& ShapeSimBase::getPxsRigidCore() const +{ + ActorSim& a = getActor(); + return a.isDynamicRigid() ? static_cast(a).getBodyCore().getCore() + : static_cast(a).getStaticCore().getCore(); +} + +void ShapeSimBase::updateCached(PxU32 transformCacheFlags, PxBitMapPinned* shapeChangedMap) +{ + PX_ALIGN(16, PxTransform absPose); + getAbsPoseAligned(&absPose); + + Scene& scene = getScene(); + const PxU32 index = getElementID(); + + scene.getLowLevelContext()->getTransformCache().setTransformCache(absPose, transformCacheFlags, index); + scene.getBoundsArray().updateBounds(absPose, getCore().getGeometryUnion().getGeometry(), index); + if (shapeChangedMap && isInBroadPhase()) + shapeChangedMap->growAndSet(index); +} + +void ShapeSimBase::updateCached(PxsTransformCache& transformCache, Bp::BoundsArray& boundsArray) +{ + const PxU32 index = getElementID(); + + PxsCachedTransform& ct = transformCache.getTransformCache(index); + PxPrefetchLine(&ct); + + getAbsPoseAligned(&ct.transform); + + ct.flags = 0; + + PxBounds3& b = boundsArray.begin()[index]; + Gu::computeBounds(b, getCore().getGeometryUnion().getGeometry(), ct.transform, 0.0f, 1.0f); +} + +void ShapeSimBase::updateBPGroup() +{ + if (isInBroadPhase()) + { + Sc::Scene& scene = getScene(); + scene.getAABBManager()->setBPGroup(getElementID(), getBPGroup(*this)); + + reinsertBroadPhase(); + // internalRemoveFromBroadPhase(); + // internalAddToBroadPhase(); + } +} + +void ShapeSimBase::markBoundsForUpdate() +{ + Scene& scene = getScene(); + if (isInBroadPhase()) + scene.getDirtyShapeSimMap().growAndSet(getElementID()); +} + +static PX_FORCE_INLINE void updateInteraction(Scene& scene, Interaction* i, const bool isDynamic, const bool isAsleep) +{ + if (i->getType() == InteractionType::eOVERLAP) + { + ShapeInteraction* si = static_cast(i); + si->resetManagerCachedState(); + + if (isAsleep) + si->onShapeChangeWhileSleeping(isDynamic); + } + else if (i->getType() == InteractionType::eTRIGGER) + (static_cast(i))->forceProcessingThisFrame(scene); // trigger pairs need to be checked next frame +} + +void ShapeSimBase::onVolumeOrTransformChange() +{ + Scene& scene = getScene(); + BodySim* body = getBodySim(); + const bool isDynamic = (body != NULL); + const bool isAsleep = body ? !body->isActive() : true; + + ElementSim::ElementInteractionIterator iter = getElemInteractions(); + ElementSimInteraction* i = iter.getNext(); + while (i) + { + updateInteraction(scene, i, isDynamic, isAsleep); + i = iter.getNext(); + } + + markBoundsForUpdate(); + getScene().getSimulationController()->reinsertShape(&getLLShapeSim(), getElementID()); +} + +void notifyActorInteractionsOfTransformChange(ActorSim& actor) +{ + bool isDynamic; + bool isAsleep; + if (actor.isDynamicRigid()) + { + isDynamic = true; + isAsleep = !static_cast(actor).isActive(); + } + else + { + isDynamic = false; + isAsleep = true; + } + + Scene& scene = actor.getScene(); + + PxU32 nbInteractions = actor.getActorInteractionCount(); + Interaction** interactions = actor.getActorInteractions(); + while (nbInteractions--) + updateInteraction(scene, *interactions++, isDynamic, isAsleep); +} + +void ShapeSimBase::createSqBounds() +{ + if (mSqBoundsId != PX_INVALID_U32) + return; + + BodySim* bodySim = getBodySim(); + PX_ASSERT(bodySim); + + if (bodySim->usingSqKinematicTarget() || bodySim->isFrozen() || !bodySim->isActive() || bodySim->readInternalFlag(BodySim::BF_IS_COMPOUND_RIGID)) + return; + + if (getCore().getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE) + getScene().getSqBoundsManager().addSyncShape(*this); +} + +void ShapeSimBase::destroySqBounds() +{ + if (mSqBoundsId != PX_INVALID_U32) + getScene().getSqBoundsManager().removeSyncShape(*this); +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.h new file mode 100644 index 0000000..564e459 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScShapeSimBase.h @@ -0,0 +1,149 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_SHAPESIM_BASE_H +#define SC_SHAPESIM_BASE_H + +#include "ScElementSim.h" +#include "ScShapeCore.h" +#include "ScRigidSim.h" +#include "PxsShapeSim.h" + +namespace physx +{ + namespace Sc + { + + PX_FORCE_INLINE PxU32 isBroadPhase(PxShapeFlags flags) { return PxU32(flags) & PxU32(PxShapeFlag::eTRIGGER_SHAPE | PxShapeFlag::eSIMULATION_SHAPE); } + class ShapeCore; + + // PT: TODO: ShapeSimBase is bonkers: + // PxU32 ElementSim::mElementID + // PxU32 ElementSim::mShapeArrayIndex; + // IG::NodeIndex mLLShape::mBodySimIndex; *** GPU only + // PxU32 mLLShape::mElementIndex; *** GPU only, looks like a copy of ElementSim::mElementID + // PxU32 mLLShape::mShapeIndex; *** GPU only, looks like a copy of ElementSim::mElementID + // PxU32 ShapeSimBase::mId; + // PxU32 ShapeSimBase::mSqBoundsId; + // => do we really need 7 different IDs per shape? + + class ShapeSimBase : public ElementSim + { + ShapeSimBase &operator=(const ShapeSimBase &); + public: + + // passing in a pointer for the shape to output its bounds allows us not to have to compute them twice. + // A neater way to do this would be to ask the AABB Manager for the bounds after the shape has been + // constructed, but there is currently no spec for what the AABBMgr is allowed to do with the bounds, + // hence better not to assume anything. + + ShapeSimBase(ActorSim& owner, const ShapeCore* core) : + ElementSim (owner), + mSqBoundsId (PX_INVALID_U32), + mPrunerIndex(PX_INVALID_U32) + { setCore(core); } + ~ShapeSimBase() { } + + PX_FORCE_INLINE void setCore(const ShapeCore* core); + PX_FORCE_INLINE const ShapeCore& getCore() const; + + PX_INLINE PxGeometryType::Enum getGeometryType() const { return getCore().getGeometryType(); } + + // This is just for getting a reference for the user, so we cast away const-ness + + PX_INLINE PxShape* getPxShape() const { return const_cast(getCore().getPxShape()); } + + PX_FORCE_INLINE PxReal getRestOffset() const { return getCore().getRestOffset(); } + PX_FORCE_INLINE PxReal getTorsionalPatchRadius() const { return getCore().getTorsionalPatchRadius(); } + PX_FORCE_INLINE PxReal getMinTorsionalPatchRadius() const { return getCore().getMinTorsionalPatchRadius(); } + PX_FORCE_INLINE PxU32 getFlags() const { return getCore().getFlags(); } + PX_FORCE_INLINE PxReal getContactOffset() const { return getCore().getContactOffset(); } + + PX_FORCE_INLINE PxU32 getTransformCacheID() const { return getElementID(); } + + PX_FORCE_INLINE PxU32 getSqBoundsId() const { return mSqBoundsId; } + PX_FORCE_INLINE void setSqBoundsId(PxU32 id) { mSqBoundsId = id; } + + PX_FORCE_INLINE PxU32 getSqPrunerIndex() const { return mPrunerIndex; } + PX_FORCE_INLINE void setSqPrunerIndex(PxU32 index) { mPrunerIndex = index; } + + PX_FORCE_INLINE PxsShapeSim& getLLShapeSim() { return mLLShape; } + + void onFilterDataChange(); + void onRestOffsetChange(); + void onFlagChange(PxShapeFlags oldFlags); + void onResetFiltering(); + void onVolumeOrTransformChange(); + void onMaterialChange(); // remove when material properties are gone from PxcNpWorkUnit + void onContactOffsetChange(); + void markBoundsForUpdate(); + void reinsertBroadPhase(); + void removeFromBroadPhase(bool wakeOnLostTouch); + void getAbsPoseAligned(PxTransform* PX_RESTRICT globalPose) const; + + PX_FORCE_INLINE RigidSim& getRbSim() const { return static_cast(getActor()); } + BodySim* getBodySim() const; + + PxsRigidCore& getPxsRigidCore() const; + + void createSqBounds(); + void destroySqBounds(); + + void updateCached(PxU32 transformCacheFlags, PxBitMapPinned* shapeChangedMap); + void updateCached(PxsTransformCache& transformCache, Bp::BoundsArray& boundsArray); + void updateBPGroup(); + protected: + + PX_FORCE_INLINE void internalAddToBroadPhase(); + PX_FORCE_INLINE bool internalRemoveFromBroadPhase(bool wakeOnLostTouch = true); + void initSubsystemsDependingOnElementID(); + + PxsShapeSim mLLShape; + PxU32 mSqBoundsId; + PxU32 mPrunerIndex; + }; + +#if PX_P64_FAMILY + // PT: to compensate for the padding I removed in PxsShapeSim + PX_COMPILE_TIME_ASSERT((sizeof(ShapeSimBase) - sizeof(PxsShapeSim))>=12); +#else + // PX_COMPILE_TIME_ASSERT(32==sizeof(Sc::ShapeSim)); // after removing bounds from shapes + // PX_COMPILE_TIME_ASSERT((sizeof(Sc::ShapeSim) % 16) == 0); // aligned mem bounds are better for prefetching +#endif + + PX_FORCE_INLINE void ShapeSimBase::setCore(const ShapeCore* core) + { + mLLShape.mShapeCore = const_cast(&core->getCore()); + } + PX_FORCE_INLINE const ShapeCore& ShapeSimBase::getCore() const + { + return Sc::ShapeCore::getCore(*mLLShape.mShapeCore); + } + + } // namespace Sc +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStateData.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStateData.h new file mode 100644 index 0000000..fb7bab3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStateData.h @@ -0,0 +1,213 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SIM_STATE_DATA_H +#define SC_SIM_STATE_DATA_H + +#include "foundation/PxMemory.h" +#include "ScBodyCore.h" + +namespace physx +{ +namespace Sc +{ + struct KinematicTransform + { + PxTransform targetPose; // The body will move to this pose over the superstep following this getting set. + PxU8 targetValid; // User set a kinematic target. + PxU8 pad[2]; + PxU8 type; + }; + + struct Kinematic : public KinematicTransform + { + // The following members buffer the original body data to restore them when switching back to dynamic body + // (for kinematics the corresponding LowLevel properties are set to predefined values) + PxVec3 backupInverseInertia; // The inverse of the body space inertia tensor + PxReal backupInvMass; // The inverse of the body mass + PxReal backupLinearDamping; // The velocity is scaled by (1.0f - this * dt) inside integrateVelocity() every substep. + PxReal backupAngularDamping; + PxReal backupMaxAngVelSq; // The angular velocity's magnitude is clamped to this maximum value. + PxReal backupMaxLinVelSq; // The angular velocity's magnitude is clamped to this maximum value + }; + PX_COMPILE_TIME_ASSERT(0 == (sizeof(Kinematic) & 0x0f)); + + enum VelocityModFlags + { + VMF_GRAVITY_DIRTY = (1 << 0), + VMF_ACC_DIRTY = (1 << 1), + VMF_VEL_DIRTY = (1 << 2) + }; + + // Important: Struct is reset in setForcesToDefaults. + struct VelocityMod + { + PxVec3 linearPerSec; // A request to change the linear velocity by this much each second. The velocity is changed by this * dt inside integrateVelocity(). + PxU8 pad0[4]; + PxVec3 angularPerSec; + PxU8 pad1[3]; + PxU8 type; + PxVec3 linearPerStep; // A request to change the linear velocity by this much the next step. The velocity is changed inside updateForces(). + PxU32 pad2; + PxVec3 angularPerStep; + PxU32 pad3; + + PX_FORCE_INLINE void clear() { linearPerSec = angularPerSec = linearPerStep = angularPerStep = PxVec3(0.0f); } + + PX_FORCE_INLINE void clearPerStep() { linearPerStep = angularPerStep = PxVec3(0.0f); } + + PX_FORCE_INLINE const PxVec3& getLinearVelModPerSec() const { return linearPerSec; } + PX_FORCE_INLINE void accumulateLinearVelModPerSec(const PxVec3& v) { linearPerSec += v; } + PX_FORCE_INLINE void setLinearVelModPerSec(const PxVec3& v) { linearPerSec = v; } + PX_FORCE_INLINE void clearLinearVelModPerSec() { linearPerSec = PxVec3(0.0f); } + + PX_FORCE_INLINE const PxVec3& getLinearVelModPerStep() const { return linearPerStep; } + PX_FORCE_INLINE void accumulateLinearVelModPerStep(const PxVec3& v) { linearPerStep += v; } + PX_FORCE_INLINE void clearLinearVelModPerStep() { linearPerStep = PxVec3(0.0f); } + + PX_FORCE_INLINE const PxVec3& getAngularVelModPerSec() const { return angularPerSec; } + PX_FORCE_INLINE void accumulateAngularVelModPerSec(const PxVec3& v) { angularPerSec += v; } + PX_FORCE_INLINE void setAngularVelModPerSec(const PxVec3& v) { angularPerSec = v; } + PX_FORCE_INLINE void clearAngularVelModPerSec() { angularPerSec = PxVec3(0.0f); } + + PX_FORCE_INLINE const PxVec3& getAngularVelModPerStep() const { return angularPerStep; } + PX_FORCE_INLINE void accumulateAngularVelModPerStep(const PxVec3& v) { angularPerStep += v; } + PX_FORCE_INLINE void clearAngularVelModPerStep() { angularPerStep = PxVec3(0.0f); } + }; + PX_COMPILE_TIME_ASSERT(sizeof(VelocityMod) == sizeof(Kinematic)); + + + // Structure to store data either for kinematics (target pose etc.) or for dynamics (vel and accel changes). + // note: we do not delete this object for kinematics even if no target is set. + struct SimStateData : public PxUserAllocated // TODO: may want to optimize the allocation of this further. + { + PxU8 data[sizeof(Kinematic)]; + + enum Enum + { + eVelMod=0, + eKine + }; + + SimStateData(){} + SimStateData(const PxU8 type) + { + PxMemZero(data, sizeof(Kinematic)); + Kinematic* kine = reinterpret_cast(data); + kine->type = type; + } + + PX_FORCE_INLINE PxU32 getType() const { const Kinematic* kine = reinterpret_cast(data); return kine->type;} + PX_FORCE_INLINE bool isKine() const {return eKine == getType();} + PX_FORCE_INLINE bool isVelMod() const {return eVelMod == getType();} + + PX_FORCE_INLINE Kinematic* getKinematicData() { Kinematic* kine = reinterpret_cast(data); PX_ASSERT(eKine == kine->type); return kine;} + PX_FORCE_INLINE VelocityMod* getVelocityModData() { VelocityMod* velmod = reinterpret_cast(data); PX_ASSERT(eVelMod == velmod->type); return velmod;} + PX_FORCE_INLINE const Kinematic* getKinematicData() const { const Kinematic* kine = reinterpret_cast(data); PX_ASSERT(eKine == kine->type); return kine;} + PX_FORCE_INLINE const VelocityMod* getVelocityModData() const { const VelocityMod* velmod = reinterpret_cast(data); PX_ASSERT(eVelMod == velmod->type); return velmod;} + }; + + PX_FORCE_INLINE void simStateBackupAndClearBodyProperties(SimStateData* simStateData, PxsBodyCore& core) + { + PX_ASSERT(simStateData && simStateData->isKine()); + Kinematic* kine = simStateData->getKinematicData(); + + kine->backupLinearDamping = core.linearDamping; + kine->backupAngularDamping = core.angularDamping; + kine->backupInverseInertia = core.inverseInertia; + kine->backupInvMass = core.inverseMass; + kine->backupMaxAngVelSq = core.maxAngularVelocitySq; + kine->backupMaxLinVelSq = core.maxLinearVelocitySq; + + core.inverseMass = 0.0f; + core.inverseInertia = PxVec3(0.0f); + core.linearDamping = 0.0f; + core.angularDamping = 0.0f; + core.maxAngularVelocitySq = PX_MAX_REAL; + core.maxLinearVelocitySq = PX_MAX_REAL; + } + + PX_FORCE_INLINE void simStateRestoreBodyProperties(const SimStateData* simStateData, PxsBodyCore& core) + { + PX_ASSERT(simStateData && simStateData->isKine()); + const Kinematic* kine = simStateData->getKinematicData(); + core.inverseMass = kine->backupInvMass; + core.inverseInertia = kine->backupInverseInertia; + core.linearDamping = kine->backupLinearDamping; + core.angularDamping = kine->backupAngularDamping; + core.maxAngularVelocitySq = kine->backupMaxAngVelSq; + core.maxLinearVelocitySq = kine->backupMaxLinVelSq; + } + + PX_FORCE_INLINE void simStateClearVelMod(SimStateData* simStateData) + { + if (simStateData && simStateData->isVelMod()) + { + VelocityMod* velmod = simStateData->getVelocityModData(); + velmod->clear(); + } + } + + PX_FORCE_INLINE bool simStateGetKinematicTarget(const SimStateData* simStateData, PxTransform& p) + { + if (simStateData && simStateData->isKine() && simStateData->getKinematicData()->targetValid) + { + p = simStateData->getKinematicData()->targetPose; + return true; + } + else + return false; + } + + PX_FORCE_INLINE bool simStateGetHasValidKinematicTarget(const SimStateData* simStateData) + { + PX_ASSERT(!simStateData || simStateData->isKine()); + return simStateData && simStateData->isKine() && simStateData->getKinematicData()->targetValid; + } + + PX_FORCE_INLINE void simStateSetKinematicTarget(SimStateData* simStateData, const PxTransform& p) + { + PX_ASSERT(simStateData && simStateData->isKine()); + // setting the kinematic target is only allowed if the body is part of a scene, at which point the + // mSimStateData buffer must exist + Kinematic* kine = simStateData->getKinematicData(); + kine->targetPose = p; + kine->targetValid = 1; + } + + PX_FORCE_INLINE void simStateInvalidateKinematicTarget(SimStateData* simStateData) + { + PX_ASSERT(simStateData && simStateData->isKine()); + simStateData->getKinematicData()->targetValid = 0; + } +} // namespace Sc + +} // namespace physx + +#endif + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp new file mode 100644 index 0000000..5cdccf9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.cpp @@ -0,0 +1,143 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxMemory.h" +#include "ScSimStats.h" +#include "PxvSimStats.h" +#include "PxsHeapMemoryAllocator.h" + +using namespace physx; + +Sc::SimStats::SimStats() +{ + numBroadPhaseAdds = numBroadPhaseRemoves = 0; + + gpuMemSizeParticles = 0; + gpuMemSizeSoftBodies = 0; + + clear(); +} + +void Sc::SimStats::clear() +{ +#if PX_ENABLE_SIM_STATS + PxMemZero(const_cast(reinterpret_cast(&numTriggerPairs)), sizeof(TriggerPairCounts)); + numBroadPhaseAddsPending = numBroadPhaseRemovesPending = 0; +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + +void Sc::SimStats::simStart() +{ +#if PX_ENABLE_SIM_STATS + // pending broadphase adds/removes are now the current ones + numBroadPhaseAdds = numBroadPhaseAddsPending; + numBroadPhaseRemoves = numBroadPhaseRemovesPending; + clear(); +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS +#endif +} + +void Sc::SimStats::readOut(PxSimulationStatistics& s, const PxvSimStats& simStats) const +{ +#if PX_ENABLE_SIM_STATS + s = PxSimulationStatistics(); // clear stats + + for(PxU32 i=0; i < PxGeometryType::eCONVEXMESH+1; i++) + { + for(PxU32 j=0; j < PxGeometryType::eGEOMETRY_COUNT; j++) + { + s.nbTriggerPairs[i][j] += PxU32(numTriggerPairs[i][j]); + if (i != j) + s.nbTriggerPairs[j][i] += PxU32(numTriggerPairs[i][j]); + } + } + + s.nbBroadPhaseAdds = numBroadPhaseAdds; + s.nbBroadPhaseRemoves = numBroadPhaseRemoves; + + for(PxU32 i=0; i < PxGeometryType::eGEOMETRY_COUNT; i++) + { + s.nbDiscreteContactPairs[i][i] = simStats.mNbDiscreteContactPairs[i][i]; + s.nbModifiedContactPairs[i][i] = simStats.mNbModifiedContactPairs[i][i]; + s.nbCCDPairs[i][i] = simStats.mNbCCDPairs[i][i]; + + for(PxU32 j=i+1; j < PxGeometryType::eGEOMETRY_COUNT; j++) + { + PxU32 c = simStats.mNbDiscreteContactPairs[i][j]; + s.nbDiscreteContactPairs[i][j] = c; + s.nbDiscreteContactPairs[j][i] = c; + + c = simStats.mNbModifiedContactPairs[i][j]; + s.nbModifiedContactPairs[i][j] = c; + s.nbModifiedContactPairs[j][i] = c; + + c = simStats.mNbCCDPairs[i][j]; + s.nbCCDPairs[i][j] = c; + s.nbCCDPairs[j][i] = c; + } +#if PX_DEBUG + for(PxU32 j=0; j < i; j++) + { + // PxvSimStats should only use one half of the matrix + PX_ASSERT(simStats.mNbDiscreteContactPairs[i][j] == 0); + PX_ASSERT(simStats.mNbModifiedContactPairs[i][j] == 0); + PX_ASSERT(simStats.mNbCCDPairs[i][j] == 0); + } +#endif + } + + s.nbDiscreteContactPairsTotal = simStats.mNbDiscreteContactPairsTotal; + s.nbDiscreteContactPairsWithCacheHits = simStats.mNbDiscreteContactPairsWithCacheHits; + s.nbDiscreteContactPairsWithContacts = simStats.mNbDiscreteContactPairsWithContacts; + s.nbActiveConstraints = simStats.mNbActiveConstraints; + s.nbActiveDynamicBodies = simStats.mNbActiveDynamicBodies; + s.nbActiveKinematicBodies = simStats.mNbActiveKinematicBodies; + + s.nbAxisSolverConstraints = simStats.mNbAxisSolverConstraints; + + s.peakConstraintMemory = simStats.mPeakConstraintBlockAllocations * 16 * 1024; + s.compressedContactSize = simStats.mTotalCompressedContactSize; + s.requiredContactConstraintMemory = simStats.mTotalConstraintSize; + s.nbNewPairs = simStats.mNbNewPairs; + s.nbLostPairs = simStats.mNbLostPairs; + s.nbNewTouches = simStats.mNbNewTouches; + s.nbLostTouches = simStats.mNbLostTouches; + s.nbPartitions = simStats.mNbPartitions; + + s.gpuMemParticles = gpuMemSizeParticles; + s.gpuMemSoftBodies = gpuMemSizeSoftBodies; + +#else + PX_CATCH_UNDEFINED_ENABLE_SIM_STATS + PX_UNUSED(s); + PX_UNUSED(simStats); +#endif +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.h new file mode 100644 index 0000000..c7a96ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimStats.h @@ -0,0 +1,91 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SIM_STATS_H +#define SC_SIM_STATS_H + +#include "geometry/PxGeometry.h" +#include "PxSimulationStatistics.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxUserAllocated.h" + +namespace physx +{ + +struct PxvSimStats; + +namespace Sc +{ + + /* + Description: contains statistics for the scene. + */ + class SimStats : public PxUserAllocated + { + public: + SimStats(); + + void clear(); //set counters to zero + void simStart(); + void readOut(PxSimulationStatistics& dest, const PxvSimStats& simStats) const; + + PX_INLINE void incBroadphaseAdds() + { + numBroadPhaseAddsPending++; + } + + PX_INLINE void incBroadphaseRemoves() + { + numBroadPhaseRemovesPending++; + } + + private: + // Broadphase adds/removes for the current simulation step + PxU32 numBroadPhaseAdds; + PxU32 numBroadPhaseRemoves; + + // Broadphase adds/removes for the next simulation step + PxU32 numBroadPhaseAddsPending; + PxU32 numBroadPhaseRemovesPending; + + public: + typedef PxI32 TriggerPairCountsNonVolatile[PxGeometryType::eCONVEXMESH+1][PxGeometryType::eGEOMETRY_COUNT]; + typedef volatile TriggerPairCountsNonVolatile TriggerPairCounts; + TriggerPairCounts numTriggerPairs; + + PxU64 gpuMemSizeParticles; + PxU64 gpuMemSizeSoftBodies; + PxU64 gpuMemSizeFEMCloths; + PxU64 gpuMemSizeHairSystems; + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp new file mode 100644 index 0000000..4a6219b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.cpp @@ -0,0 +1,127 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScSimulationController.h" +#include "foundation/PxAllocator.h" +#include "CmTask.h" +#include "CmFlushPool.h" +#include "PxNodeIndex.h" +#include "ScArticulationSim.h" +#include "PxsContext.h" +#include "foundation/PxAllocator.h" +#include "BpAABBManager.h" +#include "DyVArticulation.h" + +using namespace physx; + +void Sc::SimulationController::updateScBodyAndShapeSim(PxsTransformCache& /*cache*/, Bp::BoundsArray& /*boundArray*/, PxBaseTask* continuation) +{ + mCallback->updateScBodyAndShapeSim(continuation); +} + +class UpdateArticulationAfterIntegrationTask : public Cm::Task +{ + IG::IslandSim& mIslandSim; + + const PxNodeIndex* const PX_RESTRICT mNodeIndices; + const PxU32 mNbArticulations; + const PxReal mDt; + + PX_NOCOPY(UpdateArticulationAfterIntegrationTask) +public: + static const PxU32 NbArticulationsPerTask = 64; + + + UpdateArticulationAfterIntegrationTask(PxU64 contextId, PxU32 nbArticulations, PxReal dt, + const PxNodeIndex* nodeIndices, IG::IslandSim& islandSim) : + Cm::Task(contextId), + mIslandSim(islandSim), + mNodeIndices(nodeIndices), + mNbArticulations(nbArticulations), + mDt(dt) + { + } + + virtual void runInternal() + { + for (PxU32 i = 0; i < mNbArticulations; ++i) + { + PxNodeIndex nodeIndex = mNodeIndices[i]; + //Sc::ArticulationSim* articSim = getArticulationSim(mIslandSim, nodeIndex); + Sc::ArticulationSim* articSim = mIslandSim.getArticulationSim(nodeIndex); + articSim->sleepCheck(mDt); + articSim->updateCached(NULL); + } + } + + virtual const char* getName() const { return "UpdateArticulationAfterIntegrationTask"; } +}; + + +//KS - TODO - parallelize this bit!!!!! +void Sc::SimulationController::updateArticulationAfterIntegration( + PxsContext* llContext, + Bp::AABBManagerBase* aabbManager, + PxArray& ccdBodies, + PxBaseTask* continuation, + IG::IslandSim& islandSim, + const float dt + ) +{ + const PxU32 nbActiveArticulations = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE); + + Cm::FlushPool& flushPool = llContext->getTaskPool(); + + const PxNodeIndex* activeArticulations = islandSim.getActiveNodes(IG::Node::eARTICULATION_TYPE); + + for (PxU32 i = 0; i < nbActiveArticulations; i += UpdateArticulationAfterIntegrationTask::NbArticulationsPerTask) + { + UpdateArticulationAfterIntegrationTask* task = + PX_PLACEMENT_NEW(flushPool.allocate(sizeof(UpdateArticulationAfterIntegrationTask)), UpdateArticulationAfterIntegrationTask)(islandSim.getContextId(), PxMin(UpdateArticulationAfterIntegrationTask::NbArticulationsPerTask, PxU32(nbActiveArticulations - i)), dt, + activeArticulations + i, islandSim); + task->setContinuation(continuation); + task->removeReference(); + } + + llContext->getLock().lock(); + + //const IG::NodeIndex* activeArticulations = islandSim.getActiveNodes(IG::Node::eARTICULATION_TYPE); + + PxBitMapPinned& changedAABBMgrActorHandles = aabbManager->getChangedAABBMgActorHandleMap(); + + for (PxU32 i = 0; i < nbActiveArticulations; i++) + { + Sc::ArticulationSim* articSim = islandSim.getArticulationSim(activeArticulations[i]); + + //KS - check links for CCD flags and add to mCcdBodies list if required.... + articSim->updateCCDLinks(ccdBodies); + + articSim->markShapesUpdated(&changedAABBMgrActorHandles); + } + llContext->getLock().unlock(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.h new file mode 100644 index 0000000..167c1da --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSimulationController.h @@ -0,0 +1,286 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SIMULATION_CONTROLLER_H +#define SC_SIMULATION_CONTROLLER_H + +#include "PxsSimulationController.h" + +namespace physx +{ + +class PxsHeapMemoryAllocator; + +namespace Dy +{ + class FeatherstoneArticulation; + struct ArticulationJointCore; + class ParticleSystem; + class FEMCloth; + class HairSystem; +} + +namespace Sc +{ + + class SimulationController : public PxsSimulationController + { + PX_NOCOPY(SimulationController) + public: + SimulationController(PxsSimulationControllerCallback* callback) : PxsSimulationController(callback) + { + } + + virtual ~SimulationController() {} + virtual void addJoint(const PxU32 /*edgeIndex*/, Dy::Constraint* /*constraint*/, IG::IslandSim& /*islandSim*/, PxArray& /*jointIndices*/, + PxPinnedArray& /*managerIter*/, PxU32 /*uniqueId*/){} + virtual void removeJoint(const PxU32 /*edgeIndex*/, Dy::Constraint* /*constraint*/, PxArray& /*jointIndices*/, IG::IslandSim& /*islandSim*/){} + virtual void addShape(PxsShapeSim* /*shapeSim*/, const PxU32 /*index*/){} + virtual void reinsertShape(PxsShapeSim* /*shapeSim*/, const PxU32 /*index*/) {} + virtual void removeShape(const PxU32 /*index*/){} + virtual void addDynamic(PxsRigidBody* /*rigidBody*/, const PxNodeIndex& /*nodeIndex*/){} + virtual void addDynamics(PxsRigidBody** /*rigidBody*/, const PxU32* /*nodeIndex*/, PxU32 /*nbBodies*/) {} + virtual void addArticulation(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void releaseArticulation(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void releaseDeferredArticulationIds() {} + +#if PX_SUPPORT_GPU_PHYSX + virtual void addSoftBody(Dy::SoftBody*, const PxNodeIndex&) {} + virtual void releaseSoftBody(Dy::SoftBody*) {} + virtual void releaseDeferredSoftBodyIds() {} + virtual void activateSoftbody(Dy::SoftBody*) {} + virtual void deactivateSoftbody(Dy::SoftBody*) {} + virtual void activateSoftbodySelfCollision(Dy::SoftBody*) {} + virtual void deactivateSoftbodySelfCollision(Dy::SoftBody*) {} + virtual void setSoftBodyWakeCounter(Dy::SoftBody*) {} + + + virtual void addParticleFilter(Dy::SoftBody*, Dy::ParticleSystem* , + PxU32, PxU32, PxU32){} + virtual void removeParticleFilter(Dy::SoftBody*, + const Dy::ParticleSystem*, PxU32, PxU32, PxU32){} + + virtual PxU32 addParticleAttachment(Dy::SoftBody*, const Dy::ParticleSystem*, + PxU32, PxU32, PxU32, const PxVec4&, const bool) { return 0xFFFFFFFF; } + virtual void removeParticleAttachment(Dy::SoftBody*, PxU32){} + + virtual void addRigidFilter(Dy::SoftBody*, const PxNodeIndex&, const PxNodeIndex&, PxU32) {} + virtual void removeRigidFilter(Dy::SoftBody*, const PxNodeIndex&, PxU32){} + + + virtual PxU32 addRigidAttachment(Dy::SoftBody*, const PxNodeIndex&, + PxsRigidBody*, const PxNodeIndex&, PxU32, const PxVec3&, PxConeLimitedConstraint*, const bool) {return 0xFFFFFFFF;} + virtual void removeRigidAttachment(Dy::SoftBody*, PxU32) {} + + virtual void addTetRigidFilter(Dy::SoftBody*, + const PxNodeIndex&, PxU32) {} + virtual void removeTetRigidFilter(Dy::SoftBody* , + const PxNodeIndex&, PxU32) {} + + virtual PxU32 addTetRigidAttachment(Dy::SoftBody*, PxsRigidBody*, const PxNodeIndex&, + PxU32, const PxVec4& , const PxVec3&, PxConeLimitedConstraint*, const bool) { return 0xFFFFFFFF;} + + virtual void addSoftBodyFilter(Dy::SoftBody*, Dy::SoftBody*, PxU32, + PxU32) {} + virtual void removeSoftBodyFilter(Dy::SoftBody*, Dy::SoftBody*, PxU32, + PxU32) {} + virtual void addSoftBodyFilters(Dy::SoftBody*, Dy::SoftBody*, PxU32*, PxU32*, + PxU32) {} + virtual void removeSoftBodyFilters(Dy::SoftBody*, Dy::SoftBody*, PxU32*, PxU32*, + PxU32) {} + + virtual PxU32 addSoftBodyAttachment(Dy::SoftBody* , Dy::SoftBody* , PxU32, PxU32, + const PxVec4&, const PxVec4&, PxConeLimitedConstraint*, const bool){ return 0xFFFFFFFF;} + virtual void removeSoftBodyAttachment(Dy::SoftBody*, PxU32) {} + + virtual void addClothFilter(Dy::SoftBody*, Dy::FEMCloth*, PxU32, + PxU32) {} + virtual void removeClothFilter(Dy::SoftBody*, Dy::FEMCloth*, PxU32, + PxU32) {} + + virtual PxU32 addClothAttachment(Dy::SoftBody*, Dy::FEMCloth*, PxU32, + const PxVec4&, PxU32, const PxVec4&, PxConeLimitedConstraint* , const bool) { return 0xFFFFFFFF;} + virtual void removeClothAttachment(Dy::SoftBody*, PxU32) {} + + + virtual void addFEMCloth(Dy::FEMCloth* , const PxNodeIndex&) {} + virtual void releaseFEMCloth(Dy::FEMCloth*) {} + virtual void releaseDeferredFEMClothIds() {} + virtual void activateCloth(Dy::FEMCloth*) {} + virtual void deactivateCloth(Dy::FEMCloth*) {} + virtual void setClothWakeCounter(Dy::FEMCloth*) {} + + + virtual void addRigidFilter(Dy::FEMCloth*, + const PxNodeIndex&, PxU32){} + + virtual void removeRigidFilter(Dy::FEMCloth*, + const PxNodeIndex&, PxU32){} + + virtual PxU32 addRigidAttachment(Dy::FEMCloth* , const PxNodeIndex& , + PxsRigidBody* , const PxNodeIndex& , PxU32, const PxVec3& , PxConeLimitedConstraint*, const bool){ return 0xFFFFFFFF; } + + virtual void removeRigidAttachment(Dy::FEMCloth*, PxU32 ){} + + + virtual void addTriRigidFilter(Dy::FEMCloth*, + const PxNodeIndex&, PxU32) {} + + virtual void removeTriRigidFilter(Dy::FEMCloth*, + const PxNodeIndex&, PxU32) {} + + virtual PxU32 addTriRigidAttachment(Dy::FEMCloth*, PxsRigidBody*, const PxNodeIndex& , + PxU32 , const PxVec4& , const PxVec3&, PxConeLimitedConstraint*, const bool){ return 0xFFFFFFFF;} + + virtual void removeTriRigidAttachment(Dy::FEMCloth*, PxU32){} + + virtual void addClothFilter(Dy::FEMCloth*, Dy::FEMCloth*, PxU32, PxU32) {} + virtual void removeClothFilter(Dy::FEMCloth*, Dy::FEMCloth*, PxU32, PxU32){} + + virtual PxU32 addTriClothAttachment(Dy::FEMCloth*, Dy::FEMCloth*, PxU32, PxU32, + const PxVec4&, const PxVec4&, const bool){ return 0xFFFFFFFF;} + + virtual void removeTriClothAttachment(Dy::FEMCloth*, PxU32) {} + + virtual void addParticleSystem(Dy::ParticleSystem*, const PxNodeIndex&, PxParticleSolverType::Enum) {} + virtual void releaseParticleSystem(Dy::ParticleSystem*, PxParticleSolverType::Enum) {} + virtual void releaseDeferredParticleSystemIds() {} + + virtual void addHairSystem(Dy::HairSystem *, const PxNodeIndex&) {} + virtual void releaseHairSystem(Dy::HairSystem*) {} + virtual void releaseDeferredHairSystemIds() {} + virtual void activateHairSystem(Dy::HairSystem*) {} + virtual void deactivateHairSystem(Dy::HairSystem*) {} + virtual void setHairSystemWakeCounter(Dy::HairSystem*) {} + virtual void copyHairSystemData(void** , void* , void* , PxHairSystemData::Enum , const PxU32 , const PxU32 , void* ) {} + virtual void applyHairSystemData(void** , void* , void* , PxHairSystemData::Enum , const PxU32 , const PxU32 , void* ) {} +#endif + + virtual void flush() {} + virtual void updateDynamic(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void updateJoint(const PxU32 /*edgeIndex*/, Dy::Constraint* /*constraint*/){} + virtual void updateBodies(PxsRigidBody** /*rigidBodies*/, PxU32* /*nodeIndices*/, const PxU32 /*nbBodies*/) {} + virtual void updateBody(PxsRigidBody* /*rigidBody*/, const PxU32 /*nodeIndex*/) {} + virtual void updateBodies(PxBaseTask* /*continuation*/){} + virtual void updateShapes(PxBaseTask* /*continuation*/) {} + virtual void preIntegrateAndUpdateBound(PxBaseTask* /*continuation*/, const PxVec3 /*gravity*/, const PxReal /*dt*/){} + virtual void updateParticleSystemsAndSoftBodies(){} + virtual void sortContacts(){} + virtual void update(PxBitMapPinned& /*changedHandleMap*/){} + virtual void mergeChangedAABBMgHandle(const PxU32 /*maxAABBMgHandles*/, const bool /*suppressedReadback*/) {} + virtual void gpuDmabackData(PxsTransformCache& /*cache*/, Bp::BoundsArray& /*boundArray*/, PxBitMapPinned& /*changedAABBMgrHandles*/, bool /*suppress*/){} + virtual void updateScBodyAndShapeSim(PxsTransformCache& /*cache*/, Bp::BoundsArray& /*boundArray*/, PxBaseTask* /*continuation*/); + virtual void updateArticulation(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void updateArticulationJoint(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void updateArticulationTendon(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void updateArticulationExtAccel(Dy::FeatherstoneArticulation* /*articulation*/, const PxNodeIndex& /*nodeIndex*/) {} + virtual void updateArticulationAfterIntegration(PxsContext* /*llContext*/, Bp::AABBManagerBase* /*aabbManager*/, + PxArray& /*ccdBodies*/, PxBaseTask* /*continuation*/, IG::IslandSim& /*islandSim*/, const float /*dt*/); + virtual PxU32* getActiveBodies() { return NULL; } + virtual PxU32* getDeactiveBodies() { return NULL; } + virtual void** getRigidBodies() { return NULL; } + virtual PxU32 getNbBodies() { return 0; } + virtual PxU32 getNbFrozenShapes() { return 0; } + virtual PxU32 getNbUnfrozenShapes() { return 0; } + + virtual PxU32* getUnfrozenShapes() { return NULL; } + virtual PxU32* getFrozenShapes() { return NULL; } + virtual PxsShapeSim** getShapeSims() { return NULL; } + virtual PxU32 getNbShapes() { return 0; } + + virtual void clear() { } + virtual void setBounds(Bp::BoundsArray* /*boundArray*/){} + virtual void reserve(const PxU32 /*nbBodies*/) {} + + + virtual PxU32 getArticulationRemapIndex(const PxU32 /*nodeIndex*/) { return PX_INVALID_U32;} + + //virtual void setParticleSystemManager(PxgParticleSystemCore* /* psCore*/) {} + + virtual void copyArticulationData(void* /*jointData*/, void* /*index*/, PxArticulationGpuDataType::Enum /*flag*/, const PxU32 /*nbUpdatedArticulations*/, void* /*copyEvent*/) {} + virtual void applyArticulationData(void* /*data*/, void* /*index*/, PxArticulationGpuDataType::Enum /*flag*/, const PxU32 /*nbUpdatedArticulations*/, void* /*waitEvent*/, void* /*signalEvent*/) {} + + virtual void copySoftBodyData(void** /*data*/, void* /*dataSizes*/, void* /*softBodyIndices*/, PxSoftBodyDataFlag::Enum /*flag*/, const PxU32 /*nbCopySoftBodies*/, const PxU32 /*maxSize*/, void* /*copyEvent*/) {} + virtual void applySoftBodyData(void** /*data*/, void* /*dataSizes*/, void* /*softBodyIndices*/, PxSoftBodyDataFlag::Enum /*flag*/, const PxU32 /*nbUpdatedSoftBodies*/, const PxU32 /*maxSize*/, void* /*applyEvent*/) {} + + virtual void copyContactData(Dy::Context* /*dyContext*/, void* /*data*/, const PxU32 /*maxContactPairs*/, void* /*numContactPairs*/, void* /*copyEvent*/) {} + virtual void copyBodyData(PxGpuBodyData* /*data*/, PxGpuActorPair* /*index*/, const PxU32 /*nbCopyActors*/, void* /*copyEvent*/){} + + virtual void applyActorData(void* /*data*/, PxGpuActorPair* /*index*/, PxActorCacheFlag::Enum /*flag*/, const PxU32 /*nbUpdatedActors*/, void* /*waitEvent*/, void* /*signalEvent*/) {} + + virtual void* getMPMDataPointer(const Dy::ParticleSystem& /*psLL*/, PxMPMParticleDataFlag::Enum /*flags*/) { return NULL; } + virtual void* getSparseGridDataPointer(const Dy::ParticleSystem& /*psLL*/, PxSparseGridDataFlag::Enum /*flags*/, PxParticleSolverType::Enum /*type*/) { return NULL; } + + virtual void allocatePBDMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} + virtual void allocateFLIPMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} + virtual void allocateMPMMaterialsBuffer(PxPhysXGpu* /*physxGpu*/, Dy::ParticleSystemCore& /*core*/, PxU64* /*gpuMemStat*/) {} + + virtual void syncParticleData() {} + + virtual void updateBoundsAndShapes(Bp::AABBManagerBase& /*aabbManager*/, const bool/* useGpuBp*/, const bool /*useDirectApi*/){} + + virtual void computeDenseJacobians(const PxIndexDataPair* /*indices*/, PxU32 /*nbIndices*/, void* /*computeEvent*/){} + virtual void computeGeneralizedMassMatrices(const PxIndexDataPair* /*indices*/, PxU32 /*nbIndices*/, void* /*computeEvent*/){} + virtual void computeGeneralizedGravityForces(const PxIndexDataPair* /*indices*/, PxU32 /*nbIndices*/, const PxVec3& /*gravity*/, void* /*computeEvent*/){} + virtual void computeCoriolisAndCentrifugalForces(const PxIndexDataPair* /*indices*/, PxU32 /*nbIndices*/, void* /*computeEvent*/) {} + virtual void applyParticleBufferData(const PxU32* /*indices*/, const PxGpuParticleBufferIndexPair* /*indexPairs*/, const PxParticleBufferFlags* /*flags*/, PxU32 /*nbUpdatedBuffers*/, void* /*waitEvent*/, void* /*signalEvent*/) {} + + virtual void flushInsertions() {} + +#if PX_SUPPORT_GPU_PHYSX + virtual PxU32 getNbDeactivatedFEMCloth() const { return 0; } + virtual PxU32 getNbActivatedFEMCloth() const { return 0; } + + virtual Dy::FEMCloth** getDeactivatedFEMCloths() const { return NULL; } + virtual Dy::FEMCloth** getActivatedFEMCloths() const { return NULL; } + + virtual bool hasFEMCloth() const { return false; } + + virtual PxU32 getNbDeactivatedSoftbodies() const { return 0; } + virtual PxU32 getNbActivatedSoftbodies() const { return 0; } + + virtual const PxReal* getSoftBodyWakeCounters() const { return NULL; } + + virtual Dy::SoftBody** getDeactivatedSoftbodies() const { return NULL; } + virtual Dy::SoftBody** getActivatedSoftbodies() const { return NULL; } + + virtual bool hasSoftBodies() const { return false; } + + virtual PxU32 getNbDeactivatedHairSystems() const { return 0; } + virtual PxU32 getNbActivatedHairSystems() const { return 0; } + virtual Dy::HairSystem** getDeactivatedHairSystems() const { return NULL; } + virtual Dy::HairSystem** getActivatedHairSystems() const { return NULL; } + virtual bool hasHairSystems() const { return false; } +#endif + + }; +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp new file mode 100644 index 0000000..9b4eefe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyCore.cpp @@ -0,0 +1,521 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScSoftBodyCore.h" +#include "ScFEMClothCore.h" + +#include "ScPhysics.h" +#include "ScSoftBodySim.h" +#include "DySoftBody.h" +#include "GuTetrahedronMesh.h" +#include "GuBV4.h" +#include "geometry/PxTetrahedronMesh.h" + + +using namespace physx; + +Sc::SoftBodyCore::SoftBodyCore() : + ActorCore(PxActorType::eSOFTBODY, PxActorFlag::eVISUALIZATION, PX_DEFAULT_CLIENT, 0), + mGpuMemStat(0) +{ + const PxTolerancesScale& scale = Physics::getInstance().getTolerancesScale(); + + mCore.initialRotation = PxQuat(PxIdentity); + + + mCore.sleepThreshold = 5e-5f * scale.speed * scale.speed; + mCore.wakeCounter = Physics::sWakeCounterOnCreation; + mCore.freezeThreshold = 5e-6f * scale.speed * scale.speed; + mCore.maxPenBias = -1e32f;//-PX_MAX_F32; + + mCore.solverIterationCounts = (1 << 8) | 4; + mCore.dirty = true; + mCore.mFlags = PxSoftBodyFlags(0); + + mCore.mPositionInvMass = NULL; + mCore.mPositionInvMassCPU = NULL; + + mCore.mSimPositionInvMass = NULL; + mCore.mSimPositionInvMassCPU = NULL; + mCore.mSimVelocityInvMass = NULL; + mCore.mSimVelocityInvMassCPU = NULL; + + mCore.mKinematicTarget = NULL; + mCore.mKinematicTargetCPU = NULL; +} + + +Sc::SoftBodyCore::~SoftBodyCore() +{ + if (mCore.mPositionInvMass) + mCore.mPositionInvMass->release(); + + if (mCore.mPositionInvMassCPU) + mCore.mPositionInvMassCPU->release(); + + if(mCore.mRestPositionInvMassCPU) + mCore.mRestPositionInvMassCPU->release(); + + if (mCore.mSimPositionInvMass) + mCore.mSimPositionInvMass->release(); + + if (mCore.mSimPositionInvMassCPU) + mCore.mSimPositionInvMassCPU->release(); + + if (mCore.mSimVelocityInvMass) + mCore.mSimVelocityInvMass->release(); + + if (mCore.mSimVelocityInvMassCPU) + mCore.mSimVelocityInvMassCPU->release(); + + if (mCore.mKinematicTarget) + mCore.mKinematicTarget->release(); + + if (mCore.mKinematicTargetCPU) + mCore.mKinematicTargetCPU->release(); +} + + + +void Sc::SoftBodyCore::setMaterial(const PxU16 handle) +{ + mCore.setMaterial(handle); + mCore.dirty = true; +} + +void Sc::SoftBodyCore::clearMaterials() +{ + mCore.clearMaterials(); + mCore.dirty = true; +} + +void Sc::SoftBodyCore::setFlags(PxSoftBodyFlags flags) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + const bool wasDisabledSelfCollision = mCore.mFlags & PxSoftBodyFlag::eDISABLE_SELF_COLLISION; + const bool isDisabledSelfCollision = flags & PxSoftBodyFlag::eDISABLE_SELF_COLLISION; + + if (wasDisabledSelfCollision != isDisabledSelfCollision) + { + if (isDisabledSelfCollision) + sim->disableSelfCollision(); + else + sim->enableSelfCollision(); + } + } + + mCore.mFlags = flags; + +} + + +template +void computeRestPoses(PxVec4* pInvMasses, PxMat33* tetraRestPoses, const I* const indices, const PxU32 nbTetra) +{ + for (PxU32 i = 0; i < nbTetra; ++i) + { + const PxU32 startIndex = i * 4; + // calculate rest pose + const PxVec3 x0 = pInvMasses[indices[startIndex + 0]].getXYZ(); + const PxVec3 x1 = pInvMasses[indices[startIndex + 1]].getXYZ(); + const PxVec3 x2 = pInvMasses[indices[startIndex + 2]].getXYZ(); + const PxVec3 x3 = pInvMasses[indices[startIndex + 3]].getXYZ(); + + const PxVec3 u1 = x1 - x0; + const PxVec3 u2 = x2 - x0; + const PxVec3 u3 = x3 - x0; + + PxMat33 Q = PxMat33(u1, u2, u3); + tetraRestPoses[i] = Q.getInverse(); +#if PX_CHECKED + const float det = Q.getDeterminant(); + + if (fabsf(det) <= 1.e-9f) + { + PxGetFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "computeRestPoses(): Degenerate or inverted tetrahedron\n"); + } +#endif + } +} + +PxFEMParameters Sc::SoftBodyCore::getParameter() const +{ + return mCore.parameters; +} + +void Sc::SoftBodyCore::setParameter(const PxFEMParameters parameter) +{ + mCore.parameters = parameter; + mCore.dirty = true; +} + +PxReal Sc::SoftBodyCore::getSleepThreshold() const +{ + return mCore.sleepThreshold; +} + +void Sc::SoftBodyCore::setSleepThreshold(const PxReal v) +{ + mCore.sleepThreshold = v; + mCore.dirty = true; +} + +PxReal Sc::SoftBodyCore::getFreezeThreshold() const +{ + return mCore.freezeThreshold; +} + +void Sc::SoftBodyCore::setFreezeThreshold(const PxReal v) +{ + mCore.freezeThreshold = v; + mCore.dirty = true; +} + +void Sc::SoftBodyCore::setSolverIterationCounts(const PxU16 c) +{ + mCore.solverIterationCounts = c; + mCore.dirty = true; +} + +PxReal Sc::SoftBodyCore::getWakeCounter() const +{ + return mCore.wakeCounter; +} + +void Sc::SoftBodyCore::setWakeCounter(const PxReal v) +{ + mCore.wakeCounter = v; + mCore.dirty = true; + + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->onSetWakeCounter(); + } + +} + +void Sc::SoftBodyCore::setWakeCounterInternal(const PxReal v) +{ + mCore.wakeCounter = v; + mCore.dirty = true; + + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->onSetWakeCounter(); + } +} + +bool Sc::SoftBodyCore::isSleeping() const +{ + Sc::SoftBodySim* sim = getSim(); + return sim ? sim->isSleeping() : (mCore.wakeCounter == 0.0f); +} + +void Sc::SoftBodyCore::wakeUp(PxReal wakeCounter) +{ + mCore.wakeCounter = wakeCounter; + mCore.dirty = true; +} + +void Sc::SoftBodyCore::putToSleep() +{ + mCore.wakeCounter = 0.0f; + mCore.dirty = true; +} + +PxActor* Sc::SoftBodyCore::getPxActor() const +{ + return PxPointerOffset(const_cast(this), gOffsetTable.scCore2PxActor[getActorCoreType()]); +} + +void Sc::SoftBodyCore::attachShapeCore(ShapeCore* shapeCore) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->attachShapeCore(shapeCore); + mCore.dirty = true; + } +} + +void Sc::SoftBodyCore::attachSimulationMesh(PxTetrahedronMesh* simulationMesh, PxSoftBodyAuxData* simulationState) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->attachSimulationMesh(simulationMesh, simulationState); + mCore.dirty = true; + } +} + +Sc::SoftBodySim* Sc::SoftBodyCore::getSim() const +{ + return static_cast(ActorCore::getSim()); +} + + +void Sc::SoftBodyCore::setSimulationFilterData(const PxFilterData& data) +{ + mFilterData = data; +} + +PxFilterData Sc::SoftBodyCore::getSimulationFilterData() const +{ + return mFilterData; +} + + +void Sc::SoftBodyCore::addParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId) +{ + Sc::SoftBodySim* sim = getSim(); + + if (sim) + sim->getScene().addParticleFilter(core, *sim, particleId, userBufferId, tetId); +} + +void Sc::SoftBodyCore::removeParticleFilter(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId) +{ + Sc::SoftBodySim* sim = getSim(); + + if (sim) + sim->getScene().removeParticleFilter(core, *sim, particleId, userBufferId, tetId); +} + +PxU32 Sc::SoftBodyCore::addParticleAttachment(Sc::ParticleSystemCore* core, PxU32 particleId, PxU32 userBufferId, PxU32 tetId, const PxVec4& barycentric) +{ + Sc::SoftBodySim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addParticleAttachment(core, *sim, particleId, userBufferId, tetId, barycentric); + + return handle; +} + +void Sc::SoftBodyCore::removeParticleAttachment(Sc::ParticleSystemCore* core, PxU32 handle) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->getScene().removeParticleAttachment(core, *sim, handle); + setWakeCounter(ScInternalWakeCounterResetValue); + } +} + +void Sc::SoftBodyCore::addRigidFilter(Sc::BodyCore* core, PxU32 vertId) +{ + Sc::SoftBodySim* sim = getSim(); + + if (sim) + sim->getScene().addRigidFilter(core, *sim, vertId); + +} + +void Sc::SoftBodyCore::removeRigidFilter(Sc::BodyCore* core, PxU32 vertId) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().removeRigidFilter(core, *sim, vertId); +} + +PxU32 Sc::SoftBodyCore::addRigidAttachment(Sc::BodyCore* core, PxU32 particleId, const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) +{ + Sc::SoftBodySim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if(sim) + handle = sim->getScene().addRigidAttachment(core, *sim, particleId, actorSpacePose, constraint); + + return handle; +} + +void Sc::SoftBodyCore::removeRigidAttachment(Sc::BodyCore* core, PxU32 handle) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->getScene().removeRigidAttachment(core, *sim, handle); + setWakeCounter(ScInternalWakeCounterResetValue); + } +} + + +void Sc::SoftBodyCore::addTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().addTetRigidFilter(core, *sim, tetIdx); +} + +void Sc::SoftBodyCore::removeTetRigidFilter(Sc::BodyCore* core, PxU32 tetIdx) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + { + sim->getScene().removeTetRigidFilter(core, *sim, tetIdx); + } +} +PxU32 Sc::SoftBodyCore::addTetRigidAttachment(Sc::BodyCore* core, PxU32 tetIdx, const PxVec4& barycentric, + const PxVec3& actorSpacePose, PxConeLimitedConstraint* constraint) +{ + Sc::SoftBodySim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addTetRigidAttachment(core, *sim, tetIdx, barycentric, actorSpacePose, constraint); + + return handle; +} + + +void Sc::SoftBodyCore::addSoftBodyFilter(Sc::SoftBodyCore& core, PxU32 tetIdx0, PxU32 tetIdx1) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().addSoftBodyFilter(core, tetIdx0, *sim, tetIdx1); +} + +void Sc::SoftBodyCore::removeSoftBodyFilter(Sc::SoftBodyCore& core, PxU32 tetIdx0, PxU32 tetIdx1) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().removeSoftBodyFilter(core, tetIdx0, *sim, tetIdx1); +} + +void Sc::SoftBodyCore::addSoftBodyFilters(Sc::SoftBodyCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().addSoftBodyFilters(core, *sim, tetIndices0, tetIndices1, tetIndicesSize); +} + +void Sc::SoftBodyCore::removeSoftBodyFilters(Sc::SoftBodyCore& core, PxU32* tetIndices0, PxU32* tetIndices1, PxU32 tetIndicesSize) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().removeSoftBodyFilters(core, *sim, tetIndices0, tetIndices1, tetIndicesSize); +} + + +PxU32 Sc::SoftBodyCore::addSoftBodyAttachment(Sc::SoftBodyCore& core, PxU32 tetIdx0, const PxVec4& triBarycentric0, PxU32 tetIdx1, const PxVec4& tetBarycentric1, + PxConeLimitedConstraint* constraint) +{ + Sc::SoftBodySim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addSoftBodyAttachment(core, tetIdx0, triBarycentric0, *sim, tetIdx1, tetBarycentric1, constraint); + + return handle; +} + +void Sc::SoftBodyCore::removeSoftBodyAttachment(Sc::SoftBodyCore& core, PxU32 handle) +{ + Sc::SoftBodySim* sim = getSim(); + setWakeCounterInternal(ScInternalWakeCounterResetValue); + core.setWakeCounterInternal(ScInternalWakeCounterResetValue); + if (sim) + sim->getScene().removeSoftBodyAttachment(core, *sim, handle); +} + + +void Sc::SoftBodyCore::addClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, PxU32 tetIdx) +{ + Sc::SoftBodySim* sim = getSim(); + + if (sim) + sim->getScene().addClothFilter(core, triIdx, *sim, tetIdx); +} + +void Sc::SoftBodyCore::removeClothFilter(Sc::FEMClothCore& core, PxU32 triIdx, PxU32 tetIdx) +{ + Sc::SoftBodySim* sim = getSim(); + if (sim) + sim->getScene().removeClothFilter(core, triIdx, *sim, tetIdx); +} + +PxU32 Sc::SoftBodyCore::addClothAttachment(Sc::FEMClothCore& core, PxU32 triIdx, const PxVec4& triBarycentric, PxU32 tetIdx, + const PxVec4& tetBarycentric, PxConeLimitedConstraint* constraint) +{ + Sc::SoftBodySim* sim = getSim(); + PxU32 handle = 0xFFFFFFFF; + if (sim) + handle = sim->getScene().addClothAttachment(core, triIdx, triBarycentric, *sim, tetIdx, tetBarycentric, constraint); + + return handle; +} + +void Sc::SoftBodyCore::removeClothAttachment(Sc::FEMClothCore& core, PxU32 handle) +{ + Sc::SoftBodySim* sim = getSim(); + setWakeCounter(ScInternalWakeCounterResetValue); + core.setWakeCounter(ScInternalWakeCounterResetValue); + if (sim) + sim->getScene().removeClothAttachment(core, *sim, handle); + +} + +PxU32 Sc::SoftBodyCore::getGpuSoftBodyIndex() +{ + Sc::SoftBodySim* sim = getSim(); + + return sim ? sim->getGpuSoftBodyIndex() : 0xffffffff; +} + +void Sc::SoftBodyCore::onShapeChange(ShapeCore& shape, ShapeChangeNotifyFlags notifyFlags) +{ + PX_UNUSED(shape); + SoftBodySim* sim = getSim(); + if (!sim) + return; + SoftBodyShapeSim& s = sim->getShapeSim(); + + if (notifyFlags & ShapeChangeNotifyFlag::eGEOMETRY) + s.onVolumeOrTransformChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eMATERIAL) + s.onMaterialChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eRESET_FILTERING) + s.onResetFiltering(); + if (notifyFlags & ShapeChangeNotifyFlag::eSHAPE2BODY) + s.onVolumeOrTransformChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eFILTERDATA) + s.onFilterDataChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eCONTACTOFFSET) + s.onContactOffsetChange(); + if (notifyFlags & ShapeChangeNotifyFlag::eRESTOFFSET) + s.onRestOffsetChange(); +} + + + +#endif //PX_SUPPORT_GPU_PHYSX + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp new file mode 100644 index 0000000..974c1e5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.cpp @@ -0,0 +1,163 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScSoftBodyShapeSim.h" + +#include "ScNPhaseCore.h" +#include "ScScene.h" + +#include "ScSoftBodySim.h" +#include "PxsContext.h" +#include "BpAABBManager.h" +#include "geometry/PxTetrahedronMesh.h" + +using namespace physx; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::SoftBodyShapeSim::SoftBodyShapeSim(SoftBodySim& softBody) : + ShapeSimBase(softBody, NULL), + initialTransform(PxVec3(0, 0, 0)), + initialScale(1.0f) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +Sc::SoftBodyShapeSim::~SoftBodyShapeSim() +{ + if (isInBroadPhase()) + destroyLowLevelVolume(); + + PX_ASSERT(!isInBroadPhase()); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +void Sc::SoftBodyShapeSim::attachShapeCore(const Sc::ShapeCore* shapeCore) +{ + setCore(shapeCore); + createLowLevelVolume(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::SoftBodyShapeSim::getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const +{ + filterAttr = 0; + setFilterObjectAttributeType(filterAttr, PxFilterObjectType::eSOFTBODY); + filterData = getBodySim().getCore().getSimulationFilterData(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::SoftBodyShapeSim::updateBounds() +{ + Scene& scene = getScene(); + + PxBounds3 worldBounds = getWorldBounds(); + worldBounds.fattenSafe(getContactOffset()); // fatten for fast moving colliders + scene.getBoundsArray().setBounds(worldBounds, getElementID()); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); +} + +void Sc::SoftBodyShapeSim::updateBoundsInAABBMgr() +{ + Scene& scene = getScene(); + scene.getAABBManager()->getChangedAABBMgActorHandleMap().growAndSet(getElementID()); + scene.getAABBManager()->setGPUStateChanged(); +} + +PxBounds3 Sc::SoftBodyShapeSim::getBounds() const +{ + PxBounds3 bounds = getScene().getBoundsArray().getBounds(getElementID()); + return bounds; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::SoftBodyShapeSim::createLowLevelVolume() +{ + PX_ASSERT(getWorldBounds().isFinite()); + + const PxU32 index = getElementID(); + + getScene().getBoundsArray().setBounds(getWorldBounds(), index); + + { + const PxU32 group = Bp::FilterGroup::eDYNAMICS_BASE + getActor().getActorID(); + const PxU32 type = Bp::FilterType::SOFTBODY; + addToAABBMgr(getCore().getContactOffset(), Bp::FilterGroup::Enum((group << BP_FILTERING_TYPE_SHIFT_BIT) | type), Bp::ElementType::eSHAPE); + } + + // PT: TODO: what's the difference between "getContactOffset()" and "getCore().getContactOffset()" above? + getScene().updateContactDistance(index, getContactOffset()); + + PxsTransformCache& cache = getScene().getLowLevelContext()->getTransformCache(); + cache.initEntry(index); + + PxTransform idt(PxIdentity); + + cache.setTransformCache(idt, 0, index); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void Sc::SoftBodyShapeSim::destroyLowLevelVolume() +{ + if (!isInBroadPhase()) + return; + + Sc::Scene& scene = getScene(); + PxsContactManagerOutputIterator outputs = scene.getLowLevelContext()->getNphaseImplementationContext()->getContactManagerOutputs(); + scene.getNPhaseCore()->onVolumeRemoved(this, PairReleaseFlag::eWAKE_ON_LOST_TOUCH, outputs); + removeFromAABBMgr(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +PxBounds3 Sc::SoftBodyShapeSim::getWorldBounds() const +{ + const PxTetrahedronMeshGeometry& tetGeom = static_cast(getCore().getGeometry()); + PxTetrahedronMesh* tetMesh = tetGeom.tetrahedronMesh; + + PxBounds3 bounds = tetMesh->getLocalBounds(); + + bounds.minimum *= initialScale; + bounds.maximum *= initialScale; + bounds = PxBounds3::transformFast(initialTransform, bounds); + + return bounds; +} + +Sc::SoftBodySim& Sc::SoftBodyShapeSim::getBodySim() const +{ + return static_cast(getActor()); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.h new file mode 100644 index 0000000..81f9c77 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodyShapeSim.h @@ -0,0 +1,86 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_SOFTBODY_SHAPE_SIM_H +#define SC_SOFTBODY_SHAPE_SIM_H + +#include "PxPhysXConfig.h" + +#include "ScElementSim.h" +#include "ScShapeSimBase.h" + + +namespace physx +{ + namespace Sc + { + class SoftBodySim; + + /** + A collision detection primitive for soft body. + */ + class SoftBodyShapeSim : public ShapeSimBase + { + PxTransform initialTransform; + PxReal initialScale; + + SoftBodyShapeSim& operator=(const SoftBodyShapeSim &); + public: + SoftBodyShapeSim(SoftBodySim& softbody); + virtual ~SoftBodyShapeSim(); + + PX_FORCE_INLINE void setInitialTransform(const PxTransform& transform, PxReal scale) + { + initialTransform = transform; + initialScale = scale; + //The base class constructor ensures that getElementID() points to a valid entry in the bounds array + getScene().getBoundsArray().setBounds(getWorldBounds(), getElementID()); + } + + void attachShapeCore(const ShapeCore* core); + // ElementSim implementation + virtual void getFilterInfo(PxFilterObjectAttributes& filterAttr, PxFilterData& filterData) const; + // ~ElementSim + + PxBounds3 getWorldBounds() const; + + //PX_FORCE_INLINE SoftBodySim& getBodySim() const { return static_cast(getActor()); } + SoftBodySim& getBodySim() const; + + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + void createLowLevelVolume(); + void destroyLowLevelVolume(); + }; + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp new file mode 100644 index 0000000..b3a6de8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.cpp @@ -0,0 +1,216 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + + +#include "foundation/PxPreprocessor.h" + +#if PX_SUPPORT_GPU_PHYSX + +#include "ScSoftBodySim.h" +#include "ScSoftBodyCore.h" +#include "ScScene.h" +#include "PxsSimulationController.h" + +using namespace physx; +using namespace physx::Dy; + + +Sc::SoftBodySim::SoftBodySim(SoftBodyCore& core, Scene& scene) : + ActorSim(scene, core), + mShapeSim(*this), + mNumCountedInteractions(0) +{ + + mLLSoftBody = scene.createLLSoftBody(this); + + mNodeIndex = scene.getSimpleIslandManager()->addSoftBody(mLLSoftBody, false); + + scene.getSimpleIslandManager()->activateNode(mNodeIndex); + + mLLSoftBody->setElementId(mShapeSim.getElementID()); +} + +Sc::SoftBodySim::~SoftBodySim() +{ + if (!mLLSoftBody) + return; + + mScene.destroyLLSoftBody(*mLLSoftBody); + + mScene.getSimpleIslandManager()->removeNode(mNodeIndex); + + mCore.setSim(NULL); +} + +void Sc::SoftBodySim::updateBounds() +{ + mShapeSim.updateBounds(); +} + +void Sc::SoftBodySim::updateBoundsInAABBMgr() +{ + mShapeSim.updateBoundsInAABBMgr(); +} + +PxBounds3 Sc::SoftBodySim::getBounds() const +{ + return mShapeSim.getBounds(); +} + +bool Sc::SoftBodySim::isSleeping() const +{ + IG::IslandSim& sim = mScene.getSimpleIslandManager()->getAccurateIslandSim(); + return sim.getActiveNodeIndex(mNodeIndex) == PX_INVALID_NODE; +} + + +void Sc::SoftBodySim::setActive(const bool b, const PxU32 infoFlag) +{ + PX_UNUSED(infoFlag); + if (b) + getScene().getSimulationController()->activateSoftbody(mLLSoftBody); + else + getScene().getSimulationController()->deactivateSoftbody(mLLSoftBody); +} + +void Sc::SoftBodySim::onSetWakeCounter() +{ + getScene().getSimulationController()->setSoftBodyWakeCounter(mLLSoftBody); + if (mLLSoftBody->getCore().wakeCounter > 0.f) + getScene().getSimpleIslandManager()->activateNode(mNodeIndex); + else + getScene().getSimpleIslandManager()->deactivateNode(mNodeIndex); +} + +void Sc::SoftBodySim::attachShapeCore(ShapeCore* core) +{ + mShapeSim.attachShapeCore(core); + + PxsShapeCore* shapeCore = const_cast(&core->getCore()); + mLLSoftBody->setShapeCore(shapeCore); +} + +void Sc::SoftBodySim::attachSimulationMesh(PxTetrahedronMesh* simulationMesh, PxSoftBodyAuxData* simulationState) +{ + mLLSoftBody->setSimShapeCore(simulationMesh, simulationState); +} + +PxTetrahedronMesh* Sc::SoftBodySim::getSimulationMesh() +{ + return mLLSoftBody->getSimulationMesh(); +} + +PxSoftBodyAuxData* Sc::SoftBodySim::getSoftBodyAuxData() +{ + return mLLSoftBody->getSoftBodyAuxData(); +} + +PxTetrahedronMesh* Sc::SoftBodySim::getCollisionMesh() +{ + return mLLSoftBody->getCollisionMesh(); +} + +void Sc::SoftBodySim::enableSelfCollision() +{ + if (isActive()) + { + getScene().getSimulationController()->activateSoftbodySelfCollision(mLLSoftBody); + } +} + + +void Sc::SoftBodySim::disableSelfCollision() +{ + if (isActive()) + { + getScene().getSimulationController()->deactivateSoftbodySelfCollision(mLLSoftBody); + } +} + +void Sc::SoftBodySim::activate() +{ + // Activate body + //{ + // PX_ASSERT((!isKinematic()) || notInScene() || readInternalFlag(InternalFlags(BF_KINEMATIC_MOVED | BF_KINEMATIC_SURFACE_VELOCITY))); // kinematics should only get activated when a target is set. + // // exception: object gets newly added, then the state change will happen later + // if (!isArticulationLink()) + // { + // mLLBody.mInternalFlags &= (~PxsRigidBody::eFROZEN); + // // Put in list of activated bodies. The list gets cleared at the end of a sim step after the sleep callbacks have been fired. + // getScene().onBodyWakeUp(this); + // } + + // BodyCore& core = getBodyCore(); + // if (core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) + // { + // PX_ASSERT(!getScene().isInPosePreviewList(*this)); + // getScene().addToPosePreviewList(*this); + // } + // createSqBounds(); + //} + + activateInteractions(*this); +} + +void Sc::SoftBodySim::deactivate() +{ + deactivateInteractions(*this); + + // Deactivate body + //{ + // PX_ASSERT((!isKinematic()) || notInScene() || !readInternalFlag(BF_KINEMATIC_MOVED)); // kinematics should only get deactivated when no target is set. + // // exception: object gets newly added, then the state change will happen later + // BodyCore& core = getBodyCore(); + // if (!readInternalFlag(BF_ON_DEATHROW)) + // { + // // Set velocity to 0. + // // Note: this is also fine if the method gets called because the user puts something to sleep (this behavior is documented in the API) + // PX_ASSERT(core.getWakeCounter() == 0.0f); + // const PxVec3 zero(0.0f); + // core.setLinearVelocityInternal(zero); + // core.setAngularVelocityInternal(zero); + + // setForcesToDefaults(!(mLLBody.mInternalFlags & PxsRigidBody::eDISABLE_GRAVITY)); + // } + + // if (!isArticulationLink()) // Articulations have their own sleep logic. + // getScene().onBodySleep(this); + + // if (core.getFlags() & PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW) + // { + // PX_ASSERT(getScene().isInPosePreviewList(*this)); + // getScene().removeFromPosePreviewList(*this); + // } + // destroySqBounds(); + //} +} + +PxU32 Sc::SoftBodySim::getGpuSoftBodyIndex() +{ + return mLLSoftBody->getGpuSoftBodyIndex(); +} + +#endif //PX_SUPPORT_GPU_PHYSX diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.h new file mode 100644 index 0000000..3303852 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSoftBodySim.h @@ -0,0 +1,101 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#ifndef SC_SOFTBODY_SIM_H +#define SC_SOFTBODY_SIM_H + +#include "foundation/PxUserAllocated.h" +#include "DySoftBody.h" +#include "ScSoftBodyCore.h" +#include "ScSoftBodyShapeSim.h" + +namespace physx +{ + namespace Sc + { + class Scene; + + class SoftBodySim : public ActorSim + { + public: + SoftBodySim(SoftBodyCore& core, Scene& scene); + + ~SoftBodySim(); + + PX_INLINE Dy::SoftBody* getLowLevelSoftBody() const { return mLLSoftBody; } + PX_INLINE SoftBodyCore& getCore() const { return static_cast(mCore); } + + virtual PxActor* getPxActor() const { return getCore().getPxActor(); } + + void updateBounds(); + void updateBoundsInAABBMgr(); + PxBounds3 getBounds() const; + + bool isSleeping() const; + bool isActive() const { return !isSleeping(); } + + void setActive(const bool b, const PxU32 infoFlag = 0); + + void enableSelfCollision(); + void disableSelfCollision(); + + void onSetWakeCounter(); + + void attachShapeCore(ShapeCore* core); + void attachSimulationMesh(PxTetrahedronMesh* simulationMesh, PxSoftBodyAuxData* simulationState); + PxTetrahedronMesh* getSimulationMesh(); + PxSoftBodyAuxData* getSoftBodyAuxData(); + + PxTetrahedronMesh* getCollisionMesh(); + + virtual void registerCountedInteraction() { mNumCountedInteractions++; } + virtual void unregisterCountedInteraction() { mNumCountedInteractions--; } + virtual PxU32 getNumCountedInteractions() const { return mNumCountedInteractions; } + + virtual void activate(); + virtual void deactivate(); + + PxU32 getGpuSoftBodyIndex(); + + SoftBodyShapeSim& getShapeSim() { return mShapeSim; } + + private: + SoftBodySim& operator=(const SoftBodySim&); + + Dy::SoftBody* mLLSoftBody; + + SoftBodyShapeSim mShapeSim; + + PxU32 mNumCountedInteractions; + PxU32 mIslandNodeIndex; + + }; + + } // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp new file mode 100644 index 0000000..812f997 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.cpp @@ -0,0 +1,329 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "GuPrunerTypedef.h" +#include "ScSqBoundsManager.h" +#include "ScBodySim.h" +#include "ScShapeSim.h" +#include "ScSqBoundsSync.h" +#include "common/PxProfileZone.h" + +using namespace physx; +using namespace Sc; + +#define INVALID_REF ScPrunerHandle(Gu::INVALID_PRUNERHANDLE) + +SqBoundsManager0::SqBoundsManager0() : + mShapes ("SqBoundsManager::mShapes"), + mRefs ("SqBoundsManager::mRefs"), + mBoundsIndices ("SqBoundsManager::mBoundsIndices"), + mRefless ("SqBoundsManager::mRefless") +{ +} + +void SqBoundsManager0::addSyncShape(ShapeSimBase& shape) +{ + PX_ASSERT(shape.getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE); + PX_ASSERT(!shape.getBodySim()->usingSqKinematicTarget()); + PX_ASSERT(!shape.getBodySim()->isFrozen()); + + const PxU32 id = mShapes.size(); + PX_ASSERT(id == mRefs.size()); + PX_ASSERT(id == mBoundsIndices.size()); + + shape.setSqBoundsId(id); + + // PT: mShapes / mRefs / mBoundsIndices are "parallel arrays". These arrays are persistent. + // mRefless is temporary/transient data to help populate mRefs each frame. + // mRefs / mBoundsIndices will be ultimately passed to updateObjects, whose API dictates the layout here. + // mShapes is not actually used for the sync, it's only here to be able to call setSqBoundsId in removeShape. + + mShapes.pushBack(static_cast(&shape)); + mRefs.pushBack(INVALID_REF); + mBoundsIndices.pushBack(shape.getElementID()); + mRefless.pushBack(static_cast(&shape)); +} + +void SqBoundsManager0::removeSyncShape(ShapeSimBase& shape) +{ + const PxU32 id = shape.getSqBoundsId(); + PX_ASSERT(id!=PX_INVALID_U32); + + shape.setSqBoundsId(PX_INVALID_U32); + mShapes[id] = mShapes.back(); + mBoundsIndices[id] = mBoundsIndices.back(); + mRefs[id] = mRefs.back(); + + if(id+1 != mShapes.size()) + mShapes[id]->setSqBoundsId(id); + + mShapes.popBack(); + mRefs.popBack(); + mBoundsIndices.popBack(); +} + +void SqBoundsManager0::syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, const PxTransform32* transforms, PxU64 contextID, const PxBitMap& ignoredIndices) +{ + PX_PROFILE_ZONE("Sim.sceneQuerySyncBounds", contextID); + PX_UNUSED(contextID); + +#if PX_DEBUG + for(PxU32 i=0;iusingSqKinematicTarget()); + PX_ASSERT(!shape.getBodySim()->isFrozen()); + } +#endif + + ShapeSimBase*const * shapes = mRefless.begin(); + for(PxU32 i=0, size = mRefless.size();igetSqBoundsId(); + // PT: + // + // If id == PX_INVALID_U32, the shape has been removed and not re-added. Nothing to do in this case, we just ignore it. + // This case didn't previously exist since mRefless only contained valid (added) shapes. But now we left removed shapes in the + // structure, and these have an id == PX_INVALID_U32. + // + // Now if the id is valid but mRefs[id] == PX_INVALID_U32, this is a regular shape that has been added and not processed yet. + // So we process it. + // + // Finally, if both id and mRefs[id] are not PX_INVALID_U32, this is a shape that has been added, removed, and re-added. The + // array contains the same shape twice and we only need to process it once. + if(id!=PX_INVALID_U32) + { + if(mRefs[id] == INVALID_REF) + { + PxU32 prunerIndex = 0xffffffff; + mRefs[id] = finder.find(static_cast(shapes[i]->getBodySim()->getPxActor()), shapes[i]->getPxShape(), prunerIndex); + PX_ASSERT(prunerIndex==1); + } + } + } + mRefless.clear(); + + sync.sync(1, mRefs.begin(), mBoundsIndices.begin(), bounds, transforms, mShapes.size(), ignoredIndices); +} + + + + + + + + + + + + +// PT: we need to change the code so that the shape is added to the proper array during syncBounds, not during addSyncShape, +// because the pruner index is not known in addSyncShape. We could perhaps call the ref-finder directly in addSyncShape, but +// it would impose an order on the calls (the shape would need to be added to the pruners before addSyncShape is called. There's +// no such requirement with the initial code). +// +// Instead we do this: +// - in addSyncShape we just add the shape to a "waiting room", that's all. +// - adding the shape to the proper array is delayed until syncBounds. That way the prunerIndex will be available. Also we could +// then take advantage of batching, since all shapes are processed/added at the same time. +// - the only catch is that we need to ensure the previous edge-cases are still properly handled, i.e. when a shape is added then +// removed before sync is called, etc. +// + +SqBoundsManagerEx::SqBoundsManagerEx() : + mWaitingRoom ("SqBoundsManagerEx::mWaitingRoom"), + mPrunerSyncData (NULL), + mPrunerSyncDataSize (0) +{ +} + +SqBoundsManagerEx::~SqBoundsManagerEx() +{ + const PxU32 nbToGo = mPrunerSyncDataSize; + for(PxU32 i=0;isize) + size = minSize*2; + + PrunerSyncData** items = PX_ALLOCATE(PrunerSyncData*, size, "PrunerSyncData"); + if(mPrunerSyncData) + PxMemCopy(items, mPrunerSyncData, mPrunerSyncDataSize*sizeof(PrunerSyncData*)); + PxMemZero(items+mPrunerSyncDataSize, (size-mPrunerSyncDataSize)*sizeof(PrunerSyncData*)); + PX_FREE(mPrunerSyncData); + mPrunerSyncData = items; + mPrunerSyncDataSize = size; +} + +void SqBoundsManagerEx::addSyncShape(ShapeSimBase& shape) +{ + PX_ASSERT(shape.getFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE); + PX_ASSERT(!shape.getBodySim()->usingSqKinematicTarget()); + PX_ASSERT(!shape.getBodySim()->isFrozen()); + + PX_ASSERT(shape.getSqBoundsId()==PX_INVALID_U32); + PX_ASSERT(shape.getSqPrunerIndex()==PX_INVALID_U32); + + const PxU32 id = mWaitingRoom.size(); + mWaitingRoom.pushBack(&shape); + shape.setSqBoundsId(id); + shape.setSqPrunerIndex(PX_INVALID_U32); +} + +void SqBoundsManagerEx::removeSyncShape(ShapeSimBase& shape) +{ + const PxU32 id = shape.getSqBoundsId(); + const PxU32 prunerIndex = shape.getSqPrunerIndex(); + PX_ASSERT(id!=PX_INVALID_U32); + shape.setSqBoundsId(PX_INVALID_U32); + shape.setSqPrunerIndex(PX_INVALID_U32); + + if(prunerIndex==PX_INVALID_U32) + { + // PT: this shape is still in the waiting room + PX_ASSERT(mWaitingRoom[id]==&shape); + + mWaitingRoom[id] = mWaitingRoom.back(); + if(id+1 != mWaitingRoom.size()) + mWaitingRoom[id]->setSqBoundsId(id); + mWaitingRoom.popBack(); + } + else + { + // PT: this shape is active + PX_ASSERT(prunerIndexmShapes[id]==&shape); + + psd->mShapes[id] = psd->mShapes.back(); + psd->mBoundsIndices[id] = psd->mBoundsIndices.back(); + psd->mRefs[id] = psd->mRefs.back(); + + if(id+1 != psd->mShapes.size()) + psd->mShapes[id]->setSqBoundsId(id); + + psd->mShapes.popBack(); + psd->mBoundsIndices.popBack(); + psd->mRefs.popBack(); + + if(!psd->mShapes.size()) + { + PX_DELETE(psd); + mPrunerSyncData[prunerIndex] = NULL; + } + } +} + +void SqBoundsManagerEx::syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, const PxTransform32* transforms, PxU64 contextID, const PxBitMap& ignoredIndices) +{ + PX_PROFILE_ZONE("Sim.sceneQuerySyncBounds", contextID); + PX_UNUSED(contextID); +/* +#if PX_DEBUG + for(PxU32 i=0;igetFlags() & PxShapeFlag::eSCENE_QUERY_SHAPE); + PX_ASSERT(!shape.mSim->getBodySim()->usingSqKinematicTarget()); + PX_ASSERT(!shape.mSim->getBodySim()->isFrozen()); + } +#endif +*/ + + const PxU32 nbToGo = mWaitingRoom.size(); + if(nbToGo) + { + for(PxU32 i=0;igetSqBoundsId()); + PX_ASSERT(PX_INVALID_U32==sim->getSqPrunerIndex()); + + PxU32 prunerIndex = 0xffffffff; + const ScPrunerHandle prunerHandle = finder.find(static_cast(sim->getBodySim()->getPxActor()), sim->getPxShape(), prunerIndex); + + PX_ASSERT(prunerIndex!=0xffffffff); + + if(prunerIndex>=mPrunerSyncDataSize) + resize(prunerIndex); + + PrunerSyncData* psd = mPrunerSyncData[prunerIndex]; + if(!psd) + { + psd = PX_NEW(PrunerSyncData); + mPrunerSyncData[prunerIndex] = psd; + } + + PxArray& shapes = psd->mShapes; + PxArray& refs = psd->mRefs; + PxArray& boundsIndices = psd->mBoundsIndices; + + const PxU32 id = shapes.size(); + PX_ASSERT(id == refs.size()); + PX_ASSERT(id == boundsIndices.size()); + + sim->setSqBoundsId(id); + sim->setSqPrunerIndex(prunerIndex); + + // PT: mShapes / mRefs / mBoundsIndices are "parallel arrays". These arrays are persistent. + // mRefless is temporary/transient data to help populate mRefs each frame. + // mRefs / mBoundsIndices will be ultimately passed to updateObjects, whose API dictates the layout here. + // mShapes is not actually used for the sync, it's only here to be able to call setSqBoundsId in removeShape. + + shapes.pushBack(sim); + refs.pushBack(prunerHandle); + boundsIndices.pushBack(sim->getElementID()); + } + mWaitingRoom.clear(); // PT: TODO: optimize wasted memory here + } + + // PT: TODO: optimize this + { + const PxU32 nb = mPrunerSyncDataSize; + for(PxU32 i=0;imRefs.begin(), psd->mBoundsIndices.begin(), bounds, transforms, psd->mRefs.size(), ignoredIndices); + } + } +} + diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.h new file mode 100644 index 0000000..e2762c2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScSqBoundsManager.h @@ -0,0 +1,106 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_SQ_BOUNDS_MANAGER_H +#define SC_SQ_BOUNDS_MANAGER_H + +#include "foundation/PxUserAllocated.h" +#include "foundation/PxBitMap.h" +#include "foundation/PxArray.h" + +#include "ScSqBoundsSync.h" + +namespace physx +{ + class PxBounds3; + +namespace Sc +{ + struct SqBoundsSync; + struct SqRefFinder; + class ShapeSimBase; + + class SqBoundsManager0 : public PxUserAllocated + { + PX_NOCOPY(SqBoundsManager0) + public: + SqBoundsManager0(); + + void addSyncShape(ShapeSimBase& shape); + void removeSyncShape(ShapeSimBase& shape); + void syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, const PxTransform32* transforms, PxU64 contextID, const PxBitMap& ignoredIndices); + + private: + + PxArray mShapes; // + PxArray mRefs; // SQ pruner references + PxArray mBoundsIndices; // indices into the Sc bounds array + PxArray mRefless; // shapesims without references + }; + + class SqBoundsManagerEx : public PxUserAllocated + { + PX_NOCOPY(SqBoundsManagerEx) + public: + SqBoundsManagerEx(); + ~SqBoundsManagerEx(); + + void addSyncShape(ShapeSimBase& shape); + void removeSyncShape(ShapeSimBase& shape); + void syncBounds(SqBoundsSync& sync, SqRefFinder& finder, const PxBounds3* bounds, const PxTransform32* transforms, PxU64 contextID, const PxBitMap& ignoredIndices); + + private: + + PxArray mWaitingRoom; + + // PT: one of the many solutions discussed in https://confluence.nvidia.com/display/~pterdiman/The+new+SQ+system + // Just to get something working. This will most likely need revisiting later. + + struct PrunerSyncData : public PxUserAllocated + { + PxArray mShapes; // + // PT: layout dictated by the SqPruner API here. We could consider merging these two arrays. + PxArray mRefs; // SQ pruner references + PxArray mBoundsIndices; // indices into the Sc bounds array + }; + + PrunerSyncData** mPrunerSyncData; + PxU32 mPrunerSyncDataSize; + + void resize(PxU32 index); + }; + + //class SqBoundsManager : public SqBoundsManager0 + class SqBoundsManager : public SqBoundsManagerEx + { + public: + }; +} +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp new file mode 100644 index 0000000..558979e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticCore.cpp @@ -0,0 +1,48 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + + +#include "ScStaticCore.h" +#include "ScStaticSim.h" +#include "PxRigidStatic.h" + +using namespace physx; + +Sc::StaticSim* Sc::StaticCore::getSim() const +{ + return static_cast(Sc::ActorCore::getSim()); +} + +void Sc::StaticCore::setActor2World(const PxTransform& actor2World) +{ + mCore.body2World = actor2World; + + StaticSim* sim = getSim(); + if(sim) + sim->notifyShapesOfTransformChange(); +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticSim.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticSim.h new file mode 100644 index 0000000..8ed7c7f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScStaticSim.h @@ -0,0 +1,55 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_STATIC_SIM_H +#define SC_STATIC_SIM_H + +#include "ScRigidSim.h" +#include "ScStaticCore.h" + +namespace physx +{ +namespace Sc +{ + class StaticSim : public RigidSim + { + //--------------------------------------------------------------------------------- + // Construction, destruction & initialization + //--------------------------------------------------------------------------------- + public: + StaticSim(Scene& scene, StaticCore& core) : RigidSim(scene, core) {} + ~StaticSim() { getStaticCore().setSim(NULL); } + + PX_FORCE_INLINE StaticCore& getStaticCore() const { return static_cast(getRigidCore()); } + }; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp new file mode 100644 index 0000000..e178efd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.cpp @@ -0,0 +1,139 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#include "ScTriggerInteraction.h" +#include "ScBodySim.h" +#include "ScNPhaseCore.h" + +using namespace physx; +using namespace Sc; + +TriggerInteraction::TriggerInteraction( ShapeSimBase& tShape, ShapeSimBase& oShape) : + ElementSimInteraction(tShape, oShape, InteractionType::eTRIGGER, InteractionFlag::eRB_ELEMENT | InteractionFlag::eFILTERABLE), + mLastFrameHadContacts(false) +{ + mFlags = PROCESS_THIS_FRAME; + + // The PxPairFlags eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST get stored and mixed up with internal flags. Make sure any breaking change gets noticed. + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_FOUND < PxPairFlag::eNOTIFY_TOUCH_LOST); + PX_COMPILE_TIME_ASSERT((PAIR_FLAGS_MASK & PxPairFlag::eNOTIFY_TOUCH_FOUND) == PxPairFlag::eNOTIFY_TOUCH_FOUND); + PX_COMPILE_TIME_ASSERT((PAIR_FLAGS_MASK & PxPairFlag::eNOTIFY_TOUCH_LOST) == PxPairFlag::eNOTIFY_TOUCH_LOST); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_FOUND < 0xffff); + PX_COMPILE_TIME_ASSERT(PxPairFlag::eNOTIFY_TOUCH_LOST < 0xffff); + PX_COMPILE_TIME_ASSERT(LAST < 0xffff); + + bool active = registerInActors(); + Scene& scene = getScene(); + scene.registerInteraction(this, active); + scene.getNPhaseCore()->registerInteraction(this); + + PX_ASSERT(getTriggerShape().getFlags() & PxShapeFlag::eTRIGGER_SHAPE); + mTriggerCache.state = Gu::TRIGGER_DISJOINT; +} + +TriggerInteraction::~TriggerInteraction() +{ + Scene& scene = getScene(); + scene.unregisterInteraction(this); + scene.getNPhaseCore()->unregisterInteraction(this); + unregisterFromActors(); +} + +static bool isOneActorActive(TriggerInteraction* trigger) +{ + const ActorSim& actorSim0 = trigger->getTriggerShape().getActor(); + if(actorSim0.isActive() && actorSim0.isDynamicRigid()) + { + const BodySim* bodySim0 = static_cast(&actorSim0); + PX_UNUSED(bodySim0); + PX_ASSERT(!bodySim0->isKinematic() || bodySim0->readInternalFlag(BodySim::BF_KINEMATIC_MOVED) || + bodySim0->readInternalFlag(BodySim::InternalFlags(BodySim::BF_KINEMATIC_SETTLING | BodySim::BF_KINEMATIC_SETTLING_2))); + return true; + } + + const ActorSim& actorSim1 = trigger->getOtherShape().getActor(); + if(actorSim1.isActive() && actorSim1.isDynamicRigid()) + { + const BodySim* bodySim1 = static_cast(&actorSim1); + PX_UNUSED(bodySim1); + PX_ASSERT(!bodySim1->isKinematic() || bodySim1->readInternalFlag(BodySim::BF_KINEMATIC_MOVED) || + bodySim1->readInternalFlag(BodySim::InternalFlags(BodySim::BF_KINEMATIC_SETTLING | BodySim::BF_KINEMATIC_SETTLING_2))); + return true; + } + + return false; +} + +// +// Some general information about triggers and sleeping +// +// The goal is to avoid running overlap tests if both objects are sleeping. +// This is an optimization for eNOTIFY_TOUCH_LOST events since the overlap state +// can not change if both objects are sleeping. eNOTIFY_TOUCH_FOUND should be sent nonetheless. +// For this to work the following assumptions are made: +// - On creation or if the pose of an actor is set, the pair will always be checked. +// - If the scenario above does not apply, then a trigger pair can only be deactivated, if both actors are sleeping. +// - If an overlapping actor is activated/deactivated, the trigger interaction gets notified +// +bool TriggerInteraction::onActivate_(void*) +{ + // IMPORTANT: this method can get called concurrently from multiple threads -> make sure shared resources + // are protected (note: there are none at the moment but it might change) + + if(!(readFlag(PROCESS_THIS_FRAME))) + { + if(isOneActorActive(this)) + { + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; + } + else + return false; + } + else + { + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; // newly created trigger pairs should always test for overlap, no matter the sleep state + } +} + +bool TriggerInteraction::onDeactivate_() +{ + if(!readFlag(PROCESS_THIS_FRAME)) + { + if(!isOneActorActive(this)) + { + clearInteractionFlag(InteractionFlag::eIS_ACTIVE); + return true; + } + else + return false; + } + else + return false; +} diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.h new file mode 100644 index 0000000..5fde8fb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerInteraction.h @@ -0,0 +1,118 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_TRIGGER_INTERACTION_H +#define SC_TRIGGER_INTERACTION_H + +#include "ScElementSimInteraction.h" +#include "ScShapeSim.h" +#include "GuOverlapTests.h" + +namespace physx +{ +namespace Sc +{ + class TriggerInteraction : public ElementSimInteraction + { + public: + enum TriggerFlag + { + PAIR_FLAGS_MASK = ((PxPairFlag::eNOTIFY_TOUCH_LOST << 1) - 1), // Bits where the PxPairFlags eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST get stored + NEXT_FREE = ((PAIR_FLAGS_MASK << 1) & ~PAIR_FLAGS_MASK), + + PROCESS_THIS_FRAME = (NEXT_FREE << 0), // the trigger pair is new or the pose of an actor was set -> initial processing required. + // This is important to cover cases where a static or kinematic + // (non-moving) trigger is created and overlaps with a sleeping + // object. Or for the case where a static/kinematic is teleported to a new + // location. TOUCH_FOUND should still get sent in that case. + LAST = (NEXT_FREE << 1) + }; + + TriggerInteraction(ShapeSimBase& triggerShape, ShapeSimBase& otherShape); + ~TriggerInteraction(); + + PX_FORCE_INLINE Gu::TriggerCache& getTriggerCache() { return mTriggerCache; } + PX_FORCE_INLINE ShapeSimBase& getTriggerShape() const { return static_cast(getElement0()); } + PX_FORCE_INLINE ShapeSimBase& getOtherShape() const { return static_cast(getElement1()); } + + PX_FORCE_INLINE bool lastFrameHadContacts() const { return mLastFrameHadContacts; } + PX_FORCE_INLINE void updateLastFrameHadContacts(bool hasContact) { mLastFrameHadContacts = hasContact; } + + PX_FORCE_INLINE PxPairFlags getTriggerFlags() const { return PxPairFlags(mFlags & PAIR_FLAGS_MASK); } + PX_FORCE_INLINE void setTriggerFlags(PxPairFlags triggerFlags); + + PX_FORCE_INLINE void raiseFlag(TriggerFlag flag) { mFlags |= flag; } + PX_FORCE_INLINE void clearFlag(TriggerFlag flag) { mFlags &= ~flag; } + PX_FORCE_INLINE PxIntBool readFlag(TriggerFlag flag) const { return PxIntBool(mFlags & flag); } + + PX_FORCE_INLINE void forceProcessingThisFrame(Sc::Scene& scene); + + bool onActivate_(void*); + bool onDeactivate_(); + + protected: + Gu::TriggerCache mTriggerCache; + bool mLastFrameHadContacts; + }; + +} // namespace Sc + + +PX_FORCE_INLINE void Sc::TriggerInteraction::setTriggerFlags(PxPairFlags triggerFlags) +{ + PX_ASSERT(PxU32(triggerFlags) < (PxPairFlag::eDETECT_CCD_CONTACT << 1)); // to find out if a new PxPairFlag has been added in which case PAIR_FLAGS_MASK needs to get adjusted + +#if PX_CHECKED + if (triggerFlags & PxPairFlag::eNOTIFY_TOUCH_PERSISTS) + { + PX_WARN_ONCE("Trigger pairs do not support PxPairFlag::eNOTIFY_TOUCH_PERSISTS events any longer."); + } +#endif + + PxU32 newFlags = mFlags; + PxU32 fl = PxU32(triggerFlags) & PxU32(PxPairFlag::eNOTIFY_TOUCH_FOUND|PxPairFlag::eNOTIFY_TOUCH_LOST); + newFlags &= (~PAIR_FLAGS_MASK); // clear old flags + newFlags |= fl; + + mFlags = newFlags; +} + +PX_FORCE_INLINE void Sc::TriggerInteraction::forceProcessingThisFrame(Sc::Scene& scene) +{ + raiseFlag(PROCESS_THIS_FRAME); + + if (!readInteractionFlag(InteractionFlag::eIS_ACTIVE)) + { + raiseInteractionFlag(InteractionFlag::eIS_ACTIVE); + scene.notifyInteractionActivated(this); + } +} + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerPairs.h b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerPairs.h new file mode 100644 index 0000000..94eac0c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/simulationcontroller/src/ScTriggerPairs.h @@ -0,0 +1,93 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef SC_TRIGGER_PAIRS_H +#define SC_TRIGGER_PAIRS_H + +#include "foundation/PxArray.h" +#include "PxFiltering.h" +#include "PxClient.h" +#include "PxSimulationEventCallback.h" + +namespace physx +{ +class PxShape; + +namespace Sc +{ + struct TriggerPairFlag + { + enum Enum + { + eTEST_FOR_REMOVED_SHAPES = PxTriggerPairFlag::eNEXT_FREE // for cases where the pair got deleted because one of the shape volumes got removed from broadphase. + // This covers scenarios like volume re-insertion into broadphase as well since the shape might get removed + // after such an operation. The scenarios to consider are: + // + // - shape gets removed (this includes raising PxActorFlag::eDISABLE_SIMULATION) + // - shape switches to eSCENE_QUERY_SHAPE only + // - shape switches to eSIMULATION_SHAPE + // - resetFiltering() + // - actor gets removed from an aggregate + }; + }; + + PX_COMPILE_TIME_ASSERT((1 << (8*sizeof(PxTriggerPairFlags::InternalType))) > TriggerPairFlag::eTEST_FOR_REMOVED_SHAPES); + + struct TriggerPairExtraData + { + PX_INLINE TriggerPairExtraData() : + shape0ID(0xffffffff), + shape1ID(0xffffffff), + client0ID(0xff), + client1ID(0xff) + { + } + + PX_INLINE TriggerPairExtraData(PxU32 s0ID, PxU32 s1ID, + PxClientID cl0ID, PxClientID cl1ID) : + shape0ID(s0ID), + shape1ID(s1ID), + client0ID(cl0ID), + client1ID(cl1ID) + { + } + + PxU32 shape0ID; + PxU32 shape1ID; + PxClientID client0ID; + PxClientID client1ID; + }; + + typedef PxArray TriggerBufferExtraData; + typedef PxArray TriggerBufferAPI; + +} // namespace Sc + +} + +#endif diff --git a/modules/PhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp b/modules/PhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp new file mode 100644 index 0000000..76dee30 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/source/task/src/TaskManager.cpp @@ -0,0 +1,444 @@ +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2023 NVIDIA Corporation. All rights reserved. + +#include "task/PxTask.h" +#include "foundation/PxErrors.h" +#include "foundation/PxHashMap.h" +#include "foundation/PxAllocator.h" +#include "foundation/PxAtomic.h" +#include "foundation/PxMutex.h" +#include "foundation/PxArray.h" + +#include "foundation/PxThread.h" + +#define LOCK() PxMutex::ScopedLock _lock_(mMutex) + +namespace physx +{ + const int EOL = -1; + typedef PxHashMap PxTaskNameToIDMap; + + struct PxTaskDepTableRow + { + PxTaskID mTaskID; + int mNextDep; + }; + typedef PxArray PxTaskDepTable; + + class PxTaskTableRow + { + public: + PxTaskTableRow() : mRefCount( 1 ), mStartDep(EOL), mLastDep(EOL) {} + void addDependency( PxTaskDepTable& depTable, PxTaskID taskID ) + { + int newDep = int(depTable.size()); + PxTaskDepTableRow row; + row.mTaskID = taskID; + row.mNextDep = EOL; + depTable.pushBack( row ); + + if( mLastDep == EOL ) + { + mStartDep = mLastDep = newDep; + } + else + { + depTable[ uint32_t(mLastDep) ].mNextDep = newDep; + mLastDep = newDep; + } + } + + PxTask * mTask; + volatile int mRefCount; + PxTaskType::Enum mType; + int mStartDep; + int mLastDep; + }; + typedef PxArray PxTaskTable; + + +/* Implementation of PxTaskManager abstract API */ +class PxTaskMgr : public PxTaskManager, public PxUserAllocated +{ + PX_NOCOPY(PxTaskMgr) +public: + PxTaskMgr(PxErrorCallback& , PxCpuDispatcher*); + ~PxTaskMgr(); + + void setCpuDispatcher( PxCpuDispatcher& ref ) + { + mCpuDispatcher = &ref; + } + + PxCpuDispatcher* getCpuDispatcher() const + { + return mCpuDispatcher; + } + + void resetDependencies(); + void startSimulation(); + void stopSimulation(); + void taskCompleted( PxTask& task ); + + PxTaskID getNamedTask( const char *name ); + PxTaskID submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type = PxTaskType::eCPU ); + PxTaskID submitUnnamedTask( PxTask& task, PxTaskType::Enum type = PxTaskType::eCPU ); + PxTask* getTaskFromID( PxTaskID ); + + void dispatchTask( PxTaskID taskID ); + void resolveRow( PxTaskID taskID ); + + void release(); + + void finishBefore( PxTask& task, PxTaskID taskID ); + void startAfter( PxTask& task, PxTaskID taskID ); + + void addReference( PxTaskID taskID ); + void decrReference( PxTaskID taskID ); + int32_t getReference( PxTaskID taskID ) const; + + void decrReference( PxLightCpuTask& lighttask ); + void addReference( PxLightCpuTask& lighttask ); + + PxErrorCallback& mErrorCallback; + PxCpuDispatcher *mCpuDispatcher; + PxTaskNameToIDMap mName2IDmap; + volatile int mPendingTasks; + PxMutex mMutex; + + PxTaskDepTable mDepTable; + PxTaskTable mTaskTable; + + PxArray mStartDispatch; + }; + +PxTaskManager* PxTaskManager::createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher) +{ + return PX_NEW(PxTaskMgr)(errorCallback, cpuDispatcher); +} + +PxTaskMgr::PxTaskMgr(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher) + : mErrorCallback (errorCallback) + , mCpuDispatcher( cpuDispatcher ) + , mPendingTasks( 0 ) + , mDepTable("PxTaskDepTable") + , mTaskTable("PxTaskTable") + , mStartDispatch("StartDispatch") +{ +} + +PxTaskMgr::~PxTaskMgr() +{ +} + +void PxTaskMgr::release() +{ + PX_DELETE_THIS; +} + +void PxTaskMgr::decrReference(PxLightCpuTask& lighttask) +{ + /* This does not need a lock! */ + if (!PxAtomicDecrement(&lighttask.mRefCount)) + { + PX_ASSERT(mCpuDispatcher); + if (mCpuDispatcher) + { + mCpuDispatcher->submitTask(lighttask); + } + else + { + lighttask.release(); + } + } +} + +void PxTaskMgr::addReference(PxLightCpuTask& lighttask) +{ + /* This does not need a lock! */ + PxAtomicIncrement(&lighttask.mRefCount); +} + +/* + * Called by the owner (Scene) at the start of every frame, before + * asking for tasks to be submitted. + */ +void PxTaskMgr::resetDependencies() +{ + PX_ASSERT( !mPendingTasks ); // only valid if you don't resubmit named tasks, this is true for the SDK + PX_ASSERT( mCpuDispatcher ); + mTaskTable.clear(); + mDepTable.clear(); + mName2IDmap.clear(); + mPendingTasks = 0; +} + +/* + * Called by the owner (Scene) to start simulating the task graph. + * Dispatch all tasks with refCount == 1 + */ +void PxTaskMgr::startSimulation() +{ + PX_ASSERT( mCpuDispatcher ); + + /* Handle empty task graph */ + if( mPendingTasks == 0 ) + return; + + for( PxTaskID i = 0 ; i < mTaskTable.size() ; i++ ) + { + if( mTaskTable[ i ].mType == PxTaskType::eCOMPLETED ) + { + continue; + } + if( !PxAtomicDecrement( &mTaskTable[ i ].mRefCount ) ) + { + mStartDispatch.pushBack(i); + } + } + for( uint32_t i=0; isecond; + } + else + { + // create named entry in task table, without a task + return submitNamedTask( NULL, name, PxTaskType::eNOT_PRESENT ); + } +} + +PxTask* PxTaskMgr::getTaskFromID( PxTaskID id ) +{ + LOCK(); // todo: reader lock necessary? + return mTaskTable[ id ].mTask; +} + +/* If called at runtime, must be thread-safe */ +PxTaskID PxTaskMgr::submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type ) +{ + if( task ) + { + task->mTm = this; + task->submitted(); + } + + LOCK(); + + const PxTaskNameToIDMap::Entry *ret = mName2IDmap.find( name ); + if( ret ) + { + PxTaskID prereg = ret->second; + if( task ) + { + /* name was registered for us by a dependent task */ + PX_ASSERT( !mTaskTable[ prereg ].mTask ); + PX_ASSERT( mTaskTable[ prereg ].mType == PxTaskType::eNOT_PRESENT ); + mTaskTable[ prereg ].mTask = task; + mTaskTable[ prereg ].mType = type; + task->mTaskID = prereg; + } + return prereg; + } + else + { + PxAtomicIncrement(&mPendingTasks); + PxTaskID id = static_cast(mTaskTable.size()); + mName2IDmap[ name ] = id; + if( task ) + { + task->mTaskID = id; + } + PxTaskTableRow r; + r.mTask = task; + r.mType = type; + mTaskTable.pushBack(r); + return id; + } +} + +/* + * Add an unnamed task to the task table + */ +PxTaskID PxTaskMgr::submitUnnamedTask( PxTask& task, PxTaskType::Enum type ) +{ + PxAtomicIncrement(&mPendingTasks); + + task.mTm = this; + task.submitted(); + + LOCK(); + task.mTaskID = static_cast(mTaskTable.size()); + PxTaskTableRow r; + r.mTask = &task; + r.mType = type; + mTaskTable.pushBack(r); + return task.mTaskID; +} + +/* Called by worker threads (or cooperating application threads) when a + * PxTask has completed. Propogate depdenencies, decrementing all + * referenced tasks' refCounts. If any of those reach zero, activate + * those tasks. + */ +void PxTaskMgr::taskCompleted( PxTask& task ) +{ + LOCK(); + resolveRow(task.mTaskID); +} + +/* ================== Private Functions ======================= */ + +/* + * Add a dependency to force 'task' to complete before the + * referenced 'taskID' is allowed to be dispatched. + */ +void PxTaskMgr::finishBefore( PxTask& task, PxTaskID taskID ) +{ + LOCK(); + PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::eCOMPLETED ); + + mTaskTable[ task.mTaskID ].addDependency( mDepTable, taskID ); + PxAtomicIncrement( &mTaskTable[ taskID ].mRefCount ); +} + +/* + * Add a dependency to force 'task' to wait for the referenced 'taskID' + * to complete before it is allowed to be dispatched. + */ +void PxTaskMgr::startAfter( PxTask& task, PxTaskID taskID ) +{ + LOCK(); + PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::eCOMPLETED ); + + mTaskTable[ taskID ].addDependency( mDepTable, task.mTaskID ); + PxAtomicIncrement( &mTaskTable[ task.mTaskID ].mRefCount ); +} + +void PxTaskMgr::addReference( PxTaskID taskID ) +{ + LOCK(); + PxAtomicIncrement( &mTaskTable[ taskID ].mRefCount ); +} + +/* + * Remove one reference count from a task. Must be done here to make it thread safe. + */ +void PxTaskMgr::decrReference( PxTaskID taskID ) +{ + LOCK(); + + if( !PxAtomicDecrement( &mTaskTable[ taskID ].mRefCount ) ) + { + dispatchTask(taskID); + } +} + +int32_t PxTaskMgr::getReference(PxTaskID taskID) const +{ + return mTaskTable[ taskID ].mRefCount; +} + +/* + * A task has completed, decrement all dependencies and submit tasks + * that are ready to run. Signal simulation end if ther are no more + * pending tasks. + */ +void PxTaskMgr::resolveRow( PxTaskID taskID ) +{ + int depRow = mTaskTable[ taskID ].mStartDep; + + while( depRow != EOL ) + { + PxTaskDepTableRow& row = mDepTable[ uint32_t(depRow) ]; + PxTaskTableRow& dtt = mTaskTable[ row.mTaskID ]; + + if( !PxAtomicDecrement( &dtt.mRefCount ) ) + { + dispatchTask( row.mTaskID ); + } + + depRow = row.mNextDep; + } + + PxAtomicDecrement( &mPendingTasks ); +} + +/* + * Submit a ready task to its appropriate dispatcher. + */ +void PxTaskMgr::dispatchTask( PxTaskID taskID ) +{ + LOCK(); // todo: reader lock necessary? + PxTaskTableRow& tt = mTaskTable[ taskID ]; + + // prevent re-submission + if( tt.mType == PxTaskType::eCOMPLETED ) + { + mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "PxTask dispatched twice", __FILE__, __LINE__); + return; + } + + switch ( tt.mType ) + { + case PxTaskType::eCPU: + mCpuDispatcher->submitTask( *tt.mTask ); + break; + case PxTaskType::eNOT_PRESENT: + /* No task registered with this taskID, resolve its dependencies */ + PX_ASSERT(!tt.mTask); + //PxGetFoundation().error(PX_INFO, "unregistered task resolved"); + resolveRow( taskID ); + break; + case PxTaskType::eCOMPLETED: + default: + mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "Unknown task type", __FILE__, __LINE__); + resolveRow( taskID ); + break; + } + + tt.mType = PxTaskType::eCOMPLETED; +} + +}// end physx namespace diff --git a/modules/PhysX/physx/physx-sys/physx/physx/version.txt b/modules/PhysX/physx/physx-sys/physx/physx/version.txt new file mode 100644 index 0000000..1e74033 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/physx/physx/version.txt @@ -0,0 +1 @@ +5.1.3.32494398 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/Cargo.lock b/modules/PhysX/physx/physx-sys/pxbind/Cargo.lock new file mode 100644 index 0000000..28f87a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/Cargo.lock @@ -0,0 +1,414 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clang-ast" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5218f4ca4789f5665f2a29a08b3fd36a9862364ef29892a1255b7efcf91edc78" +dependencies = [ + "rustc-hash", + "serde", +] + +[[package]] +name = "console" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "windows-sys", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "insta" +version = "1.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5" +dependencies = [ + "console", + "lazy_static", + "linked-hash-map", + "similar", +] + +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "pxbind" +version = "0.1.0" +dependencies = [ + "anyhow", + "clang-ast", + "env_logger", + "heck", + "insta", + "log", + "serde", + "serde_json", + "tempfile", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "similar" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/modules/PhysX/physx/physx-sys/pxbind/Cargo.toml b/modules/PhysX/physx/physx-sys/pxbind/Cargo.toml new file mode 100644 index 0000000..e5ea267 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "pxbind" +version = "0.1.0" +edition = "2021" +license = "MIT OR Apache-2.0" +publish = false + +[dependencies] +anyhow = "1.0" +clang-ast = "0.1" +env_logger = "0.10" +heck = "0.4" +log = "0.4" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + +[dev-dependencies] +insta = "1.26" +tempfile = "3.6" diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/consumer.rs b/modules/PhysX/physx/physx-sys/pxbind/src/consumer.rs new file mode 100644 index 0000000..6d7ff76 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/consumer.rs @@ -0,0 +1,1027 @@ +use crate::Node; + +use serde::Deserialize; + +mod record; +use anyhow::Context as _; +pub use record::*; +mod enums; +use clang_ast::Id; +pub use enums::{EnumBinding, FlagsBinding}; +pub mod functions; +pub use functions::{FuncBinding, PhysxInvoke}; +mod templates; +pub use templates::{Template, TemplateArg}; + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Type { + desugared_qual_type: Option, + qual_type: String, + //type_alias_decl_id: Option, +} + +#[derive(Deserialize, Debug)] +pub struct EnumDecl { + name: Option, +} + +#[derive(Deserialize, Debug)] +pub struct EnumConstDecl { + name: String, + #[serde(rename = "type")] + kind: Type, +} + +#[derive(Deserialize, Debug)] +pub struct Param { + name: Option, + #[serde(rename = "type")] + kind: Type, +} + +#[derive(Deserialize, Debug)] +pub struct Typedef { + name: String, + #[serde(rename = "type")] + kind: Type, + id: Option, +} + +// #[derive(Deserialize, Debug)] +// pub struct Decl { +// id: Id, +// kind: clang_ast::Kind, +// name: String, +// } + +#[derive(Deserialize, Debug)] +pub enum Item { + NamespaceDecl { + name: Option, + }, + /// Declarations for classes and structs + CXXRecordDecl(Record), + FieldDecl { + name: Option, + #[serde(rename = "type")] + kind: Type, + }, + CXXMethodDecl(Method), + CXXConstructorDecl(Constructor), + CXXDestructorDecl(Method), + ParmVarDecl(Param), + FunctionTemplateDecl, + FunctionDecl(functions::Function), + LinkageSpecDecl { + language: String, + }, + /// Enums + EnumDecl(EnumDecl), + /// Enum variants + EnumConstantDecl(EnumConstDecl), + /// Access, eg public/protected/private + AccessSpecDecl { + access: Access, + }, + BlockCommandComment { + /// PhysX uses doxygen, so this will often be "brief", which in Rust + /// terms means we place the _next_ `TextComment::text` as the top line + /// for the item, and then any _other_ comments as separate + name: Option, + }, + ParagraphComment, + /// The text part of a C++ comment + TextComment { + text: String, + }, + ImplicitCastExpr { + #[serde(rename = "type")] + kind: Type, + }, + ConstantExpr { + value: String, + #[serde(rename = "type")] + kind: Type, + }, + TemplateSpecializationType { + #[serde(rename = "templateName")] + template_name: String, + }, + TemplateArgument { + #[serde(rename = "type")] + kind: Option, + value: Option, + }, + RecordType { + #[serde(rename = "type")] + kind: Type, + //decl: Decl, + }, + ClassTemplateDecl { + name: String, + }, + TemplateTypeParmDecl { + name: Option, + }, + NonTypeTemplateParmDecl { + name: Option, + #[serde(rename = "type")] + kind: Type, + }, + ClassTemplateSpecializationDecl(Record), + TypedefDecl(Typedef), + /// The deprecated declspec has been defined on the item (PX_DEPRECATED) + DeprecatedAttr, + /// We don't care about other items + Other { + kind: Option, + name: Option, + }, +} + +impl fmt::Display for Item { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::NamespaceDecl { name } => write!(f, "namespace '{name:?}'"), + Self::CXXRecordDecl(rec) => { + write!(f, "{} '{:?}'", rec.tag_used.unwrap_or(Tag::Class), rec.name) + } + Self::FieldDecl { name, .. } => write!(f, "field '{name:?}'"), + Self::CXXMethodDecl(method) => write!(f, "method '{:?}'", method.name), + Self::CXXConstructorDecl(ctor) => write!(f, "constructor '{:?}'", ctor.inner.name), + Self::CXXDestructorDecl(dtor) => write!(f, "destructor '{:?}'", dtor.name), + Self::EnumDecl(enm) => write!(f, "enum '{:?}'", enm.name), + Self::FunctionDecl(fun) => write!(f, "function '{}'", fun.name), + Self::TypedefDecl(td) => write!(f, "typedef '{}'", td.name), + _ => write!(f, "{self:?}"), + } + } +} + +impl Item { + #[inline] + fn as_method(&self) -> Option<&Method> { + let meth = match self { + Self::CXXMethodDecl(meth) => meth, + Self::CXXConstructorDecl(ctor) => &ctor.inner, + Self::CXXDestructorDecl(dtor) => dtor, + _ => return None, + }; + + Some(meth) + } +} + +#[derive(Default)] +pub struct Block<'ast> { + b: Vec<&'ast str>, +} + +impl<'ast> Block<'ast> { + #[inline] + fn push(&mut self, line: &'ast str) { + self.b.push(line); + } + + #[inline] + fn merge(&mut self, next: Block<'ast>) { + if next.is_empty() { + return; + } + + if !self.b.is_empty() { + self.push(""); + } + + for line in next.b { + self.b.push(line); + } + } + + #[inline] + pub fn as_slice(&self) -> &[&'ast str] { + self.b.as_slice() + } + + #[inline] + pub fn is_empty(&self) -> bool { + self.b.is_empty() + } +} + +pub fn search<'ast, T>( + node: &'ast Node, + f: &impl Fn(&'ast Node) -> Option<&'ast T>, +) -> Option<(&'ast Node, &'ast T)> { + if let Some(t) = f(node) { + return Some((node, t)); + } + + for inn in &node.inner { + if let Some(t) = search(inn, f) { + return Some(t); + } + } + + None +} + +pub struct Comment<'ast> { + /// This is the top line, we attempt to retrieve this if the comment is a + /// doxygen `/brief` section + pub summary: Block<'ast>, + /// Additional information outside of the brief section, note that the content + /// in this paragraph will be massaged so that doxygen style # references + /// will be transformed into appropriate rustdoc intralinks + pub additional: Block<'ast>, +} + +use std::collections::HashMap; + +pub struct ClassDef<'ast> { + /// Index in `recs` where the binding is located + pub index: usize, + pub node: &'ast Node, + pub rec: &'ast Record, +} + +#[derive(Default)] +pub struct AstConsumer<'ast> { + pub enums: Vec>, + pub enum_map: HashMap<&'ast str, (Builtin, &'ast str)>, + pub flags: Vec>, + pub flags_map: HashMap<&'ast str, Builtin>, + pub type_defs: HashMap<&'ast str, QualType<'ast>>, + pub recs: Vec>, + pub funcs: Vec>, + func_map: HashMap<&'ast str, u8>, + pub templates: HashMap<&'ast str, Template<'ast>>, + /// Mapping of class names -> node & record so we can check hierarchies + /// for `release` methods, or whether something is a record at all + pub classes: HashMap<&'ast str, Option>>, + pub back_refs: HashMap, +} + +impl<'ast> AstConsumer<'ast> { + pub fn consume(&mut self, root: &'ast Node) -> anyhow::Result<()> { + self.traverse(root, root, false, false) + } + + fn traverse( + &mut self, + node: &'ast Node, + root: &'ast Node, + in_physx: bool, + in_c: bool, + ) -> anyhow::Result<()> { + for inn in &node.inner { + if Self::is_deprecated(inn) { + log::debug!("skipping deprecated node {}", inn.kind); + continue; + } + + #[allow(clippy::match_same_arms)] + match &inn.kind { + Item::NamespaceDecl { name } => { + if name.as_deref() == Some("physx") { + self.traverse(inn, root, true, false)?; + } + } + Item::EnumDecl(decl) if in_physx => { + self.consume_enum(node, inn, decl)?; + } + Item::CXXRecordDecl(rec) if in_physx => { + if !in_physx { + continue; + } + + // If a record decl doesn't have any inner nodes, it's just + // a foreward declaration and we can skip it + if inn.inner.is_empty() || rec.definition_data.is_none() { + let Some(name) = rec.name.as_deref() else { + continue; + }; + + if !self.classes.contains_key(name) { + self.recs + .push(RecBinding::Forward(RecBindingForward { name })); + self.classes.insert(name, None); + } + + continue; + } + + self.consume_record(inn, rec) + .with_context(|| format!("failed to consume {rec:?}"))?; + } + Item::TypedefDecl(td) if in_physx => { + self.consume_typedef(inn, td, root)?; + } + Item::FunctionDecl(func) => { + if in_physx || (in_c && func.name.starts_with("Px")) { + self.consume_function(inn, func, &[], in_c)?; + } + } + Item::ClassTemplateDecl { .. } => { + //self.consume_template_decl(inn, name)?; + } + Item::FunctionTemplateDecl => {} + Item::LinkageSpecDecl { language } if language == "C" => { + self.traverse(inn, root, in_physx, true)?; + } + _ => { + self.traverse(inn, root, in_physx, in_c)?; + } + } + } + + Ok(()) + } + + /// Check to see if the node has the deprecated attribute, if so we can + /// ignore emitting it. + /// + /// This can get rid of entire types, so we need to account for that when + /// traversing the graph to emit types and functions + #[inline] + fn is_deprecated(node: &'ast Node) -> bool { + node.inner + .iter() + .any(|inn| matches!(inn.kind, Item::DeprecatedAttr)) + + // TODO: Maybe ignore some more types here + //false + } + + fn consume_typedef( + &mut self, + node: &'ast Node, + td: &'ast Typedef, + root: &'ast Node, + ) -> anyhow::Result<()> { + if let Some(id) = td.id { + self.back_refs.insert(id, node); + } + + if self.type_defs.contains_key(&td.name.as_str()) { + return Ok(()); + } + + if td.kind.qual_type.starts_with("physx::PxFlags<") + || td.kind.qual_type.starts_with("PxFlags<") + { + self.consume_flags(node, td)?; + } else if let Some(tid) = Self::is_template_we_care_about(node, td) { + self.consume_template_typedef(node, td, tid, root)?; + } else if td.name == "PxFileHandle" { + self.type_defs.insert( + &td.name, + QualType::Pointer { + is_const: false, + is_pointee_const: false, + pointee: Box::new(QualType::Builtin(Builtin::Void)), + }, + ); + } else if let Ok(qt) = self.parse_type(&td.kind, &[]) { + self.type_defs.insert(&td.name, qt); + } + + Ok(()) + } + + /// Walks the AST of a node and attempts to retrieve a comment for it + fn get_comment(node: &Node) -> Option> { + let full_comment = node.inner.iter().find(|inner| { + matches!( + inner.kind, + Item::Other { + kind: Some(clang_ast::Kind::FullComment), + name: _, + } + ) + })?; + + fn gather<'ast>( + node: &'ast Node, + _name: Option<&str>, + summary: &mut Block<'ast>, + additional: &mut Block<'ast>, + ) -> anyhow::Result<()> { + fn gather_paragraph(node: &Node) -> Block<'_> { + let mut block = Block::default(); + + for inner in &node.inner { + if let Item::TextComment { text } = &inner.kind { + let trimmed = text.trim(); + + if trimmed.is_empty() { + continue; + } else { + block.push(trimmed); + } + } + } + + block + } + + for inner in &node.inner { + match &inner.kind { + Item::BlockCommandComment { name } => { + // @see comments are just filled with C++ junk that would + // take more effort than it is worth to translate to intralinks, + // so we just skip them instead + if name.as_deref() == Some("see") { + continue; + } + + gather(inner, name.as_deref(), summary, additional)?; + } + Item::ParagraphComment => { + let para = gather_paragraph(inner); + + if summary.is_empty() { + *summary = para; + } else { + additional.merge(para); + } + } + _ => continue, + } + } + + Ok(()) + } + + let mut summary = Block::default(); + let mut additional = Block::default(); + + if let Err(err) = gather(full_comment, None, &mut summary, &mut additional) { + log::warn!("Failed to gather comment for {:?}: {err:#}", node.kind); + return None; + } + + if summary.is_empty() && additional.is_empty() { + return None; + } + + Some(Comment { + summary, + additional, + }) + } + + fn parse_type( + &self, + kind: impl Into>, + template_types: &[(&str, &TemplateArg<'ast>)], + ) -> anyhow::Result> { + let kind = kind.into(); + + let type_str = kind.as_str(); + + if let Some(treplace) = template_types.iter().find_map(|(t, ty)| { + if let (TemplateArg::Type(ty), true) = (ty, *t == type_str) { + Some(ty) + } else { + None + } + }) { + return Ok(treplace.clone()); + } + + // Builtin types are the most common, we already handle the common typedefs as well + if let Some(bi) = Self::parse_builtin(type_str) { + return Ok(QualType::Builtin(bi)); + } + + if type_str.contains("(*)") { + return Ok(QualType::FunctionPointer); + } + + if let AstType::Qualified(kind) = &kind { + if let Some(qt) = &kind.desugared_qual_type { + if qt.contains("(*)") { + return Ok(QualType::FunctionPointer); + } + } + } + + // There's probably a smarter way to do this, but ugh, C++ pointers are so + // dumb + fn parse_ptr(inner: &str) -> (&str, bool) { + if inner.contains('*') { + if let Some(s) = inner.strip_suffix("const ") { + (s, true) + } else { + (inner, false) + } + } else if let Some(s) = inner.strip_prefix("const ") { + (s, true) + } else { + (inner, false) + } + } + + if let Some(ptr) = type_str.strip_suffix('*') { + let (inner, is_pointee_const) = parse_ptr(ptr); + + let pointee = self.parse_type(inner.trim(), template_types)?; + + return Ok(QualType::Pointer { + is_const: false, + is_pointee_const, + pointee: Box::new(pointee), + }); + } else if let Some(ptr) = type_str.strip_suffix("*const") { + let (inner, is_pointee_const) = parse_ptr(ptr); + + let pointee = self.parse_type(inner.trim(), template_types)?; + + return Ok(QualType::Pointer { + is_const: true, + is_pointee_const, + pointee: Box::new(pointee), + }); + } else if let Some(refer) = type_str.strip_suffix('&') { + let (inner, is_const) = parse_ptr(refer); + + let pointee = self.parse_type(inner.trim(), template_types)?; + + return Ok(QualType::Reference { + is_const, + pointee: Box::new(pointee), + }); + } else if let Some(array) = type_str.strip_suffix(']') { + let ind = array.rfind('[').context("found a closing ']' but no '['")?; + + let ele_type = self + .parse_type(&array[..ind], template_types) + .context("failed to parse element type")?; + + let element = Box::new(ele_type); + + let arr_len = &array[ind + 1..]; + + let len = if let Some(len) = template_types.iter().find_map(|(tn, ta)| { + if let (TemplateArg::Value(val), true) = (ta, *tn == arr_len) { + Some(*val) + } else { + None + } + }) { + len + } else { + arr_len.parse().context("failed to parse array length")? + }; + + return Ok(QualType::Array { element, len }); + } + + // Check if it's an enum, we'll always know the enum by the time we hit + // a reference to it, since physx doesn't do forward declaration of + // enums, just old school + if let Some((repr, name)) = self.enum_map.get(type_str) { + Ok(QualType::Enum { + name, + cxx_qt: type_str, + repr: *repr, + }) + } else if let Some(name) = type_str.strip_prefix("physx::") { + let qt = if let Some((repr, unqualified)) = self.enum_map.get(name) { + QualType::Enum { + name: unqualified, + cxx_qt: name, + repr: *repr, + } + } else if let Some(repr) = self.flags_map.get(name) { + QualType::Flags { name, repr: *repr } + } else if let Some(qt) = self.type_defs.get(name) { + qt.clone() + } else { + QualType::Record { name } + }; + + Ok(qt) + } else if let Some(name) = type_str.strip_prefix("union ") { + Ok(QualType::Record { name }) + } else if let Some(name) = type_str.strip_prefix("struct ") { + Ok(QualType::Record { name }) + } else { + anyhow::bail!("Unknown type '{kind:?}'"); + } + } + + fn parse_builtin(kind: impl Into>) -> Option { + let name = kind.into().as_str(); + let name = no_physx(name); + let bi = match name { + "void" => Builtin::Void, + // See PxSimpleTypes for where the physx typedefs come from + "bool" => Builtin::Bool, + "float" | "PxReal" | "PxF32" => Builtin::Float, + "double" => Builtin::Double, + "int8_t" | "char" | "PxI8" => Builtin::Char, + "uint8_t" | "unsigned char" | "PxU8" => Builtin::UChar, + "int16_t" | "short" | "PxI16" => Builtin::Short, + "uint16_t" | "unsigned short" | "PxU16" => Builtin::UShort, + "int32_t" | "int" | "PxI32" => Builtin::Int, + "uint32_t" | "unsigned int" | "PxU32" => Builtin::UInt, + // Signed 64-bit integers are essentially unused in Physx + "int64_t" | "long" | "PxI64" => Builtin::Long, + "uint64_t" | "unsigned long" | "PxU64" => Builtin::ULong, + "size_t" => Builtin::USize, + "PxVec3" => Builtin::Vec3, + "PxVec4" => Builtin::Vec4, + "PxMat33" => Builtin::Mat33, + "PxMat44" => Builtin::Mat44, + _ => return None, + }; + + Some(bi) + } +} + +#[inline] +fn no_physx(n: &str) -> &str { + n.strip_prefix("physx::").unwrap_or(n) +} + +#[derive(Copy, Clone, Debug)] +enum AstType<'ast> { + Simple(&'ast str), + Qualified(&'ast Type), +} + +impl<'ast> From<&'ast Type> for AstType<'ast> { + fn from(t: &'ast Type) -> Self { + Self::Qualified(t) + } +} + +impl<'ast> From<&'ast str> for AstType<'ast> { + fn from(t: &'ast str) -> Self { + Self::Simple(t) + } +} + +impl<'ast> AstType<'ast> { + fn as_str(&self) -> &'ast str { + let ty = match self { + Self::Simple(s) => s, + Self::Qualified(kind) => kind.qual_type.as_str(), + }; + + let ty = ty.strip_prefix("volatile ").unwrap_or(ty); + + // If the type is _not_ a pointer or reference, strip any const prefix + // since it's useless and just makes parsing easier + if !ty.contains('*') && !ty.contains('&') { + if let Some(stripped) = ty.strip_prefix("const ") { + return stripped; + } + } else if ty.contains('*') { + if let Some(stripped) = ty.strip_suffix("__restrict") { + return stripped; + } else if ty.starts_with("class ") { + return "void *"; + } + } + + ty + } +} + +#[derive(Copy, Clone, Debug, PartialEq)] +pub enum Builtin { + Void, + Bool, + Float, + Double, + Char, + UChar, + Short, + UShort, + Int, + UInt, + Long, + ULong, + USize, + // SIMD + Vec3V, + QuatV, + Vec4V, + BoolV, + U32V, + I32V, + Mat33V, + Mat34V, + Mat44V, + // Non-SIMD + Vec3, + Vec3p, + Vec4, + Quat, + Mat33, + Mat34, + Mat44, +} + +impl Builtin { + #[inline] + pub fn rust_type(self) -> &'static str { + match self { + Self::Void => "std::ffi::c_void", + Self::Bool => "bool", + Self::Float => "f32", + Self::Double => "f64", + Self::Char => "std::ffi::c_char", + Self::UChar => "u8", + Self::Short => "i16", + Self::UShort => "u16", + Self::Int => "i32", + Self::UInt => "u32", + Self::Long => "i64", + Self::ULong => "u64", + Self::USize => "usize", + Self::Vec3V => "glam::Vec3A", + Self::Vec3 => "PxVec3", + Self::Vec3p => "PxVec3Padded", + Self::Vec4V | Self::Vec4 => "PxVec4", + Self::QuatV | Self::Quat => "PxQuat", + Self::BoolV => "glam::BVec4A", + Self::U32V => "glam::UVec4", + Self::I32V => "glam::IVec4", + Self::Mat33V => "glam::Mat3A", + Self::Mat33 => "PxMat33", + Self::Mat34V => "glam::Affine3A", + Self::Mat34 => "Affine", + Self::Mat44V | Self::Mat44 => "PxMat44", + } + } + + #[inline] + pub fn c_type(self) -> &'static str { + match self { + Self::Void => "void", + Self::Bool => "bool", + Self::Float => "float", + Self::Double => "double", + Self::Char => "char", + Self::UChar => "uint8_t", + Self::Short => "int16_t", + Self::UShort => "uint16_t", + Self::Int => "int32_t", + Self::UInt => "uint32_t", + Self::Long => "int64_t", + Self::ULong => "uint64_t", + Self::USize => "size_t", + Self::Vec3V => "physx_Vec3V", + Self::Vec3 => "physx_PxVec3", + Self::Vec3p => "physx_Vec3p", + Self::Vec4V => "physx_Vec4V", + Self::Vec4 => "physx_PxVec4", + Self::QuatV => "physx_QuatV", + Self::Quat => "physx_PxQuat", + Self::BoolV => "physx_BoolV", + Self::U32V => "physx_VecU32V", + Self::I32V => "physx_VecI32V", + Self::Mat33V => "physx_Mat33V", + Self::Mat33 => "physx_PxMat33", + Self::Mat34V => "physx_Mat34V", + Self::Mat34 => "physx_Mat34", + Self::Mat44V => "physx_Mat44V", + Self::Mat44 => "physx_PxMat44", + } + } + + #[inline] + pub fn cpp_type(self) -> &'static str { + match self { + Self::Void => "void", + Self::Bool => "bool", + Self::Float => "float", + Self::Double => "double", + Self::Char => "char", + Self::UChar => "uint8_t", + Self::Short => "int16_t", + Self::UShort => "uint16_t", + Self::Int => "int32_t", + Self::UInt => "uint32_t", + Self::Long => "int64_t", + Self::ULong => "uint64_t", + Self::USize => "size_t", + Self::Vec3V => "physx::PxVec3V", + Self::Vec3 => "physx::PxVec3", + Self::Vec3p => "physx::PxVec3p", + Self::Vec4V => "physx::PxVec4V", + Self::Vec4 => "physx::PxVec4", + Self::QuatV => "physx::PxQuatV", + Self::Quat => "physx::PxQuat", + Self::BoolV => "physx::PxBoolV", + Self::U32V => "physx::PxVecU32V", + Self::I32V => "physx::PxVecI32V", + Self::Mat33V => "physx::PxMat33V", + Self::Mat33 => "physx::PxMat33", + Self::Mat34V => "physx::PxMat34V", + Self::Mat34 => "physx::PxMat34", + Self::Mat44V => "physx::PxMat44V", + Self::Mat44 => "physx::PxMat44", + } + } + + #[inline] + pub fn is_pod(self) -> bool { + !matches!( + self, + Self::Void + | Self::Bool + | Self::Float + | Self::Double + | Self::Char + | Self::UChar + | Self::Short + | Self::UShort + | Self::Int + | Self::UInt + | Self::Long + | Self::ULong + ) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub enum QualType<'ast> { + Pointer { + is_const: bool, + is_pointee_const: bool, + pointee: Box>, + }, + Reference { + is_const: bool, + pointee: Box>, + }, + Builtin(Builtin), + FunctionPointer, + Array { + element: Box>, + len: u32, + }, + Enum { + name: &'ast str, + cxx_qt: &'ast str, + repr: Builtin, + }, + Flags { + name: &'ast str, + repr: Builtin, + }, + Record { + name: &'ast str, + }, + TemplateTypedef { + name: String, + }, +} + +use std::fmt; + +#[derive(Copy, Clone)] +pub struct RustType<'qt, 'ast>(&'qt QualType<'ast>); + +impl<'qt, 'ast> fmt::Display for RustType<'qt, 'ast> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self.0 { + QualType::Pointer { + is_pointee_const, + pointee, + .. + } => { + write!(f, "*{} ", if *is_pointee_const { "const" } else { "mut" })?; + write!(f, "{}", pointee.rust_type()) + } + QualType::Reference { + is_const, pointee, .. + } => { + write!(f, "*{} ", if *is_const { "const" } else { "mut" })?; + write!(f, "{}", pointee.rust_type()) + } + QualType::Builtin(bi) => f.write_str(bi.rust_type()), + QualType::FunctionPointer => f.write_str("*mut std::ffi::c_void"), + QualType::Array { element, len } => { + write!(f, "[{}; {len}]", element.rust_type()) + } + QualType::Enum { name, .. } + | QualType::Flags { name, .. } + | QualType::Record { name } => f.write_str(name), + QualType::TemplateTypedef { name } => f.write_str(name), + } + } +} + +#[derive(Copy, Clone)] +pub struct CppType<'qt, 'ast>(&'qt QualType<'ast>); + +impl<'qt, 'ast> fmt::Display for CppType<'qt, 'ast> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self.0 { + QualType::Pointer { + is_const, + pointee, + is_pointee_const, + } => { + write!(f, "{}", pointee.cpp_type())?; + write!(f, "{}*", if *is_pointee_const { " const" } else { "" })?; + if *is_const { + write!(f, "const")?; + } + + Ok(()) + } + QualType::Reference { + is_const, pointee, .. + } => { + write!(f, "{}", pointee.cpp_type())?; + write!(f, "{}&", if *is_const { " const" } else { "" }) + } + QualType::Builtin(bi) => f.write_str(bi.cpp_type()), + QualType::FunctionPointer => f.write_str("void *"), + QualType::Array { element, len } => { + write!(f, "{}[{len}]", element.cpp_type()) + } + QualType::Enum { cxx_qt: name, .. } + | QualType::Flags { name, .. } + | QualType::Record { name } => write!(f, "physx::{name}"), + QualType::TemplateTypedef { name } => f.write_str(name), + } + } +} + +#[derive(Copy, Clone)] +pub struct CType<'qt, 'ast>(&'qt QualType<'ast>); + +impl<'qt, 'ast> fmt::Display for CType<'qt, 'ast> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self.0 { + QualType::Pointer { + is_const, + pointee, + is_pointee_const, + } => { + write!(f, "{}", pointee.c_type())?; + write!(f, "{}*", if *is_pointee_const { " const" } else { "" })?; + if *is_const { + write!(f, "const")?; + } + Ok(()) + } + QualType::Reference { is_const, pointee } => { + write!(f, "{}", pointee.c_type())?; + write!(f, "{}*", if *is_const { " const" } else { "" }) + } + QualType::Builtin(bi) => f.write_str(bi.c_type()), + QualType::FunctionPointer => f.write_str("void *"), + QualType::Array { element, len } => { + panic!("C array `{}[{len}]` breaks the pattern of every other type by have elements on both sides of an identifier", element.c_type()); + } + QualType::Enum { repr, .. } | QualType::Flags { repr, .. } => { + f.write_str(repr.c_type()) + } + QualType::Record { name } => write!(f, "physx_{name}"), + QualType::TemplateTypedef { name } => write!(f, "physx_{name}"), + } + } +} + +impl<'ast> QualType<'ast> { + #[inline] + pub fn rust_type(&self) -> RustType<'_, 'ast> { + RustType(self) + } + + #[inline] + pub fn cpp_type(&self) -> CppType<'_, 'ast> { + CppType(self) + } + + #[inline] + pub fn c_type(&self) -> CType<'_, 'ast> { + CType(self) + } + + #[inline] + pub fn is_pod(&self) -> bool { + match self { + QualType::Pointer { pointee, .. } => pointee.is_pod(), + QualType::Builtin(bi) => bi.is_pod(), + QualType::FunctionPointer => false, + QualType::Array { element, .. } => element.is_pod(), + QualType::Enum { .. } + | QualType::Flags { .. } + | QualType::Record { .. } + | QualType::Reference { .. } + | QualType::TemplateTypedef { .. } => true, + } + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/consumer/enums.rs b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/enums.rs new file mode 100644 index 0000000..2772601 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/enums.rs @@ -0,0 +1,245 @@ +use super::{Builtin, Comment, EnumDecl, Item, Node, Typedef}; +use anyhow::Context as _; + +pub struct EnumVariant<'ast> { + /// The name of the variant + pub name: &'ast str, + /// The constant value of the variant + pub value: i64, + /// Text comment on the enum constant + pub comment: Option>, +} + +pub struct EnumBinding<'ast> { + /// The repr() applied to the the Rust enum to get it the correct size + pub repr: Builtin, + /// The "friendly" name of the enum, eg `PxErrorCode` + pub name: &'ast str, + /// The qualified type of the enum, minus the physx:: namespace since all + /// the c/cpp code we compile is done within that namespace, eg. PxErrorCode::Enum + pub cxx_qt: &'ast str, + /// Text comment on the enum (or more usually, the wrapping struct) + pub comment: Option>, + /// The list of constants + pub variants: Vec>, +} + +pub struct FlagsBinding<'ast> { + /// The name of the typedef used in the public API + pub name: &'ast str, + /// The index in the AstConsumer of the enum binding + pub enums_index: usize, + /// The storage type used by the flags + pub storage_type: super::Builtin, +} + +impl<'ast> super::AstConsumer<'ast> { + pub(super) fn consume_enum( + &mut self, + parent: &'ast Node, + enum_node: &'ast Node, + enum_decl: &'ast EnumDecl, + ) -> anyhow::Result<()> { + let comment = match Self::get_comment(enum_node) { + Some(com) => Some(com), + None => { + // If the comment isn't directly on the enum itself, check if + // the parent is a struct since most physx enums follow the classic + // struct EnumName { enum Enum {}; }; pattern + if matches!(parent.kind, Item::CXXRecordDecl(_)) { + Self::get_comment(parent) + } else { + None + } + } + }; + + let name = if let Item::CXXRecordDecl(rec) = &parent.kind { + if let Some(rname) = rec.name.as_deref() { + // Check if the record is actually not just a wrapper (ie, has fields or methods) + // as that means we'll need to the name the enum with the inner name + // as that is _probably_ still unique + if parent + .inner + .iter() + .any(|inn| matches!(&inn.kind, Item::FieldDecl { .. })) + { + if let Some(ename) = enum_decl.name.as_deref() { + ename + } else { + log::debug!("Wrapper struct {rname} that will also be a POD contained an anonymous enum"); + return Ok(()); + } + } else { + rname + } + } else { + log::debug!( + "skipping enum {:?} with anonymous wrapper struct", + enum_decl.name + ); + return Ok(()); + } + } else if let Some(ename) = enum_decl.name.as_deref() { + ename + } else { + log::debug!("skipping anonymous enum"); + return Ok(()); + }; + + let mut repr = Builtin::Int; + let mut variants = Vec::new(); + + // Unfortunately the qualified type isn't present on the enum itself, + // but rather each and every variant. They _should_ all be the same + let mut cxx_qt = None; + + fn get_value(node: &Node, current: i64, repr: &mut Builtin) -> anyhow::Result { + for inn in &node.inner { + match &inn.kind { + Item::ImplicitCastExpr { .. } => { + return get_value(inn, current, repr); + } + Item::ConstantExpr { value, kind } => { + // There are a couple of cases where clang will emit + // unsigned int for some variants and int for others, + // so we need to just ignore changes once it's not the default + if matches!(repr, Builtin::Int) { + if let Some(builtin) = super::AstConsumer::parse_builtin(kind) { + *repr = builtin; + } + } + + return value.parse().context("failed to parse enum constant"); + } + _ => continue, + } + } + + Ok(current) + } + + let mut current = 0; + + for (varn, vard) in enum_node.inner.iter().filter_map(|inn| { + if let Item::EnumConstantDecl(cdecl) = &inn.kind { + Some((inn, cdecl)) + } else { + None + } + }) { + if Self::is_deprecated(varn) { + log::debug!("ignoring deprecated variant {name}::{}", vard.name); + continue; + } + + let name = &vard.name; + + if let Some(cxx_qt) = cxx_qt { + anyhow::ensure!( + cxx_qt == vard.kind.qual_type, + "enum has mismatching qualified types current: '{cxx_qt}', new: '{}'", + vard.kind.qual_type + ); + } else { + cxx_qt = Some(vard.kind.qual_type.as_str()); + } + + let comment = Self::get_comment(varn); + let value = get_value(varn, current, &mut repr)?; + + current = value + 1; + + variants.push(EnumVariant { + name, + comment, + value, + }); + } + + // All cpp code is used within the physx namespace, so strip that prefix + let cxx_qt = + cxx_qt.with_context(|| format!("enum '{name}' never declared a qualified typename"))?; + let cxx_qt = super::no_physx(cxx_qt); + + self.enums.push(EnumBinding { + repr, + name, + cxx_qt, + comment, + variants, + }); + self.enum_map.insert(cxx_qt, (repr, name)); + + Ok(()) + } + + pub(super) fn consume_flags( + &mut self, + _node: &'ast Node, + td: &'ast Typedef, + ) -> anyhow::Result<()> { + // PhysX uses a PxFlags<> template typedef to create a bitfield type for + // a specific enum, we use this typedef to also generate an appropriate + // bitflags that can be transparently passed between the FFI boundary + let Some(flags) = super::no_physx(&td.kind.qual_type).strip_prefix("PxFlags<") else { + return Ok(()); + }; + // Get rid of `>` + let flags = &flags[..flags.len() - 1]; + + let mut iter = flags.split(','); + + // PxFlags + // First template parameter is the enum type being wrapped + let enum_type = iter + .next() + .with_context(|| format!("PxFlags typedef '{}' did not specify an enum type", td.name))? + .trim(); + + // Second is the storage type, which _should_ always be an unsigned integer + // type, so we assert on this to ensure shenanigans aren't happening + // Though the PxFlags template allows for defaulting to u32 for storage, + // this is not used AFAICT in PhysX, so we require that the storage + // type be specified as well, for now + let storage_type = iter + .next() + .with_context(|| { + format!( + "PxFlags typedef '{}' did not specify a storage type", + td.name + ) + })? + .trim(); + + let storage_type = Self::parse_builtin(storage_type).with_context(|| { + format!( + "PxFlags typedef '{}' has storage type '{storage_type}' which is not a builtin", + td.name + ) + })?; + + // Find the enum binding, we use this later when generating the bitflags, + // we search in reverse order since the enum being wrapped almost always + // comes directly before the flags typedef + let enums_index = self + .enums + .iter() + .rposition(|eb| eb.cxx_qt == enum_type) + .with_context(|| { + format!( + "PxFlags typedef '{}' references unknown enum type '{enum_type}'", + td.name + ) + })?; + + self.flags.push(FlagsBinding { + name: &td.name, + enums_index, + storage_type, + }); + self.flags_map.insert(&td.name, storage_type); + + Ok(()) + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/consumer/functions.rs b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/functions.rs new file mode 100644 index 0000000..3b5f9ef --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/functions.rs @@ -0,0 +1,242 @@ +use super::{Comment, Item, Method, QualType, TemplateArg}; +use crate::Node; +use anyhow::Context as _; +use std::borrow::Cow; + +#[derive(serde::Deserialize, Debug)] +pub struct Function { + pub name: String, + #[serde(rename = "type")] + pub kind: super::Type, + pub range: Option, +} + +#[derive(Debug)] +pub struct Param<'ast> { + pub name: Cow<'ast, str>, + pub kind: QualType<'ast>, +} + +impl<'ast> Param<'ast> { + #[inline] + pub fn self_pod(rec_type: QualType<'ast>, is_const: bool) -> Self { + Self { + name: Cow::Borrowed("self_"), + kind: QualType::Pointer { + is_const: false, + is_pointee_const: is_const, + pointee: Box::new(rec_type), + }, + } + } +} + +pub enum PhysxInvoke<'ast> { + /// Normal function call. Not many of these in PhysX, it's pretty OO + Func { func_name: &'ast str, is_c: bool }, + /// Method call + Method { + func_name: &'ast str, + class_name: &'ast str, + is_static: bool, + }, + /// Constructor call + Ctor(&'ast str), + /// New + New(&'ast str), +} + +pub enum FuncBindingExt<'ast> { + IsDelete(&'ast str), + None(PhysxInvoke<'ast>), + HasSelf(PhysxInvoke<'ast>), +} + +pub struct FuncBinding<'ast> { + pub name: String, + pub comment: Option>, + pub ext: FuncBindingExt<'ast>, + pub params: Vec>, + pub ret: Option>, +} + +impl<'ast> FuncBinding<'ast> { + pub fn owning_class(&self) -> Option<&'ast str> { + match &self.ext { + FuncBindingExt::None(pi) | FuncBindingExt::HasSelf(pi) => match pi { + PhysxInvoke::Ctor(name) + | PhysxInvoke::New(name) + | PhysxInvoke::Method { + class_name: name, .. + } => Some(name), + PhysxInvoke::Func { .. } => None, + }, + FuncBindingExt::IsDelete(class_name) => Some(class_name), + } + } +} + +impl<'ast> super::AstConsumer<'ast> { + /// Retrieves a unique name for the function to ensure that overloads have + /// different names. It also appends `phys_` before the name to ensure that + /// the C++ code compiles by avoiding errors due to functions that only + /// differ by return type being ambiguous + fn get_func_name(&mut self, name: &'ast str) -> String { + if let Some(count) = self.func_map.get_mut(name) { + *count += 1; + format!("phys_{name}_{count}") + } else { + self.func_map.insert(name, 0); + format!("phys_{name}") + } + } + + pub fn consume_function( + &mut self, + node: &'ast Node, + func: &'ast Function, + template_types: &[(&str, &TemplateArg<'ast>)], + is_c: bool, + ) -> anyhow::Result<()> { + if func.name.starts_with("operator") { + return Ok(()); + } + + // Check the source location for the function + // + // - PxMath - trivial functions that we can just do in Rust if needed + // without crossing the FFI boundary + // - PxString - internal-only string funtions we don't care about + // - PxUtilities - useless internal-only functions + // - PxAtomic - internal-only functions + // - PxHash - internal-only functions + let ignored = [ + "PxMath.h", + "PxString.h", + "PxUtilities.h", + "PxAtomic.h", + "PxHash.h", + ]; + if func + .range + .as_ref() + .and_then(|r| r.begin.expansion_loc.as_ref()) + .map_or(false, |el| { + el.file + .rfind('/') + .map_or(false, |sep| ignored.contains(&&el.file[sep + 1..])) + }) + { + log::debug!("skipping PxMath.h function {}", func.name); + return Ok(()); + } + + let comment = Self::get_comment(node); + + let mut fb = FuncBinding { + name: self.get_func_name(&func.name), + comment, + ext: FuncBindingExt::None(PhysxInvoke::Func { + func_name: &func.name, + is_c, + }), + ret: None, + params: Vec::new(), + }; + + self.consume_return(&func.name, &func.kind.qual_type, template_types, &mut fb)?; + self.consume_params(&func.name, node, template_types, &mut fb)?; + + self.funcs.push(fb); + Ok(()) + } + + pub fn consume_method( + &mut self, + node: &'ast Node, + meth: &'ast Method, + template_types: &[(&str, &TemplateArg<'ast>)], + mut func: FuncBinding<'ast>, + ) -> anyhow::Result<()> { + if meth.kind.qual_type.contains('<') { + log::debug!( + "ignoring method '{}' which has 1 or more templated parameters", + meth.name + ); + } + + self.consume_return(&meth.name, &meth.kind.qual_type, template_types, &mut func)?; + self.consume_params(&meth.name, node, template_types, &mut func)?; + + self.funcs.push(func); + + Ok(()) + } + + #[inline] + fn consume_params( + &self, + name: &'ast str, + node: &'ast Node, + template_types: &[(&str, &TemplateArg<'ast>)], + func: &mut FuncBinding<'ast>, + ) -> anyhow::Result<()> { + for (i, param) in node + .inner + .iter() + .filter_map(|inn| { + if let Item::ParmVarDecl(param) = &inn.kind { + Some(param) + } else { + None + } + }) + .enumerate() + { + let pname = param + .name + .as_deref() + .map_or_else(|| format!("anon_param{i}").into(), Cow::Borrowed); + let kind = self + .parse_type(¶m.kind, template_types) + .with_context(|| { + format!( + "failed to parse parameter '{pname} ({})' for function '{name}'", + param.kind.qual_type, + ) + })?; + + func.params.push(Param { name: pname, kind }); + } + + Ok(()) + } + + /// Unfortunately `CXXMethodDecl`'s don't have a node for the return type, + /// so we need to manually parse it from the function signature... + #[inline] + fn consume_return( + &self, + name: &str, + sig: &'ast str, + template_types: &[(&str, &TemplateArg<'ast>)], + func: &mut FuncBinding<'ast>, + ) -> anyhow::Result<()> { + // Ignore functions that already have a return type, notably constructors + if func.ret.is_none() { + let open_ind = sig + .find('(') + .with_context(|| format!("function signature for '{name}' doesn't have a '('"))?; + + let ret = sig[..open_ind].trim(); + if ret != "void" { + func.ret = Some( + self.parse_type(ret, template_types) + .with_context(|| format!("failed to parse return type for '{name}'"))?, + ); + } + } + + Ok(()) + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/consumer/record.rs b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/record.rs new file mode 100644 index 0000000..6c0a46d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/record.rs @@ -0,0 +1,740 @@ +use std::fmt; + +use super::{functions, Builtin, ClassDef, Id, Item, QualType, Type, Typedef}; +use crate::Node; +use anyhow::Context as _; +use functions::*; +use serde::Deserialize; + +#[derive(Copy, Clone, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub enum Access { + Public, + Protected, + Private, +} + +fn storage_class<'de, D>(deserializer: D) -> Result +where + D: serde::de::Deserializer<'de>, +{ + let s: &str = serde::de::Deserialize::deserialize(deserializer)?; + Ok(s == "static") +} + +#[derive(Deserialize, Debug)] +pub struct Method { + pub name: String, + #[serde(rename = "type")] + pub kind: Type, + #[serde(default, rename = "storageClass", deserialize_with = "storage_class")] + pub is_static: bool, + #[serde(default, rename = "virtual")] + pub is_virtual: bool, +} + +impl Method { + #[inline] + fn is_const(&self) -> bool { + self.is_static || self.kind.qual_type.ends_with(") const") + } +} + +#[derive(Deserialize, Debug)] +pub struct Constructor { + #[serde(flatten)] + pub(super) inner: Method, +} + +impl Constructor { + /// Determines whether a constructor is a [copy constructor](https://en.cppreference.com/w/cpp/language/copy_constructor) + #[inline] + fn is_copy_or_move_constructor(&self, node: &Node) -> bool { + let mut iter = node.inner.iter().filter_map(|inn| { + if let Item::ParmVarDecl(param) = &inn.kind { + Some(¶m.kind.qual_type) + } else { + None + } + }); + + let Some(first) = iter.next() else { + return false; + }; + + if first.ends_with(" &&") { + return true; + } + + let maybe_copy = first + .strip_suffix(" &") + .map_or(false, |is_ref| is_ref.ends_with(&self.inner.name)); + + maybe_copy && iter.next().is_none() + } +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +struct Dtor { + #[serde(default)] + irrelevant: bool, + #[serde(default)] + simple: bool, +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct DefinitionData { + // #[serde(default, rename = "isPOD")] + // is_pod: bool, + dtor: Dtor, + #[serde(default)] + is_abstract: bool, + #[serde(default)] + is_polymorphic: bool, +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Base { + //access: String, + #[serde(rename = "type")] + kind: Type, + //written_access: String, +} + +#[derive(Copy, Clone, Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub enum Tag { + Struct, + Class, + Union, +} + +impl fmt::Display for Tag { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Struct => f.write_str("struct"), + Self::Class => f.write_str("class"), + Self::Union => f.write_str("union"), + } + } +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Record { + pub id: Option, + pub name: Option, + pub tag_used: Option, + pub definition_data: Option, + #[serde(default)] + pub bases: Vec, +} + +impl Record { + #[inline] + fn is_abstract(&self) -> bool { + self.definition_data + .as_ref() + .map_or(false, |dd| dd.is_abstract) + } + + #[inline] + fn is_polymorphic(&self) -> bool { + self.definition_data + .as_ref() + .map_or(false, |dd| dd.is_polymorphic) + } + + #[inline] + fn has_irrelevant_destructor(&self) -> bool { + self.definition_data + .as_ref() + .map_or(false, |dd| dd.dtor.irrelevant) + } + + #[inline] + fn has_simple_destructor(&self) -> bool { + self.definition_data + .as_ref() + .map_or(false, |dd| dd.dtor.simple) + } +} + +#[derive(Debug)] +pub struct RecBindingDef<'ast> { + pub name: &'ast str, + pub has_vtable: bool, + pub ast: &'ast Record, + pub fields: Vec>, + pub calc_layout: bool, +} + +#[derive(Debug)] +pub struct RecBindingForward<'ast> { + pub name: &'ast str, +} + +#[derive(Debug)] +pub enum RecBinding<'ast> { + Forward(RecBindingForward<'ast>), + Def(RecBindingDef<'ast>), +} + +impl<'ast> RecBinding<'ast> { + pub fn name(&self) -> &'ast str { + match self { + Self::Def(def) => def.name, + Self::Forward(fwd) => fwd.name, + } + } +} + +impl<'ast> PartialEq for RecBinding<'ast> { + fn eq(&self, other: &str) -> bool { + match self { + Self::Def(def) => def.name == other, + Self::Forward(fwd) => fwd.name == other, + } + } +} + +#[derive(Debug, Clone)] +pub struct FieldBinding<'ast> { + pub name: &'ast str, + pub kind: QualType<'ast>, + pub is_public: bool, + pub is_reference: bool, +} + +impl<'ast> super::AstConsumer<'ast> { + fn has_release_method(&self, node: &'ast Node, rec: &'ast Record) -> anyhow::Result { + if node.inner.iter().any(|inn| { + if let Item::CXXMethodDecl(method) = &inn.kind { + method.name == "release" + } else { + false + } + }) { + return Ok(true); + } + + for base in self.iter_bases(rec) { + let (cdef, _) = base?; + if self.has_release_method(cdef.node, cdef.rec)? { + return Ok(true); + } + } + + Ok(false) + } + + #[inline] + pub(super) fn is_template_we_care_about( + node: &'ast Node, + td: &'ast Typedef, + ) -> Option<&'ast str> { + let tds = [ + "PxBitAndByte", + "PxRaycastCallback", + "PxOverlapCallback", + "PxSweepCallback", + "PxRaycastBuffer", + "PxOverlapBuffer", + "PxSweepBuffer", + "PxBitMap", + ]; + + if !tds.contains(&td.name.as_str()) { + return None; + } + + node.inner.iter().find_map(|inn| { + if let Item::TemplateSpecializationType { template_name } = &inn.kind { + Some(template_name.as_str()) + } else { + None + } + }) + } + + pub(super) fn consume_template_typedef( + &mut self, + _node: &'ast Node, + td: &'ast Typedef, + template_name: &'ast str, + root: &'ast Node, + ) -> anyhow::Result<()> { + if self.classes.contains_key(td.name.as_str()) { + return Ok(()); + } + + let mut fields = Vec::new(); + match td.name.as_str() { + "PxBitAndByte" => { + fields.push(FieldBinding { + name: "mData", + kind: QualType::Builtin(Builtin::UChar), + is_public: false, + is_reference: false, + }); + } + "PxRaycastCallback" | "PxOverlapCallback" | "PxSweepCallback" | "PxRaycastBuffer" + | "PxOverlapBuffer" | "PxSweepBuffer" => { + let hit_type = match td.name.as_str() { + "PxRaycastCallback" | "PxRaycastBuffer" => "PxRaycastHit", + "PxOverlapCallback" | "PxOverlapBuffer" => "PxOverlapHit", + "PxSweepCallback" | "PxSweepBuffer" => "PxSweepHit", + _ => unreachable!(), + }; + + fields.push(FieldBinding { + name: "block", + kind: QualType::Record { name: hit_type }, + is_public: true, + is_reference: false, + }); + fields.push(FieldBinding { + name: "hasBlock", + kind: QualType::Builtin(Builtin::Bool), + is_public: true, + is_reference: false, + }); + fields.push(FieldBinding { + name: "touches", + kind: QualType::Pointer { + is_const: false, + is_pointee_const: false, + pointee: Box::new(QualType::Record { name: hit_type }), + }, + is_public: true, + is_reference: false, + }); + fields.push(FieldBinding { + name: "maxNbTouches", + kind: QualType::Builtin(Builtin::UInt), + is_public: true, + is_reference: false, + }); + fields.push(FieldBinding { + name: "nbTouches", + kind: QualType::Builtin(Builtin::UInt), + is_public: true, + is_reference: false, + }); + } + "PxBitMap" => { + fields.push(FieldBinding { + name: "mMap", + kind: QualType::Pointer { + is_const: false, + is_pointee_const: false, + pointee: Box::new(QualType::Builtin(Builtin::UInt)), + }, + is_public: false, + is_reference: false, + }); + fields.push(FieldBinding { + name: "mWordCount", + kind: QualType::Builtin(Builtin::UInt), + is_public: false, + is_reference: false, + }); + } + _ => { + self.consume_template_instance(&td.kind.qual_type, Some(&td.name))?; + } + } + + let name = &td.name; + let (node, ast) = super::search(root, &|node: &Node| match &node.kind { + Item::ClassTemplateSpecializationDecl(rec) | Item::CXXRecordDecl(rec) => { + (rec.name.as_deref() == Some(template_name)).then_some(rec) + } + _ => None, + }) + .with_context(|| format!("failed to locate template specialization for {name}"))?; + + self.classes.insert( + name, + Some(super::ClassDef { + index: self.recs.len(), + node, + rec: ast, + }), + ); + + self.recs.push(RecBinding::Def(RecBindingDef { + name, + has_vtable: ast.is_polymorphic(), + fields, + ast, + calc_layout: true, + })); + + Ok(()) + } + + fn iter_bases( + &self, + rec: &'ast Record, + ) -> impl Iterator, &RecBindingDef<'ast>)>> { + rec.bases.iter().filter_map(|base| { + let Some(base_name) = base.kind.qual_type.strip_prefix("physx::") else { + log::debug!("skipping non-physx base class '{}'", base.kind.qual_type); + return None; + }; + + let get = || { + let base_rec = self.classes.get(base_name).with_context(|| { + format!( + "failed to find base '{}' for '{}'", + base.kind.qual_type, + rec.name.as_deref().unwrap(), + ) + })?; + + let base_rec = base_rec.as_ref().with_context(|| { + format!( + "Definition for base class {} has not been consumed", + base.kind.qual_type + ) + })?; + + if let RecBinding::Def(base_binding) = &self.recs[base_rec.index] { + anyhow::ensure!( + base_binding.name == base_name, + "Retrieved incorrect binding for base class" + ); + Ok((base_rec, base_binding)) + } else { + anyhow::bail!("Found a forward declaration instead of the base definition"); + } + }; + + Some(get()) + }) + } + + pub(super) fn consume_record( + &mut self, + node: &'ast Node, + rec: &'ast Record, + ) -> anyhow::Result<()> { + // Do a quick check of the inner nodes, if we have an enumdecl, but no fields + // or methods, this is just a wrapper around an enum and we can just emit the enum + // and exit + let mut had_enums = false; + let mut had_more = false; + + for inn in &node.inner { + match &inn.kind { + Item::FieldDecl { .. } => had_more = true, + kind if kind.as_method().is_some() => had_more = true, + Item::EnumDecl(decl) => { + self.consume_enum(node, inn, decl)?; + had_enums = true; + } + _ => continue, + } + } + + if had_enums && !had_more { + return Ok(()); + } + + let Some(rname) = rec.name.as_deref() else { + return Ok(()); + }; + + anyhow::ensure!( + rec.definition_data.is_some(), + "can't consume a record without a definition" + ); + let has_vtable = rec.is_polymorphic(); + + let mut is_public = !matches!(rec.tag_used, Some(Tag::Class)); + + let mut fields = Vec::new(); + for base_binding in self.iter_bases(rec) { + let (_, base_binding) = base_binding?; + fields.extend(base_binding.fields.iter().cloned()); + } + + self.get_fields(node, rec, &[], &mut fields)?; + + // Keep a record of each method that we are binding, to account for + // overloading, particularly constructors, we need to append a counter + // to keep the binding functions unique + let mut meth_map = std::collections::BTreeMap::::new(); + + let mut get_name = |req: String| -> String { + if let Some(count) = meth_map.get_mut(&req) { + *count += 1; + format!("{req}_{count}") + } else { + meth_map.insert(req.clone(), 0); + req + } + }; + + for inn in &node.inner { + // Ignore any method that isn't public, it's not part of the API we care about + if let Some(method) = inn.kind.as_method() { + if !is_public { + continue; + } else if method.kind.qual_type.contains('<') { + log::debug!( + "skipping `{rname}::{}` as it contains a templated parameter", + method.name + ); + continue; + } else if Self::is_deprecated(inn) { + log::debug!("skipping deprecated method {rname}::{}", method.name); + continue; + } + } + + let comment = Self::get_comment(inn); + + let (mut func, method, has_self) = match &inn.kind { + Item::AccessSpecDecl { access } => { + is_public = matches!(access, Access::Public); + continue; + } + Item::CXXConstructorDecl(method) => { + // If the class is abstract we can't construct it directly so don't need to bind constructors + // We don't care about copy or move constructors because they don't make sense in a C API + if rec.is_abstract() || method.is_copy_or_move_constructor(inn) { + continue; + } + + let func_binding = if rec.is_polymorphic() || !rec.has_simple_destructor() { + FuncBinding { + name: get_name(format!("{rname}_new_alloc")), + ret: Some(QualType::Pointer { + is_const: false, + is_pointee_const: false, + pointee: Box::new(QualType::Record { name: rname }), + }), + comment, + ext: FuncBindingExt::None(PhysxInvoke::New(rname)), + params: Vec::new(), + } + } else { + FuncBinding { + name: get_name(format!("{rname}_new")), + ret: Some(QualType::Record { name: rname }), + comment, + ext: FuncBindingExt::None(PhysxInvoke::Ctor(rname)), + params: Vec::new(), + } + }; + + (func_binding, &method.inner, false) + } + Item::CXXMethodDecl(method) => { + // We don't care about operator overloads + if method.name.starts_with("operator") { + continue; + } + + let func_binding = FuncBinding { + name: get_name(format!( + "{rname}_{}{}", + method.name, + if method.is_const() { "" } else { "" } + )), + ret: None, + comment, + ext: if method.is_static { + FuncBindingExt::None(PhysxInvoke::Method { + func_name: &method.name, + class_name: rname, + is_static: method.is_static, + }) + } else { + FuncBindingExt::HasSelf(PhysxInvoke::Method { + func_name: &method.name, + class_name: rname, + is_static: method.is_static, + }) + }, + params: Vec::new(), + }; + + (func_binding, method, !method.is_static) + } + Item::CXXDestructorDecl(method) => { + // Determine whether this class has a destructor which has no semantic effect. + // + // PhysX uses reference counting for many things, in which + // case it should be deleted with a `release` method instead + // of explicitly deleting it, but we need to account for that + // `release` method possibly being on a base class, so we + // need to walk up the base class chain until we hit the root + // or a base that has a `release` method + // https://nvidia-omniverse.github.io/PhysX/physx/5.1.2/docs/API.html#reference-counting + if rec.has_irrelevant_destructor() || self.has_release_method(node, rec)? { + continue; + } + + ( + FuncBinding { + name: format!("{rname}_delete"), + comment, + ext: FuncBindingExt::IsDelete(rname), + params: Vec::new(), + ret: None, + }, + method, + true, + ) + } + _ => continue, + }; + + if has_self { + func.params.push(Param::self_pod( + QualType::Record { name: rname }, + method.is_const(), + )); + } + + self.consume_method(inn, method, &[], func)?; + } + + // Check the fields to see if any records need to be forward declared + // Note this doesn't apply to function parameters since functions are + // emitted after all Pod types + for field in &fields { + if let QualType::Pointer { pointee, .. } | QualType::Reference { pointee, .. } = + &field.kind + { + if let QualType::Record { name } = &**pointee { + // Special case for PxTempAllocatorChunk which is an internal + // linked list + if *name != rname && !self.classes.contains_key(name) { + self.recs + .push(RecBinding::Forward(RecBindingForward { name })); + self.classes.insert(name, None); + } + } + } + } + + // If there are no fields, we need to add a dummy field since C++ doesn't have + // zero-sized types. This is fine in practice since these types are only + // ever passed by pointer + let is_empty = fields.is_empty() && !has_vtable; + if is_empty { + fields.push(FieldBinding { + name: "pxbind_dummy", + kind: QualType::Builtin(super::Builtin::Char), + is_public: false, + is_reference: false, + }); + } + + // Decide whether we should use "structgen" to calculate the exact layout of + // this C++ struct. + // + // Ideally we would do this for all types, but we must be able to name them, + // which is not feasible for anonymous types, or types which the generator + // doesn't support yet (their cppTypeName will be empty). + // + // Note that empty types are only refered to by pointers and references in + // PhysX, so we can generate dummy contents for them. + let calc_layout = (!matches!(rec.tag_used, Some(crate::consumer::Tag::Union)) + && !fields.is_empty()) + || rname == "PxBroadcastingErrorCallback"; + + let record = RecBindingDef { + name: rname, + has_vtable, + fields, + ast: rec, + calc_layout, + }; + + self.classes.insert( + rname, + Some(super::ClassDef { + index: self.recs.len(), + node, + rec, + }), + ); + self.recs.push(RecBinding::Def(record)); + Ok(()) + } + + pub fn get_fields( + &self, + node: &'ast Node, + rec: &'ast Record, + template_types: &[(&str, &super::TemplateArg<'ast>)], + fields: &mut Vec>, + ) -> anyhow::Result<()> { + let Some(rname) = rec.name.as_deref() else { + return Ok(()); + }; + let mut is_public = !matches!(rec.tag_used, Some(Tag::Class)); + + for inn in &node.inner { + // We _could_ get comments for fields here, but due to the rust + // declarations being emitted by structgen, it becomes a bit noisy + + match &inn.kind { + Item::AccessSpecDecl { access } => { + is_public = matches!(access, Access::Public); + } + Item::FieldDecl { name, kind } => { + // Skip anonymous fields, they aren't really accessible + if let Some(name) = name.as_deref() { + // PhysX uses PxPadding in some struct, but this + // is uninteresting so we can just skip it, they'll be + // accounted for in our own padding calculations regardless + if kind.qual_type.starts_with("PxPadding<") { + log::debug!("skipping padding field"); + continue; + } + + if kind.qual_type.contains('<') { + log::debug!("skipping templated field {rname}::{name}"); + continue; + } + + // We've made modifications to the C++ code to deprecate + // fields that are using deprecated types + if Self::is_deprecated(inn) { + continue; + } + + let kind = self + .parse_type(kind, template_types) + .with_context(|| format!("failed to parse type for {rname}::{name}"))?; + + // if matches!(&kind, QualType::FunctionPointer) { + // continue; + // } + + let is_reference = matches!(kind, QualType::Reference { .. }); + + fields.push(FieldBinding { + name, + kind, + is_public, + is_reference, + }); + } + } + _ => {} + } + } + + Ok(()) + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/consumer/templates.rs b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/templates.rs new file mode 100644 index 0000000..009c152 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/consumer/templates.rs @@ -0,0 +1,135 @@ +#![allow(unused)] + +use crate::Node; + +use super::{AstConsumer, Builtin, QualType, Record}; +use anyhow::Context as _; +use std::borrow::Cow; + +#[derive(PartialEq)] +pub enum TemplateArg<'ast> { + Type(QualType<'ast>), + Value(u32), +} + +struct TemplateParam<'ast> { + name: &'ast str, + builtin: Option, +} + +enum TemplateItemKind<'ast> { + Concrete(QualType<'ast>), + Parameterized(&'ast str), +} + +struct TemplateItem<'ast> { + name: &'ast str, + kind: TemplateItemKind<'ast>, +} + +struct TemplateMethod<'ast> { + name: String, + params: Vec>, +} + +struct TemplateStamp<'ast> { + name: Cow<'ast, str>, + args: Vec>, +} + +pub struct Template<'ast> { + params: Vec>, + instanced: Vec>, + /// This is the + top_record: &'ast Record, + def_record: &'ast Node, +} + +impl<'ast> Template<'ast> { + fn parse_template_args( + &self, + ast: &AstConsumer<'ast>, + qt: &'ast str, + ) -> anyhow::Result>> { + let begin = qt.find('<').context("not a template")?; + let end = qt.rfind('>').context("not a template")?; + + let mut targs = Vec::new(); + for (arg, param) in qt[begin + 1..end].split(',').zip(self.params.iter()) { + // We don't really do error checking here, if the templates are messed + // up PhysX won't compile + if param.builtin.is_some() { + targs.push(TemplateArg::Value(arg.parse()?)); + } else { + targs.push(TemplateArg::Type(ast.parse_type(arg, &[])?)); + } + } + + Ok(targs) + } + + #[inline] + fn get_stamped(&self, args: &[TemplateArg<'ast>]) -> Option> { + self.instanced + .iter() + .find_map(|i| (i.args == args).then(|| i.name.clone())) + } +} + +impl<'ast> AstConsumer<'ast> { + pub(super) fn consume_template_instance( + &mut self, + qual_type: &'ast str, + name: Option<&'ast str>, + ) -> anyhow::Result> { + let qual_type = if let Some(stripped) = qual_type.strip_prefix("const ") { + stripped + } else { + qual_type + }; + + let begin = qual_type.find('<').context("this isn't a template")?; + + let template_name = &qual_type[..begin]; + let tdecl = self + .templates + .get(template_name) + .with_context(|| format!("template decl '{template_name}' has not been consumed"))?; + + let targs = tdecl.parse_template_args(self, qual_type)?; + + // If we've already stamped out this template just return the name it was given + if let Some(stamped) = tdecl.get_stamped(&targs) { + return Ok(stamped); + } + + let instance_name = name.map_or_else( + || Cow::Owned(format!("{template_name}_T{}", tdecl.instanced.len())), + Cow::Borrowed, + ); + + let mut mappings: Vec<_> = targs + .iter() + .zip(tdecl.params.iter()) + .map(|(ta, tp)| (tp.name, ta)) + .collect(); + + let mut fields = Vec::new(); + self.get_fields(tdecl.def_record, tdecl.top_record, &mappings, &mut fields)?; + + Ok(instance_name) + } + + pub(super) fn consume_template_decl( + &mut self, + node: &'ast Node, + name: &'ast str, + ) -> anyhow::Result<()> { + anyhow::ensure!( + !self.templates.contains_key(name), + "template '{name}' has already been consumed" + ); + + unreachable!(); + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/dump.rs b/modules/PhysX/physx/physx-sys/pxbind/src/dump.rs new file mode 100644 index 0000000..634c6fb --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/dump.rs @@ -0,0 +1,88 @@ +use crate::Node; +use anyhow::Context as _; + +pub fn get_repo_root() -> anyhow::Result { + let mut git = std::process::Command::new("git"); + git.args(["rev-parse", "--show-toplevel"]); + git.stdout(std::process::Stdio::piped()); + let captured = git + .output() + .context("failed to run git to find repo root")?; + + let mut rr = String::from_utf8(captured.stdout).context("git output was non-utf8")?; + // Removing trailing newline + rr.pop(); + Ok(rr) +} + +#[inline] +pub fn get_include_dir() -> anyhow::Result { + // Acquire the repo root so we don't need to care about where we are executing + // this from (eg root, tests, wherever) + let repo_root = get_repo_root()?; + + Ok(format!("{repo_root}/physx/physx-sys/physx/physx/include")) +} + +pub fn get_ast(header: impl AsRef) -> anyhow::Result> { + let mut cmd = std::process::Command::new("clang++"); + + let include_dir = get_include_dir()?; + + cmd.args([ + "-Xclang", + // Requests the AST dump + "-ast-dump=json", + // We aren't actually compiling, just gathering type info + "-fsyntax-only", + // clang will complain about all physx headers when we are in C++ + // mode because it treats .h as "c headers", this is useless + "-xc++-header", + // Define PX_DEPRECATED so that the attribute is emitted into the AST + "-DPX_DEPRECATED=__attribute__((deprecated()))", + // Ignore all warnings, we don't care about C++ shenanigans + "-w", + // We don't want this + "-DDISABLE_CUDA_PHYSX", + "-fcolor-diagnostics", + // Add the root include directory so that clang knows how to find + // all of the includes + "-I", + &include_dir, + // Sigh, physx asserts that this is defined :p + "-DNDEBUG", + ]); + cmd.arg(header.as_ref()); + + // note that this is _terribly_ slow but hopefully fixed in 1.69? + // https://github.com/rust-lang/rust/issues/108223 + cmd.stdout(std::process::Stdio::piped()); + cmd.stderr(std::process::Stdio::piped()); + + let captured = cmd + .output() + .context("failed to run clang++ to gather AST")?; + + anyhow::ensure!( + captured.status.success(), + "clang++ failed to gather AST {:?}\n{}", + captured.status, + String::from_utf8(captured.stderr).unwrap_or_default(), + ); + + Ok(captured.stdout) +} + +/// Dump the AST of a header and all of its includes and parses it into a [`Node`] +pub fn get_parsed_ast(header: impl AsRef) -> anyhow::Result<(Node, Vec)> { + log::info!("Gathering AST via clang..."); + let t = std::time::Instant::now(); + let ast = get_ast(header)?; + log::info!("Gathered AST in {}ms", t.elapsed().as_millis()); + + log::info!("Parsing AST..."); + let t = std::time::Instant::now(); + let root_node: Node = serde_json::from_slice(&ast).context("failed to parse AST")?; + log::info!("Parsed AST in {}ms", t.elapsed().as_millis()); + Ok((root_node, ast)) +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/generator.rs b/modules/PhysX/physx/physx-sys/pxbind/src/generator.rs new file mode 100644 index 0000000..b5d105d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/generator.rs @@ -0,0 +1,324 @@ +#[macro_export] +macro_rules! writes { + ($s:expr, $f:expr $(,)?) => {{ + use std::fmt::Write; + write!($s, $f).unwrap(); + }}; + ($s:expr, $f:expr, $($arg:tt)*) => {{ + use std::fmt::Write; + write!($s, $f, $($arg)*).unwrap(); + }}; +} + +#[macro_export] +macro_rules! writesln { + ($s:expr) => {{ + use std::fmt::Write; + writeln!($s).unwrap(); + }}; + ($s:expr, $f:expr $(,)?) => {{ + use std::fmt::Write; + writeln!($s, $f).unwrap(); + }}; + ($s:expr, $f:expr, $($arg:tt)*) => {{ + use std::fmt::Write; + writeln!($s, $f, $($arg)*).unwrap(); + }}; +} + +mod comment; +mod enums; +mod functions; +mod record; + +use crate::consumer::{AstConsumer, Builtin, EnumBinding, FuncBinding, RecBinding}; +use std::{fmt, io::Write}; + +/// The variable name of `PodStructGen` in the structgen program +const SG: &str = "sg"; +/// The name of the macro used to calculate a field's offset in the structgen program +const UOF: &str = "unsafe_offsetof"; + +/// It's impossible (I believe) with Rust's format strings to have the width +/// of the alignment be dynamic, so we just uhhh...be lame +struct Indent(u32); + +impl fmt::Display for Indent { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + for _ in 0..self.0 { + f.write_str(" ")?; + } + + Ok(()) + } +} + +pub struct Generator { + pub record_filter: Box) -> bool>, + pub enum_filter: Box) -> bool>, + pub func_filter: Box) -> bool>, +} + +impl Default for Generator { + fn default() -> Self { + Self { + record_filter: Box::new(|_rb| true), + enum_filter: Box::new(|_eb| true), + func_filter: Box::new(|_fb| true), + } + } +} + +impl Generator { + pub fn generate_all( + &self, + ast: &AstConsumer<'_>, + structgen: &mut impl Write, + cpp: &mut impl Write, + rust: &mut impl Write, + ) -> anyhow::Result<()> { + self.generate_structgen(ast, structgen)?; + self.generate_cpp(ast, cpp)?; + self.generate_rust(ast, rust)?; + + Ok(()) + } + + /// Generates the structgen `main` function, which is used to generate + /// the the POD types for C and Rust and guarantee their fields are + /// appropriately sized and aligned so they can be interchanged + pub fn generate_structgen( + &self, + ast: &AstConsumer<'_>, + out: &mut impl Write, + ) -> anyhow::Result<()> { + // Preamble + { + // Get access to all of the PhysX types we're retrieving the layout for + writeln!(out, "// Automatically generated by pxbind")?; + writeln!(out, r#"#include "PxPhysicsAPI.h""#)?; + writeln!(out, "\nusing namespace physx;")?; + + // Macro used to get the offset of each public field that the PODs + // expose + writeln!( + out, + "\n#define {UOF}(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))" + )?; + // The header that contains the implementation of PodStructGen + writeln!(out, r#"#include "structgen.hpp""#)?; + writeln!(out, "\nint main() {{")?; + } + + let indent = Indent(1); + writeln!(out, "{indent}PodStructGen {SG};")?; + + let mut acc = String::new(); + for rec in ast.recs.iter().filter(|rb| (self.record_filter)(rb)) { + acc.clear(); + + match rec { + RecBinding::Def(def) => def.emit_structgen(&mut acc, 1), + RecBinding::Forward(forward) => forward.emit_structgen(&mut acc, 1), + } + writeln!(out, "{acc}")?; + } + + writeln!(out, "{indent}{SG}.finish();\n}}")?; + + Ok(()) + } + + pub fn generate_cpp(&self, ast: &AstConsumer<'_>, out: &mut impl Write) -> anyhow::Result<()> { + self.generate_size_asserts(ast, out)?; + self.generate_cpp_functions(ast, out, 0)?; + + Ok(()) + } + + /// Generates the static assert code used to verify that every structgen + /// POD type is the same size as the C++ type it is wrapping + pub fn generate_size_asserts( + &self, + ast: &AstConsumer<'_>, + out: &mut impl Write, + ) -> anyhow::Result<()> { + writeln!( + out, + "using namespace physx;\n#include \"structgen_out.hpp\"\n" + )?; + + for rec in ast.recs.iter().filter_map(|rb| { + if let RecBinding::Def(def) = rb { + if (self.record_filter)(rb) { + return Some(def); + } + } + + None + }) { + let name = rec.name; + writeln!(out, "static_assert(sizeof(physx::{name}) == sizeof(physx_{name}), \"POD wrapper for `physx::{name}` has incorrect size\");")?; + } + + writeln!(out)?; + + Ok(()) + } + + /// Generates the C functions used to convert between the C bridge types + /// and calls into the C++ code + pub fn generate_cpp_functions( + &self, + ast: &AstConsumer<'_>, + out: &mut impl Write, + level: u32, + ) -> anyhow::Result<()> { + let indent = Indent(level); + + writeln!(out, "{indent}extern \"C\" {{")?; + let mut acc = String::new(); + for func in ast.funcs.iter().filter(|fb| (self.func_filter)(fb)) { + acc.clear(); + func.emit_cpp(&mut acc, level + 1)?; + writeln!(out, "{acc}")?; + } + writeln!(out, "{indent}}}")?; + + Ok(()) + } + + pub fn generate_rust(&self, ast: &AstConsumer<'_>, w: &mut impl Write) -> anyhow::Result<()> { + let level = 0; + + self.generate_rust_enums(ast, w, level)?; + self.generate_rust_records(ast, w)?; + self.generate_rust_functions(ast, w, level)?; + + Ok(()) + } + + pub fn generate_rust_enums( + &self, + ast: &AstConsumer<'_>, + writer: &mut impl Write, + level: u32, + ) -> anyhow::Result { + let mut fiter = ast.flags.iter().peekable(); + let mut acc = String::new(); + + const INT_ENUMS: &[(&str, Builtin, &str)] = &[ + ("PxConcreteType", Builtin::UShort, "Undefined"), + ("PxD6Drive", Builtin::USize, "Count"), + ]; + + for (enum_binding, flags_binding) in ast.enums.iter().enumerate().filter_map(|(i, eb)| { + let fb = if fiter.peek().map_or(false, |f| f.enums_index == i) { + fiter.next() + } else { + None + }; + + if (self.enum_filter)(eb) { + Some((eb, fb)) + } else { + None + } + }) { + if !acc.is_empty() { + acc.clear(); + writesln!(acc); + } + + enum_binding.emit_rust(&mut acc, level); + + if let Some((builtin, default)) = INT_ENUMS.iter().find_map(|(name, bi, def)| { + if *name == enum_binding.name { + Some((*bi, *def)) + } else { + None + } + }) { + writesln!(acc); + enum_binding.emit_rust_conversion(&mut acc, level, builtin, default); + } + + if let Some(flags) = flags_binding { + writesln!(acc); + flags.emit_rust(enum_binding, &mut acc, level); + } + + write!(writer, "{acc}")?; + } + + Ok((ast.enums.len() + ast.flags.len()) as u32) + } + + pub fn generate_rust_records( + &self, + ast: &AstConsumer<'_>, + writer: &mut impl Write, + ) -> anyhow::Result { + let mut num = 0; + let mut acc = String::new(); + + for rec in ast.recs.iter().filter(|rb| (self.record_filter)(rb)) { + acc.clear(); + writesln!(acc); + + match rec { + RecBinding::Def(def) => { + if def.emit_rust(&mut acc, 0) { + num += 1; + write!(writer, "{acc}")?; + } + } + RecBinding::Forward(forward) => { + if matches!(ast.classes.get(forward.name), Some(None)) { + forward.emit_rust(&mut acc, 0); + write!(writer, "{acc}")?; + num += 1; + } + } + } + } + + Ok(num) + } + + pub fn generate_rust_functions( + &self, + ast: &AstConsumer<'_>, + w: &mut impl Write, + level: u32, + ) -> anyhow::Result { + let indent = Indent(level); + + writeln!(w, "{indent}extern \"C\" {{")?; + let mut acc = String::new(); + for func in ast.funcs.iter().filter(|fb| (self.func_filter)(fb)) { + acc.clear(); + func.emit_rust(&mut acc, level + 1); + writeln!(w, "{acc}")?; + } + writeln!(w, "{indent}}}")?; + + Ok(0) + } +} + +struct RustIdent<'ast>(&'ast str); + +impl<'ast> fmt::Display for RustIdent<'ast> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + static KEYWORDS: &[&str] = &["box", "type", "ref"]; + + f.write_str(self.0)?; + + if KEYWORDS.contains(&self.0) { + f.write_str("_")?; + } + + Ok(()) + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/generator/comment.rs b/modules/PhysX/physx/physx-sys/pxbind/src/generator/comment.rs new file mode 100644 index 0000000..98f33a9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/generator/comment.rs @@ -0,0 +1,40 @@ +use super::Indent; + +impl<'ast> crate::consumer::Comment<'ast> { + pub(super) fn emit_rust(&self, writer: &mut String, level: u32) { + let indent = Indent(level); + + let emit_lines = |w: &mut String, lines: &[&str]| { + for line in lines { + if line.is_empty() { + writesln!(w, "{indent}///"); + // PhysX _tends_ to use `#type::field/variant` style intralinks + // so attempt to convert them to proper rustdoc style intralinks + } else if let Some(ind) = line.find('#') { + writes!(w, "{indent}/// {}", &line[..ind]); + writes!(w, "[`"); + match line[ind + 1..] + .find(|c: char| !c.is_alphanumeric() && c != ':' && c != '_') + { + Some(end) => { + writes!(w, "{}`]", &line[ind + 1..ind + end + 1]); + writesln!(w, "{}", &line[ind + end + 1..]); + } + None => { + writesln!(w, "{}`]", &line[ind + 1..]); + } + }; + } else { + writesln!(w, "{indent}/// {line}"); + } + } + }; + + emit_lines(writer, self.summary.as_slice()); + + if !self.additional.is_empty() { + writesln!(writer, "{indent}///"); + emit_lines(writer, self.additional.as_slice()); + } + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/generator/enums.rs b/modules/PhysX/physx/physx-sys/pxbind/src/generator/enums.rs new file mode 100644 index 0000000..e807728 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/generator/enums.rs @@ -0,0 +1,144 @@ +use crate::consumer::{Builtin, EnumBinding}; + +use super::Indent; + +/// Fixes enum variant names from the ugly C++ style of `eWHY_ARE_YOU_SHOUTING` +/// to `WhyAreYouShouting` +fn fix_variant_name(s: &str) -> String { + let no_e = s + .strip_prefix('e') + .filter(|s| s.chars().next().unwrap().is_ascii_alphabetic()) + .unwrap_or(s); + + use heck::ToUpperCamelCase; + no_e.to_upper_camel_case() +} + +impl<'ast> EnumBinding<'ast> { + pub fn emit_rust(&self, w: &mut String, level: u32) { + if let Some(com) = &self.comment { + com.emit_rust(w, level); + } + + let indent = Indent(level); + let indent1 = Indent(level + 1); + writesln!(w, "{indent}#[derive(Debug, Clone, Copy, PartialEq, Eq)]"); + writesln!(w, "{indent}#[repr({})]", self.repr.rust_type()); + writesln!(w, "{indent}pub enum {} {{", self.name); + + for var in &self.variants { + if let Some(com) = &var.comment { + com.emit_rust(w, level + 1); + } + + writesln!( + w, + "{indent1}{} = {},", + fix_variant_name(var.name), + var.value + ); + } + + writesln!(w, "{indent}}}"); + } + + pub fn emit_rust_conversion(&self, w: &mut String, level: u32, from: Builtin, default: &str) { + let indent = Indent(level); + let indent1 = Indent(level + 1); + let indent2 = Indent(level + 2); + + let int_type = from.rust_type(); + + writesln!(w, "{indent}impl From<{int_type}> for {} {{", self.name); + writesln!(w, "{indent1}fn from(val: {int_type}) -> Self {{"); + writesln!(w, "{indent2}#[allow(clippy::match_same_arms)]"); + writesln!(w, "{indent2}match val {{"); + + let indentm = Indent(level + 3); + + for var in &self.variants { + writesln!( + w, + "{indentm}{} => Self::{},", + var.value, + fix_variant_name(var.name) + ); + } + + writesln!(w, "{indentm}_ => Self::{default},"); + writesln!(w, "{indent2}}}"); + writesln!(w, "{indent1}}}"); + writesln!(w, "{indent}}}"); + } +} + +impl<'ast> crate::consumer::FlagsBinding<'ast> { + pub fn emit_rust(&self, enum_binding: &EnumBinding<'ast>, w: &mut String, level: u32) { + let indent = Indent(level); + let indent1 = Indent(level + 1); + let indent2 = Indent(level + 2); + writesln!(w, "{indent}bitflags::bitflags! {{"); + writesln!(w, "{indent1}/// Flags for [`{}`]", enum_binding.name); + writesln!(w, "{indent1}#[derive(Default)]"); + writesln!(w, "{indent1}#[repr(transparent)]"); + writesln!( + w, + "{indent1}pub struct {}: {} {{", + self.name, + self.storage_type.rust_type() + ); + + for var in &enum_binding.variants { + // If used as flags, ignore emitting any zero value, see + // https://docs.rs/bitflags/1.3.2/bitflags/#zero-flags + if var.value == 0 { + continue; + } + + // if let Some(com) = &var.comment { + // com.emit_rust(writer, level + 2)?; + // } + + writes!(w, "{indent2}const {} = ", fix_variant_name(var.name)); + + // Since bitflags are made up of power of 2 values that can + // be combined, and the PhysX API sometimes defines named + // combinations of flags, reconstruct the bitflags to be + // easier to read + let val = var.value as u64; + if val & (val - 1) == 0 { + writes!(w, "1 << {}", val.ilog2()); + } else { + let mut is_combo = false; + // If we're not a power of 2, we're a combination of flags, + // find which ones and emit them in a friendly way + for (i, which) in enum_binding + .variants + .iter() + .filter_map(|var| { + let prev = var.value as u64; + (prev & (prev - 1) == 0 && (prev & val) != 0).then_some(var.name) + }) + .enumerate() + { + is_combo = true; + if i > 0 { + writes!(w, " | "); + } + + writes!(w, "Self::{}.bits", fix_variant_name(which)); + } + + // There are a couple of cases where they're not combos, so just + // emit the raw value + if !is_combo { + writes!(w, "0x{val:08x}"); + } + } + + writesln!(w, ";"); + } + + writesln!(w, "{indent1}}}\n{indent}}}"); + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/generator/functions.rs b/modules/PhysX/physx/physx-sys/pxbind/src/generator/functions.rs new file mode 100644 index 0000000..effe18a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/generator/functions.rs @@ -0,0 +1,291 @@ +use super::Indent; +use crate::consumer::{functions::*, QualType}; + +const RET: &str = "return_val"; +const RET_POD: &str = "return_val_pod"; + +impl<'ast> Param<'ast> { + fn write_c_to_cpp(&self, out: &mut String, level: u32) { + let name = &self.name; + + let indent = Indent(level); + + match &self.kind { + QualType::Builtin(bi) => { + // This means we got a pod type by value, so we need to copy + // from the C pod to the C++ type + writesln!(out, "{indent}{} {name};", bi.cpp_type()); + writesln!(out, "{indent}memcpy(&{name}, &{name}_pod, sizeof({name}));"); + } + QualType::Pointer { .. } => { + let ty = self.kind.cpp_type(); + writesln!( + out, + "{indent}{ty} {name} = reinterpret_cast<{ty}>({name}_pod);", + ); + } + QualType::Reference { pointee, .. } => { + if let QualType::Builtin(bi) = pointee.as_ref() { + if !bi.is_pod() { + writesln!( + out, + "{indent}{} {name} = *{name}_pod;", + self.kind.cpp_type() + ); + return; + } + } + + let ty = self.kind.cpp_type(); + writesln!( + out, + "{indent}{ty} {name} = reinterpret_cast<{ty}>(*{name}_pod);", + ); + } + QualType::Enum { .. } => { + writesln!( + out, + "{indent}auto {name} = static_cast<{}>({name}_pod);", + self.kind.cpp_type(), + ); + } + QualType::Flags { .. } => { + writesln!( + out, + "{indent}auto {name} = {}({name}_pod);", + self.kind.cpp_type() + ); + } + QualType::Record { .. } => { + writesln!(out, "{indent}{} {name};", self.kind.cpp_type()); + writesln!(out, "{indent}memcpy(&{name}, &{name}_pod, sizeof({name}));"); + } + _ => panic!( + "parameter '{}' kind '{:?}' is not supported ", + self.name, self.kind + ), + } + } +} + +impl<'ast> FuncBinding<'ast> { + pub(super) fn emit_cpp(&self, acc: &mut String, level: u32) -> anyhow::Result<()> { + // Emit the function signature, this uses the C pod types that we've + // generated to wrap the underlying physx C++ types + { + let indent = Indent(level); + + writes!(acc, "{indent}"); + + if let Some(ret) = &self.ret { + writes!(acc, "{}", ret.c_type()); + } else { + acc.push_str("void"); + } + + writes!(acc, " {}(", self.name); + + for (i, param) in self.params.iter().enumerate() { + let sep = if i > 0 { ", " } else { "" }; + + writes!( + acc, + "{sep}{} {}{}", + param.kind.c_type(), + param.name, + if param.kind.is_pod() { "_pod" } else { "" } + ); + } + + writesln!(acc, ") {{"); + } + + let indent = Indent(level + 1); + + // Emit the code that converts each argument to an appropriately typed/named + // c++ variable + if !self.params.is_empty() { + for param in self.params.iter().filter(|p| p.kind.is_pod()) { + param.write_c_to_cpp(acc, level + 1); + } + } + + let (invoke, arg_skip) = match &self.ext { + FuncBindingExt::IsDelete(_) => { + writesln!(acc, "{indent}delete self_;\n{}}}", Indent(level)); + return Ok(()); + } + FuncBindingExt::None(inv) => (inv, 0), + FuncBindingExt::HasSelf(inv) => (inv, 1), + }; + + // Emit the code that actually calls into physx + let args = self + .params + .iter() + .skip(arg_skip) + .map(|param| param.name.as_ref()); + + invoke.emit(args, self.ret.as_ref(), acc, level + 1); + + if let Some(ret) = &self.ret { + if !ret.is_pod() { + writesln!(acc, "{indent}return {RET};"); + } else { + // If we're a pod type we need to generate the code to convert + // from the C++ type to the C wrapper + match ret { + QualType::Builtin(bi) => { + writesln!(acc, "{indent}{} {RET_POD};", bi.c_type()); + writesln!( + acc, + "{indent}memcpy(&{RET_POD}, &{RET}, sizeof({RET_POD}));" + ); + } + QualType::Record { name } => { + writesln!(acc, "{indent}physx_{name} {RET_POD};"); + writesln!( + acc, + "{indent}memcpy(&{RET_POD}, &{RET}, sizeof({RET_POD}));" + ); + } + QualType::Enum { repr, .. } | QualType::Flags { repr, .. } => { + writesln!(acc, "{indent}{} {RET_POD};", repr.c_type()); + writesln!( + acc, + "{indent}memcpy(&{RET_POD}, &{RET}, sizeof({RET_POD}));" + ); + } + QualType::Pointer { .. } => { + writesln!( + acc, + "{indent}auto {RET_POD} = reinterpret_cast<{}>({RET});", + ret.c_type() + ); + } + QualType::Reference { .. } => { + writesln!( + acc, + "{indent}auto {RET_POD} = reinterpret_cast<{}>(&{RET});", + ret.c_type() + ); + } + #[allow(clippy::unimplemented)] + _ => { + unimplemented!("return type is not supported {:?}", ret); + } + } + + writesln!(acc, "{indent}return {RET_POD};"); + } + } + + writesln!(acc, "{}}}", Indent(level)); + Ok(()) + } + + pub(super) fn emit_rust(&self, writer: &mut String, level: u32) { + if let Some(com) = &self.comment { + com.emit_rust(writer, level); + } + + let indent = Indent(level); + + let mut acc = String::new(); + writes!(acc, "{indent}pub fn {}(", self.name); + + for (i, param) in self.params.iter().enumerate() { + // While Rust allows trailing commas in function signatures, it's + // kind of ugly + let sep = if i > 0 { ", " } else { "" }; + + writes!( + acc, + "{sep}{}: {}", + super::RustIdent(¶m.name), + param.kind.rust_type() + ); + } + + if let Some(ret) = &self.ret { + writes!(acc, ") -> {};", ret.rust_type()); + } else { + writes!(acc, ");"); + } + + writesln!(writer, "{acc}"); + } +} + +impl<'ast> PhysxInvoke<'ast> { + fn emit( + &self, + args: impl Iterator, + return_type: Option<&QualType<'ast>>, + out: &mut String, + level: u32, + ) { + let mut args = args.peekable(); + let has_args = args.peek().is_some(); + + let indent = Indent(level); + + // Would be nice with https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.intersperse + // but it's not stable yet + let emit_args = |out: &mut String| { + for (i, arg) in args.enumerate() { + let sep = if i > 0 { ", " } else { "" }; + + writes!(out, "{sep}{arg}"); + } + }; + + match self { + Self::Func { func_name, .. } => { + writes!(out, "{indent}"); + if let Some(ret) = return_type { + writes!(out, "{} {RET} = ", ret.cpp_type()); + } + + writes!(out, "{func_name}("); + emit_args(out); + writes!(out, ");\n"); + } + Self::Method { + func_name, + class_name, + is_static, + } => { + writes!(out, "{indent}"); + if let Some(ret) = return_type { + writes!(out, "{} {RET} = ", ret.cpp_type()); + } + + if *is_static { + writes!(out, "{class_name}::{func_name}("); + } else { + writes!(out, "self_->{func_name}("); + } + + emit_args(out); + writes!(out, ");\n"); + } + Self::Ctor(class) => { + writes!(out, "{indent}{class} {RET}"); + // Deal with Most Vexing Parse, thanks C++ + if has_args { + writes!(out, "("); + emit_args(out); + writes!(out, ");\n"); + } else { + writes!(out, ";\n"); + } + } + Self::New(class) => { + writes!(out, "{indent}auto {RET} = new physx::{}(", class); + emit_args(out); + writes!(out, ");\n"); + } + } + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/generator/record.rs b/modules/PhysX/physx/physx-sys/pxbind/src/generator/record.rs new file mode 100644 index 0000000..ccd3fce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/generator/record.rs @@ -0,0 +1,189 @@ +use super::{Indent, SG, UOF}; +use crate::consumer::QualType; + +impl<'ast> crate::consumer::RecBindingDef<'ast> { + pub(super) fn emit_structgen(&self, writer: &mut String, level: u32) { + if self.calc_layout { + self.emit_structgen_calc(writer, level); + } else { + self.emit_structgen_passthrough(writer, level); + } + } + + fn emit_structgen_calc(&self, w: &mut String, level: u32) { + let indent = Indent(level); + let indent1 = Indent(level + 1); + let indent2 = Indent(level + 2); + + let name = self.name; + + writesln!( + w, + "{indent}struct physx_{name}: public physx::{name} {{" + ); + writesln!(w, "{indent1}static void dump_layout(PodStructGen& {SG}) {{"); + writesln!( + w, + r#"{indent2}{SG}.begin_struct("physx_{name}", "{name}");"# + ); + + for field in &self.fields { + if !field.is_public || field.is_reference { + continue; + } + + let fname = field.name; + let cpp_type = field.kind.cpp_type(); + let rust_type = field.kind.rust_type(); + + writes!(w, "{indent2}{SG}.add_field(\""); + + // We need to handle arrays specially since they break the pattern of literally every other + // C type since the element and array lengths are split by the identifier. Sigh. + if let QualType::Array { element, len } = &field.kind { + // There are a couple of cases of 2-dimensional arrays :p + if let QualType::Array { + element: inner, + len: len1, + } = &**element + { + writes!(w, "{} {fname}[{len1}]", inner.c_type()); + } else { + writes!(w, "{} {fname}", element.c_type()); + } + + writes!(w, "[{len}]"); + } else { + let c_type = field.kind.c_type(); + writes!(w, "{c_type} {fname}"); + } + + writesln!( + w, + r#"", "{}", "{rust_type}", sizeof({cpp_type}), {UOF}(physx_{name}, {fname}));"#, + super::RustIdent(fname), + ); + } + + writesln!(w, "{indent2}{SG}.end_struct(sizeof(physx::{name}));"); + writesln!(w, "{indent1}}}\n{indent}}};"); + writesln!(w, "{indent}physx_{name}::dump_layout({SG});"); + } + + fn emit_structgen_passthrough(&self, w: &mut String, level: u32) { + let indent = Indent(level); + let cindent = Indent(1); + + writes!( + w, + "{indent}{SG}.pass_thru(\"{} physx_{}", + if !matches!(self.ast.tag_used, Some(crate::consumer::Tag::Union)) { + "struct" + } else { + "union" + }, + self.name + ); + + if self.ast.definition_data.is_none() { + writesln!(w, ";\\n\");"); + return; + } + + writes!(w, " {{\\n"); + + if self.has_vtable { + writes!(w, "{cindent}void* vtable_;\\n"); + } + + for field in &self.fields { + if let QualType::Array { element, len } = &field.kind { + writes!(w, "{cindent}{} {}[{len}];\\n", element.c_type(), field.name); + } else { + writes!(w, "{cindent}{} {};\\n", field.kind.c_type(), field.name); + } + } + + writes!(w, "}};\\n\");"); + } + + pub fn emit_rust(&self, w: &mut String, level: u32) -> bool { + if self.calc_layout { + return false; + } + + let indent = Indent(level); + let indent1 = Indent(level + 1); + + let is_union = matches!(self.ast.tag_used, Some(crate::consumer::Tag::Union)); + + writesln!(w, "{indent}#[derive(Clone, Copy)]"); + + if !is_union { + writesln!( + w, + "{indent}#[cfg_attr(feature = \"debug-structs\", derive(Debug))]" + ); + } + writesln!(w, "{indent}#[repr(C)]"); + writesln!( + w, + "{indent}pub {} {} {{", + if is_union { "union" } else { "struct" }, + self.name + ); + + if self.has_vtable { + writesln!(w, "{indent1}vtable_: *const std::ffi::c_void,"); + } + + for field in &self.fields { + if field.is_public { + writes!(w, "{indent1}pub "); + } + + writesln!(w, "{}: {},", field.name, field.kind.rust_type()); + } + + writesln!(w, "{indent}}}"); + + // Unions can't have derived Debug impls so we make our own + if is_union { + let indent2 = Indent(level + 2); + writesln!(w, "{indent}#[cfg(feature = \"debug-structs\")]"); + writesln!(w, "{indent}impl std::fmt::Debug for {} {{", self.name); + writesln!( + w, + "{indent1}fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {{" + ); + writesln!(w, "{indent2}f.write_str(\"{}\")", self.name); + writesln!(w, "{indent1}}}"); + writesln!(w, "{indent}}}"); + } + + true + } +} + +impl<'ast> crate::consumer::RecBindingForward<'ast> { + pub fn emit_structgen(&self, w: &mut String, level: u32) { + let indent = Indent(level); + + writes!( + w, + "{indent}{SG}.pass_thru(\"struct physx_{};\\n\");", + self.name + ); + } + + pub fn emit_rust(&self, w: &mut String, level: u32) { + let indent = Indent(level); + let indent1 = Indent(level + 1); + + writesln!(w, "{indent}#[derive(Copy, Clone)]"); + writesln!(w, "{indent}#[repr(C)]"); + writesln!(w, "{indent}pub struct {} {{", self.name); + writesln!(w, "{indent1}_unused: [u8; 0],"); + writesln!(w, "}}"); + } +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/lib.rs b/modules/PhysX/physx/physx-sys/pxbind/src/lib.rs new file mode 100644 index 0000000..66aa016 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/lib.rs @@ -0,0 +1,7 @@ +pub mod consumer; +mod dump; +pub mod generator; + +pub use dump::*; + +pub type Node = clang_ast::Node; diff --git a/modules/PhysX/physx/physx-sys/pxbind/src/main.rs b/modules/PhysX/physx/physx-sys/pxbind/src/main.rs new file mode 100644 index 0000000..267df80 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/src/main.rs @@ -0,0 +1,35 @@ +use anyhow::Context as _; + +fn main() -> anyhow::Result<()> { + env_logger::init(); + + // It takes clang++ around 30 seconds to dump the JSON, so just keep a file + // around to reduce iteration times + let root = if let Ok(json) = std::fs::read("ast-dump.json") { + serde_json::from_slice(&json).context("failed to parse ast-dump.json")? + } else { + // This is the root API include that includes all the other public APIs + let api_h = format!("{}/PxPhysicsAPI.h", pxbind::get_include_dir()?); + let (root, raw) = pxbind::get_parsed_ast(api_h)?; + + std::fs::write("ast-dump.json", raw).context("failed to write ast-dump.json")?; + + root + }; + + let mut ast = pxbind::consumer::AstConsumer::default(); + ast.consume(&root)?; + + let rr: std::path::PathBuf = pxbind::get_repo_root()?.into(); + + use std::fs::File; + + let mut structgen = File::create(rr.join("physx-sys/src/structgen/structgen.cpp"))?; + let mut cpp = File::create(rr.join("physx-sys/src/physx_generated.hpp"))?; + let mut rust = File::create(rr.join("physx-sys/src/physx_generated.rs"))?; + + let generator = pxbind::generator::Generator::default(); + generator.generate_all(&ast, &mut structgen, &mut cpp, &mut rust)?; + + Ok(()) +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/.rustc_info.json b/modules/PhysX/physx/physx-sys/pxbind/target/.rustc_info.json new file mode 100644 index 0000000..2338576 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":1020393412623493685,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\Kuju\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"pc\"\nwindows\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.78.0 (9b00956e5 2024-04-29)\nbinary: rustc\ncommit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6\ncommit-date: 2024-04-29\nhost: x86_64-pc-windows-msvc\nrelease: 1.78.0\nLLVM version: 18.1.2\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/CACHEDIR.TAG b/modules/PhysX/physx/physx-sys/pxbind/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.cargo-lock b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/dep-lib-aho_corasick b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/dep-lib-aho_corasick new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/dep-lib-aho_corasick differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick new file mode 100644 index 0000000..32b4762 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick @@ -0,0 +1 @@ +15fff3338fe16caf \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick.json new file mode 100644 index 0000000..2ce5132 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/aho-corasick-7325719205e84efb/lib-aho_corasick.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"perf-literal\", \"std\"]","declared_features":"","target":12812136000324506373,"profile":12206360443249279867,"path":514390540837453068,"deps":[[15818844694086178958,"memchr",false,3696284910854410102]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\aho-corasick-7325719205e84efb\\dep-lib-aho_corasick"}}],"rustflags":[],"metadata":13904389431191498124,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/dep-lib-anyhow b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/dep-lib-anyhow new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/dep-lib-anyhow differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow new file mode 100644 index 0000000..f70f3d3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow @@ -0,0 +1 @@ +b56f9f57d9a63965 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow.json new file mode 100644 index 0000000..c044377 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-33087781d5b7a33f/lib-anyhow.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"std\"]","declared_features":"","target":18338613112069040866,"profile":12206360443249279867,"path":3398623636968603478,"deps":[[16045357212464686133,"build_script_build",false,4921420730370980292]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\anyhow-33087781d5b7a33f\\dep-lib-anyhow"}}],"rustflags":[],"metadata":17154292783084528516,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build new file mode 100644 index 0000000..dd59ed4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build @@ -0,0 +1 @@ +a95306e68384a30a \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build.json new file mode 100644 index 0000000..f92a221 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"std\"]","declared_features":"","target":2297296889237502566,"profile":13232757476167777671,"path":13951969448738311833,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\anyhow-ab7c18cf3a7b5f66\\dep-build-script-build-script-build"}}],"rustflags":[],"metadata":17154292783084528516,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-ab7c18cf3a7b5f66/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build new file mode 100644 index 0000000..dfb5b6a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build @@ -0,0 +1 @@ +c479015814664c44 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build.json new file mode 100644 index 0000000..73f3a9f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/anyhow-eda7ba776fa5260e/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[16045357212464686133,"build_script_build",false,766602063617872809]],"local":[{"RerunIfChanged":{"output":"debug\\build\\anyhow-eda7ba776fa5260e\\output","paths":["build/probe.rs"]}},{"RerunIfEnvChanged":{"var":"RUSTC_BOOTSTRAP","val":null}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/dep-lib-clang_ast b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/dep-lib-clang_ast new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/dep-lib-clang_ast differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast new file mode 100644 index 0000000..718a7d3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast @@ -0,0 +1 @@ +6a9a16bce0214086 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast.json new file mode 100644 index 0000000..c4a4415 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/clang-ast-d481a288a7b0d16c/lib-clang_ast.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":11726655330667564086,"profile":12206360443249279867,"path":18095504893307942540,"deps":[[1098045598771442027,"rustc_hash",false,10046108987582848972],[2511671586729554969,"serde",false,3009812188610348422]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\clang-ast-d481a288a7b0d16c\\dep-lib-clang_ast"}}],"rustflags":[],"metadata":15365661418732589432,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/dep-lib-env_logger b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/dep-lib-env_logger new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/dep-lib-env_logger differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger new file mode 100644 index 0000000..f26550b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger @@ -0,0 +1 @@ +78868d473ebc8b59 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger.json new file mode 100644 index 0000000..8a4946d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/env_logger-56e99d5d442b8f7b/lib-env_logger.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"auto-color\", \"color\", \"default\", \"humantime\", \"regex\"]","declared_features":"","target":17553807293545275602,"profile":12206360443249279867,"path":6357041016660639553,"deps":[[2500285171997094844,"termcolor",false,1632694092393299734],[5523453112889398513,"is_terminal",false,8855430130372177659],[10187828652899488954,"log",false,8060913817175892080],[13547796294171082677,"humantime",false,4574831503798447096],[14982752537185592049,"regex",false,15571578597231113558]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\env_logger-56e99d5d442b8f7b\\dep-lib-env_logger"}}],"rustflags":[],"metadata":16604235976610830136,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/dep-lib-heck b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/dep-lib-heck new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/dep-lib-heck differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck new file mode 100644 index 0000000..ed84038 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck @@ -0,0 +1 @@ +05163ee200614164 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck.json new file mode 100644 index 0000000..aae1fa5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/heck-02b7e56dd051b17e/lib-heck.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\"]","declared_features":"","target":11271119367433188140,"profile":12206360443249279867,"path":12172711469631106695,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\heck-02b7e56dd051b17e\\dep-lib-heck"}}],"rustflags":[],"metadata":4968006677088137060,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/dep-lib-humantime b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/dep-lib-humantime new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/dep-lib-humantime differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime new file mode 100644 index 0000000..24d2b45 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime @@ -0,0 +1 @@ +f82b2ca303117d3f \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime.json new file mode 100644 index 0000000..84f7aec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/humantime-4629a5ab77780d49/lib-humantime.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":10444203147181933371,"profile":12206360443249279867,"path":4372706294445872892,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\humantime-4629a5ab77780d49\\dep-lib-humantime"}}],"rustflags":[],"metadata":16972751450777833143,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/dep-lib-is-terminal b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/dep-lib-is-terminal new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/dep-lib-is-terminal differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal new file mode 100644 index 0000000..cf48428 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal @@ -0,0 +1 @@ +fbee1f16c9cee47a \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal.json new file mode 100644 index 0000000..8a856c5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/is-terminal-0a7ad9ee6b95796f/lib-is-terminal.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":8847024640214747843,"profile":12206360443249279867,"path":4377015741861967496,"deps":[[11426986729031771186,"windows_sys",false,2836039361729776079]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\is-terminal-0a7ad9ee6b95796f\\dep-lib-is-terminal"}}],"rustflags":[],"metadata":10282796769989993602,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/dep-lib-itoa b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/dep-lib-itoa new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/dep-lib-itoa differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa new file mode 100644 index 0000000..e681f77 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa @@ -0,0 +1 @@ +0085d722ffcf5927 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa.json new file mode 100644 index 0000000..265b3b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/itoa-efe7cef573b48b40/lib-itoa.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":17114873591667335244,"profile":12206360443249279867,"path":5271807057032177272,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\itoa-efe7cef573b48b40\\dep-lib-itoa"}}],"rustflags":[],"metadata":851671291587502216,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/dep-lib-log b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/dep-lib-log new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/dep-lib-log differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log new file mode 100644 index 0000000..36cc432 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log @@ -0,0 +1 @@ +70a0ce7d681ede6f \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log.json new file mode 100644 index 0000000..85ad654 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/log-f3a5f9f964d58f6f/lib-log.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"std\"]","declared_features":"","target":10943587141627988751,"profile":12206360443249279867,"path":9668473457380251647,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\log-f3a5f9f964d58f6f\\dep-lib-log"}}],"rustflags":[],"metadata":179143468214550567,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/dep-lib-memchr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/dep-lib-memchr new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/dep-lib-memchr differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr new file mode 100644 index 0000000..5dfe9a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr @@ -0,0 +1 @@ +760f1dec8ad74b33 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr.json new file mode 100644 index 0000000..833e898 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/memchr-994f69aff981d39f/lib-memchr.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"alloc\", \"std\"]","declared_features":"","target":13876443730220172507,"profile":12206360443249279867,"path":16869016088127395208,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\memchr-994f69aff981d39f\\dep-lib-memchr"}}],"rustflags":[],"metadata":7513296495906230968,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build new file mode 100644 index 0000000..a7fd040 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build @@ -0,0 +1 @@ +c44dc8e20f9cabc3 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build.json new file mode 100644 index 0000000..62d8cce --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-54f73788dbe949be/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[18024560886749334364,"build_script_build",false,4758730596670865345]],"local":[{"RerunIfChanged":{"output":"debug\\build\\proc-macro2-54f73788dbe949be\\output","paths":["build/probe.rs"]}},{"RerunIfEnvChanged":{"var":"RUSTC_BOOTSTRAP","val":null}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build new file mode 100644 index 0000000..2a5433d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build @@ -0,0 +1 @@ +c17f59cc43680a42 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build.json new file mode 100644 index 0000000..df5dac0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"proc-macro\"]","declared_features":"","target":427768481117760528,"profile":13232757476167777671,"path":13607430533783183389,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\proc-macro2-b8d17f71a68360db\\dep-build-script-build-script-build"}}],"rustflags":[],"metadata":7635439851376710101,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-b8d17f71a68360db/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/dep-lib-proc_macro2 b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/dep-lib-proc_macro2 new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/dep-lib-proc_macro2 differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2 b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2 new file mode 100644 index 0000000..4c55f48 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2 @@ -0,0 +1 @@ +43a575eadbdc4b11 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2.json new file mode 100644 index 0000000..bf252d3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/proc-macro2-c511da7308677aa7/lib-proc_macro2.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"proc-macro\"]","declared_features":"","target":2187471303096632034,"profile":13232757476167777671,"path":3452992316074397663,"deps":[[10045147784146067611,"unicode_ident",false,16873762277770283682],[18024560886749334364,"build_script_build",false,14099534650456690116]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\proc-macro2-c511da7308677aa7\\dep-lib-proc_macro2"}}],"rustflags":[],"metadata":7635439851376710101,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/dep-lib-pxbind b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/dep-lib-pxbind new file mode 100644 index 0000000..b93ea3a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/dep-lib-pxbind differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind new file mode 100644 index 0000000..907fb0e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind @@ -0,0 +1 @@ +0f47b60f7b9655e8 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind.json new file mode 100644 index 0000000..5431a41 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-7b5c5eabd80e626f/lib-pxbind.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":14407593714901199159,"profile":11597332650809196192,"path":17523903030608720598,"deps":[[235571525104734574,"env_logger",false,6452457866812819064],[1287732937133714181,"clang_ast",false,9673769248703814250],[2511671586729554969,"serde",false,3009812188610348422],[7898347539352098708,"serde_json",false,4381860357230674670],[10187828652899488954,"log",false,8060913817175892080],[11709930968028960932,"heck",false,7224161933702600197],[16045357212464686133,"anyhow",false,7294044523911409589]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\pxbind-7b5c5eabd80e626f\\dep-lib-pxbind"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind new file mode 100644 index 0000000..fffb466 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind @@ -0,0 +1 @@ +187a02b52e2bcaf5 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind.json new file mode 100644 index 0000000..54fe25f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/bin-pxbind.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":625391877448926851,"profile":11597332650809196192,"path":1684066648322511884,"deps":[[235571525104734574,"env_logger",false,6452457866812819064],[1287732937133714181,"clang_ast",false,9673769248703814250],[2511671586729554969,"serde",false,3009812188610348422],[7898347539352098708,"serde_json",false,4381860357230674670],[10187828652899488954,"log",false,8060913817175892080],[11709930968028960932,"heck",false,7224161933702600197],[16045357212464686133,"anyhow",false,7294044523911409589],[18151506772420311404,"pxbind",false,16741452645108434703]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\pxbind-8860ffe5ff381603\\dep-bin-pxbind"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/dep-bin-pxbind b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/dep-bin-pxbind new file mode 100644 index 0000000..17b9f60 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/dep-bin-pxbind differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/pxbind-8860ffe5ff381603/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/dep-lib-quote b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/dep-lib-quote new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/dep-lib-quote differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote new file mode 100644 index 0000000..c9118d4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote @@ -0,0 +1 @@ +f439405effbe777f \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote.json new file mode 100644 index 0000000..f824ca2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/quote-6572dbe8242ebcbd/lib-quote.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"proc-macro\"]","declared_features":"","target":10824007166531090010,"profile":13232757476167777671,"path":8278568829579911698,"deps":[[18024560886749334364,"proc_macro2",false,1246332558987601219]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\quote-6572dbe8242ebcbd\\dep-lib-quote"}}],"rustflags":[],"metadata":2717943770976187624,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/dep-lib-regex b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/dep-lib-regex new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/dep-lib-regex differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex new file mode 100644 index 0000000..7891cc3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex @@ -0,0 +1 @@ +563509803b5c19d8 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex.json new file mode 100644 index 0000000..895aa9d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-ae8b68fa9aa6fefa/lib-regex.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"perf\", \"perf-backtrack\", \"perf-cache\", \"perf-dfa\", \"perf-inline\", \"perf-literal\", \"perf-onepass\", \"std\"]","declared_features":"","target":16142358731464406428,"profile":12206360443249279867,"path":14124468467888855413,"deps":[[7325384046744447800,"aho_corasick",false,12640726259290341141],[12099698704509148049,"regex_syntax",false,3045103758781574214],[14373384308191128698,"regex_automata",false,11585689692279149770],[15818844694086178958,"memchr",false,3696284910854410102]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\regex-ae8b68fa9aa6fefa\\dep-lib-regex"}}],"rustflags":[],"metadata":3256615787768725874,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/dep-lib-regex_automata b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/dep-lib-regex_automata new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/dep-lib-regex_automata differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata new file mode 100644 index 0000000..d96f54c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata @@ -0,0 +1 @@ +ca14343a64a3c8a0 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata.json new file mode 100644 index 0000000..7e6cb14 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-automata-448c8a222c61f315/lib-regex_automata.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"alloc\", \"dfa-onepass\", \"hybrid\", \"meta\", \"nfa-backtrack\", \"nfa-pikevm\", \"nfa-thompson\", \"perf-inline\", \"perf-literal\", \"perf-literal-multisubstring\", \"perf-literal-substring\", \"std\", \"syntax\"]","declared_features":"","target":448595855551789158,"profile":12206360443249279867,"path":11649580546086723798,"deps":[[7325384046744447800,"aho_corasick",false,12640726259290341141],[12099698704509148049,"regex_syntax",false,3045103758781574214],[15818844694086178958,"memchr",false,3696284910854410102]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\regex-automata-448c8a222c61f315\\dep-lib-regex_automata"}}],"rustflags":[],"metadata":8878122455581797878,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/dep-lib-regex_syntax b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/dep-lib-regex_syntax new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/dep-lib-regex_syntax differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax new file mode 100644 index 0000000..7afcf8d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax @@ -0,0 +1 @@ +46ec6126bc61422a \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax.json new file mode 100644 index 0000000..98abdd8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/regex-syntax-6cf651013ee141d8/lib-regex_syntax.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"std\"]","declared_features":"","target":4790163008085533209,"profile":12206360443249279867,"path":11373887691066036009,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\regex-syntax-6cf651013ee141d8\\dep-lib-regex_syntax"}}],"rustflags":[],"metadata":17586400164587752172,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/dep-lib-rustc-hash b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/dep-lib-rustc-hash new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/dep-lib-rustc-hash differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash new file mode 100644 index 0000000..256e205 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash @@ -0,0 +1 @@ +cc1fbccbe5f26a8b \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash.json new file mode 100644 index 0000000..cd32780 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/rustc-hash-9e44aed369f15a41/lib-rustc-hash.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"std\"]","declared_features":"","target":15096661004575481746,"profile":12206360443249279867,"path":8291274131465894623,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\rustc-hash-9e44aed369f15a41\\dep-lib-rustc-hash"}}],"rustflags":[],"metadata":8748413593772538637,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/dep-lib-ryu b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/dep-lib-ryu new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/dep-lib-ryu differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu new file mode 100644 index 0000000..610349a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu @@ -0,0 +1 @@ +d8b689c6b969367f \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu.json new file mode 100644 index 0000000..448943e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/ryu-83514f85ec787a34/lib-ryu.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":13901881936739684103,"profile":12206360443249279867,"path":3211819170566835433,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\ryu-83514f85ec787a34\\dep-lib-ryu"}}],"rustflags":[],"metadata":10387617312689919117,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/dep-lib-serde b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/dep-lib-serde new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/dep-lib-serde differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde new file mode 100644 index 0000000..0130777 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde @@ -0,0 +1 @@ +86c5c2263d00c529 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde.json new file mode 100644 index 0000000..32b567f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-01a927c39c970a1c/lib-serde.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"derive\", \"serde_derive\", \"std\"]","declared_features":"","target":12518487807107382959,"profile":12206360443249279867,"path":3556015227173690441,"deps":[[2511671586729554969,"build_script_build",false,17044914220680717394],[9796133154792906827,"serde_derive",false,9309903951993645161]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\serde-01a927c39c970a1c\\dep-lib-serde"}}],"rustflags":[],"metadata":3767376778934503013,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build new file mode 100644 index 0000000..5a17f20 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build @@ -0,0 +1 @@ +52a4ad062db38bec \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build.json new file mode 100644 index 0000000..464e888 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-183b8bb6666cfcff/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[2511671586729554969,"build_script_build",false,14014331752583672600]],"local":[{"RerunIfChanged":{"output":"debug\\build\\serde-183b8bb6666cfcff\\output","paths":["build.rs"]}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build new file mode 100644 index 0000000..3a865f9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build @@ -0,0 +1 @@ +18333a557ae87cc2 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build.json new file mode 100644 index 0000000..673dff0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"derive\", \"serde_derive\", \"std\"]","declared_features":"","target":2297296889237502566,"profile":13232757476167777671,"path":12099067278255437633,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\serde-1a03c3e3812839e6\\dep-build-script-build-script-build"}}],"rustflags":[],"metadata":3767376778934503013,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde-1a03c3e3812839e6/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/dep-lib-serde_derive b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/dep-lib-serde_derive new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/dep-lib-serde_derive differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive new file mode 100644 index 0000000..3b90684 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive @@ -0,0 +1 @@ +6928967f516c3381 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive.json new file mode 100644 index 0000000..214bc37 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_derive-df0e609b33f126b0/lib-serde_derive.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\"]","declared_features":"","target":17975654915224872304,"profile":13232757476167777671,"path":13311180361535533092,"deps":[[1404949221071535394,"syn",false,5051212999992519937],[14268468010440576439,"quote",false,9185019969052621300],[18024560886749334364,"proc_macro2",false,1246332558987601219]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\serde_derive-df0e609b33f126b0\\dep-lib-serde_derive"}}],"rustflags":[],"metadata":14452199383429553764,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/dep-lib-serde_json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/dep-lib-serde_json new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/dep-lib-serde_json differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json new file mode 100644 index 0000000..d908633 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json @@ -0,0 +1 @@ +eec21960c77ecf3c \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json.json new file mode 100644 index 0000000..88d7a1e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-4a0dec3224e77276/lib-serde_json.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"std\"]","declared_features":"","target":1572482250304784865,"profile":12206360443249279867,"path":5338508266237293993,"deps":[[711435865661041740,"ryu",false,9166630338180003544],[2511671586729554969,"serde",false,3009812188610348422],[7898347539352098708,"build_script_build",false,16642401545510202883],[11284357528473424989,"itoa",false,2835526135114597632]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\serde_json-4a0dec3224e77276\\dep-lib-serde_json"}}],"rustflags":[],"metadata":16261601059619201932,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build new file mode 100644 index 0000000..bd3afa4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build @@ -0,0 +1 @@ +032e8cc907b0f5e6 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build.json new file mode 100644 index 0000000..035ea0e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5b489bcac750436c/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[7898347539352098708,"build_script_build",false,4241508336267030261]],"local":[{"RerunIfChanged":{"output":"debug\\build\\serde_json-5b489bcac750436c\\output","paths":["build.rs"]}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build new file mode 100644 index 0000000..9049a0c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build @@ -0,0 +1 @@ +f5ee0dff5bdddc3a \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build.json new file mode 100644 index 0000000..384cd1b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"default\", \"std\"]","declared_features":"","target":427768481117760528,"profile":13232757476167777671,"path":1706123657835676636,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\serde_json-5ea917b9abd90220\\dep-build-script-build-script-build"}}],"rustflags":[],"metadata":16261601059619201932,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/serde_json-5ea917b9abd90220/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/dep-lib-syn b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/dep-lib-syn new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/dep-lib-syn differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn new file mode 100644 index 0000000..cea0990 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn @@ -0,0 +1 @@ +01ad630576831946 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn.json new file mode 100644 index 0000000..d2ed523 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/syn-5ac3c98c6da369ee/lib-syn.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"clone-impls\", \"derive\", \"parsing\", \"printing\", \"proc-macro\"]","declared_features":"","target":9229941241798225847,"profile":13232757476167777671,"path":17107112268789807420,"deps":[[10045147784146067611,"unicode_ident",false,16873762277770283682],[14268468010440576439,"quote",false,9185019969052621300],[18024560886749334364,"proc_macro2",false,1246332558987601219]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\syn-5ac3c98c6da369ee\\dep-lib-syn"}}],"rustflags":[],"metadata":6886477143387768027,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/dep-lib-termcolor b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/dep-lib-termcolor new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/dep-lib-termcolor differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor new file mode 100644 index 0000000..faeb5f2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor @@ -0,0 +1 @@ +163ffb6ba07ea816 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor.json new file mode 100644 index 0000000..cebef88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/termcolor-4eaf01eb662b57d9/lib-termcolor.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":9860137908366838602,"profile":12206360443249279867,"path":16588620899642552224,"deps":[[4320896329189347247,"winapi_util",false,14377232905329343682]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\termcolor-4eaf01eb662b57d9\\dep-lib-termcolor"}}],"rustflags":[],"metadata":5219475942417176210,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/dep-lib-unicode-ident b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/dep-lib-unicode-ident new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/dep-lib-unicode-ident differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident new file mode 100644 index 0000000..034051e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident @@ -0,0 +1 @@ +a24ae2fe63a52bea \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident.json new file mode 100644 index 0000000..9c2fcf1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/unicode-ident-9e712da980196895/lib-unicode-ident.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":7243519288898877878,"profile":13232757476167777671,"path":11601178315742561074,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\unicode-ident-9e712da980196895\\dep-lib-unicode-ident"}}],"rustflags":[],"metadata":1159190378059262574,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/dep-lib-winapi-util b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/dep-lib-winapi-util new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/dep-lib-winapi-util differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util new file mode 100644 index 0000000..1ad3ad9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util @@ -0,0 +1 @@ +c27c364f273186c7 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util.json new file mode 100644 index 0000000..b40ef08 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/winapi-util-3efb899db8e951a5/lib-winapi-util.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":14782989840762628784,"profile":12206360443249279867,"path":5776951740830065924,"deps":[[11426986729031771186,"windows_sys",false,2836039361729776079]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\winapi-util-3efb899db8e951a5\\dep-lib-winapi-util"}}],"rustflags":[],"metadata":10112618295776208256,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/dep-lib-windows-sys b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/dep-lib-windows-sys new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/dep-lib-windows-sys differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys new file mode 100644 index 0000000..cf0601d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys @@ -0,0 +1 @@ +cfc9ed04c6a25b27 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys.json new file mode 100644 index 0000000..ba7512e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-sys-37346e2c1fcfdf87/lib-windows-sys.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[\"Win32\", \"Win32_Foundation\", \"Win32_Storage\", \"Win32_Storage_FileSystem\", \"Win32_System\", \"Win32_System_Console\", \"Win32_System_SystemInformation\", \"default\"]","declared_features":"","target":17730664832333148837,"profile":12206360443249279867,"path":1137242349364207681,"deps":[[9471768686618079862,"windows_targets",false,4668568791741371496]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\windows-sys-37346e2c1fcfdf87\\dep-lib-windows-sys"}}],"rustflags":[],"metadata":18220959856227839970,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/dep-lib-windows-targets b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/dep-lib-windows-targets new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/dep-lib-windows-targets differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets new file mode 100644 index 0000000..e5f7048 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets @@ -0,0 +1 @@ +681438b99416ca40 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets.json new file mode 100644 index 0000000..8838dc4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows-targets-77b1c4cfc32173a8/lib-windows-targets.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":5870181148045252206,"profile":15424129364566334108,"path":2923553698007229442,"deps":[[11729866763975256760,"windows_x86_64_msvc",false,10194899672299767125]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\windows-targets-77b1c4cfc32173a8\\dep-lib-windows-targets"}}],"rustflags":[],"metadata":8011173418319876128,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build new file mode 100644 index 0000000..f752851 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build @@ -0,0 +1 @@ +e352814d27cee82d \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build.json new file mode 100644 index 0000000..f6cb36e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-11bc79bde8041b54/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[11729866763975256760,"build_script_build",false,11659598590253266556]],"local":[{"Precalculated":"0.52.5"}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/dep-lib-windows_x86_64_msvc b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/dep-lib-windows_x86_64_msvc new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/dep-lib-windows_x86_64_msvc differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc new file mode 100644 index 0000000..da79a39 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc @@ -0,0 +1 @@ +55852cb03c8f7b8d \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc.json new file mode 100644 index 0000000..0f41f9b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-ee04cd40a05d3cdd/lib-windows_x86_64_msvc.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":11736402323033814105,"profile":12206360443249279867,"path":4713951166721160160,"deps":[[11729866763975256760,"build_script_build",false,3308120594502996707]],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\windows_x86_64_msvc-ee04cd40a05d3cdd\\dep-lib-windows_x86_64_msvc"}}],"rustflags":[],"metadata":3732427515522591159,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build new file mode 100644 index 0000000..dc200c7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build @@ -0,0 +1 @@ +7cf6b0832437cfa1 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build.json new file mode 100644 index 0000000..fb0cacd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":208723055495880444,"features":"[]","declared_features":"","target":427768481117760528,"profile":13232757476167777671,"path":6831673619239951295,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug\\.fingerprint\\windows_x86_64_msvc-fc9289d64a047af3\\dep-build-script-build-script-build"}}],"rustflags":[],"metadata":3732427515522591159,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/.fingerprint/windows_x86_64_msvc-fc9289d64a047af3/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build-script-build.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build-script-build.exe new file mode 100644 index 0000000..cff2639 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build-script-build.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.d new file mode 100644 index 0000000..c03ff95 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\anyhow-ab7c18cf3a7b5f66\build_script_build-ab7c18cf3a7b5f66.exe: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\build.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\anyhow-ab7c18cf3a7b5f66\build_script_build-ab7c18cf3a7b5f66.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\build.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\build.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.exe new file mode 100644 index 0000000..cff2639 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.pdb new file mode 100644 index 0000000..624bb5f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build-ab7c18cf3a7b5f66.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build.pdb new file mode 100644 index 0000000..624bb5f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-ab7c18cf3a7b5f66/build_script_build.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/out/anyhow.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/out/anyhow.d new file mode 100644 index 0000000..60a4636 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/out/anyhow.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\anyhow-eda7ba776fa5260e\out\libanyhow.rmeta: build\probe.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\anyhow-eda7ba776fa5260e\out\anyhow.d: build\probe.rs + +build\probe.rs: + +# env-dep:RUSTC_BOOTSTRAP diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/output new file mode 100644 index 0000000..f106a4a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/output @@ -0,0 +1,3 @@ +cargo:rerun-if-changed=build/probe.rs +cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP +cargo:rustc-cfg=std_backtrace diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/root-output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/root-output new file mode 100644 index 0000000..036bbfa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/root-output @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\anyhow-eda7ba776fa5260e\out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/stderr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/anyhow-eda7ba776fa5260e/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/out/proc_macro2.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/out/proc_macro2.d new file mode 100644 index 0000000..283b726 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/out/proc_macro2.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\proc-macro2-54f73788dbe949be\out\libproc_macro2.rmeta: build\probe.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\proc-macro2-54f73788dbe949be\out\proc_macro2.d: build\probe.rs + +build\probe.rs: + +# env-dep:RUSTC_BOOTSTRAP diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/output new file mode 100644 index 0000000..09f384f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/output @@ -0,0 +1,5 @@ +cargo:rustc-cfg=no_literal_byte_character +cargo:rustc-cfg=no_literal_c_string +cargo:rerun-if-changed=build/probe.rs +cargo:rustc-cfg=wrap_proc_macro +cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/root-output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/root-output new file mode 100644 index 0000000..f6eb69f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/root-output @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\proc-macro2-54f73788dbe949be\out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/stderr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-54f73788dbe949be/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build-script-build.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build-script-build.exe new file mode 100644 index 0000000..4a2c7bb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build-script-build.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.d new file mode 100644 index 0000000..a02f79d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\proc-macro2-b8d17f71a68360db\build_script_build-b8d17f71a68360db.exe: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\build.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\proc-macro2-b8d17f71a68360db\build_script_build-b8d17f71a68360db.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\build.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\build.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.exe new file mode 100644 index 0000000..4a2c7bb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.pdb new file mode 100644 index 0000000..3d4252a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build-b8d17f71a68360db.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build.pdb new file mode 100644 index 0000000..3d4252a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/proc-macro2-b8d17f71a68360db/build_script_build.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/output new file mode 100644 index 0000000..9b68517 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/output @@ -0,0 +1,12 @@ +cargo:rerun-if-changed=build.rs +cargo:rustc-check-cfg=cfg(no_core_cstr) +cargo:rustc-check-cfg=cfg(no_core_num_saturating) +cargo:rustc-check-cfg=cfg(no_core_try_from) +cargo:rustc-check-cfg=cfg(no_float_copysign) +cargo:rustc-check-cfg=cfg(no_num_nonzero_signed) +cargo:rustc-check-cfg=cfg(no_relaxed_trait_bounds) +cargo:rustc-check-cfg=cfg(no_serde_derive) +cargo:rustc-check-cfg=cfg(no_std_atomic) +cargo:rustc-check-cfg=cfg(no_std_atomic64) +cargo:rustc-check-cfg=cfg(no_systemtime_checked_add) +cargo:rustc-check-cfg=cfg(no_target_has_atomic) diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/root-output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/root-output new file mode 100644 index 0000000..76d1a76 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/root-output @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde-183b8bb6666cfcff\out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/stderr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-183b8bb6666cfcff/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build-script-build.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build-script-build.exe new file mode 100644 index 0000000..4d7ce31 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build-script-build.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.d new file mode 100644 index 0000000..a82b095 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde-1a03c3e3812839e6\build_script_build-1a03c3e3812839e6.exe: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\build.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde-1a03c3e3812839e6\build_script_build-1a03c3e3812839e6.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\build.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\build.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.exe new file mode 100644 index 0000000..4d7ce31 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.pdb new file mode 100644 index 0000000..66120d9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build-1a03c3e3812839e6.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build.pdb new file mode 100644 index 0000000..66120d9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde-1a03c3e3812839e6/build_script_build.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/output new file mode 100644 index 0000000..da3588d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/output @@ -0,0 +1,4 @@ +cargo:rerun-if-changed=build.rs +cargo:rustc-check-cfg=cfg(limb_width_32) +cargo:rustc-check-cfg=cfg(limb_width_64) +cargo:rustc-cfg=limb_width_64 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/root-output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/root-output new file mode 100644 index 0000000..58c9853 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/root-output @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde_json-5b489bcac750436c\out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/stderr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5b489bcac750436c/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build-script-build.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build-script-build.exe new file mode 100644 index 0000000..2c59467 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build-script-build.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.d new file mode 100644 index 0000000..0f6a6c8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde_json-5ea917b9abd90220\build_script_build-5ea917b9abd90220.exe: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\build.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\serde_json-5ea917b9abd90220\build_script_build-5ea917b9abd90220.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\build.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\build.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.exe new file mode 100644 index 0000000..2c59467 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.pdb new file mode 100644 index 0000000..f165f43 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build-5ea917b9abd90220.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build.pdb new file mode 100644 index 0000000..f165f43 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/serde_json-5ea917b9abd90220/build_script_build.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/invoked.timestamp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/output new file mode 100644 index 0000000..d65e0a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/output @@ -0,0 +1 @@ +cargo:rustc-link-search=native=C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\lib diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/root-output b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/root-output new file mode 100644 index 0000000..ba30b22 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/root-output @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\windows_x86_64_msvc-11bc79bde8041b54\out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/stderr b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-11bc79bde8041b54/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build-script-build.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build-script-build.exe new file mode 100644 index 0000000..ca66577 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build-script-build.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.d new file mode 100644 index 0000000..bfea511 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\windows_x86_64_msvc-fc9289d64a047af3\build_script_build-fc9289d64a047af3.exe: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\build.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\build\windows_x86_64_msvc-fc9289d64a047af3\build_script_build-fc9289d64a047af3.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\build.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\build.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.exe new file mode 100644 index 0000000..ca66577 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.pdb new file mode 100644 index 0000000..9f9848e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build-fc9289d64a047af3.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build.pdb new file mode 100644 index 0000000..9f9848e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/build/windows_x86_64_msvc-fc9289d64a047af3/build_script_build.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/aho_corasick-7325719205e84efb.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/aho_corasick-7325719205e84efb.d new file mode 100644 index 0000000..9ad7f2f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/aho_corasick-7325719205e84efb.d @@ -0,0 +1,35 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libaho_corasick-7325719205e84efb.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\ahocorasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\automaton.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\contiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\noncontiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\api.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\pattern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\generic.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\vector.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\byte_frequencies.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\prefilter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\special.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libaho_corasick-7325719205e84efb.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\ahocorasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\automaton.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\contiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\noncontiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\api.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\pattern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\generic.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\vector.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\byte_frequencies.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\prefilter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\special.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\aho_corasick-7325719205e84efb.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\ahocorasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\automaton.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\contiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\noncontiguous.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\api.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\pattern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\generic.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\vector.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\byte_frequencies.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\prefilter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\special.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\ahocorasick.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\automaton.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\dfa.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\contiguous.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\nfa\noncontiguous.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\api.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\ext.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\pattern.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\rabinkarp.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\builder.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\teddy\generic.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\packed\vector.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\alphabet.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\buffer.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\byte_frequencies.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\debug.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\int.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\prefilter.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\primitives.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\remapper.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\search.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\aho-corasick-1.1.3\src\util\special.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/anyhow-33087781d5b7a33f.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/anyhow-33087781d5b7a33f.d new file mode 100644 index 0000000..414d9b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/anyhow-33087781d5b7a33f.d @@ -0,0 +1,17 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libanyhow-33087781d5b7a33f.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\backtrace.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\chain.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\context.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ensure.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ptr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\wrapper.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libanyhow-33087781d5b7a33f.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\backtrace.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\chain.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\context.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ensure.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ptr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\wrapper.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\anyhow-33087781d5b7a33f.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\backtrace.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\chain.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\context.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ensure.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ptr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\wrapper.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\backtrace.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\chain.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\context.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ensure.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\fmt.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\kind.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\ptr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\anyhow-1.0.86\src\wrapper.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/clang_ast-d481a288a7b0d16c.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/clang_ast-d481a288a7b0d16c.d new file mode 100644 index 0000000..865d6f9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/clang_ast-d481a288a7b0d16c.d @@ -0,0 +1,14 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libclang_ast-d481a288a7b0d16c.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\dedup.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\deserializer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\intern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\loc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\serializer.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libclang_ast-d481a288a7b0d16c.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\dedup.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\deserializer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\intern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\loc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\serializer.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\clang_ast-d481a288a7b0d16c.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\dedup.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\deserializer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\intern.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\kind.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\loc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\serializer.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\dedup.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\deserializer.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\id.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\intern.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\kind.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\loc.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\clang-ast-0.1.24\src\serializer.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/env_logger-56e99d5d442b8f7b.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/env_logger-56e99d5d442b8f7b.d new file mode 100644 index 0000000..5dfb65d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/env_logger-56e99d5d442b8f7b.d @@ -0,0 +1,17 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libenv_logger-56e99d5d442b8f7b.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\logger.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\humantime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\atty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\termcolor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\style.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libenv_logger-56e99d5d442b8f7b.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\logger.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\humantime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\atty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\termcolor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\style.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\env_logger-56e99d5d442b8f7b.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\logger.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\humantime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\atty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\termcolor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\style.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\logger.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\filter\regex.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\humantime.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\atty.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\writer\buffer\termcolor.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\env_logger-0.10.2\src\fmt\style.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/heck-02b7e56dd051b17e.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/heck-02b7e56dd051b17e.d new file mode 100644 index 0000000..0b2e9db --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/heck-02b7e56dd051b17e.d @@ -0,0 +1,15 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libheck-02b7e56dd051b17e.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lower_camel.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\title.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\train.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\upper_camel.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libheck-02b7e56dd051b17e.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lower_camel.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\title.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\train.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\upper_camel.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\heck-02b7e56dd051b17e.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lower_camel.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_kebab.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\snake.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\title.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\train.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\upper_camel.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\kebab.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\lower_camel.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_kebab.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\shouty_snake.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\snake.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\title.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\train.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\heck-0.4.1\src\upper_camel.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/humantime-4629a5ab77780d49.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/humantime-4629a5ab77780d49.d new file mode 100644 index 0000000..1574231 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/humantime-4629a5ab77780d49.d @@ -0,0 +1,10 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libhumantime-4629a5ab77780d49.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\duration.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\wrapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\date.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libhumantime-4629a5ab77780d49.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\duration.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\wrapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\date.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\humantime-4629a5ab77780d49.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\duration.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\wrapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\date.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\duration.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\wrapper.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\humantime-2.1.0\src\date.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/is_terminal-0a7ad9ee6b95796f.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/is_terminal-0a7ad9ee6b95796f.d new file mode 100644 index 0000000..2e34f82 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/is_terminal-0a7ad9ee6b95796f.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libis_terminal-0a7ad9ee6b95796f.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\is-terminal-0.4.12\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libis_terminal-0a7ad9ee6b95796f.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\is-terminal-0.4.12\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\is_terminal-0a7ad9ee6b95796f.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\is-terminal-0.4.12\src\lib.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\is-terminal-0.4.12\src\lib.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/itoa-efe7cef573b48b40.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/itoa-efe7cef573b48b40.d new file mode 100644 index 0000000..f556932 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/itoa-efe7cef573b48b40.d @@ -0,0 +1,8 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libitoa-efe7cef573b48b40.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\udiv128.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libitoa-efe7cef573b48b40.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\udiv128.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\itoa-efe7cef573b48b40.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\udiv128.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\itoa-1.0.11\src\udiv128.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rlib new file mode 100644 index 0000000..a39f4f5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rmeta new file mode 100644 index 0000000..a4434ef Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libaho_corasick-7325719205e84efb.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rlib new file mode 100644 index 0000000..0f263a1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rmeta new file mode 100644 index 0000000..59f8971 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libanyhow-33087781d5b7a33f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rlib new file mode 100644 index 0000000..03fdd52 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rmeta new file mode 100644 index 0000000..7b8660a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libclang_ast-d481a288a7b0d16c.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rlib new file mode 100644 index 0000000..5e411ae Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rmeta new file mode 100644 index 0000000..35c1e1b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libenv_logger-56e99d5d442b8f7b.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rlib new file mode 100644 index 0000000..b96c424 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rmeta new file mode 100644 index 0000000..9f7d560 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libheck-02b7e56dd051b17e.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rlib new file mode 100644 index 0000000..7918d99 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rmeta new file mode 100644 index 0000000..48fc5a0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libhumantime-4629a5ab77780d49.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rlib new file mode 100644 index 0000000..d3e3069 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rmeta new file mode 100644 index 0000000..3232d52 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libis_terminal-0a7ad9ee6b95796f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rlib new file mode 100644 index 0000000..6b702f7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rmeta new file mode 100644 index 0000000..19ea9cd Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libitoa-efe7cef573b48b40.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rlib new file mode 100644 index 0000000..f090ab1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rmeta new file mode 100644 index 0000000..b8b7aa9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/liblog-f3a5f9f964d58f6f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rlib new file mode 100644 index 0000000..cea4e41 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rmeta new file mode 100644 index 0000000..d219886 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libmemchr-994f69aff981d39f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rlib new file mode 100644 index 0000000..2d81521 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rmeta new file mode 100644 index 0000000..456e51c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libproc_macro2-c511da7308677aa7.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rlib new file mode 100644 index 0000000..832a9a4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rmeta new file mode 100644 index 0000000..9bb55e7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libpxbind-7b5c5eabd80e626f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rlib new file mode 100644 index 0000000..9e82a71 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rmeta new file mode 100644 index 0000000..0558f29 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libquote-6572dbe8242ebcbd.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rlib new file mode 100644 index 0000000..384b0df Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rmeta new file mode 100644 index 0000000..3ed5b73 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex-ae8b68fa9aa6fefa.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rlib new file mode 100644 index 0000000..fa63a6a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rmeta new file mode 100644 index 0000000..d867265 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_automata-448c8a222c61f315.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rlib new file mode 100644 index 0000000..46ef307 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rmeta new file mode 100644 index 0000000..f41d721 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libregex_syntax-6cf651013ee141d8.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rlib new file mode 100644 index 0000000..ea65230 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rmeta new file mode 100644 index 0000000..905114d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/librustc_hash-9e44aed369f15a41.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rlib new file mode 100644 index 0000000..c06a29f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rmeta new file mode 100644 index 0000000..cad860b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libryu-83514f85ec787a34.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rlib new file mode 100644 index 0000000..c2d11dd Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rmeta new file mode 100644 index 0000000..28af51b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde-01a927c39c970a1c.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rlib new file mode 100644 index 0000000..b725438 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rmeta new file mode 100644 index 0000000..a7edc3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libserde_json-4a0dec3224e77276.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rlib new file mode 100644 index 0000000..7d4cca5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rmeta new file mode 100644 index 0000000..43097b1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libsyn-5ac3c98c6da369ee.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rlib new file mode 100644 index 0000000..8fcd733 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rmeta new file mode 100644 index 0000000..3884bc0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libtermcolor-4eaf01eb662b57d9.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rlib new file mode 100644 index 0000000..141c0e3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rmeta new file mode 100644 index 0000000..bd8c4f7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libunicode_ident-9e712da980196895.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rlib new file mode 100644 index 0000000..4733fb9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rmeta new file mode 100644 index 0000000..3f50f6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwinapi_util-3efb899db8e951a5.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rlib new file mode 100644 index 0000000..9d97961 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rmeta new file mode 100644 index 0000000..e6bcade Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_sys-37346e2c1fcfdf87.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rlib new file mode 100644 index 0000000..1832e6a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rmeta new file mode 100644 index 0000000..e70cd9a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_targets-77b1c4cfc32173a8.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rlib new file mode 100644 index 0000000..66eca33 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rmeta new file mode 100644 index 0000000..78aafe9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/libwindows_x86_64_msvc-ee04cd40a05d3cdd.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/log-f3a5f9f964d58f6f.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/log-f3a5f9f964d58f6f.d new file mode 100644 index 0000000..8d386c2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/log-f3a5f9f964d58f6f.d @@ -0,0 +1,10 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\liblog-f3a5f9f964d58f6f.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\serde.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\__private_api.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\liblog-f3a5f9f964d58f6f.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\serde.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\__private_api.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\log-f3a5f9f964d58f6f.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\serde.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\__private_api.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\serde.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\log-0.4.21\src\__private_api.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/memchr-994f69aff981d39f.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/memchr-994f69aff981d39f.d new file mode 100644 index 0000000..1860579 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/memchr-994f69aff981d39f.d @@ -0,0 +1,33 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libmemchr-994f69aff981d39f.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\default_rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\shiftor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\twoway.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\cow.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\searcher.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\vector.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libmemchr-994f69aff981d39f.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\default_rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\shiftor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\twoway.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\cow.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\searcher.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\vector.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\memchr-994f69aff981d39f.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\default_rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\rabinkarp.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\shiftor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\twoway.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\packedpair.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\cow.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\searcher.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\vector.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\packedpair\default_rank.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\rabinkarp.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\shiftor.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\all\twoway.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\generic\packedpair.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\avx2\packedpair.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\sse2\packedpair.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\arch\x86_64\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\cow.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\ext.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\memmem\searcher.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\memchr-2.7.2\src\vector.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/proc_macro2-c511da7308677aa7.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/proc_macro2-c511da7308677aa7.d new file mode 100644 index 0000000..85435a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/proc_macro2-c511da7308677aa7.d @@ -0,0 +1,14 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libproc_macro2-c511da7308677aa7.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\marker.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\rcvec.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\detection.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\fallback.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\extra.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\wrapper.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libproc_macro2-c511da7308677aa7.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\marker.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\rcvec.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\detection.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\fallback.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\extra.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\wrapper.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\proc_macro2-c511da7308677aa7.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\marker.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\rcvec.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\detection.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\fallback.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\extra.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\wrapper.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\marker.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\parse.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\rcvec.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\detection.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\fallback.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\extra.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\proc-macro2-1.0.85\src\wrapper.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind-7b5c5eabd80e626f.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind-7b5c5eabd80e626f.d new file mode 100644 index 0000000..39bfddf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind-7b5c5eabd80e626f.d @@ -0,0 +1,18 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libpxbind-7b5c5eabd80e626f.rmeta: src\lib.rs src\consumer.rs src\consumer\record.rs src\consumer\enums.rs src\consumer\functions.rs src\consumer\templates.rs src\dump.rs src\generator.rs src\generator\comment.rs src\generator\enums.rs src\generator\functions.rs src\generator\record.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libpxbind-7b5c5eabd80e626f.rlib: src\lib.rs src\consumer.rs src\consumer\record.rs src\consumer\enums.rs src\consumer\functions.rs src\consumer\templates.rs src\dump.rs src\generator.rs src\generator\comment.rs src\generator\enums.rs src\generator\functions.rs src\generator\record.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\pxbind-7b5c5eabd80e626f.d: src\lib.rs src\consumer.rs src\consumer\record.rs src\consumer\enums.rs src\consumer\functions.rs src\consumer\templates.rs src\dump.rs src\generator.rs src\generator\comment.rs src\generator\enums.rs src\generator\functions.rs src\generator\record.rs + +src\lib.rs: +src\consumer.rs: +src\consumer\record.rs: +src\consumer\enums.rs: +src\consumer\functions.rs: +src\consumer\templates.rs: +src\dump.rs: +src\generator.rs: +src\generator\comment.rs: +src\generator\enums.rs: +src\generator\functions.rs: +src\generator\record.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.d new file mode 100644 index 0000000..31a6bfa --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.d @@ -0,0 +1,5 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\pxbind.exe: src\main.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\pxbind.d: src\main.rs + +src\main.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.exe new file mode 100644 index 0000000..8e50874 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.pdb new file mode 100644 index 0000000..43b8c89 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/pxbind.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/quote-6572dbe8242ebcbd.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/quote-6572dbe8242ebcbd.d new file mode 100644 index 0000000..37c5b88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/quote-6572dbe8242ebcbd.d @@ -0,0 +1,13 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libquote-6572dbe8242ebcbd.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ident_fragment.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\to_tokens.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\runtime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\spanned.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libquote-6572dbe8242ebcbd.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ident_fragment.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\to_tokens.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\runtime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\spanned.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\quote-6572dbe8242ebcbd.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ident_fragment.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\to_tokens.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\runtime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\spanned.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ext.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\format.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\ident_fragment.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\to_tokens.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\runtime.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\quote-1.0.36\src\spanned.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex-ae8b68fa9aa6fefa.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex-ae8b68fa9aa6fefa.d new file mode 100644 index 0000000..f6c0a8e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex-ae8b68fa9aa6fefa.d @@ -0,0 +1,17 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex-ae8b68fa9aa6fefa.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\builders.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\find_byte.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\string.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\string.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex-ae8b68fa9aa6fefa.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\builders.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\find_byte.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\string.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\string.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\regex-ae8b68fa9aa6fefa.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\builders.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\find_byte.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\string.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\bytes.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\string.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\builders.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\bytes.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\find_byte.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\bytes.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regex\string.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\bytes.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-1.10.5\src\regexset\string.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_automata-448c8a222c61f315.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_automata-448c8a222c61f315.d new file mode 100644 index 0000000..dcddfc1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_automata-448c8a222c61f315.d @@ -0,0 +1,65 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex_automata-448c8a222c61f315.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\onepass.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\limited.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\reverse_inner.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\stopat.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\strategy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\wrappers.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\backtrack.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\compiler.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\literal_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\nfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\pikevm.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\range_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\captures.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\escape.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\interpolate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\lazy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\look.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\pool.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\aho_corasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\byteset.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memmem.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\teddy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\start.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\syntax.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\wire.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\state.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\empty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\sparse_set.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\unicode_data\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\utf8.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex_automata-448c8a222c61f315.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\onepass.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\limited.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\reverse_inner.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\stopat.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\strategy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\wrappers.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\backtrack.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\compiler.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\literal_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\nfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\pikevm.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\range_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\captures.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\escape.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\interpolate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\lazy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\look.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\pool.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\aho_corasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\byteset.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memmem.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\teddy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\start.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\syntax.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\wire.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\state.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\empty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\sparse_set.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\unicode_data\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\utf8.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\regex_automata-448c8a222c61f315.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\onepass.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\remapper.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\dfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\id.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\limited.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\regex.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\reverse_inner.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\stopat.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\strategy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\wrappers.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\backtrack.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\builder.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\compiler.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\literal_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\nfa.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\pikevm.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\range_trie.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\alphabet.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\captures.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\escape.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\interpolate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\lazy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\look.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\pool.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\aho_corasick.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\byteset.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memmem.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\teddy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\primitives.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\start.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\syntax.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\wire.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\state.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\empty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\int.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\memchr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\search.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\sparse_set.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\unicode_data\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\utf8.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\onepass.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\dfa\remapper.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\dfa.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\id.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\regex.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\hybrid\search.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\limited.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\literal.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\regex.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\reverse_inner.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\stopat.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\strategy.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\meta\wrappers.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\backtrack.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\builder.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\compiler.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\literal_trie.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\map.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\nfa.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\pikevm.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\nfa\thompson\range_trie.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\alphabet.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\captures.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\escape.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\interpolate.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\iter.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\lazy.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\look.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\pool.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\aho_corasick.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\byteset.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\memmem.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\prefilter\teddy.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\primitives.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\start.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\syntax.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\wire.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\determinize\state.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\empty.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\int.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\memchr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\search.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\sparse_set.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\unicode_data\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-automata-0.4.7\src\util\utf8.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_syntax-6cf651013ee141d8.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_syntax-6cf651013ee141d8.d new file mode 100644 index 0000000..d43c697 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/regex_syntax-6cf651013ee141d8.d @@ -0,0 +1,25 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex_syntax-6cf651013ee141d8.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\either.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\interval.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\translate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\parser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode_tables\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\utf8.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libregex_syntax-6cf651013ee141d8.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\either.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\interval.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\translate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\parser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode_tables\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\utf8.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\regex_syntax-6cf651013ee141d8.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\debug.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\either.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\interval.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\literal.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\translate.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\visitor.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\parser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\rank.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode_tables\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\utf8.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\parse.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\print.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\ast\visitor.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\debug.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\either.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\interval.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\literal.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\print.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\translate.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\hir\visitor.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\parser.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\rank.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\unicode_tables\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\regex-syntax-0.8.4\src\utf8.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetaG7fFGH/lib.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetaG7fFGH/lib.rmeta new file mode 100644 index 0000000..0fcc7c5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetaG7fFGH/lib.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetadaD4ST/lib.rmeta b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetadaD4ST/lib.rmeta new file mode 100644 index 0000000..72dd309 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rmetadaD4ST/lib.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rustc_hash-9e44aed369f15a41.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rustc_hash-9e44aed369f15a41.d new file mode 100644 index 0000000..f685d28 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/rustc_hash-9e44aed369f15a41.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\librustc_hash-9e44aed369f15a41.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustc-hash-1.1.0\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\librustc_hash-9e44aed369f15a41.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustc-hash-1.1.0\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\rustc_hash-9e44aed369f15a41.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustc-hash-1.1.0\src\lib.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\rustc-hash-1.1.0\src\lib.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/ryu-83514f85ec787a34.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/ryu-83514f85ec787a34.d new file mode 100644 index 0000000..ef64061 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/ryu-83514f85ec787a34.d @@ -0,0 +1,18 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libryu-83514f85ec787a34.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\common.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_full_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\digit_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\exponent.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mantissa.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libryu-83514f85ec787a34.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\common.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_full_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\digit_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\exponent.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mantissa.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\ryu-83514f85ec787a34.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\buffer\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\common.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_full_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\digit_table.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s_intrinsics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\exponent.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mantissa.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\buffer\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\common.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_full_table.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\d2s_intrinsics.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\digit_table.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\f2s_intrinsics.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\exponent.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ryu-1.0.18\src\pretty\mantissa.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde-01a927c39c970a1c.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde-01a927c39c970a1c.d new file mode 100644 index 0000000..ef3f208 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde-01a927c39c970a1c.d @@ -0,0 +1,24 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libserde-01a927c39c970a1c.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\integer128.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\value.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\ignored_any.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\size_hint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impossible.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\doc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\seed.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libserde-01a927c39c970a1c.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\integer128.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\value.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\ignored_any.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\size_hint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impossible.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\doc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\seed.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\serde-01a927c39c970a1c.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\integer128.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\value.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\format.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\ignored_any.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\size_hint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\fmt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impls.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impossible.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\doc.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\seed.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\integer128.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\value.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\format.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\ignored_any.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\impls.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\size_hint.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\fmt.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impls.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\ser\impossible.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\de.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\ser.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\private\doc.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde-1.0.203\src\de\seed.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.d new file mode 100644 index 0000000..a0bc910 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.d @@ -0,0 +1,21 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\serde_derive-df0e609b33f126b0.dll: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ast.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\attr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\case.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\check.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ctxt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\receiver.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\respan.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\symbol.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\bound.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\fragment.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\dummy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\pretend.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\this.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\serde_derive-df0e609b33f126b0.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ast.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\attr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\case.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\check.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ctxt.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\receiver.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\respan.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\symbol.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\bound.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\fragment.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\dummy.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\pretend.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\this.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ast.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\attr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\case.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\check.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\ctxt.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\receiver.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\respan.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\internals\symbol.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\bound.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\fragment.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\de.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\dummy.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\pretend.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\ser.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_derive-1.0.203\src\this.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll new file mode 100644 index 0000000..f305764 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.exp b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.exp new file mode 100644 index 0000000..2f064f4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.exp differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.lib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.lib new file mode 100644 index 0000000..505eb10 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.dll.lib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.pdb new file mode 100644 index 0000000..cf1097b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_derive-df0e609b33f126b0.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_json-4a0dec3224e77276.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_json-4a0dec3224e77276.d new file mode 100644 index 0000000..a0ff99e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/serde_json-4a0dec3224e77276.d @@ -0,0 +1,22 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libserde_json-4a0dec3224e77276.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\from.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\index.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\partial_eq.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\io\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\number.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\read.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libserde_json-4a0dec3224e77276.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\from.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\index.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\partial_eq.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\io\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\number.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\read.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\serde_json-4a0dec3224e77276.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\map.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\de.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\from.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\index.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\partial_eq.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\ser.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\io\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\iter.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\number.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\read.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\de.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\map.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\ser.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\de.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\from.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\index.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\partial_eq.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\value\ser.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\io\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\iter.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\number.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\serde_json-1.0.117\src\read.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/syn-5ac3c98c6da369ee.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/syn-5ac3c98c6da369ee.d new file mode 100644 index 0000000..f4a57ec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/syn-5ac3c98c6da369ee.d @@ -0,0 +1,47 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libsyn-5ac3c98c6da369ee.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\group.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\token.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\attr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\bigint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\classify.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_keyword.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_punctuation.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\data.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\derive.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\drops.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\expr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\generics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ident.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lifetime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lit.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lookahead.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\mac.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\meta.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\op.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\discouraged.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_macro_input.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_quote.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\path.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\precedence.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\punctuated.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\restriction.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\sealed.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\span.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\spanned.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\thread.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\verbatim.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\export.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\gen\clone.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libsyn-5ac3c98c6da369ee.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\group.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\token.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\attr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\bigint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\classify.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_keyword.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_punctuation.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\data.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\derive.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\drops.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\expr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\generics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ident.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lifetime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lit.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lookahead.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\mac.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\meta.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\op.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\discouraged.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_macro_input.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_quote.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\path.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\precedence.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\punctuated.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\restriction.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\sealed.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\span.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\spanned.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\thread.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\verbatim.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\export.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\gen\clone.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\syn-5ac3c98c6da369ee.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src/lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\macros.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\group.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\token.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\attr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\bigint.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\buffer.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\classify.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_keyword.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_punctuation.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\data.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\derive.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\drops.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\error.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\expr.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ext.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\generics.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ident.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lifetime.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lit.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lookahead.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\mac.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\meta.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\op.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\discouraged.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_macro_input.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_quote.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\path.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\precedence.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\print.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\punctuated.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\restriction.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\sealed.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\span.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\spanned.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\thread.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ty.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\verbatim.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\export.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\gen\clone.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src/lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\macros.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\group.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\token.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\attr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\bigint.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\buffer.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\classify.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_keyword.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\custom_punctuation.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\data.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\derive.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\drops.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\error.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\expr.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ext.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\generics.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ident.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lifetime.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lit.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\lookahead.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\mac.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\meta.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\op.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\discouraged.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_macro_input.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\parse_quote.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\path.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\precedence.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\print.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\punctuated.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\restriction.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\sealed.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\span.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\spanned.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\thread.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\ty.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\verbatim.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\export.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\syn-2.0.66\src\gen\clone.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/termcolor-4eaf01eb662b57d9.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/termcolor-4eaf01eb662b57d9.d new file mode 100644 index 0000000..8d8c350 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/termcolor-4eaf01eb662b57d9.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libtermcolor-4eaf01eb662b57d9.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\termcolor-1.4.1\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libtermcolor-4eaf01eb662b57d9.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\termcolor-1.4.1\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\termcolor-4eaf01eb662b57d9.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\termcolor-1.4.1\src\lib.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\termcolor-1.4.1\src\lib.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/unicode_ident-9e712da980196895.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/unicode_ident-9e712da980196895.d new file mode 100644 index 0000000..06fbeda --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/unicode_ident-9e712da980196895.d @@ -0,0 +1,8 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libunicode_ident-9e712da980196895.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\tables.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libunicode_ident-9e712da980196895.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\tables.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\unicode_ident-9e712da980196895.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\tables.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\unicode-ident-1.0.12\src\tables.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/winapi_util-3efb899db8e951a5.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/winapi_util-3efb899db8e951a5.d new file mode 100644 index 0000000..25055be --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/winapi_util-3efb899db8e951a5.d @@ -0,0 +1,11 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwinapi_util-3efb899db8e951a5.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\console.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\file.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\sysinfo.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\win.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwinapi_util-3efb899db8e951a5.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\console.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\file.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\sysinfo.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\win.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\winapi_util-3efb899db8e951a5.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\console.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\file.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\sysinfo.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\win.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\console.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\file.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\sysinfo.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\winapi-util-0.1.8\src\win.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_sys-37346e2c1fcfdf87.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_sys-37346e2c1fcfdf87.d new file mode 100644 index 0000000..57f9083 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_sys-37346e2c1fcfdf87.d @@ -0,0 +1,17 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_sys-37346e2c1fcfdf87.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\literals.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows/mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Foundation\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\FileSystem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\Console\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\SystemInformation\mod.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_sys-37346e2c1fcfdf87.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\literals.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows/mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Foundation\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\FileSystem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\Console\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\SystemInformation\mod.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\windows_sys-37346e2c1fcfdf87.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\lib.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\literals.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows/mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Foundation\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\FileSystem\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\Console\mod.rs C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\SystemInformation\mod.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\lib.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\core\literals.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows/mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Foundation\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\Storage\FileSystem\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\Console\mod.rs: +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-sys-0.52.0\src\Windows\Win32\System\SystemInformation\mod.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_targets-77b1c4cfc32173a8.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_targets-77b1c4cfc32173a8.d new file mode 100644 index 0000000..26cce65 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_targets-77b1c4cfc32173a8.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_targets-77b1c4cfc32173a8.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-targets-0.52.5\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_targets-77b1c4cfc32173a8.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-targets-0.52.5\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\windows_targets-77b1c4cfc32173a8.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-targets-0.52.5\src\lib.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows-targets-0.52.5\src\lib.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_x86_64_msvc-ee04cd40a05d3cdd.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_x86_64_msvc-ee04cd40a05d3cdd.d new file mode 100644 index 0000000..0d53335 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/deps/windows_x86_64_msvc-ee04cd40a05d3cdd.d @@ -0,0 +1,7 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_x86_64_msvc-ee04cd40a05d3cdd.rmeta: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\libwindows_x86_64_msvc-ee04cd40a05d3cdd.rlib: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\src\lib.rs + +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\deps\windows_x86_64_msvc-ee04cd40a05d3cdd.d: C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\src\lib.rs + +C:\Users\Kuju\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.5\src\lib.rs: diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/10z3o29ylppz9n9e.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/10z3o29ylppz9n9e.o new file mode 100644 index 0000000..5292396 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/10z3o29ylppz9n9e.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1369vl26krs1mhb3.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1369vl26krs1mhb3.o new file mode 100644 index 0000000..8dbc446 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1369vl26krs1mhb3.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13cdh8yphvwd8dr0.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13cdh8yphvwd8dr0.o new file mode 100644 index 0000000..d75cc13 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13cdh8yphvwd8dr0.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13pudsi5cbi0zdgh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13pudsi5cbi0zdgh.o new file mode 100644 index 0000000..b4cfd26 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13pudsi5cbi0zdgh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13rltpf5llszuzke.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13rltpf5llszuzke.o new file mode 100644 index 0000000..925c152 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/13rltpf5llszuzke.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/143dpa94n31teyzb.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/143dpa94n31teyzb.o new file mode 100644 index 0000000..213768a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/143dpa94n31teyzb.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14ctzjeuy5xdje4z.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14ctzjeuy5xdje4z.o new file mode 100644 index 0000000..5f99f09 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14ctzjeuy5xdje4z.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14z1tyyu6juf4pbh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14z1tyyu6juf4pbh.o new file mode 100644 index 0000000..f77949f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/14z1tyyu6juf4pbh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1824wggl43zveddk.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1824wggl43zveddk.o new file mode 100644 index 0000000..2adf841 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1824wggl43zveddk.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1arhw4ti29nxbizv.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1arhw4ti29nxbizv.o new file mode 100644 index 0000000..7e14ac7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1arhw4ti29nxbizv.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1az5vqg90rfweghi.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1az5vqg90rfweghi.o new file mode 100644 index 0000000..295d546 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1az5vqg90rfweghi.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1dcpmufqhf7php12.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1dcpmufqhf7php12.o new file mode 100644 index 0000000..b240460 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1dcpmufqhf7php12.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1eh4wqbplzjnhvku.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1eh4wqbplzjnhvku.o new file mode 100644 index 0000000..b38a0df Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1eh4wqbplzjnhvku.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hh9sftykb1wpmch.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hh9sftykb1wpmch.o new file mode 100644 index 0000000..0cf0f8f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hh9sftykb1wpmch.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hogl9c7rxhep0pt.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hogl9c7rxhep0pt.o new file mode 100644 index 0000000..e42f644 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1hogl9c7rxhep0pt.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1i8ifakvkueshwee.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1i8ifakvkueshwee.o new file mode 100644 index 0000000..d4a4105 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1i8ifakvkueshwee.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1kc1y355o81xfzp5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1kc1y355o81xfzp5.o new file mode 100644 index 0000000..9d2fce5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1kc1y355o81xfzp5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1lc1xilg0x6y6xb9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1lc1xilg0x6y6xb9.o new file mode 100644 index 0000000..4c05ecf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1lc1xilg0x6y6xb9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ovhg3xhtyjc5zzy.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ovhg3xhtyjc5zzy.o new file mode 100644 index 0000000..c64632e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ovhg3xhtyjc5zzy.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1q2mt30717a3s0q1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1q2mt30717a3s0q1.o new file mode 100644 index 0000000..71ad5e6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1q2mt30717a3s0q1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1u7uz2lg4r9qnntk.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1u7uz2lg4r9qnntk.o new file mode 100644 index 0000000..b0e6893 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1u7uz2lg4r9qnntk.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ua8vz6z6dsdfh4v.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ua8vz6z6dsdfh4v.o new file mode 100644 index 0000000..1fec737 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ua8vz6z6dsdfh4v.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ummjh23l2hezo3a.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ummjh23l2hezo3a.o new file mode 100644 index 0000000..88c7887 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ummjh23l2hezo3a.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ye2ssk9zu7nljl2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ye2ssk9zu7nljl2.o new file mode 100644 index 0000000..5f12e34 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1ye2ssk9zu7nljl2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1yxpwiqqcjmb4jsd.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1yxpwiqqcjmb4jsd.o new file mode 100644 index 0000000..e50ab03 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1yxpwiqqcjmb4jsd.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1z6lq7qcrkhk81r1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1z6lq7qcrkhk81r1.o new file mode 100644 index 0000000..546432f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/1z6lq7qcrkhk81r1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/22k2ck97ipd4ziqz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/22k2ck97ipd4ziqz.o new file mode 100644 index 0000000..21bb41f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/22k2ck97ipd4ziqz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24aba5chcqtxqukr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24aba5chcqtxqukr.o new file mode 100644 index 0000000..c893478 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24aba5chcqtxqukr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24n4gmps9ma7joj.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24n4gmps9ma7joj.o new file mode 100644 index 0000000..8c1b98c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/24n4gmps9ma7joj.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/272npjwakv3vsbqu.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/272npjwakv3vsbqu.o new file mode 100644 index 0000000..ee7588e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/272npjwakv3vsbqu.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2auzg224wfwfub6d.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2auzg224wfwfub6d.o new file mode 100644 index 0000000..00f21f2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2auzg224wfwfub6d.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2b8f83ih2q2utyis.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2b8f83ih2q2utyis.o new file mode 100644 index 0000000..5d95ed6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2b8f83ih2q2utyis.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2dc9mifstmz4cxla.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2dc9mifstmz4cxla.o new file mode 100644 index 0000000..c8edb91 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2dc9mifstmz4cxla.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2evilks5a4tyyi4e.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2evilks5a4tyyi4e.o new file mode 100644 index 0000000..ee6fc90 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2evilks5a4tyyi4e.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2ewiycbcge97p8jd.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2ewiycbcge97p8jd.o new file mode 100644 index 0000000..0db467d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2ewiycbcge97p8jd.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2f307wwrz796l7rf.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2f307wwrz796l7rf.o new file mode 100644 index 0000000..5a540c6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2f307wwrz796l7rf.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2gitdrmgifyht2dg.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2gitdrmgifyht2dg.o new file mode 100644 index 0000000..72a9436 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2gitdrmgifyht2dg.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2j9qwzrsjqduedel.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2j9qwzrsjqduedel.o new file mode 100644 index 0000000..39ab363 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2j9qwzrsjqduedel.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2l7t8wytrs09s3li.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2l7t8wytrs09s3li.o new file mode 100644 index 0000000..8c79f0e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2l7t8wytrs09s3li.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2lcsu055vva5x1kh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2lcsu055vva5x1kh.o new file mode 100644 index 0000000..c1c6da3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2lcsu055vva5x1kh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2nlc17b9r5jloh6o.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2nlc17b9r5jloh6o.o new file mode 100644 index 0000000..9ff8a90 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2nlc17b9r5jloh6o.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2o0sku4uw8zlea30.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2o0sku4uw8zlea30.o new file mode 100644 index 0000000..9712b2e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2o0sku4uw8zlea30.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2q1to7ajcij9a2uj.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2q1to7ajcij9a2uj.o new file mode 100644 index 0000000..69c9061 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2q1to7ajcij9a2uj.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2v20l9045yj2zseb.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2v20l9045yj2zseb.o new file mode 100644 index 0000000..0bb3308 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2v20l9045yj2zseb.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2vlc8krjld8mnd4v.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2vlc8krjld8mnd4v.o new file mode 100644 index 0000000..f2c5116 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2vlc8krjld8mnd4v.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2zm7ts4qgh2badbv.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2zm7ts4qgh2badbv.o new file mode 100644 index 0000000..0021124 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/2zm7ts4qgh2badbv.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/30m7t7tkmnkfkxqx.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/30m7t7tkmnkfkxqx.o new file mode 100644 index 0000000..b3823c5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/30m7t7tkmnkfkxqx.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/33e1p8mz1hcg1scf.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/33e1p8mz1hcg1scf.o new file mode 100644 index 0000000..f21f0b9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/33e1p8mz1hcg1scf.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/364jhyy106ezsds9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/364jhyy106ezsds9.o new file mode 100644 index 0000000..6a2b32f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/364jhyy106ezsds9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/36h769lzq91ihzwc.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/36h769lzq91ihzwc.o new file mode 100644 index 0000000..82b8e10 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/36h769lzq91ihzwc.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/38gsigclqmivtz5p.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/38gsigclqmivtz5p.o new file mode 100644 index 0000000..0ffe68c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/38gsigclqmivtz5p.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/391ah7xkhd4vjepr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/391ah7xkhd4vjepr.o new file mode 100644 index 0000000..d744d8e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/391ah7xkhd4vjepr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3c0om3xu8rwds3wr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3c0om3xu8rwds3wr.o new file mode 100644 index 0000000..686d413 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3c0om3xu8rwds3wr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3gpybyxro8957ck4.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3gpybyxro8957ck4.o new file mode 100644 index 0000000..244c6ba Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3gpybyxro8957ck4.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3h7s9m9br1sp5anf.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3h7s9m9br1sp5anf.o new file mode 100644 index 0000000..44f0d57 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3h7s9m9br1sp5anf.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j72ootnlj9celnk.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j72ootnlj9celnk.o new file mode 100644 index 0000000..828fd78 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j72ootnlj9celnk.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j8uk7axdimn6zqv.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j8uk7axdimn6zqv.o new file mode 100644 index 0000000..8495d5d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3j8uk7axdimn6zqv.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3nl7m7pcifwuot50.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3nl7m7pcifwuot50.o new file mode 100644 index 0000000..9009ca6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3nl7m7pcifwuot50.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3pvxmg0fd3bg9km8.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3pvxmg0fd3bg9km8.o new file mode 100644 index 0000000..4f029d3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3pvxmg0fd3bg9km8.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3q98xn677jeqkwhv.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3q98xn677jeqkwhv.o new file mode 100644 index 0000000..4802bb7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3q98xn677jeqkwhv.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tqr8heacv3xgqtg.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tqr8heacv3xgqtg.o new file mode 100644 index 0000000..ec4fe7d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tqr8heacv3xgqtg.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tsvcxyimy48rxul.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tsvcxyimy48rxul.o new file mode 100644 index 0000000..1ac3084 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3tsvcxyimy48rxul.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3vhy2zu7olvgynjz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3vhy2zu7olvgynjz.o new file mode 100644 index 0000000..ac3ab7b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3vhy2zu7olvgynjz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3whehlvo9e9le9sx.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3whehlvo9e9le9sx.o new file mode 100644 index 0000000..32b7aed Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3whehlvo9e9le9sx.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3wux5d6u70qxz5l3.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3wux5d6u70qxz5l3.o new file mode 100644 index 0000000..4207ac4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3wux5d6u70qxz5l3.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3xrdxoyvhox4tkpz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3xrdxoyvhox4tkpz.o new file mode 100644 index 0000000..d2fff5b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3xrdxoyvhox4tkpz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3z4uhrfq95jatygy.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3z4uhrfq95jatygy.o new file mode 100644 index 0000000..9b81b56 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/3z4uhrfq95jatygy.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4221ufrmzvbr03u2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4221ufrmzvbr03u2.o new file mode 100644 index 0000000..845118a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4221ufrmzvbr03u2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42rzxzzfxdxgadmh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42rzxzzfxdxgadmh.o new file mode 100644 index 0000000..e37fb0c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42rzxzzfxdxgadmh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42tocp3ccx4ql9gp.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42tocp3ccx4ql9gp.o new file mode 100644 index 0000000..5fbfdce Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/42tocp3ccx4ql9gp.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43lk0qxkgp2z6qy0.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43lk0qxkgp2z6qy0.o new file mode 100644 index 0000000..a09f8fa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43lk0qxkgp2z6qy0.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43n5iktvk8xvdmnl.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43n5iktvk8xvdmnl.o new file mode 100644 index 0000000..a0e490b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43n5iktvk8xvdmnl.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43vmme1xs21ecwcy.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43vmme1xs21ecwcy.o new file mode 100644 index 0000000..35903cd Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/43vmme1xs21ecwcy.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44fxyfpsl2ygda9i.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44fxyfpsl2ygda9i.o new file mode 100644 index 0000000..1f999a7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44fxyfpsl2ygda9i.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44kxsgy4c28uhxly.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44kxsgy4c28uhxly.o new file mode 100644 index 0000000..5322054 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/44kxsgy4c28uhxly.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45isxzl5naree368.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45isxzl5naree368.o new file mode 100644 index 0000000..34affcf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45isxzl5naree368.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45zmb1ys4rz8ud54.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45zmb1ys4rz8ud54.o new file mode 100644 index 0000000..a8614b6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/45zmb1ys4rz8ud54.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/47rmq6thfhj6b6j1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/47rmq6thfhj6b6j1.o new file mode 100644 index 0000000..cb1860f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/47rmq6thfhj6b6j1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/48jftigl1f0a00mp.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/48jftigl1f0a00mp.o new file mode 100644 index 0000000..577fbf6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/48jftigl1f0a00mp.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4azjbh8zjckapug2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4azjbh8zjckapug2.o new file mode 100644 index 0000000..93febb8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4azjbh8zjckapug2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4br2yqk6o0fn681u.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4br2yqk6o0fn681u.o new file mode 100644 index 0000000..5f6aff3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4br2yqk6o0fn681u.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4corchs5p7aqgkm6.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4corchs5p7aqgkm6.o new file mode 100644 index 0000000..d3aeeaf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4corchs5p7aqgkm6.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eae5cl3w065ienm.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eae5cl3w065ienm.o new file mode 100644 index 0000000..d8a6069 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eae5cl3w065ienm.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eptycpd0yo781eq.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eptycpd0yo781eq.o new file mode 100644 index 0000000..5a57ab1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4eptycpd0yo781eq.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ggm97o038alsy22.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ggm97o038alsy22.o new file mode 100644 index 0000000..c85f5d4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ggm97o038alsy22.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4iu73tl2awlyiikp.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4iu73tl2awlyiikp.o new file mode 100644 index 0000000..9d6f25b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4iu73tl2awlyiikp.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4jsgj75h98abb8s5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4jsgj75h98abb8s5.o new file mode 100644 index 0000000..f22ba95 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4jsgj75h98abb8s5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4lzrib5z28yxs27t.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4lzrib5z28yxs27t.o new file mode 100644 index 0000000..8bb69e7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4lzrib5z28yxs27t.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4o19bsvkhy86vju.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4o19bsvkhy86vju.o new file mode 100644 index 0000000..63820e1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4o19bsvkhy86vju.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4pt6bcfdortc00ba.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4pt6bcfdortc00ba.o new file mode 100644 index 0000000..e210beb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4pt6bcfdortc00ba.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4qx1h1hoep9f6jlm.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4qx1h1hoep9f6jlm.o new file mode 100644 index 0000000..cff07a5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4qx1h1hoep9f6jlm.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4rpwhwaximgid6x2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4rpwhwaximgid6x2.o new file mode 100644 index 0000000..86fcc26 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4rpwhwaximgid6x2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tfxj8x8stt6pczr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tfxj8x8stt6pczr.o new file mode 100644 index 0000000..e9b34e0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tfxj8x8stt6pczr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tm2lxrxq8scsq66.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tm2lxrxq8scsq66.o new file mode 100644 index 0000000..f742c80 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4tm2lxrxq8scsq66.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4uth2j0k30r4qwen.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4uth2j0k30r4qwen.o new file mode 100644 index 0000000..c6624db Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4uth2j0k30r4qwen.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4x5rmqmle7y1po2a.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4x5rmqmle7y1po2a.o new file mode 100644 index 0000000..6bb4e3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4x5rmqmle7y1po2a.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4xdiv68t6loljlwz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4xdiv68t6loljlwz.o new file mode 100644 index 0000000..3b5db00 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4xdiv68t6loljlwz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ym4c8cilwba593l.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ym4c8cilwba593l.o new file mode 100644 index 0000000..d71fa80 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4ym4c8cilwba593l.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4yzdlce6azbh8z95.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4yzdlce6azbh8z95.o new file mode 100644 index 0000000..b4f6685 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4yzdlce6azbh8z95.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4z42nakwt8nqg9y.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4z42nakwt8nqg9y.o new file mode 100644 index 0000000..0bbbc06 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/4z42nakwt8nqg9y.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/51kxuci2yphvoyxz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/51kxuci2yphvoyxz.o new file mode 100644 index 0000000..be19142 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/51kxuci2yphvoyxz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/536d5pcairqrzukq.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/536d5pcairqrzukq.o new file mode 100644 index 0000000..4decb4b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/536d5pcairqrzukq.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/55y3uktsdz3shd92.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/55y3uktsdz3shd92.o new file mode 100644 index 0000000..b5ee5dd Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/55y3uktsdz3shd92.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/57kiu5kw1uw0vp4q.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/57kiu5kw1uw0vp4q.o new file mode 100644 index 0000000..1fb778c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/57kiu5kw1uw0vp4q.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/583mbb7x9lzp2wnl.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/583mbb7x9lzp2wnl.o new file mode 100644 index 0000000..69d98c7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/583mbb7x9lzp2wnl.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5bo99ps7q2hnrord.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5bo99ps7q2hnrord.o new file mode 100644 index 0000000..9824e58 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5bo99ps7q2hnrord.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5emgv3xhodwgdqe2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5emgv3xhodwgdqe2.o new file mode 100644 index 0000000..5c3e090 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5emgv3xhodwgdqe2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5i32nrqrn50bdx5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5i32nrqrn50bdx5.o new file mode 100644 index 0000000..2420d55 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/5i32nrqrn50bdx5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/6528b84kjk4azlw.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/6528b84kjk4azlw.o new file mode 100644 index 0000000..4eee871 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/6528b84kjk4azlw.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/7njpy66z6kh2sul.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/7njpy66z6kh2sul.o new file mode 100644 index 0000000..8678448 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/7njpy66z6kh2sul.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/aqm5v0vvpiu2gtz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/aqm5v0vvpiu2gtz.o new file mode 100644 index 0000000..c077716 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/aqm5v0vvpiu2gtz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/bfsl4r7s0kpln16.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/bfsl4r7s0kpln16.o new file mode 100644 index 0000000..ed5bb5f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/bfsl4r7s0kpln16.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/c423x1x6efe9d6p.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/c423x1x6efe9d6p.o new file mode 100644 index 0000000..48fd3d2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/c423x1x6efe9d6p.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dep-graph.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dep-graph.bin new file mode 100644 index 0000000..014fef8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dep-graph.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dsi5ittujgiwjvm.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dsi5ittujgiwjvm.o new file mode 100644 index 0000000..7ab2ad7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/dsi5ittujgiwjvm.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/ea0yecmul0awit1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/ea0yecmul0awit1.o new file mode 100644 index 0000000..9de617f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/ea0yecmul0awit1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/g7ka29oouyyjaz8.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/g7ka29oouyyjaz8.o new file mode 100644 index 0000000..e94cb74 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/g7ka29oouyyjaz8.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/h22ofrr1mqdpl0l.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/h22ofrr1mqdpl0l.o new file mode 100644 index 0000000..a955f7f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/h22ofrr1mqdpl0l.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/io0l31hqfbprwim.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/io0l31hqfbprwim.o new file mode 100644 index 0000000..eb6aab3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/io0l31hqfbprwim.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/iuaupf65p4zv1kd.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/iuaupf65p4zv1kd.o new file mode 100644 index 0000000..1f87d54 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/iuaupf65p4zv1kd.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/kh8kl9bdpwemyjr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/kh8kl9bdpwemyjr.o new file mode 100644 index 0000000..d4cebe2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/kh8kl9bdpwemyjr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/mdtt0wt5b4vywp9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/mdtt0wt5b4vywp9.o new file mode 100644 index 0000000..c6761fc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/mdtt0wt5b4vywp9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/n8ygcmajhpn03vp.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/n8ygcmajhpn03vp.o new file mode 100644 index 0000000..da0cb72 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/n8ygcmajhpn03vp.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/nz8mrs2zulnp5qa.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/nz8mrs2zulnp5qa.o new file mode 100644 index 0000000..eeee2c2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/nz8mrs2zulnp5qa.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/oamc5zbg7houi73.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/oamc5zbg7houi73.o new file mode 100644 index 0000000..aab2517 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/oamc5zbg7houi73.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/p3r0u4lsf6jfjks.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/p3r0u4lsf6jfjks.o new file mode 100644 index 0000000..8cba629 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/p3r0u4lsf6jfjks.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/query-cache.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/query-cache.bin new file mode 100644 index 0000000..9770cb3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/query-cache.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/rqy803goswz498w.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/rqy803goswz498w.o new file mode 100644 index 0000000..a8f8de1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/rqy803goswz498w.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/u8ng88ipnmmupmt.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/u8ng88ipnmmupmt.o new file mode 100644 index 0000000..a2578ab Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/u8ng88ipnmmupmt.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/uoyycle4cj38j9e.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/uoyycle4cj38j9e.o new file mode 100644 index 0000000..53aa56a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/uoyycle4cj38j9e.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/usdv74jk6sgc2n9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/usdv74jk6sgc2n9.o new file mode 100644 index 0000000..13c5cc1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/usdv74jk6sgc2n9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/work-products.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/work-products.bin new file mode 100644 index 0000000..e036fc4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/work-products.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/y6z9uotsodlxz9e.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/y6z9uotsodlxz9e.o new file mode 100644 index 0000000..a012e8c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf-3ex0uin6xh8aw7yu5x6edodhq/y6z9uotsodlxz9e.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf.lock b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-3b98tpw7kqypa/s-gx2vhrmzuo-17x8pf.lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/111jkfmvkty14d7p.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/111jkfmvkty14d7p.o new file mode 100644 index 0000000..2635dc8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/111jkfmvkty14d7p.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/12lubbs67aba3z73.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/12lubbs67aba3z73.o new file mode 100644 index 0000000..c295678 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/12lubbs67aba3z73.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/18ac1nbuij07xifl.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/18ac1nbuij07xifl.o new file mode 100644 index 0000000..1a6ae39 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/18ac1nbuij07xifl.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/19rutzh7zbxdrr5v.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/19rutzh7zbxdrr5v.o new file mode 100644 index 0000000..1870ead Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/19rutzh7zbxdrr5v.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1azavh02e8bhsoga.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1azavh02e8bhsoga.o new file mode 100644 index 0000000..f07d419 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1azavh02e8bhsoga.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1bniyykq9i0mz62c.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1bniyykq9i0mz62c.o new file mode 100644 index 0000000..00e5760 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1bniyykq9i0mz62c.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1eckb6lh904p8q5m.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1eckb6lh904p8q5m.o new file mode 100644 index 0000000..a622b11 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1eckb6lh904p8q5m.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1en8h7yyg6b0zx7n.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1en8h7yyg6b0zx7n.o new file mode 100644 index 0000000..088cc44 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1en8h7yyg6b0zx7n.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1evb8qtcxzfb3x18.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1evb8qtcxzfb3x18.o new file mode 100644 index 0000000..7eb0e79 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1evb8qtcxzfb3x18.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1fueqez5hilz4snh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1fueqez5hilz4snh.o new file mode 100644 index 0000000..604c9ae Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1fueqez5hilz4snh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gn66b1y0ex6es2r.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gn66b1y0ex6es2r.o new file mode 100644 index 0000000..4ed6e6a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gn66b1y0ex6es2r.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gvqq3n06j4c3mn3.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gvqq3n06j4c3mn3.o new file mode 100644 index 0000000..5441b3b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1gvqq3n06j4c3mn3.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1i07c2ac3bpvpc82.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1i07c2ac3bpvpc82.o new file mode 100644 index 0000000..cd1dd5d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1i07c2ac3bpvpc82.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1ii96u00w68kjiz4.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1ii96u00w68kjiz4.o new file mode 100644 index 0000000..197b8a6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1ii96u00w68kjiz4.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1p5dzycs10vshr4i.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1p5dzycs10vshr4i.o new file mode 100644 index 0000000..650b55c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1p5dzycs10vshr4i.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1qbk508esyd8r1um.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1qbk508esyd8r1um.o new file mode 100644 index 0000000..b9ccfd5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1qbk508esyd8r1um.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1upprkf85y9yica2.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1upprkf85y9yica2.o new file mode 100644 index 0000000..b40c99e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1upprkf85y9yica2.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1z6y9xj4479p1sju.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1z6y9xj4479p1sju.o new file mode 100644 index 0000000..446916e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/1z6y9xj4479p1sju.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/230p4znm9n5im9nx.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/230p4znm9n5im9nx.o new file mode 100644 index 0000000..1d24a11 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/230p4znm9n5im9nx.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/246bj4wld34oqh56.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/246bj4wld34oqh56.o new file mode 100644 index 0000000..9e2f9f8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/246bj4wld34oqh56.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/26w9ro2r24asi2uz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/26w9ro2r24asi2uz.o new file mode 100644 index 0000000..86fa159 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/26w9ro2r24asi2uz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2jzvpnvmzpueh3jd.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2jzvpnvmzpueh3jd.o new file mode 100644 index 0000000..0ca439c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2jzvpnvmzpueh3jd.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l121cux88xe2qn9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l121cux88xe2qn9.o new file mode 100644 index 0000000..80cb409 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l121cux88xe2qn9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l6u3e4dwv3u59gh.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l6u3e4dwv3u59gh.o new file mode 100644 index 0000000..c317f6a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2l6u3e4dwv3u59gh.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2mcndcumsfns6in9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2mcndcumsfns6in9.o new file mode 100644 index 0000000..e434d87 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2mcndcumsfns6in9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2n81roqq1whrv1li.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2n81roqq1whrv1li.o new file mode 100644 index 0000000..0a5f157 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2n81roqq1whrv1li.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2natgmioz6nc4nvf.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2natgmioz6nc4nvf.o new file mode 100644 index 0000000..d68bc0e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2natgmioz6nc4nvf.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qmtierfrt51xuzz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qmtierfrt51xuzz.o new file mode 100644 index 0000000..5292599 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qmtierfrt51xuzz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qpc6fm8puo8bnl.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qpc6fm8puo8bnl.o new file mode 100644 index 0000000..c3f6f82 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2qpc6fm8puo8bnl.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2uo4e7kxetbifcra.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2uo4e7kxetbifcra.o new file mode 100644 index 0000000..0361ed9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2uo4e7kxetbifcra.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2v0octd8uo7g0po1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2v0octd8uo7g0po1.o new file mode 100644 index 0000000..b477c84 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2v0octd8uo7g0po1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2w7drscy6ytbdcj6.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2w7drscy6ytbdcj6.o new file mode 100644 index 0000000..a237570 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2w7drscy6ytbdcj6.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2zp2l0k3aypifnz7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2zp2l0k3aypifnz7.o new file mode 100644 index 0000000..c747a29 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/2zp2l0k3aypifnz7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/31rw8b1hugfq9wzp.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/31rw8b1hugfq9wzp.o new file mode 100644 index 0000000..b59dd50 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/31rw8b1hugfq9wzp.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/35msz0nhz7kbut36.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/35msz0nhz7kbut36.o new file mode 100644 index 0000000..002af90 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/35msz0nhz7kbut36.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/372c6asvsmh09xwj.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/372c6asvsmh09xwj.o new file mode 100644 index 0000000..0569fbf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/372c6asvsmh09xwj.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3dsuj6fgb9v44l7a.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3dsuj6fgb9v44l7a.o new file mode 100644 index 0000000..0ba8b0f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3dsuj6fgb9v44l7a.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fc93sjs74n3u15t.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fc93sjs74n3u15t.o new file mode 100644 index 0000000..4e99bc7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fc93sjs74n3u15t.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fjrif7ff9cghvci.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fjrif7ff9cghvci.o new file mode 100644 index 0000000..5f023c7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3fjrif7ff9cghvci.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3g8ym7ecomwwl7hz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3g8ym7ecomwwl7hz.o new file mode 100644 index 0000000..12d6b65 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3g8ym7ecomwwl7hz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3gw65jxstqpbyo1n.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3gw65jxstqpbyo1n.o new file mode 100644 index 0000000..e31bbb7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3gw65jxstqpbyo1n.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hh4n1m0vyyunj1e.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hh4n1m0vyyunj1e.o new file mode 100644 index 0000000..aeef1d4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hh4n1m0vyyunj1e.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hxj0tnkrfd89hyb.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hxj0tnkrfd89hyb.o new file mode 100644 index 0000000..83ed8a1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3hxj0tnkrfd89hyb.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3jiz4jy5twy3su0h.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3jiz4jy5twy3su0h.o new file mode 100644 index 0000000..aeab982 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3jiz4jy5twy3su0h.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3kyh5houl4wxqep9.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3kyh5houl4wxqep9.o new file mode 100644 index 0000000..2c9bf8a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3kyh5houl4wxqep9.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nl4vzwy7pvw35xk.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nl4vzwy7pvw35xk.o new file mode 100644 index 0000000..4258272 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nl4vzwy7pvw35xk.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nmx1r163axyxa53.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nmx1r163axyxa53.o new file mode 100644 index 0000000..f14cd2c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3nmx1r163axyxa53.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3p5ms1580h88x9g8.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3p5ms1580h88x9g8.o new file mode 100644 index 0000000..5c33d07 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3p5ms1580h88x9g8.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pndupg32cszii9j.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pndupg32cszii9j.o new file mode 100644 index 0000000..af26b88 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pndupg32cszii9j.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pxt53hpxsq2uvr5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pxt53hpxsq2uvr5.o new file mode 100644 index 0000000..9cb4443 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3pxt53hpxsq2uvr5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3ra9d3grxnep51ww.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3ra9d3grxnep51ww.o new file mode 100644 index 0000000..aed9de9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3ra9d3grxnep51ww.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3vtker3rbbwf7mob.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3vtker3rbbwf7mob.o new file mode 100644 index 0000000..3eb6f17 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/3vtker3rbbwf7mob.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/41xa69u82sz1x96n.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/41xa69u82sz1x96n.o new file mode 100644 index 0000000..ae749b7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/41xa69u82sz1x96n.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42hz4082435h3e4t.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42hz4082435h3e4t.o new file mode 100644 index 0000000..f3e8c7a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42hz4082435h3e4t.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42uw53jn2yn25mre.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42uw53jn2yn25mre.o new file mode 100644 index 0000000..3343ac7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/42uw53jn2yn25mre.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/43i8c8qfzjmez6i8.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/43i8c8qfzjmez6i8.o new file mode 100644 index 0000000..198e883 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/43i8c8qfzjmez6i8.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/45q240z7mi64ohji.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/45q240z7mi64ohji.o new file mode 100644 index 0000000..1b81e10 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/45q240z7mi64ohji.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/47po8elxkku2azt8.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/47po8elxkku2azt8.o new file mode 100644 index 0000000..9aec442 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/47po8elxkku2azt8.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4bc5453bqppgjy91.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4bc5453bqppgjy91.o new file mode 100644 index 0000000..c15adcc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4bc5453bqppgjy91.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4cvr52dowo3c0qw0.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4cvr52dowo3c0qw0.o new file mode 100644 index 0000000..0b4834c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4cvr52dowo3c0qw0.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4f9sp51ixwldslfg.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4f9sp51ixwldslfg.o new file mode 100644 index 0000000..b6706f6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4f9sp51ixwldslfg.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4g6mwnmz7099jl07.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4g6mwnmz7099jl07.o new file mode 100644 index 0000000..9e09062 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4g6mwnmz7099jl07.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4h8kmqlkdblb83e0.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4h8kmqlkdblb83e0.o new file mode 100644 index 0000000..580d549 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4h8kmqlkdblb83e0.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4hrj19edl4hymf97.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4hrj19edl4hymf97.o new file mode 100644 index 0000000..56c4a0b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4hrj19edl4hymf97.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4lqwm6vtx21ojrf6.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4lqwm6vtx21ojrf6.o new file mode 100644 index 0000000..728ebf6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4lqwm6vtx21ojrf6.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4mbld9r8ru6bk2z7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4mbld9r8ru6bk2z7.o new file mode 100644 index 0000000..8a87d50 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4mbld9r8ru6bk2z7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4n7efsf5oiz5nmid.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4n7efsf5oiz5nmid.o new file mode 100644 index 0000000..e21288a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4n7efsf5oiz5nmid.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4ra54uckdj4nhg3o.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4ra54uckdj4nhg3o.o new file mode 100644 index 0000000..60ded76 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4ra54uckdj4nhg3o.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4snrwd6lnkyf7mj7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4snrwd6lnkyf7mj7.o new file mode 100644 index 0000000..e8f9eef Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4snrwd6lnkyf7mj7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4swmik86roeufdk1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4swmik86roeufdk1.o new file mode 100644 index 0000000..aa9a13d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4swmik86roeufdk1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vqin6k9lpyzzlfy.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vqin6k9lpyzzlfy.o new file mode 100644 index 0000000..013c000 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vqin6k9lpyzzlfy.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vyezw7w58unl0h5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vyezw7w58unl0h5.o new file mode 100644 index 0000000..dfc7435 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4vyezw7w58unl0h5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4zj807j60akbp280.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4zj807j60akbp280.o new file mode 100644 index 0000000..769ca8a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/4zj807j60akbp280.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/50zi8ynzxjxk1mu.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/50zi8ynzxjxk1mu.o new file mode 100644 index 0000000..a9658e7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/50zi8ynzxjxk1mu.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/51m43awc9vrk1wcz.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/51m43awc9vrk1wcz.o new file mode 100644 index 0000000..23d0952 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/51m43awc9vrk1wcz.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5413b47c0l3jcvk7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5413b47c0l3jcvk7.o new file mode 100644 index 0000000..a20e659 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5413b47c0l3jcvk7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/56082z48yw96aord.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/56082z48yw96aord.o new file mode 100644 index 0000000..5fc9692 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/56082z48yw96aord.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/561ldv7akq2kjgnm.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/561ldv7akq2kjgnm.o new file mode 100644 index 0000000..abeea0c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/561ldv7akq2kjgnm.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/57i2k9459hkdj99m.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/57i2k9459hkdj99m.o new file mode 100644 index 0000000..faaa614 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/57i2k9459hkdj99m.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/59qfx93uiz59s7ma.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/59qfx93uiz59s7ma.o new file mode 100644 index 0000000..006c07c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/59qfx93uiz59s7ma.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5fzaum2hj6avsifi.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5fzaum2hj6avsifi.o new file mode 100644 index 0000000..eeb8b82 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5fzaum2hj6avsifi.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5gmpbrjwr5mpbgqu.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5gmpbrjwr5mpbgqu.o new file mode 100644 index 0000000..4520b48 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5gmpbrjwr5mpbgqu.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5xk3lyfnq5moswr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5xk3lyfnq5moswr.o new file mode 100644 index 0000000..6bb82e5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/5xk3lyfnq5moswr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/6bwpy5ut1k3aeyg.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/6bwpy5ut1k3aeyg.o new file mode 100644 index 0000000..1c4a85d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/6bwpy5ut1k3aeyg.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/af9czul3godm7y0.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/af9czul3godm7y0.o new file mode 100644 index 0000000..f9a913c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/af9czul3godm7y0.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ctv1uvnewgasqdr.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ctv1uvnewgasqdr.o new file mode 100644 index 0000000..03fcc0a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ctv1uvnewgasqdr.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/dep-graph.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/dep-graph.bin new file mode 100644 index 0000000..4b0cef1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/dep-graph.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/gwu2m0z64ehkvr7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/gwu2m0z64ehkvr7.o new file mode 100644 index 0000000..c592c2c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/gwu2m0z64ehkvr7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/lj6nikztjlh0w5c.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/lj6nikztjlh0w5c.o new file mode 100644 index 0000000..5e2f612 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/lj6nikztjlh0w5c.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ouflb1gl9raw8k1.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ouflb1gl9raw8k1.o new file mode 100644 index 0000000..6cd5d07 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/ouflb1gl9raw8k1.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/p126c77w06memd7.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/p126c77w06memd7.o new file mode 100644 index 0000000..2d4bf3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/p126c77w06memd7.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/qii0dvq0ahw2f17.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/qii0dvq0ahw2f17.o new file mode 100644 index 0000000..82ac547 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/qii0dvq0ahw2f17.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/query-cache.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/query-cache.bin new file mode 100644 index 0000000..ac64056 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/query-cache.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/r2hwp81nydormy.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/r2hwp81nydormy.o new file mode 100644 index 0000000..8cecd3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/r2hwp81nydormy.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u65z1l0kpqykim5.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u65z1l0kpqykim5.o new file mode 100644 index 0000000..5bded0e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u65z1l0kpqykim5.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u7wzuqtoyp3qr47.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u7wzuqtoyp3qr47.o new file mode 100644 index 0000000..5b425b3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/u7wzuqtoyp3qr47.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/vkkh02l01nl7n3o.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/vkkh02l01nl7n3o.o new file mode 100644 index 0000000..2d7963a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/vkkh02l01nl7n3o.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/work-products.bin b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/work-products.bin new file mode 100644 index 0000000..1355e61 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/work-products.bin differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/wryk0z1cb8ciozt.o b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/wryk0z1cb8ciozt.o new file mode 100644 index 0000000..2eaf908 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml-3ey35we12hl0bb4qbut3u3m1x/wryk0z1cb8ciozt.o differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml.lock b/modules/PhysX/physx/physx-sys/pxbind/target/debug/incremental/pxbind-ltd00n52encj/s-gx2vhs0ifs-1vvl6ml.lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.d new file mode 100644 index 0000000..87c88a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.d @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\libpxbind.rlib: C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\enums.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\functions.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\record.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\templates.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\dump.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\comment.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\enums.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\functions.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\record.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\lib.rs diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.rlib b/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.rlib new file mode 100644 index 0000000..832a9a4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/libpxbind.rlib differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.d b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.d new file mode 100644 index 0000000..9b5c61a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.d @@ -0,0 +1 @@ +C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\target\debug\pxbind.exe: C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\enums.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\functions.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\record.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer\templates.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\consumer.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\dump.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\comment.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\enums.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\functions.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator\record.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\generator.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\lib.rs C:\Users\Kuju\Projects\JaiPhysX\physx\physx-sys\pxbind\src\main.rs diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.exe b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.exe new file mode 100644 index 0000000..8e50874 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.exe differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.pdb b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.pdb new file mode 100644 index 0000000..43b8c89 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/pxbind/target/debug/pxbind.pdb differ diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/all_the_things.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/all_the_things.h new file mode 100644 index 0000000..250cd8e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/all_the_things.h @@ -0,0 +1 @@ +#include "PxPhysicsAPI.h" diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/flags.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/flags.h new file mode 100644 index 0000000..cf213d4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/flags.h @@ -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 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 PxShapeFlags; +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/i32.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/i32.h new file mode 100644 index 0000000..a9fa207 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/i32.h @@ -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 diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/simple.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/simple.h new file mode 100644 index 0000000..3c98197 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/simple.h @@ -0,0 +1,9 @@ +namespace physx { + +/** enum for empty constructor tag*/ +enum PxEMPTY +{ + PxEmpty +}; + +} // physx \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/u32.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/u32.h new file mode 100644 index 0000000..9113664 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/enum/u32.h @@ -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 diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/constructors.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/constructors.h new file mode 100644 index 0000000..be604db --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/constructors.h @@ -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 + + Default: 1.0 + */ + PxF32 halfHeight; // Half-height in the "up" direction + + /** + \brief Half side extent + + Default: 0.5 + */ + PxF32 halfSideExtent; // Half-extent in the "side" direction + + /** + \brief Half forward extent + + Default: 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; +} +} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/destructors.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/destructors.h new file mode 100644 index 0000000..e50c398 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/destructors.h @@ -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; + } +}; +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/functions.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/functions.h new file mode 100644 index 0000000..71b3f4b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/functions.h @@ -0,0 +1 @@ +#include "PxPhysics.h" diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/methods_complex.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/methods_complex.h new file mode 100644 index 0000000..e77615d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/functions/methods_complex.h @@ -0,0 +1 @@ +#include "PxShape.h" diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/abstract.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/abstract.h new file mode 100644 index 0000000..db03830 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/abstract.h @@ -0,0 +1,50 @@ +#include + +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. + +Threading: 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. + + Threading: 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(). + + Threading: 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 diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/complex.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/complex.h new file mode 100644 index 0000000..d871b88 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/complex.h @@ -0,0 +1 @@ +#include "solver/PxSolverDefs.h" diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ptr_only.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ptr_only.h new file mode 100644 index 0000000..63c79f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ptr_only.h @@ -0,0 +1,18 @@ +namespace physx { + +class PxAllocatorCallback; + +class PxAllocatorCallback +{ + public: + + virtual ~PxAllocatorCallback() + { + } + + virtual void deallocate(void* ptr) = 0; +}; + +class MemoryBuffer; + +} // namespace physx diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ref_fields.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ref_fields.h new file mode 100644 index 0000000..913b351 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/ref_fields.h @@ -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; + }; +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/templates.h b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/templates.h new file mode 100644 index 0000000..71d5119 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/data/record/templates.h @@ -0,0 +1 @@ +#include "PxQueryReport.h" diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/enums.rs b/modules/PhysX/physx/physx-sys/pxbind/tests/enums.rs new file mode 100644 index 0000000..7c3740a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/enums.rs @@ -0,0 +1,59 @@ +fn gen_enums(which: &str, to_emit: &'static [&str]) -> anyhow::Result { + 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()); +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/functions.rs b/modules/PhysX/physx/physx-sys/pxbind/tests/functions.rs new file mode 100644 index 0000000..f99582c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/functions.rs @@ -0,0 +1,44 @@ +struct Functions { + cpp: String, + rust: String, +} + +fn gen_functions(which: &str) -> anyhow::Result { + 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); +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/methods.rs b/modules/PhysX/physx/physx-sys/pxbind/tests/methods.rs new file mode 100644 index 0000000..2a88680 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/methods.rs @@ -0,0 +1,78 @@ +struct Functions { + cpp: String, + rust: String, +} + +fn gen_functions(which: &str, to_emit: &'static [&str]) -> anyhow::Result { + 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); +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/records.rs b/modules/PhysX/physx/physx-sys/pxbind/tests/records.rs new file mode 100644 index 0000000..4e37653 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/records.rs @@ -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 { + 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); +} diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__flags.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__flags.snap new file mode 100644 index 0000000..ba7df84 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__flags.snap @@ -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; + } +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__i32.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__i32.snap new file mode 100644 index 0000000..66b17ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__i32.snap @@ -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, +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__simple.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__simple.snap new file mode 100644 index 0000000..4468085 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__simple.snap @@ -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, +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__u32.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__u32.snap new file mode 100644 index 0000000..66370a3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/enums__u32.snap @@ -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, +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions-2.snap new file mode 100644 index 0000000..63d0b59 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions-2.snap @@ -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; + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions.snap new file mode 100644 index 0000000..1fa615d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/functions__plain_functions.snap @@ -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(return_val); + return return_val_pod; + } + + physx_PxAssertHandler_Pod* phys_PxGetAssertHandler() { + physx::PxAssertHandler& return_val = PxGetAssertHandler(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + void phys_PxSetAssertHandler(physx_PxAssertHandler_Pod* handler_pod) { + physx::PxAssertHandler& handler = reinterpret_cast(*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(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(*foundation_pod); + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + physx::PxPvd* pvd = reinterpret_cast(pvd_pod); + physx::PxOmniPvd* omniPvd = reinterpret_cast(omniPvd_pod); + physx::PxPhysics* return_val = PxCreatePhysics(version, foundation, scale, trackOutstandingAllocations, pvd, omniPvd); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + physx_PxPhysics_Pod* phys_PxGetPhysics() { + physx::PxPhysics& return_val = PxGetPhysics(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors-2.snap new file mode 100644 index 0000000..39d35a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors-2.snap @@ -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; + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors.snap new file mode 100644 index 0000000..8a69225 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__constructors.snap @@ -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(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(self__pod); + self_->setToDefault(); + } + + physx_PxBoxControllerDesc_Pod* PxBoxControllerDesc_new_alloc() { + auto return_val = new physx::PxBoxControllerDesc(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + void PxBoxControllerDesc_delete(physx_PxBoxControllerDesc_Pod* self__pod) { + physx::PxBoxControllerDesc* self_ = reinterpret_cast(self__pod); + delete self_; + } + + void PxBoxControllerDesc_setToDefault_mut(physx_PxBoxControllerDesc_Pod* self__pod) { + physx::PxBoxControllerDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + bool PxBoxControllerDesc_isValid(physx_PxBoxControllerDesc_Pod const* self__pod) { + physx::PxBoxControllerDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor-2.snap new file mode 100644 index 0000000..dc7abb8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor-2.snap @@ -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); + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor.snap new file mode 100644 index 0000000..e8eb3d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__destructor.snap @@ -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(return_val); + return return_val_pod; + } + + bool PxJointLimitParameters_isValid(physx_PxJointLimitParameters_Pod const* self__pod) { + physx::PxJointLimitParameters const* self_ = reinterpret_cast(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(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(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + void PxJointAngularLimitPair_delete(physx_PxJointAngularLimitPair_Pod* self__pod) { + physx::PxJointAngularLimitPair* self_ = reinterpret_cast(self__pod); + delete self_; + } + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex-2.snap new file mode 100644 index 0000000..199d95f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex-2.snap @@ -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; + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex.snap new file mode 100644 index 0000000..e54e9d2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/methods__methods_complex.snap @@ -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(self__pod); + self_->release(); + } + + void PxShape_setGeometry_mut(physx_PxShape_Pod* self__pod, physx_PxGeometry_Pod const* geometry_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + self_->setGeometry(geometry); + } + + physx_PxGeometry_Pod const* PxShape_getGeometry(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& return_val = self_->getGeometry(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + physx_PxRigidActor_Pod* PxShape_getActor(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* return_val = self_->getActor(); + auto return_val_pod = reinterpret_cast(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(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setLocalPose(pose); + } + + physx_PxTransform_Pod PxShape_getLocalPose(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + physx::PxFilterData const& data = reinterpret_cast(*data_pod); + self_->setSimulationFilterData(data); + } + + physx_PxFilterData_Pod PxShape_getSimulationFilterData(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + physx::PxFilterData const& data = reinterpret_cast(*data_pod); + self_->setQueryFilterData(data); + } + + physx_PxFilterData_Pod PxShape_getQueryFilterData(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + physx::PxMaterial* const* materials = reinterpret_cast(materials_pod); + self_->setMaterials(materials, materialCount); + } + + uint16_t PxShape_getNbMaterials(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + physx::PxMaterial** userBuffer = reinterpret_cast(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(self__pod); + physx::PxBaseMaterial* return_val = self_->getMaterialFromInternalFaceIndex(faceIndex); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + void PxShape_setContactOffset_mut(physx_PxShape_Pod* self__pod, float contactOffset) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setContactOffset(contactOffset); + } + + float PxShape_getContactOffset(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + self_->setRestOffset(restOffset); + } + + float PxShape_getRestOffset(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + self_->setDensityForFluid(densityForFluid); + } + + float PxShape_getDensityForFluid(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + self_->setTorsionalPatchRadius(radius); + } + + float PxShape_getTorsionalPatchRadius(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + self_->setMinTorsionalPatchRadius(radius); + } + + float PxShape_getMinTorsionalPatchRadius(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, value); + } + + void PxShape_setFlags_mut(physx_PxShape_Pod* self__pod, uint8_t inFlags_pod) { + physx::PxShape* self_ = reinterpret_cast(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(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(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(self__pod); + self_->setName(name); + } + + char const* PxShape_getName(physx_PxShape_Pod const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-2.snap new file mode 100644 index 0000000..623189d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-2.snap @@ -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"); + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-3.snap new file mode 100644 index 0000000..5cb318e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_-3.snap @@ -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, +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_.snap new file mode 100644 index 0000000..0d4748b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__abstract_.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-2.snap new file mode 100644 index 0000000..c0960c4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-2.snap @@ -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"); + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-3.snap new file mode 100644 index 0000000..cea4b59 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex-3.snap @@ -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, +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex.snap new file mode 100644 index 0000000..c40c251 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__complex.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-2.snap new file mode 100644 index 0000000..623189d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-2.snap @@ -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"); + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-3.snap new file mode 100644 index 0000000..01dd2ea --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only-3.snap @@ -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], +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only.snap new file mode 100644 index 0000000..33d8d34 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ptr_only.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-2.snap new file mode 100644 index 0000000..9a735ec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-2.snap @@ -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"); + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-3.snap new file mode 100644 index 0000000..eb5940b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields-3.snap @@ -0,0 +1,6 @@ +--- +source: physx-sys/pxbind/tests/records.rs +expression: ro.rust_decls +--- + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields.snap new file mode 100644 index 0000000..29e0a03 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__ref_fields.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-2.snap new file mode 100644 index 0000000..c9e932a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-2.snap @@ -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"); + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-3.snap new file mode 100644 index 0000000..901ef5d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates-3.snap @@ -0,0 +1,10 @@ +--- +source: physx-sys/pxbind/tests/records.rs +expression: ro.rust_decls +--- + + + + + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates.snap new file mode 100644 index 0000000..2cf5dc8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__simple_templates.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-2.snap new file mode 100644 index 0000000..533d82c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-2.snap @@ -0,0 +1,9 @@ +--- +source: physx-sys/pxbind/tests/records.rs +expression: ro.size_asserts +--- +using namespace physx; +#include "structgen_out.hpp" + + + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-3.snap new file mode 100644 index 0000000..b91406f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates-3.snap @@ -0,0 +1,5 @@ +--- +source: physx-sys/pxbind/tests/records.rs +expression: ro.rust_decls +--- + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates.snap new file mode 100644 index 0000000..cacac8e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/records__templates.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-2.snap new file mode 100644 index 0000000..070485e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-2.snap @@ -0,0 +1,2073 @@ +--- +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_PxAllocatorCallback_Pod { + void* vtable_; +}; +struct physx_PxAssertHandler_Pod { + void* vtable_; +}; +struct physx_PxAllocationListener_Pod; +struct physx_PxFoundation_Pod { + void* vtable_; +}; +struct physx_PxProfilerCallback_Pod; +struct physx_PxAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRawAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxVirtualAllocatorCallback_Pod { + void* vtable_; +}; +struct physx_PxVirtualAllocator_Pod { + char structgen_pad0[16]; +}; +struct physx_PxUserAllocated_Pod { + char structgen_pad0[1]; +}; +union physx_PxTempAllocatorChunk_Pod { + physx_PxTempAllocatorChunk_Pod* mNext; + uint32_t mIndex; + uint8_t mPad[16]; +}; +struct physx_PxTempAllocator_Pod { + char structgen_pad0[1]; +}; +struct physx_PxLogTwo_Pod; +struct physx_PxUnConst_Pod; +struct physx_PxBitAndByte_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBitMap_Pod { + char structgen_pad0[16]; +}; +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_PxMat33_Pod { + physx_PxVec3_Pod column0; + physx_PxVec3_Pod column1; + physx_PxVec3_Pod column2; +}; +struct physx_PxBounds3_Pod { + physx_PxVec3_Pod minimum; + physx_PxVec3_Pod maximum; +}; +struct physx_PxErrorCallback_Pod { + void* vtable_; +}; +struct physx_PxAllocationListener_Pod { + void* vtable_; +}; +struct physx_PxBroadcastingAllocator_Pod { + char structgen_pad0[176]; +}; +struct physx_PxBroadcastingErrorCallback_Pod { + char structgen_pad0[160]; +}; +struct physx_PxHash_Pod; +struct physx_PxInputStream_Pod { + void* vtable_; +}; +struct physx_PxInputData_Pod { + void* vtable_; +}; +struct physx_PxOutputStream_Pod { + void* vtable_; +}; +struct physx_PxVec4_Pod { + float x; + float y; + float z; + float w; +}; +struct physx_PxMat44_Pod { + physx_PxVec4_Pod column0; + physx_PxVec4_Pod column1; + physx_PxVec4_Pod column2; + physx_PxVec4_Pod column3; +}; +struct physx_PxPlane_Pod { + physx_PxVec3_Pod n; + float d; +}; +struct physx_PxMutexImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxReadWriteLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxProfilerCallback_Pod { + void* vtable_; +}; +struct physx_PxProfileScoped_Pod { + physx_PxProfilerCallback_Pod* mCallback; + char const* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; + char structgen_pad0[7]; +}; +struct physx_PxSListEntry_Pod { + char structgen_pad0[16]; +}; +struct physx_PxSListImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSyncImpl_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRunnable_Pod { + void* vtable_; +}; +struct physx_PxCounterFrequencyToTensOfNanos_Pod { + uint64_t mNumerator; + uint64_t mDenominator; +}; +struct physx_PxTime_Pod { + char structgen_pad0[8]; +}; +struct physx_PxVec2_Pod { + float x; + float y; +}; +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_PxDebugPoint_Pod { + physx_PxVec3_Pod pos; + uint32_t color; +}; +struct physx_PxDebugLine_Pod { + physx_PxVec3_Pod pos0; + uint32_t color0; + physx_PxVec3_Pod pos1; + uint32_t color1; +}; +struct physx_PxDebugTriangle_Pod { + physx_PxVec3_Pod pos0; + uint32_t color0; + physx_PxVec3_Pod pos1; + uint32_t color1; + physx_PxVec3_Pod pos2; + uint32_t color2; +}; +struct physx_PxDebugText_Pod { + physx_PxVec3_Pod position; + float size; + uint32_t color; + char structgen_pad0[4]; + char const* string; +}; +struct physx_PxRenderBuffer_Pod { + void* vtable_; +}; +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_PxBase_Pod { + char structgen_pad0[16]; +}; +struct physx_PxRefCounted_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTolerancesScale_Pod { + float length; + float speed; +}; +struct physx_PxStringTable_Pod { + void* vtable_; +}; +struct physx_PxSerializer_Pod { + void* vtable_; +}; +struct physx_PxMetaDataEntry_Pod { + char const* type; + char const* name; + uint32_t offset; + uint32_t size; + uint32_t count; + uint32_t offsetSize; + uint32_t flags; + uint32_t alignment; +}; +struct physx_PxInsertionCallback_Pod { + void* vtable_; +}; +struct physx_PxBaseTask_Pod; +struct physx_PxTask_Pod; +struct physx_PxLightCpuTask_Pod; +struct physx_PxCpuDispatcher_Pod; +struct physx_PxTaskManager_Pod { + void* vtable_; +}; +struct physx_PxCpuDispatcher_Pod { + void* vtable_; +}; +struct physx_PxBaseTask_Pod { + char structgen_pad0[24]; +}; +struct physx_PxTask_Pod { + char structgen_pad0[32]; +}; +struct physx_PxLightCpuTask_Pod { + char structgen_pad0[40]; +}; +struct physx_PxGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxBoxGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + physx_PxVec3_Pod halfExtents; +}; +struct physx_PxBVHRaycastCallback_Pod { + void* vtable_; +}; +struct physx_PxBVHOverlapCallback_Pod { + void* vtable_; +}; +struct physx_PxBVHTraversalCallback_Pod { + void* vtable_; +}; +struct physx_PxBVH_Pod { + char structgen_pad0[16]; +}; +struct physx_PxGeomIndexPair_Pod; +struct physx_PxCapsuleGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + float radius; + float halfHeight; +}; +struct physx_PxHullPolygon_Pod { + float mPlane[4]; + uint16_t mNbVerts; + uint16_t mIndexBase; +}; +struct physx_PxConvexMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxMeshScale_Pod { + physx_PxVec3_Pod scale; + physx_PxQuat_Pod rotation; +}; +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_PxSphereGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; + float radius; +}; +struct physx_PxPlaneGeometry_Pod { + char structgen_pad0[4]; + float mTypePadding; +}; +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_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_PxGeometryQuery_Pod { + char structgen_pad0[1]; +}; +struct physx_PxHeightFieldSample_Pod { + int16_t height; + physx_PxBitAndByte_Pod materialIndex0; + physx_PxBitAndByte_Pod materialIndex1; +}; +struct physx_PxHeightFieldDesc_Pod; +struct physx_PxHeightField_Pod { + char structgen_pad0[16]; +}; +struct physx_PxHeightFieldDesc_Pod { + uint32_t nbRows; + uint32_t nbColumns; + int32_t format; + char structgen_pad0[4]; + physx_PxStridedData_Pod samples; + float convexEdgeThreshold; + uint16_t flags; + char structgen_pad1[2]; +}; +struct physx_PxTriangle_Pod; +struct physx_PxMeshQuery_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSimpleTriangleMesh_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod triangles; + uint16_t flags; + char structgen_pad0[6]; +}; +struct physx_PxTriangle_Pod { + physx_PxVec3_Pod verts[3]; +}; +struct physx_PxTrianglePadded_Pod { + physx_PxVec3_Pod verts[3]; + uint32_t padding; +}; +struct physx_PxTriangleMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxBVH34TriangleMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedron_Pod { + physx_PxVec3_Pod verts[4]; +}; +struct physx_PxSoftBodyAuxData_Pod { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedronMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxSoftBodyMesh_Pod { + char structgen_pad0[16]; +}; +struct physx_PxCollisionMeshMappingData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSoftBodyCollisionData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxTetrahedronMeshData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSoftBodySimulationData_Pod { + char structgen_pad0[1]; +}; +struct physx_PxCollisionTetrahedronMeshData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSimulationTetrahedronMeshData_Pod { + char structgen_pad0[8]; +}; +struct physx_PxScene_Pod; +struct physx_PxActor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxAggregate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpringModifiers_Pod { + float stiffness; + float damping; + char structgen_pad0[8]; +}; +struct physx_PxRestitutionModifiers_Pod { + float restitution; + float velocityThreshold; + char structgen_pad0[8]; +}; +union physx_Px1DConstraintMods_Pod { + physx_PxSpringModifiers_Pod spring; + physx_PxRestitutionModifiers_Pod bounce; +}; +struct physx_Px1DConstraint_Pod { + physx_PxVec3_Pod linear0; + float geometricError; + physx_PxVec3_Pod angular0; + float velocityTarget; + physx_PxVec3_Pod linear1; + float minImpulse; + physx_PxVec3_Pod angular1; + float maxImpulse; + physx_Px1DConstraintMods_Pod mods; + float forInternalUse; + uint16_t flags; + uint16_t solveHint; + char structgen_pad0[8]; +}; +struct physx_PxConstraintInvMassScale_Pod { + float linear0; + float angular0; + float linear1; + float angular1; +}; +struct physx_PxConstraintVisualizer_Pod { + void* vtable_; +}; +struct physx_PxConstraintConnector_Pod { + void* vtable_; +}; +struct physx_PxContactPoint_Pod { + physx_PxVec3_Pod normal; + float separation; + physx_PxVec3_Pod point; + float maxImpulse; + physx_PxVec3_Pod targetVel; + float staticFriction; + uint8_t materialFlags; + char structgen_pad0[3]; + uint32_t internalFaceIndex1; + float dynamicFriction; + float restitution; + float damping; + char structgen_pad1[12]; +}; +struct physx_PxTGSSolverBodyVel_Pod; +struct physx_PxSolverBody_Pod { + physx_PxVec3_Pod linearVelocity; + uint16_t maxSolverNormalProgress; + uint16_t maxSolverFrictionProgress; + physx_PxVec3_Pod angularState; + uint32_t solverProgress; +}; +struct physx_PxSolverBodyData_Pod { + physx_PxVec3_Pod linearVelocity; + float invMass; + physx_PxVec3_Pod angularVelocity; + float reportThreshold; + physx_PxMat33_Pod sqrtInvInertia; + float penBiasClamp; + uint32_t nodeIndex; + float maxContactImpulse; + physx_PxTransform_Pod body2World; + uint16_t pad; + char structgen_pad0[2]; +}; +struct physx_PxConstraintBatchHeader_Pod { + uint32_t startIndex; + uint16_t stride; + uint16_t constraintType; +}; +struct physx_PxSolverConstraintDesc_Pod { + char structgen_pad0[16]; + uint32_t bodyADataIndex; + uint32_t bodyBDataIndex; + uint32_t linkIndexA; + uint32_t linkIndexB; + uint8_t* constraint; + void* writeBack; + uint16_t progressA; + uint16_t progressB; + uint16_t constraintLengthOver16; + uint8_t padding[10]; +}; +struct physx_PxSolverConstraintPrepDescBase_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxSolverConstraintPrepDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + physx_Px1DConstraint_Pod* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad1[3]; + physx_PxVec3Padded_Pod body0WorldOffset; + char structgen_pad2[8]; +}; +struct physx_PxSolverContactDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxSolverBody_Pod const* body0; + physx_PxSolverBody_Pod const* body1; + physx_PxSolverBodyData_Pod const* data0; + physx_PxSolverBodyData_Pod const* data1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint_Pod* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float offsetSlop; + char structgen_pad2[12]; +}; +struct physx_PxConstraintAllocator_Pod { + void* vtable_; +}; +struct physx_PxArticulationLimit_Pod { + float low; + float high; +}; +struct physx_PxArticulationDrive_Pod { + float stiffness; + float damping; + float maxForce; + int32_t driveType; +}; +struct physx_PxTGSSolverBodyVel_Pod { + physx_PxVec3_Pod linearVelocity; + uint16_t nbStaticInteractions; + uint16_t maxDynamicPartition; + physx_PxVec3_Pod angularVelocity; + uint32_t partitionMask; + physx_PxVec3_Pod deltaAngDt; + float maxAngVel; + physx_PxVec3_Pod deltaLinDt; + uint16_t lockFlags; + bool isKinematic; + uint8_t pad; +}; +struct physx_PxTGSSolverBodyTxInertia_Pod { + physx_PxTransform_Pod deltaBody2World; + physx_PxMat33_Pod sqrtInvInertia; +}; +struct physx_PxTGSSolverBodyData_Pod { + physx_PxVec3_Pod originalLinearVelocity; + float maxContactImpulse; + physx_PxVec3_Pod originalAngularVelocity; + float penBiasClamp; + float invMass; + uint32_t nodeIndex; + float reportThreshold; + uint32_t pad; +}; +struct physx_PxTGSSolverConstraintPrepDescBase_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxTGSSolverConstraintPrepDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + physx_Px1DConstraint_Pod* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad0[3]; + physx_PxVec3Padded_Pod body0WorldOffset; + physx_PxVec3Padded_Pod cA2w; + physx_PxVec3Padded_Pod cB2w; +}; +struct physx_PxTGSSolverContactDesc_Pod { + physx_PxConstraintInvMassScale_Pod invMassScales; + physx_PxSolverConstraintDesc_Pod* desc; + physx_PxTGSSolverBodyVel_Pod const* body0; + physx_PxTGSSolverBodyVel_Pod const* body1; + physx_PxTGSSolverBodyTxInertia_Pod const* body0TxI; + physx_PxTGSSolverBodyTxInertia_Pod const* body1TxI; + physx_PxTGSSolverBodyData_Pod const* bodyData0; + physx_PxTGSSolverBodyData_Pod const* bodyData1; + physx_PxTransform_Pod bodyFrame0; + physx_PxTransform_Pod bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint_Pod* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float maxImpulse; + float torsionalPatchRadius; + float minTorsionalPatchRadius; + float offsetSlop; +}; +struct physx_PxArticulationSpatialTendon_Pod; +struct physx_PxArticulationFixedTendon_Pod; +struct physx_PxArticulationTendonLimit_Pod { + float lowLimit; + float highLimit; +}; +struct physx_PxArticulationAttachment_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendonJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationSpatialTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationFixedTendon_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpatialForce_Pod { + physx_PxVec3_Pod force; + float pad0; + physx_PxVec3_Pod torque; + float pad1; +}; +struct physx_PxSpatialVelocity_Pod { + physx_PxVec3_Pod linear; + float pad0; + physx_PxVec3_Pod angular; + float pad1; +}; +struct physx_PxArticulationRootLinkData_Pod { + physx_PxTransform_Pod transform; + physx_PxVec3_Pod worldLinVel; + physx_PxVec3_Pod worldAngVel; + physx_PxVec3_Pod worldLinAccel; + physx_PxVec3_Pod worldAngAccel; +}; +struct physx_PxArticulationCache_Pod { + physx_PxSpatialForce_Pod* externalForces; + float* denseJacobian; + float* massMatrix; + float* jointVelocity; + float* jointAcceleration; + float* jointPosition; + float* jointForce; + float* jointSolverForces; + physx_PxSpatialVelocity_Pod* linkVelocity; + physx_PxSpatialVelocity_Pod* linkAcceleration; + physx_PxArticulationRootLinkData_Pod* rootLinkData; + physx_PxSpatialForce_Pod* sensorForces; + float* coefficientMatrix; + float* lambda; + void* scratchMemory; + void* scratchAllocator; + uint32_t version; + char structgen_pad0[4]; +}; +struct physx_PxArticulationSensor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationReducedCoordinate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationJointReducedCoordinate_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData_Pod; +struct physx_PxBaseMaterial_Pod; +struct physx_PxShape_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidActor_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxNodeIndex_Pod { + char structgen_pad0[8]; +}; +struct physx_PxRigidBody_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationLink_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxConeLimitedConstraint_Pod { + physx_PxVec3_Pod mAxis; + float mAngle; + float mLowLimit; + float mHighLimit; +}; +struct physx_PxConeLimitParams_Pod { + physx_PxVec4_Pod lowHighLimits; + physx_PxVec4_Pod axisAngle; +}; +struct physx_PxConstraintShaderTable_Pod { + void * solverPrep; + char structgen_pad0[8]; + void * visualize; + int32_t flag; + char structgen_pad1[4]; +}; +struct physx_PxConstraint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxMassModificationProps_Pod { + float mInvMassScale0; + float mInvInertiaScale0; + float mInvMassScale1; + float mInvInertiaScale1; +}; +struct physx_PxContactPatch_Pod { + physx_PxMassModificationProps_Pod mMassModification; + physx_PxVec3_Pod normal; + float restitution; + float dynamicFriction; + float staticFriction; + float damping; + uint16_t startContactIndex; + uint8_t nbContacts; + uint8_t materialFlags; + uint16_t internalFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + uint16_t pad[5]; +}; +struct physx_PxContact_Pod { + physx_PxVec3_Pod contact; + float separation; +}; +struct physx_PxExtendedContact_Pod { + physx_PxVec3_Pod contact; + float separation; + physx_PxVec3_Pod targetVelocity; + float maxImpulse; +}; +struct physx_PxModifiableContact_Pod { + physx_PxVec3_Pod contact; + float separation; + physx_PxVec3_Pod targetVelocity; + float maxImpulse; + physx_PxVec3_Pod normal; + float restitution; + uint32_t materialFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + float staticFriction; + float dynamicFriction; +}; +struct physx_PxContactStreamIterator_Pod { + physx_PxVec3_Pod zero; + char structgen_pad0[4]; + physx_PxContactPatch_Pod const* patch; + physx_PxContact_Pod const* contact; + uint32_t const* faceIndice; + uint32_t totalPatches; + uint32_t totalContacts; + uint32_t nextContactIndex; + uint32_t nextPatchIndex; + uint32_t contactPatchHeaderSize; + uint32_t contactPointSize; + int32_t mStreamFormat; + uint32_t forceNoResponse; + bool pointStepped; + char structgen_pad1[3]; + uint32_t hasFaceIndices; +}; +struct physx_PxGpuContactPair_Pod { + uint8_t* contactPatches; + uint8_t* contactPoints; + float* contactForces; + uint32_t transformCacheRef0; + uint32_t transformCacheRef1; + physx_PxNodeIndex_Pod nodeIndex0; + physx_PxNodeIndex_Pod nodeIndex1; + physx_PxActor_Pod* actor0; + physx_PxActor_Pod* actor1; + uint16_t nbContacts; + uint16_t nbPatches; + char structgen_pad0[4]; +}; +struct physx_PxContactSet_Pod { + char structgen_pad0[16]; +}; +struct physx_PxContactModifyPair_Pod { + physx_PxRigidActor_Pod const* actor[2]; + physx_PxShape_Pod const* shape[2]; + physx_PxTransform_Pod transform[2]; + physx_PxContactSet_Pod contacts; +}; +struct physx_PxContactModifyCallback_Pod { + void* vtable_; +}; +struct physx_PxCCDContactModifyCallback_Pod { + void* vtable_; +}; +struct physx_PxDeletionListener_Pod { + void* vtable_; +}; +struct physx_PxBaseMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFEMMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData_Pod { + uint32_t word0; + uint32_t word1; + uint32_t word2; + uint32_t word3; +}; +struct physx_PxSimulationFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxParticleRigidFilterPair_Pod { + uint64_t mID0; + uint64_t mID1; +}; +struct physx_PxLockedData_Pod { + void* vtable_; +}; +struct physx_PxMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGpuParticleBufferIndexPair_Pod { + uint32_t systemIndex; + uint32_t bufferIndex; +}; +struct physx_PxCudaContextManager_Pod; +struct physx_PxParticleRigidAttachment_Pod; +struct physx_PxParticleVolume_Pod { + physx_PxBounds3_Pod bound; + uint32_t particleIndicesOffset; + uint32_t numParticles; +}; +struct physx_PxDiffuseParticleParams_Pod { + float threshold; + float lifetime; + float airDrag; + float bubbleDrag; + float buoyancy; + float kineticEnergyWeight; + float pressureWeight; + float divergenceWeight; + float collisionDecay; + bool useAccurateVelocity; + char structgen_pad0[3]; +}; +struct physx_PxParticleSpring_Pod { + uint32_t ind0; + uint32_t ind1; + float length; + float stiffness; + float damping; + float pad; +}; +struct physx_PxParticleMaterial_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneDesc_Pod; +struct physx_PxPvd_Pod; +struct physx_PxOmniPvd_Pod; +struct physx_PxPhysics_Pod { + void* vtable_; +}; +struct physx_PxActorShape_Pod { + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxRaycastHit_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; + char structgen_pad1[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxOverlapHit_Pod { + uint32_t faceIndex; + char structgen_pad0[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxSweepHit_Pod { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3_Pod position; + physx_PxVec3_Pod normal; + float distance; + char structgen_pad1[4]; + physx_PxRigidActor_Pod* actor; + physx_PxShape_Pod* shape; +}; +struct physx_PxRaycastCallback_Pod { + char structgen_pad0[8]; + physx_PxRaycastHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapCallback_Pod { + char structgen_pad0[8]; + physx_PxOverlapHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepCallback_Pod { + char structgen_pad0[8]; + physx_PxSweepHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxRaycastBuffer_Pod { + char structgen_pad0[8]; + physx_PxRaycastHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapBuffer_Pod { + char structgen_pad0[8]; + physx_PxOverlapHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepBuffer_Pod { + char structgen_pad0[8]; + physx_PxSweepHit_Pod block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit_Pod* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxQueryCache_Pod { + physx_PxShape_Pod* shape; + physx_PxRigidActor_Pod* actor; + uint32_t faceIndex; + char structgen_pad0[4]; +}; +struct physx_PxQueryFilterData_Pod { + physx_PxFilterData_Pod data; + uint16_t flags; + char structgen_pad0[2]; +}; +struct physx_PxQueryFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxRigidDynamic_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidStatic_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneQuerySystem_Pod; +struct physx_PxSceneQueryDesc_Pod { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; +}; +struct physx_PxSceneQuerySystemBase_Pod { + void* vtable_; +}; +struct physx_PxSceneSQSystem_Pod { + void* vtable_; +}; +struct physx_PxSceneQuerySystem_Pod { + void* vtable_; +}; +struct physx_PxBroadPhaseRegion_Pod { + physx_PxBounds3_Pod mBounds; + void* mUserData; +}; +struct physx_PxBroadPhaseRegionInfo_Pod { + physx_PxBroadPhaseRegion_Pod mRegion; + uint32_t mNbStaticObjects; + uint32_t mNbDynamicObjects; + bool mActive; + bool mOverlap; + char structgen_pad0[6]; +}; +struct physx_PxBroadPhaseCaps_Pod { + uint32_t mMaxNbRegions; +}; +struct physx_PxBroadPhaseDesc_Pod { + int32_t mType; + char structgen_pad0[4]; + uint64_t mContextID; + char structgen_pad1[8]; + uint32_t mFoundLostPairsCapacity; + bool mDiscardStaticVsKinematic; + bool mDiscardKinematicVsKinematic; + char structgen_pad2[2]; +}; +struct physx_PxBroadPhaseUpdateData_Pod { + uint32_t const* mCreated; + uint32_t mNbCreated; + char structgen_pad0[4]; + uint32_t const* mUpdated; + uint32_t mNbUpdated; + char structgen_pad1[4]; + uint32_t const* mRemoved; + uint32_t mNbRemoved; + char structgen_pad2[4]; + physx_PxBounds3_Pod const* mBounds; + uint32_t const* mGroups; + float const* mDistances; + uint32_t mCapacity; + char structgen_pad3[4]; +}; +struct physx_PxBroadPhasePair_Pod { + uint32_t mID0; + uint32_t mID1; +}; +struct physx_PxBroadPhaseResults_Pod { + uint32_t mNbCreatedPairs; + char structgen_pad0[4]; + physx_PxBroadPhasePair_Pod const* mCreatedPairs; + uint32_t mNbDeletedPairs; + char structgen_pad1[4]; + physx_PxBroadPhasePair_Pod const* mDeletedPairs; +}; +struct physx_PxBroadPhaseRegions_Pod { + void* vtable_; +}; +struct physx_PxBroadPhase_Pod { + void* vtable_; +}; +struct physx_PxAABBManager_Pod { + void* vtable_; +}; +struct physx_PxBroadPhaseCallback_Pod; +struct physx_PxSimulationEventCallback_Pod; +struct physx_PxSceneLimits_Pod { + uint32_t maxNbActors; + uint32_t maxNbBodies; + uint32_t maxNbStaticShapes; + uint32_t maxNbDynamicShapes; + uint32_t maxNbAggregates; + uint32_t maxNbConstraints; + uint32_t maxNbRegions; + uint32_t maxNbBroadPhaseOverlaps; +}; +struct physx_PxgDynamicsMemoryConfig_Pod { + uint32_t tempBufferCapacity; + uint32_t maxRigidContactCount; + uint32_t maxRigidPatchCount; + uint32_t heapCapacity; + uint32_t foundLostPairsCapacity; + uint32_t foundLostAggregatePairsCapacity; + uint32_t totalAggregatePairsCapacity; + uint32_t maxSoftBodyContacts; + uint32_t maxFemClothContacts; + uint32_t maxParticleContacts; + uint32_t collisionStackSize; + uint32_t maxHairContacts; +}; +struct physx_PxSceneDesc_Pod { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; + physx_PxVec3_Pod gravity; + physx_PxSimulationEventCallback_Pod* simulationEventCallback; + physx_PxContactModifyCallback_Pod* contactModifyCallback; + physx_PxCCDContactModifyCallback_Pod* ccdContactModifyCallback; + void const* filterShaderData; + uint32_t filterShaderDataSize; + char structgen_pad0[4]; + void * filterShader; + physx_PxSimulationFilterCallback_Pod* filterCallback; + int32_t kineKineFilteringMode; + int32_t staticKineFilteringMode; + int32_t broadPhaseType; + char structgen_pad1[4]; + physx_PxBroadPhaseCallback_Pod* broadPhaseCallback; + physx_PxSceneLimits_Pod limits; + int32_t frictionType; + int32_t solverType; + float bounceThresholdVelocity; + float frictionOffsetThreshold; + float frictionCorrelationDistance; + uint32_t flags; + physx_PxCpuDispatcher_Pod* cpuDispatcher; + char structgen_pad2[8]; + void* userData; + uint32_t solverBatchSize; + uint32_t solverArticulationBatchSize; + uint32_t nbContactDataBlocks; + uint32_t maxNbContactDataBlocks; + float maxBiasCoefficient; + uint32_t contactReportStreamBufferSize; + uint32_t ccdMaxPasses; + float ccdThreshold; + float ccdMaxSeparation; + float wakeCounterResetValue; + physx_PxBounds3_Pod sanityBounds; + physx_PxgDynamicsMemoryConfig_Pod gpuDynamicsConfig; + uint32_t gpuMaxNumPartitions; + uint32_t gpuMaxNumStaticPartitions; + uint32_t gpuComputeVersion; + uint32_t contactPairSlabSize; + physx_PxSceneQuerySystem_Pod* sceneQuerySystem; + char structgen_pad3[8]; +}; +struct physx_PxSimulationStatistics_Pod { + uint32_t nbActiveConstraints; + uint32_t nbActiveDynamicBodies; + uint32_t nbActiveKinematicBodies; + uint32_t nbStaticBodies; + uint32_t nbDynamicBodies; + uint32_t nbKinematicBodies; + uint32_t nbShapes[11]; + uint32_t nbAggregates; + uint32_t nbArticulations; + uint32_t nbAxisSolverConstraints; + uint32_t compressedContactSize; + uint32_t requiredContactConstraintMemory; + uint32_t peakConstraintMemory; + uint32_t nbDiscreteContactPairsTotal; + uint32_t nbDiscreteContactPairsWithCacheHits; + uint32_t nbDiscreteContactPairsWithContacts; + uint32_t nbNewPairs; + uint32_t nbLostPairs; + uint32_t nbNewTouches; + uint32_t nbLostTouches; + uint32_t nbPartitions; + char structgen_pad0[4]; + uint64_t gpuMemParticles; + uint64_t gpuMemSoftBodies; + uint64_t gpuMemFEMCloths; + uint64_t gpuMemHairSystems; + uint64_t gpuMemHeap; + uint64_t gpuMemHeapBroadPhase; + uint64_t gpuMemHeapNarrowPhase; + uint64_t gpuMemHeapSolver; + uint64_t gpuMemHeapArticulation; + uint64_t gpuMemHeapSimulation; + uint64_t gpuMemHeapSimulationArticulation; + uint64_t gpuMemHeapSimulationParticles; + uint64_t gpuMemHeapSimulationSoftBody; + uint64_t gpuMemHeapSimulationFEMCloth; + uint64_t gpuMemHeapSimulationHairSystem; + uint64_t gpuMemHeapParticles; + uint64_t gpuMemHeapSoftBodies; + uint64_t gpuMemHeapFEMCloths; + uint64_t gpuMemHeapHairSystems; + uint64_t gpuMemHeapOther; + uint32_t nbBroadPhaseAdds; + uint32_t nbBroadPhaseRemoves; + uint32_t nbDiscreteContactPairs[11][11]; + uint32_t nbCCDPairs[11][11]; + uint32_t nbModifiedContactPairs[11][11]; + uint32_t nbTriggerPairs[11][11]; +}; +struct physx_PxGpuBodyData_Pod { + physx_PxQuat_Pod quat; + physx_PxVec4_Pod pos; + physx_PxVec4_Pod linVel; + physx_PxVec4_Pod angVel; +}; +struct physx_PxGpuActorPair_Pod { + uint32_t srcIndex; + char structgen_pad0[4]; + physx_PxNodeIndex_Pod nodeIndex; +}; +struct physx_PxIndexDataPair_Pod { + uint32_t index; + char structgen_pad0[4]; + void* data; +}; +struct physx_PxPvdSceneClient_Pod { + void* vtable_; +}; +struct physx_PxContactPairHeader_Pod; +struct physx_PxDominanceGroupPair_Pod { + uint8_t dominance0; + uint8_t dominance1; +}; +struct physx_PxBroadPhaseCallback_Pod { + void* vtable_; +}; +struct physx_PxScene_Pod { + char structgen_pad0[8]; + void* userData; +}; +struct physx_PxSceneReadLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxSceneWriteLock_Pod { + char structgen_pad0[8]; +}; +struct physx_PxContactPairExtraDataItem_Pod { + uint8_t type; +}; +struct physx_PxContactPairVelocity_Pod { + uint8_t type; + char structgen_pad0[3]; + physx_PxVec3_Pod linearVelocity[2]; + physx_PxVec3_Pod angularVelocity[2]; +}; +struct physx_PxContactPairPose_Pod { + uint8_t type; + char structgen_pad0[3]; + physx_PxTransform_Pod globalPose[2]; +}; +struct physx_PxContactPairIndex_Pod { + uint8_t type; + char structgen_pad0[1]; + uint16_t index; +}; +struct physx_PxContactPairExtraDataIterator_Pod { + uint8_t const* currPtr; + uint8_t const* endPtr; + physx_PxContactPairVelocity_Pod const* preSolverVelocity; + physx_PxContactPairVelocity_Pod const* postSolverVelocity; + physx_PxContactPairPose_Pod const* eventPose; + uint32_t contactPairIndex; + char structgen_pad0[4]; +}; +struct physx_PxContactPair_Pod; +struct physx_PxContactPairHeader_Pod { + physx_PxActor_Pod* actors[2]; + uint8_t const* extraDataStream; + uint16_t extraDataStreamSize; + uint16_t flags; + char structgen_pad0[4]; + physx_PxContactPair_Pod const* pairs; + uint32_t nbPairs; + char structgen_pad1[4]; +}; +struct physx_PxContactPairPoint_Pod { + physx_PxVec3_Pod position; + float separation; + physx_PxVec3_Pod normal; + uint32_t internalFaceIndex0; + physx_PxVec3_Pod impulse; + uint32_t internalFaceIndex1; +}; +struct physx_PxContactPair_Pod { + physx_PxShape_Pod* shapes[2]; + uint8_t const* contactPatches; + uint8_t const* contactPoints; + float const* contactImpulses; + uint32_t requiredBufferSize; + uint8_t contactCount; + uint8_t patchCount; + uint16_t contactStreamSize; + uint16_t flags; + uint16_t events; + uint32_t internalData[2]; + char structgen_pad0[4]; +}; +struct physx_PxTriggerPair_Pod { + physx_PxShape_Pod* triggerShape; + physx_PxActor_Pod* triggerActor; + physx_PxShape_Pod* otherShape; + physx_PxActor_Pod* otherActor; + int32_t status; + uint8_t flags; + char structgen_pad0[3]; +}; +struct physx_PxConstraintInfo_Pod { + physx_PxConstraint_Pod* constraint; + void* externalReference; + uint32_t type; + char structgen_pad0[4]; +}; +struct physx_PxSimulationEventCallback_Pod { + void* vtable_; +}; +struct physx_PxFEMParameters_Pod { + float velocityDamping; + float settlingThreshold; + float sleepThreshold; + float sleepDamping; + float selfCollisionFilterDistance; + float selfCollisionStressTolerance; +}; +struct physx_PxPruningStructure_Pod { + char structgen_pad0[16]; +}; +struct physx_PxExtendedVec3_Pod { + double x; + double y; + double z; +}; +struct physx_PxControllerManager_Pod; +struct physx_PxObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; +}; +struct physx_PxBoxObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; + physx_PxVec3_Pod mHalfExtents; + char structgen_pad1[4]; +}; +struct physx_PxCapsuleObstacle_Pod { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3_Pod mPos; + physx_PxQuat_Pod mRot; + float mHalfHeight; + float mRadius; +}; +struct physx_PxObstacleContext_Pod { + void* vtable_; +}; +struct physx_PxController_Pod; +struct physx_PxControllerBehaviorCallback_Pod; +struct physx_PxControllerState_Pod { + physx_PxVec3_Pod deltaXP; + char structgen_pad0[4]; + physx_PxShape_Pod* touchedShape; + physx_PxRigidActor_Pod* touchedActor; + uint32_t touchedObstacleHandle; + uint32_t collisionFlags; + bool standOnAnotherCCT; + bool standOnObstacle; + bool isMovingUp; + char structgen_pad1[5]; +}; +struct physx_PxControllerStats_Pod { + uint16_t nbIterations; + uint16_t nbFullUpdates; + uint16_t nbPartialUpdates; + uint16_t nbTessellation; +}; +struct physx_PxControllerHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; +}; +struct physx_PxControllerShapeHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + physx_PxShape_Pod* shape; + physx_PxRigidActor_Pod* actor; + uint32_t triangleIndex; + char structgen_pad1[4]; +}; +struct physx_PxControllersHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + physx_PxController_Pod* other; +}; +struct physx_PxControllerObstacleHit_Pod { + physx_PxController_Pod* controller; + physx_PxExtendedVec3_Pod worldPos; + physx_PxVec3_Pod worldNormal; + physx_PxVec3_Pod dir; + float length; + char structgen_pad0[4]; + void const* userData; +}; +struct physx_PxUserControllerHitReport_Pod { + void* vtable_; +}; +struct physx_PxControllerFilterCallback_Pod { + void* vtable_; +}; +struct physx_PxControllerFilters_Pod { + physx_PxFilterData_Pod const* mFilterData; + physx_PxQueryFilterCallback_Pod* mFilterCallback; + uint16_t mFilterFlags; + char structgen_pad0[6]; + physx_PxControllerFilterCallback_Pod* mCCTFilterCallback; +}; +struct physx_PxControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; +}; +struct physx_PxController_Pod { + void* vtable_; +}; +struct physx_PxBoxControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float halfHeight; + float halfSideExtent; + float halfForwardExtent; +}; +struct physx_PxBoxController_Pod { + void* vtable_; +}; +struct physx_PxCapsuleControllerDesc_Pod { + char structgen_pad0[8]; + physx_PxExtendedVec3_Pod position; + physx_PxVec3_Pod upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport_Pod* reportCallback; + physx_PxControllerBehaviorCallback_Pod* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial_Pod* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float radius; + float height; + int32_t climbingMode; +}; +struct physx_PxCapsuleController_Pod { + void* vtable_; +}; +struct physx_PxControllerBehaviorCallback_Pod { + void* vtable_; +}; +struct physx_PxControllerManager_Pod { + void* vtable_; +}; +struct physx_PxDim3_Pod { + uint32_t x; + uint32_t y; + uint32_t z; +}; +struct physx_PxSDFDesc_Pod { + physx_PxBoundedData_Pod sdf; + physx_PxDim3_Pod dims; + physx_PxVec3_Pod meshLower; + float spacing; + uint32_t subgridSize; + int32_t bitsPerSubgridPixel; + physx_PxDim3_Pod sdfSubgrids3DTexBlockDim; + physx_PxBoundedData_Pod sdfSubgrids; + physx_PxBoundedData_Pod sdfStartSlots; + float subgridsMinSdfValue; + float subgridsMaxSdfValue; + physx_PxBounds3_Pod sdfBounds; + float narrowBandThicknessRelativeToSdfBoundsDiagonal; + uint32_t numThreadsForSdfConstruction; +}; +struct physx_PxConvexMeshDesc_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod polygons; + physx_PxBoundedData_Pod indices; + uint16_t flags; + uint16_t vertexLimit; + uint16_t polygonLimit; + uint16_t quantizedCount; + physx_PxSDFDesc_Pod* sdfDesc; +}; +struct physx_PxTriangleMeshDesc_Pod { + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod triangles; + uint16_t flags; + char structgen_pad0[22]; + physx_PxSDFDesc_Pod* sdfDesc; +}; +struct physx_PxTetrahedronMeshDesc_Pod { + char structgen_pad0[16]; + physx_PxBoundedData_Pod points; + physx_PxBoundedData_Pod tetrahedrons; + uint16_t flags; + uint16_t tetsPerElement; + char structgen_pad1[4]; +}; +struct physx_PxSoftBodySimulationDataDesc_Pod { + physx_PxBoundedData_Pod vertexToTet; +}; +struct physx_PxBVH34MidphaseDesc_Pod { + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + bool quantized; + char structgen_pad0[3]; +}; +struct physx_PxMidphaseDesc_Pod { + char structgen_pad0[16]; +}; +struct physx_PxBVHDesc_Pod { + physx_PxBoundedData_Pod bounds; + float enlargement; + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + char structgen_pad0[4]; +}; +struct physx_PxCookingParams_Pod { + float areaTestEpsilon; + float planeTolerance; + int32_t convexMeshCookingType; + bool suppressTriangleMeshRemapTable; + bool buildTriangleAdjacencies; + bool buildGPUData; + char structgen_pad0[1]; + physx_PxTolerancesScale_Pod scale; + uint32_t meshPreprocessParams; + float meshWeldTolerance; + physx_PxMidphaseDesc_Pod midphaseDesc; + uint32_t gaussMapLimit; + float maxWeightRatioInTet; +}; +struct physx_PxDefaultMemoryOutputStream_Pod { + char structgen_pad0[32]; +}; +struct physx_PxDefaultMemoryInputData_Pod { + char structgen_pad0[32]; +}; +struct physx_PxDefaultFileOutputStream_Pod { + char structgen_pad0[16]; +}; +struct physx_PxDefaultFileInputData_Pod { + char structgen_pad0[24]; +}; +struct physx_PxDefaultAllocator_Pod { + void* vtable_; +}; +struct physx_PxJoint_Pod; +struct physx_PxRackAndPinionJoint_Pod; +struct physx_PxGearJoint_Pod; +struct physx_PxD6Joint_Pod; +struct physx_PxDistanceJoint_Pod; +struct physx_PxContactJoint_Pod; +struct physx_PxFixedJoint_Pod; +struct physx_PxPrismaticJoint_Pod; +struct physx_PxRevoluteJoint_Pod; +struct physx_PxSphericalJoint_Pod; +struct physx_PxJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpring_Pod { + float stiffness; + float damping; +}; +struct physx_PxDistanceJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJacobianRow_Pod { + physx_PxVec3_Pod linear0; + physx_PxVec3_Pod linear1; + physx_PxVec3_Pod angular0; + physx_PxVec3_Pod angular1; +}; +struct physx_PxContactJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFixedJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJointLimitParameters_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; +}; +struct physx_PxJointLinearLimit_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float value; +}; +struct physx_PxJointLinearLimitPair_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointAngularLimitPair_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointLimitCone_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngle; + float zAngle; +}; +struct physx_PxJointLimitPyramid_Pod { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngleMin; + float yAngleMax; + float zAngleMin; + float zAngleMax; +}; +struct physx_PxPrismaticJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRevoluteJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSphericalJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxD6JointDrive_Pod { + float stiffness; + float damping; + float forceLimit; + uint32_t flags; +}; +struct physx_PxD6Joint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGearJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRackAndPinionJoint_Pod { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGroupsMask_Pod { + uint16_t bits0; + uint16_t bits1; + uint16_t bits2; + uint16_t bits3; +}; +struct physx_PxDefaultErrorCallback_Pod { + void* vtable_; +}; +struct physx_PxRigidActorExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxMassProperties_Pod { + physx_PxMat33_Pod inertiaTensor; + physx_PxVec3_Pod centerOfMass; + float mass; +}; +struct physx_PxRigidBodyExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxShapeExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxMeshOverlapUtil_Pod { + char structgen_pad0[1040]; +}; +struct physx_PxBinaryConverter_Pod; +struct physx_PxXmlMiscParameter_Pod { + physx_PxVec3_Pod upVector; + physx_PxTolerancesScale_Pod scale; +}; +struct physx_PxSerialization_Pod { + char structgen_pad0[1]; +}; +struct physx_PxDefaultCpuDispatcher_Pod { + void* vtable_; +}; +struct physx_PxStringTableExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBroadPhaseExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxSceneQueryExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxBatchQueryExt_Pod { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystem_Pod { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystemAdapter_Pod { + void* vtable_; +}; +struct physx_PxSamplingExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxPoissonSampler_Pod { + char structgen_pad0[8]; +}; +struct physx_PxTriangleMeshPoissonSampler_Pod { + char structgen_pad0[8]; +}; +struct physx_PxTetrahedronMeshExt_Pod { + char structgen_pad0[1]; +}; +struct physx_PxRepXObject_Pod { + char const* typeName; + void const* serializable; + uint64_t id; +}; +struct physx_PxCooking_Pod; +struct physx_PxRepXInstantiationArgs_Pod { + char structgen_pad0[8]; + physx_PxCooking_Pod* cooker; + physx_PxStringTable_Pod* stringTable; +}; +struct physx_PxRepXSerializer_Pod { + void* vtable_; +}; +struct physx_PxVehicleWheels4SimData_Pod; +struct physx_PxVehicleWheels4DynData_Pod; +struct physx_PxVehicleTireForceCalculator_Pod; +struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs_Pod; +struct physx_PxVehicleTelemetryData_Pod; +struct physx_PxPvdTransport_Pod; +struct physx_PxPvd_Pod { + void* vtable_; +}; +struct physx_PxPvdTransport_Pod { + void* vtable_; +}; + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-3.snap new file mode 100644 index 0000000..39d0336 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things-3.snap @@ -0,0 +1,2552 @@ +--- +source: physx-sys/pxbind/tests/structgen.rs +expression: generated.rust +--- +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRawAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxVirtualAllocator { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxUserAllocated { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTempAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBitAndByte { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBitMap { + pub structgen_pad0: [u8; 16], +} +#[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 PxMat33 { + pub column0: PxVec3, + pub column1: PxVec3, + pub column2: PxVec3, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBounds3 { + pub minimum: PxVec3, + pub maximum: PxVec3, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadcastingAllocator { + pub structgen_pad0: [u8; 176], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadcastingErrorCallback { + pub structgen_pad0: [u8; 160], +} +#[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 PxMat44 { + pub column0: PxVec4, + pub column1: PxVec4, + pub column2: PxVec4, + pub column3: PxVec4, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxPlane { + pub n: PxVec3, + pub d: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMutexImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxReadWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxProfileScoped { + pub mCallback: *mut PxProfilerCallback, + pub mEventName: *const std::ffi::c_char, + pub mProfilerData: *mut std::ffi::c_void, + pub mContextId: u64, + pub mDetached: bool, + pub structgen_pad0: [u8; 7], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSListEntry { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSListImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSyncImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCounterFrequencyToTensOfNanos { + pub mNumerator: u64, + pub mDenominator: u64, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTime { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxVec2 { + pub x: f32, + pub y: f32, +} +#[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 PxDebugPoint { + pub pos: PxVec3, + pub color: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDebugLine { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDebugTriangle { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, + pub pos2: PxVec3, + pub color2: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDebugText { + pub position: PxVec3, + pub size: f32, + pub color: u32, + pub structgen_pad0: [u8; 4], + pub string: *const std::ffi::c_char, +} +#[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 PxTolerancesScale { + pub length: f32, + pub speed: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMetaDataEntry { + pub type_: *const std::ffi::c_char, + pub name: *const std::ffi::c_char, + pub offset: u32, + pub size: u32, + pub count: u32, + pub offsetSize: u32, + pub flags: u32, + pub alignment: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBaseTask { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTask { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxLightCpuTask { + pub structgen_pad0: [u8; 40], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: 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 PxBVH { + pub structgen_pad0: [u8; 16], +} +#[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 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 PxMeshScale { + pub scale: PxVec3, + pub rotation: PxQuat, +} +#[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 PxSphereGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub radius: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxPlaneGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[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 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 PxGeometryQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxHeightFieldSample { + pub height: i16, + pub materialIndex0: PxBitAndByte, + pub materialIndex1: PxBitAndByte, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxHeightField { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxHeightFieldDesc { + pub nbRows: u32, + pub nbColumns: u32, + pub format: PxHeightFieldFormat, + pub structgen_pad0: [u8; 4], + pub samples: PxStridedData, + pub convexEdgeThreshold: f32, + pub flags: PxHeightFieldFlags, + pub structgen_pad1: [u8; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMeshQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSimpleTriangleMesh { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTriangle { + pub verts: [PxVec3; 3], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTrianglePadded { + pub verts: [PxVec3; 3], + pub padding: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBVH34TriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTetrahedron { + pub verts: [PxVec3; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSoftBodyAuxData { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTetrahedronMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSoftBodyMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCollisionMeshMappingData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSoftBodyCollisionData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTetrahedronMeshData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSoftBodySimulationData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCollisionTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSimulationTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxAggregate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSpringModifiers { + pub stiffness: f32, + pub damping: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRestitutionModifiers { + pub restitution: f32, + pub velocityThreshold: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct Px1DConstraint { + pub linear0: PxVec3, + pub geometricError: f32, + pub angular0: PxVec3, + pub velocityTarget: f32, + pub linear1: PxVec3, + pub minImpulse: f32, + pub angular1: PxVec3, + pub maxImpulse: f32, + pub mods: Px1DConstraintMods, + pub forInternalUse: f32, + pub flags: u16, + pub solveHint: u16, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConstraintInvMassScale { + pub linear0: f32, + pub angular0: f32, + pub linear1: f32, + pub angular1: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPoint { + pub normal: PxVec3, + pub separation: f32, + pub point: PxVec3, + pub maxImpulse: f32, + pub targetVel: PxVec3, + pub staticFriction: f32, + pub materialFlags: u8, + pub structgen_pad0: [u8; 3], + pub internalFaceIndex1: u32, + pub dynamicFriction: f32, + pub restitution: f32, + pub damping: f32, + pub structgen_pad1: [u8; 12], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverBody { + pub linearVelocity: PxVec3, + pub maxSolverNormalProgress: u16, + pub maxSolverFrictionProgress: u16, + pub angularState: PxVec3, + pub solverProgress: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverBodyData { + pub linearVelocity: PxVec3, + pub invMass: f32, + pub angularVelocity: PxVec3, + pub reportThreshold: f32, + pub sqrtInvInertia: PxMat33, + pub penBiasClamp: f32, + pub nodeIndex: u32, + pub maxContactImpulse: f32, + pub body2World: PxTransform, + pub pad: u16, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConstraintBatchHeader { + pub startIndex: u32, + pub stride: u16, + pub constraintType: u16, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverConstraintDesc { + pub structgen_pad0: [u8; 16], + pub bodyADataIndex: u32, + pub bodyBDataIndex: u32, + pub linkIndexA: u32, + pub linkIndexB: u32, + pub constraint: *mut u8, + pub writeBack: *mut std::ffi::c_void, + pub progressA: u16, + pub progressB: u16, + pub constraintLengthOver16: u16, + pub padding: [u8; 10], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad1: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub structgen_pad2: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad0: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad1: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub offsetSlop: f32, + pub structgen_pad2: [u8; 12], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationLimit { + pub low: f32, + pub high: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationDrive { + pub stiffness: f32, + pub damping: f32, + pub maxForce: f32, + pub driveType: PxArticulationDriveType, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverBodyVel { + pub linearVelocity: PxVec3, + pub nbStaticInteractions: u16, + pub maxDynamicPartition: u16, + pub angularVelocity: PxVec3, + pub partitionMask: u32, + pub deltaAngDt: PxVec3, + pub maxAngVel: f32, + pub deltaLinDt: PxVec3, + pub lockFlags: u16, + pub isKinematic: bool, + pub pad: u8, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverBodyTxInertia { + pub deltaBody2World: PxTransform, + pub sqrtInvInertia: PxMat33, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverBodyData { + pub originalLinearVelocity: PxVec3, + pub maxContactImpulse: f32, + pub originalAngularVelocity: PxVec3, + pub penBiasClamp: f32, + pub invMass: f32, + pub nodeIndex: u32, + pub reportThreshold: f32, + pub pad: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad0: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub cA2w: PxVec3Padded, + pub cB2w: PxVec3Padded, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTGSSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad0: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad1: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub maxImpulse: f32, + pub torsionalPatchRadius: f32, + pub minTorsionalPatchRadius: f32, + pub offsetSlop: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationTendonLimit { + pub lowLimit: f32, + pub highLimit: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationAttachment { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationTendonJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationSpatialTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationFixedTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSpatialForce { + pub force: PxVec3, + pub pad0: f32, + pub torque: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSpatialVelocity { + pub linear: PxVec3, + pub pad0: f32, + pub angular: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationRootLinkData { + pub transform: PxTransform, + pub worldLinVel: PxVec3, + pub worldAngVel: PxVec3, + pub worldLinAccel: PxVec3, + pub worldAngAccel: PxVec3, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationCache { + pub externalForces: *mut PxSpatialForce, + pub denseJacobian: *mut f32, + pub massMatrix: *mut f32, + pub jointVelocity: *mut f32, + pub jointAcceleration: *mut f32, + pub jointPosition: *mut f32, + pub jointForce: *mut f32, + pub jointSolverForces: *mut f32, + pub linkVelocity: *mut PxSpatialVelocity, + pub linkAcceleration: *mut PxSpatialVelocity, + pub rootLinkData: *mut PxArticulationRootLinkData, + pub sensorForces: *mut PxSpatialForce, + pub coefficientMatrix: *mut f32, + pub lambda: *mut f32, + pub scratchMemory: *mut std::ffi::c_void, + pub scratchAllocator: *mut std::ffi::c_void, + pub version: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationSensor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationJointReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxShape { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxNodeIndex { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidBody { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxArticulationLink { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConeLimitedConstraint { + pub mAxis: PxVec3, + pub mAngle: f32, + pub mLowLimit: f32, + pub mHighLimit: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConeLimitParams { + pub lowHighLimits: PxVec4, + pub axisAngle: PxVec4, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConstraintShaderTable { + pub solverPrep: *mut std::ffi::c_void, + pub structgen_pad0: [u8; 8], + pub visualize: *mut std::ffi::c_void, + pub flag: PxConstraintFlag, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConstraint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMassModificationProps { + pub mInvMassScale0: f32, + pub mInvInertiaScale0: f32, + pub mInvMassScale1: f32, + pub mInvInertiaScale1: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPatch { + pub mMassModification: PxMassModificationProps, + pub normal: PxVec3, + pub restitution: f32, + pub dynamicFriction: f32, + pub staticFriction: f32, + pub damping: f32, + pub startContactIndex: u16, + pub nbContacts: u8, + pub materialFlags: u8, + pub internalFlags: u16, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub pad: [u16; 5], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContact { + pub contact: PxVec3, + pub separation: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxExtendedContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxModifiableContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, + pub normal: PxVec3, + pub restitution: f32, + pub materialFlags: u32, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub staticFriction: f32, + pub dynamicFriction: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactStreamIterator { + pub zero: PxVec3, + pub structgen_pad0: [u8; 4], + pub patch: *const PxContactPatch, + pub contact: *const PxContact, + pub faceIndice: *const u32, + pub totalPatches: u32, + pub totalContacts: u32, + pub nextContactIndex: u32, + pub nextPatchIndex: u32, + pub contactPatchHeaderSize: u32, + pub contactPointSize: u32, + pub mStreamFormat: StreamFormat, + pub forceNoResponse: u32, + pub pointStepped: bool, + pub structgen_pad1: [u8; 3], + pub hasFaceIndices: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGpuContactPair { + pub contactPatches: *mut u8, + pub contactPoints: *mut u8, + pub contactForces: *mut f32, + pub transformCacheRef0: u32, + pub transformCacheRef1: u32, + pub nodeIndex0: PxNodeIndex, + pub nodeIndex1: PxNodeIndex, + pub actor0: *mut PxActor, + pub actor1: *mut PxActor, + pub nbContacts: u16, + pub nbPatches: u16, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactSet { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactModifyPair { + pub actor: [*const PxRigidActor; 2], + pub shape: [*const PxShape; 2], + pub transform: [PxTransform; 2], + pub contacts: PxContactSet, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBaseMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxFEMMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxFilterData { + pub word0: u32, + pub word1: u32, + pub word2: u32, + pub word3: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxParticleRigidFilterPair { + pub mID0: u64, + pub mID1: u64, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGpuParticleBufferIndexPair { + pub systemIndex: u32, + pub bufferIndex: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxParticleVolume { + pub bound: PxBounds3, + pub particleIndicesOffset: u32, + pub numParticles: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDiffuseParticleParams { + pub threshold: f32, + pub lifetime: f32, + pub airDrag: f32, + pub bubbleDrag: f32, + pub buoyancy: f32, + pub kineticEnergyWeight: f32, + pub pressureWeight: f32, + pub divergenceWeight: f32, + pub collisionDecay: f32, + pub useAccurateVelocity: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxParticleSpring { + pub ind0: u32, + pub ind1: u32, + pub length: f32, + pub stiffness: f32, + pub damping: f32, + pub pad: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxParticleMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxActorShape { + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRaycastHit { + 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, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxOverlapHit { + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSweepHit { + pub faceIndex: u32, + pub flags: PxHitFlags, + pub structgen_pad0: [u8; 2], + pub position: PxVec3, + pub normal: PxVec3, + pub distance: f32, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRaycastCallback { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxOverlapCallback { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSweepCallback { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRaycastBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxOverlapBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSweepBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxQueryCache { + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxQueryFilterData { + pub data: PxFilterData, + pub flags: PxQueryFlags, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidDynamic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidStatic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneQueryDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseRegion { + pub mBounds: PxBounds3, + pub mUserData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseRegionInfo { + pub mRegion: PxBroadPhaseRegion, + pub mNbStaticObjects: u32, + pub mNbDynamicObjects: u32, + pub mActive: bool, + pub mOverlap: bool, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseCaps { + pub mMaxNbRegions: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseDesc { + pub mType: PxBroadPhaseType, + pub structgen_pad0: [u8; 4], + pub mContextID: u64, + pub structgen_pad1: [u8; 8], + pub mFoundLostPairsCapacity: u32, + pub mDiscardStaticVsKinematic: bool, + pub mDiscardKinematicVsKinematic: bool, + pub structgen_pad2: [u8; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseUpdateData { + pub mCreated: *const u32, + pub mNbCreated: u32, + pub structgen_pad0: [u8; 4], + pub mUpdated: *const u32, + pub mNbUpdated: u32, + pub structgen_pad1: [u8; 4], + pub mRemoved: *const u32, + pub mNbRemoved: u32, + pub structgen_pad2: [u8; 4], + pub mBounds: *const PxBounds3, + pub mGroups: *const u32, + pub mDistances: *const f32, + pub mCapacity: u32, + pub structgen_pad3: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhasePair { + pub mID0: u32, + pub mID1: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseResults { + pub mNbCreatedPairs: u32, + pub structgen_pad0: [u8; 4], + pub mCreatedPairs: *const PxBroadPhasePair, + pub mNbDeletedPairs: u32, + pub structgen_pad1: [u8; 4], + pub mDeletedPairs: *const PxBroadPhasePair, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneLimits { + pub maxNbActors: u32, + pub maxNbBodies: u32, + pub maxNbStaticShapes: u32, + pub maxNbDynamicShapes: u32, + pub maxNbAggregates: u32, + pub maxNbConstraints: u32, + pub maxNbRegions: u32, + pub maxNbBroadPhaseOverlaps: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxgDynamicsMemoryConfig { + pub tempBufferCapacity: u32, + pub maxRigidContactCount: u32, + pub maxRigidPatchCount: u32, + pub heapCapacity: u32, + pub foundLostPairsCapacity: u32, + pub foundLostAggregatePairsCapacity: u32, + pub totalAggregatePairsCapacity: u32, + pub maxSoftBodyContacts: u32, + pub maxFemClothContacts: u32, + pub maxParticleContacts: u32, + pub collisionStackSize: u32, + pub maxHairContacts: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, + pub gravity: PxVec3, + pub simulationEventCallback: *mut PxSimulationEventCallback, + pub contactModifyCallback: *mut PxContactModifyCallback, + pub ccdContactModifyCallback: *mut PxCCDContactModifyCallback, + pub filterShaderData: *const std::ffi::c_void, + pub filterShaderDataSize: u32, + pub structgen_pad0: [u8; 4], + pub filterShader: *mut std::ffi::c_void, + pub filterCallback: *mut PxSimulationFilterCallback, + pub kineKineFilteringMode: PxPairFilteringMode, + pub staticKineFilteringMode: PxPairFilteringMode, + pub broadPhaseType: PxBroadPhaseType, + pub structgen_pad1: [u8; 4], + pub broadPhaseCallback: *mut PxBroadPhaseCallback, + pub limits: PxSceneLimits, + pub frictionType: PxFrictionType, + pub solverType: PxSolverType, + pub bounceThresholdVelocity: f32, + pub frictionOffsetThreshold: f32, + pub frictionCorrelationDistance: f32, + pub flags: PxSceneFlags, + pub cpuDispatcher: *mut PxCpuDispatcher, + pub structgen_pad2: [u8; 8], + pub userData: *mut std::ffi::c_void, + pub solverBatchSize: u32, + pub solverArticulationBatchSize: u32, + pub nbContactDataBlocks: u32, + pub maxNbContactDataBlocks: u32, + pub maxBiasCoefficient: f32, + pub contactReportStreamBufferSize: u32, + pub ccdMaxPasses: u32, + pub ccdThreshold: f32, + pub ccdMaxSeparation: f32, + pub wakeCounterResetValue: f32, + pub sanityBounds: PxBounds3, + pub gpuDynamicsConfig: PxgDynamicsMemoryConfig, + pub gpuMaxNumPartitions: u32, + pub gpuMaxNumStaticPartitions: u32, + pub gpuComputeVersion: u32, + pub contactPairSlabSize: u32, + pub sceneQuerySystem: *mut PxSceneQuerySystem, + pub structgen_pad3: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSimulationStatistics { + pub nbActiveConstraints: u32, + pub nbActiveDynamicBodies: u32, + pub nbActiveKinematicBodies: u32, + pub nbStaticBodies: u32, + pub nbDynamicBodies: u32, + pub nbKinematicBodies: u32, + pub nbShapes: [u32; 11], + pub nbAggregates: u32, + pub nbArticulations: u32, + pub nbAxisSolverConstraints: u32, + pub compressedContactSize: u32, + pub requiredContactConstraintMemory: u32, + pub peakConstraintMemory: u32, + pub nbDiscreteContactPairsTotal: u32, + pub nbDiscreteContactPairsWithCacheHits: u32, + pub nbDiscreteContactPairsWithContacts: u32, + pub nbNewPairs: u32, + pub nbLostPairs: u32, + pub nbNewTouches: u32, + pub nbLostTouches: u32, + pub nbPartitions: u32, + pub structgen_pad0: [u8; 4], + pub gpuMemParticles: u64, + pub gpuMemSoftBodies: u64, + pub gpuMemFEMCloths: u64, + pub gpuMemHairSystems: u64, + pub gpuMemHeap: u64, + pub gpuMemHeapBroadPhase: u64, + pub gpuMemHeapNarrowPhase: u64, + pub gpuMemHeapSolver: u64, + pub gpuMemHeapArticulation: u64, + pub gpuMemHeapSimulation: u64, + pub gpuMemHeapSimulationArticulation: u64, + pub gpuMemHeapSimulationParticles: u64, + pub gpuMemHeapSimulationSoftBody: u64, + pub gpuMemHeapSimulationFEMCloth: u64, + pub gpuMemHeapSimulationHairSystem: u64, + pub gpuMemHeapParticles: u64, + pub gpuMemHeapSoftBodies: u64, + pub gpuMemHeapFEMCloths: u64, + pub gpuMemHeapHairSystems: u64, + pub gpuMemHeapOther: u64, + pub nbBroadPhaseAdds: u32, + pub nbBroadPhaseRemoves: u32, + pub nbDiscreteContactPairs: [[u32; 11]; 11], + pub nbCCDPairs: [[u32; 11]; 11], + pub nbModifiedContactPairs: [[u32; 11]; 11], + pub nbTriggerPairs: [[u32; 11]; 11], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGpuBodyData { + pub quat: PxQuat, + pub pos: PxVec4, + pub linVel: PxVec4, + pub angVel: PxVec4, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGpuActorPair { + pub srcIndex: u32, + pub structgen_pad0: [u8; 4], + pub nodeIndex: PxNodeIndex, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxIndexDataPair { + pub index: u32, + pub structgen_pad0: [u8; 4], + pub data: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDominanceGroupPair { + pub dominance0: u8, + pub dominance1: u8, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxScene { + pub structgen_pad0: [u8; 8], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneReadLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairExtraDataItem { + pub type_: u8, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairVelocity { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub linearVelocity: [PxVec3; 2], + pub angularVelocity: [PxVec3; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairPose { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub globalPose: [PxTransform; 2], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairIndex { + pub type_: u8, + pub structgen_pad0: [u8; 1], + pub index: u16, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairExtraDataIterator { + pub currPtr: *const u8, + pub endPtr: *const u8, + pub preSolverVelocity: *const PxContactPairVelocity, + pub postSolverVelocity: *const PxContactPairVelocity, + pub eventPose: *const PxContactPairPose, + pub contactPairIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairHeader { + pub actors: [*mut PxActor; 2], + pub extraDataStream: *const u8, + pub extraDataStreamSize: u16, + pub flags: PxContactPairHeaderFlags, + pub structgen_pad0: [u8; 4], + pub pairs: *const PxContactPair, + pub nbPairs: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPairPoint { + pub position: PxVec3, + pub separation: f32, + pub normal: PxVec3, + pub internalFaceIndex0: u32, + pub impulse: PxVec3, + pub internalFaceIndex1: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactPair { + pub shapes: [*mut PxShape; 2], + pub contactPatches: *const u8, + pub contactPoints: *const u8, + pub contactImpulses: *const f32, + pub requiredBufferSize: u32, + pub contactCount: u8, + pub patchCount: u8, + pub contactStreamSize: u16, + pub flags: PxContactPairFlags, + pub events: PxPairFlags, + pub internalData: [u32; 2], + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTriggerPair { + pub triggerShape: *mut PxShape, + pub triggerActor: *mut PxActor, + pub otherShape: *mut PxShape, + pub otherActor: *mut PxActor, + pub status: PxPairFlag, + pub flags: PxTriggerPairFlags, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConstraintInfo { + pub constraint: *mut PxConstraint, + pub externalReference: *mut std::ffi::c_void, + pub type_: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxFEMParameters { + pub velocityDamping: f32, + pub settlingThreshold: f32, + pub sleepThreshold: f32, + pub sleepDamping: f32, + pub selfCollisionFilterDistance: f32, + pub selfCollisionStressTolerance: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxPruningStructure { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxExtendedVec3 { + pub x: f64, + pub y: f64, + pub z: f64, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBoxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfExtents: PxVec3, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCapsuleObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfHeight: f32, + pub mRadius: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerState { + pub deltaXP: PxVec3, + pub structgen_pad0: [u8; 4], + pub touchedShape: *mut PxShape, + pub touchedActor: *mut PxRigidActor, + pub touchedObstacleHandle: u32, + pub collisionFlags: u32, + pub standOnAnotherCCT: bool, + pub standOnObstacle: bool, + pub isMovingUp: bool, + pub structgen_pad1: [u8; 5], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerStats { + pub nbIterations: u16, + pub nbFullUpdates: u16, + pub nbPartialUpdates: u16, + pub nbTessellation: u16, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerShapeHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub triangleIndex: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllersHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub other: *mut PxController, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerObstacleHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub userData: *const std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerFilters { + pub mFilterData: *const PxFilterData, + pub mFilterCallback: *mut PxQueryFilterCallback, + pub mFilterFlags: PxQueryFlags, + pub structgen_pad0: [u8; 6], + pub mCCTFilterCallback: *mut PxControllerFilterCallback, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBoxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 4], + pub halfHeight: f32, + pub halfSideExtent: f32, + pub halfForwardExtent: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCapsuleControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 4], + pub radius: f32, + pub height: f32, + pub climbingMode: PxCapsuleClimbingMode, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDim3 { + pub x: u32, + pub y: u32, + pub z: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSDFDesc { + pub sdf: PxBoundedData, + pub dims: PxDim3, + pub meshLower: PxVec3, + pub spacing: f32, + pub subgridSize: u32, + pub bitsPerSubgridPixel: PxSdfBitsPerSubgridPixel, + pub sdfSubgrids3DTexBlockDim: PxDim3, + pub sdfSubgrids: PxBoundedData, + pub sdfStartSlots: PxBoundedData, + pub subgridsMinSdfValue: f32, + pub subgridsMaxSdfValue: f32, + pub sdfBounds: PxBounds3, + pub narrowBandThicknessRelativeToSdfBoundsDiagonal: f32, + pub numThreadsForSdfConstruction: u32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxConvexMeshDesc { + pub points: PxBoundedData, + pub polygons: PxBoundedData, + pub indices: PxBoundedData, + pub flags: PxConvexFlags, + pub vertexLimit: u16, + pub polygonLimit: u16, + pub quantizedCount: u16, + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTriangleMeshDesc { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 22], + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTetrahedronMeshDesc { + pub structgen_pad0: [u8; 16], + pub points: PxBoundedData, + pub tetrahedrons: PxBoundedData, + pub flags: PxMeshFlags, + pub tetsPerElement: u16, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSoftBodySimulationDataDesc { + pub vertexToTet: PxBoundedData, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBVH34MidphaseDesc { + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVH34BuildStrategy, + pub quantized: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMidphaseDesc { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBVHDesc { + pub bounds: PxBoundedData, + pub enlargement: f32, + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVHBuildStrategy, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxCookingParams { + pub areaTestEpsilon: f32, + pub planeTolerance: f32, + pub convexMeshCookingType: PxConvexMeshCookingType, + pub suppressTriangleMeshRemapTable: bool, + pub buildTriangleAdjacencies: bool, + pub buildGPUData: bool, + pub structgen_pad0: [u8; 1], + pub scale: PxTolerancesScale, + pub meshPreprocessParams: PxMeshPreprocessingFlags, + pub meshWeldTolerance: f32, + pub midphaseDesc: PxMidphaseDesc, + pub gaussMapLimit: u32, + pub maxWeightRatioInTet: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDefaultMemoryOutputStream { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDefaultMemoryInputData { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDefaultFileOutputStream { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDefaultFileInputData { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSpring { + pub stiffness: f32, + pub damping: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxDistanceJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJacobianRow { + pub linear0: PxVec3, + pub linear1: PxVec3, + pub angular0: PxVec3, + pub angular1: PxVec3, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxContactJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxFixedJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointLimitParameters { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointLinearLimit { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub value: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointLinearLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointAngularLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointLimitCone { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngle: f32, + pub zAngle: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxJointLimitPyramid { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngleMin: f32, + pub yAngleMax: f32, + pub zAngleMin: f32, + pub zAngleMax: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxPrismaticJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRevoluteJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSphericalJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxD6JointDrive { + pub stiffness: f32, + pub damping: f32, + pub forceLimit: f32, + pub flags: PxD6JointDriveFlags, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxD6Joint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGearJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRackAndPinionJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxGroupsMask { + pub bits0: u16, + pub bits1: u16, + pub bits2: u16, + pub bits3: u16, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidActorExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMassProperties { + pub inertiaTensor: PxMat33, + pub centerOfMass: PxVec3, + pub mass: f32, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRigidBodyExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxShapeExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxMeshOverlapUtil { + pub structgen_pad0: [u8; 1040], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxXmlMiscParameter { + pub upVector: PxVec3, + pub scale: PxTolerancesScale, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSerialization { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxStringTableExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxBroadPhaseExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSceneQueryExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxSamplingExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxPoissonSampler { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTriangleMeshPoissonSampler { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxTetrahedronMeshExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRepXObject { + pub typeName: *const std::ffi::c_char, + pub serializable: *const std::ffi::c_void, + pub id: u64, +} +#[derive(Clone, Copy)] +#[repr(C)] +pub struct PxRepXInstantiationArgs { + pub structgen_pad0: [u8; 8], + pub cooker: *mut PxCooking, + pub stringTable: *mut PxStringTable, +} +#[cfg(test)] +mod sizes { + #[test] + fn check_sizes() { + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 176); + assert_eq!(std::mem::size_of::(), 160); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 44); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 96); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 80); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 112); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 128); + assert_eq!(std::mem::size_of::(), 192); + assert_eq!(std::mem::size_of::(), 208); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 144); + assert_eq!(std::mem::size_of::(), 224); + assert_eq!(std::mem::size_of::(), 224); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 76); + assert_eq!(std::mem::size_of::(), 136); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 80); + assert_eq!(std::mem::size_of::(), 72); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 104); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 96); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 88); + assert_eq!(std::mem::size_of::(), 96); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 88); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 80); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 352); + assert_eq!(std::mem::size_of::(), 2232); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 2); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 52); + assert_eq!(std::mem::size_of::(), 60); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 72); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 64); + assert_eq!(std::mem::size_of::(), 88); + assert_eq!(std::mem::size_of::(), 72); + assert_eq!(std::mem::size_of::(), 72); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 136); + assert_eq!(std::mem::size_of::(), 144); + assert_eq!(std::mem::size_of::(), 144); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 160); + assert_eq!(std::mem::size_of::(), 88); + assert_eq!(std::mem::size_of::(), 80); + assert_eq!(std::mem::size_of::(), 72); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 40); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 52); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1040); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 24); + } +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things.snap new file mode 100644 index 0000000..2427c72 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__all_the_things.snap @@ -0,0 +1,3285 @@ +--- +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_PxAllocatorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAssertHandler_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAllocationListener_Pod;\n"); + sg.pass_thru("struct physx_PxFoundation_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxProfilerCallback_Pod;\n"); + struct physx_PxAllocator_Pod: public physx::PxAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxAllocator_Pod", "PxAllocator"); + sg.end_struct(sizeof(physx::PxAllocator)); + } + }; + physx_PxAllocator_Pod::dump_layout(sg); + + struct physx_PxRawAllocator_Pod: public physx::PxRawAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRawAllocator_Pod", "PxRawAllocator"); + sg.end_struct(sizeof(physx::PxRawAllocator)); + } + }; + physx_PxRawAllocator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxVirtualAllocatorCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxVirtualAllocator_Pod: public physx::PxVirtualAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxVirtualAllocator_Pod", "PxVirtualAllocator"); + sg.end_struct(sizeof(physx::PxVirtualAllocator)); + } + }; + physx_PxVirtualAllocator_Pod::dump_layout(sg); + + struct physx_PxUserAllocated_Pod: public physx::PxUserAllocated { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxUserAllocated_Pod", "PxUserAllocated"); + sg.end_struct(sizeof(physx::PxUserAllocated)); + } + }; + physx_PxUserAllocated_Pod::dump_layout(sg); + + sg.pass_thru("union physx_PxTempAllocatorChunk_Pod {\n physx_PxTempAllocatorChunk_Pod* mNext;\n uint32_t mIndex;\n uint8_t mPad[16];\n};\n"); + struct physx_PxTempAllocator_Pod: public physx::PxTempAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTempAllocator_Pod", "PxTempAllocator"); + sg.end_struct(sizeof(physx::PxTempAllocator)); + } + }; + physx_PxTempAllocator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxLogTwo_Pod;\n"); + sg.pass_thru("struct physx_PxUnConst_Pod;\n"); + struct physx_PxBitAndByte_Pod: public physx::PxBitAndByte { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBitAndByte_Pod", "PxBitAndByte"); + sg.end_struct(sizeof(physx::PxBitAndByte)); + } + }; + physx_PxBitAndByte_Pod::dump_layout(sg); + + struct physx_PxBitMap_Pod: public physx::PxBitMap { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBitMap_Pod", "PxBitMap"); + sg.end_struct(sizeof(physx::PxBitMap)); + } + }; + physx_PxBitMap_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_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_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); + + sg.pass_thru("struct physx_PxErrorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAllocationListener_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBroadcastingAllocator_Pod: public physx::PxBroadcastingAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadcastingAllocator_Pod", "PxBroadcastingAllocator"); + sg.end_struct(sizeof(physx::PxBroadcastingAllocator)); + } + }; + physx_PxBroadcastingAllocator_Pod::dump_layout(sg); + + struct physx_PxBroadcastingErrorCallback_Pod: public physx::PxBroadcastingErrorCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadcastingErrorCallback_Pod", "PxBroadcastingErrorCallback"); + sg.end_struct(sizeof(physx::PxBroadcastingErrorCallback)); + } + }; + physx_PxBroadcastingErrorCallback_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxHash_Pod;\n"); + sg.pass_thru("struct physx_PxInputStream_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxInputData_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxOutputStream_Pod {\n void* vtable_;\n};\n"); + 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", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column0)); + sg.add_field("physx_PxVec4_Pod column1", "column1", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column1)); + sg.add_field("physx_PxVec4_Pod column2", "column2", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column2)); + sg.add_field("physx_PxVec4_Pod column3", "column3", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column3)); + sg.end_struct(sizeof(physx::PxMat44)); + } + }; + physx_PxMat44_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_PxMutexImpl_Pod: public physx::PxMutexImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMutexImpl_Pod", "PxMutexImpl"); + sg.end_struct(sizeof(physx::PxMutexImpl)); + } + }; + physx_PxMutexImpl_Pod::dump_layout(sg); + + struct physx_PxReadWriteLock_Pod: public physx::PxReadWriteLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxReadWriteLock_Pod", "PxReadWriteLock"); + sg.end_struct(sizeof(physx::PxReadWriteLock)); + } + }; + physx_PxReadWriteLock_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxProfilerCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxProfileScoped_Pod: public physx::PxProfileScoped { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxProfileScoped_Pod", "PxProfileScoped"); + sg.add_field("physx_PxProfilerCallback_Pod* mCallback", "mCallback", "*mut PxProfilerCallback", sizeof(physx::PxProfilerCallback*), unsafe_offsetof(physx_PxProfileScoped_Pod, mCallback)); + sg.add_field("char const* mEventName", "mEventName", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxProfileScoped_Pod, mEventName)); + sg.add_field("void* mProfilerData", "mProfilerData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxProfileScoped_Pod, mProfilerData)); + sg.add_field("uint64_t mContextId", "mContextId", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxProfileScoped_Pod, mContextId)); + sg.add_field("bool mDetached", "mDetached", "bool", sizeof(bool), unsafe_offsetof(physx_PxProfileScoped_Pod, mDetached)); + sg.end_struct(sizeof(physx::PxProfileScoped)); + } + }; + physx_PxProfileScoped_Pod::dump_layout(sg); + + struct physx_PxSListEntry_Pod: public physx::PxSListEntry { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSListEntry_Pod", "PxSListEntry"); + sg.end_struct(sizeof(physx::PxSListEntry)); + } + }; + physx_PxSListEntry_Pod::dump_layout(sg); + + struct physx_PxSListImpl_Pod: public physx::PxSListImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSListImpl_Pod", "PxSListImpl"); + sg.end_struct(sizeof(physx::PxSListImpl)); + } + }; + physx_PxSListImpl_Pod::dump_layout(sg); + + struct physx_PxSyncImpl_Pod: public physx::PxSyncImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSyncImpl_Pod", "PxSyncImpl"); + sg.end_struct(sizeof(physx::PxSyncImpl)); + } + }; + physx_PxSyncImpl_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxRunnable_Pod {\n void* vtable_;\n};\n"); + struct physx_PxCounterFrequencyToTensOfNanos_Pod: public physx::PxCounterFrequencyToTensOfNanos { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCounterFrequencyToTensOfNanos_Pod", "PxCounterFrequencyToTensOfNanos"); + sg.add_field("uint64_t mNumerator", "mNumerator", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxCounterFrequencyToTensOfNanos_Pod, mNumerator)); + sg.add_field("uint64_t mDenominator", "mDenominator", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxCounterFrequencyToTensOfNanos_Pod, mDenominator)); + sg.end_struct(sizeof(physx::PxCounterFrequencyToTensOfNanos)); + } + }; + physx_PxCounterFrequencyToTensOfNanos_Pod::dump_layout(sg); + + struct physx_PxTime_Pod: public physx::PxTime { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTime_Pod", "PxTime"); + sg.end_struct(sizeof(physx::PxTime)); + } + }; + physx_PxTime_Pod::dump_layout(sg); + + struct physx_PxVec2_Pod: public physx::PxVec2 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxVec2_Pod", "PxVec2"); + sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec2_Pod, x)); + sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec2_Pod, y)); + sg.end_struct(sizeof(physx::PxVec2)); + } + }; + physx_PxVec2_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_PxDebugPoint_Pod: public physx::PxDebugPoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugPoint_Pod", "PxDebugPoint"); + sg.add_field("physx_PxVec3_Pod pos", "pos", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugPoint_Pod, pos)); + sg.add_field("uint32_t color", "color", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugPoint_Pod, color)); + sg.end_struct(sizeof(physx::PxDebugPoint)); + } + }; + physx_PxDebugPoint_Pod::dump_layout(sg); + + struct physx_PxDebugLine_Pod: public physx::PxDebugLine { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugLine_Pod", "PxDebugLine"); + sg.add_field("physx_PxVec3_Pod pos0", "pos0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugLine_Pod, pos0)); + sg.add_field("uint32_t color0", "color0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugLine_Pod, color0)); + sg.add_field("physx_PxVec3_Pod pos1", "pos1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugLine_Pod, pos1)); + sg.add_field("uint32_t color1", "color1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugLine_Pod, color1)); + sg.end_struct(sizeof(physx::PxDebugLine)); + } + }; + physx_PxDebugLine_Pod::dump_layout(sg); + + struct physx_PxDebugTriangle_Pod: public physx::PxDebugTriangle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugTriangle_Pod", "PxDebugTriangle"); + sg.add_field("physx_PxVec3_Pod pos0", "pos0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos0)); + sg.add_field("uint32_t color0", "color0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color0)); + sg.add_field("physx_PxVec3_Pod pos1", "pos1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos1)); + sg.add_field("uint32_t color1", "color1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color1)); + sg.add_field("physx_PxVec3_Pod pos2", "pos2", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos2)); + sg.add_field("uint32_t color2", "color2", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color2)); + sg.end_struct(sizeof(physx::PxDebugTriangle)); + } + }; + physx_PxDebugTriangle_Pod::dump_layout(sg); + + struct physx_PxDebugText_Pod: public physx::PxDebugText { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugText_Pod", "PxDebugText"); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugText_Pod, position)); + sg.add_field("float size", "size", "f32", sizeof(float), unsafe_offsetof(physx_PxDebugText_Pod, size)); + sg.add_field("uint32_t color", "color", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugText_Pod, color)); + sg.add_field("char const* string", "string", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxDebugText_Pod, string)); + sg.end_struct(sizeof(physx::PxDebugText)); + } + }; + physx_PxDebugText_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxRenderBuffer_Pod {\n void* vtable_;\n};\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"); + 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_PxTolerancesScale_Pod: public physx::PxTolerancesScale { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTolerancesScale_Pod", "PxTolerancesScale"); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxTolerancesScale_Pod, length)); + sg.add_field("float speed", "speed", "f32", sizeof(float), unsafe_offsetof(physx_PxTolerancesScale_Pod, speed)); + sg.end_struct(sizeof(physx::PxTolerancesScale)); + } + }; + physx_PxTolerancesScale_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxStringTable_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSerializer_Pod {\n void* vtable_;\n};\n"); + struct physx_PxMetaDataEntry_Pod: public physx::PxMetaDataEntry { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMetaDataEntry_Pod", "PxMetaDataEntry"); + sg.add_field("char const* type", "type_", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxMetaDataEntry_Pod, type)); + sg.add_field("char const* name", "name", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxMetaDataEntry_Pod, name)); + sg.add_field("uint32_t offset", "offset", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, offset)); + sg.add_field("uint32_t size", "size", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, size)); + sg.add_field("uint32_t count", "count", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, count)); + sg.add_field("uint32_t offsetSize", "offsetSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, offsetSize)); + sg.add_field("uint32_t flags", "flags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, flags)); + sg.add_field("uint32_t alignment", "alignment", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, alignment)); + sg.end_struct(sizeof(physx::PxMetaDataEntry)); + } + }; + physx_PxMetaDataEntry_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxInsertionCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBaseTask_Pod;\n"); + sg.pass_thru("struct physx_PxTask_Pod;\n"); + sg.pass_thru("struct physx_PxLightCpuTask_Pod;\n"); + sg.pass_thru("struct physx_PxCpuDispatcher_Pod;\n"); + sg.pass_thru("struct physx_PxTaskManager_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCpuDispatcher_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBaseTask_Pod: public physx::PxBaseTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBaseTask_Pod", "PxBaseTask"); + sg.end_struct(sizeof(physx::PxBaseTask)); + } + }; + physx_PxBaseTask_Pod::dump_layout(sg); + + struct physx_PxTask_Pod: public physx::PxTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTask_Pod", "PxTask"); + sg.end_struct(sizeof(physx::PxTask)); + } + }; + physx_PxTask_Pod::dump_layout(sg); + + struct physx_PxLightCpuTask_Pod: public physx::PxLightCpuTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxLightCpuTask_Pod", "PxLightCpuTask"); + sg.end_struct(sizeof(physx::PxLightCpuTask)); + } + }; + physx_PxLightCpuTask_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_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); + + sg.pass_thru("struct physx_PxBVHRaycastCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBVHOverlapCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBVHTraversalCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBVH_Pod: public physx::PxBVH { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH_Pod", "PxBVH"); + sg.end_struct(sizeof(physx::PxBVH)); + } + }; + physx_PxBVH_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxGeomIndexPair_Pod;\n"); + 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_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_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_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_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_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_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_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); + + struct physx_PxGeometryQuery_Pod: public physx::PxGeometryQuery { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGeometryQuery_Pod", "PxGeometryQuery"); + sg.end_struct(sizeof(physx::PxGeometryQuery)); + } + }; + physx_PxGeometryQuery_Pod::dump_layout(sg); + + struct physx_PxHeightFieldSample_Pod: public physx::PxHeightFieldSample { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightFieldSample_Pod", "PxHeightFieldSample"); + sg.add_field("int16_t height", "height", "i16", sizeof(int16_t), unsafe_offsetof(physx_PxHeightFieldSample_Pod, height)); + sg.add_field("physx_PxBitAndByte_Pod materialIndex0", "materialIndex0", "PxBitAndByte", sizeof(physx::PxBitAndByte), unsafe_offsetof(physx_PxHeightFieldSample_Pod, materialIndex0)); + sg.add_field("physx_PxBitAndByte_Pod materialIndex1", "materialIndex1", "PxBitAndByte", sizeof(physx::PxBitAndByte), unsafe_offsetof(physx_PxHeightFieldSample_Pod, materialIndex1)); + sg.end_struct(sizeof(physx::PxHeightFieldSample)); + } + }; + physx_PxHeightFieldSample_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxHeightFieldDesc_Pod;\n"); + struct physx_PxHeightField_Pod: public physx::PxHeightField { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightField_Pod", "PxHeightField"); + sg.end_struct(sizeof(physx::PxHeightField)); + } + }; + physx_PxHeightField_Pod::dump_layout(sg); + + struct physx_PxHeightFieldDesc_Pod: public physx::PxHeightFieldDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightFieldDesc_Pod", "PxHeightFieldDesc"); + sg.add_field("uint32_t nbRows", "nbRows", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, nbRows)); + sg.add_field("uint32_t nbColumns", "nbColumns", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, nbColumns)); + sg.add_field("int32_t format", "format", "PxHeightFieldFormat", sizeof(physx::PxHeightFieldFormat::Enum), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, format)); + sg.add_field("physx_PxStridedData_Pod samples", "samples", "PxStridedData", sizeof(physx::PxStridedData), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, samples)); + sg.add_field("float convexEdgeThreshold", "convexEdgeThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, convexEdgeThreshold)); + sg.add_field("uint16_t flags", "flags", "PxHeightFieldFlags", sizeof(physx::PxHeightFieldFlags), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, flags)); + sg.end_struct(sizeof(physx::PxHeightFieldDesc)); + } + }; + physx_PxHeightFieldDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxTriangle_Pod;\n"); + struct physx_PxMeshQuery_Pod: public physx::PxMeshQuery { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMeshQuery_Pod", "PxMeshQuery"); + sg.end_struct(sizeof(physx::PxMeshQuery)); + } + }; + physx_PxMeshQuery_Pod::dump_layout(sg); + + struct physx_PxSimpleTriangleMesh_Pod: public physx::PxSimpleTriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimpleTriangleMesh_Pod", "PxSimpleTriangleMesh"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod triangles", "triangles", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, triangles)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, flags)); + sg.end_struct(sizeof(physx::PxSimpleTriangleMesh)); + } + }; + physx_PxSimpleTriangleMesh_Pod::dump_layout(sg); + + struct physx_PxTriangle_Pod: public physx::PxTriangle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangle_Pod", "PxTriangle"); + sg.add_field("physx_PxVec3_Pod verts[3]", "verts", "[PxVec3; 3]", sizeof(physx::PxVec3[3]), unsafe_offsetof(physx_PxTriangle_Pod, verts)); + sg.end_struct(sizeof(physx::PxTriangle)); + } + }; + physx_PxTriangle_Pod::dump_layout(sg); + + struct physx_PxTrianglePadded_Pod: public physx::PxTrianglePadded { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTrianglePadded_Pod", "PxTrianglePadded"); + sg.add_field("physx_PxVec3_Pod verts[3]", "verts", "[PxVec3; 3]", sizeof(physx::PxVec3[3]), unsafe_offsetof(physx_PxTrianglePadded_Pod, verts)); + sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTrianglePadded_Pod, padding)); + sg.end_struct(sizeof(physx::PxTrianglePadded)); + } + }; + physx_PxTrianglePadded_Pod::dump_layout(sg); + + struct physx_PxTriangleMesh_Pod: public physx::PxTriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMesh_Pod", "PxTriangleMesh"); + sg.end_struct(sizeof(physx::PxTriangleMesh)); + } + }; + physx_PxTriangleMesh_Pod::dump_layout(sg); + + struct physx_PxBVH34TriangleMesh_Pod: public physx::PxBVH34TriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH34TriangleMesh_Pod", "PxBVH34TriangleMesh"); + sg.end_struct(sizeof(physx::PxBVH34TriangleMesh)); + } + }; + physx_PxBVH34TriangleMesh_Pod::dump_layout(sg); + + struct physx_PxTetrahedron_Pod: public physx::PxTetrahedron { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedron_Pod", "PxTetrahedron"); + sg.add_field("physx_PxVec3_Pod verts[4]", "verts", "[PxVec3; 4]", sizeof(physx::PxVec3[4]), unsafe_offsetof(physx_PxTetrahedron_Pod, verts)); + sg.end_struct(sizeof(physx::PxTetrahedron)); + } + }; + physx_PxTetrahedron_Pod::dump_layout(sg); + + struct physx_PxSoftBodyAuxData_Pod: public physx::PxSoftBodyAuxData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyAuxData_Pod", "PxSoftBodyAuxData"); + sg.end_struct(sizeof(physx::PxSoftBodyAuxData)); + } + }; + physx_PxSoftBodyAuxData_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMesh_Pod: public physx::PxTetrahedronMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMesh_Pod", "PxTetrahedronMesh"); + sg.end_struct(sizeof(physx::PxTetrahedronMesh)); + } + }; + physx_PxTetrahedronMesh_Pod::dump_layout(sg); + + struct physx_PxSoftBodyMesh_Pod: public physx::PxSoftBodyMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyMesh_Pod", "PxSoftBodyMesh"); + sg.end_struct(sizeof(physx::PxSoftBodyMesh)); + } + }; + physx_PxSoftBodyMesh_Pod::dump_layout(sg); + + struct physx_PxCollisionMeshMappingData_Pod: public physx::PxCollisionMeshMappingData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCollisionMeshMappingData_Pod", "PxCollisionMeshMappingData"); + sg.end_struct(sizeof(physx::PxCollisionMeshMappingData)); + } + }; + physx_PxCollisionMeshMappingData_Pod::dump_layout(sg); + + struct physx_PxSoftBodyCollisionData_Pod: public physx::PxSoftBodyCollisionData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyCollisionData_Pod", "PxSoftBodyCollisionData"); + sg.end_struct(sizeof(physx::PxSoftBodyCollisionData)); + } + }; + physx_PxSoftBodyCollisionData_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshData_Pod: public physx::PxTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshData_Pod", "PxTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxTetrahedronMeshData)); + } + }; + physx_PxTetrahedronMeshData_Pod::dump_layout(sg); + + struct physx_PxSoftBodySimulationData_Pod: public physx::PxSoftBodySimulationData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodySimulationData_Pod", "PxSoftBodySimulationData"); + sg.end_struct(sizeof(physx::PxSoftBodySimulationData)); + } + }; + physx_PxSoftBodySimulationData_Pod::dump_layout(sg); + + struct physx_PxCollisionTetrahedronMeshData_Pod: public physx::PxCollisionTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCollisionTetrahedronMeshData_Pod", "PxCollisionTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxCollisionTetrahedronMeshData)); + } + }; + physx_PxCollisionTetrahedronMeshData_Pod::dump_layout(sg); + + struct physx_PxSimulationTetrahedronMeshData_Pod: public physx::PxSimulationTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimulationTetrahedronMeshData_Pod", "PxSimulationTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxSimulationTetrahedronMeshData)); + } + }; + physx_PxSimulationTetrahedronMeshData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxScene_Pod;\n"); + struct physx_PxActor_Pod: public physx::PxActor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxActor_Pod", "PxActor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxActor_Pod, userData)); + sg.end_struct(sizeof(physx::PxActor)); + } + }; + physx_PxActor_Pod::dump_layout(sg); + + struct physx_PxAggregate_Pod: public physx::PxAggregate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxAggregate_Pod", "PxAggregate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxAggregate_Pod, userData)); + sg.end_struct(sizeof(physx::PxAggregate)); + } + }; + physx_PxAggregate_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.pass_thru("struct physx_PxArticulationSpatialTendon_Pod;\n"); + sg.pass_thru("struct physx_PxArticulationFixedTendon_Pod;\n"); + struct physx_PxArticulationTendonLimit_Pod: public physx::PxArticulationTendonLimit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendonLimit_Pod", "PxArticulationTendonLimit"); + sg.add_field("float lowLimit", "lowLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationTendonLimit_Pod, lowLimit)); + sg.add_field("float highLimit", "highLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationTendonLimit_Pod, highLimit)); + sg.end_struct(sizeof(physx::PxArticulationTendonLimit)); + } + }; + physx_PxArticulationTendonLimit_Pod::dump_layout(sg); + + struct physx_PxArticulationAttachment_Pod: public physx::PxArticulationAttachment { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationAttachment_Pod", "PxArticulationAttachment"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationAttachment_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationAttachment)); + } + }; + physx_PxArticulationAttachment_Pod::dump_layout(sg); + + struct physx_PxArticulationTendonJoint_Pod: public physx::PxArticulationTendonJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendonJoint_Pod", "PxArticulationTendonJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationTendonJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationTendonJoint)); + } + }; + physx_PxArticulationTendonJoint_Pod::dump_layout(sg); + + struct physx_PxArticulationTendon_Pod: public physx::PxArticulationTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendon_Pod", "PxArticulationTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationTendon)); + } + }; + physx_PxArticulationTendon_Pod::dump_layout(sg); + + struct physx_PxArticulationSpatialTendon_Pod: public physx::PxArticulationSpatialTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationSpatialTendon_Pod", "PxArticulationSpatialTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationSpatialTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationSpatialTendon)); + } + }; + physx_PxArticulationSpatialTendon_Pod::dump_layout(sg); + + struct physx_PxArticulationFixedTendon_Pod: public physx::PxArticulationFixedTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationFixedTendon_Pod", "PxArticulationFixedTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationFixedTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationFixedTendon)); + } + }; + physx_PxArticulationFixedTendon_Pod::dump_layout(sg); + + struct physx_PxSpatialForce_Pod: public physx::PxSpatialForce { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpatialForce_Pod", "PxSpatialForce"); + sg.add_field("physx_PxVec3_Pod force", "force", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialForce_Pod, force)); + sg.add_field("float pad0", "pad0", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialForce_Pod, pad0)); + sg.add_field("physx_PxVec3_Pod torque", "torque", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialForce_Pod, torque)); + sg.add_field("float pad1", "pad1", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialForce_Pod, pad1)); + sg.end_struct(sizeof(physx::PxSpatialForce)); + } + }; + physx_PxSpatialForce_Pod::dump_layout(sg); + + struct physx_PxSpatialVelocity_Pod: public physx::PxSpatialVelocity { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpatialVelocity_Pod", "PxSpatialVelocity"); + sg.add_field("physx_PxVec3_Pod linear", "linear", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialVelocity_Pod, linear)); + sg.add_field("float pad0", "pad0", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialVelocity_Pod, pad0)); + sg.add_field("physx_PxVec3_Pod angular", "angular", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialVelocity_Pod, angular)); + sg.add_field("float pad1", "pad1", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialVelocity_Pod, pad1)); + sg.end_struct(sizeof(physx::PxSpatialVelocity)); + } + }; + physx_PxSpatialVelocity_Pod::dump_layout(sg); + + struct physx_PxArticulationRootLinkData_Pod: public physx::PxArticulationRootLinkData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationRootLinkData_Pod", "PxArticulationRootLinkData"); + sg.add_field("physx_PxTransform_Pod transform", "transform", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, transform)); + sg.add_field("physx_PxVec3_Pod worldLinVel", "worldLinVel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldLinVel)); + sg.add_field("physx_PxVec3_Pod worldAngVel", "worldAngVel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldAngVel)); + sg.add_field("physx_PxVec3_Pod worldLinAccel", "worldLinAccel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldLinAccel)); + sg.add_field("physx_PxVec3_Pod worldAngAccel", "worldAngAccel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldAngAccel)); + sg.end_struct(sizeof(physx::PxArticulationRootLinkData)); + } + }; + physx_PxArticulationRootLinkData_Pod::dump_layout(sg); + + struct physx_PxArticulationCache_Pod: public physx::PxArticulationCache { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationCache_Pod", "PxArticulationCache"); + sg.add_field("physx_PxSpatialForce_Pod* externalForces", "externalForces", "*mut PxSpatialForce", sizeof(physx::PxSpatialForce*), unsafe_offsetof(physx_PxArticulationCache_Pod, externalForces)); + sg.add_field("float* denseJacobian", "denseJacobian", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, denseJacobian)); + sg.add_field("float* massMatrix", "massMatrix", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, massMatrix)); + sg.add_field("float* jointVelocity", "jointVelocity", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointVelocity)); + sg.add_field("float* jointAcceleration", "jointAcceleration", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointAcceleration)); + sg.add_field("float* jointPosition", "jointPosition", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointPosition)); + sg.add_field("float* jointForce", "jointForce", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointForce)); + sg.add_field("float* jointSolverForces", "jointSolverForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointSolverForces)); + sg.add_field("physx_PxSpatialVelocity_Pod* linkVelocity", "linkVelocity", "*mut PxSpatialVelocity", sizeof(physx::PxSpatialVelocity*), unsafe_offsetof(physx_PxArticulationCache_Pod, linkVelocity)); + sg.add_field("physx_PxSpatialVelocity_Pod* linkAcceleration", "linkAcceleration", "*mut PxSpatialVelocity", sizeof(physx::PxSpatialVelocity*), unsafe_offsetof(physx_PxArticulationCache_Pod, linkAcceleration)); + sg.add_field("physx_PxArticulationRootLinkData_Pod* rootLinkData", "rootLinkData", "*mut PxArticulationRootLinkData", sizeof(physx::PxArticulationRootLinkData*), unsafe_offsetof(physx_PxArticulationCache_Pod, rootLinkData)); + sg.add_field("physx_PxSpatialForce_Pod* sensorForces", "sensorForces", "*mut PxSpatialForce", sizeof(physx::PxSpatialForce*), unsafe_offsetof(physx_PxArticulationCache_Pod, sensorForces)); + sg.add_field("float* coefficientMatrix", "coefficientMatrix", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, coefficientMatrix)); + sg.add_field("float* lambda", "lambda", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, lambda)); + sg.add_field("void* scratchMemory", "scratchMemory", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationCache_Pod, scratchMemory)); + sg.add_field("void* scratchAllocator", "scratchAllocator", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationCache_Pod, scratchAllocator)); + sg.add_field("uint32_t version", "version", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxArticulationCache_Pod, version)); + sg.end_struct(sizeof(physx::PxArticulationCache)); + } + }; + physx_PxArticulationCache_Pod::dump_layout(sg); + + struct physx_PxArticulationSensor_Pod: public physx::PxArticulationSensor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationSensor_Pod", "PxArticulationSensor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationSensor_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationSensor)); + } + }; + physx_PxArticulationSensor_Pod::dump_layout(sg); + + struct physx_PxArticulationReducedCoordinate_Pod: public physx::PxArticulationReducedCoordinate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationReducedCoordinate_Pod", "PxArticulationReducedCoordinate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationReducedCoordinate_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationReducedCoordinate)); + } + }; + physx_PxArticulationReducedCoordinate_Pod::dump_layout(sg); + + struct physx_PxArticulationJointReducedCoordinate_Pod: public physx::PxArticulationJointReducedCoordinate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationJointReducedCoordinate_Pod", "PxArticulationJointReducedCoordinate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationJointReducedCoordinate_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationJointReducedCoordinate)); + } + }; + physx_PxArticulationJointReducedCoordinate_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); + + struct physx_PxRigidActor_Pod: public physx::PxRigidActor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidActor_Pod", "PxRigidActor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidActor_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidActor)); + } + }; + physx_PxRigidActor_Pod::dump_layout(sg); + + struct physx_PxNodeIndex_Pod: public physx::PxNodeIndex { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxNodeIndex_Pod", "PxNodeIndex"); + sg.end_struct(sizeof(physx::PxNodeIndex)); + } + }; + physx_PxNodeIndex_Pod::dump_layout(sg); + + struct physx_PxRigidBody_Pod: public physx::PxRigidBody { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidBody_Pod", "PxRigidBody"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidBody_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidBody)); + } + }; + physx_PxRigidBody_Pod::dump_layout(sg); + + struct physx_PxArticulationLink_Pod: public physx::PxArticulationLink { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationLink_Pod", "PxArticulationLink"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationLink_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationLink)); + } + }; + physx_PxArticulationLink_Pod::dump_layout(sg); + + struct physx_PxConeLimitedConstraint_Pod: public physx::PxConeLimitedConstraint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConeLimitedConstraint_Pod", "PxConeLimitedConstraint"); + sg.add_field("physx_PxVec3_Pod mAxis", "mAxis", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mAxis)); + sg.add_field("float mAngle", "mAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mAngle)); + sg.add_field("float mLowLimit", "mLowLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mLowLimit)); + sg.add_field("float mHighLimit", "mHighLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mHighLimit)); + sg.end_struct(sizeof(physx::PxConeLimitedConstraint)); + } + }; + physx_PxConeLimitedConstraint_Pod::dump_layout(sg); + + struct physx_PxConeLimitParams_Pod: public physx::PxConeLimitParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConeLimitParams_Pod", "PxConeLimitParams"); + sg.add_field("physx_PxVec4_Pod lowHighLimits", "lowHighLimits", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxConeLimitParams_Pod, lowHighLimits)); + sg.add_field("physx_PxVec4_Pod axisAngle", "axisAngle", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxConeLimitParams_Pod, axisAngle)); + sg.end_struct(sizeof(physx::PxConeLimitParams)); + } + }; + physx_PxConeLimitParams_Pod::dump_layout(sg); + + struct physx_PxConstraintShaderTable_Pod: public physx::PxConstraintShaderTable { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraintShaderTable_Pod", "PxConstraintShaderTable"); + sg.add_field("void * solverPrep", "solverPrep", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, solverPrep)); + sg.add_field("void * visualize", "visualize", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, visualize)); + sg.add_field("int32_t flag", "flag", "PxConstraintFlag", sizeof(physx::PxConstraintFlag::Enum), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, flag)); + sg.end_struct(sizeof(physx::PxConstraintShaderTable)); + } + }; + physx_PxConstraintShaderTable_Pod::dump_layout(sg); + + struct physx_PxConstraint_Pod: public physx::PxConstraint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraint_Pod", "PxConstraint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxConstraint_Pod, userData)); + sg.end_struct(sizeof(physx::PxConstraint)); + } + }; + physx_PxConstraint_Pod::dump_layout(sg); + + struct physx_PxMassModificationProps_Pod: public physx::PxMassModificationProps { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMassModificationProps_Pod", "PxMassModificationProps"); + sg.add_field("float mInvMassScale0", "mInvMassScale0", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvMassScale0)); + sg.add_field("float mInvInertiaScale0", "mInvInertiaScale0", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvInertiaScale0)); + sg.add_field("float mInvMassScale1", "mInvMassScale1", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvMassScale1)); + sg.add_field("float mInvInertiaScale1", "mInvInertiaScale1", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvInertiaScale1)); + sg.end_struct(sizeof(physx::PxMassModificationProps)); + } + }; + physx_PxMassModificationProps_Pod::dump_layout(sg); + + struct physx_PxContactPatch_Pod: public physx::PxContactPatch { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPatch_Pod", "PxContactPatch"); + sg.add_field("physx_PxMassModificationProps_Pod mMassModification", "mMassModification", "PxMassModificationProps", sizeof(physx::PxMassModificationProps), unsafe_offsetof(physx_PxContactPatch_Pod, mMassModification)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPatch_Pod, normal)); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, restitution)); + sg.add_field("float dynamicFriction", "dynamicFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, dynamicFriction)); + sg.add_field("float staticFriction", "staticFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, staticFriction)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, damping)); + sg.add_field("uint16_t startContactIndex", "startContactIndex", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, startContactIndex)); + sg.add_field("uint8_t nbContacts", "nbContacts", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPatch_Pod, nbContacts)); + sg.add_field("uint8_t materialFlags", "materialFlags", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialFlags)); + sg.add_field("uint16_t internalFlags", "internalFlags", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, internalFlags)); + sg.add_field("uint16_t materialIndex0", "materialIndex0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialIndex0)); + sg.add_field("uint16_t materialIndex1", "materialIndex1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialIndex1)); + sg.add_field("uint16_t pad[5]", "pad", "[u16; 5]", sizeof(uint16_t[5]), unsafe_offsetof(physx_PxContactPatch_Pod, pad)); + sg.end_struct(sizeof(physx::PxContactPatch)); + } + }; + physx_PxContactPatch_Pod::dump_layout(sg); + + struct physx_PxContact_Pod: public physx::PxContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContact_Pod", "PxContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxContact_Pod, separation)); + sg.end_struct(sizeof(physx::PxContact)); + } + }; + physx_PxContact_Pod::dump_layout(sg); + + struct physx_PxExtendedContact_Pod: public physx::PxExtendedContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxExtendedContact_Pod", "PxExtendedContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxExtendedContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxExtendedContact_Pod, separation)); + sg.add_field("physx_PxVec3_Pod targetVelocity", "targetVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxExtendedContact_Pod, targetVelocity)); + sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxExtendedContact_Pod, maxImpulse)); + sg.end_struct(sizeof(physx::PxExtendedContact)); + } + }; + physx_PxExtendedContact_Pod::dump_layout(sg); + + struct physx_PxModifiableContact_Pod: public physx::PxModifiableContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxModifiableContact_Pod", "PxModifiableContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, separation)); + sg.add_field("physx_PxVec3_Pod targetVelocity", "targetVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, targetVelocity)); + sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, maxImpulse)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, normal)); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, restitution)); + sg.add_field("uint32_t materialFlags", "materialFlags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialFlags)); + sg.add_field("uint16_t materialIndex0", "materialIndex0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialIndex0)); + sg.add_field("uint16_t materialIndex1", "materialIndex1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialIndex1)); + sg.add_field("float staticFriction", "staticFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, staticFriction)); + sg.add_field("float dynamicFriction", "dynamicFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, dynamicFriction)); + sg.end_struct(sizeof(physx::PxModifiableContact)); + } + }; + physx_PxModifiableContact_Pod::dump_layout(sg); + + struct physx_PxContactStreamIterator_Pod: public physx::PxContactStreamIterator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactStreamIterator_Pod", "PxContactStreamIterator"); + sg.add_field("physx_PxVec3_Pod zero", "zero", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactStreamIterator_Pod, zero)); + sg.add_field("physx_PxContactPatch_Pod const* patch", "patch", "*const PxContactPatch", sizeof(physx::PxContactPatch const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, patch)); + sg.add_field("physx_PxContact_Pod const* contact", "contact", "*const PxContact", sizeof(physx::PxContact const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contact)); + sg.add_field("uint32_t const* faceIndice", "faceIndice", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, faceIndice)); + sg.add_field("uint32_t totalPatches", "totalPatches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, totalPatches)); + sg.add_field("uint32_t totalContacts", "totalContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, totalContacts)); + sg.add_field("uint32_t nextContactIndex", "nextContactIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, nextContactIndex)); + sg.add_field("uint32_t nextPatchIndex", "nextPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, nextPatchIndex)); + sg.add_field("uint32_t contactPatchHeaderSize", "contactPatchHeaderSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contactPatchHeaderSize)); + sg.add_field("uint32_t contactPointSize", "contactPointSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contactPointSize)); + sg.add_field("int32_t mStreamFormat", "mStreamFormat", "StreamFormat", sizeof(physx::PxContactStreamIterator::StreamFormat), unsafe_offsetof(physx_PxContactStreamIterator_Pod, mStreamFormat)); + sg.add_field("uint32_t forceNoResponse", "forceNoResponse", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, forceNoResponse)); + sg.add_field("bool pointStepped", "pointStepped", "bool", sizeof(bool), unsafe_offsetof(physx_PxContactStreamIterator_Pod, pointStepped)); + sg.add_field("uint32_t hasFaceIndices", "hasFaceIndices", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, hasFaceIndices)); + sg.end_struct(sizeof(physx::PxContactStreamIterator)); + } + }; + physx_PxContactStreamIterator_Pod::dump_layout(sg); + + struct physx_PxGpuContactPair_Pod: public physx::PxGpuContactPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuContactPair_Pod", "PxGpuContactPair"); + sg.add_field("uint8_t* contactPatches", "contactPatches", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactPatches)); + sg.add_field("uint8_t* contactPoints", "contactPoints", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactPoints)); + sg.add_field("float* contactForces", "contactForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactForces)); + sg.add_field("uint32_t transformCacheRef0", "transformCacheRef0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, transformCacheRef0)); + sg.add_field("uint32_t transformCacheRef1", "transformCacheRef1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, transformCacheRef1)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex0", "nodeIndex0", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuContactPair_Pod, nodeIndex0)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex1", "nodeIndex1", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuContactPair_Pod, nodeIndex1)); + sg.add_field("physx_PxActor_Pod* actor0", "actor0", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxGpuContactPair_Pod, actor0)); + sg.add_field("physx_PxActor_Pod* actor1", "actor1", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxGpuContactPair_Pod, actor1)); + sg.add_field("uint16_t nbContacts", "nbContacts", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, nbContacts)); + sg.add_field("uint16_t nbPatches", "nbPatches", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, nbPatches)); + sg.end_struct(sizeof(physx::PxGpuContactPair)); + } + }; + physx_PxGpuContactPair_Pod::dump_layout(sg); + + struct physx_PxContactSet_Pod: public physx::PxContactSet { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactSet_Pod", "PxContactSet"); + sg.end_struct(sizeof(physx::PxContactSet)); + } + }; + physx_PxContactSet_Pod::dump_layout(sg); + + struct physx_PxContactModifyPair_Pod: public physx::PxContactModifyPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactModifyPair_Pod", "PxContactModifyPair"); + sg.add_field("physx_PxRigidActor_Pod const* actor[2]", "actor", "[*const PxRigidActor; 2]", sizeof(physx::PxRigidActor const*[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, actor)); + sg.add_field("physx_PxShape_Pod const* shape[2]", "shape", "[*const PxShape; 2]", sizeof(physx::PxShape const*[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, shape)); + sg.add_field("physx_PxTransform_Pod transform[2]", "transform", "[PxTransform; 2]", sizeof(physx::PxTransform[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, transform)); + sg.add_field("physx_PxContactSet_Pod contacts", "contacts", "PxContactSet", sizeof(physx::PxContactSet), unsafe_offsetof(physx_PxContactModifyPair_Pod, contacts)); + sg.end_struct(sizeof(physx::PxContactModifyPair)); + } + }; + physx_PxContactModifyPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxContactModifyCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCCDContactModifyCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxDeletionListener_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBaseMaterial_Pod: public physx::PxBaseMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBaseMaterial_Pod", "PxBaseMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBaseMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxBaseMaterial)); + } + }; + physx_PxBaseMaterial_Pod::dump_layout(sg); + + struct physx_PxFEMMaterial_Pod: public physx::PxFEMMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFEMMaterial_Pod", "PxFEMMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxFEMMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxFEMMaterial)); + } + }; + physx_PxFEMMaterial_Pod::dump_layout(sg); + + struct physx_PxFilterData_Pod: public physx::PxFilterData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFilterData_Pod", "PxFilterData"); + sg.add_field("uint32_t word0", "word0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word0)); + sg.add_field("uint32_t word1", "word1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word1)); + sg.add_field("uint32_t word2", "word2", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word2)); + sg.add_field("uint32_t word3", "word3", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word3)); + sg.end_struct(sizeof(physx::PxFilterData)); + } + }; + physx_PxFilterData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSimulationFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxParticleRigidFilterPair_Pod: public physx::PxParticleRigidFilterPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleRigidFilterPair_Pod", "PxParticleRigidFilterPair"); + sg.add_field("uint64_t mID0", "mID0", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxParticleRigidFilterPair_Pod, mID0)); + sg.add_field("uint64_t mID1", "mID1", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxParticleRigidFilterPair_Pod, mID1)); + sg.end_struct(sizeof(physx::PxParticleRigidFilterPair)); + } + }; + physx_PxParticleRigidFilterPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxLockedData_Pod {\n void* vtable_;\n};\n"); + struct physx_PxMaterial_Pod: public physx::PxMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMaterial_Pod", "PxMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxMaterial)); + } + }; + physx_PxMaterial_Pod::dump_layout(sg); + + struct physx_PxGpuParticleBufferIndexPair_Pod: public physx::PxGpuParticleBufferIndexPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuParticleBufferIndexPair_Pod", "PxGpuParticleBufferIndexPair"); + sg.add_field("uint32_t systemIndex", "systemIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuParticleBufferIndexPair_Pod, systemIndex)); + sg.add_field("uint32_t bufferIndex", "bufferIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuParticleBufferIndexPair_Pod, bufferIndex)); + sg.end_struct(sizeof(physx::PxGpuParticleBufferIndexPair)); + } + }; + physx_PxGpuParticleBufferIndexPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCudaContextManager_Pod;\n"); + sg.pass_thru("struct physx_PxParticleRigidAttachment_Pod;\n"); + struct physx_PxParticleVolume_Pod: public physx::PxParticleVolume { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleVolume_Pod", "PxParticleVolume"); + sg.add_field("physx_PxBounds3_Pod bound", "bound", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxParticleVolume_Pod, bound)); + sg.add_field("uint32_t particleIndicesOffset", "particleIndicesOffset", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleVolume_Pod, particleIndicesOffset)); + sg.add_field("uint32_t numParticles", "numParticles", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleVolume_Pod, numParticles)); + sg.end_struct(sizeof(physx::PxParticleVolume)); + } + }; + physx_PxParticleVolume_Pod::dump_layout(sg); + + struct physx_PxDiffuseParticleParams_Pod: public physx::PxDiffuseParticleParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDiffuseParticleParams_Pod", "PxDiffuseParticleParams"); + sg.add_field("float threshold", "threshold", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, threshold)); + sg.add_field("float lifetime", "lifetime", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, lifetime)); + sg.add_field("float airDrag", "airDrag", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, airDrag)); + sg.add_field("float bubbleDrag", "bubbleDrag", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, bubbleDrag)); + sg.add_field("float buoyancy", "buoyancy", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, buoyancy)); + sg.add_field("float kineticEnergyWeight", "kineticEnergyWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, kineticEnergyWeight)); + sg.add_field("float pressureWeight", "pressureWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, pressureWeight)); + sg.add_field("float divergenceWeight", "divergenceWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, divergenceWeight)); + sg.add_field("float collisionDecay", "collisionDecay", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, collisionDecay)); + sg.add_field("bool useAccurateVelocity", "useAccurateVelocity", "bool", sizeof(bool), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, useAccurateVelocity)); + sg.end_struct(sizeof(physx::PxDiffuseParticleParams)); + } + }; + physx_PxDiffuseParticleParams_Pod::dump_layout(sg); + + struct physx_PxParticleSpring_Pod: public physx::PxParticleSpring { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleSpring_Pod", "PxParticleSpring"); + sg.add_field("uint32_t ind0", "ind0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleSpring_Pod, ind0)); + sg.add_field("uint32_t ind1", "ind1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleSpring_Pod, ind1)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, length)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, damping)); + sg.add_field("float pad", "pad", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, pad)); + sg.end_struct(sizeof(physx::PxParticleSpring)); + } + }; + physx_PxParticleSpring_Pod::dump_layout(sg); + + struct physx_PxParticleMaterial_Pod: public physx::PxParticleMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleMaterial_Pod", "PxParticleMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxParticleMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxParticleMaterial)); + } + }; + physx_PxParticleMaterial_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneDesc_Pod;\n"); + sg.pass_thru("struct physx_PxPvd_Pod;\n"); + sg.pass_thru("struct physx_PxOmniPvd_Pod;\n"); + sg.pass_thru("struct physx_PxPhysics_Pod {\n void* vtable_;\n};\n"); + struct physx_PxActorShape_Pod: public physx::PxActorShape { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxActorShape_Pod", "PxActorShape"); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxActorShape_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxActorShape_Pod, shape)); + sg.end_struct(sizeof(physx::PxActorShape)); + } + }; + physx_PxActorShape_Pod::dump_layout(sg); + + struct physx_PxRaycastHit_Pod: public physx::PxRaycastHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastHit_Pod", "PxRaycastHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastHit_Pod, faceIndex)); + sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxRaycastHit_Pod, flags)); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxRaycastHit_Pod, position)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxRaycastHit_Pod, normal)); + sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, distance)); + sg.add_field("float u", "u", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, u)); + sg.add_field("float v", "v", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, v)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxRaycastHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxRaycastHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxRaycastHit)); + } + }; + physx_PxRaycastHit_Pod::dump_layout(sg); + + struct physx_PxOverlapHit_Pod: public physx::PxOverlapHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapHit_Pod", "PxOverlapHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapHit_Pod, faceIndex)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxOverlapHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxOverlapHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxOverlapHit)); + } + }; + physx_PxOverlapHit_Pod::dump_layout(sg); + + struct physx_PxSweepHit_Pod: public physx::PxSweepHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepHit_Pod", "PxSweepHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepHit_Pod, faceIndex)); + sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxSweepHit_Pod, flags)); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSweepHit_Pod, position)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSweepHit_Pod, normal)); + sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxSweepHit_Pod, distance)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxSweepHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxSweepHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxSweepHit)); + } + }; + physx_PxSweepHit_Pod::dump_layout(sg); + + struct physx_PxRaycastCallback_Pod: public physx::PxRaycastCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastCallback_Pod", "PxRaycastCallback"); + sg.add_field("physx_PxRaycastHit_Pod block", "block", "PxRaycastHit", sizeof(physx::PxRaycastHit), unsafe_offsetof(physx_PxRaycastCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxRaycastCallback_Pod, hasBlock)); + sg.add_field("physx_PxRaycastHit_Pod* touches", "touches", "*mut PxRaycastHit", sizeof(physx::PxRaycastHit*), unsafe_offsetof(physx_PxRaycastCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxRaycastCallback)); + } + }; + physx_PxRaycastCallback_Pod::dump_layout(sg); + + struct physx_PxOverlapCallback_Pod: public physx::PxOverlapCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapCallback_Pod", "PxOverlapCallback"); + sg.add_field("physx_PxOverlapHit_Pod block", "block", "PxOverlapHit", sizeof(physx::PxOverlapHit), unsafe_offsetof(physx_PxOverlapCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxOverlapCallback_Pod, hasBlock)); + sg.add_field("physx_PxOverlapHit_Pod* touches", "touches", "*mut PxOverlapHit", sizeof(physx::PxOverlapHit*), unsafe_offsetof(physx_PxOverlapCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxOverlapCallback)); + } + }; + physx_PxOverlapCallback_Pod::dump_layout(sg); + + struct physx_PxSweepCallback_Pod: public physx::PxSweepCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepCallback_Pod", "PxSweepCallback"); + sg.add_field("physx_PxSweepHit_Pod block", "block", "PxSweepHit", sizeof(physx::PxSweepHit), unsafe_offsetof(physx_PxSweepCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxSweepCallback_Pod, hasBlock)); + sg.add_field("physx_PxSweepHit_Pod* touches", "touches", "*mut PxSweepHit", sizeof(physx::PxSweepHit*), unsafe_offsetof(physx_PxSweepCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxSweepCallback)); + } + }; + physx_PxSweepCallback_Pod::dump_layout(sg); + + struct physx_PxRaycastBuffer_Pod: public physx::PxRaycastBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastBuffer_Pod", "PxRaycastBuffer"); + sg.add_field("physx_PxRaycastHit_Pod block", "block", "PxRaycastHit", sizeof(physx::PxRaycastHit), unsafe_offsetof(physx_PxRaycastBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxRaycastBuffer_Pod, hasBlock)); + sg.add_field("physx_PxRaycastHit_Pod* touches", "touches", "*mut PxRaycastHit", sizeof(physx::PxRaycastHit*), unsafe_offsetof(physx_PxRaycastBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxRaycastBuffer)); + } + }; + physx_PxRaycastBuffer_Pod::dump_layout(sg); + + struct physx_PxOverlapBuffer_Pod: public physx::PxOverlapBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapBuffer_Pod", "PxOverlapBuffer"); + sg.add_field("physx_PxOverlapHit_Pod block", "block", "PxOverlapHit", sizeof(physx::PxOverlapHit), unsafe_offsetof(physx_PxOverlapBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxOverlapBuffer_Pod, hasBlock)); + sg.add_field("physx_PxOverlapHit_Pod* touches", "touches", "*mut PxOverlapHit", sizeof(physx::PxOverlapHit*), unsafe_offsetof(physx_PxOverlapBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxOverlapBuffer)); + } + }; + physx_PxOverlapBuffer_Pod::dump_layout(sg); + + struct physx_PxSweepBuffer_Pod: public physx::PxSweepBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepBuffer_Pod", "PxSweepBuffer"); + sg.add_field("physx_PxSweepHit_Pod block", "block", "PxSweepHit", sizeof(physx::PxSweepHit), unsafe_offsetof(physx_PxSweepBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxSweepBuffer_Pod, hasBlock)); + sg.add_field("physx_PxSweepHit_Pod* touches", "touches", "*mut PxSweepHit", sizeof(physx::PxSweepHit*), unsafe_offsetof(physx_PxSweepBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxSweepBuffer)); + } + }; + physx_PxSweepBuffer_Pod::dump_layout(sg); + + struct physx_PxQueryCache_Pod: public physx::PxQueryCache { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxQueryCache_Pod", "PxQueryCache"); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxQueryCache_Pod, shape)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxQueryCache_Pod, actor)); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxQueryCache_Pod, faceIndex)); + sg.end_struct(sizeof(physx::PxQueryCache)); + } + }; + physx_PxQueryCache_Pod::dump_layout(sg); + + struct physx_PxQueryFilterData_Pod: public physx::PxQueryFilterData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxQueryFilterData_Pod", "PxQueryFilterData"); + sg.add_field("physx_PxFilterData_Pod data", "data", "PxFilterData", sizeof(physx::PxFilterData), unsafe_offsetof(physx_PxQueryFilterData_Pod, data)); + sg.add_field("uint16_t flags", "flags", "PxQueryFlags", sizeof(physx::PxQueryFlags), unsafe_offsetof(physx_PxQueryFilterData_Pod, flags)); + sg.end_struct(sizeof(physx::PxQueryFilterData)); + } + }; + physx_PxQueryFilterData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxQueryFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxRigidDynamic_Pod: public physx::PxRigidDynamic { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidDynamic_Pod", "PxRigidDynamic"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidDynamic_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidDynamic)); + } + }; + physx_PxRigidDynamic_Pod::dump_layout(sg); + + struct physx_PxRigidStatic_Pod: public physx::PxRigidStatic { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidStatic_Pod", "PxRigidStatic"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidStatic_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidStatic)); + } + }; + physx_PxRigidStatic_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneQuerySystem_Pod;\n"); + struct physx_PxSceneQueryDesc_Pod: public physx::PxSceneQueryDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneQueryDesc_Pod", "PxSceneQueryDesc"); + sg.add_field("int32_t staticStructure", "staticStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticStructure)); + sg.add_field("int32_t dynamicStructure", "dynamicStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicStructure)); + sg.add_field("uint32_t dynamicTreeRebuildRateHint", "dynamicTreeRebuildRateHint", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicTreeRebuildRateHint)); + sg.add_field("int32_t dynamicTreeSecondaryPruner", "dynamicTreeSecondaryPruner", "PxDynamicTreeSecondaryPruner", sizeof(physx::PxDynamicTreeSecondaryPruner::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicTreeSecondaryPruner)); + sg.add_field("int32_t staticBVHBuildStrategy", "staticBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticBVHBuildStrategy)); + sg.add_field("int32_t dynamicBVHBuildStrategy", "dynamicBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicBVHBuildStrategy)); + sg.add_field("uint32_t staticNbObjectsPerNode", "staticNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticNbObjectsPerNode)); + sg.add_field("uint32_t dynamicNbObjectsPerNode", "dynamicNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicNbObjectsPerNode)); + sg.add_field("int32_t sceneQueryUpdateMode", "sceneQueryUpdateMode", "PxSceneQueryUpdateMode", sizeof(physx::PxSceneQueryUpdateMode::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, sceneQueryUpdateMode)); + sg.end_struct(sizeof(physx::PxSceneQueryDesc)); + } + }; + physx_PxSceneQueryDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneQuerySystemBase_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSceneSQSystem_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSceneQuerySystem_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBroadPhaseRegion_Pod: public physx::PxBroadPhaseRegion { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseRegion_Pod", "PxBroadPhaseRegion"); + sg.add_field("physx_PxBounds3_Pod mBounds", "mBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxBroadPhaseRegion_Pod, mBounds)); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBroadPhaseRegion_Pod, mUserData)); + sg.end_struct(sizeof(physx::PxBroadPhaseRegion)); + } + }; + physx_PxBroadPhaseRegion_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseRegionInfo_Pod: public physx::PxBroadPhaseRegionInfo { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseRegionInfo_Pod", "PxBroadPhaseRegionInfo"); + sg.add_field("physx_PxBroadPhaseRegion_Pod mRegion", "mRegion", "PxBroadPhaseRegion", sizeof(physx::PxBroadPhaseRegion), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mRegion)); + sg.add_field("uint32_t mNbStaticObjects", "mNbStaticObjects", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mNbStaticObjects)); + sg.add_field("uint32_t mNbDynamicObjects", "mNbDynamicObjects", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mNbDynamicObjects)); + sg.add_field("bool mActive", "mActive", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mActive)); + sg.add_field("bool mOverlap", "mOverlap", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mOverlap)); + sg.end_struct(sizeof(physx::PxBroadPhaseRegionInfo)); + } + }; + physx_PxBroadPhaseRegionInfo_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseCaps_Pod: public physx::PxBroadPhaseCaps { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseCaps_Pod", "PxBroadPhaseCaps"); + sg.add_field("uint32_t mMaxNbRegions", "mMaxNbRegions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseCaps_Pod, mMaxNbRegions)); + sg.end_struct(sizeof(physx::PxBroadPhaseCaps)); + } + }; + physx_PxBroadPhaseCaps_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseDesc_Pod: public physx::PxBroadPhaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseDesc_Pod", "PxBroadPhaseDesc"); + sg.add_field("int32_t mType", "mType", "PxBroadPhaseType", sizeof(physx::PxBroadPhaseType::Enum), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mType)); + sg.add_field("uint64_t mContextID", "mContextID", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mContextID)); + sg.add_field("uint32_t mFoundLostPairsCapacity", "mFoundLostPairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mFoundLostPairsCapacity)); + sg.add_field("bool mDiscardStaticVsKinematic", "mDiscardStaticVsKinematic", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mDiscardStaticVsKinematic)); + sg.add_field("bool mDiscardKinematicVsKinematic", "mDiscardKinematicVsKinematic", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mDiscardKinematicVsKinematic)); + sg.end_struct(sizeof(physx::PxBroadPhaseDesc)); + } + }; + physx_PxBroadPhaseDesc_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseUpdateData_Pod: public physx::PxBroadPhaseUpdateData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseUpdateData_Pod", "PxBroadPhaseUpdateData"); + sg.add_field("uint32_t const* mCreated", "mCreated", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mCreated)); + sg.add_field("uint32_t mNbCreated", "mNbCreated", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbCreated)); + sg.add_field("uint32_t const* mUpdated", "mUpdated", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mUpdated)); + sg.add_field("uint32_t mNbUpdated", "mNbUpdated", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbUpdated)); + sg.add_field("uint32_t const* mRemoved", "mRemoved", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mRemoved)); + sg.add_field("uint32_t mNbRemoved", "mNbRemoved", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbRemoved)); + sg.add_field("physx_PxBounds3_Pod const* mBounds", "mBounds", "*const PxBounds3", sizeof(physx::PxBounds3 const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mBounds)); + sg.add_field("uint32_t const* mGroups", "mGroups", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mGroups)); + sg.add_field("float const* mDistances", "mDistances", "*const f32", sizeof(float const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mDistances)); + sg.add_field("uint32_t mCapacity", "mCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mCapacity)); + sg.end_struct(sizeof(physx::PxBroadPhaseUpdateData)); + } + }; + physx_PxBroadPhaseUpdateData_Pod::dump_layout(sg); + + struct physx_PxBroadPhasePair_Pod: public physx::PxBroadPhasePair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhasePair_Pod", "PxBroadPhasePair"); + sg.add_field("uint32_t mID0", "mID0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhasePair_Pod, mID0)); + sg.add_field("uint32_t mID1", "mID1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhasePair_Pod, mID1)); + sg.end_struct(sizeof(physx::PxBroadPhasePair)); + } + }; + physx_PxBroadPhasePair_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseResults_Pod: public physx::PxBroadPhaseResults { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseResults_Pod", "PxBroadPhaseResults"); + sg.add_field("uint32_t mNbCreatedPairs", "mNbCreatedPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mNbCreatedPairs)); + sg.add_field("physx_PxBroadPhasePair_Pod const* mCreatedPairs", "mCreatedPairs", "*const PxBroadPhasePair", sizeof(physx::PxBroadPhasePair const*), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mCreatedPairs)); + sg.add_field("uint32_t mNbDeletedPairs", "mNbDeletedPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mNbDeletedPairs)); + sg.add_field("physx_PxBroadPhasePair_Pod const* mDeletedPairs", "mDeletedPairs", "*const PxBroadPhasePair", sizeof(physx::PxBroadPhasePair const*), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mDeletedPairs)); + sg.end_struct(sizeof(physx::PxBroadPhaseResults)); + } + }; + physx_PxBroadPhaseResults_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBroadPhaseRegions_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBroadPhase_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAABBManager_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBroadPhaseCallback_Pod;\n"); + sg.pass_thru("struct physx_PxSimulationEventCallback_Pod;\n"); + struct physx_PxSceneLimits_Pod: public physx::PxSceneLimits { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneLimits_Pod", "PxSceneLimits"); + sg.add_field("uint32_t maxNbActors", "maxNbActors", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbActors)); + sg.add_field("uint32_t maxNbBodies", "maxNbBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbBodies)); + sg.add_field("uint32_t maxNbStaticShapes", "maxNbStaticShapes", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbStaticShapes)); + sg.add_field("uint32_t maxNbDynamicShapes", "maxNbDynamicShapes", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbDynamicShapes)); + sg.add_field("uint32_t maxNbAggregates", "maxNbAggregates", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbAggregates)); + sg.add_field("uint32_t maxNbConstraints", "maxNbConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbConstraints)); + sg.add_field("uint32_t maxNbRegions", "maxNbRegions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbRegions)); + sg.add_field("uint32_t maxNbBroadPhaseOverlaps", "maxNbBroadPhaseOverlaps", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbBroadPhaseOverlaps)); + sg.end_struct(sizeof(physx::PxSceneLimits)); + } + }; + physx_PxSceneLimits_Pod::dump_layout(sg); + + struct physx_PxgDynamicsMemoryConfig_Pod: public physx::PxgDynamicsMemoryConfig { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxgDynamicsMemoryConfig_Pod", "PxgDynamicsMemoryConfig"); + sg.add_field("uint32_t tempBufferCapacity", "tempBufferCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, tempBufferCapacity)); + sg.add_field("uint32_t maxRigidContactCount", "maxRigidContactCount", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxRigidContactCount)); + sg.add_field("uint32_t maxRigidPatchCount", "maxRigidPatchCount", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxRigidPatchCount)); + sg.add_field("uint32_t heapCapacity", "heapCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, heapCapacity)); + sg.add_field("uint32_t foundLostPairsCapacity", "foundLostPairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, foundLostPairsCapacity)); + sg.add_field("uint32_t foundLostAggregatePairsCapacity", "foundLostAggregatePairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, foundLostAggregatePairsCapacity)); + sg.add_field("uint32_t totalAggregatePairsCapacity", "totalAggregatePairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, totalAggregatePairsCapacity)); + sg.add_field("uint32_t maxSoftBodyContacts", "maxSoftBodyContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxSoftBodyContacts)); + sg.add_field("uint32_t maxFemClothContacts", "maxFemClothContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxFemClothContacts)); + sg.add_field("uint32_t maxParticleContacts", "maxParticleContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxParticleContacts)); + sg.add_field("uint32_t collisionStackSize", "collisionStackSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, collisionStackSize)); + sg.add_field("uint32_t maxHairContacts", "maxHairContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxHairContacts)); + sg.end_struct(sizeof(physx::PxgDynamicsMemoryConfig)); + } + }; + physx_PxgDynamicsMemoryConfig_Pod::dump_layout(sg); + + struct physx_PxSceneDesc_Pod: public physx::PxSceneDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneDesc_Pod", "PxSceneDesc"); + sg.add_field("int32_t staticStructure", "staticStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticStructure)); + sg.add_field("int32_t dynamicStructure", "dynamicStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicStructure)); + sg.add_field("uint32_t dynamicTreeRebuildRateHint", "dynamicTreeRebuildRateHint", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicTreeRebuildRateHint)); + sg.add_field("int32_t dynamicTreeSecondaryPruner", "dynamicTreeSecondaryPruner", "PxDynamicTreeSecondaryPruner", sizeof(physx::PxDynamicTreeSecondaryPruner::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicTreeSecondaryPruner)); + sg.add_field("int32_t staticBVHBuildStrategy", "staticBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticBVHBuildStrategy)); + sg.add_field("int32_t dynamicBVHBuildStrategy", "dynamicBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicBVHBuildStrategy)); + sg.add_field("uint32_t staticNbObjectsPerNode", "staticNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, staticNbObjectsPerNode)); + sg.add_field("uint32_t dynamicNbObjectsPerNode", "dynamicNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicNbObjectsPerNode)); + sg.add_field("int32_t sceneQueryUpdateMode", "sceneQueryUpdateMode", "PxSceneQueryUpdateMode", sizeof(physx::PxSceneQueryUpdateMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, sceneQueryUpdateMode)); + sg.add_field("physx_PxVec3_Pod gravity", "gravity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSceneDesc_Pod, gravity)); + sg.add_field("physx_PxSimulationEventCallback_Pod* simulationEventCallback", "simulationEventCallback", "*mut PxSimulationEventCallback", sizeof(physx::PxSimulationEventCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, simulationEventCallback)); + sg.add_field("physx_PxContactModifyCallback_Pod* contactModifyCallback", "contactModifyCallback", "*mut PxContactModifyCallback", sizeof(physx::PxContactModifyCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, contactModifyCallback)); + sg.add_field("physx_PxCCDContactModifyCallback_Pod* ccdContactModifyCallback", "ccdContactModifyCallback", "*mut PxCCDContactModifyCallback", sizeof(physx::PxCCDContactModifyCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdContactModifyCallback)); + sg.add_field("void const* filterShaderData", "filterShaderData", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShaderData)); + sg.add_field("uint32_t filterShaderDataSize", "filterShaderDataSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShaderDataSize)); + sg.add_field("void * filterShader", "filterShader", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShader)); + sg.add_field("physx_PxSimulationFilterCallback_Pod* filterCallback", "filterCallback", "*mut PxSimulationFilterCallback", sizeof(physx::PxSimulationFilterCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, filterCallback)); + sg.add_field("int32_t kineKineFilteringMode", "kineKineFilteringMode", "PxPairFilteringMode", sizeof(physx::PxPairFilteringMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, kineKineFilteringMode)); + sg.add_field("int32_t staticKineFilteringMode", "staticKineFilteringMode", "PxPairFilteringMode", sizeof(physx::PxPairFilteringMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticKineFilteringMode)); + sg.add_field("int32_t broadPhaseType", "broadPhaseType", "PxBroadPhaseType", sizeof(physx::PxBroadPhaseType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, broadPhaseType)); + sg.add_field("physx_PxBroadPhaseCallback_Pod* broadPhaseCallback", "broadPhaseCallback", "*mut PxBroadPhaseCallback", sizeof(physx::PxBroadPhaseCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, broadPhaseCallback)); + sg.add_field("physx_PxSceneLimits_Pod limits", "limits", "PxSceneLimits", sizeof(physx::PxSceneLimits), unsafe_offsetof(physx_PxSceneDesc_Pod, limits)); + sg.add_field("int32_t frictionType", "frictionType", "PxFrictionType", sizeof(physx::PxFrictionType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionType)); + sg.add_field("int32_t solverType", "solverType", "PxSolverType", sizeof(physx::PxSolverType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, solverType)); + sg.add_field("float bounceThresholdVelocity", "bounceThresholdVelocity", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, bounceThresholdVelocity)); + sg.add_field("float frictionOffsetThreshold", "frictionOffsetThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionOffsetThreshold)); + sg.add_field("float frictionCorrelationDistance", "frictionCorrelationDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionCorrelationDistance)); + sg.add_field("uint32_t flags", "flags", "PxSceneFlags", sizeof(physx::PxSceneFlags), unsafe_offsetof(physx_PxSceneDesc_Pod, flags)); + sg.add_field("physx_PxCpuDispatcher_Pod* cpuDispatcher", "cpuDispatcher", "*mut PxCpuDispatcher", sizeof(physx::PxCpuDispatcher*), unsafe_offsetof(physx_PxSceneDesc_Pod, cpuDispatcher)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSceneDesc_Pod, userData)); + sg.add_field("uint32_t solverBatchSize", "solverBatchSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, solverBatchSize)); + sg.add_field("uint32_t solverArticulationBatchSize", "solverArticulationBatchSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, solverArticulationBatchSize)); + sg.add_field("uint32_t nbContactDataBlocks", "nbContactDataBlocks", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, nbContactDataBlocks)); + sg.add_field("uint32_t maxNbContactDataBlocks", "maxNbContactDataBlocks", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, maxNbContactDataBlocks)); + sg.add_field("float maxBiasCoefficient", "maxBiasCoefficient", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, maxBiasCoefficient)); + sg.add_field("uint32_t contactReportStreamBufferSize", "contactReportStreamBufferSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, contactReportStreamBufferSize)); + sg.add_field("uint32_t ccdMaxPasses", "ccdMaxPasses", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdMaxPasses)); + sg.add_field("float ccdThreshold", "ccdThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdThreshold)); + sg.add_field("float ccdMaxSeparation", "ccdMaxSeparation", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdMaxSeparation)); + sg.add_field("float wakeCounterResetValue", "wakeCounterResetValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, wakeCounterResetValue)); + sg.add_field("physx_PxBounds3_Pod sanityBounds", "sanityBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxSceneDesc_Pod, sanityBounds)); + sg.add_field("physx_PxgDynamicsMemoryConfig_Pod gpuDynamicsConfig", "gpuDynamicsConfig", "PxgDynamicsMemoryConfig", sizeof(physx::PxgDynamicsMemoryConfig), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuDynamicsConfig)); + sg.add_field("uint32_t gpuMaxNumPartitions", "gpuMaxNumPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuMaxNumPartitions)); + sg.add_field("uint32_t gpuMaxNumStaticPartitions", "gpuMaxNumStaticPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuMaxNumStaticPartitions)); + sg.add_field("uint32_t gpuComputeVersion", "gpuComputeVersion", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuComputeVersion)); + sg.add_field("uint32_t contactPairSlabSize", "contactPairSlabSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, contactPairSlabSize)); + sg.add_field("physx_PxSceneQuerySystem_Pod* sceneQuerySystem", "sceneQuerySystem", "*mut PxSceneQuerySystem", sizeof(physx::PxSceneQuerySystem*), unsafe_offsetof(physx_PxSceneDesc_Pod, sceneQuerySystem)); + sg.end_struct(sizeof(physx::PxSceneDesc)); + } + }; + physx_PxSceneDesc_Pod::dump_layout(sg); + + struct physx_PxSimulationStatistics_Pod: public physx::PxSimulationStatistics { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimulationStatistics_Pod", "PxSimulationStatistics"); + sg.add_field("uint32_t nbActiveConstraints", "nbActiveConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveConstraints)); + sg.add_field("uint32_t nbActiveDynamicBodies", "nbActiveDynamicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveDynamicBodies)); + sg.add_field("uint32_t nbActiveKinematicBodies", "nbActiveKinematicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveKinematicBodies)); + sg.add_field("uint32_t nbStaticBodies", "nbStaticBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbStaticBodies)); + sg.add_field("uint32_t nbDynamicBodies", "nbDynamicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDynamicBodies)); + sg.add_field("uint32_t nbKinematicBodies", "nbKinematicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbKinematicBodies)); + sg.add_field("uint32_t nbShapes[11]", "nbShapes", "[u32; 11]", sizeof(uint32_t[11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbShapes)); + sg.add_field("uint32_t nbAggregates", "nbAggregates", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbAggregates)); + sg.add_field("uint32_t nbArticulations", "nbArticulations", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbArticulations)); + sg.add_field("uint32_t nbAxisSolverConstraints", "nbAxisSolverConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbAxisSolverConstraints)); + sg.add_field("uint32_t compressedContactSize", "compressedContactSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, compressedContactSize)); + sg.add_field("uint32_t requiredContactConstraintMemory", "requiredContactConstraintMemory", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, requiredContactConstraintMemory)); + sg.add_field("uint32_t peakConstraintMemory", "peakConstraintMemory", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, peakConstraintMemory)); + sg.add_field("uint32_t nbDiscreteContactPairsTotal", "nbDiscreteContactPairsTotal", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsTotal)); + sg.add_field("uint32_t nbDiscreteContactPairsWithCacheHits", "nbDiscreteContactPairsWithCacheHits", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsWithCacheHits)); + sg.add_field("uint32_t nbDiscreteContactPairsWithContacts", "nbDiscreteContactPairsWithContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsWithContacts)); + sg.add_field("uint32_t nbNewPairs", "nbNewPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbNewPairs)); + sg.add_field("uint32_t nbLostPairs", "nbLostPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbLostPairs)); + sg.add_field("uint32_t nbNewTouches", "nbNewTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbNewTouches)); + sg.add_field("uint32_t nbLostTouches", "nbLostTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbLostTouches)); + sg.add_field("uint32_t nbPartitions", "nbPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbPartitions)); + sg.add_field("uint64_t gpuMemParticles", "gpuMemParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemParticles)); + sg.add_field("uint64_t gpuMemSoftBodies", "gpuMemSoftBodies", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemSoftBodies)); + sg.add_field("uint64_t gpuMemFEMCloths", "gpuMemFEMCloths", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemFEMCloths)); + sg.add_field("uint64_t gpuMemHairSystems", "gpuMemHairSystems", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHairSystems)); + sg.add_field("uint64_t gpuMemHeap", "gpuMemHeap", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeap)); + sg.add_field("uint64_t gpuMemHeapBroadPhase", "gpuMemHeapBroadPhase", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapBroadPhase)); + sg.add_field("uint64_t gpuMemHeapNarrowPhase", "gpuMemHeapNarrowPhase", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapNarrowPhase)); + sg.add_field("uint64_t gpuMemHeapSolver", "gpuMemHeapSolver", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSolver)); + sg.add_field("uint64_t gpuMemHeapArticulation", "gpuMemHeapArticulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapArticulation)); + sg.add_field("uint64_t gpuMemHeapSimulation", "gpuMemHeapSimulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulation)); + sg.add_field("uint64_t gpuMemHeapSimulationArticulation", "gpuMemHeapSimulationArticulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationArticulation)); + sg.add_field("uint64_t gpuMemHeapSimulationParticles", "gpuMemHeapSimulationParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationParticles)); + sg.add_field("uint64_t gpuMemHeapSimulationSoftBody", "gpuMemHeapSimulationSoftBody", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationSoftBody)); + sg.add_field("uint64_t gpuMemHeapSimulationFEMCloth", "gpuMemHeapSimulationFEMCloth", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationFEMCloth)); + sg.add_field("uint64_t gpuMemHeapSimulationHairSystem", "gpuMemHeapSimulationHairSystem", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationHairSystem)); + sg.add_field("uint64_t gpuMemHeapParticles", "gpuMemHeapParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapParticles)); + sg.add_field("uint64_t gpuMemHeapSoftBodies", "gpuMemHeapSoftBodies", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSoftBodies)); + sg.add_field("uint64_t gpuMemHeapFEMCloths", "gpuMemHeapFEMCloths", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapFEMCloths)); + sg.add_field("uint64_t gpuMemHeapHairSystems", "gpuMemHeapHairSystems", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapHairSystems)); + sg.add_field("uint64_t gpuMemHeapOther", "gpuMemHeapOther", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapOther)); + sg.add_field("uint32_t nbBroadPhaseAdds", "nbBroadPhaseAdds", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbBroadPhaseAdds)); + sg.add_field("uint32_t nbBroadPhaseRemoves", "nbBroadPhaseRemoves", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbBroadPhaseRemoves)); + sg.add_field("uint32_t nbDiscreteContactPairs[11][11]", "nbDiscreteContactPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairs)); + sg.add_field("uint32_t nbCCDPairs[11][11]", "nbCCDPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbCCDPairs)); + sg.add_field("uint32_t nbModifiedContactPairs[11][11]", "nbModifiedContactPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbModifiedContactPairs)); + sg.add_field("uint32_t nbTriggerPairs[11][11]", "nbTriggerPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbTriggerPairs)); + sg.end_struct(sizeof(physx::PxSimulationStatistics)); + } + }; + physx_PxSimulationStatistics_Pod::dump_layout(sg); + + struct physx_PxGpuBodyData_Pod: public physx::PxGpuBodyData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuBodyData_Pod", "PxGpuBodyData"); + sg.add_field("physx_PxQuat_Pod quat", "quat", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxGpuBodyData_Pod, quat)); + sg.add_field("physx_PxVec4_Pod pos", "pos", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, pos)); + sg.add_field("physx_PxVec4_Pod linVel", "linVel", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, linVel)); + sg.add_field("physx_PxVec4_Pod angVel", "angVel", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, angVel)); + sg.end_struct(sizeof(physx::PxGpuBodyData)); + } + }; + physx_PxGpuBodyData_Pod::dump_layout(sg); + + struct physx_PxGpuActorPair_Pod: public physx::PxGpuActorPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuActorPair_Pod", "PxGpuActorPair"); + sg.add_field("uint32_t srcIndex", "srcIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuActorPair_Pod, srcIndex)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex", "nodeIndex", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuActorPair_Pod, nodeIndex)); + sg.end_struct(sizeof(physx::PxGpuActorPair)); + } + }; + physx_PxGpuActorPair_Pod::dump_layout(sg); + + struct physx_PxIndexDataPair_Pod: public physx::PxIndexDataPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxIndexDataPair_Pod", "PxIndexDataPair"); + sg.add_field("uint32_t index", "index", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxIndexDataPair_Pod, index)); + sg.add_field("void* data", "data", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxIndexDataPair_Pod, data)); + sg.end_struct(sizeof(physx::PxIndexDataPair)); + } + }; + physx_PxIndexDataPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxPvdSceneClient_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxContactPairHeader_Pod;\n"); + struct physx_PxDominanceGroupPair_Pod: public physx::PxDominanceGroupPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDominanceGroupPair_Pod", "PxDominanceGroupPair"); + sg.add_field("uint8_t dominance0", "dominance0", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxDominanceGroupPair_Pod, dominance0)); + sg.add_field("uint8_t dominance1", "dominance1", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxDominanceGroupPair_Pod, dominance1)); + sg.end_struct(sizeof(physx::PxDominanceGroupPair)); + } + }; + physx_PxDominanceGroupPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBroadPhaseCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxScene_Pod: public physx::PxScene { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxScene_Pod", "PxScene"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxScene_Pod, userData)); + sg.end_struct(sizeof(physx::PxScene)); + } + }; + physx_PxScene_Pod::dump_layout(sg); + + struct physx_PxSceneReadLock_Pod: public physx::PxSceneReadLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneReadLock_Pod", "PxSceneReadLock"); + sg.end_struct(sizeof(physx::PxSceneReadLock)); + } + }; + physx_PxSceneReadLock_Pod::dump_layout(sg); + + struct physx_PxSceneWriteLock_Pod: public physx::PxSceneWriteLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneWriteLock_Pod", "PxSceneWriteLock"); + sg.end_struct(sizeof(physx::PxSceneWriteLock)); + } + }; + physx_PxSceneWriteLock_Pod::dump_layout(sg); + + struct physx_PxContactPairExtraDataItem_Pod: public physx::PxContactPairExtraDataItem { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairExtraDataItem_Pod", "PxContactPairExtraDataItem"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairExtraDataItem_Pod, type)); + sg.end_struct(sizeof(physx::PxContactPairExtraDataItem)); + } + }; + physx_PxContactPairExtraDataItem_Pod::dump_layout(sg); + + struct physx_PxContactPairVelocity_Pod: public physx::PxContactPairVelocity { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairVelocity_Pod", "PxContactPairVelocity"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairVelocity_Pod, type)); + sg.add_field("physx_PxVec3_Pod linearVelocity[2]", "linearVelocity", "[PxVec3; 2]", sizeof(physx::PxVec3[2]), unsafe_offsetof(physx_PxContactPairVelocity_Pod, linearVelocity)); + sg.add_field("physx_PxVec3_Pod angularVelocity[2]", "angularVelocity", "[PxVec3; 2]", sizeof(physx::PxVec3[2]), unsafe_offsetof(physx_PxContactPairVelocity_Pod, angularVelocity)); + sg.end_struct(sizeof(physx::PxContactPairVelocity)); + } + }; + physx_PxContactPairVelocity_Pod::dump_layout(sg); + + struct physx_PxContactPairPose_Pod: public physx::PxContactPairPose { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairPose_Pod", "PxContactPairPose"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairPose_Pod, type)); + sg.add_field("physx_PxTransform_Pod globalPose[2]", "globalPose", "[PxTransform; 2]", sizeof(physx::PxTransform[2]), unsafe_offsetof(physx_PxContactPairPose_Pod, globalPose)); + sg.end_struct(sizeof(physx::PxContactPairPose)); + } + }; + physx_PxContactPairPose_Pod::dump_layout(sg); + + struct physx_PxContactPairIndex_Pod: public physx::PxContactPairIndex { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairIndex_Pod", "PxContactPairIndex"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairIndex_Pod, type)); + sg.add_field("uint16_t index", "index", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPairIndex_Pod, index)); + sg.end_struct(sizeof(physx::PxContactPairIndex)); + } + }; + physx_PxContactPairIndex_Pod::dump_layout(sg); + + struct physx_PxContactPairExtraDataIterator_Pod: public physx::PxContactPairExtraDataIterator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairExtraDataIterator_Pod", "PxContactPairExtraDataIterator"); + sg.add_field("uint8_t const* currPtr", "currPtr", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, currPtr)); + sg.add_field("uint8_t const* endPtr", "endPtr", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, endPtr)); + sg.add_field("physx_PxContactPairVelocity_Pod const* preSolverVelocity", "preSolverVelocity", "*const PxContactPairVelocity", sizeof(physx::PxContactPairVelocity const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, preSolverVelocity)); + sg.add_field("physx_PxContactPairVelocity_Pod const* postSolverVelocity", "postSolverVelocity", "*const PxContactPairVelocity", sizeof(physx::PxContactPairVelocity const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, postSolverVelocity)); + sg.add_field("physx_PxContactPairPose_Pod const* eventPose", "eventPose", "*const PxContactPairPose", sizeof(physx::PxContactPairPose const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, eventPose)); + sg.add_field("uint32_t contactPairIndex", "contactPairIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, contactPairIndex)); + sg.end_struct(sizeof(physx::PxContactPairExtraDataIterator)); + } + }; + physx_PxContactPairExtraDataIterator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxContactPair_Pod;\n"); + struct physx_PxContactPairHeader_Pod: public physx::PxContactPairHeader { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairHeader_Pod", "PxContactPairHeader"); + sg.add_field("physx_PxActor_Pod* actors[2]", "actors", "[*mut PxActor; 2]", sizeof(physx::PxActor*[2]), unsafe_offsetof(physx_PxContactPairHeader_Pod, actors)); + sg.add_field("uint8_t const* extraDataStream", "extraDataStream", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairHeader_Pod, extraDataStream)); + sg.add_field("uint16_t extraDataStreamSize", "extraDataStreamSize", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPairHeader_Pod, extraDataStreamSize)); + sg.add_field("uint16_t flags", "flags", "PxContactPairHeaderFlags", sizeof(physx::PxContactPairHeaderFlags), unsafe_offsetof(physx_PxContactPairHeader_Pod, flags)); + sg.add_field("physx_PxContactPair_Pod const* pairs", "pairs", "*const PxContactPair", sizeof(physx::PxContactPair const*), unsafe_offsetof(physx_PxContactPairHeader_Pod, pairs)); + sg.add_field("uint32_t nbPairs", "nbPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairHeader_Pod, nbPairs)); + sg.end_struct(sizeof(physx::PxContactPairHeader)); + } + }; + physx_PxContactPairHeader_Pod::dump_layout(sg); + + struct physx_PxContactPairPoint_Pod: public physx::PxContactPairPoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairPoint_Pod", "PxContactPairPoint"); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, position)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPairPoint_Pod, separation)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, normal)); + sg.add_field("uint32_t internalFaceIndex0", "internalFaceIndex0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairPoint_Pod, internalFaceIndex0)); + sg.add_field("physx_PxVec3_Pod impulse", "impulse", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, impulse)); + sg.add_field("uint32_t internalFaceIndex1", "internalFaceIndex1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairPoint_Pod, internalFaceIndex1)); + sg.end_struct(sizeof(physx::PxContactPairPoint)); + } + }; + physx_PxContactPairPoint_Pod::dump_layout(sg); + + struct physx_PxContactPair_Pod: public physx::PxContactPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPair_Pod", "PxContactPair"); + sg.add_field("physx_PxShape_Pod* shapes[2]", "shapes", "[*mut PxShape; 2]", sizeof(physx::PxShape*[2]), unsafe_offsetof(physx_PxContactPair_Pod, shapes)); + sg.add_field("uint8_t const* contactPatches", "contactPatches", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPair_Pod, contactPatches)); + sg.add_field("uint8_t const* contactPoints", "contactPoints", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPair_Pod, contactPoints)); + sg.add_field("float const* contactImpulses", "contactImpulses", "*const f32", sizeof(float const*), unsafe_offsetof(physx_PxContactPair_Pod, contactImpulses)); + sg.add_field("uint32_t requiredBufferSize", "requiredBufferSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPair_Pod, requiredBufferSize)); + sg.add_field("uint8_t contactCount", "contactCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPair_Pod, contactCount)); + sg.add_field("uint8_t patchCount", "patchCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPair_Pod, patchCount)); + sg.add_field("uint16_t contactStreamSize", "contactStreamSize", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPair_Pod, contactStreamSize)); + sg.add_field("uint16_t flags", "flags", "PxContactPairFlags", sizeof(physx::PxContactPairFlags), unsafe_offsetof(physx_PxContactPair_Pod, flags)); + sg.add_field("uint16_t events", "events", "PxPairFlags", sizeof(physx::PxPairFlags), unsafe_offsetof(physx_PxContactPair_Pod, events)); + sg.add_field("uint32_t internalData[2]", "internalData", "[u32; 2]", sizeof(uint32_t[2]), unsafe_offsetof(physx_PxContactPair_Pod, internalData)); + sg.end_struct(sizeof(physx::PxContactPair)); + } + }; + physx_PxContactPair_Pod::dump_layout(sg); + + struct physx_PxTriggerPair_Pod: public physx::PxTriggerPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriggerPair_Pod", "PxTriggerPair"); + sg.add_field("physx_PxShape_Pod* triggerShape", "triggerShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxTriggerPair_Pod, triggerShape)); + sg.add_field("physx_PxActor_Pod* triggerActor", "triggerActor", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxTriggerPair_Pod, triggerActor)); + sg.add_field("physx_PxShape_Pod* otherShape", "otherShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxTriggerPair_Pod, otherShape)); + sg.add_field("physx_PxActor_Pod* otherActor", "otherActor", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxTriggerPair_Pod, otherActor)); + sg.add_field("int32_t status", "status", "PxPairFlag", sizeof(physx::PxPairFlag::Enum), unsafe_offsetof(physx_PxTriggerPair_Pod, status)); + sg.add_field("uint8_t flags", "flags", "PxTriggerPairFlags", sizeof(physx::PxTriggerPairFlags), unsafe_offsetof(physx_PxTriggerPair_Pod, flags)); + sg.end_struct(sizeof(physx::PxTriggerPair)); + } + }; + physx_PxTriggerPair_Pod::dump_layout(sg); + + struct physx_PxConstraintInfo_Pod: public physx::PxConstraintInfo { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraintInfo_Pod", "PxConstraintInfo"); + sg.add_field("physx_PxConstraint_Pod* constraint", "constraint", "*mut PxConstraint", sizeof(physx::PxConstraint*), unsafe_offsetof(physx_PxConstraintInfo_Pod, constraint)); + sg.add_field("void* externalReference", "externalReference", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxConstraintInfo_Pod, externalReference)); + sg.add_field("uint32_t type", "type_", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxConstraintInfo_Pod, type)); + sg.end_struct(sizeof(physx::PxConstraintInfo)); + } + }; + physx_PxConstraintInfo_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSimulationEventCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxFEMParameters_Pod: public physx::PxFEMParameters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFEMParameters_Pod", "PxFEMParameters"); + sg.add_field("float velocityDamping", "velocityDamping", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, velocityDamping)); + sg.add_field("float settlingThreshold", "settlingThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, settlingThreshold)); + sg.add_field("float sleepThreshold", "sleepThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, sleepThreshold)); + sg.add_field("float sleepDamping", "sleepDamping", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, sleepDamping)); + sg.add_field("float selfCollisionFilterDistance", "selfCollisionFilterDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, selfCollisionFilterDistance)); + sg.add_field("float selfCollisionStressTolerance", "selfCollisionStressTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, selfCollisionStressTolerance)); + sg.end_struct(sizeof(physx::PxFEMParameters)); + } + }; + physx_PxFEMParameters_Pod::dump_layout(sg); + + struct physx_PxPruningStructure_Pod: public physx::PxPruningStructure { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPruningStructure_Pod", "PxPruningStructure"); + sg.end_struct(sizeof(physx::PxPruningStructure)); + } + }; + physx_PxPruningStructure_Pod::dump_layout(sg); + + struct physx_PxExtendedVec3_Pod: public physx::PxExtendedVec3 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxExtendedVec3_Pod", "PxExtendedVec3"); + sg.add_field("double x", "x", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, x)); + sg.add_field("double y", "y", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, y)); + sg.add_field("double z", "z", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, z)); + sg.end_struct(sizeof(physx::PxExtendedVec3)); + } + }; + physx_PxExtendedVec3_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxControllerManager_Pod;\n"); + struct physx_PxObstacle_Pod: public physx::PxObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxObstacle_Pod", "PxObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxObstacle_Pod, mRot)); + sg.end_struct(sizeof(physx::PxObstacle)); + } + }; + physx_PxObstacle_Pod::dump_layout(sg); + + struct physx_PxBoxObstacle_Pod: public physx::PxBoxObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBoxObstacle_Pod", "PxBoxObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBoxObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxBoxObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxBoxObstacle_Pod, mRot)); + sg.add_field("physx_PxVec3_Pod mHalfExtents", "mHalfExtents", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBoxObstacle_Pod, mHalfExtents)); + sg.end_struct(sizeof(physx::PxBoxObstacle)); + } + }; + physx_PxBoxObstacle_Pod::dump_layout(sg); + + struct physx_PxCapsuleObstacle_Pod: public physx::PxCapsuleObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCapsuleObstacle_Pod", "PxCapsuleObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mRot)); + sg.add_field("float mHalfHeight", "mHalfHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mHalfHeight)); + sg.add_field("float mRadius", "mRadius", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mRadius)); + sg.end_struct(sizeof(physx::PxCapsuleObstacle)); + } + }; + physx_PxCapsuleObstacle_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxObstacleContext_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxController_Pod;\n"); + sg.pass_thru("struct physx_PxControllerBehaviorCallback_Pod;\n"); + struct physx_PxControllerState_Pod: public physx::PxControllerState { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerState_Pod", "PxControllerState"); + sg.add_field("physx_PxVec3_Pod deltaXP", "deltaXP", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerState_Pod, deltaXP)); + sg.add_field("physx_PxShape_Pod* touchedShape", "touchedShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxControllerState_Pod, touchedShape)); + sg.add_field("physx_PxRigidActor_Pod* touchedActor", "touchedActor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxControllerState_Pod, touchedActor)); + sg.add_field("uint32_t touchedObstacleHandle", "touchedObstacleHandle", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerState_Pod, touchedObstacleHandle)); + sg.add_field("uint32_t collisionFlags", "collisionFlags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerState_Pod, collisionFlags)); + sg.add_field("bool standOnAnotherCCT", "standOnAnotherCCT", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, standOnAnotherCCT)); + sg.add_field("bool standOnObstacle", "standOnObstacle", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, standOnObstacle)); + sg.add_field("bool isMovingUp", "isMovingUp", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, isMovingUp)); + sg.end_struct(sizeof(physx::PxControllerState)); + } + }; + physx_PxControllerState_Pod::dump_layout(sg); + + struct physx_PxControllerStats_Pod: public physx::PxControllerStats { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerStats_Pod", "PxControllerStats"); + sg.add_field("uint16_t nbIterations", "nbIterations", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbIterations)); + sg.add_field("uint16_t nbFullUpdates", "nbFullUpdates", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbFullUpdates)); + sg.add_field("uint16_t nbPartialUpdates", "nbPartialUpdates", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbPartialUpdates)); + sg.add_field("uint16_t nbTessellation", "nbTessellation", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbTessellation)); + sg.end_struct(sizeof(physx::PxControllerStats)); + } + }; + physx_PxControllerStats_Pod::dump_layout(sg); + + struct physx_PxControllerHit_Pod: public physx::PxControllerHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerHit_Pod", "PxControllerHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerHit_Pod, length)); + sg.end_struct(sizeof(physx::PxControllerHit)); + } + }; + physx_PxControllerHit_Pod::dump_layout(sg); + + struct physx_PxControllerShapeHit_Pod: public physx::PxControllerShapeHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerShapeHit_Pod", "PxControllerShapeHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerShapeHit_Pod, length)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, shape)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, actor)); + sg.add_field("uint32_t triangleIndex", "triangleIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerShapeHit_Pod, triangleIndex)); + sg.end_struct(sizeof(physx::PxControllerShapeHit)); + } + }; + physx_PxControllerShapeHit_Pod::dump_layout(sg); + + struct physx_PxControllersHit_Pod: public physx::PxControllersHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllersHit_Pod", "PxControllersHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllersHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllersHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllersHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllersHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllersHit_Pod, length)); + sg.add_field("physx_PxController_Pod* other", "other", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllersHit_Pod, other)); + sg.end_struct(sizeof(physx::PxControllersHit)); + } + }; + physx_PxControllersHit_Pod::dump_layout(sg); + + struct physx_PxControllerObstacleHit_Pod: public physx::PxControllerObstacleHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerObstacleHit_Pod", "PxControllerObstacleHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, length)); + sg.add_field("void const* userData", "userData", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, userData)); + sg.end_struct(sizeof(physx::PxControllerObstacleHit)); + } + }; + physx_PxControllerObstacleHit_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxUserControllerHitReport_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxControllerFilters_Pod: public physx::PxControllerFilters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerFilters_Pod", "PxControllerFilters"); + sg.add_field("physx_PxFilterData_Pod const* mFilterData", "mFilterData", "*const PxFilterData", sizeof(physx::PxFilterData const*), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterData)); + sg.add_field("physx_PxQueryFilterCallback_Pod* mFilterCallback", "mFilterCallback", "*mut PxQueryFilterCallback", sizeof(physx::PxQueryFilterCallback*), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterCallback)); + sg.add_field("uint16_t mFilterFlags", "mFilterFlags", "PxQueryFlags", sizeof(physx::PxQueryFlags), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterFlags)); + sg.add_field("physx_PxControllerFilterCallback_Pod* mCCTFilterCallback", "mCCTFilterCallback", "*mut PxControllerFilterCallback", sizeof(physx::PxControllerFilterCallback*), unsafe_offsetof(physx_PxControllerFilters_Pod, mCCTFilterCallback)); + sg.end_struct(sizeof(physx::PxControllerFilters)); + } + }; + physx_PxControllerFilters_Pod::dump_layout(sg); + + struct physx_PxControllerDesc_Pod: public physx::PxControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerDesc_Pod", "PxControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxControllerDesc_Pod, userData)); + sg.end_struct(sizeof(physx::PxControllerDesc)); + } + }; + physx_PxControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxController_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBoxControllerDesc_Pod: public physx::PxBoxControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBoxControllerDesc_Pod", "PxBoxControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, userData)); + sg.add_field("float halfHeight", "halfHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfHeight)); + sg.add_field("float halfSideExtent", "halfSideExtent", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfSideExtent)); + sg.add_field("float halfForwardExtent", "halfForwardExtent", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfForwardExtent)); + sg.end_struct(sizeof(physx::PxBoxControllerDesc)); + } + }; + physx_PxBoxControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBoxController_Pod {\n void* vtable_;\n};\n"); + struct physx_PxCapsuleControllerDesc_Pod: public physx::PxCapsuleControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCapsuleControllerDesc_Pod", "PxCapsuleControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, userData)); + sg.add_field("float radius", "radius", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, radius)); + sg.add_field("float height", "height", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, height)); + sg.add_field("int32_t climbingMode", "climbingMode", "PxCapsuleClimbingMode", sizeof(physx::PxCapsuleClimbingMode::Enum), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, climbingMode)); + sg.end_struct(sizeof(physx::PxCapsuleControllerDesc)); + } + }; + physx_PxCapsuleControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCapsuleController_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerBehaviorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerManager_Pod {\n void* vtable_;\n};\n"); + struct physx_PxDim3_Pod: public physx::PxDim3 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDim3_Pod", "PxDim3"); + sg.add_field("uint32_t x", "x", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, x)); + sg.add_field("uint32_t y", "y", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, y)); + sg.add_field("uint32_t z", "z", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, z)); + sg.end_struct(sizeof(physx::PxDim3)); + } + }; + physx_PxDim3_Pod::dump_layout(sg); + + struct physx_PxSDFDesc_Pod: public physx::PxSDFDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSDFDesc_Pod", "PxSDFDesc"); + sg.add_field("physx_PxBoundedData_Pod sdf", "sdf", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdf)); + sg.add_field("physx_PxDim3_Pod dims", "dims", "PxDim3", sizeof(physx::PxDim3), unsafe_offsetof(physx_PxSDFDesc_Pod, dims)); + sg.add_field("physx_PxVec3_Pod meshLower", "meshLower", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSDFDesc_Pod, meshLower)); + sg.add_field("float spacing", "spacing", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, spacing)); + sg.add_field("uint32_t subgridSize", "subgridSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridSize)); + sg.add_field("int32_t bitsPerSubgridPixel", "bitsPerSubgridPixel", "PxSdfBitsPerSubgridPixel", sizeof(physx::PxSdfBitsPerSubgridPixel::Enum), unsafe_offsetof(physx_PxSDFDesc_Pod, bitsPerSubgridPixel)); + sg.add_field("physx_PxDim3_Pod sdfSubgrids3DTexBlockDim", "sdfSubgrids3DTexBlockDim", "PxDim3", sizeof(physx::PxDim3), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfSubgrids3DTexBlockDim)); + sg.add_field("physx_PxBoundedData_Pod sdfSubgrids", "sdfSubgrids", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfSubgrids)); + sg.add_field("physx_PxBoundedData_Pod sdfStartSlots", "sdfStartSlots", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfStartSlots)); + sg.add_field("float subgridsMinSdfValue", "subgridsMinSdfValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridsMinSdfValue)); + sg.add_field("float subgridsMaxSdfValue", "subgridsMaxSdfValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridsMaxSdfValue)); + sg.add_field("physx_PxBounds3_Pod sdfBounds", "sdfBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfBounds)); + sg.add_field("float narrowBandThicknessRelativeToSdfBoundsDiagonal", "narrowBandThicknessRelativeToSdfBoundsDiagonal", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, narrowBandThicknessRelativeToSdfBoundsDiagonal)); + sg.add_field("uint32_t numThreadsForSdfConstruction", "numThreadsForSdfConstruction", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSDFDesc_Pod, numThreadsForSdfConstruction)); + sg.end_struct(sizeof(physx::PxSDFDesc)); + } + }; + physx_PxSDFDesc_Pod::dump_layout(sg); + + struct physx_PxConvexMeshDesc_Pod: public physx::PxConvexMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConvexMeshDesc_Pod", "PxConvexMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod polygons", "polygons", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, polygons)); + sg.add_field("physx_PxBoundedData_Pod indices", "indices", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, indices)); + sg.add_field("uint16_t flags", "flags", "PxConvexFlags", sizeof(physx::PxConvexFlags), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, flags)); + sg.add_field("uint16_t vertexLimit", "vertexLimit", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, vertexLimit)); + sg.add_field("uint16_t polygonLimit", "polygonLimit", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, polygonLimit)); + sg.add_field("uint16_t quantizedCount", "quantizedCount", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, quantizedCount)); + sg.add_field("physx_PxSDFDesc_Pod* sdfDesc", "sdfDesc", "*mut PxSDFDesc", sizeof(physx::PxSDFDesc*), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, sdfDesc)); + sg.end_struct(sizeof(physx::PxConvexMeshDesc)); + } + }; + physx_PxConvexMeshDesc_Pod::dump_layout(sg); + + struct physx_PxTriangleMeshDesc_Pod: public physx::PxTriangleMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMeshDesc_Pod", "PxTriangleMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod triangles", "triangles", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, triangles)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, flags)); + sg.add_field("physx_PxSDFDesc_Pod* sdfDesc", "sdfDesc", "*mut PxSDFDesc", sizeof(physx::PxSDFDesc*), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, sdfDesc)); + sg.end_struct(sizeof(physx::PxTriangleMeshDesc)); + } + }; + physx_PxTriangleMeshDesc_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshDesc_Pod: public physx::PxTetrahedronMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshDesc_Pod", "PxTetrahedronMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod tetrahedrons", "tetrahedrons", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, tetrahedrons)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, flags)); + sg.add_field("uint16_t tetsPerElement", "tetsPerElement", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, tetsPerElement)); + sg.end_struct(sizeof(physx::PxTetrahedronMeshDesc)); + } + }; + physx_PxTetrahedronMeshDesc_Pod::dump_layout(sg); + + struct physx_PxSoftBodySimulationDataDesc_Pod: public physx::PxSoftBodySimulationDataDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodySimulationDataDesc_Pod", "PxSoftBodySimulationDataDesc"); + sg.add_field("physx_PxBoundedData_Pod vertexToTet", "vertexToTet", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSoftBodySimulationDataDesc_Pod, vertexToTet)); + sg.end_struct(sizeof(physx::PxSoftBodySimulationDataDesc)); + } + }; + physx_PxSoftBodySimulationDataDesc_Pod::dump_layout(sg); + + struct physx_PxBVH34MidphaseDesc_Pod: public physx::PxBVH34MidphaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH34MidphaseDesc_Pod", "PxBVH34MidphaseDesc"); + sg.add_field("uint32_t numPrimsPerLeaf", "numPrimsPerLeaf", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, numPrimsPerLeaf)); + sg.add_field("int32_t buildStrategy", "buildStrategy", "PxBVH34BuildStrategy", sizeof(physx::PxBVH34BuildStrategy::Enum), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, buildStrategy)); + sg.add_field("bool quantized", "quantized", "bool", sizeof(bool), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, quantized)); + sg.end_struct(sizeof(physx::PxBVH34MidphaseDesc)); + } + }; + physx_PxBVH34MidphaseDesc_Pod::dump_layout(sg); + + struct physx_PxMidphaseDesc_Pod: public physx::PxMidphaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMidphaseDesc_Pod", "PxMidphaseDesc"); + sg.end_struct(sizeof(physx::PxMidphaseDesc)); + } + }; + physx_PxMidphaseDesc_Pod::dump_layout(sg); + + struct physx_PxBVHDesc_Pod: public physx::PxBVHDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVHDesc_Pod", "PxBVHDesc"); + sg.add_field("physx_PxBoundedData_Pod bounds", "bounds", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxBVHDesc_Pod, bounds)); + sg.add_field("float enlargement", "enlargement", "f32", sizeof(float), unsafe_offsetof(physx_PxBVHDesc_Pod, enlargement)); + sg.add_field("uint32_t numPrimsPerLeaf", "numPrimsPerLeaf", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBVHDesc_Pod, numPrimsPerLeaf)); + sg.add_field("int32_t buildStrategy", "buildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxBVHDesc_Pod, buildStrategy)); + sg.end_struct(sizeof(physx::PxBVHDesc)); + } + }; + physx_PxBVHDesc_Pod::dump_layout(sg); + + struct physx_PxCookingParams_Pod: public physx::PxCookingParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCookingParams_Pod", "PxCookingParams"); + sg.add_field("float areaTestEpsilon", "areaTestEpsilon", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, areaTestEpsilon)); + sg.add_field("float planeTolerance", "planeTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, planeTolerance)); + sg.add_field("int32_t convexMeshCookingType", "convexMeshCookingType", "PxConvexMeshCookingType", sizeof(physx::PxConvexMeshCookingType::Enum), unsafe_offsetof(physx_PxCookingParams_Pod, convexMeshCookingType)); + sg.add_field("bool suppressTriangleMeshRemapTable", "suppressTriangleMeshRemapTable", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, suppressTriangleMeshRemapTable)); + sg.add_field("bool buildTriangleAdjacencies", "buildTriangleAdjacencies", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, buildTriangleAdjacencies)); + sg.add_field("bool buildGPUData", "buildGPUData", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, buildGPUData)); + sg.add_field("physx_PxTolerancesScale_Pod scale", "scale", "PxTolerancesScale", sizeof(physx::PxTolerancesScale), unsafe_offsetof(physx_PxCookingParams_Pod, scale)); + sg.add_field("uint32_t meshPreprocessParams", "meshPreprocessParams", "PxMeshPreprocessingFlags", sizeof(physx::PxMeshPreprocessingFlags), unsafe_offsetof(physx_PxCookingParams_Pod, meshPreprocessParams)); + sg.add_field("float meshWeldTolerance", "meshWeldTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, meshWeldTolerance)); + sg.add_field("physx_PxMidphaseDesc_Pod midphaseDesc", "midphaseDesc", "PxMidphaseDesc", sizeof(physx::PxMidphaseDesc), unsafe_offsetof(physx_PxCookingParams_Pod, midphaseDesc)); + sg.add_field("uint32_t gaussMapLimit", "gaussMapLimit", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxCookingParams_Pod, gaussMapLimit)); + sg.add_field("float maxWeightRatioInTet", "maxWeightRatioInTet", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, maxWeightRatioInTet)); + sg.end_struct(sizeof(physx::PxCookingParams)); + } + }; + physx_PxCookingParams_Pod::dump_layout(sg); + + struct physx_PxDefaultMemoryOutputStream_Pod: public physx::PxDefaultMemoryOutputStream { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultMemoryOutputStream_Pod", "PxDefaultMemoryOutputStream"); + sg.end_struct(sizeof(physx::PxDefaultMemoryOutputStream)); + } + }; + physx_PxDefaultMemoryOutputStream_Pod::dump_layout(sg); + + struct physx_PxDefaultMemoryInputData_Pod: public physx::PxDefaultMemoryInputData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultMemoryInputData_Pod", "PxDefaultMemoryInputData"); + sg.end_struct(sizeof(physx::PxDefaultMemoryInputData)); + } + }; + physx_PxDefaultMemoryInputData_Pod::dump_layout(sg); + + struct physx_PxDefaultFileOutputStream_Pod: public physx::PxDefaultFileOutputStream { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultFileOutputStream_Pod", "PxDefaultFileOutputStream"); + sg.end_struct(sizeof(physx::PxDefaultFileOutputStream)); + } + }; + physx_PxDefaultFileOutputStream_Pod::dump_layout(sg); + + struct physx_PxDefaultFileInputData_Pod: public physx::PxDefaultFileInputData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultFileInputData_Pod", "PxDefaultFileInputData"); + sg.end_struct(sizeof(physx::PxDefaultFileInputData)); + } + }; + physx_PxDefaultFileInputData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultAllocator_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxJoint_Pod;\n"); + sg.pass_thru("struct physx_PxRackAndPinionJoint_Pod;\n"); + sg.pass_thru("struct physx_PxGearJoint_Pod;\n"); + sg.pass_thru("struct physx_PxD6Joint_Pod;\n"); + sg.pass_thru("struct physx_PxDistanceJoint_Pod;\n"); + sg.pass_thru("struct physx_PxContactJoint_Pod;\n"); + sg.pass_thru("struct physx_PxFixedJoint_Pod;\n"); + sg.pass_thru("struct physx_PxPrismaticJoint_Pod;\n"); + sg.pass_thru("struct physx_PxRevoluteJoint_Pod;\n"); + sg.pass_thru("struct physx_PxSphericalJoint_Pod;\n"); + struct physx_PxJoint_Pod: public physx::PxJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJoint_Pod", "PxJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxJoint)); + } + }; + physx_PxJoint_Pod::dump_layout(sg); + + struct physx_PxSpring_Pod: public physx::PxSpring { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpring_Pod", "PxSpring"); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxSpring_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxSpring_Pod, damping)); + sg.end_struct(sizeof(physx::PxSpring)); + } + }; + physx_PxSpring_Pod::dump_layout(sg); + + struct physx_PxDistanceJoint_Pod: public physx::PxDistanceJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDistanceJoint_Pod", "PxDistanceJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxDistanceJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxDistanceJoint)); + } + }; + physx_PxDistanceJoint_Pod::dump_layout(sg); + + struct physx_PxJacobianRow_Pod: public physx::PxJacobianRow { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJacobianRow_Pod", "PxJacobianRow"); + sg.add_field("physx_PxVec3_Pod linear0", "linear0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, linear0)); + sg.add_field("physx_PxVec3_Pod linear1", "linear1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, linear1)); + sg.add_field("physx_PxVec3_Pod angular0", "angular0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, angular0)); + sg.add_field("physx_PxVec3_Pod angular1", "angular1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, angular1)); + sg.end_struct(sizeof(physx::PxJacobianRow)); + } + }; + physx_PxJacobianRow_Pod::dump_layout(sg); + + struct physx_PxContactJoint_Pod: public physx::PxContactJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactJoint_Pod", "PxContactJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxContactJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxContactJoint)); + } + }; + physx_PxContactJoint_Pod::dump_layout(sg); + + struct physx_PxFixedJoint_Pod: public physx::PxFixedJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFixedJoint_Pod", "PxFixedJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxFixedJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxFixedJoint)); + } + }; + physx_PxFixedJoint_Pod::dump_layout(sg); + + struct physx_PxJointLimitParameters_Pod: public physx::PxJointLimitParameters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitParameters_Pod", "PxJointLimitParameters"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, contactDistance_deprecated)); + sg.end_struct(sizeof(physx::PxJointLimitParameters)); + } + }; + physx_PxJointLimitParameters_Pod::dump_layout(sg); + + struct physx_PxJointLinearLimit_Pod: public physx::PxJointLinearLimit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLinearLimit_Pod", "PxJointLinearLimit"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, contactDistance_deprecated)); + sg.add_field("float value", "value", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, value)); + sg.end_struct(sizeof(physx::PxJointLinearLimit)); + } + }; + physx_PxJointLinearLimit_Pod::dump_layout(sg); + + struct physx_PxJointLinearLimitPair_Pod: public physx::PxJointLinearLimitPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLinearLimitPair_Pod", "PxJointLinearLimitPair"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, contactDistance_deprecated)); + sg.add_field("float upper", "upper", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, upper)); + sg.add_field("float lower", "lower", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, lower)); + sg.end_struct(sizeof(physx::PxJointLinearLimitPair)); + } + }; + physx_PxJointLinearLimitPair_Pod::dump_layout(sg); + + struct physx_PxJointAngularLimitPair_Pod: public physx::PxJointAngularLimitPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointAngularLimitPair_Pod", "PxJointAngularLimitPair"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, contactDistance_deprecated)); + sg.add_field("float upper", "upper", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, upper)); + sg.add_field("float lower", "lower", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, lower)); + sg.end_struct(sizeof(physx::PxJointAngularLimitPair)); + } + }; + physx_PxJointAngularLimitPair_Pod::dump_layout(sg); + + struct physx_PxJointLimitCone_Pod: public physx::PxJointLimitCone { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitCone_Pod", "PxJointLimitCone"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, contactDistance_deprecated)); + sg.add_field("float yAngle", "yAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, yAngle)); + sg.add_field("float zAngle", "zAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, zAngle)); + sg.end_struct(sizeof(physx::PxJointLimitCone)); + } + }; + physx_PxJointLimitCone_Pod::dump_layout(sg); + + struct physx_PxJointLimitPyramid_Pod: public physx::PxJointLimitPyramid { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitPyramid_Pod", "PxJointLimitPyramid"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, contactDistance_deprecated)); + sg.add_field("float yAngleMin", "yAngleMin", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, yAngleMin)); + sg.add_field("float yAngleMax", "yAngleMax", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, yAngleMax)); + sg.add_field("float zAngleMin", "zAngleMin", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, zAngleMin)); + sg.add_field("float zAngleMax", "zAngleMax", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, zAngleMax)); + sg.end_struct(sizeof(physx::PxJointLimitPyramid)); + } + }; + physx_PxJointLimitPyramid_Pod::dump_layout(sg); + + struct physx_PxPrismaticJoint_Pod: public physx::PxPrismaticJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPrismaticJoint_Pod", "PxPrismaticJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxPrismaticJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxPrismaticJoint)); + } + }; + physx_PxPrismaticJoint_Pod::dump_layout(sg); + + struct physx_PxRevoluteJoint_Pod: public physx::PxRevoluteJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRevoluteJoint_Pod", "PxRevoluteJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRevoluteJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxRevoluteJoint)); + } + }; + physx_PxRevoluteJoint_Pod::dump_layout(sg); + + struct physx_PxSphericalJoint_Pod: public physx::PxSphericalJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSphericalJoint_Pod", "PxSphericalJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSphericalJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxSphericalJoint)); + } + }; + physx_PxSphericalJoint_Pod::dump_layout(sg); + + struct physx_PxD6JointDrive_Pod: public physx::PxD6JointDrive { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxD6JointDrive_Pod", "PxD6JointDrive"); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, damping)); + sg.add_field("float forceLimit", "forceLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, forceLimit)); + sg.add_field("uint32_t flags", "flags", "PxD6JointDriveFlags", sizeof(physx::PxD6JointDriveFlags), unsafe_offsetof(physx_PxD6JointDrive_Pod, flags)); + sg.end_struct(sizeof(physx::PxD6JointDrive)); + } + }; + physx_PxD6JointDrive_Pod::dump_layout(sg); + + struct physx_PxD6Joint_Pod: public physx::PxD6Joint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxD6Joint_Pod", "PxD6Joint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxD6Joint_Pod, userData)); + sg.end_struct(sizeof(physx::PxD6Joint)); + } + }; + physx_PxD6Joint_Pod::dump_layout(sg); + + struct physx_PxGearJoint_Pod: public physx::PxGearJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGearJoint_Pod", "PxGearJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxGearJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxGearJoint)); + } + }; + physx_PxGearJoint_Pod::dump_layout(sg); + + struct physx_PxRackAndPinionJoint_Pod: public physx::PxRackAndPinionJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRackAndPinionJoint_Pod", "PxRackAndPinionJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRackAndPinionJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxRackAndPinionJoint)); + } + }; + physx_PxRackAndPinionJoint_Pod::dump_layout(sg); + + struct physx_PxGroupsMask_Pod: public physx::PxGroupsMask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGroupsMask_Pod", "PxGroupsMask"); + sg.add_field("uint16_t bits0", "bits0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits0)); + sg.add_field("uint16_t bits1", "bits1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits1)); + sg.add_field("uint16_t bits2", "bits2", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits2)); + sg.add_field("uint16_t bits3", "bits3", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits3)); + sg.end_struct(sizeof(physx::PxGroupsMask)); + } + }; + physx_PxGroupsMask_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultErrorCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxRigidActorExt_Pod: public physx::PxRigidActorExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidActorExt_Pod", "PxRigidActorExt"); + sg.end_struct(sizeof(physx::PxRigidActorExt)); + } + }; + physx_PxRigidActorExt_Pod::dump_layout(sg); + + struct physx_PxMassProperties_Pod: public physx::PxMassProperties { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMassProperties_Pod", "PxMassProperties"); + sg.add_field("physx_PxMat33_Pod inertiaTensor", "inertiaTensor", "PxMat33", sizeof(physx::PxMat33), unsafe_offsetof(physx_PxMassProperties_Pod, inertiaTensor)); + sg.add_field("physx_PxVec3_Pod centerOfMass", "centerOfMass", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMassProperties_Pod, centerOfMass)); + sg.add_field("float mass", "mass", "f32", sizeof(float), unsafe_offsetof(physx_PxMassProperties_Pod, mass)); + sg.end_struct(sizeof(physx::PxMassProperties)); + } + }; + physx_PxMassProperties_Pod::dump_layout(sg); + + struct physx_PxRigidBodyExt_Pod: public physx::PxRigidBodyExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidBodyExt_Pod", "PxRigidBodyExt"); + sg.end_struct(sizeof(physx::PxRigidBodyExt)); + } + }; + physx_PxRigidBodyExt_Pod::dump_layout(sg); + + struct physx_PxShapeExt_Pod: public physx::PxShapeExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxShapeExt_Pod", "PxShapeExt"); + sg.end_struct(sizeof(physx::PxShapeExt)); + } + }; + physx_PxShapeExt_Pod::dump_layout(sg); + + struct physx_PxMeshOverlapUtil_Pod: public physx::PxMeshOverlapUtil { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMeshOverlapUtil_Pod", "PxMeshOverlapUtil"); + sg.end_struct(sizeof(physx::PxMeshOverlapUtil)); + } + }; + physx_PxMeshOverlapUtil_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBinaryConverter_Pod;\n"); + struct physx_PxXmlMiscParameter_Pod: public physx::PxXmlMiscParameter { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxXmlMiscParameter_Pod", "PxXmlMiscParameter"); + sg.add_field("physx_PxVec3_Pod upVector", "upVector", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxXmlMiscParameter_Pod, upVector)); + sg.add_field("physx_PxTolerancesScale_Pod scale", "scale", "PxTolerancesScale", sizeof(physx::PxTolerancesScale), unsafe_offsetof(physx_PxXmlMiscParameter_Pod, scale)); + sg.end_struct(sizeof(physx::PxXmlMiscParameter)); + } + }; + physx_PxXmlMiscParameter_Pod::dump_layout(sg); + + struct physx_PxSerialization_Pod: public physx::PxSerialization { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSerialization_Pod", "PxSerialization"); + sg.end_struct(sizeof(physx::PxSerialization)); + } + }; + physx_PxSerialization_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultCpuDispatcher_Pod {\n void* vtable_;\n};\n"); + struct physx_PxStringTableExt_Pod: public physx::PxStringTableExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxStringTableExt_Pod", "PxStringTableExt"); + sg.end_struct(sizeof(physx::PxStringTableExt)); + } + }; + physx_PxStringTableExt_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseExt_Pod: public physx::PxBroadPhaseExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseExt_Pod", "PxBroadPhaseExt"); + sg.end_struct(sizeof(physx::PxBroadPhaseExt)); + } + }; + physx_PxBroadPhaseExt_Pod::dump_layout(sg); + + struct physx_PxSceneQueryExt_Pod: public physx::PxSceneQueryExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneQueryExt_Pod", "PxSceneQueryExt"); + sg.end_struct(sizeof(physx::PxSceneQueryExt)); + } + }; + physx_PxSceneQueryExt_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBatchQueryExt_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCustomSceneQuerySystem_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCustomSceneQuerySystemAdapter_Pod {\n void* vtable_;\n};\n"); + struct physx_PxSamplingExt_Pod: public physx::PxSamplingExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSamplingExt_Pod", "PxSamplingExt"); + sg.end_struct(sizeof(physx::PxSamplingExt)); + } + }; + physx_PxSamplingExt_Pod::dump_layout(sg); + + struct physx_PxPoissonSampler_Pod: public physx::PxPoissonSampler { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPoissonSampler_Pod", "PxPoissonSampler"); + sg.end_struct(sizeof(physx::PxPoissonSampler)); + } + }; + physx_PxPoissonSampler_Pod::dump_layout(sg); + + struct physx_PxTriangleMeshPoissonSampler_Pod: public physx::PxTriangleMeshPoissonSampler { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMeshPoissonSampler_Pod", "PxTriangleMeshPoissonSampler"); + sg.end_struct(sizeof(physx::PxTriangleMeshPoissonSampler)); + } + }; + physx_PxTriangleMeshPoissonSampler_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshExt_Pod: public physx::PxTetrahedronMeshExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshExt_Pod", "PxTetrahedronMeshExt"); + sg.end_struct(sizeof(physx::PxTetrahedronMeshExt)); + } + }; + physx_PxTetrahedronMeshExt_Pod::dump_layout(sg); + + struct physx_PxRepXObject_Pod: public physx::PxRepXObject { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRepXObject_Pod", "PxRepXObject"); + sg.add_field("char const* typeName", "typeName", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxRepXObject_Pod, typeName)); + sg.add_field("void const* serializable", "serializable", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxRepXObject_Pod, serializable)); + sg.add_field("uint64_t id", "id", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxRepXObject_Pod, id)); + sg.end_struct(sizeof(physx::PxRepXObject)); + } + }; + physx_PxRepXObject_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCooking_Pod;\n"); + struct physx_PxRepXInstantiationArgs_Pod: public physx::PxRepXInstantiationArgs { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRepXInstantiationArgs_Pod", "PxRepXInstantiationArgs"); + sg.add_field("physx_PxCooking_Pod* cooker", "cooker", "*mut PxCooking", sizeof(physx::PxCooking*), unsafe_offsetof(physx_PxRepXInstantiationArgs_Pod, cooker)); + sg.add_field("physx_PxStringTable_Pod* stringTable", "stringTable", "*mut PxStringTable", sizeof(physx::PxStringTable*), unsafe_offsetof(physx_PxRepXInstantiationArgs_Pod, stringTable)); + sg.end_struct(sizeof(physx::PxRepXInstantiationArgs)); + } + }; + physx_PxRepXInstantiationArgs_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxRepXSerializer_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxVehicleWheels4SimData_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleWheels4DynData_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleTireForceCalculator_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleTelemetryData_Pod;\n"); + sg.pass_thru("struct physx_PxPvdTransport_Pod;\n"); + sg.pass_thru("struct physx_PxPvd_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxPvdTransport_Pod {\n void* vtable_;\n};\n"); + sg.finish(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-2.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-2.snap new file mode 100644 index 0000000..07cf035 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-2.snap @@ -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; +}; + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-3.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-3.snap new file mode 100644 index 0000000..19407a2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things-3.snap @@ -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::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 28); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 20); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 48); + assert_eq!(std::mem::size_of::(), 32); + assert_eq!(std::mem::size_of::(), 24); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 12); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 44); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 36); + assert_eq!(std::mem::size_of::(), 8); + assert_eq!(std::mem::size_of::(), 1); + assert_eq!(std::mem::size_of::(), 4); + assert_eq!(std::mem::size_of::(), 16); + assert_eq!(std::mem::size_of::(), 56); + assert_eq!(std::mem::size_of::(), 24); + } +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things.snap b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things.snap new file mode 100644 index 0000000..728aeff --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/snapshots/structgen__many_things.snap @@ -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(); +} + diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.hpp b/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.hpp new file mode 100644 index 0000000..3bc24cf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.hpp @@ -0,0 +1,87 @@ +#include +#include +#include +#include + +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 rust_checks; + FILE* cfile; + FILE* rfile; + const char* rname; + size_t pos; + uint32_t padIdx; +}; diff --git a/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.rs b/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.rs new file mode 100644 index 0000000..0bf6d09 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/pxbind/tests/structgen.rs @@ -0,0 +1,88 @@ +fn gen_structgen(which: &str, _to_emit: &'static [&str]) -> anyhow::Result { + 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 { + 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); +} diff --git a/modules/PhysX/physx/physx-sys/release.toml b/modules/PhysX/physx/physx-sys/release.toml new file mode 100644 index 0000000..ebf149d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/release.toml @@ -0,0 +1,10 @@ +pre-release-commit-message = "Release {{crate_name}} v{{version}}" +tag-message = "Release {{crate_name}} {{version}}" +tag-name = "{{crate_name}}-v{{version}}" +pre-release-replacements = [ + { file = "CHANGELOG.md", search = "Unreleased", replace = "{{version}}" }, + { file = "CHANGELOG.md", search = "\\.\\.\\.HEAD", replace = "...{{tag_name}}" }, + { file = "CHANGELOG.md", search = "ReleaseDate", replace = "{{date}}" }, + { file = "CHANGELOG.md", search = "", replace = "\n## [Unreleased] - ReleaseDate" }, + { file = "CHANGELOG.md", search = "", replace = "\n[Unreleased]: https://github.com/EmbarkStudios/physx-rs/compare/{{tag_name}}...HEAD" }, +] diff --git a/modules/PhysX/physx/physx-sys/sources/common b/modules/PhysX/physx/physx-sys/sources/common new file mode 100644 index 0000000..901ad92 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/common @@ -0,0 +1,7 @@ +[ + "CmCollection", + "CmPtrTable", + "CmRadixSort", + "CmSerialize", + "CmVisualization", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/cooking b/modules/PhysX/physx/physx-sys/sources/cooking new file mode 100644 index 0000000..c21fcdf --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/cooking @@ -0,0 +1,3 @@ +[ + "Cooking", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/cooking_convex b/modules/PhysX/physx/physx-sys/sources/cooking_convex new file mode 100644 index 0000000..673c918 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/cooking_convex @@ -0,0 +1,10 @@ +[ + "BigConvexDataBuilder", + "ConvexHullBuilder", + "ConvexHullLib", + "ConvexHullUtils", + "ConvexMeshBuilder", + "ConvexPolygonsBuilder", + "QuickHullConvexHullLib", + "VolumeIntegration", +] diff --git a/modules/PhysX/physx/physx-sys/sources/core b/modules/PhysX/physx/physx-sys/sources/core new file mode 100644 index 0000000..971629b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/core @@ -0,0 +1,39 @@ +[ + "NpActor", + "NpAggregate", + "NpArticulationJointReducedCoordinate", + "NpArticulationLink", + "NpArticulationReducedCoordinate", + "NpArticulationSensor", + "NpArticulationTendon", + "NpBounds", + "NpCheck", + "NpConstraint", + "NpDebugViz", + "NpFactory", + "NpFEMCloth", + "NpFEMClothMaterial", + "NpFEMSoftBodyMaterial", + "NpFLIPMaterial", + "NpHairSystem", + "NpMaterial", + "NpMetaData", + "NpMPMMaterial", + "NpParticleSystem", + "NpPBDMaterial", + "NpPhysics", + "NpPruningStructure", + "NpPvdSceneClient", + "NpPvdSceneQueryCollector", + "NpRigidDynamic", + "NpRigidStatic", + "NpScene", + "NpSceneFetchResults", + "NpSceneQueries", + "NpSerializerAdapter", + "NpShape", + "NpShapeManager", + "NpSoftBody", + "PvdMetaDataPvdBinding", + "PvdPhysicsClient", +] diff --git a/modules/PhysX/physx/physx-sys/sources/extensions b/modules/PhysX/physx/physx-sys/sources/extensions new file mode 100644 index 0000000..4e5278d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/extensions @@ -0,0 +1,43 @@ +[ + "ExtBroadPhase", + "ExtCollection", + "ExtContactJoint", + "ExtConvexMeshExt", + "ExtCpuWorkerThread", + "ExtCustomGeometryExt", + "ExtCustomSceneQuerySystem", + "ExtD6Joint", + "ExtD6JointCreate", + "ExtDefaultCpuDispatcher", + "ExtDefaultErrorCallback", + "ExtDefaultSimulationFilterShader", + "ExtDefaultStreams", + "ExtDistanceJoint", + "ExtExtensions", + "ExtFixedJoint", + "ExtGearJoint", + "ExtGjkQueryExt", + "ExtJoint", + "ExtMetaData", + "ExtPrismaticJoint", + "ExtPvd", + "ExtPxStringTable", + "ExtRackAndPinionJoint", + "ExtRaycastCCD", + "ExtRemeshingExt", + "ExtRevoluteJoint", + "ExtRigidActorExt", + "ExtRigidBodyExt", + "ExtSampling", + "ExtSceneQueryExt", + "ExtSceneQuerySystem", + "ExtSimpleFactory", + "ExtSmoothNormals", + "ExtSoftBodyExt", + "ExtSphericalJoint", + "ExtSqManager", + "ExtSqQuery", + "ExtTetMakerExt", + "ExtTetrahedronMeshExt", + "ExtTriangleMeshExt", +] diff --git a/modules/PhysX/physx/physx-sys/sources/extensions_binary b/modules/PhysX/physx/physx-sys/sources/extensions_binary new file mode 100644 index 0000000..81b1ed0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/extensions_binary @@ -0,0 +1,12 @@ +[ + "SnBinaryDeserialization", + "SnBinarySerialization", + "SnConvX", + "SnConvX_Align", + "SnConvX_Convert", + "SnConvX_Error", + "SnConvX_MetaData", + "SnConvX_Output", + "SnConvX_Union", + "SnSerializationContext", +] diff --git a/modules/PhysX/physx/physx-sys/sources/extensions_serialization b/modules/PhysX/physx/physx-sys/sources/extensions_serialization new file mode 100644 index 0000000..9eb550d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/extensions_serialization @@ -0,0 +1,5 @@ +[ + "SnSerialization", + "SnSerializationRegistry", + "SnSerialUtils", +] diff --git a/modules/PhysX/physx/physx-sys/sources/extensions_tet b/modules/PhysX/physx/physx-sys/sources/extensions_tet new file mode 100644 index 0000000..3500010 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/extensions_tet @@ -0,0 +1,14 @@ +[ + "ExtBVH", + "ExtDelaunayBoundaryInserter", + "ExtDelaunayTetrahedralizer", + "ExtFastWindingNumber", + "ExtInsideTester", + "ExtMeshSimplificator", + "ExtOctreeTetrahedralizer", + "ExtRemesher", + "ExtTetSplitting", + "ExtTetUnionFind", + "ExtUtilities", + "ExtVoxelTetrahedralizer", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/extensions_xml b/modules/PhysX/physx/physx-sys/sources/extensions_xml new file mode 100644 index 0000000..7404174 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/extensions_xml @@ -0,0 +1,6 @@ +[ + "SnJointRepXSerializer", + "SnRepXCoreSerializer", + "SnRepXUpgrader", + "SnXmlSerialization", +] diff --git a/modules/PhysX/physx/physx-sys/sources/fastxml b/modules/PhysX/physx/physx-sys/sources/fastxml new file mode 100644 index 0000000..acf26d0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/fastxml @@ -0,0 +1 @@ +["PsFastXml"] diff --git a/modules/PhysX/physx/physx-sys/sources/foundation b/modules/PhysX/physx/physx-sys/sources/foundation new file mode 100644 index 0000000..37a744e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/foundation @@ -0,0 +1,8 @@ +[ + "FdAllocator", + "FdAssert", + "FdFoundation", + "FdMathUtils", + "FdString", + "FdTempAllocator", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/foundation_unix b/modules/PhysX/physx/physx-sys/sources/foundation_unix new file mode 100644 index 0000000..6f1a46f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/foundation_unix @@ -0,0 +1,11 @@ +[ + "FdUnixAtomic", + "FdUnixFPU", + "FdUnixMutex", + "FdUnixPrintString", + "FdUnixSList", + "FdUnixSocket", + "FdUnixSync", + "FdUnixThread", + "FdUnixTime", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/foundation_windows b/modules/PhysX/physx/physx-sys/sources/foundation_windows new file mode 100644 index 0000000..4feae78 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/foundation_windows @@ -0,0 +1,11 @@ +[ + "FdWindowsAtomic", + "FdWindowsFPU", + "FdWindowsMutex", + "FdWindowsPrintString", + "FdWindowsSList", + "FdWindowsSocket", + "FdWindowsSync", + "FdWindowsThread", + "FdWindowsTime", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils b/modules/PhysX/physx/physx-sys/sources/geomutils new file mode 100644 index 0000000..d343bc4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils @@ -0,0 +1,37 @@ +[ + "GuAABBPruner", + "GuAABBTree", + "GuAABBTreeUpdateMap", + "GuActorShapeMap", + "GuBounds", + "GuBox", + "GuBucketPruner", + "GuBVH", + "GuCapsule", + "GuCCTSweepTests", + "GuCookingSDF", + "GuExtendedBucketPruner", + "GuFactory", + "GuGeometryQuery", + "GuGjkQuery", + "GuIncrementalAABBPrunerCore", + "GuIncrementalAABBPruner", + "GuIncrementalAABBTree", + "GuInternal", + "GuMaverickNode", + "GuMeshFactory", + "GuMetaData", + "GuMTD", + "GuOverlapTests", + "GuPruningPool", + "GuQuerySystem", + "GuRaycastTests", + "GuSAH", + "GuSDF", + "GuSecondaryPruner", + "GuSqInternal", + "GuSweepMTD", + "GuSweepSharedTests", + "GuSweepTests", + "GuWindingNumber", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_ccd b/modules/PhysX/physx/physx-sys/sources/geomutils_ccd new file mode 100644 index 0000000..011fdec --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_ccd @@ -0,0 +1,4 @@ +[ + "GuCCDSweepConvexMesh", + "GuCCDSweepPrimitives", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_common b/modules/PhysX/physx/physx-sys/sources/geomutils_common new file mode 100644 index 0000000..dbbbacd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_common @@ -0,0 +1,10 @@ +[ + "GuAdjacencies", + "GuBarycentricCoordinates", + "GuEdgeList", + "GuMeshAnalysis", + "GuMeshCleaner", + "GuQuantizer", + "GuSeparatingAxes", + "GuVertexReducer", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_contact b/modules/PhysX/physx/physx-sys/sources/geomutils_contact new file mode 100644 index 0000000..803148b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_contact @@ -0,0 +1,20 @@ +[ + "GuContactBoxBox", + "GuContactCapsuleBox", + "GuContactCapsuleCapsule", + "GuContactCapsuleConvex", + "GuContactCapsuleMesh", + "GuContactConvexConvex", + "GuContactConvexMesh", + "GuContactCustomGeometry", + "GuContactPlaneBox", + "GuContactPlaneCapsule", + "GuContactPlaneConvex", + "GuContactPolygonPolygon", + "GuContactSphereBox", + "GuContactSphereCapsule", + "GuContactSphereMesh", + "GuContactSpherePlane", + "GuContactSphereSphere", + "GuFeatureCode", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_convex b/modules/PhysX/physx/physx-sys/sources/geomutils_convex new file mode 100644 index 0000000..4b89844 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_convex @@ -0,0 +1,9 @@ +[ + "GuBigConvexData", + "GuConvexHelper", + "GuConvexMesh", + "GuConvexSupportTable", + "GuConvexUtilsInternal", + "GuHillClimbing", + "GuShapeConvex", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_cooking b/modules/PhysX/physx/physx-sys/sources/geomutils_cooking new file mode 100644 index 0000000..0ba230a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_cooking @@ -0,0 +1,16 @@ +[ + "GuCookingBigConvexDataBuilder", + "GuCookingBVH", + "GuCookingConvexHullBuilder", + "GuCookingConvexHullLib", + "GuCookingConvexHullUtils", + "GuCookingConvexMeshBuilder", + "GuCookingConvexMesh", + "GuCookingConvexPolygonsBuilder", + "GuCookingHF", + "GuCookingQuickHullConvexHullLib", + "GuCookingTetrahedronMesh", + "GuCookingTriangleMesh", + "GuCookingVolumeIntegration", + "GuRTreeCooking", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_distance b/modules/PhysX/physx/physx-sys/sources/geomutils_distance new file mode 100644 index 0000000..6e25d12 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_distance @@ -0,0 +1,8 @@ +[ + "GuDistancePointBox", + "GuDistancePointTetrahedron", + "GuDistancePointTriangle", + "GuDistanceSegmentBox", + "GuDistanceSegmentSegment", + "GuDistanceSegmentTriangle", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_gjk b/modules/PhysX/physx/physx-sys/sources/geomutils_gjk new file mode 100644 index 0000000..df20de3 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_gjk @@ -0,0 +1,5 @@ +[ + "GuEPA", + "GuGJKSimplex", + "GuGJKTest", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_hf b/modules/PhysX/physx/physx-sys/sources/geomutils_hf new file mode 100644 index 0000000..6249bba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_hf @@ -0,0 +1,6 @@ +[ + "GuHeightField", + "GuHeightFieldUtil", + "GuOverlapTestsHF", + "GuSweepsHF", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_intersection b/modules/PhysX/physx/physx-sys/sources/geomutils_intersection new file mode 100644 index 0000000..9987f11 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_intersection @@ -0,0 +1,12 @@ +[ + "GuIntersectionBoxBox", + "GuIntersectionCapsuleTriangle", + "GuIntersectionEdgeEdge", + "GuIntersectionRayBox", + "GuIntersectionRayCapsule", + "GuIntersectionRaySphere", + "GuIntersectionSphereBox", + "GuIntersectionTetrahedronBox", + "GuIntersectionTriangleBox", + "GuIntersectionTriangleTriangle", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_mesh b/modules/PhysX/physx/physx-sys/sources/geomutils_mesh new file mode 100644 index 0000000..628f688 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_mesh @@ -0,0 +1,26 @@ +[ + "GuBV32Build", + "GuBV32", + "GuBV4_AABBSweep", + "GuBV4_BoxOverlap", + "GuBV4Build", + "GuBV4_CapsuleSweepAA", + "GuBV4_CapsuleSweep", + "GuBV4", + "GuBV4_MeshMeshOverlap", + "GuBV4_OBBSweep", + "GuBV4_Raycast", + "GuBV4_SphereOverlap", + "GuBV4_SphereSweep", + "GuMeshQuery", + "GuMidphaseBV4", + "GuMidphaseRTree", + "GuOverlapTestsMesh", + "GuRTree", + "GuRTreeQueries", + "GuSweepsMesh", + "GuTetrahedronMesh", + "GuTriangleMeshBV4", + "GuTriangleMesh", + "GuTriangleMeshRTree", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_pcm b/modules/PhysX/physx/physx-sys/sources/geomutils_pcm new file mode 100644 index 0000000..43d545f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_pcm @@ -0,0 +1,30 @@ +[ + "GuPCMContactBoxBox", + "GuPCMContactBoxConvex", + "GuPCMContactCapsuleBox", + "GuPCMContactCapsuleCapsule", + "GuPCMContactCapsuleConvex", + "GuPCMContactCapsuleHeightField", + "GuPCMContactCapsuleMesh", + "GuPCMContactConvexCommon", + "GuPCMContactConvexConvex", + "GuPCMContactConvexHeightField", + "GuPCMContactConvexMesh", + "GuPCMContactCustomGeometry", + "GuPCMContactGenBoxConvex", + "GuPCMContactGenSphereCapsule", + "GuPCMContactGenUtil", + "GuPCMContactPlaneBox", + "GuPCMContactPlaneCapsule", + "GuPCMContactPlaneConvex", + "GuPCMContactSphereBox", + "GuPCMContactSphereCapsule", + "GuPCMContactSphereConvex", + "GuPCMContactSphereHeightField", + "GuPCMContactSphereMesh", + "GuPCMContactSpherePlane", + "GuPCMContactSphereSphere", + "GuPCMShapeConvex", + "GuPCMTriangleContactGen", + "GuPersistentContactManifold", +] diff --git a/modules/PhysX/physx/physx-sys/sources/geomutils_sweep b/modules/PhysX/physx/physx-sys/sources/geomutils_sweep new file mode 100644 index 0000000..ea262b2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/geomutils_sweep @@ -0,0 +1,13 @@ +[ + "GuSweepBoxBox", + "GuSweepBoxSphere", + "GuSweepBoxTriangle_FeatureBased", + "GuSweepBoxTriangle_SAT", + "GuSweepCapsuleBox", + "GuSweepCapsuleCapsule", + "GuSweepCapsuleTriangle", + "GuSweepSphereCapsule", + "GuSweepSphereSphere", + "GuSweepSphereTriangle", + "GuSweepTriangleUtils", +] diff --git a/modules/PhysX/physx/physx-sys/sources/lowlevel_pipeline b/modules/PhysX/physx/physx-sys/sources/lowlevel_pipeline new file mode 100644 index 0000000..bf3a504 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/lowlevel_pipeline @@ -0,0 +1,10 @@ +[ + "PxcContactCache", + "PxcContactMethodImpl", + "PxcMaterialMethodImpl", + "PxcNpBatch", + "PxcNpCacheStreamPair", + "PxcNpContactPrepShared", + "PxcNpMemBlockPool", + "PxcNpThreadContext", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/lowlevel_software b/modules/PhysX/physx/physx-sys/sources/lowlevel_software new file mode 100644 index 0000000..e744a8b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/lowlevel_software @@ -0,0 +1,9 @@ +[ + "PxsCCD", + "PxsContactManager", + "PxsContext", + "PxsDefaultMemoryManager", + "PxsIslandSim", + "PxsNphaseImplementationContext", + "PxsSimpleIslandManager", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/lowlevelaabb b/modules/PhysX/physx/physx-sys/sources/lowlevelaabb new file mode 100644 index 0000000..80a22d5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/lowlevelaabb @@ -0,0 +1,12 @@ +[ + "BpAABBManagerBase", + "BpAABBManager", + "BpBroadPhaseABP", + "BpBroadPhase", + "BpBroadPhaseMBP", + "BpBroadPhaseSapAux", + "BpBroadPhaseSap", + "BpBroadPhaseShared", + "BpBroadPhaseUpdate", + "BpFiltering", +] diff --git a/modules/PhysX/physx/physx-sys/sources/lowleveldynamics b/modules/PhysX/physx/physx-sys/sources/lowleveldynamics new file mode 100644 index 0000000..e9bf606 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/lowleveldynamics @@ -0,0 +1,28 @@ +[ + "DyArticulationContactPrep", + "DyArticulationContactPrepPF", + "DyFeatherstoneArticulation", + "DyFeatherstoneForwardDynamic", + "DyFeatherstoneInverseDynamic", + "DyConstraintPartition", + "DyConstraintSetup", + "DyConstraintSetupBlock", + "DyContactPrep", + "DyContactPrep4", + "DyContactPrep4PF", + "DyContactPrepPF", + "DyDynamics", + "DyFrictionCorrelation", + "DyRigidBodyToSolverBody", + "DySolverConstraints", + "DySolverConstraintsBlock", + "DySolverControl", + "DySolverControlPF", + "DySolverPFConstraints", + "DySolverPFConstraintsBlock", + "DyThreadContext", + "DyThresholdTable", + "DyTGSDynamics", + "DyTGSContactPrep", + "DyTGSContactPrepBlock", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/physxcharacterkinematic b/modules/PhysX/physx/physx-sys/sources/physxcharacterkinematic new file mode 100644 index 0000000..fe63a98 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/physxcharacterkinematic @@ -0,0 +1,12 @@ +[ + "CctBoxController", + "CctCapsuleController", + "CctCharacterController", + "CctCharacterControllerCallbacks", + "CctCharacterControllerManager", + "CctController", + "CctObstacleContext", + "CctSweptBox", + "CctSweptCapsule", + "CctSweptVolume", +] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/pvd b/modules/PhysX/physx/physx-sys/sources/pvd new file mode 100644 index 0000000..1f11222 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/pvd @@ -0,0 +1,13 @@ +[ + "PxProfileEventImpl", + "PxPvd", + "PxPvdDataStream", + "PxPvdDefaultFileTransport", + "PxPvdDefaultSocketTransport", + "PxPvdImpl", + "PxPvdMemClient", + "PxPvdObjectModelMetaData", + "PxPvdObjectRegistrar", + "PxPvdProfileZoneClient", + "PxPvdUserRenderer", +] diff --git a/modules/PhysX/physx/physx-sys/sources/scenequery b/modules/PhysX/physx/physx-sys/sources/scenequery new file mode 100644 index 0000000..aa25081 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/scenequery @@ -0,0 +1,7 @@ +[ + "SqCompoundPruner", + "SqCompoundPruningPool", + "SqFactory", + "SqManager", + "SqQuery", +] diff --git a/modules/PhysX/physx/physx-sys/sources/simulationcontroller b/modules/PhysX/physx/physx-sys/sources/simulationcontroller new file mode 100644 index 0000000..b7a6984 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/simulationcontroller @@ -0,0 +1,54 @@ +[ + "ScActorCore", + "ScActorSim", + "ScArticulationCore", + "ScArticulationJointCore", + "ScArticulationJointSim", + "ScArticulationSensorSim", + "ScArticulationSim", + "ScArticulationTendonCore", + "ScArticulationTendonJointCore", + "ScArticulationTendonSim", + "ScBodyCore", + "ScBodySim", + "ScCCD", + "ScConstraintCore", + "ScConstraintGroupNode", + "ScConstraintInteraction", + "ScConstraintProjectionManager", + "ScConstraintProjectionTree", + "ScConstraintSim", + "ScElementInteractionMarker", + "ScElementSim", + "ScFEMClothCore", + "ScFEMClothShapeSim", + "ScFEMClothSim", + "ScHairSystemCore", + "ScHairSystemShapeCore", + "ScHairSystemShapeSim", + "ScHairSystemSim", + "ScInteraction", + "ScIterators", + "ScMetaData", + "ScNPhaseCore", + "ScParticleSystemCore", + "ScParticleSystemShapeCore", + "ScParticleSystemShapeSim", + "ScParticleSystemSim", + "ScPhysics", + "ScRigidCore", + "ScRigidSim", + "ScScene", + "ScShapeCore", + "ScShapeInteraction", + "ScShapeSimBase", + "ScShapeSim", + "ScSimStats", + "ScSimulationController", + "ScSoftBodyCore", + "ScSoftBodyShapeSim", + "ScSoftBodySim", + "ScSqBoundsManager", + "ScStaticCore", + "ScTriggerInteraction", +] diff --git a/modules/PhysX/physx/physx-sys/sources/task b/modules/PhysX/physx/physx-sys/sources/task new file mode 100644 index 0000000..3c0cf61 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/task @@ -0,0 +1 @@ +["TaskManager"] \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/sources/vehicle b/modules/PhysX/physx/physx-sys/sources/vehicle new file mode 100644 index 0000000..1ef23d9 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/vehicle @@ -0,0 +1,18 @@ +[ + "PxVehicleComponents", + "PxVehicleDrive", + "PxVehicleDrive4W", + "PxVehicleDriveNW", + "PxVehicleDriveTank", + "PxVehicleMetaData", + "PxVehicleNoDrive", + "PxVehicleSDK", + "PxVehicleSerialization", + "PxVehicleSuspWheelTire4", + "PxVehicleTireFriction", + "PxVehicleUpdate", + "PxVehicleWheels", + "VehicleUtilControl", + "VehicleUtilSetup", + "VehicleUtilTelemetry", +] diff --git a/modules/PhysX/physx/physx-sys/sources/vehicle_metadata b/modules/PhysX/physx/physx-sys/sources/vehicle_metadata new file mode 100644 index 0000000..c287961 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/sources/vehicle_metadata @@ -0,0 +1,4 @@ +[ + "PxVehicleAutoGeneratedMetaDataObjects", + "PxVehicleMetaDataObjects", +] diff --git a/modules/PhysX/physx/physx-sys/src/generated/unix/structgen.rs b/modules/PhysX/physx/physx-sys/src/generated/unix/structgen.rs new file mode 100644 index 0000000..39a42e5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/generated/unix/structgen.rs @@ -0,0 +1,2815 @@ +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRawAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVirtualAllocator { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxUserAllocated { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTempAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBitAndByte { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBitMap { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec3 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec3Padded { + pub x: f32, + pub y: f32, + pub z: f32, + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQuat { + pub x: f32, + pub y: f32, + pub z: f32, + pub w: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTransform { + pub q: PxQuat, + pub p: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTransformPadded { + pub transform: PxTransform, + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMat33 { + pub column0: PxVec3, + pub column1: PxVec3, + pub column2: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBounds3 { + pub minimum: PxVec3, + pub maximum: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadcastingAllocator { + pub structgen_pad0: [u8; 176], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadcastingErrorCallback { + pub structgen_pad0: [u8; 160], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec4 { + pub x: f32, + pub y: f32, + pub z: f32, + pub w: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMat44 { + pub column0: PxVec4, + pub column1: PxVec4, + pub column2: PxVec4, + pub column3: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPlane { + pub n: PxVec3, + pub d: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct Interpolation { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMutexImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxReadWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxProfileScoped { + pub mCallback: *mut PxProfilerCallback, + pub mEventName: *const std::ffi::c_char, + pub mProfilerData: *mut std::ffi::c_void, + pub mContextId: u64, + pub mDetached: bool, + pub structgen_pad0: [u8; 7], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSListEntry { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSListImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSyncImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCounterFrequencyToTensOfNanos { + pub mNumerator: u64, + pub mDenominator: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTime { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec2 { + pub x: f32, + pub y: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxStridedData { + pub stride: u32, + pub structgen_pad0: [u8; 4], + pub data: *const std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugPoint { + pub pos: PxVec3, + pub color: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugLine { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugTriangle { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, + pub pos2: PxVec3, + pub color2: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugText { + pub position: PxVec3, + pub size: f32, + pub color: u32, + pub structgen_pad0: [u8; 4], + pub string: *const std::ffi::c_char, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDeserializationContext { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBase { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRefCounted { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTolerancesScale { + pub length: f32, + pub speed: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMetaDataEntry { + pub type_: *const std::ffi::c_char, + pub name: *const std::ffi::c_char, + pub offset: u32, + pub size: u32, + pub count: u32, + pub offsetSize: u32, + pub flags: u32, + pub alignment: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBaseTask { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTask { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxLightCpuTask { + pub structgen_pad0: [u8; 40], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub halfExtents: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub radius: f32, + pub halfHeight: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHullPolygon { + pub mPlane: [f32; 4], + pub mNbVerts: u16, + pub mIndexBase: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConvexMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshScale { + pub scale: PxVec3, + pub rotation: PxQuat, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSphereGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub radius: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPlaneGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleSystemGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub mSolverType: PxParticleSolverType, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHairSystemGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub tetrahedronMesh: *mut PxTetrahedronMesh, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryHit { + pub faceIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeomOverlapHit { + pub faceIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeomIndexPair { + pub id0: u32, + pub id1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryThreadContext { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomGeometryType { + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub callbacks: *mut PxCustomGeometryCallbacks, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometryHolder { + pub structgen_pad0: [u8; 56], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometryQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightFieldSample { + pub height: i16, + pub materialIndex0: PxBitAndByte, + pub materialIndex1: PxBitAndByte, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightField { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightFieldDesc { + pub nbRows: u32, + pub nbColumns: u32, + pub format: PxHeightFieldFormat, + pub structgen_pad0: [u8; 4], + pub samples: PxStridedData, + pub convexEdgeThreshold: f32, + pub flags: PxHeightFieldFlags, + pub structgen_pad1: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimpleTriangleMesh { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangle { + pub verts: [PxVec3; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTrianglePadded { + pub verts: [PxVec3; 3], + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH34TriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedron { + pub verts: [PxVec3; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyAuxData { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCollisionMeshMappingData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyCollisionData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodySimulationData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCollisionTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAggregate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpringModifiers { + pub stiffness: f32, + pub damping: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRestitutionModifiers { + pub restitution: f32, + pub velocityThreshold: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct Px1DConstraint { + pub linear0: PxVec3, + pub geometricError: f32, + pub angular0: PxVec3, + pub velocityTarget: f32, + pub linear1: PxVec3, + pub minImpulse: f32, + pub angular1: PxVec3, + pub maxImpulse: f32, + pub mods: Px1DConstraintMods, + pub forInternalUse: f32, + pub flags: u16, + pub solveHint: u16, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintInvMassScale { + pub linear0: f32, + pub angular0: f32, + pub linear1: f32, + pub angular1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPoint { + pub normal: PxVec3, + pub separation: f32, + pub point: PxVec3, + pub maxImpulse: f32, + pub targetVel: PxVec3, + pub staticFriction: f32, + pub materialFlags: u8, + pub structgen_pad0: [u8; 3], + pub internalFaceIndex1: u32, + pub dynamicFriction: f32, + pub restitution: f32, + pub damping: f32, + pub structgen_pad1: [u8; 12], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverBody { + pub linearVelocity: PxVec3, + pub maxSolverNormalProgress: u16, + pub maxSolverFrictionProgress: u16, + pub angularState: PxVec3, + pub solverProgress: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverBodyData { + pub linearVelocity: PxVec3, + pub invMass: f32, + pub angularVelocity: PxVec3, + pub reportThreshold: f32, + pub sqrtInvInertia: PxMat33, + pub penBiasClamp: f32, + pub nodeIndex: u32, + pub maxContactImpulse: f32, + pub body2World: PxTransform, + pub pad: u16, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintBatchHeader { + pub startIndex: u32, + pub stride: u16, + pub constraintType: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintDesc { + pub structgen_pad0: [u8; 16], + pub bodyADataIndex: u32, + pub bodyBDataIndex: u32, + pub linkIndexA: u32, + pub linkIndexB: u32, + pub constraint: *mut u8, + pub writeBack: *mut std::ffi::c_void, + pub progressA: u16, + pub progressB: u16, + pub constraintLengthOver16: u16, + pub padding: [u8; 10], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad1: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub structgen_pad2: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad0: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad1: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub offsetSlop: f32, + pub structgen_pad2: [u8; 12], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationLimit { + pub low: f32, + pub high: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationDrive { + pub stiffness: f32, + pub damping: f32, + pub maxForce: f32, + pub driveType: PxArticulationDriveType, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyVel { + pub linearVelocity: PxVec3, + pub nbStaticInteractions: u16, + pub maxDynamicPartition: u16, + pub angularVelocity: PxVec3, + pub partitionMask: u32, + pub deltaAngDt: PxVec3, + pub maxAngVel: f32, + pub deltaLinDt: PxVec3, + pub lockFlags: u16, + pub isKinematic: bool, + pub pad: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyTxInertia { + pub deltaBody2World: PxTransform, + pub sqrtInvInertia: PxMat33, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyData { + pub originalLinearVelocity: PxVec3, + pub maxContactImpulse: f32, + pub originalAngularVelocity: PxVec3, + pub penBiasClamp: f32, + pub invMass: f32, + pub nodeIndex: u32, + pub reportThreshold: f32, + pub pad: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad0: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub cA2w: PxVec3Padded, + pub cB2w: PxVec3Padded, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad0: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad1: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub maxImpulse: f32, + pub torsionalPatchRadius: f32, + pub minTorsionalPatchRadius: f32, + pub offsetSlop: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendonLimit { + pub lowLimit: f32, + pub highLimit: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationAttachment { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendonJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationSpatialTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationFixedTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpatialForce { + pub force: PxVec3, + pub pad0: f32, + pub torque: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpatialVelocity { + pub linear: PxVec3, + pub pad0: f32, + pub angular: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationRootLinkData { + pub transform: PxTransform, + pub worldLinVel: PxVec3, + pub worldAngVel: PxVec3, + pub worldLinAccel: PxVec3, + pub worldAngAccel: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationCache { + pub externalForces: *mut PxSpatialForce, + pub denseJacobian: *mut f32, + pub massMatrix: *mut f32, + pub jointVelocity: *mut f32, + pub jointAcceleration: *mut f32, + pub jointPosition: *mut f32, + pub jointForce: *mut f32, + pub jointSolverForces: *mut f32, + pub linkVelocity: *mut PxSpatialVelocity, + pub linkAcceleration: *mut PxSpatialVelocity, + pub rootLinkData: *mut PxArticulationRootLinkData, + pub sensorForces: *mut PxSpatialForce, + pub coefficientMatrix: *mut f32, + pub lambda: *mut f32, + pub scratchMemory: *mut std::ffi::c_void, + pub scratchAllocator: *mut std::ffi::c_void, + pub version: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationSensor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationJointReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxShape { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxNodeIndex { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidBody { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationLink { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConeLimitedConstraint { + pub mAxis: PxVec3, + pub mAngle: f32, + pub mLowLimit: f32, + pub mHighLimit: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConeLimitParams { + pub lowHighLimits: PxVec4, + pub axisAngle: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintShaderTable { + pub solverPrep: *mut std::ffi::c_void, + pub structgen_pad0: [u8; 8], + pub visualize: *mut std::ffi::c_void, + pub flag: PxConstraintFlag, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMassModificationProps { + pub mInvMassScale0: f32, + pub mInvInertiaScale0: f32, + pub mInvMassScale1: f32, + pub mInvInertiaScale1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPatch { + pub mMassModification: PxMassModificationProps, + pub normal: PxVec3, + pub restitution: f32, + pub dynamicFriction: f32, + pub staticFriction: f32, + pub damping: f32, + pub startContactIndex: u16, + pub nbContacts: u8, + pub materialFlags: u8, + pub internalFlags: u16, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub pad: [u16; 5], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContact { + pub contact: PxVec3, + pub separation: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxExtendedContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxModifiableContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, + pub normal: PxVec3, + pub restitution: f32, + pub materialFlags: u32, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub staticFriction: f32, + pub dynamicFriction: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactStreamIterator { + pub zero: PxVec3, + pub structgen_pad0: [u8; 4], + pub patch: *const PxContactPatch, + pub contact: *const PxContact, + pub faceIndice: *const u32, + pub totalPatches: u32, + pub totalContacts: u32, + pub nextContactIndex: u32, + pub nextPatchIndex: u32, + pub contactPatchHeaderSize: u32, + pub contactPointSize: u32, + pub mStreamFormat: StreamFormat, + pub forceNoResponse: u32, + pub pointStepped: bool, + pub structgen_pad1: [u8; 3], + pub hasFaceIndices: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuContactPair { + pub contactPatches: *mut u8, + pub contactPoints: *mut u8, + pub contactForces: *mut f32, + pub transformCacheRef0: u32, + pub transformCacheRef1: u32, + pub nodeIndex0: PxNodeIndex, + pub nodeIndex1: PxNodeIndex, + pub actor0: *mut PxActor, + pub actor1: *mut PxActor, + pub nbContacts: u16, + pub nbPatches: u16, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactSet { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactModifyPair { + pub actor: [*const PxRigidActor; 2], + pub shape: [*const PxShape; 2], + pub transform: [PxTransform; 2], + pub contacts: PxContactSet, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBaseMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFEMMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFilterData { + pub word0: u32, + pub word1: u32, + pub word2: u32, + pub word3: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleRigidFilterPair { + pub mID0: u64, + pub mID1: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuParticleBufferIndexPair { + pub systemIndex: u32, + pub bufferIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleVolume { + pub bound: PxBounds3, + pub particleIndicesOffset: u32, + pub numParticles: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDiffuseParticleParams { + pub threshold: f32, + pub lifetime: f32, + pub airDrag: f32, + pub bubbleDrag: f32, + pub buoyancy: f32, + pub kineticEnergyWeight: f32, + pub pressureWeight: f32, + pub divergenceWeight: f32, + pub collisionDecay: f32, + pub useAccurateVelocity: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleSpring { + pub ind0: u32, + pub ind1: u32, + pub length: f32, + pub stiffness: f32, + pub damping: f32, + pub pad: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxActorShape { + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastHit { + 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, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapHit { + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepHit { + pub faceIndex: u32, + pub flags: PxHitFlags, + pub structgen_pad0: [u8; 2], + pub position: PxVec3, + pub normal: PxVec3, + pub distance: f32, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastCallback { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapCallback { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepCallback { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryCache { + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryFilterData { + pub data: PxFilterData, + pub flags: PxQueryFlags, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidDynamic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidStatic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQueryDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseRegion { + pub mBounds: PxBounds3, + pub mUserData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseRegionInfo { + pub mRegion: PxBroadPhaseRegion, + pub mNbStaticObjects: u32, + pub mNbDynamicObjects: u32, + pub mActive: bool, + pub mOverlap: bool, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseCaps { + pub mMaxNbRegions: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseDesc { + pub mType: PxBroadPhaseType, + pub structgen_pad0: [u8; 4], + pub mContextID: u64, + pub structgen_pad1: [u8; 8], + pub mFoundLostPairsCapacity: u32, + pub mDiscardStaticVsKinematic: bool, + pub mDiscardKinematicVsKinematic: bool, + pub structgen_pad2: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseUpdateData { + pub mCreated: *const u32, + pub mNbCreated: u32, + pub structgen_pad0: [u8; 4], + pub mUpdated: *const u32, + pub mNbUpdated: u32, + pub structgen_pad1: [u8; 4], + pub mRemoved: *const u32, + pub mNbRemoved: u32, + pub structgen_pad2: [u8; 4], + pub mBounds: *const PxBounds3, + pub mGroups: *const u32, + pub mDistances: *const f32, + pub mCapacity: u32, + pub structgen_pad3: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhasePair { + pub mID0: u32, + pub mID1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseResults { + pub mNbCreatedPairs: u32, + pub structgen_pad0: [u8; 4], + pub mCreatedPairs: *const PxBroadPhasePair, + pub mNbDeletedPairs: u32, + pub structgen_pad1: [u8; 4], + pub mDeletedPairs: *const PxBroadPhasePair, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneLimits { + pub maxNbActors: u32, + pub maxNbBodies: u32, + pub maxNbStaticShapes: u32, + pub maxNbDynamicShapes: u32, + pub maxNbAggregates: u32, + pub maxNbConstraints: u32, + pub maxNbRegions: u32, + pub maxNbBroadPhaseOverlaps: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxgDynamicsMemoryConfig { + pub tempBufferCapacity: u32, + pub maxRigidContactCount: u32, + pub maxRigidPatchCount: u32, + pub heapCapacity: u32, + pub foundLostPairsCapacity: u32, + pub foundLostAggregatePairsCapacity: u32, + pub totalAggregatePairsCapacity: u32, + pub maxSoftBodyContacts: u32, + pub maxFemClothContacts: u32, + pub maxParticleContacts: u32, + pub collisionStackSize: u32, + pub maxHairContacts: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, + pub gravity: PxVec3, + pub simulationEventCallback: *mut PxSimulationEventCallback, + pub contactModifyCallback: *mut PxContactModifyCallback, + pub ccdContactModifyCallback: *mut PxCCDContactModifyCallback, + pub filterShaderData: *const std::ffi::c_void, + pub filterShaderDataSize: u32, + pub structgen_pad0: [u8; 4], + pub filterShader: *mut std::ffi::c_void, + pub filterCallback: *mut PxSimulationFilterCallback, + pub kineKineFilteringMode: PxPairFilteringMode, + pub staticKineFilteringMode: PxPairFilteringMode, + pub broadPhaseType: PxBroadPhaseType, + pub structgen_pad1: [u8; 4], + pub broadPhaseCallback: *mut PxBroadPhaseCallback, + pub limits: PxSceneLimits, + pub frictionType: PxFrictionType, + pub solverType: PxSolverType, + pub bounceThresholdVelocity: f32, + pub frictionOffsetThreshold: f32, + pub frictionCorrelationDistance: f32, + pub flags: PxSceneFlags, + pub cpuDispatcher: *mut PxCpuDispatcher, + pub structgen_pad2: [u8; 8], + pub userData: *mut std::ffi::c_void, + pub solverBatchSize: u32, + pub solverArticulationBatchSize: u32, + pub nbContactDataBlocks: u32, + pub maxNbContactDataBlocks: u32, + pub maxBiasCoefficient: f32, + pub contactReportStreamBufferSize: u32, + pub ccdMaxPasses: u32, + pub ccdThreshold: f32, + pub ccdMaxSeparation: f32, + pub wakeCounterResetValue: f32, + pub sanityBounds: PxBounds3, + pub gpuDynamicsConfig: PxgDynamicsMemoryConfig, + pub gpuMaxNumPartitions: u32, + pub gpuMaxNumStaticPartitions: u32, + pub gpuComputeVersion: u32, + pub contactPairSlabSize: u32, + pub sceneQuerySystem: *mut PxSceneQuerySystem, + pub structgen_pad3: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationStatistics { + pub nbActiveConstraints: u32, + pub nbActiveDynamicBodies: u32, + pub nbActiveKinematicBodies: u32, + pub nbStaticBodies: u32, + pub nbDynamicBodies: u32, + pub nbKinematicBodies: u32, + pub nbShapes: [u32; 11], + pub nbAggregates: u32, + pub nbArticulations: u32, + pub nbAxisSolverConstraints: u32, + pub compressedContactSize: u32, + pub requiredContactConstraintMemory: u32, + pub peakConstraintMemory: u32, + pub nbDiscreteContactPairsTotal: u32, + pub nbDiscreteContactPairsWithCacheHits: u32, + pub nbDiscreteContactPairsWithContacts: u32, + pub nbNewPairs: u32, + pub nbLostPairs: u32, + pub nbNewTouches: u32, + pub nbLostTouches: u32, + pub nbPartitions: u32, + pub structgen_pad0: [u8; 4], + pub gpuMemParticles: u64, + pub gpuMemSoftBodies: u64, + pub gpuMemFEMCloths: u64, + pub gpuMemHairSystems: u64, + pub gpuMemHeap: u64, + pub gpuMemHeapBroadPhase: u64, + pub gpuMemHeapNarrowPhase: u64, + pub gpuMemHeapSolver: u64, + pub gpuMemHeapArticulation: u64, + pub gpuMemHeapSimulation: u64, + pub gpuMemHeapSimulationArticulation: u64, + pub gpuMemHeapSimulationParticles: u64, + pub gpuMemHeapSimulationSoftBody: u64, + pub gpuMemHeapSimulationFEMCloth: u64, + pub gpuMemHeapSimulationHairSystem: u64, + pub gpuMemHeapParticles: u64, + pub gpuMemHeapSoftBodies: u64, + pub gpuMemHeapFEMCloths: u64, + pub gpuMemHeapHairSystems: u64, + pub gpuMemHeapOther: u64, + pub nbBroadPhaseAdds: u32, + pub nbBroadPhaseRemoves: u32, + pub nbDiscreteContactPairs: [[u32; 11]; 11], + pub nbCCDPairs: [[u32; 11]; 11], + pub nbModifiedContactPairs: [[u32; 11]; 11], + pub nbTriggerPairs: [[u32; 11]; 11], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuBodyData { + pub quat: PxQuat, + pub pos: PxVec4, + pub linVel: PxVec4, + pub angVel: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuActorPair { + pub srcIndex: u32, + pub structgen_pad0: [u8; 4], + pub nodeIndex: PxNodeIndex, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxIndexDataPair { + pub index: u32, + pub structgen_pad0: [u8; 4], + pub data: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDominanceGroupPair { + pub dominance0: u8, + pub dominance1: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxScene { + pub structgen_pad0: [u8; 8], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneReadLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairExtraDataItem { + pub type_: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairVelocity { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub linearVelocity: [PxVec3; 2], + pub angularVelocity: [PxVec3; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairPose { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub globalPose: [PxTransform; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairIndex { + pub type_: u8, + pub structgen_pad0: [u8; 1], + pub index: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairExtraDataIterator { + pub currPtr: *const u8, + pub endPtr: *const u8, + pub preSolverVelocity: *const PxContactPairVelocity, + pub postSolverVelocity: *const PxContactPairVelocity, + pub eventPose: *const PxContactPairPose, + pub contactPairIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairHeader { + pub actors: [*mut PxActor; 2], + pub extraDataStream: *const u8, + pub extraDataStreamSize: u16, + pub flags: PxContactPairHeaderFlags, + pub structgen_pad0: [u8; 4], + pub pairs: *const PxContactPair, + pub nbPairs: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairPoint { + pub position: PxVec3, + pub separation: f32, + pub normal: PxVec3, + pub internalFaceIndex0: u32, + pub impulse: PxVec3, + pub internalFaceIndex1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPair { + pub shapes: [*mut PxShape; 2], + pub contactPatches: *const u8, + pub contactPoints: *const u8, + pub contactImpulses: *const f32, + pub requiredBufferSize: u32, + pub contactCount: u8, + pub patchCount: u8, + pub contactStreamSize: u16, + pub flags: PxContactPairFlags, + pub events: PxPairFlags, + pub internalData: [u32; 2], + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriggerPair { + pub triggerShape: *mut PxShape, + pub triggerActor: *mut PxActor, + pub otherShape: *mut PxShape, + pub otherActor: *mut PxActor, + pub status: PxPairFlag, + pub flags: PxTriggerPairFlags, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintInfo { + pub constraint: *mut PxConstraint, + pub externalReference: *mut std::ffi::c_void, + pub type_: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFEMParameters { + pub velocityDamping: f32, + pub settlingThreshold: f32, + pub sleepThreshold: f32, + pub sleepDamping: f32, + pub selfCollisionFilterDistance: f32, + pub selfCollisionStressTolerance: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPruningStructure { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxExtendedVec3 { + pub x: f64, + pub y: f64, + pub z: f64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfExtents: PxVec3, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfHeight: f32, + pub mRadius: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerState { + pub deltaXP: PxVec3, + pub structgen_pad0: [u8; 4], + pub touchedShape: *mut PxShape, + pub touchedActor: *mut PxRigidActor, + pub touchedObstacleHandle: u32, + pub collisionFlags: u32, + pub standOnAnotherCCT: bool, + pub standOnObstacle: bool, + pub isMovingUp: bool, + pub structgen_pad1: [u8; 5], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerStats { + pub nbIterations: u16, + pub nbFullUpdates: u16, + pub nbPartialUpdates: u16, + pub nbTessellation: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerShapeHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub triangleIndex: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllersHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub other: *mut PxController, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerObstacleHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub userData: *const std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerFilters { + pub mFilterData: *const PxFilterData, + pub mFilterCallback: *mut PxQueryFilterCallback, + pub mFilterFlags: PxQueryFlags, + pub structgen_pad0: [u8; 6], + pub mCCTFilterCallback: *mut PxControllerFilterCallback, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 4], + pub halfHeight: f32, + pub halfSideExtent: f32, + pub halfForwardExtent: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 4], + pub radius: f32, + pub height: f32, + pub climbingMode: PxCapsuleClimbingMode, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDim3 { + pub x: u32, + pub y: u32, + pub z: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSDFDesc { + pub sdf: PxBoundedData, + pub dims: PxDim3, + pub meshLower: PxVec3, + pub spacing: f32, + pub subgridSize: u32, + pub bitsPerSubgridPixel: PxSdfBitsPerSubgridPixel, + pub sdfSubgrids3DTexBlockDim: PxDim3, + pub sdfSubgrids: PxBoundedData, + pub sdfStartSlots: PxBoundedData, + pub subgridsMinSdfValue: f32, + pub subgridsMaxSdfValue: f32, + pub sdfBounds: PxBounds3, + pub narrowBandThicknessRelativeToSdfBoundsDiagonal: f32, + pub numThreadsForSdfConstruction: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConvexMeshDesc { + pub points: PxBoundedData, + pub polygons: PxBoundedData, + pub indices: PxBoundedData, + pub flags: PxConvexFlags, + pub vertexLimit: u16, + pub polygonLimit: u16, + pub quantizedCount: u16, + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMeshDesc { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 22], + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshDesc { + pub structgen_pad0: [u8; 16], + pub points: PxBoundedData, + pub tetrahedrons: PxBoundedData, + pub flags: PxMeshFlags, + pub tetsPerElement: u16, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodySimulationDataDesc { + pub vertexToTet: PxBoundedData, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH34MidphaseDesc { + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVH34BuildStrategy, + pub quantized: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMidphaseDesc { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVHDesc { + pub bounds: PxBoundedData, + pub enlargement: f32, + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVHBuildStrategy, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCookingParams { + pub areaTestEpsilon: f32, + pub planeTolerance: f32, + pub convexMeshCookingType: PxConvexMeshCookingType, + pub suppressTriangleMeshRemapTable: bool, + pub buildTriangleAdjacencies: bool, + pub buildGPUData: bool, + pub structgen_pad0: [u8; 1], + pub scale: PxTolerancesScale, + pub meshPreprocessParams: PxMeshPreprocessingFlags, + pub meshWeldTolerance: f32, + pub midphaseDesc: PxMidphaseDesc, + pub gaussMapLimit: u32, + pub maxWeightRatioInTet: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultMemoryOutputStream { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultMemoryInputData { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultFileOutputStream { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultFileInputData { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpring { + pub stiffness: f32, + pub damping: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDistanceJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJacobianRow { + pub linear0: PxVec3, + pub linear1: PxVec3, + pub angular0: PxVec3, + pub angular1: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFixedJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitParameters { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLinearLimit { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub value: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLinearLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointAngularLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitCone { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngle: f32, + pub zAngle: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitPyramid { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngleMin: f32, + pub yAngleMax: f32, + pub zAngleMin: f32, + pub zAngleMax: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPrismaticJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRevoluteJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSphericalJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxD6JointDrive { + pub stiffness: f32, + pub damping: f32, + pub forceLimit: f32, + pub flags: PxD6JointDriveFlags, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxD6Joint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGearJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRackAndPinionJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGroupsMask { + pub bits0: u16, + pub bits1: u16, + pub bits2: u16, + pub bits3: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidActorExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMassProperties { + pub inertiaTensor: PxMat33, + pub centerOfMass: PxVec3, + pub mass: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidBodyExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxShapeExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshOverlapUtil { + pub structgen_pad0: [u8; 1040], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxXmlMiscParameter { + pub upVector: PxVec3, + pub scale: PxTolerancesScale, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSerialization { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxStringTableExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQueryExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSamplingExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPoissonSampler { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMeshPoissonSampler { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRepXObject { + pub typeName: *const std::ffi::c_char, + pub serializable: *const std::ffi::c_void, + pub id: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRepXInstantiationArgs { + pub structgen_pad0: [u8; 8], + pub cooker: *mut PxCooking, + pub stringTable: *mut PxStringTable, +} +#[cfg(test)] +mod sizes { + use super::*; + use std::mem::size_of; + #[test] + fn check_sizes() { + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 176); + assert_eq!(size_of::(), 160); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 44); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 112); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 128); + assert_eq!(size_of::(), 192); + assert_eq!(size_of::(), 208); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 144); + assert_eq!(size_of::(), 224); + assert_eq!(size_of::(), 224); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 76); + assert_eq!(size_of::(), 136); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 104); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 352); + assert_eq!(size_of::(), 2232); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 52); + assert_eq!(size_of::(), 60); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 136); + assert_eq!(size_of::(), 144); + assert_eq!(size_of::(), 144); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 160); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 52); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1040); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + } +} diff --git a/modules/PhysX/physx/physx-sys/src/generated/unix/structgen_out.hpp b/modules/PhysX/physx/physx-sys/src/generated/unix/structgen_out.hpp new file mode 100644 index 0000000..30822a8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/generated/unix/structgen_out.hpp @@ -0,0 +1,2075 @@ +struct physx_PxAllocatorCallback; +struct physx_PxErrorCallback; +struct physx_PxAssertHandler; +struct physx_PxInputStream; +struct physx_PxInputData; +struct physx_PxOutputStream; +struct physx_PxVec2; +struct physx_PxVec3; +struct physx_PxVec4; +struct physx_PxQuat; +struct physx_PxMat33; +struct physx_PxMat34; +struct physx_PxMat44; +struct physx_PxTransform; +struct physx_PxPlane; +struct physx_PxBounds3; +struct physx_PxAllocatorCallback { + void* vtable_; +}; +struct physx_PxAssertHandler { + void* vtable_; +}; +struct physx_PxAllocationListener; +struct physx_PxFoundation { + void* vtable_; +}; +struct physx_PxProfilerCallback; +struct physx_PxAllocator { + char structgen_pad0[1]; +}; +struct physx_PxRawAllocator { + char structgen_pad0[1]; +}; +struct physx_PxVirtualAllocatorCallback { + void* vtable_; +}; +struct physx_PxVirtualAllocator { + char structgen_pad0[16]; +}; +struct physx_PxUserAllocated { + char structgen_pad0[1]; +}; +union physx_PxTempAllocatorChunk { + physx_PxTempAllocatorChunk* mNext; + uint32_t mIndex; + uint8_t mPad[16]; +}; +struct physx_PxTempAllocator { + char structgen_pad0[1]; +}; +struct physx_PxLogTwo; +struct physx_PxUnConst; +struct physx_PxBitAndByte { + char structgen_pad0[1]; +}; +struct physx_PxBitMap { + char structgen_pad0[16]; +}; +struct physx_PxVec3 { + float x; + float y; + float z; +}; +struct physx_PxVec3Padded { + float x; + float y; + float z; + uint32_t padding; +}; +struct physx_PxQuat { + float x; + float y; + float z; + float w; +}; +struct physx_PxTransform { + physx_PxQuat q; + physx_PxVec3 p; +}; +struct physx_PxTransformPadded { + physx_PxTransform transform; + uint32_t padding; +}; +struct physx_PxMat33 { + physx_PxVec3 column0; + physx_PxVec3 column1; + physx_PxVec3 column2; +}; +struct physx_PxBounds3 { + physx_PxVec3 minimum; + physx_PxVec3 maximum; +}; +struct physx_PxErrorCallback { + void* vtable_; +}; +struct physx_PxAllocationListener { + void* vtable_; +}; +struct physx_PxBroadcastingAllocator { + char structgen_pad0[176]; +}; +struct physx_PxBroadcastingErrorCallback { + char structgen_pad0[160]; +}; +struct physx_PxHash; +struct physx_PxInputStream { + void* vtable_; +}; +struct physx_PxInputData { + void* vtable_; +}; +struct physx_PxOutputStream { + void* vtable_; +}; +struct physx_PxVec4 { + float x; + float y; + float z; + float w; +}; +struct physx_PxMat44 { + physx_PxVec4 column0; + physx_PxVec4 column1; + physx_PxVec4 column2; + physx_PxVec4 column3; +}; +struct physx_PxPlane { + physx_PxVec3 n; + float d; +}; +struct physx_Interpolation { + char structgen_pad0[1]; +}; +struct physx_PxMutexImpl { + char structgen_pad0[1]; +}; +struct physx_PxReadWriteLock { + char structgen_pad0[8]; +}; +struct physx_PxProfilerCallback { + void* vtable_; +}; +struct physx_PxProfileScoped { + physx_PxProfilerCallback* mCallback; + char const* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; + char structgen_pad0[7]; +}; +struct physx_PxSListEntry { + char structgen_pad0[16]; +}; +struct physx_PxSListImpl { + char structgen_pad0[1]; +}; +struct physx_PxSyncImpl { + char structgen_pad0[1]; +}; +struct physx_PxRunnable { + void* vtable_; +}; +struct physx_PxCounterFrequencyToTensOfNanos { + uint64_t mNumerator; + uint64_t mDenominator; +}; +struct physx_PxTime { + char structgen_pad0[8]; +}; +struct physx_PxVec2 { + float x; + float y; +}; +struct physx_PxStridedData { + uint32_t stride; + char structgen_pad0[4]; + void const* data; +}; +struct physx_PxBoundedData { + uint32_t stride; + char structgen_pad0[4]; + void const* data; + uint32_t count; + char structgen_pad1[4]; +}; +struct physx_PxDebugPoint { + physx_PxVec3 pos; + uint32_t color; +}; +struct physx_PxDebugLine { + physx_PxVec3 pos0; + uint32_t color0; + physx_PxVec3 pos1; + uint32_t color1; +}; +struct physx_PxDebugTriangle { + physx_PxVec3 pos0; + uint32_t color0; + physx_PxVec3 pos1; + uint32_t color1; + physx_PxVec3 pos2; + uint32_t color2; +}; +struct physx_PxDebugText { + physx_PxVec3 position; + float size; + uint32_t color; + char structgen_pad0[4]; + char const* string; +}; +struct physx_PxRenderBuffer { + void* vtable_; +}; +struct physx_PxBase; +struct physx_PxSerializationContext; +struct physx_PxRepXSerializer; +struct physx_PxSerializer; +struct physx_PxPhysics; +struct physx_PxCollection; +struct physx_PxProcessPxBaseCallback { + void* vtable_; +}; +struct physx_PxSerializationContext { + void* vtable_; +}; +struct physx_PxDeserializationContext { + char structgen_pad0[16]; +}; +struct physx_PxSerializationRegistry { + void* vtable_; +}; +struct physx_PxCollection { + void* vtable_; +}; +struct physx_PxTypeInfo; +struct physx_PxMaterial; +struct physx_PxFEMSoftBodyMaterial; +struct physx_PxFEMClothMaterial; +struct physx_PxPBDMaterial; +struct physx_PxFLIPMaterial; +struct physx_PxMPMMaterial; +struct physx_PxCustomMaterial; +struct physx_PxConvexMesh; +struct physx_PxTriangleMesh; +struct physx_PxBVH33TriangleMesh; +struct physx_PxBVH34TriangleMesh; +struct physx_PxTetrahedronMesh; +struct physx_PxHeightField; +struct physx_PxActor; +struct physx_PxRigidActor; +struct physx_PxRigidBody; +struct physx_PxRigidDynamic; +struct physx_PxRigidStatic; +struct physx_PxArticulationLink; +struct physx_PxArticulationJointReducedCoordinate; +struct physx_PxArticulationReducedCoordinate; +struct physx_PxAggregate; +struct physx_PxConstraint; +struct physx_PxShape; +struct physx_PxPruningStructure; +struct physx_PxParticleSystem; +struct physx_PxPBDParticleSystem; +struct physx_PxFLIPParticleSystem; +struct physx_PxMPMParticleSystem; +struct physx_PxCustomParticleSystem; +struct physx_PxSoftBody; +struct physx_PxFEMCloth; +struct physx_PxHairSystem; +struct physx_PxParticleBuffer; +struct physx_PxParticleAndDiffuseBuffer; +struct physx_PxParticleClothBuffer; +struct physx_PxParticleRigidBuffer; +struct physx_PxBase { + char structgen_pad0[16]; +}; +struct physx_PxRefCounted { + char structgen_pad0[16]; +}; +struct physx_PxTolerancesScale { + float length; + float speed; +}; +struct physx_PxStringTable { + void* vtable_; +}; +struct physx_PxSerializer { + void* vtable_; +}; +struct physx_PxMetaDataEntry { + char const* type; + char const* name; + uint32_t offset; + uint32_t size; + uint32_t count; + uint32_t offsetSize; + uint32_t flags; + uint32_t alignment; +}; +struct physx_PxInsertionCallback { + void* vtable_; +}; +struct physx_PxBaseTask; +struct physx_PxTask; +struct physx_PxLightCpuTask; +struct physx_PxCpuDispatcher; +struct physx_PxTaskManager { + void* vtable_; +}; +struct physx_PxCpuDispatcher { + void* vtable_; +}; +struct physx_PxBaseTask { + char structgen_pad0[24]; +}; +struct physx_PxTask { + char structgen_pad0[32]; +}; +struct physx_PxLightCpuTask { + char structgen_pad0[40]; +}; +struct physx_PxGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxBoxGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxVec3 halfExtents; +}; +struct physx_PxBVHRaycastCallback { + void* vtable_; +}; +struct physx_PxBVHOverlapCallback { + void* vtable_; +}; +struct physx_PxBVHTraversalCallback { + void* vtable_; +}; +struct physx_PxBVH { + char structgen_pad0[16]; +}; +struct physx_PxGeomIndexPair; +struct physx_PxCapsuleGeometry { + char structgen_pad0[4]; + float mTypePadding; + float radius; + float halfHeight; +}; +struct physx_PxHullPolygon { + float mPlane[4]; + uint16_t mNbVerts; + uint16_t mIndexBase; +}; +struct physx_PxConvexMesh { + char structgen_pad0[16]; +}; +struct physx_PxMeshScale { + physx_PxVec3 scale; + physx_PxQuat rotation; +}; +struct physx_PxConvexMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxMeshScale scale; + char structgen_pad1[4]; + physx_PxConvexMesh* convexMesh; + uint8_t meshFlags; + char structgen_pad2[7]; +}; +struct physx_PxSphereGeometry { + char structgen_pad0[4]; + float mTypePadding; + float radius; +}; +struct physx_PxPlaneGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxTriangleMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxMeshScale scale; + uint8_t meshFlags; + char structgen_pad1[3]; + physx_PxTriangleMesh* triangleMesh; +}; +struct physx_PxHeightFieldGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxHeightField* heightField; + float heightScale; + float rowScale; + float columnScale; + uint8_t heightFieldFlags; + char structgen_pad1[3]; +}; +struct physx_PxParticleSystemGeometry { + char structgen_pad0[4]; + float mTypePadding; + int32_t mSolverType; +}; +struct physx_PxHairSystemGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxTetrahedronMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxTetrahedronMesh* tetrahedronMesh; +}; +struct physx_PxQueryHit { + uint32_t faceIndex; +}; +struct physx_PxLocationHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; +}; +struct physx_PxGeomRaycastHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + float u; + float v; +}; +struct physx_PxGeomOverlapHit { + uint32_t faceIndex; +}; +struct physx_PxGeomSweepHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; +}; +struct physx_PxGeomIndexPair { + uint32_t id0; + uint32_t id1; +}; +struct physx_PxQueryThreadContext { + char structgen_pad0[1]; +}; +struct physx_PxContactBuffer; +struct physx_PxRenderOutput; +struct physx_PxMassProperties; +struct physx_PxCustomGeometryType { + char structgen_pad0[4]; +}; +struct physx_PxCustomGeometryCallbacks { + void* vtable_; +}; +struct physx_PxCustomGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxCustomGeometryCallbacks* callbacks; +}; +struct physx_PxGeometryHolder { + char structgen_pad0[56]; +}; +struct physx_PxGeometryQuery { + char structgen_pad0[1]; +}; +struct physx_PxHeightFieldSample { + int16_t height; + physx_PxBitAndByte materialIndex0; + physx_PxBitAndByte materialIndex1; +}; +struct physx_PxHeightFieldDesc; +struct physx_PxHeightField { + char structgen_pad0[16]; +}; +struct physx_PxHeightFieldDesc { + uint32_t nbRows; + uint32_t nbColumns; + int32_t format; + char structgen_pad0[4]; + physx_PxStridedData samples; + float convexEdgeThreshold; + uint16_t flags; + char structgen_pad1[2]; +}; +struct physx_PxTriangle; +struct physx_PxMeshQuery { + char structgen_pad0[1]; +}; +struct physx_PxSimpleTriangleMesh { + physx_PxBoundedData points; + physx_PxBoundedData triangles; + uint16_t flags; + char structgen_pad0[6]; +}; +struct physx_PxTriangle { + physx_PxVec3 verts[3]; +}; +struct physx_PxTrianglePadded { + physx_PxVec3 verts[3]; + uint32_t padding; +}; +struct physx_PxTriangleMesh { + char structgen_pad0[16]; +}; +struct physx_PxBVH34TriangleMesh { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedron { + physx_PxVec3 verts[4]; +}; +struct physx_PxSoftBodyAuxData { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedronMesh { + char structgen_pad0[16]; +}; +struct physx_PxSoftBodyMesh { + char structgen_pad0[16]; +}; +struct physx_PxCollisionMeshMappingData { + char structgen_pad0[8]; +}; +struct physx_PxSoftBodyCollisionData { + char structgen_pad0[1]; +}; +struct physx_PxTetrahedronMeshData { + char structgen_pad0[1]; +}; +struct physx_PxSoftBodySimulationData { + char structgen_pad0[1]; +}; +struct physx_PxCollisionTetrahedronMeshData { + char structgen_pad0[8]; +}; +struct physx_PxSimulationTetrahedronMeshData { + char structgen_pad0[8]; +}; +struct physx_PxScene; +struct physx_PxActor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxAggregate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpringModifiers { + float stiffness; + float damping; + char structgen_pad0[8]; +}; +struct physx_PxRestitutionModifiers { + float restitution; + float velocityThreshold; + char structgen_pad0[8]; +}; +union physx_Px1DConstraintMods { + physx_PxSpringModifiers spring; + physx_PxRestitutionModifiers bounce; +}; +struct physx_Px1DConstraint { + physx_PxVec3 linear0; + float geometricError; + physx_PxVec3 angular0; + float velocityTarget; + physx_PxVec3 linear1; + float minImpulse; + physx_PxVec3 angular1; + float maxImpulse; + physx_Px1DConstraintMods mods; + float forInternalUse; + uint16_t flags; + uint16_t solveHint; + char structgen_pad0[8]; +}; +struct physx_PxConstraintInvMassScale { + float linear0; + float angular0; + float linear1; + float angular1; +}; +struct physx_PxConstraintVisualizer { + void* vtable_; +}; +struct physx_PxConstraintConnector { + void* vtable_; +}; +struct physx_PxContactPoint { + physx_PxVec3 normal; + float separation; + physx_PxVec3 point; + float maxImpulse; + physx_PxVec3 targetVel; + float staticFriction; + uint8_t materialFlags; + char structgen_pad0[3]; + uint32_t internalFaceIndex1; + float dynamicFriction; + float restitution; + float damping; + char structgen_pad1[12]; +}; +struct physx_PxTGSSolverBodyVel; +struct physx_PxSolverBody { + physx_PxVec3 linearVelocity; + uint16_t maxSolverNormalProgress; + uint16_t maxSolverFrictionProgress; + physx_PxVec3 angularState; + uint32_t solverProgress; +}; +struct physx_PxSolverBodyData { + physx_PxVec3 linearVelocity; + float invMass; + physx_PxVec3 angularVelocity; + float reportThreshold; + physx_PxMat33 sqrtInvInertia; + float penBiasClamp; + uint32_t nodeIndex; + float maxContactImpulse; + physx_PxTransform body2World; + uint16_t pad; + char structgen_pad0[2]; +}; +struct physx_PxConstraintBatchHeader { + uint32_t startIndex; + uint16_t stride; + uint16_t constraintType; +}; +struct physx_PxSolverConstraintDesc { + char structgen_pad0[16]; + uint32_t bodyADataIndex; + uint32_t bodyBDataIndex; + uint32_t linkIndexA; + uint32_t linkIndexB; + uint8_t* constraint; + void* writeBack; + uint16_t progressA; + uint16_t progressB; + uint16_t constraintLengthOver16; + uint8_t padding[10]; +}; +struct physx_PxSolverConstraintPrepDescBase { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxSolverConstraintPrepDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + physx_Px1DConstraint* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad1[3]; + physx_PxVec3Padded body0WorldOffset; + char structgen_pad2[8]; +}; +struct physx_PxSolverContactDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float offsetSlop; + char structgen_pad2[12]; +}; +struct physx_PxConstraintAllocator { + void* vtable_; +}; +struct physx_PxArticulationLimit { + float low; + float high; +}; +struct physx_PxArticulationDrive { + float stiffness; + float damping; + float maxForce; + int32_t driveType; +}; +struct physx_PxTGSSolverBodyVel { + physx_PxVec3 linearVelocity; + uint16_t nbStaticInteractions; + uint16_t maxDynamicPartition; + physx_PxVec3 angularVelocity; + uint32_t partitionMask; + physx_PxVec3 deltaAngDt; + float maxAngVel; + physx_PxVec3 deltaLinDt; + uint16_t lockFlags; + bool isKinematic; + uint8_t pad; +}; +struct physx_PxTGSSolverBodyTxInertia { + physx_PxTransform deltaBody2World; + physx_PxMat33 sqrtInvInertia; +}; +struct physx_PxTGSSolverBodyData { + physx_PxVec3 originalLinearVelocity; + float maxContactImpulse; + physx_PxVec3 originalAngularVelocity; + float penBiasClamp; + float invMass; + uint32_t nodeIndex; + float reportThreshold; + uint32_t pad; +}; +struct physx_PxTGSSolverConstraintPrepDescBase { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxTGSSolverConstraintPrepDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + physx_Px1DConstraint* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad0[3]; + physx_PxVec3Padded body0WorldOffset; + physx_PxVec3Padded cA2w; + physx_PxVec3Padded cB2w; +}; +struct physx_PxTGSSolverContactDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + void* shapeInteraction; + physx_PxContactPoint* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad0[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad1[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float maxImpulse; + float torsionalPatchRadius; + float minTorsionalPatchRadius; + float offsetSlop; +}; +struct physx_PxArticulationSpatialTendon; +struct physx_PxArticulationFixedTendon; +struct physx_PxArticulationTendonLimit { + float lowLimit; + float highLimit; +}; +struct physx_PxArticulationAttachment { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendonJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationSpatialTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationFixedTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpatialForce { + physx_PxVec3 force; + float pad0; + physx_PxVec3 torque; + float pad1; +}; +struct physx_PxSpatialVelocity { + physx_PxVec3 linear; + float pad0; + physx_PxVec3 angular; + float pad1; +}; +struct physx_PxArticulationRootLinkData { + physx_PxTransform transform; + physx_PxVec3 worldLinVel; + physx_PxVec3 worldAngVel; + physx_PxVec3 worldLinAccel; + physx_PxVec3 worldAngAccel; +}; +struct physx_PxArticulationCache { + physx_PxSpatialForce* externalForces; + float* denseJacobian; + float* massMatrix; + float* jointVelocity; + float* jointAcceleration; + float* jointPosition; + float* jointForce; + float* jointSolverForces; + physx_PxSpatialVelocity* linkVelocity; + physx_PxSpatialVelocity* linkAcceleration; + physx_PxArticulationRootLinkData* rootLinkData; + physx_PxSpatialForce* sensorForces; + float* coefficientMatrix; + float* lambda; + void* scratchMemory; + void* scratchAllocator; + uint32_t version; + char structgen_pad0[4]; +}; +struct physx_PxArticulationSensor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationReducedCoordinate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationJointReducedCoordinate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData; +struct physx_PxBaseMaterial; +struct physx_PxShape { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidActor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxNodeIndex { + char structgen_pad0[8]; +}; +struct physx_PxRigidBody { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationLink { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxConeLimitedConstraint { + physx_PxVec3 mAxis; + float mAngle; + float mLowLimit; + float mHighLimit; +}; +struct physx_PxConeLimitParams { + physx_PxVec4 lowHighLimits; + physx_PxVec4 axisAngle; +}; +struct physx_PxConstraintShaderTable { + void * solverPrep; + char structgen_pad0[8]; + void * visualize; + int32_t flag; + char structgen_pad1[4]; +}; +struct physx_PxConstraint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxMassModificationProps { + float mInvMassScale0; + float mInvInertiaScale0; + float mInvMassScale1; + float mInvInertiaScale1; +}; +struct physx_PxContactPatch { + physx_PxMassModificationProps mMassModification; + physx_PxVec3 normal; + float restitution; + float dynamicFriction; + float staticFriction; + float damping; + uint16_t startContactIndex; + uint8_t nbContacts; + uint8_t materialFlags; + uint16_t internalFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + uint16_t pad[5]; +}; +struct physx_PxContact { + physx_PxVec3 contact; + float separation; +}; +struct physx_PxExtendedContact { + physx_PxVec3 contact; + float separation; + physx_PxVec3 targetVelocity; + float maxImpulse; +}; +struct physx_PxModifiableContact { + physx_PxVec3 contact; + float separation; + physx_PxVec3 targetVelocity; + float maxImpulse; + physx_PxVec3 normal; + float restitution; + uint32_t materialFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + float staticFriction; + float dynamicFriction; +}; +struct physx_PxContactStreamIterator { + physx_PxVec3 zero; + char structgen_pad0[4]; + physx_PxContactPatch const* patch; + physx_PxContact const* contact; + uint32_t const* faceIndice; + uint32_t totalPatches; + uint32_t totalContacts; + uint32_t nextContactIndex; + uint32_t nextPatchIndex; + uint32_t contactPatchHeaderSize; + uint32_t contactPointSize; + int32_t mStreamFormat; + uint32_t forceNoResponse; + bool pointStepped; + char structgen_pad1[3]; + uint32_t hasFaceIndices; +}; +struct physx_PxGpuContactPair { + uint8_t* contactPatches; + uint8_t* contactPoints; + float* contactForces; + uint32_t transformCacheRef0; + uint32_t transformCacheRef1; + physx_PxNodeIndex nodeIndex0; + physx_PxNodeIndex nodeIndex1; + physx_PxActor* actor0; + physx_PxActor* actor1; + uint16_t nbContacts; + uint16_t nbPatches; + char structgen_pad0[4]; +}; +struct physx_PxContactSet { + char structgen_pad0[16]; +}; +struct physx_PxContactModifyPair { + physx_PxRigidActor const* actor[2]; + physx_PxShape const* shape[2]; + physx_PxTransform transform[2]; + physx_PxContactSet contacts; +}; +struct physx_PxContactModifyCallback { + void* vtable_; +}; +struct physx_PxCCDContactModifyCallback { + void* vtable_; +}; +struct physx_PxDeletionListener { + void* vtable_; +}; +struct physx_PxBaseMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFEMMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData { + uint32_t word0; + uint32_t word1; + uint32_t word2; + uint32_t word3; +}; +struct physx_PxSimulationFilterCallback { + void* vtable_; +}; +struct physx_PxParticleRigidFilterPair { + uint64_t mID0; + uint64_t mID1; +}; +struct physx_PxLockedData { + void* vtable_; +}; +struct physx_PxMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGpuParticleBufferIndexPair { + uint32_t systemIndex; + uint32_t bufferIndex; +}; +struct physx_PxCudaContextManager; +struct physx_PxParticleRigidAttachment; +struct physx_PxParticleVolume { + physx_PxBounds3 bound; + uint32_t particleIndicesOffset; + uint32_t numParticles; +}; +struct physx_PxDiffuseParticleParams { + float threshold; + float lifetime; + float airDrag; + float bubbleDrag; + float buoyancy; + float kineticEnergyWeight; + float pressureWeight; + float divergenceWeight; + float collisionDecay; + bool useAccurateVelocity; + char structgen_pad0[3]; +}; +struct physx_PxParticleSpring { + uint32_t ind0; + uint32_t ind1; + float length; + float stiffness; + float damping; + float pad; +}; +struct physx_PxParticleMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneDesc; +struct physx_PxPvd; +struct physx_PxOmniPvd; +struct physx_PxPhysics { + void* vtable_; +}; +struct physx_PxActorShape { + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxRaycastHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + float u; + float v; + char structgen_pad1[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxOverlapHit { + uint32_t faceIndex; + char structgen_pad0[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxSweepHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + char structgen_pad1[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxRaycastCallback { + char structgen_pad0[8]; + physx_PxRaycastHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapCallback { + char structgen_pad0[8]; + physx_PxOverlapHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepCallback { + char structgen_pad0[8]; + physx_PxSweepHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxRaycastBuffer { + char structgen_pad0[8]; + physx_PxRaycastHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapBuffer { + char structgen_pad0[8]; + physx_PxOverlapHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepBuffer { + char structgen_pad0[8]; + physx_PxSweepHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxQueryCache { + physx_PxShape* shape; + physx_PxRigidActor* actor; + uint32_t faceIndex; + char structgen_pad0[4]; +}; +struct physx_PxQueryFilterData { + physx_PxFilterData data; + uint16_t flags; + char structgen_pad0[2]; +}; +struct physx_PxQueryFilterCallback { + void* vtable_; +}; +struct physx_PxRigidDynamic { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidStatic { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneQuerySystem; +struct physx_PxSceneQueryDesc { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; +}; +struct physx_PxSceneQuerySystemBase { + void* vtable_; +}; +struct physx_PxSceneSQSystem { + void* vtable_; +}; +struct physx_PxSceneQuerySystem { + void* vtable_; +}; +struct physx_PxBroadPhaseRegion { + physx_PxBounds3 mBounds; + void* mUserData; +}; +struct physx_PxBroadPhaseRegionInfo { + physx_PxBroadPhaseRegion mRegion; + uint32_t mNbStaticObjects; + uint32_t mNbDynamicObjects; + bool mActive; + bool mOverlap; + char structgen_pad0[6]; +}; +struct physx_PxBroadPhaseCaps { + uint32_t mMaxNbRegions; +}; +struct physx_PxBroadPhaseDesc { + int32_t mType; + char structgen_pad0[4]; + uint64_t mContextID; + char structgen_pad1[8]; + uint32_t mFoundLostPairsCapacity; + bool mDiscardStaticVsKinematic; + bool mDiscardKinematicVsKinematic; + char structgen_pad2[2]; +}; +struct physx_PxBroadPhaseUpdateData { + uint32_t const* mCreated; + uint32_t mNbCreated; + char structgen_pad0[4]; + uint32_t const* mUpdated; + uint32_t mNbUpdated; + char structgen_pad1[4]; + uint32_t const* mRemoved; + uint32_t mNbRemoved; + char structgen_pad2[4]; + physx_PxBounds3 const* mBounds; + uint32_t const* mGroups; + float const* mDistances; + uint32_t mCapacity; + char structgen_pad3[4]; +}; +struct physx_PxBroadPhasePair { + uint32_t mID0; + uint32_t mID1; +}; +struct physx_PxBroadPhaseResults { + uint32_t mNbCreatedPairs; + char structgen_pad0[4]; + physx_PxBroadPhasePair const* mCreatedPairs; + uint32_t mNbDeletedPairs; + char structgen_pad1[4]; + physx_PxBroadPhasePair const* mDeletedPairs; +}; +struct physx_PxBroadPhaseRegions { + void* vtable_; +}; +struct physx_PxBroadPhase { + void* vtable_; +}; +struct physx_PxAABBManager { + void* vtable_; +}; +struct physx_PxBroadPhaseCallback; +struct physx_PxSimulationEventCallback; +struct physx_PxSceneLimits { + uint32_t maxNbActors; + uint32_t maxNbBodies; + uint32_t maxNbStaticShapes; + uint32_t maxNbDynamicShapes; + uint32_t maxNbAggregates; + uint32_t maxNbConstraints; + uint32_t maxNbRegions; + uint32_t maxNbBroadPhaseOverlaps; +}; +struct physx_PxgDynamicsMemoryConfig { + uint32_t tempBufferCapacity; + uint32_t maxRigidContactCount; + uint32_t maxRigidPatchCount; + uint32_t heapCapacity; + uint32_t foundLostPairsCapacity; + uint32_t foundLostAggregatePairsCapacity; + uint32_t totalAggregatePairsCapacity; + uint32_t maxSoftBodyContacts; + uint32_t maxFemClothContacts; + uint32_t maxParticleContacts; + uint32_t collisionStackSize; + uint32_t maxHairContacts; +}; +struct physx_PxSceneDesc { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; + physx_PxVec3 gravity; + physx_PxSimulationEventCallback* simulationEventCallback; + physx_PxContactModifyCallback* contactModifyCallback; + physx_PxCCDContactModifyCallback* ccdContactModifyCallback; + void const* filterShaderData; + uint32_t filterShaderDataSize; + char structgen_pad0[4]; + void * filterShader; + physx_PxSimulationFilterCallback* filterCallback; + int32_t kineKineFilteringMode; + int32_t staticKineFilteringMode; + int32_t broadPhaseType; + char structgen_pad1[4]; + physx_PxBroadPhaseCallback* broadPhaseCallback; + physx_PxSceneLimits limits; + int32_t frictionType; + int32_t solverType; + float bounceThresholdVelocity; + float frictionOffsetThreshold; + float frictionCorrelationDistance; + uint32_t flags; + physx_PxCpuDispatcher* cpuDispatcher; + char structgen_pad2[8]; + void* userData; + uint32_t solverBatchSize; + uint32_t solverArticulationBatchSize; + uint32_t nbContactDataBlocks; + uint32_t maxNbContactDataBlocks; + float maxBiasCoefficient; + uint32_t contactReportStreamBufferSize; + uint32_t ccdMaxPasses; + float ccdThreshold; + float ccdMaxSeparation; + float wakeCounterResetValue; + physx_PxBounds3 sanityBounds; + physx_PxgDynamicsMemoryConfig gpuDynamicsConfig; + uint32_t gpuMaxNumPartitions; + uint32_t gpuMaxNumStaticPartitions; + uint32_t gpuComputeVersion; + uint32_t contactPairSlabSize; + physx_PxSceneQuerySystem* sceneQuerySystem; + char structgen_pad3[8]; +}; +struct physx_PxSimulationStatistics { + uint32_t nbActiveConstraints; + uint32_t nbActiveDynamicBodies; + uint32_t nbActiveKinematicBodies; + uint32_t nbStaticBodies; + uint32_t nbDynamicBodies; + uint32_t nbKinematicBodies; + uint32_t nbShapes[11]; + uint32_t nbAggregates; + uint32_t nbArticulations; + uint32_t nbAxisSolverConstraints; + uint32_t compressedContactSize; + uint32_t requiredContactConstraintMemory; + uint32_t peakConstraintMemory; + uint32_t nbDiscreteContactPairsTotal; + uint32_t nbDiscreteContactPairsWithCacheHits; + uint32_t nbDiscreteContactPairsWithContacts; + uint32_t nbNewPairs; + uint32_t nbLostPairs; + uint32_t nbNewTouches; + uint32_t nbLostTouches; + uint32_t nbPartitions; + char structgen_pad0[4]; + uint64_t gpuMemParticles; + uint64_t gpuMemSoftBodies; + uint64_t gpuMemFEMCloths; + uint64_t gpuMemHairSystems; + uint64_t gpuMemHeap; + uint64_t gpuMemHeapBroadPhase; + uint64_t gpuMemHeapNarrowPhase; + uint64_t gpuMemHeapSolver; + uint64_t gpuMemHeapArticulation; + uint64_t gpuMemHeapSimulation; + uint64_t gpuMemHeapSimulationArticulation; + uint64_t gpuMemHeapSimulationParticles; + uint64_t gpuMemHeapSimulationSoftBody; + uint64_t gpuMemHeapSimulationFEMCloth; + uint64_t gpuMemHeapSimulationHairSystem; + uint64_t gpuMemHeapParticles; + uint64_t gpuMemHeapSoftBodies; + uint64_t gpuMemHeapFEMCloths; + uint64_t gpuMemHeapHairSystems; + uint64_t gpuMemHeapOther; + uint32_t nbBroadPhaseAdds; + uint32_t nbBroadPhaseRemoves; + uint32_t nbDiscreteContactPairs[11][11]; + uint32_t nbCCDPairs[11][11]; + uint32_t nbModifiedContactPairs[11][11]; + uint32_t nbTriggerPairs[11][11]; +}; +struct physx_PxGpuBodyData { + physx_PxQuat quat; + physx_PxVec4 pos; + physx_PxVec4 linVel; + physx_PxVec4 angVel; +}; +struct physx_PxGpuActorPair { + uint32_t srcIndex; + char structgen_pad0[4]; + physx_PxNodeIndex nodeIndex; +}; +struct physx_PxIndexDataPair { + uint32_t index; + char structgen_pad0[4]; + void* data; +}; +struct physx_PxPvdSceneClient { + void* vtable_; +}; +struct physx_PxContactPairHeader; +struct physx_PxDominanceGroupPair { + uint8_t dominance0; + uint8_t dominance1; +}; +struct physx_PxBroadPhaseCallback { + void* vtable_; +}; +struct physx_PxScene { + char structgen_pad0[8]; + void* userData; +}; +struct physx_PxSceneReadLock { + char structgen_pad0[8]; +}; +struct physx_PxSceneWriteLock { + char structgen_pad0[8]; +}; +struct physx_PxContactPairExtraDataItem { + uint8_t type; +}; +struct physx_PxContactPairVelocity { + uint8_t type; + char structgen_pad0[3]; + physx_PxVec3 linearVelocity[2]; + physx_PxVec3 angularVelocity[2]; +}; +struct physx_PxContactPairPose { + uint8_t type; + char structgen_pad0[3]; + physx_PxTransform globalPose[2]; +}; +struct physx_PxContactPairIndex { + uint8_t type; + char structgen_pad0[1]; + uint16_t index; +}; +struct physx_PxContactPairExtraDataIterator { + uint8_t const* currPtr; + uint8_t const* endPtr; + physx_PxContactPairVelocity const* preSolverVelocity; + physx_PxContactPairVelocity const* postSolverVelocity; + physx_PxContactPairPose const* eventPose; + uint32_t contactPairIndex; + char structgen_pad0[4]; +}; +struct physx_PxContactPair; +struct physx_PxContactPairHeader { + physx_PxActor* actors[2]; + uint8_t const* extraDataStream; + uint16_t extraDataStreamSize; + uint16_t flags; + char structgen_pad0[4]; + physx_PxContactPair const* pairs; + uint32_t nbPairs; + char structgen_pad1[4]; +}; +struct physx_PxContactPairPoint { + physx_PxVec3 position; + float separation; + physx_PxVec3 normal; + uint32_t internalFaceIndex0; + physx_PxVec3 impulse; + uint32_t internalFaceIndex1; +}; +struct physx_PxContactPair { + physx_PxShape* shapes[2]; + uint8_t const* contactPatches; + uint8_t const* contactPoints; + float const* contactImpulses; + uint32_t requiredBufferSize; + uint8_t contactCount; + uint8_t patchCount; + uint16_t contactStreamSize; + uint16_t flags; + uint16_t events; + uint32_t internalData[2]; + char structgen_pad0[4]; +}; +struct physx_PxTriggerPair { + physx_PxShape* triggerShape; + physx_PxActor* triggerActor; + physx_PxShape* otherShape; + physx_PxActor* otherActor; + int32_t status; + uint8_t flags; + char structgen_pad0[3]; +}; +struct physx_PxConstraintInfo { + physx_PxConstraint* constraint; + void* externalReference; + uint32_t type; + char structgen_pad0[4]; +}; +struct physx_PxSimulationEventCallback { + void* vtable_; +}; +struct physx_PxFEMParameters { + float velocityDamping; + float settlingThreshold; + float sleepThreshold; + float sleepDamping; + float selfCollisionFilterDistance; + float selfCollisionStressTolerance; +}; +struct physx_PxPruningStructure { + char structgen_pad0[16]; +}; +struct physx_PxExtendedVec3 { + double x; + double y; + double z; +}; +struct physx_PxControllerManager; +struct physx_PxObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; +}; +struct physx_PxBoxObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; + physx_PxVec3 mHalfExtents; + char structgen_pad1[4]; +}; +struct physx_PxCapsuleObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; + float mHalfHeight; + float mRadius; +}; +struct physx_PxObstacleContext { + void* vtable_; +}; +struct physx_PxController; +struct physx_PxControllerBehaviorCallback; +struct physx_PxControllerState { + physx_PxVec3 deltaXP; + char structgen_pad0[4]; + physx_PxShape* touchedShape; + physx_PxRigidActor* touchedActor; + uint32_t touchedObstacleHandle; + uint32_t collisionFlags; + bool standOnAnotherCCT; + bool standOnObstacle; + bool isMovingUp; + char structgen_pad1[5]; +}; +struct physx_PxControllerStats { + uint16_t nbIterations; + uint16_t nbFullUpdates; + uint16_t nbPartialUpdates; + uint16_t nbTessellation; +}; +struct physx_PxControllerHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; +}; +struct physx_PxControllerShapeHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + physx_PxShape* shape; + physx_PxRigidActor* actor; + uint32_t triangleIndex; + char structgen_pad1[4]; +}; +struct physx_PxControllersHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + physx_PxController* other; +}; +struct physx_PxControllerObstacleHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + void const* userData; +}; +struct physx_PxUserControllerHitReport { + void* vtable_; +}; +struct physx_PxControllerFilterCallback { + void* vtable_; +}; +struct physx_PxControllerFilters { + physx_PxFilterData const* mFilterData; + physx_PxQueryFilterCallback* mFilterCallback; + uint16_t mFilterFlags; + char structgen_pad0[6]; + physx_PxControllerFilterCallback* mCCTFilterCallback; +}; +struct physx_PxControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; +}; +struct physx_PxController { + void* vtable_; +}; +struct physx_PxBoxControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float halfHeight; + float halfSideExtent; + float halfForwardExtent; +}; +struct physx_PxBoxController { + void* vtable_; +}; +struct physx_PxCapsuleControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[4]; + float radius; + float height; + int32_t climbingMode; +}; +struct physx_PxCapsuleController { + void* vtable_; +}; +struct physx_PxControllerBehaviorCallback { + void* vtable_; +}; +struct physx_PxControllerManager { + void* vtable_; +}; +struct physx_PxDim3 { + uint32_t x; + uint32_t y; + uint32_t z; +}; +struct physx_PxSDFDesc { + physx_PxBoundedData sdf; + physx_PxDim3 dims; + physx_PxVec3 meshLower; + float spacing; + uint32_t subgridSize; + int32_t bitsPerSubgridPixel; + physx_PxDim3 sdfSubgrids3DTexBlockDim; + physx_PxBoundedData sdfSubgrids; + physx_PxBoundedData sdfStartSlots; + float subgridsMinSdfValue; + float subgridsMaxSdfValue; + physx_PxBounds3 sdfBounds; + float narrowBandThicknessRelativeToSdfBoundsDiagonal; + uint32_t numThreadsForSdfConstruction; +}; +struct physx_PxConvexMeshDesc { + physx_PxBoundedData points; + physx_PxBoundedData polygons; + physx_PxBoundedData indices; + uint16_t flags; + uint16_t vertexLimit; + uint16_t polygonLimit; + uint16_t quantizedCount; + physx_PxSDFDesc* sdfDesc; +}; +struct physx_PxTriangleMeshDesc { + physx_PxBoundedData points; + physx_PxBoundedData triangles; + uint16_t flags; + char structgen_pad0[22]; + physx_PxSDFDesc* sdfDesc; +}; +struct physx_PxTetrahedronMeshDesc { + char structgen_pad0[16]; + physx_PxBoundedData points; + physx_PxBoundedData tetrahedrons; + uint16_t flags; + uint16_t tetsPerElement; + char structgen_pad1[4]; +}; +struct physx_PxSoftBodySimulationDataDesc { + physx_PxBoundedData vertexToTet; +}; +struct physx_PxBVH34MidphaseDesc { + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + bool quantized; + char structgen_pad0[3]; +}; +struct physx_PxMidphaseDesc { + char structgen_pad0[16]; +}; +struct physx_PxBVHDesc { + physx_PxBoundedData bounds; + float enlargement; + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + char structgen_pad0[4]; +}; +struct physx_PxCookingParams { + float areaTestEpsilon; + float planeTolerance; + int32_t convexMeshCookingType; + bool suppressTriangleMeshRemapTable; + bool buildTriangleAdjacencies; + bool buildGPUData; + char structgen_pad0[1]; + physx_PxTolerancesScale scale; + uint32_t meshPreprocessParams; + float meshWeldTolerance; + physx_PxMidphaseDesc midphaseDesc; + uint32_t gaussMapLimit; + float maxWeightRatioInTet; +}; +struct physx_PxDefaultMemoryOutputStream { + char structgen_pad0[32]; +}; +struct physx_PxDefaultMemoryInputData { + char structgen_pad0[32]; +}; +struct physx_PxDefaultFileOutputStream { + char structgen_pad0[16]; +}; +struct physx_PxDefaultFileInputData { + char structgen_pad0[24]; +}; +struct physx_PxDefaultAllocator { + void* vtable_; +}; +struct physx_PxJoint; +struct physx_PxRackAndPinionJoint; +struct physx_PxGearJoint; +struct physx_PxD6Joint; +struct physx_PxDistanceJoint; +struct physx_PxContactJoint; +struct physx_PxFixedJoint; +struct physx_PxPrismaticJoint; +struct physx_PxRevoluteJoint; +struct physx_PxSphericalJoint; +struct physx_PxJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpring { + float stiffness; + float damping; +}; +struct physx_PxDistanceJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJacobianRow { + physx_PxVec3 linear0; + physx_PxVec3 linear1; + physx_PxVec3 angular0; + physx_PxVec3 angular1; +}; +struct physx_PxContactJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFixedJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJointLimitParameters { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; +}; +struct physx_PxJointLinearLimit { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float value; +}; +struct physx_PxJointLinearLimitPair { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointAngularLimitPair { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointLimitCone { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngle; + float zAngle; +}; +struct physx_PxJointLimitPyramid { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngleMin; + float yAngleMax; + float zAngleMin; + float zAngleMax; +}; +struct physx_PxPrismaticJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRevoluteJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSphericalJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxD6JointDrive { + float stiffness; + float damping; + float forceLimit; + uint32_t flags; +}; +struct physx_PxD6Joint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGearJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRackAndPinionJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGroupsMask { + uint16_t bits0; + uint16_t bits1; + uint16_t bits2; + uint16_t bits3; +}; +struct physx_PxDefaultErrorCallback { + void* vtable_; +}; +struct physx_PxRigidActorExt { + char structgen_pad0[1]; +}; +struct physx_PxMassProperties { + physx_PxMat33 inertiaTensor; + physx_PxVec3 centerOfMass; + float mass; +}; +struct physx_PxRigidBodyExt { + char structgen_pad0[1]; +}; +struct physx_PxShapeExt { + char structgen_pad0[1]; +}; +struct physx_PxMeshOverlapUtil { + char structgen_pad0[1040]; +}; +struct physx_PxBinaryConverter; +struct physx_PxXmlMiscParameter { + physx_PxVec3 upVector; + physx_PxTolerancesScale scale; +}; +struct physx_PxSerialization { + char structgen_pad0[1]; +}; +struct physx_PxDefaultCpuDispatcher { + void* vtable_; +}; +struct physx_PxStringTableExt { + char structgen_pad0[1]; +}; +struct physx_PxBroadPhaseExt { + char structgen_pad0[1]; +}; +struct physx_PxSceneQueryExt { + char structgen_pad0[1]; +}; +struct physx_PxBatchQueryExt { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystem { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystemAdapter { + void* vtable_; +}; +struct physx_PxSamplingExt { + char structgen_pad0[1]; +}; +struct physx_PxPoissonSampler { + char structgen_pad0[8]; +}; +struct physx_PxTriangleMeshPoissonSampler { + char structgen_pad0[8]; +}; +struct physx_PxTetrahedronMeshExt { + char structgen_pad0[1]; +}; +struct physx_PxRepXObject { + char const* typeName; + void const* serializable; + uint64_t id; +}; +struct physx_PxCooking; +struct physx_PxRepXInstantiationArgs { + char structgen_pad0[8]; + physx_PxCooking* cooker; + physx_PxStringTable* stringTable; +}; +struct physx_XmlMemoryAllocator; +struct physx_XmlWriter; +struct physx_XmlReader; +struct physx_MemoryBuffer; +struct physx_PxRepXSerializer { + void* vtable_; +}; +struct physx_PxVehicleWheels4SimData; +struct physx_PxVehicleWheels4DynData; +struct physx_PxVehicleTireForceCalculator; +struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs; +struct physx_PxVehicleTelemetryData; +struct physx_PxPvdTransport; +struct physx_PxPvd { + void* vtable_; +}; +struct physx_PxPvdTransport { + void* vtable_; +}; diff --git a/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen.rs b/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen.rs new file mode 100644 index 0000000..750e842 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen.rs @@ -0,0 +1,2822 @@ +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRawAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVirtualAllocator { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxUserAllocated { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTempAllocator { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBitAndByte { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBitMap { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec3 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec3Padded { + pub x: f32, + pub y: f32, + pub z: f32, + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQuat { + pub x: f32, + pub y: f32, + pub z: f32, + pub w: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTransform { + pub q: PxQuat, + pub p: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTransformPadded { + pub transform: PxTransform, + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMat33 { + pub column0: PxVec3, + pub column1: PxVec3, + pub column2: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBounds3 { + pub minimum: PxVec3, + pub maximum: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadcastingAllocator { + pub structgen_pad0: [u8; 176], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadcastingErrorCallback { + pub structgen_pad0: [u8; 160], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec4 { + pub x: f32, + pub y: f32, + pub z: f32, + pub w: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMat44 { + pub column0: PxVec4, + pub column1: PxVec4, + pub column2: PxVec4, + pub column3: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPlane { + pub n: PxVec3, + pub d: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct Interpolation { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMutexImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxReadWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxProfileScoped { + pub mCallback: *mut PxProfilerCallback, + pub mEventName: *const std::ffi::c_char, + pub mProfilerData: *mut std::ffi::c_void, + pub mContextId: u64, + pub mDetached: bool, + pub structgen_pad0: [u8; 7], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSListEntry { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSListImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSyncImpl { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCounterFrequencyToTensOfNanos { + pub mNumerator: u64, + pub mDenominator: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTime { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVec2 { + pub x: f32, + pub y: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxStridedData { + pub stride: u32, + pub structgen_pad0: [u8; 4], + pub data: *const std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugPoint { + pub pos: PxVec3, + pub color: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugLine { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugTriangle { + pub pos0: PxVec3, + pub color0: u32, + pub pos1: PxVec3, + pub color1: u32, + pub pos2: PxVec3, + pub color2: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDebugText { + pub position: PxVec3, + pub size: f32, + pub color: u32, + pub structgen_pad0: [u8; 4], + pub string: *const std::ffi::c_char, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDeserializationContext { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBase { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRefCounted { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTolerancesScale { + pub length: f32, + pub speed: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMetaDataEntry { + pub type_: *const std::ffi::c_char, + pub name: *const std::ffi::c_char, + pub offset: u32, + pub size: u32, + pub count: u32, + pub offsetSize: u32, + pub flags: u32, + pub alignment: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBaseTask { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTask { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxLightCpuTask { + pub structgen_pad0: [u8; 40], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub halfExtents: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub radius: f32, + pub halfHeight: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHullPolygon { + pub mPlane: [f32; 4], + pub mNbVerts: u16, + pub mIndexBase: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConvexMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshScale { + pub scale: PxVec3, + pub rotation: PxQuat, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSphereGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub radius: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPlaneGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleSystemGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub mSolverType: PxParticleSolverType, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHairSystemGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub tetrahedronMesh: *mut PxTetrahedronMesh, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryHit { + pub faceIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeomOverlapHit { + pub faceIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeomIndexPair { + pub id0: u32, + pub id1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryThreadContext { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomGeometryType { + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomGeometry { + pub structgen_pad0: [u8; 4], + pub mTypePadding: f32, + pub callbacks: *mut PxCustomGeometryCallbacks, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometryHolder { + pub structgen_pad0: [u8; 56], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGeometryQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightFieldSample { + pub height: i16, + pub materialIndex0: PxBitAndByte, + pub materialIndex1: PxBitAndByte, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightField { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxHeightFieldDesc { + pub nbRows: u32, + pub nbColumns: u32, + pub format: PxHeightFieldFormat, + pub structgen_pad0: [u8; 4], + pub samples: PxStridedData, + pub convexEdgeThreshold: f32, + pub flags: PxHeightFieldFlags, + pub structgen_pad1: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshQuery { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimpleTriangleMesh { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangle { + pub verts: [PxVec3; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTrianglePadded { + pub verts: [PxVec3; 3], + pub padding: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH34TriangleMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedron { + pub verts: [PxVec3; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyAuxData { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyMesh { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCollisionMeshMappingData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodyCollisionData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodySimulationData { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCollisionTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationTetrahedronMeshData { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAggregate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpringModifiers { + pub stiffness: f32, + pub damping: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRestitutionModifiers { + pub restitution: f32, + pub velocityThreshold: f32, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct Px1DConstraint { + pub linear0: PxVec3, + pub geometricError: f32, + pub angular0: PxVec3, + pub velocityTarget: f32, + pub linear1: PxVec3, + pub minImpulse: f32, + pub angular1: PxVec3, + pub maxImpulse: f32, + pub mods: Px1DConstraintMods, + pub forInternalUse: f32, + pub flags: u16, + pub solveHint: u16, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintInvMassScale { + pub linear0: f32, + pub angular0: f32, + pub linear1: f32, + pub angular1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPoint { + pub normal: PxVec3, + pub separation: f32, + pub point: PxVec3, + pub maxImpulse: f32, + pub targetVel: PxVec3, + pub staticFriction: f32, + pub materialFlags: u8, + pub structgen_pad0: [u8; 3], + pub internalFaceIndex1: u32, + pub dynamicFriction: f32, + pub restitution: f32, + pub damping: f32, + pub structgen_pad1: [u8; 12], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverBody { + pub linearVelocity: PxVec3, + pub maxSolverNormalProgress: u16, + pub maxSolverFrictionProgress: u16, + pub angularState: PxVec3, + pub solverProgress: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverBodyData { + pub linearVelocity: PxVec3, + pub invMass: f32, + pub angularVelocity: PxVec3, + pub reportThreshold: f32, + pub sqrtInvInertia: PxMat33, + pub penBiasClamp: f32, + pub nodeIndex: u32, + pub maxContactImpulse: f32, + pub body2World: PxTransform, + pub pad: u16, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintBatchHeader { + pub startIndex: u32, + pub stride: u16, + pub constraintType: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintDesc { + pub structgen_pad0: [u8; 16], + pub bodyADataIndex: u32, + pub bodyBDataIndex: u32, + pub linkIndexA: u32, + pub linkIndexB: u32, + pub constraint: *mut u8, + pub writeBack: *mut std::ffi::c_void, + pub progressA: u16, + pub progressB: u16, + pub constraintLengthOver16: u16, + pub padding: [u8; 10], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad1: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub structgen_pad2: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxSolverBody, + pub body1: *const PxSolverBody, + pub data0: *const PxSolverBodyData, + pub data1: *const PxSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad1: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad2: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub offsetSlop: f32, + pub structgen_pad3: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationLimit { + pub low: f32, + pub high: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationDrive { + pub stiffness: f32, + pub damping: f32, + pub maxForce: f32, + pub driveType: PxArticulationDriveType, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyVel { + pub linearVelocity: PxVec3, + pub nbStaticInteractions: u16, + pub maxDynamicPartition: u16, + pub angularVelocity: PxVec3, + pub partitionMask: u32, + pub deltaAngDt: PxVec3, + pub maxAngVel: f32, + pub deltaLinDt: PxVec3, + pub lockFlags: u16, + pub isKinematic: bool, + pub pad: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyTxInertia { + pub deltaBody2World: PxTransform, + pub sqrtInvInertia: PxMat33, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverBodyData { + pub originalLinearVelocity: PxVec3, + pub maxContactImpulse: f32, + pub originalAngularVelocity: PxVec3, + pub penBiasClamp: f32, + pub invMass: f32, + pub nodeIndex: u32, + pub reportThreshold: f32, + pub pad: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDescBase { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverConstraintPrepDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub rows: *mut Px1DConstraint, + pub numRows: u32, + pub linBreakForce: f32, + pub angBreakForce: f32, + pub minResponseThreshold: f32, + pub writeback: *mut std::ffi::c_void, + pub disablePreprocessing: bool, + pub improvedSlerp: bool, + pub driveLimitsAreForces: bool, + pub extendedLimits: bool, + pub disableConstraint: bool, + pub structgen_pad1: [u8; 3], + pub body0WorldOffset: PxVec3Padded, + pub cA2w: PxVec3Padded, + pub cB2w: PxVec3Padded, + pub structgen_pad2: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTGSSolverContactDesc { + pub invMassScales: PxConstraintInvMassScale, + pub desc: *mut PxSolverConstraintDesc, + pub body0: *const PxTGSSolverBodyVel, + pub body1: *const PxTGSSolverBodyVel, + pub body0TxI: *const PxTGSSolverBodyTxInertia, + pub body1TxI: *const PxTGSSolverBodyTxInertia, + pub bodyData0: *const PxTGSSolverBodyData, + pub bodyData1: *const PxTGSSolverBodyData, + pub bodyFrame0: PxTransform, + pub bodyFrame1: PxTransform, + pub bodyState0: BodyState, + pub bodyState1: BodyState, + pub structgen_pad0: [u8; 8], + pub shapeInteraction: *mut std::ffi::c_void, + pub contacts: *mut PxContactPoint, + pub numContacts: u32, + pub hasMaxImpulse: bool, + pub disableStrongFriction: bool, + pub hasForceThresholds: bool, + pub structgen_pad1: [u8; 1], + pub restDistance: f32, + pub maxCCDSeparation: f32, + pub frictionPtr: *mut u8, + pub frictionCount: u8, + pub structgen_pad2: [u8; 7], + pub contactForces: *mut f32, + pub startFrictionPatchIndex: u32, + pub numFrictionPatches: u32, + pub startContactPatchIndex: u32, + pub numContactPatches: u16, + pub axisConstraintCount: u16, + pub maxImpulse: f32, + pub torsionalPatchRadius: f32, + pub minTorsionalPatchRadius: f32, + pub offsetSlop: f32, + pub structgen_pad3: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendonLimit { + pub lowLimit: f32, + pub highLimit: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationAttachment { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendonJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationSpatialTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationFixedTendon { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpatialForce { + pub force: PxVec3, + pub pad0: f32, + pub torque: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpatialVelocity { + pub linear: PxVec3, + pub pad0: f32, + pub angular: PxVec3, + pub pad1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationRootLinkData { + pub transform: PxTransform, + pub worldLinVel: PxVec3, + pub worldAngVel: PxVec3, + pub worldLinAccel: PxVec3, + pub worldAngAccel: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationCache { + pub externalForces: *mut PxSpatialForce, + pub denseJacobian: *mut f32, + pub massMatrix: *mut f32, + pub jointVelocity: *mut f32, + pub jointAcceleration: *mut f32, + pub jointPosition: *mut f32, + pub jointForce: *mut f32, + pub jointSolverForces: *mut f32, + pub linkVelocity: *mut PxSpatialVelocity, + pub linkAcceleration: *mut PxSpatialVelocity, + pub rootLinkData: *mut PxArticulationRootLinkData, + pub sensorForces: *mut PxSpatialForce, + pub coefficientMatrix: *mut f32, + pub lambda: *mut f32, + pub scratchMemory: *mut std::ffi::c_void, + pub scratchAllocator: *mut std::ffi::c_void, + pub version: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationSensor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationJointReducedCoordinate { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxShape { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidActor { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxNodeIndex { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidBody { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxArticulationLink { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConeLimitedConstraint { + pub mAxis: PxVec3, + pub mAngle: f32, + pub mLowLimit: f32, + pub mHighLimit: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConeLimitParams { + pub lowHighLimits: PxVec4, + pub axisAngle: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintShaderTable { + pub solverPrep: *mut std::ffi::c_void, + pub structgen_pad0: [u8; 8], + pub visualize: *mut std::ffi::c_void, + pub flag: PxConstraintFlag, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMassModificationProps { + pub mInvMassScale0: f32, + pub mInvInertiaScale0: f32, + pub mInvMassScale1: f32, + pub mInvInertiaScale1: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPatch { + pub mMassModification: PxMassModificationProps, + pub normal: PxVec3, + pub restitution: f32, + pub dynamicFriction: f32, + pub staticFriction: f32, + pub damping: f32, + pub startContactIndex: u16, + pub nbContacts: u8, + pub materialFlags: u8, + pub internalFlags: u16, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub pad: [u16; 5], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContact { + pub contact: PxVec3, + pub separation: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxExtendedContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxModifiableContact { + pub contact: PxVec3, + pub separation: f32, + pub targetVelocity: PxVec3, + pub maxImpulse: f32, + pub normal: PxVec3, + pub restitution: f32, + pub materialFlags: u32, + pub materialIndex0: u16, + pub materialIndex1: u16, + pub staticFriction: f32, + pub dynamicFriction: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactStreamIterator { + pub zero: PxVec3, + pub structgen_pad0: [u8; 4], + pub patch: *const PxContactPatch, + pub contact: *const PxContact, + pub faceIndice: *const u32, + pub totalPatches: u32, + pub totalContacts: u32, + pub nextContactIndex: u32, + pub nextPatchIndex: u32, + pub contactPatchHeaderSize: u32, + pub contactPointSize: u32, + pub mStreamFormat: StreamFormat, + pub forceNoResponse: u32, + pub pointStepped: bool, + pub structgen_pad1: [u8; 3], + pub hasFaceIndices: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuContactPair { + pub contactPatches: *mut u8, + pub contactPoints: *mut u8, + pub contactForces: *mut f32, + pub transformCacheRef0: u32, + pub transformCacheRef1: u32, + pub nodeIndex0: PxNodeIndex, + pub nodeIndex1: PxNodeIndex, + pub actor0: *mut PxActor, + pub actor1: *mut PxActor, + pub nbContacts: u16, + pub nbPatches: u16, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactSet { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactModifyPair { + pub actor: [*const PxRigidActor; 2], + pub shape: [*const PxShape; 2], + pub transform: [PxTransform; 2], + pub contacts: PxContactSet, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBaseMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFEMMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFilterData { + pub word0: u32, + pub word1: u32, + pub word2: u32, + pub word3: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleRigidFilterPair { + pub mID0: u64, + pub mID1: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuParticleBufferIndexPair { + pub systemIndex: u32, + pub bufferIndex: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleVolume { + pub bound: PxBounds3, + pub particleIndicesOffset: u32, + pub numParticles: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDiffuseParticleParams { + pub threshold: f32, + pub lifetime: f32, + pub airDrag: f32, + pub bubbleDrag: f32, + pub buoyancy: f32, + pub kineticEnergyWeight: f32, + pub pressureWeight: f32, + pub divergenceWeight: f32, + pub collisionDecay: f32, + pub useAccurateVelocity: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleSpring { + pub ind0: u32, + pub ind1: u32, + pub length: f32, + pub stiffness: f32, + pub damping: f32, + pub pad: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxParticleMaterial { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxActorShape { + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastHit { + 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, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapHit { + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepHit { + pub faceIndex: u32, + pub flags: PxHitFlags, + pub structgen_pad0: [u8; 2], + pub position: PxVec3, + pub normal: PxVec3, + pub distance: f32, + pub structgen_pad1: [u8; 4], + pub actor: *mut PxRigidActor, + pub shape: *mut PxShape, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastCallback { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapCallback { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepCallback { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRaycastBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxRaycastHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxRaycastHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOverlapBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxOverlapHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxOverlapHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSweepBuffer { + pub structgen_pad0: [u8; 8], + pub block: PxSweepHit, + pub hasBlock: bool, + pub structgen_pad1: [u8; 7], + pub touches: *mut PxSweepHit, + pub maxNbTouches: u32, + pub nbTouches: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryCache { + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub faceIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryFilterData { + pub data: PxFilterData, + pub flags: PxQueryFlags, + pub structgen_pad0: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidDynamic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidStatic { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQueryDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseRegion { + pub mBounds: PxBounds3, + pub mUserData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseRegionInfo { + pub mRegion: PxBroadPhaseRegion, + pub mNbStaticObjects: u32, + pub mNbDynamicObjects: u32, + pub mActive: bool, + pub mOverlap: bool, + pub structgen_pad0: [u8; 6], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseCaps { + pub mMaxNbRegions: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseDesc { + pub mType: PxBroadPhaseType, + pub structgen_pad0: [u8; 4], + pub mContextID: u64, + pub structgen_pad1: [u8; 8], + pub mFoundLostPairsCapacity: u32, + pub mDiscardStaticVsKinematic: bool, + pub mDiscardKinematicVsKinematic: bool, + pub structgen_pad2: [u8; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseUpdateData { + pub mCreated: *const u32, + pub mNbCreated: u32, + pub structgen_pad0: [u8; 4], + pub mUpdated: *const u32, + pub mNbUpdated: u32, + pub structgen_pad1: [u8; 4], + pub mRemoved: *const u32, + pub mNbRemoved: u32, + pub structgen_pad2: [u8; 4], + pub mBounds: *const PxBounds3, + pub mGroups: *const u32, + pub mDistances: *const f32, + pub mCapacity: u32, + pub structgen_pad3: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhasePair { + pub mID0: u32, + pub mID1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseResults { + pub mNbCreatedPairs: u32, + pub structgen_pad0: [u8; 4], + pub mCreatedPairs: *const PxBroadPhasePair, + pub mNbDeletedPairs: u32, + pub structgen_pad1: [u8; 4], + pub mDeletedPairs: *const PxBroadPhasePair, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneLimits { + pub maxNbActors: u32, + pub maxNbBodies: u32, + pub maxNbStaticShapes: u32, + pub maxNbDynamicShapes: u32, + pub maxNbAggregates: u32, + pub maxNbConstraints: u32, + pub maxNbRegions: u32, + pub maxNbBroadPhaseOverlaps: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxgDynamicsMemoryConfig { + pub tempBufferCapacity: u32, + pub maxRigidContactCount: u32, + pub maxRigidPatchCount: u32, + pub heapCapacity: u32, + pub foundLostPairsCapacity: u32, + pub foundLostAggregatePairsCapacity: u32, + pub totalAggregatePairsCapacity: u32, + pub maxSoftBodyContacts: u32, + pub maxFemClothContacts: u32, + pub maxParticleContacts: u32, + pub collisionStackSize: u32, + pub maxHairContacts: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneDesc { + pub staticStructure: PxPruningStructureType, + pub dynamicStructure: PxPruningStructureType, + pub dynamicTreeRebuildRateHint: u32, + pub dynamicTreeSecondaryPruner: PxDynamicTreeSecondaryPruner, + pub staticBVHBuildStrategy: PxBVHBuildStrategy, + pub dynamicBVHBuildStrategy: PxBVHBuildStrategy, + pub staticNbObjectsPerNode: u32, + pub dynamicNbObjectsPerNode: u32, + pub sceneQueryUpdateMode: PxSceneQueryUpdateMode, + pub gravity: PxVec3, + pub simulationEventCallback: *mut PxSimulationEventCallback, + pub contactModifyCallback: *mut PxContactModifyCallback, + pub ccdContactModifyCallback: *mut PxCCDContactModifyCallback, + pub filterShaderData: *const std::ffi::c_void, + pub filterShaderDataSize: u32, + pub structgen_pad0: [u8; 4], + pub filterShader: *mut std::ffi::c_void, + pub filterCallback: *mut PxSimulationFilterCallback, + pub kineKineFilteringMode: PxPairFilteringMode, + pub staticKineFilteringMode: PxPairFilteringMode, + pub broadPhaseType: PxBroadPhaseType, + pub structgen_pad1: [u8; 4], + pub broadPhaseCallback: *mut PxBroadPhaseCallback, + pub limits: PxSceneLimits, + pub frictionType: PxFrictionType, + pub solverType: PxSolverType, + pub bounceThresholdVelocity: f32, + pub frictionOffsetThreshold: f32, + pub frictionCorrelationDistance: f32, + pub flags: PxSceneFlags, + pub cpuDispatcher: *mut PxCpuDispatcher, + pub structgen_pad2: [u8; 8], + pub userData: *mut std::ffi::c_void, + pub solverBatchSize: u32, + pub solverArticulationBatchSize: u32, + pub nbContactDataBlocks: u32, + pub maxNbContactDataBlocks: u32, + pub maxBiasCoefficient: f32, + pub contactReportStreamBufferSize: u32, + pub ccdMaxPasses: u32, + pub ccdThreshold: f32, + pub ccdMaxSeparation: f32, + pub wakeCounterResetValue: f32, + pub sanityBounds: PxBounds3, + pub gpuDynamicsConfig: PxgDynamicsMemoryConfig, + pub gpuMaxNumPartitions: u32, + pub gpuMaxNumStaticPartitions: u32, + pub gpuComputeVersion: u32, + pub contactPairSlabSize: u32, + pub sceneQuerySystem: *mut PxSceneQuerySystem, + pub structgen_pad3: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationStatistics { + pub nbActiveConstraints: u32, + pub nbActiveDynamicBodies: u32, + pub nbActiveKinematicBodies: u32, + pub nbStaticBodies: u32, + pub nbDynamicBodies: u32, + pub nbKinematicBodies: u32, + pub nbShapes: [u32; 11], + pub nbAggregates: u32, + pub nbArticulations: u32, + pub nbAxisSolverConstraints: u32, + pub compressedContactSize: u32, + pub requiredContactConstraintMemory: u32, + pub peakConstraintMemory: u32, + pub nbDiscreteContactPairsTotal: u32, + pub nbDiscreteContactPairsWithCacheHits: u32, + pub nbDiscreteContactPairsWithContacts: u32, + pub nbNewPairs: u32, + pub nbLostPairs: u32, + pub nbNewTouches: u32, + pub nbLostTouches: u32, + pub nbPartitions: u32, + pub structgen_pad0: [u8; 4], + pub gpuMemParticles: u64, + pub gpuMemSoftBodies: u64, + pub gpuMemFEMCloths: u64, + pub gpuMemHairSystems: u64, + pub gpuMemHeap: u64, + pub gpuMemHeapBroadPhase: u64, + pub gpuMemHeapNarrowPhase: u64, + pub gpuMemHeapSolver: u64, + pub gpuMemHeapArticulation: u64, + pub gpuMemHeapSimulation: u64, + pub gpuMemHeapSimulationArticulation: u64, + pub gpuMemHeapSimulationParticles: u64, + pub gpuMemHeapSimulationSoftBody: u64, + pub gpuMemHeapSimulationFEMCloth: u64, + pub gpuMemHeapSimulationHairSystem: u64, + pub gpuMemHeapParticles: u64, + pub gpuMemHeapSoftBodies: u64, + pub gpuMemHeapFEMCloths: u64, + pub gpuMemHeapHairSystems: u64, + pub gpuMemHeapOther: u64, + pub nbBroadPhaseAdds: u32, + pub nbBroadPhaseRemoves: u32, + pub nbDiscreteContactPairs: [[u32; 11]; 11], + pub nbCCDPairs: [[u32; 11]; 11], + pub nbModifiedContactPairs: [[u32; 11]; 11], + pub nbTriggerPairs: [[u32; 11]; 11], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuBodyData { + pub quat: PxQuat, + pub pos: PxVec4, + pub linVel: PxVec4, + pub angVel: PxVec4, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGpuActorPair { + pub srcIndex: u32, + pub structgen_pad0: [u8; 4], + pub nodeIndex: PxNodeIndex, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxIndexDataPair { + pub index: u32, + pub structgen_pad0: [u8; 4], + pub data: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDominanceGroupPair { + pub dominance0: u8, + pub dominance1: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxScene { + pub structgen_pad0: [u8; 8], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneReadLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneWriteLock { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairExtraDataItem { + pub type_: u8, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairVelocity { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub linearVelocity: [PxVec3; 2], + pub angularVelocity: [PxVec3; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairPose { + pub type_: u8, + pub structgen_pad0: [u8; 3], + pub globalPose: [PxTransform; 2], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairIndex { + pub type_: u8, + pub structgen_pad0: [u8; 1], + pub index: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairExtraDataIterator { + pub currPtr: *const u8, + pub endPtr: *const u8, + pub preSolverVelocity: *const PxContactPairVelocity, + pub postSolverVelocity: *const PxContactPairVelocity, + pub eventPose: *const PxContactPairPose, + pub contactPairIndex: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairHeader { + pub actors: [*mut PxActor; 2], + pub extraDataStream: *const u8, + pub extraDataStreamSize: u16, + pub flags: PxContactPairHeaderFlags, + pub structgen_pad0: [u8; 4], + pub pairs: *const PxContactPair, + pub nbPairs: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPairPoint { + pub position: PxVec3, + pub separation: f32, + pub normal: PxVec3, + pub internalFaceIndex0: u32, + pub impulse: PxVec3, + pub internalFaceIndex1: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactPair { + pub shapes: [*mut PxShape; 2], + pub contactPatches: *const u8, + pub contactPoints: *const u8, + pub contactImpulses: *const f32, + pub requiredBufferSize: u32, + pub contactCount: u8, + pub patchCount: u8, + pub contactStreamSize: u16, + pub flags: PxContactPairFlags, + pub events: PxPairFlags, + pub internalData: [u32; 2], + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriggerPair { + pub triggerShape: *mut PxShape, + pub triggerActor: *mut PxActor, + pub otherShape: *mut PxShape, + pub otherActor: *mut PxActor, + pub status: PxPairFlag, + pub flags: PxTriggerPairFlags, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConstraintInfo { + pub constraint: *mut PxConstraint, + pub externalReference: *mut std::ffi::c_void, + pub type_: u32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFEMParameters { + pub velocityDamping: f32, + pub settlingThreshold: f32, + pub sleepThreshold: f32, + pub sleepDamping: f32, + pub selfCollisionFilterDistance: f32, + pub selfCollisionStressTolerance: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPruningStructure { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxExtendedVec3 { + pub x: f64, + pub y: f64, + pub z: f64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfExtents: PxVec3, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleObstacle { + pub structgen_pad0: [u8; 8], + pub mUserData: *mut std::ffi::c_void, + pub mPos: PxExtendedVec3, + pub mRot: PxQuat, + pub mHalfHeight: f32, + pub mRadius: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerState { + pub deltaXP: PxVec3, + pub structgen_pad0: [u8; 4], + pub touchedShape: *mut PxShape, + pub touchedActor: *mut PxRigidActor, + pub touchedObstacleHandle: u32, + pub collisionFlags: u32, + pub standOnAnotherCCT: bool, + pub standOnObstacle: bool, + pub isMovingUp: bool, + pub structgen_pad1: [u8; 5], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerStats { + pub nbIterations: u16, + pub nbFullUpdates: u16, + pub nbPartialUpdates: u16, + pub nbTessellation: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerShapeHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub shape: *mut PxShape, + pub actor: *mut PxRigidActor, + pub triangleIndex: u32, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllersHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub other: *mut PxController, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerObstacleHit { + pub controller: *mut PxController, + pub worldPos: PxExtendedVec3, + pub worldNormal: PxVec3, + pub dir: PxVec3, + pub length: f32, + pub structgen_pad0: [u8; 4], + pub userData: *const std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerFilters { + pub mFilterData: *const PxFilterData, + pub mFilterCallback: *mut PxQueryFilterCallback, + pub mFilterFlags: PxQueryFlags, + pub structgen_pad0: [u8; 6], + pub mCCTFilterCallback: *mut PxControllerFilterCallback, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 8], + pub halfHeight: f32, + pub halfSideExtent: f32, + pub halfForwardExtent: f32, + pub structgen_pad5: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleControllerDesc { + pub structgen_pad0: [u8; 8], + pub position: PxExtendedVec3, + pub upDirection: PxVec3, + pub slopeLimit: f32, + pub invisibleWallHeight: f32, + pub maxJumpHeight: f32, + pub contactOffset: f32, + pub stepOffset: f32, + pub density: f32, + pub scaleCoeff: f32, + pub volumeGrowth: f32, + pub structgen_pad1: [u8; 4], + pub reportCallback: *mut PxUserControllerHitReport, + pub behaviorCallback: *mut PxControllerBehaviorCallback, + pub nonWalkableMode: PxControllerNonWalkableMode, + pub structgen_pad2: [u8; 4], + pub material: *mut PxMaterial, + pub registerDeletionListener: bool, + pub clientID: u8, + pub structgen_pad3: [u8; 6], + pub userData: *mut std::ffi::c_void, + pub structgen_pad4: [u8; 8], + pub radius: f32, + pub height: f32, + pub climbingMode: PxCapsuleClimbingMode, + pub structgen_pad5: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDim3 { + pub x: u32, + pub y: u32, + pub z: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSDFDesc { + pub sdf: PxBoundedData, + pub dims: PxDim3, + pub meshLower: PxVec3, + pub spacing: f32, + pub subgridSize: u32, + pub bitsPerSubgridPixel: PxSdfBitsPerSubgridPixel, + pub sdfSubgrids3DTexBlockDim: PxDim3, + pub sdfSubgrids: PxBoundedData, + pub sdfStartSlots: PxBoundedData, + pub subgridsMinSdfValue: f32, + pub subgridsMaxSdfValue: f32, + pub sdfBounds: PxBounds3, + pub narrowBandThicknessRelativeToSdfBoundsDiagonal: f32, + pub numThreadsForSdfConstruction: u32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxConvexMeshDesc { + pub points: PxBoundedData, + pub polygons: PxBoundedData, + pub indices: PxBoundedData, + pub flags: PxConvexFlags, + pub vertexLimit: u16, + pub polygonLimit: u16, + pub quantizedCount: u16, + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMeshDesc { + pub points: PxBoundedData, + pub triangles: PxBoundedData, + pub flags: PxMeshFlags, + pub structgen_pad0: [u8; 22], + pub sdfDesc: *mut PxSDFDesc, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshDesc { + pub structgen_pad0: [u8; 16], + pub points: PxBoundedData, + pub tetrahedrons: PxBoundedData, + pub flags: PxMeshFlags, + pub tetsPerElement: u16, + pub structgen_pad1: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSoftBodySimulationDataDesc { + pub vertexToTet: PxBoundedData, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVH34MidphaseDesc { + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVH34BuildStrategy, + pub quantized: bool, + pub structgen_pad0: [u8; 3], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMidphaseDesc { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVHDesc { + pub bounds: PxBoundedData, + pub enlargement: f32, + pub numPrimsPerLeaf: u32, + pub buildStrategy: PxBVHBuildStrategy, + pub structgen_pad0: [u8; 4], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCookingParams { + pub areaTestEpsilon: f32, + pub planeTolerance: f32, + pub convexMeshCookingType: PxConvexMeshCookingType, + pub suppressTriangleMeshRemapTable: bool, + pub buildTriangleAdjacencies: bool, + pub buildGPUData: bool, + pub structgen_pad0: [u8; 1], + pub scale: PxTolerancesScale, + pub meshPreprocessParams: PxMeshPreprocessingFlags, + pub meshWeldTolerance: f32, + pub midphaseDesc: PxMidphaseDesc, + pub gaussMapLimit: u32, + pub maxWeightRatioInTet: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultMemoryOutputStream { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultMemoryInputData { + pub structgen_pad0: [u8; 32], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultFileOutputStream { + pub structgen_pad0: [u8; 16], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultFileInputData { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSpring { + pub stiffness: f32, + pub damping: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDistanceJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJacobianRow { + pub linear0: PxVec3, + pub linear1: PxVec3, + pub angular0: PxVec3, + pub angular1: PxVec3, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFixedJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitParameters { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLinearLimit { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub value: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLinearLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointAngularLimitPair { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub upper: f32, + pub lower: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitCone { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngle: f32, + pub zAngle: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxJointLimitPyramid { + pub restitution: f32, + pub bounceThreshold: f32, + pub stiffness: f32, + pub damping: f32, + pub contactDistance_deprecated: f32, + pub yAngleMin: f32, + pub yAngleMax: f32, + pub zAngleMin: f32, + pub zAngleMax: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPrismaticJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRevoluteJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSphericalJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxD6JointDrive { + pub stiffness: f32, + pub damping: f32, + pub forceLimit: f32, + pub flags: PxD6JointDriveFlags, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxD6Joint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGearJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRackAndPinionJoint { + pub structgen_pad0: [u8; 16], + pub userData: *mut std::ffi::c_void, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxGroupsMask { + pub bits0: u16, + pub bits1: u16, + pub bits2: u16, + pub bits3: u16, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidActorExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMassProperties { + pub inertiaTensor: PxMat33, + pub centerOfMass: PxVec3, + pub mass: f32, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRigidBodyExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxShapeExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxMeshOverlapUtil { + pub structgen_pad0: [u8; 1040], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxXmlMiscParameter { + pub upVector: PxVec3, + pub scale: PxTolerancesScale, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSerialization { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxStringTableExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQueryExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSamplingExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPoissonSampler { + pub structgen_pad0: [u8; 8], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTriangleMeshPoissonSampler { + pub structgen_pad0: [u8; 24], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTetrahedronMeshExt { + pub structgen_pad0: [u8; 1], +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRepXObject { + pub typeName: *const std::ffi::c_char, + pub serializable: *const std::ffi::c_void, + pub id: u64, +} +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRepXInstantiationArgs { + pub structgen_pad0: [u8; 8], + pub cooker: *mut PxCooking, + pub stringTable: *mut PxStringTable, +} +#[cfg(test)] +mod sizes { + use super::*; + use std::mem::size_of; + #[test] + fn check_sizes() { + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 176); + assert_eq!(size_of::(), 160); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 44); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 112); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 128); + assert_eq!(size_of::(), 192); + assert_eq!(size_of::(), 208); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 144); + assert_eq!(size_of::(), 240); + assert_eq!(size_of::(), 240); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 76); + assert_eq!(size_of::(), 136); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 104); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 96); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 352); + assert_eq!(size_of::(), 2232); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 52); + assert_eq!(size_of::(), 60); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 64); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 136); + assert_eq!(size_of::(), 152); + assert_eq!(size_of::(), 152); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 160); + assert_eq!(size_of::(), 88); + assert_eq!(size_of::(), 80); + assert_eq!(size_of::(), 72); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 12); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 40); + assert_eq!(size_of::(), 56); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 48); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 28); + assert_eq!(size_of::(), 36); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 16); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 52); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1040); + assert_eq!(size_of::(), 20); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 24); + assert_eq!(size_of::(), 24); + } +} diff --git a/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen_out.hpp b/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen_out.hpp new file mode 100644 index 0000000..ae012ba --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/generated/x86_64-pc-windows-msvc/structgen_out.hpp @@ -0,0 +1,2082 @@ +struct physx_PxAllocatorCallback; +struct physx_PxErrorCallback; +struct physx_PxAssertHandler; +struct physx_PxInputStream; +struct physx_PxInputData; +struct physx_PxOutputStream; +struct physx_PxVec2; +struct physx_PxVec3; +struct physx_PxVec4; +struct physx_PxQuat; +struct physx_PxMat33; +struct physx_PxMat34; +struct physx_PxMat44; +struct physx_PxTransform; +struct physx_PxPlane; +struct physx_PxBounds3; +struct physx_PxAllocatorCallback { + void* vtable_; +}; +struct physx_PxAssertHandler { + void* vtable_; +}; +struct physx_PxAllocationListener; +struct physx_PxFoundation { + void* vtable_; +}; +struct physx_PxProfilerCallback; +struct physx_PxAllocator { + char structgen_pad0[1]; +}; +struct physx_PxRawAllocator { + char structgen_pad0[1]; +}; +struct physx_PxVirtualAllocatorCallback { + void* vtable_; +}; +struct physx_PxVirtualAllocator { + char structgen_pad0[16]; +}; +struct physx_PxUserAllocated { + char structgen_pad0[1]; +}; +union physx_PxTempAllocatorChunk { + physx_PxTempAllocatorChunk* mNext; + uint32_t mIndex; + uint8_t mPad[16]; +}; +struct physx_PxTempAllocator { + char structgen_pad0[1]; +}; +struct physx_PxLogTwo; +struct physx_PxUnConst; +struct physx_PxBitAndByte { + char structgen_pad0[1]; +}; +struct physx_PxBitMap { + char structgen_pad0[16]; +}; +struct physx_PxVec3 { + float x; + float y; + float z; +}; +struct physx_PxVec3Padded { + float x; + float y; + float z; + uint32_t padding; +}; +struct physx_PxQuat { + float x; + float y; + float z; + float w; +}; +struct physx_PxTransform { + physx_PxQuat q; + physx_PxVec3 p; +}; +struct physx_PxTransformPadded { + physx_PxTransform transform; + uint32_t padding; +}; +struct physx_PxMat33 { + physx_PxVec3 column0; + physx_PxVec3 column1; + physx_PxVec3 column2; +}; +struct physx_PxBounds3 { + physx_PxVec3 minimum; + physx_PxVec3 maximum; +}; +struct physx_PxErrorCallback { + void* vtable_; +}; +struct physx_PxAllocationListener { + void* vtable_; +}; +struct physx_PxBroadcastingAllocator { + char structgen_pad0[176]; +}; +struct physx_PxBroadcastingErrorCallback { + char structgen_pad0[160]; +}; +struct physx_PxHash; +struct physx_PxInputStream { + void* vtable_; +}; +struct physx_PxInputData { + void* vtable_; +}; +struct physx_PxOutputStream { + void* vtable_; +}; +struct physx_PxVec4 { + float x; + float y; + float z; + float w; +}; +struct physx_PxMat44 { + physx_PxVec4 column0; + physx_PxVec4 column1; + physx_PxVec4 column2; + physx_PxVec4 column3; +}; +struct physx_PxPlane { + physx_PxVec3 n; + float d; +}; +struct physx_Interpolation { + char structgen_pad0[1]; +}; +struct physx_PxMutexImpl { + char structgen_pad0[1]; +}; +struct physx_PxReadWriteLock { + char structgen_pad0[8]; +}; +struct physx_PxProfilerCallback { + void* vtable_; +}; +struct physx_PxProfileScoped { + physx_PxProfilerCallback* mCallback; + char const* mEventName; + void* mProfilerData; + uint64_t mContextId; + bool mDetached; + char structgen_pad0[7]; +}; +struct physx_PxSListEntry { + char structgen_pad0[16]; +}; +struct physx_PxSListImpl { + char structgen_pad0[1]; +}; +struct physx_PxSyncImpl { + char structgen_pad0[1]; +}; +struct physx_PxRunnable { + void* vtable_; +}; +struct physx_PxCounterFrequencyToTensOfNanos { + uint64_t mNumerator; + uint64_t mDenominator; +}; +struct physx_PxTime { + char structgen_pad0[8]; +}; +struct physx_PxVec2 { + float x; + float y; +}; +struct physx_PxStridedData { + uint32_t stride; + char structgen_pad0[4]; + void const* data; +}; +struct physx_PxBoundedData { + uint32_t stride; + char structgen_pad0[4]; + void const* data; + uint32_t count; + char structgen_pad1[4]; +}; +struct physx_PxDebugPoint { + physx_PxVec3 pos; + uint32_t color; +}; +struct physx_PxDebugLine { + physx_PxVec3 pos0; + uint32_t color0; + physx_PxVec3 pos1; + uint32_t color1; +}; +struct physx_PxDebugTriangle { + physx_PxVec3 pos0; + uint32_t color0; + physx_PxVec3 pos1; + uint32_t color1; + physx_PxVec3 pos2; + uint32_t color2; +}; +struct physx_PxDebugText { + physx_PxVec3 position; + float size; + uint32_t color; + char structgen_pad0[4]; + char const* string; +}; +struct physx_PxRenderBuffer { + void* vtable_; +}; +struct physx_PxBase; +struct physx_PxSerializationContext; +struct physx_PxRepXSerializer; +struct physx_PxSerializer; +struct physx_PxPhysics; +struct physx_PxCollection; +struct physx_PxProcessPxBaseCallback { + void* vtable_; +}; +struct physx_PxSerializationContext { + void* vtable_; +}; +struct physx_PxDeserializationContext { + char structgen_pad0[16]; +}; +struct physx_PxSerializationRegistry { + void* vtable_; +}; +struct physx_PxCollection { + void* vtable_; +}; +struct physx_PxTypeInfo; +struct physx_PxMaterial; +struct physx_PxFEMSoftBodyMaterial; +struct physx_PxFEMClothMaterial; +struct physx_PxPBDMaterial; +struct physx_PxFLIPMaterial; +struct physx_PxMPMMaterial; +struct physx_PxCustomMaterial; +struct physx_PxConvexMesh; +struct physx_PxTriangleMesh; +struct physx_PxBVH33TriangleMesh; +struct physx_PxBVH34TriangleMesh; +struct physx_PxTetrahedronMesh; +struct physx_PxHeightField; +struct physx_PxActor; +struct physx_PxRigidActor; +struct physx_PxRigidBody; +struct physx_PxRigidDynamic; +struct physx_PxRigidStatic; +struct physx_PxArticulationLink; +struct physx_PxArticulationJointReducedCoordinate; +struct physx_PxArticulationReducedCoordinate; +struct physx_PxAggregate; +struct physx_PxConstraint; +struct physx_PxShape; +struct physx_PxPruningStructure; +struct physx_PxParticleSystem; +struct physx_PxPBDParticleSystem; +struct physx_PxFLIPParticleSystem; +struct physx_PxMPMParticleSystem; +struct physx_PxCustomParticleSystem; +struct physx_PxSoftBody; +struct physx_PxFEMCloth; +struct physx_PxHairSystem; +struct physx_PxParticleBuffer; +struct physx_PxParticleAndDiffuseBuffer; +struct physx_PxParticleClothBuffer; +struct physx_PxParticleRigidBuffer; +struct physx_PxBase { + char structgen_pad0[16]; +}; +struct physx_PxRefCounted { + char structgen_pad0[16]; +}; +struct physx_PxTolerancesScale { + float length; + float speed; +}; +struct physx_PxStringTable { + void* vtable_; +}; +struct physx_PxSerializer { + void* vtable_; +}; +struct physx_PxMetaDataEntry { + char const* type; + char const* name; + uint32_t offset; + uint32_t size; + uint32_t count; + uint32_t offsetSize; + uint32_t flags; + uint32_t alignment; +}; +struct physx_PxInsertionCallback { + void* vtable_; +}; +struct physx_PxBaseTask; +struct physx_PxTask; +struct physx_PxLightCpuTask; +struct physx_PxCpuDispatcher; +struct physx_PxTaskManager { + void* vtable_; +}; +struct physx_PxCpuDispatcher { + void* vtable_; +}; +struct physx_PxBaseTask { + char structgen_pad0[24]; +}; +struct physx_PxTask { + char structgen_pad0[32]; +}; +struct physx_PxLightCpuTask { + char structgen_pad0[40]; +}; +struct physx_PxGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxBoxGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxVec3 halfExtents; +}; +struct physx_PxBVHRaycastCallback { + void* vtable_; +}; +struct physx_PxBVHOverlapCallback { + void* vtable_; +}; +struct physx_PxBVHTraversalCallback { + void* vtable_; +}; +struct physx_PxBVH { + char structgen_pad0[16]; +}; +struct physx_PxGeomIndexPair; +struct physx_PxCapsuleGeometry { + char structgen_pad0[4]; + float mTypePadding; + float radius; + float halfHeight; +}; +struct physx_PxHullPolygon { + float mPlane[4]; + uint16_t mNbVerts; + uint16_t mIndexBase; +}; +struct physx_PxConvexMesh { + char structgen_pad0[16]; +}; +struct physx_PxMeshScale { + physx_PxVec3 scale; + physx_PxQuat rotation; +}; +struct physx_PxConvexMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxMeshScale scale; + char structgen_pad1[4]; + physx_PxConvexMesh* convexMesh; + uint8_t meshFlags; + char structgen_pad2[7]; +}; +struct physx_PxSphereGeometry { + char structgen_pad0[4]; + float mTypePadding; + float radius; +}; +struct physx_PxPlaneGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxTriangleMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxMeshScale scale; + uint8_t meshFlags; + char structgen_pad1[3]; + physx_PxTriangleMesh* triangleMesh; +}; +struct physx_PxHeightFieldGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxHeightField* heightField; + float heightScale; + float rowScale; + float columnScale; + uint8_t heightFieldFlags; + char structgen_pad1[3]; +}; +struct physx_PxParticleSystemGeometry { + char structgen_pad0[4]; + float mTypePadding; + int32_t mSolverType; +}; +struct physx_PxHairSystemGeometry { + char structgen_pad0[4]; + float mTypePadding; +}; +struct physx_PxTetrahedronMeshGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxTetrahedronMesh* tetrahedronMesh; +}; +struct physx_PxQueryHit { + uint32_t faceIndex; +}; +struct physx_PxLocationHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; +}; +struct physx_PxGeomRaycastHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + float u; + float v; +}; +struct physx_PxGeomOverlapHit { + uint32_t faceIndex; +}; +struct physx_PxGeomSweepHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; +}; +struct physx_PxGeomIndexPair { + uint32_t id0; + uint32_t id1; +}; +struct physx_PxQueryThreadContext { + char structgen_pad0[1]; +}; +struct physx_PxContactBuffer; +struct physx_PxRenderOutput; +struct physx_PxMassProperties; +struct physx_PxCustomGeometryType { + char structgen_pad0[4]; +}; +struct physx_PxCustomGeometryCallbacks { + void* vtable_; +}; +struct physx_PxCustomGeometry { + char structgen_pad0[4]; + float mTypePadding; + physx_PxCustomGeometryCallbacks* callbacks; +}; +struct physx_PxGeometryHolder { + char structgen_pad0[56]; +}; +struct physx_PxGeometryQuery { + char structgen_pad0[1]; +}; +struct physx_PxHeightFieldSample { + int16_t height; + physx_PxBitAndByte materialIndex0; + physx_PxBitAndByte materialIndex1; +}; +struct physx_PxHeightFieldDesc; +struct physx_PxHeightField { + char structgen_pad0[16]; +}; +struct physx_PxHeightFieldDesc { + uint32_t nbRows; + uint32_t nbColumns; + int32_t format; + char structgen_pad0[4]; + physx_PxStridedData samples; + float convexEdgeThreshold; + uint16_t flags; + char structgen_pad1[2]; +}; +struct physx_PxTriangle; +struct physx_PxMeshQuery { + char structgen_pad0[1]; +}; +struct physx_PxSimpleTriangleMesh { + physx_PxBoundedData points; + physx_PxBoundedData triangles; + uint16_t flags; + char structgen_pad0[6]; +}; +struct physx_PxTriangle { + physx_PxVec3 verts[3]; +}; +struct physx_PxTrianglePadded { + physx_PxVec3 verts[3]; + uint32_t padding; +}; +struct physx_PxTriangleMesh { + char structgen_pad0[16]; +}; +struct physx_PxBVH34TriangleMesh { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedron { + physx_PxVec3 verts[4]; +}; +struct physx_PxSoftBodyAuxData { + char structgen_pad0[16]; +}; +struct physx_PxTetrahedronMesh { + char structgen_pad0[16]; +}; +struct physx_PxSoftBodyMesh { + char structgen_pad0[16]; +}; +struct physx_PxCollisionMeshMappingData { + char structgen_pad0[8]; +}; +struct physx_PxSoftBodyCollisionData { + char structgen_pad0[1]; +}; +struct physx_PxTetrahedronMeshData { + char structgen_pad0[1]; +}; +struct physx_PxSoftBodySimulationData { + char structgen_pad0[1]; +}; +struct physx_PxCollisionTetrahedronMeshData { + char structgen_pad0[8]; +}; +struct physx_PxSimulationTetrahedronMeshData { + char structgen_pad0[8]; +}; +struct physx_PxScene; +struct physx_PxActor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxAggregate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpringModifiers { + float stiffness; + float damping; + char structgen_pad0[8]; +}; +struct physx_PxRestitutionModifiers { + float restitution; + float velocityThreshold; + char structgen_pad0[8]; +}; +union physx_Px1DConstraintMods { + physx_PxSpringModifiers spring; + physx_PxRestitutionModifiers bounce; +}; +struct physx_Px1DConstraint { + physx_PxVec3 linear0; + float geometricError; + physx_PxVec3 angular0; + float velocityTarget; + physx_PxVec3 linear1; + float minImpulse; + physx_PxVec3 angular1; + float maxImpulse; + physx_Px1DConstraintMods mods; + float forInternalUse; + uint16_t flags; + uint16_t solveHint; + char structgen_pad0[8]; +}; +struct physx_PxConstraintInvMassScale { + float linear0; + float angular0; + float linear1; + float angular1; +}; +struct physx_PxConstraintVisualizer { + void* vtable_; +}; +struct physx_PxConstraintConnector { + void* vtable_; +}; +struct physx_PxContactPoint { + physx_PxVec3 normal; + float separation; + physx_PxVec3 point; + float maxImpulse; + physx_PxVec3 targetVel; + float staticFriction; + uint8_t materialFlags; + char structgen_pad0[3]; + uint32_t internalFaceIndex1; + float dynamicFriction; + float restitution; + float damping; + char structgen_pad1[12]; +}; +struct physx_PxTGSSolverBodyVel; +struct physx_PxSolverBody { + physx_PxVec3 linearVelocity; + uint16_t maxSolverNormalProgress; + uint16_t maxSolverFrictionProgress; + physx_PxVec3 angularState; + uint32_t solverProgress; +}; +struct physx_PxSolverBodyData { + physx_PxVec3 linearVelocity; + float invMass; + physx_PxVec3 angularVelocity; + float reportThreshold; + physx_PxMat33 sqrtInvInertia; + float penBiasClamp; + uint32_t nodeIndex; + float maxContactImpulse; + physx_PxTransform body2World; + uint16_t pad; + char structgen_pad0[2]; +}; +struct physx_PxConstraintBatchHeader { + uint32_t startIndex; + uint16_t stride; + uint16_t constraintType; +}; +struct physx_PxSolverConstraintDesc { + char structgen_pad0[16]; + uint32_t bodyADataIndex; + uint32_t bodyBDataIndex; + uint32_t linkIndexA; + uint32_t linkIndexB; + uint8_t* constraint; + void* writeBack; + uint16_t progressA; + uint16_t progressB; + uint16_t constraintLengthOver16; + uint8_t padding[10]; +}; +struct physx_PxSolverConstraintPrepDescBase { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxSolverConstraintPrepDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + physx_Px1DConstraint* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad1[3]; + physx_PxVec3Padded body0WorldOffset; + char structgen_pad2[8]; +}; +struct physx_PxSolverContactDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxSolverBody const* body0; + physx_PxSolverBody const* body1; + physx_PxSolverBodyData const* data0; + physx_PxSolverBodyData const* data1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + void* shapeInteraction; + physx_PxContactPoint* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad1[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad2[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float offsetSlop; + char structgen_pad3[4]; +}; +struct physx_PxConstraintAllocator { + void* vtable_; +}; +struct physx_PxArticulationLimit { + float low; + float high; +}; +struct physx_PxArticulationDrive { + float stiffness; + float damping; + float maxForce; + int32_t driveType; +}; +struct physx_PxTGSSolverBodyVel { + physx_PxVec3 linearVelocity; + uint16_t nbStaticInteractions; + uint16_t maxDynamicPartition; + physx_PxVec3 angularVelocity; + uint32_t partitionMask; + physx_PxVec3 deltaAngDt; + float maxAngVel; + physx_PxVec3 deltaLinDt; + uint16_t lockFlags; + bool isKinematic; + uint8_t pad; +}; +struct physx_PxTGSSolverBodyTxInertia { + physx_PxTransform deltaBody2World; + physx_PxMat33 sqrtInvInertia; +}; +struct physx_PxTGSSolverBodyData { + physx_PxVec3 originalLinearVelocity; + float maxContactImpulse; + physx_PxVec3 originalAngularVelocity; + float penBiasClamp; + float invMass; + uint32_t nodeIndex; + float reportThreshold; + uint32_t pad; +}; +struct physx_PxTGSSolverConstraintPrepDescBase { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; +}; +struct physx_PxTGSSolverConstraintPrepDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + physx_Px1DConstraint* rows; + uint32_t numRows; + float linBreakForce; + float angBreakForce; + float minResponseThreshold; + void* writeback; + bool disablePreprocessing; + bool improvedSlerp; + bool driveLimitsAreForces; + bool extendedLimits; + bool disableConstraint; + char structgen_pad1[3]; + physx_PxVec3Padded body0WorldOffset; + physx_PxVec3Padded cA2w; + physx_PxVec3Padded cB2w; + char structgen_pad2[8]; +}; +struct physx_PxTGSSolverContactDesc { + physx_PxConstraintInvMassScale invMassScales; + physx_PxSolverConstraintDesc* desc; + physx_PxTGSSolverBodyVel const* body0; + physx_PxTGSSolverBodyVel const* body1; + physx_PxTGSSolverBodyTxInertia const* body0TxI; + physx_PxTGSSolverBodyTxInertia const* body1TxI; + physx_PxTGSSolverBodyData const* bodyData0; + physx_PxTGSSolverBodyData const* bodyData1; + physx_PxTransform bodyFrame0; + physx_PxTransform bodyFrame1; + int32_t bodyState0; + int32_t bodyState1; + char structgen_pad0[8]; + void* shapeInteraction; + physx_PxContactPoint* contacts; + uint32_t numContacts; + bool hasMaxImpulse; + bool disableStrongFriction; + bool hasForceThresholds; + char structgen_pad1[1]; + float restDistance; + float maxCCDSeparation; + uint8_t* frictionPtr; + uint8_t frictionCount; + char structgen_pad2[7]; + float* contactForces; + uint32_t startFrictionPatchIndex; + uint32_t numFrictionPatches; + uint32_t startContactPatchIndex; + uint16_t numContactPatches; + uint16_t axisConstraintCount; + float maxImpulse; + float torsionalPatchRadius; + float minTorsionalPatchRadius; + float offsetSlop; + char structgen_pad3[8]; +}; +struct physx_PxArticulationSpatialTendon; +struct physx_PxArticulationFixedTendon; +struct physx_PxArticulationTendonLimit { + float lowLimit; + float highLimit; +}; +struct physx_PxArticulationAttachment { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendonJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationSpatialTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationFixedTendon { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpatialForce { + physx_PxVec3 force; + float pad0; + physx_PxVec3 torque; + float pad1; +}; +struct physx_PxSpatialVelocity { + physx_PxVec3 linear; + float pad0; + physx_PxVec3 angular; + float pad1; +}; +struct physx_PxArticulationRootLinkData { + physx_PxTransform transform; + physx_PxVec3 worldLinVel; + physx_PxVec3 worldAngVel; + physx_PxVec3 worldLinAccel; + physx_PxVec3 worldAngAccel; +}; +struct physx_PxArticulationCache { + physx_PxSpatialForce* externalForces; + float* denseJacobian; + float* massMatrix; + float* jointVelocity; + float* jointAcceleration; + float* jointPosition; + float* jointForce; + float* jointSolverForces; + physx_PxSpatialVelocity* linkVelocity; + physx_PxSpatialVelocity* linkAcceleration; + physx_PxArticulationRootLinkData* rootLinkData; + physx_PxSpatialForce* sensorForces; + float* coefficientMatrix; + float* lambda; + void* scratchMemory; + void* scratchAllocator; + uint32_t version; + char structgen_pad0[4]; +}; +struct physx_PxArticulationSensor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationReducedCoordinate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationJointReducedCoordinate { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData; +struct physx_PxBaseMaterial; +struct physx_PxShape { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidActor { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxNodeIndex { + char structgen_pad0[8]; +}; +struct physx_PxRigidBody { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxArticulationLink { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxConeLimitedConstraint { + physx_PxVec3 mAxis; + float mAngle; + float mLowLimit; + float mHighLimit; +}; +struct physx_PxConeLimitParams { + physx_PxVec4 lowHighLimits; + physx_PxVec4 axisAngle; +}; +struct physx_PxConstraintShaderTable { + void * solverPrep; + char structgen_pad0[8]; + void * visualize; + int32_t flag; + char structgen_pad1[4]; +}; +struct physx_PxConstraint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxMassModificationProps { + float mInvMassScale0; + float mInvInertiaScale0; + float mInvMassScale1; + float mInvInertiaScale1; +}; +struct physx_PxContactPatch { + physx_PxMassModificationProps mMassModification; + physx_PxVec3 normal; + float restitution; + float dynamicFriction; + float staticFriction; + float damping; + uint16_t startContactIndex; + uint8_t nbContacts; + uint8_t materialFlags; + uint16_t internalFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + uint16_t pad[5]; +}; +struct physx_PxContact { + physx_PxVec3 contact; + float separation; +}; +struct physx_PxExtendedContact { + physx_PxVec3 contact; + float separation; + physx_PxVec3 targetVelocity; + float maxImpulse; +}; +struct physx_PxModifiableContact { + physx_PxVec3 contact; + float separation; + physx_PxVec3 targetVelocity; + float maxImpulse; + physx_PxVec3 normal; + float restitution; + uint32_t materialFlags; + uint16_t materialIndex0; + uint16_t materialIndex1; + float staticFriction; + float dynamicFriction; +}; +struct physx_PxContactStreamIterator { + physx_PxVec3 zero; + char structgen_pad0[4]; + physx_PxContactPatch const* patch; + physx_PxContact const* contact; + uint32_t const* faceIndice; + uint32_t totalPatches; + uint32_t totalContacts; + uint32_t nextContactIndex; + uint32_t nextPatchIndex; + uint32_t contactPatchHeaderSize; + uint32_t contactPointSize; + int32_t mStreamFormat; + uint32_t forceNoResponse; + bool pointStepped; + char structgen_pad1[3]; + uint32_t hasFaceIndices; +}; +struct physx_PxGpuContactPair { + uint8_t* contactPatches; + uint8_t* contactPoints; + float* contactForces; + uint32_t transformCacheRef0; + uint32_t transformCacheRef1; + physx_PxNodeIndex nodeIndex0; + physx_PxNodeIndex nodeIndex1; + physx_PxActor* actor0; + physx_PxActor* actor1; + uint16_t nbContacts; + uint16_t nbPatches; + char structgen_pad0[4]; +}; +struct physx_PxContactSet { + char structgen_pad0[16]; +}; +struct physx_PxContactModifyPair { + physx_PxRigidActor const* actor[2]; + physx_PxShape const* shape[2]; + physx_PxTransform transform[2]; + physx_PxContactSet contacts; +}; +struct physx_PxContactModifyCallback { + void* vtable_; +}; +struct physx_PxCCDContactModifyCallback { + void* vtable_; +}; +struct physx_PxDeletionListener { + void* vtable_; +}; +struct physx_PxBaseMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFEMMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFilterData { + uint32_t word0; + uint32_t word1; + uint32_t word2; + uint32_t word3; +}; +struct physx_PxSimulationFilterCallback { + void* vtable_; +}; +struct physx_PxParticleRigidFilterPair { + uint64_t mID0; + uint64_t mID1; +}; +struct physx_PxLockedData { + void* vtable_; +}; +struct physx_PxMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGpuParticleBufferIndexPair { + uint32_t systemIndex; + uint32_t bufferIndex; +}; +struct physx_PxCudaContextManager; +struct physx_PxParticleRigidAttachment; +struct physx_PxParticleVolume { + physx_PxBounds3 bound; + uint32_t particleIndicesOffset; + uint32_t numParticles; +}; +struct physx_PxDiffuseParticleParams { + float threshold; + float lifetime; + float airDrag; + float bubbleDrag; + float buoyancy; + float kineticEnergyWeight; + float pressureWeight; + float divergenceWeight; + float collisionDecay; + bool useAccurateVelocity; + char structgen_pad0[3]; +}; +struct physx_PxParticleSpring { + uint32_t ind0; + uint32_t ind1; + float length; + float stiffness; + float damping; + float pad; +}; +struct physx_PxParticleMaterial { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneDesc; +struct physx_PxPvd; +struct physx_PxOmniPvd; +struct physx_PxPhysics { + void* vtable_; +}; +struct physx_PxActorShape { + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxRaycastHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + float u; + float v; + char structgen_pad1[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxOverlapHit { + uint32_t faceIndex; + char structgen_pad0[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxSweepHit { + uint32_t faceIndex; + uint16_t flags; + char structgen_pad0[2]; + physx_PxVec3 position; + physx_PxVec3 normal; + float distance; + char structgen_pad1[4]; + physx_PxRigidActor* actor; + physx_PxShape* shape; +}; +struct physx_PxRaycastCallback { + char structgen_pad0[8]; + physx_PxRaycastHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapCallback { + char structgen_pad0[8]; + physx_PxOverlapHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepCallback { + char structgen_pad0[8]; + physx_PxSweepHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxRaycastBuffer { + char structgen_pad0[8]; + physx_PxRaycastHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxRaycastHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxOverlapBuffer { + char structgen_pad0[8]; + physx_PxOverlapHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxOverlapHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxSweepBuffer { + char structgen_pad0[8]; + physx_PxSweepHit block; + bool hasBlock; + char structgen_pad1[7]; + physx_PxSweepHit* touches; + uint32_t maxNbTouches; + uint32_t nbTouches; +}; +struct physx_PxQueryCache { + physx_PxShape* shape; + physx_PxRigidActor* actor; + uint32_t faceIndex; + char structgen_pad0[4]; +}; +struct physx_PxQueryFilterData { + physx_PxFilterData data; + uint16_t flags; + char structgen_pad0[2]; +}; +struct physx_PxQueryFilterCallback { + void* vtable_; +}; +struct physx_PxRigidDynamic { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRigidStatic { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSceneQuerySystem; +struct physx_PxSceneQueryDesc { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; +}; +struct physx_PxSceneQuerySystemBase { + void* vtable_; +}; +struct physx_PxSceneSQSystem { + void* vtable_; +}; +struct physx_PxSceneQuerySystem { + void* vtable_; +}; +struct physx_PxBroadPhaseRegion { + physx_PxBounds3 mBounds; + void* mUserData; +}; +struct physx_PxBroadPhaseRegionInfo { + physx_PxBroadPhaseRegion mRegion; + uint32_t mNbStaticObjects; + uint32_t mNbDynamicObjects; + bool mActive; + bool mOverlap; + char structgen_pad0[6]; +}; +struct physx_PxBroadPhaseCaps { + uint32_t mMaxNbRegions; +}; +struct physx_PxBroadPhaseDesc { + int32_t mType; + char structgen_pad0[4]; + uint64_t mContextID; + char structgen_pad1[8]; + uint32_t mFoundLostPairsCapacity; + bool mDiscardStaticVsKinematic; + bool mDiscardKinematicVsKinematic; + char structgen_pad2[2]; +}; +struct physx_PxBroadPhaseUpdateData { + uint32_t const* mCreated; + uint32_t mNbCreated; + char structgen_pad0[4]; + uint32_t const* mUpdated; + uint32_t mNbUpdated; + char structgen_pad1[4]; + uint32_t const* mRemoved; + uint32_t mNbRemoved; + char structgen_pad2[4]; + physx_PxBounds3 const* mBounds; + uint32_t const* mGroups; + float const* mDistances; + uint32_t mCapacity; + char structgen_pad3[4]; +}; +struct physx_PxBroadPhasePair { + uint32_t mID0; + uint32_t mID1; +}; +struct physx_PxBroadPhaseResults { + uint32_t mNbCreatedPairs; + char structgen_pad0[4]; + physx_PxBroadPhasePair const* mCreatedPairs; + uint32_t mNbDeletedPairs; + char structgen_pad1[4]; + physx_PxBroadPhasePair const* mDeletedPairs; +}; +struct physx_PxBroadPhaseRegions { + void* vtable_; +}; +struct physx_PxBroadPhase { + void* vtable_; +}; +struct physx_PxAABBManager { + void* vtable_; +}; +struct physx_PxBroadPhaseCallback; +struct physx_PxSimulationEventCallback; +struct physx_PxSceneLimits { + uint32_t maxNbActors; + uint32_t maxNbBodies; + uint32_t maxNbStaticShapes; + uint32_t maxNbDynamicShapes; + uint32_t maxNbAggregates; + uint32_t maxNbConstraints; + uint32_t maxNbRegions; + uint32_t maxNbBroadPhaseOverlaps; +}; +struct physx_PxgDynamicsMemoryConfig { + uint32_t tempBufferCapacity; + uint32_t maxRigidContactCount; + uint32_t maxRigidPatchCount; + uint32_t heapCapacity; + uint32_t foundLostPairsCapacity; + uint32_t foundLostAggregatePairsCapacity; + uint32_t totalAggregatePairsCapacity; + uint32_t maxSoftBodyContacts; + uint32_t maxFemClothContacts; + uint32_t maxParticleContacts; + uint32_t collisionStackSize; + uint32_t maxHairContacts; +}; +struct physx_PxSceneDesc { + int32_t staticStructure; + int32_t dynamicStructure; + uint32_t dynamicTreeRebuildRateHint; + int32_t dynamicTreeSecondaryPruner; + int32_t staticBVHBuildStrategy; + int32_t dynamicBVHBuildStrategy; + uint32_t staticNbObjectsPerNode; + uint32_t dynamicNbObjectsPerNode; + int32_t sceneQueryUpdateMode; + physx_PxVec3 gravity; + physx_PxSimulationEventCallback* simulationEventCallback; + physx_PxContactModifyCallback* contactModifyCallback; + physx_PxCCDContactModifyCallback* ccdContactModifyCallback; + void const* filterShaderData; + uint32_t filterShaderDataSize; + char structgen_pad0[4]; + void * filterShader; + physx_PxSimulationFilterCallback* filterCallback; + int32_t kineKineFilteringMode; + int32_t staticKineFilteringMode; + int32_t broadPhaseType; + char structgen_pad1[4]; + physx_PxBroadPhaseCallback* broadPhaseCallback; + physx_PxSceneLimits limits; + int32_t frictionType; + int32_t solverType; + float bounceThresholdVelocity; + float frictionOffsetThreshold; + float frictionCorrelationDistance; + uint32_t flags; + physx_PxCpuDispatcher* cpuDispatcher; + char structgen_pad2[8]; + void* userData; + uint32_t solverBatchSize; + uint32_t solverArticulationBatchSize; + uint32_t nbContactDataBlocks; + uint32_t maxNbContactDataBlocks; + float maxBiasCoefficient; + uint32_t contactReportStreamBufferSize; + uint32_t ccdMaxPasses; + float ccdThreshold; + float ccdMaxSeparation; + float wakeCounterResetValue; + physx_PxBounds3 sanityBounds; + physx_PxgDynamicsMemoryConfig gpuDynamicsConfig; + uint32_t gpuMaxNumPartitions; + uint32_t gpuMaxNumStaticPartitions; + uint32_t gpuComputeVersion; + uint32_t contactPairSlabSize; + physx_PxSceneQuerySystem* sceneQuerySystem; + char structgen_pad3[8]; +}; +struct physx_PxSimulationStatistics { + uint32_t nbActiveConstraints; + uint32_t nbActiveDynamicBodies; + uint32_t nbActiveKinematicBodies; + uint32_t nbStaticBodies; + uint32_t nbDynamicBodies; + uint32_t nbKinematicBodies; + uint32_t nbShapes[11]; + uint32_t nbAggregates; + uint32_t nbArticulations; + uint32_t nbAxisSolverConstraints; + uint32_t compressedContactSize; + uint32_t requiredContactConstraintMemory; + uint32_t peakConstraintMemory; + uint32_t nbDiscreteContactPairsTotal; + uint32_t nbDiscreteContactPairsWithCacheHits; + uint32_t nbDiscreteContactPairsWithContacts; + uint32_t nbNewPairs; + uint32_t nbLostPairs; + uint32_t nbNewTouches; + uint32_t nbLostTouches; + uint32_t nbPartitions; + char structgen_pad0[4]; + uint64_t gpuMemParticles; + uint64_t gpuMemSoftBodies; + uint64_t gpuMemFEMCloths; + uint64_t gpuMemHairSystems; + uint64_t gpuMemHeap; + uint64_t gpuMemHeapBroadPhase; + uint64_t gpuMemHeapNarrowPhase; + uint64_t gpuMemHeapSolver; + uint64_t gpuMemHeapArticulation; + uint64_t gpuMemHeapSimulation; + uint64_t gpuMemHeapSimulationArticulation; + uint64_t gpuMemHeapSimulationParticles; + uint64_t gpuMemHeapSimulationSoftBody; + uint64_t gpuMemHeapSimulationFEMCloth; + uint64_t gpuMemHeapSimulationHairSystem; + uint64_t gpuMemHeapParticles; + uint64_t gpuMemHeapSoftBodies; + uint64_t gpuMemHeapFEMCloths; + uint64_t gpuMemHeapHairSystems; + uint64_t gpuMemHeapOther; + uint32_t nbBroadPhaseAdds; + uint32_t nbBroadPhaseRemoves; + uint32_t nbDiscreteContactPairs[11][11]; + uint32_t nbCCDPairs[11][11]; + uint32_t nbModifiedContactPairs[11][11]; + uint32_t nbTriggerPairs[11][11]; +}; +struct physx_PxGpuBodyData { + physx_PxQuat quat; + physx_PxVec4 pos; + physx_PxVec4 linVel; + physx_PxVec4 angVel; +}; +struct physx_PxGpuActorPair { + uint32_t srcIndex; + char structgen_pad0[4]; + physx_PxNodeIndex nodeIndex; +}; +struct physx_PxIndexDataPair { + uint32_t index; + char structgen_pad0[4]; + void* data; +}; +struct physx_PxPvdSceneClient { + void* vtable_; +}; +struct physx_PxContactPairHeader; +struct physx_PxDominanceGroupPair { + uint8_t dominance0; + uint8_t dominance1; +}; +struct physx_PxBroadPhaseCallback { + void* vtable_; +}; +struct physx_PxScene { + char structgen_pad0[8]; + void* userData; +}; +struct physx_PxSceneReadLock { + char structgen_pad0[8]; +}; +struct physx_PxSceneWriteLock { + char structgen_pad0[8]; +}; +struct physx_PxContactPairExtraDataItem { + uint8_t type; +}; +struct physx_PxContactPairVelocity { + uint8_t type; + char structgen_pad0[3]; + physx_PxVec3 linearVelocity[2]; + physx_PxVec3 angularVelocity[2]; +}; +struct physx_PxContactPairPose { + uint8_t type; + char structgen_pad0[3]; + physx_PxTransform globalPose[2]; +}; +struct physx_PxContactPairIndex { + uint8_t type; + char structgen_pad0[1]; + uint16_t index; +}; +struct physx_PxContactPairExtraDataIterator { + uint8_t const* currPtr; + uint8_t const* endPtr; + physx_PxContactPairVelocity const* preSolverVelocity; + physx_PxContactPairVelocity const* postSolverVelocity; + physx_PxContactPairPose const* eventPose; + uint32_t contactPairIndex; + char structgen_pad0[4]; +}; +struct physx_PxContactPair; +struct physx_PxContactPairHeader { + physx_PxActor* actors[2]; + uint8_t const* extraDataStream; + uint16_t extraDataStreamSize; + uint16_t flags; + char structgen_pad0[4]; + physx_PxContactPair const* pairs; + uint32_t nbPairs; + char structgen_pad1[4]; +}; +struct physx_PxContactPairPoint { + physx_PxVec3 position; + float separation; + physx_PxVec3 normal; + uint32_t internalFaceIndex0; + physx_PxVec3 impulse; + uint32_t internalFaceIndex1; +}; +struct physx_PxContactPair { + physx_PxShape* shapes[2]; + uint8_t const* contactPatches; + uint8_t const* contactPoints; + float const* contactImpulses; + uint32_t requiredBufferSize; + uint8_t contactCount; + uint8_t patchCount; + uint16_t contactStreamSize; + uint16_t flags; + uint16_t events; + uint32_t internalData[2]; + char structgen_pad0[4]; +}; +struct physx_PxTriggerPair { + physx_PxShape* triggerShape; + physx_PxActor* triggerActor; + physx_PxShape* otherShape; + physx_PxActor* otherActor; + int32_t status; + uint8_t flags; + char structgen_pad0[3]; +}; +struct physx_PxConstraintInfo { + physx_PxConstraint* constraint; + void* externalReference; + uint32_t type; + char structgen_pad0[4]; +}; +struct physx_PxSimulationEventCallback { + void* vtable_; +}; +struct physx_PxFEMParameters { + float velocityDamping; + float settlingThreshold; + float sleepThreshold; + float sleepDamping; + float selfCollisionFilterDistance; + float selfCollisionStressTolerance; +}; +struct physx_PxPruningStructure { + char structgen_pad0[16]; +}; +struct physx_PxExtendedVec3 { + double x; + double y; + double z; +}; +struct physx_PxControllerManager; +struct physx_PxObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; +}; +struct physx_PxBoxObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; + physx_PxVec3 mHalfExtents; + char structgen_pad1[4]; +}; +struct physx_PxCapsuleObstacle { + char structgen_pad0[8]; + void* mUserData; + physx_PxExtendedVec3 mPos; + physx_PxQuat mRot; + float mHalfHeight; + float mRadius; +}; +struct physx_PxObstacleContext { + void* vtable_; +}; +struct physx_PxController; +struct physx_PxControllerBehaviorCallback; +struct physx_PxControllerState { + physx_PxVec3 deltaXP; + char structgen_pad0[4]; + physx_PxShape* touchedShape; + physx_PxRigidActor* touchedActor; + uint32_t touchedObstacleHandle; + uint32_t collisionFlags; + bool standOnAnotherCCT; + bool standOnObstacle; + bool isMovingUp; + char structgen_pad1[5]; +}; +struct physx_PxControllerStats { + uint16_t nbIterations; + uint16_t nbFullUpdates; + uint16_t nbPartialUpdates; + uint16_t nbTessellation; +}; +struct physx_PxControllerHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; +}; +struct physx_PxControllerShapeHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + physx_PxShape* shape; + physx_PxRigidActor* actor; + uint32_t triangleIndex; + char structgen_pad1[4]; +}; +struct physx_PxControllersHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + physx_PxController* other; +}; +struct physx_PxControllerObstacleHit { + physx_PxController* controller; + physx_PxExtendedVec3 worldPos; + physx_PxVec3 worldNormal; + physx_PxVec3 dir; + float length; + char structgen_pad0[4]; + void const* userData; +}; +struct physx_PxUserControllerHitReport { + void* vtable_; +}; +struct physx_PxControllerFilterCallback { + void* vtable_; +}; +struct physx_PxControllerFilters { + physx_PxFilterData const* mFilterData; + physx_PxQueryFilterCallback* mFilterCallback; + uint16_t mFilterFlags; + char structgen_pad0[6]; + physx_PxControllerFilterCallback* mCCTFilterCallback; +}; +struct physx_PxControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; +}; +struct physx_PxController { + void* vtable_; +}; +struct physx_PxBoxControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; + float halfHeight; + float halfSideExtent; + float halfForwardExtent; + char structgen_pad5[4]; +}; +struct physx_PxBoxController { + void* vtable_; +}; +struct physx_PxCapsuleControllerDesc { + char structgen_pad0[8]; + physx_PxExtendedVec3 position; + physx_PxVec3 upDirection; + float slopeLimit; + float invisibleWallHeight; + float maxJumpHeight; + float contactOffset; + float stepOffset; + float density; + float scaleCoeff; + float volumeGrowth; + char structgen_pad1[4]; + physx_PxUserControllerHitReport* reportCallback; + physx_PxControllerBehaviorCallback* behaviorCallback; + int32_t nonWalkableMode; + char structgen_pad2[4]; + physx_PxMaterial* material; + bool registerDeletionListener; + uint8_t clientID; + char structgen_pad3[6]; + void* userData; + char structgen_pad4[8]; + float radius; + float height; + int32_t climbingMode; + char structgen_pad5[4]; +}; +struct physx_PxCapsuleController { + void* vtable_; +}; +struct physx_PxControllerBehaviorCallback { + void* vtable_; +}; +struct physx_PxControllerManager { + void* vtable_; +}; +struct physx_PxDim3 { + uint32_t x; + uint32_t y; + uint32_t z; +}; +struct physx_PxSDFDesc { + physx_PxBoundedData sdf; + physx_PxDim3 dims; + physx_PxVec3 meshLower; + float spacing; + uint32_t subgridSize; + int32_t bitsPerSubgridPixel; + physx_PxDim3 sdfSubgrids3DTexBlockDim; + physx_PxBoundedData sdfSubgrids; + physx_PxBoundedData sdfStartSlots; + float subgridsMinSdfValue; + float subgridsMaxSdfValue; + physx_PxBounds3 sdfBounds; + float narrowBandThicknessRelativeToSdfBoundsDiagonal; + uint32_t numThreadsForSdfConstruction; +}; +struct physx_PxConvexMeshDesc { + physx_PxBoundedData points; + physx_PxBoundedData polygons; + physx_PxBoundedData indices; + uint16_t flags; + uint16_t vertexLimit; + uint16_t polygonLimit; + uint16_t quantizedCount; + physx_PxSDFDesc* sdfDesc; +}; +struct physx_PxTriangleMeshDesc { + physx_PxBoundedData points; + physx_PxBoundedData triangles; + uint16_t flags; + char structgen_pad0[22]; + physx_PxSDFDesc* sdfDesc; +}; +struct physx_PxTetrahedronMeshDesc { + char structgen_pad0[16]; + physx_PxBoundedData points; + physx_PxBoundedData tetrahedrons; + uint16_t flags; + uint16_t tetsPerElement; + char structgen_pad1[4]; +}; +struct physx_PxSoftBodySimulationDataDesc { + physx_PxBoundedData vertexToTet; +}; +struct physx_PxBVH34MidphaseDesc { + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + bool quantized; + char structgen_pad0[3]; +}; +struct physx_PxMidphaseDesc { + char structgen_pad0[16]; +}; +struct physx_PxBVHDesc { + physx_PxBoundedData bounds; + float enlargement; + uint32_t numPrimsPerLeaf; + int32_t buildStrategy; + char structgen_pad0[4]; +}; +struct physx_PxCookingParams { + float areaTestEpsilon; + float planeTolerance; + int32_t convexMeshCookingType; + bool suppressTriangleMeshRemapTable; + bool buildTriangleAdjacencies; + bool buildGPUData; + char structgen_pad0[1]; + physx_PxTolerancesScale scale; + uint32_t meshPreprocessParams; + float meshWeldTolerance; + physx_PxMidphaseDesc midphaseDesc; + uint32_t gaussMapLimit; + float maxWeightRatioInTet; +}; +struct physx_PxDefaultMemoryOutputStream { + char structgen_pad0[32]; +}; +struct physx_PxDefaultMemoryInputData { + char structgen_pad0[32]; +}; +struct physx_PxDefaultFileOutputStream { + char structgen_pad0[16]; +}; +struct physx_PxDefaultFileInputData { + char structgen_pad0[24]; +}; +struct physx_PxDefaultAllocator { + void* vtable_; +}; +struct physx_PxJoint; +struct physx_PxRackAndPinionJoint; +struct physx_PxGearJoint; +struct physx_PxD6Joint; +struct physx_PxDistanceJoint; +struct physx_PxContactJoint; +struct physx_PxFixedJoint; +struct physx_PxPrismaticJoint; +struct physx_PxRevoluteJoint; +struct physx_PxSphericalJoint; +struct physx_PxJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSpring { + float stiffness; + float damping; +}; +struct physx_PxDistanceJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJacobianRow { + physx_PxVec3 linear0; + physx_PxVec3 linear1; + physx_PxVec3 angular0; + physx_PxVec3 angular1; +}; +struct physx_PxContactJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxFixedJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxJointLimitParameters { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; +}; +struct physx_PxJointLinearLimit { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float value; +}; +struct physx_PxJointLinearLimitPair { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointAngularLimitPair { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float upper; + float lower; +}; +struct physx_PxJointLimitCone { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngle; + float zAngle; +}; +struct physx_PxJointLimitPyramid { + float restitution; + float bounceThreshold; + float stiffness; + float damping; + float contactDistance_deprecated; + float yAngleMin; + float yAngleMax; + float zAngleMin; + float zAngleMax; +}; +struct physx_PxPrismaticJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRevoluteJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxSphericalJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxD6JointDrive { + float stiffness; + float damping; + float forceLimit; + uint32_t flags; +}; +struct physx_PxD6Joint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGearJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxRackAndPinionJoint { + char structgen_pad0[16]; + void* userData; +}; +struct physx_PxGroupsMask { + uint16_t bits0; + uint16_t bits1; + uint16_t bits2; + uint16_t bits3; +}; +struct physx_PxDefaultErrorCallback { + void* vtable_; +}; +struct physx_PxRigidActorExt { + char structgen_pad0[1]; +}; +struct physx_PxMassProperties { + physx_PxMat33 inertiaTensor; + physx_PxVec3 centerOfMass; + float mass; +}; +struct physx_PxRigidBodyExt { + char structgen_pad0[1]; +}; +struct physx_PxShapeExt { + char structgen_pad0[1]; +}; +struct physx_PxMeshOverlapUtil { + char structgen_pad0[1040]; +}; +struct physx_PxBinaryConverter; +struct physx_PxXmlMiscParameter { + physx_PxVec3 upVector; + physx_PxTolerancesScale scale; +}; +struct physx_PxSerialization { + char structgen_pad0[1]; +}; +struct physx_PxDefaultCpuDispatcher { + void* vtable_; +}; +struct physx_PxStringTableExt { + char structgen_pad0[1]; +}; +struct physx_PxBroadPhaseExt { + char structgen_pad0[1]; +}; +struct physx_PxSceneQueryExt { + char structgen_pad0[1]; +}; +struct physx_PxBatchQueryExt { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystem { + void* vtable_; +}; +struct physx_PxCustomSceneQuerySystemAdapter { + void* vtable_; +}; +struct physx_PxSamplingExt { + char structgen_pad0[1]; +}; +struct physx_PxPoissonSampler { + char structgen_pad0[8]; +}; +struct physx_PxTriangleMeshPoissonSampler { + char structgen_pad0[24]; +}; +struct physx_PxTetrahedronMeshExt { + char structgen_pad0[1]; +}; +struct physx_PxRepXObject { + char const* typeName; + void const* serializable; + uint64_t id; +}; +struct physx_PxCooking; +struct physx_PxRepXInstantiationArgs { + char structgen_pad0[8]; + physx_PxCooking* cooker; + physx_PxStringTable* stringTable; +}; +struct physx_XmlMemoryAllocator; +struct physx_XmlWriter; +struct physx_XmlReader; +struct physx_MemoryBuffer; +struct physx_PxRepXSerializer { + void* vtable_; +}; +struct physx_PxVehicleWheels4SimData; +struct physx_PxVehicleWheels4DynData; +struct physx_PxVehicleTireForceCalculator; +struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs; +struct physx_PxVehicleTelemetryData; +struct physx_PxPvdTransport; +struct physx_PxPvd { + void* vtable_; +}; +struct physx_PxPvdTransport { + void* vtable_; +}; diff --git a/modules/PhysX/physx/physx-sys/src/lib.rs b/modules/PhysX/physx/physx-sys/src/lib.rs new file mode 100644 index 0000000..6f3ae94 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/lib.rs @@ -0,0 +1,422 @@ +//! # 🎳 physx-sys +//! +//! ![Build Status](https://github.com/EmbarkStudios/physx-rs/workflows/CI/badge.svg) +//! [![Crates.io](https://img.shields.io/crates/v/physx-sys.svg)](https://crates.io/crates/physx-sys) +//! [![Docs](https://docs.rs/physx-sys/badge.svg)](https://docs.rs/physx-sys) +//! [![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4%20adopted-ff69b4.svg)](../CODE_OF_CONDUCT.md) +//! [![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](http://embark.games) +//! +//! Unsafe automatically-generated Rust bindings for [NVIDIA PhysX 4.1](https://github.com/NVIDIAGameWorks/PhysX) C++ API. +//! +//! Please also see the [repository](https://github.com/EmbarkStudios/physx-rs) containing a work-in-progress safe wrapper. +//! +//! ## Presentation +//! +//! [Tomasz Stachowiak](https://github.com/h3r2tic) did a presentation at the Stockholm Rust Meetup on October 2019 +//! about this project that goes through the tecnical details of how C++ to Rust bindings of `physx-sys` works: +//! +//! [![](http://img.youtube.com/vi/RxtXGeDHu0w/0.jpg)](http://www.youtube.com/watch?v=RxtXGeDHu0w "An unholy fusion of +//! Rust and C++ in physx-rs (Stockholm Rust Meetup, October 2019)") +//! +//! +//! ## Basic usage +//! +//! ```Rust +//! unsafe { +//! let foundation = physx_create_foundation(); +//! let physics = physx_create_physics(foundation); +//! +//! let mut scene_desc = PxSceneDesc_new(PxPhysics_getTolerancesScale(physics)); +//! scene_desc.gravity = PxVec3 { +//! x: 0.0, +//! y: -9.81, +//! z: 0.0, +//! }; +//! +//! let dispatcher = PxDefaultCpuDispatcherCreate(2, null_mut()); +//! +//! scene_desc.cpuDispatcher = dispatcher as *mut PxCpuDispatcher; +//! scene_desc.filterShader = Some(PxDefaultSimulationFilterShader); +//! +//! let scene = PxPhysics_createScene_mut(physics, &scene_desc); +//! +//! // Your physics simulation goes here +//! } +//! ``` +//! +//! ## Examples +//! +//! ### [Ball](examples/ball.rs) +//! +//! A simple example to showcase how to use physx-sys. It can be run with `cargo run --examples ball`. +//! +//! ``` +//! o +//! +//! o +//! o +//! +//! o +//! ooooooooo +//! o oo oo +//! o o +//! o o o +//! o oo +//! o o o +//! o ooooooo +//! o o oo oo +//! o o o oo oo +//! o o o o ooooooooo +//! o o o oo oooooooooo oo +//! +//! ``` +//! +//! ## How it works +//! +//! The binding is generated using a custom C++ app written against clang's +//! [libtooling](https://clang.llvm.org/docs/LibTooling.html). It queries the compiler's abstract syntax tree, and maps +//! the C++ PhysX functions and types to Rust using heuristics chosen specifically for this SDK. It is not a general +//! C++ <-> Rust binding generator, and using it on other projects *will* likely crash and burn. +//! +//! Since C++ does not have a standardized and stable ABI, it's generally not safe to call it from Rust code; since +//! PhysX exposes a C++ interface, we can't use it directly. That's why `physx-sys` generates both a Rust interface as +//! well as a plain C wrapper. The C code is compiled into a static library at build time, and Rust then talks to C. +//! +//! In order to minimize the amount of work required to marshall data between the C wrapper and the original C++ API, we +//! generate a **bespoke C wrapper for each build target**. The wrapper is based on metadata about structure layout +//! extracted directly from compiling and running a tiny program against the PhysX SDK using the specific C++ compiler +//! used in the build process. +//! +//! The build process comprises a few steps: +//! +//! 1. The `pxbind` utility uses `clang` to extract metadata about PhysX functions and types, and generates partial +//! Rust and C bindings as `physx_generated.hpp` and `physx_generated.rs`. Those contain all function definitions, and +//! a small subset of types. It also generates a C++ utility called `structgen` by emitting `structgen.cpp`. +//! 2. `structgen` is compiled against the PhysX SDK, and generates all the remaining type wrappers. For each struct, it +//! queries the size and offset of its members, and generates `structgen_out.hpp` and `structgen_out.rs`. The types are +//! "plain old data" structs which will perfectly match the memory layout of the C++ types. +//! 3. All the generated C types are compiled together to form `physx_api`, a static library for Rust to link with. +//! 4. The Rust wrapper is compiled, and linked with PhysX and the C wrapper. +//! +//! Steps *2..4* are performed completely automatically from within `build.rs`, while step *1* is only necessary when +//! upgrading the PhysX SDK or modifying the generator. As such, building and running `pxbind` is a manual task, and is +//! currently only supported on \*nix systems. +//! +//! ## License +//! +//! Licensed under either of +//! +//! * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) +//! * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) +//! +//! at your option. +//! +//! Note that the [PhysX C++ SDK](https://github.com/NVIDIAGameWorks/PhysX) has it's +//! [own BSD 3 license](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/Manual/License.html) and +//! depends on [additional C++ third party libraries](https://github.com/NVIDIAGameWorks/PhysX/tree/4.1/externals). +//! +//! ### Contribution +//! +//! Unless you explicitly state otherwise, any contribution intentionally +//! submitted for inclusion in the work by you, as defined in the Apache-2.0 +//! license, shall be dual licensed as above, without any additional terms or +//! conditions. + +// crate-specific exceptions: +#![allow( + unsafe_code, + non_upper_case_globals, + non_camel_case_types, + non_snake_case, + clippy::doc_markdown, // TODO: fixup comments and docs (though annoyingly complains about "PhysX") + clippy::unreadable_literal, + clippy::unused_unit, + clippy::upper_case_acronyms +)] + +#[cfg(feature = "structgen")] +include!(concat!(env!("OUT_DIR"), "/structgen_out.rs")); + +#[cfg(all( + not(feature = "structgen"), + target_os = "linux", + target_arch = "x86_64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "linux", + target_arch = "aarch64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "android", + target_arch = "x86_64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "android", + target_arch = "aarch64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "macos", + target_arch = "x86_64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "macos", + target_arch = "aarch64", +))] +include!("generated/unix/structgen.rs"); + +#[cfg(all( + not(feature = "structgen"), + target_os = "windows", + target_arch = "x86_64", + target_env = "msvc", +))] +include!("generated/x86_64-pc-windows-msvc/structgen.rs"); + +include!("physx_generated.rs"); + +use std::ffi::c_void; + +pub const fn version(major: u32, minor: u32, patch: u32) -> u32 { + (major << 24) + (minor << 16) + (patch << 8) +} + +pub type CollisionCallback = + unsafe extern "C" fn(*mut c_void, *const PxContactPairHeader, *const PxContactPair, u32); + +pub type TriggerCallback = unsafe extern "C" fn(*mut c_void, *const PxTriggerPair, u32); + +pub type ConstraintBreakCallback = unsafe extern "C" fn(*mut c_void, *const PxConstraintInfo, u32); + +pub type WakeSleepCallback = unsafe extern "C" fn(*mut c_void, *const *const PxActor, u32, bool); + +pub type AdvanceCallback = + unsafe extern "C" fn(*mut c_void, *const *const PxRigidBody, *const PxTransform, u32); + +// Function pointers in Rust are normally not nullable (which is why they don't require unsafe to call) +// but we need them to be, so we simply wrap them in Option<>. An Option is luckily represented +// by the compiler as a simple pointer with null representing None, so this is compatible with the C struct. +#[repr(C)] +pub struct SimulationEventCallbackInfo { + // Callback for collision events. + pub collision_callback: Option, + pub collision_user_data: *mut c_void, + // Callback for trigger shape events (an object entered or left a trigger shape). + pub trigger_callback: Option, + pub trigger_user_data: *mut c_void, + // Callback for when a constraint breaks (such as a joint with a force limit) + pub constraint_break_callback: Option, + pub constraint_break_user_data: *mut c_void, + // Callback for when an object falls asleep or is awoken. + pub wake_sleep_callback: Option, + pub wake_sleep_user_data: *mut c_void, + // Callback to get the next pose early for objects (if flagged with eENABLE_POSE_INTEGRATION_PREVIEW). + pub advance_callback: Option, + pub advance_user_data: *mut c_void, +} + +impl Default for SimulationEventCallbackInfo { + fn default() -> Self { + Self { + collision_callback: None, + collision_user_data: std::ptr::null_mut(), + trigger_callback: None, + trigger_user_data: std::ptr::null_mut(), + constraint_break_callback: None, + constraint_break_user_data: std::ptr::null_mut(), + wake_sleep_callback: None, + wake_sleep_user_data: std::ptr::null_mut(), + advance_callback: None, + advance_user_data: std::ptr::null_mut(), + } + } +} + +pub type RaycastHitCallback = unsafe extern "C" fn( + *const PxRigidActor, + *const PxFilterData, + *const PxShape, + hit_flags: u32, + *const c_void, +) -> PxQueryHitType; + +pub type PostFilterCallback = + unsafe extern "C" fn(*const PxFilterData, *const PxQueryHit, *const c_void) -> PxQueryHitType; + +#[repr(C)] +pub struct FilterShaderCallbackInfo { + pub attributes0: u32, + pub attributes1: u32, + pub filterData0: PxFilterData, + pub filterData1: PxFilterData, + pub pairFlags: *mut PxPairFlags, + pub constantBlock: *const std::ffi::c_void, + pub constantBlockSize: u32, +} + +pub type SimulationFilterShader = + unsafe extern "C" fn(*mut FilterShaderCallbackInfo) -> PxFilterFlags; + +pub type RaycastProcessTouchesCallback = + unsafe extern "C" fn(*const PxRaycastHit, u32, *mut c_void) -> bool; +pub type SweepProcessTouchesCallback = + unsafe extern "C" fn(*const PxSweepHit, u32, *mut c_void) -> bool; +pub type OverlapProcessTouchesCallback = + unsafe extern "C" fn(*const PxOverlapHit, u32, *mut c_void) -> bool; + +pub type FinalizeQueryCallback = unsafe extern "C" fn(*mut c_void); + +pub type AllocCallback = + unsafe extern "C" fn(u64, *const c_void, *const c_void, u32, *const c_void) -> *mut c_void; + +pub type DeallocCallback = unsafe extern "C" fn(*const c_void, *const c_void); + +pub type ZoneStartCallback = + unsafe extern "C" fn(*const i8, bool, u64, *const c_void) -> *mut c_void; + +pub type ZoneEndCallback = unsafe extern "C" fn(*const c_void, *const i8, bool, u64, *const c_void); + +pub type ErrorCallback = + unsafe extern "C" fn(PxErrorCode, *const i8, *const i8, u32, *const c_void); + +pub type AssertHandler = unsafe extern "C" fn(*const i8, *const i8, u32, *mut bool, *const c_void); + +extern "C" { + pub fn physx_create_foundation() -> *mut PxFoundation; + pub fn physx_create_foundation_with_alloc( + allocator: *mut PxDefaultAllocator, + ) -> *mut PxFoundation; + pub fn physx_create_physics(foundation: *mut PxFoundation) -> *mut PxPhysics; + + pub fn get_default_allocator() -> *mut PxDefaultAllocator; + pub fn get_default_error_callback() -> *mut PxDefaultErrorCallback; + + /// Destroy the returned callback object using PxQueryFilterCallback_delete. + pub fn create_raycast_filter_callback( + actor_to_ignore: *const PxRigidActor, + ) -> *mut PxQueryFilterCallback; + + /// Destroy the returned callback object using PxQueryFilterCallback_delete. + pub fn create_raycast_filter_callback_func( + callback: RaycastHitCallback, + userdata: *mut c_void, + ) -> *mut PxQueryFilterCallback; + + /// Destroy the returned callback object using PxQueryFilterCallback_delete. + pub fn create_pre_and_post_raycast_filter_callback_func( + preFilter: RaycastHitCallback, + postFilter: PostFilterCallback, + userdata: *mut c_void, + ) -> *mut PxQueryFilterCallback; + + pub fn create_raycast_buffer() -> *mut PxRaycastCallback; + pub fn create_sweep_buffer() -> *mut PxSweepCallback; + pub fn create_overlap_buffer() -> *mut PxOverlapCallback; + + pub fn create_raycast_callback( + process_touches_callback: RaycastProcessTouchesCallback, + finalize_query_callback: FinalizeQueryCallback, + touches_buffer: *mut PxRaycastHit, + num_touches: u32, + userdata: *mut c_void, + ) -> *mut PxRaycastCallback; + pub fn create_sweep_callback( + process_touches_callback: SweepProcessTouchesCallback, + finalize_query_callback: FinalizeQueryCallback, + touches_buffer: *mut PxSweepHit, + num_touches: u32, + userdata: *mut c_void, + ) -> *mut PxSweepCallback; + pub fn create_overlap_callback( + process_touches_callback: OverlapProcessTouchesCallback, + finalize_query_callback: FinalizeQueryCallback, + touches_buffer: *mut PxOverlapHit, + num_touches: u32, + userdata: *mut c_void, + ) -> *mut PxOverlapCallback; + + pub fn delete_raycast_callback(callback: *mut PxRaycastCallback); + pub fn delete_sweep_callback(callback: *mut PxSweepCallback); + pub fn delete_overlap_callback(callback: *mut PxOverlapCallback); + + pub fn create_alloc_callback( + alloc_callback: AllocCallback, + dealloc_callback: DeallocCallback, + userdata: *mut c_void, + ) -> *mut PxAllocatorCallback; + + pub fn create_profiler_callback( + zone_start_callback: ZoneStartCallback, + zone_end_callback: ZoneEndCallback, + userdata: *mut c_void, + ) -> *mut PxProfilerCallback; + + pub fn get_alloc_callback_user_data(alloc_callback: *mut PxAllocatorCallback) -> *mut c_void; + + pub fn create_error_callback( + error_callback: ErrorCallback, + userdata: *mut c_void, + ) -> *mut PxErrorCallback; + + pub fn create_assert_handler( + error_callback: AssertHandler, + userdata: *mut c_void, + ) -> *mut PxAssertHandler; + + pub fn get_default_simulation_filter_shader() -> *mut c_void; + + /// Create a C++ proxy callback which will forward contact events to `Callback`. + /// The returned pointer must be freed by calling `destroy_contact_callback` when done using. + #[deprecated] + pub fn create_contact_callback( + callback: CollisionCallback, + userdata: *mut c_void, + ) -> *mut PxSimulationEventCallback; + /// Deallocates the PxSimulationEventCallback that has previously been created + #[deprecated()] + pub fn destroy_contact_callback(callback: *mut PxSimulationEventCallback); + + /// New interface to handle simulation events, replacing create_contact_callback. + pub fn create_simulation_event_callbacks( + callbacks: *const SimulationEventCallbackInfo, + ) -> *mut PxSimulationEventCallback; + + pub fn get_simulation_event_info( + callback: *mut PxSimulationEventCallback, + ) -> *mut SimulationEventCallbackInfo; + + pub fn destroy_simulation_event_callbacks(callback: *mut PxSimulationEventCallback); + + /// Override the default filter shader in the scene with a custom function. + /// If call_default_filter_shader_first is set to true, this will first call the + /// built-in PhysX filter (that matches Physx 2.8 behavior) before your callback. + pub fn enable_custom_filter_shader( + scene_desc: *mut PxSceneDesc, + shader: SimulationFilterShader, + call_default_filter_shader_first: u32, + ); + + #[doc(hidden)] + /// Should only be used in testing etc! This isn't generated as we don't generate op functions. + pub fn PxAssertHandler_opCall_mut( + self_: *mut PxAssertHandler, + expr: *const i8, + file: *const i8, + line: i32, + ignore: *mut bool, + ) -> (); +} diff --git a/modules/PhysX/physx/physx-sys/src/physx_api.cpp b/modules/PhysX/physx/physx-sys/src/physx_api.cpp new file mode 100644 index 0000000..168768b --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/physx_api.cpp @@ -0,0 +1,858 @@ +#include "PxPhysicsAPI.h" +#include +#include "physx_generated.hpp" +#include + +#ifdef _WIN32 +#define DLLEXPORT __declspec(dllexport) +#else +#define DLLEXPORT +#endif + +PxDefaultAllocator gAllocator; +PxDefaultErrorCallback gErrorCallback; + +extern "C" { + typedef void (*CollisionCallback)(void *, PxContactPairHeader const *, PxContactPair const *, PxU32); +} + +extern "C" { + typedef PxU16 (*SimulationFilterShader)( + PxFilterObjectAttributes* attributes0, + PxFilterData* filterData0, + PxFilterObjectAttributes* attributes1, + PxFilterData* filterData1, + PxPairFlags* pairFlags); +} + +struct FilterShaderHandle +{ + SimulationFilterShader shader; +}; + + +PxU16 DefaultSimulationFilterShader(PxFilterObjectAttributes* attributes0, + PxFilterData* filterData0, + PxFilterObjectAttributes* attributes1, + PxFilterData* filterData1, + PxPairFlags* pairFlags) +{ + return PxDefaultSimulationFilterShader(*attributes0, *filterData0, *attributes1, *filterData1, *pairFlags, nullptr, 0); +} + +PxFilterFlags FilterShaderTrampoline(PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, + PxU32 constantBlockSize) +{ + // std::cout << "attributes0 " << attributes0 << std::endl; + // std::cout << "filterData0 " << filterData0.word0 << " " << filterData0.word1 << " " << filterData0.word2 << " " << filterData0.word3 << std::endl; + // std::cout << "attributes1 " << attributes1 << std::endl; + // std::cout << "filterData1 " << filterData1.word0 << " " << filterData1.word1 << " " << filterData1.word2 << " " << filterData1.word3 << std::endl; + // std::cout << "pairFlags " << &pairFlags << std::endl; + // std::cout << "constantBlock " << constantBlock << std::endl; + // std::cout << "constantBlockSize " << constantBlockSize << std::endl; + + FilterShaderHandle* handle = static_cast(const_cast(constantBlock)); + + // We return a u16 since PxFilterFlags is a complex type and C++ wants it to be returned on the stack, + // but Rust thinks it's simple due to the codegen and wants to return it in EAX. + return PxFilterFlags{handle->shader(&attributes0, &filterData0, &attributes1, &filterData1, &pairFlags)}; +} + +PxFilterFlags FilterShaderTrampolineWithDefault(PxFilterObjectAttributes attributes0, + PxFilterData filterData0, + PxFilterObjectAttributes attributes1, + PxFilterData filterData1, + PxPairFlags& pairFlags, + const void* constantBlock, + PxU32 constantBlockSize) +{ + // Let the default handler set the pair flags, but ignore the collision filtering + PxDefaultSimulationFilterShader(attributes0, filterData0, attributes1, filterData1, pairFlags, nullptr, 0); + + FilterShaderHandle* handle = static_cast(const_cast(constantBlock)); + + // We return a u16 since PxFilterFlags is a complex type and C++ wants it to be returned on the stack, + // but Rust thinks it's simple due to the codegen and wants to return it in EAX. + // PxU16 value = callback(attributes0, filterData0, attributes1, filterData1, pairFlags, nullptr, 0); + return PxFilterFlags{handle->shader(&attributes0, &filterData0, &attributes1, &filterData1, &pairFlags)}; +} + + +extern "C" { + using CollisionCallback = void (*)(void *, PxContactPairHeader const *, PxContactPair const *, PxU32); + using TriggerCallback = void (*)(void *, PxTriggerPair const *, PxU32); + using ConstraintBreakCallback = void (*)(void *, PxConstraintInfo const *, PxU32); + using WakeSleepCallback = void (*)(void *, PxActor **const, PxU32, bool); + using AdvanceCallback = void (*)(void *, const PxRigidBody *const *, const PxTransform *const, PxU32); +} + +struct SimulationEventCallbackInfo { + // Callback for collision events. + CollisionCallback collisionCallback = nullptr; + void *collisionUserData = nullptr; + // Callback for trigger shape events (an object entered or left a trigger shape). + TriggerCallback triggerCallback = nullptr; + void *triggerUserData = nullptr; + // Callback for when a constraint breaks (such as a joint with a force limit) + ConstraintBreakCallback constraintBreakCallback = nullptr; + void *constraintBreakUserData = nullptr; + // Callback for when an object falls asleep or is awoken. + WakeSleepCallback wakeSleepCallback = nullptr; + void *wakeSleepUserData = nullptr; + // Callback to get the next pose early for objects (if flagged with eENABLE_POSE_INTEGRATION_PREVIEW). + AdvanceCallback advanceCallback = nullptr; + void *advanceUserData = nullptr; +}; + +class SimulationEventTrampoline : public PxSimulationEventCallback +{ + public: + SimulationEventTrampoline(const SimulationEventCallbackInfo *callbacks) : mCallbacks(*callbacks) {} + + // Collisions + void onContact(const PxContactPairHeader &pairHeader, const PxContactPair *pairs, PxU32 nbPairs) override { + if (mCallbacks.collisionCallback) { + mCallbacks.collisionCallback(mCallbacks.collisionUserData, &pairHeader, pairs, nbPairs); + } + } + + // Triggers + void onTrigger(PxTriggerPair *pairs, PxU32 count) override { + if (mCallbacks.triggerCallback) { + mCallbacks.triggerCallback(mCallbacks.triggerUserData, pairs, count); + } + } + + // Constraint breaks + void onConstraintBreak(PxConstraintInfo *constraints, PxU32 count) override { + if (mCallbacks.constraintBreakCallback) { + mCallbacks.constraintBreakCallback(mCallbacks.constraintBreakUserData, constraints, count); + } + } + + // Wake/Sleep (combined for convenience) + void onWake(PxActor **actors, PxU32 count) override { + if (mCallbacks.wakeSleepCallback) { + mCallbacks.wakeSleepCallback(mCallbacks.wakeSleepUserData, actors, count, true); + } + } + void onSleep(PxActor **actors, PxU32 count) override { + if (mCallbacks.wakeSleepCallback) { + mCallbacks.wakeSleepCallback(mCallbacks.wakeSleepUserData, actors, count, false); + } + } + + // Advance + void onAdvance(const PxRigidBody *const * bodyBuffer, const PxTransform *poseBuffer, const PxU32 count) override { + if (mCallbacks.advanceCallback) { + mCallbacks.advanceCallback(mCallbacks.advanceUserData, bodyBuffer, poseBuffer, count); + } + } + + SimulationEventCallbackInfo mCallbacks; +}; + +class RaycastFilterCallback : public PxQueryFilterCallback +{ + public: + explicit RaycastFilterCallback(PxRigidActor *actor) : mActor(actor) {} + + PxRigidActor *mActor; + + virtual PxQueryHitType::Enum preFilter(const PxFilterData &, const PxShape *shape, const PxRigidActor *actor, PxHitFlags &) + { + if (mActor == actor) + { + return PxQueryHitType::eNONE; + } + else + { + return PxQueryHitType::eBLOCK; + } + } + + virtual PxQueryHitType::Enum postFilter(const PxFilterData &, const PxQueryHit &) + { + return PxQueryHitType::eNONE; + } +}; + +extern "C" { + typedef int32_t (*RaycastHitCallback)(const PxRigidActor *actor, const PxFilterData *filterData, const PxShape *shape, uint32_t hitFlags, const void *userData); + typedef int32_t (*PostFilterCallback)(const PxFilterData *filterData, const PxQueryHit* hit, const void *userData); +} + +PxQueryHitType::Enum sanitize_hit_type(int32_t hit_type) { + switch (hit_type) { + case PxQueryHitType::eNONE: + case PxQueryHitType::eTOUCH: + case PxQueryHitType::eBLOCK: return (PxQueryHitType::Enum)hit_type; + default: return PxQueryHitType::eNONE; + } +} + +class RaycastFilterTrampoline : public PxQueryFilterCallback +{ + public: + RaycastFilterTrampoline(RaycastHitCallback callback, const void *userdata) + : mCallback(callback), mUserData(userdata) {} + + RaycastHitCallback mCallback; + const void *mUserData; + + virtual PxQueryHitType::Enum preFilter(const PxFilterData &filterData, const PxShape *shape, const PxRigidActor *actor, PxHitFlags &hitFlags) + { + return sanitize_hit_type(mCallback(actor, &filterData, shape, (uint32_t)hitFlags, mUserData)); + } + + virtual PxQueryHitType::Enum postFilter(const PxFilterData &, const PxQueryHit &) + { + return PxQueryHitType::eNONE; + } +}; + + +class RaycastFilterPrePostTrampoline : public PxQueryFilterCallback +{ + public: + RaycastFilterPrePostTrampoline(RaycastHitCallback preFilter, PostFilterCallback postFilter, const void *userdata) + : mPreFilter(preFilter), mPostFilter(postFilter), mUserData(userdata) {} + + RaycastHitCallback mPreFilter; + PostFilterCallback mPostFilter; + + const void *mUserData; + + virtual PxQueryHitType::Enum preFilter(const PxFilterData &filterData, const PxShape *shape, const PxRigidActor *actor, PxHitFlags &hitFlags) + { + return sanitize_hit_type(mPreFilter(actor, &filterData, shape, (uint32_t)hitFlags, mUserData)); + + } + + virtual PxQueryHitType::Enum postFilter(const PxFilterData &filterData, const PxQueryHit &hit) + { + return sanitize_hit_type(mPostFilter(&filterData, &hit, mUserData)); + } +}; + +extern "C" { + typedef PxAgain (*RaycastHitProcessTouchesCallback)(const PxRaycastHit *buffer, PxU32 nbHits, void *userdata); + typedef PxAgain (*SweepHitProcessTouchesCallback)(const PxSweepHit *buffer, PxU32 nbHits, void *userdata); + typedef PxAgain (*OverlapHitProcessTouchesCallback)(const PxOverlapHit *buffer, PxU32 nbHits, void *userdata); + typedef void (*HitFinalizeQueryCallback)(void *userdata); +} + +class RaycastHitCallbackTrampoline : public PxRaycastCallback +{ + public: + RaycastHitCallbackTrampoline( + RaycastHitProcessTouchesCallback processTouchesCallback, + HitFinalizeQueryCallback finalizeQueryCallback, + PxRaycastHit *touchesBuffer, + PxU32 numTouches, + void *userdata) + : PxRaycastCallback(touchesBuffer, numTouches), + mProcessTouchesCallback(processTouchesCallback), + mFinalizeQueryCallback(finalizeQueryCallback), + mUserData(userdata) {} + + RaycastHitProcessTouchesCallback mProcessTouchesCallback; + HitFinalizeQueryCallback mFinalizeQueryCallback; + void *mUserData; + + PxAgain processTouches(const PxRaycastHit *buffer, PxU32 nbHits) override + { + return mProcessTouchesCallback(buffer, nbHits, mUserData); + } + + void finalizeQuery() override + { + mFinalizeQueryCallback(mUserData); + } +}; + +class SweepHitCallbackTrampoline : public PxSweepCallback +{ + public: + SweepHitCallbackTrampoline( + SweepHitProcessTouchesCallback processTouchesCallback, + HitFinalizeQueryCallback finalizeQueryCallback, + PxSweepHit *touchesBuffer, + PxU32 numTouches, + void *userdata) + : PxSweepCallback(touchesBuffer, numTouches), + mProcessTouchesCallback(processTouchesCallback), + mFinalizeQueryCallback(finalizeQueryCallback), + mUserData(userdata) {} + + SweepHitProcessTouchesCallback mProcessTouchesCallback; + HitFinalizeQueryCallback mFinalizeQueryCallback; + void *mUserData; + + PxAgain processTouches(const PxSweepHit *buffer, PxU32 nbHits) override + { + return mProcessTouchesCallback(buffer, nbHits, mUserData); + } + + void finalizeQuery() override + { + mFinalizeQueryCallback(mUserData); + } +}; + +class OverlapHitCallbackTrampoline : public PxOverlapCallback +{ + public: + OverlapHitCallbackTrampoline( + OverlapHitProcessTouchesCallback processTouchesCallback, + HitFinalizeQueryCallback finalizeQueryCallback, + PxOverlapHit *touchesBuffer, + PxU32 numTouches, + void *userdata) + : PxOverlapCallback(touchesBuffer, numTouches), + mProcessTouchesCallback(processTouchesCallback), + mFinalizeQueryCallback(finalizeQueryCallback), + mUserData(userdata) {} + + OverlapHitProcessTouchesCallback mProcessTouchesCallback; + HitFinalizeQueryCallback mFinalizeQueryCallback; + void *mUserData; + + PxAgain processTouches(const PxOverlapHit *buffer, PxU32 nbHits) override + { + return mProcessTouchesCallback(buffer, nbHits, mUserData); + } + + void finalizeQuery() override + { + mFinalizeQueryCallback(mUserData); + } +}; + +extern "C" { + typedef void * (*AllocCallback)(uint64_t size, const char *typeName, const char *filename, int line, void *userdata); + typedef void (*DeallocCallback)(void *ptr, void *userdata); +} + +class CustomAllocatorTrampoline : public PxAllocatorCallback { +public: + CustomAllocatorTrampoline(AllocCallback allocCb, DeallocCallback deallocCb, void *userdata) + : mAllocCallback(allocCb), mDeallocCallback(deallocCb), mUserData(userdata) {} + + void *allocate(size_t size, const char *typeName, const char *filename, int line) + { + return mAllocCallback((uint64_t)size, typeName, filename, line, mUserData); + } + + virtual void deallocate(void* ptr) + { + mDeallocCallback(ptr, mUserData); + } + +private: + AllocCallback mAllocCallback; + DeallocCallback mDeallocCallback; +public: + void *mUserData; +}; + +extern "C" { + typedef void * (*ZoneStartCallback)(const char *typeName, bool detached, uint64_t context , void *userdata); + typedef void (*ZoneEndCallback)(void* profilerData, const char *typeName, bool detached, uint64_t context , void *userdata); +} + +class CustomProfilerTrampoline : public PxProfilerCallback { +public: + CustomProfilerTrampoline(ZoneStartCallback startCb, ZoneEndCallback endCb, void *userdata) + : mStartCallback(startCb), mEndCallback(endCb), mUserData(userdata) { + } + + virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId) override + { + return mStartCallback(eventName, detached, contextId, mUserData); + } + + virtual void zoneEnd(void* profilerData, const char* eventName, bool detached, uint64_t contextId) override + { + return mEndCallback(profilerData, eventName, detached, contextId, mUserData); + } + +private: + ZoneStartCallback mStartCallback; + ZoneEndCallback mEndCallback; +public: + void *mUserData; +}; + +extern "C" { + using ErrorCallback = void (*)(int code, const char* message, const char* file, int line, void* userdata); +} + +class ErrorTrampoline : public PxErrorCallback { +public: + ErrorTrampoline(ErrorCallback errorCb, void* userdata) + : mErrorCallback(errorCb), mUserdata(userdata) + {} + + void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) override { + mErrorCallback(code, message, file, line, mUserdata); + } + +private: + ErrorCallback mErrorCallback = nullptr; + void* mUserdata = nullptr; +}; + +extern "C" { + using AssertHandler = void (*)(const char* expr, const char* file, int line, bool* should_ignore, void* userdata); +} + +class AssertTrampoline : public PxAssertHandler { +public: + AssertTrampoline(AssertHandler onAssert, void* userdata) + : mAssertHandler(onAssert), mUserdata(userdata) + {} + + virtual void operator()(const char* exp, const char* file, int line, bool& ignore) override final { + mAssertHandler(exp, file, line, &ignore, mUserdata); + } + +private: + AssertHandler mAssertHandler = nullptr; + void* mUserdata = nullptr; +}; + +extern "C" { + using ShapeHitCallback = void (*)(void *, PxControllerShapeHit const *); + using ControllerHitCallback = void (*)(void *, PxControllersHit const *); + using ObstacleHitCallback = void (*)(void *, PxControllerObstacleHit const *); +} + +struct UserControllerHitReportInfo { + ShapeHitCallback shapeHitCallback = nullptr; + void* shapeHitUserData = nullptr; + ControllerHitCallback controllerHitCallback = nullptr; + void* controllerHitUserData = nullptr; + ObstacleHitCallback obstacleHitCallback = nullptr; + void* obstacleHitUserData = nullptr; +}; + +class UserControllerHitReport : public PxUserControllerHitReport { +public: + UserControllerHitReport(const UserControllerHitReportInfo *callbacks) : mCallbacks(*callbacks) {} + + void onShapeHit(const PxControllerShapeHit& hit) override { + if (mCallbacks.shapeHitCallback) { + mCallbacks.shapeHitCallback(mCallbacks.shapeHitUserData, &hit); + } + } + + void onControllerHit(const PxControllersHit& hit) override { + if (mCallbacks.controllerHitCallback) { + mCallbacks.controllerHitCallback(mCallbacks.controllerHitUserData, &hit); + } + } + + void onObstacleHit(const PxControllerObstacleHit& hit) override { + if (mCallbacks.obstacleHitCallback) { + mCallbacks.obstacleHitCallback(mCallbacks.obstacleHitUserData, &hit); + } + } + + UserControllerHitReportInfo mCallbacks; +}; + +extern "C" { + using ShapeBehaviorCallback = PxControllerBehaviorFlags (*)(void* data, const PxShape* shape, const PxActor* actor); + using CharacterBehaviorCallback = PxControllerBehaviorFlags (*)(void* data, const PxController* controller); + using ObstacleBehaviorCallback = PxControllerBehaviorFlags (*)(void* data, const PxObstacle* obstacle); +} + +struct ControllerBehaviorCallbackInfo { + ShapeBehaviorCallback shapeBehaviorCallback = nullptr; + void* shapeBehaviorUserData = nullptr; + CharacterBehaviorCallback controllerBehaviorCallback = nullptr; + void* controllerBehaviorUserData = nullptr; + ObstacleBehaviorCallback obstacleBehaviorCallback = nullptr; + void* obstacleBehaviorUserData = nullptr; +}; + +class ControllerBehaviorCallback : public PxControllerBehaviorCallback { +public: + ControllerBehaviorCallback(const ControllerBehaviorCallbackInfo *callbacks) : mCallbacks(*callbacks) {} + + PxControllerBehaviorFlags getBehaviorFlags(const PxShape& shape, const PxActor& actor) override { + if (mCallbacks.shapeBehaviorCallback) { + return mCallbacks.shapeBehaviorCallback(mCallbacks.shapeBehaviorUserData, &shape, &actor); + } + return static_cast(0); + } + + PxControllerBehaviorFlags getBehaviorFlags(const PxController& controller) override { + if (mCallbacks.controllerBehaviorCallback) { + return mCallbacks.controllerBehaviorCallback(mCallbacks.controllerBehaviorUserData, &controller); + } + return static_cast(0); + } + + PxControllerBehaviorFlags getBehaviorFlags(const PxObstacle& obstacle) override { + if (mCallbacks.obstacleBehaviorCallback) { + return mCallbacks.obstacleBehaviorCallback(mCallbacks.obstacleBehaviorUserData, &obstacle); + } + return PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT; + } + + ControllerBehaviorCallbackInfo mCallbacks; +}; + +extern "C" { + using OnContactModify = void (*)(void* data, const PxContactModifyPair* pairs, PxU32 count); +} + +struct ContactModifyCallbackInfo { + OnContactModify onContactModify = nullptr; + void* onContactModifyUserData = nullptr; +}; + +class ContactModifyCallback : public PxContactModifyCallback { +public: + ContactModifyCallback(const ContactModifyCallbackInfo *callbacks) : mCallbacks(*callbacks) {} + + void onContactModify(PxContactModifyPair* const pairs, PxU32 count) override { + if (mCallbacks.onContactModify) { + mCallbacks.onContactModify(mCallbacks.onContactModifyUserData, pairs, count); + } + } + + ContactModifyCallbackInfo mCallbacks; +}; + +class CCDContactModifyCallback : public PxCCDContactModifyCallback { +public: + CCDContactModifyCallback(const ContactModifyCallbackInfo *callbacks) : mCallbacks(*callbacks) {} + + void onCCDContactModify(PxContactModifyPair* const pairs, PxU32 count) override { + if (mCallbacks.onContactModify) { + mCallbacks.onContactModify(mCallbacks.onContactModifyUserData, pairs, count); + } + } + + ContactModifyCallbackInfo mCallbacks; +}; + +extern "C" +{ + DLLEXPORT PxFoundation *physx_create_foundation() + { + return PxCreateFoundation(PX_PHYSICS_VERSION, gAllocator, gErrorCallback); + } + + DLLEXPORT PxFoundation *physx_create_foundation_with_alloc(PxAllocatorCallback *allocator) + { + return PxCreateFoundation(PX_PHYSICS_VERSION, *allocator, gErrorCallback); + } + + // fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages + // linking against the raw interface + DLLEXPORT PxAllocatorCallback* get_default_allocator() + { + return &gAllocator; + } + + // fixme[tolsson]: this might be iffy on Windows with DLLs if we have multiple packages + // linking against the raw interface + DLLEXPORT PxErrorCallback* get_default_error_callback() + { + return &gErrorCallback; + } + + DLLEXPORT PxPhysics *physx_create_physics(PxFoundation *foundation) + { + return PxCreatePhysics(PX_PHYSICS_VERSION, *foundation, PxTolerancesScale(), true, nullptr, nullptr); + } + + DLLEXPORT PxQueryFilterCallback *create_raycast_filter_callback(PxRigidActor *actor_to_ignore) + { + RaycastFilterCallback* filter = new RaycastFilterCallback(actor_to_ignore); + return static_cast(filter); + } + + DLLEXPORT void destroy_raycast_filter_callback(PxQueryFilterCallback *callback) + { + RaycastFilterCallback *filter = static_cast(callback); + delete filter; + } + + DLLEXPORT PxQueryFilterCallback *create_raycast_filter_callback_func(RaycastHitCallback callback, void *userData) + { + RaycastFilterTrampoline* filter = new RaycastFilterTrampoline(callback, userData); + return static_cast(filter); + } + + DLLEXPORT void destroy_raycast_filter_callback_func(PxQueryFilterCallback *callback) + { + RaycastFilterTrampoline *filter = static_cast(callback); + delete filter; + } + + DLLEXPORT PxQueryFilterCallback *create_pre_and_post_raycast_filter_callback_func(RaycastHitCallback preFilter, PostFilterCallback postFilter, void *userData) + { + RaycastFilterPrePostTrampoline* filter = new RaycastFilterPrePostTrampoline(preFilter, postFilter, userData); + return static_cast(filter); + } + + DLLEXPORT void destroy_pre_and_post_raycast_filter_callback_func(PxQueryFilterCallback *callback) + { + RaycastFilterPrePostTrampoline *filter = static_cast(callback); + delete filter; + } + + DLLEXPORT PxRaycastCallback *create_raycast_buffer() + { + return new PxRaycastBuffer; + } + + DLLEXPORT PxSweepCallback *create_sweep_buffer() + { + return new PxSweepBuffer; + } + + DLLEXPORT PxOverlapCallback *create_overlap_buffer() + { + return new PxOverlapBuffer; + } + + DLLEXPORT PxRaycastCallback *create_raycast_callback( + RaycastHitProcessTouchesCallback process_touches_callback, + HitFinalizeQueryCallback finalize_query_callback, + PxRaycastHit *touchesBuffer, + PxU32 numTouches, + void *userdata + ) { + return new RaycastHitCallbackTrampoline( + process_touches_callback, finalize_query_callback, touchesBuffer, numTouches, userdata); + } + + DLLEXPORT void delete_raycast_callback(PxRaycastCallback *callback) + { + delete callback; + } + + DLLEXPORT void delete_sweep_callback(PxSweepCallback *callback) + { + delete callback; + } + + DLLEXPORT void delete_overlap_callback(PxOverlapCallback *callback) + { + delete callback; + } + + DLLEXPORT PxSweepCallback *create_sweep_callback( + SweepHitProcessTouchesCallback process_touches_callback, + HitFinalizeQueryCallback finalize_query_callback, + PxSweepHit *touchesBuffer, + PxU32 numTouches, + void *userdata + ) { + return new SweepHitCallbackTrampoline( + process_touches_callback, finalize_query_callback, touchesBuffer, numTouches, userdata + ); + } + + DLLEXPORT PxOverlapCallback *create_overlap_callback( + OverlapHitProcessTouchesCallback process_touches_callback, + HitFinalizeQueryCallback finalize_query_callback, + PxOverlapHit *touchesBuffer, + PxU32 numTouches, + void *userdata + ) { + return new OverlapHitCallbackTrampoline( + process_touches_callback, finalize_query_callback, touchesBuffer, numTouches, userdata + ); + } + + DLLEXPORT PxAllocatorCallback *create_alloc_callback( + AllocCallback alloc_callback, + DeallocCallback dealloc_callback, + void *userdata + ) { + return new CustomAllocatorTrampoline(alloc_callback, dealloc_callback, userdata); + } + + DLLEXPORT void *get_alloc_callback_user_data(PxAllocatorCallback *allocator) { + CustomAllocatorTrampoline *trampoline = static_cast(allocator); + return trampoline->mUserData; + } + + DLLEXPORT PxProfilerCallback *create_profiler_callback( + ZoneStartCallback zone_start_callback, + ZoneEndCallback zone_end_callback, + void *userdata + ) { + return new CustomProfilerTrampoline(zone_start_callback, zone_end_callback, userdata); + } + + DLLEXPORT PxErrorCallback *create_error_callback( + ErrorCallback error_callback, + void* userdata + ) { + return new ErrorTrampoline(error_callback, userdata); + } + + + DLLEXPORT PxAssertHandler *create_assert_handler( + AssertHandler on_assert, + void* userdata + ) { + return new AssertTrampoline(on_assert, userdata); + } + + // simulation event + + DLLEXPORT PxSimulationEventCallback *create_simulation_event_callbacks(const SimulationEventCallbackInfo *callbacks) + { + SimulationEventTrampoline *trampoline = new SimulationEventTrampoline(callbacks); + return static_cast(trampoline); + } + + DLLEXPORT SimulationEventCallbackInfo *get_simulation_event_info(PxSimulationEventCallback *callback) + { + SimulationEventTrampoline *trampoline = static_cast(callback); + return &trampoline->mCallbacks; + } + + DLLEXPORT void destroy_simulation_event_callbacks(PxSimulationEventCallback *callback) + { + SimulationEventTrampoline *trampoline = static_cast(callback); + delete trampoline; + } + + // hit report + + DLLEXPORT PxUserControllerHitReport *create_user_controller_hit_report(const UserControllerHitReportInfo *callbacks) + { + UserControllerHitReport *report = new UserControllerHitReport(callbacks); + return static_cast(report); + } + + DLLEXPORT UserControllerHitReportInfo *get_user_controller_hit_info(PxUserControllerHitReport *callback) + { + UserControllerHitReport *report = static_cast(callback); + return &report->mCallbacks; + } + + DLLEXPORT void destroy_user_controller_hit_report(PxUserControllerHitReport *callback) + { + UserControllerHitReport *report = static_cast(callback); + delete report; + } + + // controller behavior + + DLLEXPORT PxControllerBehaviorCallback *create_controller_behavior_callbacks(const ControllerBehaviorCallbackInfo *callbacks) + { + ControllerBehaviorCallback *behavior = new ControllerBehaviorCallback(callbacks); + return static_cast(behavior); + } + + DLLEXPORT ControllerBehaviorCallbackInfo *get_controller_behavior_info(PxControllerBehaviorCallback *callback) + { + ControllerBehaviorCallback *behavior = static_cast(callback); + return &behavior->mCallbacks; + } + + DLLEXPORT void destroy_controller_behavior_callbacks(PxControllerBehaviorCallback *callback) + { + ControllerBehaviorCallback *behavior = static_cast(callback); + delete behavior; + } + + // contact modify + + DLLEXPORT PxContactModifyCallback *create_contact_modify_callbacks(const ContactModifyCallbackInfo *callbacks) + { + ContactModifyCallback *modify = new ContactModifyCallback(callbacks); + return static_cast(modify); + } + + DLLEXPORT ContactModifyCallbackInfo *get_contact_modify_info(PxContactModifyCallback *callback) + { + ContactModifyCallback *modify = static_cast(callback); + return &modify->mCallbacks; + } + + DLLEXPORT void destroy_contact_modify_callbacks(PxContactModifyCallback *callback) + { + ContactModifyCallback *modify = static_cast(callback); + delete modify; + } + + // ccd contact modify + + DLLEXPORT PxCCDContactModifyCallback *create_ccd_contact_modify_callbacks(const ContactModifyCallbackInfo *callbacks) + { + CCDContactModifyCallback *modify = new CCDContactModifyCallback(callbacks); + return static_cast(modify); + } + + DLLEXPORT ContactModifyCallbackInfo *get_ccd_contact_modify_info(PxCCDContactModifyCallback *callback) + { + CCDContactModifyCallback *modify = static_cast(callback); + return &modify->mCallbacks; + } + + DLLEXPORT void destroy_ccd_contact_modify_callbacks(PxCCDContactModifyCallback *callback) + { + CCDContactModifyCallback *modify = static_cast(callback); + delete modify; + } + + // filter shader + + DLLEXPORT SimulationFilterShader get_default_simulation_filter_shader() + { + return DefaultSimulationFilterShader; + } + + DLLEXPORT void set_default_filter_shader(PxSceneDesc* desc) + { + desc->filterShader = PxDefaultSimulationFilterShader; + desc->filterShaderData = nullptr; + desc->filterShaderDataSize = 0; + } + + DLLEXPORT FilterShaderHandle* create_custom_filter_shader(SimulationFilterShader filter) + { + return new FilterShaderHandle{filter}; + } + + DLLEXPORT void destroy_custom_filter_shader(FilterShaderHandle* filterHandle) { + delete filterHandle; + } + + DLLEXPORT void set_custom_filter_shader(PxSceneDesc* desc, FilterShaderHandle* filterHandle) + { + desc->filterShader = FilterShaderTrampoline; + desc->filterShaderData = filterHandle; + desc->filterShaderDataSize = sizeof(FilterShaderHandle); + } + + DLLEXPORT void set_custom_filter_shader_with_default(PxSceneDesc* desc, FilterShaderHandle* filterHandle) + { + desc->filterShader = FilterShaderTrampolineWithDefault; + desc->filterShaderData = filterHandle; + desc->filterShaderDataSize = sizeof(FilterShaderHandle); + } + + // Not generated, used only for testing and examples! + DLLEXPORT void PxAssertHandler_opCall_mut(physx_PxErrorCallback* self__pod, char const* expr, char const* file, int32_t line, bool* ignore ) { + physx::PxAssertHandler* self_ = reinterpret_cast(self__pod); + (*self_)(expr, file, line, *ignore); + }; +} diff --git a/modules/PhysX/physx/physx-sys/src/physx_generated.hpp b/modules/PhysX/physx/physx-sys/src/physx_generated.hpp new file mode 100644 index 0000000..b8e1754 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/physx_generated.hpp @@ -0,0 +1,13022 @@ +using namespace physx; +#include "structgen_out.hpp" + +static_assert(sizeof(physx::PxAllocatorCallback) == sizeof(physx_PxAllocatorCallback), "POD wrapper for `physx::PxAllocatorCallback` has incorrect size"); +static_assert(sizeof(physx::PxAssertHandler) == sizeof(physx_PxAssertHandler), "POD wrapper for `physx::PxAssertHandler` has incorrect size"); +static_assert(sizeof(physx::PxFoundation) == sizeof(physx_PxFoundation), "POD wrapper for `physx::PxFoundation` has incorrect size"); +static_assert(sizeof(physx::PxAllocator) == sizeof(physx_PxAllocator), "POD wrapper for `physx::PxAllocator` has incorrect size"); +static_assert(sizeof(physx::PxRawAllocator) == sizeof(physx_PxRawAllocator), "POD wrapper for `physx::PxRawAllocator` has incorrect size"); +static_assert(sizeof(physx::PxVirtualAllocatorCallback) == sizeof(physx_PxVirtualAllocatorCallback), "POD wrapper for `physx::PxVirtualAllocatorCallback` has incorrect size"); +static_assert(sizeof(physx::PxVirtualAllocator) == sizeof(physx_PxVirtualAllocator), "POD wrapper for `physx::PxVirtualAllocator` has incorrect size"); +static_assert(sizeof(physx::PxUserAllocated) == sizeof(physx_PxUserAllocated), "POD wrapper for `physx::PxUserAllocated` has incorrect size"); +static_assert(sizeof(physx::PxTempAllocatorChunk) == sizeof(physx_PxTempAllocatorChunk), "POD wrapper for `physx::PxTempAllocatorChunk` has incorrect size"); +static_assert(sizeof(physx::PxTempAllocator) == sizeof(physx_PxTempAllocator), "POD wrapper for `physx::PxTempAllocator` has incorrect size"); +static_assert(sizeof(physx::PxBitAndByte) == sizeof(physx_PxBitAndByte), "POD wrapper for `physx::PxBitAndByte` has incorrect size"); +static_assert(sizeof(physx::PxBitMap) == sizeof(physx_PxBitMap), "POD wrapper for `physx::PxBitMap` has incorrect size"); +static_assert(sizeof(physx::PxVec3) == sizeof(physx_PxVec3), "POD wrapper for `physx::PxVec3` has incorrect size"); +static_assert(sizeof(physx::PxVec3Padded) == sizeof(physx_PxVec3Padded), "POD wrapper for `physx::PxVec3Padded` has incorrect size"); +static_assert(sizeof(physx::PxQuat) == sizeof(physx_PxQuat), "POD wrapper for `physx::PxQuat` has incorrect size"); +static_assert(sizeof(physx::PxTransform) == sizeof(physx_PxTransform), "POD wrapper for `physx::PxTransform` has incorrect size"); +static_assert(sizeof(physx::PxTransformPadded) == sizeof(physx_PxTransformPadded), "POD wrapper for `physx::PxTransformPadded` has incorrect size"); +static_assert(sizeof(physx::PxMat33) == sizeof(physx_PxMat33), "POD wrapper for `physx::PxMat33` has incorrect size"); +static_assert(sizeof(physx::PxBounds3) == sizeof(physx_PxBounds3), "POD wrapper for `physx::PxBounds3` has incorrect size"); +static_assert(sizeof(physx::PxErrorCallback) == sizeof(physx_PxErrorCallback), "POD wrapper for `physx::PxErrorCallback` has incorrect size"); +static_assert(sizeof(physx::PxAllocationListener) == sizeof(physx_PxAllocationListener), "POD wrapper for `physx::PxAllocationListener` has incorrect size"); +static_assert(sizeof(physx::PxBroadcastingAllocator) == sizeof(physx_PxBroadcastingAllocator), "POD wrapper for `physx::PxBroadcastingAllocator` has incorrect size"); +static_assert(sizeof(physx::PxBroadcastingErrorCallback) == sizeof(physx_PxBroadcastingErrorCallback), "POD wrapper for `physx::PxBroadcastingErrorCallback` has incorrect size"); +static_assert(sizeof(physx::PxInputStream) == sizeof(physx_PxInputStream), "POD wrapper for `physx::PxInputStream` has incorrect size"); +static_assert(sizeof(physx::PxInputData) == sizeof(physx_PxInputData), "POD wrapper for `physx::PxInputData` has incorrect size"); +static_assert(sizeof(physx::PxOutputStream) == sizeof(physx_PxOutputStream), "POD wrapper for `physx::PxOutputStream` has incorrect size"); +static_assert(sizeof(physx::PxVec4) == sizeof(physx_PxVec4), "POD wrapper for `physx::PxVec4` has incorrect size"); +static_assert(sizeof(physx::PxMat44) == sizeof(physx_PxMat44), "POD wrapper for `physx::PxMat44` has incorrect size"); +static_assert(sizeof(physx::PxPlane) == sizeof(physx_PxPlane), "POD wrapper for `physx::PxPlane` has incorrect size"); +static_assert(sizeof(physx::Interpolation) == sizeof(physx_Interpolation), "POD wrapper for `physx::Interpolation` has incorrect size"); +static_assert(sizeof(physx::PxMutexImpl) == sizeof(physx_PxMutexImpl), "POD wrapper for `physx::PxMutexImpl` has incorrect size"); +static_assert(sizeof(physx::PxReadWriteLock) == sizeof(physx_PxReadWriteLock), "POD wrapper for `physx::PxReadWriteLock` has incorrect size"); +static_assert(sizeof(physx::PxProfilerCallback) == sizeof(physx_PxProfilerCallback), "POD wrapper for `physx::PxProfilerCallback` has incorrect size"); +static_assert(sizeof(physx::PxProfileScoped) == sizeof(physx_PxProfileScoped), "POD wrapper for `physx::PxProfileScoped` has incorrect size"); +static_assert(sizeof(physx::PxSListEntry) == sizeof(physx_PxSListEntry), "POD wrapper for `physx::PxSListEntry` has incorrect size"); +static_assert(sizeof(physx::PxSListImpl) == sizeof(physx_PxSListImpl), "POD wrapper for `physx::PxSListImpl` has incorrect size"); +static_assert(sizeof(physx::PxSyncImpl) == sizeof(physx_PxSyncImpl), "POD wrapper for `physx::PxSyncImpl` has incorrect size"); +static_assert(sizeof(physx::PxRunnable) == sizeof(physx_PxRunnable), "POD wrapper for `physx::PxRunnable` has incorrect size"); +static_assert(sizeof(physx::PxCounterFrequencyToTensOfNanos) == sizeof(physx_PxCounterFrequencyToTensOfNanos), "POD wrapper for `physx::PxCounterFrequencyToTensOfNanos` has incorrect size"); +static_assert(sizeof(physx::PxTime) == sizeof(physx_PxTime), "POD wrapper for `physx::PxTime` has incorrect size"); +static_assert(sizeof(physx::PxVec2) == sizeof(physx_PxVec2), "POD wrapper for `physx::PxVec2` has incorrect size"); +static_assert(sizeof(physx::PxStridedData) == sizeof(physx_PxStridedData), "POD wrapper for `physx::PxStridedData` has incorrect size"); +static_assert(sizeof(physx::PxBoundedData) == sizeof(physx_PxBoundedData), "POD wrapper for `physx::PxBoundedData` has incorrect size"); +static_assert(sizeof(physx::PxDebugPoint) == sizeof(physx_PxDebugPoint), "POD wrapper for `physx::PxDebugPoint` has incorrect size"); +static_assert(sizeof(physx::PxDebugLine) == sizeof(physx_PxDebugLine), "POD wrapper for `physx::PxDebugLine` has incorrect size"); +static_assert(sizeof(physx::PxDebugTriangle) == sizeof(physx_PxDebugTriangle), "POD wrapper for `physx::PxDebugTriangle` has incorrect size"); +static_assert(sizeof(physx::PxDebugText) == sizeof(physx_PxDebugText), "POD wrapper for `physx::PxDebugText` has incorrect size"); +static_assert(sizeof(physx::PxRenderBuffer) == sizeof(physx_PxRenderBuffer), "POD wrapper for `physx::PxRenderBuffer` has incorrect size"); +static_assert(sizeof(physx::PxProcessPxBaseCallback) == sizeof(physx_PxProcessPxBaseCallback), "POD wrapper for `physx::PxProcessPxBaseCallback` has incorrect size"); +static_assert(sizeof(physx::PxSerializationContext) == sizeof(physx_PxSerializationContext), "POD wrapper for `physx::PxSerializationContext` has incorrect size"); +static_assert(sizeof(physx::PxDeserializationContext) == sizeof(physx_PxDeserializationContext), "POD wrapper for `physx::PxDeserializationContext` has incorrect size"); +static_assert(sizeof(physx::PxSerializationRegistry) == sizeof(physx_PxSerializationRegistry), "POD wrapper for `physx::PxSerializationRegistry` has incorrect size"); +static_assert(sizeof(physx::PxCollection) == sizeof(physx_PxCollection), "POD wrapper for `physx::PxCollection` has incorrect size"); +static_assert(sizeof(physx::PxBase) == sizeof(physx_PxBase), "POD wrapper for `physx::PxBase` has incorrect size"); +static_assert(sizeof(physx::PxRefCounted) == sizeof(physx_PxRefCounted), "POD wrapper for `physx::PxRefCounted` has incorrect size"); +static_assert(sizeof(physx::PxTolerancesScale) == sizeof(physx_PxTolerancesScale), "POD wrapper for `physx::PxTolerancesScale` has incorrect size"); +static_assert(sizeof(physx::PxStringTable) == sizeof(physx_PxStringTable), "POD wrapper for `physx::PxStringTable` has incorrect size"); +static_assert(sizeof(physx::PxSerializer) == sizeof(physx_PxSerializer), "POD wrapper for `physx::PxSerializer` has incorrect size"); +static_assert(sizeof(physx::PxMetaDataEntry) == sizeof(physx_PxMetaDataEntry), "POD wrapper for `physx::PxMetaDataEntry` has incorrect size"); +static_assert(sizeof(physx::PxInsertionCallback) == sizeof(physx_PxInsertionCallback), "POD wrapper for `physx::PxInsertionCallback` has incorrect size"); +static_assert(sizeof(physx::PxTaskManager) == sizeof(physx_PxTaskManager), "POD wrapper for `physx::PxTaskManager` has incorrect size"); +static_assert(sizeof(physx::PxCpuDispatcher) == sizeof(physx_PxCpuDispatcher), "POD wrapper for `physx::PxCpuDispatcher` has incorrect size"); +static_assert(sizeof(physx::PxBaseTask) == sizeof(physx_PxBaseTask), "POD wrapper for `physx::PxBaseTask` has incorrect size"); +static_assert(sizeof(physx::PxTask) == sizeof(physx_PxTask), "POD wrapper for `physx::PxTask` has incorrect size"); +static_assert(sizeof(physx::PxLightCpuTask) == sizeof(physx_PxLightCpuTask), "POD wrapper for `physx::PxLightCpuTask` has incorrect size"); +static_assert(sizeof(physx::PxGeometry) == sizeof(physx_PxGeometry), "POD wrapper for `physx::PxGeometry` has incorrect size"); +static_assert(sizeof(physx::PxBoxGeometry) == sizeof(physx_PxBoxGeometry), "POD wrapper for `physx::PxBoxGeometry` has incorrect size"); +static_assert(sizeof(physx::PxBVHRaycastCallback) == sizeof(physx_PxBVHRaycastCallback), "POD wrapper for `physx::PxBVHRaycastCallback` has incorrect size"); +static_assert(sizeof(physx::PxBVHOverlapCallback) == sizeof(physx_PxBVHOverlapCallback), "POD wrapper for `physx::PxBVHOverlapCallback` has incorrect size"); +static_assert(sizeof(physx::PxBVHTraversalCallback) == sizeof(physx_PxBVHTraversalCallback), "POD wrapper for `physx::PxBVHTraversalCallback` has incorrect size"); +static_assert(sizeof(physx::PxBVH) == sizeof(physx_PxBVH), "POD wrapper for `physx::PxBVH` has incorrect size"); +static_assert(sizeof(physx::PxCapsuleGeometry) == sizeof(physx_PxCapsuleGeometry), "POD wrapper for `physx::PxCapsuleGeometry` has incorrect size"); +static_assert(sizeof(physx::PxHullPolygon) == sizeof(physx_PxHullPolygon), "POD wrapper for `physx::PxHullPolygon` has incorrect size"); +static_assert(sizeof(physx::PxConvexMesh) == sizeof(physx_PxConvexMesh), "POD wrapper for `physx::PxConvexMesh` has incorrect size"); +static_assert(sizeof(physx::PxMeshScale) == sizeof(physx_PxMeshScale), "POD wrapper for `physx::PxMeshScale` has incorrect size"); +static_assert(sizeof(physx::PxConvexMeshGeometry) == sizeof(physx_PxConvexMeshGeometry), "POD wrapper for `physx::PxConvexMeshGeometry` has incorrect size"); +static_assert(sizeof(physx::PxSphereGeometry) == sizeof(physx_PxSphereGeometry), "POD wrapper for `physx::PxSphereGeometry` has incorrect size"); +static_assert(sizeof(physx::PxPlaneGeometry) == sizeof(physx_PxPlaneGeometry), "POD wrapper for `physx::PxPlaneGeometry` has incorrect size"); +static_assert(sizeof(physx::PxTriangleMeshGeometry) == sizeof(physx_PxTriangleMeshGeometry), "POD wrapper for `physx::PxTriangleMeshGeometry` has incorrect size"); +static_assert(sizeof(physx::PxHeightFieldGeometry) == sizeof(physx_PxHeightFieldGeometry), "POD wrapper for `physx::PxHeightFieldGeometry` has incorrect size"); +static_assert(sizeof(physx::PxParticleSystemGeometry) == sizeof(physx_PxParticleSystemGeometry), "POD wrapper for `physx::PxParticleSystemGeometry` has incorrect size"); +static_assert(sizeof(physx::PxHairSystemGeometry) == sizeof(physx_PxHairSystemGeometry), "POD wrapper for `physx::PxHairSystemGeometry` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedronMeshGeometry) == sizeof(physx_PxTetrahedronMeshGeometry), "POD wrapper for `physx::PxTetrahedronMeshGeometry` has incorrect size"); +static_assert(sizeof(physx::PxQueryHit) == sizeof(physx_PxQueryHit), "POD wrapper for `physx::PxQueryHit` has incorrect size"); +static_assert(sizeof(physx::PxLocationHit) == sizeof(physx_PxLocationHit), "POD wrapper for `physx::PxLocationHit` has incorrect size"); +static_assert(sizeof(physx::PxGeomRaycastHit) == sizeof(physx_PxGeomRaycastHit), "POD wrapper for `physx::PxGeomRaycastHit` has incorrect size"); +static_assert(sizeof(physx::PxGeomOverlapHit) == sizeof(physx_PxGeomOverlapHit), "POD wrapper for `physx::PxGeomOverlapHit` has incorrect size"); +static_assert(sizeof(physx::PxGeomSweepHit) == sizeof(physx_PxGeomSweepHit), "POD wrapper for `physx::PxGeomSweepHit` has incorrect size"); +static_assert(sizeof(physx::PxGeomIndexPair) == sizeof(physx_PxGeomIndexPair), "POD wrapper for `physx::PxGeomIndexPair` has incorrect size"); +static_assert(sizeof(physx::PxQueryThreadContext) == sizeof(physx_PxQueryThreadContext), "POD wrapper for `physx::PxQueryThreadContext` has incorrect size"); +static_assert(sizeof(physx::PxCustomGeometryType) == sizeof(physx_PxCustomGeometryType), "POD wrapper for `physx::PxCustomGeometryType` has incorrect size"); +static_assert(sizeof(physx::PxCustomGeometryCallbacks) == sizeof(physx_PxCustomGeometryCallbacks), "POD wrapper for `physx::PxCustomGeometryCallbacks` has incorrect size"); +static_assert(sizeof(physx::PxCustomGeometry) == sizeof(physx_PxCustomGeometry), "POD wrapper for `physx::PxCustomGeometry` has incorrect size"); +static_assert(sizeof(physx::PxGeometryHolder) == sizeof(physx_PxGeometryHolder), "POD wrapper for `physx::PxGeometryHolder` has incorrect size"); +static_assert(sizeof(physx::PxGeometryQuery) == sizeof(physx_PxGeometryQuery), "POD wrapper for `physx::PxGeometryQuery` has incorrect size"); +static_assert(sizeof(physx::PxHeightFieldSample) == sizeof(physx_PxHeightFieldSample), "POD wrapper for `physx::PxHeightFieldSample` has incorrect size"); +static_assert(sizeof(physx::PxHeightField) == sizeof(physx_PxHeightField), "POD wrapper for `physx::PxHeightField` has incorrect size"); +static_assert(sizeof(physx::PxHeightFieldDesc) == sizeof(physx_PxHeightFieldDesc), "POD wrapper for `physx::PxHeightFieldDesc` has incorrect size"); +static_assert(sizeof(physx::PxMeshQuery) == sizeof(physx_PxMeshQuery), "POD wrapper for `physx::PxMeshQuery` has incorrect size"); +static_assert(sizeof(physx::PxSimpleTriangleMesh) == sizeof(physx_PxSimpleTriangleMesh), "POD wrapper for `physx::PxSimpleTriangleMesh` has incorrect size"); +static_assert(sizeof(physx::PxTriangle) == sizeof(physx_PxTriangle), "POD wrapper for `physx::PxTriangle` has incorrect size"); +static_assert(sizeof(physx::PxTrianglePadded) == sizeof(physx_PxTrianglePadded), "POD wrapper for `physx::PxTrianglePadded` has incorrect size"); +static_assert(sizeof(physx::PxTriangleMesh) == sizeof(physx_PxTriangleMesh), "POD wrapper for `physx::PxTriangleMesh` has incorrect size"); +static_assert(sizeof(physx::PxBVH34TriangleMesh) == sizeof(physx_PxBVH34TriangleMesh), "POD wrapper for `physx::PxBVH34TriangleMesh` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedron) == sizeof(physx_PxTetrahedron), "POD wrapper for `physx::PxTetrahedron` has incorrect size"); +static_assert(sizeof(physx::PxSoftBodyAuxData) == sizeof(physx_PxSoftBodyAuxData), "POD wrapper for `physx::PxSoftBodyAuxData` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedronMesh) == sizeof(physx_PxTetrahedronMesh), "POD wrapper for `physx::PxTetrahedronMesh` has incorrect size"); +static_assert(sizeof(physx::PxSoftBodyMesh) == sizeof(physx_PxSoftBodyMesh), "POD wrapper for `physx::PxSoftBodyMesh` has incorrect size"); +static_assert(sizeof(physx::PxCollisionMeshMappingData) == sizeof(physx_PxCollisionMeshMappingData), "POD wrapper for `physx::PxCollisionMeshMappingData` has incorrect size"); +static_assert(sizeof(physx::PxSoftBodyCollisionData) == sizeof(physx_PxSoftBodyCollisionData), "POD wrapper for `physx::PxSoftBodyCollisionData` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedronMeshData) == sizeof(physx_PxTetrahedronMeshData), "POD wrapper for `physx::PxTetrahedronMeshData` has incorrect size"); +static_assert(sizeof(physx::PxSoftBodySimulationData) == sizeof(physx_PxSoftBodySimulationData), "POD wrapper for `physx::PxSoftBodySimulationData` has incorrect size"); +static_assert(sizeof(physx::PxCollisionTetrahedronMeshData) == sizeof(physx_PxCollisionTetrahedronMeshData), "POD wrapper for `physx::PxCollisionTetrahedronMeshData` has incorrect size"); +static_assert(sizeof(physx::PxSimulationTetrahedronMeshData) == sizeof(physx_PxSimulationTetrahedronMeshData), "POD wrapper for `physx::PxSimulationTetrahedronMeshData` has incorrect size"); +static_assert(sizeof(physx::PxActor) == sizeof(physx_PxActor), "POD wrapper for `physx::PxActor` has incorrect size"); +static_assert(sizeof(physx::PxAggregate) == sizeof(physx_PxAggregate), "POD wrapper for `physx::PxAggregate` has incorrect size"); +static_assert(sizeof(physx::PxSpringModifiers) == sizeof(physx_PxSpringModifiers), "POD wrapper for `physx::PxSpringModifiers` has incorrect size"); +static_assert(sizeof(physx::PxRestitutionModifiers) == sizeof(physx_PxRestitutionModifiers), "POD wrapper for `physx::PxRestitutionModifiers` has incorrect size"); +static_assert(sizeof(physx::Px1DConstraintMods) == sizeof(physx_Px1DConstraintMods), "POD wrapper for `physx::Px1DConstraintMods` has incorrect size"); +static_assert(sizeof(physx::Px1DConstraint) == sizeof(physx_Px1DConstraint), "POD wrapper for `physx::Px1DConstraint` has incorrect size"); +static_assert(sizeof(physx::PxConstraintInvMassScale) == sizeof(physx_PxConstraintInvMassScale), "POD wrapper for `physx::PxConstraintInvMassScale` has incorrect size"); +static_assert(sizeof(physx::PxConstraintVisualizer) == sizeof(physx_PxConstraintVisualizer), "POD wrapper for `physx::PxConstraintVisualizer` has incorrect size"); +static_assert(sizeof(physx::PxConstraintConnector) == sizeof(physx_PxConstraintConnector), "POD wrapper for `physx::PxConstraintConnector` has incorrect size"); +static_assert(sizeof(physx::PxContactPoint) == sizeof(physx_PxContactPoint), "POD wrapper for `physx::PxContactPoint` has incorrect size"); +static_assert(sizeof(physx::PxSolverBody) == sizeof(physx_PxSolverBody), "POD wrapper for `physx::PxSolverBody` has incorrect size"); +static_assert(sizeof(physx::PxSolverBodyData) == sizeof(physx_PxSolverBodyData), "POD wrapper for `physx::PxSolverBodyData` has incorrect size"); +static_assert(sizeof(physx::PxConstraintBatchHeader) == sizeof(physx_PxConstraintBatchHeader), "POD wrapper for `physx::PxConstraintBatchHeader` has incorrect size"); +static_assert(sizeof(physx::PxSolverConstraintDesc) == sizeof(physx_PxSolverConstraintDesc), "POD wrapper for `physx::PxSolverConstraintDesc` has incorrect size"); +static_assert(sizeof(physx::PxSolverConstraintPrepDescBase) == sizeof(physx_PxSolverConstraintPrepDescBase), "POD wrapper for `physx::PxSolverConstraintPrepDescBase` has incorrect size"); +static_assert(sizeof(physx::PxSolverConstraintPrepDesc) == sizeof(physx_PxSolverConstraintPrepDesc), "POD wrapper for `physx::PxSolverConstraintPrepDesc` has incorrect size"); +static_assert(sizeof(physx::PxSolverContactDesc) == sizeof(physx_PxSolverContactDesc), "POD wrapper for `physx::PxSolverContactDesc` has incorrect size"); +static_assert(sizeof(physx::PxConstraintAllocator) == sizeof(physx_PxConstraintAllocator), "POD wrapper for `physx::PxConstraintAllocator` has incorrect size"); +static_assert(sizeof(physx::PxArticulationLimit) == sizeof(physx_PxArticulationLimit), "POD wrapper for `physx::PxArticulationLimit` has incorrect size"); +static_assert(sizeof(physx::PxArticulationDrive) == sizeof(physx_PxArticulationDrive), "POD wrapper for `physx::PxArticulationDrive` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverBodyVel) == sizeof(physx_PxTGSSolverBodyVel), "POD wrapper for `physx::PxTGSSolverBodyVel` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverBodyTxInertia) == sizeof(physx_PxTGSSolverBodyTxInertia), "POD wrapper for `physx::PxTGSSolverBodyTxInertia` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverBodyData) == sizeof(physx_PxTGSSolverBodyData), "POD wrapper for `physx::PxTGSSolverBodyData` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverConstraintPrepDescBase) == sizeof(physx_PxTGSSolverConstraintPrepDescBase), "POD wrapper for `physx::PxTGSSolverConstraintPrepDescBase` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverConstraintPrepDesc) == sizeof(physx_PxTGSSolverConstraintPrepDesc), "POD wrapper for `physx::PxTGSSolverConstraintPrepDesc` has incorrect size"); +static_assert(sizeof(physx::PxTGSSolverContactDesc) == sizeof(physx_PxTGSSolverContactDesc), "POD wrapper for `physx::PxTGSSolverContactDesc` has incorrect size"); +static_assert(sizeof(physx::PxArticulationTendonLimit) == sizeof(physx_PxArticulationTendonLimit), "POD wrapper for `physx::PxArticulationTendonLimit` has incorrect size"); +static_assert(sizeof(physx::PxArticulationAttachment) == sizeof(physx_PxArticulationAttachment), "POD wrapper for `physx::PxArticulationAttachment` has incorrect size"); +static_assert(sizeof(physx::PxArticulationTendonJoint) == sizeof(physx_PxArticulationTendonJoint), "POD wrapper for `physx::PxArticulationTendonJoint` has incorrect size"); +static_assert(sizeof(physx::PxArticulationTendon) == sizeof(physx_PxArticulationTendon), "POD wrapper for `physx::PxArticulationTendon` has incorrect size"); +static_assert(sizeof(physx::PxArticulationSpatialTendon) == sizeof(physx_PxArticulationSpatialTendon), "POD wrapper for `physx::PxArticulationSpatialTendon` has incorrect size"); +static_assert(sizeof(physx::PxArticulationFixedTendon) == sizeof(physx_PxArticulationFixedTendon), "POD wrapper for `physx::PxArticulationFixedTendon` has incorrect size"); +static_assert(sizeof(physx::PxSpatialForce) == sizeof(physx_PxSpatialForce), "POD wrapper for `physx::PxSpatialForce` has incorrect size"); +static_assert(sizeof(physx::PxSpatialVelocity) == sizeof(physx_PxSpatialVelocity), "POD wrapper for `physx::PxSpatialVelocity` has incorrect size"); +static_assert(sizeof(physx::PxArticulationRootLinkData) == sizeof(physx_PxArticulationRootLinkData), "POD wrapper for `physx::PxArticulationRootLinkData` has incorrect size"); +static_assert(sizeof(physx::PxArticulationCache) == sizeof(physx_PxArticulationCache), "POD wrapper for `physx::PxArticulationCache` has incorrect size"); +static_assert(sizeof(physx::PxArticulationSensor) == sizeof(physx_PxArticulationSensor), "POD wrapper for `physx::PxArticulationSensor` has incorrect size"); +static_assert(sizeof(physx::PxArticulationReducedCoordinate) == sizeof(physx_PxArticulationReducedCoordinate), "POD wrapper for `physx::PxArticulationReducedCoordinate` has incorrect size"); +static_assert(sizeof(physx::PxArticulationJointReducedCoordinate) == sizeof(physx_PxArticulationJointReducedCoordinate), "POD wrapper for `physx::PxArticulationJointReducedCoordinate` has incorrect size"); +static_assert(sizeof(physx::PxShape) == sizeof(physx_PxShape), "POD wrapper for `physx::PxShape` has incorrect size"); +static_assert(sizeof(physx::PxRigidActor) == sizeof(physx_PxRigidActor), "POD wrapper for `physx::PxRigidActor` has incorrect size"); +static_assert(sizeof(physx::PxNodeIndex) == sizeof(physx_PxNodeIndex), "POD wrapper for `physx::PxNodeIndex` has incorrect size"); +static_assert(sizeof(physx::PxRigidBody) == sizeof(physx_PxRigidBody), "POD wrapper for `physx::PxRigidBody` has incorrect size"); +static_assert(sizeof(physx::PxArticulationLink) == sizeof(physx_PxArticulationLink), "POD wrapper for `physx::PxArticulationLink` has incorrect size"); +static_assert(sizeof(physx::PxConeLimitedConstraint) == sizeof(physx_PxConeLimitedConstraint), "POD wrapper for `physx::PxConeLimitedConstraint` has incorrect size"); +static_assert(sizeof(physx::PxConeLimitParams) == sizeof(physx_PxConeLimitParams), "POD wrapper for `physx::PxConeLimitParams` has incorrect size"); +static_assert(sizeof(physx::PxConstraintShaderTable) == sizeof(physx_PxConstraintShaderTable), "POD wrapper for `physx::PxConstraintShaderTable` has incorrect size"); +static_assert(sizeof(physx::PxConstraint) == sizeof(physx_PxConstraint), "POD wrapper for `physx::PxConstraint` has incorrect size"); +static_assert(sizeof(physx::PxMassModificationProps) == sizeof(physx_PxMassModificationProps), "POD wrapper for `physx::PxMassModificationProps` has incorrect size"); +static_assert(sizeof(physx::PxContactPatch) == sizeof(physx_PxContactPatch), "POD wrapper for `physx::PxContactPatch` has incorrect size"); +static_assert(sizeof(physx::PxContact) == sizeof(physx_PxContact), "POD wrapper for `physx::PxContact` has incorrect size"); +static_assert(sizeof(physx::PxExtendedContact) == sizeof(physx_PxExtendedContact), "POD wrapper for `physx::PxExtendedContact` has incorrect size"); +static_assert(sizeof(physx::PxModifiableContact) == sizeof(physx_PxModifiableContact), "POD wrapper for `physx::PxModifiableContact` has incorrect size"); +static_assert(sizeof(physx::PxContactStreamIterator) == sizeof(physx_PxContactStreamIterator), "POD wrapper for `physx::PxContactStreamIterator` has incorrect size"); +static_assert(sizeof(physx::PxGpuContactPair) == sizeof(physx_PxGpuContactPair), "POD wrapper for `physx::PxGpuContactPair` has incorrect size"); +static_assert(sizeof(physx::PxContactSet) == sizeof(physx_PxContactSet), "POD wrapper for `physx::PxContactSet` has incorrect size"); +static_assert(sizeof(physx::PxContactModifyPair) == sizeof(physx_PxContactModifyPair), "POD wrapper for `physx::PxContactModifyPair` has incorrect size"); +static_assert(sizeof(physx::PxContactModifyCallback) == sizeof(physx_PxContactModifyCallback), "POD wrapper for `physx::PxContactModifyCallback` has incorrect size"); +static_assert(sizeof(physx::PxCCDContactModifyCallback) == sizeof(physx_PxCCDContactModifyCallback), "POD wrapper for `physx::PxCCDContactModifyCallback` has incorrect size"); +static_assert(sizeof(physx::PxDeletionListener) == sizeof(physx_PxDeletionListener), "POD wrapper for `physx::PxDeletionListener` has incorrect size"); +static_assert(sizeof(physx::PxBaseMaterial) == sizeof(physx_PxBaseMaterial), "POD wrapper for `physx::PxBaseMaterial` has incorrect size"); +static_assert(sizeof(physx::PxFEMMaterial) == sizeof(physx_PxFEMMaterial), "POD wrapper for `physx::PxFEMMaterial` has incorrect size"); +static_assert(sizeof(physx::PxFilterData) == sizeof(physx_PxFilterData), "POD wrapper for `physx::PxFilterData` has incorrect size"); +static_assert(sizeof(physx::PxSimulationFilterCallback) == sizeof(physx_PxSimulationFilterCallback), "POD wrapper for `physx::PxSimulationFilterCallback` has incorrect size"); +static_assert(sizeof(physx::PxParticleRigidFilterPair) == sizeof(physx_PxParticleRigidFilterPair), "POD wrapper for `physx::PxParticleRigidFilterPair` has incorrect size"); +static_assert(sizeof(physx::PxLockedData) == sizeof(physx_PxLockedData), "POD wrapper for `physx::PxLockedData` has incorrect size"); +static_assert(sizeof(physx::PxMaterial) == sizeof(physx_PxMaterial), "POD wrapper for `physx::PxMaterial` has incorrect size"); +static_assert(sizeof(physx::PxGpuParticleBufferIndexPair) == sizeof(physx_PxGpuParticleBufferIndexPair), "POD wrapper for `physx::PxGpuParticleBufferIndexPair` has incorrect size"); +static_assert(sizeof(physx::PxParticleVolume) == sizeof(physx_PxParticleVolume), "POD wrapper for `physx::PxParticleVolume` has incorrect size"); +static_assert(sizeof(physx::PxDiffuseParticleParams) == sizeof(physx_PxDiffuseParticleParams), "POD wrapper for `physx::PxDiffuseParticleParams` has incorrect size"); +static_assert(sizeof(physx::PxParticleSpring) == sizeof(physx_PxParticleSpring), "POD wrapper for `physx::PxParticleSpring` has incorrect size"); +static_assert(sizeof(physx::PxParticleMaterial) == sizeof(physx_PxParticleMaterial), "POD wrapper for `physx::PxParticleMaterial` has incorrect size"); +static_assert(sizeof(physx::PxPhysics) == sizeof(physx_PxPhysics), "POD wrapper for `physx::PxPhysics` has incorrect size"); +static_assert(sizeof(physx::PxActorShape) == sizeof(physx_PxActorShape), "POD wrapper for `physx::PxActorShape` has incorrect size"); +static_assert(sizeof(physx::PxRaycastHit) == sizeof(physx_PxRaycastHit), "POD wrapper for `physx::PxRaycastHit` has incorrect size"); +static_assert(sizeof(physx::PxOverlapHit) == sizeof(physx_PxOverlapHit), "POD wrapper for `physx::PxOverlapHit` has incorrect size"); +static_assert(sizeof(physx::PxSweepHit) == sizeof(physx_PxSweepHit), "POD wrapper for `physx::PxSweepHit` has incorrect size"); +static_assert(sizeof(physx::PxRaycastCallback) == sizeof(physx_PxRaycastCallback), "POD wrapper for `physx::PxRaycastCallback` has incorrect size"); +static_assert(sizeof(physx::PxOverlapCallback) == sizeof(physx_PxOverlapCallback), "POD wrapper for `physx::PxOverlapCallback` has incorrect size"); +static_assert(sizeof(physx::PxSweepCallback) == sizeof(physx_PxSweepCallback), "POD wrapper for `physx::PxSweepCallback` has incorrect size"); +static_assert(sizeof(physx::PxRaycastBuffer) == sizeof(physx_PxRaycastBuffer), "POD wrapper for `physx::PxRaycastBuffer` has incorrect size"); +static_assert(sizeof(physx::PxOverlapBuffer) == sizeof(physx_PxOverlapBuffer), "POD wrapper for `physx::PxOverlapBuffer` has incorrect size"); +static_assert(sizeof(physx::PxSweepBuffer) == sizeof(physx_PxSweepBuffer), "POD wrapper for `physx::PxSweepBuffer` has incorrect size"); +static_assert(sizeof(physx::PxQueryCache) == sizeof(physx_PxQueryCache), "POD wrapper for `physx::PxQueryCache` has incorrect size"); +static_assert(sizeof(physx::PxQueryFilterData) == sizeof(physx_PxQueryFilterData), "POD wrapper for `physx::PxQueryFilterData` has incorrect size"); +static_assert(sizeof(physx::PxQueryFilterCallback) == sizeof(physx_PxQueryFilterCallback), "POD wrapper for `physx::PxQueryFilterCallback` has incorrect size"); +static_assert(sizeof(physx::PxRigidDynamic) == sizeof(physx_PxRigidDynamic), "POD wrapper for `physx::PxRigidDynamic` has incorrect size"); +static_assert(sizeof(physx::PxRigidStatic) == sizeof(physx_PxRigidStatic), "POD wrapper for `physx::PxRigidStatic` has incorrect size"); +static_assert(sizeof(physx::PxSceneQueryDesc) == sizeof(physx_PxSceneQueryDesc), "POD wrapper for `physx::PxSceneQueryDesc` has incorrect size"); +static_assert(sizeof(physx::PxSceneQuerySystemBase) == sizeof(physx_PxSceneQuerySystemBase), "POD wrapper for `physx::PxSceneQuerySystemBase` has incorrect size"); +static_assert(sizeof(physx::PxSceneSQSystem) == sizeof(physx_PxSceneSQSystem), "POD wrapper for `physx::PxSceneSQSystem` has incorrect size"); +static_assert(sizeof(physx::PxSceneQuerySystem) == sizeof(physx_PxSceneQuerySystem), "POD wrapper for `physx::PxSceneQuerySystem` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseRegion) == sizeof(physx_PxBroadPhaseRegion), "POD wrapper for `physx::PxBroadPhaseRegion` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseRegionInfo) == sizeof(physx_PxBroadPhaseRegionInfo), "POD wrapper for `physx::PxBroadPhaseRegionInfo` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseCaps) == sizeof(physx_PxBroadPhaseCaps), "POD wrapper for `physx::PxBroadPhaseCaps` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseDesc) == sizeof(physx_PxBroadPhaseDesc), "POD wrapper for `physx::PxBroadPhaseDesc` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseUpdateData) == sizeof(physx_PxBroadPhaseUpdateData), "POD wrapper for `physx::PxBroadPhaseUpdateData` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhasePair) == sizeof(physx_PxBroadPhasePair), "POD wrapper for `physx::PxBroadPhasePair` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseResults) == sizeof(physx_PxBroadPhaseResults), "POD wrapper for `physx::PxBroadPhaseResults` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseRegions) == sizeof(physx_PxBroadPhaseRegions), "POD wrapper for `physx::PxBroadPhaseRegions` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhase) == sizeof(physx_PxBroadPhase), "POD wrapper for `physx::PxBroadPhase` has incorrect size"); +static_assert(sizeof(physx::PxAABBManager) == sizeof(physx_PxAABBManager), "POD wrapper for `physx::PxAABBManager` has incorrect size"); +static_assert(sizeof(physx::PxSceneLimits) == sizeof(physx_PxSceneLimits), "POD wrapper for `physx::PxSceneLimits` has incorrect size"); +static_assert(sizeof(physx::PxgDynamicsMemoryConfig) == sizeof(physx_PxgDynamicsMemoryConfig), "POD wrapper for `physx::PxgDynamicsMemoryConfig` has incorrect size"); +static_assert(sizeof(physx::PxSceneDesc) == sizeof(physx_PxSceneDesc), "POD wrapper for `physx::PxSceneDesc` has incorrect size"); +static_assert(sizeof(physx::PxSimulationStatistics) == sizeof(physx_PxSimulationStatistics), "POD wrapper for `physx::PxSimulationStatistics` has incorrect size"); +static_assert(sizeof(physx::PxGpuBodyData) == sizeof(physx_PxGpuBodyData), "POD wrapper for `physx::PxGpuBodyData` has incorrect size"); +static_assert(sizeof(physx::PxGpuActorPair) == sizeof(physx_PxGpuActorPair), "POD wrapper for `physx::PxGpuActorPair` has incorrect size"); +static_assert(sizeof(physx::PxIndexDataPair) == sizeof(physx_PxIndexDataPair), "POD wrapper for `physx::PxIndexDataPair` has incorrect size"); +static_assert(sizeof(physx::PxPvdSceneClient) == sizeof(physx_PxPvdSceneClient), "POD wrapper for `physx::PxPvdSceneClient` has incorrect size"); +static_assert(sizeof(physx::PxDominanceGroupPair) == sizeof(physx_PxDominanceGroupPair), "POD wrapper for `physx::PxDominanceGroupPair` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseCallback) == sizeof(physx_PxBroadPhaseCallback), "POD wrapper for `physx::PxBroadPhaseCallback` has incorrect size"); +static_assert(sizeof(physx::PxScene) == sizeof(physx_PxScene), "POD wrapper for `physx::PxScene` has incorrect size"); +static_assert(sizeof(physx::PxSceneReadLock) == sizeof(physx_PxSceneReadLock), "POD wrapper for `physx::PxSceneReadLock` has incorrect size"); +static_assert(sizeof(physx::PxSceneWriteLock) == sizeof(physx_PxSceneWriteLock), "POD wrapper for `physx::PxSceneWriteLock` has incorrect size"); +static_assert(sizeof(physx::PxContactPairExtraDataItem) == sizeof(physx_PxContactPairExtraDataItem), "POD wrapper for `physx::PxContactPairExtraDataItem` has incorrect size"); +static_assert(sizeof(physx::PxContactPairVelocity) == sizeof(physx_PxContactPairVelocity), "POD wrapper for `physx::PxContactPairVelocity` has incorrect size"); +static_assert(sizeof(physx::PxContactPairPose) == sizeof(physx_PxContactPairPose), "POD wrapper for `physx::PxContactPairPose` has incorrect size"); +static_assert(sizeof(physx::PxContactPairIndex) == sizeof(physx_PxContactPairIndex), "POD wrapper for `physx::PxContactPairIndex` has incorrect size"); +static_assert(sizeof(physx::PxContactPairExtraDataIterator) == sizeof(physx_PxContactPairExtraDataIterator), "POD wrapper for `physx::PxContactPairExtraDataIterator` has incorrect size"); +static_assert(sizeof(physx::PxContactPairHeader) == sizeof(physx_PxContactPairHeader), "POD wrapper for `physx::PxContactPairHeader` has incorrect size"); +static_assert(sizeof(physx::PxContactPairPoint) == sizeof(physx_PxContactPairPoint), "POD wrapper for `physx::PxContactPairPoint` has incorrect size"); +static_assert(sizeof(physx::PxContactPair) == sizeof(physx_PxContactPair), "POD wrapper for `physx::PxContactPair` has incorrect size"); +static_assert(sizeof(physx::PxTriggerPair) == sizeof(physx_PxTriggerPair), "POD wrapper for `physx::PxTriggerPair` has incorrect size"); +static_assert(sizeof(physx::PxConstraintInfo) == sizeof(physx_PxConstraintInfo), "POD wrapper for `physx::PxConstraintInfo` has incorrect size"); +static_assert(sizeof(physx::PxSimulationEventCallback) == sizeof(physx_PxSimulationEventCallback), "POD wrapper for `physx::PxSimulationEventCallback` has incorrect size"); +static_assert(sizeof(physx::PxFEMParameters) == sizeof(physx_PxFEMParameters), "POD wrapper for `physx::PxFEMParameters` has incorrect size"); +static_assert(sizeof(physx::PxPruningStructure) == sizeof(physx_PxPruningStructure), "POD wrapper for `physx::PxPruningStructure` has incorrect size"); +static_assert(sizeof(physx::PxExtendedVec3) == sizeof(physx_PxExtendedVec3), "POD wrapper for `physx::PxExtendedVec3` has incorrect size"); +static_assert(sizeof(physx::PxObstacle) == sizeof(physx_PxObstacle), "POD wrapper for `physx::PxObstacle` has incorrect size"); +static_assert(sizeof(physx::PxBoxObstacle) == sizeof(physx_PxBoxObstacle), "POD wrapper for `physx::PxBoxObstacle` has incorrect size"); +static_assert(sizeof(physx::PxCapsuleObstacle) == sizeof(physx_PxCapsuleObstacle), "POD wrapper for `physx::PxCapsuleObstacle` has incorrect size"); +static_assert(sizeof(physx::PxObstacleContext) == sizeof(physx_PxObstacleContext), "POD wrapper for `physx::PxObstacleContext` has incorrect size"); +static_assert(sizeof(physx::PxControllerState) == sizeof(physx_PxControllerState), "POD wrapper for `physx::PxControllerState` has incorrect size"); +static_assert(sizeof(physx::PxControllerStats) == sizeof(physx_PxControllerStats), "POD wrapper for `physx::PxControllerStats` has incorrect size"); +static_assert(sizeof(physx::PxControllerHit) == sizeof(physx_PxControllerHit), "POD wrapper for `physx::PxControllerHit` has incorrect size"); +static_assert(sizeof(physx::PxControllerShapeHit) == sizeof(physx_PxControllerShapeHit), "POD wrapper for `physx::PxControllerShapeHit` has incorrect size"); +static_assert(sizeof(physx::PxControllersHit) == sizeof(physx_PxControllersHit), "POD wrapper for `physx::PxControllersHit` has incorrect size"); +static_assert(sizeof(physx::PxControllerObstacleHit) == sizeof(physx_PxControllerObstacleHit), "POD wrapper for `physx::PxControllerObstacleHit` has incorrect size"); +static_assert(sizeof(physx::PxUserControllerHitReport) == sizeof(physx_PxUserControllerHitReport), "POD wrapper for `physx::PxUserControllerHitReport` has incorrect size"); +static_assert(sizeof(physx::PxControllerFilterCallback) == sizeof(physx_PxControllerFilterCallback), "POD wrapper for `physx::PxControllerFilterCallback` has incorrect size"); +static_assert(sizeof(physx::PxControllerFilters) == sizeof(physx_PxControllerFilters), "POD wrapper for `physx::PxControllerFilters` has incorrect size"); +static_assert(sizeof(physx::PxControllerDesc) == sizeof(physx_PxControllerDesc), "POD wrapper for `physx::PxControllerDesc` has incorrect size"); +static_assert(sizeof(physx::PxController) == sizeof(physx_PxController), "POD wrapper for `physx::PxController` has incorrect size"); +static_assert(sizeof(physx::PxBoxControllerDesc) == sizeof(physx_PxBoxControllerDesc), "POD wrapper for `physx::PxBoxControllerDesc` has incorrect size"); +static_assert(sizeof(physx::PxBoxController) == sizeof(physx_PxBoxController), "POD wrapper for `physx::PxBoxController` has incorrect size"); +static_assert(sizeof(physx::PxCapsuleControllerDesc) == sizeof(physx_PxCapsuleControllerDesc), "POD wrapper for `physx::PxCapsuleControllerDesc` has incorrect size"); +static_assert(sizeof(physx::PxCapsuleController) == sizeof(physx_PxCapsuleController), "POD wrapper for `physx::PxCapsuleController` has incorrect size"); +static_assert(sizeof(physx::PxControllerBehaviorCallback) == sizeof(physx_PxControllerBehaviorCallback), "POD wrapper for `physx::PxControllerBehaviorCallback` has incorrect size"); +static_assert(sizeof(physx::PxControllerManager) == sizeof(physx_PxControllerManager), "POD wrapper for `physx::PxControllerManager` has incorrect size"); +static_assert(sizeof(physx::PxDim3) == sizeof(physx_PxDim3), "POD wrapper for `physx::PxDim3` has incorrect size"); +static_assert(sizeof(physx::PxSDFDesc) == sizeof(physx_PxSDFDesc), "POD wrapper for `physx::PxSDFDesc` has incorrect size"); +static_assert(sizeof(physx::PxConvexMeshDesc) == sizeof(physx_PxConvexMeshDesc), "POD wrapper for `physx::PxConvexMeshDesc` has incorrect size"); +static_assert(sizeof(physx::PxTriangleMeshDesc) == sizeof(physx_PxTriangleMeshDesc), "POD wrapper for `physx::PxTriangleMeshDesc` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedronMeshDesc) == sizeof(physx_PxTetrahedronMeshDesc), "POD wrapper for `physx::PxTetrahedronMeshDesc` has incorrect size"); +static_assert(sizeof(physx::PxSoftBodySimulationDataDesc) == sizeof(physx_PxSoftBodySimulationDataDesc), "POD wrapper for `physx::PxSoftBodySimulationDataDesc` has incorrect size"); +static_assert(sizeof(physx::PxBVH34MidphaseDesc) == sizeof(physx_PxBVH34MidphaseDesc), "POD wrapper for `physx::PxBVH34MidphaseDesc` has incorrect size"); +static_assert(sizeof(physx::PxMidphaseDesc) == sizeof(physx_PxMidphaseDesc), "POD wrapper for `physx::PxMidphaseDesc` has incorrect size"); +static_assert(sizeof(physx::PxBVHDesc) == sizeof(physx_PxBVHDesc), "POD wrapper for `physx::PxBVHDesc` has incorrect size"); +static_assert(sizeof(physx::PxCookingParams) == sizeof(physx_PxCookingParams), "POD wrapper for `physx::PxCookingParams` has incorrect size"); +static_assert(sizeof(physx::PxDefaultMemoryOutputStream) == sizeof(physx_PxDefaultMemoryOutputStream), "POD wrapper for `physx::PxDefaultMemoryOutputStream` has incorrect size"); +static_assert(sizeof(physx::PxDefaultMemoryInputData) == sizeof(physx_PxDefaultMemoryInputData), "POD wrapper for `physx::PxDefaultMemoryInputData` has incorrect size"); +static_assert(sizeof(physx::PxDefaultFileOutputStream) == sizeof(physx_PxDefaultFileOutputStream), "POD wrapper for `physx::PxDefaultFileOutputStream` has incorrect size"); +static_assert(sizeof(physx::PxDefaultFileInputData) == sizeof(physx_PxDefaultFileInputData), "POD wrapper for `physx::PxDefaultFileInputData` has incorrect size"); +static_assert(sizeof(physx::PxDefaultAllocator) == sizeof(physx_PxDefaultAllocator), "POD wrapper for `physx::PxDefaultAllocator` has incorrect size"); +static_assert(sizeof(physx::PxJoint) == sizeof(physx_PxJoint), "POD wrapper for `physx::PxJoint` has incorrect size"); +static_assert(sizeof(physx::PxSpring) == sizeof(physx_PxSpring), "POD wrapper for `physx::PxSpring` has incorrect size"); +static_assert(sizeof(physx::PxDistanceJoint) == sizeof(physx_PxDistanceJoint), "POD wrapper for `physx::PxDistanceJoint` has incorrect size"); +static_assert(sizeof(physx::PxJacobianRow) == sizeof(physx_PxJacobianRow), "POD wrapper for `physx::PxJacobianRow` has incorrect size"); +static_assert(sizeof(physx::PxContactJoint) == sizeof(physx_PxContactJoint), "POD wrapper for `physx::PxContactJoint` has incorrect size"); +static_assert(sizeof(physx::PxFixedJoint) == sizeof(physx_PxFixedJoint), "POD wrapper for `physx::PxFixedJoint` has incorrect size"); +static_assert(sizeof(physx::PxJointLimitParameters) == sizeof(physx_PxJointLimitParameters), "POD wrapper for `physx::PxJointLimitParameters` has incorrect size"); +static_assert(sizeof(physx::PxJointLinearLimit) == sizeof(physx_PxJointLinearLimit), "POD wrapper for `physx::PxJointLinearLimit` has incorrect size"); +static_assert(sizeof(physx::PxJointLinearLimitPair) == sizeof(physx_PxJointLinearLimitPair), "POD wrapper for `physx::PxJointLinearLimitPair` has incorrect size"); +static_assert(sizeof(physx::PxJointAngularLimitPair) == sizeof(physx_PxJointAngularLimitPair), "POD wrapper for `physx::PxJointAngularLimitPair` has incorrect size"); +static_assert(sizeof(physx::PxJointLimitCone) == sizeof(physx_PxJointLimitCone), "POD wrapper for `physx::PxJointLimitCone` has incorrect size"); +static_assert(sizeof(physx::PxJointLimitPyramid) == sizeof(physx_PxJointLimitPyramid), "POD wrapper for `physx::PxJointLimitPyramid` has incorrect size"); +static_assert(sizeof(physx::PxPrismaticJoint) == sizeof(physx_PxPrismaticJoint), "POD wrapper for `physx::PxPrismaticJoint` has incorrect size"); +static_assert(sizeof(physx::PxRevoluteJoint) == sizeof(physx_PxRevoluteJoint), "POD wrapper for `physx::PxRevoluteJoint` has incorrect size"); +static_assert(sizeof(physx::PxSphericalJoint) == sizeof(physx_PxSphericalJoint), "POD wrapper for `physx::PxSphericalJoint` has incorrect size"); +static_assert(sizeof(physx::PxD6JointDrive) == sizeof(physx_PxD6JointDrive), "POD wrapper for `physx::PxD6JointDrive` has incorrect size"); +static_assert(sizeof(physx::PxD6Joint) == sizeof(physx_PxD6Joint), "POD wrapper for `physx::PxD6Joint` has incorrect size"); +static_assert(sizeof(physx::PxGearJoint) == sizeof(physx_PxGearJoint), "POD wrapper for `physx::PxGearJoint` has incorrect size"); +static_assert(sizeof(physx::PxRackAndPinionJoint) == sizeof(physx_PxRackAndPinionJoint), "POD wrapper for `physx::PxRackAndPinionJoint` has incorrect size"); +static_assert(sizeof(physx::PxGroupsMask) == sizeof(physx_PxGroupsMask), "POD wrapper for `physx::PxGroupsMask` has incorrect size"); +static_assert(sizeof(physx::PxDefaultErrorCallback) == sizeof(physx_PxDefaultErrorCallback), "POD wrapper for `physx::PxDefaultErrorCallback` has incorrect size"); +static_assert(sizeof(physx::PxRigidActorExt) == sizeof(physx_PxRigidActorExt), "POD wrapper for `physx::PxRigidActorExt` has incorrect size"); +static_assert(sizeof(physx::PxMassProperties) == sizeof(physx_PxMassProperties), "POD wrapper for `physx::PxMassProperties` has incorrect size"); +static_assert(sizeof(physx::PxRigidBodyExt) == sizeof(physx_PxRigidBodyExt), "POD wrapper for `physx::PxRigidBodyExt` has incorrect size"); +static_assert(sizeof(physx::PxShapeExt) == sizeof(physx_PxShapeExt), "POD wrapper for `physx::PxShapeExt` has incorrect size"); +static_assert(sizeof(physx::PxMeshOverlapUtil) == sizeof(physx_PxMeshOverlapUtil), "POD wrapper for `physx::PxMeshOverlapUtil` has incorrect size"); +static_assert(sizeof(physx::PxXmlMiscParameter) == sizeof(physx_PxXmlMiscParameter), "POD wrapper for `physx::PxXmlMiscParameter` has incorrect size"); +static_assert(sizeof(physx::PxSerialization) == sizeof(physx_PxSerialization), "POD wrapper for `physx::PxSerialization` has incorrect size"); +static_assert(sizeof(physx::PxDefaultCpuDispatcher) == sizeof(physx_PxDefaultCpuDispatcher), "POD wrapper for `physx::PxDefaultCpuDispatcher` has incorrect size"); +static_assert(sizeof(physx::PxStringTableExt) == sizeof(physx_PxStringTableExt), "POD wrapper for `physx::PxStringTableExt` has incorrect size"); +static_assert(sizeof(physx::PxBroadPhaseExt) == sizeof(physx_PxBroadPhaseExt), "POD wrapper for `physx::PxBroadPhaseExt` has incorrect size"); +static_assert(sizeof(physx::PxSceneQueryExt) == sizeof(physx_PxSceneQueryExt), "POD wrapper for `physx::PxSceneQueryExt` has incorrect size"); +static_assert(sizeof(physx::PxBatchQueryExt) == sizeof(physx_PxBatchQueryExt), "POD wrapper for `physx::PxBatchQueryExt` has incorrect size"); +static_assert(sizeof(physx::PxCustomSceneQuerySystem) == sizeof(physx_PxCustomSceneQuerySystem), "POD wrapper for `physx::PxCustomSceneQuerySystem` has incorrect size"); +static_assert(sizeof(physx::PxCustomSceneQuerySystemAdapter) == sizeof(physx_PxCustomSceneQuerySystemAdapter), "POD wrapper for `physx::PxCustomSceneQuerySystemAdapter` has incorrect size"); +static_assert(sizeof(physx::PxSamplingExt) == sizeof(physx_PxSamplingExt), "POD wrapper for `physx::PxSamplingExt` has incorrect size"); +static_assert(sizeof(physx::PxPoissonSampler) == sizeof(physx_PxPoissonSampler), "POD wrapper for `physx::PxPoissonSampler` has incorrect size"); +static_assert(sizeof(physx::PxTriangleMeshPoissonSampler) == sizeof(physx_PxTriangleMeshPoissonSampler), "POD wrapper for `physx::PxTriangleMeshPoissonSampler` has incorrect size"); +static_assert(sizeof(physx::PxTetrahedronMeshExt) == sizeof(physx_PxTetrahedronMeshExt), "POD wrapper for `physx::PxTetrahedronMeshExt` has incorrect size"); +static_assert(sizeof(physx::PxRepXObject) == sizeof(physx_PxRepXObject), "POD wrapper for `physx::PxRepXObject` has incorrect size"); +static_assert(sizeof(physx::PxRepXInstantiationArgs) == sizeof(physx_PxRepXInstantiationArgs), "POD wrapper for `physx::PxRepXInstantiationArgs` has incorrect size"); +static_assert(sizeof(physx::PxRepXSerializer) == sizeof(physx_PxRepXSerializer), "POD wrapper for `physx::PxRepXSerializer` has incorrect size"); +static_assert(sizeof(physx::PxPvd) == sizeof(physx_PxPvd), "POD wrapper for `physx::PxPvd` has incorrect size"); +static_assert(sizeof(physx::PxPvdTransport) == sizeof(physx_PxPvdTransport), "POD wrapper for `physx::PxPvdTransport` has incorrect size"); + +#ifdef _WIN32 + #define DLLEXPORT __declspec(dllexport) +#else + #define DLLEXPORT +#endif + +extern "C" { + DLLEXPORT void PxAllocatorCallback_delete(physx_PxAllocatorCallback* self__pod) { + physx::PxAllocatorCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void* PxAllocatorCallback_allocate_mut(physx_PxAllocatorCallback* self__pod, size_t size_pod, char const* typeName, char const* filename, int32_t line) { + physx::PxAllocatorCallback* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, typeName, filename, line); + return return_val; + } + + DLLEXPORT void PxAllocatorCallback_deallocate_mut(physx_PxAllocatorCallback* self__pod, void* ptr) { + physx::PxAllocatorCallback* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT void PxAssertHandler_delete(physx_PxAssertHandler* self__pod) { + physx::PxAssertHandler* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxAssertHandler* phys_PxGetAssertHandler() { + physx::PxAssertHandler& return_val = PxGetAssertHandler(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void phys_PxSetAssertHandler(physx_PxAssertHandler* handler_pod) { + physx::PxAssertHandler& handler = reinterpret_cast(*handler_pod); + PxSetAssertHandler(handler); + } + + DLLEXPORT void PxFoundation_release_mut(physx_PxFoundation* self__pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxErrorCallback* PxFoundation_getErrorCallback_mut(physx_PxFoundation* self__pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxErrorCallback& return_val = self_->getErrorCallback(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxFoundation_setErrorLevel_mut(physx_PxFoundation* self__pod, uint32_t mask) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + self_->setErrorLevel(mask); + } + + DLLEXPORT uint32_t PxFoundation_getErrorLevel(physx_PxFoundation const* self__pod) { + physx::PxFoundation const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getErrorLevel(); + return return_val; + } + + DLLEXPORT physx_PxAllocatorCallback* PxFoundation_getAllocatorCallback_mut(physx_PxFoundation* self__pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxAllocatorCallback& return_val = self_->getAllocatorCallback(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT bool PxFoundation_getReportAllocationNames(physx_PxFoundation const* self__pod) { + physx::PxFoundation const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->getReportAllocationNames(); + return return_val; + } + + DLLEXPORT void PxFoundation_setReportAllocationNames_mut(physx_PxFoundation* self__pod, bool value) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + self_->setReportAllocationNames(value); + } + + DLLEXPORT void PxFoundation_registerAllocationListener_mut(physx_PxFoundation* self__pod, physx_PxAllocationListener* listener_pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxAllocationListener& listener = reinterpret_cast(*listener_pod); + self_->registerAllocationListener(listener); + } + + DLLEXPORT void PxFoundation_deregisterAllocationListener_mut(physx_PxFoundation* self__pod, physx_PxAllocationListener* listener_pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxAllocationListener& listener = reinterpret_cast(*listener_pod); + self_->deregisterAllocationListener(listener); + } + + DLLEXPORT void PxFoundation_registerErrorCallback_mut(physx_PxFoundation* self__pod, physx_PxErrorCallback* callback_pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxErrorCallback& callback = reinterpret_cast(*callback_pod); + self_->registerErrorCallback(callback); + } + + DLLEXPORT void PxFoundation_deregisterErrorCallback_mut(physx_PxFoundation* self__pod, physx_PxErrorCallback* callback_pod) { + physx::PxFoundation* self_ = reinterpret_cast(self__pod); + physx::PxErrorCallback& callback = reinterpret_cast(*callback_pod); + self_->deregisterErrorCallback(callback); + } + + DLLEXPORT physx_PxFoundation* phys_PxCreateFoundation(uint32_t version, physx_PxAllocatorCallback* allocator_pod, physx_PxErrorCallback* errorCallback_pod) { + physx::PxAllocatorCallback& allocator = reinterpret_cast(*allocator_pod); + physx::PxErrorCallback& errorCallback = reinterpret_cast(*errorCallback_pod); + physx::PxFoundation* return_val = PxCreateFoundation(version, allocator, errorCallback); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void phys_PxSetFoundationInstance(physx_PxFoundation* foundation_pod) { + physx::PxFoundation& foundation = reinterpret_cast(*foundation_pod); + PxSetFoundationInstance(foundation); + } + + DLLEXPORT physx_PxFoundation* phys_PxGetFoundation() { + physx::PxFoundation& return_val = PxGetFoundation(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxProfilerCallback* phys_PxGetProfilerCallback() { + physx::PxProfilerCallback* return_val = PxGetProfilerCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void phys_PxSetProfilerCallback(physx_PxProfilerCallback* profiler_pod) { + physx::PxProfilerCallback* profiler = reinterpret_cast(profiler_pod); + PxSetProfilerCallback(profiler); + } + + DLLEXPORT physx_PxAllocatorCallback* phys_PxGetAllocatorCallback() { + physx::PxAllocatorCallback* return_val = PxGetAllocatorCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxAllocatorCallback* phys_PxGetBroadcastAllocator() { + physx::PxAllocatorCallback* return_val = PxGetBroadcastAllocator(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxErrorCallback* phys_PxGetErrorCallback() { + physx::PxErrorCallback* return_val = PxGetErrorCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxErrorCallback* phys_PxGetBroadcastError() { + physx::PxErrorCallback* return_val = PxGetBroadcastError(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxGetWarnOnceTimeStamp() { + uint32_t return_val = PxGetWarnOnceTimeStamp(); + return return_val; + } + + DLLEXPORT void phys_PxDecFoundationRefCount() { + PxDecFoundationRefCount(); + } + + DLLEXPORT void phys_PxIncFoundationRefCount() { + PxIncFoundationRefCount(); + } + + DLLEXPORT physx_PxAllocator PxAllocator_new(char const* anon_param0) { + PxAllocator return_val(anon_param0); + physx_PxAllocator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void* PxAllocator_allocate_mut(physx_PxAllocator* self__pod, size_t size_pod, char const* file, int32_t line) { + physx::PxAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, file, line); + return return_val; + } + + DLLEXPORT void PxAllocator_deallocate_mut(physx_PxAllocator* self__pod, void* ptr) { + physx::PxAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT physx_PxRawAllocator PxRawAllocator_new(char const* anon_param0) { + PxRawAllocator return_val(anon_param0); + physx_PxRawAllocator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void* PxRawAllocator_allocate_mut(physx_PxRawAllocator* self__pod, size_t size_pod, char const* anon_param1, int32_t anon_param2) { + physx::PxRawAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, anon_param1, anon_param2); + return return_val; + } + + DLLEXPORT void PxRawAllocator_deallocate_mut(physx_PxRawAllocator* self__pod, void* ptr) { + physx::PxRawAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT void PxVirtualAllocatorCallback_delete(physx_PxVirtualAllocatorCallback* self__pod) { + physx::PxVirtualAllocatorCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void* PxVirtualAllocatorCallback_allocate_mut(physx_PxVirtualAllocatorCallback* self__pod, size_t size_pod, int32_t group, char const* file, int32_t line) { + physx::PxVirtualAllocatorCallback* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, group, file, line); + return return_val; + } + + DLLEXPORT void PxVirtualAllocatorCallback_deallocate_mut(physx_PxVirtualAllocatorCallback* self__pod, void* ptr) { + physx::PxVirtualAllocatorCallback* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT physx_PxVirtualAllocator PxVirtualAllocator_new(physx_PxVirtualAllocatorCallback* callback_pod, int32_t group) { + physx::PxVirtualAllocatorCallback* callback = reinterpret_cast(callback_pod); + PxVirtualAllocator return_val(callback, group); + physx_PxVirtualAllocator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void* PxVirtualAllocator_allocate_mut(physx_PxVirtualAllocator* self__pod, size_t size_pod, char const* file, int32_t line) { + physx::PxVirtualAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, file, line); + return return_val; + } + + DLLEXPORT void PxVirtualAllocator_deallocate_mut(physx_PxVirtualAllocator* self__pod, void* ptr) { + physx::PxVirtualAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT physx_PxTempAllocatorChunk PxTempAllocatorChunk_new() { + PxTempAllocatorChunk return_val; + physx_PxTempAllocatorChunk return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTempAllocator PxTempAllocator_new(char const* anon_param0) { + PxTempAllocator return_val(anon_param0); + physx_PxTempAllocator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void* PxTempAllocator_allocate_mut(physx_PxTempAllocator* self__pod, size_t size_pod, char const* file, int32_t line) { + physx::PxTempAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, file, line); + return return_val; + } + + DLLEXPORT void PxTempAllocator_deallocate_mut(physx_PxTempAllocator* self__pod, void* ptr) { + physx::PxTempAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT void* phys_PxMemZero(void* dest, uint32_t count) { + void* return_val = PxMemZero(dest, count); + return return_val; + } + + DLLEXPORT void* phys_PxMemSet(void* dest, int32_t c, uint32_t count) { + void* return_val = PxMemSet(dest, c, count); + return return_val; + } + + DLLEXPORT void* phys_PxMemCopy(void* dest, void const* src, uint32_t count) { + void* return_val = PxMemCopy(dest, src, count); + return return_val; + } + + DLLEXPORT void* phys_PxMemMove(void* dest, void const* src, uint32_t count) { + void* return_val = PxMemMove(dest, src, count); + return return_val; + } + + DLLEXPORT void phys_PxMarkSerializedMemory(void* ptr, uint32_t byteSize) { + PxMarkSerializedMemory(ptr, byteSize); + } + + DLLEXPORT void phys_PxMemoryBarrier() { + PxMemoryBarrier(); + } + + DLLEXPORT uint32_t phys_PxHighestSetBitUnsafe(uint32_t v) { + uint32_t return_val = PxHighestSetBitUnsafe(v); + return return_val; + } + + DLLEXPORT uint32_t phys_PxLowestSetBitUnsafe(uint32_t v) { + uint32_t return_val = PxLowestSetBitUnsafe(v); + return return_val; + } + + DLLEXPORT uint32_t phys_PxCountLeadingZeros(uint32_t v) { + uint32_t return_val = PxCountLeadingZeros(v); + return return_val; + } + + DLLEXPORT void phys_PxPrefetchLine(void const* ptr, uint32_t offset) { + PxPrefetchLine(ptr, offset); + } + + DLLEXPORT void phys_PxPrefetch(void const* ptr, uint32_t count) { + PxPrefetch(ptr, count); + } + + DLLEXPORT uint32_t phys_PxBitCount(uint32_t v) { + uint32_t return_val = PxBitCount(v); + return return_val; + } + + DLLEXPORT bool phys_PxIsPowerOfTwo(uint32_t x) { + bool return_val = PxIsPowerOfTwo(x); + return return_val; + } + + DLLEXPORT uint32_t phys_PxNextPowerOfTwo(uint32_t x) { + uint32_t return_val = PxNextPowerOfTwo(x); + return return_val; + } + + DLLEXPORT uint32_t phys_PxLowestSetBit(uint32_t x) { + uint32_t return_val = PxLowestSetBit(x); + return return_val; + } + + DLLEXPORT uint32_t phys_PxHighestSetBit(uint32_t x) { + uint32_t return_val = PxHighestSetBit(x); + return return_val; + } + + DLLEXPORT uint32_t phys_PxILog2(uint32_t num) { + uint32_t return_val = PxILog2(num); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxVec3_new() { + PxVec3 return_val; + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec3_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxVec3 return_val(anon_param0); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec3_new_2(float a) { + PxVec3 return_val(a); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec3_new_3(float nx, float ny, float nz) { + PxVec3 return_val(nx, ny, nz); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxVec3_isZero(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isZero(); + return return_val; + } + + DLLEXPORT bool PxVec3_isFinite(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT bool PxVec3_isNormalized(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isNormalized(); + return return_val; + } + + DLLEXPORT float PxVec3_magnitudeSquared(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitudeSquared(); + return return_val; + } + + DLLEXPORT float PxVec3_magnitude(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitude(); + return return_val; + } + + DLLEXPORT float PxVec3_dot(physx_PxVec3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + float return_val = self_->dot(v); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxVec3_cross(physx_PxVec3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->cross(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec3_getNormalized(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getNormalized(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec3_normalize_mut(physx_PxVec3* self__pod) { + physx::PxVec3* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalize(); + return return_val; + } + + DLLEXPORT float PxVec3_normalizeSafe_mut(physx_PxVec3* self__pod) { + physx::PxVec3* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalizeSafe(); + return return_val; + } + + DLLEXPORT float PxVec3_normalizeFast_mut(physx_PxVec3* self__pod) { + physx::PxVec3* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalizeFast(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxVec3_multiply(physx_PxVec3 const* self__pod, physx_PxVec3 const* a_pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& a = reinterpret_cast(*a_pod); + physx::PxVec3 return_val = self_->multiply(a); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec3_minimum(physx_PxVec3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->minimum(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec3_minElement(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->minElement(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxVec3_maximum(physx_PxVec3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->maximum(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec3_maxElement(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->maxElement(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxVec3_abs(physx_PxVec3 const* self__pod) { + physx::PxVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->abs(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3Padded* PxVec3Padded_new_alloc() { + auto return_val = new physx::PxVec3Padded(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxVec3Padded_delete(physx_PxVec3Padded* self__pod) { + physx::PxVec3Padded* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxVec3Padded* PxVec3Padded_new_alloc_1(physx_PxVec3 const* p_pod) { + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + auto return_val = new physx::PxVec3Padded(p); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3Padded* PxVec3Padded_new_alloc_2(float f) { + auto return_val = new physx::PxVec3Padded(f); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new() { + PxQuat return_val; + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxQuat return_val(anon_param0); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new_2(float r) { + PxQuat return_val(r); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new_3(float nx, float ny, float nz, float nw) { + PxQuat return_val(nx, ny, nz, nw); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new_4(float angleRadians, physx_PxVec3 const* unitAxis_pod) { + physx::PxVec3 const& unitAxis = reinterpret_cast(*unitAxis_pod); + PxQuat return_val(angleRadians, unitAxis); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat PxQuat_new_5(physx_PxMat33 const* m_pod) { + physx::PxMat33 const& m = reinterpret_cast(*m_pod); + PxQuat return_val(m); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxQuat_isIdentity(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isIdentity(); + return return_val; + } + + DLLEXPORT bool PxQuat_isFinite(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT bool PxQuat_isUnit(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isUnit(); + return return_val; + } + + DLLEXPORT bool PxQuat_isSane(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSane(); + return return_val; + } + + DLLEXPORT void PxQuat_toRadiansAndUnitAxis(physx_PxQuat const* self__pod, float* angle_pod, physx_PxVec3* axis_pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + float& angle = *angle_pod; + physx::PxVec3& axis = reinterpret_cast(*axis_pod); + self_->toRadiansAndUnitAxis(angle, axis); + } + + DLLEXPORT float PxQuat_getAngle(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getAngle(); + return return_val; + } + + DLLEXPORT float PxQuat_getAngle_1(physx_PxQuat const* self__pod, physx_PxQuat const* q_pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxQuat const& q = reinterpret_cast(*q_pod); + float return_val = self_->getAngle(q); + return return_val; + } + + DLLEXPORT float PxQuat_magnitudeSquared(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitudeSquared(); + return return_val; + } + + DLLEXPORT float PxQuat_dot(physx_PxQuat const* self__pod, physx_PxQuat const* v_pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxQuat const& v = reinterpret_cast(*v_pod); + float return_val = self_->dot(v); + return return_val; + } + + DLLEXPORT physx_PxQuat PxQuat_getNormalized(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxQuat return_val = self_->getNormalized(); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxQuat_magnitude(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitude(); + return return_val; + } + + DLLEXPORT float PxQuat_normalize_mut(physx_PxQuat* self__pod) { + physx::PxQuat* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalize(); + return return_val; + } + + DLLEXPORT physx_PxQuat PxQuat_getConjugate(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxQuat return_val = self_->getConjugate(); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_getImaginaryPart(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getImaginaryPart(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_getBasisVector0(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getBasisVector0(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_getBasisVector1(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getBasisVector1(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_getBasisVector2(physx_PxQuat const* self__pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getBasisVector2(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_rotate(physx_PxQuat const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->rotate(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxQuat_rotateInv(physx_PxQuat const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxQuat const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->rotateInv(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new() { + PxTransform return_val; + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_1(physx_PxVec3 const* position_pod) { + physx::PxVec3 const& position = reinterpret_cast(*position_pod); + PxTransform return_val(position); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_2(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxTransform return_val(anon_param0); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_3(physx_PxQuat const* orientation_pod) { + physx::PxQuat const& orientation = reinterpret_cast(*orientation_pod); + PxTransform return_val(orientation); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_4(float x, float y, float z, physx_PxQuat aQ_pod) { + physx::PxQuat aQ; + memcpy(&aQ, &aQ_pod, sizeof(aQ)); + PxTransform return_val(x, y, z, aQ); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_5(physx_PxVec3 const* p0_pod, physx_PxQuat const* q0_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxQuat const& q0 = reinterpret_cast(*q0_pod); + PxTransform return_val(p0, q0); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_new_6(physx_PxMat44 const* m_pod) { + physx::PxMat44 const& m = reinterpret_cast(*m_pod); + PxTransform return_val(m); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_getInverse(physx_PxTransform const* self__pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getInverse(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxTransform_transform(physx_PxTransform const* self__pod, physx_PxVec3 const* input_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& input = reinterpret_cast(*input_pod); + physx::PxVec3 return_val = self_->transform(input); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxTransform_transformInv(physx_PxTransform const* self__pod, physx_PxVec3 const* input_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& input = reinterpret_cast(*input_pod); + physx::PxVec3 return_val = self_->transformInv(input); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxTransform_rotate(physx_PxTransform const* self__pod, physx_PxVec3 const* input_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& input = reinterpret_cast(*input_pod); + physx::PxVec3 return_val = self_->rotate(input); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxTransform_rotateInv(physx_PxTransform const* self__pod, physx_PxVec3 const* input_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& input = reinterpret_cast(*input_pod); + physx::PxVec3 return_val = self_->rotateInv(input); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_transform_1(physx_PxTransform const* self__pod, physx_PxTransform const* src_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& src = reinterpret_cast(*src_pod); + physx::PxTransform return_val = self_->transform(src); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxTransform_isValid(physx_PxTransform const* self__pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT bool PxTransform_isSane(physx_PxTransform const* self__pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSane(); + return return_val; + } + + DLLEXPORT bool PxTransform_isFinite(physx_PxTransform const* self__pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT physx_PxTransform PxTransform_transformInv_1(physx_PxTransform const* self__pod, physx_PxTransform const* src_pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& src = reinterpret_cast(*src_pod); + physx::PxTransform return_val = self_->transformInv(src); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxTransform_getNormalized(physx_PxTransform const* self__pod) { + physx::PxTransform const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getNormalized(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new() { + PxMat33 return_val; + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxMat33 return_val(anon_param0); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_2(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxMat33 return_val(anon_param0); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_3(physx_PxVec3 const* col0_pod, physx_PxVec3 const* col1_pod, physx_PxVec3 const* col2_pod) { + physx::PxVec3 const& col0 = reinterpret_cast(*col0_pod); + physx::PxVec3 const& col1 = reinterpret_cast(*col1_pod); + physx::PxVec3 const& col2 = reinterpret_cast(*col2_pod); + PxMat33 return_val(col0, col1, col2); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_4(float r) { + PxMat33 return_val(r); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_5(float* values) { + PxMat33 return_val(values); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_new_6(physx_PxQuat const* q_pod) { + physx::PxQuat const& q = reinterpret_cast(*q_pod); + PxMat33 return_val(q); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_createDiagonal(physx_PxVec3 const* d_pod) { + physx::PxVec3 const& d = reinterpret_cast(*d_pod); + physx::PxMat33 return_val = PxMat33::createDiagonal(d); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_outer(physx_PxVec3 const* a_pod, physx_PxVec3 const* b_pod) { + physx::PxVec3 const& a = reinterpret_cast(*a_pod); + physx::PxVec3 const& b = reinterpret_cast(*b_pod); + physx::PxMat33 return_val = PxMat33::outer(a, b); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_getTranspose(physx_PxMat33 const* self__pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + physx::PxMat33 return_val = self_->getTranspose(); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMat33_getInverse(physx_PxMat33 const* self__pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + physx::PxMat33 return_val = self_->getInverse(); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxMat33_getDeterminant(physx_PxMat33 const* self__pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDeterminant(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxMat33_transform(physx_PxMat33 const* self__pod, physx_PxVec3 const* other_pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& other = reinterpret_cast(*other_pod); + physx::PxVec3 return_val = self_->transform(other); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxMat33_transformTranspose(physx_PxMat33 const* self__pod, physx_PxVec3 const* other_pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& other = reinterpret_cast(*other_pod); + physx::PxVec3 return_val = self_->transformTranspose(other); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float const* PxMat33_front(physx_PxMat33 const* self__pod) { + physx::PxMat33 const* self_ = reinterpret_cast(self__pod); + float const* return_val = self_->front(); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_new() { + PxBounds3 return_val; + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_new_1(physx_PxVec3 const* minimum_pod, physx_PxVec3 const* maximum_pod) { + physx::PxVec3 const& minimum = reinterpret_cast(*minimum_pod); + physx::PxVec3 const& maximum = reinterpret_cast(*maximum_pod); + PxBounds3 return_val(minimum, maximum); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_empty() { + physx::PxBounds3 return_val = PxBounds3::empty(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_boundsOfPoints(physx_PxVec3 const* v0_pod, physx_PxVec3 const* v1_pod) { + physx::PxVec3 const& v0 = reinterpret_cast(*v0_pod); + physx::PxVec3 const& v1 = reinterpret_cast(*v1_pod); + physx::PxBounds3 return_val = PxBounds3::boundsOfPoints(v0, v1); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_centerExtents(physx_PxVec3 const* center_pod, physx_PxVec3 const* extent_pod) { + physx::PxVec3 const& center = reinterpret_cast(*center_pod); + physx::PxVec3 const& extent = reinterpret_cast(*extent_pod); + physx::PxBounds3 return_val = PxBounds3::centerExtents(center, extent); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_basisExtent(physx_PxVec3 const* center_pod, physx_PxMat33 const* basis_pod, physx_PxVec3 const* extent_pod) { + physx::PxVec3 const& center = reinterpret_cast(*center_pod); + physx::PxMat33 const& basis = reinterpret_cast(*basis_pod); + physx::PxVec3 const& extent = reinterpret_cast(*extent_pod); + physx::PxBounds3 return_val = PxBounds3::basisExtent(center, basis, extent); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_poseExtent(physx_PxTransform const* pose_pod, physx_PxVec3 const* extent_pod) { + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& extent = reinterpret_cast(*extent_pod); + physx::PxBounds3 return_val = PxBounds3::poseExtent(pose, extent); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_transformSafe(physx_PxMat33 const* matrix_pod, physx_PxBounds3 const* bounds_pod) { + physx::PxMat33 const& matrix = reinterpret_cast(*matrix_pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + physx::PxBounds3 return_val = PxBounds3::transformSafe(matrix, bounds); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_transformFast(physx_PxMat33 const* matrix_pod, physx_PxBounds3 const* bounds_pod) { + physx::PxMat33 const& matrix = reinterpret_cast(*matrix_pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + physx::PxBounds3 return_val = PxBounds3::transformFast(matrix, bounds); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_transformSafe_1(physx_PxTransform const* transform_pod, physx_PxBounds3 const* bounds_pod) { + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + physx::PxBounds3 return_val = PxBounds3::transformSafe(transform, bounds); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxBounds3_transformFast_1(physx_PxTransform const* transform_pod, physx_PxBounds3 const* bounds_pod) { + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + physx::PxBounds3 return_val = PxBounds3::transformFast(transform, bounds); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxBounds3_setEmpty_mut(physx_PxBounds3* self__pod) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->setEmpty(); + } + + DLLEXPORT void PxBounds3_setMaximal_mut(physx_PxBounds3* self__pod) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->setMaximal(); + } + + DLLEXPORT void PxBounds3_include_mut(physx_PxBounds3* self__pod, physx_PxVec3 const* v_pod) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + self_->include(v); + } + + DLLEXPORT void PxBounds3_include_mut_1(physx_PxBounds3* self__pod, physx_PxBounds3 const* b_pod) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& b = reinterpret_cast(*b_pod); + self_->include(b); + } + + DLLEXPORT bool PxBounds3_isEmpty(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isEmpty(); + return return_val; + } + + DLLEXPORT bool PxBounds3_intersects(physx_PxBounds3 const* self__pod, physx_PxBounds3 const* b_pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& b = reinterpret_cast(*b_pod); + bool return_val = self_->intersects(b); + return return_val; + } + + DLLEXPORT bool PxBounds3_intersects1D(physx_PxBounds3 const* self__pod, physx_PxBounds3 const* a_pod, uint32_t axis) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& a = reinterpret_cast(*a_pod); + bool return_val = self_->intersects1D(a, axis); + return return_val; + } + + DLLEXPORT bool PxBounds3_contains(physx_PxBounds3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + bool return_val = self_->contains(v); + return return_val; + } + + DLLEXPORT bool PxBounds3_isInside(physx_PxBounds3 const* self__pod, physx_PxBounds3 const* box_pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& box = reinterpret_cast(*box_pod); + bool return_val = self_->isInside(box); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxBounds3_getCenter(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getCenter(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxBounds3_getCenter_1(physx_PxBounds3 const* self__pod, uint32_t axis) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getCenter(axis); + return return_val; + } + + DLLEXPORT float PxBounds3_getExtents(physx_PxBounds3 const* self__pod, uint32_t axis) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getExtents(axis); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxBounds3_getDimensions(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getDimensions(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxBounds3_getExtents_1(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getExtents(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxBounds3_scaleSafe_mut(physx_PxBounds3* self__pod, float scale) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->scaleSafe(scale); + } + + DLLEXPORT void PxBounds3_scaleFast_mut(physx_PxBounds3* self__pod, float scale) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->scaleFast(scale); + } + + DLLEXPORT void PxBounds3_fattenSafe_mut(physx_PxBounds3* self__pod, float distance) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->fattenSafe(distance); + } + + DLLEXPORT void PxBounds3_fattenFast_mut(physx_PxBounds3* self__pod, float distance) { + physx::PxBounds3* self_ = reinterpret_cast(self__pod); + self_->fattenFast(distance); + } + + DLLEXPORT bool PxBounds3_isFinite(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT bool PxBounds3_isValid(physx_PxBounds3 const* self__pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxBounds3_closestPoint(physx_PxBounds3 const* self__pod, physx_PxVec3 const* p_pod) { + physx::PxBounds3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + physx::PxVec3 return_val = self_->closestPoint(p); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxErrorCallback_delete(physx_PxErrorCallback* self__pod) { + physx::PxErrorCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxErrorCallback_reportError_mut(physx_PxErrorCallback* self__pod, int32_t code_pod, char const* message, char const* file, int32_t line) { + physx::PxErrorCallback* self_ = reinterpret_cast(self__pod); + auto code = static_cast(code_pod); + self_->reportError(code, message, file, line); + } + + DLLEXPORT void PxAllocationListener_onAllocation_mut(physx_PxAllocationListener* self__pod, size_t size_pod, char const* typeName, char const* filename, int32_t line, void* allocatedMemory) { + physx::PxAllocationListener* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + self_->onAllocation(size, typeName, filename, line, allocatedMemory); + } + + DLLEXPORT void PxAllocationListener_onDeallocation_mut(physx_PxAllocationListener* self__pod, void* allocatedMemory) { + physx::PxAllocationListener* self_ = reinterpret_cast(self__pod); + self_->onDeallocation(allocatedMemory); + } + + DLLEXPORT physx_PxBroadcastingAllocator* PxBroadcastingAllocator_new_alloc(physx_PxAllocatorCallback* allocator_pod, physx_PxErrorCallback* error_pod) { + physx::PxAllocatorCallback& allocator = reinterpret_cast(*allocator_pod); + physx::PxErrorCallback& error = reinterpret_cast(*error_pod); + auto return_val = new physx::PxBroadcastingAllocator(allocator, error); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBroadcastingAllocator_delete(physx_PxBroadcastingAllocator* self__pod) { + physx::PxBroadcastingAllocator* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void* PxBroadcastingAllocator_allocate_mut(physx_PxBroadcastingAllocator* self__pod, size_t size_pod, char const* typeName, char const* filename, int32_t line) { + physx::PxBroadcastingAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, typeName, filename, line); + return return_val; + } + + DLLEXPORT void PxBroadcastingAllocator_deallocate_mut(physx_PxBroadcastingAllocator* self__pod, void* ptr) { + physx::PxBroadcastingAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT physx_PxBroadcastingErrorCallback* PxBroadcastingErrorCallback_new_alloc(physx_PxErrorCallback* errorCallback_pod) { + physx::PxErrorCallback& errorCallback = reinterpret_cast(*errorCallback_pod); + auto return_val = new physx::PxBroadcastingErrorCallback(errorCallback); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBroadcastingErrorCallback_delete(physx_PxBroadcastingErrorCallback* self__pod) { + physx::PxBroadcastingErrorCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxBroadcastingErrorCallback_reportError_mut(physx_PxBroadcastingErrorCallback* self__pod, int32_t code_pod, char const* message, char const* file, int32_t line) { + physx::PxBroadcastingErrorCallback* self_ = reinterpret_cast(self__pod); + auto code = static_cast(code_pod); + self_->reportError(code, message, file, line); + } + + DLLEXPORT void phys_PxEnableFPExceptions() { + PxEnableFPExceptions(); + } + + DLLEXPORT void phys_PxDisableFPExceptions() { + PxDisableFPExceptions(); + } + + DLLEXPORT uint32_t PxInputStream_read_mut(physx_PxInputStream* self__pod, void* dest, uint32_t count) { + physx::PxInputStream* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->read(dest, count); + return return_val; + } + + DLLEXPORT void PxInputStream_delete(physx_PxInputStream* self__pod) { + physx::PxInputStream* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxInputData_getLength(physx_PxInputData const* self__pod) { + physx::PxInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getLength(); + return return_val; + } + + DLLEXPORT void PxInputData_seek_mut(physx_PxInputData* self__pod, uint32_t offset) { + physx::PxInputData* self_ = reinterpret_cast(self__pod); + self_->seek(offset); + } + + DLLEXPORT uint32_t PxInputData_tell(physx_PxInputData const* self__pod) { + physx::PxInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->tell(); + return return_val; + } + + DLLEXPORT void PxInputData_delete(physx_PxInputData* self__pod) { + physx::PxInputData* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxOutputStream_write_mut(physx_PxOutputStream* self__pod, void const* src, uint32_t count) { + physx::PxOutputStream* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->write(src, count); + return return_val; + } + + DLLEXPORT void PxOutputStream_delete(physx_PxOutputStream* self__pod) { + physx::PxOutputStream* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxVec4 PxVec4_new() { + PxVec4 return_val; + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxVec4 return_val(anon_param0); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_new_2(float a) { + PxVec4 return_val(a); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_new_3(float nx, float ny, float nz, float nw) { + PxVec4 return_val(nx, ny, nz, nw); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_new_4(physx_PxVec3 const* v_pod, float nw) { + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + PxVec4 return_val(v, nw); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_new_5(float const* v) { + PxVec4 return_val(v); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxVec4_isZero(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isZero(); + return return_val; + } + + DLLEXPORT bool PxVec4_isFinite(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT bool PxVec4_isNormalized(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isNormalized(); + return return_val; + } + + DLLEXPORT float PxVec4_magnitudeSquared(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitudeSquared(); + return return_val; + } + + DLLEXPORT float PxVec4_magnitude(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitude(); + return return_val; + } + + DLLEXPORT float PxVec4_dot(physx_PxVec4 const* self__pod, physx_PxVec4 const* v_pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& v = reinterpret_cast(*v_pod); + float return_val = self_->dot(v); + return return_val; + } + + DLLEXPORT physx_PxVec4 PxVec4_getNormalized(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 return_val = self_->getNormalized(); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec4_normalize_mut(physx_PxVec4* self__pod) { + physx::PxVec4* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalize(); + return return_val; + } + + DLLEXPORT physx_PxVec4 PxVec4_multiply(physx_PxVec4 const* self__pod, physx_PxVec4 const* a_pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& a = reinterpret_cast(*a_pod); + physx::PxVec4 return_val = self_->multiply(a); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_minimum(physx_PxVec4 const* self__pod, physx_PxVec4 const* v_pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& v = reinterpret_cast(*v_pod); + physx::PxVec4 return_val = self_->minimum(v); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxVec4_maximum(physx_PxVec4 const* self__pod, physx_PxVec4 const* v_pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& v = reinterpret_cast(*v_pod); + physx::PxVec4 return_val = self_->maximum(v); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxVec4_getXYZ(physx_PxVec4 const* self__pod) { + physx::PxVec4 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getXYZ(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new() { + PxMat44 return_val; + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxMat44 return_val(anon_param0); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_2(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxMat44 return_val(anon_param0); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_3(physx_PxVec4 const* col0_pod, physx_PxVec4 const* col1_pod, physx_PxVec4 const* col2_pod, physx_PxVec4 const* col3_pod) { + physx::PxVec4 const& col0 = reinterpret_cast(*col0_pod); + physx::PxVec4 const& col1 = reinterpret_cast(*col1_pod); + physx::PxVec4 const& col2 = reinterpret_cast(*col2_pod); + physx::PxVec4 const& col3 = reinterpret_cast(*col3_pod); + PxMat44 return_val(col0, col1, col2, col3); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_4(float r) { + PxMat44 return_val(r); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_5(physx_PxVec3 const* col0_pod, physx_PxVec3 const* col1_pod, physx_PxVec3 const* col2_pod, physx_PxVec3 const* col3_pod) { + physx::PxVec3 const& col0 = reinterpret_cast(*col0_pod); + physx::PxVec3 const& col1 = reinterpret_cast(*col1_pod); + physx::PxVec3 const& col2 = reinterpret_cast(*col2_pod); + physx::PxVec3 const& col3 = reinterpret_cast(*col3_pod); + PxMat44 return_val(col0, col1, col2, col3); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_6(float* values) { + PxMat44 return_val(values); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_7(physx_PxQuat const* q_pod) { + physx::PxQuat const& q = reinterpret_cast(*q_pod); + PxMat44 return_val(q); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_8(physx_PxVec4 const* diagonal_pod) { + physx::PxVec4 const& diagonal = reinterpret_cast(*diagonal_pod); + PxMat44 return_val(diagonal); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_9(physx_PxMat33 const* axes_pod, physx_PxVec3 const* position_pod) { + physx::PxMat33 const& axes = reinterpret_cast(*axes_pod); + physx::PxVec3 const& position = reinterpret_cast(*position_pod); + PxMat44 return_val(axes, position); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_new_10(physx_PxTransform const* t_pod) { + physx::PxTransform const& t = reinterpret_cast(*t_pod); + PxMat44 return_val(t); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat44 PxMat44_getTranspose(physx_PxMat44 const* self__pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxMat44 return_val = self_->getTranspose(); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxMat44_transform(physx_PxMat44 const* self__pod, physx_PxVec4 const* other_pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& other = reinterpret_cast(*other_pod); + physx::PxVec4 return_val = self_->transform(other); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxMat44_transform_1(physx_PxMat44 const* self__pod, physx_PxVec3 const* other_pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& other = reinterpret_cast(*other_pod); + physx::PxVec3 return_val = self_->transform(other); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec4 PxMat44_rotate(physx_PxMat44 const* self__pod, physx_PxVec4 const* other_pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& other = reinterpret_cast(*other_pod); + physx::PxVec4 return_val = self_->rotate(other); + physx_PxVec4 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxMat44_rotate_1(physx_PxMat44 const* self__pod, physx_PxVec3 const* other_pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& other = reinterpret_cast(*other_pod); + physx::PxVec3 return_val = self_->rotate(other); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxMat44_getBasis(physx_PxMat44 const* self__pod, uint32_t num) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getBasis(num); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxMat44_getPosition(physx_PxMat44 const* self__pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getPosition(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxMat44_setPosition_mut(physx_PxMat44* self__pod, physx_PxVec3 const* position_pod) { + physx::PxMat44* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& position = reinterpret_cast(*position_pod); + self_->setPosition(position); + } + + DLLEXPORT float const* PxMat44_front(physx_PxMat44 const* self__pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + float const* return_val = self_->front(); + return return_val; + } + + DLLEXPORT void PxMat44_scale_mut(physx_PxMat44* self__pod, physx_PxVec4 const* p_pod) { + physx::PxMat44* self_ = reinterpret_cast(self__pod); + physx::PxVec4 const& p = reinterpret_cast(*p_pod); + self_->scale(p); + } + + DLLEXPORT physx_PxMat44 PxMat44_inverseRT(physx_PxMat44 const* self__pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + physx::PxMat44 return_val = self_->inverseRT(); + physx_PxMat44 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxMat44_isFinite(physx_PxMat44 const* self__pod) { + physx::PxMat44 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT physx_PxPlane PxPlane_new() { + PxPlane return_val; + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane PxPlane_new_1(float nx, float ny, float nz, float distance) { + PxPlane return_val(nx, ny, nz, distance); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane PxPlane_new_2(physx_PxVec3 const* normal_pod, float distance) { + physx::PxVec3 const& normal = reinterpret_cast(*normal_pod); + PxPlane return_val(normal, distance); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane PxPlane_new_3(physx_PxVec3 const* point_pod, physx_PxVec3 const* normal_pod) { + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec3 const& normal = reinterpret_cast(*normal_pod); + PxPlane return_val(point, normal); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane PxPlane_new_4(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, physx_PxVec3 const* p2_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxVec3 const& p2 = reinterpret_cast(*p2_pod); + PxPlane return_val(p0, p1, p2); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxPlane_distance(physx_PxPlane const* self__pod, physx_PxVec3 const* p_pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + float return_val = self_->distance(p); + return return_val; + } + + DLLEXPORT bool PxPlane_contains(physx_PxPlane const* self__pod, physx_PxVec3 const* p_pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + bool return_val = self_->contains(p); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxPlane_project(physx_PxPlane const* self__pod, physx_PxVec3 const* p_pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + physx::PxVec3 return_val = self_->project(p); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxPlane_pointInPlane(physx_PxPlane const* self__pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->pointInPlane(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPlane_normalize_mut(physx_PxPlane* self__pod) { + physx::PxPlane* self_ = reinterpret_cast(self__pod); + self_->normalize(); + } + + DLLEXPORT physx_PxPlane PxPlane_transform(physx_PxPlane const* self__pod, physx_PxTransform const* pose_pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxPlane return_val = self_->transform(pose); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane PxPlane_inverseTransform(physx_PxPlane const* self__pod, physx_PxTransform const* pose_pod) { + physx::PxPlane const* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxPlane return_val = self_->inverseTransform(pose); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat phys_PxShortestRotation(physx_PxVec3 const* from_pod, physx_PxVec3 const* target_pod) { + physx::PxVec3 const& from = reinterpret_cast(*from_pod); + physx::PxVec3 const& target = reinterpret_cast(*target_pod); + physx::PxQuat return_val = PxShortestRotation(from, target); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 phys_PxDiagonalize(physx_PxMat33 const* m_pod, physx_PxQuat* axes_pod) { + physx::PxMat33 const& m = reinterpret_cast(*m_pod); + physx::PxQuat& axes = reinterpret_cast(*axes_pod); + physx::PxVec3 return_val = PxDiagonalize(m, axes); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform phys_PxTransformFromSegment(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, float* halfHeight) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxTransform return_val = PxTransformFromSegment(p0, p1, halfHeight); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform phys_PxTransformFromPlaneEquation(physx_PxPlane const* plane_pod) { + physx::PxPlane const& plane = reinterpret_cast(*plane_pod); + physx::PxTransform return_val = PxTransformFromPlaneEquation(plane); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPlane phys_PxPlaneEquationFromTransform(physx_PxTransform const* pose_pod) { + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxPlane return_val = PxPlaneEquationFromTransform(pose); + physx_PxPlane return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQuat phys_PxSlerp(float t, physx_PxQuat const* left_pod, physx_PxQuat const* right_pod) { + physx::PxQuat const& left = reinterpret_cast(*left_pod); + physx::PxQuat const& right = reinterpret_cast(*right_pod); + physx::PxQuat return_val = PxSlerp(t, left, right); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void phys_PxIntegrateTransform(physx_PxTransform const* curTrans_pod, physx_PxVec3 const* linvel_pod, physx_PxVec3 const* angvel_pod, float timeStep, physx_PxTransform* result_pod) { + physx::PxTransform const& curTrans = reinterpret_cast(*curTrans_pod); + physx::PxVec3 const& linvel = reinterpret_cast(*linvel_pod); + physx::PxVec3 const& angvel = reinterpret_cast(*angvel_pod); + physx::PxTransform& result = reinterpret_cast(*result_pod); + PxIntegrateTransform(curTrans, linvel, angvel, timeStep, result); + } + + DLLEXPORT physx_PxQuat phys_PxExp(physx_PxVec3 const* v_pod) { + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxQuat return_val = PxExp(v); + physx_PxQuat return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 phys_PxOptimizeBoundingBox(physx_PxMat33* basis_pod) { + physx::PxMat33& basis = reinterpret_cast(*basis_pod); + physx::PxVec3 return_val = PxOptimizeBoundingBox(basis); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 phys_PxLog(physx_PxQuat const* q_pod) { + physx::PxQuat const& q = reinterpret_cast(*q_pod); + physx::PxVec3 return_val = PxLog(q); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxLargestAxis(physx_PxVec3 const* v_pod) { + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + uint32_t return_val = PxLargestAxis(v); + return return_val; + } + + DLLEXPORT float phys_PxTanHalf(float sin, float cos) { + float return_val = PxTanHalf(sin, cos); + return return_val; + } + + DLLEXPORT physx_PxVec3 phys_PxEllipseClamp(physx_PxVec3 const* point_pod, physx_PxVec3 const* radii_pod) { + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec3 const& radii = reinterpret_cast(*radii_pod); + physx::PxVec3 return_val = PxEllipseClamp(point, radii); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void phys_PxSeparateSwingTwist(physx_PxQuat const* q_pod, physx_PxQuat* swing_pod, physx_PxQuat* twist_pod) { + physx::PxQuat const& q = reinterpret_cast(*q_pod); + physx::PxQuat& swing = reinterpret_cast(*swing_pod); + physx::PxQuat& twist = reinterpret_cast(*twist_pod); + PxSeparateSwingTwist(q, swing, twist); + } + + DLLEXPORT float phys_PxComputeAngle(physx_PxVec3 const* v0_pod, physx_PxVec3 const* v1_pod) { + physx::PxVec3 const& v0 = reinterpret_cast(*v0_pod); + physx::PxVec3 const& v1 = reinterpret_cast(*v1_pod); + float return_val = PxComputeAngle(v0, v1); + return return_val; + } + + DLLEXPORT void phys_PxComputeBasisVectors(physx_PxVec3 const* dir_pod, physx_PxVec3* right_pod, physx_PxVec3* up_pod) { + physx::PxVec3 const& dir = reinterpret_cast(*dir_pod); + physx::PxVec3& right = reinterpret_cast(*right_pod); + physx::PxVec3& up = reinterpret_cast(*up_pod); + PxComputeBasisVectors(dir, right, up); + } + + DLLEXPORT void phys_PxComputeBasisVectors_1(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, physx_PxVec3* dir_pod, physx_PxVec3* right_pod, physx_PxVec3* up_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxVec3& dir = reinterpret_cast(*dir_pod); + physx::PxVec3& right = reinterpret_cast(*right_pod); + physx::PxVec3& up = reinterpret_cast(*up_pod); + PxComputeBasisVectors(p0, p1, dir, right, up); + } + + DLLEXPORT uint32_t phys_PxGetNextIndex3(uint32_t i) { + uint32_t return_val = PxGetNextIndex3(i); + return return_val; + } + + DLLEXPORT void phys_computeBarycentric(physx_PxVec3 const* a_pod, physx_PxVec3 const* b_pod, physx_PxVec3 const* c_pod, physx_PxVec3 const* d_pod, physx_PxVec3 const* p_pod, physx_PxVec4* bary_pod) { + physx::PxVec3 const& a = reinterpret_cast(*a_pod); + physx::PxVec3 const& b = reinterpret_cast(*b_pod); + physx::PxVec3 const& c = reinterpret_cast(*c_pod); + physx::PxVec3 const& d = reinterpret_cast(*d_pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + physx::PxVec4& bary = reinterpret_cast(*bary_pod); + computeBarycentric(a, b, c, d, p, bary); + } + + DLLEXPORT void phys_computeBarycentric_1(physx_PxVec3 const* a_pod, physx_PxVec3 const* b_pod, physx_PxVec3 const* c_pod, physx_PxVec3 const* p_pod, physx_PxVec4* bary_pod) { + physx::PxVec3 const& a = reinterpret_cast(*a_pod); + physx::PxVec3 const& b = reinterpret_cast(*b_pod); + physx::PxVec3 const& c = reinterpret_cast(*c_pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + physx::PxVec4& bary = reinterpret_cast(*bary_pod); + computeBarycentric(a, b, c, p, bary); + } + + DLLEXPORT float Interpolation_PxLerp(float a, float b, float t) { + float return_val = Interpolation::PxLerp(a, b, t); + return return_val; + } + + DLLEXPORT float Interpolation_PxBiLerp(float f00, float f10, float f01, float f11, float tx, float ty) { + float return_val = Interpolation::PxBiLerp(f00, f10, f01, f11, tx, ty); + return return_val; + } + + DLLEXPORT float Interpolation_PxTriLerp(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111, float tx, float ty, float tz) { + float return_val = Interpolation::PxTriLerp(f000, f100, f010, f110, f001, f101, f011, f111, tx, ty, tz); + return return_val; + } + + DLLEXPORT uint32_t Interpolation_PxSDFIdx(uint32_t i, uint32_t j, uint32_t k, uint32_t nbX, uint32_t nbY) { + uint32_t return_val = Interpolation::PxSDFIdx(i, j, k, nbX, nbY); + return return_val; + } + + DLLEXPORT float Interpolation_PxSDFSampleImpl(float const* sdf, physx_PxVec3 const* localPos_pod, physx_PxVec3 const* sdfBoxLower_pod, physx_PxVec3 const* sdfBoxHigher_pod, float sdfDx, float invSdfDx, uint32_t dimX, uint32_t dimY, uint32_t dimZ, float tolerance) { + physx::PxVec3 const& localPos = reinterpret_cast(*localPos_pod); + physx::PxVec3 const& sdfBoxLower = reinterpret_cast(*sdfBoxLower_pod); + physx::PxVec3 const& sdfBoxHigher = reinterpret_cast(*sdfBoxHigher_pod); + float return_val = Interpolation::PxSDFSampleImpl(sdf, localPos, sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, tolerance); + return return_val; + } + + DLLEXPORT float phys_PxSdfSample(float const* sdf, physx_PxVec3 const* localPos_pod, physx_PxVec3 const* sdfBoxLower_pod, physx_PxVec3 const* sdfBoxHigher_pod, float sdfDx, float invSdfDx, uint32_t dimX, uint32_t dimY, uint32_t dimZ, physx_PxVec3* gradient_pod, float tolerance) { + physx::PxVec3 const& localPos = reinterpret_cast(*localPos_pod); + physx::PxVec3 const& sdfBoxLower = reinterpret_cast(*sdfBoxLower_pod); + physx::PxVec3 const& sdfBoxHigher = reinterpret_cast(*sdfBoxHigher_pod); + physx::PxVec3& gradient = reinterpret_cast(*gradient_pod); + float return_val = PxSdfSample(sdf, localPos, sdfBoxLower, sdfBoxHigher, sdfDx, invSdfDx, dimX, dimY, dimZ, gradient, tolerance); + return return_val; + } + + DLLEXPORT physx_PxMutexImpl* PxMutexImpl_new_alloc() { + auto return_val = new physx::PxMutexImpl(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxMutexImpl_delete(physx_PxMutexImpl* self__pod) { + physx::PxMutexImpl* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxMutexImpl_lock_mut(physx_PxMutexImpl* self__pod) { + physx::PxMutexImpl* self_ = reinterpret_cast(self__pod); + self_->lock(); + } + + DLLEXPORT bool PxMutexImpl_trylock_mut(physx_PxMutexImpl* self__pod) { + physx::PxMutexImpl* self_ = reinterpret_cast(self__pod); + bool return_val = self_->trylock(); + return return_val; + } + + DLLEXPORT void PxMutexImpl_unlock_mut(physx_PxMutexImpl* self__pod) { + physx::PxMutexImpl* self_ = reinterpret_cast(self__pod); + self_->unlock(); + } + + DLLEXPORT uint32_t PxMutexImpl_getSize() { + uint32_t return_val = PxMutexImpl::getSize(); + return return_val; + } + + DLLEXPORT physx_PxReadWriteLock* PxReadWriteLock_new_alloc() { + auto return_val = new physx::PxReadWriteLock(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxReadWriteLock_delete(physx_PxReadWriteLock* self__pod) { + physx::PxReadWriteLock* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxReadWriteLock_lockReader_mut(physx_PxReadWriteLock* self__pod, bool takeLock) { + physx::PxReadWriteLock* self_ = reinterpret_cast(self__pod); + self_->lockReader(takeLock); + } + + DLLEXPORT void PxReadWriteLock_lockWriter_mut(physx_PxReadWriteLock* self__pod) { + physx::PxReadWriteLock* self_ = reinterpret_cast(self__pod); + self_->lockWriter(); + } + + DLLEXPORT void PxReadWriteLock_unlockReader_mut(physx_PxReadWriteLock* self__pod) { + physx::PxReadWriteLock* self_ = reinterpret_cast(self__pod); + self_->unlockReader(); + } + + DLLEXPORT void PxReadWriteLock_unlockWriter_mut(physx_PxReadWriteLock* self__pod) { + physx::PxReadWriteLock* self_ = reinterpret_cast(self__pod); + self_->unlockWriter(); + } + + DLLEXPORT void* PxProfilerCallback_zoneStart_mut(physx_PxProfilerCallback* self__pod, char const* eventName, bool detached, uint64_t contextId) { + physx::PxProfilerCallback* self_ = reinterpret_cast(self__pod); + void* return_val = self_->zoneStart(eventName, detached, contextId); + return return_val; + } + + DLLEXPORT void PxProfilerCallback_zoneEnd_mut(physx_PxProfilerCallback* self__pod, void* profilerData, char const* eventName, bool detached, uint64_t contextId) { + physx::PxProfilerCallback* self_ = reinterpret_cast(self__pod); + self_->zoneEnd(profilerData, eventName, detached, contextId); + } + + DLLEXPORT physx_PxProfileScoped* PxProfileScoped_new_alloc(physx_PxProfilerCallback* callback_pod, char const* eventName, bool detached, uint64_t contextId) { + physx::PxProfilerCallback* callback = reinterpret_cast(callback_pod); + auto return_val = new physx::PxProfileScoped(callback, eventName, detached, contextId); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxProfileScoped_delete(physx_PxProfileScoped* self__pod) { + physx::PxProfileScoped* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxSListEntry PxSListEntry_new() { + PxSListEntry return_val; + physx_PxSListEntry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxSListEntry* PxSListEntry_next_mut(physx_PxSListEntry* self__pod) { + physx::PxSListEntry* self_ = reinterpret_cast(self__pod); + physx::PxSListEntry* return_val = self_->next(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSListImpl* PxSListImpl_new_alloc() { + auto return_val = new physx::PxSListImpl(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSListImpl_delete(physx_PxSListImpl* self__pod) { + physx::PxSListImpl* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxSListImpl_push_mut(physx_PxSListImpl* self__pod, physx_PxSListEntry* entry_pod) { + physx::PxSListImpl* self_ = reinterpret_cast(self__pod); + physx::PxSListEntry* entry = reinterpret_cast(entry_pod); + self_->push(entry); + } + + DLLEXPORT physx_PxSListEntry* PxSListImpl_pop_mut(physx_PxSListImpl* self__pod) { + physx::PxSListImpl* self_ = reinterpret_cast(self__pod); + physx::PxSListEntry* return_val = self_->pop(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSListEntry* PxSListImpl_flush_mut(physx_PxSListImpl* self__pod) { + physx::PxSListImpl* self_ = reinterpret_cast(self__pod); + physx::PxSListEntry* return_val = self_->flush(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxSListImpl_getSize() { + uint32_t return_val = PxSListImpl::getSize(); + return return_val; + } + + DLLEXPORT physx_PxSyncImpl* PxSyncImpl_new_alloc() { + auto return_val = new physx::PxSyncImpl(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSyncImpl_delete(physx_PxSyncImpl* self__pod) { + physx::PxSyncImpl* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT bool PxSyncImpl_wait_mut(physx_PxSyncImpl* self__pod, uint32_t milliseconds) { + physx::PxSyncImpl* self_ = reinterpret_cast(self__pod); + bool return_val = self_->wait(milliseconds); + return return_val; + } + + DLLEXPORT void PxSyncImpl_set_mut(physx_PxSyncImpl* self__pod) { + physx::PxSyncImpl* self_ = reinterpret_cast(self__pod); + self_->set(); + } + + DLLEXPORT void PxSyncImpl_reset_mut(physx_PxSyncImpl* self__pod) { + physx::PxSyncImpl* self_ = reinterpret_cast(self__pod); + self_->reset(); + } + + DLLEXPORT uint32_t PxSyncImpl_getSize() { + uint32_t return_val = PxSyncImpl::getSize(); + return return_val; + } + + DLLEXPORT physx_PxRunnable* PxRunnable_new_alloc() { + auto return_val = new physx::PxRunnable(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxRunnable_delete(physx_PxRunnable* self__pod) { + physx::PxRunnable* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxRunnable_execute_mut(physx_PxRunnable* self__pod) { + physx::PxRunnable* self_ = reinterpret_cast(self__pod); + self_->execute(); + } + + DLLEXPORT uint32_t phys_PxTlsAlloc() { + uint32_t return_val = PxTlsAlloc(); + return return_val; + } + + DLLEXPORT void phys_PxTlsFree(uint32_t index) { + PxTlsFree(index); + } + + DLLEXPORT void* phys_PxTlsGet(uint32_t index) { + void* return_val = PxTlsGet(index); + return return_val; + } + + DLLEXPORT size_t phys_PxTlsGetValue(uint32_t index) { + size_t return_val = PxTlsGetValue(index); + size_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxTlsSet(uint32_t index, void* value) { + uint32_t return_val = PxTlsSet(index, value); + return return_val; + } + + DLLEXPORT uint32_t phys_PxTlsSetValue(uint32_t index, size_t value_pod) { + size_t value; + memcpy(&value, &value_pod, sizeof(value)); + uint32_t return_val = PxTlsSetValue(index, value); + return return_val; + } + + DLLEXPORT physx_PxCounterFrequencyToTensOfNanos PxCounterFrequencyToTensOfNanos_new(uint64_t inNum, uint64_t inDenom) { + PxCounterFrequencyToTensOfNanos return_val(inNum, inDenom); + physx_PxCounterFrequencyToTensOfNanos return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint64_t PxCounterFrequencyToTensOfNanos_toTensOfNanos(physx_PxCounterFrequencyToTensOfNanos const* self__pod, uint64_t inCounter) { + physx::PxCounterFrequencyToTensOfNanos const* self_ = reinterpret_cast(self__pod); + uint64_t return_val = self_->toTensOfNanos(inCounter); + return return_val; + } + + DLLEXPORT physx_PxCounterFrequencyToTensOfNanos const* PxTime_getBootCounterFrequency() { + physx::PxCounterFrequencyToTensOfNanos const& return_val = PxTime::getBootCounterFrequency(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCounterFrequencyToTensOfNanos PxTime_getCounterFrequency() { + physx::PxCounterFrequencyToTensOfNanos return_val = PxTime::getCounterFrequency(); + physx_PxCounterFrequencyToTensOfNanos return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint64_t PxTime_getCurrentCounterValue() { + uint64_t return_val = PxTime::getCurrentCounterValue(); + return return_val; + } + + DLLEXPORT uint64_t PxTime_getCurrentTimeInTensOfNanoSeconds() { + uint64_t return_val = PxTime::getCurrentTimeInTensOfNanoSeconds(); + return return_val; + } + + DLLEXPORT physx_PxTime PxTime_new() { + PxTime return_val; + physx_PxTime return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT double PxTime_getElapsedSeconds_mut(physx_PxTime* self__pod) { + physx::PxTime* self_ = reinterpret_cast(self__pod); + double return_val = self_->getElapsedSeconds(); + return return_val; + } + + DLLEXPORT double PxTime_peekElapsedSeconds_mut(physx_PxTime* self__pod) { + physx::PxTime* self_ = reinterpret_cast(self__pod); + double return_val = self_->peekElapsedSeconds(); + return return_val; + } + + DLLEXPORT double PxTime_getLastTime(physx_PxTime const* self__pod) { + physx::PxTime const* self_ = reinterpret_cast(self__pod); + double return_val = self_->getLastTime(); + return return_val; + } + + DLLEXPORT physx_PxVec2 PxVec2_new() { + PxVec2 return_val; + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec2 PxVec2_new_1(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxVec2 return_val(anon_param0); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec2 PxVec2_new_2(float a) { + PxVec2 return_val(a); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec2 PxVec2_new_3(float nx, float ny) { + PxVec2 return_val(nx, ny); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxVec2_isZero(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isZero(); + return return_val; + } + + DLLEXPORT bool PxVec2_isFinite(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT bool PxVec2_isNormalized(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isNormalized(); + return return_val; + } + + DLLEXPORT float PxVec2_magnitudeSquared(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitudeSquared(); + return return_val; + } + + DLLEXPORT float PxVec2_magnitude(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->magnitude(); + return return_val; + } + + DLLEXPORT float PxVec2_dot(physx_PxVec2 const* self__pod, physx_PxVec2 const* v_pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + physx::PxVec2 const& v = reinterpret_cast(*v_pod); + float return_val = self_->dot(v); + return return_val; + } + + DLLEXPORT physx_PxVec2 PxVec2_getNormalized(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + physx::PxVec2 return_val = self_->getNormalized(); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec2_normalize_mut(physx_PxVec2* self__pod) { + physx::PxVec2* self_ = reinterpret_cast(self__pod); + float return_val = self_->normalize(); + return return_val; + } + + DLLEXPORT physx_PxVec2 PxVec2_multiply(physx_PxVec2 const* self__pod, physx_PxVec2 const* a_pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + physx::PxVec2 const& a = reinterpret_cast(*a_pod); + physx::PxVec2 return_val = self_->multiply(a); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec2 PxVec2_minimum(physx_PxVec2 const* self__pod, physx_PxVec2 const* v_pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + physx::PxVec2 const& v = reinterpret_cast(*v_pod); + physx::PxVec2 return_val = self_->minimum(v); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec2_minElement(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->minElement(); + return return_val; + } + + DLLEXPORT physx_PxVec2 PxVec2_maximum(physx_PxVec2 const* self__pod, physx_PxVec2 const* v_pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + physx::PxVec2 const& v = reinterpret_cast(*v_pod); + physx::PxVec2 return_val = self_->maximum(v); + physx_PxVec2 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxVec2_maxElement(physx_PxVec2 const* self__pod) { + physx::PxVec2 const* self_ = reinterpret_cast(self__pod); + float return_val = self_->maxElement(); + return return_val; + } + + DLLEXPORT physx_PxStridedData PxStridedData_new() { + PxStridedData return_val; + physx_PxStridedData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBoundedData PxBoundedData_new() { + PxBoundedData return_val; + physx_PxBoundedData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugPoint PxDebugPoint_new(physx_PxVec3 const* p_pod, uint32_t const* c_pod) { + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + uint32_t const& c = *c_pod; + PxDebugPoint return_val(p, c); + physx_PxDebugPoint return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugLine PxDebugLine_new(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, uint32_t const* c_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + uint32_t const& c = *c_pod; + PxDebugLine return_val(p0, p1, c); + physx_PxDebugLine return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugTriangle PxDebugTriangle_new(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, physx_PxVec3 const* p2_pod, uint32_t const* c_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxVec3 const& p2 = reinterpret_cast(*p2_pod); + uint32_t const& c = *c_pod; + PxDebugTriangle return_val(p0, p1, p2, c); + physx_PxDebugTriangle return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugText PxDebugText_new() { + PxDebugText return_val; + physx_PxDebugText return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugText PxDebugText_new_1(physx_PxVec3 const* pos_pod, float const* sz_pod, uint32_t const* clr_pod, char const* str) { + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + float const& sz = *sz_pod; + uint32_t const& clr = *clr_pod; + PxDebugText return_val(pos, sz, clr, str); + physx_PxDebugText return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRenderBuffer_delete(physx_PxRenderBuffer* self__pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxRenderBuffer_getNbPoints(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbPoints(); + return return_val; + } + + DLLEXPORT physx_PxDebugPoint const* PxRenderBuffer_getPoints(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + physx::PxDebugPoint const* return_val = self_->getPoints(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxRenderBuffer_addPoint_mut(physx_PxRenderBuffer* self__pod, physx_PxDebugPoint const* point_pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxDebugPoint const& point = reinterpret_cast(*point_pod); + self_->addPoint(point); + } + + DLLEXPORT uint32_t PxRenderBuffer_getNbLines(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbLines(); + return return_val; + } + + DLLEXPORT physx_PxDebugLine const* PxRenderBuffer_getLines(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + physx::PxDebugLine const* return_val = self_->getLines(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxRenderBuffer_addLine_mut(physx_PxRenderBuffer* self__pod, physx_PxDebugLine const* line_pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxDebugLine const& line = reinterpret_cast(*line_pod); + self_->addLine(line); + } + + DLLEXPORT physx_PxDebugLine* PxRenderBuffer_reserveLines_mut(physx_PxRenderBuffer* self__pod, uint32_t nbLines) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxDebugLine* return_val = self_->reserveLines(nbLines); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxDebugPoint* PxRenderBuffer_reservePoints_mut(physx_PxRenderBuffer* self__pod, uint32_t nbLines) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxDebugPoint* return_val = self_->reservePoints(nbLines); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxRenderBuffer_getNbTriangles(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTriangles(); + return return_val; + } + + DLLEXPORT physx_PxDebugTriangle const* PxRenderBuffer_getTriangles(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + physx::PxDebugTriangle const* return_val = self_->getTriangles(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxRenderBuffer_addTriangle_mut(physx_PxRenderBuffer* self__pod, physx_PxDebugTriangle const* triangle_pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxDebugTriangle const& triangle = reinterpret_cast(*triangle_pod); + self_->addTriangle(triangle); + } + + DLLEXPORT void PxRenderBuffer_append_mut(physx_PxRenderBuffer* self__pod, physx_PxRenderBuffer const* other_pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxRenderBuffer const& other = reinterpret_cast(*other_pod); + self_->append(other); + } + + DLLEXPORT void PxRenderBuffer_clear_mut(physx_PxRenderBuffer* self__pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + self_->clear(); + } + + DLLEXPORT void PxRenderBuffer_shift_mut(physx_PxRenderBuffer* self__pod, physx_PxVec3 const* delta_pod) { + physx::PxRenderBuffer* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& delta = reinterpret_cast(*delta_pod); + self_->shift(delta); + } + + DLLEXPORT bool PxRenderBuffer_empty(physx_PxRenderBuffer const* self__pod) { + physx::PxRenderBuffer const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->empty(); + return return_val; + } + + DLLEXPORT void PxProcessPxBaseCallback_delete(physx_PxProcessPxBaseCallback* self__pod) { + physx::PxProcessPxBaseCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxProcessPxBaseCallback_process_mut(physx_PxProcessPxBaseCallback* self__pod, physx_PxBase* anon_param0_pod) { + physx::PxProcessPxBaseCallback* self_ = reinterpret_cast(self__pod); + physx::PxBase& anon_param0 = reinterpret_cast(*anon_param0_pod); + self_->process(anon_param0); + } + + DLLEXPORT void PxSerializationContext_registerReference_mut(physx_PxSerializationContext* self__pod, physx_PxBase* base_pod, uint32_t kind, size_t reference_pod) { + physx::PxSerializationContext* self_ = reinterpret_cast(self__pod); + physx::PxBase& base = reinterpret_cast(*base_pod); + size_t reference; + memcpy(&reference, &reference_pod, sizeof(reference)); + self_->registerReference(base, kind, reference); + } + + DLLEXPORT physx_PxCollection const* PxSerializationContext_getCollection(physx_PxSerializationContext const* self__pod) { + physx::PxSerializationContext const* self_ = reinterpret_cast(self__pod); + physx::PxCollection const& return_val = self_->getCollection(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxSerializationContext_writeData_mut(physx_PxSerializationContext* self__pod, void const* data, uint32_t size) { + physx::PxSerializationContext* self_ = reinterpret_cast(self__pod); + self_->writeData(data, size); + } + + DLLEXPORT void PxSerializationContext_alignData_mut(physx_PxSerializationContext* self__pod, uint32_t alignment) { + physx::PxSerializationContext* self_ = reinterpret_cast(self__pod); + self_->alignData(alignment); + } + + DLLEXPORT void PxSerializationContext_writeName_mut(physx_PxSerializationContext* self__pod, char const* name) { + physx::PxSerializationContext* self_ = reinterpret_cast(self__pod); + self_->writeName(name); + } + + DLLEXPORT physx_PxBase* PxDeserializationContext_resolveReference(physx_PxDeserializationContext const* self__pod, uint32_t kind, size_t reference_pod) { + physx::PxDeserializationContext const* self_ = reinterpret_cast(self__pod); + size_t reference; + memcpy(&reference, &reference_pod, sizeof(reference)); + physx::PxBase* return_val = self_->resolveReference(kind, reference); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDeserializationContext_readName_mut(physx_PxDeserializationContext* self__pod, char const** name_pod) { + physx::PxDeserializationContext* self_ = reinterpret_cast(self__pod); + char const*& name = reinterpret_cast(*name_pod); + self_->readName(name); + } + + DLLEXPORT void PxDeserializationContext_alignExtraData_mut(physx_PxDeserializationContext* self__pod, uint32_t alignment) { + physx::PxDeserializationContext* self_ = reinterpret_cast(self__pod); + self_->alignExtraData(alignment); + } + + DLLEXPORT void PxSerializationRegistry_registerSerializer_mut(physx_PxSerializationRegistry* self__pod, uint16_t type, physx_PxSerializer* serializer_pod) { + physx::PxSerializationRegistry* self_ = reinterpret_cast(self__pod); + physx::PxSerializer& serializer = reinterpret_cast(*serializer_pod); + self_->registerSerializer(type, serializer); + } + + DLLEXPORT physx_PxSerializer* PxSerializationRegistry_unregisterSerializer_mut(physx_PxSerializationRegistry* self__pod, uint16_t type) { + physx::PxSerializationRegistry* self_ = reinterpret_cast(self__pod); + physx::PxSerializer* return_val = self_->unregisterSerializer(type); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSerializer const* PxSerializationRegistry_getSerializer(physx_PxSerializationRegistry const* self__pod, uint16_t type) { + physx::PxSerializationRegistry const* self_ = reinterpret_cast(self__pod); + physx::PxSerializer const* return_val = self_->getSerializer(type); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSerializationRegistry_registerRepXSerializer_mut(physx_PxSerializationRegistry* self__pod, uint16_t type, physx_PxRepXSerializer* serializer_pod) { + physx::PxSerializationRegistry* self_ = reinterpret_cast(self__pod); + physx::PxRepXSerializer& serializer = reinterpret_cast(*serializer_pod); + self_->registerRepXSerializer(type, serializer); + } + + DLLEXPORT physx_PxRepXSerializer* PxSerializationRegistry_unregisterRepXSerializer_mut(physx_PxSerializationRegistry* self__pod, uint16_t type) { + physx::PxSerializationRegistry* self_ = reinterpret_cast(self__pod); + physx::PxRepXSerializer* return_val = self_->unregisterRepXSerializer(type); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRepXSerializer* PxSerializationRegistry_getRepXSerializer(physx_PxSerializationRegistry const* self__pod, char const* typeName) { + physx::PxSerializationRegistry const* self_ = reinterpret_cast(self__pod); + physx::PxRepXSerializer* return_val = self_->getRepXSerializer(typeName); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSerializationRegistry_release_mut(physx_PxSerializationRegistry* self__pod) { + physx::PxSerializationRegistry* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxCollection_add_mut(physx_PxCollection* self__pod, physx_PxBase* object_pod, uint64_t id) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + physx::PxBase& object = reinterpret_cast(*object_pod); + self_->add(object, id); + } + + DLLEXPORT void PxCollection_remove_mut(physx_PxCollection* self__pod, physx_PxBase* object_pod) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + physx::PxBase& object = reinterpret_cast(*object_pod); + self_->remove(object); + } + + DLLEXPORT bool PxCollection_contains(physx_PxCollection const* self__pod, physx_PxBase* object_pod) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + physx::PxBase& object = reinterpret_cast(*object_pod); + bool return_val = self_->contains(object); + return return_val; + } + + DLLEXPORT void PxCollection_addId_mut(physx_PxCollection* self__pod, physx_PxBase* object_pod, uint64_t id) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + physx::PxBase& object = reinterpret_cast(*object_pod); + self_->addId(object, id); + } + + DLLEXPORT void PxCollection_removeId_mut(physx_PxCollection* self__pod, uint64_t id) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + self_->removeId(id); + } + + DLLEXPORT void PxCollection_add_mut_1(physx_PxCollection* self__pod, physx_PxCollection* collection_pod) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + self_->add(collection); + } + + DLLEXPORT void PxCollection_remove_mut_1(physx_PxCollection* self__pod, physx_PxCollection* collection_pod) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + self_->remove(collection); + } + + DLLEXPORT uint32_t PxCollection_getNbObjects(physx_PxCollection const* self__pod) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbObjects(); + return return_val; + } + + DLLEXPORT physx_PxBase* PxCollection_getObject(physx_PxCollection const* self__pod, uint32_t index) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + physx::PxBase& return_val = self_->getObject(index); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxCollection_getObjects(physx_PxCollection const* self__pod, physx_PxBase** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + physx::PxBase** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getObjects(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxBase* PxCollection_find(physx_PxCollection const* self__pod, uint64_t id) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + physx::PxBase* return_val = self_->find(id); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxCollection_getNbIds(physx_PxCollection const* self__pod) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbIds(); + return return_val; + } + + DLLEXPORT uint32_t PxCollection_getIds(physx_PxCollection const* self__pod, uint64_t* userBuffer, uint32_t bufferSize, uint32_t startIndex) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getIds(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint64_t PxCollection_getId(physx_PxCollection const* self__pod, physx_PxBase const* object_pod) { + physx::PxCollection const* self_ = reinterpret_cast(self__pod); + physx::PxBase const& object = reinterpret_cast(*object_pod); + uint64_t return_val = self_->getId(object); + return return_val; + } + + DLLEXPORT void PxCollection_release_mut(physx_PxCollection* self__pod) { + physx::PxCollection* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxCollection* phys_PxCreateCollection() { + physx::PxCollection* return_val = PxCreateCollection(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBase_release_mut(physx_PxBase* self__pod) { + physx::PxBase* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT char const* PxBase_getConcreteTypeName(physx_PxBase const* self__pod) { + physx::PxBase const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT uint16_t PxBase_getConcreteType(physx_PxBase const* self__pod) { + physx::PxBase const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getConcreteType(); + return return_val; + } + + DLLEXPORT void PxBase_setBaseFlag_mut(physx_PxBase* self__pod, int32_t flag_pod, bool value) { + physx::PxBase* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setBaseFlag(flag, value); + } + + DLLEXPORT void PxBase_setBaseFlags_mut(physx_PxBase* self__pod, uint16_t inFlags_pod) { + physx::PxBase* self_ = reinterpret_cast(self__pod); + auto inFlags = physx::PxBaseFlags(inFlags_pod); + self_->setBaseFlags(inFlags); + } + + DLLEXPORT uint16_t PxBase_getBaseFlags(physx_PxBase const* self__pod) { + physx::PxBase const* self_ = reinterpret_cast(self__pod); + physx::PxBaseFlags return_val = self_->getBaseFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxBase_isReleasable(physx_PxBase const* self__pod) { + physx::PxBase const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isReleasable(); + return return_val; + } + + DLLEXPORT void PxRefCounted_release_mut(physx_PxRefCounted* self__pod) { + physx::PxRefCounted* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxRefCounted_getReferenceCount(physx_PxRefCounted const* self__pod) { + physx::PxRefCounted const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getReferenceCount(); + return return_val; + } + + DLLEXPORT void PxRefCounted_acquireReference_mut(physx_PxRefCounted* self__pod) { + physx::PxRefCounted* self_ = reinterpret_cast(self__pod); + self_->acquireReference(); + } + + DLLEXPORT physx_PxTolerancesScale PxTolerancesScale_new(float defaultLength, float defaultSpeed) { + PxTolerancesScale return_val(defaultLength, defaultSpeed); + physx_PxTolerancesScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxTolerancesScale_isValid(physx_PxTolerancesScale const* self__pod) { + physx::PxTolerancesScale const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT char const* PxStringTable_allocateStr_mut(physx_PxStringTable* self__pod, char const* inSrc) { + physx::PxStringTable* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->allocateStr(inSrc); + return return_val; + } + + DLLEXPORT void PxStringTable_release_mut(physx_PxStringTable* self__pod) { + physx::PxStringTable* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT char const* PxSerializer_getConcreteTypeName(physx_PxSerializer const* self__pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxSerializer_requiresObjects(physx_PxSerializer const* self__pod, physx_PxBase* anon_param0_pod, physx_PxProcessPxBaseCallback* anon_param1_pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + physx::PxBase& anon_param0 = reinterpret_cast(*anon_param0_pod); + physx::PxProcessPxBaseCallback& anon_param1 = reinterpret_cast(*anon_param1_pod); + self_->requiresObjects(anon_param0, anon_param1); + } + + DLLEXPORT bool PxSerializer_isSubordinate(physx_PxSerializer const* self__pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSubordinate(); + return return_val; + } + + DLLEXPORT void PxSerializer_exportExtraData(physx_PxSerializer const* self__pod, physx_PxBase* anon_param0_pod, physx_PxSerializationContext* anon_param1_pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + physx::PxBase& anon_param0 = reinterpret_cast(*anon_param0_pod); + physx::PxSerializationContext& anon_param1 = reinterpret_cast(*anon_param1_pod); + self_->exportExtraData(anon_param0, anon_param1); + } + + DLLEXPORT void PxSerializer_exportData(physx_PxSerializer const* self__pod, physx_PxBase* anon_param0_pod, physx_PxSerializationContext* anon_param1_pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + physx::PxBase& anon_param0 = reinterpret_cast(*anon_param0_pod); + physx::PxSerializationContext& anon_param1 = reinterpret_cast(*anon_param1_pod); + self_->exportData(anon_param0, anon_param1); + } + + DLLEXPORT void PxSerializer_registerReferences(physx_PxSerializer const* self__pod, physx_PxBase* obj_pod, physx_PxSerializationContext* s_pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + physx::PxBase& obj = reinterpret_cast(*obj_pod); + physx::PxSerializationContext& s = reinterpret_cast(*s_pod); + self_->registerReferences(obj, s); + } + + DLLEXPORT size_t PxSerializer_getClassSize(physx_PxSerializer const* self__pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + size_t return_val = self_->getClassSize(); + size_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBase* PxSerializer_createObject(physx_PxSerializer const* self__pod, uint8_t** address_pod, physx_PxDeserializationContext* context_pod) { + physx::PxSerializer const* self_ = reinterpret_cast(self__pod); + uint8_t*& address = reinterpret_cast(*address_pod); + physx::PxDeserializationContext& context = reinterpret_cast(*context_pod); + physx::PxBase* return_val = self_->createObject(address, context); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSerializer_delete(physx_PxSerializer* self__pod) { + physx::PxSerializer* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxBase* PxInsertionCallback_buildObjectFromData_mut(physx_PxInsertionCallback* self__pod, int32_t type_pod, void* data) { + physx::PxInsertionCallback* self_ = reinterpret_cast(self__pod); + auto type = static_cast(type_pod); + physx::PxBase* return_val = self_->buildObjectFromData(type, data); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTaskManager_setCpuDispatcher_mut(physx_PxTaskManager* self__pod, physx_PxCpuDispatcher* ref_pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + physx::PxCpuDispatcher& ref = reinterpret_cast(*ref_pod); + self_->setCpuDispatcher(ref); + } + + DLLEXPORT physx_PxCpuDispatcher* PxTaskManager_getCpuDispatcher(physx_PxTaskManager const* self__pod) { + physx::PxTaskManager const* self_ = reinterpret_cast(self__pod); + physx::PxCpuDispatcher* return_val = self_->getCpuDispatcher(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTaskManager_resetDependencies_mut(physx_PxTaskManager* self__pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + self_->resetDependencies(); + } + + DLLEXPORT void PxTaskManager_startSimulation_mut(physx_PxTaskManager* self__pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + self_->startSimulation(); + } + + DLLEXPORT void PxTaskManager_stopSimulation_mut(physx_PxTaskManager* self__pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + self_->stopSimulation(); + } + + DLLEXPORT void PxTaskManager_taskCompleted_mut(physx_PxTaskManager* self__pod, physx_PxTask* task_pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + physx::PxTask& task = reinterpret_cast(*task_pod); + self_->taskCompleted(task); + } + + DLLEXPORT uint32_t PxTaskManager_getNamedTask_mut(physx_PxTaskManager* self__pod, char const* name) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNamedTask(name); + return return_val; + } + + DLLEXPORT uint32_t PxTaskManager_submitNamedTask_mut(physx_PxTaskManager* self__pod, physx_PxTask* task_pod, char const* name, int32_t type_pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + physx::PxTask* task = reinterpret_cast(task_pod); + auto type = static_cast(type_pod); + uint32_t return_val = self_->submitNamedTask(task, name, type); + return return_val; + } + + DLLEXPORT uint32_t PxTaskManager_submitUnnamedTask_mut(physx_PxTaskManager* self__pod, physx_PxTask* task_pod, int32_t type_pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + physx::PxTask& task = reinterpret_cast(*task_pod); + auto type = static_cast(type_pod); + uint32_t return_val = self_->submitUnnamedTask(task, type); + return return_val; + } + + DLLEXPORT physx_PxTask* PxTaskManager_getTaskFromID_mut(physx_PxTaskManager* self__pod, uint32_t id) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + physx::PxTask* return_val = self_->getTaskFromID(id); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTaskManager_release_mut(physx_PxTaskManager* self__pod) { + physx::PxTaskManager* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxTaskManager* PxTaskManager_createTaskManager(physx_PxErrorCallback* errorCallback_pod, physx_PxCpuDispatcher* anon_param1_pod) { + physx::PxErrorCallback& errorCallback = reinterpret_cast(*errorCallback_pod); + physx::PxCpuDispatcher* anon_param1 = reinterpret_cast(anon_param1_pod); + physx::PxTaskManager* return_val = PxTaskManager::createTaskManager(errorCallback, anon_param1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxCpuDispatcher_submitTask_mut(physx_PxCpuDispatcher* self__pod, physx_PxBaseTask* task_pod) { + physx::PxCpuDispatcher* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask& task = reinterpret_cast(*task_pod); + self_->submitTask(task); + } + + DLLEXPORT uint32_t PxCpuDispatcher_getWorkerCount(physx_PxCpuDispatcher const* self__pod) { + physx::PxCpuDispatcher const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getWorkerCount(); + return return_val; + } + + DLLEXPORT void PxCpuDispatcher_delete(physx_PxCpuDispatcher* self__pod) { + physx::PxCpuDispatcher* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxBaseTask_run_mut(physx_PxBaseTask* self__pod) { + physx::PxBaseTask* self_ = reinterpret_cast(self__pod); + self_->run(); + } + + DLLEXPORT char const* PxBaseTask_getName(physx_PxBaseTask const* self__pod) { + physx::PxBaseTask const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getName(); + return return_val; + } + + DLLEXPORT void PxBaseTask_addReference_mut(physx_PxBaseTask* self__pod) { + physx::PxBaseTask* self_ = reinterpret_cast(self__pod); + self_->addReference(); + } + + DLLEXPORT void PxBaseTask_removeReference_mut(physx_PxBaseTask* self__pod) { + physx::PxBaseTask* self_ = reinterpret_cast(self__pod); + self_->removeReference(); + } + + DLLEXPORT int32_t PxBaseTask_getReference(physx_PxBaseTask const* self__pod) { + physx::PxBaseTask const* self_ = reinterpret_cast(self__pod); + int32_t return_val = self_->getReference(); + return return_val; + } + + DLLEXPORT void PxBaseTask_release_mut(physx_PxBaseTask* self__pod) { + physx::PxBaseTask* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxTaskManager* PxBaseTask_getTaskManager(physx_PxBaseTask const* self__pod) { + physx::PxBaseTask const* self_ = reinterpret_cast(self__pod); + physx::PxTaskManager* return_val = self_->getTaskManager(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBaseTask_setContextId_mut(physx_PxBaseTask* self__pod, uint64_t id) { + physx::PxBaseTask* self_ = reinterpret_cast(self__pod); + self_->setContextId(id); + } + + DLLEXPORT uint64_t PxBaseTask_getContextId(physx_PxBaseTask const* self__pod) { + physx::PxBaseTask const* self_ = reinterpret_cast(self__pod); + uint64_t return_val = self_->getContextId(); + return return_val; + } + + DLLEXPORT void PxTask_release_mut(physx_PxTask* self__pod) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxTask_finishBefore_mut(physx_PxTask* self__pod, uint32_t taskID) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->finishBefore(taskID); + } + + DLLEXPORT void PxTask_startAfter_mut(physx_PxTask* self__pod, uint32_t taskID) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->startAfter(taskID); + } + + DLLEXPORT void PxTask_addReference_mut(physx_PxTask* self__pod) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->addReference(); + } + + DLLEXPORT void PxTask_removeReference_mut(physx_PxTask* self__pod) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->removeReference(); + } + + DLLEXPORT int32_t PxTask_getReference(physx_PxTask const* self__pod) { + physx::PxTask const* self_ = reinterpret_cast(self__pod); + int32_t return_val = self_->getReference(); + return return_val; + } + + DLLEXPORT uint32_t PxTask_getTaskID(physx_PxTask const* self__pod) { + physx::PxTask const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getTaskID(); + return return_val; + } + + DLLEXPORT void PxTask_submitted_mut(physx_PxTask* self__pod) { + physx::PxTask* self_ = reinterpret_cast(self__pod); + self_->submitted(); + } + + DLLEXPORT void PxLightCpuTask_setContinuation_mut(physx_PxLightCpuTask* self__pod, physx_PxTaskManager* tm_pod, physx_PxBaseTask* c_pod) { + physx::PxLightCpuTask* self_ = reinterpret_cast(self__pod); + physx::PxTaskManager& tm = reinterpret_cast(*tm_pod); + physx::PxBaseTask* c = reinterpret_cast(c_pod); + self_->setContinuation(tm, c); + } + + DLLEXPORT void PxLightCpuTask_setContinuation_mut_1(physx_PxLightCpuTask* self__pod, physx_PxBaseTask* c_pod) { + physx::PxLightCpuTask* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* c = reinterpret_cast(c_pod); + self_->setContinuation(c); + } + + DLLEXPORT physx_PxBaseTask* PxLightCpuTask_getContinuation(physx_PxLightCpuTask const* self__pod) { + physx::PxLightCpuTask const* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* return_val = self_->getContinuation(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxLightCpuTask_removeReference_mut(physx_PxLightCpuTask* self__pod) { + physx::PxLightCpuTask* self_ = reinterpret_cast(self__pod); + self_->removeReference(); + } + + DLLEXPORT int32_t PxLightCpuTask_getReference(physx_PxLightCpuTask const* self__pod) { + physx::PxLightCpuTask const* self_ = reinterpret_cast(self__pod); + int32_t return_val = self_->getReference(); + return return_val; + } + + DLLEXPORT void PxLightCpuTask_addReference_mut(physx_PxLightCpuTask* self__pod) { + physx::PxLightCpuTask* self_ = reinterpret_cast(self__pod); + self_->addReference(); + } + + DLLEXPORT void PxLightCpuTask_release_mut(physx_PxLightCpuTask* self__pod) { + physx::PxLightCpuTask* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT int32_t PxGeometry_getType(physx_PxGeometry const* self__pod) { + physx::PxGeometry const* self_ = reinterpret_cast(self__pod); + physx::PxGeometryType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBoxGeometry PxBoxGeometry_new(float hx, float hy, float hz) { + PxBoxGeometry return_val(hx, hy, hz); + physx_PxBoxGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBoxGeometry PxBoxGeometry_new_1(physx_PxVec3 halfExtents__pod) { + physx::PxVec3 halfExtents_; + memcpy(&halfExtents_, &halfExtents__pod, sizeof(halfExtents_)); + PxBoxGeometry return_val(halfExtents_); + physx_PxBoxGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxBoxGeometry_isValid(physx_PxBoxGeometry const* self__pod) { + physx::PxBoxGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxBVHRaycastCallback_delete(physx_PxBVHRaycastCallback* self__pod) { + physx::PxBVHRaycastCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT bool PxBVHRaycastCallback_reportHit_mut(physx_PxBVHRaycastCallback* self__pod, uint32_t boundsIndex, float* distance_pod) { + physx::PxBVHRaycastCallback* self_ = reinterpret_cast(self__pod); + float& distance = *distance_pod; + bool return_val = self_->reportHit(boundsIndex, distance); + return return_val; + } + + DLLEXPORT void PxBVHOverlapCallback_delete(physx_PxBVHOverlapCallback* self__pod) { + physx::PxBVHOverlapCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT bool PxBVHOverlapCallback_reportHit_mut(physx_PxBVHOverlapCallback* self__pod, uint32_t boundsIndex) { + physx::PxBVHOverlapCallback* self_ = reinterpret_cast(self__pod); + bool return_val = self_->reportHit(boundsIndex); + return return_val; + } + + DLLEXPORT void PxBVHTraversalCallback_delete(physx_PxBVHTraversalCallback* self__pod) { + physx::PxBVHTraversalCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT bool PxBVHTraversalCallback_visitNode_mut(physx_PxBVHTraversalCallback* self__pod, physx_PxBounds3 const* bounds_pod) { + physx::PxBVHTraversalCallback* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + bool return_val = self_->visitNode(bounds); + return return_val; + } + + DLLEXPORT bool PxBVHTraversalCallback_reportLeaf_mut(physx_PxBVHTraversalCallback* self__pod, uint32_t nbPrims, uint32_t const* prims) { + physx::PxBVHTraversalCallback* self_ = reinterpret_cast(self__pod); + bool return_val = self_->reportLeaf(nbPrims, prims); + return return_val; + } + + DLLEXPORT bool PxBVH_raycast(physx_PxBVH const* self__pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float maxDist, physx_PxBVHRaycastCallback* cb_pod, uint32_t queryFlags_pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxBVHRaycastCallback& cb = reinterpret_cast(*cb_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->raycast(origin, unitDir, maxDist, cb, queryFlags); + return return_val; + } + + DLLEXPORT bool PxBVH_sweep(physx_PxBVH const* self__pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float maxDist, physx_PxBVHRaycastCallback* cb_pod, uint32_t queryFlags_pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxBVHRaycastCallback& cb = reinterpret_cast(*cb_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->sweep(geom, pose, unitDir, maxDist, cb, queryFlags); + return return_val; + } + + DLLEXPORT bool PxBVH_overlap(physx_PxBVH const* self__pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, physx_PxBVHOverlapCallback* cb_pod, uint32_t queryFlags_pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxBVHOverlapCallback& cb = reinterpret_cast(*cb_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->overlap(geom, pose, cb, queryFlags); + return return_val; + } + + DLLEXPORT bool PxBVH_cull(physx_PxBVH const* self__pod, uint32_t nbPlanes, physx_PxPlane const* planes_pod, physx_PxBVHOverlapCallback* cb_pod, uint32_t queryFlags_pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxPlane const* planes = reinterpret_cast(planes_pod); + physx::PxBVHOverlapCallback& cb = reinterpret_cast(*cb_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->cull(nbPlanes, planes, cb, queryFlags); + return return_val; + } + + DLLEXPORT uint32_t PxBVH_getNbBounds(physx_PxBVH const* self__pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbBounds(); + return return_val; + } + + DLLEXPORT physx_PxBounds3 const* PxBVH_getBounds(physx_PxBVH const* self__pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const* return_val = self_->getBounds(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3* PxBVH_getBoundsForModification_mut(physx_PxBVH* self__pod) { + physx::PxBVH* self_ = reinterpret_cast(self__pod); + physx::PxBounds3* return_val = self_->getBoundsForModification(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBVH_refit_mut(physx_PxBVH* self__pod) { + physx::PxBVH* self_ = reinterpret_cast(self__pod); + self_->refit(); + } + + DLLEXPORT bool PxBVH_updateBounds_mut(physx_PxBVH* self__pod, uint32_t boundsIndex, physx_PxBounds3 const* newBounds_pod) { + physx::PxBVH* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& newBounds = reinterpret_cast(*newBounds_pod); + bool return_val = self_->updateBounds(boundsIndex, newBounds); + return return_val; + } + + DLLEXPORT void PxBVH_partialRefit_mut(physx_PxBVH* self__pod) { + physx::PxBVH* self_ = reinterpret_cast(self__pod); + self_->partialRefit(); + } + + DLLEXPORT bool PxBVH_traverse(physx_PxBVH const* self__pod, physx_PxBVHTraversalCallback* cb_pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + physx::PxBVHTraversalCallback& cb = reinterpret_cast(*cb_pod); + bool return_val = self_->traverse(cb); + return return_val; + } + + DLLEXPORT char const* PxBVH_getConcreteTypeName(physx_PxBVH const* self__pod) { + physx::PxBVH const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxCapsuleGeometry PxCapsuleGeometry_new(float radius_, float halfHeight_) { + PxCapsuleGeometry return_val(radius_, halfHeight_); + physx_PxCapsuleGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxCapsuleGeometry_isValid(physx_PxCapsuleGeometry const* self__pod) { + physx::PxCapsuleGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT uint32_t PxConvexMesh_getNbVertices(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbVertices(); + return return_val; + } + + DLLEXPORT physx_PxVec3 const* PxConvexMesh_getVertices(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const* return_val = self_->getVertices(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint8_t const* PxConvexMesh_getIndexBuffer(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + uint8_t const* return_val = self_->getIndexBuffer(); + return return_val; + } + + DLLEXPORT uint32_t PxConvexMesh_getNbPolygons(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbPolygons(); + return return_val; + } + + DLLEXPORT bool PxConvexMesh_getPolygonData(physx_PxConvexMesh const* self__pod, uint32_t index, physx_PxHullPolygon* data_pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + physx::PxHullPolygon& data = reinterpret_cast(*data_pod); + bool return_val = self_->getPolygonData(index, data); + return return_val; + } + + DLLEXPORT void PxConvexMesh_release_mut(physx_PxConvexMesh* self__pod) { + physx::PxConvexMesh* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxConvexMesh_getMassInformation(physx_PxConvexMesh const* self__pod, float* mass_pod, physx_PxMat33* localInertia_pod, physx_PxVec3* localCenterOfMass_pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + float& mass = *mass_pod; + physx::PxMat33& localInertia = reinterpret_cast(*localInertia_pod); + physx::PxVec3& localCenterOfMass = reinterpret_cast(*localCenterOfMass_pod); + self_->getMassInformation(mass, localInertia, localCenterOfMass); + } + + DLLEXPORT physx_PxBounds3 PxConvexMesh_getLocalBounds(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getLocalBounds(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float const* PxConvexMesh_getSDF(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + float const* return_val = self_->getSDF(); + return return_val; + } + + DLLEXPORT char const* PxConvexMesh_getConcreteTypeName(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT bool PxConvexMesh_isGpuCompatible(physx_PxConvexMesh const* self__pod) { + physx::PxConvexMesh const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isGpuCompatible(); + return return_val; + } + + DLLEXPORT physx_PxMeshScale PxMeshScale_new() { + PxMeshScale return_val; + physx_PxMeshScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMeshScale PxMeshScale_new_1(float r) { + PxMeshScale return_val(r); + physx_PxMeshScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMeshScale PxMeshScale_new_2(physx_PxVec3 const* s_pod) { + physx::PxVec3 const& s = reinterpret_cast(*s_pod); + PxMeshScale return_val(s); + physx_PxMeshScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMeshScale PxMeshScale_new_3(physx_PxVec3 const* s_pod, physx_PxQuat const* r_pod) { + physx::PxVec3 const& s = reinterpret_cast(*s_pod); + physx::PxQuat const& r = reinterpret_cast(*r_pod); + PxMeshScale return_val(s, r); + physx_PxMeshScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxMeshScale_isIdentity(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isIdentity(); + return return_val; + } + + DLLEXPORT physx_PxMeshScale PxMeshScale_getInverse(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + physx::PxMeshScale return_val = self_->getInverse(); + physx_PxMeshScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMeshScale_toMat33(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + physx::PxMat33 return_val = self_->toMat33(); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxMeshScale_hasNegativeDeterminant(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->hasNegativeDeterminant(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxMeshScale_transform(physx_PxMeshScale const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = self_->transform(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxMeshScale_isValidForTriangleMesh(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValidForTriangleMesh(); + return return_val; + } + + DLLEXPORT bool PxMeshScale_isValidForConvexMesh(physx_PxMeshScale const* self__pod) { + physx::PxMeshScale const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValidForConvexMesh(); + return return_val; + } + + DLLEXPORT physx_PxConvexMeshGeometry PxConvexMeshGeometry_new(physx_PxConvexMesh* mesh_pod, physx_PxMeshScale const* scaling_pod, uint8_t flags_pod) { + physx::PxConvexMesh* mesh = reinterpret_cast(mesh_pod); + physx::PxMeshScale const& scaling = reinterpret_cast(*scaling_pod); + auto flags = physx::PxConvexMeshGeometryFlags(flags_pod); + PxConvexMeshGeometry return_val(mesh, scaling, flags); + physx_PxConvexMeshGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxConvexMeshGeometry_isValid(physx_PxConvexMeshGeometry const* self__pod) { + physx::PxConvexMeshGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxSphereGeometry PxSphereGeometry_new(float ir) { + PxSphereGeometry return_val(ir); + physx_PxSphereGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxSphereGeometry_isValid(physx_PxSphereGeometry const* self__pod) { + physx::PxSphereGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxPlaneGeometry PxPlaneGeometry_new() { + PxPlaneGeometry return_val; + physx_PxPlaneGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxPlaneGeometry_isValid(physx_PxPlaneGeometry const* self__pod) { + physx::PxPlaneGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTriangleMeshGeometry PxTriangleMeshGeometry_new(physx_PxTriangleMesh* mesh_pod, physx_PxMeshScale const* scaling_pod, uint8_t flags_pod) { + physx::PxTriangleMesh* mesh = reinterpret_cast(mesh_pod); + physx::PxMeshScale const& scaling = reinterpret_cast(*scaling_pod); + auto flags = physx::PxMeshGeometryFlags(flags_pod); + PxTriangleMeshGeometry return_val(mesh, scaling, flags); + physx_PxTriangleMeshGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxTriangleMeshGeometry_isValid(physx_PxTriangleMeshGeometry const* self__pod) { + physx::PxTriangleMeshGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxHeightFieldGeometry PxHeightFieldGeometry_new(physx_PxHeightField* hf_pod, uint8_t flags_pod, float heightScale_, float rowScale_, float columnScale_) { + physx::PxHeightField* hf = reinterpret_cast(hf_pod); + auto flags = physx::PxMeshGeometryFlags(flags_pod); + PxHeightFieldGeometry return_val(hf, flags, heightScale_, rowScale_, columnScale_); + physx_PxHeightFieldGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxHeightFieldGeometry_isValid(physx_PxHeightFieldGeometry const* self__pod) { + physx::PxHeightFieldGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxParticleSystemGeometry PxParticleSystemGeometry_new() { + PxParticleSystemGeometry return_val; + physx_PxParticleSystemGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxParticleSystemGeometry_isValid(physx_PxParticleSystemGeometry const* self__pod) { + physx::PxParticleSystemGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxHairSystemGeometry PxHairSystemGeometry_new() { + PxHairSystemGeometry return_val; + physx_PxHairSystemGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxHairSystemGeometry_isValid(physx_PxHairSystemGeometry const* self__pod) { + physx::PxHairSystemGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTetrahedronMeshGeometry PxTetrahedronMeshGeometry_new(physx_PxTetrahedronMesh* mesh_pod) { + physx::PxTetrahedronMesh* mesh = reinterpret_cast(mesh_pod); + PxTetrahedronMeshGeometry return_val(mesh); + physx_PxTetrahedronMeshGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxTetrahedronMeshGeometry_isValid(physx_PxTetrahedronMeshGeometry const* self__pod) { + physx::PxTetrahedronMeshGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxQueryHit PxQueryHit_new() { + PxQueryHit return_val; + physx_PxQueryHit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxLocationHit PxLocationHit_new() { + PxLocationHit return_val; + physx_PxLocationHit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxLocationHit_hadInitialOverlap(physx_PxLocationHit const* self__pod) { + physx::PxLocationHit const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->hadInitialOverlap(); + return return_val; + } + + DLLEXPORT physx_PxGeomRaycastHit PxGeomRaycastHit_new() { + PxGeomRaycastHit return_val; + physx_PxGeomRaycastHit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeomOverlapHit PxGeomOverlapHit_new() { + PxGeomOverlapHit return_val; + physx_PxGeomOverlapHit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeomSweepHit PxGeomSweepHit_new() { + PxGeomSweepHit return_val; + physx_PxGeomSweepHit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeomIndexPair PxGeomIndexPair_new() { + PxGeomIndexPair return_val; + physx_PxGeomIndexPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeomIndexPair PxGeomIndexPair_new_1(uint32_t _id0, uint32_t _id1) { + PxGeomIndexPair return_val(_id0, _id1); + physx_PxGeomIndexPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxCustomGeometry_getUniqueID() { + uint32_t return_val = PxCustomGeometry_getUniqueID(); + return return_val; + } + + DLLEXPORT physx_PxCustomGeometryType PxCustomGeometryType_new() { + PxCustomGeometryType return_val; + physx_PxCustomGeometryType return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxCustomGeometryType PxCustomGeometryType_INVALID() { + physx::PxCustomGeometryType return_val = PxCustomGeometryType::INVALID(); + physx_PxCustomGeometryType return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxCustomGeometryType PxCustomGeometryCallbacks_getCustomType(physx_PxCustomGeometryCallbacks const* self__pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxCustomGeometryType return_val = self_->getCustomType(); + physx_PxCustomGeometryType return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxCustomGeometryCallbacks_getLocalBounds(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxGeometry const* geometry_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxBounds3 return_val = self_->getLocalBounds(geometry); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxCustomGeometryCallbacks_raycast(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, float maxDist, uint16_t hitFlags_pod, uint32_t maxHits, physx_PxGeomRaycastHit* rayHits_pod, uint32_t stride, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxGeomRaycastHit* rayHits = reinterpret_cast(rayHits_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + uint32_t return_val = self_->raycast(origin, unitDir, geom, pose, maxDist, hitFlags, maxHits, rayHits, stride, threadContext); + return return_val; + } + + DLLEXPORT bool PxCustomGeometryCallbacks_overlap(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxGeometry const* geom0_pod, physx_PxTransform const* pose0_pod, physx_PxGeometry const* geom1_pod, physx_PxTransform const* pose1_pod, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geom0 = reinterpret_cast(*geom0_pod); + physx::PxTransform const& pose0 = reinterpret_cast(*pose0_pod); + physx::PxGeometry const& geom1 = reinterpret_cast(*geom1_pod); + physx::PxTransform const& pose1 = reinterpret_cast(*pose1_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + bool return_val = self_->overlap(geom0, pose0, geom1, pose1, threadContext); + return return_val; + } + + DLLEXPORT bool PxCustomGeometryCallbacks_sweep(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxVec3 const* unitDir_pod, float maxDist, physx_PxGeometry const* geom0_pod, physx_PxTransform const* pose0_pod, physx_PxGeometry const* geom1_pod, physx_PxTransform const* pose1_pod, physx_PxGeomSweepHit* sweepHit_pod, uint16_t hitFlags_pod, float inflation, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& geom0 = reinterpret_cast(*geom0_pod); + physx::PxTransform const& pose0 = reinterpret_cast(*pose0_pod); + physx::PxGeometry const& geom1 = reinterpret_cast(*geom1_pod); + physx::PxTransform const& pose1 = reinterpret_cast(*pose1_pod); + physx::PxGeomSweepHit& sweepHit = reinterpret_cast(*sweepHit_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + bool return_val = self_->sweep(unitDir, maxDist, geom0, pose0, geom1, pose1, sweepHit, hitFlags, inflation, threadContext); + return return_val; + } + + DLLEXPORT void PxCustomGeometryCallbacks_computeMassProperties(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxGeometry const* geometry_pod, physx_PxMassProperties* massProperties_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMassProperties& massProperties = reinterpret_cast(*massProperties_pod); + self_->computeMassProperties(geometry, massProperties); + } + + DLLEXPORT bool PxCustomGeometryCallbacks_usePersistentContactManifold(physx_PxCustomGeometryCallbacks const* self__pod, physx_PxGeometry const* geometry_pod, float* breakingThreshold_pod) { + physx::PxCustomGeometryCallbacks const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + float& breakingThreshold = *breakingThreshold_pod; + bool return_val = self_->usePersistentContactManifold(geometry, breakingThreshold); + return return_val; + } + + DLLEXPORT void PxCustomGeometryCallbacks_delete(physx_PxCustomGeometryCallbacks* self__pod) { + physx::PxCustomGeometryCallbacks* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxCustomGeometry PxCustomGeometry_new() { + PxCustomGeometry return_val; + physx_PxCustomGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxCustomGeometry PxCustomGeometry_new_1(physx_PxCustomGeometryCallbacks* _callbacks_pod) { + physx::PxCustomGeometryCallbacks& _callbacks = reinterpret_cast(*_callbacks_pod); + PxCustomGeometry return_val(_callbacks); + physx_PxCustomGeometry return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxCustomGeometry_isValid(physx_PxCustomGeometry const* self__pod) { + physx::PxCustomGeometry const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxCustomGeometryType PxCustomGeometry_getCustomType(physx_PxCustomGeometry const* self__pod) { + physx::PxCustomGeometry const* self_ = reinterpret_cast(self__pod); + physx::PxCustomGeometryType return_val = self_->getCustomType(); + physx_PxCustomGeometryType return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxGeometryHolder_getType(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxGeometryType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeometry* PxGeometryHolder_any_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxGeometry& return_val = self_->any(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxGeometry const* PxGeometryHolder_any(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& return_val = self_->any(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSphereGeometry* PxGeometryHolder_sphere_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxSphereGeometry& return_val = self_->sphere(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSphereGeometry const* PxGeometryHolder_sphere(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxSphereGeometry const& return_val = self_->sphere(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPlaneGeometry* PxGeometryHolder_plane_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxPlaneGeometry& return_val = self_->plane(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPlaneGeometry const* PxGeometryHolder_plane(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxPlaneGeometry const& return_val = self_->plane(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCapsuleGeometry* PxGeometryHolder_capsule_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxCapsuleGeometry& return_val = self_->capsule(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCapsuleGeometry const* PxGeometryHolder_capsule(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxCapsuleGeometry const& return_val = self_->capsule(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBoxGeometry* PxGeometryHolder_box_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxBoxGeometry& return_val = self_->box(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBoxGeometry const* PxGeometryHolder_box(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxBoxGeometry const& return_val = self_->box(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxConvexMeshGeometry* PxGeometryHolder_convexMesh_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxConvexMeshGeometry& return_val = self_->convexMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxConvexMeshGeometry const* PxGeometryHolder_convexMesh(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxConvexMeshGeometry const& return_val = self_->convexMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMeshGeometry* PxGeometryHolder_tetMesh_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshGeometry& return_val = self_->tetMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMeshGeometry const* PxGeometryHolder_tetMesh(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshGeometry const& return_val = self_->tetMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTriangleMeshGeometry* PxGeometryHolder_triangleMesh_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxTriangleMeshGeometry& return_val = self_->triangleMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTriangleMeshGeometry const* PxGeometryHolder_triangleMesh(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxTriangleMeshGeometry const& return_val = self_->triangleMesh(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxHeightFieldGeometry* PxGeometryHolder_heightField_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldGeometry& return_val = self_->heightField(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxHeightFieldGeometry const* PxGeometryHolder_heightField(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldGeometry const& return_val = self_->heightField(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxParticleSystemGeometry* PxGeometryHolder_particleSystem_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxParticleSystemGeometry& return_val = self_->particleSystem(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxParticleSystemGeometry const* PxGeometryHolder_particleSystem(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxParticleSystemGeometry const& return_val = self_->particleSystem(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxHairSystemGeometry* PxGeometryHolder_hairSystem_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxHairSystemGeometry& return_val = self_->hairSystem(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxHairSystemGeometry const* PxGeometryHolder_hairSystem(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxHairSystemGeometry const& return_val = self_->hairSystem(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCustomGeometry* PxGeometryHolder_custom_mut(physx_PxGeometryHolder* self__pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxCustomGeometry& return_val = self_->custom(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCustomGeometry const* PxGeometryHolder_custom(physx_PxGeometryHolder const* self__pod) { + physx::PxGeometryHolder const* self_ = reinterpret_cast(self__pod); + physx::PxCustomGeometry const& return_val = self_->custom(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxGeometryHolder_storeAny_mut(physx_PxGeometryHolder* self__pod, physx_PxGeometry const* geometry_pod) { + physx::PxGeometryHolder* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + self_->storeAny(geometry); + } + + DLLEXPORT physx_PxGeometryHolder PxGeometryHolder_new() { + PxGeometryHolder return_val; + physx_PxGeometryHolder return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxGeometryHolder PxGeometryHolder_new_1(physx_PxGeometry const* geometry_pod) { + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + PxGeometryHolder return_val(geometry); + physx_PxGeometryHolder return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxGeometryQuery_raycast(physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, float maxDist, uint16_t hitFlags_pod, uint32_t maxHits, physx_PxGeomRaycastHit* rayHits_pod, uint32_t stride, uint32_t queryFlags_pod, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxGeomRaycastHit* rayHits = reinterpret_cast(rayHits_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + uint32_t return_val = PxGeometryQuery::raycast(origin, unitDir, geom, pose, maxDist, hitFlags, maxHits, rayHits, stride, queryFlags, threadContext); + return return_val; + } + + DLLEXPORT bool PxGeometryQuery_overlap(physx_PxGeometry const* geom0_pod, physx_PxTransform const* pose0_pod, physx_PxGeometry const* geom1_pod, physx_PxTransform const* pose1_pod, uint32_t queryFlags_pod, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxGeometry const& geom0 = reinterpret_cast(*geom0_pod); + physx::PxTransform const& pose0 = reinterpret_cast(*pose0_pod); + physx::PxGeometry const& geom1 = reinterpret_cast(*geom1_pod); + physx::PxTransform const& pose1 = reinterpret_cast(*pose1_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + bool return_val = PxGeometryQuery::overlap(geom0, pose0, geom1, pose1, queryFlags, threadContext); + return return_val; + } + + DLLEXPORT bool PxGeometryQuery_sweep(physx_PxVec3 const* unitDir_pod, float maxDist, physx_PxGeometry const* geom0_pod, physx_PxTransform const* pose0_pod, physx_PxGeometry const* geom1_pod, physx_PxTransform const* pose1_pod, physx_PxGeomSweepHit* sweepHit_pod, uint16_t hitFlags_pod, float inflation, uint32_t queryFlags_pod, physx_PxQueryThreadContext* threadContext_pod) { + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& geom0 = reinterpret_cast(*geom0_pod); + physx::PxTransform const& pose0 = reinterpret_cast(*pose0_pod); + physx::PxGeometry const& geom1 = reinterpret_cast(*geom1_pod); + physx::PxTransform const& pose1 = reinterpret_cast(*pose1_pod); + physx::PxGeomSweepHit& sweepHit = reinterpret_cast(*sweepHit_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + physx::PxQueryThreadContext* threadContext = reinterpret_cast(threadContext_pod); + bool return_val = PxGeometryQuery::sweep(unitDir, maxDist, geom0, pose0, geom1, pose1, sweepHit, hitFlags, inflation, queryFlags, threadContext); + return return_val; + } + + DLLEXPORT bool PxGeometryQuery_computePenetration(physx_PxVec3* direction_pod, float* depth_pod, physx_PxGeometry const* geom0_pod, physx_PxTransform const* pose0_pod, physx_PxGeometry const* geom1_pod, physx_PxTransform const* pose1_pod, uint32_t queryFlags_pod) { + physx::PxVec3& direction = reinterpret_cast(*direction_pod); + float& depth = *depth_pod; + physx::PxGeometry const& geom0 = reinterpret_cast(*geom0_pod); + physx::PxTransform const& pose0 = reinterpret_cast(*pose0_pod); + physx::PxGeometry const& geom1 = reinterpret_cast(*geom1_pod); + physx::PxTransform const& pose1 = reinterpret_cast(*pose1_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = PxGeometryQuery::computePenetration(direction, depth, geom0, pose0, geom1, pose1, queryFlags); + return return_val; + } + + DLLEXPORT float PxGeometryQuery_pointDistance(physx_PxVec3 const* point_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, physx_PxVec3* closestPoint_pod, uint32_t* closestIndex, uint32_t queryFlags_pod) { + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3* closestPoint = reinterpret_cast(closestPoint_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + float return_val = PxGeometryQuery::pointDistance(point, geom, pose, closestPoint, closestIndex, queryFlags); + return return_val; + } + + DLLEXPORT void PxGeometryQuery_computeGeomBounds(physx_PxBounds3* bounds_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, float offset, float inflation, uint32_t queryFlags_pod) { + physx::PxBounds3& bounds = reinterpret_cast(*bounds_pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + PxGeometryQuery::computeGeomBounds(bounds, geom, pose, offset, inflation, queryFlags); + } + + DLLEXPORT bool PxGeometryQuery_isValid(physx_PxGeometry const* geom_pod) { + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + bool return_val = PxGeometryQuery::isValid(geom); + return return_val; + } + + DLLEXPORT uint8_t PxHeightFieldSample_tessFlag(physx_PxHeightFieldSample const* self__pod) { + physx::PxHeightFieldSample const* self_ = reinterpret_cast(self__pod); + uint8_t return_val = self_->tessFlag(); + return return_val; + } + + DLLEXPORT void PxHeightFieldSample_setTessFlag_mut(physx_PxHeightFieldSample* self__pod) { + physx::PxHeightFieldSample* self_ = reinterpret_cast(self__pod); + self_->setTessFlag(); + } + + DLLEXPORT void PxHeightFieldSample_clearTessFlag_mut(physx_PxHeightFieldSample* self__pod) { + physx::PxHeightFieldSample* self_ = reinterpret_cast(self__pod); + self_->clearTessFlag(); + } + + DLLEXPORT void PxHeightField_release_mut(physx_PxHeightField* self__pod) { + physx::PxHeightField* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxHeightField_saveCells(physx_PxHeightField const* self__pod, void* destBuffer, uint32_t destBufferSize) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->saveCells(destBuffer, destBufferSize); + return return_val; + } + + DLLEXPORT bool PxHeightField_modifySamples_mut(physx_PxHeightField* self__pod, int32_t startCol, int32_t startRow, physx_PxHeightFieldDesc const* subfieldDesc_pod, bool shrinkBounds) { + physx::PxHeightField* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldDesc const& subfieldDesc = reinterpret_cast(*subfieldDesc_pod); + bool return_val = self_->modifySamples(startCol, startRow, subfieldDesc, shrinkBounds); + return return_val; + } + + DLLEXPORT uint32_t PxHeightField_getNbRows(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbRows(); + return return_val; + } + + DLLEXPORT uint32_t PxHeightField_getNbColumns(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbColumns(); + return return_val; + } + + DLLEXPORT int32_t PxHeightField_getFormat(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldFormat::Enum return_val = self_->getFormat(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxHeightField_getSampleStride(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getSampleStride(); + return return_val; + } + + DLLEXPORT float PxHeightField_getConvexEdgeThreshold(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getConvexEdgeThreshold(); + return return_val; + } + + DLLEXPORT uint16_t PxHeightField_getFlags(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldFlags return_val = self_->getFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxHeightField_getHeight(physx_PxHeightField const* self__pod, float x, float z) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getHeight(x, z); + return return_val; + } + + DLLEXPORT uint16_t PxHeightField_getTriangleMaterialIndex(physx_PxHeightField const* self__pod, uint32_t triangleIndex) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getTriangleMaterialIndex(triangleIndex); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxHeightField_getTriangleNormal(physx_PxHeightField const* self__pod, uint32_t triangleIndex) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getTriangleNormal(triangleIndex); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxHeightFieldSample const* PxHeightField_getSample(physx_PxHeightField const* self__pod, uint32_t row, uint32_t column) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + physx::PxHeightFieldSample const& return_val = self_->getSample(row, column); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxHeightField_getTimestamp(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getTimestamp(); + return return_val; + } + + DLLEXPORT char const* PxHeightField_getConcreteTypeName(physx_PxHeightField const* self__pod) { + physx::PxHeightField const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxHeightFieldDesc PxHeightFieldDesc_new() { + PxHeightFieldDesc return_val; + physx_PxHeightFieldDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxHeightFieldDesc_setToDefault_mut(physx_PxHeightFieldDesc* self__pod) { + physx::PxHeightFieldDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxHeightFieldDesc_isValid(physx_PxHeightFieldDesc const* self__pod) { + physx::PxHeightFieldDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxMeshQuery_getTriangle(physx_PxTriangleMeshGeometry const* triGeom_pod, physx_PxTransform const* transform_pod, uint32_t triangleIndex, physx_PxTriangle* triangle_pod, uint32_t* vertexIndices, uint32_t* adjacencyIndices) { + physx::PxTriangleMeshGeometry const& triGeom = reinterpret_cast(*triGeom_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxTriangle& triangle = reinterpret_cast(*triangle_pod); + PxMeshQuery::getTriangle(triGeom, transform, triangleIndex, triangle, vertexIndices, adjacencyIndices); + } + + DLLEXPORT void PxMeshQuery_getTriangle_1(physx_PxHeightFieldGeometry const* hfGeom_pod, physx_PxTransform const* transform_pod, uint32_t triangleIndex, physx_PxTriangle* triangle_pod, uint32_t* vertexIndices, uint32_t* adjacencyIndices) { + physx::PxHeightFieldGeometry const& hfGeom = reinterpret_cast(*hfGeom_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxTriangle& triangle = reinterpret_cast(*triangle_pod); + PxMeshQuery::getTriangle(hfGeom, transform, triangleIndex, triangle, vertexIndices, adjacencyIndices); + } + + DLLEXPORT uint32_t PxMeshQuery_findOverlapTriangleMesh(physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxTriangleMeshGeometry const* meshGeom_pod, physx_PxTransform const* meshPose_pod, uint32_t* results, uint32_t maxResults, uint32_t startIndex, bool* overflow_pod, uint32_t queryFlags_pod) { + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxTriangleMeshGeometry const& meshGeom = reinterpret_cast(*meshGeom_pod); + physx::PxTransform const& meshPose = reinterpret_cast(*meshPose_pod); + bool& overflow = *overflow_pod; + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + uint32_t return_val = PxMeshQuery::findOverlapTriangleMesh(geom, geomPose, meshGeom, meshPose, results, maxResults, startIndex, overflow, queryFlags); + return return_val; + } + + DLLEXPORT uint32_t PxMeshQuery_findOverlapHeightField(physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxHeightFieldGeometry const* hfGeom_pod, physx_PxTransform const* hfPose_pod, uint32_t* results, uint32_t maxResults, uint32_t startIndex, bool* overflow_pod, uint32_t queryFlags_pod) { + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxHeightFieldGeometry const& hfGeom = reinterpret_cast(*hfGeom_pod); + physx::PxTransform const& hfPose = reinterpret_cast(*hfPose_pod); + bool& overflow = *overflow_pod; + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + uint32_t return_val = PxMeshQuery::findOverlapHeightField(geom, geomPose, hfGeom, hfPose, results, maxResults, startIndex, overflow, queryFlags); + return return_val; + } + + DLLEXPORT bool PxMeshQuery_sweep(physx_PxVec3 const* unitDir_pod, float distance, physx_PxGeometry const* geom_pod, physx_PxTransform const* pose_pod, uint32_t triangleCount, physx_PxTriangle const* triangles_pod, physx_PxGeomSweepHit* sweepHit_pod, uint16_t hitFlags_pod, uint32_t const* cachedIndex, float inflation, bool doubleSided, uint32_t queryFlags_pod) { + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxTriangle const* triangles = reinterpret_cast(triangles_pod); + physx::PxGeomSweepHit& sweepHit = reinterpret_cast(*sweepHit_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = PxMeshQuery::sweep(unitDir, distance, geom, pose, triangleCount, triangles, sweepHit, hitFlags, cachedIndex, inflation, doubleSided, queryFlags); + return return_val; + } + + DLLEXPORT physx_PxSimpleTriangleMesh PxSimpleTriangleMesh_new() { + PxSimpleTriangleMesh return_val; + physx_PxSimpleTriangleMesh return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSimpleTriangleMesh_setToDefault_mut(physx_PxSimpleTriangleMesh* self__pod) { + physx::PxSimpleTriangleMesh* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxSimpleTriangleMesh_isValid(physx_PxSimpleTriangleMesh const* self__pod) { + physx::PxSimpleTriangleMesh const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTriangle* PxTriangle_new_alloc() { + auto return_val = new physx::PxTriangle(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTriangle* PxTriangle_new_alloc_1(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, physx_PxVec3 const* p2_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxVec3 const& p2 = reinterpret_cast(*p2_pod); + auto return_val = new physx::PxTriangle(p0, p1, p2); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTriangle_delete(physx_PxTriangle* self__pod) { + physx::PxTriangle* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxTriangle_normal(physx_PxTriangle const* self__pod, physx_PxVec3* _normal_pod) { + physx::PxTriangle const* self_ = reinterpret_cast(self__pod); + physx::PxVec3& _normal = reinterpret_cast(*_normal_pod); + self_->normal(_normal); + } + + DLLEXPORT void PxTriangle_denormalizedNormal(physx_PxTriangle const* self__pod, physx_PxVec3* _normal_pod) { + physx::PxTriangle const* self_ = reinterpret_cast(self__pod); + physx::PxVec3& _normal = reinterpret_cast(*_normal_pod); + self_->denormalizedNormal(_normal); + } + + DLLEXPORT float PxTriangle_area(physx_PxTriangle const* self__pod) { + physx::PxTriangle const* self_ = reinterpret_cast(self__pod); + float return_val = self_->area(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxTriangle_pointFromUV(physx_PxTriangle const* self__pod, float u, float v) { + physx::PxTriangle const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->pointFromUV(u, v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTrianglePadded* PxTrianglePadded_new_alloc() { + auto return_val = new physx::PxTrianglePadded(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTrianglePadded_delete(physx_PxTrianglePadded* self__pod) { + physx::PxTrianglePadded* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxTriangleMesh_getNbVertices(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbVertices(); + return return_val; + } + + DLLEXPORT physx_PxVec3 const* PxTriangleMesh_getVertices(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const* return_val = self_->getVertices(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3* PxTriangleMesh_getVerticesForModification_mut(physx_PxTriangleMesh* self__pod) { + physx::PxTriangleMesh* self_ = reinterpret_cast(self__pod); + physx::PxVec3* return_val = self_->getVerticesForModification(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 PxTriangleMesh_refitBVH_mut(physx_PxTriangleMesh* self__pod) { + physx::PxTriangleMesh* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->refitBVH(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxTriangleMesh_getNbTriangles(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTriangles(); + return return_val; + } + + DLLEXPORT void const* PxTriangleMesh_getTriangles(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getTriangles(); + return return_val; + } + + DLLEXPORT uint8_t PxTriangleMesh_getTriangleMeshFlags(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + physx::PxTriangleMeshFlags return_val = self_->getTriangleMeshFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t const* PxTriangleMesh_getTrianglesRemap(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getTrianglesRemap(); + return return_val; + } + + DLLEXPORT void PxTriangleMesh_release_mut(physx_PxTriangleMesh* self__pod) { + physx::PxTriangleMesh* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint16_t PxTriangleMesh_getTriangleMaterialIndex(physx_PxTriangleMesh const* self__pod, uint32_t triangleIndex) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getTriangleMaterialIndex(triangleIndex); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxTriangleMesh_getLocalBounds(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getLocalBounds(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float const* PxTriangleMesh_getSDF(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + float const* return_val = self_->getSDF(); + return return_val; + } + + DLLEXPORT void PxTriangleMesh_getSDFDimensions(physx_PxTriangleMesh const* self__pod, uint32_t* numX_pod, uint32_t* numY_pod, uint32_t* numZ_pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + uint32_t& numX = *numX_pod; + uint32_t& numY = *numY_pod; + uint32_t& numZ = *numZ_pod; + self_->getSDFDimensions(numX, numY, numZ); + } + + DLLEXPORT void PxTriangleMesh_setPreferSDFProjection_mut(physx_PxTriangleMesh* self__pod, bool preferProjection) { + physx::PxTriangleMesh* self_ = reinterpret_cast(self__pod); + self_->setPreferSDFProjection(preferProjection); + } + + DLLEXPORT bool PxTriangleMesh_getPreferSDFProjection(physx_PxTriangleMesh const* self__pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->getPreferSDFProjection(); + return return_val; + } + + DLLEXPORT void PxTriangleMesh_getMassInformation(physx_PxTriangleMesh const* self__pod, float* mass_pod, physx_PxMat33* localInertia_pod, physx_PxVec3* localCenterOfMass_pod) { + physx::PxTriangleMesh const* self_ = reinterpret_cast(self__pod); + float& mass = *mass_pod; + physx::PxMat33& localInertia = reinterpret_cast(*localInertia_pod); + physx::PxVec3& localCenterOfMass = reinterpret_cast(*localCenterOfMass_pod); + self_->getMassInformation(mass, localInertia, localCenterOfMass); + } + + DLLEXPORT physx_PxTetrahedron* PxTetrahedron_new_alloc() { + auto return_val = new physx::PxTetrahedron(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedron* PxTetrahedron_new_alloc_1(physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, physx_PxVec3 const* p2_pod, physx_PxVec3 const* p3_pod) { + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + physx::PxVec3 const& p2 = reinterpret_cast(*p2_pod); + physx::PxVec3 const& p3 = reinterpret_cast(*p3_pod); + auto return_val = new physx::PxTetrahedron(p0, p1, p2, p3); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxTetrahedron_delete(physx_PxTetrahedron* self__pod) { + physx::PxTetrahedron* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxSoftBodyAuxData_release_mut(physx_PxSoftBodyAuxData* self__pod) { + physx::PxSoftBodyAuxData* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxTetrahedronMesh_getNbVertices(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbVertices(); + return return_val; + } + + DLLEXPORT physx_PxVec3 const* PxTetrahedronMesh_getVertices(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const* return_val = self_->getVertices(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxTetrahedronMesh_getNbTetrahedrons(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTetrahedrons(); + return return_val; + } + + DLLEXPORT void const* PxTetrahedronMesh_getTetrahedrons(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getTetrahedrons(); + return return_val; + } + + DLLEXPORT uint8_t PxTetrahedronMesh_getTetrahedronMeshFlags(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshFlags return_val = self_->getTetrahedronMeshFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t const* PxTetrahedronMesh_getTetrahedraRemap(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getTetrahedraRemap(); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxTetrahedronMesh_getLocalBounds(physx_PxTetrahedronMesh const* self__pod) { + physx::PxTetrahedronMesh const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getLocalBounds(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxTetrahedronMesh_release_mut(physx_PxTetrahedronMesh* self__pod) { + physx::PxTetrahedronMesh* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxTetrahedronMesh const* PxSoftBodyMesh_getCollisionMesh(physx_PxSoftBodyMesh const* self__pod) { + physx::PxSoftBodyMesh const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMesh const* return_val = self_->getCollisionMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMesh* PxSoftBodyMesh_getCollisionMesh_mut(physx_PxSoftBodyMesh* self__pod) { + physx::PxSoftBodyMesh* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMesh* return_val = self_->getCollisionMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMesh const* PxSoftBodyMesh_getSimulationMesh(physx_PxSoftBodyMesh const* self__pod) { + physx::PxSoftBodyMesh const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMesh const* return_val = self_->getSimulationMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMesh* PxSoftBodyMesh_getSimulationMesh_mut(physx_PxSoftBodyMesh* self__pod) { + physx::PxSoftBodyMesh* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMesh* return_val = self_->getSimulationMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodyAuxData const* PxSoftBodyMesh_getSoftBodyAuxData(physx_PxSoftBodyMesh const* self__pod) { + physx::PxSoftBodyMesh const* self_ = reinterpret_cast(self__pod); + physx::PxSoftBodyAuxData const* return_val = self_->getSoftBodyAuxData(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodyAuxData* PxSoftBodyMesh_getSoftBodyAuxData_mut(physx_PxSoftBodyMesh* self__pod) { + physx::PxSoftBodyMesh* self_ = reinterpret_cast(self__pod); + physx::PxSoftBodyAuxData* return_val = self_->getSoftBodyAuxData(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSoftBodyMesh_release_mut(physx_PxSoftBodyMesh* self__pod) { + physx::PxSoftBodyMesh* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxCollisionMeshMappingData_release_mut(physx_PxCollisionMeshMappingData* self__pod) { + physx::PxCollisionMeshMappingData* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxTetrahedronMeshData const* PxCollisionTetrahedronMeshData_getMesh(physx_PxCollisionTetrahedronMeshData const* self__pod) { + physx::PxCollisionTetrahedronMeshData const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshData const* return_val = self_->getMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTetrahedronMeshData* PxCollisionTetrahedronMeshData_getMesh_mut(physx_PxCollisionTetrahedronMeshData* self__pod) { + physx::PxCollisionTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshData* return_val = self_->getMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodyCollisionData const* PxCollisionTetrahedronMeshData_getData(physx_PxCollisionTetrahedronMeshData const* self__pod) { + physx::PxCollisionTetrahedronMeshData const* self_ = reinterpret_cast(self__pod); + physx::PxSoftBodyCollisionData const* return_val = self_->getData(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodyCollisionData* PxCollisionTetrahedronMeshData_getData_mut(physx_PxCollisionTetrahedronMeshData* self__pod) { + physx::PxCollisionTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + physx::PxSoftBodyCollisionData* return_val = self_->getData(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxCollisionTetrahedronMeshData_release_mut(physx_PxCollisionTetrahedronMeshData* self__pod) { + physx::PxCollisionTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxTetrahedronMeshData* PxSimulationTetrahedronMeshData_getMesh_mut(physx_PxSimulationTetrahedronMeshData* self__pod) { + physx::PxSimulationTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMeshData* return_val = self_->getMesh(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodySimulationData* PxSimulationTetrahedronMeshData_getData_mut(physx_PxSimulationTetrahedronMeshData* self__pod) { + physx::PxSimulationTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + physx::PxSoftBodySimulationData* return_val = self_->getData(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSimulationTetrahedronMeshData_release_mut(physx_PxSimulationTetrahedronMeshData* self__pod) { + physx::PxSimulationTetrahedronMeshData* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxActor_release_mut(physx_PxActor* self__pod) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT int32_t PxActor_getType(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + physx::PxActorType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxScene* PxActor_getScene(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxActor_setName_mut(physx_PxActor* self__pod, char const* name) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + self_->setName(name); + } + + DLLEXPORT char const* PxActor_getName(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getName(); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxActor_getWorldBounds(physx_PxActor const* self__pod, float inflation) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getWorldBounds(inflation); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxActor_setActorFlag_mut(physx_PxActor* self__pod, int32_t flag_pod, bool value) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setActorFlag(flag, value); + } + + DLLEXPORT void PxActor_setActorFlags_mut(physx_PxActor* self__pod, uint8_t inFlags_pod) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + auto inFlags = physx::PxActorFlags(inFlags_pod); + self_->setActorFlags(inFlags); + } + + DLLEXPORT uint8_t PxActor_getActorFlags(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + physx::PxActorFlags return_val = self_->getActorFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxActor_setDominanceGroup_mut(physx_PxActor* self__pod, uint8_t dominanceGroup) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + self_->setDominanceGroup(dominanceGroup); + } + + DLLEXPORT uint8_t PxActor_getDominanceGroup(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + uint8_t return_val = self_->getDominanceGroup(); + return return_val; + } + + DLLEXPORT void PxActor_setOwnerClient_mut(physx_PxActor* self__pod, uint8_t inClient) { + physx::PxActor* self_ = reinterpret_cast(self__pod); + self_->setOwnerClient(inClient); + } + + DLLEXPORT uint8_t PxActor_getOwnerClient(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + uint8_t return_val = self_->getOwnerClient(); + return return_val; + } + + DLLEXPORT physx_PxAggregate* PxActor_getAggregate(physx_PxActor const* self__pod) { + physx::PxActor const* self_ = reinterpret_cast(self__pod); + physx::PxAggregate* return_val = self_->getAggregate(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxGetAggregateFilterHint(int32_t type_pod, bool enableSelfCollision) { + auto type = static_cast(type_pod); + uint32_t return_val = PxGetAggregateFilterHint(type, enableSelfCollision); + return return_val; + } + + DLLEXPORT uint32_t phys_PxGetAggregateSelfCollisionBit(uint32_t hint) { + uint32_t return_val = PxGetAggregateSelfCollisionBit(hint); + return return_val; + } + + DLLEXPORT 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; + } + + DLLEXPORT void PxAggregate_release_mut(physx_PxAggregate* self__pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT bool PxAggregate_addActor_mut(physx_PxAggregate* self__pod, physx_PxActor* actor_pod, physx_PxBVH const* bvh_pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + physx::PxBVH const* bvh = reinterpret_cast(bvh_pod); + bool return_val = self_->addActor(actor, bvh); + return return_val; + } + + DLLEXPORT bool PxAggregate_removeActor_mut(physx_PxAggregate* self__pod, physx_PxActor* actor_pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + bool return_val = self_->removeActor(actor); + return return_val; + } + + DLLEXPORT bool PxAggregate_addArticulation_mut(physx_PxAggregate* self__pod, physx_PxArticulationReducedCoordinate* articulation_pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate& articulation = reinterpret_cast(*articulation_pod); + bool return_val = self_->addArticulation(articulation); + return return_val; + } + + DLLEXPORT bool PxAggregate_removeArticulation_mut(physx_PxAggregate* self__pod, physx_PxArticulationReducedCoordinate* articulation_pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate& articulation = reinterpret_cast(*articulation_pod); + bool return_val = self_->removeArticulation(articulation); + return return_val; + } + + DLLEXPORT uint32_t PxAggregate_getNbActors(physx_PxAggregate const* self__pod) { + physx::PxAggregate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbActors(); + return return_val; + } + + DLLEXPORT uint32_t PxAggregate_getMaxNbShapes(physx_PxAggregate const* self__pod) { + physx::PxAggregate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getMaxNbShapes(); + return return_val; + } + + DLLEXPORT uint32_t PxAggregate_getActors(physx_PxAggregate const* self__pod, physx_PxActor** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxAggregate const* self_ = reinterpret_cast(self__pod); + physx::PxActor** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getActors(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxScene* PxAggregate_getScene_mut(physx_PxAggregate* self__pod) { + physx::PxAggregate* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxAggregate_getSelfCollision(physx_PxAggregate const* self__pod) { + physx::PxAggregate const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->getSelfCollision(); + return return_val; + } + + DLLEXPORT char const* PxAggregate_getConcreteTypeName(physx_PxAggregate const* self__pod) { + physx::PxAggregate const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxConstraintInvMassScale PxConstraintInvMassScale_new() { + PxConstraintInvMassScale return_val; + physx_PxConstraintInvMassScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxConstraintInvMassScale PxConstraintInvMassScale_new_1(float lin0, float ang0, float lin1, float ang1) { + PxConstraintInvMassScale return_val(lin0, ang0, lin1, ang1); + physx_PxConstraintInvMassScale return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxConstraintVisualizer_visualizeJointFrames_mut(physx_PxConstraintVisualizer* self__pod, physx_PxTransform const* parent_pod, physx_PxTransform const* child_pod) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& parent = reinterpret_cast(*parent_pod); + physx::PxTransform const& child = reinterpret_cast(*child_pod); + self_->visualizeJointFrames(parent, child); + } + + DLLEXPORT void PxConstraintVisualizer_visualizeLinearLimit_mut(physx_PxConstraintVisualizer* self__pod, physx_PxTransform const* t0_pod, physx_PxTransform const* t1_pod, float value, bool active) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& t0 = reinterpret_cast(*t0_pod); + physx::PxTransform const& t1 = reinterpret_cast(*t1_pod); + self_->visualizeLinearLimit(t0, t1, value, active); + } + + DLLEXPORT void PxConstraintVisualizer_visualizeAngularLimit_mut(physx_PxConstraintVisualizer* self__pod, physx_PxTransform const* t0_pod, float lower, float upper, bool active) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& t0 = reinterpret_cast(*t0_pod); + self_->visualizeAngularLimit(t0, lower, upper, active); + } + + DLLEXPORT void PxConstraintVisualizer_visualizeLimitCone_mut(physx_PxConstraintVisualizer* self__pod, physx_PxTransform const* t_pod, float tanQSwingY, float tanQSwingZ, bool active) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& t = reinterpret_cast(*t_pod); + self_->visualizeLimitCone(t, tanQSwingY, tanQSwingZ, active); + } + + DLLEXPORT void PxConstraintVisualizer_visualizeDoubleCone_mut(physx_PxConstraintVisualizer* self__pod, physx_PxTransform const* t_pod, float angle, bool active) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& t = reinterpret_cast(*t_pod); + self_->visualizeDoubleCone(t, angle, active); + } + + DLLEXPORT void PxConstraintVisualizer_visualizeLine_mut(physx_PxConstraintVisualizer* self__pod, physx_PxVec3 const* p0_pod, physx_PxVec3 const* p1_pod, uint32_t color) { + physx::PxConstraintVisualizer* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p0 = reinterpret_cast(*p0_pod); + physx::PxVec3 const& p1 = reinterpret_cast(*p1_pod); + self_->visualizeLine(p0, p1, color); + } + + DLLEXPORT void* PxConstraintConnector_prepareData_mut(physx_PxConstraintConnector* self__pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + void* return_val = self_->prepareData(); + return return_val; + } + + DLLEXPORT void PxConstraintConnector_onConstraintRelease_mut(physx_PxConstraintConnector* self__pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + self_->onConstraintRelease(); + } + + DLLEXPORT void PxConstraintConnector_onComShift_mut(physx_PxConstraintConnector* self__pod, uint32_t actor) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + self_->onComShift(actor); + } + + DLLEXPORT void PxConstraintConnector_onOriginShift_mut(physx_PxConstraintConnector* self__pod, physx_PxVec3 const* shift_pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& shift = reinterpret_cast(*shift_pod); + self_->onOriginShift(shift); + } + + DLLEXPORT physx_PxBase* PxConstraintConnector_getSerializable_mut(physx_PxConstraintConnector* self__pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + physx::PxBase* return_val = self_->getSerializable(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void const* PxConstraintConnector_getConstantBlock(physx_PxConstraintConnector const* self__pod) { + physx::PxConstraintConnector const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getConstantBlock(); + return return_val; + } + + DLLEXPORT void PxConstraintConnector_connectToConstraint_mut(physx_PxConstraintConnector* self__pod, physx_PxConstraint* anon_param0_pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + physx::PxConstraint* anon_param0 = reinterpret_cast(anon_param0_pod); + self_->connectToConstraint(anon_param0); + } + + DLLEXPORT void PxConstraintConnector_delete(physx_PxConstraintConnector* self__pod) { + physx::PxConstraintConnector* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxSolverBody PxSolverBody_new() { + PxSolverBody return_val; + physx_PxSolverBody return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxSolverBodyData_projectVelocity(physx_PxSolverBodyData const* self__pod, physx_PxVec3 const* lin_pod, physx_PxVec3 const* ang_pod) { + physx::PxSolverBodyData const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& lin = reinterpret_cast(*lin_pod); + physx::PxVec3 const& ang = reinterpret_cast(*ang_pod); + float return_val = self_->projectVelocity(lin, ang); + return return_val; + } + + DLLEXPORT void PxSolverConstraintPrepDesc_delete(physx_PxSolverConstraintPrepDesc* self__pod) { + physx::PxSolverConstraintPrepDesc* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint8_t* PxConstraintAllocator_reserveConstraintData_mut(physx_PxConstraintAllocator* self__pod, uint32_t byteSize) { + physx::PxConstraintAllocator* self_ = reinterpret_cast(self__pod); + uint8_t* return_val = self_->reserveConstraintData(byteSize); + return return_val; + } + + DLLEXPORT uint8_t* PxConstraintAllocator_reserveFrictionData_mut(physx_PxConstraintAllocator* self__pod, uint32_t byteSize) { + physx::PxConstraintAllocator* self_ = reinterpret_cast(self__pod); + uint8_t* return_val = self_->reserveFrictionData(byteSize); + return return_val; + } + + DLLEXPORT void PxConstraintAllocator_delete(physx_PxConstraintAllocator* self__pod) { + physx::PxConstraintAllocator* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxArticulationLimit PxArticulationLimit_new() { + PxArticulationLimit return_val; + physx_PxArticulationLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationLimit PxArticulationLimit_new_1(float low_, float high_) { + PxArticulationLimit return_val(low_, high_); + physx_PxArticulationLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationDrive PxArticulationDrive_new() { + PxArticulationDrive return_val; + physx_PxArticulationDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationDrive PxArticulationDrive_new_1(float stiffness_, float damping_, float maxForce_, int32_t driveType__pod) { + auto driveType_ = static_cast(driveType__pod); + PxArticulationDrive return_val(stiffness_, damping_, maxForce_, driveType_); + physx_PxArticulationDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxTGSSolverBodyVel_projectVelocity(physx_PxTGSSolverBodyVel const* self__pod, physx_PxVec3 const* lin_pod, physx_PxVec3 const* ang_pod) { + physx::PxTGSSolverBodyVel const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& lin = reinterpret_cast(*lin_pod); + physx::PxVec3 const& ang = reinterpret_cast(*ang_pod); + float return_val = self_->projectVelocity(lin, ang); + return return_val; + } + + DLLEXPORT float PxTGSSolverBodyData_projectVelocity(physx_PxTGSSolverBodyData const* self__pod, physx_PxVec3 const* linear_pod, physx_PxVec3 const* angular_pod) { + physx::PxTGSSolverBodyData const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& linear = reinterpret_cast(*linear_pod); + physx::PxVec3 const& angular = reinterpret_cast(*angular_pod); + float return_val = self_->projectVelocity(linear, angular); + return return_val; + } + + DLLEXPORT void PxTGSSolverConstraintPrepDesc_delete(physx_PxTGSSolverConstraintPrepDesc* self__pod) { + physx::PxTGSSolverConstraintPrepDesc* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxArticulationAttachment_setRestLength_mut(physx_PxArticulationAttachment* self__pod, float restLength) { + physx::PxArticulationAttachment* self_ = reinterpret_cast(self__pod); + self_->setRestLength(restLength); + } + + DLLEXPORT float PxArticulationAttachment_getRestLength(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestLength(); + return return_val; + } + + DLLEXPORT void PxArticulationAttachment_setLimitParameters_mut(physx_PxArticulationAttachment* self__pod, physx_PxArticulationTendonLimit const* parameters_pod) { + physx::PxArticulationAttachment* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonLimit const& parameters = reinterpret_cast(*parameters_pod); + self_->setLimitParameters(parameters); + } + + DLLEXPORT physx_PxArticulationTendonLimit PxArticulationAttachment_getLimitParameters(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonLimit return_val = self_->getLimitParameters(); + physx_PxArticulationTendonLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationAttachment_setRelativeOffset_mut(physx_PxArticulationAttachment* self__pod, physx_PxVec3 const* offset_pod) { + physx::PxArticulationAttachment* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& offset = reinterpret_cast(*offset_pod); + self_->setRelativeOffset(offset); + } + + DLLEXPORT physx_PxVec3 PxArticulationAttachment_getRelativeOffset(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getRelativeOffset(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationAttachment_setCoefficient_mut(physx_PxArticulationAttachment* self__pod, float coefficient) { + physx::PxArticulationAttachment* self_ = reinterpret_cast(self__pod); + self_->setCoefficient(coefficient); + } + + DLLEXPORT float PxArticulationAttachment_getCoefficient(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getCoefficient(); + return return_val; + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationAttachment_getLink(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink* return_val = self_->getLink(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationAttachment* PxArticulationAttachment_getParent(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationAttachment* return_val = self_->getParent(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxArticulationAttachment_isLeaf(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isLeaf(); + return return_val; + } + + DLLEXPORT physx_PxArticulationSpatialTendon* PxArticulationAttachment_getTendon(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationSpatialTendon* return_val = self_->getTendon(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationAttachment_release_mut(physx_PxArticulationAttachment* self__pod) { + physx::PxArticulationAttachment* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT char const* PxArticulationAttachment_getConcreteTypeName(physx_PxArticulationAttachment const* self__pod) { + physx::PxArticulationAttachment const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxArticulationTendonJoint_setCoefficient_mut(physx_PxArticulationTendonJoint* self__pod, int32_t axis_pod, float coefficient, float recipCoefficient) { + physx::PxArticulationTendonJoint* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setCoefficient(axis, coefficient, recipCoefficient); + } + + DLLEXPORT void PxArticulationTendonJoint_getCoefficient(physx_PxArticulationTendonJoint const* self__pod, int32_t* axis_pod, float* coefficient_pod, float* recipCoefficient_pod) { + physx::PxArticulationTendonJoint const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationAxis::Enum& axis = reinterpret_cast(*axis_pod); + float& coefficient = *coefficient_pod; + float& recipCoefficient = *recipCoefficient_pod; + self_->getCoefficient(axis, coefficient, recipCoefficient); + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationTendonJoint_getLink(physx_PxArticulationTendonJoint const* self__pod) { + physx::PxArticulationTendonJoint const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink* return_val = self_->getLink(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationTendonJoint* PxArticulationTendonJoint_getParent(physx_PxArticulationTendonJoint const* self__pod) { + physx::PxArticulationTendonJoint const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonJoint* return_val = self_->getParent(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationFixedTendon* PxArticulationTendonJoint_getTendon(physx_PxArticulationTendonJoint const* self__pod) { + physx::PxArticulationTendonJoint const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationFixedTendon* return_val = self_->getTendon(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationTendonJoint_release_mut(physx_PxArticulationTendonJoint* self__pod) { + physx::PxArticulationTendonJoint* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT char const* PxArticulationTendonJoint_getConcreteTypeName(physx_PxArticulationTendonJoint const* self__pod) { + physx::PxArticulationTendonJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxArticulationTendon_setStiffness_mut(physx_PxArticulationTendon* self__pod, float stiffness) { + physx::PxArticulationTendon* self_ = reinterpret_cast(self__pod); + self_->setStiffness(stiffness); + } + + DLLEXPORT float PxArticulationTendon_getStiffness(physx_PxArticulationTendon const* self__pod) { + physx::PxArticulationTendon const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStiffness(); + return return_val; + } + + DLLEXPORT void PxArticulationTendon_setDamping_mut(physx_PxArticulationTendon* self__pod, float damping) { + physx::PxArticulationTendon* self_ = reinterpret_cast(self__pod); + self_->setDamping(damping); + } + + DLLEXPORT float PxArticulationTendon_getDamping(physx_PxArticulationTendon const* self__pod) { + physx::PxArticulationTendon const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDamping(); + return return_val; + } + + DLLEXPORT void PxArticulationTendon_setLimitStiffness_mut(physx_PxArticulationTendon* self__pod, float stiffness) { + physx::PxArticulationTendon* self_ = reinterpret_cast(self__pod); + self_->setLimitStiffness(stiffness); + } + + DLLEXPORT float PxArticulationTendon_getLimitStiffness(physx_PxArticulationTendon const* self__pod) { + physx::PxArticulationTendon const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getLimitStiffness(); + return return_val; + } + + DLLEXPORT void PxArticulationTendon_setOffset_mut(physx_PxArticulationTendon* self__pod, float offset, bool autowake) { + physx::PxArticulationTendon* self_ = reinterpret_cast(self__pod); + self_->setOffset(offset, autowake); + } + + DLLEXPORT float PxArticulationTendon_getOffset(physx_PxArticulationTendon const* self__pod) { + physx::PxArticulationTendon const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getOffset(); + return return_val; + } + + DLLEXPORT physx_PxArticulationReducedCoordinate* PxArticulationTendon_getArticulation(physx_PxArticulationTendon const* self__pod) { + physx::PxArticulationTendon const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate* return_val = self_->getArticulation(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationTendon_release_mut(physx_PxArticulationTendon* self__pod) { + physx::PxArticulationTendon* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxArticulationAttachment* PxArticulationSpatialTendon_createAttachment_mut(physx_PxArticulationSpatialTendon* self__pod, physx_PxArticulationAttachment* parent_pod, float coefficient, physx_PxVec3 relativeOffset_pod, physx_PxArticulationLink* link_pod) { + physx::PxArticulationSpatialTendon* self_ = reinterpret_cast(self__pod); + physx::PxArticulationAttachment* parent = reinterpret_cast(parent_pod); + physx::PxVec3 relativeOffset; + memcpy(&relativeOffset, &relativeOffset_pod, sizeof(relativeOffset)); + physx::PxArticulationLink* link = reinterpret_cast(link_pod); + physx::PxArticulationAttachment* return_val = self_->createAttachment(parent, coefficient, relativeOffset, link); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationSpatialTendon_getAttachments(physx_PxArticulationSpatialTendon const* self__pod, physx_PxArticulationAttachment** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationSpatialTendon const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationAttachment** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getAttachments(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationSpatialTendon_getNbAttachments(physx_PxArticulationSpatialTendon const* self__pod) { + physx::PxArticulationSpatialTendon const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbAttachments(); + return return_val; + } + + DLLEXPORT char const* PxArticulationSpatialTendon_getConcreteTypeName(physx_PxArticulationSpatialTendon const* self__pod) { + physx::PxArticulationSpatialTendon const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxArticulationTendonJoint* PxArticulationFixedTendon_createTendonJoint_mut(physx_PxArticulationFixedTendon* self__pod, physx_PxArticulationTendonJoint* parent_pod, int32_t axis_pod, float coefficient, float recipCoefficient, physx_PxArticulationLink* link_pod) { + physx::PxArticulationFixedTendon* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonJoint* parent = reinterpret_cast(parent_pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationLink* link = reinterpret_cast(link_pod); + physx::PxArticulationTendonJoint* return_val = self_->createTendonJoint(parent, axis, coefficient, recipCoefficient, link); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationFixedTendon_getTendonJoints(physx_PxArticulationFixedTendon const* self__pod, physx_PxArticulationTendonJoint** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationFixedTendon const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonJoint** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getTendonJoints(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationFixedTendon_getNbTendonJoints(physx_PxArticulationFixedTendon const* self__pod) { + physx::PxArticulationFixedTendon const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTendonJoints(); + return return_val; + } + + DLLEXPORT void PxArticulationFixedTendon_setRestLength_mut(physx_PxArticulationFixedTendon* self__pod, float restLength) { + physx::PxArticulationFixedTendon* self_ = reinterpret_cast(self__pod); + self_->setRestLength(restLength); + } + + DLLEXPORT float PxArticulationFixedTendon_getRestLength(physx_PxArticulationFixedTendon const* self__pod) { + physx::PxArticulationFixedTendon const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestLength(); + return return_val; + } + + DLLEXPORT void PxArticulationFixedTendon_setLimitParameters_mut(physx_PxArticulationFixedTendon* self__pod, physx_PxArticulationTendonLimit const* parameter_pod) { + physx::PxArticulationFixedTendon* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonLimit const& parameter = reinterpret_cast(*parameter_pod); + self_->setLimitParameters(parameter); + } + + DLLEXPORT physx_PxArticulationTendonLimit PxArticulationFixedTendon_getLimitParameters(physx_PxArticulationFixedTendon const* self__pod) { + physx::PxArticulationFixedTendon const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationTendonLimit return_val = self_->getLimitParameters(); + physx_PxArticulationTendonLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxArticulationFixedTendon_getConcreteTypeName(physx_PxArticulationFixedTendon const* self__pod) { + physx::PxArticulationFixedTendon const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxArticulationCache PxArticulationCache_new() { + PxArticulationCache return_val; + physx_PxArticulationCache return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationCache_release_mut(physx_PxArticulationCache* self__pod) { + physx::PxArticulationCache* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxArticulationSensor_release_mut(physx_PxArticulationSensor* self__pod) { + physx::PxArticulationSensor* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxSpatialForce PxArticulationSensor_getForces(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + physx::PxSpatialForce return_val = self_->getForces(); + physx_PxSpatialForce return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxArticulationSensor_getRelativePose(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getRelativePose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationSensor_setRelativePose_mut(physx_PxArticulationSensor* self__pod, physx_PxTransform const* pose_pod) { + physx::PxArticulationSensor* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setRelativePose(pose); + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationSensor_getLink(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink* return_val = self_->getLink(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationSensor_getIndex(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getIndex(); + return return_val; + } + + DLLEXPORT physx_PxArticulationReducedCoordinate* PxArticulationSensor_getArticulation(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate* return_val = self_->getArticulation(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint8_t PxArticulationSensor_getFlags(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationSensorFlags return_val = self_->getFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationSensor_setFlag_mut(physx_PxArticulationSensor* self__pod, int32_t flag_pod, bool enabled) { + physx::PxArticulationSensor* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, enabled); + } + + DLLEXPORT char const* PxArticulationSensor_getConcreteTypeName(physx_PxArticulationSensor const* self__pod) { + physx::PxArticulationSensor const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxScene* PxArticulationReducedCoordinate_getScene(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setSolverIterationCounts_mut(physx_PxArticulationReducedCoordinate* self__pod, uint32_t minPositionIters, uint32_t minVelocityIters) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setSolverIterationCounts(minPositionIters, minVelocityIters); + } + + DLLEXPORT void PxArticulationReducedCoordinate_getSolverIterationCounts(physx_PxArticulationReducedCoordinate const* self__pod, uint32_t* minPositionIters_pod, uint32_t* minVelocityIters_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t& minPositionIters = *minPositionIters_pod; + uint32_t& minVelocityIters = *minVelocityIters_pod; + self_->getSolverIterationCounts(minPositionIters, minVelocityIters); + } + + DLLEXPORT bool PxArticulationReducedCoordinate_isSleeping(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSleeping(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setSleepThreshold_mut(physx_PxArticulationReducedCoordinate* self__pod, float threshold) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setSleepThreshold(threshold); + } + + DLLEXPORT float PxArticulationReducedCoordinate_getSleepThreshold(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSleepThreshold(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setStabilizationThreshold_mut(physx_PxArticulationReducedCoordinate* self__pod, float threshold) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setStabilizationThreshold(threshold); + } + + DLLEXPORT float PxArticulationReducedCoordinate_getStabilizationThreshold(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStabilizationThreshold(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setWakeCounter_mut(physx_PxArticulationReducedCoordinate* self__pod, float wakeCounterValue) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setWakeCounter(wakeCounterValue); + } + + DLLEXPORT float PxArticulationReducedCoordinate_getWakeCounter(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getWakeCounter(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_wakeUp_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->wakeUp(); + } + + DLLEXPORT void PxArticulationReducedCoordinate_putToSleep_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->putToSleep(); + } + + DLLEXPORT void PxArticulationReducedCoordinate_setMaxCOMLinearVelocity_mut(physx_PxArticulationReducedCoordinate* self__pod, float maxLinearVelocity) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setMaxCOMLinearVelocity(maxLinearVelocity); + } + + DLLEXPORT float PxArticulationReducedCoordinate_getMaxCOMLinearVelocity(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxCOMLinearVelocity(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setMaxCOMAngularVelocity_mut(physx_PxArticulationReducedCoordinate* self__pod, float maxAngularVelocity) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setMaxCOMAngularVelocity(maxAngularVelocity); + } + + DLLEXPORT float PxArticulationReducedCoordinate_getMaxCOMAngularVelocity(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxCOMAngularVelocity(); + return return_val; + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationReducedCoordinate_createLink_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxArticulationLink* parent_pod, physx_PxTransform const* pose_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink* parent = reinterpret_cast(parent_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxArticulationLink* return_val = self_->createLink(parent, pose); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationReducedCoordinate_release_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbLinks(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbLinks(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getLinks(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationLink** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getLinks(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbShapes(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbShapes(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setName_mut(physx_PxArticulationReducedCoordinate* self__pod, char const* name) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setName(name); + } + + DLLEXPORT char const* PxArticulationReducedCoordinate_getName(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getName(); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxArticulationReducedCoordinate_getWorldBounds(physx_PxArticulationReducedCoordinate const* self__pod, float inflation) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getWorldBounds(inflation); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxAggregate* PxArticulationReducedCoordinate_getAggregate(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxAggregate* return_val = self_->getAggregate(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setArticulationFlags_mut(physx_PxArticulationReducedCoordinate* self__pod, uint8_t flags_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxArticulationFlags(flags_pod); + self_->setArticulationFlags(flags); + } + + DLLEXPORT void PxArticulationReducedCoordinate_setArticulationFlag_mut(physx_PxArticulationReducedCoordinate* self__pod, int32_t flag_pod, bool value) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setArticulationFlag(flag, value); + } + + DLLEXPORT uint8_t PxArticulationReducedCoordinate_getArticulationFlags(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationFlags return_val = self_->getArticulationFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getDofs(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getDofs(); + return return_val; + } + + DLLEXPORT physx_PxArticulationCache* PxArticulationReducedCoordinate_createCache(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache* return_val = self_->createCache(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getCacheDataSize(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getCacheDataSize(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_zeroCache(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->zeroCache(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_applyCache_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxArticulationCache* cache_pod, uint32_t flags_pod, bool autowake) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + auto flags = physx::PxArticulationCacheFlags(flags_pod); + self_->applyCache(cache, flags, autowake); + } + + DLLEXPORT void PxArticulationReducedCoordinate_copyInternalStateToCache(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod, uint32_t flags_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + auto flags = physx::PxArticulationCacheFlags(flags_pod); + self_->copyInternalStateToCache(cache, flags); + } + + DLLEXPORT void PxArticulationReducedCoordinate_packJointData(physx_PxArticulationReducedCoordinate const* self__pod, float const* maximum, float* reduced) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + self_->packJointData(maximum, reduced); + } + + DLLEXPORT void PxArticulationReducedCoordinate_unpackJointData(physx_PxArticulationReducedCoordinate const* self__pod, float const* reduced, float* maximum) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + self_->unpackJointData(reduced, maximum); + } + + DLLEXPORT void PxArticulationReducedCoordinate_commonInit(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + self_->commonInit(); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeGeneralizedGravityForce(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeGeneralizedGravityForce(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeCoriolisAndCentrifugalForce(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeCoriolisAndCentrifugalForce(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeGeneralizedExternalForce(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeGeneralizedExternalForce(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeJointAcceleration(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeJointAcceleration(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeJointForce(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeJointForce(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeDenseJacobian(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod, uint32_t* nRows_pod, uint32_t* nCols_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + uint32_t& nRows = *nRows_pod; + uint32_t& nCols = *nCols_pod; + self_->computeDenseJacobian(cache, nRows, nCols); + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeCoefficientMatrix(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeCoefficientMatrix(cache); + } + + DLLEXPORT bool PxArticulationReducedCoordinate_computeLambda(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod, physx_PxArticulationCache* initialState_pod, float const*const jointTorque, uint32_t maxIter) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + physx::PxArticulationCache& initialState = reinterpret_cast(*initialState_pod); + bool return_val = self_->computeLambda(cache, initialState, jointTorque, maxIter); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_computeGeneralizedMassMatrix(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationCache* cache_pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationCache& cache = reinterpret_cast(*cache_pod); + self_->computeGeneralizedMassMatrix(cache); + } + + DLLEXPORT void PxArticulationReducedCoordinate_addLoopJoint_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxConstraint* joint_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxConstraint* joint = reinterpret_cast(joint_pod); + self_->addLoopJoint(joint); + } + + DLLEXPORT void PxArticulationReducedCoordinate_removeLoopJoint_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxConstraint* joint_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxConstraint* joint = reinterpret_cast(joint_pod); + self_->removeLoopJoint(joint); + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbLoopJoints(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbLoopJoints(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getLoopJoints(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxConstraint** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxConstraint** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getLoopJoints(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getCoefficientMatrixSize(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getCoefficientMatrixSize(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setRootGlobalPose_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxTransform const* pose_pod, bool autowake) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setRootGlobalPose(pose, autowake); + } + + DLLEXPORT physx_PxTransform PxArticulationReducedCoordinate_getRootGlobalPose(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getRootGlobalPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setRootLinearVelocity_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxVec3 const* linearVelocity_pod, bool autowake) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& linearVelocity = reinterpret_cast(*linearVelocity_pod); + self_->setRootLinearVelocity(linearVelocity, autowake); + } + + DLLEXPORT physx_PxVec3 PxArticulationReducedCoordinate_getRootLinearVelocity(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getRootLinearVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationReducedCoordinate_setRootAngularVelocity_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxVec3 const* angularVelocity_pod, bool autowake) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& angularVelocity = reinterpret_cast(*angularVelocity_pod); + self_->setRootAngularVelocity(angularVelocity, autowake); + } + + DLLEXPORT physx_PxVec3 PxArticulationReducedCoordinate_getRootAngularVelocity(physx_PxArticulationReducedCoordinate const* self__pod) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getRootAngularVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxSpatialVelocity PxArticulationReducedCoordinate_getLinkAcceleration_mut(physx_PxArticulationReducedCoordinate* self__pod, uint32_t linkId) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxSpatialVelocity return_val = self_->getLinkAcceleration(linkId); + physx_PxSpatialVelocity return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getGpuArticulationIndex_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getGpuArticulationIndex(); + return return_val; + } + + DLLEXPORT physx_PxArticulationSpatialTendon* PxArticulationReducedCoordinate_createSpatialTendon_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationSpatialTendon* return_val = self_->createSpatialTendon(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationFixedTendon* PxArticulationReducedCoordinate_createFixedTendon_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationFixedTendon* return_val = self_->createFixedTendon(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationSensor* PxArticulationReducedCoordinate_createSensor_mut(physx_PxArticulationReducedCoordinate* self__pod, physx_PxArticulationLink* link_pod, physx_PxTransform const* relativePose_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink* link = reinterpret_cast(link_pod); + physx::PxTransform const& relativePose = reinterpret_cast(*relativePose_pod); + physx::PxArticulationSensor* return_val = self_->createSensor(link, relativePose); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getSpatialTendons(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationSpatialTendon** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationSpatialTendon** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getSpatialTendons(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbSpatialTendons_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbSpatialTendons(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getFixedTendons(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationFixedTendon** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationFixedTendon** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getFixedTendons(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbFixedTendons_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbFixedTendons(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getSensors(physx_PxArticulationReducedCoordinate const* self__pod, physx_PxArticulationSensor** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationSensor** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getSensors(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationReducedCoordinate_getNbSensors_mut(physx_PxArticulationReducedCoordinate* self__pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbSensors(); + return return_val; + } + + DLLEXPORT void PxArticulationReducedCoordinate_updateKinematic_mut(physx_PxArticulationReducedCoordinate* self__pod, uint8_t flags_pod) { + physx::PxArticulationReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxArticulationKinematicFlags(flags_pod); + self_->updateKinematic(flags); + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationJointReducedCoordinate_getParentArticulationLink(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink& return_val = self_->getParentArticulationLink(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setParentPose_mut(physx_PxArticulationJointReducedCoordinate* self__pod, physx_PxTransform const* pose_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setParentPose(pose); + } + + DLLEXPORT physx_PxTransform PxArticulationJointReducedCoordinate_getParentPose(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getParentPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationLink* PxArticulationJointReducedCoordinate_getChildArticulationLink(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink& return_val = self_->getChildArticulationLink(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setChildPose_mut(physx_PxArticulationJointReducedCoordinate* self__pod, physx_PxTransform const* pose_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setChildPose(pose); + } + + DLLEXPORT physx_PxTransform PxArticulationJointReducedCoordinate_getChildPose(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getChildPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setJointType_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t jointType_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto jointType = static_cast(jointType_pod); + self_->setJointType(jointType); + } + + DLLEXPORT int32_t PxArticulationJointReducedCoordinate_getJointType(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationJointType::Enum return_val = self_->getJointType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setMotion_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, int32_t motion_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + auto motion = static_cast(motion_pod); + self_->setMotion(axis, motion); + } + + DLLEXPORT int32_t PxArticulationJointReducedCoordinate_getMotion(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationMotion::Enum return_val = self_->getMotion(axis); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setLimitParams_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, physx_PxArticulationLimit const* limit_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationLimit const& limit = reinterpret_cast(*limit_pod); + self_->setLimitParams(axis, limit); + } + + DLLEXPORT physx_PxArticulationLimit PxArticulationJointReducedCoordinate_getLimitParams(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationLimit return_val = self_->getLimitParams(axis); + physx_PxArticulationLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setDriveParams_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, physx_PxArticulationDrive const* drive_pod) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationDrive const& drive = reinterpret_cast(*drive_pod); + self_->setDriveParams(axis, drive); + } + + DLLEXPORT physx_PxArticulationDrive PxArticulationJointReducedCoordinate_getDriveParams(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxArticulationDrive return_val = self_->getDriveParams(axis); + physx_PxArticulationDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setDriveTarget_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, float target, bool autowake) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setDriveTarget(axis, target, autowake); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getDriveTarget(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + float return_val = self_->getDriveTarget(axis); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setDriveVelocity_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, float targetVel, bool autowake) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setDriveVelocity(axis, targetVel, autowake); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getDriveVelocity(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + float return_val = self_->getDriveVelocity(axis); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setArmature_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, float armature) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setArmature(axis, armature); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getArmature(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + float return_val = self_->getArmature(axis); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setFrictionCoefficient_mut(physx_PxArticulationJointReducedCoordinate* self__pod, float coefficient) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setFrictionCoefficient(coefficient); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getFrictionCoefficient(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getFrictionCoefficient(); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setMaxJointVelocity_mut(physx_PxArticulationJointReducedCoordinate* self__pod, float maxJointV) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + self_->setMaxJointVelocity(maxJointV); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getMaxJointVelocity(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxJointVelocity(); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setJointPosition_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, float jointPos) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setJointPosition(axis, jointPos); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getJointPosition(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + float return_val = self_->getJointPosition(axis); + return return_val; + } + + DLLEXPORT void PxArticulationJointReducedCoordinate_setJointVelocity_mut(physx_PxArticulationJointReducedCoordinate* self__pod, int32_t axis_pod, float jointVel) { + physx::PxArticulationJointReducedCoordinate* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + self_->setJointVelocity(axis, jointVel); + } + + DLLEXPORT float PxArticulationJointReducedCoordinate_getJointVelocity(physx_PxArticulationJointReducedCoordinate const* self__pod, int32_t axis_pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + float return_val = self_->getJointVelocity(axis); + return return_val; + } + + DLLEXPORT char const* PxArticulationJointReducedCoordinate_getConcreteTypeName(physx_PxArticulationJointReducedCoordinate const* self__pod) { + physx::PxArticulationJointReducedCoordinate const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxShape_release_mut(physx_PxShape* self__pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxShape_setGeometry_mut(physx_PxShape* self__pod, physx_PxGeometry const* geometry_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + self_->setGeometry(geometry); + } + + DLLEXPORT physx_PxGeometry const* PxShape_getGeometry(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& return_val = self_->getGeometry(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidActor* PxShape_getActor(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* return_val = self_->getActor(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxShape_setLocalPose_mut(physx_PxShape* self__pod, physx_PxTransform const* pose_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setLocalPose(pose); + } + + DLLEXPORT physx_PxTransform PxShape_getLocalPose(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getLocalPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxShape_setSimulationFilterData_mut(physx_PxShape* self__pod, physx_PxFilterData const* data_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxFilterData const& data = reinterpret_cast(*data_pod); + self_->setSimulationFilterData(data); + } + + DLLEXPORT physx_PxFilterData PxShape_getSimulationFilterData(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxFilterData return_val = self_->getSimulationFilterData(); + physx_PxFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxShape_setQueryFilterData_mut(physx_PxShape* self__pod, physx_PxFilterData const* data_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxFilterData const& data = reinterpret_cast(*data_pod); + self_->setQueryFilterData(data); + } + + DLLEXPORT physx_PxFilterData PxShape_getQueryFilterData(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxFilterData return_val = self_->getQueryFilterData(); + physx_PxFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxShape_setMaterials_mut(physx_PxShape* self__pod, physx_PxMaterial* const* materials_pod, uint16_t materialCount) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + physx::PxMaterial* const* materials = reinterpret_cast(materials_pod); + self_->setMaterials(materials, materialCount); + } + + DLLEXPORT uint16_t PxShape_getNbMaterials(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getNbMaterials(); + return return_val; + } + + DLLEXPORT uint32_t PxShape_getMaterials(physx_PxShape const* self__pod, physx_PxMaterial** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxMaterial** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getMaterials(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxBaseMaterial* PxShape_getMaterialFromInternalFaceIndex(physx_PxShape const* self__pod, uint32_t faceIndex) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + physx::PxBaseMaterial* return_val = self_->getMaterialFromInternalFaceIndex(faceIndex); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxShape_setContactOffset_mut(physx_PxShape* self__pod, float contactOffset) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setContactOffset(contactOffset); + } + + DLLEXPORT float PxShape_getContactOffset(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getContactOffset(); + return return_val; + } + + DLLEXPORT void PxShape_setRestOffset_mut(physx_PxShape* self__pod, float restOffset) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setRestOffset(restOffset); + } + + DLLEXPORT float PxShape_getRestOffset(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestOffset(); + return return_val; + } + + DLLEXPORT void PxShape_setDensityForFluid_mut(physx_PxShape* self__pod, float densityForFluid) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setDensityForFluid(densityForFluid); + } + + DLLEXPORT float PxShape_getDensityForFluid(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDensityForFluid(); + return return_val; + } + + DLLEXPORT void PxShape_setTorsionalPatchRadius_mut(physx_PxShape* self__pod, float radius) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setTorsionalPatchRadius(radius); + } + + DLLEXPORT float PxShape_getTorsionalPatchRadius(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getTorsionalPatchRadius(); + return return_val; + } + + DLLEXPORT void PxShape_setMinTorsionalPatchRadius_mut(physx_PxShape* self__pod, float radius) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setMinTorsionalPatchRadius(radius); + } + + DLLEXPORT float PxShape_getMinTorsionalPatchRadius(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMinTorsionalPatchRadius(); + return return_val; + } + + DLLEXPORT void PxShape_setFlag_mut(physx_PxShape* self__pod, int32_t flag_pod, bool value) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, value); + } + + DLLEXPORT void PxShape_setFlags_mut(physx_PxShape* self__pod, uint8_t inFlags_pod) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + auto inFlags = physx::PxShapeFlags(inFlags_pod); + self_->setFlags(inFlags); + } + + DLLEXPORT uint8_t PxShape_getFlags(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(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; + } + + DLLEXPORT bool PxShape_isExclusive(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isExclusive(); + return return_val; + } + + DLLEXPORT void PxShape_setName_mut(physx_PxShape* self__pod, char const* name) { + physx::PxShape* self_ = reinterpret_cast(self__pod); + self_->setName(name); + } + + DLLEXPORT char const* PxShape_getName(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getName(); + return return_val; + } + + DLLEXPORT char const* PxShape_getConcreteTypeName(physx_PxShape const* self__pod) { + physx::PxShape const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxRigidActor_release_mut(physx_PxRigidActor* self__pod) { + physx::PxRigidActor* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxRigidActor_getInternalActorIndex(physx_PxRigidActor const* self__pod) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getInternalActorIndex(); + return return_val; + } + + DLLEXPORT physx_PxTransform PxRigidActor_getGlobalPose(physx_PxRigidActor const* self__pod) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getGlobalPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidActor_setGlobalPose_mut(physx_PxRigidActor* self__pod, physx_PxTransform const* pose_pod, bool autowake) { + physx::PxRigidActor* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setGlobalPose(pose, autowake); + } + + DLLEXPORT bool PxRigidActor_attachShape_mut(physx_PxRigidActor* self__pod, physx_PxShape* shape_pod) { + physx::PxRigidActor* self_ = reinterpret_cast(self__pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + bool return_val = self_->attachShape(shape); + return return_val; + } + + DLLEXPORT void PxRigidActor_detachShape_mut(physx_PxRigidActor* self__pod, physx_PxShape* shape_pod, bool wakeOnLostTouch) { + physx::PxRigidActor* self_ = reinterpret_cast(self__pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + self_->detachShape(shape, wakeOnLostTouch); + } + + DLLEXPORT uint32_t PxRigidActor_getNbShapes(physx_PxRigidActor const* self__pod) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbShapes(); + return return_val; + } + + DLLEXPORT uint32_t PxRigidActor_getShapes(physx_PxRigidActor const* self__pod, physx_PxShape** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + physx::PxShape** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getShapes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxRigidActor_getNbConstraints(physx_PxRigidActor const* self__pod) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbConstraints(); + return return_val; + } + + DLLEXPORT uint32_t PxRigidActor_getConstraints(physx_PxRigidActor const* self__pod, physx_PxConstraint** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxRigidActor const* self_ = reinterpret_cast(self__pod); + physx::PxConstraint** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getConstraints(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxNodeIndex PxNodeIndex_new(uint32_t id, uint32_t articLinkId) { + PxNodeIndex return_val(id, articLinkId); + physx_PxNodeIndex return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxNodeIndex PxNodeIndex_new_1(uint32_t id) { + PxNodeIndex return_val(id); + physx_PxNodeIndex return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxNodeIndex_index(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->index(); + return return_val; + } + + DLLEXPORT uint32_t PxNodeIndex_articulationLinkId(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->articulationLinkId(); + return return_val; + } + + DLLEXPORT uint32_t PxNodeIndex_isArticulation(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->isArticulation(); + return return_val; + } + + DLLEXPORT bool PxNodeIndex_isStaticBody(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isStaticBody(); + return return_val; + } + + DLLEXPORT bool PxNodeIndex_isValid(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxNodeIndex_setIndices_mut(physx_PxNodeIndex* self__pod, uint32_t index, uint32_t articLinkId) { + physx::PxNodeIndex* self_ = reinterpret_cast(self__pod); + self_->setIndices(index, articLinkId); + } + + DLLEXPORT void PxNodeIndex_setIndices_mut_1(physx_PxNodeIndex* self__pod, uint32_t index) { + physx::PxNodeIndex* self_ = reinterpret_cast(self__pod); + self_->setIndices(index); + } + + DLLEXPORT uint64_t PxNodeIndex_getInd(physx_PxNodeIndex const* self__pod) { + physx::PxNodeIndex const* self_ = reinterpret_cast(self__pod); + uint64_t return_val = self_->getInd(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setCMassLocalPose_mut(physx_PxRigidBody* self__pod, physx_PxTransform const* pose_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setCMassLocalPose(pose); + } + + DLLEXPORT physx_PxTransform PxRigidBody_getCMassLocalPose(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getCMassLocalPose(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBody_setMass_mut(physx_PxRigidBody* self__pod, float mass) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMass(mass); + } + + DLLEXPORT float PxRigidBody_getMass(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMass(); + return return_val; + } + + DLLEXPORT float PxRigidBody_getInvMass(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMass(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setMassSpaceInertiaTensor_mut(physx_PxRigidBody* self__pod, physx_PxVec3 const* m_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& m = reinterpret_cast(*m_pod); + self_->setMassSpaceInertiaTensor(m); + } + + DLLEXPORT physx_PxVec3 PxRigidBody_getMassSpaceInertiaTensor(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getMassSpaceInertiaTensor(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxRigidBody_getMassSpaceInvInertiaTensor(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getMassSpaceInvInertiaTensor(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBody_setLinearDamping_mut(physx_PxRigidBody* self__pod, float linDamp) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setLinearDamping(linDamp); + } + + DLLEXPORT float PxRigidBody_getLinearDamping(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getLinearDamping(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setAngularDamping_mut(physx_PxRigidBody* self__pod, float angDamp) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setAngularDamping(angDamp); + } + + DLLEXPORT float PxRigidBody_getAngularDamping(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getAngularDamping(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxRigidBody_getLinearVelocity(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getLinearVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxRigidBody_getAngularVelocity(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getAngularVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBody_setMaxLinearVelocity_mut(physx_PxRigidBody* self__pod, float maxLinVel) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMaxLinearVelocity(maxLinVel); + } + + DLLEXPORT float PxRigidBody_getMaxLinearVelocity(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxLinearVelocity(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setMaxAngularVelocity_mut(physx_PxRigidBody* self__pod, float maxAngVel) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMaxAngularVelocity(maxAngVel); + } + + DLLEXPORT float PxRigidBody_getMaxAngularVelocity(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxAngularVelocity(); + return return_val; + } + + DLLEXPORT void PxRigidBody_addForce_mut(physx_PxRigidBody* self__pod, physx_PxVec3 const* force_pod, int32_t mode_pod, bool autowake) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + auto mode = static_cast(mode_pod); + self_->addForce(force, mode, autowake); + } + + DLLEXPORT void PxRigidBody_addTorque_mut(physx_PxRigidBody* self__pod, physx_PxVec3 const* torque_pod, int32_t mode_pod, bool autowake) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& torque = reinterpret_cast(*torque_pod); + auto mode = static_cast(mode_pod); + self_->addTorque(torque, mode, autowake); + } + + DLLEXPORT void PxRigidBody_clearForce_mut(physx_PxRigidBody* self__pod, int32_t mode_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + auto mode = static_cast(mode_pod); + self_->clearForce(mode); + } + + DLLEXPORT void PxRigidBody_clearTorque_mut(physx_PxRigidBody* self__pod, int32_t mode_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + auto mode = static_cast(mode_pod); + self_->clearTorque(mode); + } + + DLLEXPORT void PxRigidBody_setForceAndTorque_mut(physx_PxRigidBody* self__pod, physx_PxVec3 const* force_pod, physx_PxVec3 const* torque_pod, int32_t mode_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + physx::PxVec3 const& torque = reinterpret_cast(*torque_pod); + auto mode = static_cast(mode_pod); + self_->setForceAndTorque(force, torque, mode); + } + + DLLEXPORT void PxRigidBody_setRigidBodyFlag_mut(physx_PxRigidBody* self__pod, int32_t flag_pod, bool value) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setRigidBodyFlag(flag, value); + } + + DLLEXPORT void PxRigidBody_setRigidBodyFlags_mut(physx_PxRigidBody* self__pod, uint16_t inFlags_pod) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + auto inFlags = physx::PxRigidBodyFlags(inFlags_pod); + self_->setRigidBodyFlags(inFlags); + } + + DLLEXPORT uint16_t PxRigidBody_getRigidBodyFlags(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxRigidBodyFlags return_val = self_->getRigidBodyFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBody_setMinCCDAdvanceCoefficient_mut(physx_PxRigidBody* self__pod, float advanceCoefficient) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMinCCDAdvanceCoefficient(advanceCoefficient); + } + + DLLEXPORT float PxRigidBody_getMinCCDAdvanceCoefficient(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMinCCDAdvanceCoefficient(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setMaxDepenetrationVelocity_mut(physx_PxRigidBody* self__pod, float biasClamp) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMaxDepenetrationVelocity(biasClamp); + } + + DLLEXPORT float PxRigidBody_getMaxDepenetrationVelocity(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxDepenetrationVelocity(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setMaxContactImpulse_mut(physx_PxRigidBody* self__pod, float maxImpulse) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setMaxContactImpulse(maxImpulse); + } + + DLLEXPORT float PxRigidBody_getMaxContactImpulse(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxContactImpulse(); + return return_val; + } + + DLLEXPORT void PxRigidBody_setContactSlopCoefficient_mut(physx_PxRigidBody* self__pod, float slopCoefficient) { + physx::PxRigidBody* self_ = reinterpret_cast(self__pod); + self_->setContactSlopCoefficient(slopCoefficient); + } + + DLLEXPORT float PxRigidBody_getContactSlopCoefficient(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getContactSlopCoefficient(); + return return_val; + } + + DLLEXPORT physx_PxNodeIndex PxRigidBody_getInternalIslandNodeIndex(physx_PxRigidBody const* self__pod) { + physx::PxRigidBody const* self_ = reinterpret_cast(self__pod); + physx::PxNodeIndex return_val = self_->getInternalIslandNodeIndex(); + physx_PxNodeIndex return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxArticulationLink_release_mut(physx_PxArticulationLink* self__pod) { + physx::PxArticulationLink* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxArticulationReducedCoordinate* PxArticulationLink_getArticulation(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate& return_val = self_->getArticulation(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationJointReducedCoordinate* PxArticulationLink_getInboundJoint(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationJointReducedCoordinate* return_val = self_->getInboundJoint(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxArticulationLink_getInboundJointDof(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getInboundJointDof(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationLink_getNbChildren(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbChildren(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationLink_getLinkIndex(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getLinkIndex(); + return return_val; + } + + DLLEXPORT uint32_t PxArticulationLink_getChildren(physx_PxArticulationLink const* self__pod, physx_PxArticulationLink** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationLink** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getChildren(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT void PxArticulationLink_setCfmScale_mut(physx_PxArticulationLink* self__pod, float cfm) { + physx::PxArticulationLink* self_ = reinterpret_cast(self__pod); + self_->setCfmScale(cfm); + } + + DLLEXPORT float PxArticulationLink_getCfmScale(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getCfmScale(); + return return_val; + } + + DLLEXPORT physx_PxVec3 PxArticulationLink_getLinearVelocity(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getLinearVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxArticulationLink_getAngularVelocity(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getAngularVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxArticulationLink_getConcreteTypeName(physx_PxArticulationLink const* self__pod) { + physx::PxArticulationLink const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxConeLimitedConstraint PxConeLimitedConstraint_new() { + PxConeLimitedConstraint return_val; + physx_PxConeLimitedConstraint return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxConstraint_release_mut(physx_PxConstraint* self__pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxScene* PxConstraint_getScene(physx_PxConstraint const* self__pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxConstraint_getActors(physx_PxConstraint const* self__pod, physx_PxRigidActor** actor0_pod, physx_PxRigidActor** actor1_pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor*& actor0 = reinterpret_cast(*actor0_pod); + physx::PxRigidActor*& actor1 = reinterpret_cast(*actor1_pod); + self_->getActors(actor0, actor1); + } + + DLLEXPORT void PxConstraint_setActors_mut(physx_PxConstraint* self__pod, physx_PxRigidActor* actor0_pod, physx_PxRigidActor* actor1_pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + self_->setActors(actor0, actor1); + } + + DLLEXPORT void PxConstraint_markDirty_mut(physx_PxConstraint* self__pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + self_->markDirty(); + } + + DLLEXPORT uint16_t PxConstraint_getFlags(physx_PxConstraint const* self__pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + physx::PxConstraintFlags return_val = self_->getFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxConstraint_setFlags_mut(physx_PxConstraint* self__pod, uint16_t flags_pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxConstraintFlags(flags_pod); + self_->setFlags(flags); + } + + DLLEXPORT void PxConstraint_setFlag_mut(physx_PxConstraint* self__pod, int32_t flag_pod, bool value) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, value); + } + + DLLEXPORT void PxConstraint_getForce(physx_PxConstraint const* self__pod, physx_PxVec3* linear_pod, physx_PxVec3* angular_pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3& linear = reinterpret_cast(*linear_pod); + physx::PxVec3& angular = reinterpret_cast(*angular_pod); + self_->getForce(linear, angular); + } + + DLLEXPORT bool PxConstraint_isValid(physx_PxConstraint const* self__pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxConstraint_setBreakForce_mut(physx_PxConstraint* self__pod, float linear, float angular) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + self_->setBreakForce(linear, angular); + } + + DLLEXPORT void PxConstraint_getBreakForce(physx_PxConstraint const* self__pod, float* linear_pod, float* angular_pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + float& linear = *linear_pod; + float& angular = *angular_pod; + self_->getBreakForce(linear, angular); + } + + DLLEXPORT void PxConstraint_setMinResponseThreshold_mut(physx_PxConstraint* self__pod, float threshold) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + self_->setMinResponseThreshold(threshold); + } + + DLLEXPORT float PxConstraint_getMinResponseThreshold(physx_PxConstraint const* self__pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMinResponseThreshold(); + return return_val; + } + + DLLEXPORT void* PxConstraint_getExternalReference_mut(physx_PxConstraint* self__pod, uint32_t* typeID_pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + uint32_t& typeID = *typeID_pod; + void* return_val = self_->getExternalReference(typeID); + return return_val; + } + + DLLEXPORT void PxConstraint_setConstraintFunctions_mut(physx_PxConstraint* self__pod, physx_PxConstraintConnector* connector_pod, physx_PxConstraintShaderTable const* shaders_pod) { + physx::PxConstraint* self_ = reinterpret_cast(self__pod); + physx::PxConstraintConnector& connector = reinterpret_cast(*connector_pod); + physx::PxConstraintShaderTable const& shaders = reinterpret_cast(*shaders_pod); + self_->setConstraintFunctions(connector, shaders); + } + + DLLEXPORT char const* PxConstraint_getConcreteTypeName(physx_PxConstraint const* self__pod) { + physx::PxConstraint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxContactStreamIterator PxContactStreamIterator_new(uint8_t const* contactPatches, uint8_t const* contactPoints, uint32_t const* contactFaceIndices, uint32_t nbPatches, uint32_t nbContacts) { + PxContactStreamIterator return_val(contactPatches, contactPoints, contactFaceIndices, nbPatches, nbContacts); + physx_PxContactStreamIterator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxContactStreamIterator_hasNextPatch(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->hasNextPatch(); + return return_val; + } + + DLLEXPORT uint32_t PxContactStreamIterator_getTotalContactCount(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getTotalContactCount(); + return return_val; + } + + DLLEXPORT uint32_t PxContactStreamIterator_getTotalPatchCount(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getTotalPatchCount(); + return return_val; + } + + DLLEXPORT void PxContactStreamIterator_nextPatch_mut(physx_PxContactStreamIterator* self__pod) { + physx::PxContactStreamIterator* self_ = reinterpret_cast(self__pod); + self_->nextPatch(); + } + + DLLEXPORT bool PxContactStreamIterator_hasNextContact(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->hasNextContact(); + return return_val; + } + + DLLEXPORT void PxContactStreamIterator_nextContact_mut(physx_PxContactStreamIterator* self__pod) { + physx::PxContactStreamIterator* self_ = reinterpret_cast(self__pod); + self_->nextContact(); + } + + DLLEXPORT physx_PxVec3 const* PxContactStreamIterator_getContactNormal(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getContactNormal(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT float PxContactStreamIterator_getInvMassScale0(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale0(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getInvMassScale1(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale1(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getInvInertiaScale0(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale0(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getInvInertiaScale1(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale1(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getMaxImpulse(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxImpulse(); + return return_val; + } + + DLLEXPORT physx_PxVec3 const* PxContactStreamIterator_getTargetVel(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getTargetVel(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 const* PxContactStreamIterator_getContactPoint(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getContactPoint(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT float PxContactStreamIterator_getSeparation(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSeparation(); + return return_val; + } + + DLLEXPORT uint32_t PxContactStreamIterator_getFaceIndex0(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getFaceIndex0(); + return return_val; + } + + DLLEXPORT uint32_t PxContactStreamIterator_getFaceIndex1(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getFaceIndex1(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getStaticFriction(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStaticFriction(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getDynamicFriction(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDynamicFriction(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getRestitution(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestitution(); + return return_val; + } + + DLLEXPORT float PxContactStreamIterator_getDamping(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDamping(); + return return_val; + } + + DLLEXPORT uint32_t PxContactStreamIterator_getMaterialFlags(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getMaterialFlags(); + return return_val; + } + + DLLEXPORT uint16_t PxContactStreamIterator_getMaterialIndex0(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getMaterialIndex0(); + return return_val; + } + + DLLEXPORT uint16_t PxContactStreamIterator_getMaterialIndex1(physx_PxContactStreamIterator const* self__pod) { + physx::PxContactStreamIterator const* self_ = reinterpret_cast(self__pod); + uint16_t return_val = self_->getMaterialIndex1(); + return return_val; + } + + DLLEXPORT bool PxContactStreamIterator_advanceToIndex_mut(physx_PxContactStreamIterator* self__pod, uint32_t initialIndex) { + physx::PxContactStreamIterator* self_ = reinterpret_cast(self__pod); + bool return_val = self_->advanceToIndex(initialIndex); + return return_val; + } + + DLLEXPORT physx_PxVec3 const* PxContactSet_getPoint(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getPoint(i); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxContactSet_setPoint_mut(physx_PxContactSet* self__pod, uint32_t i, physx_PxVec3 const* p_pod) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + self_->setPoint(i, p); + } + + DLLEXPORT physx_PxVec3 const* PxContactSet_getNormal(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getNormal(i); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxContactSet_setNormal_mut(physx_PxContactSet* self__pod, uint32_t i, physx_PxVec3 const* n_pod) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& n = reinterpret_cast(*n_pod); + self_->setNormal(i, n); + } + + DLLEXPORT float PxContactSet_getSeparation(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSeparation(i); + return return_val; + } + + DLLEXPORT void PxContactSet_setSeparation_mut(physx_PxContactSet* self__pod, uint32_t i, float s) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setSeparation(i, s); + } + + DLLEXPORT physx_PxVec3 const* PxContactSet_getTargetVelocity(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& return_val = self_->getTargetVelocity(i); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxContactSet_setTargetVelocity_mut(physx_PxContactSet* self__pod, uint32_t i, physx_PxVec3 const* v_pod) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + self_->setTargetVelocity(i, v); + } + + DLLEXPORT uint32_t PxContactSet_getInternalFaceIndex0(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getInternalFaceIndex0(i); + return return_val; + } + + DLLEXPORT uint32_t PxContactSet_getInternalFaceIndex1(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getInternalFaceIndex1(i); + return return_val; + } + + DLLEXPORT float PxContactSet_getMaxImpulse(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxImpulse(i); + return return_val; + } + + DLLEXPORT void PxContactSet_setMaxImpulse_mut(physx_PxContactSet* self__pod, uint32_t i, float s) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setMaxImpulse(i, s); + } + + DLLEXPORT float PxContactSet_getRestitution(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestitution(i); + return return_val; + } + + DLLEXPORT void PxContactSet_setRestitution_mut(physx_PxContactSet* self__pod, uint32_t i, float r) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setRestitution(i, r); + } + + DLLEXPORT float PxContactSet_getStaticFriction(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStaticFriction(i); + return return_val; + } + + DLLEXPORT void PxContactSet_setStaticFriction_mut(physx_PxContactSet* self__pod, uint32_t i, float f) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setStaticFriction(i, f); + } + + DLLEXPORT float PxContactSet_getDynamicFriction(physx_PxContactSet const* self__pod, uint32_t i) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDynamicFriction(i); + return return_val; + } + + DLLEXPORT void PxContactSet_setDynamicFriction_mut(physx_PxContactSet* self__pod, uint32_t i, float f) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setDynamicFriction(i, f); + } + + DLLEXPORT void PxContactSet_ignore_mut(physx_PxContactSet* self__pod, uint32_t i) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->ignore(i); + } + + DLLEXPORT uint32_t PxContactSet_size(physx_PxContactSet const* self__pod) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->size(); + return return_val; + } + + DLLEXPORT float PxContactSet_getInvMassScale0(physx_PxContactSet const* self__pod) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale0(); + return return_val; + } + + DLLEXPORT float PxContactSet_getInvMassScale1(physx_PxContactSet const* self__pod) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale1(); + return return_val; + } + + DLLEXPORT float PxContactSet_getInvInertiaScale0(physx_PxContactSet const* self__pod) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale0(); + return return_val; + } + + DLLEXPORT float PxContactSet_getInvInertiaScale1(physx_PxContactSet const* self__pod) { + physx::PxContactSet const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale1(); + return return_val; + } + + DLLEXPORT void PxContactSet_setInvMassScale0_mut(physx_PxContactSet* self__pod, float scale) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setInvMassScale0(scale); + } + + DLLEXPORT void PxContactSet_setInvMassScale1_mut(physx_PxContactSet* self__pod, float scale) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setInvMassScale1(scale); + } + + DLLEXPORT void PxContactSet_setInvInertiaScale0_mut(physx_PxContactSet* self__pod, float scale) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setInvInertiaScale0(scale); + } + + DLLEXPORT void PxContactSet_setInvInertiaScale1_mut(physx_PxContactSet* self__pod, float scale) { + physx::PxContactSet* self_ = reinterpret_cast(self__pod); + self_->setInvInertiaScale1(scale); + } + + DLLEXPORT void PxContactModifyCallback_onContactModify_mut(physx_PxContactModifyCallback* self__pod, physx_PxContactModifyPair*const pairs_pod, uint32_t count) { + physx::PxContactModifyCallback* self_ = reinterpret_cast(self__pod); + physx::PxContactModifyPair*const pairs = reinterpret_cast(pairs_pod); + self_->onContactModify(pairs, count); + } + + DLLEXPORT void PxCCDContactModifyCallback_onCCDContactModify_mut(physx_PxCCDContactModifyCallback* self__pod, physx_PxContactModifyPair*const pairs_pod, uint32_t count) { + physx::PxCCDContactModifyCallback* self_ = reinterpret_cast(self__pod); + physx::PxContactModifyPair*const pairs = reinterpret_cast(pairs_pod); + self_->onCCDContactModify(pairs, count); + } + + DLLEXPORT void PxDeletionListener_onRelease_mut(physx_PxDeletionListener* self__pod, physx_PxBase const* observed_pod, void* userData, int32_t deletionEvent_pod) { + physx::PxDeletionListener* self_ = reinterpret_cast(self__pod); + physx::PxBase const* observed = reinterpret_cast(observed_pod); + auto deletionEvent = static_cast(deletionEvent_pod); + self_->onRelease(observed, userData, deletionEvent); + } + + DLLEXPORT bool PxBaseMaterial_isKindOf(physx_PxBaseMaterial const* self__pod, char const* name) { + physx::PxBaseMaterial const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isKindOf(name); + return return_val; + } + + DLLEXPORT void PxFEMMaterial_setYoungsModulus_mut(physx_PxFEMMaterial* self__pod, float young) { + physx::PxFEMMaterial* self_ = reinterpret_cast(self__pod); + self_->setYoungsModulus(young); + } + + DLLEXPORT float PxFEMMaterial_getYoungsModulus(physx_PxFEMMaterial const* self__pod) { + physx::PxFEMMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getYoungsModulus(); + return return_val; + } + + DLLEXPORT void PxFEMMaterial_setPoissons_mut(physx_PxFEMMaterial* self__pod, float poisson) { + physx::PxFEMMaterial* self_ = reinterpret_cast(self__pod); + self_->setPoissons(poisson); + } + + DLLEXPORT float PxFEMMaterial_getPoissons(physx_PxFEMMaterial const* self__pod) { + physx::PxFEMMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getPoissons(); + return return_val; + } + + DLLEXPORT void PxFEMMaterial_setDynamicFriction_mut(physx_PxFEMMaterial* self__pod, float dynamicFriction) { + physx::PxFEMMaterial* self_ = reinterpret_cast(self__pod); + self_->setDynamicFriction(dynamicFriction); + } + + DLLEXPORT float PxFEMMaterial_getDynamicFriction(physx_PxFEMMaterial const* self__pod) { + physx::PxFEMMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDynamicFriction(); + return return_val; + } + + DLLEXPORT physx_PxFilterData PxFilterData_new(int32_t anon_param0_pod) { + auto anon_param0 = static_cast(anon_param0_pod); + PxFilterData return_val(anon_param0); + physx_PxFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxFilterData PxFilterData_new_1() { + PxFilterData return_val; + physx_PxFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxFilterData PxFilterData_new_2(uint32_t w0, uint32_t w1, uint32_t w2, uint32_t w3) { + PxFilterData return_val(w0, w1, w2, w3); + physx_PxFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxFilterData_setToDefault_mut(physx_PxFilterData* self__pod) { + physx::PxFilterData* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT int32_t phys_PxGetFilterObjectType(uint32_t attr) { + physx::PxFilterObjectType::Enum return_val = PxGetFilterObjectType(attr); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool phys_PxFilterObjectIsKinematic(uint32_t attr) { + bool return_val = PxFilterObjectIsKinematic(attr); + return return_val; + } + + DLLEXPORT bool phys_PxFilterObjectIsTrigger(uint32_t attr) { + bool return_val = PxFilterObjectIsTrigger(attr); + return return_val; + } + + DLLEXPORT uint16_t PxSimulationFilterCallback_pairFound_mut(physx_PxSimulationFilterCallback* self__pod, uint32_t pairID, uint32_t attributes0, physx_PxFilterData filterData0_pod, physx_PxActor const* a0_pod, physx_PxShape const* s0_pod, uint32_t attributes1, physx_PxFilterData filterData1_pod, physx_PxActor const* a1_pod, physx_PxShape const* s1_pod, uint16_t* pairFlags_pod) { + physx::PxSimulationFilterCallback* self_ = reinterpret_cast(self__pod); + physx::PxFilterData filterData0; + memcpy(&filterData0, &filterData0_pod, sizeof(filterData0)); + physx::PxActor const* a0 = reinterpret_cast(a0_pod); + physx::PxShape const* s0 = reinterpret_cast(s0_pod); + physx::PxFilterData filterData1; + memcpy(&filterData1, &filterData1_pod, sizeof(filterData1)); + physx::PxActor const* a1 = reinterpret_cast(a1_pod); + physx::PxShape const* s1 = reinterpret_cast(s1_pod); + physx::PxPairFlags& pairFlags = reinterpret_cast(*pairFlags_pod); + physx::PxFilterFlags return_val = self_->pairFound(pairID, attributes0, filterData0, a0, s0, attributes1, filterData1, a1, s1, pairFlags); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSimulationFilterCallback_pairLost_mut(physx_PxSimulationFilterCallback* self__pod, uint32_t pairID, uint32_t attributes0, physx_PxFilterData filterData0_pod, uint32_t attributes1, physx_PxFilterData filterData1_pod, bool objectRemoved) { + physx::PxSimulationFilterCallback* self_ = reinterpret_cast(self__pod); + physx::PxFilterData filterData0; + memcpy(&filterData0, &filterData0_pod, sizeof(filterData0)); + physx::PxFilterData filterData1; + memcpy(&filterData1, &filterData1_pod, sizeof(filterData1)); + self_->pairLost(pairID, attributes0, filterData0, attributes1, filterData1, objectRemoved); + } + + DLLEXPORT bool PxSimulationFilterCallback_statusChange_mut(physx_PxSimulationFilterCallback* self__pod, uint32_t* pairID_pod, uint16_t* pairFlags_pod, uint16_t* filterFlags_pod) { + physx::PxSimulationFilterCallback* self_ = reinterpret_cast(self__pod); + uint32_t& pairID = *pairID_pod; + physx::PxPairFlags& pairFlags = reinterpret_cast(*pairFlags_pod); + physx::PxFilterFlags& filterFlags = reinterpret_cast(*filterFlags_pod); + bool return_val = self_->statusChange(pairID, pairFlags, filterFlags); + return return_val; + } + + DLLEXPORT uint8_t PxLockedData_getDataAccessFlags_mut(physx_PxLockedData* self__pod) { + physx::PxLockedData* self_ = reinterpret_cast(self__pod); + physx::PxDataAccessFlags return_val = self_->getDataAccessFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxLockedData_unlock_mut(physx_PxLockedData* self__pod) { + physx::PxLockedData* self_ = reinterpret_cast(self__pod); + self_->unlock(); + } + + DLLEXPORT void PxLockedData_delete(physx_PxLockedData* self__pod) { + physx::PxLockedData* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxMaterial_setDynamicFriction_mut(physx_PxMaterial* self__pod, float coef) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + self_->setDynamicFriction(coef); + } + + DLLEXPORT float PxMaterial_getDynamicFriction(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDynamicFriction(); + return return_val; + } + + DLLEXPORT void PxMaterial_setStaticFriction_mut(physx_PxMaterial* self__pod, float coef) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + self_->setStaticFriction(coef); + } + + DLLEXPORT float PxMaterial_getStaticFriction(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStaticFriction(); + return return_val; + } + + DLLEXPORT void PxMaterial_setRestitution_mut(physx_PxMaterial* self__pod, float rest) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + self_->setRestitution(rest); + } + + DLLEXPORT float PxMaterial_getRestitution(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestitution(); + return return_val; + } + + DLLEXPORT void PxMaterial_setDamping_mut(physx_PxMaterial* self__pod, float damping) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + self_->setDamping(damping); + } + + DLLEXPORT float PxMaterial_getDamping(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDamping(); + return return_val; + } + + DLLEXPORT void PxMaterial_setFlag_mut(physx_PxMaterial* self__pod, int32_t flag_pod, bool b) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, b); + } + + DLLEXPORT void PxMaterial_setFlags_mut(physx_PxMaterial* self__pod, uint16_t flags_pod) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxMaterialFlags(flags_pod); + self_->setFlags(flags); + } + + DLLEXPORT uint16_t PxMaterial_getFlags(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + physx::PxMaterialFlags return_val = self_->getFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxMaterial_setFrictionCombineMode_mut(physx_PxMaterial* self__pod, int32_t combMode_pod) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + auto combMode = static_cast(combMode_pod); + self_->setFrictionCombineMode(combMode); + } + + DLLEXPORT int32_t PxMaterial_getFrictionCombineMode(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + physx::PxCombineMode::Enum return_val = self_->getFrictionCombineMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxMaterial_setRestitutionCombineMode_mut(physx_PxMaterial* self__pod, int32_t combMode_pod) { + physx::PxMaterial* self_ = reinterpret_cast(self__pod); + auto combMode = static_cast(combMode_pod); + self_->setRestitutionCombineMode(combMode); + } + + DLLEXPORT int32_t PxMaterial_getRestitutionCombineMode(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + physx::PxCombineMode::Enum return_val = self_->getRestitutionCombineMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxMaterial_getConcreteTypeName(physx_PxMaterial const* self__pod) { + physx::PxMaterial const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxDiffuseParticleParams PxDiffuseParticleParams_new() { + PxDiffuseParticleParams return_val; + physx_PxDiffuseParticleParams return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxDiffuseParticleParams_setToDefault_mut(physx_PxDiffuseParticleParams* self__pod) { + physx::PxDiffuseParticleParams* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT void PxParticleMaterial_setFriction_mut(physx_PxParticleMaterial* self__pod, float friction) { + physx::PxParticleMaterial* self_ = reinterpret_cast(self__pod); + self_->setFriction(friction); + } + + DLLEXPORT float PxParticleMaterial_getFriction(physx_PxParticleMaterial const* self__pod) { + physx::PxParticleMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getFriction(); + return return_val; + } + + DLLEXPORT void PxParticleMaterial_setDamping_mut(physx_PxParticleMaterial* self__pod, float damping) { + physx::PxParticleMaterial* self_ = reinterpret_cast(self__pod); + self_->setDamping(damping); + } + + DLLEXPORT float PxParticleMaterial_getDamping(physx_PxParticleMaterial const* self__pod) { + physx::PxParticleMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDamping(); + return return_val; + } + + DLLEXPORT void PxParticleMaterial_setAdhesion_mut(physx_PxParticleMaterial* self__pod, float adhesion) { + physx::PxParticleMaterial* self_ = reinterpret_cast(self__pod); + self_->setAdhesion(adhesion); + } + + DLLEXPORT float PxParticleMaterial_getAdhesion(physx_PxParticleMaterial const* self__pod) { + physx::PxParticleMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getAdhesion(); + return return_val; + } + + DLLEXPORT void PxParticleMaterial_setGravityScale_mut(physx_PxParticleMaterial* self__pod, float scale) { + physx::PxParticleMaterial* self_ = reinterpret_cast(self__pod); + self_->setGravityScale(scale); + } + + DLLEXPORT float PxParticleMaterial_getGravityScale(physx_PxParticleMaterial const* self__pod) { + physx::PxParticleMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getGravityScale(); + return return_val; + } + + DLLEXPORT void PxParticleMaterial_setAdhesionRadiusScale_mut(physx_PxParticleMaterial* self__pod, float scale) { + physx::PxParticleMaterial* self_ = reinterpret_cast(self__pod); + self_->setAdhesionRadiusScale(scale); + } + + DLLEXPORT float PxParticleMaterial_getAdhesionRadiusScale(physx_PxParticleMaterial const* self__pod) { + physx::PxParticleMaterial const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getAdhesionRadiusScale(); + return return_val; + } + + DLLEXPORT void PxPhysics_release_mut(physx_PxPhysics* self__pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxFoundation* PxPhysics_getFoundation_mut(physx_PxPhysics* self__pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxFoundation& return_val = self_->getFoundation(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxAggregate* PxPhysics_createAggregate_mut(physx_PxPhysics* self__pod, uint32_t maxActor, uint32_t maxShape, uint32_t filterHint) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxAggregate* return_val = self_->createAggregate(maxActor, maxShape, filterHint); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTolerancesScale const* PxPhysics_getTolerancesScale(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxTolerancesScale const& return_val = self_->getTolerancesScale(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxTriangleMesh* PxPhysics_createTriangleMesh_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxTriangleMesh* return_val = self_->createTriangleMesh(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbTriangleMeshes(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTriangleMeshes(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getTriangleMeshes(physx_PxPhysics const* self__pod, physx_PxTriangleMesh** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxTriangleMesh** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getTriangleMeshes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxTetrahedronMesh* PxPhysics_createTetrahedronMesh_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxTetrahedronMesh* return_val = self_->createTetrahedronMesh(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSoftBodyMesh* PxPhysics_createSoftBodyMesh_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxSoftBodyMesh* return_val = self_->createSoftBodyMesh(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbTetrahedronMeshes(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbTetrahedronMeshes(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getTetrahedronMeshes(physx_PxPhysics const* self__pod, physx_PxTetrahedronMesh** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxTetrahedronMesh** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getTetrahedronMeshes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxHeightField* PxPhysics_createHeightField_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxHeightField* return_val = self_->createHeightField(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbHeightFields(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbHeightFields(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getHeightFields(physx_PxPhysics const* self__pod, physx_PxHeightField** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxHeightField** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getHeightFields(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxConvexMesh* PxPhysics_createConvexMesh_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxConvexMesh* return_val = self_->createConvexMesh(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbConvexMeshes(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbConvexMeshes(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getConvexMeshes(physx_PxPhysics const* self__pod, physx_PxConvexMesh** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxConvexMesh** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getConvexMeshes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxBVH* PxPhysics_createBVH_mut(physx_PxPhysics* self__pod, physx_PxInputStream* stream_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInputStream& stream = reinterpret_cast(*stream_pod); + physx::PxBVH* return_val = self_->createBVH(stream); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbBVHs(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbBVHs(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getBVHs(physx_PxPhysics const* self__pod, physx_PxBVH** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxBVH** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getBVHs(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxScene* PxPhysics_createScene_mut(physx_PxPhysics* self__pod, physx_PxSceneDesc const* sceneDesc_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxSceneDesc const& sceneDesc = reinterpret_cast(*sceneDesc_pod); + physx::PxScene* return_val = self_->createScene(sceneDesc); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbScenes(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbScenes(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getScenes(physx_PxPhysics const* self__pod, physx_PxScene** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxScene** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getScenes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxRigidStatic* PxPhysics_createRigidStatic_mut(physx_PxPhysics* self__pod, physx_PxTransform const* pose_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxRigidStatic* return_val = self_->createRigidStatic(pose); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* PxPhysics_createRigidDynamic_mut(physx_PxPhysics* self__pod, physx_PxTransform const* pose_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxRigidDynamic* return_val = self_->createRigidDynamic(pose); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPruningStructure* PxPhysics_createPruningStructure_mut(physx_PxPhysics* self__pod, physx_PxRigidActor* const* actors_pod, uint32_t nbActors) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* const* actors = reinterpret_cast(actors_pod); + physx::PxPruningStructure* return_val = self_->createPruningStructure(actors, nbActors); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxShape* PxPhysics_createShape_mut(physx_PxPhysics* self__pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial const* material_pod, bool isExclusive, uint8_t shapeFlags_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial const& material = reinterpret_cast(*material_pod); + auto shapeFlags = physx::PxShapeFlags(shapeFlags_pod); + physx::PxShape* return_val = self_->createShape(geometry, material, isExclusive, shapeFlags); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxShape* PxPhysics_createShape_mut_1(physx_PxPhysics* self__pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial* const* materials_pod, uint16_t materialCount, bool isExclusive, uint8_t shapeFlags_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial* const* materials = reinterpret_cast(materials_pod); + auto shapeFlags = physx::PxShapeFlags(shapeFlags_pod); + physx::PxShape* return_val = self_->createShape(geometry, materials, materialCount, isExclusive, shapeFlags); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbShapes(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbShapes(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getShapes(physx_PxPhysics const* self__pod, physx_PxShape** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxShape** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getShapes(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxConstraint* PxPhysics_createConstraint_mut(physx_PxPhysics* self__pod, physx_PxRigidActor* actor0_pod, physx_PxRigidActor* actor1_pod, physx_PxConstraintConnector* connector_pod, physx_PxConstraintShaderTable const* shaders_pod, uint32_t dataSize) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxConstraintConnector& connector = reinterpret_cast(*connector_pod); + physx::PxConstraintShaderTable const& shaders = reinterpret_cast(*shaders_pod); + physx::PxConstraint* return_val = self_->createConstraint(actor0, actor1, connector, shaders, dataSize); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxArticulationReducedCoordinate* PxPhysics_createArticulationReducedCoordinate_mut(physx_PxPhysics* self__pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate* return_val = self_->createArticulationReducedCoordinate(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxMaterial* PxPhysics_createMaterial_mut(physx_PxPhysics* self__pod, float staticFriction, float dynamicFriction, float restitution) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxMaterial* return_val = self_->createMaterial(staticFriction, dynamicFriction, restitution); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxPhysics_getNbMaterials(physx_PxPhysics const* self__pod) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbMaterials(); + return return_val; + } + + DLLEXPORT uint32_t PxPhysics_getMaterials(physx_PxPhysics const* self__pod, physx_PxMaterial** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPhysics const* self_ = reinterpret_cast(self__pod); + physx::PxMaterial** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getMaterials(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT void PxPhysics_registerDeletionListener_mut(physx_PxPhysics* self__pod, physx_PxDeletionListener* observer_pod, uint8_t const* deletionEvents_pod, bool restrictedObjectSet) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxDeletionListener& observer = reinterpret_cast(*observer_pod); + physx::PxDeletionEventFlags const& deletionEvents = reinterpret_cast(*deletionEvents_pod); + self_->registerDeletionListener(observer, deletionEvents, restrictedObjectSet); + } + + DLLEXPORT void PxPhysics_unregisterDeletionListener_mut(physx_PxPhysics* self__pod, physx_PxDeletionListener* observer_pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxDeletionListener& observer = reinterpret_cast(*observer_pod); + self_->unregisterDeletionListener(observer); + } + + DLLEXPORT void PxPhysics_registerDeletionListenerObjects_mut(physx_PxPhysics* self__pod, physx_PxDeletionListener* observer_pod, physx_PxBase const* const* observables_pod, uint32_t observableCount) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxDeletionListener& observer = reinterpret_cast(*observer_pod); + physx::PxBase const* const* observables = reinterpret_cast(observables_pod); + self_->registerDeletionListenerObjects(observer, observables, observableCount); + } + + DLLEXPORT void PxPhysics_unregisterDeletionListenerObjects_mut(physx_PxPhysics* self__pod, physx_PxDeletionListener* observer_pod, physx_PxBase const* const* observables_pod, uint32_t observableCount) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxDeletionListener& observer = reinterpret_cast(*observer_pod); + physx::PxBase const* const* observables = reinterpret_cast(observables_pod); + self_->unregisterDeletionListenerObjects(observer, observables, observableCount); + } + + DLLEXPORT physx_PxInsertionCallback* PxPhysics_getPhysicsInsertionCallback_mut(physx_PxPhysics* self__pod) { + physx::PxPhysics* self_ = reinterpret_cast(self__pod); + physx::PxInsertionCallback& return_val = self_->getPhysicsInsertionCallback(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPhysics* phys_PxCreatePhysics(uint32_t version, physx_PxFoundation* foundation_pod, physx_PxTolerancesScale const* scale_pod, bool trackOutstandingAllocations, physx_PxPvd* pvd_pod, physx_PxOmniPvd* omniPvd_pod) { + physx::PxFoundation& foundation = reinterpret_cast(*foundation_pod); + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + physx::PxPvd* pvd = reinterpret_cast(pvd_pod); + physx::PxOmniPvd* omniPvd = reinterpret_cast(omniPvd_pod); + physx::PxPhysics* return_val = PxCreatePhysics(version, foundation, scale, trackOutstandingAllocations, pvd, omniPvd); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPhysics* phys_PxGetPhysics() { + physx::PxPhysics& return_val = PxGetPhysics(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxActorShape PxActorShape_new() { + PxActorShape return_val; + physx_PxActorShape return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxActorShape PxActorShape_new_1(physx_PxRigidActor* a_pod, physx_PxShape* s_pod) { + physx::PxRigidActor* a = reinterpret_cast(a_pod); + physx::PxShape* s = reinterpret_cast(s_pod); + PxActorShape return_val(a, s); + physx_PxActorShape return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQueryCache PxQueryCache_new() { + PxQueryCache return_val; + physx_PxQueryCache return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQueryCache PxQueryCache_new_1(physx_PxShape* s_pod, uint32_t findex) { + physx::PxShape* s = reinterpret_cast(s_pod); + PxQueryCache return_val(s, findex); + physx_PxQueryCache return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQueryFilterData PxQueryFilterData_new() { + PxQueryFilterData return_val; + physx_PxQueryFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQueryFilterData PxQueryFilterData_new_1(physx_PxFilterData const* fd_pod, uint16_t f_pod) { + physx::PxFilterData const& fd = reinterpret_cast(*fd_pod); + auto f = physx::PxQueryFlags(f_pod); + PxQueryFilterData return_val(fd, f); + physx_PxQueryFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxQueryFilterData PxQueryFilterData_new_2(uint16_t f_pod) { + auto f = physx::PxQueryFlags(f_pod); + PxQueryFilterData return_val(f); + physx_PxQueryFilterData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxQueryFilterCallback_preFilter_mut(physx_PxQueryFilterCallback* self__pod, physx_PxFilterData const* filterData_pod, physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod, uint16_t* queryFlags_pod) { + physx::PxQueryFilterCallback* self_ = reinterpret_cast(self__pod); + physx::PxFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxShape const* shape = reinterpret_cast(shape_pod); + physx::PxRigidActor const* actor = reinterpret_cast(actor_pod); + physx::PxHitFlags& queryFlags = reinterpret_cast(*queryFlags_pod); + physx::PxQueryHitType::Enum return_val = self_->preFilter(filterData, shape, actor, queryFlags); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxQueryFilterCallback_postFilter_mut(physx_PxQueryFilterCallback* self__pod, physx_PxFilterData const* filterData_pod, physx_PxQueryHit const* hit_pod, physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod) { + physx::PxQueryFilterCallback* self_ = reinterpret_cast(self__pod); + physx::PxFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryHit const& hit = reinterpret_cast(*hit_pod); + physx::PxShape const* shape = reinterpret_cast(shape_pod); + physx::PxRigidActor const* actor = reinterpret_cast(actor_pod); + physx::PxQueryHitType::Enum return_val = self_->postFilter(filterData, hit, shape, actor); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxQueryFilterCallback_delete(physx_PxQueryFilterCallback* self__pod) { + physx::PxQueryFilterCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxRigidDynamic_setKinematicTarget_mut(physx_PxRigidDynamic* self__pod, physx_PxTransform const* destination_pod) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& destination = reinterpret_cast(*destination_pod); + self_->setKinematicTarget(destination); + } + + DLLEXPORT bool PxRigidDynamic_getKinematicTarget(physx_PxRigidDynamic const* self__pod, physx_PxTransform* target_pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + physx::PxTransform& target = reinterpret_cast(*target_pod); + bool return_val = self_->getKinematicTarget(target); + return return_val; + } + + DLLEXPORT bool PxRigidDynamic_isSleeping(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSleeping(); + return return_val; + } + + DLLEXPORT void PxRigidDynamic_setSleepThreshold_mut(physx_PxRigidDynamic* self__pod, float threshold) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->setSleepThreshold(threshold); + } + + DLLEXPORT float PxRigidDynamic_getSleepThreshold(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSleepThreshold(); + return return_val; + } + + DLLEXPORT void PxRigidDynamic_setStabilizationThreshold_mut(physx_PxRigidDynamic* self__pod, float threshold) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->setStabilizationThreshold(threshold); + } + + DLLEXPORT float PxRigidDynamic_getStabilizationThreshold(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStabilizationThreshold(); + return return_val; + } + + DLLEXPORT uint8_t PxRigidDynamic_getRigidDynamicLockFlags(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + physx::PxRigidDynamicLockFlags return_val = self_->getRigidDynamicLockFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidDynamic_setRigidDynamicLockFlag_mut(physx_PxRigidDynamic* self__pod, int32_t flag_pod, bool value) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setRigidDynamicLockFlag(flag, value); + } + + DLLEXPORT void PxRigidDynamic_setRigidDynamicLockFlags_mut(physx_PxRigidDynamic* self__pod, uint8_t flags_pod) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxRigidDynamicLockFlags(flags_pod); + self_->setRigidDynamicLockFlags(flags); + } + + DLLEXPORT physx_PxVec3 PxRigidDynamic_getLinearVelocity(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getLinearVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidDynamic_setLinearVelocity_mut(physx_PxRigidDynamic* self__pod, physx_PxVec3 const* linVel_pod, bool autowake) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& linVel = reinterpret_cast(*linVel_pod); + self_->setLinearVelocity(linVel, autowake); + } + + DLLEXPORT physx_PxVec3 PxRigidDynamic_getAngularVelocity(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getAngularVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidDynamic_setAngularVelocity_mut(physx_PxRigidDynamic* self__pod, physx_PxVec3 const* angVel_pod, bool autowake) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& angVel = reinterpret_cast(*angVel_pod); + self_->setAngularVelocity(angVel, autowake); + } + + DLLEXPORT void PxRigidDynamic_setWakeCounter_mut(physx_PxRigidDynamic* self__pod, float wakeCounterValue) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->setWakeCounter(wakeCounterValue); + } + + DLLEXPORT float PxRigidDynamic_getWakeCounter(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getWakeCounter(); + return return_val; + } + + DLLEXPORT void PxRigidDynamic_wakeUp_mut(physx_PxRigidDynamic* self__pod) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->wakeUp(); + } + + DLLEXPORT void PxRigidDynamic_putToSleep_mut(physx_PxRigidDynamic* self__pod) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->putToSleep(); + } + + DLLEXPORT void PxRigidDynamic_setSolverIterationCounts_mut(physx_PxRigidDynamic* self__pod, uint32_t minPositionIters, uint32_t minVelocityIters) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->setSolverIterationCounts(minPositionIters, minVelocityIters); + } + + DLLEXPORT void PxRigidDynamic_getSolverIterationCounts(physx_PxRigidDynamic const* self__pod, uint32_t* minPositionIters_pod, uint32_t* minVelocityIters_pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + uint32_t& minPositionIters = *minPositionIters_pod; + uint32_t& minVelocityIters = *minVelocityIters_pod; + self_->getSolverIterationCounts(minPositionIters, minVelocityIters); + } + + DLLEXPORT float PxRigidDynamic_getContactReportThreshold(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getContactReportThreshold(); + return return_val; + } + + DLLEXPORT void PxRigidDynamic_setContactReportThreshold_mut(physx_PxRigidDynamic* self__pod, float threshold) { + physx::PxRigidDynamic* self_ = reinterpret_cast(self__pod); + self_->setContactReportThreshold(threshold); + } + + DLLEXPORT char const* PxRigidDynamic_getConcreteTypeName(physx_PxRigidDynamic const* self__pod) { + physx::PxRigidDynamic const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT char const* PxRigidStatic_getConcreteTypeName(physx_PxRigidStatic const* self__pod) { + physx::PxRigidStatic const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxSceneQueryDesc PxSceneQueryDesc_new() { + PxSceneQueryDesc return_val; + physx_PxSceneQueryDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSceneQueryDesc_setToDefault_mut(physx_PxSceneQueryDesc* self__pod) { + physx::PxSceneQueryDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxSceneQueryDesc_isValid(physx_PxSceneQueryDesc const* self__pod) { + physx::PxSceneQueryDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint_mut(physx_PxSceneQuerySystemBase* self__pod, uint32_t dynamicTreeRebuildRateHint) { + physx::PxSceneQuerySystemBase* self_ = reinterpret_cast(self__pod); + self_->setDynamicTreeRebuildRateHint(dynamicTreeRebuildRateHint); + } + + DLLEXPORT uint32_t PxSceneQuerySystemBase_getDynamicTreeRebuildRateHint(physx_PxSceneQuerySystemBase const* self__pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getDynamicTreeRebuildRateHint(); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystemBase_forceRebuildDynamicTree_mut(physx_PxSceneQuerySystemBase* self__pod, uint32_t prunerIndex) { + physx::PxSceneQuerySystemBase* self_ = reinterpret_cast(self__pod); + self_->forceRebuildDynamicTree(prunerIndex); + } + + DLLEXPORT void PxSceneQuerySystemBase_setUpdateMode_mut(physx_PxSceneQuerySystemBase* self__pod, int32_t updateMode_pod) { + physx::PxSceneQuerySystemBase* self_ = reinterpret_cast(self__pod); + auto updateMode = static_cast(updateMode_pod); + self_->setUpdateMode(updateMode); + } + + DLLEXPORT int32_t PxSceneQuerySystemBase_getUpdateMode(physx_PxSceneQuerySystemBase const* self__pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + physx::PxSceneQueryUpdateMode::Enum return_val = self_->getUpdateMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxSceneQuerySystemBase_getStaticTimestamp(physx_PxSceneQuerySystemBase const* self__pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getStaticTimestamp(); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystemBase_flushUpdates_mut(physx_PxSceneQuerySystemBase* self__pod) { + physx::PxSceneQuerySystemBase* self_ = reinterpret_cast(self__pod); + self_->flushUpdates(); + } + + DLLEXPORT bool PxSceneQuerySystemBase_raycast(physx_PxSceneQuerySystemBase const* self__pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float distance, physx_PxRaycastCallback* hitCall_pod, uint16_t hitFlags_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, uint32_t queryFlags_pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxRaycastCallback& hitCall = reinterpret_cast(*hitCall_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->raycast(origin, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, queryFlags); + return return_val; + } + + DLLEXPORT bool PxSceneQuerySystemBase_sweep(physx_PxSceneQuerySystemBase const* self__pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float distance, physx_PxSweepCallback* hitCall_pod, uint16_t hitFlags_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation, uint32_t queryFlags_pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxSweepCallback& hitCall = reinterpret_cast(*hitCall_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->sweep(geometry, pose, unitDir, distance, hitCall, hitFlags, filterData, filterCall, cache, inflation, queryFlags); + return return_val; + } + + DLLEXPORT bool PxSceneQuerySystemBase_overlap(physx_PxSceneQuerySystemBase const* self__pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxOverlapCallback* hitCall_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, uint32_t queryFlags_pod) { + physx::PxSceneQuerySystemBase const* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxOverlapCallback& hitCall = reinterpret_cast(*hitCall_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + auto queryFlags = physx::PxGeometryQueryFlags(queryFlags_pod); + bool return_val = self_->overlap(geometry, pose, hitCall, filterData, filterCall, cache, queryFlags); + return return_val; + } + + DLLEXPORT void PxSceneSQSystem_setSceneQueryUpdateMode_mut(physx_PxSceneSQSystem* self__pod, int32_t updateMode_pod) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + auto updateMode = static_cast(updateMode_pod); + self_->setSceneQueryUpdateMode(updateMode); + } + + DLLEXPORT int32_t PxSceneSQSystem_getSceneQueryUpdateMode(physx_PxSceneSQSystem const* self__pod) { + physx::PxSceneSQSystem const* self_ = reinterpret_cast(self__pod); + physx::PxSceneQueryUpdateMode::Enum return_val = self_->getSceneQueryUpdateMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxSceneSQSystem_getSceneQueryStaticTimestamp(physx_PxSceneSQSystem const* self__pod) { + physx::PxSceneSQSystem const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getSceneQueryStaticTimestamp(); + return return_val; + } + + DLLEXPORT void PxSceneSQSystem_flushQueryUpdates_mut(physx_PxSceneSQSystem* self__pod) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + self_->flushQueryUpdates(); + } + + DLLEXPORT void PxSceneSQSystem_forceDynamicTreeRebuild_mut(physx_PxSceneSQSystem* self__pod, bool rebuildStaticStructure, bool rebuildDynamicStructure) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + self_->forceDynamicTreeRebuild(rebuildStaticStructure, rebuildDynamicStructure); + } + + DLLEXPORT int32_t PxSceneSQSystem_getStaticStructure(physx_PxSceneSQSystem const* self__pod) { + physx::PxSceneSQSystem const* self_ = reinterpret_cast(self__pod); + physx::PxPruningStructureType::Enum return_val = self_->getStaticStructure(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxSceneSQSystem_getDynamicStructure(physx_PxSceneSQSystem const* self__pod) { + physx::PxSceneSQSystem const* self_ = reinterpret_cast(self__pod); + physx::PxPruningStructureType::Enum return_val = self_->getDynamicStructure(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSceneSQSystem_sceneQueriesUpdate_mut(physx_PxSceneSQSystem* self__pod, physx_PxBaseTask* completionTask_pod, bool controlSimulation) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* completionTask = reinterpret_cast(completionTask_pod); + self_->sceneQueriesUpdate(completionTask, controlSimulation); + } + + DLLEXPORT bool PxSceneSQSystem_checkQueries_mut(physx_PxSceneSQSystem* self__pod, bool block) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + bool return_val = self_->checkQueries(block); + return return_val; + } + + DLLEXPORT bool PxSceneSQSystem_fetchQueries_mut(physx_PxSceneSQSystem* self__pod, bool block) { + physx::PxSceneSQSystem* self_ = reinterpret_cast(self__pod); + bool return_val = self_->fetchQueries(block); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystem_release_mut(physx_PxSceneQuerySystem* self__pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxSceneQuerySystem_acquireReference_mut(physx_PxSceneQuerySystem* self__pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->acquireReference(); + } + + DLLEXPORT void PxSceneQuerySystem_preallocate_mut(physx_PxSceneQuerySystem* self__pod, uint32_t prunerIndex, uint32_t nbShapes) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->preallocate(prunerIndex, nbShapes); + } + + DLLEXPORT void PxSceneQuerySystem_flushMemory_mut(physx_PxSceneQuerySystem* self__pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->flushMemory(); + } + + DLLEXPORT void PxSceneQuerySystem_addSQShape_mut(physx_PxSceneQuerySystem* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const* shape_pod, physx_PxBounds3 const* bounds_pod, physx_PxTransform const* transform_pod, uint32_t const* compoundHandle, bool hasPruningStructure) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + self_->addSQShape(actor, shape, bounds, transform, compoundHandle, hasPruningStructure); + } + + DLLEXPORT void PxSceneQuerySystem_removeSQShape_mut(physx_PxSceneQuerySystem* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const* shape_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + self_->removeSQShape(actor, shape); + } + + DLLEXPORT void PxSceneQuerySystem_updateSQShape_mut(physx_PxSceneQuerySystem* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const* shape_pod, physx_PxTransform const* transform_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + self_->updateSQShape(actor, shape, transform); + } + + DLLEXPORT uint32_t PxSceneQuerySystem_addSQCompound_mut(physx_PxSceneQuerySystem* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const** shapes_pod, physx_PxBVH const* bvh_pod, physx_PxTransform const* transforms_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const** shapes = reinterpret_cast(shapes_pod); + physx::PxBVH const& bvh = reinterpret_cast(*bvh_pod); + physx::PxTransform const* transforms = reinterpret_cast(transforms_pod); + uint32_t return_val = self_->addSQCompound(actor, shapes, bvh, transforms); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystem_removeSQCompound_mut(physx_PxSceneQuerySystem* self__pod, uint32_t compoundHandle) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->removeSQCompound(compoundHandle); + } + + DLLEXPORT void PxSceneQuerySystem_updateSQCompound_mut(physx_PxSceneQuerySystem* self__pod, uint32_t compoundHandle, physx_PxTransform const* compoundTransform_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& compoundTransform = reinterpret_cast(*compoundTransform_pod); + self_->updateSQCompound(compoundHandle, compoundTransform); + } + + DLLEXPORT void PxSceneQuerySystem_shiftOrigin_mut(physx_PxSceneQuerySystem* self__pod, physx_PxVec3 const* shift_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& shift = reinterpret_cast(*shift_pod); + self_->shiftOrigin(shift); + } + + DLLEXPORT void PxSceneQuerySystem_merge_mut(physx_PxSceneQuerySystem* self__pod, physx_PxPruningStructure const* pruningStructure_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxPruningStructure const& pruningStructure = reinterpret_cast(*pruningStructure_pod); + self_->merge(pruningStructure); + } + + DLLEXPORT uint32_t PxSceneQuerySystem_getHandle(physx_PxSceneQuerySystem const* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const* shape_pod, uint32_t* prunerIndex_pod) { + physx::PxSceneQuerySystem const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + uint32_t& prunerIndex = *prunerIndex_pod; + uint32_t return_val = self_->getHandle(actor, shape, prunerIndex); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystem_sync_mut(physx_PxSceneQuerySystem* self__pod, uint32_t prunerIndex, uint32_t const* handles, uint32_t const* indices, physx_PxBounds3 const* bounds_pod, physx_PxTransformPadded const* transforms_pod, uint32_t count, physx_PxBitMap const* ignoredIndices_pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const* bounds = reinterpret_cast(bounds_pod); + physx::PxTransformPadded const* transforms = reinterpret_cast(transforms_pod); + physx::PxBitMap const& ignoredIndices = reinterpret_cast(*ignoredIndices_pod); + self_->sync(prunerIndex, handles, indices, bounds, transforms, count, ignoredIndices); + } + + DLLEXPORT void PxSceneQuerySystem_finalizeUpdates_mut(physx_PxSceneQuerySystem* self__pod) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->finalizeUpdates(); + } + + DLLEXPORT void* PxSceneQuerySystem_prepareSceneQueryBuildStep_mut(physx_PxSceneQuerySystem* self__pod, uint32_t prunerIndex) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + void* return_val = self_->prepareSceneQueryBuildStep(prunerIndex); + return return_val; + } + + DLLEXPORT void PxSceneQuerySystem_sceneQueryBuildStep_mut(physx_PxSceneQuerySystem* self__pod, void* handle) { + physx::PxSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->sceneQueryBuildStep(handle); + } + + DLLEXPORT physx_PxBroadPhaseDesc PxBroadPhaseDesc_new(int32_t type_pod) { + auto type = static_cast(type_pod); + PxBroadPhaseDesc return_val(type); + physx_PxBroadPhaseDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxBroadPhaseDesc_isValid(physx_PxBroadPhaseDesc const* self__pod) { + physx::PxBroadPhaseDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT uint32_t phys_PxGetBroadPhaseStaticFilterGroup() { + uint32_t return_val = PxGetBroadPhaseStaticFilterGroup(); + return return_val; + } + + DLLEXPORT uint32_t phys_PxGetBroadPhaseDynamicFilterGroup(uint32_t id) { + uint32_t return_val = PxGetBroadPhaseDynamicFilterGroup(id); + return return_val; + } + + DLLEXPORT uint32_t phys_PxGetBroadPhaseKinematicFilterGroup(uint32_t id) { + uint32_t return_val = PxGetBroadPhaseKinematicFilterGroup(id); + return return_val; + } + + DLLEXPORT physx_PxBroadPhaseUpdateData PxBroadPhaseUpdateData_new(uint32_t const* created, uint32_t nbCreated, uint32_t const* updated, uint32_t nbUpdated, uint32_t const* removed, uint32_t nbRemoved, physx_PxBounds3 const* bounds_pod, uint32_t const* groups, float const* distances, uint32_t capacity) { + physx::PxBounds3 const* bounds = reinterpret_cast(bounds_pod); + PxBroadPhaseUpdateData return_val(created, nbCreated, updated, nbUpdated, removed, nbRemoved, bounds, groups, distances, capacity); + physx_PxBroadPhaseUpdateData return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBroadPhaseResults PxBroadPhaseResults_new() { + PxBroadPhaseResults return_val; + physx_PxBroadPhaseResults return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxBroadPhaseRegions_getNbRegions(physx_PxBroadPhaseRegions const* self__pod) { + physx::PxBroadPhaseRegions const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbRegions(); + return return_val; + } + + DLLEXPORT uint32_t PxBroadPhaseRegions_getRegions(physx_PxBroadPhaseRegions const* self__pod, physx_PxBroadPhaseRegionInfo* userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxBroadPhaseRegions const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseRegionInfo* userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getRegions(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxBroadPhaseRegions_addRegion_mut(physx_PxBroadPhaseRegions* self__pod, physx_PxBroadPhaseRegion const* region_pod, bool populateRegion, physx_PxBounds3 const* bounds_pod, float const* distances) { + physx::PxBroadPhaseRegions* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseRegion const& region = reinterpret_cast(*region_pod); + physx::PxBounds3 const* bounds = reinterpret_cast(bounds_pod); + uint32_t return_val = self_->addRegion(region, populateRegion, bounds, distances); + return return_val; + } + + DLLEXPORT bool PxBroadPhaseRegions_removeRegion_mut(physx_PxBroadPhaseRegions* self__pod, uint32_t handle) { + physx::PxBroadPhaseRegions* self_ = reinterpret_cast(self__pod); + bool return_val = self_->removeRegion(handle); + return return_val; + } + + DLLEXPORT uint32_t PxBroadPhaseRegions_getNbOutOfBoundsObjects(physx_PxBroadPhaseRegions const* self__pod) { + physx::PxBroadPhaseRegions const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbOutOfBoundsObjects(); + return return_val; + } + + DLLEXPORT uint32_t const* PxBroadPhaseRegions_getOutOfBoundsObjects(physx_PxBroadPhaseRegions const* self__pod) { + physx::PxBroadPhaseRegions const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getOutOfBoundsObjects(); + return return_val; + } + + DLLEXPORT void PxBroadPhase_release_mut(physx_PxBroadPhase* self__pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT int32_t PxBroadPhase_getType(physx_PxBroadPhase const* self__pod) { + physx::PxBroadPhase const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxBroadPhase_getCaps(physx_PxBroadPhase const* self__pod, physx_PxBroadPhaseCaps* caps_pod) { + physx::PxBroadPhase const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseCaps& caps = reinterpret_cast(*caps_pod); + self_->getCaps(caps); + } + + DLLEXPORT physx_PxBroadPhaseRegions* PxBroadPhase_getRegions_mut(physx_PxBroadPhase* self__pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseRegions* return_val = self_->getRegions(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxAllocatorCallback* PxBroadPhase_getAllocator_mut(physx_PxBroadPhase* self__pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + physx::PxAllocatorCallback* return_val = self_->getAllocator(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint64_t PxBroadPhase_getContextID(physx_PxBroadPhase const* self__pod) { + physx::PxBroadPhase const* self_ = reinterpret_cast(self__pod); + uint64_t return_val = self_->getContextID(); + return return_val; + } + + DLLEXPORT void PxBroadPhase_setScratchBlock_mut(physx_PxBroadPhase* self__pod, void* scratchBlock, uint32_t size) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + self_->setScratchBlock(scratchBlock, size); + } + + DLLEXPORT void PxBroadPhase_update_mut(physx_PxBroadPhase* self__pod, physx_PxBroadPhaseUpdateData const* updateData_pod, physx_PxBaseTask* continuation_pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseUpdateData const& updateData = reinterpret_cast(*updateData_pod); + physx::PxBaseTask* continuation = reinterpret_cast(continuation_pod); + self_->update(updateData, continuation); + } + + DLLEXPORT void PxBroadPhase_fetchResults_mut(physx_PxBroadPhase* self__pod, physx_PxBroadPhaseResults* results_pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseResults& results = reinterpret_cast(*results_pod); + self_->fetchResults(results); + } + + DLLEXPORT void PxBroadPhase_update_mut_1(physx_PxBroadPhase* self__pod, physx_PxBroadPhaseResults* results_pod, physx_PxBroadPhaseUpdateData const* updateData_pod) { + physx::PxBroadPhase* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseResults& results = reinterpret_cast(*results_pod); + physx::PxBroadPhaseUpdateData const& updateData = reinterpret_cast(*updateData_pod); + self_->update(results, updateData); + } + + DLLEXPORT physx_PxBroadPhase* phys_PxCreateBroadPhase(physx_PxBroadPhaseDesc const* desc_pod) { + physx::PxBroadPhaseDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxBroadPhase* return_val = PxCreateBroadPhase(desc); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxAABBManager_release_mut(physx_PxAABBManager* self__pod) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxBroadPhase* PxAABBManager_getBroadPhase_mut(physx_PxAABBManager* self__pod) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhase& return_val = self_->getBroadPhase(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3 const* PxAABBManager_getBounds(physx_PxAABBManager const* self__pod) { + physx::PxAABBManager const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const* return_val = self_->getBounds(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT float const* PxAABBManager_getDistances(physx_PxAABBManager const* self__pod) { + physx::PxAABBManager const* self_ = reinterpret_cast(self__pod); + float const* return_val = self_->getDistances(); + return return_val; + } + + DLLEXPORT uint32_t const* PxAABBManager_getGroups(physx_PxAABBManager const* self__pod) { + physx::PxAABBManager const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getGroups(); + return return_val; + } + + DLLEXPORT uint32_t PxAABBManager_getCapacity(physx_PxAABBManager const* self__pod) { + physx::PxAABBManager const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getCapacity(); + return return_val; + } + + DLLEXPORT void PxAABBManager_addObject_mut(physx_PxAABBManager* self__pod, uint32_t index, physx_PxBounds3 const* bounds_pod, uint32_t group, float distance) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& bounds = reinterpret_cast(*bounds_pod); + self_->addObject(index, bounds, group, distance); + } + + DLLEXPORT void PxAABBManager_removeObject_mut(physx_PxAABBManager* self__pod, uint32_t index) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + self_->removeObject(index); + } + + DLLEXPORT void PxAABBManager_updateObject_mut(physx_PxAABBManager* self__pod, uint32_t index, physx_PxBounds3 const* bounds_pod, float const* distance) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const* bounds = reinterpret_cast(bounds_pod); + self_->updateObject(index, bounds, distance); + } + + DLLEXPORT void PxAABBManager_update_mut(physx_PxAABBManager* self__pod, physx_PxBaseTask* continuation_pod) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* continuation = reinterpret_cast(continuation_pod); + self_->update(continuation); + } + + DLLEXPORT void PxAABBManager_fetchResults_mut(physx_PxAABBManager* self__pod, physx_PxBroadPhaseResults* results_pod) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseResults& results = reinterpret_cast(*results_pod); + self_->fetchResults(results); + } + + DLLEXPORT void PxAABBManager_update_mut_1(physx_PxAABBManager* self__pod, physx_PxBroadPhaseResults* results_pod) { + physx::PxAABBManager* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseResults& results = reinterpret_cast(*results_pod); + self_->update(results); + } + + DLLEXPORT physx_PxAABBManager* phys_PxCreateAABBManager(physx_PxBroadPhase* broadphase_pod) { + physx::PxBroadPhase& broadphase = reinterpret_cast(*broadphase_pod); + physx::PxAABBManager* return_val = PxCreateAABBManager(broadphase); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSceneLimits PxSceneLimits_new() { + PxSceneLimits return_val; + physx_PxSceneLimits return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSceneLimits_setToDefault_mut(physx_PxSceneLimits* self__pod) { + physx::PxSceneLimits* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxSceneLimits_isValid(physx_PxSceneLimits const* self__pod) { + physx::PxSceneLimits const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxgDynamicsMemoryConfig PxgDynamicsMemoryConfig_new() { + PxgDynamicsMemoryConfig return_val; + physx_PxgDynamicsMemoryConfig return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxgDynamicsMemoryConfig_isValid(physx_PxgDynamicsMemoryConfig const* self__pod) { + physx::PxgDynamicsMemoryConfig const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxSceneDesc PxSceneDesc_new(physx_PxTolerancesScale const* scale_pod) { + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + PxSceneDesc return_val(scale); + physx_PxSceneDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSceneDesc_setToDefault_mut(physx_PxSceneDesc* self__pod, physx_PxTolerancesScale const* scale_pod) { + physx::PxSceneDesc* self_ = reinterpret_cast(self__pod); + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + self_->setToDefault(scale); + } + + DLLEXPORT bool PxSceneDesc_isValid(physx_PxSceneDesc const* self__pod) { + physx::PxSceneDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTolerancesScale const* PxSceneDesc_getTolerancesScale(physx_PxSceneDesc const* self__pod) { + physx::PxSceneDesc const* self_ = reinterpret_cast(self__pod); + physx::PxTolerancesScale const& return_val = self_->getTolerancesScale(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxSimulationStatistics_getNbBroadPhaseAdds(physx_PxSimulationStatistics const* self__pod) { + physx::PxSimulationStatistics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbBroadPhaseAdds(); + return return_val; + } + + DLLEXPORT uint32_t PxSimulationStatistics_getNbBroadPhaseRemoves(physx_PxSimulationStatistics const* self__pod) { + physx::PxSimulationStatistics const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbBroadPhaseRemoves(); + return return_val; + } + + DLLEXPORT uint32_t PxSimulationStatistics_getRbPairStats(physx_PxSimulationStatistics const* self__pod, int32_t pairType_pod, int32_t g0_pod, int32_t g1_pod) { + physx::PxSimulationStatistics const* self_ = reinterpret_cast(self__pod); + auto pairType = static_cast(pairType_pod); + auto g0 = static_cast(g0_pod); + auto g1 = static_cast(g1_pod); + uint32_t return_val = self_->getRbPairStats(pairType, g0, g1); + return return_val; + } + + DLLEXPORT physx_PxSimulationStatistics PxSimulationStatistics_new() { + PxSimulationStatistics return_val; + physx_PxSimulationStatistics return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPvdSceneClient_setScenePvdFlag_mut(physx_PxPvdSceneClient* self__pod, int32_t flag_pod, bool value) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setScenePvdFlag(flag, value); + } + + DLLEXPORT void PxPvdSceneClient_setScenePvdFlags_mut(physx_PxPvdSceneClient* self__pod, uint8_t flags_pod) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxPvdSceneFlags(flags_pod); + self_->setScenePvdFlags(flags); + } + + DLLEXPORT uint8_t PxPvdSceneClient_getScenePvdFlags(physx_PxPvdSceneClient const* self__pod) { + physx::PxPvdSceneClient const* self_ = reinterpret_cast(self__pod); + physx::PxPvdSceneFlags return_val = self_->getScenePvdFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPvdSceneClient_updateCamera_mut(physx_PxPvdSceneClient* self__pod, char const* name, physx_PxVec3 const* origin_pod, physx_PxVec3 const* up_pod, physx_PxVec3 const* target_pod) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& up = reinterpret_cast(*up_pod); + physx::PxVec3 const& target = reinterpret_cast(*target_pod); + self_->updateCamera(name, origin, up, target); + } + + DLLEXPORT void PxPvdSceneClient_drawPoints_mut(physx_PxPvdSceneClient* self__pod, physx_PxDebugPoint const* points_pod, uint32_t count) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + physx::PxDebugPoint const* points = reinterpret_cast(points_pod); + self_->drawPoints(points, count); + } + + DLLEXPORT void PxPvdSceneClient_drawLines_mut(physx_PxPvdSceneClient* self__pod, physx_PxDebugLine const* lines_pod, uint32_t count) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + physx::PxDebugLine const* lines = reinterpret_cast(lines_pod); + self_->drawLines(lines, count); + } + + DLLEXPORT void PxPvdSceneClient_drawTriangles_mut(physx_PxPvdSceneClient* self__pod, physx_PxDebugTriangle const* triangles_pod, uint32_t count) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + physx::PxDebugTriangle const* triangles = reinterpret_cast(triangles_pod); + self_->drawTriangles(triangles, count); + } + + DLLEXPORT void PxPvdSceneClient_drawText_mut(physx_PxPvdSceneClient* self__pod, physx_PxDebugText const* text_pod) { + physx::PxPvdSceneClient* self_ = reinterpret_cast(self__pod); + physx::PxDebugText const& text = reinterpret_cast(*text_pod); + self_->drawText(text); + } + + DLLEXPORT physx_PxDominanceGroupPair PxDominanceGroupPair_new(uint8_t a, uint8_t b) { + PxDominanceGroupPair return_val(a, b); + physx_PxDominanceGroupPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxBroadPhaseCallback_delete(physx_PxBroadPhaseCallback* self__pod) { + physx::PxBroadPhaseCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxBroadPhaseCallback_onObjectOutOfBounds_mut(physx_PxBroadPhaseCallback* self__pod, physx_PxShape* shape_pod, physx_PxActor* actor_pod) { + physx::PxBroadPhaseCallback* self_ = reinterpret_cast(self__pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + self_->onObjectOutOfBounds(shape, actor); + } + + DLLEXPORT void PxBroadPhaseCallback_onObjectOutOfBounds_mut_1(physx_PxBroadPhaseCallback* self__pod, physx_PxAggregate* aggregate_pod) { + physx::PxBroadPhaseCallback* self_ = reinterpret_cast(self__pod); + physx::PxAggregate& aggregate = reinterpret_cast(*aggregate_pod); + self_->onObjectOutOfBounds(aggregate); + } + + DLLEXPORT void PxScene_release_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxScene_setFlag_mut(physx_PxScene* self__pod, int32_t flag_pod, bool value) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setFlag(flag, value); + } + + DLLEXPORT uint32_t PxScene_getFlags(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxSceneFlags return_val = self_->getFlags(); + uint32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxScene_setLimits_mut(physx_PxScene* self__pod, physx_PxSceneLimits const* limits_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxSceneLimits const& limits = reinterpret_cast(*limits_pod); + self_->setLimits(limits); + } + + DLLEXPORT physx_PxSceneLimits PxScene_getLimits(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxSceneLimits return_val = self_->getLimits(); + physx_PxSceneLimits return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxPhysics* PxScene_getPhysics_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxPhysics& return_val = self_->getPhysics(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxScene_getTimestamp(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getTimestamp(); + return return_val; + } + + DLLEXPORT bool PxScene_addArticulation_mut(physx_PxScene* self__pod, physx_PxArticulationReducedCoordinate* articulation_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate& articulation = reinterpret_cast(*articulation_pod); + bool return_val = self_->addArticulation(articulation); + return return_val; + } + + DLLEXPORT void PxScene_removeArticulation_mut(physx_PxScene* self__pod, physx_PxArticulationReducedCoordinate* articulation_pod, bool wakeOnLostTouch) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate& articulation = reinterpret_cast(*articulation_pod); + self_->removeArticulation(articulation, wakeOnLostTouch); + } + + DLLEXPORT bool PxScene_addActor_mut(physx_PxScene* self__pod, physx_PxActor* actor_pod, physx_PxBVH const* bvh_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + physx::PxBVH const* bvh = reinterpret_cast(bvh_pod); + bool return_val = self_->addActor(actor, bvh); + return return_val; + } + + DLLEXPORT bool PxScene_addActors_mut(physx_PxScene* self__pod, physx_PxActor* const* actors_pod, uint32_t nbActors) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxActor* const* actors = reinterpret_cast(actors_pod); + bool return_val = self_->addActors(actors, nbActors); + return return_val; + } + + DLLEXPORT bool PxScene_addActors_mut_1(physx_PxScene* self__pod, physx_PxPruningStructure const* pruningStructure_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxPruningStructure const& pruningStructure = reinterpret_cast(*pruningStructure_pod); + bool return_val = self_->addActors(pruningStructure); + return return_val; + } + + DLLEXPORT void PxScene_removeActor_mut(physx_PxScene* self__pod, physx_PxActor* actor_pod, bool wakeOnLostTouch) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + self_->removeActor(actor, wakeOnLostTouch); + } + + DLLEXPORT void PxScene_removeActors_mut(physx_PxScene* self__pod, physx_PxActor* const* actors_pod, uint32_t nbActors, bool wakeOnLostTouch) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxActor* const* actors = reinterpret_cast(actors_pod); + self_->removeActors(actors, nbActors, wakeOnLostTouch); + } + + DLLEXPORT bool PxScene_addAggregate_mut(physx_PxScene* self__pod, physx_PxAggregate* aggregate_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxAggregate& aggregate = reinterpret_cast(*aggregate_pod); + bool return_val = self_->addAggregate(aggregate); + return return_val; + } + + DLLEXPORT void PxScene_removeAggregate_mut(physx_PxScene* self__pod, physx_PxAggregate* aggregate_pod, bool wakeOnLostTouch) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxAggregate& aggregate = reinterpret_cast(*aggregate_pod); + self_->removeAggregate(aggregate, wakeOnLostTouch); + } + + DLLEXPORT bool PxScene_addCollection_mut(physx_PxScene* self__pod, physx_PxCollection const* collection_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxCollection const& collection = reinterpret_cast(*collection_pod); + bool return_val = self_->addCollection(collection); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getNbActors(physx_PxScene const* self__pod, uint16_t types_pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + auto types = physx::PxActorTypeFlags(types_pod); + uint32_t return_val = self_->getNbActors(types); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getActors(physx_PxScene const* self__pod, uint16_t types_pod, physx_PxActor** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + auto types = physx::PxActorTypeFlags(types_pod); + physx::PxActor** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getActors(types, userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT physx_PxActor** PxScene_getActiveActors_mut(physx_PxScene* self__pod, uint32_t* nbActorsOut_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + uint32_t& nbActorsOut = *nbActorsOut_pod; + physx::PxActor** return_val = self_->getActiveActors(nbActorsOut); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxScene_getNbArticulations(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbArticulations(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getArticulations(physx_PxScene const* self__pod, physx_PxArticulationReducedCoordinate** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxArticulationReducedCoordinate** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getArticulations(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getNbConstraints(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbConstraints(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getConstraints(physx_PxScene const* self__pod, physx_PxConstraint** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxConstraint** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getConstraints(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getNbAggregates(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbAggregates(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getAggregates(physx_PxScene const* self__pod, physx_PxAggregate** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxAggregate** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getAggregates(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT void PxScene_setDominanceGroupPair_mut(physx_PxScene* self__pod, uint8_t group1, uint8_t group2, physx_PxDominanceGroupPair const* dominance_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxDominanceGroupPair const& dominance = reinterpret_cast(*dominance_pod); + self_->setDominanceGroupPair(group1, group2, dominance); + } + + DLLEXPORT physx_PxDominanceGroupPair PxScene_getDominanceGroupPair(physx_PxScene const* self__pod, uint8_t group1, uint8_t group2) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxDominanceGroupPair return_val = self_->getDominanceGroupPair(group1, group2); + physx_PxDominanceGroupPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxCpuDispatcher* PxScene_getCpuDispatcher(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxCpuDispatcher* return_val = self_->getCpuDispatcher(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint8_t PxScene_createClient_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + uint8_t return_val = self_->createClient(); + return return_val; + } + + DLLEXPORT void PxScene_setSimulationEventCallback_mut(physx_PxScene* self__pod, physx_PxSimulationEventCallback* callback_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxSimulationEventCallback* callback = reinterpret_cast(callback_pod); + self_->setSimulationEventCallback(callback); + } + + DLLEXPORT physx_PxSimulationEventCallback* PxScene_getSimulationEventCallback(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxSimulationEventCallback* return_val = self_->getSimulationEventCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_setContactModifyCallback_mut(physx_PxScene* self__pod, physx_PxContactModifyCallback* callback_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxContactModifyCallback* callback = reinterpret_cast(callback_pod); + self_->setContactModifyCallback(callback); + } + + DLLEXPORT void PxScene_setCCDContactModifyCallback_mut(physx_PxScene* self__pod, physx_PxCCDContactModifyCallback* callback_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxCCDContactModifyCallback* callback = reinterpret_cast(callback_pod); + self_->setCCDContactModifyCallback(callback); + } + + DLLEXPORT physx_PxContactModifyCallback* PxScene_getContactModifyCallback(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxContactModifyCallback* return_val = self_->getContactModifyCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCCDContactModifyCallback* PxScene_getCCDContactModifyCallback(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxCCDContactModifyCallback* return_val = self_->getCCDContactModifyCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_setBroadPhaseCallback_mut(physx_PxScene* self__pod, physx_PxBroadPhaseCallback* callback_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseCallback* callback = reinterpret_cast(callback_pod); + self_->setBroadPhaseCallback(callback); + } + + DLLEXPORT physx_PxBroadPhaseCallback* PxScene_getBroadPhaseCallback(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseCallback* return_val = self_->getBroadPhaseCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_setFilterShaderData_mut(physx_PxScene* self__pod, void const* data, uint32_t dataSize) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setFilterShaderData(data, dataSize); + } + + DLLEXPORT void const* PxScene_getFilterShaderData(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getFilterShaderData(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getFilterShaderDataSize(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getFilterShaderDataSize(); + return return_val; + } + + DLLEXPORT bool PxScene_resetFiltering_mut(physx_PxScene* self__pod, physx_PxActor* actor_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxActor& actor = reinterpret_cast(*actor_pod); + bool return_val = self_->resetFiltering(actor); + return return_val; + } + + DLLEXPORT bool PxScene_resetFiltering_mut_1(physx_PxScene* self__pod, physx_PxRigidActor* actor_pod, physx_PxShape* const* shapes_pod, uint32_t shapeCount) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor& actor = reinterpret_cast(*actor_pod); + physx::PxShape* const* shapes = reinterpret_cast(shapes_pod); + bool return_val = self_->resetFiltering(actor, shapes, shapeCount); + return return_val; + } + + DLLEXPORT int32_t PxScene_getKinematicKinematicFilteringMode(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxPairFilteringMode::Enum return_val = self_->getKinematicKinematicFilteringMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxScene_getStaticKinematicFilteringMode(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxPairFilteringMode::Enum return_val = self_->getStaticKinematicFilteringMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxScene_simulate_mut(physx_PxScene* self__pod, float elapsedTime, physx_PxBaseTask* completionTask_pod, void* scratchMemBlock, uint32_t scratchMemBlockSize, bool controlSimulation) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* completionTask = reinterpret_cast(completionTask_pod); + bool return_val = self_->simulate(elapsedTime, completionTask, scratchMemBlock, scratchMemBlockSize, controlSimulation); + return return_val; + } + + DLLEXPORT bool PxScene_advance_mut(physx_PxScene* self__pod, physx_PxBaseTask* completionTask_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* completionTask = reinterpret_cast(completionTask_pod); + bool return_val = self_->advance(completionTask); + return return_val; + } + + DLLEXPORT bool PxScene_collide_mut(physx_PxScene* self__pod, float elapsedTime, physx_PxBaseTask* completionTask_pod, void* scratchMemBlock, uint32_t scratchMemBlockSize, bool controlSimulation) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* completionTask = reinterpret_cast(completionTask_pod); + bool return_val = self_->collide(elapsedTime, completionTask, scratchMemBlock, scratchMemBlockSize, controlSimulation); + return return_val; + } + + DLLEXPORT bool PxScene_checkResults_mut(physx_PxScene* self__pod, bool block) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + bool return_val = self_->checkResults(block); + return return_val; + } + + DLLEXPORT bool PxScene_fetchCollision_mut(physx_PxScene* self__pod, bool block) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + bool return_val = self_->fetchCollision(block); + return return_val; + } + + DLLEXPORT bool PxScene_fetchResults_mut(physx_PxScene* self__pod, bool block, uint32_t* errorState) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + bool return_val = self_->fetchResults(block, errorState); + return return_val; + } + + DLLEXPORT bool PxScene_fetchResultsStart_mut(physx_PxScene* self__pod, physx_PxContactPairHeader const** contactPairs_pod, uint32_t* nbContactPairs_pod, bool block) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxContactPairHeader const*& contactPairs = reinterpret_cast(*contactPairs_pod); + uint32_t& nbContactPairs = *nbContactPairs_pod; + bool return_val = self_->fetchResultsStart(contactPairs, nbContactPairs, block); + return return_val; + } + + DLLEXPORT void PxScene_processCallbacks_mut(physx_PxScene* self__pod, physx_PxBaseTask* continuation_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBaseTask* continuation = reinterpret_cast(continuation_pod); + self_->processCallbacks(continuation); + } + + DLLEXPORT void PxScene_fetchResultsFinish_mut(physx_PxScene* self__pod, uint32_t* errorState) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->fetchResultsFinish(errorState); + } + + DLLEXPORT void PxScene_fetchResultsParticleSystem_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->fetchResultsParticleSystem(); + } + + DLLEXPORT void PxScene_flushSimulation_mut(physx_PxScene* self__pod, bool sendPendingReports) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->flushSimulation(sendPendingReports); + } + + DLLEXPORT void PxScene_setGravity_mut(physx_PxScene* self__pod, physx_PxVec3 const* vec_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& vec = reinterpret_cast(*vec_pod); + self_->setGravity(vec); + } + + DLLEXPORT physx_PxVec3 PxScene_getGravity(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getGravity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxScene_setBounceThresholdVelocity_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setBounceThresholdVelocity(t); + } + + DLLEXPORT float PxScene_getBounceThresholdVelocity(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getBounceThresholdVelocity(); + return return_val; + } + + DLLEXPORT void PxScene_setCCDMaxPasses_mut(physx_PxScene* self__pod, uint32_t ccdMaxPasses) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setCCDMaxPasses(ccdMaxPasses); + } + + DLLEXPORT uint32_t PxScene_getCCDMaxPasses(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getCCDMaxPasses(); + return return_val; + } + + DLLEXPORT void PxScene_setCCDMaxSeparation_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setCCDMaxSeparation(t); + } + + DLLEXPORT float PxScene_getCCDMaxSeparation(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getCCDMaxSeparation(); + return return_val; + } + + DLLEXPORT void PxScene_setCCDThreshold_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setCCDThreshold(t); + } + + DLLEXPORT float PxScene_getCCDThreshold(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getCCDThreshold(); + return return_val; + } + + DLLEXPORT void PxScene_setMaxBiasCoefficient_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setMaxBiasCoefficient(t); + } + + DLLEXPORT float PxScene_getMaxBiasCoefficient(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxBiasCoefficient(); + return return_val; + } + + DLLEXPORT void PxScene_setFrictionOffsetThreshold_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setFrictionOffsetThreshold(t); + } + + DLLEXPORT float PxScene_getFrictionOffsetThreshold(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getFrictionOffsetThreshold(); + return return_val; + } + + DLLEXPORT void PxScene_setFrictionCorrelationDistance_mut(physx_PxScene* self__pod, float t) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setFrictionCorrelationDistance(t); + } + + DLLEXPORT float PxScene_getFrictionCorrelationDistance(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getFrictionCorrelationDistance(); + return return_val; + } + + DLLEXPORT int32_t PxScene_getFrictionType(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxFrictionType::Enum return_val = self_->getFrictionType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxScene_getSolverType(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxSolverType::Enum return_val = self_->getSolverType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxScene_setVisualizationParameter_mut(physx_PxScene* self__pod, int32_t param_pod, float value) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto param = static_cast(param_pod); + bool return_val = self_->setVisualizationParameter(param, value); + return return_val; + } + + DLLEXPORT float PxScene_getVisualizationParameter(physx_PxScene const* self__pod, int32_t paramEnum_pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + auto paramEnum = static_cast(paramEnum_pod); + float return_val = self_->getVisualizationParameter(paramEnum); + return return_val; + } + + DLLEXPORT void PxScene_setVisualizationCullingBox_mut(physx_PxScene* self__pod, physx_PxBounds3 const* box_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& box = reinterpret_cast(*box_pod); + self_->setVisualizationCullingBox(box); + } + + DLLEXPORT physx_PxBounds3 PxScene_getVisualizationCullingBox(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 return_val = self_->getVisualizationCullingBox(); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxRenderBuffer const* PxScene_getRenderBuffer_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxRenderBuffer const& return_val = self_->getRenderBuffer(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_getSimulationStatistics(physx_PxScene const* self__pod, physx_PxSimulationStatistics* stats_pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxSimulationStatistics& stats = reinterpret_cast(*stats_pod); + self_->getSimulationStatistics(stats); + } + + DLLEXPORT int32_t PxScene_getBroadPhaseType(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseType::Enum return_val = self_->getBroadPhaseType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxScene_getBroadPhaseCaps(physx_PxScene const* self__pod, physx_PxBroadPhaseCaps* caps_pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseCaps& caps = reinterpret_cast(*caps_pod); + bool return_val = self_->getBroadPhaseCaps(caps); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getNbBroadPhaseRegions(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbBroadPhaseRegions(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getBroadPhaseRegions(physx_PxScene const* self__pod, physx_PxBroadPhaseRegionInfo* userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseRegionInfo* userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getBroadPhaseRegions(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxScene_addBroadPhaseRegion_mut(physx_PxScene* self__pod, physx_PxBroadPhaseRegion const* region_pod, bool populateRegion) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxBroadPhaseRegion const& region = reinterpret_cast(*region_pod); + uint32_t return_val = self_->addBroadPhaseRegion(region, populateRegion); + return return_val; + } + + DLLEXPORT bool PxScene_removeBroadPhaseRegion_mut(physx_PxScene* self__pod, uint32_t handle) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + bool return_val = self_->removeBroadPhaseRegion(handle); + return return_val; + } + + DLLEXPORT physx_PxTaskManager* PxScene_getTaskManager(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxTaskManager* return_val = self_->getTaskManager(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_lockRead_mut(physx_PxScene* self__pod, char const* file, uint32_t line) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->lockRead(file, line); + } + + DLLEXPORT void PxScene_unlockRead_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->unlockRead(); + } + + DLLEXPORT void PxScene_lockWrite_mut(physx_PxScene* self__pod, char const* file, uint32_t line) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->lockWrite(file, line); + } + + DLLEXPORT void PxScene_unlockWrite_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->unlockWrite(); + } + + DLLEXPORT void PxScene_setNbContactDataBlocks_mut(physx_PxScene* self__pod, uint32_t numBlocks) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setNbContactDataBlocks(numBlocks); + } + + DLLEXPORT uint32_t PxScene_getNbContactDataBlocksUsed(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbContactDataBlocksUsed(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getMaxNbContactDataBlocksUsed(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getMaxNbContactDataBlocksUsed(); + return return_val; + } + + DLLEXPORT uint32_t PxScene_getContactReportStreamBufferSize(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getContactReportStreamBufferSize(); + return return_val; + } + + DLLEXPORT void PxScene_setSolverBatchSize_mut(physx_PxScene* self__pod, uint32_t solverBatchSize) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setSolverBatchSize(solverBatchSize); + } + + DLLEXPORT uint32_t PxScene_getSolverBatchSize(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getSolverBatchSize(); + return return_val; + } + + DLLEXPORT void PxScene_setSolverArticulationBatchSize_mut(physx_PxScene* self__pod, uint32_t solverBatchSize) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->setSolverArticulationBatchSize(solverBatchSize); + } + + DLLEXPORT uint32_t PxScene_getSolverArticulationBatchSize(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getSolverArticulationBatchSize(); + return return_val; + } + + DLLEXPORT float PxScene_getWakeCounterResetValue(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getWakeCounterResetValue(); + return return_val; + } + + DLLEXPORT void PxScene_shiftOrigin_mut(physx_PxScene* self__pod, physx_PxVec3 const* shift_pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& shift = reinterpret_cast(*shift_pod); + self_->shiftOrigin(shift); + } + + DLLEXPORT physx_PxPvdSceneClient* PxScene_getScenePvdClient_mut(physx_PxScene* self__pod) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxPvdSceneClient* return_val = self_->getScenePvdClient(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxScene_copyArticulationData_mut(physx_PxScene* self__pod, void* data, void* index, int32_t dataType_pod, uint32_t nbCopyArticulations, void* copyEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto dataType = static_cast(dataType_pod); + self_->copyArticulationData(data, index, dataType, nbCopyArticulations, copyEvent); + } + + DLLEXPORT void PxScene_applyArticulationData_mut(physx_PxScene* self__pod, void* data, void* index, int32_t dataType_pod, uint32_t nbUpdatedArticulations, void* waitEvent, void* signalEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto dataType = static_cast(dataType_pod); + self_->applyArticulationData(data, index, dataType, nbUpdatedArticulations, waitEvent, signalEvent); + } + + DLLEXPORT void PxScene_copySoftBodyData_mut(physx_PxScene* self__pod, void** data, void* dataSizes, void* softBodyIndices, int32_t flag_pod, uint32_t nbCopySoftBodies, uint32_t maxSize, void* copyEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->copySoftBodyData(data, dataSizes, softBodyIndices, flag, nbCopySoftBodies, maxSize, copyEvent); + } + + DLLEXPORT void PxScene_applySoftBodyData_mut(physx_PxScene* self__pod, void** data, void* dataSizes, void* softBodyIndices, int32_t flag_pod, uint32_t nbUpdatedSoftBodies, uint32_t maxSize, void* applyEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->applySoftBodyData(data, dataSizes, softBodyIndices, flag, nbUpdatedSoftBodies, maxSize, applyEvent); + } + + DLLEXPORT void PxScene_copyContactData_mut(physx_PxScene* self__pod, void* data, uint32_t maxContactPairs, void* numContactPairs, void* copyEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + self_->copyContactData(data, maxContactPairs, numContactPairs, copyEvent); + } + + DLLEXPORT void PxScene_copyBodyData_mut(physx_PxScene* self__pod, physx_PxGpuBodyData* data_pod, physx_PxGpuActorPair* index_pod, uint32_t nbCopyActors, void* copyEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxGpuBodyData* data = reinterpret_cast(data_pod); + physx::PxGpuActorPair* index = reinterpret_cast(index_pod); + self_->copyBodyData(data, index, nbCopyActors, copyEvent); + } + + DLLEXPORT void PxScene_applyActorData_mut(physx_PxScene* self__pod, void* data, physx_PxGpuActorPair* index_pod, int32_t flag_pod, uint32_t nbUpdatedActors, void* waitEvent, void* signalEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxGpuActorPair* index = reinterpret_cast(index_pod); + auto flag = static_cast(flag_pod); + self_->applyActorData(data, index, flag, nbUpdatedActors, waitEvent, signalEvent); + } + + DLLEXPORT void PxScene_computeDenseJacobians_mut(physx_PxScene* self__pod, physx_PxIndexDataPair const* indices_pod, uint32_t nbIndices, void* computeEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxIndexDataPair const* indices = reinterpret_cast(indices_pod); + self_->computeDenseJacobians(indices, nbIndices, computeEvent); + } + + DLLEXPORT void PxScene_computeGeneralizedMassMatrices_mut(physx_PxScene* self__pod, physx_PxIndexDataPair const* indices_pod, uint32_t nbIndices, void* computeEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxIndexDataPair const* indices = reinterpret_cast(indices_pod); + self_->computeGeneralizedMassMatrices(indices, nbIndices, computeEvent); + } + + DLLEXPORT void PxScene_computeGeneralizedGravityForces_mut(physx_PxScene* self__pod, physx_PxIndexDataPair const* indices_pod, uint32_t nbIndices, void* computeEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxIndexDataPair const* indices = reinterpret_cast(indices_pod); + self_->computeGeneralizedGravityForces(indices, nbIndices, computeEvent); + } + + DLLEXPORT void PxScene_computeCoriolisAndCentrifugalForces_mut(physx_PxScene* self__pod, physx_PxIndexDataPair const* indices_pod, uint32_t nbIndices, void* computeEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxIndexDataPair const* indices = reinterpret_cast(indices_pod); + self_->computeCoriolisAndCentrifugalForces(indices, nbIndices, computeEvent); + } + + DLLEXPORT physx_PxgDynamicsMemoryConfig PxScene_getGpuDynamicsConfig(physx_PxScene const* self__pod) { + physx::PxScene const* self_ = reinterpret_cast(self__pod); + physx::PxgDynamicsMemoryConfig return_val = self_->getGpuDynamicsConfig(); + physx_PxgDynamicsMemoryConfig return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxScene_applyParticleBufferData_mut(physx_PxScene* self__pod, uint32_t const* indices, physx_PxGpuParticleBufferIndexPair const* bufferIndexPair_pod, uint32_t const* flags_pod, uint32_t nbUpdatedBuffers, void* waitEvent, void* signalEvent) { + physx::PxScene* self_ = reinterpret_cast(self__pod); + physx::PxGpuParticleBufferIndexPair const* bufferIndexPair = reinterpret_cast(bufferIndexPair_pod); + physx::PxParticleBufferFlags const* flags = reinterpret_cast(flags_pod); + self_->applyParticleBufferData(indices, bufferIndexPair, flags, nbUpdatedBuffers, waitEvent, signalEvent); + } + + DLLEXPORT physx_PxSceneReadLock* PxSceneReadLock_new_alloc(physx_PxScene* scene_pod, char const* file, uint32_t line) { + physx::PxScene& scene = reinterpret_cast(*scene_pod); + auto return_val = new physx::PxSceneReadLock(scene, file, line); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSceneReadLock_delete(physx_PxSceneReadLock* self__pod) { + physx::PxSceneReadLock* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxSceneWriteLock* PxSceneWriteLock_new_alloc(physx_PxScene* scene_pod, char const* file, uint32_t line) { + physx::PxScene& scene = reinterpret_cast(*scene_pod); + auto return_val = new physx::PxSceneWriteLock(scene, file, line); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxSceneWriteLock_delete(physx_PxSceneWriteLock* self__pod) { + physx::PxSceneWriteLock* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxContactPairExtraDataItem PxContactPairExtraDataItem_new() { + PxContactPairExtraDataItem return_val; + physx_PxContactPairExtraDataItem return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxContactPairVelocity PxContactPairVelocity_new() { + PxContactPairVelocity return_val; + physx_PxContactPairVelocity return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxContactPairPose PxContactPairPose_new() { + PxContactPairPose return_val; + physx_PxContactPairPose return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxContactPairIndex PxContactPairIndex_new() { + PxContactPairIndex return_val; + physx_PxContactPairIndex return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxContactPairExtraDataIterator PxContactPairExtraDataIterator_new(uint8_t const* stream, uint32_t size) { + PxContactPairExtraDataIterator return_val(stream, size); + physx_PxContactPairExtraDataIterator return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxContactPairExtraDataIterator_nextItemSet_mut(physx_PxContactPairExtraDataIterator* self__pod) { + physx::PxContactPairExtraDataIterator* self_ = reinterpret_cast(self__pod); + bool return_val = self_->nextItemSet(); + return return_val; + } + + DLLEXPORT physx_PxContactPairHeader PxContactPairHeader_new() { + PxContactPairHeader return_val; + physx_PxContactPairHeader return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxContactPair PxContactPair_new() { + PxContactPair return_val; + physx_PxContactPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxContactPair_extractContacts(physx_PxContactPair const* self__pod, physx_PxContactPairPoint* userBuffer_pod, uint32_t bufferSize) { + physx::PxContactPair const* self_ = reinterpret_cast(self__pod); + physx::PxContactPairPoint* userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->extractContacts(userBuffer, bufferSize); + return return_val; + } + + DLLEXPORT void PxContactPair_bufferContacts(physx_PxContactPair const* self__pod, physx_PxContactPair* newPair_pod, uint8_t* bufferMemory) { + physx::PxContactPair const* self_ = reinterpret_cast(self__pod); + physx::PxContactPair* newPair = reinterpret_cast(newPair_pod); + self_->bufferContacts(newPair, bufferMemory); + } + + DLLEXPORT uint32_t const* PxContactPair_getInternalFaceIndices(physx_PxContactPair const* self__pod) { + physx::PxContactPair const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getInternalFaceIndices(); + return return_val; + } + + DLLEXPORT physx_PxTriggerPair PxTriggerPair_new() { + PxTriggerPair return_val; + physx_PxTriggerPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxConstraintInfo PxConstraintInfo_new() { + PxConstraintInfo return_val; + physx_PxConstraintInfo return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxConstraintInfo PxConstraintInfo_new_1(physx_PxConstraint* c_pod, void* extRef, uint32_t t) { + physx::PxConstraint* c = reinterpret_cast(c_pod); + PxConstraintInfo return_val(c, extRef, t); + physx_PxConstraintInfo return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSimulationEventCallback_onConstraintBreak_mut(physx_PxSimulationEventCallback* self__pod, physx_PxConstraintInfo* constraints_pod, uint32_t count) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxConstraintInfo* constraints = reinterpret_cast(constraints_pod); + self_->onConstraintBreak(constraints, count); + } + + DLLEXPORT void PxSimulationEventCallback_onWake_mut(physx_PxSimulationEventCallback* self__pod, physx_PxActor** actors_pod, uint32_t count) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxActor** actors = reinterpret_cast(actors_pod); + self_->onWake(actors, count); + } + + DLLEXPORT void PxSimulationEventCallback_onSleep_mut(physx_PxSimulationEventCallback* self__pod, physx_PxActor** actors_pod, uint32_t count) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxActor** actors = reinterpret_cast(actors_pod); + self_->onSleep(actors, count); + } + + DLLEXPORT void PxSimulationEventCallback_onContact_mut(physx_PxSimulationEventCallback* self__pod, physx_PxContactPairHeader const* pairHeader_pod, physx_PxContactPair const* pairs_pod, uint32_t nbPairs) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxContactPairHeader const& pairHeader = reinterpret_cast(*pairHeader_pod); + physx::PxContactPair const* pairs = reinterpret_cast(pairs_pod); + self_->onContact(pairHeader, pairs, nbPairs); + } + + DLLEXPORT void PxSimulationEventCallback_onTrigger_mut(physx_PxSimulationEventCallback* self__pod, physx_PxTriggerPair* pairs_pod, uint32_t count) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxTriggerPair* pairs = reinterpret_cast(pairs_pod); + self_->onTrigger(pairs, count); + } + + DLLEXPORT void PxSimulationEventCallback_onAdvance_mut(physx_PxSimulationEventCallback* self__pod, physx_PxRigidBody const* const* bodyBuffer_pod, physx_PxTransform const* poseBuffer_pod, uint32_t count) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + physx::PxRigidBody const* const* bodyBuffer = reinterpret_cast(bodyBuffer_pod); + physx::PxTransform const* poseBuffer = reinterpret_cast(poseBuffer_pod); + self_->onAdvance(bodyBuffer, poseBuffer, count); + } + + DLLEXPORT void PxSimulationEventCallback_delete(physx_PxSimulationEventCallback* self__pod) { + physx::PxSimulationEventCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxFEMParameters PxFEMParameters_new() { + PxFEMParameters return_val; + physx_PxFEMParameters return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPruningStructure_release_mut(physx_PxPruningStructure* self__pod) { + physx::PxPruningStructure* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint32_t PxPruningStructure_getRigidActors(physx_PxPruningStructure const* self__pod, physx_PxRigidActor** userBuffer_pod, uint32_t bufferSize, uint32_t startIndex) { + physx::PxPruningStructure const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor** userBuffer = reinterpret_cast(userBuffer_pod); + uint32_t return_val = self_->getRigidActors(userBuffer, bufferSize, startIndex); + return return_val; + } + + DLLEXPORT uint32_t PxPruningStructure_getNbRigidActors(physx_PxPruningStructure const* self__pod) { + physx::PxPruningStructure const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbRigidActors(); + return return_val; + } + + DLLEXPORT void const* PxPruningStructure_getStaticMergeData(physx_PxPruningStructure const* self__pod) { + physx::PxPruningStructure const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getStaticMergeData(); + return return_val; + } + + DLLEXPORT void const* PxPruningStructure_getDynamicMergeData(physx_PxPruningStructure const* self__pod) { + physx::PxPruningStructure const* self_ = reinterpret_cast(self__pod); + void const* return_val = self_->getDynamicMergeData(); + return return_val; + } + + DLLEXPORT char const* PxPruningStructure_getConcreteTypeName(physx_PxPruningStructure const* self__pod) { + physx::PxPruningStructure const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxExtendedVec3 PxExtendedVec3_new() { + PxExtendedVec3 return_val; + physx_PxExtendedVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxExtendedVec3 PxExtendedVec3_new_1(double _x, double _y, double _z) { + PxExtendedVec3 return_val(_x, _y, _z); + physx_PxExtendedVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxExtendedVec3_isZero(physx_PxExtendedVec3 const* self__pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isZero(); + return return_val; + } + + DLLEXPORT double PxExtendedVec3_dot(physx_PxExtendedVec3 const* self__pod, physx_PxVec3 const* v_pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& v = reinterpret_cast(*v_pod); + double return_val = self_->dot(v); + return return_val; + } + + DLLEXPORT double PxExtendedVec3_distanceSquared(physx_PxExtendedVec3 const* self__pod, physx_PxExtendedVec3 const* v_pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& v = reinterpret_cast(*v_pod); + double return_val = self_->distanceSquared(v); + return return_val; + } + + DLLEXPORT double PxExtendedVec3_magnitudeSquared(physx_PxExtendedVec3 const* self__pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + double return_val = self_->magnitudeSquared(); + return return_val; + } + + DLLEXPORT double PxExtendedVec3_magnitude(physx_PxExtendedVec3 const* self__pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + double return_val = self_->magnitude(); + return return_val; + } + + DLLEXPORT double PxExtendedVec3_normalize_mut(physx_PxExtendedVec3* self__pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + double return_val = self_->normalize(); + return return_val; + } + + DLLEXPORT bool PxExtendedVec3_isFinite(physx_PxExtendedVec3 const* self__pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isFinite(); + return return_val; + } + + DLLEXPORT void PxExtendedVec3_maximum_mut(physx_PxExtendedVec3* self__pod, physx_PxExtendedVec3 const* v_pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& v = reinterpret_cast(*v_pod); + self_->maximum(v); + } + + DLLEXPORT void PxExtendedVec3_minimum_mut(physx_PxExtendedVec3* self__pod, physx_PxExtendedVec3 const* v_pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& v = reinterpret_cast(*v_pod); + self_->minimum(v); + } + + DLLEXPORT void PxExtendedVec3_set_mut(physx_PxExtendedVec3* self__pod, double x_, double y_, double z_) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + self_->set(x_, y_, z_); + } + + DLLEXPORT void PxExtendedVec3_setPlusInfinity_mut(physx_PxExtendedVec3* self__pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + self_->setPlusInfinity(); + } + + DLLEXPORT void PxExtendedVec3_setMinusInfinity_mut(physx_PxExtendedVec3* self__pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + self_->setMinusInfinity(); + } + + DLLEXPORT void PxExtendedVec3_cross_mut(physx_PxExtendedVec3* self__pod, physx_PxExtendedVec3 const* left_pod, physx_PxVec3 const* right_pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& left = reinterpret_cast(*left_pod); + physx::PxVec3 const& right = reinterpret_cast(*right_pod); + self_->cross(left, right); + } + + DLLEXPORT void PxExtendedVec3_cross_mut_1(physx_PxExtendedVec3* self__pod, physx_PxExtendedVec3 const* left_pod, physx_PxExtendedVec3 const* right_pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& left = reinterpret_cast(*left_pod); + physx::PxExtendedVec3 const& right = reinterpret_cast(*right_pod); + self_->cross(left, right); + } + + DLLEXPORT physx_PxExtendedVec3 PxExtendedVec3_cross(physx_PxExtendedVec3 const* self__pod, physx_PxExtendedVec3 const* v_pod) { + physx::PxExtendedVec3 const* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& v = reinterpret_cast(*v_pod); + physx::PxExtendedVec3 return_val = self_->cross(v); + physx_PxExtendedVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxExtendedVec3_cross_mut_2(physx_PxExtendedVec3* self__pod, physx_PxVec3 const* left_pod, physx_PxExtendedVec3 const* right_pod) { + physx::PxExtendedVec3* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& left = reinterpret_cast(*left_pod); + physx::PxExtendedVec3 const& right = reinterpret_cast(*right_pod); + self_->cross(left, right); + } + + DLLEXPORT physx_PxVec3 phys_toVec3(physx_PxExtendedVec3 const* v_pod) { + physx::PxExtendedVec3 const& v = reinterpret_cast(*v_pod); + physx::PxVec3 return_val = toVec3(v); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxObstacle_getType(physx_PxObstacle const* self__pod) { + physx::PxObstacle const* self_ = reinterpret_cast(self__pod); + physx::PxGeometryType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxBoxObstacle PxBoxObstacle_new() { + PxBoxObstacle return_val; + physx_PxBoxObstacle return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxCapsuleObstacle PxCapsuleObstacle_new() { + PxCapsuleObstacle return_val; + physx_PxCapsuleObstacle return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxObstacleContext_release_mut(physx_PxObstacleContext* self__pod) { + physx::PxObstacleContext* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxControllerManager* PxObstacleContext_getControllerManager(physx_PxObstacleContext const* self__pod) { + physx::PxObstacleContext const* self_ = reinterpret_cast(self__pod); + physx::PxControllerManager& return_val = self_->getControllerManager(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxObstacleContext_addObstacle_mut(physx_PxObstacleContext* self__pod, physx_PxObstacle const* obstacle_pod) { + physx::PxObstacleContext* self_ = reinterpret_cast(self__pod); + physx::PxObstacle const& obstacle = reinterpret_cast(*obstacle_pod); + uint32_t return_val = self_->addObstacle(obstacle); + return return_val; + } + + DLLEXPORT bool PxObstacleContext_removeObstacle_mut(physx_PxObstacleContext* self__pod, uint32_t handle) { + physx::PxObstacleContext* self_ = reinterpret_cast(self__pod); + bool return_val = self_->removeObstacle(handle); + return return_val; + } + + DLLEXPORT bool PxObstacleContext_updateObstacle_mut(physx_PxObstacleContext* self__pod, uint32_t handle, physx_PxObstacle const* obstacle_pod) { + physx::PxObstacleContext* self_ = reinterpret_cast(self__pod); + physx::PxObstacle const& obstacle = reinterpret_cast(*obstacle_pod); + bool return_val = self_->updateObstacle(handle, obstacle); + return return_val; + } + + DLLEXPORT uint32_t PxObstacleContext_getNbObstacles(physx_PxObstacleContext const* self__pod) { + physx::PxObstacleContext const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbObstacles(); + return return_val; + } + + DLLEXPORT physx_PxObstacle const* PxObstacleContext_getObstacle(physx_PxObstacleContext const* self__pod, uint32_t i) { + physx::PxObstacleContext const* self_ = reinterpret_cast(self__pod); + physx::PxObstacle const* return_val = self_->getObstacle(i); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxObstacle const* PxObstacleContext_getObstacleByHandle(physx_PxObstacleContext const* self__pod, uint32_t handle) { + physx::PxObstacleContext const* self_ = reinterpret_cast(self__pod); + physx::PxObstacle const* return_val = self_->getObstacleByHandle(handle); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxUserControllerHitReport_onShapeHit_mut(physx_PxUserControllerHitReport* self__pod, physx_PxControllerShapeHit const* hit_pod) { + physx::PxUserControllerHitReport* self_ = reinterpret_cast(self__pod); + physx::PxControllerShapeHit const& hit = reinterpret_cast(*hit_pod); + self_->onShapeHit(hit); + } + + DLLEXPORT void PxUserControllerHitReport_onControllerHit_mut(physx_PxUserControllerHitReport* self__pod, physx_PxControllersHit const* hit_pod) { + physx::PxUserControllerHitReport* self_ = reinterpret_cast(self__pod); + physx::PxControllersHit const& hit = reinterpret_cast(*hit_pod); + self_->onControllerHit(hit); + } + + DLLEXPORT void PxUserControllerHitReport_onObstacleHit_mut(physx_PxUserControllerHitReport* self__pod, physx_PxControllerObstacleHit const* hit_pod) { + physx::PxUserControllerHitReport* self_ = reinterpret_cast(self__pod); + physx::PxControllerObstacleHit const& hit = reinterpret_cast(*hit_pod); + self_->onObstacleHit(hit); + } + + DLLEXPORT void PxControllerFilterCallback_delete(physx_PxControllerFilterCallback* self__pod) { + physx::PxControllerFilterCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT bool PxControllerFilterCallback_filter_mut(physx_PxControllerFilterCallback* self__pod, physx_PxController const* a_pod, physx_PxController const* b_pod) { + physx::PxControllerFilterCallback* self_ = reinterpret_cast(self__pod); + physx::PxController const& a = reinterpret_cast(*a_pod); + physx::PxController const& b = reinterpret_cast(*b_pod); + bool return_val = self_->filter(a, b); + return return_val; + } + + DLLEXPORT physx_PxControllerFilters PxControllerFilters_new(physx_PxFilterData const* filterData_pod, physx_PxQueryFilterCallback* cb_pod, physx_PxControllerFilterCallback* cctFilterCb_pod) { + physx::PxFilterData const* filterData = reinterpret_cast(filterData_pod); + physx::PxQueryFilterCallback* cb = reinterpret_cast(cb_pod); + physx::PxControllerFilterCallback* cctFilterCb = reinterpret_cast(cctFilterCb_pod); + PxControllerFilters return_val(filterData, cb, cctFilterCb); + physx_PxControllerFilters return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxControllerDesc_isValid(physx_PxControllerDesc const* self__pod) { + physx::PxControllerDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT int32_t PxControllerDesc_getType(physx_PxControllerDesc const* self__pod) { + physx::PxControllerDesc const* self_ = reinterpret_cast(self__pod); + physx::PxControllerShapeType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxController_getType(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxControllerShapeType::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxController_release_mut(physx_PxController* self__pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT uint8_t PxController_move_mut(physx_PxController* self__pod, physx_PxVec3 const* disp_pod, float minDist, float elapsedTime, physx_PxControllerFilters const* filters_pod, physx_PxObstacleContext const* obstacles_pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& disp = reinterpret_cast(*disp_pod); + physx::PxControllerFilters const& filters = reinterpret_cast(*filters_pod); + physx::PxObstacleContext const* obstacles = reinterpret_cast(obstacles_pod); + physx::PxControllerCollisionFlags return_val = self_->move(disp, minDist, elapsedTime, filters, obstacles); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxController_setPosition_mut(physx_PxController* self__pod, physx_PxExtendedVec3 const* position_pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& position = reinterpret_cast(*position_pod); + bool return_val = self_->setPosition(position); + return return_val; + } + + DLLEXPORT physx_PxExtendedVec3 const* PxController_getPosition(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& return_val = self_->getPosition(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT bool PxController_setFootPosition_mut(physx_PxController* self__pod, physx_PxExtendedVec3 const* position_pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 const& position = reinterpret_cast(*position_pod); + bool return_val = self_->setFootPosition(position); + return return_val; + } + + DLLEXPORT physx_PxExtendedVec3 PxController_getFootPosition(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxExtendedVec3 return_val = self_->getFootPosition(); + physx_PxExtendedVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* PxController_getActor(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxRigidDynamic* return_val = self_->getActor(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxController_setStepOffset_mut(physx_PxController* self__pod, float offset) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->setStepOffset(offset); + } + + DLLEXPORT float PxController_getStepOffset(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStepOffset(); + return return_val; + } + + DLLEXPORT void PxController_setNonWalkableMode_mut(physx_PxController* self__pod, int32_t flag_pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setNonWalkableMode(flag); + } + + DLLEXPORT int32_t PxController_getNonWalkableMode(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxControllerNonWalkableMode::Enum return_val = self_->getNonWalkableMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxController_getContactOffset(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getContactOffset(); + return return_val; + } + + DLLEXPORT void PxController_setContactOffset_mut(physx_PxController* self__pod, float offset) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->setContactOffset(offset); + } + + DLLEXPORT physx_PxVec3 PxController_getUpDirection(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getUpDirection(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxController_setUpDirection_mut(physx_PxController* self__pod, physx_PxVec3 const* up_pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& up = reinterpret_cast(*up_pod); + self_->setUpDirection(up); + } + + DLLEXPORT float PxController_getSlopeLimit(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSlopeLimit(); + return return_val; + } + + DLLEXPORT void PxController_setSlopeLimit_mut(physx_PxController* self__pod, float slopeLimit) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->setSlopeLimit(slopeLimit); + } + + DLLEXPORT void PxController_invalidateCache_mut(physx_PxController* self__pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->invalidateCache(); + } + + DLLEXPORT physx_PxScene* PxController_getScene_mut(physx_PxController* self__pod) { + physx::PxController* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void* PxController_getUserData(physx_PxController const* self__pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + void* return_val = self_->getUserData(); + return return_val; + } + + DLLEXPORT void PxController_setUserData_mut(physx_PxController* self__pod, void* userData) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->setUserData(userData); + } + + DLLEXPORT void PxController_getState(physx_PxController const* self__pod, physx_PxControllerState* state_pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxControllerState& state = reinterpret_cast(*state_pod); + self_->getState(state); + } + + DLLEXPORT void PxController_getStats(physx_PxController const* self__pod, physx_PxControllerStats* stats_pod) { + physx::PxController const* self_ = reinterpret_cast(self__pod); + physx::PxControllerStats& stats = reinterpret_cast(*stats_pod); + self_->getStats(stats); + } + + DLLEXPORT void PxController_resize_mut(physx_PxController* self__pod, float height) { + physx::PxController* self_ = reinterpret_cast(self__pod); + self_->resize(height); + } + + DLLEXPORT physx_PxBoxControllerDesc* PxBoxControllerDesc_new_alloc() { + auto return_val = new physx::PxBoxControllerDesc(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBoxControllerDesc_delete(physx_PxBoxControllerDesc* self__pod) { + physx::PxBoxControllerDesc* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxBoxControllerDesc_setToDefault_mut(physx_PxBoxControllerDesc* self__pod) { + physx::PxBoxControllerDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxBoxControllerDesc_isValid(physx_PxBoxControllerDesc const* self__pod) { + physx::PxBoxControllerDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT float PxBoxController_getHalfHeight(physx_PxBoxController const* self__pod) { + physx::PxBoxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getHalfHeight(); + return return_val; + } + + DLLEXPORT float PxBoxController_getHalfSideExtent(physx_PxBoxController const* self__pod) { + physx::PxBoxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getHalfSideExtent(); + return return_val; + } + + DLLEXPORT float PxBoxController_getHalfForwardExtent(physx_PxBoxController const* self__pod) { + physx::PxBoxController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getHalfForwardExtent(); + return return_val; + } + + DLLEXPORT bool PxBoxController_setHalfHeight_mut(physx_PxBoxController* self__pod, float halfHeight) { + physx::PxBoxController* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setHalfHeight(halfHeight); + return return_val; + } + + DLLEXPORT bool PxBoxController_setHalfSideExtent_mut(physx_PxBoxController* self__pod, float halfSideExtent) { + physx::PxBoxController* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setHalfSideExtent(halfSideExtent); + return return_val; + } + + DLLEXPORT bool PxBoxController_setHalfForwardExtent_mut(physx_PxBoxController* self__pod, float halfForwardExtent) { + physx::PxBoxController* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setHalfForwardExtent(halfForwardExtent); + return return_val; + } + + DLLEXPORT physx_PxCapsuleControllerDesc* PxCapsuleControllerDesc_new_alloc() { + auto return_val = new physx::PxCapsuleControllerDesc(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxCapsuleControllerDesc_delete(physx_PxCapsuleControllerDesc* self__pod) { + physx::PxCapsuleControllerDesc* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxCapsuleControllerDesc_setToDefault_mut(physx_PxCapsuleControllerDesc* self__pod) { + physx::PxCapsuleControllerDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxCapsuleControllerDesc_isValid(physx_PxCapsuleControllerDesc const* self__pod) { + physx::PxCapsuleControllerDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT float PxCapsuleController_getRadius(physx_PxCapsuleController const* self__pod) { + physx::PxCapsuleController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRadius(); + return return_val; + } + + DLLEXPORT bool PxCapsuleController_setRadius_mut(physx_PxCapsuleController* self__pod, float radius) { + physx::PxCapsuleController* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setRadius(radius); + return return_val; + } + + DLLEXPORT float PxCapsuleController_getHeight(physx_PxCapsuleController const* self__pod) { + physx::PxCapsuleController const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getHeight(); + return return_val; + } + + DLLEXPORT bool PxCapsuleController_setHeight_mut(physx_PxCapsuleController* self__pod, float height) { + physx::PxCapsuleController* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setHeight(height); + return return_val; + } + + DLLEXPORT int32_t PxCapsuleController_getClimbingMode(physx_PxCapsuleController const* self__pod) { + physx::PxCapsuleController const* self_ = reinterpret_cast(self__pod); + physx::PxCapsuleClimbingMode::Enum return_val = self_->getClimbingMode(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxCapsuleController_setClimbingMode_mut(physx_PxCapsuleController* self__pod, int32_t mode_pod) { + physx::PxCapsuleController* self_ = reinterpret_cast(self__pod); + auto mode = static_cast(mode_pod); + bool return_val = self_->setClimbingMode(mode); + return return_val; + } + + DLLEXPORT uint8_t PxControllerBehaviorCallback_getBehaviorFlags_mut(physx_PxControllerBehaviorCallback* self__pod, physx_PxShape const* shape_pod, physx_PxActor const* actor_pod) { + physx::PxControllerBehaviorCallback* self_ = reinterpret_cast(self__pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxActor const& actor = reinterpret_cast(*actor_pod); + physx::PxControllerBehaviorFlags return_val = self_->getBehaviorFlags(shape, actor); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint8_t PxControllerBehaviorCallback_getBehaviorFlags_mut_1(physx_PxControllerBehaviorCallback* self__pod, physx_PxController const* controller_pod) { + physx::PxControllerBehaviorCallback* self_ = reinterpret_cast(self__pod); + physx::PxController const& controller = reinterpret_cast(*controller_pod); + physx::PxControllerBehaviorFlags return_val = self_->getBehaviorFlags(controller); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint8_t PxControllerBehaviorCallback_getBehaviorFlags_mut_2(physx_PxControllerBehaviorCallback* self__pod, physx_PxObstacle const* obstacle_pod) { + physx::PxControllerBehaviorCallback* self_ = reinterpret_cast(self__pod); + physx::PxObstacle const& obstacle = reinterpret_cast(*obstacle_pod); + physx::PxControllerBehaviorFlags return_val = self_->getBehaviorFlags(obstacle); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxControllerManager_release_mut(physx_PxControllerManager* self__pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxScene* PxControllerManager_getScene(physx_PxControllerManager const* self__pod) { + physx::PxControllerManager const* self_ = reinterpret_cast(self__pod); + physx::PxScene& return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxControllerManager_getNbControllers(physx_PxControllerManager const* self__pod) { + physx::PxControllerManager const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbControllers(); + return return_val; + } + + DLLEXPORT physx_PxController* PxControllerManager_getController_mut(physx_PxControllerManager* self__pod, uint32_t index) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxController* return_val = self_->getController(index); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxController* PxControllerManager_createController_mut(physx_PxControllerManager* self__pod, physx_PxControllerDesc const* desc_pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxControllerDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxController* return_val = self_->createController(desc); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxControllerManager_purgeControllers_mut(physx_PxControllerManager* self__pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->purgeControllers(); + } + + DLLEXPORT physx_PxRenderBuffer* PxControllerManager_getRenderBuffer_mut(physx_PxControllerManager* self__pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxRenderBuffer& return_val = self_->getRenderBuffer(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxControllerManager_setDebugRenderingFlags_mut(physx_PxControllerManager* self__pod, uint32_t flags_pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxControllerDebugRenderFlags(flags_pod); + self_->setDebugRenderingFlags(flags); + } + + DLLEXPORT uint32_t PxControllerManager_getNbObstacleContexts(physx_PxControllerManager const* self__pod) { + physx::PxControllerManager const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbObstacleContexts(); + return return_val; + } + + DLLEXPORT physx_PxObstacleContext* PxControllerManager_getObstacleContext_mut(physx_PxControllerManager* self__pod, uint32_t index) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxObstacleContext* return_val = self_->getObstacleContext(index); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxObstacleContext* PxControllerManager_createObstacleContext_mut(physx_PxControllerManager* self__pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxObstacleContext* return_val = self_->createObstacleContext(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxControllerManager_computeInteractions_mut(physx_PxControllerManager* self__pod, float elapsedTime, physx_PxControllerFilterCallback* cctFilterCb_pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxControllerFilterCallback* cctFilterCb = reinterpret_cast(cctFilterCb_pod); + self_->computeInteractions(elapsedTime, cctFilterCb); + } + + DLLEXPORT void PxControllerManager_setTessellation_mut(physx_PxControllerManager* self__pod, bool flag, float maxEdgeLength) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->setTessellation(flag, maxEdgeLength); + } + + DLLEXPORT void PxControllerManager_setOverlapRecoveryModule_mut(physx_PxControllerManager* self__pod, bool flag) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->setOverlapRecoveryModule(flag); + } + + DLLEXPORT void PxControllerManager_setPreciseSweeps_mut(physx_PxControllerManager* self__pod, bool flag) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->setPreciseSweeps(flag); + } + + DLLEXPORT void PxControllerManager_setPreventVerticalSlidingAgainstCeiling_mut(physx_PxControllerManager* self__pod, bool flag) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + self_->setPreventVerticalSlidingAgainstCeiling(flag); + } + + DLLEXPORT void PxControllerManager_shiftOrigin_mut(physx_PxControllerManager* self__pod, physx_PxVec3 const* shift_pod) { + physx::PxControllerManager* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& shift = reinterpret_cast(*shift_pod); + self_->shiftOrigin(shift); + } + + DLLEXPORT physx_PxControllerManager* phys_PxCreateControllerManager(physx_PxScene* scene_pod, bool lockingEnabled) { + physx::PxScene& scene = reinterpret_cast(*scene_pod); + physx::PxControllerManager* return_val = PxCreateControllerManager(scene, lockingEnabled); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxDim3 PxDim3_new() { + PxDim3 return_val; + physx_PxDim3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxSDFDesc PxSDFDesc_new() { + PxSDFDesc return_val; + physx_PxSDFDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxSDFDesc_isValid(physx_PxSDFDesc const* self__pod) { + physx::PxSDFDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxConvexMeshDesc PxConvexMeshDesc_new() { + PxConvexMeshDesc return_val; + physx_PxConvexMeshDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxConvexMeshDesc_setToDefault_mut(physx_PxConvexMeshDesc* self__pod) { + physx::PxConvexMeshDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxConvexMeshDesc_isValid(physx_PxConvexMeshDesc const* self__pod) { + physx::PxConvexMeshDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTriangleMeshDesc PxTriangleMeshDesc_new() { + PxTriangleMeshDesc return_val; + physx_PxTriangleMeshDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxTriangleMeshDesc_setToDefault_mut(physx_PxTriangleMeshDesc* self__pod) { + physx::PxTriangleMeshDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxTriangleMeshDesc_isValid(physx_PxTriangleMeshDesc const* self__pod) { + physx::PxTriangleMeshDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxTetrahedronMeshDesc PxTetrahedronMeshDesc_new() { + PxTetrahedronMeshDesc return_val; + physx_PxTetrahedronMeshDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxTetrahedronMeshDesc_isValid(physx_PxTetrahedronMeshDesc const* self__pod) { + physx::PxTetrahedronMeshDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxSoftBodySimulationDataDesc PxSoftBodySimulationDataDesc_new() { + PxSoftBodySimulationDataDesc return_val; + physx_PxSoftBodySimulationDataDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxSoftBodySimulationDataDesc_isValid(physx_PxSoftBodySimulationDataDesc const* self__pod) { + physx::PxSoftBodySimulationDataDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxBVH34MidphaseDesc_setToDefault_mut(physx_PxBVH34MidphaseDesc* self__pod) { + physx::PxBVH34MidphaseDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxBVH34MidphaseDesc_isValid(physx_PxBVH34MidphaseDesc const* self__pod) { + physx::PxBVH34MidphaseDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxMidphaseDesc PxMidphaseDesc_new() { + PxMidphaseDesc return_val; + physx_PxMidphaseDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT int32_t PxMidphaseDesc_getType(physx_PxMidphaseDesc const* self__pod) { + physx::PxMidphaseDesc const* self_ = reinterpret_cast(self__pod); + physx::PxMeshMidPhase::Enum return_val = self_->getType(); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxMidphaseDesc_setToDefault_mut(physx_PxMidphaseDesc* self__pod, int32_t type_pod) { + physx::PxMidphaseDesc* self_ = reinterpret_cast(self__pod); + auto type = static_cast(type_pod); + self_->setToDefault(type); + } + + DLLEXPORT bool PxMidphaseDesc_isValid(physx_PxMidphaseDesc const* self__pod) { + physx::PxMidphaseDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxBVHDesc PxBVHDesc_new() { + PxBVHDesc return_val; + physx_PxBVHDesc return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxBVHDesc_setToDefault_mut(physx_PxBVHDesc* self__pod) { + physx::PxBVHDesc* self_ = reinterpret_cast(self__pod); + self_->setToDefault(); + } + + DLLEXPORT bool PxBVHDesc_isValid(physx_PxBVHDesc const* self__pod) { + physx::PxBVHDesc const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxCookingParams PxCookingParams_new(physx_PxTolerancesScale const* sc_pod) { + physx::PxTolerancesScale const& sc = reinterpret_cast(*sc_pod); + PxCookingParams return_val(sc); + physx_PxCookingParams return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxInsertionCallback* phys_PxGetStandaloneInsertionCallback() { + physx::PxInsertionCallback* return_val = PxGetStandaloneInsertionCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxCookBVH(physx_PxBVHDesc const* desc_pod, physx_PxOutputStream* stream_pod) { + physx::PxBVHDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxOutputStream& stream = reinterpret_cast(*stream_pod); + bool return_val = PxCookBVH(desc, stream); + return return_val; + } + + DLLEXPORT physx_PxBVH* phys_PxCreateBVH(physx_PxBVHDesc const* desc_pod, physx_PxInsertionCallback* insertionCallback_pod) { + physx::PxBVHDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxInsertionCallback& insertionCallback = reinterpret_cast(*insertionCallback_pod); + physx::PxBVH* return_val = PxCreateBVH(desc, insertionCallback); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxCookHeightField(physx_PxHeightFieldDesc const* desc_pod, physx_PxOutputStream* stream_pod) { + physx::PxHeightFieldDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxOutputStream& stream = reinterpret_cast(*stream_pod); + bool return_val = PxCookHeightField(desc, stream); + return return_val; + } + + DLLEXPORT physx_PxHeightField* phys_PxCreateHeightField(physx_PxHeightFieldDesc const* desc_pod, physx_PxInsertionCallback* insertionCallback_pod) { + physx::PxHeightFieldDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxInsertionCallback& insertionCallback = reinterpret_cast(*insertionCallback_pod); + physx::PxHeightField* return_val = PxCreateHeightField(desc, insertionCallback); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxCookConvexMesh(physx_PxCookingParams const* params_pod, physx_PxConvexMeshDesc const* desc_pod, physx_PxOutputStream* stream_pod, int32_t* condition_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxConvexMeshDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxOutputStream& stream = reinterpret_cast(*stream_pod); + physx::PxConvexMeshCookingResult::Enum* condition = reinterpret_cast(condition_pod); + bool return_val = PxCookConvexMesh(params, desc, stream, condition); + return return_val; + } + + DLLEXPORT physx_PxConvexMesh* phys_PxCreateConvexMesh(physx_PxCookingParams const* params_pod, physx_PxConvexMeshDesc const* desc_pod, physx_PxInsertionCallback* insertionCallback_pod, int32_t* condition_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxConvexMeshDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxInsertionCallback& insertionCallback = reinterpret_cast(*insertionCallback_pod); + physx::PxConvexMeshCookingResult::Enum* condition = reinterpret_cast(condition_pod); + physx::PxConvexMesh* return_val = PxCreateConvexMesh(params, desc, insertionCallback, condition); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxValidateConvexMesh(physx_PxCookingParams const* params_pod, physx_PxConvexMeshDesc const* desc_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxConvexMeshDesc const& desc = reinterpret_cast(*desc_pod); + bool return_val = PxValidateConvexMesh(params, desc); + return return_val; + } + + DLLEXPORT bool phys_PxComputeHullPolygons(physx_PxCookingParams const* params_pod, physx_PxSimpleTriangleMesh const* mesh_pod, physx_PxAllocatorCallback* inCallback_pod, uint32_t* nbVerts_pod, physx_PxVec3** vertices_pod, uint32_t* nbIndices_pod, uint32_t** indices_pod, uint32_t* nbPolygons_pod, physx_PxHullPolygon** hullPolygons_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxSimpleTriangleMesh const& mesh = reinterpret_cast(*mesh_pod); + physx::PxAllocatorCallback& inCallback = reinterpret_cast(*inCallback_pod); + uint32_t& nbVerts = *nbVerts_pod; + physx::PxVec3*& vertices = reinterpret_cast(*vertices_pod); + uint32_t& nbIndices = *nbIndices_pod; + uint32_t*& indices = reinterpret_cast(*indices_pod); + uint32_t& nbPolygons = *nbPolygons_pod; + physx::PxHullPolygon*& hullPolygons = reinterpret_cast(*hullPolygons_pod); + bool return_val = PxComputeHullPolygons(params, mesh, inCallback, nbVerts, vertices, nbIndices, indices, nbPolygons, hullPolygons); + return return_val; + } + + DLLEXPORT bool phys_PxValidateTriangleMesh(physx_PxCookingParams const* params_pod, physx_PxTriangleMeshDesc const* desc_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxTriangleMeshDesc const& desc = reinterpret_cast(*desc_pod); + bool return_val = PxValidateTriangleMesh(params, desc); + return return_val; + } + + DLLEXPORT physx_PxTriangleMesh* phys_PxCreateTriangleMesh(physx_PxCookingParams const* params_pod, physx_PxTriangleMeshDesc const* desc_pod, physx_PxInsertionCallback* insertionCallback_pod, int32_t* condition_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxTriangleMeshDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxInsertionCallback& insertionCallback = reinterpret_cast(*insertionCallback_pod); + physx::PxTriangleMeshCookingResult::Enum* condition = reinterpret_cast(condition_pod); + physx::PxTriangleMesh* return_val = PxCreateTriangleMesh(params, desc, insertionCallback, condition); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxCookTriangleMesh(physx_PxCookingParams const* params_pod, physx_PxTriangleMeshDesc const* desc_pod, physx_PxOutputStream* stream_pod, int32_t* condition_pod) { + physx::PxCookingParams const& params = reinterpret_cast(*params_pod); + physx::PxTriangleMeshDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxOutputStream& stream = reinterpret_cast(*stream_pod); + physx::PxTriangleMeshCookingResult::Enum* condition = reinterpret_cast(condition_pod); + bool return_val = PxCookTriangleMesh(params, desc, stream, condition); + return return_val; + } + + DLLEXPORT physx_PxDefaultMemoryOutputStream* PxDefaultMemoryOutputStream_new_alloc(physx_PxAllocatorCallback* allocator_pod) { + physx::PxAllocatorCallback& allocator = reinterpret_cast(*allocator_pod); + auto return_val = new physx::PxDefaultMemoryOutputStream(allocator); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDefaultMemoryOutputStream_delete(physx_PxDefaultMemoryOutputStream* self__pod) { + physx::PxDefaultMemoryOutputStream* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxDefaultMemoryOutputStream_write_mut(physx_PxDefaultMemoryOutputStream* self__pod, void const* src, uint32_t count) { + physx::PxDefaultMemoryOutputStream* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->write(src, count); + return return_val; + } + + DLLEXPORT uint32_t PxDefaultMemoryOutputStream_getSize(physx_PxDefaultMemoryOutputStream const* self__pod) { + physx::PxDefaultMemoryOutputStream const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getSize(); + return return_val; + } + + DLLEXPORT uint8_t* PxDefaultMemoryOutputStream_getData(physx_PxDefaultMemoryOutputStream const* self__pod) { + physx::PxDefaultMemoryOutputStream const* self_ = reinterpret_cast(self__pod); + uint8_t* return_val = self_->getData(); + return return_val; + } + + DLLEXPORT physx_PxDefaultMemoryInputData* PxDefaultMemoryInputData_new_alloc(uint8_t* data, uint32_t length) { + auto return_val = new physx::PxDefaultMemoryInputData(data, length); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxDefaultMemoryInputData_read_mut(physx_PxDefaultMemoryInputData* self__pod, void* dest, uint32_t count) { + physx::PxDefaultMemoryInputData* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->read(dest, count); + return return_val; + } + + DLLEXPORT uint32_t PxDefaultMemoryInputData_getLength(physx_PxDefaultMemoryInputData const* self__pod) { + physx::PxDefaultMemoryInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getLength(); + return return_val; + } + + DLLEXPORT void PxDefaultMemoryInputData_seek_mut(physx_PxDefaultMemoryInputData* self__pod, uint32_t pos) { + physx::PxDefaultMemoryInputData* self_ = reinterpret_cast(self__pod); + self_->seek(pos); + } + + DLLEXPORT uint32_t PxDefaultMemoryInputData_tell(physx_PxDefaultMemoryInputData const* self__pod) { + physx::PxDefaultMemoryInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->tell(); + return return_val; + } + + DLLEXPORT physx_PxDefaultFileOutputStream* PxDefaultFileOutputStream_new_alloc(char const* name) { + auto return_val = new physx::PxDefaultFileOutputStream(name); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDefaultFileOutputStream_delete(physx_PxDefaultFileOutputStream* self__pod) { + physx::PxDefaultFileOutputStream* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxDefaultFileOutputStream_write_mut(physx_PxDefaultFileOutputStream* self__pod, void const* src, uint32_t count) { + physx::PxDefaultFileOutputStream* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->write(src, count); + return return_val; + } + + DLLEXPORT bool PxDefaultFileOutputStream_isValid_mut(physx_PxDefaultFileOutputStream* self__pod) { + physx::PxDefaultFileOutputStream* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxDefaultFileInputData* PxDefaultFileInputData_new_alloc(char const* name) { + auto return_val = new physx::PxDefaultFileInputData(name); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDefaultFileInputData_delete(physx_PxDefaultFileInputData* self__pod) { + physx::PxDefaultFileInputData* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxDefaultFileInputData_read_mut(physx_PxDefaultFileInputData* self__pod, void* dest, uint32_t count) { + physx::PxDefaultFileInputData* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->read(dest, count); + return return_val; + } + + DLLEXPORT void PxDefaultFileInputData_seek_mut(physx_PxDefaultFileInputData* self__pod, uint32_t pos) { + physx::PxDefaultFileInputData* self_ = reinterpret_cast(self__pod); + self_->seek(pos); + } + + DLLEXPORT uint32_t PxDefaultFileInputData_tell(physx_PxDefaultFileInputData const* self__pod) { + physx::PxDefaultFileInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->tell(); + return return_val; + } + + DLLEXPORT uint32_t PxDefaultFileInputData_getLength(physx_PxDefaultFileInputData const* self__pod) { + physx::PxDefaultFileInputData const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getLength(); + return return_val; + } + + DLLEXPORT bool PxDefaultFileInputData_isValid(physx_PxDefaultFileInputData const* self__pod) { + physx::PxDefaultFileInputData const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void* phys_platformAlignedAlloc(size_t size_pod) { + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = platformAlignedAlloc(size); + return return_val; + } + + DLLEXPORT void phys_platformAlignedFree(void* ptr) { + platformAlignedFree(ptr); + } + + DLLEXPORT void* PxDefaultAllocator_allocate_mut(physx_PxDefaultAllocator* self__pod, size_t size_pod, char const* anon_param1, char const* anon_param2, int32_t anon_param3) { + physx::PxDefaultAllocator* self_ = reinterpret_cast(self__pod); + size_t size; + memcpy(&size, &size_pod, sizeof(size)); + void* return_val = self_->allocate(size, anon_param1, anon_param2, anon_param3); + return return_val; + } + + DLLEXPORT void PxDefaultAllocator_deallocate_mut(physx_PxDefaultAllocator* self__pod, void* ptr) { + physx::PxDefaultAllocator* self_ = reinterpret_cast(self__pod); + self_->deallocate(ptr); + } + + DLLEXPORT void PxDefaultAllocator_delete(physx_PxDefaultAllocator* self__pod) { + physx::PxDefaultAllocator* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxJoint_setActors_mut(physx_PxJoint* self__pod, physx_PxRigidActor* actor0_pod, physx_PxRigidActor* actor1_pod) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + self_->setActors(actor0, actor1); + } + + DLLEXPORT void PxJoint_getActors(physx_PxJoint const* self__pod, physx_PxRigidActor** actor0_pod, physx_PxRigidActor** actor1_pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor*& actor0 = reinterpret_cast(*actor0_pod); + physx::PxRigidActor*& actor1 = reinterpret_cast(*actor1_pod); + self_->getActors(actor0, actor1); + } + + DLLEXPORT void PxJoint_setLocalPose_mut(physx_PxJoint* self__pod, int32_t actor_pod, physx_PxTransform const* localPose_pod) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + auto actor = static_cast(actor_pod); + physx::PxTransform const& localPose = reinterpret_cast(*localPose_pod); + self_->setLocalPose(actor, localPose); + } + + DLLEXPORT physx_PxTransform PxJoint_getLocalPose(physx_PxJoint const* self__pod, int32_t actor_pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + auto actor = static_cast(actor_pod); + physx::PxTransform return_val = self_->getLocalPose(actor); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxTransform PxJoint_getRelativeTransform(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getRelativeTransform(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxJoint_getRelativeLinearVelocity(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getRelativeLinearVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxJoint_getRelativeAngularVelocity(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getRelativeAngularVelocity(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxJoint_setBreakForce_mut(physx_PxJoint* self__pod, float force, float torque) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setBreakForce(force, torque); + } + + DLLEXPORT void PxJoint_getBreakForce(physx_PxJoint const* self__pod, float* force_pod, float* torque_pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + float& force = *force_pod; + float& torque = *torque_pod; + self_->getBreakForce(force, torque); + } + + DLLEXPORT void PxJoint_setConstraintFlags_mut(physx_PxJoint* self__pod, uint16_t flags_pod) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxConstraintFlags(flags_pod); + self_->setConstraintFlags(flags); + } + + DLLEXPORT void PxJoint_setConstraintFlag_mut(physx_PxJoint* self__pod, int32_t flag_pod, bool value) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setConstraintFlag(flag, value); + } + + DLLEXPORT uint16_t PxJoint_getConstraintFlags(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxConstraintFlags return_val = self_->getConstraintFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxJoint_setInvMassScale0_mut(physx_PxJoint* self__pod, float invMassScale) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setInvMassScale0(invMassScale); + } + + DLLEXPORT float PxJoint_getInvMassScale0(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale0(); + return return_val; + } + + DLLEXPORT void PxJoint_setInvInertiaScale0_mut(physx_PxJoint* self__pod, float invInertiaScale) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setInvInertiaScale0(invInertiaScale); + } + + DLLEXPORT float PxJoint_getInvInertiaScale0(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale0(); + return return_val; + } + + DLLEXPORT void PxJoint_setInvMassScale1_mut(physx_PxJoint* self__pod, float invMassScale) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setInvMassScale1(invMassScale); + } + + DLLEXPORT float PxJoint_getInvMassScale1(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvMassScale1(); + return return_val; + } + + DLLEXPORT void PxJoint_setInvInertiaScale1_mut(physx_PxJoint* self__pod, float invInertiaScale) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setInvInertiaScale1(invInertiaScale); + } + + DLLEXPORT float PxJoint_getInvInertiaScale1(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getInvInertiaScale1(); + return return_val; + } + + DLLEXPORT physx_PxConstraint* PxJoint_getConstraint(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxConstraint* return_val = self_->getConstraint(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxJoint_setName_mut(physx_PxJoint* self__pod, char const* name) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->setName(name); + } + + DLLEXPORT char const* PxJoint_getName(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getName(); + return return_val; + } + + DLLEXPORT void PxJoint_release_mut(physx_PxJoint* self__pod) { + physx::PxJoint* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxScene* PxJoint_getScene(physx_PxJoint const* self__pod) { + physx::PxJoint const* self_ = reinterpret_cast(self__pod); + physx::PxScene* return_val = self_->getScene(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxJoint_getBinaryMetaData(physx_PxOutputStream* stream_pod) { + physx::PxOutputStream& stream = reinterpret_cast(*stream_pod); + PxJoint::getBinaryMetaData(stream); + } + + DLLEXPORT physx_PxSpring PxSpring_new(float stiffness_, float damping_) { + PxSpring return_val(stiffness_, damping_); + physx_PxSpring return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void phys_PxSetJointGlobalFrame(physx_PxJoint* joint_pod, physx_PxVec3 const* wsAnchor_pod, physx_PxVec3 const* wsAxis_pod) { + physx::PxJoint& joint = reinterpret_cast(*joint_pod); + physx::PxVec3 const* wsAnchor = reinterpret_cast(wsAnchor_pod); + physx::PxVec3 const* wsAxis = reinterpret_cast(wsAxis_pod); + PxSetJointGlobalFrame(joint, wsAnchor, wsAxis); + } + + DLLEXPORT physx_PxDistanceJoint* phys_PxDistanceJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxDistanceJoint* return_val = PxDistanceJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT float PxDistanceJoint_getDistance(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDistance(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setMinDistance_mut(physx_PxDistanceJoint* self__pod, float distance) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setMinDistance(distance); + } + + DLLEXPORT float PxDistanceJoint_getMinDistance(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMinDistance(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setMaxDistance_mut(physx_PxDistanceJoint* self__pod, float distance) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setMaxDistance(distance); + } + + DLLEXPORT float PxDistanceJoint_getMaxDistance(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getMaxDistance(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setTolerance_mut(physx_PxDistanceJoint* self__pod, float tolerance) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setTolerance(tolerance); + } + + DLLEXPORT float PxDistanceJoint_getTolerance(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getTolerance(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setStiffness_mut(physx_PxDistanceJoint* self__pod, float stiffness) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setStiffness(stiffness); + } + + DLLEXPORT float PxDistanceJoint_getStiffness(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getStiffness(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setDamping_mut(physx_PxDistanceJoint* self__pod, float damping) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setDamping(damping); + } + + DLLEXPORT float PxDistanceJoint_getDamping(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDamping(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setContactDistance_mut(physx_PxDistanceJoint* self__pod, float contactDistance) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + self_->setContactDistance(contactDistance); + } + + DLLEXPORT float PxDistanceJoint_getContactDistance(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getContactDistance(); + return return_val; + } + + DLLEXPORT void PxDistanceJoint_setDistanceJointFlags_mut(physx_PxDistanceJoint* self__pod, uint16_t flags_pod) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxDistanceJointFlags(flags_pod); + self_->setDistanceJointFlags(flags); + } + + DLLEXPORT void PxDistanceJoint_setDistanceJointFlag_mut(physx_PxDistanceJoint* self__pod, int32_t flag_pod, bool value) { + physx::PxDistanceJoint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setDistanceJointFlag(flag, value); + } + + DLLEXPORT uint16_t PxDistanceJoint_getDistanceJointFlags(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + physx::PxDistanceJointFlags return_val = self_->getDistanceJointFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxDistanceJoint_getConcreteTypeName(physx_PxDistanceJoint const* self__pod) { + physx::PxDistanceJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxContactJoint* phys_PxContactJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxContactJoint* return_val = PxContactJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxJacobianRow PxJacobianRow_new() { + PxJacobianRow return_val; + physx_PxJacobianRow return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJacobianRow PxJacobianRow_new_1(physx_PxVec3 const* lin0_pod, physx_PxVec3 const* lin1_pod, physx_PxVec3 const* ang0_pod, physx_PxVec3 const* ang1_pod) { + physx::PxVec3 const& lin0 = reinterpret_cast(*lin0_pod); + physx::PxVec3 const& lin1 = reinterpret_cast(*lin1_pod); + physx::PxVec3 const& ang0 = reinterpret_cast(*ang0_pod); + physx::PxVec3 const& ang1 = reinterpret_cast(*ang1_pod); + PxJacobianRow return_val(lin0, lin1, ang0, ang1); + physx_PxJacobianRow return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxContactJoint_setContact_mut(physx_PxContactJoint* self__pod, physx_PxVec3 const* contact_pod) { + physx::PxContactJoint* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& contact = reinterpret_cast(*contact_pod); + self_->setContact(contact); + } + + DLLEXPORT void PxContactJoint_setContactNormal_mut(physx_PxContactJoint* self__pod, physx_PxVec3 const* contactNormal_pod) { + physx::PxContactJoint* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& contactNormal = reinterpret_cast(*contactNormal_pod); + self_->setContactNormal(contactNormal); + } + + DLLEXPORT void PxContactJoint_setPenetration_mut(physx_PxContactJoint* self__pod, float penetration) { + physx::PxContactJoint* self_ = reinterpret_cast(self__pod); + self_->setPenetration(penetration); + } + + DLLEXPORT physx_PxVec3 PxContactJoint_getContact(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getContact(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxContactJoint_getContactNormal(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3 return_val = self_->getContactNormal(); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxContactJoint_getPenetration(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getPenetration(); + return return_val; + } + + DLLEXPORT float PxContactJoint_getRestitution(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRestitution(); + return return_val; + } + + DLLEXPORT void PxContactJoint_setRestitution_mut(physx_PxContactJoint* self__pod, float restitution) { + physx::PxContactJoint* self_ = reinterpret_cast(self__pod); + self_->setRestitution(restitution); + } + + DLLEXPORT float PxContactJoint_getBounceThreshold(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getBounceThreshold(); + return return_val; + } + + DLLEXPORT void PxContactJoint_setBounceThreshold_mut(physx_PxContactJoint* self__pod, float bounceThreshold) { + physx::PxContactJoint* self_ = reinterpret_cast(self__pod); + self_->setBounceThreshold(bounceThreshold); + } + + DLLEXPORT char const* PxContactJoint_getConcreteTypeName(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT void PxContactJoint_computeJacobians(physx_PxContactJoint const* self__pod, physx_PxJacobianRow* jacobian_pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + physx::PxJacobianRow* jacobian = reinterpret_cast(jacobian_pod); + self_->computeJacobians(jacobian); + } + + DLLEXPORT uint32_t PxContactJoint_getNbJacobianRows(physx_PxContactJoint const* self__pod) { + physx::PxContactJoint const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbJacobianRows(); + return return_val; + } + + DLLEXPORT physx_PxFixedJoint* phys_PxFixedJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxFixedJoint* return_val = PxFixedJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT char const* PxFixedJoint_getConcreteTypeName(physx_PxFixedJoint const* self__pod) { + physx::PxFixedJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxJointLimitParameters* PxJointLimitParameters_new_alloc() { + auto return_val = new physx::PxJointLimitParameters(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxJointLimitParameters_isValid(physx_PxJointLimitParameters const* self__pod) { + physx::PxJointLimitParameters const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT bool PxJointLimitParameters_isSoft(physx_PxJointLimitParameters const* self__pod) { + physx::PxJointLimitParameters const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isSoft(); + return return_val; + } + + DLLEXPORT physx_PxJointLinearLimit PxJointLinearLimit_new(physx_PxTolerancesScale const* scale_pod, float extent, float contactDist_deprecated) { + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + PxJointLinearLimit return_val(scale, extent, contactDist_deprecated); + physx_PxJointLinearLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJointLinearLimit PxJointLinearLimit_new_1(float extent, physx_PxSpring const* spring_pod) { + physx::PxSpring const& spring = reinterpret_cast(*spring_pod); + PxJointLinearLimit return_val(extent, spring); + physx_PxJointLinearLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxJointLinearLimit_isValid(physx_PxJointLinearLimit const* self__pod) { + physx::PxJointLinearLimit const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxJointLinearLimit_delete(physx_PxJointLinearLimit* self__pod) { + physx::PxJointLinearLimit* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxJointLinearLimitPair PxJointLinearLimitPair_new(physx_PxTolerancesScale const* scale_pod, float lowerLimit, float upperLimit, float contactDist_deprecated) { + physx::PxTolerancesScale const& scale = reinterpret_cast(*scale_pod); + PxJointLinearLimitPair return_val(scale, lowerLimit, upperLimit, contactDist_deprecated); + physx_PxJointLinearLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJointLinearLimitPair PxJointLinearLimitPair_new_1(float lowerLimit, float upperLimit, physx_PxSpring const* spring_pod) { + physx::PxSpring const& spring = reinterpret_cast(*spring_pod); + PxJointLinearLimitPair return_val(lowerLimit, upperLimit, spring); + physx_PxJointLinearLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxJointLinearLimitPair_isValid(physx_PxJointLinearLimitPair const* self__pod) { + physx::PxJointLinearLimitPair const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxJointLinearLimitPair_delete(physx_PxJointLinearLimitPair* self__pod) { + physx::PxJointLinearLimitPair* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxJointAngularLimitPair PxJointAngularLimitPair_new(float lowerLimit, float upperLimit, float contactDist_deprecated) { + PxJointAngularLimitPair return_val(lowerLimit, upperLimit, contactDist_deprecated); + physx_PxJointAngularLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJointAngularLimitPair PxJointAngularLimitPair_new_1(float lowerLimit, float upperLimit, physx_PxSpring const* spring_pod) { + physx::PxSpring const& spring = reinterpret_cast(*spring_pod); + PxJointAngularLimitPair return_val(lowerLimit, upperLimit, spring); + physx_PxJointAngularLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxJointAngularLimitPair_isValid(physx_PxJointAngularLimitPair const* self__pod) { + physx::PxJointAngularLimitPair const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxJointAngularLimitPair_delete(physx_PxJointAngularLimitPair* self__pod) { + physx::PxJointAngularLimitPair* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxJointLimitCone PxJointLimitCone_new(float yLimitAngle, float zLimitAngle, float contactDist_deprecated) { + PxJointLimitCone return_val(yLimitAngle, zLimitAngle, contactDist_deprecated); + physx_PxJointLimitCone return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJointLimitCone PxJointLimitCone_new_1(float yLimitAngle, float zLimitAngle, physx_PxSpring const* spring_pod) { + physx::PxSpring const& spring = reinterpret_cast(*spring_pod); + PxJointLimitCone return_val(yLimitAngle, zLimitAngle, spring); + physx_PxJointLimitCone return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxJointLimitCone_isValid(physx_PxJointLimitCone const* self__pod) { + physx::PxJointLimitCone const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxJointLimitCone_delete(physx_PxJointLimitCone* self__pod) { + physx::PxJointLimitCone* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxJointLimitPyramid PxJointLimitPyramid_new(float yLimitAngleMin, float yLimitAngleMax, float zLimitAngleMin, float zLimitAngleMax, float contactDist_deprecated) { + PxJointLimitPyramid return_val(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, contactDist_deprecated); + physx_PxJointLimitPyramid return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxJointLimitPyramid PxJointLimitPyramid_new_1(float yLimitAngleMin, float yLimitAngleMax, float zLimitAngleMin, float zLimitAngleMax, physx_PxSpring const* spring_pod) { + physx::PxSpring const& spring = reinterpret_cast(*spring_pod); + PxJointLimitPyramid return_val(yLimitAngleMin, yLimitAngleMax, zLimitAngleMin, zLimitAngleMax, spring); + physx_PxJointLimitPyramid return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxJointLimitPyramid_isValid(physx_PxJointLimitPyramid const* self__pod) { + physx::PxJointLimitPyramid const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxJointLimitPyramid_delete(physx_PxJointLimitPyramid* self__pod) { + physx::PxJointLimitPyramid* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxPrismaticJoint* phys_PxPrismaticJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxPrismaticJoint* return_val = PxPrismaticJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT float PxPrismaticJoint_getPosition(physx_PxPrismaticJoint const* self__pod) { + physx::PxPrismaticJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getPosition(); + return return_val; + } + + DLLEXPORT float PxPrismaticJoint_getVelocity(physx_PxPrismaticJoint const* self__pod) { + physx::PxPrismaticJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getVelocity(); + return return_val; + } + + DLLEXPORT void PxPrismaticJoint_setLimit_mut(physx_PxPrismaticJoint* self__pod, physx_PxJointLinearLimitPair const* anon_param0_pod) { + physx::PxPrismaticJoint* self_ = reinterpret_cast(self__pod); + physx::PxJointLinearLimitPair const& anon_param0 = reinterpret_cast(*anon_param0_pod); + self_->setLimit(anon_param0); + } + + DLLEXPORT physx_PxJointLinearLimitPair PxPrismaticJoint_getLimit(physx_PxPrismaticJoint const* self__pod) { + physx::PxPrismaticJoint const* self_ = reinterpret_cast(self__pod); + physx::PxJointLinearLimitPair return_val = self_->getLimit(); + physx_PxJointLinearLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPrismaticJoint_setPrismaticJointFlags_mut(physx_PxPrismaticJoint* self__pod, uint16_t flags_pod) { + physx::PxPrismaticJoint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxPrismaticJointFlags(flags_pod); + self_->setPrismaticJointFlags(flags); + } + + DLLEXPORT void PxPrismaticJoint_setPrismaticJointFlag_mut(physx_PxPrismaticJoint* self__pod, int32_t flag_pod, bool value) { + physx::PxPrismaticJoint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setPrismaticJointFlag(flag, value); + } + + DLLEXPORT uint16_t PxPrismaticJoint_getPrismaticJointFlags(physx_PxPrismaticJoint const* self__pod) { + physx::PxPrismaticJoint const* self_ = reinterpret_cast(self__pod); + physx::PxPrismaticJointFlags return_val = self_->getPrismaticJointFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxPrismaticJoint_getConcreteTypeName(physx_PxPrismaticJoint const* self__pod) { + physx::PxPrismaticJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxRevoluteJoint* phys_PxRevoluteJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxRevoluteJoint* return_val = PxRevoluteJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT float PxRevoluteJoint_getAngle(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getAngle(); + return return_val; + } + + DLLEXPORT float PxRevoluteJoint_getVelocity(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getVelocity(); + return return_val; + } + + DLLEXPORT void PxRevoluteJoint_setLimit_mut(physx_PxRevoluteJoint* self__pod, physx_PxJointAngularLimitPair const* limits_pod) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + physx::PxJointAngularLimitPair const& limits = reinterpret_cast(*limits_pod); + self_->setLimit(limits); + } + + DLLEXPORT physx_PxJointAngularLimitPair PxRevoluteJoint_getLimit(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + physx::PxJointAngularLimitPair return_val = self_->getLimit(); + physx_PxJointAngularLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRevoluteJoint_setDriveVelocity_mut(physx_PxRevoluteJoint* self__pod, float velocity, bool autowake) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + self_->setDriveVelocity(velocity, autowake); + } + + DLLEXPORT float PxRevoluteJoint_getDriveVelocity(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDriveVelocity(); + return return_val; + } + + DLLEXPORT void PxRevoluteJoint_setDriveForceLimit_mut(physx_PxRevoluteJoint* self__pod, float limit) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + self_->setDriveForceLimit(limit); + } + + DLLEXPORT float PxRevoluteJoint_getDriveForceLimit(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDriveForceLimit(); + return return_val; + } + + DLLEXPORT void PxRevoluteJoint_setDriveGearRatio_mut(physx_PxRevoluteJoint* self__pod, float ratio) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + self_->setDriveGearRatio(ratio); + } + + DLLEXPORT float PxRevoluteJoint_getDriveGearRatio(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getDriveGearRatio(); + return return_val; + } + + DLLEXPORT void PxRevoluteJoint_setRevoluteJointFlags_mut(physx_PxRevoluteJoint* self__pod, uint16_t flags_pod) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxRevoluteJointFlags(flags_pod); + self_->setRevoluteJointFlags(flags); + } + + DLLEXPORT void PxRevoluteJoint_setRevoluteJointFlag_mut(physx_PxRevoluteJoint* self__pod, int32_t flag_pod, bool value) { + physx::PxRevoluteJoint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setRevoluteJointFlag(flag, value); + } + + DLLEXPORT uint16_t PxRevoluteJoint_getRevoluteJointFlags(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + physx::PxRevoluteJointFlags return_val = self_->getRevoluteJointFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxRevoluteJoint_getConcreteTypeName(physx_PxRevoluteJoint const* self__pod) { + physx::PxRevoluteJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxSphericalJoint* phys_PxSphericalJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxSphericalJoint* return_val = PxSphericalJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxJointLimitCone PxSphericalJoint_getLimitCone(physx_PxSphericalJoint const* self__pod) { + physx::PxSphericalJoint const* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitCone return_val = self_->getLimitCone(); + physx_PxJointLimitCone return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxSphericalJoint_setLimitCone_mut(physx_PxSphericalJoint* self__pod, physx_PxJointLimitCone const* limit_pod) { + physx::PxSphericalJoint* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitCone const& limit = reinterpret_cast(*limit_pod); + self_->setLimitCone(limit); + } + + DLLEXPORT float PxSphericalJoint_getSwingYAngle(physx_PxSphericalJoint const* self__pod) { + physx::PxSphericalJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSwingYAngle(); + return return_val; + } + + DLLEXPORT float PxSphericalJoint_getSwingZAngle(physx_PxSphericalJoint const* self__pod) { + physx::PxSphericalJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSwingZAngle(); + return return_val; + } + + DLLEXPORT void PxSphericalJoint_setSphericalJointFlags_mut(physx_PxSphericalJoint* self__pod, uint16_t flags_pod) { + physx::PxSphericalJoint* self_ = reinterpret_cast(self__pod); + auto flags = physx::PxSphericalJointFlags(flags_pod); + self_->setSphericalJointFlags(flags); + } + + DLLEXPORT void PxSphericalJoint_setSphericalJointFlag_mut(physx_PxSphericalJoint* self__pod, int32_t flag_pod, bool value) { + physx::PxSphericalJoint* self_ = reinterpret_cast(self__pod); + auto flag = static_cast(flag_pod); + self_->setSphericalJointFlag(flag, value); + } + + DLLEXPORT uint16_t PxSphericalJoint_getSphericalJointFlags(physx_PxSphericalJoint const* self__pod) { + physx::PxSphericalJoint const* self_ = reinterpret_cast(self__pod); + physx::PxSphericalJointFlags return_val = self_->getSphericalJointFlags(); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxSphericalJoint_getConcreteTypeName(physx_PxSphericalJoint const* self__pod) { + physx::PxSphericalJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxD6Joint* phys_PxD6JointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxD6Joint* return_val = PxD6JointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxD6JointDrive PxD6JointDrive_new() { + PxD6JointDrive return_val; + physx_PxD6JointDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxD6JointDrive PxD6JointDrive_new_1(float driveStiffness, float driveDamping, float driveForceLimit, bool isAcceleration) { + PxD6JointDrive return_val(driveStiffness, driveDamping, driveForceLimit, isAcceleration); + physx_PxD6JointDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxD6JointDrive_isValid(physx_PxD6JointDrive const* self__pod) { + physx::PxD6JointDrive const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT void PxD6Joint_setMotion_mut(physx_PxD6Joint* self__pod, int32_t axis_pod, int32_t type_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + auto type = static_cast(type_pod); + self_->setMotion(axis, type); + } + + DLLEXPORT int32_t PxD6Joint_getMotion(physx_PxD6Joint const* self__pod, int32_t axis_pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxD6Motion::Enum return_val = self_->getMotion(axis); + int32_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT float PxD6Joint_getTwistAngle(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getTwistAngle(); + return return_val; + } + + DLLEXPORT float PxD6Joint_getSwingYAngle(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSwingYAngle(); + return return_val; + } + + DLLEXPORT float PxD6Joint_getSwingZAngle(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getSwingZAngle(); + return return_val; + } + + DLLEXPORT void PxD6Joint_setDistanceLimit_mut(physx_PxD6Joint* self__pod, physx_PxJointLinearLimit const* limit_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxJointLinearLimit const& limit = reinterpret_cast(*limit_pod); + self_->setDistanceLimit(limit); + } + + DLLEXPORT physx_PxJointLinearLimit PxD6Joint_getDistanceLimit(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxJointLinearLimit return_val = self_->getDistanceLimit(); + physx_PxJointLinearLimit return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setLinearLimit_mut(physx_PxD6Joint* self__pod, int32_t axis_pod, physx_PxJointLinearLimitPair const* limit_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxJointLinearLimitPair const& limit = reinterpret_cast(*limit_pod); + self_->setLinearLimit(axis, limit); + } + + DLLEXPORT physx_PxJointLinearLimitPair PxD6Joint_getLinearLimit(physx_PxD6Joint const* self__pod, int32_t axis_pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + auto axis = static_cast(axis_pod); + physx::PxJointLinearLimitPair return_val = self_->getLinearLimit(axis); + physx_PxJointLinearLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setTwistLimit_mut(physx_PxD6Joint* self__pod, physx_PxJointAngularLimitPair const* limit_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxJointAngularLimitPair const& limit = reinterpret_cast(*limit_pod); + self_->setTwistLimit(limit); + } + + DLLEXPORT physx_PxJointAngularLimitPair PxD6Joint_getTwistLimit(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxJointAngularLimitPair return_val = self_->getTwistLimit(); + physx_PxJointAngularLimitPair return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setSwingLimit_mut(physx_PxD6Joint* self__pod, physx_PxJointLimitCone const* limit_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitCone const& limit = reinterpret_cast(*limit_pod); + self_->setSwingLimit(limit); + } + + DLLEXPORT physx_PxJointLimitCone PxD6Joint_getSwingLimit(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitCone return_val = self_->getSwingLimit(); + physx_PxJointLimitCone return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setPyramidSwingLimit_mut(physx_PxD6Joint* self__pod, physx_PxJointLimitPyramid const* limit_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitPyramid const& limit = reinterpret_cast(*limit_pod); + self_->setPyramidSwingLimit(limit); + } + + DLLEXPORT physx_PxJointLimitPyramid PxD6Joint_getPyramidSwingLimit(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxJointLimitPyramid return_val = self_->getPyramidSwingLimit(); + physx_PxJointLimitPyramid return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setDrive_mut(physx_PxD6Joint* self__pod, int32_t index_pod, physx_PxD6JointDrive const* drive_pod) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + auto index = static_cast(index_pod); + physx::PxD6JointDrive const& drive = reinterpret_cast(*drive_pod); + self_->setDrive(index, drive); + } + + DLLEXPORT physx_PxD6JointDrive PxD6Joint_getDrive(physx_PxD6Joint const* self__pod, int32_t index_pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + auto index = static_cast(index_pod); + physx::PxD6JointDrive return_val = self_->getDrive(index); + physx_PxD6JointDrive return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setDrivePosition_mut(physx_PxD6Joint* self__pod, physx_PxTransform const* pose_pod, bool autowake) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + self_->setDrivePosition(pose, autowake); + } + + DLLEXPORT physx_PxTransform PxD6Joint_getDrivePosition(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxTransform return_val = self_->getDrivePosition(); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxD6Joint_setDriveVelocity_mut(physx_PxD6Joint* self__pod, physx_PxVec3 const* linear_pod, physx_PxVec3 const* angular_pod, bool autowake) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& linear = reinterpret_cast(*linear_pod); + physx::PxVec3 const& angular = reinterpret_cast(*angular_pod); + self_->setDriveVelocity(linear, angular, autowake); + } + + DLLEXPORT void PxD6Joint_getDriveVelocity(physx_PxD6Joint const* self__pod, physx_PxVec3* linear_pod, physx_PxVec3* angular_pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + physx::PxVec3& linear = reinterpret_cast(*linear_pod); + physx::PxVec3& angular = reinterpret_cast(*angular_pod); + self_->getDriveVelocity(linear, angular); + } + + DLLEXPORT void PxD6Joint_setProjectionLinearTolerance_mut(physx_PxD6Joint* self__pod, float tolerance) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + self_->setProjectionLinearTolerance(tolerance); + } + + DLLEXPORT float PxD6Joint_getProjectionLinearTolerance(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getProjectionLinearTolerance(); + return return_val; + } + + DLLEXPORT void PxD6Joint_setProjectionAngularTolerance_mut(physx_PxD6Joint* self__pod, float tolerance) { + physx::PxD6Joint* self_ = reinterpret_cast(self__pod); + self_->setProjectionAngularTolerance(tolerance); + } + + DLLEXPORT float PxD6Joint_getProjectionAngularTolerance(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getProjectionAngularTolerance(); + return return_val; + } + + DLLEXPORT char const* PxD6Joint_getConcreteTypeName(physx_PxD6Joint const* self__pod) { + physx::PxD6Joint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxGearJoint* phys_PxGearJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxGearJoint* return_val = PxGearJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxGearJoint_setHinges_mut(physx_PxGearJoint* self__pod, physx_PxBase const* hinge0_pod, physx_PxBase const* hinge1_pod) { + physx::PxGearJoint* self_ = reinterpret_cast(self__pod); + physx::PxBase const* hinge0 = reinterpret_cast(hinge0_pod); + physx::PxBase const* hinge1 = reinterpret_cast(hinge1_pod); + bool return_val = self_->setHinges(hinge0, hinge1); + return return_val; + } + + DLLEXPORT void PxGearJoint_setGearRatio_mut(physx_PxGearJoint* self__pod, float ratio) { + physx::PxGearJoint* self_ = reinterpret_cast(self__pod); + self_->setGearRatio(ratio); + } + + DLLEXPORT float PxGearJoint_getGearRatio(physx_PxGearJoint const* self__pod) { + physx::PxGearJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getGearRatio(); + return return_val; + } + + DLLEXPORT char const* PxGearJoint_getConcreteTypeName(physx_PxGearJoint const* self__pod) { + physx::PxGearJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxRackAndPinionJoint* phys_PxRackAndPinionJointCreate(physx_PxPhysics* physics_pod, physx_PxRigidActor* actor0_pod, physx_PxTransform const* localFrame0_pod, physx_PxRigidActor* actor1_pod, physx_PxTransform const* localFrame1_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor* actor0 = reinterpret_cast(actor0_pod); + physx::PxTransform const& localFrame0 = reinterpret_cast(*localFrame0_pod); + physx::PxRigidActor* actor1 = reinterpret_cast(actor1_pod); + physx::PxTransform const& localFrame1 = reinterpret_cast(*localFrame1_pod); + physx::PxRackAndPinionJoint* return_val = PxRackAndPinionJointCreate(physics, actor0, localFrame0, actor1, localFrame1); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxRackAndPinionJoint_setJoints_mut(physx_PxRackAndPinionJoint* self__pod, physx_PxBase const* hinge_pod, physx_PxBase const* prismatic_pod) { + physx::PxRackAndPinionJoint* self_ = reinterpret_cast(self__pod); + physx::PxBase const* hinge = reinterpret_cast(hinge_pod); + physx::PxBase const* prismatic = reinterpret_cast(prismatic_pod); + bool return_val = self_->setJoints(hinge, prismatic); + return return_val; + } + + DLLEXPORT void PxRackAndPinionJoint_setRatio_mut(physx_PxRackAndPinionJoint* self__pod, float ratio) { + physx::PxRackAndPinionJoint* self_ = reinterpret_cast(self__pod); + self_->setRatio(ratio); + } + + DLLEXPORT float PxRackAndPinionJoint_getRatio(physx_PxRackAndPinionJoint const* self__pod) { + physx::PxRackAndPinionJoint const* self_ = reinterpret_cast(self__pod); + float return_val = self_->getRatio(); + return return_val; + } + + DLLEXPORT bool PxRackAndPinionJoint_setData_mut(physx_PxRackAndPinionJoint* self__pod, uint32_t nbRackTeeth, uint32_t nbPinionTeeth, float rackLength) { + physx::PxRackAndPinionJoint* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setData(nbRackTeeth, nbPinionTeeth, rackLength); + return return_val; + } + + DLLEXPORT char const* PxRackAndPinionJoint_getConcreteTypeName(physx_PxRackAndPinionJoint const* self__pod) { + physx::PxRackAndPinionJoint const* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getConcreteTypeName(); + return return_val; + } + + DLLEXPORT physx_PxGroupsMask* PxGroupsMask_new_alloc() { + auto return_val = new physx::PxGroupsMask(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxGroupsMask_delete(physx_PxGroupsMask* self__pod) { + physx::PxGroupsMask* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint16_t phys_PxDefaultSimulationFilterShader(uint32_t attributes0, physx_PxFilterData filterData0_pod, uint32_t attributes1, physx_PxFilterData filterData1_pod, uint16_t* pairFlags_pod, void const* constantBlock, uint32_t constantBlockSize) { + physx::PxFilterData filterData0; + memcpy(&filterData0, &filterData0_pod, sizeof(filterData0)); + physx::PxFilterData filterData1; + memcpy(&filterData1, &filterData1_pod, sizeof(filterData1)); + physx::PxPairFlags& pairFlags = reinterpret_cast(*pairFlags_pod); + physx::PxFilterFlags return_val = PxDefaultSimulationFilterShader(attributes0, filterData0, attributes1, filterData1, pairFlags, constantBlock, constantBlockSize); + uint16_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool phys_PxGetGroupCollisionFlag(uint16_t group1, uint16_t group2) { + bool return_val = PxGetGroupCollisionFlag(group1, group2); + return return_val; + } + + DLLEXPORT void phys_PxSetGroupCollisionFlag(uint16_t group1, uint16_t group2, bool enable) { + PxSetGroupCollisionFlag(group1, group2, enable); + } + + DLLEXPORT uint16_t phys_PxGetGroup(physx_PxActor const* actor_pod) { + physx::PxActor const& actor = reinterpret_cast(*actor_pod); + uint16_t return_val = PxGetGroup(actor); + return return_val; + } + + DLLEXPORT void phys_PxSetGroup(physx_PxActor* actor_pod, uint16_t collisionGroup) { + physx::PxActor& actor = reinterpret_cast(*actor_pod); + PxSetGroup(actor, collisionGroup); + } + + DLLEXPORT void phys_PxGetFilterOps(int32_t* op0_pod, int32_t* op1_pod, int32_t* op2_pod) { + physx::PxFilterOp::Enum& op0 = reinterpret_cast(*op0_pod); + physx::PxFilterOp::Enum& op1 = reinterpret_cast(*op1_pod); + physx::PxFilterOp::Enum& op2 = reinterpret_cast(*op2_pod); + PxGetFilterOps(op0, op1, op2); + } + + DLLEXPORT void phys_PxSetFilterOps(int32_t const* op0_pod, int32_t const* op1_pod, int32_t const* op2_pod) { + physx::PxFilterOp::Enum const& op0 = reinterpret_cast(*op0_pod); + physx::PxFilterOp::Enum const& op1 = reinterpret_cast(*op1_pod); + physx::PxFilterOp::Enum const& op2 = reinterpret_cast(*op2_pod); + PxSetFilterOps(op0, op1, op2); + } + + DLLEXPORT bool phys_PxGetFilterBool() { + bool return_val = PxGetFilterBool(); + return return_val; + } + + DLLEXPORT void phys_PxSetFilterBool(bool enable) { + PxSetFilterBool(enable); + } + + DLLEXPORT void phys_PxGetFilterConstants(physx_PxGroupsMask* c0_pod, physx_PxGroupsMask* c1_pod) { + physx::PxGroupsMask& c0 = reinterpret_cast(*c0_pod); + physx::PxGroupsMask& c1 = reinterpret_cast(*c1_pod); + PxGetFilterConstants(c0, c1); + } + + DLLEXPORT void phys_PxSetFilterConstants(physx_PxGroupsMask const* c0_pod, physx_PxGroupsMask const* c1_pod) { + physx::PxGroupsMask const& c0 = reinterpret_cast(*c0_pod); + physx::PxGroupsMask const& c1 = reinterpret_cast(*c1_pod); + PxSetFilterConstants(c0, c1); + } + + DLLEXPORT physx_PxGroupsMask phys_PxGetGroupsMask(physx_PxActor const* actor_pod) { + physx::PxActor const& actor = reinterpret_cast(*actor_pod); + physx::PxGroupsMask return_val = PxGetGroupsMask(actor); + physx_PxGroupsMask return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void phys_PxSetGroupsMask(physx_PxActor* actor_pod, physx_PxGroupsMask const* mask_pod) { + physx::PxActor& actor = reinterpret_cast(*actor_pod); + physx::PxGroupsMask const& mask = reinterpret_cast(*mask_pod); + PxSetGroupsMask(actor, mask); + } + + DLLEXPORT physx_PxDefaultErrorCallback* PxDefaultErrorCallback_new_alloc() { + auto return_val = new physx::PxDefaultErrorCallback(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDefaultErrorCallback_delete(physx_PxDefaultErrorCallback* self__pod) { + physx::PxDefaultErrorCallback* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT void PxDefaultErrorCallback_reportError_mut(physx_PxDefaultErrorCallback* self__pod, int32_t code_pod, char const* message, char const* file, int32_t line) { + physx::PxDefaultErrorCallback* self_ = reinterpret_cast(self__pod); + auto code = static_cast(code_pod); + self_->reportError(code, message, file, line); + } + + DLLEXPORT physx_PxShape* PxRigidActorExt_createExclusiveShape(physx_PxRigidActor* actor_pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial* const* materials_pod, uint16_t materialCount, uint8_t shapeFlags_pod) { + physx::PxRigidActor& actor = reinterpret_cast(*actor_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial* const* materials = reinterpret_cast(materials_pod); + auto shapeFlags = physx::PxShapeFlags(shapeFlags_pod); + physx::PxShape* return_val = PxRigidActorExt::createExclusiveShape(actor, geometry, materials, materialCount, shapeFlags); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxShape* PxRigidActorExt_createExclusiveShape_1(physx_PxRigidActor* actor_pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial const* material_pod, uint8_t shapeFlags_pod) { + physx::PxRigidActor& actor = reinterpret_cast(*actor_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial const& material = reinterpret_cast(*material_pod); + auto shapeFlags = physx::PxShapeFlags(shapeFlags_pod); + physx::PxShape* return_val = PxRigidActorExt::createExclusiveShape(actor, geometry, material, shapeFlags); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBounds3* PxRigidActorExt_getRigidActorShapeLocalBoundsList(physx_PxRigidActor const* actor_pod, uint32_t* numBounds_pod) { + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + uint32_t& numBounds = *numBounds_pod; + physx::PxBounds3* return_val = PxRigidActorExt::getRigidActorShapeLocalBoundsList(actor, numBounds); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBVH* PxRigidActorExt_createBVHFromActor(physx_PxPhysics* physics_pod, physx_PxRigidActor const* actor_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxBVH* return_val = PxRigidActorExt::createBVHFromActor(physics, actor); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxMassProperties PxMassProperties_new() { + PxMassProperties return_val; + physx_PxMassProperties return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMassProperties PxMassProperties_new_1(float m, physx_PxMat33 const* inertiaT_pod, physx_PxVec3 const* com_pod) { + physx::PxMat33 const& inertiaT = reinterpret_cast(*inertiaT_pod); + physx::PxVec3 const& com = reinterpret_cast(*com_pod); + PxMassProperties return_val(m, inertiaT, com); + physx_PxMassProperties return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMassProperties PxMassProperties_new_2(physx_PxGeometry const* geometry_pod) { + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + PxMassProperties return_val(geometry); + physx_PxMassProperties return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxMassProperties_translate_mut(physx_PxMassProperties* self__pod, physx_PxVec3 const* t_pod) { + physx::PxMassProperties* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& t = reinterpret_cast(*t_pod); + self_->translate(t); + } + + DLLEXPORT physx_PxVec3 PxMassProperties_getMassSpaceInertia(physx_PxMat33 const* inertia_pod, physx_PxQuat* massFrame_pod) { + physx::PxMat33 const& inertia = reinterpret_cast(*inertia_pod); + physx::PxQuat& massFrame = reinterpret_cast(*massFrame_pod); + physx::PxVec3 return_val = PxMassProperties::getMassSpaceInertia(inertia, massFrame); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMassProperties_translateInertia(physx_PxMat33 const* inertia_pod, float mass, physx_PxVec3 const* t_pod) { + physx::PxMat33 const& inertia = reinterpret_cast(*inertia_pod); + physx::PxVec3 const& t = reinterpret_cast(*t_pod); + physx::PxMat33 return_val = PxMassProperties::translateInertia(inertia, mass, t); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMassProperties_rotateInertia(physx_PxMat33 const* inertia_pod, physx_PxQuat const* q_pod) { + physx::PxMat33 const& inertia = reinterpret_cast(*inertia_pod); + physx::PxQuat const& q = reinterpret_cast(*q_pod); + physx::PxMat33 return_val = PxMassProperties::rotateInertia(inertia, q); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMat33 PxMassProperties_scaleInertia(physx_PxMat33 const* inertia_pod, physx_PxQuat const* scaleRotation_pod, physx_PxVec3 const* scale_pod) { + physx::PxMat33 const& inertia = reinterpret_cast(*inertia_pod); + physx::PxQuat const& scaleRotation = reinterpret_cast(*scaleRotation_pod); + physx::PxVec3 const& scale = reinterpret_cast(*scale_pod); + physx::PxMat33 return_val = PxMassProperties::scaleInertia(inertia, scaleRotation, scale); + physx_PxMat33 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMassProperties PxMassProperties_sum(physx_PxMassProperties const* props_pod, physx_PxTransform const* transforms_pod, uint32_t count) { + physx::PxMassProperties const* props = reinterpret_cast(props_pod); + physx::PxTransform const* transforms = reinterpret_cast(transforms_pod); + physx::PxMassProperties return_val = PxMassProperties::sum(props, transforms, count); + physx_PxMassProperties return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxRigidBodyExt_updateMassAndInertia(physx_PxRigidBody* body_pod, float const* shapeDensities, uint32_t shapeDensityCount, physx_PxVec3 const* massLocalPose_pod, bool includeNonSimShapes) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const* massLocalPose = reinterpret_cast(massLocalPose_pod); + bool return_val = PxRigidBodyExt::updateMassAndInertia(body, shapeDensities, shapeDensityCount, massLocalPose, includeNonSimShapes); + return return_val; + } + + DLLEXPORT bool PxRigidBodyExt_updateMassAndInertia_1(physx_PxRigidBody* body_pod, float density, physx_PxVec3 const* massLocalPose_pod, bool includeNonSimShapes) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const* massLocalPose = reinterpret_cast(massLocalPose_pod); + bool return_val = PxRigidBodyExt::updateMassAndInertia(body, density, massLocalPose, includeNonSimShapes); + return return_val; + } + + DLLEXPORT bool PxRigidBodyExt_setMassAndUpdateInertia(physx_PxRigidBody* body_pod, float const* shapeMasses, uint32_t shapeMassCount, physx_PxVec3 const* massLocalPose_pod, bool includeNonSimShapes) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const* massLocalPose = reinterpret_cast(massLocalPose_pod); + bool return_val = PxRigidBodyExt::setMassAndUpdateInertia(body, shapeMasses, shapeMassCount, massLocalPose, includeNonSimShapes); + return return_val; + } + + DLLEXPORT bool PxRigidBodyExt_setMassAndUpdateInertia_1(physx_PxRigidBody* body_pod, float mass, physx_PxVec3 const* massLocalPose_pod, bool includeNonSimShapes) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const* massLocalPose = reinterpret_cast(massLocalPose_pod); + bool return_val = PxRigidBodyExt::setMassAndUpdateInertia(body, mass, massLocalPose, includeNonSimShapes); + return return_val; + } + + DLLEXPORT physx_PxMassProperties PxRigidBodyExt_computeMassPropertiesFromShapes(physx_PxShape const* const* shapes_pod, uint32_t shapeCount) { + physx::PxShape const* const* shapes = reinterpret_cast(shapes_pod); + physx::PxMassProperties return_val = PxRigidBodyExt::computeMassPropertiesFromShapes(shapes, shapeCount); + physx_PxMassProperties return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBodyExt_addForceAtPos(physx_PxRigidBody* body_pod, physx_PxVec3 const* force_pod, physx_PxVec3 const* pos_pod, int32_t mode_pod, bool wakeup) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + auto mode = static_cast(mode_pod); + PxRigidBodyExt::addForceAtPos(body, force, pos, mode, wakeup); + } + + DLLEXPORT void PxRigidBodyExt_addForceAtLocalPos(physx_PxRigidBody* body_pod, physx_PxVec3 const* force_pod, physx_PxVec3 const* pos_pod, int32_t mode_pod, bool wakeup) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + auto mode = static_cast(mode_pod); + PxRigidBodyExt::addForceAtLocalPos(body, force, pos, mode, wakeup); + } + + DLLEXPORT void PxRigidBodyExt_addLocalForceAtPos(physx_PxRigidBody* body_pod, physx_PxVec3 const* force_pod, physx_PxVec3 const* pos_pod, int32_t mode_pod, bool wakeup) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + auto mode = static_cast(mode_pod); + PxRigidBodyExt::addLocalForceAtPos(body, force, pos, mode, wakeup); + } + + DLLEXPORT void PxRigidBodyExt_addLocalForceAtLocalPos(physx_PxRigidBody* body_pod, physx_PxVec3 const* force_pod, physx_PxVec3 const* pos_pod, int32_t mode_pod, bool wakeup) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& force = reinterpret_cast(*force_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + auto mode = static_cast(mode_pod); + PxRigidBodyExt::addLocalForceAtLocalPos(body, force, pos, mode, wakeup); + } + + DLLEXPORT physx_PxVec3 PxRigidBodyExt_getVelocityAtPos(physx_PxRigidBody const* body_pod, physx_PxVec3 const* pos_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + physx::PxVec3 return_val = PxRigidBodyExt::getVelocityAtPos(body, pos); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxRigidBodyExt_getLocalVelocityAtLocalPos(physx_PxRigidBody const* body_pod, physx_PxVec3 const* pos_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + physx::PxVec3 return_val = PxRigidBodyExt::getLocalVelocityAtLocalPos(body, pos); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxVec3 PxRigidBodyExt_getVelocityAtOffset(physx_PxRigidBody const* body_pod, physx_PxVec3 const* pos_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& pos = reinterpret_cast(*pos_pod); + physx::PxVec3 return_val = PxRigidBodyExt::getVelocityAtOffset(body, pos); + physx_PxVec3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxRigidBodyExt_computeVelocityDeltaFromImpulse(physx_PxRigidBody const* body_pod, physx_PxVec3 const* impulsiveForce_pod, physx_PxVec3 const* impulsiveTorque_pod, physx_PxVec3* deltaLinearVelocity_pod, physx_PxVec3* deltaAngularVelocity_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxVec3 const& impulsiveForce = reinterpret_cast(*impulsiveForce_pod); + physx::PxVec3 const& impulsiveTorque = reinterpret_cast(*impulsiveTorque_pod); + physx::PxVec3& deltaLinearVelocity = reinterpret_cast(*deltaLinearVelocity_pod); + physx::PxVec3& deltaAngularVelocity = reinterpret_cast(*deltaAngularVelocity_pod); + PxRigidBodyExt::computeVelocityDeltaFromImpulse(body, impulsiveForce, impulsiveTorque, deltaLinearVelocity, deltaAngularVelocity); + } + + DLLEXPORT void PxRigidBodyExt_computeVelocityDeltaFromImpulse_1(physx_PxRigidBody const* body_pod, physx_PxTransform const* globalPose_pod, physx_PxVec3 const* point_pod, physx_PxVec3 const* impulse_pod, float invMassScale, float invInertiaScale, physx_PxVec3* deltaLinearVelocity_pod, physx_PxVec3* deltaAngularVelocity_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxTransform const& globalPose = reinterpret_cast(*globalPose_pod); + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec3 const& impulse = reinterpret_cast(*impulse_pod); + physx::PxVec3& deltaLinearVelocity = reinterpret_cast(*deltaLinearVelocity_pod); + physx::PxVec3& deltaAngularVelocity = reinterpret_cast(*deltaAngularVelocity_pod); + PxRigidBodyExt::computeVelocityDeltaFromImpulse(body, globalPose, point, impulse, invMassScale, invInertiaScale, deltaLinearVelocity, deltaAngularVelocity); + } + + DLLEXPORT void PxRigidBodyExt_computeLinearAngularImpulse(physx_PxRigidBody const* body_pod, physx_PxTransform const* globalPose_pod, physx_PxVec3 const* point_pod, physx_PxVec3 const* impulse_pod, float invMassScale, float invInertiaScale, physx_PxVec3* linearImpulse_pod, physx_PxVec3* angularImpulse_pod) { + physx::PxRigidBody const& body = reinterpret_cast(*body_pod); + physx::PxTransform const& globalPose = reinterpret_cast(*globalPose_pod); + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec3 const& impulse = reinterpret_cast(*impulse_pod); + physx::PxVec3& linearImpulse = reinterpret_cast(*linearImpulse_pod); + physx::PxVec3& angularImpulse = reinterpret_cast(*angularImpulse_pod); + PxRigidBodyExt::computeLinearAngularImpulse(body, globalPose, point, impulse, invMassScale, invInertiaScale, linearImpulse, angularImpulse); + } + + DLLEXPORT bool PxRigidBodyExt_linearSweepSingle(physx_PxRigidBody* body_pod, physx_PxScene* scene_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxSweepHit* closestHit_pod, uint32_t* shapeIndex_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxScene& scene = reinterpret_cast(*scene_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxSweepHit& closestHit = reinterpret_cast(*closestHit_pod); + uint32_t& shapeIndex = *shapeIndex_pod; + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + bool return_val = PxRigidBodyExt::linearSweepSingle(body, scene, unitDir, distance, outputFlags, closestHit, shapeIndex, filterData, filterCall, cache, inflation); + return return_val; + } + + DLLEXPORT uint32_t PxRigidBodyExt_linearSweepMultiple(physx_PxRigidBody* body_pod, physx_PxScene* scene_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxSweepHit* touchHitBuffer_pod, uint32_t* touchHitShapeIndices, uint32_t touchHitBufferSize, physx_PxSweepHit* block_pod, int32_t* blockingShapeIndex_pod, bool* overflow_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxRigidBody& body = reinterpret_cast(*body_pod); + physx::PxScene& scene = reinterpret_cast(*scene_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxSweepHit* touchHitBuffer = reinterpret_cast(touchHitBuffer_pod); + physx::PxSweepHit& block = reinterpret_cast(*block_pod); + int32_t& blockingShapeIndex = *blockingShapeIndex_pod; + bool& overflow = *overflow_pod; + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + uint32_t return_val = PxRigidBodyExt::linearSweepMultiple(body, scene, unitDir, distance, outputFlags, touchHitBuffer, touchHitShapeIndices, touchHitBufferSize, block, blockingShapeIndex, overflow, filterData, filterCall, cache, inflation); + return return_val; + } + + DLLEXPORT physx_PxTransform PxShapeExt_getGlobalPose(physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod) { + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxTransform return_val = PxShapeExt::getGlobalPose(shape, actor); + physx_PxTransform return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT uint32_t PxShapeExt_raycast(physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod, physx_PxVec3 const* rayOrigin_pod, physx_PxVec3 const* rayDir_pod, float maxDist, uint16_t hitFlags_pod, uint32_t maxHits, physx_PxRaycastHit* rayHits_pod) { + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxVec3 const& rayOrigin = reinterpret_cast(*rayOrigin_pod); + physx::PxVec3 const& rayDir = reinterpret_cast(*rayDir_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxRaycastHit* rayHits = reinterpret_cast(rayHits_pod); + uint32_t return_val = PxShapeExt::raycast(shape, actor, rayOrigin, rayDir, maxDist, hitFlags, maxHits, rayHits); + return return_val; + } + + DLLEXPORT bool PxShapeExt_overlap(physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod, physx_PxGeometry const* otherGeom_pod, physx_PxTransform const* otherGeomPose_pod) { + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxGeometry const& otherGeom = reinterpret_cast(*otherGeom_pod); + physx::PxTransform const& otherGeomPose = reinterpret_cast(*otherGeomPose_pod); + bool return_val = PxShapeExt::overlap(shape, actor, otherGeom, otherGeomPose); + return return_val; + } + + DLLEXPORT bool PxShapeExt_sweep(physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod, physx_PxVec3 const* unitDir_pod, float distance, physx_PxGeometry const* otherGeom_pod, physx_PxTransform const* otherGeomPose_pod, physx_PxSweepHit* sweepHit_pod, uint16_t hitFlags_pod) { + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxGeometry const& otherGeom = reinterpret_cast(*otherGeom_pod); + physx::PxTransform const& otherGeomPose = reinterpret_cast(*otherGeomPose_pod); + physx::PxSweepHit& sweepHit = reinterpret_cast(*sweepHit_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + bool return_val = PxShapeExt::sweep(shape, actor, unitDir, distance, otherGeom, otherGeomPose, sweepHit, hitFlags); + return return_val; + } + + DLLEXPORT physx_PxBounds3 PxShapeExt_getWorldBounds(physx_PxShape const* shape_pod, physx_PxRigidActor const* actor_pod, float inflation) { + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxBounds3 return_val = PxShapeExt::getWorldBounds(shape, actor, inflation); + physx_PxBounds3 return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxMeshOverlapUtil* PxMeshOverlapUtil_new_alloc() { + auto return_val = new physx::PxMeshOverlapUtil(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxMeshOverlapUtil_delete(physx_PxMeshOverlapUtil* self__pod) { + physx::PxMeshOverlapUtil* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxMeshOverlapUtil_findOverlap_mut(physx_PxMeshOverlapUtil* self__pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxTriangleMeshGeometry const* meshGeom_pod, physx_PxTransform const* meshPose_pod) { + physx::PxMeshOverlapUtil* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxTriangleMeshGeometry const& meshGeom = reinterpret_cast(*meshGeom_pod); + physx::PxTransform const& meshPose = reinterpret_cast(*meshPose_pod); + uint32_t return_val = self_->findOverlap(geom, geomPose, meshGeom, meshPose); + return return_val; + } + + DLLEXPORT uint32_t PxMeshOverlapUtil_findOverlap_mut_1(physx_PxMeshOverlapUtil* self__pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxHeightFieldGeometry const* hfGeom_pod, physx_PxTransform const* hfPose_pod) { + physx::PxMeshOverlapUtil* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxHeightFieldGeometry const& hfGeom = reinterpret_cast(*hfGeom_pod); + physx::PxTransform const& hfPose = reinterpret_cast(*hfPose_pod); + uint32_t return_val = self_->findOverlap(geom, geomPose, hfGeom, hfPose); + return return_val; + } + + DLLEXPORT uint32_t const* PxMeshOverlapUtil_getResults(physx_PxMeshOverlapUtil const* self__pod) { + physx::PxMeshOverlapUtil const* self_ = reinterpret_cast(self__pod); + uint32_t const* return_val = self_->getResults(); + return return_val; + } + + DLLEXPORT uint32_t PxMeshOverlapUtil_getNbResults(physx_PxMeshOverlapUtil const* self__pod) { + physx::PxMeshOverlapUtil const* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->getNbResults(); + return return_val; + } + + DLLEXPORT bool phys_PxComputeTriangleMeshPenetration(physx_PxVec3* direction_pod, float* depth_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxTriangleMeshGeometry const* meshGeom_pod, physx_PxTransform const* meshPose_pod, uint32_t maxIter, uint32_t* usedIter) { + physx::PxVec3& direction = reinterpret_cast(*direction_pod); + float& depth = *depth_pod; + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxTriangleMeshGeometry const& meshGeom = reinterpret_cast(*meshGeom_pod); + physx::PxTransform const& meshPose = reinterpret_cast(*meshPose_pod); + bool return_val = PxComputeTriangleMeshPenetration(direction, depth, geom, geomPose, meshGeom, meshPose, maxIter, usedIter); + return return_val; + } + + DLLEXPORT bool phys_PxComputeHeightFieldPenetration(physx_PxVec3* direction_pod, float* depth_pod, physx_PxGeometry const* geom_pod, physx_PxTransform const* geomPose_pod, physx_PxHeightFieldGeometry const* heightFieldGeom_pod, physx_PxTransform const* heightFieldPose_pod, uint32_t maxIter, uint32_t* usedIter) { + physx::PxVec3& direction = reinterpret_cast(*direction_pod); + float& depth = *depth_pod; + physx::PxGeometry const& geom = reinterpret_cast(*geom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxHeightFieldGeometry const& heightFieldGeom = reinterpret_cast(*heightFieldGeom_pod); + physx::PxTransform const& heightFieldPose = reinterpret_cast(*heightFieldPose_pod); + bool return_val = PxComputeHeightFieldPenetration(direction, depth, geom, geomPose, heightFieldGeom, heightFieldPose, maxIter, usedIter); + return return_val; + } + + DLLEXPORT physx_PxXmlMiscParameter PxXmlMiscParameter_new() { + PxXmlMiscParameter return_val; + physx_PxXmlMiscParameter return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT physx_PxXmlMiscParameter PxXmlMiscParameter_new_1(physx_PxVec3* inUpVector_pod, physx_PxTolerancesScale inScale_pod) { + physx::PxVec3& inUpVector = reinterpret_cast(*inUpVector_pod); + physx::PxTolerancesScale inScale; + memcpy(&inScale, &inScale_pod, sizeof(inScale)); + PxXmlMiscParameter return_val(inUpVector, inScale); + physx_PxXmlMiscParameter return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxSerialization_isSerializable(physx_PxCollection* collection_pod, physx_PxSerializationRegistry* sr_pod, physx_PxCollection const* externalReferences_pod) { + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCollection const* externalReferences = reinterpret_cast(externalReferences_pod); + bool return_val = PxSerialization::isSerializable(collection, sr, externalReferences); + return return_val; + } + + DLLEXPORT void PxSerialization_complete(physx_PxCollection* collection_pod, physx_PxSerializationRegistry* sr_pod, physx_PxCollection const* exceptFor_pod, bool followJoints) { + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCollection const* exceptFor = reinterpret_cast(exceptFor_pod); + PxSerialization::complete(collection, sr, exceptFor, followJoints); + } + + DLLEXPORT void PxSerialization_createSerialObjectIds(physx_PxCollection* collection_pod, uint64_t base) { + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + PxSerialization::createSerialObjectIds(collection, base); + } + + DLLEXPORT physx_PxCollection* PxSerialization_createCollectionFromXml(physx_PxInputData* inputData_pod, physx_PxCooking* cooking_pod, physx_PxSerializationRegistry* sr_pod, physx_PxCollection const* externalRefs_pod, physx_PxStringTable* stringTable_pod, physx_PxXmlMiscParameter* outArgs_pod) { + physx::PxInputData& inputData = reinterpret_cast(*inputData_pod); + physx::PxCooking& cooking = reinterpret_cast(*cooking_pod); + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCollection const* externalRefs = reinterpret_cast(externalRefs_pod); + physx::PxStringTable* stringTable = reinterpret_cast(stringTable_pod); + physx::PxXmlMiscParameter* outArgs = reinterpret_cast(outArgs_pod); + physx::PxCollection* return_val = PxSerialization::createCollectionFromXml(inputData, cooking, sr, externalRefs, stringTable, outArgs); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxCollection* PxSerialization_createCollectionFromBinary(void* memBlock, physx_PxSerializationRegistry* sr_pod, physx_PxCollection const* externalRefs_pod) { + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCollection const* externalRefs = reinterpret_cast(externalRefs_pod); + physx::PxCollection* return_val = PxSerialization::createCollectionFromBinary(memBlock, sr, externalRefs); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxSerialization_serializeCollectionToXml(physx_PxOutputStream* outputStream_pod, physx_PxCollection* collection_pod, physx_PxSerializationRegistry* sr_pod, physx_PxCooking* cooking_pod, physx_PxCollection const* externalRefs_pod, physx_PxXmlMiscParameter* inArgs_pod) { + physx::PxOutputStream& outputStream = reinterpret_cast(*outputStream_pod); + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCooking* cooking = reinterpret_cast(cooking_pod); + physx::PxCollection const* externalRefs = reinterpret_cast(externalRefs_pod); + physx::PxXmlMiscParameter* inArgs = reinterpret_cast(inArgs_pod); + bool return_val = PxSerialization::serializeCollectionToXml(outputStream, collection, sr, cooking, externalRefs, inArgs); + return return_val; + } + + DLLEXPORT bool PxSerialization_serializeCollectionToBinary(physx_PxOutputStream* outputStream_pod, physx_PxCollection* collection_pod, physx_PxSerializationRegistry* sr_pod, physx_PxCollection const* externalRefs_pod, bool exportNames) { + physx::PxOutputStream& outputStream = reinterpret_cast(*outputStream_pod); + physx::PxCollection& collection = reinterpret_cast(*collection_pod); + physx::PxSerializationRegistry& sr = reinterpret_cast(*sr_pod); + physx::PxCollection const* externalRefs = reinterpret_cast(externalRefs_pod); + bool return_val = PxSerialization::serializeCollectionToBinary(outputStream, collection, sr, externalRefs, exportNames); + return return_val; + } + + DLLEXPORT physx_PxSerializationRegistry* PxSerialization_createSerializationRegistry(physx_PxPhysics* physics_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxSerializationRegistry* return_val = PxSerialization::createSerializationRegistry(physics); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxDefaultCpuDispatcher_release_mut(physx_PxDefaultCpuDispatcher* self__pod) { + physx::PxDefaultCpuDispatcher* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT void PxDefaultCpuDispatcher_setRunProfiled_mut(physx_PxDefaultCpuDispatcher* self__pod, bool runProfiled) { + physx::PxDefaultCpuDispatcher* self_ = reinterpret_cast(self__pod); + self_->setRunProfiled(runProfiled); + } + + DLLEXPORT bool PxDefaultCpuDispatcher_getRunProfiled(physx_PxDefaultCpuDispatcher const* self__pod) { + physx::PxDefaultCpuDispatcher const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->getRunProfiled(); + return return_val; + } + + DLLEXPORT physx_PxDefaultCpuDispatcher* phys_PxDefaultCpuDispatcherCreate(uint32_t numThreads, uint32_t* affinityMasks, int32_t mode_pod, uint32_t yieldProcessorCount) { + auto mode = static_cast(mode_pod); + physx::PxDefaultCpuDispatcher* return_val = PxDefaultCpuDispatcherCreate(numThreads, affinityMasks, mode, yieldProcessorCount); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool phys_PxBuildSmoothNormals(uint32_t nbTris, uint32_t nbVerts, physx_PxVec3 const* verts_pod, uint32_t const* dFaces, uint16_t const* wFaces, physx_PxVec3* normals_pod, bool flip) { + physx::PxVec3 const* verts = reinterpret_cast(verts_pod); + physx::PxVec3* normals = reinterpret_cast(normals_pod); + bool return_val = PxBuildSmoothNormals(nbTris, nbVerts, verts, dFaces, wFaces, normals, flip); + return return_val; + } + + DLLEXPORT physx_PxRigidDynamic* phys_PxCreateDynamic(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial* material_pod, float density, physx_PxTransform const* shapeOffset_pod) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial& material = reinterpret_cast(*material_pod); + physx::PxTransform const& shapeOffset = reinterpret_cast(*shapeOffset_pod); + physx::PxRigidDynamic* return_val = PxCreateDynamic(sdk, transform, geometry, material, density, shapeOffset); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* phys_PxCreateDynamic_1(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxShape* shape_pod, float density) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + physx::PxRigidDynamic* return_val = PxCreateDynamic(sdk, transform, shape, density); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* phys_PxCreateKinematic(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial* material_pod, float density, physx_PxTransform const* shapeOffset_pod) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial& material = reinterpret_cast(*material_pod); + physx::PxTransform const& shapeOffset = reinterpret_cast(*shapeOffset_pod); + physx::PxRigidDynamic* return_val = PxCreateKinematic(sdk, transform, geometry, material, density, shapeOffset); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* phys_PxCreateKinematic_1(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxShape* shape_pod, float density) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + physx::PxRigidDynamic* return_val = PxCreateKinematic(sdk, transform, shape, density); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidStatic* phys_PxCreateStatic(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxGeometry const* geometry_pod, physx_PxMaterial* material_pod, physx_PxTransform const* shapeOffset_pod) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxMaterial& material = reinterpret_cast(*material_pod); + physx::PxTransform const& shapeOffset = reinterpret_cast(*shapeOffset_pod); + physx::PxRigidStatic* return_val = PxCreateStatic(sdk, transform, geometry, material, shapeOffset); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidStatic* phys_PxCreateStatic_1(physx_PxPhysics* sdk_pod, physx_PxTransform const* transform_pod, physx_PxShape* shape_pod) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxShape& shape = reinterpret_cast(*shape_pod); + physx::PxRigidStatic* return_val = PxCreateStatic(sdk, transform, shape); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxShape* phys_PxCloneShape(physx_PxPhysics* physicsSDK_pod, physx_PxShape const* shape_pod, bool isExclusive) { + physx::PxPhysics& physicsSDK = reinterpret_cast(*physicsSDK_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + physx::PxShape* return_val = PxCloneShape(physicsSDK, shape, isExclusive); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidStatic* phys_PxCloneStatic(physx_PxPhysics* physicsSDK_pod, physx_PxTransform const* transform_pod, physx_PxRigidActor const* actor_pod) { + physx::PxPhysics& physicsSDK = reinterpret_cast(*physicsSDK_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxRigidStatic* return_val = PxCloneStatic(physicsSDK, transform, actor); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidDynamic* phys_PxCloneDynamic(physx_PxPhysics* physicsSDK_pod, physx_PxTransform const* transform_pod, physx_PxRigidDynamic const* body_pod) { + physx::PxPhysics& physicsSDK = reinterpret_cast(*physicsSDK_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxRigidDynamic const& body = reinterpret_cast(*body_pod); + physx::PxRigidDynamic* return_val = PxCloneDynamic(physicsSDK, transform, body); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxRigidStatic* phys_PxCreatePlane(physx_PxPhysics* sdk_pod, physx_PxPlane const* plane_pod, physx_PxMaterial* material_pod) { + physx::PxPhysics& sdk = reinterpret_cast(*sdk_pod); + physx::PxPlane const& plane = reinterpret_cast(*plane_pod); + physx::PxMaterial& material = reinterpret_cast(*material_pod); + physx::PxRigidStatic* return_val = PxCreatePlane(sdk, plane, material); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void phys_PxScaleRigidActor(physx_PxRigidActor* actor_pod, float scale, bool scaleMassProps) { + physx::PxRigidActor& actor = reinterpret_cast(*actor_pod); + PxScaleRigidActor(actor, scale, scaleMassProps); + } + + DLLEXPORT physx_PxStringTable* PxStringTableExt_createStringTable(physx_PxAllocatorCallback* inAllocator_pod) { + physx::PxAllocatorCallback& inAllocator = reinterpret_cast(*inAllocator_pod); + physx::PxStringTable& return_val = PxStringTableExt::createStringTable(inAllocator); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxBroadPhaseExt_createRegionsFromWorldBounds(physx_PxBounds3* regions_pod, physx_PxBounds3 const* globalBounds_pod, uint32_t nbSubdiv, uint32_t upAxis) { + physx::PxBounds3* regions = reinterpret_cast(regions_pod); + physx::PxBounds3 const& globalBounds = reinterpret_cast(*globalBounds_pod); + uint32_t return_val = PxBroadPhaseExt::createRegionsFromWorldBounds(regions, globalBounds, nbSubdiv, upAxis); + return return_val; + } + + DLLEXPORT bool PxSceneQueryExt_raycastAny(physx_PxScene const* scene_pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float distance, physx_PxQueryHit* hit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + physx::PxQueryHit& hit = reinterpret_cast(*hit_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + bool return_val = PxSceneQueryExt::raycastAny(scene, origin, unitDir, distance, hit, filterData, filterCall, cache); + return return_val; + } + + DLLEXPORT bool PxSceneQueryExt_raycastSingle(physx_PxScene const* scene_pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxRaycastHit* hit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxRaycastHit& hit = reinterpret_cast(*hit_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + bool return_val = PxSceneQueryExt::raycastSingle(scene, origin, unitDir, distance, outputFlags, hit, filterData, filterCall, cache); + return return_val; + } + + DLLEXPORT int32_t PxSceneQueryExt_raycastMultiple(physx_PxScene const* scene_pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxRaycastHit* hitBuffer_pod, uint32_t hitBufferSize, bool* blockingHit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxRaycastHit* hitBuffer = reinterpret_cast(hitBuffer_pod); + bool& blockingHit = *blockingHit_pod; + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + int32_t return_val = PxSceneQueryExt::raycastMultiple(scene, origin, unitDir, distance, outputFlags, hitBuffer, hitBufferSize, blockingHit, filterData, filterCall, cache); + return return_val; + } + + DLLEXPORT bool PxSceneQueryExt_sweepAny(physx_PxScene const* scene_pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t queryFlags_pod, physx_PxQueryHit* hit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto queryFlags = physx::PxHitFlags(queryFlags_pod); + physx::PxQueryHit& hit = reinterpret_cast(*hit_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + bool return_val = PxSceneQueryExt::sweepAny(scene, geometry, pose, unitDir, distance, queryFlags, hit, filterData, filterCall, cache, inflation); + return return_val; + } + + DLLEXPORT bool PxSceneQueryExt_sweepSingle(physx_PxScene const* scene_pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxSweepHit* hit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxSweepHit& hit = reinterpret_cast(*hit_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + bool return_val = PxSceneQueryExt::sweepSingle(scene, geometry, pose, unitDir, distance, outputFlags, hit, filterData, filterCall, cache, inflation); + return return_val; + } + + DLLEXPORT int32_t PxSceneQueryExt_sweepMultiple(physx_PxScene const* scene_pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t outputFlags_pod, physx_PxSweepHit* hitBuffer_pod, uint32_t hitBufferSize, bool* blockingHit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto outputFlags = physx::PxHitFlags(outputFlags_pod); + physx::PxSweepHit* hitBuffer = reinterpret_cast(hitBuffer_pod); + bool& blockingHit = *blockingHit_pod; + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + int32_t return_val = PxSceneQueryExt::sweepMultiple(scene, geometry, pose, unitDir, distance, outputFlags, hitBuffer, hitBufferSize, blockingHit, filterData, filterCall, cache, inflation); + return return_val; + } + + DLLEXPORT int32_t PxSceneQueryExt_overlapMultiple(physx_PxScene const* scene_pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxOverlapHit* hitBuffer_pod, uint32_t hitBufferSize, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxOverlapHit* hitBuffer = reinterpret_cast(hitBuffer_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + int32_t return_val = PxSceneQueryExt::overlapMultiple(scene, geometry, pose, hitBuffer, hitBufferSize, filterData, filterCall); + return return_val; + } + + DLLEXPORT bool PxSceneQueryExt_overlapAny(physx_PxScene const* scene_pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxOverlapHit* hit_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxOverlapHit& hit = reinterpret_cast(*hit_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + bool return_val = PxSceneQueryExt::overlapAny(scene, geometry, pose, hit, filterData, filterCall); + return return_val; + } + + DLLEXPORT void PxBatchQueryExt_release_mut(physx_PxBatchQueryExt* self__pod) { + physx::PxBatchQueryExt* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxRaycastBuffer* PxBatchQueryExt_raycast_mut(physx_PxBatchQueryExt* self__pod, physx_PxVec3 const* origin_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t maxNbTouches, uint16_t hitFlags_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryCache const* cache_pod) { + physx::PxBatchQueryExt* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& origin = reinterpret_cast(*origin_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + physx::PxRaycastBuffer* return_val = self_->raycast(origin, unitDir, distance, maxNbTouches, hitFlags, filterData, cache); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSweepBuffer* PxBatchQueryExt_sweep_mut(physx_PxBatchQueryExt* self__pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, physx_PxVec3 const* unitDir_pod, float distance, uint16_t maxNbTouches, uint16_t hitFlags_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryCache const* cache_pod, float inflation) { + physx::PxBatchQueryExt* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + auto hitFlags = physx::PxHitFlags(hitFlags_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + physx::PxSweepBuffer* return_val = self_->sweep(geometry, pose, unitDir, distance, maxNbTouches, hitFlags, filterData, cache, inflation); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxOverlapBuffer* PxBatchQueryExt_overlap_mut(physx_PxBatchQueryExt* self__pod, physx_PxGeometry const* geometry_pod, physx_PxTransform const* pose_pod, uint16_t maxNbTouches, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryCache const* cache_pod) { + physx::PxBatchQueryExt* self_ = reinterpret_cast(self__pod); + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& pose = reinterpret_cast(*pose_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryCache const* cache = reinterpret_cast(cache_pod); + physx::PxOverlapBuffer* return_val = self_->overlap(geometry, pose, maxNbTouches, filterData, cache); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT void PxBatchQueryExt_execute_mut(physx_PxBatchQueryExt* self__pod) { + physx::PxBatchQueryExt* self_ = reinterpret_cast(self__pod); + self_->execute(); + } + + DLLEXPORT physx_PxBatchQueryExt* phys_PxCreateBatchQueryExt(physx_PxScene const* scene_pod, physx_PxQueryFilterCallback* queryFilterCallback_pod, uint32_t maxNbRaycasts, uint32_t maxNbRaycastTouches, uint32_t maxNbSweeps, uint32_t maxNbSweepTouches, uint32_t maxNbOverlaps, uint32_t maxNbOverlapTouches) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxQueryFilterCallback* queryFilterCallback = reinterpret_cast(queryFilterCallback_pod); + physx::PxBatchQueryExt* return_val = PxCreateBatchQueryExt(scene, queryFilterCallback, maxNbRaycasts, maxNbRaycastTouches, maxNbSweeps, maxNbSweepTouches, maxNbOverlaps, maxNbOverlapTouches); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxBatchQueryExt* phys_PxCreateBatchQueryExt_1(physx_PxScene const* scene_pod, physx_PxQueryFilterCallback* queryFilterCallback_pod, physx_PxRaycastBuffer* raycastBuffers_pod, uint32_t maxNbRaycasts, physx_PxRaycastHit* raycastTouches_pod, uint32_t maxNbRaycastTouches, physx_PxSweepBuffer* sweepBuffers_pod, uint32_t maxNbSweeps, physx_PxSweepHit* sweepTouches_pod, uint32_t maxNbSweepTouches, physx_PxOverlapBuffer* overlapBuffers_pod, uint32_t maxNbOverlaps, physx_PxOverlapHit* overlapTouches_pod, uint32_t maxNbOverlapTouches) { + physx::PxScene const& scene = reinterpret_cast(*scene_pod); + physx::PxQueryFilterCallback* queryFilterCallback = reinterpret_cast(queryFilterCallback_pod); + physx::PxRaycastBuffer* raycastBuffers = reinterpret_cast(raycastBuffers_pod); + physx::PxRaycastHit* raycastTouches = reinterpret_cast(raycastTouches_pod); + physx::PxSweepBuffer* sweepBuffers = reinterpret_cast(sweepBuffers_pod); + physx::PxSweepHit* sweepTouches = reinterpret_cast(sweepTouches_pod); + physx::PxOverlapBuffer* overlapBuffers = reinterpret_cast(overlapBuffers_pod); + physx::PxOverlapHit* overlapTouches = reinterpret_cast(overlapTouches_pod); + physx::PxBatchQueryExt* return_val = PxCreateBatchQueryExt(scene, queryFilterCallback, raycastBuffers, maxNbRaycasts, raycastTouches, maxNbRaycastTouches, sweepBuffers, maxNbSweeps, sweepTouches, maxNbSweepTouches, overlapBuffers, maxNbOverlaps, overlapTouches, maxNbOverlapTouches); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxSceneQuerySystem* phys_PxCreateExternalSceneQuerySystem(physx_PxSceneQueryDesc const* desc_pod, uint64_t contextID) { + physx::PxSceneQueryDesc const& desc = reinterpret_cast(*desc_pod); + physx::PxSceneQuerySystem* return_val = PxCreateExternalSceneQuerySystem(desc, contextID); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t PxCustomSceneQuerySystem_addPruner_mut(physx_PxCustomSceneQuerySystem* self__pod, int32_t primaryType_pod, int32_t secondaryType_pod, uint32_t preallocated) { + physx::PxCustomSceneQuerySystem* self_ = reinterpret_cast(self__pod); + auto primaryType = static_cast(primaryType_pod); + auto secondaryType = static_cast(secondaryType_pod); + uint32_t return_val = self_->addPruner(primaryType, secondaryType, preallocated); + return return_val; + } + + DLLEXPORT uint32_t PxCustomSceneQuerySystem_startCustomBuildstep_mut(physx_PxCustomSceneQuerySystem* self__pod) { + physx::PxCustomSceneQuerySystem* self_ = reinterpret_cast(self__pod); + uint32_t return_val = self_->startCustomBuildstep(); + return return_val; + } + + DLLEXPORT void PxCustomSceneQuerySystem_customBuildstep_mut(physx_PxCustomSceneQuerySystem* self__pod, uint32_t index) { + physx::PxCustomSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->customBuildstep(index); + } + + DLLEXPORT void PxCustomSceneQuerySystem_finishCustomBuildstep_mut(physx_PxCustomSceneQuerySystem* self__pod) { + physx::PxCustomSceneQuerySystem* self_ = reinterpret_cast(self__pod); + self_->finishCustomBuildstep(); + } + + DLLEXPORT void PxCustomSceneQuerySystemAdapter_delete(physx_PxCustomSceneQuerySystemAdapter* self__pod) { + physx::PxCustomSceneQuerySystemAdapter* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT uint32_t PxCustomSceneQuerySystemAdapter_getPrunerIndex(physx_PxCustomSceneQuerySystemAdapter const* self__pod, physx_PxRigidActor const* actor_pod, physx_PxShape const* shape_pod) { + physx::PxCustomSceneQuerySystemAdapter const* self_ = reinterpret_cast(self__pod); + physx::PxRigidActor const& actor = reinterpret_cast(*actor_pod); + physx::PxShape const& shape = reinterpret_cast(*shape_pod); + uint32_t return_val = self_->getPrunerIndex(actor, shape); + return return_val; + } + + DLLEXPORT bool PxCustomSceneQuerySystemAdapter_processPruner(physx_PxCustomSceneQuerySystemAdapter const* self__pod, uint32_t prunerIndex, physx_PxQueryThreadContext const* context_pod, physx_PxQueryFilterData const* filterData_pod, physx_PxQueryFilterCallback* filterCall_pod) { + physx::PxCustomSceneQuerySystemAdapter const* self_ = reinterpret_cast(self__pod); + physx::PxQueryThreadContext const* context = reinterpret_cast(context_pod); + physx::PxQueryFilterData const& filterData = reinterpret_cast(*filterData_pod); + physx::PxQueryFilterCallback* filterCall = reinterpret_cast(filterCall_pod); + bool return_val = self_->processPruner(prunerIndex, context, filterData, filterCall); + return return_val; + } + + DLLEXPORT physx_PxCustomSceneQuerySystem* phys_PxCreateCustomSceneQuerySystem(int32_t sceneQueryUpdateMode_pod, uint64_t contextID, physx_PxCustomSceneQuerySystemAdapter const* adapter_pod, bool usesTreeOfPruners) { + auto sceneQueryUpdateMode = static_cast(sceneQueryUpdateMode_pod); + physx::PxCustomSceneQuerySystemAdapter const& adapter = reinterpret_cast(*adapter_pod); + physx::PxCustomSceneQuerySystem* return_val = PxCreateCustomSceneQuerySystem(sceneQueryUpdateMode, contextID, adapter, usesTreeOfPruners); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint32_t phys_PxFindFaceIndex(physx_PxConvexMeshGeometry const* convexGeom_pod, physx_PxTransform const* geomPose_pod, physx_PxVec3 const* impactPos_pod, physx_PxVec3 const* unitDir_pod) { + physx::PxConvexMeshGeometry const& convexGeom = reinterpret_cast(*convexGeom_pod); + physx::PxTransform const& geomPose = reinterpret_cast(*geomPose_pod); + physx::PxVec3 const& impactPos = reinterpret_cast(*impactPos_pod); + physx::PxVec3 const& unitDir = reinterpret_cast(*unitDir_pod); + uint32_t return_val = PxFindFaceIndex(convexGeom, geomPose, impactPos, unitDir); + return return_val; + } + + DLLEXPORT bool PxPoissonSampler_setSamplingRadius_mut(physx_PxPoissonSampler* self__pod, float samplingRadius) { + physx::PxPoissonSampler* self_ = reinterpret_cast(self__pod); + bool return_val = self_->setSamplingRadius(samplingRadius); + return return_val; + } + + DLLEXPORT void PxPoissonSampler_addSamplesInSphere_mut(physx_PxPoissonSampler* self__pod, physx_PxVec3 const* sphereCenter_pod, float sphereRadius, bool createVolumeSamples) { + physx::PxPoissonSampler* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& sphereCenter = reinterpret_cast(*sphereCenter_pod); + self_->addSamplesInSphere(sphereCenter, sphereRadius, createVolumeSamples); + } + + DLLEXPORT void PxPoissonSampler_addSamplesInBox_mut(physx_PxPoissonSampler* self__pod, physx_PxBounds3 const* axisAlignedBox_pod, physx_PxQuat const* boxOrientation_pod, bool createVolumeSamples) { + physx::PxPoissonSampler* self_ = reinterpret_cast(self__pod); + physx::PxBounds3 const& axisAlignedBox = reinterpret_cast(*axisAlignedBox_pod); + physx::PxQuat const& boxOrientation = reinterpret_cast(*boxOrientation_pod); + self_->addSamplesInBox(axisAlignedBox, boxOrientation, createVolumeSamples); + } + + DLLEXPORT void PxPoissonSampler_delete(physx_PxPoissonSampler* self__pod) { + physx::PxPoissonSampler* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxPoissonSampler* phys_PxCreateShapeSampler(physx_PxGeometry const* geometry_pod, physx_PxTransform const* transform_pod, physx_PxBounds3 const* worldBounds_pod, float initialSamplingRadius, int32_t numSampleAttemptsAroundPoint) { + physx::PxGeometry const& geometry = reinterpret_cast(*geometry_pod); + physx::PxTransform const& transform = reinterpret_cast(*transform_pod); + physx::PxBounds3 const& worldBounds = reinterpret_cast(*worldBounds_pod); + physx::PxPoissonSampler* return_val = PxCreateShapeSampler(geometry, transform, worldBounds, initialSamplingRadius, numSampleAttemptsAroundPoint); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxTriangleMeshPoissonSampler_isPointInTriangleMesh_mut(physx_PxTriangleMeshPoissonSampler* self__pod, physx_PxVec3 const* p_pod) { + physx::PxTriangleMeshPoissonSampler* self_ = reinterpret_cast(self__pod); + physx::PxVec3 const& p = reinterpret_cast(*p_pod); + bool return_val = self_->isPointInTriangleMesh(p); + return return_val; + } + + DLLEXPORT void PxTriangleMeshPoissonSampler_delete(physx_PxTriangleMeshPoissonSampler* self__pod) { + physx::PxTriangleMeshPoissonSampler* self_ = reinterpret_cast(self__pod); + delete self_; + } + + DLLEXPORT physx_PxTriangleMeshPoissonSampler* phys_PxCreateTriangleMeshSampler(uint32_t const* triangles, uint32_t numTriangles, physx_PxVec3 const* vertices_pod, uint32_t numVertices, float initialSamplingRadius, int32_t numSampleAttemptsAroundPoint) { + physx::PxVec3 const* vertices = reinterpret_cast(vertices_pod); + physx::PxTriangleMeshPoissonSampler* return_val = PxCreateTriangleMeshSampler(triangles, numTriangles, vertices, numVertices, initialSamplingRadius, numSampleAttemptsAroundPoint); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT int32_t PxTetrahedronMeshExt_findTetrahedronContainingPoint(physx_PxTetrahedronMesh const* mesh_pod, physx_PxVec3 const* point_pod, physx_PxVec4* bary_pod, float tolerance) { + physx::PxTetrahedronMesh const* mesh = reinterpret_cast(mesh_pod); + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec4& bary = reinterpret_cast(*bary_pod); + int32_t return_val = PxTetrahedronMeshExt::findTetrahedronContainingPoint(mesh, point, bary, tolerance); + return return_val; + } + + DLLEXPORT int32_t PxTetrahedronMeshExt_findTetrahedronClosestToPoint(physx_PxTetrahedronMesh const* mesh_pod, physx_PxVec3 const* point_pod, physx_PxVec4* bary_pod) { + physx::PxTetrahedronMesh const* mesh = reinterpret_cast(mesh_pod); + physx::PxVec3 const& point = reinterpret_cast(*point_pod); + physx::PxVec4& bary = reinterpret_cast(*bary_pod); + int32_t return_val = PxTetrahedronMeshExt::findTetrahedronClosestToPoint(mesh, point, bary); + return return_val; + } + + DLLEXPORT bool phys_PxInitExtensions(physx_PxPhysics* physics_pod, physx_PxPvd* pvd_pod) { + physx::PxPhysics& physics = reinterpret_cast(*physics_pod); + physx::PxPvd* pvd = reinterpret_cast(pvd_pod); + bool return_val = PxInitExtensions(physics, pvd); + return return_val; + } + + DLLEXPORT void phys_PxCloseExtensions() { + PxCloseExtensions(); + } + + DLLEXPORT physx_PxRepXObject PxRepXObject_new(char const* inTypeName, void const* inSerializable, uint64_t inId) { + PxRepXObject return_val(inTypeName, inSerializable, inId); + physx_PxRepXObject return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxRepXObject_isValid(physx_PxRepXObject const* self__pod) { + physx::PxRepXObject const* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isValid(); + return return_val; + } + + DLLEXPORT physx_PxRepXInstantiationArgs PxRepXInstantiationArgs_new(physx_PxPhysics* inPhysics_pod, physx_PxCooking* inCooking_pod, physx_PxStringTable* inStringTable_pod) { + physx::PxPhysics& inPhysics = reinterpret_cast(*inPhysics_pod); + physx::PxCooking* inCooking = reinterpret_cast(inCooking_pod); + physx::PxStringTable* inStringTable = reinterpret_cast(inStringTable_pod); + PxRepXInstantiationArgs return_val(inPhysics, inCooking, inStringTable); + physx_PxRepXInstantiationArgs return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT char const* PxRepXSerializer_getTypeName_mut(physx_PxRepXSerializer* self__pod) { + physx::PxRepXSerializer* self_ = reinterpret_cast(self__pod); + char const* return_val = self_->getTypeName(); + return return_val; + } + + DLLEXPORT void PxRepXSerializer_objectToFile_mut(physx_PxRepXSerializer* self__pod, physx_PxRepXObject const* inLiveObject_pod, physx_PxCollection* inCollection_pod, physx_XmlWriter* inWriter_pod, physx_MemoryBuffer* inTempBuffer_pod, physx_PxRepXInstantiationArgs* inArgs_pod) { + physx::PxRepXSerializer* self_ = reinterpret_cast(self__pod); + physx::PxRepXObject const& inLiveObject = reinterpret_cast(*inLiveObject_pod); + physx::PxCollection* inCollection = reinterpret_cast(inCollection_pod); + physx::XmlWriter& inWriter = reinterpret_cast(*inWriter_pod); + physx::MemoryBuffer& inTempBuffer = reinterpret_cast(*inTempBuffer_pod); + physx::PxRepXInstantiationArgs& inArgs = reinterpret_cast(*inArgs_pod); + self_->objectToFile(inLiveObject, inCollection, inWriter, inTempBuffer, inArgs); + } + + DLLEXPORT physx_PxRepXObject PxRepXSerializer_fileToObject_mut(physx_PxRepXSerializer* self__pod, physx_XmlReader* inReader_pod, physx_XmlMemoryAllocator* inAllocator_pod, physx_PxRepXInstantiationArgs* inArgs_pod, physx_PxCollection* inCollection_pod) { + physx::PxRepXSerializer* self_ = reinterpret_cast(self__pod); + physx::XmlReader& inReader = reinterpret_cast(*inReader_pod); + physx::XmlMemoryAllocator& inAllocator = reinterpret_cast(*inAllocator_pod); + physx::PxRepXInstantiationArgs& inArgs = reinterpret_cast(*inArgs_pod); + physx::PxCollection* inCollection = reinterpret_cast(inCollection_pod); + physx::PxRepXObject return_val = self_->fileToObject(inReader, inAllocator, inArgs, inCollection); + physx_PxRepXObject return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT bool PxPvd_connect_mut(physx_PxPvd* self__pod, physx_PxPvdTransport* transport_pod, uint8_t flags_pod) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + physx::PxPvdTransport& transport = reinterpret_cast(*transport_pod); + auto flags = physx::PxPvdInstrumentationFlags(flags_pod); + bool return_val = self_->connect(transport, flags); + return return_val; + } + + DLLEXPORT void PxPvd_disconnect_mut(physx_PxPvd* self__pod) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + self_->disconnect(); + } + + DLLEXPORT bool PxPvd_isConnected_mut(physx_PxPvd* self__pod, bool useCachedStatus) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isConnected(useCachedStatus); + return return_val; + } + + DLLEXPORT physx_PxPvdTransport* PxPvd_getTransport_mut(physx_PxPvd* self__pod) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + physx::PxPvdTransport* return_val = self_->getTransport(); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT uint8_t PxPvd_getInstrumentationFlags_mut(physx_PxPvd* self__pod) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + physx::PxPvdInstrumentationFlags return_val = self_->getInstrumentationFlags(); + uint8_t return_val_pod; + memcpy(&return_val_pod, &return_val, sizeof(return_val_pod)); + return return_val_pod; + } + + DLLEXPORT void PxPvd_release_mut(physx_PxPvd* self__pod) { + physx::PxPvd* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxPvd* phys_PxCreatePvd(physx_PxFoundation* foundation_pod) { + physx::PxFoundation& foundation = reinterpret_cast(*foundation_pod); + physx::PxPvd* return_val = PxCreatePvd(foundation); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT bool PxPvdTransport_connect_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + bool return_val = self_->connect(); + return return_val; + } + + DLLEXPORT void PxPvdTransport_disconnect_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + self_->disconnect(); + } + + DLLEXPORT bool PxPvdTransport_isConnected_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + bool return_val = self_->isConnected(); + return return_val; + } + + DLLEXPORT bool PxPvdTransport_write_mut(physx_PxPvdTransport* self__pod, uint8_t const* inBytes, uint32_t inLength) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + bool return_val = self_->write(inBytes, inLength); + return return_val; + } + + DLLEXPORT physx_PxPvdTransport* PxPvdTransport_lock_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + physx::PxPvdTransport& return_val = self_->lock(); + auto return_val_pod = reinterpret_cast(&return_val); + return return_val_pod; + } + + DLLEXPORT void PxPvdTransport_unlock_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + self_->unlock(); + } + + DLLEXPORT void PxPvdTransport_flush_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + self_->flush(); + } + + DLLEXPORT uint64_t PxPvdTransport_getWrittenDataSize_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + uint64_t return_val = self_->getWrittenDataSize(); + return return_val; + } + + DLLEXPORT void PxPvdTransport_release_mut(physx_PxPvdTransport* self__pod) { + physx::PxPvdTransport* self_ = reinterpret_cast(self__pod); + self_->release(); + } + + DLLEXPORT physx_PxPvdTransport* phys_PxDefaultPvdSocketTransportCreate(char const* host, int32_t port, uint32_t timeoutInMilliseconds) { + physx::PxPvdTransport* return_val = PxDefaultPvdSocketTransportCreate(host, port, timeoutInMilliseconds); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + + DLLEXPORT physx_PxPvdTransport* phys_PxDefaultPvdFileTransportCreate(char const* name) { + physx::PxPvdTransport* return_val = PxDefaultPvdFileTransportCreate(name); + auto return_val_pod = reinterpret_cast(return_val); + return return_val_pod; + } + +} diff --git a/modules/PhysX/physx/physx-sys/src/physx_generated.rs b/modules/PhysX/physx/physx-sys/src/physx_generated.rs new file mode 100644 index 0000000..cfc45d4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/physx_generated.rs @@ -0,0 +1,14250 @@ +/// enum for empty constructor tag +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxEMPTY { + PxEmpty = 0, +} + +/// enum for zero constructor tag for vectors and matrices +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxZERO { + PxZero = 0, +} + +/// enum for identity constructor flag for quaternions, transforms, and matrices +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxIDENTITY { + PxIdentity = 0, +} + +/// Error codes +/// +/// These error codes are passed to [`PxErrorCallback`] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxErrorCode { + NoError = 0, + /// An informational message. + DebugInfo = 1, + /// a warning message for the user to help with debugging + DebugWarning = 2, + /// method called with invalid parameter(s) + InvalidParameter = 4, + /// method was called at a time when an operation is not possible + InvalidOperation = 8, + /// method failed to allocate some memory + OutOfMemory = 16, + /// The library failed for some reason. + /// Possibly you have passed invalid values like NaNs, which are not checked for. + InternalError = 32, + /// An unrecoverable error, execution should be halted and log output flushed + Abort = 64, + /// The SDK has determined that an operation may result in poor performance. + PerfWarning = 128, + /// A bit mask for including all errors + MaskAll = -1, +} + +#[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, +} + +/// Default color values used for debug rendering. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u32)] +pub enum PxDebugColor { + ArgbBlack = 4278190080, + ArgbRed = 4294901760, + ArgbGreen = 4278255360, + ArgbBlue = 4278190335, + ArgbYellow = 4294967040, + ArgbMagenta = 4294902015, + ArgbCyan = 4278255615, + ArgbWhite = 4294967295, + ArgbGrey = 4286611584, + ArgbDarkred = 4287102976, + ArgbDarkgreen = 4278224896, + ArgbDarkblue = 4278190216, +} + +/// an enumeration of concrete classes inheriting from PxBase +/// +/// Enumeration space is reserved for future PhysX core types, PhysXExtensions, +/// PhysXVehicle and Custom application types. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConcreteType { + Undefined = 0, + Heightfield = 1, + ConvexMesh = 2, + TriangleMeshBvh33 = 3, + TriangleMeshBvh34 = 4, + TetrahedronMesh = 5, + SoftbodyMesh = 6, + RigidDynamic = 7, + RigidStatic = 8, + Shape = 9, + Material = 10, + SoftbodyMaterial = 11, + ClothMaterial = 12, + PbdMaterial = 13, + FlipMaterial = 14, + MpmMaterial = 15, + CustomMaterial = 16, + Constraint = 17, + Aggregate = 18, + ArticulationReducedCoordinate = 19, + ArticulationLink = 20, + ArticulationJointReducedCoordinate = 21, + ArticulationSensor = 22, + ArticulationSpatialTendon = 23, + ArticulationFixedTendon = 24, + ArticulationAttachment = 25, + ArticulationTendonJoint = 26, + PruningStructure = 27, + Bvh = 28, + SoftBody = 29, + SoftBodyState = 30, + PbdParticlesystem = 31, + FlipParticlesystem = 32, + MpmParticlesystem = 33, + CustomParticlesystem = 34, + FemCloth = 35, + HairSystem = 36, + ParticleBuffer = 37, + ParticleDiffuseBuffer = 38, + ParticleClothBuffer = 39, + ParticleRigidBuffer = 40, + PhysxCoreCount = 41, + FirstPhysxExtension = 256, + FirstVehicleExtension = 512, + FirstUserExtension = 1024, +} + +impl From for PxConcreteType { + fn from(val: u16) -> Self { + #[allow(clippy::match_same_arms)] + match val { + 0 => Self::Undefined, + 1 => Self::Heightfield, + 2 => Self::ConvexMesh, + 3 => Self::TriangleMeshBvh33, + 4 => Self::TriangleMeshBvh34, + 5 => Self::TetrahedronMesh, + 6 => Self::SoftbodyMesh, + 7 => Self::RigidDynamic, + 8 => Self::RigidStatic, + 9 => Self::Shape, + 10 => Self::Material, + 11 => Self::SoftbodyMaterial, + 12 => Self::ClothMaterial, + 13 => Self::PbdMaterial, + 14 => Self::FlipMaterial, + 15 => Self::MpmMaterial, + 16 => Self::CustomMaterial, + 17 => Self::Constraint, + 18 => Self::Aggregate, + 19 => Self::ArticulationReducedCoordinate, + 20 => Self::ArticulationLink, + 21 => Self::ArticulationJointReducedCoordinate, + 22 => Self::ArticulationSensor, + 23 => Self::ArticulationSpatialTendon, + 24 => Self::ArticulationFixedTendon, + 25 => Self::ArticulationAttachment, + 26 => Self::ArticulationTendonJoint, + 27 => Self::PruningStructure, + 28 => Self::Bvh, + 29 => Self::SoftBody, + 30 => Self::SoftBodyState, + 31 => Self::PbdParticlesystem, + 32 => Self::FlipParticlesystem, + 33 => Self::MpmParticlesystem, + 34 => Self::CustomParticlesystem, + 35 => Self::FemCloth, + 36 => Self::HairSystem, + 37 => Self::ParticleBuffer, + 38 => Self::ParticleDiffuseBuffer, + 39 => Self::ParticleClothBuffer, + 40 => Self::ParticleRigidBuffer, + 41 => Self::PhysxCoreCount, + 256 => Self::FirstPhysxExtension, + 512 => Self::FirstVehicleExtension, + 1024 => Self::FirstUserExtension, + _ => Self::Undefined, + } + } +} + +/// Flags for PxBase. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxBaseFlag { + OwnsMemory = 1, + IsReleasable = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxBaseFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxBaseFlags: u16 { + const OwnsMemory = 1 << 0; + const IsReleasable = 1 << 1; + } +} + +/// Flags used to configure binary meta data entries, typically set through PX_DEF_BIN_METADATA defines. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMetaDataFlag { + /// declares a class + Class = 1, + /// declares class to be virtual + Virtual = 2, + /// declares a typedef + Typedef = 4, + /// declares a pointer + Ptr = 8, + /// declares a handle + Handle = 16, + /// declares extra data exported with PxSerializer::exportExtraData + ExtraData = 32, + /// specifies one element of extra data + ExtraItem = 64, + /// specifies an array of extra data + ExtraItems = 128, + /// specifies a name of extra data + ExtraName = 256, + /// declares a union + Union = 512, + /// declares explicit padding data + Padding = 1024, + /// declares aligned data + Alignment = 2048, + /// specifies that the count value's most significant bit needs to be masked out + CountMaskMsb = 4096, + /// specifies that the count value is treated as zero for a variable value of one - special case for single triangle meshes + CountSkipIfOne = 8192, + /// specifies that the control value is the negate of the variable value + ControlFlip = 16384, + /// specifies that the control value is masked - mask bits are assumed to be within eCONTROL_MASK_RANGE + ControlMask = 32768, + /// mask range allowed for eCONTROL_MASK + ControlMaskRange = 255, + ForceDword = 2147483647, +} + +/// Identifies the type of each heavyweight PxTask object +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxTaskType { + /// PxTask will be run on the CPU + Cpu = 0, + /// Return code when attempting to find a task that does not exist + NotPresent = 1, + /// PxTask execution has been completed + Completed = 2, +} + +/// A geometry type. +/// +/// Used to distinguish the type of a ::PxGeometry object. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxGeometryType { + Sphere = 0, + Plane = 1, + Capsule = 2, + Box = 3, + Convexmesh = 4, + Particlesystem = 5, + Tetrahedronmesh = 6, + Trianglemesh = 7, + Heightfield = 8, + Hairsystem = 9, + Custom = 10, + /// internal use only! + GeometryCount = 11, + /// internal use only! + Invalid = -1, +} + +/// Geometry-level query flags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxGeometryQueryFlag { + /// Saves/restores SIMD control word for each query (safer but slower). Omit this if you took care of it yourself in your app. + SimdGuard = 1, +} + +bitflags::bitflags! { + /// Flags for [`PxGeometryQueryFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxGeometryQueryFlags: u32 { + const SimdGuard = 1 << 0; + } +} + +/// Desired build strategy for bounding-volume hierarchies +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxBVHBuildStrategy { + /// Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime cooking. + Fast = 0, + /// Default build strategy. Medium build speed, good runtime performance in all cases. + Default = 1, + /// SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + Sah = 2, + Last = 3, +} + +/// Flags controlling the simulated behavior of the convex mesh geometry. +/// +/// Used in ::PxConvexMeshGeometryFlags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConvexMeshGeometryFlag { + /// Use tighter (but more expensive to compute) bounds around the convex geometry. + TightBounds = 1, +} + +bitflags::bitflags! { + /// Flags for [`PxConvexMeshGeometryFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxConvexMeshGeometryFlags: u8 { + const TightBounds = 1 << 0; + } +} + +/// Flags controlling the simulated behavior of the triangle mesh geometry. +/// +/// Used in ::PxMeshGeometryFlags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshGeometryFlag { + /// Use tighter (but more expensive to compute) bounds around the triangle mesh geometry. + TightBounds = 1, + /// Meshes with this flag set are treated as double-sided. + /// This flag is currently only used for raycasts and sweeps (it is ignored for overlap queries). + /// For detailed specifications of this flag for meshes and heightfields please refer to the Geometry Query section of the user guide. + DoubleSided = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxMeshGeometryFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxMeshGeometryFlags: u8 { + const TightBounds = 1 << 0; + const DoubleSided = 1 << 1; + } +} + +/// Identifies the solver to use for a particle system. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxParticleSolverType { + /// The position based dynamics solver that can handle fluid, granular material, cloth, inflatables etc. See [`PxPBDParticleSystem`]. + Pbd = 1, + /// The FLIP fluid solver. See [`PxFLIPParticleSystem`]. + Flip = 2, + /// The MPM (material point method) solver that can handle a variety of materials. See [`PxMPMParticleSystem`]. + Mpm = 4, + /// Custom solver. The user needs to specify the interaction of the particle by providing appropriate functions. Can be used e.g. for molecular dynamics simulations. See [`PxCustomParticleSystem`]. + Custom = 8, +} + +/// Scene query and geometry query behavior flags. +/// +/// PxHitFlags are used for 3 different purposes: +/// +/// 1) To request hit fields to be filled in by scene queries (such as hit position, normal, face index or UVs). +/// 2) Once query is completed, to indicate which fields are valid (note that a query may produce more valid fields than requested). +/// 3) To specify additional options for the narrow phase and mid-phase intersection routines. +/// +/// All these flags apply to both scene queries and geometry queries (PxGeometryQuery). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHitFlag { + /// "position" member of [`PxQueryHit`] is valid + Position = 1, + /// "normal" member of [`PxQueryHit`] is valid + Normal = 2, + /// "u" and "v" barycentric coordinates of [`PxQueryHit`] are valid. Not applicable to sweep queries. + Uv = 8, + /// Performance hint flag for sweeps when it is known upfront there's no initial overlap. + /// NOTE: using this flag may cause undefined results if shapes are initially overlapping. + AssumeNoInitialOverlap = 16, + /// Report any first hit. Used for geometries that contain more than one primitive. For meshes, + /// if neither eMESH_MULTIPLE nor eANY_HIT is specified, a single closest hit will be reported. + AnyHit = 32, + /// Report all hits for meshes rather than just the first. Not applicable to sweep queries. + MeshMultiple = 64, + /// Report hits with back faces of mesh triangles. Also report hits for raycast + /// originating on mesh surface and facing away from the surface normal. Not applicable to sweep queries. + /// Please refer to the user guide for heightfield-specific differences. + MeshBothSides = 128, + /// Use more accurate but slower narrow phase sweep tests. + /// May provide better compatibility with PhysX 3.2 sweep behavior. + PreciseSweep = 256, + /// Report the minimum translation depth, normal and contact point. + Mtd = 512, + /// "face index" member of [`PxQueryHit`] is valid + FaceIndex = 1024, + Default = 1027, + /// Only this subset of flags can be modified by pre-filter. Other modifications will be discarded. + ModifiableFlags = 464, +} + +bitflags::bitflags! { + /// Flags for [`PxHitFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxHitFlags: u16 { + const Position = 1 << 0; + const Normal = 1 << 1; + const Uv = 1 << 3; + const AssumeNoInitialOverlap = 1 << 4; + const AnyHit = 1 << 5; + const MeshMultiple = 1 << 6; + const MeshBothSides = 1 << 7; + const PreciseSweep = 1 << 8; + const Mtd = 1 << 9; + const FaceIndex = 1 << 10; + const Default = Self::Position.bits | Self::Normal.bits | Self::FaceIndex.bits; + const ModifiableFlags = Self::AssumeNoInitialOverlap.bits | Self::MeshMultiple.bits | Self::MeshBothSides.bits | Self::PreciseSweep.bits; + } +} + +/// Describes the format of height field samples. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHeightFieldFormat { + /// Height field height data is 16 bit signed integers, followed by triangle materials. + /// + /// Each sample is 32 bits wide arranged as follows: + /// + /// 1) First there is a 16 bit height value. + /// 2) Next, two one byte material indices, with the high bit of each byte reserved for special use. + /// (so the material index is only 7 bits). + /// The high bit of material0 is the tess-flag. + /// The high bit of material1 is reserved for future use. + /// + /// There are zero or more unused bytes before the next sample depending on PxHeightFieldDesc.sampleStride, + /// where the application may eventually keep its own data. + /// + /// This is the only format supported at the moment. + S16Tm = 1, +} + +/// Determines the tessellation of height field cells. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHeightFieldTessFlag { + /// This flag determines which way each quad cell is subdivided. + /// + /// The flag lowered indicates subdivision like this: (the 0th vertex is referenced by only one triangle) + /// + /// +--+--+--+---> column + /// | /| /| /| + /// |/ |/ |/ | + /// +--+--+--+ + /// | /| /| /| + /// |/ |/ |/ | + /// +--+--+--+ + /// | + /// | + /// V row + /// + /// The flag raised indicates subdivision like this: (the 0th vertex is shared by two triangles) + /// + /// +--+--+--+---> column + /// | + /// \ + /// | + /// \ + /// | + /// \ + /// | + /// | + /// \ + /// | + /// \ + /// | + /// \ + /// | + /// +--+--+--+ + /// | + /// \ + /// | + /// \ + /// | + /// \ + /// | + /// | + /// \ + /// | + /// \ + /// | + /// \ + /// | + /// +--+--+--+ + /// | + /// | + /// V row + E0ThVertexShared = 1, +} + +/// Enum with flag values to be used in PxHeightFieldDesc.flags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHeightFieldFlag { + /// Disable collisions with height field with boundary edges. + /// + /// Raise this flag if several terrain patches are going to be placed adjacent to each other, + /// to avoid a bump when sliding across. + /// + /// This flag is ignored in contact generation with sphere and capsule shapes. + NoBoundaryEdges = 1, +} + +bitflags::bitflags! { + /// Flags for [`PxHeightFieldFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxHeightFieldFlags: u16 { + const NoBoundaryEdges = 1 << 0; + } +} + +/// Special material index values for height field samples. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHeightFieldMaterial { + /// A material indicating that the triangle should be treated as a hole in the mesh. + Hole = 127, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshMeshQueryFlag { + /// Report all overlaps + Default = 0, + /// Ignore coplanar triangle-triangle overlaps + DiscardCoplanar = 1, +} + +bitflags::bitflags! { + /// Flags for [`PxMeshMeshQueryFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxMeshMeshQueryFlags: u32 { + const DiscardCoplanar = 1 << 0; + } +} + +/// Enum with flag values to be used in PxSimpleTriangleMesh::flags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshFlag { + /// Specifies if the SDK should flip normals. + /// + /// The PhysX libraries assume that the face normal of a triangle with vertices [a,b,c] can be computed as: + /// edge1 = b-a + /// edge2 = c-a + /// face_normal = edge1 x edge2. + /// + /// Note: This is the same as a counterclockwise winding in a right handed coordinate system or + /// alternatively a clockwise winding order in a left handed coordinate system. + /// + /// If this does not match the winding order for your triangles, raise the below flag. + Flipnormals = 1, + /// Denotes the use of 16-bit vertex indices + E16BitIndices = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxMeshFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxMeshFlags: u16 { + const Flipnormals = 1 << 0; + const E16BitIndices = 1 << 1; + } +} + +/// Mesh midphase structure. This enum is used to select the desired acceleration structure for midphase queries +/// (i.e. raycasts, overlaps, sweeps vs triangle meshes). +/// +/// The PxMeshMidPhase::eBVH33 structure is the one used in recent PhysX versions (up to PhysX 3.3). It has great performance and is +/// supported on all platforms. It is deprecated since PhysX 5.x. +/// +/// The PxMeshMidPhase::eBVH34 structure is a revisited implementation introduced in PhysX 3.4. It can be significantly faster both +/// in terms of cooking performance and runtime performance. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshMidPhase { + /// Default midphase mesh structure, as used up to PhysX 3.3 (deprecated) + Bvh33 = 0, + /// New midphase mesh structure, introduced in PhysX 3.4 + Bvh34 = 1, + Last = 2, +} + +/// Flags for the mesh geometry properties. +/// +/// Used in ::PxTriangleMeshFlags. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxTriangleMeshFlag { + /// The triangle mesh has 16bits vertex indices. + E16BitIndices = 2, + /// The triangle mesh has adjacency information build. + AdjacencyInfo = 4, + /// Indicates that this mesh would preferably not be the mesh projected for mesh-mesh collision. This can indicate that the mesh is not well tessellated. + PreferNoSdfProj = 8, +} + +bitflags::bitflags! { + /// Flags for [`PxTriangleMeshFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxTriangleMeshFlags: u8 { + const E16BitIndices = 1 << 1; + const AdjacencyInfo = 1 << 2; + const PreferNoSdfProj = 1 << 3; + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxTetrahedronMeshFlag { + /// The tetrahedron mesh has 16bits vertex indices + E16BitIndices = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxTetrahedronMeshFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxTetrahedronMeshFlags: u8 { + const E16BitIndices = 1 << 1; + } +} + +/// Flags which control the behavior of an actor. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxActorFlag { + /// Enable debug renderer for this actor + Visualization = 1, + /// Disables scene gravity for this actor + DisableGravity = 2, + /// Enables the sending of PxSimulationEventCallback::onWake() and PxSimulationEventCallback::onSleep() notify events + SendSleepNotifies = 4, + /// Disables simulation for the actor. + /// + /// This is only supported by PxRigidStatic and PxRigidDynamic actors and can be used to reduce the memory footprint when rigid actors are + /// used for scene queries only. + /// + /// Setting this flag will remove all constraints attached to the actor from the scene. + /// + /// If this flag is set, the following calls are forbidden: + /// + /// PxRigidBody: setLinearVelocity(), setAngularVelocity(), addForce(), addTorque(), clearForce(), clearTorque(), setForceAndTorque() + /// + /// PxRigidDynamic: setKinematicTarget(), setWakeCounter(), wakeUp(), putToSleep() + /// + /// Sleeping: + /// Raising this flag will set all velocities and the wake counter to 0, clear all forces, clear the kinematic target, put the actor + /// to sleep and wake up all touching actors from the previous frame. + DisableSimulation = 8, +} + +bitflags::bitflags! { + /// Flags for [`PxActorFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxActorFlags: u8 { + const Visualization = 1 << 0; + const DisableGravity = 1 << 1; + const SendSleepNotifies = 1 << 2; + const DisableSimulation = 1 << 3; + } +} + +/// Identifies each type of actor. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxActorType { + /// A static rigid body + RigidStatic = 0, + /// A dynamic rigid body + RigidDynamic = 1, + /// An articulation link + ArticulationLink = 2, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxAggregateType { + /// Aggregate will contain various actors of unspecified types + Generic = 0, + /// Aggregate will only contain static actors + Static = 1, + /// Aggregate will only contain kinematic actors + Kinematic = 2, +} + +/// Constraint row flags +/// +/// These flags configure the post-processing of constraint rows and the behavior of the solver while solving constraints +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum Px1DConstraintFlag { + /// whether the constraint is a spring. Mutually exclusive with eRESTITUTION. If set, eKEEPBIAS is ignored. + Spring = 1, + /// whether the constraint is a force or acceleration spring. Only valid if eSPRING is set. + AccelerationSpring = 2, + /// whether the restitution model should be applied to generate the target velocity. Mutually exclusive with eSPRING. If restitution causes a bounces, eKEEPBIAS is ignored + Restitution = 4, + /// whether to keep the error term when solving for velocity. Ignored if restitution generates bounce, or eSPRING is set. + Keepbias = 8, + /// whether to accumulate the force value from this constraint in the force total that is reported for the constraint and tested for breakage + OutputForce = 16, + /// whether the constraint has a drive force limit (which will be scaled by dt unless PxConstraintFlag::eLIMITS_ARE_FORCES is set) + HasDriveLimit = 32, + /// whether this is an angular or linear constraint + AngularConstraint = 64, + /// whether the constraint's geometric error should drive the target velocity + DriveRow = 128, +} + +bitflags::bitflags! { + /// Flags for [`Px1DConstraintFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct Px1DConstraintFlags: u16 { + const Spring = 1 << 0; + const AccelerationSpring = 1 << 1; + const Restitution = 1 << 2; + const Keepbias = 1 << 3; + const OutputForce = 1 << 4; + const HasDriveLimit = 1 << 5; + const AngularConstraint = 1 << 6; + const DriveRow = 1 << 7; + } +} + +/// Constraint type hints which the solver uses to optimize constraint handling +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConstraintSolveHint { + /// no special properties + None = 0, + /// a group of acceleration drive constraints with the same stiffness and drive parameters + Acceleration1 = 256, + /// temporary special value to identify SLERP drive rows + SlerpSpring = 258, + /// a group of acceleration drive constraints with the same stiffness and drive parameters + Acceleration2 = 512, + /// a group of acceleration drive constraints with the same stiffness and drive parameters + Acceleration3 = 768, + /// rotational equality constraints with no force limit and no velocity target + RotationalEquality = 1024, + /// rotational inequality constraints with (0, PX_MAX_FLT) force limits + RotationalInequality = 1025, + /// equality constraints with no force limit and no velocity target + Equality = 2048, + /// inequality constraints with (0, PX_MAX_FLT) force limits + Inequality = 2049, +} + +/// Flags for determining which components of the constraint should be visualized. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConstraintVisualizationFlag { + /// visualize constraint frames + LocalFrames = 1, + /// visualize constraint limits + Limits = 2, +} + +/// Flags for determining how PVD should serialize a constraint update +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPvdUpdateType { + /// triggers createPvdInstance call, creates an instance of a constraint + CreateInstance = 0, + /// triggers releasePvdInstance call, releases an instance of a constraint + ReleaseInstance = 1, + /// triggers updatePvdProperties call, updates all properties of a constraint + UpdateAllProperties = 2, + /// triggers simUpdate call, updates all simulation properties of a constraint + UpdateSimProperties = 3, +} + +/// Constraint descriptor used inside the solver +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum ConstraintType { + /// Defines this pair is a contact constraint + ContactConstraint = 0, + /// Defines this pair is a joint constraint + JointConstraint = 1, +} + +/// Data structure used for preparing constraints before solving them +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum BodyState { + DynamicBody = 1, + StaticBody = 2, + KinematicBody = 4, + Articulation = 8, +} + +/// @ +/// { +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationAxis { + /// Rotational about eX + Twist = 0, + /// Rotational about eY + Swing1 = 1, + /// Rotational about eZ + Swing2 = 2, + /// Linear in eX + X = 3, + /// Linear in eY + Y = 4, + /// Linear in eZ + Z = 5, + Count = 6, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationMotion { + /// Locked axis, i.e. degree of freedom (DOF) + Locked = 0, + /// Limited DOF - set limits of joint DOF together with this flag, see PxArticulationJointReducedCoordinate::setLimitParams + Limited = 1, + /// Free DOF + Free = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxArticulationMotion`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxArticulationMotions: u8 { + const Limited = 1 << 0; + const Free = 1 << 1; + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationJointType { + /// All joint axes, i.e. degrees of freedom (DOFs) locked + Fix = 0, + /// Single linear DOF, e.g. cart on a rail + Prismatic = 1, + /// Single rotational DOF, e.g. an elbow joint or a rotational motor, position wrapped at 2pi radians + Revolute = 2, + /// Single rotational DOF, e.g. an elbow joint or a rotational motor, position not wrapped + RevoluteUnwrapped = 3, + /// Ball and socket joint with two or three DOFs + Spherical = 4, + Undefined = 5, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationFlag { + /// Set articulation base to be fixed. + FixBase = 1, + /// Limits for drive effort are forces and torques rather than impulses, see PxArticulationDrive::maxForce. + DriveLimitsAreForces = 2, + /// Disable collisions between the articulation's links (note that parent/child collisions are disabled internally in either case). + DisableSelfCollision = 4, + /// Enable in order to be able to query joint solver (i.e. constraint) forces using PxArticulationCache::jointSolverForces. + ComputeJointForces = 8, +} + +bitflags::bitflags! { + /// Flags for [`PxArticulationFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxArticulationFlags: u8 { + const FixBase = 1 << 0; + const DriveLimitsAreForces = 1 << 1; + const DisableSelfCollision = 1 << 2; + const ComputeJointForces = 1 << 3; + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationDriveType { + /// The output of the implicit spring drive controller is a force/torque. + Force = 0, + /// The output of the implicit spring drive controller is a joint acceleration (use this to get (spatial)-inertia-invariant behavior of the drive). + Acceleration = 1, + /// Sets the drive gains internally to track a target position almost kinematically (i.e. with very high drive gains). + Target = 2, + /// Sets the drive gains internally to track a target velocity almost kinematically (i.e. with very high drive gains). + Velocity = 3, + None = 4, +} + +/// A description of the types of articulation data that may be directly written to and read from the GPU using the functions +/// PxScene::copyArticulationData() and PxScene::applyArticulationData(). Types that are read-only may only be used in conjunction with +/// PxScene::copyArticulationData(). Types that are write-only may only be used in conjunction with PxScene::applyArticulationData(). +/// A subset of data types may be used in conjunction with both PxScene::applyArticulationData() and PxScene::applyArticulationData(). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationGpuDataType { + /// The joint positions, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + JointPosition = 0, + /// The joint velocities, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + JointVelocity = 1, + /// The joint accelerations, read only, see PxScene::copyArticulationData() + JointAcceleration = 2, + /// The applied joint forces, write only, see PxScene::applyArticulationData() + JointForce = 3, + /// The computed joint constraint solver forces, read only, see PxScene::copyArticulationData()() + JointSolverForce = 4, + /// The velocity targets for the joint drives, write only, see PxScene::applyArticulationData() + JointTargetVelocity = 5, + /// The position targets for the joint drives, write only, see PxScene::applyArticulationData() + JointTargetPosition = 6, + /// The spatial sensor forces, read only, see PxScene::copyArticulationData() + SensorForce = 7, + /// The root link transform, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + RootTransform = 8, + /// The root link velocity, read and write, see PxScene::copyArticulationData(), PxScene::applyArticulationData() + RootVelocity = 9, + /// The link transforms including root link, read only, see PxScene::copyArticulationData() + LinkTransform = 10, + /// The link velocities including root link, read only, see PxScene::copyArticulationData() + LinkVelocity = 11, + /// The forces to apply to links, write only, see PxScene::applyArticulationData() + LinkForce = 12, + /// The torques to apply to links, write only, see PxScene::applyArticulationData() + LinkTorque = 13, + /// Fixed tendon data, write only, see PxScene::applyArticulationData() + FixedTendon = 14, + /// Fixed tendon joint data, write only, see PxScene::applyArticulationData() + FixedTendonJoint = 15, + /// Spatial tendon data, write only, see PxScene::applyArticulationData() + SpatialTendon = 16, + /// Spatial tendon attachment data, write only, see PxScene::applyArticulationData() + SpatialTendonAttachment = 17, +} + +/// 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; + } +} + +/// Flag that configures articulation-state updates by PxArticulationReducedCoordinate::updateKinematic. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxArticulationKinematicFlag { + /// Raise after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + Position = 1, + /// Raise after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities. + Velocity = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxArticulationKinematicFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxArticulationKinematicFlags: u8 { + const Position = 1 << 0; + const Velocity = 1 << 1; + } +} + +/// 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; + } +} + +/// Parameter to addForce() and addTorque() calls, determines the exact operation that is carried out. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxForceMode { + /// parameter has unit of mass * length / time^2, i.e., a force + Force = 0, + /// parameter has unit of mass * length / time, i.e., force * time + Impulse = 1, + /// parameter has unit of length / time, i.e., the effect is mass independent: a velocity change. + VelocityChange = 2, + /// parameter has unit of length/ time^2, i.e., an acceleration. It gets treated just like a force except the mass is not divided out before integration. + Acceleration = 3, +} + +/// Collection of flags describing the behavior of a rigid body. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxRigidBodyFlag { + /// Enable kinematic mode for the body. + Kinematic = 1, + /// Use the kinematic target transform for scene queries. + /// + /// If this flag is raised, then scene queries will treat the kinematic target transform as the current pose + /// of the body (instead of using the actual pose). Without this flag, the kinematic target will only take + /// effect with respect to scene queries after a simulation step. + UseKinematicTargetForSceneQueries = 2, + /// Enable CCD for the body. + EnableCcd = 4, + /// Enabled CCD in swept integration for the actor. + /// + /// If this flag is raised and CCD is enabled, CCD interactions will simulate friction. By default, friction is disabled in CCD interactions because + /// CCD friction has been observed to introduce some simulation artifacts. CCD friction was enabled in previous versions of the SDK. Raising this flag will result in behavior + /// that is a closer match for previous versions of the SDK. + /// + /// This flag requires PxRigidBodyFlag::eENABLE_CCD to be raised to have any effect. + EnableCcdFriction = 8, + /// Register a rigid body to dynamically adjust contact offset based on velocity. This can be used to achieve a CCD effect. + /// + /// If both eENABLE_CCD and eENABLE_SPECULATIVE_CCD are set on the same body, then angular motions are handled by speculative + /// contacts (eENABLE_SPECULATIVE_CCD) while linear motions are handled by sweeps (eENABLE_CCD). + EnableSpeculativeCcd = 16, + /// Register a rigid body for reporting pose changes by the simulation at an early stage. + /// + /// Sometimes it might be advantageous to get access to the new pose of a rigid body as early as possible and + /// not wait until the call to fetchResults() returns. Setting this flag will schedule the rigid body to get reported + /// in [`PxSimulationEventCallback::onAdvance`](). Please refer to the documentation of that callback to understand + /// the behavior and limitations of this functionality. + EnablePoseIntegrationPreview = 32, + /// Permit CCD to limit maxContactImpulse. This is useful for use-cases like a destruction system but can cause visual artefacts so is not enabled by default. + EnableCcdMaxContactImpulse = 64, + /// Carries over forces/accelerations between frames, rather than clearing them + RetainAccelerations = 128, + /// Forces kinematic-kinematic pairs notifications for this actor. + /// + /// This flag overrides the global scene-level PxPairFilteringMode setting for kinematic actors. + /// This is equivalent to having PxPairFilteringMode::eKEEP for pairs involving this actor. + /// + /// A particular use case is when you have a large amount of kinematic actors, but you are only + /// interested in interactions between a few of them. In this case it is best to use + /// PxSceneDesc.kineKineFilteringMode = PxPairFilteringMode::eKILL, and then raise the + /// eFORCE_KINE_KINE_NOTIFICATIONS flag on the small set of kinematic actors that need + /// notifications. + /// + /// This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + /// + /// Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + ForceKineKineNotifications = 256, + /// Forces static-kinematic pairs notifications for this actor. + /// + /// Similar to eFORCE_KINE_KINE_NOTIFICATIONS, but for static-kinematic interactions. + /// + /// This has no effect if PxRigidBodyFlag::eKINEMATIC is not set. + /// + /// Changing this flag at runtime will not have an effect until you remove and re-add the actor to the scene. + ForceStaticKineNotifications = 512, + /// Enables computation of gyroscopic forces on the rigid body. + EnableGyroscopicForces = 1024, +} + +bitflags::bitflags! { + /// 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; + } +} + +/// constraint flags +/// +/// eBROKEN is a read only flag +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConstraintFlag { + /// whether the constraint is broken + Broken = 1, + /// whether actor1 should get projected to actor0 for this constraint (note: projection of a static/kinematic actor to a dynamic actor will be ignored) + ProjectToActor0 = 2, + /// whether actor0 should get projected to actor1 for this constraint (note: projection of a static/kinematic actor to a dynamic actor will be ignored) + ProjectToActor1 = 4, + /// whether the actors should get projected for this constraint (the direction will be chosen by PhysX) + Projection = 6, + /// whether contacts should be generated between the objects this constraint constrains + CollisionEnabled = 8, + /// whether this constraint should be visualized, if constraint visualization is turned on + Visualization = 16, + /// limits for drive strength are forces rather than impulses + DriveLimitsAreForces = 32, + /// perform preprocessing for improved accuracy on D6 Slerp Drive (this flag will be removed in a future release when preprocessing is no longer required) + ImprovedSlerp = 128, + /// suppress constraint preprocessing, intended for use with rowResponseThreshold. May result in worse solver accuracy for ill-conditioned constraints. + DisablePreprocessing = 256, + /// enables extended limit ranges for angular limits (e.g., limit values > PxPi or + /// < + /// -PxPi) + EnableExtendedLimits = 512, + /// the constraint type is supported by gpu dynamics + GpuCompatible = 1024, + /// updates the constraint each frame + AlwaysUpdate = 2048, + /// disables the constraint. SolverPrep functions won't be called for this constraint. + DisableConstraint = 4096, +} + +bitflags::bitflags! { + /// Flags for [`PxConstraintFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxConstraintFlags: u16 { + const Broken = 1 << 0; + const ProjectToActor0 = 1 << 1; + const ProjectToActor1 = 1 << 2; + const Projection = Self::ProjectToActor0.bits | Self::ProjectToActor1.bits; + const CollisionEnabled = 1 << 3; + const Visualization = 1 << 4; + const DriveLimitsAreForces = 1 << 5; + const ImprovedSlerp = 1 << 7; + const DisablePreprocessing = 1 << 8; + const EnableExtendedLimits = 1 << 9; + const GpuCompatible = 1 << 10; + const AlwaysUpdate = 1 << 11; + const DisableConstraint = 1 << 12; + } +} + +/// Header for a contact patch where all points share same material and normal +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxContactPatchFlags { + /// Indicates this contact stream has face indices. + HasFaceIndices = 1, + /// Indicates this contact stream is modifiable. + Modifiable = 2, + /// Indicates this contact stream is notify-only (no contact response). + ForceNoResponse = 4, + /// Indicates this contact stream has modified mass ratios + HasModifiedMassRatios = 8, + /// Indicates this contact stream has target velocities set + HasTargetVelocity = 16, + /// Indicates this contact stream has max impulses set + HasMaxImpulse = 32, + /// Indicates this contact stream needs patches re-generated. This is required if the application modified either the contact normal or the material properties + RegeneratePatches = 64, + CompressedModifiedContact = 128, +} + +/// A class to iterate over a compressed contact stream. This supports read-only access to the various contact formats. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum StreamFormat { + SimpleStream = 0, + ModifiableStream = 1, + CompressedModifiableStream = 2, +} + +/// Flags specifying deletion event types. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxDeletionEventFlag { + /// The user has called release on an object. + UserRelease = 1, + /// The destructor of an object has been called and the memory has been released. + MemoryRelease = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxDeletionEventFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxDeletionEventFlags: u8 { + const UserRelease = 1 << 0; + const MemoryRelease = 1 << 1; + } +} + +/// Collection of flags describing the actions to take for a collision pair. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPairFlag { + /// Process the contacts of this collision pair in the dynamics solver. + /// + /// Only takes effect if the colliding actors are rigid bodies. + SolveContact = 1, + /// Call contact modification callback for this collision pair + /// + /// Only takes effect if the colliding actors are rigid bodies. + ModifyContacts = 2, + /// Call contact report callback or trigger callback when this collision pair starts to be in contact. + /// + /// If one of the two collision objects is a trigger shape (see [`PxShapeFlag::eTRIGGER_SHAPE`]) + /// then the trigger callback will get called as soon as the other object enters the trigger volume. + /// If none of the two collision objects is a trigger shape then the contact report callback will get + /// called when the actors of this collision pair start to be in contact. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyTouchFound = 4, + /// Call contact report callback while this collision pair is in contact + /// + /// If none of the two collision objects is a trigger shape then the contact report callback will get + /// called while the actors of this collision pair are in contact. + /// + /// Triggers do not support this event. Persistent trigger contacts need to be tracked separately by observing eNOTIFY_TOUCH_FOUND/eNOTIFY_TOUCH_LOST events. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// No report will get sent if the objects in contact are sleeping. + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + /// + /// If this flag gets enabled while a pair is in touch already, there will be no eNOTIFY_TOUCH_PERSISTS events until the pair loses and regains touch. + NotifyTouchPersists = 8, + /// Call contact report callback or trigger callback when this collision pair stops to be in contact + /// + /// If one of the two collision objects is a trigger shape (see [`PxShapeFlag::eTRIGGER_SHAPE`]) + /// then the trigger callback will get called as soon as the other object leaves the trigger volume. + /// If none of the two collision objects is a trigger shape then the contact report callback will get + /// called when the actors of this collision pair stop to be in contact. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// This event will also get triggered if one of the colliding objects gets deleted. + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyTouchLost = 16, + /// Call contact report callback when this collision pair is in contact during CCD passes. + /// + /// If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same + /// object multiple times. Hence, the same pair might be in contact multiple times during a simulation step. + /// This flag will make sure that all the detected collision during CCD will get reported. For performance + /// reasons, the system can not always tell whether the contact pair lost touch in one of the previous CCD + /// passes and thus can also not always tell whether the contact is new or has persisted. eNOTIFY_TOUCH_CCD + /// just reports when the two collision objects were detected as being in contact during a CCD pass. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// Trigger shapes are not supported. + /// + /// Only takes effect if eDETECT_CCD_CONTACT is raised + NotifyTouchCcd = 32, + /// Call contact report callback when the contact force between the actors of this collision pair exceeds one of the actor-defined force thresholds. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyThresholdForceFound = 64, + /// Call contact report callback when the contact force between the actors of this collision pair continues to exceed one of the actor-defined force thresholds. + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the + /// previous one (unless [`eNOTIFY_THRESHOLD_FORCE_FOUND`] has been set in the previous frame). + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyThresholdForcePersists = 128, + /// Call contact report callback when the contact force between the actors of this collision pair falls below one of the actor-defined force thresholds (includes the case where this collision pair stops being in contact). + /// + /// Only takes effect if the colliding actors are rigid bodies. + /// + /// If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the + /// previous one (unless [`eNOTIFY_THRESHOLD_FORCE_FOUND`] or #eNOTIFY_THRESHOLD_FORCE_PERSISTS has been set in the previous frame). + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyThresholdForceLost = 256, + /// Provide contact points in contact reports for this collision pair. + /// + /// Only takes effect if the colliding actors are rigid bodies and if used in combination with the flags eNOTIFY_TOUCH_... or eNOTIFY_THRESHOLD_FORCE_... + /// + /// Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised + NotifyContactPoints = 512, + /// This flag is used to indicate whether this pair generates discrete collision detection contacts. + /// + /// Contacts are only responded to if eSOLVE_CONTACT is enabled. + DetectDiscreteContact = 1024, + /// This flag is used to indicate whether this pair generates CCD contacts. + /// + /// The contacts will only be responded to if eSOLVE_CONTACT is enabled on this pair. + /// + /// The scene must have PxSceneFlag::eENABLE_CCD enabled to use this feature. + /// + /// Non-static bodies of the pair should have PxRigidBodyFlag::eENABLE_CCD specified for this feature to work correctly. + /// + /// This flag is not supported with trigger shapes. However, CCD trigger events can be emulated using non-trigger shapes + /// and requesting eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST and not raising eSOLVE_CONTACT on the pair. + DetectCcdContact = 2048, + /// Provide pre solver velocities in contact reports for this collision pair. + /// + /// If the collision pair has contact reports enabled, the velocities of the rigid bodies before contacts have been solved + /// will be provided in the contact report callback unless the pair lost touch in which case no data will be provided. + /// + /// Usually it is not necessary to request these velocities as they will be available by querying the velocity from the provided + /// PxRigidActor object directly. However, it might be the case that the velocity of a rigid body gets set while the simulation is running + /// in which case the PxRigidActor would return this new velocity in the contact report callback and not the velocity the simulation used. + PreSolverVelocity = 4096, + /// Provide post solver velocities in contact reports for this collision pair. + /// + /// If the collision pair has contact reports enabled, the velocities of the rigid bodies after contacts have been solved + /// will be provided in the contact report callback unless the pair lost touch in which case no data will be provided. + PostSolverVelocity = 8192, + /// Provide rigid body poses in contact reports for this collision pair. + /// + /// If the collision pair has contact reports enabled, the rigid body poses at the contact event will be provided + /// in the contact report callback unless the pair lost touch in which case no data will be provided. + /// + /// Usually it is not necessary to request these poses as they will be available by querying the pose from the provided + /// PxRigidActor object directly. However, it might be the case that the pose of a rigid body gets set while the simulation is running + /// in which case the PxRigidActor would return this new pose in the contact report callback and not the pose the simulation used. + /// Another use case is related to CCD with multiple passes enabled, A fast moving object might bounce on and off the same + /// object multiple times. This flag can be used to request the rigid body poses at the time of impact for each such collision event. + ContactEventPose = 16384, + /// For internal use only. + NextFree = 32768, + /// Provided default flag to do simple contact processing for this collision pair. + ContactDefault = 1025, + /// Provided default flag to get commonly used trigger behavior for this collision pair. + TriggerDefault = 1044, +} + +bitflags::bitflags! { + /// Flags for [`PxPairFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxPairFlags: u16 { + const SolveContact = 1 << 0; + const ModifyContacts = 1 << 1; + const NotifyTouchFound = 1 << 2; + const NotifyTouchPersists = 1 << 3; + const NotifyTouchLost = 1 << 4; + const NotifyTouchCcd = 1 << 5; + const NotifyThresholdForceFound = 1 << 6; + const NotifyThresholdForcePersists = 1 << 7; + const NotifyThresholdForceLost = 1 << 8; + const NotifyContactPoints = 1 << 9; + const DetectDiscreteContact = 1 << 10; + const DetectCcdContact = 1 << 11; + const PreSolverVelocity = 1 << 12; + const PostSolverVelocity = 1 << 13; + const ContactEventPose = 1 << 14; + const NextFree = 1 << 15; + const ContactDefault = Self::SolveContact.bits | Self::DetectDiscreteContact.bits; + const TriggerDefault = Self::NotifyTouchFound.bits | Self::NotifyTouchLost.bits | Self::DetectDiscreteContact.bits; + } +} + +/// Collection of flags describing the filter actions to take for a collision pair. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxFilterFlag { + /// Ignore the collision pair as long as the bounding volumes of the pair objects overlap. + /// + /// Killed pairs will be ignored by the simulation and won't run through the filter again until one + /// of the following occurs: + /// + /// The bounding volumes of the two objects overlap again (after being separated) + /// + /// The user enforces a re-filtering (see [`PxScene::resetFiltering`]()) + Kill = 1, + /// Ignore the collision pair as long as the bounding volumes of the pair objects overlap or until filtering relevant data changes for one of the collision objects. + /// + /// Suppressed pairs will be ignored by the simulation and won't make another filter request until one + /// of the following occurs: + /// + /// Same conditions as for killed pairs (see [`eKILL`]) + /// + /// The filter data or the filter object attributes change for one of the collision objects + Suppress = 2, + /// Invoke the filter callback ([`PxSimulationFilterCallback::pairFound`]()) for this collision pair. + Callback = 4, + /// Track this collision pair with the filter callback mechanism. + /// + /// When the bounding volumes of the collision pair lose contact, the filter callback [`PxSimulationFilterCallback::pairLost`]() + /// will be invoked. Furthermore, the filter status of the collision pair can be adjusted through [`PxSimulationFilterCallback::statusChange`]() + /// once per frame (until a pairLost() notification occurs). + Notify = 12, + /// Provided default to get standard behavior: + /// + /// The application configure the pair's collision properties once when bounding volume overlap is found and + /// doesn't get asked again about that pair until overlap status or filter properties changes, or re-filtering is requested. + /// + /// No notification is provided when bounding volume overlap is lost + /// + /// The pair will not be killed or suppressed, so collision detection will be processed + Default = 0, +} + +bitflags::bitflags! { + /// Flags for [`PxFilterFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxFilterFlags: u16 { + const Kill = 1 << 0; + const Suppress = 1 << 1; + const Callback = 1 << 2; + const Notify = Self::Callback.bits; + } +} + +/// Identifies each type of filter object. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxFilterObjectType { + /// A static rigid body + RigidStatic = 0, + /// A dynamic rigid body + RigidDynamic = 1, + /// An articulation + Articulation = 2, + /// A particle system + Particlesystem = 3, + /// A FEM-based soft body + Softbody = 4, + /// A FEM-based cloth + /// + /// In development + Femcloth = 5, + /// A hair system + /// + /// In development + Hairsystem = 6, + /// internal use only! + MaxTypeCount = 16, + /// internal use only! + Undefined = 15, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxFilterObjectFlag { + Kinematic = 16, + Trigger = 32, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPairFilteringMode { + /// Output pair from BP, potentially send to user callbacks, create regular interaction object. + /// + /// Enable contact pair filtering between kinematic/static or kinematic/kinematic rigid bodies. + /// + /// By default contacts between these are suppressed (see [`PxFilterFlag::eSUPPRESS`]) and don't get reported to the filter mechanism. + /// Use this mode if these pairs should go through the filtering pipeline nonetheless. + /// + /// This mode is not mutable, and must be set in PxSceneDesc at scene creation. + Keep = 0, + /// Output pair from BP, create interaction marker. Can be later switched to regular interaction. + Suppress = 1, + /// Don't output pair from BP. Cannot be later switched to regular interaction, needs "resetFiltering" call. + Kill = 2, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxDataAccessFlag { + Readable = 1, + Writable = 2, + Device = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxDataAccessFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxDataAccessFlags: u8 { + const Readable = 1 << 0; + const Writable = 1 << 1; + const Device = 1 << 2; + } +} + +/// Flags which control the behavior of a material. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMaterialFlag { + /// If this flag is set, friction computations are always skipped between shapes with this material and any other shape. + DisableFriction = 1, + /// Whether to use strong friction. + /// The difference between "normal" and "strong" friction is that the strong friction feature + /// remembers the "friction error" between simulation steps. The friction is a force trying to + /// hold objects in place (or slow them down) and this is handled in the solver. But since the + /// solver is only an approximation, the result of the friction calculation can include a small + /// "error" - e.g. a box resting on a slope should not move at all if the static friction is in + /// action, but could slowly glide down the slope because of a small friction error in each + /// simulation step. The strong friction counter-acts this by remembering the small error and + /// taking it to account during the next simulation step. + /// + /// However, in some cases the strong friction could cause problems, and this is why it is + /// possible to disable the strong friction feature by setting this flag. One example is + /// raycast vehicles that are sliding fast across the surface, but still need a precise + /// steering behavior. It may be a good idea to reenable the strong friction when objects + /// are coming to a rest, to prevent them from slowly creeping down inclines. + /// + /// Note: This flag only has an effect if the PxMaterialFlag::eDISABLE_FRICTION bit is 0. + DisableStrongFriction = 2, + /// Whether to use the patch friction model. + /// This flag only has an effect if PxFrictionType::ePATCH friction model is used. + /// + /// When using the patch friction model, up to 2 friction anchors are generated per patch. As the number of friction anchors + /// can be smaller than the number of contacts, the normal force is accumulated over all contacts and used to compute friction + /// for all anchors. Where there are more than 2 anchors, this can produce frictional behavior that is too strong (approximately 2x as strong + /// as analytical models suggest). + /// + /// This flag causes the normal force to be distributed between the friction anchors such that the total amount of friction applied does not + /// exceed the analytical results. + ImprovedPatchFriction = 4, + /// This flag has the effect of enabling an implicit spring model for the normal force computation. + CompliantContact = 8, +} + +bitflags::bitflags! { + /// Flags for [`PxMaterialFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxMaterialFlags: u16 { + const DisableFriction = 1 << 0; + const DisableStrongFriction = 1 << 1; + const ImprovedPatchFriction = 1 << 2; + const CompliantContact = 1 << 3; + } +} + +/// Enumeration that determines the way in which two material properties will be combined to yield a friction or restitution coefficient for a collision. +/// +/// When two actors come in contact with each other, they each have materials with various coefficients, but we only need a single set of coefficients for the pair. +/// +/// Physics doesn't have any inherent combinations because the coefficients are determined empirically on a case by case +/// basis. However, simulating this with a pairwise lookup table is often impractical. +/// +/// For this reason the following combine behaviors are available: +/// +/// eAVERAGE +/// eMIN +/// eMULTIPLY +/// eMAX +/// +/// The effective combine mode for the pair is maximum(material0.combineMode, material1.combineMode). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxCombineMode { + /// Average: (a + b)/2 + Average = 0, + /// Minimum: minimum(a,b) + Min = 1, + /// Multiply: a*b + Multiply = 2, + /// Maximum: maximum(a,b) + Max = 3, + /// This is not a valid combine mode, it is a sentinel to denote the number of possible values. We assert that the variable's value is smaller than this. + NValues = 4, + /// This is not a valid combine mode, it is to assure that the size of the enum type is big enough. + Pad32 = 2147483647, +} + +/// Identifies dirty particle buffers that need to be updated in the particle system. +/// +/// This flag can be used mark the device user buffers that are dirty and need to be written to the particle system. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxParticleBufferFlag { + /// No data specified + None = 0, + /// Specifies the position (first 3 floats) and inverse mass (last float) data (array of PxVec4 * number of particles) + UpdatePosition = 1, + /// Specifies the velocity (first 3 floats) data (array of PxVec4 * number of particles) + UpdateVelocity = 2, + /// Specifies the per-particle phase flag data (array of PxU32 * number of particles) + UpdatePhase = 4, + /// Specifies the rest position (first 3 floats) data for cloth buffers + UpdateRestposition = 8, + /// Specifies the cloth buffer (see PxParticleClothBuffer) + UpdateCloth = 32, + /// Specifies the rigid buffer (see PxParticleRigidBuffer) + UpdateRigid = 64, + /// Specifies the diffuse particle parameter buffer (see PxDiffuseParticleParams) + UpdateDiffuseParam = 128, + /// Specifies the attachments. + UpdateAttachments = 256, + All = 495, +} + +bitflags::bitflags! { + /// Flags for [`PxParticleBufferFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxParticleBufferFlags: u32 { + const UpdatePosition = 1 << 0; + const UpdateVelocity = 1 << 1; + const UpdatePhase = 1 << 2; + const UpdateRestposition = 1 << 3; + const UpdateCloth = 1 << 5; + const UpdateRigid = 1 << 6; + const UpdateDiffuseParam = 1 << 7; + const UpdateAttachments = 1 << 8; + const All = Self::UpdatePosition.bits | Self::UpdateVelocity.bits | Self::UpdatePhase.bits | Self::UpdateRestposition.bits | Self::UpdateCloth.bits | Self::UpdateRigid.bits | Self::UpdateDiffuseParam.bits | Self::UpdateAttachments.bits; + } +} + +/// Identifies per-particle behavior for a PxParticleSystem. +/// +/// See [`PxParticleSystem::createPhase`](). +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u32)] +pub enum PxParticlePhaseFlag { + /// Bits [ 0, 19] represent the particle group for controlling collisions + ParticlePhaseGroupMask = 1048575, + /// Bits [20, 23] hold flags about how the particle behave + ParticlePhaseFlagsMask = 4293918720, + /// If set this particle will interact with particles of the same group + ParticlePhaseSelfCollide = 1048576, + /// If set this particle will ignore collisions with particles closer than the radius in the rest pose, this flag should not be specified unless valid rest positions have been specified using setRestParticles() + ParticlePhaseSelfCollideFilter = 2097152, + /// If set this particle will generate fluid density constraints for its overlapping neighbors + ParticlePhaseFluid = 4194304, +} + +bitflags::bitflags! { + /// Flags for [`PxParticlePhaseFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxParticlePhaseFlags: u32 { + const ParticlePhaseGroupMask = 0x000fffff; + const ParticlePhaseFlagsMask = Self::ParticlePhaseSelfCollide.bits | Self::ParticlePhaseSelfCollideFilter.bits | Self::ParticlePhaseFluid.bits; + const ParticlePhaseSelfCollide = 1 << 20; + const ParticlePhaseSelfCollideFilter = 1 << 21; + const ParticlePhaseFluid = 1 << 22; + } +} + +/// Specifies memory space for a PxBuffer instance. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxBufferType { + Host = 0, + Device = 1, +} + +/// Filtering flags for scene queries. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxQueryFlag { + /// Traverse static shapes + Static = 1, + /// Traverse dynamic shapes + Dynamic = 2, + /// Run the pre-intersection-test filter (see [`PxQueryFilterCallback::preFilter`]()) + Prefilter = 4, + /// Run the post-intersection-test filter (see [`PxQueryFilterCallback::postFilter`]()) + Postfilter = 8, + /// Abort traversal as soon as any hit is found and return it via callback.block. + /// Helps query performance. Both eTOUCH and eBLOCK hitTypes are considered hits with this flag. + AnyHit = 16, + /// All hits are reported as touching. Overrides eBLOCK returned from user filters with eTOUCH. + /// This is also an optimization hint that may improve query performance. + NoBlock = 32, + /// Same as eBATCH_QUERY_LEGACY_BEHAVIOUR, more explicit name making it clearer that this can also be used + /// with regular/non-batched queries if needed. + DisableHardcodedFilter = 64, + /// Reserved for internal use + Reserved = 32768, +} + +bitflags::bitflags! { + /// Flags for [`PxQueryFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxQueryFlags: u16 { + const Static = 1 << 0; + const Dynamic = 1 << 1; + const Prefilter = 1 << 2; + const Postfilter = 1 << 3; + const AnyHit = 1 << 4; + const NoBlock = 1 << 5; + const DisableHardcodedFilter = 1 << 6; + const Reserved = 1 << 15; + } +} + +/// Classification of scene query hits (intersections). +/// +/// - eNONE: Returning this hit type means that the hit should not be reported. +/// - eBLOCK: For all raycast, sweep and overlap queries the nearest eBLOCK type hit will always be returned in PxHitCallback::block member. +/// - eTOUCH: Whenever a raycast, sweep or overlap query was called with non-zero PxHitCallback::nbTouches and PxHitCallback::touches +/// parameters, eTOUCH type hits that are closer or same distance (touchDistance +/// < +/// = blockDistance condition) +/// as the globally nearest eBLOCK type hit, will be reported. +/// - For example, to record all hits from a raycast query, always return eTOUCH. +/// +/// All hits in overlap() queries are treated as if the intersection distance were zero. +/// This means the hits are unsorted and all eTOUCH hits are recorded by the callback even if an eBLOCK overlap hit was encountered. +/// Even though all overlap() blocking hits have zero length, only one (arbitrary) eBLOCK overlap hit is recorded in PxHitCallback::block. +/// All overlap() eTOUCH type hits are reported (zero touchDistance +/// < +/// = zero blockDistance condition). +/// +/// For raycast/sweep/overlap calls with zero touch buffer or PxHitCallback::nbTouches member, +/// only the closest hit of type eBLOCK is returned. All eTOUCH hits are discarded. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxQueryHitType { + /// the query should ignore this shape + None = 0, + /// a hit on the shape touches the intersection geometry of the query but does not block it + Touch = 1, + /// a hit on the shape blocks the query (does not block overlap queries) + Block = 2, +} + +/// Collection of flags providing a mechanism to lock motion along/around a specific axis. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxRigidDynamicLockFlag { + LockLinearX = 1, + LockLinearY = 2, + LockLinearZ = 4, + LockAngularX = 8, + LockAngularY = 16, + LockAngularZ = 32, +} + +bitflags::bitflags! { + /// Flags for [`PxRigidDynamicLockFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxRigidDynamicLockFlags: u8 { + const LockLinearX = 1 << 0; + const LockLinearY = 1 << 1; + const LockLinearZ = 1 << 2; + const LockAngularX = 1 << 3; + const LockAngularY = 1 << 4; + const LockAngularZ = 1 << 5; + } +} + +/// Pruning structure used to accelerate scene queries. +/// +/// eNONE uses a simple data structure that consumes less memory than the alternatives, +/// but generally has slower query performance. +/// +/// eDYNAMIC_AABB_TREE usually provides the fastest queries. However there is a +/// constant per-frame management cost associated with this structure. How much work should +/// be done per frame can be tuned via the [`PxSceneQueryDesc::dynamicTreeRebuildRateHint`] +/// parameter. +/// +/// eSTATIC_AABB_TREE is typically used for static objects. It is the same as the +/// dynamic AABB tree, without the per-frame overhead. This can be a good choice for static +/// objects, if no static objects are added, moved or removed after the scene has been +/// created. If there is no such guarantee (e.g. when streaming parts of the world in and out), +/// then the dynamic version is a better choice even for static objects. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPruningStructureType { + /// Using a simple data structure + None = 0, + /// Using a dynamic AABB tree + DynamicAabbTree = 1, + /// Using a static AABB tree + StaticAabbTree = 2, + Last = 3, +} + +/// Secondary pruning structure used for newly added objects in dynamic trees. +/// +/// Dynamic trees (PxPruningStructureType::eDYNAMIC_AABB_TREE) are slowly rebuilt +/// over several frames. A secondary pruning structure holds and manages objects +/// added to the scene while this rebuild is in progress. +/// +/// eNONE ignores newly added objects. This means that for a number of frames (roughly +/// defined by PxSceneQueryDesc::dynamicTreeRebuildRateHint) newly added objects will +/// be ignored by scene queries. This can be acceptable when streaming large worlds, e.g. +/// when the objects added at the boundaries of the game world don't immediately need to be +/// visible from scene queries (it would be equivalent to streaming that data in a few frames +/// later). The advantage of this approach is that there is no CPU cost associated with +/// inserting the new objects in the scene query data structures, and no extra runtime cost +/// when performing queries. +/// +/// eBUCKET uses a structure similar to PxPruningStructureType::eNONE. Insertion is fast but +/// query cost can be high. +/// +/// eINCREMENTAL uses an incremental AABB-tree, with no direct PxPruningStructureType equivalent. +/// Query time is fast but insertion cost can be high. +/// +/// eBVH uses a PxBVH structure. This usually offers the best overall performance. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxDynamicTreeSecondaryPruner { + /// no secondary pruner, new objects aren't visible to SQ for a few frames + None = 0, + /// bucket-based secondary pruner, faster updates, slower query time + Bucket = 1, + /// incremental-BVH secondary pruner, faster query time, slower updates + Incremental = 2, + /// PxBVH-based secondary pruner, good overall performance + Bvh = 3, + Last = 4, +} + +/// Scene query update mode +/// +/// This enum controls what work is done when the scene query system is updated. The updates traditionally happen when PxScene::fetchResults +/// is called. This function then calls PxSceneQuerySystem::finalizeUpdates, where the update mode is used. +/// +/// fetchResults/finalizeUpdates will sync changed bounds during simulation and update the scene query bounds in pruners, this work is mandatory. +/// +/// eBUILD_ENABLED_COMMIT_ENABLED does allow to execute the new AABB tree build step during fetchResults/finalizeUpdates, additionally +/// the pruner commit is called where any changes are applied. During commit PhysX refits the dynamic scene query tree and if a new tree +/// was built and the build finished the tree is swapped with current AABB tree. +/// +/// eBUILD_ENABLED_COMMIT_DISABLED does allow to execute the new AABB tree build step during fetchResults/finalizeUpdates. Pruner commit +/// is not called, this means that refit will then occur during the first scene query following fetchResults/finalizeUpdates, or may be forced +/// by the method PxScene::flushQueryUpdates() / PxSceneQuerySystemBase::flushUpdates(). +/// +/// eBUILD_DISABLED_COMMIT_DISABLED no further scene query work is executed. The scene queries update needs to be called manually, see +/// PxScene::sceneQueriesUpdate (see that function's doc for the equivalent PxSceneQuerySystem sequence). It is recommended to call +/// PxScene::sceneQueriesUpdate right after fetchResults/finalizeUpdates as the pruning structures are not updated. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSceneQueryUpdateMode { + /// Both scene query build and commit are executed. + BuildEnabledCommitEnabled = 0, + /// Scene query build only is executed. + BuildEnabledCommitDisabled = 1, + /// No work is done, no update of scene queries + BuildDisabledCommitDisabled = 2, +} + +/// Built-in enum for default PxScene pruners +/// +/// This is passed as a pruner index to various functions in the following APIs. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u32)] +pub enum PxScenePrunerIndex { + PxScenePrunerStatic = 0, + PxScenePrunerDynamic = 1, + PxSceneCompoundPruner = 4294967295, +} + +/// 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, +} + +/// Enum for selecting the friction algorithm used for simulation. +/// +/// [`PxFrictionType::ePATCH`] selects the patch friction model which typically leads to the most stable results at low solver iteration counts and is also quite inexpensive, as it uses only +/// up to four scalar solver constraints per pair of touching objects. The patch friction model is the same basic strong friction algorithm as PhysX 3.2 and before. +/// +/// [`PxFrictionType::eONE_DIRECTIONAL`] is a simplification of the Coulomb friction model, in which the friction for a given point of contact is applied in the alternating tangent directions of +/// the contact's normal. This simplification allows us to reduce the number of iterations required for convergence but is not as accurate as the two directional model. +/// +/// [`PxFrictionType::eTWO_DIRECTIONAL`] is identical to the one directional model, but it applies friction in both tangent directions simultaneously. This hurts convergence a bit so it +/// requires more solver iterations, but is more accurate. Like the one directional model, it is applied at every contact point, which makes it potentially more expensive +/// than patch friction for scenarios with many contact points. +/// +/// [`PxFrictionType::eFRICTION_COUNT`] is the total numer of friction models supported by the SDK. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxFrictionType { + /// Select default patch-friction model. + Patch = 0, + /// Select one directional per-contact friction model. + OneDirectional = 1, + /// Select two directional per-contact friction model. + TwoDirectional = 2, + /// The total number of friction models supported by the SDK. + FrictionCount = 3, +} + +/// Enum for selecting the type of solver used for the simulation. +/// +/// [`PxSolverType::ePGS`] selects the iterative sequential impulse solver. This is the same kind of solver used in PhysX 3.4 and earlier releases. +/// +/// [`PxSolverType::eTGS`] selects a non linear iterative solver. This kind of solver can lead to improved convergence and handle large mass ratios, long chains and jointed systems better. It is slightly more expensive than the default solver and can introduce more energy to correct joint and contact errors. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSolverType { + /// Projected Gauss-Seidel iterative solver + Pgs = 0, + /// Default Temporal Gauss-Seidel solver + Tgs = 1, +} + +/// flags for configuring properties of the scene +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSceneFlag { + /// Enable Active Actors Notification. + /// + /// This flag enables the Active Actor Notification feature for a scene. This + /// feature defaults to disabled. When disabled, the function + /// PxScene::getActiveActors() will always return a NULL list. + /// + /// There may be a performance penalty for enabling the Active Actor Notification, hence this flag should + /// only be enabled if the application intends to use the feature. + /// + /// Default: + /// False + EnableActiveActors = 1, + /// Enables a second broad phase check after integration that makes it possible to prevent objects from tunneling through eachother. + /// + /// PxPairFlag::eDETECT_CCD_CONTACT requires this flag to be specified. + /// + /// For this feature to be effective for bodies that can move at a significant velocity, the user should raise the flag PxRigidBodyFlag::eENABLE_CCD for them. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// False + EnableCcd = 2, + /// Enables a simplified swept integration strategy, which sacrifices some accuracy for improved performance. + /// + /// This simplified swept integration approach makes certain assumptions about the motion of objects that are not made when using a full swept integration. + /// These assumptions usually hold but there are cases where they could result in incorrect behavior between a set of fast-moving rigid bodies. A key issue is that + /// fast-moving dynamic objects may tunnel through each-other after a rebound. This will not happen if this mode is disabled. However, this approach will be potentially + /// faster than a full swept integration because it will perform significantly fewer sweeps in non-trivial scenes involving many fast-moving objects. This approach + /// should successfully resist objects passing through the static environment. + /// + /// PxPairFlag::eDETECT_CCD_CONTACT requires this flag to be specified. + /// + /// This scene flag requires eENABLE_CCD to be enabled as well. If it is not, this scene flag will do nothing. + /// + /// For this feature to be effective for bodies that can move at a significant velocity, the user should raise the flag PxRigidBodyFlag::eENABLE_CCD for them. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// False + DisableCcdResweep = 4, + /// Enable GJK-based distance collision detection system. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// true + EnablePcm = 64, + /// Disable contact report buffer resize. Once the contact buffer is full, the rest of the contact reports will + /// not be buffered and sent. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// false + DisableContactReportBufferResize = 128, + /// Disable contact cache. + /// + /// Contact caches are used internally to provide faster contact generation. You can disable all contact caches + /// if memory usage for this feature becomes too high. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// false + DisableContactCache = 256, + /// Require scene-level locking + /// + /// When set to true this requires that threads accessing the PxScene use the + /// multi-threaded lock methods. + /// + /// This flag is not mutable, and must be set in PxSceneDesc at scene creation. + /// + /// Default: + /// false + RequireRwLock = 512, + /// Enables additional stabilization pass in solver + /// + /// When set to true, this enables additional stabilization processing to improve that stability of complex interactions between large numbers of bodies. + /// + /// Note that this flag is not mutable and must be set in PxSceneDesc at scene creation. Also, this is an experimental feature which does result in some loss of momentum. + EnableStabilization = 1024, + /// Enables average points in contact manifolds + /// + /// When set to true, this enables additional contacts to be generated per manifold to represent the average point in a manifold. This can stabilize stacking when only a small + /// number of solver iterations is used. + /// + /// Note that this flag is not mutable and must be set in PxSceneDesc at scene creation. + EnableAveragePoint = 2048, + /// Do not report kinematics in list of active actors. + /// + /// Since the target pose for kinematics is set by the user, an application can track the activity state directly and use + /// this flag to avoid that kinematics get added to the list of active actors. + /// + /// This flag has only an effect in combination with eENABLE_ACTIVE_ACTORS. + /// + /// Default: + /// false + ExcludeKinematicsFromActiveActors = 4096, + /// Do not report kinematics in list of active actors. + /// + /// Since the target pose for kinematics is set by the user, an application can track the activity state directly and use + /// this flag to avoid that kinematics get added to the list of active actors. + /// + /// This flag has only an effect in combination with eENABLE_ACTIVE_ACTORS. + /// + /// Default: + /// false + EnableGpuDynamics = 8192, + /// Provides improved determinism at the expense of performance. + /// + /// By default, PhysX provides limited determinism guarantees. Specifically, PhysX guarantees that the exact scene (same actors created in the same order) and simulated using the same + /// time-stepping scheme should provide the exact same behaviour. + /// + /// However, if additional actors are added to the simulation, this can affect the behaviour of the existing actors in the simulation, even if the set of new actors do not interact with + /// the existing actors. + /// + /// This flag provides an additional level of determinism that guarantees that the simulation will not change if additional actors are added to the simulation, provided those actors do not interfere + /// with the existing actors in the scene. Determinism is only guaranteed if the actors are inserted in a consistent order each run in a newly-created scene and simulated using a consistent time-stepping + /// scheme. + /// + /// Note that this flag is not mutable and must be set at scene creation. + /// + /// Note that enabling this flag can have a negative impact on performance. + /// + /// Note that this feature is not currently supported on GPU. + /// + /// Default + /// false + EnableEnhancedDeterminism = 16384, + /// Controls processing friction in all solver iterations + /// + /// By default, PhysX processes friction only in the final 3 position iterations, and all velocity + /// iterations. This flag enables friction processing in all position and velocity iterations. + /// + /// The default behaviour provides a good trade-off between performance and stability and is aimed + /// primarily at game development. + /// + /// When simulating more complex frictional behaviour, such as grasping of complex geometries with + /// a robotic manipulator, better results can be achieved by enabling friction in all solver iterations. + /// + /// This flag only has effect with the default solver. The TGS solver always performs friction per-iteration. + EnableFrictionEveryIteration = 32768, + /// Controls processing friction in all solver iterations + /// + /// By default, PhysX processes friction only in the final 3 position iterations, and all velocity + /// iterations. This flag enables friction processing in all position and velocity iterations. + /// + /// The default behaviour provides a good trade-off between performance and stability and is aimed + /// primarily at game development. + /// + /// When simulating more complex frictional behaviour, such as grasping of complex geometries with + /// a robotic manipulator, better results can be achieved by enabling friction in all solver iterations. + /// + /// This flag only has effect with the default solver. The TGS solver always performs friction per-iteration. + SuppressReadback = 65536, + /// Controls processing friction in all solver iterations + /// + /// By default, PhysX processes friction only in the final 3 position iterations, and all velocity + /// iterations. This flag enables friction processing in all position and velocity iterations. + /// + /// The default behaviour provides a good trade-off between performance and stability and is aimed + /// primarily at game development. + /// + /// When simulating more complex frictional behaviour, such as grasping of complex geometries with + /// a robotic manipulator, better results can be achieved by enabling friction in all solver iterations. + /// + /// This flag only has effect with the default solver. The TGS solver always performs friction per-iteration. + ForceReadback = 131072, + /// Controls processing friction in all solver iterations + /// + /// By default, PhysX processes friction only in the final 3 position iterations, and all velocity + /// iterations. This flag enables friction processing in all position and velocity iterations. + /// + /// The default behaviour provides a good trade-off between performance and stability and is aimed + /// primarily at game development. + /// + /// When simulating more complex frictional behaviour, such as grasping of complex geometries with + /// a robotic manipulator, better results can be achieved by enabling friction in all solver iterations. + /// + /// This flag only has effect with the default solver. The TGS solver always performs friction per-iteration. + MutableFlags = 69633, +} + +bitflags::bitflags! { + /// Flags for [`PxSceneFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxSceneFlags: u32 { + const EnableActiveActors = 1 << 0; + const EnableCcd = 1 << 1; + const DisableCcdResweep = 1 << 2; + const EnablePcm = 1 << 6; + const DisableContactReportBufferResize = 1 << 7; + const DisableContactCache = 1 << 8; + const RequireRwLock = 1 << 9; + const EnableStabilization = 1 << 10; + const EnableAveragePoint = 1 << 11; + const ExcludeKinematicsFromActiveActors = 1 << 12; + const EnableGpuDynamics = 1 << 13; + const EnableEnhancedDeterminism = 1 << 14; + const EnableFrictionEveryIteration = 1 << 15; + const SuppressReadback = 1 << 16; + const ForceReadback = 1 << 17; + const MutableFlags = Self::EnableActiveActors.bits | Self::ExcludeKinematicsFromActiveActors.bits | Self::SuppressReadback.bits; + } +} + +/// Debug visualization parameters. +/// +/// [`PxVisualizationParameter::eSCALE`] is the master switch for enabling visualization, please read the corresponding documentation +/// for further details. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxVisualizationParameter { + /// This overall visualization scale gets multiplied with the individual scales. Setting to zero ignores all visualizations. Default is 0. + /// + /// The below settings permit the debug visualization of various simulation properties. + /// The setting is either zero, in which case the property is not drawn. Otherwise it is a scaling factor + /// that determines the size of the visualization widgets. + /// + /// Only objects for which visualization is turned on using setFlag(eVISUALIZATION) are visualized (see [`PxActorFlag::eVISUALIZATION`], #PxShapeFlag::eVISUALIZATION, ...). + /// Contacts are visualized if they involve a body which is being visualized. + /// Default is 0. + /// + /// Notes: + /// - to see any visualization, you have to set PxVisualizationParameter::eSCALE to nonzero first. + /// - the scale factor has been introduced because it's difficult (if not impossible) to come up with a + /// good scale for 3D vectors. Normals are normalized and their length is always 1. But it doesn't mean + /// we should render a line of length 1. Depending on your objects/scene, this might be completely invisible + /// or extremely huge. That's why the scale factor is here, to let you tune the length until it's ok in + /// your scene. + /// - however, things like collision shapes aren't ambiguous. They are clearly defined for example by the + /// triangles + /// & + /// polygons themselves, and there's no point in scaling that. So the visualization widgets + /// are only scaled when it makes sense. + /// + /// Range: + /// [0, PX_MAX_F32) + /// Default: + /// 0 + Scale = 0, + /// Visualize the world axes. + WorldAxes = 1, + /// Visualize a bodies axes. + BodyAxes = 2, + /// Visualize a body's mass axes. + /// + /// This visualization is also useful for visualizing the sleep state of bodies. Sleeping bodies are drawn in + /// black, while awake bodies are drawn in white. If the body is sleeping and part of a sleeping group, it is + /// drawn in red. + BodyMassAxes = 3, + /// Visualize the bodies linear velocity. + BodyLinVelocity = 4, + /// Visualize the bodies angular velocity. + BodyAngVelocity = 5, + /// Visualize contact points. Will enable contact information. + ContactPoint = 6, + /// Visualize contact normals. Will enable contact information. + ContactNormal = 7, + /// Visualize contact errors. Will enable contact information. + ContactError = 8, + /// Visualize Contact forces. Will enable contact information. + ContactForce = 9, + /// Visualize actor axes. + ActorAxes = 10, + /// Visualize bounds (AABBs in world space) + CollisionAabbs = 11, + /// Shape visualization + CollisionShapes = 12, + /// Shape axis visualization + CollisionAxes = 13, + /// Compound visualization (compound AABBs in world space) + CollisionCompounds = 14, + /// Mesh + /// & + /// convex face normals + CollisionFnormals = 15, + /// Active edges for meshes + CollisionEdges = 16, + /// Static pruning structures + CollisionStatic = 17, + /// Dynamic pruning structures + CollisionDynamic = 18, + /// Joint local axes + JointLocalFrames = 19, + /// Joint limits + JointLimits = 20, + /// Visualize culling box + CullBox = 21, + /// MBP regions + MbpRegions = 22, + /// Renders the simulation mesh instead of the collision mesh (only available for tetmeshes) + SimulationMesh = 23, + /// Renders the SDF of a mesh instead of the collision mesh (only available for triangle meshes with SDFs) + Sdf = 24, + /// This is not a parameter, it just records the current number of parameters (as maximum(PxVisualizationParameter)+1) for use in loops. + NumValues = 25, + /// This is not a parameter, it just records the current number of parameters (as maximum(PxVisualizationParameter)+1) for use in loops. + ForceDword = 2147483647, +} + +/// Different types of rigid body collision pair statistics. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum RbPairStatsType { + /// Shape pairs processed as discrete contact pairs for the current simulation step. + DiscreteContactPairs = 0, + /// Shape pairs processed as swept integration pairs for the current simulation step. + /// + /// Counts the pairs for which special CCD (continuous collision detection) work was actually done and NOT the number of pairs which were configured for CCD. + /// Furthermore, there can be multiple CCD passes and all processed pairs of all passes are summed up, hence the number can be larger than the amount of pairs which have been configured for CCD. + CcdPairs = 1, + /// Shape pairs processed with user contact modification enabled for the current simulation step. + ModifiedContactPairs = 2, + /// Trigger shape pairs processed for the current simulation step. + TriggerPairs = 3, +} + +/// These flags determine what data is read or written to the gpu softbody. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSoftBodyDataFlag { + /// The collision mesh tetrahedron indices (quadruples of int32) + TetIndices = 0, + /// The collision mesh cauchy stress tensors (float 3x3 matrices) + TetStress = 1, + /// The collision mesh tetrahedron von Mises stress (float scalar) + TetStresscoeff = 2, + /// The collision mesh tetrahedron rest poses (float 3x3 matrices) + TetRestPoses = 3, + /// The collision mesh tetrahedron orientations (quaternions, quadruples of float) + TetRotations = 4, + /// The collision mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + TetPositionInvMass = 5, + /// The simulation mesh tetrahedron indices (quadruples of int32) + SimTetIndices = 6, + /// The simulation mesh vertex velocities and their inverted mass in the 4th component (quadruples of float) + SimVelocityInvMass = 7, + /// The simulation mesh vertex positions and their inverted mass in the 4th component (quadruples of float) + SimPositionInvMass = 8, + /// The simulation mesh kinematic target positions + SimKinematicTarget = 9, +} + +/// Identifies input and output buffers for PxHairSystem +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHairSystemData { + /// No data specified + None = 0, + /// Specifies the position (first 3 floats) and inverse mass (last float) data (array of PxVec4 * max number of vertices) + PositionInvmass = 1, + /// Specifies the velocity (first 3 floats) data (array of PxVec4 * max number of vertices) + Velocity = 2, + /// Specifies everything + All = 3, +} + +bitflags::bitflags! { + /// Flags for [`PxHairSystemData`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxHairSystemDataFlags: u32 { + const PositionInvmass = 1 << 0; + const Velocity = 1 << 1; + const All = Self::PositionInvmass.bits | Self::Velocity.bits; + } +} + +/// Binary settings for hair system simulation +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxHairSystemFlag { + /// Determines if self-collision between hair vertices is ignored + DisableSelfCollision = 1, + /// Determines if collision between hair and external bodies is ignored + DisableExternalCollision = 2, + /// Determines if attachment constraint is also felt by body to which the hair is attached + DisableTwosidedAttachment = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxHairSystemFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxHairSystemFlags: u32 { + const DisableSelfCollision = 1 << 0; + const DisableExternalCollision = 1 << 1; + const DisableTwosidedAttachment = 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; + } +} + +/// PVD scene Flags. They are disabled by default, and only works if PxPvdInstrumentationFlag::eDEBUG is set. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPvdSceneFlag { + TransmitContacts = 1, + /// Transmits contact stream to PVD. + TransmitScenequeries = 2, + /// Transmits scene query stream to PVD. + TransmitConstraints = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxPvdSceneFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxPvdSceneFlags: u8 { + const TransmitContacts = 1 << 0; + const TransmitScenequeries = 1 << 1; + const TransmitConstraints = 1 << 2; + } +} + +/// Identifies each type of actor for retrieving actors from a scene. +/// +/// [`PxArticulationLink`] objects are not supported. Use the #PxArticulationReducedCoordinate object to retrieve all its links. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxActorTypeFlag { + /// A static rigid body + RigidStatic = 1, + /// A dynamic rigid body + RigidDynamic = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxActorTypeFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxActorTypeFlags: u16 { + const RigidStatic = 1 << 0; + const RigidDynamic = 1 << 1; + } +} + +/// Extra data item types for contact pairs. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxContactPairExtraDataType { + /// see [`PxContactPairVelocity`] + PreSolverVelocity = 0, + /// see [`PxContactPairVelocity`] + PostSolverVelocity = 1, + /// see [`PxContactPairPose`] + ContactEventPose = 2, + /// see [`PxContactPairIndex`] + ContactPairIndex = 3, +} + +/// Collection of flags providing information on contact report pairs. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxContactPairHeaderFlag { + /// The actor with index 0 has been removed from the scene. + RemovedActor0 = 1, + /// The actor with index 1 has been removed from the scene. + RemovedActor1 = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxContactPairHeaderFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxContactPairHeaderFlags: u16 { + const RemovedActor0 = 1 << 0; + const RemovedActor1 = 1 << 1; + } +} + +/// Collection of flags providing information on contact report pairs. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxContactPairFlag { + /// The shape with index 0 has been removed from the actor/scene. + RemovedShape0 = 1, + /// The shape with index 1 has been removed from the actor/scene. + RemovedShape1 = 2, + /// First actor pair contact. + /// + /// The provided shape pair marks the first contact between the two actors, no other shape pair has been touching prior to the current simulation frame. + /// + /// : This info is only available if [`PxPairFlag::eNOTIFY_TOUCH_FOUND`] has been declared for the pair. + ActorPairHasFirstTouch = 4, + /// All contact between the actor pair was lost. + /// + /// All contact between the two actors has been lost, no shape pairs remain touching after the current simulation frame. + ActorPairLostTouch = 8, + /// Internal flag, used by [`PxContactPair`].extractContacts() + /// + /// The applied contact impulses are provided for every contact point. + /// This is the case if [`PxPairFlag::eSOLVE_CONTACT`] has been set for the pair. + InternalHasImpulses = 16, + /// Internal flag, used by [`PxContactPair`].extractContacts() + /// + /// The provided contact point information is flipped with regards to the shapes of the contact pair. This mainly concerns the order of the internal triangle indices. + InternalContactsAreFlipped = 32, +} + +bitflags::bitflags! { + /// Flags for [`PxContactPairFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxContactPairFlags: u16 { + const RemovedShape0 = 1 << 0; + const RemovedShape1 = 1 << 1; + const ActorPairHasFirstTouch = 1 << 2; + const ActorPairLostTouch = 1 << 3; + const InternalHasImpulses = 1 << 4; + const InternalContactsAreFlipped = 1 << 5; + } +} + +/// Collection of flags providing information on trigger report pairs. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxTriggerPairFlag { + /// The trigger shape has been removed from the actor/scene. + RemovedShapeTrigger = 1, + /// The shape causing the trigger event has been removed from the actor/scene. + RemovedShapeOther = 2, + /// For internal use only. + NextFree = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxTriggerPairFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxTriggerPairFlags: u8 { + const RemovedShapeTrigger = 1 << 0; + const RemovedShapeOther = 1 << 1; + const NextFree = 1 << 2; + } +} + +/// Identifies input and output buffers for PxSoftBody. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSoftBodyData { + None = 0, + /// Flag to request access to the collision mesh's positions; read only + PositionInvmass = 1, + /// Flag to request access to the simulation mesh's positions and inverse masses + SimPositionInvmass = 4, + /// Flag to request access to the simulation mesh's velocities and inverse masses + SimVelocity = 8, + /// Flag to request access to the simulation mesh's kinematic target position + SimKinematicTarget = 16, + All = 29, +} + +bitflags::bitflags! { + /// Flags for [`PxSoftBodyData`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxSoftBodyDataFlags: u32 { + const PositionInvmass = 1 << 0; + const SimPositionInvmass = 1 << 2; + const SimVelocity = 1 << 3; + const SimKinematicTarget = 1 << 4; + const All = Self::PositionInvmass.bits | Self::SimPositionInvmass.bits | Self::SimVelocity.bits | Self::SimKinematicTarget.bits; + } +} + +/// Flags to enable or disable special modes of a SoftBody +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSoftBodyFlag { + /// Determines if self collision will be detected and resolved + DisableSelfCollision = 1, + /// Enables computation of a Cauchy stress tensor for every tetrahedron in the simulation mesh. The tensors can be accessed through the softbody direct API + ComputeStressTensor = 2, + /// Enables support for continuous collision detection + EnableCcd = 4, + /// Enable debug rendering to display the simulation mesh + DisplaySimMesh = 8, + /// Enables support for kinematic motion of the collision and simulation mesh. + Kinematic = 16, + /// Enables partially kinematic motion of the collisios and simulation mesh. + PartiallyKinematic = 32, +} + +bitflags::bitflags! { + /// Flags for [`PxSoftBodyFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxSoftBodyFlags: u32 { + const DisableSelfCollision = 1 << 0; + const ComputeStressTensor = 1 << 1; + const EnableCcd = 1 << 2; + const DisplaySimMesh = 1 << 3; + const Kinematic = 1 << 4; + const PartiallyKinematic = 1 << 5; + } +} + +/// The type of controller, eg box, sphere or capsule. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxControllerShapeType { + /// A box controller. + Box = 0, + /// A capsule controller + Capsule = 1, + /// A capsule controller + ForceDword = 2147483647, +} + +/// specifies how a CCT interacts with non-walkable parts. +/// +/// This is only used when slopeLimit is non zero. It is currently enabled for static actors only, and not supported for spheres or capsules. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxControllerNonWalkableMode { + /// Stops character from climbing up non-walkable slopes, but doesn't move it otherwise + PreventClimbing = 0, + /// Stops character from climbing up non-walkable slopes, and forces it to slide down those slopes + PreventClimbingAndForceSliding = 1, +} + +/// specifies which sides a character is colliding with. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxControllerCollisionFlag { + /// Character is colliding to the sides. + CollisionSides = 1, + /// Character has collision above. + CollisionUp = 2, + /// Character has collision below. + CollisionDown = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxControllerCollisionFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxControllerCollisionFlags: u8 { + const CollisionSides = 1 << 0; + const CollisionUp = 1 << 1; + const CollisionDown = 1 << 2; + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxCapsuleClimbingMode { + /// Standard mode, let the capsule climb over surfaces according to impact normal + Easy = 0, + /// Constrained mode, try to limit climbing according to the step offset + Constrained = 1, + Last = 2, +} + +/// specifies controller behavior +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxControllerBehaviorFlag { + /// Controller can ride on touched object (i.e. when this touched object is moving horizontally). + /// + /// The CCT vs. CCT case is not supported. + CctCanRideOnObject = 1, + /// Controller should slide on touched object + CctSlide = 2, + /// Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. + CctUserDefinedRide = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxControllerBehaviorFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxControllerBehaviorFlags: u8 { + const CctCanRideOnObject = 1 << 0; + const CctSlide = 1 << 1; + const CctUserDefinedRide = 1 << 2; + } +} + +/// specifies debug-rendering flags +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u32)] +pub enum PxControllerDebugRenderFlag { + /// Temporal bounding volume around controllers + TemporalBv = 1, + /// Cached bounding volume around controllers + CachedBv = 2, + /// User-defined obstacles + Obstacles = 4, + None = 0, + All = 4294967295, +} + +bitflags::bitflags! { + /// Flags for [`PxControllerDebugRenderFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxControllerDebugRenderFlags: u32 { + const TemporalBv = 1 << 0; + const CachedBv = 1 << 1; + const Obstacles = 1 << 2; + const All = Self::TemporalBv.bits | Self::CachedBv.bits | Self::Obstacles.bits; + } +} + +/// Defines the number of bits per subgrid pixel +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSdfBitsPerSubgridPixel { + /// 8 bit per subgrid pixel (values will be stored as normalized integers) + E8BitPerPixel = 1, + /// 16 bit per subgrid pixel (values will be stored as normalized integers) + E16BitPerPixel = 2, + /// 32 bit per subgrid pixel (values will be stored as floats in world scale units) + E32BitPerPixel = 4, +} + +/// Flags which describe the format and behavior of a convex mesh. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConvexFlag { + /// Denotes the use of 16-bit vertex indices in PxConvexMeshDesc::triangles or PxConvexMeshDesc::polygons. + /// (otherwise, 32-bit indices are assumed) + E16BitIndices = 1, + /// Automatically recomputes the hull from the vertices. If this flag is not set, you must provide the entire geometry manually. + /// + /// There are two different algorithms for hull computation, please see PxConvexMeshCookingType. + ComputeConvex = 2, + /// Checks and removes almost zero-area triangles during convex hull computation. + /// The rejected area size is specified in PxCookingParams::areaTestEpsilon + /// + /// This flag is only used in combination with eCOMPUTE_CONVEX. + CheckZeroAreaTriangles = 4, + /// Quantizes the input vertices using the k-means clustering + /// + /// The input vertices are quantized to PxConvexMeshDesc::quantizedCount + /// see http://en.wikipedia.org/wiki/K-means_clustering + QuantizeInput = 8, + /// Disables the convex mesh validation to speed-up hull creation. Please use separate validation + /// function in checked/debug builds. Creating a convex mesh with invalid input data without prior validation + /// may result in undefined behavior. + DisableMeshValidation = 16, + /// Enables plane shifting vertex limit algorithm. + /// + /// Plane shifting is an alternative algorithm for the case when the computed hull has more vertices + /// than the specified vertex limit. + /// + /// The default algorithm computes the full hull, and an OBB around the input vertices. This OBB is then sliced + /// with the hull planes until the vertex limit is reached.The default algorithm requires the vertex limit + /// to be set to at least 8, and typically produces results that are much better quality than are produced + /// by plane shifting. + /// + /// When plane shifting is enabled, the hull computation stops when vertex limit is reached. The hull planes + /// are then shifted to contain all input vertices, and the new plane intersection points are then used to + /// generate the final hull with the given vertex limit.Plane shifting may produce sharp edges to vertices + /// very far away from the input cloud, and does not guarantee that all input vertices are inside the resulting + /// hull.However, it can be used with a vertex limit as low as 4. + PlaneShifting = 32, + /// Inertia tensor computation is faster using SIMD code, but the precision is lower, which may result + /// in incorrect inertia for very thin hulls. + FastInertiaComputation = 64, + /// Convex hulls are created with respect to GPU simulation limitations. Vertex limit and polygon limit + /// is set to 64 and vertex limit per face is internally set to 32. + /// + /// Can be used only with eCOMPUTE_CONVEX flag. + GpuCompatible = 128, + /// Convex hull input vertices are shifted to be around origin to provide better computation stability. + /// It is recommended to provide input vertices around the origin, otherwise use this flag to improve + /// numerical stability. + /// + /// Is used only with eCOMPUTE_CONVEX flag. + ShiftVertices = 256, +} + +bitflags::bitflags! { + /// Flags for [`PxConvexFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxConvexFlags: u16 { + const E16BitIndices = 1 << 0; + const ComputeConvex = 1 << 1; + const CheckZeroAreaTriangles = 1 << 2; + const QuantizeInput = 1 << 3; + const DisableMeshValidation = 1 << 4; + const PlaneShifting = 1 << 5; + const FastInertiaComputation = 1 << 6; + const GpuCompatible = 1 << 7; + const ShiftVertices = 1 << 8; + } +} + +/// Defines the tetrahedron structure of a mesh. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshFormat { + /// Normal tetmesh with arbitrary tetrahedra + TetMesh = 0, + /// 6 tetrahedra in a row will form a hexahedron + HexMesh = 1, +} + +/// Desired build strategy for PxMeshMidPhase::eBVH34 +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxBVH34BuildStrategy { + /// Fast build strategy. Fast build speed, good runtime performance in most cases. Recommended for runtime mesh cooking. + Fast = 0, + /// Default build strategy. Medium build speed, good runtime performance in all cases. + Default = 1, + /// SAH build strategy. Slower builds, slightly improved runtime performance in some cases. + Sah = 2, + Last = 3, +} + +/// Result from convex cooking. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConvexMeshCookingResult { + /// Convex mesh cooking succeeded. + Success = 0, + /// Convex mesh cooking failed, algorithm couldn't find 4 initial vertices without a small triangle. + ZeroAreaTestFailed = 1, + /// Convex mesh cooking succeeded, but the algorithm has reached the 255 polygons limit. + /// The produced hull does not contain all input vertices. Try to simplify the input vertices + /// or try to use the eINFLATE_CONVEX or the eQUANTIZE_INPUT flags. + PolygonsLimitReached = 2, + /// Something unrecoverable happened. Check the error stream to find out what. + Failure = 3, +} + +/// Enumeration for convex mesh cooking algorithms. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConvexMeshCookingType { + /// The Quickhull algorithm constructs the hull from the given input points. The resulting hull + /// will only contain a subset of the input points. + Quickhull = 0, +} + +/// Result from triangle mesh cooking +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxTriangleMeshCookingResult { + /// Everything is A-OK. + Success = 0, + /// a triangle is too large for well-conditioned results. Tessellate the mesh for better behavior, see the user guide section on cooking for more details. + LargeTriangle = 1, + /// Something unrecoverable happened. Check the error stream to find out what. + Failure = 2, +} + +/// Enum for the set of mesh pre-processing parameters. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxMeshPreprocessingFlag { + /// When set, mesh welding is performed. See PxCookingParams::meshWeldTolerance. Clean mesh must be enabled. + WeldVertices = 1, + /// When set, mesh cleaning is disabled. This makes cooking faster. + /// + /// When clean mesh is not performed, mesh welding is also not performed. + /// + /// It is recommended to use only meshes that passed during validateTriangleMesh. + DisableCleanMesh = 2, + /// When set, active edges are set for each triangle edge. This makes cooking faster but slow up contact generation. + DisableActiveEdgesPrecompute = 4, + /// When set, 32-bit indices will always be created regardless of triangle count. + /// + /// By default mesh will be created with 16-bit indices for triangle count + /// < + /// = 0xFFFF and 32-bit otherwise. + Force32bitIndices = 8, + /// When set, a list of triangles will be created for each associated vertex in the mesh + EnableVertMapping = 16, + /// When set, inertia tensor is calculated for the mesh + EnableInertia = 32, +} + +bitflags::bitflags! { + /// Flags for [`PxMeshPreprocessingFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxMeshPreprocessingFlags: u32 { + const WeldVertices = 1 << 0; + const DisableCleanMesh = 1 << 1; + const DisableActiveEdgesPrecompute = 1 << 2; + const Force32bitIndices = 1 << 3; + const EnableVertMapping = 1 << 4; + const EnableInertia = 1 << 5; + } +} + +/// Unique identifiers for extensions classes which implement a constraint based on PxConstraint. +/// +/// Users which want to create their own custom constraint types should choose an ID larger or equal to eNEXT_FREE_ID +/// and not eINVALID_ID. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxConstraintExtIDs { + Joint = 0, + VehicleSuspLimitDeprecated = 1, + VehicleStickyTyreDeprecated = 2, + VehicleJoint = 3, + NextFreeId = 4, + InvalidId = 2147483647, +} + +/// an enumeration of PhysX' built-in joint types +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxJointConcreteType { + Spherical = 256, + Revolute = 257, + Prismatic = 258, + Fixed = 259, + Distance = 260, + D6 = 261, + Contact = 262, + Gear = 263, + RackAndPinion = 264, + Last = 265, +} + +/// an enumeration for specifying one or other of the actors referenced by a joint +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxJointActorIndex { + Actor0 = 0, + Actor1 = 1, + Count = 2, +} + +/// flags for configuring the drive of a PxDistanceJoint +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxDistanceJointFlag { + MaxDistanceEnabled = 2, + MinDistanceEnabled = 4, + SpringEnabled = 8, +} + +bitflags::bitflags! { + /// Flags for [`PxDistanceJointFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxDistanceJointFlags: u16 { + const MaxDistanceEnabled = 1 << 1; + const MinDistanceEnabled = 1 << 2; + const SpringEnabled = 1 << 3; + } +} + +/// Flags specific to the prismatic joint. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPrismaticJointFlag { + LimitEnabled = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxPrismaticJointFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxPrismaticJointFlags: u16 { + const LimitEnabled = 1 << 1; + } +} + +/// Flags specific to the Revolute Joint. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxRevoluteJointFlag { + /// enable the limit + LimitEnabled = 1, + /// enable the drive + DriveEnabled = 2, + /// if the existing velocity is beyond the drive velocity, do not add force + DriveFreespin = 4, +} + +bitflags::bitflags! { + /// Flags for [`PxRevoluteJointFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxRevoluteJointFlags: u16 { + const LimitEnabled = 1 << 0; + const DriveEnabled = 1 << 1; + const DriveFreespin = 1 << 2; + } +} + +/// Flags specific to the spherical joint. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxSphericalJointFlag { + /// the cone limit for the spherical joint is enabled + LimitEnabled = 2, +} + +bitflags::bitflags! { + /// Flags for [`PxSphericalJointFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxSphericalJointFlags: u16 { + const LimitEnabled = 1 << 1; + } +} + +/// Used to specify one of the degrees of freedom of a D6 joint. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxD6Axis { + /// motion along the X axis + X = 0, + /// motion along the Y axis + Y = 1, + /// motion along the Z axis + Z = 2, + /// motion around the X axis + Twist = 3, + /// motion around the Y axis + Swing1 = 4, + /// motion around the Z axis + Swing2 = 5, + Count = 6, +} + +/// Used to specify the range of motions allowed for a degree of freedom in a D6 joint. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxD6Motion { + /// The DOF is locked, it does not allow relative motion. + Locked = 0, + /// The DOF is limited, it only allows motion within a specific range. + Limited = 1, + /// The DOF is free and has its full range of motion. + Free = 2, +} + +/// Used to specify which axes of a D6 joint are driven. +/// +/// Each drive is an implicit force-limited damped spring: +/// +/// force = spring * (target position - position) + damping * (targetVelocity - velocity) +/// +/// Alternatively, the spring may be configured to generate a specified acceleration instead of a force. +/// +/// A linear axis is affected by drive only if the corresponding drive flag is set. There are two possible models +/// for angular drive: swing/twist, which may be used to drive one or more angular degrees of freedom, or slerp, +/// which may only be used to drive all three angular degrees simultaneously. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxD6Drive { + /// drive along the X-axis + X = 0, + /// drive along the Y-axis + Y = 1, + /// drive along the Z-axis + Z = 2, + /// drive of displacement from the X-axis + Swing = 3, + /// drive of the displacement around the X-axis + Twist = 4, + /// drive of all three angular degrees along a SLERP-path + Slerp = 5, + Count = 6, +} + +impl From for PxD6Drive { + fn from(val: usize) -> Self { + #[allow(clippy::match_same_arms)] + match val { + 0 => Self::X, + 1 => Self::Y, + 2 => Self::Z, + 3 => Self::Swing, + 4 => Self::Twist, + 5 => Self::Slerp, + 6 => Self::Count, + _ => Self::Count, + } + } +} + +/// flags for configuring the drive model of a PxD6Joint +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxD6JointDriveFlag { + /// drive spring is for the acceleration at the joint (rather than the force) + Acceleration = 1, +} + +bitflags::bitflags! { + /// Flags for [`PxD6JointDriveFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxD6JointDriveFlags: u32 { + const Acceleration = 1 << 0; + } +} + +/// Collision filtering operations. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxFilterOp { + PxFilteropAnd = 0, + PxFilteropOr = 1, + PxFilteropXor = 2, + PxFilteropNand = 3, + PxFilteropNor = 4, + PxFilteropNxor = 5, + PxFilteropSwapAnd = 6, +} + +/// If a thread ends up waiting for work it will find itself in a spin-wait loop until work becomes available. +/// Three strategies are available to limit wasted cycles. +/// The strategies are as follows: +/// a) wait until a work task signals the end of the spin-wait period. +/// b) yield the thread by providing a hint to reschedule thread execution, thereby allowing other threads to run. +/// c) yield the processor by informing it that it is waiting for work and requesting it to more efficiently use compute resources. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxDefaultCpuDispatcherWaitForWorkMode { + WaitForWork = 0, + YieldThread = 1, + YieldProcessor = 2, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxBatchQueryStatus { + /// This is the initial state before a query starts. + Pending = 0, + /// The query is finished; results have been written into the result and hit buffers. + Success = 1, + /// The query results were incomplete due to touch hit buffer overflow. Blocking hit is still correct. + Overflow = 2, +} + +/// types of instrumentation that PVD can do. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(i32)] +pub enum PxPvdInstrumentationFlag { + /// Send debugging information to PVD. + /// + /// This information is the actual object data of the rigid statics, shapes, + /// articulations, etc. Sending this information has a noticeable impact on + /// performance and thus this flag should not be set if you want an accurate + /// performance profile. + Debug = 1, + /// Send profile information to PVD. + /// + /// This information populates PVD's profile view. It has (at this time) negligible + /// cost compared to Debug information and makes PVD *much* more useful so it is quite + /// highly recommended. + /// + /// This flag works together with a PxCreatePhysics parameter. + /// Using it allows the SDK to send profile events to PVD. + Profile = 2, + /// Send memory information to PVD. + /// + /// The PVD sdk side hooks into the Foundation memory controller and listens to + /// allocation/deallocation events. This has a noticable hit on the first frame, + /// however, this data is somewhat compressed and the PhysX SDK doesn't allocate much + /// once it hits a steady state. This information also has a fairly negligible + /// impact and thus is also highly recommended. + /// + /// This flag works together with a PxCreatePhysics parameter, + /// trackOutstandingAllocations. Using both of them together allows users to have + /// an accurate view of the overall memory usage of the simulation at the cost of + /// a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort + /// attempt not to allocate or deallocate during simulation so this hashtable lookup + /// tends to have no effect past the first frame. + /// + /// Sending memory information without tracking outstanding allocations means that + /// PVD will accurate information about the state of the memory system before the + /// actual connection happened. + Memory = 4, + /// Send memory information to PVD. + /// + /// The PVD sdk side hooks into the Foundation memory controller and listens to + /// allocation/deallocation events. This has a noticable hit on the first frame, + /// however, this data is somewhat compressed and the PhysX SDK doesn't allocate much + /// once it hits a steady state. This information also has a fairly negligible + /// impact and thus is also highly recommended. + /// + /// This flag works together with a PxCreatePhysics parameter, + /// trackOutstandingAllocations. Using both of them together allows users to have + /// an accurate view of the overall memory usage of the simulation at the cost of + /// a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort + /// attempt not to allocate or deallocate during simulation so this hashtable lookup + /// tends to have no effect past the first frame. + /// + /// Sending memory information without tracking outstanding allocations means that + /// PVD will accurate information about the state of the memory system before the + /// actual connection happened. + All = 7, +} + +bitflags::bitflags! { + /// Flags for [`PxPvdInstrumentationFlag`] + #[derive(Default)] + #[repr(transparent)] + pub struct PxPvdInstrumentationFlags: u8 { + const Debug = 1 << 0; + const Profile = 1 << 1; + const Memory = 1 << 2; + const All = Self::Debug.bits | Self::Profile.bits | Self::Memory.bits; + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxMat34 { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAllocatorCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAssertHandler { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxFoundation { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxVirtualAllocatorCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[repr(C)] +pub union PxTempAllocatorChunk { + pub mNext: *mut PxTempAllocatorChunk, + pub mIndex: u32, + pub mPad: [u8; 16], +} +#[cfg(feature = "debug-structs")] +impl std::fmt::Debug for PxTempAllocatorChunk { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("PxTempAllocatorChunk") + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxLogTwo { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxUnConst { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxErrorCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAllocationListener { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxHash { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxInputStream { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxInputData { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxOutputStream { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxProfilerCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRunnable { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRenderBuffer { + vtable_: *const std::ffi::c_void, +} + +#[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 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 PxBVH33TriangleMesh { + _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)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxStringTable { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSerializer { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxInsertionCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxTaskManager { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCpuDispatcher { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVHRaycastCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVHOverlapCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBVHTraversalCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxContactBuffer { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxRenderOutput { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomGeometryCallbacks { + vtable_: *const std::ffi::c_void, +} + +#[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, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxContactModifyCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCCDContactModifyCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDeletionListener { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationFilterCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxLockedData { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxCudaContextManager { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxParticleRigidAttachment { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxOmniPvd { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPhysics { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxQueryFilterCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQuerySystemBase { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneSQSystem { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSceneQuerySystem { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseRegions { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhase { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxAABBManager { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPvdSceneClient { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBroadPhaseCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxSimulationEventCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxObstacleContext { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxUserControllerHitReport { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerFilterCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxController { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBoxController { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCapsuleController { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerBehaviorCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxControllerManager { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultAllocator { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultErrorCallback { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxBinaryConverter { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxDefaultCpuDispatcher { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxBatchQueryExt { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomSceneQuerySystem { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxCustomSceneQuerySystemAdapter { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxCooking { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct XmlMemoryAllocator { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct XmlWriter { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct XmlReader { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct MemoryBuffer { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxRepXSerializer { + vtable_: *const std::ffi::c_void, +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxVehicleWheels4SimData { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxVehicleWheels4DynData { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxVehicleTireForceCalculator { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxVehicleDrivableSurfaceToTireFrictionPairs { + _unused: [u8; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct PxVehicleTelemetryData { + _unused: [u8; 0], +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPvd { + vtable_: *const std::ffi::c_void, +} + +#[derive(Clone, Copy)] +#[cfg_attr(feature = "debug-structs", derive(Debug))] +#[repr(C)] +pub struct PxPvdTransport { + vtable_: *const std::ffi::c_void, +} +extern "C" { + pub fn PxAllocatorCallback_delete(self_: *mut PxAllocatorCallback); + + /// 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. + /// + /// Threading: + /// This function should be thread safe as it can be called in the context of the user thread + /// and physics processing thread(s). + /// + /// The allocated block of memory. + pub fn PxAllocatorCallback_allocate_mut(self_: *mut PxAllocatorCallback, size: usize, typeName: *const std::ffi::c_char, filename: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + /// Frees memory previously allocated by allocate(). + /// + /// Threading: + /// This function should be thread safe as it can be called in the context of the user thread + /// and physics processing thread(s). + pub fn PxAllocatorCallback_deallocate_mut(self_: *mut PxAllocatorCallback, ptr: *mut std::ffi::c_void); + + pub fn PxAssertHandler_delete(self_: *mut PxAssertHandler); + + pub fn phys_PxGetAssertHandler() -> *mut PxAssertHandler; + + pub fn phys_PxSetAssertHandler(handler: *mut PxAssertHandler); + + /// Destroys the instance it is called on. + /// + /// The operation will fail, if there are still modules referencing the foundation object. Release all dependent modules + /// prior to calling this method. + pub fn PxFoundation_release_mut(self_: *mut PxFoundation); + + /// retrieves error callback + pub fn PxFoundation_getErrorCallback_mut(self_: *mut PxFoundation) -> *mut PxErrorCallback; + + /// Sets mask of errors to report. + pub fn PxFoundation_setErrorLevel_mut(self_: *mut PxFoundation, mask: u32); + + /// Retrieves mask of errors to be reported. + pub fn PxFoundation_getErrorLevel(self_: *const PxFoundation) -> u32; + + /// Retrieves the allocator this object was created with. + pub fn PxFoundation_getAllocatorCallback_mut(self_: *mut PxFoundation) -> *mut PxAllocatorCallback; + + /// Retrieves if allocation names are being passed to allocator callback. + pub fn PxFoundation_getReportAllocationNames(self_: *const PxFoundation) -> bool; + + /// Set if allocation names are being passed to allocator callback. + /// + /// Enabled by default in debug and checked build, disabled by default in profile and release build. + pub fn PxFoundation_setReportAllocationNames_mut(self_: *mut PxFoundation, value: bool); + + pub fn PxFoundation_registerAllocationListener_mut(self_: *mut PxFoundation, listener: *mut PxAllocationListener); + + pub fn PxFoundation_deregisterAllocationListener_mut(self_: *mut PxFoundation, listener: *mut PxAllocationListener); + + pub fn PxFoundation_registerErrorCallback_mut(self_: *mut PxFoundation, callback: *mut PxErrorCallback); + + pub fn PxFoundation_deregisterErrorCallback_mut(self_: *mut PxFoundation, callback: *mut PxErrorCallback); + + /// Creates an instance of the foundation class + /// + /// The foundation class is needed to initialize higher level SDKs. There may be only one instance per process. + /// Calling this method after an instance has been created already will result in an error message and NULL will be + /// returned. + /// + /// Foundation instance on success, NULL if operation failed + pub fn phys_PxCreateFoundation(version: u32, allocator: *mut PxAllocatorCallback, errorCallback: *mut PxErrorCallback) -> *mut PxFoundation; + + pub fn phys_PxSetFoundationInstance(foundation: *mut PxFoundation); + + pub fn phys_PxGetFoundation() -> *mut PxFoundation; + + /// Get the callback that will be used for all profiling. + pub fn phys_PxGetProfilerCallback() -> *mut PxProfilerCallback; + + /// Set the callback that will be used for all profiling. + pub fn phys_PxSetProfilerCallback(profiler: *mut PxProfilerCallback); + + /// Get the allocator callback + pub fn phys_PxGetAllocatorCallback() -> *mut PxAllocatorCallback; + + /// Get the broadcasting allocator callback + pub fn phys_PxGetBroadcastAllocator() -> *mut PxAllocatorCallback; + + /// Get the error callback + pub fn phys_PxGetErrorCallback() -> *mut PxErrorCallback; + + /// Get the broadcasting error callback + pub fn phys_PxGetBroadcastError() -> *mut PxErrorCallback; + + /// Get the warn once timestamp + pub fn phys_PxGetWarnOnceTimeStamp() -> u32; + + /// Decrement the ref count of PxFoundation + pub fn phys_PxDecFoundationRefCount(); + + /// Increment the ref count of PxFoundation + pub fn phys_PxIncFoundationRefCount(); + + pub fn PxAllocator_new(anon_param0: *const std::ffi::c_char) -> PxAllocator; + + pub fn PxAllocator_allocate_mut(self_: *mut PxAllocator, size: usize, file: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + pub fn PxAllocator_deallocate_mut(self_: *mut PxAllocator, ptr: *mut std::ffi::c_void); + + pub fn PxRawAllocator_new(anon_param0: *const std::ffi::c_char) -> PxRawAllocator; + + pub fn PxRawAllocator_allocate_mut(self_: *mut PxRawAllocator, size: usize, anon_param1: *const std::ffi::c_char, anon_param2: i32) -> *mut std::ffi::c_void; + + pub fn PxRawAllocator_deallocate_mut(self_: *mut PxRawAllocator, ptr: *mut std::ffi::c_void); + + pub fn PxVirtualAllocatorCallback_delete(self_: *mut PxVirtualAllocatorCallback); + + pub fn PxVirtualAllocatorCallback_allocate_mut(self_: *mut PxVirtualAllocatorCallback, size: usize, group: i32, file: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + pub fn PxVirtualAllocatorCallback_deallocate_mut(self_: *mut PxVirtualAllocatorCallback, ptr: *mut std::ffi::c_void); + + pub fn PxVirtualAllocator_new(callback: *mut PxVirtualAllocatorCallback, group: i32) -> PxVirtualAllocator; + + pub fn PxVirtualAllocator_allocate_mut(self_: *mut PxVirtualAllocator, size: usize, file: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + pub fn PxVirtualAllocator_deallocate_mut(self_: *mut PxVirtualAllocator, ptr: *mut std::ffi::c_void); + + pub fn PxTempAllocatorChunk_new() -> PxTempAllocatorChunk; + + pub fn PxTempAllocator_new(anon_param0: *const std::ffi::c_char) -> PxTempAllocator; + + pub fn PxTempAllocator_allocate_mut(self_: *mut PxTempAllocator, size: usize, file: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + pub fn PxTempAllocator_deallocate_mut(self_: *mut PxTempAllocator, ptr: *mut std::ffi::c_void); + + /// 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); + + pub fn phys_PxMemoryBarrier(); + + /// Return the index of the highest set bit. Undefined for zero arg. + pub fn phys_PxHighestSetBitUnsafe(v: u32) -> u32; + + /// Return the index of the highest set bit. Undefined for zero arg. + pub fn phys_PxLowestSetBitUnsafe(v: u32) -> u32; + + /// Returns the index of the highest set bit. Returns 32 for v=0. + pub fn phys_PxCountLeadingZeros(v: u32) -> u32; + + /// Prefetch aligned 64B x86, 32b ARM around + pub fn phys_PxPrefetchLine(ptr: *const std::ffi::c_void, offset: u32); + + /// Prefetch + /// bytes starting at + pub fn phys_PxPrefetch(ptr: *const std::ffi::c_void, count: u32); + + pub fn phys_PxBitCount(v: u32) -> u32; + + pub fn phys_PxIsPowerOfTwo(x: u32) -> bool; + + pub fn phys_PxNextPowerOfTwo(x: u32) -> u32; + + /// Return the index of the highest set bit. Not valid for zero arg. + pub fn phys_PxLowestSetBit(x: u32) -> u32; + + /// Return the index of the highest set bit. Not valid for zero arg. + pub fn phys_PxHighestSetBit(x: u32) -> u32; + + pub fn phys_PxILog2(num: u32) -> u32; + + /// default constructor leaves data uninitialized. + pub fn PxVec3_new() -> PxVec3; + + /// zero constructor. + pub fn PxVec3_new_1(anon_param0: PxZERO) -> PxVec3; + + /// Assigns scalar parameter to all elements. + /// + /// Useful to initialize to zero or one. + pub fn PxVec3_new_2(a: f32) -> PxVec3; + + /// Initializes from 3 scalar parameters. + pub fn PxVec3_new_3(nx: f32, ny: f32, nz: f32) -> PxVec3; + + /// tests for exact zero vector + pub fn PxVec3_isZero(self_: *const PxVec3) -> bool; + + /// returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + pub fn PxVec3_isFinite(self_: *const PxVec3) -> bool; + + /// is normalized - used by API parameter validation + pub fn PxVec3_isNormalized(self_: *const PxVec3) -> bool; + + /// returns the squared magnitude + /// + /// Avoids calling PxSqrt()! + pub fn PxVec3_magnitudeSquared(self_: *const PxVec3) -> f32; + + /// returns the magnitude + pub fn PxVec3_magnitude(self_: *const PxVec3) -> f32; + + /// returns the scalar product of this and other. + pub fn PxVec3_dot(self_: *const PxVec3, v: *const PxVec3) -> f32; + + /// cross product + pub fn PxVec3_cross(self_: *const PxVec3, v: *const PxVec3) -> PxVec3; + + /// returns a unit vector + pub fn PxVec3_getNormalized(self_: *const PxVec3) -> PxVec3; + + /// normalizes the vector in place + pub fn PxVec3_normalize_mut(self_: *mut PxVec3) -> f32; + + /// normalizes the vector in place. Does nothing if vector magnitude is under PX_NORMALIZATION_EPSILON. + /// Returns vector magnitude if >= PX_NORMALIZATION_EPSILON and 0.0f otherwise. + pub fn PxVec3_normalizeSafe_mut(self_: *mut PxVec3) -> f32; + + /// normalizes the vector in place. Asserts if vector magnitude is under PX_NORMALIZATION_EPSILON. + /// returns vector magnitude. + pub fn PxVec3_normalizeFast_mut(self_: *mut PxVec3) -> f32; + + /// a[i] * b[i], for all i. + pub fn PxVec3_multiply(self_: *const PxVec3, a: *const PxVec3) -> PxVec3; + + /// element-wise minimum + pub fn PxVec3_minimum(self_: *const PxVec3, v: *const PxVec3) -> PxVec3; + + /// returns MIN(x, y, z); + pub fn PxVec3_minElement(self_: *const PxVec3) -> f32; + + /// element-wise maximum + pub fn PxVec3_maximum(self_: *const PxVec3, v: *const PxVec3) -> PxVec3; + + /// returns MAX(x, y, z); + pub fn PxVec3_maxElement(self_: *const PxVec3) -> f32; + + /// returns absolute values of components; + pub fn PxVec3_abs(self_: *const PxVec3) -> PxVec3; + + pub fn PxVec3Padded_new_alloc() -> *mut PxVec3Padded; + + pub fn PxVec3Padded_delete(self_: *mut PxVec3Padded); + + pub fn PxVec3Padded_new_alloc_1(p: *const PxVec3) -> *mut PxVec3Padded; + + pub fn PxVec3Padded_new_alloc_2(f: f32) -> *mut PxVec3Padded; + + /// Default constructor, does not do any initialization. + pub fn PxQuat_new() -> PxQuat; + + /// identity constructor + pub fn PxQuat_new_1(anon_param0: PxIDENTITY) -> PxQuat; + + /// Constructor from a scalar: sets the real part w to the scalar value, and the imaginary parts (x,y,z) to zero + pub fn PxQuat_new_2(r: f32) -> PxQuat; + + /// Constructor. Take note of the order of the elements! + pub fn PxQuat_new_3(nx: f32, ny: f32, nz: f32, nw: f32) -> PxQuat; + + /// Creates from angle-axis representation. + /// + /// Axis must be normalized! + /// + /// Angle is in radians! + /// + /// Unit: + /// Radians + pub fn PxQuat_new_4(angleRadians: f32, unitAxis: *const PxVec3) -> PxQuat; + + /// Creates from orientation matrix. + pub fn PxQuat_new_5(m: *const PxMat33) -> PxQuat; + + /// returns true if quat is identity + pub fn PxQuat_isIdentity(self_: *const PxQuat) -> bool; + + /// returns true if all elements are finite (not NAN or INF, etc.) + pub fn PxQuat_isFinite(self_: *const PxQuat) -> bool; + + /// returns true if finite and magnitude is close to unit + pub fn PxQuat_isUnit(self_: *const PxQuat) -> bool; + + /// returns true if finite and magnitude is reasonably close to unit to allow for some accumulation of error vs + /// isValid + pub fn PxQuat_isSane(self_: *const PxQuat) -> bool; + + /// converts this quaternion to angle-axis representation + pub fn PxQuat_toRadiansAndUnitAxis(self_: *const PxQuat, angle: *mut f32, axis: *mut PxVec3); + + /// Gets the angle between this quat and the identity quaternion. + /// + /// Unit: + /// Radians + pub fn PxQuat_getAngle(self_: *const PxQuat) -> f32; + + /// Gets the angle between this quat and the argument + /// + /// Unit: + /// Radians + pub fn PxQuat_getAngle_1(self_: *const PxQuat, q: *const PxQuat) -> f32; + + /// This is the squared 4D vector length, should be 1 for unit quaternions. + pub fn PxQuat_magnitudeSquared(self_: *const PxQuat) -> f32; + + /// returns the scalar product of this and other. + pub fn PxQuat_dot(self_: *const PxQuat, v: *const PxQuat) -> f32; + + pub fn PxQuat_getNormalized(self_: *const PxQuat) -> PxQuat; + + pub fn PxQuat_magnitude(self_: *const PxQuat) -> f32; + + /// maps to the closest unit quaternion. + pub fn PxQuat_normalize_mut(self_: *mut PxQuat) -> f32; + + pub fn PxQuat_getConjugate(self_: *const PxQuat) -> PxQuat; + + pub fn PxQuat_getImaginaryPart(self_: *const PxQuat) -> PxVec3; + + /// brief computes rotation of x-axis + pub fn PxQuat_getBasisVector0(self_: *const PxQuat) -> PxVec3; + + /// brief computes rotation of y-axis + pub fn PxQuat_getBasisVector1(self_: *const PxQuat) -> PxVec3; + + /// brief computes rotation of z-axis + pub fn PxQuat_getBasisVector2(self_: *const PxQuat) -> PxVec3; + + /// rotates passed vec by this (assumed unitary) + pub fn PxQuat_rotate(self_: *const PxQuat, v: *const PxVec3) -> PxVec3; + + /// inverse rotates passed vec by this (assumed unitary) + pub fn PxQuat_rotateInv(self_: *const PxQuat, v: *const PxVec3) -> PxVec3; + + pub fn PxTransform_new() -> PxTransform; + + pub fn PxTransform_new_1(position: *const PxVec3) -> PxTransform; + + pub fn PxTransform_new_2(anon_param0: PxIDENTITY) -> PxTransform; + + pub fn PxTransform_new_3(orientation: *const PxQuat) -> PxTransform; + + pub fn PxTransform_new_4(x: f32, y: f32, z: f32, aQ: PxQuat) -> PxTransform; + + pub fn PxTransform_new_5(p0: *const PxVec3, q0: *const PxQuat) -> PxTransform; + + pub fn PxTransform_new_6(m: *const PxMat44) -> PxTransform; + + pub fn PxTransform_getInverse(self_: *const PxTransform) -> PxTransform; + + pub fn PxTransform_transform(self_: *const PxTransform, input: *const PxVec3) -> PxVec3; + + pub fn PxTransform_transformInv(self_: *const PxTransform, input: *const PxVec3) -> PxVec3; + + pub fn PxTransform_rotate(self_: *const PxTransform, input: *const PxVec3) -> PxVec3; + + pub fn PxTransform_rotateInv(self_: *const PxTransform, input: *const PxVec3) -> PxVec3; + + /// Transform transform to parent (returns compound transform: first src, then *this) + pub fn PxTransform_transform_1(self_: *const PxTransform, src: *const PxTransform) -> PxTransform; + + /// returns true if finite and q is a unit quaternion + pub fn PxTransform_isValid(self_: *const PxTransform) -> bool; + + /// returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error + /// vs isValid + pub fn PxTransform_isSane(self_: *const PxTransform) -> bool; + + /// returns true if all elems are finite (not NAN or INF, etc.) + pub fn PxTransform_isFinite(self_: *const PxTransform) -> bool; + + /// Transform transform from parent (returns compound transform: first src, then this->inverse) + pub fn PxTransform_transformInv_1(self_: *const PxTransform, src: *const PxTransform) -> PxTransform; + + /// return a normalized transform (i.e. one in which the quaternion has unit magnitude) + pub fn PxTransform_getNormalized(self_: *const PxTransform) -> PxTransform; + + /// Default constructor + pub fn PxMat33_new() -> PxMat33; + + /// identity constructor + pub fn PxMat33_new_1(anon_param0: PxIDENTITY) -> PxMat33; + + /// zero constructor + pub fn PxMat33_new_2(anon_param0: PxZERO) -> PxMat33; + + /// Construct from three base vectors + pub fn PxMat33_new_3(col0: *const PxVec3, col1: *const PxVec3, col2: *const PxVec3) -> PxMat33; + + /// constructor from a scalar, which generates a multiple of the identity matrix + pub fn PxMat33_new_4(r: f32) -> PxMat33; + + /// Construct from float[9] + pub fn PxMat33_new_5(values: *mut f32) -> PxMat33; + + /// Construct from a quaternion + pub fn PxMat33_new_6(q: *const PxQuat) -> PxMat33; + + /// Construct from diagonal, off-diagonals are zero. + pub fn PxMat33_createDiagonal(d: *const PxVec3) -> PxMat33; + + /// Computes the outer product of two vectors + pub fn PxMat33_outer(a: *const PxVec3, b: *const PxVec3) -> PxMat33; + + /// Get transposed matrix + pub fn PxMat33_getTranspose(self_: *const PxMat33) -> PxMat33; + + /// Get the real inverse + pub fn PxMat33_getInverse(self_: *const PxMat33) -> PxMat33; + + /// Get determinant + pub fn PxMat33_getDeterminant(self_: *const PxMat33) -> f32; + + /// Transform vector by matrix, equal to v' = M*v + pub fn PxMat33_transform(self_: *const PxMat33, other: *const PxVec3) -> PxVec3; + + /// Transform vector by matrix transpose, v' = M^t*v + pub fn PxMat33_transformTranspose(self_: *const PxMat33, other: *const PxVec3) -> PxVec3; + + pub fn PxMat33_front(self_: *const PxMat33) -> *const f32; + + /// Default constructor, not performing any initialization for performance reason. + /// + /// Use empty() function below to construct empty bounds. + pub fn PxBounds3_new() -> PxBounds3; + + /// Construct from two bounding points + pub fn PxBounds3_new_1(minimum: *const PxVec3, maximum: *const PxVec3) -> PxBounds3; + + /// Return empty bounds. + pub fn PxBounds3_empty() -> PxBounds3; + + /// returns the AABB containing v0 and v1. + pub fn PxBounds3_boundsOfPoints(v0: *const PxVec3, v1: *const PxVec3) -> PxBounds3; + + /// returns the AABB from center and extents vectors. + pub fn PxBounds3_centerExtents(center: *const PxVec3, extent: *const PxVec3) -> PxBounds3; + + /// Construct from center, extent, and (not necessarily orthogonal) basis + pub fn PxBounds3_basisExtent(center: *const PxVec3, basis: *const PxMat33, extent: *const PxVec3) -> PxBounds3; + + /// Construct from pose and extent + pub fn PxBounds3_poseExtent(pose: *const PxTransform, extent: *const PxVec3) -> PxBounds3; + + /// gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + /// + /// This version is safe to call for empty bounds. + pub fn PxBounds3_transformSafe(matrix: *const PxMat33, bounds: *const PxBounds3) -> PxBounds3; + + /// gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + /// + /// Calling this method for empty bounds leads to undefined behavior. Use [`transformSafe`]() instead. + pub fn PxBounds3_transformFast(matrix: *const PxMat33, bounds: *const PxBounds3) -> PxBounds3; + + /// gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + /// + /// This version is safe to call for empty bounds. + pub fn PxBounds3_transformSafe_1(transform: *const PxTransform, bounds: *const PxBounds3) -> PxBounds3; + + /// gets the transformed bounds of the passed AABB (resulting in a bigger AABB). + /// + /// Calling this method for empty bounds leads to undefined behavior. Use [`transformSafe`]() instead. + pub fn PxBounds3_transformFast_1(transform: *const PxTransform, bounds: *const PxBounds3) -> PxBounds3; + + /// Sets empty to true + pub fn PxBounds3_setEmpty_mut(self_: *mut PxBounds3); + + /// Sets the bounds to maximum size [-PX_MAX_BOUNDS_EXTENTS, PX_MAX_BOUNDS_EXTENTS]. + pub fn PxBounds3_setMaximal_mut(self_: *mut PxBounds3); + + /// expands the volume to include v + pub fn PxBounds3_include_mut(self_: *mut PxBounds3, v: *const PxVec3); + + /// expands the volume to include b. + pub fn PxBounds3_include_mut_1(self_: *mut PxBounds3, b: *const PxBounds3); + + pub fn PxBounds3_isEmpty(self_: *const PxBounds3) -> bool; + + /// indicates whether the intersection of this and b is empty or not. + pub fn PxBounds3_intersects(self_: *const PxBounds3, b: *const PxBounds3) -> bool; + + /// computes the 1D-intersection between two AABBs, on a given axis. + pub fn PxBounds3_intersects1D(self_: *const PxBounds3, a: *const PxBounds3, axis: u32) -> bool; + + /// indicates if these bounds contain v. + pub fn PxBounds3_contains(self_: *const PxBounds3, v: *const PxVec3) -> bool; + + /// checks a box is inside another box. + pub fn PxBounds3_isInside(self_: *const PxBounds3, box_: *const PxBounds3) -> bool; + + /// returns the center of this axis aligned box. + pub fn PxBounds3_getCenter(self_: *const PxBounds3) -> PxVec3; + + /// get component of the box's center along a given axis + pub fn PxBounds3_getCenter_1(self_: *const PxBounds3, axis: u32) -> f32; + + /// get component of the box's extents along a given axis + pub fn PxBounds3_getExtents(self_: *const PxBounds3, axis: u32) -> f32; + + /// returns the dimensions (width/height/depth) of this axis aligned box. + pub fn PxBounds3_getDimensions(self_: *const PxBounds3) -> PxVec3; + + /// returns the extents, which are half of the width/height/depth. + pub fn PxBounds3_getExtents_1(self_: *const PxBounds3) -> PxVec3; + + /// scales the AABB. + /// + /// This version is safe to call for empty bounds. + pub fn PxBounds3_scaleSafe_mut(self_: *mut PxBounds3, scale: f32); + + /// scales the AABB. + /// + /// Calling this method for empty bounds leads to undefined behavior. Use [`scaleSafe`]() instead. + pub fn PxBounds3_scaleFast_mut(self_: *mut PxBounds3, scale: f32); + + /// fattens the AABB in all 3 dimensions by the given distance. + /// + /// This version is safe to call for empty bounds. + pub fn PxBounds3_fattenSafe_mut(self_: *mut PxBounds3, distance: f32); + + /// fattens the AABB in all 3 dimensions by the given distance. + /// + /// Calling this method for empty bounds leads to undefined behavior. Use [`fattenSafe`]() instead. + pub fn PxBounds3_fattenFast_mut(self_: *mut PxBounds3, distance: f32); + + /// checks that the AABB values are not NaN + pub fn PxBounds3_isFinite(self_: *const PxBounds3) -> bool; + + /// checks that the AABB values describe a valid configuration. + pub fn PxBounds3_isValid(self_: *const PxBounds3) -> bool; + + /// Finds the closest point in the box to the point p. If p is contained, this will be p, otherwise it + /// will be the closest point on the surface of the box. + pub fn PxBounds3_closestPoint(self_: *const PxBounds3, p: *const PxVec3) -> PxVec3; + + pub fn PxErrorCallback_delete(self_: *mut PxErrorCallback); + + /// Reports an error code. + pub fn PxErrorCallback_reportError_mut(self_: *mut PxErrorCallback, code: PxErrorCode, message: *const std::ffi::c_char, file: *const std::ffi::c_char, line: i32); + + /// callback when memory is allocated. + pub fn PxAllocationListener_onAllocation_mut(self_: *mut PxAllocationListener, size: usize, typeName: *const std::ffi::c_char, filename: *const std::ffi::c_char, line: i32, allocatedMemory: *mut std::ffi::c_void); + + /// callback when memory is deallocated. + pub fn PxAllocationListener_onDeallocation_mut(self_: *mut PxAllocationListener, allocatedMemory: *mut std::ffi::c_void); + + /// The default constructor. + pub fn PxBroadcastingAllocator_new_alloc(allocator: *mut PxAllocatorCallback, error: *mut PxErrorCallback) -> *mut PxBroadcastingAllocator; + + /// The default constructor. + pub fn PxBroadcastingAllocator_delete(self_: *mut PxBroadcastingAllocator); + + /// 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. + /// + /// Threading: + /// This function should be thread safe as it can be called in the context of the user thread + /// and physics processing thread(s). + /// + /// The allocated block of memory. + pub fn PxBroadcastingAllocator_allocate_mut(self_: *mut PxBroadcastingAllocator, size: usize, typeName: *const std::ffi::c_char, filename: *const std::ffi::c_char, line: i32) -> *mut std::ffi::c_void; + + /// Frees memory previously allocated by allocate(). + /// + /// Threading: + /// This function should be thread safe as it can be called in the context of the user thread + /// and physics processing thread(s). + pub fn PxBroadcastingAllocator_deallocate_mut(self_: *mut PxBroadcastingAllocator, ptr: *mut std::ffi::c_void); + + /// The default constructor. + pub fn PxBroadcastingErrorCallback_new_alloc(errorCallback: *mut PxErrorCallback) -> *mut PxBroadcastingErrorCallback; + + /// The default destructor. + pub fn PxBroadcastingErrorCallback_delete(self_: *mut PxBroadcastingErrorCallback); + + /// Reports an error code. + pub fn PxBroadcastingErrorCallback_reportError_mut(self_: *mut PxBroadcastingErrorCallback, code: PxErrorCode, message: *const std::ffi::c_char, file: *const std::ffi::c_char, line: i32); + + /// Enables floating point exceptions for the scalar and SIMD unit + pub fn phys_PxEnableFPExceptions(); + + /// Disables floating point exceptions for the scalar and SIMD unit + pub fn phys_PxDisableFPExceptions(); + + /// read from the stream. The number of bytes read may be less than the number requested. + /// + /// the number of bytes read from the stream. + pub fn PxInputStream_read_mut(self_: *mut PxInputStream, dest: *mut std::ffi::c_void, count: u32) -> u32; + + pub fn PxInputStream_delete(self_: *mut PxInputStream); + + /// return the length of the input data + /// + /// size in bytes of the input data + pub fn PxInputData_getLength(self_: *const PxInputData) -> u32; + + /// seek to the given offset from the start of the data. + pub fn PxInputData_seek_mut(self_: *mut PxInputData, offset: u32); + + /// return the current offset from the start of the data + /// + /// the offset to seek to. + pub fn PxInputData_tell(self_: *const PxInputData) -> u32; + + pub fn PxInputData_delete(self_: *mut PxInputData); + + /// write to the stream. The number of bytes written may be less than the number sent. + /// + /// the number of bytes written to the stream by this call. + pub fn PxOutputStream_write_mut(self_: *mut PxOutputStream, src: *const std::ffi::c_void, count: u32) -> u32; + + pub fn PxOutputStream_delete(self_: *mut PxOutputStream); + + /// default constructor leaves data uninitialized. + pub fn PxVec4_new() -> PxVec4; + + /// zero constructor. + pub fn PxVec4_new_1(anon_param0: PxZERO) -> PxVec4; + + /// Assigns scalar parameter to all elements. + /// + /// Useful to initialize to zero or one. + pub fn PxVec4_new_2(a: f32) -> PxVec4; + + /// Initializes from 3 scalar parameters. + pub fn PxVec4_new_3(nx: f32, ny: f32, nz: f32, nw: f32) -> PxVec4; + + /// Initializes from 3 scalar parameters. + pub fn PxVec4_new_4(v: *const PxVec3, nw: f32) -> PxVec4; + + /// Initializes from an array of scalar parameters. + pub fn PxVec4_new_5(v: *const f32) -> PxVec4; + + /// tests for exact zero vector + pub fn PxVec4_isZero(self_: *const PxVec4) -> bool; + + /// returns true if all 3 elems of the vector are finite (not NAN or INF, etc.) + pub fn PxVec4_isFinite(self_: *const PxVec4) -> bool; + + /// is normalized - used by API parameter validation + pub fn PxVec4_isNormalized(self_: *const PxVec4) -> bool; + + /// returns the squared magnitude + /// + /// Avoids calling PxSqrt()! + pub fn PxVec4_magnitudeSquared(self_: *const PxVec4) -> f32; + + /// returns the magnitude + pub fn PxVec4_magnitude(self_: *const PxVec4) -> f32; + + /// returns the scalar product of this and other. + pub fn PxVec4_dot(self_: *const PxVec4, v: *const PxVec4) -> f32; + + /// returns a unit vector + pub fn PxVec4_getNormalized(self_: *const PxVec4) -> PxVec4; + + /// normalizes the vector in place + pub fn PxVec4_normalize_mut(self_: *mut PxVec4) -> f32; + + /// a[i] * b[i], for all i. + pub fn PxVec4_multiply(self_: *const PxVec4, a: *const PxVec4) -> PxVec4; + + /// element-wise minimum + pub fn PxVec4_minimum(self_: *const PxVec4, v: *const PxVec4) -> PxVec4; + + /// element-wise maximum + pub fn PxVec4_maximum(self_: *const PxVec4, v: *const PxVec4) -> PxVec4; + + pub fn PxVec4_getXYZ(self_: *const PxVec4) -> PxVec3; + + /// Default constructor + pub fn PxMat44_new() -> PxMat44; + + /// identity constructor + pub fn PxMat44_new_1(anon_param0: PxIDENTITY) -> PxMat44; + + /// zero constructor + pub fn PxMat44_new_2(anon_param0: PxZERO) -> PxMat44; + + /// Construct from four 4-vectors + pub fn PxMat44_new_3(col0: *const PxVec4, col1: *const PxVec4, col2: *const PxVec4, col3: *const PxVec4) -> PxMat44; + + /// constructor that generates a multiple of the identity matrix + pub fn PxMat44_new_4(r: f32) -> PxMat44; + + /// Construct from three base vectors and a translation + pub fn PxMat44_new_5(col0: *const PxVec3, col1: *const PxVec3, col2: *const PxVec3, col3: *const PxVec3) -> PxMat44; + + /// Construct from float[16] + pub fn PxMat44_new_6(values: *mut f32) -> PxMat44; + + /// Construct from a quaternion + pub fn PxMat44_new_7(q: *const PxQuat) -> PxMat44; + + /// Construct from a diagonal vector + pub fn PxMat44_new_8(diagonal: *const PxVec4) -> PxMat44; + + /// Construct from Mat33 and a translation + pub fn PxMat44_new_9(axes: *const PxMat33, position: *const PxVec3) -> PxMat44; + + pub fn PxMat44_new_10(t: *const PxTransform) -> PxMat44; + + /// Get transposed matrix + pub fn PxMat44_getTranspose(self_: *const PxMat44) -> PxMat44; + + /// Transform vector by matrix, equal to v' = M*v + pub fn PxMat44_transform(self_: *const PxMat44, other: *const PxVec4) -> PxVec4; + + /// Transform vector by matrix, equal to v' = M*v + pub fn PxMat44_transform_1(self_: *const PxMat44, other: *const PxVec3) -> PxVec3; + + /// Rotate vector by matrix, equal to v' = M*v + pub fn PxMat44_rotate(self_: *const PxMat44, other: *const PxVec4) -> PxVec4; + + /// Rotate vector by matrix, equal to v' = M*v + pub fn PxMat44_rotate_1(self_: *const PxMat44, other: *const PxVec3) -> PxVec3; + + pub fn PxMat44_getBasis(self_: *const PxMat44, num: u32) -> PxVec3; + + pub fn PxMat44_getPosition(self_: *const PxMat44) -> PxVec3; + + pub fn PxMat44_setPosition_mut(self_: *mut PxMat44, position: *const PxVec3); + + pub fn PxMat44_front(self_: *const PxMat44) -> *const f32; + + pub fn PxMat44_scale_mut(self_: *mut PxMat44, p: *const PxVec4); + + pub fn PxMat44_inverseRT(self_: *const PxMat44) -> PxMat44; + + pub fn PxMat44_isFinite(self_: *const PxMat44) -> bool; + + /// Constructor + pub fn PxPlane_new() -> PxPlane; + + /// Constructor from a normal and a distance + pub fn PxPlane_new_1(nx: f32, ny: f32, nz: f32, distance: f32) -> PxPlane; + + /// Constructor from a normal and a distance + pub fn PxPlane_new_2(normal: *const PxVec3, distance: f32) -> PxPlane; + + /// Constructor from a point on the plane and a normal + pub fn PxPlane_new_3(point: *const PxVec3, normal: *const PxVec3) -> PxPlane; + + /// Constructor from three points + pub fn PxPlane_new_4(p0: *const PxVec3, p1: *const PxVec3, p2: *const PxVec3) -> PxPlane; + + pub fn PxPlane_distance(self_: *const PxPlane, p: *const PxVec3) -> f32; + + pub fn PxPlane_contains(self_: *const PxPlane, p: *const PxVec3) -> bool; + + /// projects p into the plane + pub fn PxPlane_project(self_: *const PxPlane, p: *const PxVec3) -> PxVec3; + + /// find an arbitrary point in the plane + pub fn PxPlane_pointInPlane(self_: *const PxPlane) -> PxVec3; + + /// equivalent plane with unit normal + pub fn PxPlane_normalize_mut(self_: *mut PxPlane); + + /// transform plane + pub fn PxPlane_transform(self_: *const PxPlane, pose: *const PxTransform) -> PxPlane; + + /// inverse-transform plane + pub fn PxPlane_inverseTransform(self_: *const PxPlane, pose: *const PxTransform) -> PxPlane; + + /// finds the shortest rotation between two vectors. + /// + /// a rotation about an axis normal to the two vectors which takes one to the other via the shortest path + pub fn phys_PxShortestRotation(from: *const PxVec3, target: *const PxVec3) -> PxQuat; + + pub fn phys_PxDiagonalize(m: *const PxMat33, axes: *mut PxQuat) -> PxVec3; + + /// creates a transform from the endpoints of a segment, suitable for an actor transform for a PxCapsuleGeometry + /// + /// A PxTransform which will transform the vector (1,0,0) to the capsule axis shrunk by the halfHeight + pub fn phys_PxTransformFromSegment(p0: *const PxVec3, p1: *const PxVec3, halfHeight: *mut f32) -> PxTransform; + + /// creates a transform from a plane equation, suitable for an actor transform for a PxPlaneGeometry + /// + /// a PxTransform which will transform the plane PxPlane(1,0,0,0) to the specified plane + pub fn phys_PxTransformFromPlaneEquation(plane: *const PxPlane) -> PxTransform; + + /// creates a plane equation from a transform, such as the actor transform for a PxPlaneGeometry + /// + /// the plane + pub fn phys_PxPlaneEquationFromTransform(pose: *const PxTransform) -> PxPlane; + + /// Spherical linear interpolation of two quaternions. + /// + /// Returns left when t=0, right when t=1 and a linear interpolation of left and right when 0 + /// < + /// t + /// < + /// 1. + /// Returns angle between -PI and PI in radians + pub fn phys_PxSlerp(t: f32, left: *const PxQuat, right: *const PxQuat) -> PxQuat; + + /// integrate transform. + pub fn phys_PxIntegrateTransform(curTrans: *const PxTransform, linvel: *const PxVec3, angvel: *const PxVec3, timeStep: f32, result: *mut PxTransform); + + /// Compute the exponent of a PxVec3 + pub fn phys_PxExp(v: *const PxVec3) -> PxQuat; + + /// computes a oriented bounding box around the scaled basis. + /// + /// Bounding box extent. + pub fn phys_PxOptimizeBoundingBox(basis: *mut PxMat33) -> PxVec3; + + /// return Returns the log of a PxQuat + pub fn phys_PxLog(q: *const PxQuat) -> PxVec3; + + /// return Returns 0 if v.x is largest element of v, 1 if v.y is largest element, 2 if v.z is largest element. + pub fn phys_PxLargestAxis(v: *const PxVec3) -> u32; + + /// Compute tan(theta/2) given sin(theta) and cos(theta) as inputs. + /// + /// Returns tan(theta/2) + pub fn phys_PxTanHalf(sin: f32, cos: f32) -> f32; + + /// Compute the closest point on an 2d ellipse to a given 2d point. + /// + /// Returns the 2d position on the surface of the ellipse that is closest to point. + pub fn phys_PxEllipseClamp(point: *const PxVec3, radii: *const PxVec3) -> PxVec3; + + /// Compute from an input quaternion q a pair of quaternions (swing, twist) such that + /// q = swing * twist + /// with the caveats that swing.x = twist.y = twist.z = 0. + pub fn phys_PxSeparateSwingTwist(q: *const PxQuat, swing: *mut PxQuat, twist: *mut PxQuat); + + /// Compute the angle between two non-unit vectors + /// + /// Returns the angle (in radians) between the two vector v0 and v1. + pub fn phys_PxComputeAngle(v0: *const PxVec3, v1: *const PxVec3) -> f32; + + /// Compute two normalized vectors (right and up) that are perpendicular to an input normalized vector (dir). + pub fn phys_PxComputeBasisVectors(dir: *const PxVec3, right: *mut PxVec3, up: *mut PxVec3); + + /// Compute three normalized vectors (dir, right and up) that are parallel to (dir) and perpendicular to (right, up) the + /// normalized direction vector (p1 - p0)/||p1 - p0||. + pub fn phys_PxComputeBasisVectors_1(p0: *const PxVec3, p1: *const PxVec3, dir: *mut PxVec3, right: *mut PxVec3, up: *mut PxVec3); + + /// Compute (i+1)%3 + pub fn phys_PxGetNextIndex3(i: u32) -> u32; + + pub fn phys_computeBarycentric(a: *const PxVec3, b: *const PxVec3, c: *const PxVec3, d: *const PxVec3, p: *const PxVec3, bary: *mut PxVec4); + + pub fn phys_computeBarycentric_1(a: *const PxVec3, b: *const PxVec3, c: *const PxVec3, p: *const PxVec3, bary: *mut PxVec4); + + pub fn Interpolation_PxLerp(a: f32, b: f32, t: f32) -> f32; + + pub fn Interpolation_PxBiLerp(f00: f32, f10: f32, f01: f32, f11: f32, tx: f32, ty: f32) -> f32; + + pub fn Interpolation_PxTriLerp(f000: f32, f100: f32, f010: f32, f110: f32, f001: f32, f101: f32, f011: f32, f111: f32, tx: f32, ty: f32, tz: f32) -> f32; + + pub fn Interpolation_PxSDFIdx(i: u32, j: u32, k: u32, nbX: u32, nbY: u32) -> u32; + + pub fn Interpolation_PxSDFSampleImpl(sdf: *const f32, localPos: *const PxVec3, sdfBoxLower: *const PxVec3, sdfBoxHigher: *const PxVec3, sdfDx: f32, invSdfDx: f32, dimX: u32, dimY: u32, dimZ: u32, tolerance: f32) -> f32; + + pub fn phys_PxSdfSample(sdf: *const f32, localPos: *const PxVec3, sdfBoxLower: *const PxVec3, sdfBoxHigher: *const PxVec3, sdfDx: f32, invSdfDx: f32, dimX: u32, dimY: u32, dimZ: u32, gradient: *mut PxVec3, tolerance: f32) -> f32; + + /// The constructor for Mutex creates a mutex. It is initially unlocked. + pub fn PxMutexImpl_new_alloc() -> *mut PxMutexImpl; + + /// The destructor for Mutex deletes the mutex. + pub fn PxMutexImpl_delete(self_: *mut PxMutexImpl); + + /// Acquire (lock) the mutex. If the mutex is already locked + /// by another thread, this method blocks until the mutex is + /// unlocked. + pub fn PxMutexImpl_lock_mut(self_: *mut PxMutexImpl); + + /// Acquire (lock) the mutex. If the mutex is already locked + /// by another thread, this method returns false without blocking. + pub fn PxMutexImpl_trylock_mut(self_: *mut PxMutexImpl) -> bool; + + /// Release (unlock) the mutex. + pub fn PxMutexImpl_unlock_mut(self_: *mut PxMutexImpl); + + /// Size of this class. + pub fn PxMutexImpl_getSize() -> u32; + + pub fn PxReadWriteLock_new_alloc() -> *mut PxReadWriteLock; + + pub fn PxReadWriteLock_delete(self_: *mut PxReadWriteLock); + + pub fn PxReadWriteLock_lockReader_mut(self_: *mut PxReadWriteLock, takeLock: bool); + + pub fn PxReadWriteLock_lockWriter_mut(self_: *mut PxReadWriteLock); + + pub fn PxReadWriteLock_unlockReader_mut(self_: *mut PxReadWriteLock); + + pub fn PxReadWriteLock_unlockWriter_mut(self_: *mut PxReadWriteLock); + + /// Mark the beginning of a nested profile block + /// + /// Returns implementation-specific profiler data for this event + pub fn PxProfilerCallback_zoneStart_mut(self_: *mut PxProfilerCallback, eventName: *const std::ffi::c_char, detached: bool, contextId: u64) -> *mut std::ffi::c_void; + + /// Mark the end of a nested profile block + /// + /// eventName plus contextId can be used to uniquely match up start and end of a zone. + pub fn PxProfilerCallback_zoneEnd_mut(self_: *mut PxProfilerCallback, profilerData: *mut std::ffi::c_void, eventName: *const std::ffi::c_char, detached: bool, contextId: u64); + + pub fn PxProfileScoped_new_alloc(callback: *mut PxProfilerCallback, eventName: *const std::ffi::c_char, detached: bool, contextId: u64) -> *mut PxProfileScoped; + + pub fn PxProfileScoped_delete(self_: *mut PxProfileScoped); + + pub fn PxSListEntry_new() -> PxSListEntry; + + pub fn PxSListEntry_next_mut(self_: *mut PxSListEntry) -> *mut PxSListEntry; + + pub fn PxSListImpl_new_alloc() -> *mut PxSListImpl; + + pub fn PxSListImpl_delete(self_: *mut PxSListImpl); + + pub fn PxSListImpl_push_mut(self_: *mut PxSListImpl, entry: *mut PxSListEntry); + + pub fn PxSListImpl_pop_mut(self_: *mut PxSListImpl) -> *mut PxSListEntry; + + pub fn PxSListImpl_flush_mut(self_: *mut PxSListImpl) -> *mut PxSListEntry; + + pub fn PxSListImpl_getSize() -> u32; + + pub fn PxSyncImpl_new_alloc() -> *mut PxSyncImpl; + + pub fn PxSyncImpl_delete(self_: *mut PxSyncImpl); + + /// Wait on the object for at most the given number of ms. Returns + /// true if the object is signaled. Sync::waitForever will block forever + /// or until the object is signaled. + pub fn PxSyncImpl_wait_mut(self_: *mut PxSyncImpl, milliseconds: u32) -> bool; + + /// Signal the synchronization object, waking all threads waiting on it + pub fn PxSyncImpl_set_mut(self_: *mut PxSyncImpl); + + /// Reset the synchronization object + pub fn PxSyncImpl_reset_mut(self_: *mut PxSyncImpl); + + /// Size of this class. + pub fn PxSyncImpl_getSize() -> u32; + + pub fn PxRunnable_new_alloc() -> *mut PxRunnable; + + pub fn PxRunnable_delete(self_: *mut PxRunnable); + + pub fn PxRunnable_execute_mut(self_: *mut PxRunnable); + + pub fn phys_PxTlsAlloc() -> u32; + + pub fn phys_PxTlsFree(index: u32); + + pub fn phys_PxTlsGet(index: u32) -> *mut std::ffi::c_void; + + pub fn phys_PxTlsGetValue(index: u32) -> usize; + + pub fn phys_PxTlsSet(index: u32, value: *mut std::ffi::c_void) -> u32; + + pub fn phys_PxTlsSetValue(index: u32, value: usize) -> u32; + + pub fn PxCounterFrequencyToTensOfNanos_new(inNum: u64, inDenom: u64) -> PxCounterFrequencyToTensOfNanos; + + pub fn PxCounterFrequencyToTensOfNanos_toTensOfNanos(self_: *const PxCounterFrequencyToTensOfNanos, inCounter: u64) -> u64; + + pub fn PxTime_getBootCounterFrequency() -> *const PxCounterFrequencyToTensOfNanos; + + pub fn PxTime_getCounterFrequency() -> PxCounterFrequencyToTensOfNanos; + + pub fn PxTime_getCurrentCounterValue() -> u64; + + pub fn PxTime_getCurrentTimeInTensOfNanoSeconds() -> u64; + + pub fn PxTime_new() -> PxTime; + + pub fn PxTime_getElapsedSeconds_mut(self_: *mut PxTime) -> f64; + + pub fn PxTime_peekElapsedSeconds_mut(self_: *mut PxTime) -> f64; + + pub fn PxTime_getLastTime(self_: *const PxTime) -> f64; + + /// default constructor leaves data uninitialized. + pub fn PxVec2_new() -> PxVec2; + + /// zero constructor. + pub fn PxVec2_new_1(anon_param0: PxZERO) -> PxVec2; + + /// Assigns scalar parameter to all elements. + /// + /// Useful to initialize to zero or one. + pub fn PxVec2_new_2(a: f32) -> PxVec2; + + /// Initializes from 2 scalar parameters. + pub fn PxVec2_new_3(nx: f32, ny: f32) -> PxVec2; + + /// tests for exact zero vector + pub fn PxVec2_isZero(self_: *const PxVec2) -> bool; + + /// returns true if all 2 elems of the vector are finite (not NAN or INF, etc.) + pub fn PxVec2_isFinite(self_: *const PxVec2) -> bool; + + /// is normalized - used by API parameter validation + pub fn PxVec2_isNormalized(self_: *const PxVec2) -> bool; + + /// returns the squared magnitude + /// + /// Avoids calling PxSqrt()! + pub fn PxVec2_magnitudeSquared(self_: *const PxVec2) -> f32; + + /// returns the magnitude + pub fn PxVec2_magnitude(self_: *const PxVec2) -> f32; + + /// returns the scalar product of this and other. + pub fn PxVec2_dot(self_: *const PxVec2, v: *const PxVec2) -> f32; + + /// returns a unit vector + pub fn PxVec2_getNormalized(self_: *const PxVec2) -> PxVec2; + + /// normalizes the vector in place + pub fn PxVec2_normalize_mut(self_: *mut PxVec2) -> f32; + + /// a[i] * b[i], for all i. + pub fn PxVec2_multiply(self_: *const PxVec2, a: *const PxVec2) -> PxVec2; + + /// element-wise minimum + pub fn PxVec2_minimum(self_: *const PxVec2, v: *const PxVec2) -> PxVec2; + + /// returns MIN(x, y); + pub fn PxVec2_minElement(self_: *const PxVec2) -> f32; + + /// element-wise maximum + pub fn PxVec2_maximum(self_: *const PxVec2, v: *const PxVec2) -> PxVec2; + + /// returns MAX(x, y); + pub fn PxVec2_maxElement(self_: *const PxVec2) -> f32; + + pub fn PxStridedData_new() -> PxStridedData; + + pub fn PxBoundedData_new() -> PxBoundedData; + + pub fn PxDebugPoint_new(p: *const PxVec3, c: *const u32) -> PxDebugPoint; + + pub fn PxDebugLine_new(p0: *const PxVec3, p1: *const PxVec3, c: *const u32) -> PxDebugLine; + + pub fn PxDebugTriangle_new(p0: *const PxVec3, p1: *const PxVec3, p2: *const PxVec3, c: *const u32) -> PxDebugTriangle; + + pub fn PxDebugText_new() -> PxDebugText; + + pub fn PxDebugText_new_1(pos: *const PxVec3, sz: *const f32, clr: *const u32, str: *const std::ffi::c_char) -> PxDebugText; + + pub fn PxRenderBuffer_delete(self_: *mut PxRenderBuffer); + + pub fn PxRenderBuffer_getNbPoints(self_: *const PxRenderBuffer) -> u32; + + pub fn PxRenderBuffer_getPoints(self_: *const PxRenderBuffer) -> *const PxDebugPoint; + + pub fn PxRenderBuffer_addPoint_mut(self_: *mut PxRenderBuffer, point: *const PxDebugPoint); + + pub fn PxRenderBuffer_getNbLines(self_: *const PxRenderBuffer) -> u32; + + pub fn PxRenderBuffer_getLines(self_: *const PxRenderBuffer) -> *const PxDebugLine; + + pub fn PxRenderBuffer_addLine_mut(self_: *mut PxRenderBuffer, line: *const PxDebugLine); + + pub fn PxRenderBuffer_reserveLines_mut(self_: *mut PxRenderBuffer, nbLines: u32) -> *mut PxDebugLine; + + pub fn PxRenderBuffer_reservePoints_mut(self_: *mut PxRenderBuffer, nbLines: u32) -> *mut PxDebugPoint; + + pub fn PxRenderBuffer_getNbTriangles(self_: *const PxRenderBuffer) -> u32; + + pub fn PxRenderBuffer_getTriangles(self_: *const PxRenderBuffer) -> *const PxDebugTriangle; + + pub fn PxRenderBuffer_addTriangle_mut(self_: *mut PxRenderBuffer, triangle: *const PxDebugTriangle); + + pub fn PxRenderBuffer_append_mut(self_: *mut PxRenderBuffer, other: *const PxRenderBuffer); + + pub fn PxRenderBuffer_clear_mut(self_: *mut PxRenderBuffer); + + pub fn PxRenderBuffer_shift_mut(self_: *mut PxRenderBuffer, delta: *const PxVec3); + + pub fn PxRenderBuffer_empty(self_: *const PxRenderBuffer) -> bool; + + pub fn PxProcessPxBaseCallback_delete(self_: *mut PxProcessPxBaseCallback); + + pub fn PxProcessPxBaseCallback_process_mut(self_: *mut PxProcessPxBaseCallback, anon_param0: *mut PxBase); + + /// Registers a reference value corresponding to a PxBase object. + /// + /// This method is assumed to be called in the implementation of PxSerializer::registerReferences for serialized + /// references that need to be resolved on deserialization. + /// + /// A reference needs to be associated with exactly one PxBase object in either the collection or the + /// external references collection. + /// + /// Different kinds of references are supported and need to be specified. In the most common case + /// (PX_SERIAL_REF_KIND_PXBASE) the PxBase object matches the reference value (which is the pointer + /// to the PxBase object). Integer references maybe registered as well (used for internal material + /// indices with PX_SERIAL_REF_KIND_MATERIAL_IDX). Other kinds could be added with the restriction that + /// for pointer types the kind value needs to be marked with the PX_SERIAL_REF_KIND_PTR_TYPE_BIT. + pub fn PxSerializationContext_registerReference_mut(self_: *mut PxSerializationContext, base: *mut PxBase, kind: u32, reference: usize); + + /// Returns the collection that is being serialized. + pub fn PxSerializationContext_getCollection(self_: *const PxSerializationContext) -> *const PxCollection; + + /// Serializes object data and object extra data. + /// + /// This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + pub fn PxSerializationContext_writeData_mut(self_: *mut PxSerializationContext, data: *const std::ffi::c_void, size: u32); + + /// Aligns the serialized data. + /// + /// This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData. + pub fn PxSerializationContext_alignData_mut(self_: *mut PxSerializationContext, alignment: u32); + + /// Helper function to write a name to the extraData if serialization is configured to save names. + /// + /// This function is assumed to be called within the implementation of PxSerializer::exportExtraData. + pub fn PxSerializationContext_writeName_mut(self_: *mut PxSerializationContext, name: *const std::ffi::c_char); + + /// Retrieves a pointer to a deserialized PxBase object given a corresponding deserialized reference value + /// + /// This method is assumed to be called in the implementation of PxSerializer::createObject in order + /// to update reference values on deserialization. + /// + /// To update a PxBase reference the corresponding deserialized pointer value needs to be provided in order to retrieve + /// the location of the corresponding deserialized PxBase object. (PxDeserializationContext::translatePxBase simplifies + /// this common case). + /// + /// For other kinds of references the reverence values need to be updated by deduction given the corresponding PxBase instance. + /// + /// PxBase object associated with the reference value + pub fn PxDeserializationContext_resolveReference(self_: *const PxDeserializationContext, kind: u32, reference: usize) -> *mut PxBase; + + /// Helper function to read a name from the extra data during deserialization. + /// + /// This function is assumed to be called within the implementation of PxSerializer::createObject. + pub fn PxDeserializationContext_readName_mut(self_: *mut PxDeserializationContext, name: *mut *const std::ffi::c_char); + + /// Function to align the extra data stream to a power of 2 alignment + /// + /// This function is assumed to be called within the implementation of PxSerializer::createObject. + pub fn PxDeserializationContext_alignExtraData_mut(self_: *mut PxDeserializationContext, alignment: u32); + + /// Register a serializer for a concrete type + pub fn PxSerializationRegistry_registerSerializer_mut(self_: *mut PxSerializationRegistry, type_: u16, serializer: *mut PxSerializer); + + /// Unregister a serializer for a concrete type, and retrieves the corresponding serializer object. + /// + /// Unregistered serializer corresponding to type, NULL for types for which no serializer has been registered. + pub fn PxSerializationRegistry_unregisterSerializer_mut(self_: *mut PxSerializationRegistry, type_: u16) -> *mut PxSerializer; + + /// Returns PxSerializer corresponding to type + /// + /// Registered PxSerializer object corresponding to type + pub fn PxSerializationRegistry_getSerializer(self_: *const PxSerializationRegistry, type_: u16) -> *const PxSerializer; + + /// Register a RepX serializer for a concrete type + pub fn PxSerializationRegistry_registerRepXSerializer_mut(self_: *mut PxSerializationRegistry, type_: u16, serializer: *mut PxRepXSerializer); + + /// Unregister a RepX serializer for a concrete type, and retrieves the corresponding serializer object. + /// + /// Unregistered PxRepxSerializer corresponding to type, NULL for types for which no RepX serializer has been registered. + pub fn PxSerializationRegistry_unregisterRepXSerializer_mut(self_: *mut PxSerializationRegistry, type_: u16) -> *mut PxRepXSerializer; + + /// Returns RepX serializer given the corresponding type name + /// + /// Registered PxRepXSerializer object corresponding to type name + pub fn PxSerializationRegistry_getRepXSerializer(self_: *const PxSerializationRegistry, typeName: *const std::ffi::c_char) -> *mut PxRepXSerializer; + + /// Releases PxSerializationRegistry instance. + /// + /// This unregisters all PhysX and PhysXExtension serializers. Make sure to unregister all custom type + /// serializers before releasing the PxSerializationRegistry. + pub fn PxSerializationRegistry_release_mut(self_: *mut PxSerializationRegistry); + + /// Adds a PxBase object to the collection. + /// + /// Adds a PxBase object to the collection. Optionally a PxSerialObjectId can be provided + /// in order to resolve dependencies between collections. A PxSerialObjectId value of PX_SERIAL_OBJECT_ID_INVALID + /// means the object remains without id. Objects can be added regardless of other objects they require. If the object + /// is already in the collection, the ID will be set if it was PX_SERIAL_OBJECT_ID_INVALID previously, otherwise the + /// operation fails. + pub fn PxCollection_add_mut(self_: *mut PxCollection, object: *mut PxBase, id: u64); + + /// Removes a PxBase member object from the collection. + /// + /// Object needs to be contained by the collection. + pub fn PxCollection_remove_mut(self_: *mut PxCollection, object: *mut PxBase); + + /// Returns whether the collection contains a certain PxBase object. + /// + /// Whether object is contained. + pub fn PxCollection_contains(self_: *const PxCollection, object: *mut PxBase) -> bool; + + /// Adds an id to a member PxBase object. + /// + /// If the object is already associated with an id within the collection, the id is replaced. + /// May only be called for objects that are members of the collection. The id needs to be unique + /// within the collection. + pub fn PxCollection_addId_mut(self_: *mut PxCollection, object: *mut PxBase, id: u64); + + /// Removes id from a contained PxBase object. + /// + /// May only be called for ids that are associated with an object in the collection. + pub fn PxCollection_removeId_mut(self_: *mut PxCollection, id: u64); + + /// Adds all PxBase objects and their ids of collection to this collection. + /// + /// PxBase objects already in this collection are ignored. Object ids need to be conflict + /// free, i.e. the same object may not have two different ids within the two collections. + pub fn PxCollection_add_mut_1(self_: *mut PxCollection, collection: *mut PxCollection); + + /// Removes all PxBase objects of collection from this collection. + /// + /// PxBase objects not present in this collection are ignored. Ids of objects + /// which are removed are also removed. + pub fn PxCollection_remove_mut_1(self_: *mut PxCollection, collection: *mut PxCollection); + + /// Gets number of PxBase objects in this collection. + /// + /// Number of objects in this collection + pub fn PxCollection_getNbObjects(self_: *const PxCollection) -> u32; + + /// Gets the PxBase object of this collection given its index. + /// + /// PxBase object at index index + pub fn PxCollection_getObject(self_: *const PxCollection, index: u32) -> *mut PxBase; + + /// Copies member PxBase pointers to a user specified buffer. + /// + /// number of members PxBase objects that have been written to the userBuffer + pub fn PxCollection_getObjects(self_: *const PxCollection, userBuffer: *mut *mut PxBase, bufferSize: u32, startIndex: u32) -> u32; + + /// Looks for a PxBase object given a PxSerialObjectId value. + /// + /// If there is no PxBase object in the collection with the given id, NULL is returned. + /// + /// PxBase object with the given id value or NULL + pub fn PxCollection_find(self_: *const PxCollection, id: u64) -> *mut PxBase; + + /// Gets number of PxSerialObjectId names in this collection. + /// + /// Number of PxSerialObjectId names in this collection + pub fn PxCollection_getNbIds(self_: *const PxCollection) -> u32; + + /// Copies member PxSerialObjectId values to a user specified buffer. + /// + /// number of members PxSerialObjectId values that have been written to the userBuffer + pub fn PxCollection_getIds(self_: *const PxCollection, userBuffer: *mut u64, bufferSize: u32, startIndex: u32) -> u32; + + /// Gets the PxSerialObjectId name of a PxBase object within the collection. + /// + /// The PxBase object needs to be a member of the collection. + /// + /// PxSerialObjectId name of the object or PX_SERIAL_OBJECT_ID_INVALID if the object is unnamed + pub fn PxCollection_getId(self_: *const PxCollection, object: *const PxBase) -> u64; + + /// Deletes a collection object. + /// + /// This function only deletes the collection object, i.e. the container class. It doesn't delete objects + /// that are part of the collection. + pub fn PxCollection_release_mut(self_: *mut PxCollection); + + /// 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; + + /// Releases the PxBase instance, please check documentation of release in derived class. + pub fn PxBase_release_mut(self_: *mut PxBase); + + /// Returns string name of dynamic type. + /// + /// Class name of most derived type of this object. + pub fn PxBase_getConcreteTypeName(self_: *const PxBase) -> *const std::ffi::c_char; + + /// Returns concrete type of object. + /// + /// PxConcreteType::Enum of serialized object + pub fn PxBase_getConcreteType(self_: *const PxBase) -> u16; + + /// Set PxBaseFlag + pub fn PxBase_setBaseFlag_mut(self_: *mut PxBase, flag: PxBaseFlag, value: bool); + + /// Set PxBaseFlags + pub fn PxBase_setBaseFlags_mut(self_: *mut PxBase, inFlags: PxBaseFlags); + + /// Returns PxBaseFlags + /// + /// PxBaseFlags + pub fn PxBase_getBaseFlags(self_: *const PxBase) -> PxBaseFlags; + + /// Whether the object is subordinate. + /// + /// A class is subordinate, if it can only be instantiated in the context of another class. + /// + /// Whether the class is subordinate + pub fn PxBase_isReleasable(self_: *const PxBase) -> bool; + + /// Decrements the reference count of the object and releases it if the new reference count is zero. + pub fn PxRefCounted_release_mut(self_: *mut PxRefCounted); + + /// Returns the reference count of the object. + /// + /// At creation, the reference count of the object is 1. Every other object referencing this object increments the + /// count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically. + /// + /// the current reference count. + pub fn PxRefCounted_getReferenceCount(self_: *const PxRefCounted) -> u32; + + /// Acquires a counted reference to this object. + /// + /// This method increases the reference count of the object by 1. Decrement the reference count by calling release() + pub fn PxRefCounted_acquireReference_mut(self_: *mut PxRefCounted); + + /// constructor sets to default + pub fn PxTolerancesScale_new(defaultLength: f32, defaultSpeed: f32) -> PxTolerancesScale; + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid (returns always true). + pub fn PxTolerancesScale_isValid(self_: *const PxTolerancesScale) -> bool; + + /// Allocate a new string. + /// + /// *Always* a valid null terminated string. "" is returned if "" or null is passed in. + pub fn PxStringTable_allocateStr_mut(self_: *mut PxStringTable, inSrc: *const std::ffi::c_char) -> *const std::ffi::c_char; + + /// Release the string table and all the strings associated with it. + pub fn PxStringTable_release_mut(self_: *mut PxStringTable); + + /// Returns string name of dynamic type. + /// + /// Class name of most derived type of this object. + pub fn PxSerializer_getConcreteTypeName(self_: *const PxSerializer) -> *const std::ffi::c_char; + + /// Adds required objects to the collection. + /// + /// This method does not add the required objects recursively, e.g. objects required by required objects. + pub fn PxSerializer_requiresObjects(self_: *const PxSerializer, anon_param0: *mut PxBase, anon_param1: *mut PxProcessPxBaseCallback); + + /// Whether the object is subordinate. + /// + /// A class is subordinate, if it can only be instantiated in the context of another class. + /// + /// Whether the class is subordinate + pub fn PxSerializer_isSubordinate(self_: *const PxSerializer) -> bool; + + /// Exports object's extra data to stream. + pub fn PxSerializer_exportExtraData(self_: *const PxSerializer, anon_param0: *mut PxBase, anon_param1: *mut PxSerializationContext); + + /// Exports object's data to stream. + pub fn PxSerializer_exportData(self_: *const PxSerializer, anon_param0: *mut PxBase, anon_param1: *mut PxSerializationContext); + + /// Register references that the object maintains to other objects. + pub fn PxSerializer_registerReferences(self_: *const PxSerializer, obj: *mut PxBase, s: *mut PxSerializationContext); + + /// Returns size needed to create the class instance. + /// + /// sizeof class instance. + pub fn PxSerializer_getClassSize(self_: *const PxSerializer) -> usize; + + /// Create object at a given address, resolve references and import extra data. + /// + /// Created PxBase pointer (needs to be identical to address before increment). + pub fn PxSerializer_createObject(self_: *const PxSerializer, address: *mut *mut u8, context: *mut PxDeserializationContext) -> *mut PxBase; + + /// ******************************************************************************************************************* + pub fn PxSerializer_delete(self_: *mut PxSerializer); + + /// Builds object (TriangleMesh, Heightfield, ConvexMesh or BVH) from given data in PxPhysics. + /// + /// PxBase Created object in PxPhysics. + pub fn PxInsertionCallback_buildObjectFromData_mut(self_: *mut PxInsertionCallback, type_: PxConcreteType, data: *mut std::ffi::c_void) -> *mut PxBase; + + /// Set the user-provided dispatcher object for CPU tasks + pub fn PxTaskManager_setCpuDispatcher_mut(self_: *mut PxTaskManager, ref_: *mut PxCpuDispatcher); + + /// Get the user-provided dispatcher object for CPU tasks + /// + /// The CPU dispatcher object. + pub fn PxTaskManager_getCpuDispatcher(self_: *const PxTaskManager) -> *mut PxCpuDispatcher; + + /// Reset any dependencies between Tasks + /// + /// Will be called at the start of every frame before tasks are submitted. + pub fn PxTaskManager_resetDependencies_mut(self_: *mut PxTaskManager); + + /// Called by the owning scene to start the task graph. + /// + /// All tasks with ref count of 1 will be dispatched. + pub fn PxTaskManager_startSimulation_mut(self_: *mut PxTaskManager); + + /// Called by the owning scene at the end of a simulation step. + pub fn PxTaskManager_stopSimulation_mut(self_: *mut PxTaskManager); + + /// Called by the worker threads to inform the PxTaskManager that a task has completed processing. + pub fn PxTaskManager_taskCompleted_mut(self_: *mut PxTaskManager, task: *mut PxTask); + + /// Retrieve a task by name + /// + /// The ID of the task with that name, or eNOT_PRESENT if not found + pub fn PxTaskManager_getNamedTask_mut(self_: *mut PxTaskManager, name: *const std::ffi::c_char) -> u32; + + /// Submit a task with a unique name. + /// + /// The ID of the task with that name, or eNOT_PRESENT if not found + pub fn PxTaskManager_submitNamedTask_mut(self_: *mut PxTaskManager, task: *mut PxTask, name: *const std::ffi::c_char, type_: PxTaskType) -> u32; + + /// Submit an unnamed task. + /// + /// The ID of the task with that name, or eNOT_PRESENT if not found + pub fn PxTaskManager_submitUnnamedTask_mut(self_: *mut PxTaskManager, task: *mut PxTask, type_: PxTaskType) -> u32; + + /// Retrieve a task given a task ID + /// + /// The task associated with the ID + pub fn PxTaskManager_getTaskFromID_mut(self_: *mut PxTaskManager, id: u32) -> *mut PxTask; + + /// Release the PxTaskManager object, referenced dispatchers will not be released + pub fn PxTaskManager_release_mut(self_: *mut PxTaskManager); + + /// Construct a new PxTaskManager instance with the given [optional] dispatchers + pub fn PxTaskManager_createTaskManager(errorCallback: *mut PxErrorCallback, anon_param1: *mut PxCpuDispatcher) -> *mut PxTaskManager; + + /// Called by the TaskManager when a task is to be queued for execution. + /// + /// Upon receiving a task, the dispatcher should schedule the task to run. + /// After the task has been run, it should call the release() method and + /// discard its pointer. + pub fn PxCpuDispatcher_submitTask_mut(self_: *mut PxCpuDispatcher, task: *mut PxBaseTask); + + /// Returns the number of available worker threads for this dispatcher. + /// + /// The SDK will use this count to control how many tasks are submitted. By + /// matching the number of tasks with the number of execution units task + /// overhead can be reduced. + pub fn PxCpuDispatcher_getWorkerCount(self_: *const PxCpuDispatcher) -> u32; + + pub fn PxCpuDispatcher_delete(self_: *mut PxCpuDispatcher); + + /// The user-implemented run method where the task's work should be performed + /// + /// run() methods must be thread safe, stack friendly (no alloca, etc), and + /// must never block. + pub fn PxBaseTask_run_mut(self_: *mut PxBaseTask); + + /// Return a user-provided task name for profiling purposes. + /// + /// It does not have to be unique, but unique names are helpful. + /// + /// The name of this task + pub fn PxBaseTask_getName(self_: *const PxBaseTask) -> *const std::ffi::c_char; + + /// Implemented by derived implementation classes + pub fn PxBaseTask_addReference_mut(self_: *mut PxBaseTask); + + /// Implemented by derived implementation classes + pub fn PxBaseTask_removeReference_mut(self_: *mut PxBaseTask); + + /// Implemented by derived implementation classes + pub fn PxBaseTask_getReference(self_: *const PxBaseTask) -> i32; + + /// Implemented by derived implementation classes + /// + /// A task may assume in its release() method that the task system no longer holds + /// references to it - so it may safely run its destructor, recycle itself, etc. + /// provided no additional user references to the task exist + pub fn PxBaseTask_release_mut(self_: *mut PxBaseTask); + + /// Return PxTaskManager to which this task was submitted + /// + /// Note, can return NULL if task was not submitted, or has been + /// completed. + pub fn PxBaseTask_getTaskManager(self_: *const PxBaseTask) -> *mut PxTaskManager; + + pub fn PxBaseTask_setContextId_mut(self_: *mut PxBaseTask, id: u64); + + pub fn PxBaseTask_getContextId(self_: *const PxBaseTask) -> u64; + + /// Release method implementation + pub fn PxTask_release_mut(self_: *mut PxTask); + + /// Inform the PxTaskManager this task must finish before the given + pub fn PxTask_finishBefore_mut(self_: *mut PxTask, taskID: u32); + + /// Inform the PxTaskManager this task cannot start until the given + pub fn PxTask_startAfter_mut(self_: *mut PxTask, taskID: u32); + + /// Manually increment this task's reference count. The task will + /// not be allowed to run until removeReference() is called. + pub fn PxTask_addReference_mut(self_: *mut PxTask); + + /// Manually decrement this task's reference count. If the reference + /// count reaches zero, the task will be dispatched. + pub fn PxTask_removeReference_mut(self_: *mut PxTask); + + /// Return the ref-count for this task + pub fn PxTask_getReference(self_: *const PxTask) -> i32; + + /// Return the unique ID for this task + pub fn PxTask_getTaskID(self_: *const PxTask) -> u32; + + /// Called by PxTaskManager at submission time for initialization + /// + /// Perform simulation step initialization here. + pub fn PxTask_submitted_mut(self_: *mut PxTask); + + /// Initialize this task and specify the task that will have its ref count decremented on completion. + /// + /// Submission is deferred until the task's mRefCount is decremented to zero. + /// Note that we only use the PxTaskManager to query the appropriate dispatcher. + pub fn PxLightCpuTask_setContinuation_mut(self_: *mut PxLightCpuTask, tm: *mut PxTaskManager, c: *mut PxBaseTask); + + /// Initialize this task and specify the task that will have its ref count decremented on completion. + /// + /// This overload of setContinuation() queries the PxTaskManager from the continuation + /// task, which cannot be NULL. + pub fn PxLightCpuTask_setContinuation_mut_1(self_: *mut PxLightCpuTask, c: *mut PxBaseTask); + + /// Retrieves continuation task + pub fn PxLightCpuTask_getContinuation(self_: *const PxLightCpuTask) -> *mut PxBaseTask; + + /// Manually decrement this task's reference count. If the reference + /// count reaches zero, the task will be dispatched. + pub fn PxLightCpuTask_removeReference_mut(self_: *mut PxLightCpuTask); + + /// Return the ref-count for this task + pub fn PxLightCpuTask_getReference(self_: *const PxLightCpuTask) -> i32; + + /// Manually increment this task's reference count. The task will + /// not be allowed to run until removeReference() is called. + pub fn PxLightCpuTask_addReference_mut(self_: *mut PxLightCpuTask); + + /// called by CpuDispatcher after run method has completed + /// + /// Decrements the continuation task's reference count, if specified. + pub fn PxLightCpuTask_release_mut(self_: *mut PxLightCpuTask); + + /// Returns the type of the geometry. + /// + /// The type of the object. + pub fn PxGeometry_getType(self_: *const PxGeometry) -> PxGeometryType; + + /// Constructor to initialize half extents from scalar parameters. + pub fn PxBoxGeometry_new(hx: f32, hy: f32, hz: f32) -> PxBoxGeometry; + + /// Constructor to initialize half extents from vector parameter. + pub fn PxBoxGeometry_new_1(halfExtents_: PxVec3) -> PxBoxGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid + /// + /// A valid box has a positive extent in each direction (halfExtents.x > 0, halfExtents.y > 0, halfExtents.z > 0). + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a box that has zero extent in any direction. + pub fn PxBoxGeometry_isValid(self_: *const PxBoxGeometry) -> bool; + + pub fn PxBVHRaycastCallback_delete(self_: *mut PxBVHRaycastCallback); + + pub fn PxBVHRaycastCallback_reportHit_mut(self_: *mut PxBVHRaycastCallback, boundsIndex: u32, distance: *mut f32) -> bool; + + pub fn PxBVHOverlapCallback_delete(self_: *mut PxBVHOverlapCallback); + + pub fn PxBVHOverlapCallback_reportHit_mut(self_: *mut PxBVHOverlapCallback, boundsIndex: u32) -> bool; + + pub fn PxBVHTraversalCallback_delete(self_: *mut PxBVHTraversalCallback); + + pub fn PxBVHTraversalCallback_visitNode_mut(self_: *mut PxBVHTraversalCallback, bounds: *const PxBounds3) -> bool; + + pub fn PxBVHTraversalCallback_reportLeaf_mut(self_: *mut PxBVHTraversalCallback, nbPrims: u32, prims: *const u32) -> bool; + + /// Raycast test against a BVH. + /// + /// false if query has been aborted + pub fn PxBVH_raycast(self_: *const PxBVH, origin: *const PxVec3, unitDir: *const PxVec3, maxDist: f32, cb: *mut PxBVHRaycastCallback, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Sweep test against a BVH. + /// + /// false if query has been aborted + pub fn PxBVH_sweep(self_: *const PxBVH, geom: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, maxDist: f32, cb: *mut PxBVHRaycastCallback, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Overlap test against a BVH. + /// + /// false if query has been aborted + pub fn PxBVH_overlap(self_: *const PxBVH, geom: *const PxGeometry, pose: *const PxTransform, cb: *mut PxBVHOverlapCallback, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Frustum culling test against a BVH. + /// + /// This is similar in spirit to an overlap query using a convex object around the frustum. + /// However this specialized query has better performance, and can support more than the 6 planes + /// of a frustum, which can be useful in portal-based engines. + /// + /// On the other hand this test only returns a conservative number of bounds, i.e. some of the returned + /// bounds may actually be outside the frustum volume, close to it but not touching it. This is usually + /// an ok performance trade-off when the function is used for view-frustum culling. + /// + /// false if query has been aborted + pub fn PxBVH_cull(self_: *const PxBVH, nbPlanes: u32, planes: *const PxPlane, cb: *mut PxBVHOverlapCallback, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Returns the number of bounds in the BVH. + /// + /// You can use [`getBounds`]() to retrieve the bounds. + /// + /// These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + /// + /// Number of bounds in the BVH. + pub fn PxBVH_getNbBounds(self_: *const PxBVH) -> u32; + + /// Retrieve the read-only bounds in the BVH. + /// + /// These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + pub fn PxBVH_getBounds(self_: *const PxBVH) -> *const PxBounds3; + + /// Retrieve the bounds in the BVH. + /// + /// These bounds can be modified. Call refit() after modifications are done. + /// + /// These are the user-defined bounds passed to the BVH builder, not the internal bounds around each BVH node. + pub fn PxBVH_getBoundsForModification_mut(self_: *mut PxBVH) -> *mut PxBounds3; + + /// Refit the BVH. + /// + /// This function "refits" the tree, i.e. takes the new (leaf) bounding boxes into account and + /// recomputes all the BVH bounds accordingly. This is an O(n) operation with n = number of bounds in the BVH. + /// + /// This works best with minor bounds modifications, i.e. when the bounds remain close to their initial values. + /// With large modifications the tree quality degrades more and more, and subsequent query performance suffers. + /// It might be a better strategy to create a brand new BVH if bounds change drastically. + /// + /// This function refits the whole tree after an arbitrary number of bounds have potentially been modified by + /// users (via getBoundsForModification()). If you only have a small number of bounds to update, it might be + /// more efficient to use setBounds() and partialRefit() instead. + pub fn PxBVH_refit_mut(self_: *mut PxBVH); + + /// Update single bounds. + /// + /// This is an alternative to getBoundsForModification() / refit(). If you only have a small set of bounds to + /// update, it can be inefficient to call the refit() function, because it refits the whole BVH. + /// + /// Instead, one can update individual bounds with this updateBounds() function. It sets the new bounds and + /// marks the corresponding BVH nodes for partial refit. Once all the individual bounds have been updated, + /// call partialRefit() to only refit the subset of marked nodes. + /// + /// true if success + pub fn PxBVH_updateBounds_mut(self_: *mut PxBVH, boundsIndex: u32, newBounds: *const PxBounds3) -> bool; + + /// Refits subset of marked nodes. + /// + /// This is an alternative to the refit() function, to be called after updateBounds() calls. + /// See updateBounds() for details. + pub fn PxBVH_partialRefit_mut(self_: *mut PxBVH); + + /// Generic BVH traversal function. + /// + /// This can be used to implement custom BVH traversal functions if provided ones are not enough. + /// In particular this can be used to visualize the tree's bounds. + /// + /// false if query has been aborted + pub fn PxBVH_traverse(self_: *const PxBVH, cb: *mut PxBVHTraversalCallback) -> bool; + + pub fn PxBVH_getConcreteTypeName(self_: *const PxBVH) -> *const std::ffi::c_char; + + /// Constructor, initializes to a capsule with passed radius and half height. + pub fn PxCapsuleGeometry_new(radius_: f32, halfHeight_: f32) -> PxCapsuleGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid. + /// + /// A valid capsule has radius > 0, halfHeight >= 0. + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a capsule that has zero radius or height. + pub fn PxCapsuleGeometry_isValid(self_: *const PxCapsuleGeometry) -> bool; + + /// Returns the number of vertices. + /// + /// Number of vertices. + pub fn PxConvexMesh_getNbVertices(self_: *const PxConvexMesh) -> u32; + + /// Returns the vertices. + /// + /// Array of vertices. + pub fn PxConvexMesh_getVertices(self_: *const PxConvexMesh) -> *const PxVec3; + + /// Returns the index buffer. + /// + /// Index buffer. + pub fn PxConvexMesh_getIndexBuffer(self_: *const PxConvexMesh) -> *const u8; + + /// Returns the number of polygons. + /// + /// Number of polygons. + pub fn PxConvexMesh_getNbPolygons(self_: *const PxConvexMesh) -> u32; + + /// Returns the polygon data. + /// + /// True if success. + pub fn PxConvexMesh_getPolygonData(self_: *const PxConvexMesh, index: u32, data: *mut PxHullPolygon) -> bool; + + /// Decrements the reference count of a convex mesh and releases it if the new reference count is zero. + pub fn PxConvexMesh_release_mut(self_: *mut PxConvexMesh); + + /// Returns the mass properties of the mesh assuming unit density. + /// + /// The following relationship holds between mass and volume: + /// + /// mass = volume * density + /// + /// The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh. + /// + /// Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the + /// localInertia of the unit density mesh by d. + pub fn PxConvexMesh_getMassInformation(self_: *const PxConvexMesh, mass: *mut f32, localInertia: *mut PxMat33, localCenterOfMass: *mut PxVec3); + + /// Returns the local-space (vertex space) AABB from the convex mesh. + /// + /// local-space bounds + pub fn PxConvexMesh_getLocalBounds(self_: *const PxConvexMesh) -> PxBounds3; + + /// Returns the local-space Signed Distance Field for this mesh if it has one. + /// + /// local-space SDF. + pub fn PxConvexMesh_getSDF(self_: *const PxConvexMesh) -> *const f32; + + pub fn PxConvexMesh_getConcreteTypeName(self_: *const PxConvexMesh) -> *const std::ffi::c_char; + + /// This method decides whether a convex mesh is gpu compatible. If the total number of vertices are more than 64 or any number of vertices in a polygon is more than 32, or + /// convex hull data was not cooked with GPU data enabled during cooking or was loaded from a serialized collection, the convex hull is incompatible with GPU collision detection. Otherwise + /// it is compatible. + /// + /// True if the convex hull is gpu compatible + pub fn PxConvexMesh_isGpuCompatible(self_: *const PxConvexMesh) -> bool; + + /// Constructor initializes to identity scale. + pub fn PxMeshScale_new() -> PxMeshScale; + + /// Constructor from scalar. + pub fn PxMeshScale_new_1(r: f32) -> PxMeshScale; + + /// Constructor to initialize to arbitrary scale and identity scale rotation. + pub fn PxMeshScale_new_2(s: *const PxVec3) -> PxMeshScale; + + /// Constructor to initialize to arbitrary scaling. + pub fn PxMeshScale_new_3(s: *const PxVec3, r: *const PxQuat) -> PxMeshScale; + + /// Returns true if the scaling is an identity transformation. + pub fn PxMeshScale_isIdentity(self_: *const PxMeshScale) -> bool; + + /// Returns the inverse of this scaling transformation. + pub fn PxMeshScale_getInverse(self_: *const PxMeshScale) -> PxMeshScale; + + /// Converts this transformation to a 3x3 matrix representation. + pub fn PxMeshScale_toMat33(self_: *const PxMeshScale) -> PxMat33; + + /// Returns true if combination of negative scale components will cause the triangle normal to flip. The SDK will flip the normals internally. + pub fn PxMeshScale_hasNegativeDeterminant(self_: *const PxMeshScale) -> bool; + + pub fn PxMeshScale_transform(self_: *const PxMeshScale, v: *const PxVec3) -> PxVec3; + + pub fn PxMeshScale_isValidForTriangleMesh(self_: *const PxMeshScale) -> bool; + + pub fn PxMeshScale_isValidForConvexMesh(self_: *const PxMeshScale) -> bool; + + /// Constructor. By default creates an empty object with a NULL mesh and identity scale. + pub fn PxConvexMeshGeometry_new(mesh: *mut PxConvexMesh, scaling: *const PxMeshScale, flags: PxConvexMeshGeometryFlags) -> PxConvexMeshGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + /// + /// A valid convex mesh has a positive scale value in each direction (scale.x > 0, scale.y > 0, scale.z > 0). + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a convex that has zero extent in any direction. + pub fn PxConvexMeshGeometry_isValid(self_: *const PxConvexMeshGeometry) -> bool; + + /// Constructor. + pub fn PxSphereGeometry_new(ir: f32) -> PxSphereGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid + /// + /// A valid sphere has radius > 0. + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a sphere that has zero radius. + pub fn PxSphereGeometry_isValid(self_: *const PxSphereGeometry) -> bool; + + /// Constructor. + pub fn PxPlaneGeometry_new() -> PxPlaneGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid + pub fn PxPlaneGeometry_isValid(self_: *const PxPlaneGeometry) -> bool; + + /// Constructor. By default creates an empty object with a NULL mesh and identity scale. + pub fn PxTriangleMeshGeometry_new(mesh: *mut PxTriangleMesh, scaling: *const PxMeshScale, flags: PxMeshGeometryFlags) -> PxTriangleMeshGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + /// + /// A valid triangle mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a triangle mesh that has zero extents in any direction. + pub fn PxTriangleMeshGeometry_isValid(self_: *const PxTriangleMeshGeometry) -> bool; + + /// Constructor. + pub fn PxHeightFieldGeometry_new(hf: *mut PxHeightField, flags: PxMeshGeometryFlags, heightScale_: f32, rowScale_: f32, columnScale_: f32) -> PxHeightFieldGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid + /// + /// A valid height field has a positive scale value in each direction (heightScale > 0, rowScale > 0, columnScale > 0). + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a height field that has zero extents in any direction. + pub fn PxHeightFieldGeometry_isValid(self_: *const PxHeightFieldGeometry) -> bool; + + /// Default constructor. + /// + /// Creates an empty object with no particles. + pub fn PxParticleSystemGeometry_new() -> PxParticleSystemGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + pub fn PxParticleSystemGeometry_isValid(self_: *const PxParticleSystemGeometry) -> bool; + + /// Default constructor. + pub fn PxHairSystemGeometry_new() -> PxHairSystemGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + pub fn PxHairSystemGeometry_isValid(self_: *const PxHairSystemGeometry) -> bool; + + /// Constructor. By default creates an empty object with a NULL mesh and identity scale. + pub fn PxTetrahedronMeshGeometry_new(mesh: *mut PxTetrahedronMesh) -> PxTetrahedronMeshGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + /// + /// A valid tetrahedron mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). + /// It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a tetrahedron mesh that has zero extents in any direction. + pub fn PxTetrahedronMeshGeometry_isValid(self_: *const PxTetrahedronMeshGeometry) -> bool; + + pub fn PxQueryHit_new() -> PxQueryHit; + + pub fn PxLocationHit_new() -> PxLocationHit; + + /// For raycast hits: true for shapes overlapping with raycast origin. + /// + /// For sweep hits: true for shapes overlapping at zero sweep distance. + pub fn PxLocationHit_hadInitialOverlap(self_: *const PxLocationHit) -> bool; + + pub fn PxGeomRaycastHit_new() -> PxGeomRaycastHit; + + pub fn PxGeomOverlapHit_new() -> PxGeomOverlapHit; + + pub fn PxGeomSweepHit_new() -> PxGeomSweepHit; + + pub fn PxGeomIndexPair_new() -> PxGeomIndexPair; + + pub fn PxGeomIndexPair_new_1(_id0: u32, _id1: u32) -> PxGeomIndexPair; + + /// For internal use + pub fn phys_PxCustomGeometry_getUniqueID() -> u32; + + /// Default constructor + pub fn PxCustomGeometryType_new() -> PxCustomGeometryType; + + /// Invalid type + pub fn PxCustomGeometryType_INVALID() -> PxCustomGeometryType; + + /// Return custom type. The type purpose is for user to differentiate custom geometries. Not used by PhysX. + /// + /// Unique ID of a custom geometry type. + /// + /// User should use DECLARE_CUSTOM_GEOMETRY_TYPE and IMPLEMENT_CUSTOM_GEOMETRY_TYPE intead of overwriting this function. + pub fn PxCustomGeometryCallbacks_getCustomType(self_: *const PxCustomGeometryCallbacks) -> PxCustomGeometryType; + + /// Return local bounds. + /// + /// Bounding box in the geometry local space. + pub fn PxCustomGeometryCallbacks_getLocalBounds(self_: *const PxCustomGeometryCallbacks, geometry: *const PxGeometry) -> PxBounds3; + + /// Raycast. Cast a ray against the geometry in given pose. + /// + /// Number of hits. + pub fn PxCustomGeometryCallbacks_raycast(self_: *const PxCustomGeometryCallbacks, origin: *const PxVec3, unitDir: *const PxVec3, geom: *const PxGeometry, pose: *const PxTransform, maxDist: f32, hitFlags: PxHitFlags, maxHits: u32, rayHits: *mut PxGeomRaycastHit, stride: u32, threadContext: *mut PxQueryThreadContext) -> u32; + + /// Overlap. Test if geometries overlap. + /// + /// True if there is overlap. False otherwise. + pub fn PxCustomGeometryCallbacks_overlap(self_: *const PxCustomGeometryCallbacks, geom0: *const PxGeometry, pose0: *const PxTransform, geom1: *const PxGeometry, pose1: *const PxTransform, threadContext: *mut PxQueryThreadContext) -> bool; + + /// Sweep. Sweep one geometry against the other. + /// + /// True if there is hit. False otherwise. + pub fn PxCustomGeometryCallbacks_sweep(self_: *const PxCustomGeometryCallbacks, unitDir: *const PxVec3, maxDist: f32, geom0: *const PxGeometry, pose0: *const PxTransform, geom1: *const PxGeometry, pose1: *const PxTransform, sweepHit: *mut PxGeomSweepHit, hitFlags: PxHitFlags, inflation: f32, threadContext: *mut PxQueryThreadContext) -> bool; + + /// Compute custom geometry mass properties. For geometries usable with dynamic rigidbodies. + pub fn PxCustomGeometryCallbacks_computeMassProperties(self_: *const PxCustomGeometryCallbacks, geometry: *const PxGeometry, massProperties: *mut PxMassProperties); + + /// Compatible with PhysX's PCM feature. Allows to optimize contact generation. + pub fn PxCustomGeometryCallbacks_usePersistentContactManifold(self_: *const PxCustomGeometryCallbacks, geometry: *const PxGeometry, breakingThreshold: *mut f32) -> bool; + + pub fn PxCustomGeometryCallbacks_delete(self_: *mut PxCustomGeometryCallbacks); + + /// Default constructor. + /// + /// Creates an empty object with a NULL callbacks pointer. + pub fn PxCustomGeometry_new() -> PxCustomGeometry; + + /// Constructor. + pub fn PxCustomGeometry_new_1(_callbacks: *mut PxCustomGeometryCallbacks) -> PxCustomGeometry; + + /// Returns true if the geometry is valid. + /// + /// True if the current settings are valid for shape creation. + pub fn PxCustomGeometry_isValid(self_: *const PxCustomGeometry) -> bool; + + /// Returns the custom type of the custom geometry. + pub fn PxCustomGeometry_getCustomType(self_: *const PxCustomGeometry) -> PxCustomGeometryType; + + pub fn PxGeometryHolder_getType(self_: *const PxGeometryHolder) -> PxGeometryType; + + pub fn PxGeometryHolder_any_mut(self_: *mut PxGeometryHolder) -> *mut PxGeometry; + + pub fn PxGeometryHolder_any(self_: *const PxGeometryHolder) -> *const PxGeometry; + + pub fn PxGeometryHolder_sphere_mut(self_: *mut PxGeometryHolder) -> *mut PxSphereGeometry; + + pub fn PxGeometryHolder_sphere(self_: *const PxGeometryHolder) -> *const PxSphereGeometry; + + pub fn PxGeometryHolder_plane_mut(self_: *mut PxGeometryHolder) -> *mut PxPlaneGeometry; + + pub fn PxGeometryHolder_plane(self_: *const PxGeometryHolder) -> *const PxPlaneGeometry; + + pub fn PxGeometryHolder_capsule_mut(self_: *mut PxGeometryHolder) -> *mut PxCapsuleGeometry; + + pub fn PxGeometryHolder_capsule(self_: *const PxGeometryHolder) -> *const PxCapsuleGeometry; + + pub fn PxGeometryHolder_box_mut(self_: *mut PxGeometryHolder) -> *mut PxBoxGeometry; + + pub fn PxGeometryHolder_box(self_: *const PxGeometryHolder) -> *const PxBoxGeometry; + + pub fn PxGeometryHolder_convexMesh_mut(self_: *mut PxGeometryHolder) -> *mut PxConvexMeshGeometry; + + pub fn PxGeometryHolder_convexMesh(self_: *const PxGeometryHolder) -> *const PxConvexMeshGeometry; + + pub fn PxGeometryHolder_tetMesh_mut(self_: *mut PxGeometryHolder) -> *mut PxTetrahedronMeshGeometry; + + pub fn PxGeometryHolder_tetMesh(self_: *const PxGeometryHolder) -> *const PxTetrahedronMeshGeometry; + + pub fn PxGeometryHolder_triangleMesh_mut(self_: *mut PxGeometryHolder) -> *mut PxTriangleMeshGeometry; + + pub fn PxGeometryHolder_triangleMesh(self_: *const PxGeometryHolder) -> *const PxTriangleMeshGeometry; + + pub fn PxGeometryHolder_heightField_mut(self_: *mut PxGeometryHolder) -> *mut PxHeightFieldGeometry; + + pub fn PxGeometryHolder_heightField(self_: *const PxGeometryHolder) -> *const PxHeightFieldGeometry; + + pub fn PxGeometryHolder_particleSystem_mut(self_: *mut PxGeometryHolder) -> *mut PxParticleSystemGeometry; + + pub fn PxGeometryHolder_particleSystem(self_: *const PxGeometryHolder) -> *const PxParticleSystemGeometry; + + pub fn PxGeometryHolder_hairSystem_mut(self_: *mut PxGeometryHolder) -> *mut PxHairSystemGeometry; + + pub fn PxGeometryHolder_hairSystem(self_: *const PxGeometryHolder) -> *const PxHairSystemGeometry; + + pub fn PxGeometryHolder_custom_mut(self_: *mut PxGeometryHolder) -> *mut PxCustomGeometry; + + pub fn PxGeometryHolder_custom(self_: *const PxGeometryHolder) -> *const PxCustomGeometry; + + pub fn PxGeometryHolder_storeAny_mut(self_: *mut PxGeometryHolder, geometry: *const PxGeometry); + + pub fn PxGeometryHolder_new() -> PxGeometryHolder; + + pub fn PxGeometryHolder_new_1(geometry: *const PxGeometry) -> PxGeometryHolder; + + /// Raycast test against a geometry object. + /// + /// All geometry types are supported except PxParticleSystemGeometry, PxTetrahedronMeshGeometry and PxHairSystemGeometry. + /// + /// Number of hits between the ray and the geometry object + pub fn PxGeometryQuery_raycast(origin: *const PxVec3, unitDir: *const PxVec3, geom: *const PxGeometry, pose: *const PxTransform, maxDist: f32, hitFlags: PxHitFlags, maxHits: u32, rayHits: *mut PxGeomRaycastHit, stride: u32, queryFlags: PxGeometryQueryFlags, threadContext: *mut PxQueryThreadContext) -> u32; + + /// Overlap test for two geometry objects. + /// + /// All combinations are supported except: + /// + /// PxPlaneGeometry vs. {PxPlaneGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + /// + /// PxTriangleMeshGeometry vs. PxHeightFieldGeometry + /// + /// PxHeightFieldGeometry vs. PxHeightFieldGeometry + /// + /// Anything involving PxParticleSystemGeometry, PxTetrahedronMeshGeometry or PxHairSystemGeometry. + /// + /// True if the two geometry objects overlap + pub fn PxGeometryQuery_overlap(geom0: *const PxGeometry, pose0: *const PxTransform, geom1: *const PxGeometry, pose1: *const PxTransform, queryFlags: PxGeometryQueryFlags, threadContext: *mut PxQueryThreadContext) -> bool; + + /// Sweep a specified geometry object in space and test for collision with a given object. + /// + /// The following combinations are supported. + /// + /// PxSphereGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + /// + /// PxCapsuleGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + /// + /// PxBoxGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + /// + /// PxConvexMeshGeometry vs. {PxSphereGeometry, PxPlaneGeometry, PxCapsuleGeometry, PxBoxGeometry, PxConvexMeshGeometry, PxTriangleMeshGeometry, PxHeightFieldGeometry} + /// + /// True if the swept geometry object geom0 hits the object geom1 + pub fn PxGeometryQuery_sweep(unitDir: *const PxVec3, maxDist: f32, geom0: *const PxGeometry, pose0: *const PxTransform, geom1: *const PxGeometry, pose1: *const PxTransform, sweepHit: *mut PxGeomSweepHit, hitFlags: PxHitFlags, inflation: f32, queryFlags: PxGeometryQueryFlags, threadContext: *mut PxQueryThreadContext) -> bool; + + /// Compute minimum translational distance (MTD) between two geometry objects. + /// + /// All combinations of geom objects are supported except: + /// - plane/plane + /// - plane/mesh + /// - plane/heightfield + /// - mesh/mesh + /// - mesh/heightfield + /// - heightfield/heightfield + /// - anything involving PxParticleSystemGeometry, PxTetrahedronMeshGeometry or PxHairSystemGeometry + /// + /// The function returns a unit vector ('direction') and a penetration depth ('depth'). + /// + /// The depenetration vector D = direction * depth should be applied to the first object, to + /// get out of the second object. + /// + /// Returned depth should always be positive or null. + /// + /// If objects do not overlap, the function can not compute the MTD and returns false. + /// + /// True if the MTD has successfully been computed, i.e. if objects do overlap. + pub fn PxGeometryQuery_computePenetration(direction: *mut PxVec3, depth: *mut f32, geom0: *const PxGeometry, pose0: *const PxTransform, geom1: *const PxGeometry, pose1: *const PxTransform, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Computes distance between a point and a geometry object. + /// + /// Currently supported geometry objects: box, sphere, capsule, convex, mesh. + /// + /// For meshes, only the BVH34 midphase data-structure is supported. + /// + /// Square distance between the point and the geom object, or 0.0 if the point is inside the object, or -1.0 if an error occured (geometry type is not supported, or invalid pose) + pub fn PxGeometryQuery_pointDistance(point: *const PxVec3, geom: *const PxGeometry, pose: *const PxTransform, closestPoint: *mut PxVec3, closestIndex: *mut u32, queryFlags: PxGeometryQueryFlags) -> f32; + + /// computes the bounds for a geometry object + pub fn PxGeometryQuery_computeGeomBounds(bounds: *mut PxBounds3, geom: *const PxGeometry, pose: *const PxTransform, offset: f32, inflation: f32, queryFlags: PxGeometryQueryFlags); + + /// Checks if provided geometry is valid. + /// + /// True if geometry is valid. + pub fn PxGeometryQuery_isValid(geom: *const PxGeometry) -> bool; + + pub fn PxHeightFieldSample_tessFlag(self_: *const PxHeightFieldSample) -> u8; + + pub fn PxHeightFieldSample_setTessFlag_mut(self_: *mut PxHeightFieldSample); + + pub fn PxHeightFieldSample_clearTessFlag_mut(self_: *mut PxHeightFieldSample); + + /// Decrements the reference count of a height field and releases it if the new reference count is zero. + pub fn PxHeightField_release_mut(self_: *mut PxHeightField); + + /// Writes out the sample data array. + /// + /// The user provides destBufferSize bytes storage at destBuffer. + /// The data is formatted and arranged as PxHeightFieldDesc.samples. + /// + /// The number of bytes written. + pub fn PxHeightField_saveCells(self_: *const PxHeightField, destBuffer: *mut std::ffi::c_void, destBufferSize: u32) -> u32; + + /// Replaces a rectangular subfield in the sample data array. + /// + /// The user provides the description of a rectangular subfield in subfieldDesc. + /// The data is formatted and arranged as PxHeightFieldDesc.samples. + /// + /// True on success, false on failure. Failure can occur due to format mismatch. + /// + /// Modified samples are constrained to the same height quantization range as the original heightfield. + /// Source samples that are out of range of target heightfield will be clipped with no error. + /// PhysX does not keep a mapping from the heightfield to heightfield shapes that reference it. + /// Call PxShape::setGeometry on each shape which references the height field, to ensure that internal data structures are updated to reflect the new geometry. + /// Please note that PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + pub fn PxHeightField_modifySamples_mut(self_: *mut PxHeightField, startCol: i32, startRow: i32, subfieldDesc: *const PxHeightFieldDesc, shrinkBounds: bool) -> bool; + + /// Retrieves the number of sample rows in the samples array. + /// + /// The number of sample rows in the samples array. + pub fn PxHeightField_getNbRows(self_: *const PxHeightField) -> u32; + + /// Retrieves the number of sample columns in the samples array. + /// + /// The number of sample columns in the samples array. + pub fn PxHeightField_getNbColumns(self_: *const PxHeightField) -> u32; + + /// Retrieves the format of the sample data. + /// + /// The format of the sample data. + pub fn PxHeightField_getFormat(self_: *const PxHeightField) -> PxHeightFieldFormat; + + /// Retrieves the offset in bytes between consecutive samples in the array. + /// + /// The offset in bytes between consecutive samples in the array. + pub fn PxHeightField_getSampleStride(self_: *const PxHeightField) -> u32; + + /// Retrieves the convex edge threshold. + /// + /// The convex edge threshold. + pub fn PxHeightField_getConvexEdgeThreshold(self_: *const PxHeightField) -> f32; + + /// Retrieves the flags bits, combined from values of the enum ::PxHeightFieldFlag. + /// + /// The flags bits, combined from values of the enum ::PxHeightFieldFlag. + pub fn PxHeightField_getFlags(self_: *const PxHeightField) -> PxHeightFieldFlags; + + /// Retrieves the height at the given coordinates in grid space. + /// + /// The height at the given coordinates or 0 if the coordinates are out of range. + pub fn PxHeightField_getHeight(self_: *const PxHeightField, x: f32, z: f32) -> f32; + + /// Returns material table index of given triangle + /// + /// This function takes a post cooking triangle index. + /// + /// Material table index, or 0xffff if no per-triangle materials are used + pub fn PxHeightField_getTriangleMaterialIndex(self_: *const PxHeightField, triangleIndex: u32) -> u16; + + /// Returns a triangle face normal for a given triangle index + /// + /// This function takes a post cooking triangle index. + /// + /// Triangle normal for a given triangle index + pub fn PxHeightField_getTriangleNormal(self_: *const PxHeightField, triangleIndex: u32) -> PxVec3; + + /// Returns heightfield sample of given row and column + /// + /// Heightfield sample + pub fn PxHeightField_getSample(self_: *const PxHeightField, row: u32, column: u32) -> *const PxHeightFieldSample; + + /// Returns the number of times the heightfield data has been modified + /// + /// This method returns the number of times modifySamples has been called on this heightfield, so that code that has + /// retained state that depends on the heightfield can efficiently determine whether it has been modified. + /// + /// the number of times the heightfield sample data has been modified. + pub fn PxHeightField_getTimestamp(self_: *const PxHeightField) -> u32; + + pub fn PxHeightField_getConcreteTypeName(self_: *const PxHeightField) -> *const std::ffi::c_char; + + /// Constructor sets to default. + pub fn PxHeightFieldDesc_new() -> PxHeightFieldDesc; + + /// (re)sets the structure to the default. + pub fn PxHeightFieldDesc_setToDefault_mut(self_: *mut PxHeightFieldDesc); + + /// Returns true if the descriptor is valid. + /// + /// True if the current settings are valid. + pub fn PxHeightFieldDesc_isValid(self_: *const PxHeightFieldDesc) -> bool; + + /// Retrieves triangle data from a triangle ID. + /// + /// This function can be used together with [`findOverlapTriangleMesh`]() to retrieve triangle properties. + /// + /// This function will flip the triangle normal whenever triGeom.scale.hasNegativeDeterminant() is true. + pub fn PxMeshQuery_getTriangle(triGeom: *const PxTriangleMeshGeometry, transform: *const PxTransform, triangleIndex: u32, triangle: *mut PxTriangle, vertexIndices: *mut u32, adjacencyIndices: *mut u32); + + /// Retrieves triangle data from a triangle ID. + /// + /// This function can be used together with [`findOverlapHeightField`]() to retrieve triangle properties. + /// + /// This function will flip the triangle normal whenever triGeom.scale.hasNegativeDeterminant() is true. + /// + /// TriangleIndex is an index used in internal format, which does have an index out of the bounds in last row. + /// To traverse all tri indices in the HF, the following code can be applied: + /// for (PxU32 row = 0; row + /// < + /// (nbRows - 1); row++) + /// { + /// for (PxU32 col = 0; col + /// < + /// (nbCols - 1); col++) + /// { + /// for (PxU32 k = 0; k + /// < + /// 2; k++) + /// { + /// const PxU32 triIndex = 2 * (row*nbCols + col) + k; + /// .... + /// } + /// } + /// } + pub fn PxMeshQuery_getTriangle_1(hfGeom: *const PxHeightFieldGeometry, transform: *const PxTransform, triangleIndex: u32, triangle: *mut PxTriangle, vertexIndices: *mut u32, adjacencyIndices: *mut u32); + + /// Find the mesh triangles which touch the specified geometry object. + /// + /// For mesh-vs-mesh overlap tests, please use the specialized function below. + /// + /// Returned triangle indices can be used with [`getTriangle`]() to retrieve the triangle properties. + /// + /// Number of overlaps found, i.e. number of elements written to the results buffer + pub fn PxMeshQuery_findOverlapTriangleMesh(geom: *const PxGeometry, geomPose: *const PxTransform, meshGeom: *const PxTriangleMeshGeometry, meshPose: *const PxTransform, results: *mut u32, maxResults: u32, startIndex: u32, overflow: *mut bool, queryFlags: PxGeometryQueryFlags) -> u32; + + /// Find the height field triangles which touch the specified geometry object. + /// + /// Returned triangle indices can be used with [`getTriangle`]() to retrieve the triangle properties. + /// + /// Number of overlaps found, i.e. number of elements written to the results buffer + pub fn PxMeshQuery_findOverlapHeightField(geom: *const PxGeometry, geomPose: *const PxTransform, hfGeom: *const PxHeightFieldGeometry, hfPose: *const PxTransform, results: *mut u32, maxResults: u32, startIndex: u32, overflow: *mut bool, queryFlags: PxGeometryQueryFlags) -> u32; + + /// Sweep a specified geometry object in space and test for collision with a set of given triangles. + /// + /// This function simply sweeps input geometry against each input triangle, in the order they are given. + /// This is an O(N) operation with N = number of input triangles. It does not use any particular acceleration structure. + /// + /// True if the swept geometry object hits the specified triangles + /// + /// Only the following geometry types are currently supported: PxSphereGeometry, PxCapsuleGeometry, PxBoxGeometry + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + /// + /// This function returns a single closest hit across all the input triangles. Multiple hits are not supported. + /// + /// Supported hitFlags are PxHitFlag::eDEFAULT, PxHitFlag::eASSUME_NO_INITIAL_OVERLAP, PxHitFlag::ePRECISE_SWEEP, PxHitFlag::eMESH_BOTH_SIDES, PxHitFlag::eMESH_ANY. + /// + /// ePOSITION is only defined when there is no initial overlap (sweepHit.hadInitialOverlap() == false) + /// + /// The returned normal for initially overlapping sweeps is set to -unitDir. + /// + /// Otherwise the returned normal is the front normal of the triangle even if PxHitFlag::eMESH_BOTH_SIDES is set. + /// + /// The returned PxGeomSweepHit::faceIndex parameter will hold the index of the hit triangle in input array, i.e. the range is [0; triangleCount). For initially overlapping sweeps, this is the index of overlapping triangle. + /// + /// The inflation parameter is not compatible with PxHitFlag::ePRECISE_SWEEP. + pub fn PxMeshQuery_sweep(unitDir: *const PxVec3, distance: f32, geom: *const PxGeometry, pose: *const PxTransform, triangleCount: u32, triangles: *const PxTriangle, sweepHit: *mut PxGeomSweepHit, hitFlags: PxHitFlags, cachedIndex: *const u32, inflation: f32, doubleSided: bool, queryFlags: PxGeometryQueryFlags) -> bool; + + /// constructor sets to default. + pub fn PxSimpleTriangleMesh_new() -> PxSimpleTriangleMesh; + + /// (re)sets the structure to the default. + pub fn PxSimpleTriangleMesh_setToDefault_mut(self_: *mut PxSimpleTriangleMesh); + + /// returns true if the current settings are valid + pub fn PxSimpleTriangleMesh_isValid(self_: *const PxSimpleTriangleMesh) -> bool; + + /// Constructor + pub fn PxTriangle_new_alloc() -> *mut PxTriangle; + + /// Constructor + pub fn PxTriangle_new_alloc_1(p0: *const PxVec3, p1: *const PxVec3, p2: *const PxVec3) -> *mut PxTriangle; + + /// Destructor + pub fn PxTriangle_delete(self_: *mut PxTriangle); + + /// Compute the normal of the Triangle. + pub fn PxTriangle_normal(self_: *const PxTriangle, _normal: *mut PxVec3); + + /// Compute the unnormalized normal of the triangle. + pub fn PxTriangle_denormalizedNormal(self_: *const PxTriangle, _normal: *mut PxVec3); + + /// Compute the area of the triangle. + /// + /// Area of the triangle. + pub fn PxTriangle_area(self_: *const PxTriangle) -> f32; + + /// Computes a point on the triangle from u and v barycentric coordinates. + pub fn PxTriangle_pointFromUV(self_: *const PxTriangle, u: f32, v: f32) -> PxVec3; + + pub fn PxTrianglePadded_new_alloc() -> *mut PxTrianglePadded; + + pub fn PxTrianglePadded_delete(self_: *mut PxTrianglePadded); + + /// Returns the number of vertices. + /// + /// number of vertices + pub fn PxTriangleMesh_getNbVertices(self_: *const PxTriangleMesh) -> u32; + + /// Returns the vertices. + /// + /// array of vertices + pub fn PxTriangleMesh_getVertices(self_: *const PxTriangleMesh) -> *const PxVec3; + + /// Returns all mesh vertices for modification. + /// + /// This function will return the vertices of the mesh so that their positions can be changed in place. + /// After modifying the vertices you must call refitBVH for the refitting to actually take place. + /// This function maintains the old mesh topology (triangle indices). + /// + /// inplace vertex coordinates for each existing mesh vertex. + /// + /// It is recommended to use this feature for scene queries only. + /// + /// Size of array returned is equal to the number returned by getNbVertices(). + /// + /// This function operates on cooked vertex indices. + /// + /// This means the index mapping and vertex count can be different from what was provided as an input to the cooking routine. + /// + /// To achieve unchanged 1-to-1 index mapping with orignal mesh data (before cooking) please use the following cooking flags: + /// + /// eWELD_VERTICES = 0, eDISABLE_CLEAN_MESH = 1. + /// + /// It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + pub fn PxTriangleMesh_getVerticesForModification_mut(self_: *mut PxTriangleMesh) -> *mut PxVec3; + + /// Refits BVH for mesh vertices. + /// + /// This function will refit the mesh BVH to correctly enclose the new positions updated by getVerticesForModification. + /// Mesh BVH will not be reoptimized by this function so significantly different new positions will cause significantly reduced performance. + /// + /// New bounds for the entire mesh. + /// + /// For PxMeshMidPhase::eBVH34 trees the refit operation is only available on non-quantized trees (see PxBVH34MidphaseDesc::quantized) + /// + /// PhysX does not keep a mapping from the mesh to mesh shapes that reference it. + /// + /// Call PxShape::setGeometry on each shape which references the mesh, to ensure that internal data structures are updated to reflect the new geometry. + /// + /// PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. + /// + /// It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. + /// + /// Active edges information will be lost during refit, the rigid body mesh contact generation might not perform as expected. + pub fn PxTriangleMesh_refitBVH_mut(self_: *mut PxTriangleMesh) -> PxBounds3; + + /// Returns the number of triangles. + /// + /// number of triangles + pub fn PxTriangleMesh_getNbTriangles(self_: *const PxTriangleMesh) -> u32; + + /// Returns the triangle indices. + /// + /// The indices can be 16 or 32bit depending on the number of triangles in the mesh. + /// Call getTriangleMeshFlags() to know if the indices are 16 or 32 bits. + /// + /// The number of indices is the number of triangles * 3. + /// + /// array of triangles + pub fn PxTriangleMesh_getTriangles(self_: *const PxTriangleMesh) -> *const std::ffi::c_void; + + /// Reads the PxTriangleMesh flags. + /// + /// See the list of flags [`PxTriangleMeshFlag`] + /// + /// The values of the PxTriangleMesh flags. + pub fn PxTriangleMesh_getTriangleMeshFlags(self_: *const PxTriangleMesh) -> PxTriangleMeshFlags; + + /// Returns the triangle remapping table. + /// + /// The triangles are internally sorted according to various criteria. Hence the internal triangle order + /// does not always match the original (user-defined) order. The remapping table helps finding the old + /// indices knowing the new ones: + /// + /// remapTable[ internalTriangleIndex ] = originalTriangleIndex + /// + /// the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used) + pub fn PxTriangleMesh_getTrianglesRemap(self_: *const PxTriangleMesh) -> *const u32; + + /// Decrements the reference count of a triangle mesh and releases it if the new reference count is zero. + pub fn PxTriangleMesh_release_mut(self_: *mut PxTriangleMesh); + + /// Returns material table index of given triangle + /// + /// This function takes a post cooking triangle index. + /// + /// Material table index, or 0xffff if no per-triangle materials are used + pub fn PxTriangleMesh_getTriangleMaterialIndex(self_: *const PxTriangleMesh, triangleIndex: u32) -> u16; + + /// Returns the local-space (vertex space) AABB from the triangle mesh. + /// + /// local-space bounds + pub fn PxTriangleMesh_getLocalBounds(self_: *const PxTriangleMesh) -> PxBounds3; + + /// Returns the local-space Signed Distance Field for this mesh if it has one. + /// + /// local-space SDF. + pub fn PxTriangleMesh_getSDF(self_: *const PxTriangleMesh) -> *const f32; + + /// Returns the resolution of the local-space dense SDF. + pub fn PxTriangleMesh_getSDFDimensions(self_: *const PxTriangleMesh, numX: *mut u32, numY: *mut u32, numZ: *mut u32); + + /// Sets whether this mesh should be preferred for SDF projection. + /// + /// By default, meshes are flagged as preferring projection and the decisions on which mesh to project is based on the triangle and vertex + /// count. The model with the fewer triangles is projected onto the SDF of the more detailed mesh. + /// If one of the meshes is set to prefer SDF projection (default) and the other is set to not prefer SDF projection, model flagged as + /// preferring SDF projection will be projected onto the model flagged as not preferring, regardless of the detail of the respective meshes. + /// Where both models are flagged as preferring no projection, the less detailed model will be projected as before. + pub fn PxTriangleMesh_setPreferSDFProjection_mut(self_: *mut PxTriangleMesh, preferProjection: bool); + + /// Returns whether this mesh prefers SDF projection. + /// + /// whether this mesh prefers SDF projection. + pub fn PxTriangleMesh_getPreferSDFProjection(self_: *const PxTriangleMesh) -> bool; + + /// Returns the mass properties of the mesh assuming unit density. + /// + /// The following relationship holds between mass and volume: + /// + /// mass = volume * density + /// + /// The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh. + /// + /// Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the + /// localInertia of the unit density mesh by d. + pub fn PxTriangleMesh_getMassInformation(self_: *const PxTriangleMesh, mass: *mut f32, localInertia: *mut PxMat33, localCenterOfMass: *mut PxVec3); + + /// Constructor + pub fn PxTetrahedron_new_alloc() -> *mut PxTetrahedron; + + /// Constructor + pub fn PxTetrahedron_new_alloc_1(p0: *const PxVec3, p1: *const PxVec3, p2: *const PxVec3, p3: *const PxVec3) -> *mut PxTetrahedron; + + /// Destructor + pub fn PxTetrahedron_delete(self_: *mut PxTetrahedron); + + /// Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + pub fn PxSoftBodyAuxData_release_mut(self_: *mut PxSoftBodyAuxData); + + /// Returns the number of vertices. + /// + /// number of vertices + pub fn PxTetrahedronMesh_getNbVertices(self_: *const PxTetrahedronMesh) -> u32; + + /// Returns the vertices + /// + /// array of vertices + pub fn PxTetrahedronMesh_getVertices(self_: *const PxTetrahedronMesh) -> *const PxVec3; + + /// Returns the number of tetrahedrons. + /// + /// number of tetrahedrons + pub fn PxTetrahedronMesh_getNbTetrahedrons(self_: *const PxTetrahedronMesh) -> u32; + + /// Returns the tetrahedron indices. + /// + /// The indices can be 16 or 32bit depending on the number of tetrahedrons in the mesh. + /// Call getTetrahedronMeshFlags() to know if the indices are 16 or 32 bits. + /// + /// The number of indices is the number of tetrahedrons * 4. + /// + /// array of tetrahedrons + pub fn PxTetrahedronMesh_getTetrahedrons(self_: *const PxTetrahedronMesh) -> *const std::ffi::c_void; + + /// Reads the PxTetrahedronMesh flags. + /// + /// See the list of flags [`PxTetrahedronMeshFlags`] + /// + /// The values of the PxTetrahedronMesh flags. + pub fn PxTetrahedronMesh_getTetrahedronMeshFlags(self_: *const PxTetrahedronMesh) -> PxTetrahedronMeshFlags; + + /// Returns the tetrahedra remapping table. + /// + /// The tetrahedra are internally sorted according to various criteria. Hence the internal tetrahedron order + /// does not always match the original (user-defined) order. The remapping table helps finding the old + /// indices knowing the new ones: + /// + /// remapTable[ internalTetrahedronIndex ] = originalTetrahedronIndex + /// + /// the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used) + pub fn PxTetrahedronMesh_getTetrahedraRemap(self_: *const PxTetrahedronMesh) -> *const u32; + + /// Returns the local-space (vertex space) AABB from the tetrahedron mesh. + /// + /// local-space bounds + pub fn PxTetrahedronMesh_getLocalBounds(self_: *const PxTetrahedronMesh) -> PxBounds3; + + /// Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + pub fn PxTetrahedronMesh_release_mut(self_: *mut PxTetrahedronMesh); + + /// Const accecssor to the softbody's collision mesh. + pub fn PxSoftBodyMesh_getCollisionMesh(self_: *const PxSoftBodyMesh) -> *const PxTetrahedronMesh; + + /// Accecssor to the softbody's collision mesh. + pub fn PxSoftBodyMesh_getCollisionMesh_mut(self_: *mut PxSoftBodyMesh) -> *mut PxTetrahedronMesh; + + /// Const accessor to the softbody's simulation mesh. + pub fn PxSoftBodyMesh_getSimulationMesh(self_: *const PxSoftBodyMesh) -> *const PxTetrahedronMesh; + + /// Accecssor to the softbody's simulation mesh. + pub fn PxSoftBodyMesh_getSimulationMesh_mut(self_: *mut PxSoftBodyMesh) -> *mut PxTetrahedronMesh; + + /// Const accessor to the softbodies simulation state. + pub fn PxSoftBodyMesh_getSoftBodyAuxData(self_: *const PxSoftBodyMesh) -> *const PxSoftBodyAuxData; + + /// Accessor to the softbody's auxilary data like mass and rest pose information + pub fn PxSoftBodyMesh_getSoftBodyAuxData_mut(self_: *mut PxSoftBodyMesh) -> *mut PxSoftBodyAuxData; + + /// Decrements the reference count of a tetrahedron mesh and releases it if the new reference count is zero. + pub fn PxSoftBodyMesh_release_mut(self_: *mut PxSoftBodyMesh); + + pub fn PxCollisionMeshMappingData_release_mut(self_: *mut PxCollisionMeshMappingData); + + pub fn PxCollisionTetrahedronMeshData_getMesh(self_: *const PxCollisionTetrahedronMeshData) -> *const PxTetrahedronMeshData; + + pub fn PxCollisionTetrahedronMeshData_getMesh_mut(self_: *mut PxCollisionTetrahedronMeshData) -> *mut PxTetrahedronMeshData; + + pub fn PxCollisionTetrahedronMeshData_getData(self_: *const PxCollisionTetrahedronMeshData) -> *const PxSoftBodyCollisionData; + + pub fn PxCollisionTetrahedronMeshData_getData_mut(self_: *mut PxCollisionTetrahedronMeshData) -> *mut PxSoftBodyCollisionData; + + pub fn PxCollisionTetrahedronMeshData_release_mut(self_: *mut PxCollisionTetrahedronMeshData); + + pub fn PxSimulationTetrahedronMeshData_getMesh_mut(self_: *mut PxSimulationTetrahedronMeshData) -> *mut PxTetrahedronMeshData; + + pub fn PxSimulationTetrahedronMeshData_getData_mut(self_: *mut PxSimulationTetrahedronMeshData) -> *mut PxSoftBodySimulationData; + + pub fn PxSimulationTetrahedronMeshData_release_mut(self_: *mut PxSimulationTetrahedronMeshData); + + /// Deletes the actor. + /// + /// Do not keep a reference to the deleted instance. + /// + /// If the actor belongs to a [`PxAggregate`] object, it is automatically removed from the aggregate. + pub fn PxActor_release_mut(self_: *mut PxActor); + + /// Retrieves the type of actor. + /// + /// The actor type of the actor. + pub fn PxActor_getType(self_: *const PxActor) -> PxActorType; + + /// Retrieves the scene which this actor belongs to. + /// + /// Owner Scene. NULL if not part of a scene. + pub fn PxActor_getScene(self_: *const PxActor) -> *mut PxScene; + + /// 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 PxActor_setName_mut(self_: *mut PxActor, name: *const std::ffi::c_char); + + /// Retrieves the name string set with setName(). + /// + /// Name string associated with object. + pub fn PxActor_getName(self_: *const PxActor) -> *const std::ffi::c_char; + + /// Retrieves the axis aligned bounding box enclosing the actor. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// The actor's bounding box. + pub fn PxActor_getWorldBounds(self_: *const PxActor, inflation: f32) -> PxBounds3; + + /// Raises or clears a particular actor flag. + /// + /// See the list of flags [`PxActorFlag`] + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxActor_setActorFlag_mut(self_: *mut PxActor, flag: PxActorFlag, value: bool); + + /// Sets the actor flags. + /// + /// See the list of flags [`PxActorFlag`] + pub fn PxActor_setActorFlags_mut(self_: *mut PxActor, inFlags: PxActorFlags); + + /// Reads the PxActor flags. + /// + /// See the list of flags [`PxActorFlag`] + /// + /// The values of the PxActor flags. + pub fn PxActor_getActorFlags(self_: *const PxActor) -> PxActorFlags; + + /// Assigns dynamic actors a dominance group identifier. + /// + /// PxDominanceGroup is a 5 bit group identifier (legal range from 0 to 31). + /// + /// The PxScene::setDominanceGroupPair() lets you set certain behaviors for pairs of dominance groups. + /// By default every dynamic actor is created in group 0. + /// + /// Default: + /// 0 + /// + /// Sleeping: + /// Changing the dominance group does + /// NOT + /// wake the actor up automatically. + pub fn PxActor_setDominanceGroup_mut(self_: *mut PxActor, dominanceGroup: u8); + + /// Retrieves the value set with setDominanceGroup(). + /// + /// The dominance group of this actor. + pub fn PxActor_getDominanceGroup(self_: *const PxActor) -> u8; + + /// Sets the owner client of an actor. + /// + /// This cannot be done once the actor has been placed into a scene. + /// + /// Default: + /// PX_DEFAULT_CLIENT + pub fn PxActor_setOwnerClient_mut(self_: *mut PxActor, inClient: u8); + + /// Returns the owner client that was specified at creation time. + /// + /// This value cannot be changed once the object is placed into the scene. + pub fn PxActor_getOwnerClient(self_: *const PxActor) -> u8; + + /// Retrieves the aggregate the actor might be a part of. + /// + /// The aggregate the actor is a part of, or NULL if the actor does not belong to an aggregate. + pub fn PxActor_getAggregate(self_: *const PxActor) -> *mut PxAggregate; + + pub fn phys_PxGetAggregateFilterHint(type_: PxAggregateType, enableSelfCollision: bool) -> u32; + + pub fn phys_PxGetAggregateSelfCollisionBit(hint: u32) -> u32; + + pub fn phys_PxGetAggregateType(hint: u32) -> PxAggregateType; + + /// Deletes the aggregate object. + /// + /// Deleting the PxAggregate object does not delete the aggregated actors. If the PxAggregate object + /// belongs to a scene, the aggregated actors are automatically re-inserted in that scene. If you intend + /// to delete both the PxAggregate and its actors, it is best to release the actors first, then release + /// the PxAggregate when it is empty. + pub fn PxAggregate_release_mut(self_: *mut PxAggregate); + + /// Adds an actor to the aggregate object. + /// + /// A warning is output if the total number of actors is reached, or if the incoming actor already belongs + /// to an aggregate. + /// + /// If the aggregate belongs to a scene, adding an actor to the aggregate also adds the actor to that scene. + /// + /// If the actor already belongs to a scene, a warning is output and the call is ignored. You need to remove + /// the actor from the scene first, before adding it to the aggregate. + /// + /// When a BVH is provided the actor shapes are grouped together. + /// The scene query pruning structure inside PhysX SDK will store/update one + /// bound per actor. The scene queries against such an actor will query actor + /// bounds and then make a local space query against the provided BVH, which is in actor's local space. + pub fn PxAggregate_addActor_mut(self_: *mut PxAggregate, actor: *mut PxActor, bvh: *const PxBVH) -> bool; + + /// Removes an actor from the aggregate object. + /// + /// A warning is output if the incoming actor does not belong to the aggregate. Otherwise the actor is + /// removed from the aggregate. If the aggregate belongs to a scene, the actor is reinserted in that + /// scene. If you intend to delete the actor, it is best to call [`PxActor::release`]() directly. That way + /// the actor will be automatically removed from its aggregate (if any) and not reinserted in a scene. + pub fn PxAggregate_removeActor_mut(self_: *mut PxAggregate, actor: *mut PxActor) -> bool; + + /// Adds an articulation to the aggregate object. + /// + /// A warning is output if the total number of actors is reached (every articulation link counts as an actor), + /// or if the incoming articulation already belongs to an aggregate. + /// + /// If the aggregate belongs to a scene, adding an articulation to the aggregate also adds the articulation to that scene. + /// + /// If the articulation already belongs to a scene, a warning is output and the call is ignored. You need to remove + /// the articulation from the scene first, before adding it to the aggregate. + pub fn PxAggregate_addArticulation_mut(self_: *mut PxAggregate, articulation: *mut PxArticulationReducedCoordinate) -> bool; + + /// Removes an articulation from the aggregate object. + /// + /// A warning is output if the incoming articulation does not belong to the aggregate. Otherwise the articulation is + /// removed from the aggregate. If the aggregate belongs to a scene, the articulation is reinserted in that + /// scene. If you intend to delete the articulation, it is best to call [`PxArticulationReducedCoordinate::release`]() directly. That way + /// the articulation will be automatically removed from its aggregate (if any) and not reinserted in a scene. + pub fn PxAggregate_removeArticulation_mut(self_: *mut PxAggregate, articulation: *mut PxArticulationReducedCoordinate) -> bool; + + /// Returns the number of actors contained in the aggregate. + /// + /// You can use [`getActors`]() to retrieve the actor pointers. + /// + /// Number of actors contained in the aggregate. + pub fn PxAggregate_getNbActors(self_: *const PxAggregate) -> u32; + + /// Retrieves max amount of shapes that can be contained in the aggregate. + /// + /// Max shape size. + pub fn PxAggregate_getMaxNbShapes(self_: *const PxAggregate) -> u32; + + /// Retrieve all actors contained in the aggregate. + /// + /// You can retrieve the number of actor pointers by calling [`getNbActors`]() + /// + /// Number of actor pointers written to the buffer. + pub fn PxAggregate_getActors(self_: *const PxAggregate, userBuffer: *mut *mut PxActor, bufferSize: u32, startIndex: u32) -> u32; + + /// Retrieves the scene which this aggregate belongs to. + /// + /// Owner Scene. NULL if not part of a scene. + pub fn PxAggregate_getScene_mut(self_: *mut PxAggregate) -> *mut PxScene; + + /// Retrieves aggregate's self-collision flag. + /// + /// self-collision flag + pub fn PxAggregate_getSelfCollision(self_: *const PxAggregate) -> bool; + + pub fn PxAggregate_getConcreteTypeName(self_: *const PxAggregate) -> *const std::ffi::c_char; + + pub fn PxConstraintInvMassScale_new() -> PxConstraintInvMassScale; + + pub fn PxConstraintInvMassScale_new_1(lin0: f32, ang0: f32, lin1: f32, ang1: f32) -> PxConstraintInvMassScale; + + /// Visualize joint frames + pub fn PxConstraintVisualizer_visualizeJointFrames_mut(self_: *mut PxConstraintVisualizer, parent: *const PxTransform, child: *const PxTransform); + + /// Visualize joint linear limit + pub fn PxConstraintVisualizer_visualizeLinearLimit_mut(self_: *mut PxConstraintVisualizer, t0: *const PxTransform, t1: *const PxTransform, value: f32, active: bool); + + /// Visualize joint angular limit + pub fn PxConstraintVisualizer_visualizeAngularLimit_mut(self_: *mut PxConstraintVisualizer, t0: *const PxTransform, lower: f32, upper: f32, active: bool); + + /// Visualize limit cone + pub fn PxConstraintVisualizer_visualizeLimitCone_mut(self_: *mut PxConstraintVisualizer, t: *const PxTransform, tanQSwingY: f32, tanQSwingZ: f32, active: bool); + + /// Visualize joint double cone + pub fn PxConstraintVisualizer_visualizeDoubleCone_mut(self_: *mut PxConstraintVisualizer, t: *const PxTransform, angle: f32, active: bool); + + /// Visualize line + pub fn PxConstraintVisualizer_visualizeLine_mut(self_: *mut PxConstraintVisualizer, p0: *const PxVec3, p1: *const PxVec3, color: u32); + + /// Pre-simulation data preparation + /// when the constraint is marked dirty, this function is called at the start of the simulation + /// step for the SDK to copy the constraint data block. + pub fn PxConstraintConnector_prepareData_mut(self_: *mut PxConstraintConnector) -> *mut std::ffi::c_void; + + /// Constraint release callback + /// + /// When the SDK deletes a PxConstraint object this function is called by the SDK. In general + /// custom constraints should not be deleted directly by applications: rather, the constraint + /// should respond to a release() request by calling PxConstraint::release(), then wait for + /// this call to release its own resources. + /// + /// This function is also called when a PxConstraint object is deleted on cleanup due to + /// destruction of the PxPhysics object. + pub fn PxConstraintConnector_onConstraintRelease_mut(self_: *mut PxConstraintConnector); + + /// Center-of-mass shift callback + /// + /// This function is called by the SDK when the CoM of one of the actors is moved. Since the + /// API specifies constraint positions relative to actors, and the constraint shader functions + /// are supplied with coordinates relative to bodies, some synchronization is usually required + /// when the application moves an object's center of mass. + pub fn PxConstraintConnector_onComShift_mut(self_: *mut PxConstraintConnector, actor: u32); + + /// Origin shift callback + /// + /// This function is called by the SDK when the scene origin gets shifted and allows to adjust + /// custom data which contains world space transforms. + /// + /// If the adjustments affect constraint shader data, it is necessary to call PxConstraint::markDirty() + /// to make sure that the data gets synced at the beginning of the next simulation step. + pub fn PxConstraintConnector_onOriginShift_mut(self_: *mut PxConstraintConnector, shift: *const PxVec3); + + /// Obtain a reference to a PxBase interface if the constraint has one. + /// + /// If the constraint does not implement the PxBase interface, it should return NULL. + pub fn PxConstraintConnector_getSerializable_mut(self_: *mut PxConstraintConnector) -> *mut PxBase; + + /// Obtain the pointer to the constraint's constant data + pub fn PxConstraintConnector_getConstantBlock(self_: *const PxConstraintConnector) -> *const std::ffi::c_void; + + /// Let the connector know it has been connected to a constraint. + pub fn PxConstraintConnector_connectToConstraint_mut(self_: *mut PxConstraintConnector, anon_param0: *mut PxConstraint); + + /// virtual destructor + pub fn PxConstraintConnector_delete(self_: *mut PxConstraintConnector); + + pub fn PxSolverBody_new() -> PxSolverBody; + + pub fn PxSolverBodyData_projectVelocity(self_: *const PxSolverBodyData, lin: *const PxVec3, ang: *const PxVec3) -> f32; + + pub fn PxSolverConstraintPrepDesc_delete(self_: *mut PxSolverConstraintPrepDesc); + + /// Allocates constraint data. It is the application's responsibility to release this memory after PxSolveConstraints has completed. + /// + /// The allocated memory. This address must be 16-byte aligned. + pub fn PxConstraintAllocator_reserveConstraintData_mut(self_: *mut PxConstraintAllocator, byteSize: u32) -> *mut u8; + + /// Allocates friction data. Friction data can be retained by the application for a given pair and provided as an input to PxSolverContactDesc to improve simulation stability. + /// It is the application's responsibility to release this memory. If this memory is released, the application should ensure it does not pass pointers to this memory to PxSolverContactDesc. + /// + /// The allocated memory. This address must be 4-byte aligned. + pub fn PxConstraintAllocator_reserveFrictionData_mut(self_: *mut PxConstraintAllocator, byteSize: u32) -> *mut u8; + + pub fn PxConstraintAllocator_delete(self_: *mut PxConstraintAllocator); + + pub fn PxArticulationLimit_new() -> PxArticulationLimit; + + pub fn PxArticulationLimit_new_1(low_: f32, high_: f32) -> PxArticulationLimit; + + pub fn PxArticulationDrive_new() -> PxArticulationDrive; + + pub fn PxArticulationDrive_new_1(stiffness_: f32, damping_: f32, maxForce_: f32, driveType_: PxArticulationDriveType) -> PxArticulationDrive; + + pub fn PxTGSSolverBodyVel_projectVelocity(self_: *const PxTGSSolverBodyVel, lin: *const PxVec3, ang: *const PxVec3) -> f32; + + pub fn PxTGSSolverBodyData_projectVelocity(self_: *const PxTGSSolverBodyData, linear: *const PxVec3, angular: *const PxVec3) -> f32; + + pub fn PxTGSSolverConstraintPrepDesc_delete(self_: *mut PxTGSSolverConstraintPrepDesc); + + /// Sets the spring rest length for the sub-tendon from the root to this leaf attachment. + /// + /// Setting this on non-leaf attachments has no effect. + pub fn PxArticulationAttachment_setRestLength_mut(self_: *mut PxArticulationAttachment, restLength: f32); + + /// Gets the spring rest length for the sub-tendon from the root to this leaf attachment. + /// + /// The rest length. + pub fn PxArticulationAttachment_getRestLength(self_: *const PxArticulationAttachment) -> f32; + + /// Sets the low and high limit on the length of the sub-tendon from the root to this leaf attachment. + /// + /// Setting this on non-leaf attachments has no effect. + pub fn PxArticulationAttachment_setLimitParameters_mut(self_: *mut PxArticulationAttachment, parameters: *const PxArticulationTendonLimit); + + /// Gets the low and high limit on the length of the sub-tendon from the root to this leaf attachment. + /// + /// Struct with the low and high limit. + pub fn PxArticulationAttachment_getLimitParameters(self_: *const PxArticulationAttachment) -> PxArticulationTendonLimit; + + /// Sets the attachment's relative offset in the link actor frame. + pub fn PxArticulationAttachment_setRelativeOffset_mut(self_: *mut PxArticulationAttachment, offset: *const PxVec3); + + /// Gets the attachment's relative offset in the link actor frame. + /// + /// The relative offset in the link actor frame. + pub fn PxArticulationAttachment_getRelativeOffset(self_: *const PxArticulationAttachment) -> PxVec3; + + /// Sets the attachment coefficient. + pub fn PxArticulationAttachment_setCoefficient_mut(self_: *mut PxArticulationAttachment, coefficient: f32); + + /// Gets the attachment coefficient. + /// + /// The scale that the distance between this attachment and its parent is multiplied by when summing up the spatial tendon's length. + pub fn PxArticulationAttachment_getCoefficient(self_: *const PxArticulationAttachment) -> f32; + + /// Gets the articulation link. + /// + /// The articulation link that this attachment is attached to. + pub fn PxArticulationAttachment_getLink(self_: *const PxArticulationAttachment) -> *mut PxArticulationLink; + + /// Gets the parent attachment. + /// + /// The parent attachment. + pub fn PxArticulationAttachment_getParent(self_: *const PxArticulationAttachment) -> *mut PxArticulationAttachment; + + /// Indicates that this attachment is a leaf, and thus defines a sub-tendon from the root to this attachment. + /// + /// True: This attachment is a leaf and has zero children; False: Not a leaf. + pub fn PxArticulationAttachment_isLeaf(self_: *const PxArticulationAttachment) -> bool; + + /// Gets the spatial tendon that the attachment is a part of. + /// + /// The tendon. + pub fn PxArticulationAttachment_getTendon(self_: *const PxArticulationAttachment) -> *mut PxArticulationSpatialTendon; + + /// Releases the attachment. + /// + /// Releasing the attachment is not allowed while the articulation is in a scene. In order to + /// release the attachment, remove and then re-add the articulation to the scene. + pub fn PxArticulationAttachment_release_mut(self_: *mut PxArticulationAttachment); + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationAttachment_getConcreteTypeName(self_: *const PxArticulationAttachment) -> *const std::ffi::c_char; + + /// Sets the tendon joint coefficient. + /// + /// RecipCoefficient is commonly expected to be 1/coefficient, but it can be set to different values to tune behavior; for example, zero can be used to + /// have a joint axis only participate in the length computation of the tendon, but not have any tendon force applied to it. + pub fn PxArticulationTendonJoint_setCoefficient_mut(self_: *mut PxArticulationTendonJoint, axis: PxArticulationAxis, coefficient: f32, recipCoefficient: f32); + + /// Gets the tendon joint coefficient. + pub fn PxArticulationTendonJoint_getCoefficient(self_: *const PxArticulationTendonJoint, axis: *mut PxArticulationAxis, coefficient: *mut f32, recipCoefficient: *mut f32); + + /// Gets the articulation link. + /// + /// The articulation link (and its incoming joint in particular) that this tendon joint is associated with. + pub fn PxArticulationTendonJoint_getLink(self_: *const PxArticulationTendonJoint) -> *mut PxArticulationLink; + + /// Gets the parent tendon joint. + /// + /// The parent tendon joint. + pub fn PxArticulationTendonJoint_getParent(self_: *const PxArticulationTendonJoint) -> *mut PxArticulationTendonJoint; + + /// Gets the tendon that the joint is a part of. + /// + /// The tendon. + pub fn PxArticulationTendonJoint_getTendon(self_: *const PxArticulationTendonJoint) -> *mut PxArticulationFixedTendon; + + /// Releases a tendon joint. + /// + /// Releasing a tendon joint is not allowed while the articulation is in a scene. In order to + /// release the joint, remove and then re-add the articulation to the scene. + pub fn PxArticulationTendonJoint_release_mut(self_: *mut PxArticulationTendonJoint); + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationTendonJoint_getConcreteTypeName(self_: *const PxArticulationTendonJoint) -> *const std::ffi::c_char; + + /// Sets the spring stiffness term acting on the tendon length. + pub fn PxArticulationTendon_setStiffness_mut(self_: *mut PxArticulationTendon, stiffness: f32); + + /// Gets the spring stiffness of the tendon. + /// + /// The spring stiffness. + pub fn PxArticulationTendon_getStiffness(self_: *const PxArticulationTendon) -> f32; + + /// Sets the damping term acting both on the tendon length and tendon-length limits. + pub fn PxArticulationTendon_setDamping_mut(self_: *mut PxArticulationTendon, damping: f32); + + /// Gets the damping term acting both on the tendon length and tendon-length limits. + /// + /// The damping term. + pub fn PxArticulationTendon_getDamping(self_: *const PxArticulationTendon) -> f32; + + /// Sets the limit stiffness term acting on the tendon's length limits. + /// + /// For spatial tendons, this parameter applies to all its leaf attachments / sub-tendons. + pub fn PxArticulationTendon_setLimitStiffness_mut(self_: *mut PxArticulationTendon, stiffness: f32); + + /// Gets the limit stiffness term acting on the tendon's length limits. + /// + /// For spatial tendons, this parameter applies to all its leaf attachments / sub-tendons. + /// + /// The limit stiffness term. + pub fn PxArticulationTendon_getLimitStiffness(self_: *const PxArticulationTendon) -> f32; + + /// Sets the length offset term for the tendon. + /// + /// An offset defines an amount to be added to the accumulated length computed for the tendon. It allows the + /// application to actuate the tendon by shortening or lengthening it. + pub fn PxArticulationTendon_setOffset_mut(self_: *mut PxArticulationTendon, offset: f32, autowake: bool); + + /// Gets the length offset term for the tendon. + /// + /// The offset term. + pub fn PxArticulationTendon_getOffset(self_: *const PxArticulationTendon) -> f32; + + /// Gets the articulation that the tendon is a part of. + /// + /// The articulation. + pub fn PxArticulationTendon_getArticulation(self_: *const PxArticulationTendon) -> *mut PxArticulationReducedCoordinate; + + /// Releases a tendon to remove it from the articulation and free its associated memory. + /// + /// When an articulation is released, its attached tendons are automatically released. + /// + /// Releasing a tendon is not allowed while the articulation is in a scene. In order to + /// release the tendon, remove and then re-add the articulation to the scene. + pub fn PxArticulationTendon_release_mut(self_: *mut PxArticulationTendon); + + /// Creates an articulation attachment and adds it to the list of children in the parent attachment. + /// + /// Creating an attachment is not allowed while the articulation is in a scene. In order to + /// add the attachment, remove and then re-add the articulation to the scene. + /// + /// The newly-created attachment if creation was successful, otherwise a null pointer. + pub fn PxArticulationSpatialTendon_createAttachment_mut(self_: *mut PxArticulationSpatialTendon, parent: *mut PxArticulationAttachment, coefficient: f32, relativeOffset: PxVec3, link: *mut PxArticulationLink) -> *mut PxArticulationAttachment; + + /// Fills a user-provided buffer of attachment pointers with the set of attachments. + /// + /// The number of attachments that were filled into the user buffer. + pub fn PxArticulationSpatialTendon_getAttachments(self_: *const PxArticulationSpatialTendon, userBuffer: *mut *mut PxArticulationAttachment, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of attachments in the tendon. + /// + /// The number of attachments. + pub fn PxArticulationSpatialTendon_getNbAttachments(self_: *const PxArticulationSpatialTendon) -> u32; + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationSpatialTendon_getConcreteTypeName(self_: *const PxArticulationSpatialTendon) -> *const std::ffi::c_char; + + /// Creates an articulation tendon joint and adds it to the list of children in the parent tendon joint. + /// + /// Creating a tendon joint is not allowed while the articulation is in a scene. In order to + /// add the joint, remove and then re-add the articulation to the scene. + /// + /// The newly-created tendon joint if creation was successful, otherwise a null pointer. + /// + /// - The axis motion must not be configured as PxArticulationMotion::eLOCKED. + /// - The axis cannot be part of a fixed joint, i.e. joint configured as PxArticulationJointType::eFIX. + pub fn PxArticulationFixedTendon_createTendonJoint_mut(self_: *mut PxArticulationFixedTendon, parent: *mut PxArticulationTendonJoint, axis: PxArticulationAxis, coefficient: f32, recipCoefficient: f32, link: *mut PxArticulationLink) -> *mut PxArticulationTendonJoint; + + /// Fills a user-provided buffer of tendon-joint pointers with the set of tendon joints. + /// + /// The number of tendon joints filled into the user buffer. + pub fn PxArticulationFixedTendon_getTendonJoints(self_: *const PxArticulationFixedTendon, userBuffer: *mut *mut PxArticulationTendonJoint, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of tendon joints in the tendon. + /// + /// The number of tendon joints. + pub fn PxArticulationFixedTendon_getNbTendonJoints(self_: *const PxArticulationFixedTendon) -> u32; + + /// Sets the spring rest length of the tendon. + /// + /// The accumulated "length" of a fixed tendon is a linear combination of the joint axis positions that the tendon is + /// associated with, scaled by the respective tendon joints' coefficients. As such, when the joint positions of all + /// joints are zero, the accumulated length of a fixed tendon is zero. + /// + /// The spring of the tendon is not exerting any force on the articulation when the rest length is equal to the + /// tendon's accumulated length plus the tendon offset. + pub fn PxArticulationFixedTendon_setRestLength_mut(self_: *mut PxArticulationFixedTendon, restLength: f32); + + /// Gets the spring rest length of the tendon. + /// + /// The spring rest length of the tendon. + pub fn PxArticulationFixedTendon_getRestLength(self_: *const PxArticulationFixedTendon) -> f32; + + /// Sets the low and high limit on the length of the tendon. + /// + /// The limits, together with the damping and limit stiffness parameters, act on the accumulated length of the tendon. + pub fn PxArticulationFixedTendon_setLimitParameters_mut(self_: *mut PxArticulationFixedTendon, parameter: *const PxArticulationTendonLimit); + + /// Gets the low and high limit on the length of the tendon. + /// + /// Struct with the low and high limit. + pub fn PxArticulationFixedTendon_getLimitParameters(self_: *const PxArticulationFixedTendon) -> PxArticulationTendonLimit; + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationFixedTendon_getConcreteTypeName(self_: *const PxArticulationFixedTendon) -> *const std::ffi::c_char; + + pub fn PxArticulationCache_new() -> PxArticulationCache; + + /// Releases an articulation cache. + pub fn PxArticulationCache_release_mut(self_: *mut PxArticulationCache); + + /// Releases the sensor. + /// + /// Releasing a sensor is not allowed while the articulation is in a scene. In order to + /// release a sensor, remove and then re-add the articulation to the scene. + pub fn PxArticulationSensor_release_mut(self_: *mut PxArticulationSensor); + + /// Returns the spatial force in the local frame of the sensor. + /// + /// The spatial force. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationSensor_getForces(self_: *const PxArticulationSensor) -> PxSpatialForce; + + /// Returns the relative pose between this sensor and the body frame of the link that the sensor is attached to. + /// + /// The link body frame is at the center of mass and aligned with the principal axes of inertia, see PxRigidBody::getCMassLocalPose. + /// + /// The transform link body frame -> sensor frame. + pub fn PxArticulationSensor_getRelativePose(self_: *const PxArticulationSensor) -> PxTransform; + + /// Sets the relative pose between this sensor and the body frame of the link that the sensor is attached to. + /// + /// The link body frame is at the center of mass and aligned with the principal axes of inertia, see PxRigidBody::getCMassLocalPose. + /// + /// Setting the sensor relative pose is not allowed while the articulation is in a scene. In order to + /// set the pose, remove and then re-add the articulation to the scene. + pub fn PxArticulationSensor_setRelativePose_mut(self_: *mut PxArticulationSensor, pose: *const PxTransform); + + /// Returns the link that this sensor is attached to. + /// + /// A pointer to the link. + pub fn PxArticulationSensor_getLink(self_: *const PxArticulationSensor) -> *mut PxArticulationLink; + + /// Returns the index of this sensor inside the articulation. + /// + /// The return value is only valid for sensors attached to articulations that are in a scene. + /// + /// The low-level index, or 0xFFFFFFFF if the articulation is not in a scene. + pub fn PxArticulationSensor_getIndex(self_: *const PxArticulationSensor) -> u32; + + /// Returns the articulation that this sensor is part of. + /// + /// A pointer to the articulation. + pub fn PxArticulationSensor_getArticulation(self_: *const PxArticulationSensor) -> *mut PxArticulationReducedCoordinate; + + /// Returns the sensor's flags. + /// + /// The current set of flags of the sensor. + pub fn PxArticulationSensor_getFlags(self_: *const PxArticulationSensor) -> PxArticulationSensorFlags; + + /// Sets a flag of the sensor. + /// + /// Setting the sensor flags is not allowed while the articulation is in a scene. In order to + /// set the flags, remove and then re-add the articulation to the scene. + pub fn PxArticulationSensor_setFlag_mut(self_: *mut PxArticulationSensor, flag: PxArticulationSensorFlag, enabled: bool); + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationSensor_getConcreteTypeName(self_: *const PxArticulationSensor) -> *const std::ffi::c_char; + + /// Returns the scene which this articulation belongs to. + /// + /// Owner Scene. NULL if not part of a scene. + pub fn PxArticulationReducedCoordinate_getScene(self_: *const PxArticulationReducedCoordinate) -> *mut PxScene; + + /// Sets the solver iteration counts for the articulation. + /// + /// The solver iteration count determines how accurately contacts, drives, and limits are resolved. + /// Setting a higher position iteration count may therefore help in scenarios where the articulation + /// is subject to many constraints; for example, a manipulator articulation with drives and joint limits + /// that is grasping objects, or several such articulations interacting through contacts. Other situations + /// where higher position iterations may improve simulation fidelity are: large mass ratios within the + /// articulation or between the articulation and an object in contact with it; or strong drives in the + /// articulation being used to manipulate a light object. + /// + /// If intersecting bodies are being depenetrated too violently, increase the number of velocity + /// iterations. More velocity iterations will drive the relative exit velocity of the intersecting + /// objects closer to the correct value given the restitution. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setSolverIterationCounts_mut(self_: *mut PxArticulationReducedCoordinate, minPositionIters: u32, minVelocityIters: u32); + + /// Returns the solver iteration counts. + pub fn PxArticulationReducedCoordinate_getSolverIterationCounts(self_: *const PxArticulationReducedCoordinate, minPositionIters: *mut u32, minVelocityIters: *mut u32); + + /// Returns true if this articulation is sleeping. + /// + /// When an actor does not move for a period of time, it is no longer simulated in order to save time. This state + /// is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + /// or a sleep-affecting property is changed by the user, the entire sleep mechanism should be transparent to the user. + /// + /// An articulation can only go to sleep if all links are ready for sleeping. An articulation is guaranteed to be awake + /// if at least one of the following holds: + /// + /// The wake counter is positive (see [`setWakeCounter`]()). + /// + /// The linear or angular velocity of any link is non-zero. + /// + /// A non-zero force or torque has been applied to the articulation or any of its links. + /// + /// If an articulation is sleeping, the following state is guaranteed: + /// + /// The wake counter is zero. + /// + /// The linear and angular velocity of all links is zero. + /// + /// There is no force update pending. + /// + /// When an articulation gets inserted into a scene, it will be considered asleep if all the points above hold, else it will + /// be treated as awake. + /// + /// If an articulation is asleep after the call to [`PxScene::fetchResults`]() returns, it is guaranteed that the poses of the + /// links were not changed. You can use this information to avoid updating the transforms of associated objects. + /// + /// True if the articulation is sleeping. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation, + /// except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_isSleeping(self_: *const PxArticulationReducedCoordinate) -> bool; + + /// Sets the mass-normalized energy threshold below which the articulation may go to sleep. + /// + /// The articulation will sleep if the energy of each link is below this threshold. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setSleepThreshold_mut(self_: *mut PxArticulationReducedCoordinate, threshold: f32); + + /// Returns the mass-normalized energy below which the articulation may go to sleep. + /// + /// The energy threshold for sleeping. + pub fn PxArticulationReducedCoordinate_getSleepThreshold(self_: *const PxArticulationReducedCoordinate) -> f32; + + /// Sets the mass-normalized kinetic energy threshold below which the articulation may participate in stabilization. + /// + /// Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + /// + /// This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc. + /// + /// Default: + /// 0.01 * PxTolerancesScale::speed * PxTolerancesScale::speed + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setStabilizationThreshold_mut(self_: *mut PxArticulationReducedCoordinate, threshold: f32); + + /// Returns the mass-normalized kinetic energy below which the articulation may participate in stabilization. + /// + /// Articulations whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + /// + /// The energy threshold for participating in stabilization. + pub fn PxArticulationReducedCoordinate_getStabilizationThreshold(self_: *const PxArticulationReducedCoordinate) -> f32; + + /// Sets the wake counter for the articulation in seconds. + /// + /// - The wake counter value determines the minimum amount of time until the articulation can be put to sleep. + /// - An articulation will not be put to sleep if the energy is above the specified threshold (see [`setSleepThreshold`]()) + /// or if other awake objects are touching it. + /// - Passing in a positive value will wake up the articulation automatically. + /// + /// Default: + /// 0.4s (which corresponds to 20 frames for a time step of 0.02s) + /// + /// This call may not be made during simulation, except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_setWakeCounter_mut(self_: *mut PxArticulationReducedCoordinate, wakeCounterValue: f32); + + /// Returns the wake counter of the articulation in seconds. + /// + /// The wake counter of the articulation in seconds. + /// + /// This call may not be made during simulation, except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_getWakeCounter(self_: *const PxArticulationReducedCoordinate) -> f32; + + /// Wakes up the articulation if it is sleeping. + /// + /// - The articulation will get woken up and might cause other touching objects to wake up as well during the next simulation step. + /// - This will set the wake counter of the articulation to the value specified in [`PxSceneDesc::wakeCounterResetValue`]. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation, + /// except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_wakeUp_mut(self_: *mut PxArticulationReducedCoordinate); + + /// Forces the articulation to sleep. + /// + /// - The articulation will stay asleep during the next simulation step if not touched by another non-sleeping actor. + /// - This will set any applied force, the velocity, and the wake counter of all bodies in the articulation to zero. + /// + /// This call may not be made during simulation, and may only be made on articulations that are in a scene. + pub fn PxArticulationReducedCoordinate_putToSleep_mut(self_: *mut PxArticulationReducedCoordinate); + + /// Sets the limit on the magnitude of the linear velocity of the articulation's center of mass. + /// + /// - The limit acts on the linear velocity of the entire articulation. The velocity is calculated from the total momentum + /// and the spatial inertia of the articulation. + /// - The limit only applies to floating-base articulations. + /// - A benefit of the COM velocity limit is that it is evenly applied to the whole articulation, which results in fewer visual + /// artifacts compared to link rigid-body damping or joint-velocity limits. However, these per-link or per-degree-of-freedom + /// limits may still help avoid numerical issues. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setMaxCOMLinearVelocity_mut(self_: *mut PxArticulationReducedCoordinate, maxLinearVelocity: f32); + + /// Gets the limit on the magnitude of the linear velocity of the articulation's center of mass. + /// + /// The maximal linear velocity magnitude. + pub fn PxArticulationReducedCoordinate_getMaxCOMLinearVelocity(self_: *const PxArticulationReducedCoordinate) -> f32; + + /// Sets the limit on the magnitude of the angular velocity at the articulation's center of mass. + /// + /// - The limit acts on the angular velocity of the entire articulation. The velocity is calculated from the total momentum + /// and the spatial inertia of the articulation. + /// - The limit only applies to floating-base articulations. + /// - A benefit of the COM velocity limit is that it is evenly applied to the whole articulation, which results in fewer visual + /// artifacts compared to link rigid-body damping or joint-velocity limits. However, these per-link or per-degree-of-freedom + /// limits may still help avoid numerical issues. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setMaxCOMAngularVelocity_mut(self_: *mut PxArticulationReducedCoordinate, maxAngularVelocity: f32); + + /// Gets the limit on the magnitude of the angular velocity at the articulation's center of mass. + /// + /// The maximal angular velocity magnitude. + pub fn PxArticulationReducedCoordinate_getMaxCOMAngularVelocity(self_: *const PxArticulationReducedCoordinate) -> f32; + + /// Adds a link to the articulation with default attribute values. + /// + /// The new link, or NULL if the link cannot be created. + /// + /// Creating a link is not allowed while the articulation is in a scene. In order to add a link, + /// remove and then re-add the articulation to the scene. + pub fn PxArticulationReducedCoordinate_createLink_mut(self_: *mut PxArticulationReducedCoordinate, parent: *mut PxArticulationLink, pose: *const PxTransform) -> *mut PxArticulationLink; + + /// Releases the articulation, and all its links and corresponding joints. + /// + /// Attached sensors and tendons are released automatically when the articulation is released. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_release_mut(self_: *mut PxArticulationReducedCoordinate); + + /// Returns the number of links in the articulation. + /// + /// The number of links. + pub fn PxArticulationReducedCoordinate_getNbLinks(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Returns the set of links in the articulation in the order that they were added to the articulation using createLink. + /// + /// The number of links written into the buffer. + pub fn PxArticulationReducedCoordinate_getLinks(self_: *const PxArticulationReducedCoordinate, userBuffer: *mut *mut PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of shapes in the articulation. + /// + /// The number of shapes. + pub fn PxArticulationReducedCoordinate_getNbShapes(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Sets a name string for the articulation 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. + pub fn PxArticulationReducedCoordinate_setName_mut(self_: *mut PxArticulationReducedCoordinate, name: *const std::ffi::c_char); + + /// Returns the name string set with setName(). + /// + /// Name string associated with the articulation. + pub fn PxArticulationReducedCoordinate_getName(self_: *const PxArticulationReducedCoordinate) -> *const std::ffi::c_char; + + /// Returns the axis-aligned bounding box enclosing the articulation. + /// + /// The articulation's bounding box. + /// + /// It is not allowed to use this method while the simulation is running, except in a split simulation + /// during [`PxScene::collide`]() and up to #PxScene::advance(), and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationReducedCoordinate_getWorldBounds(self_: *const PxArticulationReducedCoordinate, inflation: f32) -> PxBounds3; + + /// Returns the aggregate the articulation might be a part of. + /// + /// The aggregate the articulation is a part of, or NULL if the articulation does not belong to an aggregate. + pub fn PxArticulationReducedCoordinate_getAggregate(self_: *const PxArticulationReducedCoordinate) -> *mut PxAggregate; + + /// Sets flags on the articulation. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setArticulationFlags_mut(self_: *mut PxArticulationReducedCoordinate, flags: PxArticulationFlags); + + /// Raises or clears a flag on the articulation. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setArticulationFlag_mut(self_: *mut PxArticulationReducedCoordinate, flag: PxArticulationFlag, value: bool); + + /// Returns the articulation's flags. + /// + /// The flags. + pub fn PxArticulationReducedCoordinate_getArticulationFlags(self_: *const PxArticulationReducedCoordinate) -> PxArticulationFlags; + + /// Returns the total number of joint degrees-of-freedom (DOFs) of the articulation. + /// + /// - The six DOFs of the base of a floating-base articulation are not included in this count. + /// - Example: Both a fixed-base and a floating-base double-pendulum with two revolute joints will have getDofs() == 2. + /// - The return value is only valid for articulations that are in a scene. + /// + /// The number of joint DOFs, or 0xFFFFFFFF if the articulation is not in a scene. + pub fn PxArticulationReducedCoordinate_getDofs(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Creates an articulation cache that can be used to read and write internal articulation data. + /// + /// - When the structure of the articulation changes (e.g. adding a link or sensor) after the cache was created, + /// the cache needs to be released and recreated. + /// - Free the memory allocated for the cache by calling the release() method on the cache. + /// - Caches can only be created by articulations that are in a scene. + /// + /// The cache, or NULL if the articulation is not in a scene. + pub fn PxArticulationReducedCoordinate_createCache(self_: *const PxArticulationReducedCoordinate) -> *mut PxArticulationCache; + + /// Returns the size of the articulation cache in bytes. + /// + /// - The size does not include: the user-allocated memory for the coefficient matrix or lambda values; + /// the scratch-related memory/members; and the cache version. See comment in [`PxArticulationCache`]. + /// - The return value is only valid for articulations that are in a scene. + /// + /// The byte size of the cache, or 0xFFFFFFFF if the articulation is not in a scene. + pub fn PxArticulationReducedCoordinate_getCacheDataSize(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Zeroes all data in the articulation cache, except user-provided and scratch memory, and cache version. + /// + /// This call may only be made on articulations that are in a scene. + pub fn PxArticulationReducedCoordinate_zeroCache(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Applies the data in the cache to the articulation. + /// + /// This call wakes the articulation if it is sleeping, and the autowake parameter is true (default) or: + /// - a nonzero joint velocity is applied or + /// - a nonzero joint force is applied or + /// - a nonzero root velocity is applied + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_applyCache_mut(self_: *mut PxArticulationReducedCoordinate, cache: *mut PxArticulationCache, flags: PxArticulationCacheFlags, autowake: bool); + + /// Copies internal data of the articulation to the cache. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_copyInternalStateToCache(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache, flags: PxArticulationCacheFlags); + + /// Converts maximal-coordinate joint DOF data to reduced coordinates. + /// + /// - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + /// - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + /// + /// The articulation must be in a scene. + pub fn PxArticulationReducedCoordinate_packJointData(self_: *const PxArticulationReducedCoordinate, maximum: *const f32, reduced: *mut f32); + + /// Converts reduced-coordinate joint DOF data to maximal coordinates. + /// + /// - Indexing into the maximal joint DOF data is via the link's low-level index minus 1 (the root link is not included). + /// - The reduced-coordinate data follows the cache indexing convention, see PxArticulationCache::jointVelocity. + /// + /// The articulation must be in a scene. + pub fn PxArticulationReducedCoordinate_unpackJointData(self_: *const PxArticulationReducedCoordinate, reduced: *const f32, maximum: *mut f32); + + /// Prepares common articulation data based on articulation pose for inverse dynamics calculations. + /// + /// Usage: + /// 1. Set articulation pose (joint positions and base transform) via articulation cache and applyCache(). + /// 1. Call commonInit. + /// 1. Call inverse dynamics computation method. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_commonInit(self_: *const PxArticulationReducedCoordinate); + + /// Computes the joint DOF forces required to counteract gravitational forces for the given articulation pose. + /// + /// - Inputs - Articulation pose (joint positions + base transform). + /// - Outputs - Joint forces to counteract gravity (in cache). + /// + /// - The joint forces returned are determined purely by gravity for the articulation in the current joint and base pose, and joints at rest; + /// i.e. external forces, joint velocities, and joint accelerations are set to zero. Joint drives are also not considered in the computation. + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeGeneralizedGravityForce(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Computes the joint DOF forces required to counteract Coriolis and centrifugal forces for the given articulation state. + /// + /// - Inputs - Articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + /// - Outputs - Joint forces to counteract Coriolis and centrifugal forces (in cache). + /// + /// - The joint forces returned are determined purely by the articulation's state; i.e. external forces, gravity, and joint accelerations are set to zero. + /// Joint drives and potential damping terms, such as link angular or linear damping, or joint friction, are also not considered in the computation. + /// - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeCoriolisAndCentrifugalForce(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Computes the joint DOF forces required to counteract external spatial forces applied to articulation links. + /// + /// - Inputs - External forces on links (in cache), articulation pose (joint positions + base transform). + /// - Outputs - Joint forces to counteract the external forces (in cache). + /// + /// - Only the external spatial forces provided in the cache and the articulation pose are considered in the computation. + /// - The external spatial forces are with respect to the links' centers of mass, and not the actor's origin. + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeGeneralizedExternalForce(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Computes the joint accelerations for the given articulation state and joint forces. + /// + /// - Inputs - Joint forces (in cache) and articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + /// - Outputs - Joint accelerations (in cache). + /// + /// - The computation includes Coriolis terms and gravity. However, joint drives and potential damping terms are not considered in the computation + /// (for example, linear link damping or joint friction). + /// - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeJointAcceleration(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Computes the joint forces for the given articulation state and joint accelerations, not considering gravity. + /// + /// - Inputs - Joint accelerations (in cache) and articulation state (joint positions and velocities (in cache), and base transform and spatial velocity). + /// - Outputs - Joint forces (in cache). + /// + /// - The computation includes Coriolis terms. However, joint drives and potential damping terms are not considered in the computation + /// (for example, linear link damping or joint friction). + /// - Prior to the computation, update/set the base spatial velocity with PxArticulationCache::rootLinkData and applyCache(). + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeJointForce(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Compute the dense Jacobian for the articulation in world space, including the DOFs of a potentially floating base. + /// + /// This computes the dense representation of an inherently sparse matrix. Multiplication with this matrix maps + /// joint space velocities to world-space linear and angular (i.e. spatial) velocities of the centers of mass of the links. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeDenseJacobian(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache, nRows: *mut u32, nCols: *mut u32); + + /// Computes the coefficient matrix for contact forces. + /// + /// - The matrix dimension is getCoefficientMatrixSize() = getDofs() * getNbLoopJoints(), and the DOF (column) indexing follows the internal DOF order, see PxArticulationCache::jointVelocity. + /// - Each column in the matrix is the joint forces effected by a contact based on impulse strength 1. + /// - The user must allocate memory for PxArticulationCache::coefficientMatrix where the required size of the PxReal array is equal to getCoefficientMatrixSize(). + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeCoefficientMatrix(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Computes the lambda values when the test impulse is 1. + /// + /// - The user must allocate memory for PxArticulationCache::lambda where the required size of the PxReal array is equal to getNbLoopJoints(). + /// - commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// True if convergence was achieved within maxIter; False if convergence was not achieved or the operation failed otherwise. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeLambda(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache, initialState: *mut PxArticulationCache, jointTorque: *const f32, maxIter: u32) -> bool; + + /// Compute the joint-space inertia matrix that maps joint accelerations to joint forces: forces = M * accelerations. + /// + /// - Inputs - Articulation pose (joint positions and base transform). + /// - Outputs - Mass matrix (in cache). + /// + /// commonInit() must be called before the computation, and after setting the articulation pose via applyCache(). + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_computeGeneralizedMassMatrix(self_: *const PxArticulationReducedCoordinate, cache: *mut PxArticulationCache); + + /// Adds a loop joint to the articulation system for inverse dynamics. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_addLoopJoint_mut(self_: *mut PxArticulationReducedCoordinate, joint: *mut PxConstraint); + + /// Removes a loop joint from the articulation for inverse dynamics. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_removeLoopJoint_mut(self_: *mut PxArticulationReducedCoordinate, joint: *mut PxConstraint); + + /// Returns the number of loop joints in the articulation for inverse dynamics. + /// + /// The number of loop joints. + pub fn PxArticulationReducedCoordinate_getNbLoopJoints(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Returns the set of loop constraints (i.e. joints) in the articulation. + /// + /// The number of constraints written into the buffer. + pub fn PxArticulationReducedCoordinate_getLoopJoints(self_: *const PxArticulationReducedCoordinate, userBuffer: *mut *mut PxConstraint, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the required size of the coefficient matrix in the articulation. + /// + /// Size of the coefficient matrix (equal to getDofs() * getNbLoopJoints()). + /// + /// This call may only be made on articulations that are in a scene. + pub fn PxArticulationReducedCoordinate_getCoefficientMatrixSize(self_: *const PxArticulationReducedCoordinate) -> u32; + + /// Sets the root link transform (world to actor frame). + /// + /// - For performance, prefer PxArticulationCache::rootLinkData to set the root link transform in a batch articulation state update. + /// - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + /// in order to update link states for the next simulation frame or querying. + /// + /// This call may not be made during simulation. + pub fn PxArticulationReducedCoordinate_setRootGlobalPose_mut(self_: *mut PxArticulationReducedCoordinate, pose: *const PxTransform, autowake: bool); + + /// Returns the root link transform (world to actor frame). + /// + /// For performance, prefer PxArticulationCache::rootLinkData to get the root link transform in a batch query. + /// + /// The root link transform. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationReducedCoordinate_getRootGlobalPose(self_: *const PxArticulationReducedCoordinate) -> PxTransform; + + /// Sets the root link linear center-of-mass velocity. + /// + /// - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + /// - For performance, prefer PxArticulationCache::rootLinkData to set the root link velocity in a batch articulation state update. + /// - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + /// - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + /// in order to update link states for the next simulation frame or querying. + /// + /// This call may not be made during simulation, except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_setRootLinearVelocity_mut(self_: *mut PxArticulationReducedCoordinate, linearVelocity: *const PxVec3, autowake: bool); + + /// Gets the root link center-of-mass linear velocity. + /// + /// - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + /// - For performance, prefer PxArticulationCache::rootLinkData to get the root link velocity in a batch query. + /// + /// The root link center-of-mass linear velocity. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationReducedCoordinate_getRootLinearVelocity(self_: *const PxArticulationReducedCoordinate) -> PxVec3; + + /// Sets the root link angular velocity. + /// + /// - For performance, prefer PxArticulationCache::rootLinkData to set the root link velocity in a batch articulation state update. + /// - The articulation is woken up if the input velocity is nonzero (ignoring autowake) and the articulation is in a scene. + /// - Use updateKinematic() after all state updates to the articulation via non-cache API such as this method, + /// in order to update link states for the next simulation frame or querying. + /// + /// This call may not be made during simulation, except in a split simulation in-between [`PxScene::fetchCollision`] and #PxScene::advance. + pub fn PxArticulationReducedCoordinate_setRootAngularVelocity_mut(self_: *mut PxArticulationReducedCoordinate, angularVelocity: *const PxVec3, autowake: bool); + + /// Gets the root link angular velocity. + /// + /// For performance, prefer PxArticulationCache::rootLinkData to get the root link velocity in a batch query. + /// + /// The root link angular velocity. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationReducedCoordinate_getRootAngularVelocity(self_: *const PxArticulationReducedCoordinate) -> PxVec3; + + /// Returns the (classical) link acceleration in world space for the given low-level link index. + /// + /// - The returned acceleration is not a spatial, but a classical, i.e. body-fixed acceleration (https://en.wikipedia.org/wiki/Spatial_acceleration). + /// - The (linear) acceleration is with respect to the link's center of mass and not the actor frame origin. + /// + /// The link's center-of-mass classical acceleration, or 0 if the call is made before the articulation participated in a first simulation step. + /// + /// This call may only be made on articulations that are in a scene, and it is not allowed to use this method while the simulation + /// is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationReducedCoordinate_getLinkAcceleration_mut(self_: *mut PxArticulationReducedCoordinate, linkId: u32) -> PxSpatialVelocity; + + /// Returns the GPU articulation index. + /// + /// The GPU index, or 0xFFFFFFFF if the articulation is not in a scene or PxSceneFlag::eSUPPRESS_READBACK is not set. + pub fn PxArticulationReducedCoordinate_getGpuArticulationIndex_mut(self_: *mut PxArticulationReducedCoordinate) -> u32; + + /// Creates a spatial tendon to attach to the articulation with default attribute values. + /// + /// The new spatial tendon. + /// + /// Creating a spatial tendon is not allowed while the articulation is in a scene. In order to + /// add the tendon, remove and then re-add the articulation to the scene. + pub fn PxArticulationReducedCoordinate_createSpatialTendon_mut(self_: *mut PxArticulationReducedCoordinate) -> *mut PxArticulationSpatialTendon; + + /// Creates a fixed tendon to attach to the articulation with default attribute values. + /// + /// The new fixed tendon. + /// + /// Creating a fixed tendon is not allowed while the articulation is in a scene. In order to + /// add the tendon, remove and then re-add the articulation to the scene. + pub fn PxArticulationReducedCoordinate_createFixedTendon_mut(self_: *mut PxArticulationReducedCoordinate) -> *mut PxArticulationFixedTendon; + + /// Creates a force sensor attached to a link of the articulation. + /// + /// The new sensor. + /// + /// Creating a sensor is not allowed while the articulation is in a scene. In order to + /// add the sensor, remove and then re-add the articulation to the scene. + pub fn PxArticulationReducedCoordinate_createSensor_mut(self_: *mut PxArticulationReducedCoordinate, link: *mut PxArticulationLink, relativePose: *const PxTransform) -> *mut PxArticulationSensor; + + /// Returns the spatial tendons attached to the articulation. + /// + /// The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + /// + /// The number of tendons written into the buffer. + pub fn PxArticulationReducedCoordinate_getSpatialTendons(self_: *const PxArticulationReducedCoordinate, userBuffer: *mut *mut PxArticulationSpatialTendon, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of spatial tendons in the articulation. + /// + /// The number of tendons. + pub fn PxArticulationReducedCoordinate_getNbSpatialTendons_mut(self_: *mut PxArticulationReducedCoordinate) -> u32; + + /// Returns the fixed tendons attached to the articulation. + /// + /// The order of the tendons in the buffer is not necessarily identical to the order in which the tendons were added to the articulation. + /// + /// The number of tendons written into the buffer. + pub fn PxArticulationReducedCoordinate_getFixedTendons(self_: *const PxArticulationReducedCoordinate, userBuffer: *mut *mut PxArticulationFixedTendon, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of fixed tendons in the articulation. + /// + /// The number of tendons. + pub fn PxArticulationReducedCoordinate_getNbFixedTendons_mut(self_: *mut PxArticulationReducedCoordinate) -> u32; + + /// Returns the sensors attached to the articulation. + /// + /// The order of the sensors in the buffer is not necessarily identical to the order in which the sensors were added to the articulation. + /// + /// The number of sensors written into the buffer. + pub fn PxArticulationReducedCoordinate_getSensors(self_: *const PxArticulationReducedCoordinate, userBuffer: *mut *mut PxArticulationSensor, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of sensors in the articulation. + /// + /// The number of sensors. + pub fn PxArticulationReducedCoordinate_getNbSensors_mut(self_: *mut PxArticulationReducedCoordinate) -> u32; + + /// Update link velocities and/or positions in the articulation. + /// + /// For performance, prefer the PxArticulationCache API that performs batch articulation state updates. + /// + /// If the application updates the root state (position and velocity) or joint state via any combination of + /// the non-cache API calls + /// + /// - setRootGlobalPose(), setRootLinearVelocity(), setRootAngularVelocity() + /// - PxArticulationJointReducedCoordinate::setJointPosition(), PxArticulationJointReducedCoordinate::setJointVelocity() + /// + /// the application needs to call this method after the state setting in order to update the link states for + /// the next simulation frame or querying. + /// + /// Use + /// - PxArticulationKinematicFlag::ePOSITION after any changes to the articulation root or joint positions using non-cache API calls. Updates links' positions and velocities. + /// - PxArticulationKinematicFlag::eVELOCITY after velocity-only changes to the articulation root or joints using non-cache API calls. Updates links' velocities only. + /// + /// This call may only be made on articulations that are in a scene, and may not be made during simulation. + pub fn PxArticulationReducedCoordinate_updateKinematic_mut(self_: *mut PxArticulationReducedCoordinate, flags: PxArticulationKinematicFlags); + + /// Gets the parent articulation link of this joint. + /// + /// The parent link. + pub fn PxArticulationJointReducedCoordinate_getParentArticulationLink(self_: *const PxArticulationJointReducedCoordinate) -> *mut PxArticulationLink; + + /// Sets the joint pose in the parent link actor frame. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setParentPose_mut(self_: *mut PxArticulationJointReducedCoordinate, pose: *const PxTransform); + + /// Gets the joint pose in the parent link actor frame. + /// + /// The joint pose. + pub fn PxArticulationJointReducedCoordinate_getParentPose(self_: *const PxArticulationJointReducedCoordinate) -> PxTransform; + + /// Gets the child articulation link of this joint. + /// + /// The child link. + pub fn PxArticulationJointReducedCoordinate_getChildArticulationLink(self_: *const PxArticulationJointReducedCoordinate) -> *mut PxArticulationLink; + + /// Sets the joint pose in the child link actor frame. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setChildPose_mut(self_: *mut PxArticulationJointReducedCoordinate, pose: *const PxTransform); + + /// Gets the joint pose in the child link actor frame. + /// + /// The joint pose. + pub fn PxArticulationJointReducedCoordinate_getChildPose(self_: *const PxArticulationJointReducedCoordinate) -> PxTransform; + + /// Sets the joint type (e.g. revolute). + /// + /// Setting the joint type is not allowed while the articulation is in a scene. + /// In order to set the joint type, remove and then re-add the articulation to the scene. + pub fn PxArticulationJointReducedCoordinate_setJointType_mut(self_: *mut PxArticulationJointReducedCoordinate, jointType: PxArticulationJointType); + + /// Gets the joint type. + /// + /// The joint type. + pub fn PxArticulationJointReducedCoordinate_getJointType(self_: *const PxArticulationJointReducedCoordinate) -> PxArticulationJointType; + + /// Sets the joint motion for a given axis. + /// + /// Setting the motion of joint axes is not allowed while the articulation is in a scene. + /// In order to set the motion, remove and then re-add the articulation to the scene. + pub fn PxArticulationJointReducedCoordinate_setMotion_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, motion: PxArticulationMotion); + + /// Returns the joint motion for the given axis. + /// + /// The joint motion of the given axis. + pub fn PxArticulationJointReducedCoordinate_getMotion(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> PxArticulationMotion; + + /// Sets the joint limits for a given axis. + /// + /// - The motion of the corresponding axis should be set to PxArticulationMotion::eLIMITED in order for the limits to be enforced. + /// - The lower limit should be strictly smaller than the higher limit. If the limits should be equal, use PxArticulationMotion::eLOCKED + /// and an appropriate offset in the parent/child joint frames. + /// + /// This call is not allowed while the simulation is running. + /// + /// For spherical joints, limit.min and limit.max must both be in range [-Pi, Pi]. + pub fn PxArticulationJointReducedCoordinate_setLimitParams_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, limit: *const PxArticulationLimit); + + /// Returns the joint limits for a given axis. + /// + /// The joint limits. + pub fn PxArticulationJointReducedCoordinate_getLimitParams(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> PxArticulationLimit; + + /// Configures a joint drive for the given axis. + /// + /// See PxArticulationDrive for parameter details; and the manual for further information, and the drives' implicit spring-damper (i.e. PD control) implementation in particular. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setDriveParams_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, drive: *const PxArticulationDrive); + + /// Gets the joint drive configuration for the given axis. + /// + /// The drive parameters. + pub fn PxArticulationJointReducedCoordinate_getDriveParams(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> PxArticulationDrive; + + /// Sets the joint drive position target for the given axis. + /// + /// The target units are linear units (equivalent to scene units) for a translational axis, or rad for a rotational axis. + /// + /// This call is not allowed while the simulation is running. + /// + /// For spherical joints, target must be in range [-Pi, Pi]. + /// + /// The target is specified in the parent frame of the joint. If Gp, Gc are the parent and child actor poses in the world frame and Lp, Lc are the parent and child joint frames expressed in the parent and child actor frames then the joint will drive the parent and child links to poses that obey Gp * Lp * J = Gc * Lc. For joints restricted to angular motion, J has the form PxTranfsorm(PxVec3(PxZero), PxExp(PxVec3(twistTarget, swing1Target, swing2Target))). For joints restricted to linear motion, J has the form PxTransform(PxVec3(XTarget, YTarget, ZTarget), PxQuat(PxIdentity)). + /// + /// For spherical joints with more than 1 degree of freedom, the joint target angles taken together can collectively represent a rotation of greater than Pi around a vector. When this happens the rotation that matches the joint drive target is not the shortest path rotation. The joint pose J that is the outcome after driving to the target pose will always be the equivalent of the shortest path rotation. + pub fn PxArticulationJointReducedCoordinate_setDriveTarget_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, target: f32, autowake: bool); + + /// Returns the joint drive position target for the given axis. + /// + /// The target position. + pub fn PxArticulationJointReducedCoordinate_getDriveTarget(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> f32; + + /// Sets the joint drive velocity target for the given axis. + /// + /// The target units are linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setDriveVelocity_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, targetVel: f32, autowake: bool); + + /// Returns the joint drive velocity target for the given axis. + /// + /// The target velocity. + pub fn PxArticulationJointReducedCoordinate_getDriveVelocity(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> f32; + + /// Sets the joint armature for the given axis. + /// + /// - The armature is directly added to the joint-space spatial inertia of the corresponding axis. + /// - The armature is in mass units for a prismatic (i.e. linear) joint, and in mass units * (scene linear units)^2 for a rotational joint. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setArmature_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, armature: f32); + + /// Gets the joint armature for the given axis. + /// + /// The armature set on the given axis. + pub fn PxArticulationJointReducedCoordinate_getArmature(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> f32; + + /// Sets the joint friction coefficient, which applies to all joint axes. + /// + /// - The joint friction is unitless and relates the magnitude of the spatial force [F_trans, T_trans] transmitted from parent to child link to + /// the maximal friction force F_resist that may be applied by the solver to resist joint motion, per axis; i.e. |F_resist| + /// < + /// = coefficient * (|F_trans| + |T_trans|), + /// where F_resist may refer to a linear force or torque depending on the joint axis. + /// - The simulated friction effect is therefore similar to static and Coulomb friction. In order to simulate dynamic joint friction, use a joint drive with + /// zero stiffness and zero velocity target, and an appropriately dimensioned damping parameter. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setFrictionCoefficient_mut(self_: *mut PxArticulationJointReducedCoordinate, coefficient: f32); + + /// Gets the joint friction coefficient. + /// + /// The joint friction coefficient. + pub fn PxArticulationJointReducedCoordinate_getFrictionCoefficient(self_: *const PxArticulationJointReducedCoordinate) -> f32; + + /// Sets the maximal joint velocity enforced for all axes. + /// + /// - The solver will apply appropriate joint-space impulses in order to enforce the per-axis joint-velocity limit. + /// - The velocity units are linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setMaxJointVelocity_mut(self_: *mut PxArticulationJointReducedCoordinate, maxJointV: f32); + + /// Gets the maximal joint velocity enforced for all axes. + /// + /// The maximal per-axis joint velocity. + pub fn PxArticulationJointReducedCoordinate_getMaxJointVelocity(self_: *const PxArticulationJointReducedCoordinate) -> f32; + + /// Sets the joint position for the given axis. + /// + /// - For performance, prefer PxArticulationCache::jointPosition to set joint positions in a batch articulation state update. + /// - Use PxArticulationReducedCoordinate::updateKinematic after all state updates to the articulation via non-cache API such as this method, + /// in order to update link states for the next simulation frame or querying. + /// + /// This call is not allowed while the simulation is running. + /// + /// For spherical joints, jointPos must be in range [-Pi, Pi]. + /// + /// Joint position is specified in the parent frame of the joint. If Gp, Gc are the parent and child actor poses in the world frame and Lp, Lc are the parent and child joint frames expressed in the parent and child actor frames then the parent and child links will be given poses that obey Gp * Lp * J = Gc * Lc with J denoting the joint pose. For joints restricted to angular motion, J has the form PxTranfsorm(PxVec3(PxZero), PxExp(PxVec3(twistPos, swing1Pos, swing2Pos))). For joints restricted to linear motion, J has the form PxTransform(PxVec3(xPos, yPos, zPos), PxQuat(PxIdentity)). + /// + /// For spherical joints with more than 1 degree of freedom, the input joint positions taken together can collectively represent a rotation of greater than Pi around a vector. When this happens the rotation that matches the joint positions is not the shortest path rotation. The joint pose J that is the outcome of setting and applying the joint positions will always be the equivalent of the shortest path rotation. + pub fn PxArticulationJointReducedCoordinate_setJointPosition_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, jointPos: f32); + + /// Gets the joint position for the given axis, i.e. joint degree of freedom (DOF). + /// + /// For performance, prefer PxArticulationCache::jointPosition to get joint positions in a batch query. + /// + /// The joint position in linear units (equivalent to scene units) for a translational axis, or radians for a rotational axis. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationJointReducedCoordinate_getJointPosition(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> f32; + + /// Sets the joint velocity for the given axis. + /// + /// - For performance, prefer PxArticulationCache::jointVelocity to set joint velocities in a batch articulation state update. + /// - Use PxArticulationReducedCoordinate::updateKinematic after all state updates to the articulation via non-cache API such as this method, + /// in order to update link states for the next simulation frame or querying. + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationJointReducedCoordinate_setJointVelocity_mut(self_: *mut PxArticulationJointReducedCoordinate, axis: PxArticulationAxis, jointVel: f32); + + /// Gets the joint velocity for the given axis. + /// + /// For performance, prefer PxArticulationCache::jointVelocity to get joint velocities in a batch query. + /// + /// The joint velocity in linear units (equivalent to scene units) per second for a translational axis, or radians per second for a rotational axis. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationJointReducedCoordinate_getJointVelocity(self_: *const PxArticulationJointReducedCoordinate, axis: PxArticulationAxis) -> f32; + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationJointReducedCoordinate_getConcreteTypeName(self_: *const PxArticulationJointReducedCoordinate) -> *const std::ffi::c_char; + + /// 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; + + /// Deletes the rigid actor object. + /// + /// Also releases any shapes associated with the actor. + /// + /// Releasing an actor will affect any objects that are connected to the actor (constraint shaders like joints etc.). + /// Such connected objects will be deleted upon scene deletion, or explicitly by the user by calling release() + /// on these objects. It is recommended to always remove all objects that reference actors before the actors + /// themselves are removed. It is not possible to retrieve list of dead connected objects. + /// + /// Sleeping: + /// This call will awaken any sleeping actors contacting the deleted actor (directly or indirectly). + /// + /// Calls [`PxActor::release`]() so you might want to check the documentation of that method as well. + pub fn PxRigidActor_release_mut(self_: *mut PxRigidActor); + + /// Returns the internal actor index. + /// + /// This is only defined for actors that have been added to a scene. + /// + /// The internal actor index, or 0xffffffff if the actor is not part of a scene. + pub fn PxRigidActor_getInternalActorIndex(self_: *const PxRigidActor) -> u32; + + /// Retrieves the actors world space transform. + /// + /// The getGlobalPose() method retrieves the actor's current actor space to world space transformation. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// Global pose of object. + pub fn PxRigidActor_getGlobalPose(self_: *const PxRigidActor) -> PxTransform; + + /// Method for setting an actor's pose in the world. + /// + /// This method instantaneously changes the actor space to world space transformation. + /// + /// This method is mainly for dynamic rigid bodies (see [`PxRigidDynamic`]). Calling this method on static actors is + /// likely to result in a performance penalty, since internal optimization structures for static actors may need to be + /// recomputed. In addition, moving static actors will not interact correctly with dynamic actors or joints. + /// + /// To directly control an actor's position and have it correctly interact with dynamic bodies and joints, create a dynamic + /// body with the PxRigidBodyFlag::eKINEMATIC flag, then use the setKinematicTarget() commands to define its path. + /// + /// Even when moving dynamic actors, exercise restraint in making use of this method. Where possible, avoid: + /// + /// moving actors into other actors, thus causing overlap (an invalid physical state) + /// + /// moving an actor that is connected by a joint to another away from the other (thus causing joint error) + /// + /// Sleeping: + /// This call wakes dynamic actors if they are sleeping and the autowake parameter is true (default). + pub fn PxRigidActor_setGlobalPose_mut(self_: *mut PxRigidActor, pose: *const PxTransform, autowake: bool); + + /// Attach a shape to an actor + /// + /// This call will increment the reference count of the shape. + /// + /// Mass properties of dynamic rigid actors will not automatically be recomputed + /// to reflect the new mass distribution implied by the shape. Follow this call with a call to + /// the PhysX extensions method [`PxRigidBodyExt::updateMassAndInertia`]() to do that. + /// + /// Attaching a triangle mesh, heightfield or plane geometry shape configured as eSIMULATION_SHAPE is not supported for + /// non-kinematic PxRigidDynamic instances. + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + /// + /// True if success. + pub fn PxRigidActor_attachShape_mut(self_: *mut PxRigidActor, shape: *mut PxShape) -> bool; + + /// Detach a shape from an actor. + /// + /// This will also decrement the reference count of the PxShape, and if the reference count is zero, will cause it to be deleted. + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxRigidActor_detachShape_mut(self_: *mut PxRigidActor, shape: *mut PxShape, wakeOnLostTouch: bool); + + /// Returns the number of shapes assigned to the actor. + /// + /// You can use [`getShapes`]() to retrieve the shape pointers. + /// + /// Number of shapes associated with this actor. + pub fn PxRigidActor_getNbShapes(self_: *const PxRigidActor) -> u32; + + /// Retrieve all the shape pointers belonging to the actor. + /// + /// These are the shapes used by the actor for collision detection. + /// + /// You can retrieve the number of shape pointers by calling [`getNbShapes`]() + /// + /// Note: Removing shapes with [`PxShape::release`]() will invalidate the pointer of the released shape. + /// + /// Number of shape pointers written to the buffer. + pub fn PxRigidActor_getShapes(self_: *const PxRigidActor, userBuffer: *mut *mut PxShape, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of constraint shaders attached to the actor. + /// + /// You can use [`getConstraints`]() to retrieve the constraint shader pointers. + /// + /// Number of constraint shaders attached to this actor. + pub fn PxRigidActor_getNbConstraints(self_: *const PxRigidActor) -> u32; + + /// Retrieve all the constraint shader pointers belonging to the actor. + /// + /// You can retrieve the number of constraint shader pointers by calling [`getNbConstraints`]() + /// + /// Note: Removing constraint shaders with [`PxConstraint::release`]() will invalidate the pointer of the released constraint. + /// + /// Number of constraint shader pointers written to the buffer. + pub fn PxRigidActor_getConstraints(self_: *const PxRigidActor, userBuffer: *mut *mut PxConstraint, bufferSize: u32, startIndex: u32) -> u32; + + pub fn PxNodeIndex_new(id: u32, articLinkId: u32) -> PxNodeIndex; + + pub fn PxNodeIndex_new_1(id: u32) -> PxNodeIndex; + + pub fn PxNodeIndex_index(self_: *const PxNodeIndex) -> u32; + + pub fn PxNodeIndex_articulationLinkId(self_: *const PxNodeIndex) -> u32; + + pub fn PxNodeIndex_isArticulation(self_: *const PxNodeIndex) -> u32; + + pub fn PxNodeIndex_isStaticBody(self_: *const PxNodeIndex) -> bool; + + pub fn PxNodeIndex_isValid(self_: *const PxNodeIndex) -> bool; + + pub fn PxNodeIndex_setIndices_mut(self_: *mut PxNodeIndex, index: u32, articLinkId: u32); + + pub fn PxNodeIndex_setIndices_mut_1(self_: *mut PxNodeIndex, index: u32); + + pub fn PxNodeIndex_getInd(self_: *const PxNodeIndex) -> u64; + + /// Sets the pose of the center of mass relative to the actor. + /// + /// Changing this transform will not move the actor in the world! + /// + /// Setting an unrealistic center of mass which is a long way from the body can make it difficult for + /// the SDK to solve constraints. Perhaps leading to instability and jittering bodies. + /// + /// Default: + /// the identity transform + pub fn PxRigidBody_setCMassLocalPose_mut(self_: *mut PxRigidBody, pose: *const PxTransform); + + /// Retrieves the center of mass pose relative to the actor frame. + /// + /// The center of mass pose relative to the actor frame. + pub fn PxRigidBody_getCMassLocalPose(self_: *const PxRigidBody) -> PxTransform; + + /// Sets the mass of a dynamic actor. + /// + /// The mass must be non-negative. + /// + /// setMass() does not update the inertial properties of the body, to change the inertia tensor + /// use setMassSpaceInertiaTensor() or the PhysX extensions method [`PxRigidBodyExt::updateMassAndInertia`](). + /// + /// A value of 0 is interpreted as infinite mass. + /// + /// Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + /// + /// Default: + /// 1.0 + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxRigidBody_setMass_mut(self_: *mut PxRigidBody, mass: f32); + + /// Retrieves the mass of the actor. + /// + /// A value of 0 is interpreted as infinite mass. + /// + /// The mass of this actor. + pub fn PxRigidBody_getMass(self_: *const PxRigidBody) -> f32; + + /// Retrieves the inverse mass of the actor. + /// + /// The inverse mass of this actor. + pub fn PxRigidBody_getInvMass(self_: *const PxRigidBody) -> f32; + + /// Sets the inertia tensor, using a parameter specified in mass space coordinates. + /// + /// Note that such matrices are diagonal -- the passed vector is the diagonal. + /// + /// If you have a non diagonal world/actor space inertia tensor(3x3 matrix). Then you need to + /// diagonalize it and set an appropriate mass space transform. See [`setCMassLocalPose`](). + /// + /// The inertia tensor elements must be non-negative. + /// + /// A value of 0 in an element is interpreted as infinite inertia along that axis. + /// + /// Values of 0 are not permitted for instances of PxArticulationLink but are permitted for instances of PxRigidDynamic. + /// + /// Default: + /// (1.0, 1.0, 1.0) + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxRigidBody_setMassSpaceInertiaTensor_mut(self_: *mut PxRigidBody, m: *const PxVec3); + + /// Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame. + /// + /// This method retrieves a mass frame inertia vector. + /// + /// The mass space inertia tensor of this actor. + /// + /// A value of 0 in an element is interpreted as infinite inertia along that axis. + pub fn PxRigidBody_getMassSpaceInertiaTensor(self_: *const PxRigidBody) -> PxVec3; + + /// Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame. + /// + /// This method retrieves a mass frame inverse inertia vector. + /// + /// A value of 0 in an element is interpreted as infinite inertia along that axis. + /// + /// The mass space inverse inertia tensor of this actor. + pub fn PxRigidBody_getMassSpaceInvInertiaTensor(self_: *const PxRigidBody) -> PxVec3; + + /// Sets the linear damping coefficient. + /// + /// Zero represents no damping. The damping coefficient must be nonnegative. + /// + /// Default: + /// 0.0 + pub fn PxRigidBody_setLinearDamping_mut(self_: *mut PxRigidBody, linDamp: f32); + + /// Retrieves the linear damping coefficient. + /// + /// The linear damping coefficient associated with this actor. + pub fn PxRigidBody_getLinearDamping(self_: *const PxRigidBody) -> f32; + + /// Sets the angular damping coefficient. + /// + /// Zero represents no damping. + /// + /// The angular damping coefficient must be nonnegative. + /// + /// Default: + /// 0.05 + pub fn PxRigidBody_setAngularDamping_mut(self_: *mut PxRigidBody, angDamp: f32); + + /// Retrieves the angular damping coefficient. + /// + /// The angular damping coefficient associated with this actor. + pub fn PxRigidBody_getAngularDamping(self_: *const PxRigidBody) -> f32; + + /// Retrieves the linear velocity of an actor. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// The linear velocity of the actor. + pub fn PxRigidBody_getLinearVelocity(self_: *const PxRigidBody) -> PxVec3; + + /// Retrieves the angular velocity of the actor. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// The angular velocity of the actor. + pub fn PxRigidBody_getAngularVelocity(self_: *const PxRigidBody) -> PxVec3; + + /// Lets you set the maximum linear velocity permitted for this actor. + /// + /// With this function, you can set the maximum linear velocity permitted for this rigid body. + /// Higher angular velocities are clamped to this value. + /// + /// Note: The angular velocity is clamped to the set value + /// before + /// the solver, which means that + /// the limit may still be momentarily exceeded. + /// + /// Default: + /// PX_MAX_F32 + pub fn PxRigidBody_setMaxLinearVelocity_mut(self_: *mut PxRigidBody, maxLinVel: f32); + + /// Retrieves the maximum angular velocity permitted for this actor. + /// + /// The maximum allowed angular velocity for this actor. + pub fn PxRigidBody_getMaxLinearVelocity(self_: *const PxRigidBody) -> f32; + + /// Lets you set the maximum angular velocity permitted for this actor. + /// + /// For various internal computations, very quickly rotating actors introduce error + /// into the simulation, which leads to undesired results. + /// + /// With this function, you can set the maximum angular velocity permitted for this rigid body. + /// Higher angular velocities are clamped to this value. + /// + /// Note: The angular velocity is clamped to the set value + /// before + /// the solver, which means that + /// the limit may still be momentarily exceeded. + /// + /// Default: + /// 100.0 + pub fn PxRigidBody_setMaxAngularVelocity_mut(self_: *mut PxRigidBody, maxAngVel: f32); + + /// Retrieves the maximum angular velocity permitted for this actor. + /// + /// The maximum allowed angular velocity for this actor. + pub fn PxRigidBody_getMaxAngularVelocity(self_: *const PxRigidBody) -> f32; + + /// Applies a force (or impulse) defined in the global coordinate frame to the actor at its center of mass. + /// + /// This will not induce a torque + /// . + /// + /// ::PxForceMode determines if the force is to be conventional or impulsive. + /// + /// Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + /// and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + /// accumulators and are just short hand for multiplying the vector parameter by inverse mass and then using PxForceMode::eACCELERATION and + /// PxForceMode::eVELOCITY_CHANGE respectively. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + /// + /// if this is called on an articulation link, only the link is updated, not the entire articulation. + /// + /// see [`PxRigidBodyExt::computeVelocityDeltaFromImpulse`] for details of how to compute the change in linear velocity that + /// will arise from the application of an impulsive force, where an impulsive force is applied force multiplied by a timestep. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the force is non-zero. + pub fn PxRigidBody_addForce_mut(self_: *mut PxRigidBody, force: *const PxVec3, mode: PxForceMode, autowake: bool); + + /// Applies an impulsive torque defined in the global coordinate frame to the actor. + /// + /// ::PxForceMode determines if the torque is to be conventional or impulsive. + /// + /// Each actor has an angular acceleration and an angular velocity change accumulator which are directly modified using the modes + /// PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE + /// also modify these same accumulators and are just short hand for multiplying the vector parameter by inverse inertia and then + /// using PxForceMode::eACCELERATION and PxForceMode::eVELOCITY_CHANGE respectively. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + /// + /// if this called on an articulation link, only the link is updated, not the entire articulation. + /// + /// see [`PxRigidBodyExt::computeVelocityDeltaFromImpulse`] for details of how to compute the change in angular velocity that + /// will arise from the application of an impulsive torque, where an impulsive torque is an applied torque multiplied by a timestep. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the torque is non-zero. + pub fn PxRigidBody_addTorque_mut(self_: *mut PxRigidBody, torque: *const PxVec3, mode: PxForceMode, autowake: bool); + + /// Clears the accumulated forces (sets the accumulated force back to zero). + /// + /// Each actor has an acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + /// and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + /// accumulators (see PxRigidBody::addForce() for details); therefore the effect of calling clearForce(PxForceMode::eFORCE) is equivalent to calling + /// clearForce(PxForceMode::eACCELERATION), and the effect of calling clearForce(PxForceMode::eIMPULSE) is equivalent to calling + /// clearForce(PxForceMode::eVELOCITY_CHANGE). + /// + /// ::PxForceMode determines if the cleared force is to be conventional or impulsive. + /// + /// The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + pub fn PxRigidBody_clearForce_mut(self_: *mut PxRigidBody, mode: PxForceMode); + + /// Clears the impulsive torque defined in the global coordinate frame to the actor. + /// + /// ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + /// + /// Each actor has an angular acceleration and a velocity change accumulator which are directly modified using the modes PxForceMode::eACCELERATION + /// and PxForceMode::eVELOCITY_CHANGE respectively. The modes PxForceMode::eFORCE and PxForceMode::eIMPULSE also modify these same + /// accumulators (see PxRigidBody::addTorque() for details); therefore the effect of calling clearTorque(PxForceMode::eFORCE) is equivalent to calling + /// clearTorque(PxForceMode::eACCELERATION), and the effect of calling clearTorque(PxForceMode::eIMPULSE) is equivalent to calling + /// clearTorque(PxForceMode::eVELOCITY_CHANGE). + /// + /// The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + pub fn PxRigidBody_clearTorque_mut(self_: *mut PxRigidBody, mode: PxForceMode); + + /// Sets the impulsive force and torque defined in the global coordinate frame to the actor. + /// + /// ::PxForceMode determines if the cleared torque is to be conventional or impulsive. + /// + /// The force modes PxForceMode::eIMPULSE and PxForceMode::eVELOCITY_CHANGE can not be applied to articulation links. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + pub fn PxRigidBody_setForceAndTorque_mut(self_: *mut PxRigidBody, force: *const PxVec3, torque: *const PxVec3, mode: PxForceMode); + + /// Raises or clears a particular rigid body flag. + /// + /// See the list of flags [`PxRigidBodyFlag`] + /// + /// Default: + /// no flags are set + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxRigidBody_setRigidBodyFlag_mut(self_: *mut PxRigidBody, flag: PxRigidBodyFlag, value: bool); + + pub fn PxRigidBody_setRigidBodyFlags_mut(self_: *mut PxRigidBody, inFlags: PxRigidBodyFlags); + + /// Reads the PxRigidBody flags. + /// + /// See the list of flags [`PxRigidBodyFlag`] + /// + /// The values of the PxRigidBody flags. + pub fn PxRigidBody_getRigidBodyFlags(self_: *const PxRigidBody) -> PxRigidBodyFlags; + + /// Sets the CCD minimum advance coefficient. + /// + /// The CCD minimum advance coefficient is a value in the range [0, 1] that is used to control the minimum amount of time a body is integrated when + /// it has a CCD contact. The actual minimum amount of time that is integrated depends on various properties, including the relative speed and collision shapes + /// of the bodies involved in the contact. From these properties, a numeric value is calculated that determines the maximum distance (and therefore maximum time) + /// which these bodies could be integrated forwards that would ensure that these bodies did not pass through each-other. This value is then scaled by CCD minimum advance + /// coefficient to determine the amount of time that will be consumed in the CCD pass. + /// + /// Things to consider: + /// A large value (approaching 1) ensures that the objects will always advance some time. However, larger values increase the chances of objects gently drifting through each-other in + /// scenes which the constraint solver can't converge, e.g. scenes where an object is being dragged through a wall with a constraint. + /// A value of 0 ensures that the pair of objects stop at the exact time-of-impact and will not gently drift through each-other. However, with very small/thin objects initially in + /// contact, this can lead to a large amount of time being dropped and increases the chances of jamming. Jamming occurs when the an object is persistently in contact with an object + /// such that the time-of-impact is 0, which results in no time being advanced for those objects in that CCD pass. + /// + /// The chances of jamming can be reduced by increasing the number of CCD mass + pub fn PxRigidBody_setMinCCDAdvanceCoefficient_mut(self_: *mut PxRigidBody, advanceCoefficient: f32); + + /// Gets the CCD minimum advance coefficient. + /// + /// The value of the CCD min advance coefficient. + pub fn PxRigidBody_getMinCCDAdvanceCoefficient(self_: *const PxRigidBody) -> f32; + + /// Sets the maximum depenetration velocity permitted to be introduced by the solver. + /// This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + pub fn PxRigidBody_setMaxDepenetrationVelocity_mut(self_: *mut PxRigidBody, biasClamp: f32); + + /// Returns the maximum depenetration velocity the solver is permitted to introduced. + /// This value controls how much velocity the solver can introduce to correct for penetrations in contacts. + /// + /// The maximum penetration bias applied by the solver. + pub fn PxRigidBody_getMaxDepenetrationVelocity(self_: *const PxRigidBody) -> f32; + + /// Sets a limit on the impulse that may be applied at a contact. The maximum impulse at a contact between two dynamic or kinematic + /// bodies will be the minimum of the two limit values. For a collision between a static and a dynamic body, the impulse is limited + /// by the value for the dynamic body. + pub fn PxRigidBody_setMaxContactImpulse_mut(self_: *mut PxRigidBody, maxImpulse: f32); + + /// Returns the maximum impulse that may be applied at a contact. + /// + /// The maximum impulse that may be applied at a contact + pub fn PxRigidBody_getMaxContactImpulse(self_: *const PxRigidBody) -> f32; + + /// Sets a distance scale whereby the angular influence of a contact on the normal constraint in a contact is + /// zeroed if normal.cross(offset) falls below this tolerance. Rather than acting as an absolute value, this tolerance + /// is scaled by the ratio rXn.dot(angVel)/normal.dot(linVel) such that contacts that have relatively larger angular velocity + /// than linear normal velocity (e.g. rolling wheels) achieve larger slop values as the angular velocity increases. + pub fn PxRigidBody_setContactSlopCoefficient_mut(self_: *mut PxRigidBody, slopCoefficient: f32); + + /// Returns the contact slop coefficient. + /// + /// The contact slop coefficient. + pub fn PxRigidBody_getContactSlopCoefficient(self_: *const PxRigidBody) -> f32; + + /// Returns the island node index + /// + /// The island node index. + pub fn PxRigidBody_getInternalIslandNodeIndex(self_: *const PxRigidBody) -> PxNodeIndex; + + /// Releases the link from the articulation. + /// + /// Only a leaf articulation link can be released. + /// + /// Releasing a link is not allowed while the articulation link is in a scene. In order to release a link, + /// remove and then re-add the corresponding articulation to the scene. + pub fn PxArticulationLink_release_mut(self_: *mut PxArticulationLink); + + /// Gets the articulation that the link is a part of. + /// + /// The articulation. + pub fn PxArticulationLink_getArticulation(self_: *const PxArticulationLink) -> *mut PxArticulationReducedCoordinate; + + /// Gets the joint which connects this link to its parent. + /// + /// The joint connecting the link to the parent. NULL for the root link. + pub fn PxArticulationLink_getInboundJoint(self_: *const PxArticulationLink) -> *mut PxArticulationJointReducedCoordinate; + + /// Gets the number of degrees of freedom of the joint which connects this link to its parent. + /// + /// - The root link DOF-count is defined to be 0 regardless of PxArticulationFlag::eFIX_BASE. + /// - The return value is only valid for articulations that are in a scene. + /// + /// The number of degrees of freedom, or 0xFFFFFFFF if the articulation is not in a scene. + pub fn PxArticulationLink_getInboundJointDof(self_: *const PxArticulationLink) -> u32; + + /// Gets the number of child links. + /// + /// The number of child links. + pub fn PxArticulationLink_getNbChildren(self_: *const PxArticulationLink) -> u32; + + /// Gets the low-level link index that may be used to index into members of PxArticulationCache. + /// + /// The return value is only valid for articulations that are in a scene. + /// + /// The low-level index, or 0xFFFFFFFF if the articulation is not in a scene. + pub fn PxArticulationLink_getLinkIndex(self_: *const PxArticulationLink) -> u32; + + /// Retrieves the child links. + /// + /// The number of articulation links written to the buffer. + pub fn PxArticulationLink_getChildren(self_: *const PxArticulationLink, userBuffer: *mut *mut PxArticulationLink, bufferSize: u32, startIndex: u32) -> u32; + + /// Set the constraint-force-mixing scale term. + /// + /// The cfm scale term is a stabilization term that helps avoid instabilities with over-constrained + /// configurations. It should be a small value that is multiplied by 1/mass internally to produce + /// an additional bias added to the unit response term in the solver. + /// + /// Default: + /// 0.025 + /// Range: + /// [0, 1] + /// + /// This call is not allowed while the simulation is running. + pub fn PxArticulationLink_setCfmScale_mut(self_: *mut PxArticulationLink, cfm: f32); + + /// Get the constraint-force-mixing scale term. + /// + /// The constraint-force-mixing scale term. + pub fn PxArticulationLink_getCfmScale(self_: *const PxArticulationLink) -> f32; + + /// Get the linear velocity of the link. + /// + /// - The linear velocity is with respect to the link's center of mass and not the actor frame origin. + /// - For performance, prefer PxArticulationCache::linkVelocity to get link spatial velocities in a batch query. + /// - When the articulation state is updated via non-cache API, use PxArticulationReducedCoordinate::updateKinematic before querying velocity. + /// + /// The linear velocity of the link. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationLink_getLinearVelocity(self_: *const PxArticulationLink) -> PxVec3; + + /// Get the angular velocity of the link. + /// + /// - For performance, prefer PxArticulationCache::linkVelocity to get link spatial velocities in a batch query. + /// - When the articulation state is updated via non-cache API, use PxArticulationReducedCoordinate::updateKinematic before querying velocity. + /// + /// The angular velocity of the link. + /// + /// This call is not allowed while the simulation is running except in a split simulation during [`PxScene::collide`]() and up to #PxScene::advance(), + /// and in PxContactModifyCallback or in contact report callbacks. + pub fn PxArticulationLink_getAngularVelocity(self_: *const PxArticulationLink) -> PxVec3; + + /// Returns the string name of the dynamic type. + /// + /// The string name. + pub fn PxArticulationLink_getConcreteTypeName(self_: *const PxArticulationLink) -> *const std::ffi::c_char; + + pub fn PxConeLimitedConstraint_new() -> PxConeLimitedConstraint; + + /// Releases a PxConstraint instance. + /// + /// This call does not wake up the connected rigid bodies. + pub fn PxConstraint_release_mut(self_: *mut PxConstraint); + + /// Retrieves the scene which this constraint belongs to. + /// + /// Owner Scene. NULL if not part of a scene. + pub fn PxConstraint_getScene(self_: *const PxConstraint) -> *mut PxScene; + + /// Retrieves the actors for this constraint. + pub fn PxConstraint_getActors(self_: *const PxConstraint, actor0: *mut *mut PxRigidActor, actor1: *mut *mut PxRigidActor); + + /// Sets the actors for this constraint. + pub fn PxConstraint_setActors_mut(self_: *mut PxConstraint, actor0: *mut PxRigidActor, actor1: *mut PxRigidActor); + + /// Notify the scene that the constraint shader data has been updated by the application + pub fn PxConstraint_markDirty_mut(self_: *mut PxConstraint); + + /// Retrieve the flags for this constraint + /// + /// the constraint flags + pub fn PxConstraint_getFlags(self_: *const PxConstraint) -> PxConstraintFlags; + + /// Set the flags for this constraint + /// + /// default: PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + pub fn PxConstraint_setFlags_mut(self_: *mut PxConstraint, flags: PxConstraintFlags); + + /// Set a flag for this constraint + pub fn PxConstraint_setFlag_mut(self_: *mut PxConstraint, flag: PxConstraintFlag, value: bool); + + /// Retrieve the constraint force most recently applied to maintain this constraint. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + pub fn PxConstraint_getForce(self_: *const PxConstraint, linear: *mut PxVec3, angular: *mut PxVec3); + + /// whether the constraint is valid. + /// + /// A constraint is valid if it has at least one dynamic rigid body or articulation link. A constraint that + /// is not valid may not be inserted into a scene, and therefore a static actor to which an invalid constraint + /// is attached may not be inserted into a scene. + /// + /// Invalid constraints arise only when an actor to which the constraint is attached has been deleted. + pub fn PxConstraint_isValid(self_: *const PxConstraint) -> bool; + + /// Set the break force and torque thresholds for this constraint. + /// + /// If either the force or torque measured at the constraint exceed these thresholds the constraint will break. + pub fn PxConstraint_setBreakForce_mut(self_: *mut PxConstraint, linear: f32, angular: f32); + + /// Retrieve the constraint break force and torque thresholds + pub fn PxConstraint_getBreakForce(self_: *const PxConstraint, linear: *mut f32, angular: *mut f32); + + /// Set the minimum response threshold for a constraint row + /// + /// When using mass modification for a joint or infinite inertia for a jointed body, very stiff solver constraints can be generated which + /// can destabilize simulation. Setting this value to a small positive value (e.g. 1e-8) will cause constraint rows to be ignored if very + /// large changes in impulses will generate only small changes in velocity. When setting this value, also set + /// PxConstraintFlag::eDISABLE_PREPROCESSING. The solver accuracy for this joint may be reduced. + pub fn PxConstraint_setMinResponseThreshold_mut(self_: *mut PxConstraint, threshold: f32); + + /// Retrieve the constraint break force and torque thresholds + /// + /// the minimum response threshold for a constraint row + pub fn PxConstraint_getMinResponseThreshold(self_: *const PxConstraint) -> f32; + + /// Fetch external owner of the constraint. + /// + /// Provides a reference to the external owner of a constraint and a unique owner type ID. + /// + /// Reference to the external object which owns the constraint. + pub fn PxConstraint_getExternalReference_mut(self_: *mut PxConstraint, typeID: *mut u32) -> *mut std::ffi::c_void; + + /// Set the constraint functions for this constraint + pub fn PxConstraint_setConstraintFunctions_mut(self_: *mut PxConstraint, connector: *mut PxConstraintConnector, shaders: *const PxConstraintShaderTable); + + pub fn PxConstraint_getConcreteTypeName(self_: *const PxConstraint) -> *const std::ffi::c_char; + + /// Constructor + pub fn PxContactStreamIterator_new(contactPatches: *const u8, contactPoints: *const u8, contactFaceIndices: *const u32, nbPatches: u32, nbContacts: u32) -> PxContactStreamIterator; + + /// Returns whether there are more patches in this stream. + /// + /// Whether there are more patches in this stream. + pub fn PxContactStreamIterator_hasNextPatch(self_: *const PxContactStreamIterator) -> bool; + + /// Returns the total contact count. + /// + /// Total contact count. + pub fn PxContactStreamIterator_getTotalContactCount(self_: *const PxContactStreamIterator) -> u32; + + /// Returns the total patch count. + /// + /// Total patch count. + pub fn PxContactStreamIterator_getTotalPatchCount(self_: *const PxContactStreamIterator) -> u32; + + /// Advances iterator to next contact patch. + pub fn PxContactStreamIterator_nextPatch_mut(self_: *mut PxContactStreamIterator); + + /// Returns if the current patch has more contacts. + /// + /// If there are more contacts in the current patch. + pub fn PxContactStreamIterator_hasNextContact(self_: *const PxContactStreamIterator) -> bool; + + /// Advances to the next contact in the patch. + pub fn PxContactStreamIterator_nextContact_mut(self_: *mut PxContactStreamIterator); + + /// Gets the current contact's normal + /// + /// The current contact's normal. + pub fn PxContactStreamIterator_getContactNormal(self_: *const PxContactStreamIterator) -> *const PxVec3; + + /// Gets the inverse mass scale for body 0. + /// + /// The inverse mass scale for body 0. + pub fn PxContactStreamIterator_getInvMassScale0(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the inverse mass scale for body 1. + /// + /// The inverse mass scale for body 1. + pub fn PxContactStreamIterator_getInvMassScale1(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the inverse inertia scale for body 0. + /// + /// The inverse inertia scale for body 0. + pub fn PxContactStreamIterator_getInvInertiaScale0(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the inverse inertia scale for body 1. + /// + /// The inverse inertia scale for body 1. + pub fn PxContactStreamIterator_getInvInertiaScale1(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's max impulse. + /// + /// The contact's max impulse. + pub fn PxContactStreamIterator_getMaxImpulse(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's target velocity. + /// + /// The contact's target velocity. + pub fn PxContactStreamIterator_getTargetVel(self_: *const PxContactStreamIterator) -> *const PxVec3; + + /// Gets the contact's contact point. + /// + /// The contact's contact point. + pub fn PxContactStreamIterator_getContactPoint(self_: *const PxContactStreamIterator) -> *const PxVec3; + + /// Gets the contact's separation. + /// + /// The contact's separation. + pub fn PxContactStreamIterator_getSeparation(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's face index for shape 0. + /// + /// The contact's face index for shape 0. + pub fn PxContactStreamIterator_getFaceIndex0(self_: *const PxContactStreamIterator) -> u32; + + /// Gets the contact's face index for shape 1. + /// + /// The contact's face index for shape 1. + pub fn PxContactStreamIterator_getFaceIndex1(self_: *const PxContactStreamIterator) -> u32; + + /// Gets the contact's static friction coefficient. + /// + /// The contact's static friction coefficient. + pub fn PxContactStreamIterator_getStaticFriction(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's dynamic friction coefficient. + /// + /// The contact's dynamic friction coefficient. + pub fn PxContactStreamIterator_getDynamicFriction(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's restitution coefficient. + /// + /// The contact's restitution coefficient. + pub fn PxContactStreamIterator_getRestitution(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's damping value. + /// + /// The contact's damping value. + pub fn PxContactStreamIterator_getDamping(self_: *const PxContactStreamIterator) -> f32; + + /// Gets the contact's material flags. + /// + /// The contact's material flags. + pub fn PxContactStreamIterator_getMaterialFlags(self_: *const PxContactStreamIterator) -> u32; + + /// Gets the contact's material index for shape 0. + /// + /// The contact's material index for shape 0. + pub fn PxContactStreamIterator_getMaterialIndex0(self_: *const PxContactStreamIterator) -> u16; + + /// Gets the contact's material index for shape 1. + /// + /// The contact's material index for shape 1. + pub fn PxContactStreamIterator_getMaterialIndex1(self_: *const PxContactStreamIterator) -> u16; + + /// Advances the contact stream iterator to a specific contact index. + /// + /// True if advancing was possible + pub fn PxContactStreamIterator_advanceToIndex_mut(self_: *mut PxContactStreamIterator, initialIndex: u32) -> bool; + + /// Get the position of a specific contact point in the set. + /// + /// Position to the requested point in world space + pub fn PxContactSet_getPoint(self_: *const PxContactSet, i: u32) -> *const PxVec3; + + /// Alter the position of a specific contact point in the set. + pub fn PxContactSet_setPoint_mut(self_: *mut PxContactSet, i: u32, p: *const PxVec3); + + /// Get the contact normal of a specific contact point in the set. + /// + /// The requested normal in world space + pub fn PxContactSet_getNormal(self_: *const PxContactSet, i: u32) -> *const PxVec3; + + /// Alter the contact normal of a specific contact point in the set. + /// + /// Changing the normal can cause contact points to be ignored. + pub fn PxContactSet_setNormal_mut(self_: *mut PxContactSet, i: u32, n: *const PxVec3); + + /// Get the separation distance of a specific contact point in the set. + /// + /// The separation. Negative implies penetration. + pub fn PxContactSet_getSeparation(self_: *const PxContactSet, i: u32) -> f32; + + /// Alter the separation of a specific contact point in the set. + pub fn PxContactSet_setSeparation_mut(self_: *mut PxContactSet, i: u32, s: f32); + + /// Get the target velocity of a specific contact point in the set. + /// + /// The target velocity in world frame + pub fn PxContactSet_getTargetVelocity(self_: *const PxContactSet, i: u32) -> *const PxVec3; + + /// Alter the target velocity of a specific contact point in the set. + pub fn PxContactSet_setTargetVelocity_mut(self_: *mut PxContactSet, i: u32, v: *const PxVec3); + + /// Get the face index with respect to the first shape of the pair for a specific contact point in the set. + /// + /// The face index of the first shape + /// + /// At the moment, the first shape is never a tri-mesh, therefore this function always returns PXC_CONTACT_NO_FACE_INDEX + pub fn PxContactSet_getInternalFaceIndex0(self_: *const PxContactSet, i: u32) -> u32; + + /// Get the face index with respect to the second shape of the pair for a specific contact point in the set. + /// + /// The face index of the second shape + pub fn PxContactSet_getInternalFaceIndex1(self_: *const PxContactSet, i: u32) -> u32; + + /// Get the maximum impulse for a specific contact point in the set. + /// + /// The maximum impulse + pub fn PxContactSet_getMaxImpulse(self_: *const PxContactSet, i: u32) -> f32; + + /// Alter the maximum impulse for a specific contact point in the set. + /// + /// Must be nonnegative. If set to zero, the contact point will be ignored + pub fn PxContactSet_setMaxImpulse_mut(self_: *mut PxContactSet, i: u32, s: f32); + + /// Get the restitution coefficient for a specific contact point in the set. + /// + /// The restitution coefficient + pub fn PxContactSet_getRestitution(self_: *const PxContactSet, i: u32) -> f32; + + /// Alter the restitution coefficient for a specific contact point in the set. + /// + /// Valid ranges [0,1] + pub fn PxContactSet_setRestitution_mut(self_: *mut PxContactSet, i: u32, r: f32); + + /// Get the static friction coefficient for a specific contact point in the set. + /// + /// The friction coefficient (dimensionless) + pub fn PxContactSet_getStaticFriction(self_: *const PxContactSet, i: u32) -> f32; + + /// Alter the static friction coefficient for a specific contact point in the set. + pub fn PxContactSet_setStaticFriction_mut(self_: *mut PxContactSet, i: u32, f: f32); + + /// Get the static friction coefficient for a specific contact point in the set. + /// + /// The friction coefficient + pub fn PxContactSet_getDynamicFriction(self_: *const PxContactSet, i: u32) -> f32; + + /// Alter the static dynamic coefficient for a specific contact point in the set. + pub fn PxContactSet_setDynamicFriction_mut(self_: *mut PxContactSet, i: u32, f: f32); + + /// Ignore the contact point. + /// + /// If a contact point is ignored then no force will get applied at this point. This can be used to disable collision in certain areas of a shape, for example. + pub fn PxContactSet_ignore_mut(self_: *mut PxContactSet, i: u32); + + /// The number of contact points in the set. + pub fn PxContactSet_size(self_: *const PxContactSet) -> u32; + + /// Returns the invMassScale of body 0 + /// + /// A value + /// < + /// 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + /// treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + pub fn PxContactSet_getInvMassScale0(self_: *const PxContactSet) -> f32; + + /// Returns the invMassScale of body 1 + /// + /// A value + /// < + /// 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + /// treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + pub fn PxContactSet_getInvMassScale1(self_: *const PxContactSet) -> f32; + + /// Returns the invInertiaScale of body 0 + /// + /// A value + /// < + /// 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + /// treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + pub fn PxContactSet_getInvInertiaScale0(self_: *const PxContactSet) -> f32; + + /// Returns the invInertiaScale of body 1 + /// + /// A value + /// < + /// 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + /// treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + pub fn PxContactSet_getInvInertiaScale1(self_: *const PxContactSet) -> f32; + + /// Sets the invMassScale of body 0 + /// + /// This can be set to any value in the range [0, PX_MAX_F32). A value + /// < + /// 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + /// treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + pub fn PxContactSet_setInvMassScale0_mut(self_: *mut PxContactSet, scale: f32); + + /// Sets the invMassScale of body 1 + /// + /// This can be set to any value in the range [0, PX_MAX_F32). A value + /// < + /// 1.0 makes this contact treat the body as if it had larger mass. A value of 0.f makes this contact + /// treat the body as if it had infinite mass. Any value > 1.f makes this contact treat the body as if it had smaller mass. + pub fn PxContactSet_setInvMassScale1_mut(self_: *mut PxContactSet, scale: f32); + + /// Sets the invInertiaScale of body 0 + /// + /// This can be set to any value in the range [0, PX_MAX_F32). A value + /// < + /// 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + /// treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + pub fn PxContactSet_setInvInertiaScale0_mut(self_: *mut PxContactSet, scale: f32); + + /// Sets the invInertiaScale of body 1 + /// + /// This can be set to any value in the range [0, PX_MAX_F32). A value + /// < + /// 1.0 makes this contact treat the body as if it had larger inertia. A value of 0.f makes this contact + /// treat the body as if it had infinite inertia. Any value > 1.f makes this contact treat the body as if it had smaller inertia. + pub fn PxContactSet_setInvInertiaScale1_mut(self_: *mut PxContactSet, scale: f32); + + /// Passes modifiable arrays of contacts to the application. + /// + /// The initial contacts are regenerated from scratch each frame by collision detection. + /// + /// The number of contacts can not be changed, so you cannot add your own contacts. You may however + /// disable contacts using PxContactSet::ignore(). + pub fn PxContactModifyCallback_onContactModify_mut(self_: *mut PxContactModifyCallback, pairs: *mut PxContactModifyPair, count: u32); + + /// Passes modifiable arrays of contacts to the application. + /// + /// The initial contacts are regenerated from scratch each frame by collision detection. + /// + /// The number of contacts can not be changed, so you cannot add your own contacts. You may however + /// disable contacts using PxContactSet::ignore(). + pub fn PxCCDContactModifyCallback_onCCDContactModify_mut(self_: *mut PxCCDContactModifyCallback, pairs: *mut PxContactModifyPair, count: u32); + + /// Notification if an object or its memory gets released + /// + /// If release() gets called on a PxBase object, an eUSER_RELEASE event will get fired immediately. The object state can be queried in the callback but + /// it is not allowed to change the state. Furthermore, when reading from the object it is the user's responsibility to make sure that no other thread + /// is writing at the same time to the object (this includes the simulation itself, i.e., [`PxScene::fetchResults`]() must not get called at the same time). + /// + /// Calling release() on a PxBase object does not necessarily trigger its destructor immediately. For example, the object can be shared and might still + /// be referenced by other objects or the simulation might still be running and accessing the object state. In such cases the destructor will be called + /// as soon as it is safe to do so. After the destruction of the object and its memory, an eMEMORY_RELEASE event will get fired. In this case it is not + /// allowed to dereference the object pointer in the callback. + pub fn PxDeletionListener_onRelease_mut(self_: *mut PxDeletionListener, observed: *const PxBase, userData: *mut std::ffi::c_void, deletionEvent: PxDeletionEventFlag); + + pub fn PxBaseMaterial_isKindOf(self_: *const PxBaseMaterial, name: *const std::ffi::c_char) -> bool; + + /// Sets young's modulus which defines the body's stiffness + pub fn PxFEMMaterial_setYoungsModulus_mut(self_: *mut PxFEMMaterial, young: f32); + + /// Retrieves the young's modulus value. + /// + /// The young's modulus value. + pub fn PxFEMMaterial_getYoungsModulus(self_: *const PxFEMMaterial) -> f32; + + /// Sets the Poisson's ratio which defines the body's volume preservation. Completely incompressible materials have a poisson ratio of 0.5. Its value should not be set to exactly 0.5 because this leads to numerical problems. + pub fn PxFEMMaterial_setPoissons_mut(self_: *mut PxFEMMaterial, poisson: f32); + + /// Retrieves the Poisson's ratio. + /// + /// The Poisson's ratio. + pub fn PxFEMMaterial_getPoissons(self_: *const PxFEMMaterial) -> f32; + + /// Sets the dynamic friction value which defines the strength of resistance when two objects slide relative to each other while in contact. + pub fn PxFEMMaterial_setDynamicFriction_mut(self_: *mut PxFEMMaterial, dynamicFriction: f32); + + /// Retrieves the dynamic friction value + /// + /// The dynamic friction value + pub fn PxFEMMaterial_getDynamicFriction(self_: *const PxFEMMaterial) -> f32; + + 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); + + /// Extract filter object type from the filter attributes of a collision pair object + /// + /// The type of the collision pair object. + pub fn phys_PxGetFilterObjectType(attr: u32) -> PxFilterObjectType; + + /// Specifies whether the collision object belongs to a kinematic rigid body + /// + /// True if the object belongs to a kinematic rigid body, else false + pub fn phys_PxFilterObjectIsKinematic(attr: u32) -> bool; + + /// Specifies whether the collision object is a trigger shape + /// + /// True if the object is a trigger shape, else false + pub fn phys_PxFilterObjectIsTrigger(attr: u32) -> bool; + + /// Filter method to specify how a pair of potentially colliding objects should be processed. + /// + /// This method gets called when the filter flags returned by the filter shader (see [`PxSimulationFilterShader`]) + /// indicate that the filter callback should be invoked ([`PxFilterFlag::eCALLBACK`] or #PxFilterFlag::eNOTIFY set). + /// Return the PxFilterFlag flags and set the PxPairFlag flags to define what the simulation should do with the given + /// collision pair. + /// + /// Filter flags defining whether the pair should be discarded, temporarily ignored or processed and whether the pair + /// should be tracked and send a report on pair deletion through the filter callback + pub fn PxSimulationFilterCallback_pairFound_mut(self_: *mut PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, a0: *const PxActor, s0: *const PxShape, attributes1: u32, filterData1: PxFilterData, a1: *const PxActor, s1: *const PxShape, pairFlags: *mut PxPairFlags) -> PxFilterFlags; + + /// Callback to inform that a tracked collision pair is gone. + /// + /// This method gets called when a collision pair disappears or gets re-filtered. Only applies to + /// collision pairs which have been marked as filter callback pairs ([`PxFilterFlag::eNOTIFY`] set in #pairFound()). + pub fn PxSimulationFilterCallback_pairLost_mut(self_: *mut PxSimulationFilterCallback, pairID: u32, attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, objectRemoved: bool); + + /// Callback to give the opportunity to change the filter state of a tracked collision pair. + /// + /// This method gets called once per simulation step to let the application change the filter and pair + /// flags of a collision pair that has been reported in [`pairFound`]() and requested callbacks by + /// setting [`PxFilterFlag::eNOTIFY`]. To request a change of filter status, the target pair has to be + /// specified by its ID, the new filter and pair flags have to be provided and the method should return true. + /// + /// If this method changes the filter status of a collision pair and the pair should keep being tracked + /// by the filter callbacks then [`PxFilterFlag::eNOTIFY`] has to be set. + /// + /// The application is responsible to ensure that this method does not get called for pairs that have been + /// reported as lost, see [`pairLost`](). + /// + /// True if the changes should be applied. In this case the method will get called again. False if + /// no more status changes should be done in the current simulation step. In that case the provided flags will be discarded. + pub fn PxSimulationFilterCallback_statusChange_mut(self_: *mut PxSimulationFilterCallback, pairID: *mut u32, pairFlags: *mut PxPairFlags, filterFlags: *mut PxFilterFlags) -> bool; + + /// Any combination of PxDataAccessFlag::eREADABLE and PxDataAccessFlag::eWRITABLE + pub fn PxLockedData_getDataAccessFlags_mut(self_: *mut PxLockedData) -> PxDataAccessFlags; + + /// Unlocks the bulk data. + pub fn PxLockedData_unlock_mut(self_: *mut PxLockedData); + + /// virtual destructor + pub fn PxLockedData_delete(self_: *mut PxLockedData); + + /// Sets the coefficient of dynamic friction. + /// + /// The coefficient of dynamic friction should be in [0, PX_MAX_F32). If set to greater than staticFriction, the effective value of staticFriction will be increased to match. + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setDynamicFriction_mut(self_: *mut PxMaterial, coef: f32); + + /// Retrieves the DynamicFriction value. + /// + /// The coefficient of dynamic friction. + pub fn PxMaterial_getDynamicFriction(self_: *const PxMaterial) -> f32; + + /// Sets the coefficient of static friction + /// + /// The coefficient of static friction should be in the range [0, PX_MAX_F32) + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setStaticFriction_mut(self_: *mut PxMaterial, coef: f32); + + /// Retrieves the coefficient of static friction. + /// + /// The coefficient of static friction. + pub fn PxMaterial_getStaticFriction(self_: *const PxMaterial) -> f32; + + /// Sets the coefficient of restitution + /// + /// A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce. + /// + /// This property is overloaded when PxMaterialFlag::eCOMPLIANT_CONTACT flag is enabled. This permits negative values for restitution to be provided. + /// The negative values are converted into spring stiffness terms for an implicit spring simulated at the contact site, with the spring positional error defined by + /// the contact separation value. Higher stiffness terms produce stiffer springs that behave more like a rigid contact. + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setRestitution_mut(self_: *mut PxMaterial, rest: f32); + + /// Retrieves the coefficient of restitution. + /// + /// See [`setRestitution`]. + /// + /// The coefficient of restitution. + pub fn PxMaterial_getRestitution(self_: *const PxMaterial) -> f32; + + /// Sets the coefficient of damping + /// + /// This property only affects the simulation if PxMaterialFlag::eCOMPLIANT_CONTACT is raised. + /// Damping works together with spring stiffness (set through a negative restitution value). Spring stiffness corrects positional error while + /// damping resists relative velocity. Setting a high damping coefficient can produce spongy contacts. + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setDamping_mut(self_: *mut PxMaterial, damping: f32); + + /// Retrieves the coefficient of damping. + /// + /// See [`setDamping`]. + /// + /// The coefficient of damping. + pub fn PxMaterial_getDamping(self_: *const PxMaterial) -> f32; + + /// Raises or clears a particular material flag. + /// + /// See the list of flags [`PxMaterialFlag`] + /// + /// Default: + /// eIMPROVED_PATCH_FRICTION + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setFlag_mut(self_: *mut PxMaterial, flag: PxMaterialFlag, b: bool); + + /// sets all the material flags. + /// + /// See the list of flags [`PxMaterialFlag`] + /// + /// Default: + /// eIMPROVED_PATCH_FRICTION + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setFlags_mut(self_: *mut PxMaterial, flags: PxMaterialFlags); + + /// Retrieves the flags. See [`PxMaterialFlag`]. + /// + /// The material flags. + pub fn PxMaterial_getFlags(self_: *const PxMaterial) -> PxMaterialFlags; + + /// Sets the friction combine mode. + /// + /// See the enum ::PxCombineMode . + /// + /// Default: + /// PxCombineMode::eAVERAGE + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setFrictionCombineMode_mut(self_: *mut PxMaterial, combMode: PxCombineMode); + + /// Retrieves the friction combine mode. + /// + /// See [`setFrictionCombineMode`]. + /// + /// The friction combine mode for this material. + pub fn PxMaterial_getFrictionCombineMode(self_: *const PxMaterial) -> PxCombineMode; + + /// Sets the restitution combine mode. + /// + /// See the enum ::PxCombineMode . + /// + /// Default: + /// PxCombineMode::eAVERAGE + /// + /// Sleeping: + /// Does + /// NOT + /// wake any actors which may be affected. + pub fn PxMaterial_setRestitutionCombineMode_mut(self_: *mut PxMaterial, combMode: PxCombineMode); + + /// Retrieves the restitution combine mode. + /// + /// See [`setRestitutionCombineMode`]. + /// + /// The coefficient of restitution combine mode for this material. + pub fn PxMaterial_getRestitutionCombineMode(self_: *const PxMaterial) -> PxCombineMode; + + pub fn PxMaterial_getConcreteTypeName(self_: *const PxMaterial) -> *const std::ffi::c_char; + + /// Construct parameters with default values. + pub fn PxDiffuseParticleParams_new() -> PxDiffuseParticleParams; + + /// (re)sets the structure to the default. + pub fn PxDiffuseParticleParams_setToDefault_mut(self_: *mut PxDiffuseParticleParams); + + /// Sets friction + pub fn PxParticleMaterial_setFriction_mut(self_: *mut PxParticleMaterial, friction: f32); + + /// Retrieves the friction value. + /// + /// The friction value. + pub fn PxParticleMaterial_getFriction(self_: *const PxParticleMaterial) -> f32; + + /// Sets velocity damping term + pub fn PxParticleMaterial_setDamping_mut(self_: *mut PxParticleMaterial, damping: f32); + + /// Retrieves the velocity damping term + /// + /// The velocity damping term. + pub fn PxParticleMaterial_getDamping(self_: *const PxParticleMaterial) -> f32; + + /// Sets adhesion term + pub fn PxParticleMaterial_setAdhesion_mut(self_: *mut PxParticleMaterial, adhesion: f32); + + /// Retrieves the adhesion term + /// + /// The adhesion term. + pub fn PxParticleMaterial_getAdhesion(self_: *const PxParticleMaterial) -> f32; + + /// Sets gravity scale term + pub fn PxParticleMaterial_setGravityScale_mut(self_: *mut PxParticleMaterial, scale: f32); + + /// Retrieves the gravity scale term + /// + /// The gravity scale term. + pub fn PxParticleMaterial_getGravityScale(self_: *const PxParticleMaterial) -> f32; + + /// Sets material adhesion radius scale. This is multiplied by the particle rest offset to compute the fall-off distance + /// at which point adhesion ceases to operate. + pub fn PxParticleMaterial_setAdhesionRadiusScale_mut(self_: *mut PxParticleMaterial, scale: f32); + + /// Retrieves the adhesion radius scale. + /// + /// The adhesion radius scale. + pub fn PxParticleMaterial_getAdhesionRadiusScale(self_: *const PxParticleMaterial) -> f32; + + /// Destroys the instance it is called on. + /// + /// Use this release method to destroy an instance of this class. Be sure + /// to not keep a reference to this object after calling release. + /// Avoid release calls while a scene is simulating (in between simulate() and fetchResults() calls). + /// + /// Note that this must be called once for each prior call to PxCreatePhysics, as + /// there is a reference counter. Also note that you mustn't destroy the PxFoundation instance (holding the allocator, error callback etc.) + /// until after the reference count reaches 0 and the SDK is actually removed. + /// + /// Releasing an SDK will also release any objects created through it (scenes, triangle meshes, convex meshes, heightfields, shapes etc.), + /// provided the user hasn't already done so. + /// + /// Releasing the PxPhysics instance is a prerequisite to releasing the PxFoundation instance. + pub fn PxPhysics_release_mut(self_: *mut PxPhysics); + + /// Retrieves the Foundation instance. + /// + /// A reference to the Foundation object. + pub fn PxPhysics_getFoundation_mut(self_: *mut PxPhysics) -> *mut PxFoundation; + + /// Creates an aggregate with the specified maximum size and filtering hint. + /// + /// The previous API used "bool enableSelfCollision" which should now silently evaluates + /// to a PxAggregateType::eGENERIC aggregate with its self-collision bit. + /// + /// Use PxAggregateType::eSTATIC or PxAggregateType::eKINEMATIC for aggregates that will + /// only contain static or kinematic actors. This provides faster filtering when used in + /// combination with PxPairFilteringMode. + /// + /// The new aggregate. + pub fn PxPhysics_createAggregate_mut(self_: *mut PxPhysics, maxActor: u32, maxShape: u32, filterHint: u32) -> *mut PxAggregate; + + /// Returns the simulation tolerance parameters. + /// + /// The current simulation tolerance parameters. + pub fn PxPhysics_getTolerancesScale(self_: *const PxPhysics) -> *const PxTolerancesScale; + + /// Creates a triangle mesh object. + /// + /// This can then be instanced into [`PxShape`] objects. + /// + /// The new triangle mesh. + pub fn PxPhysics_createTriangleMesh_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxTriangleMesh; + + /// Return the number of triangle meshes that currently exist. + /// + /// Number of triangle meshes. + pub fn PxPhysics_getNbTriangleMeshes(self_: *const PxPhysics) -> u32; + + /// Writes the array of triangle mesh pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the triangle meshes in the array is not specified. + /// + /// The number of triangle mesh pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getTriangleMeshes(self_: *const PxPhysics, userBuffer: *mut *mut PxTriangleMesh, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a tetrahedron mesh object. + /// + /// This can then be instanced into [`PxShape`] objects. + /// + /// The new tetrahedron mesh. + pub fn PxPhysics_createTetrahedronMesh_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxTetrahedronMesh; + + /// Creates a softbody mesh object. + /// + /// The new softbody mesh. + pub fn PxPhysics_createSoftBodyMesh_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxSoftBodyMesh; + + /// Return the number of tetrahedron meshes that currently exist. + /// + /// Number of tetrahedron meshes. + pub fn PxPhysics_getNbTetrahedronMeshes(self_: *const PxPhysics) -> u32; + + /// Writes the array of tetrahedron mesh pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the tetrahedron meshes in the array is not specified. + /// + /// The number of tetrahedron mesh pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getTetrahedronMeshes(self_: *const PxPhysics, userBuffer: *mut *mut PxTetrahedronMesh, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a heightfield object from previously cooked stream. + /// + /// This can then be instanced into [`PxShape`] objects. + /// + /// The new heightfield. + pub fn PxPhysics_createHeightField_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxHeightField; + + /// Return the number of heightfields that currently exist. + /// + /// Number of heightfields. + pub fn PxPhysics_getNbHeightFields(self_: *const PxPhysics) -> u32; + + /// Writes the array of heightfield pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the heightfields in the array is not specified. + /// + /// The number of heightfield pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getHeightFields(self_: *const PxPhysics, userBuffer: *mut *mut PxHeightField, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a convex mesh object. + /// + /// This can then be instanced into [`PxShape`] objects. + /// + /// The new convex mesh. + pub fn PxPhysics_createConvexMesh_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxConvexMesh; + + /// Return the number of convex meshes that currently exist. + /// + /// Number of convex meshes. + pub fn PxPhysics_getNbConvexMeshes(self_: *const PxPhysics) -> u32; + + /// Writes the array of convex mesh pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the convex meshes in the array is not specified. + /// + /// The number of convex mesh pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getConvexMeshes(self_: *const PxPhysics, userBuffer: *mut *mut PxConvexMesh, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a bounding volume hierarchy. + /// + /// The new BVH. + pub fn PxPhysics_createBVH_mut(self_: *mut PxPhysics, stream: *mut PxInputStream) -> *mut PxBVH; + + /// Return the number of bounding volume hierarchies that currently exist. + /// + /// Number of bounding volume hierarchies. + pub fn PxPhysics_getNbBVHs(self_: *const PxPhysics) -> u32; + + /// Writes the array of bounding volume hierarchy pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the BVHs in the array is not specified. + /// + /// The number of BVH pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getBVHs(self_: *const PxPhysics, userBuffer: *mut *mut PxBVH, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a scene. + /// + /// Every scene uses a Thread Local Storage slot. This imposes a platform specific limit on the + /// number of scenes that can be created. + /// + /// The new scene object. + pub fn PxPhysics_createScene_mut(self_: *mut PxPhysics, sceneDesc: *const PxSceneDesc) -> *mut PxScene; + + /// Gets number of created scenes. + /// + /// The number of scenes created. + pub fn PxPhysics_getNbScenes(self_: *const PxPhysics) -> u32; + + /// Writes the array of scene pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the scene pointers in the array is not specified. + /// + /// The number of scene pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getScenes(self_: *const PxPhysics, userBuffer: *mut *mut PxScene, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a static rigid actor with the specified pose and all other fields initialized + /// to their default values. + pub fn PxPhysics_createRigidStatic_mut(self_: *mut PxPhysics, pose: *const PxTransform) -> *mut PxRigidStatic; + + /// Creates a dynamic rigid actor with the specified pose and all other fields initialized + /// to their default values. + pub fn PxPhysics_createRigidDynamic_mut(self_: *mut PxPhysics, pose: *const PxTransform) -> *mut PxRigidDynamic; + + /// Creates a pruning structure from actors. + /// + /// Every provided actor needs at least one shape with the eSCENE_QUERY_SHAPE flag set. + /// + /// Both static and dynamic actors can be provided. + /// + /// It is not allowed to pass in actors which are already part of a scene. + /// + /// Articulation links cannot be provided. + /// + /// Pruning structure created from given actors, or NULL if any of the actors did not comply with the above requirements. + pub fn PxPhysics_createPruningStructure_mut(self_: *mut PxPhysics, actors: *const *mut PxRigidActor, nbActors: u32) -> *mut PxPruningStructure; + + /// Creates a shape which may be attached to multiple actors + /// + /// The shape will be created with a reference count of 1. + /// + /// The shape + /// + /// Shared shapes are not mutable when they are attached to an actor + pub fn PxPhysics_createShape_mut(self_: *mut PxPhysics, geometry: *const PxGeometry, material: *const PxMaterial, isExclusive: bool, shapeFlags: PxShapeFlags) -> *mut PxShape; + + /// Creates a shape which may be attached to multiple actors + /// + /// The shape will be created with a reference count of 1. + /// + /// The shape + /// + /// Shared shapes are not mutable when they are attached to an actor + /// + /// Shapes created from *SDF* triangle-mesh geometries do not support more than one material. + pub fn PxPhysics_createShape_mut_1(self_: *mut PxPhysics, geometry: *const PxGeometry, materials: *const *mut PxMaterial, materialCount: u16, isExclusive: bool, shapeFlags: PxShapeFlags) -> *mut PxShape; + + /// Return the number of shapes that currently exist. + /// + /// Number of shapes. + pub fn PxPhysics_getNbShapes(self_: *const PxPhysics) -> u32; + + /// Writes the array of shape pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the shapes in the array is not specified. + /// + /// The number of shape pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getShapes(self_: *const PxPhysics, userBuffer: *mut *mut PxShape, bufferSize: u32, startIndex: u32) -> u32; + + /// Creates a constraint shader. + /// + /// A constraint shader will get added automatically to the scene the two linked actors belong to. Either, but not both, of actor0 and actor1 may + /// be NULL to denote attachment to the world. + /// + /// The new constraint shader. + pub fn PxPhysics_createConstraint_mut(self_: *mut PxPhysics, actor0: *mut PxRigidActor, actor1: *mut PxRigidActor, connector: *mut PxConstraintConnector, shaders: *const PxConstraintShaderTable, dataSize: u32) -> *mut PxConstraint; + + /// Creates a reduced-coordinate articulation with all fields initialized to their default values. + /// + /// the new articulation + pub fn PxPhysics_createArticulationReducedCoordinate_mut(self_: *mut PxPhysics) -> *mut PxArticulationReducedCoordinate; + + /// Creates a new rigid body material with certain default properties. + /// + /// The new rigid body material. + pub fn PxPhysics_createMaterial_mut(self_: *mut PxPhysics, staticFriction: f32, dynamicFriction: f32, restitution: f32) -> *mut PxMaterial; + + /// Return the number of rigid body materials that currently exist. + /// + /// Number of rigid body materials. + pub fn PxPhysics_getNbMaterials(self_: *const PxPhysics) -> u32; + + /// Writes the array of rigid body material pointers to a user buffer. + /// + /// Returns the number of pointers written. + /// + /// The ordering of the materials in the array is not specified. + /// + /// The number of material pointers written to userBuffer, this should be less or equal to bufferSize. + pub fn PxPhysics_getMaterials(self_: *const PxPhysics, userBuffer: *mut *mut PxMaterial, bufferSize: u32, startIndex: u32) -> u32; + + /// Register a deletion listener. Listeners will be called whenever an object is deleted. + /// + /// It is illegal to register or unregister a deletion listener while deletions are being processed. + /// + /// By default a registered listener will receive events from all objects. Set the restrictedObjectSet parameter to true on registration and use [`registerDeletionListenerObjects`] to restrict the received events to specific objects. + /// + /// The deletion events are only supported on core PhysX objects. In general, objects in extension modules do not provide this functionality, however, in the case of PxJoint objects, the underlying PxConstraint will send the events. + pub fn PxPhysics_registerDeletionListener_mut(self_: *mut PxPhysics, observer: *mut PxDeletionListener, deletionEvents: *const PxDeletionEventFlags, restrictedObjectSet: bool); + + /// Unregister a deletion listener. + /// + /// It is illegal to register or unregister a deletion listener while deletions are being processed. + pub fn PxPhysics_unregisterDeletionListener_mut(self_: *mut PxPhysics, observer: *mut PxDeletionListener); + + /// Register specific objects for deletion events. + /// + /// This method allows for a deletion listener to limit deletion events to specific objects only. + /// + /// It is illegal to register or unregister objects while deletions are being processed. + /// + /// The deletion listener has to be registered through [`registerDeletionListener`]() and configured to support restricted object sets prior to this method being used. + pub fn PxPhysics_registerDeletionListenerObjects_mut(self_: *mut PxPhysics, observer: *mut PxDeletionListener, observables: *const *const PxBase, observableCount: u32); + + /// Unregister specific objects for deletion events. + /// + /// This method allows to clear previously registered objects for a deletion listener (see [`registerDeletionListenerObjects`]()). + /// + /// It is illegal to register or unregister objects while deletions are being processed. + /// + /// The deletion listener has to be registered through [`registerDeletionListener`]() and configured to support restricted object sets prior to this method being used. + pub fn PxPhysics_unregisterDeletionListenerObjects_mut(self_: *mut PxPhysics, observer: *mut PxDeletionListener, observables: *const *const PxBase, observableCount: u32); + + /// Gets PxPhysics object insertion interface. + /// + /// The insertion interface is needed for PxCreateTriangleMesh, PxCooking::createTriangleMesh etc., this allows runtime mesh creation. + pub fn PxPhysics_getPhysicsInsertionCallback_mut(self_: *mut PxPhysics) -> *mut PxInsertionCallback; + + /// 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; + + pub fn PxActorShape_new() -> PxActorShape; + + pub fn PxActorShape_new_1(a: *mut PxRigidActor, s: *mut PxShape) -> PxActorShape; + + /// constructor sets to default + pub fn PxQueryCache_new() -> PxQueryCache; + + /// constructor to set properties + pub fn PxQueryCache_new_1(s: *mut PxShape, findex: u32) -> PxQueryCache; + + /// default constructor + pub fn PxQueryFilterData_new() -> PxQueryFilterData; + + /// constructor to set both filter data and filter flags + pub fn PxQueryFilterData_new_1(fd: *const PxFilterData, f: PxQueryFlags) -> PxQueryFilterData; + + /// constructor to set filter flags only + pub fn PxQueryFilterData_new_2(f: PxQueryFlags) -> PxQueryFilterData; + + /// This filter callback is executed before the exact intersection test if PxQueryFlag::ePREFILTER flag was set. + /// + /// the updated type for this hit (see [`PxQueryHitType`]) + pub fn PxQueryFilterCallback_preFilter_mut(self_: *mut PxQueryFilterCallback, filterData: *const PxFilterData, shape: *const PxShape, actor: *const PxRigidActor, queryFlags: *mut PxHitFlags) -> PxQueryHitType; + + /// This filter callback is executed if the exact intersection test returned true and PxQueryFlag::ePOSTFILTER flag was set. + /// + /// the updated hit type for this hit (see [`PxQueryHitType`]) + pub fn PxQueryFilterCallback_postFilter_mut(self_: *mut PxQueryFilterCallback, filterData: *const PxFilterData, hit: *const PxQueryHit, shape: *const PxShape, actor: *const PxRigidActor) -> PxQueryHitType; + + /// virtual destructor + pub fn PxQueryFilterCallback_delete(self_: *mut PxQueryFilterCallback); + + /// Moves kinematically controlled dynamic actors through the game world. + /// + /// You set a dynamic actor to be kinematic using the PxRigidBodyFlag::eKINEMATIC flag + /// with setRigidBodyFlag(). + /// + /// The move command will result in a velocity that will move the body into + /// the desired pose. After the move is carried out during a single time step, + /// the velocity is returned to zero. Thus, you must continuously call + /// this in every time step for kinematic actors so that they move along a path. + /// + /// This function simply stores the move destination until the next simulation + /// step is processed, so consecutive calls will simply overwrite the stored target variable. + /// + /// The motion is always fully carried out. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping and will set the wake counter to [`PxSceneDesc::wakeCounterResetValue`]. + pub fn PxRigidDynamic_setKinematicTarget_mut(self_: *mut PxRigidDynamic, destination: *const PxTransform); + + /// Get target pose of a kinematically controlled dynamic actor. + /// + /// True if the actor is a kinematically controlled dynamic and the target has been set, else False. + pub fn PxRigidDynamic_getKinematicTarget(self_: *const PxRigidDynamic, target: *mut PxTransform) -> bool; + + /// Returns true if this body is sleeping. + /// + /// When an actor does not move for a period of time, it is no longer simulated in order to save time. This state + /// is called sleeping. However, because the object automatically wakes up when it is either touched by an awake object, + /// or one of its properties is changed by the user, the entire sleep mechanism should be transparent to the user. + /// + /// In general, a dynamic rigid actor is guaranteed to be awake if at least one of the following holds: + /// + /// The wake counter is positive (see [`setWakeCounter`]()). + /// + /// The linear or angular velocity is non-zero. + /// + /// A non-zero force or torque has been applied. + /// + /// If a dynamic rigid actor is sleeping, the following state is guaranteed: + /// + /// The wake counter is zero. + /// + /// The linear and angular velocity is zero. + /// + /// There is no force update pending. + /// + /// When an actor gets inserted into a scene, it will be considered asleep if all the points above hold, else it will be treated as awake. + /// + /// If an actor is asleep after the call to PxScene::fetchResults() returns, it is guaranteed that the pose of the actor + /// was not changed. You can use this information to avoid updating the transforms of associated objects. + /// + /// A kinematic actor is asleep unless a target pose has been set (in which case it will stay awake until two consecutive + /// simulation steps without a target pose being set have passed). The wake counter will get set to zero or to the reset value + /// [`PxSceneDesc::wakeCounterResetValue`] in the case where a target pose has been set to be consistent with the definitions above. + /// + /// It is invalid to use this method if the actor has not been added to a scene already. + /// + /// It is not allowed to use this method while the simulation is running. + /// + /// True if the actor is sleeping. + pub fn PxRigidDynamic_isSleeping(self_: *const PxRigidDynamic) -> bool; + + /// Sets the mass-normalized kinetic energy threshold below which an actor may go to sleep. + /// + /// Actors whose kinetic energy divided by their mass is below this threshold will be candidates for sleeping. + /// + /// Default: + /// 5e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed + pub fn PxRigidDynamic_setSleepThreshold_mut(self_: *mut PxRigidDynamic, threshold: f32); + + /// Returns the mass-normalized kinetic energy below which an actor may go to sleep. + /// + /// The energy threshold for sleeping. + pub fn PxRigidDynamic_getSleepThreshold(self_: *const PxRigidDynamic) -> f32; + + /// Sets the mass-normalized kinetic energy threshold below which an actor may participate in stabilization. + /// + /// Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + /// + /// This value has no effect if PxSceneFlag::eENABLE_STABILIZATION was not enabled on the PxSceneDesc. + /// + /// Default: + /// 1e-5f * PxTolerancesScale::speed * PxTolerancesScale::speed + pub fn PxRigidDynamic_setStabilizationThreshold_mut(self_: *mut PxRigidDynamic, threshold: f32); + + /// Returns the mass-normalized kinetic energy below which an actor may participate in stabilization. + /// + /// Actors whose kinetic energy divided by their mass is above this threshold will not participate in stabilization. + /// + /// The energy threshold for participating in stabilization. + pub fn PxRigidDynamic_getStabilizationThreshold(self_: *const PxRigidDynamic) -> f32; + + /// Reads the PxRigidDynamic lock flags. + /// + /// See the list of flags [`PxRigidDynamicLockFlag`] + /// + /// The values of the PxRigidDynamicLock flags. + pub fn PxRigidDynamic_getRigidDynamicLockFlags(self_: *const PxRigidDynamic) -> PxRigidDynamicLockFlags; + + /// Raises or clears a particular rigid dynamic lock flag. + /// + /// See the list of flags [`PxRigidDynamicLockFlag`] + /// + /// Default: + /// no flags are set + pub fn PxRigidDynamic_setRigidDynamicLockFlag_mut(self_: *mut PxRigidDynamic, flag: PxRigidDynamicLockFlag, value: bool); + + pub fn PxRigidDynamic_setRigidDynamicLockFlags_mut(self_: *mut PxRigidDynamic, flags: PxRigidDynamicLockFlags); + + /// Retrieves the linear velocity of an actor. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// The linear velocity of the actor. + pub fn PxRigidDynamic_getLinearVelocity(self_: *const PxRigidDynamic) -> PxVec3; + + /// Sets the linear velocity of the actor. + /// + /// Note that if you continuously set the velocity of an actor yourself, + /// forces such as gravity or friction will not be able to manifest themselves, because forces directly + /// influence only the velocity/momentum of an actor. + /// + /// Default: + /// (0.0, 0.0, 0.0) + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the + /// new velocity is non-zero. + /// + /// It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + pub fn PxRigidDynamic_setLinearVelocity_mut(self_: *mut PxRigidDynamic, linVel: *const PxVec3, autowake: bool); + + /// Retrieves the angular velocity of the actor. + /// + /// It is not allowed to use this method while the simulation is running (except during PxScene::collide(), + /// in PxContactModifyCallback or in contact report callbacks). + /// + /// The angular velocity of the actor. + pub fn PxRigidDynamic_getAngularVelocity(self_: *const PxRigidDynamic) -> PxVec3; + + /// Sets the angular velocity of the actor. + /// + /// Note that if you continuously set the angular velocity of an actor yourself, + /// forces such as friction will not be able to rotate the actor, because forces directly influence only the velocity/momentum. + /// + /// Default: + /// (0.0, 0.0, 0.0) + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping, and the autowake parameter is true (default) or the + /// new velocity is non-zero. + /// + /// It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + pub fn PxRigidDynamic_setAngularVelocity_mut(self_: *mut PxRigidDynamic, angVel: *const PxVec3, autowake: bool); + + /// Sets the wake counter for the actor. + /// + /// The wake counter value determines the minimum amount of time until the body can be put to sleep. Please note + /// that a body will not be put to sleep if the energy is above the specified threshold (see [`setSleepThreshold`]()) + /// or if other awake bodies are touching it. + /// + /// Passing in a positive value will wake the actor up automatically. + /// + /// It is invalid to use this method for kinematic actors since the wake counter for kinematics is defined + /// based on whether a target pose has been set (see the comment in [`isSleeping`]()). + /// + /// It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// Default: + /// 0.4 (which corresponds to 20 frames for a time step of 0.02) + pub fn PxRigidDynamic_setWakeCounter_mut(self_: *mut PxRigidDynamic, wakeCounterValue: f32); + + /// Returns the wake counter of the actor. + /// + /// It is not allowed to use this method while the simulation is running. + /// + /// The wake counter of the actor. + pub fn PxRigidDynamic_getWakeCounter(self_: *const PxRigidDynamic) -> f32; + + /// Wakes up the actor if it is sleeping. + /// + /// The actor will get woken up and might cause other touching actors to wake up as well during the next simulation step. + /// + /// This will set the wake counter of the actor to the value specified in [`PxSceneDesc::wakeCounterResetValue`]. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined + /// based on whether a target pose has been set (see the comment in [`isSleeping`]()). + pub fn PxRigidDynamic_wakeUp_mut(self_: *mut PxRigidDynamic); + + /// Forces the actor to sleep. + /// + /// The actor will stay asleep during the next simulation step if not touched by another non-sleeping actor. + /// + /// Any applied force will be cleared and the velocity and the wake counter of the actor will be set to 0. + /// + /// It is invalid to use this method if the actor has not been added to a scene already or if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// It is invalid to use this method for kinematic actors since the sleep state for kinematics is defined + /// based on whether a target pose has been set (see the comment in [`isSleeping`]()). + pub fn PxRigidDynamic_putToSleep_mut(self_: *mut PxRigidDynamic); + + /// Sets the solver iteration counts for the body. + /// + /// The solver iteration count determines how accurately joints and contacts are resolved. + /// If you are having trouble with jointed bodies oscillating and behaving erratically, then + /// setting a higher position iteration count may improve their stability. + /// + /// If intersecting bodies are being depenetrated too violently, increase the number of velocity + /// iterations. More velocity iterations will drive the relative exit velocity of the intersecting + /// objects closer to the correct value given the restitution. + /// + /// Default: + /// 4 position iterations, 1 velocity iteration + pub fn PxRigidDynamic_setSolverIterationCounts_mut(self_: *mut PxRigidDynamic, minPositionIters: u32, minVelocityIters: u32); + + /// Retrieves the solver iteration counts. + pub fn PxRigidDynamic_getSolverIterationCounts(self_: *const PxRigidDynamic, minPositionIters: *mut u32, minVelocityIters: *mut u32); + + /// Retrieves the force threshold for contact reports. + /// + /// The contact report threshold is a force threshold. If the force between + /// two actors exceeds this threshold for either of the two actors, a contact report + /// will be generated according to the contact report threshold flags provided by + /// the filter shader/callback. + /// See [`PxPairFlag`]. + /// + /// The threshold used for a collision between a dynamic actor and the static environment is + /// the threshold of the dynamic actor, and all contacts with static actors are summed to find + /// the total normal force. + /// + /// Default: + /// PX_MAX_F32 + /// + /// Force threshold for contact reports. + pub fn PxRigidDynamic_getContactReportThreshold(self_: *const PxRigidDynamic) -> f32; + + /// Sets the force threshold for contact reports. + /// + /// See [`getContactReportThreshold`](). + pub fn PxRigidDynamic_setContactReportThreshold_mut(self_: *mut PxRigidDynamic, threshold: f32); + + pub fn PxRigidDynamic_getConcreteTypeName(self_: *const PxRigidDynamic) -> *const std::ffi::c_char; + + pub fn PxRigidStatic_getConcreteTypeName(self_: *const PxRigidStatic) -> *const std::ffi::c_char; + + /// constructor sets to default. + pub fn PxSceneQueryDesc_new() -> PxSceneQueryDesc; + + /// (re)sets the structure to the default. + pub fn PxSceneQueryDesc_setToDefault_mut(self_: *mut PxSceneQueryDesc); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxSceneQueryDesc_isValid(self_: *const PxSceneQueryDesc) -> bool; + + /// Sets the rebuild rate of the dynamic tree pruning structures. + pub fn PxSceneQuerySystemBase_setDynamicTreeRebuildRateHint_mut(self_: *mut PxSceneQuerySystemBase, dynamicTreeRebuildRateHint: u32); + + /// Retrieves the rebuild rate of the dynamic tree pruning structures. + /// + /// The rebuild rate of the dynamic tree pruning structures. + pub fn PxSceneQuerySystemBase_getDynamicTreeRebuildRateHint(self_: *const PxSceneQuerySystemBase) -> u32; + + /// Forces dynamic trees to be immediately rebuilt. + /// + /// PxScene will call this function with the PX_SCENE_PRUNER_STATIC or PX_SCENE_PRUNER_DYNAMIC value. + pub fn PxSceneQuerySystemBase_forceRebuildDynamicTree_mut(self_: *mut PxSceneQuerySystemBase, prunerIndex: u32); + + /// Sets scene query update mode + pub fn PxSceneQuerySystemBase_setUpdateMode_mut(self_: *mut PxSceneQuerySystemBase, updateMode: PxSceneQueryUpdateMode); + + /// Gets scene query update mode + /// + /// Current scene query update mode. + pub fn PxSceneQuerySystemBase_getUpdateMode(self_: *const PxSceneQuerySystemBase) -> PxSceneQueryUpdateMode; + + /// Retrieves the system's internal scene query timestamp, increased each time a change to the + /// static scene query structure is performed. + /// + /// scene query static timestamp + pub fn PxSceneQuerySystemBase_getStaticTimestamp(self_: *const PxSceneQuerySystemBase) -> u32; + + /// Flushes any changes to the scene query representation. + /// + /// This method updates the state of the scene query representation to match changes in the scene state. + /// + /// By default, these changes are buffered until the next query is submitted. Calling this function will not change + /// the results from scene queries, but can be used to ensure that a query will not perform update work in the course of + /// its execution. + /// + /// A thread performing updates will hold a write lock on the query structure, and thus stall other querying threads. In multithread + /// scenarios it can be useful to explicitly schedule the period where this lock may be held for a significant period, so that + /// subsequent queries issued from multiple threads will not block. + pub fn PxSceneQuerySystemBase_flushUpdates_mut(self_: *mut PxSceneQuerySystemBase); + + /// Performs a raycast against objects in the scene, returns results in a PxRaycastBuffer object + /// or via a custom user callback implementation inheriting from PxRaycastCallback. + /// + /// Touching hits are not ordered. + /// + /// Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in user guide article SceneQuery. User can ignore such objects by employing one of the provided filter mechanisms. + /// + /// True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + pub fn PxSceneQuerySystemBase_raycast(self_: *const PxSceneQuerySystemBase, origin: *const PxVec3, unitDir: *const PxVec3, distance: f32, hitCall: *mut PxRaycastCallback, hitFlags: PxHitFlags, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Performs a sweep test against objects in the scene, returns results in a PxSweepBuffer object + /// or via a custom user callback implementation inheriting from PxSweepCallback. + /// + /// Touching hits are not ordered. + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, + /// the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + /// + /// True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + pub fn PxSceneQuerySystemBase_sweep(self_: *const PxSceneQuerySystemBase, geometry: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, distance: f32, hitCall: *mut PxSweepCallback, hitFlags: PxHitFlags, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Performs an overlap test of a given geometry against objects in the scene, returns results in a PxOverlapBuffer object + /// or via a custom user callback implementation inheriting from PxOverlapCallback. + /// + /// Filtering: returning eBLOCK from user filter for overlap queries will cause a warning (see [`PxQueryHitType`]). + /// + /// True if any touching or blocking hits were found or any hit was found in case PxQueryFlag::eANY_HIT was specified. + /// + /// eBLOCK should not be returned from user filters for overlap(). Doing so will result in undefined behavior, and a warning will be issued. + /// + /// If the PxQueryFlag::eNO_BLOCK flag is set, the eBLOCK will instead be automatically converted to an eTOUCH and the warning suppressed. + pub fn PxSceneQuerySystemBase_overlap(self_: *const PxSceneQuerySystemBase, geometry: *const PxGeometry, pose: *const PxTransform, hitCall: *mut PxOverlapCallback, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, queryFlags: PxGeometryQueryFlags) -> bool; + + /// Sets scene query update mode + pub fn PxSceneSQSystem_setSceneQueryUpdateMode_mut(self_: *mut PxSceneSQSystem, updateMode: PxSceneQueryUpdateMode); + + /// Gets scene query update mode + /// + /// Current scene query update mode. + pub fn PxSceneSQSystem_getSceneQueryUpdateMode(self_: *const PxSceneSQSystem) -> PxSceneQueryUpdateMode; + + /// Retrieves the scene's internal scene query timestamp, increased each time a change to the + /// static scene query structure is performed. + /// + /// scene query static timestamp + pub fn PxSceneSQSystem_getSceneQueryStaticTimestamp(self_: *const PxSceneSQSystem) -> u32; + + /// Flushes any changes to the scene query representation. + pub fn PxSceneSQSystem_flushQueryUpdates_mut(self_: *mut PxSceneSQSystem); + + /// Forces dynamic trees to be immediately rebuilt. + pub fn PxSceneSQSystem_forceDynamicTreeRebuild_mut(self_: *mut PxSceneSQSystem, rebuildStaticStructure: bool, rebuildDynamicStructure: bool); + + /// Return the value of PxSceneQueryDesc::staticStructure that was set when creating the scene with PxPhysics::createScene + pub fn PxSceneSQSystem_getStaticStructure(self_: *const PxSceneSQSystem) -> PxPruningStructureType; + + /// Return the value of PxSceneQueryDesc::dynamicStructure that was set when creating the scene with PxPhysics::createScene + pub fn PxSceneSQSystem_getDynamicStructure(self_: *const PxSceneSQSystem) -> PxPruningStructureType; + + /// Executes scene queries update tasks. + /// + /// This function will refit dirty shapes within the pruner and will execute a task to build a new AABB tree, which is + /// build on a different thread. The new AABB tree is built based on the dynamic tree rebuild hint rate. Once + /// the new tree is ready it will be commited in next fetchQueries call, which must be called after. + /// + /// This function is equivalent to the following PxSceneQuerySystem calls: + /// Synchronous calls: + /// - PxSceneQuerySystemBase::flushUpdates() + /// - handle0 = PxSceneQuerySystem::prepareSceneQueryBuildStep(PX_SCENE_PRUNER_STATIC) + /// - handle1 = PxSceneQuerySystem::prepareSceneQueryBuildStep(PX_SCENE_PRUNER_DYNAMIC) + /// Asynchronous calls: + /// - PxSceneQuerySystem::sceneQueryBuildStep(handle0); + /// - PxSceneQuerySystem::sceneQueryBuildStep(handle1); + /// + /// This function is part of the PxSceneSQSystem interface because it uses the PxScene task system under the hood. But + /// it calls PxSceneQuerySystem functions, which are independent from this system and could be called in a similar + /// fashion by a separate, possibly user-defined task manager. + /// + /// If PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED is used, it is required to update the scene queries + /// using this function. + pub fn PxSceneSQSystem_sceneQueriesUpdate_mut(self_: *mut PxSceneSQSystem, completionTask: *mut PxBaseTask, controlSimulation: bool); + + /// This checks to see if the scene queries update has completed. + /// + /// This does not cause the data available for reading to be updated with the results of the scene queries update, it is simply a status check. + /// The bool will allow it to either return immediately or block waiting for the condition to be met so that it can return true + /// + /// True if the results are available. + pub fn PxSceneSQSystem_checkQueries_mut(self_: *mut PxSceneSQSystem, block: bool) -> bool; + + /// This method must be called after sceneQueriesUpdate. It will wait for the scene queries update to finish. If the user makes an illegal scene queries update call, + /// the SDK will issue an error message. + /// + /// If a new AABB tree build finished, then during fetchQueries the current tree within the pruning structure is swapped with the new tree. + pub fn PxSceneSQSystem_fetchQueries_mut(self_: *mut PxSceneSQSystem, block: bool) -> bool; + + /// Decrements the reference count of the object and releases it if the new reference count is zero. + pub fn PxSceneQuerySystem_release_mut(self_: *mut PxSceneQuerySystem); + + /// Acquires a counted reference to this object. + /// + /// This method increases the reference count of the object by 1. Decrement the reference count by calling release() + pub fn PxSceneQuerySystem_acquireReference_mut(self_: *mut PxSceneQuerySystem); + + /// Preallocates internal arrays to minimize the amount of reallocations. + /// + /// The system does not prevent more allocations than given numbers. It is legal to not call this function at all, + /// or to add more shapes to the system than the preallocated amounts. + pub fn PxSceneQuerySystem_preallocate_mut(self_: *mut PxSceneQuerySystem, prunerIndex: u32, nbShapes: u32); + + /// Frees internal memory that may not be in-use anymore. + /// + /// This is an entry point for reclaiming transient memory allocated at some point by the SQ system, + /// but which wasn't been immediately freed for performance reason. Calling this function might free + /// some memory, but it might also produce a new set of allocations in the next frame. + pub fn PxSceneQuerySystem_flushMemory_mut(self_: *mut PxSceneQuerySystem); + + /// Adds a shape to the SQ system. + /// + /// The same function is used to add either a regular shape, or a SQ compound shape. + pub fn PxSceneQuerySystem_addSQShape_mut(self_: *mut PxSceneQuerySystem, actor: *const PxRigidActor, shape: *const PxShape, bounds: *const PxBounds3, transform: *const PxTransform, compoundHandle: *const u32, hasPruningStructure: bool); + + /// Removes a shape from the SQ system. + /// + /// The same function is used to remove either a regular shape, or a SQ compound shape. + pub fn PxSceneQuerySystem_removeSQShape_mut(self_: *mut PxSceneQuerySystem, actor: *const PxRigidActor, shape: *const PxShape); + + /// Updates a shape in the SQ system. + /// + /// The same function is used to update either a regular shape, or a SQ compound shape. + /// + /// The transforms are eager-evaluated, but the bounds are lazy-evaluated. This means that + /// the updated transform has to be passed to the update function, while the bounds are automatically + /// recomputed by the system whenever needed. + pub fn PxSceneQuerySystem_updateSQShape_mut(self_: *mut PxSceneQuerySystem, actor: *const PxRigidActor, shape: *const PxShape, transform: *const PxTransform); + + /// Adds a compound to the SQ system. + /// + /// SQ compound handle + pub fn PxSceneQuerySystem_addSQCompound_mut(self_: *mut PxSceneQuerySystem, actor: *const PxRigidActor, shapes: *mut *const PxShape, bvh: *const PxBVH, transforms: *const PxTransform) -> u32; + + /// Removes a compound from the SQ system. + pub fn PxSceneQuerySystem_removeSQCompound_mut(self_: *mut PxSceneQuerySystem, compoundHandle: u32); + + /// Updates a compound in the SQ system. + /// + /// The compound structures are immediately updated when the call occurs. + pub fn PxSceneQuerySystem_updateSQCompound_mut(self_: *mut PxSceneQuerySystem, compoundHandle: u32, compoundTransform: *const PxTransform); + + /// Shift the data structures' origin by the specified vector. + /// + /// Please refer to the notes of the similar function in PxScene. + pub fn PxSceneQuerySystem_shiftOrigin_mut(self_: *mut PxSceneQuerySystem, shift: *const PxVec3); + + /// Merges a pruning structure with the SQ system's internal pruners. + pub fn PxSceneQuerySystem_merge_mut(self_: *mut PxSceneQuerySystem, pruningStructure: *const PxPruningStructure); + + /// Shape to SQ-pruner-handle mapping function. + /// + /// This function finds and returns the SQ pruner handle associated with a given (actor/shape) couple + /// that was previously added to the system. This is needed for the sync function. + /// + /// Associated SQ pruner handle. + pub fn PxSceneQuerySystem_getHandle(self_: *const PxSceneQuerySystem, actor: *const PxRigidActor, shape: *const PxShape, prunerIndex: *mut u32) -> u32; + + /// Synchronizes the scene-query system with another system that references the same objects. + /// + /// This function is used when the scene-query objects also exist in another system that can also update them. For example the scene-query objects + /// (used for raycast, overlap or sweep queries) might be driven by equivalent objects in an external rigid-body simulation engine. In this case + /// the rigid-body simulation engine computes the new poses and transforms, and passes them to the scene-query system using this function. It is + /// more efficient than calling updateSQShape on each object individually, since updateSQShape would end up recomputing the bounds already available + /// in the rigid-body engine. + pub fn PxSceneQuerySystem_sync_mut(self_: *mut PxSceneQuerySystem, prunerIndex: u32, handles: *const u32, indices: *const u32, bounds: *const PxBounds3, transforms: *const PxTransformPadded, count: u32, ignoredIndices: *const PxBitMap); + + /// Finalizes updates made to the SQ system. + /// + /// This function should be called after updates have been made to the SQ system, to fully reflect the changes + /// inside the internal pruners. In particular it should be called: + /// - after calls to updateSQShape + /// - after calls to sync + /// + /// This function: + /// - recomputes bounds of manually updated shapes (i.e. either regular or SQ compound shapes modified by updateSQShape) + /// - updates dynamic pruners (refit operations) + /// - incrementally rebuilds AABB-trees + /// + /// The amount of work performed in this function depends on PxSceneQueryUpdateMode. + pub fn PxSceneQuerySystem_finalizeUpdates_mut(self_: *mut PxSceneQuerySystem); + + /// Prepares asynchronous build step. + /// + /// This is directly called (synchronously) by PxSceneSQSystem::sceneQueriesUpdate(). See the comments there. + /// + /// This function is called to let the system execute any necessary synchronous operation before the + /// asynchronous sceneQueryBuildStep() function is called. + /// + /// If there is any work to do for the specific pruner, the function returns a pruner-specific handle that + /// will be passed to the corresponding, asynchronous sceneQueryBuildStep function. + /// + /// A pruner-specific handle that will be sent to sceneQueryBuildStep if there is any work to do, i.e. to execute the corresponding sceneQueryBuildStep() call. + /// + /// Null if there is no work to do, otherwise a pruner-specific handle. + pub fn PxSceneQuerySystem_prepareSceneQueryBuildStep_mut(self_: *mut PxSceneQuerySystem, prunerIndex: u32) -> *mut std::ffi::c_void; + + /// Executes asynchronous build step. + /// + /// This is directly called (asynchronously) by PxSceneSQSystem::sceneQueriesUpdate(). See the comments there. + /// + /// This function incrementally builds the internal trees/pruners. It is called asynchronously, i.e. this can be + /// called from different threads for building multiple trees at the same time. + pub fn PxSceneQuerySystem_sceneQueryBuildStep_mut(self_: *mut PxSceneQuerySystem, handle: *mut std::ffi::c_void); + + pub fn PxBroadPhaseDesc_new(type_: PxBroadPhaseType) -> PxBroadPhaseDesc; + + pub fn PxBroadPhaseDesc_isValid(self_: *const PxBroadPhaseDesc) -> bool; + + /// Retrieves the filter group for static objects. + /// + /// Mark static objects with this group when adding them to the broadphase. + /// Overlaps between static objects will not be detected. All static objects + /// should have the same group. + /// + /// Filter group for static objects. + pub fn phys_PxGetBroadPhaseStaticFilterGroup() -> u32; + + /// Retrieves a filter group for dynamic objects. + /// + /// Mark dynamic objects with this group when adding them to the broadphase. + /// Each dynamic object must have an ID, and overlaps between dynamic objects that have + /// the same ID will not be detected. This is useful to dismiss overlaps between shapes + /// of the same (compound) actor directly within the broadphase. + /// + /// Filter group for the object. + pub fn phys_PxGetBroadPhaseDynamicFilterGroup(id: u32) -> u32; + + /// Retrieves a filter group for kinematic objects. + /// + /// Mark kinematic objects with this group when adding them to the broadphase. + /// Each kinematic object must have an ID, and overlaps between kinematic objects that have + /// the same ID will not be detected. + /// + /// Filter group for the object. + pub fn phys_PxGetBroadPhaseKinematicFilterGroup(id: u32) -> u32; + + pub fn PxBroadPhaseUpdateData_new(created: *const u32, nbCreated: u32, updated: *const u32, nbUpdated: u32, removed: *const u32, nbRemoved: u32, bounds: *const PxBounds3, groups: *const u32, distances: *const f32, capacity: u32) -> PxBroadPhaseUpdateData; + + pub fn PxBroadPhaseResults_new() -> PxBroadPhaseResults; + + /// Returns number of regions currently registered in the broad-phase. + /// + /// Number of regions + pub fn PxBroadPhaseRegions_getNbRegions(self_: *const PxBroadPhaseRegions) -> u32; + + /// Gets broad-phase regions. + /// + /// Number of written out regions. + pub fn PxBroadPhaseRegions_getRegions(self_: *const PxBroadPhaseRegions, userBuffer: *mut PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32; + + /// Adds a new broad-phase region. + /// + /// The total number of regions is limited to PxBroadPhaseCaps::mMaxNbRegions. If that number is exceeded, the call is ignored. + /// + /// The newly added region will be automatically populated with already existing objects that touch it, if the + /// 'populateRegion' parameter is set to true. Otherwise the newly added region will be empty, and it will only be + /// populated with objects when those objects are added to the simulation, or updated if they already exist. + /// + /// Using 'populateRegion=true' has a cost, so it is best to avoid it if possible. In particular it is more efficient + /// to create the empty regions first (with populateRegion=false) and then add the objects afterwards (rather than + /// the opposite). + /// + /// Objects automatically move from one region to another during their lifetime. The system keeps tracks of what + /// regions a given object is in. It is legal for an object to be in an arbitrary number of regions. However if an + /// object leaves all regions, or is created outside of all regions, several things happen: + /// - collisions get disabled for this object + /// - the object appears in the getOutOfBoundsObjects() array + /// + /// If an out-of-bounds object, whose collisions are disabled, re-enters a valid broadphase region, then collisions + /// are re-enabled for that object. + /// + /// Handle for newly created region, or 0xffffffff in case of failure. + pub fn PxBroadPhaseRegions_addRegion_mut(self_: *mut PxBroadPhaseRegions, region: *const PxBroadPhaseRegion, populateRegion: bool, bounds: *const PxBounds3, distances: *const f32) -> u32; + + /// Removes a broad-phase region. + /// + /// If the region still contains objects, and if those objects do not overlap any region any more, they are not + /// automatically removed from the simulation. Instead, the PxBroadPhaseCallback::onObjectOutOfBounds notification + /// is used for each object. Users are responsible for removing the objects from the simulation if this is the + /// desired behavior. + /// + /// If the handle is invalid, or if a valid handle is removed twice, an error message is sent to the error stream. + /// + /// True if success + pub fn PxBroadPhaseRegions_removeRegion_mut(self_: *mut PxBroadPhaseRegions, handle: u32) -> bool; + + pub fn PxBroadPhaseRegions_getNbOutOfBoundsObjects(self_: *const PxBroadPhaseRegions) -> u32; + + pub fn PxBroadPhaseRegions_getOutOfBoundsObjects(self_: *const PxBroadPhaseRegions) -> *const u32; + + pub fn PxBroadPhase_release_mut(self_: *mut PxBroadPhase); + + /// Gets the broadphase type. + /// + /// Broadphase type. + pub fn PxBroadPhase_getType(self_: *const PxBroadPhase) -> PxBroadPhaseType; + + /// Gets broad-phase caps. + pub fn PxBroadPhase_getCaps(self_: *const PxBroadPhase, caps: *mut PxBroadPhaseCaps); + + /// Retrieves the regions API if applicable. + /// + /// For broadphases that do not use explicit user-defined regions, this call returns NULL. + /// + /// Region API, or NULL. + pub fn PxBroadPhase_getRegions_mut(self_: *mut PxBroadPhase) -> *mut PxBroadPhaseRegions; + + /// Retrieves the broadphase allocator. + /// + /// User-provided buffers should ideally be allocated with this allocator, for best performance. + /// This is especially true for the GPU broadphases, whose buffers need to be allocated in CUDA + /// host memory. + /// + /// The broadphase allocator. + pub fn PxBroadPhase_getAllocator_mut(self_: *mut PxBroadPhase) -> *mut PxAllocatorCallback; + + /// Retrieves the profiler's context ID. + /// + /// The context ID. + pub fn PxBroadPhase_getContextID(self_: *const PxBroadPhase) -> u64; + + /// Sets a scratch buffer + /// + /// Some broadphases might take advantage of a scratch buffer to limit runtime allocations. + /// + /// All broadphases still work without providing a scratch buffer, this is an optional function + /// that can potentially reduce runtime allocations. + pub fn PxBroadPhase_setScratchBlock_mut(self_: *mut PxBroadPhase, scratchBlock: *mut std::ffi::c_void, size: u32); + + /// Updates the broadphase and computes the lists of created/deleted pairs. + /// + /// The provided update data describes changes to objects since the last broadphase update. + /// + /// To benefit from potentially multithreaded implementations, it is necessary to provide a continuation + /// task to the function. It is legal to pass NULL there, but the underlying (CPU) implementations will + /// then run single-threaded. + pub fn PxBroadPhase_update_mut(self_: *mut PxBroadPhase, updateData: *const PxBroadPhaseUpdateData, continuation: *mut PxBaseTask); + + /// Retrieves the broadphase results after an update. + /// + /// This should be called once after each update call to retrieve the results of the broadphase. The + /// results are incremental, i.e. the system only returns new and lost pairs, not all current pairs. + pub fn PxBroadPhase_fetchResults_mut(self_: *mut PxBroadPhase, results: *mut PxBroadPhaseResults); + + /// Helper for single-threaded updates. + /// + /// This short helper function performs a single-theaded update and reports the results in a single call. + pub fn PxBroadPhase_update_mut_1(self_: *mut PxBroadPhase, results: *mut PxBroadPhaseResults, updateData: *const PxBroadPhaseUpdateData); + + /// Broadphase factory function. + /// + /// Use this function to create a new standalone broadphase. + /// + /// Newly created broadphase, or NULL + pub fn phys_PxCreateBroadPhase(desc: *const PxBroadPhaseDesc) -> *mut PxBroadPhase; + + pub fn PxAABBManager_release_mut(self_: *mut PxAABBManager); + + /// Retrieves the underlying broadphase. + /// + /// The managed broadphase. + pub fn PxAABBManager_getBroadPhase_mut(self_: *mut PxAABBManager) -> *mut PxBroadPhase; + + /// Retrieves the managed bounds. + /// + /// This is needed as input parameters to functions like PxBroadPhaseRegions::addRegion. + /// + /// The managed object bounds. + pub fn PxAABBManager_getBounds(self_: *const PxAABBManager) -> *const PxBounds3; + + /// Retrieves the managed distances. + /// + /// This is needed as input parameters to functions like PxBroadPhaseRegions::addRegion. + /// + /// The managed object distances. + pub fn PxAABBManager_getDistances(self_: *const PxAABBManager) -> *const f32; + + /// Retrieves the managed filter groups. + /// + /// The managed object groups. + pub fn PxAABBManager_getGroups(self_: *const PxAABBManager) -> *const u32; + + /// Retrieves the managed buffers' capacity. + /// + /// Bounds, distances and groups buffers have the same capacity. + /// + /// The managed buffers' capacity. + pub fn PxAABBManager_getCapacity(self_: *const PxAABBManager) -> u32; + + /// Adds an object to the manager. + /// + /// Objects' indices are externally managed, i.e. they must be provided by users (as opposed to handles + /// that could be returned by this manager). The design allows users to identify an object by a single ID, + /// and use the same ID in multiple sub-systems. + pub fn PxAABBManager_addObject_mut(self_: *mut PxAABBManager, index: u32, bounds: *const PxBounds3, group: u32, distance: f32); + + /// Removes an object from the manager. + pub fn PxAABBManager_removeObject_mut(self_: *mut PxAABBManager, index: u32); + + /// Updates an object in the manager. + /// + /// This call can update an object's bounds, distance, or both. + /// It is not possible to update an object's filter group. + pub fn PxAABBManager_updateObject_mut(self_: *mut PxAABBManager, index: u32, bounds: *const PxBounds3, distance: *const f32); + + /// Updates the broadphase and computes the lists of created/deleted pairs. + /// + /// The data necessary for updating the broadphase is internally computed by the AABB manager. + /// + /// To benefit from potentially multithreaded implementations, it is necessary to provide a continuation + /// task to the function. It is legal to pass NULL there, but the underlying (CPU) implementations will + /// then run single-threaded. + pub fn PxAABBManager_update_mut(self_: *mut PxAABBManager, continuation: *mut PxBaseTask); + + /// Retrieves the broadphase results after an update. + /// + /// This should be called once after each update call to retrieve the results of the broadphase. The + /// results are incremental, i.e. the system only returns new and lost pairs, not all current pairs. + pub fn PxAABBManager_fetchResults_mut(self_: *mut PxAABBManager, results: *mut PxBroadPhaseResults); + + /// Helper for single-threaded updates. + /// + /// This short helper function performs a single-theaded update and reports the results in a single call. + pub fn PxAABBManager_update_mut_1(self_: *mut PxAABBManager, results: *mut PxBroadPhaseResults); + + /// AABB manager factory function. + /// + /// Use this function to create a new standalone high-level broadphase. + /// + /// Newly created AABB manager, or NULL + pub fn phys_PxCreateAABBManager(broadphase: *mut PxBroadPhase) -> *mut PxAABBManager; + + /// constructor sets to default + pub fn PxSceneLimits_new() -> PxSceneLimits; + + /// (re)sets the structure to the default + pub fn PxSceneLimits_setToDefault_mut(self_: *mut PxSceneLimits); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxSceneLimits_isValid(self_: *const PxSceneLimits) -> bool; + + pub fn PxgDynamicsMemoryConfig_new() -> PxgDynamicsMemoryConfig; + + pub fn PxgDynamicsMemoryConfig_isValid(self_: *const PxgDynamicsMemoryConfig) -> bool; + + /// constructor sets to default. + pub fn PxSceneDesc_new(scale: *const PxTolerancesScale) -> PxSceneDesc; + + /// (re)sets the structure to the default. + pub fn PxSceneDesc_setToDefault_mut(self_: *mut PxSceneDesc, scale: *const PxTolerancesScale); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxSceneDesc_isValid(self_: *const PxSceneDesc) -> bool; + + pub fn PxSceneDesc_getTolerancesScale(self_: *const PxSceneDesc) -> *const PxTolerancesScale; + + /// Get number of broadphase volumes added for the current simulation step. + /// + /// Number of broadphase volumes added. + pub fn PxSimulationStatistics_getNbBroadPhaseAdds(self_: *const PxSimulationStatistics) -> u32; + + /// Get number of broadphase volumes removed for the current simulation step. + /// + /// Number of broadphase volumes removed. + pub fn PxSimulationStatistics_getNbBroadPhaseRemoves(self_: *const PxSimulationStatistics) -> u32; + + /// Get number of shape collision pairs of a certain type processed for the current simulation step. + /// + /// There is an entry for each geometry pair type. + /// + /// entry[i][j] = entry[j][i], hence, if you want the sum of all pair + /// types, you need to discard the symmetric entries + /// + /// Number of processed pairs of the specified geometry types. + pub fn PxSimulationStatistics_getRbPairStats(self_: *const PxSimulationStatistics, pairType: RbPairStatsType, g0: PxGeometryType, g1: PxGeometryType) -> u32; + + pub fn PxSimulationStatistics_new() -> PxSimulationStatistics; + + /// Sets the PVD flag. See PxPvdSceneFlag. + pub fn PxPvdSceneClient_setScenePvdFlag_mut(self_: *mut PxPvdSceneClient, flag: PxPvdSceneFlag, value: bool); + + /// Sets the PVD flags. See PxPvdSceneFlags. + pub fn PxPvdSceneClient_setScenePvdFlags_mut(self_: *mut PxPvdSceneClient, flags: PxPvdSceneFlags); + + /// Retrieves the PVD flags. See PxPvdSceneFlags. + pub fn PxPvdSceneClient_getScenePvdFlags(self_: *const PxPvdSceneClient) -> PxPvdSceneFlags; + + /// update camera on PVD application's render window + pub fn PxPvdSceneClient_updateCamera_mut(self_: *mut PxPvdSceneClient, name: *const std::ffi::c_char, origin: *const PxVec3, up: *const PxVec3, target: *const PxVec3); + + /// draw points on PVD application's render window + pub fn PxPvdSceneClient_drawPoints_mut(self_: *mut PxPvdSceneClient, points: *const PxDebugPoint, count: u32); + + /// draw lines on PVD application's render window + pub fn PxPvdSceneClient_drawLines_mut(self_: *mut PxPvdSceneClient, lines: *const PxDebugLine, count: u32); + + /// draw triangles on PVD application's render window + pub fn PxPvdSceneClient_drawTriangles_mut(self_: *mut PxPvdSceneClient, triangles: *const PxDebugTriangle, count: u32); + + /// draw text on PVD application's render window + pub fn PxPvdSceneClient_drawText_mut(self_: *mut PxPvdSceneClient, text: *const PxDebugText); + + pub fn PxDominanceGroupPair_new(a: u8, b: u8) -> PxDominanceGroupPair; + + pub fn PxBroadPhaseCallback_delete(self_: *mut PxBroadPhaseCallback); + + /// Out-of-bounds notification. + /// + /// This function is called when an object leaves the broad-phase. + pub fn PxBroadPhaseCallback_onObjectOutOfBounds_mut(self_: *mut PxBroadPhaseCallback, shape: *mut PxShape, actor: *mut PxActor); + + /// Out-of-bounds notification. + /// + /// This function is called when an aggregate leaves the broad-phase. + pub fn PxBroadPhaseCallback_onObjectOutOfBounds_mut_1(self_: *mut PxBroadPhaseCallback, aggregate: *mut PxAggregate); + + /// Deletes the scene. + /// + /// Removes any actors and constraint shaders from this scene + /// (if the user hasn't already done so). + /// + /// Be sure to not keep a reference to this object after calling release. + /// Avoid release calls while the scene is simulating (in between simulate() and fetchResults() calls). + pub fn PxScene_release_mut(self_: *mut PxScene); + + /// Sets a scene flag. You can only set one flag at a time. + /// + /// Not all flags are mutable and changing some will result in an error. Please check [`PxSceneFlag`] to see which flags can be changed. + pub fn PxScene_setFlag_mut(self_: *mut PxScene, flag: PxSceneFlag, value: bool); + + /// Get the scene flags. + /// + /// The scene flags. See [`PxSceneFlag`] + pub fn PxScene_getFlags(self_: *const PxScene) -> PxSceneFlags; + + /// Set new scene limits. + /// + /// Increase the maximum capacity of various data structures in the scene. The new capacities will be + /// at least as large as required to deal with the objects currently in the scene. Further, these values + /// are for preallocation and do not represent hard limits. + pub fn PxScene_setLimits_mut(self_: *mut PxScene, limits: *const PxSceneLimits); + + /// Get current scene limits. + /// + /// Current scene limits. + pub fn PxScene_getLimits(self_: *const PxScene) -> PxSceneLimits; + + /// Call this method to retrieve the Physics SDK. + /// + /// The physics SDK this scene is associated with. + pub fn PxScene_getPhysics_mut(self_: *mut PxScene) -> *mut PxPhysics; + + /// Retrieves the scene's internal timestamp, increased each time a simulation step is completed. + /// + /// scene timestamp + pub fn PxScene_getTimestamp(self_: *const PxScene) -> u32; + + /// Adds an articulation to this scene. + /// + /// If the articulation is already assigned to a scene (see [`PxArticulationReducedCoordinate::getScene`]), the call is ignored and an error is issued. + /// + /// True if success + pub fn PxScene_addArticulation_mut(self_: *mut PxScene, articulation: *mut PxArticulationReducedCoordinate) -> bool; + + /// Removes an articulation from this scene. + /// + /// If the articulation is not part of this scene (see [`PxArticulationReducedCoordinate::getScene`]), the call is ignored and an error is issued. + /// + /// If the articulation is in an aggregate it will be removed from the aggregate. + pub fn PxScene_removeArticulation_mut(self_: *mut PxScene, articulation: *mut PxArticulationReducedCoordinate, wakeOnLostTouch: bool); + + /// Adds an actor to this scene. + /// + /// If the actor is already assigned to a scene (see [`PxActor::getScene`]), the call is ignored and an error is issued. + /// + /// If the actor has an invalid constraint, in checked builds the call is ignored and an error is issued. + /// + /// You can not add individual articulation links (see [`PxArticulationLink`]) to the scene. Use #addArticulation() instead. + /// + /// If the actor is a PxRigidActor then each assigned PxConstraint object will get added to the scene automatically if + /// it connects to another actor that is part of the scene already. + /// + /// When a BVH is provided the actor shapes are grouped together. + /// The scene query pruning structure inside PhysX SDK will store/update one + /// bound per actor. The scene queries against such an actor will query actor + /// bounds and then make a local space query against the provided BVH, which is in actor's local space. + /// + /// True if success + pub fn PxScene_addActor_mut(self_: *mut PxScene, actor: *mut PxActor, bvh: *const PxBVH) -> bool; + + /// Adds actors to this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + /// + /// This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use addActor() instead. + /// For articulation links, use addArticulation(). + /// + /// If one of the actors is already assigned to a scene (see [`PxActor::getScene`]), the call is ignored and an error is issued. + /// + /// If an actor in the array contains an invalid constraint, in checked builds the call is ignored and an error is issued. + /// + /// If an actor in the array is a PxRigidActor then each assigned PxConstraint object will get added to the scene automatically if + /// it connects to another actor that is part of the scene already. + /// + /// this method is optimized for high performance. + /// + /// True if success + pub fn PxScene_addActors_mut(self_: *mut PxScene, actors: *const *mut PxActor, nbActors: u32) -> bool; + + /// Adds a pruning structure together with its actors to this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + /// + /// This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use addActor() instead. + /// For articulation links, use addArticulation(). + /// + /// If an actor in the pruning structure contains an invalid constraint, in checked builds the call is ignored and an error is issued. + /// + /// For all actors in the pruning structure each assigned PxConstraint object will get added to the scene automatically if + /// it connects to another actor that is part of the scene already. + /// + /// This method is optimized for high performance. + /// + /// Merging a PxPruningStructure into an active scene query optimization AABB tree might unbalance the tree. A typical use case for + /// PxPruningStructure is a large world scenario where blocks of closely positioned actors get streamed in. The merge process finds the + /// best node in the active scene query optimization AABB tree and inserts the PxPruningStructure. Therefore using PxPruningStructure + /// for actors scattered throughout the world will result in an unbalanced tree. + /// + /// True if success + pub fn PxScene_addActors_mut_1(self_: *mut PxScene, pruningStructure: *const PxPruningStructure) -> bool; + + /// Removes an actor from this scene. + /// + /// If the actor is not part of this scene (see [`PxActor::getScene`]), the call is ignored and an error is issued. + /// + /// You can not remove individual articulation links (see [`PxArticulationLink`]) from the scene. Use #removeArticulation() instead. + /// + /// If the actor is a PxRigidActor then all assigned PxConstraint objects will get removed from the scene automatically. + /// + /// If the actor is in an aggregate it will be removed from the aggregate. + pub fn PxScene_removeActor_mut(self_: *mut PxScene, actor: *mut PxActor, wakeOnLostTouch: bool); + + /// Removes actors from this scene. Only supports actors of type PxRigidStatic and PxRigidDynamic. + /// + /// This method only supports actors of type PxRigidStatic and PxRigidDynamic. For other actors, use removeActor() instead. + /// For articulation links, use removeArticulation(). + /// + /// If some actor is not part of this scene (see [`PxActor::getScene`]), the actor remove is ignored and an error is issued. + /// + /// You can not remove individual articulation links (see [`PxArticulationLink`]) from the scene. Use #removeArticulation() instead. + /// + /// If the actor is a PxRigidActor then all assigned PxConstraint objects will get removed from the scene automatically. + pub fn PxScene_removeActors_mut(self_: *mut PxScene, actors: *const *mut PxActor, nbActors: u32, wakeOnLostTouch: bool); + + /// Adds an aggregate to this scene. + /// + /// If the aggregate is already assigned to a scene (see [`PxAggregate::getScene`]), the call is ignored and an error is issued. + /// + /// If the aggregate contains an actor with an invalid constraint, in checked builds the call is ignored and an error is issued. + /// + /// If the aggregate already contains actors, those actors are added to the scene as well. + /// + /// True if success + pub fn PxScene_addAggregate_mut(self_: *mut PxScene, aggregate: *mut PxAggregate) -> bool; + + /// Removes an aggregate from this scene. + /// + /// If the aggregate is not part of this scene (see [`PxAggregate::getScene`]), the call is ignored and an error is issued. + /// + /// If the aggregate contains actors, those actors are removed from the scene as well. + pub fn PxScene_removeAggregate_mut(self_: *mut PxScene, aggregate: *mut PxAggregate, wakeOnLostTouch: bool); + + /// Adds objects in the collection to this scene. + /// + /// This function adds the following types of objects to this scene: PxRigidActor (except PxArticulationLink), PxAggregate, PxArticulationReducedCoordinate. + /// This method is typically used after deserializing the collection in order to populate the scene with deserialized objects. + /// + /// If the collection contains an actor with an invalid constraint, in checked builds the call is ignored and an error is issued. + /// + /// True if success + pub fn PxScene_addCollection_mut(self_: *mut PxScene, collection: *const PxCollection) -> bool; + + /// Retrieve the number of actors of certain types in the scene. For supported types, see PxActorTypeFlags. + /// + /// the number of actors. + pub fn PxScene_getNbActors(self_: *const PxScene, types: PxActorTypeFlags) -> u32; + + /// Retrieve an array of all the actors of certain types in the scene. For supported types, see PxActorTypeFlags. + /// + /// Number of actors written to the buffer. + pub fn PxScene_getActors(self_: *const PxScene, types: PxActorTypeFlags, userBuffer: *mut *mut PxActor, bufferSize: u32, startIndex: u32) -> u32; + + /// Queries the PxScene for a list of the PxActors whose transforms have been + /// updated during the previous simulation step. Only includes actors of type PxRigidDynamic and PxArticulationLink. + /// + /// PxSceneFlag::eENABLE_ACTIVE_ACTORS must be set. + /// + /// Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored and NULL will be returned. + /// + /// A pointer to the list of active PxActors generated during the last call to fetchResults(). + pub fn PxScene_getActiveActors_mut(self_: *mut PxScene, nbActorsOut: *mut u32) -> *mut *mut PxActor; + + /// Returns the number of articulations in the scene. + /// + /// the number of articulations in this scene. + pub fn PxScene_getNbArticulations(self_: *const PxScene) -> u32; + + /// Retrieve all the articulations in the scene. + /// + /// Number of articulations written to the buffer. + pub fn PxScene_getArticulations(self_: *const PxScene, userBuffer: *mut *mut PxArticulationReducedCoordinate, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of constraint shaders in the scene. + /// + /// the number of constraint shaders in this scene. + pub fn PxScene_getNbConstraints(self_: *const PxScene) -> u32; + + /// Retrieve all the constraint shaders in the scene. + /// + /// Number of constraint shaders written to the buffer. + pub fn PxScene_getConstraints(self_: *const PxScene, userBuffer: *mut *mut PxConstraint, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of aggregates in the scene. + /// + /// the number of aggregates in this scene. + pub fn PxScene_getNbAggregates(self_: *const PxScene) -> u32; + + /// Retrieve all the aggregates in the scene. + /// + /// Number of aggregates written to the buffer. + pub fn PxScene_getAggregates(self_: *const PxScene, userBuffer: *mut *mut PxAggregate, bufferSize: u32, startIndex: u32) -> u32; + + /// Specifies the dominance behavior of contacts between two actors with two certain dominance groups. + /// + /// It is possible to assign each actor to a dominance groups using [`PxActor::setDominanceGroup`](). + /// + /// With dominance groups one can have all contacts created between actors act in one direction only. This is useful, for example, if you + /// want an object to push debris out of its way and be unaffected,while still responding physically to forces and collisions + /// with non-debris objects. + /// + /// Whenever a contact between two actors (a0, a1) needs to be solved, the groups (g0, g1) of both + /// actors are retrieved. Then the PxDominanceGroupPair setting for this group pair is retrieved with getDominanceGroupPair(g0, g1). + /// + /// In the contact, PxDominanceGroupPair::dominance0 becomes the dominance setting for a0, and + /// PxDominanceGroupPair::dominance1 becomes the dominance setting for a1. A dominanceN setting of 1.0f, the default, + /// will permit aN to be pushed or pulled by a(1-N) through the contact. A dominanceN setting of 0.0f, will however + /// prevent aN to be pushed by a(1-N) via the contact. Thus, a PxDominanceGroupPair of (1.0f, 0.0f) makes + /// the interaction one-way. + /// + /// The matrix sampled by getDominanceGroupPair(g1, g2) is initialised by default such that: + /// + /// if g1 == g2, then (1.0f, 1.0f) is returned + /// if g1 + /// < + /// g2, then (0.0f, 1.0f) is returned + /// if g1 > g2, then (1.0f, 0.0f) is returned + /// + /// In other words, we permit actors in higher groups to be pushed around by actors in lower groups by default. + /// + /// These settings should cover most applications, and in fact not overriding these settings may likely result in higher performance. + /// + /// It is not possible to make the matrix asymetric, or to change the diagonal. In other words: + /// + /// it is not possible to change (g1, g2) if (g1==g2) + /// if you set + /// + /// (g1, g2) to X, then (g2, g1) will implicitly and automatically be set to ~X, where: + /// + /// ~(1.0f, 1.0f) is (1.0f, 1.0f) + /// ~(0.0f, 1.0f) is (1.0f, 0.0f) + /// ~(1.0f, 0.0f) is (0.0f, 1.0f) + /// + /// These two restrictions are to make sure that contacts between two actors will always evaluate to the same dominance + /// setting, regardless of the order of the actors. + /// + /// Dominance settings are currently specified as floats 0.0f or 1.0f because in the future we may permit arbitrary + /// fractional settings to express 'partly-one-way' interactions. + /// + /// Sleeping: + /// Does + /// NOT + /// wake actors up automatically. + pub fn PxScene_setDominanceGroupPair_mut(self_: *mut PxScene, group1: u8, group2: u8, dominance: *const PxDominanceGroupPair); + + /// Samples the dominance matrix. + pub fn PxScene_getDominanceGroupPair(self_: *const PxScene, group1: u8, group2: u8) -> PxDominanceGroupPair; + + /// Return the cpu dispatcher that was set in PxSceneDesc::cpuDispatcher when creating the scene with PxPhysics::createScene + pub fn PxScene_getCpuDispatcher(self_: *const PxScene) -> *mut PxCpuDispatcher; + + /// Reserves a new client ID. + /// + /// PX_DEFAULT_CLIENT is always available as the default clientID. + /// Additional clients are returned by this function. Clients cannot be released once created. + /// An error is reported when more than a supported number of clients (currently 128) are created. + pub fn PxScene_createClient_mut(self_: *mut PxScene) -> u8; + + /// Sets a user notify object which receives special simulation events when they occur. + /// + /// Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_setSimulationEventCallback_mut(self_: *mut PxScene, callback: *mut PxSimulationEventCallback); + + /// Retrieves the simulationEventCallback pointer set with setSimulationEventCallback(). + /// + /// The current user notify pointer. See [`PxSimulationEventCallback`]. + pub fn PxScene_getSimulationEventCallback(self_: *const PxScene) -> *mut PxSimulationEventCallback; + + /// Sets a user callback object, which receives callbacks on all contacts generated for specified actors. + /// + /// Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_setContactModifyCallback_mut(self_: *mut PxScene, callback: *mut PxContactModifyCallback); + + /// Sets a user callback object, which receives callbacks on all CCD contacts generated for specified actors. + /// + /// Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_setCCDContactModifyCallback_mut(self_: *mut PxScene, callback: *mut PxCCDContactModifyCallback); + + /// Retrieves the PxContactModifyCallback pointer set with setContactModifyCallback(). + /// + /// The current user contact modify callback pointer. See [`PxContactModifyCallback`]. + pub fn PxScene_getContactModifyCallback(self_: *const PxScene) -> *mut PxContactModifyCallback; + + /// Retrieves the PxCCDContactModifyCallback pointer set with setContactModifyCallback(). + /// + /// The current user contact modify callback pointer. See [`PxContactModifyCallback`]. + pub fn PxScene_getCCDContactModifyCallback(self_: *const PxScene) -> *mut PxCCDContactModifyCallback; + + /// Sets a broad-phase user callback object. + /// + /// Do not set the callback while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_setBroadPhaseCallback_mut(self_: *mut PxScene, callback: *mut PxBroadPhaseCallback); + + /// Retrieves the PxBroadPhaseCallback pointer set with setBroadPhaseCallback(). + /// + /// The current broad-phase callback pointer. See [`PxBroadPhaseCallback`]. + pub fn PxScene_getBroadPhaseCallback(self_: *const PxScene) -> *mut PxBroadPhaseCallback; + + /// Sets the shared global filter data which will get passed into the filter shader. + /// + /// It is the user's responsibility to ensure that changing the shared global filter data does not change the filter output value for existing pairs. + /// If the filter output for existing pairs does change nonetheless then such a change will not take effect until the pair gets refiltered. + /// resetFiltering() can be used to explicitly refilter the pairs of specific objects. + /// + /// The provided data will get copied to internal buffers and this copy will be used for filtering calls. + /// + /// Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_setFilterShaderData_mut(self_: *mut PxScene, data: *const std::ffi::c_void, dataSize: u32); + + /// Gets the shared global filter data in use for this scene. + /// + /// The reference points to a copy of the original filter data specified in [`PxSceneDesc`].filterShaderData or provided by #setFilterShaderData(). + /// + /// Shared filter data for filter shader. + pub fn PxScene_getFilterShaderData(self_: *const PxScene) -> *const std::ffi::c_void; + + /// Gets the size of the shared global filter data ([`PxSceneDesc`].filterShaderData) + /// + /// Size of shared filter data [bytes]. + pub fn PxScene_getFilterShaderDataSize(self_: *const PxScene) -> u32; + + /// Marks the object to reset interactions and re-run collision filters in the next simulation step. + /// + /// This call forces the object to remove all existing collision interactions, to search anew for existing contact + /// pairs and to run the collision filters again for found collision pairs. + /// + /// The operation is supported for PxRigidActor objects only. + /// + /// All persistent state of existing interactions will be lost and can not be retrieved even if the same collison pair + /// is found again in the next step. This will mean, for example, that you will not get notified about persistent contact + /// for such an interaction (see [`PxPairFlag::eNOTIFY_TOUCH_PERSISTS`]), the contact pair will be interpreted as newly found instead. + /// + /// Lost touch contact reports will be sent for every collision pair which includes this shape, if they have + /// been requested through [`PxPairFlag::eNOTIFY_TOUCH_LOST`] or #PxPairFlag::eNOTIFY_THRESHOLD_FORCE_LOST. + /// + /// This is an expensive operation, don't use it if you don't have to. + /// + /// Can be used to retrieve collision pairs that were killed by the collision filters (see [`PxFilterFlag::eKILL`]) + /// + /// It is invalid to use this method if the actor has not been added to a scene already. + /// + /// It is invalid to use this method if PxActorFlag::eDISABLE_SIMULATION is set. + /// + /// Do not use this method while the simulation is running. + /// + /// Sleeping: + /// Does wake up the actor. + /// + /// True if success + pub fn PxScene_resetFiltering_mut(self_: *mut PxScene, actor: *mut PxActor) -> bool; + + /// Marks the object to reset interactions and re-run collision filters for specified shapes in the next simulation step. + /// + /// This is a specialization of the resetFiltering(PxActor + /// & + /// actor) method and allows to reset interactions for specific shapes of + /// a PxRigidActor. + /// + /// Do not use this method while the simulation is running. + /// + /// Sleeping: + /// Does wake up the actor. + pub fn PxScene_resetFiltering_mut_1(self_: *mut PxScene, actor: *mut PxRigidActor, shapes: *const *mut PxShape, shapeCount: u32) -> bool; + + /// Gets the pair filtering mode for kinematic-kinematic pairs. + /// + /// Filtering mode for kinematic-kinematic pairs. + pub fn PxScene_getKinematicKinematicFilteringMode(self_: *const PxScene) -> PxPairFilteringMode; + + /// Gets the pair filtering mode for static-kinematic pairs. + /// + /// Filtering mode for static-kinematic pairs. + pub fn PxScene_getStaticKinematicFilteringMode(self_: *const PxScene) -> PxPairFilteringMode; + + /// Advances the simulation by an elapsedTime time. + /// + /// Large elapsedTime values can lead to instabilities. In such cases elapsedTime + /// should be subdivided into smaller time intervals and simulate() should be called + /// multiple times for each interval. + /// + /// Calls to simulate() should pair with calls to fetchResults(): + /// Each fetchResults() invocation corresponds to exactly one simulate() + /// invocation; calling simulate() twice without an intervening fetchResults() + /// or fetchResults() twice without an intervening simulate() causes an error + /// condition. + /// + /// scene->simulate(); + /// ...do some processing until physics is computed... + /// scene->fetchResults(); + /// ...now results of run may be retrieved. + /// + /// True if success + pub fn PxScene_simulate_mut(self_: *mut PxScene, elapsedTime: f32, completionTask: *mut PxBaseTask, scratchMemBlock: *mut std::ffi::c_void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool; + + /// Performs dynamics phase of the simulation pipeline. + /// + /// Calls to advance() should follow calls to fetchCollision(). An error message will be issued if this sequence is not followed. + /// + /// True if success + pub fn PxScene_advance_mut(self_: *mut PxScene, completionTask: *mut PxBaseTask) -> bool; + + /// Performs collision detection for the scene over elapsedTime + /// + /// Calls to collide() should be the first method called to simulate a frame. + /// + /// True if success + pub fn PxScene_collide_mut(self_: *mut PxScene, elapsedTime: f32, completionTask: *mut PxBaseTask, scratchMemBlock: *mut std::ffi::c_void, scratchMemBlockSize: u32, controlSimulation: bool) -> bool; + + /// This checks to see if the simulation run has completed. + /// + /// This does not cause the data available for reading to be updated with the results of the simulation, it is simply a status check. + /// The bool will allow it to either return immediately or block waiting for the condition to be met so that it can return true + /// + /// True if the results are available. + pub fn PxScene_checkResults_mut(self_: *mut PxScene, block: bool) -> bool; + + /// This method must be called after collide() and before advance(). It will wait for the collision phase to finish. If the user makes an illegal simulation call, the SDK will issue an error + /// message. + pub fn PxScene_fetchCollision_mut(self_: *mut PxScene, block: bool) -> bool; + + /// This is the big brother to checkResults() it basically does the following: + /// + /// True if the results have been fetched. + pub fn PxScene_fetchResults_mut(self_: *mut PxScene, block: bool, errorState: *mut u32) -> bool; + + /// This call performs the first section of fetchResults, and returns a pointer to the contact streams output by the simulation. It can be used to process contact pairs in parallel, which is often a limiting factor + /// for fetchResults() performance. + /// + /// After calling this function and processing the contact streams, call fetchResultsFinish(). Note that writes to the simulation are not + /// permitted between the start of fetchResultsStart() and the end of fetchResultsFinish(). + /// + /// True if the results have been fetched. + pub fn PxScene_fetchResultsStart_mut(self_: *mut PxScene, contactPairs: *mut *const PxContactPairHeader, nbContactPairs: *mut u32, block: bool) -> bool; + + /// This call processes all event callbacks in parallel. It takes a continuation task, which will be executed once all callbacks have been processed. + /// + /// This is a utility function to make it easier to process callbacks in parallel using the PhysX task system. It can only be used in conjunction with + /// fetchResultsStart(...) and fetchResultsFinish(...) + pub fn PxScene_processCallbacks_mut(self_: *mut PxScene, continuation: *mut PxBaseTask); + + /// This call performs the second section of fetchResults. + /// + /// It must be called after fetchResultsStart() returns and contact reports have been processed. + /// + /// Note that once fetchResultsFinish() has been called, the contact streams returned in fetchResultsStart() will be invalid. + pub fn PxScene_fetchResultsFinish_mut(self_: *mut PxScene, errorState: *mut u32); + + /// This call performs the synchronization of particle system data copies. + pub fn PxScene_fetchResultsParticleSystem_mut(self_: *mut PxScene); + + /// Clear internal buffers and free memory. + /// + /// This method can be used to clear buffers and free internal memory without having to destroy the scene. Can be useful if + /// the physics data gets streamed in and a checkpoint with a clean state should be created. + /// + /// It is not allowed to call this method while the simulation is running. The call will fail. + pub fn PxScene_flushSimulation_mut(self_: *mut PxScene, sendPendingReports: bool); + + /// Sets a constant gravity for the entire scene. + /// + /// Do not use this method while the simulation is running. + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + pub fn PxScene_setGravity_mut(self_: *mut PxScene, vec: *const PxVec3); + + /// Retrieves the current gravity setting. + /// + /// The current gravity for the scene. + pub fn PxScene_getGravity(self_: *const PxScene) -> PxVec3; + + /// Set the bounce threshold velocity. Collision speeds below this threshold will not cause a bounce. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setBounceThresholdVelocity_mut(self_: *mut PxScene, t: f32); + + /// Return the bounce threshold velocity. + pub fn PxScene_getBounceThresholdVelocity(self_: *const PxScene) -> f32; + + /// Sets the maximum number of CCD passes + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setCCDMaxPasses_mut(self_: *mut PxScene, ccdMaxPasses: u32); + + /// Gets the maximum number of CCD passes. + /// + /// The maximum number of CCD passes. + pub fn PxScene_getCCDMaxPasses(self_: *const PxScene) -> u32; + + /// Set the maximum CCD separation. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setCCDMaxSeparation_mut(self_: *mut PxScene, t: f32); + + /// Gets the maximum CCD separation. + /// + /// The maximum CCD separation. + pub fn PxScene_getCCDMaxSeparation(self_: *const PxScene) -> f32; + + /// Set the CCD threshold. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setCCDThreshold_mut(self_: *mut PxScene, t: f32); + + /// Gets the CCD threshold. + /// + /// The CCD threshold. + pub fn PxScene_getCCDThreshold(self_: *const PxScene) -> f32; + + /// Set the max bias coefficient. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setMaxBiasCoefficient_mut(self_: *mut PxScene, t: f32); + + /// Gets the max bias coefficient. + /// + /// The max bias coefficient. + pub fn PxScene_getMaxBiasCoefficient(self_: *const PxScene) -> f32; + + /// Set the friction offset threshold. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setFrictionOffsetThreshold_mut(self_: *mut PxScene, t: f32); + + /// Gets the friction offset threshold. + pub fn PxScene_getFrictionOffsetThreshold(self_: *const PxScene) -> f32; + + /// Set the friction correlation distance. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setFrictionCorrelationDistance_mut(self_: *mut PxScene, t: f32); + + /// Gets the friction correlation distance. + pub fn PxScene_getFrictionCorrelationDistance(self_: *const PxScene) -> f32; + + /// Return the friction model. + pub fn PxScene_getFrictionType(self_: *const PxScene) -> PxFrictionType; + + /// Return the solver model. + pub fn PxScene_getSolverType(self_: *const PxScene) -> PxSolverType; + + /// Function that lets you set debug visualization parameters. + /// + /// Returns false if the value passed is out of range for usage specified by the enum. + /// + /// Do not use this method while the simulation is running. + /// + /// False if the parameter is out of range. + pub fn PxScene_setVisualizationParameter_mut(self_: *mut PxScene, param: PxVisualizationParameter, value: f32) -> bool; + + /// Function that lets you query debug visualization parameters. + /// + /// The value of the parameter. + pub fn PxScene_getVisualizationParameter(self_: *const PxScene, paramEnum: PxVisualizationParameter) -> f32; + + /// Defines a box in world space to which visualization geometry will be (conservatively) culled. Use a non-empty culling box to enable the feature, and an empty culling box to disable it. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setVisualizationCullingBox_mut(self_: *mut PxScene, box_: *const PxBounds3); + + /// Retrieves the visualization culling box. + /// + /// the box to which the geometry will be culled. + pub fn PxScene_getVisualizationCullingBox(self_: *const PxScene) -> PxBounds3; + + /// Retrieves the render buffer. + /// + /// This will contain the results of any active visualization for this scene. + /// + /// Do not use this method while the simulation is running. Calls to this method while the simulation is running will result in undefined behaviour. + /// + /// The render buffer. + pub fn PxScene_getRenderBuffer_mut(self_: *mut PxScene) -> *const PxRenderBuffer; + + /// Call this method to retrieve statistics for the current simulation step. + /// + /// Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + pub fn PxScene_getSimulationStatistics(self_: *const PxScene, stats: *mut PxSimulationStatistics); + + /// Returns broad-phase type. + /// + /// Broad-phase type + pub fn PxScene_getBroadPhaseType(self_: *const PxScene) -> PxBroadPhaseType; + + /// Gets broad-phase caps. + /// + /// True if success + pub fn PxScene_getBroadPhaseCaps(self_: *const PxScene, caps: *mut PxBroadPhaseCaps) -> bool; + + /// Returns number of regions currently registered in the broad-phase. + /// + /// Number of regions + pub fn PxScene_getNbBroadPhaseRegions(self_: *const PxScene) -> u32; + + /// Gets broad-phase regions. + /// + /// Number of written out regions + pub fn PxScene_getBroadPhaseRegions(self_: *const PxScene, userBuffer: *mut PxBroadPhaseRegionInfo, bufferSize: u32, startIndex: u32) -> u32; + + /// Adds a new broad-phase region. + /// + /// The bounds for the new region must be non-empty, otherwise an error occurs and the call is ignored. + /// + /// Note that by default, objects already existing in the SDK that might touch this region will not be automatically + /// added to the region. In other words the newly created region will be empty, and will only be populated with new + /// objects when they are added to the simulation, or with already existing objects when they are updated. + /// + /// It is nonetheless possible to override this default behavior and let the SDK populate the new region automatically + /// with already existing objects overlapping the incoming region. This has a cost though, and it should only be used + /// when the game can not guarantee that all objects within the new region will be added to the simulation after the + /// region itself. + /// + /// Objects automatically move from one region to another during their lifetime. The system keeps tracks of what + /// regions a given object is in. It is legal for an object to be in an arbitrary number of regions. However if an + /// object leaves all regions, or is created outside of all regions, several things happen: + /// - collisions get disabled for this object + /// - if a PxBroadPhaseCallback object is provided, an "out-of-bounds" event is generated via that callback + /// - if a PxBroadPhaseCallback object is not provided, a warning/error message is sent to the error stream + /// + /// If an object goes out-of-bounds and user deletes it during the same frame, neither the out-of-bounds event nor the + /// error message is generated. + /// + /// Handle for newly created region, or 0xffffffff in case of failure. + pub fn PxScene_addBroadPhaseRegion_mut(self_: *mut PxScene, region: *const PxBroadPhaseRegion, populateRegion: bool) -> u32; + + /// Removes a new broad-phase region. + /// + /// If the region still contains objects, and if those objects do not overlap any region any more, they are not + /// automatically removed from the simulation. Instead, the PxBroadPhaseCallback::onObjectOutOfBounds notification + /// is used for each object. Users are responsible for removing the objects from the simulation if this is the + /// desired behavior. + /// + /// If the handle is invalid, or if a valid handle is removed twice, an error message is sent to the error stream. + /// + /// True if success + pub fn PxScene_removeBroadPhaseRegion_mut(self_: *mut PxScene, handle: u32) -> bool; + + /// Get the task manager associated with this scene + /// + /// the task manager associated with the scene + pub fn PxScene_getTaskManager(self_: *const PxScene) -> *mut PxTaskManager; + + /// Lock the scene for reading from the calling thread. + /// + /// When the PxSceneFlag::eREQUIRE_RW_LOCK flag is enabled lockRead() must be + /// called before any read calls are made on the scene. + /// + /// Multiple threads may read at the same time, no threads may read while a thread is writing. + /// If a call to lockRead() is made while another thread is holding a write lock + /// then the calling thread will be blocked until the writing thread calls unlockWrite(). + /// + /// Lock upgrading is *not* supported, that means it is an error to + /// call lockRead() followed by lockWrite(). + /// + /// Recursive locking is supported but each lockRead() call must be paired with an unlockRead(). + pub fn PxScene_lockRead_mut(self_: *mut PxScene, file: *const std::ffi::c_char, line: u32); + + /// Unlock the scene from reading. + /// + /// Each unlockRead() must be paired with a lockRead() from the same thread. + pub fn PxScene_unlockRead_mut(self_: *mut PxScene); + + /// Lock the scene for writing from this thread. + /// + /// When the PxSceneFlag::eREQUIRE_RW_LOCK flag is enabled lockWrite() must be + /// called before any write calls are made on the scene. + /// + /// Only one thread may write at a time and no threads may read while a thread is writing. + /// If a call to lockWrite() is made and there are other threads reading then the + /// calling thread will be blocked until the readers complete. + /// + /// Writers have priority. If a thread is blocked waiting to write then subsequent calls to + /// lockRead() from other threads will be blocked until the writer completes. + /// + /// If multiple threads are waiting to write then the thread that is first + /// granted access depends on OS scheduling. + /// + /// Recursive locking is supported but each lockWrite() call must be paired + /// with an unlockWrite(). + /// + /// If a thread has already locked the scene for writing then it may call + /// lockRead(). + pub fn PxScene_lockWrite_mut(self_: *mut PxScene, file: *const std::ffi::c_char, line: u32); + + /// Unlock the scene from writing. + /// + /// Each unlockWrite() must be paired with a lockWrite() from the same thread. + pub fn PxScene_unlockWrite_mut(self_: *mut PxScene); + + /// set the cache blocks that can be used during simulate(). + /// + /// Each frame the simulation requires memory to store contact, friction, and contact cache data. This memory is used in blocks of 16K. + /// Each frame the blocks used by the previous frame are freed, and may be retrieved by the application using PxScene::flushSimulation() + /// + /// This call will force allocation of cache blocks if the numBlocks parameter is greater than the currently allocated number + /// of blocks, and less than the max16KContactDataBlocks parameter specified at scene creation time. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setNbContactDataBlocks_mut(self_: *mut PxScene, numBlocks: u32); + + /// get the number of cache blocks currently used by the scene + /// + /// This function may not be called while the scene is simulating + /// + /// the number of cache blocks currently used by the scene + pub fn PxScene_getNbContactDataBlocksUsed(self_: *const PxScene) -> u32; + + /// get the maximum number of cache blocks used by the scene + /// + /// This function may not be called while the scene is simulating + /// + /// the maximum number of cache blocks everused by the scene + pub fn PxScene_getMaxNbContactDataBlocksUsed(self_: *const PxScene) -> u32; + + /// Return the value of PxSceneDesc::contactReportStreamBufferSize that was set when creating the scene with PxPhysics::createScene + pub fn PxScene_getContactReportStreamBufferSize(self_: *const PxScene) -> u32; + + /// Sets the number of actors required to spawn a separate rigid body solver thread. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setSolverBatchSize_mut(self_: *mut PxScene, solverBatchSize: u32); + + /// Retrieves the number of actors required to spawn a separate rigid body solver thread. + /// + /// Current number of actors required to spawn a separate rigid body solver thread. + pub fn PxScene_getSolverBatchSize(self_: *const PxScene) -> u32; + + /// Sets the number of articulations required to spawn a separate rigid body solver thread. + /// + /// Do not use this method while the simulation is running. + pub fn PxScene_setSolverArticulationBatchSize_mut(self_: *mut PxScene, solverBatchSize: u32); + + /// Retrieves the number of articulations required to spawn a separate rigid body solver thread. + /// + /// Current number of articulations required to spawn a separate rigid body solver thread. + pub fn PxScene_getSolverArticulationBatchSize(self_: *const PxScene) -> u32; + + /// Returns the wake counter reset value. + /// + /// Wake counter reset value + pub fn PxScene_getWakeCounterResetValue(self_: *const PxScene) -> f32; + + /// Shift the scene origin by the specified vector. + /// + /// The poses of all objects in the scene and the corresponding data structures will get adjusted to reflect the new origin location + /// (the shift vector will get subtracted from all object positions). + /// + /// It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysX accordingly. + /// + /// Do not use this method while the simulation is running. Calls to this method while the simulation is running will be ignored. + /// + /// Make sure to propagate the origin shift to other dependent modules (for example, the character controller module etc.). + /// + /// This is an expensive operation and we recommend to use it only in the case where distance related precision issues may arise in areas far from the origin. + pub fn PxScene_shiftOrigin_mut(self_: *mut PxScene, shift: *const PxVec3); + + /// Returns the Pvd client associated with the scene. + /// + /// the client, NULL if no PVD supported. + pub fn PxScene_getScenePvdClient_mut(self_: *mut PxScene) -> *mut PxPvdSceneClient; + + /// Copy GPU articulation data from the internal GPU buffer to a user-provided device buffer. + pub fn PxScene_copyArticulationData_mut(self_: *mut PxScene, data: *mut std::ffi::c_void, index: *mut std::ffi::c_void, dataType: PxArticulationGpuDataType, nbCopyArticulations: u32, copyEvent: *mut std::ffi::c_void); + + /// Apply GPU articulation data from a user-provided device buffer to the internal GPU buffer. + pub fn PxScene_applyArticulationData_mut(self_: *mut PxScene, data: *mut std::ffi::c_void, index: *mut std::ffi::c_void, dataType: PxArticulationGpuDataType, nbUpdatedArticulations: u32, waitEvent: *mut std::ffi::c_void, signalEvent: *mut std::ffi::c_void); + + /// Copy GPU softbody data from the internal GPU buffer to a user-provided device buffer. + pub fn PxScene_copySoftBodyData_mut(self_: *mut PxScene, data: *mut *mut std::ffi::c_void, dataSizes: *mut std::ffi::c_void, softBodyIndices: *mut std::ffi::c_void, flag: PxSoftBodyDataFlag, nbCopySoftBodies: u32, maxSize: u32, copyEvent: *mut std::ffi::c_void); + + /// Apply user-provided data to the internal softbody system. + pub fn PxScene_applySoftBodyData_mut(self_: *mut PxScene, data: *mut *mut std::ffi::c_void, dataSizes: *mut std::ffi::c_void, softBodyIndices: *mut std::ffi::c_void, flag: PxSoftBodyDataFlag, nbUpdatedSoftBodies: u32, maxSize: u32, applyEvent: *mut std::ffi::c_void); + + /// Copy contact data from the internal GPU buffer to a user-provided device buffer. + /// + /// The contact data contains pointers to internal state and is only valid until the next call to simulate(). + pub fn PxScene_copyContactData_mut(self_: *mut PxScene, data: *mut std::ffi::c_void, maxContactPairs: u32, numContactPairs: *mut std::ffi::c_void, copyEvent: *mut std::ffi::c_void); + + /// Copy GPU rigid body data from the internal GPU buffer to a user-provided device buffer. + pub fn PxScene_copyBodyData_mut(self_: *mut PxScene, data: *mut PxGpuBodyData, index: *mut PxGpuActorPair, nbCopyActors: u32, copyEvent: *mut std::ffi::c_void); + + /// Apply user-provided data to rigid body. + pub fn PxScene_applyActorData_mut(self_: *mut PxScene, data: *mut std::ffi::c_void, index: *mut PxGpuActorPair, flag: PxActorCacheFlag, nbUpdatedActors: u32, waitEvent: *mut std::ffi::c_void, signalEvent: *mut std::ffi::c_void); + + /// Compute dense Jacobian matrices for specified articulations on the GPU. + /// + /// The size of Jacobians can vary by articulation, since it depends on the number of links, degrees-of-freedom, and whether the base is fixed. + /// + /// The size is determined using these formulas: + /// nCols = (fixedBase ? 0 : 6) + dofCount + /// nRows = (fixedBase ? 0 : 6) + (linkCount - 1) * 6; + /// + /// The user must ensure that adequate space is provided for each Jacobian matrix. + pub fn PxScene_computeDenseJacobians_mut(self_: *mut PxScene, indices: *const PxIndexDataPair, nbIndices: u32, computeEvent: *mut std::ffi::c_void); + + /// Compute the joint-space inertia matrices that maps joint accelerations to joint forces: forces = M * accelerations on the GPU. + /// + /// The size of matrices can vary by articulation, since it depends on the number of links and degrees-of-freedom. + /// + /// The size is determined using this formula: + /// sizeof(float) * dofCount * dofCount + /// + /// The user must ensure that adequate space is provided for each mass matrix. + pub fn PxScene_computeGeneralizedMassMatrices_mut(self_: *mut PxScene, indices: *const PxIndexDataPair, nbIndices: u32, computeEvent: *mut std::ffi::c_void); + + /// Computes the joint DOF forces required to counteract gravitational forces for the given articulation pose. + /// + /// The size of the result can vary by articulation, since it depends on the number of links and degrees-of-freedom. + /// + /// The size is determined using this formula: + /// sizeof(float) * dofCount + /// + /// The user must ensure that adequate space is provided for each articulation. + pub fn PxScene_computeGeneralizedGravityForces_mut(self_: *mut PxScene, indices: *const PxIndexDataPair, nbIndices: u32, computeEvent: *mut std::ffi::c_void); + + /// Computes the joint DOF forces required to counteract coriolis and centrifugal forces for the given articulation pose. + /// + /// The size of the result can vary by articulation, since it depends on the number of links and degrees-of-freedom. + /// + /// The size is determined using this formula: + /// sizeof(float) * dofCount + /// + /// The user must ensure that adequate space is provided for each articulation. + pub fn PxScene_computeCoriolisAndCentrifugalForces_mut(self_: *mut PxScene, indices: *const PxIndexDataPair, nbIndices: u32, computeEvent: *mut std::ffi::c_void); + + pub fn PxScene_getGpuDynamicsConfig(self_: *const PxScene) -> PxgDynamicsMemoryConfig; + + /// Apply user-provided data to particle buffers. + /// + /// This function should be used if the particle buffer flags are already on the device. Otherwise, use PxParticleBuffer::raiseFlags() + /// from the CPU. + /// + /// This assumes the data has been changed directly in the PxParticleBuffer. + pub fn PxScene_applyParticleBufferData_mut(self_: *mut PxScene, indices: *const u32, bufferIndexPair: *const PxGpuParticleBufferIndexPair, flags: *const PxParticleBufferFlags, nbUpdatedBuffers: u32, waitEvent: *mut std::ffi::c_void, signalEvent: *mut std::ffi::c_void); + + /// Constructor + pub fn PxSceneReadLock_new_alloc(scene: *mut PxScene, file: *const std::ffi::c_char, line: u32) -> *mut PxSceneReadLock; + + pub fn PxSceneReadLock_delete(self_: *mut PxSceneReadLock); + + /// Constructor + pub fn PxSceneWriteLock_new_alloc(scene: *mut PxScene, file: *const std::ffi::c_char, line: u32) -> *mut PxSceneWriteLock; + + pub fn PxSceneWriteLock_delete(self_: *mut PxSceneWriteLock); + + pub fn PxContactPairExtraDataItem_new() -> PxContactPairExtraDataItem; + + pub fn PxContactPairVelocity_new() -> PxContactPairVelocity; + + pub fn PxContactPairPose_new() -> PxContactPairPose; + + pub fn PxContactPairIndex_new() -> PxContactPairIndex; + + /// Constructor + pub fn PxContactPairExtraDataIterator_new(stream: *const u8, size: u32) -> PxContactPairExtraDataIterator; + + /// Advances the iterator to next set of extra data items. + /// + /// The contact pair extra data stream contains sets of items as requested by the corresponding [`PxPairFlag`] flags + /// [`PxPairFlag::ePRE_SOLVER_VELOCITY`], #PxPairFlag::ePOST_SOLVER_VELOCITY, #PxPairFlag::eCONTACT_EVENT_POSE. A set can contain one + /// item of each plus the PxContactPairIndex item. This method parses the stream and points the iterator + /// member variables to the corresponding items of the current set, if they are available. If CCD is not enabled, + /// you should only get one set of items. If CCD with multiple passes is enabled, you might get more than one item + /// set. + /// + /// Even though contact pair extra data is requested per shape pair, you will not get an item set per shape pair + /// but one per actor pair. If, for example, an actor has two shapes and both collide with another actor, then + /// there will only be one item set (since it applies to both shape pairs). + /// + /// True if there was another set of extra data items in the stream, else false. + pub fn PxContactPairExtraDataIterator_nextItemSet_mut(self_: *mut PxContactPairExtraDataIterator) -> bool; + + pub fn PxContactPairHeader_new() -> PxContactPairHeader; + + pub fn PxContactPair_new() -> PxContactPair; + + /// Extracts the contact points from the stream and stores them in a convenient format. + /// + /// Number of contact points written to the buffer. + pub fn PxContactPair_extractContacts(self_: *const PxContactPair, userBuffer: *mut PxContactPairPoint, bufferSize: u32) -> u32; + + /// Helper method to clone the contact pair and copy the contact data stream into a user buffer. + /// + /// The contact data stream is only accessible during the contact report callback. This helper function provides copy functionality + /// to buffer the contact stream information such that it can get accessed at a later stage. + pub fn PxContactPair_bufferContacts(self_: *const PxContactPair, newPair: *mut PxContactPair, bufferMemory: *mut u8); + + pub fn PxContactPair_getInternalFaceIndices(self_: *const PxContactPair) -> *const u32; + + pub fn PxTriggerPair_new() -> PxTriggerPair; + + pub fn PxConstraintInfo_new() -> PxConstraintInfo; + + pub fn PxConstraintInfo_new_1(c: *mut PxConstraint, extRef: *mut std::ffi::c_void, t: u32) -> PxConstraintInfo; + + /// This is called when a breakable constraint breaks. + /// + /// The user should not release the constraint shader inside this call! + /// + /// No event will get reported if the constraint breaks but gets deleted while the time step is still being simulated. + pub fn PxSimulationEventCallback_onConstraintBreak_mut(self_: *mut PxSimulationEventCallback, constraints: *mut PxConstraintInfo, count: u32); + + /// This is called with the actors which have just been woken up. + /// + /// Only supported by rigid bodies yet. + /// + /// Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + /// + /// Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + /// will get reported. For example, let us assume actor A is awake, then A->putToSleep() gets called, then later A->wakeUp() gets called. + /// At the next simulate/fetchResults() step only an onWake() event will get triggered because that was the last transition. + /// + /// If an actor gets newly added to a scene with properties such that it is awake and the sleep state does not get changed by + /// the user or simulation, then an onWake() event will get sent at the next simulate/fetchResults() step. + pub fn PxSimulationEventCallback_onWake_mut(self_: *mut PxSimulationEventCallback, actors: *mut *mut PxActor, count: u32); + + /// This is called with the actors which have just been put to sleep. + /// + /// Only supported by rigid bodies yet. + /// + /// Only called on actors for which the PxActorFlag eSEND_SLEEP_NOTIFIES has been set. + /// + /// Only the latest sleep state transition happening between fetchResults() of the previous frame and fetchResults() of the current frame + /// will get reported. For example, let us assume actor A is asleep, then A->wakeUp() gets called, then later A->putToSleep() gets called. + /// At the next simulate/fetchResults() step only an onSleep() event will get triggered because that was the last transition (assuming the simulation + /// does not wake the actor up). + /// + /// If an actor gets newly added to a scene with properties such that it is asleep and the sleep state does not get changed by + /// the user or simulation, then an onSleep() event will get sent at the next simulate/fetchResults() step. + pub fn PxSimulationEventCallback_onSleep_mut(self_: *mut PxSimulationEventCallback, actors: *mut *mut PxActor, count: u32); + + /// This is called when certain contact events occur. + /// + /// The method will be called for a pair of actors if one of the colliding shape pairs requested contact notification. + /// You request which events are reported using the filter shader/callback mechanism (see [`PxSimulationFilterShader`], + /// [`PxSimulationFilterCallback`], #PxPairFlag). + /// + /// Do not keep references to the passed objects, as they will be + /// invalid after this function returns. + pub fn PxSimulationEventCallback_onContact_mut(self_: *mut PxSimulationEventCallback, pairHeader: *const PxContactPairHeader, pairs: *const PxContactPair, nbPairs: u32); + + /// This is called with the current trigger pair events. + /// + /// Shapes which have been marked as triggers using PxShapeFlag::eTRIGGER_SHAPE will send events + /// according to the pair flag specification in the filter shader (see [`PxPairFlag`], #PxSimulationFilterShader). + /// + /// Trigger shapes will no longer send notification events for interactions with other trigger shapes. + pub fn PxSimulationEventCallback_onTrigger_mut(self_: *mut PxSimulationEventCallback, pairs: *mut PxTriggerPair, count: u32); + + /// Provides early access to the new pose of moving rigid bodies. + /// + /// When this call occurs, rigid bodies having the [`PxRigidBodyFlag::eENABLE_POSE_INTEGRATION_PREVIEW`] + /// flag set, were moved by the simulation and their new poses can be accessed through the provided buffers. + /// + /// The provided buffers are valid and can be read until the next call to [`PxScene::simulate`]() or #PxScene::collide(). + /// + /// This callback gets triggered while the simulation is running. If the provided rigid body references are used to + /// read properties of the object, then the callback has to guarantee no other thread is writing to the same body at the same + /// time. + /// + /// The code in this callback should be lightweight as it can block the simulation, that is, the + /// [`PxScene::fetchResults`]() call. + pub fn PxSimulationEventCallback_onAdvance_mut(self_: *mut PxSimulationEventCallback, bodyBuffer: *const *const PxRigidBody, poseBuffer: *const PxTransform, count: u32); + + pub fn PxSimulationEventCallback_delete(self_: *mut PxSimulationEventCallback); + + pub fn PxFEMParameters_new() -> PxFEMParameters; + + /// Release this object. + pub fn PxPruningStructure_release_mut(self_: *mut PxPruningStructure); + + /// Retrieve rigid actors in the pruning structure. + /// + /// You can retrieve the number of rigid actor pointers by calling [`getNbRigidActors`]() + /// + /// Number of rigid actor pointers written to the buffer. + pub fn PxPruningStructure_getRigidActors(self_: *const PxPruningStructure, userBuffer: *mut *mut PxRigidActor, bufferSize: u32, startIndex: u32) -> u32; + + /// Returns the number of rigid actors in the pruning structure. + /// + /// You can use [`getRigidActors`]() to retrieve the rigid actor pointers. + /// + /// Number of rigid actors in the pruning structure. + pub fn PxPruningStructure_getNbRigidActors(self_: *const PxPruningStructure) -> u32; + + /// Gets the merge data for static actors + /// + /// This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + /// with the internal data-structures of the scene-query system. + /// + /// Implementation-dependent merge data for static actors. + pub fn PxPruningStructure_getStaticMergeData(self_: *const PxPruningStructure) -> *const std::ffi::c_void; + + /// Gets the merge data for dynamic actors + /// + /// This is mainly called by the PxSceneQuerySystem::merge() function to merge a PxPruningStructure + /// with the internal data-structures of the scene-query system. + /// + /// Implementation-dependent merge data for dynamic actors. + pub fn PxPruningStructure_getDynamicMergeData(self_: *const PxPruningStructure) -> *const std::ffi::c_void; + + pub fn PxPruningStructure_getConcreteTypeName(self_: *const PxPruningStructure) -> *const std::ffi::c_char; + + pub fn PxExtendedVec3_new() -> PxExtendedVec3; + + pub fn PxExtendedVec3_new_1(_x: f64, _y: f64, _z: f64) -> PxExtendedVec3; + + pub fn PxExtendedVec3_isZero(self_: *const PxExtendedVec3) -> bool; + + pub fn PxExtendedVec3_dot(self_: *const PxExtendedVec3, v: *const PxVec3) -> f64; + + pub fn PxExtendedVec3_distanceSquared(self_: *const PxExtendedVec3, v: *const PxExtendedVec3) -> f64; + + pub fn PxExtendedVec3_magnitudeSquared(self_: *const PxExtendedVec3) -> f64; + + pub fn PxExtendedVec3_magnitude(self_: *const PxExtendedVec3) -> f64; + + pub fn PxExtendedVec3_normalize_mut(self_: *mut PxExtendedVec3) -> f64; + + pub fn PxExtendedVec3_isFinite(self_: *const PxExtendedVec3) -> bool; + + pub fn PxExtendedVec3_maximum_mut(self_: *mut PxExtendedVec3, v: *const PxExtendedVec3); + + pub fn PxExtendedVec3_minimum_mut(self_: *mut PxExtendedVec3, v: *const PxExtendedVec3); + + pub fn PxExtendedVec3_set_mut(self_: *mut PxExtendedVec3, x_: f64, y_: f64, z_: f64); + + pub fn PxExtendedVec3_setPlusInfinity_mut(self_: *mut PxExtendedVec3); + + pub fn PxExtendedVec3_setMinusInfinity_mut(self_: *mut PxExtendedVec3); + + pub fn PxExtendedVec3_cross_mut(self_: *mut PxExtendedVec3, left: *const PxExtendedVec3, right: *const PxVec3); + + pub fn PxExtendedVec3_cross_mut_1(self_: *mut PxExtendedVec3, left: *const PxExtendedVec3, right: *const PxExtendedVec3); + + pub fn PxExtendedVec3_cross(self_: *const PxExtendedVec3, v: *const PxExtendedVec3) -> PxExtendedVec3; + + pub fn PxExtendedVec3_cross_mut_2(self_: *mut PxExtendedVec3, left: *const PxVec3, right: *const PxExtendedVec3); + + pub fn phys_toVec3(v: *const PxExtendedVec3) -> PxVec3; + + pub fn PxObstacle_getType(self_: *const PxObstacle) -> PxGeometryType; + + pub fn PxBoxObstacle_new() -> PxBoxObstacle; + + pub fn PxCapsuleObstacle_new() -> PxCapsuleObstacle; + + /// Releases the context. + pub fn PxObstacleContext_release_mut(self_: *mut PxObstacleContext); + + /// Retrieves the controller manager associated with this context. + /// + /// The associated controller manager + pub fn PxObstacleContext_getControllerManager(self_: *const PxObstacleContext) -> *mut PxControllerManager; + + /// Adds an obstacle to the context. + /// + /// Handle for newly-added obstacle + pub fn PxObstacleContext_addObstacle_mut(self_: *mut PxObstacleContext, obstacle: *const PxObstacle) -> u32; + + /// Removes an obstacle from the context. + /// + /// True if success + pub fn PxObstacleContext_removeObstacle_mut(self_: *mut PxObstacleContext, handle: u32) -> bool; + + /// Updates data for an existing obstacle. + /// + /// True if success + pub fn PxObstacleContext_updateObstacle_mut(self_: *mut PxObstacleContext, handle: u32, obstacle: *const PxObstacle) -> bool; + + /// Retrieves number of obstacles in the context. + /// + /// Number of obstacles in the context + pub fn PxObstacleContext_getNbObstacles(self_: *const PxObstacleContext) -> u32; + + /// Retrieves desired obstacle. + /// + /// Desired obstacle + pub fn PxObstacleContext_getObstacle(self_: *const PxObstacleContext, i: u32) -> *const PxObstacle; + + /// Retrieves desired obstacle by given handle. + /// + /// Desired obstacle + pub fn PxObstacleContext_getObstacleByHandle(self_: *const PxObstacleContext, handle: u32) -> *const PxObstacle; + + /// Called when current controller hits a shape. + /// + /// This is called when the CCT moves and hits a shape. This will not be called when a moving shape hits a non-moving CCT. + pub fn PxUserControllerHitReport_onShapeHit_mut(self_: *mut PxUserControllerHitReport, hit: *const PxControllerShapeHit); + + /// Called when current controller hits another controller. + pub fn PxUserControllerHitReport_onControllerHit_mut(self_: *mut PxUserControllerHitReport, hit: *const PxControllersHit); + + /// Called when current controller hits a user-defined obstacle. + pub fn PxUserControllerHitReport_onObstacleHit_mut(self_: *mut PxUserControllerHitReport, hit: *const PxControllerObstacleHit); + + pub fn PxControllerFilterCallback_delete(self_: *mut PxControllerFilterCallback); + + /// Filtering method for CCT-vs-CCT. + /// + /// true to keep the pair, false to filter it out + pub fn PxControllerFilterCallback_filter_mut(self_: *mut PxControllerFilterCallback, a: *const PxController, b: *const PxController) -> bool; + + pub fn PxControllerFilters_new(filterData: *const PxFilterData, cb: *mut PxQueryFilterCallback, cctFilterCb: *mut PxControllerFilterCallback) -> PxControllerFilters; + + /// returns true if the current settings are valid + /// + /// True if the descriptor is valid. + pub fn PxControllerDesc_isValid(self_: *const PxControllerDesc) -> bool; + + /// Returns the character controller type + /// + /// The controllers type. + pub fn PxControllerDesc_getType(self_: *const PxControllerDesc) -> PxControllerShapeType; + + /// Return the type of controller + pub fn PxController_getType(self_: *const PxController) -> PxControllerShapeType; + + /// Releases the controller. + pub fn PxController_release_mut(self_: *mut PxController); + + /// Moves the character using a "collide-and-slide" algorithm. + /// + /// Collision flags, collection of ::PxControllerCollisionFlags + pub fn PxController_move_mut(self_: *mut PxController, disp: *const PxVec3, minDist: f32, elapsedTime: f32, filters: *const PxControllerFilters, obstacles: *const PxObstacleContext) -> PxControllerCollisionFlags; + + /// Sets controller's position. + /// + /// The position controlled by this function is the center of the collision shape. + /// + /// This is a 'teleport' function, it doesn't check for collisions. + /// + /// The character's position must be such that it does not overlap the static geometry. + /// + /// To move the character under normal conditions use the [`move`]() function. + /// + /// Currently always returns true. + pub fn PxController_setPosition_mut(self_: *mut PxController, position: *const PxExtendedVec3) -> bool; + + /// Retrieve the raw position of the controller. + /// + /// The position retrieved by this function is the center of the collision shape. To retrieve the bottom position of the shape, + /// a.k.a. the foot position, use the getFootPosition() function. + /// + /// The position is updated by calls to move(). Calling this method without calling + /// move() will return the last position or the initial position of the controller. + /// + /// The controller's center position + pub fn PxController_getPosition(self_: *const PxController) -> *const PxExtendedVec3; + + /// Set controller's foot position. + /// + /// The position controlled by this function is the bottom of the collision shape, a.k.a. the foot position. + /// + /// The foot position takes the contact offset into account + /// + /// This is a 'teleport' function, it doesn't check for collisions. + /// + /// To move the character under normal conditions use the [`move`]() function. + /// + /// Currently always returns true. + pub fn PxController_setFootPosition_mut(self_: *mut PxController, position: *const PxExtendedVec3) -> bool; + + /// Retrieve the "foot" position of the controller, i.e. the position of the bottom of the CCT's shape. + /// + /// The foot position takes the contact offset into account + /// + /// The controller's foot position + pub fn PxController_getFootPosition(self_: *const PxController) -> PxExtendedVec3; + + /// Get the rigid body actor associated with this controller (see PhysX documentation). + /// The behavior upon manually altering this actor is undefined, you should primarily + /// use it for reading const properties. + /// + /// the actor associated with the controller. + pub fn PxController_getActor(self_: *const PxController) -> *mut PxRigidDynamic; + + /// The step height. + pub fn PxController_setStepOffset_mut(self_: *mut PxController, offset: f32); + + /// Retrieve the step height. + /// + /// The step offset for the controller. + pub fn PxController_getStepOffset(self_: *const PxController) -> f32; + + /// Sets the non-walkable mode for the CCT. + pub fn PxController_setNonWalkableMode_mut(self_: *mut PxController, flag: PxControllerNonWalkableMode); + + /// Retrieves the non-walkable mode for the CCT. + /// + /// The current non-walkable mode. + pub fn PxController_getNonWalkableMode(self_: *const PxController) -> PxControllerNonWalkableMode; + + /// Retrieve the contact offset. + /// + /// The contact offset for the controller. + pub fn PxController_getContactOffset(self_: *const PxController) -> f32; + + /// Sets the contact offset. + pub fn PxController_setContactOffset_mut(self_: *mut PxController, offset: f32); + + /// Retrieve the 'up' direction. + /// + /// The up direction for the controller. + pub fn PxController_getUpDirection(self_: *const PxController) -> PxVec3; + + /// Sets the 'up' direction. + pub fn PxController_setUpDirection_mut(self_: *mut PxController, up: *const PxVec3); + + /// Retrieve the slope limit. + /// + /// The slope limit for the controller. + pub fn PxController_getSlopeLimit(self_: *const PxController) -> f32; + + /// Sets the slope limit. + /// + /// This feature can not be enabled at runtime, i.e. if the slope limit is zero when creating the CCT + /// (which disables the feature) then changing the slope limit at runtime will not have any effect, and the call + /// will be ignored. + pub fn PxController_setSlopeLimit_mut(self_: *mut PxController, slopeLimit: f32); + + /// Flushes internal geometry cache. + /// + /// The character controller uses caching in order to speed up collision testing. The cache is + /// automatically flushed when a change to static objects is detected in the scene. For example when a + /// static shape is added, updated, or removed from the scene, the cache is automatically invalidated. + /// + /// However there may be situations that cannot be automatically detected, and those require manual + /// invalidation of the cache. Currently the user must call this when the filtering behavior changes (the + /// PxControllerFilters parameter of the PxController::move call). While the controller in principle + /// could detect a change in these parameters, it cannot detect a change in the behavior of the filtering + /// function. + pub fn PxController_invalidateCache_mut(self_: *mut PxController); + + /// Retrieve the scene associated with the controller. + /// + /// The physics scene + pub fn PxController_getScene_mut(self_: *mut PxController) -> *mut PxScene; + + /// Returns the user data associated with this controller. + /// + /// The user pointer associated with the controller. + pub fn PxController_getUserData(self_: *const PxController) -> *mut std::ffi::c_void; + + /// Sets the user data associated with this controller. + pub fn PxController_setUserData_mut(self_: *mut PxController, userData: *mut std::ffi::c_void); + + /// Returns information about the controller's internal state. + pub fn PxController_getState(self_: *const PxController, state: *mut PxControllerState); + + /// Returns the controller's internal statistics. + pub fn PxController_getStats(self_: *const PxController, stats: *mut PxControllerStats); + + /// Resizes the controller. + /// + /// This function attempts to resize the controller to a given size, while making sure the bottom + /// position of the controller remains constant. In other words the function modifies both the + /// height and the (center) position of the controller. This is a helper function that can be used + /// to implement a 'crouch' functionality for example. + pub fn PxController_resize_mut(self_: *mut PxController, height: f32); + + /// 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; + + /// Gets controller's half height. + /// + /// The half height of the controller. + pub fn PxBoxController_getHalfHeight(self_: *const PxBoxController) -> f32; + + /// Gets controller's half side extent. + /// + /// The half side extent of the controller. + pub fn PxBoxController_getHalfSideExtent(self_: *const PxBoxController) -> f32; + + /// Gets controller's half forward extent. + /// + /// The half forward extent of the controller. + pub fn PxBoxController_getHalfForwardExtent(self_: *const PxBoxController) -> f32; + + /// Sets controller's half height. + /// + /// this doesn't check for collisions. + /// + /// Currently always true. + pub fn PxBoxController_setHalfHeight_mut(self_: *mut PxBoxController, halfHeight: f32) -> bool; + + /// Sets controller's half side extent. + /// + /// this doesn't check for collisions. + /// + /// Currently always true. + pub fn PxBoxController_setHalfSideExtent_mut(self_: *mut PxBoxController, halfSideExtent: f32) -> bool; + + /// Sets controller's half forward extent. + /// + /// this doesn't check for collisions. + /// + /// Currently always true. + pub fn PxBoxController_setHalfForwardExtent_mut(self_: *mut PxBoxController, halfForwardExtent: f32) -> bool; + + /// constructor sets to default. + pub fn PxCapsuleControllerDesc_new_alloc() -> *mut PxCapsuleControllerDesc; + + pub fn PxCapsuleControllerDesc_delete(self_: *mut PxCapsuleControllerDesc); + + /// (re)sets the structure to the default. + pub fn PxCapsuleControllerDesc_setToDefault_mut(self_: *mut PxCapsuleControllerDesc); + + /// returns true if the current settings are valid + /// + /// True if the descriptor is valid. + pub fn PxCapsuleControllerDesc_isValid(self_: *const PxCapsuleControllerDesc) -> bool; + + /// Gets controller's radius. + /// + /// The radius of the controller. + pub fn PxCapsuleController_getRadius(self_: *const PxCapsuleController) -> f32; + + /// Sets controller's radius. + /// + /// this doesn't check for collisions. + /// + /// Currently always true. + pub fn PxCapsuleController_setRadius_mut(self_: *mut PxCapsuleController, radius: f32) -> bool; + + /// Gets controller's height. + /// + /// The height of the capsule controller. + pub fn PxCapsuleController_getHeight(self_: *const PxCapsuleController) -> f32; + + /// Resets controller's height. + /// + /// this doesn't check for collisions. + /// + /// Currently always true. + pub fn PxCapsuleController_setHeight_mut(self_: *mut PxCapsuleController, height: f32) -> bool; + + /// Gets controller's climbing mode. + /// + /// The capsule controller's climbing mode. + pub fn PxCapsuleController_getClimbingMode(self_: *const PxCapsuleController) -> PxCapsuleClimbingMode; + + /// Sets controller's climbing mode. + pub fn PxCapsuleController_setClimbingMode_mut(self_: *mut PxCapsuleController, mode: PxCapsuleClimbingMode) -> bool; + + /// Retrieve behavior flags for a shape. + /// + /// When the CCT touches a shape, the CCT's behavior w.r.t. this shape can be customized by users. + /// This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + /// + /// See comments about deprecated functions at the start of this class + /// + /// Desired behavior flags for the given shape + pub fn PxControllerBehaviorCallback_getBehaviorFlags_mut(self_: *mut PxControllerBehaviorCallback, shape: *const PxShape, actor: *const PxActor) -> PxControllerBehaviorFlags; + + /// Retrieve behavior flags for a controller. + /// + /// When the CCT touches a controller, the CCT's behavior w.r.t. this controller can be customized by users. + /// This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + /// + /// The flag PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not supported. + /// + /// See comments about deprecated functions at the start of this class + /// + /// Desired behavior flags for the given controller + pub fn PxControllerBehaviorCallback_getBehaviorFlags_mut_1(self_: *mut PxControllerBehaviorCallback, controller: *const PxController) -> PxControllerBehaviorFlags; + + /// Retrieve behavior flags for an obstacle. + /// + /// When the CCT touches an obstacle, the CCT's behavior w.r.t. this obstacle can be customized by users. + /// This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. + /// + /// See comments about deprecated functions at the start of this class + /// + /// Desired behavior flags for the given obstacle + pub fn PxControllerBehaviorCallback_getBehaviorFlags_mut_2(self_: *mut PxControllerBehaviorCallback, obstacle: *const PxObstacle) -> PxControllerBehaviorFlags; + + /// Releases the controller manager. + /// + /// This will release all associated controllers and obstacle contexts. + /// + /// This function is required to be called to release foundation usage. + pub fn PxControllerManager_release_mut(self_: *mut PxControllerManager); + + /// Returns the scene the manager is adding the controllers to. + /// + /// The associated physics scene. + pub fn PxControllerManager_getScene(self_: *const PxControllerManager) -> *mut PxScene; + + /// Returns the number of controllers that are being managed. + /// + /// The number of controllers. + pub fn PxControllerManager_getNbControllers(self_: *const PxControllerManager) -> u32; + + /// Retrieve one of the controllers in the manager. + /// + /// The controller with the specified index. + pub fn PxControllerManager_getController_mut(self_: *mut PxControllerManager, index: u32) -> *mut PxController; + + /// Creates a new character controller. + /// + /// The new controller + pub fn PxControllerManager_createController_mut(self_: *mut PxControllerManager, desc: *const PxControllerDesc) -> *mut PxController; + + /// Releases all the controllers that are being managed. + pub fn PxControllerManager_purgeControllers_mut(self_: *mut PxControllerManager); + + /// Retrieves debug data. + /// + /// The render buffer filled with debug-render data + pub fn PxControllerManager_getRenderBuffer_mut(self_: *mut PxControllerManager) -> *mut PxRenderBuffer; + + /// Sets debug rendering flags + pub fn PxControllerManager_setDebugRenderingFlags_mut(self_: *mut PxControllerManager, flags: PxControllerDebugRenderFlags); + + /// Returns the number of obstacle contexts that are being managed. + /// + /// The number of obstacle contexts. + pub fn PxControllerManager_getNbObstacleContexts(self_: *const PxControllerManager) -> u32; + + /// Retrieve one of the obstacle contexts in the manager. + /// + /// The obstacle context with the specified index. + pub fn PxControllerManager_getObstacleContext_mut(self_: *mut PxControllerManager, index: u32) -> *mut PxObstacleContext; + + /// Creates an obstacle context. + /// + /// New obstacle context + pub fn PxControllerManager_createObstacleContext_mut(self_: *mut PxControllerManager) -> *mut PxObstacleContext; + + /// Computes character-character interactions. + /// + /// This function is an optional helper to properly resolve interactions between characters, in case they overlap (which can happen for gameplay reasons, etc). + /// + /// You should call this once per frame, before your PxController::move() calls. The function will not move the characters directly, but it will + /// compute overlap information for each character that will be used in the next move() call. + /// + /// You need to provide a proper time value here so that interactions are resolved in a way that do not depend on the framerate. + /// + /// If you only have one character in the scene, or if you can guarantee your characters will never overlap, then you do not need to call this function. + /// + /// Releasing the manager will automatically release all the associated obstacle contexts. + pub fn PxControllerManager_computeInteractions_mut(self_: *mut PxControllerManager, elapsedTime: f32, cctFilterCb: *mut PxControllerFilterCallback); + + /// Enables or disables runtime tessellation. + /// + /// Large triangles can create accuracy issues in the sweep code, which in turn can lead to characters not sliding smoothly + /// against geometries, or even penetrating them. This feature allows one to reduce those issues by tessellating large + /// triangles at runtime, before performing sweeps against them. The amount of tessellation is controlled by the 'maxEdgeLength' parameter. + /// Any triangle with at least one edge length greater than the maxEdgeLength will get recursively tessellated, until resulting triangles are small enough. + /// + /// This features only applies to triangle meshes, convex meshes, heightfields and boxes. + pub fn PxControllerManager_setTessellation_mut(self_: *mut PxControllerManager, flag: bool, maxEdgeLength: f32); + + /// Enables or disables the overlap recovery module. + /// + /// The overlap recovery module can be used to depenetrate CCTs from static objects when an overlap is detected. This can happen + /// in three main cases: + /// - when the CCT is directly spawned or teleported in another object + /// - when the CCT algorithm fails due to limited FPU accuracy + /// - when the "up vector" is modified, making the rotated CCT shape overlap surrounding objects + /// + /// When activated, the CCT module will automatically try to resolve the penetration, and move the CCT to a safe place where it does + /// not overlap other objects anymore. This only concerns static objects, dynamic objects are ignored by the recovery module. + /// + /// When the recovery module is not activated, it is possible for the CCTs to go through static objects. By default, the recovery + /// module is enabled. + /// + /// The recovery module currently works with all geometries except heightfields. + pub fn PxControllerManager_setOverlapRecoveryModule_mut(self_: *mut PxControllerManager, flag: bool); + + /// Enables or disables the precise sweeps. + /// + /// Precise sweeps are more accurate, but also potentially slower than regular sweeps. + /// + /// By default, precise sweeps are enabled. + pub fn PxControllerManager_setPreciseSweeps_mut(self_: *mut PxControllerManager, flag: bool); + + /// Enables or disables vertical sliding against ceilings. + /// + /// Geometry is seen as "ceilings" when the following condition is met: + /// + /// dot product(contact normal, up direction) + /// < + /// 0.0f + /// + /// This flag controls whether characters should slide vertically along the geometry in that case. + /// + /// By default, sliding is allowed. + pub fn PxControllerManager_setPreventVerticalSlidingAgainstCeiling_mut(self_: *mut PxControllerManager, flag: bool); + + /// Shift the origin of the character controllers and obstacle objects by the specified vector. + /// + /// The positions of all character controllers, obstacle objects and the corresponding data structures will get adjusted to reflect the shifted origin location + /// (the shift vector will get subtracted from all character controller and obstacle object positions). + /// + /// It is the user's responsibility to keep track of the summed total origin shift and adjust all input/output to/from PhysXCharacterKinematic accordingly. + /// + /// This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() seperately to keep the systems in sync. + pub fn PxControllerManager_shiftOrigin_mut(self_: *mut PxControllerManager, shift: *const PxVec3); + + /// Creates the controller manager. + /// + /// The character controller is informed by [`PxDeletionListener::onRelease`]() when actors or shapes are released, and updates its internal + /// caches accordingly. If character controller movement or a call to [`PxControllerManager::shiftOrigin`]() may overlap with actor/shape releases, + /// internal data structures must be guarded against concurrent access. + /// + /// Locking guarantees thread safety in such scenarios. + /// + /// locking may result in significant slowdown for release of actors or shapes. + /// + /// By default, locking is disabled. + pub fn phys_PxCreateControllerManager(scene: *mut PxScene, lockingEnabled: bool) -> *mut PxControllerManager; + + pub fn PxDim3_new() -> PxDim3; + + /// Constructor + pub fn PxSDFDesc_new() -> PxSDFDesc; + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid + pub fn PxSDFDesc_isValid(self_: *const PxSDFDesc) -> bool; + + /// constructor sets to default. + pub fn PxConvexMeshDesc_new() -> PxConvexMeshDesc; + + /// (re)sets the structure to the default. + pub fn PxConvexMeshDesc_setToDefault_mut(self_: *mut PxConvexMeshDesc); + + /// Returns true if the descriptor is valid. + /// + /// True if the current settings are valid + pub fn PxConvexMeshDesc_isValid(self_: *const PxConvexMeshDesc) -> bool; + + /// Constructor sets to default. + pub fn PxTriangleMeshDesc_new() -> PxTriangleMeshDesc; + + /// (re)sets the structure to the default. + pub fn PxTriangleMeshDesc_setToDefault_mut(self_: *mut PxTriangleMeshDesc); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid + pub fn PxTriangleMeshDesc_isValid(self_: *const PxTriangleMeshDesc) -> bool; + + /// Constructor to build an empty tetmesh description + pub fn PxTetrahedronMeshDesc_new() -> PxTetrahedronMeshDesc; + + pub fn PxTetrahedronMeshDesc_isValid(self_: *const PxTetrahedronMeshDesc) -> bool; + + /// Constructor to build an empty simulation description + pub fn PxSoftBodySimulationDataDesc_new() -> PxSoftBodySimulationDataDesc; + + pub fn PxSoftBodySimulationDataDesc_isValid(self_: *const PxSoftBodySimulationDataDesc) -> bool; + + /// Desc initialization to default value. + pub fn PxBVH34MidphaseDesc_setToDefault_mut(self_: *mut PxBVH34MidphaseDesc); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxBVH34MidphaseDesc_isValid(self_: *const PxBVH34MidphaseDesc) -> bool; + + pub fn PxMidphaseDesc_new() -> PxMidphaseDesc; + + /// Returns type of midphase mesh structure. + /// + /// PxMeshMidPhase::Enum + pub fn PxMidphaseDesc_getType(self_: *const PxMidphaseDesc) -> PxMeshMidPhase; + + /// Initialize the midphase mesh structure descriptor + pub fn PxMidphaseDesc_setToDefault_mut(self_: *mut PxMidphaseDesc, type_: PxMeshMidPhase); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxMidphaseDesc_isValid(self_: *const PxMidphaseDesc) -> bool; + + pub fn PxBVHDesc_new() -> PxBVHDesc; + + /// Initialize the BVH descriptor + pub fn PxBVHDesc_setToDefault_mut(self_: *mut PxBVHDesc); + + /// Returns true if the descriptor is valid. + /// + /// true if the current settings are valid. + pub fn PxBVHDesc_isValid(self_: *const PxBVHDesc) -> bool; + + pub fn PxCookingParams_new(sc: *const PxTolerancesScale) -> PxCookingParams; + + pub fn phys_PxGetStandaloneInsertionCallback() -> *mut PxInsertionCallback; + + /// Cooks a bounding volume hierarchy. The results are written to the stream. + /// + /// PxCookBVH() allows a BVH description to be cooked into a binary stream + /// suitable for loading and performing BVH detection at runtime. + /// + /// true on success. + pub fn phys_PxCookBVH(desc: *const PxBVHDesc, stream: *mut PxOutputStream) -> bool; + + /// Cooks and creates a bounding volume hierarchy without going through a stream. + /// + /// This method does the same as cookBVH, but the produced BVH is not stored + /// into a stream but is either directly inserted in PxPhysics, or created as a standalone + /// object. Use this method if you are unable to cook offline. + /// + /// PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() + /// or PxCooking::getStandaloneInsertionCallback(). + /// + /// PxBVH pointer on success + pub fn phys_PxCreateBVH(desc: *const PxBVHDesc, insertionCallback: *mut PxInsertionCallback) -> *mut PxBVH; + + /// Cooks a heightfield. The results are written to the stream. + /// + /// To create a heightfield object there is an option to precompute some of calculations done while loading the heightfield data. + /// + /// cookHeightField() allows a heightfield description to be cooked into a binary stream + /// suitable for loading and performing collision detection at runtime. + /// + /// true on success + pub fn phys_PxCookHeightField(desc: *const PxHeightFieldDesc, stream: *mut PxOutputStream) -> bool; + + /// Cooks and creates a heightfield mesh and inserts it into PxPhysics. + /// + /// PxHeightField pointer on success + pub fn phys_PxCreateHeightField(desc: *const PxHeightFieldDesc, insertionCallback: *mut PxInsertionCallback) -> *mut PxHeightField; + + /// Cooks a convex mesh. The results are written to the stream. + /// + /// To create a triangle mesh object it is necessary to first 'cook' the mesh data into + /// a form which allows the SDK to perform efficient collision detection. + /// + /// cookConvexMesh() allows a mesh description to be cooked into a binary stream + /// suitable for loading and performing collision detection at runtime. + /// + /// The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 255. + /// + /// If those limits are exceeded in either the user-provided data or the final cooked mesh, an error is reported. + /// + /// true on success. + pub fn phys_PxCookConvexMesh(params: *const PxCookingParams, desc: *const PxConvexMeshDesc, stream: *mut PxOutputStream, condition: *mut PxConvexMeshCookingResult) -> bool; + + /// Cooks and creates a convex mesh without going through a stream. + /// + /// This method does the same as cookConvexMesh, but the produced mesh is not stored + /// into a stream but is either directly inserted in PxPhysics, or created as a standalone + /// object. Use this method if you are unable to cook offline. + /// + /// PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() + /// or PxCooking::getStandaloneInsertionCallback(). + /// + /// PxConvexMesh pointer on success + pub fn phys_PxCreateConvexMesh(params: *const PxCookingParams, desc: *const PxConvexMeshDesc, insertionCallback: *mut PxInsertionCallback, condition: *mut PxConvexMeshCookingResult) -> *mut PxConvexMesh; + + /// Verifies if the convex mesh is valid. Prints an error message for each inconsistency found. + /// + /// The convex mesh descriptor must contain an already created convex mesh - the vertices, indices and polygons must be provided. + /// + /// This function should be used if PxConvexFlag::eDISABLE_MESH_VALIDATION is planned to be used in release builds. + /// + /// true if all the validity conditions hold, false otherwise. + pub fn phys_PxValidateConvexMesh(params: *const PxCookingParams, desc: *const PxConvexMeshDesc) -> bool; + + /// Computed hull polygons from given vertices and triangles. Polygons are needed for PxConvexMeshDesc rather than triangles. + /// + /// Please note that the resulting polygons may have different number of vertices. Some vertices may be removed. + /// The output vertices, indices and polygons must be used to construct a hull. + /// + /// The provided PxAllocatorCallback does allocate the out array's. It is the user responsibility to deallocated those + /// array's. + /// + /// true on success + pub fn phys_PxComputeHullPolygons(params: *const PxCookingParams, mesh: *const PxSimpleTriangleMesh, inCallback: *mut PxAllocatorCallback, nbVerts: *mut u32, vertices: *mut *mut PxVec3, nbIndices: *mut u32, indices: *mut *mut u32, nbPolygons: *mut u32, hullPolygons: *mut *mut PxHullPolygon) -> bool; + + /// Verifies if the triangle mesh is valid. Prints an error message for each inconsistency found. + /// + /// The following conditions are true for a valid triangle mesh: + /// 1. There are no duplicate vertices (within specified vertexWeldTolerance. See PxCookingParams::meshWeldTolerance) + /// 2. There are no large triangles (within specified PxTolerancesScale.) + /// + /// true if all the validity conditions hold, false otherwise. + pub fn phys_PxValidateTriangleMesh(params: *const PxCookingParams, desc: *const PxTriangleMeshDesc) -> bool; + + /// Cooks and creates a triangle mesh without going through a stream. + /// + /// This method does the same as cookTriangleMesh, but the produced mesh is not stored + /// into a stream but is either directly inserted in PxPhysics, or created as a standalone + /// object. Use this method if you are unable to cook offline. + /// + /// PxInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback() + /// or PxCooking::getStandaloneInsertionCallback(). + /// + /// PxTriangleMesh pointer on success. + pub fn phys_PxCreateTriangleMesh(params: *const PxCookingParams, desc: *const PxTriangleMeshDesc, insertionCallback: *mut PxInsertionCallback, condition: *mut PxTriangleMeshCookingResult) -> *mut PxTriangleMesh; + + /// Cooks a triangle mesh. The results are written to the stream. + /// + /// To create a triangle mesh object it is necessary to first 'cook' the mesh data into + /// a form which allows the SDK to perform efficient collision detection. + /// + /// PxCookTriangleMesh() allows a mesh description to be cooked into a binary stream + /// suitable for loading and performing collision detection at runtime. + /// + /// true on success + pub fn phys_PxCookTriangleMesh(params: *const PxCookingParams, desc: *const PxTriangleMeshDesc, stream: *mut PxOutputStream, condition: *mut PxTriangleMeshCookingResult) -> bool; + + pub fn PxDefaultMemoryOutputStream_new_alloc(allocator: *mut PxAllocatorCallback) -> *mut PxDefaultMemoryOutputStream; + + pub fn PxDefaultMemoryOutputStream_delete(self_: *mut PxDefaultMemoryOutputStream); + + pub fn PxDefaultMemoryOutputStream_write_mut(self_: *mut PxDefaultMemoryOutputStream, src: *const std::ffi::c_void, count: u32) -> u32; + + pub fn PxDefaultMemoryOutputStream_getSize(self_: *const PxDefaultMemoryOutputStream) -> u32; + + pub fn PxDefaultMemoryOutputStream_getData(self_: *const PxDefaultMemoryOutputStream) -> *mut u8; + + pub fn PxDefaultMemoryInputData_new_alloc(data: *mut u8, length: u32) -> *mut PxDefaultMemoryInputData; + + pub fn PxDefaultMemoryInputData_read_mut(self_: *mut PxDefaultMemoryInputData, dest: *mut std::ffi::c_void, count: u32) -> u32; + + pub fn PxDefaultMemoryInputData_getLength(self_: *const PxDefaultMemoryInputData) -> u32; + + pub fn PxDefaultMemoryInputData_seek_mut(self_: *mut PxDefaultMemoryInputData, pos: u32); + + pub fn PxDefaultMemoryInputData_tell(self_: *const PxDefaultMemoryInputData) -> u32; + + pub fn PxDefaultFileOutputStream_new_alloc(name: *const std::ffi::c_char) -> *mut PxDefaultFileOutputStream; + + pub fn PxDefaultFileOutputStream_delete(self_: *mut PxDefaultFileOutputStream); + + pub fn PxDefaultFileOutputStream_write_mut(self_: *mut PxDefaultFileOutputStream, src: *const std::ffi::c_void, count: u32) -> u32; + + pub fn PxDefaultFileOutputStream_isValid_mut(self_: *mut PxDefaultFileOutputStream) -> bool; + + pub fn PxDefaultFileInputData_new_alloc(name: *const std::ffi::c_char) -> *mut PxDefaultFileInputData; + + pub fn PxDefaultFileInputData_delete(self_: *mut PxDefaultFileInputData); + + pub fn PxDefaultFileInputData_read_mut(self_: *mut PxDefaultFileInputData, dest: *mut std::ffi::c_void, count: u32) -> u32; + + pub fn PxDefaultFileInputData_seek_mut(self_: *mut PxDefaultFileInputData, pos: u32); + + pub fn PxDefaultFileInputData_tell(self_: *const PxDefaultFileInputData) -> u32; + + pub fn PxDefaultFileInputData_getLength(self_: *const PxDefaultFileInputData) -> u32; + + pub fn PxDefaultFileInputData_isValid(self_: *const PxDefaultFileInputData) -> bool; + + pub fn phys_platformAlignedAlloc(size: usize) -> *mut std::ffi::c_void; + + pub fn phys_platformAlignedFree(ptr: *mut std::ffi::c_void); + + pub fn PxDefaultAllocator_allocate_mut(self_: *mut PxDefaultAllocator, size: usize, anon_param1: *const std::ffi::c_char, anon_param2: *const std::ffi::c_char, anon_param3: i32) -> *mut std::ffi::c_void; + + pub fn PxDefaultAllocator_deallocate_mut(self_: *mut PxDefaultAllocator, ptr: *mut std::ffi::c_void); + + pub fn PxDefaultAllocator_delete(self_: *mut PxDefaultAllocator); + + /// Set the actors for this joint. + /// + /// An actor may be NULL to indicate the world frame. At most one of the actors may be NULL. + pub fn PxJoint_setActors_mut(self_: *mut PxJoint, actor0: *mut PxRigidActor, actor1: *mut PxRigidActor); + + /// Get the actors for this joint. + pub fn PxJoint_getActors(self_: *const PxJoint, actor0: *mut *mut PxRigidActor, actor1: *mut *mut PxRigidActor); + + /// Set the joint local pose for an actor. + /// + /// This is the relative pose which locates the joint frame relative to the actor. + pub fn PxJoint_setLocalPose_mut(self_: *mut PxJoint, actor: PxJointActorIndex, localPose: *const PxTransform); + + /// get the joint local pose for an actor. + /// + /// return the local pose for this joint + pub fn PxJoint_getLocalPose(self_: *const PxJoint, actor: PxJointActorIndex) -> PxTransform; + + /// get the relative pose for this joint + /// + /// This function returns the pose of the joint frame of actor1 relative to actor0 + pub fn PxJoint_getRelativeTransform(self_: *const PxJoint) -> PxTransform; + + /// get the relative linear velocity of the joint + /// + /// This function returns the linear velocity of the origin of the constraint frame of actor1, relative to the origin of the constraint + /// frame of actor0. The value is returned in the constraint frame of actor0 + pub fn PxJoint_getRelativeLinearVelocity(self_: *const PxJoint) -> PxVec3; + + /// get the relative angular velocity of the joint + /// + /// This function returns the angular velocity of actor1 relative to actor0. The value is returned in the constraint frame of actor0 + pub fn PxJoint_getRelativeAngularVelocity(self_: *const PxJoint) -> PxVec3; + + /// set the break force for this joint. + /// + /// if the constraint force or torque on the joint exceeds the specified values, the joint will break, + /// at which point it will not constrain the two actors and the flag PxConstraintFlag::eBROKEN will be set. The + /// force and torque are measured in the joint frame of the first actor + pub fn PxJoint_setBreakForce_mut(self_: *mut PxJoint, force: f32, torque: f32); + + /// get the break force for this joint. + pub fn PxJoint_getBreakForce(self_: *const PxJoint, force: *mut f32, torque: *mut f32); + + /// set the constraint flags for this joint. + pub fn PxJoint_setConstraintFlags_mut(self_: *mut PxJoint, flags: PxConstraintFlags); + + /// set a constraint flags for this joint to a specified value. + pub fn PxJoint_setConstraintFlag_mut(self_: *mut PxJoint, flag: PxConstraintFlag, value: bool); + + /// get the constraint flags for this joint. + /// + /// the constraint flags + pub fn PxJoint_getConstraintFlags(self_: *const PxJoint) -> PxConstraintFlags; + + /// set the inverse mass scale for actor0. + pub fn PxJoint_setInvMassScale0_mut(self_: *mut PxJoint, invMassScale: f32); + + /// get the inverse mass scale for actor0. + /// + /// inverse mass scale for actor0 + pub fn PxJoint_getInvMassScale0(self_: *const PxJoint) -> f32; + + /// set the inverse inertia scale for actor0. + pub fn PxJoint_setInvInertiaScale0_mut(self_: *mut PxJoint, invInertiaScale: f32); + + /// get the inverse inertia scale for actor0. + /// + /// inverse inertia scale for actor0 + pub fn PxJoint_getInvInertiaScale0(self_: *const PxJoint) -> f32; + + /// set the inverse mass scale for actor1. + pub fn PxJoint_setInvMassScale1_mut(self_: *mut PxJoint, invMassScale: f32); + + /// get the inverse mass scale for actor1. + /// + /// inverse mass scale for actor1 + pub fn PxJoint_getInvMassScale1(self_: *const PxJoint) -> f32; + + /// set the inverse inertia scale for actor1. + pub fn PxJoint_setInvInertiaScale1_mut(self_: *mut PxJoint, invInertiaScale: f32); + + /// get the inverse inertia scale for actor1. + /// + /// inverse inertia scale for actor1 + pub fn PxJoint_getInvInertiaScale1(self_: *const PxJoint) -> f32; + + /// Retrieves the PxConstraint corresponding to this joint. + /// + /// This can be used to determine, among other things, the force applied at the joint. + /// + /// the constraint + pub fn PxJoint_getConstraint(self_: *const PxJoint) -> *mut PxConstraint; + + /// 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. + pub fn PxJoint_setName_mut(self_: *mut PxJoint, name: *const std::ffi::c_char); + + /// Retrieves the name string set with setName(). + /// + /// Name string associated with object. + pub fn PxJoint_getName(self_: *const PxJoint) -> *const std::ffi::c_char; + + /// Deletes the joint. + /// + /// This call does not wake up the connected rigid bodies. + pub fn PxJoint_release_mut(self_: *mut PxJoint); + + /// Retrieves the scene which this joint belongs to. + /// + /// Owner Scene. NULL if not part of a scene. + pub fn PxJoint_getScene(self_: *const PxJoint) -> *mut PxScene; + + /// Put class meta data in stream, used for serialization + pub fn PxJoint_getBinaryMetaData(stream: *mut PxOutputStream); + + pub fn PxSpring_new(stiffness_: f32, damping_: f32) -> PxSpring; + + /// Helper function to setup a joint's global frame + /// + /// This replaces the following functions from previous SDK versions: + /// + /// void NxJointDesc::setGlobalAnchor(const NxVec3 + /// & + /// wsAnchor); + /// void NxJointDesc::setGlobalAxis(const NxVec3 + /// & + /// wsAxis); + /// + /// The function sets the joint's localPose using world-space input parameters. + pub fn phys_PxSetJointGlobalFrame(joint: *mut PxJoint, wsAnchor: *const PxVec3, wsAxis: *const PxVec3); + + /// Create a distance Joint. + pub fn phys_PxDistanceJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxDistanceJoint; + + /// Return the current distance of the joint + pub fn PxDistanceJoint_getDistance(self_: *const PxDistanceJoint) -> f32; + + /// Set the allowed minimum distance for the joint. + /// + /// The minimum distance must be no more than the maximum distance + /// + /// Default + /// 0.0f + /// Range + /// [0, PX_MAX_F32) + pub fn PxDistanceJoint_setMinDistance_mut(self_: *mut PxDistanceJoint, distance: f32); + + /// Get the allowed minimum distance for the joint. + /// + /// the allowed minimum distance + pub fn PxDistanceJoint_getMinDistance(self_: *const PxDistanceJoint) -> f32; + + /// Set the allowed maximum distance for the joint. + /// + /// The maximum distance must be no less than the minimum distance. + /// + /// Default + /// 0.0f + /// Range + /// [0, PX_MAX_F32) + pub fn PxDistanceJoint_setMaxDistance_mut(self_: *mut PxDistanceJoint, distance: f32); + + /// Get the allowed maximum distance for the joint. + /// + /// the allowed maximum distance + pub fn PxDistanceJoint_getMaxDistance(self_: *const PxDistanceJoint) -> f32; + + /// Set the error tolerance of the joint. + pub fn PxDistanceJoint_setTolerance_mut(self_: *mut PxDistanceJoint, tolerance: f32); + + /// Get the error tolerance of the joint. + /// + /// the distance beyond the joint's [min, max] range before the joint becomes active. + /// + /// Default + /// 0.25f * PxTolerancesScale::length + /// Range + /// (0, PX_MAX_F32) + /// + /// This value should be used to ensure that if the minimum distance is zero and the + /// spring function is in use, the rest length of the spring is non-zero. + pub fn PxDistanceJoint_getTolerance(self_: *const PxDistanceJoint) -> f32; + + /// Set the strength of the joint spring. + /// + /// The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + /// + /// Default + /// 0.0f + /// Range + /// [0, PX_MAX_F32) + pub fn PxDistanceJoint_setStiffness_mut(self_: *mut PxDistanceJoint, stiffness: f32); + + /// Get the strength of the joint spring. + /// + /// stiffness the spring strength of the joint + pub fn PxDistanceJoint_getStiffness(self_: *const PxDistanceJoint) -> f32; + + /// Set the damping of the joint spring. + /// + /// The spring is used if enabled, and the distance exceeds the range [min-error, max+error]. + /// + /// Default + /// 0.0f + /// Range + /// [0, PX_MAX_F32) + pub fn PxDistanceJoint_setDamping_mut(self_: *mut PxDistanceJoint, damping: f32); + + /// Get the damping of the joint spring. + /// + /// the degree of damping of the joint spring of the joint + pub fn PxDistanceJoint_getDamping(self_: *const PxDistanceJoint) -> f32; + + /// Set the contact distance for the min + /// & + /// max distance limits. + /// + /// This is similar to the PxJointLimitParameters::contactDistance parameter for regular limits. + /// + /// The two most common values are 0 and infinite. Infinite means the internal constraints are + /// always created, resulting in the best simulation quality but slower performance. Zero means + /// the internal constraints are only created when the limits are violated, resulting in best + /// performance but worse simulation quality. + /// + /// Default + /// 0.0f + /// Range + /// [0, PX_MAX_F32) + pub fn PxDistanceJoint_setContactDistance_mut(self_: *mut PxDistanceJoint, contactDistance: f32); + + /// Get the contact distance. + /// + /// the contact distance + pub fn PxDistanceJoint_getContactDistance(self_: *const PxDistanceJoint) -> f32; + + /// Set the flags specific to the Distance Joint. + /// + /// Default + /// PxDistanceJointFlag::eMAX_DISTANCE_ENABLED + pub fn PxDistanceJoint_setDistanceJointFlags_mut(self_: *mut PxDistanceJoint, flags: PxDistanceJointFlags); + + /// Set a single flag specific to a Distance Joint to true or false. + pub fn PxDistanceJoint_setDistanceJointFlag_mut(self_: *mut PxDistanceJoint, flag: PxDistanceJointFlag, value: bool); + + /// Get the flags specific to the Distance Joint. + /// + /// the joint flags + pub fn PxDistanceJoint_getDistanceJointFlags(self_: *const PxDistanceJoint) -> PxDistanceJointFlags; + + /// Returns string name of PxDistanceJoint, used for serialization + pub fn PxDistanceJoint_getConcreteTypeName(self_: *const PxDistanceJoint) -> *const std::ffi::c_char; + + /// Create a distance Joint. + pub fn phys_PxContactJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxContactJoint; + + pub fn PxJacobianRow_new() -> PxJacobianRow; + + pub fn PxJacobianRow_new_1(lin0: *const PxVec3, lin1: *const PxVec3, ang0: *const PxVec3, ang1: *const PxVec3) -> PxJacobianRow; + + /// Set the current contact of the joint + pub fn PxContactJoint_setContact_mut(self_: *mut PxContactJoint, contact: *const PxVec3); + + /// Set the current contact normal of the joint + pub fn PxContactJoint_setContactNormal_mut(self_: *mut PxContactJoint, contactNormal: *const PxVec3); + + /// Set the current penetration of the joint + pub fn PxContactJoint_setPenetration_mut(self_: *mut PxContactJoint, penetration: f32); + + /// Return the current contact of the joint + pub fn PxContactJoint_getContact(self_: *const PxContactJoint) -> PxVec3; + + /// Return the current contact normal of the joint + pub fn PxContactJoint_getContactNormal(self_: *const PxContactJoint) -> PxVec3; + + /// Return the current penetration value of the joint + pub fn PxContactJoint_getPenetration(self_: *const PxContactJoint) -> f32; + + pub fn PxContactJoint_getRestitution(self_: *const PxContactJoint) -> f32; + + pub fn PxContactJoint_setRestitution_mut(self_: *mut PxContactJoint, restitution: f32); + + pub fn PxContactJoint_getBounceThreshold(self_: *const PxContactJoint) -> f32; + + pub fn PxContactJoint_setBounceThreshold_mut(self_: *mut PxContactJoint, bounceThreshold: f32); + + /// Returns string name of PxContactJoint, used for serialization + pub fn PxContactJoint_getConcreteTypeName(self_: *const PxContactJoint) -> *const std::ffi::c_char; + + pub fn PxContactJoint_computeJacobians(self_: *const PxContactJoint, jacobian: *mut PxJacobianRow); + + pub fn PxContactJoint_getNbJacobianRows(self_: *const PxContactJoint) -> u32; + + /// Create a fixed joint. + pub fn phys_PxFixedJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxFixedJoint; + + /// Returns string name of PxFixedJoint, used for serialization + pub fn PxFixedJoint_getConcreteTypeName(self_: *const PxFixedJoint) -> *const std::ffi::c_char; + + 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; + + /// construct a linear hard limit + pub fn PxJointLinearLimit_new(scale: *const PxTolerancesScale, extent: f32, contactDist_deprecated: f32) -> PxJointLinearLimit; + + /// construct a linear soft limit + pub fn PxJointLinearLimit_new_1(extent: f32, spring: *const PxSpring) -> PxJointLinearLimit; + + /// Returns true if the limit is valid + /// + /// true if the current settings are valid + pub fn PxJointLinearLimit_isValid(self_: *const PxJointLinearLimit) -> bool; + + pub fn PxJointLinearLimit_delete(self_: *mut PxJointLinearLimit); + + /// Construct a linear hard limit pair. The lower distance value must be less than the upper distance value. + pub fn PxJointLinearLimitPair_new(scale: *const PxTolerancesScale, lowerLimit: f32, upperLimit: f32, contactDist_deprecated: f32) -> PxJointLinearLimitPair; + + /// construct a linear soft limit pair + pub fn PxJointLinearLimitPair_new_1(lowerLimit: f32, upperLimit: f32, spring: *const PxSpring) -> PxJointLinearLimitPair; + + /// Returns true if the limit is valid. + /// + /// true if the current settings are valid + pub fn PxJointLinearLimitPair_isValid(self_: *const PxJointLinearLimitPair) -> bool; + + pub fn PxJointLinearLimitPair_delete(self_: *mut PxJointLinearLimitPair); + + /// construct an angular hard limit pair. + /// + /// The lower value must be less than the upper value. + pub fn PxJointAngularLimitPair_new(lowerLimit: f32, upperLimit: f32, contactDist_deprecated: f32) -> PxJointAngularLimitPair; + + /// construct an angular soft limit pair. + /// + /// The lower value must be less than the upper value. + pub fn PxJointAngularLimitPair_new_1(lowerLimit: f32, upperLimit: f32, spring: *const PxSpring) -> 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); + + /// Construct a cone hard limit. + pub fn PxJointLimitCone_new(yLimitAngle: f32, zLimitAngle: f32, contactDist_deprecated: f32) -> PxJointLimitCone; + + /// Construct a cone soft limit. + pub fn PxJointLimitCone_new_1(yLimitAngle: f32, zLimitAngle: f32, spring: *const PxSpring) -> PxJointLimitCone; + + /// Returns true if the limit is valid. + /// + /// true if the current settings are valid + pub fn PxJointLimitCone_isValid(self_: *const PxJointLimitCone) -> bool; + + pub fn PxJointLimitCone_delete(self_: *mut PxJointLimitCone); + + /// Construct a pyramid hard limit. + pub fn PxJointLimitPyramid_new(yLimitAngleMin: f32, yLimitAngleMax: f32, zLimitAngleMin: f32, zLimitAngleMax: f32, contactDist_deprecated: f32) -> PxJointLimitPyramid; + + /// Construct a pyramid soft limit. + pub fn PxJointLimitPyramid_new_1(yLimitAngleMin: f32, yLimitAngleMax: f32, zLimitAngleMin: f32, zLimitAngleMax: f32, spring: *const PxSpring) -> PxJointLimitPyramid; + + /// Returns true if the limit is valid. + /// + /// true if the current settings are valid + pub fn PxJointLimitPyramid_isValid(self_: *const PxJointLimitPyramid) -> bool; + + pub fn PxJointLimitPyramid_delete(self_: *mut PxJointLimitPyramid); + + /// Create a prismatic joint. + pub fn phys_PxPrismaticJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxPrismaticJoint; + + /// returns the displacement of the joint along its axis. + pub fn PxPrismaticJoint_getPosition(self_: *const PxPrismaticJoint) -> f32; + + /// returns the velocity of the joint along its axis + pub fn PxPrismaticJoint_getVelocity(self_: *const PxPrismaticJoint) -> f32; + + /// sets the joint limit parameters. + /// + /// The limit range is [-PX_MAX_F32, PX_MAX_F32], but note that the width of the limit (upper-lower) must also be + /// a valid float. + pub fn PxPrismaticJoint_setLimit_mut(self_: *mut PxPrismaticJoint, anon_param0: *const PxJointLinearLimitPair); + + /// gets the joint limit parameters. + pub fn PxPrismaticJoint_getLimit(self_: *const PxPrismaticJoint) -> PxJointLinearLimitPair; + + /// Set the flags specific to the Prismatic Joint. + /// + /// Default + /// PxPrismaticJointFlags(0) + pub fn PxPrismaticJoint_setPrismaticJointFlags_mut(self_: *mut PxPrismaticJoint, flags: PxPrismaticJointFlags); + + /// Set a single flag specific to a Prismatic Joint to true or false. + pub fn PxPrismaticJoint_setPrismaticJointFlag_mut(self_: *mut PxPrismaticJoint, flag: PxPrismaticJointFlag, value: bool); + + /// Get the flags specific to the Prismatic Joint. + /// + /// the joint flags + pub fn PxPrismaticJoint_getPrismaticJointFlags(self_: *const PxPrismaticJoint) -> PxPrismaticJointFlags; + + /// Returns string name of PxPrismaticJoint, used for serialization + pub fn PxPrismaticJoint_getConcreteTypeName(self_: *const PxPrismaticJoint) -> *const std::ffi::c_char; + + /// Create a revolute joint. + pub fn phys_PxRevoluteJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxRevoluteJoint; + + /// return the angle of the joint, in the range (-2*Pi, 2*Pi] + pub fn PxRevoluteJoint_getAngle(self_: *const PxRevoluteJoint) -> f32; + + /// return the velocity of the joint + pub fn PxRevoluteJoint_getVelocity(self_: *const PxRevoluteJoint) -> f32; + + /// set the joint limit parameters. + /// + /// The limit is activated using the flag PxRevoluteJointFlag::eLIMIT_ENABLED + /// + /// The limit angle range is (-2*Pi, 2*Pi). + pub fn PxRevoluteJoint_setLimit_mut(self_: *mut PxRevoluteJoint, limits: *const PxJointAngularLimitPair); + + /// get the joint limit parameters. + /// + /// the joint limit parameters + pub fn PxRevoluteJoint_getLimit(self_: *const PxRevoluteJoint) -> PxJointAngularLimitPair; + + /// set the target velocity for the drive model. + /// + /// The motor will only be able to reach this velocity if the maxForce is sufficiently large. + /// If the joint is spinning faster than this velocity, the motor will actually try to brake + /// (see PxRevoluteJointFlag::eDRIVE_FREESPIN.) + /// + /// The sign of this variable determines the rotation direction, with positive values going + /// the same way as positive joint angles. Setting a very large target velocity may cause + /// undesirable results. + /// + /// Range: + /// (-PX_MAX_F32, PX_MAX_F32) + /// Default: + /// 0.0 + pub fn PxRevoluteJoint_setDriveVelocity_mut(self_: *mut PxRevoluteJoint, velocity: f32, autowake: bool); + + /// gets the target velocity for the drive model. + /// + /// the drive target velocity + pub fn PxRevoluteJoint_getDriveVelocity(self_: *const PxRevoluteJoint) -> f32; + + /// sets the maximum torque the drive can exert. + /// + /// The value set here may be used either as an impulse limit or a force limit, depending on the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES + /// + /// Range: + /// [0, PX_MAX_F32) + /// Default: + /// PX_MAX_F32 + pub fn PxRevoluteJoint_setDriveForceLimit_mut(self_: *mut PxRevoluteJoint, limit: f32); + + /// gets the maximum torque the drive can exert. + /// + /// the torque limit + pub fn PxRevoluteJoint_getDriveForceLimit(self_: *const PxRevoluteJoint) -> f32; + + /// sets the gear ratio for the drive. + /// + /// When setting up the drive constraint, the velocity of the first actor is scaled by this value, and its response to drive torque is scaled down. + /// So if the drive target velocity is zero, the second actor will be driven to the velocity of the first scaled by the gear ratio + /// + /// Range: + /// [0, PX_MAX_F32) + /// Default: + /// 1.0 + pub fn PxRevoluteJoint_setDriveGearRatio_mut(self_: *mut PxRevoluteJoint, ratio: f32); + + /// gets the gear ratio. + /// + /// the drive gear ratio + pub fn PxRevoluteJoint_getDriveGearRatio(self_: *const PxRevoluteJoint) -> f32; + + /// sets the flags specific to the Revolute Joint. + /// + /// Default + /// PxRevoluteJointFlags(0) + pub fn PxRevoluteJoint_setRevoluteJointFlags_mut(self_: *mut PxRevoluteJoint, flags: PxRevoluteJointFlags); + + /// sets a single flag specific to a Revolute Joint. + pub fn PxRevoluteJoint_setRevoluteJointFlag_mut(self_: *mut PxRevoluteJoint, flag: PxRevoluteJointFlag, value: bool); + + /// gets the flags specific to the Revolute Joint. + /// + /// the joint flags + pub fn PxRevoluteJoint_getRevoluteJointFlags(self_: *const PxRevoluteJoint) -> PxRevoluteJointFlags; + + /// Returns string name of PxRevoluteJoint, used for serialization + pub fn PxRevoluteJoint_getConcreteTypeName(self_: *const PxRevoluteJoint) -> *const std::ffi::c_char; + + /// Create a spherical joint. + pub fn phys_PxSphericalJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxSphericalJoint; + + /// Set the limit cone. + /// + /// If enabled, the limit cone will constrain the angular movement of the joint to lie + /// within an elliptical cone. + /// + /// the limit cone + pub fn PxSphericalJoint_getLimitCone(self_: *const PxSphericalJoint) -> PxJointLimitCone; + + /// Get the limit cone. + pub fn PxSphericalJoint_setLimitCone_mut(self_: *mut PxSphericalJoint, limit: *const PxJointLimitCone); + + /// get the swing angle of the joint from the Y axis + pub fn PxSphericalJoint_getSwingYAngle(self_: *const PxSphericalJoint) -> f32; + + /// get the swing angle of the joint from the Z axis + pub fn PxSphericalJoint_getSwingZAngle(self_: *const PxSphericalJoint) -> f32; + + /// Set the flags specific to the Spherical Joint. + /// + /// Default + /// PxSphericalJointFlags(0) + pub fn PxSphericalJoint_setSphericalJointFlags_mut(self_: *mut PxSphericalJoint, flags: PxSphericalJointFlags); + + /// Set a single flag specific to a Spherical Joint to true or false. + pub fn PxSphericalJoint_setSphericalJointFlag_mut(self_: *mut PxSphericalJoint, flag: PxSphericalJointFlag, value: bool); + + /// Get the flags specific to the Spherical Joint. + /// + /// the joint flags + pub fn PxSphericalJoint_getSphericalJointFlags(self_: *const PxSphericalJoint) -> PxSphericalJointFlags; + + /// Returns string name of PxSphericalJoint, used for serialization + pub fn PxSphericalJoint_getConcreteTypeName(self_: *const PxSphericalJoint) -> *const std::ffi::c_char; + + /// Create a D6 joint. + pub fn phys_PxD6JointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxD6Joint; + + /// default constructor for PxD6JointDrive. + pub fn PxD6JointDrive_new() -> PxD6JointDrive; + + /// constructor a PxD6JointDrive. + pub fn PxD6JointDrive_new_1(driveStiffness: f32, driveDamping: f32, driveForceLimit: f32, isAcceleration: bool) -> PxD6JointDrive; + + /// returns true if the drive is valid + pub fn PxD6JointDrive_isValid(self_: *const PxD6JointDrive) -> bool; + + /// Set the motion type around the specified axis. + /// + /// Each axis may independently specify that the degree of freedom is locked (blocking relative movement + /// along or around this axis), limited by the corresponding limit, or free. + /// + /// Default: + /// all degrees of freedom are locked + pub fn PxD6Joint_setMotion_mut(self_: *mut PxD6Joint, axis: PxD6Axis, type_: PxD6Motion); + + /// Get the motion type around the specified axis. + /// + /// the motion type around the specified axis + pub fn PxD6Joint_getMotion(self_: *const PxD6Joint, axis: PxD6Axis) -> PxD6Motion; + + /// get the twist angle of the joint, in the range (-2*Pi, 2*Pi] + pub fn PxD6Joint_getTwistAngle(self_: *const PxD6Joint) -> f32; + + /// get the swing angle of the joint from the Y axis + pub fn PxD6Joint_getSwingYAngle(self_: *const PxD6Joint) -> f32; + + /// get the swing angle of the joint from the Z axis + pub fn PxD6Joint_getSwingZAngle(self_: *const PxD6Joint) -> f32; + + /// Set the distance limit for the joint. + /// + /// A single limit constraints all linear limited degrees of freedom, forming a linear, circular + /// or spherical constraint on motion depending on the number of limited degrees. This is similar + /// to a distance limit. + pub fn PxD6Joint_setDistanceLimit_mut(self_: *mut PxD6Joint, limit: *const PxJointLinearLimit); + + /// Get the distance limit for the joint. + /// + /// the distance limit structure + pub fn PxD6Joint_getDistanceLimit(self_: *const PxD6Joint) -> PxJointLinearLimit; + + /// Set the linear limit for a given linear axis. + /// + /// This function extends the previous setDistanceLimit call with the following features: + /// - there can be a different limit for each linear axis + /// - each limit is defined by two values, i.e. it can now be asymmetric + /// + /// This can be used to create prismatic joints similar to PxPrismaticJoint, or point-in-quad joints, + /// or point-in-box joints. + pub fn PxD6Joint_setLinearLimit_mut(self_: *mut PxD6Joint, axis: PxD6Axis, limit: *const PxJointLinearLimitPair); + + /// Get the linear limit for a given linear axis. + /// + /// the linear limit pair structure from desired axis + pub fn PxD6Joint_getLinearLimit(self_: *const PxD6Joint, axis: PxD6Axis) -> PxJointLinearLimitPair; + + /// Set the twist limit for the joint. + /// + /// The twist limit controls the range of motion around the twist axis. + /// + /// The limit angle range is (-2*Pi, 2*Pi). + pub fn PxD6Joint_setTwistLimit_mut(self_: *mut PxD6Joint, limit: *const PxJointAngularLimitPair); + + /// Get the twist limit for the joint. + /// + /// the twist limit structure + pub fn PxD6Joint_getTwistLimit(self_: *const PxD6Joint) -> PxJointAngularLimitPair; + + /// Set the swing cone limit for the joint. + /// + /// The cone limit is used if either or both swing axes are limited. The extents are + /// symmetrical and measured in the frame of the parent. If only one swing degree of freedom + /// is limited, the corresponding value from the cone limit defines the limit range. + pub fn PxD6Joint_setSwingLimit_mut(self_: *mut PxD6Joint, limit: *const PxJointLimitCone); + + /// Get the cone limit for the joint. + /// + /// the swing limit structure + pub fn PxD6Joint_getSwingLimit(self_: *const PxD6Joint) -> PxJointLimitCone; + + /// Set a pyramidal swing limit for the joint. + /// + /// The pyramid limits will only be used in the following cases: + /// - both swing Y and Z are limited. The limit shape is then a pyramid. + /// - Y is limited and Z is locked, or vice versa. The limit shape is an asymmetric angular section, similar to + /// what is supported for the twist axis. + /// The remaining cases (Y limited and Z is free, or vice versa) are not supported. + pub fn PxD6Joint_setPyramidSwingLimit_mut(self_: *mut PxD6Joint, limit: *const PxJointLimitPyramid); + + /// Get the pyramidal swing limit for the joint. + /// + /// the swing limit structure + pub fn PxD6Joint_getPyramidSwingLimit(self_: *const PxD6Joint) -> PxJointLimitPyramid; + + /// Set the drive parameters for the specified drive type. + /// + /// Default + /// The default drive spring and damping values are zero, the force limit is zero, and no flags are set. + pub fn PxD6Joint_setDrive_mut(self_: *mut PxD6Joint, index: PxD6Drive, drive: *const PxD6JointDrive); + + /// Get the drive parameters for the specified drive type. + pub fn PxD6Joint_getDrive(self_: *const PxD6Joint, index: PxD6Drive) -> PxD6JointDrive; + + /// Set the drive goal pose + /// + /// The goal is relative to the constraint frame of actor[0] + /// + /// Default + /// the identity transform + pub fn PxD6Joint_setDrivePosition_mut(self_: *mut PxD6Joint, pose: *const PxTransform, autowake: bool); + + /// Get the drive goal pose. + pub fn PxD6Joint_getDrivePosition(self_: *const PxD6Joint) -> PxTransform; + + /// Set the target goal velocity for drive. + /// + /// The velocity is measured in the constraint frame of actor[0] + pub fn PxD6Joint_setDriveVelocity_mut(self_: *mut PxD6Joint, linear: *const PxVec3, angular: *const PxVec3, autowake: bool); + + /// Get the target goal velocity for joint drive. + pub fn PxD6Joint_getDriveVelocity(self_: *const PxD6Joint, linear: *mut PxVec3, angular: *mut PxVec3); + + /// Set the linear tolerance threshold for projection. Projection is enabled if PxConstraintFlag::ePROJECTION + /// is set for the joint. + /// + /// If the joint separates by more than this distance along its locked degrees of freedom, the solver + /// will move the bodies to close the distance. + /// + /// Setting a very small tolerance may result in simulation jitter or other artifacts. + /// + /// Sometimes it is not possible to project (for example when the joints form a cycle). + /// + /// Range: + /// [0, PX_MAX_F32) + /// Default: + /// 1e10f + pub fn PxD6Joint_setProjectionLinearTolerance_mut(self_: *mut PxD6Joint, tolerance: f32); + + /// Get the linear tolerance threshold for projection. + /// + /// the linear tolerance threshold + pub fn PxD6Joint_getProjectionLinearTolerance(self_: *const PxD6Joint) -> f32; + + /// Set the angular tolerance threshold for projection. Projection is enabled if + /// PxConstraintFlag::ePROJECTION is set for the joint. + /// + /// If the joint deviates by more than this angle around its locked angular degrees of freedom, + /// the solver will move the bodies to close the angle. + /// + /// Setting a very small tolerance may result in simulation jitter or other artifacts. + /// + /// Sometimes it is not possible to project (for example when the joints form a cycle). + /// + /// Range: + /// [0,Pi] + /// Default: + /// Pi + /// + /// Angular projection is implemented only for the case of two or three locked angular degrees of freedom. + pub fn PxD6Joint_setProjectionAngularTolerance_mut(self_: *mut PxD6Joint, tolerance: f32); + + /// Get the angular tolerance threshold for projection. + /// + /// tolerance the angular tolerance threshold in radians + pub fn PxD6Joint_getProjectionAngularTolerance(self_: *const PxD6Joint) -> f32; + + /// Returns string name of PxD6Joint, used for serialization + pub fn PxD6Joint_getConcreteTypeName(self_: *const PxD6Joint) -> *const std::ffi::c_char; + + /// Create a gear Joint. + pub fn phys_PxGearJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxGearJoint; + + /// Set the hinge/revolute joints connected by the gear joint. + /// + /// The passed joints can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. + /// The joints must define degrees of freedom around the twist axis. They cannot be null. + /// + /// Note that these joints are only used to compute the positional error correction term, + /// used to adjust potential drift between jointed actors. The gear joint can run without + /// calling this function, but in that case some visible overlap may develop over time between + /// the teeth of the gear meshes. + /// + /// Calling this function resets the internal positional error correction term. + /// + /// true if success + pub fn PxGearJoint_setHinges_mut(self_: *mut PxGearJoint, hinge0: *const PxBase, hinge1: *const PxBase) -> bool; + + /// Set the desired gear ratio. + /// + /// For two gears with n0 and n1 teeth respectively, the gear ratio is n0/n1. + /// + /// You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + /// + /// Calling this function resets the internal positional error correction term. + pub fn PxGearJoint_setGearRatio_mut(self_: *mut PxGearJoint, ratio: f32); + + /// Get the gear ratio. + /// + /// Current ratio + pub fn PxGearJoint_getGearRatio(self_: *const PxGearJoint) -> f32; + + pub fn PxGearJoint_getConcreteTypeName(self_: *const PxGearJoint) -> *const std::ffi::c_char; + + /// Create a rack + /// & + /// pinion Joint. + pub fn phys_PxRackAndPinionJointCreate(physics: *mut PxPhysics, actor0: *mut PxRigidActor, localFrame0: *const PxTransform, actor1: *mut PxRigidActor, localFrame1: *const PxTransform) -> *mut PxRackAndPinionJoint; + + /// Set the hinge + /// & + /// prismatic joints connected by the rack + /// & + /// pinion joint. + /// + /// The passed hinge joint can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. It cannot be null. + /// The passed prismatic joint can be either PxPrismaticJoint or PxD6Joint. It cannot be null. + /// + /// Note that these joints are only used to compute the positional error correction term, + /// used to adjust potential drift between jointed actors. The rack + /// & + /// pinion joint can run without + /// calling this function, but in that case some visible overlap may develop over time between + /// the teeth of the rack + /// & + /// pinion meshes. + /// + /// Calling this function resets the internal positional error correction term. + /// + /// true if success + pub fn PxRackAndPinionJoint_setJoints_mut(self_: *mut PxRackAndPinionJoint, hinge: *const PxBase, prismatic: *const PxBase) -> bool; + + /// Set the desired ratio directly. + /// + /// You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction. + /// + /// Calling this function resets the internal positional error correction term. + pub fn PxRackAndPinionJoint_setRatio_mut(self_: *mut PxRackAndPinionJoint, ratio: f32); + + /// Get the ratio. + /// + /// Current ratio + pub fn PxRackAndPinionJoint_getRatio(self_: *const PxRackAndPinionJoint) -> f32; + + /// Set the desired ratio indirectly. + /// + /// This is a simple helper function that computes the ratio from passed data: + /// + /// ratio = (PI*2*nbRackTeeth)/(rackLength*nbPinionTeeth) + /// + /// Calling this function resets the internal positional error correction term. + /// + /// true if success + pub fn PxRackAndPinionJoint_setData_mut(self_: *mut PxRackAndPinionJoint, nbRackTeeth: u32, nbPinionTeeth: u32, rackLength: f32) -> bool; + + pub fn PxRackAndPinionJoint_getConcreteTypeName(self_: *const PxRackAndPinionJoint) -> *const std::ffi::c_char; + + pub fn PxGroupsMask_new_alloc() -> *mut PxGroupsMask; + + pub fn PxGroupsMask_delete(self_: *mut PxGroupsMask); + + /// Implementation of a simple filter shader that emulates PhysX 2.8.x filtering + /// + /// This shader provides the following logic: + /// + /// If one of the two filter objects is a trigger, the pair is acccepted and [`PxPairFlag::eTRIGGER_DEFAULT`] will be used for trigger reports + /// + /// Else, if the filter mask logic (see further below) discards the pair it will be suppressed ([`PxFilterFlag::eSUPPRESS`]) + /// + /// Else, the pair gets accepted and collision response gets enabled ([`PxPairFlag::eCONTACT_DEFAULT`]) + /// + /// Filter mask logic: + /// Given the two [`PxFilterData`] structures fd0 and fd1 of two collision objects, the pair passes the filter if the following + /// conditions are met: + /// + /// 1) Collision groups of the pair are enabled + /// 2) Collision filtering equation is satisfied + pub fn phys_PxDefaultSimulationFilterShader(attributes0: u32, filterData0: PxFilterData, attributes1: u32, filterData1: PxFilterData, pairFlags: *mut PxPairFlags, constantBlock: *const std::ffi::c_void, constantBlockSize: u32) -> PxFilterFlags; + + /// Determines if collision detection is performed between a pair of groups + /// + /// Collision group is an integer between 0 and 31. + /// + /// True if the groups could collide + pub fn phys_PxGetGroupCollisionFlag(group1: u16, group2: u16) -> bool; + + /// Specifies if collision should be performed by a pair of groups + /// + /// Collision group is an integer between 0 and 31. + pub fn phys_PxSetGroupCollisionFlag(group1: u16, group2: u16, enable: bool); + + /// Retrieves the value set with PxSetGroup() + /// + /// Collision group is an integer between 0 and 31. + /// + /// The collision group this actor belongs to + pub fn phys_PxGetGroup(actor: *const PxActor) -> u16; + + /// Sets which collision group this actor is part of + /// + /// Collision group is an integer between 0 and 31. + pub fn phys_PxSetGroup(actor: *mut PxActor, collisionGroup: u16); + + /// Retrieves filtering operation. See comments for PxGroupsMask + pub fn phys_PxGetFilterOps(op0: *mut PxFilterOp, op1: *mut PxFilterOp, op2: *mut PxFilterOp); + + /// Setups filtering operations. See comments for PxGroupsMask + pub fn phys_PxSetFilterOps(op0: *const PxFilterOp, op1: *const PxFilterOp, op2: *const PxFilterOp); + + /// Retrieves filtering's boolean value. See comments for PxGroupsMask + /// + /// flag Boolean value for filter. + pub fn phys_PxGetFilterBool() -> bool; + + /// Setups filtering's boolean value. See comments for PxGroupsMask + pub fn phys_PxSetFilterBool(enable: bool); + + /// Gets filtering constant K0 and K1. See comments for PxGroupsMask + pub fn phys_PxGetFilterConstants(c0: *mut PxGroupsMask, c1: *mut PxGroupsMask); + + /// Setups filtering's K0 and K1 value. See comments for PxGroupsMask + pub fn phys_PxSetFilterConstants(c0: *const PxGroupsMask, c1: *const PxGroupsMask); + + /// Gets 64-bit mask used for collision filtering. See comments for PxGroupsMask + /// + /// The group mask for the actor. + pub fn phys_PxGetGroupsMask(actor: *const PxActor) -> PxGroupsMask; + + /// Sets 64-bit mask used for collision filtering. See comments for PxGroupsMask + pub fn phys_PxSetGroupsMask(actor: *mut PxActor, mask: *const PxGroupsMask); + + pub fn PxDefaultErrorCallback_new_alloc() -> *mut PxDefaultErrorCallback; + + pub fn PxDefaultErrorCallback_delete(self_: *mut PxDefaultErrorCallback); + + pub fn PxDefaultErrorCallback_reportError_mut(self_: *mut PxDefaultErrorCallback, code: PxErrorCode, message: *const std::ffi::c_char, file: *const std::ffi::c_char, line: i32); + + /// Creates a new shape with default properties and a list of materials and adds it to the list of shapes of this actor. + /// + /// This is equivalent to the following + /// + /// ```cpp + /// // reference count is 1 + /// PxShape* shape(...) = PxGetPhysics().createShape(...); + /// // increments reference count + /// actor->attachShape(shape); + /// // releases user reference, leaving reference count at 1 + /// shape->release(); + /// ``` + /// + /// As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + /// + /// The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see [`PxShapeFlag`]). + /// Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + /// non-kinematic PxRigidDynamic instances. + /// + /// Creating compounds with a very large number of shapes may adversely affect performance and stability. + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + /// + /// The newly created shape. + pub fn PxRigidActorExt_createExclusiveShape(actor: *mut PxRigidActor, geometry: *const PxGeometry, materials: *const *mut PxMaterial, materialCount: u16, shapeFlags: PxShapeFlags) -> *mut PxShape; + + /// Creates a new shape with default properties and a single material adds it to the list of shapes of this actor. + /// + /// This is equivalent to the following + /// + /// ```cpp + /// // reference count is 1 + /// PxShape* shape(...) = PxGetPhysics().createShape(...); + /// // increments reference count + /// actor->attachShape(shape); + /// // releases user reference, leaving reference count at 1 + /// shape->release(); + /// ``` + /// + /// As a consequence, detachShape() will result in the release of the last reference, and the shape will be deleted. + /// + /// The default shape flags to be set are: eVISUALIZATION, eSIMULATION_SHAPE, eSCENE_QUERY_SHAPE (see [`PxShapeFlag`]). + /// Triangle mesh, heightfield or plane geometry shapes configured as eSIMULATION_SHAPE are not supported for + /// non-kinematic PxRigidDynamic instances. + /// + /// Creating compounds with a very large number of shapes may adversely affect performance and stability. + /// + /// Sleeping: + /// Does + /// NOT + /// wake the actor up automatically. + /// + /// The newly created shape. + pub fn PxRigidActorExt_createExclusiveShape_1(actor: *mut PxRigidActor, geometry: *const PxGeometry, material: *const PxMaterial, shapeFlags: PxShapeFlags) -> *mut PxShape; + + /// Gets a list of bounds based on shapes in rigid actor. This list can be used to cook/create + /// bounding volume hierarchy though PxCooking API. + pub fn PxRigidActorExt_getRigidActorShapeLocalBoundsList(actor: *const PxRigidActor, numBounds: *mut u32) -> *mut PxBounds3; + + /// Convenience function to create a PxBVH object from a PxRigidActor. + /// + /// The computed PxBVH can then be used in PxScene::addActor() or PxAggregate::addActor(). + /// After adding the actor + /// & + /// BVH to the scene/aggregate, release the PxBVH object by calling PxBVH::release(). + /// + /// The PxBVH for this actor. + pub fn PxRigidActorExt_createBVHFromActor(physics: *mut PxPhysics, actor: *const PxRigidActor) -> *mut PxBVH; + + /// Default constructor. + pub fn PxMassProperties_new() -> PxMassProperties; + + /// Construct from individual elements. + pub fn PxMassProperties_new_1(m: f32, inertiaT: *const PxMat33, com: *const PxVec3) -> PxMassProperties; + + /// Compute mass properties based on a provided geometry structure. + /// + /// This constructor assumes the geometry has a density of 1. Mass and inertia tensor scale linearly with density. + pub fn PxMassProperties_new_2(geometry: *const PxGeometry) -> PxMassProperties; + + /// Translate the center of mass by a given vector and adjust the inertia tensor accordingly. + pub fn PxMassProperties_translate_mut(self_: *mut PxMassProperties, t: *const PxVec3); + + /// Get the entries of the diagonalized inertia tensor and the corresponding reference rotation. + /// + /// The entries of the diagonalized inertia tensor. + pub fn PxMassProperties_getMassSpaceInertia(inertia: *const PxMat33, massFrame: *mut PxQuat) -> PxVec3; + + /// Translate an inertia tensor using the parallel axis theorem + /// + /// The translated inertia tensor. + pub fn PxMassProperties_translateInertia(inertia: *const PxMat33, mass: f32, t: *const PxVec3) -> PxMat33; + + /// Rotate an inertia tensor around the center of mass + /// + /// The rotated inertia tensor. + pub fn PxMassProperties_rotateInertia(inertia: *const PxMat33, q: *const PxQuat) -> PxMat33; + + /// Non-uniform scaling of the inertia tensor + /// + /// The scaled inertia tensor. + pub fn PxMassProperties_scaleInertia(inertia: *const PxMat33, scaleRotation: *const PxQuat, scale: *const PxVec3) -> PxMat33; + + /// Sum up individual mass properties. + /// + /// The summed up mass properties. + pub fn PxMassProperties_sum(props: *const PxMassProperties, transforms: *const PxTransform, count: u32) -> PxMassProperties; + + /// Computation of mass properties for a rigid body actor + /// + /// To simulate a dynamic rigid actor, the SDK needs a mass and an inertia tensor. + /// + /// This method offers functionality to compute the necessary mass and inertia properties based on the shapes declared in + /// the PxRigidBody descriptor and some additionally specified parameters. For each shape, the shape geometry, + /// the shape positioning within the actor and the specified shape density are used to compute the body's mass and + /// inertia properties. + /// + /// Shapes without PxShapeFlag::eSIMULATION_SHAPE set are ignored unless includeNonSimShapes is true. + /// Shapes with plane, triangle mesh or heightfield geometry and PxShapeFlag::eSIMULATION_SHAPE set are not allowed for PxRigidBody collision. + /// + /// This method will set the mass, center of mass, and inertia tensor + /// + /// if no collision shapes are found, the inertia tensor is set to (1,1,1) and the mass to 1 + /// + /// if massLocalPose is non-NULL, the rigid body's center of mass parameter will be set + /// to the user provided value (massLocalPose) and the inertia tensor will be resolved at that point. + /// + /// If all shapes of the actor have the same density then the overloaded method updateMassAndInertia() with a single density parameter can be used instead. + /// + /// Boolean. True on success else false. + pub fn PxRigidBodyExt_updateMassAndInertia(body: *mut PxRigidBody, shapeDensities: *const f32, shapeDensityCount: u32, massLocalPose: *const PxVec3, includeNonSimShapes: bool) -> bool; + + /// Computation of mass properties for a rigid body actor + /// + /// See previous method for details. + /// + /// Boolean. True on success else false. + pub fn PxRigidBodyExt_updateMassAndInertia_1(body: *mut PxRigidBody, density: f32, massLocalPose: *const PxVec3, includeNonSimShapes: bool) -> bool; + + /// Computation of mass properties for a rigid body actor + /// + /// This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the sum of all user-supplied + /// shape mass values, and the inertia and center of mass are computed according to the rigid body's shapes and the per shape mass input values. + /// + /// If no collision shapes are found, the inertia tensor is set to (1,1,1) + /// + /// If a single mass value should be used for the actor as a whole then the overloaded method setMassAndUpdateInertia() with a single mass parameter can be used instead. + /// + /// Boolean. True on success else false. + pub fn PxRigidBodyExt_setMassAndUpdateInertia(body: *mut PxRigidBody, shapeMasses: *const f32, shapeMassCount: u32, massLocalPose: *const PxVec3, includeNonSimShapes: bool) -> bool; + + /// Computation of mass properties for a rigid body actor + /// + /// This method sets the mass, inertia and center of mass of a rigid body. The mass is set to the user-supplied + /// value, and the inertia and center of mass are computed according to the rigid body's shapes and the input mass. + /// + /// If no collision shapes are found, the inertia tensor is set to (1,1,1) + /// + /// Boolean. True on success else false. + pub fn PxRigidBodyExt_setMassAndUpdateInertia_1(body: *mut PxRigidBody, mass: f32, massLocalPose: *const PxVec3, includeNonSimShapes: bool) -> bool; + + /// Compute the mass, inertia tensor and center of mass from a list of shapes. + /// + /// The mass properties from the combined shapes. + pub fn PxRigidBodyExt_computeMassPropertiesFromShapes(shapes: *const *const PxShape, shapeCount: u32) -> PxMassProperties; + + /// Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + /// point in global coordinates, to the actor. + /// + /// Note that if the force does not act along the center of mass of the actor, this + /// will also add the corresponding torque. Because forces are reset at the end of every timestep, + /// you can maintain a total external force on an object by calling this once every frame. + /// + /// if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + /// articulation + /// + /// ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + /// force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + /// given point. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + pub fn PxRigidBodyExt_addForceAtPos(body: *mut PxRigidBody, force: *const PxVec3, pos: *const PxVec3, mode: PxForceMode, wakeup: bool); + + /// Applies a force (or impulse) defined in the global coordinate frame, acting at a particular + /// point in local coordinates, to the actor. + /// + /// Note that if the force does not act along the center of mass of the actor, this + /// will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + /// total external force on an object by calling this once every frame. + /// + /// if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + /// articulation + /// + /// ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + /// force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + /// given point. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + pub fn PxRigidBodyExt_addForceAtLocalPos(body: *mut PxRigidBody, force: *const PxVec3, pos: *const PxVec3, mode: PxForceMode, wakeup: bool); + + /// Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + /// particular point in global coordinates, to the actor. + /// + /// Note that if the force does not act along the center of mass of the actor, this + /// will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + /// total external force on an object by calling this once every frame. + /// + /// if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + /// articulation + /// + /// ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + /// force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + /// given point. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + pub fn PxRigidBodyExt_addLocalForceAtPos(body: *mut PxRigidBody, force: *const PxVec3, pos: *const PxVec3, mode: PxForceMode, wakeup: bool); + + /// Applies a force (or impulse) defined in the actor local coordinate frame, acting at a + /// particular point in local coordinates, to the actor. + /// + /// Note that if the force does not act along the center of mass of the actor, this + /// will also add the corresponding torque. Because forces are reset at the end of every timestep, you can maintain a + /// total external force on an object by calling this once every frame. + /// + /// if this call is used to apply a force or impulse to an articulation link, only the link is updated, not the entire + /// articulation + /// + /// ::PxForceMode determines if the force is to be conventional or impulsive. Only eFORCE and eIMPULSE are supported, as the + /// force required to produce a given velocity change or acceleration is underdetermined given only the desired change at a + /// given point. + /// + /// Sleeping: + /// This call wakes the actor if it is sleeping and the wakeup parameter is true (default). + pub fn PxRigidBodyExt_addLocalForceAtLocalPos(body: *mut PxRigidBody, force: *const PxVec3, pos: *const PxVec3, mode: PxForceMode, wakeup: bool); + + /// Computes the velocity of a point given in world coordinates if it were attached to the + /// specified body and moving with it. + /// + /// The velocity of point in the global frame. + pub fn PxRigidBodyExt_getVelocityAtPos(body: *const PxRigidBody, pos: *const PxVec3) -> PxVec3; + + /// Computes the velocity of a point given in local coordinates if it were attached to the + /// specified body and moving with it. + /// + /// The velocity of point in the local frame. + pub fn PxRigidBodyExt_getLocalVelocityAtLocalPos(body: *const PxRigidBody, pos: *const PxVec3) -> PxVec3; + + /// Computes the velocity of a point (offset from the origin of the body) given in world coordinates if it were attached to the + /// specified body and moving with it. + /// + /// The velocity of point (offset from the origin of the body) in the global frame. + pub fn PxRigidBodyExt_getVelocityAtOffset(body: *const PxRigidBody, pos: *const PxVec3) -> PxVec3; + + /// Compute the change to linear and angular velocity that would occur if an impulsive force and torque were to be applied to a specified rigid body. + /// + /// The rigid body is left unaffected unless a subsequent independent call is executed that actually applies the computed changes to velocity and angular velocity. + /// + /// if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + pub fn PxRigidBodyExt_computeVelocityDeltaFromImpulse(body: *const PxRigidBody, impulsiveForce: *const PxVec3, impulsiveTorque: *const PxVec3, deltaLinearVelocity: *mut PxVec3, deltaAngularVelocity: *mut PxVec3); + + /// Computes the linear and angular velocity change vectors for a given impulse at a world space position taking a mass and inertia scale into account + /// + /// This function is useful for extracting the respective linear and angular velocity changes from a contact or joint when the mass/inertia ratios have been adjusted. + /// + /// if this call is used to determine the velocity delta for an articulation link, only the mass properties of the link are taken into account. + pub fn PxRigidBodyExt_computeVelocityDeltaFromImpulse_1(body: *const PxRigidBody, globalPose: *const PxTransform, point: *const PxVec3, impulse: *const PxVec3, invMassScale: f32, invInertiaScale: f32, deltaLinearVelocity: *mut PxVec3, deltaAngularVelocity: *mut PxVec3); + + /// Computes the linear and angular impulse vectors for a given impulse at a world space position taking a mass and inertia scale into account + /// + /// This function is useful for extracting the respective linear and angular impulses from a contact or joint when the mass/inertia ratios have been adjusted. + pub fn PxRigidBodyExt_computeLinearAngularImpulse(body: *const PxRigidBody, globalPose: *const PxTransform, point: *const PxVec3, impulse: *const PxVec3, invMassScale: f32, invInertiaScale: f32, linearImpulse: *mut PxVec3, angularImpulse: *mut PxVec3); + + /// Performs a linear sweep through space with the body's geometry objects. + /// + /// Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + /// + /// If eTOUCH is returned from the filter callback, it will trigger an error and the hit will be discarded. + /// + /// The function sweeps all shapes attached to a given rigid body through space and reports the nearest + /// object in the scene which intersects any of of the shapes swept paths. + /// Information about the closest intersection is written to a [`PxSweepHit`] structure. + /// + /// True if a blocking hit was found. + pub fn PxRigidBodyExt_linearSweepSingle(body: *mut PxRigidBody, scene: *mut PxScene, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, closestHit: *mut PxSweepHit, shapeIndex: *mut u32, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32) -> bool; + + /// Performs a linear sweep through space with the body's geometry objects, returning all overlaps. + /// + /// Supported geometries are: box, sphere, capsule, convex. Other geometry types will be ignored. + /// + /// This function sweeps all shapes attached to a given rigid body through space and reports all + /// objects in the scene that intersect any of the shapes' swept paths until there are no more objects to report + /// or a blocking hit is encountered. + /// + /// the number of touching hits. If overflow is set to true, the results are incomplete. In case of overflow there are also no guarantees that all touching hits returned are closer than the blocking hit. + pub fn PxRigidBodyExt_linearSweepMultiple(body: *mut PxRigidBody, scene: *mut PxScene, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, touchHitBuffer: *mut PxSweepHit, touchHitShapeIndices: *mut u32, touchHitBufferSize: u32, block: *mut PxSweepHit, blockingShapeIndex: *mut i32, overflow: *mut bool, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32) -> u32; + + /// Retrieves the world space pose of the shape. + /// + /// Global pose of shape. + pub fn PxShapeExt_getGlobalPose(shape: *const PxShape, actor: *const PxRigidActor) -> PxTransform; + + /// Raycast test against the shape. + /// + /// Number of hits between the ray and the shape + pub fn PxShapeExt_raycast(shape: *const PxShape, actor: *const PxRigidActor, rayOrigin: *const PxVec3, rayDir: *const PxVec3, maxDist: f32, hitFlags: PxHitFlags, maxHits: u32, rayHits: *mut PxRaycastHit) -> u32; + + /// Test overlap between the shape and a geometry object + /// + /// True if the shape overlaps the geometry object + pub fn PxShapeExt_overlap(shape: *const PxShape, actor: *const PxRigidActor, otherGeom: *const PxGeometry, otherGeomPose: *const PxTransform) -> bool; + + /// Sweep a geometry object against the shape. + /// + /// Currently only box, sphere, capsule and convex mesh shapes are supported, i.e. the swept geometry object must be one of those types. + /// + /// True if the swept geometry object hits the shape + pub fn PxShapeExt_sweep(shape: *const PxShape, actor: *const PxRigidActor, unitDir: *const PxVec3, distance: f32, otherGeom: *const PxGeometry, otherGeomPose: *const PxTransform, sweepHit: *mut PxSweepHit, hitFlags: PxHitFlags) -> bool; + + /// Retrieves the axis aligned bounding box enclosing the shape. + /// + /// The shape's bounding box. + pub fn PxShapeExt_getWorldBounds(shape: *const PxShape, actor: *const PxRigidActor, inflation: f32) -> PxBounds3; + + pub fn PxMeshOverlapUtil_new_alloc() -> *mut PxMeshOverlapUtil; + + pub fn PxMeshOverlapUtil_delete(self_: *mut PxMeshOverlapUtil); + + /// Find the mesh triangles which touch the specified geometry object. + /// + /// Number of overlaps found. Triangle indices can then be accessed through the [`getResults`]() function. + pub fn PxMeshOverlapUtil_findOverlap_mut(self_: *mut PxMeshOverlapUtil, geom: *const PxGeometry, geomPose: *const PxTransform, meshGeom: *const PxTriangleMeshGeometry, meshPose: *const PxTransform) -> u32; + + /// Find the height field triangles which touch the specified geometry object. + /// + /// Number of overlaps found. Triangle indices can then be accessed through the [`getResults`]() function. + pub fn PxMeshOverlapUtil_findOverlap_mut_1(self_: *mut PxMeshOverlapUtil, geom: *const PxGeometry, geomPose: *const PxTransform, hfGeom: *const PxHeightFieldGeometry, hfPose: *const PxTransform) -> u32; + + /// Retrieves array of triangle indices after a findOverlap call. + /// + /// Indices of touched triangles + pub fn PxMeshOverlapUtil_getResults(self_: *const PxMeshOverlapUtil) -> *const u32; + + /// Retrieves number of triangle indices after a findOverlap call. + /// + /// Number of touched triangles + pub fn PxMeshOverlapUtil_getNbResults(self_: *const PxMeshOverlapUtil) -> u32; + + /// Computes an approximate minimum translational distance (MTD) between a geometry object and a mesh. + /// + /// This iterative function computes an approximate vector that can be used to depenetrate a geom object + /// from a triangle mesh. Returned depenetration vector should be applied to 'geom', to get out of the mesh. + /// + /// The function works best when the amount of overlap between the geom object and the mesh is small. If the + /// geom object's center goes inside the mesh, backface culling usually kicks in, no overlap is detected, + /// and the function does not compute an MTD vector. + /// + /// The function early exits if no overlap is detected after a depenetration attempt. This means that if + /// maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + /// been successful. Usually N = 4 gives good results. + /// + /// True if the MTD has successfully been computed, i.e. if objects do overlap. + pub fn phys_PxComputeTriangleMeshPenetration(direction: *mut PxVec3, depth: *mut f32, geom: *const PxGeometry, geomPose: *const PxTransform, meshGeom: *const PxTriangleMeshGeometry, meshPose: *const PxTransform, maxIter: u32, usedIter: *mut u32) -> bool; + + /// Computes an approximate minimum translational distance (MTD) between a geometry object and a heightfield. + /// + /// This iterative function computes an approximate vector that can be used to depenetrate a geom object + /// from a heightfield. Returned depenetration vector should be applied to 'geom', to get out of the heightfield. + /// + /// The function works best when the amount of overlap between the geom object and the mesh is small. If the + /// geom object's center goes inside the heightfield, backface culling usually kicks in, no overlap is detected, + /// and the function does not compute an MTD vector. + /// + /// The function early exits if no overlap is detected after a depenetration attempt. This means that if + /// maxIter = N, the code will attempt at most N iterations but it might exit earlier if depenetration has + /// been successful. Usually N = 4 gives good results. + /// + /// True if the MTD has successfully been computed, i.e. if objects do overlap. + pub fn phys_PxComputeHeightFieldPenetration(direction: *mut PxVec3, depth: *mut f32, geom: *const PxGeometry, geomPose: *const PxTransform, heightFieldGeom: *const PxHeightFieldGeometry, heightFieldPose: *const PxTransform, maxIter: u32, usedIter: *mut u32) -> bool; + + pub fn PxXmlMiscParameter_new() -> PxXmlMiscParameter; + + pub fn PxXmlMiscParameter_new_1(inUpVector: *mut PxVec3, inScale: PxTolerancesScale) -> PxXmlMiscParameter; + + /// Returns whether the collection is serializable with the externalReferences collection. + /// + /// Some definitions to explain whether a collection can be serialized or not: + /// + /// For definitions of + /// requires + /// and + /// complete + /// see [`PxSerialization::complete`] + /// + /// A serializable object is + /// subordinate + /// if it cannot be serialized on its own + /// The following objects are subordinate: + /// - articulation links + /// - articulation joints + /// - joints + /// + /// A collection C can be serialized with external references collection D iff + /// - C is complete relative to D (no dangling references) + /// - Every object in D required by an object in C has a valid ID (no unnamed references) + /// - Every subordinate object in C is required by another object in C (no orphans) + /// + /// Whether the collection is serializable + pub fn PxSerialization_isSerializable(collection: *mut PxCollection, sr: *mut PxSerializationRegistry, externalReferences: *const PxCollection) -> bool; + + /// Adds to a collection all objects such that it can be successfully serialized. + /// + /// A collection C is complete relative to an other collection D if every object required by C is either in C or D. + /// This function adds objects to a collection, such that it becomes complete with respect to the exceptFor collection. + /// Completeness is needed for serialization. See [`PxSerialization::serializeCollectionToBinary`], + /// [`PxSerialization::serializeCollectionToXml`]. + /// + /// Sdk objects require other sdk object according to the following rules: + /// - joints require their actors and constraint + /// - rigid actors require their shapes + /// - shapes require their material(s) and mesh (triangle mesh, convex mesh or height field), if any + /// - articulations require their links and joints + /// - aggregates require their actors + /// + /// If followJoints is specified another rule is added: + /// - actors require their joints + /// + /// Specifying followJoints will make whole jointed actor chains being added to the collection. Following chains + /// is interrupted whenever a object in exceptFor is encountered. + pub fn PxSerialization_complete(collection: *mut PxCollection, sr: *mut PxSerializationRegistry, exceptFor: *const PxCollection, followJoints: bool); + + /// Creates PxSerialObjectId values for unnamed objects in a collection. + /// + /// Creates PxSerialObjectId names for unnamed objects in a collection starting at a base value and incrementing, + /// skipping values that are already assigned to objects in the collection. + pub fn PxSerialization_createSerialObjectIds(collection: *mut PxCollection, base: u64); + + /// Creates a PxCollection from XML data. + /// + /// a pointer to a PxCollection if successful or NULL if it failed. + pub fn PxSerialization_createCollectionFromXml(inputData: *mut PxInputData, cooking: *mut PxCooking, sr: *mut PxSerializationRegistry, externalRefs: *const PxCollection, stringTable: *mut PxStringTable, outArgs: *mut PxXmlMiscParameter) -> *mut PxCollection; + + /// Deserializes a PxCollection from memory. + /// + /// Creates a collection from memory. If the collection has external dependencies another collection + /// can be provided to resolve these. + /// + /// The memory block provided has to be 128 bytes aligned and contain a contiguous serialized collection as written + /// by PxSerialization::serializeCollectionToBinary. The contained binary data needs to be compatible with the current binary format version + /// which is defined by "PX_PHYSICS_VERSION_MAJOR.PX_PHYSICS_VERSION_MINOR.PX_PHYSICS_VERSION_BUGFIX-PX_BINARY_SERIAL_VERSION". + /// For a list of compatible sdk releases refer to the documentation of PX_BINARY_SERIAL_VERSION. + pub fn PxSerialization_createCollectionFromBinary(memBlock: *mut std::ffi::c_void, sr: *mut PxSerializationRegistry, externalRefs: *const PxCollection) -> *mut PxCollection; + + /// Serializes a physics collection to an XML output stream. + /// + /// The collection to be serialized needs to be complete + /// + /// Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + /// + /// true if the collection is successfully serialized. + pub fn PxSerialization_serializeCollectionToXml(outputStream: *mut PxOutputStream, collection: *mut PxCollection, sr: *mut PxSerializationRegistry, cooking: *mut PxCooking, externalRefs: *const PxCollection, inArgs: *mut PxXmlMiscParameter) -> bool; + + /// Serializes a collection to a binary stream. + /// + /// Serializes a collection to a stream. In order to resolve external dependencies the externalReferences collection has to be provided. + /// Optionally names of objects that where set for example with [`PxActor::setName`] are serialized along with the objects. + /// + /// The collection can be successfully serialized if isSerializable(collection) returns true. See [`isSerializable`]. + /// + /// The implementation of the output stream needs to fulfill the requirements on the memory block input taken by + /// PxSerialization::createCollectionFromBinary. + /// + /// Serialization of objects in a scene that is simultaneously being simulated is not supported and leads to undefined behavior. + /// + /// Whether serialization was successful + pub fn PxSerialization_serializeCollectionToBinary(outputStream: *mut PxOutputStream, collection: *mut PxCollection, sr: *mut PxSerializationRegistry, externalRefs: *const PxCollection, exportNames: bool) -> bool; + + /// Creates an application managed registry for serialization. + /// + /// PxSerializationRegistry instance. + pub fn PxSerialization_createSerializationRegistry(physics: *mut PxPhysics) -> *mut PxSerializationRegistry; + + /// Deletes the dispatcher. + /// + /// Do not keep a reference to the deleted instance. + pub fn PxDefaultCpuDispatcher_release_mut(self_: *mut PxDefaultCpuDispatcher); + + /// Enables profiling at task level. + /// + /// By default enabled only in profiling builds. + pub fn PxDefaultCpuDispatcher_setRunProfiled_mut(self_: *mut PxDefaultCpuDispatcher, runProfiled: bool); + + /// Checks if profiling is enabled at task level. + /// + /// True if tasks should be profiled. + pub fn PxDefaultCpuDispatcher_getRunProfiled(self_: *const PxDefaultCpuDispatcher) -> bool; + + /// Create default dispatcher, extensions SDK needs to be initialized first. + /// + /// numThreads may be zero in which case no worker thread are initialized and + /// simulation tasks will be executed on the thread that calls PxScene::simulate() + /// + /// yieldProcessorCount must be greater than zero if eYIELD_PROCESSOR is the chosen mode and equal to zero for all other modes. + /// + /// eYIELD_THREAD and eYIELD_PROCESSOR modes will use compute resources even if the simulation is not running. + /// It is left to users to keep threads inactive, if so desired, when no simulation is running. + pub fn phys_PxDefaultCpuDispatcherCreate(numThreads: u32, affinityMasks: *mut u32, mode: PxDefaultCpuDispatcherWaitForWorkMode, yieldProcessorCount: u32) -> *mut PxDefaultCpuDispatcher; + + /// Builds smooth vertex normals over a mesh. + /// + /// - "smooth" because smoothing groups are not supported here + /// - takes angles into account for correct cube normals computation + /// + /// To use 32bit indices pass a pointer in dFaces and set wFaces to zero. Alternatively pass a pointer to + /// wFaces and set dFaces to zero. + /// + /// True on success. + pub fn phys_PxBuildSmoothNormals(nbTris: u32, nbVerts: u32, verts: *const PxVec3, dFaces: *const u32, wFaces: *const u16, normals: *mut PxVec3, flip: bool) -> bool; + + /// simple method to create a PxRigidDynamic actor with a single PxShape. + /// + /// a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + /// not be constructed + pub fn phys_PxCreateDynamic(sdk: *mut PxPhysics, transform: *const PxTransform, geometry: *const PxGeometry, material: *mut PxMaterial, density: f32, shapeOffset: *const PxTransform) -> *mut PxRigidDynamic; + + /// simple method to create a PxRigidDynamic actor with a single PxShape. + /// + /// a new dynamic actor with the PxRigidBodyFlag, or NULL if it could + /// not be constructed + pub fn phys_PxCreateDynamic_1(sdk: *mut PxPhysics, transform: *const PxTransform, shape: *mut PxShape, density: f32) -> *mut PxRigidDynamic; + + /// simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + /// + /// unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + /// kinematics of other geometry types may not participate in simulation collision and may be used only for + /// triggers or scene queries of moving objects under animation control. In this case the density parameter + /// will be ignored and the created shape will be set up as a scene query only shape (see [`PxShapeFlag::eSCENE_QUERY_SHAPE`]) + /// + /// a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + /// not be constructed + pub fn phys_PxCreateKinematic(sdk: *mut PxPhysics, transform: *const PxTransform, geometry: *const PxGeometry, material: *mut PxMaterial, density: f32, shapeOffset: *const PxTransform) -> *mut PxRigidDynamic; + + /// simple method to create a kinematic PxRigidDynamic actor with a single PxShape. + /// + /// unlike PxCreateDynamic, the geometry is not restricted to box, capsule, sphere or convex. However, + /// kinematics of other geometry types may not participate in simulation collision and may be used only for + /// triggers or scene queries of moving objects under animation control. In this case the density parameter + /// will be ignored and the created shape will be set up as a scene query only shape (see [`PxShapeFlag::eSCENE_QUERY_SHAPE`]) + /// + /// a new dynamic actor with the PxRigidBodyFlag::eKINEMATIC set, or NULL if it could + /// not be constructed + pub fn phys_PxCreateKinematic_1(sdk: *mut PxPhysics, transform: *const PxTransform, shape: *mut PxShape, density: f32) -> *mut PxRigidDynamic; + + /// simple method to create a PxRigidStatic actor with a single PxShape. + /// + /// a new static actor, or NULL if it could not be constructed + pub fn phys_PxCreateStatic(sdk: *mut PxPhysics, transform: *const PxTransform, geometry: *const PxGeometry, material: *mut PxMaterial, shapeOffset: *const PxTransform) -> *mut PxRigidStatic; + + /// simple method to create a PxRigidStatic actor with a single PxShape. + /// + /// a new static actor, or NULL if it could not be constructed + pub fn phys_PxCreateStatic_1(sdk: *mut PxPhysics, transform: *const PxTransform, shape: *mut PxShape) -> *mut PxRigidStatic; + + /// create a shape by copying attributes from another shape + /// + /// The function clones a PxShape. The following properties are copied: + /// - geometry + /// - flags + /// - materials + /// - actor-local pose + /// - contact offset + /// - rest offset + /// - simulation filter data + /// - query filter data + /// - torsional patch radius + /// - minimum torsional patch radius + /// + /// The following are not copied and retain their default values: + /// - name + /// - user data + /// + /// the newly-created rigid static + pub fn phys_PxCloneShape(physicsSDK: *mut PxPhysics, shape: *const PxShape, isExclusive: bool) -> *mut PxShape; + + /// create a static body by copying attributes from another rigid actor + /// + /// The function clones a PxRigidDynamic or PxRigidStatic as a PxRigidStatic. A uniform scale is applied. The following properties are copied: + /// - shapes + /// - actor flags + /// - owner client and client behavior bits + /// - dominance group + /// + /// The following are not copied and retain their default values: + /// - name + /// - joints or observers + /// - aggregate or scene membership + /// - user data + /// + /// Transforms are not copied with bit-exact accuracy. + /// + /// the newly-created rigid static + pub fn phys_PxCloneStatic(physicsSDK: *mut PxPhysics, transform: *const PxTransform, actor: *const PxRigidActor) -> *mut PxRigidStatic; + + /// create a dynamic body by copying attributes from an existing body + /// + /// The following properties are copied: + /// - shapes + /// - actor flags, rigidDynamic flags and rigidDynamic lock flags + /// - mass, moment of inertia, and center of mass frame + /// - linear and angular velocity + /// - linear and angular damping + /// - maximum linear velocity + /// - maximum angular velocity + /// - position and velocity solver iterations + /// - maximum depenetration velocity + /// - sleep threshold + /// - contact report threshold + /// - dominance group + /// - owner client and client behavior bits + /// - name pointer + /// - kinematic target + /// + /// The following are not copied and retain their default values: + /// - name + /// - joints or observers + /// - aggregate or scene membership + /// - sleep timer + /// - user data + /// + /// Transforms are not copied with bit-exact accuracy. + /// + /// the newly-created rigid static + pub fn phys_PxCloneDynamic(physicsSDK: *mut PxPhysics, transform: *const PxTransform, body: *const PxRigidDynamic) -> *mut PxRigidDynamic; + + /// create a plane actor. The plane equation is n.x + d = 0 + /// + /// a new static actor, or NULL if it could not be constructed + pub fn phys_PxCreatePlane(sdk: *mut PxPhysics, plane: *const PxPlane, material: *mut PxMaterial) -> *mut PxRigidStatic; + + /// scale a rigid actor by a uniform scale + /// + /// The geometry and relative positions of the actor are multiplied by the given scale value. If the actor is a rigid body or an + /// articulation link and the scaleMassProps value is true, the mass properties are scaled assuming the density is constant: the + /// center of mass is linearly scaled, the mass is multiplied by the cube of the scale, and the inertia tensor by the fifth power of the scale. + pub fn phys_PxScaleRigidActor(actor: *mut PxRigidActor, scale: f32, scaleMassProps: bool); + + pub fn PxStringTableExt_createStringTable(inAllocator: *mut PxAllocatorCallback) -> *mut PxStringTable; + + /// Creates regions for PxSceneDesc, from a global box. + /// + /// This helper simply subdivides the given global box into a 2D grid of smaller boxes. Each one of those smaller boxes + /// is a region of interest for the broadphase. There are nbSubdiv*nbSubdiv regions in the 2D grid. The function does not + /// subdivide along the given up axis. + /// + /// This is the simplest setup one can use with PxBroadPhaseType::eMBP. A more sophisticated setup would try to cover + /// the game world with a non-uniform set of regions (i.e. not just a grid). + /// + /// number of regions written out to the 'regions' array + pub fn PxBroadPhaseExt_createRegionsFromWorldBounds(regions: *mut PxBounds3, globalBounds: *const PxBounds3, nbSubdiv: u32, upAxis: u32) -> u32; + + /// Raycast returning any blocking hit, not necessarily the closest. + /// + /// Returns whether any rigid actor is hit along the ray. + /// + /// Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + /// + /// True if a blocking hit was found. + pub fn PxSceneQueryExt_raycastAny(scene: *const PxScene, origin: *const PxVec3, unitDir: *const PxVec3, distance: f32, hit: *mut PxQueryHit, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache) -> bool; + + /// Raycast returning a single result. + /// + /// Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + /// + /// Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + /// + /// True if a blocking hit was found. + pub fn PxSceneQueryExt_raycastSingle(scene: *const PxScene, origin: *const PxVec3, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, hit: *mut PxRaycastHit, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache) -> bool; + + /// Raycast returning multiple results. + /// + /// Find all rigid actors that get hit along the ray. Each result contains data as specified by the outputFlags field. + /// + /// Touching hits are not ordered. + /// + /// Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + /// + /// Number of hits in the buffer, or -1 if the buffer overflowed. + pub fn PxSceneQueryExt_raycastMultiple(scene: *const PxScene, origin: *const PxVec3, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, hitBuffer: *mut PxRaycastHit, hitBufferSize: u32, blockingHit: *mut bool, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache) -> i32; + + /// Sweep returning any blocking hit, not necessarily the closest. + /// + /// Returns whether any rigid actor is hit along the sweep path. + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + /// + /// True if a blocking hit was found. + pub fn PxSceneQueryExt_sweepAny(scene: *const PxScene, geometry: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, distance: f32, queryFlags: PxHitFlags, hit: *mut PxQueryHit, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32) -> bool; + + /// Sweep returning a single result. + /// + /// Returns the first rigid actor that is hit along the ray. Data for a blocking hit will be returned as specified by the outputFlags field. Touching hits will be ignored. + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + /// + /// True if a blocking hit was found. + pub fn PxSceneQueryExt_sweepSingle(scene: *const PxScene, geometry: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, hit: *mut PxSweepHit, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32) -> bool; + + /// Sweep returning multiple results. + /// + /// Find all rigid actors that get hit along the sweep. Each result contains data as specified by the outputFlags field. + /// + /// Touching hits are not ordered. + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, behavior is controlled by the PxSceneQueryFlag::eINITIAL_OVERLAP flag. + /// + /// Number of hits in the buffer, or -1 if the buffer overflowed. + pub fn PxSceneQueryExt_sweepMultiple(scene: *const PxScene, geometry: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, distance: f32, outputFlags: PxHitFlags, hitBuffer: *mut PxSweepHit, hitBufferSize: u32, blockingHit: *mut bool, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback, cache: *const PxQueryCache, inflation: f32) -> i32; + + /// Test overlap between a geometry and objects in the scene. + /// + /// Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both get written to the hit buffer. + /// + /// PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + /// + /// Number of hits in the buffer, or -1 if the buffer overflowed. + pub fn PxSceneQueryExt_overlapMultiple(scene: *const PxScene, geometry: *const PxGeometry, pose: *const PxTransform, hitBuffer: *mut PxOverlapHit, hitBufferSize: u32, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback) -> i32; + + /// Test returning, for a given geometry, any overlapping object in the scene. + /// + /// Filtering: Overlap tests do not distinguish between touching and blocking hit types. Both trigger a hit. + /// + /// PxHitFlag::eMESH_MULTIPLE and PxHitFlag::eMESH_BOTH_SIDES have no effect in this case + /// + /// True if an overlap was found. + pub fn PxSceneQueryExt_overlapAny(scene: *const PxScene, geometry: *const PxGeometry, pose: *const PxTransform, hit: *mut PxOverlapHit, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback) -> bool; + + pub fn PxBatchQueryExt_release_mut(self_: *mut PxBatchQueryExt); + + /// Performs a raycast against objects in the scene. + /// + /// Touching hits are not ordered. + /// + /// Shooting a ray from within an object leads to different results depending on the shape type. Please check the details in article SceneQuery. User can ignore such objects by using one of the provided filter mechanisms. + /// + /// This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + /// and overlapping writes from different threads may result in undefined behavior). + /// + /// Returns a PxRaycastBuffer pointer that will store the result of the query after execute() is completed. + /// This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + pub fn PxBatchQueryExt_raycast_mut(self_: *mut PxBatchQueryExt, origin: *const PxVec3, unitDir: *const PxVec3, distance: f32, maxNbTouches: u16, hitFlags: PxHitFlags, filterData: *const PxQueryFilterData, cache: *const PxQueryCache) -> *mut PxRaycastBuffer; + + /// Performs a sweep test against objects in the scene. + /// + /// Touching hits are not ordered. + /// + /// If a shape from the scene is already overlapping with the query shape in its starting position, + /// the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified. + /// + /// This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + /// and overlapping writes from different threads may result in undefined behavior). + /// + /// Returns a PxSweepBuffer pointer that will store the result of the query after execute() is completed. + /// This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + pub fn PxBatchQueryExt_sweep_mut(self_: *mut PxBatchQueryExt, geometry: *const PxGeometry, pose: *const PxTransform, unitDir: *const PxVec3, distance: f32, maxNbTouches: u16, hitFlags: PxHitFlags, filterData: *const PxQueryFilterData, cache: *const PxQueryCache, inflation: f32) -> *mut PxSweepBuffer; + + /// Performs an overlap test of a given geometry against objects in the scene. + /// + /// Filtering: returning eBLOCK from user filter for overlap queries will cause a warning (see [`PxQueryHitType`]). + /// + /// eBLOCK should not be returned from user filters for overlap(). Doing so will result in undefined behavior, and a warning will be issued. + /// + /// If the PxQueryFlag::eNO_BLOCK flag is set, the eBLOCK will instead be automatically converted to an eTOUCH and the warning suppressed. + /// + /// This query call writes to a list associated with the query object and is NOT thread safe (for performance reasons there is no lock + /// and overlapping writes from different threads may result in undefined behavior). + /// + /// Returns a PxOverlapBuffer pointer that will store the result of the query after execute() is completed. + /// This will point either to an element of the buffer allocated on construction or to a user buffer passed to the constructor. + pub fn PxBatchQueryExt_overlap_mut(self_: *mut PxBatchQueryExt, geometry: *const PxGeometry, pose: *const PxTransform, maxNbTouches: u16, filterData: *const PxQueryFilterData, cache: *const PxQueryCache) -> *mut PxOverlapBuffer; + + pub fn PxBatchQueryExt_execute_mut(self_: *mut PxBatchQueryExt); + + /// Create a PxBatchQueryExt without the need for pre-allocated result or touch buffers. + /// + /// Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. + /// In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. + pub fn phys_PxCreateBatchQueryExt(scene: *const PxScene, queryFilterCallback: *mut PxQueryFilterCallback, maxNbRaycasts: u32, maxNbRaycastTouches: u32, maxNbSweeps: u32, maxNbSweepTouches: u32, maxNbOverlaps: u32, maxNbOverlapTouches: u32) -> *mut PxBatchQueryExt; + + /// Create a PxBatchQueryExt with user-supplied result and touch buffers. + /// + /// Returns a PxBatchQueryExt instance. A NULL pointer will be returned if the subsequent allocations fail or if any of the arguments are illegal. + /// In the event that a NULL pointer is returned a corresponding error will be issued to the error stream. + pub fn phys_PxCreateBatchQueryExt_1(scene: *const PxScene, queryFilterCallback: *mut PxQueryFilterCallback, raycastBuffers: *mut PxRaycastBuffer, maxNbRaycasts: u32, raycastTouches: *mut PxRaycastHit, maxNbRaycastTouches: u32, sweepBuffers: *mut PxSweepBuffer, maxNbSweeps: u32, sweepTouches: *mut PxSweepHit, maxNbSweepTouches: u32, overlapBuffers: *mut PxOverlapBuffer, maxNbOverlaps: u32, overlapTouches: *mut PxOverlapHit, maxNbOverlapTouches: u32) -> *mut PxBatchQueryExt; + + /// Creates an external scene query system. + /// + /// An external SQ system is the part of a PxScene that deals with scene queries (SQ). This is usually taken care of + /// by an internal implementation inside PxScene, but it is also possible to re-route all SQ calls to an external + /// implementation, potentially opening the door to some customizations in behavior and features for advanced users. + /// + /// The following external SQ system is an example of how an implementation would look like. It re-uses much of the + /// same code as the internal version, but it could be re-implemented in a completely different way to match users' + /// specific needs. + /// + /// An external SQ system instance + pub fn phys_PxCreateExternalSceneQuerySystem(desc: *const PxSceneQueryDesc, contextID: u64) -> *mut PxSceneQuerySystem; + + /// Adds a pruner to the system. + /// + /// The internal PhysX scene-query system uses two regular pruners (one for static shapes, one for dynamic shapes) and an optional + /// compound pruner. Our custom scene query system supports an arbitrary number of regular pruners. + /// + /// This can be useful to reduce the load on each pruner, in particular during updates, when internal trees are rebuilt in the + /// background. On the other hand this implementation simply iterates over all created pruners to perform queries, so their cost + /// might increase if a large number of pruners is used. + /// + /// In any case this serves as an example of how the PxSceneQuerySystem API can be used to customize scene queries. + /// + /// A pruner index + pub fn PxCustomSceneQuerySystem_addPruner_mut(self_: *mut PxCustomSceneQuerySystem, primaryType: PxPruningStructureType, secondaryType: PxDynamicTreeSecondaryPruner, preallocated: u32) -> u32; + + /// Start custom build-steps for all pruners + /// + /// This function is used in combination with customBuildstep() and finishCustomBuildstep() to let users take control + /// of the pruners' build-step + /// & + /// commit calls - basically the pruners' update functions. These functions should be used + /// with the PxSceneQueryUpdateMode::eBUILD_DISABLED_COMMIT_DISABLED update mode, otherwise the build-steps will happen + /// automatically in fetchResults. For N pruners it can be more efficient to use these custom build-step functions to + /// perform the updates in parallel: + /// + /// - call startCustomBuildstep() first (one synchronous call) + /// - for each pruner, call customBuildstep() (asynchronous calls from multiple threads) + /// - once it is done, call finishCustomBuildstep() to finish the update (synchronous call) + /// + /// The multi-threaded update is more efficient here than what it is in PxScene, because the "flushShapes()" call is + /// also multi-threaded (while it is not in PxScene). + /// + /// Note that users are responsible for locks here, and these calls should not overlap with other SQ calls. In particular + /// one should not add new objects to the SQ system or perform queries while these calls are happening. + /// + /// The number of pruners in the system. + pub fn PxCustomSceneQuerySystem_startCustomBuildstep_mut(self_: *mut PxCustomSceneQuerySystem) -> u32; + + /// Perform a custom build-step for a given pruner. + pub fn PxCustomSceneQuerySystem_customBuildstep_mut(self_: *mut PxCustomSceneQuerySystem, index: u32); + + /// Finish custom build-steps + /// + /// Call this function once after all the customBuildstep() calls are done. + pub fn PxCustomSceneQuerySystem_finishCustomBuildstep_mut(self_: *mut PxCustomSceneQuerySystem); + + pub fn PxCustomSceneQuerySystemAdapter_delete(self_: *mut PxCustomSceneQuerySystemAdapter); + + /// Gets a pruner index for an actor/shape. + /// + /// This user-defined function tells the system in which pruner a given actor/shape should go. + /// + /// The returned index must be valid, i.e. it must have been previously returned to users by PxCustomSceneQuerySystem::addPruner. + /// + /// A pruner index for this actor/shape. + pub fn PxCustomSceneQuerySystemAdapter_getPrunerIndex(self_: *const PxCustomSceneQuerySystemAdapter, actor: *const PxRigidActor, shape: *const PxShape) -> u32; + + /// Pruner filtering callback. + /// + /// This will be called for each query to validate whether it should process a given pruner. + /// + /// True to process the pruner, false to skip it entirely + pub fn PxCustomSceneQuerySystemAdapter_processPruner(self_: *const PxCustomSceneQuerySystemAdapter, prunerIndex: u32, context: *const PxQueryThreadContext, filterData: *const PxQueryFilterData, filterCall: *mut PxQueryFilterCallback) -> bool; + + /// Creates a custom scene query system. + /// + /// This is similar to PxCreateExternalSceneQuerySystem, except this function creates a PxCustomSceneQuerySystem object. + /// It can be plugged to PxScene the same way, via PxSceneDesc::sceneQuerySystem. + /// + /// A custom SQ system instance + pub fn phys_PxCreateCustomSceneQuerySystem(sceneQueryUpdateMode: PxSceneQueryUpdateMode, contextID: u64, adapter: *const PxCustomSceneQuerySystemAdapter, usesTreeOfPruners: bool) -> *mut PxCustomSceneQuerySystem; + + /// Computes closest polygon of the convex hull geometry for a given impact point + /// and impact direction. When doing sweeps against a scene, one might want to delay + /// the rather expensive computation of the hit face index for convexes until it is clear + /// the information is really needed and then use this method to get the corresponding + /// face index. + /// + /// Closest face index of the convex geometry. + pub fn phys_PxFindFaceIndex(convexGeom: *const PxConvexMeshGeometry, geomPose: *const PxTransform, impactPos: *const PxVec3, unitDir: *const PxVec3) -> u32; + + /// Sets the sampling radius + /// + /// Returns true if the sampling was successful and false if there was a problem. Usually an internal overflow is the problem for very big meshes or very small sampling radii. + pub fn PxPoissonSampler_setSamplingRadius_mut(self_: *mut PxPoissonSampler, samplingRadius: f32) -> bool; + + /// Adds new Poisson Samples inside the sphere specified + pub fn PxPoissonSampler_addSamplesInSphere_mut(self_: *mut PxPoissonSampler, sphereCenter: *const PxVec3, sphereRadius: f32, createVolumeSamples: bool); + + /// Adds new Poisson Samples inside the box specified + pub fn PxPoissonSampler_addSamplesInBox_mut(self_: *mut PxPoissonSampler, axisAlignedBox: *const PxBounds3, boxOrientation: *const PxQuat, createVolumeSamples: bool); + + pub fn PxPoissonSampler_delete(self_: *mut PxPoissonSampler); + + /// Creates a shape sampler + /// + /// Returns the sampler + pub fn phys_PxCreateShapeSampler(geometry: *const PxGeometry, transform: *const PxTransform, worldBounds: *const PxBounds3, initialSamplingRadius: f32, numSampleAttemptsAroundPoint: i32) -> *mut PxPoissonSampler; + + /// Checks whether a point is inside the triangle mesh + /// + /// Returns true if the point is inside the triangle mesh + pub fn PxTriangleMeshPoissonSampler_isPointInTriangleMesh_mut(self_: *mut PxTriangleMeshPoissonSampler, p: *const PxVec3) -> bool; + + pub fn PxTriangleMeshPoissonSampler_delete(self_: *mut PxTriangleMeshPoissonSampler); + + /// Creates a triangle mesh sampler + /// + /// Returns the sampler + pub fn phys_PxCreateTriangleMeshSampler(triangles: *const u32, numTriangles: u32, vertices: *const PxVec3, numVertices: u32, initialSamplingRadius: f32, numSampleAttemptsAroundPoint: i32) -> *mut PxTriangleMeshPoissonSampler; + + /// Returns the index of the tetrahedron that contains a point + /// + /// The index of the tetrahedon containing the point, -1 if not tetrahedron contains the opoint + pub fn PxTetrahedronMeshExt_findTetrahedronContainingPoint(mesh: *const PxTetrahedronMesh, point: *const PxVec3, bary: *mut PxVec4, tolerance: f32) -> i32; + + /// Returns the index of the tetrahedron closest to a point + /// + /// The index of the tetrahedon closest to the point + pub fn PxTetrahedronMeshExt_findTetrahedronClosestToPoint(mesh: *const PxTetrahedronMesh, point: *const PxVec3, bary: *mut PxVec4) -> i32; + + /// Initialize the PhysXExtensions library. + /// + /// This should be called before calling any functions or methods in extensions which may require allocation. + /// + /// This function does not need to be called before creating a PxDefaultAllocator object. + pub fn phys_PxInitExtensions(physics: *mut PxPhysics, pvd: *mut PxPvd) -> bool; + + /// Shut down the PhysXExtensions library. + /// + /// This function should be called to cleanly shut down the PhysXExtensions library before application exit. + /// + /// This function is required to be called to release foundation usage. + pub fn phys_PxCloseExtensions(); + + pub fn PxRepXObject_new(inTypeName: *const std::ffi::c_char, inSerializable: *const std::ffi::c_void, inId: u64) -> PxRepXObject; + + pub fn PxRepXObject_isValid(self_: *const PxRepXObject) -> bool; + + pub fn PxRepXInstantiationArgs_new(inPhysics: *mut PxPhysics, inCooking: *mut PxCooking, inStringTable: *mut PxStringTable) -> PxRepXInstantiationArgs; + + /// The type this Serializer is meant to operate on. + pub fn PxRepXSerializer_getTypeName_mut(self_: *mut PxRepXSerializer) -> *const std::ffi::c_char; + + /// Convert from a RepX object to a key-value pair hierarchy + pub fn PxRepXSerializer_objectToFile_mut(self_: *mut PxRepXSerializer, inLiveObject: *const PxRepXObject, inCollection: *mut PxCollection, inWriter: *mut XmlWriter, inTempBuffer: *mut MemoryBuffer, inArgs: *mut PxRepXInstantiationArgs); + + /// Convert from a descriptor to a live object. Must be an object of this Serializer type. + /// + /// The new live object. It can be an invalid object if the instantiation cannot take place. + pub fn PxRepXSerializer_fileToObject_mut(self_: *mut PxRepXSerializer, inReader: *mut XmlReader, inAllocator: *mut XmlMemoryAllocator, inArgs: *mut PxRepXInstantiationArgs, inCollection: *mut PxCollection) -> PxRepXObject; + + /// Connects the SDK to the PhysX Visual Debugger application. + pub fn PxPvd_connect_mut(self_: *mut PxPvd, transport: *mut PxPvdTransport, flags: PxPvdInstrumentationFlags) -> bool; + + /// Disconnects the SDK from the PhysX Visual Debugger application. + /// If we are still connected, this will kill the entire debugger connection. + pub fn PxPvd_disconnect_mut(self_: *mut PxPvd); + + /// Return if connection to PVD is created. + pub fn PxPvd_isConnected_mut(self_: *mut PxPvd, useCachedStatus: bool) -> bool; + + /// returns the PVD data transport + /// returns NULL if no transport is present. + pub fn PxPvd_getTransport_mut(self_: *mut PxPvd) -> *mut PxPvdTransport; + + /// Retrieves the PVD flags. See PxPvdInstrumentationFlags. + pub fn PxPvd_getInstrumentationFlags_mut(self_: *mut PxPvd) -> PxPvdInstrumentationFlags; + + /// Releases the pvd instance. + pub fn PxPvd_release_mut(self_: *mut PxPvd); + + /// Create a pvd instance. + pub fn phys_PxCreatePvd(foundation: *mut PxFoundation) -> *mut PxPvd; + + /// Connects to the Visual Debugger application. + /// return True if success + pub fn PxPvdTransport_connect_mut(self_: *mut PxPvdTransport) -> bool; + + /// Disconnects from the Visual Debugger application. + /// If we are still connected, this will kill the entire debugger connection. + pub fn PxPvdTransport_disconnect_mut(self_: *mut PxPvdTransport); + + /// Return if connection to PVD is created. + pub fn PxPvdTransport_isConnected_mut(self_: *mut PxPvdTransport) -> bool; + + /// write bytes to the other endpoint of the connection. should lock before witre. If an error occurs + /// this connection will assume to be dead. + pub fn PxPvdTransport_write_mut(self_: *mut PxPvdTransport, inBytes: *const u8, inLength: u32) -> bool; + + pub fn PxPvdTransport_lock_mut(self_: *mut PxPvdTransport) -> *mut PxPvdTransport; + + pub fn PxPvdTransport_unlock_mut(self_: *mut PxPvdTransport); + + /// send any data and block until we know it is at least on the wire. + pub fn PxPvdTransport_flush_mut(self_: *mut PxPvdTransport); + + /// Return size of written data. + pub fn PxPvdTransport_getWrittenDataSize_mut(self_: *mut PxPvdTransport) -> u64; + + pub fn PxPvdTransport_release_mut(self_: *mut PxPvdTransport); + + /// Create a default socket transport. + pub fn phys_PxDefaultPvdSocketTransportCreate(host: *const std::ffi::c_char, port: i32, timeoutInMilliseconds: u32) -> *mut PxPvdTransport; + + /// Create a default file transport. + pub fn phys_PxDefaultPvdFileTransportCreate(name: *const std::ffi::c_char) -> *mut PxPvdTransport; + +} diff --git a/modules/PhysX/physx/physx-sys/src/structgen/structgen.cpp b/modules/PhysX/physx/physx-sys/src/structgen/structgen.cpp new file mode 100644 index 0000000..51d9811 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/structgen/structgen.cpp @@ -0,0 +1,3292 @@ +// 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_PxAllocatorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAssertHandler_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAllocationListener_Pod;\n"); + sg.pass_thru("struct physx_PxFoundation_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxProfilerCallback_Pod;\n"); + struct physx_PxAllocator_Pod: public physx::PxAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxAllocator_Pod", "PxAllocator"); + sg.end_struct(sizeof(physx::PxAllocator)); + } + }; + physx_PxAllocator_Pod::dump_layout(sg); + + struct physx_PxRawAllocator_Pod: public physx::PxRawAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRawAllocator_Pod", "PxRawAllocator"); + sg.end_struct(sizeof(physx::PxRawAllocator)); + } + }; + physx_PxRawAllocator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxVirtualAllocatorCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxVirtualAllocator_Pod: public physx::PxVirtualAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxVirtualAllocator_Pod", "PxVirtualAllocator"); + sg.end_struct(sizeof(physx::PxVirtualAllocator)); + } + }; + physx_PxVirtualAllocator_Pod::dump_layout(sg); + + struct physx_PxUserAllocated_Pod: public physx::PxUserAllocated { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxUserAllocated_Pod", "PxUserAllocated"); + sg.end_struct(sizeof(physx::PxUserAllocated)); + } + }; + physx_PxUserAllocated_Pod::dump_layout(sg); + + sg.pass_thru("union physx_PxTempAllocatorChunk_Pod {\n physx_PxTempAllocatorChunk_Pod* mNext;\n uint32_t mIndex;\n uint8_t mPad[16];\n};\n"); + struct physx_PxTempAllocator_Pod: public physx::PxTempAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTempAllocator_Pod", "PxTempAllocator"); + sg.end_struct(sizeof(physx::PxTempAllocator)); + } + }; + physx_PxTempAllocator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxLogTwo_Pod;\n"); + sg.pass_thru("struct physx_PxUnConst_Pod;\n"); + struct physx_PxBitAndByte_Pod: public physx::PxBitAndByte { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBitAndByte_Pod", "PxBitAndByte"); + sg.end_struct(sizeof(physx::PxBitAndByte)); + } + }; + physx_PxBitAndByte_Pod::dump_layout(sg); + + struct physx_PxBitMap_Pod: public physx::PxBitMap { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBitMap_Pod", "PxBitMap"); + sg.end_struct(sizeof(physx::PxBitMap)); + } + }; + physx_PxBitMap_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_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_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); + + sg.pass_thru("struct physx_PxErrorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAllocationListener_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBroadcastingAllocator_Pod: public physx::PxBroadcastingAllocator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadcastingAllocator_Pod", "PxBroadcastingAllocator"); + sg.end_struct(sizeof(physx::PxBroadcastingAllocator)); + } + }; + physx_PxBroadcastingAllocator_Pod::dump_layout(sg); + + struct physx_PxBroadcastingErrorCallback_Pod: public physx::PxBroadcastingErrorCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadcastingErrorCallback_Pod", "PxBroadcastingErrorCallback"); + sg.end_struct(sizeof(physx::PxBroadcastingErrorCallback)); + } + }; + physx_PxBroadcastingErrorCallback_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxHash_Pod;\n"); + sg.pass_thru("struct physx_PxInputStream_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxInputData_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxOutputStream_Pod {\n void* vtable_;\n};\n"); + 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", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column0)); + sg.add_field("physx_PxVec4_Pod column1", "column1", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column1)); + sg.add_field("physx_PxVec4_Pod column2", "column2", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column2)); + sg.add_field("physx_PxVec4_Pod column3", "column3", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxMat44_Pod, column3)); + sg.end_struct(sizeof(physx::PxMat44)); + } + }; + physx_PxMat44_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_Interpolation_Pod: public physx::Interpolation { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_Interpolation_Pod", "Interpolation"); + sg.end_struct(sizeof(physx::Interpolation)); + } + }; + physx_Interpolation_Pod::dump_layout(sg); + + struct physx_PxMutexImpl_Pod: public physx::PxMutexImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMutexImpl_Pod", "PxMutexImpl"); + sg.end_struct(sizeof(physx::PxMutexImpl)); + } + }; + physx_PxMutexImpl_Pod::dump_layout(sg); + + struct physx_PxReadWriteLock_Pod: public physx::PxReadWriteLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxReadWriteLock_Pod", "PxReadWriteLock"); + sg.end_struct(sizeof(physx::PxReadWriteLock)); + } + }; + physx_PxReadWriteLock_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxProfilerCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxProfileScoped_Pod: public physx::PxProfileScoped { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxProfileScoped_Pod", "PxProfileScoped"); + sg.add_field("physx_PxProfilerCallback_Pod* mCallback", "mCallback", "*mut PxProfilerCallback", sizeof(physx::PxProfilerCallback*), unsafe_offsetof(physx_PxProfileScoped_Pod, mCallback)); + sg.add_field("char const* mEventName", "mEventName", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxProfileScoped_Pod, mEventName)); + sg.add_field("void* mProfilerData", "mProfilerData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxProfileScoped_Pod, mProfilerData)); + sg.add_field("uint64_t mContextId", "mContextId", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxProfileScoped_Pod, mContextId)); + sg.add_field("bool mDetached", "mDetached", "bool", sizeof(bool), unsafe_offsetof(physx_PxProfileScoped_Pod, mDetached)); + sg.end_struct(sizeof(physx::PxProfileScoped)); + } + }; + physx_PxProfileScoped_Pod::dump_layout(sg); + + struct physx_PxSListEntry_Pod: public physx::PxSListEntry { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSListEntry_Pod", "PxSListEntry"); + sg.end_struct(sizeof(physx::PxSListEntry)); + } + }; + physx_PxSListEntry_Pod::dump_layout(sg); + + struct physx_PxSListImpl_Pod: public physx::PxSListImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSListImpl_Pod", "PxSListImpl"); + sg.end_struct(sizeof(physx::PxSListImpl)); + } + }; + physx_PxSListImpl_Pod::dump_layout(sg); + + struct physx_PxSyncImpl_Pod: public physx::PxSyncImpl { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSyncImpl_Pod", "PxSyncImpl"); + sg.end_struct(sizeof(physx::PxSyncImpl)); + } + }; + physx_PxSyncImpl_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxRunnable_Pod {\n void* vtable_;\n};\n"); + struct physx_PxCounterFrequencyToTensOfNanos_Pod: public physx::PxCounterFrequencyToTensOfNanos { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCounterFrequencyToTensOfNanos_Pod", "PxCounterFrequencyToTensOfNanos"); + sg.add_field("uint64_t mNumerator", "mNumerator", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxCounterFrequencyToTensOfNanos_Pod, mNumerator)); + sg.add_field("uint64_t mDenominator", "mDenominator", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxCounterFrequencyToTensOfNanos_Pod, mDenominator)); + sg.end_struct(sizeof(physx::PxCounterFrequencyToTensOfNanos)); + } + }; + physx_PxCounterFrequencyToTensOfNanos_Pod::dump_layout(sg); + + struct physx_PxTime_Pod: public physx::PxTime { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTime_Pod", "PxTime"); + sg.end_struct(sizeof(physx::PxTime)); + } + }; + physx_PxTime_Pod::dump_layout(sg); + + struct physx_PxVec2_Pod: public physx::PxVec2 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxVec2_Pod", "PxVec2"); + sg.add_field("float x", "x", "f32", sizeof(float), unsafe_offsetof(physx_PxVec2_Pod, x)); + sg.add_field("float y", "y", "f32", sizeof(float), unsafe_offsetof(physx_PxVec2_Pod, y)); + sg.end_struct(sizeof(physx::PxVec2)); + } + }; + physx_PxVec2_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_PxDebugPoint_Pod: public physx::PxDebugPoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugPoint_Pod", "PxDebugPoint"); + sg.add_field("physx_PxVec3_Pod pos", "pos", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugPoint_Pod, pos)); + sg.add_field("uint32_t color", "color", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugPoint_Pod, color)); + sg.end_struct(sizeof(physx::PxDebugPoint)); + } + }; + physx_PxDebugPoint_Pod::dump_layout(sg); + + struct physx_PxDebugLine_Pod: public physx::PxDebugLine { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugLine_Pod", "PxDebugLine"); + sg.add_field("physx_PxVec3_Pod pos0", "pos0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugLine_Pod, pos0)); + sg.add_field("uint32_t color0", "color0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugLine_Pod, color0)); + sg.add_field("physx_PxVec3_Pod pos1", "pos1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugLine_Pod, pos1)); + sg.add_field("uint32_t color1", "color1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugLine_Pod, color1)); + sg.end_struct(sizeof(physx::PxDebugLine)); + } + }; + physx_PxDebugLine_Pod::dump_layout(sg); + + struct physx_PxDebugTriangle_Pod: public physx::PxDebugTriangle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugTriangle_Pod", "PxDebugTriangle"); + sg.add_field("physx_PxVec3_Pod pos0", "pos0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos0)); + sg.add_field("uint32_t color0", "color0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color0)); + sg.add_field("physx_PxVec3_Pod pos1", "pos1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos1)); + sg.add_field("uint32_t color1", "color1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color1)); + sg.add_field("physx_PxVec3_Pod pos2", "pos2", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugTriangle_Pod, pos2)); + sg.add_field("uint32_t color2", "color2", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugTriangle_Pod, color2)); + sg.end_struct(sizeof(physx::PxDebugTriangle)); + } + }; + physx_PxDebugTriangle_Pod::dump_layout(sg); + + struct physx_PxDebugText_Pod: public physx::PxDebugText { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDebugText_Pod", "PxDebugText"); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxDebugText_Pod, position)); + sg.add_field("float size", "size", "f32", sizeof(float), unsafe_offsetof(physx_PxDebugText_Pod, size)); + sg.add_field("uint32_t color", "color", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDebugText_Pod, color)); + sg.add_field("char const* string", "string", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxDebugText_Pod, string)); + sg.end_struct(sizeof(physx::PxDebugText)); + } + }; + physx_PxDebugText_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxRenderBuffer_Pod {\n void* vtable_;\n};\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"); + 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_PxTolerancesScale_Pod: public physx::PxTolerancesScale { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTolerancesScale_Pod", "PxTolerancesScale"); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxTolerancesScale_Pod, length)); + sg.add_field("float speed", "speed", "f32", sizeof(float), unsafe_offsetof(physx_PxTolerancesScale_Pod, speed)); + sg.end_struct(sizeof(physx::PxTolerancesScale)); + } + }; + physx_PxTolerancesScale_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxStringTable_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSerializer_Pod {\n void* vtable_;\n};\n"); + struct physx_PxMetaDataEntry_Pod: public physx::PxMetaDataEntry { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMetaDataEntry_Pod", "PxMetaDataEntry"); + sg.add_field("char const* type", "type_", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxMetaDataEntry_Pod, type)); + sg.add_field("char const* name", "name", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxMetaDataEntry_Pod, name)); + sg.add_field("uint32_t offset", "offset", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, offset)); + sg.add_field("uint32_t size", "size", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, size)); + sg.add_field("uint32_t count", "count", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, count)); + sg.add_field("uint32_t offsetSize", "offsetSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, offsetSize)); + sg.add_field("uint32_t flags", "flags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, flags)); + sg.add_field("uint32_t alignment", "alignment", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxMetaDataEntry_Pod, alignment)); + sg.end_struct(sizeof(physx::PxMetaDataEntry)); + } + }; + physx_PxMetaDataEntry_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxInsertionCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBaseTask_Pod;\n"); + sg.pass_thru("struct physx_PxTask_Pod;\n"); + sg.pass_thru("struct physx_PxLightCpuTask_Pod;\n"); + sg.pass_thru("struct physx_PxCpuDispatcher_Pod;\n"); + sg.pass_thru("struct physx_PxTaskManager_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCpuDispatcher_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBaseTask_Pod: public physx::PxBaseTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBaseTask_Pod", "PxBaseTask"); + sg.end_struct(sizeof(physx::PxBaseTask)); + } + }; + physx_PxBaseTask_Pod::dump_layout(sg); + + struct physx_PxTask_Pod: public physx::PxTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTask_Pod", "PxTask"); + sg.end_struct(sizeof(physx::PxTask)); + } + }; + physx_PxTask_Pod::dump_layout(sg); + + struct physx_PxLightCpuTask_Pod: public physx::PxLightCpuTask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxLightCpuTask_Pod", "PxLightCpuTask"); + sg.end_struct(sizeof(physx::PxLightCpuTask)); + } + }; + physx_PxLightCpuTask_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_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); + + sg.pass_thru("struct physx_PxBVHRaycastCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBVHOverlapCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBVHTraversalCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBVH_Pod: public physx::PxBVH { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH_Pod", "PxBVH"); + sg.end_struct(sizeof(physx::PxBVH)); + } + }; + physx_PxBVH_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxGeomIndexPair_Pod;\n"); + 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_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_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_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_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_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_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_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); + + struct physx_PxGeometryQuery_Pod: public physx::PxGeometryQuery { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGeometryQuery_Pod", "PxGeometryQuery"); + sg.end_struct(sizeof(physx::PxGeometryQuery)); + } + }; + physx_PxGeometryQuery_Pod::dump_layout(sg); + + struct physx_PxHeightFieldSample_Pod: public physx::PxHeightFieldSample { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightFieldSample_Pod", "PxHeightFieldSample"); + sg.add_field("int16_t height", "height", "i16", sizeof(int16_t), unsafe_offsetof(physx_PxHeightFieldSample_Pod, height)); + sg.add_field("physx_PxBitAndByte_Pod materialIndex0", "materialIndex0", "PxBitAndByte", sizeof(physx::PxBitAndByte), unsafe_offsetof(physx_PxHeightFieldSample_Pod, materialIndex0)); + sg.add_field("physx_PxBitAndByte_Pod materialIndex1", "materialIndex1", "PxBitAndByte", sizeof(physx::PxBitAndByte), unsafe_offsetof(physx_PxHeightFieldSample_Pod, materialIndex1)); + sg.end_struct(sizeof(physx::PxHeightFieldSample)); + } + }; + physx_PxHeightFieldSample_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxHeightFieldDesc_Pod;\n"); + struct physx_PxHeightField_Pod: public physx::PxHeightField { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightField_Pod", "PxHeightField"); + sg.end_struct(sizeof(physx::PxHeightField)); + } + }; + physx_PxHeightField_Pod::dump_layout(sg); + + struct physx_PxHeightFieldDesc_Pod: public physx::PxHeightFieldDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxHeightFieldDesc_Pod", "PxHeightFieldDesc"); + sg.add_field("uint32_t nbRows", "nbRows", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, nbRows)); + sg.add_field("uint32_t nbColumns", "nbColumns", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, nbColumns)); + sg.add_field("int32_t format", "format", "PxHeightFieldFormat", sizeof(physx::PxHeightFieldFormat::Enum), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, format)); + sg.add_field("physx_PxStridedData_Pod samples", "samples", "PxStridedData", sizeof(physx::PxStridedData), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, samples)); + sg.add_field("float convexEdgeThreshold", "convexEdgeThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, convexEdgeThreshold)); + sg.add_field("uint16_t flags", "flags", "PxHeightFieldFlags", sizeof(physx::PxHeightFieldFlags), unsafe_offsetof(physx_PxHeightFieldDesc_Pod, flags)); + sg.end_struct(sizeof(physx::PxHeightFieldDesc)); + } + }; + physx_PxHeightFieldDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxTriangle_Pod;\n"); + struct physx_PxMeshQuery_Pod: public physx::PxMeshQuery { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMeshQuery_Pod", "PxMeshQuery"); + sg.end_struct(sizeof(physx::PxMeshQuery)); + } + }; + physx_PxMeshQuery_Pod::dump_layout(sg); + + struct physx_PxSimpleTriangleMesh_Pod: public physx::PxSimpleTriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimpleTriangleMesh_Pod", "PxSimpleTriangleMesh"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod triangles", "triangles", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, triangles)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxSimpleTriangleMesh_Pod, flags)); + sg.end_struct(sizeof(physx::PxSimpleTriangleMesh)); + } + }; + physx_PxSimpleTriangleMesh_Pod::dump_layout(sg); + + struct physx_PxTriangle_Pod: public physx::PxTriangle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangle_Pod", "PxTriangle"); + sg.add_field("physx_PxVec3_Pod verts[3]", "verts", "[PxVec3; 3]", sizeof(physx::PxVec3[3]), unsafe_offsetof(physx_PxTriangle_Pod, verts)); + sg.end_struct(sizeof(physx::PxTriangle)); + } + }; + physx_PxTriangle_Pod::dump_layout(sg); + + struct physx_PxTrianglePadded_Pod: public physx::PxTrianglePadded { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTrianglePadded_Pod", "PxTrianglePadded"); + sg.add_field("physx_PxVec3_Pod verts[3]", "verts", "[PxVec3; 3]", sizeof(physx::PxVec3[3]), unsafe_offsetof(physx_PxTrianglePadded_Pod, verts)); + sg.add_field("uint32_t padding", "padding", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxTrianglePadded_Pod, padding)); + sg.end_struct(sizeof(physx::PxTrianglePadded)); + } + }; + physx_PxTrianglePadded_Pod::dump_layout(sg); + + struct physx_PxTriangleMesh_Pod: public physx::PxTriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMesh_Pod", "PxTriangleMesh"); + sg.end_struct(sizeof(physx::PxTriangleMesh)); + } + }; + physx_PxTriangleMesh_Pod::dump_layout(sg); + + struct physx_PxBVH34TriangleMesh_Pod: public physx::PxBVH34TriangleMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH34TriangleMesh_Pod", "PxBVH34TriangleMesh"); + sg.end_struct(sizeof(physx::PxBVH34TriangleMesh)); + } + }; + physx_PxBVH34TriangleMesh_Pod::dump_layout(sg); + + struct physx_PxTetrahedron_Pod: public physx::PxTetrahedron { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedron_Pod", "PxTetrahedron"); + sg.add_field("physx_PxVec3_Pod verts[4]", "verts", "[PxVec3; 4]", sizeof(physx::PxVec3[4]), unsafe_offsetof(physx_PxTetrahedron_Pod, verts)); + sg.end_struct(sizeof(physx::PxTetrahedron)); + } + }; + physx_PxTetrahedron_Pod::dump_layout(sg); + + struct physx_PxSoftBodyAuxData_Pod: public physx::PxSoftBodyAuxData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyAuxData_Pod", "PxSoftBodyAuxData"); + sg.end_struct(sizeof(physx::PxSoftBodyAuxData)); + } + }; + physx_PxSoftBodyAuxData_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMesh_Pod: public physx::PxTetrahedronMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMesh_Pod", "PxTetrahedronMesh"); + sg.end_struct(sizeof(physx::PxTetrahedronMesh)); + } + }; + physx_PxTetrahedronMesh_Pod::dump_layout(sg); + + struct physx_PxSoftBodyMesh_Pod: public physx::PxSoftBodyMesh { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyMesh_Pod", "PxSoftBodyMesh"); + sg.end_struct(sizeof(physx::PxSoftBodyMesh)); + } + }; + physx_PxSoftBodyMesh_Pod::dump_layout(sg); + + struct physx_PxCollisionMeshMappingData_Pod: public physx::PxCollisionMeshMappingData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCollisionMeshMappingData_Pod", "PxCollisionMeshMappingData"); + sg.end_struct(sizeof(physx::PxCollisionMeshMappingData)); + } + }; + physx_PxCollisionMeshMappingData_Pod::dump_layout(sg); + + struct physx_PxSoftBodyCollisionData_Pod: public physx::PxSoftBodyCollisionData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodyCollisionData_Pod", "PxSoftBodyCollisionData"); + sg.end_struct(sizeof(physx::PxSoftBodyCollisionData)); + } + }; + physx_PxSoftBodyCollisionData_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshData_Pod: public physx::PxTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshData_Pod", "PxTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxTetrahedronMeshData)); + } + }; + physx_PxTetrahedronMeshData_Pod::dump_layout(sg); + + struct physx_PxSoftBodySimulationData_Pod: public physx::PxSoftBodySimulationData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodySimulationData_Pod", "PxSoftBodySimulationData"); + sg.end_struct(sizeof(physx::PxSoftBodySimulationData)); + } + }; + physx_PxSoftBodySimulationData_Pod::dump_layout(sg); + + struct physx_PxCollisionTetrahedronMeshData_Pod: public physx::PxCollisionTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCollisionTetrahedronMeshData_Pod", "PxCollisionTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxCollisionTetrahedronMeshData)); + } + }; + physx_PxCollisionTetrahedronMeshData_Pod::dump_layout(sg); + + struct physx_PxSimulationTetrahedronMeshData_Pod: public physx::PxSimulationTetrahedronMeshData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimulationTetrahedronMeshData_Pod", "PxSimulationTetrahedronMeshData"); + sg.end_struct(sizeof(physx::PxSimulationTetrahedronMeshData)); + } + }; + physx_PxSimulationTetrahedronMeshData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxScene_Pod;\n"); + struct physx_PxActor_Pod: public physx::PxActor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxActor_Pod", "PxActor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxActor_Pod, userData)); + sg.end_struct(sizeof(physx::PxActor)); + } + }; + physx_PxActor_Pod::dump_layout(sg); + + struct physx_PxAggregate_Pod: public physx::PxAggregate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxAggregate_Pod", "PxAggregate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxAggregate_Pod, userData)); + sg.end_struct(sizeof(physx::PxAggregate)); + } + }; + physx_PxAggregate_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.pass_thru("struct physx_PxArticulationSpatialTendon_Pod;\n"); + sg.pass_thru("struct physx_PxArticulationFixedTendon_Pod;\n"); + struct physx_PxArticulationTendonLimit_Pod: public physx::PxArticulationTendonLimit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendonLimit_Pod", "PxArticulationTendonLimit"); + sg.add_field("float lowLimit", "lowLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationTendonLimit_Pod, lowLimit)); + sg.add_field("float highLimit", "highLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxArticulationTendonLimit_Pod, highLimit)); + sg.end_struct(sizeof(physx::PxArticulationTendonLimit)); + } + }; + physx_PxArticulationTendonLimit_Pod::dump_layout(sg); + + struct physx_PxArticulationAttachment_Pod: public physx::PxArticulationAttachment { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationAttachment_Pod", "PxArticulationAttachment"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationAttachment_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationAttachment)); + } + }; + physx_PxArticulationAttachment_Pod::dump_layout(sg); + + struct physx_PxArticulationTendonJoint_Pod: public physx::PxArticulationTendonJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendonJoint_Pod", "PxArticulationTendonJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationTendonJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationTendonJoint)); + } + }; + physx_PxArticulationTendonJoint_Pod::dump_layout(sg); + + struct physx_PxArticulationTendon_Pod: public physx::PxArticulationTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationTendon_Pod", "PxArticulationTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationTendon)); + } + }; + physx_PxArticulationTendon_Pod::dump_layout(sg); + + struct physx_PxArticulationSpatialTendon_Pod: public physx::PxArticulationSpatialTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationSpatialTendon_Pod", "PxArticulationSpatialTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationSpatialTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationSpatialTendon)); + } + }; + physx_PxArticulationSpatialTendon_Pod::dump_layout(sg); + + struct physx_PxArticulationFixedTendon_Pod: public physx::PxArticulationFixedTendon { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationFixedTendon_Pod", "PxArticulationFixedTendon"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationFixedTendon_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationFixedTendon)); + } + }; + physx_PxArticulationFixedTendon_Pod::dump_layout(sg); + + struct physx_PxSpatialForce_Pod: public physx::PxSpatialForce { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpatialForce_Pod", "PxSpatialForce"); + sg.add_field("physx_PxVec3_Pod force", "force", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialForce_Pod, force)); + sg.add_field("float pad0", "pad0", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialForce_Pod, pad0)); + sg.add_field("physx_PxVec3_Pod torque", "torque", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialForce_Pod, torque)); + sg.add_field("float pad1", "pad1", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialForce_Pod, pad1)); + sg.end_struct(sizeof(physx::PxSpatialForce)); + } + }; + physx_PxSpatialForce_Pod::dump_layout(sg); + + struct physx_PxSpatialVelocity_Pod: public physx::PxSpatialVelocity { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpatialVelocity_Pod", "PxSpatialVelocity"); + sg.add_field("physx_PxVec3_Pod linear", "linear", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialVelocity_Pod, linear)); + sg.add_field("float pad0", "pad0", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialVelocity_Pod, pad0)); + sg.add_field("physx_PxVec3_Pod angular", "angular", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSpatialVelocity_Pod, angular)); + sg.add_field("float pad1", "pad1", "f32", sizeof(float), unsafe_offsetof(physx_PxSpatialVelocity_Pod, pad1)); + sg.end_struct(sizeof(physx::PxSpatialVelocity)); + } + }; + physx_PxSpatialVelocity_Pod::dump_layout(sg); + + struct physx_PxArticulationRootLinkData_Pod: public physx::PxArticulationRootLinkData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationRootLinkData_Pod", "PxArticulationRootLinkData"); + sg.add_field("physx_PxTransform_Pod transform", "transform", "PxTransform", sizeof(physx::PxTransform), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, transform)); + sg.add_field("physx_PxVec3_Pod worldLinVel", "worldLinVel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldLinVel)); + sg.add_field("physx_PxVec3_Pod worldAngVel", "worldAngVel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldAngVel)); + sg.add_field("physx_PxVec3_Pod worldLinAccel", "worldLinAccel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldLinAccel)); + sg.add_field("physx_PxVec3_Pod worldAngAccel", "worldAngAccel", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxArticulationRootLinkData_Pod, worldAngAccel)); + sg.end_struct(sizeof(physx::PxArticulationRootLinkData)); + } + }; + physx_PxArticulationRootLinkData_Pod::dump_layout(sg); + + struct physx_PxArticulationCache_Pod: public physx::PxArticulationCache { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationCache_Pod", "PxArticulationCache"); + sg.add_field("physx_PxSpatialForce_Pod* externalForces", "externalForces", "*mut PxSpatialForce", sizeof(physx::PxSpatialForce*), unsafe_offsetof(physx_PxArticulationCache_Pod, externalForces)); + sg.add_field("float* denseJacobian", "denseJacobian", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, denseJacobian)); + sg.add_field("float* massMatrix", "massMatrix", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, massMatrix)); + sg.add_field("float* jointVelocity", "jointVelocity", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointVelocity)); + sg.add_field("float* jointAcceleration", "jointAcceleration", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointAcceleration)); + sg.add_field("float* jointPosition", "jointPosition", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointPosition)); + sg.add_field("float* jointForce", "jointForce", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointForce)); + sg.add_field("float* jointSolverForces", "jointSolverForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, jointSolverForces)); + sg.add_field("physx_PxSpatialVelocity_Pod* linkVelocity", "linkVelocity", "*mut PxSpatialVelocity", sizeof(physx::PxSpatialVelocity*), unsafe_offsetof(physx_PxArticulationCache_Pod, linkVelocity)); + sg.add_field("physx_PxSpatialVelocity_Pod* linkAcceleration", "linkAcceleration", "*mut PxSpatialVelocity", sizeof(physx::PxSpatialVelocity*), unsafe_offsetof(physx_PxArticulationCache_Pod, linkAcceleration)); + sg.add_field("physx_PxArticulationRootLinkData_Pod* rootLinkData", "rootLinkData", "*mut PxArticulationRootLinkData", sizeof(physx::PxArticulationRootLinkData*), unsafe_offsetof(physx_PxArticulationCache_Pod, rootLinkData)); + sg.add_field("physx_PxSpatialForce_Pod* sensorForces", "sensorForces", "*mut PxSpatialForce", sizeof(physx::PxSpatialForce*), unsafe_offsetof(physx_PxArticulationCache_Pod, sensorForces)); + sg.add_field("float* coefficientMatrix", "coefficientMatrix", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, coefficientMatrix)); + sg.add_field("float* lambda", "lambda", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxArticulationCache_Pod, lambda)); + sg.add_field("void* scratchMemory", "scratchMemory", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationCache_Pod, scratchMemory)); + sg.add_field("void* scratchAllocator", "scratchAllocator", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationCache_Pod, scratchAllocator)); + sg.add_field("uint32_t version", "version", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxArticulationCache_Pod, version)); + sg.end_struct(sizeof(physx::PxArticulationCache)); + } + }; + physx_PxArticulationCache_Pod::dump_layout(sg); + + struct physx_PxArticulationSensor_Pod: public physx::PxArticulationSensor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationSensor_Pod", "PxArticulationSensor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationSensor_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationSensor)); + } + }; + physx_PxArticulationSensor_Pod::dump_layout(sg); + + struct physx_PxArticulationReducedCoordinate_Pod: public physx::PxArticulationReducedCoordinate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationReducedCoordinate_Pod", "PxArticulationReducedCoordinate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationReducedCoordinate_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationReducedCoordinate)); + } + }; + physx_PxArticulationReducedCoordinate_Pod::dump_layout(sg); + + struct physx_PxArticulationJointReducedCoordinate_Pod: public physx::PxArticulationJointReducedCoordinate { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationJointReducedCoordinate_Pod", "PxArticulationJointReducedCoordinate"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationJointReducedCoordinate_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationJointReducedCoordinate)); + } + }; + physx_PxArticulationJointReducedCoordinate_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); + + struct physx_PxRigidActor_Pod: public physx::PxRigidActor { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidActor_Pod", "PxRigidActor"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidActor_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidActor)); + } + }; + physx_PxRigidActor_Pod::dump_layout(sg); + + struct physx_PxNodeIndex_Pod: public physx::PxNodeIndex { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxNodeIndex_Pod", "PxNodeIndex"); + sg.end_struct(sizeof(physx::PxNodeIndex)); + } + }; + physx_PxNodeIndex_Pod::dump_layout(sg); + + struct physx_PxRigidBody_Pod: public physx::PxRigidBody { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidBody_Pod", "PxRigidBody"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidBody_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidBody)); + } + }; + physx_PxRigidBody_Pod::dump_layout(sg); + + struct physx_PxArticulationLink_Pod: public physx::PxArticulationLink { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxArticulationLink_Pod", "PxArticulationLink"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxArticulationLink_Pod, userData)); + sg.end_struct(sizeof(physx::PxArticulationLink)); + } + }; + physx_PxArticulationLink_Pod::dump_layout(sg); + + struct physx_PxConeLimitedConstraint_Pod: public physx::PxConeLimitedConstraint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConeLimitedConstraint_Pod", "PxConeLimitedConstraint"); + sg.add_field("physx_PxVec3_Pod mAxis", "mAxis", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mAxis)); + sg.add_field("float mAngle", "mAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mAngle)); + sg.add_field("float mLowLimit", "mLowLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mLowLimit)); + sg.add_field("float mHighLimit", "mHighLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxConeLimitedConstraint_Pod, mHighLimit)); + sg.end_struct(sizeof(physx::PxConeLimitedConstraint)); + } + }; + physx_PxConeLimitedConstraint_Pod::dump_layout(sg); + + struct physx_PxConeLimitParams_Pod: public physx::PxConeLimitParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConeLimitParams_Pod", "PxConeLimitParams"); + sg.add_field("physx_PxVec4_Pod lowHighLimits", "lowHighLimits", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxConeLimitParams_Pod, lowHighLimits)); + sg.add_field("physx_PxVec4_Pod axisAngle", "axisAngle", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxConeLimitParams_Pod, axisAngle)); + sg.end_struct(sizeof(physx::PxConeLimitParams)); + } + }; + physx_PxConeLimitParams_Pod::dump_layout(sg); + + struct physx_PxConstraintShaderTable_Pod: public physx::PxConstraintShaderTable { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraintShaderTable_Pod", "PxConstraintShaderTable"); + sg.add_field("void * solverPrep", "solverPrep", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, solverPrep)); + sg.add_field("void * visualize", "visualize", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, visualize)); + sg.add_field("int32_t flag", "flag", "PxConstraintFlag", sizeof(physx::PxConstraintFlag::Enum), unsafe_offsetof(physx_PxConstraintShaderTable_Pod, flag)); + sg.end_struct(sizeof(physx::PxConstraintShaderTable)); + } + }; + physx_PxConstraintShaderTable_Pod::dump_layout(sg); + + struct physx_PxConstraint_Pod: public physx::PxConstraint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraint_Pod", "PxConstraint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxConstraint_Pod, userData)); + sg.end_struct(sizeof(physx::PxConstraint)); + } + }; + physx_PxConstraint_Pod::dump_layout(sg); + + struct physx_PxMassModificationProps_Pod: public physx::PxMassModificationProps { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMassModificationProps_Pod", "PxMassModificationProps"); + sg.add_field("float mInvMassScale0", "mInvMassScale0", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvMassScale0)); + sg.add_field("float mInvInertiaScale0", "mInvInertiaScale0", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvInertiaScale0)); + sg.add_field("float mInvMassScale1", "mInvMassScale1", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvMassScale1)); + sg.add_field("float mInvInertiaScale1", "mInvInertiaScale1", "f32", sizeof(float), unsafe_offsetof(physx_PxMassModificationProps_Pod, mInvInertiaScale1)); + sg.end_struct(sizeof(physx::PxMassModificationProps)); + } + }; + physx_PxMassModificationProps_Pod::dump_layout(sg); + + struct physx_PxContactPatch_Pod: public physx::PxContactPatch { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPatch_Pod", "PxContactPatch"); + sg.add_field("physx_PxMassModificationProps_Pod mMassModification", "mMassModification", "PxMassModificationProps", sizeof(physx::PxMassModificationProps), unsafe_offsetof(physx_PxContactPatch_Pod, mMassModification)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPatch_Pod, normal)); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, restitution)); + sg.add_field("float dynamicFriction", "dynamicFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, dynamicFriction)); + sg.add_field("float staticFriction", "staticFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, staticFriction)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPatch_Pod, damping)); + sg.add_field("uint16_t startContactIndex", "startContactIndex", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, startContactIndex)); + sg.add_field("uint8_t nbContacts", "nbContacts", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPatch_Pod, nbContacts)); + sg.add_field("uint8_t materialFlags", "materialFlags", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialFlags)); + sg.add_field("uint16_t internalFlags", "internalFlags", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, internalFlags)); + sg.add_field("uint16_t materialIndex0", "materialIndex0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialIndex0)); + sg.add_field("uint16_t materialIndex1", "materialIndex1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPatch_Pod, materialIndex1)); + sg.add_field("uint16_t pad[5]", "pad", "[u16; 5]", sizeof(uint16_t[5]), unsafe_offsetof(physx_PxContactPatch_Pod, pad)); + sg.end_struct(sizeof(physx::PxContactPatch)); + } + }; + physx_PxContactPatch_Pod::dump_layout(sg); + + struct physx_PxContact_Pod: public physx::PxContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContact_Pod", "PxContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxContact_Pod, separation)); + sg.end_struct(sizeof(physx::PxContact)); + } + }; + physx_PxContact_Pod::dump_layout(sg); + + struct physx_PxExtendedContact_Pod: public physx::PxExtendedContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxExtendedContact_Pod", "PxExtendedContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxExtendedContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxExtendedContact_Pod, separation)); + sg.add_field("physx_PxVec3_Pod targetVelocity", "targetVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxExtendedContact_Pod, targetVelocity)); + sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxExtendedContact_Pod, maxImpulse)); + sg.end_struct(sizeof(physx::PxExtendedContact)); + } + }; + physx_PxExtendedContact_Pod::dump_layout(sg); + + struct physx_PxModifiableContact_Pod: public physx::PxModifiableContact { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxModifiableContact_Pod", "PxModifiableContact"); + sg.add_field("physx_PxVec3_Pod contact", "contact", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, contact)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, separation)); + sg.add_field("physx_PxVec3_Pod targetVelocity", "targetVelocity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, targetVelocity)); + sg.add_field("float maxImpulse", "maxImpulse", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, maxImpulse)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxModifiableContact_Pod, normal)); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, restitution)); + sg.add_field("uint32_t materialFlags", "materialFlags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialFlags)); + sg.add_field("uint16_t materialIndex0", "materialIndex0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialIndex0)); + sg.add_field("uint16_t materialIndex1", "materialIndex1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxModifiableContact_Pod, materialIndex1)); + sg.add_field("float staticFriction", "staticFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, staticFriction)); + sg.add_field("float dynamicFriction", "dynamicFriction", "f32", sizeof(float), unsafe_offsetof(physx_PxModifiableContact_Pod, dynamicFriction)); + sg.end_struct(sizeof(physx::PxModifiableContact)); + } + }; + physx_PxModifiableContact_Pod::dump_layout(sg); + + struct physx_PxContactStreamIterator_Pod: public physx::PxContactStreamIterator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactStreamIterator_Pod", "PxContactStreamIterator"); + sg.add_field("physx_PxVec3_Pod zero", "zero", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactStreamIterator_Pod, zero)); + sg.add_field("physx_PxContactPatch_Pod const* patch", "patch", "*const PxContactPatch", sizeof(physx::PxContactPatch const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, patch)); + sg.add_field("physx_PxContact_Pod const* contact", "contact", "*const PxContact", sizeof(physx::PxContact const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contact)); + sg.add_field("uint32_t const* faceIndice", "faceIndice", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxContactStreamIterator_Pod, faceIndice)); + sg.add_field("uint32_t totalPatches", "totalPatches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, totalPatches)); + sg.add_field("uint32_t totalContacts", "totalContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, totalContacts)); + sg.add_field("uint32_t nextContactIndex", "nextContactIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, nextContactIndex)); + sg.add_field("uint32_t nextPatchIndex", "nextPatchIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, nextPatchIndex)); + sg.add_field("uint32_t contactPatchHeaderSize", "contactPatchHeaderSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contactPatchHeaderSize)); + sg.add_field("uint32_t contactPointSize", "contactPointSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, contactPointSize)); + sg.add_field("int32_t mStreamFormat", "mStreamFormat", "StreamFormat", sizeof(physx::PxContactStreamIterator::StreamFormat), unsafe_offsetof(physx_PxContactStreamIterator_Pod, mStreamFormat)); + sg.add_field("uint32_t forceNoResponse", "forceNoResponse", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, forceNoResponse)); + sg.add_field("bool pointStepped", "pointStepped", "bool", sizeof(bool), unsafe_offsetof(physx_PxContactStreamIterator_Pod, pointStepped)); + sg.add_field("uint32_t hasFaceIndices", "hasFaceIndices", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactStreamIterator_Pod, hasFaceIndices)); + sg.end_struct(sizeof(physx::PxContactStreamIterator)); + } + }; + physx_PxContactStreamIterator_Pod::dump_layout(sg); + + struct physx_PxGpuContactPair_Pod: public physx::PxGpuContactPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuContactPair_Pod", "PxGpuContactPair"); + sg.add_field("uint8_t* contactPatches", "contactPatches", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactPatches)); + sg.add_field("uint8_t* contactPoints", "contactPoints", "*mut u8", sizeof(uint8_t*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactPoints)); + sg.add_field("float* contactForces", "contactForces", "*mut f32", sizeof(float*), unsafe_offsetof(physx_PxGpuContactPair_Pod, contactForces)); + sg.add_field("uint32_t transformCacheRef0", "transformCacheRef0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, transformCacheRef0)); + sg.add_field("uint32_t transformCacheRef1", "transformCacheRef1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, transformCacheRef1)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex0", "nodeIndex0", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuContactPair_Pod, nodeIndex0)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex1", "nodeIndex1", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuContactPair_Pod, nodeIndex1)); + sg.add_field("physx_PxActor_Pod* actor0", "actor0", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxGpuContactPair_Pod, actor0)); + sg.add_field("physx_PxActor_Pod* actor1", "actor1", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxGpuContactPair_Pod, actor1)); + sg.add_field("uint16_t nbContacts", "nbContacts", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, nbContacts)); + sg.add_field("uint16_t nbPatches", "nbPatches", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGpuContactPair_Pod, nbPatches)); + sg.end_struct(sizeof(physx::PxGpuContactPair)); + } + }; + physx_PxGpuContactPair_Pod::dump_layout(sg); + + struct physx_PxContactSet_Pod: public physx::PxContactSet { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactSet_Pod", "PxContactSet"); + sg.end_struct(sizeof(physx::PxContactSet)); + } + }; + physx_PxContactSet_Pod::dump_layout(sg); + + struct physx_PxContactModifyPair_Pod: public physx::PxContactModifyPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactModifyPair_Pod", "PxContactModifyPair"); + sg.add_field("physx_PxRigidActor_Pod const* actor[2]", "actor", "[*const PxRigidActor; 2]", sizeof(physx::PxRigidActor const*[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, actor)); + sg.add_field("physx_PxShape_Pod const* shape[2]", "shape", "[*const PxShape; 2]", sizeof(physx::PxShape const*[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, shape)); + sg.add_field("physx_PxTransform_Pod transform[2]", "transform", "[PxTransform; 2]", sizeof(physx::PxTransform[2]), unsafe_offsetof(physx_PxContactModifyPair_Pod, transform)); + sg.add_field("physx_PxContactSet_Pod contacts", "contacts", "PxContactSet", sizeof(physx::PxContactSet), unsafe_offsetof(physx_PxContactModifyPair_Pod, contacts)); + sg.end_struct(sizeof(physx::PxContactModifyPair)); + } + }; + physx_PxContactModifyPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxContactModifyCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCCDContactModifyCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxDeletionListener_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBaseMaterial_Pod: public physx::PxBaseMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBaseMaterial_Pod", "PxBaseMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBaseMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxBaseMaterial)); + } + }; + physx_PxBaseMaterial_Pod::dump_layout(sg); + + struct physx_PxFEMMaterial_Pod: public physx::PxFEMMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFEMMaterial_Pod", "PxFEMMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxFEMMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxFEMMaterial)); + } + }; + physx_PxFEMMaterial_Pod::dump_layout(sg); + + struct physx_PxFilterData_Pod: public physx::PxFilterData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFilterData_Pod", "PxFilterData"); + sg.add_field("uint32_t word0", "word0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word0)); + sg.add_field("uint32_t word1", "word1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word1)); + sg.add_field("uint32_t word2", "word2", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word2)); + sg.add_field("uint32_t word3", "word3", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxFilterData_Pod, word3)); + sg.end_struct(sizeof(physx::PxFilterData)); + } + }; + physx_PxFilterData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSimulationFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxParticleRigidFilterPair_Pod: public physx::PxParticleRigidFilterPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleRigidFilterPair_Pod", "PxParticleRigidFilterPair"); + sg.add_field("uint64_t mID0", "mID0", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxParticleRigidFilterPair_Pod, mID0)); + sg.add_field("uint64_t mID1", "mID1", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxParticleRigidFilterPair_Pod, mID1)); + sg.end_struct(sizeof(physx::PxParticleRigidFilterPair)); + } + }; + physx_PxParticleRigidFilterPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxLockedData_Pod {\n void* vtable_;\n};\n"); + struct physx_PxMaterial_Pod: public physx::PxMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMaterial_Pod", "PxMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxMaterial)); + } + }; + physx_PxMaterial_Pod::dump_layout(sg); + + struct physx_PxGpuParticleBufferIndexPair_Pod: public physx::PxGpuParticleBufferIndexPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuParticleBufferIndexPair_Pod", "PxGpuParticleBufferIndexPair"); + sg.add_field("uint32_t systemIndex", "systemIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuParticleBufferIndexPair_Pod, systemIndex)); + sg.add_field("uint32_t bufferIndex", "bufferIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuParticleBufferIndexPair_Pod, bufferIndex)); + sg.end_struct(sizeof(physx::PxGpuParticleBufferIndexPair)); + } + }; + physx_PxGpuParticleBufferIndexPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCudaContextManager_Pod;\n"); + sg.pass_thru("struct physx_PxParticleRigidAttachment_Pod;\n"); + struct physx_PxParticleVolume_Pod: public physx::PxParticleVolume { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleVolume_Pod", "PxParticleVolume"); + sg.add_field("physx_PxBounds3_Pod bound", "bound", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxParticleVolume_Pod, bound)); + sg.add_field("uint32_t particleIndicesOffset", "particleIndicesOffset", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleVolume_Pod, particleIndicesOffset)); + sg.add_field("uint32_t numParticles", "numParticles", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleVolume_Pod, numParticles)); + sg.end_struct(sizeof(physx::PxParticleVolume)); + } + }; + physx_PxParticleVolume_Pod::dump_layout(sg); + + struct physx_PxDiffuseParticleParams_Pod: public physx::PxDiffuseParticleParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDiffuseParticleParams_Pod", "PxDiffuseParticleParams"); + sg.add_field("float threshold", "threshold", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, threshold)); + sg.add_field("float lifetime", "lifetime", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, lifetime)); + sg.add_field("float airDrag", "airDrag", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, airDrag)); + sg.add_field("float bubbleDrag", "bubbleDrag", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, bubbleDrag)); + sg.add_field("float buoyancy", "buoyancy", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, buoyancy)); + sg.add_field("float kineticEnergyWeight", "kineticEnergyWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, kineticEnergyWeight)); + sg.add_field("float pressureWeight", "pressureWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, pressureWeight)); + sg.add_field("float divergenceWeight", "divergenceWeight", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, divergenceWeight)); + sg.add_field("float collisionDecay", "collisionDecay", "f32", sizeof(float), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, collisionDecay)); + sg.add_field("bool useAccurateVelocity", "useAccurateVelocity", "bool", sizeof(bool), unsafe_offsetof(physx_PxDiffuseParticleParams_Pod, useAccurateVelocity)); + sg.end_struct(sizeof(physx::PxDiffuseParticleParams)); + } + }; + physx_PxDiffuseParticleParams_Pod::dump_layout(sg); + + struct physx_PxParticleSpring_Pod: public physx::PxParticleSpring { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleSpring_Pod", "PxParticleSpring"); + sg.add_field("uint32_t ind0", "ind0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleSpring_Pod, ind0)); + sg.add_field("uint32_t ind1", "ind1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxParticleSpring_Pod, ind1)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, length)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, damping)); + sg.add_field("float pad", "pad", "f32", sizeof(float), unsafe_offsetof(physx_PxParticleSpring_Pod, pad)); + sg.end_struct(sizeof(physx::PxParticleSpring)); + } + }; + physx_PxParticleSpring_Pod::dump_layout(sg); + + struct physx_PxParticleMaterial_Pod: public physx::PxParticleMaterial { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxParticleMaterial_Pod", "PxParticleMaterial"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxParticleMaterial_Pod, userData)); + sg.end_struct(sizeof(physx::PxParticleMaterial)); + } + }; + physx_PxParticleMaterial_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneDesc_Pod;\n"); + sg.pass_thru("struct physx_PxPvd_Pod;\n"); + sg.pass_thru("struct physx_PxOmniPvd_Pod;\n"); + sg.pass_thru("struct physx_PxPhysics_Pod {\n void* vtable_;\n};\n"); + struct physx_PxActorShape_Pod: public physx::PxActorShape { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxActorShape_Pod", "PxActorShape"); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxActorShape_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxActorShape_Pod, shape)); + sg.end_struct(sizeof(physx::PxActorShape)); + } + }; + physx_PxActorShape_Pod::dump_layout(sg); + + struct physx_PxRaycastHit_Pod: public physx::PxRaycastHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastHit_Pod", "PxRaycastHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastHit_Pod, faceIndex)); + sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxRaycastHit_Pod, flags)); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxRaycastHit_Pod, position)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxRaycastHit_Pod, normal)); + sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, distance)); + sg.add_field("float u", "u", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, u)); + sg.add_field("float v", "v", "f32", sizeof(float), unsafe_offsetof(physx_PxRaycastHit_Pod, v)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxRaycastHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxRaycastHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxRaycastHit)); + } + }; + physx_PxRaycastHit_Pod::dump_layout(sg); + + struct physx_PxOverlapHit_Pod: public physx::PxOverlapHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapHit_Pod", "PxOverlapHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapHit_Pod, faceIndex)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxOverlapHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxOverlapHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxOverlapHit)); + } + }; + physx_PxOverlapHit_Pod::dump_layout(sg); + + struct physx_PxSweepHit_Pod: public physx::PxSweepHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepHit_Pod", "PxSweepHit"); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepHit_Pod, faceIndex)); + sg.add_field("uint16_t flags", "flags", "PxHitFlags", sizeof(physx::PxHitFlags), unsafe_offsetof(physx_PxSweepHit_Pod, flags)); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSweepHit_Pod, position)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSweepHit_Pod, normal)); + sg.add_field("float distance", "distance", "f32", sizeof(float), unsafe_offsetof(physx_PxSweepHit_Pod, distance)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxSweepHit_Pod, actor)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxSweepHit_Pod, shape)); + sg.end_struct(sizeof(physx::PxSweepHit)); + } + }; + physx_PxSweepHit_Pod::dump_layout(sg); + + struct physx_PxRaycastCallback_Pod: public physx::PxRaycastCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastCallback_Pod", "PxRaycastCallback"); + sg.add_field("physx_PxRaycastHit_Pod block", "block", "PxRaycastHit", sizeof(physx::PxRaycastHit), unsafe_offsetof(physx_PxRaycastCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxRaycastCallback_Pod, hasBlock)); + sg.add_field("physx_PxRaycastHit_Pod* touches", "touches", "*mut PxRaycastHit", sizeof(physx::PxRaycastHit*), unsafe_offsetof(physx_PxRaycastCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxRaycastCallback)); + } + }; + physx_PxRaycastCallback_Pod::dump_layout(sg); + + struct physx_PxOverlapCallback_Pod: public physx::PxOverlapCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapCallback_Pod", "PxOverlapCallback"); + sg.add_field("physx_PxOverlapHit_Pod block", "block", "PxOverlapHit", sizeof(physx::PxOverlapHit), unsafe_offsetof(physx_PxOverlapCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxOverlapCallback_Pod, hasBlock)); + sg.add_field("physx_PxOverlapHit_Pod* touches", "touches", "*mut PxOverlapHit", sizeof(physx::PxOverlapHit*), unsafe_offsetof(physx_PxOverlapCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxOverlapCallback)); + } + }; + physx_PxOverlapCallback_Pod::dump_layout(sg); + + struct physx_PxSweepCallback_Pod: public physx::PxSweepCallback { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepCallback_Pod", "PxSweepCallback"); + sg.add_field("physx_PxSweepHit_Pod block", "block", "PxSweepHit", sizeof(physx::PxSweepHit), unsafe_offsetof(physx_PxSweepCallback_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxSweepCallback_Pod, hasBlock)); + sg.add_field("physx_PxSweepHit_Pod* touches", "touches", "*mut PxSweepHit", sizeof(physx::PxSweepHit*), unsafe_offsetof(physx_PxSweepCallback_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepCallback_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepCallback_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxSweepCallback)); + } + }; + physx_PxSweepCallback_Pod::dump_layout(sg); + + struct physx_PxRaycastBuffer_Pod: public physx::PxRaycastBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRaycastBuffer_Pod", "PxRaycastBuffer"); + sg.add_field("physx_PxRaycastHit_Pod block", "block", "PxRaycastHit", sizeof(physx::PxRaycastHit), unsafe_offsetof(physx_PxRaycastBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxRaycastBuffer_Pod, hasBlock)); + sg.add_field("physx_PxRaycastHit_Pod* touches", "touches", "*mut PxRaycastHit", sizeof(physx::PxRaycastHit*), unsafe_offsetof(physx_PxRaycastBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxRaycastBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxRaycastBuffer)); + } + }; + physx_PxRaycastBuffer_Pod::dump_layout(sg); + + struct physx_PxOverlapBuffer_Pod: public physx::PxOverlapBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxOverlapBuffer_Pod", "PxOverlapBuffer"); + sg.add_field("physx_PxOverlapHit_Pod block", "block", "PxOverlapHit", sizeof(physx::PxOverlapHit), unsafe_offsetof(physx_PxOverlapBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxOverlapBuffer_Pod, hasBlock)); + sg.add_field("physx_PxOverlapHit_Pod* touches", "touches", "*mut PxOverlapHit", sizeof(physx::PxOverlapHit*), unsafe_offsetof(physx_PxOverlapBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxOverlapBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxOverlapBuffer)); + } + }; + physx_PxOverlapBuffer_Pod::dump_layout(sg); + + struct physx_PxSweepBuffer_Pod: public physx::PxSweepBuffer { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSweepBuffer_Pod", "PxSweepBuffer"); + sg.add_field("physx_PxSweepHit_Pod block", "block", "PxSweepHit", sizeof(physx::PxSweepHit), unsafe_offsetof(physx_PxSweepBuffer_Pod, block)); + sg.add_field("bool hasBlock", "hasBlock", "bool", sizeof(bool), unsafe_offsetof(physx_PxSweepBuffer_Pod, hasBlock)); + sg.add_field("physx_PxSweepHit_Pod* touches", "touches", "*mut PxSweepHit", sizeof(physx::PxSweepHit*), unsafe_offsetof(physx_PxSweepBuffer_Pod, touches)); + sg.add_field("uint32_t maxNbTouches", "maxNbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepBuffer_Pod, maxNbTouches)); + sg.add_field("uint32_t nbTouches", "nbTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSweepBuffer_Pod, nbTouches)); + sg.end_struct(sizeof(physx::PxSweepBuffer)); + } + }; + physx_PxSweepBuffer_Pod::dump_layout(sg); + + struct physx_PxQueryCache_Pod: public physx::PxQueryCache { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxQueryCache_Pod", "PxQueryCache"); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxQueryCache_Pod, shape)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxQueryCache_Pod, actor)); + sg.add_field("uint32_t faceIndex", "faceIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxQueryCache_Pod, faceIndex)); + sg.end_struct(sizeof(physx::PxQueryCache)); + } + }; + physx_PxQueryCache_Pod::dump_layout(sg); + + struct physx_PxQueryFilterData_Pod: public physx::PxQueryFilterData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxQueryFilterData_Pod", "PxQueryFilterData"); + sg.add_field("physx_PxFilterData_Pod data", "data", "PxFilterData", sizeof(physx::PxFilterData), unsafe_offsetof(physx_PxQueryFilterData_Pod, data)); + sg.add_field("uint16_t flags", "flags", "PxQueryFlags", sizeof(physx::PxQueryFlags), unsafe_offsetof(physx_PxQueryFilterData_Pod, flags)); + sg.end_struct(sizeof(physx::PxQueryFilterData)); + } + }; + physx_PxQueryFilterData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxQueryFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxRigidDynamic_Pod: public physx::PxRigidDynamic { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidDynamic_Pod", "PxRigidDynamic"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidDynamic_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidDynamic)); + } + }; + physx_PxRigidDynamic_Pod::dump_layout(sg); + + struct physx_PxRigidStatic_Pod: public physx::PxRigidStatic { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidStatic_Pod", "PxRigidStatic"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRigidStatic_Pod, userData)); + sg.end_struct(sizeof(physx::PxRigidStatic)); + } + }; + physx_PxRigidStatic_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneQuerySystem_Pod;\n"); + struct physx_PxSceneQueryDesc_Pod: public physx::PxSceneQueryDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneQueryDesc_Pod", "PxSceneQueryDesc"); + sg.add_field("int32_t staticStructure", "staticStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticStructure)); + sg.add_field("int32_t dynamicStructure", "dynamicStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicStructure)); + sg.add_field("uint32_t dynamicTreeRebuildRateHint", "dynamicTreeRebuildRateHint", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicTreeRebuildRateHint)); + sg.add_field("int32_t dynamicTreeSecondaryPruner", "dynamicTreeSecondaryPruner", "PxDynamicTreeSecondaryPruner", sizeof(physx::PxDynamicTreeSecondaryPruner::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicTreeSecondaryPruner)); + sg.add_field("int32_t staticBVHBuildStrategy", "staticBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticBVHBuildStrategy)); + sg.add_field("int32_t dynamicBVHBuildStrategy", "dynamicBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicBVHBuildStrategy)); + sg.add_field("uint32_t staticNbObjectsPerNode", "staticNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, staticNbObjectsPerNode)); + sg.add_field("uint32_t dynamicNbObjectsPerNode", "dynamicNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, dynamicNbObjectsPerNode)); + sg.add_field("int32_t sceneQueryUpdateMode", "sceneQueryUpdateMode", "PxSceneQueryUpdateMode", sizeof(physx::PxSceneQueryUpdateMode::Enum), unsafe_offsetof(physx_PxSceneQueryDesc_Pod, sceneQueryUpdateMode)); + sg.end_struct(sizeof(physx::PxSceneQueryDesc)); + } + }; + physx_PxSceneQueryDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSceneQuerySystemBase_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSceneSQSystem_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxSceneQuerySystem_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBroadPhaseRegion_Pod: public physx::PxBroadPhaseRegion { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseRegion_Pod", "PxBroadPhaseRegion"); + sg.add_field("physx_PxBounds3_Pod mBounds", "mBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxBroadPhaseRegion_Pod, mBounds)); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBroadPhaseRegion_Pod, mUserData)); + sg.end_struct(sizeof(physx::PxBroadPhaseRegion)); + } + }; + physx_PxBroadPhaseRegion_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseRegionInfo_Pod: public physx::PxBroadPhaseRegionInfo { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseRegionInfo_Pod", "PxBroadPhaseRegionInfo"); + sg.add_field("physx_PxBroadPhaseRegion_Pod mRegion", "mRegion", "PxBroadPhaseRegion", sizeof(physx::PxBroadPhaseRegion), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mRegion)); + sg.add_field("uint32_t mNbStaticObjects", "mNbStaticObjects", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mNbStaticObjects)); + sg.add_field("uint32_t mNbDynamicObjects", "mNbDynamicObjects", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mNbDynamicObjects)); + sg.add_field("bool mActive", "mActive", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mActive)); + sg.add_field("bool mOverlap", "mOverlap", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseRegionInfo_Pod, mOverlap)); + sg.end_struct(sizeof(physx::PxBroadPhaseRegionInfo)); + } + }; + physx_PxBroadPhaseRegionInfo_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseCaps_Pod: public physx::PxBroadPhaseCaps { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseCaps_Pod", "PxBroadPhaseCaps"); + sg.add_field("uint32_t mMaxNbRegions", "mMaxNbRegions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseCaps_Pod, mMaxNbRegions)); + sg.end_struct(sizeof(physx::PxBroadPhaseCaps)); + } + }; + physx_PxBroadPhaseCaps_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseDesc_Pod: public physx::PxBroadPhaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseDesc_Pod", "PxBroadPhaseDesc"); + sg.add_field("int32_t mType", "mType", "PxBroadPhaseType", sizeof(physx::PxBroadPhaseType::Enum), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mType)); + sg.add_field("uint64_t mContextID", "mContextID", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mContextID)); + sg.add_field("uint32_t mFoundLostPairsCapacity", "mFoundLostPairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mFoundLostPairsCapacity)); + sg.add_field("bool mDiscardStaticVsKinematic", "mDiscardStaticVsKinematic", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mDiscardStaticVsKinematic)); + sg.add_field("bool mDiscardKinematicVsKinematic", "mDiscardKinematicVsKinematic", "bool", sizeof(bool), unsafe_offsetof(physx_PxBroadPhaseDesc_Pod, mDiscardKinematicVsKinematic)); + sg.end_struct(sizeof(physx::PxBroadPhaseDesc)); + } + }; + physx_PxBroadPhaseDesc_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseUpdateData_Pod: public physx::PxBroadPhaseUpdateData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseUpdateData_Pod", "PxBroadPhaseUpdateData"); + sg.add_field("uint32_t const* mCreated", "mCreated", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mCreated)); + sg.add_field("uint32_t mNbCreated", "mNbCreated", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbCreated)); + sg.add_field("uint32_t const* mUpdated", "mUpdated", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mUpdated)); + sg.add_field("uint32_t mNbUpdated", "mNbUpdated", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbUpdated)); + sg.add_field("uint32_t const* mRemoved", "mRemoved", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mRemoved)); + sg.add_field("uint32_t mNbRemoved", "mNbRemoved", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mNbRemoved)); + sg.add_field("physx_PxBounds3_Pod const* mBounds", "mBounds", "*const PxBounds3", sizeof(physx::PxBounds3 const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mBounds)); + sg.add_field("uint32_t const* mGroups", "mGroups", "*const u32", sizeof(uint32_t const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mGroups)); + sg.add_field("float const* mDistances", "mDistances", "*const f32", sizeof(float const*), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mDistances)); + sg.add_field("uint32_t mCapacity", "mCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseUpdateData_Pod, mCapacity)); + sg.end_struct(sizeof(physx::PxBroadPhaseUpdateData)); + } + }; + physx_PxBroadPhaseUpdateData_Pod::dump_layout(sg); + + struct physx_PxBroadPhasePair_Pod: public physx::PxBroadPhasePair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhasePair_Pod", "PxBroadPhasePair"); + sg.add_field("uint32_t mID0", "mID0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhasePair_Pod, mID0)); + sg.add_field("uint32_t mID1", "mID1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhasePair_Pod, mID1)); + sg.end_struct(sizeof(physx::PxBroadPhasePair)); + } + }; + physx_PxBroadPhasePair_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseResults_Pod: public physx::PxBroadPhaseResults { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseResults_Pod", "PxBroadPhaseResults"); + sg.add_field("uint32_t mNbCreatedPairs", "mNbCreatedPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mNbCreatedPairs)); + sg.add_field("physx_PxBroadPhasePair_Pod const* mCreatedPairs", "mCreatedPairs", "*const PxBroadPhasePair", sizeof(physx::PxBroadPhasePair const*), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mCreatedPairs)); + sg.add_field("uint32_t mNbDeletedPairs", "mNbDeletedPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mNbDeletedPairs)); + sg.add_field("physx_PxBroadPhasePair_Pod const* mDeletedPairs", "mDeletedPairs", "*const PxBroadPhasePair", sizeof(physx::PxBroadPhasePair const*), unsafe_offsetof(physx_PxBroadPhaseResults_Pod, mDeletedPairs)); + sg.end_struct(sizeof(physx::PxBroadPhaseResults)); + } + }; + physx_PxBroadPhaseResults_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBroadPhaseRegions_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBroadPhase_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxAABBManager_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxBroadPhaseCallback_Pod;\n"); + sg.pass_thru("struct physx_PxSimulationEventCallback_Pod;\n"); + struct physx_PxSceneLimits_Pod: public physx::PxSceneLimits { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneLimits_Pod", "PxSceneLimits"); + sg.add_field("uint32_t maxNbActors", "maxNbActors", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbActors)); + sg.add_field("uint32_t maxNbBodies", "maxNbBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbBodies)); + sg.add_field("uint32_t maxNbStaticShapes", "maxNbStaticShapes", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbStaticShapes)); + sg.add_field("uint32_t maxNbDynamicShapes", "maxNbDynamicShapes", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbDynamicShapes)); + sg.add_field("uint32_t maxNbAggregates", "maxNbAggregates", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbAggregates)); + sg.add_field("uint32_t maxNbConstraints", "maxNbConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbConstraints)); + sg.add_field("uint32_t maxNbRegions", "maxNbRegions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbRegions)); + sg.add_field("uint32_t maxNbBroadPhaseOverlaps", "maxNbBroadPhaseOverlaps", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneLimits_Pod, maxNbBroadPhaseOverlaps)); + sg.end_struct(sizeof(physx::PxSceneLimits)); + } + }; + physx_PxSceneLimits_Pod::dump_layout(sg); + + struct physx_PxgDynamicsMemoryConfig_Pod: public physx::PxgDynamicsMemoryConfig { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxgDynamicsMemoryConfig_Pod", "PxgDynamicsMemoryConfig"); + sg.add_field("uint32_t tempBufferCapacity", "tempBufferCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, tempBufferCapacity)); + sg.add_field("uint32_t maxRigidContactCount", "maxRigidContactCount", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxRigidContactCount)); + sg.add_field("uint32_t maxRigidPatchCount", "maxRigidPatchCount", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxRigidPatchCount)); + sg.add_field("uint32_t heapCapacity", "heapCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, heapCapacity)); + sg.add_field("uint32_t foundLostPairsCapacity", "foundLostPairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, foundLostPairsCapacity)); + sg.add_field("uint32_t foundLostAggregatePairsCapacity", "foundLostAggregatePairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, foundLostAggregatePairsCapacity)); + sg.add_field("uint32_t totalAggregatePairsCapacity", "totalAggregatePairsCapacity", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, totalAggregatePairsCapacity)); + sg.add_field("uint32_t maxSoftBodyContacts", "maxSoftBodyContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxSoftBodyContacts)); + sg.add_field("uint32_t maxFemClothContacts", "maxFemClothContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxFemClothContacts)); + sg.add_field("uint32_t maxParticleContacts", "maxParticleContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxParticleContacts)); + sg.add_field("uint32_t collisionStackSize", "collisionStackSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, collisionStackSize)); + sg.add_field("uint32_t maxHairContacts", "maxHairContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxgDynamicsMemoryConfig_Pod, maxHairContacts)); + sg.end_struct(sizeof(physx::PxgDynamicsMemoryConfig)); + } + }; + physx_PxgDynamicsMemoryConfig_Pod::dump_layout(sg); + + struct physx_PxSceneDesc_Pod: public physx::PxSceneDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneDesc_Pod", "PxSceneDesc"); + sg.add_field("int32_t staticStructure", "staticStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticStructure)); + sg.add_field("int32_t dynamicStructure", "dynamicStructure", "PxPruningStructureType", sizeof(physx::PxPruningStructureType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicStructure)); + sg.add_field("uint32_t dynamicTreeRebuildRateHint", "dynamicTreeRebuildRateHint", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicTreeRebuildRateHint)); + sg.add_field("int32_t dynamicTreeSecondaryPruner", "dynamicTreeSecondaryPruner", "PxDynamicTreeSecondaryPruner", sizeof(physx::PxDynamicTreeSecondaryPruner::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicTreeSecondaryPruner)); + sg.add_field("int32_t staticBVHBuildStrategy", "staticBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticBVHBuildStrategy)); + sg.add_field("int32_t dynamicBVHBuildStrategy", "dynamicBVHBuildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicBVHBuildStrategy)); + sg.add_field("uint32_t staticNbObjectsPerNode", "staticNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, staticNbObjectsPerNode)); + sg.add_field("uint32_t dynamicNbObjectsPerNode", "dynamicNbObjectsPerNode", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, dynamicNbObjectsPerNode)); + sg.add_field("int32_t sceneQueryUpdateMode", "sceneQueryUpdateMode", "PxSceneQueryUpdateMode", sizeof(physx::PxSceneQueryUpdateMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, sceneQueryUpdateMode)); + sg.add_field("physx_PxVec3_Pod gravity", "gravity", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSceneDesc_Pod, gravity)); + sg.add_field("physx_PxSimulationEventCallback_Pod* simulationEventCallback", "simulationEventCallback", "*mut PxSimulationEventCallback", sizeof(physx::PxSimulationEventCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, simulationEventCallback)); + sg.add_field("physx_PxContactModifyCallback_Pod* contactModifyCallback", "contactModifyCallback", "*mut PxContactModifyCallback", sizeof(physx::PxContactModifyCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, contactModifyCallback)); + sg.add_field("physx_PxCCDContactModifyCallback_Pod* ccdContactModifyCallback", "ccdContactModifyCallback", "*mut PxCCDContactModifyCallback", sizeof(physx::PxCCDContactModifyCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdContactModifyCallback)); + sg.add_field("void const* filterShaderData", "filterShaderData", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShaderData)); + sg.add_field("uint32_t filterShaderDataSize", "filterShaderDataSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShaderDataSize)); + sg.add_field("void * filterShader", "filterShader", "*mut std::ffi::c_void", sizeof(void *), unsafe_offsetof(physx_PxSceneDesc_Pod, filterShader)); + sg.add_field("physx_PxSimulationFilterCallback_Pod* filterCallback", "filterCallback", "*mut PxSimulationFilterCallback", sizeof(physx::PxSimulationFilterCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, filterCallback)); + sg.add_field("int32_t kineKineFilteringMode", "kineKineFilteringMode", "PxPairFilteringMode", sizeof(physx::PxPairFilteringMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, kineKineFilteringMode)); + sg.add_field("int32_t staticKineFilteringMode", "staticKineFilteringMode", "PxPairFilteringMode", sizeof(physx::PxPairFilteringMode::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, staticKineFilteringMode)); + sg.add_field("int32_t broadPhaseType", "broadPhaseType", "PxBroadPhaseType", sizeof(physx::PxBroadPhaseType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, broadPhaseType)); + sg.add_field("physx_PxBroadPhaseCallback_Pod* broadPhaseCallback", "broadPhaseCallback", "*mut PxBroadPhaseCallback", sizeof(physx::PxBroadPhaseCallback*), unsafe_offsetof(physx_PxSceneDesc_Pod, broadPhaseCallback)); + sg.add_field("physx_PxSceneLimits_Pod limits", "limits", "PxSceneLimits", sizeof(physx::PxSceneLimits), unsafe_offsetof(physx_PxSceneDesc_Pod, limits)); + sg.add_field("int32_t frictionType", "frictionType", "PxFrictionType", sizeof(physx::PxFrictionType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionType)); + sg.add_field("int32_t solverType", "solverType", "PxSolverType", sizeof(physx::PxSolverType::Enum), unsafe_offsetof(physx_PxSceneDesc_Pod, solverType)); + sg.add_field("float bounceThresholdVelocity", "bounceThresholdVelocity", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, bounceThresholdVelocity)); + sg.add_field("float frictionOffsetThreshold", "frictionOffsetThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionOffsetThreshold)); + sg.add_field("float frictionCorrelationDistance", "frictionCorrelationDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, frictionCorrelationDistance)); + sg.add_field("uint32_t flags", "flags", "PxSceneFlags", sizeof(physx::PxSceneFlags), unsafe_offsetof(physx_PxSceneDesc_Pod, flags)); + sg.add_field("physx_PxCpuDispatcher_Pod* cpuDispatcher", "cpuDispatcher", "*mut PxCpuDispatcher", sizeof(physx::PxCpuDispatcher*), unsafe_offsetof(physx_PxSceneDesc_Pod, cpuDispatcher)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSceneDesc_Pod, userData)); + sg.add_field("uint32_t solverBatchSize", "solverBatchSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, solverBatchSize)); + sg.add_field("uint32_t solverArticulationBatchSize", "solverArticulationBatchSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, solverArticulationBatchSize)); + sg.add_field("uint32_t nbContactDataBlocks", "nbContactDataBlocks", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, nbContactDataBlocks)); + sg.add_field("uint32_t maxNbContactDataBlocks", "maxNbContactDataBlocks", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, maxNbContactDataBlocks)); + sg.add_field("float maxBiasCoefficient", "maxBiasCoefficient", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, maxBiasCoefficient)); + sg.add_field("uint32_t contactReportStreamBufferSize", "contactReportStreamBufferSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, contactReportStreamBufferSize)); + sg.add_field("uint32_t ccdMaxPasses", "ccdMaxPasses", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdMaxPasses)); + sg.add_field("float ccdThreshold", "ccdThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdThreshold)); + sg.add_field("float ccdMaxSeparation", "ccdMaxSeparation", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, ccdMaxSeparation)); + sg.add_field("float wakeCounterResetValue", "wakeCounterResetValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSceneDesc_Pod, wakeCounterResetValue)); + sg.add_field("physx_PxBounds3_Pod sanityBounds", "sanityBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxSceneDesc_Pod, sanityBounds)); + sg.add_field("physx_PxgDynamicsMemoryConfig_Pod gpuDynamicsConfig", "gpuDynamicsConfig", "PxgDynamicsMemoryConfig", sizeof(physx::PxgDynamicsMemoryConfig), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuDynamicsConfig)); + sg.add_field("uint32_t gpuMaxNumPartitions", "gpuMaxNumPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuMaxNumPartitions)); + sg.add_field("uint32_t gpuMaxNumStaticPartitions", "gpuMaxNumStaticPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuMaxNumStaticPartitions)); + sg.add_field("uint32_t gpuComputeVersion", "gpuComputeVersion", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, gpuComputeVersion)); + sg.add_field("uint32_t contactPairSlabSize", "contactPairSlabSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSceneDesc_Pod, contactPairSlabSize)); + sg.add_field("physx_PxSceneQuerySystem_Pod* sceneQuerySystem", "sceneQuerySystem", "*mut PxSceneQuerySystem", sizeof(physx::PxSceneQuerySystem*), unsafe_offsetof(physx_PxSceneDesc_Pod, sceneQuerySystem)); + sg.end_struct(sizeof(physx::PxSceneDesc)); + } + }; + physx_PxSceneDesc_Pod::dump_layout(sg); + + struct physx_PxSimulationStatistics_Pod: public physx::PxSimulationStatistics { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSimulationStatistics_Pod", "PxSimulationStatistics"); + sg.add_field("uint32_t nbActiveConstraints", "nbActiveConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveConstraints)); + sg.add_field("uint32_t nbActiveDynamicBodies", "nbActiveDynamicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveDynamicBodies)); + sg.add_field("uint32_t nbActiveKinematicBodies", "nbActiveKinematicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbActiveKinematicBodies)); + sg.add_field("uint32_t nbStaticBodies", "nbStaticBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbStaticBodies)); + sg.add_field("uint32_t nbDynamicBodies", "nbDynamicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDynamicBodies)); + sg.add_field("uint32_t nbKinematicBodies", "nbKinematicBodies", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbKinematicBodies)); + sg.add_field("uint32_t nbShapes[11]", "nbShapes", "[u32; 11]", sizeof(uint32_t[11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbShapes)); + sg.add_field("uint32_t nbAggregates", "nbAggregates", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbAggregates)); + sg.add_field("uint32_t nbArticulations", "nbArticulations", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbArticulations)); + sg.add_field("uint32_t nbAxisSolverConstraints", "nbAxisSolverConstraints", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbAxisSolverConstraints)); + sg.add_field("uint32_t compressedContactSize", "compressedContactSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, compressedContactSize)); + sg.add_field("uint32_t requiredContactConstraintMemory", "requiredContactConstraintMemory", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, requiredContactConstraintMemory)); + sg.add_field("uint32_t peakConstraintMemory", "peakConstraintMemory", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, peakConstraintMemory)); + sg.add_field("uint32_t nbDiscreteContactPairsTotal", "nbDiscreteContactPairsTotal", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsTotal)); + sg.add_field("uint32_t nbDiscreteContactPairsWithCacheHits", "nbDiscreteContactPairsWithCacheHits", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsWithCacheHits)); + sg.add_field("uint32_t nbDiscreteContactPairsWithContacts", "nbDiscreteContactPairsWithContacts", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairsWithContacts)); + sg.add_field("uint32_t nbNewPairs", "nbNewPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbNewPairs)); + sg.add_field("uint32_t nbLostPairs", "nbLostPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbLostPairs)); + sg.add_field("uint32_t nbNewTouches", "nbNewTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbNewTouches)); + sg.add_field("uint32_t nbLostTouches", "nbLostTouches", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbLostTouches)); + sg.add_field("uint32_t nbPartitions", "nbPartitions", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbPartitions)); + sg.add_field("uint64_t gpuMemParticles", "gpuMemParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemParticles)); + sg.add_field("uint64_t gpuMemSoftBodies", "gpuMemSoftBodies", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemSoftBodies)); + sg.add_field("uint64_t gpuMemFEMCloths", "gpuMemFEMCloths", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemFEMCloths)); + sg.add_field("uint64_t gpuMemHairSystems", "gpuMemHairSystems", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHairSystems)); + sg.add_field("uint64_t gpuMemHeap", "gpuMemHeap", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeap)); + sg.add_field("uint64_t gpuMemHeapBroadPhase", "gpuMemHeapBroadPhase", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapBroadPhase)); + sg.add_field("uint64_t gpuMemHeapNarrowPhase", "gpuMemHeapNarrowPhase", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapNarrowPhase)); + sg.add_field("uint64_t gpuMemHeapSolver", "gpuMemHeapSolver", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSolver)); + sg.add_field("uint64_t gpuMemHeapArticulation", "gpuMemHeapArticulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapArticulation)); + sg.add_field("uint64_t gpuMemHeapSimulation", "gpuMemHeapSimulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulation)); + sg.add_field("uint64_t gpuMemHeapSimulationArticulation", "gpuMemHeapSimulationArticulation", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationArticulation)); + sg.add_field("uint64_t gpuMemHeapSimulationParticles", "gpuMemHeapSimulationParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationParticles)); + sg.add_field("uint64_t gpuMemHeapSimulationSoftBody", "gpuMemHeapSimulationSoftBody", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationSoftBody)); + sg.add_field("uint64_t gpuMemHeapSimulationFEMCloth", "gpuMemHeapSimulationFEMCloth", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationFEMCloth)); + sg.add_field("uint64_t gpuMemHeapSimulationHairSystem", "gpuMemHeapSimulationHairSystem", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSimulationHairSystem)); + sg.add_field("uint64_t gpuMemHeapParticles", "gpuMemHeapParticles", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapParticles)); + sg.add_field("uint64_t gpuMemHeapSoftBodies", "gpuMemHeapSoftBodies", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapSoftBodies)); + sg.add_field("uint64_t gpuMemHeapFEMCloths", "gpuMemHeapFEMCloths", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapFEMCloths)); + sg.add_field("uint64_t gpuMemHeapHairSystems", "gpuMemHeapHairSystems", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapHairSystems)); + sg.add_field("uint64_t gpuMemHeapOther", "gpuMemHeapOther", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, gpuMemHeapOther)); + sg.add_field("uint32_t nbBroadPhaseAdds", "nbBroadPhaseAdds", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbBroadPhaseAdds)); + sg.add_field("uint32_t nbBroadPhaseRemoves", "nbBroadPhaseRemoves", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbBroadPhaseRemoves)); + sg.add_field("uint32_t nbDiscreteContactPairs[11][11]", "nbDiscreteContactPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbDiscreteContactPairs)); + sg.add_field("uint32_t nbCCDPairs[11][11]", "nbCCDPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbCCDPairs)); + sg.add_field("uint32_t nbModifiedContactPairs[11][11]", "nbModifiedContactPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbModifiedContactPairs)); + sg.add_field("uint32_t nbTriggerPairs[11][11]", "nbTriggerPairs", "[[u32; 11]; 11]", sizeof(uint32_t[11][11]), unsafe_offsetof(physx_PxSimulationStatistics_Pod, nbTriggerPairs)); + sg.end_struct(sizeof(physx::PxSimulationStatistics)); + } + }; + physx_PxSimulationStatistics_Pod::dump_layout(sg); + + struct physx_PxGpuBodyData_Pod: public physx::PxGpuBodyData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuBodyData_Pod", "PxGpuBodyData"); + sg.add_field("physx_PxQuat_Pod quat", "quat", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxGpuBodyData_Pod, quat)); + sg.add_field("physx_PxVec4_Pod pos", "pos", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, pos)); + sg.add_field("physx_PxVec4_Pod linVel", "linVel", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, linVel)); + sg.add_field("physx_PxVec4_Pod angVel", "angVel", "PxVec4", sizeof(physx::PxVec4), unsafe_offsetof(physx_PxGpuBodyData_Pod, angVel)); + sg.end_struct(sizeof(physx::PxGpuBodyData)); + } + }; + physx_PxGpuBodyData_Pod::dump_layout(sg); + + struct physx_PxGpuActorPair_Pod: public physx::PxGpuActorPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGpuActorPair_Pod", "PxGpuActorPair"); + sg.add_field("uint32_t srcIndex", "srcIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxGpuActorPair_Pod, srcIndex)); + sg.add_field("physx_PxNodeIndex_Pod nodeIndex", "nodeIndex", "PxNodeIndex", sizeof(physx::PxNodeIndex), unsafe_offsetof(physx_PxGpuActorPair_Pod, nodeIndex)); + sg.end_struct(sizeof(physx::PxGpuActorPair)); + } + }; + physx_PxGpuActorPair_Pod::dump_layout(sg); + + struct physx_PxIndexDataPair_Pod: public physx::PxIndexDataPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxIndexDataPair_Pod", "PxIndexDataPair"); + sg.add_field("uint32_t index", "index", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxIndexDataPair_Pod, index)); + sg.add_field("void* data", "data", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxIndexDataPair_Pod, data)); + sg.end_struct(sizeof(physx::PxIndexDataPair)); + } + }; + physx_PxIndexDataPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxPvdSceneClient_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxContactPairHeader_Pod;\n"); + struct physx_PxDominanceGroupPair_Pod: public physx::PxDominanceGroupPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDominanceGroupPair_Pod", "PxDominanceGroupPair"); + sg.add_field("uint8_t dominance0", "dominance0", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxDominanceGroupPair_Pod, dominance0)); + sg.add_field("uint8_t dominance1", "dominance1", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxDominanceGroupPair_Pod, dominance1)); + sg.end_struct(sizeof(physx::PxDominanceGroupPair)); + } + }; + physx_PxDominanceGroupPair_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBroadPhaseCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxScene_Pod: public physx::PxScene { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxScene_Pod", "PxScene"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxScene_Pod, userData)); + sg.end_struct(sizeof(physx::PxScene)); + } + }; + physx_PxScene_Pod::dump_layout(sg); + + struct physx_PxSceneReadLock_Pod: public physx::PxSceneReadLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneReadLock_Pod", "PxSceneReadLock"); + sg.end_struct(sizeof(physx::PxSceneReadLock)); + } + }; + physx_PxSceneReadLock_Pod::dump_layout(sg); + + struct physx_PxSceneWriteLock_Pod: public physx::PxSceneWriteLock { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneWriteLock_Pod", "PxSceneWriteLock"); + sg.end_struct(sizeof(physx::PxSceneWriteLock)); + } + }; + physx_PxSceneWriteLock_Pod::dump_layout(sg); + + struct physx_PxContactPairExtraDataItem_Pod: public physx::PxContactPairExtraDataItem { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairExtraDataItem_Pod", "PxContactPairExtraDataItem"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairExtraDataItem_Pod, type)); + sg.end_struct(sizeof(physx::PxContactPairExtraDataItem)); + } + }; + physx_PxContactPairExtraDataItem_Pod::dump_layout(sg); + + struct physx_PxContactPairVelocity_Pod: public physx::PxContactPairVelocity { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairVelocity_Pod", "PxContactPairVelocity"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairVelocity_Pod, type)); + sg.add_field("physx_PxVec3_Pod linearVelocity[2]", "linearVelocity", "[PxVec3; 2]", sizeof(physx::PxVec3[2]), unsafe_offsetof(physx_PxContactPairVelocity_Pod, linearVelocity)); + sg.add_field("physx_PxVec3_Pod angularVelocity[2]", "angularVelocity", "[PxVec3; 2]", sizeof(physx::PxVec3[2]), unsafe_offsetof(physx_PxContactPairVelocity_Pod, angularVelocity)); + sg.end_struct(sizeof(physx::PxContactPairVelocity)); + } + }; + physx_PxContactPairVelocity_Pod::dump_layout(sg); + + struct physx_PxContactPairPose_Pod: public physx::PxContactPairPose { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairPose_Pod", "PxContactPairPose"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairPose_Pod, type)); + sg.add_field("physx_PxTransform_Pod globalPose[2]", "globalPose", "[PxTransform; 2]", sizeof(physx::PxTransform[2]), unsafe_offsetof(physx_PxContactPairPose_Pod, globalPose)); + sg.end_struct(sizeof(physx::PxContactPairPose)); + } + }; + physx_PxContactPairPose_Pod::dump_layout(sg); + + struct physx_PxContactPairIndex_Pod: public physx::PxContactPairIndex { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairIndex_Pod", "PxContactPairIndex"); + sg.add_field("uint8_t type", "type_", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPairIndex_Pod, type)); + sg.add_field("uint16_t index", "index", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPairIndex_Pod, index)); + sg.end_struct(sizeof(physx::PxContactPairIndex)); + } + }; + physx_PxContactPairIndex_Pod::dump_layout(sg); + + struct physx_PxContactPairExtraDataIterator_Pod: public physx::PxContactPairExtraDataIterator { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairExtraDataIterator_Pod", "PxContactPairExtraDataIterator"); + sg.add_field("uint8_t const* currPtr", "currPtr", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, currPtr)); + sg.add_field("uint8_t const* endPtr", "endPtr", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, endPtr)); + sg.add_field("physx_PxContactPairVelocity_Pod const* preSolverVelocity", "preSolverVelocity", "*const PxContactPairVelocity", sizeof(physx::PxContactPairVelocity const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, preSolverVelocity)); + sg.add_field("physx_PxContactPairVelocity_Pod const* postSolverVelocity", "postSolverVelocity", "*const PxContactPairVelocity", sizeof(physx::PxContactPairVelocity const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, postSolverVelocity)); + sg.add_field("physx_PxContactPairPose_Pod const* eventPose", "eventPose", "*const PxContactPairPose", sizeof(physx::PxContactPairPose const*), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, eventPose)); + sg.add_field("uint32_t contactPairIndex", "contactPairIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairExtraDataIterator_Pod, contactPairIndex)); + sg.end_struct(sizeof(physx::PxContactPairExtraDataIterator)); + } + }; + physx_PxContactPairExtraDataIterator_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxContactPair_Pod;\n"); + struct physx_PxContactPairHeader_Pod: public physx::PxContactPairHeader { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairHeader_Pod", "PxContactPairHeader"); + sg.add_field("physx_PxActor_Pod* actors[2]", "actors", "[*mut PxActor; 2]", sizeof(physx::PxActor*[2]), unsafe_offsetof(physx_PxContactPairHeader_Pod, actors)); + sg.add_field("uint8_t const* extraDataStream", "extraDataStream", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPairHeader_Pod, extraDataStream)); + sg.add_field("uint16_t extraDataStreamSize", "extraDataStreamSize", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPairHeader_Pod, extraDataStreamSize)); + sg.add_field("uint16_t flags", "flags", "PxContactPairHeaderFlags", sizeof(physx::PxContactPairHeaderFlags), unsafe_offsetof(physx_PxContactPairHeader_Pod, flags)); + sg.add_field("physx_PxContactPair_Pod const* pairs", "pairs", "*const PxContactPair", sizeof(physx::PxContactPair const*), unsafe_offsetof(physx_PxContactPairHeader_Pod, pairs)); + sg.add_field("uint32_t nbPairs", "nbPairs", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairHeader_Pod, nbPairs)); + sg.end_struct(sizeof(physx::PxContactPairHeader)); + } + }; + physx_PxContactPairHeader_Pod::dump_layout(sg); + + struct physx_PxContactPairPoint_Pod: public physx::PxContactPairPoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPairPoint_Pod", "PxContactPairPoint"); + sg.add_field("physx_PxVec3_Pod position", "position", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, position)); + sg.add_field("float separation", "separation", "f32", sizeof(float), unsafe_offsetof(physx_PxContactPairPoint_Pod, separation)); + sg.add_field("physx_PxVec3_Pod normal", "normal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, normal)); + sg.add_field("uint32_t internalFaceIndex0", "internalFaceIndex0", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairPoint_Pod, internalFaceIndex0)); + sg.add_field("physx_PxVec3_Pod impulse", "impulse", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxContactPairPoint_Pod, impulse)); + sg.add_field("uint32_t internalFaceIndex1", "internalFaceIndex1", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPairPoint_Pod, internalFaceIndex1)); + sg.end_struct(sizeof(physx::PxContactPairPoint)); + } + }; + physx_PxContactPairPoint_Pod::dump_layout(sg); + + struct physx_PxContactPair_Pod: public physx::PxContactPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactPair_Pod", "PxContactPair"); + sg.add_field("physx_PxShape_Pod* shapes[2]", "shapes", "[*mut PxShape; 2]", sizeof(physx::PxShape*[2]), unsafe_offsetof(physx_PxContactPair_Pod, shapes)); + sg.add_field("uint8_t const* contactPatches", "contactPatches", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPair_Pod, contactPatches)); + sg.add_field("uint8_t const* contactPoints", "contactPoints", "*const u8", sizeof(uint8_t const*), unsafe_offsetof(physx_PxContactPair_Pod, contactPoints)); + sg.add_field("float const* contactImpulses", "contactImpulses", "*const f32", sizeof(float const*), unsafe_offsetof(physx_PxContactPair_Pod, contactImpulses)); + sg.add_field("uint32_t requiredBufferSize", "requiredBufferSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxContactPair_Pod, requiredBufferSize)); + sg.add_field("uint8_t contactCount", "contactCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPair_Pod, contactCount)); + sg.add_field("uint8_t patchCount", "patchCount", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxContactPair_Pod, patchCount)); + sg.add_field("uint16_t contactStreamSize", "contactStreamSize", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxContactPair_Pod, contactStreamSize)); + sg.add_field("uint16_t flags", "flags", "PxContactPairFlags", sizeof(physx::PxContactPairFlags), unsafe_offsetof(physx_PxContactPair_Pod, flags)); + sg.add_field("uint16_t events", "events", "PxPairFlags", sizeof(physx::PxPairFlags), unsafe_offsetof(physx_PxContactPair_Pod, events)); + sg.add_field("uint32_t internalData[2]", "internalData", "[u32; 2]", sizeof(uint32_t[2]), unsafe_offsetof(physx_PxContactPair_Pod, internalData)); + sg.end_struct(sizeof(physx::PxContactPair)); + } + }; + physx_PxContactPair_Pod::dump_layout(sg); + + struct physx_PxTriggerPair_Pod: public physx::PxTriggerPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriggerPair_Pod", "PxTriggerPair"); + sg.add_field("physx_PxShape_Pod* triggerShape", "triggerShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxTriggerPair_Pod, triggerShape)); + sg.add_field("physx_PxActor_Pod* triggerActor", "triggerActor", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxTriggerPair_Pod, triggerActor)); + sg.add_field("physx_PxShape_Pod* otherShape", "otherShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxTriggerPair_Pod, otherShape)); + sg.add_field("physx_PxActor_Pod* otherActor", "otherActor", "*mut PxActor", sizeof(physx::PxActor*), unsafe_offsetof(physx_PxTriggerPair_Pod, otherActor)); + sg.add_field("int32_t status", "status", "PxPairFlag", sizeof(physx::PxPairFlag::Enum), unsafe_offsetof(physx_PxTriggerPair_Pod, status)); + sg.add_field("uint8_t flags", "flags", "PxTriggerPairFlags", sizeof(physx::PxTriggerPairFlags), unsafe_offsetof(physx_PxTriggerPair_Pod, flags)); + sg.end_struct(sizeof(physx::PxTriggerPair)); + } + }; + physx_PxTriggerPair_Pod::dump_layout(sg); + + struct physx_PxConstraintInfo_Pod: public physx::PxConstraintInfo { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConstraintInfo_Pod", "PxConstraintInfo"); + sg.add_field("physx_PxConstraint_Pod* constraint", "constraint", "*mut PxConstraint", sizeof(physx::PxConstraint*), unsafe_offsetof(physx_PxConstraintInfo_Pod, constraint)); + sg.add_field("void* externalReference", "externalReference", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxConstraintInfo_Pod, externalReference)); + sg.add_field("uint32_t type", "type_", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxConstraintInfo_Pod, type)); + sg.end_struct(sizeof(physx::PxConstraintInfo)); + } + }; + physx_PxConstraintInfo_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxSimulationEventCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxFEMParameters_Pod: public physx::PxFEMParameters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFEMParameters_Pod", "PxFEMParameters"); + sg.add_field("float velocityDamping", "velocityDamping", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, velocityDamping)); + sg.add_field("float settlingThreshold", "settlingThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, settlingThreshold)); + sg.add_field("float sleepThreshold", "sleepThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, sleepThreshold)); + sg.add_field("float sleepDamping", "sleepDamping", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, sleepDamping)); + sg.add_field("float selfCollisionFilterDistance", "selfCollisionFilterDistance", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, selfCollisionFilterDistance)); + sg.add_field("float selfCollisionStressTolerance", "selfCollisionStressTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxFEMParameters_Pod, selfCollisionStressTolerance)); + sg.end_struct(sizeof(physx::PxFEMParameters)); + } + }; + physx_PxFEMParameters_Pod::dump_layout(sg); + + struct physx_PxPruningStructure_Pod: public physx::PxPruningStructure { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPruningStructure_Pod", "PxPruningStructure"); + sg.end_struct(sizeof(physx::PxPruningStructure)); + } + }; + physx_PxPruningStructure_Pod::dump_layout(sg); + + struct physx_PxExtendedVec3_Pod: public physx::PxExtendedVec3 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxExtendedVec3_Pod", "PxExtendedVec3"); + sg.add_field("double x", "x", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, x)); + sg.add_field("double y", "y", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, y)); + sg.add_field("double z", "z", "f64", sizeof(double), unsafe_offsetof(physx_PxExtendedVec3_Pod, z)); + sg.end_struct(sizeof(physx::PxExtendedVec3)); + } + }; + physx_PxExtendedVec3_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxControllerManager_Pod;\n"); + struct physx_PxObstacle_Pod: public physx::PxObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxObstacle_Pod", "PxObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxObstacle_Pod, mRot)); + sg.end_struct(sizeof(physx::PxObstacle)); + } + }; + physx_PxObstacle_Pod::dump_layout(sg); + + struct physx_PxBoxObstacle_Pod: public physx::PxBoxObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBoxObstacle_Pod", "PxBoxObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBoxObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxBoxObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxBoxObstacle_Pod, mRot)); + sg.add_field("physx_PxVec3_Pod mHalfExtents", "mHalfExtents", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBoxObstacle_Pod, mHalfExtents)); + sg.end_struct(sizeof(physx::PxBoxObstacle)); + } + }; + physx_PxBoxObstacle_Pod::dump_layout(sg); + + struct physx_PxCapsuleObstacle_Pod: public physx::PxCapsuleObstacle { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCapsuleObstacle_Pod", "PxCapsuleObstacle"); + sg.add_field("void* mUserData", "mUserData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mUserData)); + sg.add_field("physx_PxExtendedVec3_Pod mPos", "mPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mPos)); + sg.add_field("physx_PxQuat_Pod mRot", "mRot", "PxQuat", sizeof(physx::PxQuat), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mRot)); + sg.add_field("float mHalfHeight", "mHalfHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mHalfHeight)); + sg.add_field("float mRadius", "mRadius", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleObstacle_Pod, mRadius)); + sg.end_struct(sizeof(physx::PxCapsuleObstacle)); + } + }; + physx_PxCapsuleObstacle_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxObstacleContext_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxController_Pod;\n"); + sg.pass_thru("struct physx_PxControllerBehaviorCallback_Pod;\n"); + struct physx_PxControllerState_Pod: public physx::PxControllerState { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerState_Pod", "PxControllerState"); + sg.add_field("physx_PxVec3_Pod deltaXP", "deltaXP", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerState_Pod, deltaXP)); + sg.add_field("physx_PxShape_Pod* touchedShape", "touchedShape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxControllerState_Pod, touchedShape)); + sg.add_field("physx_PxRigidActor_Pod* touchedActor", "touchedActor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxControllerState_Pod, touchedActor)); + sg.add_field("uint32_t touchedObstacleHandle", "touchedObstacleHandle", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerState_Pod, touchedObstacleHandle)); + sg.add_field("uint32_t collisionFlags", "collisionFlags", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerState_Pod, collisionFlags)); + sg.add_field("bool standOnAnotherCCT", "standOnAnotherCCT", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, standOnAnotherCCT)); + sg.add_field("bool standOnObstacle", "standOnObstacle", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, standOnObstacle)); + sg.add_field("bool isMovingUp", "isMovingUp", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerState_Pod, isMovingUp)); + sg.end_struct(sizeof(physx::PxControllerState)); + } + }; + physx_PxControllerState_Pod::dump_layout(sg); + + struct physx_PxControllerStats_Pod: public physx::PxControllerStats { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerStats_Pod", "PxControllerStats"); + sg.add_field("uint16_t nbIterations", "nbIterations", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbIterations)); + sg.add_field("uint16_t nbFullUpdates", "nbFullUpdates", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbFullUpdates)); + sg.add_field("uint16_t nbPartialUpdates", "nbPartialUpdates", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbPartialUpdates)); + sg.add_field("uint16_t nbTessellation", "nbTessellation", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxControllerStats_Pod, nbTessellation)); + sg.end_struct(sizeof(physx::PxControllerStats)); + } + }; + physx_PxControllerStats_Pod::dump_layout(sg); + + struct physx_PxControllerHit_Pod: public physx::PxControllerHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerHit_Pod", "PxControllerHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerHit_Pod, length)); + sg.end_struct(sizeof(physx::PxControllerHit)); + } + }; + physx_PxControllerHit_Pod::dump_layout(sg); + + struct physx_PxControllerShapeHit_Pod: public physx::PxControllerShapeHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerShapeHit_Pod", "PxControllerShapeHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerShapeHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerShapeHit_Pod, length)); + sg.add_field("physx_PxShape_Pod* shape", "shape", "*mut PxShape", sizeof(physx::PxShape*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, shape)); + sg.add_field("physx_PxRigidActor_Pod* actor", "actor", "*mut PxRigidActor", sizeof(physx::PxRigidActor*), unsafe_offsetof(physx_PxControllerShapeHit_Pod, actor)); + sg.add_field("uint32_t triangleIndex", "triangleIndex", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxControllerShapeHit_Pod, triangleIndex)); + sg.end_struct(sizeof(physx::PxControllerShapeHit)); + } + }; + physx_PxControllerShapeHit_Pod::dump_layout(sg); + + struct physx_PxControllersHit_Pod: public physx::PxControllersHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllersHit_Pod", "PxControllersHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllersHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllersHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllersHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllersHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllersHit_Pod, length)); + sg.add_field("physx_PxController_Pod* other", "other", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllersHit_Pod, other)); + sg.end_struct(sizeof(physx::PxControllersHit)); + } + }; + physx_PxControllersHit_Pod::dump_layout(sg); + + struct physx_PxControllerObstacleHit_Pod: public physx::PxControllerObstacleHit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerObstacleHit_Pod", "PxControllerObstacleHit"); + sg.add_field("physx_PxController_Pod* controller", "controller", "*mut PxController", sizeof(physx::PxController*), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, controller)); + sg.add_field("physx_PxExtendedVec3_Pod worldPos", "worldPos", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, worldPos)); + sg.add_field("physx_PxVec3_Pod worldNormal", "worldNormal", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, worldNormal)); + sg.add_field("physx_PxVec3_Pod dir", "dir", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, dir)); + sg.add_field("float length", "length", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, length)); + sg.add_field("void const* userData", "userData", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxControllerObstacleHit_Pod, userData)); + sg.end_struct(sizeof(physx::PxControllerObstacleHit)); + } + }; + physx_PxControllerObstacleHit_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxUserControllerHitReport_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerFilterCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxControllerFilters_Pod: public physx::PxControllerFilters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerFilters_Pod", "PxControllerFilters"); + sg.add_field("physx_PxFilterData_Pod const* mFilterData", "mFilterData", "*const PxFilterData", sizeof(physx::PxFilterData const*), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterData)); + sg.add_field("physx_PxQueryFilterCallback_Pod* mFilterCallback", "mFilterCallback", "*mut PxQueryFilterCallback", sizeof(physx::PxQueryFilterCallback*), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterCallback)); + sg.add_field("uint16_t mFilterFlags", "mFilterFlags", "PxQueryFlags", sizeof(physx::PxQueryFlags), unsafe_offsetof(physx_PxControllerFilters_Pod, mFilterFlags)); + sg.add_field("physx_PxControllerFilterCallback_Pod* mCCTFilterCallback", "mCCTFilterCallback", "*mut PxControllerFilterCallback", sizeof(physx::PxControllerFilterCallback*), unsafe_offsetof(physx_PxControllerFilters_Pod, mCCTFilterCallback)); + sg.end_struct(sizeof(physx::PxControllerFilters)); + } + }; + physx_PxControllerFilters_Pod::dump_layout(sg); + + struct physx_PxControllerDesc_Pod: public physx::PxControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxControllerDesc_Pod", "PxControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxControllerDesc_Pod, userData)); + sg.end_struct(sizeof(physx::PxControllerDesc)); + } + }; + physx_PxControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxController_Pod {\n void* vtable_;\n};\n"); + struct physx_PxBoxControllerDesc_Pod: public physx::PxBoxControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBoxControllerDesc_Pod", "PxBoxControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, userData)); + sg.add_field("float halfHeight", "halfHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfHeight)); + sg.add_field("float halfSideExtent", "halfSideExtent", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfSideExtent)); + sg.add_field("float halfForwardExtent", "halfForwardExtent", "f32", sizeof(float), unsafe_offsetof(physx_PxBoxControllerDesc_Pod, halfForwardExtent)); + sg.end_struct(sizeof(physx::PxBoxControllerDesc)); + } + }; + physx_PxBoxControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBoxController_Pod {\n void* vtable_;\n};\n"); + struct physx_PxCapsuleControllerDesc_Pod: public physx::PxCapsuleControllerDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCapsuleControllerDesc_Pod", "PxCapsuleControllerDesc"); + sg.add_field("physx_PxExtendedVec3_Pod position", "position", "PxExtendedVec3", sizeof(physx::PxExtendedVec3), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, position)); + sg.add_field("physx_PxVec3_Pod upDirection", "upDirection", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, upDirection)); + sg.add_field("float slopeLimit", "slopeLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, slopeLimit)); + sg.add_field("float invisibleWallHeight", "invisibleWallHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, invisibleWallHeight)); + sg.add_field("float maxJumpHeight", "maxJumpHeight", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, maxJumpHeight)); + sg.add_field("float contactOffset", "contactOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, contactOffset)); + sg.add_field("float stepOffset", "stepOffset", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, stepOffset)); + sg.add_field("float density", "density", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, density)); + sg.add_field("float scaleCoeff", "scaleCoeff", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, scaleCoeff)); + sg.add_field("float volumeGrowth", "volumeGrowth", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, volumeGrowth)); + sg.add_field("physx_PxUserControllerHitReport_Pod* reportCallback", "reportCallback", "*mut PxUserControllerHitReport", sizeof(physx::PxUserControllerHitReport*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, reportCallback)); + sg.add_field("physx_PxControllerBehaviorCallback_Pod* behaviorCallback", "behaviorCallback", "*mut PxControllerBehaviorCallback", sizeof(physx::PxControllerBehaviorCallback*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, behaviorCallback)); + sg.add_field("int32_t nonWalkableMode", "nonWalkableMode", "PxControllerNonWalkableMode", sizeof(physx::PxControllerNonWalkableMode::Enum), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, nonWalkableMode)); + sg.add_field("physx_PxMaterial_Pod* material", "material", "*mut PxMaterial", sizeof(physx::PxMaterial*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, material)); + sg.add_field("bool registerDeletionListener", "registerDeletionListener", "bool", sizeof(bool), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, registerDeletionListener)); + sg.add_field("uint8_t clientID", "clientID", "u8", sizeof(uint8_t), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, clientID)); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, userData)); + sg.add_field("float radius", "radius", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, radius)); + sg.add_field("float height", "height", "f32", sizeof(float), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, height)); + sg.add_field("int32_t climbingMode", "climbingMode", "PxCapsuleClimbingMode", sizeof(physx::PxCapsuleClimbingMode::Enum), unsafe_offsetof(physx_PxCapsuleControllerDesc_Pod, climbingMode)); + sg.end_struct(sizeof(physx::PxCapsuleControllerDesc)); + } + }; + physx_PxCapsuleControllerDesc_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCapsuleController_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerBehaviorCallback_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxControllerManager_Pod {\n void* vtable_;\n};\n"); + struct physx_PxDim3_Pod: public physx::PxDim3 { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDim3_Pod", "PxDim3"); + sg.add_field("uint32_t x", "x", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, x)); + sg.add_field("uint32_t y", "y", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, y)); + sg.add_field("uint32_t z", "z", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxDim3_Pod, z)); + sg.end_struct(sizeof(physx::PxDim3)); + } + }; + physx_PxDim3_Pod::dump_layout(sg); + + struct physx_PxSDFDesc_Pod: public physx::PxSDFDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSDFDesc_Pod", "PxSDFDesc"); + sg.add_field("physx_PxBoundedData_Pod sdf", "sdf", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdf)); + sg.add_field("physx_PxDim3_Pod dims", "dims", "PxDim3", sizeof(physx::PxDim3), unsafe_offsetof(physx_PxSDFDesc_Pod, dims)); + sg.add_field("physx_PxVec3_Pod meshLower", "meshLower", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxSDFDesc_Pod, meshLower)); + sg.add_field("float spacing", "spacing", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, spacing)); + sg.add_field("uint32_t subgridSize", "subgridSize", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridSize)); + sg.add_field("int32_t bitsPerSubgridPixel", "bitsPerSubgridPixel", "PxSdfBitsPerSubgridPixel", sizeof(physx::PxSdfBitsPerSubgridPixel::Enum), unsafe_offsetof(physx_PxSDFDesc_Pod, bitsPerSubgridPixel)); + sg.add_field("physx_PxDim3_Pod sdfSubgrids3DTexBlockDim", "sdfSubgrids3DTexBlockDim", "PxDim3", sizeof(physx::PxDim3), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfSubgrids3DTexBlockDim)); + sg.add_field("physx_PxBoundedData_Pod sdfSubgrids", "sdfSubgrids", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfSubgrids)); + sg.add_field("physx_PxBoundedData_Pod sdfStartSlots", "sdfStartSlots", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfStartSlots)); + sg.add_field("float subgridsMinSdfValue", "subgridsMinSdfValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridsMinSdfValue)); + sg.add_field("float subgridsMaxSdfValue", "subgridsMaxSdfValue", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, subgridsMaxSdfValue)); + sg.add_field("physx_PxBounds3_Pod sdfBounds", "sdfBounds", "PxBounds3", sizeof(physx::PxBounds3), unsafe_offsetof(physx_PxSDFDesc_Pod, sdfBounds)); + sg.add_field("float narrowBandThicknessRelativeToSdfBoundsDiagonal", "narrowBandThicknessRelativeToSdfBoundsDiagonal", "f32", sizeof(float), unsafe_offsetof(physx_PxSDFDesc_Pod, narrowBandThicknessRelativeToSdfBoundsDiagonal)); + sg.add_field("uint32_t numThreadsForSdfConstruction", "numThreadsForSdfConstruction", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxSDFDesc_Pod, numThreadsForSdfConstruction)); + sg.end_struct(sizeof(physx::PxSDFDesc)); + } + }; + physx_PxSDFDesc_Pod::dump_layout(sg); + + struct physx_PxConvexMeshDesc_Pod: public physx::PxConvexMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxConvexMeshDesc_Pod", "PxConvexMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod polygons", "polygons", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, polygons)); + sg.add_field("physx_PxBoundedData_Pod indices", "indices", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, indices)); + sg.add_field("uint16_t flags", "flags", "PxConvexFlags", sizeof(physx::PxConvexFlags), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, flags)); + sg.add_field("uint16_t vertexLimit", "vertexLimit", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, vertexLimit)); + sg.add_field("uint16_t polygonLimit", "polygonLimit", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, polygonLimit)); + sg.add_field("uint16_t quantizedCount", "quantizedCount", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, quantizedCount)); + sg.add_field("physx_PxSDFDesc_Pod* sdfDesc", "sdfDesc", "*mut PxSDFDesc", sizeof(physx::PxSDFDesc*), unsafe_offsetof(physx_PxConvexMeshDesc_Pod, sdfDesc)); + sg.end_struct(sizeof(physx::PxConvexMeshDesc)); + } + }; + physx_PxConvexMeshDesc_Pod::dump_layout(sg); + + struct physx_PxTriangleMeshDesc_Pod: public physx::PxTriangleMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMeshDesc_Pod", "PxTriangleMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod triangles", "triangles", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, triangles)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, flags)); + sg.add_field("physx_PxSDFDesc_Pod* sdfDesc", "sdfDesc", "*mut PxSDFDesc", sizeof(physx::PxSDFDesc*), unsafe_offsetof(physx_PxTriangleMeshDesc_Pod, sdfDesc)); + sg.end_struct(sizeof(physx::PxTriangleMeshDesc)); + } + }; + physx_PxTriangleMeshDesc_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshDesc_Pod: public physx::PxTetrahedronMeshDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshDesc_Pod", "PxTetrahedronMeshDesc"); + sg.add_field("physx_PxBoundedData_Pod points", "points", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, points)); + sg.add_field("physx_PxBoundedData_Pod tetrahedrons", "tetrahedrons", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, tetrahedrons)); + sg.add_field("uint16_t flags", "flags", "PxMeshFlags", sizeof(physx::PxMeshFlags), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, flags)); + sg.add_field("uint16_t tetsPerElement", "tetsPerElement", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxTetrahedronMeshDesc_Pod, tetsPerElement)); + sg.end_struct(sizeof(physx::PxTetrahedronMeshDesc)); + } + }; + physx_PxTetrahedronMeshDesc_Pod::dump_layout(sg); + + struct physx_PxSoftBodySimulationDataDesc_Pod: public physx::PxSoftBodySimulationDataDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSoftBodySimulationDataDesc_Pod", "PxSoftBodySimulationDataDesc"); + sg.add_field("physx_PxBoundedData_Pod vertexToTet", "vertexToTet", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxSoftBodySimulationDataDesc_Pod, vertexToTet)); + sg.end_struct(sizeof(physx::PxSoftBodySimulationDataDesc)); + } + }; + physx_PxSoftBodySimulationDataDesc_Pod::dump_layout(sg); + + struct physx_PxBVH34MidphaseDesc_Pod: public physx::PxBVH34MidphaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVH34MidphaseDesc_Pod", "PxBVH34MidphaseDesc"); + sg.add_field("uint32_t numPrimsPerLeaf", "numPrimsPerLeaf", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, numPrimsPerLeaf)); + sg.add_field("int32_t buildStrategy", "buildStrategy", "PxBVH34BuildStrategy", sizeof(physx::PxBVH34BuildStrategy::Enum), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, buildStrategy)); + sg.add_field("bool quantized", "quantized", "bool", sizeof(bool), unsafe_offsetof(physx_PxBVH34MidphaseDesc_Pod, quantized)); + sg.end_struct(sizeof(physx::PxBVH34MidphaseDesc)); + } + }; + physx_PxBVH34MidphaseDesc_Pod::dump_layout(sg); + + struct physx_PxMidphaseDesc_Pod: public physx::PxMidphaseDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMidphaseDesc_Pod", "PxMidphaseDesc"); + sg.end_struct(sizeof(physx::PxMidphaseDesc)); + } + }; + physx_PxMidphaseDesc_Pod::dump_layout(sg); + + struct physx_PxBVHDesc_Pod: public physx::PxBVHDesc { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBVHDesc_Pod", "PxBVHDesc"); + sg.add_field("physx_PxBoundedData_Pod bounds", "bounds", "PxBoundedData", sizeof(physx::PxBoundedData), unsafe_offsetof(physx_PxBVHDesc_Pod, bounds)); + sg.add_field("float enlargement", "enlargement", "f32", sizeof(float), unsafe_offsetof(physx_PxBVHDesc_Pod, enlargement)); + sg.add_field("uint32_t numPrimsPerLeaf", "numPrimsPerLeaf", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxBVHDesc_Pod, numPrimsPerLeaf)); + sg.add_field("int32_t buildStrategy", "buildStrategy", "PxBVHBuildStrategy", sizeof(physx::PxBVHBuildStrategy::Enum), unsafe_offsetof(physx_PxBVHDesc_Pod, buildStrategy)); + sg.end_struct(sizeof(physx::PxBVHDesc)); + } + }; + physx_PxBVHDesc_Pod::dump_layout(sg); + + struct physx_PxCookingParams_Pod: public physx::PxCookingParams { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxCookingParams_Pod", "PxCookingParams"); + sg.add_field("float areaTestEpsilon", "areaTestEpsilon", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, areaTestEpsilon)); + sg.add_field("float planeTolerance", "planeTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, planeTolerance)); + sg.add_field("int32_t convexMeshCookingType", "convexMeshCookingType", "PxConvexMeshCookingType", sizeof(physx::PxConvexMeshCookingType::Enum), unsafe_offsetof(physx_PxCookingParams_Pod, convexMeshCookingType)); + sg.add_field("bool suppressTriangleMeshRemapTable", "suppressTriangleMeshRemapTable", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, suppressTriangleMeshRemapTable)); + sg.add_field("bool buildTriangleAdjacencies", "buildTriangleAdjacencies", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, buildTriangleAdjacencies)); + sg.add_field("bool buildGPUData", "buildGPUData", "bool", sizeof(bool), unsafe_offsetof(physx_PxCookingParams_Pod, buildGPUData)); + sg.add_field("physx_PxTolerancesScale_Pod scale", "scale", "PxTolerancesScale", sizeof(physx::PxTolerancesScale), unsafe_offsetof(physx_PxCookingParams_Pod, scale)); + sg.add_field("uint32_t meshPreprocessParams", "meshPreprocessParams", "PxMeshPreprocessingFlags", sizeof(physx::PxMeshPreprocessingFlags), unsafe_offsetof(physx_PxCookingParams_Pod, meshPreprocessParams)); + sg.add_field("float meshWeldTolerance", "meshWeldTolerance", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, meshWeldTolerance)); + sg.add_field("physx_PxMidphaseDesc_Pod midphaseDesc", "midphaseDesc", "PxMidphaseDesc", sizeof(physx::PxMidphaseDesc), unsafe_offsetof(physx_PxCookingParams_Pod, midphaseDesc)); + sg.add_field("uint32_t gaussMapLimit", "gaussMapLimit", "u32", sizeof(uint32_t), unsafe_offsetof(physx_PxCookingParams_Pod, gaussMapLimit)); + sg.add_field("float maxWeightRatioInTet", "maxWeightRatioInTet", "f32", sizeof(float), unsafe_offsetof(physx_PxCookingParams_Pod, maxWeightRatioInTet)); + sg.end_struct(sizeof(physx::PxCookingParams)); + } + }; + physx_PxCookingParams_Pod::dump_layout(sg); + + struct physx_PxDefaultMemoryOutputStream_Pod: public physx::PxDefaultMemoryOutputStream { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultMemoryOutputStream_Pod", "PxDefaultMemoryOutputStream"); + sg.end_struct(sizeof(physx::PxDefaultMemoryOutputStream)); + } + }; + physx_PxDefaultMemoryOutputStream_Pod::dump_layout(sg); + + struct physx_PxDefaultMemoryInputData_Pod: public physx::PxDefaultMemoryInputData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultMemoryInputData_Pod", "PxDefaultMemoryInputData"); + sg.end_struct(sizeof(physx::PxDefaultMemoryInputData)); + } + }; + physx_PxDefaultMemoryInputData_Pod::dump_layout(sg); + + struct physx_PxDefaultFileOutputStream_Pod: public physx::PxDefaultFileOutputStream { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultFileOutputStream_Pod", "PxDefaultFileOutputStream"); + sg.end_struct(sizeof(physx::PxDefaultFileOutputStream)); + } + }; + physx_PxDefaultFileOutputStream_Pod::dump_layout(sg); + + struct physx_PxDefaultFileInputData_Pod: public physx::PxDefaultFileInputData { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDefaultFileInputData_Pod", "PxDefaultFileInputData"); + sg.end_struct(sizeof(physx::PxDefaultFileInputData)); + } + }; + physx_PxDefaultFileInputData_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultAllocator_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxJoint_Pod;\n"); + sg.pass_thru("struct physx_PxRackAndPinionJoint_Pod;\n"); + sg.pass_thru("struct physx_PxGearJoint_Pod;\n"); + sg.pass_thru("struct physx_PxD6Joint_Pod;\n"); + sg.pass_thru("struct physx_PxDistanceJoint_Pod;\n"); + sg.pass_thru("struct physx_PxContactJoint_Pod;\n"); + sg.pass_thru("struct physx_PxFixedJoint_Pod;\n"); + sg.pass_thru("struct physx_PxPrismaticJoint_Pod;\n"); + sg.pass_thru("struct physx_PxRevoluteJoint_Pod;\n"); + sg.pass_thru("struct physx_PxSphericalJoint_Pod;\n"); + struct physx_PxJoint_Pod: public physx::PxJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJoint_Pod", "PxJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxJoint)); + } + }; + physx_PxJoint_Pod::dump_layout(sg); + + struct physx_PxSpring_Pod: public physx::PxSpring { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSpring_Pod", "PxSpring"); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxSpring_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxSpring_Pod, damping)); + sg.end_struct(sizeof(physx::PxSpring)); + } + }; + physx_PxSpring_Pod::dump_layout(sg); + + struct physx_PxDistanceJoint_Pod: public physx::PxDistanceJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxDistanceJoint_Pod", "PxDistanceJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxDistanceJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxDistanceJoint)); + } + }; + physx_PxDistanceJoint_Pod::dump_layout(sg); + + struct physx_PxJacobianRow_Pod: public physx::PxJacobianRow { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJacobianRow_Pod", "PxJacobianRow"); + sg.add_field("physx_PxVec3_Pod linear0", "linear0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, linear0)); + sg.add_field("physx_PxVec3_Pod linear1", "linear1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, linear1)); + sg.add_field("physx_PxVec3_Pod angular0", "angular0", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, angular0)); + sg.add_field("physx_PxVec3_Pod angular1", "angular1", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxJacobianRow_Pod, angular1)); + sg.end_struct(sizeof(physx::PxJacobianRow)); + } + }; + physx_PxJacobianRow_Pod::dump_layout(sg); + + struct physx_PxContactJoint_Pod: public physx::PxContactJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxContactJoint_Pod", "PxContactJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxContactJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxContactJoint)); + } + }; + physx_PxContactJoint_Pod::dump_layout(sg); + + struct physx_PxFixedJoint_Pod: public physx::PxFixedJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxFixedJoint_Pod", "PxFixedJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxFixedJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxFixedJoint)); + } + }; + physx_PxFixedJoint_Pod::dump_layout(sg); + + struct physx_PxJointLimitParameters_Pod: public physx::PxJointLimitParameters { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitParameters_Pod", "PxJointLimitParameters"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitParameters_Pod, contactDistance_deprecated)); + sg.end_struct(sizeof(physx::PxJointLimitParameters)); + } + }; + physx_PxJointLimitParameters_Pod::dump_layout(sg); + + struct physx_PxJointLinearLimit_Pod: public physx::PxJointLinearLimit { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLinearLimit_Pod", "PxJointLinearLimit"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, contactDistance_deprecated)); + sg.add_field("float value", "value", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimit_Pod, value)); + sg.end_struct(sizeof(physx::PxJointLinearLimit)); + } + }; + physx_PxJointLinearLimit_Pod::dump_layout(sg); + + struct physx_PxJointLinearLimitPair_Pod: public physx::PxJointLinearLimitPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLinearLimitPair_Pod", "PxJointLinearLimitPair"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, contactDistance_deprecated)); + sg.add_field("float upper", "upper", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, upper)); + sg.add_field("float lower", "lower", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLinearLimitPair_Pod, lower)); + sg.end_struct(sizeof(physx::PxJointLinearLimitPair)); + } + }; + physx_PxJointLinearLimitPair_Pod::dump_layout(sg); + + struct physx_PxJointAngularLimitPair_Pod: public physx::PxJointAngularLimitPair { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointAngularLimitPair_Pod", "PxJointAngularLimitPair"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, contactDistance_deprecated)); + sg.add_field("float upper", "upper", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, upper)); + sg.add_field("float lower", "lower", "f32", sizeof(float), unsafe_offsetof(physx_PxJointAngularLimitPair_Pod, lower)); + sg.end_struct(sizeof(physx::PxJointAngularLimitPair)); + } + }; + physx_PxJointAngularLimitPair_Pod::dump_layout(sg); + + struct physx_PxJointLimitCone_Pod: public physx::PxJointLimitCone { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitCone_Pod", "PxJointLimitCone"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, contactDistance_deprecated)); + sg.add_field("float yAngle", "yAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, yAngle)); + sg.add_field("float zAngle", "zAngle", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitCone_Pod, zAngle)); + sg.end_struct(sizeof(physx::PxJointLimitCone)); + } + }; + physx_PxJointLimitCone_Pod::dump_layout(sg); + + struct physx_PxJointLimitPyramid_Pod: public physx::PxJointLimitPyramid { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxJointLimitPyramid_Pod", "PxJointLimitPyramid"); + sg.add_field("float restitution", "restitution", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, restitution)); + sg.add_field("float bounceThreshold", "bounceThreshold", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, bounceThreshold)); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, damping)); + sg.add_field("float contactDistance_deprecated", "contactDistance_deprecated", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, contactDistance_deprecated)); + sg.add_field("float yAngleMin", "yAngleMin", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, yAngleMin)); + sg.add_field("float yAngleMax", "yAngleMax", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, yAngleMax)); + sg.add_field("float zAngleMin", "zAngleMin", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, zAngleMin)); + sg.add_field("float zAngleMax", "zAngleMax", "f32", sizeof(float), unsafe_offsetof(physx_PxJointLimitPyramid_Pod, zAngleMax)); + sg.end_struct(sizeof(physx::PxJointLimitPyramid)); + } + }; + physx_PxJointLimitPyramid_Pod::dump_layout(sg); + + struct physx_PxPrismaticJoint_Pod: public physx::PxPrismaticJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPrismaticJoint_Pod", "PxPrismaticJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxPrismaticJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxPrismaticJoint)); + } + }; + physx_PxPrismaticJoint_Pod::dump_layout(sg); + + struct physx_PxRevoluteJoint_Pod: public physx::PxRevoluteJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRevoluteJoint_Pod", "PxRevoluteJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRevoluteJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxRevoluteJoint)); + } + }; + physx_PxRevoluteJoint_Pod::dump_layout(sg); + + struct physx_PxSphericalJoint_Pod: public physx::PxSphericalJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSphericalJoint_Pod", "PxSphericalJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxSphericalJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxSphericalJoint)); + } + }; + physx_PxSphericalJoint_Pod::dump_layout(sg); + + struct physx_PxD6JointDrive_Pod: public physx::PxD6JointDrive { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxD6JointDrive_Pod", "PxD6JointDrive"); + sg.add_field("float stiffness", "stiffness", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, stiffness)); + sg.add_field("float damping", "damping", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, damping)); + sg.add_field("float forceLimit", "forceLimit", "f32", sizeof(float), unsafe_offsetof(physx_PxD6JointDrive_Pod, forceLimit)); + sg.add_field("uint32_t flags", "flags", "PxD6JointDriveFlags", sizeof(physx::PxD6JointDriveFlags), unsafe_offsetof(physx_PxD6JointDrive_Pod, flags)); + sg.end_struct(sizeof(physx::PxD6JointDrive)); + } + }; + physx_PxD6JointDrive_Pod::dump_layout(sg); + + struct physx_PxD6Joint_Pod: public physx::PxD6Joint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxD6Joint_Pod", "PxD6Joint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxD6Joint_Pod, userData)); + sg.end_struct(sizeof(physx::PxD6Joint)); + } + }; + physx_PxD6Joint_Pod::dump_layout(sg); + + struct physx_PxGearJoint_Pod: public physx::PxGearJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGearJoint_Pod", "PxGearJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxGearJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxGearJoint)); + } + }; + physx_PxGearJoint_Pod::dump_layout(sg); + + struct physx_PxRackAndPinionJoint_Pod: public physx::PxRackAndPinionJoint { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRackAndPinionJoint_Pod", "PxRackAndPinionJoint"); + sg.add_field("void* userData", "userData", "*mut std::ffi::c_void", sizeof(void*), unsafe_offsetof(physx_PxRackAndPinionJoint_Pod, userData)); + sg.end_struct(sizeof(physx::PxRackAndPinionJoint)); + } + }; + physx_PxRackAndPinionJoint_Pod::dump_layout(sg); + + struct physx_PxGroupsMask_Pod: public physx::PxGroupsMask { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxGroupsMask_Pod", "PxGroupsMask"); + sg.add_field("uint16_t bits0", "bits0", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits0)); + sg.add_field("uint16_t bits1", "bits1", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits1)); + sg.add_field("uint16_t bits2", "bits2", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits2)); + sg.add_field("uint16_t bits3", "bits3", "u16", sizeof(uint16_t), unsafe_offsetof(physx_PxGroupsMask_Pod, bits3)); + sg.end_struct(sizeof(physx::PxGroupsMask)); + } + }; + physx_PxGroupsMask_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultErrorCallback_Pod {\n void* vtable_;\n};\n"); + struct physx_PxRigidActorExt_Pod: public physx::PxRigidActorExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidActorExt_Pod", "PxRigidActorExt"); + sg.end_struct(sizeof(physx::PxRigidActorExt)); + } + }; + physx_PxRigidActorExt_Pod::dump_layout(sg); + + struct physx_PxMassProperties_Pod: public physx::PxMassProperties { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMassProperties_Pod", "PxMassProperties"); + sg.add_field("physx_PxMat33_Pod inertiaTensor", "inertiaTensor", "PxMat33", sizeof(physx::PxMat33), unsafe_offsetof(physx_PxMassProperties_Pod, inertiaTensor)); + sg.add_field("physx_PxVec3_Pod centerOfMass", "centerOfMass", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxMassProperties_Pod, centerOfMass)); + sg.add_field("float mass", "mass", "f32", sizeof(float), unsafe_offsetof(physx_PxMassProperties_Pod, mass)); + sg.end_struct(sizeof(physx::PxMassProperties)); + } + }; + physx_PxMassProperties_Pod::dump_layout(sg); + + struct physx_PxRigidBodyExt_Pod: public physx::PxRigidBodyExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRigidBodyExt_Pod", "PxRigidBodyExt"); + sg.end_struct(sizeof(physx::PxRigidBodyExt)); + } + }; + physx_PxRigidBodyExt_Pod::dump_layout(sg); + + struct physx_PxShapeExt_Pod: public physx::PxShapeExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxShapeExt_Pod", "PxShapeExt"); + sg.end_struct(sizeof(physx::PxShapeExt)); + } + }; + physx_PxShapeExt_Pod::dump_layout(sg); + + struct physx_PxMeshOverlapUtil_Pod: public physx::PxMeshOverlapUtil { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxMeshOverlapUtil_Pod", "PxMeshOverlapUtil"); + sg.end_struct(sizeof(physx::PxMeshOverlapUtil)); + } + }; + physx_PxMeshOverlapUtil_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBinaryConverter_Pod;\n"); + struct physx_PxXmlMiscParameter_Pod: public physx::PxXmlMiscParameter { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxXmlMiscParameter_Pod", "PxXmlMiscParameter"); + sg.add_field("physx_PxVec3_Pod upVector", "upVector", "PxVec3", sizeof(physx::PxVec3), unsafe_offsetof(physx_PxXmlMiscParameter_Pod, upVector)); + sg.add_field("physx_PxTolerancesScale_Pod scale", "scale", "PxTolerancesScale", sizeof(physx::PxTolerancesScale), unsafe_offsetof(physx_PxXmlMiscParameter_Pod, scale)); + sg.end_struct(sizeof(physx::PxXmlMiscParameter)); + } + }; + physx_PxXmlMiscParameter_Pod::dump_layout(sg); + + struct physx_PxSerialization_Pod: public physx::PxSerialization { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSerialization_Pod", "PxSerialization"); + sg.end_struct(sizeof(physx::PxSerialization)); + } + }; + physx_PxSerialization_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxDefaultCpuDispatcher_Pod {\n void* vtable_;\n};\n"); + struct physx_PxStringTableExt_Pod: public physx::PxStringTableExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxStringTableExt_Pod", "PxStringTableExt"); + sg.end_struct(sizeof(physx::PxStringTableExt)); + } + }; + physx_PxStringTableExt_Pod::dump_layout(sg); + + struct physx_PxBroadPhaseExt_Pod: public physx::PxBroadPhaseExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxBroadPhaseExt_Pod", "PxBroadPhaseExt"); + sg.end_struct(sizeof(physx::PxBroadPhaseExt)); + } + }; + physx_PxBroadPhaseExt_Pod::dump_layout(sg); + + struct physx_PxSceneQueryExt_Pod: public physx::PxSceneQueryExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSceneQueryExt_Pod", "PxSceneQueryExt"); + sg.end_struct(sizeof(physx::PxSceneQueryExt)); + } + }; + physx_PxSceneQueryExt_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxBatchQueryExt_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCustomSceneQuerySystem_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxCustomSceneQuerySystemAdapter_Pod {\n void* vtable_;\n};\n"); + struct physx_PxSamplingExt_Pod: public physx::PxSamplingExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxSamplingExt_Pod", "PxSamplingExt"); + sg.end_struct(sizeof(physx::PxSamplingExt)); + } + }; + physx_PxSamplingExt_Pod::dump_layout(sg); + + struct physx_PxPoissonSampler_Pod: public physx::PxPoissonSampler { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxPoissonSampler_Pod", "PxPoissonSampler"); + sg.end_struct(sizeof(physx::PxPoissonSampler)); + } + }; + physx_PxPoissonSampler_Pod::dump_layout(sg); + + struct physx_PxTriangleMeshPoissonSampler_Pod: public physx::PxTriangleMeshPoissonSampler { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTriangleMeshPoissonSampler_Pod", "PxTriangleMeshPoissonSampler"); + sg.end_struct(sizeof(physx::PxTriangleMeshPoissonSampler)); + } + }; + physx_PxTriangleMeshPoissonSampler_Pod::dump_layout(sg); + + struct physx_PxTetrahedronMeshExt_Pod: public physx::PxTetrahedronMeshExt { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxTetrahedronMeshExt_Pod", "PxTetrahedronMeshExt"); + sg.end_struct(sizeof(physx::PxTetrahedronMeshExt)); + } + }; + physx_PxTetrahedronMeshExt_Pod::dump_layout(sg); + + struct physx_PxRepXObject_Pod: public physx::PxRepXObject { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRepXObject_Pod", "PxRepXObject"); + sg.add_field("char const* typeName", "typeName", "*const std::ffi::c_char", sizeof(char const*), unsafe_offsetof(physx_PxRepXObject_Pod, typeName)); + sg.add_field("void const* serializable", "serializable", "*const std::ffi::c_void", sizeof(void const*), unsafe_offsetof(physx_PxRepXObject_Pod, serializable)); + sg.add_field("uint64_t id", "id", "u64", sizeof(uint64_t), unsafe_offsetof(physx_PxRepXObject_Pod, id)); + sg.end_struct(sizeof(physx::PxRepXObject)); + } + }; + physx_PxRepXObject_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_PxCooking_Pod;\n"); + struct physx_PxRepXInstantiationArgs_Pod: public physx::PxRepXInstantiationArgs { + static void dump_layout(PodStructGen& sg) { + sg.begin_struct("physx_PxRepXInstantiationArgs_Pod", "PxRepXInstantiationArgs"); + sg.add_field("physx_PxCooking_Pod* cooker", "cooker", "*mut PxCooking", sizeof(physx::PxCooking*), unsafe_offsetof(physx_PxRepXInstantiationArgs_Pod, cooker)); + sg.add_field("physx_PxStringTable_Pod* stringTable", "stringTable", "*mut PxStringTable", sizeof(physx::PxStringTable*), unsafe_offsetof(physx_PxRepXInstantiationArgs_Pod, stringTable)); + sg.end_struct(sizeof(physx::PxRepXInstantiationArgs)); + } + }; + physx_PxRepXInstantiationArgs_Pod::dump_layout(sg); + + sg.pass_thru("struct physx_XmlMemoryAllocator_Pod;\n"); + sg.pass_thru("struct physx_XmlWriter_Pod;\n"); + sg.pass_thru("struct physx_XmlReader_Pod;\n"); + sg.pass_thru("struct physx_MemoryBuffer_Pod;\n"); + sg.pass_thru("struct physx_PxRepXSerializer_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxVehicleWheels4SimData_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleWheels4DynData_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleTireForceCalculator_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleDrivableSurfaceToTireFrictionPairs_Pod;\n"); + sg.pass_thru("struct physx_PxVehicleTelemetryData_Pod;\n"); + sg.pass_thru("struct physx_PxPvdTransport_Pod;\n"); + sg.pass_thru("struct physx_PxPvd_Pod {\n void* vtable_;\n};\n"); + sg.pass_thru("struct physx_PxPvdTransport_Pod {\n void* vtable_;\n};\n"); + sg.finish(); +} diff --git a/modules/PhysX/physx/physx-sys/src/structgen/structgen.hpp b/modules/PhysX/physx/physx-sys/src/structgen/structgen.hpp new file mode 100644 index 0000000..07745fe --- /dev/null +++ b/modules/PhysX/physx/physx-sys/src/structgen/structgen.hpp @@ -0,0 +1,88 @@ +#include +#include +#include +#include + +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 use super::*;\n use std::mem::size_of;\n #[test]\n fn check_sizes() {\n", rfile); + for (const auto& rc : rust_checks) { + fprintf( + rfile, + " assert_eq!(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, "#[cfg_attr(feature = \"debug-structs\", derive(Debug))]\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 rust_checks; + FILE* cfile; + FILE* rfile; + const char* rname; + size_t pos; + uint32_t padIdx; +}; diff --git a/modules/PhysX/physx/physx-sys/target/.rustc_info.json b/modules/PhysX/physx/physx-sys/target/.rustc_info.json new file mode 100644 index 0000000..75c608a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":7727952987707309103,"outputs":{"16495917692426387086":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/kuju/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.80.0 (051478957 2024-07-21)\nbinary: rustc\ncommit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9\ncommit-date: 2024-07-21\nhost: x86_64-unknown-linux-gnu\nrelease: 1.80.0\nLLVM version: 18.1.7\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/CACHEDIR.TAG b/modules/PhysX/physx/physx-sys/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.cargo-lock b/modules/PhysX/physx/physx-sys/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/dep-lib-bitflags b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/dep-lib-bitflags new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/dep-lib-bitflags differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags new file mode 100644 index 0000000..fcc32de --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags @@ -0,0 +1 @@ +d4a9ef30c5676805 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags.json new file mode 100644 index 0000000..fdab6f5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/bitflags-f6c2a11e00f54c4f/lib-bitflags.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[\"default\"]","declared_features":"[\"compiler_builtins\", \"core\", \"default\", \"example_generated\", \"rustc-dep-of-std\"]","target":202096439108023897,"profile":16690480377348987070,"path":15410430763961243395,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/bitflags-f6c2a11e00f54c4f/dep-lib-bitflags"}}],"rustflags":[],"metadata":14564035643000669268,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/dep-lib-cc b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/dep-lib-cc new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/dep-lib-cc differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc new file mode 100644 index 0000000..7e24c2d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc @@ -0,0 +1 @@ +80aaf4067be1d67c \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc.json new file mode 100644 index 0000000..04a1f4c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/cc-1bbb76d873e4f57f/lib-cc.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[\"jobserver\", \"libc\", \"once_cell\", \"parallel\"]","declared_features":"[\"jobserver\", \"libc\", \"once_cell\", \"parallel\"]","target":15558527229170934796,"profile":8861558584828204938,"path":3559388631017034131,"deps":[[1438437697209609444,"jobserver",false,2201446237650091858],[4254328441789853856,"once_cell",false,12330381824070897532],[16859105048871006744,"libc",false,7240734459061769300]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/cc-1bbb76d873e4f57f/dep-lib-cc"}}],"rustflags":[],"metadata":5862599371499774553,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/dep-lib-jobserver b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/dep-lib-jobserver new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/dep-lib-jobserver differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver new file mode 100644 index 0000000..21ee3a5 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver @@ -0,0 +1 @@ +52ff407bb01b8d1e \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver.json new file mode 100644 index 0000000..4260e27 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/jobserver-fdd14c5ab8a10f26/lib-jobserver.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[]","declared_features":"[]","target":6988845742686229667,"profile":8861558584828204938,"path":7231589843554958098,"deps":[[16859105048871006744,"libc",false,7240734459061769300]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/jobserver-fdd14c5ab8a10f26/dep-lib-jobserver"}}],"rustflags":[],"metadata":16595760044110941856,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build new file mode 100644 index 0000000..016476f --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build @@ -0,0 +1 @@ +bb39150e2a05df58 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build.json new file mode 100644 index 0000000..6bae2c0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-130ef449c29c2588/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[16859105048871006744,"build_script_build",false,3737691420235036548]],"local":[{"RerunIfChanged":{"output":"debug/build/libc-130ef449c29c2588/output","paths":["build.rs"]}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build new file mode 100644 index 0000000..6b4b3a4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build @@ -0,0 +1 @@ +847722278bf2de33 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build.json new file mode 100644 index 0000000..7de03e6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[\"default\", \"std\"]","declared_features":"[\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"]","target":6423576478976419116,"profile":8861558584828204938,"path":5595444609051683787,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/libc-62681aef5bc670f9/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":14998826085014762512,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-62681aef5bc670f9/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/dep-lib-libc b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/dep-lib-libc new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/dep-lib-libc differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc new file mode 100644 index 0000000..a1c37a7 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc @@ -0,0 +1 @@ +54944ea1a0417c64 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc.json new file mode 100644 index 0000000..e3e8ba4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/libc-fc575165ea81cc67/lib-libc.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[\"default\", \"std\"]","declared_features":"[\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"]","target":7478490212225406400,"profile":8861558584828204938,"path":16849142308753911259,"deps":[[16859105048871006744,"build_script_build",false,6403842873327172027]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/libc-fc575165ea81cc67/dep-lib-libc"}}],"rustflags":[],"metadata":14998826085014762512,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/dep-lib-once_cell b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/dep-lib-once_cell new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/dep-lib-once_cell differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell new file mode 100644 index 0000000..43cf02d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell @@ -0,0 +1 @@ +7ccfad98f0501eab \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell.json new file mode 100644 index 0000000..ab7de97 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/once_cell-15255e9cea695494/lib-once_cell.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[\"alloc\", \"default\", \"race\", \"std\"]","declared_features":"[\"alloc\", \"atomic-polyfill\", \"critical-section\", \"default\", \"parking_lot\", \"portable-atomic\", \"race\", \"std\", \"unstable\"]","target":6794429743695580115,"profile":8861558584828204938,"path":16209352229936649492,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/once_cell-15255e9cea695494/dep-lib-once_cell"}}],"rustflags":[],"metadata":14177539708254521827,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build new file mode 100644 index 0000000..d3b9d0e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build @@ -0,0 +1 @@ +b73a3c8ab2e92451 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build.json new file mode 100644 index 0000000..0526b4e --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-577acca7a1f237f0/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[573819198708053098,"build_script_build",false,2798372799498588546]],"local":[{"RerunIfChanged":{"output":"debug/build/physx-sys-577acca7a1f237f0/output","paths":["src/physx_generated.hpp","src/physx_generated.rs","src/physx_api.cpp","physx/physx/include/foundation/PxPhysicsVersion.h"]}},{"RerunIfEnvChanged":{"var":"CC_ENABLE_DEBUG_OUTPUT","val":null}},{"RerunIfEnvChanged":{"var":"CRATE_CC_NO_DEFAULTS","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_CXXFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"AR_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"AR_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_AR","val":null}},{"RerunIfEnvChanged":{"var":"AR","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_ARFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_CXXSTDLIB","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB","val":null}},{"RerunIfEnvChanged":{"var":"CC_ENABLE_DEBUG_OUTPUT","val":null}},{"RerunIfEnvChanged":{"var":"CRATE_CC_NO_DEFAULTS","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_CXXFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"CXXFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"AR_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"AR_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_AR","val":null}},{"RerunIfEnvChanged":{"var":"AR","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_ARFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"ARFLAGS","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB_x86_64-unknown-linux-gnu","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB_x86_64_unknown_linux_gnu","val":null}},{"RerunIfEnvChanged":{"var":"HOST_CXXSTDLIB","val":null}},{"RerunIfEnvChanged":{"var":"CXXSTDLIB","val":null}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/dep-lib-physx_sys b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/dep-lib-physx_sys new file mode 100644 index 0000000..28df102 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/dep-lib-physx_sys differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/lib-physx_sys b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/lib-physx_sys new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/lib-physx_sys.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/lib-physx_sys.json new file mode 100644 index 0000000..400e6f8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/lib-physx_sys.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[]","declared_features":"[\"cpp-warnings\", \"debug-structs\", \"profile\", \"structgen\"]","target":6812562315457822505,"profile":6929766844333714335,"path":17523903030608720598,"deps":[[573819198708053098,"build_script_build",false,5847055169266399927],[14051957667571541382,"bitflags",false,389675464394779092]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/physx-sys-5a9af9c8f04defb4/dep-lib-physx_sys"}}],"rustflags":[],"metadata":8910512910446030985,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/output-lib-physx_sys b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/output-lib-physx_sys new file mode 100644 index 0000000..cea49b6 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-5a9af9c8f04defb4/output-lib-physx_sys @@ -0,0 +1,2 @@ +{"$message_type":"diagnostic","message":"expected one of `!` or `::`, found `(`","code":null,"level":"error","spans":[{"file_name":"src/physx_generated.rs","byte_start":152187,"byte_end":152188,"line_start":3984,"line_end":3984,"column_start":31,"column_end":32,"is_primary":true,"text":[{"text":" PxAllocatorCallback_delete(self_: *mut PxAllocatorCallback);","highlight_start":31,"highlight_end":32}],"label":"expected one of `!` or `::`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/physx_generated.rs","byte_start":152136,"byte_end":152137,"line_start":3982,"line_end":3982,"column_start":12,"column_end":13,"is_primary":false,"text":[{"text":"extern \"C\" {","highlight_start":12,"highlight_end":13}],"label":"while parsing this item list starting here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/physx_generated.rs","byte_start":732896,"byte_end":732897,"line_start":16147,"line_end":16147,"column_start":1,"column_end":2,"is_primary":false,"text":[{"text":"}","highlight_start":1,"highlight_end":2}],"label":"the item list ends here","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: expected one of `!` or `::`, found `(`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/physx_generated.rs:3984:31\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m3982\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mextern \"C\" {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m-\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mwhile parsing this item list starting here\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m3983\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m #[no_mangle]\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m3984\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m PxAllocatorCallback_delete(self_: *mut PxAllocatorCallback);\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mexpected one of `!` or `::`\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m...\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m16147\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m}\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m-\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mthe item list ends here\u001b[0m\n\n"} +{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 1 previous error\u001b[0m\n\n"} diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build new file mode 100644 index 0000000..2e29d28 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build @@ -0,0 +1 @@ +82913a173cd1d526 \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build.json b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build.json new file mode 100644 index 0000000..ed671a1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":11204790496287538401,"features":"[]","declared_features":"[\"cpp-warnings\", \"debug-structs\", \"profile\", \"structgen\"]","target":9652763411108993936,"profile":9863265754668111639,"path":4524081124783967569,"deps":[[17491831633240220582,"cc",false,8995625224233069184]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/physx-sys-8f3c236339c37e11/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":8910512910446030985,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/dep-build-script-build-script-build b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/dep-build-script-build-script-build new file mode 100644 index 0000000..d152301 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/dep-build-script-build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/.fingerprint/physx-sys-8f3c236339c37e11/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/output b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/output new file mode 100644 index 0000000..33449c2 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/output @@ -0,0 +1,42 @@ +cargo:rerun-if-changed=build.rs +cargo:rustc-cfg=freebsd11 +cargo:rustc-cfg=libc_priv_mod_use +cargo:rustc-cfg=libc_union +cargo:rustc-cfg=libc_const_size_of +cargo:rustc-cfg=libc_align +cargo:rustc-cfg=libc_int128 +cargo:rustc-cfg=libc_core_cvoid +cargo:rustc-cfg=libc_packedN +cargo:rustc-cfg=libc_cfg_target_vendor +cargo:rustc-cfg=libc_non_exhaustive +cargo:rustc-cfg=libc_long_array +cargo:rustc-cfg=libc_ptr_addr_of +cargo:rustc-cfg=libc_underscore_const_names +cargo:rustc-cfg=libc_const_extern_fn +cargo:rustc-check-cfg=cfg(emscripten_new_stat_abi) +cargo:rustc-check-cfg=cfg(espidf_time64) +cargo:rustc-check-cfg=cfg(freebsd10) +cargo:rustc-check-cfg=cfg(freebsd11) +cargo:rustc-check-cfg=cfg(freebsd12) +cargo:rustc-check-cfg=cfg(freebsd13) +cargo:rustc-check-cfg=cfg(freebsd14) +cargo:rustc-check-cfg=cfg(freebsd15) +cargo:rustc-check-cfg=cfg(libc_align) +cargo:rustc-check-cfg=cfg(libc_cfg_target_vendor) +cargo:rustc-check-cfg=cfg(libc_const_extern_fn) +cargo:rustc-check-cfg=cfg(libc_const_extern_fn_unstable) +cargo:rustc-check-cfg=cfg(libc_const_size_of) +cargo:rustc-check-cfg=cfg(libc_core_cvoid) +cargo:rustc-check-cfg=cfg(libc_deny_warnings) +cargo:rustc-check-cfg=cfg(libc_int128) +cargo:rustc-check-cfg=cfg(libc_long_array) +cargo:rustc-check-cfg=cfg(libc_non_exhaustive) +cargo:rustc-check-cfg=cfg(libc_packedN) +cargo:rustc-check-cfg=cfg(libc_priv_mod_use) +cargo:rustc-check-cfg=cfg(libc_ptr_addr_of) +cargo:rustc-check-cfg=cfg(libc_thread_local) +cargo:rustc-check-cfg=cfg(libc_underscore_const_names) +cargo:rustc-check-cfg=cfg(libc_union) +cargo:rustc-check-cfg=cfg(target_os,values("switch","aix","ohos","hurd","visionos")) +cargo:rustc-check-cfg=cfg(target_env,values("illumos","wasi","aix","ohos")) +cargo:rustc-check-cfg=cfg(target_arch,values("loongarch64","mips32r6","mips64r6","csky")) diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/root-output b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/root-output new file mode 100644 index 0000000..28a62e8 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/root-output @@ -0,0 +1 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/stderr b/modules/PhysX/physx/physx-sys/target/debug/build/libc-130ef449c29c2588/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build-script-build b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build-script-build new file mode 100644 index 0000000..bff96b4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9 b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9 new file mode 100644 index 0000000..bff96b4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9 differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9.d b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9.d new file mode 100644 index 0000000..52b624d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9.d @@ -0,0 +1,5 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/build.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/libc-62681aef5bc670f9/build_script_build-62681aef5bc670f9.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/build.rs + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/build.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/invoked.timestamp b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/122e7656a4dfc287-TaskManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/122e7656a4dfc287-TaskManager.o new file mode 100644 index 0000000..d100784 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/122e7656a4dfc287-TaskManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32.o new file mode 100644 index 0000000..5e95df0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32Build.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32Build.o new file mode 100644 index 0000000..c00d7e3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV32Build.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4.o new file mode 100644 index 0000000..e77a9df Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4Build.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4Build.o new file mode 100644 index 0000000..803336e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4Build.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_AABBSweep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_AABBSweep.o new file mode 100644 index 0000000..1fc0937 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_AABBSweep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_BoxOverlap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_BoxOverlap.o new file mode 100644 index 0000000..c31b5d8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_BoxOverlap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweep.o new file mode 100644 index 0000000..5d47d85 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweepAA.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweepAA.o new file mode 100644 index 0000000..656be2f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_CapsuleSweepAA.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_MeshMeshOverlap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_MeshMeshOverlap.o new file mode 100644 index 0000000..4466f8c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_MeshMeshOverlap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_OBBSweep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_OBBSweep.o new file mode 100644 index 0000000..070ebfc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_OBBSweep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_Raycast.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_Raycast.o new file mode 100644 index 0000000..e2fc068 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_Raycast.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereOverlap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereOverlap.o new file mode 100644 index 0000000..dbc5144 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereOverlap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereSweep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereSweep.o new file mode 100644 index 0000000..ca948d4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuBV4_SphereSweep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMeshQuery.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMeshQuery.o new file mode 100644 index 0000000..321f058 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMeshQuery.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseBV4.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseBV4.o new file mode 100644 index 0000000..d6181e1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseBV4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseRTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseRTree.o new file mode 100644 index 0000000..4762d01 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuMidphaseRTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuOverlapTestsMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuOverlapTestsMesh.o new file mode 100644 index 0000000..bf354b4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuOverlapTestsMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTree.o new file mode 100644 index 0000000..d187627 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTreeQueries.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTreeQueries.o new file mode 100644 index 0000000..4b8f726 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuRTreeQueries.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuSweepsMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuSweepsMesh.o new file mode 100644 index 0000000..d3b4487 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuSweepsMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTetrahedronMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTetrahedronMesh.o new file mode 100644 index 0000000..327ed3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTetrahedronMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMesh.o new file mode 100644 index 0000000..3978a2e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshBV4.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshBV4.o new file mode 100644 index 0000000..8e7a480 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshBV4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshRTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshRTree.o new file mode 100644 index 0000000..66c5553 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/17b50e8ac57346d2-GuTriangleMeshRTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuEPA.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuEPA.o new file mode 100644 index 0000000..cad4ef0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuEPA.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKSimplex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKSimplex.o new file mode 100644 index 0000000..7840c38 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKSimplex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKTest.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKTest.o new file mode 100644 index 0000000..0c2dfb9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/1bb2192acb2a5553-GuGJKTest.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixAtomic.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixAtomic.o new file mode 100644 index 0000000..22e7ec5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixAtomic.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixFPU.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixFPU.o new file mode 100644 index 0000000..3e2eca2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixFPU.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixMutex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixMutex.o new file mode 100644 index 0000000..de726c0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixMutex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixPrintString.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixPrintString.o new file mode 100644 index 0000000..bb764f2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixPrintString.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSList.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSList.o new file mode 100644 index 0000000..a62f55b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSList.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSocket.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSocket.o new file mode 100644 index 0000000..09dc16e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSocket.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSync.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSync.o new file mode 100644 index 0000000..a088cec Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixSync.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixThread.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixThread.o new file mode 100644 index 0000000..183054a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixThread.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixTime.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixTime.o new file mode 100644 index 0000000..ca9711e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2659aa3d1778c056-FdUnixTime.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2e40c9e35e9506f4-physx_api.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2e40c9e35e9506f4-physx_api.o new file mode 100644 index 0000000..2bca91e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/2e40c9e35e9506f4-physx_api.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAllocator.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAllocator.o new file mode 100644 index 0000000..d8ec1e2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAllocator.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAssert.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAssert.o new file mode 100644 index 0000000..9f7b418 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdAssert.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdFoundation.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdFoundation.o new file mode 100644 index 0000000..cfd2328 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdFoundation.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdMathUtils.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdMathUtils.o new file mode 100644 index 0000000..cc9a5db Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdMathUtils.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdString.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdString.o new file mode 100644 index 0000000..ea15b9f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdString.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdTempAllocator.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdTempAllocator.o new file mode 100644 index 0000000..f7c48fc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/3057ee9cb905712a-FdTempAllocator.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpActor.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpActor.o new file mode 100644 index 0000000..8f20a99 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpActor.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpAggregate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpAggregate.o new file mode 100644 index 0000000..3bf00f5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpAggregate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationJointReducedCoordinate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationJointReducedCoordinate.o new file mode 100644 index 0000000..74c9666 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationJointReducedCoordinate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationLink.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationLink.o new file mode 100644 index 0000000..45c0bb3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationLink.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationReducedCoordinate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationReducedCoordinate.o new file mode 100644 index 0000000..a06ae7c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationReducedCoordinate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationSensor.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationSensor.o new file mode 100644 index 0000000..6ceb9b3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationSensor.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationTendon.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationTendon.o new file mode 100644 index 0000000..51d8f6f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpArticulationTendon.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpBounds.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpBounds.o new file mode 100644 index 0000000..b09a376 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpBounds.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpCheck.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpCheck.o new file mode 100644 index 0000000..ec49137 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpCheck.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpConstraint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpConstraint.o new file mode 100644 index 0000000..6417635 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpConstraint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpDebugViz.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpDebugViz.o new file mode 100644 index 0000000..44b7d61 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpDebugViz.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMCloth.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMCloth.o new file mode 100644 index 0000000..2ac9922 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMCloth.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMClothMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMClothMaterial.o new file mode 100644 index 0000000..2d56b57 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMClothMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMSoftBodyMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMSoftBodyMaterial.o new file mode 100644 index 0000000..91a0355 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFEMSoftBodyMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFLIPMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFLIPMaterial.o new file mode 100644 index 0000000..81ab0e5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFLIPMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFactory.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFactory.o new file mode 100644 index 0000000..605f1ae Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpFactory.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpHairSystem.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpHairSystem.o new file mode 100644 index 0000000..8334f35 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpHairSystem.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMPMMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMPMMaterial.o new file mode 100644 index 0000000..eb43a6c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMPMMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMaterial.o new file mode 100644 index 0000000..7fefb44 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMetaData.o new file mode 100644 index 0000000..abd9aa5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPBDMaterial.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPBDMaterial.o new file mode 100644 index 0000000..56550ab Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPBDMaterial.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpParticleSystem.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpParticleSystem.o new file mode 100644 index 0000000..4a10d12 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpParticleSystem.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPhysics.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPhysics.o new file mode 100644 index 0000000..a530990 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPhysics.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPruningStructure.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPruningStructure.o new file mode 100644 index 0000000..261e031 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPruningStructure.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneClient.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneClient.o new file mode 100644 index 0000000..39454a2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneClient.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneQueryCollector.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneQueryCollector.o new file mode 100644 index 0000000..b4ceb65 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpPvdSceneQueryCollector.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidDynamic.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidDynamic.o new file mode 100644 index 0000000..1793d3b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidDynamic.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidStatic.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidStatic.o new file mode 100644 index 0000000..714e31c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpRigidStatic.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpScene.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpScene.o new file mode 100644 index 0000000..3c6e3ce Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpScene.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneFetchResults.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneFetchResults.o new file mode 100644 index 0000000..74950a9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneFetchResults.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneQueries.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneQueries.o new file mode 100644 index 0000000..f493eaa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSceneQueries.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSerializerAdapter.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSerializerAdapter.o new file mode 100644 index 0000000..da0770d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSerializerAdapter.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShape.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShape.o new file mode 100644 index 0000000..327f6b8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShape.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShapeManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShapeManager.o new file mode 100644 index 0000000..4c14b4b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpShapeManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSoftBody.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSoftBody.o new file mode 100644 index 0000000..359d8e2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-NpSoftBody.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdMetaDataPvdBinding.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdMetaDataPvdBinding.o new file mode 100644 index 0000000..5e73e6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdMetaDataPvdBinding.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdPhysicsClient.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdPhysicsClient.o new file mode 100644 index 0000000..d221886 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4008ae3b1cd8e6d1-PvdPhysicsClient.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialUtils.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialUtils.o new file mode 100644 index 0000000..db5f4d1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialUtils.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialization.o new file mode 100644 index 0000000..f1026c3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerialization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerializationRegistry.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerializationRegistry.o new file mode 100644 index 0000000..eae2572 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/42671ee22cc4b8df-SnSerializationRegistry.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuBigConvexData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuBigConvexData.o new file mode 100644 index 0000000..cefa050 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuBigConvexData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexHelper.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexHelper.o new file mode 100644 index 0000000..b749a95 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexHelper.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexMesh.o new file mode 100644 index 0000000..6d6044b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexSupportTable.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexSupportTable.o new file mode 100644 index 0000000..7802de5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexSupportTable.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexUtilsInternal.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexUtilsInternal.o new file mode 100644 index 0000000..6731598 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuConvexUtilsInternal.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuHillClimbing.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuHillClimbing.o new file mode 100644 index 0000000..620ee9a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuHillClimbing.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuShapeConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuShapeConvex.o new file mode 100644 index 0000000..687c303 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4505667025500105-GuShapeConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManager.o new file mode 100644 index 0000000..862c984 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManagerBase.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManagerBase.o new file mode 100644 index 0000000..25e776f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpAABBManagerBase.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhase.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhase.o new file mode 100644 index 0000000..a940f18 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhase.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseABP.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseABP.o new file mode 100644 index 0000000..3aeb70a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseABP.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseMBP.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseMBP.o new file mode 100644 index 0000000..9d20cf4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseMBP.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSap.o new file mode 100644 index 0000000..ece272a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSapAux.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSapAux.o new file mode 100644 index 0000000..9e0dbba Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseSapAux.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseShared.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseShared.o new file mode 100644 index 0000000..f9e7bb8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseShared.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseUpdate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseUpdate.o new file mode 100644 index 0000000..661cd88 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpBroadPhaseUpdate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpFiltering.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpFiltering.o new file mode 100644 index 0000000..413996a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4970ede8bfc57bce-BpFiltering.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionBoxBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionBoxBox.o new file mode 100644 index 0000000..6f3efa4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionBoxBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionCapsuleTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionCapsuleTriangle.o new file mode 100644 index 0000000..1e26a75 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionCapsuleTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionEdgeEdge.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionEdgeEdge.o new file mode 100644 index 0000000..6cbe766 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionEdgeEdge.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayBox.o new file mode 100644 index 0000000..0c33b30 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayCapsule.o new file mode 100644 index 0000000..c26bfd3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRayCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRaySphere.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRaySphere.o new file mode 100644 index 0000000..68c2dba Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionRaySphere.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionSphereBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionSphereBox.o new file mode 100644 index 0000000..82bb6d1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionSphereBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTetrahedronBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTetrahedronBox.o new file mode 100644 index 0000000..41b7f67 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTetrahedronBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleBox.o new file mode 100644 index 0000000..caae2a0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleTriangle.o new file mode 100644 index 0000000..ba67226 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4cf7234c321fceef-GuIntersectionTriangleTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxProfileEventImpl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxProfileEventImpl.o new file mode 100644 index 0000000..b20a0a3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxProfileEventImpl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvd.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvd.o new file mode 100644 index 0000000..2eaf0f1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvd.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDataStream.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDataStream.o new file mode 100644 index 0000000..6c94fea Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDataStream.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultFileTransport.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultFileTransport.o new file mode 100644 index 0000000..8dd9e00 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultFileTransport.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultSocketTransport.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultSocketTransport.o new file mode 100644 index 0000000..702885b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdDefaultSocketTransport.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdImpl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdImpl.o new file mode 100644 index 0000000..f79cdba Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdImpl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdMemClient.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdMemClient.o new file mode 100644 index 0000000..5ea270d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdMemClient.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectModelMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectModelMetaData.o new file mode 100644 index 0000000..7a10649 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectModelMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectRegistrar.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectRegistrar.o new file mode 100644 index 0000000..a611224 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdObjectRegistrar.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdProfileZoneClient.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdProfileZoneClient.o new file mode 100644 index 0000000..c9ca0fc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdProfileZoneClient.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdUserRenderer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdUserRenderer.o new file mode 100644 index 0000000..538b652 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/4f1396cceaef6d3d-PxPvdUserRenderer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5607ed1c5db4e9d0-PsFastXml.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5607ed1c5db4e9d0-PsFastXml.o new file mode 100644 index 0000000..cdf0997 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5607ed1c5db4e9d0-PsFastXml.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmCollection.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmCollection.o new file mode 100644 index 0000000..939100a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmCollection.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmPtrTable.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmPtrTable.o new file mode 100644 index 0000000..502c0a6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmPtrTable.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmRadixSort.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmRadixSort.o new file mode 100644 index 0000000..84db70c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmRadixSort.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmSerialize.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmSerialize.o new file mode 100644 index 0000000..94a8887 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmSerialize.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmVisualization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmVisualization.o new file mode 100644 index 0000000..b47b007 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/5ea27eef07376c55-CmVisualization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactCache.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactCache.o new file mode 100644 index 0000000..64c8104 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactCache.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactMethodImpl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactMethodImpl.o new file mode 100644 index 0000000..386abfb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcContactMethodImpl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcMaterialMethodImpl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcMaterialMethodImpl.o new file mode 100644 index 0000000..b39a31f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcMaterialMethodImpl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpBatch.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpBatch.o new file mode 100644 index 0000000..f7b66f8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpBatch.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpCacheStreamPair.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpCacheStreamPair.o new file mode 100644 index 0000000..8c27120 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpCacheStreamPair.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpContactPrepShared.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpContactPrepShared.o new file mode 100644 index 0000000..6ee4b6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpContactPrepShared.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpMemBlockPool.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpMemBlockPool.o new file mode 100644 index 0000000..ae8a9cc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpMemBlockPool.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpThreadContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpThreadContext.o new file mode 100644 index 0000000..7ebb020 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/653498dd576e7f91-PxcNpThreadContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepConvexMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepConvexMesh.o new file mode 100644 index 0000000..c3fbd8d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepConvexMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepPrimitives.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepPrimitives.o new file mode 100644 index 0000000..fc89049 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6b41ffd2bea108db-GuCCDSweepPrimitives.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnJointRepXSerializer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnJointRepXSerializer.o new file mode 100644 index 0000000..a8949d0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnJointRepXSerializer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXCoreSerializer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXCoreSerializer.o new file mode 100644 index 0000000..a62bd48 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXCoreSerializer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXUpgrader.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXUpgrader.o new file mode 100644 index 0000000..11663b5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnRepXUpgrader.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnXmlSerialization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnXmlSerialization.o new file mode 100644 index 0000000..408e3fb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/6e321b266076b2a5-SnXmlSerialization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctBoxController.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctBoxController.o new file mode 100644 index 0000000..3042e44 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctBoxController.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCapsuleController.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCapsuleController.o new file mode 100644 index 0000000..b75ac23 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCapsuleController.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterController.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterController.o new file mode 100644 index 0000000..ae1aa24 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterController.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerCallbacks.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerCallbacks.o new file mode 100644 index 0000000..bde62ca Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerCallbacks.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerManager.o new file mode 100644 index 0000000..9d8896b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctCharacterControllerManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctController.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctController.o new file mode 100644 index 0000000..69f0324 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctController.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctObstacleContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctObstacleContext.o new file mode 100644 index 0000000..10407f6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctObstacleContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptBox.o new file mode 100644 index 0000000..e9ac558 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptCapsule.o new file mode 100644 index 0000000..0d4cc21 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptVolume.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptVolume.o new file mode 100644 index 0000000..f67636b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/74f013a11bfc5618-CctSweptVolume.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/81d5adc6762311d8-NpImmediateMode.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/81d5adc6762311d8-NpImmediateMode.o new file mode 100644 index 0000000..743c8c8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/81d5adc6762311d8-NpImmediateMode.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsCCD.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsCCD.o new file mode 100644 index 0000000..0187592 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsCCD.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContactManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContactManager.o new file mode 100644 index 0000000..1d9965f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContactManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContext.o new file mode 100644 index 0000000..c154e73 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsDefaultMemoryManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsDefaultMemoryManager.o new file mode 100644 index 0000000..5eaa981 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsDefaultMemoryManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsIslandSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsIslandSim.o new file mode 100644 index 0000000..0bad80d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsIslandSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsNphaseImplementationContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsNphaseImplementationContext.o new file mode 100644 index 0000000..004e690 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsNphaseImplementationContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsSimpleIslandManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsSimpleIslandManager.o new file mode 100644 index 0000000..56d0260 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/823525f661ca354d-PxsSimpleIslandManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruner.o new file mode 100644 index 0000000..7e84312 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruningPool.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruningPool.o new file mode 100644 index 0000000..0029f92 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqCompoundPruningPool.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqFactory.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqFactory.o new file mode 100644 index 0000000..dd0a6fb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqFactory.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqManager.o new file mode 100644 index 0000000..f438ed8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqQuery.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqQuery.o new file mode 100644 index 0000000..fd00991 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/866135840add89b7-SqQuery.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinaryDeserialization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinaryDeserialization.o new file mode 100644 index 0000000..687221e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinaryDeserialization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinarySerialization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinarySerialization.o new file mode 100644 index 0000000..56b96fc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnBinarySerialization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX.o new file mode 100644 index 0000000..db84821 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Align.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Align.o new file mode 100644 index 0000000..89b1c09 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Align.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Convert.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Convert.o new file mode 100644 index 0000000..2645571 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Convert.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Error.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Error.o new file mode 100644 index 0000000..958d598 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Error.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_MetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_MetaData.o new file mode 100644 index 0000000..5fd694c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_MetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Output.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Output.o new file mode 100644 index 0000000..f9c5f54 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Output.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Union.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Union.o new file mode 100644 index 0000000..58e2162 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnConvX_Union.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnSerializationContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnSerializationContext.o new file mode 100644 index 0000000..2fff0f1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8b66dcb48c4c0b1e-SnSerializationContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBPruner.o new file mode 100644 index 0000000..ed4e3fa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTree.o new file mode 100644 index 0000000..b75ea47 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTreeUpdateMap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTreeUpdateMap.o new file mode 100644 index 0000000..9a95679 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuAABBTreeUpdateMap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuActorShapeMap.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuActorShapeMap.o new file mode 100644 index 0000000..1d10f09 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuActorShapeMap.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBVH.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBVH.o new file mode 100644 index 0000000..59fec64 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBVH.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBounds.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBounds.o new file mode 100644 index 0000000..c3f533b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBounds.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBox.o new file mode 100644 index 0000000..f362dbe Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBucketPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBucketPruner.o new file mode 100644 index 0000000..d2238ed Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuBucketPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCCTSweepTests.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCCTSweepTests.o new file mode 100644 index 0000000..54fb85d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCCTSweepTests.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCapsule.o new file mode 100644 index 0000000..9ea9281 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCookingSDF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCookingSDF.o new file mode 100644 index 0000000..57f7d54 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuCookingSDF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuExtendedBucketPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuExtendedBucketPruner.o new file mode 100644 index 0000000..714a0c4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuExtendedBucketPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuFactory.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuFactory.o new file mode 100644 index 0000000..53a5c6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuFactory.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGeometryQuery.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGeometryQuery.o new file mode 100644 index 0000000..fb394f0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGeometryQuery.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGjkQuery.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGjkQuery.o new file mode 100644 index 0000000..4ae0654 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuGjkQuery.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPruner.o new file mode 100644 index 0000000..ffdead8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPrunerCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPrunerCore.o new file mode 100644 index 0000000..471ab39 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBPrunerCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBTree.o new file mode 100644 index 0000000..319353f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuIncrementalAABBTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuInternal.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuInternal.o new file mode 100644 index 0000000..95003ca Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuInternal.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMTD.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMTD.o new file mode 100644 index 0000000..8fbeac3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMTD.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMaverickNode.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMaverickNode.o new file mode 100644 index 0000000..44a9b2b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMaverickNode.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMeshFactory.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMeshFactory.o new file mode 100644 index 0000000..5f31d54 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMeshFactory.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMetaData.o new file mode 100644 index 0000000..1f50288 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuOverlapTests.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuOverlapTests.o new file mode 100644 index 0000000..55263af Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuOverlapTests.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuPruningPool.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuPruningPool.o new file mode 100644 index 0000000..33fc9d8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuPruningPool.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuQuerySystem.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuQuerySystem.o new file mode 100644 index 0000000..6e4a0c8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuQuerySystem.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuRaycastTests.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuRaycastTests.o new file mode 100644 index 0000000..0972093 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuRaycastTests.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSAH.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSAH.o new file mode 100644 index 0000000..cf973db Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSAH.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSDF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSDF.o new file mode 100644 index 0000000..1d2170d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSDF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSecondaryPruner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSecondaryPruner.o new file mode 100644 index 0000000..332fd0e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSecondaryPruner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSqInternal.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSqInternal.o new file mode 100644 index 0000000..336d6d2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSqInternal.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepMTD.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepMTD.o new file mode 100644 index 0000000..20fc3fa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepMTD.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepSharedTests.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepSharedTests.o new file mode 100644 index 0000000..e97704d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepSharedTests.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepTests.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepTests.o new file mode 100644 index 0000000..d965b93 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuSweepTests.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuWindingNumber.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuWindingNumber.o new file mode 100644 index 0000000..c9b2766 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/8dda0fa7e21b4045-GuWindingNumber.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointBox.o new file mode 100644 index 0000000..bae7ad4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTetrahedron.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTetrahedron.o new file mode 100644 index 0000000..ec24fcc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTetrahedron.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTriangle.o new file mode 100644 index 0000000..c9b84c6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistancePointTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentBox.o new file mode 100644 index 0000000..0ae8d91 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentSegment.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentSegment.o new file mode 100644 index 0000000..21086b3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentSegment.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentTriangle.o new file mode 100644 index 0000000..d1d7684 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/95141eb3f8e00195-GuDistanceSegmentTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtBroadPhase.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtBroadPhase.o new file mode 100644 index 0000000..9054bf2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtBroadPhase.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCollection.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCollection.o new file mode 100644 index 0000000..3b0bc11 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCollection.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtContactJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtContactJoint.o new file mode 100644 index 0000000..b360d5b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtContactJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtConvexMeshExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtConvexMeshExt.o new file mode 100644 index 0000000..ce72cb2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtConvexMeshExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCpuWorkerThread.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCpuWorkerThread.o new file mode 100644 index 0000000..c78b499 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCpuWorkerThread.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomGeometryExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomGeometryExt.o new file mode 100644 index 0000000..5c24eb7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomGeometryExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomSceneQuerySystem.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomSceneQuerySystem.o new file mode 100644 index 0000000..84dd6e2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtCustomSceneQuerySystem.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6Joint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6Joint.o new file mode 100644 index 0000000..6085c87 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6Joint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6JointCreate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6JointCreate.o new file mode 100644 index 0000000..8b4fe50 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtD6JointCreate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultCpuDispatcher.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultCpuDispatcher.o new file mode 100644 index 0000000..ec987ea Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultCpuDispatcher.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultErrorCallback.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultErrorCallback.o new file mode 100644 index 0000000..bb6624c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultErrorCallback.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultSimulationFilterShader.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultSimulationFilterShader.o new file mode 100644 index 0000000..3a12f94 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultSimulationFilterShader.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultStreams.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultStreams.o new file mode 100644 index 0000000..d3ba7a0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDefaultStreams.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDistanceJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDistanceJoint.o new file mode 100644 index 0000000..885f653 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtDistanceJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtExtensions.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtExtensions.o new file mode 100644 index 0000000..8ead1b1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtExtensions.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtFixedJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtFixedJoint.o new file mode 100644 index 0000000..3db3aec Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtFixedJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGearJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGearJoint.o new file mode 100644 index 0000000..f22a1a1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGearJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGjkQueryExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGjkQueryExt.o new file mode 100644 index 0000000..692e14a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtGjkQueryExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtJoint.o new file mode 100644 index 0000000..a1a9d1c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtMetaData.o new file mode 100644 index 0000000..1d1b70b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPrismaticJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPrismaticJoint.o new file mode 100644 index 0000000..89858eb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPrismaticJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPvd.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPvd.o new file mode 100644 index 0000000..53f07a2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPvd.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPxStringTable.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPxStringTable.o new file mode 100644 index 0000000..83c303f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtPxStringTable.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRackAndPinionJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRackAndPinionJoint.o new file mode 100644 index 0000000..49d6b5a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRackAndPinionJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRaycastCCD.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRaycastCCD.o new file mode 100644 index 0000000..707c49a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRaycastCCD.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRemeshingExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRemeshingExt.o new file mode 100644 index 0000000..aaf5e6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRemeshingExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRevoluteJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRevoluteJoint.o new file mode 100644 index 0000000..61e962a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRevoluteJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidActorExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidActorExt.o new file mode 100644 index 0000000..3df62a6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidActorExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidBodyExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidBodyExt.o new file mode 100644 index 0000000..e0c5964 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtRigidBodyExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSampling.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSampling.o new file mode 100644 index 0000000..f4bf095 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSampling.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQueryExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQueryExt.o new file mode 100644 index 0000000..bde079b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQueryExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQuerySystem.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQuerySystem.o new file mode 100644 index 0000000..be72ed1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSceneQuerySystem.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSimpleFactory.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSimpleFactory.o new file mode 100644 index 0000000..c5c6743 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSimpleFactory.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSmoothNormals.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSmoothNormals.o new file mode 100644 index 0000000..293846e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSmoothNormals.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSoftBodyExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSoftBodyExt.o new file mode 100644 index 0000000..773b8c5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSoftBodyExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSphericalJoint.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSphericalJoint.o new file mode 100644 index 0000000..3fe6f0e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSphericalJoint.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqManager.o new file mode 100644 index 0000000..01f8fa0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqQuery.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqQuery.o new file mode 100644 index 0000000..84601d7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtSqQuery.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetMakerExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetMakerExt.o new file mode 100644 index 0000000..499adae Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetMakerExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetrahedronMeshExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetrahedronMeshExt.o new file mode 100644 index 0000000..dfbd260 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTetrahedronMeshExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTriangleMeshExt.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTriangleMeshExt.o new file mode 100644 index 0000000..a5c2ecf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/9eb1f6fe25744e69-ExtTriangleMeshExt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a25937f24e302c51-Cooking.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a25937f24e302c51-Cooking.o new file mode 100644 index 0000000..bd6bead Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a25937f24e302c51-Cooking.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrep.o new file mode 100644 index 0000000..52d4f6c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrepPF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrepPF.o new file mode 100644 index 0000000..87c0119 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyArticulationContactPrepPF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintPartition.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintPartition.o new file mode 100644 index 0000000..74b4be8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintPartition.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetup.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetup.o new file mode 100644 index 0000000..a1742db Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetup.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetupBlock.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetupBlock.o new file mode 100644 index 0000000..85906da Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyConstraintSetupBlock.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep.o new file mode 100644 index 0000000..db85e23 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4.o new file mode 100644 index 0000000..ab9fc5a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4PF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4PF.o new file mode 100644 index 0000000..8ddf64e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrep4PF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrepPF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrepPF.o new file mode 100644 index 0000000..553f940 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyContactPrepPF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyDynamics.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyDynamics.o new file mode 100644 index 0000000..86608e1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyDynamics.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneArticulation.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneArticulation.o new file mode 100644 index 0000000..f809c54 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneArticulation.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneForwardDynamic.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneForwardDynamic.o new file mode 100644 index 0000000..ae0035a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneForwardDynamic.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneInverseDynamic.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneInverseDynamic.o new file mode 100644 index 0000000..3dccf46 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFeatherstoneInverseDynamic.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFrictionCorrelation.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFrictionCorrelation.o new file mode 100644 index 0000000..be07b04 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyFrictionCorrelation.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyRigidBodyToSolverBody.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyRigidBodyToSolverBody.o new file mode 100644 index 0000000..110de96 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyRigidBodyToSolverBody.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraints.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraints.o new file mode 100644 index 0000000..cdb6c5f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraints.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraintsBlock.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraintsBlock.o new file mode 100644 index 0000000..4e4de90 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverConstraintsBlock.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControl.o new file mode 100644 index 0000000..8ffa2bf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControlPF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControlPF.o new file mode 100644 index 0000000..9f1f826 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverControlPF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraints.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraints.o new file mode 100644 index 0000000..09c487e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraints.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraintsBlock.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraintsBlock.o new file mode 100644 index 0000000..c0fbfdc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DySolverPFConstraintsBlock.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrep.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrep.o new file mode 100644 index 0000000..ba9cd75 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrep.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrepBlock.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrepBlock.o new file mode 100644 index 0000000..9894951 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSContactPrepBlock.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSDynamics.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSDynamics.o new file mode 100644 index 0000000..309e9d6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyTGSDynamics.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThreadContext.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThreadContext.o new file mode 100644 index 0000000..0f0d7e0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThreadContext.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThresholdTable.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThresholdTable.o new file mode 100644 index 0000000..2ed33c6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/a91921f2fc473acf-DyThresholdTable.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxBox.o new file mode 100644 index 0000000..52e5a37 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxSphere.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxSphere.o new file mode 100644 index 0000000..6cbdb4b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxSphere.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_FeatureBased.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_FeatureBased.o new file mode 100644 index 0000000..67069b6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_FeatureBased.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_SAT.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_SAT.o new file mode 100644 index 0000000..ddea172 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepBoxTriangle_SAT.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleBox.o new file mode 100644 index 0000000..5d2818f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleCapsule.o new file mode 100644 index 0000000..9d2372a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleTriangle.o new file mode 100644 index 0000000..1e7ada1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepCapsuleTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereCapsule.o new file mode 100644 index 0000000..57066f7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereSphere.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereSphere.o new file mode 100644 index 0000000..611e54c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereSphere.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereTriangle.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereTriangle.o new file mode 100644 index 0000000..2aeb758 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepSphereTriangle.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepTriangleUtils.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepTriangleUtils.o new file mode 100644 index 0000000..032b955 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/b200a41b79b6fb5d-GuSweepTriangleUtils.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/bbf0897011efb1e2-PxExtensionAutoGeneratedMetaDataObjects.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/bbf0897011efb1e2-PxExtensionAutoGeneratedMetaDataObjects.o new file mode 100644 index 0000000..ca4635a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/bbf0897011efb1e2-PxExtensionAutoGeneratedMetaDataObjects.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleAutoGeneratedMetaDataObjects.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleAutoGeneratedMetaDataObjects.o new file mode 100644 index 0000000..0b671a5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleAutoGeneratedMetaDataObjects.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleMetaDataObjects.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleMetaDataObjects.o new file mode 100644 index 0000000..d1dc140 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/c13a3e4779f6f1ad-PxVehicleMetaDataObjects.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightField.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightField.o new file mode 100644 index 0000000..2f6bc00 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightField.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightFieldUtil.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightFieldUtil.o new file mode 100644 index 0000000..6215ad0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuHeightFieldUtil.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuOverlapTestsHF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuOverlapTestsHF.o new file mode 100644 index 0000000..34caba1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuOverlapTestsHF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuSweepsHF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuSweepsHF.o new file mode 100644 index 0000000..99eb09b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cae74d40a5020e27-GuSweepsHF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtBVH.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtBVH.o new file mode 100644 index 0000000..976a762 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtBVH.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayBoundaryInserter.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayBoundaryInserter.o new file mode 100644 index 0000000..65930f1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayBoundaryInserter.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayTetrahedralizer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayTetrahedralizer.o new file mode 100644 index 0000000..2fc9055 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtDelaunayTetrahedralizer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtFastWindingNumber.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtFastWindingNumber.o new file mode 100644 index 0000000..5483d04 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtFastWindingNumber.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtInsideTester.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtInsideTester.o new file mode 100644 index 0000000..9bcf066 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtInsideTester.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtMeshSimplificator.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtMeshSimplificator.o new file mode 100644 index 0000000..c860cf5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtMeshSimplificator.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtOctreeTetrahedralizer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtOctreeTetrahedralizer.o new file mode 100644 index 0000000..a078d22 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtOctreeTetrahedralizer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtRemesher.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtRemesher.o new file mode 100644 index 0000000..b28c745 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtRemesher.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetSplitting.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetSplitting.o new file mode 100644 index 0000000..e899585 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetSplitting.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetUnionFind.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetUnionFind.o new file mode 100644 index 0000000..2798f0c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtTetUnionFind.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtUtilities.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtUtilities.o new file mode 100644 index 0000000..3d2eef1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtUtilities.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtVoxelTetrahedralizer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtVoxelTetrahedralizer.o new file mode 100644 index 0000000..5e30c81 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cc5dca862e1b2dfb-ExtVoxelTetrahedralizer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cd9784801bb9ed17-px_globals.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cd9784801bb9ed17-px_globals.o new file mode 100644 index 0000000..c785b46 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/cd9784801bb9ed17-px_globals.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuAdjacencies.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuAdjacencies.o new file mode 100644 index 0000000..293caa6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuAdjacencies.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuBarycentricCoordinates.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuBarycentricCoordinates.o new file mode 100644 index 0000000..375ace8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuBarycentricCoordinates.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuEdgeList.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuEdgeList.o new file mode 100644 index 0000000..7dd646b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuEdgeList.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshAnalysis.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshAnalysis.o new file mode 100644 index 0000000..377a941 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshAnalysis.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshCleaner.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshCleaner.o new file mode 100644 index 0000000..3f98876 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuMeshCleaner.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuQuantizer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuQuantizer.o new file mode 100644 index 0000000..5562465 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuQuantizer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuSeparatingAxes.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuSeparatingAxes.o new file mode 100644 index 0000000..17e49a7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuSeparatingAxes.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuVertexReducer.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuVertexReducer.o new file mode 100644 index 0000000..170e3b0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b24a11dc5ae042-GuVertexReducer.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorCore.o new file mode 100644 index 0000000..43283e6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorSim.o new file mode 100644 index 0000000..6efe009 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScActorSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationCore.o new file mode 100644 index 0000000..ab6454b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointCore.o new file mode 100644 index 0000000..590c1f7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointSim.o new file mode 100644 index 0000000..4ef681a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationJointSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSensorSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSensorSim.o new file mode 100644 index 0000000..e438f5b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSensorSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSim.o new file mode 100644 index 0000000..5f399f6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonCore.o new file mode 100644 index 0000000..79a5a2c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonJointCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonJointCore.o new file mode 100644 index 0000000..fa7158e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonJointCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonSim.o new file mode 100644 index 0000000..da3f102 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScArticulationTendonSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodyCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodyCore.o new file mode 100644 index 0000000..6917982 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodyCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodySim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodySim.o new file mode 100644 index 0000000..fa7d875 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScBodySim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScCCD.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScCCD.o new file mode 100644 index 0000000..61c6234 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScCCD.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintCore.o new file mode 100644 index 0000000..f8a66b0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintGroupNode.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintGroupNode.o new file mode 100644 index 0000000..b01aa66 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintGroupNode.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintInteraction.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintInteraction.o new file mode 100644 index 0000000..73bb907 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintInteraction.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionManager.o new file mode 100644 index 0000000..ebba39a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionTree.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionTree.o new file mode 100644 index 0000000..830c3fb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintProjectionTree.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintSim.o new file mode 100644 index 0000000..8f5a38b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScConstraintSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementInteractionMarker.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementInteractionMarker.o new file mode 100644 index 0000000..31eb579 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementInteractionMarker.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementSim.o new file mode 100644 index 0000000..c277db4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScElementSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothCore.o new file mode 100644 index 0000000..028d97f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothShapeSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothShapeSim.o new file mode 100644 index 0000000..f7c8926 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothShapeSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothSim.o new file mode 100644 index 0000000..08c529b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScFEMClothSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemCore.o new file mode 100644 index 0000000..6d363b2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeCore.o new file mode 100644 index 0000000..e60f609 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeSim.o new file mode 100644 index 0000000..d1cac55 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemShapeSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemSim.o new file mode 100644 index 0000000..5a070e3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScHairSystemSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScInteraction.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScInteraction.o new file mode 100644 index 0000000..6e78bf4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScInteraction.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScIterators.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScIterators.o new file mode 100644 index 0000000..5cae36e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScIterators.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScMetaData.o new file mode 100644 index 0000000..cd24662 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScNPhaseCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScNPhaseCore.o new file mode 100644 index 0000000..96aef46 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScNPhaseCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemCore.o new file mode 100644 index 0000000..faf5692 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeCore.o new file mode 100644 index 0000000..d0d5134 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeSim.o new file mode 100644 index 0000000..e150274 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemShapeSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemSim.o new file mode 100644 index 0000000..2bbabd2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScParticleSystemSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScPhysics.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScPhysics.o new file mode 100644 index 0000000..ad76eed Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScPhysics.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidCore.o new file mode 100644 index 0000000..d70f697 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidSim.o new file mode 100644 index 0000000..9b97706 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScRigidSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScScene.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScScene.o new file mode 100644 index 0000000..55878bf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScScene.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeCore.o new file mode 100644 index 0000000..1ad8f29 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeInteraction.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeInteraction.o new file mode 100644 index 0000000..e7f657a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeInteraction.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSim.o new file mode 100644 index 0000000..d71558e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSimBase.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSimBase.o new file mode 100644 index 0000000..78532bf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScShapeSimBase.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimStats.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimStats.o new file mode 100644 index 0000000..a0ed70a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimStats.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimulationController.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimulationController.o new file mode 100644 index 0000000..a23eaf0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSimulationController.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyCore.o new file mode 100644 index 0000000..06a477a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyShapeSim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyShapeSim.o new file mode 100644 index 0000000..7bba2c0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodyShapeSim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodySim.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodySim.o new file mode 100644 index 0000000..03f9b27 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSoftBodySim.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSqBoundsManager.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSqBoundsManager.o new file mode 100644 index 0000000..2447795 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScSqBoundsManager.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScStaticCore.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScStaticCore.o new file mode 100644 index 0000000..2dfae0d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScStaticCore.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScTriggerInteraction.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScTriggerInteraction.o new file mode 100644 index 0000000..c467042 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/d4b2eabe48fa7cdb-ScTriggerInteraction.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxBox.o new file mode 100644 index 0000000..a1b4db6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxConvex.o new file mode 100644 index 0000000..c7c47d5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactBoxConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleBox.o new file mode 100644 index 0000000..b095ad4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleCapsule.o new file mode 100644 index 0000000..4ab1dea Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleConvex.o new file mode 100644 index 0000000..8ac55ff Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleHeightField.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleHeightField.o new file mode 100644 index 0000000..a7fe93d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleHeightField.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleMesh.o new file mode 100644 index 0000000..5eb87b4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCapsuleMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexCommon.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexCommon.o new file mode 100644 index 0000000..3ea4d78 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexCommon.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexConvex.o new file mode 100644 index 0000000..d6449a2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexHeightField.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexHeightField.o new file mode 100644 index 0000000..3b96a09 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexHeightField.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexMesh.o new file mode 100644 index 0000000..29d1c35 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactConvexMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCustomGeometry.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCustomGeometry.o new file mode 100644 index 0000000..1c79467 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactCustomGeometry.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenBoxConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenBoxConvex.o new file mode 100644 index 0000000..ac95b45 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenBoxConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenSphereCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenSphereCapsule.o new file mode 100644 index 0000000..365d80d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenSphereCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenUtil.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenUtil.o new file mode 100644 index 0000000..20a9e8b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactGenUtil.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneBox.o new file mode 100644 index 0000000..b3cd80a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneCapsule.o new file mode 100644 index 0000000..de2a2dc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneConvex.o new file mode 100644 index 0000000..9a565d4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactPlaneConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereBox.o new file mode 100644 index 0000000..172f04a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereCapsule.o new file mode 100644 index 0000000..49a5ae2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereConvex.o new file mode 100644 index 0000000..cfa1bf5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereHeightField.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereHeightField.o new file mode 100644 index 0000000..a79f736 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereHeightField.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereMesh.o new file mode 100644 index 0000000..7182ac7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSpherePlane.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSpherePlane.o new file mode 100644 index 0000000..e4feaef Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSpherePlane.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereSphere.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereSphere.o new file mode 100644 index 0000000..564d1ab Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMContactSphereSphere.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMShapeConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMShapeConvex.o new file mode 100644 index 0000000..d12f7a1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMShapeConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMTriangleContactGen.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMTriangleContactGen.o new file mode 100644 index 0000000..0ee60dc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPCMTriangleContactGen.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPersistentContactManifold.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPersistentContactManifold.o new file mode 100644 index 0000000..eb282b6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/df5a4153af297152-GuPersistentContactManifold.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactBoxBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactBoxBox.o new file mode 100644 index 0000000..276e178 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactBoxBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleBox.o new file mode 100644 index 0000000..761fe46 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleCapsule.o new file mode 100644 index 0000000..49b736c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleConvex.o new file mode 100644 index 0000000..0a666e8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleMesh.o new file mode 100644 index 0000000..82bde14 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCapsuleMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexConvex.o new file mode 100644 index 0000000..0c018b7 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexMesh.o new file mode 100644 index 0000000..a550fe5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactConvexMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCustomGeometry.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCustomGeometry.o new file mode 100644 index 0000000..938c5af Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactCustomGeometry.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneBox.o new file mode 100644 index 0000000..531b225 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneCapsule.o new file mode 100644 index 0000000..74699c5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneConvex.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneConvex.o new file mode 100644 index 0000000..e8dcce2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPlaneConvex.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPolygonPolygon.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPolygonPolygon.o new file mode 100644 index 0000000..9a5b370 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactPolygonPolygon.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereBox.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereBox.o new file mode 100644 index 0000000..b1798ed Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereBox.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereCapsule.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereCapsule.o new file mode 100644 index 0000000..b1249f6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereCapsule.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereMesh.o new file mode 100644 index 0000000..c6682cc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSpherePlane.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSpherePlane.o new file mode 100644 index 0000000..77797bb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSpherePlane.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereSphere.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereSphere.o new file mode 100644 index 0000000..accc191 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuContactSphereSphere.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuFeatureCode.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuFeatureCode.o new file mode 100644 index 0000000..0419122 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/f5cb914894a65e43-GuFeatureCode.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleComponents.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleComponents.o new file mode 100644 index 0000000..80b56c5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleComponents.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive.o new file mode 100644 index 0000000..de5dcb6 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive4W.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive4W.o new file mode 100644 index 0000000..fdbeb61 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDrive4W.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveNW.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveNW.o new file mode 100644 index 0000000..2041446 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveNW.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveTank.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveTank.o new file mode 100644 index 0000000..a11434a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleDriveTank.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleMetaData.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleMetaData.o new file mode 100644 index 0000000..443b56f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleMetaData.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleNoDrive.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleNoDrive.o new file mode 100644 index 0000000..4db0053 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleNoDrive.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSDK.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSDK.o new file mode 100644 index 0000000..caca436 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSDK.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSerialization.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSerialization.o new file mode 100644 index 0000000..24c9714 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSerialization.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSuspWheelTire4.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSuspWheelTire4.o new file mode 100644 index 0000000..3558486 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleSuspWheelTire4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleTireFriction.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleTireFriction.o new file mode 100644 index 0000000..65c5373 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleTireFriction.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleUpdate.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleUpdate.o new file mode 100644 index 0000000..5b07ccf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleUpdate.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleWheels.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleWheels.o new file mode 100644 index 0000000..b0d4f33 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-PxVehicleWheels.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilControl.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilControl.o new file mode 100644 index 0000000..174c525 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilControl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilSetup.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilSetup.o new file mode 100644 index 0000000..e2ba7ff Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilSetup.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilTelemetry.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilTelemetry.o new file mode 100644 index 0000000..cbb6914 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fa8d688327424f3c-VehicleUtilTelemetry.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBVH.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBVH.o new file mode 100644 index 0000000..c80cbe8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBVH.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBigConvexDataBuilder.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBigConvexDataBuilder.o new file mode 100644 index 0000000..6e235ba Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingBigConvexDataBuilder.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullBuilder.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullBuilder.o new file mode 100644 index 0000000..b0d8d57 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullBuilder.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullLib.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullLib.o new file mode 100644 index 0000000..9bd67d2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullLib.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullUtils.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullUtils.o new file mode 100644 index 0000000..3912ae8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexHullUtils.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMesh.o new file mode 100644 index 0000000..9e37756 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMeshBuilder.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMeshBuilder.o new file mode 100644 index 0000000..b4d5de8 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexMeshBuilder.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexPolygonsBuilder.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexPolygonsBuilder.o new file mode 100644 index 0000000..af9957b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingConvexPolygonsBuilder.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingHF.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingHF.o new file mode 100644 index 0000000..36b1cae Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingHF.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingQuickHullConvexHullLib.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingQuickHullConvexHullLib.o new file mode 100644 index 0000000..cd2cd06 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingQuickHullConvexHullLib.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTetrahedronMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTetrahedronMesh.o new file mode 100644 index 0000000..75eaee3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTetrahedronMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTriangleMesh.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTriangleMesh.o new file mode 100644 index 0000000..8c2f6df Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingTriangleMesh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingVolumeIntegration.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingVolumeIntegration.o new file mode 100644 index 0000000..6f3c64d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuCookingVolumeIntegration.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuRTreeCooking.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuRTreeCooking.o new file mode 100644 index 0000000..67b54f0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fb41b98045d16b12-GuRTreeCooking.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxAutoGeneratedMetaDataObjects.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxAutoGeneratedMetaDataObjects.o new file mode 100644 index 0000000..46c0d52 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxAutoGeneratedMetaDataObjects.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxMetaDataObjects.o b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxMetaDataObjects.o new file mode 100644 index 0000000..f229670 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out/fcc728c83b9c745e-PxMetaDataObjects.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/output b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/output new file mode 100644 index 0000000..ffafdc4 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/output @@ -0,0 +1,538 @@ +OPT_LEVEL = Some("0") +TARGET = Some("x86_64-unknown-linux-gnu") +cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT +cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS +CRATE_CC_NO_DEFAULTS = None +DEBUG = Some("true") +HOST = Some("x86_64-unknown-linux-gnu") +cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-gnu +CXXFLAGS_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_gnu +CXXFLAGS_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_CXXFLAGS +HOST_CXXFLAGS = None +cargo:rerun-if-env-changed=CXXFLAGS +CXXFLAGS = None +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +exit status: 0 +cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu +AR_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu +AR_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_AR +HOST_AR = None +cargo:rerun-if-env-changed=AR +AR = None +cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu +ARFLAGS_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu +ARFLAGS_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_ARFLAGS +HOST_ARFLAGS = None +cargo:rerun-if-env-changed=ARFLAGS +ARFLAGS = None +cargo:rustc-link-lib=static=physx +cargo:rustc-link-search=native=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out +cargo:rerun-if-env-changed=CXXSTDLIB_x86_64-unknown-linux-gnu +CXXSTDLIB_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=CXXSTDLIB_x86_64_unknown_linux_gnu +CXXSTDLIB_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_CXXSTDLIB +HOST_CXXSTDLIB = None +cargo:rerun-if-env-changed=CXXSTDLIB +CXXSTDLIB = None +cargo:rustc-link-lib=stdc++ +TARGET = Some("x86_64-unknown-linux-gnu") +cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT +cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS +CRATE_CC_NO_DEFAULTS = None +HOST = Some("x86_64-unknown-linux-gnu") +cargo:rerun-if-env-changed=CXXFLAGS_x86_64-unknown-linux-gnu +CXXFLAGS_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=CXXFLAGS_x86_64_unknown_linux_gnu +CXXFLAGS_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_CXXFLAGS +HOST_CXXFLAGS = None +cargo:rerun-if-env-changed=CXXFLAGS +CXXFLAGS = None +cargo:rerun-if-env-changed=AR_x86_64-unknown-linux-gnu +AR_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=AR_x86_64_unknown_linux_gnu +AR_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_AR +HOST_AR = None +cargo:rerun-if-env-changed=AR +AR = None +cargo:rerun-if-env-changed=ARFLAGS_x86_64-unknown-linux-gnu +ARFLAGS_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=ARFLAGS_x86_64_unknown_linux_gnu +ARFLAGS_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_ARFLAGS +HOST_ARFLAGS = None +cargo:rerun-if-env-changed=ARFLAGS +ARFLAGS = None +cargo:rustc-link-lib=static=physx_api +cargo:rustc-link-search=native=/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out +cargo:rerun-if-env-changed=CXXSTDLIB_x86_64-unknown-linux-gnu +CXXSTDLIB_x86_64-unknown-linux-gnu = None +cargo:rerun-if-env-changed=CXXSTDLIB_x86_64_unknown_linux_gnu +CXXSTDLIB_x86_64_unknown_linux_gnu = None +cargo:rerun-if-env-changed=HOST_CXXSTDLIB +HOST_CXXSTDLIB = None +cargo:rerun-if-env-changed=CXXSTDLIB +CXXSTDLIB = None +cargo:rustc-link-lib=stdc++ +cargo:rerun-if-changed=src/physx_generated.hpp +cargo:rerun-if-changed=src/physx_generated.rs +cargo:rerun-if-changed=src/physx_api.cpp +cargo:rerun-if-changed=physx/physx/include/foundation/PxPhysicsVersion.h diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/root-output b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/root-output new file mode 100644 index 0000000..df4eddc --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/root-output @@ -0,0 +1 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/out \ No newline at end of file diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/stderr b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-577acca7a1f237f0/stderr new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build-script-build b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build-script-build new file mode 100644 index 0000000..dd16389 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build-script-build differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11 b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11 new file mode 100644 index 0000000..dd16389 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11 differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11.d b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11.d new file mode 100644 index 0000000..809b6fd --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11.d @@ -0,0 +1,41 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11: build.rs sources/common sources/fastxml sources/lowlevelaabb sources/lowleveldynamics sources/pvd sources/scenequery sources/simulationcontroller sources/task sources/foundation sources/foundation_unix sources/foundation_windows sources/lowlevel_pipeline sources/lowlevel_software sources/vehicle sources/vehicle_metadata sources/extensions sources/extensions_serialization sources/extensions_xml sources/extensions_binary sources/extensions_tet sources/physxcharacterkinematic sources/geomutils sources/geomutils_ccd sources/geomutils_common sources/geomutils_contact sources/geomutils_convex sources/geomutils_cooking sources/geomutils_distance sources/geomutils_gjk sources/geomutils_hf sources/geomutils_intersection sources/geomutils_mesh sources/geomutils_pcm sources/geomutils_sweep sources/cooking sources/core + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/build/physx-sys-8f3c236339c37e11/build_script_build-8f3c236339c37e11.d: build.rs sources/common sources/fastxml sources/lowlevelaabb sources/lowleveldynamics sources/pvd sources/scenequery sources/simulationcontroller sources/task sources/foundation sources/foundation_unix sources/foundation_windows sources/lowlevel_pipeline sources/lowlevel_software sources/vehicle sources/vehicle_metadata sources/extensions sources/extensions_serialization sources/extensions_xml sources/extensions_binary sources/extensions_tet sources/physxcharacterkinematic sources/geomutils sources/geomutils_ccd sources/geomutils_common sources/geomutils_contact sources/geomutils_convex sources/geomutils_cooking sources/geomutils_distance sources/geomutils_gjk sources/geomutils_hf sources/geomutils_intersection sources/geomutils_mesh sources/geomutils_pcm sources/geomutils_sweep sources/cooking sources/core + +build.rs: +sources/common: +sources/fastxml: +sources/lowlevelaabb: +sources/lowleveldynamics: +sources/pvd: +sources/scenequery: +sources/simulationcontroller: +sources/task: +sources/foundation: +sources/foundation_unix: +sources/foundation_windows: +sources/lowlevel_pipeline: +sources/lowlevel_software: +sources/vehicle: +sources/vehicle_metadata: +sources/extensions: +sources/extensions_serialization: +sources/extensions_xml: +sources/extensions_binary: +sources/extensions_tet: +sources/physxcharacterkinematic: +sources/geomutils: +sources/geomutils_ccd: +sources/geomutils_common: +sources/geomutils_contact: +sources/geomutils_convex: +sources/geomutils_cooking: +sources/geomutils_distance: +sources/geomutils_gjk: +sources/geomutils_hf: +sources/geomutils_intersection: +sources/geomutils_mesh: +sources/geomutils_pcm: +sources/geomutils_sweep: +sources/cooking: +sources/core: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/bitflags-f6c2a11e00f54c4f.d b/modules/PhysX/physx/physx-sys/target/debug/deps/bitflags-f6c2a11e00f54c4f.d new file mode 100644 index 0000000..bd2cad0 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/bitflags-f6c2a11e00f54c4f.d @@ -0,0 +1,7 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rmeta: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rlib: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/bitflags-f6c2a11e00f54c4f.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/cc-1bbb76d873e4f57f.d b/modules/PhysX/physx/physx-sys/target/debug/deps/cc-1bbb76d873e4f57f.d new file mode 100644 index 0000000..51d9d4a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/cc-1bbb76d873e4f57f.d @@ -0,0 +1,18 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rmeta: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/async_executor.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/job_token.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/stderr.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/find_tools.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/command_helpers.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tool.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/target_info.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tempfile.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/detect_compiler_family.c + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rlib: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/async_executor.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/job_token.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/stderr.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/find_tools.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/command_helpers.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tool.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/target_info.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tempfile.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/detect_compiler_family.c + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/cc-1bbb76d873e4f57f.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/async_executor.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/job_token.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/stderr.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/find_tools.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/command_helpers.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tool.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/target_info.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tempfile.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/detect_compiler_family.c + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/lib.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/async_executor.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/job_token.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/parallel/stderr.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/windows/find_tools.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/command_helpers.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tool.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/target_info.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/tempfile.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cc-1.0.99/src/detect_compiler_family.c: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/jobserver-fdd14c5ab8a10f26.d b/modules/PhysX/physx/physx-sys/target/debug/deps/jobserver-fdd14c5ab8a10f26.d new file mode 100644 index 0000000..02b1b05 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/jobserver-fdd14c5ab8a10f26.d @@ -0,0 +1,9 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rmeta: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/error.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/unix.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rlib: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/error.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/unix.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/jobserver-fdd14c5ab8a10f26.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/error.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/unix.rs + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/lib.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/error.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jobserver-0.1.31/src/unix.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rlib b/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rlib new file mode 100644 index 0000000..4698d7a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rmeta b/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rmeta new file mode 100644 index 0000000..c58119f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libbitflags-f6c2a11e00f54c4f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libc-fc575165ea81cc67.d b/modules/PhysX/physx/physx-sys/target/debug/deps/libc-fc575165ea81cc67.d new file mode 100644 index 0000000..c2c5bf1 --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/libc-fc575165ea81cc67.d @@ -0,0 +1,23 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rmeta: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/macros.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/fixed_width_ints.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/generic/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/non_exhaustive.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/align.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rlib: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/macros.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/fixed_width_ints.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/generic/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/non_exhaustive.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/align.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libc-fc575165ea81cc67.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/macros.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/fixed_width_ints.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/generic/mod.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/align.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/non_exhaustive.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/align.rs + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/lib.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/macros.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/fixed_width_ints.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/align.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/arch/generic/mod.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/align.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/non_exhaustive.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/align.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rlib b/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rlib new file mode 100644 index 0000000..6e2b4d2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rlib differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rmeta b/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rmeta new file mode 100644 index 0000000..3a20b55 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libcc-1bbb76d873e4f57f.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rlib b/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rlib new file mode 100644 index 0000000..0025d62 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rlib differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rmeta b/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rmeta new file mode 100644 index 0000000..826d098 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libjobserver-fdd14c5ab8a10f26.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rlib b/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rlib new file mode 100644 index 0000000..1a591be Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rlib differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rmeta b/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rmeta new file mode 100644 index 0000000..05376ea Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/liblibc-fc575165ea81cc67.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rlib b/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rlib new file mode 100644 index 0000000..eabfdcf Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rlib differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rmeta b/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rmeta new file mode 100644 index 0000000..42c2acb Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rmeta differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/once_cell-15255e9cea695494.d b/modules/PhysX/physx/physx-sys/target/debug/deps/once_cell-15255e9cea695494.d new file mode 100644 index 0000000..3a4de8a --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/once_cell-15255e9cea695494.d @@ -0,0 +1,9 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rmeta: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/imp_std.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/race.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libonce_cell-15255e9cea695494.rlib: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/imp_std.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/race.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/once_cell-15255e9cea695494.d: /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/imp_std.rs /home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/race.rs + +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/lib.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/imp_std.rs: +/home/kuju/.cargo/registry/src/index.crates.io-6f17d22bba15001f/once_cell-1.19.0/src/race.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/deps/physx_sys.d b/modules/PhysX/physx/physx-sys/target/debug/deps/physx_sys.d new file mode 100644 index 0000000..f0c689c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/deps/physx_sys.d @@ -0,0 +1,7 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/libphysx_sys.so: src/lib.rs src/generated/unix/structgen.rs src/physx_generated.rs + +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/deps/physx_sys.d: src/lib.rs src/generated/unix/structgen.rs src/physx_generated.rs + +src/lib.rs: +src/generated/unix/structgen.rs: +src/physx_generated.rs: diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0htknkjcu2zg88dno50r72lxt.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0htknkjcu2zg88dno50r72lxt.o new file mode 100644 index 0000000..f8e11a9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0htknkjcu2zg88dno50r72lxt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0ik0zo3jsp44gix4cipuq5ba4.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0ik0zo3jsp44gix4cipuq5ba4.o new file mode 100644 index 0000000..45445fc Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0ik0zo3jsp44gix4cipuq5ba4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0lmw3b6yzut2yhyqj34me0dgc.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0lmw3b6yzut2yhyqj34me0dgc.o new file mode 100644 index 0000000..ca758ef Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/0lmw3b6yzut2yhyqj34me0dgc.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/13b4osjt9pngbjd49loijydal.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/13b4osjt9pngbjd49loijydal.o new file mode 100644 index 0000000..27f5fe1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/13b4osjt9pngbjd49loijydal.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/19i2xbuu8pipkwkuezbv7f6j9.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/19i2xbuu8pipkwkuezbv7f6j9.o new file mode 100644 index 0000000..3d73379 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/19i2xbuu8pipkwkuezbv7f6j9.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/1iczjsgpdehzqxmpxsyipik5x.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/1iczjsgpdehzqxmpxsyipik5x.o new file mode 100644 index 0000000..62d12d5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/1iczjsgpdehzqxmpxsyipik5x.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2oyuu1a2gis9c9p35m48ds3u2.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2oyuu1a2gis9c9p35m48ds3u2.o new file mode 100644 index 0000000..4061026 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2oyuu1a2gis9c9p35m48ds3u2.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2q4tdanpxq8awnji0wx6yoc35.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2q4tdanpxq8awnji0wx6yoc35.o new file mode 100644 index 0000000..72dacfe Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2q4tdanpxq8awnji0wx6yoc35.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2wh1enuy792xcypgmo5o1ies4.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2wh1enuy792xcypgmo5o1ies4.o new file mode 100644 index 0000000..2d24053 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2wh1enuy792xcypgmo5o1ies4.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2xygt5s9wxdnkf67x0llzzf65.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2xygt5s9wxdnkf67x0llzzf65.o new file mode 100644 index 0000000..76d1b61 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/2xygt5s9wxdnkf67x0llzzf65.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/349og2gpf4uur9nigtrh0savy.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/349og2gpf4uur9nigtrh0savy.o new file mode 100644 index 0000000..659487e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/349og2gpf4uur9nigtrh0savy.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/3r11bd2398lhadv388nq5gwuq.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/3r11bd2398lhadv388nq5gwuq.o new file mode 100644 index 0000000..a54c0d9 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/3r11bd2398lhadv388nq5gwuq.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/47ro1tezklm5m8yybubqwffks.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/47ro1tezklm5m8yybubqwffks.o new file mode 100644 index 0000000..77a47b5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/47ro1tezklm5m8yybubqwffks.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/48nglzkrihnmzhi6k9xuce2q6.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/48nglzkrihnmzhi6k9xuce2q6.o new file mode 100644 index 0000000..396c5aa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/48nglzkrihnmzhi6k9xuce2q6.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/51dytn4bplt0te8cqku0zkowu.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/51dytn4bplt0te8cqku0zkowu.o new file mode 100644 index 0000000..fed208a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/51dytn4bplt0te8cqku0zkowu.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5shtwp917ape6h9q1tgsa8gjp.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5shtwp917ape6h9q1tgsa8gjp.o new file mode 100644 index 0000000..f94bfca Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5shtwp917ape6h9q1tgsa8gjp.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5yi5q05mmbdznsesv01o7w2a9.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5yi5q05mmbdznsesv01o7w2a9.o new file mode 100644 index 0000000..9cae070 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/5yi5q05mmbdznsesv01o7w2a9.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/67g9bqvfe00dinolh40irn6tt.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/67g9bqvfe00dinolh40irn6tt.o new file mode 100644 index 0000000..fcd2828 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/67g9bqvfe00dinolh40irn6tt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/6x70o2sjueizn4bjads2frl7x.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/6x70o2sjueizn4bjads2frl7x.o new file mode 100644 index 0000000..c731bb0 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/6x70o2sjueizn4bjads2frl7x.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/71gest2lwmo7t2hieqmjn4123.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/71gest2lwmo7t2hieqmjn4123.o new file mode 100644 index 0000000..6605b7c Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/71gest2lwmo7t2hieqmjn4123.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/7e7if3a1j2az1j5mc9pkxnzvt.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/7e7if3a1j2az1j5mc9pkxnzvt.o new file mode 100644 index 0000000..236b2a2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/7e7if3a1j2az1j5mc9pkxnzvt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8c8y18h58c5dqnkiwh226ckfk.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8c8y18h58c5dqnkiwh226ckfk.o new file mode 100644 index 0000000..27deb20 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8c8y18h58c5dqnkiwh226ckfk.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8gmd78ikcpjen6lzdiou7etjj.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8gmd78ikcpjen6lzdiou7etjj.o new file mode 100644 index 0000000..6317b95 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8gmd78ikcpjen6lzdiou7etjj.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ji1fm8le3qe5e4ljhp5vozkp.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ji1fm8le3qe5e4ljhp5vozkp.o new file mode 100644 index 0000000..a4eb3ef Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ji1fm8le3qe5e4ljhp5vozkp.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8p6bcctgtxnpa2zhzscupz903.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8p6bcctgtxnpa2zhzscupz903.o new file mode 100644 index 0000000..e7abe11 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8p6bcctgtxnpa2zhzscupz903.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8pn9e093w9a1168yge1e5w739.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8pn9e093w9a1168yge1e5w739.o new file mode 100644 index 0000000..74f7cee Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8pn9e093w9a1168yge1e5w739.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8rjuzivdz8qdrg5fjmv5243go.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8rjuzivdz8qdrg5fjmv5243go.o new file mode 100644 index 0000000..d943f6e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8rjuzivdz8qdrg5fjmv5243go.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ua9m184o0f1kr7a8eqh6vvh0.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ua9m184o0f1kr7a8eqh6vvh0.o new file mode 100644 index 0000000..2303558 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/8ua9m184o0f1kr7a8eqh6vvh0.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/91mpxhby1zpronz9ufpxr9335.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/91mpxhby1zpronz9ufpxr9335.o new file mode 100644 index 0000000..6e53b20 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/91mpxhby1zpronz9ufpxr9335.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/92rkjblizwoyeznyzdnqemixs.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/92rkjblizwoyeznyzdnqemixs.o new file mode 100644 index 0000000..aeaa978 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/92rkjblizwoyeznyzdnqemixs.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9jxdo9ra4pa4mzudn0rz64zcl.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9jxdo9ra4pa4mzudn0rz64zcl.o new file mode 100644 index 0000000..c5fe069 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9jxdo9ra4pa4mzudn0rz64zcl.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9y45oa4sunrnsud06lxom8q3n.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9y45oa4sunrnsud06lxom8q3n.o new file mode 100644 index 0000000..c2ecd82 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/9y45oa4sunrnsud06lxom8q3n.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a4hycau8pelz6bc8bzic1afgr.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a4hycau8pelz6bc8bzic1afgr.o new file mode 100644 index 0000000..87d0900 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a4hycau8pelz6bc8bzic1afgr.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a5xwq7x8wofwq2ez9v8ntrlbm.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a5xwq7x8wofwq2ez9v8ntrlbm.o new file mode 100644 index 0000000..0f18cf4 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/a5xwq7x8wofwq2ez9v8ntrlbm.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ad7ib3cla7107079v898zrdk9.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ad7ib3cla7107079v898zrdk9.o new file mode 100644 index 0000000..41e1790 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ad7ib3cla7107079v898zrdk9.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/b97pit5eyb3fbek3g083pya9v.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/b97pit5eyb3fbek3g083pya9v.o new file mode 100644 index 0000000..9b960b1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/b97pit5eyb3fbek3g083pya9v.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/bdqxx9evayvst1m5bibsykehp.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/bdqxx9evayvst1m5bibsykehp.o new file mode 100644 index 0000000..f35fd5e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/bdqxx9evayvst1m5bibsykehp.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c1tkqapri6d6qs03emm9wjh9l.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c1tkqapri6d6qs03emm9wjh9l.o new file mode 100644 index 0000000..7f8dfc2 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c1tkqapri6d6qs03emm9wjh9l.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c5b4y6twjlpads9ilor2z64pt.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c5b4y6twjlpads9ilor2z64pt.o new file mode 100644 index 0000000..ec184f1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c5b4y6twjlpads9ilor2z64pt.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c6pspnhmgaa9pz2rmi15xlfav.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c6pspnhmgaa9pz2rmi15xlfav.o new file mode 100644 index 0000000..d24c1a1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c6pspnhmgaa9pz2rmi15xlfav.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c7i8b0d8chtpf30pymzmgudyw.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c7i8b0d8chtpf30pymzmgudyw.o new file mode 100644 index 0000000..06ce0c3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/c7i8b0d8chtpf30pymzmgudyw.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc1vzvj7j8ex4w7h0rfdrg1qx.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc1vzvj7j8ex4w7h0rfdrg1qx.o new file mode 100644 index 0000000..7e36ae3 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc1vzvj7j8ex4w7h0rfdrg1qx.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc4mx86m9yorzp8iv80op83ky.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc4mx86m9yorzp8iv80op83ky.o new file mode 100644 index 0000000..5e6dbed Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/cc4mx86m9yorzp8iv80op83ky.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ccr0y9ptxrj7rowtcj394zes9.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ccr0y9ptxrj7rowtcj394zes9.o new file mode 100644 index 0000000..1073dd5 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ccr0y9ptxrj7rowtcj394zes9.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/clzg6g7n9dzbhcwp4exomz2ct.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/clzg6g7n9dzbhcwp4exomz2ct.o new file mode 100644 index 0000000..dfbb455 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/clzg6g7n9dzbhcwp4exomz2ct.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/coy2kaq95yllzdt3vrcsth2ya.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/coy2kaq95yllzdt3vrcsth2ya.o new file mode 100644 index 0000000..86beb5d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/coy2kaq95yllzdt3vrcsth2ya.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d4g4kfwz140467vlmq9lnksjh.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d4g4kfwz140467vlmq9lnksjh.o new file mode 100644 index 0000000..4d5dd6d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d4g4kfwz140467vlmq9lnksjh.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d95fhqkdglw8h86s4e9mn9uzo.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d95fhqkdglw8h86s4e9mn9uzo.o new file mode 100644 index 0000000..f744ea1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d95fhqkdglw8h86s4e9mn9uzo.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d9fevvom1vs7tw4fdqlltif1c.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d9fevvom1vs7tw4fdqlltif1c.o new file mode 100644 index 0000000..a3523df Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/d9fevvom1vs7tw4fdqlltif1c.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dep-graph.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dep-graph.bin new file mode 100644 index 0000000..cd9540b Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dep-graph.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dw2k5h6j5yqikrds0ws2j7gud.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dw2k5h6j5yqikrds0ws2j7gud.o new file mode 100644 index 0000000..d61314e Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/dw2k5h6j5yqikrds0ws2j7gud.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/edzkxo6fuee2vwdtwizl1gwnr.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/edzkxo6fuee2vwdtwizl1gwnr.o new file mode 100644 index 0000000..5505702 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/edzkxo6fuee2vwdtwizl1gwnr.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ezq7bd9epjgfntz990fe0l10i.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ezq7bd9epjgfntz990fe0l10i.o new file mode 100644 index 0000000..9814dc1 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/ezq7bd9epjgfntz990fe0l10i.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/query-cache.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/query-cache.bin new file mode 100644 index 0000000..aed7d4f Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/query-cache.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/work-products.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/work-products.bin new file mode 100644 index 0000000..c41a178 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k-3iu4ftdwh8hnwforvyhp2edv9/work-products.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k.lock b/modules/PhysX/physx/physx-sys/target/debug/incremental/build_script_build-2ziwrydq6kv6m/s-gz1d1lyk0n-1445a3k.lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/bj3td9wiwsvtv5o2m3m8q57ot.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/bj3td9wiwsvtv5o2m3m8q57ot.o new file mode 100644 index 0000000..5001c3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/bj3td9wiwsvtv5o2m3m8q57ot.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/dep-graph.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/dep-graph.bin new file mode 100644 index 0000000..7a54efa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/dep-graph.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/query-cache.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/query-cache.bin new file mode 100644 index 0000000..680ec04 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/query-cache.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/work-products.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/work-products.bin new file mode 100644 index 0000000..fcc0084 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9-2fgj0ttltmbn77vpcmidmekyv/work-products.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9.lock b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d1468vc-1c8rrl9.lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/bj3td9wiwsvtv5o2m3m8q57ot.o b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/bj3td9wiwsvtv5o2m3m8q57ot.o new file mode 100644 index 0000000..5001c3d Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/bj3td9wiwsvtv5o2m3m8q57ot.o differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.bin new file mode 100644 index 0000000..7a54efa Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.part.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.part.bin new file mode 100644 index 0000000..68f330a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/dep-graph.part.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/query-cache.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/query-cache.bin new file mode 100644 index 0000000..680ec04 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/query-cache.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/work-products.bin b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/work-products.bin new file mode 100644 index 0000000..fcc0084 Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0-working/work-products.bin differ diff --git a/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0.lock b/modules/PhysX/physx/physx-sys/target/debug/incremental/physx_sys-13l1cmmfm522p/s-gz1d7x4d0f-1rzdil0.lock new file mode 100644 index 0000000..e69de29 diff --git a/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.d b/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.d new file mode 100644 index 0000000..5b5427c --- /dev/null +++ b/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.d @@ -0,0 +1 @@ +/mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/target/debug/libphysx_sys.so: /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/build.rs /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/physx/physx/include/foundation/PxPhysicsVersion.h /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/common /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/cooking /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/core /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/extensions /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/extensions_binary /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/extensions_serialization /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/extensions_tet /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/extensions_xml /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/fastxml /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/foundation /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/foundation_unix /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/foundation_windows /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_ccd /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_common /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_contact /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_convex /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_cooking /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_distance /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_gjk /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_hf /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_intersection /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_mesh /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_pcm /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/geomutils_sweep /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/lowlevel_pipeline /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/lowlevel_software /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/lowlevelaabb /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/lowleveldynamics /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/physxcharacterkinematic /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/pvd /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/scenequery /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/simulationcontroller /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/task /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/vehicle /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/sources/vehicle_metadata /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/generated/unix/structgen.rs /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/lib.rs /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_api.cpp /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_generated.hpp /mnt/c/Users/Kuju/Projects/JaiPhysX/physx/physx-sys/src/physx_generated.rs diff --git a/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.so b/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.so new file mode 100644 index 0000000..f63324a Binary files /dev/null and b/modules/PhysX/physx/physx-sys/target/debug/libphysx_sys.so differ diff --git a/modules/PhysX/windows/physx.dll b/modules/PhysX/windows/physx.dll new file mode 100644 index 0000000..8afa5d7 Binary files /dev/null and b/modules/PhysX/windows/physx.dll differ diff --git a/modules/PhysX/windows/physx.lib b/modules/PhysX/windows/physx.lib new file mode 100644 index 0000000..cc7e665 Binary files /dev/null and b/modules/PhysX/windows/physx.lib differ diff --git a/physics/physx.jai b/physics/physx.jai new file mode 100644 index 0000000..a399680 --- /dev/null +++ b/physics/physx.jai @@ -0,0 +1,120 @@ +init_physx :: () { + default_allocator = PhysX.get_default_allocator(); + default_error_callback = PhysX.get_default_error_callback(); + + foundation := PhysX.PxCreateFoundation(PhysX.PX_PHYSICS_VERSION, *default_allocator, *default_error_callback); + if foundation == null { + log_error("Could not initialize PhysX\n"); + return; + } + + pvd := PhysX.PxCreatePvd(foundation); + transport := PhysX.PxDefaultPvdSocketTransportCreate("127.0.0.1", 5425, 10); + PhysX.PxPvd_connect(pvd, transport, cast(u8)PhysX.PxPvdInstrumentationFlags.ALL); + + tolerance_scale : PhysX.PxTolerancesScale; + tolerance_scale.length = 100; + tolerance_scale.speed = 981; + physics = PhysX.PxCreatePhysics(PhysX.PX_PHYSICS_VERSION, foundation, *tolerance_scale, true, pvd, null); + + dispatcher = PhysX.PxDefaultCpuDispatcherCreate(2); + material = PhysX.PxPhysics_createMaterial(physics, 0.5, 0.5, 0.6); +} + +tick_physx :: (scene: *PhysX.PxScene, dt: float) { + PhysX.PxScene_simulate(scene, dt, null, null, 0, false); + PhysX.PxScene_fetchResults(scene, true, null); +} + +create_physx_scene :: () -> *PhysX.PxScene { + tolerance_scale : PhysX.PxTolerancesScale; + tolerance_scale.length = 100; + tolerance_scale.speed = 981; + + scene_desc := PhysX.PxSceneDesc_new(*tolerance_scale); + scene_desc.gravity.y = -9.81; + + scene_desc.cpuDispatcher = xx dispatcher; + PhysX.set_default_filter_shader(*scene_desc); + scene := PhysX.PxPhysics_createScene(physics, *scene_desc); + + // @Incomplete: If debug + pvd_client := PhysX.PxScene_getScenePvdClient(scene); + if pvd_client { + PhysX.PxPvdSceneClient_setScenePvdFlag(pvd_client, xx PhysX.PxPvdSceneFlag.TRANSMIT_CONSTRAINTS, true); + PhysX.PxPvdSceneClient_setScenePvdFlag(pvd_client, xx PhysX.PxPvdSceneFlag.TRANSMIT_CONTACTS, true); + PhysX.PxPvdSceneClient_setScenePvdFlag(pvd_client, xx PhysX.PxPvdSceneFlag.TRANSMIT_SCENEQUERIES, true); + //PhysX.PxScene_setVisualizationParameter(scene, 0, 1.0); + //PhysX.PxScene_setVisualizationParameter(scene, 1, 2.0); + } +{ + plane := PhysX.PxPlane_new(0.0,-1.0,0.0,50.0); + ground_plane := PhysX.PxCreatePlane(physics, *plane, material); + PhysX.PxScene_addActor(scene, ground_plane, null); +} + +{ + plane := PhysX.PxPlane_new(0.0,-1.0,0.0,50.0); + ground_plane := PhysX.PxCreatePlane(physics, *plane, material); + PhysX.PxScene_addActor(scene, ground_plane, null); +} + +{ + plane := PhysX.PxPlane_new(0.0,-1.0,0.0,50.0); + ground_plane := PhysX.PxCreatePlane(physics, *plane, material); + PhysX.PxScene_addActor(scene, ground_plane, null); +} + +{ + plane := PhysX.PxPlane_new(0.0,-1.0,0.0,50.0); + ground_plane := PhysX.PxCreatePlane(physics, *plane, material); + PhysX.PxScene_addActor(scene, ground_plane, null); +} + + stack_z := 10.0; + for i: 0..4 { + stack_pos := Vector3.{0,100,stack_z}; + stack_z -= 10.0; + create_stack(scene, PhysX.PxTransform_new(*stack_pos), 10, 2.0); + } + + return scene; +} + +create_stack :: (scene: *PhysX.PxScene, t: PhysX.PxTransform, size: u32, half_extent: float) { + shape := PhysX.PxPhysics_createShape(physics, PhysX.PxBoxGeometry_new(half_extent, half_extent, half_extent), material, false, 0); + for i: 0..size-1 { + for j: 0..size-i-1 { + pos := Vector3.{cast(float)(j*2) - cast(float)(size-i), cast(float)(i*2+1), 0} * half_extent; + local_tm := PhysX.PxTransform_new(*pos); + + body := PhysX.PxPhysics_createRigidDynamic(physics, *PhysX.PxTransform_transform(*t, *local_tm)); + PhysX.PxRigidActor_attachShape(body, shape); + PhysX.PxRigidBodyExt_updateMassAndInertia(body, 10., null, false); + PhysX.PxScene_addActor(scene, body, null); + } + } + //shape->release(); +} + + +create_dynamic :: (scene: *PhysX.PxScene, t: PhysX.PxTransform, geometry: PhysX.PxGeometry, velocity: Vector3 = .{}) -> *PhysX.PxRigidDynamic { + p := Vector3.{0,0,0}; + dynamic := PhysX.PxCreateDynamic(physics, *t, *geometry, material, 10.0, *PhysX.PxTransform_new(cast(s32)PhysX.PxIDENTITY.PxIdentity)); + PhysX.PxRigidBody_setAngularDamping(dynamic, 0.5); + PhysX.PxRigidDynamic_setLinearVelocity(dynamic, *velocity, true); + PhysX.PxScene_addActor(scene, dynamic, null); + return dynamic; +} + +PhysX :: #import "PhysX"; + +#scope_file + +physics : *PhysX.PxPhysics; +material : *PhysX.PxMaterial; +default_allocator : PhysX.PxAllocatorCallback; +default_error_callback : PhysX.PxErrorCallback; +default_filter_shader : PhysX.SimulationFilterShader; +dispatcher : *PhysX.PxDefaultCpuDispatcher; + diff --git a/renderer/engine_buffers.jai b/renderer/engine_buffers.jai index 85c88c2..fd45437 100644 --- a/renderer/engine_buffers.jai +++ b/renderer/engine_buffers.jai @@ -44,70 +44,6 @@ calc_tight_light_projection :: (camera: Camera, light_direction: Vector3) -> Mat return light_projection * light_view; } -calculate_sun_transform :: (camera: Camera, light_direction: Vector3) -> Matrix4 { - success, inv_viewproj := inverse(camera.projection_matrix * camera.view_matrix); - - view : Matrix4; - proj : Matrix4; - - ndc : [8] Vector4 = .[ - .{-1, -1, 0, 1}, .{1, -1, 0, 1}, .{-1, 1, 0, 1}, .{1, 1, 0, 1}, // near plane - .{-1, -1, 1, 1}, .{1, -1, 1, 1}, .{-1, 1, 1, 1}, .{1, 1, 1, 1} // far plane - ]; - - corners : [8] Vector3; - center : Vector3; - - for i: 0..7 { - world := inv_viewproj * ndc[i]; - corners[i] = world.xyz / world.w; - center += corners[i]; - } - - center /= 8.0; - - { - // Build light basis - forward := normalize(-light_direction); - up := ifx abs(forward.y) > 0.99 then Vector3.{0, 0, 1} else .{0, 1, 0}; - right := normalize(cross(up, forward)); - up = cross(forward, right); - - // Build view matrix manually (row-major layout) - view = Matrix4_Identity; - view.v[0] = Vector4.{right.x, right.y, right.z, 0.0}; - view.v[1] = Vector4.{up.x, up.y, up.z, 0.0}; - view.v[2] = Vector4.{forward.x, forward.y, forward.z, 0.0}; - view.v[3] = Vector4.{-dot(right, center), - -dot(up, center), - -dot(forward, center), - 1.0}; - } - - { - min_bounds : Vector3 = .{FLOAT32_MAX, FLOAT32_MAX, FLOAT32_MAX}; - max_bounds : Vector3 = .{-FLOAT32_MAX, -FLOAT32_MAX, -FLOAT32_MAX}; - - for i: 0..7 { - ls := transform_position(corners[i], view); - min_bounds = min(min_bounds, ls); - max_bounds = max(max_bounds, ls); - } - - // Step 5: Build orthographic projection (DX11 Z: 0..1) - left := min_bounds.x; - right := max_bounds.x; - bottom := min_bounds.y; - top := max_bounds.y; - near_z := min_bounds.z; - far_z := max_bounds.z; - - proj = orthographic_lh_projection_matrix(left, right, bottom, top, near_z, far_z); - } - - return proj * view; -} - update_light_buffer :: () { scene := engine.current_scene;